Keep only base/extractor.[cc|h].

Change-Id: I2fd15eeae9fcba3f33d10317bba92634959860d8
Reviewed-on: https://chromium-review.googlesource.com/220982
Reviewed-by: Jack Hou <jackhou@chromium.org>
Commit-Queue: Jack Hou <jackhou@chromium.org>
Tested-by: Jack Hou <jackhou@chromium.org>
Reviewed-by: Ben Wells <benwells@chromium.org>
Commit-Queue: Ben Wells <benwells@chromium.org>
diff --git a/COPYING b/COPYING
deleted file mode 100644
index d645695..0000000
--- a/COPYING
+++ /dev/null
@@ -1,202 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
diff --git a/VERSION b/VERSION
deleted file mode 100644
index 608225a..0000000
--- a/VERSION
+++ /dev/null
@@ -1,11 +0,0 @@
-# -*- Python -*-
-
-# update these manually - don't autogenerate, autoincrement, etc.
-# REMEMBER TO INCREMENT BUILD BY TWO! BUILD SHOULD ALWAYS BE ODD!
-version_major = 1    # 1-65535
-version_minor = 3    # 0-65535
-version_build = 23   # 1-65535
-version_patch = 0    # 0-65535
-
-oneclick_plugin_version = 9
-update_plugin_version = 3
diff --git a/__init__.py b/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/__init__.py
+++ /dev/null
diff --git a/base/ATLRegMapEx.h b/base/ATLRegMapEx.h
deleted file mode 100644
index 8e79394..0000000
--- a/base/ATLRegMapEx.h
+++ /dev/null
@@ -1,325 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Extension to DECLARE_REGISTRY_RESOURCEID that makes adding stuff to
-// your reg file as simple as using an atl macro map.
-//
-// Adapted from http://thecodeproject.com/atl/RegistryMap.asp
-/*
- * Defines a 'registry' map for adding variables to rgs files.
- * Original Code Copyright 2001-2003 Michael Geddes.  All rights reserved.
- * Modified Code Copyright 2005 Google Inc.
- */
-
-/* use this as your RGS file -- remove or add parameters as you see fit
-//
-// The ATL registrar requires single quotes to be escaped in substitution data
-// enclosed in single quotes in the RGS file. Since the registry map is not
-// aware of which data fields are quoted, to err on the side of caution, all
-// _ATL_REGMAP_ENTRYKeeper constructors escape szData. It is also important to
-// enclose all substitutions in RGS files in single quotes, as shown in the
-// example here:
-
-HKCR
-{
-  '%PROGID%.%VERSION%' = s '%DESCRIPTION%'
-  {
-    CLSID = s '%CLSID%'
-  }
-  '%PROGID%' = s '%DESCRIPTION%'
-  {
-    CLSID = s '%CLSID%'
-    CurVer = s '%PROGID%.%VERSION%'
-  }
-  NoRemove CLSID
-  {
-    ForceRemove '%CLSID%' = s '%DESCRIPTION%'
-    {
-      ProgID = s '%PROGID%.%VERSION%'
-       VersionIndependentProgID = s '%PROGID%'
-      ForceRemove 'Programmable'
-      InprocServer32 = s '%MODULE%'
-      {
-        val ThreadingModel = s '%THREADING%'
-      }
-      'TypeLib' = s '%LIBID%'
-    }
-  }
-}
-
-*/
-
-#ifndef OMAHA_BASE_ATLREGMAPEX_H__
-#define OMAHA_BASE_ATLREGMAPEX_H__
-
-#include <atlbase.h>
-#include <atlconv.h>
-#include <atlstr.h>
-#include "omaha/base/app_util.h"
-#include "omaha/base/error.h"
-#include "omaha/base/path.h"
-#include "omaha/base/statregex.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-struct _ATL_REGMAP_ENTRYKeeper : public _ATL_REGMAP_ENTRY {
-  // Returns a new Olestr that needs to be freed by caller.
-  LPCOLESTR NewKeyOlestr(LPCTSTR tstr)  {
-    CT2COLE olestr(tstr);
-    int alloc_length = lstrlen(olestr) + 1;
-    LPOLESTR new_olestr =  new OLECHAR[alloc_length];
-    if (new_olestr) {
-      lstrcpyn(new_olestr, olestr, alloc_length);
-    }
-    return new_olestr;
-  }
-
-  // Escapes single quotes and returns a new Olestr that needs to be freed by
-  // caller.
-  LPCOLESTR NewDataOlestr(LPCTSTR tstr)  {
-    CT2COLE olestr(tstr);
-
-    CStringW escaped_str;
-    int alloc_length = lstrlen(olestr) * 2 + 1;
-    ATL::CAtlModule::EscapeSingleQuote(CStrBufW(escaped_str, alloc_length),
-                                       alloc_length,
-                                       olestr);
-
-    alloc_length = escaped_str.GetLength() + 1;
-    LPOLESTR new_escaped_str =  new OLECHAR[alloc_length];
-    if (new_escaped_str) {
-      lstrcpyn(new_escaped_str, escaped_str, alloc_length);
-    }
-    return new_escaped_str;
-  }
-
-  _ATL_REGMAP_ENTRYKeeper() {
-    szKey = NULL;
-    szData = NULL;
-  }
-
-  // REGMAP_ENTRY(x, y)
-  _ATL_REGMAP_ENTRYKeeper(LPCTSTR key_tstr, LPCWSTR data_tstr)  {
-    szKey = NewKeyOlestr(key_tstr);
-    szData = NewDataOlestr(CW2T(data_tstr));
-  }
-
-  // REGMAP_ENTRY(x, y)
-  _ATL_REGMAP_ENTRYKeeper(LPCTSTR key_tstr, LPCSTR data_tstr)  {
-    szKey = NewKeyOlestr(key_tstr);
-    szData = NewDataOlestr(CA2T(data_tstr));
-  }
-
-  // REGMAP_MODULE(x)
-  explicit _ATL_REGMAP_ENTRYKeeper(LPCTSTR key_tstr) {
-    szKey = NewKeyOlestr(key_tstr);
-    szData = NewDataOlestr(EnclosePathIfExe(app_util::GetCurrentModulePath()));
-  }
-
-  // REGMAP_MODULE2(x, modulename)
-  _ATL_REGMAP_ENTRYKeeper(LPCTSTR key_tstr,
-                          LPCTSTR module_name_tstr,
-                          bool /* is_relative_to_current_module */)  {
-    szKey = NewKeyOlestr(key_tstr);
-    szData = NULL;
-
-    CStringW full_module_name(app_util::GetCurrentModuleDirectory());
-    full_module_name += _T("\\");
-    full_module_name += module_name_tstr;
-    szData = NewDataOlestr(EnclosePathIfExe(full_module_name));
-  }
-
-  // REGMAP_EXE_MODULE(x)
-  _ATL_REGMAP_ENTRYKeeper(LPCTSTR key_tstr,
-                          bool /* is_current_exe_module */)  {
-    szKey = NewKeyOlestr(key_tstr);
-    szData = NewDataOlestr(EnclosePathIfExe(app_util::GetModulePath(NULL)));
-  }
-
-  // REGMAP_RESOURCE(x, resid)
-  _ATL_REGMAP_ENTRYKeeper(LPCTSTR key_tstr, UINT resid, bool /* resource */)  {
-    szKey = NewKeyOlestr(key_tstr);
-    CStringW res_name;
-    BOOL success = res_name.LoadString(resid);
-    ATLASSERT(success);
-    szData = NewDataOlestr(res_name);
-  }
-
-  // REGMAP_UUID(x, clsid)
-  _ATL_REGMAP_ENTRYKeeper(LPCTSTR key_tstr, REFGUID guid)  {
-    szKey = NewKeyOlestr(key_tstr);
-    szData = NewDataOlestr(GuidToString(guid));
-  }
-
-  ~_ATL_REGMAP_ENTRYKeeper()  {
-    delete [] szKey;
-    delete [] szData;
-  }
-
-  // This method is mostly the same as the atlmfc_vc80 version of
-  // ATL::CAtlModule::UpdateRegistryFromResourceS. The only functional change
-  // is that it uses omaha::RegObject instead of ATL::CRegObject.
-  static HRESULT UpdateRegistryFromResourceEx(
-      UINT nResID, BOOL bRegister, struct _ATL_REGMAP_ENTRY* pMapEntries) {
-    RegObject ro;
-    HRESULT hr = ro.FinalConstruct();
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    if (pMapEntries != NULL) {
-      while (pMapEntries->szKey != NULL) {
-        ASSERT1(NULL != pMapEntries->szData);
-        ro.AddReplacement(pMapEntries->szKey, pMapEntries->szData);
-        pMapEntries++;
-      }
-    }
-
-    hr = ATL::_pAtlModule->AddCommonRGSReplacements(&ro);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    USES_CONVERSION_EX;
-    TCHAR szModule[MAX_PATH];
-    HINSTANCE hInst = _AtlBaseModule.GetModuleInstance();
-    DWORD dwFLen = ::GetModuleFileName(hInst, szModule, MAX_PATH);
-    if (dwFLen == 0) {
-      return HRESULTFromLastError();
-    } else if (dwFLen == MAX_PATH) {
-      return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
-    }
-
-    LPOLESTR pszModule = NULL;
-    pszModule = T2OLE_EX(szModule, _ATL_SAFE_ALLOCA_DEF_THRESHOLD);
-    OLECHAR pszModuleUnquoted[_MAX_PATH * 2];  // NOLINT
-    ATL::CAtlModule::EscapeSingleQuote(pszModuleUnquoted,
-                                       _countof(pszModuleUnquoted),
-                                       pszModule);
-
-    HRESULT hRes;
-    if ((hInst == NULL) || (hInst == GetModuleHandle(NULL))) {
-      // If Registering as an EXE, then we quote the resultant path.
-      // We don't do it for a DLL, because LoadLibrary fails if the path is
-      // quoted
-      OLECHAR pszModuleQuote[(_MAX_PATH + _ATL_QUOTES_SPACE) * 2];  // NOLINT
-      pszModuleQuote[0] = OLESTR('\"');
-      if (!ocscpy_s(pszModuleQuote + 1, (_MAX_PATH + _ATL_QUOTES_SPACE) * 2 - 1,
-                    pszModuleUnquoted)) {
-        return E_FAIL;
-      }
-
-      size_t nLen = ocslen(pszModuleQuote);
-      pszModuleQuote[nLen] = OLESTR('\"');
-      pszModuleQuote[nLen + 1] = 0;
-
-      hRes = ro.AddReplacement(OLESTR("Module"), pszModuleQuote);
-    } else {
-      hRes = ro.AddReplacement(OLESTR("Module"), pszModuleUnquoted);
-    }
-
-    if (FAILED(hRes)) {
-      return hRes;
-    }
-
-    hRes = ro.AddReplacement(OLESTR("Module_Raw"), pszModuleUnquoted);
-    if (FAILED(hRes)) {
-      return hRes;
-    }
-
-    LPCOLESTR szType = OLESTR("REGISTRY");
-    hr = bRegister ? ro.ResourceRegister(pszModule, nResID, szType) :
-                     ro.ResourceUnregister(pszModule, nResID, szType);
-    return hr;
-  }
-};
-
-// This now supports DECLARE_OLEMISC_STATUS()
-#define BEGIN_REGISTRY_MAP()                                                \
-  __if_exists(_GetMiscStatus) {                                             \
-    static LPCTSTR _GetMiscStatusString()  {                                \
-      static TCHAR misc_string[32] = {0}                                    \
-      if (!misc_string[0])  {                                               \
-        wsprintf(misc_string, _T("%d"), _GetMiscStatus());                  \
-      }                                                                     \
-                                                                            \
-      return misc_string;                                                   \
-    }                                                                       \
-  }                                                                         \
-                                                                            \
-  static struct _ATL_REGMAP_ENTRY *_GetRegistryMap() {                      \
-    static const _ATL_REGMAP_ENTRYKeeper map[] = {                          \
-      __if_exists(_GetMiscStatusString) {                                   \
-        _ATL_REGMAP_ENTRYKeeper(_T("OLEMISC"), _GetMiscStatusString()),     \
-      }                                                                     \
-      __if_exists(GetAppIdT) {                                              \
-        _ATL_REGMAP_ENTRYKeeper(_T("APPID"), GetAppIdT()),                  \
-      }                                                                     \
-
-#define REGMAP_ENTRY(x, y) _ATL_REGMAP_ENTRYKeeper((x), (y)),
-
-#define REGMAP_RESOURCE(x, resid) _ATL_REGMAP_ENTRYKeeper((x), (resid), true),
-
-#define REGMAP_UUID(x, clsid) _ATL_REGMAP_ENTRYKeeper((x), (clsid)),
-
-// Add in an entry with key x, and value being the current module path.
-// For example, REGMAP_MODULE("foo"), with the current module being
-// "goopdate.dll" will result in the entry:
-// "foo", "{blah}\\Google\\Update\\1.2.71.7\\goopdate.dll"
-#define REGMAP_MODULE(x) _ATL_REGMAP_ENTRYKeeper((x)),
-
-// Add in an entry with key x, and value being modulename, fully qualified with
-// the current module path. For example, REGMAP_MODULE2("foo", "npClick7.dll")
-// with the current module being "goopdate.dll" will result in the entry:
-// "foo", "{blah}\\Google\\Update\\1.2.71.7\\npClick7.dll"
-#define REGMAP_MODULE2(x, modulename)                                       \
-    _ATL_REGMAP_ENTRYKeeper((x), (modulename), true),
-
-// Add in an entry with key x, and value being the currently running EXE's
-// module path. For example, REGMAP_EXE_MODULE("foo"), with the current process
-// being googleupdate.exe will result in the entry:
-// "foo", "{blah}\\Google\\Update\\googleupdate.exe"
-#define REGMAP_EXE_MODULE(x) _ATL_REGMAP_ENTRYKeeper((x), true),
-
-#define END_REGISTRY_MAP() _ATL_REGMAP_ENTRYKeeper()                        \
-    };                                                                      \
-    return (_ATL_REGMAP_ENTRY *)map;  /* NOLINT */                          \
-  }
-
-#define DECLARE_REGISTRY_RESOURCEID_EX(x)                                   \
-  static HRESULT WINAPI UpdateRegistry(BOOL reg) {                          \
-    return _ATL_REGMAP_ENTRYKeeper::UpdateRegistryFromResourceEx(           \
-        (UINT)(x), (reg), _GetRegistryMap());                               \
-}
-
-#define DECLARE_REGISTRY_APPID_RESOURCEID_EX(resid, appid)                  \
-  static LPCOLESTR GetAppId() throw() {                                     \
-    static const CStringW app_id(appid);                                    \
-    return app_id;                                                          \
-  }                                                                         \
-  static LPCTSTR GetAppIdT() throw() {                                      \
-    return GetAppId();                                                      \
-  }                                                                         \
-  static HRESULT WINAPI UpdateRegistryAppId(BOOL reg) throw() {             \
-    return _ATL_REGMAP_ENTRYKeeper::UpdateRegistryFromResourceEx(           \
-        resid, (reg), _GetRegistryMap());                                   \
-  }
-// END registry map
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_ATLREGMAPEX_H__
-
diff --git a/base/accounts.cc b/base/accounts.cc
deleted file mode 100644
index d196fb1..0000000
--- a/base/accounts.cc
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Enumeration of the user accounts on the PC.
-
-#include "omaha/base/accounts.h"
-
-#include <sddl.h>
-#include "base/basictypes.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/reg_key.h"
-
-namespace omaha {
-
-namespace accounts {
-
-const wchar_t kActiveProfilesKey[] =
-    L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList";
-
-HRESULT GetAllUserSids(CSimpleArray<CString> *sid_array) {
-  ASSERT(sid_array, (L""));
-
-  RegKey key_profiles;
-  HRESULT hr = key_profiles.Open(HKEY_LOCAL_MACHINE, kActiveProfilesKey);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  sid_array->RemoveAll();
-
-  uint32 total_keys = key_profiles.GetSubkeyCount();
-
-  for (uint32 i = 0 ; i < total_keys ; ++i) {
-    CString possible_user_sid, name, domain;
-    SID_NAME_USE user_type;
-
-    if (SUCCEEDED(key_profiles.GetSubkeyNameAt(i, &possible_user_sid))) {
-      if (SUCCEEDED(GetUserInfo(possible_user_sid, &name,
-                                &domain, &user_type)) &&
-          user_type == SidTypeUser) {
-        sid_array->Add(possible_user_sid);
-      }
-    }
-  }
-
-  return hr;
-}
-
-HRESULT GetUserInfo(const wchar_t *sid_str, CString *name,
-                    CString *domain, SID_NAME_USE *user_type) {
-  ASSERT(sid_str, (L""));
-  ASSERT(name, (L""));
-  ASSERT(domain, (L""));
-  ASSERT(user_type, (L""));
-
-  PSID sid = NULL;
-  HRESULT ret = E_FAIL;
-  if (ConvertStringSidToSid(sid_str, &sid)) {
-    DWORD name_size = 0, domain_size = 0;
-    if (!LookupAccountSid(NULL, sid, NULL, &name_size, NULL,
-                          &domain_size, user_type) &&
-        ERROR_INSUFFICIENT_BUFFER != GetLastError()) {
-      ret = GetCurError();
-      LocalFree(sid);
-      return ret;
-    }
-
-    ASSERT(name_size, (L""));
-    ASSERT(domain_size, (L""));
-    if (!domain_size || !name_size) {
-      LocalFree(sid);
-      return E_UNEXPECTED;
-    }
-
-    wchar_t* c_name = new wchar_t[name_size];
-    ASSERT(c_name, (L""));
-    if (!c_name) {
-      LocalFree(sid);
-      return E_OUTOFMEMORY;
-    }
-
-    wchar_t* c_domain = new wchar_t[domain_size];
-    ASSERT(c_domain, (L""));
-    if (!c_domain) {
-      delete[] c_name;
-      LocalFree(sid);
-      return E_OUTOFMEMORY;
-    }
-
-    if (LookupAccountSid(NULL, sid, c_name, &name_size, c_domain,
-                         &domain_size, user_type)) {
-      ret = S_OK;
-      name->SetString(c_name);
-      domain->SetString(c_domain);
-    } else {
-      ret = GetCurError();
-    }
-
-    delete[] c_name;
-    delete[] c_domain;
-    LocalFree(sid);
-  }
-
-  return ret;
-}
-
-}  // namespace accounts
-
-}  // namespace omaha
-
diff --git a/base/accounts.h b/base/accounts.h
deleted file mode 100644
index 26c713d..0000000
--- a/base/accounts.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-// Enumeration of the user accounts on the PC.
-
-#ifndef OMAHA_COMMON_ACCOUNTS_H__
-#define OMAHA_COMMON_ACCOUNTS_H__
-
-#include <windows.h>
-#include <atlcoll.h>
-#include <atlstr.h>
-
-namespace omaha {
-
-namespace accounts {
-
-// Populates sid_array with string SIDs for all users, that have profiles
-// on PC. Includes only user SIDs, no groups, computers or aliases.
-HRESULT GetAllUserSids(CSimpleArray<CString>* sid_array);
-
-// Looks up account info for given SID.
-// sid - SID to look up account info for.
-// On success populates:
-// name - name on the account
-// domain - domain name for account
-// user_type - the type of the passed SID, possible values:
-//   SidTypeUser
-//   SidTypeGroup
-//   SidTypeDomain
-//   SidTypeAlias
-//   SidTypeWellKnownGroup
-//   SidTypeDeletedAccount
-//   SidTypeInvalid
-//   SidTypeUnknown
-//   SidTypeComputer
-HRESULT GetUserInfo(const wchar_t* sid,
-                    CString* name,
-                    CString* domain,
-                    SID_NAME_USE* user_type);
-
-}  // namespace accounts
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_ACCOUNTS_H__
diff --git a/base/app_util.cc b/base/app_util.cc
deleted file mode 100644
index 81b7080..0000000
--- a/base/app_util.cc
+++ /dev/null
@@ -1,252 +0,0 @@
-// Copyright 2003-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/app_util.h"
-#include <shlwapi.h>
-#include <atlsecurity.h>
-#include <vector>
-#include "omaha/base/cgi.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/file_ver.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/path.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-namespace app_util {
-
-HMODULE GetModuleHandleFromAddress(void* address) {
-  MEMORY_BASIC_INFORMATION mbi = {0};
-  DWORD result = ::VirtualQuery(address, &mbi, sizeof(mbi));
-  ASSERT1(result == sizeof(mbi));
-  return static_cast<HMODULE>(mbi.AllocationBase);
-}
-
-HMODULE GetCurrentModuleHandle() {
-  return GetModuleHandleFromAddress(GetCurrentModuleHandle);
-}
-
-
-CString GetModulePath(HMODULE module_handle) {
-  ASSERT1(IsModuleHandleValid(module_handle));
-  CString mod_path;
-
-  DWORD result = ::GetModuleFileName(module_handle,
-                                     mod_path.GetBufferSetLength(MAX_PATH),
-                                     MAX_PATH);
-  mod_path.ReleaseBuffer();
-  ASSERT1(result == static_cast<DWORD>(mod_path.GetLength()));
-
-  return mod_path;
-}
-
-CString GetModuleDirectory(HMODULE module_handle) {
-  ASSERT1(IsModuleHandleValid(module_handle));
-  return GetDirectoryFromPath(GetModulePath(module_handle));
-}
-
-CString GetModuleName(HMODULE module_handle) {
-  ASSERT1(IsModuleHandleValid(module_handle));
-  CString app_name(GetFileFromPath(GetModulePath(module_handle)));
-
-  UTIL_LOG(L5, (_T("[GetModuleName][module 0x%08x][path '%s'][name '%s']"),
-                module_handle, GetModulePath(module_handle), app_name));
-
-  return app_name;
-}
-
-CString GetModuleNameWithoutExtension(HMODULE module_handle) {
-  ASSERT1(IsModuleHandleValid(module_handle));
-  CString module_name(GetPathRemoveExtension(GetModuleName(module_handle)));
-
-  UTIL_LOG(L5, (_T("[GetModuleNameWithoutExtension]")
-                _T("[module 0x%08x][module '%s'][name '%s']"),
-                module_handle, GetModulePath(module_handle), module_name));
-
-  return module_name;
-}
-
-CString GetCurrentModulePath() {
-  return GetModulePath(GetCurrentModuleHandle());
-}
-
-CString GetCurrentModuleDirectory() {
-  return GetModuleDirectory(GetCurrentModuleHandle());
-}
-
-CString GetCurrentModuleName() {
-  return GetModuleName(GetCurrentModuleHandle());
-}
-
-CString GetCurrentModuleNameWithoutExtension() {
-  return GetModuleNameWithoutExtension(GetCurrentModuleHandle());
-}
-
-bool IsAddressInCurrentModule(void* address) {
-  return GetCurrentModuleHandle() == GetModuleHandleFromAddress(address);
-}
-
-CString GetHostName() {
-  CString hostName;
-  DWORD name_len = MAX_COMPUTERNAME_LENGTH + 1;
-  bool result = !!::GetComputerName(hostName.GetBufferSetLength(name_len),
-                                    &name_len);
-  ASSERT1(result);
-  hostName.ReleaseBuffer();
-  ASSERT1(name_len == static_cast<DWORD>(hostName.GetLength()));
-
-  return hostName;
-}
-
-CString GetWindowsDir() {
-  CString windows_path;
-
-  DWORD result = ::GetWindowsDirectory(
-      windows_path.GetBufferSetLength(MAX_PATH), MAX_PATH);
-  windows_path.ReleaseBuffer();
-  ASSERT1(result == static_cast<DWORD>(windows_path.GetLength()));
-
-  return windows_path;
-}
-
-CString GetSystemDir() {
-  CString systemPath;
-
-  DWORD result = ::GetSystemDirectory(systemPath.GetBufferSetLength(MAX_PATH),
-                                      MAX_PATH);
-  systemPath.ReleaseBuffer();
-  ASSERT1(result == static_cast<DWORD>(systemPath.GetLength()));
-
-  return systemPath;
-}
-
-CString GetTempDir() {
-  CString tempPath;
-
-  DWORD result = ::GetTempPath(MAX_PATH, tempPath.GetBufferSetLength(MAX_PATH));
-  tempPath.ReleaseBuffer();
-  ASSERT1(result == static_cast<DWORD>(tempPath.GetLength()));
-
-  return tempPath;
-}
-
-bool IsModuleHandleValid(HMODULE module_handle) {
-  if (!module_handle) {
-    return true;
-  }
-  return module_handle == GetModuleHandleFromAddress(module_handle);
-}
-
-DWORD DllGetVersion(const CString& dll_path)  {
-  HINSTANCE hInst = ::GetModuleHandle(dll_path);
-  ASSERT(hInst,
-         (_T("[GetModuleHandle failed][%s][%d]"), dll_path, ::GetLastError()));
-  DWORD dwVersion = 0;
-  DLLGETVERSIONPROC pfn = reinterpret_cast<DLLGETVERSIONPROC>(
-                              ::GetProcAddress(hInst, "DllGetVersion"));
-  if (pfn != NULL) {
-    DLLVERSIONINFO dvi = {0};
-    dvi.cbSize = sizeof(dvi);
-    HRESULT hr = (*pfn)(&dvi);
-    if (SUCCEEDED(hr)) {
-      // Since we're fitting both the major and minor versions into a DWORD,
-      // let's sanity check that we're not in an overflow situation here
-      ASSERT1(dvi.dwMajorVersion <= 0xFFFF);
-      ASSERT1(dvi.dwMinorVersion <= 0xFFFF);
-      dwVersion = MAKELONG(dvi.dwMinorVersion, dvi.dwMajorVersion);
-    }
-  }
-  return dwVersion;
-}
-
-DWORD SystemDllGetVersion(const TCHAR* dll_name)  {
-  ASSERT1(dll_name);
-  CString full_dll_path(String_MakeEndWith(GetSystemDir(), _T("\\"), false) +
-                        dll_name);
-  ASSERT1(File::Exists(full_dll_path));
-  return DllGetVersion(full_dll_path);
-}
-
-ULONGLONG GetVersionFromModule(HMODULE instance) {
-  TCHAR module_path[MAX_PATH] = {0};
-  if (!::GetModuleFileName(instance, module_path, MAX_PATH) != 0) {
-    return 0;
-  }
-
-  return GetVersionFromFile(module_path);
-}
-
-ULONGLONG GetVersionFromFile(const CString& file_path) {
-  FileVer existing_file_ver;
-  if (!existing_file_ver.Open(file_path)) {
-    return 0;
-  }
-
-  return existing_file_ver.GetFileVersionAsULONGLONG();
-}
-
-// Returns a temporary dir for the impersonated user and an empty string if
-// the user is not impersonated or an error occurs.
-CString GetTempDirForImpersonatedUser() {
-  CAccessToken access_token;
-  if (!access_token.GetThreadToken(TOKEN_READ)) {
-    return NULL;
-  }
-
-  CString temp_dir;
-  if (::ExpandEnvironmentStringsForUser(access_token.GetHandle(),
-                                        _T("%TMP%"),
-                                        CStrBuf(temp_dir, MAX_PATH),
-                                        MAX_PATH)) {
-    return temp_dir;
-  }
-  if (::ExpandEnvironmentStringsForUser(access_token.GetHandle(),
-                                        _T("%TEMP%"),
-                                        CStrBuf(temp_dir, MAX_PATH),
-                                        MAX_PATH)) {
-    return temp_dir;
-  }
-
-  const int kCsIdl = CSIDL_LOCAL_APPDATA | CSIDL_FLAG_DONT_VERIFY;
-  if (SUCCEEDED(GetFolderPath(kCsIdl, &temp_dir)) &&
-    ::PathAppend(CStrBuf(temp_dir, MAX_PATH), LOCAL_APPDATA_REL_TEMP_DIR)) {
-    return temp_dir;
-  }
-
-  return NULL;
-}
-
-
-CString GetTempDirForImpersonatedOrCurrentUser() {
-  CString temp_dir_for_impersonated_user(GetTempDirForImpersonatedUser());
-  if (!temp_dir_for_impersonated_user.IsEmpty()) {
-    CStrBuf string_buffer(temp_dir_for_impersonated_user, MAX_PATH);
-    if (::PathAddBackslash(string_buffer)) {
-      return temp_dir_for_impersonated_user;
-    }
-  }
-  return app_util::GetTempDir();
-}
-
-}  // namespace app_util
-
-}  // namespace omaha
-
diff --git a/base/app_util.h b/base/app_util.h
deleted file mode 100644
index e4d103a..0000000
--- a/base/app_util.h
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright 2003-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Utility functions for getting app and module information.
-
-#ifndef OMAHA_BASE_APP_UTIL_H_
-#define OMAHA_BASE_APP_UTIL_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-#include "omaha/base/constants.h"
-
-namespace omaha {
-
-namespace app_util {
-
-// Gets the handle to the module containing the given executing address.
-HMODULE GetModuleHandleFromAddress(void* address);
-
-// Gets the handle to the currently executing module.
-HMODULE GetCurrentModuleHandle();
-
-// Gets the path of the loaded module.
-// If module_handle == NULL returns the path of the current executable.
-CString GetModulePath(HMODULE module_handle);
-
-// Gets the directory of the specified module
-// Returns the part of the module path, before the last '\'.
-// Returns the dir from where the module was loaded (could be exe or dll).
-CString GetModuleDirectory(HMODULE module_handle);
-
-// Gets the name of the specified module
-// Returns the part of the module path, after the last '\'.
-CString GetModuleName(HMODULE module_handle);
-
-// Gets the name of the specified module without the extension.
-CString GetModuleNameWithoutExtension(HMODULE module_handle);
-
-// Gets the current app name (i.e. exe name).
-CString GetAppName();
-
-// Gets the current app name without the extension.
-CString GetAppNameWithoutExtension();
-
-// Gets the current module path
-// returns the path from where the module was loaded (could be exe or dll).
-CString GetCurrentModulePath();
-
-// Gets the current module directory
-// returns the dir from where the module was loaded (could be exe or dll).
-CString GetCurrentModuleDirectory();
-
-// Gets the current module name.
-CString GetCurrentModuleName();
-
-// Gets the current module name without the extension.
-CString GetCurrentModuleNameWithoutExtension();
-
-// Checks if the given address is in the current module.
-bool IsAddressInCurrentModule(void* address);
-
-// Gets the host machine name.
-CString GetHostName();
-
-// Gets the Windows directory.
-CString GetWindowsDir();
-
-// Gets the System directory.
-CString GetSystemDir();
-
-// Gets the TEMP directory for the current user. The directory path ends
-// with a '\'.
-CString GetTempDir();
-
-// Gets a temporary directory for the impersonated user. Returns the temporary
-// directory of the process if the caller is not impersonated or an error
-// occurs. The directory path ends with a '\'.
-CString GetTempDirForImpersonatedOrCurrentUser();
-
-// Helper that gets us the version of a DLL in a DWORD format,
-// with the major and minor versions squeezed into it.
-DWORD DllGetVersion(const CString& dll_path);
-
-// Helper that gets us the version of a System DLL in a DWORD format,
-// with the major and minor versions squeezed into it. The assumption
-// is that the dll_name is only a name, and not a path. Using this
-// function (over DllGetVersion directly) for System DLLs is recommended
-// from a security perspective.
-// However, this may not work for DLLs that are loaded from the side-by-side
-// location (WinSxS) instead of the system directory.
-DWORD SystemDllGetVersion(const TCHAR* dll_name);
-
-// Gets the version from a module.
-ULONGLONG GetVersionFromModule(HMODULE instance);
-
-// Gets the version from a file path.
-ULONGLONG GetVersionFromFile(const CString& file_path);
-
-// Helper to check if a module handle is valid.
-bool IsModuleHandleValid(HMODULE module_handle);
-
-inline CString GetAppName() {
-  return GetModuleName(NULL);
-}
-
-inline CString GetAppNameWithoutExtension() {
-  return GetModuleNameWithoutExtension(NULL);
-}
-
-}  // namespace app_util
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_APP_UTIL_H_
-
diff --git a/base/app_util_unittest.cc b/base/app_util_unittest.cc
deleted file mode 100644
index ca938f0..0000000
--- a/base/app_util_unittest.cc
+++ /dev/null
@@ -1,147 +0,0 @@
-// Copyright 2004-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <atlpath.h>
-#include "omaha/base/app_util.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/file.h"
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/testing/unit_test.h"
-
-const TCHAR* const kKernel32Name  = L"kernel32.dll";
-const TCHAR* const kShell32Name   = L"shell32.dll";
-const TCHAR* const kComCtl32Name  = L"comctl32.dll";
-
-namespace omaha {
-
-namespace app_util {
-
-TEST(AppUtilTest, AppUtil) {
-  HMODULE module = NULL;
-  CString name;
-  struct Local {
-    static void Func() {}
-  };
-
-  // First test the functionality for EXE applications.
-
-  // Test the app name.
-  name = GetAppName();
-  EXPECT_STREQ(kUnittestName, name);
-
-  // Test the module name.
-  name = GetCurrentModuleName();
-  EXPECT_STREQ(kUnittestName, name);
-
-  // Test the app name w/o extension.
-  name = GetAppNameWithoutExtension() + L".exe";
-  EXPECT_STREQ(kUnittestName, name);
-
-  // Test the module name w/o extension.
-  name = GetCurrentModulePath();
-  EXPECT_STREQ(GetCurrentModuleDirectory() + L"\\" + kUnittestName, name);
-
-  // Test the module path and directory.
-  name = GetCurrentModuleName();
-  EXPECT_STREQ(kUnittestName, name);
-
-  // Test an address.
-  module = GetCurrentModuleHandle();
-  EXPECT_TRUE(IsAddressInCurrentModule(module + 0x1));
-  EXPECT_TRUE(IsAddressInCurrentModule(&Local::Func));
-  EXPECT_FALSE(IsAddressInCurrentModule(reinterpret_cast<void*>(0x1)));
-
-  // Test the functionality for DLL modules.
-  // Use kernel32.dll
-
-  // Get the loading address of kernel32.
-  HMODULE kernel32Module = ::LoadLibrary(kKernel32Name);
-  EXPECT_TRUE(kernel32Module != NULL);
-
-  // Test the dll module handle using an address.
-  module = GetModuleHandleFromAddress(::ReadFile);
-  EXPECT_EQ(kernel32Module, module);
-
-  CString system_path;
-  EXPECT_SUCCEEDED(GetFolderPath(CSIDL_SYSTEMX86, &system_path));
-
-  // Test the dll module directory.
-  name = GetModuleDirectory(module);
-  EXPECT_EQ(0, name.CompareNoCase(system_path));
-
-  // Test the dll module path.
-  name = GetModulePath(module);
-  EXPECT_EQ(0, name.CompareNoCase(system_path + L"\\" + kKernel32Name));
-
-  // Test the dll module name.
-  name = GetModuleName(module);
-  EXPECT_EQ(0, name.CompareNoCase(kKernel32Name));
-
-  // Other checks.
-  EXPECT_FALSE(GetWindowsDir().IsEmpty());
-  EXPECT_FALSE(GetHostName().IsEmpty());
-  EXPECT_FALSE(GetTempDir().IsEmpty());
-  EXPECT_TRUE(String_EndsWith(GetTempDir(), _T("\\"), false));
-
-  // DLL versioning.
-  // For the tests to succeed, shell32.dll must be loaded in memory.
-  HMODULE shell32Module = ::LoadLibrary(kShell32Name);
-  EXPECT_NE(0, DllGetVersion(GetSystemDir() + L"\\" + kShell32Name));
-  EXPECT_NE(0, DllGetVersion(kShell32Name));
-  EXPECT_NE(0, SystemDllGetVersion(kShell32Name));
-
-  // For the tests to succeed, comctl32.dll must be loaded in memory.
-  // ComCtl32 may be loaded from a side-by-side (WinSxS) directory, so it is not
-  // practical to do a full-path or SystemDllGetVersion test with it.
-  HMODULE comctl32_module = ::LoadLibrary(kComCtl32Name);
-  EXPECT_NE(0, DllGetVersion(kComCtl32Name));
-
-  // kernel32 does not export DllGetVersion.
-  EXPECT_EQ(0, SystemDllGetVersion(kKernel32Name));
-
-  // Module clean-up.
-  EXPECT_TRUE(::FreeLibrary(comctl32_module));
-  EXPECT_TRUE(::FreeLibrary(shell32Module));
-  EXPECT_TRUE(::FreeLibrary(kernel32Module));
-}
-
-TEST(AppUtilTest, GetVersionFromModule) {
-  EXPECT_EQ(OMAHA_BUILD_VERSION, GetVersionFromModule(NULL));
-}
-
-TEST(AppUtilTest, GetVersionFromFile) {
-  CPath goopdate_path(GetCurrentModuleDirectory());
-  ASSERT_TRUE(goopdate_path.Append(kUnittestName));
-  ASSERT_TRUE(File::Exists(goopdate_path));
-
-  EXPECT_EQ(OMAHA_BUILD_VERSION, GetVersionFromFile(goopdate_path));
-}
-
-TEST(AppUtilTest, GetTempDirForImpersonatedOrCurrentUser) {
-  // The behavior should be the same when the code is not running impersonated.
-  EXPECT_STREQ(GetTempDir(), GetTempDirForImpersonatedOrCurrentUser());
-
-  // The behavior should be the same when the code impersonates as self.
-  EXPECT_TRUE(::ImpersonateSelf(SecurityImpersonation));
-  EXPECT_STREQ(GetTempDir(), GetTempDirForImpersonatedOrCurrentUser());
-
-  EXPECT_TRUE(::RevertToSelf());
-}
-
-}  // namespace app_util
-
-}  // namespace omaha
diff --git a/base/apply_tag.cc b/base/apply_tag.cc
deleted file mode 100644
index e6bc6e8..0000000
--- a/base/apply_tag.cc
+++ /dev/null
@@ -1,244 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Applies a tag to a signed file.
-
-#include "omaha/base/apply_tag.h"
-#include <atlrx.h>
-#include <vector>
-#include "base/scoped_ptr.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/extractor.h"
-
-namespace omaha {
-
-const char kMagicBytes[] = "Gact";
-const uint32 kPEHeaderOffset = 60;
-
-ApplyTag::ApplyTag()
-    : prev_tag_string_length_(0),
-      prev_cert_length_(0),
-      append_(0) {}
-
-bool ApplyTag::IsValidTagString(const char* tag_string) {
-  ASSERT1(tag_string);
-
-  CAtlRegExp<CAtlRECharTraitsA> regex;
-  REParseError error = regex.Parse(kValidTagStringRegEx);
-  if (error != REPARSE_ERROR_OK) {
-    return false;
-  }
-
-  CAtlREMatchContext<CAtlRECharTraitsA> context;
-  return !!regex.Match(tag_string, &context);
-}
-
-HRESULT ApplyTag::Init(const TCHAR* signed_exe_file,
-                       const char* tag_string,
-                       int tag_string_length,
-                       const TCHAR* tagged_file,
-                       bool append) {
-  ASSERT1(signed_exe_file);
-  ASSERT1(tag_string);
-  ASSERT1(tagged_file);
-
-  signed_exe_file_ = signed_exe_file;
-  tagged_file_ = tagged_file;
-  append_ = append;
-
-  // Check the tag_string for invalid characters.
-  if (!IsValidTagString(tag_string)) {
-    return E_INVALIDARG;
-  }
-
-  for (int i = 0; i < tag_string_length; ++i) {
-    tag_string_.push_back(tag_string[i]);
-  }
-
-  return S_OK;
-}
-
-HRESULT ApplyTag::EmbedTagString() {
-  std::vector<byte> input_file_buffer;
-  HRESULT hr = ReadEntireFile(signed_exe_file_, 0, &input_file_buffer);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  ASSERT1(!input_file_buffer.empty());
-  VERIFY1(ReadExistingTag(&input_file_buffer));
-  if (!append_ && prev_tag_string_length_) {
-    // If there is a previous tag and the append flag is not set, then
-    // we should error out.
-    return APPLYTAG_E_ALREADY_TAGGED;
-  }
-
-  if (!CreateBufferToWrite()) {
-    return E_FAIL;
-  }
-
-  // The input_file_buffer might contain the previously read tag, in which
-  // case the buffer_data_ is larger than the actual output buffer length.
-  // The real output buffer length is returned by the ApplyTagToBuffer
-  // method.
-  buffer_data_.resize(input_file_buffer.size() + tag_buffer_.size());
-
-  copy(input_file_buffer.begin(),
-       input_file_buffer.end(),
-       buffer_data_.begin());
-
-  int output_length = 0;
-  if (!ApplyTagToBuffer(&output_length))
-    return E_FAIL;
-
-  std::vector<byte> output_buffer(output_length);
-  ASSERT1(static_cast<size_t>(output_length) <= buffer_data_.size());
-  copy(buffer_data_.begin(),
-       buffer_data_.begin() + output_length,
-       output_buffer.begin());
-  return WriteEntireFile(tagged_file_, output_buffer);
-}
-
-uint32 ApplyTag::GetUint32(const void* p) {
-  ASSERT1(p);
-
-  const uint32* pu = reinterpret_cast<const uint32*>(p);
-  return *pu;
-}
-
-void ApplyTag::PutUint32(uint32 i, void* p) {
-  ASSERT1(p);
-
-  uint32* pu = reinterpret_cast<uint32*>(p);
-  *pu = i;
-}
-
-bool ApplyTag::ReadExistingTag(std::vector<byte>* binary) {
-  ASSERT1(binary);
-
-  int len = 0;
-  TagExtractor tag;
-  char* bin = reinterpret_cast<char*>(&binary->front());
-  ASSERT1(bin);
-  if (tag.ExtractTag(bin, binary->size(), NULL, &len)) {
-    prev_tag_string_.resize(len);
-    if (tag.ExtractTag(bin, binary->size(), &prev_tag_string_.front(), &len)) {
-      // The extractor returns the actual length
-      // of the string + 1 for the terminating null.
-      prev_tag_string_length_ = len - 1;
-    }
-  }
-
-  // Set the existing certificate length even if previous
-  // tag does not exist.
-  prev_cert_length_ = tag.cert_length();
-  return true;
-}
-
-bool ApplyTag::CreateBufferToWrite() {
-  ASSERT1(!append_ && !prev_tag_string_length_ || append_);
-  ASSERT1(!tag_string_.empty());
-  ASSERT1(!prev_tag_string_.size() ||
-          prev_tag_string_.size() ==
-          static_cast<size_t>(prev_tag_string_length_ + 1));
-
-  // Build the tag buffer.
-  // The format of the tag buffer is:
-  // 000000-000003: 4-byte magic (big-endian)
-  // 000004-000005: unsigned 16-bit int string length (big-endian)
-  // 000006-??????: ASCII string
-  int tag_string_len = tag_string_.size() + prev_tag_string_length_;
-  int kMagicBytesLen = ::lstrlenA(kMagicBytes);
-  int tag_header_len = kMagicBytesLen + 2;
-  int unpadded_tag_buffer_len = tag_string_len + tag_header_len;
-  // The tag buffer should be padded to multiples of 8, otherwise it will
-  // break the signature of the executable file.
-  int padded_tag_buffer_length = (unpadded_tag_buffer_len + 15) & (-8);
-
-  tag_buffer_.clear();
-  tag_buffer_.resize(padded_tag_buffer_length, 0);
-  memcpy(&tag_buffer_.front(), kMagicBytes, kMagicBytesLen);
-  tag_buffer_[kMagicBytesLen] =
-      static_cast<char>((tag_string_len & 0xff00) >> 8);
-  tag_buffer_[kMagicBytesLen+1] = static_cast<char>(tag_string_len & 0xff);
-
-  if (prev_tag_string_length_ > 0) {
-    copy(prev_tag_string_.begin(),
-         prev_tag_string_.end(),
-         tag_buffer_.begin() + tag_header_len);
-  }
-
-  copy(tag_string_.begin(),
-       tag_string_.end(),
-       tag_buffer_.begin() + tag_header_len + prev_tag_string_length_);
-  ASSERT1(static_cast<int>(tag_buffer_.size()) == padded_tag_buffer_length);
-
-  return true;
-}
-
-bool ApplyTag::ApplyTagToBuffer(int* output_len) {
-  ASSERT1(output_len);
-
-  uint32 original_data_len = buffer_data_.size() - tag_buffer_.size();
-  uint32 peheader = GetUint32(&buffer_data_.front() + kPEHeaderOffset);
-  uint32 kCertDirAddressOffset = 152;
-  uint32 kCertDirInfoSize = 4 + 4;
-
-  ASSERT1(peheader + kCertDirAddressOffset + kCertDirInfoSize <=
-          original_data_len);
-
-  // Read certificate directory info.
-  uint32 cert_dir_offset = GetUint32(&buffer_data_.front() + peheader +
-                                     kCertDirAddressOffset);
-  if (cert_dir_offset == 0)
-    return false;
-  uint32 cert_dir_len = GetUint32(&buffer_data_.front() + peheader +
-                                  kCertDirAddressOffset + 4);
-  ASSERT1(cert_dir_offset + cert_dir_len <= original_data_len);
-
-  // Calculate the new output length.
-  int prev_pad_length = cert_dir_len - prev_cert_length_ -
-                        prev_tag_string_length_;
-  ASSERT1(prev_pad_length >= 0);
-  int orig_dir_len = cert_dir_len - prev_tag_string_length_ -
-                     prev_pad_length;
-  ASSERT1(orig_dir_len == prev_cert_length_);
-  int output_length = original_data_len - prev_tag_string_length_ -
-                      prev_pad_length + tag_buffer_.size();
-  *output_len = output_length;
-  ASSERT1(static_cast<size_t>(output_length) <= buffer_data_.size());
-  ASSERT1(output_length >= orig_dir_len);
-
-  // Increase the size of certificate directory.
-  int new_cert_len = prev_cert_length_ + tag_buffer_.size();
-  PutUint32(new_cert_len,
-            &buffer_data_.front() + peheader + kCertDirAddressOffset + 4);
-
-  // Read certificate struct info.
-  uint32 cert_struct_len = GetUint32(&buffer_data_.front() + cert_dir_offset);
-  ASSERT1(!(cert_struct_len > cert_dir_len ||
-            cert_struct_len < cert_dir_len - 8));
-
-  // Increase the certificate struct size.
-  PutUint32(new_cert_len, &buffer_data_.front() + cert_dir_offset);
-
-  // Copy the tag buffer.
-  copy(tag_buffer_.begin(), tag_buffer_.end(),
-       buffer_data_.begin() + cert_dir_offset + prev_cert_length_);
-
-  return true;
-}
-
-}  // namespace omaha
diff --git a/base/apply_tag.h b/base/apply_tag.h
deleted file mode 100644
index bd2aa0f..0000000
--- a/base/apply_tag.h
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_APPLY_TAG_H__
-#define OMAHA_COMMON_APPLY_TAG_H__
-
-#include <atlbase.h>
-#include <atlstr.h>
-
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/error.h"
-
-namespace omaha {
-
-// This regular expression represents the valid characters allowed in the
-// binary tag.
-// When changing this regular expression make sure that string patterns on
-// the server are also updated.
-const char* const kValidTagStringRegEx = "^[-%{}/&=.,_a-zA-Z0-9_]*$";
-
-// Stamps the tag_string into the signed_exe_file.
-// Appends the tag_string to the existing tag if append is
-// true, else errors out. Note that we do not support a
-// overwrite.
-// The tagging is done by adding bytes to the signature
-// directory in the PE flie.
-// The modified signature directory looks something like this
-// <Signature>Gact.<tag_len><tag_string>
-// There are no restrictions on the tag_string, it is just treated
-// as a sequence of bytes.
-class ApplyTag {
- public:
-  ApplyTag();
-  HRESULT Init(const TCHAR* signed_exe_file,
-               const char* tag_string,
-               int tag_string_length,
-               const TCHAR* tagged_file,
-               bool append);
-  HRESULT EmbedTagString();
-
- private:
-  static uint32 GetUint32(const void* p);
-  static void PutUint32(uint32 i, void* p);
-  bool ReadExistingTag(std::vector<byte>* binary);
-  bool CreateBufferToWrite();
-  bool ApplyTagToBuffer(int* output_len);
-  bool IsValidTagString(const char* tag_string);
-
-  // The string to be tagged into the binary.
-  std::vector<char> tag_string_;
-
-  // Existing tag string inside the binary.
-  std::vector<char> prev_tag_string_;
-
-  // This is prev_tag_string_.size - 1, to exclude the terminating null.
-  int prev_tag_string_length_;
-
-  // Length of the certificate inside the binary.
-  int prev_cert_length_;
-
-  // The input binary to be tagged.
-  CString signed_exe_file_;
-
-  // The output binary name.
-  CString tagged_file_;
-
-  // Whether to append the tag string to the existing one.
-  bool append_;
-
-  // Internal buffer to hold the appended string.
-  std::vector<char> tag_buffer_;
-
-  // The output buffer that contains the original binary
-  // data with the tagged information.
-  std::vector<char> buffer_data_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(ApplyTag);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_APPLY_TAG_H__
diff --git a/base/atl_regexp.cc b/base/atl_regexp.cc
deleted file mode 100644
index 4c5693c..0000000
--- a/base/atl_regexp.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-
-#include "omaha/base/atl_regexp.h"
-
-namespace omaha {
-
-const int kMaxArgs  = 16;
-
-AtlRE::AtlRE(const TCHAR* pattern, bool case_sensitive) {
-  ASSERT(pattern, (L""));
-  REParseError status = re_.Parse(pattern, case_sensitive);
-  ASSERT(status == REPARSE_ERROR_OK, (L""));
-}
-
-AtlRE::~AtlRE() {
-}
-
-bool AtlRE::DoMatchImpl(const TCHAR* text,
-                        CString* args[],
-                        int n,
-                        const TCHAR** match_end) const {
-  // text may be NULL.
-  ASSERT(args, (L""));
-
-  if (!text) {
-    return false;
-  }
-
-  AtlMatchContext matches;
-  BOOL b = re_.Match(text, &matches, match_end);
-  if (!b || matches.m_uNumGroups < static_cast<uint32>(n)) {
-    return false;
-  }
-
-  // Oddly enough, the Match call will make match_end
-  // point off the end of the string if the result is at the
-  // end of the string. We check this and handle it.
-  if (match_end) {
-    if ((*match_end - text) >= lstrlen(text)) {
-      *match_end = NULL;
-    }
-  }
-
-  const TCHAR* start = 0;
-  const TCHAR* end = 0;
-  for (int i = 0; i < n; ++i) {
-    matches.GetMatch(i, &start, &end);
-    ptrdiff_t len = end - start;
-    ASSERT(args[i], (L""));
-    // len+1 for the NULL character that's placed by lstrlen
-    VERIFY1(lstrcpyn(args[i]->GetBufferSetLength(len), start, len + 1) != NULL);
-  }
-  return true;
-}
-
-}  // namespace omaha
diff --git a/base/atl_regexp.h b/base/atl_regexp.h
deleted file mode 100644
index e7f6f90..0000000
--- a/base/atl_regexp.h
+++ /dev/null
@@ -1,150 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// ATL Regular expression class that implements the RE interface.
-// See MSDN help for example patterns (lookup help on CAtlRegExp)
-// NOTE: This class adds about 8k to release builds.
-// TODO(omaha): add a unit test, showing examples, testing functionality
-// and perf.
-
-#ifndef OMAHA_COMMON_ATL_REGEXP_H__
-#define OMAHA_COMMON_ATL_REGEXP_H__
-
-#pragma warning(push)
-// enumerator 'identifier' in switch of enum 'enumeration' is not explicitly
-// handled by a case label
-#pragma warning(disable:4061)
-#include <atlrx.h>
-#pragma warning(pop)
-#include <atlstr.h>
-#include "base/basictypes.h"
-#include "omaha/base/regexp.h"
-#include "omaha/base/string.h"
-
-namespace omaha {
-
-// This class is essentially a copy of CAtlRECharTraitsWide from <atlrx.h>, but
-// I've replaced CRT functions that are not in our minicrt.
-//
-// TODO(omaha): do we need this?
-class CAtlRECharTraitsWideNoCrt
-{
-public:
-  typedef WCHAR RECHARTYPE;
-
-  // ATL80 addition.
-  static size_t GetBitFieldForRangeArrayIndex(const RECHARTYPE *sz) throw()
-  {
-#ifndef ATL_NO_CHECK_BIT_FIELD
-    ATLASSERT(UseBitFieldForRange());
-#endif
-    return static_cast<size_t>(*sz);
-  }
-
-  static RECHARTYPE *Next(const RECHARTYPE *sz) throw()
-  {
-    return (RECHARTYPE *) (sz+1);
-  }
-
-  static int Strncmp(const RECHARTYPE *szLeft,
-                     const RECHARTYPE *szRight, size_t nCount) throw()
-  {
-    return String_StrNCmp(szLeft, szRight, nCount,false);
-  }
-
-  static int Strnicmp(const RECHARTYPE *szLeft,
-                      const RECHARTYPE *szRight, size_t nCount) throw()
-  {
-    return String_StrNCmp(szLeft, szRight, nCount,true);
-  }
-
-  static RECHARTYPE *Strlwr(RECHARTYPE *sz) throw()
-  {
-    return String_FastToLower(sz);
-  }
-
-  // In ATL 80 Strlwr must be passed a buffer size for security reasons.
-  // TODO(omaha): Implement the function to consider the nSize param.
-  static RECHARTYPE *Strlwr(RECHARTYPE *sz, int) throw()
-  {
-    return Strlwr(sz);
-  }
-
-  static long Strtol(const RECHARTYPE *sz,
-                     RECHARTYPE **szEnd, int nBase) throw()
-  {
-    return Wcstol(sz, szEnd, nBase);
-  }
-
-  static int Isdigit(RECHARTYPE ch) throw()
-  {
-    return String_IsDigit(ch) ? 1 : 0;
-  }
-
-  static const RECHARTYPE** GetAbbrevs()
-  {
-    static const RECHARTYPE *s_szAbbrevs[] =
-    {
-      L"a([a-zA-Z0-9])",  // alpha numeric
-        L"b([ \\t])",    // white space (blank)
-        L"c([a-zA-Z])",  // alpha
-        L"d([0-9])",    // digit
-        L"h([0-9a-fA-F])",  // hex digit
-        L"n(\r|(\r?\n))",  // newline
-        L"q(\"[^\"]*\")|(\'[^\']*\')",  // quoted string
-        L"w([a-zA-Z]+)",  // simple word
-        L"z([0-9]+)",    // integer
-        NULL
-    };
-
-    return s_szAbbrevs;
-  }
-
-  static BOOL UseBitFieldForRange() throw()
-  {
-    return FALSE;
-  }
-
-  static int ByteLen(const RECHARTYPE *sz) throw()
-  {
-    return int(lstrlen(sz)*sizeof(WCHAR));
-  }
-};
-
-typedef CAtlRegExp<CAtlRECharTraitsWideNoCrt> AtlRegExp;
-typedef CAtlREMatchContext<CAtlRECharTraitsWideNoCrt> AtlMatchContext;
-
-// implements the RE class using the ATL Regular Expressions class
-class AtlRE : public RE {
- public:
-
-  AtlRE(const TCHAR* pattern, bool case_sensitive = true);
-  virtual ~AtlRE();
-
- protected:
-  // See regexp.h for an explanation.
-  virtual bool DoMatchImpl(const TCHAR* text,
-                           CString* args[],
-                           int n,
-                           const TCHAR** match_end) const;
-
- private:
-  mutable AtlRegExp re_;
-  DISALLOW_EVIL_CONSTRUCTORS(AtlRE);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_ATL_REGEXP_H__
diff --git a/base/atl_regexp_unittest.cc b/base/atl_regexp_unittest.cc
deleted file mode 100644
index a1c4261..0000000
--- a/base/atl_regexp_unittest.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/atl_regexp.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(AtlRETest, AtlRE) {
-  AtlRE newline_test_re(_T("ab{\\n}cd"));
-  const TCHAR* newline_strings[] = { _T("\n"), _T("\r"), _T("\r\n") };
-  for (size_t i = 0; i < arraysize(newline_strings); ++i) {
-    CString content(_T("ab"));
-    content.Append(newline_strings[i]);
-    content.Append(_T("cd"));
-    const TCHAR* content_ptr = content.GetString();
-    CString newline;
-    EXPECT_TRUE(RE::FindAndConsume(&content_ptr, newline_test_re, &newline));
-    EXPECT_STREQ(newline, newline_strings[i]);
-  }
-
-  // Check that AtlRE works with Unicode characters.
-  AtlRE one_two_three_four(_T("\x1234"));
-  EXPECT_TRUE(RE::PartialMatch(_T("\x4321\x1234\x4321"), one_two_three_four));
-}
-
-}  // namespace omaha
diff --git a/base/atlassert.h b/base/atlassert.h
deleted file mode 100644
index 975955d..0000000
--- a/base/atlassert.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Take over ATLASSERT
-//
-
-#ifndef OMAHA_BASE_ATLASSERT_H_
-#define OMAHA_BASE_ATLASSERT_H_
-
-#include <tchar.h>
-
-#ifdef _DEBUG
-#ifndef DEBUG
-#error DEBUG and _DEBUG must be in sync
-#endif
-#endif
-
-namespace omaha {
-
-enum ReportType {
-  R_INFO = 1,   // Not an error, used for accumulating statistics.
-  R_WARNING,    // May or may not be an error.
-  R_ERROR,      // Definitely an error.
-  R_FATAL       // halt program == ASSERT for release mode.
-};
-
-enum DebugReportKind {
-  DEBUGREPORT_NONE   = 0,
-  DEBUGREPORT_ASSERT = 1,
-  DEBUGREPORT_REPORT = 2,
-  DEBUGREPORT_ABORT  = 3
-};
-
-#ifdef DEBUG
-extern "C" bool DebugReport(unsigned int id,
-                            omaha::ReportType type,
-                            const char* expr,
-                            const TCHAR* message,
-                            const char* filename,
-                            int linenumber,
-                            omaha::DebugReportKind debug_report_kind);
-  #ifndef ATLASSERT
-  #define ATLASSERT(expr)                         \
-    do {                                          \
-      if (!(expr)) {                              \
-        DebugReport(0,                            \
-                    omaha::R_FATAL,               \
-                    #expr,                        \
-                    _T("ATL assertion"),          \
-                    __FILE__,                     \
-                    __LINE__,                     \
-                    omaha::DEBUGREPORT_ASSERT);   \
-      }                                           \
-    } while (0)
-  #endif
-#else
-  #ifndef ATLASSERT
-  #define ATLASSERT(expr) ((void)0)
-  #endif
-#endif
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_ATLASSERT_H_
diff --git a/base/atlassert_unittest.cc b/base/atlassert_unittest.cc
deleted file mode 100644
index 76cebda..0000000
--- a/base/atlassert_unittest.cc
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/debug.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-// Test what happens when we hit an ATLASSERT within ATL code.
-// The CComPtr expects the parameter to be 0.
-TEST(AtlAssertTest, AtlAssert) {
-  ExpectAsserts expect_asserts;
-  CComPtr<IUnknown> p(1);
-}
-
-}  // namespace omaha
diff --git a/base/atlconvfix.h b/base/atlconvfix.h
deleted file mode 100644
index 76ffaa4..0000000
--- a/base/atlconvfix.h
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// atlconvfix.h
-//
-// This file is included in the precompile headers.
-// Do not include the base/basictypes.h here.
-
-#ifndef OMAHA_COMMON_ATLCONVFIX_H_
-#define OMAHA_COMMON_ATLCONVFIX_H_
-
-#ifndef DISALLOW_EVIL_CONSTRUCTORS
-// A macro to disallow the evil copy constructor and operator= functions
-// This should be used in the private: declarations for a class
-#define DISALLOW_EVIL_CONSTRUCTORS(TypeName)    \
-  TypeName(const TypeName&);                    \
-  void operator=(const TypeName&)
-#endif
-
-// These use alloca which can be dangerous,
-// so we don't allow them to be used.  Use
-// CA2[C]W, etc. instead.
-#undef A2W
-#undef W2A
-#undef A2W_EX
-#undef W2A_EX
-#undef USES_CONVERSION
-
-#ifdef DEBUG
-// The DestroyBuffer template and the macros following it are
-// all there to ensure that when the string classes get destroyed,
-// so does the string that they return since it is no longer valid.
-// Without them it is very easy to make simple and hard to catch mistakes
-// when using the atl C*2[C]* string converstion classes.
-
-// In non-debug code, the atl string macros do not need to be destroyed,
-// so they aren't wrapped there.
-
-template <int buffer_length, template <int buffer_length> class ConversionClass,
-          typename StringType>
-class DestroyBuffer : public ConversionClass<buffer_length> {
- public:
-  DestroyBuffer(StringType string) : ConversionClass<buffer_length>(string) {
-  }
-
-  DestroyBuffer(StringType string, UINT code_page) :
-      ConversionClass<buffer_length>(string, code_page) {
-  }
-
-  ~DestroyBuffer() {
-    memset(m_szBuffer, 0xdd, sizeof(m_szBuffer));
-  }
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(DestroyBuffer);
-};
-
-#define DECLARED_DESTROY_NAME(base_type) DestroyBuffer##base_type
-#define DECLARE_DESTROY_TYPES(base_type, string_type) \
-  template <int buffer_length = 128> \
-  class DECLARED_DESTROY_NAME(base_type##EX) : \
-      public DestroyBuffer<buffer_length, base_type##EX, string_type> { \
-   public: \
-    DECLARED_DESTROY_NAME(base_type##EX)(string_type string) : \
-      DestroyBuffer<buffer_length, base_type##EX, string_type>(string) {  \
-    } \
-    DECLARED_DESTROY_NAME(base_type##EX)(string_type string, \
-                                         UINT code_page) : \
-      DestroyBuffer<buffer_length, base_type##EX, string_type>(string, \
-                                                               code_page) { \
-    } \
-   private: \
-    DISALLOW_EVIL_CONSTRUCTORS(DECLARED_DESTROY_NAME(base_type##EX)); \
-  }; \
-  typedef DECLARED_DESTROY_NAME(base_type##EX)<> \
-      DECLARED_DESTROY_NAME(base_type)
-
-DECLARE_DESTROY_TYPES(CW2W, LPCWSTR);
-DECLARE_DESTROY_TYPES(CW2A, LPCWSTR);
-DECLARE_DESTROY_TYPES(CA2W, LPCSTR);
-DECLARE_DESTROY_TYPES(CA2A, LPCSTR);
-
-#define CW2WEX DECLARED_DESTROY_NAME(CW2WEX)
-#define CW2AEX DECLARED_DESTROY_NAME(CW2AEX)
-#define CA2WEX DECLARED_DESTROY_NAME(CA2WEX)
-#define CA2AEX DECLARED_DESTROY_NAME(CA2AEX)
-#define CW2W   DECLARED_DESTROY_NAME(CW2W)
-#define CW2A   DECLARED_DESTROY_NAME(CW2A)
-#define CA2W   DECLARED_DESTROY_NAME(CA2W)
-#define CA2A   DECLARED_DESTROY_NAME(CA2A)
-#endif // DEBUG
-
-#endif // OMAHA_COMMON_ATLCONVFIX_H_
diff --git a/base/auto_any.h b/base/auto_any.h
deleted file mode 100644
index 3291614..0000000
--- a/base/auto_any.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// See the comments in omaha/base/scoped_any.h for details.
-
-#ifndef OMAHA_COMMON_AUTO_ANY_H__
-#define OMAHA_COMMON_AUTO_ANY_H__
-
-#pragma warning(push)
-// C4640: construction of local static object is not thread-safe
-#pragma warning(disable : 4640)
-#include "omaha/third_party/smartany/scoped_any.h"
-#pragma warning(pop)
-
-#endif  // OMAHA_COMMON_AUTO_ANY_H__
-
diff --git a/base/browser_utils.cc b/base/browser_utils.cc
deleted file mode 100644
index c21c30e..0000000
--- a/base/browser_utils.cc
+++ /dev/null
@@ -1,727 +0,0 @@
-// Copyright 2006 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <exdisp.h>
-#include "omaha/base/browser_utils.h"
-#include "base/basictypes.h"
-#include "omaha/base/commands.h"
-#include "omaha/base/const_utils.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/path.h"
-#include "omaha/base/process.h"
-#include "omaha/base/proc_utils.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/shell.h"
-#include "omaha/base/string.h"
-#include "omaha/base/system.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/thread.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/base/vista_utils.h"
-
-namespace omaha {
-
-namespace {
-
-// Attempts to force instances of IE to quit gracefully using shell APIs.
-HRESULT CloseIeUsingShell(const CString& sid) {
-  CComPtr<IShellWindows> shell_windows;
-  HRESULT hr = shell_windows.CoCreateInstance(CLSID_ShellWindows);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  long num_windows = 0;  // NOLINT
-  hr = shell_windows->get_Count(&num_windows);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  for (int32 i = 0; i < num_windows; ++i) {
-    CComVariant index(i);
-
-    CComPtr<IDispatch> disp;
-    hr = shell_windows->Item(index, &disp);
-    if (FAILED(hr)) {
-      UTIL_LOG(L3, (_T("[CloseIeUsingShell][Item failed][0x%08x]"), hr));
-      return hr;
-    }
-    if (!disp) {
-      // Skip - this shell window was registered with a NULL IDispatch
-      continue;
-    }
-
-    CComPtr<IWebBrowser2> browser;
-    hr = disp.QueryInterface(&browser);
-    if (FAILED(hr)) {
-      // Skip - this shell window doesn't implement IWebBrowser2
-      continue;
-    }
-
-    // Okay, this window implements IWebBrowser2, so it's potentially an
-    // IE session.  Identify the owning process.
-    long hwnd = 0;  // NOLINT
-    hr = browser->get_HWND(&hwnd);
-    if (FAILED(hr)) {
-      UTIL_LOG(L3, (_T("[CloseIeUsingShell][get_HWND failed][0x%08x]"), hr));
-      continue;
-    }
-
-    DWORD process_id = 0;
-    ::GetWindowThreadProcessId(reinterpret_cast<HWND>(hwnd), &process_id);
-    if (0 == process_id) {
-      UTIL_LOG(L3, (_T("[CloseIeUsingShell][invalid process id]")));
-      continue;
-    }
-
-    // If a SID was passed in, check that the SID owns this process.  (If we
-    // can't query the process owner, play it safe and skip it.)
-    if (!sid.IsEmpty()) {
-      CString process_sid;
-      hr = Process::GetProcessOwner(process_id, &process_sid);
-      if (FAILED(hr)) {
-        UTIL_LOG(L3, (_T("[CloseIeUsingShell][GetProcessOwner][0x%08x]"), hr));
-        continue;
-      }
-
-      if (0 != sid.CompareNoCase(process_sid)) {
-        // Skip - process is not owned by us
-        continue;
-      }
-    }
-
-    // Verify that the process executable is iexplore.exe, as this list may
-    // also contain embedded shdocvw sessions in explorer.exe.  (If we can't
-    // fetch the process executable, play it safe and skip it.)
-    CString process_module;
-    hr = Process::GetExecutablePath(process_id, &process_module);
-    if (FAILED(hr)) {
-      UTIL_LOG(L3, (_T("[CloseIeUsingShell][GetExecutablePath][0x%08x]"), hr));
-      continue;
-    }
-
-    if (0 != GetFileFromPath(process_module).CompareNoCase(kIeExeName)) {
-      // Skip - it's not an iexplore.exe
-      continue;
-    }
-
-    // Okay, this is an IWebBrowser2 hosted by an iexplore.exe that is running
-    // under the requested SID.  Ask it to quit.  (Note: It may not necessarily
-    // honor this request.  We can follow it up with WM_CLOSE messages or a
-    // process termination if absolutely necessary.)
-    UTIL_LOG(L3, (_T("[CloseIeUsingShell][Closing IE session][pid %d]"),
-             process_id));
-
-    hr = browser->Quit();
-    if (FAILED(hr)) {
-      UTIL_LOG(L3, (_T("[CloseIeUsingShell][Quit failed][0x%08x]"), hr));
-      continue;
-    }
-  }
-
-  return S_OK;
-}
-
-class CloseIeUsingShellRunnable : public Runnable {
- public:
-  explicit CloseIeUsingShellRunnable(const CString& sid) : sid_(sid) {}
- protected:
-  virtual ~CloseIeUsingShellRunnable() {}
-
-  virtual void Run() {
-    UTIL_LOG(L3, (_T("[CloseIeUsingShellRunnable][%s]"), sid_));
-
-    scoped_co_init co_init(COINIT_MULTITHREADED);
-    VERIFY1(SUCCEEDED(co_init.hresult()));
-
-    CloseIeUsingShell(sid_);
-    delete this;
-  }
-
- private:
-  CString sid_;
-};
-
-}  // end namespace
-
-HRESULT GetLegacyDefaultBrowserInfo(CString* name, CString* path) {
-  UTIL_LOG(L3, (_T("[GetLegacyDefaultBrowserInfo]")));
-  ASSERT1(name);
-  ASSERT1(path);
-  name->Empty();
-  path->Empty();
-
-  CString browser_command_line;
-  HRESULT hr = RegKey::GetValue(kRegKeyLegacyDefaultBrowserCommand,
-                                NULL,
-                                &browser_command_line);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[Read failed][%s]"), kRegKeyLegacyDefaultBrowserCommand));
-    return hr;
-  }
-
-  UTIL_LOG(L5, (_T("[browser_command_line][%s]"), browser_command_line));
-  browser_command_line.Trim(_T(" "));
-  if (browser_command_line.IsEmpty()) {
-    return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
-  }
-
-  CString browser_path;
-  if (File::Exists(browser_command_line)) {
-    if (File::IsDirectory(browser_command_line)) {
-      UTIL_LOG(LE, (_T("[Unexpected. Command line should not be directory]")));
-      return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
-    }
-
-    browser_path = browser_command_line;
-  } else {
-    hr = GetExePathFromCommandLine(browser_command_line, &browser_path);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    if (!File::Exists(browser_path) ||
-        File::IsDirectory(browser_path)) {
-      UTIL_LOG(LE, (_T("[browser_path invalid][%s]"), browser_path));
-      return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
-    }
-  }
-
-  CString browser_name = ::PathFindFileName(browser_path);
-  if (browser_name.IsEmpty() ||
-      !String_EndsWith(browser_name, _T(".exe"), true)) {
-    UTIL_LOG(LE, (_T("[browser name invalid][%s]"), browser_name));
-    return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
-  }
-
-  *path = browser_path;
-  *name = browser_name;
-  return S_OK;
-}
-
-HRESULT GetDefaultBrowserName(CString* name) {
-  ASSERT1(name);
-  name->Empty();
-
-  // Get the default browser name from current user registry.
-  HKEY user_root_key = NULL;
-  VERIFY1(::RegOpenCurrentUser(KEY_READ, &user_root_key) == ERROR_SUCCESS);
-  RegKey user_default_browser;
-  HRESULT hr = user_default_browser.Open(
-      user_root_key ? user_root_key : HKEY_CURRENT_USER,
-      kRegKeyDefaultBrowser,
-      KEY_READ);
-  if (SUCCEEDED(hr)) {
-    hr = user_default_browser.GetValue(NULL, name);
-  }
-  if (user_root_key) {
-    LONG error(::RegCloseKey(user_root_key));
-
-    // See bug http://b/1231862 for details when RegCloseKey can
-    // return ERROR_INVALID_HANDLE.
-    ASSERT1(error == ERROR_SUCCESS ||
-            error == ERROR_INVALID_HANDLE);
-  }
-
-  if (SUCCEEDED(hr) && !name->IsEmpty()) {
-    UTIL_LOG(L3, (_T("[Default browser for the user is %s]"), *name));
-    return S_OK;
-  }
-
-  // Try to get from local machine registry.
-  hr = RegKey::GetValue(kRegKeyMachineDefaultBrowser, NULL, name);
-  if (SUCCEEDED(hr) && !name->IsEmpty()) {
-    UTIL_LOG(L3, (_T("[Default browser for the machine is %s]"), *name));
-    return S_OK;
-  }
-
-  // Try to get from legacy default browser location.
-  CString browser_path;
-  hr = GetLegacyDefaultBrowserInfo(name, &browser_path);
-  if (SUCCEEDED(hr) && !name->IsEmpty()) {
-    UTIL_LOG(L3, (_T("[Legacy default browser is %s]"), *name));
-    return S_OK;
-  }
-
-  // If still failed, we don't want to break in this case so we default to
-  // IEXPLORE.EXE. A scenario where this can happen is when the user installs
-  // a browser that configures itself to be default. Then the user uninstalls
-  // or somehow removes that browser and the registry is not updated correctly.
-  *name = kIeExeName;
-  return S_OK;
-}
-
-HRESULT GetDefaultBrowserType(BrowserType* type) {
-  ASSERT1(type);
-
-  CString name;
-  HRESULT hr = GetDefaultBrowserName(&name);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (name.CompareNoCase(kIeExeName) == 0) {
-    *type = BROWSER_IE;
-  } else if (name.CompareNoCase(kFirefoxExeName) == 0) {
-    *type = BROWSER_FIREFOX;
-  } else if (name.CompareNoCase(kChromeExeName) == 0 ||
-             name.CompareNoCase(kChromeBrowserName) == 0) {
-    *type = BROWSER_CHROME;
-  } else {
-    *type = BROWSER_UNKNOWN;
-  }
-
-  return S_OK;
-}
-
-// Returns a path that is always unenclosed. The method could return a short or
-// long form path.
-HRESULT GetDefaultBrowserPath(CString* path) {
-  ASSERT1(path);
-  path->Empty();
-  ON_SCOPE_EXIT(UnenclosePath, path);
-
-  // Get the default browser name.
-  CString name;
-  if (FAILED(GetDefaultBrowserName(&name))) {
-    // Try getting IE's path through COM registration and app path entries.
-    return GetBrowserImagePath(BROWSER_IE, path);
-  }
-
-  CString shell_open_path(_T("\\"));
-  shell_open_path += name;
-  shell_open_path += kRegKeyShellOpenCommand;
-
-  // Read the path corresponding to it from current user registry.
-  CString browser_key(kRegKeyUserDefaultBrowser);
-  browser_key += shell_open_path;
-  HRESULT hr = RegKey::GetValue(browser_key, NULL, path);
-
-  CString cmd_line(*path);
-  CString args;
-  if (SUCCEEDED(hr) &&
-      !path->IsEmpty() &&
-      SUCCEEDED(CommandParsingSimple::SplitExeAndArgsGuess(cmd_line,
-                                                           path,
-                                                           &args))) {
-    return S_OK;
-  }
-
-  // If failed, try to get from local machine registry.
-  browser_key = kRegKeyMachineDefaultBrowser;
-  browser_key += shell_open_path;
-  hr = RegKey::GetValue(browser_key, NULL, path);
-
-  cmd_line = *path;
-  args.Empty();
-  if (SUCCEEDED(hr) &&
-      !path->IsEmpty() &&
-      SUCCEEDED(CommandParsingSimple::SplitExeAndArgsGuess(cmd_line,
-                                                           path,
-                                                           &args))) {
-    return S_OK;
-  }
-
-  // Try to get from legacy default browser location.
-  hr = GetLegacyDefaultBrowserInfo(&name, path);
-  if (SUCCEEDED(hr) && !path->IsEmpty()) {
-    return S_OK;
-  }
-
-  // If failed and the default browser is not IE, try IE once again.
-  if (name.CompareNoCase(kIeExeName) != 0) {
-    browser_key = kRegKeyMachineDefaultBrowser
-                  _T("\\") kIeExeName kRegKeyShellOpenCommand;
-    hr = RegKey::GetValue(browser_key, NULL, path);
-
-    cmd_line = *path;
-    args.Empty();
-    if (SUCCEEDED(hr) &&
-        !path->IsEmpty() &&
-        SUCCEEDED(CommandParsingSimple::SplitExeAndArgsGuess(cmd_line,
-                                                             path,
-                                                             &args))) {
-      return S_OK;
-    }
-  }
-
-  // Try getting the default browser's path through COM registration and app
-  // path entries.
-  BrowserType default_type = BROWSER_UNKNOWN;
-  hr = GetDefaultBrowserType(&default_type);
-  if (FAILED(hr) ||
-      default_type == BROWSER_UNKNOWN ||
-      default_type == BROWSER_DEFAULT) {
-    default_type = BROWSER_IE;
-  }
-
-  return GetBrowserImagePath(default_type, path);
-}
-
-HRESULT GetFirefoxDefaultProfile(CString* name, CString* path) {
-  ASSERT1(name);
-  ASSERT1(path);
-
-  const TCHAR kFirefoxAppDataPath[] = _T("\\Mozilla\\Firefox\\");
-  const TCHAR kFirefoxProfileIni[] = _T("profiles.ini");
-  const TCHAR kFirefoxDefaultProfileSecName[] = _T("Profile0");
-  const TCHAR kFirefoxProfileIniNameKey[] = _T("Name");
-  const TCHAR kFirefoxProfileIniIsRelativeKey[] = _T("IsRelative");
-  const TCHAR kFirefoxProfileIniPathKey[] = _T("Path");
-  const TCHAR kFirefoxProfileIniDefaultKey[] = _T("Default");
-
-  name->Empty();
-  path->Empty();
-
-  // Get appdata path for storing Firefox settings.
-  CString appdata_path;
-  RET_IF_FAILED(Shell::GetSpecialFolder(CSIDL_APPDATA, false, &appdata_path));
-  appdata_path += kFirefoxAppDataPath;
-
-  // Get profile.ini.
-  CString profile_ini = appdata_path + kFirefoxProfileIni;
-  UTIL_LOG(L3, (_T("[FireFox profile.ini][%s]"), profile_ini));
-
-  if (!File::Exists(profile_ini)) {
-    UTIL_LOG(LE, (_T("[File does not exist][%s]"), profile_ini));
-    return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
-  }
-
-  // Read all section names in profile.ini.
-  // The buffer is filled with one or more null-terminated strings; the last
-  // string is followed by a second null character.
-  const int kMaxProfileSecNamesLength = 2048;
-  CString profile_sec_names;
-  DWORD char_returned = ::GetPrivateProfileSectionNames(
-      profile_sec_names.GetBufferSetLength(kMaxProfileSecNamesLength),
-      kMaxProfileSecNamesLength,
-      profile_ini);
-  if (char_returned == kMaxProfileSecNamesLength - 2) {
-    UTIL_LOG(LW, (_T("[FireFox profile.ini contains too many sections]")));
-  }
-  profile_sec_names.ReleaseBuffer(char_returned);
-
-  // Iterate through all the sections to find the default profile.
-  const TCHAR* default_profile_sec = NULL;
-  const TCHAR* ptr = profile_sec_names.GetString();
-  const TCHAR* end = ptr + char_returned;
-  while (ptr < end && *ptr) {
-    if (::GetPrivateProfileInt(ptr,
-                               kFirefoxProfileIniDefaultKey,
-                               0,
-                               profile_ini)) {
-      default_profile_sec = ptr;
-      break;
-    }
-
-    for (; ptr < end && *ptr; ++ptr) {
-    }
-    ++ptr;
-  }
-
-  if (!default_profile_sec) {
-    default_profile_sec = kFirefoxDefaultProfileSecName;
-  }
-
-  DWORD name_len = ::GetPrivateProfileString(default_profile_sec,
-                                             kFirefoxProfileIniNameKey, _T(""),
-                                             name->GetBufferSetLength(256),
-                                             256,
-                                             profile_ini);
-  name->ReleaseBuffer(name_len);
-
-  DWORD path_len = ::GetPrivateProfileString(default_profile_sec,
-                                             kFirefoxProfileIniPathKey,
-                                             _T(""),
-                                             path->GetBufferSetLength(1024),
-                                             1024,
-                                             profile_ini);
-  path->ReleaseBuffer(path_len);
-  path->Replace(_T('/'), _T('\\'));
-
-  bool is_relative = ::GetPrivateProfileInt(default_profile_sec,
-                                            kFirefoxProfileIniIsRelativeKey,
-                                            0,
-                                            profile_ini) != 0;
-
-  if (is_relative && !path->IsEmpty()) {
-    path->Insert(0, appdata_path);
-  }
-
-  return S_OK;
-}
-
-HRESULT BrowserTypeToProcessName(BrowserType type, CString* exe_name) {
-  ASSERT1(exe_name);
-  ASSERT1(type < BROWSER_MAX);
-
-  switch (type) {
-    case BROWSER_IE:
-      *exe_name = kIeExeName;
-      break;
-    case BROWSER_FIREFOX:
-      *exe_name = kFirefoxExeName;
-      break;
-    case BROWSER_CHROME:
-      *exe_name = kChromeExeName;
-      break;
-    case BROWSER_DEFAULT:
-      return GetDefaultBrowserName(exe_name);
-    case BROWSER_UNKNOWN:
-      // Fall through.
-    case BROWSER_MAX:
-      // Fall through.
-    default:
-      return E_FAIL;
-  }
-
-  return S_OK;
-}
-
-// Returns a path that is always unenclosed. The method could return a short or
-// long form path.
-HRESULT GetBrowserImagePath(BrowserType type, CString* path) {
-  ASSERT1(path);
-  ASSERT1(type < BROWSER_MAX);
-
-  HRESULT hr = E_FAIL;
-  switch (type) {
-    case BROWSER_IE: {
-      hr = RegKey::GetValue(kRegKeyIeClass, kRegValueIeClass, path);
-      break;
-    }
-    case BROWSER_FIREFOX: {
-      hr = RegKey::GetValue(kRegKeyFirefox, kRegValueFirefox, path);
-      if (SUCCEEDED(hr) && !path->IsEmpty()) {
-        // The Firefox registry key contains a -url %1 value. Remove this
-        // because we only want to return the path.
-        ReplaceCString(*path, _T("-url \"%1\""), _T(""));
-      }
-      break;
-    }
-    case BROWSER_CHROME: {
-      hr = RegKey::GetValue(kRegKeyChrome, kRegValueChrome, path);
-      if (SUCCEEDED(hr) && !path->IsEmpty()) {
-        // The Chrome registry key contains a -- "%1" value. Remove this because
-        // we only want to return the path.
-        ReplaceCString(*path, _T("-- \"%1\""), _T(""));
-      }
-      break;
-    }
-    case BROWSER_DEFAULT: {
-      hr = GetDefaultBrowserPath(path);
-      if (FAILED(hr)) {
-        UTIL_LOG(LE, (_T("[GetDefaultBrowserPath failed.][0x%08x]"), hr));
-      }
-      path->Trim();
-      UnenclosePath(path);
-      return hr;
-    }
-    case BROWSER_UNKNOWN:
-      // Fall through.
-    case BROWSER_MAX:
-      // Fall through.
-    default:
-      return E_FAIL;
-  }
-
-  CString cmd_line(*path);
-  CString args;
-  if (SUCCEEDED(hr) &&
-      !path->IsEmpty() &&
-      SUCCEEDED(CommandParsingSimple::SplitExeAndArgsGuess(cmd_line,
-                                                           path,
-                                                           &args))) {
-    return S_OK;
-  }
-
-  // If the above did not work, then we try to read the value from
-  // "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths".
-  CString browser_exe_name;
-  hr = BrowserTypeToProcessName(type, &browser_exe_name);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[BrowserTypeToProcessName failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  CString exe_path;
-  hr = Shell::GetApplicationExecutablePath(browser_exe_name, &exe_path);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[GetApplicationExecutablePath failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  *path = ConcatenatePath(exe_path, browser_exe_name);
-  ASSERT1(!path->IsEmpty());
-
-  path->Trim();
-  UnenclosePath(path);
-  return S_OK;
-}
-
-HRESULT TerminateBrowserProcess(BrowserType type,
-                                const CString& sid,
-                                int timeout_msec,
-                                bool* found) {
-  UTIL_LOG(L3, (_T("[TerminateBrowserProcess][%d]"), type));
-  ASSERT1(found);
-  ASSERT1(type < BROWSER_MAX);
-
-  *found = false;
-  if (type == BROWSER_UNKNOWN || type >= BROWSER_MAX) {
-    return E_FAIL;
-  }
-
-  if (type == BROWSER_IE) {
-    Thread close_ie_thread;
-
-    close_ie_thread.Start(new CloseIeUsingShellRunnable(sid));
-    close_ie_thread.WaitTillExit(timeout_msec);
-
-    // Fall through after attempting to close IE via automation - if it
-    // succeeded, we'll find no processes, but if it failed we still want
-    // to attempt a conventional WM_CLOSE quit.  (This also applies to
-    // third-party hosts of IE that may not respect IWebBrowser2::Quit.)
-  }
-
-  CString browser_exe_name;
-  HRESULT hr = BrowserTypeToProcessName(type, &browser_exe_name);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[BrowserTypeToProcessName failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  DWORD current_session = System::GetCurrentSessionId();
-  uint32 method_mask = ProcessTerminator::KILL_METHOD_1_WINDOW_MESSAGE;
-  ProcessTerminator process(browser_exe_name, sid, current_session);
-  hr = process.KillTheProcess(timeout_msec, found, method_mask, true);
-  if (FAILED(hr)) {
-    UTIL_LOG(LEVEL_WARNING, (_T("[KillTheProcess failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT WaitForBrowserToDie(BrowserType type,
-                            const CString& sid,
-                            int timeout_msec) {
-  UTIL_LOG(L3, (_T("[WaitForBrowserToDie][%d]"), type));
-  ASSERT1(type < BROWSER_MAX);
-
-  if (type == BROWSER_UNKNOWN || type >= BROWSER_MAX) {
-    return E_FAIL;
-  }
-
-  CString browser_exe_name;
-  HRESULT hr = BrowserTypeToProcessName(type, &browser_exe_name);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[BrowserTypeToProcessName failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  DWORD current_session = System::GetCurrentSessionId();
-  ProcessTerminator process(browser_exe_name, sid, current_session);
-  hr = process.WaitForAllToDie(timeout_msec);
-  if (FAILED(hr)) {
-    UTIL_LOG(LEVEL_WARNING, (_T("[WaitForAllToDie failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT RunBrowser(BrowserType type, const CString& url) {
-  UTIL_LOG(L3, (_T("[RunBrowser][%d][%s]"), type, url));
-  ASSERT1(type < BROWSER_MAX);
-
-  if (type == BROWSER_UNKNOWN || type >= BROWSER_MAX) {
-    return E_FAIL;
-  }
-
-  CString path;
-  HRESULT hr =  GetBrowserImagePath(type, &path);
-  if (FAILED(hr)) {
-    UTIL_LOG(LW, (_T("[GetBrowserImagePath failed][0x%08x]"), hr));
-    // ShellExecute the url directly as a last resort.
-    return Shell::Execute(url);
-  }
-  EnclosePath(&path);
-
-  UTIL_LOG(L3, (_T("[Execute browser][%s][%s]"), path, url));
-
-  // http://b/1219313: For Vista, in some cases, using ShellExecuteEx does not
-  // re-launch the process. So, using CreateProcess instead.
-  // http://b/1223658: For Vista, especially in the impersonated case, need to
-  // create a fresh environment block. Otherwise, the environment is tainted.
-  hr = vista::RunAsCurrentUser(path + _T(' ') + url);
-
-  if (FAILED(hr)) {
-    UTIL_LOG(LW, (_T("[RunAsCurrentUser failed][0x%x]"), hr));
-    // ShellExecute the url directly as a last resort.
-    return Shell::Execute(url);
-  }
-
-  return S_OK;
-}
-
-// Gets the font size of IE. This is the value that corresponds to what IE
-// displays in "Page/Text Size" menu option. There are 5 values and the default
-// is "Medium", for which the numeric value is 2. The "IEFontSize" is only
-// present after the user has modified the default text size in IE, therefore
-// the absence of the value indicates "Medium" text size.
-HRESULT GetIeFontSize(uint32* font_size) {
-  ASSERT1(font_size);
-
-  const TCHAR ie_scripts_key[] =
-    _T("HKCU\\Software\\Microsoft\\Internet Explorer\\International\\Scripts\\3");  // NOLINT
-  const TCHAR ie_font_size[] = _T("IEFontSize");
-  const uint32 kDefaultFontSize = 2;
-
-  // We expect the scripts key to be there in all cases. The "IEFontSize" value
-  // is optional but we want to fail if the key is not there.
-  if (!RegKey::HasKey(ie_scripts_key)) {
-    return E_UNEXPECTED;
-  }
-
-  scoped_array<byte> buf;   // The font size is a binary registry value.
-  DWORD buf_size(0);
-  if (FAILED(RegKey::GetValue(ie_scripts_key, ie_font_size,
-                              address(buf), &buf_size))) {
-    *font_size = kDefaultFontSize;
-    return S_OK;
-  }
-
-  ASSERT1(buf_size == sizeof(uint32));  // NOLINT
-  if (buf_size != sizeof(uint32)) {     // NOLINT
-    return E_UNEXPECTED;
-  }
-
-  uint32 val = *reinterpret_cast<uint32*>(buf.get());
-  ASSERT1(val <= 4);
-  if (val > 4) {
-    return E_UNEXPECTED;
-  }
-
-  *font_size = val;
-  return S_OK;
-}
-
-}  // namespace omaha
diff --git a/base/browser_utils.h b/base/browser_utils.h
deleted file mode 100644
index c062edb..0000000
--- a/base/browser_utils.h
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2006 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// TODO(omaha): namespaces
-
-#ifndef OMAHA_BASE_BROWSER_UTILS_H_
-#define OMAHA_BASE_BROWSER_UTILS_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-// Must be kept in sync with the enum in base/omaha3_idl.idl. Do not include
-// BROWSER_MAX in the IDL file.
-// Do not move or remove existing elements.
-enum BrowserType {
-  BROWSER_UNKNOWN = 0,
-  BROWSER_DEFAULT = 1,
-  BROWSER_IE      = 2,
-  BROWSER_FIREFOX = 3,
-  BROWSER_CHROME  = 4,
-  // Add new browsers above this.
-  BROWSER_MAX
-};
-
-// Read the browser information from legacy keys. See
-// http://support.microsoft.com/kb/224816.
-HRESULT GetLegacyDefaultBrowserInfo(CString* name, CString* browser_path);
-
-// Gets the default browser name.
-// When calling this method from the local system account, the caller must
-// impersonate the user first. This assumes the user profile is loaded under
-// HKEY_USERS, which is true if the user has an interactive session.
-// Otherwise, the caller must load the profile for the user before
-// calling the function.
-HRESULT GetDefaultBrowserName(CString* name);
-
-// Returns the default browser type.
-HRESULT GetDefaultBrowserType(BrowserType* type);
-
-// Get the default browser path
-HRESULT GetDefaultBrowserPath(CString* path);
-
-// Get the default profile of Firefox
-HRESULT GetFirefoxDefaultProfile(CString* name, CString* path);
-
-// Returns the executable name corresponding to the browser type.
-HRESULT BrowserTypeToProcessName(BrowserType type, CString* exe_name);
-
-// Returns the absolute filename of the browser executable.
-HRESULT GetBrowserImagePath(BrowserType type, CString* path);
-
-// Terminates all the browsers identified by type for a user.
-HRESULT TerminateBrowserProcess(BrowserType type,
-                                const CString& sid,
-                                int timeout_msec,
-                                bool* found);
-
-// Waits for all instances of browser to die.
-HRESULT WaitForBrowserToDie(BrowserType type,
-                            const CString& sid,
-                            int timeout_msec);
-
-// Launches the browser using RunAsCurrentUser. On failure, falls back to
-// using ShellExecute.
-HRESULT RunBrowser(BrowserType type, const CString& url);
-
-// Returns the current font size selection in Internet Explorer.
-// Possible font size values:
-// 0 : smallest font
-// 1 : small font
-// 2 : medium font
-// 3 : large font
-// 4 : largest font
-HRESULT GetIeFontSize(uint32* font_size);
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_BROWSER_UTILS_H_
diff --git a/base/browser_utils_unittest.cc b/base/browser_utils_unittest.cc
deleted file mode 100644
index ef75fda..0000000
--- a/base/browser_utils_unittest.cc
+++ /dev/null
@@ -1,385 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/browser_utils.h"
-#include "omaha/base/const_utils.h"
-#include "omaha/base/path.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-const CString kRegistryHiveOverrideClasses =
-    CString(kRegistryHiveOverrideRoot) + _T("HKCR");
-
-// GetDefaultBrowserName() uses ::RegOpenCurrentUser, which does not appear to
-// be affected by registry hive overrides. Therefore, in order to test methods
-// that rely on it, the actual value must be replaced. This class saves the
-// value and restores it. If the test is interrupted before TearDown, the
-// default browser may not be correctly registered.
-class BrowserUtilsDefaultBrowserSavedTest : public testing::Test {
- protected:
-  virtual void SetUp() {
-    if (!RegKey::HasKey(kRegKeyUserDefaultBrowser)) {
-      return;
-    }
-
-    EXPECT_SUCCEEDED(RegKey::GetValue(kRegKeyUserDefaultBrowser,
-                                      NULL,
-                                      &default_browser_name_));
-  }
-
-  virtual void TearDown() {
-    if (default_browser_name_.IsEmpty()) {
-      RegKey::DeleteKey(kRegKeyUserDefaultBrowser);
-      return;
-    }
-
-    EXPECT_SUCCEEDED(RegKey::SetValue(kRegKeyUserDefaultBrowser,
-                                      NULL,
-                                      default_browser_name_));
-  }
-
-  CString default_browser_name_;
-};
-
-class GetLegacyDefaultBrowserInfoTest : public testing::Test {
- protected:
-  virtual void SetUp() {
-    RegKey::DeleteKey(kRegistryHiveOverrideClasses, true);
-    RegKey classes_key;
-    ASSERT_HRESULT_SUCCEEDED(classes_key.Create(kRegistryHiveOverrideClasses));
-    ASSERT_HRESULT_SUCCEEDED(::RegOverridePredefKey(HKEY_CLASSES_ROOT,
-                                                    classes_key.Key()));
-  }
-
-  virtual void TearDown() {
-    ASSERT_HRESULT_SUCCEEDED(::RegOverridePredefKey(HKEY_CLASSES_ROOT, NULL));
-    ASSERT_HRESULT_SUCCEEDED(RegKey::DeleteKey(kRegistryHiveOverrideClasses,
-                             true));
-  }
-};
-
-TEST_F(BrowserUtilsDefaultBrowserSavedTest, GetDefaultBrowserType_IE) {
-  if (!ShouldRunLargeTest()) {
-    return;
-  }
-  EXPECT_SUCCEEDED(
-      RegKey::SetValue(kRegKeyUserDefaultBrowser, NULL, _T("IeXpLoRe.ExE")));
-  BrowserType type = BROWSER_UNKNOWN;
-  EXPECT_SUCCEEDED(GetDefaultBrowserType(&type));
-  EXPECT_EQ(BROWSER_IE, type);
-}
-
-TEST_F(BrowserUtilsDefaultBrowserSavedTest, GetDefaultBrowserType_Firefox) {
-  if (!ShouldRunLargeTest()) {
-    return;
-  }
-  EXPECT_SUCCEEDED(
-      RegKey::SetValue(kRegKeyUserDefaultBrowser, NULL, _T("FiReFoX.ExE")));
-  BrowserType type = BROWSER_UNKNOWN;
-  EXPECT_SUCCEEDED(GetDefaultBrowserType(&type));
-  EXPECT_EQ(BROWSER_FIREFOX, type);
-}
-
-TEST_F(BrowserUtilsDefaultBrowserSavedTest, GetDefaultBrowserType_Chrome) {
-  if (!ShouldRunLargeTest()) {
-    return;
-  }
-  EXPECT_SUCCEEDED(
-      RegKey::SetValue(kRegKeyUserDefaultBrowser, NULL, _T("ChRoMe.ExE")));
-  BrowserType type = BROWSER_UNKNOWN;
-  EXPECT_SUCCEEDED(GetDefaultBrowserType(&type));
-  EXPECT_EQ(BROWSER_CHROME, type);
-}
-
-TEST_F(BrowserUtilsDefaultBrowserSavedTest, GetDefaultBrowserType_Unsupported) {
-  if (!ShouldRunLargeTest()) {
-    return;
-  }
-  EXPECT_SUCCEEDED(
-      RegKey::SetValue(kRegKeyUserDefaultBrowser, NULL, _T("FoO.ExE")));
-  BrowserType type = BROWSER_UNKNOWN;
-  EXPECT_SUCCEEDED(GetDefaultBrowserType(&type));
-  EXPECT_EQ(BROWSER_UNKNOWN, type);
-}
-
-TEST(BrowserUtilsTest, BrowserTypeToProcessName_Unknown) {
-  CString exe_name;
-  EXPECT_EQ(E_FAIL, BrowserTypeToProcessName(BROWSER_UNKNOWN, &exe_name));
-  EXPECT_TRUE(exe_name.IsEmpty());
-}
-
-// Writes the default browser to ensure consistent results.
-TEST_F(BrowserUtilsDefaultBrowserSavedTest, BrowserTypeToProcessName_Default) {
-  if (!ShouldRunLargeTest()) {
-    return;
-  }
-  EXPECT_SUCCEEDED(
-      RegKey::SetValue(kRegKeyUserDefaultBrowser, NULL, _T("IeXpLoRe.ExE")));
-
-  CString default_exe_name;
-  EXPECT_SUCCEEDED(GetDefaultBrowserName(&default_exe_name));
-  EXPECT_STREQ(_T("IeXpLoRe.ExE"), default_exe_name);
-
-  CString exe_name;
-  EXPECT_SUCCEEDED(BrowserTypeToProcessName(BROWSER_DEFAULT, &exe_name));
-  EXPECT_STREQ(_T("IeXpLoRe.ExE"), exe_name);
-}
-
-TEST(BrowserUtilsTest, BrowserTypeToProcessName_Browsers) {
-  CString exe_name;
-  EXPECT_SUCCEEDED(BrowserTypeToProcessName(BROWSER_IE, &exe_name));
-  EXPECT_STREQ(_T("IEXPLORE.EXE"), exe_name);
-  EXPECT_SUCCEEDED(BrowserTypeToProcessName(BROWSER_FIREFOX, &exe_name));
-  EXPECT_STREQ(_T("FIREFOX.EXE"), exe_name);
-  EXPECT_SUCCEEDED(BrowserTypeToProcessName(BROWSER_CHROME, &exe_name));
-  EXPECT_STREQ(_T("CHROME.EXE"), exe_name);
-}
-
-TEST(BrowserUtilsTest, BrowserTypeToProcessName_Invalid) {
-  CString exe_name;
-  ExpectAsserts expect_asserts;
-  EXPECT_EQ(E_FAIL, BrowserTypeToProcessName(BROWSER_MAX, &exe_name));
-  EXPECT_TRUE(exe_name.IsEmpty());
-  EXPECT_EQ(E_FAIL,
-            BrowserTypeToProcessName(static_cast<BrowserType>(9), &exe_name));
-  EXPECT_TRUE(exe_name.IsEmpty());
-  EXPECT_EQ(E_FAIL,
-            BrowserTypeToProcessName(static_cast<BrowserType>(-1), &exe_name));
-  EXPECT_TRUE(exe_name.IsEmpty());
-}
-
-TEST(BrowserUtilsTest, GetBrowserImagePath_DefaultBrowser) {
-  CString browser;
-  ASSERT_SUCCEEDED(GetDefaultBrowserName(&browser));
-
-  BrowserType default_type = BROWSER_UNKNOWN;
-  if (browser.CompareNoCase(kIeExeName) == 0) {
-    default_type = BROWSER_IE;
-  } else if (browser.CompareNoCase(kFirefoxExeName) == 0) {
-    default_type = BROWSER_FIREFOX;
-  } else if (browser.CompareNoCase(kChromeExeName) == 0) {
-    default_type = BROWSER_CHROME;
-  }
-
-  CString exp_browser_path;
-  ASSERT_SUCCEEDED(GetDefaultBrowserPath(&exp_browser_path));
-
-  if (default_type == BROWSER_IE) {
-    CString path;
-    ASSERT_SUCCEEDED(GetBrowserImagePath(BROWSER_IE, &path));
-
-    CString long_name;
-    ASSERT_SUCCEEDED(ShortPathToLongPath(path, &long_name));
-    CString exp_long_name;
-    ASSERT_SUCCEEDED(ShortPathToLongPath(exp_browser_path, &exp_long_name));
-    ASSERT_STREQ(exp_long_name.MakeLower(), long_name.MakeLower());
-  } else if (default_type == BROWSER_FIREFOX) {
-    CString path;
-    ASSERT_SUCCEEDED(GetBrowserImagePath(BROWSER_FIREFOX, &path));
-
-    CString long_name;
-    ASSERT_SUCCEEDED(ShortPathToLongPath(path, &long_name));
-    CString exp_long_name;
-    ASSERT_SUCCEEDED(ShortPathToLongPath(exp_browser_path, &exp_long_name));
-    ASSERT_STREQ(exp_long_name.MakeLower(), long_name.MakeLower());
-  } else if (default_type == BROWSER_CHROME) {
-    CString path;
-    ASSERT_SUCCEEDED(GetBrowserImagePath(BROWSER_CHROME, &path));
-
-    CString long_name;
-    ASSERT_SUCCEEDED(ShortPathToLongPath(path, &long_name));
-    CString exp_long_name;
-    ASSERT_SUCCEEDED(ShortPathToLongPath(exp_browser_path, &exp_long_name));
-    ASSERT_STREQ(exp_long_name.MakeLower(), long_name.MakeLower());
-  }
-
-  CString path;
-  ASSERT_SUCCEEDED(GetBrowserImagePath(BROWSER_DEFAULT, &path));
-  CString long_name;
-  ASSERT_SUCCEEDED(ShortPathToLongPath(path, &long_name));
-  CString exp_long_name;
-  ASSERT_SUCCEEDED(ShortPathToLongPath(exp_browser_path, &exp_long_name));
-  ASSERT_STREQ(exp_long_name.MakeLower(), long_name.MakeLower());
-
-  ASSERT_FAILED(GetBrowserImagePath(BROWSER_UNKNOWN, &path));
-}
-
-// Try all browsers to get more test coverage.
-TEST(BrowserUtilsTest, GetBrowserImagePath_AllSupportedBrowsers) {
-  if (IsTestRunByLocalSystem()) {
-    return;
-  }
-
-  CString program_files_path;
-  EXPECT_SUCCEEDED(GetFolderPath(CSIDL_PROGRAM_FILES | CSIDL_FLAG_DONT_VERIFY,
-                                 &program_files_path));
-  CString path;
-
-  HRESULT hr = GetBrowserImagePath(BROWSER_IE, &path);
-  if (SUCCEEDED(hr)) {
-    EXPECT_EQ(0, path.CompareNoCase(program_files_path +
-                                    _T("\\Internet Explorer\\iexplore.exe")))
-        << _T("Actual path: ") << path.GetString();
-  } else {
-    EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), hr);
-  }
-
-  hr = GetBrowserImagePath(BROWSER_FIREFOX, &path);
-  if (SUCCEEDED(hr)) {
-    EXPECT_TRUE(
-        0 == path.CompareNoCase(program_files_path +
-                                _T("\\Mozilla Firefox\\firefox.exe")) ||
-        0 == path.CompareNoCase(
-                                _T("C:\\PROGRA~1\\MOZILL~1\\FIREFOX.EXE")) ||
-        0 == path.CompareNoCase(program_files_path +
-                                _T("\\Minefield\\FIREFOX.EXE"))) // Trunk build.
-        << _T("Actual path: ") << path.GetString();
-  } else {
-    EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), hr);
-  }
-
-  hr = GetBrowserImagePath(BROWSER_CHROME, &path);
-  if (SUCCEEDED(hr)) {
-    EXPECT_TRUE(
-        0 == path.CompareNoCase(program_files_path +
-                            _T("\\Google\\Chrome\\Application\\chrome.exe")) ||
-        0 == path.CompareNoCase(
-            GetLocalAppDataPath() +
-            _T("Google\\Chrome\\Application\\chrome.exe")))
-        << _T("Actual path: ") << path.GetString();
-  } else {
-    EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), hr);
-  }
-}
-
-TEST(BrowserUtilsTest, GetLegacyDefaultBrowserInfo) {
-  CString name;
-  CString browser_path;
-  EXPECT_SUCCEEDED(GetLegacyDefaultBrowserInfo(&name, &browser_path));
-  EXPECT_FALSE(browser_path.IsEmpty());
-  EXPECT_FALSE(name.IsEmpty());
-}
-
-TEST(BrowserUtilsTest, GetIeFontSize) {
-  uint32 font_size = 0;
-  const uint32 kMaxFontSize = 4;
-  EXPECT_TRUE(SUCCEEDED(GetIeFontSize(&font_size)) || IsTestRunByLocalSystem());
-  EXPECT_LE(font_size, kMaxFontSize);
-}
-
-TEST_F(GetLegacyDefaultBrowserInfoTest, ValidQuotedIE) {
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(
-      kRegKeyLegacyDefaultBrowserCommand,
-      NULL,
-      _T("\"C:\\Program Files\\Internet Explorer\\iexplore.exe\" -nohome")));
-
-  CString name;
-  CString browser_path;
-  EXPECT_SUCCEEDED(GetLegacyDefaultBrowserInfo(&name, &browser_path));
-  EXPECT_STREQ(_T("C:\\Program Files\\Internet Explorer\\iexplore.exe"),
-               browser_path);
-  EXPECT_STREQ(_T("iexplore.exe"), name);
-}
-
-TEST_F(GetLegacyDefaultBrowserInfoTest, ValidUnquotedPath) {
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(
-      kRegKeyLegacyDefaultBrowserCommand,
-      NULL,
-      _T("C:\\Program Files\\Internet Explorer\\iexplore.exe")));
-
-  CString name;
-  CString browser_path;
-  EXPECT_SUCCEEDED(GetLegacyDefaultBrowserInfo(&name, &browser_path));
-  EXPECT_STREQ(_T("C:\\Program Files\\Internet Explorer\\iexplore.exe"),
-               browser_path);
-  EXPECT_STREQ(_T("iexplore.exe"), name);
-}
-
-TEST_F(GetLegacyDefaultBrowserInfoTest, InvalidNoKey) {
-  CString name;
-  CString browser_path;
-  EXPECT_FAILED(GetLegacyDefaultBrowserInfo(&name, &browser_path));
-  EXPECT_TRUE(browser_path.IsEmpty());
-  EXPECT_TRUE(name.IsEmpty());
-}
-
-TEST_F(GetLegacyDefaultBrowserInfoTest, InvalidNoValue) {
-  EXPECT_HRESULT_SUCCEEDED(RegKey::CreateKey(
-      kRegKeyLegacyDefaultBrowserCommand));
-
-  CString name;
-  CString browser_path;
-  EXPECT_FAILED(GetLegacyDefaultBrowserInfo(&name, &browser_path));
-  EXPECT_TRUE(browser_path.IsEmpty());
-  EXPECT_TRUE(name.IsEmpty());
-}
-
-TEST_F(GetLegacyDefaultBrowserInfoTest, InvalidPath) {
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(
-      kRegKeyLegacyDefaultBrowserCommand,
-      NULL,
-      _T("\"C:\\Program File\\iexplore.exe\" -nohome")));
-
-  CString name;
-  CString browser_path;
-  EXPECT_FAILED(GetLegacyDefaultBrowserInfo(&name, &browser_path));
-  EXPECT_TRUE(browser_path.IsEmpty());
-  EXPECT_TRUE(name.IsEmpty());
-}
-
-TEST_F(GetLegacyDefaultBrowserInfoTest, InvalidUnquotedPath) {
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(
-      kRegKeyLegacyDefaultBrowserCommand,
-      NULL,
-      _T("C:\\Program Files\\Internet Explorer\\iexplore.exe -nohome")));
-
-  CString name;
-  CString browser_path;
-  EXPECT_FAILED(GetLegacyDefaultBrowserInfo(&name, &browser_path));
-  EXPECT_TRUE(browser_path.IsEmpty());
-  EXPECT_TRUE(name.IsEmpty());
-}
-
-TEST_F(GetLegacyDefaultBrowserInfoTest, InvalidUnquotedDirectory) {
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(
-      kRegKeyLegacyDefaultBrowserCommand,
-      NULL,
-      _T("C:\\Program Files\\Internet Explorer\\")));
-
-  CString name;
-  CString browser_path;
-  EXPECT_FAILED(GetLegacyDefaultBrowserInfo(&name, &browser_path));
-  EXPECT_TRUE(browser_path.IsEmpty());
-  EXPECT_TRUE(name.IsEmpty());
-}
-
-TEST_F(GetLegacyDefaultBrowserInfoTest, InvalidQuotedDirectory) {
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(
-      kRegKeyLegacyDefaultBrowserCommand,
-      NULL,
-      _T("\"C:\\Program Files\\Internet Explorer\\\" -nohome")));
-
-  CString name;
-  CString browser_path;
-  EXPECT_FAILED(GetLegacyDefaultBrowserInfo(&name, &browser_path));
-  EXPECT_TRUE(browser_path.IsEmpty());
-  EXPECT_TRUE(name.IsEmpty());
-}
-
-}  // namespace omaha
-
diff --git a/base/build.scons b/base/build.scons
deleted file mode 100644
index cf82007..0000000
--- a/base/build.scons
+++ /dev/null
@@ -1,105 +0,0 @@
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-env.BuildSConscript('logging')
-env.BuildSConscript('security')
-
-local_env = env.Clone()
-
-inputs = [
-    'accounts.cc',
-    'app_util.cc',
-    'atl_regexp.cc',
-    'browser_utils.cc',
-    'cgi.cc',
-    'clipboard.cc',
-    'command_line_parser.cc',
-    'command_line_validator.cc',
-    'commands.cc',
-    'crash_if_specific_error.cc',
-    'crc.cc',
-    'debug.cc',
-    'disk.cc',
-    'dynamic_link_dbghelp.cc',
-    'dynamic_link_kernel32.cc',
-    'encrypt.cc',
-    'error.cc',
-    'event_trace_controller.cc',
-    'event_trace_provider.cc',
-    'etw_log_writer.cc',
-    'exception_barrier.cc',
-    'exception_barrier_lowlevel.asm',
-    'exception_utils.cc',
-    'extractor.cc',
-    'file.cc',
-    'file_reader.cc',
-    'file_store.cc',
-    'file_ver.cc',
-    'firewall_product_detection.cc',
-    'highres_timer-win32.cc',
-    'localization.cc',
-    'logging.cc',
-    'md5.cc',
-    'module_utils.cc',
-    'omaha_version.cc',
-    'path.cc',
-    'pe_utils.cc',
-    'popup_menu.cc',
-    'process.cc',
-    'proc_utils.cc',
-    'program_instance.cc',
-    'queue_timer.cc',
-    'reactor.cc',
-    'reg_key.cc',
-    'regexp.cc',
-    'registry_hive.cc',
-    'registry_monitor_manager.cc',
-    'registry_store.cc',
-    'safe_format.cc',
-    'serializable_object.cc',
-    'service_utils.cc',
-    'shell.cc',
-    'shutdown_handler.cc',
-    'signatures.cc',
-    'signaturevalidator.cc',
-    'single_instance.cc',
-    'sta.cc',
-    'string.cc',
-    'synchronized.cc',
-    'system.cc',
-    'system_info.cc',
-    '../third_party/smartany/shared_any.cc',
-    'thread.cc',
-    'thread_pool.cc',
-    'time.cc',
-    'timer.cc',
-    'tr_rand.cc',
-    'user_info.cc',
-    'user_rights.cc',
-    'utils.cc',
-    'vista_utils.cc',
-    'vistautil.cc',
-    'window_utils.cc',
-    'wmi_query.cc',
-    'xml_utils.cc',
-    ]
-
-# Required by the exception barrier code.
-local_env.Append(ASFLAGS = ['/safeseh'])
-
-# Build these into a library.
-local_env.ComponentStaticLibrary('base', inputs)
diff --git a/base/cgi.cc b/base/cgi.cc
deleted file mode 100644
index 7175a4c..0000000
--- a/base/cgi.cc
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/cgi.h"
-
-#include <tchar.h>
-#include "base/basictypes.h"
-#include "omaha/base/debug.h"
-
-namespace omaha {
-
-static uint32 _needs_escape[8] = {
-  0xffffffffL,
-  0xf80008fdL,
-  0x78000001L,
-  0xb8000001L,
-  0xffffffffL,
-  0xffffffffL,
-  0xffffffffL,
-  0xffffffffL
-};
-#define needs_escape(c) (_needs_escape[(c)>>5]&(1<<((c)&31)))
-
-// Here are a couple utility methods to change ints to hex chars & back.
-inline int int_to_hex_digit(int i) {
-  ASSERT((i >= 0) && (i <= 16), (_T("")));
-  return ((i < 10) ? (i + '0') : ((i - 10) + 'A'));
-}
-
-inline int hex_digit_to_int(TCHAR c) {
-  ASSERT(isxdigit(c), (_T("")));
-  return ((c >= 'a') ? ((c - 'a') + 10) :
-          (c >= 'A') ? ((c - 'A') + 10) :
-          (c - '0'));
-}
-
-bool CGI::EscapeString(const TCHAR* src, int srcn, TCHAR* dst, int dstn) {
-  ASSERT1(src != dst);  // In-place escaping will fail.
-  ASSERT1(srcn >= 0);
-  ASSERT1(dstn >= 1);
-  dstn--;   // Number of characters we can write, not including null terminator.
-
-  int i, j;
-  for (i = 0, j = 0; i < srcn && j < dstn; i++) {
-    TCHAR c = src[i];
-    if (c == ' ') {
-      dst[j++] = '+';
-    } else if (!needs_escape(c)) {
-      dst[j++] = c;
-    } else if (j + 3 > dstn) {
-      break;  // Escape sequence will not fit.
-    } else {
-      dst[j++] = '%';
-      dst[j++] = static_cast<TCHAR>(int_to_hex_digit((c >> 4) & 0xf));
-      dst[j++] = static_cast<TCHAR>(int_to_hex_digit(c & 0xf));
-    }
-  }
-  dst[j] = '\0';
-  return i == srcn;
-}
-
-bool CGI::UnescapeString(const TCHAR* src, int srcn, TCHAR* dst, int dstn) {
-  ASSERT1(srcn >= 0);
-  ASSERT1(dstn >= 1);
-  dstn--;   // Number of characters we can write, not including null terminator.
-
-  int i, j;
-  for (i = 0, j = 0; i < srcn && j < dstn; ++j) {
-    TCHAR c = src[i++];
-    if (c == '+') {
-      dst[j] = ' ';
-    } else if (c != '%') {
-      dst[j] = c;
-    } else if (i + 2 > srcn) {
-      break;  // Escape sequence is incomplete.
-    } else if (!isxdigit(src[i]) || !isxdigit(src[i + 1])) {
-      break;  // Escape sequence isn't hex.
-    } else {
-      int num = hex_digit_to_int(src[i++]) << 4;
-      num += hex_digit_to_int(src[i++]);
-      dst[j] = static_cast<TCHAR>(num);
-    }
-  }
-  dst[j] = '\0';
-  return i == srcn;
-}
-
-}  // namespace omaha
-
diff --git a/base/cgi.h b/base/cgi.h
deleted file mode 100644
index bb78b08..0000000
--- a/base/cgi.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_CGI_H__
-#define OMAHA_COMMON_CGI_H__
-
-#include <tchar.h>
-
-namespace omaha {
-
-class CGI {
- public:
-  // Maximum factor by which EscapeString() can increase the string length
-  static const int kEscapeFactor = 3;
-
-  // EscapeString() converts funky characters found in "src[0,srcn-1]" into
-  // escape sequences.  The escaped string is placed back in "dst".  At most
-  // "dstn" characters are written into "dst", including the
-  // null-termination byte.  Returns true if
-  // successful, false if the escaped string will not fit entirely in "dstn"
-  // characters.  Since escaping can increase the length, "dst" should not
-  // be the same as "src".
-
-  // These functions always return a null-terminated string, even if they
-  // fail (e.g. if a bad escape sequence is found).  As a consequence, you
-  // must pass in a dstn > 0.
-  // If you want to guarantee that the result will fit, you need
-  //      dstn >= kEscapeFactor * srcn + 1
-  // for EscapeString and
-  //      dstn >= srcn + 1
-  // for UnescapeString.
-
-  static bool EscapeString(const TCHAR* src, int srcn, TCHAR* dst, int dstn);
-  static bool UnescapeString(const TCHAR* src, int srcn, TCHAR* dst, int dstn);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_CGI_H__
diff --git a/base/cgi_unittest.cc b/base/cgi_unittest.cc
deleted file mode 100644
index 0aec8c4..0000000
--- a/base/cgi_unittest.cc
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Unit test for the CGI escape/unescape string..
-
-#include "base/scoped_ptr.h"
-#include "omaha/base/cgi.h"
-#include "omaha/base/string.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-void TestEscapeUnescape(const TCHAR* origin, const TCHAR* escaped) {
-  int origin_len = lstrlen(origin);
-  int buffer_len = origin_len * CGI::kEscapeFactor + 1;
-  scoped_array<TCHAR> escaped_buffer(new TCHAR[buffer_len]);
-  ASSERT_TRUE(CGI::EscapeString(origin, origin_len,
-                                escaped_buffer.get(), buffer_len));
-  ASSERT_STREQ(escaped_buffer.get(), escaped);
-
-  scoped_array<TCHAR> origin_buffer(new TCHAR[buffer_len]);
-  ASSERT_TRUE(CGI::UnescapeString(escaped_buffer.get(),
-                                  lstrlen(escaped_buffer.get()),
-                                  origin_buffer.get(), buffer_len));
-  ASSERT_STREQ(origin_buffer.get(), origin);
-}
-
-TEST(CGITEST, EscapeUnescape) {
-  // Regular chars.
-  TCHAR origin1[] = _T("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
-  TestEscapeUnescape(origin1, origin1);
-
-  String_ToLower(origin1);
-  TestEscapeUnescape(origin1, origin1);
-
-  // Special chars.
-  TCHAR origin2[] =  _T("^&`{}|][\"<>\\");    // NOLINT
-  TCHAR escaped2[] = _T("%5E%26%60%7B%7D%7C%5D%5B%22%3C%3E%5C");
-  TestEscapeUnescape(origin2, escaped2);
-
-  // Real case.
-  TCHAR origin3[] = _T("http://foo2.bar.google.com:80/pagead/conversion/1067912086/?ai=123&gclid=456&label=installation&value=0.0");                    // NOLINT
-  TCHAR escaped3[] = _T("http://foo2.bar.google.com:80/pagead/conversion/1067912086/%3Fai%3D123%26gclid%3D456%26label%3Dinstallation%26value%3D0.0");   // NOLINT
-  TestEscapeUnescape(origin3, escaped3);
-}
-
-}  // namespace omaha
-
diff --git a/base/clipboard.cc b/base/clipboard.cc
deleted file mode 100644
index 5429555..0000000
--- a/base/clipboard.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/clipboard.h"
-#include "base/basictypes.h"
-#include "omaha/base/debug.h"
-
-namespace omaha {
-
-// Put the given string on the system clipboard
-void SetClipboard(const TCHAR *string_to_set) {
-  ASSERT(string_to_set, (L""));
-
-  int len = lstrlen(string_to_set);
-
-  //
-  // Note to developer: It is not always possible to step through this code
-  //  since the debugger will possibly steal the clipboard.  E.g. OpenClipboard
-  //  might succeed and EmptyClipboard might fail with "Thread does not have
-  //  clipboard open".
-  //
-
-  // Actual clipboard processing
-  if (::OpenClipboard(NULL)) {
-    BOOL b = ::EmptyClipboard();
-    ASSERT(b, (L"EmptyClipboard failed"));
-
-    // Include the terminating null
-    len++;
-
-    HANDLE copy_handle = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE,
-                                       len * sizeof(TCHAR));
-    ASSERT(copy_handle, (L""));
-
-    byte* copy_data = reinterpret_cast<byte*>(::GlobalLock(copy_handle));
-    memcpy(copy_data, string_to_set, len * sizeof(TCHAR));
-    ::GlobalUnlock(copy_handle);
-
-#ifdef _UNICODE
-    HANDLE h = ::SetClipboardData(CF_UNICODETEXT, copy_handle);
-#else
-    HANDLE h = ::SetClipboardData(CF_TEXT, copy_handle);
-#endif
-
-    ASSERT(h != NULL, (L"SetClipboardData failed"));
-    if (!h) {
-      ::GlobalFree(copy_handle);
-    }
-
-    VERIFY(::CloseClipboard(), (L""));
-  } else {
-    ASSERT(false, (L"OpenClipboard failed - %i", ::GetLastError()));
-  }
-}
-
-}  // namespace omaha
-
diff --git a/base/clipboard.h b/base/clipboard.h
deleted file mode 100644
index 832e853..0000000
--- a/base/clipboard.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_CLIPBOARD_H__
-#define OMAHA_COMMON_CLIPBOARD_H__
-
-#include <windows.h>
-#include <tchar.h>
-
-namespace omaha {
-
-// Copies the given string to the system clipboard.
-void SetClipboard(const TCHAR *string_to_set);
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_CLIPBOARD_H__
diff --git a/base/command_line_parser.cc b/base/command_line_parser.cc
deleted file mode 100644
index c52c0a3..0000000
--- a/base/command_line_parser.cc
+++ /dev/null
@@ -1,389 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/command_line_parser.h"
-#include "omaha/base/command_line_parser_internal.h"
-#include <shellapi.h>
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/path.h"
-
-namespace omaha {
-
-namespace internal {
-
-void CommandLineParserArgs::Reset() {
-  switch_arguments_.clear();
-}
-
-// Assumes switch_name is already lower case.
-HRESULT CommandLineParserArgs::AddSwitch(const CString& switch_name) {
-  ASSERT1(CString(switch_name).MakeLower().Compare(switch_name) == 0);
-  if (switch_arguments_.find(switch_name) != switch_arguments_.end()) {
-    return E_INVALIDARG;
-  }
-
-  StringVector string_vector;
-  switch_arguments_[switch_name] = string_vector;
-  return S_OK;
-}
-
-// Assumes switch_name is already lower case.
-HRESULT CommandLineParserArgs::AddSwitchArgument(const CString& switch_name,
-                                                 const CString& value) {
-  ASSERT1(CString(switch_name).MakeLower().Compare(switch_name) == 0);
-  ASSERT1(!switch_name.IsEmpty());
-  if (switch_name.IsEmpty()) {
-    // We don't have a switch yet, so this is just a base argument.
-    // Example command line:  "foo.exe myarg /someswitch"
-    // Here, myarg would be a base argument.
-    // TODO(omaha): base_args_.push_back(switch_name_str);
-    return E_INVALIDARG;
-  }
-
-  SwitchAndArgumentsMap::iterator iter = switch_arguments_.find(switch_name);
-  if (iter == switch_arguments_.end()) {
-    return E_UNEXPECTED;
-  }
-  (*iter).second.push_back(value);
-
-  return S_OK;
-}
-
-int CommandLineParserArgs::GetSwitchCount() const {
-  return switch_arguments_.size();
-}
-
-bool CommandLineParserArgs::HasSwitch(const CString& switch_name) const {
-  CString switch_name_lower = switch_name;
-  switch_name_lower.MakeLower();
-  return switch_arguments_.find(switch_name_lower) != switch_arguments_.end();
-}
-
-// The value at a particular index may change if switch_names are added
-// since we're using a map underneath.  But this keeps us from having to write
-// an interator and expose it externally.
-HRESULT CommandLineParserArgs::GetSwitchNameAtIndex(int index,
-                                                    CString* name) const {
-  ASSERT1(name);
-
-  if (index >= static_cast<int>(switch_arguments_.size())) {
-    return E_INVALIDARG;
-  }
-
-  SwitchAndArgumentsMapIter iter = switch_arguments_.begin();
-  for (int i = 0; i < index; ++i) {
-    ++iter;
-  }
-
-  *name = (*iter).first;
-
-  return S_OK;
-}
-
-HRESULT CommandLineParserArgs::GetSwitchArgumentCount(
-    const CString& switch_name,
-    int* count) const {
-  ASSERT1(count);
-
-  CString switch_name_lower = switch_name;
-  switch_name_lower.MakeLower();
-
-  SwitchAndArgumentsMapIter iter = switch_arguments_.find(switch_name_lower);
-  if (iter == switch_arguments_.end()) {
-    return E_INVALIDARG;
-  }
-
-  *count = (*iter).second.size();
-  return S_OK;
-}
-
-HRESULT CommandLineParserArgs::GetSwitchArgumentValue(
-    const CString& switch_name,
-    int argument_index,
-    CString* argument_value) const {
-  ASSERT1(argument_value);
-
-  CString switch_name_lower = switch_name;
-  switch_name_lower.MakeLower();
-
-  int count = 0;
-  HRESULT hr = GetSwitchArgumentCount(switch_name_lower, &count);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (argument_index >= count) {
-    return E_INVALIDARG;
-  }
-
-  SwitchAndArgumentsMapIter iter = switch_arguments_.find(switch_name_lower);
-  if (iter == switch_arguments_.end()) {
-    return E_INVALIDARG;
-  }
-
-  *argument_value = (*iter).second[argument_index];
-  return S_OK;
-}
-
-}  // namespace internal
-
-CommandLineParser::CommandLineParser() {
-  required_args_.reset(new internal::CommandLineParserArgs);
-  optional_args_.reset(new internal::CommandLineParserArgs);
-}
-
-CommandLineParser::~CommandLineParser() {
-}
-
-HRESULT CommandLineParser::ParseFromString(const wchar_t* command_line) {
-  CString command_line_str(command_line);
-  command_line_str.Trim(_T(" "));
-
-  if (command_line_str.IsEmpty()) {
-    // If the first arg to CommandLineToArgvW "is an empty string the function
-    // returns the path to the current executable file." However, it does not
-    // correctly handle the case when the path contains spaces - it breaks the
-    // path up into separate argv elements. To avoid issues while maintaining
-    // the expected behavior, manually get the command line in the empty case.
-    // See http://msdn.microsoft.com/en-us/library/bb776391.aspx.
-    VERIFY1(::GetModuleFileName(NULL,
-                                CStrBuf(command_line_str, MAX_PATH),
-                                MAX_PATH));
-    EnclosePath(&command_line_str);
-  }
-
-  int argc = 0;
-  wchar_t** argv = ::CommandLineToArgvW(command_line_str, &argc);
-  if (!argv) {
-    return HRESULTFromLastError();
-  }
-
-  HRESULT hr = ParseFromArgv(argc, argv);
-  ::LocalFree(argv);
-  return hr;
-}
-
-// TODO(Omaha): Move the rule parser into a separate class.
-// TODO(Omaha): Fail the regular command parser if [/ switch is passed.
-// ParseFromArgv parses either a rule or a command line.
-//
-// Rules have required and optional parameters. An example of a rule is:
-//     "gu.exe /install <extraargs> [/oem [/appargs <appargs> [/silent"
-// This creates a rule for a command line that requires "/install" for the rule
-// to match. The other parameters are optional, indicated by prefixes of "[/".
-//
-// Command lines do not use "[/", and use "/" for all parameters.
-// A command line that looks like this:
-//     "gu.exe /install <extraargs> /oem /appargs <appargs>"
-// will match the rule above.
-HRESULT CommandLineParser::ParseFromArgv(int argc, wchar_t** argv) {
-  if (argc == 0 || !argv) {
-    return E_INVALIDARG;
-  }
-
-  Reset();
-
-  if (argc == 1) {
-    // We only have the program name.  So, we're done parsing.
-    ASSERT1(!IsSwitch(argv[0]));
-    return S_OK;
-  }
-
-  CString current_switch_name;
-  bool is_optional_switch = false;
-
-  // Start parsing at the first argument after the program name (index 1).
-  for (int i = 1; i < argc; ++i) {
-    HRESULT hr = S_OK;
-    CString token = argv[i];
-    token.Trim(_T(" "));
-    if (IsSwitch(token)) {
-      hr = StripSwitchNameFromArgv(token, &current_switch_name);
-      if (FAILED(hr)) {
-        return hr;
-      }
-      hr = AddSwitch(current_switch_name);
-      if (FAILED(hr)) {
-        CORE_LOG(LE, (_T("[AddSwitch failed][%s][0x%x]"),
-                      current_switch_name, hr));
-        return hr;
-      }
-      is_optional_switch = false;
-    } else if (IsOptionalSwitch(token)) {
-      hr = StripOptionalSwitchNameFromArgv(token, &current_switch_name);
-      if (FAILED(hr)) {
-        return hr;
-      }
-      hr = AddOptionalSwitch(current_switch_name);
-      if (FAILED(hr)) {
-        CORE_LOG(LE, (_T("[AddOptionalSwitch failed][%s][0x%x]"),
-                      current_switch_name, hr));
-        return hr;
-      }
-      is_optional_switch = true;
-    } else {
-      hr = is_optional_switch ?
-          AddOptionalSwitchArgument(current_switch_name, token) :
-          AddSwitchArgument(current_switch_name, token);
-
-      if (FAILED(hr)) {
-        CORE_LOG(LE, (_T("[Adding switch argument failed][%d][%s][%s][0x%x]"),
-                      is_optional_switch, current_switch_name, token, hr));
-        return hr;
-      }
-    }
-  }
-
-  return S_OK;
-}
-
-bool CommandLineParser::IsSwitch(const CString& param) const {
-  // Switches must have a prefix (/) or (-), and at least one character.
-  if (param.GetLength() < 2) {
-    return false;
-  }
-
-  // All switches must start with / or -, and not contain any spaces.
-  // Since the argv parser strips out the enclosing quotes around an argument,
-  // we need to handle the following cases properly:
-  // * foo.exe /switch arg     -- /switch is a switch, arg is an arg
-  // * foo.exe /switch "/x y"  -- /switch is a switch, '/x y' is an arg and it
-  //   will get here _without_ the quotes.
-  // If param_str starts with / and contains no spaces, then it's a switch.
-  return ((param[0] == _T('/')) || (param[0] == _T('-'))) &&
-          (param.Find(_T(" ")) == -1) &&
-          (param.Find(_T("%20")) == -1);
-}
-
-bool CommandLineParser::IsOptionalSwitch(const CString& param) const {
-  // Optional switches must have a prefix ([/) or ([-), and at least one
-  // character.
-  return param[0] == _T('[') && IsSwitch(param.Right(param.GetLength() - 1));
-}
-
-HRESULT CommandLineParser::StripSwitchNameFromArgv(const CString& param,
-                                                   CString* switch_name) {
-  ASSERT1(switch_name);
-
-  if (!IsSwitch(param)) {
-    return E_INVALIDARG;
-  }
-
-  *switch_name = param.Right(param.GetLength() - 1);
-  switch_name->Trim(_T(" "));
-  switch_name->MakeLower();
-  return S_OK;
-}
-
-HRESULT CommandLineParser::StripOptionalSwitchNameFromArgv(const CString& param,
-                                                           CString* name) {
-  ASSERT1(name);
-
-  if (!IsOptionalSwitch(param)) {
-    return E_INVALIDARG;
-  }
-
-  return StripSwitchNameFromArgv(param.Right(param.GetLength() - 1), name);
-}
-
-void CommandLineParser::Reset() {
-  required_args_->Reset();
-  optional_args_->Reset();
-}
-
-HRESULT CommandLineParser::AddSwitch(const CString& switch_name) {
-  ASSERT1(switch_name == CString(switch_name).MakeLower());
-  return required_args_->AddSwitch(switch_name);
-}
-
-HRESULT CommandLineParser::AddSwitchArgument(const CString& switch_name,
-                                             const CString& argument_value) {
-  ASSERT1(switch_name == CString(switch_name).MakeLower());
-  return required_args_->AddSwitchArgument(switch_name, argument_value);
-}
-
-int CommandLineParser::GetSwitchCount() const {
-  return required_args_->GetSwitchCount();
-}
-
-bool CommandLineParser::HasSwitch(const CString& switch_name) const {
-  return required_args_->HasSwitch(switch_name);
-}
-
-// The value at a particular index may change if switch_names are added
-// since we're using a map underneath.  But this keeps us from having to write
-// an interator and expose it externally.
-HRESULT CommandLineParser::GetSwitchNameAtIndex(int index,
-                                                CString* switch_name) const {
-  return required_args_->GetSwitchNameAtIndex(index, switch_name);
-}
-
-HRESULT CommandLineParser::GetSwitchArgumentCount(const CString& switch_name,
-                                                  int* count) const {
-  return required_args_->GetSwitchArgumentCount(switch_name, count);
-}
-
-HRESULT CommandLineParser::GetSwitchArgumentValue(
-    const CString& switch_name,
-    int argument_index,
-    CString* argument_value) const {
-  return required_args_->GetSwitchArgumentValue(switch_name,
-                                               argument_index,
-                                               argument_value);
-}
-
-HRESULT CommandLineParser::AddOptionalSwitch(const CString& switch_name) {
-  ASSERT1(switch_name == CString(switch_name).MakeLower());
-  return optional_args_->AddSwitch(switch_name);
-}
-
-HRESULT CommandLineParser::AddOptionalSwitchArgument(const CString& switch_name,
-                                                     const CString& value) {
-  ASSERT1(switch_name == CString(switch_name).MakeLower());
-  return optional_args_->AddSwitchArgument(switch_name, value);
-}
-
-int CommandLineParser::GetOptionalSwitchCount() const {
-  return optional_args_->GetSwitchCount();
-}
-
-bool CommandLineParser::HasOptionalSwitch(const CString& switch_name) const {
-  return optional_args_->HasSwitch(switch_name);
-}
-
-// The value at a particular index may change if switch_names are added
-// since we're using a map underneath.  But this keeps us from having to write
-// an interator and expose it externally.
-HRESULT CommandLineParser::GetOptionalSwitchNameAtIndex(int index,
-                                                        CString* name) const {
-  return optional_args_->GetSwitchNameAtIndex(index, name);
-}
-
-HRESULT CommandLineParser::GetOptionalSwitchArgumentCount(const CString& name,
-                                                          int* count) const {
-  return optional_args_->GetSwitchArgumentCount(name, count);
-}
-
-HRESULT CommandLineParser::GetOptionalSwitchArgumentValue(const CString& name,
-                                                          int argument_index,
-                                                          CString* val) const {
-  return optional_args_->GetSwitchArgumentValue(name,
-                                               argument_index,
-                                               val);
-}
-
-}  // namespace omaha
diff --git a/base/command_line_parser.h b/base/command_line_parser.h
deleted file mode 100644
index 03171dc..0000000
--- a/base/command_line_parser.h
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_BASE_COMMAND_LINE_PARSER_H__
-#define OMAHA_BASE_COMMAND_LINE_PARSER_H__
-
-#include <windows.h>
-#include <atlstr.h>
-#include <map>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-
-namespace omaha {
-
-namespace internal {
-
-class CommandLineParserArgs;
-
-}  // namespace internal
-
-// This class will parse a command line either from a string or in argc/argv
-// format.  It then provides information about the parsed command line.
-// When passing the string, make sure it includes the program name as the first
-// argument.
-// A "switch" is an argument preceded by "/".  Each switch can take 0..n
-// arguments.
-// Example:  foo.exe /sw a "b b" /sw2 /sw3
-// * foo.exe is the program name
-// * sw, sw2, and sw3 are switches.
-// * a and 'b b' (without the quotes) are the arguments to the sw switch.
-// * sw has 2 arguments and sw2 and sw3 have no arguments.
-class CommandLineParser {
- public:
-  CommandLineParser();
-  ~CommandLineParser();
-
-  // Parses the command line from a string.  Must include the program name (e.g.
-  // foo.exe) as the first value in the command line.
-  HRESULT ParseFromString(const wchar_t* command_line);
-
-  // Parses the command line form argc/argv syntax.  Makes the assumption that
-  // argv[0] is the program name (e.g. foo.exe).
-  HRESULT ParseFromArgv(int argc, wchar_t** argv);
-
-  // TODO(Omaha): Name these methods "Required".
-  // Gets the number of required switches in the parsed command line.
-  int GetSwitchCount() const;
-
-  // Returns the required switch at a particular index.
-  HRESULT GetSwitchNameAtIndex(int index, CString* switch_name) const;
-
-  // Returns true if a required switch with the name switch_name is found.
-  bool HasSwitch(const CString& switch_name) const;
-
-  // Returns the number of required arguments for required switch switch_name.
-  HRESULT GetSwitchArgumentCount(const CString& switch_name,
-                                 int* count) const;
-
-  // Returns the value of a required switch argument at the specified offset.
-  HRESULT GetSwitchArgumentValue(const CString& switch_name,
-                                 int argument_index,
-                                 CString* argument_value) const;
-
-  // Functions that have the same functionality as the above functions,
-  // except they operate on the optional switches.
-  int GetOptionalSwitchCount() const;
-  bool HasOptionalSwitch(const CString& switch_name) const;
-  HRESULT GetOptionalSwitchNameAtIndex(int index, CString* switch_name) const;
-  HRESULT GetOptionalSwitchArgumentCount(const CString& switch_name,
-                                         int* count) const;
-  HRESULT GetOptionalSwitchArgumentValue(
-      const CString& switch_name,
-      int argument_index,
-      CString* argument_value) const;
-
- private:
-  bool IsSwitch(const CString& param) const;
-  HRESULT StripSwitchNameFromArgv(const CString& param, CString* switch_name);
-  bool IsOptionalSwitch(const CString& param) const;
-  HRESULT StripOptionalSwitchNameFromArgv(const CString& param, CString* name);
-
-  void Reset();
-
-  HRESULT AddSwitch(const CString& switch_name);
-  HRESULT AddSwitchArgument(const CString& switch_name,
-                            const CString& argument_value);
-  HRESULT AddOptionalSwitch(const CString& switch_name);
-  HRESULT AddOptionalSwitchArgument(const CString& switch_name,
-                                    const CString& argument_value);
-
-  scoped_ptr<internal::CommandLineParserArgs> required_args_;
-  scoped_ptr<internal::CommandLineParserArgs> optional_args_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(CommandLineParser);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_COMMAND_LINE_PARSER_H__
-
diff --git a/base/command_line_parser_internal.h b/base/command_line_parser_internal.h
deleted file mode 100644
index 61ac041..0000000
--- a/base/command_line_parser_internal.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_BASE_COMMAND_LINE_PARSER_INTERNAL_H_
-#define OMAHA_BASE_COMMAND_LINE_PARSER_INTERNAL_H_
-
-#include <windows.h>
-#include <map>
-#include <vector>
-
-namespace omaha {
-
-namespace internal {
-
-// Repository for switches and corresponding switch arguments for a command
-// line.
-class CommandLineParserArgs {
- public:
-  CommandLineParserArgs() {}
-  ~CommandLineParserArgs() {}
-
-  typedef std::vector<CString> StringVector;
-  typedef StringVector::const_iterator StringVectorIter;
-  typedef std::map<CString, StringVector > SwitchAndArgumentsMap;
-  typedef SwitchAndArgumentsMap::const_iterator SwitchAndArgumentsMapIter;
-
-  // Gets the number of switches in the parsed command line.  Will return 0 for
-  // count if a parse has not occurred.
-  int GetSwitchCount() const;
-
-  // Returns the switch at a particular index.
-  // This is meant for iteration only and is not guaranteed to be in the order
-  // of the switches in the parsed command line.
-  HRESULT GetSwitchNameAtIndex(int index, CString* switch_name) const;
-
-  // Returns true if a switch with the name switch_name is found.
-  bool HasSwitch(const CString& switch_name) const;
-
-  // Returns the number of arguments for switch_name.  Will fail if switch_name
-  // is not a valid switch.
-  HRESULT GetSwitchArgumentCount(const CString& switch_name, int* count) const;
-
-  // Returns the value of a switch argument at the specified offset.
-  // Fails if switch_name is not a valid switch.
-  HRESULT GetSwitchArgumentValue(const CString& switch_name,
-                                 int argument_index,
-                                 CString* argument_value) const;
-
-  void Reset();
-  HRESULT AddSwitch(const CString& switch_name);
-  HRESULT AddSwitchArgument(const CString& switch_name,
-                            const CString& argument_value);
-
- private:
-  SwitchAndArgumentsMap switch_arguments_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(CommandLineParserArgs);
-};
-
-}  // namespace internal
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_COMMAND_LINE_PARSER_INTERNAL_H_
-
diff --git a/base/command_line_parser_unittest.cc b/base/command_line_parser_unittest.cc
deleted file mode 100644
index aaa3f80..0000000
--- a/base/command_line_parser_unittest.cc
+++ /dev/null
@@ -1,175 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/command_line_parser.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-// This will succeed since the CommandLineToArgvW function returns the
-// path to the current executable file if it's passed the empty string.
-TEST(CommandLineParserTest, ParseFromString_NullString) {
-  CommandLineParser parser;
-  EXPECT_SUCCEEDED(parser.ParseFromString(NULL));
-  EXPECT_EQ(0, parser.GetSwitchCount());
-}
-
-// This will succeed since the CommandLineToArgvW function returns the
-// path to the current executable file if it's passed the empty string.
-TEST(CommandLineParserTest, ParseFromString_EmptyString) {
-  CommandLineParser parser;
-  EXPECT_SUCCEEDED(parser.ParseFromString(_T("")));
-  EXPECT_EQ(0, parser.GetSwitchCount());
-}
-
-// This will succeed since the CommandLineToArgvW function returns the
-// path to the current executable file if it's passed the empty string.
-TEST(CommandLineParserTest, ParseFromString_SpacesOnlyString) {
-  CommandLineParser parser;
-  EXPECT_SUCCEEDED(parser.ParseFromString(_T("    ")));
-}
-
-TEST(CommandLineParserTest, ParseFromArgv_NullArgv) {
-  CommandLineParser parser;
-  EXPECT_FAILED(parser.ParseFromArgv(0, NULL));
-}
-
-TEST(CommandLineParserTest, CallFunctionsBeforeParse) {
-  CommandLineParser parser;
-  int arg_count = 0;
-  CString arg_value;
-  EXPECT_FALSE(parser.HasSwitch(_T("foo")));
-  EXPECT_EQ(0, parser.GetSwitchCount());
-  EXPECT_FAILED(parser.GetSwitchArgumentCount(_T("foo"), &arg_count));
-  EXPECT_FAILED(parser.GetSwitchArgumentValue(_T("foo"), 0, &arg_value));
-}
-
-TEST(CommandLineParserTest, ParseFromString_ProgramNameOnly) {
-  CommandLineParser parser;
-  EXPECT_SUCCEEDED(parser.ParseFromString(_T("myprog.exe")));
-  EXPECT_EQ(0, parser.GetSwitchCount());
-}
-
-TEST(CommandLineParserTest, ValidateSwitchMixedCase) {
-  CommandLineParser parser;
-  EXPECT_SUCCEEDED(parser.ParseFromString(_T("myprog.exe /FooP")));
-  EXPECT_EQ(1, parser.GetSwitchCount());
-  EXPECT_TRUE(parser.HasSwitch(_T("foop")));
-  EXPECT_TRUE(parser.HasSwitch(_T("FooP")));
-  EXPECT_TRUE(parser.HasSwitch(_T("fOOp")));
-  EXPECT_TRUE(parser.HasSwitch(_T("FOOP")));
-  EXPECT_FALSE(parser.HasSwitch(_T("blAH")));
-}
-
-TEST(CommandLineParserTest, ParseFromString_OneSwitchNoArgs) {
-  CommandLineParser parser;
-  int arg_count = 0;
-  EXPECT_SUCCEEDED(parser.ParseFromString(_T("myprog.exe /foo")));
-  EXPECT_EQ(1, parser.GetSwitchCount());
-  EXPECT_TRUE(parser.HasSwitch(_T("foo")));
-  EXPECT_SUCCEEDED(parser.GetSwitchArgumentCount(_T("foo"), &arg_count));
-  EXPECT_EQ(0, arg_count);
-}
-
-TEST(CommandLineParserTest, ParseFromString_OneSwitchOneArg) {
-  CommandLineParser parser;
-  int arg_count = 0;
-  CString arg_value;
-  EXPECT_SUCCEEDED(parser.ParseFromString(_T("myprog.exe /foo bar")));
-  EXPECT_EQ(1, parser.GetSwitchCount());
-  EXPECT_TRUE(parser.HasSwitch(_T("foo")));
-  EXPECT_SUCCEEDED(parser.GetSwitchArgumentCount(_T("foo"), &arg_count));
-  EXPECT_EQ(1, arg_count);
-  EXPECT_SUCCEEDED(parser.GetSwitchArgumentValue(_T("foo"), 0, &arg_value));
-  EXPECT_STREQ(_T("bar"), arg_value);
-}
-
-TEST(CommandLineParserTest, ParseFromString_OneSwitchTwoArgs) {
-  CommandLineParser parser;
-  int arg_count = 0;
-  CString arg_value;
-  EXPECT_SUCCEEDED(parser.ParseFromString(_T("myprog.exe /foo bar baz")));
-  EXPECT_EQ(1, parser.GetSwitchCount());
-  EXPECT_TRUE(parser.HasSwitch(_T("foo")));
-  EXPECT_SUCCEEDED(parser.GetSwitchArgumentCount(_T("foo"), &arg_count));
-  EXPECT_EQ(2, arg_count);
-  EXPECT_SUCCEEDED(parser.GetSwitchArgumentValue(_T("foo"), 0, &arg_value));
-  EXPECT_STREQ(_T("bar"), arg_value);
-  EXPECT_SUCCEEDED(parser.GetSwitchArgumentValue(_T("foo"), 1, &arg_value));
-  EXPECT_STREQ(_T("baz"), arg_value);
-}
-
-TEST(CommandLineParserTest, ParseFromString_TwoSwitchesNoArgs) {
-  CommandLineParser parser;
-  int arg_count = 0;
-  CString arg_value;
-  EXPECT_SUCCEEDED(parser.ParseFromString(_T("myprog.exe /foo /bar")));
-  EXPECT_EQ(2, parser.GetSwitchCount());
-  EXPECT_TRUE(parser.HasSwitch(_T("foo")));
-  EXPECT_TRUE(parser.HasSwitch(_T("bar")));
-  EXPECT_SUCCEEDED(parser.GetSwitchArgumentCount(_T("foo"), &arg_count));
-  EXPECT_EQ(0, arg_count);
-  EXPECT_SUCCEEDED(parser.GetSwitchArgumentCount(_T("bar"), &arg_count));
-  EXPECT_EQ(0, arg_count);
-}
-
-TEST(CommandLineParserTest, ParseFromString_TwoSwitchesOneArgNoArg) {
-  CommandLineParser parser;
-  int arg_count = 0;
-  CString arg_value;
-  EXPECT_SUCCEEDED(parser.ParseFromString(_T("myprog.exe /foo blech /bar")));
-  EXPECT_EQ(2, parser.GetSwitchCount());
-  EXPECT_TRUE(parser.HasSwitch(_T("foo")));
-  EXPECT_TRUE(parser.HasSwitch(_T("bar")));
-  EXPECT_SUCCEEDED(parser.GetSwitchArgumentCount(_T("foo"), &arg_count));
-  EXPECT_EQ(1, arg_count);
-  EXPECT_SUCCEEDED(parser.GetSwitchArgumentValue(_T("foo"), 0, &arg_value));
-  EXPECT_STREQ(_T("blech"), arg_value);
-  EXPECT_SUCCEEDED(parser.GetSwitchArgumentCount(_T("bar"), &arg_count));
-  EXPECT_EQ(0, arg_count);
-}
-
-TEST(CommandLineParserTest, ParseFromString_ArgInQuotesWithLeadingSlash) {
-  CommandLineParser parser;
-  int arg_count = 0;
-  CString arg_value;
-  EXPECT_SUCCEEDED(parser.ParseFromString(_T("f.exe /pi \"arg\" \"/sw x\"")));
-  EXPECT_EQ(1, parser.GetSwitchCount());
-  EXPECT_TRUE(parser.HasSwitch(_T("pi")));
-  EXPECT_SUCCEEDED(parser.GetSwitchArgumentCount(_T("pi"), &arg_count));
-  EXPECT_EQ(2, arg_count);
-  EXPECT_SUCCEEDED(parser.GetSwitchArgumentValue(_T("pi"), 0, &arg_value));
-  EXPECT_STREQ(_T("arg"), arg_value);
-  EXPECT_SUCCEEDED(parser.GetSwitchArgumentValue(_T("pi"), 1, &arg_value));
-  EXPECT_STREQ(_T("/sw x"), arg_value);
-}
-
-// Paths with spaces and no enclosing quotes is not supported. Thus, there is
-// no test for it.
-TEST(CommandLineParserTest, ParseFromString_SpaceInPathWithQuotes) {
-  CommandLineParser parser;
-  int arg_count = 0;
-  CString arg_value;
-  EXPECT_SUCCEEDED(
-      parser.ParseFromString(_T("\"C:\\Space In Path\\myprog.exe\" /foo bar")));
-  EXPECT_EQ(1, parser.GetSwitchCount());
-  EXPECT_TRUE(parser.HasSwitch(_T("foo")));
-  EXPECT_SUCCEEDED(parser.GetSwitchArgumentCount(_T("foo"), &arg_count));
-  EXPECT_EQ(1, arg_count);
-  EXPECT_SUCCEEDED(parser.GetSwitchArgumentValue(_T("foo"), 0, &arg_value));
-  EXPECT_STREQ(_T("bar"), arg_value);
-}
-
-}  // namespace omaha
diff --git a/base/command_line_validator.cc b/base/command_line_validator.cc
deleted file mode 100644
index ef2cc76..0000000
--- a/base/command_line_validator.cc
+++ /dev/null
@@ -1,256 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/command_line_validator.h"
-
-#include <atlbase.h>
-
-#include "omaha/base/command_line_parser.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-CommandLineValidator::CommandLineValidator() : scenario_sequence_number_(0) {
-}
-
-CommandLineValidator::~CommandLineValidator() {
-  Clear();
-}
-
-HRESULT CommandLineValidator::CreateScenario(const CString& scenario_name) {
-  if (scenarios_.find(scenario_name) != scenarios_.end()) {
-    return E_INVALIDARG;
-  }
-
-  ScenarioParameters scenario_parameters;
-  scenarios_[scenario_name] = scenario_parameters;
-  return S_OK;
-}
-
-// TODO(Omaha): Instead of creating the scenario in the map then populating it,
-// which requires these methods to know about the map, verify the scenario
-// exists, etc. - why not build the scenario then add it to the map? That seems
-// more straightforward.
-HRESULT CommandLineValidator::AddScenarioParameter(
-    const CString& scenario_name,
-    const CString& switch_name,
-    int num_required_parameters) {
-  MapScenariosIter iter = scenarios_.find(scenario_name);
-  if (iter == scenarios_.end()) {
-    return E_INVALIDARG;
-  }
-
-  ScenarioParameter* scenario_parameter =
-      new ScenarioParameter(switch_name, num_required_parameters);
-  (*iter).second.required.push_back(scenario_parameter);
-  return S_OK;
-}
-
-HRESULT CommandLineValidator::AddOptionalScenarioParameter(
-    const CString& scenario_name,
-    const CString& switch_name,
-    int num_required_parameters) {
-  MapScenariosIter iter = scenarios_.find(scenario_name);
-  if (iter == scenarios_.end()) {
-    return E_INVALIDARG;
-  }
-
-  ScenarioParameter* scenario_parameter =
-      new ScenarioParameter(switch_name, num_required_parameters);
-  (*iter).second.optional.push_back(scenario_parameter);
-  return S_OK;
-}
-
-HRESULT CommandLineValidator::CreateScenarioFromCmdLine(
-    const CString& command_line,
-    CString* scenario_name) {
-  ASSERT1(scenario_name);
-
-  CommandLineParser parser;
-  HRESULT hr = parser.ParseFromString(command_line);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Generate a unique scenario name.
-  CString scenario_name_str;
-  do {
-    ++scenario_sequence_number_;
-    scenario_name_str.Format(_T("scenario_%d"), scenario_sequence_number_);
-  } while (scenarios_.find(scenario_name_str) != scenarios_.end());
-
-  CreateScenario(scenario_name_str);
-
-  int switch_count = parser.GetSwitchCount();
-  for (int idx_switch = 0; idx_switch < switch_count; ++idx_switch) {
-    CString switch_name;
-    hr = parser.GetSwitchNameAtIndex(idx_switch, &switch_name);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    int arg_count = 0;
-    hr = parser.GetSwitchArgumentCount(switch_name, &arg_count);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = AddScenarioParameter(scenario_name_str, switch_name, arg_count);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  switch_count = parser.GetOptionalSwitchCount();
-  for (int idx_switch = 0; idx_switch < switch_count; ++idx_switch) {
-    CString switch_name;
-    hr = parser.GetOptionalSwitchNameAtIndex(idx_switch, &switch_name);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    int arg_count = 0;
-    hr = parser.GetOptionalSwitchArgumentCount(switch_name, &arg_count);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = AddOptionalScenarioParameter(scenario_name_str,
-                                      switch_name,
-                                      arg_count);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  *scenario_name = scenario_name_str;
-
-  return S_OK;
-}
-
-HRESULT CommandLineValidator::Validate(
-    const CommandLineParser& command_line_parser,
-    CString* scenario_name) const {
-  // Attempt to verify the data within the command_line_parser against each of
-  // the scenarios.
-  MapScenariosConstIter scenarios_iter;
-  for (scenarios_iter = scenarios_.begin();
-       scenarios_iter != scenarios_.end();
-       ++scenarios_iter) {
-    // Make sure we have a match for the number of switches in this scenario.
-    int parser_switch_count = command_line_parser.GetSwitchCount();
-    int scenario_required_switch_count =
-        (*scenarios_iter).second.required.size();
-    int scenario_optional_switch_count =
-        (*scenarios_iter).second.optional.size();
-
-    if (parser_switch_count < scenario_required_switch_count ||
-        parser_switch_count > scenario_required_switch_count +
-                              scenario_optional_switch_count) {
-      continue;
-    }
-
-    if (DoesScenarioMatch(command_line_parser, (*scenarios_iter).second)) {
-      *scenario_name = (*scenarios_iter).first;
-      return S_OK;
-    }
-  }
-
-  return GOOGLEUPDATE_COMMANDLINE_E_NO_SCENARIO_HANDLER_MATCHED;
-}
-
-bool CommandLineValidator::DoesScenarioMatch(
-    const CommandLineParser& command_line_parser,
-    const ScenarioParameters& scenario_parameters) const {
-  // Make sure that each switch matches with the right number of arguments.
-  ScenarioParameterVectorConstIter parameter_iter;
-  for (parameter_iter = scenario_parameters.required.begin();
-       parameter_iter != scenario_parameters.required.end();
-       ++parameter_iter) {
-    CString current_switch_name = (*parameter_iter)->switch_name_;
-    // This would probably allow duplicate switches (i.e. /c /c) in a command
-    // line.
-    if (!command_line_parser.HasSwitch(current_switch_name)) {
-      return false;
-    }
-
-    int arg_count = 0;
-    HRESULT hr = command_line_parser.GetSwitchArgumentCount(current_switch_name,
-                                                            &arg_count);
-    if (FAILED(hr)) {
-      return false;
-    }
-
-    int switch_arg_count = (*parameter_iter)->num_required_parameters_;
-    if (arg_count != switch_arg_count) {
-      return false;
-    }
-  }
-
-  int parser_optional_switch_count = command_line_parser.GetSwitchCount() -
-                                     scenario_parameters.required.size();
-  for (parameter_iter = scenario_parameters.optional.begin();
-       parser_optional_switch_count != 0 &&
-           parameter_iter != scenario_parameters.optional.end();
-       ++parameter_iter) {
-    CString current_switch_name = (*parameter_iter)->switch_name_;
-    // This would probably allow duplicate optional switches (i.e. /oem /oem) in
-    // a command line.
-    if (!command_line_parser.HasSwitch(current_switch_name)) {
-      continue;
-    }
-
-    int arg_count = 0;
-    HRESULT hr = command_line_parser.GetSwitchArgumentCount(current_switch_name,
-                                                            &arg_count);
-    if (FAILED(hr)) {
-      return false;
-    }
-
-    int switch_arg_count = (*parameter_iter)->num_required_parameters_;
-    if (arg_count != switch_arg_count) {
-      return false;
-    }
-    --parser_optional_switch_count;
-  }
-
-  return parser_optional_switch_count == 0;
-}
-
-void CommandLineValidator::Clear() {
-  MapScenariosIter scenarios_iter;
-  for (scenarios_iter = scenarios_.begin();
-       scenarios_iter != scenarios_.end();
-       ++scenarios_iter) {
-    ScenarioParameterVectorIter param_iter;
-    for (param_iter = (*scenarios_iter).second.required.begin();
-         param_iter != (*scenarios_iter).second.required.end();
-         ++param_iter) {
-      delete *param_iter;
-    }
-    for (param_iter = (*scenarios_iter).second.optional.begin();
-         param_iter != (*scenarios_iter).second.optional.end();
-         ++param_iter) {
-      delete *param_iter;
-    }
-  }
-  scenarios_.clear();
-}
-
-}  // namespace omaha
-
diff --git a/base/command_line_validator.h b/base/command_line_validator.h
deleted file mode 100644
index f20fa21..0000000
--- a/base/command_line_validator.h
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#ifndef OMAHA_BASE_COMMAND_LINE_VALIDATOR_H__
-#define OMAHA_BASE_COMMAND_LINE_VALIDATOR_H__
-
-#include <windows.h>
-#include <atlstr.h>
-#include <map>
-#include <vector>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-class CommandLineParser;
-
-// This class allows creation of scenarios for command line combinations and
-// then provides a mechanism to validate a command line against those scenarios
-// to determine if there's a match.
-class CommandLineValidator {
- public:
-  class ScenarioParameter {
-   public:
-    ScenarioParameter(const TCHAR* switch_name, int num_required_parameters)
-      : switch_name_(switch_name),
-        num_required_parameters_(num_required_parameters) {
-    }
-    ~ScenarioParameter() {}
-
-    CString switch_name_;
-    int num_required_parameters_;
-
-   private:
-    DISALLOW_EVIL_CONSTRUCTORS(ScenarioParameter);
-  };
-
-  typedef std::vector<ScenarioParameter*> ScenarioParameterVector;
-  typedef ScenarioParameterVector::iterator ScenarioParameterVectorIter;
-  typedef ScenarioParameterVector::const_iterator
-      ScenarioParameterVectorConstIter;
-
-  struct ScenarioParameters {
-   public:
-    ScenarioParameterVector required;
-    ScenarioParameterVector optional;
-  };
-
-  typedef std::map<CString, ScenarioParameters> MapScenarios;
-  typedef MapScenarios::iterator MapScenariosIter;
-  typedef MapScenarios::const_iterator MapScenariosConstIter;
-
-  CommandLineValidator();
-  ~CommandLineValidator();
-
-  void Clear();
-
-  // Parses a command line rule and builds a scenario from it.  Returns a
-  // generated scenario name.
-  // Rules have required and optional parameters. An example of a rule is:
-  //     "gu.exe /install <extraargs> [/oem [/appargs <appargs> [/silent"
-  HRESULT CreateScenarioFromCmdLine(const CString& command_line,
-                                    CString* scenario_name);
-
-  // Validates a CommandLineParser against all scenarios.  If a match, returns
-  // S_OK and the scenario_name.  Fails if not a match.
-  // command_line_parser must already be compiled before calling.
-  HRESULT Validate(const CommandLineParser& command_line_parser,
-                   CString* scenario_name) const;
-
-  // Creates a scenario by name.
-  HRESULT CreateScenario(const CString& scenario_name);
-
-  // Adds a switch and its parameter count to an existing scenario.
-  HRESULT AddScenarioParameter(const CString& scenario_name,
-                               const CString& switch_name,
-                               int num_required_parameters);
-  HRESULT AddOptionalScenarioParameter(const CString& scenario_name,
-                                       const CString& switch_name,
-                                       int num_required_parameters);
-
- private:
-  bool DoesScenarioMatch(const CommandLineParser& command_line_parser,
-                         const ScenarioParameters& scenario_parameters) const;
-
-  int scenario_sequence_number_;
-  MapScenarios scenarios_;
-  DISALLOW_EVIL_CONSTRUCTORS(CommandLineValidator);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_COMMAND_LINE_VALIDATOR_H__
-
diff --git a/base/command_line_validator_unittest.cc b/base/command_line_validator_unittest.cc
deleted file mode 100644
index 3979260..0000000
--- a/base/command_line_validator_unittest.cc
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/command_line_validator.h"
-#include "omaha/base/command_line_parser.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-const TCHAR* kScenario1Name = _T("core");
-const TCHAR* kScenario2Name = _T("SomeScenario");
-const TCHAR* kScenario3Name = _T("OtherMechanism");
-
-const TCHAR* kScenario1CmdLine = _T("program.exe /lang foo");
-const TCHAR* kScenario2CmdLine = _T("program.exe /install x y /service");
-const TCHAR* kScenario3CmdLine = _T("prog.exe /install x y /service /lang en");
-
-const TCHAR* kLangSwitch = _T("lang");
-const int kLangSwitchArgCount = 1;
-const TCHAR* kInstallSwitch = _T("install");
-const int kInstallSwitchArgCount = 2;
-const TCHAR* kServiceSwitch = _T("service");
-const int kServiceSwitchArgCount = 0;
-
-class CommandLineValidatorTest : public testing::Test {
- public:
-
- protected:
-  CommandLineValidatorTest() {
-  }
-
-  virtual void SetUp() {
-    scenario_match_name_.Empty();
-
-    // This validator only has one scenario.
-    validator1_.Clear();
-    // "program.exe /lang foo"
-    validator1_.CreateScenario(kScenario1Name);
-    validator1_.AddScenarioParameter(kScenario1Name,
-                                     kLangSwitch,
-                                     kLangSwitchArgCount);
-
-    // This validator has three scenarios.
-    validator2_.Clear();
-    // "program.exe /lang foo"
-    validator2_.CreateScenario(kScenario1Name);
-    validator2_.AddScenarioParameter(kScenario1Name,
-                                     kLangSwitch,
-                                     kLangSwitchArgCount);
-
-    // "program.exe /install x y /service"
-    validator2_.CreateScenario(kScenario2Name);
-    validator2_.AddScenarioParameter(kScenario2Name,
-                                     kInstallSwitch,
-                                     kInstallSwitchArgCount);
-    validator2_.AddScenarioParameter(kScenario2Name,
-                                     kServiceSwitch,
-                                     kServiceSwitchArgCount);
-
-    // "program.exe /install x y /service /lang en"
-    validator2_.CreateScenario(kScenario3Name);
-    validator2_.AddScenarioParameter(kScenario3Name,
-                                     kInstallSwitch,
-                                     kInstallSwitchArgCount);
-    validator2_.AddScenarioParameter(kScenario3Name,
-                                     kServiceSwitch,
-                                     kServiceSwitchArgCount);
-    validator2_.AddScenarioParameter(kScenario3Name,
-                                     kLangSwitch,
-                                     kLangSwitchArgCount);
-  }
-
-  virtual void TearDown() {
-  }
-
-  CommandLineValidator validator1_;
-  CommandLineValidator validator2_;
-  CommandLineParser parser_;
-  CString scenario_match_name_;
-};
-
-TEST_F(CommandLineValidatorTest, BasicScenarioPass) {
-  EXPECT_SUCCEEDED(parser_.ParseFromString(kScenario1CmdLine));
-  EXPECT_SUCCEEDED(validator1_.Validate(parser_, &scenario_match_name_));
-  EXPECT_STREQ(kScenario1Name, scenario_match_name_);
-}
-
-TEST_F(CommandLineValidatorTest, BasicScenarioFail) {
-  EXPECT_SUCCEEDED(parser_.ParseFromString(_T("goopdate.exe /something bad")));
-  EXPECT_FAILED(validator1_.Validate(parser_, &scenario_match_name_));
-}
-
-TEST_F(CommandLineValidatorTest, Scenario1PassMulti) {
-  EXPECT_SUCCEEDED(parser_.ParseFromString(kScenario1CmdLine));
-  EXPECT_SUCCEEDED(validator2_.Validate(parser_, &scenario_match_name_));
-  EXPECT_STREQ(kScenario1Name, scenario_match_name_);
-}
-
-TEST_F(CommandLineValidatorTest, Scenario2PassMulti) {
-  EXPECT_SUCCEEDED(parser_.ParseFromString(kScenario2CmdLine));
-  EXPECT_SUCCEEDED(validator2_.Validate(parser_, &scenario_match_name_));
-  EXPECT_STREQ(kScenario2Name, scenario_match_name_);
-}
-
-TEST_F(CommandLineValidatorTest, Scenario3PassMulti) {
-  EXPECT_SUCCEEDED(parser_.ParseFromString(kScenario3CmdLine));
-  EXPECT_SUCCEEDED(validator2_.Validate(parser_, &scenario_match_name_));
-  EXPECT_STREQ(kScenario3Name, scenario_match_name_);
-}
-
-TEST_F(CommandLineValidatorTest, ScenarioFailMulti) {
-  EXPECT_SUCCEEDED(parser_.ParseFromString(_T("Goopdate.exe /fail me /here")));
-  EXPECT_FAILED(validator2_.Validate(parser_, &scenario_match_name_));
-}
-
-}  // namespace omaha
-
diff --git a/base/commands.cc b/base/commands.cc
deleted file mode 100644
index 96aa896..0000000
--- a/base/commands.cc
+++ /dev/null
@@ -1,578 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Parse command-line options
-
-#include "omaha/base/commands.h"
-#include <cstdlib>
-#include "base/scoped_ptr.h"
-#include "omaha/base/cgi.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-#define kNameValueChar  _T('=')
-#define kTrueValue      _T("true")
-#define kFalseValue     _T("false")
-#define kOnValue        _T("on")
-#define kOffValue       _T("off")
-
-
-//
-// Helper functions
-//
-
-template<class T>
-HRESULT ConvertValue(const TCHAR* str_value, T* value);
-
-// Convert the three-valued value from the string representation
-template<>
-HRESULT ConvertValue<ThreeValue>(const TCHAR* str_value, ThreeValue* value) {
-  ASSERT1(value);
-
-  *value = VALUE_NOT_SET;
-  if (str_value && *str_value) {
-    if (String_StrNCmp(str_value,
-                       kTrueValue,
-                       TSTR_SIZE(kTrueValue) + 1,
-                       true) == 0 ||
-        String_StrNCmp(str_value,
-                       kOnValue,
-                       TSTR_SIZE(kOnValue) + 1,
-                       true) == 0) {
-      *value = TRUE_VALUE;
-    } else if (String_StrNCmp(str_value,
-                              kFalseValue,
-                              TSTR_SIZE(kFalseValue) + 1,
-                              true) == 0 ||
-               String_StrNCmp(str_value,
-                              kOffValue,
-                              TSTR_SIZE(kOffValue) + 1,
-                              true) == 0) {
-      *value = FALSE_VALUE;
-    } else {
-      return CI_E_INVALID_ARG;
-    }
-  }
-  return S_OK;
-}
-
-// Convert the int value from the string representation
-template<>
-HRESULT ConvertValue<int>(const TCHAR* str_value, int* value) {
-  ASSERT1(str_value && *str_value);
-  ASSERT1(value);
-
-  if (_set_errno(0)) {
-    return E_FAIL;
-  }
-
-  *value = _tcstol(str_value, NULL, 0);
-  if (errno == ERANGE) {
-    return CI_E_INVALID_ARG;
-  }
-  return S_OK;
-}
-
-// Convert the unsigned int value from the string representation
-template<>
-HRESULT ConvertValue<uint32>(const TCHAR* str_value, uint32* value) {
-  ASSERT1(str_value && *str_value);
-  ASSERT1(value);
-
-  if (_set_errno(0)) {
-    return E_FAIL;
-  }
-
-  *value = _tcstoul(str_value, NULL, 0);
-  if (errno == ERANGE) {
-    return CI_E_INVALID_ARG;
-  }
-  return S_OK;
-}
-
-// Convert the string value from the string representation
-HRESULT ConvertValue(const TCHAR* str_value, CString* value, bool to_unescape) {
-  ASSERT1(str_value && *str_value);
-  ASSERT1(value);
-
-  *value = str_value;
-
-  if (to_unescape) {
-    int length = value->GetLength();
-    scoped_array<TCHAR> unescaped_value(new TCHAR[length + 1]);
-    RET_IF_FALSE(CGI::UnescapeString(*value, length, unescaped_value.get(),
-      length + 1), CI_E_INVALID_ARG);
-    *value = unescaped_value.get();
-  }
-
-  return S_OK;
-}
-
-//
-// Struct CommandOption
-//
-void CommandOption::Init(const TCHAR* name, CommandOptionType type,
-                         void* value, int max_value_len) {
-  this->name = name;
-  this->type = type;
-  this->value = value;
-  this->max_value_len = max_value_len;
-}
-
-void CommandOption::Copy(const CommandOption& option) {
-  Init(option.name, option.type, option.value, option.max_value_len);
-}
-
-//
-// Class CommandParsingSimple
-//
-
-// Constructor
-CommandParsingSimple::CommandParsingSimple()
-    : separator_(_T(' ')) {
-}
-
-// Constructor
-CommandParsingSimple::CommandParsingSimple(TCHAR separator)
-    : separator_(separator) {
-}
-
-// Parse a command line string into args
-HRESULT CommandParsingSimple::ParseSimple(const TCHAR* cmd_line) {
-  ASSERT1(cmd_line);
-
-  UTIL_LOG(L3, (_T("[CommandParsingSimple::ParseSimple][%s]"), cmd_line));
-
-  args_.clear();
-
-  // Split command line string into list of arguments
-  for (const TCHAR* s = cmd_line; *s; ++s) {
-    // Handle separator
-    if (*s == separator_) {
-      continue;
-    }
-
-    // Handle single/double quote
-    if (*s == _T('"') || *s == _T('\'')) {
-      int right_quote = String_FindChar(s + 1, *s);
-      if (right_quote == -1) {
-        UTIL_LOG(LE, (_T("[CommandParsingSimple::ParseSimple]")
-                      _T("[single/double quote mismatches]")));
-        return CI_E_INVALID_ARG;
-      }
-      args_.push_back(CString(s + 1, right_quote));
-      s += right_quote + 1;
-      continue;
-    }
-
-    // Handle all other char
-    int next_space = String_FindChar(s + 1, separator_);
-    if (next_space == -1) {
-      args_.push_back(CString(s));
-      break;
-    } else {
-      args_.push_back(CString(s, next_space + 1));
-      s += next_space + 1;
-    }
-  }
-
-  return S_OK;
-}
-
-// Get the arg at specified position from the command line
-HRESULT CommandParsingSimple::GetAt(uint32 position, CString* arg) {
-  ASSERT1(arg);
-  ASSERT1(position < args_.size());
-
-  if (!arg || position >= args_.size()) {
-    return E_INVALIDARG;
-  }
-
-  *arg = args_[position];
-  return S_OK;
-}
-
-// Remove the arg at specified position from the command line
-HRESULT CommandParsingSimple::RemoveAt(uint32 position) {
-  ASSERT1(position < args_.size());
-
-  if (position >= args_.size()) {
-    return E_INVALIDARG;
-  }
-
-  uint32 i = 0;
-  std::vector<CString>::iterator it(args_.begin());
-  for (; i < position; ++it, ++i) {
-    ASSERT1(it != args_.end());
-  }
-  args_.erase(it);
-  return S_OK;
-}
-
-// Converted to the string
-HRESULT CommandParsingSimple::ToString(CString* cmd_line) {
-  ASSERT1(cmd_line);
-
-  bool is_first = true;
-  cmd_line->Empty();
-  for (std::vector<CString>::const_iterator it(args_.begin());
-       it != args_.end();
-       ++it) {
-    if (is_first) {
-      is_first = false;
-    } else {
-      cmd_line->AppendChar(separator_);
-    }
-    const TCHAR* arg = it->GetString();
-    if (String_FindChar(arg, separator_) != -1) {
-      cmd_line->AppendChar(_T('"'));
-      cmd_line->Append(arg);
-      cmd_line->AppendChar(_T('"'));
-    } else {
-      cmd_line->Append(arg);
-    }
-  }
-
-  return S_OK;
-}
-
-// Static Helper function that splits a command line
-// string into executable and any arguments
-HRESULT CommandParsingSimple::SplitExeAndArgs(const TCHAR* cmd_line,
-                                              CString* exe,
-                                              CString* args) {
-  ASSERT1(cmd_line);
-  ASSERT1(exe);
-  ASSERT1(args);
-
-  // Do the parsing
-  CommandParsingSimple cmd_parsing_simple;
-
-  RET_IF_FAILED(cmd_parsing_simple.ParseSimple(cmd_line));
-  RET_IF_FAILED(cmd_parsing_simple.GetAt(0, exe));
-  exe->Trim();
-  RET_IF_FAILED(cmd_parsing_simple.RemoveAt(0));
-  return (cmd_parsing_simple.ToString(args));
-}
-
-HRESULT CommandParsingSimple::SplitExeAndArgsGuess(const TCHAR* cmd_line,
-                                                   CString* exe,
-                                                   CString* args) {
-  ASSERT1(cmd_line);
-  ASSERT1(exe);
-  ASSERT1(args);
-
-  if (File::Exists(cmd_line)) {
-    // Optimization for the single executable case.
-    // Fill the [out] parameters and return.
-    *exe = cmd_line;
-    exe->Trim();
-    args->Empty();
-    return S_OK;
-  }
-
-  CString command_line(cmd_line);
-  // Check if the command line is properly enclosed, or that it does not have
-  // spaces
-  if (command_line.GetAt(0) != _T('"') && command_line.Find(_T(' ')) != -1) {
-    // File::Exists() does not handle leading spaces so remove it.
-    command_line.Trim();
-
-    // If not, need to find the executable, and if valid, enclose it in
-    // double quotes
-    const TCHAR* index_dot_exe = stristrW(command_line.GetString(), _T(".EXE"));
-
-    if (index_dot_exe != NULL) {
-      int dot_exe_end = (index_dot_exe - command_line.GetString())
-                         + arraysize(_T(".EXE")) - 1;
-      if (File::Exists(CString(command_line, dot_exe_end))) {
-        // Enclose the EXE in double quotes
-        command_line.Insert(dot_exe_end, _T('"'));
-        command_line.Insert(0, _T('"'));
-      } else {
-        UTIL_LOG(L1, (_T("[CommandParsing::SplitExeAndArgsGuess]")
-                      _T("[Could not guess the Executable file within [%s]. ")
-                      _T("Passing on to SplitExeAndArgs as-is."),
-                      command_line));
-      }
-    }
-  }
-
-  // Do the parsing
-  return SplitExeAndArgs(command_line, exe, args);
-}
-
-
-// Static Helper function that returns the number of arguments
-// in the passed in cmd_line
-HRESULT CommandParsingSimple::GetNumberOfArgs(const TCHAR* cmd_line,
-                                              uint32* number_of_args) {
-  ASSERT1(cmd_line);
-  ASSERT1(number_of_args);
-
-  // Do the parsing
-  CommandParsingSimple cmd_parsing_simple;
-
-  RET_IF_FAILED(cmd_parsing_simple.ParseSimple(cmd_line));
-  *number_of_args = cmd_parsing_simple.args_.size();
-  return S_OK;
-}
-
-
-//
-// Class CommandParsing
-//
-
-// Constructor
-CommandParsing::CommandParsing(CommandOption* options, int options_count)
-    : CommandParsingSimple(),
-      options_(options),
-      options_count_(options_count),
-      as_name_value_pair_(false) {
-}
-
-// Constructor
-CommandParsing::CommandParsing(CommandOption* options, int options_count,
-                               TCHAR separator, bool as_name_value_pair)
-    : CommandParsingSimple(separator),
-      options_(options),
-      options_count_(options_count),
-      as_name_value_pair_(as_name_value_pair) {
-}
-
-// Parse a command line string
-HRESULT CommandParsing::Parse(const TCHAR* cmd_line, bool ignore_unknown_args) {
-  ASSERT1(cmd_line);
-
-  UTIL_LOG(L3, (_T("[CommandParsing::Parse][%s][%d]"),
-                cmd_line, ignore_unknown_args));
-
-  // Parse into args_ vector
-  RET_IF_FAILED(ParseSimple(cmd_line));
-
-  // Do the internal parsing
-  return InternalParse(ignore_unknown_args);
-}
-
-// Parse a list of command line arguments
-HRESULT CommandParsing::ParseArguments(int argc, TCHAR* argv[]) {
-  if (argc <= 1) {
-    return S_OK;
-  }
-
-  // Push each argument
-  args_.clear();
-  for (int i = 1; i < argc; ++i) {
-    args_.push_back(CString(argv[i]));
-  }
-
-  // Do the internal parsing
-  return InternalParse(false);
-}
-
-// Internal parsing
-HRESULT CommandParsing::InternalParse(bool ignore_unknown_args) {
-  CString name, value;
-  for (std::vector<CString>::const_iterator it(args_.begin());
-       it != args_.end();
-       ++it) {
-    RET_IF_FAILED(ExtractName(&name, &it));
-
-    int i = FindOption(name);
-    if (i == -1) {
-      if (ignore_unknown_args) {
-        UTIL_LOG(L3, (_T("[CommandParsing::Parse][unknown arg %s]"), name));
-        continue;
-      } else {
-        UTIL_LOG(LE, (_T("[CommandParsing::Parse][invalid arg %s]"), name));
-        return CI_E_INVALID_ARG;
-      }
-    }
-
-    if (options_[i].type != COMMAND_OPTION_BOOL) {
-      RET_IF_FAILED(ExtractValue(options_[i], &value, &it, args_.end()));
-    }
-
-    switch (options_[i].type & COMMAND_OPTION_FLAGS_MASK) {
-      case COMMAND_OPTION_BOOL: {
-        bool bool_value = true;
-        SetParsedValue(options_[i], bool_value);
-        break;
-      }
-
-      case COMMAND_OPTION_THREE: {
-        ThreeValue three_value = VALUE_NOT_SET;
-        RET_IF_FAILED(ConvertValue(value, &three_value));
-        SetParsedValue(options_[i], three_value);
-        break;
-      }
-
-      case COMMAND_OPTION_INT: {
-        int int_value = 0;
-        RET_IF_FAILED(ConvertValue(value, &int_value));
-        SetParsedValue(options_[i], int_value);
-        break;
-      }
-
-      case COMMAND_OPTION_UINT: {
-        int uint_value = 0;
-        RET_IF_FAILED(ConvertValue(value, &uint_value));
-        SetParsedValue(options_[i], uint_value);
-        break;
-      }
-
-      case COMMAND_OPTION_STRING: {
-        CString str_value;
-        bool is_unescape = (options_[i].type & COMMAND_OPTION_UNESCAPE) != 0;
-        RET_IF_FAILED(ConvertValue(value, &str_value, is_unescape));
-        SetParsedValue(options_[i], str_value);
-        break;
-      }
-
-      default:
-        ASSERT1(false);
-        break;
-    }
-  }
-
-  return S_OK;
-}
-
-// Extract the name
-HRESULT CommandParsing::ExtractName(CString* name,
-                                    std::vector<CString>::const_iterator* it) {
-  ASSERT1(name);
-  ASSERT1(it);
-
-  if (as_name_value_pair_) {
-    int idx = (*it)->Find(kNameValueChar);
-    if (idx == -1) {
-      return CI_E_INVALID_ARG;
-    } else {
-      *name = (*it)->Left(idx);
-    }
-  } else {
-    *name = (*it)->GetString();
-  }
-  return S_OK;
-}
-
-// Extract the value
-// Also validate the value length if necessary
-HRESULT CommandParsing::ExtractValue(
-    const CommandOption& option,
-    CString* value,
-    std::vector<CString>::const_iterator* it,
-    const std::vector<CString>::const_iterator& end) {
-  ASSERT1(value);
-  ASSERT1(it);
-
-  if (as_name_value_pair_) {
-    int idx = (*it)->Find(kNameValueChar);
-    if (idx == -1) {
-      return CI_E_INVALID_ARG;
-    } else {
-      *value = (*it)->Right((*it)->GetLength() - idx - 1);
-    }
-  } else {
-    ++(*it);
-    if (*it == end) {
-      UTIL_LOG(LE, (_T("[CommandParsing::ExtractValue]")
-                    _T("[argument %s missing value]"), option.name));
-      return CI_E_INVALID_ARG;
-    }
-    *value = (*it)->GetString();
-  }
-
-  if (option.max_value_len >= 0) {
-    if (value->GetLength() > option.max_value_len) {
-      return CI_E_INVALID_ARG;
-    }
-  }
-
-  return S_OK;
-}
-
-// Set the parsed value
-template<class T>
-void CommandParsing::SetParsedValue(const CommandOption& option,
-                                    const T& value) {
-  if (option.type & COMMAND_OPTION_MULTIPLE) {
-    ASSERT((option.type & COMMAND_OPTION_FLAGS_MASK) != COMMAND_OPTION_BOOL,
-      (_T("COMMAND_OPTION_BOOL can't be used with COMMAND_OPTION_MULTIPLE")));
-    ASSERT((option.type & COMMAND_OPTION_FLAGS_MASK) != COMMAND_OPTION_THREE,
-      (_T("COMMAND_OPTION_THREE can't be used with COMMAND_OPTION_MULTIPLE")));
-
-    std::vector<T>* ptr = reinterpret_cast<std::vector<T>*>(option.value);
-    ptr->push_back(value);
-  } else {
-    T* ptr = reinterpret_cast<T*>(option.value);
-    *ptr = value;
-  }
-}
-
-// Helper function to find an option in the CommandOption list
-int CommandParsing::FindOption(const TCHAR* option_name) {
-  ASSERT1(option_name);
-
-  for (int i = 0; i < options_count_; ++i) {
-    if (String_StrNCmp(option_name,
-                       options_[i].name,
-                       options_[i].name.GetLength() + 1,
-                       false) == 0) {
-      return i;
-    }
-  }
-
-  return -1;
-}
-
-// Remove an option from the command line
-HRESULT CommandParsing::Remove(const TCHAR* option_name) {
-  ASSERT1(option_name);
-
-  for (std::vector<CString>::iterator it(args_.begin());
-       it != args_.end();
-       ++it) {
-    if (*it == option_name) {
-      int i = FindOption(option_name);
-      if (i == -1) {
-        return E_FAIL;
-      }
-      args_.erase(it);
-      if (!as_name_value_pair_) {
-        if (options_[i].type != COMMAND_OPTION_BOOL) {
-          if (it == args_.end()) {
-            return E_FAIL;
-          }
-          args_.erase(it);
-        }
-      }
-
-      return S_OK;
-    }
-  }
-
-  return E_FAIL;
-}
-
-}  // namespace omaha
-
diff --git a/base/commands.h b/base/commands.h
deleted file mode 100644
index c2a857b..0000000
--- a/base/commands.h
+++ /dev/null
@@ -1,159 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Parse command-line options
-//
-// Class CommandParsing supports two kinds of command line options:
-// 1) Traditional option, like "-b -v 100"
-// 2) Name-value-pairs, like "b=&v=100"
-
-#ifndef OMAHA_COMMON_COMMANDS_H_
-#define OMAHA_COMMON_COMMANDS_H_
-
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-enum ThreeValue {
-  VALUE_NOT_SET = 0,
-  TRUE_VALUE = 1,
-  FALSE_VALUE = 2
-};
-
-enum CommandOptionType {
-  COMMAND_OPTION_BOOL = 0x1,
-  COMMAND_OPTION_INT = 0x2,
-  COMMAND_OPTION_UINT = 0x3,
-  COMMAND_OPTION_STRING = 0x4,
-  COMMAND_OPTION_THREE = 0x5,
-  COMMAND_OPTION_UNESCAPE = 0x1000,
-  COMMAND_OPTION_MULTIPLE = 0x2000
-};
-
-#define COMMAND_OPTION_FLAGS_MASK   0x0FFF
-
-struct CommandOption {
-  void Init(const TCHAR* name, CommandOptionType type,
-            void* value, int max_value_len);
-  void Copy(const CommandOption& option);
-
-  CString name;
-  CommandOptionType type;
-  void* value;
-  int max_value_len;
-};
-
-class CommandParsingSimple {
- public:
-  // Static Helper function that splits a command line
-  // string into executable and any arguments
-  static HRESULT SplitExeAndArgs(const TCHAR* cmd_line,
-                                 CString* exe,
-                                 CString* args);
-
-  // Static Helper function that splits a command line
-  // string into executable and any arguments. Tries to
-  // guess the positioning of the EXE argument in cases
-  // where the EXE argument has spaces and is not enclosed
-  // in quotes. For instance, earlier versions of Google Desktop
-  // used to have an "Uninstall" string of the form:
-  // C:\Program Files\Google\Google Toolbar\GoogleToolbarSetup.exe -uninstall
-  // This function is meant to accomodate such cases.
-  static HRESULT SplitExeAndArgsGuess(const TCHAR* cmd_line,
-                                      CString* exe,
-                                      CString* args);
-
-  // Static Helper function that returns the number of arguments
-  // in the passed in cmd_line
-  static HRESULT GetNumberOfArgs(const TCHAR* cmd_line, uint32* number_of_args);
-
-  // Converted to a string
-  HRESULT ToString(CString* cmd_line);
-
- protected:
-  // Constructor
-  CommandParsingSimple();
-
-  // Constructor
-  explicit CommandParsingSimple(TCHAR separator);
-
-  // Parse a command line string into args
-  HRESULT ParseSimple(const TCHAR* cmd_line);
-
-  // Get the arg at specified position from the command line
-  HRESULT GetAt(uint32 position, CString* arg);
-
-  // Remove the arg at specified position from the command line
-  HRESULT RemoveAt(uint32 position);
-
-  TCHAR separator_;                   // Separator
-  std::vector<CString> args_;         // Splitted args
-
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(CommandParsingSimple);
-};
-
-
-class CommandParsing : public CommandParsingSimple {
- public:
-  // Constructor
-  CommandParsing(CommandOption* options, int options_count);
-
-  CommandParsing(CommandOption* options, int options_count,
-                 TCHAR separator, bool as_name_value_pair);
-
-  // Parse a command line string
-  HRESULT Parse(const TCHAR* cmd_line, bool ignore_unknown_args);
-
-  // Parse a list of command line arguments
-  HRESULT ParseArguments(int argc, TCHAR* argv[]);
-
-  // Remove an option from the command line
-  HRESULT Remove(const TCHAR* option_name);
-
- private:
-  // Internal parsing
-  HRESULT InternalParse(bool ignore_unknown_args);
-
-  // Extract the name
-  HRESULT ExtractName(CString* name, std::vector<CString>::const_iterator* it);
-
-  // Extract the value
-  // Also validate the value length if necessary
-  HRESULT ExtractValue(const CommandOption& option,
-                       CString* value,
-                       std::vector<CString>::const_iterator* it,
-                       const std::vector<CString>::const_iterator& end);
-
-  // Set the parsed value
-  template<class T>
-  static void SetParsedValue(const CommandOption& option, const T& value);
-
-  // Helper function to find an option in the CommandOption list
-  int FindOption(const TCHAR* option_name);
-
-  CommandOption* options_;            // Command-line option list
-  int options_count_;                 // Count of command-line options
-  bool as_name_value_pair_;           // Parse as name-value-pair
-
-  DISALLOW_EVIL_CONSTRUCTORS(CommandParsing);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_COMMANDS_H_
diff --git a/base/commands_unittest.cc b/base/commands_unittest.cc
deleted file mode 100644
index 8ecf2ef..0000000
--- a/base/commands_unittest.cc
+++ /dev/null
@@ -1,430 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Unit tests of command line options parsing
-
-#include <cstdio>
-#include "omaha/base/commands.h"
-#include "omaha/base/file.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-#define kDash         _T("-")
-#define kBoolOption   _T("bool")
-#define kThreeOption  _T("three")
-#define kIntOption    _T("int")
-#define kUintOption   _T("uint")
-#define kStrOption    _T("str")
-
-#define kIEBrowserExe \
-  _T("C:\\PROGRAM FILES\\Internet Explorer\\iexplore.exe")
-
-#define kIEBrowserQuotedExe \
-  _T("\"") kIEBrowserExe _T("\"")
-
-#define kIEBrowserQuotedArgs          _T("-h \"%1\"")
-#define kIEBrowserQuotedCommandLine \
-    kIEBrowserQuotedExe _T(" ") kIEBrowserQuotedArgs
-
-#define kIEBrowserQuotedExeResult \
-    _T("C:\\PROGRAM FILES\\Internet Explorer\\iexplore.exe")
-#define kIEBrowserQuotedArgsResult    _T("-h %1")
-
-#define kIEBrowserUnquotedCommandLine \
-    _T("C:\\Program Files\\Internet Explorer\\iexplore.exe -nohome")
-#define kIEBrowserUnquotedExe \
-    _T("C:\\Program Files\\Internet Explorer\\iexplore.exe")
-#define kIEBrowserUnquotedArgs        _T("-nohome")
-
-#define kGEUninstallCommandLine       _T("RunDll32 C:\\PROGRA~1\\COMMON~1\\INSTAL~1\\PROFES~1\\RunTime\\10\\01\\Intel32\\Ctor.dll,LaunchSetup \"C:\\Program Files\\InstallShield Installation Information\\{3DE5E7D4-7B88-403C-A3FD-2017A8240C5B}\\setup.exe\" -l0x9  -removeonly")  // NOLINT
-#define kGEUninstallExe               _T("RunDll32")
-#define kGEUninstallArgs              _T("C:\\PROGRA~1\\COMMON~1\\INSTAL~1\\PROFES~1\\RunTime\\10\\01\\Intel32\\Ctor.dll,LaunchSetup \"C:\\Program Files\\InstallShield Installation Information\\{3DE5E7D4-7B88-403C-A3FD-2017A8240C5B}\\setup.exe\" -l0x9 -removeonly")            // NOLINT
-
-
-struct TestData {
-  TestData() {
-    Clear();
-  }
-
-  void Clear() {
-    bool_value = false;
-    three_value = VALUE_NOT_SET;
-    int_value = 0;
-    uint_value = 0;
-    str_value.Empty();
-  }
-
-  bool bool_value;
-  ThreeValue three_value;
-  int int_value;
-  uint32 uint_value;
-  CString str_value;
-};
-
-void FillTestData(TestData* data) {
-  data->bool_value = true;
-  data->three_value = FALSE_VALUE;
-  data->int_value = -128;
-  data->uint_value = 256;
-  data->str_value = _T("Foo");
-}
-
-void CheckTestData(const TestData& d1, const TestData& d2) {
-  EXPECT_EQ(d1.bool_value, d2.bool_value);
-  EXPECT_EQ(d1.three_value, d2.three_value);
-  EXPECT_EQ(d1.int_value, d2.int_value);
-  EXPECT_EQ(d1.uint_value, d2.uint_value);
-  EXPECT_STREQ(d1.str_value, d2.str_value);
-}
-
-TEST(CommandsTest, TraditionalCommandLineOptionsParsingTest) {
-  TestData data;
-  FillTestData(&data);
-  CString cmd_line;
-  cmd_line.Format(_T("%s%s %s ")
-                  _T("%s%s %d ")
-                  _T("%s%s %u ")
-                  _T("%s%s %s "),
-                  kDash, kThreeOption, (data.three_value == TRUE_VALUE) ? _T("on") : _T("off"),   // NOLINT
-                  kDash, kIntOption, data.int_value,
-                  kDash, kUintOption, data.uint_value,
-                  kDash, kStrOption, data.str_value);
-  if (data.bool_value) {
-    cmd_line.AppendFormat(_T("%s%s"), kDash, kBoolOption);
-  }
-
-  TestData option_data;
-  CommandOption cmd_options[] = {
-    { kDash kBoolOption,  COMMAND_OPTION_BOOL,   &option_data.bool_value,  -1 },
-    { kDash kThreeOption, COMMAND_OPTION_THREE,  &option_data.three_value, -1 },
-    { kDash kIntOption,   COMMAND_OPTION_INT,    &option_data.int_value,   -1 },
-    { kDash kUintOption,  COMMAND_OPTION_UINT,   &option_data.uint_value,  -1 },
-    { kDash kStrOption,   COMMAND_OPTION_STRING, &option_data.str_value,   -1 }
-  };
-
-  option_data.Clear();
-  CommandParsing cmd_parsing(cmd_options, arraysize(cmd_options));
-  ASSERT_SUCCEEDED(cmd_parsing.Parse(cmd_line, false));
-
-  CheckTestData(option_data, data);
-}
-
-TEST(CommandsTest, TraditionalIgnoreUnknownArgsParsingTest) {
-  TestData data;
-  FillTestData(&data);
-  CString cmd_line;
-  cmd_line.Format(_T("%s%s %s ")
-                  _T("%s%s %d ")
-                  _T("%s%s %u ")
-                  _T("%s%s %s "),
-                  kDash, kThreeOption, (data.three_value == TRUE_VALUE) ? _T("on") : _T("off"),   // NOLINT
-                  kDash, kIntOption, data.int_value,
-                  kDash, kUintOption, data.uint_value,
-                  kDash, kStrOption, data.str_value);
-  if (data.bool_value) {
-    cmd_line.AppendFormat(_T("%s%s"), kDash, kBoolOption);
-  }
-
-  TestData option_data;
-  CommandOption cmd_options[] = {
-    { kDash kThreeOption, COMMAND_OPTION_THREE,  &option_data.three_value, -1 },
-    { kDash kIntOption,   COMMAND_OPTION_INT,    &option_data.int_value,   -1 },
-    { kDash kUintOption,  COMMAND_OPTION_UINT,   &option_data.uint_value,  -1 },
-    { kDash kStrOption,   COMMAND_OPTION_STRING, &option_data.str_value,   -1 }
-  };
-
-  option_data.Clear();
-  CommandParsing cmd_parsing(cmd_options, arraysize(cmd_options));
-  ASSERT_FAILED(cmd_parsing.Parse(cmd_line, false));
-  ASSERT_SUCCEEDED(cmd_parsing.Parse(cmd_line, true));
-
-  option_data.bool_value = data.bool_value;
-  CheckTestData(option_data, data);
-}
-
-TEST(CommandsTest, NameValuePairCommandLineOptionsParsingTest) {
-  TestData data;
-  FillTestData(&data);
-  CString cmd_line;
-  cmd_line.Format(
-      _T("%s=%s&")
-      _T("%s=%d&")
-      _T("%s=%u&")
-      _T("%s=%s"),
-      kThreeOption, (data.three_value == TRUE_VALUE) ? _T("on") : _T("off"),
-      kIntOption, data.int_value,
-      kUintOption, data.uint_value,
-      kStrOption, data.str_value);
-  if (data.bool_value) {
-    cmd_line.AppendFormat(_T("&%s="), kBoolOption);
-  }
-
-  TestData option_data;
-  CommandOption cmd_options[] = {
-    { kBoolOption,  COMMAND_OPTION_BOOL,   &option_data.bool_value,    -1 },
-    { kThreeOption, COMMAND_OPTION_THREE,  &option_data.three_value,   -1 },
-    { kIntOption,   COMMAND_OPTION_INT,    &option_data.int_value,     -1 },
-    { kUintOption,  COMMAND_OPTION_UINT,   &option_data.uint_value,    -1 },
-    { kStrOption,   COMMAND_OPTION_STRING, &option_data.str_value,     -1 }
-  };
-
-  option_data.Clear();
-  CommandParsing cmd_parsing(cmd_options,
-                             arraysize(cmd_options),
-                             _T('&'),
-                             true);
-  ASSERT_SUCCEEDED(cmd_parsing.Parse(cmd_line, false));
-
-  CheckTestData(option_data, data);
-}
-
-TEST(CommandsTest, NameValuePairIgnoreUnknownArgsParsingTest) {
-  TestData data;
-  FillTestData(&data);
-  CString cmd_line;
-  cmd_line.Format(
-      _T("%s=%s&")
-      _T("%s=%d&")
-      _T("%s=%u&")
-      _T("%s=%s"),
-      kThreeOption, (data.three_value == TRUE_VALUE) ? _T("on") : _T("off"),
-      kIntOption, data.int_value,
-      kUintOption, data.uint_value,
-      kStrOption, data.str_value);
-  if (data.bool_value) {
-    cmd_line.AppendFormat(_T("&%s="), kBoolOption);
-  }
-
-  TestData option_data;
-  CommandOption cmd_options[] = {
-    { kBoolOption,  COMMAND_OPTION_BOOL,   &option_data.bool_value,    -1 },
-    { kThreeOption, COMMAND_OPTION_THREE,  &option_data.three_value,   -1 },
-    { kUintOption,  COMMAND_OPTION_UINT,   &option_data.uint_value,    -1 },
-    { kStrOption,   COMMAND_OPTION_STRING, &option_data.str_value,     -1 }
-  };
-
-  option_data.Clear();
-  CommandParsing cmd_parsing(cmd_options,
-                             arraysize(cmd_options),
-                             _T('&'),
-                             true);
-  ASSERT_FAILED(cmd_parsing.Parse(cmd_line, false));
-  ASSERT_SUCCEEDED(cmd_parsing.Parse(cmd_line, true));
-
-  option_data.int_value = data.int_value;
-  CheckTestData(option_data, data);
-}
-
-TEST(CommandsTest, CommandParsingSimpleSplitTest) {
-  CString exe;
-  CString args;
-
-  // Test to make sure SplitExeAndArgs correctly splits
-  // a properly constructed command line
-  ASSERT_SUCCEEDED(
-    CommandParsingSimple::SplitExeAndArgs(kIEBrowserQuotedCommandLine,
-                                          &exe,
-                                          &args));
-
-  EXPECT_STREQ(kIEBrowserQuotedExeResult, exe);
-  EXPECT_STREQ(kIEBrowserQuotedArgsResult, args);
-}
-
-TEST(CommandsTest, CommandParsingGuessSplitTest) {
-  CString exe;
-  CString args;
-
-  // Test to make sure SplitExeAndArgsGuess correctly splits
-  // a properly constructed command line
-  ASSERT_SUCCEEDED(
-    CommandParsingSimple::SplitExeAndArgsGuess(kIEBrowserQuotedCommandLine,
-                                               &exe,
-                                               &args));
-
-  EXPECT_STREQ(kIEBrowserQuotedExeResult, exe);
-  EXPECT_STREQ(kIEBrowserQuotedArgsResult, args);
-
-  // Test to make sure SplitExeAndArgsGuess correctly splits
-  // an improperly constructed "Uninstall" command line
-  ASSERT_SUCCEEDED(
-    CommandParsingSimple::SplitExeAndArgsGuess(kIEBrowserUnquotedCommandLine,
-                                               &exe,
-                                               &args));
-
-  EXPECT_STREQ(kIEBrowserUnquotedExe, exe);
-  EXPECT_STREQ(kIEBrowserUnquotedArgs, args);
-
-  // Test to make sure SplitExeAndArgsGuess correctly splits
-  // a properly constructed "Uninstall" command line, where
-  // the executable does not have a ".EXE" extension, and
-  // where there happens to be an argument which happens to
-  // be an executable
-  ASSERT_SUCCEEDED(
-    CommandParsingSimple::SplitExeAndArgsGuess(kGEUninstallCommandLine,
-                                               &exe,
-                                               &args));
-
-  EXPECT_STREQ(kGEUninstallExe, exe);
-  EXPECT_STREQ(kGEUninstallArgs, args);
-}
-
-TEST(CommandsTest, CommandParsingGuessSplit_ExtraWhiteSpace) {
-  CString exe;
-  CString args;
-
-  EXPECT_SUCCEEDED(CommandParsingSimple::SplitExeAndArgsGuess(
-      kIEBrowserUnquotedCommandLine _T(" "),
-      &exe,
-      &args));
-  EXPECT_STREQ(kIEBrowserUnquotedExe, exe);
-  EXPECT_STREQ(kIEBrowserUnquotedArgs, args);
-
-  EXPECT_SUCCEEDED(CommandParsingSimple::SplitExeAndArgsGuess(
-      kIEBrowserUnquotedCommandLine _T("\t"),
-      &exe,
-      &args));
-  EXPECT_STREQ(kIEBrowserUnquotedExe, exe);
-  EXPECT_STREQ(kIEBrowserUnquotedArgs, args);
-
-  EXPECT_SUCCEEDED(CommandParsingSimple::SplitExeAndArgsGuess(
-      _T(" ") kIEBrowserUnquotedCommandLine,
-      &exe,
-      &args));
-  EXPECT_STREQ(kIEBrowserUnquotedExe, exe);
-  EXPECT_STREQ(kIEBrowserUnquotedArgs, args);
-
-  // The following cases have unexpected results.
-  // Quoting a command line with args is not handled correctly.
-  // The entire thing is interpreted as an EXE.
-
-  EXPECT_SUCCEEDED(CommandParsingSimple::SplitExeAndArgsGuess(
-      _T("\" ") kIEBrowserUnquotedCommandLine _T("\""),
-      &exe,
-      &args));
-  EXPECT_STREQ(kIEBrowserUnquotedCommandLine, exe);
-  EXPECT_TRUE(args.IsEmpty());
-
-  EXPECT_SUCCEEDED(CommandParsingSimple::SplitExeAndArgsGuess(
-      _T("\"") kIEBrowserUnquotedCommandLine _T(" \""),
-      &exe,
-      &args));
-  EXPECT_STREQ(kIEBrowserUnquotedCommandLine, exe);
-  EXPECT_TRUE(args.IsEmpty());
-
-  EXPECT_SUCCEEDED(CommandParsingSimple::SplitExeAndArgsGuess(
-      _T("\"") kIEBrowserUnquotedCommandLine _T("\t\""),
-      &exe,
-      &args));
-  EXPECT_STREQ(kIEBrowserUnquotedCommandLine, exe);
-  EXPECT_TRUE(args.IsEmpty());
-}
-
-TEST(CommandsTest, CommandParsingGuessSplit_CommandLineIsExistingFile) {
-  CString exe;
-  CString args;
-
-  EXPECT_TRUE(File::Exists(kIEBrowserExe));
-  EXPECT_SUCCEEDED(
-    CommandParsingSimple::SplitExeAndArgsGuess(kIEBrowserExe, &exe, &args));
-  EXPECT_STREQ(kIEBrowserExe, exe);
-  EXPECT_TRUE(args.IsEmpty());
-
-  // File::Exists does not handle enclosed paths.
-  EXPECT_FALSE(File::Exists(kIEBrowserQuotedExe));
-  EXPECT_SUCCEEDED(
-    CommandParsingSimple::SplitExeAndArgsGuess(kIEBrowserQuotedExe,
-                                               &exe,
-                                               &args));
-  EXPECT_STREQ(kIEBrowserExe, exe);
-  EXPECT_TRUE(args.IsEmpty());
-}
-
-TEST(CommandsTest,
-     CommandParsingGuessSplit_CommandLineIsExistingFileWithExtraWhiteSpace) {
-  CString exe;
-  CString args;
-
-  EXPECT_TRUE(File::Exists(kIEBrowserExe));
-  // File::Exists does not handle enclosed paths.
-  EXPECT_FALSE(File::Exists(kIEBrowserQuotedExe));
-
-  EXPECT_SUCCEEDED(
-    CommandParsingSimple::SplitExeAndArgsGuess(kIEBrowserExe _T(" "),
-                                               &exe,
-                                               &args));
-  EXPECT_STREQ(kIEBrowserExe, exe);
-  EXPECT_TRUE(args.IsEmpty());
-
-  EXPECT_SUCCEEDED(
-    CommandParsingSimple::SplitExeAndArgsGuess(kIEBrowserQuotedExe _T(" "),
-                                               &exe,
-                                               &args));
-  EXPECT_STREQ(kIEBrowserExe, exe);
-  EXPECT_TRUE(args.IsEmpty());
-
-  EXPECT_SUCCEEDED(
-    CommandParsingSimple::SplitExeAndArgsGuess(kIEBrowserExe _T("\t"),
-                                               &exe,
-                                               &args));
-  EXPECT_STREQ(kIEBrowserExe, exe);
-  EXPECT_TRUE(args.IsEmpty());
-
-  EXPECT_SUCCEEDED(
-    CommandParsingSimple::SplitExeAndArgsGuess(kIEBrowserQuotedExe _T("\t"),
-                                               &exe,
-                                               &args));
-  EXPECT_STREQ(kIEBrowserExe, exe);
-  // SplitExeAndArgs does not treat tab like whitespace and args aren't trimmed.
-  EXPECT_STREQ(_T("\t"), args);
-
-  EXPECT_SUCCEEDED(
-    CommandParsingSimple::SplitExeAndArgsGuess(_T(" ") kIEBrowserExe,
-                                               &exe,
-                                               &args));
-  EXPECT_STREQ(kIEBrowserExe, exe);
-  EXPECT_TRUE(args.IsEmpty());
-
-  EXPECT_SUCCEEDED(
-    CommandParsingSimple::SplitExeAndArgsGuess(_T(" ") kIEBrowserQuotedExe,
-                                               &exe,
-                                               &args));
-  EXPECT_STREQ(kIEBrowserExe, exe);
-  EXPECT_TRUE(args.IsEmpty());
-
-  EXPECT_SUCCEEDED(CommandParsingSimple::SplitExeAndArgsGuess(
-                       _T("\" ") kIEBrowserExe _T("\""),
-                       &exe,
-                       &args));
-  EXPECT_STREQ(kIEBrowserExe, exe);
-  EXPECT_TRUE(args.IsEmpty());
-
-  EXPECT_SUCCEEDED(CommandParsingSimple::SplitExeAndArgsGuess(
-                       _T("\"") kIEBrowserExe _T(" \""),
-                       &exe,
-                       &args));
-  EXPECT_STREQ(kIEBrowserExe, exe);
-  EXPECT_TRUE(args.IsEmpty());
-
-  EXPECT_SUCCEEDED(CommandParsingSimple::SplitExeAndArgsGuess(
-                       _T("\"") kIEBrowserExe _T("\t\""),
-                       &exe,
-                       &args));
-  EXPECT_STREQ(kIEBrowserExe, exe);
-  EXPECT_TRUE(args.IsEmpty());
-}
-
-}  // namespace omaha
-
diff --git a/base/commontypes.h b/base/commontypes.h
deleted file mode 100644
index 5c2de0b..0000000
--- a/base/commontypes.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// TODO(omaha): Maybe eliminate this file or at least rename it.
-
-#ifndef OMAHA_BASE_COMMONTYPES_H_
-#define OMAHA_BASE_COMMONTYPES_H_
-
-namespace omaha {
-
-// Isolate some VisualC++-isms to macros for easy redefinition
-#define SELECTANY __declspec(selectany)
-#define DLLIMPORT __declspec(dllimport)
-#define DLLEXPORT __declspec(dllexport)
-
-// Put this around string literals that don't need to be localized
-// to indicate this fact.  Note that you don't need to do this for string
-// literals used in functions where they obviously don't need to be localized,
-// such as REPORT(), XXX_LOG(), CHK(), ASSERT(), VERIFY(), TRACE(), dbgprint(),
-// OutputDebugString(), GetProcAddress(), GetModuleHandle(), etc.
-//
-// For large blocks of non-localizable string literals, you can use a comment
-// line including "SKIP_LOC_BEGIN" to start a non-localizable section of
-// your file, and "SKIP_LOC_END" to end the section.
-//
-// Don't worry about NOTRANSL or the SKIP_LOC blocks in unit tests, experimental
-// code, etc. as they are ignored when checking for localizable string literals.
-#define NOTRANSL(x) x
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_COMMONTYPES_H_
diff --git a/base/const_addresses.h b/base/const_addresses.h
deleted file mode 100644
index f00219a..0000000
--- a/base/const_addresses.h
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2004-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Constants for dealing with machines.
-//
-// Manifests are requested over HTTPS. All other network communication goes
-// over HTTP.
-
-#ifndef OMAHA_BASE_CONST_ADDRESSES_H_
-#define OMAHA_BASE_CONST_ADDRESSES_H_
-
-#include <tchar.h>
-#include "omaha/base/constants.h"
-
-namespace omaha {
-
-// Static string that gives the main Google website address
-// TODO(omaha): Rename this as a connection-check URL. Name should be in caps
-// and not include "Google".
-#define kGoogleHttpServer _T("www.") COMPANY_DOMAIN
-
-// Static string used as an identity for the "Omaha" Google domain.
-// TODO(omaha): Rename this as a plug-in domain.
-const TCHAR* const kGoopdateServer = _T("tools.") COMPANY_DOMAIN;
-
-// HTTP protocol prefix
-#define kProtoSuffix              _T("://")
-#define kFileProtoScheme          _T("file")
-#define kHttpProtoScheme          _T("http")
-#define kHttpsProtoScheme         _T("https")
-#define kHttpProto                kHttpProtoScheme kProtoSuffix
-#define kHttpsProto               kHttpsProtoScheme kProtoSuffix
-#define kFileProto                kFileProtoScheme kProtoSuffix
-
-// Default ports for proxies
-#define kDefaultHttpProxyPort     80
-#define kDefaultSslProxyPort      443
-
-// Update checks and manifest requests.
-const TCHAR* const kUrlUpdateCheck =
-    kHttpsProto _T("tools.") COMPANY_DOMAIN _T("/service/update2");
-
-// Pings.
-const TCHAR* const kUrlPing =
-    _T("http://tools.") COMPANY_DOMAIN _T("/service/update2");
-
-// Crash reports.
-const TCHAR* const kUrlCrashReport =
-    _T("http://clients2.") COMPANY_DOMAIN _T("/cr/report");
-
-// More information url.
-// Must allow query parameters to be appended to it.
-const TCHAR* const kUrlMoreInfo =
-    _T("http://www.") COMPANY_DOMAIN _T("/support/installer/?");
-
-// Code Red check url.
-const TCHAR* const kUrlCodeRedCheck =
-    _T("http://cr-tools.clients.") COMPANY_DOMAIN _T("/service/check2");
-
-// Usage stats url.
-const TCHAR* const kUrlUsageStatsReport =
-    _T("http://clients5.") COMPANY_DOMAIN _T("/tbproxy/usagestats");
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_CONST_ADDRESSES_H_
diff --git a/base/const_config.h b/base/const_config.h
deleted file mode 100644
index 13bb02f..0000000
--- a/base/const_config.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2003-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_BASE_CONST_CONFIG_H_
-#define OMAHA_BASE_CONST_CONFIG_H_
-
-#include "omaha/base/constants.h"
-
-namespace omaha {
-
-// TODO(omaha): Move these values used by debug.cc someplace else.
-#define kRegKeyShared        _T("Shared")
-#define kCiRegKeyShared      GOOPDATE_MAIN_KEY kRegKeyShared
-#define kRegValueReportIds   _T("report_ids")
-
-// TODO(omaha): Move these plugin values someplace else. Since we're building
-// constants, that should probably be the customization header. Move the Omaha 3
-// plugin equivalents from config.cc there as well.
-
-// NOTE: ONECLICK_PLUGIN_VERSION_ANSI is defined in main.scons
-// For example: kOneClickProgId == "Google.OneClickCtrl.1"
-const TCHAR* const kOneClickProgId = COMPANY_NAME_IDENTIFIER
-                                     _T(".OneClickCtrl.")
-                                     _T(ONECLICK_PLUGIN_VERSION_ANSI);
-// The plug-in MIME type.
-// For example:
-//     kOneClickPluginMimeTypeAnsi == "application/x-vnd.google.oneclickctrl.1"
-// TODO(omaha): Deal with the "Google.OneClickCtrl.%d") in
-// tools\goopdump\data_dumper_oneclick.cc after integrating goopdump.
-#define kOneClickPluginMimeTypeAnsi \
-    "application/x-vnd." COMPANY_DOMAIN_BASE_ANSI ".oneclickctrl." \
-     ONECLICK_PLUGIN_VERSION_ANSI
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_CONST_CONFIG_H_
diff --git a/base/const_debug.h b/base/const_debug.h
deleted file mode 100644
index 8129de4..0000000
--- a/base/const_debug.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_BASE_CONST_DEBUG_H_
-#define OMAHA_BASE_CONST_DEBUG_H_
-
-#include <tchar.h>
-#include "omaha/base/constants.h"
-
-namespace omaha {
-
-// kCiDebugDirectory is relative to the system drive if available or the
-// current directory otherwise. The expectation is that %SystemDrive% is
-// always avaialable, including for the code running as system.
-#define kCiDebugDirectory     APP_NAME_IDENTIFIER _T("-debug")
-
-// TODO(omaha): unify the debugging and logging support so that these files
-// are created under the same directory as the log file.
-#define kCiDebugLogFile                   _T("debug.log")
-#define kCiAssertOccurredFile             _T("assert.log")
-#define kCiAbortOccurredFile              _T("abort.log")
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_CONST_DEBUG_H_
diff --git a/base/const_object_names.h b/base/const_object_names.h
deleted file mode 100644
index c133528..0000000
--- a/base/const_object_names.h
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Kernel object names.
-
-#ifndef OMAHA_BASE_CONST_OBJECT_NAMES_H_
-#define OMAHA_BASE_CONST_OBJECT_NAMES_H_
-
-#include <tchar.h>
-#include "omaha/base/constants.h"
-
-namespace omaha {
-
-// The prefix to use for global names in the win32 API's.
-const TCHAR* const kGlobalPrefix = _T("Global\\Omaha");
-
-const TCHAR kCrashPipeNamePrefix[] =
-    _T("\\\\.\\pipe\\") SHORT_COMPANY_NAME _T("CrashServices");
-
-// Ensures that only one instance of machine or user Omaha is trying to setup at
-// a time.
-const TCHAR* const kSetupMutex = _T("{A9A86B93-B54E-4570-BE89-42418507707B}");
-
-// TODO(omaha3): Update this comment.
-// Signals the process to exit. Currently the core and the worker listen to
-// this event.
-// TODO(omaha): Consider making all our processes listen to it. Maybe not the
-// service, since the SCM controls the life time of the service.
-const TCHAR* const kShutdownEvent =
-    _T("{A0C1F415-D2CE-4ddc-9B48-14E56FD55162}");
-
-// This is for Omaha2 backwards compatibility.
-// The installed Omaha3 handoff process sets an event to tell an Omaha2 setup
-// worker running from the temp directory that a UI has been displayed so that
-// the Omaha2 worker will not display a second UI on error. The event's name is
-// passed in this environment variable name by the Omaha2 worker.
-const TCHAR* const kLegacyUiDisplayedEventEnvironmentVariableName =
-    _T("GOOGLE_UPDATE_UI_DISPLAYED_EVENT_NAME");
-
-// Ensures the Core only runs one instance per machine and one instance per
-// each user session.
-const TCHAR* const kCoreSingleInstance =
-    _T("{B5665124-2B19-40e2-A7BC-B44321E72C4B}");
-
-// Ensures the Crash Handler only runs one instance per machine and one
-// instance per each user session.
-const TCHAR* const kCrashHandlerSingleInstance =
-    _T("{C4F406E5-F024-4e3f-89A7-D5AB7663C3CD}");
-
-// Ensures the /ua process only runs one instance per machine and one
-// instance per each user session.
-const TCHAR* const kUpdateAppsSingleInstance =
-    _T("{D0BB2EF1-C183-4cdb-B218-040922092869}");
-
-// Ensures only one installer for an app is running in a session.
-// The %s is replaced with the application ID.
-const TCHAR* const kInstallAppSingleInstance =
-    _T("%s-{F707E94F-D66B-4525-AD84-B1DA87D6A971}");
-
-// Ensures the GoogleUpdate3 server only runs one instance per machine and one
-// instance per each user session.
-const TCHAR* const kGoogleUpdate3SingleInstance =
-    _T("{6885AE8E-C070-458d-9711-37B9BEAB65F6}");
-
-// TODO(omaha): Delete Job Object code.
-
-// Base name of job object for Setup phase 1 processes except self updates.
-// These may not be running as Local System for machine installs like
-// self-updates do.
-const TCHAR* const kSetupPhase1NonSelfUpdateJobObject =
-    _T("{5A913EF1-4160-48bc-B688-4D67EAEB698A}");
-
-// Base name of job object for interactive install processes except /install.
-const TCHAR* const kAppInstallJobObject =
-    _T("{8AD051DB-4FE6-458b-B103-7DCC78D56013}");
-
-// Base name of job object for silent processes that are okay to kill.
-const TCHAR* const kSilentJobObject =
-    _T("{A2300FD6-CBED-48a6-A3CB-B35C38A42F8E}");
-
-// Base name of job object for silent processes that should not be killed.
-const TCHAR* const kSilentDoNotKillJobObject =
-    _T("{D33A8A53-F57D-4fd9-A32D-238FD69B4BC4}");
-
-// The global lock to ensure that a single app is being installed for this
-// user/machine at a given time.
-const TCHAR* const kInstallManagerSerializer =
-    _T("{0A175FBE-AEEC-4fea-855A-2AA549A88846}");
-
-// Serializes access to metrics stores, machine and user, respectively.
-const TCHAR* const kMetricsSerializer =
-    _T("{C68009EA-1163-4498-8E93-D5C4E317D8CE}");
-
-// Serializes access to the global network configuration, such as the CUP keys.
-const TCHAR* const kNetworkConfigLock =
-    _T("{0E900C7B-04B0-47f9-81B0-F8D94F2DF01B}");
-
-// Serializes access to the registry for application state.
-const TCHAR* const kRegistryAccessMutex =
-    _T("{66CC0160-ABB3-4066-AE47-1CA6AD5065C8}");
-
-// Serializes opt user id generation.
-const TCHAR* const kOptUserIdLock =
-    _T("{D19BAF17-7C87-467E-8D63-6C4B1C836373}");
-
-// The name of the shared memory objects containing the serialized COM
-// interface pointers exposed by the machine core.
-// TODO(omaha): Rename these constants to remove "GoogleUpdate".
-// TODO(omaha): Consider following the kGlobalPrefix convention with the 'G'
-// for the new shared Omaha 3 name  and building this from the same #define as
-// kGlobalPrefix.
-const TCHAR* const kGoogleUpdate3SharedMemoryName =
-    _T("Global\\") APP_NAME_IDENTIFIER _T("3");
-const TCHAR* const kGoogleUpdateCoreSharedMemoryName =
-    _T("Global\\") APP_NAME_IDENTIFIER _T("Core");
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_CONST_OBJECT_NAMES_H_
diff --git a/base/const_timeouts.h b/base/const_timeouts.h
deleted file mode 100644
index 08bd319..0000000
--- a/base/const_timeouts.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Constants used for different timeouts in Common Installer
-
-#ifndef OMAHA_COMMON_CONST_TIMEOUTS_H__
-#define OMAHA_COMMON_CONST_TIMEOUTS_H__
-
-namespace omaha {
-
-// Timeout for tearing down thread
-const int kMaxThreadDestructionTimeMs = 2000;
-
-const int kRegisterExeTimeoutMs =                  120000;      // 2 minutes.
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_CONST_TIMEOUTS_H__
-
diff --git a/base/const_utils.h b/base/const_utils.h
deleted file mode 100644
index f301a3d..0000000
--- a/base/const_utils.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2004-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Constants used in util functions
-
-#ifndef OMAHA_BASE_CONST_UTILS_H_
-#define OMAHA_BASE_CONST_UTILS_H_
-
-namespace omaha {
-
-// The registry key for the registered application path. Take a look at
-// http://msdn2.microsoft.com/en-us/library/ms997545.aspx for more information.
-#define kRegKeyApplicationPath \
-    _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths")
-#define kRegKeyPathValue _T("Path")
-
-#define USER_REG_VISTA_LOW_INTEGRITY_HKCU \
-    _T("Software\\Microsoft\\Internet Explorer\\") \
-    _T("InternetRegistry\\REGISTRY\\USER")
-
-// Including this property specification in the msiexec command line will
-// prevent MSI from rebooting in all cases.
-const TCHAR* const kMsiSuppressAllRebootsCmdLine = _T("REBOOT=ReallySuppress");
-
-// TODO(omaha): We could probably move most of these to browser_utils.
-// TODO(omaha): The rest are Windows constants. Maybe name this file as such.
-
-// The regkey for the default browser the Windows Shell opens.
-#define kRegKeyDefaultBrowser _T("SOFTWARE\\Clients\\StartMenuInternet")
-#define kRegKeyUserDefaultBrowser _T("HKCU\\") kRegKeyDefaultBrowser
-#define kRegKeyMachineDefaultBrowser _T("HKLM\\") kRegKeyDefaultBrowser
-#define kRegKeyShellOpenCommand _T("\\shell\\open\\command")
-#define kRegKeyLegacyDefaultBrowser _T("HKCR\\http")
-#define kRegKeyLegacyDefaultBrowserCommand \
-            kRegKeyLegacyDefaultBrowser kRegKeyShellOpenCommand
-
-#define kIeExeName _T("IEXPLORE.EXE")
-#define kFirefoxExeName _T("FIREFOX.EXE")
-#define kChromeExeName _T("CHROME.EXE")
-#define kChromeBrowserName _T("Google Chrome")
-
-// The regkey for proxy settings for IE.
-const TCHAR* const kRegKeyIESettings =
-    _T("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings");
-const TCHAR* const kRegKeyIESettingsConnections = _T("Connections");
-const TCHAR* const kRegValueIEDefaultConnectionSettings =
-    _T("DefaultConnectionSettings");
-const TCHAR* const kRegValueIEProxyEnable = _T("ProxyEnable");
-const TCHAR* const kRegValueIEProxyServer = _T("ProxyServer");
-const TCHAR* const kRegValueIEAutoConfigURL = _T("AutoConfigURL");
-
-// Internet Explorer.
-#define kRegKeyIeClass \
-    _T("HKCR\\CLSID\\{0002DF01-0000-0000-C000-000000000046}\\LocalServer32")
-#define kRegValueIeClass _T("")
-
-// Firefox.
-#define kRegKeyFirefox \
-    _T("HKCR\\Applications\\FIREFOX.EXE\\shell\\open\\command")
-#define kRegValueFirefox        _T("")
-#define kFullRegKeyFirefox      _T("HKLM\\SOFTWARE\\Mozilla\\Mozilla Firefox")
-#define kRegKeyFirefoxPlugins   _T("plugins")
-#define kFirefoxCurrentVersion  _T("CurrentVersion")
-#define kFirefoxInstallDir      _T("Install Directory")
-
-// Chrome.
-#define kRegKeyChrome _T("HKCR\\Applications\\chrome.exe\\shell\\open\\command")
-#define kRegValueChrome _T("")
-
-// SEHOP setting under IFEO.
-#define kRegKeyWindowsNTCurrentVersion \
-    _T("HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion")
-#define kRegKeyImageFileExecutionOptions \
-      kRegKeyWindowsNTCurrentVersion _T("\\") _T("Image File Execution Options")
-#define kRegKeyDisableSEHOPValue _T("DisableExceptionChainValidation")
-
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_CONST_UTILS_H_
diff --git a/base/constants.h b/base/constants.h
deleted file mode 100644
index 7d660f1..0000000
--- a/base/constants.h
+++ /dev/null
@@ -1,477 +0,0 @@
-// Copyright 2003-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-//
-// Constants used by Omaha project
-
-#ifndef OMAHA_BASE_CONSTANTS_H_
-#define OMAHA_BASE_CONSTANTS_H_
-
-#include <windows.h>
-#include <tchar.h>
-
-namespace omaha {
-
-//
-// Begin vendor-specific constants.
-//
-// When adding values here or using these values for a constant, add a test for
-// the value to common\omaha_customization_unittest.cc.
-// NOTE: The following are defined in main.scons:
-//  + FULL_COMPANY_NAME_ANSI
-//  + SHORT_COMPANY_NAME_ANSI
-//  + PRODUCT_NAME_ANSI
-//  + COMPANY_DOMAIN_ANSI
-//  + MAIN_DLL_BASE_NAME_ANSI
-//
-// *_IDENTIFIER assume that SHORT_COMPANY_NAME_ANSI and PRODUCT_NAME_ANSI are
-// legal identifiers (i.e. one word).
-
-// TODO(omaha3): Move vendor-specific constants to a single file to make use
-// of open source code by other vendors simpler.
-// TODO(omaha3): Only use very specific const variables outside that file. Do
-// not build values in other source files by concatenating preprocessor defines.
-
-// Full company name.
-// FULL_COMPANY_NAME == "Google Inc."
-const TCHAR* const kFullCompanyName = _T(FULL_COMPANY_NAME_ANSI);
-
-// Short company name (for use in paths and messages and to combine with product
-// name). Does not include "Inc." and similar formal parts of the company name.
-// SHORT_COMPANY_NAME == "Google"
-#define SHORT_COMPANY_NAME _T(SHORT_COMPANY_NAME_ANSI)
-const TCHAR* const kShortCompanyName = SHORT_COMPANY_NAME;
-
-// Product name.
-// PRODUCT_NAME == "Update"
-#define PRODUCT_NAME _T(PRODUCT_NAME_ANSI)
-
-// Company domain name base. Used for MIME type names.
-// COMPANY_DOMAIN_BASE_ANSI = "google"
-#define COMPANY_DOMAIN_BASE _T(COMPANY_DOMAIN_BASE_ANSI)
-
-// Company domain name base. Used for addresses.
-// COMPANY_DOMAIN_ANSI = "google.com"
-#define COMPANY_DOMAIN _T(COMPANY_DOMAIN_ANSI)
-
-// Company's internal network DNS domain. Used for detecting internal users.
-// If the internal network uses a different domain than the public-facing
-// COMPANY_DOMAIN, this will need to be changed.
-// kCompanyInternalDnsName = ".google.com"
-const TCHAR* const kCompanyInternalDnsName = _T(".") COMPANY_DOMAIN;
-
-// Company's internal network NetBIOS name. Used for detecting internal users.
-// If the internal network uses a different domain than the public-facing
-// COMPANY_DOMAIN_BASE, this will need to be changed.
-// kCompanyInternalLanGroupName = "google"
-const TCHAR* const kCompanyInternalLanGroupName = COMPANY_DOMAIN_BASE;
-
-// The base name of the main executable. Everything except the ".exe".
-// Most files start with the main .exe's base name.
-// MAIN_EXE_BASE_NAME = "GoogleUpdate"
-#define MAIN_EXE_BASE_NAME  _T(MAIN_EXE_BASE_NAME_ANSI)
-
-// Base name of the main DLL.
-// MAIN_DLL_BASE_NAME = "goopdate"
-#define MAIN_DLL_BASE_NAME _T(MAIN_DLL_BASE_NAME_ANSI)
-
-// Application name.
-// Use the localized IDS_PRODUCT_DISPLAY_NAME or the formatted
-// IDS_INSTALLER_DISPLAY_NAME instead when string is displayed to user.
-// kAppName == "Google Update"
-// TODO(omaha): Maybe rename all of these kOmahaAppName.
-const TCHAR* const kAppName = _T(OMAHA_APP_NAME_ANSI);
-
-#define COMPANY_NAME_IDENTIFIER SHORT_COMPANY_NAME
-#define PRODUCT_NAME_IDENTIFIER PRODUCT_NAME
-#define APP_NAME_IDENTIFIER SHORT_COMPANY_NAME PRODUCT_NAME
-
-// Prefix for any Win32 objects (mutexes, events, etc.).
-// TODO(omaha): This is used by several files in base/. Maybe we can use a
-// similar prefix to avoid conflicts with some values in const_object_names.h.
-// Consider moving this constant to const_object_names.h.
-#define kLockPrefix \
-    _T("_") COMPANY_NAME_IDENTIFIER _T("_") PRODUCT_NAME_IDENTIFIER _T("_")
-
-const TCHAR* const kOmahaShellFileName         = MAIN_EXE_BASE_NAME _T(".exe");
-const TCHAR* const kCrashHandlerFileName       = CRASH_HANDLER_NAME _T(".exe");
-const TCHAR* const kOmahaDllName               = MAIN_DLL_BASE_NAME _T(".dll");
-const TCHAR* const kOmahaResourceDllNameFormat =
-    MAIN_DLL_BASE_NAME _T("res_%s.dll");
-const TCHAR* const kOmahaBrokerFileName        =
-    MAIN_EXE_BASE_NAME _T("Broker.exe");
-const TCHAR* const kOmahaOnDemandFileName      =
-    MAIN_EXE_BASE_NAME _T("OnDemand.exe");
-const TCHAR* const kPSFileNameMachine  = _T("psmachine.dll");
-const TCHAR* const kPSFileNameUser     = _T("psuser.dll");
-
-// TODO(omaha): Replace the following literal in clickonce\build.scons.
-// '%s/GoogleUpdateSetup.exe'
-
-// These must be in sync with the WiX files.
-// TODO(omaha): Make these constants in main.scons and use them in the .wxs
-// files, kMsiUninstallKey, and elsewhere this GUID appears.
-const TCHAR* const kHelperInstallerName = MAIN_EXE_BASE_NAME _T("Helper.msi");
-const TCHAR* const kHelperInstallerProductGuid =
-    _T("{A92DAB39-4E2C-4304-9AB6-BC44E68B55E2}");
-const TCHAR* const kHelperPatchName = MAIN_EXE_BASE_NAME _T("HelperPatch.msp");
-const TCHAR* const kHelperPatchGuid =
-    _T("{E0D0D2C9-5836-4023-AB1D-54EC3B90AD03}");
-
-// The value that is used in the run key.
-const TCHAR* const kRunValueName = kAppName;
-
-// The company and organization names as expected in Authenticode certificates.
-const TCHAR* const kCertificateSubjectName = _T("Google Inc");
-
-// TODO(omaha): Try to use the above constants in the IDL file help strings.
-// TODO(omaha): Consider moving uuid's from the IDL files to here too.
-// TODO(omaha): Use these values for the registry maps definitions, and progid
-// uses, such as ondemand.h.
-
-//
-// Omaha's app ID
-//
-// TODO(omaha): Rename all of these "Omaha".
-#define GOOPDATE_APP_ID _T("{430FD4D0-B729-4F61-AA34-91526481799D}")
-const TCHAR* const kGoogleUpdateAppId = GOOPDATE_APP_ID;
-const GUID kGoopdateGuid = {0x430FD4D0, 0xB729, 0x4F61,
-                            {0xAA, 0x34, 0x91, 0x52, 0x64, 0x81, 0x79, 0x9D}};
-
-//
-// Directory names
-//
-#define OFFLINE_DIR_NAME _T("Offline")
-
-#define OMAHA_REL_COMPANY_DIR SHORT_COMPANY_NAME
-#define OMAHA_REL_CRASH_DIR OMAHA_REL_COMPANY_DIR _T("\\CrashReports")
-#define OMAHA_REL_GOOPDATE_INSTALL_DIR \
-    OMAHA_REL_COMPANY_DIR _T("\\") PRODUCT_NAME
-#define OMAHA_REL_LOG_DIR OMAHA_REL_GOOPDATE_INSTALL_DIR _T("\\Log")
-#define OMAHA_REL_OFFLINE_STORAGE_DIR \
-    OMAHA_REL_GOOPDATE_INSTALL_DIR _T("\\") OFFLINE_DIR_NAME
-#define OMAHA_REL_DOWNLOAD_STORAGE_DIR \
-    OMAHA_REL_GOOPDATE_INSTALL_DIR _T("\\Download")
-#define OMAHA_REL_INSTALL_WORKING_DIR \
-      OMAHA_REL_GOOPDATE_INSTALL_DIR _T("\\Install")
-
-// This directory is relative to the user profile app data local.
-#define LOCAL_APPDATA_REL_TEMP_DIR _T("\\Temp")
-
-//
-// Registry keys and values
-//
-#define MACHINE_KEY_NAME _T("HKLM")
-#define MACHINE_KEY MACHINE_KEY_NAME _T("\\")
-#define USER_KEY_NAME _T("HKCU")
-#define USER_KEY USER_KEY_NAME _T("\\")
-#define USERS_KEY _T("HKU\\")
-#define COMPANY_MAIN_KEY _T("Software\\") SHORT_COMPANY_NAME _T("\\")
-#define GOOPDATE_MAIN_KEY COMPANY_MAIN_KEY PRODUCT_NAME _T("\\")
-#define GOOPDATE_REG_RELATIVE_CLIENTS GOOPDATE_MAIN_KEY _T("Clients\\")
-#define GOOPDATE_REG_RELATIVE_CLIENT_STATE GOOPDATE_MAIN_KEY _T("ClientState\\")
-#define GOOPDATE_REG_RELATIVE_CLIENT_STATE_MEDIUM \
-    GOOPDATE_MAIN_KEY _T("ClientStateMedium\\")
-#define COMPANY_POLICIES_MAIN_KEY \
-    _T("Software\\Policies\\") SHORT_COMPANY_NAME _T("\\")
-#define GOOPDATE_POLICIES_RELATIVE COMPANY_POLICIES_MAIN_KEY \
-    PRODUCT_NAME _T("\\")
-
-#define USER_REG_GOOGLE USER_KEY COMPANY_MAIN_KEY
-#define USER_REG_UPDATE USER_KEY GOOPDATE_MAIN_KEY
-#define USER_REG_CLIENTS USER_KEY GOOPDATE_REG_RELATIVE_CLIENTS
-#define USER_REG_CLIENTS_GOOPDATE  USER_REG_CLIENTS GOOPDATE_APP_ID
-#define USER_REG_CLIENT_STATE USER_KEY GOOPDATE_REG_RELATIVE_CLIENT_STATE
-#define USER_REG_CLIENT_STATE_GOOPDATE USER_REG_CLIENT_STATE GOOPDATE_APP_ID
-
-#define MACHINE_REG_GOOGLE MACHINE_KEY COMPANY_MAIN_KEY
-#define MACHINE_REG_UPDATE MACHINE_KEY GOOPDATE_MAIN_KEY
-#define MACHINE_REG_CLIENTS MACHINE_KEY GOOPDATE_REG_RELATIVE_CLIENTS
-#define MACHINE_REG_CLIENTS_GOOPDATE  MACHINE_REG_CLIENTS GOOPDATE_APP_ID
-#define MACHINE_REG_CLIENT_STATE MACHINE_KEY GOOPDATE_REG_RELATIVE_CLIENT_STATE
-#define MACHINE_REG_CLIENT_STATE_GOOPDATE \
-    MACHINE_REG_CLIENT_STATE GOOPDATE_APP_ID
-#define MACHINE_REG_CLIENT_STATE_MEDIUM \
-    MACHINE_KEY GOOPDATE_REG_RELATIVE_CLIENT_STATE_MEDIUM
-
-// Expands to HKEY_LOCAL_MACHINE\SOFTWARE\Google\UpdateDev
-#define MACHINE_REG_UPDATE_DEV \
-    MACHINE_KEY COMPANY_MAIN_KEY PRODUCT_NAME _T("Dev\\")
-
-// Regular expressions for the servers allowed to use the Omaha plugins.
-const TCHAR* const kSiteLockPatternStrings[] = {
-  _T("^(gears)|(mail)|(tools)|(www)|(desktop)|(pack)\\.google\\.com$"),
-  _T("^www\\.google\\.(ad)|(bg)|(ca)|(cn)|(cz)|(de)|(es)|(fi)|(fr)|(gr)|(hr)|(hu)|(it)|(ki)|(kr)|(lt)|(lv)|(nl)|(no)|(pl)|(pt)|(ro)|(ru)|(sk)|(sg)|(sl)|(sr)|(vn)$"),  // NOLINT
-  _T("^www\\.google\\.co\\.(hu)|(id)|(il)|(it)|(jp)|(kr)|(th)|(uk)$"),
-  _T("^www\\.google\\.com\\.(ar)|(au)|(br)|(cn)|(et)|(gr)|(hr)|(ki)|(lv)|(om)|(pl)|(pt)|(ru)|(sg)|(sv)|(tr)|(vn)$"),  // NOLINT
-};
-
-//
-// Compatible shell versions
-// The following shell versions are compatible with the current version of
-// goopdate.dll and do not need be replaced: 1.2.131.7 and 1.2.183.9.
-//
-const ULONGLONG kCompatibleOlderShellVersions[] = { 0x0001000200830007,
-                                                    0x0001000200B70009,
-                                                  };
-
-//
-// End vendor-specific constants.
-//
-
-//
-// Registry values under MACHINE_REG_UPDATE_DEV allow customization of the
-// default behavior. The overrides apply for both user and machine
-// instances of omaha.
-//
-// The values below can only be overriden in debug builds.
-const TCHAR* const kRegValueNameOverInstall    = _T("OverInstall");
-const TCHAR* const kRegValueNameCrashIfSpecificError
-    = _T("CrashIfSpecificError");
-
-// The values below can be overriden in both debug and opt builds. Code Red url
-// can be overriden but its value is defined in the Code Red module. The value
-// name is "CodeRedUrl".
-const TCHAR* const kRegValueNameUrl                 = _T("url");
-const TCHAR* const kRegValueNamePingUrl             = _T("PingUrl");
-const TCHAR* const kRegValueNameCrashReportUrl      = _T("CrashReportUrl");
-const TCHAR* const kRegValueNameGetMoreInfoUrl      = _T("MoreInfoUrl");
-const TCHAR* const kRegValueNameUsageStatsReportUrl = _T("UsageStatsReportUrl");
-const TCHAR* const kRegValueTestSource              = _T("TestSource");
-const TCHAR* const kRegValueAuCheckPeriodMs         = _T("AuCheckPeriodMs");
-const TCHAR* const kRegValueCrCheckPeriodMs         = _T("CrCheckPeriodMs");
-const TCHAR* const kRegValueProxyHost               = _T("ProxyHost");
-const TCHAR* const kRegValueProxyPort               = _T("ProxyPort");
-const TCHAR* const kRegValueMID                     = _T("mid");
-
-// The values below can be overriden in unofficial builds.
-const TCHAR* const kRegValueNameWindowsInstalling = _T("WindowsInstalling");
-
-// Allows Omaha to log events in the Windows Event Log. This is
-// a DWORD value 0: Log nothing, 1: Log warnings and errors, 2: Log everything.
-const TCHAR* const kRegValueEventLogLevel      = _T("LogEventLevel");
-
-enum LogEventLevel {
-  LOG_EVENT_LEVEL_NONE           = 0,
-  LOG_EVENT_LEVEL_WARN_AND_ERROR = 1,
-  LOG_EVENT_LEVEL_ALL            = 2
-};
-
-// How often Omaha checks the server for updates.
-const TCHAR* const kRegValueLastCheckPeriodSec = _T("LastCheckPeriodSec");
-
-// Uses the production or the test cup keys. Once the client has negotiated
-// CUP credentials {sk, c} and it has saved them under the corresponding
-// Google\Update\network key then the client does not need any of the CUP keys.
-// To force the client to use test or production keys, {sk, c} credentials must
-// be cleared too.
-const TCHAR* const kRegValueCupKeys            = _T("TestKeys");
-
-// Allow a custom host pattern to be specified. For example,
-// "^https?://some_test_server\.google\.com/". For other examples, see
-// kSiteLockPatternStrings. The detailed regular expression syntax is documented
-// in the MSDN documentation for the CAtlRegExp class:
-// http://msdn.microsoft.com/en-us/library/k3zs4axe.aspx.
-const TCHAR* const kRegValueOneClickHostPattern = _T("OneClickHostPattern");
-
-// Disables the Code Red check.
-const TCHAR* const kRegValueNoCodeRedCheck     = _T("NoCrCheck");
-
-// Enables sending usage stats always if the value is present.
-const TCHAR* const kRegValueForceUsageStats    = _T("UsageStats");
-
-// Enables crash uploads if the value is 1. Crashes can be uploaded only if
-// certain conditions are met. This value allows overriding of the default
-// crash uploading behavior.
-const TCHAR* const kRegValueAlwaysAllowCrashUploads =
-    _T("AlwaysAllowCrashUploads");
-
-// Enables monitoring the 'LastChecked' value for testing purposes. When
-// the 'LastChecked' is deleted, the core starts a worker process to do an
-// update check. This value must be set before the core process starts.
-const TCHAR* const kRegValueMonitorLastChecked = _T("MonitorLastChecked");
-
-// The test_source value to use for Omaha instances that have
-// customizations, and hence should be discarded from metrics.
-const TCHAR* const kRegValueTestSourceAuto     = _T("auto");
-
-// The network configuration to override the network detection.
-// The corresponding value must have the following format:
-// wpad=[false|true];script=script_url;proxy=host:port
-const TCHAR* const kRegValueNetConfig          = _T("NetConfig");
-
-// The maximum length of application and bundle names.
-const int kMaxNameLength = 512;
-
-// Specifies whether a tristate item has a value and if so what the value is.
-enum Tristate {
-  TRISTATE_FALSE,
-  TRISTATE_TRUE,
-  TRISTATE_NONE
-};
-
-// Number of periods to use when abbreviating URLs
-#define kAbbreviationPeriodLength 3
-
-// The Unicode "Byte Order Marker" character.  This is the native
-// encoding, i.e. after conversion from UTF-8 or whatever.
-const wchar_t kUnicodeBom = 0xFEFF;
-
-// Using these constants will make ATL load the
-// typelib directly from a DLL instead of looking up typelib
-// registration in registry.
-const DWORD kMajorTypeLibVersion = 0xFFFF;
-const DWORD kMinorTypeLibVersion = 0xFFFF;
-
-// Brand id length
-const int kBrandIdLength = 4;
-
-// Country code length according to ISO 3166-3.
-const int kCountryCodeMaxLength = 5;
-
-// Language code length.
-const int kLangMaxLength = 10;
-
-// When not specified, the country code defaults to USA
-const TCHAR* const kDefaultCountryCode = _T("us");
-
-// the max length of the extra info we can store inside the install stubs.
-const int kExtraMaxLength = 64 * 1024;  // 64 KB
-
-// Default brand code value when one is not specified.
-// This has been specifically assigned to Omaha.
-const TCHAR* const kDefaultGoogleUpdateBrandCode = _T("GGLS");
-
-// The platform named used for Windows.
-const TCHAR* const kPlatformWin = _T("win");
-
-// TODO(omaha3): Move goopdate-specific values in this file to const_goopdate.h.
-// Maybe there should be a const_server_api.h file so the server API is
-// documented in one location.
-
-// The following are response strings returned by the server.
-// They must exactly match the strings returned by the server.
-const TCHAR* const kResponseStatusOkValue = _T("ok");
-const TCHAR* const kResponseStatusNoUpdate = _T("noupdate");
-const TCHAR* const kResponseStatusRestrictedExportCountry = _T("restricted");
-const TCHAR* const kResponseStatusOsNotSupported = _T("error-osnotsupported");
-const TCHAR* const kResponseStatusUnKnownApplication =
-    _T("error-UnKnownApplication");
-const TCHAR* const kResponseStatusInternalError = _T("error-internal");
-const TCHAR* const kResponseStatusHashError = _T("error-hash");
-const TCHAR* const kResponseStatusUnsupportedProtocol =
-    _T("error-unsupportedprotocol");
-const TCHAR* const kResponseDataStatusNoData = _T("error-nodata");
-
-const TCHAR* const kLocalSystemSid = _T("S-1-5-18");
-
-// Time-related constants for defining durations.
-const int kMsPerSec           = 1000;
-const int kSecPerMin          = 60;
-const int kMinPerHour         = 60;
-const int kSecondsPerHour     = 60 * 60;
-const int kSecondsPerDay      = 24 * kSecondsPerHour;
-
-// Defines LastCheckPeriodSec: the time interval between actual server
-// update checks. Opt builds have an aggressive check for updates every 5 hours.
-// This introduces some time shift for computers connected all the time, for
-// example, the update checks occur at: 12, 17, 22, 3, 8, 13, 18, etc...
-//
-// Since time computation for LastChecked is done in seconds, sometimes it
-// can miss an update check, depending on arithmetic truncations.
-// Adjust down the LastCheckPeriod so that the update worker does not miss it.
-//
-// Almost 5 hours for production users and almost hourly for internal users.
-const int kLastCheckPeriodSec              = 5 * 59 * kMinPerHour;
-const int kLastCheckPeriodInternalUserSec  = 1 * 59 * kMinPerHour;
-
-
-const int kMinLastCheckPeriodSec = 60;  // 60 seconds minimum.
-
-// Defines the time interval when the core is kicking off silent workers. When
-// there is nothing to do, a worker does not take more than 200 ms to run.
-// Internal users are supposed to update at least once every hour. Therefore,
-// start workers every 30 minutes.
-const int kAUCheckPeriodMs             = 60 * 60 * 1000;  // Hourly.
-const int kAUCheckPeriodInternalUserMs = 30 * 60 * 1000;  // 30 minutes.
-
-// Avoids starting workers too soon. This helps reduce disk thrashing at
-// boot or logon, as well as needlessly starting a worker after setting up.
-const int kUpdateTimerStartupDelayMinMs = 5 * 60 * 1000;   // 5 minutes.
-
-// Maximum amount of time to wait before starting an update worker.
-const int kUpdateTimerStartupDelayMaxMs = 15 * 60 * 1000;   // 15 minutes.
-
-// Minimum AU check interval is lowered to 3 seconds to speed up test
-// automation.
-const int kMinAUCheckPeriodMs = 1000 * 3;   // 3 seconds.
-
-// The Code Red check frequency.
-const int kCodeRedCheckPeriodMs     = 24 * 60 * 60 * 1000;    // 24 hours.
-const int kMinCodeRedCheckPeriodMs  = 60 * 1000;              // 1 minute.
-
-// The minimum amount of time after a /oem install that Omaha is considered to
-// be in OEM mode regardless of audit mode.
-const int kMinOemModeSec = 72 * 60 * 60;  // 72 hours.
-
-// The amount of time to wait for the setup lock before giving up.
-const int kSetupLockWaitMs = 1000;  // 1 second.
-
-// The amount of time to wait for other instances to shutdown before giving up.
-const int kSetupInstallShutdownWaitMs = 45 * 1000;      // 45 seconds.
-const int kSetupUpdateShutdownWaitMs  = 3 * 60 * 1000;  // 3 minutes.
-
-// Time to wait for the busy MSI when uninstalling. If MSI is found busy,
-// Omaha won't uninstall. The timeout should be high enough so that it allows
-// a normal application uninstall to finish and trigger an Omaha uninstall
-// when needed.
-const int kWaitForMSIExecuteMs                = 5 * 60000;  // 5 minutes.
-
-// Name of the language key-value pair inside the version resource.
-const TCHAR* const kLanguageVersionName = _T("LanguageId");
-
-// Group name to use to read/write INI files for custom crash client info.
-const TCHAR* const kCustomClientInfoGroup = _T("ClientCustomData");
-
-// ***                                            ***
-// *** Custom HTTP request headers sent by Omaha. ***
-// ***                                            ***
-const TCHAR* const kHeaderUserAgent           = _T("User-Agent");
-
-// The HRESULT and HTTP status code updated by the prior
-// NetworkRequestImpl::DoSendHttpRequest() call.
-const TCHAR* const kHeaderXLastHR             = _T("X-Last-HR");
-const TCHAR* const kHeaderXLastHTTPStatusCode = _T("X-Last-HTTP-Status-Code");
-
-// The "mid" value if it exists in HKLM\SOFTWARE\Google\UpdateDev.
-const TCHAR* const kHeaderXMID                = _T("X-MID");
-
-// The 407 retry count in the case of authenticated proxies.
-const TCHAR* const kHeaderXProxyRetryCount    = _T("X-Proxy-Retry-Count");
-
-// Indicates that we had to prompt the user for proxy credentials.
-const TCHAR* const kHeaderXProxyManualAuth    = _T("X-Proxy-Manual-Auth");
-
-// The age in seconds between the current time and when a ping was first
-// persisted.
-const TCHAR* const kHeaderXRequestAge         = _T("X-RequestAge");
-
-// The current retry count defined by the outermost
-// NetworkRequestImpl::DoSendWithRetries() call.
-const TCHAR* const kHeaderXRetryCount         = _T("X-Retry-Count");
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_CONSTANTS_H_
diff --git a/base/crash_if_specific_error.cc b/base/crash_if_specific_error.cc
deleted file mode 100644
index 57bef78..0000000
--- a/base/crash_if_specific_error.cc
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/crash_if_specific_error.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vista_utils.h"
-
-#undef SUCCEEDED
-#undef FAILED
-
-namespace omaha {
-
-HRESULT g_crash_specific_error = 0;
-
-void CrashIfSpecificError(HRESULT hr) {
-  if (g_crash_specific_error && hr == g_crash_specific_error) {
-    ::RaiseException(0, EXCEPTION_NONCONTINUABLE, 0, NULL);
-  }
-}
-
-}  // namespace omaha
-
diff --git a/base/crash_if_specific_error.h b/base/crash_if_specific_error.h
deleted file mode 100644
index 6321a47..0000000
--- a/base/crash_if_specific_error.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_BASE_CRASH_IF_SPECIFIC_ERROR_H_
-#define OMAHA_BASE_CRASH_IF_SPECIFIC_ERROR_H_
-#include <windows.h>
-
-#if defined __cplusplus
-
-namespace omaha {
-
-extern HRESULT g_crash_specific_error;
-extern void CrashIfSpecificError(HRESULT hr);
-
-#define CRASH_IF_SPECIFIC_ERROR(hr) CrashIfSpecificError(hr)
-
-inline bool CheckSuccessWithSpecificError(HRESULT hr) {
-  CRASH_IF_SPECIFIC_ERROR(hr);
-  return hr >= 0;
-}
-
-inline bool CheckFailureWithSpecificError(HRESULT hr) {
-  CRASH_IF_SPECIFIC_ERROR(hr);
-  return hr < 0;
-}
-
-}  // namespace omaha
-
-#ifdef SUCCEEDED
-#undef SUCCEEDED
-#endif
-#define SUCCEEDED(hr) omaha::CheckSuccessWithSpecificError(hr)
-
-#ifdef FAILED
-#undef FAILED
-#endif
-#define FAILED(hr) omaha::CheckFailureWithSpecificError(hr)
-
-#else   // defined __cplusplus
-
-#define CRASH_IF_SPECIFIC_ERROR(hr)
-
-#endif  // defined __cplusplus
-
-#endif  // OMAHA_BASE_CRASH_IF_SPECIFIC_ERROR_H_
-
diff --git a/base/crc.cc b/base/crc.cc
deleted file mode 100644
index fe3cb25..0000000
--- a/base/crc.cc
+++ /dev/null
@@ -1,899 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Implemetation of CRCs (aka Rabin Fingerprints).
-// Treats the input as a polynomial with coefficients in Z(2),
-// and finds the remainder when divided by an irreducible polynomial
-// of the appropriate length.
-// It handles all CRC sizes from 8 to 128 bits.
-// It's somewhat complicated by having separate implementations optimized for
-// CRC's <=32 bits, <= 64 bits, and <= 128 bits.
-// The input string is prefixed with a "1" bit, and has "degree" "0" bits
-// appended to it before the remainder is found.   This ensures that
-// short strings are scrambled somewhat and that strings consisting
-// of all nulls have a non-zero CRC.
-
-#include <stddef.h>
-#include "omaha/base/crc.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/commontypes.h"
-
-namespace omaha {
-
-static const int SMALL_BITS = 8;
-                   // When extending an input with a string of zeroes,
-                   // if the number of zeroes is less than 2**SMALL_BITS,
-                   // a normal Extend is done, rather than a polynomial
-                   // multiplication.
-static const char zeroes[1 << SMALL_BITS] = { 0 };  // an array of zeroes
-
-static const uint8 *zero_ptr = 0;   // The 0 pointer---used for alignment
-
-// These are used to index a 2-entry array of words that together
-// for a longer integer.  LO indexes the low-order half.
-#define LO 0
-#define HI (1-LO)
-
-// Constructor and destructor for baseclase CRC.
-CRC::~CRC() {}
-CRC::CRC() {}
-
-struct CRC_pair {             // Used to represent a 128-bit value
-  uint64 lo;
-  uint64 hi;
-};
-
-class CRCImpl : public CRC {    // Implemention of the abstract class CRC
- public:
-  CRCImpl() {}
-  virtual ~CRCImpl() {}
-
-  // The internal version of CRC::New().
-  static CRCImpl *NewInternal(uint64 lo, uint64 hi,
-                              int degree, size_t roll_length);
-
-  virtual void Empty(uint64 *lo, uint64 *hi) const;
-
-  size_t roll_length_;    // length of window in rolling CRC
-  int degree_;            // bits in the CRC
-  uint64 poly_lo_;        // The CRC of the empty string, low part
-  uint64 poly_hi_;        // The CRC of the empty string, high part
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(CRCImpl);
-};
-
-// This is the 32-bit implementation.  It handles all sizes from 8 to 32.
-class CRC32 : public CRCImpl {
- public:
-  CRC32() {}
-  virtual ~CRC32() {}
-
-  virtual void Extend(uint64 *lo, uint64 *hi,
-                      const void *bytes, size_t length) const;
-  virtual void ExtendByZeroes(uint64 *lo, uint64 *hi, size_t length) const;
-  virtual void Roll(uint64 *lo, uint64 *hi, uint8 o_byte, uint8 i_byte) const;
-
-  uint32 table0_[256];  // table of byte extensions
-  uint32 table1_[256];  // table of byte extensions, shifted by 1 byte
-  uint32 table2_[256];  // table of byte extensions, shifted by 2 bytes
-  uint32 table3_[256];  // table of byte extensions, shifted by 3 bytes
-  uint32 roll_[256];    // table of byte roll values
-  uint32 zeroes_[256];  // table of zero extensions
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(CRC32);
-};
-
-static const uint64 UINT64_ZERO = 0;    // a 64-bit zero
-static const uint64 UINT64_ONE = 1;     // a 64-bit 1
-
-// The B() macro sets the bit corresponding to X**(_x) in the polynomial
-#define B(_x) (UINT64_ONE << ((_x) < 64?(63-(_x)):(127-(_x))))
-
-// Used to initialize polynomials.
-// The redundant tests on _len are to avoid warnings from the
-// compiler about inappropriate shift lengths.   These shifts
-// occur on not-taken branch of the ?: in some cases.
-#define kDefPoly(_h,_l,_len) \
- { ((_len) <= 64  ? (_l) >> ((_len) <= 64? 64 - (_len): 0) : \
-    (_len) == 128 ? (_h) : \
-                     ((_h) >> ((_len) > 64? 128 - (_len): 0)) | \
-                     ((_l) << ((_len) > 64 && (_len) < 128? (_len)-64: 0))), \
-   ((_len) <= 64  ? 0 : \
-    (_len) == 128 ? (_l) :  \
-                    (_l) >> ((_len) > 64? 128 - (_len): 0)), \
-   (_len) }
-
-// A table of irreducible polynomials suitable for use with the implementation.
-// Indexes 0...1 have degree 32 polynomials.
-// Indexes 2...3 have degree 64 polynomials.
-// Indexes 4...5 have degree 96 polynomials.
-// Indexes 6...7 have degree 128 polynomials.
-// Index i=8...128 has a degree i polynomial.
-// All polynomials in the table are guaranteed distinct.
-// lint -save -e572 -e648 -e778   Excessive shift value, expression evaluates to 0
-static const struct CRC::Poly poly_list[] = {
- kDefPoly(UINT64_ZERO, B(30)+B(27)+B(26)+B(25)+B(23)+B(20)+B(17)+B(15)+B(14)+
-          B(12)+B(6)+B(5)+B(2)+B(0), 32),
- kDefPoly(UINT64_ZERO, B(31)+B(28)+B(27)+B(26)+B(24)+B(22)+B(19)+B(18)+B(16)+
-          B(13)+B(11)+B(10)+B(9)+B(4)+B(2)+B(0), 32),
- kDefPoly(UINT64_ZERO, B(60)+B(59)+B(58)+B(56)+B(55)+B(54)+B(51)+B(50)+B(49)+
-          B(48)+B(47)+B(45)+B(44)+B(42)+B(40)+B(39)+B(38)+B(36)+B(34)+B(33)+
-          B(32)+B(31)+B(30)+B(27)+B(25)+B(23)+B(22)+B(21)+B(20)+B(19)+
-          B(17)+B(16)+B(15)+B(8)+B(7)+B(6)+B(5)+B(0), 64),
- kDefPoly(UINT64_ZERO, B(63)+B(62)+B(60)+B(58)+B(57)+B(56)+B(54)+B(52)+B(46)+
-          B(45)+B(43)+B(40)+B(37)+B(36)+B(34)+B(33)+B(32)+B(31)+B(30)+B(29)+
-          B(28)+B(27)+B(26)+B(23)+B(19)+B(18)+B(15)+B(14)+B(13)+B(9)+B(8)+
-          B(0), 64),
- kDefPoly(B(95)+B(94)+B(91)+B(90)+B(89)+B(88)+B(87)+B(86)+B(79)+B(78)+
-          B(77)+B(76)+B(75)+B(74)+B(73)+B(69)+B(68)+B(66), B(63)+B(61)+
-          B(59)+B(57)+B(53)+B(51)+B(50)+B(47)+B(40)+B(39)+B(38)+B(36)+
-          B(35)+B(33)+B(29)+B(28)+B(27)+B(25)+B(24)+B(23)+B(21)+B(19)+
-          B(18)+B(17)+B(16)+B(13)+B(12)+B(10)+B(9)+B(7)+B(4)+B(2)+B(1)+
-          B(0), 96),
- kDefPoly(B(95)+B(92)+B(89)+B(88)+B(87)+B(85)+B(84)+B(82)+B(81)+B(80)+
-          B(79)+B(78)+B(76)+B(75)+B(70)+B(69)+B(66)+B(65), B(60)+B(56)+
-          B(55)+B(52)+B(51)+B(49)+B(48)+B(46)+B(44)+B(42)+B(41)+B(39)+
-          B(38)+B(37)+B(35)+B(33)+B(32)+B(30)+B(28)+B(27)+B(25)+B(22)+
-          B(19)+B(17)+B(14)+B(12)+B(10)+B(0), 96),
- kDefPoly(B(122)+B(121)+B(120)+B(119)+B(117)+B(116)+B(114)+B(113)+B(112)+
-          B(111)+B(109)+B(107)+B(104)+B(102)+B(100)+B(98)+B(96)+B(94)+
-          B(93)+B(92)+B(91)+B(90)+B(88)+B(87)+B(86)+B(84)+B(82)+B(80)+
-          B(75)+B(74)+B(73)+B(69), B(62)+B(61)+B(58)+B(52)+B(48)+B(47)+
-          B(46)+B(45)+B(42)+B(41)+B(38)+B(37)+B(35)+B(33)+B(32)+B(31)+
-          B(30)+B(28)+B(26)+B(24)+B(22)+B(21)+B(20)+B(19)+B(18)+B(17)+
-          B(10)+B(9)+B(8)+B(7)+B(5)+B(2)+B(1)+B(0), 128),
- kDefPoly(B(127)+B(126)+B(124)+B(121)+B(117)+B(116)+B(115)+B(113)+B(112)+
-          B(111)+B(108)+B(105)+B(104)+B(103)+B(100)+B(98)+B(96)+B(93)+
-          B(92)+B(90)+B(89)+B(88)+B(86)+B(85)+B(80)+B(77)+B(76)+B(72)+
-          B(70)+B(69)+B(68)+B(65)+B(64), B(62)+B(61)+B(59)+B(58)+B(56)+
-          B(53)+B(52)+B(51)+B(50)+B(48)+B(46)+B(39)+B(35)+B(34)+B(33)+
-          B(32)+B(30)+B(29)+B(28)+B(22)+B(21)+B(19)+B(18)+B(17)+B(14)+
-          B(10)+B(9)+B(7)+B(5)+B(4)+B(3)+B(2)+B(0), 128),
- kDefPoly(UINT64_ZERO, B(7)+B(6)+B(5)+B(4)+B(2)+B(0), 8),
- kDefPoly(UINT64_ZERO, B(8)+B(4)+B(3)+B(2)+B(1)+B(0), 9),
- kDefPoly(UINT64_ZERO, B(8)+B(6)+B(5)+B(3)+B(1)+B(0), 10),
- kDefPoly(UINT64_ZERO, B(10)+B(9)+B(7)+B(5)+B(1)+B(0), 11),
- kDefPoly(UINT64_ZERO, B(11)+B(10)+B(5)+B(2)+B(1)+B(0), 12),
- kDefPoly(UINT64_ZERO, B(12)+B(11)+B(10)+B(8)+B(5)+B(3)+B(2)+B(0), 13),
- kDefPoly(UINT64_ZERO, B(11)+B(10)+B(9)+B(8)+B(7)+B(5)+B(4)+B(2)+B(1)+
-          B(0), 14),
- kDefPoly(UINT64_ZERO, B(14)+B(12)+B(11)+B(10)+B(9)+B(5)+B(3)+B(2)+B(1)+
-          B(0), 15),
- kDefPoly(UINT64_ZERO, B(12)+B(11)+B(7)+B(6)+B(5)+B(4)+B(3)+B(0), 16),
- kDefPoly(UINT64_ZERO, B(16)+B(14)+B(11)+B(10)+B(8)+B(3)+B(1)+B(0), 17),
- kDefPoly(UINT64_ZERO, B(12)+B(11)+B(9)+B(8)+B(7)+B(4)+B(3)+B(0), 18),
- kDefPoly(UINT64_ZERO, B(12)+B(11)+B(8)+B(7)+B(6)+B(5)+B(2)+B(0), 19),
- kDefPoly(UINT64_ZERO, B(18)+B(15)+B(14)+B(12)+B(9)+B(6)+B(3)+B(0), 20),
- kDefPoly(UINT64_ZERO, B(20)+B(19)+B(14)+B(13)+B(12)+B(11)+B(8)+B(7)+B(6)+
-          B(5)+B(2)+B(0), 21),
- kDefPoly(UINT64_ZERO, B(21)+B(20)+B(18)+B(16)+B(15)+B(14)+B(12)+B(9)+B(7)+
-          B(2)+B(1)+B(0), 22),
- kDefPoly(UINT64_ZERO, B(22)+B(21)+B(17)+B(16)+B(15)+B(14)+B(12)+B(10)+B(7)+
-          B(4)+B(1)+B(0), 23),
- kDefPoly(UINT64_ZERO, B(23)+B(22)+B(21)+B(18)+B(17)+B(15)+B(14)+B(12)+B(4)+
-          B(0), 24),
- kDefPoly(UINT64_ZERO, B(24)+B(23)+B(22)+B(20)+B(18)+B(17)+B(14)+B(13)+B(9)+
-          B(0), 25),
- kDefPoly(UINT64_ZERO, B(25)+B(22)+B(21)+B(19)+B(17)+B(15)+B(14)+B(12)+B(11)+
-          B(10)+B(6)+B(4)+B(3)+B(0), 26),
- kDefPoly(UINT64_ZERO, B(26)+B(25)+B(19)+B(17)+B(16)+B(13)+B(5)+B(4)+B(1)+
-          B(0), 27),
- kDefPoly(UINT64_ZERO, B(23)+B(22)+B(21)+B(20)+B(19)+B(18)+B(13)+B(12)+B(10)+
-          B(9)+B(8)+B(6)+B(5)+B(3)+B(1)+B(0), 28),
- kDefPoly(UINT64_ZERO, B(27)+B(26)+B(25)+B(23)+B(22)+B(20)+B(19)+B(15)+B(14)+
-          B(11)+B(10)+B(8)+B(7)+B(6)+B(4)+B(0), 29),
- kDefPoly(UINT64_ZERO, B(29)+B(27)+B(25)+B(23)+B(20)+B(19)+B(18)+B(17)+B(16)+
-          B(14)+B(11)+B(10)+B(9)+B(7)+B(6)+B(5)+B(4)+B(0), 30),
- kDefPoly(UINT64_ZERO, B(30)+B(29)+B(28)+B(27)+B(25)+B(23)+B(22)+B(21)+B(20)+
-          B(19)+B(18)+B(16)+B(15)+B(10)+B(9)+B(8)+B(4)+B(3)+B(1)+B(0), 31),
- kDefPoly(UINT64_ZERO, B(31)+B(29)+B(28)+B(27)+B(21)+B(20)+B(15)+B(13)+B(10)+
-          B(9)+B(8)+B(7)+B(4)+B(3)+B(2)+B(0), 32),
- kDefPoly(UINT64_ZERO, B(32)+B(31)+B(30)+B(29)+B(27)+B(25)+B(24)+B(22)+B(21)+
-          B(19)+B(15)+B(10)+B(4)+B(3)+B(2)+B(0), 33),
- kDefPoly(UINT64_ZERO, B(30)+B(27)+B(26)+B(25)+B(24)+B(20)+B(19)+B(18)+B(16)+
-          B(15)+B(14)+B(12)+B(9)+B(8)+B(7)+B(5)+B(1)+B(0), 34),
- kDefPoly(UINT64_ZERO, B(34)+B(32)+B(28)+B(27)+B(26)+B(22)+B(21)+B(20)+B(19)+
-          B(14)+B(13)+B(12)+B(10)+B(6)+B(5)+B(4)+B(3)+B(0), 35),
- kDefPoly(UINT64_ZERO, B(35)+B(34)+B(33)+B(32)+B(31)+B(28)+B(26)+B(24)+B(22)+
-          B(21)+B(20)+B(19)+B(18)+B(14)+B(13)+B(12)+B(10)+B(9)+B(8)+B(6)+B(5)+
-          B(4)+B(3)+B(0), 36),
- kDefPoly(UINT64_ZERO, B(36)+B(35)+B(31)+B(30)+B(28)+B(26)+B(25)+B(23)+B(22)+
-          B(20)+B(19)+B(18)+B(16)+B(13)+B(12)+B(7)+B(6)+B(4)+B(3)+B(0), 37),
- kDefPoly(UINT64_ZERO, B(37)+B(34)+B(33)+B(32)+B(31)+B(30)+B(29)+B(28)+B(27)+
-          B(26)+B(25)+B(23)+B(18)+B(16)+B(15)+B(13)+B(12)+B(11)+B(10)+B(9)+
-          B(8)+B(7)+B(6)+B(2)+B(1)+B(0), 38),
- kDefPoly(UINT64_ZERO, B(38)+B(37)+B(33)+B(32)+B(31)+B(27)+B(25)+B(24)+B(21)+
-          B(20)+B(19)+B(18)+B(17)+B(15)+B(14)+B(8)+B(7)+B(6)+B(3)+B(2)+B(1)+
-          B(0), 39),
- kDefPoly(UINT64_ZERO, B(38)+B(37)+B(35)+B(34)+B(32)+B(31)+B(30)+B(27)+B(24)+
-          B(21)+B(20)+B(14)+B(13)+B(11)+B(8)+B(4)+B(2)+B(0), 40),
- kDefPoly(UINT64_ZERO, B(38)+B(36)+B(35)+B(34)+B(33)+B(31)+B(30)+B(29)+B(28)+
-          B(27)+B(23)+B(22)+B(20)+B(19)+B(18)+B(17)+B(15)+B(14)+B(11)+B(5)+
-          B(4)+B(0), 41),
- kDefPoly(UINT64_ZERO, B(41)+B(37)+B(36)+B(35)+B(32)+B(31)+B(30)+B(29)+B(28)+
-          B(25)+B(19)+B(18)+B(14)+B(13)+B(12)+B(7)+B(6)+B(4)+B(2)+B(0), 42),
- kDefPoly(UINT64_ZERO, B(42)+B(40)+B(38)+B(37)+B(36)+B(35)+B(34)+B(33)+B(31)+
-          B(29)+B(27)+B(26)+B(25)+B(23)+B(21)+B(20)+B(19)+B(15)+B(11)+B(10)+
-          B(9)+B(8)+B(6)+B(5)+B(3)+B(0), 43),
- kDefPoly(UINT64_ZERO, B(43)+B(42)+B(40)+B(39)+B(37)+B(35)+B(32)+B(30)+B(26)+
-          B(25)+B(24)+B(20)+B(16)+B(13)+B(12)+B(11)+B(8)+B(6)+B(5)+B(4)+B(1)+
-          B(0), 44),
- kDefPoly(UINT64_ZERO, B(43)+B(42)+B(41)+B(40)+B(39)+B(38)+B(33)+B(32)+B(27)+
-          B(26)+B(25)+B(23)+B(20)+B(18)+B(17)+B(16)+B(14)+B(11)+B(10)+B(9)+
-          B(6)+B(5)+B(1)+B(0), 45),
- kDefPoly(UINT64_ZERO, B(45)+B(43)+B(42)+B(41)+B(40)+B(39)+B(32)+B(31)+B(30)+
-          B(29)+B(27)+B(25)+B(23)+B(18)+B(17)+B(16)+B(10)+B(9)+B(7)+B(6)+B(4)+
-          B(3)+B(2)+B(0), 46),
- kDefPoly(UINT64_ZERO, B(45)+B(44)+B(43)+B(41)+B(40)+B(39)+B(38)+B(37)+B(32)+
-          B(30)+B(23)+B(21)+B(20)+B(17)+B(15)+B(13)+B(11)+B(10)+B(7)+B(5)+
-          B(3)+B(0), 47),
- kDefPoly(UINT64_ZERO, B(46)+B(42)+B(41)+B(39)+B(37)+B(36)+B(35)+B(29)+B(28)+
-          B(25)+B(24)+B(21)+B(20)+B(18)+B(17)+B(13)+B(12)+B(11)+B(10)+B(9)+
-          B(8)+B(5)+B(1)+B(0), 48),
- kDefPoly(UINT64_ZERO, B(48)+B(44)+B(41)+B(40)+B(39)+B(38)+B(37)+B(36)+B(35)+
-          B(34)+B(30)+B(28)+B(27)+B(24)+B(21)+B(18)+B(17)+B(8)+B(3)+B(0), 49),
- kDefPoly(UINT64_ZERO, B(48)+B(47)+B(46)+B(45)+B(44)+B(43)+B(42)+B(35)+B(33)+
-          B(29)+B(26)+B(24)+B(23)+B(21)+B(18)+B(16)+B(14)+B(13)+B(12)+B(9)+
-          B(7)+B(6)+B(5)+B(4)+B(3)+B(0), 50),
- kDefPoly(UINT64_ZERO, B(47)+B(46)+B(45)+B(44)+B(43)+B(40)+B(39)+B(38)+B(36)+
-          B(35)+B(30)+B(29)+B(28)+B(26)+B(25)+B(24)+B(23)+B(22)+B(20)+B(19)+
-          B(18)+B(17)+B(15)+B(11)+B(7)+B(4)+B(3)+B(0), 51),
- kDefPoly(UINT64_ZERO, B(51)+B(46)+B(43)+B(38)+B(37)+B(36)+B(34)+B(31)+B(27)+
-          B(26)+B(20)+B(17)+B(16)+B(15)+B(13)+B(12)+B(11)+B(9)+B(7)+B(5)+B(1)+
-          B(0), 52),
- kDefPoly(UINT64_ZERO, B(50)+B(49)+B(47)+B(46)+B(44)+B(42)+B(41)+B(37)+B(36)+
-          B(35)+B(33)+B(29)+B(28)+B(26)+B(24)+B(23)+B(21)+B(20)+B(14)+B(13)+
-          B(12)+B(11)+B(10)+B(9)+B(8)+B(6)+B(3)+B(2)+B(1)+B(0), 53),
- kDefPoly(UINT64_ZERO, B(52)+B(47)+B(46)+B(44)+B(43)+B(42)+B(40)+B(36)+B(32)+
-          B(31)+B(30)+B(29)+B(28)+B(26)+B(25)+B(24)+B(23)+B(22)+B(20)+B(19)+
-          B(17)+B(16)+B(15)+B(14)+B(13)+B(12)+B(11)+B(10)+B(7)+B(4)+B(2)+
-          B(0), 54),
- kDefPoly(UINT64_ZERO, B(53)+B(50)+B(48)+B(47)+B(37)+B(35)+B(31)+B(30)+B(25)+
-          B(22)+B(21)+B(20)+B(19)+B(18)+B(15)+B(10)+B(8)+B(6)+B(3)+B(2)+B(1)+
-          B(0), 55),
- kDefPoly(UINT64_ZERO, B(54)+B(52)+B(51)+B(49)+B(48)+B(42)+B(38)+B(37)+B(31)+
-          B(30)+B(27)+B(26)+B(24)+B(23)+B(22)+B(19)+B(16)+B(12)+B(11)+B(8)+
-          B(6)+B(4)+B(3)+B(0), 56),
- kDefPoly(UINT64_ZERO, B(55)+B(54)+B(51)+B(49)+B(48)+B(47)+B(46)+B(44)+B(43)+
-          B(42)+B(41)+B(40)+B(39)+B(38)+B(32)+B(29)+B(27)+B(26)+B(23)+B(21)+
-          B(20)+B(15)+B(12)+B(7)+B(6)+B(5)+B(3)+B(0), 57),
- kDefPoly(UINT64_ZERO, B(57)+B(54)+B(52)+B(47)+B(45)+B(42)+B(41)+B(40)+B(39)+
-          B(36)+B(34)+B(33)+B(31)+B(28)+B(26)+B(21)+B(20)+B(18)+B(17)+B(16)+
-          B(13)+B(11)+B(8)+B(7)+B(4)+B(2)+B(1)+B(0), 58),
- kDefPoly(UINT64_ZERO, B(58)+B(56)+B(54)+B(49)+B(47)+B(46)+B(43)+B(40)+B(38)+
-          B(36)+B(35)+B(33)+B(32)+B(31)+B(30)+B(27)+B(24)+B(22)+B(21)+B(19)+
-          B(17)+B(16)+B(11)+B(10)+B(9)+B(8)+B(7)+B(4)+B(3)+B(2)+B(1)+B(0),
-          59),
- kDefPoly(UINT64_ZERO, B(56)+B(54)+B(51)+B(46)+B(43)+B(42)+B(40)+B(39)+B(37)+
-          B(35)+B(34)+B(33)+B(32)+B(31)+B(30)+B(29)+B(27)+B(25)+B(22)+B(21)+
-          B(20)+B(19)+B(17)+B(16)+B(15)+B(14)+B(13)+B(12)+B(9)+B(7)+B(4)+
-          B(3)+B(1)+B(0), 60),
- kDefPoly(UINT64_ZERO, B(59)+B(58)+B(57)+B(56)+B(54)+B(53)+B(50)+B(49)+B(47)+
-          B(44)+B(42)+B(41)+B(40)+B(37)+B(35)+B(34)+B(32)+B(30)+B(29)+B(27)+
-          B(26)+B(22)+B(21)+B(20)+B(17)+B(14)+B(13)+B(12)+B(8)+B(5)+B(4)+
-          B(0), 61),
- kDefPoly(UINT64_ZERO, B(61)+B(59)+B(57)+B(55)+B(54)+B(53)+B(52)+B(51)+B(50)+
-          B(49)+B(48)+B(45)+B(44)+B(40)+B(37)+B(35)+B(32)+B(31)+B(29)+B(25)+
-          B(24)+B(23)+B(20)+B(17)+B(16)+B(15)+B(13)+B(12)+B(11)+B(10)+B(6)+
-          B(5)+B(2)+B(0), 62),
- kDefPoly(UINT64_ZERO, B(62)+B(57)+B(56)+B(53)+B(52)+B(51)+B(50)+B(46)+B(41)+
-          B(38)+B(35)+B(34)+B(33)+B(31)+B(27)+B(25)+B(23)+B(21)+B(19)+B(18)+
-          B(17)+B(16)+B(13)+B(11)+B(7)+B(5)+B(1)+B(0), 63),
- kDefPoly(UINT64_ZERO, B(62)+B(61)+B(60)+B(57)+B(55)+B(54)+B(53)+B(49)+B(48)+
-          B(46)+B(44)+B(42)+B(40)+B(39)+B(37)+B(36)+B(28)+B(27)+B(25)+B(23)+
-          B(22)+B(21)+B(17)+B(15)+B(13)+B(7)+B(6)+B(4)+B(2)+B(0), 64),
- kDefPoly(UINT64_ZERO, B(63)+B(62)+B(59)+B(57)+B(54)+B(53)+B(51)+B(48)+
-          B(47)+B(46)+B(45)+B(44)+B(41)+B(40)+B(38)+B(36)+B(35)+B(28)+
-          B(25)+B(24)+B(21)+B(20)+B(18)+B(16)+B(15)+B(13)+B(11)+B(8)+B(7)+
-          B(3)+B(1)+B(0), 65),
- kDefPoly(UINT64_ZERO, B(63)+B(58)+B(57)+B(56)+B(52)+B(51)+B(50)+B(44)+
-          B(41)+B(40)+B(36)+B(34)+B(32)+B(31)+B(27)+B(25)+B(23)+B(21)+
-          B(20)+B(19)+B(18)+B(17)+B(15)+B(14)+B(12)+B(11)+B(10)+B(8)+B(5)+
-          B(4)+B(3)+B(0), 66),
- kDefPoly(B(66), B(62)+B(60)+B(59)+B(58)+B(57)+B(56)+B(55)+B(54)+B(52)+
-          B(50)+B(47)+B(46)+B(45)+B(43)+B(42)+B(41)+B(38)+B(37)+B(36)+
-          B(33)+B(32)+B(31)+B(30)+B(28)+B(27)+B(26)+B(24)+B(21)+B(18)+
-          B(17)+B(14)+B(13)+B(12)+B(11)+B(10)+B(7)+B(4)+B(3)+B(0), 67),
- kDefPoly(B(67)+B(66), B(63)+B(61)+B(57)+B(55)+B(51)+B(47)+B(45)+B(43)+
-          B(42)+B(41)+B(40)+B(39)+B(32)+B(31)+B(30)+B(28)+B(27)+B(25)+
-          B(19)+B(18)+B(17)+B(15)+B(11)+B(9)+B(8)+B(7)+B(6)+B(5)+B(4)+B(3)+
-          B(1)+B(0), 68),
- kDefPoly(B(68), B(60)+B(57)+B(55)+B(54)+B(52)+B(50)+B(49)+B(48)+B(44)+
-          B(40)+B(38)+B(37)+B(33)+B(31)+B(28)+B(25)+B(22)+B(21)+B(20)+
-          B(19)+B(18)+B(17)+B(13)+B(12)+B(9)+B(8)+B(6)+B(5)+B(4)+B(1)+
-          B(0), 69),
- kDefPoly(B(69)+B(68)+B(67)+B(66), B(63)+B(62)+B(61)+B(59)+B(51)+B(49)+
-          B(48)+B(46)+B(45)+B(42)+B(40)+B(38)+B(36)+B(35)+B(33)+B(32)+
-          B(30)+B(29)+B(27)+B(23)+B(22)+B(21)+B(16)+B(12)+B(5)+B(4)+B(1)+
-          B(0), 70),
- kDefPoly(B(70)+B(69)+B(68)+B(64), B(63)+B(62)+B(61)+B(60)+B(59)+B(57)+
-          B(56)+B(55)+B(54)+B(53)+B(51)+B(50)+B(47)+B(44)+B(43)+B(41)+
-          B(39)+B(37)+B(36)+B(33)+B(32)+B(26)+B(25)+B(24)+B(23)+B(21)+
-          B(20)+B(19)+B(17)+B(12)+B(11)+B(10)+B(8)+B(6)+B(5)+B(4)+B(2)+
-          B(0), 71),
- kDefPoly(B(71)+B(69)+B(68)+B(65)+B(64), B(62)+B(61)+B(59)+B(58)+B(55)+
-          B(53)+B(51)+B(49)+B(48)+B(47)+B(43)+B(40)+B(38)+B(37)+B(36)+
-          B(35)+B(33)+B(32)+B(31)+B(30)+B(29)+B(26)+B(24)+B(19)+B(18)+
-          B(15)+B(13)+B(9)+B(7)+B(6)+B(3)+B(1)+B(0), 72),
- kDefPoly(B(71)+B(70)+B(69)+B(67)+B(65), B(63)+B(62)+B(61)+B(58)+B(57)+
-          B(56)+B(55)+B(52)+B(51)+B(50)+B(49)+B(46)+B(45)+B(44)+B(43)+
-          B(41)+B(37)+B(36)+B(34)+B(33)+B(27)+B(26)+B(25)+B(21)+B(19)+
-          B(18)+B(16)+B(15)+B(14)+B(13)+B(9)+B(8)+B(6)+B(5)+B(2)+B(1)+
-          B(0), 73),
- kDefPoly(B(73)+B(71)+B(70)+B(65)+B(64), B(62)+B(60)+B(55)+B(54)+B(52)+
-          B(50)+B(48)+B(47)+B(46)+B(44)+B(41)+B(40)+B(31)+B(29)+B(28)+
-          B(27)+B(26)+B(24)+B(23)+B(22)+B(20)+B(16)+B(12)+B(9)+B(6)+B(5)+
-          B(4)+B(2)+B(0), 74),
- kDefPoly(B(74)+B(73)+B(72)+B(67)+B(64), B(63)+B(61)+B(60)+B(58)+B(57)+
-          B(56)+B(54)+B(52)+B(51)+B(50)+B(44)+B(43)+B(42)+B(41)+B(40)+
-          B(39)+B(38)+B(36)+B(35)+B(33)+B(32)+B(31)+B(29)+B(28)+B(26)+
-          B(23)+B(21)+B(19)+B(18)+B(16)+B(15)+B(13)+B(12)+B(11)+B(7)+B(6)+
-          B(5)+B(4)+B(3)+B(2)+B(0), 75),
- kDefPoly(B(75)+B(74)+B(71)+B(70)+B(66), B(63)+B(61)+B(59)+B(57)+B(53)+
-          B(50)+B(49)+B(48)+B(44)+B(43)+B(42)+B(37)+B(33)+B(30)+B(27)+
-          B(24)+B(23)+B(20)+B(18)+B(15)+B(12)+B(11)+B(9)+B(7)+B(6)+B(4)+
-          B(3)+B(2)+B(0), 76),
- kDefPoly(B(73)+B(71)+B(70)+B(68)+B(67)+B(66)+B(65), B(63)+B(60)+B(59)+
-          B(58)+B(57)+B(54)+B(49)+B(47)+B(46)+B(45)+B(43)+B(41)+B(38)+
-          B(34)+B(33)+B(31)+B(30)+B(29)+B(27)+B(25)+B(24)+B(21)+B(20)+
-          B(19)+B(16)+B(15)+B(14)+B(13)+B(10)+B(8)+B(6)+B(5)+B(4)+B(2)+
-          B(0), 77),
- kDefPoly(B(77)+B(76)+B(75)+B(74)+B(70)+B(66)+B(65)+B(64), B(63)+B(62)+
-          B(60)+B(58)+B(57)+B(55)+B(52)+B(51)+B(44)+B(41)+B(39)+B(38)+
-          B(35)+B(31)+B(30)+B(29)+B(26)+B(22)+B(21)+B(20)+B(19)+B(15)+
-          B(13)+B(11)+B(6)+B(4)+B(1)+B(0), 78),
- kDefPoly(B(78)+B(76)+B(75)+B(71)+B(68)+B(67)+B(65), B(63)+B(61)+B(60)+
-          B(55)+B(54)+B(51)+B(50)+B(48)+B(44)+B(42)+B(41)+B(40)+B(38)+
-          B(35)+B(34)+B(32)+B(28)+B(26)+B(23)+B(22)+B(19)+B(15)+B(13)+
-          B(12)+B(8)+B(7)+B(5)+B(2)+B(0), 79),
- kDefPoly(B(77)+B(76)+B(75)+B(73)+B(70)+B(66), B(63)+B(61)+B(60)+B(59)+
-          B(56)+B(54)+B(53)+B(52)+B(50)+B(44)+B(43)+B(40)+B(39)+B(38)+
-          B(35)+B(34)+B(33)+B(29)+B(28)+B(27)+B(26)+B(25)+B(24)+B(23)+
-          B(22)+B(21)+B(20)+B(18)+B(16)+B(13)+B(12)+B(11)+B(10)+B(8)+B(7)+
-          B(6)+B(3)+B(2)+B(1)+B(0), 80),
- kDefPoly(B(78)+B(77)+B(76)+B(75)+B(73)+B(71)+B(67)+B(66)+B(65)+
-          B(64), B(61)+B(54)+B(53)+B(52)+B(49)+B(47)+B(44)+B(41)+B(40)+
-          B(35)+B(33)+B(31)+B(30)+B(28)+B(27)+B(26)+B(25)+B(22)+B(21)+
-          B(20)+B(16)+B(15)+B(13)+B(12)+B(11)+B(0), 81),
- kDefPoly(B(81)+B(80)+B(79)+B(77)+B(76)+B(74)+B(73)+B(72)+B(68)+B(67)+
-          B(66)+B(64), B(62)+B(51)+B(50)+B(49)+B(47)+B(46)+B(45)+B(43)+
-          B(41)+B(38)+B(37)+B(34)+B(32)+B(30)+B(27)+B(26)+B(25)+B(24)+
-          B(23)+B(22)+B(20)+B(19)+B(16)+B(15)+B(13)+B(12)+B(9)+B(7)+B(5)+
-          B(4)+B(1)+B(0), 82),
- kDefPoly(B(82)+B(81)+B(79)+B(78)+B(77)+B(75)+B(72)+B(71)+B(69)+B(68)+
-          B(67)+B(66)+B(65)+B(64), B(60)+B(58)+B(57)+B(56)+B(53)+B(52)+
-          B(51)+B(49)+B(48)+B(45)+B(43)+B(41)+B(40)+B(39)+B(38)+B(37)+
-          B(36)+B(35)+B(33)+B(26)+B(24)+B(21)+B(19)+B(16)+B(13)+B(12)+
-          B(11)+B(9)+B(7)+B(5)+B(4)+B(3)+B(1)+B(0), 83),
- kDefPoly(B(79)+B(77)+B(73)+B(72)+B(71)+B(66)+B(64), B(62)+B(61)+B(59)+
-          B(58)+B(57)+B(56)+B(53)+B(52)+B(51)+B(48)+B(47)+B(46)+B(45)+
-          B(43)+B(42)+B(41)+B(38)+B(37)+B(35)+B(33)+B(32)+B(29)+B(24)+
-          B(22)+B(17)+B(16)+B(15)+B(13)+B(11)+B(10)+B(9)+B(7)+B(6)+B(5)+
-          B(0), 84),
- kDefPoly(B(83)+B(78)+B(76)+B(73)+B(70)+B(69)+B(68)+B(67)+B(66)+
-          B(64), B(62)+B(61)+B(60)+B(59)+B(54)+B(51)+B(50)+B(48)+B(47)+
-          B(42)+B(41)+B(40)+B(38)+B(37)+B(36)+B(34)+B(31)+B(30)+B(28)+
-          B(27)+B(26)+B(24)+B(22)+B(21)+B(20)+B(19)+B(18)+B(16)+B(15)+
-          B(14)+B(13)+B(12)+B(10)+B(6)+B(4)+B(0), 85),
- kDefPoly(B(84)+B(77)+B(76)+B(75)+B(71)+B(70)+B(69)+B(67)+B(65), B(63)+
-          B(62)+B(59)+B(58)+B(57)+B(55)+B(53)+B(52)+B(51)+B(48)+B(47)+
-          B(45)+B(43)+B(40)+B(38)+B(36)+B(34)+B(33)+B(31)+B(27)+B(25)+
-          B(24)+B(23)+B(22)+B(19)+B(15)+B(13)+B(12)+B(11)+B(8)+B(6)+B(4)+
-          B(0), 86),
- kDefPoly(B(85)+B(84)+B(83)+B(81)+B(80)+B(78)+B(73)+B(72)+B(70)+B(68)+
-          B(67)+B(64), B(61)+B(60)+B(58)+B(57)+B(55)+B(52)+B(50)+B(49)+
-          B(47)+B(44)+B(37)+B(36)+B(35)+B(34)+B(32)+B(31)+B(30)+B(25)+
-          B(24)+B(23)+B(20)+B(13)+B(12)+B(11)+B(10)+B(9)+B(7)+B(6)+B(4)+
-          B(3)+B(2)+B(0), 87),
- kDefPoly(B(86)+B(85)+B(84)+B(83)+B(82)+B(80)+B(77)+B(74)+B(70)+B(69)+
-          B(65), B(63)+B(60)+B(59)+B(57)+B(56)+B(55)+B(53)+B(50)+B(49)+
-          B(48)+B(45)+B(42)+B(41)+B(40)+B(39)+B(38)+B(37)+B(36)+B(25)+
-          B(21)+B(19)+B(13)+B(11)+B(8)+B(5)+B(4)+B(2)+B(1)+B(0), 88),
- kDefPoly(B(86)+B(85)+B(83)+B(82)+B(81)+B(78)+B(77)+B(74)+B(73)+B(72)+
-          B(70)+B(69)+B(68)+B(65)+B(64), B(59)+B(57)+B(55)+B(54)+B(51)+
-          B(50)+B(46)+B(45)+B(44)+B(43)+B(42)+B(40)+B(38)+B(37)+B(33)+
-          B(31)+B(30)+B(29)+B(28)+B(27)+B(23)+B(22)+B(21)+B(20)+B(18)+
-          B(17)+B(16)+B(15)+B(10)+B(9)+B(3)+B(1)+B(0), 89),
- kDefPoly(B(86)+B(83)+B(82)+B(80)+B(79)+B(73)+B(70)+B(69)+B(67)+
-          B(64), B(63)+B(62)+B(61)+B(57)+B(56)+B(54)+B(51)+B(49)+B(47)+
-          B(46)+B(45)+B(40)+B(39)+B(37)+B(35)+B(33)+B(32)+B(29)+B(28)+
-          B(27)+B(25)+B(24)+B(23)+B(22)+B(21)+B(20)+B(19)+B(18)+B(17)+
-          B(15)+B(9)+B(8)+B(7)+B(3)+B(2)+B(0), 90),
- kDefPoly(B(90)+B(89)+B(84)+B(81)+B(80)+B(78)+B(74)+B(73)+B(71)+B(68)+
-          B(64), B(60)+B(59)+B(58)+B(57)+B(55)+B(54)+B(52)+B(50)+B(49)+
-          B(47)+B(45)+B(42)+B(41)+B(39)+B(38)+B(36)+B(32)+B(28)+B(25)+
-          B(21)+B(20)+B(19)+B(15)+B(12)+B(11)+B(9)+B(8)+B(3)+
-          B(0), 91),
- kDefPoly(B(91)+B(89)+B(88)+B(87)+B(86)+B(85)+B(84)+B(83)+B(80)+B(78)+
-          B(76)+B(72)+B(70)+B(68), B(63)+B(62)+B(61)+B(59)+B(57)+B(56)+
-          B(52)+B(51)+B(50)+B(49)+B(43)+B(40)+B(39)+B(37)+B(36)+B(35)+
-          B(34)+B(33)+B(32)+B(26)+B(25)+B(24)+B(23)+B(22)+B(18)+B(15)+
-          B(12)+B(11)+B(9)+B(7)+B(6)+B(3)+B(1)+B(0), 92),
- kDefPoly(B(86)+B(85)+B(83)+B(82)+B(79)+B(78)+B(77)+B(75)+B(74)+B(73)+
-          B(66)+B(64), B(59)+B(57)+B(56)+B(55)+B(54)+B(52)+B(51)+B(40)+
-          B(38)+B(36)+B(34)+B(33)+B(28)+B(27)+B(26)+B(25)+B(23)+B(22)+
-          B(21)+B(20)+B(19)+B(18)+B(16)+B(15)+B(14)+B(13)+B(12)+B(11)+B(8)+
-          B(7)+B(6)+B(5)+B(4)+B(0), 93),
- kDefPoly(B(93)+B(92)+B(91)+B(89)+B(88)+B(87)+B(86)+B(81)+B(80)+B(75)+
-          B(66)+B(64), B(62)+B(61)+B(60)+B(59)+B(58)+B(57)+B(56)+B(54)+
-          B(48)+B(47)+B(46)+B(45)+B(44)+B(42)+B(41)+B(38)+B(37)+B(36)+
-          B(34)+B(33)+B(31)+B(30)+B(27)+B(26)+B(25)+B(22)+B(13)+B(12)+
-          B(11)+B(10)+B(8)+B(7)+B(4)+B(0), 94),
- kDefPoly(B(94)+B(88)+B(87)+B(82)+B(79)+B(78)+B(76)+B(73)+B(65)+
-          B(64), B(62)+B(61)+B(60)+B(59)+B(58)+B(57)+B(53)+B(51)+B(50)+
-          B(49)+B(48)+B(47)+B(46)+B(44)+B(40)+B(36)+B(34)+B(33)+B(30)+
-          B(28)+B(27)+B(25)+B(22)+B(19)+B(18)+B(17)+B(16)+B(14)+B(7)+B(5)+
-          B(3)+B(2)+B(1)+B(0), 95),
- kDefPoly(B(92)+B(89)+B(88)+B(86)+B(83)+B(79)+B(78)+B(76)+B(75)+B(74)+
-          B(72)+B(70)+B(67)+B(66), B(63)+B(60)+B(57)+B(55)+B(53)+B(51)+
-          B(47)+B(46)+B(44)+B(43)+B(42)+B(39)+B(38)+B(36)+B(34)+B(32)+
-          B(31)+B(30)+B(27)+B(26)+B(25)+B(22)+B(21)+B(19)+B(17)+B(13)+
-          B(11)+B(10)+B(9)+B(8)+B(7)+B(4)+B(1)+B(0), 96),
- kDefPoly(B(96)+B(94)+B(93)+B(91)+B(89)+B(87)+B(85)+B(83)+B(81)+B(78)+
-          B(76)+B(74)+B(73)+B(68)+B(67)+B(64), B(62)+B(61)+B(57)+B(55)+
-          B(54)+B(53)+B(49)+B(47)+B(41)+B(38)+B(35)+B(33)+B(28)+B(27)+
-          B(24)+B(23)+B(21)+B(19)+B(18)+B(17)+B(15)+B(13)+B(12)+B(11)+B(8)+
-          B(6)+B(4)+B(3)+B(1)+B(0), 97),
- kDefPoly(B(97)+B(93)+B(92)+B(91)+B(90)+B(87)+B(83)+B(82)+B(80)+B(77)+
-          B(76)+B(75)+B(74)+B(73)+B(72)+B(70)+B(69)+B(68)+B(66)+B(65)+
-          B(64), B(63)+B(62)+B(61)+B(60)+B(59)+B(57)+B(55)+B(53)+B(50)+
-          B(49)+B(48)+B(45)+B(44)+B(43)+B(42)+B(40)+B(38)+B(36)+B(35)+
-          B(34)+B(28)+B(27)+B(24)+B(22)+B(21)+B(18)+B(17)+B(16)+B(15)+
-          B(14)+B(12)+B(11)+B(9)+B(8)+B(2)+B(1)+B(0), 98),
- kDefPoly(B(96)+B(94)+B(92)+B(86)+B(85)+B(84)+B(78)+B(77)+B(76)+B(75)+
-          B(73)+B(71)+B(69)+B(68)+B(65), B(61)+B(59)+B(57)+B(56)+B(54)+
-          B(50)+B(47)+B(46)+B(44)+B(41)+B(38)+B(36)+B(35)+B(34)+B(33)+
-          B(32)+B(29)+B(27)+B(26)+B(25)+B(23)+B(22)+B(21)+B(19)+B(17)+
-          B(16)+B(11)+B(9)+B(7)+B(6)+B(3)+B(2)+B(0), 99),
- kDefPoly(B(99)+B(96)+B(95)+B(93)+B(92)+B(88)+B(87)+B(83)+B(78)+B(77)+
-          B(76)+B(75)+B(74)+B(73)+B(70)+B(66)+B(64), B(63)+B(62)+B(60)+
-          B(59)+B(57)+B(56)+B(53)+B(50)+B(47)+B(41)+B(39)+B(38)+B(37)+
-          B(34)+B(25)+B(23)+B(21)+B(20)+B(19)+B(18)+B(17)+B(16)+B(13)+B(9)+
-          B(8)+B(6)+B(5)+B(1)+B(0), 100),
- kDefPoly(B(100)+B(98)+B(97)+B(95)+B(93)+B(92)+B(91)+B(89)+B(87)+B(85)+
-          B(84)+B(82)+B(81)+B(80)+B(79)+B(76)+B(68)+B(66)+B(65), B(63)+
-          B(62)+B(59)+B(57)+B(52)+B(51)+B(50)+B(47)+B(46)+B(45)+B(42)+
-          B(41)+B(40)+B(39)+B(38)+B(37)+B(36)+B(34)+B(32)+B(31)+B(30)+
-          B(24)+B(22)+B(21)+B(20)+B(18)+B(17)+B(16)+B(14)+B(12)+B(11)+
-          B(10)+B(8)+B(7)+B(5)+B(4)+B(2)+B(1)+B(0), 101),
- kDefPoly(B(101)+B(99)+B(97)+B(96)+B(92)+B(89)+B(88)+B(87)+B(86)+B(84)+
-          B(82)+B(81)+B(80)+B(78)+B(77)+B(76)+B(75)+B(74)+B(73)+
-          B(69), B(60)+B(59)+B(57)+B(56)+B(55)+B(54)+B(53)+B(51)+B(50)+
-          B(49)+B(47)+B(45)+B(43)+B(41)+B(35)+B(34)+B(32)+B(31)+B(29)+
-          B(27)+B(26)+B(25)+B(24)+B(21)+B(13)+B(12)+B(9)+B(8)+B(6)+B(5)+
-          B(3)+B(0), 102),
- kDefPoly(B(101)+B(98)+B(97)+B(96)+B(94)+B(93)+B(92)+B(90)+B(89)+B(88)+
-          B(87)+B(85)+B(83)+B(81)+B(80)+B(79)+B(76)+B(75)+B(71)+B(70)+
-          B(69)+B(66), B(63)+B(62)+B(60)+B(59)+B(58)+B(56)+B(54)+B(53)+
-          B(48)+B(45)+B(43)+B(42)+B(41)+B(37)+B(36)+B(32)+B(31)+B(30)+
-          B(27)+B(25)+B(23)+B(22)+B(19)+B(16)+B(15)+B(11)+B(9)+B(5)+B(3)+
-          B(0), 103),
- kDefPoly(B(98)+B(97)+B(95)+B(94)+B(91)+B(89)+B(88)+B(86)+B(85)+B(84)+
-          B(81)+B(79)+B(78)+B(76)+B(74)+B(73)+B(70)+B(69)+B(68)+B(67)+
-          B(66)+B(64), B(59)+B(53)+B(52)+B(51)+B(48)+B(46)+B(45)+B(43)+
-          B(37)+B(34)+B(33)+B(31)+B(30)+B(28)+B(25)+B(22)+B(21)+B(20)+
-          B(19)+B(14)+B(10)+B(8)+B(4)+B(2)+B(1)+B(0), 104),
- kDefPoly(B(103)+B(100)+B(99)+B(98)+B(94)+B(90)+B(89)+B(86)+B(84)+B(82)+
-          B(79)+B(76)+B(74)+B(73)+B(72)+B(71)+B(70)+B(69)+B(67)+
-          B(66), B(63)+B(62)+B(59)+B(58)+B(57)+B(55)+B(51)+B(49)+B(48)+
-          B(47)+B(46)+B(43)+B(42)+B(38)+B(36)+B(34)+B(33)+B(31)+B(30)+
-          B(29)+B(28)+B(27)+B(24)+B(21)+B(20)+B(18)+B(17)+B(16)+B(14)+
-          B(13)+B(11)+B(9)+B(7)+B(6)+B(5)+B(0), 105),
- kDefPoly(B(105)+B(104)+B(103)+B(102)+B(100)+B(98)+B(94)+B(93)+B(92)+B(91)+
-          B(90)+B(89)+B(87)+B(86)+B(85)+B(83)+B(82)+B(81)+B(79)+B(77)+
-          B(69)+B(68)+B(67)+B(64), B(61)+B(60)+B(59)+B(58)+B(56)+B(55)+
-          B(53)+B(50)+B(48)+B(44)+B(40)+B(38)+B(37)+B(36)+B(35)+B(34)+
-          B(33)+B(30)+B(29)+B(26)+B(22)+B(20)+B(13)+B(10)+B(8)+B(7)+B(5)+
-          B(0), 106),
- kDefPoly(B(105)+B(101)+B(100)+B(98)+B(97)+B(96)+B(93)+B(92)+B(91)+B(90)+
-          B(87)+B(86)+B(81)+B(79)+B(77)+B(75)+B(74)+B(72)+B(68)+B(67)+
-          B(64), B(63)+B(62)+B(61)+B(60)+B(59)+B(58)+B(54)+B(53)+B(52)+
-          B(50)+B(48)+B(47)+B(45)+B(42)+B(41)+B(38)+B(32)+B(29)+B(27)+
-          B(26)+B(24)+B(21)+B(19)+B(18)+B(16)+B(15)+B(14)+B(13)+B(12)+
-          B(10)+B(7)+B(6)+B(4)+B(1)+B(0), 107),
- kDefPoly(B(106)+B(105)+B(102)+B(100)+B(97)+B(95)+B(90)+B(89)+B(88)+B(86)+
-          B(83)+B(82)+B(81)+B(79)+B(78)+B(75)+B(72)+B(66)+B(64), B(63)+
-          B(62)+B(59)+B(58)+B(56)+B(54)+B(52)+B(51)+B(50)+B(48)+B(46)+
-          B(45)+B(44)+B(42)+B(40)+B(37)+B(36)+B(35)+B(33)+B(29)+B(27)+
-          B(22)+B(19)+B(17)+B(14)+B(12)+B(11)+B(10)+B(9)+B(8)+B(7)+B(6)+
-          B(5)+B(3)+B(0), 108),
- kDefPoly(B(108)+B(102)+B(101)+B(100)+B(99)+B(98)+B(96)+B(95)+B(94)+B(90)+
-          B(89)+B(88)+B(87)+B(84)+B(83)+B(81)+B(80)+B(77)+B(76)+B(75)+
-          B(71)+B(67)+B(65), B(63)+B(61)+B(60)+B(54)+B(50)+B(49)+B(48)+
-          B(43)+B(40)+B(39)+B(38)+B(36)+B(34)+B(29)+B(28)+B(27)+B(22)+
-          B(21)+B(19)+B(16)+B(14)+B(13)+B(12)+B(10)+B(9)+B(7)+B(6)+B(5)+
-          B(3)+B(2)+B(0), 109),
- kDefPoly(B(109)+B(108)+B(107)+B(102)+B(101)+B(98)+B(97)+B(96)+B(94)+B(92)+
-          B(91)+B(90)+B(88)+B(87)+B(85)+B(84)+B(83)+B(82)+B(81)+B(80)+
-          B(79)+B(78)+B(74)+B(73)+B(71)+B(70)+B(69)+B(66)+B(64), B(61)+
-          B(58)+B(57)+B(56)+B(50)+B(49)+B(46)+B(44)+B(43)+B(41)+B(36)+
-          B(35)+B(34)+B(30)+B(29)+B(26)+B(25)+B(24)+B(22)+B(21)+B(17)+
-          B(13)+B(11)+B(9)+B(4)+B(1)+B(0), 110),
- kDefPoly(B(110)+B(109)+B(105)+B(98)+B(97)+B(95)+B(94)+B(93)+B(92)+B(90)+
-          B(88)+B(84)+B(83)+B(82)+B(80)+B(77)+B(75)+B(72)+B(71)+B(70)+
-          B(69)+B(66), B(63)+B(61)+B(60)+B(59)+B(57)+B(56)+B(55)+B(52)+
-          B(51)+B(50)+B(49)+B(47)+B(43)+B(40)+B(36)+B(35)+B(34)+B(33)+
-          B(31)+B(27)+B(26)+B(21)+B(20)+B(19)+B(17)+B(16)+B(12)+B(8)+B(6)+
-          B(4)+B(3)+B(2)+B(1)+B(0), 111),
- kDefPoly(B(109)+B(107)+B(106)+B(104)+B(100)+B(98)+B(96)+B(95)+B(94)+B(92)+
-          B(91)+B(90)+B(89)+B(88)+B(86)+B(84)+B(81)+B(79)+B(78)+B(77)+
-          B(75)+B(73)+B(71)+B(70)+B(69)+B(67)+B(64), B(63)+B(62)+B(61)+
-          B(60)+B(58)+B(56)+B(54)+B(52)+B(51)+B(49)+B(48)+B(45)+B(44)+
-          B(39)+B(38)+B(37)+B(36)+B(35)+B(34)+B(32)+B(30)+B(26)+B(25)+
-          B(24)+B(23)+B(22)+B(21)+B(19)+B(16)+B(15)+B(11)+B(10)+B(9)+B(8)+
-          B(3)+B(1)+B(0), 112),
- kDefPoly(B(111)+B(107)+B(102)+B(100)+B(99)+B(98)+B(97)+B(96)+B(95)+B(94)+
-          B(93)+B(92)+B(87)+B(86)+B(82)+B(81)+B(80)+B(79)+B(77)+B(76)+
-          B(75)+B(72)+B(69)+B(64), B(61)+B(58)+B(56)+B(54)+B(53)+B(52)+
-          B(51)+B(49)+B(46)+B(43)+B(40)+B(39)+B(37)+B(36)+B(35)+B(34)+
-          B(33)+B(31)+B(29)+B(24)+B(22)+B(21)+B(20)+B(15)+B(14)+B(12)+
-          B(10)+B(6)+B(1)+B(0), 113),
- kDefPoly(B(112)+B(111)+B(110)+B(104)+B(102)+B(101)+B(100)+B(92)+B(89)+
-          B(87)+B(83)+B(82)+B(80)+B(79)+B(75)+B(74)+B(73)+B(72)+B(71)+
-          B(70)+B(68)+B(67)+B(65), B(60)+B(59)+B(57)+B(56)+B(55)+B(52)+
-          B(50)+B(47)+B(44)+B(41)+B(36)+B(35)+B(30)+B(29)+B(26)+B(25)+
-          B(24)+B(21)+B(18)+B(17)+B(16)+B(14)+B(12)+B(10)+B(7)+B(6)+
-          B(0), 114),
- kDefPoly(B(114)+B(112)+B(111)+B(110)+B(108)+B(107)+B(103)+B(102)+B(98)+
-          B(97)+B(96)+B(90)+B(88)+B(87)+B(86)+B(83)+B(82)+B(80)+B(79)+
-          B(77)+B(75)+B(70)+B(66)+B(65)+B(64), B(61)+B(60)+B(59)+B(58)+
-          B(57)+B(53)+B(52)+B(51)+B(50)+B(47)+B(45)+B(43)+B(39)+B(38)+
-          B(33)+B(32)+B(31)+B(29)+B(27)+B(21)+B(17)+B(14)+B(12)+B(10)+B(7)+
-          B(4)+B(2)+B(1)+B(0), 115),
- kDefPoly(B(113)+B(110)+B(108)+B(106)+B(105)+B(102)+B(101)+B(100)+B(98)+
-          B(96)+B(92)+B(89)+B(87)+B(86)+B(84)+B(81)+B(79)+B(78)+B(76)+
-          B(75)+B(73)+B(72)+B(71)+B(70)+B(67)+B(64), B(63)+B(62)+B(61)+
-          B(52)+B(47)+B(45)+B(44)+B(42)+B(40)+B(39)+B(35)+B(34)+B(33)+
-          B(31)+B(29)+B(25)+B(18)+B(15)+B(14)+B(10)+B(8)+B(6)+B(1)+
-          B(0), 116),
- kDefPoly(B(113)+B(111)+B(110)+B(109)+B(107)+B(106)+B(103)+B(102)+B(100)+
-          B(96)+B(95)+B(94)+B(91)+B(90)+B(89)+B(86)+B(82)+B(81)+B(78)+
-          B(77)+B(76)+B(75)+B(74)+B(73)+B(70)+B(67)+B(66), B(63)+B(61)+
-          B(59)+B(57)+B(56)+B(55)+B(53)+B(52)+B(51)+B(50)+B(47)+B(45)+
-          B(42)+B(40)+B(37)+B(35)+B(32)+B(30)+B(29)+B(25)+B(22)+B(21)+
-          B(20)+B(19)+B(16)+B(15)+B(14)+B(12)+B(8)+B(5)+B(0), 117),
- kDefPoly(B(117)+B(113)+B(110)+B(108)+B(105)+B(104)+B(103)+B(102)+B(99)+
-          B(98)+B(97)+B(94)+B(93)+B(91)+B(90)+B(89)+B(85)+B(84)+B(82)+
-          B(81)+B(79)+B(78)+B(77)+B(74)+B(73)+B(69)+B(67)+B(64), B(63)+
-          B(62)+B(61)+B(57)+B(55)+B(51)+B(50)+B(46)+B(45)+B(43)+B(42)+
-          B(41)+B(37)+B(33)+B(32)+B(30)+B(27)+B(26)+B(21)+B(19)+B(18)+
-          B(17)+B(15)+B(14)+B(12)+B(10)+B(8)+B(7)+B(3)+B(2)+B(1)+
-          B(0), 118),
- kDefPoly(B(118)+B(111)+B(109)+B(107)+B(106)+B(105)+B(104)+B(101)+B(99)+
-          B(98)+B(97)+B(94)+B(92)+B(91)+B(89)+B(83)+B(82)+B(80)+B(79)+
-          B(67)+B(66), B(62)+B(61)+B(60)+B(58)+B(57)+B(52)+B(48)+B(46)+
-          B(44)+B(42)+B(40)+B(39)+B(38)+B(36)+B(34)+B(33)+B(32)+B(29)+
-          B(23)+B(22)+B(20)+B(19)+B(18)+B(15)+B(13)+B(12)+B(11)+B(6)+B(5)+
-          B(4)+B(3)+B(1)+B(0), 119),
- kDefPoly(B(116)+B(115)+B(113)+B(112)+B(110)+B(107)+B(106)+B(104)+B(103)+
-          B(101)+B(100)+B(99)+B(98)+B(90)+B(89)+B(88)+B(87)+B(82)+B(80)+
-          B(79)+B(77)+B(76)+B(75)+B(74)+B(73)+B(71)+B(70)+B(68)+B(65)+
-          B(64), B(63)+B(62)+B(59)+B(55)+B(54)+B(48)+B(47)+B(45)+B(44)+
-          B(40)+B(39)+B(38)+B(35)+B(33)+B(29)+B(27)+B(26)+B(25)+B(24)+
-          B(23)+B(22)+B(21)+B(18)+B(17)+B(15)+B(13)+B(12)+B(10)+B(8)+B(3)+
-          B(2)+B(0), 120),
- kDefPoly(B(118)+B(117)+B(114)+B(113)+B(112)+B(110)+B(109)+B(104)+B(103)+
-          B(101)+B(99)+B(97)+B(96)+B(95)+B(93)+B(92)+B(91)+B(90)+B(89)+
-          B(87)+B(85)+B(84)+B(82)+B(81)+B(79)+B(73)+B(72)+B(68)+B(67)+
-          B(66)+B(64), B(60)+B(58)+B(57)+B(56)+B(54)+B(53)+B(52)+B(51)+
-          B(49)+B(48)+B(47)+B(45)+B(44)+B(38)+B(37)+B(36)+B(35)+B(33)+
-          B(32)+B(31)+B(30)+B(27)+B(26)+B(24)+B(23)+B(22)+B(20)+B(19)+
-          B(18)+B(16)+B(15)+B(12)+B(6)+B(5)+B(4)+B(2)+B(0), 121),
- kDefPoly(B(121)+B(118)+B(114)+B(112)+B(109)+B(106)+B(103)+B(102)+B(101)+
-          B(100)+B(97)+B(95)+B(90)+B(89)+B(87)+B(83)+B(81)+B(80)+B(79)+
-          B(78)+B(77)+B(76)+B(75)+B(74)+B(72)+B(71)+B(70)+B(69)+B(68)+
-          B(66)+B(64), B(61)+B(57)+B(51)+B(50)+B(47)+B(46)+B(43)+B(39)+
-          B(38)+B(37)+B(36)+B(34)+B(33)+B(32)+B(30)+B(28)+B(27)+B(24)+
-          B(22)+B(20)+B(18)+B(17)+B(14)+B(12)+B(11)+B(9)+B(7)+B(2)+
-          B(0), 122),
- kDefPoly(B(122)+B(121)+B(120)+B(119)+B(118)+B(117)+B(116)+B(113)+B(112)+
-          B(111)+B(109)+B(106)+B(105)+B(103)+B(100)+B(98)+B(97)+B(95)+
-          B(93)+B(92)+B(90)+B(87)+B(86)+B(85)+B(83)+B(81)+B(78)+B(77)+
-          B(75)+B(74)+B(73)+B(72)+B(71)+B(70)+B(69)+B(68)+B(67)+B(65)+
-          B(64), B(63)+B(62)+B(60)+B(55)+B(52)+B(51)+B(49)+B(47)+B(45)+
-          B(43)+B(42)+B(41)+B(37)+B(36)+B(35)+B(34)+B(32)+B(28)+B(27)+
-          B(26)+B(24)+B(23)+B(21)+B(20)+B(16)+B(13)+B(10)+B(9)+B(8)+B(7)+
-          B(5)+B(2)+B(0), 123),
- kDefPoly(B(123)+B(121)+B(120)+B(118)+B(117)+B(116)+B(115)+B(112)+B(111)+
-          B(110)+B(109)+B(107)+B(104)+B(102)+B(101)+B(100)+B(99)+B(98)+
-          B(97)+B(94)+B(90)+B(87)+B(86)+B(84)+B(83)+B(82)+B(79)+B(75)+
-          B(72)+B(71)+B(70)+B(64), B(63)+B(56)+B(54)+B(51)+B(50)+B(47)+
-          B(45)+B(44)+B(42)+B(39)+B(38)+B(36)+B(34)+B(33)+B(29)+B(26)+
-          B(24)+B(20)+B(16)+B(14)+B(11)+B(10)+B(8)+B(7)+B(6)+B(4)+B(2)+
-          B(0), 124),
- kDefPoly(B(124)+B(123)+B(121)+B(119)+B(118)+B(116)+B(115)+B(114)+B(107)+
-          B(105)+B(104)+B(103)+B(102)+B(99)+B(98)+B(96)+B(94)+B(93)+B(89)+
-          B(83)+B(82)+B(81)+B(80)+B(79)+B(78)+B(75)+B(74)+B(73)+B(72)+
-          B(70)+B(69)+B(68)+B(64), B(63)+B(59)+B(56)+B(55)+B(52)+B(51)+
-          B(50)+B(49)+B(48)+B(44)+B(42)+B(38)+B(37)+B(36)+B(33)+B(31)+
-          B(29)+B(27)+B(26)+B(25)+B(23)+B(21)+B(19)+B(18)+B(16)+B(14)+
-          B(11)+B(8)+B(7)+B(6)+B(4)+B(1)+B(0), 125),
- kDefPoly(B(124)+B(122)+B(121)+B(120)+B(119)+B(117)+B(113)+B(110)+B(108)+
-          B(105)+B(103)+B(102)+B(101)+B(97)+B(93)+B(91)+B(90)+B(88)+B(86)+
-          B(84)+B(82)+B(81)+B(79)+B(77)+B(76)+B(75)+B(73)+B(72)+B(71)+
-          B(69)+B(67)+B(64), B(63)+B(62)+B(61)+B(60)+B(58)+B(56)+B(55)+
-          B(52)+B(51)+B(48)+B(47)+B(45)+B(44)+B(42)+B(41)+B(40)+B(39)+
-          B(37)+B(33)+B(32)+B(30)+B(29)+B(28)+B(27)+B(26)+B(25)+B(24)+
-          B(23)+B(19)+B(18)+B(17)+B(16)+B(14)+B(13)+B(11)+B(9)+B(8)+B(7)+
-          B(4)+B(2)+B(1)+B(0), 126),
- kDefPoly(B(125)+B(124)+B(121)+B(116)+B(115)+B(105)+B(103)+B(101)+B(94)+
-          B(93)+B(91)+B(90)+B(88)+B(87)+B(86)+B(85)+B(77)+B(73)+B(72)+
-          B(70)+B(68)+B(67), B(63)+B(62)+B(61)+B(59)+B(57)+B(53)+B(52)+
-          B(51)+B(49)+B(48)+B(46)+B(44)+B(41)+B(39)+B(38)+B(36)+B(35)+
-          B(30)+B(27)+B(25)+B(23)+B(20)+B(19)+B(13)+B(12)+B(11)+B(10)+B(8)+
-          B(7)+B(5)+B(4)+B(3)+B(2)+B(0), 127),
- kDefPoly(B(127)+B(122)+B(121)+B(118)+B(117)+B(116)+B(109)+B(108)+B(107)+
-          B(106)+B(104)+B(103)+B(102)+B(101)+B(96)+B(93)+B(92)+B(91)+B(89)+
-          B(86)+B(85)+B(80)+B(78)+B(77)+B(76)+B(75)+B(74)+B(73)+B(72)+
-          B(71)+B(66), B(60)+B(56)+B(53)+B(52)+B(50)+B(47)+B(45)+B(41)+
-          B(39)+B(38)+B(37)+B(35)+B(34)+B(33)+B(30)+B(28)+B(25)+B(24)+
-          B(23)+B(21)+B(20)+B(19)+B(14)+B(13)+B(10)+B(8)+B(5)+B(4)+B(2)+
-          B(1)+B(0), 128),
-};
-// lint -restore
-
-// The number of polynomials in POLYS[].
-SELECTANY const int CRC::N_POLYS = sizeof (poly_list) / sizeof (poly_list[0]);
-
-// The externally visible name of poly_list.
-// This guarantees that the size of poly_list is opaque.
-SELECTANY const struct CRC::Poly *const CRC::POLYS = poly_list;
-
-// The "constructor" for a CRC with an default polynomial.
-CRC *CRC::Default(int degree, size_t roll_length) {
-  ASSERT1(32 == degree);
-
-  CRC *crc = CRCImpl::NewInternal(CRC::POLYS[degree].lo, CRC::POLYS[degree].hi,
-                                  degree, roll_length);  // Build the table
-  return crc;
-}
-
-// The "constructor" for a CRC with an arbitrary polynomial.
-CRC *CRC::New(uint64 lo, uint64 hi, int degree, size_t roll_length) {
-  return CRCImpl::NewInternal(lo, hi, degree, roll_length);
-}
-
-// Internal version of the "constructor".
-CRCImpl *CRCImpl::NewInternal(uint64 lo, uint64 hi,
-                             int degree, size_t roll_length) {
-  ASSERT1(8 <= degree && degree <= 64);  // precondition
-  ASSERT1(lo != 0 || hi != 0);            // precondition
-  // Generate the tables for extending a CRC by 4 bytes at a time.
-  // Why 4 and not 8?  Because Pentium 4 has such small caches.
-  struct CRC_pair t[4][256];
-  for (int j = 0; j != 4; j++) {      // for each byte of extension....
-    t[j][0].lo = 0;                   // a zero has no effect
-    t[j][0].hi = 0;
-    for (int i = 128; i != 0;  i >>= 1) {  // fill in entries for powers of 2
-      if (j == 0 && i == 128) {
-        t[j][i].lo = lo;  // top bit in first byte is easy---it's the polynomial
-        t[j][i].hi = hi;
-      } else {
-                  // each successive power of two is derive from the previous
-                  // one, either in this table, or the last table
-        struct CRC_pair pred;
-        if (i == 128) {
-          pred = t[j-1][1];
-        } else {
-          pred = t[j][i << 1];
-        }
-        // Advance the CRC by one bit (multiply by X, and take remainder
-        // through one step of polynomial long division)
-        if (pred.lo & 1) {
-          t[j][i].lo = (pred.lo >> 1) ^ (pred.hi << 63) ^ lo;
-          t[j][i].hi = (pred.hi >> 1) ^ hi;
-        } else {
-          t[j][i].lo = (pred.lo >> 1) ^ (pred.hi << 63);
-          t[j][i].hi = pred.hi >> 1;
-        }
-      }
-    }
-    // CRCs have the property that CRC(a xor b) == CRC(a) xor CRC(b)
-    // so we can make all the tables for non-powers of two by
-    // xoring previously created entries.
-    for (int i = 2; i != 256;  i <<= 1) {
-      for (int k = i+1; k != (i << 1); k++) {
-        t[j][k].lo = t[j][i].lo ^ t[j][k-i].lo;
-        t[j][k].hi = t[j][i].hi ^ t[j][k-i].hi;
-      }
-    }
-  }
-
-  // Copy the newly built tables in t[] into an appropriate
-  // CRC implenentation object.
-  CRCImpl *result = 0;
-  CRC32 *crc32 = 0;
-  crc32 = new CRC32();
-  for (int i = 0; i != 256; i++) {
-    crc32->table0_[i] = static_cast<uint32>(t[0][i].lo);
-    crc32->table1_[i] = static_cast<uint32>(t[1][i].lo);
-    crc32->table2_[i] = static_cast<uint32>(t[2][i].lo);
-    crc32->table3_[i] = static_cast<uint32>(t[3][i].lo);
-  }
-  result = crc32;
-
-  // "result" is now a CRC object of the right type to handle
-  // the polynomial of the right degree.
-
-  result->roll_length_ = roll_length;
-  result->degree_ = degree;
-  result->poly_lo_ = lo;
-  result->poly_hi_ = hi;
-
-  // Build the table for extending by zeroes.
-  // Entry i=a-1+3*b (a in {1, 2, 3}, b in {0, 1, 2, 3, ...}
-  // contains a polynomial Pi such that multiplying
-  // a CRC by Pi mod P, where P is the CRC polynomial, is equivalent to
-  // appending a*2**(2*b+SMALL_BITS) zero bytes to the original string.
-  // Entry is generated by calling ExtendByZeroes() twice using
-  // half the length from the previous entry.
-  int pos = 0;
-  for (uint64 inc_len = (1 << SMALL_BITS); inc_len != 0; inc_len <<= 2) {
-    result->Empty(&lo, &hi);
-    for (int k = 0; k != 3; k++) {
-      result->ExtendByZeroes(&lo, &hi, (size_t) (inc_len >> 1));
-      result->ExtendByZeroes(&lo, &hi, (size_t) (inc_len >> 1));
-      crc32->zeroes_[pos] = static_cast<uint32>(lo);
-      pos++;
-    }
-  }
-
-  // Calculate the entries in the roll table, used for rolling checksums
-  // of a fixed length.
-  // Extend the powers of two in the one-byte extension table by the roll
-  // length.
-  int bit = 256;
-  do {
-    bit >>= 1;
-    result->ExtendByZeroes(&t[0][bit].lo, &t[0][bit].hi, roll_length);
-  } while (bit != 0);
-  // Calculate the non-powers of two using CRC(a xor b) == CRC(a) xor CRC(b)
-  for (int i = 2; i != 256;  i <<= 1) {
-    for (int j = i+1; j != (i << 1); j++) {
-      t[0][j].lo = t[0][i].lo ^ t[0][j-i].lo;
-      t[0][j].hi = t[0][i].hi ^ t[0][j-i].hi;
-    }
-  }
-  // Now xor the CRC of (binary) 100000001 followed by
-  // the roll length of zeroes.   This will be xored into every
-  // entry.   This will simultaneously roll out the CRC
-  // of the empty string that's been pushed one byte too far,
-  // and roll in the CRC of the empty string in the correct place again.
-  result->Empty(&lo, &hi);
-  const uint8 x = 0x80;
-  result->Extend(&lo, &hi, &x, 1);
-  result->ExtendByZeroes(&lo, &hi, roll_length);
-  for (int i = 0; i != 256; i++) {
-    t[0][i].lo ^= lo;
-    t[0][i].hi ^= hi;
-  }
-
-  // Put the roll table into the object.
-  for (int i = 0; i != 256; i++) {
-    crc32->roll_[i] = static_cast<uint32>(t[0][i].lo);
-  }
-
-  return result;
-}
-
-// The CRC of the empty string is always the CRC polynomial itself.
-void CRCImpl::Empty(uint64 *lo, uint64 *hi) const {
-  ASSERT1(hi);
-  ASSERT1(lo);
-
-  *lo = this->poly_lo_;
-  *hi = this->poly_hi_;
-}
-
-//  The 32-bit implementation
-
-void CRC32::Extend(uint64 *lo, uint64 *hi, const void *bytes, size_t length)
-                      const {
-  ASSERT1(hi);
-  ASSERT1(lo);
-
-  hi;   // unreferenced formal parameter
-
-  const uint8 *p = static_cast<const uint8 *>(bytes);
-  const uint8 *e = p + length;
-  uint32 l = static_cast<uint32>(*lo);
-  // point x at MIN(first 4-byte aligned byte in string, end of string)
-  const uint8 *x = p + ((zero_ptr - p) & 3);
-  if (x > e) {
-    x = e;
-  }
-  // Process bytes until finished or p is 4-byte aligned
-  while (p != x) {
-    int c = (l & 0xff) ^ *p++;
-    l = this->table0_[c] ^ (l >> 8);
-  }
-  // point x at MIN(last 4-byte aligned byte in string, end of string)
-  x = e - ((e - zero_ptr) & 3);
-  // Process bytes 4 at a time
-  while (p < x) {
-    uint32 c = l ^ *reinterpret_cast<const uint32*>(p);
-    p += 4;
-    l = this->table3_[c & 0xff] ^
-        this->table2_[(c >> 8) & 0xff] ^
-        this->table1_[(c >> 16) & 0xff] ^
-        this->table0_[c >> 24];
-  }
-
-  // Process the last few bytes
-  while (p != e) {
-    int c = (l & 0xff) ^ *p++;
-    l = this->table0_[c] ^ (l >> 8);
-  }
-  *lo = l;
-}
-
-void CRC32::ExtendByZeroes(uint64 *lo, uint64 *hi, size_t length) const {
-  ASSERT1(hi);
-  ASSERT1(lo);
-
-  // Process the low order SMALL_BITS of the length by simply
-  // using Extend() on an array of bytes that are zero.
-  int small_part = (length & ((1 << SMALL_BITS)-1));
-  if (small_part != 0) {
-    this->Extend(lo, hi, zeroes, small_part);
-  }
-  length >>= SMALL_BITS;
-  if (length != 0) {          // if the length was at least 2**SMALL_BITS
-    uint32 l = static_cast<uint32>(*lo);
-    uint32 onebit = 1;
-    onebit <<= this->degree_ - 1;
-    // For each pair of bits in length
-    // (after the low-oder bits have been removed)
-    // we lookup the appropriate polynomial in the zeroes_ array
-    // and do a polynomial long multiplication (mod the CRC polynomial)
-    // to extend the CRC by the appropriate number of bits.
-    for (int i = 0; length != 0; i += 3, length >>= 2) {
-      int c = length & 3;       // pick next two bits
-      if (c != 0) {             // if they are not zero,
-                                // multiply by entry in table
-        uint32 m = this->zeroes_[c+i-1];
-        uint32 result = 0;
-        for (uint32 one = onebit; one != 0; one >>= 1) {
-          if ((l & one) != 0) {
-            result ^= m;
-          }
-          if (m & 1) {
-            m = (m >> 1) ^ static_cast<uint32>(poly_lo_);
-          } else {
-            m = (m >> 1);
-          }
-        }
-        l = result;
-      }
-    }
-    *lo = l;
-  }
-}
-
-void CRC32::Roll(uint64 *lo, uint64 *hi, uint8 o_byte, uint8 i_byte) const {
-  ASSERT1(hi);
-  ASSERT1(lo);
-
-  hi;   // unreferenced formal parameter
-
-  uint32 l = static_cast<uint32>(*lo);
-  // Roll in i_byte and out o_byte
-  *lo = this->table0_[(l & 0xff) ^ i_byte] ^ (l >> 8) ^ this->roll_[o_byte];
-}
-
-}  // namespace omaha
-
diff --git a/base/crc.h b/base/crc.h
deleted file mode 100644
index 26abe59..0000000
--- a/base/crc.h
+++ /dev/null
@@ -1,140 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef _CRC_H_
-#define _CRC_H_
-
-#include "base/basictypes.h"
-
-namespace omaha {
-
-// This class implements CRCs (aka Rabin Fingerprints).
-// Treats the input as a polynomial with coefficients in Z(2),
-// and finds the remainder when divided by an irreducible polynomial
-// of the appropriate length.
-// It handles all CRC sizes from 8 to 128 bits.
-// The input string is prefixed with a "1" bit, and has "degree" "0" bits
-// appended to it before the remainder is found.   This ensures that
-// short strings are scrambled somewhat.
-
-// A polynomial is represented by the bit pattern formed by its coefficients,
-// but with the highest order bit not stored.
-// The highest degree coefficient is stored in the lowest numbered bit
-// in the the lowest adderessed byte.   Thus, in what follows,
-// the highest degree coeficient that is stored is in the low order bit
-// of "lo" or "*lo".
-
-// Typical usage:
-//
-// // prepare to do 32-bit CRCs using the default polynomial.  No rolling hash.
-// scoped_ptr<CRC> crc(CRC::Default(32, 0));
-// ...
-// uint64 lo;   // declare a lo,hi pair to hold the CRC
-// uint64 hi;
-// crc->Empty(&lo, &hi);      // Initialize to CRC of empty string
-// crc->Extend(&lo, &hi, "hello", 5);     // Get CRC of "hello"
-// ...
-//
-// // prepare to use a 32-bit rolling hash over 6 bytes
-// scoped_ptr<CRC> crc(CRC::Default(32, 6));
-// ...
-// uint64 lo;   // declare a lo,hi pair to hold the CRC
-// uint64 hi;
-// crc->Empty(&lo, &hi);      // Initialize to CRC of empty string
-// crc->Extend(&lo, &hi, data, 6);     // Get CRC of first 6 bytes
-// for (int i = 6; i != sizeof (data); i++) {
-//   crc->Roll(&lo, &hi, data[i-6], data[i]); // Move window by one byte
-//   // lo,hi is CRC of bytes data[i-5...i]
-// }
-// ...
-//
-
-class CRC {
-public:
- // Initialize all the tables for CRC's of a given bit length "degree"
- // using a default polynomial of the given length.
- //
- // The argument "roll_length" is used by subsequent calls to
- // Roll().
- // Returns a handle that MUST NOT be destroyed with delete.
- // The default polynomials are those in POLYS[8...128].
- // Handles returned by Default() MUST NOT be deleted.
- // Identical calls to Default() yield identical handles.
- static CRC *Default(int degree, size_t roll_length);
-
- // Initialize all the tables for CRC's of a given bit length "degree"
- // using an arbitrary CRC polynomial.
- // Normally, you would use Default() instead of New()---see above.
- //
- // Requires that "lo,hi" contain an irreducible polynomial of degree "degree"
- // Requires 8 <= degree && degree <= 128
- // Any irreducible polynomial of the correct degree will work.
- // See the POLYS array for suitable irredicible polynomials.
- //
- // The argument "roll_length" is used by subsequent calls to
- // Roll().
- // Each call to New() yeilds a pointer to a new object
- // that may be deallocated with delete.
- static CRC *New(uint64 lo, uint64 hi, int degree, size_t roll_length);
-
- virtual ~CRC();
-
- // Place the CRC of the empty string in "*lo,*hi"
- virtual void Empty(uint64 *lo, uint64 *hi) const = 0;
-
- // If "*lo,*hi" is the CRC of bytestring A, place the CRC of
- // the bytestring formed from the concatenation of A and the "length"
- // bytes at "bytes" into "*lo,*hi".
- virtual void Extend(/*INOUT*/ uint64 *lo, /*INOUT*/ uint64 *hi,
-                     const void *bytes, size_t length) const = 0;
-
- // Equivalent to Extend(lo, hi, bytes, length) where "bytes"
- // points to an array of "length" zero bytes.
- virtual void ExtendByZeroes(/*INOUT*/ uint64 *lo, /*INOUT*/ uint64 *hi,
-                             size_t length) const = 0;
-
- // If "*lo,*hi" is the CRC of a byte string of length "roll_length"
- // (which is an argument to New() and Default()) that consists of
- // byte "o_byte" followed by string S, set "*lo,*hi" to the CRC of
- // the string that consists of S followed by the byte "i_byte".
- virtual void Roll(/*INOUT*/ uint64 *lo, /*INOUT*/ uint64 *hi,
-                   uint8 o_byte, uint8 i_byte) const = 0;
-
- // POLYS[] is an array of valid triples that may be given to New()
- static const struct Poly {
-   uint64 lo;                      // first half suitable CRC polynomial
-   uint64 hi;                      // second half of suitable CRC polynomial
-   int degree;                     // degree of suitable CRC polynomial
- } *const POLYS;
- // It is guaranteed that no two entries in POLYS[] are identical,
- // that POLYS[i] cnotains a polynomial of degree i for 8 <= i <= 128,
- // that POLYS[0] and POLYS[1] contains polynomials of degree 32,
- // that POLYS[2] and POLYS[3] contains polynomials of degree 64,
- // that POLYS[4] and POLYS[5] contains polynomials of degree 96, and
- // that POLYS[6] and POLYS[7] contains polynomials of degree 128.
-
- static const int N_POLYS;         // Number of elements in POLYS array.
-
-protected:
- CRC();      // Clients may not call constructor;
-               // use Default() or New() instead.
-
-private:
- DISALLOW_EVIL_CONSTRUCTORS(CRC);
-};
-
-}  // namespace omaha
-
-#endif
diff --git a/base/debug.cc b/base/debug.cc
deleted file mode 100644
index b0b53bd..0000000
--- a/base/debug.cc
+++ /dev/null
@@ -1,1195 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Debug functions
-
-#include "omaha/base/debug.h"
-
-#include <dbghelp.h>
-#include <wtsapi32.h>
-#include <atlstr.h>
-#ifdef _DEBUG
-#include <atlcom.h>
-#define STRSAFE_NO_DEPRECATE
-#include <strsafe.h>
-#endif
-#include <stdlib.h>
-#include <signal.h>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/clipboard.h"
-#include "omaha/base/commontypes.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/const_addresses.h"
-#include "omaha/base/const_config.h"
-#include "omaha/base/const_debug.h"
-#include "omaha/base/const_timeouts.h"
-#include "omaha/base/file.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/module_utils.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/string.h"
-#include "omaha/base/system.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/time.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/base/vista_utils.h"
-
-namespace omaha {
-
-#ifdef _DEBUG
-#define kSprintfBuffers (100)  // number of buffers for SPRINTF
-#else
-#define kSprintfBuffers (3)  // number of buffers for SPRINTF
-#endif
-
-// pad SPRINTF buffer to check for overruns
-#if SHIPPING
-#define kSprintfBufferOverrunPadding 0
-#else  // !SHIPPING
-#ifdef DEBUG
-#define kSprintfBufferOverrunPadding 20000
-#else
-#define kSprintfBufferOverrunPadding 1024
-#endif  // DEBUG
-#endif  // SHIPPING
-
-#ifdef _DEBUG
-const TCHAR* const kErrorRequestToSendFormat =
-    _T("*** Please hit Ignore to continue and send error information to the ")
-    _T("%s team ***\n*** These details have been pasted to the clipboard ***");
-
-// Max length of report summary string.
-const int kMaxReportSummaryLen = 1024 * 100;
-#endif  // DEBUG
-
-#define kReportIdsLock kLockPrefix                                             \
-    _T("Report_Ids_Lock_57146B01-6A07-4b8d-A1D8-0C3AFC3B2F9B")
-
-SELECTANY bool g_always_assert = false;
-SELECTANY TCHAR *g_additional_status_ping_info = NULL;
-
-#define kSprintfMaxLen (1024 + 2)  // max length that wvsprintf writes is 1024
-static bool g_initialized_sprintf = false;
-static volatile LONG g_sprintf_interlock = 0;
-static int g_current_sprintf_buffer = 0;
-static TCHAR *g_sprintf_buffer = NULL;
-static TCHAR *g_sprintf_buffers[kSprintfBuffers];
-SELECTANY volatile LONG g_debugassertrecursioncheck = 0;
-static int g_total_reports = 0;
-
-SELECTANY ReportIds g_report_ids;
-
-// Builds a full path name out of the given filename. If the filename is
-// a relative path, it is appended to the debug directory. Otherwise, if the
-// filename is a full path, it returns it as the full debug filename.
-static CString MakeFullDebugFilename(const TCHAR *filename) {
-  CString full_name;
-  if (lstrlen(filename) <= 2 || filename[1] != _T(':')) {
-    full_name = GetDebugDirectory();
-    full_name += L"\\";
-  }
-  full_name += filename;
-  return full_name;
-}
-
-
-// Displays the assert box. Due to session isolation, MB_SERVICE_NOTIFICATION
-// flag does not work for Vista services. In this case, use WTS to display
-// a message box in the active console session.
-void ShowAssertDialog(const TCHAR *message, const TCHAR *title) {
-  int ret = 0;
-  OSVERSIONINFOEX osviex = {sizeof(OSVERSIONINFOEX), 0};
-  const bool is_vista_or_greater =
-     ::GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&osviex)) &&
-     osviex.dwMajorVersion >= 6;
-  bool is_system_process = false;
-  if (is_vista_or_greater &&
-      SUCCEEDED(IsSystemProcess(&is_system_process)) &&
-      is_system_process) {
-    DWORD session_id = System::WTSGetActiveConsoleSessionId();
-    if (session_id == kInvalidSessionId) {
-      session_id = WTS_CURRENT_SESSION;
-    }
-    DWORD response = 0;
-    ::WTSSendMessage(WTS_CURRENT_SERVER_HANDLE,
-                     session_id,
-                     const_cast<TCHAR*>(title),
-                     _tcslen(title) * sizeof(TCHAR),
-                     const_cast<TCHAR*>(message),
-                     _tcslen(message) * sizeof(TCHAR),
-                     MB_ABORTRETRYIGNORE | MB_ICONERROR,
-                     0,
-                     &response,
-                     true);
-    ret = response;
-  } else {
-    ret = ::MessageBoxW(NULL,
-                        message,
-                        title,
-                        MB_ABORTRETRYIGNORE |
-                        MB_ICONERROR        |
-                        MB_SERVICE_NOTIFICATION);
-  }
-
-  switch (ret) {
-    case IDABORT:
-      // Terminate the process if the user chose 'Abort'. Calling ExitProcess
-      // here results in calling the destructors for static objects which can
-      // result in deadlocks.
-      raise(SIGABRT);
-      break;
-
-    case IDRETRY:
-      // Break if the user chose "Retry".
-      __debugbreak();
-      break;
-    default:
-      // By default we ignore the message.
-      break;
-  }
-}
-
-DebugObserver* g_debug_observer = NULL;
-
-// replaces the debug observer, returns the previous value.
-DebugObserver* SetDebugObserver(DebugObserver* observer) {
-  DebugObserver* old_value = g_debug_observer;
-  g_debug_observer = observer;
-  return old_value;
-}
-
-DebugObserver* PeekDebugObserver() {
-  return g_debug_observer;
-}
-
-int SehSendMinidump(unsigned int code,
-                    struct _EXCEPTION_POINTERS *ep,
-                    time64 time_between_minidumps) {
-    if (code == EXCEPTION_BREAKPOINT)
-    return EXCEPTION_CONTINUE_SEARCH;
-
-  if (::IsDebuggerPresent())
-    return EXCEPTION_CONTINUE_SEARCH;
-
-  OutputDebugString(L"**SehSendMinidump**\r\n");
-
-  if (g_debug_observer) {
-    return g_debug_observer->SehSendMinidump(code, ep, time_between_minidumps);
-  }
-
-  return EXCEPTION_EXECUTE_HANDLER;
-}
-
-#if defined(_DEBUG) || defined(ASSERT_IN_RELEASE)
-CallInterceptor<DebugAssertFunctionType> debug_assert_interceptor;
-
-// Replaces the debug assert function; returns the old value.
-DebugAssertFunctionType* ReplaceDebugAssertFunction(
-    DebugAssertFunctionType* replacement) {
-  return debug_assert_interceptor.ReplaceFunction(replacement);
-}
-
-void OnAssert(const char *expr, const TCHAR *msg,
-              const char *filename, int32 linenumber) {
-  if (g_debug_observer) {
-    g_debug_observer->OnAssert(expr, msg, filename, linenumber);
-  }
-}
-#endif
-
-#if defined(_DEBUG)
-CString OnDebugReport(uint32 id,
-                      bool is_report,
-                      ReportType type,
-                      const char *expr,
-                      const TCHAR *message,
-                      const char *filename,
-                      int32 linenumber,
-                      DebugReportKind debug_report_kind) {
-  CString trace;
-  if (g_debug_observer) {
-    trace = g_debug_observer->OnDebugReport(id, is_report,
-                                            type, expr, message, filename,
-                                            linenumber, debug_report_kind);
-  }
-  return trace;
-}
-
-void SendExceptionReport(const TCHAR *log_file, const TCHAR *filename, int line,
-                         const TCHAR *type, uint32 id, bool offline) {
-  if (g_debug_observer) {
-    g_debug_observer->SendExceptionReport(log_file, filename, line,
-                                          type, id, offline);
-  }
-}
-#endif
-
-
-#ifdef _DEBUG  // won't compile since _CrtDbgReport isn't defined.
-
-#include <crtdbg.h>    // NOLINT
-static CString g_report_summary;
-
-// dump summary of reports on exit
-SELECTANY ReportSummaryGenerator g_report_summary_generator;
-
-ReportSummaryGenerator::~ReportSummaryGenerator() {
-  DumpReportSummary();
-}
-
-void ReportSummaryGenerator::DumpReportSummary() {
-  if (g_total_reports) {
-    ::OutputDebugString(L"REPORT SUMMARY:\r\n");
-    ::OutputDebugString(SPRINTF(L"%d total reports\r\n", g_total_reports));
-    ::OutputDebugString(g_report_summary);
-  } else {
-    ::OutputDebugString(L"NO REPORTS!!\r\n");
-  }
-}
-
-TCHAR *ReportSummaryGenerator::GetReportSummary() {
-  TCHAR *s = new TCHAR[kMaxReportSummaryLen];
-  if (s) {
-    s[0] = 0;
-    if (g_total_reports) {
-      SafeStrCat(s, L"REPORT SUMMARY:\r\n\r\n", kMaxReportSummaryLen);
-      SafeStrCat(s,
-                 SPRINTF(L"%d total reports\r\n\r\n", g_total_reports),
-                 kMaxReportSummaryLen);
-      SafeStrCat(s,
-                 g_report_summary.
-                     Left(kMaxReportSummaryLen - lstrlen(s) - 1).GetString(),
-                 kMaxReportSummaryLen);
-      CString report_string = g_report_ids.DebugReportString();
-      ReplaceCString(report_string, L"&", L"\r\n");
-      SafeStrCat(s,
-                 report_string.
-                     Left(kMaxReportSummaryLen - lstrlen(s) - 1).GetString(),
-                 kMaxReportSummaryLen);
-    } else {
-      SafeStrCat(s, L"NO REPORTS!!\r\n", kMaxReportSummaryLen);
-    }
-  }
-
-  return s;
-}
-
-static CAtlMap<CString, uint32> g_reports_done;
-
-#endif  // _DEBUG
-
-#ifdef _DEBUG
-
-void TraceError(DWORD error) {
-  HLOCAL mem = NULL;
-  ::FormatMessage(
-    FORMAT_MESSAGE_ALLOCATE_BUFFER |
-    FORMAT_MESSAGE_FROM_SYSTEM |
-    FORMAT_MESSAGE_IGNORE_INSERTS,
-    static_cast<LPVOID>(_AtlBaseModule.GetResourceInstance()),
-    error,
-    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),  // default language
-    reinterpret_cast<TCHAR*>(&mem),
-    0,
-    NULL);
-
-  TCHAR* str = reinterpret_cast<TCHAR*>(::LocalLock(mem));
-  ::OutputDebugString(str);
-  REPORT(false, R_ERROR, (str), 3968294226);
-  ::LocalFree(mem);
-}
-
-// ban ASSERT/VERIFY/REPORT to prevent recursion
-#undef ASSERT
-#undef VERIFY
-#undef REPORT
-
-// TODO(omaha): fix static initialization order below.
-// The initialization order of static variables is not deterministic per C++
-// standard and it depends completely on the compiler implementation.
-// For VC++ compiler we are using, it seems to work as expected.
-// One real fix is to put all definitons of static variables inside a class and
-// define a boolean variable in this class to indicate that all necessary
-// static initializations have been done.
-//
-// The follow definition is used to detect whether we get the exception
-// during initializing static variables. If this is the case, DebugReport()
-// will not function and will throw an exception because some of its refering
-// static variables are not initialized yet (i.e. g_reports_done).
-const int kTestInitStaticVariablesDoneValue = 1234;
-struct TestInitStaticVariablesDone {
-  int value;
-  TestInitStaticVariablesDone() : value(kTestInitStaticVariablesDoneValue) {}
-};
-static TestInitStaticVariablesDone test_var;
-
-bool DebugReport(unsigned int id,
-                 ReportType type,
-                 const char *expr,
-                 const TCHAR *message,
-                 const char *filename,
-                 int linenumber,
-                 DebugReportKind debug_report_kind) {
-  int recursion_count = ::InterlockedIncrement(&g_debugassertrecursioncheck);
-  ON_SCOPE_EXIT(::InterlockedDecrement, &g_debugassertrecursioncheck);
-  if (recursion_count > 1) {
-    ::OutputDebugString(_T("recursive debugreport skipped\n"));
-    return 1;
-  }
-
-  if (debug_assert_interceptor.interceptor()) {
-    // call replacement function (typically used for unit tests)
-    // Note that I'm doing this inside the in_assert block for paranoia;
-    // it's not really necessary and perhaps the wrong choice.
-    debug_assert_interceptor.interceptor()(expr, CT2A(message), filename,
-                                            linenumber);
-    return true;
-  }
-
-
-  // Check whether we have already finished initializing all static variables
-  // needed for executing DebugReport(). If not, bail out.
-  if (test_var.value != kTestInitStaticVariablesDoneValue) {
-    CString debug_msg;
-    SafeCStringFormat(&debug_msg, _T("%hs:%d - %s - %S"),
-                      filename, linenumber, message, expr);
-    debug_msg.Append(_T("\n\nException occurs while initializing ")
-                     _T("static variables needed for DebugReport"));
-    ShowAssertDialog(debug_msg, _T("DebugReport"));
-    return true;
-  }
-
-  bool is_assert = debug_report_kind == DEBUGREPORT_ASSERT;
-  bool is_report = debug_report_kind == DEBUGREPORT_REPORT;
-  bool is_abort  = debug_report_kind == DEBUGREPORT_ABORT;
-
-  if (is_report)
-    g_total_reports++;
-
-  g_report_ids.ReleaseReport(id);
-
-  if (type == R_FATAL) {
-    if (is_report) {
-      // Treat as ASSERT
-      is_report = false;
-      is_assert = true;
-    }
-  }
-
-  bool always_assert = g_always_assert;
-
-  if (always_assert) {
-    is_report = false;
-    is_assert = true;
-  }
-
-  if (!message) {
-    message = _T("");
-  }
-
-  // log to debugger
-  TCHAR *debug_string;
-  // ::OutputDebugString(DEBUG_LOG_SEPARATOR);
-  ::OutputDebugString(is_report ? _T("REPORT: ") :
-                                  (is_assert ? _T("ASSERT: ") : _T("ABORT: ")));
-
-  CFixedStringT<CString, 1024> proc_name = app_util::GetAppName();
-
-  // last %s now %s skip %d
-  const TCHAR* format = message && *message ?
-                        _T("[%hs:%d][%hs][%s]") : _T("[%hs:%d][%hs]");
-  debug_string = SPRINTF(format, filename, linenumber, expr, message);
-
-  // String_Int64ToString(g_last_report_time, 10),
-  // String_Int64ToString(time, 10), skip_report));
-
-  // ::OutputDebugString(DEBUG_LOG_SEPARATOR);
-  // ::OutputDebugString(_T("\n"));
-
-#ifdef LOGGING
-  // Log the reports via the logging system to all loggers.
-  CString what = is_report ? _T("REPORT") :
-                             is_assert ? _T("ASSERT") : _T("ABORT");
-  LC_LOG(LC_LOGGING, LEVEL_ERROR, (_T("[%s]%s"), what, debug_string));
-#else
-  ::OutputDebugString(debug_string);
-  ::OutputDebugString(_T("\n"));
-#endif
-
-  // skip sending strack trace for duplicate reports
-  CString report_id;
-  SafeCStringFormat(&report_id, _T("%hs:%d"), filename, linenumber);
-
-  uint32 prev_reports = 0;
-  if (g_reports_done.Lookup(report_id, prev_reports) && is_report) {
-    prev_reports++;
-    g_reports_done.SetAt(report_id, prev_reports);
-    ::OutputDebugString(SPRINTF(_T("skipping duplicate report %s %d\n"),
-                                report_id.GetString(),
-                                prev_reports));
-    return 1;
-  }
-
-  prev_reports++;
-  g_reports_done.SetAt(report_id, prev_reports);
-
-  g_report_summary.Append(debug_string);
-  g_report_summary.Append(L" (");
-  g_report_summary.Append(itostr(id));
-  g_report_summary.Append(L")");
-  g_report_summary.Append(L"\r\n");
-
-  // ::OutputDebugString(_T("log to file\n"));
-
-  // log to file
-  CString path_name(MakeFullDebugFilename(kCiDebugLogFile));
-  HANDLE h = CreateFile(path_name,
-                        GENERIC_WRITE | GENERIC_READ,
-                        FILE_SHARE_READ | FILE_SHARE_WRITE,
-                        NULL,
-                        OPEN_ALWAYS,
-                        FILE_ATTRIBUTE_NORMAL,
-                        NULL);
-
-  HANDLE assert_file = INVALID_HANDLE_VALUE;
-  if (is_assert) {
-    path_name = MakeFullDebugFilename(kCiAssertOccurredFile);
-    assert_file = CreateFile(path_name,
-                             GENERIC_WRITE,
-                             0,
-                             0,
-                             OPEN_ALWAYS,
-                             FILE_FLAG_WRITE_THROUGH,
-                             NULL);
-  }
-
-  HANDLE abort_file = INVALID_HANDLE_VALUE;
-  if (is_abort) {
-    path_name = MakeFullDebugFilename(kCiAbortOccurredFile);
-    abort_file = CreateFile(path_name,
-                            GENERIC_WRITE,
-                            0,
-                            0,
-                            OPEN_ALWAYS,
-                            FILE_FLAG_WRITE_THROUGH,
-                            NULL);
-  }
-
-  if (h != INVALID_HANDLE_VALUE ||
-      assert_file != INVALID_HANDLE_VALUE ||
-      abort_file != INVALID_HANDLE_VALUE) {
-    // more convenient for now to have this in UTF8
-    char *utf8_buffer = new char[(lstrlen(debug_string)*2) + 1];
-    if (utf8_buffer) {
-        int conv_bytes = WideCharToMultiByte(CP_UTF8,
-                                             0,
-                                             debug_string,
-                                             lstrlen(debug_string),
-                                             utf8_buffer,
-                                             (lstrlen(debug_string) * 2) + 1,
-                                             NULL,
-                                             NULL);
-
-        if (conv_bytes) {
-            DWORD bytes_written;
-            BOOL result;
-
-            if (h != INVALID_HANDLE_VALUE) {
-              SetFilePointer(h, 0, NULL, FILE_END);
-              result = ::WriteFile(h,
-                                   (LPCVOID)utf8_buffer,
-                                   conv_bytes,
-                                   &bytes_written,
-                                   NULL);
-              result = ::WriteFile(h,
-                                   (LPCVOID)DEBUG_LOG_SEPARATOR_CHAR,
-                                   strlen(DEBUG_LOG_SEPARATOR_CHAR),
-                                   &bytes_written,
-                                   NULL);
-            }
-            if (assert_file != INVALID_HANDLE_VALUE) {
-              result = ::WriteFile(assert_file,
-                                   (LPCVOID)utf8_buffer,
-                                   conv_bytes,
-                                   &bytes_written,
-                                   NULL);
-            }
-            if (abort_file != INVALID_HANDLE_VALUE) {
-              result = ::WriteFile(abort_file,
-                                   (LPCVOID)utf8_buffer,
-                                   conv_bytes,
-                                   &bytes_written,
-                                   NULL);
-            }
-        }
-
-        delete [] utf8_buffer;
-    }
-  }
-
-  if (h != INVALID_HANDLE_VALUE) {
-    ::CloseHandle(h);
-  }
-  if (assert_file != INVALID_HANDLE_VALUE) {
-    ::CloseHandle(assert_file);
-  }
-  if (abort_file != INVALID_HANDLE_VALUE) {
-    ::CloseHandle(abort_file);
-  }
-
-  CString stack_trace = OnDebugReport(id, is_report, type, expr, message,
-                                      filename, linenumber, debug_report_kind);
-
-  if (is_report) {
-    return 1;
-  }
-
-  ::OutputDebugString(L"show assert dialog\r\n");
-  ::OutputDebugString(stack_trace.GetString());
-
-  CString process_path;
-  GetModuleFileName(NULL, &process_path);
-
-  static TCHAR clipboard_string[4096] = {0};
-  lstrcpyn(clipboard_string,
-           SPRINTF(L"%ls (pid=%i)\r\n%hs:%d\r\n\r\n%hs\r\n%s\r\n\r\n",
-                   process_path,
-                   ::GetCurrentProcessId(),
-                   filename,
-                   linenumber,
-                   expr,
-                   message),
-           arraysize(clipboard_string));
-  stack_trace = stack_trace.Left(
-      arraysize(clipboard_string) - lstrlen(clipboard_string) - 1);
-  SafeStrCat(clipboard_string, stack_trace, arraysize(clipboard_string));
-  SetClipboard(clipboard_string);
-
-  stack_trace = stack_trace.Left(kMaxStackTraceDialogLen);
-
-  CString assert_text;
-  SafeCStringFormat(&assert_text,
-    _T("Assertion (%ls) failed!\r\n\r\nProcess: %d ")
-    _T("(0x%08X)\r\nThread %d (0x%08X)\r\nProgram: %ls\r\n")
-    _T("Version: %s\r\nFile: %hs\r\nLine: %d\r\n\r\n"),
-    debug_report_kind == DEBUGREPORT_ASSERT ?
-      L"Assert" : (debug_report_kind == DEBUGREPORT_ABORT ?
-      L"Abort" : L"Report"),
-    ::GetCurrentProcessId(), ::GetCurrentProcessId(), ::GetCurrentThreadId(),
-    ::GetCurrentThreadId(), process_path, omaha::GetVersionString(), filename,
-    linenumber);
-
-  CString error_request_to_send;
-  SafeCStringFormat(&error_request_to_send, kErrorRequestToSendFormat, kAppName);
-
-  if (lstrlen(message) > 0) {
-    SafeCStringAppendFormat(&assert_text,
-        _T("Expression: %hs\r\nMessage: %s\r\n\r\n%s\r\n\r\n%s"),
-        expr,
-        message,
-        stack_trace,
-        error_request_to_send);
-  } else {
-    SafeCStringAppendFormat(&assert_text,
-        _T("Expression: %hs\r\n\r\n%s\r\n\r\n%s"),
-        expr, stack_trace, error_request_to_send);
-  }
-
-  ShowAssertDialog(assert_text, CString(filename));
-  return 1;
-}
-
-#endif  // #ifdef _DEBUG
-
-
-ReportIds::ReportIds() {
-  data_.report_counts_num = 0;
-  NamedObjectAttributes lock_attr;
-  GetNamedObjectAttributes(kReportIdsLock,
-                           vista_util::IsUserAdmin(),
-                           &lock_attr);
-  InitializeWithSecAttr(lock_attr.name, &lock_attr.sa);
-}
-
-ReportIds::~ReportIds() {
-  // don't attempt to write out reports from low integrity mode.
-  //
-  // TODO(omaha): save reports from a low integrity process (specifically IE
-  // which does some extra special magic to thwart this) --
-  // possible by launch a process or a broker, etc.
-  if (vista::IsProcessProtected()) {
-    return;
-  }
-
-  if (data_.report_counts_num != 0) {
-    // Back the report IDs to the registry
-    __mutexBlock(this) {
-      ReportData *reports_in_config = NULL;
-      if (LoadReportData(&reports_in_config)) {
-        MergeReports(reports_in_config, &data_);
-        SaveReportData(reports_in_config);
-
-        byte *data = reinterpret_cast<byte*>(reports_in_config);
-        delete [] data;
-      } else {
-        // There's no data in the registry, so just fill it up with this
-        // component's data.
-        SaveReportData(&data_);
-      }
-    }
-  }
-}
-
-const TCHAR* const GetRegKeyShared() {
-  return vista_util::IsUserAdmin() ? _T("HKLM\\") kCiRegKeyShared :
-                                     _T("HKCU\\") kCiRegKeyShared;
-}
-
-void ReportIds::ResetReportsAfterPing() {
-  // We will lose reports from TRS between the time DebugReportString was called
-  // and now. We'll also lose reports from non TRS components if they exit in
-  // between this time.  Not important.
-  data_.report_counts_num = 0;
-  __mutexBlock(this) {
-    RegKey::DeleteValue(GetRegKeyShared(), kRegValueReportIds);
-  }
-}
-
-void ReportIds::MergeReports(ReportData *data1, const ReportData *data2) {
-  // Loop through each report ID from data2.  If we find it already, increment
-  // the report's count in data1. Otherwise, if there's enough space, add the
-  // report ID to data1.
-  uint32 i, j;
-  for (i = 0; i < data2->report_counts_num; ++i) {
-    bool duplicate_report = false;
-    for (j = 0; j < data1->report_counts_num; ++j) {
-      if (data1->report_ids[j] == data2->report_ids[i]) {
-        // uint16 is promoted to int.
-        data1->report_counts[j] = static_cast<uint16>(
-            data1->report_counts[j] + data2->report_counts[i]);
-        duplicate_report = true;
-      }
-    }
-
-    if (!duplicate_report && j < kMaxUniqueReports) {
-      data1->report_ids[j] = data2->report_ids[i];
-      data1->report_counts[j] = data2->report_counts[i];
-      data1->report_counts_num++;
-    }
-  }
-}
-
-bool ReportIds::LoadReportData(ReportData **data) {
-  DWORD byte_count = 0;
-  *data = NULL;
-  HRESULT hr = RegKey::GetValue(GetRegKeyShared(),
-                                kRegValueReportIds,
-                                reinterpret_cast<byte**>(data),
-                                &byte_count);
-  if (SUCCEEDED(hr)) {
-    if (byte_count == sizeof(ReportData)) {
-      return true;
-    } else {
-      delete[] data;
-      data = NULL;
-      return false;
-    }
-  } else {
-    return false;
-  }
-}
-
-void ReportIds::SaveReportData(ReportData *data) {
-  if (data->report_counts_num) {
-    RegKey::SetValue(GetRegKeyShared(),
-                     kRegValueReportIds,
-                     reinterpret_cast<byte*>(data),
-                     sizeof(ReportData));
-  }
-}
-
-bool ReportIds::ReleaseReport(uint32 id) {
-  uint32 max = data_.report_counts_num;
-
-  // If two threads call simultaneously, might miss one of an existing report
-  // here; not important.
-
-  uint32 i = 0;
-  for (i = 0; i < max; ++i) {
-    if (data_.report_ids[i] == id) {
-      data_.report_counts[i]++;
-      return true;
-      }
-  }
-
-  // If two threads call simultaneously, might overwrite first of another
-  // report; not important.
-
-  if (i < kMaxUniqueReports) {
-    data_.report_ids[i] = id;
-    data_.report_counts[i] = 1;
-    data_.report_counts_num = i + 1;  // Set only after setting ids and count;
-                                      // don't use ++
-  }
-
-#ifdef _DEBUG
-  OutputDebugString(SPRINTF(_T("release report %u\n"), id));
-#endif
-  // must return true (return value of REPORT)
-  return true;
-}
-
-// caller deletes the string
-TCHAR *ReportIds::DebugReportString() {
-  TCHAR *s = new TCHAR[(kMaxUniqueReports * kMaxReportCountString) + 1];
-  if (!s) { return NULL; }
-  s[0] = '\0';
-
-#if 0
-  // this version if we use a hash table for the report counts:
-  uint32 id;
-  uint16 count;
-  hr = g_reports->First(&found, &id, &count);
-  while (SUCCEEDED(hr) && found) {
-    if (count) {
-        SafeCStringAppendFormat(&status_info, _T("%d=%d"),
-                                id,
-                                static_cast<uint32>(count));
-    }
-
-    hr = g_reports->Next(&found, &id, &count);
-  }
-#endif
-
-  // The registry will contain the REPORTs from other components, so get that
-  // list and merge it with TRS'.
-  __mutexBlock(this) {
-    ReportData *reports_in_config = NULL;
-    if (LoadReportData(&reports_in_config)) {
-      MergeReports(&data_, reports_in_config);
-
-      byte *data = reinterpret_cast<byte*>(reports_in_config);
-      delete[] data;
-    }
-  }
-
-  TCHAR *current_pos = s;
-  for (uint32 i = 0; i < data_.report_counts_num; i++) {
-    if (data_.report_counts[i]) {
-      // should be no chance of overflow, ok to use wsprintf
-      int n = wsprintf(current_pos,
-                       _T("%u:%u,"),
-                       data_.report_ids[i],
-                       static_cast<uint32>(data_.report_counts[i]));
-      current_pos += n;
-    }
-  }
-
-  return s;
-}
-
-// A simple helper function whose sole purpose is
-// to isolate the dtor from SPRINTF which uses try/except.
-// app_util::GetAppName returns a CString and dtor's
-// aren't allowed in functions with try/except when
-// the /EHsc flag is set.
-void FillInSprintfErrorString(const TCHAR * format, TCHAR * error_string) {
-  wsprintf(error_string, L"SPRINTF buffer overrun %ls %hs %ls",
-           app_util::GetAppName(), omaha::GetVersionString(), format);
-}
-
-// following is currently included in release build
-// return string from format+arglist; for debugging
-TCHAR * __cdecl SPRINTF(const TCHAR * format, ...) {
-  while (::InterlockedCompareExchange(&g_sprintf_interlock, 1, 0) == 1) {
-  // while (::InterlockedIncrement(&g_sprintf_interlock)>1) {
-    // ::InterlockedDecrement(&g_sprintf_interlock);
-    // Don't process APCs here.
-    // Can lead to infinite recursion, for example: filecap->logging->filecap...
-    Sleep(0);
-  }
-
-  g_current_sprintf_buffer++;
-  if (g_current_sprintf_buffer >= kSprintfBuffers) {
-    g_current_sprintf_buffer = 0;
-  }
-
-  TCHAR *sprintf_buf = NULL;
-
-  if (!g_initialized_sprintf) {  // initialize buffers
-    g_sprintf_buffer = new TCHAR[
-        ((kSprintfMaxLen + 1) * kSprintfBuffers) +
-        kSprintfBufferOverrunPadding];
-    TCHAR* buffer = g_sprintf_buffer;
-    if (!buffer) { goto cleanup; }
-    for (int i = 0; i < kSprintfBuffers; ++i) {
-      g_sprintf_buffers[i] = buffer;
-      buffer += kSprintfMaxLen + 1;
-    }
-
-#if !SHIPPING
-    for (int i = ((kSprintfMaxLen+1) * kSprintfBuffers);
-         i < ((kSprintfMaxLen + 1) * kSprintfBuffers) +
-            kSprintfBufferOverrunPadding;
-         ++i) {
-      g_sprintf_buffer[i] = 1;
-    }
-#endif
-
-    // InitializeCriticalSection(&g_sprintf_critical_section);
-    g_initialized_sprintf = true;
-  }
-
-  sprintf_buf = g_sprintf_buffers[g_current_sprintf_buffer];
-
-  // EnterCriticalSection(&g_sprintf_critical_section);
-
-  __try {
-    // create the formatted CString
-    va_list vl;
-    va_start(vl, format);
-#ifdef DEBUG
-    StringCbVPrintfW(sprintf_buf, kSprintfMaxLen, format, vl);
-#else
-    wvsprintfW(sprintf_buf, format, vl);
-#endif
-    va_end(vl);
-
-#if !SHIPPING
-    for (int i = ((kSprintfMaxLen+1) * kSprintfBuffers);
-         i < ((kSprintfMaxLen+1) * kSprintfBuffers) +
-            kSprintfBufferOverrunPadding;
-         ++i) {
-      if (g_sprintf_buffer[i] != 1) {
-        TCHAR error_string[1024];
-        FillInSprintfErrorString(format, error_string);
-        MessageBox(NULL,
-                   error_string,
-                   error_string,
-                   MB_OK | MB_SETFOREGROUND | MB_TOPMOST);
-        break;
-      }
-    }
-#endif
-  }
-  __except(EXCEPTION_EXECUTE_HANDLER) {
-    lstrcpyn(sprintf_buf, _T("sprintf failure"), kSprintfMaxLen);
-  }
-
-  // LeaveCriticalSection(&g_sprintf_critical_section);
-
-  cleanup:
-
-  ::InterlockedDecrement(&g_sprintf_interlock);
-  return sprintf_buf;
-}
-
-#if 0
-  TCHAR * __cdecl SPRINTF(const TCHAR * format, ...) {
-  ASSERT(format, (L""));
-
-  g_current_sprintf_buffer++;
-  if (g_current_sprintf_buffer >= kSprintfBuffers) {
-    g_current_sprintf_buffer = 0;
-    }
-
-  TCHAR *sprintf_buf = sprintf_buffers[g_current_sprintf_buffer];
-  CFixedStringT<CString, kSprintfMaxLen> out;
-
-  va_list argptr;
-  va_start(argptr, format);
-  out.FormatV(format, argptr);
-  va_end(argptr);
-
-  // copy to fixed return buffers
-  SafeStrCat(sprintf_buf,
-             out.GetBufferSetLength(kSprintfMaxLen),
-             g_current_sprintf_buffer);
-  sprintf_buf[kSprintfMaxLen] = '\0';
-
-  return sprintf_buf;
-}
-#endif
-
-// Cleanup allocated memory
-class SprintfCleaner {
- public:
-  SprintfCleaner() {}
-
-  ~SprintfCleaner() {
-    while (::InterlockedCompareExchange(&g_sprintf_interlock, 1, 0) == 1) {
-      Sleep(0);
-    }
-
-    if (g_initialized_sprintf) {
-      delete[] g_sprintf_buffer;
-      for (int i = 0; i < kSprintfBuffers; ++i) {
-        g_sprintf_buffers[i] = NULL;
-      }
-      g_initialized_sprintf = false;
-    }
-
-    ::InterlockedDecrement(&g_sprintf_interlock);
-  }
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(SprintfCleaner);
-};
-
-static SprintfCleaner cleaner;
-
-// This is for our testers to find asserts in release mode.
-#if !defined(_DEBUG) && defined(ASSERT_IN_RELEASE)
-bool ReleaseAssert(const char *expr,
-                   const TCHAR *msg,
-                   const char *filename,
-                   int32 linenumber) {
-  ASSERT(filename, (L""));
-  ASSERT(msg, (L""));
-  ASSERT(expr, (L""));
-
-  if (debug_assert_interceptor.interceptor()) {
-    // call replacement function (typically used for unit tests)
-    // Note that I'm doing this inside the in_assert block for paranoia;
-    // it's not really necessary and perhaps the wrong choice.
-    debug_assert_interceptor.interceptor()(expr,
-                                           CT2CA(msg),
-                                           filename,
-                                           linenumber);
-    return true;
-  }
-
-  OnAssert(expr, msg, filename, linenumber);
-
-  // Also put up a message box.
-  TCHAR error_string[1024] = {0};
-  wsprintf(error_string,
-           L"App: %ls\r\n"
-           L"Expr: %hs\r\n"
-           L"File: %hs\r\n"
-           L"Line: %d\r\n"
-           L"Version: %hs\r\n"
-           L"Message: ",
-           app_util::GetAppName(),
-           expr,
-           filename,
-           linenumber,
-           VER_TIMESTAMP_STR_FILE);
-  SafeStrCat(error_string, msg, arraysize(error_string));
-  SafeStrCat(error_string,
-             L"\r\n\r\n*** This message has been copied to the clipboard. ***",
-             arraysize(error_string));
-  SetClipboard(error_string);
-
-  TCHAR title_string[1024];
-  wsprintf(title_string, L"%s ASSERT %s %hs",
-           kAppName, app_util::GetAppName(), VER_TIMESTAMP_STR_FILE);
-  MessageBox(NULL,
-             error_string,
-             title_string,
-             MB_OK | MB_SETFOREGROUND | MB_TOPMOST);
-  return true;
-}
-#endif
-
-#if defined(_DEBUG)
-void DebugAbort(const TCHAR *msg,
-                const char* filename,
-                int32 linenumber,
-                bool do_abort) {
-  DebugReport(0, R_FATAL, "", msg, filename, linenumber, DEBUGREPORT_ABORT);
-  if (do_abort) {
-    abort();
-  }
-}
-#else
-void ReleaseAbort(const TCHAR *msg,
-                  const char* filename,
-                  int32 linenumber,
-                  bool do_abort) {
-  // Send info to the server.
-#if defined(ASSERT_IN_RELEASE)
-  OnAssert("", msg, filename, linenumber);
-#endif
-
-  // Also put up a message box.
-  TCHAR error_string[1024] = {0};
-  wsprintf(error_string,
-           L"App: %ls\r\n"
-           L"File: %hs\r\n"
-           L"Line: %d\r\n"
-           L"Version: %hs\r\n"
-           L"Message: ",
-           app_util::GetAppName(),
-           filename,
-           linenumber,
-           omaha::GetVersionString());
-  SafeStrCat(error_string, msg, arraysize(error_string));
-  SafeStrCat(error_string,
-             L"\r\n\r\n*** This message has been copied to the clipboard. ***",
-             arraysize(error_string));
-  SetClipboard(error_string);
-
-  TCHAR title_string[1024];
-  wsprintf(title_string,
-           L"%s ABORT %s %hs",
-           kAppName,
-           app_util::GetAppName(),
-           omaha::GetVersionString());
-  MessageBox(NULL,
-             error_string,
-             title_string,
-             MB_OK | MB_SETFOREGROUND | MB_TOPMOST);
-
-  if (do_abort) {
-    abort();
-  }
-}
-#endif
-
-
-#ifdef _DEBUG
-
-void DumpInterface(IUnknown* unknown) {
-  if (!unknown)
-    return;
-
-  OutputDebugString(_T("------------------------------------------------\r\n"));
-
-  // Open the HKCR\Interfaces key where the IIDs of marshalable interfaces
-  // are stored.
-  RegKey key;
-  if (SUCCEEDED(key.Open(HKEY_CLASSES_ROOT, _T("Interface"), KEY_READ))) {
-    TCHAR name[_MAX_PATH + 1] = {0};
-    DWORD name_size = _MAX_PATH;
-    DWORD index = 0;
-    FILETIME last_written;
-
-    //
-    // Enumerate through the IIDs and see if the object supports it
-    // by calling QueryInterface.
-    //
-    while (::RegEnumKeyEx(key.Key(),
-                          index++,
-                          name,
-                          &name_size,
-                          NULL,
-                          NULL,
-                          NULL,
-                          &last_written) == ERROR_SUCCESS) {
-      // Convert the string to an IID
-      IID iid;
-      HRESULT hr = StringToGuidSafe(name, &iid);
-
-      CComPtr<IUnknown> test;
-      if (unknown->QueryInterface(iid,
-                                  reinterpret_cast<void**>(&test)) == S_OK) {
-        //
-        // The object supports this interface.
-        // See if we can get a human readable name for the interface
-        // If not, the name buffer already contains the string
-        // representation of the IID, which we'll use as a fallback.
-        //
-        RegKey sub_key;
-        if (sub_key.Open(key.Key(), name, KEY_READ) == S_OK) {
-          scoped_array<TCHAR> display;
-          // If this fails, we should still have the IID
-          if (sub_key.GetValue(NULL, address(display)) == S_OK)
-            lstrcpyn(name, display.get(), _MAX_PATH);
-        }
-
-        CString fmt;
-        SafeCStringFormat(&fmt, _T("  %s\r\n"), name);
-        OutputDebugString(fmt);
-      }
-
-      ZeroMemory(name, arraysize(name));
-      name_size = _MAX_PATH;
-    }
-  }
-
-  OutputDebugString(_T("------------------------------------------------\r\n"));
-}
-#endif
-
-// TODO(omaha): the implementation below is using CStrings so it is not very
-// conservative in terms of memory allocations.
-int SehNoMinidump(unsigned int code, struct _EXCEPTION_POINTERS *,
-                  const char *filename, int32 linenumber, bool show_message) {
-  if (code == EXCEPTION_BREAKPOINT)
-    return EXCEPTION_CONTINUE_SEARCH;
-
-  uint32 latest_cl = 0;
-#ifdef VERSION_LATEST_CL
-  latest_cl = VERSION_LATEST_CL;
-#endif
-
-  if (show_message) {
-    TCHAR message[1025] = {0};
-    wsprintf(message,
-             _T("Exception %x in %s %s %u\r\n\r\n%hs:%d\r\n"),
-             code,
-             app_util::GetAppName(),
-             omaha::GetVersionString(),
-             latest_cl,
-             filename,
-             linenumber);
-
-    SetClipboard(message);
-    uint32 type = MB_ABORTRETRYIGNORE |
-                  MB_ICONERROR |
-                  MB_SERVICE_NOTIFICATION |
-                  MB_SETFOREGROUND |
-                  MB_TOPMOST;
-    int ret = ::MessageBox(NULL, message, _T("Exception"), type);
-    switch (ret) {
-      case IDABORT:
-        // Kamikaze if the user chose 'abort'
-        ::ExitProcess(static_cast<UINT>(-1));
-        break;
-
-      case IDRETRY:
-        // Break if the user chose "retry"
-        __debugbreak();
-        break;
-
-      default:
-        // By default we ignore the message
-      break;
-    }
-  }
-  return EXCEPTION_EXECUTE_HANDLER;
-}
-
-CString GetDebugDirectory() {
-  CString debug_dir;
-  CString system_drive = GetEnvironmentVariableAsString(_T("SystemDrive"));
-  if (!system_drive.IsEmpty()) {
-    debug_dir += system_drive;
-    debug_dir += L"\\";
-  }
-  debug_dir += kCiDebugDirectory;
-  return debug_dir;
-}
-
-}  // namespace omaha
-
diff --git a/base/debug.h b/base/debug.h
deleted file mode 100644
index 5566a0b..0000000
--- a/base/debug.h
+++ /dev/null
@@ -1,305 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Debug functions
-
-#ifndef OMAHA_BASE_DEBUG_H_
-#define OMAHA_BASE_DEBUG_H_
-
-// To create a release build with asserts turned on, uncomment the
-// following line, and uncomment the linking with atls.lib in api.
-//
-// #define ASSERT_IN_RELEASE
-
-#include "omaha/base/atlassert.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/time.h"
-
-namespace omaha {
-
-// hash table for counts of the number of times REPORTs occur
-// template<class K, class V>
-// class HashTable;
-// extern HashTable<uint32, uint16> *g_reports;
-
-#define kMaxUniqueReports (20)
-#define kMaxReportCountString (20)
-
-class ReportIds;
-extern ReportIds g_report_ids;
-extern volatile LONG g_debugassertrecursioncheck;
-extern bool g_always_assert;
-
-const int kMaxStackTraceDialogLen = 512;  // too long and dialog box fails
-
-// TODO(omaha): consider merging this into DebugObserver.
-//
-// For automated testing, we don't (always) want asserts to fire. So
-// we allow the unit test system to handle asserts instead.
-//
-// Give a function matching the prototype to REPLACE_ASSERT_FUNCTION to
-// have your function called instead of the normal assert function.
-typedef int DebugAssertFunctionType(const char *expression,
-  const char *message, const char *file, int line);
-
-enum ReportType;
-enum DebugReportKind;
-class DebugObserver {
- public:
-  virtual ~DebugObserver() {}
-  virtual int SehSendMinidump(unsigned int code, struct _EXCEPTION_POINTERS *ep,
-                              time64 time_between_minidumps) = 0;
-
-#if defined(_DEBUG) || defined(ASSERT_IN_RELEASE)
-  virtual void OnAssert(const char *expr, const TCHAR *msg,
-                        const char *filename, int32 linenumber) = 0;
-#endif
-
-#if defined(_DEBUG)
-  virtual void SendExceptionReport(const TCHAR *log_file, const TCHAR *filename,
-                                   int line, const TCHAR *type, uint32 id,
-                                   bool offline) = 0;
-  virtual CString OnDebugReport(uint32 id, bool is_report, ReportType type,
-                                const char *expr, const TCHAR *message,
-                                const char *filename, int32 linenumber,
-                                DebugReportKind debug_report_kind) = 0;
-#endif
-};
-
-// replaces the debug observer, returns the previous value.
-DebugObserver* SetDebugObserver(DebugObserver* observer);
-DebugObserver* PeekDebugObserver();
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int SehSendMinidump(unsigned int code,
-                    struct _EXCEPTION_POINTERS *ep,
-                    time64 time_between_minidumps);
-
-#define kMinReportInterval100ns (60 * kSecsTo100ns)
-#define kMinStackReportInterval100ns (60 * kSecsTo100ns)
-#define DEBUG_LOG_SEPARATOR_CHAR "-------------------------------------------\n"
-#define DEBUG_LOG_SEPARATOR     L"-------------------------------------------\n"
-#define kExceptionReportHeaders L"Content-Type: binary"
-
-#undef ASSERT
-#undef VERIFY
-#undef TRACE
-
-// Holds information about REPORTS and their frequency
-struct ReportData {
-  uint32 report_counts_num;
-  uint32 report_ids[kMaxUniqueReports];
-  uint16 report_counts[kMaxUniqueReports];
-};
-
-// Used to hold REPORT IDs and to back them to the registry, where they'll be
-// read and sent in a ping.
-class ReportIds : public GLock {
- public:
-  ReportIds();
-  ~ReportIds();
-
-  // Call this after a successful ping to clear the report IDs from the registry
-  // and from this component (TRS).
-  void ResetReportsAfterPing();
-
-  // Adds a report ID to our list, if there's enough space.
-  bool ReleaseReport(uint32 id);
-
-  // Creates a string with the report IDs and their frequency.
-  // Caller deletes string.
-  TCHAR *DebugReportString();
-
- private:
-  ReportData data_;
-
-  // Merges the report data from data2 with data1.
-  void MergeReports(ReportData *data1, const ReportData *data2);
-
-  // We have to use RegKey directly, because we can't depend on the global
-  // Config object during destruction.
-  bool LoadReportData(ReportData **data);
-  void SaveReportData(ReportData *data);
-
-  DISALLOW_EVIL_CONSTRUCTORS(ReportIds);
-};
-
-#if defined(_DEBUG) || defined(ASSERT_IN_RELEASE)
-  // Replaces the debug assert function; returns the old value.
-  DebugAssertFunctionType *ReplaceDebugAssertFunction(DebugAssertFunctionType
-                                                      *replacement);
-  #define REPLACE_ASSERT_FUNCTION(replacement) \
-      ReplaceDebugAssertFunction(replacement)
-#else
-  #define REPLACE_ASSERT_FUNCTION(replacement) NULL
-#endif
-
-#ifdef _DEBUG
-  void SendExceptionReport(const TCHAR *log_file,
-                           const TCHAR *filename,
-                           int line,
-                           const TCHAR *type,
-                           uint32 id,
-                           bool offline);
-
-  void SendStackTrace(const TCHAR *filename,
-                      int line,
-                      const TCHAR *type,
-                      bool all_threads,
-                      uint32 id);
-
-  // DEBUG MODE
-
-  extern bool g_LSPMode;
-
-  bool DebugReport(unsigned int id,
-                   ReportType type,
-                   const char *expr,
-                   const TCHAR *message,
-                   const char *filename,
-                   int linenumber,
-                   DebugReportKind debug_report_kind);
-
-  #define VERIFY(expr, msg) ASSERT(expr, msg)  // VERIFY is ASSERT
-
-  #define ASSERT(expr, msg)                                                    \
-      do {                                                                     \
-        ((expr) ? 0 : omaha::DebugReport(0, omaha::R_FATAL, #expr,             \
-          omaha::SPRINTF msg, __FILE__, __LINE__, omaha::DEBUGREPORT_ASSERT)); \
-      } while (0)
-
-  #define REPORT(expr, type, msg, id)                           \
-    ((expr) ? 0 : omaha::DebugReport(id,                        \
-                                     type,                      \
-                                     #expr,                     \
-                                     omaha::SPRINTF msg,        \
-                                     __FILE__,                  \
-                                     __LINE__,                  \
-                                     omaha::DEBUGREPORT_REPORT))
-  void DebugAbort(const TCHAR* msg,
-                  const char* filename,
-                  int32 linenumber,
-                  bool do_abort);
-  #define ABORT(msg)                                            \
-      omaha::DebugAbort(omaha::SPRINTF msg, __FILE__, __LINE__, true)
-
-  void TraceError(DWORD error);
-  inline void TraceLastError() { TraceError(GetLastError()); }
-
-  /**
-  * Iterates through HKEY_CLASSES_ROOT\Interface and calls QI for
-  * all the interfaces there.  Useful for finding out what type of
-  * object you're dealing with :-)
-  */
-  void DumpInterface(IUnknown* unknown);
-
-#else  // #ifdef _DEBUG
-
-  #ifdef ASSERT_IN_RELEASE
-    bool ReleaseAssert(const char *expr,
-                       const TCHAR *msg,
-                       const char *filename,
-                       int32 linenumber);
-    #define ASSERT(expr, msg) \
-        ((expr) ? 0 : ReleaseAssert(#expr, SPRINTF msg, __FILE__, __LINE__))
-  #else
-    #define ASSERT(expr, msg) 0
-  #endif
-
-  // VERIFY executes but does not check expression
-  #define VERIFY(expr, msg) \
-    do {                   \
-      (expr);              \
-    } while (0)
-  #define REPORT(expr, type, msg, id) \
-      ((expr) ? 0 : g_report_ids.ReleaseReport(id))
-  void ReleaseAbort(const TCHAR* msg,
-                    const char* filename,
-                    int32 linenumber,
-                    bool do_abort);
-  #define ABORT(msg) ReleaseAbort(SPRINTF msg, __FILE__, __LINE__, true)
-
-#endif  // #ifdef _DEBUG
-
-#define ASSERT1(expr) ASSERT(expr, (_T("")))
-#define VERIFY1(expr) VERIFY(expr, (_T("")))
-
-#ifdef __cplusplus
-}  // extern "C"{
-#endif
-
-#ifdef _DEBUG
-void ShowAssertDialog(const TCHAR *message, const TCHAR *title);
-
-// used to automatically dump the global summary of reports when the
-// program exits
-class ReportSummaryGenerator {
- public:
-  ReportSummaryGenerator() {}
-  // calls DumpReportSummary()
-  ~ReportSummaryGenerator();
-  // some programs exit without calling destructors, they can use this function
-  // to dump the report summary
-  void DumpReportSummary();
-  // get text summary of reports
-  // caller is responsible for deleting the string returned
-  TCHAR *GetReportSummary();
-  DISALLOW_EVIL_CONSTRUCTORS(ReportSummaryGenerator);
-};
-
-extern ReportSummaryGenerator g_report_summary_generator;
-#endif
-
-// return string from format+arglist; for debugging; not thread-safe
-TCHAR * __cdecl SPRINTF(const TCHAR * format, ...);
-bool DebugError(const char * expr,
-                const TCHAR * message,
-                const char * filename,
-                INT linenumber,
-                BOOL report_only);
-
-// shows an error dialog in DEBUG and when g_release_debug is true
-//
-// example usage:
-//
-//  __try {
-//    do something that sometimes causes a known exception (e.g.,
-//    calling third party code)
-//  } __except(SehNoMinidump(GetExceptionCode(), GetExceptionInformation(),
-//      __FILE__, __LINE__)) {
-//    REPORT(false, R_ERROR, (L"exception doing something"), 103178920);
-//  }
-// show_message - show an error dialog in DEBUG and when g_release_debug is true
-int SehNoMinidump(unsigned int code, struct _EXCEPTION_POINTERS *ep,
-  const char *filename, int32 linenumber, bool show_message);
-
-/**
-* @return Always returns an error value.  If GetLastError is not ERROR_SUCCESS
-*   the function returns an HRESULT value derived from GetLastError()
-*/
-inline HRESULT GetCurError() {
-  return ::GetLastError() == ERROR_SUCCESS ?
-      E_FAIL : HRESULT_FROM_WIN32(::GetLastError());
-}
-
-// Returns the directory where the debugging module stores debug-related files.
-CString GetDebugDirectory();
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_DEBUG_H_
diff --git a/base/debug_unittest.cc b/base/debug_unittest.cc
deleted file mode 100644
index ee74ad8..0000000
--- a/base/debug_unittest.cc
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Debug unittest
-
-#include <stdexcept>
-
-#include "omaha/base/debug.h"
-#include "omaha/base/test.h"
-#include "omaha/base/time.h"
-
-namespace omaha {
-
-// test what happens when we hit an exception
-int SEHExceptionTest(int level, int reserved) {
-  const uint32 kflags = MB_SETFOREGROUND  |
-                        MB_TOPMOST        |
-                        MB_ICONWARNING    |
-                        MB_OKCANCEL;
-  if (::MessageBox(NULL,
-                   L"do exception?",
-                   L"exception test",
-                   kflags) == IDOK) {
-    int *a1 = static_cast<int *>(1);
-    *a1 = 2;
-
-    // if that does not work try:
-    // simulate a divide by zero
-    int a = 10;
-    int b2 = a;
-    b2 /= 2;
-    b2 -= 5;
-    // int c = a/b2;
-    int c = 0;
-    TCHAR *s = 0;
-    s++;
-    *s = 0;
-
-    RaiseException(EXCEPTION_BREAKPOINT, 0, 0, NULL);
-  }
-
-  return 0;
-}
-
-int SEHCatchExceptionTest(int level, int reserved) {
-  __try {
-    SEHExceptionTest(level, reserved);
-  } __except (SehSendMinidump(GetExceptionCode(),
-                              GetExceptionInformation(),
-                              kMinsTo100ns)) {
-  }
-
-  return 0;
-}
-
-#pragma warning(push)
-#pragma warning(disable:4702)
-// test what happens when we do a C++ exception
-int CppExceptionTest(int level, int reserved) {
-  _TRY_BEGIN
-#if 0
-    _THROW(std::logic_error, "throwing a fake logic_error");
-#else
-//    std::logic_error e("throwing a fake logic_error");
-  //    e._Raise();
-  std::runtime_error(std::string("throwing a fake logic_error"))._Raise();
-#endif
-  _CATCH(std::logic_error e)
-    ASSERT(false, (L"caught exception"));
-  _CATCH_END
-  return 0;
-}
-#pragma warning(pop)
-
-// test what happens when we do a REPORT
-int ReportTest(int level, int reserved) {
-  REPORT(false, R_ERROR, (L"test REPORT"), 592854117);
-  return 0;
-}
-
-// test what happens when we hit an ASSERT
-int AssertTest(int level, int reserved) {
-  ASSERT(false, (L"test ASSERT"));
-  return 0;
-}
-
-// test what happens when we hit an ABORT
-int AbortTest(int level, int reserved) {
-  ABORT((L"test ABORT"));
-  ASSERT(false, (L"returned from ABORT"));
-  return 0;
-}
-
-}  // namespace omaha
-
diff --git a/base/disk.cc b/base/disk.cc
deleted file mode 100644
index ef09e87..0000000
--- a/base/disk.cc
+++ /dev/null
@@ -1,401 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Disk functions
-
-#include "omaha/base/disk.h"
-
-#include <winioctl.h>
-#include "omaha/base/commontypes.h"
-#include "omaha/base/const_config.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/localization.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/shell.h"
-#include "omaha/base/string.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/system.h"
-#include "omaha/base/timer.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-#define kNetdiskVendorId "netdisk"
-
-// see also: http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q264203
-
-#if _MSC_VER < 1400
-// Not defined in the headers we have; from MSDN:
-#define IOCTL_STORAGE_QUERY_PROPERTY \
-          CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)
-
-typedef struct _STORAGE_DEVICE_DESCRIPTOR {
-  ULONG  Version;
-  ULONG  Size;
-  UCHAR  DeviceType;
-  UCHAR  DeviceTypeModifier;
-  BOOLEAN  RemovableMedia;
-  BOOLEAN  CommandQueueing;
-  ULONG  VendorIdOffset;
-  ULONG  ProductIdOffset;
-  ULONG  ProductRevisionOffset;
-  ULONG  SerialNumberOffset;
-  STORAGE_BUS_TYPE  BusType;
-  ULONG  RawPropertiesLength;
-  UCHAR  RawDeviceProperties[1];
-} STORAGE_DEVICE_DESCRIPTOR, *PSTORAGE_DEVICE_DESCRIPTOR;
-
-typedef enum _STORAGE_QUERY_TYPE {
-  PropertyStandardQuery = 0,
-  PropertyExistsQuery,
-  PropertyMaskQuery,
-  PropertyQueryMaxDefined
-} STORAGE_QUERY_TYPE, *PSTORAGE_QUERY_TYPE;
-
-typedef enum _STORAGE_PROPERTY_ID {
-  StorageDeviceProperty = 0,
-  StorageAdapterProperty,
-  StorageDeviceIdProperty
-} STORAGE_PROPERTY_ID, *PSTORAGE_PROPERTY_ID;
-
-typedef struct _STORAGE_PROPERTY_QUERY {
-  STORAGE_PROPERTY_ID  PropertyId;
-  STORAGE_QUERY_TYPE  QueryType;
-  UCHAR  AdditionalParameters[1];
-} STORAGE_PROPERTY_QUERY, *PSTORAGE_PROPERTY_QUERY;
-
-// -------
-#endif
-
-#define kIoctlBufferSize 1024
-
-#define kMaxDrivesCached 3
-#define kMaxDriveLen 20
-static TCHAR g_cache_drive[kMaxDrivesCached][kMaxDriveLen+1];
-static bool g_cache_external[kMaxDrivesCached];
-static int g_cache_pos;
-static LLock g_cache_lock;
-
-bool IsDiskExternal(const TCHAR *drive) {
-  ASSERT(drive, (L""));
-  ASSERT(lstrlen(drive) < kMaxDriveLen, (L""));
-
-  DisableThreadErrorUI disable_error_dialog_box;
-
-  {
-    __mutexScope(g_cache_lock);
-    for (int i = 0; i < kMaxDrivesCached; i++)
-      if (!lstrcmp(drive, g_cache_drive[i])) {
-        UTIL_LOG(L1, (L"cached disk ext %s %d", drive, g_cache_external[i]));
-        return g_cache_external[i];
-      }
-  }
-
-#ifdef _DEBUG
-  Timer timer(true);
-#endif
-
-  byte buffer[kIoctlBufferSize+1];
-
-  bool external = false;
-  HANDLE device = ::CreateFile(drive,
-                               GENERIC_READ,
-                               FILE_SHARE_READ | FILE_SHARE_WRITE,
-                               NULL,
-                               OPEN_EXISTING,
-                               NULL,
-                               NULL);
-  if (device == INVALID_HANDLE_VALUE) {
-      UTIL_LOG(L1, (L"disk external could not open drive %s", drive));
-      goto done;
-  }
-  STORAGE_DEVICE_DESCRIPTOR *device_desc;
-  STORAGE_PROPERTY_QUERY query;
-  DWORD out_bytes;
-  query.PropertyId = StorageDeviceProperty;
-  query.QueryType = PropertyStandardQuery;
-  *(query.AdditionalParameters) = 0;
-
-  device_desc = reinterpret_cast<STORAGE_DEVICE_DESCRIPTOR*>(buffer);
-  // should not be needed, but just to be safer
-  ZeroMemory(buffer, kIoctlBufferSize);
-
-  BOOL ok = ::DeviceIoControl(device,
-                              IOCTL_STORAGE_QUERY_PROPERTY,
-                              &query,
-                              sizeof(STORAGE_PROPERTY_QUERY),
-                              buffer,
-                              kIoctlBufferSize,
-                              &out_bytes,
-                              (LPOVERLAPPED)NULL);
-
-  if (ok &&
-      device_desc->VendorIdOffset &&
-      stristr(reinterpret_cast<char*>(buffer + device_desc->VendorIdOffset),
-              kNetdiskVendorId)) {
-    external = true;
-    UTIL_LOG(L1, (L"ximeta netdisk %s", drive));
-  }
-
-  if (ok &&
-      (device_desc->BusType == BusTypeUsb ||
-       device_desc->BusType == BusType1394)) {
-    external = true;
-  }
-  if (!ok) {
-    UTIL_LOG(L1, (L"disk external ioctl failed %s", drive));
-  }
-  CloseHandle(device);
-  done:
-  UTIL_LOG(L1, (L"disk external %s %d time %s",
-      drive, external, String_DoubleToString(timer.GetMilliseconds(), 3)));
-
-  {
-    __mutexScope(g_cache_lock);
-    lstrcpyn(g_cache_drive[g_cache_pos], drive, kMaxDriveLen+1);
-    g_cache_external[g_cache_pos] = external;
-    if (++g_cache_pos >= kMaxDrivesCached) g_cache_pos = 0;
-  }
-
-  return external;
-}
-
-// find the first fixed local disk with at least the space requested
-// confirms that we can create a directory on the drive
-// returns the drive in the drive parameter
-// returns E_FAIL if no drive with enough space could be found
-HRESULT FindFirstLocalDriveWithEnoughSpace(const uint64 space_required,
-                                           CString *drive) {
-  ASSERT1(drive);
-
-  DisableThreadErrorUI disable_error_dialog_box;
-
-  const int kMaxNumDrives = 26;
-  static const size_t kBufLen = (STR_SIZE("c:\\\0") * kMaxNumDrives) + 1;
-
-  // obtain the fixed system drives
-  TCHAR buf[kBufLen];
-  DWORD str_len = ::GetLogicalDriveStrings(kBufLen, buf);
-  if (str_len > 0 && str_len < kBufLen) {
-    for (TCHAR* ptr = buf; *ptr != L'\0'; ptr += (lstrlen(ptr) + 1)) {
-      UINT drive_type = GetDriveType(ptr);
-      if (drive_type == DRIVE_FIXED) {
-        CString test_drive(ptr);
-        if (!IsDiskExternal(CString(L"\\\\?\\") + test_drive.Left(2))) {
-          uint64 free_disk_space = 0;
-          HRESULT hr = GetFreeDiskSpace(test_drive, &free_disk_space);
-
-          if (SUCCEEDED(hr) && space_required <= free_disk_space) {
-            CString temp_dir;
-            // confirm that we can create a directory on this drive
-            bool found = false;
-            while (!found) {
-              temp_dir = test_drive +
-                         NOTRANSL(L"test") +
-                         itostr(static_cast<uint32>(::GetTickCount()));
-              if (!File::Exists (temp_dir)) found = true;
-            }
-
-            if (SUCCEEDED(CreateDir(temp_dir, NULL))) {
-              VERIFY1(SUCCEEDED(DeleteDirectory(temp_dir)));
-              *drive = test_drive;
-              UTIL_LOG(L1, (L"drive %s enough space %d", test_drive.GetString(),
-                            free_disk_space));
-              return S_OK;
-            }
-          }
-        }
-      }
-    }
-  }
-
-  return E_FAIL;
-}
-
-// Get free disk space of a drive containing the specified folder
-HRESULT GetFreeDiskSpace(uint32 csidl, uint64* free_disk_space) {
-  ASSERT1(free_disk_space);
-
-  CString path;
-  RET_IF_FAILED(Shell::GetSpecialFolder(csidl, false, &path));
-
-  return GetFreeDiskSpace(path, free_disk_space);
-}
-
-// Get free disk space of a drive containing the specified folder
-HRESULT GetFreeDiskSpace(const TCHAR* folder, uint64* free_disk_space) {
-  ASSERT1(folder && *folder);
-  ASSERT1(free_disk_space);
-
-  DisableThreadErrorUI disable_error_dialog_box;
-
-  CString drive(folder);
-
-  // (Stupid API used by System::GetDiskStatistics will work with any folder -
-  // as long as it EXISTS.  Since the data storage folder might not exist yet
-  // (e.g., on a clean install) we'll just truncate it down to a drive letter.)
-  drive = drive.Left(3);  // "X:\"
-  ASSERT1(String_EndsWith(drive, _T(":\\"), false));
-
-  // Get the free disk space available to this user on this drive
-  uint64 free_bytes_current_user = 0LL;
-  uint64 total_bytes_current_user = 0LL;
-  uint64 free_bytes_all_users = 0LL;
-  RET_IF_FAILED(System::GetDiskStatistics(drive,
-                                          &free_bytes_current_user,
-                                          &total_bytes_current_user,
-                                          &free_bytes_all_users));
-
-  *free_disk_space = std::min(free_bytes_current_user, free_bytes_all_users);
-
-  return S_OK;
-}
-
-// Has enough free disk space on a drive containing the specified folder
-HRESULT HasEnoughFreeDiskSpace(uint32 csidl, uint64 disk_space_needed) {
-  uint64 free_disk_space = 0;
-  if (SUCCEEDED(GetFreeDiskSpace(csidl, &free_disk_space))) {
-    return (disk_space_needed <= free_disk_space) ?
-           S_OK : CI_E_NOT_ENOUGH_DISK_SPACE;
-  }
-  return S_OK;
-}
-
-// Has enough free disk space on a drive containing the specified folder
-HRESULT HasEnoughFreeDiskSpace(const TCHAR* folder, uint64 disk_space_needed) {
-  uint64 free_disk_space = 0;
-  if (SUCCEEDED(GetFreeDiskSpace(folder, &free_disk_space))) {
-    return (disk_space_needed <= free_disk_space) ?
-           S_OK : CI_E_NOT_ENOUGH_DISK_SPACE;
-  }
-  return S_OK;
-}
-
-// The ::CreateFile() call will fail for mapped local drives (subst).
-bool IsHotPluggable(const TCHAR* drive) {
-  ASSERT(drive, (L""));
-
-  // Disable potential error dialogs during this check
-  DisableThreadErrorUI disable_error_dialog_box;
-
-  //
-  // We set the default return value to true so that
-  // we treat the disk as hot-pluggable in case we
-  // don't know.
-  //
-  bool ret = true;
-
-  if (drive && lstrlen(drive) >= 2) {
-    CString volume_path(_T("\\\\.\\"));
-    // We don't want the trailing backslash.
-    volume_path.Append(drive, 2);
-
-    CHandle volume(::CreateFile(volume_path, GENERIC_READ,
-                                FILE_SHARE_READ | FILE_SHARE_WRITE,
-                                NULL, OPEN_EXISTING, 0, NULL));
-
-    if (volume != INVALID_HANDLE_VALUE) {
-      STORAGE_HOTPLUG_INFO shi = {0};
-      shi.Size = sizeof(shi);
-      DWORD bytes_returned = 0;
-      if (::DeviceIoControl(volume, IOCTL_STORAGE_GET_HOTPLUG_INFO,  NULL, 0,
-                            &shi, sizeof(STORAGE_HOTPLUG_INFO), &bytes_returned,
-                            NULL)) {
-          ret = (shi.DeviceHotplug != false);
-      } else {
-        UTIL_LOG(LW, (_T("[::DeviceIoControl failed][%u]"), ::GetLastError()));
-      }
-    } else {
-      UTIL_LOG(LW, (_T("[::CreateFile failed][%u]"), ::GetLastError()));
-    }
-  } else {
-    ASSERT(false, (L"Invalid path"));
-  }
-
-  return ret;
-}
-
-bool IsLargeDrive(const TCHAR* drive) {
-  ASSERT1(drive && *drive);
-
-  DisableThreadErrorUI disable_error_dialog_box;
-
-  ULARGE_INTEGER caller_free_bytes = {0};
-  ULARGE_INTEGER total_bytes = {0};
-  ULARGE_INTEGER total_free_bytes = {0};
-
-  if (!::GetDiskFreeSpaceEx(drive,
-                            &caller_free_bytes,
-                            &total_bytes,
-                            &total_free_bytes)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR,
-             (_T("[IsLargeDrive - failed to GetDiskFreeSpaceEx][0x%x]"), hr));
-    return false;
-  }
-
-  return (total_bytes.QuadPart > kLargeDriveSize);
-}
-
-HRESULT DevicePathToDosPath(const TCHAR* device_path, CString* dos_path) {
-  ASSERT1(device_path);
-  ASSERT1(dos_path);
-  UTIL_LOG(L4, (_T("[DevicePathToDosPath][device_path=%s]"), device_path));
-
-  dos_path->Empty();
-
-  TCHAR drive_strings[MAX_PATH] = _T("");
-  if (!::GetLogicalDriveStrings(arraysize(drive_strings), drive_strings)) {
-    UTIL_LOG(L4, (_T("[DevicePathToDosPath-GetLogicalDriveStrings fail][0x%x]"),
-                  HRESULTFromLastError()));
-    return HRESULTFromLastError();
-  }
-
-  // Drive strings are stored as a set of null terminated strings, with an
-  // extra null after the last string. Each drive string is of the form "C:\".
-  // We convert it to the form "C:", which is the format expected by
-  // ::QueryDosDevice().
-  TCHAR drive_colon[3] = _T(" :");
-  for (const TCHAR* next_drive_letter = drive_strings;
-       *next_drive_letter;
-       next_drive_letter += _tcslen(next_drive_letter) + 1) {
-    // Dos device of the form "C:".
-    *drive_colon = *next_drive_letter;
-    TCHAR device_name[MAX_PATH] = _T("");
-    if (!::QueryDosDevice(drive_colon, device_name, arraysize(device_name))) {
-      UTIL_LOG(LEVEL_ERROR, (_T("[QueryDosDevice failed][0x%x]"),
-                             HRESULTFromLastError()));
-      continue;
-    }
-
-    UTIL_LOG(L4, (_T("[DevicePathToDosPath found drive]")
-                  _T("[logical drive %s][device name %s]"),
-                  drive_colon, device_name));
-
-    size_t name_length = _tcslen(device_name);
-    if (_tcsnicmp(device_path, device_name, name_length) == 0) {
-      // Construct DOS path.
-      dos_path->Format(_T("%s%s"), drive_colon, device_path + name_length);
-      UTIL_LOG(L4, (_T("[DevicePathToDosPath][dos_path=%s]"), *dos_path));
-      return S_OK;
-    }
-  }
-
-  return HRESULT_FROM_WIN32(ERROR_INVALID_DRIVE);
-}
-
-}  // namespace omaha
diff --git a/base/disk.h b/base/disk.h
deleted file mode 100644
index dd59006..0000000
--- a/base/disk.h
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Disk functions
-
-#ifndef OMAHA_COMMON_DISK_H__
-#define OMAHA_COMMON_DISK_H__
-
-#include <atlstr.h>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-// A constant we use to determine a large drive.
-// Although today this isn't really really large,
-// it is enough to distinguish small, removable
-// drives that are not continually connected to
-// a computer, from the drives that are.
-// In addition to using this constant, we
-// also check if the drive is hot-pluggable.
-const uint64 kLargeDriveSize = 0x00000000ffffffff;
-
-// returns true if the device is an external disk
-// drive typically is something like: \\?\C:
-bool IsDiskExternal(const TCHAR *drive);
-
-//
-// Determines if a drive can be unplugged without manually disabling
-// the drive first.  By default, USB drives are initialized with
-// "surprise removal" enabled, which means they are hot-pluggable.
-//
-// @param drive  The root of the drive, as returned from GetLogicalDriveStrings
-//               e.g. "E:\\".
-//
-// @returns true if the drive is optimized for quick/surprise removal.
-//   If the function returns false, then caching (lazy write) is enabled for
-//   the drive, otherwise it is not.
-//   If an error occurs during this call, the return value will be 'true' since
-//   we always want to treat a drive as hot-pluggable if we're not sure.
-//
-bool IsHotPluggable(const TCHAR* drive);
-
-//
-// @returns true if the specified drive is larger than kLargeDriveSize.
-//
-// @param drive  The root of the drive, as returned from GetLogicalDriveStrings
-//               e.g. "E:\\".
-//
-bool IsLargeDrive(const TCHAR* drive);
-
-// find the first fixed local disk with at least the space requested
-// returns the drive in the drive parameter
-// returns E_FAIL if no drive with enough space could be found
-HRESULT FindFirstLocalDriveWithEnoughSpace(const uint64 space_required,
-                                           CString *drive);
-
-// Get free disk space of a drive containing the specified folder
-HRESULT GetFreeDiskSpace(uint32 csidl, uint64* free_disk_space);
-
-// Get free disk space of a drive containing the specified folder
-HRESULT GetFreeDiskSpace(const TCHAR* folder, uint64* free_disk_space);
-
-// Has enough free disk space on a drive containing the specified folder
-HRESULT HasEnoughFreeDiskSpace(uint32 csidl, uint64 disk_space_needed);
-
-// Has enough free disk space on a drive containing the specified folder
-HRESULT HasEnoughFreeDiskSpace(const TCHAR* folder, uint64 disk_space_needed);
-
-// Convert from "\Device\Harddisk0\Partition1\WINNT\System32\ntdll.dll" to
-// "C:\WINNT\System32\ntdll.dll"
-HRESULT DevicePathToDosPath(const TCHAR* device_path, CString* dos_path);
-
-//
-// Disables critical error dialogs on the current thread.
-// The system does not display the critical-error-handler message box.
-// Instead, the system returns the error to the calling process.
-//
-class DisableThreadErrorUI {
- public:
-  DisableThreadErrorUI() {
-    // Set the error mode
-    prev_mode_ = SetErrorMode(SEM_FAILCRITICALERRORS);
-  }
-
-  ~DisableThreadErrorUI() {
-    // Restore the error mode
-    SetErrorMode(prev_mode_);
-  }
-
- protected:
-  UINT prev_mode_;
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_DISK_H__
-
diff --git a/base/disk_unittest.cc b/base/disk_unittest.cc
deleted file mode 100644
index ae7a1d2..0000000
--- a/base/disk_unittest.cc
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2004-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <shlobj.h>
-#include <psapi.h>
-
-#include "omaha/base/app_util.h"
-#include "omaha/base/const_utils.h"
-#include "omaha/base/disk.h"
-#include "omaha/base/file.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(DiskTest, GetFreeDiskSpace) {
-  uint64 bytes_available = 0;
-  EXPECT_SUCCEEDED(GetFreeDiskSpace(_T("C:\\"), &bytes_available));
-
-  bytes_available = 0;
-  EXPECT_SUCCEEDED(GetFreeDiskSpace(CSIDL_PROGRAM_FILES, &bytes_available));
-}
-
-TEST(DiskTest, Disk_SystemDrive) {
-  TCHAR system_drive[MAX_PATH] = _T("%SystemDrive%");
-  EXPECT_TRUE(::ExpandEnvironmentStrings(system_drive, system_drive, MAX_PATH));
-  EXPECT_TRUE(::PathAddBackslash(system_drive));
-
-  if (vista_util::IsUserAdmin()) {
-    // System drive should not be hot-pluggable
-    EXPECT_FALSE(IsHotPluggable(system_drive));
-  }
-
-  // System drive is expected to be > 4GB.
-  EXPECT_TRUE(IsLargeDrive(system_drive));
-}
-
-TEST(DiskTest, Disk_FirstLargeLocalDrive) {
-  // Preferred amount of disk space for data (choose first location if found).
-  // Ideally this would be 1 GB, but some test VMs have little free space.
-  const int kDesiredSpace = 100 * 1000 * 1000;  // 100 MB
-
-  CString drive;
-  EXPECT_SUCCEEDED(FindFirstLocalDriveWithEnoughSpace(kDesiredSpace, &drive));
-  EXPECT_TRUE(IsLargeDrive(drive));
-}
-
-// TODO(omaha): Make this work on mapped drives. See http://b/1076675.
-TEST(DiskTest, DISABLED_DevicePathToDosPath) {
-  TCHAR image_name[MAX_PATH] = _T("");
-  EXPECT_TRUE(::GetProcessImageFileName(::GetCurrentProcess(),
-                                        image_name,
-                                        arraysize(image_name)) != 0);
-
-  CString dos_name;
-  EXPECT_SUCCEEDED(DevicePathToDosPath(image_name, &dos_name));
-  EXPECT_TRUE(File::Exists(dos_name));
-
-  EXPECT_EQ(dos_name.CompareNoCase(app_util::GetCurrentModulePath()), 0);
-}
-
-}  // namespace omaha
diff --git a/base/dual_interface_switch.h b/base/dual_interface_switch.h
deleted file mode 100644
index 72dd933..0000000
--- a/base/dual_interface_switch.h
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// This class allows for implementing two dual interfaces, ReadOnly being a
-// read-only dual interface, and ReadWrite being a read-write dual interface.
-// Based on the value returned from is_read_only(), the ReadOnly or the
-// ReadWrite dual interface is exposed at runtime.
-//
-// An ATL class needs to
-// (a) derive from DualInterfaceSwitch
-//
-// (b) implement the is_read_only() method. For instance:
-//   bool is_read_only() { return is_read_only_; }
-//
-// (c) add entries similar to below for the dual interfaces as well as IDispatch
-//     to the COM map:
-//  BEGIN_COM_MAP(AppData)
-//    COM_INTERFACE_ENTRY2(IUnknown, IAppData)
-//    COM_INTERFACE_ENTRY_FUNC(__uuidof(IAppDataReadOnly), 0, DualInterfaceQI)
-//    COM_INTERFACE_ENTRY_FUNC(__uuidof(IAppData), 0, DualInterfaceQI)
-//    COM_INTERFACE_ENTRY_FUNC(__uuidof(IDispatch), 0, DualInterfaceQI)
-//  END_COM_MAP()
-
-#ifndef OMAHA_BASE_DUAL_INTERFACE_SWITCH_H_
-#define OMAHA_BASE_DUAL_INTERFACE_SWITCH_H_
-
-#include <windows.h>
-#include <atlbase.h>
-#include "base/basictypes.h"
-#include "omaha/base/debug.h"
-
-namespace omaha {
-
-template <class T, class ReadOnly, REFIID iid_read_only,
-          class ReadWrite, REFIID iid_read_write>
-class ATL_NO_VTABLE DualInterfaceSwitch : public ReadOnly,
-                                          public ReadWrite {
- protected:
-  // DualInterfaceQI gives out either the ReadOnly or ReadWrite interface
-  // pointer, based on the value of is_read_only() that class T implements.
-  // The signature of this function has to be
-  //   HRESULT WINAPI func(void* pv, REFIID riid, LPVOID* ppv, DWORD dw);
-  // for it to work with COM_INTERFACE_ENTRY_FUNC.
-  static HRESULT WINAPI DualInterfaceQI(void* p,
-                                        REFIID riid,
-                                        LPVOID* v,
-                                        DWORD) {
-    // Ensure that ReadOnly and ReadWrite are derived from IDispatch.
-    ASSERT1(static_cast<IDispatch*>(reinterpret_cast<ReadOnly*>(1)));
-    ASSERT1(static_cast<IDispatch*>(reinterpret_cast<ReadWrite*>(1)));
-
-    if (riid != iid_read_only &&
-        riid != iid_read_write &&
-        riid != __uuidof(IDispatch)) {
-      // Returning S_FALSE allows COM map processing to continue. Another entry
-      // in the COM map might match the interface requested.
-      return S_FALSE;
-    }
-
-    T* t = reinterpret_cast<T*>(p);
-    if (t->is_read_only() && riid == iid_read_write) {
-      return S_FALSE;
-    }
-
-    t->AddRef();
-    if (t->is_read_only() || riid == iid_read_only) {
-      *v = static_cast<ReadOnly*>(t);
-      return S_OK;
-    }
-
-    *v = static_cast<ReadWrite*>(t);
-    return S_OK;
-  }
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_DUAL_INTERFACE_SWITCH_H_
diff --git a/base/dynamic_link_dbghelp.cc b/base/dynamic_link_dbghelp.cc
deleted file mode 100644
index 9430726..0000000
--- a/base/dynamic_link_dbghelp.cc
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// dynamic loading of dbghelp dll functions
-
-#include "omaha/base/debug.h"
-#include "omaha/base/dynamic_link_dbghelp.h"
-
-namespace omaha {
-
-BOOL (CALLBACK *Dbghelp::SymInitialize)(HANDLE, PCSTR, BOOL);
-BOOL (CALLBACK *Dbghelp::SymCleanup)(HANDLE);
-BOOL (CALLBACK *Dbghelp::SymEnumSymbols)(HANDLE, ULONG64, PCSTR, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID);
-DWORD (CALLBACK *Dbghelp::SymSetOptions)(DWORD);
-BOOL (CALLBACK *Dbghelp::SymSetContext)(HANDLE, PIMAGEHLP_STACK_FRAME, PIMAGEHLP_CONTEXT);
-BOOL (CALLBACK *Dbghelp::SymGetLineFromAddr)(HANDLE, DWORD, PDWORD, PIMAGEHLP_LINE);
-BOOL (CALLBACK *Dbghelp::SymGetLineFromAddr64)(HANDLE, DWORD64, PDWORD, PIMAGEHLP_LINE64);
-BOOL (CALLBACK *Dbghelp::SymFromAddr)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFO);
-BOOL (CALLBACK *Dbghelp::StackWalk64)(DWORD, HANDLE, HANDLE, LPSTACKFRAME64, PVOID, PREAD_PROCESS_MEMORY_ROUTINE64,
-        PFUNCTION_TABLE_ACCESS_ROUTINE64, PGET_MODULE_BASE_ROUTINE64, PTRANSLATE_ADDRESS_ROUTINE64);
-BOOL (CALLBACK *Dbghelp::StackWalk)(DWORD, HANDLE, HANDLE, LPSTACKFRAME, PVOID, PREAD_PROCESS_MEMORY_ROUTINE,
-        PFUNCTION_TABLE_ACCESS_ROUTINE, PGET_MODULE_BASE_ROUTINE, PTRANSLATE_ADDRESS_ROUTINE);
-PVOID (CALLBACK *Dbghelp::SymFunctionTableAccess64)(HANDLE, DWORD64);
-PVOID (CALLBACK *Dbghelp::SymFunctionTableAccess)(HANDLE, DWORD);
-DWORD64 (CALLBACK *Dbghelp::SymGetModuleBase64)(HANDLE, DWORD64);
-DWORD64 (CALLBACK *Dbghelp::SymGetModuleBase)(HANDLE, DWORD);
-BOOL (CALLBACK *Dbghelp::SymGetTypeInfo)(HANDLE, DWORD64, ULONG, IMAGEHLP_SYMBOL_TYPE_INFO, PVOID);
-BOOL (CALLBACK *Dbghelp::MiniDumpWriteDump)(HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, PMINIDUMP_EXCEPTION_INFORMATION,
-        PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION);
-
-Dbghelp::LoadedState Dbghelp::loaded_state_ = Dbghelp::NOT_LOADED;
-HINSTANCE Dbghelp::library_ = NULL;
-
-template <typename T>
-bool Dbghelp::GPA(const char * function_name, T& function_pointer) {
-  ASSERT(function_name, (L""));
-
-  function_pointer = reinterpret_cast<T>(::GetProcAddress(library_,
-                                                          function_name));
-  return function_pointer != NULL;
-}
-
-HRESULT Dbghelp::Load() {
-  // If we've already tried to load, don't try again.
-  if (loaded_state_ != NOT_LOADED) goto Exit;
-
-  Clear();
-
-  // UTIL_LOG((L2, _T("dbghelp loading")));
-  library_ = ::LoadLibrary(_T("dbghelp"));
-  // UTIL_LOG((L2, _T("dbghelp loaded")));
-
-  if (!library_) return E_FAIL;
-
-  bool all_valid = (GPA("SymInitialize", SymInitialize))
-    & (GPA("SymCleanup", SymCleanup))
-    & (GPA("SymSetOptions", SymSetOptions))
-    & (GPA("SymGetLineFromAddr", SymGetLineFromAddr))
-    & (GPA("SymGetLineFromAddr64", SymGetLineFromAddr64))
-    & (GPA("StackWalk", StackWalk))
-    & (GPA("StackWalk64", StackWalk64))
-    & (GPA("SymFunctionTableAccess", SymFunctionTableAccess))
-    & (GPA("SymFunctionTableAccess64", SymFunctionTableAccess64))
-    & (GPA("SymGetModuleBase", SymGetModuleBase))
-    & (GPA("SymGetModuleBase64", SymGetModuleBase64))
-    & (GPA("MiniDumpWriteDump", MiniDumpWriteDump));
-
-  // These are not supported in the Win2k version of DbgHelp;
-  // failing to load them is not an error.
-  GPA("SymEnumSymbols", SymEnumSymbols);
-  GPA("SymGetTypeInfo", SymGetTypeInfo);
-  GPA("SymSetContext", SymSetContext);
-  GPA("SymFromAddr", SymFromAddr);
-
-  if (!all_valid) Unload();
-  loaded_state_ = all_valid ? LOAD_SUCCEEDED : LOAD_FAILED;
-
- Exit:
-  return (loaded_state_ == LOAD_SUCCEEDED) ? S_OK : E_FAIL;
-}
-
-void Dbghelp::Unload() {
-  if (library_) {
-    VERIFY(::FreeLibrary(library_), (L""));
-
-    // Must set library_ to NULL so that Loaded() will return FALSE.
-    library_ = NULL;
-    }
-  Clear();
-}
-
-void Dbghelp::Clear() {
-  // just clear the main entry points
-  SymInitialize = NULL;
-  MiniDumpWriteDump = NULL;
-}
-
-}  // namespace omaha
-
diff --git a/base/dynamic_link_dbghelp.h b/base/dynamic_link_dbghelp.h
deleted file mode 100644
index df6de46..0000000
--- a/base/dynamic_link_dbghelp.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// dynamic loading of dbghelp dll functions
-//
-
-#ifndef OMAHA_COMMON_DYNAMIC_LINK_DBGHELP_H_
-#define OMAHA_COMMON_DYNAMIC_LINK_DBGHELP_H_
-
-#include <dbghelp.h>
-
-namespace omaha {
-
-class Dbghelp {
- public:
-  static BOOL (CALLBACK *SymInitialize)(HANDLE, PCSTR, BOOL);
-  static BOOL (CALLBACK *SymCleanup)(HANDLE);
-  static BOOL (CALLBACK *SymEnumSymbols)(HANDLE, ULONG64, PCSTR, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID);
-  static DWORD (CALLBACK *SymSetOptions)(DWORD);
-  static BOOL (CALLBACK *SymSetContext)(HANDLE, PIMAGEHLP_STACK_FRAME, PIMAGEHLP_CONTEXT);
-  static BOOL (CALLBACK *SymGetLineFromAddr)(HANDLE, DWORD, PDWORD, PIMAGEHLP_LINE);
-  static BOOL (CALLBACK *SymGetLineFromAddr64)(HANDLE, DWORD64, PDWORD, PIMAGEHLP_LINE64);
-  static BOOL (CALLBACK *SymFromAddr)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFO);
-  static BOOL (CALLBACK *StackWalk64)(DWORD, HANDLE, HANDLE, LPSTACKFRAME64, PVOID, PREAD_PROCESS_MEMORY_ROUTINE64,
-      PFUNCTION_TABLE_ACCESS_ROUTINE64, PGET_MODULE_BASE_ROUTINE64, PTRANSLATE_ADDRESS_ROUTINE64);
-  static BOOL (CALLBACK *StackWalk)(DWORD, HANDLE, HANDLE, LPSTACKFRAME, PVOID, PREAD_PROCESS_MEMORY_ROUTINE,
-      PFUNCTION_TABLE_ACCESS_ROUTINE, PGET_MODULE_BASE_ROUTINE, PTRANSLATE_ADDRESS_ROUTINE);
-  static PVOID (CALLBACK *SymFunctionTableAccess64)(HANDLE, DWORD64);
-  static PVOID (CALLBACK *SymFunctionTableAccess)(HANDLE, DWORD);
-  static DWORD64 (CALLBACK *SymGetModuleBase64)(HANDLE, DWORD64);
-  static DWORD64 (CALLBACK *SymGetModuleBase)(HANDLE, DWORD);
-  static BOOL (CALLBACK *SymGetTypeInfo)(HANDLE, DWORD64, ULONG, IMAGEHLP_SYMBOL_TYPE_INFO, PVOID);
-  static BOOL (CALLBACK *MiniDumpWriteDump)(HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, PMINIDUMP_EXCEPTION_INFORMATION,
-      PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION);
-
-  static HRESULT Load();
-  static void Unload();
-  static bool Loaded() { return (loaded_state_ == LOAD_SUCCEEDED && library_ != NULL); }
-
- private:
-  // If we tried to load and failed, do not try again.
-  static enum LoadedState {NOT_LOADED, LOAD_FAILED, LOAD_SUCCEEDED};
-
-  static LoadedState loaded_state_;
-  static HINSTANCE library_;
-
-  static void Clear();
-
-  // wrapper around GetProcAddress()
-  template <typename T>
-  static bool GPA(const char * function_name, T& function_pointer);
-
-  DISALLOW_EVIL_CONSTRUCTORS(Dbghelp);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_DYNAMIC_LINK_DBGHELP_H_
diff --git a/base/dynamic_link_kernel32.cc b/base/dynamic_link_kernel32.cc
deleted file mode 100644
index 302cc15..0000000
--- a/base/dynamic_link_kernel32.cc
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// dynamic loading of Windows kernel32.dll API dll functions
-// wrappers for win32 functions not supported on windows 95/98/ME
-
-#include "omaha/base/debug.h"
-#include "omaha/base/dynamic_link_kernel32.h"
-
-namespace omaha {
-
-typedef BOOL (WINAPI * Module32FirstFunc)(HANDLE, LPMODULEENTRY32);
-typedef BOOL (WINAPI * Module32NextFunc)(HANDLE, LPMODULEENTRY32);
-typedef BOOL (WINAPI * Process32FirstFunc)(HANDLE, LPPROCESSENTRY32);
-typedef BOOL (WINAPI * Process32NextFunc)(HANDLE, LPPROCESSENTRY32);
-typedef BOOL (WINAPI * IsWow64ProcessFunc)(HANDLE, PBOOL);
-
-#define kKernel32Module L"kernel32"
-
-BOOL WINAPI Kernel32::Module32First(HANDLE hSnapshot, LPMODULEENTRY32 lpme) {
-  static Module32FirstFunc f = NULL;
-
-  if (f == NULL) {
-    HMODULE handle = GetModuleHandle(kKernel32Module);
-    ASSERT(handle, (L""));
-    f = (Module32FirstFunc) GetProcAddress(handle, "Module32FirstW");
-  }
-
-  if (f == NULL)
-    return FALSE;
-
-  return f(hSnapshot, lpme);
-}
-
-BOOL WINAPI Kernel32::Module32Next(HANDLE hSnapshot, LPMODULEENTRY32 lpme) {
-  static Module32NextFunc f = NULL;
-
-  if (f == NULL) {
-    HMODULE handle = GetModuleHandle(kKernel32Module);
-    ASSERT(handle, (L""));
-    f = (Module32NextFunc) GetProcAddress(handle, "Module32NextW");
-  }
-
-  if (f == NULL)
-    return FALSE;
-
-  return f(hSnapshot, lpme);
-}
-
-BOOL WINAPI Kernel32::Process32First(HANDLE hSnapshot, LPPROCESSENTRY32 lppe) {
-  static Process32FirstFunc f = NULL;
-
-  if (f == NULL) {
-    HMODULE handle = GetModuleHandle(kKernel32Module);
-    ASSERT(handle, (L""));
-    f = (Process32FirstFunc) GetProcAddress(handle, "Process32FirstW");
-  }
-
-  if (f == NULL)
-    return FALSE;
-
-  return f(hSnapshot, lppe);
-}
-
-BOOL WINAPI Kernel32::Process32Next(HANDLE hSnapshot, LPPROCESSENTRY32 lppe) {
-  static Process32NextFunc f = NULL;
-
-  if (f == NULL) {
-    HMODULE handle = GetModuleHandle(kKernel32Module);
-    ASSERT(handle, (L""));
-    f = (Process32NextFunc) GetProcAddress(handle, "Process32NextW");
-  }
-
-  if (f == NULL)
-    return FALSE;
-
-  return f(hSnapshot, lppe);
-}
-
-BOOL WINAPI Kernel32::IsWow64Process(HANDLE hProcess, PBOOL Wow64Process) {
-  static IsWow64ProcessFunc f = NULL;
-
-  if (f == NULL) {
-    HMODULE handle = GetModuleHandle(kKernel32Module);
-    ASSERT(handle, (L""));
-    f = (IsWow64ProcessFunc) GetProcAddress(handle, "IsWow64Process");
-  }
-
-  if (f == NULL)
-    return FALSE;
-
-  return f(hProcess, Wow64Process);
-}
-
-}  // namespace omaha
-
diff --git a/base/dynamic_link_kernel32.h b/base/dynamic_link_kernel32.h
deleted file mode 100644
index b8542f8..0000000
--- a/base/dynamic_link_kernel32.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Dynamic loading of Windows kernel32.dll API dll functions not supported
-// on Windows 95/98/ME.
-
-#ifndef OMAHA_COMMON_DYNAMIC_LINK_KERNEL32_H_
-#define OMAHA_COMMON_DYNAMIC_LINK_KERNEL32_H_
-
-#include <windows.h>
-#include <tlhelp32.h>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-class Kernel32 {
- public:
-
-  static BOOL WINAPI Module32First(HANDLE hSnapshot, LPMODULEENTRY32 lpme);
-  static BOOL WINAPI Module32Next(HANDLE hSnapshot, LPMODULEENTRY32 lpme);
-  static BOOL WINAPI Process32First(HANDLE hSnapshot, LPPROCESSENTRY32 lppe);
-  static BOOL WINAPI Process32Next(HANDLE hSnapshot, LPPROCESSENTRY32 lppe);
-
-  // Is process running under WOW64?
-  // WOW64 is the emulator for win32 applications running on win64.
-  static BOOL WINAPI IsWow64Process(HANDLE hProcess, PBOOL Wow64Process);
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(Kernel32);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_DYNAMIC_LINK_KERNEL32_H_
diff --git a/base/dynamic_link_kernel32_unittest.cc b/base/dynamic_link_kernel32_unittest.cc
deleted file mode 100644
index 80c3253..0000000
--- a/base/dynamic_link_kernel32_unittest.cc
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// dynamic link kernel 32 unittest
-
-#include "omaha/base/dynamic_link_kernel32.h"
-#include "omaha/base/system_info.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(DynamicLinkKernel32Test, DynamicLinkKernel32) {
-  BOOL is64(0);
-  ASSERT_TRUE(Kernel32::IsWow64Process(GetCurrentProcess(), &is64));
-  ASSERT_EQ(static_cast<BOOL>(SystemInfo::Is64BitWindows()), is64);
-}
-
-}  // namespace omaha
diff --git a/base/encrypt.cc b/base/encrypt.cc
deleted file mode 100644
index 46c368c..0000000
--- a/base/encrypt.cc
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/base/encrypt.h"
-
-#include <vector>
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-
-namespace omaha {
-
-namespace encrypt {
-
-// TODO(omaha): consider loading crypt32.dll dynamically, as these functions
-// are used infrequently.
-
-HRESULT EncryptData(const void* key, size_t key_len,
-                    const void* data, size_t data_len,
-                    std::vector<uint8>* data_out) {
-  // key may be null.
-  ASSERT1(data);
-  ASSERT1(data_out);
-  DATA_BLOB blob_out = {0, NULL};
-  DATA_BLOB blob_in = { data_len, static_cast<BYTE*>(const_cast<void*>(data)) };
-  DATA_BLOB entropy = { 0, NULL };
-  if (key != NULL && key_len != 0) {
-    entropy.cbData = key_len;
-    entropy.pbData = static_cast<BYTE*>(const_cast<void*>(key));
-  }
-
-  // The description parameter is required on W2K.
-  if (!::CryptProtectData(&blob_in, _T("gupdate"), &entropy, NULL, NULL,
-                          CRYPTPROTECT_UI_FORBIDDEN, &blob_out)) {
-    return HRESULTFromLastError();
-  }
-
-  data_out->clear();
-  const uint8* first = reinterpret_cast<const uint8*>(blob_out.pbData);
-  const uint8* last = first + blob_out.cbData;
-  data_out->insert(data_out->begin(), first, last);
-  ::LocalFree(blob_out.pbData);
-
-  ASSERT1(data_out->size() == blob_out.cbData);
-  return S_OK;
-}
-
-HRESULT DecryptData(const void* key, size_t key_len,
-                    const void* data, size_t data_len,
-                    std::vector<uint8>* data_out) {
-  // key may be null.
-  ASSERT1(data);
-  ASSERT1(data_out);
-
-  DATA_BLOB blob_out = {0, NULL};
-  DATA_BLOB blob_in = { data_len, static_cast<BYTE*>(const_cast<void*>(data)) };
-  DATA_BLOB entropy = { 0, NULL };
-
-  if (key != NULL && key_len != 0) {
-    entropy.cbData = key_len;
-    entropy.pbData = static_cast<BYTE*>(const_cast<void*>(key));
-  }
-
-  if (!::CryptUnprotectData(&blob_in, NULL, &entropy, NULL, NULL,
-                            CRYPTPROTECT_UI_FORBIDDEN, &blob_out)) {
-    return (::GetLastError() != ERROR_SUCCESS) ?
-        HRESULTFromLastError() : HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
-  }
-
-  data_out->clear();
-  const uint8* first = reinterpret_cast<const uint8*>(blob_out.pbData);
-  const uint8* last = first + blob_out.cbData;
-  data_out->insert(data_out->begin(), first, last);
-  ::LocalFree(blob_out.pbData);
-
-  ASSERT1(data_out->size() == blob_out.cbData);
-  return S_OK;
-}
-
-}  // namespace encrypt
-
-}  // namespace omaha
-
diff --git a/base/encrypt.h b/base/encrypt.h
deleted file mode 100644
index 59a43de..0000000
--- a/base/encrypt.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Encryption functions
-
-#ifndef OMAHA_COMMON_ENCRYPT_H__
-#define OMAHA_COMMON_ENCRYPT_H__
-
-#include <windows.h>
-#include <wincrypt.h>
-#include <vector>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-namespace encrypt {
-
-// Encrypts a data buffer by using the user's credentials as well as
-// the provided key. The key may be NULL, if no entropy is needed.
-HRESULT EncryptData(const void* key, size_t key_len,
-                    const void* data, size_t data_len,
-                    std::vector<uint8>* data_out);
-
-// Decrypts the provided data buffer. The key may be NULL, if no entropy
-// is needed.
-HRESULT DecryptData(const void* key, size_t key_len,
-                    const void* data, size_t data_len,
-                    std::vector<uint8>* data_out);
-
-}  // namespace encrypt
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_ENCRYPT_H__
diff --git a/base/encrypt_test.cc b/base/encrypt_test.cc
deleted file mode 100644
index c37bee9..0000000
--- a/base/encrypt_test.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <omaha/base/encrypt.h>
-#include <cstring>
-#include <vector>
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace encrypt {
-
-TEST(EncryptTest, Test) {
-  const char* plaintext = "the quick brown fox jumps over the lazy dog";
-  std::vector<uint8> ciphertext;
-  EXPECT_HRESULT_SUCCEEDED(EncryptData(NULL, 0,
-                                       plaintext, strlen(plaintext),
-                                       &ciphertext));
-  std::vector<uint8> decrypted_text;
-  EXPECT_HRESULT_SUCCEEDED(DecryptData(NULL, 0,
-                                       &ciphertext.front(), ciphertext.size(),
-                                       &decrypted_text));
-  EXPECT_EQ(decrypted_text.size(), strlen(plaintext));
-  decrypted_text.push_back(0);
-  EXPECT_STREQ(reinterpret_cast<char*>(&decrypted_text.front()), plaintext);
-
-
-  const char* key = "foobar";
-  ciphertext.clear();
-  EXPECT_HRESULT_SUCCEEDED(EncryptData(key, strlen(key),
-                                       plaintext, strlen(plaintext),
-                                       &ciphertext));
-  decrypted_text.clear();
-  EXPECT_HRESULT_SUCCEEDED(DecryptData(key, strlen(key),
-                                       &ciphertext.front(), ciphertext.size(),
-                                       &decrypted_text));
-  EXPECT_EQ(decrypted_text.size(), strlen(plaintext));
-  decrypted_text.push_back(0);
-  EXPECT_STREQ(reinterpret_cast<char*>(&decrypted_text.front()), plaintext);
-}
-
-}  // namespace encrypt
-
-}  // namespace omaha
-
diff --git a/base/error.cc b/base/error.cc
deleted file mode 100644
index e0a568e..0000000
--- a/base/error.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/error.h"
-#include <winhttp.h>
-#include "base/basictypes.h"
-#include "omaha/base/crash_if_specific_error.h"
-#include "omaha/base/debug.h"
-
-namespace omaha {
-
-int g_error_extra_code1 = 0;
-
-int error_extra_code1() {
-  return g_error_extra_code1;
-}
-
-void set_error_extra_code1(int extra_code) {
-  g_error_extra_code1 = extra_code;
-}
-
-HRESULT HRESULTFromLastError() {
-  DWORD error_code = ::GetLastError();
-  ASSERT1(error_code != NO_ERROR);
-  HRESULT hr = error_code != NO_ERROR ? HRESULT_FROM_WIN32(error_code) : E_FAIL;
-  CRASH_IF_SPECIFIC_ERROR(hr);
-  return hr;
-}
-
-HRESULT HRESULTFromHttpStatusCode(int status_code) {
-  COMPILE_ASSERT(GOOPDATE_E_NETWORK_FIRST + HTTP_STATUS_LAST <
-                 GOOPDATE_E_NETWORK_LAST,
-                 GOOPDATE_E_NETWORK_LAST_too_small);
-  HRESULT hr = S_OK;
-  if (HTTP_STATUS_FIRST <= status_code && status_code <= HTTP_STATUS_LAST) {
-    hr = GOOPDATE_E_NETWORK_FIRST + status_code;
-  } else {
-    hr = GOOPDATE_E_NETWORK_LAST;
-  }
-  ASSERT1(HRESULT_FACILITY(hr) == FACILITY_ITF);
-  return hr;
-}
-
-}  // namespace omaha
-
diff --git a/base/error.h b/base/error.h
deleted file mode 100644
index fad4aa0..0000000
--- a/base/error.h
+++ /dev/null
@@ -1,481 +0,0 @@
-// Copyright 2003-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Error codes and HRESULTS
-//
-// For all new error codes, please use the macro MAKE_OMAHA_HRESULT instead of
-// MAKE_HRESULT. This macro sets both the custom facility code of kFacilityOmaha
-// and the C bit (0x20000000) to indicate it is a customer code.
-//
-// TODO(omaha): reduce the number of custom error codes below by searching and
-// seeing what is handled and what is not.
-//
-// TODO(omaha): rename CI and GOOPDATE to OMAHA.
-
-#ifndef OMAHA_BASE_ERROR_H_
-#define OMAHA_BASE_ERROR_H_
-
-#include <windows.h>
-
-namespace omaha {
-
-//
-// Exception Codes.
-//
-#define EXCEPTION_IMPERSONATION_FAILED          0x1
-#define EXCEPTION_REVERT_IMPERSONATION_FAILED   0x2
-
-//
-// HRESULT Functions.
-//
-
-// Returns the last error as an HRESULT or E_FAIL if last error is NO_ERROR.
-// This is not a drop in replacement for the HRESULT_FROM_WIN32 macro.
-// The macro maps a NO_ERROR to S_OK, whereas the function below maps a
-// NO_ERROR to E_FAIL. Also, the macro is evaluating arguments multiple times.
-HRESULT HRESULTFromLastError();
-
-// Returns the http status_code as an HRESULT.
-HRESULT HRESULTFromHttpStatusCode(int status_code);
-
-//
-// HRESULTs.
-//
-// Top bit indicates success (0) or failure (1)
-// 16 bits available for 'code' field at end
-
-const ULONG kHresultCBit   = 0x20000000;
-const ULONG kFacilityOmaha = 67;
-
-#define MAKE_OMAHA_HRESULT(sev, code)                    \
-    ((HRESULT)(((ULONG)(sev) << 31) |            \
-               kHresultCBit |                            \
-               (kFacilityOmaha << 16) |                  \
-               ((ULONG)(code))))
-
-#define CI_E_NOT_ENOUGH_DISK_SPACE                \
-    MAKE_HRESULT(SEVERITY_ERROR, kFacilityOmaha, 0x0003)
-
-// CI_E_INVALID_MANIFEST is returned when the manifest file is missing a
-// required field or has some other kind of semantic error
-#define CI_E_INVALID_MANIFEST                     \
-    MAKE_HRESULT(SEVERITY_ERROR, kFacilityOmaha, 0x0012)
-
-// CI_E_XML_LOAD_ERROR is returned when MSXML can't load the document into DOM.
-// It may be because the document is not well formed (tags, namespaces, etc)
-#define CI_E_XML_LOAD_ERROR                       \
-    MAKE_HRESULT(SEVERITY_ERROR, kFacilityOmaha, 0x0013)
-
-// CI_E_INVALID_ARG is returned when invalid command line arugment is specified
-#define CI_E_INVALID_ARG                          \
-    MAKE_HRESULT(SEVERITY_ERROR, kFacilityOmaha, 0x001B)
-
-// CI_E_PROXY_AUTH_REQUIRED is returned when proxy authentication is required
-#define CI_E_PROXY_AUTH_REQUIRED                  \
-    MAKE_HRESULT(SEVERITY_ERROR, kFacilityOmaha, 0x0028)
-
-// CI_E_INVALID_PROXY_AUTH_SCHEME is returned when the proxy authentication
-// scheme is unknown or not supported
-#define CI_E_INVALID_PROXY_AUTH_SCHEME            \
-    MAKE_HRESULT(SEVERITY_ERROR, kFacilityOmaha, 0x0029)
-
-// CI_E_BITS_DISABLED is returned by the download manager when the BITS service
-// is not enabled.
-#define CI_E_BITS_DISABLED                        \
-    MAKE_HRESULT(SEVERITY_ERROR, kFacilityOmaha, 0x0030)
-
-// CI_E_HTTPS_CERT_FAILURE is returned when the https connection fails.
-// One cause of this is when the system clock is off by a significant
-// amount which makes the server certificate appear invalid.
-#define CI_E_HTTPS_CERT_FAILURE                   \
-    MAKE_HRESULT(SEVERITY_ERROR, kFacilityOmaha, 0x0035)
-
-// Return values from Process::WaitUntilDeadOrInterrupt
-// TODO(omaha) Move this constants to the Process class. They do not look like
-// error codes.
-#define CI_S_PROCESSWAIT_DEAD                     \
-    MAKE_HRESULT(SEVERITY_SUCCESS, kFacilityOmaha, 0x0100)
-#define CI_S_PROCESSWAIT_TIMEOUT                  \
-    MAKE_HRESULT(SEVERITY_SUCCESS, kFacilityOmaha, 0x0101)
-#define CI_S_PROCESSWAIT_MESSAGE                  \
-    MAKE_HRESULT(SEVERITY_SUCCESS, kFacilityOmaha, 0x0102)
-
-// Signatures error codes.
-#define SIGS_E_INVALID_PFX_CERTIFICATE            \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0200)
-#define SIGS_E_INVALID_DER_CERTIFICATE            \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0201)
-#define SIGS_E_INVALID_PASSWORD                   \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0202)
-#define SIGS_E_INVALID_KEY_TYPE                   \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0203)
-#define SIGS_E_INVALID_SIGNATURE                  \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0204)
-
-// Goopdate XML parser error codes.
-#define GOOPDATEXML_E_STRTOUINT                   \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x300)
-#define GOOPDATEXML_E_RESPONSENODE                \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x301)
-#define GOOPDATEXML_E_XMLVERSION                  \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x302)
-#define GOOPDATEXML_E_NEEDSADMIN                  \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x303)
-#define GOOPDATEXML_E_UNEXPECTED_URI              \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x304)
-#define GOOPDATEXML_E_TOO_MANY_APPS               \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x305)
-#define GOOPDATEXML_E_PARSE_ERROR                 \
-    MAKE_OMAHA_HRESULT(SEVERITY_ERROR, 0x306)
-
-// Goopdate job queue error codes.
-// Errors 0x401 - 0x407 are legacy codes and should not be reused.
-
-// Download Manager custom error codes.
-// Obsolete: GOOPDATEDOWNLOAD_E_FILE_ALREADY_DOWNLOADED - 0x500.
-// Obsolete: GOOPDATEDOWNLOAD_E_FAILED_GET_ERROR - 0x501.
-#define GOOPDATEDOWNLOAD_E_INVALID_PATH             \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x502)
-#define GOOPDATEDOWNLOAD_E_CRACKURL_FAILED          \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x503)
-#define GOOPDATEDOWNLOAD_E_FILE_NAME_EMPTY          \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x504)
-#define GOOPDATEDOWNLOAD_E_DEST_FILE_PATH_EMPTY     \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x505)
-#define GOOPDATEDOWNLOAD_E_STORAGE_DIR_NOT_EXIST    \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x506)
-#define GOOPDATEDOWNLOAD_E_FILE_SIZE_ZERO           \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x507)
-#define GOOPDATEDOWNLOAD_E_FILE_SIZE_SMALLER        \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x508)
-#define GOOPDATEDOWNLOAD_E_FILE_SIZE_LARGER         \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x509)
-#define GOOPDATEDOWNLOAD_E_UNIQUE_FILE_PATH_EMPTY   \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x50A)
-#define GOOPDATEDOWNLOAD_E_DEST_PATH_EMPTY          \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x50B)
-#define GOOPDATEDOWNLOAD_E_DEST_FILENAME_EMPTY      \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x50C)
-
-// The file could not be cached.
-#define GOOPDATEDOWNLOAD_E_CACHING_FAILED           \
-    MAKE_OMAHA_HRESULT(SEVERITY_ERROR, 0x50D)
-
-#define GOOPDATEDOWNLOAD_E_FAILED_MOVE              \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x5FF)
-
-// Goopdate custom error codes.
-// Obsolete: GOOPDATE_E_NON_ADMINS_CANNOT_INSTALL_ADMIN - 0x600.
-// Obsolete: GOOPDATE_S_WORKER_ALREADY_RUNNING  - 0x601.
-// Obsolete: GOOPDATE_E_INVALID_ARG_COMBINATION - 0x602.
-#define GOOPDATE_E_UA_ALREADY_RUNNING               \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x603)
-#define GOOPDATE_E_APP_BEING_INSTALLED              \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x604)
-#define GOOPDATE_E_RESOURCE_DLL_PATH_EMPTY          \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x605)
-#define GOOPDATE_E_NO_ARGS                          \
-    MAKE_OMAHA_HRESULT(SEVERITY_ERROR, 0x606)
-#define GOOPDATE_E_SHUTDOWN_SIGNALED                \
-    MAKE_OMAHA_HRESULT(SEVERITY_ERROR, 0x607)
-
-// Setup and metainstaller custom error codes.
-#define GOOPDATE_E_NONADMIN_INSTALL_ADMIN_APP       \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x700)
-// Obsolete: GOOPDATE_E_MANIFEST_FILENAME_EMPTY - 0x701.
-// Obsolete: GOOPDATE_E_MANIFEST_FILE_DOES_NOT_EXIST - 0x702.
-// This error appears in the metainstaller.
-#define GOOPDATE_E_RUNNING_INFERIOR_WINDOWS         \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x703)
-#define GOOPDATE_E_RUNNING_INFERIOR_MSXML           \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x704)
-// Obsolete: GOOPDATE_E_ELEVATION_FAILED     - 0x705
-#define GOOPDATE_E_FAILED_TO_GET_LOCK               \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x706)
-#define GOOPDATE_E_INSTANCES_RUNNING                \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x707)
-#define GOOPDATE_E_HANDOFF_FAILED                   \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x708)
-#define GOOPDATE_E_PATH_APPEND_FAILED               \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x709)
-// Obsolete: GOOPDATE_E_SERVICE_NAME_EMPTY     - 0x70a
-#define GOOPDATE_E_SETUP_LOCK_INIT_FAILED           \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x70b)
-#define GOOPDATE_E_ACCESSDENIED_COPYING_CORE_FILES  \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x70c)
-#define GOOPDATE_E_ACCESSDENIED_COPYING_SHELL       \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x70d)
-#define GOOPDATE_E_ACCESSDENIED_STOP_PROCESSES      \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x70e)
-#define GOOPDATE_E_ACCESSDENIED_SETUP_REG_ACCESS    \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x70f)
-// User may have accidentally run the metainstaller twice.
-#define GOOPDATE_E_FAILED_TO_GET_LOCK_MATCHING_INSTALL_PROCESS_RUNNING  \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x710)
-#define GOOPDATE_E_FAILED_TO_GET_LOCK_NONMATCHING_INSTALL_PROCESS_RUNNING \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x711)
-#define GOOPDATE_E_FAILED_TO_GET_LOCK_UPDATE_PROCESS_RUNNING  \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x712)
-#define GOOPDATE_E_VERIFY_SIGNEE_IS_GOOGLE_FAILED   \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x713)
-// Obsolete: GOOPDATE_E_VERIFY_SIGNEE_IS_GOOGLE_FAILED_TIMESTAMP_CHECK - 0x714.
-#define GOOPDATE_E_INSTALL_ELEVATED_PROCESS_NEEDS_ELEVATION \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x715)
-#define GOOPDATE_E_ELEVATION_FAILED_ADMIN           \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x716)
-#define GOOPDATE_E_ELEVATION_FAILED_NON_ADMIN       \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x717)
-#define GOOPDATE_E_CANT_UNINSTALL                   \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x718)
-#define GOOPDATE_E_SILENT_INSTALL_NEEDS_ELEVATION   \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x719)
-#define GOOPDATE_E_OEM_NOT_MACHINE_AND_PRIVILEGED_AND_AUDIT_MODE  \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x71a)
-#define GOOPDATE_E_OEM_WITH_ONLINE_INSTALLER        \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x71b)
-// Obsolete: GOOPDATE_E_NON_OEM_INSTALL_IN_AUDIT_MODE - 0x71c
-#define GOOPDATE_E_OEM_INSTALL_SUCCEEDED_BUT_NOT_IN_OEM_INSTALLING_MODE \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x71d)
-#define GOOPDATE_E_EULA_REQURED_WITH_ONLINE_INSTALLER \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x71e)
-#define GOOPDATE_E_COM_LOCAL_SERVER_REGISTER_FAILED \
-    MAKE_OMAHA_HRESULT(SEVERITY_ERROR, 0x71f)
-#define GOOPDATE_E_USER_AND_ELEVATED_WITH_UAC_ON    \
-    MAKE_OMAHA_HRESULT(SEVERITY_ERROR, 0x720)
-#define GOOPDATE_E_FAILED_TO_GET_LOCK_UNINSTALL_PROCESS_RUNNING  \
-    MAKE_OMAHA_HRESULT(SEVERITY_ERROR, 0x721)
-#define GOOPDATE_E_POST_COPY_VERIFICATION_FAILED    \
-    MAKE_OMAHA_HRESULT(SEVERITY_ERROR, 0x722)
-
-// Metainstaller custom error codes.
-#define GOOPDATE_E_UNTAGGED_METAINSTALLER           \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x750)
-
-// COM Server error codes.
-// Obsolete: GOOPDATE_E_NO_SERVER_RESPONSE   - 0x800.
-#define GOOPDATE_E_NO_NETWORK \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x801)
-// Obsolete: GOOPDATE_E_UPDATE_CHECK_FAILED  - 0x802.
-// Obsolete: GOOPDATE_COULD_NOT_GET_IGOOGLEUPDATE - 0x803.
-// Obsolete: GOOPDATE_E_BAD_SERVER_RESPONSE  - 0x804.
-#define GOOPDATE_E_UNKNOWN_SERVER_RESPONSE          \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x805)
-#define GOOPDATE_E_RESTRICTED_SERVER_RESPONSE       \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x806)
-// Obsolete: GOOPDATE_E_ONECLICK_HOSTCHECK_FAILED - 0x807.
-// Obsolete: GOOPDATE_E_ABANDON_UPDATE       - 0x808.
-#define GOOPDATE_E_NO_UPDATE_RESPONSE               \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x809)
-// Obsolete: GOOPDATE_E_BUNDLE_ERROR         - 0x80A.
-// Obsolete: GOOPDATE_E_APP_UNINSTALLED      - 0x80B.
-// Obsolete: GOOPDATE_E_CALL_INPROGRESS      - 0x80C.
-#define GOOPDATE_E_UNKNOWN_APP_SERVER_RESPONSE      \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x80D)
-#define GOOPDATE_E_INTERNAL_ERROR_SERVER_RESPONSE   \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x80E)
-#define GOOPDATE_E_NO_SERVER_RESPONSE               \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x80F)
-#define GOOPDATE_E_CANCELLED                 \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x810)
-#define GOOPDATE_E_OS_NOT_SUPPORTED                 \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x811)
-#define GOOPDATE_E_APP_INSTALL_DISABLED_BY_POLICY   \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x812)
-#define GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY    \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x813)
-// Obsolete: GOOPDATE_E_APP_NOT_REGISTERED   - 0x814.
-#define GOOPDATE_E_CANNOT_USE_NETWORK               \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x815)
-#define GOOPDATE_E_APP_UPDATE_DISABLED_EULA_NOT_ACCEPTED  \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x816)
-#define GOOPDATE_E_NON_BLOCKING_CALL_PENDING        \
-    MAKE_OMAHA_HRESULT(SEVERITY_ERROR, 0x817)
-#define GOOPDATE_E_INVALID_STATE_TRANSITION         \
-    MAKE_OMAHA_HRESULT(SEVERITY_ERROR, 0x818)
-#define GOOPDATE_E_CALL_UNEXPECTED                  \
-    MAKE_OMAHA_HRESULT(SEVERITY_ERROR, 0x819)
-// TODO(omaha): Rename other SERVER_RESPONSE errors to match these.
-#define GOOPDATE_E_SERVER_RESPONSE_NO_HASH          \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x81a)
-#define GOOPDATE_E_SERVER_RESPONSE_UNSUPPORTED_PROTOCOL \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x81b)
-#define GOOPDATE_E_UPDATE_DEFERRED                      \
-    MAKE_OMAHA_HRESULT(SEVERITY_ERROR, 0x81c)
-
-//
-// Network stack error codes.
-//
-
-// The CUP response is missing the ETag header containing the server proof.
-#define OMAHA_NET_E_CUP_NO_SERVER_PROOF            \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x880)
-
-// The CUP response is not trusted.
-#define OMAHA_NET_E_CUP_NOT_TRUSTED                \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x881)
-// Obsolete: OMAHA_NET_E_REQUEST_CANCELLED   - 0x882.
-
-// CUP could not instantiate an http client.
-#define OMAHA_NET_E_CUP_NO_HTTP_CLIENT              \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x883)
-
-// CUP could not generate random bytes.
-#define OMAHA_NET_E_CUP_NO_ENTROPY                  \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x884)
-
-// Non-CUP network errors.
-#define OMAHA_NET_E_WINHTTP_NOT_AVAILABLE           \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x890)
-
-// Install Manager custom error codes.
-#define GOOPDATEINSTALL_E_FILENAME_INVALID         \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x900)
-#define GOOPDATEINSTALL_E_INSTALLER_FAILED_START   \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x901)
-#define GOOPDATEINSTALL_E_INSTALLER_FAILED         \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x902)
-#define GOOPDATEINSTALL_E_INSTALLER_INTERNAL_ERROR \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x903)
-#define GOOPDATEINSTALL_E_INSTALLER_TIMED_OUT      \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x904)
-#define GOOPDATEINSTALL_E_INSTALLER_DID_NOT_WRITE_CLIENTS_KEY \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x905)
-#define GOOPDATEINSTALL_E_FAILED_INIT_INSTALLER_LOCK          \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x906)
-#define GOOPDATEINSTALL_E_MSI_INSTALL_ALREADY_RUNNING         \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x907)
-#define GOOPDATEINSTALL_E_INSTALLER_DID_NOT_CHANGE_VERSION    \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x908)
-#define GOOPDATE_E_INVALID_INSTALL_DATA_INDEX                 \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x909)
-#define GOOPDATE_E_INVALID_INSTALLER_DATA_IN_APPARGS          \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x90A)
-#define GOOPDATEINSTALL_E_INSTALLER_VERSION_MISMATCH  \
-    MAKE_OMAHA_HRESULT(SEVERITY_ERROR, 0x90B)
-
-// GoopdateUtils custom error codes.
-#define GOOPDATEUTILS_E_BROWSERTYPE                 \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA00)
-
-// GoogleUpdate.exe shell custom error codes.
-#define GOOGLEUPDATE_E_DLL_NOT_FOUND           \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xB00)
-#define GOOGLEUPDATE_E_VERIFY_SIGNEE_IS_GOOGLE_FAILED \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xB01)
-
-// Command line parse custom error codes.
-#define GOOGLEUPDATE_COMMANDLINE_E_NO_SCENARIO_HANDLER \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xC00)
-#define GOOGLEUPDATE_COMMANDLINE_E_NO_SCENARIO_HANDLER_MATCHED \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xC01)
-
-// OneClick custom error codes
-#define GOOPDATE_E_ONECLICK_HOSTCHECK_FAILED        \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xD01)
-#define GOOPDATE_E_ONECLICK_LANGUAGE_NOT_SUPPORTED  \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xD02)
-
-// Usage stats / metrics error codes
-#define GOOPDATE_E_METRICS_LOCK_INIT_FAILED         \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xD80)
-#define GOOPDATE_E_METRICS_AGGREGATE_FAILED         \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xD81)
-
-// Core error codes
-#define GOOPDATE_E_CORE_INTERNAL_ERROR              \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xE00)
-#define GOOPDATE_E_CORE_MISSING_CMD                 \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xE01)
-
-// UI & Observer error codes
-#define GOOPDATE_E_UI_INTERNAL_ERROR                \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xE80)
-#define GOOPDATE_E_OBSERVER_PROGRESS_WND_EVENTS_NULL  \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xE81)
-
-// ApplyTagTool error codes.
-#define APPLYTAG_E_ALREADY_TAGGED                   \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x1000)
-
-// The range [0x2000, 0x2400) is reserved for certain network stack errors
-// when the server returns an HTTP result code that is not a success code.
-// The size of the range is 1024, which is enough to map all the HTTP result
-// codes.
-#define GOOPDATE_E_NETWORK_FIRST                            \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x2000)
-
-// Http Status Code 401 -- Unauthorized.
-#define GOOPDATE_E_NETWORK_UNAUTHORIZED                     \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x2191)
-
-// Http Status Code 403 -- Forbidden.
-#define GOOPDATE_E_NETWORK_FORBIDDEN                        \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x2193)
-
-// Http Status Code 407 -- Proxy Authentication Required.
-#define GOOPDATE_E_NETWORK_PROXYAUTHREQUIRED                \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x2197)
-
-#define GOOPDATE_E_NETWORK_LAST                             \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x23FF)
-
-// Shared Memory Proxy error codes.
-#define GOOPDATE_E_INVALID_SHARED_MEMORY_PTR                \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x2401)
-#define GOOPDATE_E_INVALID_INTERFACE_MARSHAL_SIZE           \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x2402)
-
-// Crash handling error codes.
-
-// The crash reporting cannot start the crash server for
-// out-of-process crash handling.
-#define GOOPDATE_E_CRASH_START_SERVER_FAILED                 \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFFFA)
-
-// The crash reporting cannot set the security descriptors for
-// a securable object.
-#define GOOPDATE_E_CRASH_SECURITY_FAILED                     \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFFFB)
-
-// The crash reporting could not get the crash reports dir.
-#define GOOPDATE_E_CRASH_NO_DIR                             \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFFFC)
-
-// The crash reporting failed due to the client side metering of the crashes.
-#define GOOPDATE_E_CRASH_THROTTLED                          \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFFFD)
-
-// The crash reporting failed due to the server rejecting the crash.
-#define GOOPDATE_E_CRASH_REJECTED                           \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFFFE)
-
-// Goopdate crash. The error code is returned when the process is terminated
-// due to a crash handled by breakpad.
-#define GOOPDATE_E_CRASH                            \
-    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFFFF)
-
-
-// This is the end of the range for FACILITY_ITF errors. Do not define errors
-// below.
-
-// Gets or sets the value of the extra code. Use this feature to convey
-// additional error information in canary builds.
-int error_extra_code1();
-void set_error_extra_code1(int extra_code);
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_ERROR_H_
-
diff --git a/base/error_unittest.cc b/base/error_unittest.cc
deleted file mode 100644
index 91bfc2c..0000000
--- a/base/error_unittest.cc
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/base/error.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(ErrorTest, HRESULTFromLastError) {
-  ::SetLastError(ERROR_ACCESS_DENIED);
-  EXPECT_EQ(HRESULTFromLastError(), E_ACCESSDENIED);
-
-  ::SetLastError(static_cast<DWORD>(E_INVALIDARG));
-  EXPECT_EQ(HRESULTFromLastError(), E_INVALIDARG);
-}
-
-TEST(ErrorTest, HRESULTFromLastErrorAssert) {
-  ExpectAsserts expect_asserts;
-  ::SetLastError(0);
-  EXPECT_EQ(HRESULTFromLastError(), E_FAIL);
-}
-
-}  // namespace omaha
-
diff --git a/base/etw_log_writer.cc b/base/etw_log_writer.cc
deleted file mode 100644
index 6925082..0000000
--- a/base/etw_log_writer.cc
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// ETW log writer implementation.
-
-#include "omaha/base/etw_log_writer.h"
-
-namespace omaha {
-
-// {9B18BFF9-915E-4cc1-9C3E-F4AC112CB36C}
-const GUID EtwLogWriter::kOmahaTraceGuid =
-    { 0x9b18bff9, 0x915e, 0x4cc1,
-        { 0x9c, 0x3e, 0xf4, 0xac, 0x11, 0x2c, 0xb3, 0x6c } };
-
-const GUID EtwLogWriter::kLogEventId =
-    { 0x7fe69228, 0x633e, 0x4f06,
-        { 0x80, 0xc1, 0x52, 0x7f, 0xea, 0x23, 0xe3, 0xa7 } };
-
-EtwLogWriter::EtwLogWriter(const GUID& provider_guid)
-    : EtwTraceProvider(provider_guid),
-      rtl_capture_stack_backtrace_(NULL) {
-  HMODULE kernel32 = ::GetModuleHandle(L"kernel32.dll");
-  if (kernel32 != NULL) {
-    rtl_capture_stack_backtrace_ =
-        reinterpret_cast<RtlCaptureStackBackTraceFunc>(
-            ::GetProcAddress(kernel32, "RtlCaptureStackBackTrace"));
-  }
-
-  EtwTraceProvider::Register();
-}
-
-void EtwLogWriter::Cleanup() {
-  EtwTraceProvider::Unregister();
-}
-
-EtwLogWriter* EtwLogWriter::Create() {
-  return new EtwLogWriter(kOmahaTraceGuid);
-}
-
-bool EtwLogWriter::WantsToLogRegardless() const {
-  return session_handle() != 0;
-}
-
-bool EtwLogWriter::IsCatLevelEnabled(LogCategory category,
-                                     LogLevel level) const {
-  if ((enable_flags() & CategoryToEnableFlag(category)) == 0 ||
-      enable_level() < LogLevelToTraceLevel(level))
-    return false;
-
-  return true;
-}
-
-void EtwLogWriter::OutputMessage(const OutputInfo* output_info) {
-  if (!IsCatLevelEnabled(output_info->category, output_info->level))
-    return;
-
-  CStringA msg1(output_info->msg1);
-  CStringA msg2(output_info->msg2);
-  EtwEventLevel level = LogLevelToTraceLevel(output_info->level);
-  if (enable_flags() & kCaptureStackTraceMask) {
-    void* back_trace[32] = {0};
-    DWORD depth = 0;
-
-    if (rtl_capture_stack_backtrace_) {
-      depth = rtl_capture_stack_backtrace_(0,
-                                           arraysize(back_trace),
-                                           back_trace,
-                                           NULL);
-    }
-
-    EtwMofEvent<4> mof_event(kLogEventId, kLogMessageWithStackTraceType, level);
-    mof_event.SetField(0, sizeof(depth), &depth);
-    mof_event.SetField(1, depth * sizeof(back_trace[0]), &back_trace);
-    mof_event.SetField(2, msg1.GetLength(), msg1.GetString());
-    mof_event.SetField(3, msg2.GetLength() + 1, msg2.GetString());
-    Log(mof_event.get());
-  } else {
-    EtwMofEvent<2> mof_event(kLogEventId, kLogMessageType, level);
-    mof_event.SetField(0, msg1.GetLength(), msg1.GetString());
-    mof_event.SetField(1, msg2.GetLength() + 1, msg2.GetString());
-    Log(mof_event.get());
-  }
-}
-
-void EtwLogWriter::OnEventsEnabled() {
-  CORE_LOG(L2, (_T("ETW logging enabled")));
-}
-
-void EtwLogWriter::OnEventsDisabled() {
-  CORE_LOG(L2, (_T("ETW logging disabled")));
-}
-
-EtwEventFlags EtwLogWriter::CategoryToEnableFlag(LogCategory category) {
-  // Bit zero is reserved for the capture stack trace enable flag.
-  return 1 << (category + 1);
-}
-
-EtwEventLevel EtwLogWriter::LogLevelToTraceLevel(LogLevel level) {
-  switch (level) {
-    case LEVEL_FATALERROR:
-      return TRACE_LEVEL_FATAL;
-    case LEVEL_ERROR:
-      return TRACE_LEVEL_ERROR;
-    case LEVEL_WARNING:
-      return TRACE_LEVEL_WARNING;
-    case L1:
-    case L2:
-      return TRACE_LEVEL_INFORMATION;
-    case L3:
-    case L4:
-    case L5:
-    case L6:
-      return TRACE_LEVEL_VERBOSE;
-
-    case LEVEL_ALL:
-    default:
-      return TRACE_LEVEL_NONE;
-  }
-
-  // NOTREACHED
-}
-
-}  // namespace omaha
diff --git a/base/etw_log_writer.h b/base/etw_log_writer.h
deleted file mode 100644
index 0aae9c9..0000000
--- a/base/etw_log_writer.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// A log writer that is controlled, and outputs to Event Tracing for Windows.
-
-#ifndef OMAHA_BASE_ETW_LOG_WRITER_H_
-#define OMAHA_BASE_ETW_LOG_WRITER_H_
-
-#include "omaha/base/event_trace_provider.h"
-#include "omaha/base/logging.h"
-
-namespace omaha {
-
-class EtwLogWriter : public LogWriter, public EtwTraceProvider {
- public:
-  // The Omaha trace provider's GUID.
-  static const GUID kOmahaTraceGuid;
-
-  // The event ID for the event types below.
-  static const GUID kLogEventId;
-
-  // The event type for a simple UTF-8 zero-terminated message event.
-  static const EtwEventType kLogMessageType = 10;
-
-  // The event type for a log message with a stack trace, followed by the
-  // zero-terminated UTF-8 message text.
-  static const EtwEventType kLogMessageWithStackTraceType = 11;
-
-  // The lowest-order enable flags bit turn on stack trace capture.
-  // The remaining enable bits correspond to log categories, starting
-  // from LC_LOGGING through LC_MAX_CAT - 1.
-  static const EtwEventFlags kCaptureStackTraceMask = 0x0001;
-
-  // LogWriter overrides.
-  virtual bool WantsToLogRegardless() const;
-  virtual bool IsCatLevelEnabled(LogCategory category, LogLevel level) const;
-  virtual void OutputMessage(const OutputInfo* output_info);
-
-  // Factory for new instances.
-  static EtwLogWriter* Create();
-
-  // Convert a log category to the corresponding ETW enable flag.
-  static EtwEventFlags CategoryToEnableFlag(LogCategory category);
-
-  // Convert from a log level to the corresponding ETW trace level.
-  static EtwEventLevel LogLevelToTraceLevel(LogLevel level);
-
- protected:
-  explicit EtwLogWriter(const GUID& provider_guid);
-  virtual void Cleanup();
-
-  // Override from EtwTraceProvider.
-  virtual void OnEventsEnabled();
-  virtual void OnEventsDisabled();
-
- private:
-  // The CaptureStackBackTrace function is only available as of Windows XP,
-  // and is only declared in SDK headers as of the Vista SDK. To uncomplicate
-  // things we get at the function through GetProcAddress.
-  typedef WORD (NTAPI* RtlCaptureStackBackTraceFunc)(DWORD frames_to_skip,
-                                                     DWORD frames_to_capture,
-                                                     PVOID* backtrace,
-                                                     PDWORD backtrace_hash);
-
-  RtlCaptureStackBackTraceFunc rtl_capture_stack_backtrace_;
-
-  DISALLOW_COPY_AND_ASSIGN(EtwLogWriter);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_ETW_LOG_WRITER_H_
diff --git a/base/etw_log_writer_unittest.cc b/base/etw_log_writer_unittest.cc
deleted file mode 100644
index 0a5a0de..0000000
--- a/base/etw_log_writer_unittest.cc
+++ /dev/null
@@ -1,563 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// ETW log writer unittests.
-
-#include <atlbase.h>
-#include <atlstr.h>
-#include <atlsync.h>
-#include "omaha/base/app_util.h"
-#include "omaha/base/etw_log_writer.h"
-#include "omaha/base/event_trace_consumer.h"
-#include "omaha/base/event_trace_controller.h"
-#include "omaha/testing/unit_test.h"
-
-
-namespace {
-
-using omaha::EtwEventType;
-using omaha::EtwLogWriter;
-using omaha::EtwTraceConsumerBase;
-using testing::StrEq;
-
-class TestConsumer : public EtwTraceConsumerBase<TestConsumer> {
- public:
-  TestConsumer() {
-    EXPECT_EQ(NULL, s_current_);
-    s_current_ = this;
-  }
-
-  ~TestConsumer() {
-    EXPECT_TRUE(this == s_current_);
-    s_current_ = NULL;
-  }
-
-  MOCK_METHOD1(OnLogMessage, void(const char* msg));
-
-  void ProcessLogEvent(EtwEventType type, const void* data, size_t data_len) {
-    data_len;  // Unused
-    if (type == EtwLogWriter::kLogMessageType) {
-      OnLogMessage(reinterpret_cast<const char*>(data));
-    } else if (type == EtwLogWriter::kLogMessageWithStackTraceType) {
-      const DWORD* depth = reinterpret_cast<const DWORD*>(data);
-      void* const* stack_trace = reinterpret_cast<void* const*>(depth + 1);
-      OnLogMessage(reinterpret_cast<const char*>(stack_trace + *depth));
-    } else {
-      FAIL() << "Unexpected message type " << type;
-    }
-  }
-
-  static void ProcessEvent(EVENT_TRACE* event) {
-    if (event->Header.Guid == EtwLogWriter::kLogEventId) {
-      s_current_->ProcessLogEvent(event->Header.Class.Type,
-                                  event->MofData,
-                                  event->MofLength);
-    }
-  }
-
- private:
-  static TestConsumer* s_current_;
-};
-
-TestConsumer* TestConsumer::s_current_ = NULL;
-
-const wchar_t kTestSessionName[] = L"EtwLogWriterTest Session";
-// {AD914B7A-0C5F-426e-895C-58B125408125}
-const GUID kTestProviderGuid = { 0xad914b7a, 0xc5f, 0x426e,
-    { 0x89, 0x5c, 0x58, 0xb1, 0x25, 0x40, 0x81, 0x25 } };
-
-// Subclass to allow using a distinct provider GUID and overriding
-// event handlers.
-class TestingLogWriter: public EtwLogWriter {
- public:
-  TestingLogWriter() : EtwLogWriter(kTestProviderGuid) {
-    EXPECT_TRUE(events_enabled_.Create(NULL, TRUE, FALSE, NULL));
-    EXPECT_TRUE(events_disabled_.Create(NULL, TRUE, FALSE, NULL));
-  }
-
-  void WaitUntilEnabled() {
-    // Wait for a the callback to hit, then reset the event.
-    EXPECT_EQ(WAIT_OBJECT_0,
-              ::WaitForSingleObject(events_enabled_, INFINITE));
-    EXPECT_TRUE(::ResetEvent(events_enabled_));
-  }
-
-  void WaitUntilDisabled() {
-    // Wait for a the callback to hit, then reset the event.
-    EXPECT_EQ(WAIT_OBJECT_0,
-              ::WaitForSingleObject(events_disabled_, INFINITE));
-    EXPECT_TRUE(::ResetEvent(events_disabled_));
-  }
-
-  ~TestingLogWriter() {
-    // We explicitly call Cleanup() here so that the ETW provider will
-    // be torn down before the CEvent destructors are called.  We had
-    // issues with the test failing spuriously because the provider
-    // teardown is done on a separate thread, and would attempt to call
-    // OnEventsDisabled() after the event handles had been released.
-    // (http://b/2873205)
-
-    Cleanup();
-  }
-
- protected:
-  // Override from EtwTraceProvider.
-  virtual void OnEventsEnabled() {
-    EtwLogWriter::OnEventsEnabled();
-    events_enabled_.Set();
-  }
-
-  virtual void OnEventsDisabled() {
-    EtwLogWriter::OnEventsDisabled();
-    events_disabled_.Set();
-  }
-
-  CEvent events_enabled_;
-  CEvent events_disabled_;
-};
-
-}  // namespace
-
-namespace omaha {
-
-class EtwLogWriterTest: public testing::Test {
- public:
-  EtwLogWriterTest() : counter_(0) {
-  }
-
-  virtual void SetUp() {
-    // Kill any dangling trace session.
-    EtwTraceProperties prop;
-    EtwTraceController::Stop(kTestSessionName, &prop);
-
-    // And create a session on a new temp file.
-    EXPECT_TRUE(::GetTempFileName(app_util::GetTempDir(), _T("tmp"), 0,
-                                  CStrBuf(temp_file_, MAX_PATH)));
-
-    EXPECT_HRESULT_SUCCEEDED(
-        controller_.StartFileSession(kTestSessionName, temp_file_, false));
-  }
-
-  virtual void TearDown() {
-    if (controller_.session() != NULL) {
-      EXPECT_HRESULT_SUCCEEDED(controller_.Stop(NULL));
-      EXPECT_TRUE(::DeleteFile(temp_file_));
-    }
-  }
-
-  // Asserts that enabling ETW logging at trace_level causes
-  // logging at log_level to be enabled.
-  void ExpectLogLevelEnabled(EtwEventLevel trace_level, LogLevel log_level) {
-    TestingLogWriter writer;
-    EXPECT_HRESULT_SUCCEEDED(
-        controller_.EnableProvider(kTestProviderGuid,
-                                   trace_level,
-                                   0xFFFFFFFF)) <<
-    _T("[trace level: ") << static_cast<uint16>(trace_level) <<
-    _T("][log level: ") << log_level << _T("]");
-    writer.WaitUntilEnabled();
-    EXPECT_EQ(true, writer.IsCatLevelEnabled(LC_LOGGING, log_level));
-  }
-
-  // Asserts that enabling ETW logging at trace_level causes
-  // logging at log_level to be disabled.
-  void ExpectLogLevelDisabled(EtwEventLevel trace_level, LogLevel log_level) {
-    TestingLogWriter writer;
-    EXPECT_HRESULT_SUCCEEDED(
-        controller_.EnableProvider(kTestProviderGuid,
-                                   trace_level,
-                                   0xFFFFFFFF)) <<
-    _T("[trace level: ") << static_cast<uint16>(trace_level) <<
-    _T("][log level: ") << log_level << _T("]");
-    writer.WaitUntilEnabled();
-    EXPECT_EQ(false, writer.IsCatLevelEnabled(LC_LOGGING, log_level));
-  }
-
-  void ExpectLogMessage(EtwEventLevel trace_level,
-                        EtwEventFlags enable_bits,
-                        LogLevel log_level,
-                        LogCategory log_cat,
-                        bool should_log) {
-    TestingLogWriter writer;
-    EXPECT_HRESULT_SUCCEEDED(
-        controller_.EnableProvider(kTestProviderGuid,
-                                   trace_level,
-                                   enable_bits)) <<
-    _T("[trace level: ") << static_cast<uint16>(trace_level) <<
-    _T("][flags: 0x") << std::hex << enable_bits << std::dec <<
-    _T("][log level: ") << log_level <<
-    _T("][category: ") << log_cat <<
-    _T("][should_log: ") << should_log << _T("]");
-    writer.WaitUntilEnabled();
-
-    CString message;
-    message.Format(L"[%d][%d][0x%08X][%d][%d]",
-                   ++counter_,  // Make each expectation call unique.
-                   trace_level,
-                   enable_bits,
-                   log_level,
-                   log_cat);
-    OutputInfo info(log_cat, log_level, L"[Prefix]", message);
-    writer.OutputMessage(&info);
-
-    CStringA expected_msg("[Prefix]");
-    expected_msg += message;
-    // Set up an expectation for zero or one calls with this string,
-    // depending whether should_log or not.
-    EXPECT_CALL(consumer_, OnLogMessage(StrEq(expected_msg.GetString())))
-        .Times(should_log ? 1 : 0);
-  }
-
-  void ConsumeAndRestartLog() {
-    EXPECT_HRESULT_SUCCEEDED(controller_.Stop(NULL));
-
-    EXPECT_HRESULT_SUCCEEDED(consumer_.OpenFileSession(temp_file_));
-    EXPECT_HRESULT_SUCCEEDED(consumer_.Consume());
-    EXPECT_HRESULT_SUCCEEDED(consumer_.Close());
-
-    EXPECT_TRUE(::DeleteFile(temp_file_));
-
-    // Restart the log collection.
-    EXPECT_HRESULT_SUCCEEDED(
-        controller_.StartFileSession(kTestSessionName, temp_file_, false));
-  }
-
- protected:
-  EtwTraceController controller_;
-  TestConsumer consumer_;
-  CString temp_file_;
-  int counter_;
-};
-
-TEST_F(EtwLogWriterTest, ProviderNotEnabled) {
-  // Verify that everything is turned off when the provider is not enabled.
-  TestingLogWriter writer;
-
-  EXPECT_FALSE(writer.WantsToLogRegardless());
-  for (int cat = LC_LOGGING; cat < LC_MAX_CAT; ++cat) {
-    for (int level = LEVEL_FATALERROR; level < LEVEL_ALL; ++level) {
-      EXPECT_EQ(false, writer.IsCatLevelEnabled(static_cast<LogCategory>(cat),
-                                                static_cast<LogLevel>(level)));
-    }
-  }
-}
-
-TEST_F(EtwLogWriterTest, ProviderEnableFlags) {
-  // Test that various provider enable flags have the expected effect on
-  // IsCatLevelEnabled.
-  for (int cat = LC_LOGGING; cat < LC_MAX_CAT; ++cat) {
-    EtwEventFlags flags = 1 << (cat + 1);
-
-    TestingLogWriter writer;
-    EXPECT_HRESULT_SUCCEEDED(
-        controller_.EnableProvider(kTestProviderGuid,
-                                   TRACE_LEVEL_INFORMATION,
-                                   flags)) <<
-    _T("cat[") << cat << _T("]: 0x") << std::hex << flags;
-    writer.WaitUntilEnabled();
-
-    for (int probe = LC_LOGGING; probe < LC_MAX_CAT; ++probe) {
-      bool category_enabled = probe == cat;
-      EXPECT_EQ(category_enabled,
-                writer.IsCatLevelEnabled(static_cast<LogCategory>(probe),
-                                         LEVEL_ERROR));
-    }
-  }
-}
-
-// On Windows XP, it appears that 32 enable/disable trace level operations
-// saturates some sort of a buffer, which causes the subsequent enable/disable
-// operations to fail. To work around this, the following tests are chopped up
-// into unnaturally small pieces.
-TEST_F(EtwLogWriterTest, ProviderLevel) {
-  // Test that various trace levels have the expected effect on
-  // IsCatLevelEnabled.
-
-  // TRACE_LEVEL_NONE
-  ExpectLogLevelDisabled(TRACE_LEVEL_NONE, LEVEL_FATALERROR);
-  ExpectLogLevelDisabled(TRACE_LEVEL_NONE, LEVEL_ERROR);
-  ExpectLogLevelDisabled(TRACE_LEVEL_NONE, LE);
-  ExpectLogLevelDisabled(TRACE_LEVEL_NONE, LEVEL_WARNING);
-  ExpectLogLevelDisabled(TRACE_LEVEL_NONE, LW);
-  ExpectLogLevelDisabled(TRACE_LEVEL_NONE, L1);
-  ExpectLogLevelDisabled(TRACE_LEVEL_NONE, L2);
-  ExpectLogLevelDisabled(TRACE_LEVEL_NONE, L3);
-  ExpectLogLevelDisabled(TRACE_LEVEL_NONE, L4);
-  ExpectLogLevelDisabled(TRACE_LEVEL_NONE, L5);
-  ExpectLogLevelDisabled(TRACE_LEVEL_NONE, L6);
-  ConsumeAndRestartLog();
-
-  if (!ShouldRunLargeTest()) {
-    // This test takes about 6 seconds, so only run part of it by default.
-    return;
-  }
-
-  // TRACE_LEVEL_FATAL
-  ExpectLogLevelEnabled(TRACE_LEVEL_FATAL, LEVEL_FATALERROR);
-  ExpectLogLevelDisabled(TRACE_LEVEL_FATAL, LEVEL_ERROR);
-  ExpectLogLevelDisabled(TRACE_LEVEL_FATAL, LE);
-  ExpectLogLevelDisabled(TRACE_LEVEL_FATAL, LEVEL_WARNING);
-  ExpectLogLevelDisabled(TRACE_LEVEL_FATAL, LW);
-  ExpectLogLevelDisabled(TRACE_LEVEL_FATAL, L1);
-  ExpectLogLevelDisabled(TRACE_LEVEL_FATAL, L2);
-  ExpectLogLevelDisabled(TRACE_LEVEL_FATAL, L3);
-  ExpectLogLevelDisabled(TRACE_LEVEL_FATAL, L4);
-  ExpectLogLevelDisabled(TRACE_LEVEL_FATAL, L5);
-  ExpectLogLevelDisabled(TRACE_LEVEL_FATAL, L6);
-  ConsumeAndRestartLog();
-
-  // TRACE_LEVEL_ERROR
-  ExpectLogLevelEnabled(TRACE_LEVEL_ERROR, LEVEL_FATALERROR);
-  ExpectLogLevelEnabled(TRACE_LEVEL_ERROR, LEVEL_ERROR);
-  ExpectLogLevelEnabled(TRACE_LEVEL_ERROR, LE);
-  ExpectLogLevelDisabled(TRACE_LEVEL_ERROR, LEVEL_WARNING);
-  ExpectLogLevelDisabled(TRACE_LEVEL_ERROR, LW);
-  ExpectLogLevelDisabled(TRACE_LEVEL_ERROR, L1);
-  ExpectLogLevelDisabled(TRACE_LEVEL_ERROR, L2);
-  ExpectLogLevelDisabled(TRACE_LEVEL_ERROR, L3);
-  ExpectLogLevelDisabled(TRACE_LEVEL_ERROR, L4);
-  ExpectLogLevelDisabled(TRACE_LEVEL_ERROR, L5);
-  ExpectLogLevelDisabled(TRACE_LEVEL_ERROR, L6);
-  ConsumeAndRestartLog();
-
-  // TRACE_LEVEL_WARNING
-  ExpectLogLevelEnabled(TRACE_LEVEL_WARNING, LEVEL_FATALERROR);
-  ExpectLogLevelEnabled(TRACE_LEVEL_WARNING, LEVEL_ERROR);
-  ExpectLogLevelEnabled(TRACE_LEVEL_WARNING, LE);
-  ExpectLogLevelEnabled(TRACE_LEVEL_WARNING, LEVEL_WARNING);
-  ExpectLogLevelEnabled(TRACE_LEVEL_WARNING, LW);
-  ExpectLogLevelDisabled(TRACE_LEVEL_WARNING, L1);
-  ExpectLogLevelDisabled(TRACE_LEVEL_WARNING, L2);
-  ExpectLogLevelDisabled(TRACE_LEVEL_WARNING, L3);
-  ExpectLogLevelDisabled(TRACE_LEVEL_WARNING, L4);
-  ExpectLogLevelDisabled(TRACE_LEVEL_WARNING, L5);
-  ExpectLogLevelDisabled(TRACE_LEVEL_WARNING, L6);
-  ConsumeAndRestartLog();
-
-  // TRACE_LEVEL_INFORMATION
-  ExpectLogLevelEnabled(TRACE_LEVEL_INFORMATION, LEVEL_FATALERROR);
-  ExpectLogLevelEnabled(TRACE_LEVEL_INFORMATION, LEVEL_ERROR);
-  ExpectLogLevelEnabled(TRACE_LEVEL_INFORMATION, LE);
-  ExpectLogLevelEnabled(TRACE_LEVEL_INFORMATION, LEVEL_WARNING);
-  ExpectLogLevelEnabled(TRACE_LEVEL_INFORMATION, LW);
-  ExpectLogLevelEnabled(TRACE_LEVEL_INFORMATION, L1);
-  ExpectLogLevelEnabled(TRACE_LEVEL_INFORMATION, L2);
-  ExpectLogLevelDisabled(TRACE_LEVEL_INFORMATION, L3);
-  ExpectLogLevelDisabled(TRACE_LEVEL_INFORMATION, L4);
-  ExpectLogLevelDisabled(TRACE_LEVEL_INFORMATION, L5);
-  ExpectLogLevelDisabled(TRACE_LEVEL_INFORMATION, L6);
-  ConsumeAndRestartLog();
-
-  // TRACE_LEVEL_VERBOSE
-  ExpectLogLevelEnabled(TRACE_LEVEL_VERBOSE, LEVEL_FATALERROR);
-  ExpectLogLevelEnabled(TRACE_LEVEL_VERBOSE, LEVEL_ERROR);
-  ExpectLogLevelEnabled(TRACE_LEVEL_VERBOSE, LE);
-  ExpectLogLevelEnabled(TRACE_LEVEL_VERBOSE, LEVEL_WARNING);
-  ExpectLogLevelEnabled(TRACE_LEVEL_VERBOSE, LW);
-  ExpectLogLevelEnabled(TRACE_LEVEL_VERBOSE, L1);
-  ExpectLogLevelEnabled(TRACE_LEVEL_VERBOSE, L2);
-  ExpectLogLevelEnabled(TRACE_LEVEL_VERBOSE, L3);
-  ExpectLogLevelEnabled(TRACE_LEVEL_VERBOSE, L4);
-  ExpectLogLevelEnabled(TRACE_LEVEL_VERBOSE, L5);
-  ExpectLogLevelEnabled(TRACE_LEVEL_VERBOSE, L6);
-}
-
-TEST_F(EtwLogWriterTest, UpdateProviderLevel) {
-  // Test that changing ETW trace levels and flags causes a pre-existing
-  // ETWLogProvider to update its log levels per IsCatLevelEnabled.
-  TestingLogWriter writer;
-  for (int cat = LC_LOGGING; cat < LC_MAX_CAT; ++cat) {
-    EXPECT_FALSE(writer.IsCatLevelEnabled(static_cast<LogCategory>(cat),
-                                          LEVEL_WARNING));
-  }
-
-  // Turn logging on.
-  EXPECT_HRESULT_SUCCEEDED(
-      controller_.EnableProvider(kTestProviderGuid,
-                                 TRACE_LEVEL_INFORMATION,
-                                 0xFFFFFFFF));
-
-  // Wait for the callback to hit, then assert that logging is now enabled.
-  writer.WaitUntilEnabled();
-  for (int cat = LC_LOGGING; cat < LC_MAX_CAT; ++cat) {
-    EXPECT_TRUE(writer.IsCatLevelEnabled(static_cast<LogCategory>(cat),
-                                         LEVEL_WARNING));
-  }
-
-  // Turn down the enable mask, aka categories.
-  EXPECT_HRESULT_SUCCEEDED(
-      controller_.EnableProvider(kTestProviderGuid,
-                                 TRACE_LEVEL_INFORMATION,
-                                 0x0003));  // 3 is LC_LOGGING + stack traces.
-
-  // Wait for the callback to hit, then assert that logging is still enabled
-  // but only for the LC_LOGGING category.
-  writer.WaitUntilEnabled();
-  for (int cat = LC_LOGGING; cat < LC_MAX_CAT; ++cat) {
-    EXPECT_EQ(cat == LC_LOGGING,
-              writer.IsCatLevelEnabled(static_cast<LogCategory>(cat),
-                                       LEVEL_WARNING));
-  }
-
-  EXPECT_HRESULT_SUCCEEDED(controller_.DisableProvider(kTestProviderGuid));
-
-  // Wait for the callback to hit, then assert that logging is now disabled.
-  writer.WaitUntilDisabled();
-  for (int cat = LC_LOGGING; cat < LC_MAX_CAT; ++cat) {
-    EXPECT_FALSE(writer.IsCatLevelEnabled(static_cast<LogCategory>(cat),
-                                          LEVEL_WARNING));
-  }
-}
-
-TEST_F(EtwLogWriterTest, OutputMessageIsRobust) {
-  // Test that OutputMessage doesn't fall over on unexpected inputs.
-
-  // Turn logging on.
-  TestingLogWriter writer;
-  EXPECT_HRESULT_SUCCEEDED(
-      controller_.EnableProvider(kTestProviderGuid,
-                                 TRACE_LEVEL_INFORMATION,
-                                 0xFFFFFFFF));
-  writer.WaitUntilEnabled();
-
-  OutputInfo msg(LC_LOGGING, LW, L"TEST", NULL);
-  writer.OutputMessage(&msg);
-
-  msg.category = static_cast<LogCategory>(0xFF);
-  msg.level = static_cast<LogLevel>(0xFF);
-  msg.msg1 = NULL;
-  msg.msg2 = L"TEST";
-  writer.OutputMessage(&msg);
-}
-
-TEST_F(EtwLogWriterTest, OutputMessageOnlyLevelsEnabled) {
-#define EXPECT_LOG(trace_level, enable_bits, log_level, log_cat) \
-  ExpectLogMessage(trace_level, enable_bits, log_level, log_cat, true);
-#define EXPECT_NO_LOG(trace_level, enable_bits, log_level, log_cat) \
-  ExpectLogMessage(trace_level, enable_bits, log_level, log_cat, false);
-
-  // Try different levels at LC_LOGGING category.
-  EXPECT_NO_LOG(TRACE_LEVEL_NONE, 0x3, LEVEL_FATALERROR, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_NONE, 0x3, LEVEL_ERROR, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_NONE, 0x3, LE, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_NONE, 0x3, LEVEL_WARNING, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_NONE, 0x3, LW, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_NONE, 0x3, L1, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_NONE, 0x3, L2, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_NONE, 0x3, L3, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_NONE, 0x3, L4, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_NONE, 0x3, L5, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_NONE, 0x3, L6, LC_LOGGING);
-  ConsumeAndRestartLog();
-
-  if (!ShouldRunLargeTest()) {
-    // This test takes about 7 seconds, so only run part of it by default.
-    return;
-  }
-
-  EXPECT_LOG(TRACE_LEVEL_FATAL, 0x3, LEVEL_FATALERROR, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_FATAL, 0x3, LEVEL_ERROR, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_FATAL, 0x3, LE, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_FATAL, 0x3, LEVEL_WARNING, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_FATAL, 0x3, LW, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_FATAL, 0x3, L1, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_FATAL, 0x3, L2, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_FATAL, 0x3, L3, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_FATAL, 0x3, L4, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_FATAL, 0x3, L5, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_FATAL, 0x3, L6, LC_LOGGING);
-  ConsumeAndRestartLog();
-
-  EXPECT_LOG(TRACE_LEVEL_ERROR, 0x3, LEVEL_FATALERROR, LC_LOGGING);
-  EXPECT_LOG(TRACE_LEVEL_ERROR, 0x3, LEVEL_ERROR, LC_LOGGING);
-  EXPECT_LOG(TRACE_LEVEL_ERROR, 0x3, LE, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_ERROR, 0x3, LEVEL_WARNING, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_ERROR, 0x3, LW, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_ERROR, 0x3, L1, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_ERROR, 0x3, L2, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_ERROR, 0x3, L3, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_ERROR, 0x3, L4, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_ERROR, 0x3, L5, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_ERROR, 0x3, L6, LC_LOGGING);
-  ConsumeAndRestartLog();
-
-  EXPECT_LOG(TRACE_LEVEL_WARNING, 0x3, LEVEL_FATALERROR, LC_LOGGING);
-  EXPECT_LOG(TRACE_LEVEL_WARNING, 0x3, LEVEL_ERROR, LC_LOGGING);
-  EXPECT_LOG(TRACE_LEVEL_WARNING, 0x3, LE, LC_LOGGING);
-  EXPECT_LOG(TRACE_LEVEL_WARNING, 0x3, LEVEL_WARNING, LC_LOGGING);
-  EXPECT_LOG(TRACE_LEVEL_WARNING, 0x3, LW, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_WARNING, 0x3, L1, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_WARNING, 0x3, L2, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_WARNING, 0x3, L3, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_WARNING, 0x3, L4, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_WARNING, 0x3, L5, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_WARNING, 0x3, L6, LC_LOGGING);
-  ConsumeAndRestartLog();
-
-  EXPECT_LOG(TRACE_LEVEL_INFORMATION, 0x3, LEVEL_FATALERROR, LC_LOGGING);
-  EXPECT_LOG(TRACE_LEVEL_INFORMATION, 0x3, LEVEL_ERROR, LC_LOGGING);
-  EXPECT_LOG(TRACE_LEVEL_INFORMATION, 0x3, LE, LC_LOGGING);
-  EXPECT_LOG(TRACE_LEVEL_INFORMATION, 0x3, LEVEL_WARNING, LC_LOGGING);
-  EXPECT_LOG(TRACE_LEVEL_INFORMATION, 0x3, LW, LC_LOGGING);
-  EXPECT_LOG(TRACE_LEVEL_INFORMATION, 0x3, L1, LC_LOGGING);
-  EXPECT_LOG(TRACE_LEVEL_INFORMATION, 0x3, L2, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_INFORMATION, 0x3, L3, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_INFORMATION, 0x3, L4, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_INFORMATION, 0x3, L5, LC_LOGGING);
-  EXPECT_NO_LOG(TRACE_LEVEL_INFORMATION, 0x3, L6, LC_LOGGING);
-  ConsumeAndRestartLog();
-
-  EXPECT_LOG(TRACE_LEVEL_VERBOSE, 0x3, LEVEL_FATALERROR, LC_LOGGING);
-  EXPECT_LOG(TRACE_LEVEL_VERBOSE, 0x3, LEVEL_ERROR, LC_LOGGING);
-  EXPECT_LOG(TRACE_LEVEL_VERBOSE, 0x3, LE, LC_LOGGING);
-  EXPECT_LOG(TRACE_LEVEL_VERBOSE, 0x3, LEVEL_WARNING, LC_LOGGING);
-  EXPECT_LOG(TRACE_LEVEL_VERBOSE, 0x3, LW, LC_LOGGING);
-  EXPECT_LOG(TRACE_LEVEL_VERBOSE, 0x3, L1, LC_LOGGING);
-  EXPECT_LOG(TRACE_LEVEL_VERBOSE, 0x3, L2, LC_LOGGING);
-  EXPECT_LOG(TRACE_LEVEL_VERBOSE, 0x3, L3, LC_LOGGING);
-  EXPECT_LOG(TRACE_LEVEL_VERBOSE, 0x3, L4, LC_LOGGING);
-  EXPECT_LOG(TRACE_LEVEL_VERBOSE, 0x3, L5, LC_LOGGING);
-  EXPECT_LOG(TRACE_LEVEL_VERBOSE, 0x3, L6, LC_LOGGING);
-  ConsumeAndRestartLog();
-}
-
-TEST_F(EtwLogWriterTest, OutputMessageOnlyCategoriesEnabled) {
-  int max_cat = LC_MAX_CAT;
-  if (!ShouldRunLargeTest()) {
-    // This test takes about 12 seconds, so only run part of it by default.
-    max_cat = LC_LOGGING + 2;  // Test combinations of the first two categories.
-  }
-
-  // Loop through categories.
-  for (int log_cat = LC_LOGGING; log_cat < max_cat; ++log_cat) {
-    for (int enable_cat = LC_LOGGING; enable_cat < max_cat; ++enable_cat) {
-      EtwEventFlags enable_bits =
-          EtwLogWriter::CategoryToEnableFlag(
-              static_cast<LogCategory>(enable_cat));
-
-      ExpectLogMessage(TRACE_LEVEL_VERBOSE,
-                       enable_bits,
-                       LEVEL_WARNING,
-                       static_cast<LogCategory>(log_cat),
-                       log_cat == enable_cat);
-    }
-
-    // Play the log for every log category, due to the ETW enable/disable
-    // restriction on Windows XP that's mentioned above.
-    ConsumeAndRestartLog();
-  }
-}
-
-}  // namespace omaha
diff --git a/base/event_handler.h b/base/event_handler.h
deleted file mode 100644
index 1a0990c..0000000
--- a/base/event_handler.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_EVENT_HANDLER_H_
-#define OMAHA_COMMON_EVENT_HANDLER_H_
-
-#include <windows.h>
-
-namespace omaha {
-
-// Defines an abstract interface for the event handlers associated with
-// waitable kernel objects.
-class EventHandler {
- public:
-  virtual ~EventHandler() {}
-
-  // Gets called when the handle is signaled.
-  virtual void HandleEvent(HANDLE h) = 0;
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_EVENT_HANDLER_H_
-
diff --git a/base/event_trace_consumer.h b/base/event_trace_consumer.h
deleted file mode 100644
index 9662a3f..0000000
--- a/base/event_trace_consumer.h
+++ /dev/null
@@ -1,159 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Declaration of a Windows event trace consumer base class.
-#ifndef BASE_EVENT_TRACE_CONSUMER_H_
-#define BASE_EVENT_TRACE_CONSUMER_H_
-
-#include <windows.h>
-#include <wmistr.h>
-#include <evntrace.h>
-#include <vector>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-// This class is a base class that makes it easier to consume events
-// from realtime or file sessions. Concrete consumers need to sublass
-// a specialization of this class and override the ProcessEvent and/or
-// the ProcessBuffer methods to implement the event consumption logic.
-// Usage might look like:
-// class MyConsumer: public EtwTraceConsumerBase<MyConsumer, 1> {
-//  protected:
-//    static VOID WINAPI ProcessEvent(PEVENT_TRACE event);
-// };
-//
-// MyConsumer consumer;
-// consumer.OpenFileSession(file_path);
-// consumer.Consume();
-template <class ImplClass>
-class EtwTraceConsumerBase {
- public:
-  // Constructs a closed consumer.
-  EtwTraceConsumerBase() {
-  }
-
-  ~EtwTraceConsumerBase() {
-    Close();
-  }
-
-  // Opens the named realtime session, which must be existent.
-  // Note: You can use OpenRealtimeSession or OpenFileSession
-  //    to open as many as MAXIMUM_WAIT_OBJECTS (63) sessions at
-  //    any one time, though only one of them may be a realtime
-  //    session.
-  HRESULT OpenRealtimeSession(const wchar_t* session_name);
-
-  // Opens the event trace log in "file_name", which must be a full or
-  // relative path to an existing event trace log file.
-  // Note: You can use OpenRealtimeSession or OpenFileSession
-  //    to open as many as kNumSessions at any one time.
-  HRESULT OpenFileSession(const wchar_t* file_name);
-
-  // Consume all open sessions from beginning to end.
-  HRESULT Consume();
-
-  // Close all open sessions.
-  HRESULT Close();
-
- protected:
-  // Override in subclasses to handle events.
-  static void ProcessEvent(EVENT_TRACE* event) {
-  }
-  // Override in subclasses to handle buffers.
-  static bool ProcessBuffer(EVENT_TRACE_LOGFILE* buffer) {
-    buffer;
-    return true;  // keep going
-  }
-
- protected:
-  // Currently open sessions.
-  std::vector<TRACEHANDLE> trace_handles_;
-
- private:
-  // These delegate to ImplClass callbacks with saner signatures.
-  static void WINAPI ProcessEventCallback(EVENT_TRACE* event) {
-    ImplClass::ProcessEvent(event);
-  }
-  static ULONG WINAPI ProcessBufferCallback(PEVENT_TRACE_LOGFILE buffer) {
-    return ImplClass::ProcessBuffer(buffer);
-  }
-
-  DISALLOW_COPY_AND_ASSIGN(EtwTraceConsumerBase);
-};
-
-template <class ImplClass> inline
-HRESULT EtwTraceConsumerBase<ImplClass>::OpenRealtimeSession(
-    const wchar_t* session_name) {
-  EVENT_TRACE_LOGFILE logfile = {};
-  logfile.LoggerName = const_cast<wchar_t*>(session_name);
-  logfile.LogFileMode = EVENT_TRACE_REAL_TIME_MODE;
-  logfile.BufferCallback = &ProcessBufferCallback;
-  logfile.EventCallback = &ProcessEventCallback;
-  logfile.Context = this;
-  TRACEHANDLE trace_handle = ::OpenTrace(&logfile);
-  if (reinterpret_cast<TRACEHANDLE>(INVALID_HANDLE_VALUE) == trace_handle)
-    return HRESULT_FROM_WIN32(::GetLastError());
-
-  trace_handles_.push_back(trace_handle);
-  return S_OK;
-}
-
-template <class ImplClass> inline
-HRESULT EtwTraceConsumerBase<ImplClass>::OpenFileSession(
-    const wchar_t* file_name) {
-  EVENT_TRACE_LOGFILE logfile = {};
-  logfile.LogFileName = const_cast<wchar_t*>(file_name);
-  logfile.BufferCallback = &ProcessBufferCallback;
-  logfile.EventCallback = &ProcessEventCallback;
-  logfile.Context = this;
-  TRACEHANDLE trace_handle = ::OpenTrace(&logfile);
-  if (reinterpret_cast<TRACEHANDLE>(INVALID_HANDLE_VALUE) == trace_handle)
-    return HRESULT_FROM_WIN32(::GetLastError());
-
-  trace_handles_.push_back(trace_handle);
-  return S_OK;
-}
-
-template <class ImplClass> inline
-HRESULT EtwTraceConsumerBase<ImplClass>::Consume() {
-  ULONG err = ::ProcessTrace(&trace_handles_[0],
-                             trace_handles_.size(),
-                             NULL,
-                             NULL);
-  return HRESULT_FROM_WIN32(err);
-}
-
-template <class ImplClass> inline
-HRESULT EtwTraceConsumerBase<ImplClass>::Close() {
-  HRESULT hr = S_OK;
-  for (size_t i = 0; i < trace_handles_.size(); ++i) {
-    if (NULL != trace_handles_[i]) {
-      ULONG ret = ::CloseTrace(trace_handles_[i]);
-      trace_handles_[i] = NULL;
-
-      if (FAILED(HRESULT_FROM_WIN32(ret)))
-        hr = HRESULT_FROM_WIN32(ret);
-    }
-
-    trace_handles_.clear();
-  }
-
-  return hr;
-}
-
-}  // namespace omaha
-
-#endif  // BASE_EVENT_TRACE_CONSUMER_H_
diff --git a/base/event_trace_consumer_unittest.cc b/base/event_trace_consumer_unittest.cc
deleted file mode 100644
index 4e2d698..0000000
--- a/base/event_trace_consumer_unittest.cc
+++ /dev/null
@@ -1,379 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Unit tests for event trace consumer_ base class.
-#include "omaha/base/event_trace_consumer.h"
-#include <atlbase.h>
-#include <atlsync.h>
-#include <list>
-#include "base/basictypes.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/event_trace_controller.h"
-#include "omaha/base/event_trace_provider.h"
-// TODO(omaha): Remove when http://b/2767208 is fixed.
-#include "omaha/base/vistautil.h"
-#include "omaha/testing/unit_test.h"
-
-#include <initguid.h>  // NOLINT - has to be last
-
-namespace omaha {
-
-namespace {
-
-using omaha::EtwTraceConsumerBase;
-using omaha::EtwTraceController;
-using omaha::EtwTraceProperties;
-
-typedef std::list<EVENT_TRACE> EventQueue;
-
-class TestConsumer: public EtwTraceConsumerBase<TestConsumer> {
- public:
-  TestConsumer() {
-    sank_event_.Create(NULL, TRUE, FALSE, NULL);
-
-    ClearQueue();
-  }
-
-  ~TestConsumer() {
-    ClearQueue();
-    sank_event_.Close();
-  }
-
-  void ClearQueue() {
-    EventQueue::const_iterator it(events_.begin()), end(events_.end());
-
-    for (; it != end; ++it) {
-      delete [] it->MofData;
-    }
-
-    events_.clear();
-  }
-
-  static void EnqueueEvent(EVENT_TRACE* event) {
-    events_.push_back(*event);
-    EVENT_TRACE& back = events_.back();
-
-    if (NULL != event->MofData && 0 != event->MofLength) {
-      back.MofData = new char[event->MofLength];
-      memcpy(back.MofData, event->MofData, event->MofLength);
-    }
-  }
-
-  static void ProcessEvent(EVENT_TRACE* event) {
-    EnqueueEvent(event);
-    sank_event_.Set();
-  }
-
-  static CEvent sank_event_;
-  static EventQueue events_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(TestConsumer);
-};
-
-CEvent TestConsumer::sank_event_;
-EventQueue TestConsumer::events_;
-
-const wchar_t* const kTestSessionName = L"TestLogSession";
-
-void StopTestTraceSession() {
-  // Shut down any potentially dangling session.
-  EtwTraceProperties prop;
-  EtwTraceController::Stop(kTestSessionName, &prop);
-}
-
-class EtwTraceConsumerBaseTest: public testing::Test {
- public:
-  virtual void SetUp() {
-    StopTestTraceSession();
-  }
-};
-
-}  // namespace
-
-TEST_F(EtwTraceConsumerBaseTest, Initialize) {
-  TestConsumer consumer_;
-}
-
-TEST_F(EtwTraceConsumerBaseTest, OpenRealtimeSucceedsWhenNoSession) {
-  TestConsumer consumer_;
-
-  EXPECT_HRESULT_SUCCEEDED(consumer_.OpenRealtimeSession(kTestSessionName));
-}
-
-TEST_F(EtwTraceConsumerBaseTest, ConsumerImmediateFailureWhenNoSession) {
-  TestConsumer consumer_;
-
-  EXPECT_HRESULT_SUCCEEDED(consumer_.OpenRealtimeSession(kTestSessionName));
-  EXPECT_HRESULT_FAILED(consumer_.Consume());
-}
-
-class EtwTraceConsumerRealtimeTest: public testing::Test {
- public:
-  virtual void SetUp() {
-    StopTestTraceSession();
-
-    EXPECT_HRESULT_SUCCEEDED(consumer_.OpenRealtimeSession(kTestSessionName));
-  }
-
-  virtual void TearDown() {
-    consumer_.Close();
-  }
-
-  DWORD ConsumerThread() {
-    ::SetEvent(consumer_ready_);
-
-    HRESULT hr = consumer_.Consume();
-    return hr;
-  }
-
-  static DWORD WINAPI ConsumerThreadMainProc(void* arg) {
-    return reinterpret_cast<EtwTraceConsumerRealtimeTest*>(arg)->
-        ConsumerThread();
-  }
-
-  HRESULT StartConsumerThread() {
-    consumer_ready_.Attach(::CreateEvent(NULL, TRUE, FALSE, NULL));
-    EXPECT_TRUE(consumer_ready_ != NULL);
-    consumer_thread_.Attach(::CreateThread(NULL, 0, ConsumerThreadMainProc,
-        this, 0, NULL));
-    if (NULL == consumer_thread_)
-      return HRESULT_FROM_WIN32(::GetLastError());
-
-    HRESULT hr = S_OK;
-    HANDLE events[] = { consumer_ready_, consumer_thread_ };
-    DWORD result = ::WaitForMultipleObjects(arraysize(events), events,
-                                            FALSE, INFINITE);
-    switch (result) {
-      case WAIT_OBJECT_0:
-        // The event was set, the consumer_ is ready.
-        return S_OK;
-      case WAIT_OBJECT_0 + 1: {
-          // The thread finished. This may race with the event, so check
-          // explicitly for the event here, before concluding there's trouble.
-          if (WAIT_OBJECT_0 == ::WaitForSingleObject(consumer_ready_, 0))
-            return S_OK;
-          DWORD exit_code = 0;
-          if (::GetExitCodeThread(consumer_thread_, &exit_code))
-            return exit_code;
-          else
-            return HRESULT_FROM_WIN32(::GetLastError());
-          break;
-        }
-      default:
-        return E_UNEXPECTED;
-        break;
-    }
-
-    // NOTREACHED
-  }
-
-  // Waits for consumer_ thread to exit, and returns its exit code.
-  HRESULT JoinConsumerThread() {
-    if (WAIT_OBJECT_0 != ::WaitForSingleObject(consumer_thread_, INFINITE))
-      return HRESULT_FROM_WIN32(::GetLastError());
-
-    DWORD exit_code = 0;
-    if (::GetExitCodeThread(consumer_thread_, &exit_code))
-      return exit_code;
-
-    return HRESULT_FROM_WIN32(::GetLastError());
-  }
-
-  TestConsumer consumer_;
-  CHandle consumer_ready_;
-  CHandle consumer_thread_;
-};
-
-TEST_F(EtwTraceConsumerRealtimeTest, ConsumerReturnsWhenSessionClosed) {
-  if (!IsBuildSystem() && !vista_util::IsVistaOrLater()) {
-    std::wcout << _T("\tTest not run due to http://b/2767208.") << std::endl;
-    return;
-  }
-
-  EtwTraceController controller;
-
-  HRESULT hr = controller.StartRealtimeSession(kTestSessionName, 100 * 1024);
-  if (hr == E_ACCESSDENIED) {
-    SUCCEED() << "You must be an administrator to run this test on Vista";
-    return;
-  }
-
-  // Start the consumer_.
-  EXPECT_HRESULT_SUCCEEDED(StartConsumerThread());
-
-  // Wait around for the consumer_ thread a bit.
-  EXPECT_EQ(WAIT_TIMEOUT, ::WaitForSingleObject(consumer_thread_, 50));
-
-  EXPECT_HRESULT_SUCCEEDED(controller.Stop(NULL));
-
-  // The consumer_ returns success on session stop.
-  EXPECT_HRESULT_SUCCEEDED(JoinConsumerThread());
-}
-
-namespace {
-
-// {036B8F65-8DF3-46e4-ABFC-6985C43D59BA}
-DEFINE_GUID(kTestProvider,
-  0x36b8f65, 0x8df3, 0x46e4, 0xab, 0xfc, 0x69, 0x85, 0xc4, 0x3d, 0x59, 0xba);
-
-// {57E47923-A549-476f-86CA-503D57F59E62}
-DEFINE_GUID(kTestEventType,
-  0x57e47923, 0xa549, 0x476f, 0x86, 0xca, 0x50, 0x3d, 0x57, 0xf5, 0x9e, 0x62);
-
-}  // namespace
-
-TEST_F(EtwTraceConsumerRealtimeTest, ConsumeEvent) {
-  if (!IsBuildSystem() && !vista_util::IsVistaOrLater()) {
-    std::wcout << _T("\tTest not run due to http://b/2767208.") << std::endl;
-    return;
-  }
-
-  EtwTraceController controller;
-  HRESULT hr = controller.StartRealtimeSession(kTestSessionName, 100 * 1024);
-  if (hr == E_ACCESSDENIED) {
-    SUCCEED() << "You must be an administrator to run this test on Vista";
-    return;
-  }
-
-  EXPECT_HRESULT_SUCCEEDED(controller.EnableProvider(kTestProvider,
-      TRACE_LEVEL_VERBOSE, 0xFFFFFFFF));
-
-  EtwTraceProvider provider(kTestProvider);
-  EXPECT_EQ(ERROR_SUCCESS, provider.Register());
-
-  // Start the consumer_.
-  EXPECT_HRESULT_SUCCEEDED(StartConsumerThread());
-
-  EXPECT_EQ(0, TestConsumer::events_.size());
-
-  EtwMofEvent<1> event(kTestEventType, 1, TRACE_LEVEL_ERROR);
-  EXPECT_EQ(ERROR_SUCCESS, provider.Log(&event.header));
-
-  EXPECT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(TestConsumer::sank_event_,
-                                                 INFINITE));
-  EXPECT_HRESULT_SUCCEEDED(controller.Stop(NULL));
-  EXPECT_HRESULT_SUCCEEDED(JoinConsumerThread());
-  EXPECT_NE(0, TestConsumer::events_.size());
-}
-
-namespace {
-
-// We run events through a file session to assert that
-// the content comes through.
-class EtwTraceConsumerDataTest: public testing::Test {
- public:
-  EtwTraceConsumerDataTest() {
-  }
-
-  virtual void SetUp() {
-    StopTestTraceSession();
-
-    // Construct a temp file name.
-    CString temp_dir = omaha::app_util::GetTempDir();
-    EXPECT_TRUE(::GetTempFileName(temp_dir, _T("tmp"), 0,
-                                  CStrBuf(temp_file_, MAX_PATH)));
-  }
-
-  virtual void TearDown() {
-    EXPECT_TRUE(::DeleteFile(temp_file_));
-
-    // Shut down any potentially dangling session.
-    EtwTraceProperties prop;
-    EtwTraceController::Stop(kTestSessionName, &prop);
-  }
-
-  HRESULT LogEventToTempSession(PEVENT_TRACE_HEADER header) {
-    EtwTraceController controller;
-
-    // Set up a file session.
-    HRESULT hr = controller.StartFileSession(kTestSessionName, temp_file_);
-    if (FAILED(hr))
-      return hr;
-
-    // Enable our provider.
-    EXPECT_HRESULT_SUCCEEDED(controller.EnableProvider(kTestProvider,
-        TRACE_LEVEL_VERBOSE, 0xFFFFFFFF));
-
-    EtwTraceProvider provider(kTestProvider);
-    // Then register our provider, means we get a session handle immediately.
-    EXPECT_EQ(ERROR_SUCCESS, provider.Register());
-    // Trace the event, it goes to the temp file.
-    EXPECT_EQ(ERROR_SUCCESS, provider.Log(header));
-    EXPECT_HRESULT_SUCCEEDED(controller.DisableProvider(kTestProvider));
-    EXPECT_HRESULT_SUCCEEDED(provider.Unregister());
-    EXPECT_HRESULT_SUCCEEDED(controller.Flush(NULL));
-    EXPECT_HRESULT_SUCCEEDED(controller.Stop(NULL));
-
-    return S_OK;
-  }
-
-  HRESULT ConsumeEventFromTempSession() {
-    // Now consume the event(s).
-    TestConsumer consumer_;
-    HRESULT hr = consumer_.OpenFileSession(temp_file_);
-    if (SUCCEEDED(hr))
-      hr = consumer_.Consume();
-    consumer_.Close();
-    // And nab the result.
-    events_.swap(TestConsumer::events_);
-    return hr;
-  }
-
-  HRESULT RoundTripEvent(PEVENT_TRACE_HEADER header, PEVENT_TRACE* trace) {
-    ::DeleteFile(temp_file_);
-
-    HRESULT hr = LogEventToTempSession(header);
-    if (SUCCEEDED(hr))
-      hr = ConsumeEventFromTempSession();
-
-    if (FAILED(hr))
-      return hr;
-
-    // We should now have the event in the queue.
-    if (events_.empty())
-      return E_FAIL;
-
-    *trace = &events_.back();
-    return S_OK;
-  }
-
-  EventQueue events_;
-  CString temp_file_;
-};
-
-}  // namespace
-
-
-TEST_F(EtwTraceConsumerDataTest, RoundTrip) {
-  EtwMofEvent<1> event(kTestEventType, 1, TRACE_LEVEL_ERROR);
-
-  static const char kData[] = "This is but test data";
-  event.fields[0].DataPtr = reinterpret_cast<ULONG_PTR>(kData);
-  event.fields[0].Length = sizeof(kData);
-
-  PEVENT_TRACE trace = NULL;
-  HRESULT hr = RoundTripEvent(&event.header, &trace);
-  if (hr == E_ACCESSDENIED) {
-    SUCCEED() << "You must be an administrator to run this test on Vista";
-    return;
-  }
-  ASSERT_TRUE(NULL != trace);
-  EXPECT_EQ(sizeof(kData), trace->MofLength);
-  EXPECT_STREQ(kData, reinterpret_cast<const char*>(trace->MofData));
-}
-
-}  // namespace omaha
-
diff --git a/base/event_trace_controller.cc b/base/event_trace_controller.cc
deleted file mode 100644
index 845c6ce..0000000
--- a/base/event_trace_controller.cc
+++ /dev/null
@@ -1,150 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Implementation of a Windows event trace controller class.
-#include "omaha/base/event_trace_controller.h"
-#include "omaha/base/debug.h"
-
-namespace omaha {
-
-EtwTraceController::EtwTraceController() : session_(NULL) {
-}
-
-EtwTraceController::~EtwTraceController() {
-  Stop(NULL);
-}
-
-HRESULT EtwTraceController::Start(const wchar_t* session_name,
-    EtwTraceProperties* prop) {
-  ASSERT1(NULL == session_ && session_name_.empty());
-  EtwTraceProperties ignore;
-  if (prop == NULL)
-    prop = &ignore;
-
-  HRESULT hr = Start(session_name, prop, &session_);
-  if (SUCCEEDED(hr))
-    session_name_ = session_name;
-
-  return hr;
-}
-
-HRESULT EtwTraceController::StartFileSession(const wchar_t* session_name,
-      const wchar_t* logfile_path, bool realtime) {
-  ASSERT1(NULL == session_ && session_name_.empty());
-
-  EtwTraceProperties prop;
-  prop.SetLoggerFileName(logfile_path);
-  EVENT_TRACE_PROPERTIES& p = *prop.get();
-  p.Wnode.ClientContext = 1;  // QPC timer accuracy.
-  p.LogFileMode = EVENT_TRACE_FILE_MODE_SEQUENTIAL;  // Sequential log.
-  if (realtime)
-    p.LogFileMode |= EVENT_TRACE_REAL_TIME_MODE;
-
-  p.MaximumFileSize = 100;  // 100M file size.
-  p.FlushTimer = 30;  // 30 seconds flush lag.
-  return Start(session_name, &prop);
-}
-
-HRESULT EtwTraceController::StartRealtimeSession(const wchar_t* session_name,
-    size_t buffer_size) {
-  ASSERT1(NULL == session_ && session_name_.empty());
-  EtwTraceProperties prop;
-  EVENT_TRACE_PROPERTIES& p = *prop.get();
-  p.LogFileMode = EVENT_TRACE_REAL_TIME_MODE | EVENT_TRACE_USE_PAGED_MEMORY;
-  p.FlushTimer = 1;  // flush every second.
-  p.BufferSize = buffer_size;  // buffer_size in kilobytes.
-  p.LogFileNameOffset = 0;
-  return Start(session_name, &prop);
-}
-
-HRESULT EtwTraceController::EnableProvider(REFGUID provider, UCHAR level,
-    ULONG flags) {
-  ULONG error = ::EnableTrace(TRUE, flags, level, &provider, session_);
-  return HRESULT_FROM_WIN32(error);
-}
-
-HRESULT EtwTraceController::DisableProvider(REFGUID provider) {
-  ULONG error = ::EnableTrace(FALSE, 0, 0, &provider, session_);
-  return HRESULT_FROM_WIN32(error);
-}
-
-HRESULT EtwTraceController::Stop(EtwTraceProperties* properties) {
-  EtwTraceProperties ignore;
-  if (properties == NULL)
-    properties = &ignore;
-
-  ULONG error = ::ControlTrace(session_, NULL, properties->get(),
-    EVENT_TRACE_CONTROL_STOP);
-  if (ERROR_SUCCESS != error)
-    return HRESULT_FROM_WIN32(error);
-
-  session_ = NULL;
-  session_name_.clear();
-  return S_OK;
-}
-
-HRESULT EtwTraceController::Flush(EtwTraceProperties* properties) {
-  EtwTraceProperties ignore;
-  if (properties == NULL)
-    properties = &ignore;
-
-  ULONG error = ::ControlTrace(session_, NULL, properties->get(),
-                               EVENT_TRACE_CONTROL_FLUSH);
-  if (ERROR_SUCCESS != error)
-    return HRESULT_FROM_WIN32(error);
-
-  return S_OK;
-}
-
-HRESULT EtwTraceController::Start(const wchar_t* session_name,
-    EtwTraceProperties* properties, TRACEHANDLE* session_handle) {
-  ASSERT1(properties != NULL);
-  ULONG err = ::StartTrace(session_handle, session_name, properties->get());
-  return HRESULT_FROM_WIN32(err);
-}
-
-HRESULT EtwTraceController::Query(const wchar_t* session_name,
-    EtwTraceProperties* properties) {
-  ASSERT1(properties != NULL);
-  ULONG err = ::ControlTrace(NULL, session_name, properties->get(),
-                             EVENT_TRACE_CONTROL_QUERY);
-  return HRESULT_FROM_WIN32(err);
-};
-
-HRESULT EtwTraceController::Update(const wchar_t* session_name,
-    EtwTraceProperties* properties) {
-  ASSERT1(properties != NULL);
-  ULONG err = ::ControlTrace(NULL, session_name, properties->get(),
-                             EVENT_TRACE_CONTROL_UPDATE);
-  return HRESULT_FROM_WIN32(err);
-}
-
-HRESULT EtwTraceController::Stop(const wchar_t* session_name,
-    EtwTraceProperties* properties) {
-  ASSERT1(properties != NULL);
-  ULONG err = ::ControlTrace(NULL, session_name, properties->get(),
-                             EVENT_TRACE_CONTROL_STOP);
-  return HRESULT_FROM_WIN32(err);
-}
-
-HRESULT EtwTraceController::Flush(const wchar_t* session_name,
-    EtwTraceProperties* properties) {
-  ASSERT1(properties != NULL);
-  ULONG err = ::ControlTrace(NULL, session_name, properties->get(),
-                             EVENT_TRACE_CONTROL_FLUSH);
-  return HRESULT_FROM_WIN32(err);
-}
-
-}  // namespace omaha
diff --git a/base/event_trace_controller.h b/base/event_trace_controller.h
deleted file mode 100644
index 9f96599..0000000
--- a/base/event_trace_controller.h
+++ /dev/null
@@ -1,183 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Declaration of a Windows event trace controller class.
-// The controller takes care of creating and manipulating event trace
-// sessions.
-//
-// Event tracing for Windows is a system-provided service that provides
-// logging control and high-performance transport for generic, binary trace
-// events. Event trace providers register with the system by their name,
-// which is a GUID, and can from that point forward receive callbacks that
-// start or end tracing and that change their trace level and enable mask.
-//
-// A trace controller can create an event tracing session, which either
-// sends events to a binary file, or to a realtime consumer, or both.
-//
-// A trace consumer consumes events from zero or one realtime session,
-// as well as potentially from multiple binary trace files.
-#ifndef BASE_EVENT_TRACE_CONTROLLER_H_
-#define BASE_EVENT_TRACE_CONTROLLER_H_
-
-#include <windows.h>
-#include <wmistr.h>
-#include <evntrace.h>
-#include <string>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-// Utility class to make it easier to work with EVENT_TRACE_PROPERTIES.
-// The EVENT_TRACE_PROPERTIES structure contains information about an
-// event tracing session.
-class EtwTraceProperties {
- public:
-  EtwTraceProperties() {
-    memset(buffer_, 0, sizeof(buffer_));
-    EVENT_TRACE_PROPERTIES* prop = get();
-
-    prop->Wnode.BufferSize = sizeof(buffer_);
-    prop->Wnode.Flags = WNODE_FLAG_TRACED_GUID;
-    prop->LoggerNameOffset = sizeof(EVENT_TRACE_PROPERTIES);
-    prop->LogFileNameOffset = sizeof(EVENT_TRACE_PROPERTIES) +
-                              sizeof(wchar_t) * kMaxStringLen;
-  }
-
-  EVENT_TRACE_PROPERTIES* get() {
-    return &properties_;
-  }
-  const EVENT_TRACE_PROPERTIES* get() const {
-    return reinterpret_cast<const EVENT_TRACE_PROPERTIES*>(&properties_);
-  }
-
-  const wchar_t* GetLoggerName() const {
-    return reinterpret_cast<const wchar_t *>(buffer_ + get()->LoggerNameOffset);
-  }
-
-  HRESULT SetLoggerName(const wchar_t* logger_name) {
-    size_t len = wcslen(logger_name) + 1;
-    if (kMaxStringLen < len)
-      return E_INVALIDARG;
-
-    memcpy(buffer_ + get()->LoggerNameOffset,
-           logger_name,
-           sizeof(wchar_t) * len);
-    return S_OK;
-  }
-
-  const wchar_t* GetLoggerFileName() const {
-    return reinterpret_cast<const wchar_t*>(buffer_ + get()->LogFileNameOffset);
-  }
-
-  HRESULT SetLoggerFileName(const wchar_t* logger_file_name) {
-    size_t len = wcslen(logger_file_name) + 1;
-    if (kMaxStringLen < len)
-      return E_INVALIDARG;
-
-    memcpy(buffer_ + get()->LogFileNameOffset,
-           logger_file_name,
-           sizeof(wchar_t) * len);
-    return S_OK;
-  }
-
-  // Max string len for name and session name is 1024 per documentation.
-  static const size_t kMaxStringLen = 1024;
-  // Properties buffer allocates space for header and for
-  // max length for name and session name.
-  static const size_t kBufSize = sizeof(EVENT_TRACE_PROPERTIES)
-      + 2 * sizeof(wchar_t) * (kMaxStringLen);
-
- private:
-  // The EVENT_TRACE_PROPERTIES structure needs to be overlaid on a
-  // larger buffer to allow storing the logger name and logger file
-  // name contiguously with the structure.
-  union {
-   public:
-    // Our properties header.
-    EVENT_TRACE_PROPERTIES properties_;
-    // The actual size of the buffer is forced by this member.
-    char buffer_[kBufSize];
-  };
-
-  DISALLOW_COPY_AND_ASSIGN(EtwTraceProperties);
-};
-
-// This class implements an ETW controller, which knows how to start and
-// stop event tracing sessions, as well as controlling ETW provider
-// log levels and enable bit masks under the session.
-class EtwTraceController {
- public:
-  EtwTraceController();
-  ~EtwTraceController();
-
-  // Start a session with given name and properties.
-  HRESULT Start(const wchar_t* session_name, EtwTraceProperties* prop);
-
-  // Starts a session tracing to a file with some default properties.
-  HRESULT StartFileSession(const wchar_t* session_name,
-                           const wchar_t* logfile_path,
-                           bool realtime = false);
-
-  // Starts a realtime session with some default properties.
-  HRESULT StartRealtimeSession(const wchar_t* session_name,
-                               size_t buffer_size);
-
-  // Enables "provider" at "level" for this session.
-  // This will cause all providers registered with the GUID
-  // "provider" to start tracing at the new level, systemwide.
-  HRESULT EnableProvider(const GUID& provider, UCHAR level,
-                         ULONG flags = 0xFFFFFFFF);
-  // Disables "provider".
-  HRESULT DisableProvider(const GUID& provider);
-
-  // Stops our session and retrieve the new properties of the session,
-  // properties may be NULL.
-  HRESULT Stop(EtwTraceProperties* properties);
-
-  // Flushes our session and retrieve the current properties,
-  // properties may be NULL.
-  HRESULT Flush(EtwTraceProperties* properties);
-
-  // Static utility functions for controlling
-  // sessions we don't necessarily own.
-  static HRESULT Start(const wchar_t* session_name,
-                       EtwTraceProperties* properties,
-                       TRACEHANDLE* session_handle);
-
-  static HRESULT Query(const wchar_t* session_name,
-                       EtwTraceProperties* properties);
-
-  static HRESULT Update(const wchar_t* session_name,
-                        EtwTraceProperties* properties);
-
-  static HRESULT Stop(const wchar_t* session_name,
-                      EtwTraceProperties* properties);
-  static HRESULT Flush(const wchar_t* session_name,
-                       EtwTraceProperties* properties);
-
-  // Accessors.
-  TRACEHANDLE session() const { return session_; }
-  const wchar_t* session_name() const { return session_name_.c_str(); }
-
- private:
-  std::wstring session_name_;
-  TRACEHANDLE session_;
-
-  DISALLOW_COPY_AND_ASSIGN(EtwTraceController);
-};
-
-}  // namespace omaha
-
-#endif  // BASE_EVENT_TRACE_CONTROLLER_H_
diff --git a/base/event_trace_controller_unittest.cc b/base/event_trace_controller_unittest.cc
deleted file mode 100644
index 6ce027b..0000000
--- a/base/event_trace_controller_unittest.cc
+++ /dev/null
@@ -1,239 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Unit tests for event trace controller.
-#include "omaha/base/event_trace_controller.h"
-#include <atlsync.h>
-#include "omaha/base/app_util.h"
-#include "omaha/base/event_trace_provider.h"
-#include "omaha/testing/unit_test.h"
-#include <initguid.h>  // NOLINT - must be last.
-
-namespace {
-
-using omaha::EtwTraceController;
-using omaha::EtwTraceProvider;
-using omaha::EtwTraceProperties;
-
-const wchar_t kTestSessionName[] = L"TestLogSession";
-
-// {0D236A42-CD18-4e3d-9975-DCEEA2106E05}
-DEFINE_GUID(kTestProvider,
-    0xd236a42, 0xcd18, 0x4e3d, 0x99, 0x75, 0xdc, 0xee, 0xa2, 0x10, 0x6e, 0x5);
-
-DEFINE_GUID(kGuidNull,
-    0x0000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0);
-
-const ULONG kTestProviderFlags = 0xCAFEBABE;
-
-class TestingProvider: public EtwTraceProvider {
- public:
-  explicit TestingProvider(const GUID& provider_name)
-      : EtwTraceProvider(provider_name) {
-    callback_event_.Create(NULL, TRUE, FALSE, NULL);
-  }
-
-  void WaitForCallback() {
-    ::WaitForSingleObject(callback_event_, INFINITE);
-    callback_event_.Reset();
-  }
-
- private:
-  virtual void OnEventsEnabled() {
-    callback_event_.Set();
-  }
-  virtual void OnEventsDisabled() {
-    callback_event_.Set();
-  }
-
-  CEvent callback_event_;
-
-  DISALLOW_COPY_AND_ASSIGN(TestingProvider);
-};
-
-// These fixtures make sure we clean up dangling trace sessions
-// prior to all tests, to make the tests stable against crashes
-// and failures.
-class EtwTracePropertiesTest : public testing::Test {
- public:
-  virtual void SetUp() {
-    CloseTestTraceSession();
-  }
-
-  virtual void TearDown() {
-    CloseTestTraceSession();
-  }
-
- private:
-  void CloseTestTraceSession() {
-    // Clean up potential leftover sessions from previous unsuccessful runs.
-    EtwTraceProperties prop;
-    EtwTraceController::Stop(kTestSessionName, &prop);
-  }
-};
-
-class EtwTraceControllerTest : public EtwTracePropertiesTest {
-};
-
-}  // namespace
-
-namespace omaha {
-
-TEST_F(EtwTracePropertiesTest, Initialization) {
-  EtwTraceProperties prop;
-
-  EVENT_TRACE_PROPERTIES* p = prop.get();
-  EXPECT_NE(0u, p->Wnode.BufferSize);
-  EXPECT_EQ(0u, p->Wnode.ProviderId);
-  EXPECT_EQ(0u, p->Wnode.HistoricalContext);
-
-  EXPECT_TRUE(kGuidNull == p->Wnode.Guid);
-  EXPECT_EQ(0, p->Wnode.ClientContext);
-  EXPECT_EQ(WNODE_FLAG_TRACED_GUID, p->Wnode.Flags);
-
-  EXPECT_EQ(0, p->BufferSize);
-  EXPECT_EQ(0, p->MinimumBuffers);
-  EXPECT_EQ(0, p->MaximumBuffers);
-  EXPECT_EQ(0, p->MaximumFileSize);
-  EXPECT_EQ(0, p->LogFileMode);
-  EXPECT_EQ(0, p->FlushTimer);
-  EXPECT_EQ(0, p->EnableFlags);
-  EXPECT_EQ(0, p->AgeLimit);
-
-  EXPECT_EQ(0, p->NumberOfBuffers);
-  EXPECT_EQ(0, p->FreeBuffers);
-  EXPECT_EQ(0, p->EventsLost);
-  EXPECT_EQ(0, p->BuffersWritten);
-  EXPECT_EQ(0, p->LogBuffersLost);
-  EXPECT_EQ(0, p->RealTimeBuffersLost);
-  EXPECT_EQ(0, p->LoggerThreadId);
-  EXPECT_NE(0u, p->LogFileNameOffset);
-  EXPECT_NE(0u, p->LoggerNameOffset);
-}
-
-TEST_F(EtwTracePropertiesTest, Strings) {
-  EtwTraceProperties prop;
-
-  EXPECT_STREQ(L"", prop.GetLoggerFileName());
-  EXPECT_STREQ(L"", prop.GetLoggerName());
-
-  std::wstring name(1023, L'A');
-  EXPECT_HRESULT_SUCCEEDED(prop.SetLoggerFileName(name.c_str()));
-  EXPECT_HRESULT_SUCCEEDED(prop.SetLoggerName(name.c_str()));
-  EXPECT_STREQ(name.c_str(), prop.GetLoggerFileName());
-  EXPECT_STREQ(name.c_str(), prop.GetLoggerName());
-
-  std::wstring name2(1024, L'A');
-  EXPECT_HRESULT_FAILED(prop.SetLoggerFileName(name2.c_str()));
-  EXPECT_HRESULT_FAILED(prop.SetLoggerName(name2.c_str()));
-}
-
-TEST_F(EtwTraceControllerTest, Initialize) {
-  EtwTraceController controller;
-
-  EXPECT_EQ(NULL, controller.session());
-  EXPECT_STREQ(L"", controller.session_name());
-}
-
-TEST_F(EtwTraceControllerTest, StartRealTimeSession) {
-  EtwTraceController controller;
-
-  HRESULT hr = controller.StartRealtimeSession(kTestSessionName, 100 * 1024);
-  if (hr == E_ACCESSDENIED) {
-    SUCCEED() << "You must be an administrator to run this test on Vista";
-    return;
-  }
-
-  EXPECT_TRUE(NULL != controller.session());
-  EXPECT_STREQ(kTestSessionName, controller.session_name());
-
-  EXPECT_HRESULT_SUCCEEDED(controller.Stop(NULL));
-  EXPECT_EQ(NULL, controller.session());
-  EXPECT_STREQ(L"", controller.session_name());
-}
-
-TEST_F(EtwTraceControllerTest, StartFileSession) {
-  CString temp;
-  EXPECT_TRUE(::GetTempFileName(app_util::GetTempDir(), _T("tmp"), 0,
-                                CStrBuf(temp, MAX_PATH)));
-
-  EtwTraceController controller;
-  HRESULT hr = controller.StartFileSession(kTestSessionName, temp);
-  if (hr == E_ACCESSDENIED) {
-    SUCCEED() << "You must be an administrator to run this test on Vista";
-    return;
-  }
-
-  EXPECT_TRUE(NULL != controller.session());
-  EXPECT_STREQ(kTestSessionName, controller.session_name());
-
-  EXPECT_HRESULT_SUCCEEDED(controller.Stop(NULL));
-  EXPECT_EQ(NULL, controller.session());
-  EXPECT_STREQ(L"", controller.session_name());
-
-  EXPECT_TRUE(::DeleteFile(temp));
-}
-
-TEST_F(EtwTraceControllerTest, EnableDisable) {
-  TestingProvider provider(kTestProvider);
-
-  EXPECT_EQ(ERROR_SUCCESS, provider.Register());
-  EXPECT_EQ(NULL, provider.session_handle());
-
-  EtwTraceController controller;
-  HRESULT hr = controller.StartRealtimeSession(kTestSessionName, 100 * 1024);
-  if (hr == E_ACCESSDENIED) {
-    SUCCEED() << "You must be an administrator to run this test on Vista";
-    return;
-  }
-
-  EXPECT_HRESULT_SUCCEEDED(controller.EnableProvider(kTestProvider,
-                           TRACE_LEVEL_VERBOSE, kTestProviderFlags));
-
-  provider.WaitForCallback();
-
-  EXPECT_EQ(TRACE_LEVEL_VERBOSE, provider.enable_level());
-  EXPECT_EQ(kTestProviderFlags, provider.enable_flags());
-
-  EXPECT_HRESULT_SUCCEEDED(controller.DisableProvider(kTestProvider));
-
-  provider.WaitForCallback();
-
-  EXPECT_EQ(0, provider.enable_level());
-  EXPECT_EQ(0, provider.enable_flags());
-
-  EXPECT_EQ(ERROR_SUCCESS, provider.Unregister());
-
-  // Enable the provider again, before registering.
-  EXPECT_HRESULT_SUCCEEDED(controller.EnableProvider(kTestProvider,
-                           TRACE_LEVEL_VERBOSE, kTestProviderFlags));
-
-  // Register the provider again, the settings above
-  // should take immediate effect.
-  EXPECT_EQ(ERROR_SUCCESS, provider.Register());
-
-  EXPECT_EQ(TRACE_LEVEL_VERBOSE, provider.enable_level());
-  EXPECT_EQ(kTestProviderFlags, provider.enable_flags());
-
-  EXPECT_HRESULT_SUCCEEDED(controller.Stop(NULL));
-
-  provider.WaitForCallback();
-
-  // Session should have wound down.
-  EXPECT_EQ(0, provider.enable_level());
-  EXPECT_EQ(0, provider.enable_flags());
-}
-
-}  // namespace omaha
diff --git a/base/event_trace_provider.cc b/base/event_trace_provider.cc
deleted file mode 100644
index 1941f6c..0000000
--- a/base/event_trace_provider.cc
+++ /dev/null
@@ -1,150 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-#include "omaha/base/event_trace_provider.h"
-#include <windows.h>
-#include <cguid.h>
-
-namespace omaha {
-
-TRACE_GUID_REGISTRATION EtwTraceProvider::obligatory_guid_registration_ = {
-  &GUID_NULL,
-  NULL
-};
-
-EtwTraceProvider::EtwTraceProvider(const GUID& provider_name)
-    : provider_name_(provider_name), registration_handle_(NULL),
-      session_handle_(NULL), enable_flags_(0), enable_level_(0) {
-}
-
-EtwTraceProvider::EtwTraceProvider()
-    : provider_name_(GUID_NULL), registration_handle_(NULL),
-      session_handle_(NULL), enable_flags_(0), enable_level_(0) {
-}
-
-EtwTraceProvider::~EtwTraceProvider() {
-  Unregister();
-}
-
-ULONG EtwTraceProvider::EnableEvents(void* buffer) {
-  session_handle_ = ::GetTraceLoggerHandle(buffer);
-  if (NULL == session_handle_) {
-    return ::GetLastError();
-  }
-
-  enable_flags_ = ::GetTraceEnableFlags(session_handle_);
-  enable_level_ = ::GetTraceEnableLevel(session_handle_);
-
-  // Give subclasses a chance to digest the state change.
-  OnEventsEnabled();
-
-  return ERROR_SUCCESS;
-}
-
-ULONG EtwTraceProvider::DisableEvents() {
-  enable_level_ = 0;
-  enable_flags_ = 0;
-  session_handle_ = NULL;
-
-  // Give subclasses a chance to digest the state change.
-  OnEventsDisabled();
-
-  return ERROR_SUCCESS;
-}
-
-ULONG EtwTraceProvider::Callback(WMIDPREQUESTCODE request, void* buffer) {
-  switch (request) {
-    case WMI_ENABLE_EVENTS:
-      return EnableEvents(buffer);
-    case WMI_DISABLE_EVENTS:
-      return DisableEvents();
-
-    case WMI_GET_ALL_DATA:
-    case WMI_GET_SINGLE_INSTANCE:
-    case WMI_SET_SINGLE_INSTANCE:
-    case WMI_SET_SINGLE_ITEM:
-    case WMI_ENABLE_COLLECTION:
-    case WMI_DISABLE_COLLECTION:
-    case WMI_REGINFO:
-    case WMI_EXECUTE_METHOD:
-    default:
-      return ERROR_INVALID_PARAMETER;
-  }
-  // Not reached.
-}
-
-ULONG WINAPI EtwTraceProvider::ControlCallback(WMIDPREQUESTCODE request,
-    void* context, ULONG *reserved, void* buffer) {
-  reserved;  // Unused.
-  EtwTraceProvider *provider = reinterpret_cast<EtwTraceProvider*>(context);
-
-  return provider->Callback(request, buffer);
-}
-
-ULONG EtwTraceProvider::Register() {
-  if (provider_name_ == GUID_NULL)
-    return ERROR_INVALID_NAME;
-
-  return ::RegisterTraceGuids(ControlCallback, this, &provider_name_,
-      1, &obligatory_guid_registration_, NULL, NULL, &registration_handle_);
-}
-
-ULONG EtwTraceProvider::Unregister() {
-  ULONG ret = ::UnregisterTraceGuids(registration_handle_);
-
-  // Make sure we don't log anything from here on.
-  enable_level_ = 0;
-  enable_flags_ = 0;
-  session_handle_ = NULL;
-  registration_handle_ = NULL;
-
-  return ret;
-}
-
-ULONG EtwTraceProvider::Log(const EtwEventClass& event_class,
-    EtwEventType type, EtwEventLevel level, const char *message) {
-  if (NULL == session_handle_ || enable_level_ < level)
-    return ERROR_SUCCESS;  // No one listening.
-
-  EtwMofEvent<1> event(event_class, type, level);
-
-  event.fields[0].DataPtr = reinterpret_cast<ULONG_PTR>(message);
-  event.fields[0].Length = message ?
-      static_cast<ULONG>(sizeof(message[0]) * (1 + strlen(message))) : 0;
-
-  return ::TraceEvent(session_handle_, &event.header);
-}
-
-ULONG EtwTraceProvider::Log(const EtwEventClass& event_class,
-    EtwEventType type, EtwEventLevel level, const wchar_t *message) {
-  if (NULL == session_handle_ || enable_level_ < level)
-    return ERROR_SUCCESS;  // No one listening.
-
-  EtwMofEvent<1> event(event_class, type, level);
-
-  event.fields[0].DataPtr = reinterpret_cast<ULONG_PTR>(message);
-  event.fields[0].Length = message ?
-      static_cast<ULONG>(sizeof(message[0]) * (1 + wcslen(message))) : 0;
-
-  return ::TraceEvent(session_handle_, &event.header);
-}
-
-ULONG EtwTraceProvider::Log(EVENT_TRACE_HEADER* event) {
-  if (enable_level_ < event->Class.Level)
-    return ERROR_SUCCESS;
-
-  return ::TraceEvent(session_handle_, event);
-}
-
-}  // namespace omaha
diff --git a/base/event_trace_provider.h b/base/event_trace_provider.h
deleted file mode 100644
index 7fedeae..0000000
--- a/base/event_trace_provider.h
+++ /dev/null
@@ -1,171 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Declaration of a Windows event trace provider class, to allow using
-// Windows Event Tracing for logging transport and control.
-#ifndef BASE_EVENT_TRACE_PROVIDER_H_
-#define BASE_EVENT_TRACE_PROVIDER_H_
-
-#include <windows.h>
-#include <wmistr.h>
-#include <evntrace.h>
-#include "omaha/base/debug.h"
-#include "base/basictypes.h"
-
-namespace omaha {
-
-typedef GUID EtwEventClass;
-typedef UCHAR EtwEventType;
-typedef UCHAR EtwEventLevel;
-typedef USHORT EtwEventVersion;
-typedef ULONG EtwEventFlags;
-
-// Base class is a POD for correctness.
-template <size_t N> struct EtwMofEventBase {
-  EVENT_TRACE_HEADER header;
-  MOF_FIELD fields[N];
-};
-
-// Utility class to auto-initialize event trace header structures.
-template <size_t N> class EtwMofEvent: public EtwMofEventBase<N> {
- public:
-  typedef EtwMofEventBase<N> Super;
-
-  EtwMofEvent() {
-    memset(static_cast<Super*>(this), 0, sizeof(Super));
-  }
-
-  EtwMofEvent(const EtwEventClass& event_class, EtwEventType type,
-              EtwEventLevel level) {
-    memset(static_cast<Super*>(this), 0, sizeof(Super));
-    header.Size = sizeof(Super);
-    header.Guid = event_class;
-    header.Class.Type = type;
-    header.Class.Level = level;
-    header.Flags = WNODE_FLAG_TRACED_GUID | WNODE_FLAG_USE_MOF_PTR;
-  }
-
-  EtwMofEvent(const EtwEventClass& event_class, EtwEventType type,
-              EtwEventVersion version, EtwEventLevel level) {
-    memset(static_cast<Super*>(this), 0, sizeof(Super));
-    header.Size = sizeof(Super);
-    header.Guid = event_class;
-    header.Class.Type = type;
-    header.Class.Version = version;
-    header.Class.Level = level;
-    header.Flags = WNODE_FLAG_TRACED_GUID | WNODE_FLAG_USE_MOF_PTR;
-  }
-
-  void SetField(int field, size_t size, const void *data) {
-    ASSERT1(field < N);
-    if ((field < N) && (size <= kuint32max)) {
-      fields[field].DataPtr = reinterpret_cast<ULONG_PTR>(data);
-      fields[field].Length = static_cast<ULONG>(size);
-    }
-  }
-
-  EVENT_TRACE_HEADER* get() { return& header; }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(EtwMofEvent);
-};
-
-// Trace provider with Event Tracing for Windows. The trace provider
-// registers with ETW by its name which is a GUID. ETW calls back to
-// the object whenever the trace level or enable flags for this provider
-// name changes.
-// Users of this class can test whether logging is currently enabled at
-// a particular trace level, and whether particular enable flags are set,
-// before other resources are consumed to generate and issue the log
-// messages themselves.
-class EtwTraceProvider {
- public:
-  // Creates an event trace provider identified by provider_name, which
-  // will be the name registered with Event Tracing for Windows (ETW).
-  explicit EtwTraceProvider(const GUID& provider_name);
-
-  // Creates an unnamed event trace provider, the provider must be given
-  // a name before registration.
-  EtwTraceProvider();
-  virtual ~EtwTraceProvider();
-
-  // Registers the trace provider with Event Tracing for Windows.
-  // Note: from this point forward ETW may call the provider's control
-  //    callback. If the provider's name is enabled in some trace session
-  //    already, the callback may occur recursively from this call, so
-  //    call this only when you're ready to handle callbacks.
-  ULONG Register();
-  // Unregisters the trace provider with ETW.
-  ULONG Unregister();
-
-  // Accessors.
-  void set_provider_name(const GUID& provider_name) {
-    provider_name_ = provider_name;
-  }
-  const GUID& provider_name() const { return provider_name_; }
-  TRACEHANDLE registration_handle() const { return registration_handle_; }
-  TRACEHANDLE session_handle() const { return session_handle_; }
-  EtwEventFlags enable_flags() const { return enable_flags_; }
-  EtwEventLevel enable_level() const { return enable_level_; }
-
-  // Returns true iff logging should be performed for "level" and "flags".
-  // Note: flags is treated as a bitmask, and should normally have a single
-  //      bit set, to test whether to log for a particular sub "facility".
-  bool ShouldLog(EtwEventLevel level, EtwEventFlags flags) {
-    return NULL != session_handle_ && level >= enable_level_ &&
-        (0 != (flags & enable_flags_));
-  }
-
-  // Simple wrappers to log Unicode and ANSI strings.
-  // Do nothing if !ShouldLog(level, 0xFFFFFFFF).
-  ULONG Log(const EtwEventClass& event_class, EtwEventType type,
-            EtwEventLevel level, const char *message);
-  ULONG Log(const EtwEventClass& event_class, EtwEventType type,
-            EtwEventLevel level, const wchar_t *message);
-
-  // Log the provided event.
-  ULONG Log(EVENT_TRACE_HEADER* event);
-
- protected:
-  // These are called after events have been enabled or disabled.
-  // Override them if you want to do processing at the start or
-  // end of collection.
-  // Note: These may be called ETW's thread and they may be racy.
-  virtual void OnEventsEnabled() {}
-  virtual void OnEventsDisabled() {}
-
- private:
-  ULONG EnableEvents(PVOID buffer);
-  ULONG DisableEvents();
-  ULONG Callback(WMIDPREQUESTCODE request, PVOID buffer);
-  static ULONG WINAPI ControlCallback(WMIDPREQUESTCODE request, PVOID context,
-                                      ULONG *reserved, PVOID buffer);
-
-  GUID provider_name_;
-  TRACEHANDLE registration_handle_;
-  TRACEHANDLE session_handle_;
-  EtwEventFlags enable_flags_;
-  EtwEventLevel enable_level_;
-
-  // We don't use this, but on XP we're obliged to pass one in to
-  // RegisterTraceGuids. Non-const, because that's how the API needs it.
-  static TRACE_GUID_REGISTRATION obligatory_guid_registration_;
-
-  DISALLOW_COPY_AND_ASSIGN(EtwTraceProvider);
-};
-
-}  // namespace omaha
-
-#endif  // BASE_EVENT_TRACE_PROVIDER_H_
diff --git a/base/event_trace_provider_unittest.cc b/base/event_trace_provider_unittest.cc
deleted file mode 100644
index a99cf21..0000000
--- a/base/event_trace_provider_unittest.cc
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Unit tests for event trace provider.
-#include "omaha/base/event_trace_provider.h"
-#include <new>
-#include "omaha/testing/unit_test.h"
-#include <initguid.h>  // NOLINT - has to be last
-
-namespace omaha {
-
-// {7F0FD37F-FA3C-4cd6-9242-DF60967A2CB2}
-DEFINE_GUID(kTestProvider,
-  0x7f0fd37f, 0xfa3c, 0x4cd6, 0x92, 0x42, 0xdf, 0x60, 0x96, 0x7a, 0x2c, 0xb2);
-
-// {7F0FD37F-FA3C-4cd6-9242-DF60967A2CB2}
-DEFINE_GUID(kTestEventClass,
-  0x7f0fd37f, 0xfa3c, 0x4cd6, 0x92, 0x42, 0xdf, 0x60, 0x96, 0x7a, 0x2c, 0xb2);
-
-TEST(EtwTraceProviderTest, ToleratesPreCreateInvocations) {
-  // Because the trace provider is used in logging, it's important that
-  // it be possible to use static provider instances without regard to
-  // whether they've been constructed or destructed.
-  // The interface of the class is designed to tolerate this usage.
-  char buf[sizeof(EtwTraceProvider)] = {0};
-  EtwTraceProvider& provider = reinterpret_cast<EtwTraceProvider&>(buf);
-
-  EXPECT_EQ(NULL, provider.registration_handle());
-  EXPECT_EQ(NULL, provider.session_handle());
-  EXPECT_EQ(0, provider.enable_flags());
-  EXPECT_EQ(0, provider.enable_level());
-
-  EXPECT_FALSE(provider.ShouldLog(TRACE_LEVEL_FATAL, 0xfffffff));
-
-  // We expect these not to crash.
-  provider.Log(kTestEventClass, 0, TRACE_LEVEL_FATAL, "foo");
-  provider.Log(kTestEventClass, 0, TRACE_LEVEL_FATAL, L"foo");
-
-  EtwMofEvent<1> dummy(kTestEventClass, 0, TRACE_LEVEL_FATAL);
-  DWORD data = 0;
-  dummy.SetField(0, sizeof(data), &data);
-  provider.Log(dummy.get());
-
-  // Placement-new the provider into our buffer.
-  new (buf) EtwTraceProvider(kTestProvider);  // NOLINT
-
-  // Registration is now safe.
-  EXPECT_EQ(ERROR_SUCCESS, provider.Register());
-
-  // Destruct the instance, this should unregister it.
-  provider.EtwTraceProvider::~EtwTraceProvider();
-
-  // And post-destruction, all of the above should still be safe.
-  EXPECT_EQ(NULL, provider.registration_handle());
-  EXPECT_EQ(NULL, provider.session_handle());
-  EXPECT_EQ(0, provider.enable_flags());
-  EXPECT_EQ(0, provider.enable_level());
-
-  EXPECT_FALSE(provider.ShouldLog(TRACE_LEVEL_FATAL, 0xfffffff));
-
-  // We expect these not to crash.
-  provider.Log(kTestEventClass, 0, TRACE_LEVEL_FATAL, "foo");
-  provider.Log(kTestEventClass, 0, TRACE_LEVEL_FATAL, L"foo");
-  provider.Log(dummy.get());
-}
-
-TEST(EtwTraceProviderTest, Initialize) {
-  EtwTraceProvider provider(kTestProvider);
-
-  EXPECT_EQ(NULL, provider.registration_handle());
-  EXPECT_EQ(NULL, provider.session_handle());
-  EXPECT_EQ(0, provider.enable_flags());
-  EXPECT_EQ(0, provider.enable_level());
-}
-
-TEST(EtwTraceProviderTest, Register) {
-  EtwTraceProvider provider(kTestProvider);
-
-  EXPECT_EQ(ERROR_SUCCESS, provider.Register());
-  EXPECT_NE(NULL, provider.registration_handle());
-  EXPECT_EQ(ERROR_SUCCESS, provider.Unregister());
-  EXPECT_EQ(NULL, provider.registration_handle());
-}
-
-TEST(EtwTraceProviderTest, RegisterWithNoNameFails) {
-  EtwTraceProvider provider;
-
-  EXPECT_TRUE(provider.Register() != ERROR_SUCCESS);
-}
-
-TEST(EtwTraceProviderTest, Enable) {
-  EtwTraceProvider provider(kTestProvider);
-
-  EXPECT_EQ(ERROR_SUCCESS, provider.Register());
-  EXPECT_NE(NULL, provider.registration_handle());
-
-  // No session so far.
-  EXPECT_EQ(NULL, provider.session_handle());
-  EXPECT_EQ(0, provider.enable_flags());
-  EXPECT_EQ(0, provider.enable_level());
-
-  EXPECT_EQ(ERROR_SUCCESS, provider.Unregister());
-  EXPECT_EQ(NULL, provider.registration_handle());
-}
-
-}  // namespace omaha
diff --git a/base/exception_barrier.cc b/base/exception_barrier.cc
deleted file mode 100644
index 1bfca5e..0000000
--- a/base/exception_barrier.cc
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// A class to make it easy to tag exception propagation boundaries and
-// get crash reports of exceptions that pass over same.
-#include "omaha/base/exception_barrier.h"
-
-enum {
-  // Flag set by exception handling machinery when unwinding
-  EH_UNWINDING = 0x00000002
-};
-
-// TODO(omaha): How to make this statically parameterizable?
-ExceptionBarrier::ExceptionHandler ExceptionBarrier::s_handler_ = NULL;
-
-// This function must be extern "C" to match up with the SAFESEH
-// declaration in our corresponding ASM file
-extern "C" EXCEPTION_DISPOSITION __cdecl
-ExceptionBarrierHandler(struct _EXCEPTION_RECORD *exception_record,
-                        void * establisher_frame,
-                        struct _CONTEXT *context,
-                        void * reserved) {
-  establisher_frame;  // unreferenced formal parameter
-  reserved;
-  if (!(exception_record->ExceptionFlags & EH_UNWINDING)) {
-    // When the exception is really propagating through us, we'd like to be
-    // called before the state of the program has been modified by the stack
-    // unwinding. In the absence of an exception handler, the unhandled
-    // exception filter gets called between the first chance and the second
-    // chance exceptions, so Windows pops either the JIT debugger or WER UI.
-    // This is not desirable in most of the cases.
-    ExceptionBarrier::ExceptionHandler handler = ExceptionBarrier::handler();
-    if (handler) {
-      EXCEPTION_POINTERS ptrs = { exception_record, context };
-
-      handler(&ptrs);
-    }
-  }
-
-  return ExceptionContinueSearch;
-}
diff --git a/base/exception_barrier.h b/base/exception_barrier.h
deleted file mode 100644
index ecc01b6..0000000
--- a/base/exception_barrier.h
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// A class to make it easy to tag exception propagation boundaries and
-// get crash reports of exceptions that pass over same.
-#ifndef OMAHA_COMMON_EXCEPTION_BARRIER_H_
-#define OMAHA_COMMON_EXCEPTION_BARRIER_H_
-
-#include <windows.h>
-
-/// This is the type dictated for an exception handler by the platform ABI
-/// @see _except_handler in excpt.h
-typedef EXCEPTION_DISPOSITION (__cdecl *ExceptionHandlerFunc)(
-                                struct _EXCEPTION_RECORD *exception_record,
-                                void * establisher_frame,
-                                struct _CONTEXT *context,
-                                void * reserved);
-
-/// The type of an exception record in the exception handler chain
-struct EXCEPTION_REGISTRATION {
-  EXCEPTION_REGISTRATION *prev;
-  ExceptionHandlerFunc  handler;
-};
-
-/// This is our raw exception handler, it must be declared extern "C" to
-/// match up with the SAFESEH declaration in our corresponding ASM file
-extern "C" EXCEPTION_DISPOSITION __cdecl
-ExceptionBarrierHandler(struct _EXCEPTION_RECORD *exception_record,
-                        void * establisher_frame,
-                        struct _CONTEXT *context,
-                        void * reserved);
-
-/// An exception barrier is used to report exceptions that pass through
-/// a boundary where exceptions shouldn't pass, such as e.g. COM interface
-/// boundaries.
-/// This is handy for any kind of plugin code, where if the exception passes
-/// through unhindered, it'll either be swallowed by an SEH exception handler
-/// above us on the stack, or be reported as an unhandled exception for
-/// the application hosting the plugin code.
-///
-/// To use this class, simply instantiate an ExceptionBarrier just inside
-/// the code boundary, like this:
-/// @code
-/// HRESULT SomeObject::SomeCOMMethod(...) {
-///   ExceptionBarrier report_crashes;
-///
-///   ... other code here ...
-/// }
-/// @endcode
-class ExceptionBarrier {
- public:
-  /// Register the barrier in the SEH chain
-  ExceptionBarrier();
-
-  /// And unregister on destruction
-  ~ExceptionBarrier();
-
-  /// Signature of the handler function which gets notified when
-  /// an exception propagates through a barrier.
-  typedef void (CALLBACK *ExceptionHandler)(EXCEPTION_POINTERS *ptrs);
-
-  /// @name Accessors
-  /// @{
-  static void set_handler(ExceptionHandler handler) { s_handler_ = handler; }
-  static ExceptionHandler handler() { return s_handler_; }
-  /// @}
-
- private:
-  /// Our SEH frame
-  EXCEPTION_REGISTRATION registration_;
-
-  /// The function that gets invoked if an exception
-  /// propagates through a barrier
-  /// TODO(omaha): how can this be statically parametrized?
-  static ExceptionHandler s_handler_;
-};
-
-/// @name These are implemented in the associated .asm file
-/// @{
-extern "C" void WINAPI RegisterExceptionRecord(
-                          EXCEPTION_REGISTRATION *registration,
-                          ExceptionHandlerFunc func);
-extern "C" void WINAPI UnregisterExceptionRecord(
-                          EXCEPTION_REGISTRATION *registration);
-/// @}
-
-
-inline ExceptionBarrier::ExceptionBarrier() {
-  RegisterExceptionRecord(&registration_, ExceptionBarrierHandler);
-}
-
-inline ExceptionBarrier::~ExceptionBarrier() {
-  // TODO(omaha): I don't think it's safe to unregister after an exception
-  //          has taken place???
-  UnregisterExceptionRecord(&registration_);
-}
-
-#endif  // OMAHA_COMMON_EXCEPTION_BARRIER_H_
diff --git a/base/exception_barrier_lowlevel.asm b/base/exception_barrier_lowlevel.asm
deleted file mode 100644
index 0906b92..0000000
--- a/base/exception_barrier_lowlevel.asm
+++ /dev/null
@@ -1,63 +0,0 @@
-; Copyright 2006-2009 Google Inc.
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-;      http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-; ========================================================================
-;
-; Tag the exception handler as an SEH handler in case the executable
-; is linked with /SAFESEH (which is the default).
-;
-; MASM 8.0 inserts an additional leading underscore in front of names
-; and this is an attempted fix until we understand why.
-IF @version LT 800
-_ExceptionBarrierHandler PROTO
-.SAFESEH _ExceptionBarrierHandler
-ELSE
-ExceptionBarrierHandler PROTO
-.SAFESEH ExceptionBarrierHandler
-ENDIF
-
-.586
-.MODEL FLAT, STDCALL
-ASSUME FS:NOTHING
-.CODE
-
-; extern "C" void WINAPI RegisterExceptionRecord(
-;                          EXCEPTION_REGISTRATION *registration,
-;                          ExceptionHandlerFunc func);
-RegisterExceptionRecord PROC registration:DWORD, func:DWORD
-OPTION PROLOGUE:None
-OPTION EPILOGUE:None
-  mov   edx, DWORD PTR [esp + 4]  ; edx is registration
-  mov   eax, DWORD PTR [esp + 8] ; eax is func
-  mov   DWORD PTR [edx + 4], eax
-  mov   eax, FS:[0]
-  mov   DWORD PTR [edx], eax
-  mov   FS:[0], edx
-  ret   8
-
-RegisterExceptionRecord ENDP
-
-; extern "C" void UnregisterExceptionRecord(
-;                           EXCEPTION_REGISTRATION *registration);
-UnregisterExceptionRecord PROC registration:DWORD
-OPTION PROLOGUE:None
-OPTION EPILOGUE:None
-
-  mov   edx, DWORD PTR [esp + 4]
-  mov   eax, [edx]
-  mov   FS:[0], eax
-  ret   4
-
-UnregisterExceptionRecord ENDP
-
-END
diff --git a/base/exception_utils.cc b/base/exception_utils.cc
deleted file mode 100644
index 56af779..0000000
--- a/base/exception_utils.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "exception_utils.h"
-
-
-// Capture a CONTEXT that represents machine state at callsite
-// TODO(omaha): 64 bit platforms can pass through to
-//      RtlCaptureContext (or can they?)
-__declspec(naked) PCONTEXT WINAPI CaptureContext(PCONTEXT runner) {
-  runner;   // unreferenced formal parameter
-  __asm {
-    // set up a call frame
-    push ebp
-    mov ebp, esp
-
-    // save ecx for later
-    push ecx
-
-    // fetch the context record pointer argument into ecx
-    // which we use as pointer to context throughout the rest
-    // of this function
-    mov ecx, DWORD PTR [ebp + 8]
-
-    // set flags
-    mov [ecx]CONTEXT.ContextFlags, CONTEXT_SEGMENTS | CONTEXT_INTEGER | \
-                                   CONTEXT_CONTROL | CONTEXT_FLOATING_POINT
-
-    // stash the integer registers away
-    mov [ecx]CONTEXT.Edi, edi
-    mov [ecx]CONTEXT.Ebx, ebx
-    mov [ecx]CONTEXT.Edx, edx
-    mov [ecx]CONTEXT.Eax, eax
-    mov [ecx]CONTEXT.Esi, esi
-    // get the saved ecx
-    pop eax
-    mov [ecx]CONTEXT.Ecx, eax
-
-    // now control registers
-    pushfd
-    pop eax
-    mov [ecx]CONTEXT.EFlags, eax
-
-    // get the old ebp, our FP points to it
-    mov eax, [ebp]
-    mov [ecx]CONTEXT.Ebp, eax
-
-    // get return address and record as eip
-    mov eax, [ebp + 4]
-    mov [ecx]CONTEXT.Eip, eax
-
-    // esp post-return is ...
-    lea eax, [ebp + 0xC]
-    mov [ecx]CONTEXT.Esp, eax
-
-    // snarf segment registers
-    mov word ptr [ecx]CONTEXT.SegSs, ss
-    mov word ptr [ecx]CONTEXT.SegCs, cs
-    mov word ptr [ecx]CONTEXT.SegGs, gs
-    mov word ptr [ecx]CONTEXT.SegFs, fs
-    mov word ptr [ecx]CONTEXT.SegEs, es
-    mov word ptr [ecx]CONTEXT.SegDs, ds
-
-    // and lastly grab floating point state
-    fnsave [ecx]CONTEXT.FloatSave
-
-    // return the CONTEXT pointer
-    mov eax, ecx
-
-    // and return
-    pop ebp
-    ret 4
-  }
-}
diff --git a/base/exception_utils.h b/base/exception_utils.h
deleted file mode 100644
index 9ee9005..0000000
--- a/base/exception_utils.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Utility functions for crash reporting
-#ifndef OMAHA_COMMON_EXCEPTION_UTILS_H_
-#define OMAHA_COMMON_EXCEPTION_UTILS_H_
-
-#include <windows.h>
-
-/// Captures machine state at callsite.
-PCONTEXT WINAPI CaptureContext(PCONTEXT runner);
-
-#endif  // OMAHA_COMMON_EXCEPTION_UTILS_H_
diff --git a/base/extractor_unittest.cc b/base/extractor_unittest.cc
deleted file mode 100644
index 180fe59..0000000
--- a/base/extractor_unittest.cc
+++ /dev/null
@@ -1,246 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Unit test for the extractor and the ApplyTag class.
-//
-// TODO(omaha): eliminate the dependency on the hardcoded "GoogleUpdate.exe"
-// program name.
-
-#include <shlobj.h>
-#include "base/scoped_ptr.h"
-#include "omaha/base/apply_tag.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/extractor.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-const TCHAR kFilePath[] = _T(".");
-const TCHAR kFileName[] = _T("GoogleUpdate.exe");
-const char kTagString[] = "1234567890abcdefg";
-const char kAppendTagString[] = "..AppendedStr";
-
-TEST(ExtractorTest, EmbedExtract) {
-  // Test the extractor.
-  TagExtractor extractor;
-  ASSERT_FALSE(extractor.IsFileOpen());
-
-  CString signed_exe_file;
-  signed_exe_file.Format(_T("%s\\%s\\%s"),
-                         app_util::GetCurrentModuleDirectory(),
-                         kFilePath, kFileName);
-  ASSERT_TRUE(extractor.OpenFile(signed_exe_file));
-
-  // No tag string in the original exe file.
-  int tag_buffer_size = 0;
-  ASSERT_FALSE(extractor.ExtractTag(NULL, &tag_buffer_size));
-  ASSERT_EQ(tag_buffer_size, 0);
-  extractor.CloseFile();
-
-  // Create a temp dir.
-  TCHAR temp_path[MAX_PATH] = {0};
-  *temp_path = 0;
-  ASSERT_NE(::GetTempPath(MAX_PATH, temp_path), 0);
-
-  // Embed the tag string.
-  CString tagged_file;
-  tagged_file.Format(_T("%s%s"), temp_path, kFileName);
-  omaha::ApplyTag tag;
-  ASSERT_HRESULT_SUCCEEDED(tag.Init(signed_exe_file,
-                                    kTagString,
-                                    strlen(kTagString),
-                                    tagged_file,
-                                    false));
-  ASSERT_SUCCEEDED(tag.EmbedTagString());
-  ON_SCOPE_EXIT(::DeleteFile, tagged_file);
-
-  // Extract the tag string.
-  tag_buffer_size = 0;
-  ASSERT_TRUE(extractor.OpenFile(tagged_file));
-  ASSERT_TRUE(extractor.ExtractTag(NULL, &tag_buffer_size));
-  ASSERT_EQ(tag_buffer_size, arraysize(kTagString));
-
-  char tag_buffer[arraysize(kTagString)] = {0};
-  ASSERT_TRUE(extractor.ExtractTag(tag_buffer, &tag_buffer_size));
-  ASSERT_EQ(tag_buffer_size, arraysize(kTagString));
-  ASSERT_EQ(memcmp(tag_buffer, kTagString, arraysize(kTagString)), 0);
-  extractor.CloseFile();
-}
-
-TEST(ExtractorTest, EmbedAppendExtract) {
-  // Test the extractor.
-  TagExtractor extractor;
-  ASSERT_FALSE(extractor.IsFileOpen());
-
-  CString signed_exe_file;
-  signed_exe_file.Format(_T("%s\\%s\\%s"),
-                         app_util::GetCurrentModuleDirectory(),
-                         kFilePath, kFileName);
-  ASSERT_TRUE(extractor.OpenFile(signed_exe_file));
-
-  // No tag string in the original exe file.
-  int tag_buffer_size = 0;
-  ASSERT_FALSE(extractor.ExtractTag(NULL, &tag_buffer_size));
-  ASSERT_GT(extractor.cert_length(), 0);
-  ASSERT_EQ(tag_buffer_size, 0);
-  extractor.CloseFile();
-
-  // Create a temp dir.
-  TCHAR temp_path[MAX_PATH] = {0};
-  *temp_path = 0;
-  ASSERT_NE(::GetTempPath(MAX_PATH, temp_path), 0);
-
-  // Embed the tag string.
-  CString tagged_file;
-  tagged_file.Format(_T("%s%d%s"), temp_path, 1, kFileName);
-  omaha::ApplyTag tag;
-  ASSERT_HRESULT_SUCCEEDED(tag.Init(signed_exe_file,
-                                    kTagString,
-                                    strlen(kTagString),
-                                    tagged_file,
-                                    false));
-  ASSERT_SUCCEEDED(tag.EmbedTagString());
-  ON_SCOPE_EXIT(::DeleteFile, tagged_file);
-
-  // Append another tag string.
-  CString tagged_appended_file;
-  tagged_appended_file.Format(_T("%s%d%s"), temp_path, 2, kFileName);
-  omaha::ApplyTag tag1;
-
-  ASSERT_HRESULT_SUCCEEDED(tag1.Init(tagged_file,
-                                     kAppendTagString,
-                                     strlen(kAppendTagString),
-                                     tagged_appended_file,
-                                     true));
-  ASSERT_SUCCEEDED(tag1.EmbedTagString());
-  ON_SCOPE_EXIT(::DeleteFile, tagged_appended_file);
-
-  // Append another tag string.
-  CString tagged_appended_file2;
-  tagged_appended_file2.Format(_T("%s%d%s"), temp_path, 3, kFileName);
-  omaha::ApplyTag tag2;
-  ASSERT_HRESULT_SUCCEEDED(tag2.Init(tagged_appended_file,
-                                     kAppendTagString,
-                                     strlen(kAppendTagString),
-                                     tagged_appended_file2,
-                                     true));
-  ASSERT_SUCCEEDED(tag2.EmbedTagString());
-  ON_SCOPE_EXIT(::DeleteFile, tagged_appended_file2);
-
-  // Extract the tag string.
-  tag_buffer_size = 0;
-  CStringA expected_tag_string(kTagString);
-  expected_tag_string += kAppendTagString;
-  expected_tag_string += kAppendTagString;
-  int expected_tag_string_len = expected_tag_string.GetLength() + 1;
-  ASSERT_TRUE(extractor.OpenFile(tagged_appended_file2));
-  ASSERT_TRUE(extractor.ExtractTag(NULL, &tag_buffer_size));
-  ASSERT_EQ(tag_buffer_size, expected_tag_string_len);
-
-  scoped_array<char> tag_buffer(new char[expected_tag_string_len]);
-  ASSERT_TRUE(extractor.ExtractTag(tag_buffer.get(), &tag_buffer_size));
-  ASSERT_EQ(tag_buffer_size, expected_tag_string_len);
-  ASSERT_EQ(memcmp(tag_buffer.get(),
-                   expected_tag_string,
-                   expected_tag_string_len),
-            0);
-  extractor.CloseFile();
-}
-
-TEST(ExtractorTest, AlreadyTaggedError) {
-  // Test the extractor.
-  TagExtractor extractor;
-  ASSERT_FALSE(extractor.IsFileOpen());
-
-  CString signed_exe_file;
-  signed_exe_file.Format(_T("%s\\%s\\%s"),
-                         app_util::GetCurrentModuleDirectory(),
-                         kFilePath, kFileName);
-  ASSERT_TRUE(extractor.OpenFile(signed_exe_file));
-
-  // No tag string in the original exe file.
-  int tag_buffer_size = 0;
-  ASSERT_FALSE(extractor.ExtractTag(NULL, &tag_buffer_size));
-  ASSERT_GT(extractor.cert_length(), 0);
-  ASSERT_EQ(tag_buffer_size, 0);
-  extractor.CloseFile();
-
-  // Create a temp dir.
-  TCHAR temp_path[MAX_PATH] = {0};
-  *temp_path = 0;
-  ASSERT_NE(::GetTempPath(MAX_PATH, temp_path), 0);
-
-  // Embed the tag string.
-  CString tagged_file;
-  tagged_file.Format(_T("%s%d%s"), temp_path, 1, kFileName);
-  omaha::ApplyTag tag1;
-  ASSERT_HRESULT_SUCCEEDED(tag1.Init(signed_exe_file,
-                                     kTagString,
-                                     strlen(kTagString),
-                                     tagged_file,
-                                     false));
-  ASSERT_SUCCEEDED(tag1.EmbedTagString());
-  ON_SCOPE_EXIT(::DeleteFile, tagged_file);
-
-  CString tagged_appended_file;
-  tagged_appended_file.Format(_T("%s%d%s"), temp_path, 2, kFileName);
-  omaha::ApplyTag tag2;
-  ASSERT_HRESULT_SUCCEEDED(tag2.Init(tagged_file,
-                                     kAppendTagString,
-                                     strlen(kAppendTagString),
-                                     tagged_appended_file,
-                                     false));
-  ASSERT_EQ(tag2.EmbedTagString(), APPLYTAG_E_ALREADY_TAGGED);
-  ON_SCOPE_EXIT(::DeleteFile, tagged_appended_file);
-  extractor.CloseFile();
-}
-
-TEST(ApplyTagTest, InvalidCharsTest) {
-  // Accepted Regex = [-%{}/\a&=._]*
-  CString signed_exe_file;
-  signed_exe_file.Format(_T("%s\\%s\\%s"),
-                         app_util::GetCurrentModuleDirectory(),
-                         kFilePath, kFileName);
-  CString tagged_file(_T("out.txt"));
-
-  const char* const input_str = "abcd";
-  omaha::ApplyTag tag1;
-  ASSERT_HRESULT_SUCCEEDED(tag1.Init(signed_exe_file,
-                                     input_str,
-                                     strlen(input_str),
-                                     tagged_file,
-                                     false));
-
-  const char* const input_str2 = "abcd$%#";
-  omaha::ApplyTag tag2;
-  ASSERT_HRESULT_FAILED(tag2.Init(signed_exe_file,
-                                  input_str2,
-                                  strlen(input_str2),
-                                  tagged_file,
-                                  false));
-
-  const char* const input_str3 = "abcd asdf";
-  omaha::ApplyTag tag3;
-  ASSERT_HRESULT_FAILED(tag3.Init(signed_exe_file,
-                                  input_str3,
-                                  strlen(input_str3),
-                                  tagged_file,
-                                  false));
-}
-
-}  // namespace omaha
-
diff --git a/base/file.cc b/base/file.cc
deleted file mode 100644
index 8317af1..0000000
--- a/base/file.cc
+++ /dev/null
@@ -1,1430 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-// File handling routines
-//
-// Possible performance improvement: make a subclass or alternate class
-// that reads an entire file into memory and fulfills read/write requests
-// in memory (or equivalently, use a memory mapped file). This can greatly
-// improve performance if there are files we do a lot of read/write requests on.
-//
-// We generally are dealing with files that can be very large and want to
-// minimize memory usage, so this is not high priority
-//
-// this has the beginnings of asynchronous access support
-//
-// Unfortunately, doing asynchronous reads with FILE_FLAG_OVERLAPPED buys us
-// nothing because the system cache manager enforces serial requests.
-//
-// Hence, we need to also use FILE_FLAG_NO_BUFFERING. this has a number of
-// constraints:
-// - file read/write position must be aligned on multiples of the disk sector
-//   size
-// - file read/write length must be a multiple of the sector size
-// - read/write buffer must be aligned on multiples of the disk sector size
-//
-// In particular, this means that we cannot write 8 bytes, for example, because
-// we have to write an entire sector.
-//
-// Currently, the implementation only supports enough to do some simple read
-// tests
-//
-// The general idea is code that wants to to a sequence of asynchronous actions
-// will look like the following, for an example of reading multiple event
-// records asynchronously:
-//
-// uint32 async_id = File::GetNextAsyncId()
-// while (!done) {
-//   for (everything_to_do, e.g., for each event to read) {
-//     call File::Read to read items needed;
-//     returns TR_E_FILE_ASYNC_PENDING if queued; or returns data if done
-//     process the item (e.g., event) if desired
-//   }
-//   call some routine to process pending completions; initiate delayed action
-// }
-// call some cleanup routine
-
-#include "omaha/base/file.h"
-#include <algorithm>
-#include "base/scoped_ptr.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/const_config.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/path.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/string.h"
-#include "omaha/base/system.h"
-#include "omaha/base/timer.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-// Constants
-const uint32 kZeroSize = 4096;  // Buffer size used for clearing data in a file.
-
-// The moves-pending-reboot is a MULTISZ registry key in the HKLM part of the
-// registry.
-static const TCHAR* kSessionManagerKey =
-    _T("HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager");
-static const TCHAR* kPendingFileRenameOps = _T("PendingFileRenameOperations");
-
-File::File()
-    : handle_(INVALID_HANDLE_VALUE), read_only_(false), sequence_id_(0) {
-}
-
-File::~File() {
-  if (handle_ != INVALID_HANDLE_VALUE) {
-    VERIFY1(SUCCEEDED(Close()));
-  }
-}
-
-// open for reading only if write == false, otherwise both reading and writing
-// allow asynchronous operations if async == true. Use this function when you
-// need exclusive access to the file.
-HRESULT File::Open(const TCHAR* file_name, bool write, bool async) {
-  return OpenShareMode(file_name, write, async, 0);
-}
-
-// Allows specifying a sharing mode such as FILE_SHARE_READ. Otherwise,
-// this is identical to File::Open().
-HRESULT File::OpenShareMode(const TCHAR* file_name,
-                            bool write,
-                            bool async,
-                            DWORD share_mode) {
-  ASSERT1(file_name && *file_name);
-  ASSERT1(handle_ == INVALID_HANDLE_VALUE);
-  VERIFY1(!async);
-
-  file_name_ = file_name;
-
-  // there are restrictions on what we can do if using FILE_FLAG_NO_BUFFERING
-  // if (!buffer) { flags |= FILE_FLAG_NO_BUFFERING; }
-  // FILE_FLAG_WRITE_THROUGH
-  // how efficient is NTFS encryption? FILE_ATTRIBUTE_ENCRYPTED
-  // FILE_ATTRIBUTE_TEMPORARY
-  // FILE_FLAG_RANDOM_ACCESS
-  // FILE_FLAG_SEQUENTIAL_SCAN
-
-  handle_ = ::CreateFile(file_name,
-                         write ? (FILE_WRITE_DATA       |
-                                  FILE_WRITE_ATTRIBUTES |
-                                  FILE_READ_DATA) : FILE_READ_DATA,
-                         share_mode,
-                         NULL,
-                         write ? OPEN_ALWAYS : OPEN_EXISTING,
-                         FILE_FLAG_RANDOM_ACCESS,
-                         NULL);
-
-  if (handle_ == INVALID_HANDLE_VALUE) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR,
-            (_T("[File::OpenShareMode - CreateFile failed][%s][%d][%d][0x%x]"),
-             file_name, write, async, hr));
-    return hr;
-  }
-
-  // This attribute is not supported directly by the CreateFile function.
-  if (write &&
-      !::SetFileAttributes(file_name, FILE_ATTRIBUTE_NOT_CONTENT_INDEXED)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR,
-            (_T("[File::OpenShareMode - SetFileAttributes failed][0x%x]"), hr));
-    return hr;
-  }
-
-  read_only_ = !write;
-  pos_ = 0;
-  return S_OK;
-}
-
-// The path must not be enclosed in quotes. This is the Windows standard.
-// ::GetFileAttributesEx() returns ERROR_INVALID_NAME for quoted paths.
-bool File::Exists(const TCHAR* file_name) {
-  ASSERT1(file_name && *file_name);
-  ASSERT1(lstrlen(file_name) > 0);
-
-  // NOTE: This is the fastest implementation I found.  The results were:
-  //   CreateFile           1783739 avg ticks/call
-  //   FindFirstFile         634148 avg ticks/call
-  //   GetFileAttributes     428714 avg ticks/call
-  //   GetFileAttributesEx   396324 avg ticks/call
-  WIN32_FILE_ATTRIBUTE_DATA attrs = {0};
-  return 0 != ::GetFileAttributesEx(file_name, ::GetFileExInfoStandard, &attrs);
-}
-
-bool File::IsDirectory(const TCHAR* file_name) {
-  ASSERT1(file_name && *file_name);
-
-  WIN32_FILE_ATTRIBUTE_DATA attrs;
-  SetZero(attrs);
-  if (!::GetFileAttributesEx(file_name, ::GetFileExInfoStandard, &attrs)) {
-    UTIL_LOG(LEVEL_ERROR,
-             (_T("[File::IsDirectory - GetFileAttributesEx failed][%s][0x%x]"),
-              file_name, HRESULTFromLastError()));
-    return false;
-  }
-
-  return (attrs.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
-}
-
-HRESULT File::GetWildcards(const TCHAR* dir,
-                           const TCHAR* wildcard,
-                           std::vector<CString>* matching_paths) {
-  ASSERT1(dir && *dir);
-  ASSERT1(wildcard && *wildcard);
-  ASSERT1(matching_paths);
-
-  matching_paths->clear();
-
-  // Make sure directory name ends with "\"
-  CString directory = String_MakeEndWith(dir, _T("\\"), false);
-
-  WIN32_FIND_DATA find_data;
-  SetZero(find_data);
-  scoped_hfind hfind(::FindFirstFile(directory + wildcard, &find_data));
-  if (!hfind) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(L5, (_T("[File::GetWildcards - FindFirstFile failed][0x%x]"), hr));
-    return hr;
-  }
-  do {
-    if (find_data.dwFileAttributes == FILE_ATTRIBUTE_NORMAL ||
-        !(find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
-      CString to_file(directory + find_data.cFileName);
-      matching_paths->push_back(to_file);
-    }
-  } while (::FindNextFile(get(hfind), &find_data));
-
-  HRESULT hr = HRESULTFromLastError();
-  if (hr != HRESULT_FROM_WIN32(ERROR_NO_MORE_FILES)) {
-    UTIL_LOG(LEVEL_ERROR,
-             (_T("[File::GetWildcards - FindNextFile failed][0x%x]"), hr));
-    return hr;
-  }
-  return S_OK;
-}
-
-// returns error if cannot remove
-// returns success if removed or already removed
-HRESULT File::Remove(const TCHAR* file_name) {
-  ASSERT1(file_name && *file_name);
-
-  if (!Exists(file_name)) {
-    return S_OK;
-  }
-
-  if (!::DeleteFile(file_name)) {
-    return HRESULTFromLastError();
-  }
-
-  return S_OK;
-}
-
-HRESULT File::CopyWildcards(const TCHAR* from_dir,
-                            const TCHAR* to_dir,
-                            const TCHAR* wildcard,
-                            bool replace_existing_files) {
-  ASSERT1(from_dir && *from_dir);
-  ASSERT1(to_dir && *to_dir);
-  ASSERT1(wildcard && *wildcard);
-
-  // Make sure dir names end with a "\"
-  CString from_directory = String_MakeEndWith(from_dir, _T("\\"), false);
-  CString to_directory = String_MakeEndWith(to_dir, _T("\\"), false);
-
-  // Get full path to source files (which is a wildcard)
-  CString from_files(from_directory + wildcard);
-
-  // Run over all files that match wildcard
-  WIN32_FIND_DATA find_data;
-  SetZero(find_data);
-
-  scoped_hfind hfind(::FindFirstFile(from_files, &find_data));
-  if (!hfind) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR,
-             (_T("[File::CopyWildcards - FindFirstFile failed][0x%x]"), hr));
-    return hr;
-  }
-  do {
-    // Copy files
-    if (find_data.dwFileAttributes == FILE_ATTRIBUTE_NORMAL ||
-        !(find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
-      CString from_file(from_directory + find_data.cFileName);
-      CString to_file(to_directory + find_data.cFileName);
-
-      if (!replace_existing_files && Exists(to_file)) {
-        // Continue, since the caller has explicitly asked us to not replace an
-        // existing file
-        continue;
-      }
-
-      RET_IF_FAILED(Copy(from_file, to_file, replace_existing_files));
-    }
-  } while (::FindNextFile(get(hfind), &find_data));
-
-  HRESULT hr = HRESULTFromLastError();
-  if (hr != HRESULT_FROM_WIN32(ERROR_NO_MORE_FILES)) {
-    UTIL_LOG(LEVEL_ERROR,
-             (_T("[File::CopyWildcards - FindNextFile failed][0x%x]"), hr));
-    return hr;
-  }
-  return S_OK;
-}
-
-HRESULT File::CopyTree(const TCHAR* from_dir,
-                       const TCHAR* to_dir,
-                       bool replace_existing_files) {
-  ASSERT1(from_dir && *from_dir);
-  ASSERT1(to_dir && *to_dir);
-
-  UTIL_LOG(L3, (L"[File::CopyTree][from_dir %s][to_dir %s][replace %d]",
-                from_dir, to_dir, replace_existing_files));
-
-  // Make sure dir names end with a "\"
-  CString from_directory(String_MakeEndWith(from_dir, L"\\", false));
-  CString to_directory(String_MakeEndWith(to_dir, L"\\", false));
-
-  RET_IF_FAILED(CreateDir(to_directory, NULL));
-  RET_IF_FAILED(CopyWildcards(from_directory,
-                              to_directory,
-                              L"*.*",
-                              replace_existing_files));
-
-  // Run over all directories
-  WIN32_FIND_DATA find_data;
-  SetZero(find_data);
-
-  CString from_files(from_directory);
-  from_files += _T("*.*");
-
-  scoped_hfind hfind(::FindFirstFile(from_files, &find_data));
-  if (!hfind) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR,
-             (_T("[File::CopyTree - FindFirstFile failed][0x%x]"), hr));
-    return hr;
-  }
-  do {
-    // Copy files
-    if ((find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0 &&
-        String_StrNCmp(find_data.cFileName, L"..", 2, false) &&
-        String_StrNCmp(find_data.cFileName, L".", 2, false)) {
-      CString from_subdir(from_directory + find_data.cFileName);
-      CString to_subdir(to_directory + find_data.cFileName);
-      RET_IF_FAILED(CopyTree(from_subdir, to_subdir, replace_existing_files));
-    }
-  } while (::FindNextFile(get(hfind), &find_data));
-
-  HRESULT hr = HRESULTFromLastError();
-  if (hr != HRESULT_FROM_WIN32(ERROR_NO_MORE_FILES)) {
-    UTIL_LOG(LEVEL_ERROR,
-             (_T("[File::CopyTree - FindNextFile failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT File::Copy(const TCHAR* from,
-                   const TCHAR* to,
-                   bool replace_existing_file) {
-  ASSERT1(from && *from);
-  ASSERT1(to && *to);
-
-  if (!replace_existing_file && Exists(to)) {
-    // Return success, since the caller has explicitly asked us to not replace
-    // an existing file
-    return S_OK;
-  }
-
-  if (!::CopyFile(from, to, !replace_existing_file)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[File::Copy - CopyFile failed]")
-                           _T("[from=%s][to=%s][replace=%u][0x%x]"),
-                           from, to, replace_existing_file, hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// TODO(omaha): Combine common code in Move/MoveAfterReboot
-HRESULT File::Move(const TCHAR* from,
-                   const TCHAR* to,
-                   bool replace_existing_file) {
-  ASSERT1(from && *from);
-  ASSERT1(to && *to);
-
-  DWORD flags = MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH;
-  if (replace_existing_file) {
-    flags |= MOVEFILE_REPLACE_EXISTING;
-  }
-
-  if (!::MoveFileEx(from, to, flags)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR,
-             (_T("[File::Move - MoveFileEx failed]")
-              _T("[from=%s][to=%s][replace=%u][0x%x]"),
-              from, to, replace_existing_file, hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// DeleteAfterReboot tries to delete the files by either moving them to the TEMP
-// directory and deleting them on reboot, or if that fails, by trying to delete
-// them in-place on reboot
-HRESULT File::DeleteAfterReboot(const TCHAR* from) {
-  ASSERT1(from && *from);
-
-  if (File::Exists(from)) {
-    HRESULT hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
-    CString from_temp;
-
-    // No point in moving into TEMP if we're already there
-    if (!String_StartsWith(from, app_util::GetTempDir(), true)) {
-      // Try to move to the TEMP directory first
-      CString temp_dir(String_MakeEndWith(app_util::GetTempDir(),
-                                          _T("\\"),
-                                          false));
-      // Of the form "C:\\Windows\\Temp\\FROM.EXE1f4c0b7f"
-      from_temp.Format(_T("%s%s%x"),
-                       temp_dir,
-                       GetFileFromPath(from),
-                       ::GetTickCount());
-
-      hr = File::Move(from, from_temp, true);
-      UTIL_LOG(L2, (_T("[File::DeleteAfterReboot - move %s to %s][0x%x]"),
-                    from, from_temp, hr));
-    }
-
-    if (SUCCEEDED(hr)) {
-      UTIL_LOG(L2, (_T("[File::DeleteAfterReboot - delete %s after reboot]"),
-                    from_temp));
-      // Move temp file after reboot
-      if (FAILED(hr = File::MoveAfterReboot(from_temp, NULL))) {
-        UTIL_LOG(LEVEL_ERROR, (_T("[DeleteWildcardFiles]")
-                               _T("[failed to delete after reboot %s][0x%x]"),
-                               from_temp, hr));
-      }
-    } else  {
-      // Move original file after reboot
-      if (FAILED(hr = File::MoveAfterReboot(from, NULL))) {
-        UTIL_LOG(LEVEL_ERROR, (_T("[DeleteWildcardFiles]")
-                               _T("[failed to delete after reboot %s][0x%x]"),
-                               from, hr));
-      }
-    }
-
-    return hr;
-  }
-
-  return S_OK;
-}
-
-
-HRESULT File::MoveAfterReboot(const TCHAR* from, const TCHAR* to) {
-  ASSERT1(from && *from);
-
-  if (!File::Exists(from)) {
-    // File/directory doesn't exist, should this return failure or success?
-    // Decision:  Failure.  Because the caller can decide if it is really
-    // failure or not in his specific case.
-    UTIL_LOG(LEVEL_WARNING, (_T("[File::MoveAfterReboot]")
-                             _T("[file doesn't exist][from %s]"), from));
-    return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
-  }
-
-  DWORD flags = MOVEFILE_DELAY_UNTIL_REBOOT;
-  if (!File::IsDirectory(from)) {
-    // This flag valid only for files
-    flags |= MOVEFILE_REPLACE_EXISTING;
-  }
-
-  if (!::MoveFileEx(from, to, flags)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[File::MoveAfterReboot]")
-                           _T("[failed to MoveFileEx from '%s' to '%s'][0x%x]"),
-                           from, to, hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// See if we have any moves pending a reboot. Return SUCCESS if we do
-// not encounter errors (not finding a move is not an error). We need to
-// also check the value of *found_ptr for whether we actually found a move.
-// On return, *value_multisz_ptr is the value within
-// "PendingFileRenameOperations", but with any moves for in_directory removed
-// from it.
-// The prefix_match boolean controls whether we do an exact match on
-// in_directory, or remove all entries with the in_directory prefix.
-// NOTE: If the only values found were our own keys, the whole
-// PendingFileRenameOperations MULTISZ needs to be deleted.
-// This is signified by a returned *value_size_chars_ptr of 0.
-HRESULT File::GetPendingRenamesValueMinusDir(const TCHAR* in_directory,
-                                             bool prefix_match,
-                                             TCHAR** value_multisz_ptr,
-                                             DWORD* value_size_chars_ptr,
-                                             bool* found_ptr) {
-  ASSERT1(in_directory && *in_directory);
-
-  // Convert to references for easier-to-read-code:
-  TCHAR*& value_multisz = *value_multisz_ptr;
-  DWORD& value_size_chars = *value_size_chars_ptr;
-  bool& found = *found_ptr;
-
-  // Initialize [out] parameters
-  value_multisz = NULL;
-  value_size_chars = 0;
-  found = false;
-
-  // Locals mirroring the [out] parameters.
-  // We will only set the corresponding [out] parameters when we have something
-  // meaningful to return to the caller
-  scoped_array<TCHAR> value_multisz_local;
-  DWORD value_size_chars_local = 0;
-
-  DWORD value_size_bytes = 0;
-  // Get the current value of the key
-  // If the Key is missing, that's totally acceptable.
-  RET_IF_FALSE(
-      RegKey::HasValue(kSessionManagerKey, kPendingFileRenameOps) &&
-      SUCCEEDED(RegKey::GetValue(kSessionManagerKey,
-                                 kPendingFileRenameOps,
-                                 reinterpret_cast<byte**>(&value_multisz_local),
-                                 &value_size_bytes)),
-      S_OK);
-
-  ASSERT1(value_multisz_local.get() || value_size_bytes == 0);
-  UTIL_LOG(L5, (_T("[File::GetPendingRenamesValueMinusDir]")
-                _T("[read multisz %d bytes]"),
-                value_size_bytes));
-  RET_IF_FALSE(value_size_bytes > 0, S_OK);
-
-  // The size should always be aligned to a TCHAR boundary, otherwise the key
-  // is corrupted.
-  ASSERT1((value_size_bytes % sizeof(TCHAR)) == 0);
-  RET_IF_FALSE((value_size_bytes % sizeof(TCHAR)) == 0,
-               HRESULT_FROM_WIN32(ERROR_BADKEY));
-  // Valid size, so convert to TCHARs:
-  value_size_chars_local = value_size_bytes / sizeof(TCHAR);
-
-  // Buffer must terminate with two nulls
-  ASSERT(value_size_chars_local >= 2 &&
-         !value_multisz_local[value_size_chars_local - 1] &&
-         !value_multisz_local[value_size_chars_local - 2],
-         (_T("buffer must terminate with two nulls")));
-  RET_IF_FALSE(value_size_chars_local >= 2 &&
-               !value_multisz_local[value_size_chars_local - 1] &&
-               !value_multisz_local[value_size_chars_local - 2],
-               HRESULT_FROM_WIN32(ERROR_BADKEY));
-  // Mark the end of the string.
-  // multisz_end will point at the character past end of buffer:
-  TCHAR* multisz_end = value_multisz_local.get() + value_size_chars_local;
-
-  // We're looking for \??\C:\...  The \??\ was
-  // added by the OS to the directory name we specified.
-  CString from_dir(_T("\\??\\"));
-  from_dir += in_directory;
-  DWORD from_dir_len = from_dir.GetLength();
-
-  // A MULTISZ is a list of null terminated strings, terminated by a double
-  // null.  We keep two pointers marching along the string in parallel.
-  TCHAR* str_read = value_multisz_local.get();
-  TCHAR* str_write = str_read;
-
-  while ((str_read < multisz_end) && *str_read) {
-    size_t str_len = ::lstrlen(str_read);
-  // A FALSE here indicates a corrupt PendingFileRenameOperations
-    RET_IF_FALSE((str_read + str_len + 1) < multisz_end,
-      HRESULT_FROM_WIN32(ERROR_BADKEY));
-    if (0 == String_StrNCmp(str_read,
-                            from_dir,
-                            from_dir_len + (prefix_match ? 0 : 1),
-                            true)) {
-      // String matches, we want to remove this string, so advance only the
-      // read pointer - past this string and the replacement string.
-      UTIL_LOG(L5, (_T("[File::GetPendingRenamesValueMinusDir]")
-                    _T("[skips past match '%s']"),
-                    str_read));
-      str_read += str_len + 1;
-      str_read += ::lstrlen(str_read) + 1;
-      continue;
-    }
-    // String doesn't match, we want to keep it.
-    if (str_read != str_write) {
-      // Here we're not in sync in the buffer, we've got to move two
-      // strings down.
-      UTIL_LOG(L5, (_T("[File::GetPendingRenamesValueMinusDir]")
-                    _T("[copying some other deletion][%s][%s]"),
-                    str_read, str_read + ::lstrlen(str_read) + 1));
-      ASSERT1(str_write < str_read);
-      String_StrNCpy(str_write, str_read, str_len+1);
-      str_read += str_len + 1;
-      str_write += str_len + 1;
-      str_len = ::lstrlen(str_read);
-      String_StrNCpy(str_write, str_read, str_len+1);
-      str_read += str_len + 1;
-      str_write += str_len + 1;
-    } else {
-      // We're in sync in the buffer, advance both pointers past two strings
-      UTIL_LOG(L5, (_T("[File::GetPendingRenamesValueMinusDir]")
-                    _T("[skipping past some other deletion][%s][%s]"),
-                    str_read, str_read + ::lstrlen(str_read) + 1));
-      str_read += str_len + 1;
-      str_read += ::lstrlen(str_read) + 1;
-      str_write = str_read;
-    }
-  }
-
-  // A FALSE here indicates a corrupt PendingFileRenameOperations
-  RET_IF_FALSE(str_read < multisz_end,
-    HRESULT_FROM_WIN32(ERROR_BADKEY));
-
-  if (str_read != str_write) {
-    // We found some values
-    found = true;
-
-    if (str_write == value_multisz_local.get()) {
-      // The only values were our own keys,
-      // and the whole PendingFileRenameOperations
-      // value needs to be deleted. We do not populate
-      // value_size_chars or value_multisz in this case.
-      ASSERT1(!value_size_chars);
-      ASSERT1(!value_multisz);
-    } else  {
-      // The last string should have a NULL terminator:
-      ASSERT1(str_write[-1] == '\0');
-      RET_IF_FALSE(str_write[-1] == '\0',
-        HRESULT_FROM_WIN32(ERROR_INVALID_DATA));
-      // a REG_MULTI_SZ needs to be terminated with an extra NULL.
-      *str_write = '\0';
-      ++str_write;
-
-      // Populate value_size_chars and value_multisz in this case.
-      value_multisz = value_multisz_local.release();
-      value_size_chars = str_write - value_multisz;
-    }
-  }
-
-  return S_OK;
-}
-
-// Remove any moves pending a reboot from the PendingFileRenameOperations
-// in the registry.
-// The prefix_match boolean controls whether we do an exact match on
-// in_directory, or remove all entries with the in_directory prefix.
-HRESULT File::RemoveFromMovesPendingReboot(const TCHAR* in_directory,
-                                           bool prefix_match) {
-  ASSERT1(in_directory && *in_directory);
-
-  bool found = false;
-  // scoped_array will free the value_multisz buffer on stack unwind:
-  scoped_array<TCHAR> value_multisz;
-  DWORD value_size_chars = 0;
-  HRESULT hr = GetPendingRenamesValueMinusDir(in_directory,
-                                              prefix_match,
-                                              address(value_multisz),
-                                              &value_size_chars,
-                                              &found);
-  if (SUCCEEDED(hr) && found) {
-    if (value_multisz.get() == NULL)  {
-      // There's no point in writing an empty value_multisz.
-      // Let's delete the PendingFileRenameOperations value
-      UTIL_LOG(L5, (_T("[File::RemoveFromMovesPendingReboot]")
-                    _T("[deleting PendingFileRenameOperations value]")));
-      RET_IF_FAILED(RegKey::DeleteValue(kSessionManagerKey,
-                    kPendingFileRenameOps));
-    } else  {
-      // Let's write the modified value_multisz into the
-      // PendingFileRenameOperations value
-      UTIL_LOG(L5, (_T("[File::RemoveFromMovesPendingReboot]")
-                    _T("[rewriting multisz %d bytes]"),
-                    value_size_chars * sizeof(TCHAR)));
-      RET_IF_FAILED(RegKey::SetValueMultiSZ(
-          kSessionManagerKey,
-          kPendingFileRenameOps,
-          reinterpret_cast<byte*>(value_multisz.get()),
-          value_size_chars * sizeof(TCHAR)));
-    }
-  }
-
-  // Failure of GetPendingRenamesValueMinusDir() may indicate something
-  // seriously wrong with the system. Propogate error.
-  return hr;
-}
-
-// Did the user try to uninstall a previous install of the same version, and
-// we couldn't clean up without a reboot?
-// We check if there are any moves pending a reboot from the
-// PendingFileRenameOperations in the registry.
-// The prefix_match boolean controls whether we do an exact match on
-// in_directory, or check all entries with the in_directory prefix.
-bool File::AreMovesPendingReboot(const TCHAR* in_directory, bool prefix_match) {
-  ASSERT1(in_directory && *in_directory);
-
-  bool found = false;
-  // scoped_array will free the value_multisz buffer on stack unwind:
-  scoped_array<TCHAR> value_multisz;
-  DWORD value_size_chars = 0;
-
-  if (SUCCEEDED(GetPendingRenamesValueMinusDir(in_directory,
-                                               prefix_match,
-                                               address(value_multisz),
-                                               &value_size_chars,
-                                               &found)) && found) {
-    return true;
-  }
-
-  return false;
-}
-
-HRESULT File::GetFileTime(const TCHAR* file_name,
-                          FILETIME* created,
-                          FILETIME* accessed,
-                          FILETIME* modified) {
-  ASSERT1(file_name && *file_name);
-
-  bool is_dir = IsDirectory(file_name);
-  // To obtain a handle to a directory, call the CreateFile function with
-  // the FILE_FLAG_BACKUP_SEMANTICS flag
-  scoped_hfile file_handle(
-      ::CreateFile(file_name,
-                   FILE_READ_DATA,
-                   FILE_SHARE_READ,
-                   NULL,
-                   OPEN_EXISTING,
-                   is_dir ? FILE_FLAG_BACKUP_SEMANTICS : NULL,
-                   NULL));
-  HRESULT hr = S_OK;
-
-  if (!file_handle) {
-    hr = HRESULTFromLastError();
-    UTIL_LOG(LE, (_T("[File::GetFileTime]")
-                  _T("[failed to open file][%s][0x%x]"), file_name, hr));
-  } else {
-    if (!::GetFileTime(get(file_handle), created, accessed, modified)) {
-      hr = HRESULTFromLastError();
-      UTIL_LOG(LEVEL_ERROR, (_T("[File::GetFileTime]")
-                             _T("[failed to get file time][%s][0x%x]"),
-                             file_name, hr));
-    }
-  }
-
-  return hr;
-}
-
-HRESULT File::SetFileTime(const TCHAR* file_name,
-                          const FILETIME* created,
-                          const FILETIME* accessed,
-                          const FILETIME* modified) {
-  ASSERT1(file_name && *file_name);
-
-  bool is_dir = IsDirectory(file_name);
-  // To obtain a handle to a directory, call the CreateFile function with
-  // the FILE_FLAG_BACKUP_SEMANTICS flag
-  scoped_hfile file_handle(
-      ::CreateFile(file_name,
-                   FILE_WRITE_ATTRIBUTES,
-                   FILE_SHARE_WRITE,
-                   NULL,
-                   OPEN_EXISTING,
-                   is_dir ? FILE_FLAG_BACKUP_SEMANTICS : NULL,
-                   NULL));
-  HRESULT hr = S_OK;
-
-  if (!file_handle) {
-    hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[File::GetFileTime]")
-                           _T("[failed to open file][%s][0x%x]"),
-                           file_name, hr));
-  } else {
-    BOOL res = ::SetFileTime(get(file_handle), created, accessed, modified);
-    if (!res) {
-      hr = HRESULTFromLastError();
-      UTIL_LOG(LEVEL_ERROR, (_T("[File::SetFileTime]")
-                             _T("[failed to set file time][%s][0x%x]"),
-                             file_name, hr));
-    }
-  }
-
-  return hr;
-}
-
-HRESULT File::Sync() {
-  ASSERT1(handle_ != INVALID_HANDLE_VALUE);
-
-  if (!::FlushFileBuffers(handle_)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[File::Sync]")
-                           _T("[FlushFileBuffers failed][%s][0x%x]"),
-                           file_name_, hr));
-    return hr;
-  }
-  return S_OK;
-}
-
-HRESULT File::SeekToBegin() {
-  return SeekFromBegin(0);
-}
-
-HRESULT File::SeekFromBegin(uint32 n) {
-  ASSERT1(handle_ != INVALID_HANDLE_VALUE);
-
-  if (::SetFilePointer(handle_, n, NULL, FILE_BEGIN) ==
-      INVALID_SET_FILE_POINTER) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[File::SeekFromBegin]")
-                           _T("[SetFilePointer failed][%s][0x%x]"),
-                           file_name_, hr));
-    return hr;
-  }
-  pos_ = n;
-  return S_OK;
-}
-
-// read nLen bytes starting at position n
-// returns number of bytes read
-//
-// async operations:
-//
-// async_id - identifier of a sequence of async operations, 0 for synchronous
-//
-// if the async operation has not been initiated, we initiate it
-// if it is in progress we do nothing
-// if it has been completed we return the data
-// does not delete async data entry
-HRESULT File::ReadAt(const uint32 offset, byte* buf, const uint32 len,
-                     const uint32, uint32* bytes_read) {
-  ASSERT1(handle_ != INVALID_HANDLE_VALUE);
-  ASSERT1(buf);
-  ASSERT1(len);  // reading 0 bytes is not valid (differs from CRT API)
-
-  RET_IF_FAILED(SeekFromBegin(offset));
-
-  DWORD read = 0;
-  if (!::ReadFile(handle_, buf, len, &read, NULL)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[File::ReadAt]")
-                           _T("[ReadFile failed][%s][0x%x]"), file_name_, hr));
-    return hr;
-  }
-
-  if (bytes_read) {
-    *bytes_read = read;
-  }
-
-  return (read == len) ? S_OK : E_FAIL;
-}
-
-
-// reads up to max_len bytes from the start of the file
-// not considered an error if there are less than max_len bytes read
-// returns number of bytes read
-HRESULT File::ReadFromStartOfFile(const uint32 max_len,
-                                  byte* buf,
-                                  uint32* bytes_read) {
-  ASSERT1(handle_ != INVALID_HANDLE_VALUE);
-  ASSERT1(buf);
-  ASSERT1(max_len);
-
-  RET_IF_FAILED(SeekFromBegin(0));
-
-  uint32 file_len = 0;
-  RET_IF_FAILED(GetLength(&file_len));
-
-  if (!file_len) {
-    if (bytes_read) {
-      *bytes_read = 0;
-    }
-    return S_OK;
-  }
-
-  uint32 len = max_len;
-  if (len > file_len) {
-    len = static_cast<uint32>(file_len);
-  }
-
-  return Read(len, buf, bytes_read);
-}
-
-// this function handles lines terminated with LF or CRLF
-// all CR characters are removed from each line, and LF is assumed
-// to be the end of line and is removed
-HRESULT File::ReadLineAnsi(uint32 max_len, char* line, uint32* len) {
-  ASSERT1(line);
-  ASSERT1(max_len);
-
-  char c = 0;
-  uint32 len_read = 0;
-  uint32 total_len = 0;
-
-  while (SUCCEEDED(Read(1, reinterpret_cast<byte *>(&c), &len_read)) &&
-         len_read  &&
-         c != '\n') {
-    if (total_len < max_len - 1 && c != '\r') {
-      line[total_len++] = c;
-    }
-  }
-
-  ASSERT1(total_len < max_len);
-  line[total_len] = '\0';
-
-  if (len) {
-    *len = total_len;
-  }
-
-  return (len_read || total_len) ? S_OK : E_FAIL;
-}
-
-// used by ReadFromStartOfFile and ReadLineAnsi; not reading all requested bytes
-// is not considered fatal
-HRESULT File::Read(const uint32 len, byte* buf, uint32* bytes_read) {
-  ASSERT1(handle_ != INVALID_HANDLE_VALUE);
-  ASSERT1(buf);
-  ASSERT1(len);
-
-  DWORD read = 0;
-  if (!::ReadFile(handle_, buf, len, &read, NULL)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[File::ReadAt]")
-                           _T("[ReadFile failed][%s][0x%x]"),
-                           file_name_, hr));
-    return hr;
-  }
-
-  if (bytes_read) {
-    *bytes_read = read;
-  }
-
-  return S_OK;
-}
-
-
-// returns number of bytes written
-HRESULT File::WriteAt(const uint32 offset,
-                      const byte* buf,
-                      const uint32 len,
-                      uint32,
-                      uint32* bytes_written) {
-  ASSERT1(handle_ != INVALID_HANDLE_VALUE);
-  ASSERT1(!read_only_);
-  ASSERT1(buf);
-  ASSERT1(len);
-
-  RET_IF_FAILED(SeekFromBegin(offset));
-
-  return Write(buf, len, bytes_written);
-}
-
-
-// write buffer n times
-HRESULT File::WriteN(const byte* buf,
-                     const uint32 len,
-                     const uint32 n,
-                     uint32* bytes_written) {
-  ASSERT1(handle_ != INVALID_HANDLE_VALUE);
-  ASSERT1(!read_only_);
-  ASSERT1(buf);
-  ASSERT1(len);
-  ASSERT1(n);
-
-  HRESULT hr = S_OK;
-
-  uint32 total_wrote = 0;
-
-  byte* temp_buf = const_cast<byte*>(buf);
-
-  scoped_array<byte> encrypt_buf;
-
-  uint32 to_go = n;
-  while (to_go) {
-    uint32 wrote = 0;
-    hr = Write(temp_buf, len, &wrote);
-    if (FAILED(hr)) {
-      if (bytes_written) {
-        *bytes_written = total_wrote;
-      }
-      return hr;
-    }
-
-    total_wrote += wrote;
-    to_go--;
-  }
-
-  if (bytes_written) {
-    *bytes_written = total_wrote;
-  }
-  return hr;
-}
-
-// returns number of bytes written
-HRESULT File::Write(const byte* buf, const uint32 len, uint32* bytes_written) {
-  ASSERT1(handle_ != INVALID_HANDLE_VALUE);
-  ASSERT1(!read_only_);
-  ASSERT1(buf);
-  ASSERT1(len);  // writing 0 bytes is not valid (differs from CRT API)
-
-  byte* b = const_cast<byte*>(buf);
-
-  scoped_array<byte> encrypt_buf;
-
-  DWORD wrote = 0;
-  if (!::WriteFile(handle_, b, len, &wrote, NULL)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[File::Write]")
-                           _T("[WriteFile failed][%s][0x%x]"),
-                           file_name_, hr));
-    return hr;
-  }
-
-  if (bytes_written) {
-    *bytes_written = wrote;
-  }
-  pos_ += wrote;
-
-  return (wrote == len) ? S_OK : E_FAIL;
-}
-
-HRESULT File::ClearAt(const uint32 offset,
-                      const uint32 len,
-                      uint32* bytes_written) {
-  ASSERT1(handle_ != INVALID_HANDLE_VALUE);
-  ASSERT1(!read_only_);
-  ASSERT1(len);
-
-  byte zero[kZeroSize] = {0};
-  uint32 to_go = len;
-  uint32 written = 0;
-  uint32 pos = offset;
-
-  while (to_go) {
-    uint32 wrote = 0;
-    uint32 write_len = std::min(to_go, kZeroSize);
-    RET_IF_FAILED(WriteAt(pos, zero, write_len, 0, &wrote));
-
-    if (wrote != write_len) {
-      return E_FAIL;
-    }
-    pos += wrote;
-    written += wrote;
-    to_go -= write_len;
-  }
-
-  if (bytes_written) {
-    *bytes_written = written;
-  }
-  return S_OK;
-}
-
-// returns true on failure
-// zeros new data if zero_data == true
-HRESULT File::SetLength(const uint32 n, bool zero_data) {
-  ASSERT1(handle_ != INVALID_HANDLE_VALUE);
-  ASSERT1(!read_only_);
-  ASSERT1(n <= kMaxFileSize);
-
-  HRESULT hr = S_OK;
-
-  uint32 len = 0;
-  VERIFY1(SUCCEEDED(GetLength(&len)));
-
-  if (len == n) {
-    return S_OK;
-  }
-
-  // according to the documentation, the
-  // new space will not be initialized
-  if (n > len) {
-    if (zero_data) {
-      uint32 bytes_written = 0;
-      RET_IF_FAILED(ClearAt(len, n - len, &bytes_written));
-      if (bytes_written != n - len) {
-        return E_FAIL;
-      }
-    } else {
-      byte zero = 0;
-      uint32 bytes_written = 0;
-      RET_IF_FAILED(WriteAt(n - 1, &zero, 1, 0, &bytes_written));
-      if (bytes_written != 1) {
-        return E_FAIL;
-      }
-    }
-  } else {
-    SeekFromBegin(n);
-    SetEndOfFile(handle_);
-  }
-
-  ASSERT1(SUCCEEDED(GetLength(&len)) && len == n);
-
-  return S_OK;
-}
-
-HRESULT File::ExtendInBlocks(const uint32 block_size, uint32 size_needed,
-                             uint32* new_size, bool clear_new_space) {
-  ASSERT1(new_size);
-
-  *new_size = size_needed;
-
-  if (*new_size % block_size) {
-    *new_size += block_size - (*new_size % block_size);
-  }
-
-  // is zero_data needed? may reduce fragmentation by causing the block to
-  // be written
-  return SetLength(*new_size, clear_new_space);
-}
-
-// returns S_OK on success
-HRESULT File::GetLength(uint32* length) {
-  ASSERT1(length);
-  ASSERT1(handle_ != INVALID_HANDLE_VALUE);
-
-  DWORD len = GetFileSize(handle_, NULL);
-  if (len == INVALID_FILE_SIZE) {
-    ASSERT(false, (_T("cannot get file length")));
-    return E_FAIL;
-  }
-  *length = len;
-  return S_OK;
-}
-
-HRESULT File::Touch() {
-  ASSERT1(handle_ != INVALID_HANDLE_VALUE);
-
-  FILETIME file_time;
-  SetZero(file_time);
-
-  ::GetSystemTimeAsFileTime(&file_time);
-
-  if (!::SetFileTime(handle_, NULL, NULL, &file_time)) {
-    return HRESULTFromLastError();
-  }
-  return S_OK;
-}
-
-HRESULT File::Close() {
-  ASSERT1(handle_ != INVALID_HANDLE_VALUE);
-
-  HRESULT hr = S_OK;
-  if (!::CloseHandle(handle_)) {
-    hr = HRESULTFromLastError();
-  }
-
-  handle_ = INVALID_HANDLE_VALUE;
-
-  return hr;
-}
-
-// this is just for consistency with other classes; does not do anything
-HRESULT File::Reload(uint32* number_errors) {
-  ASSERT1(number_errors);
-  ASSERT1(handle_ != INVALID_HANDLE_VALUE);
-
-  *number_errors = 0;
-  return S_OK;
-}
-
-// this is just for consistency with other classes; does not do anything
-HRESULT File::Verify(uint32* number_errors) {
-  ASSERT1(number_errors);
-  ASSERT1(handle_ != INVALID_HANDLE_VALUE);
-
-  *number_errors = 0;
-  return S_OK;
-}
-
-// this is just for consistency with other classes; does not do anything
-HRESULT File::Dump() {
-  ASSERT1(handle_ != INVALID_HANDLE_VALUE);
-  return S_OK;
-}
-
-// for consistency with other classes
-HRESULT File::GetSizeOnDisk(uint64* size_on_disk) {
-  ASSERT1(size_on_disk);
-  ASSERT1(handle_ != INVALID_HANDLE_VALUE);
-
-  uint32 len = 0;
-  RET_IF_FAILED(GetLength(&len));
-
-  *size_on_disk = len;
-  return S_OK;
-}
-
-// for consistency with other classes
-HRESULT File::GetReloadDiskSpaceNeeded(uint64* bytes_needed) {
-  ASSERT1(bytes_needed);
-  ASSERT1(handle_ != INVALID_HANDLE_VALUE);
-
-  uint32 len = 0;
-  RET_IF_FAILED(GetLength(&len));
-
-  *bytes_needed = len;
-  return S_OK;
-}
-
-// Get the file size
-HRESULT File::GetFileSizeUnopen(const TCHAR* filename, uint32* out_size) {
-  ASSERT1(filename);
-  ASSERT1(out_size);
-
-  WIN32_FILE_ATTRIBUTE_DATA data;
-  SetZero(data);
-
-  if (!::GetFileAttributesEx(filename, ::GetFileExInfoStandard, &data)) {
-    return HRESULTFromLastError();
-  }
-
-  *out_size = data.nFileSizeLow;
-
-  return S_OK;
-}
-
-// Get the last time with a file was written to, and the size
-HRESULT File::GetLastWriteTimeAndSize(const TCHAR* file_path,
-                                      SYSTEMTIME* out_time,
-                                      unsigned int* out_size) {
-  ASSERT1(file_path);
-
-  WIN32_FIND_DATA wfd;
-  SetZero(wfd);
-
-  HANDLE find = ::FindFirstFile(file_path, &wfd);
-  if (find == INVALID_HANDLE_VALUE) {
-    return HRESULTFromLastError();
-  }
-
-  ::FindClose(find);
-
-  if (out_size) {
-    *out_size = wfd.nFileSizeLow;
-  }
-
-  if (out_time) {
-    // If created time is newer than write time, then use that instead
-    // [it tends to be more relevant when copying files around]
-    FILETIME* latest_time = NULL;
-    if (::CompareFileTime(&wfd.ftCreationTime, &wfd.ftLastWriteTime) > 0) {
-      latest_time = &wfd.ftCreationTime;
-    } else {
-      latest_time = &wfd.ftLastWriteTime;
-    }
-
-    if (!::FileTimeToSystemTime(latest_time, out_time)) {
-      return HRESULTFromLastError();
-    }
-  }
-
-  return S_OK;
-}
-
-bool File::AreFilesIdentical(const TCHAR* filename1, const TCHAR* filename2) {
-  UTIL_LOG(L4, (_T("[File::AreFilesIdentical][%s][%s]"), filename1, filename2));
-
-  uint32 file_size1 = 0;
-  HRESULT hr = File::GetFileSizeUnopen(filename1, &file_size1);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[GetFileSizeUnopen failed file_size1][0x%x]"), hr));
-    return false;
-  }
-
-  uint32 file_size2 = 0;
-  hr = File::GetFileSizeUnopen(filename2, &file_size2);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[GetFileSizeUnopen failed file_size2][0x%x]"), hr));
-    return false;
-  }
-
-  if (file_size1 != file_size2) {
-    UTIL_LOG(L3, (_T("[file_size1 != file_size2][%d][%d]"),
-                  file_size1, file_size2));
-    return false;
-  }
-
-  File file1;
-  hr = file1.OpenShareMode(filename1, false, false, FILE_SHARE_READ);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[file1.OpenShareMode failed][0x%x]"), hr));
-    return false;
-  }
-
-  File file2;
-  hr = file2.OpenShareMode(filename2, false, false, FILE_SHARE_READ);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[file2.OpenShareMode failed][0x%x]"), hr));
-    return false;
-  }
-
-  static const uint32 kBufferSize = 0x10000;
-  std::vector<uint8> buffer1(kBufferSize);
-  std::vector<uint8> buffer2(kBufferSize);
-  uint32 bytes_left = file_size1;
-
-  while (bytes_left > 0) {
-    uint32 bytes_to_read = std::min(bytes_left, kBufferSize);
-    uint32 bytes_read1 = 0;
-    uint32 bytes_read2 = 0;
-
-    hr = file1.Read(bytes_to_read, &buffer1.front(), &bytes_read1);
-    if (FAILED(hr)) {
-      UTIL_LOG(LE, (_T("[file1.Read failed][%d][%d][0x%x]"),
-                    bytes_left, bytes_to_read, hr));
-      return false;
-    }
-
-    hr = file2.Read(bytes_to_read, &buffer2.front(), &bytes_read2);
-    if (FAILED(hr)) {
-      UTIL_LOG(LE, (_T("[file2.Read failed][%d][%d][0x%x]"),
-                    bytes_left, bytes_to_read, hr));
-      return false;
-    }
-
-    if (bytes_to_read != bytes_read1 || bytes_to_read != bytes_read2) {
-      UTIL_LOG(LE,
-          (_T("[bytes_to_read != bytes_read1 || bytes_to_read != bytes_read2]")
-          _T("[%d][%d][%d]"), bytes_to_read, bytes_read1, bytes_read2));
-      return false;
-    }
-
-    if (memcmp(&buffer1.front(), &buffer2.front(), bytes_read1) != 0) {
-      UTIL_LOG(L3, (_T("[memcmp failed][%d][%d]"), bytes_left, bytes_read1));
-      return false;
-    }
-
-    if (bytes_left < bytes_to_read) {
-      UTIL_LOG(LE, (_T("[bytes_left < bytes_to_read][%d][%d]"),
-                    bytes_left, bytes_to_read));
-      return false;
-    }
-
-    bytes_left -= bytes_to_read;
-  }
-
-  return true;
-}
-
-FileLock::FileLock() {
-}
-
-FileLock::~FileLock() {
-  Unlock();
-}
-
-HRESULT FileLock::Lock(const TCHAR* file) {
-  std::vector<CString> files;
-  files.push_back(file);
-  return Lock(files);
-}
-
-HRESULT FileLock::Lock(const std::vector<CString>& files) {
-  ASSERT1(!files.empty());
-
-  // Try to lock all files
-  size_t curr_size = handles_.size();
-  for (size_t i = 0; i < files.size(); ++i) {
-    scoped_hfile handle(::CreateFile(files[i],
-                                     GENERIC_READ,
-                                     FILE_SHARE_READ,
-                                     NULL,
-                                     OPEN_EXISTING,
-                                     FILE_ATTRIBUTE_NORMAL,
-                                     NULL));
-    if (!handle) {
-      UTIL_LOG(LEVEL_ERROR,
-               (_T("[FileLock::Lock - failed to lock file][%s][0x%x]"),
-                files[i], HRESULTFromLastError()));
-      break;
-    }
-    handles_.push_back(release(handle));
-  }
-
-  // Cleanup if we fail to lock all the files
-  if (curr_size +  files.size() < handles_.size()) {
-    for (size_t i = handles_.size() - 1; i >= curr_size; --i) {
-      VERIFY(::CloseHandle(handles_[i]), (_T("")));
-      handles_.pop_back();
-    }
-    return E_FAIL;
-  }
-
-  return S_OK;
-}
-
-HRESULT FileLock::Unlock() {
-  for (size_t i = 0; i < handles_.size(); ++i) {
-    VERIFY(::CloseHandle(handles_[i]), (_T("")));
-  }
-  handles_.clear();
-  return S_OK;
-}
-
-
-// path_name: the directory to watch
-// watch_subtree: watch all subdirectory changes  or
-//                only immediate child values
-// notify_filter: See the documentation for FindFirstChangeNotification
-FileWatcher::FileWatcher(const TCHAR* path_name, bool watch_subtree,
-                         DWORD notify_filter)
-    : path_name_(path_name),
-      watch_subtree_(watch_subtree),
-      notify_filter_(notify_filter) {
-  ASSERT1(path_name && *path_name);
-  UTIL_LOG(L3, (_T("[FileWatcher::FileWatcher][%s]"), path_name));
-}
-
-// Get the event that is signaled on store changes.
-HANDLE FileWatcher::change_event() const {
-  ASSERT(valid(change_event_), (_T("call FileWatcher::SetupEvent first")));
-  return get(change_event_);
-}
-
-
-// Called to create/reset the event that gets signaled
-// any time the store changes.  Access the created
-// event using change_event().
-HRESULT FileWatcher::EnsureEventSetup() {
-  UTIL_LOG(L3, (_T("[FileWatcher::EnsureEventSetup]")));
-  if (!valid(change_event_)) {
-    reset(change_event_, ::FindFirstChangeNotification(path_name_,
-                                                       watch_subtree_,
-                                                       notify_filter_));
-    if (!valid(change_event_)) {
-      ASSERT(false, (_T("unable to get file change notification")));
-      return E_FAIL;
-    }
-    // path name was only needed to set-up the event and now that is done....
-    path_name_.Empty();
-    return S_OK;
-  }
-
-  // if the event is set-up and no changes have occurred,
-  // then there is no need to re-setup the event.
-  if (valid(change_event_) && !HasChangeOccurred()) {
-    return NOERROR;
-  }
-
-  return ::FindNextChangeNotification(get(change_event_)) ? S_OK : E_FAIL;
-}
-
-}  // namespace omaha
-
diff --git a/base/file.h b/base/file.h
deleted file mode 100644
index ca266ef..0000000
--- a/base/file.h
+++ /dev/null
@@ -1,249 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-// File handling routines
-//
-// encryption is not currently active
-//
-#ifndef OMAHA_BASE_FILE_H_
-#define OMAHA_BASE_FILE_H_
-
-#include <windows.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/store_watcher.h"
-
-namespace omaha {
-
-class File {
- public:
-
-    File();
-    ~File();
-
-    HRESULT Open(const TCHAR* file_name, bool write, bool async);
-    HRESULT OpenShareMode(const TCHAR* file_name,
-                          bool write,
-                          bool async,
-                          DWORD share_mode);
-
-    HRESULT Close();
-
-    static bool Exists(const TCHAR* file_name);
-    static bool IsDirectory(const TCHAR *file_name);
-    static HRESULT GetWildcards(const TCHAR* dir, const TCHAR* wildcard,
-                                std::vector<CString>* matching_paths);
-    // returns S_OK on successful removal or if not existing
-    static HRESULT Remove(const TCHAR* file_name);
-    // CopyWildcards doesn't work recursively
-    static HRESULT CopyWildcards(const TCHAR* from_dir, const TCHAR* to_dir,
-                                 const TCHAR* wildcard,
-                                 bool replace_existing_files);
-    static HRESULT CopyTree(const TCHAR* from_dir, const TCHAR* to_dir,
-                            bool replace_existing_files);
-                                                    // to_dir need not exist
-    static HRESULT Copy(const TCHAR* from, const TCHAR* to,
-                        bool replace_existing_file);
-    static HRESULT Move(const TCHAR* from, const TCHAR* to,
-                        bool replace_existing_file);
-    // DeleteAfterReboot tries to delete the files by either moving them to
-    // the TEMP directory and deleting them on reboot, or if that fails, by
-    // trying to delete them in-place on reboot
-    static HRESULT DeleteAfterReboot(const TCHAR* from);
-    static HRESULT MoveAfterReboot(const TCHAR* from, const TCHAR* to);
-    // Remove any moves pending a reboot from the PendingFileRenameOperations
-    // in the registry.
-    // The prefix_match boolean controls whether we do an exact match on
-    // in_directory, or remove all entries with the in_directory prefix.
-    static HRESULT RemoveFromMovesPendingReboot(const TCHAR* in_directory,
-                                                bool prefix_match);
-    // Did the user try to uninstall a previous install of the same version,
-    // and we couldn't clean up without a reboot?
-    // We check if there are any moves pending a reboot from the
-    // PendingFileRenameOperations in the registry.
-    // The prefix_match boolean controls whether we do an exact match on
-    // in_directory, or check all entries with the in_directory prefix.
-    static bool AreMovesPendingReboot(const TCHAR* in_directory,
-                                      bool prefix_match);
-
-    // The GetFileTime function retrieves the date and time that a file was
-    // created, last accessed, and last modified. The parameters 'created',
-    // 'accessed', 'modified' can be null if the caller does not require that
-    // information. All times are utc
-    // (http://support.microsoft.com/default.aspx?scid=kb;%5BLN%5D;158588)
-    // To compare FILETIME values, use CompareFileTime API.
-    static HRESULT GetFileTime(const TCHAR* file_name, FILETIME* created,
-                               FILETIME* accessed, FILETIME* modified);
-
-    // Sets the file time
-    static HRESULT SetFileTime(const TCHAR* file_name,
-                               const FILETIME* created,
-                               const FILETIME* accessed,
-                               const FILETIME* modified);
-
-    // sync flushes any pending writes to disk
-    HRESULT Sync();
-    // static HRESULT SyncAllFiles();
-
-    HRESULT SeekToBegin();
-    HRESULT SeekFromBegin(uint32 n);
-
-    HRESULT ReadFromStartOfFile(const uint32 max_len, byte *buf,
-                                uint32 *bytes_read);
-    HRESULT ReadLineAnsi(uint32 max_len, char *line, uint32 *len);
-
-    // read len bytes, reading 0 bytes is invalid
-    HRESULT Read(const uint32 len, byte *buf, uint32 *bytes_read);
-    // read len bytes starting at position n, reading 0 bytes is invalid
-    HRESULT ReadAt(const uint32 offset, byte *buf, const uint32 len,
-                    const uint32 async_id, uint32 *bytes_read);
-
-    // write len bytes, writing 0 bytes is invalid
-    HRESULT Write(const byte *buf, const uint32 len, uint32 *bytes_written);
-    // write len bytes, writing 0 bytes is invalid
-    HRESULT WriteAt(const uint32 offset, const byte *buf, const uint32 len,
-                     const uint32 async_id, uint32 *bytes_written);
-
-    // write buffer n times
-    HRESULT WriteN(const byte *buf, const uint32 len, const uint32 n,
-                    uint32 *bytes_written);
-
-    // zeros section of file
-    HRESULT ClearAt(const uint32 offset, const uint32 len,
-                     uint32 *bytes_written);
-
-    // set length of file
-    // if new length is greater than current length, new data is undefined
-    // unless zero_data == true in which case the new data is zeroed.
-    HRESULT SetLength(const uint32 n, bool zero_data);
-    HRESULT ExtendInBlocks(const uint32 block_size, uint32 size_needed,
-                            uint32 *new_size, bool clear_new_space);
-    HRESULT GetLength(uint32 *len);
-
-    // Sets the last write time to the current time
-    HRESULT Touch();
-
-    // all the data storage classes contain these functions
-    // we implemenent them here for consistency
-    // e.g., so we can do object->GetSizeOnDisk independent of the object type
-    HRESULT GetSizeOnDisk(uint64 *size_on_disk);
-    HRESULT GetReloadDiskSpaceNeeded(uint64 *bytes_needed);
-    HRESULT Reload(uint32 *number_errors);
-    HRESULT Verify(uint32 *number_errors);
-    HRESULT Dump();
-
-    // Gets the size of a file, without opening it [the regular GetFileSize
-    // requires a file handle, which conflicts if the file is already opened
-    // and locked]
-    static HRESULT GetFileSizeUnopen(const TCHAR * filename,
-                                     uint32 * out_size);
-
-    // Optimized function that gets the last write time and size
-    static HRESULT GetLastWriteTimeAndSize(const TCHAR* file_path,
-                                           SYSTEMTIME* out_time,
-                                           unsigned int* out_size);
-
-    // Returns true if the two files are binary-identical.
-    static bool AreFilesIdentical(const TCHAR* filename1,
-                                  const TCHAR* filename2);
-
- private:
-    // See if we have any moves pending a reboot. Return SUCCESS if we do
-    // not encounter errors (not finding a move is not an error). We need to
-    // also check the value of *found_ptr for whether we actually found a move.
-    // On return, *value_multisz_ptr is the value within
-    // "PendingFileRenameOperations", but with any moves for in_directory
-    // removed from it.
-    // The prefix_match boolean controls whether we do an exact match on
-    // in_directory, or remove all entries with the in_directory prefix.
-    // NOTE: If the only values found were our own keys, the whole
-    // PendingFileRenameOperations MULTISZ needs to be deleted. This is
-    // signified by a returned *value_size_chars_ptr of 0.
-    static HRESULT GetPendingRenamesValueMinusDir(const TCHAR* in_directory,
-      bool prefix_match, TCHAR** value_multisz_ptr, DWORD* value_size_chars_ptr,
-      bool* found_ptr);
-
-    HANDLE handle_;
-    CString file_name_;
-    bool read_only_;
-    bool sync_write_done_;
-    uint32 pos_;
-    uint32 encryption_seed_;
-    uint32 sequence_id_;
-    enum EncryptionTypes encryption_;
-
-    static const int kMaxFileSize = kint32max;
-
-    DISALLOW_EVIL_CONSTRUCTORS(File);
-};
-
-// File lock
-class FileLock {
- public:
-  // Default constructor
-  FileLock();
-
-  // Destructor
-  ~FileLock();
-
-  // Lock a single file
-  HRESULT Lock(const TCHAR* file);
-
-  // Lock multiple files (atomic)
-  HRESULT Lock(const std::vector<CString>& files);
-
-  // Unlock all
-  HRESULT Unlock();
-
- private:
-  std::vector<HANDLE> handles_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(FileLock);
-};
-
-
-// Does the common things necessary for watching
-// changes in a directory.  If there are file change or other watchers,
-// there could be a common interface for the three methods to decouple
-// the code that is doing the watching from the code that owns the store.
-class FileWatcher : public StoreWatcher {
- public:
-  // path_name: the directory to watch
-  // watch_subtree: watch all subdirectory changes  or
-  //                only immediate child values
-  // notify_filter: See the documentation for FindFirstChangeNotification
-  FileWatcher(const TCHAR* path_name, bool watch_subtree, DWORD notify_filter);
-
-  // Called to create/reset the event that gets signaled
-  // any time the store changes.  Access the created
-  // event using change_event().
-  virtual HRESULT EnsureEventSetup();
-
-  // Get the event that is signaled on store changes.
-  virtual HANDLE change_event() const;
-
- private:
-  scoped_hfind_change_notification change_event_;
-  CString path_name_;
-  bool watch_subtree_;
-  DWORD notify_filter_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(FileWatcher);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_FILE_H_
-
diff --git a/base/file_reader.cc b/base/file_reader.cc
deleted file mode 100644
index 0008e76..0000000
--- a/base/file_reader.cc
+++ /dev/null
@@ -1,248 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/file_reader.h"
-#include "omaha/base/debug.h"
-
-namespace omaha {
-
-FileReader::FileReader()
-    : file_is_open_(false),
-      buffered_byte_count_(0),
-      current_position_(0),
-      file_buffer_size_(0),
-      is_unicode_(false) {}
-
-FileReader::~FileReader() {
-  if (file_is_open_) {
-    file_.Close();
-    file_is_open_ = false;
-  }
-}
-
-HRESULT FileReader::Init(const TCHAR* file_name, size_t buffer_size) {
-  ASSERT1(file_name);
-  ASSERT1(buffer_size);
-  file_buffer_size_ = buffer_size;
-  file_buffer_.reset(new byte[file_buffer_size()]);
-  HRESULT hr = file_.OpenShareMode(file_name, false, false, FILE_SHARE_WRITE |
-                                                            FILE_SHARE_READ);
-  file_is_open_ = SUCCEEDED(hr);
-  is_unicode_ = false;
-
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = file_.SeekToBegin();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  const int unicode_header_length = 2;
-
-  char buf[unicode_header_length] = {0};
-  uint32 bytes_read = 0;
-  hr = file_.Read(sizeof(buf), reinterpret_cast<byte*>(buf), &bytes_read);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (bytes_read == sizeof(buf)) {
-    char unicode_buf[unicode_header_length] = {0xff, 0xfe};
-    is_unicode_ = (memcmp(buf, unicode_buf, sizeof(buf)) == 0);
-  }
-
-  if (!is_unicode_) {
-    file_.SeekToBegin();
-  }
-
-  if (is_unicode_ && (buffer_size < sizeof(WCHAR))) {
-    return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
-  }
-
-  return S_OK;
-}
-
-HRESULT FileReader::GetNextChar(bool peek, CString* next_char) {
-  ASSERT1(next_char);
-  next_char->Empty();
-
-  // Do we need to read in more of the file?
-  if (current_position_ >= buffered_byte_count_) {
-    current_position_ = 0;
-    if (FAILED(file_.Read(file_buffer_size(),
-                          file_buffer_.get(),
-                          &buffered_byte_count_))) {
-      // There is no more of the file buffered.
-      buffered_byte_count_ = 0;
-    }
-  }
-
-  // Have we gone past the end of the file?
-  if (current_position_ >= buffered_byte_count_) {
-    return E_FAIL;
-  }
-
-  if (is_unicode_) {
-    // Need to make sure there are at least 2 characters still in the buffer.
-    // If we're right at the end of the buffer and there's only one character,
-    // then we will need to read more from the file.
-
-    if (current_position_ + 1 >= buffered_byte_count_) {
-      // We need one more byte to make a WCHAR.
-      // Due to the need to peek, we're going to take that byte and put it at
-      // the beginning of the file_buffer_ and read in as many remaining bytes
-      // as we can from the file.
-
-      // Copy current (and last) byte to the beginning of the buffer.
-      file_buffer_[0] = file_buffer_[current_position_];
-
-      // Reset current_position.
-      current_position_ = 0;
-
-      if (SUCCEEDED(file_.Read(file_buffer_size() - 1,
-                               file_buffer_.get() + 1,
-                               &buffered_byte_count_))) {
-        // Incrememt count to deal with byte we pre-filled at offset 0.
-        buffered_byte_count_++;
-      } else {
-        // We've got a Unicode file with an extra byte.  We're going to drop the
-        // byte and call it end of file.
-        buffered_byte_count_ = 0;
-        return E_FAIL;
-      }
-    }
-
-    // Get the next character.
-    char c1 = file_buffer_[current_position_];
-    ++current_position_;
-    char c2 = file_buffer_[current_position_];
-    ++current_position_;
-
-    if (peek) {
-      // Reset the current position pointer backwards if we're peeking.
-      current_position_ -= 2;
-    }
-
-    WCHAR c = (static_cast<WCHAR>(c2) << 8) | static_cast<WCHAR>(c1);
-
-    *next_char = c;
-  } else {
-    char c = file_buffer_[current_position_];
-    if (!peek) {
-      ++current_position_;
-    }
-    *next_char = c;
-  }
-
-  return S_OK;
-}
-
-HRESULT FileReader::ReadLineString(CString* line) {
-  ASSERT1(line);
-
-  line->Empty();
-
-  while (true) {
-    CString current_char;
-    HRESULT hr = GetNextChar(false, &current_char);
-    // If we failed to get the next char, we're at the end of the file.
-    // If the current line is empty, then fail out signalling we're done.
-    // Otherwise, return the current line and we'll fail out on the next call to
-    // ReadLine().
-    if (FAILED(hr)) {
-      if (line->IsEmpty()) {
-        return hr;
-      } else {
-        return S_OK;
-      }
-    }
-
-    // Have we reached end of line?
-    if (current_char.Compare(_T("\r")) == 0) {
-      // Seek ahead to see if the next char is "\n"
-      CString next_char;
-      GetNextChar(true, &next_char);
-      if (next_char.Compare(_T("\n")) == 0) {
-        // Get in the next char too.
-        GetNextChar(false, &next_char);
-      }
-      break;
-    } else if (current_char.Compare(_T("\n")) == 0) {
-      break;
-    }
-
-    line->Append(current_char);
-  }
-
-  return S_OK;
-}
-
-HRESULT FileReader::ReadLineAnsi(size_t max_len, char* line) {
-  ASSERT1(line);
-  ASSERT1(max_len);
-
-  size_t total_len = 0;
-
-  while (true) {
-    // Do we need to read in more of the file?
-    if (current_position_ >= buffered_byte_count_) {
-      current_position_ = 0;
-      if (FAILED(file_.Read(file_buffer_size(),
-                            file_buffer_.get(),
-                            &buffered_byte_count_))) {
-        // There is no more of the file buffered.
-        buffered_byte_count_ = 0;
-      }
-    }
-
-    // Have we gone past the end of the file?
-    if (current_position_ >= buffered_byte_count_) {
-      break;
-    }
-
-    // Get the next character.
-    char c = file_buffer_[current_position_];
-    ++current_position_;
-
-    // Have we reached end of line?
-    // TODO(omaha): if the line is terminated with a \r\n pair then perhaps
-    // the code should skip the whole pair not only half of it.
-    if (c == '\n' || c == '\r') {
-      break;
-    }
-
-    // Fill up the passed in buffer for the line.
-    if (total_len < max_len - 1) {
-      line[total_len] = c;
-      ++total_len;
-    }
-  }
-  // Terminate the passed in buffer.
-  ASSERT1(total_len < max_len);
-  line[total_len] = '\0';
-
-  // If we are out of bytes and we didn't read in any bytes.
-  // then fail signaling end of file.
-  if (!buffered_byte_count_ && !total_len) {
-    return E_FAIL;
-  }
-
-  return S_OK;
-}
-
-}  // namespace omaha
-
diff --git a/base/file_reader.h b/base/file_reader.h
deleted file mode 100644
index 3412b79..0000000
--- a/base/file_reader.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_FILE_READER_H_
-#define OMAHA_COMMON_FILE_READER_H_
-
-#include <windows.h>
-#include <tchar.h>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/file.h"
-
-namespace omaha {
-
-// Allows one to read files quickly and easily line by line.
-class FileReader {
- public:
-  FileReader();
-  ~FileReader();
-
-  // Specifies the underlying file name and the size of internal read buffer.
-  HRESULT Init(const TCHAR* file_name, size_t buffer_size);
-
-  // Reads one line of text from the file, taking advantage of the internal
-  // file buffer to optimize I/O reads. It reads at most max_len - 1 characters
-  // and it always terminates the line.
-  HRESULT ReadLineAnsi(size_t max_len, char* line);
-  HRESULT ReadLineString(CString* line);
-
- private:
-  HRESULT GetNextChar(bool peek, CString* next_char);
-  size_t file_buffer_size() const { return file_buffer_size_; }
-
-  File file_;
-  bool file_is_open_;
-  size_t buffered_byte_count_;          // How many bytes are in the buffer.
-  size_t current_position_;             // An index into the buffer.
-  scoped_array<byte> file_buffer_;      // A buffer (cache) of the file.
-  size_t file_buffer_size_;             // How much of the file to slurp
-                                        // in on each read.
-  bool is_unicode_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(FileReader);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_FILE_READER_H_
diff --git a/base/file_reader_unittest.cc b/base/file_reader_unittest.cc
deleted file mode 100644
index 1897033..0000000
--- a/base/file_reader_unittest.cc
+++ /dev/null
@@ -1,304 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// TODO(omaha): improve unit test. For example, test we are handling correctly
-// different types of line termination.
-
-#include <vector>
-#include "base/scoped_ptr.h"
-#include "omaha/base/file_reader.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-class ReadingFilesTest : public testing::Test {
- protected:
-  ReadingFilesTest() {
-    temp_file_[0] = '\0';
-  }
-
-  virtual void SetUp() {
-    // create a temporary file
-    TCHAR temp_path[MAX_PATH] = {0};
-    EXPECT_LT(::GetTempPath(arraysize(temp_path), temp_path),
-              arraysize(temp_path));
-    EXPECT_NE(::GetTempFileName(temp_path, _T("ut_"), 0, temp_file_), 0);
-  }
-
-  virtual void TearDown() {
-    // remove the temporary file
-    if (::lstrlen(temp_file_) > 0) {
-      ASSERT_SUCCEEDED(File::Remove(temp_file_));
-    }
-  }
-
-  void Compare(const std::vector<char*>& lines1,
-               const std::vector<char*>& lines2,
-               byte** orig_lines, int* lengths, int* copies) {
-    // verify that all three things match
-    //  * The lines read using the File class,
-    //  * The lines read using the FileReader class,
-    //  * The original data used to write the files
-    EXPECT_EQ(lines1.size(), lines2.size());
-
-    for (uint32 line_number = 0; line_number < lines1.size(); line_number++) {
-      int index = 0;
-      int data_length = lengths[line_number];
-      int data_copies = copies[line_number];
-      for (int copy = 0; copy < data_copies; copy++) {
-        for (int index_data = 0; index_data < data_length; index_data++) {
-          EXPECT_EQ(lines1[line_number][index], lines2[line_number][index]);
-          EXPECT_EQ(lines1[line_number][index],
-                    orig_lines[line_number][index_data]);
-          index++;
-        }
-      }
-      EXPECT_EQ(lines1[line_number][index], lines2[line_number][index]);
-      EXPECT_EQ(lines1[line_number][index], '\0');
-    }
-  }
-
-  void DeleteContainedArrays(std::vector<char*>* lines) {
-    for (uint32 line_number = 0; line_number < lines->size(); line_number++) {
-      delete[] (*lines)[line_number];
-      (*lines)[line_number] = NULL;
-    }
-  }
-
-  HRESULT WriteCStringW(File* file, CStringW* str) {
-    return file->Write(reinterpret_cast<const byte*>(str->GetBuffer()),
-                       str->GetLength() * sizeof(WCHAR),
-                       NULL);
-  }
-
-  void TestReadFileStringUnicode(int buffer_size) {
-    CStringW line1 = L"hello there, here's some data";
-    CStringW line2 = L"i've got more\tdata over here.";
-    CStringW eol1 = L"\r";
-    CStringW eol2 = L"\r\n";
-    CStringW eol3 = L"\n";
-
-    std::vector<CString> expected_lines;
-    expected_lines.push_back(CString(line1));
-    expected_lines.push_back(CString(line2));
-    expected_lines.push_back(CString(line1));
-    expected_lines.push_back(CString(line1));
-    expected_lines.push_back(CString(line2));
-
-    File file_write;
-    EXPECT_SUCCEEDED(file_write.Open(temp_file_, true, false));
-
-    // Write the unicode marker to the beginning of the file.
-    byte buf[2] = {0xff, 0xfe};
-    EXPECT_SUCCEEDED(file_write.Write(buf, sizeof(buf), NULL));
-
-    EXPECT_SUCCEEDED(WriteCStringW(&file_write, &line1));
-    EXPECT_SUCCEEDED(WriteCStringW(&file_write, &eol1));
-    EXPECT_SUCCEEDED(WriteCStringW(&file_write, &line2));
-    EXPECT_SUCCEEDED(WriteCStringW(&file_write, &eol1));
-    EXPECT_SUCCEEDED(WriteCStringW(&file_write, &line1));
-    EXPECT_SUCCEEDED(WriteCStringW(&file_write, &eol3));
-    EXPECT_SUCCEEDED(WriteCStringW(&file_write, &line1));
-    EXPECT_SUCCEEDED(WriteCStringW(&file_write, &eol2));
-    EXPECT_SUCCEEDED(WriteCStringW(&file_write, &line2));
-    file_write.Close();
-
-    FileReader reader;
-    EXPECT_SUCCEEDED(reader.Init(temp_file_, buffer_size));
-
-    std::vector<CString> read_lines;
-    CString current_string;
-    while (SUCCEEDED(reader.ReadLineString(&current_string))) {
-      read_lines.push_back(current_string);
-    }
-
-    ASSERT_EQ(expected_lines.size(), read_lines.size());
-
-    if (expected_lines.size() == read_lines.size()) {
-      for (size_t i = 0; i < expected_lines.size(); ++i) {
-        CString expected_str = expected_lines[i];
-        CString read_str = read_lines[i];
-        ASSERT_STREQ(expected_str, read_str);
-      }
-    }
-  }
-
-  TCHAR temp_file_[MAX_PATH];
-
-  DISALLOW_EVIL_CONSTRUCTORS(ReadingFilesTest);
-};
-
-
-TEST_F(ReadingFilesTest, ReadFile1) {
-  // write the data to the file
-  File file_write;
-  EXPECT_SUCCEEDED(file_write.Open(temp_file_, true, false));
-  byte data1[] = {'a', 'b', 'c', 'z', '!', '&', '\t'};
-  int data1_copies = 1;
-  EXPECT_SUCCEEDED(file_write.WriteN(data1, arraysize(data1), data1_copies,
-                                     NULL));
-  byte return_data = '\n';
-  EXPECT_SUCCEEDED(file_write.WriteN(&return_data, 1, 1, NULL));
-
-  byte data2[] = {'d', 'a', 'v', 'e', ' ', ' ', '\t', '\\'};
-  int data2_copies = 2;
-  EXPECT_SUCCEEDED(file_write.WriteN(data2, arraysize(data2), data2_copies,
-                                     NULL));
-  file_write.Close();
-
-  // read in the file line by line using the File class
-  std::vector<char*> lines1;
-  File file_read1;
-  ASSERT_SUCCEEDED(file_read1.Open(temp_file_, false, false));
-  while (true) {
-    uint32 bytes_read;
-    scoped_array<char> line(new char[256]);
-    if (FAILED(file_read1.ReadLineAnsi(256, line.get(), &bytes_read))) {
-      break;
-    }
-    lines1.push_back(line.release());
-  }
-
-  file_read1.Close();
-
-  // read in the file line by line using the FileReader class
-  std::vector<char*> lines2;
-  FileReader file_read2;
-  size_t buffer_size = 512;
-  ASSERT_SUCCEEDED(file_read2.Init(temp_file_, buffer_size));
-  while (true) {
-    scoped_array<char> line(new char[256]);
-    if (FAILED(file_read2.ReadLineAnsi(256, line.get()))) {
-      break;
-    }
-    lines2.push_back(line.release());
-  }
-
-  // Verify that everything matches
-  byte* (orig_lines[]) = {data1, data2};
-  int copies[] = {data1_copies, data2_copies};
-  int lengths[] = {arraysize(data1), arraysize(data2)};
-  Compare(lines1, lines2, orig_lines, lengths, copies);
-
-  // Free the allocated memory
-  DeleteContainedArrays(&lines1);
-  DeleteContainedArrays(&lines1);
-}
-
-// Two readers should be able to read from the same file.
-TEST_F(ReadingFilesTest, ReadFileShare) {
-  File file;
-  EXPECT_SUCCEEDED(file.Open(temp_file_, true, false));
-  file.Close();
-
-  const size_t kBufferSize = 0x100;
-
-  FileReader reader1;
-  EXPECT_SUCCEEDED(reader1.Init(temp_file_, kBufferSize));
-
-  FileReader reader2;
-  EXPECT_SUCCEEDED(reader2.Init(temp_file_, kBufferSize));
-}
-
-HRESULT WriteCStringA(File* file, CStringA* str) {
-  return file->Write(reinterpret_cast<const byte*>(str->GetBuffer()),
-                     str->GetLength(),
-                     NULL);
-}
-
-TEST_F(ReadingFilesTest, ReadFileStringAnsi) {
-  CStringA line1 = "hello there, here's some data";
-  CStringA line2 = "i've got more\tdata over here.";
-  CStringA eol1 = "\r";
-  CStringA eol2 = "\r\n";
-  CStringA eol3 = "\n";
-
-  std::vector<CString> expected_lines;
-  expected_lines.push_back(CString(line1));
-  expected_lines.push_back(CString(line2));
-  expected_lines.push_back(CString(line1));
-  expected_lines.push_back(CString(line1));
-  expected_lines.push_back(CString(line2));
-
-  File file_write;
-  EXPECT_SUCCEEDED(file_write.Open(temp_file_, true, false));
-  EXPECT_SUCCEEDED(WriteCStringA(&file_write, &line1));
-  EXPECT_SUCCEEDED(WriteCStringA(&file_write, &eol1));
-  EXPECT_SUCCEEDED(WriteCStringA(&file_write, &line2));
-  EXPECT_SUCCEEDED(WriteCStringA(&file_write, &eol1));
-  EXPECT_SUCCEEDED(WriteCStringA(&file_write, &line1));
-  EXPECT_SUCCEEDED(WriteCStringA(&file_write, &eol3));
-  EXPECT_SUCCEEDED(WriteCStringA(&file_write, &line1));
-  EXPECT_SUCCEEDED(WriteCStringA(&file_write, &eol2));
-  EXPECT_SUCCEEDED(WriteCStringA(&file_write, &line2));
-  file_write.Close();
-
-  FileReader reader;
-  EXPECT_SUCCEEDED(reader.Init(temp_file_, 20));
-
-  std::vector<CString> read_lines;
-  CString current_string;
-  while (SUCCEEDED(reader.ReadLineString(&current_string))) {
-    read_lines.push_back(current_string);
-  }
-
-  ASSERT_EQ(expected_lines.size(), read_lines.size());
-
-  if (expected_lines.size() == read_lines.size()) {
-    for (size_t i = 0; i < expected_lines.size(); ++i) {
-      CString expected_str = expected_lines[i];
-      CString read_str = read_lines[i];
-      ASSERT_STREQ(expected_str, read_str);
-    }
-  }
-}
-
-TEST_F(ReadingFilesTest, ReadFileStringUnicodeSmallBuffer) {
-  TestReadFileStringUnicode(20);
-}
-
-TEST_F(ReadingFilesTest, ReadFileStringUnicodeHugeBuffer) {
-  TestReadFileStringUnicode(4096);
-}
-
-TEST_F(ReadingFilesTest, ReadFileStringUnicodeSmallOddBufferBuffer) {
-  TestReadFileStringUnicode(19);
-}
-
-TEST_F(ReadingFilesTest, ReadFileStringUnicodeTinyOddBuffer) {
-  TestReadFileStringUnicode(3);
-}
-
-TEST_F(ReadingFilesTest, ReadFileStringUnicodeTinyEvenBuffer) {
-  TestReadFileStringUnicode(2);
-}
-
-TEST_F(ReadingFilesTest, ReadFileStringUnicodeOneByteBuffer) {
-  File file_write;
-  EXPECT_SUCCEEDED(file_write.Open(temp_file_, true, false));
-
-  // Write the unicode marker to the beginning of the file.
-  byte buf[2] = {0xff, 0xfe};
-  EXPECT_SUCCEEDED(file_write.Write(buf, sizeof(buf), NULL));
-
-  file_write.Close();
-
-  FileReader reader;
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER),
-            reader.Init(temp_file_, 1));
-}
-
-}  // namespace omaha
-
diff --git a/base/file_store.cc b/base/file_store.cc
deleted file mode 100644
index 372c1b8..0000000
--- a/base/file_store.cc
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Defines class FileStore
-
-#include <vector>
-#include "omaha/base/debug.h"
-#include "omaha/base/file.h"
-#include "omaha/base/file_store.h"
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-// Open the store
-bool FileStore::Open(const TCHAR* file_path) {
-  file_path_ = String_MakeEndWith(file_path, _T("\\"), false);
-  return true;
-}
-
-// Close the store
-bool FileStore::Close() {
-  file_path_.Empty();
-  return true;
-}
-
-// Clear the store
-bool FileStore::Clear() {
-  if (File::Exists(file_path_) && File::IsDirectory(file_path_)) {
-    return SUCCEEDED(DeleteDirectoryFiles(file_path_));
-  } else {
-    return true;
-  }
-}
-
-// Read a value from the store
-bool FileStore::Read(const TCHAR* name, std::vector<byte>* data) const {
-  ASSERT1(name);
-  ASSERT1(data);
-
-  return Exists(name) && SUCCEEDED(ReadEntireFile(file_path_ + name, 0, data));
-}
-
-// Write a value to the store
-bool FileStore::Write(const TCHAR* name, byte* data, int data_size) {
-  ASSERT1(name);
-  ASSERT1(data);
-  ASSERT1(data_size);
-
-  std::vector<byte> buffer(data_size);
-  memcpy(&buffer.front(), data, data_size);
-
-  return SUCCEEDED(WriteEntireFile(file_path_ + name, buffer));
-}
-
-// Check to see a named value exists in the store
-bool FileStore::Exists(const TCHAR* name) const {
-  ASSERT1(name);
-
-  return File::Exists(file_path_ + name);
-}
-
-// Remove a value from the store
-bool FileStore::Remove(const TCHAR* name) {
-  ASSERT1(name);
-
-  return SUCCEEDED(File::Remove(file_path_ + name));
-}
-
-// Get the number of values for this store
-bool FileStore::GetValueCount(uint32* value_count) {
-  ASSERT1(value_count);
-
-  std::vector<CString> matching_paths;
-
-  if (FAILED(File::GetWildcards(file_path_, _T("*"), &matching_paths))) {
-    return false;
-  }
-
-  *value_count = matching_paths.size();
-
-  return true;
-}
-
-// Get the value name for the given value name index
-bool FileStore::GetValueNameAt(uint32 index, CString* value_name) {
-  ASSERT1(value_name);
-
-  std::vector<CString> matching_paths;
-
-  if (FAILED(File::GetWildcards(file_path_, _T("*"), &matching_paths))) {
-    return false;
-  }
-  if (index >= matching_paths.size()) {
-    return false;
-  }
-
-  *value_name = matching_paths[index].Mid(file_path_.GetLength());
-
-  return true;
-}
-
-}  // namespace omaha
-
diff --git a/base/file_store.h b/base/file_store.h
deleted file mode 100644
index 43febe9..0000000
--- a/base/file_store.h
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Defines class FileStore
-
-#ifndef OMAHA_COMMON_FILE_STORE_H__
-#define OMAHA_COMMON_FILE_STORE_H__
-
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-class FileStore {
- public:
-  // Open the store
-  bool Open(const TCHAR* file_path);
-
-  // Close the store
-  bool Close();
-
-  // Clear the store
-  bool Clear();
-
-  // Read a value from the store
-  bool Read(const TCHAR* name, std::vector<byte>* data) const;
-
-  // Write a value to the store
-  bool Write(const TCHAR* name, byte* data, int data_size);
-
-  // Check to see a named value exists in the store
-  bool Exists(const TCHAR* name) const;
-
-  // Remove a value from the store
-  bool Remove(const TCHAR* name);
-
-  // Get the number of values for this store
-  bool GetValueCount(uint32* value_count);
-
-  // Get the value name for the given value name index
-  bool GetValueNameAt(uint32 index, CString* value_name);
-
- private:
-  CString file_path_;      // Full path to the file store
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_FILE_STORE_H__
diff --git a/base/file_store_unittest.cc b/base/file_store_unittest.cc
deleted file mode 100644
index d49d7e2..0000000
--- a/base/file_store_unittest.cc
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Unit test for the file_store.
-
-
-
-#include <shlobj.h>
-#include "base/basictypes.h"
-#include "omaha/base/file_store.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-const TCHAR kFilePathPrefix[] = _T("unittest");
-const TCHAR kFileName1[] = _T("fname1");
-const TCHAR kFileName2[] = _T("fname2");
-char kFileContent[] = "1234567890abcdefg";
-
-TEST(FileStoreTest, FileStore) {
-  // Create a temp dir
-  TCHAR temp_path[MAX_PATH];
-  *temp_path = 0;
-  ASSERT_LT(0u, ::GetTempPath(MAX_PATH, temp_path));
-
-  CString temp_dir;
-  temp_dir.Format(_T("%s%s%x"), temp_path, kFilePathPrefix, ::GetTickCount());
-  ASSERT_EQ(::SHCreateDirectoryEx(0, temp_dir, 0), ERROR_SUCCESS);
-  ON_SCOPE_EXIT(DeleteDirectory, temp_dir);
-
-  // Test the file store
-  FileStore file_store;
-  ASSERT_TRUE(file_store.Open(temp_dir));
-
-  // Make sure the folder is empty
-  uint32 value_count;
-  ASSERT_TRUE(file_store.GetValueCount(&value_count));
-  ASSERT_EQ(value_count, 0);
-  CString value_name;
-  ASSERT_FALSE(file_store.GetValueNameAt(0, &value_name));
-
-  // Write 2 files
-  std::vector<byte> buffer;
-  ASSERT_TRUE(file_store.Write(kFileName1,
-                               reinterpret_cast<byte*>(kFileContent),
-                               arraysize(kFileContent)));
-  ASSERT_TRUE(file_store.Exists(kFileName1));
-  ASSERT_TRUE(file_store.GetValueCount(&value_count));
-  ASSERT_EQ(value_count, 1);
-  ASSERT_TRUE(file_store.GetValueNameAt(0, &value_name));
-  ASSERT_TRUE(value_name == kFileName1);
-  ASSERT_TRUE(file_store.Read(kFileName1, &buffer));
-  ASSERT_TRUE(memcmp(kFileContent,
-                     &buffer.front(),
-                     arraysize(kFileContent)) == 0);
-
-  ASSERT_TRUE(file_store.Write(kFileName2,
-                               reinterpret_cast<byte*>(kFileContent),
-                               arraysize(kFileContent)));
-  ASSERT_TRUE(file_store.Exists(kFileName2));
-  ASSERT_TRUE(file_store.GetValueCount(&value_count));
-  ASSERT_EQ(value_count, 2);
-  ASSERT_TRUE(file_store.GetValueNameAt(1, &value_name));
-  ASSERT_TRUE(value_name == kFileName2);
-  ASSERT_TRUE(file_store.Read(kFileName2, &buffer));
-  ASSERT_TRUE(memcmp(kFileContent,
-                     &buffer.front(),
-                     arraysize(kFileContent)) == 0);
-
-  // Remove files
-  ASSERT_TRUE(file_store.Remove(kFileName1));
-  ASSERT_FALSE(file_store.Exists(kFileName1));
-  ASSERT_TRUE(file_store.GetValueCount(&value_count));
-  ASSERT_EQ(value_count, 1);
-  ASSERT_TRUE(file_store.Remove(kFileName2));
-  ASSERT_FALSE(file_store.Exists(kFileName2));
-  ASSERT_TRUE(file_store.GetValueCount(&value_count));
-  ASSERT_EQ(value_count, 0);
-
-  ASSERT_TRUE(file_store.Close());
-}
-
-}  // namespace omaha
-
diff --git a/base/file_unittest.cc b/base/file_unittest.cc
deleted file mode 100644
index c061491..0000000
--- a/base/file_unittest.cc
+++ /dev/null
@@ -1,439 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// File unittest
-
-#include "omaha/base/file.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/string.h"
-#include "omaha/base/timer.h"
-#include "omaha/base/tr_rand.h"
-#include "omaha/base/utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-// TODO(omaha): test error-prone functions such as ReadLineAnsi
-
-namespace {
-
-#define kIEBrowserExe \
-  _T("C:\\PROGRAM FILES\\Internet Explorer\\iexplore.exe")
-
-#define kIEBrowserQuotedExe \
-  _T("\"") kIEBrowserExe _T("\"")
-
-}  // namespace
-
-void SimpleTest(bool async) {
-  File f;
-
-  char buf[1000] = "test";
-  uint32 len1 = 4;
-
-  char buf2[1000] = "aaaa";
-  uint32 len2 = 4;
-
-  char buf3[1000] = "bbbb";
-  uint32 len3 = 4;
-
-  char buf4[1000] = "    ";
-  uint32 len4 = 4;
-
-  CString s(_T("test"));
-  CString testfile(_T("testfile.1"));
-
-  ASSERT_SUCCEEDED(f.Open(testfile, true, async));
-  uint32 pos = 0;
-  ASSERT_SUCCEEDED(f.WriteAt(pos,
-                             reinterpret_cast<byte*>(buf),
-                             len1,
-                             0,
-                             NULL));
-  pos += len1;
-
-  ASSERT_SUCCEEDED(f.WriteAt(pos,
-                             reinterpret_cast<byte*>(buf3),
-                             len3,
-                             0,
-                             NULL));
-  pos += len3;
-
-  ASSERT_SUCCEEDED(f.WriteAt(pos,
-                             reinterpret_cast<byte*>(buf3),
-                             len3,
-                             0,
-                             NULL));
-  pos += len3;
-
-  ASSERT_SUCCEEDED(f.WriteAt(pos,
-                             reinterpret_cast<byte*>(buf3),
-                             len3,
-                             0,
-                             NULL));
-  pos += len3;
-
-  ASSERT_SUCCEEDED(f.WriteAt(pos,
-                             reinterpret_cast<byte*>(buf3),
-                             len3,
-                             0,
-                             NULL));
-  pos += len3;
-
-  ASSERT_SUCCEEDED(f.WriteAt(pos,
-                             reinterpret_cast<byte*>(buf3),
-                             len3,
-                             0,
-                             NULL));
-  pos += len3;
-
-  ASSERT_SUCCEEDED(f.WriteAt(pos,
-                             reinterpret_cast<byte*>(buf3),
-                             len3,
-                             0,
-                             NULL));
-  pos += len3;
-
-  ASSERT_SUCCEEDED(f.ReadAt(0, reinterpret_cast<byte*>(buf4), len1, 0, NULL));
-  ASSERT_STREQ(buf, buf4);
-
-  ASSERT_SUCCEEDED(f.ReadAt(4, reinterpret_cast<byte*>(buf4), len3, 0, NULL));
-  ASSERT_STREQ(buf3, buf4);
-
-  ASSERT_SUCCEEDED(f.WriteAt(1, reinterpret_cast<byte*>(buf3), 2, 0, NULL));
-
-  ASSERT_SUCCEEDED(f.WriteAt(20, reinterpret_cast<byte*>(buf), 2, 0, NULL));
-  ASSERT_SUCCEEDED(f.ReadAt(20, reinterpret_cast<byte*>(buf), 2, 0, NULL));
-
-  ASSERT_SUCCEEDED(f.WriteAt(30, reinterpret_cast<byte*>(buf), 2, 0, NULL));
-
-  ASSERT_SUCCEEDED(f.SeekFromBegin(0));
-
-  ASSERT_SUCCEEDED(f.ReadAt(30, reinterpret_cast<byte*>(buf), 2, 0, NULL));
-
-  ASSERT_SUCCEEDED(f.Close());
-
-  ASSERT_SUCCEEDED(f.Open(L"testfile.1", false, false));
-  ASSERT_SUCCEEDED(f.ReadAt(0, reinterpret_cast<byte*>(buf), 16, 0, NULL));
-  buf[17] = '\0';
-
-  uint64 size_on_disk = 0;
-  ASSERT_SUCCEEDED(f.GetSizeOnDisk(&size_on_disk));
-  ASSERT_EQ(size_on_disk, 32);
-
-  ASSERT_SUCCEEDED(f.Close());
-
-  ASSERT_TRUE(File::Exists(testfile));
-  ASSERT_SUCCEEDED(File::Remove(testfile));
-  ASSERT_FALSE(File::Exists(testfile));
-}
-
-void FileWriteCreate(uint32 file_size) {
-  Timer time(true);
-  CString testfile;
-  testfile.Format(L"testfile%u", file_size);
-
-  File f;
-  ASSERT_SUCCEEDED(f.Open(testfile, true, false));
-  ASSERT_SUCCEEDED(f.SetLength(file_size, false));
-
-  uint32 write_size = 512;
-
-  byte *buf2 = new byte[write_size];
-
-  for (uint32 j = 0; j < file_size - write_size; j += write_size) {
-      for (uint32 i = 0; i < write_size; i++) {
-        buf2[i] = static_cast<byte>(tr_rand() % 255);
-      }
-      ASSERT_SUCCEEDED(f.WriteAt(j, buf2, write_size, 0, NULL));
-  }
-
-  f.Sync();
-  f.Close();
-
-  EXPECT_SUCCEEDED(File::Remove(testfile));
-}
-
-void FileWriteTimeTest(uint32 file_size,
-                       uint32 number_writes,
-                       uint32 write_size) {
-  Timer time(true);
-  CString testfile;
-  testfile.Format(L"testfile%u", file_size);
-
-  File f;
-  ASSERT_SUCCEEDED(f.Open(testfile, true, false));
-
-  byte *buf = new byte[write_size];
-
-  for (uint32 i = 0; i < number_writes; i++) {
-    for (uint32 j = 0; j < write_size; j++) {
-      buf[j] = static_cast<byte>(tr_rand() % 255);
-    }
-    uint32 pos = (tr_rand() * 65536 + tr_rand()) % (file_size - write_size);
-    ASSERT_SUCCEEDED(f.WriteAt(pos, buf, write_size, 0, NULL));
-  }
-
-  delete[] buf;
-
-  ASSERT_SUCCEEDED(f.Sync());
-  ASSERT_SUCCEEDED(f.Close());
-
-  EXPECT_SUCCEEDED(File::Remove(testfile));
-}
-
-TEST(FileTest, File) {
-  const TCHAR* const kTestFileName = L"testfile.3";
-
-  SimpleTest(false);
-
-  int header = 123;
-  int header2 = 0;
-
-  File f2;
-  ASSERT_SUCCEEDED(f2.Open(kTestFileName, true, false));
-  ASSERT_SUCCEEDED(f2.WriteAt(0,
-                              reinterpret_cast<byte*>(&header),
-                              sizeof(header),
-                              0,
-                              NULL));
-  ASSERT_SUCCEEDED(f2.ReadAt(0,
-                             reinterpret_cast<byte*>(&header2),
-                             sizeof(header),
-                             0,
-                             NULL));
-  ASSERT_EQ(header, header2);
-
-  uint64 size_on_disk = 0;
-
-  ASSERT_SUCCEEDED(f2.GetSizeOnDisk(&size_on_disk));
-  ASSERT_EQ(size_on_disk, sizeof(header));
-  ASSERT_SUCCEEDED(f2.Close());
-
-  const int kLevel = 1;
-  for (uint32 file_size = 2 * 1024 * 1024;
-       file_size <= 2 * 1024 * 1024;
-       file_size *= 2) {
-    for (uint32 number_writes = 100;
-         number_writes <= (300 * static_cast<uint32>(kLevel));
-         number_writes *= 2) {
-      uint32 write_size = 128;
-      FileWriteTimeTest(file_size, number_writes, write_size);
-    }
-  }
-
-  // Test File::Copy, File::Move, File::CopyWildcards
-  {
-    CString windows_dir;
-    CString temp_dir;
-    DWORD dw = ::GetEnvironmentVariable(
-        L"SystemRoot",
-        windows_dir.GetBufferSetLength(MAX_PATH),
-        MAX_PATH);
-    windows_dir.ReleaseBuffer();
-    ASSERT_TRUE(dw);
-    dw = ::GetEnvironmentVariable(L"TEMP",
-                                  temp_dir.GetBufferSetLength(MAX_PATH),
-                                  MAX_PATH);
-    temp_dir.ReleaseBuffer();
-    ASSERT_TRUE(dw);
-    CString known_file1(windows_dir + L"\\NOTEPAD.EXE");
-    CString known_file2(windows_dir + L"\\REGEDIT.EXE");
-    CString temp_file1(temp_dir + L"\\FOO.TMP");
-    CString temp_file2(temp_dir + L"\\BAR.TMP");
-    uint32 known_size1 = 0;
-    uint32 known_size2 = 0;
-    uint32 temp_size1 = 0;
-
-    // Start with neither file existing
-    if (File::Exists(temp_file1))
-      File::Remove(temp_file1);
-    if (File::Exists(temp_file2))
-      File::Remove(temp_file2);
-    ASSERT_FALSE(File::Exists(temp_file1));
-    ASSERT_FALSE(File::Exists(temp_file2));
-    ASSERT_SUCCEEDED(File::GetFileSizeUnopen(known_file1, &known_size1));
-    ASSERT_SUCCEEDED(File::GetFileSizeUnopen(known_file2, &known_size2));
-    ASSERT_NE(known_size1, known_size2);
-
-    // Copy to create a file, move it to 2nd file, then remove 2nd file
-    ASSERT_SUCCEEDED(File::Copy(known_file1, temp_file1, false));
-    ASSERT_TRUE(File::Exists(temp_file1));
-    ASSERT_SUCCEEDED(File::Move(temp_file1, temp_file2, false));
-    ASSERT_FALSE(File::Exists(temp_file1));
-    ASSERT_TRUE(File::Exists(temp_file2));
-    ASSERT_SUCCEEDED(File::Remove(temp_file2));
-    ASSERT_FALSE(File::Exists(temp_file2));
-
-    // Try copying a file on top of a file - with and without
-    // replace_existing_file=true
-    ASSERT_SUCCEEDED(File::Copy(known_file1, temp_file1, false));
-    ASSERT_SUCCEEDED(File::GetFileSizeUnopen(temp_file1, &temp_size1));
-    ASSERT_EQ(temp_size1, known_size1);
-    ASSERT_SUCCEEDED(File::Copy(known_file2, temp_file1, false));
-    ASSERT_TRUE(File::Exists(temp_file1));
-    ASSERT_SUCCEEDED(File::GetFileSizeUnopen(temp_file1, &temp_size1));
-    ASSERT_EQ(temp_size1, known_size1);
-    ASSERT_SUCCEEDED(File::Copy(known_file2, temp_file1, true));
-    ASSERT_TRUE(File::Exists(temp_file1));
-    ASSERT_SUCCEEDED(File::GetFileSizeUnopen(temp_file1, &temp_size1));
-    ASSERT_EQ(temp_size1, known_size2);
-    ASSERT_SUCCEEDED(File::Remove(temp_file1));
-
-    // Try copying a bunch of files
-    CString known_file3(windows_dir + L"\\twunk_32.exe");
-    CString known_file4(windows_dir + L"\\twunk_16.exe");
-    CString temp_file3(temp_dir + L"\\twunk_32.exe");
-    CString temp_file4(temp_dir + L"\\twunk_16.exe");
-    if (File::Exists(temp_file3))
-      File::Remove(temp_file3);
-    if (File::Exists(temp_file4))
-      File::Remove(temp_file4);
-    ASSERT_TRUE(File::Exists(known_file3));
-    ASSERT_TRUE(File::Exists(known_file4));
-    ASSERT_FALSE(File::Exists(temp_file3));
-    ASSERT_FALSE(File::Exists(temp_file4));
-    ASSERT_SUCCEEDED(File::CopyWildcards(windows_dir,
-                                         temp_dir,
-                                         L"twunk*.exe",
-                                         true));
-    ASSERT_TRUE(File::Exists(temp_file3));
-    ASSERT_TRUE(File::Exists(temp_file4));
-    ASSERT_SUCCEEDED(File::Remove(temp_file3));
-    ASSERT_SUCCEEDED(File::Remove(temp_file4));
-
-    std::vector<CString> matching_files;
-    ASSERT_SUCCEEDED(File::GetWildcards(windows_dir,
-                                        L"twunk*.exe",
-                                        &matching_files));
-    ASSERT_EQ(matching_files.size(), 2);
-    ASSERT_TRUE(matching_files[0] == known_file3 ||
-                matching_files[0] == known_file4);
-    ASSERT_TRUE(matching_files[1] == known_file3 ||
-                matching_files[1] == known_file4);
-    ASSERT_TRUE(matching_files[0] != matching_files[1]);
-  }
-
-  EXPECT_SUCCEEDED(File::Remove(kTestFileName));
-}
-
-
-TEST(FileTest, FileChangeWatcher) {
-  CString temp_dir;
-  ASSERT_TRUE(::GetEnvironmentVariable(L"TEMP",
-                                       temp_dir.GetBufferSetLength(MAX_PATH),
-                                       MAX_PATH) != 0);
-  temp_dir.ReleaseBuffer();
-  temp_dir = String_MakeEndWith(temp_dir, _T("\\"), false /* ignore_case */);
-  temp_dir = temp_dir + _T("omaha_unittest") + itostr(tr_rand() % 255);
-  EXPECT_SUCCEEDED(CreateDir(temp_dir, 0));
-
-  // watch the directory for changes
-  FileWatcher watcher(temp_dir, false, FILE_NOTIFY_CHANGE_LAST_WRITE);
-  EXPECT_SUCCEEDED(watcher.EnsureEventSetup());
-  EXPECT_FALSE(watcher.HasChangeOccurred());
-
-  //
-  // verify that the watcher got set-up correctly the first time
-  //
-
-  // do something in the dir
-  File f;
-  int header1 = 94;
-  ASSERT_SUCCEEDED(f.Open(temp_dir + _T("\\testfile.1"), true, false));
-  ASSERT_SUCCEEDED(f.WriteAt(0, reinterpret_cast<byte*>(&header1),
-                             sizeof(header1), 0, NULL));
-  ASSERT_SUCCEEDED(f.Sync());
-  ASSERT_SUCCEEDED(f.Close());
-
-  // Did we noticed that something happened?
-  EXPECT_TRUE(watcher.HasChangeOccurred());
-  EXPECT_SUCCEEDED(watcher.EnsureEventSetup());
-  EXPECT_FALSE(watcher.HasChangeOccurred());
-
-  //
-  // verify that the watcher got set-up correctly the second time
-  //
-
-  // do something in the dir
-  byte header2 = 2;
-  ASSERT_SUCCEEDED(f.Open(temp_dir + _T("\\testfile.2"), true, false));
-  ASSERT_SUCCEEDED(f.WriteAt(0, reinterpret_cast<byte*>(&header2),
-                             sizeof(header2), 0, NULL));
-  ASSERT_SUCCEEDED(f.Sync());
-  ASSERT_SUCCEEDED(f.Close());
-
-  // Did we noticed that something happened?
-  EXPECT_TRUE(watcher.HasChangeOccurred());
-  EXPECT_SUCCEEDED(watcher.EnsureEventSetup());
-  EXPECT_FALSE(watcher.HasChangeOccurred());
-
-  EXPECT_SUCCEEDED(DeleteDirectory(temp_dir));
-}
-
-TEST(FileTest, Exists_UnQuoted) {
-  EXPECT_TRUE(File::Exists(kIEBrowserExe));
-  EXPECT_FALSE(File::Exists(_T("C:\\foo\\does not exist.exe")));
-  EXPECT_FALSE(File::Exists(_T("Z:\\foo\\does not exist.exe")));
-  if (ShouldRunLargeTest()) {
-    EXPECT_FALSE(File::Exists(_T("\\\\foo\\does not exist.exe")));
-  }
-}
-
-// File::Exists() expects unquoted paths.
-TEST(FileTest, Exists_Quoted) {
-  EXPECT_FALSE(File::Exists(kIEBrowserQuotedExe));
-  EXPECT_FALSE(File::Exists(_T("\"C:\\foo\\does not exist.exe\"")));
-  EXPECT_FALSE(File::Exists(_T("\"Z:\\foo\\does not exist.exe\"")));
-  if (ShouldRunLargeTest()) {
-    EXPECT_FALSE(File::Exists(_T("\"\\\\foo\\does not exist.exe\"")));
-  }
-}
-
-// File::Exists() handles trailing spaces but not leading whitespace, tabs, or
-// enclosed paths.
-TEST(FileTest, Exists_ExtraWhitespace) {
-  EXPECT_TRUE(File::Exists(kIEBrowserExe _T(" ")));
-  EXPECT_TRUE(File::Exists(kIEBrowserExe _T("    ")));
-  EXPECT_FALSE(File::Exists(_T(" ") kIEBrowserExe));
-  EXPECT_FALSE(File::Exists(kIEBrowserExe _T("\t")));
-
-  EXPECT_FALSE(File::Exists(kIEBrowserQuotedExe _T(" ")));
-  EXPECT_FALSE(File::Exists(kIEBrowserQuotedExe _T("    ")));
-  EXPECT_FALSE(File::Exists(_T(" ") kIEBrowserQuotedExe));
-  EXPECT_FALSE(File::Exists(kIEBrowserQuotedExe _T("\t")));
-
-  EXPECT_FALSE(File::Exists(_T("\"") kIEBrowserExe _T(" \"")));
-  EXPECT_FALSE(File::Exists(_T("\"") kIEBrowserExe _T("    \"")));
-  EXPECT_FALSE(File::Exists(_T("\" ") kIEBrowserExe _T("\"") ));
-  EXPECT_FALSE(File::Exists(_T("\"") kIEBrowserExe _T("\t\"")));
-
-  EXPECT_FALSE(File::Exists(_T("\"") kIEBrowserExe _T(" \" ")));
-}
-
-TEST(FileTest, AreFilesIdentical) {
-  CString windows_dir;
-  ASSERT_TRUE(::GetEnvironmentVariable(_T("SystemRoot"),
-                                       CStrBuf(windows_dir, MAX_PATH),
-                                       MAX_PATH));
-
-  CString known_file1(windows_dir + _T("\\NOTEPAD.EXE"));
-  CString known_file2(windows_dir + _T("\\REGEDIT.EXE"));
-
-  EXPECT_TRUE(File::AreFilesIdentical(known_file1, known_file1));
-  EXPECT_FALSE(File::AreFilesIdentical(known_file1, known_file2));
-}
-
-}  // namespace omaha
diff --git a/base/file_ver.cc b/base/file_ver.cc
deleted file mode 100644
index a97f90e..0000000
--- a/base/file_ver.cc
+++ /dev/null
@@ -1,178 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/file_ver.h"
-#include "omaha/base/commontypes.h"
-#include "omaha/base/debug.h"
-
-namespace omaha {
-
-// TODO(omaha): Write unittest for this class.
-
-FileVer::FileVer() {
-  file_ver_data_ = NULL;
-  lang_charset_ = 0;
-}
-
-FileVer::~FileVer() {
-  Close();
-}
-
-void FileVer::Close() {
-  delete[] file_ver_data_;
-  file_ver_data_ = NULL;
-  lang_charset_ = 0;
-}
-
-BOOL FileVer::Open(const TCHAR* lpszModuleName) {
-  ASSERT1(lpszModuleName);
-
-  // Get the version information size and allocate the buffer.
-  DWORD handle;
-  DWORD ver_info_size =
-      ::GetFileVersionInfoSize(const_cast<TCHAR*>(lpszModuleName), &handle);
-  if (ver_info_size == 0) {
-    return FALSE;
-  }
-
-  // Get version information.
-  // file_ver_data_ is allocated here and deleted in Close() (or implicitly
-  // in the destructor).
-  file_ver_data_ = new byte[ver_info_size];
-  ASSERT1(file_ver_data_);
-  if (!file_ver_data_) {
-    return FALSE;
-  }
-
-  if (!::GetFileVersionInfo(const_cast<TCHAR*>(lpszModuleName), handle,
-                            ver_info_size,
-                            reinterpret_cast<void**>(file_ver_data_))) {
-    Close();
-    return FALSE;
-  }
-
-  // Get the first language and character-set identifier.
-  UINT query_size = 0;
-  DWORD* translation_table = NULL;
-  if (!::VerQueryValue(file_ver_data_,
-                       _T("\\VarFileInfo\\Translation"),
-                       reinterpret_cast<void**>(&translation_table),
-                       &query_size) ||
-      query_size == 0) {
-    Close();
-    return FALSE;
-  }
-
-  ASSERT1(query_size != 0);
-  ASSERT1(translation_table);
-
-  // Create charset.
-  lang_charset_ = MAKELONG(HIWORD(translation_table[0]),
-                           LOWORD(translation_table[0]));
-  return TRUE;
-}
-
-CString FileVer::QueryValue(const TCHAR* lpszValueName) const {
-  ASSERT1(lpszValueName);
-
-  if (file_ver_data_ == NULL) {
-    return (CString)_T("");
-  }
-
-  // Query version information value.
-  UINT query_size = 0;
-  LPVOID query_data = NULL;
-  CString str_query_value, str_block_name;
-  str_block_name.Format(_T("\\StringFileInfo\\%08lx\\%s"),
-                        lang_charset_,
-                        lpszValueName);
-
-  if (::VerQueryValue(reinterpret_cast<void**>(file_ver_data_),
-                      str_block_name.GetBuffer(0),
-                      &query_data,
-                      &query_size) &&
-      query_size != 0 &&
-      query_data) {
-    str_query_value = reinterpret_cast<const TCHAR*>(query_data);
-  }
-
-  str_block_name.ReleaseBuffer();
-
-  return str_query_value;
-}
-
-BOOL FileVer::GetFixedInfo(VS_FIXEDFILEINFO& vsffi) const {   // NOLINT
-  if (file_ver_data_ == NULL) {
-    return FALSE;
-  }
-
-  UINT query_size = 0;
-  VS_FIXEDFILEINFO* pVsffi = NULL;
-  if (::VerQueryValue(reinterpret_cast<void**>(file_ver_data_),
-                      _T("\\"),
-                      reinterpret_cast<void**>(&pVsffi),
-                      &query_size) &&
-      query_size != 0 &&
-      pVsffi) {
-    vsffi = *pVsffi;
-    return TRUE;
-  }
-
-  return FALSE;
-}
-
-CString FileVer::FormatFixedFileVersion() const {
-  CString str_version;
-  VS_FIXEDFILEINFO vsffi = {0};
-
-  if (GetFixedInfo(vsffi)) {
-    str_version.Format(NOTRANSL(_T("%u.%u.%u.%u")),
-                       HIWORD(vsffi.dwFileVersionMS),
-                       LOWORD(vsffi.dwFileVersionMS),
-                       HIWORD(vsffi.dwFileVersionLS),
-                       LOWORD(vsffi.dwFileVersionLS));
-  }
-  return str_version;
-}
-
-CString FileVer::FormatFixedProductVersion() const {
-  CString str_version;
-  VS_FIXEDFILEINFO vsffi = {0};
-
-  if (GetFixedInfo(vsffi)) {
-    str_version.Format(NOTRANSL(_T("%u.%u.%u.%u")),
-                       HIWORD(vsffi.dwProductVersionMS),
-                       LOWORD(vsffi.dwProductVersionMS),
-                       HIWORD(vsffi.dwProductVersionLS),
-                       LOWORD(vsffi.dwProductVersionLS));
-  }
-  return str_version;
-}
-
-ULONGLONG FileVer::GetFileVersionAsULONGLONG() const {
-  ULONGLONG version = 0;
-  VS_FIXEDFILEINFO vsffi = {0};
-
-  if (GetFixedInfo(vsffi)) {
-    version = MAKEDLLVERULL(HIWORD(vsffi.dwProductVersionMS),
-                            LOWORD(vsffi.dwProductVersionMS),
-                            HIWORD(vsffi.dwProductVersionLS),
-                            LOWORD(vsffi.dwProductVersionLS));
-  }
-  return version;
-}
-
-}  // namespace omaha
-
diff --git a/base/file_ver.h b/base/file_ver.h
deleted file mode 100644
index 6ba29f0..0000000
--- a/base/file_ver.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_FILE_VER_H_
-#define OMAHA_COMMON_FILE_VER_H_
-
-#include <windows.h>
-#include <tchar.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-class FileVer {
- public:
-  FileVer();
-  ~FileVer();
-
-  // opens the version info for the specified file
-  BOOL Open(const TCHAR* lpszModuleName);
-
-  // Cleanup
-  void Close();
-
-  // Query for a given vlaue
-  CString QueryValue(const TCHAR* lpszValueName) const;
-
-  // Shortcuts for common values
-  CString GetFileDescription() const {return QueryValue(_T("FileDescription"));}
-  CString GetFileVersion() const     {return QueryValue(_T("FileVersion"));    }
-  CString GetCompanyName() const     {return QueryValue(_T("CompanyName"));    }
-  CString GetProductName() const     {return QueryValue(_T("ProductName"));    }
-  CString GetProductVersion() const  {return QueryValue(_T("ProductVersion")); }
-
-  // gets the FIXEDFILEINFO datastructure
-  BOOL GetFixedInfo(VS_FIXEDFILEINFO& vsffi) const;   // NOLINT
-
-  // returns a formated string representing the file and product versions
-  // e.g. 2.4.124.34
-  CString FormatFixedFileVersion() const;
-  CString FormatFixedProductVersion() const;
-
-  // Returns a ULONGLONG containing the version in DLL version format.
-  ULONGLONG GetFileVersionAsULONGLONG() const;
-
-  // gets the language ID
-  LCID GetLanguageID() const         { return HIWORD(lang_charset_); }
-
- private:
-  // versioning data returned by GetFileVersionInfo
-  byte*  file_ver_data_;
-
-  // language charset
-  DWORD   lang_charset_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(FileVer);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_FILE_VER_H_
diff --git a/base/firewall_product_detection.cc b/base/firewall_product_detection.cc
deleted file mode 100644
index fe3c481..0000000
--- a/base/firewall_product_detection.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/firewall_product_detection.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/wmi_query.h"
-
-namespace omaha {
-
-namespace firewall_detection {
-
-namespace {
-
-const TCHAR kWmiSecurityCenter[]        = _T("root\\SecurityCenter");
-const TCHAR kWmiQueryFirewallProduct[]  = _T("select * from FirewallProduct");
-const TCHAR kWmiPropDisplayName[]       = _T("displayName");
-const TCHAR kWmiPropVersionNumber[]     = _T("versionNumber");
-
-}  // namespace
-
-
-HRESULT Detect(CString* name, CString* version) {
-  ASSERT1(name);
-  ASSERT1(version);
-
-  name->Empty();
-  version->Empty();
-
-  WmiQuery wmi_query;
-  HRESULT hr = wmi_query.Connect(kWmiSecurityCenter);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  hr = wmi_query.Query(kWmiQueryFirewallProduct);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  if (wmi_query.AtEnd()) {
-    return E_FAIL;
-  }
-  hr = wmi_query.GetValue(kWmiPropDisplayName, name);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  wmi_query.GetValue(kWmiPropVersionNumber, version);
-  return S_OK;
-}
-
-}  // namespace firewall_detection
-
-}  // namespace omaha
-
diff --git a/base/firewall_product_detection.h b/base/firewall_product_detection.h
deleted file mode 100644
index d29e786..0000000
--- a/base/firewall_product_detection.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_FIREWALL_PRODUCT_DETECTION_H_
-#define OMAHA_COMMON_FIREWALL_PRODUCT_DETECTION_H_
-
-#include <windows.h>
-#include <atlstr.h>
-
-namespace omaha {
-
-namespace firewall_detection {
-
-// Detects if the computer is running a software firewall.
-HRESULT Detect(CString* name, CString* version);
-
-}  // namespace firewall_detection
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_FIREWALL_PRODUCT_DETECTION_H_
diff --git a/base/firewall_product_detection_unittest.cc b/base/firewall_product_detection_unittest.cc
deleted file mode 100644
index 9f26ec3..0000000
--- a/base/firewall_product_detection_unittest.cc
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/base/firewall_product_detection.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace firewall_detection {
-
-TEST(FirewallProductDetection, Detect) {
-  CString name, version;
-  HRESULT hr = Detect(&name, &version);
-  if (SUCCEEDED(hr)) {
-    EXPECT_FALSE(name.IsEmpty());
-    EXPECT_FALSE(version.IsEmpty());
-  }
-}
-
-}  // namespace firewall_detection
-
-}  // namespace omaha
-
diff --git a/base/generic_reg_file_appid.rgs b/base/generic_reg_file_appid.rgs
deleted file mode 100644
index 829d0b2..0000000
--- a/base/generic_reg_file_appid.rgs
+++ /dev/null
@@ -1,18 +0,0 @@
-HKLM
-{
-  NoRemove SOFTWARE
-  {
-    NoRemove Classes
-    {
-      NoRemove AppID
-      {
-        ForceRemove '%APPID%' = s '%DESCRIPTION%'
-        ForceRemove '%FILENAME%'
-        {
-          val AppID = s '%APPID%'
-        }
-      }
-    }
-  }
-}
-
diff --git a/base/generic_reg_file_clsid_elevation_localserver.rgs b/base/generic_reg_file_clsid_elevation_localserver.rgs
deleted file mode 100644
index d672a21..0000000
--- a/base/generic_reg_file_clsid_elevation_localserver.rgs
+++ /dev/null
@@ -1,16 +0,0 @@
-'%HKROOT%' {
-  NoRemove Software {
-    NoRemove Classes {
-      NoRemove CLSID {
-        ForceRemove '%CLSID%' = s '%DESCRIPTION%' {
-          Elevation {
-            val Enabled = d 1
-            val IconReference = s '@%MODULE_RAW%, -%ICONRESID%'
-          }
-          LocalServer32 = s '%EXE_MODULE%'
-          val LocalizedString = s '@%MODULE_RAW%,-%STRINGRESID%'
-        }
-      }
-    }
-  }
-}
diff --git a/base/generic_reg_file_dll.rgs b/base/generic_reg_file_dll.rgs
deleted file mode 100644
index 7b68f64..0000000
--- a/base/generic_reg_file_dll.rgs
+++ /dev/null
@@ -1,13 +0,0 @@
-'%HKROOT%' {
-  NoRemove Software {
-    NoRemove Classes {
-      NoRemove CLSID {
-        ForceRemove '%CLSID%' {
-          InprocServer32 = s '%MODULE%' {
-            val ThreadingModel = s 'Both'
-          }
-        }
-      }
-    }
-  }
-}
diff --git a/base/generic_reg_file_dll_handler.rgs b/base/generic_reg_file_dll_handler.rgs
deleted file mode 100644
index f787d7c..0000000
--- a/base/generic_reg_file_dll_handler.rgs
+++ /dev/null
@@ -1,13 +0,0 @@
-'%HKROOT%' {
-  NoRemove Software {
-    NoRemove Classes {
-      NoRemove CLSID {
-        ForceRemove '%CLSID%' {
-          InprocHandler32 = s '%MODULE%' {
-            val ThreadingModel = s 'Both'
-          }
-        }
-      }
-    }
-  }
-}
diff --git a/base/generic_reg_file_elevation_localserver.rgs b/base/generic_reg_file_elevation_localserver.rgs
deleted file mode 100644
index 8e24f85..0000000
--- a/base/generic_reg_file_elevation_localserver.rgs
+++ /dev/null
@@ -1,34 +0,0 @@
-HKLM
-{
-  NoRemove SOFTWARE
-  {
-    NoRemove Classes
-    {
-      '%PROGID%.%VERSION%' = s '%DESCRIPTION%'
-      {
-        CLSID = s '%CLSID%'
-      }
-      '%PROGID%' = s '%DESCRIPTION%'
-      {
-        CLSID = s '%CLSID%'
-        CurVer = s '%PROGID%.%VERSION%'
-      }
-      NoRemove CLSID
-      {
-        ForceRemove '%CLSID%' = s '%DESCRIPTION%'
-        {
-          ProgID = s '%PROGID%.%VERSION%'
-          VersionIndependentProgID = s '%PROGID%'
-          LocalServer32 = s '%MODULE%'
-          val LocalizedString = s '@%MODULE_RAW%,-%STRINGRESID%'
-          Elevation
-          {
-            val Enabled = d '1'
-            val IconReference = s '@%MODULE_RAW%,-%ICONRESID%'
-          }
-        }
-      }
-    }
-  }
-}
-
diff --git a/base/generic_reg_file_ie_low_local_server.rgs b/base/generic_reg_file_ie_low_local_server.rgs
deleted file mode 100644
index 55003fd..0000000
--- a/base/generic_reg_file_ie_low_local_server.rgs
+++ /dev/null
@@ -1,45 +0,0 @@
-%HKROOT%
-{
-  NoRemove SOFTWARE
-  {
-    NoRemove Classes
-    {
-      %PROGID%.%VERSION% = s '%DESCRIPTION%'
-      {
-        CLSID = s '%CLSID%'
-      }
-      %PROGID% = s '%DESCRIPTION%'
-      {
-        CLSID = s '%CLSID%'
-        CurVer = s '%PROGID%.%VERSION%'
-      }
-      NoRemove CLSID
-      {
-        ForceRemove %CLSID% = s '%DESCRIPTION%'
-        {
-          ProgID = s '%PROGID%.%VERSION%'
-          VersionIndependentProgID = s '%PROGID%'
-          LocalServer32 = s '%MODULE%'
-        }
-      }
-    }
-    NoRemove Microsoft
-    {
-      NoRemove 'Internet Explorer'
-      {
-        NoRemove 'Low Rights'
-        {
-          NoRemove 'ElevationPolicy'
-          {
-            ForceRemove '%CLSID%'
-            {
-              val CLSID = s '%CLSID%'
-              val Policy = d '3'
-            }
-          }
-        }
-      }
-    }
-  }
-}
-
diff --git a/base/generic_reg_file_local_server.rgs b/base/generic_reg_file_local_server.rgs
deleted file mode 100644
index 743a264..0000000
--- a/base/generic_reg_file_local_server.rgs
+++ /dev/null
@@ -1,28 +0,0 @@
-'%HKROOT%'
-{
-  NoRemove SOFTWARE
-  {
-    NoRemove Classes
-    {
-      '%PROGID%.%VERSION%' = s '%DESCRIPTION%'
-      {
-        CLSID = s '%CLSID%'
-      }
-      '%PROGID%' = s '%DESCRIPTION%'
-      {
-        CLSID = s '%CLSID%'
-        CurVer = s '%PROGID%.%VERSION%'
-      }
-      NoRemove CLSID
-      {
-        ForceRemove '%CLSID%' = s '%DESCRIPTION%'
-        {
-          ProgID = s '%PROGID%.%VERSION%'
-          VersionIndependentProgID = s '%PROGID%'
-          LocalServer32 = s '%MODULE%'
-        }
-      }
-    }
-  }
-}
-
diff --git a/base/generic_reg_file_local_server_w_appid.rgs b/base/generic_reg_file_local_server_w_appid.rgs
deleted file mode 100644
index 0d769c3..0000000
--- a/base/generic_reg_file_local_server_w_appid.rgs
+++ /dev/null
@@ -1,62 +0,0 @@
-HKCR
-{
-  '%PROGID%.%VERSION%' = s '%DESCRIPTION%'
-  {
-    CLSID = s '%CLSID%'
-  }
-  '%PROGID%' = s '%DESCRIPTION%'
-  {
-    CLSID = s '%CLSID%'
-    CurVer = s '%PROGID%.%VERSION%'
-  }
-  NoRemove CLSID
-  {
-    ForceRemove '%CLSID%' = s '%DESCRIPTION%'
-    {
-      ProgID = s '%PROGID%.%VERSION%'
-      VersionIndependentProgID = s '%PROGID%'
-      ForceRemove 'Programmable'
-      LocalServer32 = s '%MODULE%'
-      {
-        val ThreadingModel = s '%THREADING%'
-      }
-      val AppID = s '%APPID%'
-      'TypeLib' = s '%LIBID%'
-    }
-  }
-  NoRemove AppID
-  {
-    ForceRemove '%APPID%' = s '%DESCRIPTION%'
-    {
-
-    }
-    ForceRemove '%OBJECTFILENAME%'
-    {
-      val AppID = s '%APPID%'
-    }
-  }
-}
-HKLM
-{
-  NoRemove SOFTWARE
-  {
-    NoRemove Microsoft
-    {
-      NoRemove 'Internet Explorer'
-      {
-        NoRemove 'Low Rights'
-        {
-          NoRemove ElevationPolicy
-          {
-            ForceRemove '%APPID%'
-            {
-              val AppName = s '%OBJECTFILENAME%'
-              val AppPath = s '%MODULEPATH%'
-              val Policy = d '3'
-            }
-          }
-        }
-      }
-    }
-  }
-}
\ No newline at end of file
diff --git a/base/generic_reg_file_localservice.rgs b/base/generic_reg_file_localservice.rgs
deleted file mode 100644
index 6f48c2b..0000000
--- a/base/generic_reg_file_localservice.rgs
+++ /dev/null
@@ -1,28 +0,0 @@
-HKLM
-{
-  NoRemove SOFTWARE
-  {
-    NoRemove Classes
-    {
-      '%PROGID%.%VERSION%' = s '%DESCRIPTION%'
-      {
-        CLSID = s '%CLSID%'
-      }
-      '%PROGID%' = s '%DESCRIPTION%'
-      {
-        CLSID = s '%CLSID%'
-        CurVer = s '%PROGID%.%VERSION%'
-      }
-      NoRemove CLSID
-      {
-        ForceRemove '%CLSID%' = s '%DESCRIPTION%'
-        {
-          ProgID = s '%PROGID%.%VERSION%'
-          VersionIndependentProgID = s '%PROGID%'
-          val AppID = s '%APPID%'
-        }
-      }
-    }
-  }
-}
-
diff --git a/base/generic_reg_file_typelib.rgs b/base/generic_reg_file_typelib.rgs
deleted file mode 100644
index b55a786..0000000
--- a/base/generic_reg_file_typelib.rgs
+++ /dev/null
@@ -1,10 +0,0 @@
-HKCR
-{
-  NoRemove CLSID
-  {
-    ForceRemove '%CLSID%' = s '%DESCRIPTION%'
-    {
-      'TypeLib' = s '%LIBID%'
-    }
-  }
-}
diff --git a/base/has_exception_namespace_fix.h b/base/has_exception_namespace_fix.h
deleted file mode 100644
index e4f6367..0000000
--- a/base/has_exception_namespace_fix.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#if !_HAS_EXCEPTIONS
-// Fixes a problem with using the standard library with exceptions turned off.
-// See discussion at http://tiny.cc/byLhe
-#include <exception>
-using std::exception;
-#endif
diff --git a/base/highres_timer-win32.cc b/base/highres_timer-win32.cc
deleted file mode 100644
index f3d5111..0000000
--- a/base/highres_timer-win32.cc
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-#include "omaha/base/highres_timer-win32.h"
-
-namespace omaha {
-
-bool HighresTimer::perf_freq_collected_ = false;
-ULONGLONG HighresTimer::perf_freq_ = 0;
-
-ULONGLONG HighresTimer::GetElapsedMs() const {
-  ULONGLONG end_time = GetCurrentTicks();
-
-  // Scale to ms and round to nearerst ms - rounding is important
-  // because otherwise the truncation error may accumulate e.g. in sums.
-  //
-  // Given infinite resolution, this expression could be written as:
-  //  trunc((end - start (units:freq*sec))/freq (units:sec) *
-  //                1000 (unit:ms) + 1/2 (unit:ms))
-  ULONGLONG freq = GetTimerFrequency();
-  return ((end_time - start_ticks_) * 1000L + freq / 2) / freq;
-}
-
-ULONGLONG HighresTimer::GetElapsedSec() const {
-  ULONGLONG end_time = GetCurrentTicks();
-
-  // Scale to ms and round to nearerst ms - rounding is important
-  // because otherwise the truncation error may accumulate e.g. in sums.
-  //
-  // Given infinite resolution, this expression could be written as:
-  //  trunc((end - start (units:freq*sec))/freq (unit:sec) + 1/2 (unit:sec))
-  ULONGLONG freq = GetTimerFrequency();
-  return ((end_time - start_ticks_) + freq / 2) / freq;
-}
-
-void HighresTimer::CollectPerfFreq() {
-  LARGE_INTEGER freq;
-
-  // Note that this is racy.
-  // It's OK, however, because even concurrent executions of this
-  // are idempotent.
-  if (::QueryPerformanceFrequency(&freq)) {
-    perf_freq_ = freq.QuadPart;
-    perf_freq_collected_ = true;
-  }
-}
-
-}  // namespace omaha
-
diff --git a/base/highres_timer-win32.h b/base/highres_timer-win32.h
deleted file mode 100644
index 68a9f6e..0000000
--- a/base/highres_timer-win32.h
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-#ifndef OMAHA_COMMON_HIGHRES_TIMER_WIN32_H__
-#define OMAHA_COMMON_HIGHRES_TIMER_WIN32_H__
-
-#include <windows.h>
-
-namespace omaha {
-
-/// A handy class for reliably measuring wall-clock time with decent resolution,
-/// even on multi-processor machines and on laptops (where RDTSC potentially
-/// returns different results on different processors and/or the RDTSC timer
-/// clocks at different rates depending on the power state of the CPU,
-/// respectively).
-class HighresTimer {
- public:
-  /// Captures the current start time
-  HighresTimer();
-
-  /// Captures the current tick, can be used to reset a timer for reuse.
-  void Start();
-
-  /// Returns the elapsed ticks with full resolution
-  ULONGLONG GetElapsedTicks() const;
-
-  /// Returns the elapsed time in milliseconds, rounded to the nearest
-  /// millisecond.
-  ULONGLONG GetElapsedMs() const;
-
-  /// Returns the elapsed time in seconds, rounded to the nearest second.
-  ULONGLONG GetElapsedSec() const;
-
-  ULONGLONG start_ticks() const { return start_ticks_; }
-
-  /// Returns timer frequency from cache, should be less
-  /// overhead than ::QueryPerformanceFrequency
-  static ULONGLONG GetTimerFrequency();
-  /// Returns current ticks
-  static ULONGLONG GetCurrentTicks();
-
- private:
-  static void CollectPerfFreq();
-
-  /// Captured start time
-  ULONGLONG start_ticks_;
-
-  /// Captured performance counter frequency
-  static bool perf_freq_collected_;
-  static ULONGLONG perf_freq_;
-};
-
-inline HighresTimer::HighresTimer() {
-  Start();
-}
-
-inline void HighresTimer::Start() {
-  start_ticks_ = GetCurrentTicks();
-}
-
-inline ULONGLONG HighresTimer::GetTimerFrequency() {
-  if (!perf_freq_collected_)
-    CollectPerfFreq();
-  return perf_freq_;
-}
-
-inline ULONGLONG HighresTimer::GetCurrentTicks() {
-  LARGE_INTEGER ticks;
-  ::QueryPerformanceCounter(&ticks);
-  return ticks.QuadPart;
-}
-
-inline ULONGLONG HighresTimer::GetElapsedTicks() const {
-  return start_ticks_ - GetCurrentTicks();
-}
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_HIGHRES_TIMER_WIN32_H__
diff --git a/base/highres_timer_unittest.cc b/base/highres_timer_unittest.cc
deleted file mode 100644
index 6965244..0000000
--- a/base/highres_timer_unittest.cc
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-#include "base/basictypes.h"
-#include "omaha/base/highres_timer-win32.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-// Timing tests are extremely sensitive to external interference from other
-// work currently being done on the machine.  scoped_priority_boost temporarily
-// raises the priority of the caller's thread to reduce the chance of an
-// intervening context switch.
-
-class scoped_priority_boost {
- public:
-  scoped_priority_boost() {
-    orig_process_priority_ = ::GetPriorityClass(::GetCurrentProcess());
-    if (0 != orig_process_priority_) {
-      if (0 == ::SetPriorityClass(::GetCurrentProcess(),
-                                  HIGH_PRIORITY_CLASS)) {
-        orig_process_priority_ = 0;
-      }
-    }
-
-    orig_thread_priority_ = ::GetThreadPriority(::GetCurrentThread());
-    if (THREAD_PRIORITY_ERROR_RETURN != orig_thread_priority_) {
-      if (0 == ::SetThreadPriority(::GetCurrentThread(),
-                                   THREAD_PRIORITY_HIGHEST)) {
-        orig_thread_priority_ = THREAD_PRIORITY_ERROR_RETURN;
-      }
-    }
-  }
-
-  ~scoped_priority_boost() {
-    if (0 != orig_process_priority_) {
-      ::SetPriorityClass(::GetCurrentProcess(), orig_process_priority_);
-    }
-    if (THREAD_PRIORITY_ERROR_RETURN != orig_thread_priority_) {
-      ::SetPriorityClass(::GetCurrentProcess(), orig_process_priority_);
-    }
-  }
-
-  bool succeeded() const {
-    return (0 != orig_process_priority_) &&
-            (THREAD_PRIORITY_ERROR_RETURN != orig_thread_priority_);
-  }
-
- private:
-  DWORD orig_process_priority_;
-  int orig_thread_priority_;
-
-  DISALLOW_COPY_AND_ASSIGN(scoped_priority_boost);
-};
-
-TEST(HighresTimer, MillisecondClock) {
-  scoped_priority_boost spb;
-  EXPECT_TRUE(spb.succeeded());
-
-  HighresTimer timer;
-
-  // note: this could fail if we context switch between initializing the timer
-  // and here. Very unlikely however.
-  EXPECT_EQ(0, timer.GetElapsedMs());
-  timer.Start();
-  uint64 half_ms = (HighresTimer::GetTimerFrequency() / 2000) + 1;
-  // busy wait for a fraction more than half a millisecond.
-  while (timer.start_ticks() + half_ms > HighresTimer::GetCurrentTicks()) {
-    // Nothing
-  }
-  EXPECT_EQ(1, timer.GetElapsedMs());
-}
-
-TEST(HighresTimer, SecondClock) {
-  scoped_priority_boost spb;
-  EXPECT_TRUE(spb.succeeded());
-
-  HighresTimer timer;
-
-  EXPECT_EQ(0, timer.GetElapsedSec());
-#ifdef OS_WINDOWS
-  ::Sleep(250);
-#else
-  struct timespec ts1 = {0, 250000000};
-  nanosleep(&ts1, 0);
-#endif
-  EXPECT_EQ(0, timer.GetElapsedSec());
-  EXPECT_LE(230, timer.GetElapsedMs());
-  EXPECT_GE(270, timer.GetElapsedMs());
-#ifdef OS_WINDOWS
-  ::Sleep(251);
-#else
-  struct timespec ts2 = {0, 251000000};
-  nanosleep(&ts2, 0);
-#endif
-  EXPECT_EQ(1, timer.GetElapsedSec());
-}
-
-}  // namespace omaha
-
diff --git a/base/lang_enc.h b/base/lang_enc.h
deleted file mode 100644
index 9da8c03..0000000
--- a/base/lang_enc.h
+++ /dev/null
@@ -1,299 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// This file is for i18n. It contains two enums, namely Language and
-// Encoding, where Language is the linguistic convention, and Encoding
-// contains information on both language encoding and character set.
-//
-// The language and encoding are both based on Teragram's conventions,
-// except for some common ISO-8859 encodings that are not detected by
-// Teragram but might be in the future.
-//
-// This file also includes functions that do mappings among
-// Language/Encoding enums, language/encoding string names (typically
-// the output from Language Encoding identifier), and language codes
-// (iso 639), and two-letter country codes (iso 3166)
-//
-// NOTE: Both Language and Encoding enums should always start from
-// zero value. This assumption has been made and used.
-
-#ifndef  OMAHA_BASE_LANG_ENC_H_
-#define  OMAHA_BASE_LANG_ENC_H_
-
-#include <windows.h>
-
-// some of the popular encoding aliases
-#define LATIN1     ISO_8859_1
-#define LATIN2     ISO_8859_2
-#define LATIN3     ISO_8859_3
-#define LATIN4     ISO_8859_4
-#define CYRILLIC   ISO_8859_5
-#define ARABIC_ENCODING  ISO_8859_6     // avoiding the same name as language
-#define GREEK_ENCODING   ISO_8859_7     // avoiding the same name as language
-#define HEBREW_ENCODING  ISO_8859_8     // avoiding the same name as language
-#define LATIN5     ISO_8859_9
-#define LATIN6     ISO_8859_10
-#define KOREAN_HANGUL  KOREAN_EUC_KR
-
-// NOTE: Only add new languages to the end of this list (but before
-// NUM_LANGUAGES).
-enum Language {
-  ENGLISH = 0,  /* 0 */
-  DANISH,       /* 1 */
-  DUTCH,        /* 2 */
-  FINNISH,      /* 3 */
-  FRENCH,       /* 4 */
-  GERMAN,       /* 5 */
-  HEBREW,       /* 6 */
-  ITALIAN,      /* 7 */
-  JAPANESE,     /* 8 */
-  KOREAN,       /* 9 */
-  NORWEGIAN,    /* 10 */
-  POLISH,       /* 11 */
-  PORTUGUESE,   /* 12 */
-  RUSSIAN,      /* 13 */
-  SPANISH,      /* 14 */
-  SWEDISH,      /* 15 */
-  CHINESE,      /* 16 */
-  CZECH,        /* 17 */
-  GREEK,        /* 18 */
-  ICELANDIC,    /* 19 */
-  LATVIAN,      /* 20 */
-  LITHUANIAN,   /* 21 */
-  ROMANIAN,     /* 22 */
-  HUNGARIAN,    /* 23 */
-  ESTONIAN,     /* 24 */
-  TG_UNKNOWN_LANGUAGE,  /* 25 */
-  UNKNOWN_LANGUAGE,     /* 26 */
-  BULGARIAN,    /* 27 */
-  CROATIAN,     /* 28 */
-  SERBIAN,      /* 29 */
-  IRISH,        /* 30 */
-  GALICIAN,     /* 31 */
-  TAGALOG,      /* 32 */
-  TURKISH,      /* 33 */
-  UKRAINIAN,    /* 34 */
-  HINDI,        /* 35 */
-  MACEDONIAN,   /* 36 */
-  BENGALI,      /* 37 */
-  INDONESIAN,   /* 38 */
-  LATIN,        /* 39 */
-  MALAY,        /* 40 */
-  MALAYALAM,    /* 41 */
-  WELSH,        /* 42 */
-  NEPALI,       /* 43 */
-  TELUGU,       /* 44 */
-  ALBANIAN,     /* 45 */
-  TAMIL,        /* 46 */
-  BELARUSIAN,   /* 47 */
-  JAVANESE,     /* 48 */
-  OCCITAN,      /* 49 */
-  URDU,         /* 50 */
-  BIHARI,       /* 51 */
-  GUJARATI,     /* 52 */
-  THAI,         /* 53 */
-  ARABIC,       /* 54 */
-  CATALAN,      /* 55 */
-  ESPERANTO,    /* 56 */
-  BASQUE,       /* 57 */
-  INTERLINGUA,  /* 58 */
-  KANNADA,      /* 59 */
-  PUNJABI,      /* 60 */
-  SCOTS_GAELIC, /* 61 */
-  SWAHILI,      /* 62 */
-  SLOVENIAN,    /* 63 */
-  MARATHI,      /* 64 */
-  MALTESE,      /* 65 */
-  VIETNAMESE,   /* 66 */
-  FRISIAN,      /* 67 */
-  SLOVAK,       /* 68 */
-  CHINESE_T,    /* 69 */      // This is added to solve the problem of
-                              // distinguishing Traditional and Simplified
-                              // Chinese when the encoding is UTF8.
-  FAROESE,      /* 70 */
-  SUNDANESE,    /* 71 */
-  UZBEK,        /* 72 */
-  AMHARIC,      /* 73 */
-  AZERBAIJANI,  /* 74 */
-  GEORGIAN,     /* 75 */
-  TIGRINYA,     /* 76 */
-  PERSIAN,      /* 77 */
-  BOSNIAN,      /* 78 */
-  SINHALESE,    /* 79 */
-  NORWEGIAN_N,  /* 80 */
-  PORTUGUESE_P, /* 81 */
-  PORTUGUESE_B, /* 82 */
-  XHOSA,        /* 83 */
-  ZULU,         /* 84 */
-  GUARANI,      /* 85 */
-  SESOTHO,      /* 86 */
-  TURKMEN,      /* 87 */
-  KYRGYZ,       /* 88 */
-  BRETON,       /* 89 */
-  TWI,          /* 90 */
-  YIDDISH,      /* 91 */
-  ORIYA,        /* 92 */
-  SERBO_CROATIAN,       /* 93 */
-  SOMALI,       /* 94 */
-  UIGHUR,       /* 95 */
-  KURDISH,      /* 96 */
-  MONGOLIAN,    /* 97 */
-  ARMENIAN,     /* 98 */
-  LAOTHIAN,     /* 99 */
-  SINDHI,       /* 100! */
-  RHAETO_ROMANCE,  /* 101 */
-  CHINESE_JAPANESE_KOREAN,  /* 103 */  // Not really a language
-  PSEUDOTRANSLATION,  /* 104 */  // Not really a language
-  NUM_LANGUAGES,              // Always keep this at the end. It is not a
-                              // valid Language enum, it is only used to
-                              // indicate the total number of Languages.
-};
-
-
-// Language codes for those languages we support, used to map to IDs from
-// the Language enumeration.  We could have used the Rfc1766ToLcid from the
-// Win32 system's mlang.dll to map these to LCIDs, but a) we don't want to
-// have to load mlang.dll and b) we are using our own language IDs.
-const TCHAR* const kLangCodeChinesePrc = _T("zh_cn");
-const TCHAR* const kLangCodeChineseTaiwan = _T("zh_tw");
-const TCHAR* const kLangCodeCjk = _T("cjk");
-const TCHAR* const kLangCodeDutch = _T("nl");
-const TCHAR* const kLangCodeEnglish = _T("en");
-const TCHAR* const kLangCodeFrench = _T("fr");
-const TCHAR* const kLangCodeGerman = _T("de");
-const TCHAR* const kLangCodeItalian = _T("it");
-const TCHAR* const kLangCodeJapanese = _T("ja");
-const TCHAR* const kLangCodeKorean = _T("ko");
-const TCHAR* const kLangCodePseudo = _T("x");
-const TCHAR* const kLangCodeSpanish = _T("es");
-
-
-// Maps language codes to languages.  Terminated by a { NULL, UNKNOWN_LANGUAGE }
-// item.
-struct CodeToLanguage {
-  const TCHAR* code;
-  Language language;
-};
-
-SELECTANY CodeToLanguage codes_to_languages[] = {
-  { kLangCodeChinesePrc, CHINESE },
-  { kLangCodeChineseTaiwan, CHINESE_T },
-  { kLangCodeCjk, CHINESE_JAPANESE_KOREAN },
-  { kLangCodeDutch, DUTCH },
-  { kLangCodeEnglish, ENGLISH },
-  { kLangCodeFrench, FRENCH },
-  { kLangCodeGerman, GERMAN },
-  { kLangCodeItalian, ITALIAN },
-  { kLangCodeJapanese, JAPANESE },
-  { kLangCodeKorean, KOREAN },
-  { kLangCodePseudo, PSEUDOTRANSLATION },
-  { kLangCodeSpanish, SPANISH },
-  { NULL, UNKNOWN_LANGUAGE }
-};
-
-
-
-// Macro to wrap the notion of "unknown language".
-#define IS_LANGUAGE_UNKNOWN(l)  \
-  ((l) == TG_UNKNOWN_LANGUAGE || (l) == UNKNOWN_LANGUAGE)
-
-// NOTE: Only add new encodings to the end of this list (but before
-// NUM_ENCODINGS).
-// NOTE: If you add an encoding here, you must also modify basistech_encoding()
-// and google2/com/google/i18n/Encoding.java
-enum Encoding {
-  ISO_8859_1 = 0,       // 0: Teragram ASCII
-  ISO_8859_2,           // 1: Teragram Latin2
-  ISO_8859_3,           // 2: in BasisTech but not in Teragram
-  ISO_8859_4,           // 3: Teragram Latin4
-  ISO_8859_5,           // 4: Teragram ISO-8859-5
-  ISO_8859_6,           // 5: Teragram Arabic
-  ISO_8859_7,           // 6: Teragram Greek
-  ISO_8859_8,           // 7: Teragram Hebrew
-  ISO_8859_9,           // 8: in BasisTech but not in Teragram
-  ISO_8859_10,          // 9: in BasisTech but not in Teragram
-  JAPANESE_EUC_JP,      // 10: Teragram EUC_JP
-  JAPANESE_SHIFT_JIS,   // 11: Teragram SJS
-  JAPANESE_JIS,         // 12: Teragram JIS
-  CHINESE_BIG5,         // 13: Teragram BIG5
-  CHINESE_GB,           // 14: Teragram GB
-  CHINESE_EUC_CN,       // 15: Teragram EUC-CN
-  KOREAN_EUC_KR,        // 16: Teragram KSC
-  UNICODE_ENCODING,     // 17: Teragram Unicode, changed to UNICODE_ENCODING
-                        //     from UNICODE, which is predefined by WINDOW
-  CHINESE_EUC_DEC,      // 18: Teragram EUC
-  CHINESE_CNS,          // 19: Teragram CNS
-  CHINESE_BIG5_CP950,   // 20: Teragram BIG5_CP950
-  JAPANESE_CP932,       // 21: Teragram CP932
-  UTF8,                 // 22
-  UNKNOWN_ENCODING,     // 23
-  ASCII_7BIT,           // 24: ISO_8859_1 with all characters <= 127.
-                        //     Should be present only in the crawler
-                        //     and in the repository,
-                        //     *never* as a result of Document::encoding().
-  RUSSIAN_KOI8_R,       // 25: Teragram KOI8R
-  RUSSIAN_CP1251,       // 26: Teragram CP1251
-
-  //----------------------------------------------------------
-  // These are _not_ output from teragram. Instead, they are as
-  // detected in the headers of usenet articles.
-  MSFT_CP1252,          // 27: CP1252 aka MSFT euro ascii
-  RUSSIAN_KOI8_RU,      // 28: CP21866 aka KOI8_RU, used for Ukrainian
-  MSFT_CP1250,          // 29: CP1250 aka MSFT eastern european
-  ISO_8859_15,          // 30: aka ISO_8859_0 aka ISO_8859_1 euroized
-  //----------------------------------------------------------
-
-  //----------------------------------------------------------
-  // These are in BasisTech but not in Teragram. They are
-  // needed for new interface languages. Now detected by
-  // research langid
-  MSFT_CP1254,          // 31: used for Turkish
-  MSFT_CP1257,          // 32: used in Baltic countries
-  //----------------------------------------------------------
-
-  //----------------------------------------------------------
-  //----------------------------------------------------------
-  // New encodings detected by Teragram
-  ISO_8859_11,          // 33: aka TIS-620, used for Thai
-  MSFT_CP874,           // 34: used for Thai
-  MSFT_CP1256,          // 35: used for Arabic
-
-  //----------------------------------------------------------
-  // Detected as ISO_8859_8 by Teragram, but can be found in META tags
-  MSFT_CP1255,          // 36: Logical Hebrew Microsoft
-  ISO_8859_8_I,         // 37: Iso Hebrew Logical
-  HEBREW_VISUAL,        // 38: Iso Hebrew Visual
-  //----------------------------------------------------------
-
-  //----------------------------------------------------------
-  // Detected by research langid
-  CZECH_CP852,          // 39
-  CZECH_CSN_369103,     // 40: aka ISO_IR_139 aka KOI8_CS
-  MSFT_CP1253,          // 41: used for Greek
-  RUSSIAN_CP866,        // 42
-  //----------------------------------------------------------
-  HZ_ENCODING,
-  ISO2022_CN,
-  ISO2022_KR,
-
-  NUM_ENCODINGS              // Always keep this at the end. It is not a
-                             // valid Encoding enum, it is only used to
-                             // indicate the total number of Encodings.
-};
-
-const int kNumLanguages = NUM_LANGUAGES;
-const int kNumEncodings = NUM_ENCODINGS;
-
-#endif  // OMAHA_BASE_LANG_ENC_H_
diff --git a/base/localization.cc b/base/localization.cc
deleted file mode 100644
index e982fb1..0000000
--- a/base/localization.cc
+++ /dev/null
@@ -1,336 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// localization.cpp
-//
-// Localization functions for date-time, strings, locales, and numbers
-
-#include "omaha/base/localization.h"
-
-#include <windows.h>  // SetThreadLocale
-#include <mlang.h>
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/string.h"
-#include "omaha/base/time.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-// The maximum length for a date
-#define kDateLengthMax 200
-
-// The maximum length for chracter seperators
-#define kDecimalSeparatorMaxLen 5
-
-// Allow the unittest to override.
-static LCID lcid_override = MAKELCID(-1, -1);
-
-void SetLcidOverride(const LCID & lcid_new) {
-  lcid_override = lcid_new;
-}
-
-// We should call this, it allows for our override
-LCID GetLiveLcid() {
-  if (lcid_override != MAKELCID(-1, -1))
-    return lcid_override;
-
-  return GetUserDefaultLCID();
-}
-
-
-CString ShowDateInternal(const time64 & t, const LCID & lcid,
-                         // Either type needs to be 0 or format needs to be
-                         // NULL; both cannot be set simultaneously:
-                         const DWORD type, const TCHAR * format ) {
-  SYSTEMTIME time = Time64ToLocalTime(t);
-  TCHAR buf[kDateLengthMax] = {_T('\0')};
-  int num = ::GetDateFormat(lcid, type, &time, format, buf, kDateLengthMax);
-  ASSERT(num > 0, (_T("[localization::ShowDateInternal] - GetDateFormat ")
-                   _T("failed")));
-
-  return CString(buf);
-}
-
-CString ShowDateForLocale(const time64 & t, const LCID & lcid) {
-  return ShowDateInternal(t, lcid, DATE_SHORTDATE, NULL);
-}
-
-CString ShowFormattedDateForLocale(const time64 & t, const LCID & lcid,
-                                   const TCHAR * format) {
-  return ShowDateInternal(t, lcid, 0, format);
-}
-
-
-CString ShowTimeInternal(const time64 & t, const LCID & lcid,
-                         // Either type needs to be 0 or format needs to be
-                         // NULL; both cannot be set simultaneously:
-                         const DWORD type, const TCHAR * format) {
-  ASSERT(IsValidTime(t), (_T("[localization::ShowTimeInternal - Invalid ")
-                          _T("time %llu"), t));
-
-  SYSTEMTIME time = Time64ToLocalTime(t);
-  TCHAR buf[kDateLengthMax] = {_T('\0')};
-  int num = ::GetTimeFormat(lcid, type, &time, format, buf, kDateLengthMax);
-  ASSERT(num > 0, (_T("[localization::ShowTimeInternal - GetTimeFormat ")
-                   _T("failed")));
-
-  return CString(buf);
-}
-
-CString ShowTimeForLocale(const time64 & t, const LCID & lcid) {
-  return ShowTimeInternal(t, lcid, TIME_NOSECONDS, NULL);
-}
-
-CString ShowFormattedTimeForLocale(const time64 & t, const LCID & lcid,
-                                   const TCHAR * format) {
-  return ShowTimeInternal(t, lcid, 0, format);
-}
-
-// Show the long date and time [ie - Tuesday, March 20, 2004 5:15pm]
-CString ShowDateTimeForLocale(const time64 & t, const LCID & lcid) {
-  return ShowDateForLocale(t, lcid) + _T(" ") + ShowTimeForLocale(t, lcid);
-}
-
-// Get the long data and time in a (US English) format for logging
-CString ShowDateTimeForLogging(const time64 & t) {
-  if (t == 0) {
-     return CString();
-  }
-  const LCID lcid = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US);
-  return ShowDateTimeForLocale(t, lcid);
-}
-
-// Convert a number in string format to formatted string
-static CString Show(const CString & in, const int decimal_places) {
-  NUMBERFMT nf = {0};
-  TCHAR decimal_seperator[8] = {_T('\0')};
-  TCHAR thousands_seperator[8] = {_T('\0')};
-  GetNumberFormatForLCID(GetLiveLcid(), &nf,
-                         decimal_seperator, arraysize(decimal_seperator),
-                         thousands_seperator, arraysize(thousands_seperator));
-  nf.NumDigits = decimal_places;
-
-  TCHAR buf[kDateLengthMax] = {_T('\0')};
-  int num = GetNumberFormat(GetLiveLcid(),  // locale (current user locale)
-    0,                                      // options
-    in,                                     // input string (see MSDN for chars)
-    &nf,                                    // formatting information
-    buf,                                    // formatted string buffer
-    kDateLengthMax);                        // size of buffer
-
-  ASSERT(num > 0, (_T("GetNumberFormat failed: %s?"), in.GetString()));
-
-  return CString(buf);
-}
-
-// If we have a formatted number containing a decimal, and we want it to be
-// an int
-CString TrimDecimal(const CString & in) {
-  // Get the decimal seperator -- cache it as this is very slow
-  static LCID last_user_default_lcid = MAKELCID(-1, -1);
-  static TCHAR buf[kDecimalSeparatorMaxLen] = {_T('\0')};
-
-  LCID current_lcid = GetLiveLcid();
-  if (last_user_default_lcid != current_lcid) {
-    int num = GetLocaleInfo(GetLiveLcid(),
-                            LOCALE_SDECIMAL,
-                            buf,
-                            kDecimalSeparatorMaxLen);
-    ASSERT(num > 0, (L"GetLocaleInfo(.., LOCALE_SDECIMAL, ..) failed?"));
-    last_user_default_lcid = current_lcid;
-  }
-
-  CString sep(buf);
-
-  // Trim it if necessary
-  int pos = String_FindString(in, sep);
-  if (pos != -1)
-    return in.Left(pos);
-
-  return in;
-}
-
-// Number Functions
-// Changes the number into a user viewable format for the current locale
-
-// TODO(omaha): Rename these functions into ShowNumberForLocale.
-CString Show(const int i) {
-  return TrimDecimal(Show(itostr(i), 0));
-}
-
-CString Show(const uint32 u) {
-  return TrimDecimal(Show(itostr(u), 0));
-}
-
-CString Show(const double & d, const int decimal_places) {
-  return Show(String_DoubleToString(d, decimal_places), decimal_places);
-}
-
-HRESULT SetLocaleToRfc1766(const TCHAR * rfc1766_locale) {
-  ASSERT1(rfc1766_locale != NULL);
-
-  // Convert the RFC 1766 locale (eg, "fr-CA" for Canadian French to a
-  // Windows LCID (eg, 0x0c0c for Canadian French)
-  CComPtr<IMultiLanguage2> pIM;
-  RET_IF_FAILED(pIM.CoCreateInstance(__uuidof(CMultiLanguage)));
-
-  LCID lcid = 0;
-  CComBSTR rfc1766_locale_bstr(rfc1766_locale);
-  RET_IF_FAILED(pIM->GetLcidFromRfc1766(&lcid, (BSTR)rfc1766_locale_bstr));
-
-  return SetLocaleToLCID(lcid);
-}
-
-HRESULT SetLocaleToLCID(const LCID & lcid) {
-  // Initialize the locales
-  //   (in an attempt to cut down on our memory footprint, don't call
-  //    the libc version of setlocale)
-  if (!::SetThreadLocale(lcid)) {
-    UTIL_LOG(LEVEL_ERROR, (_T("Unable to SetThreadLocale to lcid 0x%x"),
-                           lcid));
-    return E_FAIL;
-  }
-
-  return S_OK;
-}
-
-HRESULT GetLocaleAsLCID(LCID * lcid) {
-  ASSERT1(lcid != NULL);
-
-  *lcid = GetThreadLocale();
-  return S_OK;
-}
-
-HRESULT GetLocaleAsRfc1766(CString * rfc1766_locale) {
-  ASSERT1(rfc1766_locale != NULL);
-
-  LCID lcid = 0;
-  HRESULT hr = GetLocaleAsLCID(&lcid);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CComPtr<IMultiLanguage2> pIM;
-  RET_IF_FAILED(pIM.CoCreateInstance(__uuidof(CMultiLanguage)));
-
-  CComBSTR bstr;
-  RET_IF_FAILED(pIM->GetRfc1766FromLcid(lcid, &bstr));
-
-  *rfc1766_locale = bstr;
-  return hr;
-}
-
-HRESULT GetNumberFormatForLCID(const LCID & lcid, NUMBERFMT * fmt,
-                               TCHAR * fmt_decimal_buf,
-                               size_t decimal_buf_len,  // including null char
-                               TCHAR * fmt_thousand_buf,
-                               size_t thousand_buf_len) {  // including null
-  ASSERT1(fmt);
-
-  TCHAR buf[64] = {_T('\0')};
-  size_t buf_len = arraysize(buf);
-
-  HRESULT hr = S_OK;
-  int retval = GetLocaleInfo(lcid, LOCALE_IDIGITS, buf, buf_len);
-
-  if (!retval) {
-    CORE_LOG(LEVEL_WARNING, (_T("[localization::GetNumberFormatForLCID - ")
-                             _T("Failed to load LOCALE_IDIGITS]")));
-    hr = E_FAIL;
-  } else {
-    fmt->NumDigits = String_StringToInt(buf);
-  }
-
-  retval = GetLocaleInfo(lcid, LOCALE_ILZERO, buf, buf_len);
-  if (!retval) {
-    CORE_LOG(LEVEL_WARNING, (_T("[App::Impl::InitializeLocaleSettings - ")
-                             _T("Failed to load LOCALE_ILZERO]")));
-    hr = E_FAIL;
-  } else {
-    fmt->LeadingZero = String_StringToInt(buf);
-  }
-
-  retval = GetLocaleInfo(lcid, LOCALE_INEGNUMBER, buf, buf_len);
-  if (!retval) {
-    CORE_LOG(LEVEL_WARNING, (_T("[App::Impl::InitializeLocaleSettings - ")
-                             _T("Failed to load LOCALE_INEGNUMBER]")));
-    hr = E_FAIL;
-  } else {
-    fmt->NegativeOrder = String_StringToInt(buf);
-  }
-
-  retval = GetLocaleInfo(lcid, LOCALE_SGROUPING, buf, buf_len);
-  if (!retval) {
-    CORE_LOG(LEVEL_WARNING, (_T("[App::Impl::InitializeLocaleSettings - ")
-                             _T("Failed to load LOCALE_SGROUPING]")));
-    hr = E_FAIL;
-  } else {
-    // A string terminated in ';0' is equivalent to the substring without
-    // the ';0', so just truncate the ';0' from the string
-    int semicolon_idx = String_ReverseFindChar(buf, _T(';'));
-    if (retval > semicolon_idx && buf[semicolon_idx + 1] == _T('0')) {
-      buf[semicolon_idx] = _T('\0');
-    }
-
-    if (String_FindChar(buf, _T(';')) != -1) {
-      // NUMBERFMT only allows values 0-9 or 32 for number grouping.  If
-      // this locale has variable-length grouping rules (as indicated by
-      // the presence of ';[1-9]'), pass in the only variable-length
-      // grouping rule NUMBERFMT understands: 32.  Note that '3;0' is
-      // considered a fixed-length grouping rule and handled above.
-      // This is a HACK.
-      fmt->Grouping = 32;
-    } else {
-      fmt->Grouping = String_StringToInt(buf);
-    }
-  }
-
-  // GetLocaleInfo doesn't write more than 4 chars for this field (per MSDN)
-  retval = GetLocaleInfo(lcid, LOCALE_SDECIMAL, fmt_decimal_buf,
-                         decimal_buf_len);
-  if (!retval) {
-    CORE_LOG(LEVEL_WARNING, (_T("[App::Impl::InitializeLocaleSettings - ")
-                             _T("Failed to load LOCALE_SDECIMAL]")));
-    hr = E_FAIL;
-  } else {
-    fmt->lpDecimalSep = fmt_decimal_buf;
-  }
-
-  // GetLocaleInfo doesn't write more than 4 chars for this field (per MSDN)
-  retval = GetLocaleInfo(lcid, LOCALE_STHOUSAND, fmt_thousand_buf,
-                         thousand_buf_len);
-  if (!retval) {
-    CORE_LOG(LEVEL_WARNING, (_T("[App::Impl::InitializeLocaleSettings - ")
-                             _T("Failed to load LOCALE_STHOUSAND]")));
-    hr = E_FAIL;
-  } else {
-    fmt->lpThousandSep = fmt_thousand_buf;
-  }
-
-  retval = GetLocaleInfo(lcid, LOCALE_INEGNUMBER, buf, buf_len);
-  if (!retval) {
-    CORE_LOG(LEVEL_WARNING, (_T("[App::Impl::InitializeLocaleSettings - ")
-                             _T("Failed to load LOCALE_INEGNUMBER]")));
-    hr = E_FAIL;
-  } else {
-    fmt->NegativeOrder = String_StringToInt(buf);
-  }
-
-  return hr;
-}
-
-}  // namespace omaha
-
diff --git a/base/localization.h b/base/localization.h
deleted file mode 100644
index 87c8b14..0000000
--- a/base/localization.h
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-//
-// localization.h
-//
-// Localization functions for date-time, strings, locales, and numbers
-
-#ifndef OMAHA_BASE_LOCALIZATION_H_
-#define OMAHA_BASE_LOCALIZATION_H_
-
-#include <atlstr.h>
-#include "base/basictypes.h"
-#include "omaha/base/time.h"
-
-namespace omaha {
-
-// Allows us to override LCIDs for unittests
-void SetLcidOverride(const LCID & lcid_new);
-
-
-//
-// Date-time Functions
-//
-
-// Show the time in the specified locale's default format.
-// If you want to use the user's default format, use LOCALE_USER_DEFAULT
-// for the locale [eg - "5:15:34 pm" is the US default]
-CString ShowDateForLocale(const time64 & t, const LCID & lcid);
-
-// Show the time in the specified format for the specified locale.
-// If you want to use the user's default format, use LOCALE_USER_DEFAULT
-// for the locale [eg - "5:15:34 pm" is the US default]
-CString ShowFormattedDateForLocale(const time64 & t, const LCID & lcid,
-                                   const TCHAR * format);
-
-
-// Show the time in the specified locale's default format.
-// If you want to use the user's default format, use LOCALE_USER_DEFAULT
-// for the locale [eg - "5:15:34 pm" is the US default]
-CString ShowTimeForLocale(const time64 & t, const LCID & lcid);
-
-// Show the time in the specified format for the specified locale.
-// If you want to use the user's default format, use LOCALE_USER_DEFAULT
-// for the locale [eg - "5:15:34 pm" is the US default]
-CString ShowFormattedTimeForLocale(const time64 & t, const LCID & lcid,
-                                   const TCHAR * format);
-
-// Show the long date and time [ie - Tuesday, March 20, 2004 5:15pm]
-CString ShowDateTimeForLocale(const time64 & t, const LCID & lcid);
-
-// Get the long data and time in a (US English) format for logging
-CString ShowDateTimeForLogging(const time64 & t);
-
-//
-// Number Functions
-//
-
-// Changes the number into a user viewable format for the current locale
-CString Show(const int i);
-CString Show(const uint32 u);
-CString Show(const double & d, const int decimal_places);
-
-
-//
-// Locale Name / LCID / RFC 1766 conversions
-//
-HRESULT SetLocaleToRfc1766(const TCHAR * rfc1766_locale);
-HRESULT SetLocaleToLCID(const LCID & lcid);
-
-HRESULT GetLocaleAsLCID(LCID * lcid);
-HRESULT GetLocaleAsRfc1766(CString * rfc1766_locale);
-
-HRESULT GetNumberFormatForLCID(const LCID & lcid, NUMBERFMT * fmt,
-                               TCHAR * fmt_decimal_buf,
-                               size_t decimal_buf_len,
-                               TCHAR * fmt_thousand_buf,
-                               size_t thousand_buf_len);
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_LOCALIZATION_H_
diff --git a/base/localization_unittest.cc b/base/localization_unittest.cc
deleted file mode 100644
index 253c279..0000000
--- a/base/localization_unittest.cc
+++ /dev/null
@@ -1,158 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// localization_unittest.cpp
-//
-// Unit test functions for Localization
-
-#include "omaha/base/localization.h"
-#include "omaha/base/string.h"
-#include "omaha/base/time.h"
-#include "omaha/testing/unit_test.h"
-
-using testing::Message;
-
-namespace omaha {
-
-// Test out the time display functions
-void LocalizationTimeTest() {
-  CString time_str;
-
-  // Lets process this a bit to give ourselves a known time.
-  SYSTEMTIME temp_time;
-  temp_time.wYear = 2004;
-  temp_time.wMonth = 4;
-  temp_time.wDayOfWeek = 1;
-  temp_time.wDay = 19;
-  temp_time.wHour = 19;
-  temp_time.wMinute = 18;
-  temp_time.wSecond = 17;
-  temp_time.wMilliseconds = 16;
-
-  time64 override_time = SystemTimeToTime64(&temp_time);
-
-  // Useful when debugging to confirm that this worked
-  SYSTEMTIME confirm = Time64ToSystemTime(override_time);
-
-  // the need to check two different times below is because:
-
-  // FileTimeToLocalFileTime uses the current settings for the time
-  // zone and daylight saving time. Therefore, if it is daylight
-  // saving time, this function will take daylight saving time into
-  // account, even if the time you are converting is in standard
-  // time.
-  // TODO(omaha): we may want to fix this.
-
-  // Show just the time [ie -12:19pm]
-  time_str = ShowTimeForLocale(override_time, 1033 /* US english */);
-  ASSERT_TRUE(time_str == _T("12:18 PM") || time_str == _T("11:18 AM"))
-      << _T("Returned time string was ") << time_str.GetString();
-
-  // Show just the time [ie - 12:19:18pm]
-  time_str = ShowFormattedTimeForLocale(override_time, 1033,
-                                        _T("hh:mm:ss tt"));
-  ASSERT_TRUE(time_str == _T("12:18:17 PM") || time_str == _T("11:18:17 AM"))
-      << _T("Returned time string was ") << time_str.GetString();
-
-  // Try it out with a some different values to test out single digit
-  // minutes and such
-  temp_time.wHour = 15;
-  temp_time.wMinute = 4;
-  temp_time.wSecond = 3;
-  temp_time.wMilliseconds = 2;
-  override_time = SystemTimeToTime64(&temp_time);
-
-  time_str = ShowTimeForLocale(override_time, 1033);
-  ASSERT_TRUE(time_str == _T("8:04 AM") || time_str == _T("7:04 AM"))
-      << _T("Returned time string was ") << time_str.GetString();
-
-  time_str = ShowFormattedTimeForLocale(override_time, 1033,
-                                        _T("hh:mm:ss tt"));
-  ASSERT_TRUE(time_str == _T("08:04:03 AM") || time_str == _T("07:04:03 AM"))
-      << _T("Returned time string was ") << time_str.GetString();
-
-
-  //
-  // Check the date functionality
-  //
-
-  temp_time.wYear = 2004;
-  temp_time.wMonth = 4;
-  temp_time.wDayOfWeek = 1;
-  temp_time.wDay = 19;
-
-  // Show the short date
-  time_str = ShowDateForLocale(override_time, 1033);
-//  CHKM(time_str == _T("Monday, April 19, 2004"),
-  ASSERT_STREQ(time_str, _T("4/19/2004"));
-
-  // Show the customized date
-  time_str = ShowFormattedDateForLocale(override_time, 1033,
-                                        _T("MMM d, yyyy"));
-  ASSERT_STREQ(time_str, _T("Apr 19, 2004"));
-
-  // Try it out with a some different values to test out single dates and such
-  temp_time.wDay = 1;
-  override_time = SystemTimeToTime64(&temp_time);
-
-  time_str = ShowFormattedDateForLocale(override_time, 1033,
-                                        _T("ddd, MMM dd"));
-  ASSERT_STREQ(time_str, _T("Thu, Apr 01"));
-
-  time_str = ShowFormattedDateForLocale(override_time, 1033, _T("MM/dd/yyyy"));
-  ASSERT_STREQ(time_str, _T("04/01/2004"));
-}
-
-// Test out the numbers and display functions
-void LocalizationNumberTest() {
-  // Make sure we are using the normal american version
-  SetLcidOverride(1033);  // the codepage for american english
-
-  // Try some basics
-  ASSERT_STREQ(Show(1), _T("1"));
-  ASSERT_STREQ(Show(2), _T("2"));
-
-  // Try some extremes
-  ASSERT_STREQ(Show(0), _T("0"));
-  ASSERT_STREQ(Show(kint32max), _T("2,147,483,647"));
-  ASSERT_STREQ(Show(-kint32max), _T("-2,147,483,647"));
-  ASSERT_STREQ(Show(kuint32max), _T("4,294,967,295"));
-
-  // Try some doubles
-  ASSERT_STREQ(Show(0.3, 0), _T("0"));
-  ASSERT_STREQ(Show(0.3, 1), _T("0.3"));
-  ASSERT_STREQ(Show(0.3, 2), _T("0.30"));
-  ASSERT_STREQ(Show(0.3, 5), _T("0.30000"));
-
-  // Try some with interesting rounding
-  ASSERT_STREQ(Show(0.159, 0), _T("0"));
-  ASSERT_STREQ(Show(0.159, 1), _T("0.1"));
-  ASSERT_STREQ(Show(0.159, 2), _T("0.15"));
-  ASSERT_STREQ(Show(0.159, 5), _T("0.15900"));
-
-  // Try a nice whole number
-  ASSERT_STREQ(Show(12.0, 0), _T("12"));
-  ASSERT_STREQ(Show(12.0, 1), _T("12.0"));
-  ASSERT_STREQ(Show(12.0, 2), _T("12.00"));
-  ASSERT_STREQ(Show(12.0, 5), _T("12.00000"));
-}
-
-TEST(LocalizationTest, Localization) {
-  LocalizationTimeTest();
-  LocalizationNumberTest();
-}
-
-}  // namespace omaha
-
diff --git a/base/lock_ptr.h b/base/lock_ptr.h
deleted file mode 100644
index 74c424a..0000000
--- a/base/lock_ptr.h
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// lock_ptr.h
-//
-// A smart pointer to manage synchronized access to a shared resource.
-//
-// LockPtr provides a simple and concise syntax for accessing a
-// shared resource. The LockPtr is a smart pointer and provides
-// pointer operators -> and *. LockPtr does not have copy semantics and it is
-// not intended to be stored in containers. Instead, instances of LockPtr are
-// usually unamed or short-lived named variables.
-//
-// LockPtr uses an external lock, it acquires the lock in the constructor, and
-// it guarantees the lock is released in the destructor.
-//
-// Since different types of locks have different method names, such as
-// Enter/Exit or Lock/Unlock, etc, LockPtr uses an external customizable policy
-// to bind to different operations. The external policy is a set of template
-// functions that can be specialized for different types of locks, if needed.
-// Think of this policy as an adapter between the lock type and the LockPtr.
-//
-// Usage: let's assume that we have the type below:
-//
-// class X {
-//  public:
-//    X() : i_(0) {}
-//    void f() {}
-//
-//  private:
-//    int i_;
-//
-//    friend int LockPtrTest(int, int);
-// };
-//
-// We have an instance of this type and an external lock instance to serialize
-// the access to the X instance.
-//
-// Using LockPtr, the code is:
-//
-//    X x;
-//    LLock local_lock;
-//
-//    LockPtr<X>(x, local_lock)->f();
-//
-// For more example, please see the unit test of the module.
-
-
-
-#ifndef OMAHA_COMMON_LOCK_PTR_H_
-#define OMAHA_COMMON_LOCK_PTR_H_
-
-#include "omaha/base/debug.h"
-
-namespace omaha {
-
-template <typename T>
-class LockPtr {
- public:
-  template <typename U>
-  LockPtr(T& obj, U& lock)
-      : pobj_(&obj),
-        plock_(&lock),
-        punlock_method_(&LockPtr::Unlock<U>) {
-    AcquireLock(lock);
-  }
-
-  ~LockPtr() {
-    ASSERT1(punlock_method_);
-    (this->*punlock_method_)();
-  }
-
-  // Pointer behavior
-  T& operator*() {
-    ASSERT1(pobj_);
-    return *pobj_;
-  }
-
-  T* operator->() {
-    return pobj_;
-  }
-
- private:
-  // template method to restore the type of the lock and to call the
-  // release policy for the lock
-  template <class U>
-  void Unlock() {
-    ASSERT1(plock_);
-    U& lock = *(static_cast<U*>(plock_));
-    ReleaseLock(lock);
-  }
-
-  T* pobj_;       // managed shared object
-  void* plock_;   // type-less lock to control access to pobj_
-
-  void (LockPtr::*punlock_method_)();   // the address of the method to Unlock
-
-  DISALLOW_EVIL_CONSTRUCTORS(LockPtr);
-};
-
-// template functions to define the policy of acquiring and releasing
-// the locks.
-template <class Lock> inline void AcquireLock(Lock& lock) { lock.Lock(); }
-template <class Lock> inline void ReleaseLock(Lock& lock) { lock.Unlock(); }
-
-// specialization of policy for diferent types of locks.
-#include "omaha/base/synchronized.h"
-template <> void inline AcquireLock(CriticalSection& cs) { cs.Enter(); }
-template <> void inline ReleaseLock(CriticalSection& cs) { cs.Exit(); }
-
-// Add more policy specializations below, if needed.
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_LOCK_PTR_H_
-
diff --git a/base/lock_ptr_unittest.cc b/base/lock_ptr_unittest.cc
deleted file mode 100644
index d1cce8b..0000000
--- a/base/lock_ptr_unittest.cc
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// lock_ptr_unittest.cpp
-
-#include "omaha/base/lock_ptr.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-// Test type.
-class X {
- public:
-  X() : i_(0) {}
-  void f() { i_ = 10; }
-
- private:
-  int i_;
-
-  friend class LockTest;
-  FRIEND_TEST(LockTest, X);
-};
-
-// A dummy lock just to test that locking and unlocking methods get called.
-class DummyLock {
- public:
-  DummyLock() : cnt_(0) {}
-
-  void FakeLock() { ++cnt_; }
-  void FakeUnlock() { --cnt_; }
-
- private:
-  int cnt_;
-
-  friend class LockTest;
-  FRIEND_TEST(LockTest, DummyLock);
-};
-
-// Specialization of the policy for the DummyLock.
-template<> void AcquireLock(DummyLock& lock) { lock.FakeLock(); }
-template<> void ReleaseLock(DummyLock& lock) { lock.FakeUnlock(); }
-
-// Empty test fixture.
-class LockTest : public testing::Test {};
-
-TEST_F(LockTest, X) {
-  // Create a few synchronization objects.
-  CriticalSection cs_lock;
-  LLock local_lock;
-  GLock global_lock;
-  ASSERT_TRUE(global_lock.Initialize(_T("test")));
-
-  // The instance to lock.
-  X x;
-
-  // Lock the instance and call a method.
-  LockPtr<X>(x, local_lock)->f();
-  ASSERT_EQ((*LockPtr<X>(x, cs_lock)).i_, 10);
-
-  // Lock the instance and access a data member.
-  LockPtr<X>(x, cs_lock)->i_ = 0;
-  ASSERT_EQ((*LockPtr<X>(x, cs_lock)).i_, 0);
-
-  // Lock the instance and call a method.
-  LockPtr<X>(x, global_lock)->f();
-  ASSERT_EQ((*LockPtr<X>(x, cs_lock)).i_, 10);
-}
-
-TEST_F(LockTest, DummyLock) {
-  DummyLock dummy_lock;
-  ASSERT_EQ(dummy_lock.cnt_, 0);
-
-  // The instance to lock.
-  X x;
-
-  {
-    LockPtr<X> p(x, dummy_lock);
-    ASSERT_EQ(dummy_lock.cnt_, 1);
-  }
-
-  ASSERT_EQ(dummy_lock.cnt_, 0);
-}
-
-}  // namespace omaha
-
diff --git a/base/logging.cc b/base/logging.cc
deleted file mode 100644
index 9285510..0000000
--- a/base/logging.cc
+++ /dev/null
@@ -1,1369 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Tracing and logging system.
-//
-// The log output goes to "All Users/Application Data/Google/Update/Log/".
-// The log configuration file is under
-// "%Program Files%/C:\Program Files\Google\Common\Update".
-// By default, the logging is on in debug modes and off in opt mode although in
-// opt mode only the OPT_LOG statements write to the log.
-//
-// The log is open to all the users to write to. There is a known vulnerability
-// where a DOS can be created by holding on to the logging mutex.
-//
-// In this module use of ASSERT & REPORT is banned.  This is to prevent any
-// possible recursion issues between logging (logging.h) and
-// asserting/reporting (debug.h).  Both are basement-level systems that need to
-// work when almost nothing else works and interdependencies are best avoided.
-// One unavoidable interdependency is that debugASSERT will send messages to
-// the logger via Logger::OutputMessage - which then broadcasts it to each
-// LogWriter's OutputMessage.  So these methods should be as simple as
-// possible.  (Also, unlike asserting/reporting - this module will not avoid
-// use of the heap, however the code executed from Logger::OutputMessage
-// doesn't use the heap (for all the LogWriters in this file).)
-//
-// TODO(omaha): implement the minidump handling in terms of breakpad.
-//              Log initialization if full of lazy init. Consider doing
-//              eager init of log and its registered log writers when the
-//              log is created and initialized.
-//              Reimplement in terms of smart handles and locks.
-//              Reimplement without dependency on any other compilation unit
-//               that can call assert, verify, or the log itself.
-//              Redo the history logging feature
-
-#include "omaha/base/logging.h"
-
-#include <excpt.h>  // Microsoft specific: structured exceptions.
-#include <shlobj.h>
-#include <shlwapi.h>
-#include <string.h>
-#include <atlpath.h>
-#include <atlsecurity.h>
-#include "base/basictypes.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/const_debug.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/etw_log_writer.h"
-#include "omaha/base/file.h"
-#include "omaha/base/path.h"
-#include "omaha/base/string.h"
-#include "omaha/base/time.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-// enforce ban on ASSERT/REPORT
-#undef ASSERT
-#undef REPORT
-
-#ifdef LOGGING
-
-#define kNumLockRetries (20)
-#define kLockRetryDelayMs (50)
-
-// Circular buffer to log history.
-static wchar_t history_buffer[kMaxHistoryBufferSize];
-
-// Index into the history buffer to begin writing at.
-static int history_buffer_next_idx = 0;
-
-// Indicates whether the history buffer has ever reached its full capacity.
-// Once this boolean is true, if never becomes false.
-static bool history_buffer_full = false;
-
-//
-// Table of category names to categories.
-//
-#define LC_ENTRY(lc_value)  (L#lc_value), (lc_value)
-struct {
-  wchar_t* category_name;
-  LogCategory category;
-} static LogCategoryNames[] = {
-  LC_ENTRY(LC_UTIL),
-  LC_ENTRY(LC_SETUP),
-  LC_ENTRY(LC_SHELL),
-  LC_ENTRY(LC_CORE),
-  LC_ENTRY(LC_JS),
-  LC_ENTRY(LC_PLUGIN),
-  LC_ENTRY(LC_SERVICE),
-  LC_ENTRY(LC_OPT),
-  LC_ENTRY(LC_NET),
-  LC_ENTRY(LC_REPORT),
-};
-
-COMPILE_ASSERT(arraysize(LogCategoryNames) == LC_MAX_CAT - 1,
-               LogCategoryNames_missing_category);
-
-static CString StripBackslashes(const CString& name) {
-  int n = String_FindChar(name, L'\\');
-  if (n == -1) {
-    return name;
-  } else {
-    CString result;
-    for (int i = 0; i < name.GetLength(); ++i) {
-      if (name[i] != L'\\') {
-        result += name[i];
-      }
-    }
-    return result;
-  }
-}
-
-static CString GetProcName() {
-  CString proc_name(app_util::GetAppNameWithoutExtension());
-  CString module_name(app_util::GetCurrentModuleNameWithoutExtension());
-  CString result(proc_name);
-  if (module_name.CompareNoCase(proc_name) != 0) {
-    result += L":";
-    result += module_name;
-  }
-  return result;
-}
-
-// Formats a line prefix with the current time min:sec:milisec if wanted,
-// otherwise just the process:module.
-static void FormatLinePrefix(bool show_time,
-                             const wchar_t* proc_name,
-                             CString& result) {
-  if (show_time) {
-    SYSTEMTIME system_time = {0};
-    GetLocalTime(&system_time);
-    result.Format(L"[%02d/%02d/%02d %02d:%02d:%02d.%03d]",
-                  system_time.wMonth, system_time.wDay, system_time.wYear % 100,
-                  system_time.wHour, system_time.wMinute, system_time.wSecond,
-                  system_time.wMilliseconds);
-  }
-  result.AppendFormat(L"[%s][%u:%u]",
-                      proc_name,
-                      ::GetCurrentProcessId(),
-                      ::GetCurrentThreadId());
-}
-
-static bool g_logging_valid = false;
-static Logging g_logging;
-
-// Singleton factory for the Logging object.
-Logging* GetLogging() {
-  return g_logging_valid ? &g_logging : NULL;
-}
-
-// Force the logging system to be initialized during elaboration of static
-// constructors, while the program is still single-threaded.  This global
-// static object will cause the static logger inside of GetLogging() to be
-// constructed.  However, it might not be the first call to GetLogging() -
-// another static object in another object file might get constructed first,
-// and in its constructor call a logging API.  Just as long as it is done when
-// the system is single threaded.  (Reason: because the Logger object has a
-// LLock object which has a Win32 critical section which needs to be
-// initialized - only once!)
-
-
-Logging::Logging()
-    : logging_initialized_(false),
-      logging_enabled_(true),
-      force_show_time_(false),
-      show_time_(true),
-      log_to_file_(true),
-      log_to_debug_out_(true),
-      append_to_file_(true),
-      logging_shutdown_(false),
-      num_writers_(0),
-      file_log_writer_(NULL),
-      debug_out_writer_(NULL),
-      etw_log_writer_(NULL),
-      is_initializing_(false),
-      log_file_name_(kDefaultLogFileName),
-      config_file_path_(GetConfigurationFilePath()) {
-  g_last_category_check_time = 0;
-  for (int i = 0; i < max_writers; ++i) {
-    writers_[i] = NULL;
-  }
-  proc_name_ = GetProcName();
-  g_logging_valid = true;
-
-  // Read initial settings from the config file.
-  ReadLoggingSettings();
-}
-
-// TODO(omaha): why aren't we using a mutexscope and what if an the code
-// throws? Will the lock be unlocked?
-Logging::~Logging() {
-  // Acquire the lock outside the try/except block so we'll always release it
-  lock_.Lock();
-
-  __try {
-    // prevent further access to the system
-    // necessary because the static destructors happen
-    // in a non-deterministic order
-    logging_shutdown_ = true;
-
-    // Delete all registered LogWriters
-    for (int i = 0; i < num_writers_; ++i) {
-      if (writers_[i]) {
-        delete writers_[i];
-      }
-    }
-
-    logging_initialized_ = false;
-  } __except(SehNoMinidump(GetExceptionCode(),
-                           GetExceptionInformation(),
-                           __FILE__,
-                           __LINE__,
-                           true)) {
-    OutputDebugStringA("Unexpected exception in: " __FUNCTION__ "\r\n");
-    logging_initialized_  = false;
-  }
-
-  g_logging_valid = false;
-  lock_.Unlock();
-}
-
-void Logging::UpdateCatAndLevel(const wchar_t* cat_name, LogCategory cat) {
-  if (cat_name == NULL) {
-    return;
-  }
-  if (cat >= LC_MAX_CAT) {
-    return;
-  }
-  int log_level = kDefaultLogLevel;
-  CString config_file = GetCurrentConfigurationFilePath();
-  if (!config_file.IsEmpty()) {
-    log_level = GetPrivateProfileInt(kConfigSectionLoggingLevel,
-                                     cat_name,
-                                     kDefaultLogLevel,
-                                     config_file);
-  }
-  category_list_[cat].enabled = (log_level != 0);
-  category_list_[cat].log_level = static_cast<LogLevel>(log_level);
-}
-
-void Logging::ReadLoggingSettings() {
-  CString config_file = GetCurrentConfigurationFilePath();
-  if (!config_file.IsEmpty()) {
-    logging_enabled_ = ::GetPrivateProfileInt(
-        kConfigSectionLoggingSettings,
-        kConfigAttrEnableLogging,
-        kDefaultLoggingEnabled,
-        config_file) == 0 ? false : true;
-
-    show_time_ = ::GetPrivateProfileInt(
-        kConfigSectionLoggingSettings,
-        kConfigAttrShowTime,
-        kDefaultShowTime,
-        config_file) == 0 ? false : true;
-
-    log_to_file_ = ::GetPrivateProfileInt(
-        kConfigSectionLoggingSettings,
-        kConfigAttrLogToFile,
-        kDefaultLogToFile,
-        config_file) == 0 ? false : true;
-
-    log_to_debug_out_ = ::GetPrivateProfileInt(
-        kConfigSectionLoggingSettings,
-        kConfigAttrLogToOutputDebug,
-        kDefaultLogToOutputDebug,
-        config_file) == 0 ? false : true;
-
-    append_to_file_ = ::GetPrivateProfileInt(
-        kConfigSectionLoggingSettings,
-        kConfigAttrAppendToFile,
-        kDefaultAppendToFile,
-        config_file) == 0 ? false : true;
-
-    ::GetPrivateProfileString(kConfigSectionLoggingSettings,
-                              kConfigAttrLogFilePath,
-                              kDefaultLogFileName,
-                              CStrBuf(log_file_name_, MAX_PATH),
-                              MAX_PATH,
-                              config_file);
-  } else {
-    logging_enabled_ = kDefaultLoggingEnabled;
-    show_time_ = kDefaultShowTime;
-    log_to_file_ = kDefaultLogToFile;
-    log_to_debug_out_ = kDefaultLogToOutputDebug;
-    append_to_file_ = kDefaultAppendToFile;
-    log_file_name_ = kDefaultLogFileName;
-  }
-
-  if (force_show_time_) {
-    show_time_ = true;
-  }
-
-  // The "default" category is always enabled.
-  category_list_[LC_LOGGING].enabled = true;
-  category_list_[LC_LOGGING].log_level = LEVEL_ALL;
-
-  // Read each category from the ini file.
-  for (size_t i = 0; i < arraysize(LogCategoryNames); ++i) {
-    UpdateCatAndLevel(LogCategoryNames[i].category_name,
-                      LogCategoryNames[i].category);
-  }
-
-  g_last_category_check_time = GetCurrent100NSTime();
-}
-
-CString Logging::GetDefaultLogDirectory() const {
-  CString path;
-  CStrBuf buf(path, MAX_PATH);
-  HRESULT hr = ::SHGetFolderPath(NULL,
-                                 CSIDL_COMMON_APPDATA,
-                                 NULL,
-                                 SHGFP_TYPE_CURRENT,
-                                 buf);
-  if (FAILED(hr)) {
-    return L"";
-  }
-  if (!::PathAppend(buf, OMAHA_REL_LOG_DIR)) {
-    return L"";
-  }
-  return path;
-}
-
-CString Logging::GetLogFilePath() const {
-  if (log_file_name_.IsEmpty()) {
-    return CString();
-  }
-
-  if (!ATLPath::IsRelative(log_file_name_)) {
-    return log_file_name_;
-  }
-
-  CString path = GetDefaultLogDirectory();
-  if (path.IsEmpty()) {
-    return CString();
-  }
-
-  if (!::PathAppend(CStrBuf(path, MAX_PATH), log_file_name_)) {
-    return CString();
-  }
-
-  return path;
-}
-
-void Logging::ConfigureETWLogWriter() {
-  // Always create the ETW log writer, as its log level is controlled
-  // at runtime through Event Tracing for Windows.
-  if (etw_log_writer_ == NULL) {
-    etw_log_writer_ = EtwLogWriter::Create();
-    if (debug_out_writer_ == NULL) {
-      OutputDebugString(SPRINTF(L"LOG_SYSTEM: [%s]: ERROR - "
-                                L"Cannot create ETW log writer",
-                                proc_name_));
-    }
-  }
-
-  if (etw_log_writer_ != NULL) {
-    InternalRegisterWriter(etw_log_writer_);
-  }
-}
-
-void Logging::ConfigureFileLogWriter() {
-  if (!log_to_file_) {
-    return;
-  }
-
-  // Create the logging file.
-  if (file_log_writer_ == NULL) {
-    CString path = GetLogFilePath();
-    if (path.IsEmpty()) {
-      return;
-    }
-
-    // Extract the final target directory which will not be what
-    // GetDefaultLogDirectory() returns if log_file_name_ is an absolute path.
-    CString log_file_dir = GetDirectoryFromPath(path);
-    if (!File::Exists(log_file_dir)) {
-      if (FAILED(CreateDir(log_file_dir, NULL))) {
-        return;
-      }
-    }
-    file_log_writer_ = FileLogWriter::Create(path, append_to_file_);
-    if (file_log_writer_ == NULL) {
-      OutputDebugString(SPRINTF(L"LOG_SYSTEM: [%s]: ERROR - "
-                                L"Cannot create log writer to %s",
-                                proc_name_, path));
-    }
-  }
-
-  if (file_log_writer_ != NULL) {
-    InternalRegisterWriter(file_log_writer_);
-  }
-}
-
-void Logging::ConfigureDebugOutLogWriter() {
-  if (!log_to_debug_out_) {
-    return;
-  }
-
-  if (debug_out_writer_ == NULL) {
-    debug_out_writer_ = OutputDebugStringLogWriter::Create();
-    if (debug_out_writer_ == NULL) {
-      OutputDebugString(SPRINTF(L"LOG_SYSTEM: [%s]: ERROR - "
-                                L"Cannot create OutputDebugString log writer",
-                                proc_name_));
-    }
-  }
-
-  if (debug_out_writer_ != NULL) {
-    InternalRegisterWriter(debug_out_writer_);
-  }
-}
-
-// Configures/unconfigures the log writers for the current settings.
-bool Logging::ConfigureLogging() {
-  ConfigureETWLogWriter();
-  ConfigureFileLogWriter();
-  ConfigureDebugOutLogWriter();
-
-  return num_writers_ > 0;
-}
-
-void Logging::UnconfigureLogging() {
-  if (etw_log_writer_ != NULL) {
-    InternalUnregisterWriter(etw_log_writer_);
-  }
-  if (file_log_writer_ != NULL) {
-    InternalUnregisterWriter(file_log_writer_);
-  }
-  if (debug_out_writer_ != NULL) {
-    InternalUnregisterWriter(debug_out_writer_);
-  }
-}
-
-bool Logging::InternalInitialize() {
-  __try {
-    if (logging_shutdown_ == true) {
-      OutputDebugString(SPRINTF(L"LOG_SYSTEM: [%s]: ERROR - "
-                                L"Calling the logging system after "
-                                L"it has been shut down \n",
-                                GetProcName()));
-      return false;
-    }
-
-    if (logging_initialized_ == true) {
-      return true;
-    }
-    // If something called by this method is attempting to do logging,
-    // just ignore it. The cost/benefit ratio is too high to do otherwise.
-    if (is_initializing_) {
-      return false;
-    }
-    is_initializing_ = true;
-
-    // Read the initial settings from the config file.
-    ReadLoggingSettings();
-
-    // Initialize logging system if enabled at start.
-    if (logging_enabled_) {
-      logging_initialized_ = ConfigureLogging();
-    }
-  } __except(SehNoMinidump(GetExceptionCode(),
-                           GetExceptionInformation(),
-                           __FILE__,
-                           __LINE__,
-                           true)) {
-    OutputDebugStringA("Unexpected exception in: " __FUNCTION__ "\r\n");
-    logging_initialized_  = false;
-    return false;
-  }
-
-  is_initializing_ = false;
-  return true;
-}
-
-bool Logging::InitializeLogging() {
-  // Double-checked locking idiom is broken, especially on multicore machines.
-  // TODO(omaha): understand how this works and fix it.
-  if (logging_shutdown_ == true) {
-    OutputDebugString(SPRINTF(L"LOG_SYSTEM: [%s]: ERROR - Calling the logging "
-                              L"system after it has been shut down \n",
-                              GetProcName()));
-    return false;
-  }
-
-  if (logging_initialized_ == true) {
-    return true;
-  }
-
-  // Acquire the lock outside the try/except block so we'll always release it.
-  __mutexScope(lock_);
-  return InternalInitialize();
-}
-
-// Enables/disables the logging mechanism. Allows turning logging on/off
-// in mid-run.
-// TODO(omaha):  same comment as for the destructor.
-void Logging::EnableLogging() {
-  if (!InitializeLogging()) {
-    return;
-  }
-
-  // Acquire the lock outside the try/except block so we'll always release it.
-  lock_.Lock();
-
-  __try {
-    if (!logging_enabled_) {
-      ConfigureLogging();
-      logging_enabled_ = true;
-    }
-  } __except(SehNoMinidump(GetExceptionCode(),
-                           GetExceptionInformation(),
-                           __FILE__,
-                           __LINE__,
-                           true)) {
-    OutputDebugStringA("Unexpected exception in: " __FUNCTION__ "\r\n");
-    logging_enabled_  = false;
-  }
-
-  lock_.Unlock();
-}
-
-void Logging::DisableLogging() {
-  if (!InitializeLogging()) {
-    return;
-  }
-
-  // Acquire the lock outside the try/except block so we'll always release it.
-  lock_.Lock();
-
-  __try {
-    if (logging_enabled_) {
-      logging_enabled_ = false;
-      UnconfigureLogging();
-    }
-  } __except(SehNoMinidump(GetExceptionCode(),
-             GetExceptionInformation(),
-             __FILE__,
-             __LINE__,
-             true)) {
-    OutputDebugStringA("Unexpected exception in: " __FUNCTION__ "\r\n");
-    logging_enabled_  = false;
-  }
-
-  lock_.Unlock();
-}
-
-// Checks if logging is enabled - and updates logging settings from the
-// configuration file every kLogSettingsCheckInterval seconds.
-bool Logging::IsLoggingEnabled() {
-  if (!InitializeLogging()) {
-    return false;
-  }
-
-  // Dynamic update - including reading a new value of logging_enabled_.
-  bool prev_logging_enabled = logging_enabled_;
-  if (GetCurrent100NSTime() >
-      g_last_category_check_time + kLogSettingsCheckInterval) {
-    ReadLoggingSettings();
-  }
-
-  // If enabled state has changed either enable or disable logging.
-  if (prev_logging_enabled != logging_enabled_) {
-    if (logging_enabled_) {
-      EnableLogging();
-    } else {
-      DisableLogging();
-    }
-  }
-
-  return logging_enabled_;
-}
-
-bool Logging::IsLoggingAlreadyEnabled() const {
-  return logging_enabled_;
-}
-
-void Logging::ForceShowTimestamp(bool force_show_time) {
-  force_show_time_ = show_time_ = force_show_time;
-}
-
-// Get category level
-LogLevel Logging::GetCatLevel(LogCategory category) const {
-  if (!IsLoggingAlreadyEnabled()) {
-    return kDefaultLogLevel;
-  }
-
-  if (category >= LC_MAX_CAT) {
-    return kDefaultLogLevel;
-  }
-
-  return category_list_[category].log_level;
-}
-
-// Check if logging is enabled for a given category and level
-DWORD Logging::IsCatLevelEnabled(LogCategory category, LogLevel level) {
-  if (!IsLoggingEnabled()) {
-    return 0;
-  }
-
-  if (category >= LC_MAX_CAT) {
-    return 0;
-  }
-
-  // If the config value is to log: then log to all writers.
-  if (category_list_[category].enabled &&
-      level <= category_list_[category].log_level) {
-    return static_cast<DWORD>(all_writers_mask);
-  }
-
-  // Check each of the registered loggers to see if they want to override the
-  // negative config value.
-  DWORD mask = 0;
-  for (int i = num_writers_ - 1; i >= 0; --i) {
-    mask <<= 1;
-    if (writers_[i] && writers_[i]->IsCatLevelEnabled(category, level)) {
-      mask |= 1;
-    }
-  }
-
-  return mask;
-}
-
-// TODO(omaha): For now this is hard coded and there is no way to override
-// writing other log categories into the history. Add a store_in_history
-// boolean into the CategoryInfo struct that allows reading from the config
-// file. This will enable other log categories to get buffered in the history.
-bool Logging::IsCategoryEnabledForBuffering(LogCategory cat) {
-  return cat == LC_REPORT;
-}
-
-void Logging::LogMessage(LogCategory cat, LogLevel level,
-                         const wchar_t* fmt, ...) {
-  va_list args;
-  va_start(args, fmt);
-  LogMessageVA(cat, level, fmt, args);
-  va_end(args);
-}
-
-void Logging::LogMessageVA(LogCategory cat, LogLevel level,
-                           const wchar_t* fmt, va_list args) {
-  LogMessageMaskedVA(static_cast<DWORD>(all_writers_mask),
-                     cat,
-                     level,
-                     fmt,
-                     args);
-}
-
-void Logging::InternalLogMessageMaskedVA(DWORD writer_mask,
-                                         LogCategory cat,
-                                         LogLevel level,
-                                         CString* log_buffer,
-                                         CString* prefix,
-                                         const wchar_t* fmt,
-                                         va_list args) {
-  __try {
-    // Initial buffer size in characters.
-    // It will adjust dynamically if the message is bigger.
-    DWORD buffer_size = 512;
-
-    // Count of chars / bytes written.
-    int num_chars = 0;
-    bool result = false;
-
-    // Write the message in the buffer.
-    // Dynamically adjust the size to hold the entire message.
-
-    while ((num_chars = _vsnwprintf_s(
-        log_buffer->GetBufferSetLength(buffer_size),
-        buffer_size,
-        _TRUNCATE,
-        fmt,
-        args)) == -1) {
-      // Truncate if the message is too big.
-      if (buffer_size >= kMaxLogMessageSize) {
-        num_chars = buffer_size;
-        break;
-      }
-
-      // Get a buffer that is big enough.
-      buffer_size *= 2;
-    }
-
-    log_buffer->ReleaseBuffer(num_chars);
-
-    FormatLinePrefix(show_time_, proc_name_, *prefix);
-
-    // Log the message.
-    OutputInfo info(cat, level, *prefix, *log_buffer);
-    OutputMessage(writer_mask, &info);
-  } __except(SehSendMinidump(GetExceptionCode(),
-                             GetExceptionInformation(),
-                             kMinsTo100ns)) {
-    OutputDebugStringA("Unexpected exception in: " __FUNCTION__ "\r\n");
-    OutputDebugString(fmt);
-    OutputDebugString(L"\n\r");
-  }
-}
-
-void Logging::LogMessageMaskedVA(DWORD writer_mask,
-                                 LogCategory cat,
-                                 LogLevel level,
-                                 const wchar_t* fmt,
-                                 va_list args) {
-  if (!fmt) {
-    return;
-  }
-
-  if (writer_mask == 0 && level > kMaxLevelToStoreInLogHistory) {
-    return;
-  }
-
-  CString log_buffer;    // The buffer for formatted log messages.
-  CString prefix;
-
-  int i = 0;
-  while (++i <= kNumLockRetries) {
-    if (lock_.Lock(0)) {
-      InternalLogMessageMaskedVA(writer_mask, cat, level, &log_buffer,
-                                 &prefix, fmt, args);
-      lock_.Unlock();
-      break;
-    }
-
-    Sleep(kLockRetryDelayMs);
-  }
-
-  if (i > kNumLockRetries) {
-    OutputDebugStringA("LOG_SYSTEM: Couldn't acquire lock - ");
-    OutputDebugString(fmt);
-    OutputDebugString(L"\n\r");
-  }
-}
-
-void Logging::OutputMessage(DWORD writer_mask, LogCategory cat, LogLevel level,
-                            const wchar_t* msg1, const wchar_t* msg2) {
-  OutputInfo info(cat, level, msg1, msg2);
-  OutputMessage(writer_mask, &info);
-}
-
-// Store log message in in-memory history buffer.
-void Logging::StoreInHistory(const OutputInfo* output_info) {
-  AppendToHistory(output_info->msg1);
-  AppendToHistory(output_info->msg2);
-  AppendToHistory(L"\r\n");
-}
-
-// Append string to in-memory history buffer.
-// history_buffer_next_idx points to the next index to write at,
-// thus it should always be in (0 - kHistoryBufferEndIdx).
-void Logging::AppendToHistory(const wchar_t* msg) {
-  int msg_len = wcslen(msg);
-  if (msg_len == 0) {
-    return;
-  }
-
-  if (msg_len >= kMaxHistoryBufferSize) {
-    // Write the first kMaxHistoryBufferSize chars.
-    memcpy(history_buffer, msg, kMaxHistoryBufferSize * sizeof(TCHAR));
-    history_buffer_next_idx = 0;
-    history_buffer_full = true;
-    return;
-  }
-
-  // Determine if the message fits into the portion of the buffer after
-  // history_buffer_next_idx.
-  if (msg_len + history_buffer_next_idx < kMaxHistoryBufferSize) {
-    memcpy(history_buffer + history_buffer_next_idx, msg,
-           msg_len * sizeof(TCHAR));
-    history_buffer_next_idx += msg_len;
-    return;
-  }
-
-  // Have to split the input message into the part that fits in
-  // history_buffer_next_idx to kMaxHistoryBufferSize and the remaining message.
-  int msg_first_part_len = kMaxHistoryBufferSize - history_buffer_next_idx;
-  int msg_second_part_len = msg_len - msg_first_part_len;
-  memcpy(history_buffer + history_buffer_next_idx,
-         msg,
-         msg_first_part_len * sizeof(TCHAR));
-
-  history_buffer_full = true;
-  history_buffer_next_idx = msg_second_part_len;
-  if (msg_second_part_len) {
-    memcpy(history_buffer,
-           msg + msg_first_part_len,
-           msg_second_part_len * sizeof(TCHAR));
-  }
-}
-
-// Retrieve in-memory history buffer.
-CString Logging::GetHistory() {
-  CString history;
-
-  if (history_buffer_full) {
-    history.Append(history_buffer + history_buffer_next_idx,
-                   kMaxHistoryBufferSize - history_buffer_next_idx);
-  }
-  history.Append(history_buffer, history_buffer_next_idx);
-
-  // Reset the history buffer to the original state.
-  history_buffer_next_idx = 0;
-  history_buffer_full = false;
-  memset(history_buffer, 0, kMaxHistoryBufferSize * sizeof(TCHAR));
-
-  return history;
-}
-
-void Logging::OutputMessage(DWORD writer_mask,
-                            const OutputInfo* output_info) {
-  if (output_info->level <= kMaxLevelToStoreInLogHistory &&
-      IsCategoryEnabledForBuffering(output_info->category)) {
-    StoreInHistory(output_info);
-  }
-
-  for (int i = 0; i < num_writers_; ++i) {
-    if (writer_mask & 1) {
-      __try {
-        if (logging_enabled_ || writers_[i]->WantsToLogRegardless()) {
-          writers_[i]->OutputMessage(output_info);
-        }
-      }
-      __except(SehNoMinidump(GetExceptionCode(),
-                             GetExceptionInformation(),
-                             __FILE__,
-                             __LINE__,
-                             true)) {
-        // Just eat errors that happen from within the LogWriters.  This is
-        // important so that if such an error happens when OutputMessage is
-        // called from debugASSERT we don't go recursively into more
-        // error handling ...
-      }
-    }
-    writer_mask >>= 1;
-  }
-}
-
-bool Logging::InternalRegisterWriter(LogWriter* log_writer) {
-  if (num_writers_ >= max_writers) {
-    return false;
-  }
-  writers_[num_writers_++] = log_writer;
-  return true;
-}
-
-bool Logging::RegisterWriter(LogWriter* log_writer) {
-  if (!InternalRegisterWriter(log_writer)) {
-    return false;
-  }
-  if (log_writer->WantsToLogRegardless()) {
-    EnableLogging();
-  }
-  return true;
-}
-
-bool Logging::InternalUnregisterWriter(LogWriter* log_writer) {
-  bool result = false;
-  for (int i = 0; i < num_writers_; ++i) {
-    if (writers_[i] == log_writer) {
-      // Replace this entry with last entry in array, then truncate.
-      writers_[i] = writers_[--num_writers_];
-      result = true;
-      break;
-    }
-  }
-  return result;
-}
-
-bool Logging::UnregisterWriter(LogWriter* log_writer) {
-  if (!InternalUnregisterWriter(log_writer)) {
-    return false;
-  }
-  if (num_writers_ == 0) {
-    DisableLogging();
-  }
-  return true;
-}
-
-// The primary configuration file under %PROGRAMFILES%\Google\Update is
-// removed on uninstall. This is midly inconvenient during development
-// therefore a fallback location for the configuration file is desired.
-CString Logging::GetCurrentConfigurationFilePath() const {
-  if (!config_file_path_.IsEmpty() &&
-      File::Exists(config_file_path_)) {
-    return config_file_path_;
-  } else {
-    return L"";
-  }
-}
-
-CString Logging::GetConfigurationFilePath() const {
-  CString file_path;
-  CString system_drive = GetEnvironmentVariableAsString(_T("SystemDrive"));
-  if (!system_drive.IsEmpty()) {
-    file_path = system_drive;
-    file_path += L"\\";
-  }
-  return file_path + kLogConfigFileName;
-}
-
-LogWriter::LogWriter() {
-}
-
-LogWriter::~LogWriter() {
-}
-
-void LogWriter::Cleanup() {}
-
-bool LogWriter::WantsToLogRegardless() const { return false; }
-
-bool LogWriter::IsCatLevelEnabled(LogCategory, LogLevel) const {
-  return false;
-}
-
-void LogWriter::OutputMessage(const OutputInfo*) { }
-
-bool LogWriter::Register() {
-  Logging* logger = GetLogging();
-  if (logger) {
-    return logger->RegisterWriter(this);
-  } else {
-    return false;
-  }
-}
-
-bool LogWriter::Unregister() {
-  Logging* logger = GetLogging();
-  if (logger) {
-    return logger->RegisterWriter(this);
-  } else {
-    return false;
-  }
-}
-
-// FileLogWriter
-
-FileLogWriter* FileLogWriter::Create(const wchar_t* file_name, bool append) {
-  return new FileLogWriter(file_name, append);
-}
-
-FileLogWriter::FileLogWriter(const wchar_t* file_name, bool append)
-    : initialized_(false),
-      valid_(false),
-      file_name_(file_name),
-      log_file_mutex_(NULL),
-      log_file_(NULL),
-      append_(append),
-      max_file_size_(kDefaultMaxLogFileSize),
-      log_file_wide_(kDefaultLogFileWide) {
-  Logging* logger = GetLogging();
-  if (logger) {
-    CString config_file_path = logger->GetCurrentConfigurationFilePath();
-    if (!config_file_path.IsEmpty()) {
-        max_file_size_ = ::GetPrivateProfileInt(
-            kConfigSectionLoggingSettings,
-            kConfigAttrMaxLogFileSize,
-            kDefaultMaxLogFileSize,
-            config_file_path);
-        log_file_wide_ = ::GetPrivateProfileInt(
-            kConfigSectionLoggingSettings,
-            kConfigAttrLogFileWide,
-            kDefaultLogFileWide,
-            config_file_path) == 0 ? false : true;
-    } else {
-      max_file_size_ = kDefaultMaxLogFileSize;
-      log_file_wide_ = kDefaultLogFileWide;
-    }
-    proc_name_ = logger->proc_name();
-  }
-}
-
-FileLogWriter::~FileLogWriter() {
-  // TODO(omaha): Figure out a way to pass the proc_name - and possibly
-  // the show_time var - into here.
-  Logging* logger = GetLogging();
-  if (logger && logger->IsLoggingAlreadyEnabled()) {
-    // OutputInfo info(LEVEL_WARNING, NULL, kEndOfLogMessage);
-    // OutputMessage(&info);
-  }
-  Cleanup();
-}
-
-void FileLogWriter::Initialize() {
-  if (initialized_) {
-    return;
-  }
-
-  initialized_ = true;
-
-  bool already_created = CreateLoggingMutex();
-  if (!log_file_mutex_) {
-    return;
-  }
-
-  if (already_created) {
-    append_ = true;
-  }
-
-  if (!GetMutex()) {
-    ::OutputDebugString(SPRINTF(L"LOG_SYSTEM: [%s]: "
-                                L"Could not acquire logging mutex %s\n",
-                                proc_name_,
-                                log_file_mutex_name_));
-    return;
-  }
-
-  CreateLoggingFile();
-  if (!log_file_) {
-    ::OutputDebugString(SPRINTF(L"LOG_SYSTEM: [%s]: "
-                                L"Could not create logging file %s\n",
-                                proc_name_,
-                                file_name_));
-    valid_ = false;
-  }
-
-  valid_ = true;
-  ReleaseMutex();
-}
-
-void FileLogWriter::Cleanup() {
-  if (log_file_) {
-    ::CloseHandle(log_file_);
-  }
-  if (log_file_mutex_) {
-    ::ReleaseMutex(log_file_mutex_);
-    ::CloseHandle(log_file_mutex_);
-  }
-}
-
-bool FileLogWriter::CreateLoggingMutex() {
-  log_file_mutex_name_ = StripBackslashes(kLoggingMutexName L"_" + file_name_);
-  // TODO(omaha): I don't see where this class is used, but I guess the
-  // caller is always in the same context. We should use the default security
-  // here.  If the caller can be in different contexts (System Service, Usermode
-  // applications, etc), then we should revisit this code to give access only
-  // to those who really need it.  What if a malicious piece a code decide
-  // to get the mutex and lock it? If it happens, everytime you try to log
-  // something, the thread would hang for 500ms and then fail to log the
-  // message.
-  CSecurityDesc sd;
-  GetEveryoneDaclSecurityDescriptor(&sd, GENERIC_ALL, GENERIC_ALL);
-  CSecurityAttributes sa(sd);
-  log_file_mutex_ = CreateMutexWithSyncAccess(log_file_mutex_name_, &sa);
-  if (log_file_mutex_) {
-    return ERROR_ALREADY_EXISTS == ::GetLastError();
-  }
-  return false;
-}
-
-bool FileLogWriter::CreateLoggingFile() {
-  uint32 file_size(0);
-  File::GetFileSizeUnopen(file_name_, &file_size);
-  if (file_size > max_file_size_) {
-    ArchiveLoggingFile();
-  }
-  log_file_ = ::CreateFile(file_name_,
-                           GENERIC_WRITE,
-                           FILE_SHARE_WRITE | FILE_SHARE_READ,
-                           NULL,
-                           append_ ? OPEN_ALWAYS : CREATE_ALWAYS,
-                           FILE_ATTRIBUTE_NORMAL,
-                           NULL);
-  if (log_file_ == INVALID_HANDLE_VALUE) {
-    // The code in this file is written with the assumption that log_file_ is
-    // NULL on creation errors. The easy fix is to set it to NULL here. The
-    // long term fix should be implementing it in terms of a smart handle.
-    log_file_ = NULL;
-    return false;
-  }
-
-  // Allow users to read, write, and delete the log file.
-  ACCESS_MASK mask = GENERIC_READ | GENERIC_WRITE | DELETE;
-  CDacl dacl;
-  if (dacl.AddAllowedAce(ATL::Sids::Users(), mask)) {
-    AtlSetDacl(file_name_, SE_FILE_OBJECT, dacl);
-  }
-
-  // Insert a BOM in the newly created file.
-  if (GetLastError() != ERROR_ALREADY_EXISTS && log_file_wide_) {
-    DWORD num = 0;
-    ::WriteFile(log_file_, &kUnicodeBom, sizeof(kUnicodeBom), &num, NULL);
-  }
-  return true;
-}
-
-bool FileLogWriter::TruncateLoggingFile() {
-  DWORD share_mode = FILE_SHARE_WRITE;
-  HANDLE log_file = ::CreateFile(file_name_,
-                                 GENERIC_WRITE,
-                                 FILE_SHARE_WRITE | FILE_SHARE_READ,
-                                 NULL,
-                                 TRUNCATE_EXISTING,
-                                 FILE_ATTRIBUTE_NORMAL,
-                                 NULL);
-  if (log_file_ == INVALID_HANDLE_VALUE) {
-    return false;
-  }
-
-  // Insert a BOM in the newly created file.
-  if (log_file_wide_) {
-    DWORD num = 0;
-    ::WriteFile(log_file, &kUnicodeBom, sizeof(kUnicodeBom), &num, NULL);
-  }
-  ::CloseHandle(log_file);
-  return true;
-}
-
-bool FileLogWriter::ArchiveLoggingFile() {
-  ::OutputDebugString(L"LOG_SYSTEM: trying to move log file to backup\n");
-  CString backup_file_name = file_name_ + L".bak";
-  HRESULT hr = File::Move(file_name_, backup_file_name, true);
-  if (FAILED(hr)) {
-    ::OutputDebugString(L"LOG_SYSTEM: failed to move log file to backup\n");
-
-    // Trying to move the log file when loggers have it open returns
-    // ERROR_SHARING_VIOLATION. Each call to MoveFileAfterReboot inserts the
-    // file into PendingFileRenames list. Moving files at reboot requires the
-    // user to be either the LocalSystem account or in the Administrators
-    // group.
-    if (!IsArchivePending()) {
-      File::MoveAfterReboot(file_name_, backup_file_name);
-    }
-    return false;
-  }
-  return true;
-}
-
-bool FileLogWriter::IsArchivePending() {
-  // We look at the PendingFileRenameOperations to see if our log file is
-  // pending a rename. The list is a REG_MULTI_SZ, which is a sequence of
-  // null-terminated strings, terminated by an empty string "\0".
-  // The strings have the structure:
-  // \??\file1\0!\??\file2\0\file3\0\0...\0\0. where file1 is to be renamed to
-  // file2 and file3 is to be deleted.
-  // It is valid for the PFR list to include an empty string in the middle
-  // of the sequence.
-  const wchar_t sub_key_name[] = L"SYSTEM\\CurrentControlSet\\Control\\"
-                                 L"Session Manager";
-  HKEY key = NULL;
-  int res = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE,
-                            sub_key_name,
-                            0,
-                            KEY_READ,
-                            &key);
-  if (res != ERROR_SUCCESS) {
-    return false;
-  }
-  DWORD bytes = 0;
-  DWORD type = REG_MULTI_SZ;
-  res = ::RegQueryValueEx(key,
-                          L"PendingFileRenameOperations",
-                          0,
-                          &type,
-                          NULL,
-                          &bytes);
-  if (!(res == ERROR_SUCCESS && type == REG_MULTI_SZ)) {
-    return false;
-  }
-  scoped_array<byte> buf(new byte[bytes]);
-  memset(buf.get(), 0, bytes);
-  res = ::RegQueryValueEx(key,
-                          L"PendingFileRenameOperations",
-                          0,
-                          NULL,
-                          buf.get(),
-                          &bytes);
-  if (res != ERROR_SUCCESS) {
-    return false;
-  }
-  const wchar_t* multi_str = reinterpret_cast<const wchar_t*>(buf.get());
-  size_t count = bytes / sizeof(*multi_str);
-  const size_t kMaxRegistryValueLen = 1024 * 1024;  // 1MB
-  if (!(count >= 2 &&
-        count < kMaxRegistryValueLen &&
-        multi_str[count - 2] == L'\0' &&
-        multi_str[count - 1] == L'\0')) {
-    return false;
-  }
-  // The file names in the PFR list are prefixed by \??\.
-  CString file_name = L"\\??\\" + file_name_;
-  return FindFirstInMultiString(multi_str, count, file_name) != -1;
-}
-
-int FileLogWriter::FindFirstInMultiString(const wchar_t* multi_str,
-                                          size_t count,
-                                          const wchar_t* str) {
-  const wchar_t* p = multi_str;
-  size_t i = 0;
-  while (i < count) {
-    p =  multi_str + i;
-    if (lstrcmp(p, str) == 0) {
-      return i;
-    } else {
-      size_t len = lstrlen(p);
-      i += len + 1;
-    }
-  }
-  return -1;
-}
-
-void FileLogWriter::OutputMessage(const OutputInfo* output_info) {
-  if (!initialized_) {
-    Initialize();
-  }
-
-  if (!valid_) {
-    return;
-  }
-
-  // Acquire the mutex.
-  if (!GetMutex()) {
-    return;
-  }
-
-  // Move to end of file.
-  DWORD pos = ::SetFilePointer(log_file_, 0, NULL, FILE_END);
-  int64 stop_gap_file_size = kStopGapLogFileSizeFactor *
-                             static_cast<int64>(max_file_size_);
-  if (pos >= stop_gap_file_size) {
-    if (!TruncateLoggingFile()) {
-      // Logging stops until the log can be archived over since we do not
-      // want to overfill the disk.
-      return;
-    }
-  }
-  pos = ::SetFilePointer(log_file_, 0, NULL, FILE_END);
-
-  // Write the date, followed by a CRLF
-  DWORD written_size = 0;
-  if (output_info->msg1) {
-    if (log_file_wide_) {
-      ::WriteFile(log_file_, output_info->msg1,
-                  lstrlen(output_info->msg1) * sizeof(wchar_t), &written_size,
-                  NULL);
-    } else {
-      CStringA msg(WideToAnsiDirect(output_info->msg1));
-      ::WriteFile(log_file_, msg.GetString(), msg.GetLength(), &written_size,
-                  NULL);
-    }
-  }
-
-  if (output_info->msg2) {
-    if (log_file_wide_) {
-      ::WriteFile(log_file_, output_info->msg2,
-                  lstrlen(output_info->msg2) * sizeof(wchar_t), &written_size,
-                  NULL);
-    } else {
-      CStringA msg(WideToAnsiDirect(output_info->msg2));
-      ::WriteFile(log_file_, msg.GetString(), msg.GetLength(), &written_size,
-                  NULL);
-    }
-  }
-
-  if (log_file_wide_) {
-    ::WriteFile(log_file_, L"\r\n", 2 * sizeof(wchar_t), &written_size, NULL);
-  } else {
-    ::WriteFile(log_file_, "\r\n", 2, &written_size, NULL);
-  }
-
-  ReleaseMutex();
-}
-
-bool FileLogWriter::GetMutex() {
-  if (!log_file_mutex_) {
-    return false;
-  }
-
-  DWORD res = ::WaitForSingleObject(log_file_mutex_, kMaxMutexWaitTimeMs);
-  if (res != WAIT_OBJECT_0 && res != WAIT_ABANDONED) {
-    ::OutputDebugString(SPRINTF(L"LOG_SYSTEM: [%s]: "
-                                L"Could not acquire logging mutex %s\n",
-                                proc_name_, log_file_mutex_name_));
-    valid_ = false;
-    return false;
-  }
-
-  return true;
-}
-
-void FileLogWriter::ReleaseMutex() {
-  if (log_file_mutex_) {
-    ::ReleaseMutex(log_file_mutex_);
-  }
-}
-
-// OutputDebugStringLogWriter.
-OutputDebugStringLogWriter* OutputDebugStringLogWriter::Create() {
-  return new OutputDebugStringLogWriter();
-}
-
-OutputDebugStringLogWriter::OutputDebugStringLogWriter() {}
-
-OutputDebugStringLogWriter::~OutputDebugStringLogWriter() {
-  Logging* logger = GetLogging();
-  if (logger && logger->IsLoggingAlreadyEnabled()) {
-    // OutputInfo info(LEVEL_WARNING, NULL, kEndOfLogMessage);
-    // OutputMessage(&info);
-  }
-  Cleanup();
-}
-
-void OutputDebugStringLogWriter::OutputMessage(const OutputInfo* output_info) {
-  // Combine everything into one string so that messages coming from
-  // multiple threads don't get interleaved.
-  ::OutputDebugString(SPRINTF(L"%s%s\n", output_info->msg1, output_info->msg2));
-}
-
-// OverrideConfigLogWriter.
-OverrideConfigLogWriter* OverrideConfigLogWriter::Create(LogCategory category,
-    LogLevel level, LogWriter* log_writer, bool force_logging_enabled) {
-  return new OverrideConfigLogWriter(category,
-                                     level,
-                                     log_writer,
-                                     force_logging_enabled);
-}
-
-OverrideConfigLogWriter::OverrideConfigLogWriter(LogCategory category,
-                                                 LogLevel level,
-                                                 LogWriter* log_writer,
-                                                 bool force_logging_enabled)
-    : category_(category),
-      level_(level),
-      log_writer_(log_writer),
-      force_logging_enabled_(force_logging_enabled) {}
-
-void OverrideConfigLogWriter::Cleanup() {
-  if (log_writer_) {
-    delete log_writer_;
-  }
-}
-
-bool OverrideConfigLogWriter::WantsToLogRegardless() const {
-  return force_logging_enabled_;
-}
-
-bool OverrideConfigLogWriter::IsCatLevelEnabled(LogCategory category,
-                                                LogLevel level) const {
-  if (category != category_) {
-    return false;
-  }
-  if (level > level_) {
-    return false;
-  }
-  return true;
-}
-
-void OverrideConfigLogWriter::OutputMessage(const OutputInfo* output_info) {
-  if (log_writer_) {
-    log_writer_->OutputMessage(output_info);
-  }
-  return;
-}
-
-}  // namespace omaha
-
-#endif  // LOGGING
-
diff --git a/base/logging.h b/base/logging.h
deleted file mode 100644
index e4f0cf1..0000000
--- a/base/logging.h
+++ /dev/null
@@ -1,528 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// logging.h
-//
-// Tracing and logging system.
-// Allows filtering of the log messages based on logging categories and levels.
-
-#ifndef OMAHA_BASE_LOGGING_H_
-#define OMAHA_BASE_LOGGING_H_
-
-#include "omaha/base/constants.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/time.h"
-
-#ifdef LOGGING
-
-// Logging levels.
-enum LogLevel {
-  LEVEL_FATALERROR = -3,      // crashing fatal error
-  LEVEL_ERROR      = -2,      // errors - recoverable but shouldn't happen
-  LE               = -2,
-  LEVEL_WARNING    = -1,      // warnings
-  LW               = -1,
-  L1               =  1,      // for aprox. 10 logs per run
-  L2,                         // for aprox. 100 logs per run
-  L3,                         // for aprox. 1,000 logs per run
-  L4,                         // for aprox. 10,000 logs per run
-  L5,                         // for aprox. 100,000 logs per run
-  L6,                         // for > 1,000,000 logs per run
-
-  // add above
-  LEVEL_ALL                   // all errors
-};
-
-#endif
-
-namespace omaha {
-
-#define kDefaultLoggingEnabled          1
-#define kLogConfigFileName              MAIN_EXE_BASE_NAME _T(".ini")
-#define kDefaultLogFileName             MAIN_EXE_BASE_NAME _T(".log")
-#define kDefaultLogFileWide             1
-#define kDefaultShowTime                1
-#define kDefaultAppendToFile            1
-
-#ifdef _DEBUG
-#define kDefaultMaxLogFileSize          0xFFFFFFFF  // 4GB
-#define kDefaultLogToFile               1
-#define kDefaultLogToOutputDebug        1
-#define kDefaultLogLevel                L3
-#else
-#define kDefaultMaxLogFileSize          10000000    // 10MB
-#define kDefaultLogToFile               0
-#define kDefaultLogToOutputDebug        0
-#define kDefaultLogLevel                L1
-#endif
-
-// Truncates the log file when the size of the log file is this many
-// times over the MaxLogFileSize to prevent disk overfill.
-#define kStopGapLogFileSizeFactor       10
-
-// config file sections
-#define kConfigSectionLoggingLevel      L"LoggingLevel"
-#define kConfigSectionLoggingSettings   L"LoggingSettings"
-
-// config file attributes
-#define kConfigAttrEnableLogging        L"EnableLogging"
-#define kConfigAttrShowTime             L"ShowTime"
-#define kConfigAttrLogToFile            L"LogToFile"
-#define kConfigAttrLogFilePath          L"LogFilePath"
-#define kConfigAttrLogFileWide          L"LogFileWide"
-#define kConfigAttrLogToOutputDebug     L"LogToOutputDebug"
-#define kConfigAttrAppendToFile         L"AppendToFile"
-#define kConfigAttrMaxLogFileSize       L"MaxLogFileSize"
-
-#define kLoggingMutexName               kLockPrefix L"logging_mutex"
-#define kMaxMutexWaitTimeMs             500
-
-// Does not allow messages bigger than 1 MB.
-#define kMaxLogMessageSize              (1024 * 1024)
-
-#define kLogSettingsCheckInterval       (5 * kSecsTo100ns)
-
-#define kStartOfLogMessage \
-    L"********************* NEW LOG *********************"
-#define kEndOfLogMessage   \
-    L"********************* END LOG *********************"
-
-// TODO(omaha): Allow these defaults to be overriden in the config file.
-#define kMaxLevelToStoreInLogHistory L2
-#define kMaxHistoryBufferSize 1024
-
-#ifdef LOGGING
-
-#define LC_LOG(cat, level, msg) \
-  do {                                                     \
-    omaha::Logging* logger = omaha::GetLogging();          \
-    if (logger) {                                          \
-      omaha::LoggingHelper(logger, cat, level,             \
-        logger->IsCatLevelEnabled(cat, level)) msg;        \
-    }                                                      \
-  } while (0)
-
-#define LC_LOG_OPT(cat, level, msg)   LC_LOG(cat, level, msg)
-
-#else
-#define LC_LOG(cat, level, msg)   ((void)0)
-#endif
-
-#ifdef _DEBUG
-#define LC_LOG_DEBUG(cat, level, msg) LC_LOG(cat, level, msg)
-#else
-#define LC_LOG_DEBUG(cat, level, msg) ((void)0)
-#endif
-
-// Shortcuts for different logging categories - no need to specify the category.
-#define CORE_LOG(x, y)         LC_LOG_DEBUG(omaha::LC_CORE, x, y)
-#define NET_LOG(x, y)          LC_LOG_DEBUG(omaha::LC_NET, x, y)
-#define PLUGIN_LOG(x, y)       LC_LOG_DEBUG(omaha::LC_PLUGIN, x, y)
-#define SERVICE_LOG(x, y)      LC_LOG_DEBUG(omaha::LC_SERVICE, x, y)
-#define SETUP_LOG(x, y)        LC_LOG_DEBUG(omaha::LC_SETUP, x, y)
-#define SHELL_LOG(x, y)        LC_LOG_DEBUG(omaha::LC_SHELL, x, y)
-#define UTIL_LOG(x, y)         LC_LOG_DEBUG(omaha::LC_UTIL, x, y)
-
-#define OPT_LOG(x, y)          LC_LOG_OPT(omaha::LC_OPT, x, y)
-#define REPORT_LOG(x, y)       LC_LOG_OPT(omaha::LC_REPORT, x, y)
-
-#ifdef LOGGING
-
-// Logging components.
-// Maximum 32 categories unless mask is increased to 64 bits.
-enum LogCategory {
-  LC_LOGGING = 0,
-
-  // ADD BELOW - AND REMEMBER:
-  //   - Add a line to the LogCategoryNames table in logging.cc!!!
-  //   - Add to C:\GoogleUpdate.ini.
-
-  LC_UTIL,
-  LC_SETUP,
-  LC_SHELL,
-  LC_CORE,
-  LC_JS,
-  LC_PLUGIN,
-  LC_SERVICE,
-  LC_OPT,
-  LC_NET,
-  LC_REPORT,
-
-  // ADD ABOVE
-
-  LC_MAX_CAT
-};
-
-#define kCatEnabledField      L"Enabled"
-#define kCatLevelField        L"Level"
-
-struct CategoryInfo {
-  bool enabled;
-  LogLevel log_level;
-};
-
-// If you want to log anything else, add it to this structure.  This structure
-// basically says that each logged message is composed of two parts, and they
-// are output one after the other.  Intended to be used for a message "prefix"
-// and the message itself (the prefix can contain the component name, the time,
-// and any other logging system boilerplate, while the message is supplied by
-// the component).  (This basically saves having to copy a variable length -
-// possibly very large - message just to tack it onto the end of the message
-// prefix.)
-struct OutputInfo {
-  LogCategory category;
-  LogLevel level;
-  const wchar_t* msg1;
-  const wchar_t* msg2;
-
-  OutputInfo(LogCategory cat, LogLevel log_level,
-             const wchar_t* m1, const wchar_t* m2)
-      : category(cat),
-        level(log_level),
-        msg1(m1),
-        msg2(m2) {}
-};
-
-// The LogWriter - can decide whether to process message or not, then
-// will process it.  Actually, the message is processed if either a) the
-// individual LogWriter wants to process it or b) it is marked as processable
-// by settings in config ini.
-//
-// Included LogWriters:
-//   OutputDebugStringLogWriter - Logs to OutputDebugString() API
-//   FileLogWriter - Logs to a file
-//   OverrideConfigLogWriter - Overrides the level settings of a
-//     particular category, uses another writer to actually do the writing.
-//     Used, e.g., in installer to force SETUP_LOG messages to go to a file
-//     tr_setup_log.info even if the there is no trconfig.ini file.
-//
-// Not included LogWriters:
-//   StdLogWriter - Logs to stdout or stderr
-//   SubmitToGoogleLogWriter - When done logging submits the log file to
-//     Google's status-receiving server
-class LogWriter {
- protected:
-  LogWriter();
-  virtual void Cleanup();
- public:
-  virtual ~LogWriter();
-
-  // Returns true if this Logging object wants to log even if the global
-  // "enable logging" flag is off.  Useful for always creating a log, e.g., an
-  // install log, even without a GoogleUpdate.ini.
-  virtual bool WantsToLogRegardless() const;
-
-  // Returns true if this Logging object wants to handle the message,
-  // regardless of other settings.
-  virtual bool IsCatLevelEnabled(LogCategory category, LogLevel level) const;
-
-  virtual void OutputMessage(const OutputInfo* output_info);
-
-  // Registers and unregisters this LogWriter with the Logging system.  When
-  // registered, the Logging class assumes ownership.
-  bool Register();
-  bool Unregister();
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(LogWriter);
-};
-
-// A LogWriter that writes to a named file.
-class FileLogWriter : public LogWriter {
- protected:
-  FileLogWriter(const wchar_t* file_name, bool append);
-  ~FileLogWriter();
-  virtual void Cleanup();
-
- public:
-  static FileLogWriter* Create(const wchar_t* file_name, bool append);
-  virtual void OutputMessage(const OutputInfo* output_info);
-
- private:
-  void Initialize();
-  bool CreateLoggingMutex();
-  bool CreateLoggingFile();
-  bool ArchiveLoggingFile();
-  bool TruncateLoggingFile();
-  bool GetMutex();
-  void ReleaseMutex();
-
-  // Returns true if archiving of the log file is pending a computer restart.
-  bool IsArchivePending();
-
-  // Returns the first position of str inside of a MULTI_SZ of count characters
-  // including the terminating zeros.
-  static int FindFirstInMultiString(const wchar_t* multi_str,
-                                    size_t count,
-                                    const wchar_t* str);
-
-  uint32 max_file_size_;
-  bool initialized_;
-  bool valid_;
-  bool append_;
-  bool log_file_wide_;
-  CString log_file_mutex_name_;
-  HANDLE log_file_mutex_;
-  CString file_name_;
-  HANDLE log_file_;
-  CString proc_name_;
-
-  friend class FileLogWriterTest;
-
-  DISALLOW_EVIL_CONSTRUCTORS(FileLogWriter);
-};
-
-// A LogWriter that uses OutputDebugString() to write messages.
-class OutputDebugStringLogWriter : public LogWriter {
- protected:
-  OutputDebugStringLogWriter();
-  ~OutputDebugStringLogWriter();
- public:
-  static OutputDebugStringLogWriter* Create();
-  virtual void OutputMessage(const OutputInfo* info);
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(OutputDebugStringLogWriter);
-};
-
-// A LogWriter that overrides the settings in trconfig.ini and sends messages
-// to another LogWriter.  Takes ownership of the other LogWriter.
-class OverrideConfigLogWriter : public LogWriter {
- protected:
-  OverrideConfigLogWriter(LogCategory category, LogLevel level,
-                          LogWriter* log_writer, bool force_logging_enabled);
-  virtual void Cleanup();
- public:
-  static OverrideConfigLogWriter* Create(LogCategory category, LogLevel level,
-    LogWriter* log_writer, bool force_logging_enabled);
-  virtual bool WantsToLogRegardless() const;
-  virtual bool IsCatLevelEnabled(LogCategory category, LogLevel level) const;
-  virtual void OutputMessage(const OutputInfo* output_info);
- private:
-  LogCategory category_;
-  LogLevel level_;
-  LogWriter* log_writer_;
-  bool force_logging_enabled_;
-  DISALLOW_EVIL_CONSTRUCTORS(OverrideConfigLogWriter);
-};
-
-// This log writer outputs to Event Tracing for Windows.
-class EtwLogWriter;
-
-// The Logging class - Singleton class
-// Fine-grain logging based on categories and levels.
-// Can log to a file, stdout or debugger.
-class Logging {
- public:
-  // constructor
-  Logging();
-
-  // destructor
-  ~Logging();
-
-  // Enables/disables the logging mechanism.  Allows turning logging on/off
-  // in mid-run.  Returns true for success (not for 'logging enabled').
-  void EnableLogging();
-  void DisableLogging();
-
-  // Checks if logging is enabled - and updates logging settings from the
-  // configuration file every kLogSettingsCheckInterval seconds
-  bool IsLoggingEnabled();
-
-  // Checks if logging is already enabled. It does not try to enable it.
-  bool IsLoggingAlreadyEnabled() const;
-
-  // Overrides the config file settings for showing the time stamps.
-  void ForceShowTimestamp(bool force_show_time);
-
-  // Checks if logging is enabled for a given category and level.
-  DWORD IsCatLevelEnabled(LogCategory category, LogLevel level);
-  LogLevel GetCatLevel(LogCategory category) const;
-
-  // Logs a message.
-  void LogMessage(LogCategory cat, LogLevel level, const wchar_t* fmt, ...);
-  void LogMessageVA(LogCategory cat, LogLevel level, const wchar_t* fmt,
-                    va_list args);
-
-  // Retrieves the default location of the log directory.
-  CString GetDefaultLogDirectory() const;
-
-  // Computes and returns the complete path of the log file.
-  CString GetLogFilePath() const;
-
-  // Retrieves in-memory history buffer.
-  CString GetHistory();
-
-  // Returns the file path of the current GoogleUpdate.ini.
-  CString GetCurrentConfigurationFilePath() const;
-
-  const CString& proc_name() const { return proc_name_; }
-
-  bool IsCategoryEnabledForBuffering(LogCategory cat);
- private:
-  bool InternalInitialize();
-  void InternalLogMessageMaskedVA(DWORD writer_mask,
-                                  LogCategory cat,
-                                  LogLevel level,
-                                  CString* log_buffer,
-                                  CString* prefix,
-                                  const wchar_t* fmt,
-                                  va_list args);
-
-  friend class LoggingHelper;
-  void LogMessageMaskedVA(DWORD writer_mask, LogCategory cat, LogLevel level,
-                          const wchar_t* fmt, va_list args);
-
-  // Stores log message in in-memory history buffer.
-  void StoreInHistory(const OutputInfo* output_info);
-
-  // Appends string to in-memory history buffer.
-  void AppendToHistory(const wchar_t* msg);
-
-  // Initializes the logging engine. Harmless to call multiple times.
-  bool InitializeLogging();
-
-  // Configures/unconfigures the log writers for the current settings.  That
-  // is, given the current settings from GoogleUpdate.ini, either initializes
-  // and registers the file-out and debug-out logwriters, or unregisters them.
-  void ConfigureETWLogWriter();
-  void ConfigureFileLogWriter();
-  void ConfigureDebugOutLogWriter();
-  bool ConfigureLogging();
-  void UnconfigureLogging();
-
-  void UpdateCatAndLevel(const wchar_t* cat_name, LogCategory cat);
-  void ReadLoggingSettings();
-
-  // Returns the primary file path of the GoogleUpdate.ini.
-  CString GetConfigurationFilePath() const;
-
-  // Returns the alternate file path of the GoogleUpdate.ini.
-  CString GetAltConfigurationFilePath() const;
-
- public:
-
-  // Passes the messages along to other OutputMessage()
-  void OutputMessage(DWORD writer_mask, LogCategory cat, LogLevel level,
-                     const wchar_t* msg1, const wchar_t* msg2);
-
-  // Broadcasts the message to each LogWriter.
-  // It should be private but the function we want to be able to use this,
-  // debugASSERT is extern "C" and thus can't be declared a friend of
-  // Logging.
-  void OutputMessage(DWORD writer_mask, const OutputInfo* output_info);
-
- private:
-
-  CategoryInfo category_list_[LC_MAX_CAT];
-
-  // Checks if logging is initialized.
-  bool logging_initialized_;
-
-  // Is logging in the process of initializing?
-  bool is_initializing_;
-
-  // The logging process name including the calling module.
-  CString proc_name_;
-
-  // Serializes changing logging init/uninit/enable/disable status.
-  LLock lock_;
-
-  // Bunch of settings from the config .ini file.
-  bool logging_enabled_;     // Checks if logging is enabled.
-  bool force_show_time_;
-  bool show_time_;
-  bool log_to_file_;
-  CString log_file_name_;
-  bool log_to_debug_out_;
-  bool append_to_file_;
-
-  // Signals the logging system is shutting down.
-  bool logging_shutdown_;
-
-  // Checkpoint time for dynamic category updates.
-  time64 g_last_category_check_time;
-
-  // The file path of the optional ini file which defines the logging
-  // configuration.
-  CString config_file_path_;
-
- private:
-  bool InternalRegisterWriter(LogWriter* log_writer);
-  bool InternalUnregisterWriter(LogWriter* log_writer);
-
- public:
-  bool RegisterWriter(LogWriter* log_writer);
-  bool UnregisterWriter(LogWriter* log_writer);
-  enum { all_writers_mask = -1 };
-
- private:
-  enum { max_writers = 15 };
-  int num_writers_;
-  LogWriter* writers_[max_writers];
-
-  LogWriter* file_log_writer_;
-  LogWriter* debug_out_writer_;
-  LogWriter* etw_log_writer_;
-
-  friend class HistoryTest;
-
-  DISALLOW_EVIL_CONSTRUCTORS(Logging);
-};
-
-// In order to make the logging macro LC_LOG work out we need to pass a
-// parameter (the mask of loggers to write to) (*) to the actual logging
-// method. However, the last parameter to the macro LC_LOG has its own
-// parenthesis - it encloses multiple expressions (a format string and
-// arguments). So this function object is used as an intermediary in order to
-// hold the writer mask.
-//
-// (*) The mask needs to be transferred separately because we want to keep the
-// LC_LOG structure of asking if the message is going to be logged before
-// evaluating the arguments, and we can't store it in the singleton Logging
-// object - wouldn't be thread-safe.
-
-class LoggingHelper {
- public:
-  LoggingHelper(Logging* logger, LogCategory cat,
-                LogLevel level, DWORD writer_mask)
-      : logger_(logger),
-        category_(cat),
-        level_(level),
-        writer_mask_(writer_mask) {}
-
-  void operator()(const wchar_t* fmt, ...) {
-    va_list args;
-    va_start(args, fmt);
-    logger_->LogMessageMaskedVA(writer_mask_, category_, level_, fmt, args);
-    va_end(args);
-  }
-
- private:
-  Logging* logger_;
-  DWORD writer_mask_;
-  LogLevel level_;
-  LogCategory category_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(LoggingHelper);
-};
-
-// Getter for the Logging singleton class.
-Logging* GetLogging();
-
-#endif  // LOGGING
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_LOGGING_H_
diff --git a/base/logging/build.scons b/base/logging/build.scons
deleted file mode 100644
index 106cb01..0000000
--- a/base/logging/build.scons
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-
-Import('env')
-
-#
-# Build the googleclient port of the logging module.
-#
-logging_env = env.Clone()
-
-logging_inputs = [
-    'logging.cc',
-    ]
-
-logging_env.ComponentStaticLibrary(
-    lib_name='logging',
-    source=logging_inputs,
-)
-
diff --git a/base/logging/logging.cc b/base/logging/logging.cc
deleted file mode 100644
index 04b4cf0..0000000
--- a/base/logging/logging.cc
+++ /dev/null
@@ -1,348 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// This is code that defines the backend for the new LogMessage definition
-// and the functions that the client application can call to control logging.
-
-#include <ctime>
-#include <iomanip>
-#include <cstring>
-#include <windows.h>
-#include <tchar.h>
-#include <algorithm>
-#include "omaha/base/logging/logging.h"
-
-namespace logging {
-
-const char* const log_severity_names[LOG_NUM_SEVERITIES] = {
-  "INFO", "WARNING", "ERROR", "FATAL" };
-
-int min_log_level = 0;
-LogLockingState lock_log_file = LOCK_LOG_FILE;
-LoggingDestination logging_destination = LOG_ONLY_TO_FILE;
-
-// which log file to use? This is initialized by InitLogging or
-// will be lazily initialized to the default value when it is
-// first needed.
-TCHAR log_file_name[MAX_PATH] = { 0 };
-
-// this file is lazily opened and the handle may be NULL
-HANDLE log_file = NULL;
-
-// what should be prepended to each message?
-bool log_process_id = false;
-bool log_thread_id = false;
-bool log_timestamp = true;
-bool log_tickcount = false;
-
-// An assert handler override specified by the client to be called instead of
-// the debug message dialog.
-LogAssertHandlerFunction log_assert_handler = NULL;
-
-// The critical section is used if log file locking is false. It helps us
-// avoid problems with multiple threads writing to the log file at the same
-// time.
-bool initialized_critical_section = false;
-CRITICAL_SECTION log_critical_section;
-
-// When we don't use a critical section, we are using a global mutex. We
-// need to do this because LockFileEx is not thread safe
-HANDLE log_mutex = NULL;
-
-void InitLogMutex() {
-  if (!log_mutex) {
-    // \ is not a legal character in mutex names so we replace \ with /
-    std::wstring safe_name(log_file_name);
-    std::replace(safe_name.begin(), safe_name.end(), '\\', '/');
-    std::wstring t(L"Global\\");
-    t.append(safe_name);
-    log_mutex = ::CreateMutex(NULL, FALSE, t.c_str());
-  }
-}
-
-void InitLogging(const TCHAR* new_log_file, LoggingDestination logging_dest,
-                 LogLockingState lock_log, OldFileDeletionState delete_old) {
-  if (log_file) {
-    // calling InitLogging twice or after some log call has already opened the
-    // default log file will re-initialize to the new options
-    CloseHandle(log_file);
-    log_file = NULL;
-  }
-
-  lock_log_file = lock_log;
-  logging_destination = logging_dest;
-
-  // ignore file options if logging is only to system
-  if (logging_destination == LOG_ONLY_TO_SYSTEM_DEBUG_LOG)
-    return;
-
-  _tcsncpy(log_file_name, new_log_file, MAX_PATH);
-  log_file_name[MAX_PATH - 1] = _T('\0');
-  if (delete_old == DELETE_OLD_LOG_FILE)
-    DeleteFile(log_file_name);
-
-  if (lock_log_file == LOCK_LOG_FILE) {
-    InitLogMutex();
-  } else if (!initialized_critical_section) {
-    // initialize the critical section
-    InitializeCriticalSection(&log_critical_section);
-    initialized_critical_section = true;
-  }
-}
-
-void SetMinLogLevel(int level) {
-  min_log_level = level;
-}
-
-void SetLogItems(bool enable_process_id, bool enable_thread_id,
-                 bool enable_timestamp, bool enable_tickcount) {
-  log_process_id = enable_process_id;
-  log_thread_id = enable_thread_id;
-  log_timestamp = enable_timestamp;
-  log_tickcount = enable_tickcount;
-}
-
-void SetLogAssertHandler(LogAssertHandlerFunction handler) {
-  log_assert_handler = handler;
-}
-
-// Called by logging functions to ensure that debug_file is initialized
-// and can be used for writing. Returns false if the file could not be
-// initialized. debug_file will be NULL in this case.
-bool VerifyLogFileHandle() {
-  if (log_file)
-    return true;
-
-  if (!log_file_name[0]) {
-    // nobody has called InitLogging to specify a debug log file, so here we
-    // initialize the log file name to the default
-    GetModuleFileName(NULL, log_file_name, MAX_PATH);
-    TCHAR* last_backslash = _tcsrchr(log_file_name, '\\');
-    if (last_backslash)
-      last_backslash[1] = 0; // name now ends with the backslash
-    _tcscat(log_file_name, _T("debug.log"));
-  }
-
-  log_file = CreateFile(log_file_name, GENERIC_WRITE,
-                        FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
-                        OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
-  if (log_file == INVALID_HANDLE_VALUE || log_file == NULL) {
-    log_file = NULL;
-    return false;
-  }
-  SetFilePointer(log_file, 0, 0, FILE_END);
-  return true;
-}
-
-// Displays a message box to the user with the error message in it. For
-// Windows programs, it's possible that the message loop is messed up on
-// a fatal error, and creating a MessageBox will cause that message loop
-// to be run. Instead, we try to spawn another process that displays its
-// command line. We look for "Debug Message.exe" in the same directory as
-// the application. If it exists, we use it, otherwise, we use a regular
-// message box.
-void DisplayDebugMessage(const std::string& str) {
-  if (str.empty())
-    return;
-
-  // look for the debug dialog program next to our application
-  wchar_t prog_name[MAX_PATH];
-  GetModuleFileNameW(NULL, prog_name, MAX_PATH);
-  wchar_t* backslash = wcsrchr(prog_name, '\\');
-  if (backslash)
-    backslash[1] = 0;
-  wcsncat(prog_name, L"DebugMessage.exe", MAX_PATH);
-  prog_name[MAX_PATH - 1] = L'\0';
-
-  // stupid CreateProcess requires a non-const command line and may modify it.
-  // We also want to use the wide string
-  int charcount = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), -1, NULL, 0);
-  if (!charcount)
-    return;
-  scoped_array<wchar_t> cmdline(new wchar_t[charcount]);
-  if (!MultiByteToWideChar(CP_UTF8, 0, str.c_str(), -1, cmdline.get(),
-      charcount))
-    return;
-
-  STARTUPINFO startup_info;
-  memset(&startup_info, 0, sizeof(startup_info));
-  startup_info.cb = sizeof(startup_info);
-
-  PROCESS_INFORMATION process_info;
-  if (CreateProcessW(prog_name, cmdline.get(), NULL, NULL, false, 0, NULL,
-                     NULL, &startup_info, &process_info)) {
-    WaitForSingleObject(process_info.hProcess, INFINITE);
-    CloseHandle(process_info.hThread);
-    CloseHandle(process_info.hProcess);
-  } else {
-    // debug process broken, let's just do a message box
-    MessageBoxW(NULL, cmdline.get(), L"Fatal error", MB_OK | MB_ICONHAND);
-  }
-}
-
-LogMessage::LogMessage(const char* file, int line, LogSeverity severity, int)
-    : severity_(severity) {
-  Init(file, line);
-}
-
-LogMessage::LogMessage(const char* file, int line, const CheckOpString& result)
-    : severity_(LOG_FATAL) {
-  Init(file, line);
-  stream_ << "Check failed: " << (*result.str_);
-}
-
-LogMessage::LogMessage(const char* file, int line)
-     : severity_(LOG_INFO) {
-  Init(file, line);
-}
-
-LogMessage::LogMessage(const char* file, int line, LogSeverity severity)
-    : severity_(severity) {
-  Init(file, line);
-}
-
-// writes the common header info to the stream
-void LogMessage::Init(const char* file, int line) {
-  // log only the filename
-  const char* last_slash = strrchr(file, '\\');
-  if (last_slash)
-    file = last_slash + 1;
-
-  // TODO(omaha): It might be nice if the columns were fixed width.
-
-  stream_ <<  '[';
-  if (log_process_id)
-    stream_ << GetCurrentProcessId() << ':';
-  if (log_thread_id)
-    stream_ << GetCurrentThreadId() << ':';
-  if (log_timestamp) {
-    time_t t = time(NULL);
-#if _MSC_VER >= 1400
-    struct tm local_time = {0};
-    localtime_s(&local_time, &t);
-    struct tm* tm_time = &local_time;
-#else
-    struct tm* tm_time = localtime(&t);
-#endif
-    stream_ << std::setfill('0')
-            << std::setw(2) << 1 + tm_time->tm_mon
-            << std::setw(2) << tm_time->tm_mday
-            << '/'
-            << std::setw(2) << tm_time->tm_hour
-            << std::setw(2) << tm_time->tm_min
-            << std::setw(2) << tm_time->tm_sec
-            << ':';
-  }
-  if (log_tickcount)
-    stream_ << GetTickCount() << ':';
-  stream_ << log_severity_names[severity_] << ":" << file << "(" << line
-      << ")] ";
-}
-
-LogMessage::~LogMessage() {
-  // TODO(omaha) modify the macros so that nothing is executed when the log
-  // level is too high or there is
-  if (severity_ < min_log_level)
-    return;
-
-  std::string str_newline(stream_.str(), stream_.pcount());
-  str_newline.append("\r\n");
-  if (logging_destination != LOG_ONLY_TO_FILE)
-    OutputDebugStringA(str_newline.c_str());
-
-  // write to log file
-  if (logging_destination != LOG_ONLY_TO_SYSTEM_DEBUG_LOG &&
-      VerifyLogFileHandle()) {
-    // we can have multiple threads and/or processes, so try to prevent them
-    // from clobbering each other's writes
-    if (lock_log_file == LOCK_LOG_FILE) {
-      // Ensure that the mutex is initialized in case the client app did not
-      // call InitLogging. This is not thread safe. See below
-      InitLogMutex();
-
-      DWORD r = ::WaitForSingleObject(log_mutex, INFINITE);
-      DCHECK(r != WAIT_ABANDONED);
-    } else {
-      // use the critical section
-      if (!initialized_critical_section) {
-        // The client app did not call InitLogging, and so the critical section
-        // has not been created. We do this on demand, but if two threads try to
-        // do this at the same time, there will be a race condition to create
-        // the critical section. This is why InitLogging should be called from
-        // the main thread at the beginning of execution.
-        InitializeCriticalSection(&log_critical_section);
-        initialized_critical_section = true;
-      }
-      EnterCriticalSection(&log_critical_section);
-    }
-
-    SetFilePointer(log_file, 0, 0, SEEK_END);
-    DWORD num_written;
-    WriteFile(log_file, (void*)str_newline.c_str(), (DWORD)str_newline.length(),
-              &num_written, NULL);
-
-    if (lock_log_file == LOCK_LOG_FILE) {
-      ReleaseMutex(log_mutex);
-    } else {
-      LeaveCriticalSection(&log_critical_section);
-    }
-  }
-
-  if (severity_ == LOG_FATAL) {
-    // display a message or break into the debugger on a fatal error
-    if (::IsDebuggerPresent()) {
-      DebugBreak();
-    } else {
-      if (log_assert_handler) {
-        log_assert_handler(std::string(stream_.str(), stream_.pcount()));
-      } else {
-        // don't use the string with the newline, get a fresh version to send to
-        // the debug message process
-        DisplayDebugMessage(std::string(stream_.str(), stream_.pcount()));
-        TerminateProcess(GetCurrentProcess(), 1);
-      }
-    }
-  }
-
-  // Calling stream_.str() freezes the stream buffer.  A frozen buffer will
-  // not be freed during strstreambuf destruction.
-  stream_.freeze(false);
-}
-
-void CloseLogFile() {
-  if (!log_file)
-    return;
-
-  CloseHandle(log_file);
-  log_file = NULL;
-}
-
-} // namespace logging
-
-std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) {
-  if (!wstr || !wstr[0])
-    return out;
-
-  // compute the length of the buffer we'll need
-  int charcount = WideCharToMultiByte(CP_UTF8, 0, wstr, -1,
-                                      NULL, 0, NULL, NULL);
-  if (charcount == 0)
-    return out;
-
-  // convert
-  scoped_array<char> buf(new char[charcount]);
-  WideCharToMultiByte(CP_UTF8, 0, wstr, -1, buf.get(), charcount, NULL, NULL);
-  return out << buf.get();
-}
diff --git a/base/logging/logging.h b/base/logging/logging.h
deleted file mode 100644
index 4008561..0000000
--- a/base/logging/logging.h
+++ /dev/null
@@ -1,499 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_LOGGING_LOGGING_H__
-#define OMAHA_COMMON_LOGGING_LOGGING_H__
-
-#include <string>
-#include <cstring>
-#include <strstream>
-#include <tchar.h>
-
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-
-// This file provides logging facility for Windows client apps.
-//
-// Optional message capabilities
-// -----------------------------
-// Assertion failed messages and fatal errors are displayed in a dialog box
-// before the application exits. However, running this UI creates a message
-// loop, which causes application messages to be processed and potentially
-// dispatched to existing application windows. Since the application is in a
-// bad state when this assertion dialog is displayed, these messages may not
-// get processed and hang the dialog, or the application might go crazy.
-//
-// Therefore, it can be beneficial to display the error dialog in a separate
-// process from the main application. When the logging system needs to display
-// a fatal error dialog box, it will look for a program called
-// "DebugMessage.exe" in the same directory as the application executable. It
-// will run this application with the message as the command line, and will
-// not include the name of the application as is traditional for easier
-// parsing.
-//
-// The code for DebugMessage.exe is only one line. In WinMain, do:
-//   MessageBox(NULL, GetCommandLineW(), L"Fatal Error", 0);
-//
-// If DebugMessage.exe is not found, the logging code will use a normal
-// MessageBox, potentially causing the problems discussed above.
-
-
-// Instructions
-// ------------
-//
-// Make a bunch of macros for logging.  The way to log things is to stream
-// things to LOG(<a particular severity level>).  E.g.,
-//
-//   LOG(INFO) << "Found " << num_cookies << " cookies";
-//
-// You can also do conditional logging:
-//
-//   LOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
-//
-// The above will cause log messages to be output on the 1st, 11th, 21st, ...
-// times it is executed.  Note that the special COUNTER value is used to
-// identify which repetition is happening.
-//
-// The CHECK(condition) macro is active in both debug and release builds and
-// effectively performs a LOG(FATAL) which terminates the process and
-// generates a crashdump unless a debugger is attached.
-//
-// There are also "debug mode" logging macros like the ones above:
-//
-//   DLOG(INFO) << "Found cookies";
-//
-//   DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
-//
-// All "debug mode" logging is compiled away to nothing for non-debug mode
-// compiles.  LOG_IF and development flags also work well together
-// because the code can be compiled away sometimes.
-//
-// We also have
-//
-//   LOG_ASSERT(assertion);
-//   DLOG_ASSERT(assertion);
-//
-// which is syntactic sugar for {,D}LOG_IF(FATAL, assert fails) << assertion;
-//
-// We also override the standard 'assert' to use 'DLOG_ASSERT'.
-//
-// The supported severity levels for macros that allow you to specify one
-// are (in increasing order of severity) INFO, WARNING, ERROR, and FATAL.
-//
-// There is also the special severity of DFATAL, which logs FATAL in
-// debug mode, ERROR in normal mode.
-//
-// Very important: logging a message at the FATAL severity level causes
-// the program to terminate (after the message is logged).
-
-namespace logging {
-
-// Where to record logging output? A flat file and/or system debug log via
-// OutputDebugString. Defaults to LOG_ONLY_TO_FILE.
-enum LoggingDestination { LOG_ONLY_TO_FILE, 
-                          LOG_ONLY_TO_SYSTEM_DEBUG_LOG,
-                          LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG };
-
-// Indicates that the log file should be locked when being written to.
-// Often, there is no locking, which is fine for a single threaded program.
-// If logging is being done from multiple threads or there can be more than
-// one process doing the logging, the file should be locked during writes to
-// make each log outut atomic. Other writers will block.
-//
-// All processes writing to the log file must have their locking set for it to
-// work properly. Defaults to DONT_LOCK_LOG_FILE.
-enum LogLockingState { LOCK_LOG_FILE, DONT_LOCK_LOG_FILE };
-
-// On startup, should we delete or append to an existing log file (if any)?
-// Defaults to APPEND_TO_OLD_LOG_FILE.
-enum OldFileDeletionState { DELETE_OLD_LOG_FILE, APPEND_TO_OLD_LOG_FILE };
-
-// Sets the log file name and other global logging state. Calling this function
-// is recommended, and is normally done at the beginning of application init.
-// If you don't call it, all the flags will be initialized to their default
-// values, and there is a race condition that may leak a critical section
-// object if two threads try to do the first log at the same time.
-// See the definition of the enums above for descriptions and default values.
-//
-// The default log file is initialized to "debug.log" in the application
-// directory. You probably don't want this, especially since the program
-// directory may not be writable on an enduser's system.
-void InitLogging(const TCHAR* log_file, LoggingDestination logging_dest,
-                 LogLockingState lock_log, OldFileDeletionState delete_old);
-
-// Sets the log level. Anything at or above this level will be written to the
-// log file/displayed to the user (if applicable). Anything below this level
-// will be silently ignored. The log level defaults to 0 (everything is logged)
-// if this function is not called.
-void SetMinLogLevel(int level);
-
-// Sets the common items you want to be prepended to each log message.
-// process and thread IDs default to off, the timestamp defaults to on.
-// If this function is not called, logging defaults to writing the timestamp
-// only.
-void SetLogItems(bool enable_process_id, bool enable_thread_id,
-                 bool enable_timestamp, bool enable_tickcount);
-
-// Sets the Log Assert Handler that will be used to notify of check failures.
-// The default handler shows a dialog box, however clients can use this 
-// function to override with their own handling (e.g. a silent one for Unit
-// Tests)
-typedef void (*LogAssertHandlerFunction)(const std::string& str);
-void SetLogAssertHandler(LogAssertHandlerFunction handler);
-
-typedef int LogSeverity;
-const LogSeverity LOG_INFO = 0;
-const LogSeverity LOG_WARNING = 1;
-const LogSeverity LOG_ERROR = 2;
-const LogSeverity LOG_FATAL = 3;
-const LogSeverity LOG_NUM_SEVERITIES = 4;
-
-// LOG_DFATAL_LEVEL is LOG_FATAL in debug mode, ERROR in normal mode
-#ifdef NDEBUG
-const LogSeverity LOG_DFATAL_LEVEL = LOG_ERROR;
-#else
-const LogSeverity LOG_DFATAL_LEVEL = LOG_FATAL;
-#endif
-
-// A few definitions of macros that don't generate much code. These are used
-// by LOG() and LOG_IF, etc. Since these are used all over our code, it's
-// better to have compact code for these operations.
-#define COMPACT_GOOGLE_LOG_INFO \
-  logging::LogMessage(__FILE__, __LINE__)
-#define COMPACT_GOOGLE_LOG_WARNING \
-  logging::LogMessage(__FILE__, __LINE__, logging::LOG_WARNING)
-#define COMPACT_GOOGLE_LOG_ERROR \
-  logging::LogMessage(__FILE__, __LINE__, logging::LOG_ERROR)
-#define COMPACT_GOOGLE_LOG_FATAL \
-  logging::LogMessage(__FILE__, __LINE__, logging::LOG_FATAL)
-#define COMPACT_GOOGLE_LOG_DFATAL \
-  logging::LogMessage(__FILE__, __LINE__, logging::LOG_DFATAL_LEVEL)
-
-// wingdi.h defines ERROR to be 0. When we call LOG(ERROR), it gets
-// substituted with 0, and it expands to COMPACT_GOOGLE_LOG_0. To allow us
-// to keep using this syntax, we define this macro to do the same thing
-// as COMPACT_GOOGLE_LOG_ERROR, and also define ERROR the same way that
-// the Windows SDK does for consistency.
-#define ERROR 0
-#define COMPACT_GOOGLE_LOG_0 \
-  logging::LogMessage(__FILE__, __LINE__, logging::LOG_ERROR)
-
-// We use the preprocessor's merging operator, "##", so that, e.g.,
-// LOG(INFO) becomes the token COMPACT_GOOGLE_LOG_INFO.  There's some funny
-// subtle difference between ostream member streaming functions (e.g.,
-// ostream::operator<<(int) and ostream non-member streaming functions
-// (e.g., ::operator<<(ostream&, string&): it turns out that it's
-// impossible to stream something like a string directly to an unnamed
-// ostream. We employ a neat hack by calling the stream() member
-// function of LogMessage which seems to avoid the problem.
-
-#define LOG(severity) COMPACT_GOOGLE_LOG_ ## severity.stream()
-#define SYSLOG(severity) LOG(severity)
-
-#define LOG_IF(severity, condition) \
-  !(condition) ? (void) 0 : logging::LogMessageVoidify() & LOG(severity)
-#define SYSLOG_IF(severity, condition) LOG_IF(severity, condition)
-
-#define LOG_ASSERT(condition)  \
-  LOG_IF(FATAL, !(condition)) << "Assert failed: " #condition ". "
-#define SYSLOG_ASSERT(condition) \
-  SYSLOG_IF(FATAL, !(condition)) << "Assert failed: " #condition ". "
-
-// CHECK dies with a fatal error if condition is not true.  It is *not*
-// controlled by NDEBUG, so the check will be executed regardless of
-// compilation mode.
-#define CHECK(condition) \
-  LOG_IF(FATAL, !(condition)) << "Check failed: " #condition ". "
-
-// A container for a string pointer which can be evaluated to a bool -
-// true iff the pointer is NULL.
-struct CheckOpString {
-  CheckOpString(std::string* str) : str_(str) { }
-  // No destructor: if str_ is non-NULL, we're about to LOG(FATAL),
-  // so there's no point in cleaning up str_.
-  operator bool() const { return str_ != NULL; }
-  std::string* str_;
-};
-
-// Build the error message string.  This is separate from the "Impl"
-// function template because it is not performance critical and so can
-// be out of line, while the "Impl" code should be inline.
-template<class t1, class t2>
-std::string* MakeCheckOpString(const t1& v1, const t2& v2, const char* names) {
-  std::ostrstream ss;
-  ss << names << " (" << v1 << " vs. " << v2 << ")";
-  return new std::string(ss.str(), ss.pcount());
-}
-
-extern std::string* MakeCheckOpStringIntInt(int v1, int v2, const char* names);
-
-template<int, int>
-std::string* MakeCheckOpString(const int& v1, const int& v2, const char* names) {
-  return MakeCheckOpStringIntInt(v1, v2, names);
-}
-
-// Plus some debug-logging macros that get compiled to nothing for production
-//
-// DEBUG_MODE is for uses like
-//   if (DEBUG_MODE) foo.CheckThatFoo();
-// instead of
-//   #ifndef NDEBUG
-//     foo.CheckThatFoo();
-//   #endif
-
-#ifndef NDEBUG
-
-#define DLOG(severity) LOG(severity)
-#define DLOG_IF(severity, condition) LOG_IF(severity, condition)
-#define DLOG_ASSERT(condition) LOG_ASSERT(condition)
-
-// debug-only checking.  not executed in NDEBUG mode.
-enum { DEBUG_MODE = 1 };
-#define DCHECK(condition) \
-  LOG_IF(FATAL, !(condition)) << "Check failed: " #condition ". "
-
-// Helper functions for DCHECK_OP macro.
-// The (int, int) specialization works around the issue that the compiler
-// will not instantiate the template version of the function on values of
-// unnamed enum type - see comment below.
-#define DEFINE_DCHECK_OP_IMPL(name, op) \
-  template <class t1, class t2> \
-  inline std::string* Check##name##Impl(const t1& v1, const t2& v2, \
-                                        const char* names) { \
-    if (v1 op v2) return NULL; \
-    else return MakeCheckOpString(v1, v2, names); \
-  } \
-  inline std::string* Check##name##Impl(int v1, int v2, const char* names) { \
-    if (v1 op v2) return NULL; \
-    else return MakeCheckOpString(v1, v2, names); \
-  }
-DEFINE_DCHECK_OP_IMPL(EQ, ==)
-DEFINE_DCHECK_OP_IMPL(NE, !=)
-DEFINE_DCHECK_OP_IMPL(LE, <=)
-DEFINE_DCHECK_OP_IMPL(LT, < )
-DEFINE_DCHECK_OP_IMPL(GE, >=)
-DEFINE_DCHECK_OP_IMPL(GT, > )
-#undef DEFINE_DCHECK_OP_IMPL
-
-// Helper macro for binary operators.
-// Don't use this macro directly in your code, use CHECK_EQ et al below.
-#define DCHECK_OP(name, op, val1, val2)  \
-  while (logging::CheckOpString _result = \
-         logging::Check##name##Impl((val1), (val2), #val1 " " #op " " #val2)) \
-    logging::LogMessage(__FILE__, __LINE__, _result).stream()
-
-// Equality/Inequality checks - compare two values, and log a LOG_FATAL message
-// including the two values when the result is not as expected.  The values
-// must have operator<<(ostream, ...) defined.
-//
-// You may append to the error message like so:
-//   CHECK_NE(1, 2) << ": The world must be ending!";
-//
-// We are very careful to ensure that each argument is evaluated exactly
-// once, and that anything which is legal to pass as a function argument is
-// legal here.  In particular, the arguments may be temporary expressions
-// which will end up being destroyed at the end of the apparent statement,
-// for example:
-//   CHECK_EQ(string("abc")[1], 'b');
-//
-// WARNING: These don't compile correctly if one of the arguments is a pointer
-// and the other is NULL. To work around this, simply static_cast NULL to the
-// type of the desired pointer.
-
-#define DCHECK_EQ(val1, val2) DCHECK_OP(EQ, ==, val1, val2)
-#define DCHECK_NE(val1, val2) DCHECK_OP(NE, !=, val1, val2)
-#define DCHECK_LE(val1, val2) DCHECK_OP(LE, <=, val1, val2)
-#define DCHECK_LT(val1, val2) DCHECK_OP(LT, < , val1, val2)
-#define DCHECK_GE(val1, val2) DCHECK_OP(GE, >=, val1, val2)
-#define DCHECK_GT(val1, val2) DCHECK_OP(GT, > , val1, val2)
-
-// Helper functions for string comparisons.
-// To avoid bloat, the definitions are in logging.cc.
-#define DECLARE_DCHECK_STROP_IMPL(func, expected) \
-  std::string* Check##func##expected##Impl(const char* s1, \
-                                           const char* s2, \
-                                           const char* names);
-DECLARE_DCHECK_STROP_IMPL(strcmp, true)
-DECLARE_DCHECK_STROP_IMPL(strcmp, false)
-DECLARE_DCHECK_STROP_IMPL(_stricmp, true)
-DECLARE_DCHECK_STROP_IMPL(_stricmp, false)
-#undef DECLARE_DCHECK_STROP_IMPL
-
-// Helper macro for string comparisons.
-// Don't use this macro directly in your code, use CHECK_STREQ et al below.
-#define DCHECK_STROP(func, op, expected, s1, s2) \
-  while (CheckOpString _result = \
-      logging::Check##func##expected##Impl((s1), (s2), \
-                                           #s1 " " #op " " #s2)) \
-    LOG(FATAL) << *_result.str_
-
-// String (char*) equality/inequality checks.
-// CASE versions are case-insensitive.
-//
-// Note that "s1" and "s2" may be temporary strings which are destroyed
-// by the compiler at the end of the current "full expression"
-// (e.g. DCHECK_STREQ(Foo().c_str(), Bar().c_str())).
-
-#define DCHECK_STREQ(s1, s2) DCHECK_STROP(strcmp, ==, true, s1, s2)
-#define DCHECK_STRNE(s1, s2) DCHECK_STROP(strcmp, !=, false, s1, s2)
-#define DCHECK_STRCASEEQ(s1, s2) DCHECK_STROP(_stricmp, ==, true, s1, s2)
-#define DCHECK_STRCASENE(s1, s2) DCHECK_STROP(_stricmp, !=, false, s1, s2)
-
-#define DCHECK_INDEX(I,A) DCHECK(I < (sizeof(A)/sizeof(A[0])))
-#define DCHECK_BOUND(B,A) DCHECK(B <= (sizeof(A)/sizeof(A[0])))
-
-#else  // NDEBUG
-
-#define DLOG(severity) \
-  true ? (void) 0 : logging::LogMessageVoidify() & LOG(severity)
-
-#define DLOG_IF(severity, condition) \
-  true ? (void) 0 : logging::LogMessageVoidify() & LOG(severity)
-
-#define DLOG_ASSERT(condition) \
-  true ? (void) 0 : LOG_ASSERT(condition)
-
-enum { DEBUG_MODE = 0 };
-
-// This macro can be followed by a sequence of stream parameters in
-// non-debug mode. The DCHECK and friends macros use this so that
-// the expanded expression DCHECK(foo) << "asdf" is still syntactically
-// valid, even though the expression will get optimized away.
-#define NDEBUG_EAT_STREAM_PARAMETERS \
-  logging::LogMessage(__FILE__, __LINE__).stream()
-
-#define DCHECK(condition) \
-  while (false) NDEBUG_EAT_STREAM_PARAMETERS
-
-#define DCHECK_EQ(val1, val2) \
-  while (false) NDEBUG_EAT_STREAM_PARAMETERS
-
-#define DCHECK_NE(val1, val2) \
-  while (false) NDEBUG_EAT_STREAM_PARAMETERS
-
-#define DCHECK_LE(val1, val2) \
-  while (false) NDEBUG_EAT_STREAM_PARAMETERS
-
-#define DCHECK_LT(val1, val2) \
-  while (false) NDEBUG_EAT_STREAM_PARAMETERS
-
-#define DCHECK_GE(val1, val2) \
-  while (false) NDEBUG_EAT_STREAM_PARAMETERS
-
-#define DCHECK_GT(val1, val2) \
-  while (false) NDEBUG_EAT_STREAM_PARAMETERS
-
-#define DCHECK_STREQ(str1, str2) \
-  while (false) NDEBUG_EAT_STREAM_PARAMETERS
-
-#define DCHECK_STRCASEEQ(str1, str2) \
-  while (false) NDEBUG_EAT_STREAM_PARAMETERS
-
-#define DCHECK_STRNE(str1, str2) \
-  while (false) NDEBUG_EAT_STREAM_PARAMETERS
-
-#define DCHECK_STRCASENE(str1, str2) \
-  while (false) NDEBUG_EAT_STREAM_PARAMETERS
-
-#endif  // NDEBUG
-
-#define NOTREACHED() DCHECK(false)
-
-// Redefine the standard assert to use our nice log files
-#undef assert
-#define assert(x) DLOG_ASSERT(x)
-
-// This class more or less represents a particular log message.  You
-// create an instance of LogMessage and then stream stuff to it.
-// When you finish streaming to it, ~LogMessage is called and the
-// full message gets streamed to the appropriate destination.
-//
-// You shouldn't actually use LogMessage's constructor to log things,
-// though.  You should use the LOG() macro (and variants thereof)
-// above.
-class LogMessage {
- public:
-  LogMessage(const char* file, int line, LogSeverity severity, int ctr);
-
-  // Two special constructors that generate reduced amounts of code at
-  // LOG call sites for common cases.
-  //
-  // Used for LOG(INFO): Implied are:
-  // severity = LOG_INFO, ctr = 0
-  //
-  // Using this constructor instead of the more complex constructor above
-  // saves a couple of bytes per call site.
-  LogMessage(const char* file, int line);
-
-  // Used for LOG(severity) where severity != INFO.  Implied
-  // are: ctr = 0
-  //
-  // Using this constructor instead of the more complex constructor above
-  // saves a couple of bytes per call site.
-  LogMessage(const char* file, int line, LogSeverity severity);
-
-  // A special constructor used for check failures.
-  // Implied severity = LOG_FATAL
-  LogMessage(const char* file, int line, const CheckOpString& result);
-
-  ~LogMessage();
-
-  std::ostream& stream() { return stream_; }
-
- private:
-  void Init(const char* file, int line);
-
-  LogSeverity severity_;
-  std::ostrstream stream_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(LogMessage);
-};
-
-// A non-macro interface to the log facility; (useful
-// when the logging level is not a compile-time constant).
-inline void LogAtLevel(int const log_level, std::string const &msg) {
-  LogMessage(__FILE__, __LINE__, log_level).stream() << msg;
-}
-
-// This class is used to explicitly ignore values in the conditional
-// logging macros.  This avoids compiler warnings like "value computed
-// is not used" and "statement has no effect".
-class LogMessageVoidify {
- public:
-  LogMessageVoidify() { }
-  // This has to be an operator with a precedence lower than << but
-  // higher than ?:
-  void operator&(std::ostream&) { }
-};
-
-// Closes the log file explicitly if open.
-// NOTE: Since the log file is opened as necessary by the action of logging
-//       statements, there's no guarantee that it will stay closed
-//       after this call.
-void CloseLogFile();
-
-} // namespace Logging
-
-// These functions are provided as a convenience for logging, which is where we
-// use streams (it is against Google style to use streams in other places). It
-// is designed to allow you to emit non-ASCII Unicode strings to the log file,
-// which is normally ASCII. It is relatively slow, so try not to use it for
-// common cases. Non-ASCII characters will be converted to UTF-8 by these operators.
-std::ostream& operator<<(std::ostream& out, const wchar_t* wstr);
-inline std::ostream& operator<<(std::ostream& out, const std::wstring& wstr) {
-  return out << wstr.c_str();
-}
-
-#endif  // OMAHA_COMMON_LOGGING_LOGGING_H__
diff --git a/base/logging_unittest.cc b/base/logging_unittest.cc
deleted file mode 100644
index 5b5156e..0000000
--- a/base/logging_unittest.cc
+++ /dev/null
@@ -1,268 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "base/basictypes.h"
-#include "omaha/base/logging.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(LoggingTest, Logging) {
-#ifdef _DEBUG
-  OPT_LOG(L1, (_T("[OPT_LOG from debug build.]")));
-#else
-  OPT_LOG(L1, (_T("[OPT_LOG from optimized build.]")));
-#endif
-}
-
-class FileLogWriterTest : public testing::Test {
- public:
-
-  int FindFirstInMultiString(const TCHAR* multi_str,
-                             size_t count,
-                             const TCHAR* str) {
-    return FileLogWriter::FindFirstInMultiString(multi_str, count, str);
-  }
-};
-
-class HistoryTest : public testing::Test {
- protected:
-  HistoryTest() {
-    logging_ = GetLogging();
-  }
-
-  void AppendToHistory(const wchar_t* msg) {
-    logging_->AppendToHistory(msg);
-  }
-
-  CString GetHistory() {
-    return logging_->GetHistory();
-  }
-
- private:
-  Logging* logging_;
-};
-
-#define EOS _T("")
-TEST_F(FileLogWriterTest, FindInMultiString) {
-  // One string of one char.
-  const TCHAR s1[] = _T("a\0") EOS;
-  EXPECT_EQ(FindFirstInMultiString(s1, arraysize(s1), _T("a")), 0);
-
-  // One string.
-  const TCHAR s2[] = _T("abc\0") EOS;
-  EXPECT_EQ(FindFirstInMultiString(s2, arraysize(s2), _T("abc")), 0);
-
-  // Two strings of one char.
-  const TCHAR s3[] = _T("a\0b\0") EOS;
-  EXPECT_EQ(FindFirstInMultiString(s3, arraysize(s3), _T("b")), 2);
-
-  // Two strings.
-  const TCHAR s4[] = _T("ab\0cde\0") EOS;
-  EXPECT_EQ(FindFirstInMultiString(s4, arraysize(s4), _T("cde")), 3);
-
-  // Three strings one char.
-  const TCHAR s5[] = _T("a\0b\0c\0") EOS;
-  EXPECT_EQ(FindFirstInMultiString(s5, arraysize(s5), _T("c")), 4);
-
-  // Many strings.
-  const TCHAR s6[] = _T("a\0bcd\0efgh\0") EOS;
-  EXPECT_EQ(FindFirstInMultiString(s6, arraysize(s6), _T("efgh")), 6);
-
-  // Many strings including empty string.
-  const TCHAR s7[] = _T("a\0\0bc\0\0de\0fg") EOS;
-  EXPECT_EQ(FindFirstInMultiString(s7, arraysize(s7), _T("fg")), 10);
-
-  // Many strings, empty string at the end, negative test.
-  const TCHAR s8[] = _T("a\0bcd\0efgh\0\0") EOS;
-  EXPECT_EQ(FindFirstInMultiString(s8, arraysize(s8), _T("foo")), -1);
-
-  // Another negative test.
-  const TCHAR s9[] = _T("a\0bcd\0\0\0efgh\0") EOS;
-  EXPECT_EQ(FindFirstInMultiString(s9, arraysize(s9), _T("foo")), -1);
-
-  // Empty string is always found.
-  const TCHAR s10[] = _T("\0") EOS;
-  EXPECT_EQ(FindFirstInMultiString(s10, arraysize(s10), _T("\0")), 0);
-
-  const TCHAR s11[] = _T("\0") EOS;
-  EXPECT_EQ(FindFirstInMultiString(s11, arraysize(s11), _T("a")), -1);
-}
-
-TEST_F(HistoryTest, GetHistory) {
-  EXPECT_TRUE(GetHistory().IsEmpty());
-
-  const TCHAR msg1[] = _T("Hello");
-  AppendToHistory(msg1);
-  EXPECT_STREQ(msg1, GetHistory());
-  EXPECT_TRUE(GetHistory().IsEmpty());
-}
-
-TEST_F(HistoryTest, AppendToHistoryTest) {
-  // Test one character.
-  const TCHAR msg1[] = _T("A");
-  AppendToHistory(msg1);
-  EXPECT_STREQ(msg1, GetHistory());
-
-  // Test small string.
-  const TCHAR msg2[] = _T("ABCD");
-  AppendToHistory(msg2);
-  EXPECT_STREQ(msg2, GetHistory());
-
-  // Test one string that fills the buffer.
-  TCHAR msg3[kMaxHistoryBufferSize + 1] = {0};
-  for (int i = 0; i <= kMaxHistoryBufferSize; ++i) {
-    msg3[i] = _T('A');
-  }
-  msg3[kMaxHistoryBufferSize] = _T('\0');
-  AppendToHistory(msg3);
-  EXPECT_STREQ(msg3, GetHistory());
-
-  // Test set of strings that exactly fill buffer.
-  const int test_buffer_size = 64;
-  TCHAR msg4[test_buffer_size + 1] = {0};
-  for (int i = 0; i <= test_buffer_size; ++i) {
-    msg4[i] = _T('A');
-  }
-  msg4[test_buffer_size] = _T('\0');
-
-  int num_times_to_append = kMaxHistoryBufferSize / test_buffer_size;
-  EXPECT_EQ(kMaxHistoryBufferSize, num_times_to_append * test_buffer_size);
-  for (int i = 0; i < num_times_to_append; ++i) {
-    AppendToHistory(msg4);
-  }
-  EXPECT_STREQ(msg3, GetHistory());
-}
-
-TEST_F(HistoryTest, AppendToHistoryTest_WrapAround) {
-  // Test string that wraps around the buffer.
-  // First fill kMaxHistoryBufferSize - 1 with one string, then use
-  // another string of length 2("XX"), and another string to length of length 3.
-  // "XFFFGGGGG....GGGX" should be the result. The returned string should
-  // be in correct FIFO order i.e. "GGGGG......XXFFF".
-  const TCHAR msg6[] = _T("XX");
-  const TCHAR msg7[] = _T("FFF");
-  const int test_buffer_size = kMaxHistoryBufferSize - 1;
-  TCHAR msg5[test_buffer_size + 1] = {0};
-  TCHAR expected_buffer[kMaxHistoryBufferSize + 1] = {0};
-  for (int i = 0; i <= test_buffer_size; ++i) {
-    msg5[i] = _T('G');
-  }
-  msg5[test_buffer_size] = _T('\0');
-
-  // Call test method.
-  AppendToHistory(msg5);
-  AppendToHistory(msg6);
-  AppendToHistory(msg7);
-
-  // Create the expected string.
-  for (int i = 0; i <= kMaxHistoryBufferSize; ++i) {
-    expected_buffer[i] = _T('G');
-  }
-  int msg6len = wcslen(msg6);
-  int msg7len = wcslen(msg7);
-  memcpy(expected_buffer + kMaxHistoryBufferSize - msg6len - msg7len,
-         msg6,
-         msg6len * sizeof(TCHAR));
-  memcpy(expected_buffer + kMaxHistoryBufferSize - msg7len,
-         msg7,
-         msg7len * sizeof(TCHAR));
-  expected_buffer[kMaxHistoryBufferSize] = _T('\0');
-  EXPECT_STREQ(expected_buffer, GetHistory());
-}
-
-TEST_F(HistoryTest, AppendToHistoryTest_AnotherWrapAroundTest) {
-  // Test string that wraps around the buffer.
-  // First fill the kMaxHistoryBufferSize - 1 with one string, then fill it with
-  // another string of same length.
-  const int test_buffer_size = kMaxHistoryBufferSize - 1;
-  TCHAR msg2[test_buffer_size + 1] = {0};
-  TCHAR msg1[test_buffer_size + 1] = {0};
-  TCHAR expected_buffer[kMaxHistoryBufferSize + 1] = {0};
-  for (int i = 0; i <= test_buffer_size; ++i) {
-    msg1[i] = _T('G');
-    msg2[i] = _T('J');
-  }
-  msg2[test_buffer_size] = _T('\0');
-  msg1[test_buffer_size] = _T('\0');
-
-  // Call test method.
-  AppendToHistory(msg1);
-  AppendToHistory(msg2);
-
-  // Create the expected string.
-  for (int i = 0; i <= kMaxHistoryBufferSize; ++i) {
-    expected_buffer[i] = _T('J');
-  }
-  expected_buffer[0] = _T('G');
-  expected_buffer[kMaxHistoryBufferSize] = _T('\0');
-  EXPECT_STREQ(expected_buffer, GetHistory());
-}
-
-TEST_F(HistoryTest, AppendToHistoryTest_LotsOfLogs) {
-  // Run over a number of Append calls, with strings length
-  // (kMaxHistoryBufferSize / 2) + 1, causing wrap on every run.
-  TCHAR expected_buffer[kMaxHistoryBufferSize + 1] = {0};
-  const int test_buffer_size = (kMaxHistoryBufferSize / 2) + 1;
-  TCHAR msg1[test_buffer_size + 1] = {0};
-  for (int test_char = 'A'; test_char <= 'Z'; ++test_char) {
-    for (int i = 0; i <= test_buffer_size; ++i) {
-      msg1[i] = static_cast<TCHAR>(test_char);
-    }
-    msg1[test_buffer_size] = _T('\0');
-
-    // Call test method.
-    AppendToHistory(msg1);
-  }
-
-  // Create the expected string.
-  int i = 0;
-  for (; i < test_buffer_size - 2; ++i) {
-    expected_buffer[i] = _T('Y');
-  }
-  for (; i <= kMaxHistoryBufferSize; ++i) {
-    expected_buffer[i] = _T('Z');
-  }
-  expected_buffer[kMaxHistoryBufferSize] = _T('\0');
-  EXPECT_STREQ(expected_buffer, GetHistory());
-}
-
-TEST_F(HistoryTest, AppendToHistoryTest_LargeBuffer) {
-  // Test with a message that is larger than the buffer.
-  const int test_buffer_size = kMaxHistoryBufferSize + 10;
-  TCHAR msg4[test_buffer_size + 1] = {0};
-  TCHAR expected_buffer[kMaxHistoryBufferSize + 1] = {0};
-  for (int i = 0; i < test_buffer_size; ++i) {
-    msg4[i] = _T('A');
-  }
-  msg4[test_buffer_size] = _T('\0');
-
-  for (int i = 0; i <= kMaxHistoryBufferSize; ++i) {
-    expected_buffer[i] = _T('A');
-  }
-  expected_buffer[kMaxHistoryBufferSize] = _T('\0');
-
-  AppendToHistory(msg4);
-  EXPECT_STREQ(expected_buffer, GetHistory());
-}
-
-TEST_F(HistoryTest, AppendToHistoryTest_EmptyBuffer) {
-  CString test_string;
-  AppendToHistory(test_string);
-  EXPECT_TRUE(GetHistory().IsEmpty());
-}
-
-}  // namespace omaha
-
diff --git a/base/marshal_by_value.h b/base/marshal_by_value.h
deleted file mode 100644
index 4a87a8c..0000000
--- a/base/marshal_by_value.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// This is an implementation of IMarshal that always marshals by value. class T
-// needs to derive from MarshalByValue, and expose IMarshal through
-// QueryInterface. class T also needs to expose the IPersistStream-style methods
-// GetSizeMax(), Save(), and Load().
-
-#ifndef OMAHA_BASE_MARSHAL_BY_VALUE_H_
-#define OMAHA_BASE_MARSHAL_BY_VALUE_H_
-
-#include <atlbase.h>
-#include "omaha/base/debug.h"
-
-namespace omaha {
-
-template <class T>
-class ATL_NO_VTABLE MarshalByValue : public IMarshal {
- public:
-  STDMETHOD(GetUnmarshalClass)(REFIID, void*, DWORD, void*, DWORD,
-                               CLSID* clsid) {
-    ASSERT1(clsid);
-    *clsid = T::GetObjectCLSID();
-    return S_OK;
-  }
-
-  STDMETHOD(ReleaseMarshalData)(IStream* stream) {
-    UNREFERENCED_PARAMETER(stream);
-    return S_OK;
-  }
-
-  STDMETHOD(DisconnectObject)(DWORD) {
-    return S_OK;
-  }
-
-  STDMETHOD(GetMarshalSizeMax)(REFIID, void*, DWORD, void*, DWORD,
-                               DWORD* size) {
-    ASSERT1(size);
-
-    T* persist = static_cast<T*>(this);
-    ULARGE_INTEGER size_max = {0};
-    HRESULT hr = persist->GetSizeMax(&size_max);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    *size = size_max.LowPart;
-    return S_OK;
-  }
-
-  STDMETHOD(MarshalInterface)(IStream* stream, REFIID, void*, DWORD, void*,
-                              DWORD) {
-    ASSERT1(stream);
-
-    T* persist = static_cast<T*>(this);
-    return persist->Save(stream, FALSE);
-  }
-
-  STDMETHOD(UnmarshalInterface)(IStream* stream, REFIID iid, void** ptr) {
-    ASSERT1(stream);
-    ASSERT1(ptr);
-
-    T* persist = static_cast<T*>(this);
-    HRESULT hr = persist->Load(stream);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    return persist->QueryInterface(iid, ptr);
-  }
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_MARSHAL_BY_VALUE_H_
-
diff --git a/base/md5.cc b/base/md5.cc
deleted file mode 100644
index e357ee3..0000000
--- a/base/md5.cc
+++ /dev/null
@@ -1,453 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-/*
- * md5_opt.c V1.0 - optimized md5c.c from RFC1321 reference implementation
- *
- * Copyright (c) 1995 University of Southern California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation, advertising
- * materials, and other materials related to such distribution and use
- * acknowledge that the software was developed by the University of
- * Southern California, Information Sciences Institute.  The name of the
- * University may not be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- J. Touch / touch@isi.edu
- 5/1/95
-
-*/
-/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
- */
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
-rights reserved.
-
-License to copy and use this software is granted provided that it
-is identified as the "RSA Data Security, Inc. MD5 Message-Digest
-Algorithm" in all material mentioning or referencing this software
-or this function.
-
-License is also granted to make and use derivative works provided
-that such works are identified as "derived from the RSA Data
-Security, Inc. MD5 Message-Digest Algorithm" in all material
-mentioning or referencing the derived work.
-
-RSA Data Security, Inc. makes no representations concerning either
-the merchantability of this software or the suitability of this
-software for any particular purpose. It is provided "as is"
-without express or implied warranty of any kind.
-
-These notices must be retained in any copies of any part of this
-documentation and/or software.
-*/
-
-#include "omaha/base/md5.h"
-#include "omaha/base/debug.h"
-
-namespace omaha {
-
-#if (defined(i386) || defined (__i386__) || defined (_M_IX86) || defined(__alpha))  // little-endian
-#undef REORDER
-#else
-#define REORDER 1
-#endif
-
-// Constants for MD5Transform routine
-#define kS11 7
-#define kS12 12
-#define kS13 17
-#define kS14 22
-#define kS21 5
-#define kS22 9
-#define kS23 14
-#define kS24 20
-#define kS31 4
-#define kS32 11
-#define kS33 16
-#define kS34 23
-#define kS41 6
-#define kS42 10
-#define kS43 15
-#define kS44 21
-
-static void MD5Transform (uint32 [4], unsigned char [64]);
-static void Encode (unsigned char *, uint32 *, unsigned int);
-#ifdef REORDER
-static void Decode (uint32 *, unsigned char *, unsigned int);
-#endif
-
-// SELECTANY static unsigned char PADDING[64] = {
-static unsigned char PADDING[64] = {
-    0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-// F, G, H and I are basic MD5 functions.
-#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
-#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
-#define H(x, y, z) ((x) ^ (y) ^ (z))
-#define I(x, y, z) ((y) ^ ((x) | (~z)))
-
-// ROTATE_LEFT rotates x left n bits.
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
-
-// FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
-// Rotation is separate from addition to prevent recomputation.
-#define FF(a, b, c, d, x, s, ac) { \
-    (a) += F ((b), (c), (d)) + (x) + (uint32)(ac); \
-    (a) = ROTATE_LEFT ((a), (s)); \
-    (a) += (b); \
-    }
-#define GG(a, b, c, d, x, s, ac) { \
-    (a) += G ((b), (c), (d)) + (x) + (uint32)(ac); \
-    (a) = ROTATE_LEFT ((a), (s)); \
-    (a) += (b); \
-    }
-#define HH(a, b, c, d, x, s, ac) { \
-    (a) += H ((b), (c), (d)) + (x) + (uint32)(ac); \
-    (a) = ROTATE_LEFT ((a), (s)); \
-    (a) += (b); \
-    }
-#define II(a, b, c, d, x, s, ac) { \
-    (a) += I ((b), (c), (d)) + (x) + (uint32)(ac); \
-    (a) = ROTATE_LEFT ((a), (s)); \
-    (a) += (b); \
-    }
-
-// MD5 initialization. Begins an MD5 operation, writing a new context.
-void MD5Init (MD5_CTX *context) {
-    ASSERT(context, (L""));
-
-    context->count[0] = context->count[1] = 0;
-    // Load magic initialization constants.
-    context->state[0] = 0x67452301;
-    context->state[1] = 0xefcdab89;
-    context->state[2] = 0x98badcfe;
-    context->state[3] = 0x10325476;
-}
-
-// MD5 block update operation. Continues an MD5 message-digest
-// operation, processing another message block, and updating the context.
-void MD5Update (MD5_CTX *context, unsigned char *input, unsigned int inputLen) {
-    ASSERT(input, (L""));
-    ASSERT(context, (L""));
-
-    unsigned int i, index, partLen;
-
-    // Compute number of bytes mod 64
-    index = (unsigned int)((context->count[0] >> 3) & 0x3F);
-
-    // Update number of bits
-    if ((context->count[0] += ((uint32)inputLen << 3)) < ((uint32)inputLen << 3))
-        context->count[1]++;
-
-    context->count[1] += ((uint32)inputLen >> 29);
-    partLen = 64 - index;
-
-    // Transform as many times as possible
-    if (inputLen >= partLen) {
-       memcpy ((POINTER)&context->buffer[index], (POINTER)input, partLen);
-       MD5Transform (context->state, context->buffer);
-
-       for (i = partLen; i + 63 < inputLen; i += 64) MD5Transform (context->state, &input[i]);
-       index = 0;
-       }
-    else
-       i = 0;
-
-    // Buffer remaining input
-    memcpy ((POINTER)&context->buffer[index], (POINTER)&input[i], inputLen-i);
-}
-
-// MD5 finalization. Ends an MD5 message-digest operation, writing the
-// the message digest and zeroizing the context.
-void MD5Final (unsigned char digest[16], MD5_CTX *context) {
-    ASSERT(context, (L""));
-
-    unsigned char bits[8];
-    unsigned int index, padLen;
-
-    // Save number of bits
-    Encode (bits, context->count, 8);
-
-    // Pad out to 56 mod 64.
-    index = (unsigned int)((context->count[0] >> 3) & 0x3f);
-    padLen = (index < 56) ? (56 - index) : (120 - index);
-    MD5Update (context, PADDING, padLen);
-
-    // Append length (before padding)
-    MD5Update (context, bits, 8);
-    // Store state in digest
-    Encode (digest, context->state, 16);
-
-    // Zeroize sensitive information.
-    memset ((POINTER)context, 0, sizeof (*context));
-}
-
-// MD5 basic transformation. Transforms state based on block.
-void MD5Transform (uint32 state[4], unsigned char block[64]) {
-    // USC/ISI J. Touch - encourage pushing state variables into registers
-    register uint32 a = state[0], b = state[1], c = state[2], d = state[3];
-
-    /* USC/ISI J. Touch
-    decode and using copied data vs. direct use of input buffer
-    depends on whether reordering is required, which is a combination
-    of the byte order of the architecture and the command-line option
-    override
-    */
-
-#ifdef REORDER
-    uint32 x[16];
-
-    Decode (x, block, 64);
-
-    /* Round 1 */
-    FF (a, b, c, d, x[ 0], kS11, 0xd76aa478); /* 1 */
-    FF (d, a, b, c, x[ 1], kS12, 0xe8c7b756); /* 2 */
-    FF (c, d, a, b, x[ 2], kS13, 0x242070db); /* 3 */
-    FF (b, c, d, a, x[ 3], kS14, 0xc1bdceee); /* 4 */
-    FF (a, b, c, d, x[ 4], kS11, 0xf57c0faf); /* 5 */
-    FF (d, a, b, c, x[ 5], kS12, 0x4787c62a); /* 6 */
-    FF (c, d, a, b, x[ 6], kS13, 0xa8304613); /* 7 */
-    FF (b, c, d, a, x[ 7], kS14, 0xfd469501); /* 8 */
-    FF (a, b, c, d, x[ 8], kS11, 0x698098d8); /* 9 */
-    FF (d, a, b, c, x[ 9], kS12, 0x8b44f7af); /* 10 */
-    FF (c, d, a, b, x[10], kS13, 0xffff5bb1); /* 11 */
-    FF (b, c, d, a, x[11], kS14, 0x895cd7be); /* 12 */
-    FF (a, b, c, d, x[12], kS11, 0x6b901122); /* 13 */
-    FF (d, a, b, c, x[13], kS12, 0xfd987193); /* 14 */
-    FF (c, d, a, b, x[14], kS13, 0xa679438e); /* 15 */
-    FF (b, c, d, a, x[15], kS14, 0x49b40821); /* 16 */
-
-    /* Round 2 */
-    GG (a, b, c, d, x[ 1], kS21, 0xf61e2562); /* 17 */
-    GG (d, a, b, c, x[ 6], kS22, 0xc040b340); /* 18 */
-    GG (c, d, a, b, x[11], kS23, 0x265e5a51); /* 19 */
-    GG (b, c, d, a, x[ 0], kS24, 0xe9b6c7aa); /* 20 */
-    GG (a, b, c, d, x[ 5], kS21, 0xd62f105d); /* 21 */
-    GG (d, a, b, c, x[10], kS22,  0x2441453); /* 22 */
-    GG (c, d, a, b, x[15], kS23, 0xd8a1e681); /* 23 */
-    GG (b, c, d, a, x[ 4], kS24, 0xe7d3fbc8); /* 24 */
-    GG (a, b, c, d, x[ 9], kS21, 0x21e1cde6); /* 25 */
-    GG (d, a, b, c, x[14], kS22, 0xc33707d6); /* 26 */
-    GG (c, d, a, b, x[ 3], kS23, 0xf4d50d87); /* 27 */
-    GG (b, c, d, a, x[ 8], kS24, 0x455a14ed); /* 28 */
-    GG (a, b, c, d, x[13], kS21, 0xa9e3e905); /* 29 */
-    GG (d, a, b, c, x[ 2], kS22, 0xfcefa3f8); /* 30 */
-    GG (c, d, a, b, x[ 7], kS23, 0x676f02d9); /* 31 */
-    GG (b, c, d, a, x[12], kS24, 0x8d2a4c8a); /* 32 */
-
-    /* Round 3 */
-    HH (a, b, c, d, x[ 5], kS31, 0xfffa3942); /* 33 */
-    HH (d, a, b, c, x[ 8], kS32, 0x8771f681); /* 34 */
-    HH (c, d, a, b, x[11], kS33, 0x6d9d6122); /* 35 */
-    HH (b, c, d, a, x[14], kS34, 0xfde5380c); /* 36 */
-    HH (a, b, c, d, x[ 1], kS31, 0xa4beea44); /* 37 */
-    HH (d, a, b, c, x[ 4], kS32, 0x4bdecfa9); /* 38 */
-    HH (c, d, a, b, x[ 7], kS33, 0xf6bb4b60); /* 39 */
-    HH (b, c, d, a, x[10], kS34, 0xbebfbc70); /* 40 */
-    HH (a, b, c, d, x[13], kS31, 0x289b7ec6); /* 41 */
-    HH (d, a, b, c, x[ 0], kS32, 0xeaa127fa); /* 42 */
-    HH (c, d, a, b, x[ 3], kS33, 0xd4ef3085); /* 43 */
-    HH (b, c, d, a, x[ 6], kS34,  0x4881d05); /* 44 */
-    HH (a, b, c, d, x[ 9], kS31, 0xd9d4d039); /* 45 */
-    HH (d, a, b, c, x[12], kS32, 0xe6db99e5); /* 46 */
-    HH (c, d, a, b, x[15], kS33, 0x1fa27cf8); /* 47 */
-    HH (b, c, d, a, x[ 2], kS34, 0xc4ac5665); /* 48 */
-
-    /* Round 4 */
-    II (a, b, c, d, x[ 0], kS41, 0xf4292244); /* 49 */
-    II (d, a, b, c, x[ 7], kS42, 0x432aff97); /* 50 */
-    II (c, d, a, b, x[14], kS43, 0xab9423a7); /* 51 */
-    II (b, c, d, a, x[ 5], kS44, 0xfc93a039); /* 52 */
-    II (a, b, c, d, x[12], kS41, 0x655b59c3); /* 53 */
-    II (d, a, b, c, x[ 3], kS42, 0x8f0ccc92); /* 54 */
-    II (c, d, a, b, x[10], kS43, 0xffeff47d); /* 55 */
-    II (b, c, d, a, x[ 1], kS44, 0x85845dd1); /* 56 */
-    II (a, b, c, d, x[ 8], kS41, 0x6fa87e4f); /* 57 */
-    II (d, a, b, c, x[15], kS42, 0xfe2ce6e0); /* 58 */
-    II (c, d, a, b, x[ 6], kS43, 0xa3014314); /* 59 */
-    II (b, c, d, a, x[13], kS44, 0x4e0811a1); /* 60 */
-    II (a, b, c, d, x[ 4], kS41, 0xf7537e82); /* 61 */
-    II (d, a, b, c, x[11], kS42, 0xbd3af235); /* 62 */
-    II (c, d, a, b, x[ 2], kS43, 0x2ad7d2bb); /* 63 */
-    II (b, c, d, a, x[ 9], kS44, 0xeb86d391); /* 64 */
-
-#else
-    // USC/ISI J. Touch
-    // omit reordering, and use the input block as source data
-    /* Round 1 */
-    FF (a, b, c, d, ((uint32 *)block)[ 0], kS11, 0xd76aa478); /* 1 */
-    FF (d, a, b, c, ((uint32 *)block)[ 1], kS12, 0xe8c7b756); /* 2 */
-    FF (c, d, a, b, ((uint32 *)block)[ 2], kS13, 0x242070db); /* 3 */
-    FF (b, c, d, a, ((uint32 *)block)[ 3], kS14, 0xc1bdceee); /* 4 */
-    FF (a, b, c, d, ((uint32 *)block)[ 4], kS11, 0xf57c0faf); /* 5 */
-    FF (d, a, b, c, ((uint32 *)block)[ 5], kS12, 0x4787c62a); /* 6 */
-    FF (c, d, a, b, ((uint32 *)block)[ 6], kS13, 0xa8304613); /* 7 */
-    FF (b, c, d, a, ((uint32 *)block)[ 7], kS14, 0xfd469501); /* 8 */
-    FF (a, b, c, d, ((uint32 *)block)[ 8], kS11, 0x698098d8); /* 9 */
-    FF (d, a, b, c, ((uint32 *)block)[ 9], kS12, 0x8b44f7af); /* 10 */
-    FF (c, d, a, b, ((uint32 *)block)[10], kS13, 0xffff5bb1); /* 11 */
-    FF (b, c, d, a, ((uint32 *)block)[11], kS14, 0x895cd7be); /* 12 */
-    FF (a, b, c, d, ((uint32 *)block)[12], kS11, 0x6b901122); /* 13 */
-    FF (d, a, b, c, ((uint32 *)block)[13], kS12, 0xfd987193); /* 14 */
-    FF (c, d, a, b, ((uint32 *)block)[14], kS13, 0xa679438e); /* 15 */
-    FF (b, c, d, a, ((uint32 *)block)[15], kS14, 0x49b40821); /* 16 */
-
-    /* Round 2 */
-    GG (a, b, c, d, ((uint32 *)block)[ 1], kS21, 0xf61e2562); /* 17 */
-    GG (d, a, b, c, ((uint32 *)block)[ 6], kS22, 0xc040b340); /* 18 */
-    GG (c, d, a, b, ((uint32 *)block)[11], kS23, 0x265e5a51); /* 19 */
-    GG (b, c, d, a, ((uint32 *)block)[ 0], kS24, 0xe9b6c7aa); /* 20 */
-    GG (a, b, c, d, ((uint32 *)block)[ 5], kS21, 0xd62f105d); /* 21 */
-    GG (d, a, b, c, ((uint32 *)block)[10], kS22,  0x2441453); /* 22 */
-    GG (c, d, a, b, ((uint32 *)block)[15], kS23, 0xd8a1e681); /* 23 */
-    GG (b, c, d, a, ((uint32 *)block)[ 4], kS24, 0xe7d3fbc8); /* 24 */
-    GG (a, b, c, d, ((uint32 *)block)[ 9], kS21, 0x21e1cde6); /* 25 */
-    GG (d, a, b, c, ((uint32 *)block)[14], kS22, 0xc33707d6); /* 26 */
-    GG (c, d, a, b, ((uint32 *)block)[ 3], kS23, 0xf4d50d87); /* 27 */
-    GG (b, c, d, a, ((uint32 *)block)[ 8], kS24, 0x455a14ed); /* 28 */
-    GG (a, b, c, d, ((uint32 *)block)[13], kS21, 0xa9e3e905); /* 29 */
-    GG (d, a, b, c, ((uint32 *)block)[ 2], kS22, 0xfcefa3f8); /* 30 */
-    GG (c, d, a, b, ((uint32 *)block)[ 7], kS23, 0x676f02d9); /* 31 */
-    GG (b, c, d, a, ((uint32 *)block)[12], kS24, 0x8d2a4c8a); /* 32 */
-
-    /* Round 3 */
-    HH (a, b, c, d, ((uint32 *)block)[ 5], kS31, 0xfffa3942); /* 33 */
-    HH (d, a, b, c, ((uint32 *)block)[ 8], kS32, 0x8771f681); /* 34 */
-    HH (c, d, a, b, ((uint32 *)block)[11], kS33, 0x6d9d6122); /* 35 */
-    HH (b, c, d, a, ((uint32 *)block)[14], kS34, 0xfde5380c); /* 36 */
-    HH (a, b, c, d, ((uint32 *)block)[ 1], kS31, 0xa4beea44); /* 37 */
-    HH (d, a, b, c, ((uint32 *)block)[ 4], kS32, 0x4bdecfa9); /* 38 */
-    HH (c, d, a, b, ((uint32 *)block)[ 7], kS33, 0xf6bb4b60); /* 39 */
-    HH (b, c, d, a, ((uint32 *)block)[10], kS34, 0xbebfbc70); /* 40 */
-    HH (a, b, c, d, ((uint32 *)block)[13], kS31, 0x289b7ec6); /* 41 */
-    HH (d, a, b, c, ((uint32 *)block)[ 0], kS32, 0xeaa127fa); /* 42 */
-    HH (c, d, a, b, ((uint32 *)block)[ 3], kS33, 0xd4ef3085); /* 43 */
-    HH (b, c, d, a, ((uint32 *)block)[ 6], kS34,  0x4881d05); /* 44 */
-    HH (a, b, c, d, ((uint32 *)block)[ 9], kS31, 0xd9d4d039); /* 45 */
-    HH (d, a, b, c, ((uint32 *)block)[12], kS32, 0xe6db99e5); /* 46 */
-    HH (c, d, a, b, ((uint32 *)block)[15], kS33, 0x1fa27cf8); /* 47 */
-    HH (b, c, d, a, ((uint32 *)block)[ 2], kS34, 0xc4ac5665); /* 48 */
-
-    /* Round 4 */
-    II (a, b, c, d, ((uint32 *)block)[ 0], kS41, 0xf4292244); /* 49 */
-    II (d, a, b, c, ((uint32 *)block)[ 7], kS42, 0x432aff97); /* 50 */
-    II (c, d, a, b, ((uint32 *)block)[14], kS43, 0xab9423a7); /* 51 */
-    II (b, c, d, a, ((uint32 *)block)[ 5], kS44, 0xfc93a039); /* 52 */
-    II (a, b, c, d, ((uint32 *)block)[12], kS41, 0x655b59c3); /* 53 */
-    II (d, a, b, c, ((uint32 *)block)[ 3], kS42, 0x8f0ccc92); /* 54 */
-    II (c, d, a, b, ((uint32 *)block)[10], kS43, 0xffeff47d); /* 55 */
-    II (b, c, d, a, ((uint32 *)block)[ 1], kS44, 0x85845dd1); /* 56 */
-    II (a, b, c, d, ((uint32 *)block)[ 8], kS41, 0x6fa87e4f); /* 57 */
-    II (d, a, b, c, ((uint32 *)block)[15], kS42, 0xfe2ce6e0); /* 58 */
-    II (c, d, a, b, ((uint32 *)block)[ 6], kS43, 0xa3014314); /* 59 */
-    II (b, c, d, a, ((uint32 *)block)[13], kS44, 0x4e0811a1); /* 60 */
-    II (a, b, c, d, ((uint32 *)block)[ 4], kS41, 0xf7537e82); /* 61 */
-    II (d, a, b, c, ((uint32 *)block)[11], kS42, 0xbd3af235); /* 62 */
-    II (c, d, a, b, ((uint32 *)block)[ 2], kS43, 0x2ad7d2bb); /* 63 */
-    II (b, c, d, a, ((uint32 *)block)[ 9], kS44, 0xeb86d391); /* 64 */
-#endif  // REORDER
-
-    state[0] += a;
-    state[1] += b;
-    state[2] += c;
-    state[3] += d;
-
-#ifdef REORDER
-    memset ((POINTER)x, 0, sizeof (x));  // zero sensitive information
-#endif
-}
-
-// Encodes input (uint32) into output (unsigned char). Assumes len is a multiple of 4.
-void Encode (unsigned char *output, uint32 *input, unsigned int len) {
-    ASSERT(input, (L""));
-    ASSERT(output, (L""));
-
-    unsigned int i, j;
-
-    for (i = 0, j = 0; j < len; i++, j += 4) {
-        output[j] = (unsigned char)(input[i] & 0xff);
-        output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
-        output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
-        output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
-        }
-}
-
-#ifdef REORDER
-
-// Decodes input (unsigned char) into output (uint32). Assumes len is a multiple of 4.
-void Decode (uint32 *output, unsigned char *input, unsigned int len) {
-    ASSERT(input, (L""));
-    ASSERT(output, (L""));
-
-    register uint32 out,other;
-
-    // for (i = 0, j = 0; j < len; i++, j += 4)
-    // output[i] = ((uint32)input[j]) | (((uint32)input[j+1]) << 8) |
-    // (((uint32)input[j+2]) << 16) | (((uint32)input[j+3]) << 24);
-
-    // USC/ISI J. Touch
-    // these are optimized swap routines, in C code they cost more in "computation" operations, but less in
-    // "loads" than the above code, and run substantially faster as a result
-#if (!defined(hpux))
-#define swapbyte(src,dst) { \
-     out = ROTATE_LEFT((src),16); \
-     other = out >> 8; \
-     other &= 0x00ff00ff; \
-     out &= 0x00ff00ff; \
-     out <<= 8; \
-     (dst) = out | other; \
-     }
-#else
-#define swapbyte(src,dst) { \
-     (dst) = (ROTATE_LEFT((src),8) & 0x00ff00ff) | ROTATE_LEFT((src) & 0x00ff00ff,24); \
-     }
-#endif
-
-    // USC/ISI J. Touch
-    // unroll the loop above, because the code runs faster with constants for indices than even with variable indices
-    // as conventional (automatic) unrolling would perform (!)
-    swapbyte(((uint32 *)input)[0],output[0]);
-    swapbyte(((uint32 *)input)[1],output[1]);
-    swapbyte(((uint32 *)input)[2],output[2]);
-    swapbyte(((uint32 *)input)[3],output[3]);
-    swapbyte(((uint32 *)input)[4],output[4]);
-    swapbyte(((uint32 *)input)[5],output[5]);
-    swapbyte(((uint32 *)input)[6],output[6]);
-    swapbyte(((uint32 *)input)[7],output[7]);
-    swapbyte(((uint32 *)input)[8],output[8]);
-    swapbyte(((uint32 *)input)[9],output[9]);
-    swapbyte(((uint32 *)input)[10],output[10]);
-    swapbyte(((uint32 *)input)[11],output[11]);
-    swapbyte(((uint32 *)input)[12],output[12]);
-    swapbyte(((uint32 *)input)[13],output[13]);
-    swapbyte(((uint32 *)input)[14],output[14]);
-    swapbyte(((uint32 *)input)[15],output[15]);
-}
-
-#endif // #ifdef REORDER
-
-}  // namespace omaha
-
diff --git a/base/md5.h b/base/md5.h
deleted file mode 100644
index a688c3d..0000000
--- a/base/md5.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-/* MD5.H - header file for MD5C.C
-*/
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
-rights reserved.
-
-License to copy and use this software is granted provided that it
-is identified as the "RSA Data Security, Inc. MD5 Message-Digest
-Algorithm" in all material mentioning or referencing this software
-or this function.
-
-License is also granted to make and use derivative works provided
-that such works are identified as "derived from the RSA Data
-Security, Inc. MD5 Message-Digest Algorithm" in all material
-mentioning or referencing the derived work.
-
-RSA Data Security, Inc. makes no representations concerning either
-the merchantability of this software or the suitability of this
-software for any particular purpose. It is provided "as is"
-without express or implied warranty of any kind.
-
-These notices must be retained in any copies of any part of this
-documentation and/or software.
-*/
-
-/* GLOBAL.H - RSAREF types and constants
-*/
-
-#ifndef TR_COMMON_MD5_H_
-#define TR_COMMON_MD5_H_
-
-#include "base/basictypes.h"
-
-namespace omaha {
-
-/* POINTER defines a generic pointer type */
-typedef unsigned char *POINTER;
-
-/* MD5 context */
-typedef struct {
-  uint32 state[4];                                  /* state (ABCD) */
-  uint32 count[2];        /* number of bits, modulo 2^64 (lsb first) */
-  unsigned char buffer[64];                         /* input buffer */
-} MD5_CTX;
-
-void MD5Init (MD5_CTX *);
-void MD5Update (MD5_CTX *, unsigned char *, unsigned int);
-void MD5Final (unsigned char [16], MD5_CTX *);
-
-}  // namespace omaha
-
-#endif  // TR_COMMON_MD5_H_
diff --git a/base/md5_unittest.cc b/base/md5_unittest.cc
deleted file mode 100644
index 049ffe3..0000000
--- a/base/md5_unittest.cc
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-// MD5 unittest
-
-#include <atlstr.h>
-#include "omaha/base/debug.h"
-#include "omaha/base/md5.h"
-#include "omaha/base/string.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-void CheckMD5 (char *string, TCHAR *correct_digest) {
-    ASSERT_TRUE(correct_digest);
-    ASSERT_TRUE(string);
-
-    MD5_CTX context;
-    MD5Init (&context);
-    MD5Update (&context, (unsigned char *)string, strlen (string));
-    unsigned char digest[16];
-    MD5Final (digest, &context);
-
-    const DWORD digest_len = 32+1;
-    TCHAR digest_string[digest_len];
-    digest_string[31] = '\0';
-    digest_string[0] = '\0';
-
-    for (int i = 0; i < 16; i++) {
-        SafeStrCat (digest_string, SPRINTF (_T("%02x"), digest[i]), digest_len);
-    }
-
-    ASSERT_STREQ(digest_string, correct_digest);
-}
-
-TEST(Md5Test, MD5) {
-    CheckMD5 ("", _T("d41d8cd98f00b204e9800998ecf8427e"));
-    CheckMD5 ("a", _T("0cc175b9c0f1b6a831c399e269772661"));
-    CheckMD5 ("abc", _T("900150983cd24fb0d6963f7d28e17f72"));
-    CheckMD5 ("message digest", _T("f96b697d7cb7938d525a2f31aaf161d0"));
-    CheckMD5 ("abcdefghijklmnopqrstuvwxyz", _T("c3fcd3d76192e4007dfb496cca67e13b"));
-    CheckMD5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", _T("d174ab98d277d9f5a5611c2c9f419d9f"));
-    CheckMD5 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890", _T("57edf4a22be3c955ac49da2e2107b67a"));
-}
-
-}  // namespace omaha
-
diff --git a/base/module_utils.cc b/base/module_utils.cc
deleted file mode 100644
index c9f9e89..0000000
--- a/base/module_utils.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/module_utils.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-const int kLongPath = (_MAX_PATH * 2);
-const int kReallyLongPath = (kLongPath * 2);
-
-HMODULE ModuleFromStatic(void* pointer_to_static_in_module) {
-  ASSERT(pointer_to_static_in_module, (L""));
-
-  MEMORY_BASIC_INFORMATION info = { 0 };
-  VirtualQuery(reinterpret_cast<void*>(pointer_to_static_in_module),
-    &info, sizeof(info));
-  // Module handles are just the allocation base address of the module.
-  return reinterpret_cast<HMODULE>(info.AllocationBase);
-}
-
-bool GetModuleDirectory(HMODULE module, TCHAR* directory) {
-  ASSERT(directory, (L"Invalid arguments"));
-  if (!directory) {
-    return false;
-  }
-
-  // PathRemoveFileSpec only supports buffers up to MAX_PATH so we must
-  // limit ourselves to this.  It will "always" work anyway, given that
-  // our installation path is not absurdly deep.
-  if (0 == GetModuleFileName(module, directory, MAX_PATH)) {
-    ASSERT(false, (L"Path longer than MAX_PATH"));
-    return false;
-  }
-
-  if (!String_PathRemoveFileSpec(directory)) {
-    ASSERT(false, (L"PathRemoveFileSpec failed"));
-    // Ensure we don't return with an incorrect path in the buffer that was
-    // passed in.
-    ZeroMemory(directory, MAX_PATH * sizeof(TCHAR));
-    return false;
-  }
-
-  return true;
-}
-
-HRESULT GetModuleFileName(HMODULE module, CString* path) {
-  ASSERT(path, (_T("must be valid")));
-
-  // _MAX_PATH should cover at least 99% of the paths
-  int buf_size = _MAX_PATH;
-  int chars_copied = 0;
-  while ((chars_copied = ::GetModuleFileName(module,
-                                             CStrBuf(*path, buf_size + 1),
-                                             buf_size)) == buf_size) {
-    // We'll stop before things get ridiculous
-    if (buf_size >= kReallyLongPath) {
-      UTIL_LOG(LEVEL_ERROR,
-               (_T("[GetModuleFileName - unusually long path '%s']"), path));
-      chars_copied = 0;
-      ::SetLastError(ERROR_NOT_ENOUGH_MEMORY);
-      break;
-    }
-
-    buf_size *= 2;
-  }
-
-  if (!chars_copied) {
-    path->Empty();
-    return GetCurError();
-  }
-
-  return S_OK;
-}
-
-}  // namespace omaha
-
diff --git a/base/module_utils.h b/base/module_utils.h
deleted file mode 100644
index 7f71411..0000000
--- a/base/module_utils.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_MODULE_UTILS_H_
-#define OMAHA_COMMON_MODULE_UTILS_H_
-
-#include "omaha/base/string.h"
-
-namespace omaha {
-
-// Utilities for working with modules in processes.
-
-// Returns the module handle of a module, given a pointer to a static
-// member of the module (e.g. a static function or static variable).
-HMODULE ModuleFromStatic(void* pointer_to_static_in_module);
-
-// Copies the path of the directory that contains the file for 'module' into
-// 'directory'.
-//
-// @param module Must be a valid, non-NULL module handle.
-// @param directory MUST have room for MAX_PATH characters or more.  The path
-// copied into this buffer will not have a trailing backslash.
-//
-// @return false iff there is an error.
-bool GetModuleDirectory(HMODULE module, TCHAR* directory);
-
-/**
-* Returns a path to a module.  Uses the
-* Win32 GetModuleFileName function, so you
-* can pass NULL for module.
-*
-* @param module Handle to the module or NULL for the current module.
-* @param path Holds the path to the module on successful return.
-* @returns S_OK if successful, otherwise an error value.
-*/
-HRESULT GetModuleFileName(HMODULE module, OUT CString* path);
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_MODULE_UTILS_H_
diff --git a/base/module_utils_unittest.cc b/base/module_utils_unittest.cc
deleted file mode 100644
index ddf2fcb..0000000
--- a/base/module_utils_unittest.cc
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Unit test for module utility functions.
-
-#include "omaha/base/constants.h"
-#include "omaha/base/module_utils.h"
-#include "omaha/base/path.h"
-#include "omaha/base/utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(ModuleUtilsTest, ModuleUtils) {
-  // ModuleFromStatic
-  HMODULE module = ModuleFromStatic(reinterpret_cast<void*>(ModuleFromStatic));
-  ASSERT_TRUE(module);
-
-  // GetModuleDirectory
-  TCHAR directory1[MAX_PATH] = {0};
-  TCHAR directory2[MAX_PATH] = {0};
-  ASSERT_TRUE(GetModuleDirectory(module, directory1));
-  ASSERT_TRUE(GetModuleDirectory(NULL, directory2));
-  EXPECT_STREQ(directory1, directory2);
-
-  // GetModuleFileName
-  CString path1;
-  CString path2;
-  ASSERT_SUCCEEDED(GetModuleFileName(module, &path1));
-  ASSERT_SUCCEEDED(GetModuleFileName(NULL, &path2));
-  EXPECT_STREQ(path1, path2);
-
-  // Verify values, as much as we can.
-  CString file(GetFileFromPath(path1));
-  EXPECT_STREQ(file, kUnittestName);
-
-  CString dir(GetDirectoryFromPath(path1));
-  EXPECT_STREQ(dir, directory1);
-}
-
-}  // namespace omaha
diff --git a/base/object_factory.h b/base/object_factory.h
deleted file mode 100644
index b74b21c..0000000
--- a/base/object_factory.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_BASE_OBJECT_FACTORY_H_
-#define OMAHA_BASE_OBJECT_FACTORY_H_
-
-#include <map>
-
-namespace omaha {
-
-// Factory creates instances of objects based on a unique type id.
-//
-// AbstractProduct - base class of the product hierarchy.
-// TypeId - type id for each type in the hierarchy.
-// ProductCreator - callable entity to create objects.
-
-template <class AbstractProduct,
-          typename TypeId,
-          typename ProductCreator = AbstractProduct* (*)()>
-class Factory {
- public:
-  Factory() {}
-
-  // Registers a creator for the type id. Returns true if the creator has
-  // been registered succesfully.
-  bool Register(const TypeId& id, ProductCreator creator) {
-    return id_to_creators_.insert(Map::value_type(id, creator)).second;
-  }
-
-  // Unregisters a type id.
-  bool Unregister(const TypeId& id) {
-    return id_to_creators_.erase(id) == 1;
-  }
-
-  // Creates an instance of the abstract product.
-  AbstractProduct* CreateObject(const TypeId& id) const {
-    typename Map::const_iterator it = id_to_creators_.find(id);
-    if (it != id_to_creators_.end()) {
-      return (it->second)();
-    } else {
-      return NULL;
-    }
-  }
-
- private:
-  typedef std::map<TypeId, ProductCreator> Map;
-  Map id_to_creators_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(Factory);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_OBJECT_FACTORY_H_
-
diff --git a/base/object_factory_unittest.cc b/base/object_factory_unittest.cc
deleted file mode 100644
index 132ce39..0000000
--- a/base/object_factory_unittest.cc
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/object_factory.h"
-#include "omaha/testing/unit_test.h"
-
-// TODO(omaha): write unit tests
diff --git a/base/omaha_version.cc b/base/omaha_version.cc
deleted file mode 100644
index 96bd073..0000000
--- a/base/omaha_version.cc
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/file_ver.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/utils.h"
-
-namespace {
-
-// The version string is not visible outside this module and it is only
-// accessible through the omaha::GetVersionString accessor.
-CString version_string;
-
-ULONGLONG omaha_version = 0;
-
-}  // namespace
-
-namespace omaha {
-
-// In both GetVersion* methods, we assert only that InitializeVersion* was
-// already called and not that they weren't called twice, which is OK.
-// There is no detection that the version_ variables aren't accessed before
-// being initialized because this would require accessor methods to enforce and
-// lead to bloat.
-
-const TCHAR* GetVersionString() {
-  ASSERT1(!version_string.IsEmpty());
-  return version_string;
-}
-
-ULONGLONG GetVersion() {
-  ASSERT1(!version_string.IsEmpty());
-  return omaha_version;
-}
-
-void InitializeVersionFromModule(HINSTANCE instance) {
-  ULONGLONG module_version = app_util::GetVersionFromModule(instance);
-
-  InitializeVersion(module_version);
-}
-
-void InitializeVersion(ULONGLONG version) {
-  omaha_version = version;
-
-  version_string = StringFromVersion(omaha_version);
-}
-
-}  // namespace omaha
diff --git a/base/omaha_version.h b/base/omaha_version.h
deleted file mode 100644
index 76f9f06..0000000
--- a/base/omaha_version.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_OMAHA_VERSION_H__
-#define OMAHA_COMMON_OMAHA_VERSION_H__
-
-#include <windows.h>
-#include <tchar.h>
-
-namespace omaha {
-
-// Overloading on pointer types and integral types is not possible in this
-// case and generally speaking not a good idea anyway. It leads to either
-// compile time ambiguities or surprising results at runtime, such as
-// which overload is being called if foobar(NULL).
-
-// Initializes the version variables from the version resource of the module.
-void InitializeVersionFromModule(HINSTANCE instance);
-
-// Initializes the version variables from a ULONGLONG version.
-void InitializeVersion(ULONGLONG version);
-
-// Returns the version string as "major.minor.build.patch".
-const TCHAR* GetVersionString();
-
-// Returns the version string as a ULONGLONG.
-ULONGLONG GetVersion();
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_OMAHA_VERSION_H__
diff --git a/base/omaha_version_unittest.cc b/base/omaha_version_unittest.cc
deleted file mode 100644
index da88fc2..0000000
--- a/base/omaha_version_unittest.cc
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(OmahaVersionTest, InitializeVersion) {
-  CString version_string = GetVersionString();
-  ULONGLONG version = GetVersion();
-
-  EXPECT_STREQ(OMAHA_BUILD_VERSION_STRING, version_string);
-  EXPECT_EQ(OMAHA_BUILD_VERSION, version);
-
-  InitializeVersion(MAKEDLLVERULL(0, 0, 0, 0));
-  EXPECT_STREQ(_T("0.0.0.0"), GetVersionString());
-  EXPECT_EQ(0, GetVersion());
-
-  InitializeVersion(MAKEDLLVERULL(1, 2, 3, 4));
-  EXPECT_STREQ(_T("1.2.3.4"), GetVersionString());
-  EXPECT_EQ(0x0001000200030004, GetVersion());
-
-  InitializeVersion(MAKEDLLVERULL(0x7fff, 0x7fff, 0x7fff, 0x7fff));
-  EXPECT_STREQ(_T("32767.32767.32767.32767"), GetVersionString());
-  EXPECT_EQ(0x7fff7fff7fff7fff, GetVersion());
-
-  InitializeVersion(MAKEDLLVERULL(0xffff, 0xffff, 0xffff, 0xffff));
-  EXPECT_STREQ(_T("65535.65535.65535.65535"), GetVersionString());
-  EXPECT_EQ(0xffffffffffffffff, GetVersion());
-
-  // Sets back the initial version.
-  InitializeVersion(VersionFromString(version_string));
-  EXPECT_STREQ(version_string, GetVersionString());
-  EXPECT_EQ(version, GetVersion());
-}
-
-}  // namespace omaha
diff --git a/base/path.cc b/base/path.cc
deleted file mode 100644
index 1035b7c..0000000
--- a/base/path.cc
+++ /dev/null
@@ -1,461 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Path utility functions.
-
-#include "omaha/base/path.h"
-
-#include <atlbase.h>
-#include <atlstr.h>
-#include <atlpath.h>
-#include <map>
-#include <vector>
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/shell.h"
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-const TCHAR* const kRegSvr32Cmd1 = _T("regsvr32 ");
-const TCHAR* const kRegSvr32Cmd2 = _T("regsvr32.exe ");
-const TCHAR* const kRunDll32Cmd1 = _T("rundll32 ");
-const TCHAR* const kRunDll32Cmd2 = _T("rundll32.exe ");
-const TCHAR* const kMsiExecCmd1  = _T("msiexec ");
-const TCHAR* const kMsiExecCmd2  = _T("msiexec.exe ");
-const TCHAR* const kDotExe       = _T(".exe");
-
-
-namespace detail {
-
-typedef bool (*Filter)(const WIN32_FIND_DATA&);
-
-bool IsFile(const WIN32_FIND_DATA& find_data) {
-  return (find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0;
-}
-
-bool IsDirectory(const WIN32_FIND_DATA& find_data) {
-  return (find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
-}
-
-bool AllFiles(const WIN32_FIND_DATA&) {
-  return true;
-}
-
-HRESULT FindFilesEx(const CString& dir,
-                    const CString& pattern,
-                    std::vector<CString>* files,
-                    Filter func) {
-  ASSERT1(files);
-
-  files->clear();
-  if (!File::Exists(dir)) {
-    return HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND);
-  }
-
-  CString files_to_find = ConcatenatePath(dir, pattern);
-  WIN32_FIND_DATA find_data = {0};
-  scoped_hfind hfind(::FindFirstFile(files_to_find, &find_data));
-  if (!hfind) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(L5, (_T("[File::GetWildcards - FindFirstFile failed][0x%x]"), hr));
-    return hr;
-  }
-
-  do {
-    if (func(find_data)) {
-      files->push_back(find_data.cFileName);
-    }
-  } while (::FindNextFile(get(hfind), &find_data));
-
-  return S_OK;
-}
-
-}  // namespace detail.
-
-// Get the starting path from the command string
-CString GetStartingPathFromString(const CString& s) {
-  CString path;
-  CString str(s);
-  TrimCString(str);
-
-  int len = str.GetLength();
-  if (len > 0) {
-    if (str[0] == _T('"')) {
-      // For something like:  "c:\Program Files\...\" ...
-      int idx = String_FindChar(str.GetString() + 1, _T('"'));
-      if (idx != -1)
-        path.SetString(str.GetString() + 1, idx);
-    } else {
-      // For something like:  c:\PRGRA~1\... ...
-      int idx = String_FindChar(str, _T(' '));
-      path.SetString(str, idx == -1 ? len : idx);
-    }
-  }
-
-  return path;
-}
-
-// Get the trailing path from the command string
-CString GetTrailingPathFromString(const CString& s) {
-  CString path;
-  CString str(s);
-  TrimCString(str);
-
-  int len = str.GetLength();
-  if (len > 0) {
-    if (str[len - 1] == _T('"')) {
-      // For something like:  regsvr32 /u /s "c:\Program Files\..."
-      str.Truncate(len - 1);
-      int idx = String_ReverseFindChar(str, _T('"'));
-      if (idx != -1)
-        path.SetString(str.GetString() + idx + 1, len - idx - 1);
-    } else {
-      // For something like:  regsvr32 /u /s c:\PRGRA~1\...
-      int idx = String_ReverseFindChar(str, _T(' '));
-      if (idx != -1)
-        path.SetString(str.GetString() + idx + 1, len - idx - 1);
-    }
-  }
-
-  return path;
-}
-
-// Get the file from the command string
-HRESULT GetFileFromCommandString(const TCHAR* s, CString* file) {
-  ASSERT1(file);
-
-  if (!s || !*s) {
-    return E_INVALIDARG;
-  }
-
-  CString str(s);
-  TrimCString(str);
-
-  // Handle the string starting with quotation mark
-  // For example: "C:\Program Files\WinZip\WINZIP32.EXE" /uninstall
-  if (str[0] == _T('"')) {
-    int idx_quote = str.Find(_T('"'), 1);
-    if (idx_quote != -1) {
-      file->SetString(str.GetString() + 1, idx_quote - 1);
-      return S_OK;
-    } else {
-      return E_FAIL;
-    }
-  }
-
-  // Handle the string starting with "regsvr32"
-  // For example: regsvr32 /u /s "c:\program files\google\googletoolbar3.dll"
-  if (String_StartsWith(str, kRegSvr32Cmd1, true) ||
-      String_StartsWith(str, kRegSvr32Cmd2, true)) {
-    file->SetString(GetTrailingPathFromString(str));
-    return S_OK;
-  }
-
-  // Handle the string starting with "rundll32"
-  // For example: "rundll32.exe setupapi.dll,InstallHinfSection DefaultUninstall 132 C:\WINDOWS\INF\PCHealth.inf"  // NOLINT
-  if (String_StartsWith(str, kRunDll32Cmd1, true) ||
-      String_StartsWith(str, kRunDll32Cmd2, true)) {
-    int idx_space = str.Find(_T(' '));
-    ASSERT1(idx_space != -1);
-    int idx_comma = str.Find(_T(','), idx_space + 1);
-    if (idx_comma != -1) {
-      file->SetString(str.GetString() + idx_space + 1,
-                      idx_comma - idx_space - 1);
-      TrimCString(*file);
-      return S_OK;
-    } else {
-      return E_FAIL;
-    }
-  }
-
-  // Handle the string starting with "msiexec"
-  // For example: MsiExec.exe /I{25A13826-8E4A-4FBF-AD2B-776447FE9646}
-  if (String_StartsWith(str, kMsiExecCmd1, true) ||
-      String_StartsWith(str, kMsiExecCmd2, true)) {
-    return E_FAIL;
-  }
-
-  // Otherwise, try to find the file till reaching ".exe"
-  // For example: "C:\Program Files\Google\Google Desktop Search\GoogleDesktopSetup.exe -uninstall"  // NOLINT
-  for (int i = 0; i < str.GetLength(); ++i) {
-    if (String_StartsWith(str.GetString() + i, kDotExe, true)) {
-      file->SetString(str, i + _tcslen(kDotExe));
-      return S_OK;
-    }
-  }
-
-  // As last resort, return the part from the beginning to first space found.
-  int idx = str.Find(_T(' '));
-  if (idx == -1) {
-    file->SetString(str);
-  } else {
-    file->SetString(str, idx);
-  }
-
-  return S_OK;
-}
-
-// Expands the string with embedded special folder variables.
-// TODO(omaha): This function seems to have a very specific purpose, which
-// is not used in our code base. Consider removing it.
-HRESULT ExpandStringWithSpecialFolders(CString* str) {
-  ASSERT(str, (L""));
-
-#pragma warning(push)
-// construction of local static object is not thread-safe
-#pragma warning(disable : 4640)
-  static std::map<CString, CString> g_special_folders_mapping;
-#pragma warning(pop)
-
-  if (g_special_folders_mapping.size() == 0) {
-    RET_IF_FAILED(
-        Shell::GetSpecialFolderKeywordsMapping(&g_special_folders_mapping));
-  }
-
-  CString expanded_str;
-  RET_IF_FAILED(
-      ExpandEnvLikeStrings(*str, g_special_folders_mapping, &expanded_str));
-
-  str->SetString(expanded_str);
-
-  return S_OK;
-}
-
-// Internal helper method for normalizing a path
-HRESULT NormalizePathInternal(const TCHAR* path, CString* normalized_path) {
-  // We use '|' to separate fields
-  CString field;
-  int bar_idx = String_FindChar(path, _T('|'));
-  if (bar_idx == -1)
-    field = path;
-  else
-    field.SetString(path, bar_idx);
-
-  if (IsRegistryPath(field)) {
-    CString key_name, value_name;
-    RET_IF_FAILED(RegSplitKeyvalueName(field, &key_name, &value_name));
-
-    CString reg_value;
-    RET_IF_FAILED(RegKey::GetValue(key_name, value_name, &reg_value));
-    normalized_path->Append(reg_value);
-  } else {
-    RET_IF_FAILED(ExpandStringWithSpecialFolders(&field));
-    normalized_path->Append(field);
-  }
-
-  if (bar_idx != -1)
-    return NormalizePathInternal(path + bar_idx + 1, normalized_path);
-  else
-    return S_OK;
-}
-
-// Normalize a path
-HRESULT NormalizePath(const TCHAR* path, CString* normalized_path) {
-  ASSERT1(normalized_path);
-
-  normalized_path->Empty();
-
-  if (path) {
-    HRESULT hr = NormalizePathInternal(path, normalized_path);
-    if (FAILED(hr)) {
-      normalized_path->Empty();
-      UTIL_LOG(LE, (_T("[NormalizePath - unable to normalize path][%s][0x%x]"),
-                    path, hr));
-    }
-    return hr;
-  } else {
-    return S_OK;
-  }
-}
-
-CString ConcatenatePath(const CString& path1, const CString& path2) {
-  CString ret(path1);
-
-  // Append the file path using the PathAppend.
-  VERIFY1(::PathAppend(CStrBuf(ret, MAX_PATH), path2));
-
-  return ret;
-}
-
-// Get the filename from the path
-// "C:\TEST\sample.txt" returns "sample.txt"
-CString GetFileFromPath(const CString& path) {
-  CPath path1(path);
-  path1.StripPath();
-  return static_cast<CString>(path1);
-}
-
-// Get the directory from the path
-// "C:\TEST\sample.txt" returns "C:\TEST"
-// Get the directory out of the file path
-CString GetDirectoryFromPath(const CString& path) {
-  CPath path1(path);
-  path1.RemoveFileSpec();
-  return static_cast<CString>(path1);
-}
-
-// Remove the extension from the path.
-// "C:\TEST\sample.txt" returns "C:\TEST\sample"
-CString GetPathRemoveExtension(const CString& path) {
-  CPath path1(path);
-  path1.RemoveExtension();
-  return static_cast<CString>(path1);
-}
-
-// Basically, an absolute path starts with X:\ or \\ (a UNC name)
-bool IsAbsolutePath(const TCHAR* path) {
-  ASSERT1(path);
-
-  int len = ::_tcslen(path);
-  if (len < 3)
-    return false;
-  if (*path == _T('"'))
-    path++;
-  if (String_StartsWith(path+1, _T(":\\"), false))
-    return true;
-  if (String_StartsWith(path, _T("\\\\"), false))
-    return true;
-  return false;
-}
-
-void EnclosePath(CString* path) {
-  ASSERT1(path);
-
-  if (path->IsEmpty()) {
-    return;
-  }
-
-  bool starts_with_quote = (_T('"') == path->GetAt(0));
-  bool ends_with_quote = (_T('"') == path->GetAt(path->GetLength() - 1));
-  ASSERT(starts_with_quote == ends_with_quote, (_T("%s"), path->GetString()));
-  bool is_enclosed = starts_with_quote && ends_with_quote;
-  if (is_enclosed) {
-    return;
-  }
-
-  path->Insert(0, _T('"'));
-  path->AppendChar(_T('"'));
-}
-
-CString EnclosePathIfExe(const CString& module_path) {
-  if (!String_EndsWith(module_path, _T(".exe"), true)) {
-    return module_path;
-  }
-
-  CString enclosed_path(module_path);
-  EnclosePath(&enclosed_path);
-  return enclosed_path;
-}
-
-// remove any double quotation masks from an enclosed path
-void UnenclosePath(CString* path) {
-  ASSERT1(path);
-
-  if (path->GetLength() > 1 && path->GetAt(0) == _T('"')) {
-    bool right_quote_exists = (path->GetAt(path->GetLength() - 1) == _T('"'));
-    ASSERT(right_quote_exists,
-           (_T("[UnenclosePath - double quote mismatches]")));
-    if (right_quote_exists) {
-      // Remove the double quotation masks
-      path->Delete(0);
-      path->Truncate(path->GetLength() - 1);
-    }
-  }
-}
-
-void RemoveMismatchedEndQuoteInDirectoryPath(CString* directory_path) {
-  ASSERT1(directory_path);
-
-  if (directory_path->GetLength() <= 1) {
-    return;
-  }
-
-  ASSERT1(directory_path->GetAt(0) != _T('"'));
-  if (directory_path->GetAt(directory_path->GetLength() - 1) == _T('"')) {
-    directory_path->Truncate(directory_path->GetLength() - 1);
-  }
-}
-
-HRESULT ShortPathToLongPath(const CString& short_path, CString* long_path) {
-  ASSERT1(long_path);
-
-  TCHAR long_name[MAX_PATH] = {0};
-  if (!::GetLongPathName(short_path, long_name, MAX_PATH)) {
-    return HRESULTFromLastError();
-  }
-
-  *long_path = long_name;
-  return S_OK;
-}
-
-HRESULT FindFilesEx(const CString& dir,
-                    const CString& pattern,
-                    std::vector<CString>* files) {
-  return detail::FindFilesEx(dir, pattern, files, &detail::IsFile);
-}
-
-HRESULT FindFiles(const CString& dir,
-                  const CString& pattern,
-                  std::vector<CString>* files) {
-  return detail::FindFilesEx(dir, pattern, files, &detail::AllFiles);
-}
-
-HRESULT FindSubDirectories(const CString& dir,
-                           const CString& pattern,
-                           std::vector<CString>* files) {
-  return detail::FindFilesEx(dir, pattern, files, &detail::IsDirectory);
-}
-
-HRESULT FindFileRecursive(const CString& dir,
-                          const CString& pattern,
-                          std::vector<CString>* files) {
-  ASSERT1(files);
-
-  std::vector<CString> temp_files;
-  HRESULT hr = FindFilesEx(dir, pattern, &temp_files);
-  if (hr != HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) && FAILED(hr)) {
-    return hr;
-  }
-
-  for (size_t i = 0; i < temp_files.size(); ++i) {
-    files->push_back(ConcatenatePath(dir, temp_files[i]));
-  }
-
-  std::vector<CString> sub_dirs;
-  hr = FindSubDirectories(dir, _T("*"), &sub_dirs);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  for (size_t i = 0; i < sub_dirs.size(); ++i) {
-    const CString& sub_dir = sub_dirs[i];
-    if (sub_dir == _T(".") || sub_dir == _T("..")) {
-      continue;
-    }
-
-    CString path = ConcatenatePath(dir, sub_dir);
-    hr = FindFileRecursive(path, pattern, files);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  return S_OK;
-}
-
-}  // namespace omaha
-
diff --git a/base/path.h b/base/path.h
deleted file mode 100644
index 2a3ce1e..0000000
--- a/base/path.h
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Path utility functions.
-
-#ifndef OMAHA_BASE_PATH_H_
-#define OMAHA_BASE_PATH_H_
-
-#include <atlstr.h>
-#include <vector>
-
-namespace omaha {
-
-// Get the starting path from the command string
-CString GetStartingPathFromString(const CString& s);
-
-// Get the trailing path from the command string
-CString GetTrailingPathFromString(const CString& s);
-
-// Get the file from the command string
-HRESULT GetFileFromCommandString(const TCHAR* s, CString* file);
-
-// Expands the string with embedded special folder variables
-HRESULT ExpandStringWithSpecialFolders(CString* str);
-
-// Normalize a path
-HRESULT NormalizePath(const TCHAR* path, CString* normalized_path);
-
-// Concatenate two paths together
-CString ConcatenatePath(const CString& path1, const CString& path2);
-
-// Get the file out of the file path
-CString GetFileFromPath(const CString& path);
-
-// Get the directory from the path
-CString GetDirectoryFromPath(const CString& path);
-
-// Remove the extension from the path.
-CString GetPathRemoveExtension(const CString& path);
-
-// Returns true iff path is an absolute path (starts with a drive name)
-bool IsAbsolutePath(const TCHAR* path);
-
-// Makes sure the path is enclosed with double quotation marks.
-void EnclosePath(CString* path);
-
-// Used to enclose paths that are typically used with LocalServer32 entries.
-// Unenclosed LocalServer32 entries with spaces are not recommended because
-// the LocalServer32 entry is a command line, not just an EXE path.
-// DLL paths should not be enclosed, because InProcServer32 entries are just
-// a DLL path and not a command line.
-CString EnclosePathIfExe(const CString& module_path);
-
-// remove any double quotation masks from an enclosed path
-void UnenclosePath(CString* path);
-
-// Removes a trailing double quote from a path. ::CommandLineToArgvW() has some
-// strange treatment for quotation marks and backslashes, as detailed here:
-// http://blogs.msdn.com/b/oldnewthing/archive/2010/09/17/10063629.aspx
-//
-// So an argument containing a directory path with a trailing backslash:
-// <<prog.exe /dir "c:\a dir\">>
-// is incorrectly parsed with a double-quote at the end:
-// <<c:\a dir">>.
-void RemoveMismatchedEndQuoteInDirectoryPath(CString* directory_path);
-
-// Converts the short path name to long name.
-HRESULT ShortPathToLongPath(const CString& short_path, CString* long_path);
-
-// Returns a list of files that match the criteria.
-HRESULT FindFiles(const CString& dir,
-                  const CString& pattern,
-                  std::vector<CString>* files);
-
-HRESULT FindFilesEx(const CString& dir,
-                    const CString& pattern,
-                    std::vector<CString>* files);
-
-HRESULT FindFileRecursive(const CString& dir,
-                          const CString& pattern,
-                          std::vector<CString>* files);
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_PATH_H_
diff --git a/base/path_unittest.cc b/base/path_unittest.cc
deleted file mode 100644
index ea325a1..0000000
--- a/base/path_unittest.cc
+++ /dev/null
@@ -1,413 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Path-utility unit tests.
-
-#include <vector>
-#include "omaha/base/file.h"
-#include "omaha/base/path.h"
-#include "omaha/base/utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(PathTest, IsAbsolutePath) {
-  ASSERT_TRUE(IsAbsolutePath(L"C:\\Foo.bar"));
-  ASSERT_TRUE(IsAbsolutePath(L"\\\\user-laptop1\\path"));
-  ASSERT_FALSE(IsAbsolutePath(L"windows\\system32"));
-}
-
-// EnclosePath is overzealous and quotes a path even though no spaces exists.
-TEST(PathTest, EnclosePath) {
-  CString path;
-  EnclosePath(&path);
-  EXPECT_STREQ(_T(""), path);
-
-  path = _T("");
-  EnclosePath(&path);
-  EXPECT_STREQ(_T(""), path);
-
-  path = _T("a");
-  EnclosePath(&path);
-  EXPECT_STREQ(_T("\"a\""), path);
-
-  path = _T("a b");
-  EnclosePath(&path);
-  EXPECT_STREQ(_T("\"a b\""), path);
-
-  path = " a b ";
-  EnclosePath(&path);
-  EXPECT_STREQ(_T("\" a b \""), path);
-
-  path = _T("\"a b\"");
-  EnclosePath(&path);
-  EXPECT_STREQ(_T("\"a b\""), path);
-
-  path = _T("c:\\Windows\\notepad.exe");
-  EnclosePath(&path);
-  EXPECT_STREQ(_T("\"c:\\Windows\\notepad.exe\""), path);
-
-  path = _T("c:\\Program Files\\Google\\Common\\Google Update");
-  EnclosePath(&path);
-  EXPECT_STREQ(_T("\"c:\\Program Files\\Google\\Common\\Google Update\""),
-               path);
-}
-
-// EnclosePath encloses a string that has a quote only at the beginning or end.
-TEST(PathTest, EnclosePath_OnlyOneQuote) {
-  ExpectAsserts expect_asserts;
-  CString path = _T("\"a b");
-  EnclosePath(&path);
-  EXPECT_STREQ(_T("\"\"a b\""), path);
-
-  path = _T("a b\"");
-  EnclosePath(&path);
-  EXPECT_STREQ(_T("\"a b\"\""), path);
-}
-
-// EnclosePath does not look at the middle of the string.
-TEST(PathTest, EnclosePath_QuoteInMiddle) {
-  CString path = _T("a\" b");
-  EnclosePath(&path);
-  EXPECT_STREQ(_T("\"a\" b\""), path);
-}
-
-TEST(PathTest, EnclosePath_SingleQuotes) {
-  CString path = _T("'foo'");
-  EnclosePath(&path);
-  EXPECT_STREQ(_T("\"'foo'\""), path);
-}
-
-TEST(PathTest, EnclosePathIfExe) {
-  CString original_path;
-  CString new_path;
-  new_path = EnclosePathIfExe(original_path);
-  EXPECT_STREQ(original_path, new_path);
-
-  original_path = _T("");
-  new_path = EnclosePathIfExe(original_path);
-  EXPECT_STREQ(original_path, new_path);
-
-  original_path = _T("a");
-  new_path = EnclosePathIfExe(original_path);
-  EXPECT_STREQ(original_path, new_path);
-
-  original_path = _T("a b");
-  new_path = EnclosePathIfExe(original_path);
-  EXPECT_STREQ(original_path, new_path);
-
-  original_path = " a b ";
-  new_path = EnclosePathIfExe(original_path);
-  EXPECT_STREQ(original_path, new_path);
-
-  original_path = _T("\"a b\"");
-  new_path = EnclosePathIfExe(original_path);
-  EXPECT_STREQ(original_path, new_path);
-
-  original_path = _T("c:\\Windows\\notepad.exe");
-  new_path = EnclosePathIfExe(original_path);
-  EXPECT_STREQ(_T("\"c:\\Windows\\notepad.exe\""), new_path);
-
-  original_path = _T("c:\\Program Files\\Google\\Update");
-  new_path = EnclosePathIfExe(original_path);
-  EXPECT_STREQ(original_path, new_path);
-
-  original_path = _T("c:\\Progra Files\\Google\\Update\\1.1.1.1\\goopdate.dll");
-  new_path = EnclosePathIfExe(original_path);
-  EXPECT_STREQ(original_path, new_path);
-
-  original_path = _T("c:\\Prog F\\Googl\\Update\\GoogleUpdate.exe");
-  new_path = EnclosePathIfExe(original_path);
-  EXPECT_STREQ(_T("\"c:\\Prog F\\Googl\\Update\\GoogleUpdate.exe\""), new_path);
-}
-
-TEST(PathTest, ConcatenatePath) {
-  CString expected_path("C:\\first\\part\\second\\part");
-
-  CString start("C:\\first\\part");
-  CString start_slash("C:\\first\\part\\");
-  CString end("second\\part");
-  CString end_slash("\\second\\part");
-
-  EXPECT_STREQ(expected_path, ConcatenatePath(start, end));
-  EXPECT_STREQ(expected_path, ConcatenatePath(start_slash, end));
-  EXPECT_STREQ(expected_path, ConcatenatePath(start, end_slash));
-  EXPECT_STREQ(expected_path, ConcatenatePath(start_slash, end_slash));
-}
-
-TEST(PathTest, ConcatenatePath_PathTooLong) {
-  CString two_hundred_char_root_path(_T("C:\\reallllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllly\\loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"));  // NOLINT
-  CString two_hundred_char_path(_T("realllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllly\\loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"));  // NOLINT
-  EXPECT_EQ(200, two_hundred_char_root_path.GetLength());
-  CString fifty_eight_char_name(
-      _T("filenaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaame"));
-  EXPECT_EQ(58, fifty_eight_char_name.GetLength());
-  CString fifty_nine_char_name(
-      _T("filenaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaame"));
-  EXPECT_EQ(59, fifty_nine_char_name.GetLength());
-  CString sixty_char_name(
-      _T("filenaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaame"));
-  EXPECT_EQ(60, sixty_char_name.GetLength());
-
-  // Adding the '\' makes it 259 chars.
-  CString result = ConcatenatePath(two_hundred_char_root_path,
-                                   fifty_eight_char_name);
-  EXPECT_STREQ(_T("C:\\reallllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllly\\loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong\\filenaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaame"),  // NOLINT
-               result);
-
-  // Adding the '\' makes it 260 chars.
-  ExpectAsserts expect_asserts;
-  result = ConcatenatePath(two_hundred_char_root_path,
-                                   fifty_nine_char_name);
-  EXPECT_TRUE(result.IsEmpty());
-
-  // Adding the '\' makes it 261 chars.
-  result = ConcatenatePath(two_hundred_char_root_path, sixty_char_name);
-  EXPECT_TRUE(result.IsEmpty());
-
-  // Test for buffer overflow on long strings.
-}
-
-TEST(PathTest, ConcatenatePath_EmptyString) {
-  EXPECT_STREQ(_T("bar.exe"), ConcatenatePath(_T(""), _T("bar.exe")));
-  EXPECT_STREQ(_T("foo"), ConcatenatePath(_T("foo"), _T("")));
-  // This is not what I would expect, but it is what the API does.
-  EXPECT_STREQ(_T("\\"), ConcatenatePath(_T(""), _T("")));
-}
-
-// TODO(omaha): The expected and actual values are reversed throughout.
-
-TEST(PathTest, ShortPathToLongPath) {
-  CString expected_path("C:\\Program Files");
-  CString short_path("C:\\Progra~1");
-
-  CString long_path;
-  ASSERT_SUCCEEDED(ShortPathToLongPath(short_path, &long_path));
-  ASSERT_STREQ(expected_path, long_path);
-}
-
-TEST(PathTest, FindFilesTest) {
-  GUID guid = GUID_NULL;
-  ASSERT_SUCCEEDED(::CoCreateGuid(&guid));
-
-  TCHAR path[MAX_PATH] = {0};
-  ASSERT_NE(::GetTempPath(MAX_PATH, path), 0);
-
-  CString dir = ConcatenatePath(path, GuidToString(guid));
-  EXPECT_FALSE(dir.IsEmpty());
-  EXPECT_FALSE(File::Exists(dir));
-
-  // Test with non-existent dir.
-  std::vector<CString> files;
-  EXPECT_FAILED(FindFiles(dir, _T("*.txt"), &files));
-  EXPECT_EQ(files.size(), 0);
-
-  // Test with empty dir.
-  EXPECT_NE(::CreateDirectory(dir, NULL), 0);
-  files.clear();
-  EXPECT_EQ(FindFiles(dir, _T("asdf.txt"), &files), 0x80070002);
-  EXPECT_EQ(files.size(), 0);
-
-  CString filename1 = _T("one.txt");
-  CString filepath1 = ConcatenatePath(dir, filename1);
-  CString filename2 = _T("two_en.txt");
-  CString filepath2 = ConcatenatePath(dir, filename2);
-
-  // Test with dir containing one file.
-  scoped_hfile handle1(::CreateFile(filepath1, GENERIC_READ, FILE_SHARE_READ,
-                                    NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,
-                                    NULL));
-  EXPECT_TRUE(valid(handle1));
-  files.clear();
-  EXPECT_SUCCEEDED(FindFiles(dir, _T("*.txt"), &files));
-  EXPECT_EQ(files.size(), 1);
-  EXPECT_STREQ(files[0], filename1);
-
-  files.clear();
-  EXPECT_SUCCEEDED(FindFiles(dir, _T("o*.txt"), &files));
-  EXPECT_EQ(files.size(), 1);
-  EXPECT_STREQ(files[0], filename1);
-
-  files.clear();
-  EXPECT_SUCCEEDED(FindFiles(dir, filepath1, &files));
-  EXPECT_EQ(files.size(), 1);
-  EXPECT_STREQ(files[0], filename1);
-
-  files.clear();
-  EXPECT_EQ(FindFiles(dir, _T("t*.txt"), &files), 0x80070002);
-  EXPECT_EQ(files.size(), 0);
-
-  // Test with dir containing two files.
-  scoped_hfile handle2(::CreateFile(filepath2, GENERIC_READ, FILE_SHARE_READ,
-                                    NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,
-                                    NULL));
-  EXPECT_TRUE(valid(handle2));
-  files.clear();
-  EXPECT_SUCCEEDED(FindFiles(dir, _T("*.txt"), &files));
-  EXPECT_EQ(files.size(), 2);
-  EXPECT_STREQ(files[0], filename1);
-  EXPECT_STREQ(files[1], filename2);
-
-  files.clear();
-  EXPECT_SUCCEEDED(FindFiles(dir, _T("o*.txt"), &files));
-  EXPECT_EQ(files.size(), 1);
-  EXPECT_STREQ(files[0], filename1);
-
-  files.clear();
-  EXPECT_SUCCEEDED(FindFiles(dir, _T("t*.txt"), &files));
-  EXPECT_EQ(files.size(), 1);
-  EXPECT_STREQ(files[0], filename2);
-
-  files.clear();
-  EXPECT_EQ(FindFiles(dir, _T("asdf.txt"), &files), 0x80070002);
-  EXPECT_EQ(files.size(), 0);
-
-  reset(handle1);
-  EXPECT_SUCCEEDED(File::Remove(filepath1));
-  reset(handle2);
-  EXPECT_SUCCEEDED(File::Remove(filepath2));
-  EXPECT_NE(::RemoveDirectory(dir), 0);
-}
-
-namespace detail {
-
-struct Directory {
-  Directory() {}
-  explicit Directory(const CString& name) : dir_name(name) {}
-
-  CString dir_name;
-  std::vector<Directory> sub_dirs;
-  std::vector<CString> files;
-};
-
-void ConvertDirectoryStructureToFiles(const Directory& directory,
-                                      const CString& dir_path,
-                                      std::vector<CString>* files) {
-  ASSERT_TRUE(files != NULL);
-  ASSERT_HRESULT_SUCCEEDED(CreateDir(dir_path, NULL));
-
-  for (size_t i = 0; i < directory.files.size(); ++i) {
-    const CString& file = ConcatenatePath(dir_path, directory.files[i]);
-    scoped_hfile handle(::CreateFile(file, GENERIC_READ, FILE_SHARE_READ,
-                                      NULL, CREATE_ALWAYS,
-                                      FILE_ATTRIBUTE_NORMAL,
-                                      NULL));
-    EXPECT_TRUE(valid(handle));
-    files->push_back(file);
-  }
-
-  for (size_t i = 0; i < directory.sub_dirs.size(); ++i) {
-    ConvertDirectoryStructureToFiles(
-        directory.sub_dirs[i],
-        ConcatenatePath(dir_path, directory.sub_dirs[i].dir_name),
-        files);
-  }
-}
-
-void CreateTestDirectoryStructure(Directory* root_dir) {
-  EXPECT_TRUE(root_dir != NULL);
-  GUID guid = GUID_NULL;
-  ASSERT_HRESULT_SUCCEEDED(::CoCreateGuid(&guid));
-
-  TCHAR path[MAX_PATH] = {0};
-  ASSERT_NE(0, ::GetTempPath(MAX_PATH, path));
-
-  CString dir = ConcatenatePath(path, GuidToString(guid));
-  EXPECT_FALSE(dir.IsEmpty());
-  EXPECT_FALSE(File::Exists(dir));
-
-  root_dir->dir_name = dir;
-  root_dir->files.push_back(_T("test1.txt"));
-  root_dir->files.push_back(_T("test2.txt"));
-
-  Directory sub_dir1_level1(_T("sub_dir1_level1"));
-  sub_dir1_level1.files.push_back(_T("sub_dir1_level1_test1.txt"));
-  Directory sub_dir1_level2(_T("sub_dir1_level2"));
-  sub_dir1_level2.files.push_back(_T("sub_dir1_level2_test1.txt"));
-  sub_dir1_level1.sub_dirs.push_back(sub_dir1_level2);
-  root_dir->sub_dirs.push_back(sub_dir1_level1);
-
-  Directory sub_dir2_level1(_T("sub_dir2_level1"));
-  sub_dir2_level1.files.push_back(_T("sub_dir2_level1_test1.txt"));
-  root_dir->sub_dirs.push_back(sub_dir2_level1);
-}
-}  // detail.
-
-TEST(PathTest, FindFileRecursiveTest) {
-  detail::Directory dir;
-  detail::CreateTestDirectoryStructure(&dir);
-
-  std::vector<CString> expected_files;
-  detail::ConvertDirectoryStructureToFiles(dir, dir.dir_name, &expected_files);
-
-  // Call the test method.
-  std::vector<CString> files;
-  ASSERT_HRESULT_SUCCEEDED(FindFileRecursive(dir.dir_name,
-                                             _T("*test*.txt"),
-                                             &files));
-
-  // Validate the results.
-  ASSERT_EQ(expected_files.size(), files.size());
-  for (size_t i = 0; i < expected_files.size(); ++i) {
-    EXPECT_STREQ(expected_files[i], files[i]);
-  }
-
-  // Cleanup.
-  ASSERT_HRESULT_SUCCEEDED(DeleteDirectory(dir.dir_name));
-}
-
-TEST(PathTest, FindFileRecursiveTest_Empty) {
-  GUID guid = GUID_NULL;
-  ASSERT_HRESULT_SUCCEEDED(::CoCreateGuid(&guid));
-
-  TCHAR path[MAX_PATH] = {0};
-  ASSERT_NE(0, ::GetTempPath(MAX_PATH, path));
-
-  CString dir = ConcatenatePath(path, GuidToString(guid));
-  EXPECT_FALSE(dir.IsEmpty());
-  EXPECT_FALSE(File::Exists(dir));
-
-  ASSERT_HRESULT_SUCCEEDED(CreateDir(dir, NULL));
-
-  // Call the test method.
-  std::vector<CString> files;
-  ASSERT_HRESULT_SUCCEEDED(FindFileRecursive(dir, _T("*test*.txt"),
-                                             &files));
-
-  // Validate results.
-  ASSERT_EQ(0, files.size());
-
-  // Cleanup.
-  ASSERT_HRESULT_SUCCEEDED(DeleteDirectory(dir));
-}
-
-TEST(PathTest, FindFileRecursiveTest_DirNotCreated) {
-  GUID guid = GUID_NULL;
-  ASSERT_HRESULT_SUCCEEDED(::CoCreateGuid(&guid));
-
-  TCHAR path[MAX_PATH] = {0};
-  ASSERT_NE(0, ::GetTempPath(MAX_PATH, path));
-
-  CString dir = ConcatenatePath(path, GuidToString(guid));
-  EXPECT_FALSE(dir.IsEmpty());
-  EXPECT_FALSE(File::Exists(dir));
-
-  // Call the test method.
-  std::vector<CString> files;
-  ASSERT_HRESULT_FAILED(FindFileRecursive(dir, _T("*test*.txt"), &files));
-}
-
-}  // namespace omaha
-
diff --git a/base/pe_utils.cc b/base/pe_utils.cc
deleted file mode 100644
index ce4ca22..0000000
--- a/base/pe_utils.cc
+++ /dev/null
@@ -1,219 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Utility functions related to PE files (executables)
-
-#include "omaha/base/pe_utils.h"
-
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/scoped_any.h"
-
-namespace omaha {
-
-namespace {
-
-// Not really necessary as long as running on x86 architecture throughout, but
-// what the hell
-#if defined(BIG_ENDIAN)
-uint32 GetUint32LE(void const * const p) {
-  uint8 const * const pu = reinterpret_cast<uint8 const * const>(p);
-  uint32 i = pu[0] | pu[1]<<8 | pu[2]<<16 | pu[3]<<24;
-  return i;
-}
-
-void PutUint32LE(uint32 i, void * const p) {
-  uint8 * const pu = reinterpret_cast<uint8 * const>(p);
-  pu[0] = i & 0xff;
-  pu[1] = (i >>  8) & 0xff;
-  pu[2] = (i >> 16) & 0xff;
-  pu[3] = (i >> 24) & 0xff;
-}
-#else  // LITTLE_ENDIAN
-inline uint32 GetUint32LE(void const * const p) {
-  uint32 const * const pu = reinterpret_cast<uint32 const * const>(p);
-  return *pu;
-}
-
-inline void PutUint32LE(uint32 i, void * const p) {
-  uint32 * const pu = reinterpret_cast<uint32 * const>(p);
-  *pu = i;
-}
-#endif
-
-// Magic PE constants
-const uint32 kPEHeaderOffset         = 60;
-const uint32 kPEHeaderChecksumOffset = 88;
-const uint32 kPEHeaderSizeMin        = 160;
-const char magic_EXE_header[] = "MZ\0\0";
-const char magic_PE_header[]  = "PE\0\0";
-
-}  // namespace
-
-HRESULT SetPEChecksum(const TCHAR *filename, uint32 checksum) {
-  // Write the checksum field of the Windows NT-specific "optional" header.
-  // Use Windows API calls rather than C library calls so that it will be
-  // really a small routine when used in the stub executable.
-
-  ASSERT(filename, (L""));
-
-  scoped_hfile file(::CreateFile(filename,
-                                 GENERIC_READ | GENERIC_WRITE,
-                                 0,
-                                 NULL,
-                                 OPEN_EXISTING,
-                                 FILE_ATTRIBUTE_NORMAL,
-                                 NULL));
-  if (!file)
-    return HRESULTFromLastError();
-
-  size_t size = ::GetFileSize(get(file), NULL);
-  if (size == INVALID_FILE_SIZE)
-    return HRESULTFromLastError();
-
-  scoped_file_mapping mapping(::CreateFileMapping(get(file),
-                                                  NULL,
-                                                  PAGE_READWRITE,
-                                                  0,
-                                                  0,
-                                                  NULL));
-  if (!mapping)
-    return HRESULTFromLastError();
-
-  scoped_file_view file_data(::MapViewOfFile(get(mapping),
-                                             FILE_MAP_WRITE,
-                                             0,
-                                             0,
-                                             size));
-  if (!file_data)
-    return HRESULTFromLastError();
-
-  uint8 * image = reinterpret_cast<uint8 *>(get(file_data));
-
-  return SetPEChecksumToBuffer(image, size, checksum);
-}
-
-HRESULT GetPEChecksum(const TCHAR *filename, uint32 * checksum) {
-  // Read the checksum field out of the Windows NT-specific "optional" header.
-  // Use Windows API calls rather than C library calls so that it will be
-  // really a small routine when used in the stub executable.
-
-  ASSERT(filename, (L""));
-  ASSERT(checksum, (L""));
-
-  scoped_hfile file(::CreateFile(filename,
-                                 GENERIC_READ,
-                                 FILE_SHARE_READ,
-                                 NULL,
-                                 OPEN_EXISTING,
-                                 FILE_ATTRIBUTE_READONLY,
-                                 NULL));
-  if (!file)
-    return HRESULTFromLastError();
-
-  size_t size = ::GetFileSize(get(file), NULL);
-  if (size == INVALID_FILE_SIZE)
-    return HRESULTFromLastError();
-
-  scoped_file_mapping mapping(::CreateFileMapping(get(file),
-                              NULL,
-                              PAGE_READONLY,
-                              0,
-                              0,
-                              NULL));
-  if (!mapping)
-    return HRESULTFromLastError();
-
-  scoped_file_view file_data(::MapViewOfFile(get(mapping),
-                             FILE_MAP_READ,
-                             0,
-                             0,
-                             size));
-  if (!file_data)
-    return HRESULTFromLastError();
-
-  uint8 * image = reinterpret_cast<uint8 *>(get(file_data));
-
-  return GetPEChecksumFromBuffer(image, size, checksum);
-}
-
-HRESULT SetPEChecksumToBuffer(uint8 *buffer, size_t size, uint32 checksum) {
-  // Sanity checks
-  if (size < 64) {
-    ASSERT(false, (L"File too short to be valid executable"));
-    return E_FAIL;
-  }
-
-  uint32 x = GetUint32LE(magic_EXE_header);
-  if (::memcmp(buffer, &x, 2)) {
-    ASSERT(false, (L"Missing executable's magic number"));
-    return E_FAIL;
-  }
-
-  uint32 peheader = GetUint32LE(buffer + kPEHeaderOffset);
-  if (size < peheader + kPEHeaderSizeMin) {
-    ASSERT(false, (L"Too small given PE header size"));
-    return E_FAIL;
-  }
-
-  x = GetUint32LE(magic_PE_header);
-  if (::memcmp(buffer + peheader, &x, 4)) {
-    ASSERT(false, (L"Missing PE header magic number"));
-    return E_FAIL;
-  }
-
-  // Finally, write the checksum
-  PutUint32LE(checksum, &x);
-  ::memcpy(buffer + peheader + kPEHeaderChecksumOffset, &x, 4);
-
-  return S_OK;
-}
-
-HRESULT GetPEChecksumFromBuffer(const unsigned char *buffer,
-                                size_t size,
-                                uint32 *checksum) {
-  // Sanity checks
-  if (size < 64) {
-    ASSERT(false, (L"File too short to be valid executable"));
-    return E_FAIL;
-  }
-
-  uint32 x = GetUint32LE(magic_EXE_header);
-  if (::memcmp(buffer, &x, 2)) {
-    ASSERT(false, (L"Missing executable's magic number"));
-    return E_FAIL;
-  }
-
-  uint32 peheader = GetUint32LE(buffer + kPEHeaderOffset);
-  if (size < peheader + kPEHeaderSizeMin) {
-    ASSERT(false, (L"Too small given PE header size"));
-    return E_FAIL;
-  }
-
-  x = GetUint32LE(magic_PE_header);
-  if (::memcmp(buffer + peheader, &x, 4)) {
-    ASSERT(false, (L"Missing PE header magic number"));
-    return E_FAIL;
-  }
-
-  // Finally, read the checksum
-
-  *checksum = GetUint32LE(buffer + peheader + kPEHeaderChecksumOffset);
-
-  return S_OK;
-}
-
-}  // namespace omaha
-
diff --git a/base/pe_utils.h b/base/pe_utils.h
deleted file mode 100644
index cc969c6..0000000
--- a/base/pe_utils.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Utility functions related to PE files (executables)
-
-#ifndef OMAHA_COMMON_PE_UTILS_H_
-#define OMAHA_COMMON_PE_UTILS_H_
-
-#include <windows.h>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-HRESULT SetPEChecksum(const TCHAR *filename, uint32 checksum);
-
-HRESULT SetPEChecksumToBuffer(unsigned char *buffer,
-                              size_t size, uint32 checksum);
-
-HRESULT GetPEChecksum(const TCHAR *filename, uint32 * checksum);
-
-HRESULT GetPEChecksumFromBuffer(const unsigned char *buffer,
-                                size_t size,
-                                uint32 *checksum);
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_PE_UTILS_H_
diff --git a/base/pe_utils_unittest.cc b/base/pe_utils_unittest.cc
deleted file mode 100644
index 56b11c6..0000000
--- a/base/pe_utils_unittest.cc
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Unittests for pe_utils
-
-
-#include "omaha/base/debug.h"
-#include "omaha/base/file.h"
-#include "omaha/base/pe_utils.h"
-#include "omaha/base/utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(PEUtilsTest, PEUtils) {
-  // Get some known directories
-  CString windows_dir;
-  CString temp_dir;
-  DWORD dw = ::GetEnvironmentVariable(L"SystemRoot",
-                                      CStrBuf(windows_dir, MAX_PATH), MAX_PATH);
-  ASSERT_TRUE(dw);
-  dw = ::GetEnvironmentVariable(L"TEMP", CStrBuf(temp_dir, MAX_PATH), MAX_PATH);
-  ASSERT_TRUE(dw);
-
-  // Get a known executable to play with
-  CString notepad(windows_dir + L"\\NOTEPAD.EXE");
-  ASSERT_TRUE(File::Exists(notepad));
-
-  CString temp_exe(temp_dir + L"\\pe_utils_test.exe");
-  if (File::Exists(temp_exe)) {
-    File::Remove(temp_exe);
-  }
-  ASSERT_FALSE(File::Exists(temp_exe));
-  ASSERT_SUCCEEDED(File::Copy(notepad, temp_exe, true));
-
-  // Stomp on its checksum and check the result
-  const unsigned int kChk1 = 0xFEE1BAD;
-  const unsigned int kChk2 = 0x600DF00D;
-
-  unsigned int checksum = 0;
-
-  // Test Get/SetPEChecksum
-  ASSERT_SUCCEEDED(SetPEChecksum(temp_exe, kChk1));
-  ASSERT_SUCCEEDED(GetPEChecksum(temp_exe, &checksum));
-  ASSERT_EQ(kChk1, checksum);
-
-  ASSERT_SUCCEEDED(SetPEChecksum(temp_exe, kChk2));
-  ASSERT_SUCCEEDED(GetPEChecksum(temp_exe, &checksum));
-  ASSERT_EQ(kChk2, checksum);
-
-  // Test GetPEChecksumFromBuffer/SetPEChecksumToBuffer
-  std::vector<byte> buffer;
-  ASSERT_SUCCEEDED(ReadEntireFile(temp_exe, 0, &buffer));
-
-  int buffer_data_len = buffer.size();
-  uint8 *buffer_data = reinterpret_cast<uint8*>(&buffer.front());
-
-  ASSERT_SUCCEEDED(SetPEChecksumToBuffer(buffer_data, buffer_data_len, kChk1));
-  ASSERT_SUCCEEDED(GetPEChecksumFromBuffer(buffer_data,
-                                           buffer_data_len,
-                                           &checksum));
-  ASSERT_EQ(kChk1, checksum);
-
-  ASSERT_SUCCEEDED(SetPEChecksumToBuffer(buffer_data, buffer_data_len, kChk2));
-  ASSERT_SUCCEEDED(GetPEChecksumFromBuffer(buffer_data,
-                                           buffer_data_len,
-                                           &checksum));
-  ASSERT_EQ(kChk2, checksum);
-
-  // Clean up
-  ASSERT_SUCCEEDED(File::Remove(temp_exe));
-}
-
-}  // namespace omaha
-
diff --git a/base/popup_menu.cc b/base/popup_menu.cc
deleted file mode 100644
index bfb15e5..0000000
--- a/base/popup_menu.cc
+++ /dev/null
@@ -1,464 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/popup_menu.h"
-
-#include <windows.h>
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-// Hold owner draw data
-struct OwnerDrawData {
-  HFONT font;
-  CString text;
-  HICON icon;
-
-  OwnerDrawData(HFONT f, const TCHAR* t, HICON i) {
-    font = f;
-    text = t;
-    icon = i;
-  }
-};
-
-
-// Default constructor
-PopupMenu::PopupMenu()
-    : wnd_(NULL) {
-  reset(menu_, ::CreatePopupMenu());
-  ASSERT1(menu_);
-}
-
-// Constructor
-PopupMenu::PopupMenu(HINSTANCE inst, const TCHAR* name)
-    : wnd_(NULL) {
-  LoadFromResource(inst, name);
-  ASSERT1(menu_);
-}
-
-// Destructor
-PopupMenu::~PopupMenu() {
-}
-
-// Load from resource
-bool PopupMenu::LoadFromResource(HINSTANCE inst, const TCHAR* name) {
-  reset(menu_, GetSubMenu(reinterpret_cast<HMENU>(::LoadMenu(inst, name)), 0));
-  return get(menu_) != NULL;
-}
-
-// Append menu item
-bool PopupMenu::AppendMenuItem(int menu_item_id, const TCHAR* text) {
-  return AppendMenuItem(menu_item_id, text, NULL);
-}
-
-// Append menu item
-bool PopupMenu::AppendMenuItem(int menu_item_id,
-                               const TCHAR* text,
-                               const MenuItemDrawStyle* style) {
-  int count = ::GetMenuItemCount(get(menu_));
-  if (count == -1)
-    return false;
-
-  return InsertMenuItem(menu_item_id, count, true, text, style);
-}
-
-// Append separator
-bool PopupMenu::AppendSeparator() {
-  return AppendMenuItem(-1, NULL, NULL);
-}
-
-// Insert menu item
-bool PopupMenu::InsertMenuItem(int menu_item_id,
-                               int before_item,
-                               bool by_pos,
-                               const TCHAR* text) {
-  return InsertMenuItem(menu_item_id, before_item, by_pos, text, NULL);
-}
-
-// Helper function that populates the MENUITEMINFO structure and sets
-// accelerator keys for OWNERDRAW menu items
-MENUITEMINFO PopupMenu::PrepareMenuItemInfo(int menu_item_id, const TCHAR* text,
-                                            const MenuItemDrawStyle* style) {
-  // Fill in the MENUITEMINFO structure
-  MENUITEMINFO menuitem_info;
-  SetZero(menuitem_info);
-  menuitem_info.cbSize = sizeof(MENUITEMINFO);
-  menuitem_info.wID = menu_item_id;
-  if (text == NULL) {
-    menuitem_info.fMask = MIIM_FTYPE | MIIM_ID;
-    menuitem_info.fType = MFT_SEPARATOR;
-  } else {
-    if (!style) {
-      menuitem_info.fMask = MIIM_STRING | MIIM_ID;
-      menuitem_info.fType = MFT_STRING;
-      menuitem_info.dwTypeData = const_cast<TCHAR*>(text);
-    } else {
-      // Handle bold font style
-      HFONT font = NULL;
-      if (style->is_bold) {
-        font = GetBoldFont();
-      }
-
-      // Remove '&' if it is there
-      CString text_str(text);
-      int pos = String_FindChar(text_str, _T('&'));
-      if (pos != -1) {
-        if (pos + 1 < text_str.GetLength()) {
-          accelerator_keys_.Add(Char_ToLower(text_str[pos + 1]), menu_item_id);
-        }
-        ReplaceCString(text_str, _T("&"), _T(""));
-      }
-
-      // Set owner-draw related properties
-      OwnerDrawData* data = new OwnerDrawData(font, text_str, style->icon);
-      menuitem_info.fMask = MIIM_FTYPE | MIIM_DATA | MIIM_ID;
-      menuitem_info.fType = MFT_OWNERDRAW;
-      menuitem_info.dwItemData = reinterpret_cast<ULONG_PTR>(data);
-    }
-  }
-
-  return menuitem_info;
-}
-
-// Insert menu item
-bool PopupMenu::InsertMenuItem(int menu_item_id,
-                               int before_item,
-                               bool by_pos,
-                               const TCHAR* text,
-                               const MenuItemDrawStyle* style) {
-  MENUITEMINFO menuitem_info = PrepareMenuItemInfo(menu_item_id, text, style);
-  if (!::InsertMenuItem(get(menu_), before_item, by_pos, &menuitem_info))
-    return false;
-
-  return Redraw();
-}
-
-// Insert separator
-bool PopupMenu::InsertSeparator(int before_item, bool by_pos) {
-  return InsertMenuItem(-1, before_item, by_pos, NULL, NULL);
-}
-
-// Modify a given menu item
-bool PopupMenu::ModifyMenuItem(int menu_item, bool by_pos, const TCHAR* text,
-                               const MenuItemDrawStyle* style) {
-  // Get OWNERDRAW data for later deletion
-  MENUITEMINFO menuitem_info;
-  SetZero(menuitem_info);
-  menuitem_info.cbSize = sizeof(MENUITEMINFO);
-  menuitem_info.fMask = MIIM_FTYPE | MIIM_DATA;
-  if (!::GetMenuItemInfo(get(menu_), menu_item, by_pos, &menuitem_info)) {
-    return false;
-  }
-
-  OwnerDrawData* old_owner_data = NULL;
-  if ((menuitem_info.fType | MFT_OWNERDRAW) && menuitem_info.dwItemData) {
-    old_owner_data =
-        reinterpret_cast<OwnerDrawData *>(menuitem_info.dwItemData);
-  }
-
-  // Remove old accelerator mapping
-  int menu_item_id = by_pos ? ::GetMenuItemID(get(menu_), menu_item) :
-                              menu_item;
-  int key_pos = accelerator_keys_.FindVal(menu_item_id);
-  if (key_pos != -1) {
-    accelerator_keys_.RemoveAt(key_pos);
-  }
-
-  // Set new menu item info
-  menuitem_info = PrepareMenuItemInfo(menu_item_id, text, style);
-  if (!::SetMenuItemInfo(get(menu_), menu_item, by_pos, &menuitem_info)) {
-    return false;
-  }
-
-  // Delete old owner draw data
-  if (old_owner_data) {
-    delete old_owner_data;
-  }
-
-  // Redraw
-  return Redraw();
-}
-
-// Remove a menu item
-bool PopupMenu::RemoveMenuItem(int menu_item, bool by_pos) {
-  // Get OWNERDRAW data for later deletion
-  MENUITEMINFO menuitem_info;
-  SetZero(menuitem_info);
-  menuitem_info.cbSize = sizeof(MENUITEMINFO);
-  menuitem_info.fMask = MIIM_FTYPE | MIIM_DATA;
-  if (!::GetMenuItemInfo(get(menu_), menu_item, by_pos, &menuitem_info)) {
-    return false;
-  }
-
-  OwnerDrawData* old_owner_data = NULL;
-  if ((menuitem_info.fType | MFT_OWNERDRAW) && menuitem_info.dwItemData) {
-    old_owner_data =
-        reinterpret_cast<OwnerDrawData *>(menuitem_info.dwItemData);
-  }
-
-  // Remove the menu item
-  if (!::RemoveMenu(get(menu_), menu_item, by_pos ? MF_BYPOSITION :
-                                                    MF_BYCOMMAND)) {
-    return false;
-  }
-
-  // Remove old accelerator mapping
-  int menu_item_id = by_pos ? ::GetMenuItemID(get(menu_), menu_item) :
-                              menu_item;
-  int key_pos = accelerator_keys_.FindVal(menu_item_id);
-  if (key_pos != -1) {
-    accelerator_keys_.RemoveAt(key_pos);
-  }
-
-  // Delete old owner draw data
-  if (old_owner_data) {
-    delete old_owner_data;
-  }
-
-  // Redraw
-  return Redraw();
-}
-
-// Enable menu item
-bool PopupMenu::EnableMenuItem(int menu_item, bool by_pos, bool enabled) {
-  if (::EnableMenuItem(get(menu_), menu_item,
-                        (by_pos ? MF_BYPOSITION : MF_BYCOMMAND) |
-                        (enabled ? MF_ENABLED : MF_GRAYED)) == -1)
-    return false;
-
-  return Redraw();
-}
-
-// Get menu state
-bool PopupMenu::GetMenuState(int menu_item, bool by_pos, int* menu_state) {
-  int state = ::GetMenuState(get(menu_),
-                             menu_item, by_pos ? MF_BYPOSITION : MF_BYCOMMAND);
-  if (menu_state)
-    *menu_state = state;
-  return state != -1;
-}
-
-// Exists a menu item
-bool PopupMenu::ExistsMenuItem(int menu_item_id) {
-  return GetMenuState(menu_item_id, false, NULL);
-}
-
-// Redraw menu
-bool PopupMenu::Redraw() {
-  if (!wnd_)
-    return true;
-
-  return ::DrawMenuBar(wnd_) == TRUE;
-}
-
-// Track menu
-bool PopupMenu::Track() {
-  ASSERT1(wnd_);
-
-  // If we don't set it to be foreground, it will not stop tracking even
-  // if we click outside of menu.
-  ::SetForegroundWindow(wnd_);
-
-  POINT point = {0, 0};
-  VERIFY(::GetCursorPos(&point), (_T("")));
-
-  uint32 kFlags = TPM_LEFTALIGN  |
-                  TPM_RETURNCMD  |
-                  TPM_NONOTIFY   |
-                  TPM_LEFTBUTTON |
-                  TPM_VERTICAL;
-  int command = ::TrackPopupMenuEx(get(menu_),
-                                   kFlags,
-                                   point.x, point.y, wnd_, NULL);
-
-  if (command != 0)
-    ::SendMessage(wnd_, WM_COMMAND, command, 0);
-
-  return true;
-}
-
-// Handle WM_MEASUREITEM message
-bool PopupMenu::OnMeasureItem(MEASUREITEMSTRUCT* mi) {
-  ASSERT1(wnd_);
-
-  // Get owner draw data
-  ASSERT1(mi->itemData);
-  OwnerDrawData* data = reinterpret_cast<OwnerDrawData*>(mi->itemData);
-
-  // Get the DC
-  scoped_hdc dc;
-  reset(dc, ::GetDC(wnd_));
-
-  // Select the font
-  HFONT old_font = reinterpret_cast<HFONT>(::SelectObject(get(dc), data->font));
-  if (!old_font)
-    return false;
-
-  // compute the size of the text
-  SIZE size = {0, 0};
-  bool success = ::GetTextExtentPoint32(get(dc),
-                                        data->text.GetString(),
-                                        data->text.GetLength(),
-                                        &size) != 0;
-  if (success) {
-    mi->itemWidth = size.cx;
-    mi->itemHeight = size.cy;
-  }
-
-  // deselect the title font
-  ::SelectObject(get(dc), old_font);
-
-  return success;
-}
-
-// Handle WM_MDRAWITEM message
-bool PopupMenu::OnDrawItem(DRAWITEMSTRUCT* di) {
-  ASSERT1(di);
-
-  // Get owner draw data
-  ASSERT1(di->itemData);
-  OwnerDrawData* data = reinterpret_cast<OwnerDrawData*>(di->itemData);
-
-  // Select the font
-  HFONT prev_font = NULL;
-  if (data->font) {
-    prev_font = reinterpret_cast<HFONT>(::SelectObject(di->hDC, data->font));
-    if (!prev_font) {
-      return false;
-    }
-  }
-
-  // Draw the text per the menuitem state
-  int fg_color_idx =
-      (di->itemState & ODS_DISABLED) ?
-      COLOR_GRAYTEXT :
-      ((di->itemState & ODS_SELECTED) ? COLOR_HIGHLIGHTTEXT : COLOR_MENUTEXT);
-
-  int bg_color_idx =
-      (di->itemState & ODS_SELECTED) ? COLOR_HIGHLIGHT : COLOR_MENU;
-
-  bool success = DrawText(data->text, di, fg_color_idx, bg_color_idx);
-
-  // Restore the original font
-  if (prev_font) {
-    ::SelectObject(di->hDC, prev_font);
-  }
-
-  // Compute the width and height
-  int height = di->rcItem.bottom - di->rcItem.top + 1;
-  int width = static_cast<int>(::GetSystemMetrics(SM_CXMENUCHECK) *
-    (static_cast<double>(height) / ::GetSystemMetrics(SM_CYMENUCHECK)));
-
-  // Draw the icon
-  // TODO(omaha): Draw a grayed icon when the menuitem is disabled
-  if (success && data->icon) {
-    success = ::DrawIconEx(di->hDC,
-                           di->rcItem.left,
-                           di->rcItem.top,
-                           data->icon,
-                           width,
-                           height,
-                           0,
-                           NULL,
-                           DI_NORMAL) != 0;
-  }
-
-  return success;
-}
-
-// Draw the text
-bool PopupMenu::DrawText(const CString& text,
-                         DRAWITEMSTRUCT* di,
-                         int fg_color_idx,
-                         int bg_color_idx) {
-  // Set the appropriate foreground and background colors
-  COLORREF prev_fg_color = 0, prev_bg_color = 0;
-  prev_fg_color = ::SetTextColor(di->hDC, ::GetSysColor(fg_color_idx));
-  if (prev_fg_color == CLR_INVALID) {
-    return false;
-  }
-  prev_bg_color = ::SetBkColor(di->hDC, ::GetSysColor(bg_color_idx));
-  if (prev_bg_color == CLR_INVALID) {
-    return false;
-  }
-
-  // Draw the text
-  bool success = ::ExtTextOut(
-      di->hDC,
-      di->rcItem.left + ::GetSystemMetrics(SM_CXMENUCHECK) + 4,
-      di->rcItem.top,
-      ETO_OPAQUE,
-      &di->rcItem,
-      text.GetString(),
-      text.GetLength(),
-      NULL) == TRUE;
-
-  // Restore the original colors
-  ::SetTextColor(di->hDC, prev_fg_color);
-  ::SetBkColor(di->hDC, prev_bg_color);
-
-  return success;
-}
-
-// Handle WM_MENUCHAR message
-int PopupMenu::OnMenuChar(TCHAR key) {
-  int pos = accelerator_keys_.FindKey(Char_ToLower(key));
-  if (pos != -1)
-    return GetMenuPosFromID(accelerator_keys_.GetValueAt(pos));
-  else
-    return -1;
-}
-
-HFONT PopupMenu::GetBoldFont() {
-  if (!bold_font_) {
-    NONCLIENTMETRICS ncm;
-    SetZero(ncm);
-    ncm.cbSize = sizeof(NONCLIENTMETRICS);
-    if (::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0)) {
-      ncm.lfMenuFont.lfWeight = FW_BOLD;
-      reset(bold_font_, ::CreateFontIndirect(&ncm.lfMenuFont));
-    } else {
-      UTIL_LOG(LEVEL_ERROR, (_T("[PopupMenu::GetBoldFont]")
-                             _T("[failed to get system menu font][0x%x]"),
-                             HRESULTFromLastError()));
-    }
-  }
-
-  ASSERT1(bold_font_);
-
-  return get(bold_font_);
-}
-
-// Get menu pos from ID
-int PopupMenu::GetMenuPosFromID(int id) {
-  ASSERT1(id >= 0);
-  int count = ::GetMenuItemCount(get(menu_));
-  if (count > 0) {
-    for (int pos = 0; pos < count; ++pos) {
-      if (::GetMenuItemID(get(menu_), pos) == static_cast<UINT>(id)) {
-        return pos;
-      }
-    }
-  }
-
-  return -1;
-}
-
-}  // namespace omaha
-
diff --git a/base/popup_menu.h b/base/popup_menu.h
deleted file mode 100644
index 9428381..0000000
--- a/base/popup_menu.h
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef  OMAHA_COMMON_POPUP_MENU_H_
-#define  OMAHA_COMMON_POPUP_MENU_H_
-
-#include "omaha/base/debug.h"
-#include "omaha/base/scoped_any.h"
-
-namespace omaha {
-
-struct MenuItemDrawStyle {
-  bool is_bold;
-  HICON icon;
-
-  MenuItemDrawStyle() : is_bold(false), icon(NULL) {}
-};
-
-
-class PopupMenu {
- public:
-  PopupMenu();
-  PopupMenu(HINSTANCE inst, const TCHAR* name);
-
-  ~PopupMenu();
-
-  // Load from resource
-  bool LoadFromResource(HINSTANCE inst, const TCHAR* name);
-
-  // Append menu item
-  bool AppendMenuItem(int menu_item_id, const TCHAR* text);
-  bool AppendMenuItem(int menu_item_id,
-                      const TCHAR* text,
-                      const MenuItemDrawStyle* style);
-
-  // Append separator
-  bool AppendSeparator();
-
-  // Helper function that populates the MENUITEMINFO structure and sets
-  // accelerator keys for OWNERDRAW menu items
-  MENUITEMINFO PrepareMenuItemInfo(int menu_item_id,
-                                   const TCHAR* text,
-                                   const MenuItemDrawStyle* style);
-
-  // Insert menu item
-  bool InsertMenuItem(int menu_item_id,
-                      int before_item,
-                      bool by_pos,
-                      const TCHAR* text);
-
-  bool InsertMenuItem(int menu_item_id,
-                      int before_item,
-                      bool by_pos,
-                      const TCHAR* text,
-                      const MenuItemDrawStyle* style);
-
-  // Insert separator
-  bool InsertSeparator(int before_item, bool by_pos);
-
-  // Modify a given menu item
-  bool ModifyMenuItem(int menu_item,
-                      bool by_pos,
-                      const TCHAR* text,
-                      const MenuItemDrawStyle* style);
-
-  // Remove menu item
-  bool RemoveMenuItem(int menu_item, bool by_pos);
-
-  // Enable menu item
-  bool EnableMenuItem(int menu_item, bool by_pos, bool enabled);
-
-  // Get menu state
-  bool GetMenuState(int menu_item, bool by_pos, int* menu_state);
-
-  // Exists a menu item
-  bool ExistsMenuItem(int menu_item_id);
-
-  // Get menu pos from ID
-  int GetMenuPosFromID(int id);
-
-  // Attach to the window
-  void AttachToWindow(HWND wnd) {
-    ASSERT1(wnd);
-    wnd_ = wnd;
-  }
-
-  // Redraw menu
-  bool Redraw();
-
-  // Track menu
-  bool Track();
-
-  // Handle WM_MEASUREITEM message
-  bool OnMeasureItem(MEASUREITEMSTRUCT* mi);
-
-  // Handle WM_MDRAWITEM message
-  bool OnDrawItem(DRAWITEMSTRUCT* di);
-
-  // Handle WM_MENUCHAR message
-  int OnMenuChar(TCHAR key);
-
- private:
-  // Get bold font
-  HFONT GetBoldFont();
-
-  // Draw the text
-  bool DrawText(const CString& text,
-                DRAWITEMSTRUCT* di,
-                int fg_color_idx,
-                int bg_color_idx);
-
-  HWND wnd_;           // HWND associated with this menu
-  scoped_hmenu menu_;  // HMENU associated with this menu
-
-  // Bold font used in owner draw menu-item
-  scoped_hfont bold_font_;
-
-  // Accelerator key used in owner draw menu-item
-  CSimpleMap<TCHAR, int> accelerator_keys_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(PopupMenu);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_POPUP_MENU_H_
-
diff --git a/base/preprocessor_fun.h b/base/preprocessor_fun.h
deleted file mode 100644
index c2f6c12..0000000
--- a/base/preprocessor_fun.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// PP_STRINGIZE - expands arguments before stringizing
-// PP_STRINGIZE(PP_CAT(a,b)) => "ab"
-
-#define PP_STRINGIZE(text)   PP_STRINGIZE_A((text))
-#define PP_STRINGIZE_A(arg)  PP_STRINGIZE_B ## (arg)
-#define PP_STRINGIZE_B(arg)  PP_STRINGIZE_I ## arg
-#define PP_STRINGIZE_I(text) #text
-
-// T_PP_STRINGIZE - expands arguments before stringizing
-// T_PP_STRINGIZE(PP_CAT(a,b)) => _T("ab")
-
-#define T_PP_STRINGIZE(text)   T_PP_STRINGIZE_A((text))
-#define T_PP_STRINGIZE_A(arg)  T_PP_STRINGIZE_B ## (arg)
-#define T_PP_STRINGIZE_B(arg)  T_PP_STRINGIZE_I ## arg
-#define T_PP_STRINGIZE_I(text) _T(#text)
-
-// PP_CAT - concatenates arguments after they have been expanded
-// PP_CAT(x, PP_CAT(y,z)) => xyz
-#define PP_CAT(a,b)   PP_CAT_I(a,b)
-#define PP_CAT_I(a,b) PP_CAT_J(a##b)
-#define PP_CAT_J(arg) arg
diff --git a/base/proc_utils.cc b/base/proc_utils.cc
deleted file mode 100644
index fa1e6ad..0000000
--- a/base/proc_utils.cc
+++ /dev/null
@@ -1,463 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// proc_utils.cpp
-//
-// Useful functions that relate to process/thread manipulation/information
-// (Originally moved from utils.cpp)
-
-#include "omaha/base/proc_utils.h"
-
-#include <psapi.h>
-#include "base/scoped_ptr.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/const_config.h"
-#include "omaha/base/const_timeouts.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/process.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/window_utils.h"
-
-namespace omaha {
-
-ProcessTerminator::ProcessTerminator(const CString& process_name)
-    : recursion_level_(0),
-      process_name_(process_name),
-      flash_window_(false),
-      session_id_(INVALID_SESSION_ID) {
-  MakeLowerCString(process_name_);
-}
-
-ProcessTerminator::ProcessTerminator(const CString& process_name,
-                                     const CString& user_sid)
-    : recursion_level_(0),
-      user_sid_(user_sid),
-      process_name_(process_name),
-      flash_window_(false),
-      session_id_(INVALID_SESSION_ID) {
-  MakeLowerCString(process_name_);
-}
-
-ProcessTerminator::ProcessTerminator(const CString& process_name,
-                                     const CString& user_sid,
-                                     int session_id)
-    : recursion_level_(0),
-      user_sid_(user_sid),
-      session_id_(session_id),
-      process_name_(process_name),
-      flash_window_(false) {
-  MakeLowerCString(process_name_);
-}
-
-ProcessTerminator::~ProcessTerminator() {
-  CloseAllHandles();
-}
-
-// Will close all currently opened handles.
-void ProcessTerminator::CloseAllHandles() {
-  UTIL_LOG(L3, (_T("[CloseAllHandles]")));
-  // Do clean up if we have opened handles.
-  for (size_t i = 0; i < process_handles_.size(); i++) {
-    VERIFY1(::CloseHandle(process_handles_[i]));
-  }
-
-  process_handles_.clear();
-}
-
-// Wait for a while till all process instances will die.
-bool ProcessTerminator::WaitForProcessInstancesToDie(
-    uint32 timeout_msec) const {
-  UTIL_LOG(L3, (_T("[WaitForProcessInstancesToDie]")));
-  size_t size = process_handles_.size();
-  scoped_array<HANDLE> handles(new HANDLE[size]);
-
-  for (size_t i = 0; i < size; i++) {
-    handles[i] = process_handles_[i];
-  }
-
-  DWORD wait_result = ::WaitForMultipleObjectsEx(size,
-                                                 handles.get(),
-                                                 true,
-                                                 timeout_msec,
-                                                 false);
-#pragma warning(disable : 4296)
-// C4296: '>=' : expression is always true
-  if ((wait_result >= WAIT_OBJECT_0) &&
-      (wait_result < WAIT_OBJECT_0 + size)) {
-    return true;
-  }
-#pragma warning(default : 4296)
-
-  UTIL_LOG(L3, (_T("WaitForProcessToDie timed out for '%s'. Waited for %d ms."),
-                process_name_, timeout_msec));
-  return false;
-}
-
-// Finds all process ids for the process of a given name.
-bool ProcessTerminator::FindProcessInstances() {
-  UTIL_LOG(L3, (_T("[FindProcessInstances]")));
-
-  DWORD exclude_mask = EXCLUDE_CURRENT_PROCESS;
-  if (!user_sid_.IsEmpty()) {
-    exclude_mask |= INCLUDE_ONLY_PROCESS_OWNED_BY_USER;
-  }
-
-  std::vector<CString> command_lines;
-  HRESULT hr = S_OK;
-  if (session_id_ != INVALID_SESSION_ID) {
-    hr = Process::FindProcessesInSession(session_id_,
-                                         exclude_mask,
-                                         process_name_,
-                                         true,
-                                         user_sid_,
-                                         command_lines,
-                                         &process_ids_);
-  } else {
-    hr = Process::FindProcesses(exclude_mask,
-                                process_name_,
-                                true,
-                                user_sid_,
-                                command_lines,
-                                &process_ids_);
-  }
-
-  return SUCCEEDED(hr) && !process_ids_.empty();
-}
-
-// Tries to kill all instances of the process that was specified in the
-// constructor.
-// 'method_mask' determines which technique to attempt.
-// 'was_found' is optional and can be NULL.
-// Returns S_OK if all instances were killed, S_FALSE if process wasn't running,
-// and E_FAIL if one or more instances weren't killed.
-// Always sets 'was_found' correctly, regardless of return value.
-HRESULT ProcessTerminator::KillTheProcess(uint32 timeout_msec,
-                                          bool* was_found,
-                                          uint32 method_mask,
-                                          bool flash_window) {
-  UTIL_LOG(L3, (_T("[KillTheProcess]")));
-  if (!FindProcessInstances()) {
-    if (was_found != NULL) {
-      *was_found = false;
-    }
-    return S_FALSE;  // process is not running, so don't return a FAILED hr
-  }
-
-  // If got here, found at least one process to kill
-  if (was_found != NULL) {
-    *was_found = true;
-  }
-
-  flash_window_ = flash_window;
-  // Try the nicest, cleanest method of closing a process: window messages
-  if (method_mask & KILL_METHOD_1_WINDOW_MESSAGE) {
-    if (PrepareToKill(KILL_METHOD_1_WINDOW_MESSAGE)) {
-      KillProcessViaWndMessages(timeout_msec);
-    }
-
-    // Are any instances of the process still running?
-    if (!FindProcessInstances()) {
-      return S_OK;  // killed them all
-    }
-  }
-
-  // Also nice method
-  if (method_mask & KILL_METHOD_2_THREAD_MESSAGE) {
-    if (PrepareToKill(KILL_METHOD_2_THREAD_MESSAGE)) {
-      KillProcessViaThreadMessages(timeout_msec);
-    }
-    // Are any instances of the process still running?
-    if (!FindProcessInstances()) {
-      return S_OK;  // killed them all
-    }
-  }
-
-  // the crude one.
-  if (method_mask & KILL_METHOD_4_TERMINATE_PROCESS) {
-    if (PrepareToKill(KILL_METHOD_4_TERMINATE_PROCESS)) {
-      KillProcessViaTerminate(timeout_msec);
-    }
-    // Are any instances of the process still running?
-    if (!FindProcessInstances()) {
-      return S_OK;  // killed them all
-    }
-
-    UTIL_LOG(LEVEL_ERROR, (_T("[ProcessTerminator::KillTheProcess]")
-                           _T("[totally unable to kill process '%s']"),
-                           process_name_));
-  }
-
-  return E_FAIL;
-}
-
-HRESULT ProcessTerminator::WaitForAllToDie(uint32 timeout_msec) {
-  UTIL_LOG(L3, (_T("[WaitForAllToDie]")));
-  if (!FindProcessInstances()) {
-    return S_OK;
-  }
-
-  if (PrepareToKill(KILL_METHOD_1_WINDOW_MESSAGE)) {
-    return WaitForProcessInstancesToDie(timeout_msec) ? S_OK :
-              HRESULT_FROM_WIN32(WAIT_TIMEOUT);
-  }
-
-  return E_FAIL;
-}
-
-// Given process_ids array will try to
-// open handle to each instance.
-// Leaves process handles open (in member process_handles_)
-// Will use access rights for opening appropriate for the purpose_of_opening.
-// This function recursively calls itself if by the time it tries to open
-// handles to process instances some of the processes died or naturally exited.
-bool ProcessTerminator::PrepareToKill(uint32 method_mask) {
-  UTIL_LOG(L3, (_T("[PrepareToKill]")));
-  uint32 desired_access = 0;
-
-  if (method_mask & KILL_METHOD_4_TERMINATE_PROCESS) {
-    desired_access = SYNCHRONIZE       |
-                     PROCESS_TERMINATE |
-                     PROCESS_QUERY_INFORMATION;
-  } else {
-    desired_access = SYNCHRONIZE | PROCESS_QUERY_INFORMATION | PROCESS_VM_READ;
-  }
-
-  // do clean up in case some handles are opened.
-  CloseAllHandles();
-
-  if (process_ids_.empty()) {
-    // no instances are running.
-    return false;
-  }
-
-  for (size_t i = 0; i < process_ids_.size(); i++) {
-    HANDLE handle = ::OpenProcess(desired_access, false, process_ids_[i]);
-    if (handle) {
-      process_handles_.push_back(handle);
-    } else {
-      if (::GetLastError() == ERROR_ACCESS_DENIED) {
-        // If we are here that means that we do not have enough priveleges to
-        // open the process for a given kill method. No reason to attempt other
-        // instances. Just clean up and return false.
-        UTIL_LOG(L3, (_T("PrepareToKill failed for '%s'. Kill method %d."),
-                      process_name_, method_mask));
-        CloseAllHandles();
-        return false;
-      }
-    }
-  }
-  // We already handled the case when we don't have enough privileges to open
-  // the process. So if we have less handles than process ids -> some of the
-  // processes have died since we made a snapshot untill the time we tried to
-  // open handles. We need to do another snapshot and try to open handles one
-  // more time. We need number of handles and number of ids to be equal.
-  // We can do it with recursion. The idea is: make the next snapshot and open
-  // handles. Hopefully the number will be equal. Stop recursion at the third
-  // level.
-
-  if (process_handles_.size() != process_ids_.size()) {
-    recursion_level_++;
-
-    // we have a disbalance here. This is pretty bad.
-    // Some of the processes died already so let's try
-    // to balance them.
-    if (!FindProcessInstances()) {
-      // they are all dead.
-      recursion_level_ = 0;
-      return false;
-    }
-
-    // try to balance three times no more.
-    if (recursion_level_ >= 3) {
-      recursion_level_ = 0;
-      UTIL_LOG(L3, (_T("Recursion level too deep in PrepareToKill for '%s'."),
-                    process_name_));
-      return false;
-    }
-
-    // recursively call the function
-    return PrepareToKill(method_mask);
-  }
-  recursion_level_ = 0;
-  return true;
-}
-
-// ProcessTerminator::FindProcessWindows
-// Just calls enumeration function
-bool ProcessTerminator::FindProcessWindows() {
-  window_handles_.clear();
-  return ::EnumWindows(EnumAllWindowsProc, reinterpret_cast<LPARAM>(this)) &&
-         !window_handles_.empty();
-}
-
-// ProcessTerminator::EnumAllWindowsProc
-// During enumeration this function will try to find a match between
-// process id we already found and process id obtained from each window.
-// if there is a match, we record the window in an array
-BOOL ProcessTerminator::EnumAllWindowsProc(HWND hwnd, LPARAM lparam) {
-  ProcessTerminator* this_pointer =
-        reinterpret_cast<ProcessTerminator*>(lparam);
-  ASSERT1(this_pointer);
-
-  uint32 process_id = 0;
-  uint32 thread_id =
-    ::GetWindowThreadProcessId(hwnd, reinterpret_cast<DWORD*>(&process_id));
-
-  typedef std::vector<uint32>::const_iterator ProcessIdIterator;
-  for (ProcessIdIterator it = this_pointer->process_ids_.begin();
-       it != this_pointer->process_ids_.end();
-       ++it) {
-    if (*it == process_id) {
-      // The main idea is: Find all top level windows (NO PARENT!!!)
-      // AND this windows must have system menu and be visible. So we make sure
-      // that we send WM_CLOSE ONLY to the windows that user might close
-      // interactively. This way we are safe. The last thing to check is if it
-      // is tr hidden window.
-      if (WindowUtils::IsMainWindow(hwnd) && WindowUtils::HasSystemMenu(hwnd)) {
-        this_pointer->window_handles_.push_back(hwnd);
-      }
-    }
-  }
-  return TRUE;
-}
-
-// ProcessTerminator::KillProcessViaWndMessages()
-// try to post a windows message
-bool  ProcessTerminator::KillProcessViaWndMessages(uint32 timeout_msec) {
-  UTIL_LOG(L3, (_T("[KillProcessViaWndMessages]")));
-  if (!FindProcessWindows()) {
-    UTIL_LOG(L1, (_T("[KillProcessViaWndMessages]")
-                  _T("[failed to find any windows for '%s']"), process_name_));
-    return false;
-  }
-
-  bool post_messages_succeeded = false;
-
-  for (size_t i = 0; i < window_handles_.size(); i++) {
-    // Previous method used WM_CLOSE, WM_SYSCOMMAND+SC_CLOSE is slightly better.
-    // It closes our apps, and also works correctly on AOL!
-    if (::PostMessage(window_handles_[i], WM_SYSCOMMAND, SC_CLOSE, 0)) {
-      if (flash_window_) {
-        UTIL_LOG(L3, (_T("[PostMessageSucceeded flashing window]")));
-        ::FlashWindow(window_handles_[i], true);
-      }
-      post_messages_succeeded = true;
-    }
-  }
-
-  if (!post_messages_succeeded) {
-    UTIL_LOG(L3, (_T("[KillProcessViaWndMessages]")
-                  _T("[failed to PostMessage to windows of '%s']"),
-                  process_name_));
-  }
-  // If we succeeded in posting message at least one time we have to wait.
-  // We don't know the relationship between windows in the process.
-  return post_messages_succeeded && WaitForProcessInstancesToDie(timeout_msec);
-}
-
-// Try to post a thread message.
-bool ProcessTerminator::KillProcessViaThreadMessages(uint32 timeout_msec) {
-  UTIL_LOG(L3, (_T("[KillProcessViaThreadMessages]")));
-  std::vector<uint32> thread_ids;
-
-  if (!FindProcessThreads(&thread_ids)) {
-    UTIL_LOG(L3, (_T("[KillProcessViaThreadMessages]")
-                  _T("[failed to find any threads for '%s']"), process_name_));
-    return false;
-  }
-
-  bool post_messages_succeeded = false;
-  for (size_t i = 0; i < thread_ids.size(); i++) {
-    if (::PostThreadMessage(thread_ids[i], WM_CLOSE, 0, 0)) {
-      post_messages_succeeded = true;
-    }
-  }
-
-  if (!post_messages_succeeded) {
-    UTIL_LOG(L3, (_T("[KillProcessViaWndMessages]")
-                  _T("[failed to PostMessage to threads of '%s'."),
-                  process_name_));
-  }
-  // If we succeded in posting message to at least one thread we have to wait.
-  // We don't know the relationship between threads in the process.
-  return post_messages_succeeded && WaitForProcessInstancesToDie(timeout_msec);
-}
-
-// find all the threads running in a given process.
-bool ProcessTerminator::FindProcessThreads(std::vector<uint32>* thread_ids) {
-  HANDLE process_snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
-  if (process_snapshot == INVALID_HANDLE_VALUE) {
-    return false;
-  }
-
-  THREADENTRY32 thread_info = {0};  // zero it out just in case.
-  thread_info.dwSize = sizeof(THREADENTRY32);
-
-  if (::Thread32First(process_snapshot, &thread_info))  {
-    do {
-      for (std::vector<uint32>::const_iterator it = process_ids_.begin();
-           it != process_ids_.end(); ++it) {
-        if (*it == thread_info.th32OwnerProcessID) {
-          // we have found it.
-          thread_ids->push_back(thread_info.th32ThreadID);
-        }
-      }
-      // system changes this value, do not forget to reset to
-      // max possible.
-      thread_info.dwSize = sizeof(THREADENTRY32);
-    } while (::Thread32Next(process_snapshot, &thread_info));
-  }
-
-  return !thread_ids->empty();
-}
-
-// Last and crude method to kill the process. Should be used only
-// if all other methods have failed.
-bool ProcessTerminator::KillProcessViaTerminate(uint32 timeout_msec) {
-  UTIL_LOG(L3, (_T("[KillProcessViaTerminate]")));
-  bool at_least_one_terminated = false;
-
-  for (size_t i = 0; i < process_handles_.size(); i++) {
-    if (!::TerminateProcess(process_handles_[i], 0)) {
-      UTIL_LOG(L3, (_T("[KillProcessViaTerminate]")
-                    _T("[failed for instance of '%s'][System error %d]"),
-                    process_name_, ::GetLastError()));
-    } else {
-       at_least_one_terminated = true;
-    }
-  }
-  return at_least_one_terminated ? WaitForProcessInstancesToDie(timeout_msec) :
-                                   false;
-}
-
-HRESULT SetProcessSilentShutdown() {
-  DWORD shut_down_level(0), shut_down_flags(0);
-  if (!::GetProcessShutdownParameters(&shut_down_level, &shut_down_flags)) {
-    return HRESULTFromLastError();
-  }
-  shut_down_flags |= SHUTDOWN_NORETRY;
-  if (!::SetProcessShutdownParameters(shut_down_level, shut_down_flags)) {
-    return HRESULTFromLastError();
-  }
-  return S_OK;
-}
-
-}  // namespace omaha
-
diff --git a/base/proc_utils.h b/base/proc_utils.h
deleted file mode 100644
index 4cc78c6..0000000
--- a/base/proc_utils.h
+++ /dev/null
@@ -1,148 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_PROC_UTILS_H_
-#define OMAHA_COMMON_PROC_UTILS_H_
-
-#include <windows.h>
-#include <tlhelp32.h>
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-// Moved here from installation directory. Generic enought to be in common.
-class ProcessTerminator {
- public:
-
-  // constants for specifying which methods to attempt when killing a process
-  static const int KILL_METHOD_1_WINDOW_MESSAGE = 0x01;
-  static const int KILL_METHOD_2_THREAD_MESSAGE = 0x02;
-  static const int KILL_METHOD_4_TERMINATE_PROCESS = 0x08;
-  static const int INVALID_SESSION_ID = 0xFFFF;
-
-  // Creates the object given the process name to kill.
-  explicit ProcessTerminator(const CString& process_name);
-  ProcessTerminator(const CString& process_name, const CString& user_sid);
-  ProcessTerminator(const CString& process_name,
-                    const CString& user_sid,
-                    int session_id);
-
-  // Performs necessary cleanup.
-  ~ProcessTerminator();
-
-  // Go through process list try to find the required one to kill,
-  // trying three methods to kill, from easiest and cleanest to a
-  // harsh one.  S_OK if no process by the right name was found, or if it was
-  // found and was killed.  E_FAIL otherwise.  was_found returns true if
-  // process was found. Kills all instances of a process.
-  HRESULT KillTheProcess(uint32 timeout_msec,
-                         bool* was_found,
-                         uint32 method_mask,
-                         bool flash_window);
-
-  // Wait for all instances of the process to die.
-  HRESULT WaitForAllToDie(uint32 timeout_msec);
-
-  // Finds all process ids for the process of a given name.
-  bool FindProcessInstances();
-
- private:
-
-  // Will try to open handle to each instance.
-  // Leaves process handles open (in member process_handles_)
-  // Will use access rights for opening appropriate for the purpose_of_opening
-  bool PrepareToKill(uint32 method_mask);
-
-  // Wait for process instances to die for timeout_msec
-  // return true if all are dead and false if timed out.
-  bool WaitForProcessInstancesToDie(uint32 timeout_msec) const;
-
-  // Will close all currently opened handles.
-  void CloseAllHandles();
-
-
-  //
-  // Killing via messages to window
-  //
-  // Function which meet win32 requirements for callback
-  // function passed into EnumWindows function.
-  BOOL static CALLBACK EnumAllWindowsProc(HWND hwnd, LPARAM lparam);
-
-  // Will return true if it succeeds in finding a window for the process
-  // to be killed, otherwise false.  If there are such top-level windows
-  // then returns an array of window handles.
-  bool FindProcessWindows();
-
-  // Will try to kill the process via posting windows messages
-  // returns true on success otherwise false.
-  // Timeout is maximum time to wait for WM_CLOSE to work before going to
-  // next method.
-  bool KillProcessViaWndMessages(uint32 timeout_msec);
-
-  //
-  // Killing via messages to thread
-  //
-  // Try to find the threads than run in
-  // the process in question.
-  bool FindProcessThreads(std::vector<uint32>* thread_ids);
-
-  // Will try to kill the process via posing thread messages
-  // returns true on success otherwise false.
-  // Timeout is maximum time to wait for message to work before going to
-  // next method.
-  bool KillProcessViaThreadMessages(uint32 timeout_msec);
-
-  // The last and crude method to kill the process.
-  // Calls TerminateProcess function.
-  bool KillProcessViaTerminate(uint32 timeout_msec);
-
-  // Private member variables:
-  CString process_name_;
-  // One process can have several instances
-  // running. This array will keep handles to all
-  // instances of the process.
-  std::vector<HANDLE> process_handles_;
-  // Array of process ids which correspond to different
-  // instances of the same process.
-  std::vector<uint32>  process_ids_;
-  // Function PrepareToKill can call itself
-  // recursively under some conditions.
-  // We need to stop the recursion at some point.
-  // This is the purpose of this member.
-  int recursion_level_;
-  // Array of window handles.
-  std::vector<HWND> window_handles_;
-  // The sid of the user whose process needs to be terminated.
-  CString user_sid_;
-  // True if the window flashes on shut down.
-  bool flash_window_;
-  // The session to search the processes in.
-  int session_id_;
-
-  // Disable copy constructor and assignment operator.
-  DISALLOW_EVIL_CONSTRUCTORS(ProcessTerminator);
-};
-
-// Application calling this function will be shut down
-// by the system without displaying message boxes if the application
-// fails to shutdown itself properly as a result of processing
-// WM_QUERYENDSESSION.
-HRESULT SetProcessSilentShutdown();
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_PROC_UTILS_H_
diff --git a/base/proc_utils_unittest.cc b/base/proc_utils_unittest.cc
deleted file mode 100644
index 0a47041..0000000
--- a/base/proc_utils_unittest.cc
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/proc_utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(ProcUtilsTest, SetSilentShutdown) {
-  ASSERT_HRESULT_SUCCEEDED(SetProcessSilentShutdown());
-}
-
-}  // namespace omaha
-
diff --git a/base/process.cc b/base/process.cc
deleted file mode 100644
index 0ebfb07..0000000
--- a/base/process.cc
+++ /dev/null
@@ -1,1650 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Defines class Process to incapsulate win32
-// functions for creation and some manipulations of
-// processes.
-
-#include "omaha/base/process.h"
-
-#include <ntsecapi.h>
-#include <psapi.h>
-#include <stierr.h>
-#include <tlhelp32.h>
-#include <vector>
-
-#ifndef NT_SUCCESS
-#define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0)
-#endif
-
-#include "omaha/base/debug.h"
-#include "omaha/base/disk.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/string.h"
-#include "omaha/base/system.h"
-#include "omaha/base/system_info.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/user_info.h"
-#include "omaha/base/window_utils.h"
-
-namespace omaha {
-
-const int kNumRetriesToFindProcess = 4;
-const int kFindProcessRetryIntervalMs = 500;
-const int kMaxCmdLineLengthBytes = 4096;
-
-// Constructor
-Process::Process(const TCHAR* name,
-                 const TCHAR* window_class_name)
-    : process_id_(0),
-      exit_code_(0),
-      number_of_restarts_(static_cast<uint32>(-1)),
-      name_(name),
-      shutdown_event_(NULL) {
-  ASSERT1(name);
-  command_line_ = name;
-  window_class_name_ = window_class_name;
-}
-
-// Constructor
-Process::Process(uint32 process_id)
-    : process_id_(process_id),
-      exit_code_(0),
-      number_of_restarts_(static_cast<uint32>(-1)),
-      name_(itostr(static_cast<uint32>(process_id))),
-      shutdown_event_(NULL) {
-  reset(process_, ::OpenProcess(PROCESS_QUERY_INFORMATION | SYNCHRONIZE,
-                                false,
-                                process_id));
-  if (!valid(process_)) {
-    UTIL_LOG(LEVEL_ERROR,
-             (_T("[Process::Process - failed to open process][%u][0x%x]"),
-              process_id, HRESULTFromLastError()));
-  }
-}
-
-// Destructor
-Process::~Process() {
-}
-
-// Start with command params
-HRESULT Process::Start(const TCHAR* command_line_parameters,
-                       HANDLE runas_token) {
-  if (command_line_parameters && *command_line_parameters) {
-    command_line_parameters_ = command_line_parameters;
-  }
-
-  number_of_restarts_ = static_cast<uint32>(-1);
-  time_of_start_      = GetTickCount();
-
-  return Restart(runas_token);
-}
-
-// Restart with the old command params
-HRESULT Process::Restart(HANDLE runas_token) {
-  // Can't start the same process twice in the same containing object.
-  if (Running()) {
-    return E_FAIL;
-  }
-
-  PROCESS_INFORMATION process_info = {0};
-  HRESULT hr = runas_token ?
-                   System::StartProcessAsUser(runas_token,
-                                              command_line_,
-                                              command_line_parameters_,
-                                              _T("WinSta0\\Default"),
-                                              &process_info) :
-                   System::StartProcessWithArgsAndInfo(command_line_,
-                                                       command_line_parameters_,
-                                                       &process_info);
-
-  if (SUCCEEDED(hr)) {
-    VERIFY1(::CloseHandle(process_info.hThread));
-
-    reset(process_, process_info.hProcess);
-    process_id_ = process_info.dwProcessId;
-
-    ASSERT1(process_id_);
-    number_of_restarts_++;
-  } else {
-    UTIL_LOG(LE, (_T("[Process Restart failed][%s][0x%x]"), command_line_, hr));
-  }
-
-  return hr;
-}
-
-// Check if the process is running.
-bool Process::Running() const {
-  if (!get(process_)) {
-    return false;
-  }
-
-  return (::WaitForSingleObject(get(process_), 0) == WAIT_TIMEOUT);
-}
-
-// Create a job and assign the process to it
-HANDLE Process::AssignToJob() {
-  // Make sure that the process handle is valid
-  if (!get(process_)) {
-    return false;
-  }
-
-  // Create a job
-  scoped_job job(::CreateJobObject(NULL, NULL));
-  if (!valid(job)) {
-    UTIL_LOG(LEVEL_ERROR,
-             (_T("[Process::AssignToJob - CreateJobObject failed][0x%x]"),
-              HRESULTFromLastError()));
-    return false;
-  }
-
-  // Assign the process to the job
-  if (!::AssignProcessToJobObject(get(job), get(process_))) {
-    UTIL_LOG(LEVEL_ERROR,
-             (_T("[Process::AssignToJob-AssignProcessToJobObject fail][0x%x]"),
-              HRESULTFromLastError()));
-    return false;
-  }
-
-  return release(job);
-}
-
-// Wait till the process finishes
-bool Process::WaitUntilDead(uint32 timeout_msec) {
-  ASSERT1(timeout_msec);
-
-  if (!get(process_)) {
-    return false;
-  }
-
-  uint32 ret = 0;
-  if (shutdown_event_) {
-    HANDLE wait_handles[2] = {0};
-    wait_handles[0] = get(process_);
-    wait_handles[1] = shutdown_event_;
-    ret = ::WaitForMultipleObjectsEx(2,
-                                     wait_handles,
-                                     false,
-                                     timeout_msec,
-                                     true);
-  } else {
-    ret = ::WaitForSingleObjectEx(get(process_), timeout_msec, true);
-  }
-  if (ret == WAIT_OBJECT_0) {
-    UTIL_LOG(L2, (_T("[Process::WaitUntilDead - succeeded to wait process]")
-                  _T("[%s]"), GetName()));
-    return true;
-  } else if (ret == WAIT_IO_COMPLETION) {
-    UTIL_LOG(LEVEL_ERROR, (_T("[Process::WaitUntilDead-recv APC][%s][%u][%u]"),
-                           GetName(), process_id_));
-    return false;
-  } else {
-    UTIL_LOG(LEVEL_ERROR, (_T("[Process::WaitUntilDead - fail to wait process,")
-                           _T("possibly timeout][%s][%u][%u]"),
-                           GetName(), process_id_, ret));
-    return false;
-  }
-}
-
-// Wait some time till the process and all its descendent processes finish
-//
-// Background:
-//   Some process might spawn another process and get itself terminated
-// without waiting the descendant process to finish.
-//
-// Args:
-//   job:                Job to which the process is assigned
-//                       AssignToJob() will be called when NULL value is passed
-//   timeout_msec:       Timeout value in msec
-//   path_to_exclude:    Path of descendant process to excluded from waiting
-//                       (this should be in long format)
-//   exit_code:          To hold the exit code being returned
-bool Process::WaitUntilAllDead(HANDLE job,
-                               uint32 timeout_msec,
-                               const TCHAR* path_to_exclude,
-                               uint32* exit_code) {
-  ASSERT1(timeout_msec);
-
-  UTIL_LOG(L2, (_T("[Process::WaitUntilAllDead][%u][%s]"),
-                timeout_msec, path_to_exclude));
-
-  if (exit_code) {
-  *exit_code = 0;
-  }
-
-  scoped_job job_guard;
-  if (!job) {
-    reset(job_guard, AssignToJob());
-    if (!valid(job_guard)) {
-      return false;
-    }
-    job = get(job_guard);
-  }
-
-  return InternalWaitUntilAllDead(job,
-                                  timeout_msec,
-                                  path_to_exclude,
-                                  exit_code);
-}
-
-// Helper function to wait till the process and all its descendent processes
-// finish.
-bool Process::InternalWaitUntilAllDead(HANDLE job,
-                                       uint32 timeout_msec,
-                                       const TCHAR* path_to_exclude,
-                                       uint32* exit_code) {
-  ASSERT1(job);
-  ASSERT1(timeout_msec);
-
-  // Wait until current process finishes
-  if (!WaitUntilDead(timeout_msec)) {
-    return false;
-  }
-
-  // Find descendant process
-  uint32 desc_process_id = GetDescendantProcess(
-                               job,
-                               false,  // child_only
-                               exit_code != NULL,  // sole_descendent
-                               NULL,  // search_name
-                               path_to_exclude);
-
-  if (desc_process_id) {
-    // Open descendent process
-    Process desc_process(desc_process_id);
-
-    // If descendant process dies too soon, do not need to wait for it
-    if (desc_process.Running()) {
-      // Release the parent process handle
-      // This to handle the scenario that Firefox uninstall code will wait till
-      // parent process handle becomes NULL
-      reset(process_);
-
-      UTIL_LOG(L2, (_T("[Process::InternalWaitUntilAllDead]")
-                    _T("[waiting descendant process][%u]"), desc_process_id));
-
-      // Propagate the shutdown event to descendent process
-      if (shutdown_event_) {
-        desc_process.SetShutdownEvent(shutdown_event_);
-      }
-
-      // Wait till descendant process finishes
-      bool wait_ret = desc_process.InternalWaitUntilAllDead(job,
-                                                            timeout_msec,
-                                                            path_to_exclude,
-                                                            exit_code);
-
-      return wait_ret;
-    }
-  }
-
-  // Use the exit code from parent process
-  if (exit_code) {
-  VERIFY1(GetExitCode(exit_code));
-  }
-
-  // Release the parent process handle
-  reset(process_);
-
-  return true;
-}
-
-// Wait until process is dead or a windows message arrives (for use in a message
-// loop while waiting)
-HRESULT Process::WaitUntilDeadOrInterrupt(uint32 msec) {
-  if (!get(process_)) {
-    return E_FAIL;
-  }
-
-  HANDLE events[1] = { get(process_) };
-  uint32 dw = ::MsgWaitForMultipleObjects(1, events, FALSE, msec, QS_ALLEVENTS);
-  switch (dw) {
-    case WAIT_OBJECT_0:
-      return CI_S_PROCESSWAIT_DEAD;
-    case WAIT_OBJECT_0 + 1:
-      return CI_S_PROCESSWAIT_MESSAGE;
-    case WAIT_TIMEOUT:
-      return CI_S_PROCESSWAIT_TIMEOUT;
-    case WAIT_FAILED:
-    default:
-      return E_FAIL;
-  }
-}
-
-#if !SHIPPING
-CString Process::GetDebugInfo() const {
-  return debug_info_;
-}
-#endif
-
-// Return the process ID
-uint32 Process::GetId() const {
-  return process_id_;
-}
-
-// Return the process name
-const TCHAR *Process::GetName() const {
-  return name_;
-}
-
-// Return win32 handle to the process.
-HANDLE Process::GetHandle() const {
-  return get(process_);
-}
-
-// Get process exit code.
-bool Process::GetExitCode(uint32* exit_code) const {
-  ASSERT1(exit_code);
-
-  if (!get(process_)) {
-    return false;
-  }
-
-  if (!::GetExitCodeProcess(get(process_),
-                            reinterpret_cast<DWORD*>(&exit_code_))) {
-    UTIL_LOG(LEVEL_ERROR,
-             (_T("[Process::GetExitCode - failed to get exit code][%u][0x%x]"),
-              process_id_, HRESULTFromLastError()));
-    return false;
-  }
-  if (exit_code_ == STILL_ACTIVE) {
-    return false;
-  }
-
-  *exit_code = exit_code_;
-  return true;
-}
-
-// default implementation allows termination
-bool Process::IsTerminationAllowed() const {
-  return true;
-}
-
-// Terminate the process. If wait_for_terminate_msec == 0 return value doesn't
-// mean that the process actualy terminated. It becomes assync. operation.
-// Check the status with Running accessor function in this case.
-bool Process::Terminate(uint32 wait_for_terminate_msec) {
-  if (!Running()) {
-    return true;
-  }
-
-  if (!IsTerminationAllowed()) {
-    return false;
-  }
-
-  if (!::TerminateProcess(get(process_), 1)) {
-    return false;
-  }
-
-  return wait_for_terminate_msec ? WaitUntilDead(wait_for_terminate_msec) :
-                                   true;
-}
-
-// Default returns INFINITE means never restart.
-// Return any number of msec if overwriting
-uint32 Process::GetRestartInterval() const {
-  return INFINITE;
-}
-
-// How many times the process can be restarted
-// in case it crashes. When overriding return any
-// number or INFINITE to restart forever.
-uint32 Process::GetMaxNumberOfRestarts() const {
-  return 0;
-}
-
-// what is the time window for number of crashes returned by
-// GetMaxNumberOfRestarts(). If crashed more that this number of restarts
-// in a specified time window - do not restart it anymore.
-// Default implementation returns INFINITE which means that this is not time
-// based at all, if the process crashed more than the value returned by
-// GetMaxNumberOfRestarts it will not be restarted no matter how long it took.
-uint32 Process::GetTimeWindowForCrashes() const {
-  return INFINITE;
-}
-
-uint32 Process::GetMaxMemory() const {
-  return 0;
-}
-
-// Have we exceeded the number of maximum restarting?
-bool Process::AllowedToRestart() const {
-  uint32 max_number_of_restarts = GetMaxNumberOfRestarts();
-
-  if ((max_number_of_restarts == INFINITE) ||
-     (number_of_restarts_ < max_number_of_restarts)) {
-    return true;
-  }
-
-  // process crashed too many times. Let's look at the rate of crashes.
-  // Maybe we can "forgive" the process if it took some time for it to crash.
-  if ((::GetTickCount() - time_of_start_) < GetTimeWindowForCrashes()) {
-    return false;  // not forgiven
-  }
-
-  // Everything is forgiven. Give the process
-  // new start in life.
-  time_of_start_ = ::GetTickCount();
-  number_of_restarts_ = static_cast<uint32>(-1);
-
-  return true;
-}
-
-// Set shutdown event using in signaling the process watch
-void Process::SetShutdownEvent(HANDLE shutdown_event) {
-  ASSERT1(shutdown_event);
-
-  shutdown_event_ = shutdown_event;
-}
-
-// Set priority class to the process.
-bool Process::SetPriority(uint32 priority_class) const {
-  if (!get(process_)) {
-    return false;
-  }
-
-  VERIFY1(::SetPriorityClass(get(process_), priority_class));
-  return true;
-}
-
-HRESULT Process::GetParentProcessId(uint32* parent_pid) {
-  ASSERT1(parent_pid);
-  *parent_pid = 0;
-
-  scoped_hfile process_snap(::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0));
-  if (!process_snap) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LE, (_T("[GetParentProcessId][Failed snapshot][0x%x]"), hr));
-    return hr;
-  }
-
-  // Eumerate all processes in the snapshot
-  PROCESSENTRY32 pe32;
-  SetZero(pe32);
-  pe32.dwSize = sizeof(PROCESSENTRY32);
-  if (!::Process32First(get(process_snap), &pe32)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LE, (_T("[Process32First failed][0x%x]"), hr));
-    return hr;
-  }
-
-  do {
-    if (pe32.th32ProcessID != process_id_) {
-      continue;
-    }
-
-    if (pe32.th32ParentProcessID) {
-      *parent_pid = pe32.th32ParentProcessID;
-      return S_OK;
-    }
-  } while (::Process32Next(get(process_snap), &pe32));
-
-  return E_FAIL;
-}
-
-// Try to get a descendant process. Return process id if found.
-uint32 Process::GetDescendantProcess(HANDLE job,
-                                     bool child_only,
-                                     bool sole_descedent,
-                                     const TCHAR* search_name,
-                                     const TCHAR* path_to_exclude) {
-  ASSERT1(job);
-
-  // Find all descendent processes
-  std::vector<ProcessInfo> descendant_processes;
-  if (FAILED(GetAllDescendantProcesses(job,
-                                       child_only,
-                                       search_name,
-                                       path_to_exclude,
-                                       &descendant_processes))) {
-    return 0;
-  }
-
-  // If more than one decendent processes is found, filter out those that are
-  // not direct children. This is because it might be the case that in a very
-  // short period of time, process A spawns B and B spawns C, and we capture
-  // both B and C.
-  std::vector<ProcessInfo> child_processes;
-  typedef std::vector<ProcessInfo>::const_iterator ProcessInfoConstIterator;
-  if (descendant_processes.size() > 1) {
-    for (ProcessInfoConstIterator it(descendant_processes.begin());
-         it != descendant_processes.end(); ++it) {
-      if (it->parent_id == process_id_) {
-        child_processes.push_back(*it);
-      }
-    }
-    if (!child_processes.empty()) {
-      descendant_processes = child_processes;
-    }
-  }
-
-  // Save the debugging information if needed
-#if !SHIPPING
-  if (sole_descedent && descendant_processes.size() > 1) {
-    debug_info_ = _T("More than one descendent process is found for process ");
-    debug_info_ += itostr(process_id_);
-    debug_info_ += _T("\n");
-    for (ProcessInfoConstIterator it(descendant_processes.begin());
-         it != descendant_processes.end(); ++it) {
-      debug_info_.AppendFormat(_T("%u %u %s\n"),
-                               it->process_id,
-                               it->parent_id,
-                               it->exe_file);
-    }
-  }
-#else
-  sole_descedent;   // unreferenced formal parameter
-#endif
-
-  return descendant_processes.empty() ? 0 : descendant_processes[0].process_id;
-}
-
-BOOL Process::IsProcessInJob(HANDLE process_handle,
-                             HANDLE job_handle,
-                             PBOOL result)  {
-  typedef BOOL (WINAPI *Fun)(HANDLE process_handle,
-                             HANDLE job_handle,
-                             PBOOL result);
-
-  HINSTANCE kernel_instance = ::GetModuleHandle(_T("kernel32.dll"));
-  ASSERT1(kernel_instance);
-  Fun pfn = reinterpret_cast<Fun>(::GetProcAddress(kernel_instance,
-                                                   "IsProcessInJob"));
-  ASSERT(pfn, (_T("IsProcessInJob export not found in kernel32.dll")));
-  return pfn ? (*pfn)(process_handle, job_handle, result) : FALSE;
-}
-
-// Try to get all matching descendant processes
-HRESULT Process::GetAllDescendantProcesses(
-                     HANDLE job,
-                     bool child_only,
-                     const TCHAR* search_name,
-                     const TCHAR* path_to_exclude,
-                     std::vector<ProcessInfo>* descendant_processes) {
-  ASSERT1(job);
-  ASSERT1(descendant_processes);
-
-  // Take a snapshot
-  // Note that we do not have a seperate scoped_* type defined to wrap the
-  // handle returned by CreateToolhelp32Snapshot. So scoped_hfile with similar
-  // behavior is used.
-  scoped_hfile process_snap(::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0));
-  if (!process_snap) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR,
-             (_T("[Process::GetAllDescendantProcesses - fail to get snapshot]")
-              _T("[0x%x]"), hr));
-    return hr;
-  }
-
-  // Eumerate all processes in the snapshot
-  PROCESSENTRY32 pe32;
-  SetZero(pe32);
-  pe32.dwSize = sizeof(PROCESSENTRY32);
-  if (!::Process32First(get(process_snap), &pe32)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[Process::GetAllDescendantProcesses - failed to")
-                           _T("get first process][0x%x]"), hr));
-    return hr;
-  }
-
-  do {
-    // Skip process 0 and current process
-    if (pe32.th32ProcessID == 0 || pe32.th32ProcessID == process_id_) {
-      continue;
-    }
-
-    // If searching for child only, perform the check
-    if (child_only && pe32.th32ParentProcessID != process_id_) {
-      continue;
-    }
-
-    // Open the process
-    scoped_process process(::OpenProcess(PROCESS_QUERY_INFORMATION |
-                                         SYNCHRONIZE,
-                                         false,
-                                         pe32.th32ProcessID));
-    if (!valid(process)) {
-      continue;
-    }
-
-    // Determines whether the process is running in the specified job
-    BOOL result = FALSE;
-    if (!IsProcessInJob(get(process), job, &result) || !result) {
-      continue;
-    }
-
-    // Check whether the process is still running
-    if (::WaitForSingleObject(get(process), 0) != WAIT_TIMEOUT) {
-      continue;
-    }
-
-    // Compare the name if needed
-    if (search_name && *search_name) {
-      if (_tcsicmp(pe32.szExeFile, search_name) != 0) {
-        continue;
-      }
-    }
-
-    // If we need to exclude certain path, check it now
-    if (path_to_exclude && *path_to_exclude) {
-      if (IsProcessRunningWithPath(pe32.th32ProcessID, path_to_exclude)) {
-        continue;
-      }
-    }
-
-    // Add to the list
-    ProcessInfo proc_info;
-    proc_info.process_id = pe32.th32ProcessID;
-    proc_info.parent_id = pe32.th32ParentProcessID;
-#if !SHIPPING
-    proc_info.exe_file = pe32.szExeFile;
-#endif
-    descendant_processes->push_back(proc_info);
-  } while (::Process32Next(get(process_snap), &pe32));
-
-  return S_OK;
-}
-
-HRESULT Process::FindProcesses(uint32 exclude_mask,
-                               const TCHAR* search_name,
-                               bool search_main_executable_only,
-                               std::vector<uint32>* process_ids_found) {
-  ASSERT1(process_ids_found);
-  // Remove the only include processes owned by user mask from the exclude
-  // mask. This is needed as this is the behavior expected by the method,
-  // before the addition of the user_sid.
-  exclude_mask &= (~INCLUDE_ONLY_PROCESS_OWNED_BY_USER);
-  std::vector<CString> command_lines;
-  return FindProcesses(exclude_mask, search_name, search_main_executable_only,
-                       _T(""), command_lines, process_ids_found);
-}
-
-bool Process::IsStringPresentInList(const CString& process_command_line,
-                                    const std::vector<CString>& list) {
-  std::vector<CString>::const_iterator iter = list.begin();
-  for (; iter != list.end(); ++iter) {
-    CString value_to_find = *iter;
-
-    // If we are able to open the process command line, then we should
-    // ensure that it does not contain the value that we are looking for.
-    if (process_command_line.Find(value_to_find) != -1) {
-      // Found a match.
-      return true;
-    }
-  }
-
-  return false;
-}
-
-// TODO(omaha): Change the implementation of this method to take in a
-// predicate that determines whether a process should be included in the
-// result set.
-HRESULT Process::FindProcesses(uint32 exclude_mask,
-                               const TCHAR* search_name,
-                               bool search_main_executable_only,
-                               const CString& user_sid,
-                               const std::vector<CString>& command_lines,
-                               std::vector<uint32>* process_ids_found) {
-  ASSERT1(search_name && *search_name);
-  ASSERT1(process_ids_found);
-  ASSERT1(!((exclude_mask & EXCLUDE_PROCESS_COMMAND_LINE_CONTAINING_STRING) &&
-            (exclude_mask & INCLUDE_PROCESS_COMMAND_LINE_CONTAINING_STRING)));
-
-  const TCHAR* const kLocalSystemSid = _T("S-1-5-18");
-
-  // Clear the output queue
-  process_ids_found->clear();
-
-  // Get the list of process identifiers.
-  uint32 process_ids[kMaxProcesses] = {0};
-  uint32 bytes_returned = 0;
-  if (!::EnumProcesses(reinterpret_cast<DWORD*>(process_ids),
-                       sizeof(process_ids),
-                       reinterpret_cast<DWORD*>(&bytes_returned))) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[Process::FindProcesses-fail to EnumProcesses]")
-                           _T("[0x%x]"), hr));
-    return hr;
-  }
-
-  // Enumerate all processes
-  int num_processes = bytes_returned / sizeof(process_ids[0]);
-  // We have found an elevated number of crashes in 1.2.584.15114 on what
-  // we believe are Italian systems. The first step to solving this Italian job
-  // is to assert on the condition while we are further testing this.
-  ASSERT1(num_processes <= kMaxProcesses);
-
-  // In Vista, SeDebugPrivilege is required to open the process not owned by
-  // current user. Also required for XP admins to open Local System processes
-  // with PROCESS_QUERY_INFORMATION access rights.
-  System::AdjustPrivilege(SE_DEBUG_NAME, true);
-
-  const uint32 cur_process_id = ::GetCurrentProcessId();
-
-  uint32 parent_process_id = 0;
-  if (exclude_mask & EXCLUDE_PARENT_PROCESS) {
-    Process current_process(cur_process_id);
-    uint32 ppid = 0;
-    HRESULT hr = current_process.GetParentProcessId(&ppid);
-    parent_process_id = SUCCEEDED(hr) ? ppid : 0;
-  }
-
-  // Get SID of current user
-  CString cur_user_sid;
-  HRESULT hr = omaha::user_info::GetProcessUser(NULL, NULL, &cur_user_sid);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  UTIL_LOG(L4, (_T("[Process::FindProcesses][processes=%d]"), num_processes));
-  for (int i = 0; i < num_processes; ++i) {
-    // Skip the system idle process.
-    if (process_ids[i] == 0) {
-      continue;
-    }
-
-    // Skip the current process if needed.
-    if ((exclude_mask & EXCLUDE_CURRENT_PROCESS) &&
-        (process_ids[i] == cur_process_id)) {
-      UTIL_LOG(L4, (_T("[Excluding current process %d"), process_ids[i]));
-      continue;
-    }
-
-    // Skip the parent process if needed.
-    if ((exclude_mask & EXCLUDE_PARENT_PROCESS) &&
-        (process_ids[i] == parent_process_id)) {
-      UTIL_LOG(L4, (_T("[Excluding parent process(%d) of %d"),
-          process_ids[i], cur_process_id));
-      continue;
-    }
-
-
-    // Get the owner sid.
-    // Note that we may fail to get the owner which is not current user.
-    // So if the owner_sid is empty, the process is sure not to be owned by the
-    // current user.
-    CString owner_sid;
-    Process::GetProcessOwner(process_ids[i], &owner_sid);
-
-    if ((exclude_mask & INCLUDE_ONLY_PROCESS_OWNED_BY_USER) &&
-      owner_sid != user_sid) {
-      UTIL_LOG(L4,
-          (_T("[Excluding process as not owned by user][%d]"), process_ids[i]));
-      continue;
-    }
-
-    if ((exclude_mask & EXCLUDE_PROCESS_OWNED_BY_CURRENT_USER) &&
-        owner_sid == cur_user_sid) {
-      UTIL_LOG(L4,
-          (_T("[Excluding process as owned by current user][%d]"),
-           process_ids[i]));
-      continue;
-    }
-    if ((exclude_mask & EXCLUDE_PROCESS_OWNED_BY_SYSTEM) &&
-        owner_sid == kLocalSystemSid) {
-      UTIL_LOG(L4,
-          (_T("[Excluding process as owned by system][%d]"), process_ids[i]));
-      continue;
-    }
-    if (exclude_mask & EXCLUDE_PROCESS_COMMAND_LINE_CONTAINING_STRING ||
-        exclude_mask & INCLUDE_PROCESS_COMMAND_LINE_CONTAINING_STRING) {
-      CString process_command_line;
-      HRESULT hr = GetCommandLine(process_ids[i], &process_command_line);
-      if (FAILED(hr)) {
-        UTIL_LOG(L4,
-          (_T("[Excluding process could not get command line][%d]"),
-           process_ids[i]));
-        continue;
-      }
-
-      // If we are able to open the process command line, then we should
-      // ensure that it does not contain the value that we are looking for if
-      // we are excluding the command line or that it contains the command line
-      // that we are looking for in case the include switch is specified.
-      bool present = IsStringPresentInList(process_command_line, command_lines);
-      if ((present &&
-            (exclude_mask & EXCLUDE_PROCESS_COMMAND_LINE_CONTAINING_STRING)) ||
-          (!present &&
-            (exclude_mask & INCLUDE_PROCESS_COMMAND_LINE_CONTAINING_STRING))) {
-        UTIL_LOG(L4, (_T("[Process command line matches criteria][%d]'[%s]'"),
-                 process_ids[i], process_command_line));
-        continue;
-      }
-    }
-
-    // If search_name is provided, make sure it matches
-    if (Process::IsProcessUsingExeOrDll(process_ids[i],
-                                        search_name,
-                                        search_main_executable_only)) {
-      UTIL_LOG(L4,
-          (_T("[Including process][%d][%s]"), process_ids[i], search_name));
-      process_ids_found->push_back(process_ids[i]);
-    }
-  }
-
-  return S_OK;
-}
-
-HRESULT Process::FindProcessesInSession(
-    DWORD session_id,
-    uint32 exclude_mask,
-    const TCHAR* search_name,
-    bool search_main_executable_only,
-    const CString& user_sid,
-    const std::vector<CString>& cmd_lines,
-    std::vector<uint32>* process_ids_found) {
-  HRESULT hr = FindProcesses(exclude_mask,
-                             search_name,
-                             search_main_executable_only,
-                             user_sid,
-                             cmd_lines,
-                             process_ids_found);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Filter to processes running under session_id.
-  std::vector<uint32>::iterator iter = process_ids_found->begin();
-  while (iter != process_ids_found->end()) {
-    uint32 process_pid = *iter;
-    DWORD process_session = 0;
-    hr = S_OK;
-    if (!::ProcessIdToSessionId(process_pid, &process_session)) {
-      hr = HRESULTFromLastError();
-      UTIL_LOG(LE,  (_T("[::ProcessIdToSessionId failed][0x%x]"), hr));
-    } else if (process_session != session_id) {
-      UTIL_LOG(L4, (_T("[Excluding process, different session][%d][%d][%d]"),
-                    process_pid, process_session, session_id));
-    }
-
-    if (FAILED(hr) || process_session != session_id) {
-      // Remove from list and continue.
-      iter = process_ids_found->erase(iter);
-      continue;
-    }
-
-    ++iter;
-  }
-
-  return S_OK;
-}
-
-bool Process::IsModuleMatchingExeOrDll(const TCHAR* module_name,
-                                       const TCHAR* search_name,
-                                       bool is_fully_qualified_name) {
-  CString module_file_name;
-  if (is_fully_qualified_name) {
-    if (FAILED(GetLongPathName(module_name, &module_file_name))) {
-      return false;
-    }
-  } else {
-    module_file_name = ::PathFindFileName(module_name);
-    ASSERT1(!module_file_name.IsEmpty());
-    if (module_file_name.IsEmpty()) {
-      return false;
-    }
-  }
-
-  return (module_file_name.CompareNoCase(search_name) == 0);
-}
-
-DWORD Process::GetProcessImageFileName(HANDLE proc_handle,
-                                       LPTSTR image_file,
-                                       DWORD file_size)  {
-  typedef DWORD (WINAPI *Fun)(HANDLE proc_handle,
-                              LPWSTR image_file,
-                              DWORD file_size);
-
-  HINSTANCE psapi_instance = ::GetModuleHandle(_T("Psapi.dll"));
-  ASSERT1(psapi_instance);
-  Fun pfn = reinterpret_cast<Fun>(::GetProcAddress(psapi_instance,
-                                                   "GetProcessImageFileNameW"));
-  if (!pfn) {
-    UTIL_LOG(L1, (_T("::GetProcessImageFileNameW() not found in Psapi.dll")));
-    return 0;
-  }
-  return (*pfn)(proc_handle, image_file, file_size);
-}
-
-bool Process::IsProcImageMatch(HANDLE proc_handle,
-                               const TCHAR* search_name,
-                               bool is_fully_qualified_name)  {
-  TCHAR image_name[MAX_PATH] = _T("");
-  if (!GetProcessImageFileName(proc_handle,
-                               image_name,
-                               arraysize(image_name))) {
-    UTIL_LOG(L4, (_T("[GetProcessImageFileName fail[0x%x]"),
-                  HRESULTFromLastError()));
-    return false;
-  }
-
-  UTIL_LOG(L4, (_T("[GetProcessImageFileName][%s]"), image_name));
-  CString dos_name;
-  HRESULT hr(DevicePathToDosPath(image_name, &dos_name));
-  if (FAILED(hr)) {
-    UTIL_LOG(L4, (_T("[DevicePathToDosPath fail[0x%x]"), hr));
-    return false;
-  }
-
-  return IsModuleMatchingExeOrDll(dos_name,
-                                  search_name,
-                                  is_fully_qualified_name);
-}
-
-// Is the process using the specified exe/dll?
-bool Process::IsProcessUsingExeOrDll(uint32 process_id,
-                                     const TCHAR* search_name,
-                                     bool search_main_executable_only) {
-  ASSERT1(search_name);
-
-  // Open the process
-  scoped_process process_handle(::OpenProcess(
-                                    PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
-                                    FALSE,
-                                    process_id));
-  if (!process_handle) {
-    UTIL_LOG(L4, (_T("[::OpenProcess failed][0x%x]"), HRESULTFromLastError()));
-    return false;
-  }
-
-  // Does the name represent a fully qualified name?
-  // We only do a simple check here
-  bool is_fully_qualified_name = String_FindChar(search_name, _T('\\')) != -1;
-  CString long_search_name;
-  if (is_fully_qualified_name) {
-    HRESULT hr(GetLongPathName(search_name, &long_search_name));
-    if (FAILED(hr)) {
-      UTIL_LOG(L4, (_T("[GetLongPathName fail][hr=x%x]"), hr));
-      return false;
-    }
-    search_name = long_search_name;
-  }
-
-  // Take a snapshot of all modules in the specified process
-  int num_modules_to_fetch = search_main_executable_only ? 1 :
-                                                           kMaxProcessModules;
-  HMODULE module_handles[kMaxProcessModules];
-  SetZero(module_handles);
-  uint32 bytes_needed = 0;
-  if (!::EnumProcessModules(get(process_handle),
-                            module_handles,
-                            num_modules_to_fetch * sizeof(HMODULE),
-                            reinterpret_cast<DWORD*>(&bytes_needed))) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[EnumProcessModules failed][0x%x]"), hr));
-
-    if (IsWow64(::GetCurrentProcessId())) {
-      // ::EnumProcessModules from a WoW64 process fails for x64 processes.
-      // We try ::GetProcessImageFileName as a workaround here.
-      return search_main_executable_only ?
-                 IsProcImageMatch(get(process_handle),
-                                  search_name,
-                                  is_fully_qualified_name) :
-                 false;
-    } else {
-      return false;
-    }
-  }
-
-  int num_modules = bytes_needed / sizeof(HMODULE);
-  if (num_modules > num_modules_to_fetch) {
-    num_modules = num_modules_to_fetch;
-  }
-
-  for (int i = 0; i < num_modules; ++i) {
-    TCHAR module_name[MAX_PATH];
-    SetZero(module_name);
-    if (!::GetModuleFileNameEx(get(process_handle),
-                               module_handles[i],
-                               module_name,
-                               arraysize(module_name))) {
-      UTIL_LOG(LEVEL_ERROR, (_T("[GetModuleFileNameEx fail[x%x]"),
-                             HRESULTFromLastError()));
-      continue;
-    }
-
-    if (IsModuleMatchingExeOrDll(module_name,
-                                 search_name,
-                                 is_fully_qualified_name)) {
-      return true;
-    }
-  }
-
-  return false;
-}
-
-// Helper function to get long path name
-HRESULT Process::GetLongPathName(const TCHAR* short_name, CString* long_name) {
-  ASSERT1(short_name);
-  ASSERT1(long_name);
-
-  TCHAR temp_name[MAX_PATH];
-  SetZero(temp_name);
-
-  HRESULT hr = S_OK;
-  if (!::GetLongPathName(short_name, temp_name, arraysize(temp_name))) {
-    hr = HRESULTFromLastError();
-  } else {
-    long_name->SetString(temp_name);
-  }
-
-  return hr;
-}
-
-// Retrieve the FQPN for the executable file for a process.  (Note: Using
-// GetModuleFileNameEx is slower than GetProcessImageFileName, but the former
-// is available on Win2K, while the latter is only only on XP and up.)
-HRESULT Process::GetExecutablePath(uint32 process_id, CString *exe_path) {
-  ASSERT1(process_id);
-  ASSERT1(exe_path);
-
-  TCHAR temp_path[MAX_PATH];
-  SetZero(temp_path);
-
-  scoped_process process(::OpenProcess(PROCESS_QUERY_INFORMATION |
-                                       PROCESS_VM_READ,
-                                       FALSE,
-                                       process_id));
-  if (!valid(process)) {
-    return HRESULTFromLastError();
-  }
-
-  if (0 == ::GetModuleFileNameEx(get(process), NULL, temp_path, MAX_PATH)) {
-    return HRESULTFromLastError();
-  }
-
-  exe_path->SetString(temp_path);
-  return S_OK;
-}
-
-// Type definitions needed for GetCommandLine() and GetProcessIdFromHandle()
-// From MSDN document on NtQueryInformationProcess() and other sources
-typedef struct _PROCESS_BASIC_INFORMATION {
-  PVOID Reserved1;
-  BYTE *PebBaseAddress;
-  PVOID Reserved2[2];
-  ULONG_PTR UniqueProcessId;
-  PVOID Reserved3;
-} PROCESS_BASIC_INFORMATION;
-
-typedef enum _PROCESSINFOCLASS {
-  ProcessBasicInformation = 0,
-  ProcessWow64Information = 26
-} PROCESSINFOCLASS;
-
-typedef WINBASEAPI DWORD WINAPI
-GetProcessIdFn(
-    HANDLE Process
-);
-
-typedef LONG WINAPI
-NtQueryInformationProcess(
-  IN HANDLE ProcessHandle,
-  IN PROCESSINFOCLASS ProcessInformationClass,
-  OUT PVOID ProcessInformation,
-  IN ULONG ProcessInformationLength,
-  OUT PULONG ReturnLength OPTIONAL
-);
-
-typedef struct _RTL_DRIVE_LETTER_CURDIR {
-  USHORT Flags;
-  USHORT Length;
-  ULONG TimeStamp;
-  UNICODE_STRING DosPath;
-} RTL_DRIVE_LETTER_CURDIR, *PRTL_DRIVE_LETTER_CURDIR;
-
-typedef struct _RTL_USER_PROCESS_PARAMETERS {
-  ULONG MaximumLength;
-  ULONG Length;
-  ULONG Flags;
-  ULONG DebugFlags;
-  PVOID ConsoleHandle;
-  ULONG ConsoleFlags;
-  HANDLE StdInputHandle;
-  HANDLE StdOutputHandle;
-  HANDLE StdErrorHandle;
-  UNICODE_STRING CurrentDirectoryPath;
-  HANDLE CurrentDirectoryHandle;
-  UNICODE_STRING DllPath;
-  UNICODE_STRING ImagePathName;
-  UNICODE_STRING CommandLine;
-  PVOID Environment;
-  ULONG StartingPositionLeft;
-  ULONG StartingPositionTop;
-  ULONG Width;
-  ULONG Height;
-  ULONG CharWidth;
-  ULONG CharHeight;
-  ULONG ConsoleTextAttributes;
-  ULONG WindowFlags;
-  ULONG ShowWindowFlags;
-  UNICODE_STRING WindowTitle;
-  UNICODE_STRING DesktopName;
-  UNICODE_STRING ShellInfo;
-  UNICODE_STRING RuntimeData;
-  RTL_DRIVE_LETTER_CURDIR DLCurrentDirectory[0x20];
-} RTL_USER_PROCESS_PARAMETERS, *PRTL_USER_PROCESS_PARAMETERS;
-
-// Get the function pointer to GetProcessId in KERNEL32.DLL
-static HRESULT EnsureGPIFunction(GetProcessIdFn** gpi_func_ptr) {
-  static GetProcessIdFn* gpi_func = NULL;
-  if (!gpi_func) {
-    HMODULE kernel32_module = ::GetModuleHandle(_T("kernel32.dll"));
-    if (!kernel32_module) {
-      return HRESULTFromLastError();
-    }
-    gpi_func = reinterpret_cast<GetProcessIdFn*>(
-                  ::GetProcAddress(kernel32_module, "GetProcessId"));
-    if (!gpi_func) {
-      return HRESULTFromLastError();
-    }
-  }
-
-  *gpi_func_ptr = gpi_func;
-  return S_OK;
-}
-
-// Get the function pointer to NtQueryInformationProcess in NTDLL.DLL
-static HRESULT EnsureQIPFunction(NtQueryInformationProcess** qip_func_ptr) {
-  static NtQueryInformationProcess* qip_func = NULL;
-  if (!qip_func) {
-    HMODULE ntdll_module = ::GetModuleHandle(_T("ntdll.dll"));
-    if (!ntdll_module) {
-      return HRESULTFromLastError();
-    }
-    qip_func = reinterpret_cast<NtQueryInformationProcess*>(
-                  ::GetProcAddress(ntdll_module, "NtQueryInformationProcess"));
-    if (!qip_func) {
-      return HRESULTFromLastError();
-    }
-  }
-
-  *qip_func_ptr = qip_func;
-  return S_OK;
-}
-
-// Obtain the process ID from a hProcess HANDLE
-ULONG Process::GetProcessIdFromHandle(HANDLE hProcess) {
-  if (SystemInfo::IsRunningOnXPSP1OrLater()) {
-    // Thunk to the documented ::GetProcessId() API
-    GetProcessIdFn* gpi_func = NULL;
-    HRESULT hr = EnsureGPIFunction(&gpi_func);
-    if (FAILED(hr)) {
-      ASSERT(FALSE,
-             (_T("Process::GetProcessIdFromHandle - EnsureGPIFunction")
-              _T(" failed[0x%x]"), hr));
-      return 0;
-    }
-    ASSERT1(gpi_func);
-    return gpi_func(hProcess);
-  }
-
-  // For lower versions of Windows, we use undocumented
-  // function NtQueryInformationProcess to get at the PID
-  NtQueryInformationProcess* qip_func = NULL;
-  HRESULT hr = EnsureQIPFunction(&qip_func);
-  if (FAILED(hr)) {
-    ASSERT(FALSE,
-           (_T("Process::GetProcessIdFromHandle - EnsureQIPFunction")
-            _T(" failed[0x%x]"), hr));
-    return 0;
-  }
-  ASSERT1(qip_func);
-
-  PROCESS_BASIC_INFORMATION info;
-  SetZero(info);
-  if (!NT_SUCCESS(qip_func(hProcess,
-                           ProcessBasicInformation,
-                           &info,
-                           sizeof(info),
-                           NULL))) {
-    ASSERT(FALSE, (_T("Process::GetProcessIdFromHandle - ")
-                   _T("NtQueryInformationProcess failed!")));
-    return 0;
-  }
-
-  return info.UniqueProcessId;
-}
-
-// Get the command line of a process
-HRESULT Process::GetCommandLine(uint32 process_id, CString* cmd_line) {
-  ASSERT1(process_id);
-  ASSERT1(cmd_line);
-
-  // Open the process
-  scoped_process process_handle(::OpenProcess(
-                                    PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
-                                    false,
-                                    process_id));
-  if (!process_handle) {
-    return HRESULTFromLastError();
-  }
-
-  // Obtain Process Environment Block
-  // Note that NtQueryInformationProcess is not available in Windows 95/98/ME
-  NtQueryInformationProcess* qip_func = NULL;
-  HRESULT hr = EnsureQIPFunction(&qip_func);
-
-  if (FAILED(hr)) {
-    return hr;
-  }
-  ASSERT1(qip_func);
-
-  PROCESS_BASIC_INFORMATION info;
-  SetZero(info);
-  if (!NT_SUCCESS(qip_func(get(process_handle),
-                           ProcessBasicInformation,
-                           &info,
-                           sizeof(info),
-                           NULL))) {
-    return E_FAIL;
-  }
-  BYTE* peb = info.PebBaseAddress;
-
-  // Read address of parameters (see some PEB reference)
-  // TODO(omaha): use offsetof(PEB, ProcessParameters) to replace 0x10
-  // http://msdn.microsoft.com/en-us/library/aa813706.aspx
-  SIZE_T bytes_read = 0;
-  uint32 dw = 0;
-  if (!::ReadProcessMemory(get(process_handle),
-                           peb + 0x10,
-                           &dw,
-                           sizeof(dw),
-                           &bytes_read)) {
-    return HRESULTFromLastError();
-  }
-
-  // Read all the parameters
-  RTL_USER_PROCESS_PARAMETERS params;
-  SetZero(params);
-  if (!::ReadProcessMemory(get(process_handle),
-                           reinterpret_cast<PVOID>(dw),
-                           &params,
-                           sizeof(params),
-                           &bytes_read)) {
-    return HRESULTFromLastError();
-  }
-
-  // Read the command line parameter
-  const int max_cmd_line_len = std::min(
-      static_cast<int>(params.CommandLine.MaximumLength),
-      kMaxCmdLineLengthBytes);
-  if (!::ReadProcessMemory(get(process_handle),
-                           params.CommandLine.Buffer,
-                           cmd_line->GetBufferSetLength(max_cmd_line_len),
-                           max_cmd_line_len,
-                           &bytes_read)) {
-    return HRESULTFromLastError();
-  }
-
-  cmd_line->ReleaseBuffer();
-
-  return S_OK;
-}
-
-// Check if the process is running with a specified path
-bool Process::IsProcessRunningWithPath(uint32 process_id, const TCHAR* path) {
-  ASSERT1(process_id);
-  ASSERT1(path && *path);
-
-  const int kProcessWaitModuleFullyUpMs = 100;
-  const int kProcessWaitModuleRetries = 10;
-
-  // Open the process
-  scoped_process process(::OpenProcess(
-                             PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
-                             false,
-                             process_id));
-  if (!process) {
-    UTIL_LOG(LEVEL_ERROR,
-             (_T("[Process::IsProcessRunningWithPath - OpenProcess failed]")
-              _T("[%u][0x%x]"),
-             process_id, HRESULTFromLastError()));
-    return false;
-  }
-
-  for (int i = 0; i < kProcessWaitModuleRetries; ++i) {
-    // Get the command line path of the main module
-    // Note that we are using psapi functions which is not supported in Windows
-    // 95/98/ME
-    //
-    // Sometimes it might be the case that the process is created but the main
-    // module is not fully loaded. If so, wait a while and then try again
-    TCHAR process_path[MAX_PATH];
-    if (::GetModuleFileNameEx(get(process),
-                              NULL,
-                              process_path,
-                              arraysize(process_path))) {
-      // Do the check
-      if (String_StartsWith(process_path, path, true)) {
-        return true;
-      }
-
-      // Try again with short form
-      TCHAR short_path[MAX_PATH];
-      if (::GetShortPathName(path, short_path, arraysize(short_path)) &&
-          String_StartsWith(process_path, short_path, true)) {
-        return true;
-      }
-
-      return false;
-    }
-
-    UTIL_LOG(LEVEL_ERROR,
-              (_T("[Process::IsProcessRunningWithPath - GetModuleFileNameEx ")
-               _T("failed][%u][0x%x]"),
-              process_id, HRESULTFromLastError()));
-
-    ::Sleep(kProcessWaitModuleFullyUpMs);
-  }
-
-  UTIL_LOG(LEVEL_ERROR,
-           (_T("[Process::IsProcessRunningWithPath - failed to get process ")
-            _T("path][%u][0x%x]"),
-            process_id, HRESULTFromLastError()));
-
-  return false;
-}
-
-// Get the process owner
-// Note that we may fail to get the owner which is not current user.
-HRESULT Process::GetProcessOwner(uint32 pid, CString* owner_sid) {
-  ASSERT1(pid);
-  ASSERT1(owner_sid);
-
-  scoped_process process(::OpenProcess(PROCESS_QUERY_INFORMATION, false, pid));
-  if (!valid(process)) {
-    return HRESULTFromLastError();
-  }
-
-  CAccessToken token;
-  CSid sid;
-  if (!token.GetProcessToken(READ_CONTROL | TOKEN_QUERY, get(process)) ||
-      !token.GetUser(&sid)) {
-    return HRESULTFromLastError();
-  }
-
-  *owner_sid = sid.Sid();
-  return S_OK;
-}
-
-// Creates an impersonation token for the user running process_id.
-// The caller is responsible for closing the returned handle.
-HRESULT Process::GetImpersonationToken(DWORD process_id, HANDLE* user_token) {
-  // Get a handle to the process.
-  scoped_process process(::OpenProcess(
-                             PROCESS_DUP_HANDLE | PROCESS_QUERY_INFORMATION,
-                             TRUE,
-                             process_id));
-  if (!valid(process)) {
-    HRESULT hr(HRESULTFromLastError());
-    UTIL_LOG(LEVEL_ERROR,
-             (_T("[GetImpersonationToken - ::OpenProcess failed][0x%x]"),
-              hr));
-    return hr;
-  }
-
-  HRESULT result = S_OK;
-  scoped_handle process_token;
-  if (!::OpenProcessToken(get(process), TOKEN_DUPLICATE | TOKEN_QUERY,
-                          address(process_token))) {
-    result = HRESULTFromLastError();
-  } else {
-    if (!::DuplicateTokenEx(get(process_token),
-                            TOKEN_IMPERSONATE | TOKEN_QUERY |
-                            TOKEN_ASSIGN_PRIMARY | TOKEN_DUPLICATE,
-                            NULL,
-                            SecurityImpersonation,
-                            TokenPrimary,
-                            user_token)) {
-      result = HRESULTFromLastError();
-    }
-  }
-
-  ASSERT(SUCCEEDED(result), (_T("[GetImpersonationToken Failed][hr=0x%x]"),
-                             result));
-  return result;
-}
-
-HRESULT Process::GetUsersOfProcesses(const TCHAR* task_name,
-                                     int maximum_users,
-                                     scoped_handle user_tokens[],
-                                     int* number_of_users) {
-  ASSERT1(task_name && *task_name);
-  ASSERT1(maximum_users);
-  ASSERT1(user_tokens);
-  ASSERT1(number_of_users);
-
-  scoped_hfile th32cs_snapshot(::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,
-                                                          0));
-  if (!valid(th32cs_snapshot)) {
-    HRESULT hr(HRESULTFromLastError());
-    UTIL_LOG(LEVEL_ERROR, (_T("[::CreateToolhelp32Snapshot fail][0x%x]"), hr));
-    return hr;
-  }
-
-  HRESULT result = S_OK;
-  *number_of_users = 0;
-  // Walk the list of processes.
-  PROCESSENTRY32 process = {0};
-  process.dwSize = sizeof(PROCESSENTRY32);
-  for (BOOL found = ::Process32First(get(th32cs_snapshot), &process); found;
-       found = ::Process32Next(get(th32cs_snapshot), &process)) {
-    // Check if it is one of the processes we are looking for.
-    if (_tcsicmp(task_name, process.szExeFile) == 0) {
-      // We match.  Get the user's token.
-      scoped_handle user_token;
-      if (FAILED(GetImpersonationToken(process.th32ProcessID,
-                                       address(user_token))))
-        continue;
-
-      // Search through the existing list to see if it's a duplicate.
-      // It's O(n^2) but we should have very few logged on users.
-      int i = 0;
-      for (; i < *number_of_users; i++) {
-        if (get(user_tokens[i]) == get(user_token)) {
-          // It's a duplicate.
-          break;
-        }
-      }
-      if (i >= *number_of_users) {
-        // It's a new one.  Add it if there's room.
-        ASSERT1(i < maximum_users);
-        if (i < maximum_users) {
-          // Release the user_token, we don't want it to be closed
-          // by the user_token destructor
-          reset(user_tokens[(*number_of_users)++], release(user_token));
-        }
-      }
-     }
-  }
-  return result;
-}
-
-HRESULT Process::GetImagePath(const CString& process_name,
-                              const CString& user_sid,
-                              CString* path) {
-  ASSERT1(path);
-
-  // Search for running processes with process_name.
-  uint32 mask = INCLUDE_ONLY_PROCESS_OWNED_BY_USER;
-  std::vector<CString> command_line;
-  std::vector<uint32> process_ids;
-  HRESULT hr = FindProcesses(mask,
-                             process_name,
-                             true,
-                             user_sid,
-                             command_line,
-                             &process_ids);
-  if (FAILED(hr)) {
-    UTIL_LOG(LEVEL_WARNING, (_T("[FindProcesses failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  if (process_ids.empty()) {
-    return E_FAIL;
-  }
-
-  uint32 process_id = process_ids[0];
-  UTIL_LOG(L4, (_T("[GetImagePath][pid=%d]"), process_id));
-  scoped_process process_handle(::OpenProcess(PROCESS_QUERY_INFORMATION |
-                                              PROCESS_VM_READ,
-                                              FALSE,
-                                              process_id));
-  if (!process_handle) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(L4, (_T("[OpenProcess failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  HMODULE module_handle = NULL;
-  DWORD bytes_needed = 0;
-  if (!::EnumProcessModules(get(process_handle),
-                            &module_handle,
-                            sizeof(HMODULE),
-                            &bytes_needed)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_WARNING, (_T("[EnumProcessModules failed][0x%08x]"), hr));
-    // ::EnumProcessModules from a WoW64 process fails for x64 processes. We try
-    // ::GetProcessImageFileName as a workaround here.
-    TCHAR image_name[MAX_PATH] = {0};
-    if (!GetProcessImageFileName(get(process_handle),
-                                 image_name,
-                                 arraysize(image_name))) {
-      HRESULT hr = HRESULTFromLastError();
-      UTIL_LOG(LE, (_T("[GetProcessImageFileName failed][0x%08x]"), hr));
-      return hr;
-    } else {
-      *path = image_name;
-      return S_OK;
-    }
-  }
-
-  TCHAR module_name[MAX_PATH] = {0};
-  if (!::GetModuleFileNameEx(get(process_handle),
-                             module_handle,
-                             module_name,
-                             arraysize(module_name))) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[GetModuleFileNameEx failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  *path = module_name;
-  return S_OK;
-}
-
-bool Process::IsWow64(uint32 pid) {
-  typedef BOOL (WINAPI *IsWow64Process)(HANDLE, BOOL*);
-  scoped_process handle(::OpenProcess(PROCESS_QUERY_INFORMATION | SYNCHRONIZE,
-                                      false,
-                                      pid));
-  if (!handle) {
-    return false;
-  }
-
-  HINSTANCE kernel_instance = ::GetModuleHandle(_T("kernel32.dll"));
-  if (kernel_instance == NULL) {
-    ASSERT1(false);
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LW, (_T("[::GetModuleHandle  kernel32.dll failed][0x%08x]"), hr));
-    return false;
-  }
-
-  IsWow64Process pfn = reinterpret_cast<IsWow64Process>(::GetProcAddress(
-      kernel_instance,
-      "IsWow64Process"));
-  if (!pfn) {
-    UTIL_LOG(LW, (_T("[::IsWow64Process() not found in kernel32.dll]")));
-    return false;
-  }
-
-  BOOL wow64 = FALSE;
-  if (!(*pfn)(get(handle), &wow64)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LW, (_T("[::IsWow64Process() failed][0x%08x]"), hr));
-    return false;
-  }
-
-  return (wow64 != 0);
-}
-
-HRESULT Process::MakeProcessWindowForeground(const CString& executable) {
-  UTIL_LOG(L3, (_T("[MakeProcessWindowForeground]")));
-
-  CString sid;
-  HRESULT hr = omaha::user_info::GetProcessUser(NULL, NULL, &sid);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // This code does not handle two cases:
-  // 1. If a new process instance is starting up but there are other process
-  //    instances running, then we will not wait for the new process instance.
-  //    One way to fix this is to pass the number of expected processes to this
-  //    method.
-  // 2. If we find multiple processes, and we are able to find the windows only
-  //    for some of the processes (maybe because the rest are still starting up)
-  //    then we will only set the windows of the one that we found to the
-  //    foreground and ignore the rest.
-  bool found = false;
-  for (int retries = 0; retries < kNumRetriesToFindProcess && !found;
-       ++retries) {
-    std::vector<CString> command_lines;
-    std::vector<uint32> processes;
-    DWORD flags = EXCLUDE_CURRENT_PROCESS | INCLUDE_ONLY_PROCESS_OWNED_BY_USER;
-    hr = Process::FindProcesses(flags,
-                                executable,
-                                true,
-                                sid,
-                                command_lines,
-                                &processes);
-    if (FAILED(hr)) {
-      UTIL_LOG(LW, (_T("[FindProcesses failed][0x%08x]"), hr));
-      return hr;
-    }
-
-    UTIL_LOG(L3, (_T("[Found %d processes]"), processes.size()));
-    for (size_t i = 0; i < processes.size(); ++i) {
-      CSimpleArray<HWND> windows;
-      if (!WindowUtils::FindProcessWindows(processes[i], 0, &windows)) {
-        UTIL_LOG(L3, (_T("[FindProcessWindows failed][0x%08x]"), hr));
-        continue;
-      }
-
-      for (int j = 0; j < windows.GetSize(); ++j) {
-        if (WindowUtils::IsMainWindow(windows[j])) {
-          UTIL_LOG(L4, (_T("[Found main window of process %d]"), processes[i]));
-          WindowUtils::MakeWindowForeground(windows[j]);
-          ::FlashWindow(windows[j], true);
-          found = true;
-          break;
-        }
-      }
-    }
-
-    if (!found) {
-      ::Sleep(kFindProcessRetryIntervalMs);
-    }
-  }
-
-  return S_OK;
-}
-
-}  // namespace omaha
-
diff --git a/base/process.h b/base/process.h
deleted file mode 100644
index 1cde0c3..0000000
--- a/base/process.h
+++ /dev/null
@@ -1,314 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Declares class Process to incapsulate win32
-// functions for creation and some manipulations of
-// processes.
-
-#ifndef OMAHA_BASE_PROCESS_H_
-#define OMAHA_BASE_PROCESS_H_
-
-#include <windows.h>
-#include <psapi.h>
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/scoped_any.h"
-
-namespace omaha {
-
-const int kMaxProcesses = 1024;
-const int kMaxProcessModules = 1024;
-
-// Exclude mask for finding processes.
-enum FindProcessesExcludeMask {
-  EXCLUDE_NONE = 0,
-  EXCLUDE_CURRENT_PROCESS = 0x1,
-  EXCLUDE_PROCESS_OWNED_BY_CURRENT_USER = 0x2,
-  EXCLUDE_PROCESS_OWNED_BY_SYSTEM = 0x4,
-  INCLUDE_ONLY_PROCESS_OWNED_BY_USER = 0x08,
-  EXCLUDE_PROCESS_COMMAND_LINE_CONTAINING_STRING = 0x10,
-  INCLUDE_PROCESS_COMMAND_LINE_CONTAINING_STRING = 0x20,
-  EXCLUDE_PARENT_PROCESS = 0x40,
-};
-
-// Process info used in finding descendent processes.
-struct ProcessInfo {
-  uint32 process_id;
-  uint32 parent_id;
-#if !SHIPPING
-  CString exe_file;
-#endif
-};
-
-// Process class
-class Process {
- public:
-  // Constructor
-  // Init the process object with the executable name
-  // and if known the window class name of the process.
-  // If window_class_name is known it will be easy
-  // to stop the process just by sending messages to
-  // a window.
-  // TODO(omaha3): window_class_name is not being used.
-  Process(const TCHAR* name, const TCHAR* window_class_name);
-
-  // Constructor.
-  // Init the process object with the process id.
-  explicit Process(uint32 process_id);
-
-  // Destructor
-  virtual ~Process();
-
-  // Start the process with some command line params if any.
-  // If a token is provided, it will be used to start
-  // the process in the default desktop of the
-  // token's session. The caller needs to be SYSTEM in
-  // this case.
-  virtual HRESULT Start(const TCHAR* command_line_parameters,
-                        HANDLE runas_token);
-
-  // Restart the process with the old command line params.
-  HRESULT Restart(HANDLE runas_token);
-
-  // Set shutdown event using in signaling the process watch.
-  void SetShutdownEvent(HANDLE shutdown_event);
-
-  // Sets the specified priority class to the process.
-  bool SetPriority(uint32 priority_class) const;
-
-  // Check if the process is running.
-  bool Running() const;
-
-  // Create a job and assign the process to it.
-  HANDLE AssignToJob();
-
-  // Wait some time till the process finishes.
-  bool WaitUntilDead(uint32 timeout_msec);
-
-  // Wait some time till the process and all its descendent processes finish.
-  bool WaitUntilAllDead(HANDLE job,
-                        uint32 timeout_msec,
-                        const TCHAR* path_to_exclude,
-                        uint32* exit_code);
-
-  // Wait until process is dead or a windows message arrives. For use in a
-  // message loop while waiting.
-  HRESULT WaitUntilDeadOrInterrupt(uint32 msec);
-  // Return values include CI_S_PROCESSWAIT_DEAD, CI_S_PROCESSWAIT_TIMEOUT,
-  // CI_S_PROCESSWAIT_MESSAGE.
-
-#if !SHIPPING
-  CString GetDebugInfo() const;
-#endif
-
-  // Return the process ID.
-  uint32 GetId() const;
-
-  // Return a readable representation of the process's name.
-  const TCHAR *GetName() const;
-
-  // Get win32 handle to process.
-  HANDLE GetHandle() const;
-
-  // Get process exit code.
-  bool GetExitCode(uint32* exit_code) const;
-
-  // can we kill the process via terminating
-  // some processes are not safe to terminate.
-  virtual bool IsTerminationAllowed() const;
-
-  // Second, more rude method to stop the process. window_class_name was
-  // not given or CloseWithMessage didn't succeed.
-  bool Terminate(uint32 wait_for_terminate_msec);
-
-  // Gets the parent process id.
-  HRESULT GetParentProcessId(uint32* parent_pid);
-
-  // Try to get a descendant process. Return process id if found.
-  uint32 GetDescendantProcess(HANDLE job,
-                              bool child_only,
-                              bool sole_descedent,
-                              const TCHAR* search_name,
-                              const TCHAR* path_to_exclude);
-
-  // Dynamically links and calls ::IsProcessInJob() in kernel32.dll.
-  static BOOL IsProcessInJob(HANDLE process_handle,
-                             HANDLE job_handle,
-                             PBOOL result);
-
-  // Try to get all matching descendant processes.
-  HRESULT GetAllDescendantProcesses(
-      HANDLE job,
-      bool child_only,
-      const TCHAR* search_name,
-      const TCHAR* path_to_exclude,
-      std::vector<ProcessInfo>* descendant_proc_ids);
-
-  // Finds the processes based on passed criteria.
-  static HRESULT FindProcesses(uint32 exclude_mask,
-                               const TCHAR* search_name,
-                               bool search_main_executable_only,
-                               std::vector<uint32>* process_ids_found);
-
-  // Find processes which loads the specified exe/dll. Uses the user_sid only
-  // if the INCLUDE_ONLY_PROCESS_OWNED_BY_USER flag has been set.
-  // The command_line is only used when
-  // EXCLUDE_PROCESS_COMMAND_LINE_CONTAINING_STRING is set.
-  static HRESULT FindProcesses(uint32 exclude_mask,
-                               const TCHAR* search_name,
-                               bool search_main_executable_only,
-                               const CString& user_sid,
-                               const std::vector<CString>& command_line,
-                               std::vector<uint32>* process_ids_found);
-
-  // Find processes with the specified criteria running in specific session.
-  static HRESULT FindProcessesInSession(DWORD session_id,
-                                        uint32 exclude_mask,
-                                        const TCHAR* search_name,
-                                        bool search_main_executable_only,
-                                        const CString& user_sid,
-                                        const std::vector<CString>& cmd_lines,
-                                        std::vector<uint32>* process_ids_found);
-
-  // Is the process using the specified exe/dll.
-  static bool IsProcessUsingExeOrDll(uint32 process_id,
-                                     const TCHAR* search_name,
-                                     bool search_main_executable_only);
-
-  // Obtain the process ID from a hProcess HANDLE.
-  static ULONG GetProcessIdFromHandle(HANDLE hProcess);
-
-  // Get the fully qualified path of the executable file for a process.
-  static HRESULT GetExecutablePath(uint32 process_id, CString *exe_path);
-
-  // Get the command line of a process.
-  static HRESULT GetCommandLine(uint32 process_id, CString* cmd_line);
-
-  // Get the process owner.
-  static HRESULT GetProcessOwner(uint32 pid, CString* owner_sid);
-
-  // Creates an impersonation token for the user running process_id.
-  // The caller is responsible for closing the returned handle.
-  static HRESULT GetImpersonationToken(DWORD process_id, HANDLE* user_token);
-
-  // Returns user token handles for the users currently running the named task.
-  // maximum_users specifies the maximun number of handles to be retured.
-  // The actual number filled is returned.
-  static HRESULT GetUsersOfProcesses(const TCHAR* task_name,
-                                     int maximum_users,
-                                     scoped_handle users[],
-                                     int* number_of_users);
-
-  // Gets the on disk path from where the process image is loaded.
-  static HRESULT GetImagePath(const CString& process_name,
-                              const CString& user_sid,
-                              CString* path);
-
-  // Returns if the process is running under WOW64.
-  static bool IsWow64(uint32 pid);
-
- public:
-  // How many times the process can be restarted in case it crashes.
-  virtual uint32 GetMaxNumberOfRestarts() const;
-
-  // Maximum amount of memory process is allowed to use before it's killed.
-  // Default of 0 means unlimited.
-  virtual uint32 GetMaxMemory() const;
-
-  // Have we exceeded the number of maximum restarting.
-  bool AllowedToRestart() const;
-
-  // In case of crash, how soon to restart.
-  virtual uint32 GetRestartInterval() const;
-
-  // The idea is the following. Each process has maximum number of restarts.
-  // As soon as the process reaches that number of restarts in should no longer
-  // be restarted unless the time window in which the process was crashing is
-  // more than the value returned by this function. For example:
-  // Process X returns 3 from the function GetMaxNumberOfRestarts.
-  // The same process returns 30*1000*60 (30 minutes) from
-  // GetTimeWindowForCrashes if  process X crashed more than 3 times in 30
-  // minutes it will not be restarted. if it took more than 30 minutes for
-  // process X to crash more than 3 times - internal counters for number of
-  // crashes will be reset and the process will be happily restarted.
-  // Each derived process can override this function to return its own time
-  // window for crashes.
-  // Default implementation returns INFINITE which means that this is not time
-  // based at all, if the process crashed more than the value returned by
-  // GetMaxNumberOfRestarts it will not be restarted no matter how long it took.
-  virtual uint32 GetTimeWindowForCrashes() const;
-
-  // Sets the main window of all process instances to the foreground.
-  static HRESULT MakeProcessWindowForeground(const CString& executable);
-
- private:
-  mutable uint32 number_of_restarts_;
-  CString command_line_;
-  CString command_line_parameters_;
-  CString window_class_name_;
-  CString name_;
-  scoped_process process_;
-  uint32 process_id_;
-  mutable uint32 time_of_start_;
-  mutable uint32 exit_code_;
-  HANDLE shutdown_event_;
-
-  // Helper function to wait till the process and all its descendent processes
-  // finish.
-  bool InternalWaitUntilAllDead(HANDLE job,
-                                uint32 timeout_msec,
-                                const TCHAR* path_to_exclude,
-                                uint32* exit_code);
-
-  // Check if the process is running with a specified path.
-  static bool IsProcessRunningWithPath(uint32 process_id, const TCHAR* path);
-
-  // Checks if the command line of the process has been specified as one to
-  // ignore.
-  static bool IsStringPresentInList(const CString& process_command_line,
-                                    const std::vector<CString>& list);
-
-
-  // Helper function to get long path name.
-  static HRESULT GetLongPathName(const TCHAR* short_name, CString* long_name);
-
-  // Helper for Process::IsProcessUsingExeOrDll(). Use GetProcessImageFileName
-  // to get the filename, and match against search_name.
-  static bool IsProcImageMatch(HANDLE proc_handle,
-                               const TCHAR* search_name,
-                               bool is_fully_qualified_name);
-
-  // Dynamically links and calls ::GetProcessImageFileName() in psapi.dll.
-  static DWORD GetProcessImageFileName(HANDLE proc_handle,
-                                       LPTSTR image_file,
-                                       DWORD file_size);
-
-  // Helper for Process::IsProcessUsingExeOrDll().
-  // Is there a match between the module and the specified exe/dll?
-  static bool IsModuleMatchingExeOrDll(const TCHAR* module_name,
-                                       const TCHAR* search_name,
-                                       bool is_fully_qualified_name);
-
-#if !SHIPPING
-  CString debug_info_;
-#endif
-  DISALLOW_EVIL_CONSTRUCTORS(Process);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_PROCESS_H_
diff --git a/base/process_unittest.cc b/base/process_unittest.cc
deleted file mode 100644
index 70bfd82..0000000
--- a/base/process_unittest.cc
+++ /dev/null
@@ -1,243 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-//
-// Process unit tests.
-
-#include <vector>
-
-#include "omaha/base/app_util.h"
-#include "omaha/base/path.h"
-#include "omaha/base/process.h"
-#include "omaha/base/user_info.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-const int kWaitUntilDeadMs = 10000;
-
-// Process class that terminates the associated process when deleted.
-class ScopedProcess : public Process {
- public:
-  explicit ScopedProcess(const TCHAR* name) : Process(name, NULL) {}
-  virtual ~ScopedProcess() {
-    Terminate(0);
-    EXPECT_TRUE(WaitUntilDead(kWaitUntilDeadMs));
-  }
-};
-
-TEST(ProcessTest, StartOneProcess) {
-  const TCHAR kExecutableName[] = _T("cmd.exe");
-  const TCHAR kExecutableArguments[] = _T("/c exit 702");
-  const int kExpectedExitCode = 702;
-
-  CString path = ConcatenatePath(app_util::GetSystemDir(), kExecutableName);
-  ScopedProcess process(path);
-
-  ASSERT_HRESULT_SUCCEEDED(process.Start(kExecutableArguments, NULL));
-  EXPECT_TRUE(process.WaitUntilDead(kWaitUntilDeadMs));
-
-  // Check the exit code to get some assurance that the process actually ran.
-  uint32 exit_code = 0;
-  EXPECT_TRUE(process.GetExitCode(&exit_code));
-  EXPECT_EQ(kExpectedExitCode, exit_code);
-}
-
-// Dummy process to spin off and then find.  The numeric argument will make
-// netstat run until it's killed by the ScopedProcess destructor.
-const TCHAR kTestExecutable[] = _T("netstat.exe");
-const TCHAR kTestArguments[] = _T("10");
-const TCHAR kTestExcludeArguments[] = _T("-o 20");
-const TCHAR kTestExcludeString[] = _T("20");
-const TCHAR kTestIncludeArguments[] = _T("-o 30");
-const TCHAR kTestIncludeString[] = _T("30");
-const int kWaitForProcessStartMs = 500;
-const int kMaxWaitIterations = 10;
-
-TEST(ProcessTest, FindOneProcess) {
-  CString path = ConcatenatePath(app_util::GetSystemDir(), kTestExecutable);
-  ScopedProcess process(path);
-  ASSERT_HRESULT_SUCCEEDED(process.Start(kTestArguments, NULL));
-  for (int i = 0; i < kMaxWaitIterations; ++i) {
-    ::Sleep(kWaitForProcessStartMs);
-    if (process.Running())
-      break;
-  }
-  EXPECT_TRUE(process.Running());
-
-  // Try to find the test process.
-  uint32 exclude_mask = INCLUDE_ONLY_PROCESS_OWNED_BY_USER;
-  CString user_sid;
-  std::vector<CString> command_lines;
-  std::vector<uint32> process_ids;
-
-  ASSERT_SUCCEEDED(omaha::user_info::GetProcessUser(NULL, NULL, &user_sid));
-
-  // This test intermittently fails to find the process when run on Pulse.
-  // This code attempts to ensure that the process is further along in the
-  // initialization process by waiting until Process::GetCommandLine succeeds.
-  // This test case does not result in FindProcesses using GetCommandLine, but
-  // waiting until this point may be enough to address the intermitent failures.
-  HRESULT hr = E_FAIL;
-  CString process_cmd;
-  for (int tries = 0; tries < 100 && FAILED(hr); ++tries) {
-    ::Sleep(50);
-    hr = Process::GetCommandLine(process.GetId(), &process_cmd);
-  }
-  EXPECT_SUCCEEDED(hr);
-
-  ASSERT_SUCCEEDED(Process::FindProcesses(exclude_mask,
-                                          kTestExecutable,
-                                          true,
-                                          user_sid,
-                                          command_lines,
-                                          &process_ids));
-  ASSERT_EQ(1, process_ids.size());  // Exit before accessing invalid element.
-  EXPECT_EQ(process.GetId(), process_ids[0]);
-}
-
-TEST(ProcessTest, ExcludeProcess) {
-  // Make sure the test process is not already running.
-  uint32 exclude_mask = INCLUDE_ONLY_PROCESS_OWNED_BY_USER;
-  CString user_sid;
-  std::vector<CString> command_lines;
-  std::vector<uint32> process_ids;
-
-  ASSERT_SUCCEEDED(omaha::user_info::GetProcessUser(NULL, NULL, &user_sid));
-  ASSERT_SUCCEEDED(Process::FindProcesses(exclude_mask,
-                                          kTestExecutable,
-                                          true,
-                                          user_sid,
-                                          command_lines,
-                                          &process_ids));
-  ASSERT_EQ(0, process_ids.size());
-
-  // Ok, test process not running. Let's continue running the test.
-  CString path = ConcatenatePath(app_util::GetSystemDir(), kTestExecutable);
-  ScopedProcess process(path);
-  ScopedProcess exclude_process(path);
-
-  ASSERT_HRESULT_SUCCEEDED(process.Start(kTestArguments, NULL));
-  ASSERT_HRESULT_SUCCEEDED(exclude_process.Start(kTestExcludeArguments, NULL));
-  for (int i = 0; i < kMaxWaitIterations; ++i) {
-    ::Sleep(kWaitForProcessStartMs);
-    if (process.Running() && exclude_process.Running())
-      break;
-  }
-  EXPECT_TRUE(process.Running());
-  EXPECT_TRUE(exclude_process.Running());
-
-  // Try to find just the first process, excluding the other.
-  exclude_mask = INCLUDE_ONLY_PROCESS_OWNED_BY_USER |
-                 EXCLUDE_CURRENT_PROCESS |
-                 EXCLUDE_PROCESS_COMMAND_LINE_CONTAINING_STRING;
-
-  command_lines.push_back(kTestExcludeString);
-  ASSERT_SUCCEEDED(Process::FindProcesses(exclude_mask,
-                                          kTestExecutable,
-                                          true,
-                                          user_sid,
-                                          command_lines,
-                                          &process_ids));
-  ASSERT_EQ(1, process_ids.size());
-  EXPECT_EQ(process.GetId(), process_ids[0]);
-}
-
-TEST(ProcessTest, IncludeProcess) {
-  CString path = ConcatenatePath(app_util::GetSystemDir(), kTestExecutable);
-  ScopedProcess process(path);
-  ScopedProcess include_process(path);
-
-  ASSERT_HRESULT_SUCCEEDED(process.Start(kTestArguments, NULL));
-  ASSERT_HRESULT_SUCCEEDED(include_process.Start(kTestIncludeArguments, NULL));
-  for (int i = 0; i < kMaxWaitIterations; ++i) {
-    ::Sleep(kWaitForProcessStartMs);
-    if (process.Running() && include_process.Running())
-      break;
-  }
-  EXPECT_TRUE(process.Running());
-  EXPECT_TRUE(include_process.Running());
-
-  // Try to find just the first process, excluding the other.
-  uint32 exclude_mask = INCLUDE_ONLY_PROCESS_OWNED_BY_USER |
-                        EXCLUDE_CURRENT_PROCESS |
-                        INCLUDE_PROCESS_COMMAND_LINE_CONTAINING_STRING;
-  CString user_sid;
-  std::vector<CString> command_lines;
-  std::vector<uint32> process_ids;
-
-  command_lines.push_back(kTestIncludeString);
-  ASSERT_SUCCEEDED(omaha::user_info::GetProcessUser(NULL, NULL, &user_sid));
-  ASSERT_SUCCEEDED(Process::FindProcesses(exclude_mask,
-                                          kTestExecutable,
-                                          true,
-                                          user_sid,
-                                          command_lines,
-                                          &process_ids));
-  ASSERT_EQ(1, process_ids.size());
-  EXPECT_EQ(include_process.GetId(), process_ids[0]);
-}
-
-TEST(ProcessTest, GetImagePath) {
-  // Get this module's path.
-  HMODULE handle = ::GetModuleHandle(NULL);
-  ASSERT_TRUE(handle != NULL);
-
-  TCHAR file_name[MAX_PATH] = {0};
-  ASSERT_NE(::GetModuleFileName(handle, file_name, MAX_PATH), 0);
-  ASSERT_NE(0, wcslen(file_name));
-
-  CString exe = GetFileFromPath(file_name);
-  ASSERT_FALSE(exe.IsEmpty());
-
-  CString user_sid;
-  ASSERT_SUCCEEDED(omaha::user_info::GetProcessUser(NULL, NULL, &user_sid));
-
-  // Test the method.
-  CString path;
-  ASSERT_SUCCEEDED(Process::GetImagePath(exe, user_sid, &path));
-
-  // Compare the result.
-  ASSERT_STREQ(file_name, path);
-}
-
-TEST(ProcessTest, GetParentProcessId_CurrentProcess) {
-  Process process(::GetCurrentProcessId());
-  uint32 parent_pid = 0;
-  EXPECT_SUCCEEDED(process.GetParentProcessId(&parent_pid));
-  EXPECT_NE(0, parent_pid);
-}
-
-TEST(ProcessTest, GetParentProcessId_ChildProcess) {
-  CString path = ConcatenatePath(app_util::GetSystemDir(), kTestExecutable);
-  ScopedProcess process(path);
-
-  EXPECT_HRESULT_SUCCEEDED(process.Start(kTestArguments, NULL));
-  for (int i = 0; i < kMaxWaitIterations; ++i) {
-    ::Sleep(kWaitForProcessStartMs);
-    if (process.Running()) {
-      break;
-    }
-  }
-
-  EXPECT_TRUE(process.Running());
-
-  uint32 parent_pid = 0;
-  EXPECT_SUCCEEDED(process.GetParentProcessId(&parent_pid));
-  EXPECT_EQ(::GetCurrentProcessId(), parent_pid);
-}
-
-}  // namespace omaha
-
diff --git a/base/processor_type.cc b/base/processor_type.cc
deleted file mode 100644
index 7517464..0000000
--- a/base/processor_type.cc
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Processor brand detection implementation
-//
-#include "omaha/base/processor_type.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-// Returns "GenuineIntel", "AuthenticAMD", etc...
-CString GetProcessorType() {
-  // Reference for checking for chip type
-  // http://en.wikipedia.org/wiki/CPUID
-
-  // There are 12 characters in the chip id (e.g. "GenuineIntel")
-  union {
-    char str[16];
-    uint32 n[4];
-  } regs;
-  SetZero(regs.str);
-  __asm {
-    xor eax, eax;  // Set EAX = 0 to get CPU type
-    cpuid;         // Now ebx, edx, ecx will contain cpu brand
-    mov regs.n[0], ebx;
-    mov regs.n[4], edx;
-    mov regs.n[8], ecx;
-  }
-  return CString(regs.str);
-}
-
-// Returns true if we're running on an Intel
-bool IsIntelProcessor() {
-  CString chip = GetProcessorType();
-  return (chip == kIntelVendorId);
-}
-
-}  // namespace omaha
diff --git a/base/processor_type.h b/base/processor_type.h
deleted file mode 100644
index cedf778..0000000
--- a/base/processor_type.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Processor brand detection declarations
-//
-
-#ifndef OMAHA_COMMON_PROCESSOR_TYPE_H_
-#define OMAHA_COMMON_PROCESSOR_TYPE_H_
-
-namespace omaha {
-
-bool IsIntelProcessor();
-CString GetProcessorType();
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_PROCESSOR_TYPE_H_
diff --git a/base/program_instance.cc b/base/program_instance.cc
deleted file mode 100644
index 5758b15..0000000
--- a/base/program_instance.cc
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2005-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// The class uses a singleton mutex, with a local name in the user session, to
-// prevent multiple instances of a program.
-
-#include "omaha/base/program_instance.h"
-#include "omaha/base/debug.h"
-
-namespace omaha {
-
-bool ProgramInstance::EnsureSingleInstance() {
-  return CheckSingleInstance();
-}
-
-bool ProgramInstance::CheckSingleInstance() {
-  ASSERT1(!mutex_name_.IsEmpty());
-
-  reset(mutex_, ::CreateMutex(NULL, false, mutex_name_));
-  if (!mutex_) {
-    // We were not able to create the mutex instance for some reason.
-    return false;
-  }
-  DWORD error = ::GetLastError();
-  if (error == ERROR_ALREADY_EXISTS) {
-    // The program instance is already running since the mutex already exists.
-    return false;
-  }
-  return true;
-}
-
-}  // namespace omaha
diff --git a/base/program_instance.h b/base/program_instance.h
deleted file mode 100644
index 06a923d..0000000
--- a/base/program_instance.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2005-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_BASE_PROGRAM_INSTANCE_H_
-#define OMAHA_BASE_PROGRAM_INSTANCE_H_
-
-#include <atlstr.h>
-#include "base/basictypes.h"
-#include "omaha/third_party/smartany/auto_any.h"
-
-namespace omaha {
-
-  // Helps limit the number of instances of a program. The class itself does not
-  // limit the number of instances. The calling code is expected to take action
-  // based on the return of EnsureSingleInstance function.
-  class ProgramInstance {
-   public:
-    explicit ProgramInstance(const TCHAR* mutex_name)
-        : mutex_name_(mutex_name) {}
-    virtual ~ProgramInstance() {}
-    bool EnsureSingleInstance();
-   private:
-    bool CheckSingleInstance();
-    CString mutex_name_;
-    auto_mutex mutex_;
-    DISALLOW_EVIL_CONSTRUCTORS(ProgramInstance);
-  };
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_PROGRAM_INSTANCE_H_
diff --git a/base/queue_timer.cc b/base/queue_timer.cc
deleted file mode 100644
index 255fd2b..0000000
--- a/base/queue_timer.cc
+++ /dev/null
@@ -1,185 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// The implementation is straightforward except the destruction of the
-// QueueTimer which needs some clarification.
-// If there is no callback running, then the destructor gets the critical
-// section and then it blocks on the DeleteTimerQueueTimer call, waiting for
-// the kernel to clean up the timer handle. The callback never fires in this
-// case.
-// If a callback is running, then there are two possibilities:
-// 1. The callback gets the critical section. The callback runs as usual and
-// then the destructor gets the critical section. This is also easy.
-// 2. The destructor gets the critical section. In this case, the callback
-// tries the critical section then it returns right away.
-//
-// Alarm timers are started and restarted every time they fire. The usage
-// patterns for alarms is usually Start, Callback, Start, Callback, etc...
-// The cleanup of an alarm timer handle usually happens in the callback, unless
-// the destructor of the QueueTimer is called, in which case the logic
-// above applies.
-//
-// Periodic timers are only started once: Start, Callback, Callback, etc...
-// In this case, the destructor does all the necessary cleanup.
-// Periodic timers must fire at intervals that are reasonable long so that
-// the callbacks do not queue up.
-
-#include "omaha/base/queue_timer.h"
-
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-
-namespace omaha {
-
-QueueTimer::QueueTimer(HANDLE timer_queue, Callback callback, void* ctx)
-    : callback_tid_(0),
-      ctx_(ctx),
-      due_time_(0),
-      period_(0),
-      flags_(0),
-      timer_handle_(NULL),
-      timer_queue_(timer_queue),
-      callback_(callback) {
-  UTIL_LOG(L3, (_T("[QueueTimer::QueueTimer][0x%p]"), this));
-  ASSERT1(timer_queue);
-  ASSERT1(callback);
-  ::InitializeCriticalSection(&dtor_cs_);
-  ::InitializeCriticalSection(&cs_);
-}
-
-// The destructor blocks on waiting for the timer kernel object to be deleted.
-// We can't call the destructor of QueueTimer while we are handling a callback.
-// This will result is a deadlock.
-QueueTimer::~QueueTimer() {
-  UTIL_LOG(L3, (_T("[QueueTimer::~QueueTimer][0x%p]"), this));
-
-  ::EnterCriticalSection(&dtor_cs_);
-  if (timer_handle_) {
-    ASSERT1(callback_tid_ != ::GetCurrentThreadId());
-
-    // This is a blocking call waiting for all callbacks to clear up.
-    bool res = !!::DeleteTimerQueueTimer(timer_queue_,
-                                         timer_handle_,
-                                         INVALID_HANDLE_VALUE);
-    ASSERT1(res);
-    timer_handle_ = NULL;
-  }
-  callback_ = NULL;
-  timer_queue_ = NULL;
-  flags_ = 0;
-  period_ = 0;
-  due_time_ = 0;
-  ctx_ = 0;
-  callback_tid_ = 0;
-  ::LeaveCriticalSection(&dtor_cs_);
-
-  ::DeleteCriticalSection(&cs_);
-  ::DeleteCriticalSection(&dtor_cs_);
-}
-
-// Thread safe.
-HRESULT QueueTimer::Start(int due_time, int period, uint32 flags) {
-  // Since Start creates the timer there could be a race condition where
-  // the timer could fire while we are still executing Start. We protect
-  // the start with a critical section so the Start completes before the
-  // timer can be entered by the callback.
-
-  ::EnterCriticalSection(&cs_);
-  HRESULT hr = DoStart(due_time, period, flags);
-  ::LeaveCriticalSection(&cs_);
-  return hr;
-}
-
-// Thread-safe.
-void QueueTimer::TimerCallback(void* param, BOOLEAN timer_or_wait) {
-  ASSERT1(param);
-  VERIFY1(timer_or_wait);
-
-  QueueTimer* timer = static_cast<QueueTimer*>(param);
-
-  if (!::TryEnterCriticalSection(&timer->dtor_cs_)) {
-    return;
-  }
-
-  ::EnterCriticalSection(&timer->cs_);
-  timer->DoCallback();
-  ::LeaveCriticalSection(&timer->cs_);
-
-  ::LeaveCriticalSection(&timer->dtor_cs_);
-}
-
-
-HRESULT QueueTimer::DoStart(int due_time, int period, uint32 flags) {
-  UTIL_LOG(L2, (_T("[QueueTimer::DoStart][0x%p][%d][%d][0x%08u]"),
-                this, due_time, period, flags));
-  due_time_ = due_time;
-  period_ = period;
-  flags_ = flags;
-
-  // Application Verifier says period must be 0 for WT_EXECUTEONLYONCE timers.
-  if ((flags & WT_EXECUTEONLYONCE) && period != 0) {
-    return E_INVALIDARG;
-  }
-
-  // Periodic timers can't be started more than one time.
-  if (timer_handle_) {
-    return E_UNEXPECTED;
-  }
-
-  bool res = !!::CreateTimerQueueTimer(&timer_handle_,
-                                       timer_queue_,
-                                       &QueueTimer::TimerCallback,
-                                       this,
-                                       due_time,
-                                       period,
-                                       flags_);
-  if (!res) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LE, (_T("[QueueTimer::Start failed][0x%p][0x%08x]"), this, hr));
-    return hr;
-  }
-
-  ASSERT1(timer_handle_);
-  UTIL_LOG(L3, (_T("[QueueTimer::Start timer created][0x%p]"), this));
-  return S_OK;
-}
-
-void QueueTimer::DoCallback() {
-  UTIL_LOG(L2, (_T("[QueueTimer::OnCallback][0x%p]"), this));
-
-  ASSERT1(timer_queue_);
-  ASSERT1(timer_handle_);
-  ASSERT1(callback_);
-
-  if (!period_) {
-    // Non-periodic aka alarm timers fire only once. We delete the timer
-    // handle so that the timer object can be restarted later on.
-    // The call below is non-blocking. The deletion of the kernel object can
-    // succeed right away, for example if the timer runs in the timer thread
-    // itself. Otherwise, if the last error is ERROR_IO_PENDING the kernel
-    // cleans up the object once the callback returns.
-    bool res = !!::DeleteTimerQueueTimer(timer_queue_, timer_handle_, NULL);
-    ASSERT1(res || (!res && ::GetLastError() == ERROR_IO_PENDING));
-    timer_handle_ = NULL;
-  }
-
-  callback_tid_ = ::GetCurrentThreadId();
-  callback_(this);
-  callback_tid_ = 0;
-}
-
-}  // namespace omaha
-
diff --git a/base/queue_timer.h b/base/queue_timer.h
deleted file mode 100644
index 10d9182..0000000
--- a/base/queue_timer.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// QueueTimer is a wrapper for the kernel queue timer.
-//
-// There are two ways to use the QueueTimer:
-// - alarm, where the timer goes off only once.
-// - periodic timer.
-// When working as an alarm, the timer must be restarted after it fired. There
-// is no need to destroy the whole object.
-// When working with a periodic timer, the timer can only be started once.
-// Alarm timers fire only once, so they will have to be restarted every time.
-// It is easy to deadlock when working with timers. As a general rule, never
-// destroy a QueueTimer from its callback.
-
-#ifndef OMAHA_COMMON_QUEUE_TIMER_H__
-#define OMAHA_COMMON_QUEUE_TIMER_H__
-
-#include <windows.h>
-
-#include "base/basictypes.h"
-
-namespace omaha {
-
-class QueueTimer {
-  public:
-    typedef void (*Callback)(QueueTimer* timer);
-
-    QueueTimer(HANDLE timer_queue,  // Caller provided timer queue.
-               Callback callback,   // Callback to call when the timer fires.
-               void* ctx);          // Caller provided context.
-
-    // The destructor waits for the pending callbacks to finish since we do not
-    // want the callback to fire after the C++ object was destroyed.
-    ~QueueTimer();
-
-    // Starts a timer. The time is in milliseconds.
-    HRESULT Start(int due_time, int period, uint32 flags);
-
-    void* ctx() const { return ctx_; }
-
-    int due_time() const { return due_time_; }
-
-    int period() const { return period_; }
-
-    uint32 flags() const { return flags_; }
-
-  private:
-    static void _stdcall TimerCallback(void* param, BOOLEAN timer_or_wait);
-
-    HRESULT DoStart(int due_time, int period, uint32 flags);
-    void DoCallback();
-
-    CRITICAL_SECTION cs_;         // Serializes access to shared state.
-    CRITICAL_SECTION dtor_cs_;    // Serializes the destruction of the object.
-    DWORD callback_tid_;          // The thread id of the callback, if any.
-    void* ctx_;
-    int due_time_;
-    int period_;
-    uint32 flags_;
-    HANDLE timer_handle_;
-    HANDLE timer_queue_;
-    Callback callback_;
-
-    DISALLOW_EVIL_CONSTRUCTORS(QueueTimer);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_QUEUE_TIMER_H__
-
diff --git a/base/queue_timer_unittest.cc b/base/queue_timer_unittest.cc
deleted file mode 100644
index 383e1a5..0000000
--- a/base/queue_timer_unittest.cc
+++ /dev/null
@@ -1,171 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include <iostream>
-#include "base/scoped_ptr.h"
-#include "omaha/base/queue_timer.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/timer.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-class QueueTimerTest : public testing::Test {
- protected:
-  QueueTimerTest()
-      : timer_queue_(NULL),
-        cnt_(0),
-        max_cnt_(0) {}
-
-  virtual void SetUp() {
-    cnt_ = 0;
-    timer_queue_ = ::CreateTimerQueue();
-    ASSERT_TRUE(timer_queue_);
-    reset(ev_, ::CreateEvent(NULL, true, false, NULL));
-  }
-
-  virtual void TearDown() {
-    // First destroy the timer, otherwise the timer could fire and
-    // access invalid test case state.
-    queue_timer_.reset();
-    reset(ev_);
-    ASSERT_TRUE(::DeleteTimerQueueEx(timer_queue_, INVALID_HANDLE_VALUE));
-    cnt_ = 0;
-    max_cnt_ = 0;
-  }
-
-  // Handles the alarm mode of the timer queue, where the timer fires once.
-  static void AlarmCallback(QueueTimer* queue_timer);
-
-  // Handles the periodic timer.
-  static void TimerCallback(QueueTimer* queue_timer);
-
-  HANDLE timer_queue_;
-  scoped_ptr<QueueTimer> queue_timer_;
-  scoped_event ev_;
-  volatile int cnt_;
-  volatile int max_cnt_;
-};
-
-void QueueTimerTest::AlarmCallback(QueueTimer* queue_timer) {
-  ASSERT_TRUE(queue_timer);
-  void* ctx = queue_timer->ctx();
-  QueueTimerTest* test = static_cast<QueueTimerTest*>(ctx);
-  test->cnt_ = 1;
-  ASSERT_TRUE(::SetEvent(get(test->ev_)));
-}
-
-void QueueTimerTest::TimerCallback(QueueTimer* queue_timer) {
-  ASSERT_TRUE(queue_timer);
-  void* ctx = queue_timer->ctx();
-  QueueTimerTest* test = static_cast<QueueTimerTest*>(ctx);
-
-  // Wait max_cnt_ ticks before signaling.
-  ++test->cnt_;
-  if (test->cnt_ == test->max_cnt_) {
-    ::SetEvent(get(test->ev_));
-  }
-}
-
-TEST_F(QueueTimerTest, QuickAlarm) {
-  queue_timer_.reset(new QueueTimer(timer_queue_,
-                                    &QueueTimerTest::AlarmCallback,
-                                    this));
-  const int kWaitTimeMaxMs = 1000;
-
-  // Set the timer to fire once right away.
-  LowResTimer timer(true);
-  ASSERT_HRESULT_SUCCEEDED(
-      queue_timer_->Start(0, 0, WT_EXECUTEINTIMERTHREAD | WT_EXECUTEONLYONCE));
-  EXPECT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(get(ev_), kWaitTimeMaxMs));
-  EXPECT_EQ(1, cnt_);
-
-  // Expect the alarm to fire quickly.
-  EXPECT_GE(50u, timer.GetMilliseconds());
-}
-
-// The test takes about 50 seconds to run.
-TEST_F(QueueTimerTest, Alarm) {
-  if (!ShouldRunEnormousTest()) {
-    return;
-  }
-
-  queue_timer_.reset(new QueueTimer(timer_queue_,
-                                    &QueueTimerTest::AlarmCallback,
-                                    this));
-  const int kWaitTimeMaxMs = 60 * 1000;     // 60 seconds.
-
-  // Set the timer to fire once after 5 sec, 10 sec, 15 sec, 20 sec and wait.
-  LowResTimer timer(false);
-  for (int i = 1; i <= 4; ++i) {
-    const int time_interval_ms = 5 * 1000 * i;
-    SCOPED_TRACE(testing::Message() << "time_interval_ms=" << time_interval_ms);
-
-    timer.Start();
-    ASSERT_HRESULT_SUCCEEDED(
-        queue_timer_->Start(time_interval_ms, 0, WT_EXECUTEONLYONCE));
-    EXPECT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(get(ev_), kWaitTimeMaxMs));
-
-    int actual_time_ms = timer.GetMilliseconds();
-    timer.Reset();
-
-    // Expect the alarm to fire anytime between a narrow interval.
-    EXPECT_EQ(1, cnt_);
-    EXPECT_LE(time_interval_ms - 50, actual_time_ms);
-    EXPECT_GE(time_interval_ms + 150, actual_time_ms);
-
-    cnt_ = 0;
-    ::ResetEvent(get(ev_));
-  }
-
-  // Set the timer to fire once after 2000 ms but do not wait for it to fire.
-  ASSERT_HRESULT_SUCCEEDED(
-      queue_timer_->Start(2000, 0, WT_EXECUTEONLYONCE));
-  EXPECT_EQ(WAIT_TIMEOUT, ::WaitForSingleObject(get(ev_), 100));
-  EXPECT_EQ(0, cnt_);
-}
-
-// The test takes about 35 seconds to run.
-TEST_F(QueueTimerTest, Timer) {
-  if (!ShouldRunEnormousTest()) {
-    return;
-  }
-
-  queue_timer_.reset(new QueueTimer(timer_queue_,
-                                    &QueueTimerTest::TimerCallback,
-                                    this));
-  const int kWaitTimeMaxMs = 60 * 1000;       // 60 seconds.
-
-  max_cnt_ = 4;
-
-  // Set the timer to fire at 10 seconds intervals with an initial delay of
-  // 5 seconds.
-  LowResTimer timer(true);
-  ASSERT_HRESULT_SUCCEEDED(queue_timer_->Start(5000, 10000, WT_EXECUTEDEFAULT));
-  EXPECT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(get(ev_), kWaitTimeMaxMs));
-
-  int actual_time_ms = timer.GetMilliseconds();
-
-  EXPECT_EQ(4, cnt_);
-  EXPECT_LE(35 * 1000 - 50, actual_time_ms);
-  EXPECT_GE(35 * 1000 + 350, actual_time_ms);
-
-  // Tests it can't start periodic timers more than one time.
-  ASSERT_EQ(E_UNEXPECTED, queue_timer_->Start(25, 50, WT_EXECUTEDEFAULT));
-}
-
-}  // namespace omaha
-
diff --git a/base/reactor.cc b/base/reactor.cc
deleted file mode 100644
index 1a02aa3..0000000
--- a/base/reactor.cc
+++ /dev/null
@@ -1,205 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/base/reactor.h"
-
-#include <vector>
-#include "base/scoped_ptr.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/event_handler.h"
-
-namespace omaha {
-
-Reactor::Reactor() {
-  CORE_LOG(L4, (_T("[Reactor::Reactor]")));
-  ::InitializeCriticalSection(&cs_);
-}
-
-Reactor::~Reactor() {
-  CORE_LOG(L4, (_T("[Reactor::~Reactor]")));
-
-  // Each handle must be unregistered before destroying the reactor.
-  ASSERT1(handlers_.empty());
-  ::DeleteCriticalSection(&cs_);
-}
-
-// The reactor loop is just an efficient wait, as the demultiplexing of the
-// events is actually done by the OS thread pool.
-// TODO(omaha): replace the alertable wait with waiting on an event and provide
-// a method for the reactor to stop handling events.
-HRESULT Reactor::HandleEvents() {
-  CORE_LOG(L1, (_T("[Reactor::HandleEvents]")));
-  VERIFY1(::SleepEx(INFINITE, true) == WAIT_IO_COMPLETION);
-  CORE_LOG(L1, (_T("[Reactor::HandleEvents exit]")));
-  return S_OK;
-}
-
-void __stdcall Reactor::Callback(void* param, BOOLEAN timer_or_wait) {
-  ASSERT1(param);
-
-  // Since we wait an INFINITE the wait handle is always signaled.
-  VERIFY1(!timer_or_wait);
-  RegistrationState* state = static_cast<RegistrationState*>(param);
-  ASSERT1(state->reactor);
-  state->reactor->DoCallback(state);
-}
-
-// Method does not check to see if the same handle is registered twice.
-HRESULT Reactor::RegisterHandle(HANDLE handle,
-                                EventHandler* event_handler,
-                                uint32 flags) {
-  ASSERT1(handle);
-  ASSERT1(event_handler);
-
-  if (!handle || !event_handler) {
-    return E_INVALIDARG;
-  }
-
-  scoped_ptr<RegistrationState> state(new RegistrationState);
-  state->event_handler = event_handler;
-  state->handle = handle;
-  state->reactor = this;
-  state->flags = flags | WT_EXECUTEONLYONCE;
-
-  // The reactor only calls the handler once.
-  ASSERT1(WT_EXECUTEDEFAULT == 0);
-
-  // As soon as the handle is registered, the thread pool can queue up a
-  // callback and reenter the reactor on a different thread.
-  // Acquire the critical section before registering the handle.
-  ::EnterCriticalSection(&cs_);
-#if DEBUG
-  // The same handle should not be registered multiple times.
-  std::vector<RegistrationState*>::iterator it = handlers_.begin();
-  for (; it != handlers_.end(); ++it) {
-    ASSERT((*it)->handle != handle, (_T("[already registered %d]"), handle));
-  }
-#endif
-  bool res = !!::RegisterWaitForSingleObject(&state->wait_handle,
-                                             state->handle,
-                                             &Reactor::Callback,
-                                             state.get(),
-                                             INFINITE,
-                                             state->flags);
-  HRESULT hr = res ? S_OK : HRESULTFromLastError();
-  if (SUCCEEDED(hr)) {
-    handlers_.push_back(state.release());
-  }
-  ::LeaveCriticalSection(&cs_);
-
-  return hr;
-}
-
-HRESULT Reactor::RegisterHandle(HANDLE handle) {
-  ::EnterCriticalSection(&cs_);
-  HRESULT hr = DoRegisterHandle(handle);
-  ::LeaveCriticalSection(&cs_);
-  return hr;
-}
-
-HRESULT Reactor::DoRegisterHandle(HANDLE handle) {
-  ASSERT1(handle);
-  std::vector<RegistrationState*>::iterator it = handlers_.begin();
-  for (; it != handlers_.end(); ++it) {
-    if ((*it)->handle == handle) {
-      break;
-    }
-  }
-  if (it == handlers_.end()) {
-    // The handle is not registered with the reactor anymore. Registering the
-    // the handle again is not possible.
-    return E_FAIL;
-  }
-
-  // Unregister and register the handle again. Unregistering is an non blocking
-  // call.
-  RegistrationState* state = *it;
-  bool res = !!::UnregisterWaitEx(state->wait_handle, NULL);
-  if (!res && ::GetLastError() != ERROR_IO_PENDING) {
-    return HRESULTFromLastError();
-  }
-  if (!::RegisterWaitForSingleObject(&state->wait_handle,
-                                     state->handle,
-                                     &Reactor::Callback,
-                                     state,
-                                     INFINITE,
-                                     state->flags)) {
-    return HRESULTFromLastError();
-  }
-  return S_OK;
-}
-
-HRESULT Reactor::UnregisterHandle(HANDLE handle) {
-  ASSERT1(handle);
-  if (!handle) {
-    return E_INVALIDARG;
-  }
-
-  // Attempts to take the ownership of the registration state for the handle.
-  // If taking the ownership does not succeed, it means the handle has already
-  // been unregistered.
-  scoped_ptr<RegistrationState> state(ReleaseHandlerState(handle));
-  if (!state.get()) {
-    return E_UNEXPECTED;
-  }
-
-  // Unregisters the wait handle from the thread pool. The call blocks waiting
-  // for any pending callbacks to finish. No lock is being held while waiting
-  // here. If there is no callback pending, the call will succeed right away.
-  // Otherwise, if a callback has already started, the call waits for the
-  // callback to complete.
-  bool res = !!::UnregisterWaitEx(state->wait_handle, INVALID_HANDLE_VALUE);
-
-  // Clear the registration state, as a defensive programming measure and
-  // for debugging purposes.
-  state->reactor          = NULL;
-  state->handle           = NULL;
-  state->wait_handle      = NULL;
-  state->event_handler    = NULL;
-
-  return res ? S_OK : HRESULTFromLastError();
-}
-
-void Reactor::DoCallback(RegistrationState* state) {
-  ASSERT1(state);
-  ASSERT1(state->event_handler);
-  ASSERT1(state->handle);
-  state->event_handler->HandleEvent(state->handle);
-}
-
-// Looks up the registration state for a handle and releases the ownership
-// of it to the caller. As the clean up of the state can happen from multiple
-// places, the transfer of ownership ensures the clean up happens once and
-// only once.
-Reactor::RegistrationState* Reactor::ReleaseHandlerState(HANDLE handle) {
-  RegistrationState* registration_state = NULL;
-  ::EnterCriticalSection(&cs_);
-  std::vector<RegistrationState*>::iterator it = handlers_.begin();
-  for (; it != handlers_.end(); ++it) {
-    if ((*it)->handle == handle) {
-      registration_state = *it;
-      handlers_.erase(it);
-      break;
-    }
-  }
-  ::LeaveCriticalSection(&cs_);
-  return registration_state;
-}
-
-}  // namespace omaha
-
diff --git a/base/reactor.h b/base/reactor.h
deleted file mode 100644
index 7cad78e..0000000
--- a/base/reactor.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// reactor.{h, cc} implements the reactor design pattern.
-//
-// For each signaled handle the reactor calls back the event handler only once.
-// To get further notifications, the handle must be registered again with the
-// reactor. This may sound like a lot of work but this is the only way to
-// guarantee that the event handler is only called once.
-// UnregisterHandle can't be called when handling a callback or it results in
-// a deadlock. When handling a callback, the only possible operation is
-// registering back a handle using Register.
-
-#ifndef OMAHA_COMMON_REACTOR_H__
-#define OMAHA_COMMON_REACTOR_H__
-
-#include <windows.h>
-#include <vector>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-class EventHandler;
-
-class Reactor {
- public:
-  Reactor();
-  ~Reactor();
-
-  // Starts demultiplexing and dispatching events.
-  HRESULT HandleEvents();
-
-  // Registers an event handler for a handle. The reactor does not own the
-  // handle. Registering the same handle twice results in undefined behavior.
-  // The flags parameter can be one of the WT* thread pool values or 0 for
-  // a reasonable default.
-  HRESULT RegisterHandle(HANDLE handle,
-                         EventHandler* event_handler,
-                         uint32 flags);
-
-  // Registers the handle again. This method can be called from the callback.
-  HRESULT RegisterHandle(HANDLE handle);
-
-  // Unregisters the handle. The method blocks and waits for any callback to
-  // complete if an event dispatching is in progress.
-  HRESULT UnregisterHandle(HANDLE handle);
-
- private:
-  struct RegistrationState {
-    RegistrationState()
-        : reactor(NULL),
-          event_handler(NULL),
-          handle(NULL),
-          wait_handle(NULL),
-          flags(0) {}
-
-    Reactor*      reactor;
-    EventHandler* event_handler;
-    HANDLE        handle;
-    HANDLE        wait_handle;
-    uint32        flags;
-  };
-
-  static void __stdcall Callback(void* param, BOOLEAN timer_or_wait);
-  void DoCallback(RegistrationState* registration_state);
-
-  HRESULT DoRegisterHandle(HANDLE handle);
-
-  // Releases the ownership of the registration state corresponding to a handle.
-  RegistrationState* ReleaseHandlerState(HANDLE handle);
-
-  CRITICAL_SECTION cs_;
-  std::vector<RegistrationState*> handlers_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(Reactor);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_REACTOR_H__
diff --git a/base/reactor_unittest.cc b/base/reactor_unittest.cc
deleted file mode 100644
index 99463b6..0000000
--- a/base/reactor_unittest.cc
+++ /dev/null
@@ -1,136 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include <stdlib.h>
-#include "base/scoped_ptr.h"
-#include "omaha/base/event_handler.h"
-#include "omaha/base/reactor.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-// TODO(omaha): rename EventHandler to EventHandlerInterface.
-
-// Creates and registers two waitable timers with the reactor. They go off
-// randomly until the reactor stops handling events.
-class ReactorTest
-    : public testing::Test,
-      public EventHandler {
- protected:
-  ReactorTest() : cnt_(0) {}
-
-  virtual void SetUp() {
-    // Timer handles are with auto reset for simplicity.
-    reset(timer1_, ::CreateWaitableTimer(NULL, false, NULL));
-    reset(timer2_, ::CreateWaitableTimer(NULL, false, NULL));
-
-    reset(event_done_, ::CreateEvent(NULL, true, false, NULL));
-
-    ASSERT_TRUE(timer1_);
-    ASSERT_TRUE(timer2_);
-    ASSERT_TRUE(event_done_);
-
-    // We only need the thread handle to queue an empty APC to it.
-    reset(main_thread_, ::OpenThread(THREAD_ALL_ACCESS,
-                                     false,
-                                     ::GetCurrentThreadId()));
-    ASSERT_TRUE(main_thread_);
-  }
-
-  virtual void TearDown() {
-  }
-
-  // EventHandler.
-  virtual void HandleEvent(HANDLE h);
-
-  // Empty APC to stop the reactor.
-  static void _stdcall Stop(ULONG_PTR) {}
-
-  // Returns an integer value in the [0, 10) range.
-  static int GetSmallInt() {
-    unsigned int val = 0;
-    rand_s(&val);
-    return val % 10;
-  }
-
-  Reactor reactor_;
-
-  scoped_timer timer1_;
-  scoped_timer timer2_;
-  scoped_event event_done_;
-
-  scoped_handle main_thread_;
-  LONG cnt_;
-  static const LONG ReactorTest::kMaxCount = 10;
-};
-
-const LONG ReactorTest::kMaxCount;
-
-void ReactorTest::HandleEvent(HANDLE h) {
-  EXPECT_TRUE(h);
-  if (h == get(event_done_)) {
-    ASSERT_TRUE(::QueueUserAPC(&ReactorTest::Stop,
-                               get(main_thread_),
-                               0));
-  } else if (h == get(timer1_) || h == get(timer2_)) {
-    // Check the handles auto reset correctly.
-    EXPECT_EQ(::WaitForSingleObject(h, 0), WAIT_TIMEOUT);
-    if (::InterlockedIncrement(&cnt_) > kMaxCount) {
-      ASSERT_TRUE(::SetEvent(get(event_done_)));
-    } else {
-      ASSERT_HRESULT_SUCCEEDED(reactor_.RegisterHandle(h));
-
-      unsigned int val = 0;
-      ASSERT_EQ(rand_s(&val), 0);
-      val %= 10;
-
-      // Set the timer to fire; negative values indicate relative time.
-      LARGE_INTEGER due_time_100ns = {0};
-      due_time_100ns.QuadPart = -(static_cast<int>(val) * 10 * 1000);
-      ASSERT_TRUE(::SetWaitableTimer(h, &due_time_100ns, 0, NULL, NULL, false));
-    }
-  }
-}
-
-// Registers the handles, primes the timers, and handles events.
-TEST_F(ReactorTest, HandleEvents) {
-  ASSERT_HRESULT_SUCCEEDED(reactor_.RegisterHandle(get(event_done_), this, 0));
-  ASSERT_HRESULT_SUCCEEDED(reactor_.RegisterHandle(get(timer1_), this, 0));
-  ASSERT_HRESULT_SUCCEEDED(reactor_.RegisterHandle(get(timer2_), this, 0));
-
-  LARGE_INTEGER due_time_100ns = {0};
-  ASSERT_TRUE(SetWaitableTimer(get(timer1_),
-                               &due_time_100ns,
-                               0,
-                               NULL,
-                               NULL,
-                               false));
-  ASSERT_TRUE(SetWaitableTimer(get(timer2_),
-                               &due_time_100ns,
-                               0,
-                               NULL,
-                               NULL,
-                               false));
-
-  ASSERT_HRESULT_SUCCEEDED(reactor_.HandleEvents());
-
-  ASSERT_HRESULT_SUCCEEDED(reactor_.UnregisterHandle(get(timer2_)));
-  ASSERT_HRESULT_SUCCEEDED(reactor_.UnregisterHandle(get(timer1_)));
-  ASSERT_HRESULT_SUCCEEDED(reactor_.UnregisterHandle(get(event_done_)));
-}
-
-}  // namespace omaha
diff --git a/base/reg_key.cc b/base/reg_key.cc
deleted file mode 100644
index 67abedf..0000000
--- a/base/reg_key.cc
+++ /dev/null
@@ -1,1277 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Registry configuration wrapers class implementation
-
-#include <raserror.h>
-#include "omaha/base/reg_key.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/static_assert.h"
-#include "omaha/base/string.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/system.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-HRESULT RegKey::Close() {
-  HRESULT hr = S_OK;
-  if (h_key_ != NULL) {
-    LONG res = RegCloseKey(h_key_);
-    hr = HRESULT_FROM_WIN32(res);
-    h_key_ = NULL;
-  }
-  return hr;
-}
-
-HRESULT RegKey::Create(HKEY hKeyParent,
-                       const TCHAR * key_name,
-                       TCHAR * lpszClass,
-                       DWORD options,
-                       REGSAM sam_desired,
-                       LPSECURITY_ATTRIBUTES lpSecAttr,
-                       LPDWORD lpdwDisposition) {
-  // lpszClass may be NULL
-  ASSERT1(key_name);
-  ASSERT1(hKeyParent != NULL);
-  DWORD dw;
-  HKEY hKey = NULL;
-  LONG res = ::RegCreateKeyEx(hKeyParent,
-                              key_name,
-                              0,
-                              lpszClass,
-                              options,
-                              sam_desired,
-                              lpSecAttr,
-                              &hKey,
-                              &dw);
-  HRESULT hr = HRESULT_FROM_WIN32(res);
-
-  if (lpdwDisposition != NULL)
-    *lpdwDisposition = dw;
-  // we have to close the currently opened key
-  // before replacing it with the new one
-  if (hr == S_OK) {
-    hr = Close();
-    ASSERT1(hr == S_OK);
-    h_key_ = hKey;
-  }
-  return hr;
-}
-
-HRESULT RegKey::Create(const TCHAR * full_key_name,
-                       TCHAR * lpszClass, DWORD options,
-                       REGSAM sam_desired,
-                       LPSECURITY_ATTRIBUTES lpSecAttr,
-                       LPDWORD lpdwDisposition) {
-  // lpszClass may be NULL
-  ASSERT1(full_key_name);
-  CString key_name(full_key_name);
-
-  HKEY parent_key = RegKey::GetRootKeyInfo(&key_name);
-  if (!parent_key) {
-    ASSERT(false, (_T("unable to get root key location %s"), full_key_name));
-    return HRESULT_FROM_WIN32(ERROR_KEY_NOT_FOUND);
-  }
-
-  return Create(parent_key, key_name, lpszClass,
-    options, sam_desired, lpSecAttr, lpdwDisposition);
-}
-
-HRESULT RegKey::CreateKeys(const TCHAR* keys_to_create[],
-                           DWORD number_of_keys,
-                           TCHAR* lpszClass,
-                           DWORD options,
-                           LPSECURITY_ATTRIBUTES lpSecAttr) {
-  ASSERT1(keys_to_create);
-  ASSERT1(number_of_keys);
-
-  for (DWORD i = 0; i < number_of_keys; i++) {
-    HRESULT hr = CreateKey(keys_to_create[i], lpszClass, options, lpSecAttr);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  return S_OK;
-}
-
-HRESULT RegKey::CreateKey(const TCHAR* full_key_name,
-                          TCHAR* lpszClass,
-                          DWORD options,
-                          LPSECURITY_ATTRIBUTES lpSecAttr) {
-  ASSERT1(full_key_name);
-
-  RegKey key;
-  HRESULT hr = key.Create(full_key_name,
-                          lpszClass,
-                          options,
-                          KEY_ALL_ACCESS,
-                          lpSecAttr,
-                          NULL);
-  if (FAILED(hr)) {
-    UTIL_LOG(L3, (_T("[couldn't create %s reg key]"), full_key_name));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT RegKey::Open(HKEY hKeyParent,
-                     const TCHAR * key_name,
-                     REGSAM sam_desired) {
-  ASSERT1(key_name);
-  ASSERT1(hKeyParent != NULL);
-  HKEY hKey = NULL;
-  LONG res = ::RegOpenKeyEx(hKeyParent, key_name, 0, sam_desired, &hKey);
-  HRESULT hr = HRESULT_FROM_WIN32(res);
-
-  // we have to close the currently opened key
-  // before replacing it with the new one
-  if (hr == S_OK) {
-    // close the currently opened key if any
-    hr = Close();
-    ASSERT1(hr == S_OK);
-    h_key_ = hKey;
-  }
-  return hr;
-}
-
-HRESULT RegKey::Open(const TCHAR * full_key_name, REGSAM sam_desired) {
-  ASSERT1(full_key_name);
-  CString key_name(full_key_name);
-
-  HKEY parent_key = RegKey::GetRootKeyInfo(&key_name);
-  if (!parent_key) {
-    ASSERT(false, (_T("unable to get root key for %s"), full_key_name));
-    return HRESULT_FROM_WIN32(ERROR_KEY_NOT_FOUND);
-  }
-
-  return Open(parent_key, key_name, sam_desired);
-}
-
-// save the key and all of its subkeys and values to a file
-HRESULT RegKey::Save(const TCHAR* full_key_name, const TCHAR* file_name) {
-  ASSERT1(full_key_name);
-  ASSERT1(file_name);
-
-  CString key_name(full_key_name);
-  HKEY h_key = GetRootKeyInfo(&key_name);
-  if (!h_key) {
-    return E_FAIL;
-  }
-
-  RegKey key;
-  HRESULT hr = key.Open(h_key, key_name, KEY_READ);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  System::AdjustPrivilege(SE_BACKUP_NAME, true);
-  LONG res = ::RegSaveKey(key.h_key_, file_name, NULL);
-  System::AdjustPrivilege(SE_BACKUP_NAME, false);
-
-  return HRESULT_FROM_WIN32(res);
-}
-
-// restore the key and all of its subkeys and values which are saved into a file
-HRESULT RegKey::Restore(const TCHAR* full_key_name, const TCHAR* file_name) {
-  ASSERT1(full_key_name);
-  ASSERT1(file_name);
-
-  CString key_name(full_key_name);
-  HKEY h_key = GetRootKeyInfo(&key_name);
-  if (!h_key) {
-    return E_FAIL;
-  }
-
-  RegKey key;
-  HRESULT hr = key.Open(h_key, key_name, KEY_WRITE);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  System::AdjustPrivilege(SE_RESTORE_NAME, true);
-  LONG res = ::RegRestoreKey(key.h_key_, file_name, REG_FORCE_RESTORE);
-  System::AdjustPrivilege(SE_RESTORE_NAME, false);
-
-  return HRESULT_FROM_WIN32(res);
-}
-
-// check if the current key has the specified subkey
-bool RegKey::HasSubkey(const TCHAR * key_name) const {
-  ASSERT1(key_name);
-  ASSERT1(h_key_);
-
-  RegKey key;
-  HRESULT hr = key.Open(h_key_, key_name, KEY_READ);
-  key.Close();
-  return S_OK == hr;
-}
-
-// static flush key
-HRESULT RegKey::FlushKey(const TCHAR * full_key_name) {
-  ASSERT1(full_key_name);
-
-  HRESULT hr = HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND);
-  // get the root HKEY
-  CString key_name(full_key_name);
-  HKEY h_key = GetRootKeyInfo(&key_name);
-
-  if (h_key != NULL) {
-    LONG res = RegFlushKey(h_key);
-    hr = HRESULT_FROM_WIN32(res);
-  }
-  return hr;
-}
-
-// static SET helper
-HRESULT RegKey::SetValueStaticHelper(const TCHAR * full_key_name,
-                                     const TCHAR * value_name,
-                                     DWORD type,
-                                     LPVOID value,
-                                     DWORD byte_count) {
-  // value_name may be NULL
-  ASSERT1(full_key_name);
-
-  HRESULT hr = HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND);
-  // get the root HKEY
-  CString key_name(full_key_name);
-  HKEY h_key = GetRootKeyInfo(&key_name);
-
-  if (h_key != NULL) {
-    RegKey key;
-    hr = key.Create(h_key, key_name.GetString());
-    if (hr == S_OK) {
-      switch (type) {
-        case REG_DWORD:
-          hr = key.SetValue(value_name, *reinterpret_cast<DWORD *>(value));
-          if (SUCCEEDED(hr)) {
-            UTIL_LOG(L6, (_T("[Wrote int32 value: %s:%s = %d]"),
-                          full_key_name,
-                          value_name,
-                          *reinterpret_cast<DWORD*>(value)));
-          }
-          break;
-        case REG_QWORD:
-          hr = key.SetValue(value_name, *reinterpret_cast<DWORD64 *>(value));
-          if (SUCCEEDED(hr)) {
-            UTIL_LOG(L6, (_T("[Wrote int64 value: %s:%s = %s]"),
-                          full_key_name,
-                          value_name,
-                          String_Int64ToString(
-                              *reinterpret_cast<DWORD64*>(value), 10)));
-          }
-          break;
-        case REG_SZ:
-          hr = key.SetValue(value_name, reinterpret_cast<const TCHAR *>(value));
-          if (SUCCEEDED(hr)) {
-            UTIL_LOG(L6, (_T("[Wrote string value: %s:%s = %s]"),
-                          full_key_name,
-                          value_name,
-                          reinterpret_cast<const TCHAR *>(value)));
-          }
-          break;
-        case REG_BINARY:
-          hr = key.SetValue(value_name,
-                            reinterpret_cast<const byte *>(value),
-                            byte_count);
-          if (SUCCEEDED(hr)) {
-            UTIL_LOG(L6, (_T("[Wrote binary value: %s:%s, len = %d]"),
-                          full_key_name, value_name, byte_count));
-          }
-          break;
-        case REG_MULTI_SZ:
-          hr = key.SetValue(value_name,
-                            reinterpret_cast<const byte *>(value),
-                            byte_count,
-                            type);
-          if (SUCCEEDED(hr)) {
-            UTIL_LOG(L6, (_T("[Wrote multi-sz value: %s:%s, len = %d]"),
-                          full_key_name, value_name, byte_count));
-          }
-          break;
-        case REG_EXPAND_SZ:
-          hr = key.SetStringValue(value_name,
-                                  reinterpret_cast<const TCHAR *>(value),
-                                  type);
-          if (SUCCEEDED(hr)) {
-            UTIL_LOG(L6, (_T("[Wrote expandable string value: %s:%s = %s]"),
-                          full_key_name, value_name, (const TCHAR *)value));
-          }
-          break;
-        default:
-          ASSERT(false, (_T("Unsupported Registry Type")));
-          hr = HRESULT_FROM_WIN32(ERROR_DATATYPE_MISMATCH);
-          break;
-      }
-      // close the key after writing
-      HRESULT temp_res = key.Close();
-      if (hr == S_OK) {
-        hr = temp_res;
-      } else {
-        ASSERT(false, (_T("Failed to write reg value: %s:%s (hr=0x%x)"),
-                       full_key_name, value_name, hr));
-      }
-    } else {
-      UTIL_LOG(L3, (_T("[Failed to create reg key: %s]"), full_key_name));
-    }
-  }
-  return hr;
-}
-
-// static GET helper
-// byte_count may be NULL.
-// value_name may be NULL.
-HRESULT RegKey::GetValueStaticHelper(const TCHAR * full_key_name,
-                                     const TCHAR * value_name,
-                                     DWORD type,
-                                     LPVOID value,
-                                     DWORD * byte_count) {
-  ASSERT1(full_key_name);
-
-  HRESULT hr = HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND);
-  // get the root HKEY
-  CString key_name(full_key_name);
-  HKEY h_key = GetRootKeyInfo(&key_name);
-
-  if (h_key != NULL) {
-    RegKey key;
-    hr = key.Open(h_key, key_name.GetString(), KEY_READ);
-    if (hr == S_OK) {
-      switch (type) {
-        case REG_DWORD:
-          hr = key.GetValue(value_name, reinterpret_cast<DWORD *>(value));
-          if (SUCCEEDED(hr)) {
-            UTIL_LOG(L6, (_T("[Read int32 value: %s:%s = %d]"),
-                          full_key_name,
-                          value_name,
-                          *reinterpret_cast<DWORD*>(value)));
-          }
-          break;
-        case REG_QWORD:
-          hr = key.GetValue(value_name, reinterpret_cast<DWORD64 *>(value));
-          if (SUCCEEDED(hr)) {
-            UTIL_LOG(L6, (_T("[Read int64 value: %s:%s = %s]"),
-                          full_key_name,
-                          value_name,
-                          String_Int64ToString(
-                              *(reinterpret_cast<DWORD64*>(value)), 10)));
-          }
-          break;
-        case REG_SZ:
-          hr = key.GetValue(value_name, reinterpret_cast<TCHAR * *>(value));
-          if (SUCCEEDED(hr)) {
-            UTIL_LOG(L6, (_T("[Read string value: %s:%s = %s]"),
-                          full_key_name,
-                          value_name,
-                          *reinterpret_cast<TCHAR * *>(value)));
-          }
-          break;
-        case REG_MULTI_SZ:
-          hr = key.GetValue(value_name,
-                            reinterpret_cast<std::vector<CString> *>(value));
-          if (SUCCEEDED(hr)) {
-            UTIL_LOG(L6, (_T("[Read multi string value: %s:%s = %d]"),
-                full_key_name,
-                value_name,
-                reinterpret_cast<std::vector<CString>*>(value)->size()));
-          }
-          break;
-        case REG_BINARY:
-          hr = key.GetValue(value_name,
-                            reinterpret_cast<byte * *>(value),
-                            byte_count);
-          if (SUCCEEDED(hr)) {
-            UTIL_LOG(L6, (_T("[Read binary value: %s:%s, len = %d]"),
-                          full_key_name, value_name, byte_count));
-          }
-          break;
-        default:
-          ASSERT(false, (_T("Unsupported Registry Type")));
-          hr = HRESULT_FROM_WIN32(ERROR_DATATYPE_MISMATCH);
-          break;
-      }
-      // close the key after writing
-      HRESULT temp_res = key.Close();
-      if (hr == S_OK) {
-        hr = temp_res;
-      } else {
-        UTIL_LOG(L5, (_T("[Failed to read reg value: %s:%s]"),
-                      full_key_name, value_name));
-      }
-    } else {
-      UTIL_LOG(L5, (_T("[reg value does not exist: %s]"), key_name));
-    }
-  }
-  return hr;
-}
-
-// GET helper
-// value_name may be NULL.
-HRESULT RegKey::GetValueHelper(const TCHAR * value_name,
-                               DWORD * type,
-                               byte * * value,
-                               DWORD * byte_count) const {
-  ASSERT1(byte_count);
-  ASSERT1(value);
-  ASSERT1(type);
-  ASSERT1(h_key_);
-
-  // init return buffer
-  *value = NULL;
-
-  // get the size of the return data buffer
-  LONG res = ::SHQueryValueEx(h_key_, value_name, NULL, type, NULL, byte_count);
-  HRESULT hr = HRESULT_FROM_WIN32(res);
-
-  if (hr == S_OK) {
-    // if the value length is 0, nothing to do
-    if (*byte_count != 0) {
-      // allocate the buffer
-      *value = new byte[*byte_count];
-      ASSERT1(*value);
-
-      // make the call again to get the data
-      res = ::SHQueryValueEx(h_key_,
-                             value_name,
-                             NULL,
-                             type,
-                             *value,
-                             byte_count);
-      hr = HRESULT_FROM_WIN32(res);
-      ASSERT1(S_OK == hr);
-    }
-  }
-  return hr;
-}
-
-// value_name may be NULL
-HRESULT RegKey::GetValueType(const TCHAR* value_name,
-                             DWORD* value_type) const {
-  ASSERT1(value_type);
-
-  *value_type = REG_NONE;
-
-  LONG res = ::SHQueryValueEx(h_key_, value_name, NULL, value_type, NULL, NULL);
-  if (res != ERROR_SUCCESS) {
-    return HRESULT_FROM_WIN32(res);
-  }
-
-  return S_OK;
-}
-
-// Int32 Get
-// value_name may be NULL.
-HRESULT RegKey::GetValue(const TCHAR * value_name, DWORD * value) const {
-  ASSERT1(value);
-  ASSERT1(h_key_);
-
-  DWORD type = 0;
-  DWORD byte_count = sizeof(DWORD);
-  LONG res = ::SHQueryValueEx(h_key_,
-                              value_name,
-                              NULL,
-                              &type,
-                              reinterpret_cast<byte*>(value),
-                              &byte_count);
-  HRESULT hr = HRESULT_FROM_WIN32(res);
-  ASSERT1((hr != S_OK) || (type == REG_DWORD));
-  ASSERT1((hr != S_OK) || (byte_count == sizeof(DWORD)));
-  return hr;
-}
-
-// Int64 Get
-// value_name may be NULL.
-HRESULT RegKey::GetValue(const TCHAR * value_name, DWORD64 * value) const {
-  ASSERT1(value);
-  ASSERT1(h_key_);
-
-  DWORD type = 0;
-  DWORD byte_count = sizeof(DWORD64);
-  LONG res = ::SHQueryValueEx(h_key_,
-                              value_name,
-                              NULL,
-                              &type,
-                              reinterpret_cast<byte *>(value),
-                              &byte_count);
-  HRESULT hr = HRESULT_FROM_WIN32(res);
-  ASSERT1((hr != S_OK) || (type == REG_QWORD));
-  ASSERT1((hr != S_OK) || (byte_count == sizeof(DWORD64)));
-  return hr;
-}
-
-// String Get
-// value_name may be NULL.
-HRESULT RegKey::GetValue(const TCHAR * value_name, TCHAR * * value) const {
-  ASSERT1(value);
-  ASSERT1(h_key_);
-
-  DWORD byte_count = 0;
-  DWORD type = 0;
-
-  // first get the size of the string buffer
-  LONG res = ::SHQueryValueEx(h_key_,
-                              value_name,
-                              NULL,
-                              &type,
-                              NULL,
-                              &byte_count);
-  HRESULT hr = HRESULT_FROM_WIN32(res);
-
-  if (hr == S_OK) {
-    // allocate room for the string and a terminating \0
-    *value = new TCHAR[(byte_count / sizeof(TCHAR)) + 1];
-
-    if ((*value) != NULL) {
-      if (byte_count != 0) {
-        // make the call again
-        res = ::SHQueryValueEx(h_key_, value_name, NULL, &type,
-                              reinterpret_cast<byte*>(*value), &byte_count);
-        hr = HRESULT_FROM_WIN32(res);
-      } else {
-        (*value)[0] = _T('\0');
-      }
-
-      ASSERT1((hr != S_OK) || (type == REG_SZ) ||
-              (type == REG_MULTI_SZ) || (type == REG_EXPAND_SZ));
-    } else {
-      hr = E_OUTOFMEMORY;
-    }
-  }
-
-  return hr;
-}
-
-// CString Get
-// value_name may be NULL.
-HRESULT RegKey::GetValue(const TCHAR* value_name, OUT CString* value) const {
-  ASSERT1(value);
-  ASSERT1(h_key_);
-
-  DWORD byte_count = 0;
-  DWORD type = 0;
-
-  // first get the size of the string buffer
-  LONG res = ::SHQueryValueEx(h_key_,
-                              value_name,
-                              NULL,
-                              &type,
-                              NULL,
-                              &byte_count);
-  HRESULT hr = HRESULT_FROM_WIN32(res);
-
-  if (hr == S_OK) {
-    if (byte_count != 0) {
-      // Allocate some memory and make the call again
-      TCHAR* buffer = value->GetBuffer(byte_count / sizeof(TCHAR) + 1);
-      if (buffer == NULL) {
-        hr = E_OUTOFMEMORY;
-      } else {
-        res = ::SHQueryValueEx(h_key_, value_name, NULL, &type,
-                              reinterpret_cast<byte*>(buffer), &byte_count);
-        hr = HRESULT_FROM_WIN32(res);
-      }
-      value->ReleaseBuffer();
-    } else {
-      value->Empty();
-    }
-
-    ASSERT1((hr != S_OK) || (type == REG_SZ) ||
-            (type == REG_MULTI_SZ) || (type == REG_EXPAND_SZ));
-  }
-
-  return hr;
-}
-
-// convert REG_MULTI_SZ bytes to string array
-HRESULT RegKey::MultiSZBytesToStringArray(const byte * buffer,
-                                          DWORD byte_count,
-                                          std::vector<CString> * value) {
-  ASSERT1(buffer);
-  ASSERT1(value);
-
-  const TCHAR* data = reinterpret_cast<const TCHAR*>(buffer);
-  DWORD data_len = byte_count / sizeof(TCHAR);
-  value->clear();
-  if (data_len > 1) {
-    // must be terminated by two null characters
-    if (data[data_len - 1] != 0 || data[data_len - 2] != 0) {
-      return E_INVALIDARG;
-    }
-
-    // put null-terminated strings into arrays
-    while (*data) {
-      CString str(data);
-      value->push_back(str);
-      data += str.GetLength() + 1;
-    }
-  }
-  return S_OK;
-}
-
-// get a vector<CString> value from REG_MULTI_SZ type
-HRESULT RegKey::GetValue(const TCHAR * value_name,
-                         std::vector<CString> * value) const {
-  ASSERT1(value);
-  // value_name may be NULL
-
-  DWORD byte_count = 0;
-  DWORD type = 0;
-  byte* buffer = 0;
-
-  // first get the size of the buffer
-  HRESULT hr = GetValueHelper(value_name, &type, &buffer, &byte_count);
-  ASSERT1((hr != S_OK) || (type == REG_MULTI_SZ));
-
-  if (SUCCEEDED(hr)) {
-    hr = MultiSZBytesToStringArray(buffer, byte_count, value);
-  }
-
-  return hr;
-}
-
-// Binary data Get
-HRESULT RegKey::GetValue(const TCHAR * value_name,
-                         byte * * value,
-                         DWORD * byte_count) const {
-  ASSERT1(byte_count);
-  ASSERT1(value);
-  // value_name may be NULL
-
-  DWORD type = 0;
-  HRESULT hr = GetValueHelper(value_name, &type, value, byte_count);
-  ASSERT1((hr != S_OK) || (type == REG_MULTI_SZ) || (type == REG_BINARY));
-  return hr;
-}
-
-// Raw data get
-HRESULT RegKey::GetValue(const TCHAR * value_name,
-                         byte * * value,
-                         DWORD * byte_count,
-                         DWORD *type) const {
-  ASSERT1(type);
-  ASSERT1(byte_count);
-  ASSERT1(value);
-
-  return GetValueHelper(value_name, type, value, byte_count);
-}
-
-// Int32 set
-// value_name may be NULL
-HRESULT RegKey::SetValue(const TCHAR * value_name, DWORD value) const {
-  ASSERT1(h_key_);
-  LONG res = RegSetValueEx(h_key_,
-                           value_name,
-                           NULL,
-                           REG_DWORD,
-                           reinterpret_cast<byte *>(&value),
-                           sizeof(DWORD));
-  return HRESULT_FROM_WIN32(res);
-}
-
-// Int64 set
-// value_name may be NULL
-HRESULT RegKey::SetValue(const TCHAR * value_name, DWORD64 value) const {
-  ASSERT1(h_key_);
-  LONG res = RegSetValueEx(h_key_,
-                           value_name,
-                           NULL,
-                           REG_QWORD,
-                           reinterpret_cast<byte *>(&value),
-                           sizeof(DWORD64));
-  return HRESULT_FROM_WIN32(res);
-}
-
-// String set
-HRESULT RegKey::SetValue(const TCHAR * value_name, const TCHAR * value) const {
-  return SetStringValue(value_name, value, REG_SZ);
-}
-
-// String set helper
-// value_name may be NULL.
-HRESULT RegKey::SetStringValue(const TCHAR * value_name,
-                               const TCHAR * value,
-                               DWORD type) const {
-  ASSERT1(value);
-  ASSERT1(h_key_);
-  ASSERT1(type == REG_SZ || type == REG_EXPAND_SZ);
-  LONG res = RegSetValueEx(h_key_,
-                           value_name,
-                           NULL,
-                           type,
-                           reinterpret_cast<const byte *>(value),
-                           (lstrlen(value) + 1) * sizeof(TCHAR));
-  return HRESULT_FROM_WIN32(res);
-}
-
-// Binary data set
-// value may be NULL.
-// value_name may be NULL.
-HRESULT RegKey::SetValue(const TCHAR * value_name,
-                         const byte * value,
-                         DWORD byte_count) const {
-  ASSERT1(h_key_);
-
-  // special case - if 'value' is NULL make sure byte_count is zero
-  if (value == NULL) {
-    byte_count = 0;
-  }
-
-  LONG res = RegSetValueEx(h_key_,
-                           value_name,
-                           NULL,
-                           REG_BINARY,
-                           value,
-                           byte_count);
-  return HRESULT_FROM_WIN32(res);
-}
-
-// Raw data set
-// value_name may be NULL.
-HRESULT RegKey::SetValue(const TCHAR * value_name,
-                         const byte * value,
-                         DWORD byte_count,
-                         DWORD type) const {
-  ASSERT1(value);
-  ASSERT1(h_key_);
-  LONG res = RegSetValueEx(h_key_, value_name, NULL, type, value, byte_count);
-  return HRESULT_FROM_WIN32(res);
-}
-
-HRESULT RegKey::RenameValue(const TCHAR* old_value_name,
-                            const TCHAR* new_value_name) const {
-  ASSERT1(h_key_);
-  ASSERT1(new_value_name);
-  ASSERT1(old_value_name);
-
-  scoped_ptr<byte> value;
-  DWORD byte_count = 0;
-  DWORD type = 0;
-
-  HRESULT hr = GetValue(old_value_name, address(value), &byte_count, &type);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = SetValue(new_value_name, value.get(), byte_count, type);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  VERIFY1(SUCCEEDED(DeleteValue(old_value_name)));
-  return S_OK;
-}
-
-bool RegKey::HasKey(const TCHAR * full_key_name) {
-  return HasKeyHelper(full_key_name, KEY_READ);
-}
-
-bool RegKey::HasNativeKey(const TCHAR * full_key_name) {
-  return HasKeyHelper(full_key_name, KEY_READ | KEY_WOW64_64KEY);
-}
-
-bool RegKey::HasKeyHelper(const TCHAR * full_key_name, DWORD sam_flags) {
-  ASSERT1(full_key_name);
-  ASSERT1(sam_flags & KEY_READ);
-
-  // get the root HKEY
-  CString key_name(full_key_name);
-  HKEY h_key = GetRootKeyInfo(&key_name);
-
-  if (h_key != NULL) {
-    RegKey key;
-    HRESULT hr = key.Open(h_key, key_name.GetString(), sam_flags);
-    key.Close();
-    return S_OK == hr;
-  }
-  return false;
-}
-
-HRESULT RegKey::CopyValue(const TCHAR * full_from_key_name,
-                          const TCHAR * from_value_name,
-                          const TCHAR * full_to_key_name,
-                          const TCHAR * to_value_name) {
-  ASSERT1(full_from_key_name);
-  ASSERT1(full_to_key_name);
-
-  RegKey from_reg_key;
-  HRESULT hr = from_reg_key.Open(full_from_key_name, KEY_READ);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  scoped_ptr<byte> val;
-  DWORD byte_count = 0;
-  DWORD type = 0;
-  hr = from_reg_key.GetValue(from_value_name, address(val), &byte_count, &type);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  RegKey to_reg_key;
-  hr = to_reg_key.Open(full_to_key_name, KEY_WRITE);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return to_reg_key.SetValue(to_value_name, val.get(), byte_count, type);
-}
-
-// static version of HasValue
-bool RegKey::HasValue(const TCHAR * full_key_name, const TCHAR * value_name) {
-  ASSERT1(full_key_name);
-
-  bool has_value = false;
-  // get the root HKEY
-  CString key_name(full_key_name);
-  HKEY h_key = GetRootKeyInfo(&key_name);
-
-  if (h_key != NULL) {
-    RegKey key;
-    if (key.Open(h_key, key_name.GetString(), KEY_READ) == S_OK) {
-      has_value = key.HasValue(value_name);
-      key.Close();
-    }
-  }
-  return has_value;
-}
-
-HRESULT RegKey::GetValueType(const TCHAR* full_key_name,
-                             const TCHAR* value_name,
-                             DWORD* value_type) {
-  ASSERT1(full_key_name);
-  // value_name may be NULL
-  ASSERT1(value_type);
-
-  *value_type = REG_NONE;
-
-  CString key_name(full_key_name);
-  HKEY root_key = GetRootKeyInfo(&key_name);
-
-  RegKey key;
-  HRESULT hr = key.Open(root_key, key_name, KEY_READ);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  return key.GetValueType(value_name, value_type);
-}
-
-HRESULT RegKey::DeleteKey(const TCHAR* full_key_name) {
-  ASSERT1(full_key_name);
-
-  return DeleteKey(full_key_name, true);
-}
-
-HRESULT RegKey::DeleteKey(const TCHAR* full_key_name, bool recursively) {
-  ASSERT1(full_key_name);
-
-  // need to open the parent key first
-  // get the root HKEY
-  CString key_name(full_key_name);
-  HKEY h_key = GetRootKeyInfo(&key_name);
-
-  // get the parent key
-  CString parent_key(GetParentKeyInfo(&key_name));
-
-  RegKey key;
-  HRESULT hr = key.Open(h_key, parent_key);
-
-  if (hr == S_OK) {
-    hr = recursively ? key.RecurseDeleteSubKey(key_name) :
-                       key.DeleteSubKey(key_name);
-  } else if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
-             hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)) {
-    hr = S_FALSE;
-  }
-
-  key.Close();
-  return hr;
-}
-
-HRESULT RegKey::DeleteValue(const TCHAR * full_key_name,
-                            const TCHAR * value_name) {
-  ASSERT1(value_name);
-  ASSERT1(full_key_name);
-
-  HRESULT hr = HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND);
-  // get the root HKEY
-  CString key_name(full_key_name);
-  HKEY h_key = GetRootKeyInfo(&key_name);
-
-  if (h_key != NULL) {
-    RegKey key;
-    hr = key.Open(h_key, key_name.GetString());
-    if (hr == S_OK) {
-      hr = key.DeleteValue(value_name);
-      key.Close();
-    }
-  }
-  return hr;
-}
-
-HRESULT RegKey::RecurseDeleteSubKey(const TCHAR * key_name) {
-  ASSERT1(key_name);
-  ASSERT1(h_key_);
-
-  RegKey key;
-  HRESULT hr = key.Open(h_key_, key_name);
-  if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
-      hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)) {
-    hr = S_FALSE;
-  }
-  if (hr != S_OK) {
-    return hr;
-  }
-
-  // enumerate all subkeys of this key
-  // and recursivelly delete them
-  FILETIME time;
-  TCHAR key_name_buf[kMaxKeyNameChars];
-  DWORD key_name_buf_size = kMaxKeyNameChars;
-  while (RegEnumKeyEx(key.h_key_,
-                      0,
-                      key_name_buf,
-                      &key_name_buf_size,
-                      NULL,
-                      NULL,
-                      NULL,
-                      &time) == ERROR_SUCCESS) {
-    hr = key.RecurseDeleteSubKey(key_name_buf);
-    // return if error deleting key
-    if (hr != S_OK)
-      return hr;
-    // restore the buffer size
-    key_name_buf_size = kMaxKeyNameChars;
-  }
-  // close the top key
-  key.Close();
-
-  // the key has no more children keys
-  // delete the key and all of its values
-  return DeleteSubKey(key_name);
-}
-
-HKEY RegKey::GetRootKeyInfo(CString * full_key_name) {
-  ASSERT1(full_key_name);
-
-  HKEY h_key = NULL;
-  // get the root HKEY
-  int index = String_FindChar(*(full_key_name), '\\');
-  CString root_key;
-
-  if (index == -1) {
-    root_key = *full_key_name;
-    *full_key_name = _T("");
-  } else {
-    root_key= full_key_name->Left(index);
-    *full_key_name =
-        full_key_name->Right(full_key_name->GetLength() - index - 1);
-  }
-
-  if (!root_key.CompareNoCase(_T("HKLM")) ||
-      !root_key.CompareNoCase(_T("HKEY_LOCAL_MACHINE")))
-    h_key = HKEY_LOCAL_MACHINE;
-  else if (!root_key.CompareNoCase(_T("HKCU")) ||
-           !root_key.CompareNoCase(_T("HKEY_CURRENT_USER")))
-    h_key = HKEY_CURRENT_USER;
-  else if (!root_key.CompareNoCase(_T("HKU")) ||
-           !root_key.CompareNoCase(_T("HKEY_USERS")))
-    h_key = HKEY_USERS;
-  else if (!root_key.CompareNoCase(_T("HKCR")) ||
-           !root_key.CompareNoCase(_T("HKEY_CLASSES_ROOT")))
-    h_key = HKEY_CLASSES_ROOT;
-
-  return h_key;
-}
-
-
-// Returns true if this key name is 'safe' for deletion (doesn't specify a
-// key root)
-bool RegKey::SafeKeyNameForDeletion(const wchar_t *key_name) {
-  ASSERT1(key_name);
-  CString key(key_name);
-
-  HKEY root_key = GetRootKeyInfo(&key);
-
-  if ( !root_key ) {
-    key = key_name;
-  }
-  if ( key.IsEmpty() ) {
-    return false;
-  }
-  bool found_subkey = false, backslash_found = false;
-  for (int i = 0 ; i < key.GetLength() ; ++i) {
-    if ( key[i] == L'\\' ) {
-      backslash_found = true;
-    } else if ( backslash_found ) {
-      found_subkey = true;
-      break;
-    }
-  }
-  return ( root_key == HKEY_USERS ) ? found_subkey : true;
-}
-
-CString RegKey::GetParentKeyInfo(CString * key_name) {
-  ASSERT1(key_name);
-
-  // get the parent key
-  int index = key_name->ReverseFind('\\');
-  CString parent_key;
-  if (index == -1) {
-    parent_key = _T("");
-  } else {
-    parent_key = key_name->Left(index);
-    *key_name = key_name->Right(key_name->GetLength() - index - 1);
-  }
-
-  return parent_key;
-}
-
-// get the number of values for this key
-uint32 RegKey::GetValueCount() {
-  ASSERT1(h_key_);
-  // number of values for key
-  DWORD  num_values = 0;
-
-  LONG res = ::RegQueryInfoKey(h_key_,       // key handle
-                               NULL,         // buffer for class name
-                               NULL,         // size of class string
-                               NULL,         // reserved
-                               NULL,         // number of subkeys
-                               NULL,         // longest subkey size
-                               NULL,         // longest class string
-                               &num_values,  // number of values for this key
-                               NULL,         // longest value name
-                               NULL,         // longest value data
-                               NULL,         // security descriptor
-                               NULL);        // last write time
-
-  ASSERT1(res == ERROR_SUCCESS);
-  return num_values;
-}
-
-// Enumerators for the value_names for this key
-
-// Called to get the value name for the given value name index
-// Use GetValueCount() to get the total value_name count for this key
-// Returns failure if no key at the specified index
-// type may be NULL.
-HRESULT RegKey::GetValueNameAt(int index, CString *value_name, DWORD *type) {
-  ASSERT1(value_name);
-  ASSERT1(h_key_);
-
-  LONG res = ERROR_SUCCESS;
-  TCHAR value_name_buf[kMaxValueNameChars];
-  DWORD value_name_buf_size = kMaxValueNameChars;
-  res = ::RegEnumValue(h_key_,
-                       index,
-                       value_name_buf,
-                       &value_name_buf_size,
-                       NULL,
-                       type,
-                       NULL,
-                       NULL);
-
-  if (res == ERROR_SUCCESS) {
-    value_name->SetString(value_name_buf);
-  }
-
-  return HRESULT_FROM_WIN32(res);
-}
-
-uint32 RegKey::GetSubkeyCount() {
-  ASSERT1(h_key_);
-
-  DWORD num_subkeys = 0;   // number of values for key
-
-  LONG res = ::RegQueryInfoKey(h_key_,        // key handle
-                               NULL,          // buffer for class name
-                               NULL,          // size of class string
-                               NULL,          // reserved
-                               &num_subkeys,  // number of subkeys
-                               NULL,          // longest subkey size
-                               NULL,          // longest class string
-                               NULL,          // number of values for this key
-                               NULL,          // longest value name
-                               NULL,          // longest value data
-                               NULL,          // security descriptor
-                               NULL);         // last write time
-
-  ASSERT1(res == ERROR_SUCCESS);
-  return num_subkeys;
-}
-
-HRESULT RegKey::GetSubkeyNameAt(int index, CString * key_name) {
-  ASSERT1(key_name);
-  ASSERT1(h_key_);
-
-  LONG res = ERROR_SUCCESS;
-  TCHAR key_name_buf[kMaxKeyNameChars];
-  DWORD key_name_buf_size = kMaxKeyNameChars;
-
-  res = ::RegEnumKeyEx(h_key_,
-                       index,
-                       key_name_buf,
-                       &key_name_buf_size,
-                       NULL,
-                       NULL,
-                       NULL,
-                       NULL);
-
-  if (res == ERROR_SUCCESS) {
-    key_name->SetString(key_name_buf);
-  }
-
-  return HRESULT_FROM_WIN32(res);
-}
-
-// Is the key empty: having no sub-keys and values
-bool RegKey::IsKeyEmpty(const TCHAR* full_key_name) {
-  ASSERT1(full_key_name);
-
-  bool is_empty = true;
-
-  // Get the root HKEY
-  CString key_name(full_key_name);
-  HKEY h_key = GetRootKeyInfo(&key_name);
-
-  // Open the key to check
-  if (h_key != NULL) {
-    RegKey key;
-    HRESULT hr = key.Open(h_key, key_name.GetString(), KEY_READ);
-    if (SUCCEEDED(hr)) {
-      is_empty = key.GetSubkeyCount() == 0 && key.GetValueCount() == 0;
-      key.Close();
-    }
-  }
-
-  return is_empty;
-}
-
-// close this reg key and the event
-HRESULT RegKeyWithChangeEvent::Close() {
-  reset(change_event_);
-  return RegKey::Close();
-}
-
-// Called to create/reset the event that gets signaled
-// any time the registry key changes
-// Note:
-//   * reg key should have been opened using KEY_NOTIFY for the sam_desired
-//
-// See the documentation for RegNotifyChangeKeyValue
-// for values for notify_filter.
-HRESULT RegKeyWithChangeEvent::SetupEvent(bool watch_subtree,
-                                          DWORD notify_filter) {
-  // If the event exists, then it should be in the signaled state
-  // indicating a registry change took place.  If not, then
-  // the caller is setting up the event a second time and this
-  // will create a memory leak.
-  ASSERT(!valid(change_event_) || HasChangeOccurred(),
-         (_T("Event is getting set-up for a second ")
-          _T("time without being signaled.")));
-
-  if (!valid(change_event_)) {
-    reset(change_event_, ::CreateEvent(NULL, TRUE, FALSE, NULL));
-    if (!valid(change_event_)) {
-      ASSERT(false, (_T("create event failed")));
-      return HRESULT_FROM_WIN32(::GetLastError());
-    }
-  } else {
-    if (!::ResetEvent(get(change_event_))) {
-      ASSERT(false, (_T("reset event failed")));
-      return HRESULT_FROM_WIN32(::GetLastError());
-    }
-  }
-
-  LONG res = ::RegNotifyChangeKeyValue(Key(), watch_subtree, notify_filter,
-      get(change_event_), TRUE);
-
-  if (res != ERROR_SUCCESS) {
-    // You may get this failure if you didn't pass in KEY_NOTIFY
-    // as part of the sam_desired flags during Open or Create
-    ASSERT(false, (_T("setting up change notification for a reg key failed")));
-
-    // Leave the event around so that it never changes once it has been set-up
-    // but in this case it will not get signaled again.
-  }
-
-  return HRESULT_FROM_WIN32(res);
-}
-
-// Indicates if any changes (that are being monitored have occured)
-bool RegKeyWithChangeEvent::HasChangeOccurred() const {
-  return IsHandleSignaled(get(change_event_));
-}
-
-
-RegKeyWatcher::RegKeyWatcher(const TCHAR* reg_key, bool watch_subtree,
-                             DWORD notify_filter, bool allow_creation)
-    : reg_key_string_(reg_key),
-      watch_subtree_(watch_subtree),
-      notify_filter_(notify_filter),
-      allow_creation_(allow_creation) {
-  UTIL_LOG(L3, (_T("[RegKeyWatcher::RegKeyWatcher][%s]"), reg_key));
-}
-
-HRESULT RegKeyWatcher::EnsureEventSetup() {
-  UTIL_LOG(L3, (_T("[RegKeyWatcher::EnsureEventSetup]")));
-  if (!reg_key_with_change_event_.get()) {
-    scoped_ptr<RegKeyWithChangeEvent> local_reg_key(new RegKeyWithChangeEvent);
-    if (!local_reg_key.get()) {
-      ASSERT(false, (_T("unable to allocate local_reg_key")));
-      return E_FAIL;
-    }
-
-    if (allow_creation_ && !RegKey::HasKey(reg_key_string_)) {
-      RegKey key;
-      VERIFY1(SUCCEEDED(key.Create(reg_key_string_)));
-    }
-
-    HRESULT hr = local_reg_key->Open(reg_key_string_, KEY_NOTIFY);
-    if (FAILED(hr)) {
-      ASSERT(false, (_T("couldn't open %s reg key for notifications. ")
-                     _T("Make sure you have pre-created the key!"),
-                     reg_key_string_));
-      return hr;
-    }
-    reg_key_with_change_event_.reset(local_reg_key.release());
-    reg_key_string_.Empty();
-  }
-
-  // if the event is set-up and no changes have occurred,
-  // then there is no need to re-setup the event.
-  if (reg_key_with_change_event_->change_event() && !HasChangeOccurred()) {
-    return S_OK;
-  }
-
-  return reg_key_with_change_event_->SetupEvent(watch_subtree_,
-                                                notify_filter_);
-}
-
-// Get the event that is signaled on registry changes.
-HANDLE RegKeyWatcher::change_event() const {
-  if (!reg_key_with_change_event_.get()) {
-    ASSERT(false, (_T("call RegKeyWatcher::EnsureEventSetup first")));
-    return NULL;
-  }
-  return reg_key_with_change_event_->change_event();
-}
-
-}  // namespace omaha
-
diff --git a/base/reg_key.h b/base/reg_key.h
deleted file mode 100644
index 295df98..0000000
--- a/base/reg_key.h
+++ /dev/null
@@ -1,787 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// reg_key.h
-//
-// Registry configuration wrappers class
-//
-// Offers static functions for convenient
-// fast access for individual values
-//
-// Also provides a wrapper class for efficient
-// batch operations on values of a given registry key.
-
-#ifndef OMAHA_BASE_REG_KEY_H_
-#define OMAHA_BASE_REG_KEY_H_
-
-#include <windows.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/static_assert.h"
-#include "omaha/base/store_watcher.h"
-
-namespace omaha {
-
-// maximum sizes registry key and value names
-#define kMaxKeyNameChars   (255 + 1)
-#define kMaxValueNameChars (16383 + 1)
-
-class RegKey {
- public:
-  RegKey();
-  virtual ~RegKey();
-
-  // create a reg key
-  HRESULT Create(HKEY hKeyParent, const TCHAR * key_name,
-        TCHAR * reg_class = REG_NONE, DWORD options = REG_OPTION_NON_VOLATILE,
-        REGSAM sam_desired = KEY_ALL_ACCESS,
-        LPSECURITY_ATTRIBUTES lp_sec_attr = NULL,
-        LPDWORD lp_disposition = NULL);
-
-  // create a reg key, given the full key name, including the HKEY root
-  // (say for example, "HKLM\\Software")
-  HRESULT Create(const TCHAR * full_key_name,
-        TCHAR * reg_class = REG_NONE, DWORD options = REG_OPTION_NON_VOLATILE,
-        REGSAM sam_desired = KEY_ALL_ACCESS,
-        LPSECURITY_ATTRIBUTES lp_sec_attr = NULL,
-        LPDWORD lp_disposition = NULL);
-
-  // static helper function that create a set of reg keys,
-  // given an array of full key names including the HKEY root
-  // (say for example, "HKLM\\Software")
-  static HRESULT CreateKeys(const TCHAR* keys_to_create[],
-                            DWORD number_of_keys,
-                            TCHAR* reg_class = REG_NONE,
-                            DWORD options = REG_OPTION_NON_VOLATILE,
-                            LPSECURITY_ATTRIBUTES lp_sec_attr = NULL);
-
-  // Static method to create a single key.
-  static HRESULT CreateKey(const TCHAR * full_key_name,
-                           TCHAR * reg_class = REG_NONE,
-                           DWORD options = REG_OPTION_NON_VOLATILE,
-                           LPSECURITY_ATTRIBUTES lp_sec_attr = NULL);
-
-  // open an existing reg key
-  HRESULT Open(HKEY hKeyParent,
-               const TCHAR * key_name,
-               REGSAM sam_desired = KEY_ALL_ACCESS);
-
-  // open an existing reg key, given the full key name, including the HKEY root
-  // (say for example, "HKLM\\Software")
-  HRESULT Open(const TCHAR * full_key_name,
-               REGSAM sam_desired = KEY_ALL_ACCESS);
-
-  // close this reg key
-  virtual HRESULT Close();
-
-  // check if the key has a specified value
-  bool HasValue(const TCHAR * value_name);
-
-  // get the number of values for this key
-  uint32 GetValueCount();
-
-  // Called to get the value name for the given value name index
-  // Use GetValueCount() to get the total value_name count for this key
-  // Returns failure if no key at the specified index
-  // If you modify the key while enumerating, the indexes will be out of order.
-  // Since the index order is not guaranteed, you need to reset your counting
-  // loop.
-  // type refers to REG_DWORD, REG_QWORD, etc..
-  // 'type' can be NULL if not interested in the value type
-  HRESULT GetValueNameAt(int index, CString * value_name, DWORD *type);
-
-  // check if the current key has the specified subkey
-  bool HasSubkey(const TCHAR * key_name) const;
-
-  // get the number of subkeys for this key
-  uint32 GetSubkeyCount();
-
-  // Called to get the key name for the given key index
-  // Use GetSubkeyCount() to get the total count for this key
-  // Returns failure if no key at the specified index
-  // If you modify the key while enumerating, the indexes will be out of order.
-  // Since the index order is not guaranteed, you need to reset your counting
-  // loop.
-  HRESULT GetSubkeyNameAt(int index, CString * key_name);
-
-  // SETTERS
-
-  // set an int32 value - use when reading multiple values from a key
-  HRESULT SetValue(const TCHAR * value_name, DWORD value) const;
-
-  // set an int64 value
-  HRESULT SetValue(const TCHAR * value_name, DWORD64 value) const;
-
-  // set a string value
-  HRESULT SetValue(const TCHAR * value_name, const TCHAR * value) const;
-
-  // set binary data
-  HRESULT SetValue(const TCHAR * value_name,
-                   const byte * value,
-                   DWORD byte_count) const;
-
-  // set raw data, including type
-  HRESULT SetValue(const TCHAR * value_name,
-                   const byte * value,
-                   DWORD byte_count,
-                   DWORD type) const;
-
-  // GETTERS
-
-  // get type of a registry value
-  HRESULT GetValueType(const TCHAR* value_name, DWORD* value_type) const;
-
-  // get an int32 value
-  HRESULT GetValue(const TCHAR * value_name, DWORD * value) const;
-
-  // get an int64 value
-  //
-  // Note: if you are using time64 you should
-  // likely use GetLimitedTimeValue (util.h) instead of this method.
-  HRESULT GetValue(const TCHAR * value_name, DWORD64 * value) const;
-
-  // get a string value - the caller must free the return buffer
-  HRESULT GetValue(const TCHAR * value_name, TCHAR * * value) const;
-
-  // get a CString value
-  HRESULT GetValue(const TCHAR* value_name, OUT CString* value) const;
-
-  // get a vector<CString> value from REG_MULTI_SZ type
-  HRESULT GetValue(const TCHAR * value_name,
-                   std::vector<CString> * value) const;
-
-  // get binary data - the caller must free the return buffer
-  HRESULT GetValue(const TCHAR * value_name,
-                   byte * * value,
-                   DWORD * byte_count) const;
-
-  // get raw data, including type - the caller must free the return buffer
-  HRESULT GetValue(const TCHAR * value_name,
-                   byte * * value,
-                   DWORD * byte_count,
-                   DWORD *type) const;
-
-  // RENAMERS
-
-  // Rename a named value.
-  HRESULT RenameValue(const TCHAR * old_value_name,
-                      const TCHAR * new_value_name) const;
-
-  // STATIC VERSIONS
-
-  // flush
-  static HRESULT FlushKey(const TCHAR * full_key_name);
-
-  // Check if a key exists.
-  static bool HasKey(const TCHAR * full_key_name);
-
-  // Check if a key exists in the native (i.e. non-redirected) registry.
-  static bool HasNativeKey(const TCHAR * full_key_name);
-
-  // check if the key has a specified value
-  static bool HasValue(const TCHAR * full_key_name, const TCHAR * value_name);
-
-  // SETTERS
-
-  // STATIC int32 set
-  static HRESULT SetValue(const TCHAR * full_key_name,
-                          const TCHAR * value_name,
-                          DWORD value);
-
-  // STATIC int64 set
-  static HRESULT SetValue(const TCHAR * full_key_name,
-                          const TCHAR * value_name,
-                          DWORD64 value);
-
-  // STATIC float set
-  static HRESULT SetValue(const TCHAR * full_key_name,
-                          const TCHAR * value_name,
-                          float value);
-
-  // STATIC double set
-  static HRESULT SetValue(const TCHAR * full_key_name,
-                          const TCHAR * value_name,
-                          double value);
-
-  // STATIC string set
-  static HRESULT SetValue(const TCHAR * full_key_name,
-                          const TCHAR * value_name,
-                          const TCHAR * value);
-
-  // STATIC binary data set
-  static HRESULT SetValue(const TCHAR * full_key_name,
-                          const TCHAR * value_name,
-                          const byte * value,
-                          DWORD byte_count);
-
-  // STATIC array of strings set
-  static HRESULT SetValueMultiSZ(const TCHAR * full_key_name,
-                                 const TCHAR * value_name,
-                                 const byte * value,
-                                 DWORD byte_count);
-
-  // STATIC expandable string set
-  static HRESULT SetValueExpandSZ(const TCHAR * full_key_name,
-                                  const TCHAR * value_name,
-                                  const TCHAR * value);
-
-  // GETTERS
-
-  // STATIC int32 get
-  static HRESULT GetValue(const TCHAR * full_key_name,
-                          const TCHAR * value_name,
-                          DWORD * value);
-
-  // STATIC int64 get
-  //
-  // Note: if you are using time64 you should
-  // likely use GetLimitedTimeValue (util.h) instead of this method.
-  static HRESULT GetValue(const TCHAR * full_key_name,
-                          const TCHAR * value_name,
-                          DWORD64 * value);
-
-  // STATIC float get
-  static HRESULT GetValue(const TCHAR * full_key_name,
-                          const TCHAR * value_name,
-                          float * value);
-
-  // STATIC double get
-  static HRESULT GetValue(const TCHAR * full_key_name,
-                          const TCHAR * value_name,
-                          double * value);
-
-  // STATIC string get (STR and CString versions) - the caller must free
-  // the return buffer
-  static HRESULT GetValue(const TCHAR * full_key_name,
-                          const TCHAR * value_name,
-                          TCHAR * * value);
-
-  static HRESULT GetValue(const TCHAR * full_key_name,
-                          const TCHAR * value_name,
-                          CString * value);
-
-  // STATIC REG_MULTI_SZ get
-  static HRESULT GetValue(const TCHAR * full_key_name,
-                          const TCHAR * value_name,
-                          std::vector<CString> * value);
-
-  // STATIC get binary data - the caller must free the return buffer
-  static HRESULT GetValue(const TCHAR * full_key_name,
-                          const TCHAR * value_name,
-                          byte * * value,
-                          DWORD * byte_count);
-
-  // Try reg keys successively if there is a failure in getting a value.
-  //
-  // Typically used when there is a user value and a default value if the
-  // user has none.
-  template<typename T>
-  static HRESULT GetValue(const TCHAR * full_key_names[],
-                          int key_names_length,
-                          const TCHAR * value_name,
-                          T* value);
-
-  // RENAMERS
-
-  // Rename a named value.
-  static HRESULT RenameValue(const TCHAR * full_key_name,
-                             const TCHAR * old_value_name,
-                             const TCHAR * new_value_name);
-
-  // COPIERS
-
-  // The full_to_key must exist for CopyValue to succeed.
-  static HRESULT CopyValue(const TCHAR * full_from_key_name,
-                           const TCHAR * from_value_name,
-                           const TCHAR * full_to_key_name,
-                           const TCHAR * to_value_name);
-
-  static HRESULT CopyValue(const TCHAR * full_from_key_name,
-                           const TCHAR * full_to_key_name,
-                           const TCHAR * value_name);
-
-  // Get type of a registry value
-  static HRESULT GetValueType(const TCHAR* full_key_name,
-                              const TCHAR* value_name,
-                              DWORD* value_type);
-
-  // delete a subkey of the current key (with no subkeys)
-  HRESULT DeleteSubKey(const TCHAR * key_name);
-
-  // recursively delete a sub key of the current key (and all its subkeys)
-  HRESULT RecurseDeleteSubKey(const TCHAR * key_name);
-
-  // STATIC version of delete key - handles nested keys also
-  // delete a key and all its sub-keys recursively
-  // Returns S_FALSE if key didn't exist, S_OK if deletion was successful,
-  // and failure otherwise.
-  static HRESULT DeleteKey(const TCHAR* full_key_name);
-
-  // STATIC version of delete key
-  // delete a key recursively or non-recursively
-  // Returns S_FALSE if key didn't exist, S_OK if deletion was successful,
-  // and failure otherwise.
-  static HRESULT DeleteKey(const TCHAR* full_key_name, bool recursive);
-
-  // delete the specified value
-  HRESULT DeleteValue(const TCHAR * value_name) const;
-
-  // STATIC version of delete value
-  // Returns S_FALSE if key didn't exist, S_OK if deletion was successful,
-  // and failure otherwise.
-  static HRESULT DeleteValue(const TCHAR * full_key_name,
-                             const TCHAR * value_name);
-
-  // Peek inside (use a RegKey as a smart wrapper around a registry handle)
-  HKEY Key() { return h_key_; }
-
-  // Used to help test the private functionality
-  friend class RegKeyTestClass;
-
-  // helper function to get the HKEY and the root key from a string
-  // representation modifies the argument in place and returns the key name
-  // e.g. HKLM\\Software\\Google\... returns HKLM, "Software\\Google\..."
-  // Necessary for the static versions that use the full name of the reg key
-  static HKEY GetRootKeyInfo(CString * full_key_name);
-
-  // Returns true if this key name is 'safe' for deletion (doesn't specify
-  // a key root)
-  static bool SafeKeyNameForDeletion(const wchar_t *key_name);
-
-  // save the key and all of its subkeys and values to a file
-  static HRESULT Save(const TCHAR* full_key_name, const TCHAR* file_name);
-
-  // restore the key and all of its subkeys and values which are saved into
-  // a file
-  static HRESULT Restore(const TCHAR* full_key_name, const TCHAR* file_name);
-
-  // Is the key empty: having no sub-keys and values
-  static bool IsKeyEmpty(const TCHAR* full_key_name);
-
- private:
-
-  // Helper function to check if a key exists, using the sam flags specified.
-  // Note: KEY_READ must be included in sam_flags.
-  static bool HasKeyHelper(const TCHAR * full_key_name, DWORD sam_flags);
-
-  // helper function to get the parent key name and the subkey from a string
-  // representation modifies the argument in place and returns the key name
-  // e.g. Software\\Google\\Foo_Bar returns "Software\\Google", "Foo_Bar"
-  // Necessary for the static versions that use the full name of the reg key
-  static CString GetParentKeyInfo(CString * key_name);
-
-  // helper function to get any value from the registry
-  // used when the size of the data is unknown
-  HRESULT GetValueHelper(const TCHAR * value_name,
-                         DWORD * type,
-                         byte * * value,
-                         DWORD * byte_count) const;
-
-  // common SET Helper for the static case
-  static HRESULT SetValueStaticHelper(const TCHAR * full_key_name,
-                                      const TCHAR * value_name,
-                                      DWORD type,
-                                      LPVOID value,
-                                      DWORD byte_count = 0);
-
-  // common GET Helper for the static case
-  static HRESULT GetValueStaticHelper(const TCHAR * full_key_name,
-                                      const TCHAR * value_name,
-                                      DWORD type,
-                                      LPVOID value,
-                                      DWORD * byte_count = NULL);
-
-  // convert REG_MULTI_SZ bytes to string array
-  static HRESULT MultiSZBytesToStringArray(const byte * buffer,
-                                           DWORD byte_count,
-                                           std::vector<CString> * value);
-
-  // set a string or expandable string value
-  HRESULT SetStringValue(const TCHAR * value_name,
-                         const TCHAR * value,
-                         DWORD type) const;
-
-  // the HKEY for the current key
-  HKEY h_key_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(RegKey);
-};
-
-// Provides all the functionality of RegKey plus
-// an event to watch for changes to the registry key.
-class RegKeyWithChangeEvent : public RegKey {
- public:
-  RegKeyWithChangeEvent() {}
-  // close this reg key and the event
-  virtual HRESULT Close();
-
-  // Called to create/reset the event that gets signaled
-  // any time the registry key changes.  Access the created
-  // event using change_event().
-  //
-  // See the documentation for RegNotifyChangeKeyValue
-  // for values for notify_filter.
-  HRESULT SetupEvent(bool watch_subtree, DWORD notify_filter);
-
-  // Indicates if any changes (that are being monitored) have occured
-  bool HasChangeOccurred() const;
-
-  // Get the event that is signaled on registry changes.
-  // Note:
-  //   * This event will remain constant until Close() is called.
-  //   * One should call SetupEvent to set-up the event.
-  //   * The event is only signaled on the next change and remains signaled.
-  //     Do not call ::ResetEvent().  Call SetupEvent() to reset
-  //     the event and wait for more changes.
-  HANDLE change_event() const {
-    return get(change_event_);
-  }
-
- private:
-  scoped_handle change_event_;
-  DISALLOW_EVIL_CONSTRUCTORS(RegKeyWithChangeEvent);
-};
-
-// Does the common things necessary for watching
-// registry key changes.  If there are file change or other watchers,
-// there could be a common interface for the three methods to decouple
-// the code that is doing the watching from the code that owns the store.
-class RegKeyWatcher : public StoreWatcher {
- public:
-  // reg_key: the full string for the reg key
-  // watch_subtree: watch all subkey changes  or
-  //                only immediate child values
-  // notify_filter: See the documentation for RegNotifyChangeKeyValue
-  // allow_creation: Should the key be created if it doesn't exist?
-  RegKeyWatcher(const TCHAR* reg_key, bool watch_subtree,
-                DWORD notify_filter, bool allow_creation);
-  virtual ~RegKeyWatcher() {}
-
-  // Called to create/reset the event that gets signaled
-  // any time the registry key changes.  Access the created
-  // event using change_event().
-  virtual HRESULT EnsureEventSetup();
-
-  // Get the event that is signaled on registry changes.
-  virtual HANDLE change_event() const;
-
- private:
-  // Used to do the SetupEvent method
-  scoped_ptr<RegKeyWithChangeEvent> reg_key_with_change_event_;
-
-  CString reg_key_string_;
-  bool watch_subtree_;
-  bool allow_creation_;
-  DWORD notify_filter_;
-  DISALLOW_EVIL_CONSTRUCTORS(RegKeyWatcher);
-};
-
-
-inline RegKey::RegKey() { h_key_ = NULL; }
-
-inline RegKey::~RegKey() { Close(); }
-
-inline bool RegKey::HasValue(const TCHAR* value_name) {
-  return (ERROR_SUCCESS == ::RegQueryValueEx(h_key_,
-                                             value_name,
-                                             NULL, NULL,
-                                             NULL,
-                                             NULL));
-}
-
-// SETTERS static versions
-inline HRESULT RegKey::SetValue(const TCHAR* full_key_name,
-                                const TCHAR* value_name,
-                                DWORD value) {
-  ASSERT1(full_key_name);
-
-  return SetValueStaticHelper(full_key_name, value_name, REG_DWORD, &value);
-}
-
-inline HRESULT RegKey::SetValue(const TCHAR* full_key_name,
-                                const TCHAR* value_name,
-                                DWORD64 value) {
-  ASSERT1(full_key_name);
-
-  return SetValueStaticHelper(full_key_name, value_name, REG_QWORD, &value);
-}
-
-inline HRESULT RegKey::SetValue(const TCHAR* full_key_name,
-                                const TCHAR* value_name,
-                                float value) {
-  ASSERT1(full_key_name);
-
-  return SetValueStaticHelper(full_key_name,
-                              value_name,
-                              REG_BINARY,
-                              &value,
-                              sizeof(value));
-}
-
-inline HRESULT RegKey::SetValue(const TCHAR* full_key_name,
-                                const TCHAR* value_name,
-                                double value) {
-  ASSERT1(full_key_name);
-
-  return SetValueStaticHelper(full_key_name,
-                              value_name,
-                              REG_BINARY,
-                              &value,
-                              sizeof(value));
-}
-
-inline HRESULT RegKey::SetValue(const TCHAR* full_key_name,
-                                const TCHAR* value_name,
-                                const TCHAR* value) {
-  ASSERT1(full_key_name);
-  ASSERT1(value);
-
-  return SetValueStaticHelper(full_key_name,
-                              value_name,
-                              REG_SZ,
-                              const_cast<TCHAR*>(value));
-}
-
-inline HRESULT RegKey::SetValue(const TCHAR* full_key_name,
-                                const TCHAR* value_name,
-                                const byte* value,
-                                DWORD byte_count) {
-  ASSERT1(full_key_name);
-
-  return SetValueStaticHelper(full_key_name, value_name, REG_BINARY,
-                              const_cast<byte*>(value), byte_count);
-}
-
-inline HRESULT RegKey::SetValueMultiSZ(const TCHAR* full_key_name,
-                                       const TCHAR* value_name,
-                                       const byte* value,
-                                       DWORD byte_count) {
-  ASSERT1(full_key_name);
-
-  return SetValueStaticHelper(full_key_name, value_name, REG_MULTI_SZ,
-                              const_cast<byte*>(value), byte_count);
-}
-
-inline HRESULT RegKey::SetValueExpandSZ(const TCHAR* full_key_name,
-                                        const TCHAR* value_name,
-                                        const TCHAR* value) {
-  ASSERT1(full_key_name);
-  ASSERT1(value);
-
-  return SetValueStaticHelper(full_key_name,
-                              value_name,
-                              REG_EXPAND_SZ,
-                              const_cast<TCHAR*>(value));
-}
-
-// GETTERS static versions
-inline HRESULT RegKey::GetValue(const TCHAR* full_key_name,
-                                const TCHAR* value_name,
-                                DWORD* value) {
-  ASSERT1(full_key_name);
-  ASSERT1(value);
-
-  return GetValueStaticHelper(full_key_name, value_name, REG_DWORD, value);
-}
-
-inline HRESULT RegKey::GetValue(const TCHAR* full_key_name,
-                                const TCHAR* value_name,
-                                DWORD64* value) {
-  ASSERT1(full_key_name);
-  ASSERT1(value);
-
-  return GetValueStaticHelper(full_key_name, value_name, REG_QWORD, value);
-}
-
-inline HRESULT RegKey::GetValue(const TCHAR* full_key_name,
-                                const TCHAR* value_name,
-                                float* value) {
-  ASSERT1(value);
-  ASSERT1(value_name);
-  ASSERT1(full_key_name);
-
-  DWORD byte_count = 0;
-  byte* buffer = NULL;
-  HRESULT hr = GetValueStaticHelper(full_key_name,
-                                    value_name,
-                                    REG_BINARY,
-                                    &buffer,
-                                    &byte_count);
-  scoped_array<byte> free_buffer(buffer);
-
-  if (SUCCEEDED(hr)) {
-    if (byte_count == sizeof(*value)) {
-      ::CopyMemory(value, buffer, sizeof(*value));
-    } else {
-      UTIL_LOG(LEVEL_ERROR, (_T("[RegKey::GetValue]")
-                             _T("[size mismatches for float value][%s\\%s]"),
-                             full_key_name, value_name));
-      return HRESULT_FROM_WIN32(ERROR_DATATYPE_MISMATCH);
-    }
-  }
-
-  return hr;
-}
-
-inline HRESULT RegKey::GetValue(const TCHAR* full_key_name,
-                                const TCHAR* value_name,
-                                double* value) {
-  ASSERT1(value);
-  ASSERT1(value_name);
-  ASSERT1(full_key_name);
-
-  DWORD byte_count = 0;
-  byte* buffer = NULL;
-  HRESULT hr = GetValueStaticHelper(full_key_name,
-                                    value_name,
-                                    REG_BINARY,
-                                    &buffer,
-                                    &byte_count);
-  scoped_array<byte> free_buffer(buffer);
-
-  if (SUCCEEDED(hr)) {
-    if (byte_count == sizeof(*value)) {
-      ::CopyMemory(value, buffer, sizeof(*value));
-    } else {
-      UTIL_LOG(LEVEL_ERROR, (_T("[RegKey::GetValue]")
-                             _T("[size mismatches for double value][%s\\%s]"),
-                             full_key_name, value_name));
-      return HRESULT_FROM_WIN32(ERROR_DATATYPE_MISMATCH);
-    }
-  }
-
-  return hr;
-}
-
-inline HRESULT RegKey::GetValue(const TCHAR* full_key_name,
-                                const TCHAR* value_name,
-                                TCHAR** value) {
-  ASSERT1(full_key_name);
-  ASSERT1(value);
-
-  return GetValueStaticHelper(full_key_name, value_name, REG_SZ, value);
-}
-
-inline HRESULT RegKey::GetValue(const TCHAR* full_key_name,
-                                const TCHAR* value_name,
-                                CString* value) {
-  ASSERT1(full_key_name);
-  ASSERT1(value);
-
-  TCHAR* buffer = NULL;
-  HRESULT hr = RegKey::GetValue(full_key_name, value_name, &buffer);
-  value->SetString(buffer);
-  delete [] buffer;
-  return hr;
-}
-
-inline HRESULT RegKey::GetValue(const TCHAR* full_key_name,
-                                const TCHAR* value_name,
-                                std::vector<CString>* value) {
-  ASSERT1(full_key_name);
-  ASSERT1(value);
-
-  return GetValueStaticHelper(full_key_name, value_name, REG_MULTI_SZ, value);
-}
-
-inline HRESULT RegKey::GetValue(const TCHAR* full_key_name,
-                                const TCHAR* value_name,
-                                byte** value,
-                                DWORD* byte_count) {
-  ASSERT1(full_key_name);
-  ASSERT1(value);
-  ASSERT1(byte_count);
-
-  return GetValueStaticHelper(full_key_name,
-                              value_name,
-                              REG_BINARY,
-                              value,
-                              byte_count);
-}
-
-template<typename T>
-HRESULT RegKey::GetValue(const TCHAR* full_key_names[],
-                         int key_names_length,
-                         const TCHAR* value_name,
-                         T* value) {
-  HRESULT hr = S_OK;
-  for (int i = 0; i < key_names_length; ++i) {
-    hr = GetValue(full_key_names[i], value_name, value);
-    if (SUCCEEDED(hr)) {
-      return hr;
-    }
-  }
-  return hr;
-}
-
-// Rename a named value.
-inline HRESULT RegKey::RenameValue(const TCHAR * full_key_name,
-                                   const TCHAR * old_value_name,
-                                   const TCHAR * new_value_name) {
-  ASSERT1(full_key_name);
-
-  RegKey reg_key;
-  HRESULT hr = reg_key.Open(full_key_name);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return reg_key.RenameValue(old_value_name, new_value_name);
-}
-
-inline HRESULT RegKey::CopyValue(const TCHAR * full_from_key_name,
-                                 const TCHAR * full_to_key_name,
-                                 const TCHAR * value_name) {
-  return CopyValue(full_from_key_name,
-                   value_name,
-                   full_to_key_name,
-                   value_name);
-}
-
-// DELETE
-inline HRESULT RegKey::DeleteSubKey(const TCHAR* key_name) {
-  ASSERT1(key_name);
-  ASSERT1(h_key_);
-
-  LONG res = ::RegDeleteKey(h_key_, key_name);
-  HRESULT hr = HRESULT_FROM_WIN32(res);
-  if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
-      hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)) {
-    hr = S_FALSE;
-  }
-  return hr;
-}
-
-inline HRESULT RegKey::DeleteValue(const TCHAR* value_name) const {
-  ASSERT1(value_name);
-  ASSERT1(h_key_);
-
-  LONG res = ::RegDeleteValue(h_key_, value_name);
-  HRESULT hr = HRESULT_FROM_WIN32(res);
-  if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
-      hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)) {
-    hr = S_FALSE;
-  }
-  return hr;
-}
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_REG_KEY_H_
-
diff --git a/base/reg_key_unittest.cc b/base/reg_key_unittest.cc
deleted file mode 100644
index 31c5b6c..0000000
--- a/base/reg_key_unittest.cc
+++ /dev/null
@@ -1,918 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/reg_key.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-#define kStTestRkeyRelativeBase   _T("Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME _T("\\UnitTest")
-#define kStTestRkeyBase   _T("HKCU\\") kStTestRkeyRelativeBase
-#define kStRkey1Name      _T("TEST")
-#define kStRkey1          kStTestRkeyBase _T("\\") kStRkey1Name
-#define kRkey1            kStTestRkeyRelativeBase _T("\\") kStRkey1Name
-#define kStRkey2          kStTestRkeyBase _T("\\TEST2")
-#define kStRkey3          kStTestRkeyBase _T("\\TEST3")
-#define kRkey1SubkeyName  _T("subkey_test")
-#define kRkey1Subkey      kRkey1 _T("\\") kRkey1SubkeyName
-#define kStRkey1Subkey    kStRkey1 _T("\\") kRkey1SubkeyName
-
-// NON - STATIC
-
-#define kValNameInt          _T("Int32 Value")
-#define kRenameValNameInt    _T("Renamed Int32 Value")
-#define kIntVal              (DWORD)20
-#define kIntVal2             (DWORD)30
-
-#define kValNameInt64        _T("Int64 Value")
-#define kIntVal64            (DWORD64)40
-#define kIntVal642           (DWORD64)50
-
-#define kValNameStr          _T("Str Value")
-#define kStrVal              _T("Some string data 1")
-#define kStrVal2             _T("Some string data 2")
-
-#define kValNameBinary       _T("Binary Value")
-#define kBinaryVal           "Some binary data abcdefghi 1"
-#define kBinaryVal2          "Some binary data abcdefghi 2"
-
-// STATIC
-
-#define kStValNameInt        _T("Static Int32 Value")
-#define kStIntVal            (DWORD)60
-
-#define kStValNameInt64      _T("Static Int64 Value")
-#define kStIntVal64          (DWORD64)80
-
-#define kStValNameFloat      _T("Static Float Value")
-#define kStFloatVal          (static_cast<float>(12.3456789))
-
-#define kStValNameDouble     _T("Static Double Value")
-#define kStDoubleVal         (static_cast<double>(98.7654321))
-
-#define kStValNameStr        _T("Static Str Value")
-#define kRenameStValNameStr  _T("Renamed Static Str Value")
-#define kStStrVal            _T("Some static string data 2")
-
-#define kStValNameBinary     _T("Static Binary Value")
-#define kStBinaryVal         "Some static binary data abcdefghi 2"
-
-// Test the private member functions of RegKey
-class RegKeyTestClass : public testing::Test {
- protected:
-  static const HKEY GetHKey(const RegKey& reg) {
-    return reg.h_key_;
-  }
-
-  static CString GetParentKeyInfo(CString* key_name) {
-    return RegKey::GetParentKeyInfo(key_name);
-  }
-};
-
-class RegKeyCleanupTestKeyTest : public testing::Test {
- protected:
-  virtual void SetUp() {
-    EXPECT_SUCCEEDED(RegKey::DeleteKey(kStTestRkeyBase));
-  }
-
-  virtual void TearDown() {
-    EXPECT_SUCCEEDED(RegKey::DeleteKey(kStTestRkeyBase));
-  }
-
-  RegKey key_;
-};
-
-// Make sure the RegKey is nice and clean when we first initialize it
-TEST_F(RegKeyTestClass, Init) {
-  // Make a new RegKey object so we can test its pristine state
-  RegKey reg;
-
-  ASSERT_TRUE(GetHKey(reg) == NULL);
-}
-
-// Make sure the helper functions work
-TEST_F(RegKeyTestClass, Helper) {
-  // Dud items cause NULL
-  CString temp_key;
-
-  // RegKey::GetRootKeyInfo turns a string into the HKEY and subtree value
-
-  // Try out some dud values
-  temp_key = _T("");
-  ASSERT_TRUE(RegKey::GetRootKeyInfo(&temp_key) == NULL);
-  ASSERT_STREQ(temp_key, _T(""));
-
-  temp_key = _T("a");
-  ASSERT_TRUE(RegKey::GetRootKeyInfo(&temp_key) == NULL);
-  ASSERT_STREQ(temp_key, _T(""));
-
-  // The basics
-  temp_key = _T("HKLM\\a");
-  ASSERT_EQ(RegKey::GetRootKeyInfo(&temp_key), HKEY_LOCAL_MACHINE);
-  ASSERT_STREQ(temp_key, _T("a"));
-
-  temp_key = _T("HKEY_LOCAL_MACHINE\\a");
-  ASSERT_EQ(RegKey::GetRootKeyInfo(&temp_key), HKEY_LOCAL_MACHINE);
-  ASSERT_STREQ(temp_key, _T("a"));
-
-  temp_key = _T("HKCU\\a");
-  ASSERT_EQ(RegKey::GetRootKeyInfo(&temp_key), HKEY_CURRENT_USER);
-  ASSERT_STREQ(temp_key, _T("a"));
-
-  temp_key = _T("HKEY_CURRENT_USER\\a");
-  ASSERT_EQ(RegKey::GetRootKeyInfo(&temp_key), HKEY_CURRENT_USER);
-  ASSERT_STREQ(temp_key, _T("a"));
-
-  temp_key = _T("HKU\\a");
-  ASSERT_EQ(RegKey::GetRootKeyInfo(&temp_key), HKEY_USERS);
-  ASSERT_STREQ(temp_key, _T("a"));
-
-  temp_key = _T("HKEY_USERS\\a");
-  ASSERT_EQ(RegKey::GetRootKeyInfo(&temp_key), HKEY_USERS);
-  ASSERT_STREQ(temp_key, _T("a"));
-
-  temp_key = _T("HKCR\\a");
-  ASSERT_EQ(RegKey::GetRootKeyInfo(&temp_key), HKEY_CLASSES_ROOT);
-  ASSERT_STREQ(temp_key, _T("a"));
-
-  temp_key = _T("HKEY_CLASSES_ROOT\\a");
-  ASSERT_EQ(RegKey::GetRootKeyInfo(&temp_key), HKEY_CLASSES_ROOT);
-  ASSERT_STREQ(temp_key, _T("a"));
-
-  // Make sure it is case insensitive
-  temp_key = _T("hkcr\\a");
-  ASSERT_EQ(RegKey::GetRootKeyInfo(&temp_key), HKEY_CLASSES_ROOT);
-  ASSERT_STREQ(temp_key, _T("a"));
-
-  temp_key = _T("hkey_CLASSES_ROOT\\a");
-  ASSERT_EQ(RegKey::GetRootKeyInfo(&temp_key), HKEY_CLASSES_ROOT);
-  ASSERT_STREQ(temp_key, _T("a"));
-
-  // Test out temp_GetParentKeyInfo
-
-  // dud cases
-  temp_key = _T("");
-  ASSERT_STREQ(GetParentKeyInfo(&temp_key), _T(""));
-  ASSERT_STREQ(temp_key, _T(""));
-
-  temp_key = _T("a");
-  ASSERT_STREQ(GetParentKeyInfo(&temp_key), _T(""));
-  ASSERT_STREQ(temp_key, _T("a"));
-
-  temp_key = _T("a\\b");
-  ASSERT_STREQ(GetParentKeyInfo(&temp_key), _T("a"));
-  ASSERT_STREQ(temp_key, _T("b"));
-
-  temp_key = _T("\\b");
-  ASSERT_STREQ(GetParentKeyInfo(&temp_key), _T(""));
-  ASSERT_STREQ(temp_key, _T("b"));
-
-
-  // Some regular cases
-  temp_key = _T("HKEY_CLASSES_ROOT\\moon");
-  ASSERT_STREQ(GetParentKeyInfo(&temp_key), _T("HKEY_CLASSES_ROOT"));
-  ASSERT_STREQ(temp_key, _T("moon"));
-
-  temp_key = _T("HKEY_CLASSES_ROOT\\moon\\doggy");
-  ASSERT_STREQ(GetParentKeyInfo(&temp_key),
-               _T("HKEY_CLASSES_ROOT\\moon"));
-  ASSERT_STREQ(temp_key, _T("doggy"));
-}
-
-
-TEST(RegKeyTest, RegKey) {
-  //
-  // PRIVATE MEMBER WHITE BOX TESTS
-  //
-  RegKeyWithChangeEvent r_key;
-  bool bool_res = false;
-  HRESULT hr = E_FAIL;
-  DWORD int_val = 0;
-  DWORD64 int64_val = 0;
-  time64 t = 0;
-  float float_val = 0;
-  double double_val = 0;
-  TCHAR * str_val = NULL;
-  byte * binary_val = NULL;
-  DWORD byte_count = 0;
-
-  // Just in case...
-  // make sure the no test key residue is left from previous aborted runs
-  hr = RegKey::DeleteKey(kStTestRkeyBase);
-
-  // first test the non-static version
-
-  // create a reg key
-  hr = r_key.Create(HKEY_CURRENT_USER, kRkey1);
-  ASSERT_SUCCEEDED(hr);
-
-  // do the create twice - it should return the already created one
-  hr = r_key.Create(HKEY_CURRENT_USER, kRkey1);
-  ASSERT_SUCCEEDED(hr);
-
-  // now do an open - should work just fine
-  hr = r_key.Open(HKEY_CURRENT_USER, kRkey1);
-  ASSERT_SUCCEEDED(hr);
-
-  // get an in-existent value
-  hr = r_key.GetValue(kValNameInt, &int_val);
-  ASSERT_EQ(hr, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND));
-
-  // get an in-existent value type
-  DWORD value_type = REG_NONE;
-  hr = r_key.GetValueType(kValNameInt, &value_type);
-  ASSERT_EQ(hr, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND));
-
-  // set-up an event to watch for changes
-  hr = r_key.SetupEvent(TRUE,
-                        REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_CHANGE_LAST_SET);
-  ASSERT_SUCCEEDED(hr);
-  HANDLE change_event = r_key.change_event();
-  ASSERT_EQ(::WaitForSingleObject(change_event, 0), WAIT_TIMEOUT);
-
-  // set and get some values and verify that the handle gets signaled
-
-  // set an INT 32
-  hr = r_key.SetValue(kValNameInt, kIntVal);
-  ASSERT_SUCCEEDED(hr);
-
-  hr = r_key.GetValueType(kValNameInt, &value_type);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_EQ(REG_DWORD, value_type);
-  hr = RegKey::GetValueType(kStRkey1, kValNameInt, &value_type);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_EQ(REG_DWORD, value_type);
-
-  // verify that we got the change and that the event got reset appropriately
-  // and set-up the notification again (use the actual event this time)
-  ASSERT_EQ(::WaitForSingleObject(change_event, 0), WAIT_OBJECT_0);
-  hr = r_key.SetupEvent(TRUE,
-                        REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_CHANGE_LAST_SET);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_FALSE(r_key.HasChangeOccurred());
-
-  // check that the value exists
-  bool_res = r_key.HasValue(kValNameInt);
-  ASSERT_TRUE(bool_res);
-  // No change expected on a read
-  ASSERT_FALSE(r_key.HasChangeOccurred());
-
-  // read it back
-  hr = r_key.GetValue(kValNameInt, &int_val);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_EQ(int_val, kIntVal);
-  // No change expected on a read
-  ASSERT_FALSE(r_key.HasChangeOccurred());
-
-  // set it again!
-  hr = r_key.SetValue(kValNameInt, kIntVal2);
-  ASSERT_SUCCEEDED(hr);
-  // verify that we got the change and that the event got reset appropriately
-  // and set-up the notification again
-  ASSERT_TRUE(r_key.HasChangeOccurred());
-  hr = r_key.SetupEvent(TRUE,
-                        REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_CHANGE_LAST_SET);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_FALSE(r_key.HasChangeOccurred());
-
-  // read it again
-  hr = r_key.GetValue(kValNameInt, &int_val);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_EQ(int_val, kIntVal2);
-  // No change expected on a read
-  ASSERT_FALSE(r_key.HasChangeOccurred());
-
-  // delete the value
-  hr = r_key.DeleteValue(kValNameInt);
-  ASSERT_SUCCEEDED(hr);
-  // verify that we got the change
-  ASSERT_TRUE(r_key.HasChangeOccurred());
-
-  // check that the value is gone
-  bool_res = r_key.HasValue(kValNameInt);
-  ASSERT_FALSE(bool_res);
-
-  // set an INT 64
-  hr = r_key.SetValue(kValNameInt64, kIntVal64);
-  ASSERT_SUCCEEDED(hr);
-
-  // check that the value exists
-  bool_res = r_key.HasValue(kValNameInt64);
-  ASSERT_TRUE(bool_res);
-
-  // read it back
-  hr = r_key.GetValue(kValNameInt64, &int64_val);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_EQ(int64_val, kIntVal64);
-
-  // delete the value
-  hr = r_key.DeleteValue(kValNameInt64);
-  ASSERT_SUCCEEDED(hr);
-
-  // check that the value is gone
-  bool_res = r_key.HasValue(kValNameInt64);
-  ASSERT_FALSE(bool_res);
-
-  // set a string
-  hr = r_key.SetValue(kValNameStr, kStrVal);
-  ASSERT_SUCCEEDED(hr);
-
-  // check that the value exists
-  bool_res = r_key.HasValue(kValNameStr);
-  ASSERT_TRUE(bool_res);
-
-  // read it back
-  hr = r_key.GetValue(kValNameStr, &str_val);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_STREQ(str_val, kStrVal);
-  delete [] str_val;
-
-  // set it again
-  hr = r_key.SetValue(kValNameStr, kStrVal2);
-  ASSERT_SUCCEEDED(hr);
-
-  // read it again
-  hr = r_key.GetValue(kValNameStr, &str_val);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_STREQ(str_val, kStrVal2);
-  delete [] str_val;
-
-  // delete the value
-  hr = r_key.DeleteValue(kValNameStr);
-  ASSERT_SUCCEEDED(hr);
-
-  // check that the value is gone
-  bool_res = r_key.HasValue(kValNameInt);
-  ASSERT_FALSE(bool_res);
-
-  // set a binary value
-  hr = r_key.SetValue(kValNameBinary, (const byte *)kBinaryVal,
-                      sizeof(kBinaryVal)-1);
-  ASSERT_SUCCEEDED(hr);
-
-  // check that the value exists
-  bool_res = r_key.HasValue(kValNameBinary);
-  ASSERT_TRUE(bool_res);
-
-  // read it back
-  hr = r_key.GetValue(kValNameBinary, &binary_val, &byte_count);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_EQ(0, memcmp(binary_val, kBinaryVal, sizeof(kBinaryVal)-1));
-  delete [] binary_val;
-
-  // set it again
-  hr = r_key.SetValue(kValNameBinary, (const byte *)kBinaryVal2,
-                      sizeof(kBinaryVal)-1);
-  ASSERT_SUCCEEDED(hr);
-
-  // read it again
-  hr = r_key.GetValue(kValNameBinary, &binary_val, &byte_count);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_EQ(0, memcmp(binary_val, kBinaryVal2, sizeof(kBinaryVal2)-1));
-  delete [] binary_val;
-
-  // delete the value
-  hr = r_key.DeleteValue(kValNameBinary);
-  ASSERT_SUCCEEDED(hr);
-
-  // check that the value is gone
-  bool_res = r_key.HasValue(kValNameBinary);
-  ASSERT_FALSE(bool_res);
-
-  // set some values and check the total count
-
-  // set an INT 32
-  hr = r_key.SetValue(kValNameInt, kIntVal);
-  ASSERT_SUCCEEDED(hr);
-
-  // set an INT 64
-  hr = r_key.SetValue(kValNameInt64, kIntVal64);
-  ASSERT_SUCCEEDED(hr);
-
-  // set a string
-  hr = r_key.SetValue(kValNameStr, kStrVal);
-  ASSERT_SUCCEEDED(hr);
-
-  hr = r_key.GetValueType(kValNameStr, &value_type);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_EQ(REG_SZ, value_type);
-  hr = RegKey::GetValueType(kStRkey1, kValNameStr, &value_type);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_EQ(REG_SZ, value_type);
-
-  // set a binary value
-  hr = r_key.SetValue(kValNameBinary, (const byte *)kBinaryVal,
-                      sizeof(kBinaryVal)-1);
-  ASSERT_SUCCEEDED(hr);
-
-  // get the value count
-  uint32 value_count = r_key.GetValueCount();
-  ASSERT_EQ(value_count, 4);
-
-  // check the value names
-  CString value_name;
-  DWORD type;
-
-  hr = r_key.GetValueNameAt(0, &value_name, &type);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_EQ(value_name, kValNameInt);
-  ASSERT_EQ(type, REG_DWORD);
-
-  hr = r_key.GetValueNameAt(1, &value_name, &type);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_EQ(value_name, kValNameInt64);
-  ASSERT_EQ(type, REG_QWORD);
-
-  hr = r_key.GetValueNameAt(2, &value_name, &type);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_EQ(value_name, kValNameStr);
-  ASSERT_EQ(type, REG_SZ);
-
-  hr = r_key.GetValueNameAt(3, &value_name, &type);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_EQ(value_name, kValNameBinary);
-  ASSERT_EQ(type, REG_BINARY);
-
-  // check that there are no more values
-  hr = r_key.GetValueNameAt(4, &value_name, &type);
-  ASSERT_FAILED(hr);
-
-  uint32 subkey_count = r_key.GetSubkeyCount();
-  ASSERT_EQ(subkey_count, 0);
-
-  RegKey temp_key;
-
-  // now create a subkey and make sure we can get the name
-  hr = temp_key.Create(HKEY_CURRENT_USER, kRkey1Subkey);
-  ASSERT_SUCCEEDED(hr);
-
-  // check the subkey exists
-  bool_res = r_key.HasSubkey(kRkey1SubkeyName);
-  ASSERT_TRUE(bool_res);
-
-  // check the name
-  subkey_count = r_key.GetSubkeyCount();
-  ASSERT_EQ(subkey_count, 1);
-
-  CString subkey_name;
-  hr = r_key.GetSubkeyNameAt(0, &subkey_name);
-  ASSERT_EQ(subkey_name, kRkey1SubkeyName);
-
-  // verify that the event handle remained the same throughout everything
-  ASSERT_EQ(change_event, r_key.change_event());
-
-  // close this key
-  r_key.Close();
-
-  // whack the whole key
-  hr = RegKey::DeleteKey(kStTestRkeyBase);
-  ASSERT_SUCCEEDED(hr);
-
-  // STATIC
-  // now set a different value using the static versions
-
-  // get an in-existent value from an un-existent key
-  hr = RegKey::GetValue(kStRkey1, kStValNameInt, &int_val);
-  ASSERT_EQ(hr, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND));
-
-  // set int32
-  hr = RegKey::SetValue(kStRkey1, kStValNameInt, kStIntVal);
-  ASSERT_SUCCEEDED(hr);
-
-  // check that the value exists
-  bool_res = RegKey::HasValue(kStRkey1, kStValNameInt);
-  ASSERT_TRUE(bool_res);
-
-  // get an in-existent value from an existent key
-  hr = RegKey::GetValue(kStRkey1, _T("bogus"), &int_val);
-  ASSERT_EQ(hr, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND));
-
-  // read it back
-  hr = RegKey::GetValue(kStRkey1, kStValNameInt, &int_val);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_EQ(int_val, kStIntVal);
-
-  // delete the value
-  hr = RegKey::DeleteValue(kStRkey1, kStValNameInt);
-  ASSERT_SUCCEEDED(hr);
-
-  // check that the value is gone
-  bool_res = RegKey::HasValue(kStRkey1, kStValNameInt);
-  ASSERT_FALSE(bool_res);
-
-
-  // set int64
-  hr = RegKey::SetValue(kStRkey1, kStValNameInt64, kStIntVal64);
-  ASSERT_SUCCEEDED(hr);
-
-  // check that the value exists
-  bool_res = RegKey::HasValue(kStRkey1, kStValNameInt64);
-  ASSERT_TRUE(bool_res);
-
-  // read it back
-  hr = RegKey::GetValue(kStRkey1, kStValNameInt64, &int64_val);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_EQ(int64_val, kStIntVal64);
-
-  // read it back to test time64
-  bool limited_value;
-  hr = GetLimitedTimeValue(kStRkey1, kStValNameInt64,  kStIntVal64 + 10, &t,
-                           &limited_value);
-  ASSERT_SUCCEEDED(hr);
-  EXPECT_FALSE(limited_value);
-  ASSERT_EQ(t, kStIntVal64);
-  hr = GetLimitedTimeValue(kStRkey1, kStValNameInt64,  kStIntVal64 - 10, &t,
-                           &limited_value);
-  EXPECT_TRUE(limited_value);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_EQ(t, kStIntVal64 - 10);
-  // Verify that the GetValue permanently made the value lower
-  hr = GetLimitedTimeValue(kStRkey1, kStValNameInt64,  kStIntVal64, &t,
-                           &limited_value);
-  EXPECT_FALSE(limited_value);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_EQ(t, kStIntVal64 - 10);
-
-  // delete the value
-  hr = RegKey::DeleteValue(kStRkey1, kStValNameInt64);
-  ASSERT_SUCCEEDED(hr);
-
-  // check that the value is gone
-  bool_res = RegKey::HasValue(kStRkey1, kStValNameInt64);
-  ASSERT_FALSE(bool_res);
-
-  // set float
-  hr = RegKey::SetValue(kStRkey1, kStValNameFloat, kStFloatVal);
-  ASSERT_SUCCEEDED(hr);
-
-  // check that the value exists
-  bool_res = RegKey::HasValue(kStRkey1, kStValNameFloat);
-  ASSERT_TRUE(bool_res);
-
-  // read it back
-  hr = RegKey::GetValue(kStRkey1, kStValNameFloat, &float_val);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_EQ(float_val, kStFloatVal);
-
-  // delete the value
-  hr = RegKey::DeleteValue(kStRkey1, kStValNameFloat);
-  ASSERT_SUCCEEDED(hr);
-
-  // check that the value is gone
-  bool_res = RegKey::HasValue(kStRkey1, kStValNameFloat);
-  ASSERT_FALSE(bool_res);
-  hr = RegKey::GetValue(kStRkey1, kStValNameFloat, &float_val);
-  ASSERT_FAILED(hr);
-
-
-  // set double
-  hr = RegKey::SetValue(kStRkey1, kStValNameDouble, kStDoubleVal);
-  ASSERT_SUCCEEDED(hr);
-
-  // check that the value exists
-  bool_res = RegKey::HasValue(kStRkey1, kStValNameDouble);
-  ASSERT_TRUE(bool_res);
-
-  // read it back
-  hr = RegKey::GetValue(kStRkey1, kStValNameDouble, &double_val);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_EQ(double_val, kStDoubleVal);
-
-  // delete the value
-  hr = RegKey::DeleteValue(kStRkey1, kStValNameDouble);
-  ASSERT_SUCCEEDED(hr);
-
-  // check that the value is gone
-  bool_res = RegKey::HasValue(kStRkey1, kStValNameDouble);
-  ASSERT_FALSE(bool_res);
-  hr = RegKey::GetValue(kStRkey1, kStValNameDouble, &double_val);
-  ASSERT_FAILED(hr);
-
-  // set string
-  hr = RegKey::SetValue(kStRkey1, kStValNameStr, kStStrVal);
-  ASSERT_SUCCEEDED(hr);
-
-  // check that the value exists
-  bool_res = RegKey::HasValue(kStRkey1, kStValNameStr);
-  ASSERT_TRUE(bool_res);
-
-  // read it back
-  hr = RegKey::GetValue(kStRkey1, kStValNameStr, &str_val);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_STREQ(str_val, kStStrVal);
-  delete [] str_val;
-
-  // get an in-existent value from an existent key
-  hr = RegKey::GetValue(kStRkey1, _T("bogus"), &str_val);
-  ASSERT_EQ(hr, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND));
-
-  // delete the value
-  hr = RegKey::DeleteValue(kStRkey1, kStValNameStr);
-  ASSERT_SUCCEEDED(hr);
-
-  // check that the value is gone
-  bool_res = RegKey::HasValue(kStRkey1, kStValNameStr);
-  ASSERT_FALSE(bool_res);
-
-  // set binary
-  hr = RegKey::SetValue(kStRkey1, kStValNameBinary, (const byte *)kStBinaryVal,
-                        sizeof(kStBinaryVal)-1);
-  ASSERT_SUCCEEDED(hr);
-
-  // check that the value exists
-  bool_res = RegKey::HasValue(kStRkey1, kStValNameBinary);
-  ASSERT_TRUE(bool_res);
-
-  // read it back
-  hr = RegKey::GetValue(kStRkey1, kStValNameBinary, &binary_val, &byte_count);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_EQ(0, memcmp(binary_val, kStBinaryVal, sizeof(kStBinaryVal)-1));
-  delete [] binary_val;
-
-  // delete the value
-  hr = RegKey::DeleteValue(kStRkey1, kStValNameBinary);
-  ASSERT_SUCCEEDED(hr);
-
-  // check that the value is gone
-  bool_res = RegKey::HasValue(kStRkey1, kStValNameBinary);
-  ASSERT_FALSE(bool_res);
-
-  // special case - set a binary value with length 0
-  hr = RegKey::SetValue(kStRkey1, kStValNameBinary,
-                        (const byte *)kStBinaryVal, 0);
-  ASSERT_SUCCEEDED(hr);
-
-  // check that the value exists
-  bool_res = RegKey::HasValue(kStRkey1, kStValNameBinary);
-  ASSERT_TRUE(bool_res);
-
-  // read it back
-  hr = RegKey::GetValue(kStRkey1, kStValNameBinary, &binary_val, &byte_count);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_EQ(byte_count, 0);
-  ASSERT_TRUE(binary_val == NULL);
-  delete [] binary_val;
-
-  // delete the value
-  hr = RegKey::DeleteValue(kStRkey1, kStValNameBinary);
-  ASSERT_SUCCEEDED(hr);
-
-  // check that the value is gone
-  bool_res = RegKey::HasValue(kStRkey1, kStValNameBinary);
-  ASSERT_FALSE(bool_res);
-
-  // special case - set a NULL binary value
-  hr = RegKey::SetValue(kStRkey1, kStValNameBinary, NULL, 100);
-  ASSERT_SUCCEEDED(hr);
-
-  // check that the value exists
-  bool_res = RegKey::HasValue(kStRkey1, kStValNameBinary);
-  ASSERT_TRUE(bool_res);
-
-  // read it back
-  hr = RegKey::GetValue(kStRkey1, kStValNameBinary, &binary_val, &byte_count);
-  ASSERT_SUCCEEDED(hr);
-  ASSERT_EQ(byte_count, 0);
-  ASSERT_TRUE(binary_val == NULL);
-  delete [] binary_val;
-
-  // delete the value
-  hr = RegKey::DeleteValue(kStRkey1, kStValNameBinary);
-  ASSERT_SUCCEEDED(hr);
-
-  // check that the value is gone
-  bool_res = RegKey::HasValue(kStRkey1, kStValNameBinary);
-  ASSERT_FALSE(bool_res);
-
-  // whack the whole key
-
-  hr = RegKey::DeleteKey(kStTestRkeyBase);
-  ASSERT_SUCCEEDED(hr);
-}
-
-// RegKey::GetValue changes the output CString when errors occur.
-TEST_F(RegKeyTestClass, ChangesStringOnErrors) {
-  CString string_val = _T("foo");
-  EXPECT_FAILED(RegKey::GetValue(_T("HCKU"), _T("no_such_value"), &string_val));
-  ASSERT_TRUE(string_val.IsEmpty());
-}
-
-TEST_F(RegKeyCleanupTestKeyTest, CreateKeys) {
-  // 3 keys specified but the count is two.
-  const TCHAR* keys[] = {kStRkey1, kStRkey2, kStRkey3};
-  ASSERT_SUCCEEDED(RegKey::CreateKeys(keys, 2));
-
-  EXPECT_TRUE(RegKey::HasKey(kStRkey1));
-  EXPECT_TRUE(RegKey::HasKey(kStRkey2));
-  EXPECT_FALSE(RegKey::HasKey(kStRkey3));
-}
-
-TEST_F(RegKeyCleanupTestKeyTest, CreateKey) {
-  ASSERT_SUCCEEDED(RegKey::CreateKey(kStRkey1));
-
-  EXPECT_TRUE(RegKey::HasKey(kStRkey1));
-}
-
-TEST_F(RegKeyCleanupTestKeyTest, RenameValue) {
-  RegKey reg_key;
-  ASSERT_SUCCEEDED(reg_key.Create(HKEY_CURRENT_USER, kRkey1));
-  ASSERT_SUCCEEDED(reg_key.SetValue(kValNameInt, kIntVal));
-  ASSERT_TRUE(reg_key.HasValue(kValNameInt));
-
-  ASSERT_SUCCEEDED(reg_key.RenameValue(kValNameInt, kRenameValNameInt));
-  ASSERT_FALSE(reg_key.HasValue(kValNameInt));
-
-  DWORD int_val = 0;
-  EXPECT_SUCCEEDED(reg_key.GetValue(kRenameValNameInt, &int_val));
-  EXPECT_EQ(kIntVal, int_val);
-
-  EXPECT_SUCCEEDED(reg_key.Close());
-}
-
-TEST_F(RegKeyCleanupTestKeyTest, RenameValueStatic) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(kStRkey1, kStValNameStr, kStStrVal));
-  ASSERT_TRUE(RegKey::HasValue(kStRkey1, kStValNameStr));
-
-  RegKey::RenameValue(kStRkey1, kStValNameStr, kRenameStValNameStr);
-  ASSERT_FALSE(RegKey::HasValue(kStRkey1, kStValNameStr));
-
-  CString str_val;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kStRkey1, kRenameStValNameStr, &str_val));
-  EXPECT_STREQ(kStStrVal, str_val);
-}
-
-TEST_F(RegKeyCleanupTestKeyTest, CopyValue) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kStRkey1, kStValNameStr, kStStrVal));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kStRkey1, NULL, kStStrVal));
-  EXPECT_TRUE(RegKey::HasValue(kStRkey1, kStValNameStr));
-
-  // Test that CopyValue fails when the to_key does not exist.
-  EXPECT_FALSE(RegKey::HasKey(kStRkey2));
-  EXPECT_FAILED(RegKey::CopyValue(kStRkey1, kStRkey2, kStValNameStr));
-  EXPECT_FALSE(RegKey::HasKey(kStRkey2));
-
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kStRkey2));
-  // Test CopyValue(full_from_key_name, full_to_key_name, value_name).
-  EXPECT_FALSE(RegKey::HasValue(kStRkey2, kStValNameStr));
-  RegKey::CopyValue(kStRkey1, kStRkey2, kStValNameStr);
-  CString str_val;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kStRkey2, kStValNameStr, &str_val));
-  EXPECT_STREQ(kStStrVal, str_val);
-
-  // Test CopyValue to a (Default) value.
-  EXPECT_FALSE(RegKey::HasValue(kStRkey2, NULL));
-  RegKey::CopyValue(kStRkey1, kStRkey2, NULL);
-  str_val.Empty();
-  EXPECT_SUCCEEDED(RegKey::GetValue(kStRkey2, NULL, &str_val));
-  EXPECT_STREQ(kStStrVal, str_val);
-
-  // Test CopyValue(full_from_key_name, from_value_name, full_to_key_name,
-  //                to_value_name).
-  EXPECT_FALSE(RegKey::HasValue(kStRkey2, kRenameStValNameStr));
-  RegKey::CopyValue(kStRkey1, kStValNameStr, kStRkey2, kRenameStValNameStr);
-  str_val.Empty();
-  EXPECT_SUCCEEDED(RegKey::GetValue(kStRkey2, kRenameStValNameStr, &str_val));
-  EXPECT_STREQ(kStStrVal, str_val);
-}
-
-// Delete a key that does not have children.
-
-TEST_F(RegKeyCleanupTestKeyTest, DeleteKey_NoChildren_Recursively) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kStRkey1));
-
-  EXPECT_EQ(S_OK, RegKey::DeleteKey(kStRkey1, true));
-  EXPECT_FALSE(RegKey::HasKey(kStRkey1));
-}
-
-TEST_F(RegKeyCleanupTestKeyTest, DeleteKey_NoChildren_NotRecursively) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kStRkey1));
-
-  EXPECT_EQ(S_OK, RegKey::DeleteKey(kStRkey1, false));
-  EXPECT_FALSE(RegKey::HasKey(kStRkey1));
-}
-
-TEST_F(RegKeyCleanupTestKeyTest, RecurseDeleteSubKey_NoChildren) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kStRkey1));
-  EXPECT_SUCCEEDED(key_.Open(kStTestRkeyBase));
-
-  EXPECT_EQ(S_OK, key_.RecurseDeleteSubKey(kStRkey1Name));
-  EXPECT_FALSE(RegKey::HasKey(kStRkey1));
-}
-
-TEST_F(RegKeyCleanupTestKeyTest, DeleteSubKey_NoChildren) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kStRkey1));
-  EXPECT_SUCCEEDED(key_.Open(kStTestRkeyBase));
-
-  EXPECT_EQ(S_OK, key_.DeleteSubKey(kStRkey1Name));
-  EXPECT_FALSE(RegKey::HasKey(kStRkey1));
-}
-
-// Delete a key that has a child.
-
-TEST_F(RegKeyCleanupTestKeyTest, DeleteKey_WithChild_Recursively) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kStRkey1Subkey));
-
-  EXPECT_EQ(S_OK, RegKey::DeleteKey(kStRkey1, true));
-  EXPECT_FALSE(RegKey::HasKey(kStRkey1));
-  EXPECT_FALSE(RegKey::HasKey(kStRkey1Subkey));
-}
-
-// Deleting a key with children present results in ERROR_ACCESS_DENIED.
-TEST_F(RegKeyCleanupTestKeyTest, DeleteKey_WithChild_NotRecursively) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kStRkey1Subkey));
-
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED),
-            RegKey::DeleteKey(kStRkey1, false));
-  EXPECT_TRUE(RegKey::HasKey(kStRkey1));
-  EXPECT_TRUE(RegKey::HasKey(kStRkey1Subkey));
-}
-
-TEST_F(RegKeyCleanupTestKeyTest, RecurseDeleteSubKey_WithChild) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kStRkey1Subkey));
-  EXPECT_SUCCEEDED(key_.Open(kStTestRkeyBase));
-
-  EXPECT_EQ(S_OK, key_.RecurseDeleteSubKey(kStRkey1Name));
-  EXPECT_FALSE(RegKey::HasKey(kStRkey1));
-  EXPECT_FALSE(RegKey::HasKey(kStRkey1Subkey));
-}
-
-// Deleting a key with children present results in ERROR_ACCESS_DENIED.
-TEST_F(RegKeyCleanupTestKeyTest, DeleteSubKey_WithChild) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kStRkey1Subkey));
-  EXPECT_SUCCEEDED(key_.Open(kStTestRkeyBase));
-
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED),
-            key_.DeleteSubKey(kStRkey1Name));
-  EXPECT_TRUE(RegKey::HasKey(kStRkey1));
-  EXPECT_TRUE(RegKey::HasKey(kStRkey1Subkey));
-}
-
-// Delete a key that does not exist.
-
-TEST_F(RegKeyCleanupTestKeyTest, DeleteKey_KeyDoesNotExist_Recursively) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kStRkey1));
-  EXPECT_FALSE(RegKey::HasKey(kStRkey1Subkey));
-
-  EXPECT_EQ(S_FALSE, RegKey::DeleteKey(kStRkey1Subkey, true));
-  EXPECT_FALSE(RegKey::HasKey(kStRkey1Subkey));
-}
-
-TEST_F(RegKeyCleanupTestKeyTest, DeleteKey_KeyDoesNotExist_NotRecursively) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kStRkey1));
-  EXPECT_FALSE(RegKey::HasKey(kStRkey1Subkey));
-
-  EXPECT_EQ(S_FALSE, RegKey::DeleteKey(kStRkey1Subkey, false));
-  EXPECT_FALSE(RegKey::HasKey(kStRkey1Subkey));
-}
-
-TEST_F(RegKeyCleanupTestKeyTest, RecurseDeleteSubKey_KeyDoesNotExist) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kStRkey1));
-  EXPECT_SUCCEEDED(key_.Open(kStRkey1));
-  EXPECT_FALSE(RegKey::HasKey(kStRkey1Subkey));
-
-  EXPECT_EQ(S_FALSE, key_.RecurseDeleteSubKey(kRkey1SubkeyName));
-  EXPECT_FALSE(RegKey::HasKey(kStRkey1Subkey));
-}
-
-TEST_F(RegKeyCleanupTestKeyTest, DeleteSubKey_KeyDoesNotExist) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kStRkey1));
-  EXPECT_SUCCEEDED(key_.Open(kStRkey1));
-  EXPECT_FALSE(RegKey::HasKey(kStRkey1Subkey));
-
-  EXPECT_EQ(S_FALSE, key_.DeleteSubKey(kRkey1SubkeyName));
-  EXPECT_FALSE(RegKey::HasKey(kStRkey1Subkey));
-}
-
-// Delete a key whose parent does not exist.
-// There is no equivalent test for RecurseDeleteSubKey and DeleteSubKey.
-
-TEST_F(RegKeyCleanupTestKeyTest, DeleteKey_ParentKeyDoesNotExist_Recursively) {
-  EXPECT_FALSE(RegKey::HasKey(kStRkey1));
-
-  EXPECT_EQ(S_FALSE, RegKey::DeleteKey(kStRkey1Subkey, true));
-  EXPECT_FALSE(RegKey::HasKey(kStRkey1Subkey));
-}
-
-TEST_F(RegKeyCleanupTestKeyTest,
-       DeleteKey_ParentKeyDoesNotExist_NotRecursively) {
-  EXPECT_FALSE(RegKey::HasKey(kStRkey1));
-
-  EXPECT_EQ(S_FALSE, RegKey::DeleteKey(kStRkey1Subkey, false));
-  EXPECT_FALSE(RegKey::HasKey(kStRkey1Subkey));
-}
-
-}  // namespace omaha
diff --git a/base/regexp.cc b/base/regexp.cc
deleted file mode 100644
index ba071ca..0000000
--- a/base/regexp.cc
+++ /dev/null
@@ -1,146 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/regexp.h"
-#include "omaha/base/debug.h"
-
-namespace omaha {
-
-#define kMaxArgs 16
-
-bool RE::PartialMatch(const TCHAR* text, const RE& re,  // 3..16 args
-                      CString * a0,
-                      CString * a1,
-                      CString * a2,
-                      CString * a3,
-                      CString * a4,
-                      CString * a5,
-                      CString * a6,
-                      CString * a7,
-                      CString * a8,
-                      CString * a9,
-                      CString * a10,
-                      CString * a11,
-                      CString * a12,
-                      CString * a13,
-                      CString * a14,
-                      CString * a15)
-{
-  ASSERT(text, (L""));
-  // a0 may be NULL
-  // a1 may be NULL
-  // a2 may be NULL
-  // a3 may be NULL
-  // a4 may be NULL
-  // a5 may be NULL
-  // a6 may be NULL
-  // a7 may be NULL
-  // a8 may be NULL
-  // a9 may be NULL
-  // a10 may be NULL
-  // a11 may be NULL
-  // a12 may be NULL
-  // a13 may be NULL
-  // a14 may be NULL
-  // a15 may be NULL
-
-  CString * args[kMaxArgs];
-  int n = 0;
-  if (a0 == NULL) goto done; args[n++] = a0;
-  if (a1 == NULL) goto done; args[n++] = a1;
-  if (a2 == NULL) goto done; args[n++] = a2;
-  if (a3 == NULL) goto done; args[n++] = a3;
-  if (a4 == NULL) goto done; args[n++] = a4;
-  if (a5 == NULL) goto done; args[n++] = a5;
-  if (a6 == NULL) goto done; args[n++] = a6;
-  if (a7 == NULL) goto done; args[n++] = a7;
-  if (a8 == NULL) goto done; args[n++] = a8;
-  if (a9 == NULL) goto done; args[n++] = a9;
-  if (a10 == NULL) goto done; args[n++] = a10;
-  if (a11 == NULL) goto done; args[n++] = a11;
-  if (a12 == NULL) goto done; args[n++] = a12;
-  if (a13 == NULL) goto done; args[n++] = a13;
-  if (a14 == NULL) goto done; args[n++] = a14;
-  if (a15 == NULL) goto done; args[n++] = a15;
-
-done:
-  return re.DoMatchImpl(text,args,n,NULL);
-}
-
-// Like PartialMatch(), except the "input" is advanced past the matched
-// text.  Note: "input" is modified iff this routine returns true.
-// For example, "FindAndConsume(s, "(\\w+)", &word)" finds the next
-// word in "s" and stores it in "word".
-bool RE::FindAndConsume(const TCHAR **input, const RE& re,
-                        CString * a0,
-                        CString * a1,
-                        CString * a2,
-                        CString * a3,
-                        CString * a4,
-                        CString * a5,
-                        CString * a6,
-                        CString * a7,
-                        CString * a8,
-                        CString * a9,
-                        CString * a10,
-                        CString * a11,
-                        CString * a12,
-                        CString * a13,
-                        CString * a14,
-                        CString * a15)
-{
-  ASSERT(input, (L""));
-  // a0 may be NULL
-  // a1 may be NULL
-  // a2 may be NULL
-  // a3 may be NULL
-  // a4 may be NULL
-  // a5 may be NULL
-  // a6 may be NULL
-  // a7 may be NULL
-  // a8 may be NULL
-  // a9 may be NULL
-  // a10 may be NULL
-  // a11 may be NULL
-  // a12 may be NULL
-  // a13 may be NULL
-  // a14 may be NULL
-  // a15 may be NULL
-
-  CString * args[kMaxArgs];
-  int n = 0;
-  if (a0 == NULL) goto done; args[n++] = a0;
-  if (a1 == NULL) goto done; args[n++] = a1;
-  if (a2 == NULL) goto done; args[n++] = a2;
-  if (a3 == NULL) goto done; args[n++] = a3;
-  if (a4 == NULL) goto done; args[n++] = a4;
-  if (a5 == NULL) goto done; args[n++] = a5;
-  if (a6 == NULL) goto done; args[n++] = a6;
-  if (a7 == NULL) goto done; args[n++] = a7;
-  if (a8 == NULL) goto done; args[n++] = a8;
-  if (a9 == NULL) goto done; args[n++] = a9;
-  if (a10 == NULL) goto done; args[n++] = a10;
-  if (a11 == NULL) goto done; args[n++] = a11;
-  if (a12 == NULL) goto done; args[n++] = a12;
-  if (a13 == NULL) goto done; args[n++] = a13;
-  if (a14 == NULL) goto done; args[n++] = a14;
-  if (a15 == NULL) goto done; args[n++] = a15;
-
-done:
-  return re.DoMatchImpl(*input,args,n,input);
-}
-
-}  // namespace omaha
-
diff --git a/base/regexp.h b/base/regexp.h
deleted file mode 100644
index 25781c1..0000000
--- a/base/regexp.h
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Implementors: There is only one function to implement -- DoMatchImpl
-// See below
-
-#ifndef OMAHA_COMMON_REGEXP_H__
-#define OMAHA_COMMON_REGEXP_H__
-
-#include <atlstr.h>
-
-namespace omaha {
-
-// Interface for regular expression matching.  Also corresponds to a
-// pre-compiled regular expression.  An "RE" object is safe for
-// concurrent use by multiple threads.
-class RE {
- public:
-
-  // Matches "text" against "pattern".  If pointer arguments are
-  // supplied, copies matched sub-patterns into them. Use braces
-  // "{", "}" within the regexp to indicate a pattern to be copied.
-  //
-  // Returns true iff all of the following conditions are satisfied:
-  //   a. some substring of "text" matches "pattern"
-  //   b. The number of matched sub-patterns is >= number of supplied pointers
-  static bool PartialMatch(const TCHAR* text, const RE& re, // 3..16 args
-    CString * a0 = NULL,
-    CString * a1 = NULL,
-    CString * a2 = NULL,
-    CString * a3 = NULL,
-    CString * a4 = NULL,
-    CString * a5 = NULL,
-    CString * a6 = NULL,
-    CString * a7 = NULL,
-    CString * a8 = NULL,
-    CString * a9 = NULL,
-    CString * a10 = NULL,
-    CString * a11 = NULL,
-    CString * a12 = NULL,
-    CString * a13 = NULL,
-    CString * a14 = NULL,
-    CString * a15 = NULL);
-
-  // Like PartialMatch(), except the "input" is advanced past the matched
-  // text.  Note: "input" is modified iff this routine returns true.
-  // For example, "FindAndConsume(s, "{\\w+}", &word)" finds the next
-  // word in "s" and stores it in "word".
-  static bool FindAndConsume(const TCHAR** input, const RE& re,
-    CString * a0 = NULL,
-    CString * a1 = NULL,
-    CString * a2 = NULL,
-    CString * a3 = NULL,
-    CString * a4 = NULL,
-    CString * a5 = NULL,
-    CString * a6 = NULL,
-    CString * a7 = NULL,
-    CString * a8 = NULL,
-    CString * a9 = NULL,
-    CString * a10 = NULL,
-    CString * a11 = NULL,
-    CString * a12 = NULL,
-    CString * a13 = NULL,
-    CString * a14 = NULL,
-    CString * a15 = NULL);
-
- protected:
-
-  // The behavior of this function is subject to how it's used
-  // in PartialMatch() and FindAndConsume() above. See the header
-  // description of those functions to understand how an implementation
-  // should behave.
-  // text is the text we're looking in
-  // args is where matches should be outputted
-  // n is the number of CStrings in args
-  // match_end is a pointer to the position in text that
-  // we ended matching on
-  // returns true if data was found, false otherwise
-  // Example:Suppose text = "google 1\nYahoo! 2\n ..." and the regexp
-  // is something like "{\w+} \d". If args has two CStrings (n=2),
-  // then args[0] = "google", arg[1] = "1" and match_end will point to the \n
-  // before "Yahoo!"
-  virtual bool DoMatchImpl(const TCHAR *text,
-    CString * args[],
-    int n,
-    const TCHAR ** match_end) const = 0;
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_REGEXP_H__
diff --git a/base/registry_hive.cc b/base/registry_hive.cc
deleted file mode 100644
index 006d4cf..0000000
--- a/base/registry_hive.cc
+++ /dev/null
@@ -1,269 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/registry_hive.h"
-#include "omaha/base/accounts.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/string.h"
-#include "omaha/base/system.h"
-#include "omaha/base/user_info.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-RegistryHive::RegistryHive()
-    : hive_holding_key_(NULL) {
-}
-
-RegistryHive::~RegistryHive() {
-  if ( !hive_name_.IsEmpty() ) {
-    UnloadHive();
-  }
-}
-
-// Loads hive for requested SID. SID should be in format "S-X-X....."
-// name is a name under which the hive will be added to the HKEY_USERS,
-// you could use persons name here. This parameter should not have '\\'
-// characters!
-// It is not recommended to load more than one hive at once - LoadHive,
-// manipulate hive, UnloadHive, and then work on the next one.
-//
-// Hive could be already loaded: you logged out from other user but system
-// had open key in your current user. In that case I open hive_holding_key_ to
-// prevent system from unloading hive and do not load/unload hive - the system
-// will do it.
-HRESULT RegistryHive::LoadHive(TCHAR const * sid, TCHAR const *name) {
-  ASSERT1(sid);
-  ASSERT1(name);
-  ASSERT1(hive_name_.IsEmpty());
-  ASSERT1(String_FindChar(name, _T('\\')) == -1);
-
-  CString profile_key;
-  CString hive_path;
-
-  // Need set SE_RESTORE_NAME/SE_BACKUP_NAME priveleges to current process
-  // otherwise loading of the hive will fail
-  RET_IF_FAILED(System::AdjustPrivilege(SE_RESTORE_NAME, true));
-  RET_IF_FAILED(System::AdjustPrivilege(SE_BACKUP_NAME, true));
-
-  SafeCStringFormat(&profile_key, kProfileKeyFormat, sid);
-
-  if ( FAILED(RegKey::GetValue(profile_key, kProfilePathValue, &hive_path)) ) {
-    return E_FAIL;
-  }
-
-
-  wchar_t temporary_buffer[MAX_PATH];
-  DWORD ret = ExpandEnvironmentStrings(hive_path, temporary_buffer, MAX_PATH);
-
-  if ( !ret || ret >= MAX_PATH ) {
-    return E_FAIL;
-  }
-  hive_path = temporary_buffer;
-
-  hive_path.Append(_T("\\"));
-  hive_path.Append(kHiveName);
-
-  hive_name_ = name;
-
-  LONG res = RegLoadKey(HKEY_USERS, hive_name_, hive_path);
-
-  if ( ERROR_SHARING_VIOLATION == res ) {
-    // It is quite possible that the hive is still held by system.
-    hive_name_ = sid;
-
-    // if it is the case, this call will succeeed, and the system will not
-    // unload the hive while there are outstanding keys opened.
-    res = RegOpenKeyEx(HKEY_USERS,
-                       hive_name_,
-                       0,
-                       KEY_ALL_ACCESS,
-                       &hive_holding_key_);
-  }
-
-  return (res == ERROR_SUCCESS) ? S_OK : E_FAIL;
-}
-
-// Loads hive for requested SID, but only if the SID is another user
-// (since we don't need to do anything if the sid is ours)
-HRESULT RegistryHive::LoadHive(TCHAR const * user_sid) {
-  ASSERT1(user_sid != NULL);
-  bool other_user = false;
-
-  // Determine if the SID passed in is really another user
-  CString current_user_sid;
-  HRESULT hr = omaha::user_info::GetProcessUser(NULL, NULL, &current_user_sid);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[RegistryHive::LoadHive - failed to get current user")));
-    return hr;
-  }
-
-  // user_sid is the current user - no need to load the hive
-  if (lstrcmpi(current_user_sid, user_sid) == 0)
-    return S_FALSE;
-
-  // Get info on the sid we're being asked to load for
-  CString name;
-  CString domain;
-  SID_NAME_USE user_type;
-  hr = accounts::GetUserInfo(user_sid, &name, &domain, &user_type);
-  if ( FAILED(hr) || user_type != SidTypeUser ) {
-    // Either Sid no longer exists or Sid is not a user Sid
-    // (There is other possibility: Sid could be for roaming profile on domain
-    // which is currently down, but we do not support roaming profiles)
-    return FAILED(hr) ? hr : E_FAIL;
-  }
-
-  hr = LoadHive(user_sid, name);  // Use user name as a temporary key name.
-  if ( FAILED(hr) ) {
-    // Hive no longer present.
-    return E_FAIL;
-  }
-
-  return S_OK;
-}
-
-
-// Unloads and saves loaded hive
-HRESULT RegistryHive::UnloadHive() {
-  if (hive_name_.IsEmpty())
-    return S_OK;
-
-  LONG res;
-  if ( hive_holding_key_ ) {
-    res = RegCloseKey(hive_holding_key_);
-    hive_holding_key_ = NULL;
-    // no need to unload hive. System will do it.
-  } else {
-    res = RegUnLoadKey(HKEY_USERS, hive_name_);
-  }
-  hive_name_.Empty();
-  return (res == ERROR_SUCCESS) ? S_OK : E_FAIL;
-}
-
-// Does it recursively. The name should be relative to HKEY_CURRENT_USER.
-HRESULT RegistryHive::DeleteUserKey(TCHAR const * key_name) {
-  ASSERT(key_name && *key_name, (L""));
-  if ( !key_name || !*key_name ) {
-    return E_FAIL;
-  }
-  CString key(key_name);
-  ExpandKeyName(&key);
-
-  if ( !RegKey::SafeKeyNameForDeletion(key) ) {
-    return E_FAIL;
-  }
-
-  return RegKey::DeleteKey(key);
-}
-
-void RegistryHive::ExpandKeyName(CString * str) {
-  ASSERT1(str);
-
-  // If we haven't loaded another user's hive, use HKCU instead of
-  // HKEY_USERS
-  CString key_name;
-  if (hive_name_.IsEmpty()) {
-    key_name = _T("HKCU\\");
-  } else {
-    key_name = _T("HKEY_USERS\\");
-    key_name.Append(hive_name_ + _T("\\"));
-  }
-
-  key_name.Append(*str);
-  *str = key_name;
-}
-
-// Load a user registry
-int LoadUserRegistry(const TCHAR* user_sid,
-                     ProcessUserRegistryFunc* handler,
-                     LONG_PTR param) {
-  ASSERT1(user_sid && *user_sid);
-  ASSERT1(handler);
-
-  // Get current user SID
-  CString curr_user_sid;
-  HRESULT hr = omaha::user_info::GetProcessUser(NULL, NULL, &curr_user_sid);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[LoadUserRegistry - can't get current user][0x%x]"), hr));
-    return 0;
-  }
-
-  // Is current user?
-  bool other_user = curr_user_sid.CompareNoCase(user_sid) != 0;
-
-  // Get the hive for this user
-  RegistryHive user_hive;
-  if (other_user) {
-    // Get the info about this user
-    SID_NAME_USE user_type = SidTypeInvalid;
-    CString name, domain;
-    hr = accounts::GetUserInfo(user_sid, &name, &domain, &user_type);
-    if (FAILED(hr) || user_type != SidTypeUser) {
-      // Either SID no longer exists or SID is not a user Sid
-      // (There is other possibility: SID could be for roaming profile on domain
-      // which is currently down, but we do not support roaming profiles)
-      UTIL_LOG(LEVEL_WARNING,
-               (_T("[LoadUserRegistry - SID %s invalid or unsupported][0x%x]"),
-                user_sid, hr));
-      return 0;
-    }
-
-    // Load the hive
-    hr = user_hive.LoadHive(user_sid, domain + _T("_") + name);
-    if (FAILED(hr)) {
-      // Hive no longer present.
-      UTIL_LOG(LW, (_T("[LoadUserRegistry]")
-                    _T("[hive not present for %s][0x%x]"), user_sid, hr));
-      return 0;
-    }
-  }
-
-  // Get the registry key path
-  CString user_reg_path;
-  user_hive.ExpandKeyName(&user_reg_path);
-
-  // Call the handler
-  int res = (*handler)(user_sid, user_reg_path, param);
-
-  // Unload the hive
-  if (other_user) {
-    hr = user_hive.UnloadHive();
-    if (FAILED(hr)) {
-      UTIL_LOG(LE, (_T("[LoadUserRegistry]")
-                    _T("[failed to save hive for %s][0x%x]"), user_sid, hr));
-    }
-  }
-
-  return res;
-}
-
-// Enumerate all user registries
-void EnumerateAllUserRegistries(ProcessUserRegistryFunc* handler,
-                                LONG_PTR param) {
-  ASSERT1(handler);
-
-  CSimpleArray<CString> sid_array;
-  accounts::GetAllUserSids(&sid_array);
-  for (int i = 0 ; i < sid_array.GetSize() ; ++i) {
-    if (LoadUserRegistry(sid_array[i], handler, param)) {
-      return;
-    }
-  }
-}
-
-}  // namespace omaha
-
diff --git a/base/registry_hive.h b/base/registry_hive.h
deleted file mode 100644
index cf34680..0000000
--- a/base/registry_hive.h
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Other persons' registry hive manipulations.
-//
-#ifndef OMAHA_COMMON_REGISTRY_HIVE_H_
-#define OMAHA_COMMON_REGISTRY_HIVE_H_
-
-#include <windows.h>
-#include <atlstr.h>
-
-namespace omaha {
-
-#define kProfileKeyFormat \
-    _T("HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\%s")
-#define kProfilePathValue _T("ProfileImagePath")
-#define kHiveName         _T("Ntuser.dat")
-
-// !!! Warning !!!
-// You MUST unload hive, or this hive becomes unavailable until PC is restarted
-// This means the person cannot login.
-class RegistryHive {
- public:
-  RegistryHive();
-  ~RegistryHive();
-
-  // Loads hive for requested SID. SID should be in format "S-X-X....."
-  // name is a name under which the hive will be added to the HKEY_USERS,
-  // you could use persons name here. This parameter should not have '\\'
-  // characters!
-  // It is not recommended to load more than one hive at once - LoadHive,
-  // manipulate hive, UnloadHive, and then work on the next one.
-  HRESULT LoadHive(TCHAR const * sid, TCHAR const *name);
-  // Loads hive for requested SID, but only if the SID is another user
-  // (since we don't need to do anything if the sid is ours)
-  HRESULT LoadHive(TCHAR const * sid);
-  // Unloads and saves loaded hive
-  HRESULT UnloadHive();
-  // Does it recursively. The name should be relative to HKEY_CURRENT_USER.
-  HRESULT DeleteUserKey(TCHAR const * key_name);
-  // Expands key name for hive:
-  // "Software\Google" => "HKEY_USERS\[hive_name_]\Software\Google"
-  void ExpandKeyName(CString * str);
-
- private:
-  CString hive_name_;
-  HKEY hive_holding_key_;
-};
-
-// Function pointer
-// Return non-zero to abort the enumeration
-typedef int ProcessUserRegistryFunc(const TCHAR* user_sid,
-                                    const TCHAR* user_reg_key,
-                                    LONG_PTR param);
-
-// Enumerate all user registries
-void EnumerateAllUserRegistries(ProcessUserRegistryFunc* handler,
-                                LONG_PTR param);
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_REGISTRY_HIVE_H_
diff --git a/base/registry_monitor_manager.cc b/base/registry_monitor_manager.cc
deleted file mode 100644
index e57d7de..0000000
--- a/base/registry_monitor_manager.cc
+++ /dev/null
@@ -1,586 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// RegistryMonitor creates a KeyWatcher for every unique registry key that
-// contains a value registered by MonitorValue. Each KeyWatcher is responsible
-// for monitoring one or more values in a single registry key but not its
-// subkeys. RegistryMonitor manages a thread which waits on event objects.
-// The events are signaled when the corresponding monitored key changes.
-
-#include "omaha/base/registry_monitor_manager.h"
-#include <atlbase.h>
-#include <utility>
-#include <vector>
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/thread.h"
-
-namespace omaha {
-
-namespace detail {
-
-// converts a registry change type value to a string for logging purposes.
-CString RegistryChangeTypeToString(RegistryChangeType registry_change_type) {
-  switch (registry_change_type) {
-  case REGISTRY_CHANGE_TYPE_CREATE:
-    return _T("create");
-  case REGISTRY_CHANGE_TYPE_UPDATE:
-    return _T("update");
-  case REGISTRY_CHANGE_TYPE_DELETE:
-    return _T("delete");
-  default:
-    ASSERT1(false);
-    return _T("unknown");
-  }
-};
-
-// Holds a pair of root key and sub key, as monitoring must be unique for
-// each pair.
-class KeyId {
- public:
-  KeyId(HKEY parent_key, const CString& key_name)
-      : parent_key_(parent_key), key_name_(key_name) {}
-
-  HKEY parent_key() const { return parent_key_; }
-  CString key_name() const { return key_name_; }
-
-  static bool IsEqual(const KeyId& id1, const KeyId& id2) {
-    return id1.parent_key_ == id2.parent_key_ &&
-           id1.key_name_   == id2.key_name_;
-  }
- private:
-  HKEY    parent_key_;
-  CString key_name_;
-};
-
-class KeyWatcher;
-
-// ValueWatcher represents a single monitored registry value.
-// It is used by KeyWatcher to determine which registry value has changed when
-// it detects a change in its key.
-class ValueWatcher {
- public:
-  ValueWatcher(KeyWatcher* key_watcher,
-               const CString& value_name,
-               int value_type,
-               RegistryValueChangeCallback callback,
-               void* user_data);
-  ~ValueWatcher();
-
-  // Returns true if the initial value has changed.
-  bool HasChanged();
-
-  // Calls the callback function to do the notification of the change.
-  void DoCallback();
-
- private:
-  CString GetCurrentValueString();
-  DWORD   GetCurrentValueDword();
-
-  CString last_known_value_string_;
-  DWORD last_known_value_dword_;
-  bool value_is_valid_;
-  RegistryChangeType change_type_;
-  CString value_name_;
-  int value_type_;
-  KeyWatcher* key_watcher_;
-  RegistryValueChangeCallback callback_;
-  void* callback_param_;
-};
-
-
-// KeyWatcher is responsible for monitoring changes to a single key in the
-// Windows registry. RegistryMonitor keeps a container of KeyWatcher objects,
-// one object for each key that contains a value to be monitored.
-class KeyWatcher {
- public:
-  explicit KeyWatcher(const KeyId& key_id);
-
-  ~KeyWatcher();
-
-  // Adds a new registry value to monitor.
-  HRESULT AddValue(const CString& value_name,
-                   int value_type,
-                   RegistryValueChangeCallback callback,
-                   void* user_data);
-
-  // Registers the key watcher with the OS and gets ready to receive events.
-  HRESULT StartWatching();
-
-  // Returns true if the underlying registry handle corresponds to a valid key.
-  bool IsKeyValid();
-
-  HANDLE notification_event() const { return get(notification_event_); }
-
-  RegKey& key() { return key_; }
-
-  CString key_name() const { return key_id_.key_name(); }
-
-  void set_callback(RegistryKeyChangeCallback callback, void* callback_param) {
-    callback_       = callback;
-    callback_param_ = callback_param;
-  }
-
-  // Callback called when the notification event is signaled by the OS
-  // as a result of a change in the monitored key.
-  void HandleEvent(HANDLE handle);
-
- private:
-  // Ensures the key to monitor is always open.
-  HRESULT EnsureOpen();
-
-  std::vector<ValueWatcher*> values_;
-  RegKey key_;
-  const KeyId key_id_;
-  scoped_event notification_event_;
-
-  RegistryKeyChangeCallback callback_;
-  void* callback_param_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(KeyWatcher);
-};
-
-class RegistryMonitorImpl : public Runnable {
- public:
-  RegistryMonitorImpl();
-  ~RegistryMonitorImpl();
-
-  HRESULT MonitorKey(HKEY root_key,
-                     const CString& sub_key,
-                     RegistryKeyChangeCallback callback,
-                     void* user_data);
-
-  HRESULT MonitorValue(HKEY root_key,
-                       const CString& sub_key,
-                       const CString& value_name,
-                       int value_type,
-                       RegistryValueChangeCallback callback,
-                       void* user_data);
-
-  HRESULT Initialize();
-
-  HRESULT StartMonitoring();
-
- private:
-
-  // Runnable.
-  virtual void Run();
-
-  typedef std::pair<KeyId, KeyWatcher*> Watcher;
-  std::vector<Watcher> watchers_;
-
-  Thread thread_;
-  scoped_ptr<Gate> start_monitoring_gate_;
-  scoped_event stop_monitoring_;
-  DISALLOW_EVIL_CONSTRUCTORS(RegistryMonitorImpl);
-};
-
-
-ValueWatcher::ValueWatcher(KeyWatcher* key_watcher,
-                           const CString &value_name,
-                           int value_type,
-                           RegistryValueChangeCallback callback,
-                           void* user_data)
-    : key_watcher_(key_watcher),
-      value_is_valid_(false),
-      change_type_(REGISTRY_CHANGE_TYPE_CREATE),
-      callback_(callback),
-      callback_param_(user_data),
-      value_name_(value_name),
-      value_type_(value_type),
-      last_known_value_dword_(0) {
-  ASSERT1(key_watcher);
-  ASSERT1(callback);
-  if (value_type_ == REG_SZ) {
-    last_known_value_string_ = GetCurrentValueString();
-  } else if (value_type_ == REG_DWORD) {
-    last_known_value_dword_ = GetCurrentValueDword();
-  } else {
-    ASSERT(false, (_T("value type not supported")));
-  }
-}
-
-ValueWatcher::~ValueWatcher() {
-}
-
-bool ValueWatcher::HasChanged() {
-  UTIL_LOG(L3, (_T("[ValueWatcher::HasChanged]")
-                _T("[key name '%s'][value '%s'][valid %d]"),
-                key_watcher_->key_name(), value_name_, value_is_valid_));
-
-  const bool value_was_valid = value_is_valid_;
-
-  bool has_changed = false;
-  if (value_type_ == REG_SZ) {
-    CString new_value = GetCurrentValueString();
-    has_changed = last_known_value_string_ != new_value;
-
-    UTIL_LOG(L3, (_T("[ValueWatcher::HasChanged][old value %s][new value %s]"),
-                  last_known_value_string_, new_value));
-
-    last_known_value_string_ = new_value;
-  } else if (value_type_ == REG_DWORD) {
-    DWORD new_value = GetCurrentValueDword();
-    has_changed = last_known_value_dword_ != new_value;
-
-    UTIL_LOG(L3, (_T("[ValueWatcher::HasChanged][old value %d][new value %d]"),
-                  last_known_value_dword_, new_value));
-
-    last_known_value_dword_ = new_value;
-  } else {
-    ASSERT(false, (_T("value type not supported")));
-  }
-
-  // Detect the type of the change based on previous and current value state.
-  if (value_was_valid && value_is_valid_) {
-    change_type_ = REGISTRY_CHANGE_TYPE_UPDATE;
-  } else if (value_was_valid && !value_is_valid_) {
-    change_type_ = REGISTRY_CHANGE_TYPE_DELETE;
-  } else if (!value_was_valid && value_is_valid_) {
-    change_type_ = REGISTRY_CHANGE_TYPE_CREATE;
-  } else {
-    ASSERT1(!value_was_valid && !value_is_valid_);
-  }
-
-  if (has_changed) {
-    UTIL_LOG(L3, (_T("[ValueWatcher::HasChanged]")
-                  _T("[key name '%s'][value '%s' has changed][%s]"),
-                  key_watcher_->key_name(), value_name_,
-                  RegistryChangeTypeToString(change_type_)));
-  } else {
-    UTIL_LOG(L3, (_T("[ValueWatcher::HasChanged]")
-                  _T("[key name '%s'][value '%s' is the same]"),
-                  key_watcher_->key_name(), value_name_));
-  }
-
-  return has_changed;
-}
-
-CString ValueWatcher::GetCurrentValueString() {
-  CString value_data;
-  RegKey& key = key_watcher_->key();
-  ASSERT1(key.Key());
-  value_is_valid_ = SUCCEEDED(key.GetValue(value_name_, &value_data));
-  return value_is_valid_ ? value_data : CString();
-}
-
-DWORD ValueWatcher::GetCurrentValueDword() {
-  DWORD value_data = 0;
-  RegKey& key = key_watcher_->key();
-  ASSERT1(key.Key());
-  value_is_valid_ = SUCCEEDED(key.GetValue(value_name_, &value_data));
-  return value_is_valid_ ? value_data : static_cast<DWORD>(-1);
-}
-
-void ValueWatcher::DoCallback() {
-  ASSERT1(callback_ != NULL);
-
-  const void* value = NULL;
-  if (value_type_ == REG_SZ) {
-    value = static_cast<const TCHAR*>(last_known_value_string_);
-  } else if (value_type_ == REG_DWORD) {
-    value = reinterpret_cast<void*>(last_known_value_dword_);
-  }
-
-  callback_(key_watcher_->key_name(), value_name_, change_type_,
-            value, callback_param_);
-
-  // If value was not valid, for example, the key was deleted or renamed, and
-  // it is valid after callback, update last known with the current value.
-  if (!value_is_valid_) {
-    if (value_type_ == REG_SZ) {
-      CString new_value = GetCurrentValueString();
-      if (value_is_valid_) {
-        last_known_value_string_ = new_value;
-      }
-    } else if (value_type_ == REG_DWORD) {
-      DWORD new_value = GetCurrentValueDword();
-      if (value_is_valid_) {
-        last_known_value_dword_ = new_value;
-      }
-    }
-  }
-}
-
-KeyWatcher::KeyWatcher(const KeyId& key_id)
-    : key_id_(key_id),
-      notification_event_(::CreateEvent(NULL, false, false, NULL)),
-      callback_(NULL),
-      callback_param_(NULL) {
-}
-
-KeyWatcher::~KeyWatcher() {
-  for (size_t i = 0; i != values_.size(); ++i) {
-    delete values_[i];
-  }
-}
-
-HRESULT KeyWatcher::StartWatching() {
-  // By this time the key could be deleted or renamed. Check if the handle
-  // is still valid and reopen the key if needed.
-  HRESULT hr = EnsureOpen();
-  if (FAILED(hr)) {
-    return hr;
-  }
-  ASSERT1(key_.Key());
-  const DWORD kNotifyFilter = REG_NOTIFY_CHANGE_NAME          |
-                              REG_NOTIFY_CHANGE_ATTRIBUTES    |
-                              REG_NOTIFY_CHANGE_LAST_SET      |
-                              REG_NOTIFY_CHANGE_SECURITY;
-  LONG result = ::RegNotifyChangeKeyValue(key_.Key(), false, kNotifyFilter,
-                                          get(notification_event_), true);
-  UTIL_LOG(L3, (_T("[KeyWatcher::StartWatching][key '%s' %s]"),
-                key_id_.key_name(),
-                result == ERROR_SUCCESS ? _T("ok") : _T("failed")));
-  return HRESULT_FROM_WIN32(result);
-}
-
-HRESULT KeyWatcher::AddValue(const CString& value_name,
-                             int value_type,
-                             RegistryValueChangeCallback callback,
-                             void* user_data) {
-  ASSERT1(callback);
-  HRESULT hr = EnsureOpen();
-  if (FAILED(hr)) {
-    return hr;
-  }
-  values_.push_back(
-      new ValueWatcher(this, value_name, value_type, callback, user_data));
-  return S_OK;
-}
-
-void KeyWatcher::HandleEvent(HANDLE handle) {
-  UTIL_LOG(L3, (_T("[KeyWatcher::HandleEvent][key '%s']"), key_id_.key_name()));
-
-  ASSERT1(handle);
-  ASSERT1(handle == get(notification_event_));
-  UNREFERENCED_PARAMETER(handle);
-
-  // Although not documented, it seems the OS pulses the event so the event
-  // is never signaled at this point.
-  ASSERT1(::WaitForSingleObject(handle, 0) == WAIT_TIMEOUT);
-
-  // Notify the key has changed.
-  if (callback_) {
-    callback_(key_name(), callback_param_);
-  }
-
-  // Notify the values have changed.
-  for (size_t i = 0; i != values_.size(); ++i) {
-    ValueWatcher* value = values_[i];
-    if (value != NULL) {
-      if (value->HasChanged()) {
-        value->DoCallback();
-      }
-    }
-  }
-
-  VERIFY1(SUCCEEDED(StartWatching()));
-}
-
-HRESULT KeyWatcher::EnsureOpen() {
-  // Close the key if it is not valid for whatever reasons, such as it was
-  // deleted and recreated back.
-  if (!IsKeyValid()) {
-    UTIL_LOG(L3, (_T("[key '%s' is not valid]"), key_id_.key_name()));
-    VERIFY1(SUCCEEDED(key_.Close()));
-  }
-
-  // Open the key if not already open or create the key if needed.
-  HRESULT hr = S_OK;
-  if (!key_.Key()) {
-    hr = key_.Create(key_id_.parent_key(), key_id_.key_name());
-    if (SUCCEEDED(hr)) {
-      UTIL_LOG(L3, (_T("[key '%s' has been created]"), key_id_.key_name()));
-    }
-  }
-  return hr;
-}
-
-bool KeyWatcher::IsKeyValid() {
-  if (!key_.Key()) {
-    return false;
-  }
-  LONG ret = RegQueryInfoKey(key_.Key(),
-                             NULL, NULL, NULL, NULL, NULL,
-                             NULL, NULL, NULL, NULL, NULL, NULL);
-  return ret == ERROR_SUCCESS;
-}
-
-RegistryMonitorImpl::RegistryMonitorImpl() {
-}
-
-RegistryMonitorImpl::~RegistryMonitorImpl() {
-  if (stop_monitoring_) {
-    VERIFY1(::SetEvent(get(stop_monitoring_)));
-  }
-  VERIFY1(thread_.WaitTillExit(INFINITE));
-
-  for (size_t i = 0; i != watchers_.size(); ++i) {
-    ASSERT1(watchers_[i].second);
-    delete watchers_[i].second;
-  }
-}
-
-HRESULT RegistryMonitorImpl::Initialize() {
-  reset(stop_monitoring_, ::CreateEvent(NULL, true, false, NULL));
-  if (!stop_monitoring_) {
-    return HRESULTFromLastError();
-  }
-  return S_OK;
-}
-
-HRESULT RegistryMonitorImpl::MonitorKey(HKEY root_key,
-                                        const CString& sub_key,
-                                        RegistryKeyChangeCallback callback,
-                                        void* user_data) {
-  ASSERT1(callback);
-  ASSERT1(!thread_.Running());
-
-  KeyId key_id(root_key, sub_key);
-  for (size_t i = 0; i != watchers_.size(); ++i) {
-    if (KeyId::IsEqual(watchers_[i].first, key_id)) {
-      watchers_[i].second->set_callback(callback, user_data);
-      return S_OK;
-    }
-  }
-  scoped_ptr<KeyWatcher> key_watcher(new KeyWatcher(key_id));
-  key_watcher->set_callback(callback, user_data);
-  Watcher watcher(key_id, key_watcher.release());
-  watchers_.push_back(watcher);
-  return S_OK;
-}
-
-HRESULT RegistryMonitorImpl::MonitorValue(
-    HKEY root_key, const CString& sub_key, const CString& value_name,
-    int value_type, RegistryValueChangeCallback callback, void* user_data) {
-  ASSERT1(callback);
-  ASSERT1(!thread_.Running());
-
-  // Reuse an existing key watcher if there is a value already registered
-  // for monitoring under the respective registry key.
-  KeyId key_id(root_key, sub_key);
-  for (size_t i = 0; i != watchers_.size(); ++i) {
-    if (KeyId::IsEqual(watchers_[i].first, key_id)) {
-      return watchers_[i].second->AddValue(value_name, value_type,
-                                           callback, user_data);
-    }
-  }
-  scoped_ptr<KeyWatcher> key_watcher(new KeyWatcher(key_id));
-  HRESULT hr = key_watcher->AddValue(value_name, value_type,
-                                     callback, user_data);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[RegistryMonitorImpl::RegisterValue failed]")
-                  _T("[key %s][value %s][0x%x]"), sub_key, value_name, hr));
-    return hr;
-  }
-  Watcher watcher(key_id, key_watcher.release());
-  watchers_.push_back(watcher);
-  return S_OK;
-}
-
-HRESULT RegistryMonitorImpl::StartMonitoring() {
-  // Starts the thread and waits on the gate for the thread to open after
-  // it has registered all watchers for notifications and it is ready to
-  // handle notification events. The gate is only needed to synchronize the
-  // caller and the monitoring threads.
-  start_monitoring_gate_.reset(new Gate);
-  if (!thread_.Start(this)) {
-    return E_FAIL;
-  }
-  bool wait_result = start_monitoring_gate_->Wait(INFINITE);
-  start_monitoring_gate_.reset();
-  ASSERT1(wait_result);
-  return wait_result ? S_OK : HRESULTFromLastError();
-}
-
-void RegistryMonitorImpl::Run() {
-  UTIL_LOG(L3, (_T("[started monitoring registry]")));
-
-  const size_t kNumNotificationHandles = watchers_.size();
-  const size_t kNumHandles = kNumNotificationHandles + 1;
-  const size_t kStopMonitoringHandleIndex = kNumNotificationHandles;
-
-  scoped_array<HANDLE> handles(new HANDLE[kNumHandles]);
-  for (size_t i = 0; i != watchers_.size(); ++i) {
-    handles[i] = watchers_[i].second->notification_event();
-    VERIFY1(SUCCEEDED(watchers_[i].second->StartWatching()));
-  }
-  handles[kStopMonitoringHandleIndex] = get(stop_monitoring_);
-
-  // Open the gate and allow the RegistryMonitor::StartMonitoring call to
-  // to return to the caller.
-  ASSERT1(start_monitoring_gate_.get());
-  VERIFY1(start_monitoring_gate_->Open());
-
-  for (;;) {
-    DWORD result = ::WaitForMultipleObjects(kNumHandles,
-                                            handles.get(),
-                                            false,
-                                            INFINITE);
-    COMPILE_ASSERT(0 == WAIT_OBJECT_0, invalid_wait_object_0);
-    ASSERT1(result < kNumHandles);
-    if (result < kNumHandles) {
-      if (result == kStopMonitoringHandleIndex) {
-        break;
-      } else {
-        size_t i = result - WAIT_OBJECT_0;
-        watchers_[i].second->HandleEvent(handles[i]);
-      }
-    }
-  }
-  UTIL_LOG(L3, (_T("[stopped monitoring registry]")));
-}
-
-}  // namespace detail
-
-RegistryMonitor::RegistryMonitor()
-    : impl_(new detail::RegistryMonitorImpl) {
-}
-
-RegistryMonitor::~RegistryMonitor() {
-}
-
-HRESULT RegistryMonitor::MonitorKey(HKEY root_key,
-                                    const CString& sub_key,
-                                    RegistryKeyChangeCallback callback,
-                                    void* user_data) {
-  return impl_->MonitorKey(root_key, sub_key, callback, user_data);
-}
-
-HRESULT RegistryMonitor::MonitorValue(HKEY root_key,
-                                      const CString& sub_key,
-                                      const CString& value_name,
-                                      int value_type,
-                                      RegistryValueChangeCallback callback,
-                                      void* user_data) {
-  return impl_->MonitorValue(root_key, sub_key, value_name, value_type,
-                             callback, user_data);
-}
-
-HRESULT RegistryMonitor::Initialize() {
-  return impl_->Initialize();
-}
-
-HRESULT RegistryMonitor::StartMonitoring() {
-  return impl_->StartMonitoring();
-}
-
-}  // namespace omaha
-
diff --git a/base/registry_monitor_manager.h b/base/registry_monitor_manager.h
deleted file mode 100644
index 6cf9952..0000000
--- a/base/registry_monitor_manager.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// The RegistryMonitor allows a caller to request monitoring
-// for registry value changes across multiple keys. It uses the Windows API
-// function RegNotifyChangeKeyValue to notify when any value in a key changes.
-
-#ifndef OMAHA_COMMON_REGISTRY_MONITOR_MANAGER_H_
-#define OMAHA_COMMON_REGISTRY_MONITOR_MANAGER_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-
-namespace omaha {
-
-namespace detail {
-
-class RegistryMonitorImpl;
-
-}  // namespace detail
-
-// Called when a registry value changes. 'new_value_data' contains a
-// pointer to the string data for a string value or the value itself for a
-// DWORD value.
-enum RegistryChangeType {
-  REGISTRY_CHANGE_TYPE_CREATE = 0,
-  REGISTRY_CHANGE_TYPE_UPDATE,
-  REGISTRY_CHANGE_TYPE_DELETE,
-};
-typedef void (*RegistryValueChangeCallback)(const TCHAR* key_name,
-                                            const TCHAR* value_name,
-                                            RegistryChangeType change_type,
-                                            const void* new_value_data,
-                                            void* user_data);
-
-// Called when a registry key changes. Changes include subkeys being
-// created or deleted as well as value changes under that key but not under
-// the subkeys of the key.
-typedef void (*RegistryKeyChangeCallback)(const TCHAR* key_name,
-                                          void* user_data);
-
-class RegistryMonitor {
- public:
-  RegistryMonitor();
-  ~RegistryMonitor();
-
-  HRESULT Initialize();
-
-  // Monitors a registry sub key for changes. Registering the same sub key
-  // overrides the previous registration.
-  HRESULT MonitorKey(HKEY root_key,
-                     const CString& sub_key,
-                     RegistryKeyChangeCallback callback,
-                     void* user_data);
-
-  // Adds a registry value to the list of values to monitor for changes.
-  // All values must be registered before starting monitoring. Registering
-  // the same value is allowed, although not particularly useful.
-  HRESULT MonitorValue(HKEY root_key,
-                       const CString& sub_key,
-                       const CString& value_name,
-                       int value_type,
-                       RegistryValueChangeCallback callback,
-                       void* user_data);
-
-  // Starts monitoring for changes.
-  HRESULT StartMonitoring();
-
- private:
-  scoped_ptr<detail::RegistryMonitorImpl> impl_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(RegistryMonitor);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_REGISTRY_MONITOR_MANAGER_H_
-
diff --git a/base/registry_monitor_manager_unittest.cc b/base/registry_monitor_manager_unittest.cc
deleted file mode 100644
index 4d76705..0000000
--- a/base/registry_monitor_manager_unittest.cc
+++ /dev/null
@@ -1,235 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-#include <limits.h>
-#include "base/basictypes.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/reactor.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/registry_monitor_manager.h"
-#include "omaha/base/thread.h"
-#include "omaha/base/utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-const TCHAR kKeyNameFull[] = _T("HKCU\\key");
-const TCHAR kKeyName[]     = _T("key");
-const TCHAR kValueName[]   = _T("value");
-
-}  // namespace
-
-class RegistryMonitorTest : public testing::Test {
- protected:
-  RegistryMonitorTest() {}
-
-  virtual void SetUp() {
-    // Override HKCU.
-    RegKey::DeleteKey(kRegistryHiveOverrideRoot);
-    OverrideSpecifiedRegistryHives(kRegistryHiveOverrideRoot, false, true);
-    reset(registry_changed_event_, ::CreateEvent(NULL, true, false, NULL));
-  }
-
-  virtual void TearDown() {
-    reset(registry_changed_event_);
-    RestoreRegistryHives();
-    RegKey::DeleteKey(kRegistryHiveOverrideRoot);
-  }
-
-  static void RegistryDeleteCallback(const TCHAR* key_name,
-                                     const TCHAR* value_name,
-                                     RegistryChangeType change_type,
-                                     const void* new_value_data,
-                                     void* user_data) {
-    EXPECT_STREQ(kKeyName, key_name);
-    EXPECT_STREQ(kValueName, value_name);
-    EXPECT_EQ(REGISTRY_CHANGE_TYPE_DELETE, change_type);
-    EXPECT_TRUE(new_value_data);
-    EXPECT_TRUE(user_data);
-    RegistryMonitorTest* object = static_cast<RegistryMonitorTest*>(user_data);
-    DWORD actual_value = reinterpret_cast<DWORD>(new_value_data);
-    EXPECT_EQ(ULONG_MAX, actual_value);
-    EXPECT_TRUE(::SetEvent(get(object->registry_changed_event_)));
-  }
-
-  static void RegistryChangeCallback(const TCHAR* key_name,
-                                     const TCHAR* value_name,
-                                     RegistryChangeType change_type,
-                                     const void* new_value_data,
-                                     void* user_data) {
-    EXPECT_STREQ(kKeyName, key_name);
-    EXPECT_STREQ(kValueName, value_name);
-    EXPECT_EQ(REGISTRY_CHANGE_TYPE_UPDATE, change_type);
-    EXPECT_TRUE(new_value_data);
-    EXPECT_TRUE(user_data);
-    RegistryMonitorTest* object = static_cast<RegistryMonitorTest*>(user_data);
-    const TCHAR* actual_value = static_cast<const TCHAR*>(new_value_data);
-    EXPECT_STREQ(_T("foo"), actual_value);
-    EXPECT_TRUE(::SetEvent(get(object->registry_changed_event_)));
-  }
-
-  static void RegistryChangesCallback(const TCHAR* key_name,
-                                     const TCHAR* value_name,
-                                     RegistryChangeType change_type,
-                                     const void* new_value_data,
-                                     void* user_data) {
-    EXPECT_STREQ(kKeyName, key_name);
-    EXPECT_STREQ(kValueName, value_name);
-    EXPECT_EQ(REGISTRY_CHANGE_TYPE_UPDATE, change_type);
-    EXPECT_TRUE(new_value_data);
-    EXPECT_TRUE(user_data);
-    RegistryMonitorTest* object = static_cast<RegistryMonitorTest*>(user_data);
-    EXPECT_TRUE(::SetEvent(get(object->registry_changed_event_)));
-  }
-
-  static void RegistryCreateCallback(const TCHAR* key_name,
-                                     const TCHAR* value_name,
-                                     RegistryChangeType change_type,
-                                     const void* new_value_data,
-                                     void* user_data) {
-    EXPECT_STREQ(kKeyName, key_name);
-    EXPECT_STREQ(kValueName, value_name);
-    EXPECT_EQ(REGISTRY_CHANGE_TYPE_CREATE, change_type);
-    EXPECT_TRUE(new_value_data);
-    EXPECT_TRUE(user_data);
-    RegistryMonitorTest* object = static_cast<RegistryMonitorTest*>(user_data);
-    DWORD actual_value = reinterpret_cast<DWORD>(new_value_data);
-    EXPECT_EQ(1, actual_value);
-    EXPECT_TRUE(::SetEvent(get(object->registry_changed_event_)));
-  }
-
-  static void RegistryKeyCallback(const TCHAR* key_name, void* user_data) {
-    EXPECT_STREQ(kKeyName, key_name);
-    RegistryMonitorTest* object = static_cast<RegistryMonitorTest*>(user_data);
-    EXPECT_TRUE(::SetEvent(get(object->registry_changed_event_)));
-  }
-
-  scoped_event registry_changed_event_;
-
-  static DWORD const kWaitForChangeMs = 5000;
-};
-
-TEST_F(RegistryMonitorTest, DeleteValue) {
-  DWORD value = 0;
-  ASSERT_HRESULT_SUCCEEDED(RegKey::SetValue(kKeyNameFull, kValueName, value));
-  RegistryMonitor registry_monitor;
-  ASSERT_HRESULT_SUCCEEDED(registry_monitor.Initialize());
-  ASSERT_HRESULT_SUCCEEDED(registry_monitor.MonitorValue(
-      HKEY_CURRENT_USER, kKeyName, kValueName, REG_DWORD,
-      RegistryDeleteCallback, this));
-  ASSERT_HRESULT_SUCCEEDED(registry_monitor.StartMonitoring());
-
-  EXPECT_HRESULT_SUCCEEDED(RegKey::DeleteValue(kKeyNameFull, kValueName));
-  EXPECT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(get(registry_changed_event_),
-                                                 kWaitForChangeMs));
-}
-
-TEST_F(RegistryMonitorTest, ChangeValue) {
-  ASSERT_HRESULT_SUCCEEDED(RegKey::SetValue(kKeyNameFull, kValueName, _T("")));
-  RegistryMonitor registry_monitor;
-  ASSERT_HRESULT_SUCCEEDED(registry_monitor.Initialize());
-  ASSERT_HRESULT_SUCCEEDED(registry_monitor.MonitorValue(
-    HKEY_CURRENT_USER, kKeyName, kValueName, REG_SZ,
-    RegistryChangeCallback, this));
-  ASSERT_HRESULT_SUCCEEDED(registry_monitor.StartMonitoring());
-
-  ASSERT_HRESULT_SUCCEEDED(RegKey::SetValue(kKeyNameFull,
-                                            kValueName,
-                                            _T("foo")));
-  EXPECT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(get(registry_changed_event_),
-                                                 kWaitForChangeMs));
-}
-
-// Tests changing the same value two times. This is useful to detect if
-// the key is registered back for notification after a succesful callback.
-TEST_F(RegistryMonitorTest, ChangeValues) {
-  ASSERT_HRESULT_SUCCEEDED(RegKey::SetValue(kKeyNameFull,
-                                            kValueName,
-                                            _T("")));
-
-  RegistryMonitor registry_monitor;
-  ASSERT_HRESULT_SUCCEEDED(registry_monitor.Initialize());
-  ASSERT_HRESULT_SUCCEEDED(registry_monitor.MonitorValue(
-      HKEY_CURRENT_USER, kKeyName, kValueName, REG_SZ,
-      RegistryChangesCallback, this));
-  ASSERT_HRESULT_SUCCEEDED(registry_monitor.StartMonitoring());
-
-  ASSERT_HRESULT_SUCCEEDED(RegKey::SetValue(kKeyNameFull,
-                                            kValueName,
-                                            _T("foo")));
-  EXPECT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(get(registry_changed_event_),
-                                                 kWaitForChangeMs));
-  EXPECT_TRUE(::ResetEvent(get(registry_changed_event_)));
-
-  ASSERT_HRESULT_SUCCEEDED(RegKey::SetValue(kKeyNameFull,
-                                            kValueName,
-                                            _T("bar")));
-  EXPECT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(get(registry_changed_event_),
-                                                 kWaitForChangeMs));
-}
-
-TEST_F(RegistryMonitorTest, CreateValue) {
-  RegistryMonitor registry_monitor;
-  ASSERT_HRESULT_SUCCEEDED(registry_monitor.Initialize());
-  ASSERT_HRESULT_SUCCEEDED(RegKey::CreateKey(kKeyNameFull));
-  ASSERT_HRESULT_SUCCEEDED(registry_monitor.MonitorValue(
-      HKEY_CURRENT_USER, kKeyName, kValueName, REG_DWORD,
-      RegistryCreateCallback, this));
-  ASSERT_HRESULT_SUCCEEDED(registry_monitor.StartMonitoring());
-
-  DWORD value = 1;
-  ASSERT_HRESULT_SUCCEEDED(RegKey::SetValue(kKeyNameFull, kValueName, value));
-  EXPECT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(get(registry_changed_event_),
-                                                 kWaitForChangeMs));
-}
-
-// Monitoring values under the same key pair is allowed.
-TEST_F(RegistryMonitorTest, MonitorSame) {
-  RegistryMonitor registry_monitor;
-  ASSERT_HRESULT_SUCCEEDED(registry_monitor.Initialize());
-  ASSERT_HRESULT_SUCCEEDED(RegKey::CreateKey(kKeyNameFull));
-  ASSERT_HRESULT_SUCCEEDED(registry_monitor.MonitorValue(
-      HKEY_CURRENT_USER, kKeyName, kValueName, REG_DWORD,
-      RegistryCreateCallback, this));
-  ASSERT_HRESULT_SUCCEEDED(registry_monitor.MonitorValue(
-      HKEY_CURRENT_USER, kKeyName, kValueName, REG_DWORD,
-      RegistryCreateCallback, this));
-}
-
-TEST_F(RegistryMonitorTest, MonitorKey) {
-  EXPECT_HRESULT_SUCCEEDED(RegKey::CreateKey(kKeyNameFull));
-
-  RegistryMonitor registry_monitor;
-  EXPECT_HRESULT_SUCCEEDED(registry_monitor.Initialize());
-  EXPECT_HRESULT_SUCCEEDED(registry_monitor.MonitorKey(
-      HKEY_CURRENT_USER, kKeyName, RegistryKeyCallback, this));
-
-  EXPECT_HRESULT_SUCCEEDED(registry_monitor.StartMonitoring());
-
-  EXPECT_HRESULT_SUCCEEDED(RegKey::CreateKey(_T("HKCU\\key\\subkey")));
-  EXPECT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(get(registry_changed_event_),
-                                                 kWaitForChangeMs));
-
-  EXPECT_TRUE(::ResetEvent(get(registry_changed_event_)));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::DeleteKey(_T("HKCU\\key\\subkey")));
-  EXPECT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(get(registry_changed_event_),
-                                                 kWaitForChangeMs));
-}
-
-}  // namespace omaha
-
diff --git a/base/registry_store.cc b/base/registry_store.cc
deleted file mode 100644
index ccfb6a3..0000000
--- a/base/registry_store.cc
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/registry_store.h"
-#include <vector>
-#include "omaha/base/debug.h"
-#include "omaha/base/reg_key.h"
-
-namespace omaha {
-
-bool RegistryStore::Open(const TCHAR* key_path) {
-  key_path_ = key_path;
-  return true;
-}
-
-bool RegistryStore::Close() {
-  key_path_.Empty();
-  return true;
-}
-
-bool RegistryStore::Clear() {
-  if (RegKey::HasKey(key_path_)) {
-    return SUCCEEDED(RegKey::DeleteKey(key_path_, false));
-  } else {
-    return true;
-  }
-}
-
-bool RegistryStore::Read(const TCHAR* name, std::vector<byte>* data) const {
-  ASSERT1(name);
-  ASSERT1(data);
-
-  byte* sdata = NULL;
-  DWORD sdata_size = 0;
-  HRESULT hr = RegKey::GetValue(key_path_, name, &sdata, &sdata_size);
-  if (FAILED(hr) || !sdata || !sdata_size)
-    return false;
-
-  data->resize(sdata_size);
-  memcpy(&data->front(), sdata, sdata_size);
-
-  delete[] sdata;
-
-  return true;
-}
-
-bool RegistryStore::Write(const TCHAR* name, byte* data, int data_size) {
-  ASSERT1(name);
-  ASSERT1(data);
-  ASSERT1(data_size);
-
-  return SUCCEEDED(RegKey::SetValue(key_path_, name, data, data_size));
-}
-
-bool RegistryStore::Exists(const TCHAR* name) {
-  ASSERT1(name);
-
-  return RegKey::HasValue(key_path_, name);
-}
-
-bool RegistryStore::Remove(const TCHAR* name) {
-  ASSERT1(name);
-
-  return SUCCEEDED(RegKey::DeleteValue(key_path_, name));
-}
-
-bool RegistryStore::GetValueCount(uint32* value_count) {
-  ASSERT1(value_count);
-
-  CString key_name(key_path_);
-  HKEY h_key = RegKey::GetRootKeyInfo(&key_name);
-
-  RegKey reg_key;
-  if (FAILED(reg_key.Open(h_key, key_name.GetString(), KEY_READ)))
-    return false;
-
-  *value_count = reg_key.GetValueCount();
-
-  reg_key.Close();
-
-  return true;
-}
-
-bool RegistryStore::GetValueNameAt(int index, CString* value_name) {
-  ASSERT1(index >= 0);
-  ASSERT1(value_name);
-
-  CString key_name(key_path_);
-  HKEY h_key = RegKey::GetRootKeyInfo(&key_name);
-
-  RegKey reg_key;
-  if (FAILED(reg_key.Open(h_key, key_name.GetString(), KEY_READ)))
-    return false;
-
-  HRESULT hr = reg_key.GetValueNameAt(index, value_name, NULL);
-
-  reg_key.Close();
-
-  return SUCCEEDED(hr);
-}
-
-}  // namespace omaha
-
diff --git a/base/registry_store.h b/base/registry_store.h
deleted file mode 100644
index d7e55cb..0000000
--- a/base/registry_store.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Declares class RegistryStore
-///////////////////////////////////////////////////////////////////////////
-
-#ifndef OMAHA_COMMON_REGISTRY_STORE_H__
-#define OMAHA_COMMON_REGISTRY_STORE_H__
-
-#include <wtypes.h>
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-class RegistryStore {
- public:
-  // Constructor
-  RegistryStore() {}
-
-  // Destructor
-  ~RegistryStore() {}
-
-  // Open the store
-  bool Open(const TCHAR* key_path);
-
-  // Close the store
-  bool Close();
-
-  // Clear the store
-  bool Clear();
-
-  // Read a value from the store
-  bool Read(const TCHAR* name, std::vector<byte>* data) const;
-
-  // Write a value to the store
-  bool Write(const TCHAR* name, byte* data, int data_size);
-
-  // Check to see a named value exists in the store
-  bool Exists(const TCHAR* name);
-
-  // Remove a value from the store
-  bool Remove(const TCHAR* name);
-
-  // Get the number of values for this key
-  bool GetValueCount(uint32* value_count);
-
-  // Get the value name for the given value name index
-  bool GetValueNameAt(int index, CString* value_name);
-
- private:
-  CString key_path_;      // Full path to the registry key
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_REGISTRY_STORE_H__
diff --git a/base/registry_store_unittest.cc b/base/registry_store_unittest.cc
deleted file mode 100644
index 6d7bdb3..0000000
--- a/base/registry_store_unittest.cc
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-//
-// Unit test for RegistryStore.
-
-#include "omaha/base/registry_store.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-static const TCHAR kRSTestKey[] =
-    _T("HKCU\\Software\\Google\\Common_Installer__TEST_STORE");
-static const TCHAR kRSTestName[] = _T("TestValueName");
-static const byte kRSTestValue[] = {0x01, 0x02, 0x03, 0x04, 0x05};
-static const int kRSTestValueSize = arraysize(kRSTestValue);
-
-TEST(RegistryStoreTest, RegistryStore) {
-  RegistryStore registry_store;
-  uint32 value_count = 42; // We want to make sure it's overwritten with 0.
-  CString value_name;
-  std::vector<byte> data;
-
-  // Set up and get in a known state.
-  EXPECT_TRUE(registry_store.Open(kRSTestKey));
-  EXPECT_TRUE(registry_store.Clear());
-
-  // Add and test a single value
-  EXPECT_FALSE(registry_store.Exists(kRSTestName));
-  EXPECT_FALSE(registry_store.Read(kRSTestName, &data));
-  data.clear();
-
-  EXPECT_TRUE(registry_store.Write(kRSTestName,
-                                   const_cast<byte*>(kRSTestValue),
-                                   kRSTestValueSize));
-
-  EXPECT_TRUE(registry_store.Exists(kRSTestName));
-  EXPECT_TRUE(registry_store.Read(kRSTestName, &data));
-  EXPECT_EQ(data.size(), kRSTestValueSize);
-  for (int i = 0; i < kRSTestValueSize; i++)
-    EXPECT_EQ(data[i], kRSTestValue[i]);
-
-  // Remove and re-add value
-  EXPECT_TRUE(registry_store.Remove(kRSTestName));
-  EXPECT_FALSE(registry_store.Exists(kRSTestName));
-  EXPECT_TRUE(registry_store.GetValueCount(&value_count));
-  EXPECT_EQ(value_count, 0);
-  EXPECT_TRUE(registry_store.Write(kRSTestName,
-                                   const_cast<byte*>(kRSTestValue),
-                                   kRSTestValueSize));
-  EXPECT_TRUE(registry_store.GetValueCount(&value_count));
-  EXPECT_EQ(value_count, 1);
-  EXPECT_TRUE(registry_store.GetValueNameAt(0, &value_name));
-  EXPECT_TRUE(value_name == kRSTestName);
-
-  // Clean up and finish.
-  EXPECT_TRUE(registry_store.Clear());
-  EXPECT_FALSE(registry_store.Exists(kRSTestName));
-  EXPECT_FALSE(registry_store.GetValueCount(&value_count));
-  EXPECT_TRUE(registry_store.Close());
-}
-
-}  // namespace omaha
diff --git a/base/run_as_invoker.manifest b/base/run_as_invoker.manifest
deleted file mode 100644
index 005db1b..0000000
--- a/base/run_as_invoker.manifest
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
-  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
-    <security>
-      <requestedPrivileges>
-        <requestedExecutionLevel level="asInvoker" />
-      </requestedPrivileges>
-    </security>
-  </trustInfo>
-  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
-    <application>
-      <!--The ID below indicates application support for Windows Vista -->
-      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
-      <!--The ID below indicates application support for Windows 7 -->
-      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
-    </application>
-  </compatibility>
-</assembly>
diff --git a/base/run_as_invoker.rc b/base/run_as_invoker.rc
deleted file mode 100644
index 8c37334..0000000
--- a/base/run_as_invoker.rc
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <afxres.h>
-
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-
-1 RT_MANIFEST "omaha/base/run_as_invoker.manifest"
diff --git a/base/safe_format.cc b/base/safe_format.cc
deleted file mode 100644
index e52c749..0000000
--- a/base/safe_format.cc
+++ /dev/null
@@ -1,163 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <algorithm>
-#include "omaha/base/debug.h"
-#include "omaha/base/safe_format.h"
-
-namespace omaha {
-
-namespace {
-
-// Define a templated wrapper for StringCchVPrintf_() that will call the
-// appropriate W/A version based on template parameter.
-template <typename CharType>
-HRESULT InternalStringCchVPrintf(CharType* dest_buffer,
-                                 size_t dest_size,
-                                 const CharType* format_str,
-                                 va_list arg_list);
-
-template <>
-HRESULT InternalStringCchVPrintf<char>(char* dest_buffer,
-                                       size_t dest_size,
-                                       const char* format_str,
-                                       va_list arg_list) {
-  return ::StringCchVPrintfA(dest_buffer, dest_size, format_str, arg_list);
-}
-
-template <>
-HRESULT InternalStringCchVPrintf<wchar_t>(wchar_t* dest_buffer,
-                                          size_t dest_size,
-                                          const wchar_t* format_str,
-                                          va_list arg_list) {
-  return ::StringCchVPrintfW(dest_buffer, dest_size, format_str, arg_list);
-}
-
-// Define a templated wrapper for strlen() that will call the appropriate
-// W/A version based on template parameter.
-template <typename CharType>
-size_t InternalStrlen(const CharType* str);
-
-template <>
-size_t InternalStrlen<char>(const char* str) {
-  return ::strlen(str);
-}
-
-template <>
-size_t InternalStrlen<wchar_t>(const wchar_t* str) {
-  return ::wcslen(str);
-}
-
-// InternalCStringVPrintf() wraps InternalStringCchVPrintf() to accept a
-// CStringT as the output parameter and resize it until the latter succeeds
-// or we hit the StrSafe.h limit.
-template <typename CharType, typename CharTraits>
-HRESULT InternalCStringVPrintf(
-               ATL::CStringT<CharType, CharTraits>& dest_str,
-               const CharType* format_str,
-               va_list arg_list) {
-  size_t buf_length = std::max(InternalStrlen(format_str),
-                               static_cast<size_t>(256));
-
-  for (;;) {
-    CStrBufT<CharType> str_buf(dest_str, buf_length);
-    HRESULT hr = InternalStringCchVPrintf(static_cast<CharType*>(str_buf),
-                                    buf_length - 1,
-                                    format_str,
-                                    arg_list);
-    if (hr != STRSAFE_E_INSUFFICIENT_BUFFER) {
-      return hr;
-    }
-    if (buf_length >= STRSAFE_MAX_CCH) {
-      return STRSAFE_E_INVALID_PARAMETER;
-    }
-    buf_length = std::min(buf_length * 2, static_cast<size_t>(STRSAFE_MAX_CCH));
-  }
-}
-
-// InternalCStringVPrintf() will have an overflow bug if STRSAFE_MAX_CCH ever
-// becomes larger than MAX_SIZE_T / 2.  Ensure at compile time that this is so.
-COMPILE_ASSERT(STRSAFE_MAX_CCH <= SIZE_MAX / 2, strsafe_limit_has_changed);
-
-}  // namespace
-
-// Define the non-templated API calls.
-
-void SafeCStringWFormatV(CStringW* dest_str,
-                         LPCWSTR format_str,
-                         va_list arg_list) {
-  ASSERT1(dest_str);
-  ASSERT1(format_str);
-  VERIFY1(SUCCEEDED(InternalCStringVPrintf(*dest_str, format_str, arg_list)));
-}
-
-void SafeCStringAFormatV(CStringA* dest_str,
-                         LPCSTR format_str,
-                         va_list arg_list) {
-  ASSERT1(dest_str);
-  ASSERT1(format_str);
-  VERIFY1(SUCCEEDED(InternalCStringVPrintf(*dest_str, format_str, arg_list)));
-}
-
-void SafeCStringWFormat(CStringW* dest_str, LPCWSTR format_str, ...) {
-  ASSERT1(dest_str);
-  ASSERT1(format_str);
-
-  va_list arg_list;
-  va_start(arg_list, format_str);
-  VERIFY1(SUCCEEDED(InternalCStringVPrintf(*dest_str, format_str, arg_list)));
-  va_end(arg_list);
-}
-
-void SafeCStringAFormat(CStringA* dest_str, LPCSTR format_str, ...) {
-  ASSERT1(dest_str);
-  ASSERT1(format_str);
-
-  va_list arg_list;
-  va_start(arg_list, format_str);
-  VERIFY1(SUCCEEDED(InternalCStringVPrintf(*dest_str, format_str, arg_list)));
-  va_end(arg_list);
-}
-
-void SafeCStringWAppendFormat(CStringW* dest_str, LPCWSTR format_str, ...) {
-  ASSERT1(dest_str);
-  ASSERT1(format_str);
-
-  va_list arg_list;
-  va_start(arg_list, format_str);
-
-  CStringW append_str;
-  VERIFY1(SUCCEEDED(InternalCStringVPrintf(append_str, format_str, arg_list)));
-  dest_str->Append(append_str);
-
-  va_end(arg_list);
-}
-
-void SafeCStringAAppendFormat(CStringA* dest_str, LPCSTR format_str, ...) {
-  ASSERT1(dest_str);
-  ASSERT1(format_str);
-
-  va_list arg_list;
-  va_start(arg_list, format_str);
-
-  CStringA append_str;
-  VERIFY1(SUCCEEDED(InternalCStringVPrintf(append_str, format_str, arg_list)));
-  dest_str->Append(append_str);
-
-  va_end(arg_list);
-}
-
-}  // namespace omaha
-
diff --git a/base/safe_format.h b/base/safe_format.h
deleted file mode 100644
index 421441d..0000000
--- a/base/safe_format.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// As of Sept 2010, the implementation of Format() in ATL's CStringT uses a
-// fixed internal buffer of 1024 bytes; any output beyond that point will
-// be silently truncated.  (AppendFormat() is affected by the same bug.)
-// A bug has been filed with Microsoft; in the meantime, we provide the
-// following safer implementations of Format/AppendFormat.  These functions
-// currently support up to MAX_INT characters and will return an HRESULT
-// error code on overflow or invalid parameters.
-
-#ifndef OMAHA_BASE_SAFE_FORMAT_H_
-#define OMAHA_BASE_SAFE_FORMAT_H_
-
-#include <atlstr.h>
-#include <strsafe.h>
-
-namespace omaha {
-
-void SafeCStringWFormatV(CStringW* dest_str,
-                         LPCWSTR format_str,
-                         va_list arg_list);
-
-void SafeCStringAFormatV(CStringA* dest_str,
-                         LPCSTR format_str,
-                         va_list arg_list);
-
-void SafeCStringWFormat(CStringW* dest_str, LPCWSTR format_str, ...);
-
-void SafeCStringAFormat(CStringA* dest_str, LPCSTR format_str, ...);
-
-void SafeCStringWAppendFormat(CStringW* dest_str, LPCWSTR format_str, ...);
-
-void SafeCStringAAppendFormat(CStringA* dest_str, LPCSTR format_str, ...);
-
-}  // namespace omaha
-
-#ifdef UNICODE
-#define SafeCStringFormatV       SafeCStringWFormatV
-#define SafeCStringFormat        SafeCStringWFormat
-#define SafeCStringAppendFormat  SafeCStringWAppendFormat
-#else
-#define SafeCStringFormatV       SafeCStringAFormatV
-#define SafeCStringFormat        SafeCStringAFormat
-#define SafeCStringAppendFormat  SafeCStringAAppendFormat
-#endif  // UNICODE
-
-#endif  // OMAHA_BASE_SAFE_FORMAT_H_
diff --git a/base/safe_format_unittest.cc b/base/safe_format_unittest.cc
deleted file mode 100644
index d404306..0000000
--- a/base/safe_format_unittest.cc
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// SafeCStringFormat unit tests.
-
-#include "omaha/base/safe_format.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(SafeFormatTest, BrokenCStringFormatTruncates) {
-  // TODO(omaha): See http://b/1016121 for details.  As of Sept 2010,
-  // CString::Format() is implemented using ::wvsprintf(), which has
-  // an internal 1024-byte buffer limit.  A bug has been filed with
-  // Microsoft.  If this test breaks, it means that we have gotten a
-  // new version of ATL/MFC with a fixed CString and can use that
-  // instead of SafeCStrFormat/AppendFormat.
-
-  TCHAR largestr[4000] = { 0 };
-
-  for (int i = 0; i < ARRAYSIZE(largestr); ++i) {
-    largestr[i] = _T('a') + static_cast<TCHAR>(i % 26);
-  }
-  largestr[ARRAYSIZE(largestr) - 1] = _T('\0');
-
-  CString test_string;
-  test_string.Format(_T("%s"), largestr);
-  EXPECT_EQ(1024, test_string.GetLength());
-  test_string.AppendFormat(_T("%s"), largestr);
-  EXPECT_EQ(2048, test_string.GetLength());
-}
-
-TEST(SafeFormatTest, SafeFormatDoesNotTruncate) {
-  TCHAR largestr[4000] = { 0 };
-
-  for (int i = 0; i < ARRAYSIZE(largestr); ++i) {
-    largestr[i] = _T('a') + static_cast<TCHAR>(i % 26);
-  }
-  largestr[ARRAYSIZE(largestr) - 1] = _T('\0');
-
-  CString test_string;
-  SafeCStringFormat(&test_string, _T("%s"), largestr);
-  EXPECT_EQ(ARRAYSIZE(largestr) - 1, test_string.GetLength());
-
-  SafeCStringAppendFormat(&test_string, _T("%s"), largestr);
-  EXPECT_EQ(2 * (ARRAYSIZE(largestr) - 1), test_string.GetLength());
-}
-
-TEST(SafeFormatTest, FormatBasicFieldTypes) {
-  CString test_string;
-
-  test_string.Empty();
-  SafeCStringFormat(&test_string, _T("%%"));
-  EXPECT_STREQ(_T("%"), test_string);
-
-  test_string.Empty();
-  SafeCStringFormat(&test_string, _T("%c"), _T('h'));
-  EXPECT_STREQ(_T("h"), test_string);
-
-  test_string.Empty();
-  SafeCStringFormat(&test_string, _T("%d"), -42);
-  EXPECT_STREQ(_T("-42"), test_string);
-
-  test_string.Empty();
-  SafeCStringFormat(&test_string, _T("%6u"), 1337);
-  EXPECT_STREQ(_T("  1337"), test_string);
-
-  test_string.Empty();
-  SafeCStringFormat(&test_string, _T("%010X"), 3545084735U);
-  EXPECT_STREQ(_T("00D34DB33F"), test_string);
-
-  test_string.Empty();
-  SafeCStringFormat(&test_string, _T("%0.3f"), 123.456);
-  EXPECT_STREQ(_T("123.456"), test_string);
-
-  test_string.Empty();
-  SafeCStringFormat(&test_string, _T("\"%s\""), _T("ut_str"));
-  EXPECT_STREQ(_T("\"ut_str\""), test_string);
-
-  test_string.Empty();
-  SafeCStringFormat(&test_string, _T("\"%s\""), NULL);
-  EXPECT_STREQ(_T("\"(null)\""), test_string);
-}
-
-TEST(SafeFormatTest, AppendFormatBasicFieldTypes) {
-  const CString prefix = _T("ut_prefix");
-  CString test_string;
-
-  test_string = prefix;
-  SafeCStringAppendFormat(&test_string, _T("%%"));
-  EXPECT_STREQ(prefix + _T("%"), test_string);
-
-  test_string = prefix;
-  SafeCStringAppendFormat(&test_string, _T("%c"), _T('h'));
-  EXPECT_STREQ(prefix + _T("h"), test_string);
-
-  test_string = prefix;
-  SafeCStringAppendFormat(&test_string, _T("%d"), -42);
-  EXPECT_STREQ(prefix + _T("-42"), test_string);
-
-  test_string = prefix;
-  SafeCStringAppendFormat(&test_string, _T("%6u"), 1337);
-  EXPECT_STREQ(prefix + _T("  1337"), test_string);
-
-  test_string = prefix;
-  SafeCStringAppendFormat(&test_string, _T("%010X"), 3545084735U);
-  EXPECT_STREQ(prefix + _T("00D34DB33F"), test_string);
-
-  test_string = prefix;
-  SafeCStringAppendFormat(&test_string, _T("%0.3f"), 123.456);
-  EXPECT_STREQ(prefix + _T("123.456"), test_string);
-
-  test_string = prefix;
-  SafeCStringAppendFormat(&test_string, _T("\"%s\""), _T("ut_str"));
-  EXPECT_STREQ(prefix + _T("\"ut_str\""), test_string);
-
-  test_string = prefix;
-  SafeCStringAppendFormat(&test_string, _T("\"%s\""), NULL);
-  EXPECT_STREQ(prefix + _T("\"(null)\""), test_string);
-}
-
-TEST(SafeFormatTest, FormatComplex) {
-  CString test_string = _T("prefix: ");
-  SafeCStringAppendFormat(&test_string, _T("Test: %cx%08X '%s' %4d %0.2f"),
-                          _T('0'), 12648430, _T("utstr"), 42, 123.456);
-  EXPECT_STREQ(_T("prefix: Test: 0x00C0FFEE 'utstr'   42 123.46"), test_string);
-}
-
-}  // namespace omaha
diff --git a/base/scope_guard.h b/base/scope_guard.h
deleted file mode 100644
index d0227c9..0000000
--- a/base/scope_guard.h
+++ /dev/null
@@ -1,369 +0,0 @@
-//
-// Author: Andrei Alexandrescu - andrei@metalanguage.com
-//
-// The code below is based on the following article published in
-// C/C++ Users Journal by Andrei Alexandrescu:
-//
-// http://www.cuj.com/documents/s=8000/cujcexp1812alexandr/alexandr.htm
-//
-// ScopeGuard is useful when you need to perform automatic cleanup of resources.
-// This idiom is important when you want to assemble an operation out of several
-// atomic operations, each of which could fail.
-//
-// Usage
-// ------
-// Scope guard for objects:
-// void f(T& t) {
-//   std::vector<T> v;
-//   v.push_back(t);
-//   ScopeGuard guard = MakeObjGuard(v, &std::vector<T>v::pop_back);
-//   if (!Commit()) {
-//     return;
-//   }
-//   guard.Dismiss();     // removes the t from the vector in the case Commit fails
-// }
-//
-// Scope guard for functions:
-// void open();
-// void close(int i);
-// void g(int i) {
-//   open();
-//   ScopeGuard guard = MakeGuard(close, 0);
-//   if (!read()) {
-//       return;
-//   }
-//   if (!write()) {
-//       return;
-//   }
-// }
-//
-// Using the macros:
-// void g(int i) {
-//   open();
-//   ON_SCOPE_EXIT(close, 0);
-//   if (!read()) {
-//       return;
-//   }
-//   if (!write()) {
-//       return;
-//   }
-// }
-
-// TODO(omaha): provide support to run with or without exceptions enabled.
-// For now it assumes that the code is not throwing exceptions.
-#ifndef SCOPEGUARD_H_
-#define SCOPEGUARD_H_
-
-namespace omaha {
-
-template <class T>
-class RefHolder
-{
-  T& ref_;
-public:
-  RefHolder(T& ref) : ref_(ref) {}
-  operator T& () const
-  {
-    return ref_;
-  }
-private:
-    // Disable assignment - not implemented
-    RefHolder& operator=(const RefHolder&);
-};
-
-template <class T>
-inline RefHolder<T> ByRef(T& t)
-{
-  return RefHolder<T>(t);
-}
-
-class ScopeGuardImplBase
-{
-  ScopeGuardImplBase& operator =(const ScopeGuardImplBase&);
-protected:
-  ~ScopeGuardImplBase()
-  {
-  }
-  ScopeGuardImplBase(const ScopeGuardImplBase& other) throw()
-    : dismissed_(other.dismissed_)
-  {
-    other.Dismiss();
-  }
-  template <typename J>
-  static void SafeExecute(J& j) throw()
-  {
-    if (!j.dismissed_)
-    {
-      // TODO(omaha): assume this does not throw
-      j.Execute();
-    }
-  }
-
-  mutable bool dismissed_;
-public:
-  ScopeGuardImplBase() throw() : dismissed_(false)
-  {
-  }
-  void Dismiss() const throw()
-  {
-    dismissed_ = true;
-  }
-};
-
-typedef const ScopeGuardImplBase& ScopeGuard;
-
-template <typename F>
-class ScopeGuardImpl0 : public ScopeGuardImplBase
-{
-public:
-  static ScopeGuardImpl0<F> MakeGuard(F fun)
-  {
-    return ScopeGuardImpl0<F>(fun);
-  }
-  ~ScopeGuardImpl0() throw()
-  {
-    SafeExecute(*this);
-  }
-  void Execute()
-  {
-    fun_();
-  }
-protected:
-  ScopeGuardImpl0(F fun) : fun_(fun)
-  {
-  }
-  F fun_;
-};
-
-template <typename F>
-inline ScopeGuardImpl0<F> MakeGuard(F fun)
-{
-  return ScopeGuardImpl0<F>::MakeGuard(fun);
-}
-
-template <typename F, typename P1>
-class ScopeGuardImpl1 : public ScopeGuardImplBase
-{
-public:
-  static ScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1)
-  {
-    return ScopeGuardImpl1<F, P1>(fun, p1);
-  }
-  ~ScopeGuardImpl1() throw()
-  {
-    SafeExecute(*this);
-  }
-  void Execute()
-  {
-    fun_(p1_);
-  }
-protected:
-  ScopeGuardImpl1(F fun, P1 p1) : fun_(fun), p1_(p1)
-  {
-  }
-  F fun_;
-  const P1 p1_;
-};
-
-template <typename F, typename P1>
-inline ScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1)
-{
-  return ScopeGuardImpl1<F, P1>::MakeGuard(fun, p1);
-}
-
-template <typename F, typename P1, typename P2>
-class ScopeGuardImpl2: public ScopeGuardImplBase
-{
-public:
-  static ScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2)
-  {
-    return ScopeGuardImpl2<F, P1, P2>(fun, p1, p2);
-  }
-  ~ScopeGuardImpl2() throw()
-  {
-    SafeExecute(*this);
-  }
-  void Execute()
-  {
-    fun_(p1_, p2_);
-  }
-protected:
-  ScopeGuardImpl2(F fun, P1 p1, P2 p2) : fun_(fun), p1_(p1), p2_(p2)
-  {
-  }
-  F fun_;
-  const P1 p1_;
-  const P2 p2_;
-};
-
-template <typename F, typename P1, typename P2>
-inline ScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2)
-{
-  return ScopeGuardImpl2<F, P1, P2>::MakeGuard(fun, p1, p2);
-}
-
-template <typename F, typename P1, typename P2, typename P3>
-class ScopeGuardImpl3 : public ScopeGuardImplBase
-{
-public:
-  static ScopeGuardImpl3<F, P1, P2, P3> MakeGuard(F fun, P1 p1, P2 p2, P3 p3)
-  {
-    return ScopeGuardImpl3<F, P1, P2, P3>(fun, p1, p2, p3);
-  }
-  ~ScopeGuardImpl3() throw()
-  {
-    SafeExecute(*this);
-  }
-  void Execute()
-  {
-    fun_(p1_, p2_, p3_);
-  }
-protected:
-  ScopeGuardImpl3(F fun, P1 p1, P2 p2, P3 p3) : fun_(fun), p1_(p1), p2_(p2), p3_(p3)
-  {
-  }
-  F fun_;
-  const P1 p1_;
-  const P2 p2_;
-  const P3 p3_;
-};
-
-template <typename F, typename P1, typename P2, typename P3>
-inline ScopeGuardImpl3<F, P1, P2, P3> MakeGuard(F fun, P1 p1, P2 p2, P3 p3)
-{
-  return ScopeGuardImpl3<F, P1, P2, P3>::MakeGuard(fun, p1, p2, p3);
-}
-
-
-template <class Obj, typename MemFun>
-class ObjScopeGuardImpl0 : public ScopeGuardImplBase
-{
-public:
-  static ObjScopeGuardImpl0<Obj, MemFun> MakeObjGuard(Obj& obj, MemFun memFun)
-  {
-    return ObjScopeGuardImpl0<Obj, MemFun>(obj, memFun);
-  }
-  ~ObjScopeGuardImpl0() throw()
-  {
-    SafeExecute(*this);
-  }
-  void Execute()
-  {
-    (obj_.*memFun_)();
-  }
-protected:
-  ObjScopeGuardImpl0(Obj& obj, MemFun memFun)
-    : obj_(obj), memFun_(memFun) {}
-  Obj& obj_;
-  MemFun memFun_;
-};
-
-template <class Obj, typename MemFun>
-inline ObjScopeGuardImpl0<Obj, MemFun> MakeObjGuard(Obj& obj, MemFun memFun)
-{
-  return ObjScopeGuardImpl0<Obj, MemFun>::MakeObjGuard(obj, memFun);
-}
-
-template <class Obj, typename MemFun, typename P1>
-class ObjScopeGuardImpl1 : public ScopeGuardImplBase
-{
-public:
-  static ObjScopeGuardImpl1<Obj, MemFun, P1> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1)
-  {
-    return ObjScopeGuardImpl1<Obj, MemFun, P1>(obj, memFun, p1);
-  }
-  ~ObjScopeGuardImpl1() throw()
-  {
-    SafeExecute(*this);
-  }
-  void Execute()
-  {
-    (obj_.*memFun_)(p1_);
-  }
-protected:
-  ObjScopeGuardImpl1(Obj& obj, MemFun memFun, P1 p1)
-    : obj_(obj), memFun_(memFun), p1_(p1) {}
-  Obj& obj_;
-  MemFun memFun_;
-  const P1 p1_;
-};
-
-template <class Obj, typename MemFun, typename P1>
-inline ObjScopeGuardImpl1<Obj, MemFun, P1> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1)
-{
-  return ObjScopeGuardImpl1<Obj, MemFun, P1>::MakeObjGuard(obj, memFun, p1);
-}
-
-template <class Obj, typename MemFun, typename P1, typename P2>
-class ObjScopeGuardImpl2 : public ScopeGuardImplBase
-{
-public:
-  static ObjScopeGuardImpl2<Obj, MemFun, P1, P2> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2)
-  {
-    return ObjScopeGuardImpl2<Obj, MemFun, P1, P2>(obj, memFun, p1, p2);
-  }
-  ~ObjScopeGuardImpl2() throw()
-  {
-    SafeExecute(*this);
-  }
-  void Execute()
-  {
-    (obj_.*memFun_)(p1_, p2_);
-  }
-protected:
-  ObjScopeGuardImpl2(Obj& obj, MemFun memFun, P1 p1, P2 p2)
-    : obj_(obj), memFun_(memFun), p1_(p1), p2_(p2) {}
-  Obj& obj_;
-  MemFun memFun_;
-  const P1 p1_;
-  const P2 p2_;
-};
-
-template <class Obj, typename MemFun, typename P1, typename P2>
-inline ObjScopeGuardImpl2<Obj, MemFun, P1, P2> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2)
-{
-  return ObjScopeGuardImpl2<Obj, MemFun, P1, P2>::MakeObjGuard(obj, memFun, p1, p2);
-}
-
-template <class Obj, typename MemFun, typename P1, typename P2, typename P3>
-class ObjScopeGuardImpl3 : public ScopeGuardImplBase
-{
-public:
-  static ObjScopeGuardImpl3<Obj, MemFun, P1, P2, P3> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2, P3 p3)
-  {
-    return ObjScopeGuardImpl3<Obj, MemFun, P1, P2, P3>(obj, memFun, p1, p2, p3);
-  }
-  ~ObjScopeGuardImpl3() throw()
-  {
-    SafeExecute(*this);
-  }
-  void Execute()
-  {
-    (obj_.*memFun_)(p1_, p2_, p3_);
-  }
-protected:
-  ObjScopeGuardImpl3(Obj& obj, MemFun memFun, P1 p1, P2 p2, P3 p3)
-    : obj_(obj), memFun_(memFun), p1_(p1), p2_(p2), p3_(p3) {}
-  Obj& obj_;
-  MemFun memFun_;
-  const P1 p1_;
-  const P2 p2_;
-  const P3 p3_;
-};
-
-template <class Obj, typename MemFun, typename P1, typename P2, typename P3>
-inline ObjScopeGuardImpl3<Obj, MemFun, P1, P2, P3> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2, P3 p3)
-{
-  return ObjScopeGuardImpl3<Obj, MemFun, P1, P2, P3>::MakeObjGuard(obj, memFun, p1, p2, p3);
-}
-
-#define CONCATENATE_DIRECT(s1, s2) s1##s2
-#define CONCATENATE(s1, s2) CONCATENATE_DIRECT(s1, s2)
-#define ANONYMOUS_VARIABLE(str) CONCATENATE(str, __LINE__)
-
-#define ON_SCOPE_EXIT ScopeGuard ANONYMOUS_VARIABLE(scopeGuard) = MakeGuard
-#define ON_SCOPE_EXIT_OBJ ScopeGuard ANONYMOUS_VARIABLE(scopeGuard) = MakeObjGuard
-
-}  // namespace omaha
-
-#endif //SCOPEGUARD_H_
diff --git a/base/scoped_any.h b/base/scoped_any.h
deleted file mode 100644
index d7735f8..0000000
--- a/base/scoped_any.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// smartany library uses a poor compile time assert. It is actually generating
-// runtime code to call the constructor of the assert class. Most likely to
-// improve performance, the library uses a static instance of the compile time
-// assert object. In theory the code is not thread-safe. In practice, since the
-// compile time assert is an empty class, there should be no problems. The long
-// term solution requires changing smartany to use a better compile time assert
-// which is completely evaluated at compile time and it has no effects
-// whatsoever at runtime. Short term, the code should include these wrappers
-// to silence the compiler warning.
-
-#ifndef OMAHA_COMMON_SCOPED_ANY__
-#define OMAHA_COMMON_SCOPED_ANY__
-
-#pragma warning(push)
-// C4640: construction of local static object is not thread-safe
-#pragma warning(disable : 4640)
-#include "omaha/third_party/smartany/scoped_any.h"
-#pragma warning(pop)
-
-#endif  // OMAHA_COMMON_SCOPED_ANY__
-
diff --git a/base/scoped_current_directory.h b/base/scoped_current_directory.h
deleted file mode 100644
index ecb2aba..0000000
--- a/base/scoped_current_directory.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_SCOPED_CURRENT_DIRECTORY_H_
-#define OMAHA_COMMON_SCOPED_CURRENT_DIRECTORY_H_
-
-namespace omaha {
-
-// Utility class to "scope" the setting of a current directory, and restore
-// to the previous current directory when leaving the scope.  Handles the
-// case where we don't actually have a new current directory to switch to
-// (thus the parameter is the empty string).
-
-class scoped_current_directory {
-  public:
-    explicit scoped_current_directory(const TCHAR* new_directory) {
-      *was_directory_ = _T('\0');
-      if (new_directory && *new_directory) {
-        ::GetCurrentDirectory(arraysize(was_directory_), was_directory_);
-        ::SetCurrentDirectory(new_directory);
-      }
-    }
-    ~scoped_current_directory() {
-      if (*was_directory_) {
-        ::SetCurrentDirectory(was_directory_);
-      }
-    }
-  private:
-    TCHAR was_directory_[MAX_PATH];
-};
-
-}  // namespace omaha
-
-#endif // OMAHA_COMMON_SCOPED_CURRENT_DIRECTORY_H_
diff --git a/base/scoped_impersonation.h b/base/scoped_impersonation.h
deleted file mode 100644
index aa08849..0000000
--- a/base/scoped_impersonation.h
+++ /dev/null
@@ -1,173 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// TODO(omaha): deprecate and use ATL::CAccessToken instead.
-
-#ifndef OMAHA_BASE_SCOPED_IMPERSONATION_H_
-#define OMAHA_BASE_SCOPED_IMPERSONATION_H_
-
-#include <windows.h>
-#include <atlsecurity.h>
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/scoped_any.h"
-
-namespace omaha {
-
-inline void ImpersonateLoggedOnUserOrDie(HANDLE token) {
-  if (!::ImpersonateLoggedOnUser(token)) {
-    CORE_LOG(LE, (_T("[ImpersonateLoggedOnUser failed][0x%08x]"),
-                  HRESULTFromLastError()));
-    ::RaiseException(EXCEPTION_IMPERSONATION_FAILED,
-                     EXCEPTION_NONCONTINUABLE,
-                     0,
-                     NULL);
-  }
-}
-
-inline void RevertToSelfOrDie() {
-  if (!::RevertToSelf()) {
-    CORE_LOG(LE, (_T("[RevertToSelf failed][0x%08x]"), HRESULTFromLastError()));
-    ::RaiseException(EXCEPTION_REVERT_IMPERSONATION_FAILED,
-                     EXCEPTION_NONCONTINUABLE,
-                     0,
-                     NULL);
-  }
-}
-
-inline HRESULT smart_impersonate_helper(HANDLE token) {
-  if (!token) {
-    return S_FALSE;
-  }
-  return ::ImpersonateLoggedOnUser(token) ? S_OK : HRESULTFromLastError();
-}
-
-inline void smart_unimpersonate_helper(HRESULT result) {
-  if (result == S_OK) {
-    RevertToSelfOrDie();
-  }
-}
-
-typedef close_fun<void (*)(HRESULT), smart_unimpersonate_helper>
-    close_impersonation;
-
-typedef value_const<HRESULT, E_FAIL> impersonation_not_init;
-
-typedef scoped_any<HRESULT, close_impersonation, impersonation_not_init>
-    scoped_impersonation_close;
-
-// Manages the calls to ImpersonateLoggedOnUser and RevertToSelf. The input
-// token is allowed to be NULL in which case no impersonation/revert is
-// performed.
-struct scoped_impersonation {
-  explicit scoped_impersonation(HANDLE token)
-      : result_(smart_impersonate_helper(token)) {
-    HRESULT hr = result();
-    if (token && SUCCEEDED(hr)) {
-      CORE_LOG(L3, (_T("[Impersonation succeeded]")));
-    } else if (token && FAILED(hr)) {
-      CORE_LOG(LW, (_T("[Impersonation failed][0x%x]"), hr));
-    } else if (!token) {
-      CORE_LOG(LW, (_T("[Impersonation requested but the token was null]")));
-    }
-  }
-
-  HRESULT result() const { return get(result_); }
-
- private:
-  const scoped_impersonation_close result_;
-};
-
-class scoped_revert_to_self {
- public:
-  scoped_revert_to_self() {
-    token_.GetThreadToken(TOKEN_ALL_ACCESS);
-    if (token_.GetHandle()) {
-      RevertToSelfOrDie();
-    }
-  }
-  ~scoped_revert_to_self() {
-    if (token_.GetHandle()) {
-      ImpersonateLoggedOnUserOrDie(token_.GetHandle());
-    }
-  }
- private:
-  CAccessToken token_;
-};
-
-// Calls a function member using the security context of the process, and
-// re-impersonates after the call if the calling thread previously had a valid
-// thread token.
-// This is particularly useful when a thread running impersonated needs to
-// revert to self, call a member function, and impersonate back. If the callee
-// has a result type, it returns the result of the actual call as an out
-// parameter. The function crashes the process if either revert to self or
-// re-impersonation fails.
-
-// Callers for function members without arguments.
-template <typename T, typename R>
-R CallAsSelfAndImpersonate0(T* object, R (T::*pm)()) {
-  ASSERT1(object);
-  ASSERT1(pm);
-
-  scoped_revert_to_self revert_to_self;
-  return (object->*pm)();
-}
-
-// Callers for __stdcall function members with one argument.
-template <typename T, typename P1, typename R>
-R StdCallAsSelfAndImpersonate1(T* object, R (__stdcall T::*pm)(P1), P1 p1) {
-  ASSERT1(object);
-  ASSERT1(pm);
-
-  scoped_revert_to_self revert_to_self;
-  return (object->*pm)(p1);
-}
-
-// Callers for function members with one argument.
-template <typename T, typename P1, typename R>
-R CallAsSelfAndImpersonate1(T* object, R (T::*pm)(P1), P1 p1) {
-  ASSERT1(object);
-  ASSERT1(pm);
-
-  scoped_revert_to_self revert_to_self;
-  return (object->*pm)(p1);
-}
-
-// Callers for function members with two arguments.
-template <class T, typename P1, typename P2, class R>
-R CallAsSelfAndImpersonate2(T* object, R (T::*pm)(P1, P2), P1 p1, P2 p2) {
-  ASSERT1(object);
-  ASSERT1(pm);
-
-  scoped_revert_to_self revert_to_self;
-  return (object->*pm)(p1, p2);
-}
-
-// Callers for function members with three arguments.
-template <class T, typename P1, typename P2, typename P3, typename R>
-R CallAsSelfAndImpersonate3(T* object, R (T::*pm)(P1, P2, P3),
-                            P1 p1, P2 p2, P3 p3) {
-  ASSERT1(object);
-  ASSERT1(pm);
-
-  scoped_revert_to_self revert_to_self;
-  return (object->*pm)(p1, p2, p3);
-}
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_SCOPED_IMPERSONATION_H_
diff --git a/base/scoped_impersonation_unittest.cc b/base/scoped_impersonation_unittest.cc
deleted file mode 100644
index a476a34..0000000
--- a/base/scoped_impersonation_unittest.cc
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-#include "base/basictypes.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/scoped_impersonation.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/vista_utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(ScopedImpersonationTest, ImpersonateLoggedOnUser) {
-  scoped_handle token;
-  vista::GetLoggedOnUserToken(address(token));
-  if (token) {
-    scoped_impersonation impersonate_user(get(token));
-    EXPECT_EQ(impersonate_user.result(), S_OK);
-  }
-}
-
-TEST(ScopedImpersonationTest, ImpersonateLoggedOnUserNullHandle) {
-  scoped_impersonation impersonate_user(NULL);
-  EXPECT_EQ(impersonate_user.result(), S_FALSE);
-}
-
-
-}  // namespace omaha
-
diff --git a/base/scoped_ptr_address.h b/base/scoped_ptr_address.h
deleted file mode 100644
index 0fa6930..0000000
--- a/base/scoped_ptr_address.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Helper functions to enable a useful pattern of using scoped pointers in
-// which the ownership of the memory is transferred out to an empty
-// scoped_ptr or scoped_array.
-//
-// The usage pattern is as follows:
-//    void foo(Bar** b);
-//
-//    scoped_ptr<B> p;
-//    foo(address(p));
-//
-// To receive the ownwership of the resource the scoped pointer must be
-// empty, otherwise it will leak.
-//
-// As an implementation detail, the scoped pointers in "base/scoped_ptr.h" do
-// not offer support for this idiom. The code below may break if the
-// implementation of the scoped_ptr changes. The code works with the vast
-// majority of the scoped_ptr implementations though.
-//
-// TODO(omaha): add unit tests.
-
-#ifndef OMAHA_COMMON_SCOPED_PTR_ADDRESS__
-#define OMAHA_COMMON_SCOPED_PTR_ADDRESS__
-
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/debug.h"
-
-template <typename T>
-inline T** address(const scoped_ptr<T>& t) {
-  COMPILE_ASSERT(sizeof(T*) == sizeof(scoped_ptr<T>), types_do_not_match);
-  ASSERT1(!t.get());
-  return reinterpret_cast<T**>(&const_cast<scoped_ptr<T>&>(t));
-}
-
-template <typename T>
-inline T** address(const scoped_array<T>& t) {
-  COMPILE_ASSERT(sizeof(T*) == sizeof(scoped_ptr<T>), types_do_not_match);
-  ASSERT1(!t.get());
-  return reinterpret_cast<T**>(&const_cast<scoped_array<T>&>(t));
-}
-
-#endif // OMAHA_COMMON_SCOPED_PTR_ADDRESS__
-
diff --git a/base/scoped_ptr_cotask.h b/base/scoped_ptr_cotask.h
deleted file mode 100644
index 85dc2a1..0000000
--- a/base/scoped_ptr_cotask.h
+++ /dev/null
@@ -1,260 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Defines utility classes and functions which facilitate working with the
-// memory allocation functions CoTaskMemAlloc and CoTaskMemFree.
-
-#ifndef OMAHA_COMMON_SCOPED_PTR_COTASK_H__
-#define OMAHA_COMMON_SCOPED_PTR_COTASK_H__
-
-#include "omaha/base/debug.h"
-
-// scoped_ptr_cotask is identical to scoped_ptr, except that CoTaskMemFree is
-// called instead of delete.  For documentation of the interface, see
-// scoped_ptr.h.
-
-template <typename T>
-class scoped_ptr_cotask;
-
-template <typename T>
-scoped_ptr_cotask<T> make_scoped_ptr_cotask(T* p);
-
-template <typename T>
-class scoped_ptr_cotask {
- private:
-  T* ptr_;
-
-  scoped_ptr_cotask(scoped_ptr_cotask const &);
-  scoped_ptr_cotask & operator=(scoped_ptr_cotask const &);
-
-  friend scoped_ptr_cotask<T> make_scoped_ptr_cotask<T>(T* p);
-
- public:
-  typedef T element_type;
-
-  explicit scoped_ptr_cotask(T* p = 0): ptr_(p) {}
-
-  ~scoped_ptr_cotask() {
-    typedef char type_must_be_complete[sizeof(T)];
-    ::CoTaskMemFree(ptr_);
-  }
-
-  void reset(T* p = 0) {
-    typedef char type_must_be_complete[sizeof(T)];
-
-    if (ptr_ != p) {
-      ::CoTaskMemFree(ptr_);
-      ptr_ = p;
-    }
-  }
-
-  T& operator*() const {
-    assert(ptr_ != 0);
-    return *ptr_;
-  }
-
-  T* operator->() const  {
-    assert(ptr_ != 0);
-    return ptr_;
-  }
-
-  bool operator==(T* p) const {
-    return ptr_ == p;
-  }
-
-  bool operator!=(T* p) const {
-    return ptr_ != p;
-  }
-
-  T* get() const  {
-    return ptr_;
-  }
-
-  void swap(scoped_ptr_cotask & b) {
-    T* tmp = b.ptr_;
-    b.ptr_ = ptr_;
-    ptr_ = tmp;
-  }
-
-  T* release() {
-    T* tmp = ptr_;
-    ptr_ = 0;
-    return tmp;
-  }
-
- private:
-  template <typename U> bool operator==(scoped_ptr_cotask<U> const& p) const;
-  template <typename U> bool operator!=(scoped_ptr_cotask<U> const& p) const;
-};
-
-template <typename T>
-scoped_ptr_cotask<T> make_scoped_ptr_cotask(T* p) {
-  return scoped_ptr_cotask<T>(p);
-}
-
-template <typename T> inline
-void swap(scoped_ptr_cotask<T>& a, scoped_ptr_cotask<T>& b) {
-  a.swap(b);
-}
-
-template <typename T> inline
-bool operator==(T* p, const scoped_ptr_cotask<T>& b) {
-  return p == b.get();
-}
-
-template <typename T> inline
-bool operator!=(T* p, const scoped_ptr_cotask<T>& b) {
-  return p != b.get();
-}
-
-template <typename T>
-inline T** address(const scoped_ptr_cotask<T>& t) {
-  COMPILE_ASSERT(sizeof(T*) == sizeof(t), types_do_not_match);
-  ASSERT1(!t.get());
-  return reinterpret_cast<T**>(&const_cast<scoped_ptr_cotask<T>&>(t));
-}
-
-// scoped_array_cotask manages an array of pointers to objects allocated by
-// CoTaskMemAlloc.  The array is also allocated via CoTaskMemAlloc.  The
-// interface is similar to scoped_array, except that an array length must be
-// explicitly provided.  When the object is destructed, the array and each
-// element of the array are explicitly freed.
-
-template <typename T>
-class scoped_array_cotask;
-
-template <typename T>
-class scoped_array_cotask<T*> {
- private:
-  size_t count_;
-  T** ptr_;
-
-  scoped_array_cotask(scoped_array_cotask const &);
-  scoped_array_cotask & operator=(scoped_array_cotask const &);
-
- public:
-  typedef T* element_type;
-
-  explicit scoped_array_cotask(size_t c, T** p = 0)
-      : count_(c), ptr_(p) {
-    if (!ptr_) {
-      const size_t array_size = sizeof(T*) * count_;
-      ptr_ = static_cast<T**>(::CoTaskMemAlloc(array_size));
-      memset(ptr_, 0, array_size);
-    }
-  }
-
-  ~scoped_array_cotask() {
-    typedef char type_must_be_complete[sizeof(T*)];
-    if (ptr_) {
-      for (size_t i = 0; i < count_; ++i) {
-        ::CoTaskMemFree(ptr_[i]);
-      }
-      ::CoTaskMemFree(ptr_);
-    }
-  }
-
-  size_t size() const { return count_; }
-
-  void reset(size_t c, T** p = 0) {
-    typedef char type_must_be_complete[sizeof(T*)];
-
-    if (ptr_ != p) {
-      if (ptr_) {
-        for (size_t i = 0; i < count_; ++i) {
-          ::CoTaskMemFree(ptr_[i]);
-        }
-        ::CoTaskMemFree(ptr_);
-      }
-      ptr_ = p;
-    }
-    count_ = c;
-    if (!ptr_) {
-      const size_t array_size = sizeof(T*) * count_;
-      ptr_ = static_cast<T**>(::CoTaskMemAlloc(array_size));
-      memset(ptr_, 0, array_size);
-    }
-  }
-
-  T*& operator[](std::ptrdiff_t i) const {
-    assert(ptr_ != 0);
-    assert(i >= 0);
-    return ptr_[i];
-  }
-
-  bool operator==(T** p) const {
-    return ptr_ == p;
-  }
-
-  bool operator!=(T** p) const {
-    return ptr_ != p;
-  }
-
-  T** get() const {
-    return ptr_;
-  }
-
-  void swap(scoped_array_cotask & b) {
-    T** tmp = b.ptr_;
-    b.ptr_ = ptr_;
-    ptr_ = tmp;
-  }
-
-  T** release() {
-    T** tmp = ptr_;
-    ptr_ = 0;
-    return tmp;
-  }
-
- private:
-  template <typename U> bool operator==(scoped_array_cotask<U> const& p) const;
-  template <typename U> bool operator!=(scoped_array_cotask<U> const& p) const;
-};
-
-template <typename T> inline
-void swap(scoped_array_cotask<T>& a, scoped_array_cotask<T>& b) {
-  a.swap(b);
-}
-
-template <typename T> inline
-bool operator==(T* p, const scoped_array_cotask<T>& b) {
-  return p == b.get();
-}
-
-template <typename T> inline
-bool operator!=(T* p, const scoped_array_cotask<T>& b) {
-  return p != b.get();
-}
-
-// address() is not relevant to scoped_array_cotask, due to the count parameter.
-//
-// template <typename T>
-// inline T** address(const scoped_array_cotask<T>& t) {
-//   COMPILE_ASSERT(sizeof(T*) == sizeof(t), types_do_not_match);
-//   ASSERT1(!t.get());
-//   return reinterpret_cast<T**>(&const_cast<scoped_array_cotask<T>&>(t));
-// }
-
-// StrDupCoTask allocates a copy of a string using CoTaskMemAlloc.
-
-template <class T>
-inline T* StrDupCoTask(const T* str, size_t length) {
-  T* mem = static_cast<T*>(::CoTaskMemAlloc(sizeof(T) * (length + 1)));
-  memcpy(mem, str, sizeof(T) * length);
-  mem[length] = 0;
-  return mem;
-}
-
-#endif  // OMAHA_COMMON_SCOPED_PTR_COTASK_H__
diff --git a/base/scoped_ptr_cotask_unittest.cc b/base/scoped_ptr_cotask_unittest.cc
deleted file mode 100644
index 8b22d2c..0000000
--- a/base/scoped_ptr_cotask_unittest.cc
+++ /dev/null
@@ -1,308 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <vector>
-#include "omaha/base/debug.h"
-#include "omaha/base/scoped_ptr_cotask.h"
-#include "omaha/testing/unit_test.h"
-
-// TestMallocSpy monitors CoTaskMemAlloc/Free, and records statistics about
-// them.
-
-class TestMallocSpy : public IMallocSpy {
- public:
-  struct Alloc {
-    size_t size;
-    void* ptr;
-    bool freed;
-  };
-
-  TestMallocSpy() : ref_(1) {}
-
-  virtual ~TestMallocSpy() {}
-
-  size_t NumAllocs() const { return allocs_.size(); }
-
-  const Alloc* GetAlloc(size_t i) const {
-    if (i >= allocs_.size())
-      return NULL;
-    return &allocs_[i];
-  }
-
-  size_t NumFrees() const { return frees_.size(); }
-
-  const Alloc* GetFree(size_t i) const {
-    if (i >= frees_.size())
-      return NULL;
-    ASSERT1(frees_[i] < allocs_.size());
-    return &allocs_[frees_[i]];
-  }
-
-  // IUnknown methods
-  virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppv) {
-    if (NULL == ppv) {
-      return E_POINTER;
-    }
-    if (::IsEqualIID(__uuidof(IUnknown), riid) ||
-        ::IsEqualIID(__uuidof(IMallocSpy), riid)) {
-      AddRef();
-      *ppv = static_cast<IUnknown*>(this);
-      return S_OK;
-    }
-    *ppv = NULL;
-    return E_NOINTERFACE;
-  }
-  virtual ULONG STDMETHODCALLTYPE AddRef() {
-    return ++ref_;
-  }
-  virtual ULONG STDMETHODCALLTYPE Release() {
-    ULONG r = --ref_;
-    if (0 == r) {
-      delete this;
-    }
-    return r;
-  }
-
-  // IMallocSpy methods
-  virtual SIZE_T STDMETHODCALLTYPE PreAlloc(SIZE_T request_size) {
-    Alloc a = { request_size, NULL, false };
-    allocs_.push_back(a);
-    return request_size;
-  }
-  virtual void* STDMETHODCALLTYPE PostAlloc(void* actual) {
-    ASSERT1(!allocs_.empty());
-    ASSERT1(NULL == allocs_.back().ptr);
-    allocs_.back().ptr = actual;
-    return actual;
-  }
-  virtual void* STDMETHODCALLTYPE PreFree(void* request, BOOL spyed) {
-    if (spyed) {
-      bool found = false;
-      for (size_t i = 0; i < allocs_.size(); ++i) {
-        if ((allocs_[i].ptr == request) && !allocs_[i].freed) {
-          allocs_[i].freed = true;
-          frees_.push_back(i);
-          found = true;
-          break;
-        }
-      }
-      ASSERT1(found);
-    }
-    return request;
-  }
-  virtual void STDMETHODCALLTYPE PostFree(BOOL) {}
-  virtual SIZE_T STDMETHODCALLTYPE PreRealloc(void*,
-                                              SIZE_T request_size,
-                                              void**,
-                                              BOOL) {
-    return request_size;
-  }
-  virtual void* STDMETHODCALLTYPE PostRealloc(void* actual, BOOL) {
-    return actual;
-  }
-  virtual void* STDMETHODCALLTYPE PreGetSize(void* request, BOOL) {
-    return request;
-  }
-  virtual SIZE_T STDMETHODCALLTYPE PostGetSize(SIZE_T actual_size, BOOL) {
-    return actual_size;
-  }
-  virtual void* STDMETHODCALLTYPE PreDidAlloc(void* request, BOOL) {
-    return request;
-  }
-  virtual int STDMETHODCALLTYPE PostDidAlloc(void*, BOOL, int fActual) {
-    return fActual;
-  }
-  virtual void STDMETHODCALLTYPE PreHeapMinimize() {}
-  virtual void STDMETHODCALLTYPE PostHeapMinimize() {}
-
- private:
-  ULONG ref_;
-  std::vector<Alloc> allocs_;
-  std::vector<size_t> frees_;
-};
-
-// MallocTest runs tests with a TestMallocSpy installed.
-
-class MallocTest : public testing::Test {
- public:
-  virtual void SetUp() {
-    spy_.Attach(new TestMallocSpy);
-    ASSERT_SUCCEEDED(::CoRegisterMallocSpy(spy_.p));
-    EXPECT_EQ(0, spy()->NumAllocs());
-  }
-  virtual void TearDown() {
-    EXPECT_EQ(spy()->NumAllocs(), spy()->NumFrees());
-    ASSERT_SUCCEEDED(::CoRevokeMallocSpy());
-  }
-  TestMallocSpy* spy() { return spy_.p; }
-
- private:
-  CComPtr<TestMallocSpy> spy_;
-};
-
-TEST_F(MallocTest, StrDupCoTask) {
-  const char kNarrowString[] = "Hello";
-  const size_t kNarrowLen = strlen(kNarrowString);
-  const wchar_t kWideString[] = L"World";
-  const size_t kWideLen = wcslen(kWideString);
-
-  // Test StrDupCoTask with narrow strings.
-  char* narrow_copy = StrDupCoTask(kNarrowString, kNarrowLen);
-
-  ASSERT_EQ(1, spy()->NumAllocs());
-  EXPECT_EQ(0, spy()->NumFrees());
-  EXPECT_EQ((kNarrowLen + 1) * sizeof(char), spy()->GetAlloc(0)->size);
-  EXPECT_EQ(narrow_copy, spy()->GetAlloc(0)->ptr);
-  EXPECT_FALSE(spy()->GetAlloc(0)->freed);
-
-  ::CoTaskMemFree(narrow_copy);
-
-  ASSERT_EQ(1, spy()->NumFrees());
-  EXPECT_EQ(spy()->GetAlloc(0), spy()->GetFree(0));
-  EXPECT_EQ(narrow_copy, spy()->GetFree(0)->ptr);
-  EXPECT_TRUE(spy()->GetFree(0)->freed);
-
-  // Test StrDupCoTask with wide strings.
-  wchar_t* wide_copy = StrDupCoTask(kWideString, kWideLen);
-
-  ASSERT_EQ(2, spy()->NumAllocs());
-  EXPECT_EQ(1, spy()->NumFrees());
-  EXPECT_EQ((kWideLen + 1) * sizeof(wchar_t), spy()->GetAlloc(1)->size);
-  EXPECT_EQ(wide_copy, spy()->GetAlloc(1)->ptr);
-  EXPECT_FALSE(spy()->GetAlloc(1)->freed);
-
-  ::CoTaskMemFree(wide_copy);
-
-  ASSERT_EQ(2, spy()->NumFrees());
-  EXPECT_EQ(spy()->GetAlloc(1), spy()->GetFree(1));
-  EXPECT_EQ(wide_copy, spy()->GetFree(1)->ptr);
-  EXPECT_TRUE(spy()->GetFree(1)->freed);
-}
-
-TEST_F(MallocTest, scoped_ptr_cotask) {
-  scoped_ptr_cotask<wchar_t>* string_ptr;
-
-  // Creating an empty ptr does no additional allocations.
-  string_ptr = new scoped_ptr_cotask<wchar_t>;
-  ASSERT_EQ(0, spy()->NumAllocs());
-  EXPECT_EQ(0, spy()->NumFrees());
-
-  // Assigning a string does not additional allocations.
-  string_ptr->reset(StrDupCoTask(L"hi", 2));
-  ASSERT_EQ(1, spy()->NumAllocs());
-  EXPECT_EQ(0, spy()->NumFrees());
-  EXPECT_EQ(3 * sizeof(wchar_t), spy()->GetAlloc(0)->size);
-  EXPECT_FALSE(spy()->GetAlloc(0)->freed);
-
-  EXPECT_EQ(0, memcmp(string_ptr->get(), L"hi", 3 * sizeof(wchar_t)));
-
-  // Replacing the string frees the old memory.
-  string_ptr->reset(StrDupCoTask(L"there", 5));
-  ASSERT_EQ(2, spy()->NumAllocs());
-  EXPECT_EQ(1, spy()->NumFrees());
-  EXPECT_EQ(6 * sizeof(wchar_t), spy()->GetAlloc(1)->size);
-  EXPECT_TRUE(spy()->GetAlloc(0)->freed);
-  EXPECT_FALSE(spy()->GetAlloc(1)->freed);
-
-  // Deleting the string frees the memory.
-  delete string_ptr;
-  ASSERT_EQ(2, spy()->NumAllocs());
-  EXPECT_EQ(2, spy()->NumFrees());
-  EXPECT_TRUE(spy()->GetAlloc(1)->freed);
-}
-
-TEST_F(MallocTest, scoped_array_cotask) {
-  const size_t kSize = 5;
-  scoped_array_cotask<wchar_t*>* string_array;
-
-  // Allocate an array of 5 empty elements.
-  string_array = new scoped_array_cotask<wchar_t*>(kSize);
-  ASSERT_EQ(kSize, string_array->size());
-  ASSERT_EQ(1, spy()->NumAllocs());
-  EXPECT_EQ(0, spy()->NumFrees());
-  EXPECT_EQ(kSize * sizeof(wchar_t*), spy()->GetAlloc(0)->size);
-
-  // Populate array elements.
-  for (size_t i = 0; i < kSize; ++i) {
-    EXPECT_TRUE(NULL == (*string_array)[i]);
-    (*string_array)[i] = StrDupCoTask(L"hi", 2);
-  }
-  EXPECT_EQ(1 + kSize, spy()->NumAllocs());
-  EXPECT_EQ(0, spy()->NumFrees());
-
-  // Get is idempotent.
-  wchar_t** ptr = string_array->get();
-  EXPECT_EQ(ptr, string_array->get());
-  EXPECT_EQ(ptr, spy()->GetAlloc(0)->ptr);
-  EXPECT_EQ(0, spy()->NumFrees());
-
-  // Release is not idempotent, but does not free memory.
-  ptr = string_array->release();
-  EXPECT_TRUE(NULL == string_array->release());
-  EXPECT_EQ(ptr, spy()->GetAlloc(0)->ptr);
-  EXPECT_EQ(0, spy()->NumFrees());
-
-  // Deleting a released array does not free memory.
-  delete string_array;
-  EXPECT_EQ(0, spy()->NumFrees());
-
-  // Constructing an array from existing memory, does not cause allocations.
-  string_array = new scoped_array_cotask<wchar_t*>(kSize, ptr);
-  EXPECT_EQ(1 + kSize, spy()->NumAllocs());
-  EXPECT_EQ(0, spy()->NumFrees());
-
-  // Deleting an array frees all elements and the array.
-  delete string_array;
-  ASSERT_EQ(1 + kSize, spy()->NumAllocs());
-  EXPECT_EQ(1 + kSize, spy()->NumFrees());
-  for (size_t i = 0; i < spy()->NumAllocs(); ++i) {
-    EXPECT_TRUE(spy()->GetAlloc(i)->freed);
-  }
-}
-
-TEST_F(MallocTest, scoped_array_cotask_reset) {
-  // This test exposes a former bug, where reset did not reallocate a new
-  // array after being released.
-
-  // Allocate an empty array.
-  const size_t kSize = 5;
-  scoped_array_cotask<int*>* array = new scoped_array_cotask<int*>(kSize);
-  ASSERT_EQ(1, spy()->NumAllocs());
-
-  // Release the array, to verify it was allocated.
-  int** first_raw_array = array->release();
-  EXPECT_TRUE(NULL != first_raw_array);
-  EXPECT_FALSE(spy()->GetAlloc(0)->freed);
-
-  // Allocate another empty array.
-  array->reset(kSize);
-  ASSERT_EQ(2, spy()->NumAllocs());
-
-  // Release the second array, to verify it was allocated.
-  int** second_raw_array = array->release();
-  EXPECT_TRUE(NULL != second_raw_array);
-  EXPECT_FALSE(spy()->GetAlloc(1)->freed);
-
-  // Use the scoped_array_cotask object to dispose of the allocated arrays.
-  array->reset(kSize, first_raw_array);
-  array->reset(kSize, second_raw_array);
-  delete array;
-
-  // Check the final conditions.
-  ASSERT_EQ(2, spy()->NumAllocs());
-  for (size_t i = 0; i < spy()->NumAllocs(); ++i) {
-    EXPECT_TRUE(spy()->GetAlloc(i)->freed);
-  }
-}
diff --git a/base/security/aes.c b/base/security/aes.c
deleted file mode 100644
index 47cbcf8..0000000
--- a/base/security/aes.c
+++ /dev/null
@@ -1,177 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Optimized for code size. Lacking decrypt functionality.
-// Currently 1042 bytes of code.
-
-#include "aes.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <memory.h>
-#include <inttypes.h>
-
-static const uint8_t sbox_e[256]= {
-    99  , 124 , 119 , 123 , 242 , 107 , 111 , 197
-  , 48  , 1   , 103 , 43  , 254 , 215 , 171 , 118
-  , 202 , 130 , 201 , 125 , 250 , 89  , 71  , 240
-  , 173 , 212 , 162 , 175 , 156 , 164 , 114 , 192
-  , 183 , 253 , 147 , 38  , 54  , 63  , 247 , 204
-  , 52  , 165 , 229 , 241 , 113 , 216 , 49  , 21
-  , 4   , 199 , 35  , 195 , 24  , 150 , 5   , 154
-  , 7   , 18  , 128 , 226 , 235 , 39  , 178 , 117
-  , 9   , 131 , 44  , 26  , 27  , 110 , 90  , 160
-  , 82  , 59  , 214 , 179 , 41  , 227 , 47  , 132
-  , 83  , 209 , 0   , 237 , 32  , 252 , 177 , 91
-  , 106 , 203 , 190 , 57  , 74  , 76  , 88  , 207
-  , 208 , 239 , 170 , 251 , 67  , 77  , 51  , 133
-  , 69  , 249 , 2   , 127 , 80  , 60  , 159 , 168
-  , 81  , 163 , 64  , 143 , 146 , 157 , 56  , 245
-  , 188 , 182 , 218 , 33  , 16  , 255 , 243 , 210
-  , 205 , 12  , 19  , 236 , 95  , 151 , 68  , 23
-  , 196 , 167 , 126 , 61  , 100 , 93  , 25  , 115
-  , 96  , 129 , 79  , 220 , 34  , 42  , 144 , 136
-  , 70  , 238 , 184 , 20  , 222 , 94  , 11  , 219
-  , 224 , 50  , 58  , 10  , 73  , 6   , 36  , 92
-  , 194 , 211 , 172 , 98  , 145 , 149 , 228 , 121
-  , 231 , 200 , 55  , 109 , 141 , 213 , 78  , 169
-  , 108 , 86  , 244 , 234 , 101 , 122 , 174 , 8
-  , 186 , 120 , 37  , 46  , 28  , 166 , 180 , 198
-  , 232 , 221 , 116 , 31  , 75  , 189 , 139 , 138
-  , 112 , 62  , 181 , 102 , 72  , 3   , 246 , 14
-  , 97  , 53  , 87  , 185 , 134 , 193 , 29  , 158
-  , 225 , 248 , 152 , 17  , 105 , 217 , 142 , 148
-  , 155 , 30  , 135 , 233 , 206 , 85  , 40  , 223
-  , 140 , 161 , 137 , 13  , 191 , 230 , 66  , 104
-  , 65  , 153 , 45  , 15  , 176 , 84  , 187 , 22
-  };
-
-static uint8_t xtime(int in) {
-  in <<= 1;
-  if( in&0x100 ) in ^= 0x11b;
-  return (uint8_t)in;
-  }
-
-static void expand_key(const uint8_t* key, uint32_t* expanded_key) {
-  int   nrounds;
-  union {
-    uint8_t b[16];
-    uint32_t w[4];
-    } W;
-  uint8_t xor = 1;
-
-  memcpy( &W, key, 16 );
-  memcpy( expanded_key, &W, 16 );
-
-  for( nrounds = 0; nrounds < 10; ++nrounds ) {
-
-      // update key schedule
-    W.b[0] ^= sbox_e[W.b[12+1]] ^ xor;
-    W.b[1] ^= sbox_e[W.b[12+2]];
-    W.b[2] ^= sbox_e[W.b[12+3]];
-    W.b[3] ^= sbox_e[W.b[12+0]];
-    W.w[1] ^= W.w[0];
-    W.w[2] ^= W.w[1];
-    W.w[3] ^= W.w[2];
-
-    xor = xtime( xor );
-
-    expanded_key += 4;
-    memcpy( expanded_key, &W, 16 );
-    }
-  }
-
-void AES_encrypt_block(const uint8_t* key, const uint8_t* in, uint8_t* out) {
-  int j, nrounds;
-  union {
-    uint8_t b[16];
-    uint32_t w[4];
-    } rd_state;
-  uint32_t expanded_key[11 * 4];
-  uint32_t* expkey = &expanded_key[0];
-
-  expand_key( key, expanded_key );
-
-  memcpy( &rd_state, in, 16 );
-
-    // xor with initial key
-  rd_state.w[0] ^= *expkey++;
-  rd_state.w[1] ^= *expkey++;
-  rd_state.w[2] ^= *expkey++;
-  rd_state.w[3] ^= *expkey++;
-
-  nrounds = 10;
-
-  do {
-    uint8_t tmp;
-
-      // bytesub && shiftrow
-
-      // 1st
-    rd_state.b[0] = sbox_e[rd_state.b[0]];
-    rd_state.b[4] = sbox_e[rd_state.b[4]];
-    rd_state.b[8] = sbox_e[rd_state.b[8]];
-    rd_state.b[12] = sbox_e[rd_state.b[12]];
-
-      // 2nd
-    tmp = rd_state.b[1];
-    rd_state.b[1] = sbox_e[rd_state.b[5]];
-    rd_state.b[5] = sbox_e[rd_state.b[9]];
-    rd_state.b[9] = sbox_e[rd_state.b[13]];
-    rd_state.b[13] = sbox_e[tmp];
-
-      // 3th
-    tmp = rd_state.b[2];
-    rd_state.b[2] = sbox_e[rd_state.b[10]];
-    rd_state.b[10] = sbox_e[tmp];
-    tmp = rd_state.b[6];
-    rd_state.b[6] = sbox_e[rd_state.b[14]];
-    rd_state.b[14] = sbox_e[tmp];
-
-      // 4th
-    tmp = rd_state.b[3];
-    rd_state.b[3] = sbox_e[rd_state.b[15]];
-    rd_state.b[15] = sbox_e[rd_state.b[11]];
-    rd_state.b[11] = sbox_e[rd_state.b[7]];
-    rd_state.b[7] = sbox_e[tmp];
-
-      // mixcolumn except for last round
-    if( --nrounds ) {
-      for( j = 0; j < 16; j += 4 ) {
-        uint8_t tmp =
-            rd_state.b[j+0] ^
-            rd_state.b[j+1] ^
-            rd_state.b[j+2] ^
-            rd_state.b[j+3];
-
-        rd_state.b[j+0] ^= xtime( rd_state.b[j+0] ^ rd_state.b[j+1] ) ^ tmp;
-        rd_state.b[j+1] ^= xtime( rd_state.b[j+1] ^ rd_state.b[j+2] ) ^ tmp;
-        rd_state.b[j+2] ^= xtime( rd_state.b[j+2] ^ rd_state.b[j+3] ) ^ tmp;
-        rd_state.b[j+3] =
-            rd_state.b[j+0] ^
-            rd_state.b[j+1] ^
-            rd_state.b[j+2] ^
-            tmp;
-        }
-      }
-
-    rd_state.w[0] ^= *expkey++;
-    rd_state.w[1] ^= *expkey++;
-    rd_state.w[2] ^= *expkey++;
-    rd_state.w[3] ^= *expkey++;
-  } while( nrounds );
-
-  memcpy( out, &rd_state, 16 );
-}
diff --git a/base/security/aes.h b/base/security/aes.h
deleted file mode 100644
index 9277d5e..0000000
--- a/base/security/aes.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_SECURITY_AES_H__
-#define OMAHA_COMMON_SECURITY_AES_H__
-
-#include <inttypes.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Encrypt a block.
-// Both key and block size are 128 bits.
-void AES_encrypt_block(const uint8_t* key,
-                       const uint8_t* in,
-                       uint8_t* out );
-
-#define AES_BLOCK_SIZE 16
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  // OMAHA_COMMON_SECURITY_AES_H__
diff --git a/base/security/b64.c b/base/security/b64.c
deleted file mode 100644
index 2d95cfc..0000000
--- a/base/security/b64.c
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "b64.h"
-
-static const char b64outmap[64] = {
-  'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
-  'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
-  'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
-  'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
-  '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_'
-};
-
-static const char b64inmap[96] = {
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0,
-  53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 0, 0, 0, 0, 0, 0,
-  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
-  16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 0, 0, 0, 64,
-  0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
-  42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 0, 0, 0, 0, 0,
-};
-
-int B64_encode(const uint8_t* input,
-               int input_length,
-               char* output,
-               int output_max) {
-  unsigned int accu = 0;
-  int shift = 0;
-  int output_size = 0;
-
-  while (input_length--) {
-    accu <<= 8;
-    accu |= *input++;
-    shift += 8;
-
-    while (shift >= 6) {
-      if (output_size >= output_max) return -1;  // out of output space
-      output[output_size++] = b64outmap[(accu >> (shift - 6)) & 63];
-      shift -= 6;
-    }
-  }
-  if (shift) {
-    if (output_size >= output_max) return -1;  // out of output space
-    accu <<= 8;  // pad with 0 byte really
-    shift += 8;
-    output[output_size++] = b64outmap[(accu >> (shift - 6)) & 63];
-  }
-
-  // Output terminating 0
-  if (output_size >= output_max) return -1;  // out of output space
-  output[output_size] = '\0';
-
-  return output_size;
-}
-
-int B64_decode(const char* input,
-               uint8_t* output,
-               int output_max) {
-  unsigned int accu = 0;
-  int shift = 0;
-  int output_size = 0;
-
-  while (*input) {
-    unsigned char in = *input++ & 255;
-    if (in < 32 || in > 127 || !b64inmap[in - 32]) return -1;  // invalid input
-    accu <<= 6;
-    accu |= (b64inmap[in - 32] - 1);
-    shift += 6;
-    if (shift >= 8) {
-      if (output_size >= output_max) return -1;  // out of output space
-      output[output_size++] = (accu >> (shift - 8)) & 255;
-      shift -= 8;
-    }
-  }
-  return output_size;
-}
diff --git a/base/security/b64.h b/base/security/b64.h
deleted file mode 100644
index a48a931..0000000
--- a/base/security/b64.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_SECURITY_B64_H__
-#define OMAHA_COMMON_SECURITY_B64_H__
-
-#include <inttypes.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int B64_encode(const uint8_t* input,
-              int input_length,
-              char* output,
-              int output_max);
-
-int B64_decode(const char* input,
-               uint8_t* output,
-               int output_max);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  // OMAHA_COMMON_SECURITY_B64_H__
diff --git a/base/security/build.scons b/base/security/build.scons
deleted file mode 100644
index d8703a4..0000000
--- a/base/security/build.scons
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-#
-# Build Security library
-#
-security_env = env.Clone()
-
-security_env.Append(
-    CPPPATH = [
-        '$MAIN_DIR/third_party/c99/include',
-        ],
-    CCFLAGS = [
-        '/wd4242',  # conversion from 'type1' to 'type2', possible loss of data
-        '/wd4244',  # conversion from 'type1' to 'type2', possible loss of data
-        '/wd4510',  # default constructor could not be generated
-        '/wd4610',  # object 'class' can never be instantiated
-        ],
-)
-
-
-security_inputs = [
-    'aes.c',
-    'b64.c',
-    'challenger.cc',
-    'hmac.c',
-    'md5.c',
-    'rc4.c',
-    'rsa.cc',
-    'sha.c',
-    ]
-
-# Precompiled headers cannot be used with C files.
-security_env.ComponentStaticLibrary('security',
-                                    security_inputs,
-                                    use_pch_default=False)
diff --git a/base/security/challenger.cc b/base/security/challenger.cc
deleted file mode 100644
index ab3ee95..0000000
--- a/base/security/challenger.cc
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "challenger.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "rsa.h"
-#include "md5.h"
-#include "aes.h"
-#include "b64.h"
-
-// Windows compilers do not have C99 support yet.
-#if defined(WIN32) || defined(_WIN32)
-#ifndef snprintf
-#define snprintf _snprintf
-#endif
-#endif
-
-Challenger::Challenger(RSA::PublicKey pkey,
-                       const unsigned char* seed, int seed_size)
-    : rsa_(pkey) {
-  memset(count_, 0, sizeof(count_));
-  // Use seed as key for AES. Compress seed first.
-  MD5(seed, seed_size, seed_);
-}
-
-const char* Challenger::challenge() {
-  uint8_t ctr[AES_BLOCK_SIZE];
-
-  // Compute current challenge.
-  AES_encrypt_block(seed_, count_, ctr);
-
-  // Increment count for future fresh challenges.
-  for (size_t i = 0; i < sizeof(count_) && !++count_[i]; ++i);
-
-  // Prepend our version number.
-  char* p = challenge_;
-  p += snprintf(challenge_, sizeof(challenge_), "%d:", rsa_.version());
-
-  // Append our current challenge.
-  B64_encode(ctr, sizeof(ctr), p, sizeof(challenge_) - (p - challenge_));
-
-  return challenge_;
-}
-
-bool Challenger::verify(const char* hash, const char* signature) const {
-  char message[128];
-  uint8_t sigbuf[128];
-
-  // Expect exactly 128 bytes of decoded signature data.
-  if (B64_decode(signature, sigbuf, sizeof(sigbuf)) != sizeof(sigbuf))
-    return false;
-
-  // Verify signature with baked-in public key and recover embedded message.
-  int result = rsa_.verify(sigbuf, sizeof(sigbuf),
-                           message, sizeof(message) - 1);
-
-  if (result < 0 || result >= static_cast<int>(sizeof(message) - 1))
-    return false;
-
-  // Since we're expecting a textual message, 0-terminate it.
-  message[result] = '\0';
-
-  // Construct and compare expected against received signed message.
-  char expected[128];
-  snprintf(expected, sizeof(expected), "%s:%s", challenge_, hash);
-
-  return !strcmp(expected, message);
-}
diff --git a/base/security/challenger.h b/base/security/challenger.h
deleted file mode 100644
index d2d6e0a..0000000
--- a/base/security/challenger.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_SECURITY_CHALLENGER_H__
-#define OMAHA_COMMON_SECURITY_CHALLENGER_H__
-
-#include <inttypes.h>
-
-#include "md5.h"
-#include "aes.h"
-#include "rsa.h"
-
-class Challenger {
- public:
-  // Instantiate internal PRNG with seed. Use a proper method on your
-  // target platform to collect some entropy. For windows for instance,
-  // use CryptoAPI; on unix, read some from /dev/urandom.
-  // 128 bits of entropy is plenty.
-  explicit Challenger(RSA::PublicKey public_key,
-                      const uint8_t* seed, int seed_size);
-
-  // Not a const method! Every call updates internal state and never
-  // are identical challenges returned.
-  // Returns WebSafe base64 encoded string.
-  const char* challenge();
-
-  // Verifies whether signature contains current challenge and hash.
-  // Arguments are expected to be WebSafe base64 encoded strings.
-  bool verify(const char* hash, const char* signature) const;
-
- private:
-  char challenge_[64];
-  uint8_t count_[AES_BLOCK_SIZE];
-  uint8_t seed_[MD5_DIGEST_SIZE];
-  RSA rsa_;
-};
-
-#endif  // OMAHA_COMMON_SECURITY_CHALLENGER_H__
diff --git a/base/security/hash-internal.h b/base/security/hash-internal.h
deleted file mode 100644
index 9bade84..0000000
--- a/base/security/hash-internal.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_SECURITY_HASH_INTERNAL_H__
-#define OMAHA_COMMON_SECURITY_HASH_INTERNAL_H__
-
-#include <inttypes.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __cplusplus
-
-struct HASH_CTX;  // forward decl
-
-typedef struct HASH_VTAB {
-  void (* const init)(struct HASH_CTX*);
-  void (* const update)(struct HASH_CTX*, const void*, int);
-  const uint8_t* (* const final)(struct HASH_CTX*);
-  const uint8_t* (* const hash)(const void*, int, uint8_t*);
-  int size;
-} HASH_VTAB;
-
-typedef struct HASH_CTX {
-  const HASH_VTAB * f;
-  uint64_t count;
-  uint8_t buf[64];
-  uint32_t state[8];  // upto SHA2
-} HASH_CTX;
-
-#define HASH_init(ctx) (ctx)->f->init(ctx)
-#define HASH_update(ctx, data, len) (ctx)->f->update(ctx, data, len)
-#define HASH_final(ctx) (ctx)->f->final(ctx)
-#define HASH_hash(data, len, digest) (ctx)->f->hash(data, len, digest)
-#define HASH_size(ctx) (ctx)->f->size
-
-#ifdef __cplusplus
-}
-#endif  // __cplusplus
-
-#endif  // OMAHA_COMMON_SECURITY_HASH_INTERNAL_H__
diff --git a/base/security/hmac.c b/base/security/hmac.c
deleted file mode 100644
index f726da3..0000000
--- a/base/security/hmac.c
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Optimized for minimal code size.
-
-#include "hmac.h"
-
-#include <memory.h>
-#include "sha.h"
-#include "md5.h"
-
-static void HMAC_init(HMAC_CTX* ctx, const void* key, int len) {
-  int i;
-  memset(&ctx->opad[0], 0, sizeof(ctx->opad));
-
-  if (len > sizeof(ctx->opad)) {
-    HASH_init(&ctx->hash);
-    HASH_update(&ctx->hash, key, len);
-    memcpy(&ctx->opad[0], HASH_final(&ctx->hash), HASH_size(&ctx->hash));
-  } else {
-    memcpy(&ctx->opad[0], key, len);
-  }
-
-  for (i = 0; i < sizeof(ctx->opad); ++i) {
-    ctx->opad[i] ^= 0x36;
-  }
-
-  HASH_init(&ctx->hash);
-  HASH_update(&ctx->hash, ctx->opad, sizeof(ctx->opad));  // hash ipad
-
-  for (i = 0; i < sizeof(ctx->opad); ++i) {
-    ctx->opad[i] ^= (0x36 ^ 0x5c);
-  }
-}
-
-void HMAC_MD5_init(HMAC_CTX* ctx, const void* key, int len) {
-  MD5_init(&ctx->hash);
-  HMAC_init(ctx, key, len);
-}
-
-void HMAC_SHA_init(HMAC_CTX* ctx, const void* key, int len) {
-  SHA_init(&ctx->hash);
-  HMAC_init(ctx, key, len);
-}
-
-const uint8_t* HMAC_final(HMAC_CTX* ctx) {
-  uint8_t digest[32];  // upto SHA2
-  memcpy(digest, HASH_final(&ctx->hash),
-         (HASH_size(&ctx->hash) <= sizeof(digest) ?
-             HASH_size(&ctx->hash) : sizeof(digest)));
-  HASH_init(&ctx->hash);
-  HASH_update(&ctx->hash, ctx->opad, sizeof(ctx->opad));
-  HASH_update(&ctx->hash, digest, HASH_size(&ctx->hash));
-  memset(&ctx->opad[0], 0, sizeof(ctx->opad));  // wipe key
-  return HASH_final(&ctx->hash);
-}
diff --git a/base/security/hmac.h b/base/security/hmac.h
deleted file mode 100644
index fdfce11..0000000
--- a/base/security/hmac.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_SECURITY_HMAC_H__
-#define OMAHA_COMMON_SECURITY_HMAC_H__
-
-#include <inttypes.h>
-#include "hash-internal.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct HMAC_CTX {
-  HASH_CTX hash;
-  uint8_t opad[64];
-} HMAC_CTX;
-
-void HMAC_MD5_init(HMAC_CTX* ctx, const void* key, int len);
-void HMAC_SHA_init(HMAC_CTX* ctx, const void* key, int len);
-const uint8_t* HMAC_final(HMAC_CTX* ctx);
-
-#define HMAC_update(ctx, data, len) HASH_update(&(ctx)->hash, data, len)
-#define HMAC_size(ctx) HASH_size(&(ctx)->hash)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  // OMAHA_COMMON_SECURITY_HMAC_H__
diff --git a/base/security/md5.c b/base/security/md5.c
deleted file mode 100644
index 7f3b7c1..0000000
--- a/base/security/md5.c
+++ /dev/null
@@ -1,171 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Optimized for minimal code size.
-
-#include "md5.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
-
-#define rol(bits, value) (((value) << (bits)) | ((value) >> (32 - (bits))))
-
-static const char Kr[64] =
-{
-  7, 12, 17, 22,  7, 12, 17, 22,  7, 12, 17, 22,  7, 12, 17, 22,
-  5,  9, 14, 20,  5,  9, 14, 20,  5,  9, 14, 20,  5,  9, 14, 20,
-  4, 11, 16, 23,  4, 11, 16, 23,  4, 11, 16, 23,  4, 11, 16, 23,
-  6, 10, 15, 21,  6, 10, 15, 21,  6, 10, 15, 21,  6, 10, 15, 21
-};
-
-static const int KK[64] =
-{
-  0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,
-  0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
-  0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,
-  0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821,
-  0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa,
-  0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8,
-  0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed,
-  0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a,
-  0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c,
-  0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70,
-  0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05,
-  0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665,
-  0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039,
-  0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,
-  0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,
-  0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391
-};
-
-static void MD5_Transform(MD5_CTX* ctx) {
-  uint32_t W[64];
-  uint32_t A, B, C, D;
-  uint8_t* p = ctx->buf;
-  int t;
-
-  for(t = 0; t < 16; ++t) {
-    uint32_t tmp =  *p++;
-    tmp |= *p++ << 8;
-    tmp |= *p++ << 16;
-    tmp |= *p++ << 24;
-    W[t] = tmp;
-  }
-
-  A = ctx->state[0];
-  B = ctx->state[1];
-  C = ctx->state[2];
-  D = ctx->state[3];
-
-  for(t = 0; t < 64; t++) {
-    uint32_t f, tmp;
-    int g;
-
-    if (t < 16) {
-      f = (D^(B&(C^D)));
-      g = t;
-    } else if ( t < 32) {
-      f = (C^(D&(B^C)));
-      g = (5*t + 1) & 15;
-    } else if ( t < 48) {
-      f = (B^C^D);
-      g = (3*t + 5) & 15;
-    } else {
-      f = (C^(B|(~D)));
-      g = (7*t) & 15;
-    }
-
-    tmp = D;
-    D = C;
-    C = B;
-    B = B + rol(Kr[t], (A+f+KK[t]+W[g]));
-    A = tmp;
-  }
-
-  ctx->state[0] += A;
-  ctx->state[1] += B;
-  ctx->state[2] += C;
-  ctx->state[3] += D;
-}
-
-static const HASH_VTAB MD5_VTAB = {
-  MD5_init,
-  MD5_update,
-  MD5_final,
-  MD5,
-  MD5_DIGEST_SIZE
-};
-
-void MD5_init(MD5_CTX* ctx) {
-  ctx->f = &MD5_VTAB;
-  ctx->state[0] = 0x67452301;
-  ctx->state[1] = 0xEFCDAB89;
-  ctx->state[2] = 0x98BADCFE;
-  ctx->state[3] = 0x10325476;
-  ctx->count = 0;
-}
-
-
-void MD5_update(MD5_CTX* ctx, const void* data, int len) {
-  int i = ctx->count & 63;
-  const uint8_t* p = (const uint8_t*)data;
-
-  ctx->count += len;
-
-  while (len--) {
-    ctx->buf[i++] = *p++;
-    if (i == 64) {
-      MD5_Transform(ctx);
-      i = 0;
-    }
-  }
-}
-
-
-const uint8_t* MD5_final(MD5_CTX* ctx) {
-  uint8_t* p = ctx->buf;
-  uint64_t cnt = ctx->count * 8;
-  int i;
-
-  MD5_update(ctx, (uint8_t*)"\x80", 1);
-  while ((ctx->count & 63) != 56) {
-    MD5_update(ctx, (uint8_t*)"\0", 1);
-  }
-  for (i = 0; i < 8; ++i) {
-    uint8_t tmp = cnt >> (i * 8);
-    MD5_update(ctx, &tmp, 1);
-  }
-
-  for (i = 0; i < 4; i++) {
-    uint32_t tmp = ctx->state[i];
-    *p++ = tmp;
-    *p++ = tmp >> 8;
-    *p++ = tmp >> 16;
-    *p++ = tmp >> 24;
-  }
-
-  return ctx->buf;
-}
-
-
-/* Convenience function */
-const uint8_t* MD5(const void* data, int len, uint8_t* digest) {
-  MD5_CTX ctx;
-  MD5_init(&ctx);
-  MD5_update(&ctx, data, len);
-  memcpy(digest, MD5_final(&ctx), MD5_DIGEST_SIZE);
-  return digest;
-}
diff --git a/base/security/md5.h b/base/security/md5.h
deleted file mode 100644
index 37cfc04..0000000
--- a/base/security/md5.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_SECURITY_MD5_H__
-#define OMAHA_COMMON_SECURITY_MD5_H__
-
-#include <inttypes.h>
-#include "hash-internal.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-typedef HASH_CTX MD5_CTX;
-
-void MD5_init(MD5_CTX* ctx);
-void MD5_update(MD5_CTX* ctx, const void* data, int len);
-const uint8_t* MD5_final(MD5_CTX* ctx);
-
-// Convenience method. Returns digest address.
-const uint8_t* MD5(const void* data, int len, uint8_t* digest);
-
-#define MD5_DIGEST_SIZE 16
-
-#ifdef __cplusplus
-}
-#endif // __cplusplus
-
-#endif  // OMAHA_COMMON_SECURITY_MD5_H__
diff --git a/base/security/rc4.c b/base/security/rc4.c
deleted file mode 100644
index 3f1b336..0000000
--- a/base/security/rc4.c
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "rc4.h"
-
-#include <inttypes.h>
-
-void RC4_setKey(RC4_CTX* ctx, const uint8_t* key, int len) {
-  uint8_t* S = ctx->S;
-  int i, j;
-
-  for (i = 0; i < 256; ++i) {
-    S[i] = i;
-  }
-
-  j = 0;
-  for (i = 0; i < 256; ++i) {
-    uint8_t tmp;
-
-    j = (j + S[i] + key[i % len]) & 255;
-
-    tmp = S[i];
-    S[i] = S[j];
-    S[j] = tmp;
-  }
-
-  ctx->i = 0;
-  ctx->j = 0;
-}
-
-void RC4_crypt(RC4_CTX* ctx,
-               const uint8_t *in,
-               uint8_t* out,
-               int len) {
-  uint8_t i = ctx->i;
-  uint8_t j = ctx->j;
-  uint8_t* S = ctx->S;
-
-  int n;
-
-  for (n = 0; n < len; ++n) {
-    uint8_t tmp;
-
-    i = (i + 1) & 255;
-    j = (j + S[i]) & 255;
-
-    tmp = S[i];
-    S[i] = S[j];
-    S[j] = tmp;
-
-    if (in) {
-      if (out) {
-        out[n] = in[n] ^ S[(S[i] + S[j]) & 255];
-      }
-    } else {
-      if (out) {
-        out[n] = S[(S[i] + S[j]) & 255];
-      }
-    }
-  }
-
-  ctx->i = i;
-  ctx->j = j;
-}
-
-void RC4_discard(RC4_CTX* ctx, int len) {
-  RC4_crypt(ctx, 0, 0, len);
-}
-
-void RC4_stream(RC4_CTX* ctx, uint8_t* out, int len) {
-  RC4_crypt(ctx, 0, out, len);
-}
diff --git a/base/security/rc4.h b/base/security/rc4.h
deleted file mode 100644
index e3e9f6e..0000000
--- a/base/security/rc4.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_SECURITY_RC4_H__
-#define OMAHA_COMMON_SECURITY_RC4_H__
-
-#include <inttypes.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
-  uint8_t S[256];
-  uint8_t i;
-  uint8_t j;
-} RC4_CTX;
-
-void RC4_setKey(RC4_CTX* ctx, const uint8_t* data, int len);
-void RC4_discard(RC4_CTX* ctx, int len);
-void RC4_crypt(RC4_CTX* ctx, const uint8_t* in, uint8_t* out, int len);
-void RC4_stream(RC4_CTX* ctx, uint8_t* out, int len);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  // OMAHA_COMMON_SECURITY_RC4_H__
diff --git a/base/security/rsa.cc b/base/security/rsa.cc
deleted file mode 100644
index 4f3d104..0000000
--- a/base/security/rsa.cc
+++ /dev/null
@@ -1,290 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "rsa.h"
-
-#include <stddef.h>
-#include <inttypes.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "md5.h"
-#include "aes.h"
-#include "sha.h"
-#include "rc4.h"
-
-#define DINV mod[0]
-#define RR(i) mod[1 + 2*(i)]
-#define MOD(i) (mod[2 + 2*(i)] + mod[1 + 2*(i)])  // +mod[1+2*(i)] to deobscure
-
-//
-// a[] -= M
-//
-static void subM(uint32_t* a, const uint32_t* mod, int len) {
-  int64_t A = 0;
-  for (int i = 0; i < len; ++i) {
-    A += (uint64_t)a[i] - MOD(i);
-    a[i] = (uint32_t)A;
-    A >>= 32;
-  }
-}
-
-//
-// return a[] >= M
-//
-static bool geM(const uint32_t* a, const uint32_t* mod, int len) {
-  for (int i = len; i;) {
-    --i;
-    if (a[i] < MOD(i)) return false;
-    if (a[i] > MOD(i)) return true;
-  }
-  return true;  // equal
-}
-
-//
-// montgomery c[] += a * b[] / R mod M
-//
-static void montMulAdd(uint32_t* c,
-                       uint32_t a,
-                       const uint32_t* b,
-                       const uint32_t* mod,
-                       int len) {
-  uint64_t A = (uint64_t)a * b[0] + c[0];
-  uint32_t d0 = (uint32_t)A * DINV;
-  uint64_t B = (uint64_t)d0 * MOD(0) + (uint32_t)A;
-
-  int i = 1;
-  for (; i < len; ++i) {
-    A = (A >> 32) + (uint64_t)a * b[i] + c[i];
-    B = (B >> 32) + (uint64_t)d0 * MOD(i) + (uint32_t)A;
-    c[i - 1] = (uint32_t)B;
-  }
-
-  A = (A >> 32) + (B >> 32);
-
-  c[i - 1] = (uint32_t)A;
-
-  if ((A >> 32)) {  // proper probablistic padding could avoid this?
-    subM(c, mod, len);  // or moduli without the highest bit set..
-  }
-}
-
-//
-// montgomery c[] = a[] * R^2 / R mod M (= a[] * R mod M)
-//
-static void montMulR(uint32_t* c,
-                     const uint32_t* a,
-                     const uint32_t* mod,
-                     int len) {
-  memset(c, 0, len * sizeof(uint32_t));
-
-  for (int i = 0; i < len; ++i) {
-    montMulAdd(c, RR(i), a, mod, len);
-  }
-}
-
-//
-// montgomery c[] = a[] * b[] / R mod M
-//
-static void montMul(uint32_t* c,
-                    const uint32_t* a,
-                    const uint32_t* b,
-                    const uint32_t* mod,
-                    int len) {
-  memset(c, 0, len * sizeof(uint32_t));
-
-  for (int i = 0; i < len; ++i) {
-    montMulAdd(c, a[i], b, mod, len);
-  }
-}
-
-
-//
-// In-place public exponentiation.
-// Input and output big-endian byte array.
-// Returns 0 on failure or # uint8_t written in inout (always inout_len).
-//
-int RSA::raw(uint8_t* inout, int inout_len) const {
-  const uint32_t* mod = &pkey_[1];
-  int len = *mod++;
-
-  if (len > kMaxWords)
-    return 0;  // Only work with up to 2048 bit moduli.
-  if ((len * 4) != inout_len)
-    return 0;  // Input length should match modulus length.
-
-  uint32_t a[kMaxWords];
-
-  // Convert from big endian byte array to little endian word array.
-  for (int i = 0; i < len; ++i) {
-    uint32_t tmp =
-      (inout[((len - 1 - i) * 4) + 0] << 24) |
-      (inout[((len - 1 - i) * 4) + 1] << 16) |
-      (inout[((len - 1 - i) * 4) + 2] << 8) |
-      (inout[((len - 1 - i) * 4) + 3] << 0);
-    a[i] = tmp;
-  }
-
-  uint32_t aR[kMaxWords];
-  uint32_t aaR[kMaxWords];
-  uint32_t aaa[kMaxWords];
-
-  montMulR(aR, a, mod, len);       // aR = a * R mod M
-  montMul(aaR, aR, aR, mod, len);  // aaR = a^2 * R mod M
-  montMul(aaa, aaR, a, mod, len);  // aaa = a^3 mod M
-
-  // Make sure aaa < mod; aaa is at most 1x mod too large.
-  if (geM(aaa, mod, len)) {
-    subM(aaa, mod, len);
-  }
-
-  // Convert to bigendian byte array
-  int reslen = 0;
-
-  for (int i = len - 1; i >= 0; --i) {
-    uint32_t tmp = aaa[i];
-    inout[reslen++] = tmp >> 24;
-    inout[reslen++] = tmp >> 16;
-    inout[reslen++] = tmp >> 8;
-    inout[reslen++] = tmp >> 0;
-  }
-
-  return reslen;
-}
-
-//
-// Verify a Google style padded message recovery signature and return the
-// message.
-//
-int RSA::verify(const uint8_t* data, int data_len,
-                void* output, int output_len) const {
-  uint8_t res[kMaxWords * 4];
-
-  if (data_len < 0 || data_len > (kMaxWords * 4))
-    return 0;  // Input too big, 2048 bit max.
-
-  memcpy(res, data, data_len);
-
-  int reslen = this->raw(res, data_len);
-
-  if (!reslen) return 0;
-
-  uint8_t md5[16];
-
-  MD5(res, reslen - 16, md5);
-
-  for (int i = 0; i < 16; ++i) {
-    res[reslen - 16 + i] ^= md5[i];
-  }
-
-  // Unmask low part using high part as ofb key.
-  uint8_t iv[16] = {0};
-
-  for (int i = 0; i < reslen - 16; i++) {
-    if (!(i & 15))
-      AES_encrypt_block(res + reslen - 16, iv, iv);
-    res[i] ^= iv[i & 15];
-  }
-
-  res[0] &= 127;
-  res[0] %= reslen - 16 - 16;
-
-  bool result = true;
-
-  // Verify high part is hash of random in low part.
-  MD5(res + 1, res[0] + 16, md5);
-  for (int i = 0; i < 16; ++i) {
-    result = result && (res[reslen - 16 + i] == md5[i]);
-  }
-
-  if (!result) {
-    return 0;  // verification failure
-  }
-
-  // Copy message into output[]
-  if (res[0] > output_len) {
-    return 0;  // output too small, return failure
-  }
-
-  memcpy(output, res + 1, res[0]);
-
-  return res[0];
-}
-
-//
-// Hybrid encrypt message.
-// Make up RC4 key using seed and hash of msg.
-// Wrap key with RSA, encrypt msg with RC4.
-//
-int RSA::encrypt(const uint8_t* msg, int msg_len,
-                 const void* seed, int seed_len,
-                 uint8_t* output, int output_max) const {
-  int output_len = this->encryptedSize(msg_len);
-  if (output_max < 0 || output_max < output_len)
-    return 0;
-
-  int header_size = output_len - msg_len;  // Our added overhead.
-
-  // Hash of message. Least significant SHA_DIGEST_SIZE bytes of RSA number.
-  uint8_t* hash = &output[header_size - SHA_DIGEST_SIZE];
-  SHA(msg, msg_len, hash);
-
-  // Hash(Hash(message) | seed).
-  SHA_CTX sha;
-  SHA_init(&sha);
-  SHA_update(&sha, hash, SHA_DIGEST_SIZE);
-  SHA_update(&sha, seed, seed_len);
-
-  // Use this Hash(Hash(message) | seed) as RC4 key for prng.
-  RC4_CTX rc4;
-  RC4_setKey(&rc4, SHA_final(&sha), SHA_DIGEST_SIZE);
-  RC4_discard(&rc4, 1536);  // Drop some to warm up RC4.
-
-  uint8_t* key = &output[1 + 4];
-
-  // Prng conjure some bytes.
-  RC4_stream(&rc4, key, this->size() - SHA_DIGEST_SIZE);
-  key[0] &= 127;  // Drop top bit to be less than modulus.
-
-  // Mask plaintext hash with hash of prng part.
-  SHA_init(&sha);
-  SHA_update(&sha, key, this->size() - SHA_DIGEST_SIZE);
-  const uint8_t* mask = SHA_final(&sha);
-  for (int i = 0; i < SHA_DIGEST_SIZE; ++i)
-    hash[i] ^= mask[i];
-
-  // Use entire RSA number as content encryption key.
-  RC4_setKey(&rc4, key, this->size());
-  RC4_discard(&rc4, 1536);  // Warm up RC4.
-
-  // Output wire-format version, single 0 byte.
-  output[0] = 0;
-
-  // Output version, msb first.
-  uint32_t version = this->version();
-  output[1] = version >> 24;
-  output[2] = version >> 16;
-  output[3] = version >> 8;
-  output[4] = version >> 0;
-
-  // Wrap key data with public RSA key.
-  if (!this->raw(key, this->size()))
-    return 0;
-
-  // Append encrypted message.
-  RC4_crypt(&rc4, msg, &output[header_size], msg_len);
-
-  return output_len;
-}
diff --git a/base/security/rsa.h b/base/security/rsa.h
deleted file mode 100644
index 3403c11..0000000
--- a/base/security/rsa.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_SECURITY_RSA_H__
-#define OMAHA_COMMON_SECURITY_RSA_H__
-
-#include <inttypes.h>
-
-class RSA {
- public:
-  typedef const uint32_t PublicKeyInstance[];
-  typedef const uint32_t* PublicKey;
-
-  // Public_key as montgomery precomputed array
-  explicit RSA(PublicKey public_key) : pkey_(public_key) {}
-
-  // Verifies a Google style RSA message recovery signature.
-  //
-  // sig[] signature to verify, big-endian byte array.
-  // sig_len length of sig[] in bytes.
-  // If verified successfully, output receives the recovered
-  // message and the function returns the number of bytes.
-  // If not successful, the function returns 0.
-  // (empty message is not a useful message)
-  int verify(const uint8_t* sig, int sig_len,
-             void* output, int output_max) const;
-
-  // Hybrid encrypt message.
-  //
-  // output_max should be at least encryptedSize(msg_len)
-  // Returns 0 on failure, # output bytes on success.
-  int encrypt(const uint8_t* msg, int msg_len,
-              const void* seed, int seed_len,
-              uint8_t* output, int output_max) const;
-
-  int encryptedSize(int len) const {
-    return len + 1 + 4 + size();
-  }
-
-  // Performs in-place public key exponentiation.
-  //
-  // Input_len should match size of modulus in bytes.
-  // Returns 0 on failure, # of bytes written on success.
-  int raw(uint8_t* input, int input_len) const;
-
-  int version() const { return pkey_[0]; }
-  int size() const { return pkey_[1] * 4; }
-
- private:
-  const PublicKey pkey_;
-  static const int kMaxWords = 64;
-};
-
-#endif  // OMAHA_COMMON_SECURITY_RSA_H__
diff --git a/base/security/sha.c b/base/security/sha.c
deleted file mode 100644
index dee6624..0000000
--- a/base/security/sha.c
+++ /dev/null
@@ -1,143 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Optimized for minimal code size.
-
-#include "sha.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
-
-#define rol(bits, value) (((value) << (bits)) | ((value) >> (32 - (bits))))
-
-static void SHA1_Transform(SHA_CTX* ctx) {
-  uint32_t W[80];
-  uint32_t A, B, C, D, E;
-  uint8_t* p = ctx->buf;
-  int t;
-
-  for(t = 0; t < 16; ++t) {
-    uint32_t tmp =  *p++ << 24;
-    tmp |= *p++ << 16;
-    tmp |= *p++ << 8;
-    tmp |= *p++;
-    W[t] = tmp;
-  }
-
-  for(; t < 80; t++) {
-    W[t] = rol(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]);
-  }
-
-  A = ctx->state[0];
-  B = ctx->state[1];
-  C = ctx->state[2];
-  D = ctx->state[3];
-  E = ctx->state[4];
-
-  for(t = 0; t < 80; t++) {
-    uint32_t tmp = rol(5,A) + E + W[t];
-
-    if (t < 20)
-      tmp += (D^(B&(C^D))) + 0x5A827999;
-    else if ( t < 40)
-      tmp += (B^C^D) + 0x6ED9EBA1;
-    else if ( t < 60)
-      tmp += ((B&C)|(D&(B|C))) + 0x8F1BBCDC;
-    else
-      tmp += (B^C^D) + 0xCA62C1D6;
-
-    E = D;
-    D = C;
-    C = rol(30,B);
-    B = A;
-    A = tmp;
-  }
-
-  ctx->state[0] += A;
-  ctx->state[1] += B;
-  ctx->state[2] += C;
-  ctx->state[3] += D;
-  ctx->state[4] += E;
-}
-
-static const HASH_VTAB SHA_VTAB = {
-  SHA_init,
-  SHA_update,
-  SHA_final,
-  SHA,
-  SHA_DIGEST_SIZE
-};
-
-void SHA_init(SHA_CTX* ctx) {
-  ctx->f = &SHA_VTAB;
-  ctx->state[0] = 0x67452301;
-  ctx->state[1] = 0xEFCDAB89;
-  ctx->state[2] = 0x98BADCFE;
-  ctx->state[3] = 0x10325476;
-  ctx->state[4] = 0xC3D2E1F0;
-  ctx->count = 0;
-}
-
-
-void SHA_update(SHA_CTX* ctx, const void* data, int len) {
-  int i = ctx->count & 63;
-  const uint8_t* p = (const uint8_t*)data;
-
-  ctx->count += len;
-
-  while (len--) {
-    ctx->buf[i++] = *p++;
-    if (i == 64) {
-      SHA1_Transform(ctx);
-      i = 0;
-    }
-  }
-}
-
-
-const uint8_t* SHA_final(SHA_CTX* ctx) {
-  uint8_t *p = ctx->buf;
-  uint64_t cnt = ctx->count * 8;
-  int i;
-
-  SHA_update(ctx, (uint8_t*)"\x80", 1);
-  while ((ctx->count & 63) != 56) {
-    SHA_update(ctx, (uint8_t*)"\0", 1);
-  }
-  for (i = 0; i < 8; ++i) {
-    uint8_t tmp = cnt >> ((7 - i) * 8);
-    SHA_update(ctx, &tmp, 1);
-  }
-
-  for (i = 0; i < 5; i++) {
-    uint32_t tmp = ctx->state[i];
-    *p++ = tmp >> 24;
-    *p++ = tmp >> 16;
-    *p++ = tmp >> 8;
-    *p++ = tmp >> 0;
-  }
-
-  return ctx->buf;
-}
-
-/* Convenience function */
-const uint8_t* SHA(const void* data, int len, uint8_t* digest) {
-  SHA_CTX ctx;
-  SHA_init(&ctx);
-  SHA_update(&ctx, data, len);
-  memcpy(digest, SHA_final(&ctx), SHA_DIGEST_SIZE);
-  return digest;
-}
diff --git a/base/security/sha.h b/base/security/sha.h
deleted file mode 100644
index e9750dd..0000000
--- a/base/security/sha.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_SECURITY_SHA1_H__
-#define OMAHA_COMMON_SECURITY_SHA1_H__
-
-#include <inttypes.h>
-#include "hash-internal.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-typedef HASH_CTX SHA_CTX;
-
-void SHA_init(SHA_CTX* ctx);
-void SHA_update(SHA_CTX* ctx, const void* data, int len);
-const uint8_t* SHA_final(SHA_CTX* ctx);
-
-// Convenience method. Returns digest address.
-const uint8_t* SHA(const void* data, int len, uint8_t* digest);
-
-#define SHA_DIGEST_SIZE 20
-
-#ifdef __cplusplus
-}
-#endif // __cplusplus
-
-#endif  // OMAHA_COMMON_SECURITY_SHA1_H__
diff --git a/base/serializable_object.cc b/base/serializable_object.cc
deleted file mode 100644
index ae0e8d4..0000000
--- a/base/serializable_object.cc
+++ /dev/null
@@ -1,375 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Provides the base class framework for those objects to be serialized
-//
-// HACK:
-//
-// During the serialization/deserialization of vector<T> members, we
-// coerce the type from vector<T> to vector<byte> since we are unable to
-// get the real type vector<T> at later time. This is feasible because
-// vector<T> in the vector library we are linking now keeps track of
-// only front() and end() pointers and use them to calculate size().
-// We need to check whether this approach is still OK if we upgrade the
-// standard libraries.
-
-#include "omaha/base/serializable_object.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-
-namespace omaha {
-
-// Serialize
-bool SerializableObject::Serialize(std::vector<byte>* data) const {
-  ASSERT(data, (_T("")));
-
-  // Estimate how much memory we need
-  int size = data->size();
-  for (size_t i = 0; i < members_.size(); ++i)
-    size += (members_[i].size > 0) ? members_[i].size : sizeof(int);
-
-  // Reserve the estimated size fo vector memory
-  data->reserve(size);
-
-  // Copy over the data
-  for (size_t i = 0; i < members_.size(); ++i) {
-    switch (members_[i].type) {
-      case SERIALIZABLE_VALUE_TYPE: {
-        int pos = data->size();
-        data->resize(data->size() + members_[i].size);
-        memcpy(&(*data)[pos], members_[i].ptr, members_[i].size);
-        break;
-      }
-
-      case SERIALIZABLE_CSTRING: {
-        CString* s = reinterpret_cast<CString*>(members_[i].ptr);
-        SerializeValueList(data,
-                           reinterpret_cast<const byte*>(s->GetString()),
-                           sizeof(TCHAR),
-                           s->GetLength());
-        break;
-      }
-
-      case SERIALIZABLE_NESTED_OBJECT: {
-        SerializableObject* nested_obj =
-            reinterpret_cast<SerializableObject*>(members_[i].ptr);
-        if (!nested_obj->Serialize(data))
-          return false;
-        break;
-      }
-
-      case SERIALIZABLE_VECTOR | SERIALIZABLE_VALUE_TYPE: {
-        // Hack: coerce vector<T> to vector<byte>
-        std::vector<byte>* v =
-            reinterpret_cast<std::vector<byte>*>(members_[i].ptr);
-        if (v->size() != 0) {
-          SerializeValueList(data,
-                             &v->front(),
-                             members_[i].size,
-                             v->size() / members_[i].size);
-        } else {
-          SerializeValueList(data,
-                             NULL,
-                             members_[i].size,
-                             v->size() / members_[i].size);
-        }
-        break;
-      }
-
-      case SERIALIZABLE_VECTOR | SERIALIZABLE_CSTRING: {
-        std::vector<CString>* v =
-            reinterpret_cast<std::vector<CString>*>(members_[i].ptr);
-        SerializeSizeAndCount(data, 1, v->size());
-        if (!v->empty()) {
-          for (std::vector<CString>::const_iterator it = v->begin();
-               it != v->end();
-               ++it) {
-            SerializeValueList(data,
-                               reinterpret_cast<const byte*>(it->GetString()),
-                               sizeof(TCHAR),
-                               it->GetLength());
-          }
-        }
-        break;
-      }
-
-      case SERIALIZABLE_VECTOR | SERIALIZABLE_NESTED_OBJECT: {
-        if (!SerializeVectorNestedObject(data, members_[i].ptr))
-          return false;
-        break;
-      }
-
-      default:
-        ASSERT(false, (_T("")));
-        return false;
-    }
-  }
-
-  return true;
-}
-
-// Serialize the size and count values
-void SerializableObject::SerializeSizeAndCount(std::vector<byte>* data,
-                                               int size,
-                                               int count) const {
-  ASSERT(data, (_T("")));
-  ASSERT(size >= 0, (_T("")));
-
-  // Get current size
-  int pos = data->size();
-
-  // Adjust the size of the data buffer
-  data->resize(data->size() + 2 * sizeof(int));
-
-  // Get pointer to the position of data buffer we start to write
-  byte* ptr = &((*data)[pos]);
-
-  // Push size
-  memcpy(ptr, &size, sizeof(int));
-  ptr += sizeof(int);
-
-  // Push count
-  memcpy(ptr, &count, sizeof(int));
-  ptr += sizeof(int);
-}
-
-// Serialize a list of value-typed elements
-//
-// Args:
-//   ser_data:  pointer to the vector for the serialized data
-//   raw_data:  pointer to the raw data to be serialized
-//   size:      the size of the element in the list
-//   count:     the number of the elements in the list
-void SerializableObject::SerializeValueList(std::vector<byte>* ser_data,
-                                            const byte* raw_data,
-                                            int size,
-                                            int count) const {
-  ASSERT(ser_data, (_T("")));
-  ASSERT(size > 0, (_T("")));
-
-  // Serialize the size and count values
-  SerializeSizeAndCount(ser_data, size, count);
-
-  // Push data
-  if (count > 0) {
-    // Get current size
-    int pos = ser_data->size();
-
-    // Adjust the size of the data buffer
-    ser_data->resize(ser_data->size() + count * size);
-
-    // Get pointer to the position of data buffer we start to write
-    byte* ptr = &((*ser_data)[pos]);
-
-    // Copy data
-    memcpy(ptr, raw_data, count * size);
-  }
-}
-
-// Deserialize
-bool SerializableObject::Deserialize(byte* data, int size, uint32 version) {
-  ASSERT(data, (_T("")));
-  ASSERT(size > 0, (_T("")));
-
-  byte* tail = data + size;
-  byte** data_ptr = &data;
-  if (!DeserializeHelper(data_ptr, size, version))
-    return false;
-
-  if (*data_ptr != tail) {
-    UTIL_LOG(LE, (_T("[SerializableObject::Deserialize]")
-                  _T("[failed to deserialize all data]")));
-    return false;
-  }
-
-  return true;
-}
-
-// Deserialize helper
-bool SerializableObject::DeserializeHelper(byte** data,
-                                           int size,
-                                           uint32 version) {
-  ASSERT(data, (_T("")));
-  ASSERT(size > 0, (_T("")));
-
-  byte* tail = *data + size;
-
-  for (size_t i = 0; i < members_.size(); ++i) {
-    // Ignore those members which are persisted in newer versions
-    if (version != kLatestSerializableVersion &&
-        members_[i].version  > version) {
-      continue;
-    }
-
-    switch (members_[i].type) {
-      case SERIALIZABLE_VALUE_TYPE:
-        if (*data + members_[i].size > tail) {
-          UTIL_LOG(L6, (_T("[SerializableObject::DeserializeHelper]")
-                        _T("[overflow when deserializing value type]")));
-          return false;
-        }
-        memcpy(members_[i].ptr, *data, members_[i].size);
-        *data += members_[i].size;
-        break;
-
-      case SERIALIZABLE_CSTRING: {
-        std::vector<byte> deser_data;
-        if (!DeserializeValueList(&deser_data,
-                                  members_[i].size,
-                                  data,
-                                  tail - *data))
-          return false;
-        CString* s = reinterpret_cast<CString*>(members_[i].ptr);
-        if (deser_data.size() != 0) {
-          s->SetString(reinterpret_cast<const TCHAR*>(&deser_data.front()),
-                       deser_data.size() / members_[i].size);
-        } else {
-          s->SetString(_T(""));
-        }
-        break;
-      }
-
-      case SERIALIZABLE_NESTED_OBJECT: {
-        SerializableObject* nested_obj =
-            reinterpret_cast<SerializableObject*>(members_[i].ptr);
-        if (!nested_obj->DeserializeHelper(data, size, version))
-          return false;
-        break;
-      }
-
-      case SERIALIZABLE_VECTOR | SERIALIZABLE_VALUE_TYPE: {
-        // Hack: coerce vector<T> to vector<byte>
-        std::vector<byte>* v =
-            reinterpret_cast<std::vector<byte>*>(members_[i].ptr);
-        if (!DeserializeValueList(v, members_[i].size, data, tail - *data))
-          return false;
-        break;
-      }
-
-      case SERIALIZABLE_VECTOR | SERIALIZABLE_CSTRING: {
-        std::vector<CString>* v =
-              reinterpret_cast<std::vector<CString>*>(members_[i].ptr);
-        int count = 0;
-        if (!DeserializeSizeAndCount(&count, 1, data, tail - *data))
-          return false;
-        for (int j = 0; j < count; ++j) {
-          std::vector<byte> deser_data;
-          if (!DeserializeValueList(&deser_data,
-                                    members_[i].size,
-                                    data,
-                                    tail - *data))
-            return false;
-
-          CString s;
-          if (deser_data.size() != 0) {
-            s = CString(reinterpret_cast<const TCHAR*>(&deser_data.front()),
-                        deser_data.size() / members_[i].size);
-          }
-          v->push_back(s);
-        }
-        break;
-      }
-
-      case SERIALIZABLE_VECTOR | SERIALIZABLE_NESTED_OBJECT: {
-        if (!DeserializeVectorNestedObject(data,
-                                           tail - *data,
-                                           members_[i].ptr,
-                                           version))
-          return false;
-        break;
-      }
-
-      default:
-        ASSERT(false, (_T("")));
-        break;
-    }
-  }
-
-  return true;
-}
-
-// Serialize the size and count values
-bool SerializableObject::DeserializeSizeAndCount(int* count,
-                                                 int size,
-                                                 byte** ser_data,
-                                                 int ser_size) const {
-  ASSERT(ser_data, (_T("")));
-  ASSERT(count, (_T("")));
-
-  byte* ser_tail = *ser_data + ser_size;
-
-  // Check to make sure that the serialization data should at least contain
-  // 'size' and 'count'
-  if (*ser_data + 2 * sizeof(int) > ser_tail) {
-    UTIL_LOG(L6, (_T("[SerializableObject::DeserializeSizeAndCount]")
-                  _T("[overflow when deserializing size and count]")));
-    return false;
-  }
-
-  // Get size
-  // If the passing size is 0, skip the size check
-  int size2 = *(reinterpret_cast<const int*>(*ser_data));
-  *ser_data += sizeof(int);
-  if (size && size != size2)
-    return false;
-
-  // Get count
-  *count = *(reinterpret_cast<const int*>(*ser_data));
-  *ser_data += sizeof(int);
-
-  return true;
-}
-
-// Deserialize a list of value-typed elements
-//
-// Args:
-//   ser_data:  pointer to the vector for the serialized data
-//   size:      the size of the element in the list
-//   raw_data:  pointer to the raw data to be serialized
-//   ser_size:  size of the serization data
-bool SerializableObject::DeserializeValueList(std::vector<byte>* raw_data,
-                                              int size,
-                                              byte** ser_data,
-                                              int ser_size) {
-  ASSERT(raw_data, (_T("")));
-  ASSERT(ser_data, (_T("")));
-
-  byte* ser_tail = *ser_data + ser_size;
-
-  // Deserialize the size and count values
-  int count = 0;
-  bool ret = DeserializeSizeAndCount(&count, size, ser_data, ser_size);
-  if (!ret)
-    return false;
-
-  // Check to make sure that the serialization data is in the right size
-  if (*ser_data + count * size > ser_tail) {
-    UTIL_LOG(L6, (_T("[SerializableObject::DeserializeValueList]")
-                  _T("[overflow when deserializing value list]")));
-    return false;
-  }
-
-  // Get data
-  raw_data->resize(size * count);
-  if (count > 0) {
-    memcpy(&raw_data->front(), *ser_data, count * size);
-    *ser_data += count * size;
-  }
-
-  return true;
-}
-
-}  // namespace omaha
-
diff --git a/base/serializable_object.h b/base/serializable_object.h
deleted file mode 100644
index 5dd712d..0000000
--- a/base/serializable_object.h
+++ /dev/null
@@ -1,373 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Declares class SerializableObject
-//
-// Provides the base class framework for those objects to be serialized
-//
-// Currently we support the serialization for the following member type
-//
-//   1) Value-type object
-//   2) CString
-//   3) Nested serializable object
-//   4) Vector of the value-type objects
-//   5) Vector of CString
-//   6) Vector of serializable objects
-//
-// Usage:
-//
-//   1) Declare the object class, which you want to serialize, to be derived
-//      from SerializableObject
-//   2) In its constructor, call AddSerializableMember(...) to add those fields
-//      to be included in the serialization
-//   3) If you need to serialize a vector of serializable objects,
-//      a) The inner object class has to implement copy constructor and
-//         operator =
-//      b) The outer object class has to override SerializeVectorNestedObject()
-//         and DeserializeVectorNestedObject() (see sample)
-//
-// Versioning support:
-//
-//   To add new fields in the new version, call
-//        AddSerializableMember(version, &member);
-//   If "version" is not given, it is 0 by default.
-//
-//   To deserialize the data for latest version, call
-//        Deserialize(data, size, kLatestSerializableVersion);
-//   To deserialize the data for a particular version, call
-//        Deserialize(data, size, version);
-//
-// Sample:
-//
-//   class FooObject : public SerializableObject {
-//     ...
-//   };
-//
-//   class BarObject : public SerializableObject {
-//    public:
-//     BarObject() {
-//      AddSerializableMember(&value1_);
-//      AddSerializableMember(&value2_);
-//      AddSerializableMember(&value3_);
-//      AddSerializableMember(&value4_);
-//      AddSerializableMember(&value5_);
-//      AddSerializableMember(&value6_);
-//      AddSerializableMember(1, &value7_);     // New version
-//     }
-//
-//    protected:
-//     virtual bool SerializeVectorNestedObject(std::vector<byte>* data,
-//                                              const byte* ptr) const {
-//       ASSERT(data, (_T("")));
-//       ASSERT(ptr, (_T("")));
-//       if (ptr == reinterpret_cast<const byte*>(&value6_))
-//         return SerializeVectorNestedObjectHelper(data, &value6_);
-//       return false;
-//     }
-//
-//     virtual bool DeserializeVectorNestedObject(byte** data,
-//                                                int size,
-//                                                byte* ptr,
-//                                                uint32 version) {
-//       ASSERT(data, (_T("")));
-//       ASSERT(*data, (_T("")));
-//       ASSERT(ptr, (_T("")));
-//       if (ptr == reinterpret_cast<byte*>(&value6_))
-//         return DeserializeVectorNestedObjectHelper(data,
-//                                                    size,
-//                                                    &value6_,
-//                                                    version);
-//       return false;
-//     }
-//
-//    private:
-//     int value1_;
-//     CString value2_;
-//     FooObject value3_;
-//     std::vector<byte> value4_;
-//     std::vector<CString> value5_;
-//     std::vector<BarObject> value6_;
-//     int value7_;
-//   };
-//
-// Binary format:
-//
-//   1) Value type: data
-//      e.g.  100           =>   64 00 00 00
-//   2) CString:    size count data
-//      e.g.  "ABC"         =>   02 00 00 00 03 00 00 00 41 00 42 00 43 00
-//   3) Vector:     size count data
-//      e.g.  vector<int> = {1, 2}
-//                          =>   04 00 00 00 02 00 00 00 01 00 00 00 02 00 00 00
-//
-// TODO(omaha):
-//   1) Define struct TypeTrait for all type-related info
-//   2) Initialize TypeTrait on per-type basis instead of per-object basis
-
-#ifndef OMAHA_COMMON_SERIALIZABLE_OBJECT_H_
-#define OMAHA_COMMON_SERIALIZABLE_OBJECT_H_
-
-#include <vector>
-#include "base/basictypes.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/type_utils.h"
-
-namespace omaha {
-
-// Constants
-const uint32 kLatestSerializableVersion = 0xFFFFFFFF;
-
-// Serializable object
-class SerializableObject {
- private:
-  // Define SerializableMemberType, for internal use
-  typedef uint32 SerializableMemberType;
-
-  #define SERIALIZABLE_VALUE_TYPE     1
-  #define SERIALIZABLE_CSTRING        2
-  #define SERIALIZABLE_NESTED_OBJECT  3
-  #define SERIALIZABLE_VECTOR         0x8000
-
-  // Serializable member info
-  struct SerializableMemberInfo {
-    byte* ptr;                      // Pointers to the serializable member
-    SerializableMemberType type;    // Type of the serializable member
-    int size;                       // Size of the serializable member
-    uint32 version;                 // Version when the member is added
-
-    SerializableMemberInfo()
-        : ptr(NULL), type(SERIALIZABLE_VALUE_TYPE), size(0) {}
-  };
-
- public:
-  // Constructor
-  SerializableObject() {}
-
-  // Destructor
-  virtual ~SerializableObject() {}
-
-  // Serialize
-  bool Serialize(std::vector<byte>* data) const;
-
-  // Deserialize the data for the latest version
-  bool Deserialize(byte* data, int size) {
-    return Deserialize(data, size, kLatestSerializableVersion);
-  }
-
-  // Deserialize the data for a particular version
-  bool Deserialize(byte* data, int size, uint32 version);
-
- protected:
-  // Clear the serializable member list
-  void ClearSerializableMemberList() {
-    members_.clear();
-  }
-
-  // Add value-typed member to the serializable member list
-  template<typename T>
-  void AddSerializableMember(T* ptr) {
-    return AddSerializableMember(0, ptr);
-  }
-
-  // Add value-typed member to the serializable member list
-  template<typename T>
-  void AddSerializableMember(uint32 version, T* ptr) {
-    if (SUPERSUBCLASS(SerializableObject, T)) {
-      #pragma warning(push)
-      // reinterpret_cast used between related classes
-      #pragma warning(disable : 4946)
-      return AddSerializableMember(version,
-                                   reinterpret_cast<SerializableObject*>(ptr),
-                                   sizeof(T));
-      #pragma warning(pop)
-    }
-    SerializableMemberInfo member;
-    member.ptr = reinterpret_cast<byte*>(ptr);
-    member.type = SERIALIZABLE_VALUE_TYPE;
-    member.size = sizeof(T);
-    member.version = version;
-    members_.push_back(member);
-  }
-
-  // Add CString-typed member to the serializable member list
-  void AddSerializableMember(CString* ptr) {
-    AddSerializableMember(0, ptr);
-  }
-
-  // Add CString-typed member to the serializable member list
-  void AddSerializableMember(uint32 version, CString* ptr) {
-    SerializableMemberInfo member;
-    member.ptr = reinterpret_cast<byte*>(ptr);
-    member.type = SERIALIZABLE_CSTRING;
-    member.size = sizeof(TCHAR);
-    member.version = version;
-    members_.push_back(member);
-  }
-
-  // Add nested serializable member to the serializable member list
-  void AddSerializableMember(SerializableObject* ptr, int size) {
-    AddSerializableMember(0, ptr, size);
-  }
-
-  // Add nested serializable member to the serializable member list
-  void AddSerializableMember(uint32 version,
-                             SerializableObject* ptr,
-                             int size) {
-    SerializableMemberInfo member;
-    member.ptr = reinterpret_cast<byte*>(ptr);
-    member.type = SERIALIZABLE_NESTED_OBJECT;
-    member.size = size;
-    member.version = version;
-    members_.push_back(member);
-  }
-
-  // Add vector-typed member to the serializable member list
-  template<typename T>
-  void AddSerializableMember(std::vector<T>* ptr) {
-    AddSerializableMember(0, ptr);
-  }
-
-  // Add vector-typed member to the serializable member list
-  template<typename T>
-  void AddSerializableMember(uint32 version, std::vector<T>* ptr) {
-    SerializableMemberInfo member;
-    member.ptr = reinterpret_cast<byte*>(ptr);
-    member.version = version;
-
-    if (SUPERSUBCLASS(CString, T)) {
-      member.type =
-          static_cast<SerializableMemberType>(SERIALIZABLE_VECTOR |
-                                              SERIALIZABLE_CSTRING);
-      member.size = sizeof(TCHAR);
-    } else if (SUPERSUBCLASS(SerializableObject, T)) {
-      member.type =
-          static_cast<SerializableMemberType>(SERIALIZABLE_VECTOR |
-                                              SERIALIZABLE_NESTED_OBJECT);
-      member.size = sizeof(T);
-    } else {
-      member.type =
-          static_cast<SerializableMemberType>(SERIALIZABLE_VECTOR |
-                                              SERIALIZABLE_VALUE_TYPE);
-      member.size = sizeof(T);
-    }
-
-    members_.push_back(member);
-  }
-
-  // If there is a vector of SerializableObject to be serialized, the derived
-  // class need to provide the implementation
-  virtual bool SerializeVectorNestedObject(std::vector<byte>*,
-                                           const byte*) const {
-    ASSERT(false, (_T("Provide the implementation in the derived class.")));
-    return false;
-  }
-
-  // Helper method to serialize a vector of SerializableObject
-  template<typename T>
-  bool SerializeVectorNestedObjectHelper(std::vector<byte>* data,
-                                         const std::vector<T>* list) const {
-    ASSERT(data, (_T("")));
-    ASSERT(list, (_T("")));
-    ASSERT(SUPERSUBCLASS(SerializableObject, T), (_T("")));
-
-    // Size of SerializableObject is unknown
-    SerializeSizeAndCount(data, 0, list->size());
-    for (size_t i = 0; i < list->size(); ++i) {
-      // To work around compiler complaint while using dynamic_cast
-      SerializableObject* so =
-          const_cast<SerializableObject*>(
-              static_cast<const SerializableObject*>(&(*list)[i]));
-      bool res = so->Serialize(data);
-      if (!res)
-        return false;
-    }
-    return true;
-  }
-
-  // If there is a vector of SerializableObject to be serialized, the derived
-  // class need to provide the implementation
-  virtual bool DeserializeVectorNestedObject(byte**, int, byte*, uint32) {
-    ASSERT(false, (_T("provide the implementation in the derived class.")));
-    return false;
-  }
-
-  // Helper method to deserialize a vector of SerializableObject
-  template<typename T>
-  bool DeserializeVectorNestedObjectHelper(byte** data,
-                                           int size,
-                                           std::vector<T>* list,
-                                           uint32 version) {
-    ASSERT(data, (_T("")));
-    ASSERT(*data, (_T("")));
-    ASSERT(size, (_T("")));
-    ASSERT(list, (_T("")));
-    ASSERT(SUPERSUBCLASS(SerializableObject, T), (_T("")));
-
-    byte* tail = *data + size;
-
-    // Size of SerializableObject is unknown
-    int count = 0;
-    bool res = DeserializeSizeAndCount(&count, 0, data, size);
-    if (!res)
-      return false;
-
-    for (int i = 0; i < count; ++i) {
-      T obj;
-      bool res = obj.DeserializeHelper(data, tail - *data, version);
-      if (!res)
-        return false;
-      list->push_back(obj);
-    }
-    return true;
-  }
-
- private:
-  // Serialize the size and count values
-  void SerializeSizeAndCount(std::vector<byte>* data,
-                             int size,
-                             int count) const;
-
-  // Serialize a list of value-typed elements
-  void SerializeValueList(std::vector<byte>* ser_data,
-                          const byte* raw_data,
-                          int size,
-                          int count) const;
-
-  // Deserialize helper
-  bool DeserializeHelper(byte** data, int size, uint32 version);
-
-  // Deserialize the size and count values
-  bool DeserializeSizeAndCount(int* count,
-                               int size,
-                               byte** ser_data,
-                               int ser_size) const;
-
-  // Deserialize a list of value-typed elements
-  bool DeserializeValueList(std::vector<byte>* raw_data,
-                            int size,
-                            byte** ser_data,
-                            int ser_size);
-
-  // List of serializable members
-  std::vector<SerializableMemberInfo> members_;
-
-  // We need to initialize TypeTrait on per-type basis instead of per-object
-  // basis and remove the following use of macro.
-  DISALLOW_EVIL_CONSTRUCTORS(SerializableObject);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_SERIALIZABLE_OBJECT_H_
diff --git a/base/serializable_object_unittest.cc b/base/serializable_object_unittest.cc
deleted file mode 100644
index 8ae5fec..0000000
--- a/base/serializable_object_unittest.cc
+++ /dev/null
@@ -1,248 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/serializable_object.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-// Template test function to round-trip an object through its serialized form.
-// Requires the object to implement SetTestValues() and VerifyTestValues().
-template <class T>
-void TestSerializeRoundTrip() {
-  T in;
-  T out;
-  std::vector<byte> data;
-
-  in.SetTestValues();
-  in.VerifyTestValues();  // sanity check to catch broken tests
-  EXPECT_TRUE(in.Serialize(&data));
-  EXPECT_TRUE(out.Deserialize(&data[0], data.size()));
-  out.VerifyTestValues();
-}
-
-
-// Ordinary values.
-class SimpleValues : public SerializableObject {
- public:
-  SimpleValues() {
-    AddSerializableMember(&value1_);
-    AddSerializableMember(&value2_);
-    AddSerializableMember(&value3_);
-    AddSerializableMember(&value4_);
-  }
-
-  virtual void SetTestValues() {
-    value1_ = 452;
-    value2_ = 'Z';
-    value3_ = false;
-    value4_ = 9276554;
-  }
-
-  virtual void VerifyTestValues() {
-    EXPECT_EQ(452, value1_);
-    EXPECT_EQ('Z', value2_);
-    EXPECT_EQ(false, value3_);
-    EXPECT_EQ(9276554, value4_);
-  }
-
- private:
-  int value1_;
-  char value2_;
-  bool value3_;
-  int value4_;
-};
-
-TEST(SerializableObjectTest, SimpleValues) {
-  TestSerializeRoundTrip<SimpleValues>();
-}
-
-
-// Strings.
-const TCHAR kString1[] = _T("an example\tvalue\n");
-const TCHAR kString2[] = _T("");
-const TCHAR kString3[] = _T("and the mome raths outgrabe");
-
-class StringValues : public SerializableObject {
- public:
-  StringValues() {
-    AddSerializableMember(&string1_);
-    AddSerializableMember(&string2_);
-    AddSerializableMember(&string3_);
-  }
-
-  virtual void SetTestValues() {
-    string1_ = kString1;
-    string2_ = kString2;
-    string3_ = kString3;
-  }
-
-  virtual void VerifyTestValues() {
-    EXPECT_STREQ(kString1, string1_);
-    EXPECT_STREQ(kString2, string2_);
-    EXPECT_STREQ(kString3, string3_);
-  }
-
- private:
-  CString string1_;
-  CString string2_;
-  CString string3_;
-};
-
-TEST(SerializableObjectTest, StringValues) {
-  TestSerializeRoundTrip<StringValues>();
-}
-
-
-// Nested objects.
-class NestedObjects : public SerializableObject {
- public:
-  NestedObjects() {
-    AddSerializableMember(&simple_values_);
-    AddSerializableMember(&string_values_);
-  }
-
-  virtual void SetTestValues() {
-    simple_values_.SetTestValues();
-    string_values_.SetTestValues();
-  }
-
-  virtual void VerifyTestValues() {
-    simple_values_.VerifyTestValues();
-    string_values_.VerifyTestValues();
-  }
-
- private:
-  SimpleValues simple_values_;
-  StringValues string_values_;
-};
-
-TEST(SerializableObjectTest, NestedObjects) {
-  TestSerializeRoundTrip<NestedObjects>();
-}
-
-
-// Vector of values.
-class ValueVector : public SerializableObject {
- public:
-  ValueVector() {
-    AddSerializableMember(&vector_);
-    AddSerializableMember(&empty_vector_);
-  }
-
-  virtual void SetTestValues() {
-    vector_.push_back(5);
-    vector_.push_back(8);
-    vector_.push_back(13);
-  }
-
-  virtual void VerifyTestValues() {
-    EXPECT_EQ(0, empty_vector_.size());
-    EXPECT_EQ(3, vector_.size());
-    EXPECT_EQ(5, vector_[0]);
-    EXPECT_EQ(8, vector_[1]);
-    EXPECT_EQ(13, vector_[2]);
-  }
-
- private:
-  std::vector<int> vector_;
-  std::vector<int> empty_vector_;
-};
-
-TEST(SerializableObjectTest, ValueVector) {
-  TestSerializeRoundTrip<ValueVector>();
-}
-
-
-// Vector of objects.
-class InnerObject : public SerializableObject {
- public:
-  InnerObject() : value_(-1) {
-    AddSerializableMember(&value_);
-  }
-
-  explicit InnerObject(int i) : value_(i) {
-    AddSerializableMember(&value_);
-  }
-
-  InnerObject(const InnerObject& other) {
-    AddSerializableMember(&value_);
-    value_ = other.value_;
-  }
-
-  InnerObject& operator=(const InnerObject& other) {
-    value_ = other.value_;
-    return *this;
-  }
-
-  int value() {
-    return value_;
-  }
-
- private:
-  int value_;
-};
-
-class ObjectVector : public SerializableObject {
- public:
-  ObjectVector() {
-    AddSerializableMember(&vector_);
-  }
-
-  virtual void SetTestValues() {
-    vector_.push_back(InnerObject(21));
-    vector_.push_back(InnerObject(34));
-    vector_.push_back(InnerObject(55));
-  }
-
-  virtual void VerifyTestValues() {
-    EXPECT_EQ(3, vector_.size());
-    EXPECT_EQ(21, vector_[0].value());
-    EXPECT_EQ(34, vector_[1].value());
-    EXPECT_EQ(55, vector_[2].value());
-  }
-
-  virtual bool SerializeVectorNestedObject(std::vector<byte>* data,
-                                           const byte* ptr) const {
-    EXPECT_TRUE(data);
-    EXPECT_TRUE(ptr);
-    if (ptr == reinterpret_cast<const byte*>(&vector_))
-      return SerializeVectorNestedObjectHelper(data, &vector_);
-    return false;
-  }
-
-  virtual bool DeserializeVectorNestedObject(byte** data,
-                                             int size,
-                                             byte* ptr,
-                                             uint32 version) {
-    EXPECT_TRUE(data);
-    EXPECT_TRUE(ptr);
-    if (ptr == reinterpret_cast<byte*>(&vector_)) {
-      return DeserializeVectorNestedObjectHelper(data, size,
-                                                 &vector_, version);
-    }
-    return false;
-  }
-
- private:
-  std::vector<InnerObject> vector_;
-};
-
-TEST(SerializableObjectTest, ObjectVector) {
-  TestSerializeRoundTrip<ObjectVector>();
-}
-
-}  // namespace omaha
-
diff --git a/base/service_utils.cc b/base/service_utils.cc
deleted file mode 100644
index e190bd5..0000000
--- a/base/service_utils.cc
+++ /dev/null
@@ -1,360 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-//
-// Service-related utilities.
-//
-
-#include "omaha/base/service_utils.h"
-
-#include <windows.h>
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/smart_handle.h"
-#include "omaha/base/string.h"
-#include "omaha/base/timer.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-HRESULT ScmDatabase::EnumerateServices(
-    ScmDatabase::EnumerateServicesCallback callback,
-    void* callback_context) {
-  ASSERT1(callback);
-  if (!callback)
-    return E_POINTER;
-
-  const wchar_t* kServicesRegKeyFromRoot =
-    L"SYSTEM\\CurrentControlSet\\Services";
-
-  HRESULT hr = E_FAIL;
-
-  RegKey services_key;
-  if (FAILED(hr = services_key.Open(HKEY_LOCAL_MACHINE,
-                                    kServicesRegKeyFromRoot,
-                                    KEY_ENUMERATE_SUB_KEYS))) {
-    ASSERT1(false);
-    REPORT(false, R_ERROR, (L"Couldn't open services subkey, hr=0x%x", hr),
-           9834572);
-    return hr;
-  }
-
-  CString service_name;
-  int key_index = 0;
-  while (SUCCEEDED(hr = services_key.GetSubkeyNameAt(key_index++,
-                                                     &service_name))) {
-    hr = callback(callback_context, service_name);
-    if (FAILED(hr) || hr == S_FALSE) {
-      // Callback asked to terminate enumeration.
-      return hr;
-    }
-  }
-
-  if (hr != HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS)) {
-    ASSERT1(false);
-    REPORT(false, R_ERROR, (L"Failed enumerating service subkeys: 0x%x", hr),
-           1499372);
-    return hr;
-  }
-
-  return S_OK;
-}
-
-bool ScmDatabase::IsServiceStateEqual(SC_HANDLE service, DWORD state) {
-  ASSERT1(service);
-
-  DWORD bytes_needed_ignored = 0;
-  byte buffer[8 * 1024] = { 0 };
-  QUERY_SERVICE_CONFIG* service_config =
-    reinterpret_cast<QUERY_SERVICE_CONFIG*>(buffer);
-  if (!::QueryServiceConfig(service, service_config, sizeof(buffer),
-                            &bytes_needed_ignored)) {
-    ASSERT(false, (L"Failed to query service config, perhaps handle is missing "
-                   L"SERVICE_QUERY_CONFIG rights?"));
-    return false;
-  }
-
-  return (service_config[0].dwStartType == state);
-}
-
-bool ScmDatabase::IsServiceMarkedDeleted(SC_HANDLE service) {
-  ASSERT1(service);
-
-  // Services that have been marked deleted are always in the
-  // SERVICE_DISABLED state.  The converse is not true, and unfortunately
-  // there is no way to check if a service has been marked deleted except by
-  // attempting to change one of its configuration parameters, at which
-  // point you get a specific error indicating it has been marked deleted.
-  //
-  // The following call to ChangeServiceConfig does not actually change any
-  // of the service's configuration, but should hopefully return the
-  // specific error if the service has been marked deleted.
-  if (!::ChangeServiceConfig(service, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE,
-                             SERVICE_NO_CHANGE, NULL, NULL, NULL, NULL,
-                             NULL, NULL, NULL) &&
-      ::GetLastError() == ERROR_SERVICE_MARKED_FOR_DELETE) {
-    ASSERT1(IsServiceStateEqual(service, SERVICE_DISABLED));
-    return true;
-  } else {
-    return false;
-  }
-}
-
-HRESULT ServiceInstall::UninstallByPrefix(void* context,
-                                          const wchar_t* service_name) {
-  ASSERT1(context != NULL);
-  if (!context)
-    return E_POINTER;
-
-  UninstallByPrefixParams* params =
-    reinterpret_cast<UninstallByPrefixParams*>(context);
-
-  if (String_StartsWith(service_name, params->prefix, true) &&
-      lstrcmpiW(service_name, params->unless_matches) != 0) {
-    // The service must be stopped before attempting to remove it from the
-    // database. Otherwise, the SCM database remains dirty and all service
-    // functions return ERROR_SERVICE_MARKED_FOR_DELETE until the system is
-    // restarted.
-    StopService(service_name);
-
-    scoped_service scm(::OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS));
-    if (!scm) {
-      HRESULT hr = HRESULTFromLastError();
-      ASSERT1(false);
-      REPORT(false, R_ERROR, (L"Failed to open SCM: 0x%x", hr), 77223399);
-      return hr;
-    }
-    scoped_service service(::OpenService(get(scm),
-                                         service_name,
-                                         SERVICE_CHANGE_CONFIG | DELETE));
-    if (service) {
-      // The service may not get deleted immediately; if there are handles to
-      // it open, it won't get deleted until the last one is closed.  If the
-      // service is running, it won't get deleted immediately but rather will be
-      // marked for deletion (which happens on next reboot).  Having to wait for
-      // a while and even until reboot doesn't matter much to us as our new
-      // service is installed under a new name and we are just cleaning up old
-      // ones.
-      if (!::DeleteService(get(service))) {
-        // We do not assert but just report so that we know if this happens
-        // abnormally often.
-        if (::GetLastError() == ERROR_SERVICE_MARKED_FOR_DELETE) {
-          REPORT(false, R_INFO,
-                 (L"Failed to immediately delete service %s", service_name),
-                 5440098);
-        } else {
-          ASSERT(false, (L"Failed to delete service %s, error %d",
-                         service_name, ::GetLastError()));
-        }
-        // DO NOT return an error here; we want to keep going through all the
-        // services.
-      } else {
-        SERVICE_LOG(L1,
-                    (L"Deleted old service %s", service_name));
-      }
-    } else {
-      // Per documentation of the EnumerateServicesCallback interface we can
-      // expect not to be able to open the service with one of the following two
-      // error codes, because of discrepancies between the registry and the SCM
-      // database in memory.
-      DWORD last_error = ::GetLastError();
-      ASSERT(last_error == ERROR_SERVICE_DOES_NOT_EXIST ||
-             last_error == ERROR_INVALID_NAME,
-             (L"Failed to open service %s, last error %d", service_name,
-              last_error));
-      REPORT(last_error == ERROR_SERVICE_DOES_NOT_EXIST ||
-             last_error == ERROR_INVALID_NAME, R_ERROR,
-             (L"Failed to open service %s, last error %d", service_name,
-              last_error), 5576234);
-    }
-  }
-
-  return S_OK;
-}
-
-CString ServiceInstall::GenerateServiceName(const TCHAR* service_prefix) {
-  FILETIME ft = {0};
-  ::GetSystemTimeAsFileTime(&ft);
-  CString versioned_service_name;
-  versioned_service_name.Format(_T("%s%x%x"),
-                                service_prefix,
-                                ft.dwHighDateTime,
-                                ft.dwLowDateTime);
-
-  ASSERT1(!versioned_service_name.IsEmpty());
-  return versioned_service_name;
-}
-
-HRESULT ServiceInstall::UninstallServices(const TCHAR* service_prefix,
-                                          const TCHAR* exclude_service) {
-  SERVICE_LOG(L2, (L"ServiceInstall::UninstallServices"));
-
-  UninstallByPrefixParams params = {
-    service_prefix,
-    exclude_service,
-  };
-
-  return ScmDatabase::EnumerateServices(UninstallByPrefix, &params);
-}
-
-bool ServiceInstall::CanInstallWithoutReboot() {
-  scoped_service scm(::OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS));
-  if (!scm) {
-    ASSERT1(false);
-    REPORT(false, R_ERROR, (L"Failed to open SCM: %d", ::GetLastError()),
-           77224449);
-    return false;  // request reboot just in case
-  }
-
-  scoped_service service(::OpenService(get(scm),
-                                       _T("gupdate"),
-                                       SERVICE_QUERY_CONFIG |
-                                       SERVICE_CHANGE_CONFIG));
-  if (!service) {
-    DWORD last_error = ::GetLastError();
-    if (last_error == ERROR_ACCESS_DENIED ||
-        last_error == ERROR_INVALID_HANDLE) {
-      // unable to verify the service is fully deleted, so request reboot
-      ASSERT(false, (L"Expected access and correct handle"));
-      return false;
-    } else {
-      // service does not exist
-      return true;
-    }
-  }
-
-  return !ScmDatabase::IsServiceMarkedDeleted(get(service));
-}
-
-HRESULT ServiceInstall::StopService(const CString& service_name) {
-  SERVICE_LOG(L1, (_T("[ServiceInstall::StopService]")));
-
-  scoped_service scm(::OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS));
-  if (!scm) {
-    return HRESULTFromLastError();
-  }
-  scoped_service service(::OpenService(get(scm),
-                                       service_name,
-                                       SERVICE_QUERY_STATUS | SERVICE_STOP));
-  if (!service) {
-    return HRESULTFromLastError();
-  }
-
-  SERVICE_STATUS status = {0};
-  if (::QueryServiceStatus(get(service), &status)) {
-    if (status.dwCurrentState != SERVICE_STOPPED &&
-        status.dwCurrentState != SERVICE_STOP_PENDING) {
-      // Stop the service.
-      SetZero(status);
-      if (!::ControlService(get(service), SERVICE_CONTROL_STOP, &status)) {
-        return HRESULTFromLastError();
-      }
-    }
-  }
-
-  if (status.dwCurrentState != SERVICE_STOPPED) {
-    SERVICE_LOG(L1, (_T("[Service is stopping...]")));
-
-    const int kWaitForServiceToStopMs = 8000;
-    LowResTimer t(true);
-
-    while (status.dwCurrentState != SERVICE_STOPPED &&
-           t.GetMilliseconds() < kWaitForServiceToStopMs) {
-      const int kSleepTimeMs = 50;
-      ::Sleep(kSleepTimeMs);
-      SetZero(status);
-      VERIFY1(::QueryServiceStatus(get(service), &status));
-      SERVICE_LOG(L1, (_T("[Waiting for service to stop][time elapsed: %d ms]"),
-          static_cast<int>(t.GetMilliseconds())));
-    }
-
-    if (status.dwCurrentState != SERVICE_STOPPED) {
-      SERVICE_LOG(LEVEL_WARNING, (_T("[Service did not stop! Not good...]")));
-      return HRESULT_FROM_WIN32(ERROR_TIMEOUT);
-    }
-  }
-
-  ASSERT1(status.dwCurrentState == SERVICE_STOPPED);
-  SERVICE_LOG(L1, (_T("[ServiceInstall::StopService - service stopped]")));
-  return S_OK;
-}
-
-bool ServiceInstall::IsServiceInstalled(const TCHAR* service_name) {
-  ASSERT1(service_name);
-  scoped_service scm(::OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT));
-  if (!scm) {
-    return false;
-  }
-  scoped_service service(::OpenService(get(scm),
-                                       service_name,
-                                       SERVICE_QUERY_CONFIG));
-  return valid(service);
-}
-
-// TODO(Omaha): Move all functions under a common ServiceUtils namespace.
-bool ServiceUtils::IsServiceRunning(const TCHAR* service_name) {
-  ASSERT1(service_name);
-
-  scoped_service scm(::OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT));
-  if (!scm) {
-    SERVICE_LOG(LE, (_T("[OpenSCManager fail][0x%x]"), HRESULTFromLastError()));
-    return false;
-  }
-
-  scoped_service service(::OpenService(get(scm),
-                                       service_name,
-                                       SERVICE_QUERY_STATUS));
-  if (!service) {
-    SERVICE_LOG(LE, (_T("[OpenService failed][%s][0x%x]"),
-                     service_name, HRESULTFromLastError()));
-    return false;
-  }
-
-  SERVICE_STATUS status = {0};
-  if (!::QueryServiceStatus(get(service), &status)) {
-    SERVICE_LOG(LE, (_T("[QueryServiceStatus failed][%s][0x%x]"),
-                     service_name, HRESULTFromLastError()));
-    return false;
-  }
-
-  return status.dwCurrentState == SERVICE_RUNNING ||
-         status.dwCurrentState == SERVICE_START_PENDING;
-}
-
-bool ServiceUtils::IsServiceDisabled(const TCHAR* service_name) {
-  ASSERT1(service_name);
-
-  scoped_service scm(::OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT));
-  if (!scm) {
-    SERVICE_LOG(LE, (_T("[OpenSCManager fail][0x%x]"), HRESULTFromLastError()));
-    return false;
-  }
-
-  scoped_service service(::OpenService(get(scm),
-                                       service_name,
-                                       SERVICE_QUERY_CONFIG));
-  if (!service) {
-    SERVICE_LOG(LE, (_T("[OpenService failed][%s][0x%x]"),
-                     service_name, HRESULTFromLastError()));
-    return false;
-  }
-
-  return ScmDatabase::IsServiceStateEqual(get(service), SERVICE_DISABLED);
-}
-
-}  // namespace omaha
-
diff --git a/base/service_utils.h b/base/service_utils.h
deleted file mode 100644
index 103e307..0000000
--- a/base/service_utils.h
+++ /dev/null
@@ -1,143 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Service-related utilities.
-
-#ifndef OMAHA_BASE_SERVICE_UTILS_H__
-#define OMAHA_BASE_SERVICE_UTILS_H__
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-// Utility functions for working with the SCM database.
-class ScmDatabase {
- public:
-  // Callback function type for EnumerateServices. This gets called for each
-  // service in the registry.
-  //
-  // @param callback_context Passed unchanged from the caller of
-  // EnumerateServices to the callback function.
-  // @param service_name The name of the service (not the display name but
-  // rather the canonical name, to be used with e.g. ::OpenService()).  Note
-  // that because this function is based on enumerating the registry, it's
-  // possible that services that were recently deleted will show up in the
-  // enumeration; therefore, it should not be considered an error if you try
-  // to ::OpenService() on this name and it fails with a last error of
-  // ERROR_SERVICE_DOES_NOT_EXIST or possibly ERROR_INVALID_NAME (if
-  // somebody messed up the registry by hand).
-  //
-  // @return S_OK to continue enumeration, S_FALSE or a COM error code to
-  // stop enumeration.  The return value will be propagated to the caller
-  // of Enumerate.
-  //
-  // @note The initial version of this function used EnumServicesStatusEx
-  // but it turns out the function is a fair bit flaky, not returning all
-  // recently created (e.g. created but never started) services.
-  typedef HRESULT(*EnumerateServicesCallback)(void* callback_context,
-                                              const wchar_t* service_name);
-
-  // Calls 'callback' for each of the services in the registry.
-  //
-  // @param callback Callback function to call
-  // @param callback_context Passed unchanged to your callback function
-  //
-  // @return S_OK or a COM error code.
-  static HRESULT EnumerateServices(EnumerateServicesCallback callback,
-                                   void* callback_context);
-
-  // Returns true iff the service passed in is in the indicated state.
-  //
-  // @param service An open handle to a service.  The handle must have at
-  // least SERVICE_QUERY_CONFIG rights.
-  // @param state One of the SERVICE_XXX constants indicating the state of a
-  // service (e.g. SERVICE_DISABLED).
-  //
-  // @return True iff 'service' is in state 'state'.
-  static bool IsServiceStateEqual(SC_HANDLE service, DWORD state);
-
-  // Returns true iff the service passed in has been marked deleted.
-  //
-  // @param service An open handle to a service.  The handle must have at
-  // least SERVICE_QUERY_CONFIG and SERVICE_CHANGE_CONFIG rights.
-  //
-  // @return True iff 'service' has been marked deleted.
-  static bool IsServiceMarkedDeleted(SC_HANDLE service);
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(ScmDatabase);
-};
-
-// Utility functions for the service's installation, overinstall etc.
-class ServiceInstall {
- public:
-
-  // Generates a versioned service name based on the current system time.
-  static CString GenerateServiceName(const TCHAR* service_prefix);
-
-  // Uninstalls all versions of the service other than the one that matches
-  // the service name passed in. Pass in NULL to uninstall everything.
-  static HRESULT UninstallServices(const TCHAR* service_prefix,
-                                   const TCHAR* exclude_service);
-
-  static bool IsServiceInstalled(const TCHAR* service_name);
-
-  // @return True if the current service can be installed without rebooting,
-  // false if a reboot is required before it can be installed.  The cases
-  // where the current service can be installed without rebooting are:
-  // a) when no service exists with the current name
-  // b) when there is an existing service with the current name but it is
-  //    not marked for deletion
-  static bool CanInstallWithoutReboot();
-
-  // Given a service name, stops it if it is already running.
-  static HRESULT StopService(const CString& service_name);
-
- protected:
-  // Context passed to the UninstallIfNotCurrent function; this is made a
-  // parameter so we can unit test the function without mucking with the
-  // "actual" services.
-  struct UninstallByPrefixParams {
-    CString prefix;  // prefix of services we want to uninstall
-    CString unless_matches;  // name of current service, to not touch
-  };
-
-  // Uninstalls a given service if it matches a given prefix but does not match
-  // a given full service name.
-  //
-  // This is an ScmDatabase::EnumerateServicesCallback function.
-  //
-  // @param context Pointer to an UninstallByPrefix structure.
-  static HRESULT UninstallByPrefix(void* context, const wchar_t* service_name);
-
- private:
-  DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceInstall);
-};
-
-// Service utility functions for querying current state, and eventually more.
-class ServiceUtils {
- public:
-  static bool IsServiceRunning(const TCHAR* service_name);
-  static bool IsServiceDisabled(const TCHAR* service_name);
-
- private:
-  DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceUtils);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_SERVICE_UTILS_H__
diff --git a/base/service_utils_unittest.cc b/base/service_utils_unittest.cc
deleted file mode 100644
index 00fe871..0000000
--- a/base/service_utils_unittest.cc
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/service_utils.h"
-#include <lmsname.h>
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-// Set to true when the test callback sees the service indicated in the
-// context parameter.
-bool found_service = false;
-
-HRESULT TestEnumCallback(void* context, const wchar_t* service_name) {
-  EXPECT_TRUE(context);
-
-  const wchar_t* find_service_name = reinterpret_cast<const wchar_t*>(context);
-  if (lstrcmpW(service_name, find_service_name) == 0) {
-    found_service = true;
-  }
-
-  return S_OK;
-}
-
-TEST(ServiceUtilsTest, ScmDatabaseEnumerateServices) {
-  found_service = false;
-  EXPECT_TRUE(SUCCEEDED(ScmDatabase::EnumerateServices(TestEnumCallback,
-                            reinterpret_cast<void*>(_T("RpcSs")))));
-  EXPECT_TRUE(found_service);
-}
-
-TEST(ServiceUtilsTest, IsServiceInstalled) {
-  EXPECT_TRUE(ServiceInstall::IsServiceInstalled(SERVICE_SCHEDULE));
-  EXPECT_FALSE(ServiceInstall::IsServiceInstalled(_T("FooBar")));
-}
-
-TEST(ServiceUtilsTest, IsServiceRunning) {
-  EXPECT_TRUE(ServiceUtils::IsServiceRunning(SERVICE_SCHEDULE));
-  EXPECT_FALSE(ServiceUtils::IsServiceRunning(_T("FooBar")));
-}
-
-TEST(ServiceUtilsTest, IsServiceDisabled) {
-  EXPECT_FALSE(ServiceUtils::IsServiceDisabled(SERVICE_SCHEDULE));
-}
-
-}  // namespace omaha
-
diff --git a/base/shared_any.h b/base/shared_any.h
deleted file mode 100644
index d12413a..0000000
--- a/base/shared_any.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// See the comments in omaha/base/scoped_any.h for details.
-
-#ifndef OMAHA_COMMON_SHARED_ANY__
-#define OMAHA_COMMON_SHARED_ANY__
-
-#pragma warning(push)
-// C4640: construction of local static object is not thread-safe
-#pragma warning(disable : 4640)
-#include "omaha/third_party/smartany/shared_any.h"
-#pragma warning(pop)
-
-#endif  // OMAHA_COMMON_SHARED_ANY__
-
diff --git a/base/shared_memory_ptr.h b/base/shared_memory_ptr.h
deleted file mode 100644
index d813cc6..0000000
--- a/base/shared_memory_ptr.h
+++ /dev/null
@@ -1,392 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Defines template class used to share data
-// between processes.
-//
-
-#ifndef OMAHA_COMMON_SHARED_MEMORY_PTR_H__
-#define OMAHA_COMMON_SHARED_MEMORY_PTR_H__
-
-#include "base/debug.h"
-#include "base/singleton.h"
-#include "base/system_info.h"
-#include "base/vista_utils.h"
-
-namespace omaha {
-
-// SharedMemoryPtr class is designed to allow seamless data sharing process boundaries.
-// All the data passed as a template parameter will be shared between processes.
-// Very important to remember that for now - all shared data should be on stack.
-// For example if the class A had stl vector as a member, the members of the vector
-// would be allocated not from shared memory and therefore will not be shared.
-// That could be solved with allocators, but for now we don't need that.
-//
-// Here is a typical example of usage:
-//   Class A {
-//    int i_;
-//    double d_;
-//    .......
-//    ........
-//
-//    public:
-//    set_double(double d){d_=d;}
-//    double get_double(){return d_};
-//
-// };
-//
-// ... Prosess one...
-//    SharedMemoryPtr<A> spA("ABC");
-//    if (!spA)
-//      return false;
-//
-//    spA->set_double(3.14);
-//
-//  ... Process two ...
-//
-//
-//    SharedMemoryPtr<A> spA1("ABC");
-//    if (!spA1)
-//      return false;
-//
-//    process two will see the value set by process one.
-//    it will be 3.14
-//    double d = spA1->get_double();
-//
-
-// You should implement a class member of SystemSharedData if the data you want
-// to share is several hundred bytes. Always try this approach first before you implement
-// new class that is derived from SharedMemoryPtr. The main difference is that SharedMemoryPtr
-// will allocate a least page of shared memory. If your class is just a member of SystemSharedData
-// memory mapped file will be shared between members. It is just more efficient.
-// Look in system_shared_data.h , shared_data_member.h, and system_shared_data_members.h
-// for more details.
-
-// Forward declaration.
-template <typename LockType, typename T> class SharedMemoryPtr;
-
-// During several code reviews it has been noticed that the same error gets repeated over and over.
-// People create SharedMemoryPtr<SomeData>. And than the access to member functions of SomeData
-// is not synchronized by __mutexBlock or __mutexScope. So we need to somehow find a way to make
-// automatic syncronization whenever people access shared data methods or  members.
-// Since by design the only way we can acess shared data is through operator -> of SharedMemoryPtr
-// we need to somehow invoke synchronization at the time of access.
-// We can implement this mainly because of the mechanics of operator-> dictated by C++ standard.
-// When you apply operator-> to a type that's not a built-in pointer, the compiler does an interesting thing.
-// After looking up and applying the user-defined operator-> to that type, it applies operator-> again to the result.
-// The compiler keeps doing this recursively until it reaches a pointer to a built-in type, and only then proceeds with member access.
-// It follows that a SharedMemoryPtr<T> operator-> does not have to return a pointer.
-// It can return an object that in turn implements operator->, without changing the use syntax.
-// So we can implement: pre- and postfunction calls. (See Stroustrup 2000)
-// If you return an object of some type X
-// by value from operator->, the sequence of execution is as follows:
-// 1. Constructor of type X
-// 2. X::operator-> called;  returns a pointer to an object of type T of SharedMemoryPtr
-// 3. Member access
-// 4. Destructor of X
-// In a nutshell, we have a  way of implementing locked function calls.
-
-template <typename LockType, typename T>
-class SharedDataLockingProxy {
-public:
-  // Lock on construction.
-  SharedDataLockingProxy(SharedMemoryPtr<LockType, T> * mem_ptr, T* shared_data)
-    : mem_ptr_(mem_ptr), shared_data_(shared_data) {
-      mem_ptr_->Lock();
-    }
-   // Unlock on destruction.
-  ~SharedDataLockingProxy() {
-    mem_ptr_->Unlock();
-  }
-  // operator
-  T* operator->() const  {
-    ASSERT(shared_data_ != NULL, (L"NULL object pointer being dereferenced"));
-    return shared_data_;
-  }
-private:
-  SharedDataLockingProxy& operator=(const SharedDataLockingProxy&);
-  SharedMemoryPtr<LockType, T>* mem_ptr_;
-  T* shared_data_;
-  // To allow this implicit locking - copy constructor must be
-  // enabled. hence, no DISALLOW_EVIL_CONSTRUCTORS
-};
-
-template <typename LockType, typename T> class SharedMemoryPtr
-    : public LockType {
-  // Handle to disk file if we're backing this shared memory by a file
-  HANDLE file_;
-  // Local handle to file mapping.
-  HANDLE file_mapping_;
-  // pointer to a view.
-  T*     data_;
-  // If the first time creation can do some initialization.
-  bool   first_instance_;
-public:
-  // The heart of the whole idea. Points to shared memrory
-  // instead of the beginning of the class.
-  SharedDataLockingProxy<LockType, T> operator->() {
-    return SharedDataLockingProxy<LockType, T>(this, data_);
-  }
-  // To check after creation.
-  // For example:
-  // SharedMemoryPtr<GLock, SomeClass> sm;
-  // if (sm)
-  // { do whatever you want}
-  // else
-  // {error reporting}
-  operator bool() const {return ((file_mapping_ != NULL) && (data_ != NULL));}
-
-  // Initialize memory mapped file and sync mechanics.
-  // by calling InitializeSharedAccess
-  SharedMemoryPtr(const CString& name,
-                  LPSECURITY_ATTRIBUTES sa,
-                  LPSECURITY_ATTRIBUTES sa_mutex,
-                  bool read_only)
-      : file_(INVALID_HANDLE_VALUE),
-        file_mapping_(NULL),
-        data_(NULL) {
-    HRESULT hr = InitializeSharedAccess(name, false, sa, sa_mutex, read_only);
-    if (FAILED(hr)) {
-      UTIL_LOG(LE, (_T("InitializeSharedAccess failed [%s][%s][0x%x]"),
-                    name, read_only ? _T("R") : _T("RW"), hr));
-    }
-  }
-
-  // Use this constructor if you want to back the shared memory by a file.
-  // NOTE: if using a persistent shared memory, every object with this same
-  // name should be persistent. Otherwise, the objects marked as
-  // non-persistent will lead to InitializeSharedData called again if
-  // they are instantiated before the ones marked as persistent.
-  SharedMemoryPtr(bool persist,
-                  LPSECURITY_ATTRIBUTES sa,
-                  LPSECURITY_ATTRIBUTES sa_mutex,
-                  bool read_only)
-      : file_(INVALID_HANDLE_VALUE),
-        file_mapping_(NULL),
-        data_(NULL) {
-    // Each shared data must implement GetFileName() to use this c-tor. The
-    // implementation should be:
-    // const CString GetFileName() const {return L"C:\\directory\file";}
-    // This is purposedly different from GetSharedName, so that the user is
-    // well aware that a file name is expected, not a mutex name.
-    HRESULT hr = InitializeSharedAccess(data_->GetFileName(),
-                                        persist,
-                                        sa,
-                                        sa_mutex,
-                                        read_only);
-    if (FAILED(hr)) {
-      UTIL_LOG(LE, (_T("InitializeSharedAccess failed [%s][%s][0x%x]"),
-                    data_->GetFileName(), read_only ? _T("R") : _T("RW"), hr));
-    }
-  }
-
-  // Initialize memory mapped file and sync mechanics.
-  // by calling InitializeSharedAccess
-  SharedMemoryPtr() :
-      file_(INVALID_HANDLE_VALUE), file_mapping_(NULL), data_(NULL) {
-    // This should never happen but let's assert
-    // in case it does.
-    // Each shared data must implement GetSharedData() to use this c-tor.
-    // The implementation should be:
-    // const TCHAR * GetSharedName() const
-    //     {return L"Some_unique_string_with_no_spaces";}
-    HRESULT hr = InitializeSharedAccess(data_->GetSharedName(),
-                                        false,
-                                        NULL,
-                                        NULL,
-                                        false);
-    if (FAILED(hr)) {
-      UTIL_LOG(LE, (_T("InitializeSharedAccess failed [%s][%s][0x%x]"),
-                    data_->GetSharedName(), _T("RW"), hr));
-    }
-  }
-
-  // Clean up.
-  ~SharedMemoryPtr() {
-    Cleanup();
-  }
-
-  void Cleanup() {
-    __mutexScope(this);
-    if (data_)
-      UnmapViewOfFile(data_);
-    if (file_mapping_)
-      VERIFY(CloseHandle(file_mapping_), (L""));
-    if (file_ != INVALID_HANDLE_VALUE)
-      VERIFY(CloseHandle(file_), (L""));
-  }
-
-  // Initialize memory mapped file and sync object.
-  bool InitializeSharedAccess(const CString& name,
-                              bool persist,
-                              LPSECURITY_ATTRIBUTES sa,
-                              LPSECURITY_ATTRIBUTES sa_mutex,
-                              bool read_only) {
-    return InitializeSharedAccessInternal(name,
-                                          persist,
-                                          sa,
-                                          sa_mutex,
-                                          read_only,
-                                          sizeof(T),
-                                          &T::InitializeSharedData);
-  }
-
- private:
-  // Initialize memory mapped file and sync object.
-  //
-  // This internal method allows template method folding by only using things
-  // that are consistent in all templates.  Things that vary are passed in.
-  bool InitializeSharedAccessInternal(const CString& name, bool persist,
-                                      LPSECURITY_ATTRIBUTES sa,
-                                      LPSECURITY_ATTRIBUTES sa_mutex,
-                                      bool read_only,
-                                      size_t data_size,
-                                      void (T::*initialize_shared_data)
-                                          (const CString&)) {
-    // If this memory mapped object is backed by a file, then "name" is a fully
-    // qualified name with backslashes. Since we can't use backslashes in a
-    // mutex's name, let's make another name where we convert them to
-    // underscores.
-    CString mem_name(name);
-    if (persist) {
-      mem_name.Replace(_T('\\'), _T('_'));
-    }
-
-    // Initialize the mutex
-    CString mutex_name(mem_name + _T("MUTEX"));
-    LPSECURITY_ATTRIBUTES mutex_attr = sa_mutex ? sa_mutex : sa;
-    if (!InitializeWithSecAttr(mutex_name, mutex_attr)) {
-      ASSERT(false, (L"Failed to initialize mutex. Err=%i", ::GetLastError()));
-      return false;
-    }
-
-    // everything is synchronized till the end of the function or return.
-    __mutexScope(this);
-
-    first_instance_ = false;
-
-    if (persist) {
-      // Back this shared memory by a file
-      file_ = CreateFile(name,
-                         GENERIC_READ | (read_only ? 0 : GENERIC_WRITE),
-                         FILE_SHARE_READ | (read_only ? 0 : FILE_SHARE_WRITE),
-                         sa,
-                         OPEN_ALWAYS,
-                         NULL,
-                         NULL);
-      if (file_ == INVALID_HANDLE_VALUE)
-        return false;
-
-      if (!read_only && GetLastError() != ERROR_ALREADY_EXISTS)
-        first_instance_ = true;
-    } else {
-      ASSERT(file_ == INVALID_HANDLE_VALUE, (L""));
-      file_ = INVALID_HANDLE_VALUE;
-    }
-
-    if (read_only) {
-      file_mapping_ = OpenFileMapping(FILE_MAP_READ, false, mem_name);
-      if (!file_mapping_) {
-        UTIL_LOG(LW, (L"[OpenFileMapping failed][error %i]", ::GetLastError()));
-      }
-    } else {
-      file_mapping_ = CreateFileMapping(file_, sa,
-                                        PAGE_READWRITE, 0, data_size, mem_name);
-      ASSERT(file_mapping_, (L"CreateFileMapping. Err=%i", ::GetLastError()));
-    }
-
-    if (!file_mapping_) {
-      return false;
-    } else if (!read_only &&
-               file_ == INVALID_HANDLE_VALUE &&
-               GetLastError() != ERROR_ALREADY_EXISTS) {
-      first_instance_ = true;
-    }
-
-    data_ = reinterpret_cast<T*>(MapViewOfFile(file_mapping_,
-                                               FILE_MAP_READ |
-                                               (read_only ? 0 : FILE_MAP_WRITE),
-                                               0,
-                                               0,
-                                               data_size));
-
-    if (!data_) {
-      ASSERT(false, (L"MapViewOfFile. Err=%i", ::GetLastError()));
-      VERIFY(CloseHandle(file_mapping_), (L""));
-      file_mapping_ = NULL;
-
-      if (file_ != INVALID_HANDLE_VALUE) {
-        VERIFY(CloseHandle(file_), (L""));
-        file_ = INVALID_HANDLE_VALUE;
-      }
-
-      return false;
-    }
-
-    if (!first_instance_) {
-      return true;
-    }
-
-    // If this is the first instance of shared object
-    // call initialization function. This is nice but
-    // at the same time we can not share built in data types.
-    // SharedMemoryPtr<double> - will not compile. But this is OK
-    // We don't want all the overhead to just share couple of bytes.
-    // Signature is void InitializeSharedData()
-    (data_->*initialize_shared_data)(name);
-
-    return true;
-  }
-
-  DISALLOW_EVIL_CONSTRUCTORS(SharedMemoryPtr);
-};
-
-// Sometimes we want Singletons that are shared between processes.
-// SharedMemoryPtr can do that. But if used in C-written module there will be
-// a need to make SharedMemoryPtr a global object. Making a Singleton from SharedMemoryPtr
-// is possible in this situation, but syntactically this is very difficult to read.
-// The following template solves the problem. It hides difficult to read details inside.
-// Usage is the same as SharedMemoryPtr (ONLY through -> operator). Completely thread-safe.
-// Can be used in two ways:
-// Class A {
-//  public:
-//  void foo(){}
-//
-//};
-// SharedMemorySingleton<A> a, b;
-// a->foo();
-// b->foo();  //refers to the same data in any process.
-//
-//  or
-//
-// class A : public SharedMemorySingleton<A> {
-//  public:
-//  void foo(){}
-//};
-//  A a, b;
-//  a->foo();
-//  b->foo(); //refers to the same data in any process.
-
-template <typename LockType, typename T> class SharedMemorySingleton  {
-public:
-  SharedDataLockingProxy<LockType, T> operator->() {
-    return
-      Singleton<SharedMemoryPtr<LockType, T> >::Instance()->operator->();
-  }
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_SHARED_MEMORY_PTR_H__
diff --git a/base/shell.cc b/base/shell.cc
deleted file mode 100644
index 7483b03..0000000
--- a/base/shell.cc
+++ /dev/null
@@ -1,397 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Shell functions
-
-#include "omaha/base/shell.h"
-
-#include <shlobj.h>
-#include <shellapi.h>
-#include "omaha/base/app_util.h"
-#include "omaha/base/browser_utils.h"
-#include "omaha/base/const_utils.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/path.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/string.h"
-#include "omaha/base/system.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-// create and store a shortcut
-// uses shell IShellLink and IPersistFile interfaces
-HRESULT Shell::CreateLink(const TCHAR *source,
-                          const TCHAR *destination,
-                          const TCHAR *working_dir,
-                          const TCHAR *arguments,
-                          const TCHAR *description,
-                          WORD hotkey_virtual_key_code,
-                          WORD hotkey_modifiers,
-                          const TCHAR *icon) {
-  ASSERT1(source);
-  ASSERT1(destination);
-  ASSERT1(working_dir);
-  ASSERT1(arguments);
-  ASSERT1(description);
-
-  scoped_co_init co_init(COINIT_APARTMENTTHREADED);
-  HRESULT hr = co_init.hresult();
-  if (FAILED(hr) && hr != RPC_E_CHANGED_MODE) {
-    UTIL_LOG(LEVEL_ERROR, (_T("[Shell::CreateLink - failed to co_init]"), hr));
-    return hr;
-  }
-
-  UTIL_LOG(L1, (_T("[Create shell link]")
-                _T("[source %s dest %s dir %s arg %s desc %s hotkey %x:%x]"),
-                source, destination, working_dir, arguments, description,
-                hotkey_modifiers, hotkey_virtual_key_code));
-
-  // Get a pointer to the IShellLink interface
-  CComPtr<IShellLink> shell_link;
-
-  RET_IF_FAILED(shell_link.CoCreateInstance(CLSID_ShellLink));
-  ASSERT(shell_link, (L""));
-
-  // Set the path to the shortcut target and add the description
-  VERIFY1(SUCCEEDED(shell_link->SetPath(source)));
-  VERIFY1(SUCCEEDED(shell_link->SetArguments(arguments)));
-  VERIFY1(SUCCEEDED(shell_link->SetDescription(description)));
-  VERIFY1(SUCCEEDED(shell_link->SetWorkingDirectory(working_dir)));
-
-  // If we are given an icon, then set it
-  // For now, we always use the first icon if this happens to have multiple ones
-  if (icon) {
-    VERIFY1(SUCCEEDED(shell_link->SetIconLocation(icon, 0)));
-  }
-
-// C4201: nonstandard extension used : nameless struct/union
-#pragma warning(disable : 4201)
-  union {
-    WORD flags;
-    struct {                  // little-endian machine:
-      WORD virtual_key:8;     // low order byte
-      WORD modifiers:8;       // high order byte
-    };
-  } hot_key;
-#pragma warning(default : 4201)
-
-  hot_key.virtual_key = hotkey_virtual_key_code;
-  hot_key.modifiers = hotkey_modifiers;
-
-  if (hot_key.flags) {
-    shell_link->SetHotkey(hot_key.flags);
-  }
-
-  // Query IShellLink for the IPersistFile interface for saving the shortcut in
-  // persistent storage
-  CComQIPtr<IPersistFile> persist_file(shell_link);
-  if (!persist_file)
-    return E_FAIL;
-
-  // Save the link by calling IPersistFile::Save
-  RET_IF_FAILED(persist_file->Save(destination, TRUE));
-
-  return S_OK;
-}
-
-HRESULT Shell::RemoveLink(const TCHAR *link) {
-  ASSERT(link, (L""));
-  ASSERT(*link, (L""));
-
-  return File::Remove(link);
-}
-
-// Open a URL in a new browser window
-HRESULT Shell::OpenLinkInNewWindow(const TCHAR* url, UseBrowser use_browser) {
-  ASSERT1(url);
-
-  HRESULT hr = S_OK;
-  CString browser_path;
-
-  // Try to open with default browser
-  if (use_browser == USE_DEFAULT_BROWSER) {
-    // Load full browser path from regkey
-    hr = GetDefaultBrowserPath(&browser_path);
-
-    // If there is a default browser and it is not AOL, load the url in that
-    // browser
-    if (SUCCEEDED(hr) && !String_Contains(browser_path, _T("aol"))) {
-      if (!browser_path.IsEmpty()) {
-        // Have we figured out how to append the URL onto the browser path?
-        bool acceptable_url = false;
-
-        if (ReplaceCString(browser_path, _T("\"%1\""), url)) {
-          // the "browser.exe "%1"" case
-          acceptable_url = true;
-        } else if (ReplaceCString(browser_path, _T("%1"), url)) {
-          // the "browser.exe %1 "case
-          acceptable_url = true;
-        } else if (ReplaceCString(browser_path, _T("-nohome"), url)) {
-          // the "browser.exe -nohome" case
-          acceptable_url = true;
-        } else {
-          // the browser.exe case.
-          // simply append the quoted url.
-          EnclosePath(&browser_path);
-          browser_path.AppendChar(_T(' '));
-          CString quoted_url(url);
-          EnclosePath(&quoted_url);
-          browser_path.Append(quoted_url);
-          acceptable_url = true;
-        }
-
-        if (acceptable_url) {
-          hr = System::ShellExecuteCommandLine(browser_path, NULL, NULL);
-          if (SUCCEEDED(hr)) {
-            return S_OK;
-          } else {
-            UTIL_LOG(LE, (_T("[Shell::OpenLinkInNewWindow]")
-                          _T("[failed to start default browser to open url]")
-                          _T("[%s][0x%x]"), url, hr));
-          }
-        }
-      }
-    }
-  }
-
-  // Try to open with IE if can't open with default browser or required
-  if (use_browser == USE_DEFAULT_BROWSER ||
-      use_browser == USE_INTERNET_EXPLORER) {
-    hr = RegKey::GetValue(kRegKeyIeClass, kRegValueIeClass, &browser_path);
-    if (SUCCEEDED(hr)) {
-      hr = System::ShellExecuteProcess(browser_path, url, NULL, NULL);
-      if (SUCCEEDED(hr)) {
-        return S_OK;
-      } else {
-        UTIL_LOG(LE, (_T("[Shell::OpenLinkInNewWindow]")
-                      _T("[failed to start IE to open url][%s][0x%x]"),
-                      url, hr));
-      }
-    }
-  }
-
-  // Try to open with Firefox if can't open with default browser or required
-  if (use_browser == USE_DEFAULT_BROWSER || use_browser == USE_FIREFOX) {
-    hr = RegKey::GetValue(kRegKeyFirefox, kRegValueFirefox, &browser_path);
-    if (SUCCEEDED(hr) && !browser_path.IsEmpty()) {
-      ReplaceCString(browser_path, _T("%1"), url);
-      hr = System::ShellExecuteCommandLine(browser_path, NULL, NULL);
-      if (SUCCEEDED(hr)) {
-        return S_OK;
-      } else {
-        UTIL_LOG(LE, (_T("[Shell::OpenLinkInNewWindow]")
-                      _T("[failed to start Firefox to open url][%s][0x%x]"),
-                      url, hr));
-      }
-    }
-  }
-
-  // ShellExecute the url directly as a last resort
-  hr = Shell::Execute(url);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[Shell::OpenLinkInNewWindow]")
-                  _T("[failed to run ShellExecute to open url][%s][0x%x]"),
-                  url, hr));
-  }
-
-  return hr;
-}
-
-HRESULT Shell::Execute(const TCHAR* file) {
-  ASSERT1(file);
-
-  // Prepare everything required for ::ShellExecuteEx().
-  SHELLEXECUTEINFO sei;
-  SetZero(sei);
-  sei.cbSize = sizeof(sei);
-  sei.fMask = SEE_MASK_FLAG_NO_UI     |  // Do not display an error message box.
-              SEE_MASK_NOZONECHECKS   |  // Do not perform a zone check.
-              SEE_MASK_NOASYNC;          // Wait to complete before returning.
-  // Pass NULL for hwnd. This will have ShellExecuteExEnsureParent()
-  // create a dummy parent window for us.
-  // sei.hwnd = NULL;
-  sei.lpVerb = _T("open");
-  sei.lpFile = file;
-  // No parameters to pass
-  // sei.lpParameters = NULL;
-  // Use parent's starting directory
-  // sei.lpDirectory = NULL;
-  sei.nShow = SW_SHOWNORMAL;
-
-  // Use ShellExecuteExEnsureParent to ensure that we always have a parent HWND.
-  // We need to use the HWND Property to be acknowledged as a Foreground
-  // Application on Vista. Otherwise, the elevation prompt will appear minimized
-  // on the taskbar.
-  if (!ShellExecuteExEnsureParent(&sei)) {
-    HRESULT hr(HRESULTFromLastError());
-    ASSERT(false,
-        (_T("Shell::Execute - ShellExecuteEx failed][%s][0x%x]"), file, hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT Shell::BasicGetSpecialFolder(DWORD csidl, CString* folder_path) {
-  ASSERT1(folder_path);
-
-  // Get a ITEMIDLIST* (called a PIDL in the MSDN documentation) to the
-  // special folder
-  scoped_any<ITEMIDLIST*, close_co_task_free> folder_location;
-  RET_IF_FAILED(::SHGetFolderLocation(NULL,
-                                      csidl,
-                                      NULL,
-                                      0,
-                                      address(folder_location)));
-  ASSERT(get(folder_location), (_T("")));
-
-  // Get an interface to the Desktop folder
-  CComPtr<IShellFolder> desktop_folder;
-  RET_IF_FAILED(::SHGetDesktopFolder(&desktop_folder));
-  ASSERT1(desktop_folder);
-
-  // Ask the desktop for the display name of the special folder
-  STRRET str_return;
-  SetZero(str_return);
-  str_return.uType = STRRET_WSTR;
-  RET_IF_FAILED(desktop_folder->GetDisplayNameOf(get(folder_location),
-                                                 SHGDN_FORPARSING,
-                                                 &str_return));
-
-  // Get the display name of the special folder and return it
-  scoped_any<wchar_t*, close_co_task_free> folder_name;
-  RET_IF_FAILED(::StrRetToStr(&str_return,
-                              get(folder_location),
-                              address(folder_name)));
-  *folder_path = get(folder_name);
-
-  return S_OK;
-}
-
-HRESULT Shell::GetSpecialFolder(DWORD csidl,
-                                bool create_if_missing,
-                                CString* folder_path) {
-  ASSERT(folder_path, (L""));
-
-  HRESULT hr = Shell::BasicGetSpecialFolder(csidl, folder_path);
-
-  // If the folder does not exist, ::SHGetFolderLocation may return error
-  // code ERROR_FILE_NOT_FOUND.
-  if (create_if_missing) {
-    if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
-        (SUCCEEDED(hr) && !File::Exists(*folder_path))) {
-      hr = Shell::BasicGetSpecialFolder(csidl | CSIDL_FLAG_CREATE, folder_path);
-    }
-  }
-  ASSERT(FAILED(hr) || File::Exists(*folder_path), (_T("")));
-
-  return hr;
-}
-
-#pragma warning(disable : 4510 4610)
-// C4510: default constructor could not be generated
-// C4610: struct can never be instantiated - user defined constructor required
-struct {
-  const TCHAR* name;
-  const DWORD csidl;
-} const folder_mappings[] = {
-  L"APPDATA",            CSIDL_APPDATA,
-  L"DESKTOP",            CSIDL_DESKTOPDIRECTORY,
-  L"LOCALAPPDATA",       CSIDL_LOCAL_APPDATA,
-  L"MYMUSIC",            CSIDL_MYMUSIC,
-  L"MYPICTURES",         CSIDL_MYPICTURES,
-  L"PROGRAMFILES",       CSIDL_PROGRAM_FILES,
-  L"PROGRAMFILESCOMMON", CSIDL_PROGRAM_FILES_COMMON,
-  L"PROGRAMS",           CSIDL_PROGRAMS,
-  L"STARTMENU",          CSIDL_STARTMENU,
-  L"STARTUP",            CSIDL_STARTUP,
-  L"SYSTEM",             CSIDL_SYSTEM,
-  L"WINDOWS",            CSIDL_WINDOWS,
-};
-#pragma warning(default : 4510 4610)
-
-HRESULT Shell::GetSpecialFolderKeywordsMapping(
-    std::map<CString, CString>* special_folders_map) {
-  ASSERT1(special_folders_map);
-
-  special_folders_map->clear();
-
-  for (size_t i = 0; i < arraysize(folder_mappings); ++i) {
-    CString name(folder_mappings[i].name);
-    DWORD csidl(folder_mappings[i].csidl);
-    CString folder;
-    HRESULT hr = GetSpecialFolder(csidl, false, &folder);
-    if (FAILED(hr)) {
-      UTIL_LOG(LE, (_T("[Shell::GetSpecialFolderKeywordsMapping]")
-                    _T("[failed to retrieve %s]"), name));
-      continue;
-    }
-    special_folders_map->insert(std::make_pair(name, folder));
-  }
-
-  // Get the current module directory
-  CString module_dir = app_util::GetModuleDirectory(::GetModuleHandle(NULL));
-  ASSERT1(module_dir.GetLength() > 0);
-  special_folders_map->insert(std::make_pair(_T("CURRENTMODULEDIR"),
-                                             module_dir));
-
-  return S_OK;
-}
-
-HRESULT Shell::DeleteDirectory(const TCHAR* dir) {
-  ASSERT1(dir && *dir);
-
-  if (!SafeDirectoryNameForDeletion(dir)) {
-    return E_INVALIDARG;
-  }
-
-  uint32 dir_len = lstrlen(dir);
-  if (dir_len >= MAX_PATH) {
-    return E_INVALIDARG;
-  }
-
-  // the 'from' must be double-terminated with 0. Reserve space for one more
-  // zero at the end
-  TCHAR from[MAX_PATH + 1] = {0};
-  lstrcpyn(from, dir, MAX_PATH);
-  from[1 + dir_len] = 0;    // the second zero terminator.
-
-  SHFILEOPSTRUCT file_op = {0};
-
-  file_op.hwnd   = 0;
-  file_op.wFunc  = FO_DELETE;
-  file_op.pFrom  = from;
-  file_op.pTo    = 0;
-  file_op.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT;
-
-  // ::SHFileOperation returns non-zero on errors
-  return ::SHFileOperation(&file_op) ? HRESULTFromLastError() : S_OK;
-}
-
-HRESULT Shell::GetApplicationExecutablePath(const CString& exe,
-                                            CString* path) {
-  ASSERT1(path);
-
-  CString reg_key_name = AppendRegKeyPath(kRegKeyApplicationPath, exe);
-  return RegKey::GetValue(reg_key_name, kRegKeyPathValue, path);
-}
-
-}  // namespace omaha
-
diff --git a/base/shell.h b/base/shell.h
deleted file mode 100644
index eb5ef45..0000000
--- a/base/shell.h
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Shell functions
-//
-// create shortcut links
-// remove shortcut links
-
-#ifndef OMAHA_BASE_SHELL_H_
-#define OMAHA_BASE_SHELL_H_
-
-#include <windows.h>
-#include <shlobj.h>   // for the CSIDL definitions
-#include <atlstr.h>
-#include <map>
-
-#include "base/basictypes.h"
-
-namespace omaha {
-
-// TODO(omaha): Use BrowserType instead.
-enum UseBrowser {
-  USE_DEFAULT_BROWSER = 0,
-  USE_INTERNET_EXPLORER = 1,
-  USE_FIREFOX = 2
-};
-
-class Shell {
- public:
-
-  // create and store a shortcut link
-  // note that icon can be NULL if no icon is required
-  // note that we always pick the 0th icon for now, this can be changed later
-  // [relevant with EXE and compound icons]
-  static HRESULT CreateLink(const TCHAR *source,
-                            const TCHAR *destination,
-                            const TCHAR *working_dir,
-                            const TCHAR *arguments,
-                            const TCHAR *description,
-                            WORD hotkey_virtual_key_code,
-                            WORD hotkey_modifiers,
-                            const TCHAR *icon);
-  // For information on hotkey modifiers see MSDN IShellLink::GetHotKey method.
-
-  // Delete a shortcut link
-  static HRESULT RemoveLink(const TCHAR *link);
-
-  // Open a URL in a new browser window
-  static HRESULT OpenLinkInNewWindow(const TCHAR* url, UseBrowser use_browser);
-
-  // Execute a file
-  static HRESULT Shell::Execute(const TCHAR* file);
-
-  // Get the location of a special folder.  The special folders are identified
-  // by a unique integer - see the platform SDK files shfolder.h and
-  // shlobj.h.  (These names will be the localized versions for the
-  // system that is running.)
-  static HRESULT GetSpecialFolder(DWORD csidl,
-                                  bool create_if_missing,
-                                  CString* folder_path);
-
-  // Get a mapping from special folder "env var" names to special folder
-  // pathnames.
-  // Provides mappings for: APPDATA, DESKTOP, LOCALAPPDATA, MYMUSIC, MYPICTURES,
-  // PROGRAMFILES, PROGRAMFILESCOMMON, PROGRAMS, STARTMENU, STARTUP, SYSTEM,
-  // WINDOWS.
-  static HRESULT GetSpecialFolderKeywordsMapping(
-      std::map<CString, CString>* special_folders_map);
-
-  // Recursively delete a directory including its files.
-  static HRESULT DeleteDirectory(const TCHAR* dir);
-
-  // Reads the application executable path from
-  // HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths.
-  static HRESULT GetApplicationExecutablePath(const CString& exe,
-                                              CString* path);
-
- private:
-
-  static HRESULT BasicGetSpecialFolder(DWORD csidl, CString* folder_path);
-
-  DISALLOW_EVIL_CONSTRUCTORS(Shell);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_SHELL_H_
diff --git a/base/shell_unittest.cc b/base/shell_unittest.cc
deleted file mode 100644
index 45bf92d..0000000
--- a/base/shell_unittest.cc
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Shell functions
-
-#include <shlobj.h>
-#include <map>
-#include "base/basictypes.h"
-#include "omaha/base/dynamic_link_kernel32.h"
-#include "omaha/base/file.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/shell.h"
-#include "omaha/base/system_info.h"
-#include "omaha/base/utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(ShellTest, ShellLink) {
-  if (IsTestRunByLocalSystem()) {
-    return;
-  }
-
-  CString desktop;
-  EXPECT_SUCCEEDED(GetFolderPath(CSIDL_DESKTOP, &desktop));
-  CString link(desktop + _T("\\Shell Unittest.lnk"));
-  CString install_dir;
-  ASSERT_SUCCEEDED(Shell::GetSpecialFolder(CSIDL_PROGRAM_FILES,
-                                           true,
-                                           &install_dir));
-  install_dir += _T("\\Shell Unittest");
-  CString exe = install_dir + _T("\\foo.bar.exe");
-  ASSERT_FALSE(File::Exists(link));
-  ASSERT_SUCCEEDED(Shell::CreateLink(exe,
-                                     link,
-                                     install_dir,
-                                     _T(""),
-                                     _T("Google Update Unit Test"),
-                                     'W',
-                                     HOTKEYF_ALT | HOTKEYF_CONTROL,
-                                     NULL));
-  ASSERT_TRUE(File::Exists(link));
-  ASSERT_SUCCEEDED(Shell::RemoveLink(link));
-  ASSERT_FALSE(File::Exists(link));
-}
-
-struct Folders {
-    DWORD csidl;
-    CString name;
-};
-
-TEST(ShellTest, GetSpecialFolder) {
-  Folders folders[] = {
-    { CSIDL_COMMON_APPDATA,
-      CString("C:\\Documents and Settings\\All Users\\Application Data") },
-    { CSIDL_FONTS,
-      CString("C:\\WINDOWS\\Fonts") },
-    { CSIDL_PROGRAM_FILES,
-      CString("C:\\Program Files") },
-  };
-
-  if (SystemInfo::IsRunningOnVistaOrLater()) {
-    folders[0].name = _T("C:\\ProgramData");
-  }
-
-  // Override the program files location, which changes for 32-bit processes
-  // running on 64-bit systems.
-  BOOL isWow64 = FALSE;
-  EXPECT_SUCCEEDED(Kernel32::IsWow64Process(GetCurrentProcess(), &isWow64));
-  if (isWow64) {
-    folders[2].name += _T(" (x86)");
-  }
-
-  for (size_t i = 0; i != arraysize(folders); ++i) {
-    CString folder_name;
-    EXPECT_SUCCEEDED(Shell::GetSpecialFolder(folders[i].csidl,
-                                             false,
-                                             &folder_name));
-    // This should work, but CmpHelperSTRCASEEQ is not overloaded for wchars.
-    // EXPECT_STRCASEEQ(folder_name, folders[i].name);
-    EXPECT_EQ(folder_name.CompareNoCase(folders[i].name), 0);
-  }
-}
-
-TEST(ShellTest, GetSpecialFolderKeywordsMapping) {
-  typedef std::map<CString, CString> mapping;
-  mapping folder_map;
-  ASSERT_SUCCEEDED(Shell::GetSpecialFolderKeywordsMapping(&folder_map));
-}
-
-}  // namespace omaha
-
diff --git a/base/shutdown_callback.h b/base/shutdown_callback.h
deleted file mode 100644
index e21598a..0000000
--- a/base/shutdown_callback.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-//
-// ShutdownCallBack monitors a shutdown event.
-
-#ifndef OMAHA_COMMON_SHUTDOWN_CALLBACK_H__
-#define OMAHA_COMMON_SHUTDOWN_CALLBACK_H__
-
-#include <windows.h>
-
-namespace omaha {
-
-class ShutdownCallback {
- public:
-  virtual ~ShutdownCallback() {}
-  virtual HRESULT Shutdown() = 0;
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_SHUTDOWN_CALLBACK_H__
-
diff --git a/base/shutdown_handler.cc b/base/shutdown_handler.cc
deleted file mode 100644
index 8c72af1..0000000
--- a/base/shutdown_handler.cc
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/shutdown_handler.h"
-
-#include <atlsecurity.h>
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/reactor.h"
-#include "omaha/base/shutdown_callback.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-ShutdownHandler::ShutdownHandler()
-  : shutdown_callback_(NULL) {
-}
-
-ShutdownHandler::~ShutdownHandler() {
-  if (get(shutdown_event_)) {
-    VERIFY1(SUCCEEDED(reactor_->UnregisterHandle(get(shutdown_event_))));
-  }
-}
-
-HRESULT ShutdownHandler::Initialize(Reactor* reactor,
-                                    ShutdownCallback* shutdown,
-                                    bool is_machine) {
-  ASSERT1(reactor);
-  ASSERT1(shutdown);
-  shutdown_callback_ = shutdown;
-  reactor_ = reactor;
-  is_machine_ = is_machine;
-
-  NamedObjectAttributes attr;
-  GetNamedObjectAttributes(kShutdownEvent, is_machine_, &attr);
-  // Manual reset=true and signaled=false
-  reset(shutdown_event_, ::CreateEvent(&attr.sa, true, false, attr.name));
-  if (!shutdown_event_) {
-    return HRESULTFromLastError();
-  }
-
-  HRESULT hr = reactor_->RegisterHandle(get(shutdown_event_), this, 0);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return S_OK;
-}
-
-void ShutdownHandler::HandleEvent(HANDLE handle) {
-  if (handle == get(shutdown_event_)) {
-    CORE_LOG(L1, (_T("[shutdown event is signaled]")));
-  } else {
-    ASSERT1(false);
-  }
-  ASSERT1(shutdown_callback_);
-  shutdown_callback_->Shutdown();
-}
-
-}  // namespace omaha
-
diff --git a/base/shutdown_handler.h b/base/shutdown_handler.h
deleted file mode 100644
index fb8f661..0000000
--- a/base/shutdown_handler.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// ShutdownHandler monitors a shutdown event.
-
-#ifndef OMAHA_BASE_SHUTDOWN_HANDLER_H_
-#define OMAHA_BASE_SHUTDOWN_HANDLER_H_
-
-#include <windows.h>
-#include "base/basictypes.h"
-#include "omaha/base/event_handler.h"
-#include "omaha/base/scoped_any.h"
-
-namespace omaha {
-
-class Reactor;
-class ShutdownCallback;
-
-class ShutdownHandler : public EventHandler {
- public:
-  ShutdownHandler();
-  ~ShutdownHandler();
-
-  HRESULT Initialize(Reactor* reactor,
-                     ShutdownCallback* shutdown,
-                     bool is_machine);
-  virtual void HandleEvent(HANDLE handle);
-
- private:
-  Reactor* reactor_;
-  scoped_event shutdown_event_;
-  ShutdownCallback* shutdown_callback_;
-  bool is_machine_;
-  DISALLOW_EVIL_CONSTRUCTORS(ShutdownHandler);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_SHUTDOWN_HANDLER_H_
diff --git a/base/signatures.cc b/base/signatures.cc
deleted file mode 100644
index 6d40f86..0000000
--- a/base/signatures.cc
+++ /dev/null
@@ -1,1113 +0,0 @@
-// Copyright 2003-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// signatures.cpp
-//
-// Classes and functions related to crypto-hashes of buffers and digital
-// signatures of buffers.
-
-#include "omaha/base/signatures.h"
-#include <wincrypt.h>
-#include <memory.h>
-#pragma warning(disable : 4245)
-// C4245 : conversion from 'type1' to 'type2', signed/unsigned mismatch
-#include <atlenc.h>
-#pragma warning(default : 4245)
-#include <vector>
-#include "base/scoped_ptr.h"
-#include "omaha/base/const_utils.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-const ALG_ID kHashAlgorithm = CALG_SHA1;
-const DWORD kEncodingType = X509_ASN_ENCODING | PKCS_7_ASN_ENCODING;
-const DWORD kProviderType = PROV_RSA_FULL;
-const DWORD kCertificateNameType = CERT_NAME_SIMPLE_DISPLAY_TYPE;
-const DWORD kKeyPairType = AT_SIGNATURE;
-
-// Maximum file size allowed for performing authentication.
-const int kMaxFileSizeForAuthentication = 512 * 1024 * 1024;  // 512MB
-
-// Buffer size used to read files from disk.
-const int kFileReadBufferSize = 128 * 1024;
-
-namespace CryptDetails {
-
-  // Useful scoped pointers for working with CryptoAPI objects
-
-  void crypt_release_context(HCRYPTPROV provider) {
-    UTIL_LOG(L3, (L"Releasing HCRYPTPROV 0x%08lx", provider));
-    BOOL b = ::CryptReleaseContext(provider, 0 /*flags*/);
-    ASSERT(b, (L""));
-  }
-
-  void crypt_close_store(HCERTSTORE store) {
-    UTIL_LOG(L3, (L"Releasing HCERTSTORE 0x%08lx", store));
-    BOOL b = ::CertCloseStore(store, 0 /*flags*/);
-    ASSERT(b, (L""));
-    ASSERT(::GetLastError() != CRYPT_E_PENDING_CLOSE, (L""));
-  }
-
-  void crypt_free_certificate(PCCERT_CONTEXT certificate) {
-    UTIL_LOG(L3, (L"Releasing PCCERT_CONTEXT 0x%08lx", certificate));
-    BOOL b = ::CertFreeCertificateContext(certificate);
-    ASSERT(b, (L""));
-  }
-
-  void crypt_destroy_key(HCRYPTKEY key) {
-    UTIL_LOG(L3, (L"Releasing HCRYPTKEY 0x%08lx", key));
-    BOOL b = ::CryptDestroyKey(key);
-    ASSERT(b, (L""));
-  }
-
-  void crypt_destroy_hash(HCRYPTHASH hash) {
-    UTIL_LOG(L3, (L"Releasing HCRYPTHASH 0x%08lx", hash));
-    BOOL b = ::CryptDestroyHash(hash);
-    ASSERT(b, (L""));
-  }
-
-  typedef close_fun<void (*)(HCRYPTHASH),
-                    crypt_destroy_hash> smart_destroy_hash;
-  typedef scoped_any<HCRYPTHASH, smart_destroy_hash, null_t> scoped_crypt_hash;
-}
-
-// Base64 encode/decode functions are part of ATL Server
-HRESULT Base64::Encode(const std::vector<byte>& buffer_in,
-                       std::vector<byte>* encoded,
-                       bool break_into_lines) {
-  ASSERT(encoded, (L""));
-
-  if (buffer_in.empty()) {
-    encoded->resize(0);
-    return S_OK;
-  }
-
-  int32 encoded_len =
-    Base64EncodeGetRequiredLength(
-        buffer_in.size(),
-        break_into_lines ? ATL_BASE64_FLAG_NONE : ATL_BASE64_FLAG_NOCRLF);
-  ASSERT(encoded_len > 0, (L""));
-
-  encoded->resize(encoded_len);
-  int32 str_out_len = encoded_len;
-
-  BOOL result = Base64Encode(
-      &buffer_in.front(),
-      buffer_in.size(),
-      reinterpret_cast<char*>(&encoded->front()),
-      &str_out_len,
-      break_into_lines ? ATL_BASE64_FLAG_NONE : ATL_BASE64_FLAG_NOCRLF);
-  if (!result)
-    return E_FAIL;
-  ASSERT(str_out_len <= encoded_len, (L""));
-  if (str_out_len < encoded_len)
-    encoded->resize(str_out_len);
-
-  return S_OK;
-}
-
-HRESULT Base64::Encode(const std::vector<byte>& buffer_in,
-                       CStringA* encoded,
-                       bool break_into_lines) {
-  ASSERT(encoded, (L""));
-
-  if (buffer_in.empty()) {
-    return S_OK;
-  }
-
-  std::vector<byte> buffer_out;
-  RET_IF_FAILED(Encode(buffer_in, &buffer_out, break_into_lines));
-  encoded->Append(reinterpret_cast<const char*>(&buffer_out.front()),
-                                                buffer_out.size());
-
-  return S_OK;
-}
-
-HRESULT Base64::Encode(const std::vector<byte>& buffer_in,
-                       CString* encoded,
-                       bool break_into_lines) {
-  ASSERT(encoded, (L""));
-
-  CStringA string_out;
-  RET_IF_FAILED(Encode(buffer_in, &string_out, break_into_lines));
-  *encoded = string_out;
-
-  return S_OK;
-}
-
-HRESULT Base64::Decode(const std::vector<byte>& encoded,
-                       std::vector<byte>* buffer_out) {
-  ASSERT(buffer_out, (L""));
-
-  size_t encoded_len = encoded.size();
-  int32 required_len = Base64DecodeGetRequiredLength(encoded_len);
-
-  buffer_out->resize(required_len);
-
-  if (required_len == 0) {
-    return S_OK;
-  }
-
-  int32 bytes_written = required_len;
-  BOOL result = Base64Decode(reinterpret_cast<const char*>(&encoded.front()),
-                             encoded_len,
-                             &buffer_out->front(),
-                             &bytes_written);
-  if (!result)
-    return E_FAIL;
-  ASSERT(bytes_written <= required_len, (L""));
-  if (bytes_written < required_len) {
-    buffer_out->resize(bytes_written);
-  }
-
-  return S_OK;
-}
-
-HRESULT Base64::Decode(const CStringA& encoded, std::vector<byte>* buffer_out) {
-  ASSERT(buffer_out, (L""));
-
-  size_t encoded_len = encoded.GetLength();
-  std::vector<byte> buffer_in(encoded_len);
-  if (encoded_len != 0) {
-    ::memcpy(&buffer_in.front(), encoded.GetString(), encoded_len);
-  }
-
-  return Decode(buffer_in, buffer_out);
-}
-
-// Base64 in a CString -> binary
-HRESULT Base64::Decode(const CString& encoded, std::vector<byte>* buffer_out) {
-  ASSERT(buffer_out, (L""));
-
-  CW2A encoded_a(encoded.GetString());
-
-  size_t encoded_len = ::strlen(encoded_a);
-  std::vector<byte> buffer_in(encoded_len);
-  if (encoded_len != 0) {
-    ::memcpy(&buffer_in.front(), encoded_a, encoded_len);
-  }
-
-  return Decode(buffer_in, buffer_out);
-}
-
-CryptoHash::CryptoHash() {
-}
-
-CryptoHash::~CryptoHash() {
-}
-
-HRESULT CryptoHash::Compute(const TCHAR* filepath,
-                            uint64 max_len,
-                            std::vector<byte>* hash_out) {
-  ASSERT1(filepath);
-  ASSERT1(hash_out);
-
-  std::vector<CString> filepaths;
-  filepaths.push_back(filepath);
-  return Compute(filepaths, max_len, hash_out);
-}
-
-HRESULT CryptoHash::Compute(const std::vector<CString>& filepaths,
-                            uint64 max_len,
-                            std::vector<byte>* hash_out) {
-  ASSERT1(filepaths.size() > 0);
-  ASSERT1(hash_out);
-
-  return ComputeOrValidate(filepaths, max_len, NULL, hash_out);
-}
-
-HRESULT CryptoHash::Compute(const std::vector<byte>& buffer_in,
-                            std::vector<byte>* hash_out) {
-  ASSERT1(buffer_in.size() > 0);
-  ASSERT1(hash_out);
-
-  return ComputeOrValidate(buffer_in, NULL, hash_out);
-}
-
-HRESULT CryptoHash::Validate(const TCHAR* filepath,
-                             uint64 max_len,
-                             const std::vector<byte>& hash_in) {
-  ASSERT1(filepath);
-  ASSERT1(hash_in.size() == kHashSize);
-
-  std::vector<CString> filepaths;
-  filepaths.push_back(filepath);
-  return Validate(filepaths, max_len, hash_in);
-}
-
-HRESULT CryptoHash::Validate(const std::vector<CString>& filepaths,
-                             uint64 max_len,
-                             const std::vector<byte>& hash_in) {
-  ASSERT1(hash_in.size() == kHashSize);
-
-  return ComputeOrValidate(filepaths, max_len, &hash_in, NULL);
-}
-
-
-HRESULT CryptoHash::Validate(const std::vector<byte>& buffer_in,
-                             const std::vector<byte>& hash_in) {
-  ASSERT1(buffer_in.size() > 0);
-  ASSERT1(hash_in.size() == kHashSize);
-
-  return ComputeOrValidate(buffer_in, &hash_in, NULL);
-}
-
-HRESULT CryptoHash::ComputeOrValidate(const std::vector<CString>& filepaths,
-                                      uint64 max_len,
-                                      const std::vector<byte>* hash_in,
-                                      std::vector<byte>* hash_out) {
-  ASSERT1(filepaths.size() > 0);
-  ASSERT1(hash_in && !hash_out || !hash_in && hash_out);
-  UTIL_LOG(L1, (_T("[CryptoHash::ComputeOrValidate]")));
-
-  std::vector<byte> buf(kFileReadBufferSize);
-  uint64 curr_len = 0;
-
-  CryptDetails::scoped_crypt_context scoped_csp_handle;
-  if (0 == ::CryptAcquireContext(address(scoped_csp_handle),
-                                 NULL,
-                                 NULL,  // Use OS-default CSP.
-                                 kProviderType,
-                                 CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LE, (_T("[CryptAcquireContext failed][0x%08lX]"), hr));
-    return hr;
-  }
-
-  CryptDetails::scoped_crypt_hash scoped_hash_handle;
-  if (0 == ::CryptCreateHash(get(scoped_csp_handle),
-                             kHashAlgorithm,
-                             NULL,
-                             0,
-                             address(scoped_hash_handle))) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LE, (_T("[CryptCreateHash failed][0x%08lX]"), hr));
-    return hr;
-  }
-
-  for (size_t i = 0; i < filepaths.size(); ++i) {
-    scoped_hfile file_handle(::CreateFile(filepaths[i],
-                                          FILE_READ_DATA,
-                                          FILE_SHARE_READ,
-                                          NULL,
-                                          OPEN_EXISTING,
-                                          FILE_ATTRIBUTE_NORMAL,
-                                          NULL));
-    if (!file_handle) {
-      return HRESULTFromLastError();
-    }
-
-    if (max_len) {
-      LARGE_INTEGER file_size = {0};
-      if (!::GetFileSizeEx(get(file_handle), &file_size)) {
-        return HRESULTFromLastError();
-      }
-      curr_len += file_size.QuadPart;
-      if (curr_len > max_len) {
-        UTIL_LOG(LE, (_T("[exceed max len][curr_len=%lu][max_len=%lu]"),
-                      curr_len, max_len));
-        return E_FAIL;
-      }
-    }
-
-    DWORD bytes_read = 0;
-    do {
-      if (!::ReadFile(get(file_handle),
-                      &buf[0],
-                      buf.size(),
-                      &bytes_read,
-                      NULL)) {
-        return HRESULTFromLastError();
-      }
-
-      if (bytes_read > 0) {
-        if (0 == ::CryptHashData(get(scoped_hash_handle),
-                                 &buf[0],
-                                 bytes_read,
-                                 0)) {
-          HRESULT hr = HRESULTFromLastError();
-          UTIL_LOG(LE, (_T("[CryptHashData failed][0x%08lX]"), hr));
-          return hr;
-        }
-      }
-    } while (bytes_read == buf.size());
-  }
-
-  DWORD digest_size = kHashSize;
-  byte digest_data[kHashSize] = {};
-  if (0 == ::CryptGetHashParam(get(scoped_hash_handle),
-                               HP_HASHVAL,
-                               digest_data,
-                               &digest_size,
-                               0)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LE, (_T("[CryptGetHashParam failed][0x%08lX]"), hr));
-    return hr;
-  }
-  if (digest_size != kHashSize) {
-    UTIL_LOG(LE, (_T("[CryptGetHashParam returned %d bytes]"), digest_size));
-    return E_UNEXPECTED;
-  }
-
-  if (hash_in) {
-    int res = ::memcmp(&hash_in->front(), digest_data, kHashSize);
-    if (res == 0) {
-      return S_OK;
-    }
-
-    std::vector<byte> calculated_hash(kHashSize);
-    ::memcpy(&calculated_hash.front(), digest_data, kHashSize);
-    CStringA base64_encoded_hash;
-    Base64::Encode(calculated_hash, &base64_encoded_hash, false);
-    CString hash = AnsiToWideString(base64_encoded_hash,
-                                    base64_encoded_hash.GetLength());
-    REPORT_LOG(L1, (_T("[actual hash=%s]"), hash));
-    return SIGS_E_INVALID_SIGNATURE;
-  } else {
-    hash_out->resize(kHashSize);
-    ::memcpy(&hash_out->front(), digest_data, kHashSize);
-    return S_OK;
-  }
-}
-
-HRESULT CryptoHash::ComputeOrValidate(const std::vector<byte>& buffer_in,
-                                      const std::vector<byte>* hash_in,
-                                      std::vector<byte>* hash_out) {
-  ASSERT1(hash_in && !hash_out || !hash_in && hash_out);
-  UTIL_LOG(L1, (_T("[CryptoHash::ComputeOrValidate]")));
-
-  CryptDetails::scoped_crypt_context scoped_csp_handle;
-  if (0 == ::CryptAcquireContext(address(scoped_csp_handle),
-                                 NULL,
-                                 NULL,  // Use OS-default CSP.
-                                 kProviderType,
-                                 CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LE, (_T("[CryptAcquireContext failed][0x%08lX]"), hr));
-    return hr;
-  }
-
-  CryptDetails::scoped_crypt_hash scoped_hash_handle;
-  if (0 == ::CryptCreateHash(get(scoped_csp_handle),
-                             kHashAlgorithm,
-                             NULL,
-                             0,
-                             address(scoped_hash_handle))) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LE, (_T("[CryptCreateHash failed][0x%08lX]"), hr));
-    return hr;
-  }
-
-  if (!buffer_in.empty()) {
-    if (0 == ::CryptHashData(get(scoped_hash_handle),
-                             &buffer_in.front(),
-                             buffer_in.size(),
-                             0)) {
-      HRESULT hr = HRESULTFromLastError();
-      UTIL_LOG(LE, (_T("[CryptHashData failed][0x%08lX]"), hr));
-      return hr;
-    }
-  }
-
-  DWORD digest_size = kHashSize;
-  byte digest_data[kHashSize] = {};
-  if (0 == ::CryptGetHashParam(get(scoped_hash_handle),
-                               HP_HASHVAL,
-                               digest_data,
-                               &digest_size,
-                               0)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LE, (_T("[CryptGetHashParam failed][0x%08lX]"), hr));
-    return hr;
-  }
-  if (digest_size != kHashSize) {
-    UTIL_LOG(LE, (_T("[CryptGetHashParam returned %d bytes]"), digest_size));
-    return E_UNEXPECTED;
-  }
-
-  if (hash_in) {
-    int res = ::memcmp(&hash_in->front(), digest_data, kHashSize);
-    return (res == 0) ? S_OK : SIGS_E_INVALID_SIGNATURE;
-  } else {
-    hash_out->resize(kHashSize);
-    ::memcpy(&hash_out->front(), digest_data, kHashSize);
-    return S_OK;
-  }
-}
-
-// To sign data you need a CSP with the proper private key installed.
-// To get a signing certificate you start with a PFX file.  This file
-// encodes a "certificate store" which can hold more than one
-// certificate.  (In general it can hold a certificate chain, but we
-// only use the signing certificate.)  There are special APIs to verify
-// the format of a PFX file and read it into a new certificate store.  A
-// password must be specified to read the PFX file as it is encrypted.
-// The password was set when the PFX file was exported or otherwise
-// created.  Then you search for the proper certificate in the store
-// (using the subject_name which tells who the certificate was issued
-// to).  Finally, to get a CSP with the certificate's private key
-// available there is a special API, CryptAcquireCertificatePrivateKey,
-// that takes a CSP and a certificate and makes the private key of the
-// certificate the private key of the CSP.
-
-CryptoSigningCertificate::CryptoSigningCertificate() : key_spec_(0) {
-}
-
-CryptoSigningCertificate::~CryptoSigningCertificate() {
-}
-
-HRESULT CryptoSigningCertificate::ImportCertificate(
-    const TCHAR * filepath,
-    const TCHAR * password,
-    const TCHAR * subject_name) {
-  ASSERT(filepath, (L""));
-  ASSERT(password, (L""));
-
-  std::vector<byte> buffer;
-  HRESULT hr = ReadEntireFile(filepath, kMaxCertificateSize, &buffer);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (L"[CryptoSigningCertificate::ImportCertificate]"
-                  L"['%s' not read, hr 0x%08lx]", filepath, hr));
-    return hr;
-  }
-  return ImportCertificate(buffer, password, subject_name);
-}
-
-HRESULT CryptoSigningCertificate::ImportCertificate(
-    const std::vector<byte>& certificate_in,
-    const TCHAR * password,
-    const TCHAR * subject_name) {
-  ASSERT(password, (L""));
-  ASSERT1(!certificate_in.empty());
-
-  UTIL_LOG(L2, (L"[CryptoSigningCertificate::ImportCertificate]"
-                L"[%d bytes, subject_name '%s']",
-                certificate_in.size(), subject_name ? subject_name : L""));
-
-  // CryptoAPI treats the certificate as a "blob"
-  CRYPT_DATA_BLOB blob;
-  blob.cbData = certificate_in.size();
-  blob.pbData = const_cast<BYTE*>(&certificate_in.front());
-
-  // Ensure that it is PFX formatted
-  BOOL b = ::PFXIsPFXBlob(&blob);
-  if (!b) {
-    ASSERT(0, (L"Invalid PFX certificate, err 0x%08lx", ::GetLastError()));
-    return SIGS_E_INVALID_PFX_CERTIFICATE;
-  }
-
-  // Make sure the password checks out
-  b = ::PFXVerifyPassword(&blob, password, 0 /* flags */);
-  if (!b) {
-    UTIL_LOG(LE, (L"[CryptoSigningCertificate::ImportCertificate]"
-                  L"[invalid password, err 0x%08lx]", ::GetLastError()));
-    return SIGS_E_INVALID_PASSWORD;
-  }
-
-  // Do the import from the certificate to a new certificate store
-  // TODO(omaha): Check that this is in fact a new certificate store, not an
-  // existing one.  If it is an existing one we'll need to delete the
-  // certificate later.
-  // The last parameter to ::PFXImportCertStore() is 0, indicating that we want
-  // the CSP to be "silent"; i.e., not prompt.
-  reset(store_, ::PFXImportCertStore(&blob, password, 0));
-  if (!store_) {
-    DWORD err = ::GetLastError();
-    ASSERT(0, (L"Failed to import PFX certificate into a certificate store, "
-               L"err 0x%08lx", err));
-    return HRESULT_FROM_WIN32(err);
-  }
-  UTIL_LOG(L3, (L"[CryptoSigningCertificate::ImportCertificate]"
-                L"[new store 0x%08lx]", get(store_)));
-
-  // Now that we have a store, look for the correct certificate.  (There may
-  // have been more than one in the PFX file, e.g., a certificate chain.)
-  PCCERT_CONTEXT certificate_context = NULL;
-  while ((certificate_context =
-          ::CertEnumCertificatesInStore(get(store_),
-                                        certificate_context)) != NULL) {
-    // Have a certificate, does it look like the right one?  Check the name
-    DWORD name_len = ::CertGetNameString(certificate_context,
-                                         kCertificateNameType,
-                                         0 /*flags*/,
-                                         NULL,
-                                         NULL,
-                                         0);
-    if (name_len <= 1) {
-      // Name attribute not found - should never happen
-      ASSERT(0, (L"CryptoSigningCertificate::ImportCertificate failed to get "
-                 L"certificate name length, err 0x%08lx", ::GetLastError()));
-      continue;
-    }
-    // name_len includes the terminating null
-
-    std::vector<TCHAR> name;
-    name.resize(name_len);
-    ASSERT1(!name.empty());
-    DWORD name_len2 = ::CertGetNameString(certificate_context,
-                                          kCertificateNameType,
-                                          0,
-                                          NULL,
-                                          &name.front(),
-                                          name_len);
-    ASSERT(name_len2 == name_len, (L""));
-
-    UTIL_LOG(L3, (L"[CryptoSigningCertificate::ImportCertificate]"
-                  L"[found '%s' in store]", &name.front()));
-
-    // Check the name if the user so desires.  (If subject_name == NULL then
-    // the first certificate found is used.)
-    if (subject_name && (0 != String_StrNCmp(&name.front(),
-                                             subject_name,
-                                             ::lstrlen(subject_name),
-                                             false))) {
-      // name mismatch
-      UTIL_LOG(L3, (L"[CryptoSigningCertificate::ImportCertificate]"
-                    L"[not the right certificate, we're looking for '%s']",
-                    subject_name));
-      continue;
-    }
-
-    // This is the right certificate
-    subject_name_ = &name.front();
-    reset(certificate_, certificate_context);
-    UTIL_LOG(L3, (L"[CryptoSigningCertificate::ImportCertificate]"
-                  L"[new certificate 0x%08lx]", get(certificate_)));
-    break;
-  }
-
-  return S_OK;
-}
-
-HRESULT CryptoSigningCertificate::GetCSPContext(HCRYPTPROV* csp_context) {
-  ASSERT(csp_context, (L""));
-  ASSERT(get(certificate_), (L""));
-
-  // CSP may have already been used - reset it
-  reset(csp_);
-
-  // Create a CSP context using the private key of the certificate we imported
-  // earlier.
-  HCRYPTPROV csp = NULL;
-  BOOL must_free_csp = FALSE;
-  BOOL b = ::CryptAcquireCertificatePrivateKey(get(certificate_),
-                                               0 /*flags*/,
-                                               0 /*reserved*/,
-                                               &csp,
-                                               &key_spec_,
-                                               &must_free_csp);
-  if (!b) {
-    DWORD err = ::GetLastError();
-    ASSERT(0, (L"CryptoSigningCertificate::GetCSPContext "
-               L"CryptAcquireCertificatePrivateKey failed, err 0x%08lx", err));
-    return HRESULT_FROM_WIN32(err);
-  }
-
-  // (Funky API returns a boolean which tells you whether it is your
-  // responsibility to delete the CSP context or not.)
-  if (must_free_csp) {
-    reset(csp_, csp);
-  }
-  if (get(csp_)) {
-    UTIL_LOG(L3, (L"[CryptoSigningCertificate::GetCSPContext new CSP 0x%08lx]",
-                  get(csp_)));
-  }
-
-  ASSERT(key_spec_ == AT_SIGNATURE || key_spec_ == AT_KEYEXCHANGE, (L""));
-  if (key_spec_ != kKeyPairType) {
-    UTIL_LOG(LE, (L"[CryptoSigningCertificate::GetCSPContext]"
-                  L"[requires a AT_SIGNATURE type key]"));
-    return SIGS_E_INVALID_KEY_TYPE;
-  }
-
-#ifdef _DEBUG
-  // Which CSP did we get?
-  char csp_name[256] = {0};
-  DWORD csp_name_len = arraysize(csp_name);
-  b = ::CryptGetProvParam(csp,
-                          PP_NAME,
-                          reinterpret_cast<BYTE*>(&csp_name[0]),
-                          &csp_name_len,
-                          0 /*flags*/);
-  if (!b) {
-    DWORD err = ::GetLastError();
-    UTIL_LOG(LE, (L"[CryptoSigningCertificate::GetCSPContext]"
-                  L"[error getting CSP name, err 0x%08lx]", err));
-  }
-  DWORD csp_prov_type;
-  DWORD csp_prov_type_len = sizeof(csp_prov_type);
-  b = ::CryptGetProvParam(csp,
-                          PP_PROVTYPE,
-                          reinterpret_cast<BYTE*>(&csp_prov_type),
-                          &csp_prov_type_len,
-                          0 /*flags*/);
-  if (!b) {
-    DWORD err = ::GetLastError();
-    UTIL_LOG(LE, (L"[CryptoSigningCertificate::GetCSPContext]"
-                  L"[error getting CSP provtype, err 0x%08lx]", err));
-  }
-  char csp_container[256] = {0};
-  DWORD csp_container_len = arraysize(csp_container);
-  b = ::CryptGetProvParam(csp,
-                          PP_CONTAINER,
-                          reinterpret_cast<BYTE*>(&csp_container[0]),
-                          &csp_container_len,
-                          0 /*flags*/);
-  if (!b) {
-    DWORD err = ::GetLastError();
-    UTIL_LOG(LE, (L"[CryptoSigningCertificate::GetCSPContext]"
-                  L"[error getting CSP current container name, err 0x%08lx]",
-                  err));
-  }
-  UTIL_LOG(L2, (L"[CryptoSigningCertificate::GetCSPContext]"
-                L"[have CSP '%S' (provtype %d) key container '%S']",
-                csp_name, csp_prov_type, csp_container));
-  // End of which CSP did we get
-#endif
-
-  *csp_context = csp;
-
-  UTIL_LOG(L2, (L"[CryptoSigningCertificate::GetCSPContext]"
-                L"[getting CSP with private key from certificate]"
-                L"[HCRYPTPROV 0x%08lx]", csp));
-
-  return S_OK;
-}
-
-// To sign some data using CryptoAPI you first hash it into a hash
-// object, then sign it using the CSP.  The CSP needs to have the
-// private key, of type AT_SIGNATURE, in it already, as it isn't a
-// parameter of the CryptSignHash API.  The CryptoSigningCertificate
-// can provide such a CSP.
-
-CryptoComputeSignature::CryptoComputeSignature(
-    CryptoSigningCertificate* certificate)
-    : certificate_(certificate) {
-}
-
-CryptoComputeSignature::~CryptoComputeSignature() {
-}
-
-HRESULT CryptoComputeSignature::Sign(TCHAR const * const filepath,
-                                     uint32 max_len,
-                                     std::vector<byte>* signature_out) {
-  ASSERT(filepath, (L""));
-  std::vector<byte> buffer;
-  HRESULT hr = ReadEntireFile(filepath, max_len, &buffer);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (L"[CryptoComputeSignature::Sign]"
-                  L"['%s not read, hr 0x%08lx]", filepath, hr));
-    return hr;
-  }
-  return Sign(buffer, signature_out);
-}
-
-HRESULT CryptoComputeSignature::Sign(const std::vector<byte>& buffer_in,
-                                     std::vector<byte>* signature_out) {
-  ASSERT(signature_out, (L""));
-  ASSERT1(!buffer_in.empty());
-
-  UTIL_LOG(L2, (L"[CryptoComputeSignature::Sign]"
-                L"[buffer of %d bytes]", buffer_in.size()));
-
-  // Get the proper CSP with the private key (certificate retains ownership)
-  HCRYPTPROV csp = NULL;
-  HRESULT hr = certificate_->GetCSPContext(&csp);
-  ASSERT(SUCCEEDED(hr) && csp, (L""));
-
-  // Hash the data
-  CryptDetails::scoped_crypt_hash hash;
-  BOOL b = ::CryptCreateHash(csp, kHashAlgorithm, 0, 0, address(hash));
-  if (!b) {
-    // hash is now invalid, but might not be NULL, so stomp on it
-    DWORD err = ::GetLastError();
-    ASSERT(!hash, (L""));
-    UTIL_LOG(LE, (L"[CryptoComputeSignature::Sign]"
-                  L"[could not create hash, err 0x%08lx]", err));
-    return HRESULT_FROM_WIN32(err);
-  }
-  UTIL_LOG(L3, (L"CryptoComputeSignature::Sign new hash 0x%08lx", get(hash)));
-
-  b = ::CryptHashData(get(hash), &buffer_in.front(), buffer_in.size(), 0);
-  if (!b) {
-    DWORD err = ::GetLastError();
-    UTIL_LOG(LE, (L"[CryptoComputeSignature::Sign]"
-                  L"[could not hash data, err 0x%08lx]", err));
-    return HRESULT_FROM_WIN32(err);
-  }
-
-  // Sign the hash (first get length, then allocate buffer and do real signing)
-  DWORD signature_len = 0;
-  b = ::CryptSignHash(get(hash),
-                      kKeyPairType,
-                      NULL,
-                      0 /*flags*/,
-                      NULL,
-                      &signature_len);
-  if (!b && ::GetLastError() != ERROR_MORE_DATA) {
-    DWORD err = ::GetLastError();
-    UTIL_LOG(LE, (L"[CryptoComputeSignature::Sign]"
-                  L"[could not compute size of signature, err 0x%08lx]", err));
-    return HRESULT_FROM_WIN32(err);
-  }
-  signature_out->resize(signature_len);
-  b = ::CryptSignHash(get(hash),
-                      kKeyPairType,
-                      NULL,
-                      0,
-                      &signature_out->front(),
-                      &signature_len);
-  if (!b) {
-    DWORD err = ::GetLastError();
-    UTIL_LOG(LE, (L"[CryptoComputeSignature::Sign]"
-                  L"[could not compute signature, err 0x%08lx]", err));
-    return HRESULT_FROM_WIN32(err);
-  }
-  ASSERT(signature_len == signature_out->size(), (L""));
-
-  UTIL_LOG(L3, (L"[CryptoComputeSignature::Sign]"
-                L"[have %d byte signature]", signature_out->size()));
-
-  return S_OK;
-}
-
-// To verify signed data you need a CSP, and you also need the public
-// key extracted from a certificate.  The CSP can be any RSA CSP on the
-// machine, the default one is fine.  To get the public key you start
-// by importing a certificate in standard "DER encoded" format.  That
-// returns a giant data structure, one field of which is the public key
-// in a format that CryptoAPI understands.  You import this public key
-// into the CSP with the CryptImportPublicKey() API, and then create a
-// key object from it suitable for use with the verification API.
-
-CryptoSignatureVerificationCertificate::CryptoSignatureVerificationCertificate() {   // NOLINT
-}
-
-CryptoSignatureVerificationCertificate::~CryptoSignatureVerificationCertificate() {  // NOLINT
-}
-
-HRESULT CryptoSignatureVerificationCertificate::ImportCertificate(
-    const TCHAR * filepath,
-    const TCHAR * subject_name) {
-  ASSERT(filepath, (L""));
-  std::vector<byte> buffer;
-  HRESULT hr = ReadEntireFile(filepath, kMaxCertificateSize, &buffer);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (L"[CryptoSignatureVerificationCertificate::ImportCertificate]"
-                  L"['%s' not read, hr 0x%08lx]", filepath, hr));
-    return hr;
-  }
-  return ImportCertificate(buffer, subject_name);
-}
-
-HRESULT CryptoSignatureVerificationCertificate::ImportCertificate(
-    const std::vector<byte>& certificate_in,
-    const TCHAR * subject_name) {
-  // Import the certificate
-  ASSERT1(!certificate_in.empty());
-  reset(certificate_, ::CertCreateCertificateContext(kEncodingType,
-                                                     &certificate_in.front(),
-                                                     certificate_in.size()));
-  if (!certificate_) {
-    DWORD err = ::GetLastError();
-    UTIL_LOG(LE, (L"[CryptoSignatureVerificationCertificate::ImportCertificate]"
-                  L"[could not import certificate, err 0x%08lx]", err));
-    return SIGS_E_INVALID_DER_CERTIFICATE;
-  }
-  UTIL_LOG(L3, (L"[CryptoSignatureVerificationCertificate::ImportCertificate]"
-                L"[new certificate 0x%08lx]", get(certificate_)));
-
-  // Get certificate's subject name
-  DWORD name_len = ::CertGetNameString(get(certificate_),
-                                       kCertificateNameType,
-                                       0 /*flags*/,
-                                       NULL,
-                                       NULL,
-                                       0);
-  if (name_len <= 1) {
-    // Name attribute not found - should never happen
-    ASSERT(0, (L"CryptoSignatureVerificationCertificate failed to get "
-               L"certificate name length, err 0x%08lx", ::GetLastError()));
-    return E_FAIL;
-  }
-  // name_len includes the terminating NULL
-
-  std::vector <TCHAR> name;
-  name.resize(name_len);
-  ASSERT1(!name.empty());
-  DWORD name_len2 = ::CertGetNameString(get(certificate_),
-                                        kCertificateNameType,
-                                        0,
-                                        NULL,
-                                        &name.front(),
-                                        name_len);
-  ASSERT(name_len2 == name_len, (L""));
-
-  UTIL_LOG(L3, (L"[CryptoSignatureVerificationCertificate::ImportCertificate]"
-                L"['%s' is subject of certificate]", &name.front()));
-
-  subject_name_ = &name.front();
-
-  // Check the name if the user so desires.
-  if (subject_name && (0 != String_StrNCmp(&name.front(),
-                                           subject_name,
-                                           ::lstrlen(subject_name), false))) {
-      // name mismatch
-    UTIL_LOG(L3, (L"[CryptoSignatureVerificationCertificate::ImportCertificate]"
-                  L"[not the right certificate, we're looking for '%s']",
-                  subject_name));
-    return E_FAIL;
-  }
-
-  return S_OK;
-}
-
-HRESULT CryptoSignatureVerificationCertificate::GetCSPContextAndKey(
-    HCRYPTPROV* csp_context,
-    HCRYPTKEY* public_key) {
-  ASSERT(csp_context, (L""));
-  ASSERT(public_key, (L""));
-  ASSERT(get(certificate_), (L""));
-
-  // Get the public key out of the certificate
-  PCERT_INFO cert_info = get(certificate_)->pCertInfo;
-  ASSERT(cert_info, (L""));
-  PCERT_PUBLIC_KEY_INFO public_key_info = &cert_info->SubjectPublicKeyInfo;
-  ASSERT(public_key_info, (L""));
-
-  // Reset the CSP and key in case it has been used already
-  reset(key_);
-  reset(csp_);
-
-  // Get the default CSP.  With CRYPT_VERIFYCONTEXT don't need to worry
-  // about creating/destroying a key container.
-  // TODO(omaha):  Why wasn't PROV_RSA_SIG available?  Maybe looking for the
-  // default isn't a good idea?
-  BOOL b = ::CryptAcquireContext(address(csp_),
-                                 NULL,
-                                 NULL,
-                                 kProviderType,
-                                 CRYPT_VERIFYCONTEXT|CRYPT_SILENT);
-  if (!b) {
-    DWORD err = ::GetLastError();
-    UTIL_LOG(LE, (L"[GetCSPContextAndKey]"
-                  L"[failed to acquire CSP, err 0x%08lx]", err));
-    return HRESULT_FROM_WIN32(err);
-  }
-  UTIL_LOG(L3, (L"[CryptoSignatureVerificationCertificate::GetCSPContextAndKey]"
-                L"[new CSP 0x%08lx]", get(csp_)));
-
-  // Convert the public key in encoded form into a CryptoAPI HCRYPTKEY
-  b = ::CryptImportPublicKeyInfo(get(csp_),
-                                 kEncodingType,
-                                 public_key_info,
-                                 address(key_));
-  if (!b) {
-    DWORD err = ::GetLastError();
-    UTIL_LOG(LE, (L"[GetCSPContextAndKey]"
-                  L"[failed to import public key, err 0x%08lx]", err));
-    return HRESULT_FROM_WIN32(err);
-  }
-  UTIL_LOG(L3, (L"[CryptoSignatureVerificationCertificate::GetCSPContextAndKey]"
-                L"[new key 0x%08lx]", get(key_)));
-
-  *csp_context = get(csp_);
-  *public_key = get(key_);
-
-  return S_OK;
-}
-
-// To verify the signature of some data using CryptoAPI you first hash
-// it into a hash object, then verify it using the CSP and a public key.
-// In this case the CryptVerifySignature takes the key (of type
-// AT_SIGNATURE) as a separate parameter. The
-// CryptoSignatureVerificationCertificate can provide the proper CSP and
-// the public key from the certificate.
-
-CryptoVerifySignature::CryptoVerifySignature(
-    CryptoSignatureVerificationCertificate& certificate)
-    : certificate_(&certificate) {
-}
-
-CryptoVerifySignature::~CryptoVerifySignature() {
-}
-
-HRESULT CryptoVerifySignature::Validate(const TCHAR* filepath,
-                                        uint32 max_len,
-                                        const std::vector<byte>& signature_in) {
-  ASSERT(filepath, (L""));
-  std::vector<byte> buffer;
-  HRESULT hr = ReadEntireFile(filepath, max_len, &buffer);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (L"[CryptoVerifySignature::Validate]"
-                  L"['%s' not read, hr 0x%08lx]", filepath, hr));
-    return hr;
-  }
-  return Validate(buffer, signature_in);
-}
-
-HRESULT CryptoVerifySignature::Validate(const std::vector<byte>& buffer_in,
-                                        const std::vector<byte>& signature_in) {
-  ASSERT(certificate_, (L""));
-  ASSERT1(!buffer_in.empty());
-  ASSERT1(!signature_in.empty());
-
-  UTIL_LOG(L2, (L"[CryptoVerifySignature::Validate]"
-                L"[buffer of %d bytes, signature of %d bytes]",
-                buffer_in.size(), signature_in.size()));
-
-  // Get the CSP context and the public key from the certificate
-  HCRYPTPROV csp = NULL;
-  HCRYPTKEY key = NULL;
-  HRESULT hr = certificate_->GetCSPContextAndKey(&csp, &key);
-  ASSERT(SUCCEEDED(hr) && csp && key, (L""));
-
-  // Hash the data
-  CryptDetails::scoped_crypt_hash hash;
-  BOOL b = ::CryptCreateHash(csp, kHashAlgorithm, 0, 0, address(hash));
-  if (!b) {
-    // hash is now invalid, but might not be NULL, so stomp on it
-    DWORD err = ::GetLastError();
-    ASSERT(!hash, (L""));
-    UTIL_LOG(LE, (L"[CrypoVerifySignature::Validate]"
-                  L"[could not create hash], err 0x%08lx", err));
-    return HRESULT_FROM_WIN32(err);
-  }
-  UTIL_LOG(L3, (L"CryptoVerifySignature::Validate new hash 0x%08lx", hash));
-
-  b = ::CryptHashData(get(hash),
-                      &buffer_in.front(),
-                      buffer_in.size(),
-                      0 /*flags*/);
-  if (!b) {
-    DWORD err = ::GetLastError();
-    UTIL_LOG(LE, (L"[CryptoVerifySignature::Validate]"
-                  L"[could not hash data, err 0x%08lx]", err));
-    return HRESULT_FROM_WIN32(err);
-  }
-
-  // Verify the hash
-  b = ::CryptVerifySignature(get(hash),
-                             &signature_in.front(),
-                             signature_in.size(),
-                             key,
-                             NULL,
-                             0 /*flags*/);
-  if (!b) {
-    DWORD err = ::GetLastError();
-#ifdef LOGGING
-    CString encoded_signature;
-    Base64::Encode(signature_in, &encoded_signature, false);
-
-    UTIL_LOG(LE, (_T("CryptoVerifySignature::Validate could not ")
-                  _T("verify signature, err 0x%08lx with sig \"%s\""),
-                  err, encoded_signature));
-#endif
-    if (err == NTE_BAD_SIGNATURE)
-      return SIGS_E_INVALID_SIGNATURE;
-    else
-      return HRESULT_FROM_WIN32(err);
-  }
-
-  return S_OK;
-}
-
-HRESULT SignData(const TCHAR* certificate_path,
-                 const TCHAR* certificate_password,
-                 const TCHAR* certificate_subject_name,
-                 const std::vector<byte>& data,
-                 CString* signature_base64) {
-  ASSERT(certificate_path, (L""));
-  ASSERT(certificate_password, (L""));
-  // certificate_subject_name can be NULL
-  ASSERT(signature_base64, (L""));
-
-  CryptoSigningCertificate certificate;
-  RET_IF_FAILED(certificate.ImportCertificate(certificate_path,
-                                              certificate_password,
-                                              certificate_subject_name));
-
-  CryptoComputeSignature signer(&certificate);
-  std::vector<byte> signature;
-  RET_IF_FAILED(signer.Sign(data, &signature));
-  RET_IF_FAILED(Base64::Encode(signature, signature_base64, false));
-
-  return S_OK;
-}
-
-HRESULT VerifyData(const TCHAR* certificate_path,
-                   const TCHAR* certificate_subject_name,
-                   const std::vector<byte>& data,
-                   const TCHAR* signature_base64) {
-  ASSERT(certificate_path, (L""));
-  // certificate_subject_name can be NULL
-  ASSERT(signature_base64, (L""));
-
-  std::vector<byte> signature;
-  RET_IF_FAILED(Base64::Decode(CString(signature_base64), &signature));
-
-  CryptoSignatureVerificationCertificate certificate;
-  RET_IF_FAILED(certificate.ImportCertificate(certificate_path,
-                                              certificate_subject_name));
-
-  CryptoVerifySignature verifier(certificate);
-  RET_IF_FAILED(verifier.Validate(data, signature));
-
-  return S_OK;
-}
-
-HRESULT VerifyData(const std::vector<byte>& certificate_buffer,
-                   const TCHAR* certificate_subject_name,
-                   const std::vector<byte>& data,
-                   const TCHAR* signature_base64) {
-  // certificate_subject_name can be NULL
-  ASSERT(signature_base64, (L""));
-
-  std::vector<byte> signature;
-  RET_IF_FAILED(Base64::Decode(CString(signature_base64), &signature));
-
-  CryptoSignatureVerificationCertificate certificate;
-  RET_IF_FAILED(certificate.ImportCertificate(certificate_buffer,
-                                              certificate_subject_name));
-
-  CryptoVerifySignature verifier(certificate);
-  RET_IF_FAILED(verifier.Validate(data, signature));
-
-  return S_OK;
-}
-
-// TODO(omaha): function is missing the unit test.
-HRESULT AuthenticateFiles(const std::vector<CString>& files,
-                          const CString& hash) {
-  ASSERT1(!files.empty());
-
-  std::vector<byte> hash_vector;
-  RET_IF_FAILED(Base64::Decode(hash, &hash_vector));
-  if (hash_vector.size() != CryptoHash::kHashSize) {
-    return E_INVALIDARG;
-  }
-
-  CryptoHash crypto;
-  return crypto.Validate(files, kMaxFileSizeForAuthentication, hash_vector);
-}
-
-}  // namespace omaha
-
diff --git a/base/signatures.h b/base/signatures.h
deleted file mode 100644
index 2b2b507..0000000
--- a/base/signatures.h
+++ /dev/null
@@ -1,296 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// signatures.h
-//
-// Classes and functions related to crypto-hashes of buffers and digital
-// signatures of buffers.
-
-#ifndef OMAHA_BASE_SIGNATURES_H_
-#define OMAHA_BASE_SIGNATURES_H_
-
-#include <windows.h>
-#include <wincrypt.h>
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "omaha/base/scoped_any.h"
-
-namespace omaha {
-
-// Forward decls of classes defined here
-class CryptoHash;
-class CryptoComputeSignature;
-class CryptoVerifySignature;
-class CryptoSigningCertificate;
-class CryptoSignatureVerificationCertificate;
-
-// Useful scoped pointers for working with CryptoAPI objects
-namespace CryptDetails {
-
-  void crypt_close_store(HCERTSTORE);
-  void crypt_release_context(HCRYPTPROV);
-  void crypt_free_certificate(PCCERT_CONTEXT);
-  void crypt_destroy_key(HCRYPTKEY);
-
-  typedef close_fun<void (*)(HCERTSTORE),crypt_close_store>          smart_close_store;       // NOLINT
-  typedef close_fun<void (*)(HCRYPTPROV),crypt_release_context>      smart_release_context;   // NOLINT
-  typedef close_fun<void (*)(PCCERT_CONTEXT),crypt_free_certificate> smart_free_certificate;  // NOLINT
-  typedef close_fun<void (*)(HCRYPTKEY),crypt_destroy_key>           smart_destroy_key;       // NOLINT
-
-  typedef scoped_any<HCERTSTORE,smart_close_store,null_t>            scoped_crypt_store;      // NOLINT
-  typedef scoped_any<HCRYPTPROV,smart_release_context,null_t>        scoped_crypt_context;    // NOLINT
-  typedef scoped_any<PCCERT_CONTEXT,smart_free_certificate,null_t>   scoped_crypt_cert;       // NOLINT
-  typedef scoped_any<HCRYPTKEY,smart_destroy_key,null_t>             scoped_crypt_key;        // NOLINT
-}
-
-// A namespace for encoding binary into base64 (portable ASCII) representation
-// and for decoding it again.
-namespace Base64 {
-  // Binary -> base64 in a buffer
-  HRESULT Encode(const std::vector<byte>& buffer_in,
-                 std::vector<byte>* encoded,
-                 bool break_into_lines = true);
-
-  // Binary -> base64 in a string
-  HRESULT Encode(const std::vector<byte>& buffer_in,
-                 CStringA* encoded,
-                 bool break_into_lines = true);
-
-  // Binary -> base64 in a wide string
-  HRESULT Encode(const std::vector<byte>& buffer_in,
-                 CString* encoded,
-                 bool break_into_lines = true);
-
-  // Base64 in a buffer -> binary
-  HRESULT Decode(const std::vector<byte>& encoded,
-                 std::vector<byte>* buffer_out);
-
-  // Base64 in a CStringA -> binary
-  HRESULT Decode(const CStringA& encoded, std::vector<byte>* buffer_out);
-
-  // Base64 in a CString -> binary
-  HRESULT Decode(const CString& encoded, std::vector<byte>* buffer_out);
-}
-
-
-// Compute and validate SHA-1 hashes of data
-class CryptoHash {
-  public:
-
-    CryptoHash();
-    ~CryptoHash();
-
-    static const int kHashSize = 20;
-
-    // Hash a file
-    HRESULT Compute(const TCHAR * filepath,
-                    uint64 max_len,
-                    std::vector<byte>* hash_out);
-
-    // Hash a list of files
-    HRESULT Compute(const std::vector<CString>& filepaths,
-                    uint64 max_len,
-                    std::vector<byte>* hash_out);
-
-    // Hash a buffer
-    HRESULT Compute(const std::vector<byte>& buffer_in,
-                    std::vector<byte>* hash_out);
-
-    // Verify hash of a file
-    HRESULT Validate(const TCHAR * filepath,
-                     uint64 max_len,
-                     const std::vector<byte>& hash_in);
-
-    // Verify hash of a list of files
-    HRESULT Validate(const std::vector<CString>& filepaths,
-                     uint64 max_len,
-                     const std::vector<byte>& hash_in);
-
-    // Verify hash of a buffer
-    HRESULT Validate(const std::vector<byte>& buffer_in,
-                     const std::vector<byte>& hash_in);
-
-  private:
-    // Compute or verify hash of a file
-    HRESULT ComputeOrValidate(const std::vector<CString>& filepaths,
-                              uint64 max_len,
-                              const std::vector<byte>* hash_in,
-                              std::vector<byte>* hash_out);
-
-    // Compute or verify hash of a buffer
-    HRESULT ComputeOrValidate(const std::vector<byte>& buffer_in,
-                              const std::vector<byte>* hash_in,
-                              std::vector<byte>* hash_out);
-
-    DISALLOW_EVIL_CONSTRUCTORS(CryptoHash);
-};
-
-
-// Import and use a certificate for signing data (has a private key)
-class CryptoSigningCertificate {
-  public:
-    CryptoSigningCertificate();
-    ~CryptoSigningCertificate();
-
-    // Import certificate - with both public key and private key.
-    // Must be in PFX format.  Password must unlock the PFX file.
-    // subject_name is the certificate's subject name (who it was
-    // issued to) - if not NULL then it is checked for an exact
-    // match against the certificate.
-
-    // User can get the certificate in PFX format by following the procedure at
-    // http://support.globalsign.net/en/objectsign/transform.cfm
-
-    HRESULT ImportCertificate(const TCHAR * filepath,
-                              const TCHAR * password,
-                              const TCHAR * subject_name);
-
-    HRESULT ImportCertificate(const std::vector<byte>& certificate_in,
-                              const TCHAR * password,
-                              const TCHAR * subject_name);
-
-    CString subject_name() { return subject_name_; }
-
-  private:
-    static const int kMaxCertificateSize = 100000;
-
-    CryptDetails::scoped_crypt_store   store_;
-    CryptDetails::scoped_crypt_cert    certificate_;
-    CryptDetails::scoped_crypt_context csp_;
-    CString subject_name_;
-    DWORD key_spec_;
-
-    friend class CryptoComputeSignature;
-    // Get the CSP with the private key
-    // (CryptoSigningCertificate retains ownership of csp_context.)
-    HRESULT GetCSPContext(HCRYPTPROV* csp_context);
-
-    DISALLOW_EVIL_CONSTRUCTORS(CryptoSigningCertificate);
-};
-
-
-// Compute digital signatures
-class CryptoComputeSignature {
-  public:
-    explicit CryptoComputeSignature(CryptoSigningCertificate* certificate);
-    ~CryptoComputeSignature();
-
-    // Sign a file, returning a separate signature
-    HRESULT Sign(const TCHAR * filepath,
-                 uint32 max_len,
-                 std::vector<byte>* signature_out);
-
-    // Sign a chunk of memory, returning a separate signature
-    HRESULT Sign(const std::vector<byte>& buffer_in,
-                 std::vector<byte>* signature_out);
-
-  private:
-    // Does not take ownership of the certificate
-    CryptoSigningCertificate* const certificate_;
-
-    DISALLOW_EVIL_CONSTRUCTORS(CryptoComputeSignature);
-};
-
-
-// Import and use a certificate for verifying signatures (has public key only)
-class CryptoSignatureVerificationCertificate {
-  public:
-    CryptoSignatureVerificationCertificate();
-    ~CryptoSignatureVerificationCertificate();
-
-    // Import certificate - with only public key.  Must be in DER (.cer) format.
-    // subject_name is the certificate's subject name (who it was
-    // issued to) - if not NULL then it is checked for an exact
-    // match against the certificate.
-
-    // User can get certificate in DER format (.cer) by exporting from
-    // certmgr.exe, using openssl, etc.)
-
-    HRESULT ImportCertificate(const TCHAR * filepath,
-                              const TCHAR * subject_name);
-    HRESULT ImportCertificate(const std::vector<byte>& certificate_in,
-                              const TCHAR * subject_name);
-
-    CString subject_name() { return subject_name_; }
-
-  private:
-    static const int kMaxCertificateSize = 100000;
-
-    CryptDetails::scoped_crypt_cert    certificate_;
-    CryptDetails::scoped_crypt_context csp_;
-    CryptDetails::scoped_crypt_key     key_;
-    CString subject_name_;
-
-    friend class CryptoVerifySignature;
-    // Get the CSP and the public key
-    // (CryptoSignatureVerificationCertificate retains ownership of csp_context
-    // and public_key.)
-    HRESULT GetCSPContextAndKey(HCRYPTPROV* csp_context, HCRYPTKEY* public_key);
-
-    DISALLOW_EVIL_CONSTRUCTORS(CryptoSignatureVerificationCertificate);
-};
-
-
-// Verify digital signatures
-class CryptoVerifySignature {
-  public:
-    explicit CryptoVerifySignature(
-        CryptoSignatureVerificationCertificate& certificate);
-    ~CryptoVerifySignature();
-
-    // Validate signature of a file, signature given separately
-    HRESULT Validate(const TCHAR * filepath,
-                     uint32 max_len,
-                     const std::vector<byte>& signature_in);
-
-    // Validate signature of a buffer of data, signature given separately
-    HRESULT Validate(const std::vector<byte>& buffer_in,
-                     const std::vector<byte>& signature_in);
-
-  private:
-    // Does not take ownership of the certificate
-    CryptoSignatureVerificationCertificate* const certificate_;
-
-    DISALLOW_EVIL_CONSTRUCTORS(CryptoVerifySignature);
-};
-
-
-// All-in-one routine to sign a chunk of data and return the signature
-// (encoded in base64)
-HRESULT SignData(const TCHAR* certificate_path,
-                 const TCHAR* certificate_password,
-                 const TCHAR* certificate_subject_name,
-                 const std::vector<byte>& data,
-                 CString* signature_base64);
-
-// All-in-one routine to verify the signature of a chunk of data
-HRESULT VerifyData(const TCHAR* certificate_path,
-                   const TCHAR* certificate_subject_name,
-                   const std::vector<byte>& data,
-                   const TCHAR* signature_base64);
-
-HRESULT VerifyData(const std::vector<byte>& certificate_buffer,
-                   const TCHAR* certificate_subject_name,
-                   const std::vector<byte>& data,
-                   const TCHAR* signature_base64);
-
-// Authenticate files
-HRESULT AuthenticateFiles(const std::vector<CString>& files,
-                          const CString& hash);
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_SIGNATURES_H_
diff --git a/base/signatures_unittest.cc b/base/signatures_unittest.cc
deleted file mode 100644
index 8bb82ad..0000000
--- a/base/signatures_unittest.cc
+++ /dev/null
@@ -1,213 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// signatures_unittest.cpp
-//
-// Unittests for classes and functions related to crypto-hashes of buffers and
-// digital signatures of buffers.
-// TODO(omaha): There are a number of places inside the signatures code, where
-// empty vector iterators were being dereferenced. Ensure that all these are
-// being tested.
-
-#include <cstring>
-#include <vector>
-#include "omaha/base/app_util.h"
-#include "omaha/base/error.h"
-#include "omaha/base/module_utils.h"
-#include "omaha/base/path.h"
-#include "omaha/base/signatures.h"
-#include "omaha/base/utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-struct {
-  char* binary;
-  char* base64;
-} test_data[] = {
-  "",                                "",
-  "what",                            "d2hhdA==",
-  "what will print out",             "d2hhdCB3aWxsIHByaW50IG91dA==",
-  "foobar",                          "Zm9vYmFy",
-  "a man, a plan, a canal: panama!", "YSBtYW4sIGEgcGxhbiwgYSBjYW5hbDogcGFuYW1hIQ==",    // NOLINT
-};
-
-// This test data from http://en.wikipedia.org/wiki/SHA-1:
-struct {
-  char* binary;
-  byte  hash[20];
-} test_hash[] = {
-  "The quick brown fox jumps over the lazy dog",
-    0x2f, 0xd4, 0xe1, 0xc6, 0x7a, 0x2d, 0x28, 0xfc, 0xed, 0x84,
-    0x9e, 0xe1, 0xbb, 0x76, 0xe7, 0x39, 0x1b, 0x93, 0xeb, 0x12,
-  "The quick brown fox jumps over the lazy cog",
-    0xde, 0x9f, 0x2c, 0x7f, 0xd2, 0x5e, 0x1b, 0x3a, 0xfa, 0xd3,
-    0xe8, 0x5a, 0x0b, 0xd1, 0x7d, 0x9b, 0x10, 0x0d, 0xb4, 0xb3,
-};
-
-}  // namespace
-
-TEST(SignaturesTest, Base64) {
-  for (size_t i = 0; i != arraysize(test_data); i++) {
-    std::vector<byte> buffer(strlen(test_data[i].binary));
-    if (strlen(test_data[i].binary) != 0) {
-      memcpy(&buffer.front(), test_data[i].binary, strlen(test_data[i].binary));
-    }
-    CStringA test_e;
-    ASSERT_SUCCEEDED(Base64::Encode(buffer, &test_e));
-    ASSERT_STREQ(test_e, test_data[i].base64);
-    std::vector<byte> test_d;
-    uint32 test_d_written = 0;
-    ASSERT_SUCCEEDED(Base64::Decode(test_e, &test_d));
-    ASSERT_EQ(test_d.size(), strlen(test_data[i].binary));
-    if (strlen(test_data[i].binary) != 0) {
-      ASSERT_EQ(0, memcmp(&test_d.front(),
-                          test_data[i].binary,
-                          strlen(test_data[i].binary)));
-    }
-  }
-}
-
-TEST(SignaturesTest, CryptoHash) {
-  CryptoHash chash;
-  for (size_t i = 0; i != arraysize(test_hash); i++) {
-    std::vector<byte> buffer(strlen(test_hash[i].binary));
-    memcpy(&buffer.front(), test_hash[i].binary, strlen(test_hash[i].binary));
-    std::vector<byte> hash;
-    ASSERT_SUCCEEDED(chash.Compute(buffer, &hash));
-    ASSERT_EQ(hash.size(), CryptoHash::kHashSize);
-    ASSERT_EQ(0, memcmp(&hash.front(),
-                        test_hash[i].hash,
-                        CryptoHash::kHashSize));
-    ASSERT_SUCCEEDED(chash.Validate(buffer, hash));
-  }
-}
-
-TEST(SignaturesTest, CreationVerification) {
-  TCHAR module_directory[MAX_PATH] = {0};
-  ASSERT_TRUE(GetModuleDirectory(NULL, module_directory));
-  CString directory;
-  directory.Format(_T("%s\\unittest_support"), module_directory);
-
-  CString encoded_cert_with_private_key_path;
-  encoded_cert_with_private_key_path.AppendFormat(
-      _T("%s\\certificate-with-private-key.pfx"), directory);
-  CString encoded_cert_without_private_key_path;
-  encoded_cert_without_private_key_path.AppendFormat(
-      _T("%s\\certificate-without-private-key.cer"), directory);
-  CString raw_test_data_path;
-  raw_test_data_path.AppendFormat(_T("%s\\declaration.txt"), directory);
-
-  // Get cert with private key and cert without private key.
-  std::vector<byte> encoded_cert_with_private_key;
-  std::vector<byte> encoded_cert_without_private_key;
-  ASSERT_SUCCEEDED(ReadEntireFile(encoded_cert_with_private_key_path,
-                                  0,
-                                  &encoded_cert_with_private_key));
-  ASSERT_SUCCEEDED(ReadEntireFile(encoded_cert_without_private_key_path,
-                                  0,
-                                  &encoded_cert_without_private_key));
-  CString cert_password = _T("f00bar");
-  CString cert_subject_name = _T("Unofficial Google Test");
-
-  // Get testdata.
-  std::vector<byte> raw_testdata;
-  ASSERT_SUCCEEDED(ReadEntireFile(raw_test_data_path, 0, &raw_testdata));
-
-  // Create a signing certificate.
-  CryptoSigningCertificate signing_certificate;
-  ASSERT_SUCCEEDED(signing_certificate.ImportCertificate(
-      encoded_cert_with_private_key, cert_password, cert_subject_name));
-
-  // Create a signature object and sign the test data.
-  std::vector<byte> signature;
-  CryptoComputeSignature signer(&signing_certificate);
-  ASSERT_SUCCEEDED(signer.Sign(raw_testdata, &signature));
-
-  // Create a validating certificate.
-  CryptoSignatureVerificationCertificate verification_certificate;
-  ASSERT_SUCCEEDED(verification_certificate.ImportCertificate(
-      encoded_cert_without_private_key, cert_subject_name));
-
-  // Create a signature object and verify the test data's signature.
-  CryptoVerifySignature verifier(verification_certificate);
-  ASSERT_SUCCEEDED(verifier.Validate(raw_testdata, signature));
-
-  // Mess up the signature and show it doesn't verify.
-  size_t mid = signature.size() / 2;
-  byte mid_byte = signature[mid];
-  signature[mid] = ~mid_byte;
-  ASSERT_FAILED(verifier.Validate(raw_testdata, signature));
-
-  // Restore the signature, mess up the test data, and show it doesn't verify.
-  signature[mid] = mid_byte;
-  mid = raw_testdata.size() / 2;
-  mid_byte = raw_testdata[mid];
-  raw_testdata[mid] = ~mid_byte;
-  ASSERT_FAILED(verifier.Validate(raw_testdata, signature));
-}
-
-TEST(SignaturesTest, AuthenticateFiles) {
-  const CString executable_path(app_util::GetCurrentModuleDirectory());
-
-  const CString source_file1 = ConcatenatePath(
-      executable_path,
-      _T("unittest_support\\download_cache_test\\")
-      _T("{89640431-FE64-4da8-9860-1A1085A60E13}\\gears-win32-opt.msi"));
-
-  const CString hash_file1 = _T("ImV9skETZqGFMjs32vbZTvzAYJU=");
-
-  const CString source_file2 = ConcatenatePath(
-       executable_path,
-       _T("unittest_support\\download_cache_test\\")
-       _T("{7101D597-3481-4971-AD23-455542964072}\\livelysetup.exe"));
-
-  const CString hash_file2 = _T("Igq6bYaeXFJCjH770knXyJ6V53s=");
-
-  const CString hash_files = _T("e2uzy96jlusKbADl87zie6F5iwE=");
-
-  const CString bad_hash = _T("sFzmoHgCbowEnioqVb8WanTYbhIabcde=");
-
-  std::vector<CString> files;
-
-  // Authenticate one file.
-  files.push_back(source_file1);
-  EXPECT_HRESULT_SUCCEEDED(AuthenticateFiles(files, hash_file1));
-
-  // Incorrect hash.
-  EXPECT_EQ(SIGS_E_INVALID_SIGNATURE, AuthenticateFiles(files, hash_file2));
-
-  // Bad hash.
-  EXPECT_EQ(E_INVALIDARG, AuthenticateFiles(files, bad_hash));
-  EXPECT_EQ(E_INVALIDARG, AuthenticateFiles(files, _T("")));
-
-  // Authenticate two files.
-  files.push_back(source_file2);
-  EXPECT_HRESULT_SUCCEEDED(AuthenticateFiles(files, hash_files));
-
-  // Round trip through CryptoHash::Compute to verify the hash of two files.
-  CryptoHash crypto;
-  std::vector<byte> hash_out;
-  EXPECT_HRESULT_SUCCEEDED(crypto.Compute(files, 0, &hash_out));
-
-  CStringA actual_hash_files;
-  EXPECT_HRESULT_SUCCEEDED(Base64::Encode(hash_out, &actual_hash_files));
-  EXPECT_STREQ(hash_files, CString(actual_hash_files));
-}
-
-}  // namespace omaha
-
diff --git a/base/signaturevalidator.cc b/base/signaturevalidator.cc
deleted file mode 100644
index c845e34..0000000
--- a/base/signaturevalidator.cc
+++ /dev/null
@@ -1,521 +0,0 @@
-// Copyright 2002-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/base/signaturevalidator.h"
-
-#include <atltime.h>
-#include <softpub.h>
-#include <wincrypt.h>
-#include <wintrust.h>
-#pragma warning(push)
-// C4100: unreferenced formal parameter
-// C4310: cast truncates constant value
-// C4548: expression before comma has no effect
-#pragma warning(disable : 4100 4310 4548)
-#include "base/basictypes.h"
-#pragma warning(pop)
-#include "omaha/base/constants.h"
-#include "omaha/base/error.h"
-
-namespace omaha {
-
-namespace {
-
-const LPCTSTR kEmptyStr = _T("");
-const DWORD kCertificateEncoding = X509_ASN_ENCODING | PKCS_7_ASN_ENCODING;
-
-// Gets a handle to the certificate store and optionally the cryptographic
-// message from the specified file.
-// The caller is responsible for closing the store and message.
-// message can be NULL if the handle is not needed.
-HRESULT GetCertStoreFromFile(const wchar_t* signed_file,
-                             HCERTSTORE* cert_store,
-                             HCRYPTMSG* message) {
-  if (!signed_file || !cert_store) {
-    return E_INVALIDARG;
-  }
-
-  // Get message handle and store handle from the signed file.
-  if (!::CryptQueryObject(CERT_QUERY_OBJECT_FILE,
-                          signed_file,
-                          CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED_EMBED,
-                          CERT_QUERY_FORMAT_FLAG_BINARY,
-                          0,              // reserved, must be 0
-                          NULL,           // pdwMsgAndCertEncodingType
-                          NULL,           // pdwContentType
-                          NULL,           // pdwFormatType
-                          cert_store,
-                          message,
-                          NULL)) {        // ppvContext
-    return HRESULT_FROM_WIN32(::GetLastError());
-  }
-
-  return S_OK;
-}
-
-// Gets the signer info from the crypt message.
-// The caller is responsible for freeing the signer info using LocalFree.
-HRESULT GetSignerInfo(HCRYPTMSG message, PCMSG_SIGNER_INFO* signer_info) {
-  if (!signer_info) {
-    return E_INVALIDARG;
-  }
-  *signer_info = NULL;
-
-  DWORD info_size = 0;
-  if (!::CryptMsgGetParam(message,
-                          CMSG_SIGNER_INFO_PARAM,
-                          0,
-                          NULL,
-                          &info_size)) {
-    return HRESULT_FROM_WIN32(::GetLastError());
-  }
-
-  *signer_info = static_cast<PCMSG_SIGNER_INFO>(::LocalAlloc(LPTR, info_size));
-  if (!*signer_info) {
-    return HRESULT_FROM_WIN32(::GetLastError());
-  }
-
-  if (!::CryptMsgGetParam(message,
-                          CMSG_SIGNER_INFO_PARAM,
-                          0,
-                          *signer_info,
-                          &info_size)) {
-    return HRESULT_FROM_WIN32(::GetLastError());
-  }
-
-  return S_OK;
-}
-
-// Gets the signer info for the time stamp signature in the specified signature.
-HRESULT GetTimeStampSignerInfo(PCMSG_SIGNER_INFO signer_info,
-                               PCMSG_SIGNER_INFO* countersigner_info) {
-  if (!signer_info || !countersigner_info) {
-    return E_INVALIDARG;
-  }
-  *countersigner_info = NULL;
-
-  PCRYPT_ATTRIBUTE attr = NULL;
-
-  // The countersigner info is contained in the unauthenticated attributes and
-  // indicated by the szOID_RSA_counterSign OID.
-  for (size_t i = 0; i < signer_info->UnauthAttrs.cAttr; ++i) {
-    if (lstrcmpA(szOID_RSA_counterSign,
-                 signer_info->UnauthAttrs.rgAttr[i].pszObjId) == 0) {
-      attr = &signer_info->UnauthAttrs.rgAttr[i];
-      break;
-    }
-  }
-
-  if (!attr) {
-    return E_FAIL;
-  }
-
-  // Decode and get CMSG_SIGNER_INFO structure for the timestamp certificate.
-  DWORD data_size = 0;
-  if (!::CryptDecodeObject(kCertificateEncoding,
-                           PKCS7_SIGNER_INFO,
-                           attr->rgValue[0].pbData,
-                           attr->rgValue[0].cbData,
-                           0,
-                           NULL,
-                           &data_size)) {
-    return HRESULT_FROM_WIN32(::GetLastError());
-  }
-
-  *countersigner_info =
-      static_cast<PCMSG_SIGNER_INFO>(::LocalAlloc(LPTR, data_size));
-  if (!*countersigner_info) {
-    return HRESULT_FROM_WIN32(::GetLastError());
-  }
-
-  if (!::CryptDecodeObject(kCertificateEncoding,
-                           PKCS7_SIGNER_INFO,
-                           attr->rgValue[0].pbData,
-                           attr->rgValue[0].cbData,
-                           0,
-                           *countersigner_info,
-                           &data_size)) {
-    return HRESULT_FROM_WIN32(::GetLastError());
-  }
-
-  return S_OK;
-}
-
-// Gets the time of the date stamp for the specified signature.
-// The time is in UTC.
-HRESULT GetDateOfTimeStamp(PCMSG_SIGNER_INFO signer_info,
-                           SYSTEMTIME* system_time) {
-  if (!signer_info || !system_time) {
-    return E_INVALIDARG;
-  }
-
-  PCRYPT_ATTRIBUTE attr = NULL;
-
-  // The signing time is contained in the authenticated attributes and
-  // indicated by the szOID_RSA_signingTime OID.
-  for (size_t i = 0; i < signer_info->AuthAttrs.cAttr; ++i) {
-    if (lstrcmpA(szOID_RSA_signingTime,
-                 signer_info->AuthAttrs.rgAttr[i].pszObjId) == 0) {
-      attr = &signer_info->AuthAttrs.rgAttr[i];
-      break;
-    }
-  }
-
-  if (!attr) {
-    return E_FAIL;
-  }
-
-  FILETIME file_time = {0};
-
-  // Decode and get FILETIME structure.
-  DWORD data_size = sizeof(file_time);
-  if (!::CryptDecodeObject(kCertificateEncoding,
-                           szOID_RSA_signingTime,
-                           attr->rgValue[0].pbData,
-                           attr->rgValue[0].cbData,
-                           0,
-                           &file_time,
-                           &data_size)) {
-    return HRESULT_FROM_WIN32(::GetLastError());
-  }
-
-  if (!::FileTimeToSystemTime(&file_time, system_time)) {
-    return HRESULT_FROM_WIN32(::GetLastError());
-  }
-
-  return S_OK;
-}
-
-}  // namespace
-
-CertInfo::CertInfo(const CERT_CONTEXT* given_cert_context)
-    : cert_context_(NULL) {
-  if (given_cert_context) {
-    // CertDuplicateCertificateContext just increases reference count of a given
-    // CERT_CONTEXT.
-    cert_context_ = CertDuplicateCertificateContext(given_cert_context);
-    not_valid_before_ = cert_context_->pCertInfo->NotBefore;
-    not_valid_after_ = cert_context_->pCertInfo->NotAfter;
-    // Extract signed party details.
-    ExtractIssuerInfo(cert_context_,
-                      &issuing_company_name_,
-                      &issuing_dept_name_,
-                      &trust_authority_name_);
-  }
-}
-
-CertInfo::~CertInfo() {
-  // Decrement reference count, if needed.
-  if (cert_context_)
-    CertFreeCertificateContext(cert_context_);
-}
-
-
-bool CertInfo::IsValidNow() const {
-  // we cannot directly get current time in FILETIME format.
-  // so first get it in SYSTEMTIME format and convert it into FILETIME.
-  SYSTEMTIME now;
-  GetSystemTime(&now);
-  FILETIME filetime_now;
-  SystemTimeToFileTime(&now, &filetime_now);
-  // CompareFileTime() is a windows function
-  return ((CompareFileTime(&filetime_now, &not_valid_before_) > 0)
-          && (CompareFileTime(&filetime_now, &not_valid_after_) < 0));
-}
-
-
-CString CertInfo::FileTimeToString(const FILETIME* ft) {
-  if (ft == NULL)
-    return _T("");
-  SYSTEMTIME st;
-  if (!FileTimeToSystemTime(ft, &st))
-    return _T("");
-
-  // Build a string showing the date and time.
-  CString time_str;
-  time_str.Format(_T("%02d/%02d/%d  %02d:%02d"), st.wDay, st.wMonth, st.wYear,
-    st.wHour, st.wMinute);
-  return time_str;
-}
-
-
-bool CertInfo::ExtractField(const CERT_CONTEXT* cert_context,
-                            const char* field_name,
-                            CString* field_value) {
-  if ((!cert_context) || (!field_name) || (!field_value)) {
-    return false;
-  }
-
-  field_value->Empty();
-
-  DWORD num_chars = ::CertGetNameString(cert_context,
-                                        CERT_NAME_ATTR_TYPE,
-                                        0,
-                                        const_cast<char*>(field_name),
-                                        NULL,
-                                        0);
-  if (num_chars > 1) {
-    num_chars = ::CertGetNameString(cert_context,
-                                  CERT_NAME_ATTR_TYPE,
-                                  0,
-                                  const_cast<char*>(field_name),
-                                  CStrBuf(*field_value, num_chars),
-                                  num_chars);
-  }
-
-  return num_chars > 1 ? true : false;
-}
-
-
-bool CertInfo::ExtractIssuerInfo(const CERT_CONTEXT* cert_context,
-                                 CString* orgn_name,
-                                 CString* orgn_dept_name,
-                                 CString* trust_authority) {
-  // trust-authority is optional, so no check.
-  if ((!orgn_name) || (!orgn_dept_name)) {
-    return false;
-  }
-
-  ExtractField(cert_context, szOID_COMMON_NAME, orgn_name);
-  ExtractField(cert_context, szOID_ORGANIZATIONAL_UNIT_NAME, orgn_dept_name);
-  if (trust_authority != NULL) {
-    ExtractField(cert_context, szOID_ORGANIZATION_NAME, trust_authority);
-  }
-
-  return true;
-}
-
-
-void CertList::FindFirstCert(CertInfo** result_cert_info,
-                             const CString &company_name_to_match,
-                             const CString &orgn_unit_to_match,
-                             const CString &trust_authority_to_match,
-                             bool allow_test_variant,
-                             bool check_cert_is_valid_now) {
-  if (!result_cert_info)
-    return;
-  (*result_cert_info) = NULL;
-
-  for (CertInfoList::const_iterator cert_iter = cert_list_.begin();
-       cert_iter != cert_list_.end();
-       ++cert_iter) {
-    // If any of the criteria does not match, continue on to next certificate
-    if (!company_name_to_match.IsEmpty()) {
-      const TCHAR* certificate_company_name =
-          (*cert_iter)->issuing_company_name_;
-      bool names_match = company_name_to_match == certificate_company_name;
-      if (!names_match && allow_test_variant) {
-        CString test_variant = company_name_to_match;
-        test_variant += _T(" (TEST)");
-        names_match = test_variant == certificate_company_name;
-      }
-      if (!names_match)
-        continue;
-    }
-    if (!orgn_unit_to_match.IsEmpty() &&
-        orgn_unit_to_match != (*cert_iter)->issuing_dept_name_)
-      continue;
-    if (!trust_authority_to_match.IsEmpty() &&
-        trust_authority_to_match != (*cert_iter)->trust_authority_name_)
-      continue;
-    // All the criteria matched. But, add only if it is a valid certificate.
-    if (!check_cert_is_valid_now || (*cert_iter)->IsValidNow()) {
-      (*result_cert_info) = (*cert_iter);
-      return;
-    }
-  }
-}
-
-
-void ExtractAllCertificatesFromSignature(const wchar_t* signed_file,
-                                         CertList* cert_list) {
-  if ((!signed_file) || (!cert_list))
-    return;
-
-  DWORD encoding_type = 0, content_type = 0, format_type = 0;
-  // If successful, cert_store will be populated by
-  // a store containing all the certificates related to the file signature.
-  HCERTSTORE cert_store = NULL;
-  BOOL succeeded = CryptQueryObject(CERT_QUERY_OBJECT_FILE,
-                    signed_file,
-                    CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED_EMBED,
-                    CERT_QUERY_FORMAT_FLAG_ALL,
-                    0,               // has to be zero as documentation says
-                    &encoding_type,  // DWORD *pdwMsgAndCertEncodingType,
-                    &content_type,   // DWORD *pdwContentType,
-                    &format_type,    // DWORD *pdwFormatType,
-                    &cert_store,     // HCERTSTORE *phCertStore,
-                    NULL,            // HCRYPTMSG *phMsg,
-                    NULL);           // const void** pvContext
-
-  if (succeeded && (cert_store != NULL)) {
-    PCCERT_CONTEXT   cert_context_ptr = NULL;
-    while ((cert_context_ptr =
-            CertEnumCertificatesInStore(cert_store, cert_context_ptr))
-           != NULL) {
-      CertInfo* cert_info = new CertInfo(cert_context_ptr);
-      cert_list->AddCertificate(cert_info);
-    }
-  }
-  if (cert_store) {
-    CertCloseStore(cert_store, 0);
-  }
-  return;
-}
-
-// Only check the CN. The OU can change.
-// TODO(omaha): A better way to implement the valid now check would be to add
-// a parameter to VerifySignature that adds WTD_LIFETIME_SIGNING_FLAG.
-bool VerifySigneeIsGoogleInternal(const wchar_t* signed_file,
-                                  bool check_cert_is_valid_now) {
-  CertList cert_list;
-  ExtractAllCertificatesFromSignature(signed_file, &cert_list);
-  if (cert_list.size() > 0) {
-    CertInfo* required_cert = NULL;
-    // now, see if one of the certificates in the signature belongs to Google.
-    cert_list.FindFirstCert(&required_cert,
-                            kCertificateSubjectName,
-                            CString(),
-                            CString(),
-                            true,
-                            check_cert_is_valid_now);
-    if (required_cert != NULL) {
-      return true;
-    }
-  }
-  return false;
-}
-
-// Does not verify that the certificate is currently valid.
-// VerifySignature verifies that the certificate was valid at signing time as
-// part of the normal signature verification.
-bool VerifySigneeIsGoogle(const wchar_t* signed_file) {
-  return VerifySigneeIsGoogleInternal(signed_file, false);
-}
-
-HRESULT VerifySignature(const wchar_t* signed_file, bool allow_network_check) {
-  // Don't pop up any windows
-  HWND const kWindowMode = reinterpret_cast<HWND>(INVALID_HANDLE_VALUE);
-
-  // Verify file & certificates
-  GUID verification_type = WINTRUST_ACTION_GENERIC_VERIFY_V2;
-
-  // Info for the file we're going to verify
-  WINTRUST_FILE_INFO file_info = {0};
-  file_info.cbStruct = sizeof(file_info);
-  file_info.pcwszFilePath = signed_file;
-
-  // Info for request to WinVerifyTrust
-  WINTRUST_DATA trust_data;
-  ZeroMemory(&trust_data, sizeof(trust_data));
-  trust_data.cbStruct = sizeof(trust_data);
-  trust_data.dwUIChoice = WTD_UI_NONE;               // no graphics
-  // No additional revocation checking -- note that this flag does not
-  // cancel the flag we set in dwProvFlags; it specifies that no -additional-
-  // checks are to be performed beyond the provider-specified ones.
-  trust_data.fdwRevocationChecks = WTD_REVOKE_NONE;
-  trust_data.dwProvFlags = WTD_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT;
-
-  if (!allow_network_check)
-    trust_data.dwProvFlags |= WTD_CACHE_ONLY_URL_RETRIEVAL;
-
-  trust_data.dwUnionChoice = WTD_CHOICE_FILE;        // check a file
-  trust_data.pFile = &file_info;                     // check this file
-
-  // If the trust provider verifies that the subject is trusted for the
-  // specified action, the return value is zero. No other value besides zero
-  // should be considered a successful return.
-  LONG result = ::WinVerifyTrust(kWindowMode, &verification_type, &trust_data);
-  if (result != 0) {
-    return FAILED(result) ? result : HRESULT_FROM_WIN32(result);
-  }
-  return S_OK;
-}
-
-// This method must not return until the end to avoid leaking memory.
-// More info on Authenticode Signatures Time Stamping can be found at
-// http://msdn2.microsoft.com/en-us/library/bb931395.aspx.
-HRESULT GetSigningTime(const wchar_t* signed_file, SYSTEMTIME* signing_time) {
-  if (!signed_file || !signing_time) {
-    return E_INVALIDARG;
-  }
-
-  HCERTSTORE cert_store = NULL;
-  HCRYPTMSG message = NULL;
-  PCMSG_SIGNER_INFO signer_info = NULL;
-  PCMSG_SIGNER_INFO countersigner_info = NULL;
-
-  HRESULT hr = GetCertStoreFromFile(signed_file, &cert_store, &message);
-
-  if (SUCCEEDED(hr)) {
-    hr = GetSignerInfo(message, &signer_info);
-  }
-
-  if (SUCCEEDED(hr)) {
-    hr = GetTimeStampSignerInfo(signer_info, &countersigner_info);
-  }
-
-  if (SUCCEEDED(hr)) {
-    hr = GetDateOfTimeStamp(countersigner_info, signing_time);
-  }
-
-  if (cert_store) {
-    ::CertCloseStore(cert_store, 0);
-  }
-  if (message) {
-    ::CryptMsgClose(message);
-  }
-  ::LocalFree(signer_info);
-  ::LocalFree(countersigner_info);
-
-  return hr;
-}
-
-HRESULT VerifyFileSignedWithinDays(const wchar_t* signed_file, int days) {
-  if (!signed_file || days <= 0) {
-    return E_INVALIDARG;
-  }
-
-  SYSTEMTIME signing_time = {0};
-  HRESULT hr = GetSigningTime(signed_file, &signing_time);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Use the Win32 API instead of CTime::GetCurrentTime() because the latter
-  // is broken in VS 2003 and 2005 and doesn't account for the timezone.
-  SYSTEMTIME current_system_time = {0};
-  ::GetSystemTime(&current_system_time);
-
-  CTime signed_time(signing_time);
-  CTime current_time(current_system_time);
-
-  if (current_time <= signed_time) {
-    return TRUST_E_TIME_STAMP;
-  }
-
-  CTimeSpan time_since_signed = current_time - signed_time;
-  CTimeSpan max_duration(days, 0, 0, 0);
-
-  if (max_duration < time_since_signed) {
-    return TRUST_E_TIME_STAMP;
-  }
-
-  return S_OK;
-}
-
-}  // namespace omaha
-
diff --git a/base/signaturevalidator.h b/base/signaturevalidator.h
deleted file mode 100644
index 9e7b717..0000000
--- a/base/signaturevalidator.h
+++ /dev/null
@@ -1,202 +0,0 @@
-// Copyright 2002-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_SIGNATUREVALIDATOR_H__
-#define OMAHA_COMMON_SIGNATUREVALIDATOR_H__
-
-#include <windows.h>
-#include <wincrypt.h>
-#include <atlstr.h>
-#pragma warning(push)
-// C4548: expression before comma has no effect
-#pragma warning(disable : 4548)
-#include <vector>
-#pragma warning(pop)
-
-// VerifySignature() and VerifySigneeIsGoogle() should always be used together.
-//
-// VerifySignature() verifies that the signature is valid and has a trusted
-// chain. It also verifies that the signing certificate was valid at the time
-// it was used to sign. If all are true, it returns S_OK. Even if the
-// certificate has expired since it was used to sign, the signature is valid and
-// VerifySignature() returns S_OK.
-//
-// If allow_network_check is true, VerifySignature() will
-// also check the Certificate Revocation List (CRL). If the certificate was
-// revoked after it was used to sign, it will return S_OK. Otherwise, it fails.
-// At no time does VerifySignature() check whether the certificate is currently
-// valid.
-//
-// VerifySigneeIsGoogle() verifies that Google signed the file. It does not
-// check the certificate chain, CRL, or anything related to the timestamp.
-//
-// Some of the helper classes and methods allow the caller to check whether the
-// certificate is valid now. The above methods do not check this.
-
-namespace omaha {
-
-// Class: CertInfo
-//
-// CertInfo holds all sensible details of a certificate. During verification of
-// a signature, one CertInfo object is made for each certificate encountered in
-// the signature.
-class CertInfo {
- public:
-  // certificate issuing company name e.g. "Google Inc".
-  CString issuing_company_name_;
-
-  // a company may own multiple certificates.
-  // so this tells which dept owns this certificate.
-  CString issuing_dept_name_;
-
-  // trust-authority (or trust-provider) name. e.g. "Verisign, Inc.".
-  CString trust_authority_name_;
-
-  // validity period start-date
-  FILETIME not_valid_before_;
-
-  // validity period end-date
-  FILETIME not_valid_after_;
-
-  // CERT_CONTEXT structure, defined by Crypto API, contains all the info about
-  // the certificate.
-  const CERT_CONTEXT *cert_context_;
-
-  explicit CertInfo(const CERT_CONTEXT* given_cert_context);
-
-  ~CertInfo();
-
-  // IsValidNow() functions returns true if this certificate is valid at this
-  // moment, based on the validity period specified in the certificate.
-  bool IsValidNow() const;
-
-  // AsString() is a utility function that's used for printing CertInfo details.
-  CString AsString() const {
-    CString cert_info_str =
-        _T("Issuing Company: \"") + issuing_company_name_ +
-        _T("\"  Dept: \"") + issuing_dept_name_ +
-        _T("\"  Trust Provider: \"") + trust_authority_name_ +
-        _T("\"  Valid From: \"") + this->FileTimeToString(&not_valid_before_) +
-        _T("\"  Valid To: \"") + this->FileTimeToString(&not_valid_after_) +
-        _T("\"");
-    return cert_info_str;
-  }
-
-
-  // FileTimeToString() is just a convenience function to print FILETIME.
-  static CString FileTimeToString(const FILETIME* ft);
-
-  // Given a cerificate context, this function extracts the subject/signee
-  // company name and its dept name(orgnanizational-unit-name, as they call it).
-  // Optionally, you could also retrieve trust-authority name.
-  static bool ExtractIssuerInfo(const CERT_CONTEXT* cert_context,
-                         CString* orgn_name,
-                         CString* orgn_dept_name,
-                         CString* trust_authority = NULL);
-
- private:
-  // Extracts the specified field from the certificate. Only the first value for
-  // the field is extracted if multiple values are present. Returns true if
-  // the field is extracted successfully. Returns false if an error occurred
-  // during the extraction or the field was not found.
-  static bool ExtractField(const CERT_CONTEXT* cert_context,
-                           const char* field_name,
-                           CString* field_value);
-};
-
-// CertList is a container for a list of certificates. It is used to hold all
-// the certificates found in the signature of a signed file. In addition, it
-// also provides interface to fetch certificates matching to a particular
-// criterion.
-//
-// Internally, CertList contains basically a vector of CertInfo* pointers.
-// The only reason why CertList is created as opposed to simply putting all
-// the certificates in a vector<CertInfo*> is to avoid memory-leaks. CertList
-// contains a list of CertInfo pointers and users don't have to worry about
-// freeing those pointers. On the other hand, if you use vector<CertInfo>
-// instead, it results in unwanted copying of CertInfo objects around.
-class CertList {
- public:
-  // Constructor
-  CertList() {}
-
-  // Destructor
-  ~CertList() {
-    for (unsigned int inx = 0; inx < cert_list_.size(); ++inx)
-      delete cert_list_[inx];
-    cert_list_.clear();
-  }
-
-  // size() returns the number of certificates in this CertList
-  size_t size() {
-    return cert_list_.size();
-  }
-
-  // AddCertificate() is used to add a certificate to CertList.
-  // NOTE that once a certificate is added, CertList takes ownership of that
-  // CertInfo object.
-  void AddCertificate(CertInfo* cert) {
-    cert_list_.push_back(cert);
-  }
-
-  // FindFirstCert() finds the first certificate that exactly matches the given
-  // criteria. If allow_test_variant is true, the company name will also be
-  // deemed valid if it equals company_name_to_match + " (TEST)".
-  void FindFirstCert(CertInfo** result_cert_info,
-                     const CString &company_name_to_match,
-                     const CString &orgn_unit_to_match,
-                     const CString &trust_authority_to_match,
-                     bool allow_test_variant,
-                     bool check_cert_is_valid_now);
-
-  typedef std::vector<CertInfo*> CertInfoList;
-
- private:
-  CertInfoList cert_list_;
-};
-
-
-// ExtractAllCertificatesFromSignature() takes in a signed file, extracts all
-// the certificates related to its signature and returns them in a CertList
-// object.
-void ExtractAllCertificatesFromSignature(const wchar_t* signed_file,
-                                         CertList* cert_list);
-
-// Returns true if the signee is Google by exactly matching the first CN name
-// against a well-defined string, currently "Google Inc".
-bool VerifySigneeIsGoogle(const wchar_t* signed_file);
-
-// Returns S_OK if a given signed file contains a signature
-// that could be successfully verified using one of the trust providers
-// IE relies on. This means that, whoever signed the file, they should've signed
-// using certificate issued by a well-known (to IE) trust provider like
-// Verisign, Inc.
-HRESULT VerifySignature(const wchar_t* signed_file, bool allow_network_check);
-
-// Returns true if a given signed file contains a valid signature.
-inline bool SignatureIsValid(const wchar_t* signed_file,
-                             bool allow_network_check) {
-  return VerifySignature(signed_file, allow_network_check) == S_OK;
-}
-
-// Gets the timestamp for the file's signature.
-HRESULT GetSigningTime(const wchar_t* signed_file, SYSTEMTIME* signing_time);
-
-// Verifies that the file was signed within the specified number of days.
-HRESULT VerifyFileSignedWithinDays(const wchar_t* signed_file, int days);
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_SIGNATUREVALIDATOR_H__
diff --git a/base/signaturevalidator_unittest.cc b/base/signaturevalidator_unittest.cc
deleted file mode 100644
index 6517bc1..0000000
--- a/base/signaturevalidator_unittest.cc
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Unit tests for the Google file signature validation.
-
-#include <windows.h>
-#include <atlstr.h>
-#include "omaha/base/app_util.h"
-#include "omaha/base/file.h"
-#include "omaha/base/signaturevalidator.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-class SignatureValidatorTest : public testing::Test {
-  virtual void SetUp() {
-  }
-
-  virtual void TearDown() {
-  }
-};
-
-
-TEST_F(SignatureValidatorTest, VerifySigneeIsGoogle_OfficiallySigned) {
-  const TCHAR kRelativePath[] = _T("unittest_support\\SaveArguments.exe");
-
-  CString executable_full_path(app_util::GetCurrentModuleDirectory());
-  ASSERT_TRUE(::PathAppend(CStrBuf(executable_full_path, MAX_PATH),
-                           kRelativePath));
-  ASSERT_TRUE(File::Exists(executable_full_path));
-  EXPECT_TRUE(VerifySigneeIsGoogle(executable_full_path));
-}
-
-// Tests a certificate subject containing multiple CNs such as:
-//    "CN = Google Inc (TEST), CN = Some Other CN, ...
-// The code exactly matches on the first CN only.
-TEST_F(SignatureValidatorTest, VerifySigneeIsGoogle_TestSigned_MultipleCN) {
-  const TCHAR kRelativePath[] =
-      _T("unittest_support\\SaveArguments_multiple_cn.exe");
-
-  CString executable_full_path(app_util::GetCurrentModuleDirectory());
-  ASSERT_TRUE(::PathAppend(CStrBuf(executable_full_path, MAX_PATH),
-                           kRelativePath));
-  ASSERT_TRUE(File::Exists(executable_full_path));
-  EXPECT_TRUE(VerifySigneeIsGoogle(executable_full_path));
-}
-
-TEST_F(SignatureValidatorTest,
-       VerifySigneeIsGoogle_OfficiallySigned_DifferentOU) {
-  const TCHAR kRelativePath[] =
-      _T("unittest_support\\SaveArguments_different_ou.exe");
-
-  CString executable_full_path(app_util::GetCurrentModuleDirectory());
-  ASSERT_TRUE(::PathAppend(CStrBuf(executable_full_path, MAX_PATH),
-                           kRelativePath));
-  ASSERT_TRUE(File::Exists(executable_full_path));
-  EXPECT_TRUE(VerifySigneeIsGoogle(executable_full_path));
-}
-
-TEST_F(SignatureValidatorTest, VerifySigneeIsGoogle_OmahaTestSigned) {
-  const TCHAR kRelativePath[] =
-      _T("unittest_support\\SaveArguments_OmahaTestSigned.exe");
-
-  CString executable_full_path(app_util::GetCurrentModuleDirectory());
-  ASSERT_TRUE(::PathAppend(CStrBuf(executable_full_path, MAX_PATH),
-                           kRelativePath));
-  ASSERT_TRUE(File::Exists(executable_full_path));
-  EXPECT_TRUE(VerifySigneeIsGoogle(executable_full_path));
-}
-
-// The certificate was valid when it was used to sign the executable, but it has
-// since expired.
-TEST_F(SignatureValidatorTest, VerifySigneeIsGoogle_SignedWithNowExpiredCert) {
-  const TCHAR kRelativePath[] =
-      _T("unittest_support\\GoogleUpdate_now_expired_cert.exe");
-
-  CString executable_full_path(app_util::GetCurrentModuleDirectory());
-  ASSERT_TRUE(::PathAppend(CStrBuf(executable_full_path, MAX_PATH),
-                           kRelativePath));
-  ASSERT_TRUE(File::Exists(executable_full_path));
-  EXPECT_TRUE(VerifySigneeIsGoogle(executable_full_path));
-}
-
-TEST_F(SignatureValidatorTest, VerifySigneeIsGoogle_TestSigned_NoCN) {
-  const TCHAR kRelativePath[] =
-      _T("unittest_support\\SaveArguments_no_cn.exe");
-
-  CString executable_full_path(app_util::GetCurrentModuleDirectory());
-  ASSERT_TRUE(::PathAppend(CStrBuf(executable_full_path, MAX_PATH),
-                           kRelativePath));
-  ASSERT_TRUE(File::Exists(executable_full_path));
-  EXPECT_FALSE(VerifySigneeIsGoogle(executable_full_path));
-}
-
-TEST_F(SignatureValidatorTest, VerifySigneeIsGoogle_TestSigned_WrongCN) {
-  const TCHAR kRelativePath[] =
-      _T("unittest_support\\SaveArguments_wrong_cn.exe");
-
-  CString executable_full_path(app_util::GetCurrentModuleDirectory());
-  ASSERT_TRUE(::PathAppend(CStrBuf(executable_full_path, MAX_PATH),
-                           kRelativePath));
-  ASSERT_TRUE(File::Exists(executable_full_path));
-  EXPECT_FALSE(VerifySigneeIsGoogle(executable_full_path));
-}
-
-}  // namespace omaha
diff --git a/base/single_instance.cc b/base/single_instance.cc
deleted file mode 100644
index c536baf..0000000
--- a/base/single_instance.cc
+++ /dev/null
@@ -1,196 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Synchronization functions
-
-#include "omaha/base/single_instance.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-// Check to see whether an instance is already running across all sessions.
-// If not, enter single instance protection. The user must call Shutdown()
-// on that SingleInstance once single instance protection is no longer needed.
-bool SingleInstance::StartupSingleInstance(const TCHAR* id) {
-  ASSERT1(id);
-
-  bool already_running = false, already_running_in_different_session = false;
-  HRESULT hr = Startup(id,
-                       &already_running,
-                       &already_running_in_different_session);
-  ASSERT(SUCCEEDED(hr), (_T("")));
-
-  return already_running || already_running_in_different_session;
-}
-
-// Check to see whether an instance is already running in this session. If not,
-// enter session-only single instance protection. The user must call Shutdown()
-// on that SingleInstance once single instance protection is no longer needed.
-bool SingleInstance::StartupSingleSessionInstance(const TCHAR* id) {
-  ASSERT1(id);
-
-  bool already_running = false;
-  HRESULT hr = Startup(id, &already_running, NULL);
-  ASSERT(SUCCEEDED(hr), (_T("")));
-
-  return already_running;
-}
-
-// Startup a single instance protection. The user must call Shutdown() on
-// that SingleInstance once the single instance protection is no longer needed.
-//
-// Returns whether or not the process is already running
-// already_running means "already running in same session".
-// already_running_in_different_session means "already running on machine"
-HRESULT SingleInstance::Startup(const TCHAR* id,
-                                bool* already_running,
-                                bool* already_running_in_different_session) {
-  ASSERT1(id);
-  ASSERT1(already_running);
-
-  CString mutex_id;
-
-  // Use two mutexes: one to check for being the only instance in this
-  // session, and one for being the only instance in any terminal session.
-  // Only create (and check) the global mutex for one-per-machine check if
-  // the result is asked for.
-  // We don't actually obtain ownership of the mutex
-  // For information on the "Local" and "Global" namespace prefixes, see MSDN
-  // article "Kernel Object Namespaces".
-
-  // Create a user level mutex
-  CreateSyncId(id, SYNC_USER, &mutex_id);
-  RET_IF_FAILED(CreateInstanceMutex(mutex_id,
-                                    &user_mutex_handle_,
-                                    already_running));
-
-  // Create a global mutex
-  if (already_running_in_different_session) {
-    CreateSyncId(id, SYNC_GLOBAL, &mutex_id);
-    RET_IF_FAILED(CreateInstanceMutex(mutex_id,
-                                      &global_mutex_handle_,
-                                      already_running_in_different_session));
-  }
-
-  return S_OK;
-}
-
-// Create a mutex
-HRESULT SingleInstance::CreateInstanceMutex(const TCHAR* mutex_id,
-                                            HANDLE* mutex_handle,
-                                            bool* already_running) {
-  ASSERT1(mutex_id && *mutex_id);
-  ASSERT1(mutex_handle);
-  ASSERT1(already_running);
-
-  *already_running = false;
-
-  *mutex_handle = ::CreateMutex(NULL, false, mutex_id);
-  DWORD last_error = ::GetLastError();
-
-  // We check for both values because we sometimes see access
-  // denied.  We expect this to mean that the mutex was created by a
-  // different set of user credentials, which shouldn't happen under
-  // normal circumstances in our applications, but in fact we did
-  // see it happen.
-  if (last_error == ERROR_ALREADY_EXISTS || last_error == ERROR_ACCESS_DENIED) {
-    *already_running = true;
-    return S_OK;
-  }
-
-  if (*mutex_handle == NULL) {
-    HRESULT hr = HRESULT_FROM_WIN32(last_error);
-    ASSERT(false, (_T("[SingleInstance::CreateInstanceMutex]")
-                   _T("[failed to create mutex][%s][0x%x]"), mutex_id, hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// Shutdown a single instance protection
-HRESULT SingleInstance::Shutdown() {
-  if (user_mutex_handle_) {
-    VERIFY(::CloseHandle(user_mutex_handle_), (_T("")));
-    user_mutex_handle_ = NULL;
-  }
-
-  if (global_mutex_handle_) {
-    VERIFY(::CloseHandle(global_mutex_handle_), (_T("")));
-    global_mutex_handle_ = NULL;
-  }
-
-  return S_OK;
-}
-
-// Check to see whether an instance is already running
-HRESULT SingleInstance::CheckAlreadyRunning(
-    const TCHAR* id,
-    bool* already_running,
-    bool* already_running_in_different_session) {
-  ASSERT1(id);
-  ASSERT1(already_running);
-
-  CString mutex_id;
-
-  // Open a user level mutex
-  CreateSyncId(id, SYNC_USER, &mutex_id);
-  RET_IF_FAILED(OpenInstanceMutex(mutex_id, already_running));
-
-  // Open a global mutex
-  if (already_running_in_different_session) {
-    CreateSyncId(id, SYNC_GLOBAL, &mutex_id);
-    RET_IF_FAILED(OpenInstanceMutex(mutex_id,
-                                    already_running_in_different_session));
-  }
-
-  return S_OK;
-}
-
-// Open a mutex
-HRESULT SingleInstance::OpenInstanceMutex(const TCHAR* mutex_id,
-                                          bool* already_running) {
-  ASSERT1(mutex_id && *mutex_id);
-  ASSERT1(already_running);
-
-  *already_running = false;
-
-  scoped_handle mutex_handle(::OpenMutex(NULL, false, mutex_id));
-  DWORD last_error = ::GetLastError();
-
-  if (get(mutex_handle) || last_error == ERROR_ACCESS_DENIED) {
-    UTIL_LOG(L3, (_T("[SingleInstance::OpenInstanceMutex]")
-                  _T("[already running][0x%x]"), last_error));
-    *already_running = true;
-    return S_OK;
-  }
-
-  if (last_error != ERROR_FILE_NOT_FOUND) {
-    HRESULT hr = HRESULT_FROM_WIN32(last_error);
-    ASSERT(false, (_T("[SingleInstance::OpenInstanceMutex]")
-                   _T("[failed to open mutex][%s][0x%x]"), mutex_id, hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-}  // namespace omaha
-
diff --git a/base/single_instance.h b/base/single_instance.h
deleted file mode 100644
index af1ca07..0000000
--- a/base/single_instance.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-// Single Instance of a process running (plus some synchronization functions
-// that should be moved elsewhere)
-//
-// synchronization functions
-
-#ifndef OMAHA_COMMON_SINGLE_INSTANCE_H_
-#define OMAHA_COMMON_SINGLE_INSTANCE_H_
-
-#include <windows.h>
-
-#include "base/basictypes.h"
-#include "omaha/base/debug.h"
-
-namespace omaha {
-
-// Used to ensure only a single instance of a process per machine
-// (e.g., even in terminal server sessions)
-class SingleInstance {
- public:
-  // Constructor
-  SingleInstance() : user_mutex_handle_(NULL), global_mutex_handle_(NULL) {}
-
-  // Destructor
-  ~SingleInstance() { Shutdown(); }
-
-  // Check to see whether an instance is already running across all sessions.
-  // If not, enter single instance protection. The user must call Shutdown()
-  // on that SingleInstance once single instance protection is no longer needed.
-  bool StartupSingleInstance(const TCHAR* id);
-
-  // Check to see whether an instance is already running for this user. If not,
-  // enter user-only single instance protection. The user must call Shutdown()
-  // on that SingleInstance once single instance protection is no longer needed.
-  bool StartupSingleSessionInstance(const TCHAR* id);
-
-  // Startup a single instance protection. The user must call Shutdown() on
-  // that SingleInstance once the single instance protection is no longer needed.
-  HRESULT Startup(const TCHAR* id,
-                  bool* already_running,
-                  bool* already_running_in_different_session);
-
-  // Shutdown a single instance protection
-  HRESULT Shutdown();
-
-  // Check to see whether an instance is already running
-  static HRESULT CheckAlreadyRunning(
-      const TCHAR* id,
-      bool* already_running,
-      bool* already_running_in_different_session);
-
- private:
-  // Create a mutex
-  static HRESULT CreateInstanceMutex(const TCHAR* mutex_id,
-                                     HANDLE* mutex_handle,
-                                     bool* already_running);
-
-  // Open a mutex
-  static HRESULT OpenInstanceMutex(const TCHAR* mutex_id,
-                                   bool* already_running);
-
-  HANDLE user_mutex_handle_;
-  HANDLE global_mutex_handle_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(SingleInstance);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_SINGLE_INSTANCE_H_
diff --git a/base/singleton.h b/base/singleton.h
deleted file mode 100644
index fc7c043..0000000
--- a/base/singleton.h
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Defines two classes
-// 1. class SingletonBase.
-// 2. template class Singleton.
-// Creation of singletons is a common
-// activity. Use Singleton class to not
-// repeat code every time.
-
-#ifndef OMAHA_COMMON_SINGLETON_H_
-#define OMAHA_COMMON_SINGLETON_H_
-
-#include "omaha/base/debug.h"
-#include "omaha/base/synchronized.h"
-
-
-// Very important design pattern.
-// Singleton class can be used in two ways.
-// 1. Pass the class you want to make into Singleton as a
-//    template parameter.
-//
-//    class SomeClass {
-//     protected:
-//    SomeClass(){}  // note - it is protected
-//    ~SomeClass(){} // note - it is protected
-//    public:
-//    void Foo() {}
-//  };
-//
-//   Singleton<SomeClass> s;
-//   s::Instance()->Foo();
-//
-//     OR
-// 2. You class can be derived from Singleton in a following way:
-//    class SomeClass : public Singleton<SomeClass> {
-//     protected:
-//    SomeClass(){}
-//    ~SomeClass(){}
-//    public:
-//    void Foo() {}
-//  };
-//
-//   SomeClass::Instance()->Foo();
-//
-//  There is no requirement on the class you want to make into
-//  Singleton except is has to have constructor that takes nothing.
-//  As long as the class has void constructor it can become a singleton.
-//  However if you want you class to be trully singleton you have to make
-//  it constructors and destructors protected. Than you can only access your
-//  class through the singlenot interface Instance().
-//  If simple void constructor is not enough for you class, provide some kind of
-//  initialization function, which could be called after the instance is
-// created.
-
-#define kSingletonMutexName               kLockPrefix L"Singleton_Creation_Lock"
-
-#ifdef _DEBUG
-  #define InstanceReturnTypeDeclaration SingletonProxy<T>
-  #define InstanceReturnTypeStatement   SingletonProxy<T>
-#else
-  #define InstanceReturnTypeDeclaration T*
-  #define InstanceReturnTypeStatement
-#endif
-
-template <typename T> class Singleton  {
-  // Caching pointers to Singletons is very dangerous and goes against
-  // Singleton philosophy. So we will return proxy from instance in Debug mode.
-  // In release mode we will not go this route for efficiency.
-  template <typename T> class SingletonProxy {
-    T* data_;
-  public:
-    explicit SingletonProxy(T* data) : data_(data) {}
-    T* operator->() const  {
-      return data_;
-    }
-    SingletonProxy& operator=(const SingletonProxy&);
-  };
-
- public:
-  Singleton() {}
-
-  // Use double-check pattern for efficiency.
-  // TODO(omaha): the pattern is broken on multicore.
-  static InstanceReturnTypeDeclaration Instance() {
-    if(instance_ == NULL) {
-      // We use GLock here since LLock will not give us synchronization and
-      // SimpleLock will create deadlock if one singleton is created in the
-      // constructor of the other singleton.
-      GLock creation_lock;
-      TCHAR mutex_name[MAX_PATH] = {0};
-      wsprintf(mutex_name, L"%s%d",
-               kSingletonMutexName, ::GetCurrentProcessId());
-
-      VERIFY1(creation_lock.Initialize(mutex_name));
-      __mutexScope(creation_lock);
-      if(instance_ == NULL)
-         instance_ = GetInstance();
-    }
-    return InstanceReturnTypeStatement(instance_);
-  }
-
- private:
-  static T* GetInstance() {
-    static MyT my_t;
-    return &my_t;
-  }
-
-  // shared between the same type T.
-  static T * instance_;
-
-  // Needed to access the protected constructor
-  // of a client.
-  class MyT : public T {
-  };
-};
-
-// This instance_ is shared between template of the same type.
-template <typename T>  T* Singleton<T>::instance_ = NULL;
-
-#endif  // OMAHA_COMMON_SINGLETON_H_
diff --git a/base/smart_handle.h b/base/smart_handle.h
deleted file mode 100644
index 154fe04..0000000
--- a/base/smart_handle.h
+++ /dev/null
@@ -1,240 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Classes for automatically closing handles.
-
-#ifndef OMAHA_COMMON_SMART_HANDLE_H_
-#define OMAHA_COMMON_SMART_HANDLE_H_
-
-#include <wincrypt.h>
-
-namespace omaha {
-
-/**
-* Base traits class for handles.
-* This base class provides default implementation for InvalidValue and IsValid
-* @param T  The handle type to be wrapped.
-*/
-template<class T>
-class BaseHandleTraitsT {
- public:
-  // Typedef that is used by this class and derived classes
-  typedef T HandleType;
-
-  // Returns the invalid handle value
-  static HandleType InvalidValue() {
-    return NULL;
-  }
-
-  // Returns true only if the given handle h is invalid
-  static bool IsValid(const HandleType& h) {
-    return h != InvalidValue();
-  }
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(BaseHandleTraitsT);
-};
-
-/**
-* Smart handle class.
-* Offers basic HANDLE functionality such as cast, attach/detach and automatic Close().
-*/
-template<class T, class Traits, class AlternateType = T>
-class HandleT {
- public:
-  // Default constructor.
-  HandleT() : h_(Traits::InvalidValue()) {
-  }
-
-  // Constructor that assumes ownership of the supplied handle
-  explicit HandleT(T h) : h_(h) {
-  }
-
-  // Destructor calls @ref Close()
-  ~HandleT() {
-    Close();
-  }
-
-  // Assumes ownership of the supplied handle,
-  // potentially closing an already held handle.
-  void Attach(T h) {
-    Close();
-    h_ = h;
-  }
-
-  // Transfers ownership to the caller and sets the internal
-  // state to InvalidValue().
-  T Detach() {
-    T h = h_;
-    h_ = Traits::InvalidValue();
-    return h;
-  }
-
-  // Handle accessor
-  T handle() {
-    return h_;
-  }
-
-  // An alternate cast for the handle.
-  // This can be useful for GDI objects that are used
-  // in functions that e.g. accept both HGDIOBJ and HBITMAP.
-  AlternateType alt_type() {
-    return reinterpret_cast<AlternateType>(h_);
-  }
-
-  // Accesses the contained handle
-  operator T() {
-    return h_;
-  }
-
-  T& receive() {
-    ASSERT(!IsValid(), (L"Should only be used for out arguments"));
-    return h_;
-  }
-
-  // @returns true only if the handle is valid as depicted
-  //  by the traits class.
-  bool IsValid() {
-    return Traits::IsValid(h_);
-  }
-
-  // Closes the handle
-  void Close() {
-    if (Traits::IsValid(h_)) {
-      Traits::Close(h_);
-      h_ = Traits::InvalidValue();
-    }
-  }
-
- protected:
-  T h_;
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(HandleT);
-};
-
-
-/*
-* Traits class for a regular Win32 HANDLE.
-*/
-class HandleTraitsWin32Handle : public BaseHandleTraitsT<HANDLE> {
- public:
-  // Calls FindClose to close the handle.
-  static bool Close(HandleType h) {
-    return (::CloseHandle(h) != false);
-  }
-
-  // Returns the invalid handle value
-  static HandleType InvalidValue() {
-    return NULL;  // note that INVALID_HANDLE_VALUE is also an invalid handle
-  }
-
-  // Returns true only if the given handle h is invalid
-  static bool IsValid(const HandleType& h) {
-    return h != InvalidValue() && h != INVALID_HANDLE_VALUE;
-  }
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(HandleTraitsWin32Handle);
-};
-
-/*
-* Traits class for FindXXXFile handles.
-*/
-class HandleTraitsFindHandle : public BaseHandleTraitsT<HANDLE> {
- public:
-  // Calls FindClose to close the handle.
-  static bool Close(HandleType h) {
-    return (::FindClose(h) != false);
-  }
-
-  // Returns the invalid handle value
-  static HandleType InvalidValue() {
-    return INVALID_HANDLE_VALUE;
-  }
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(HandleTraitsFindHandle);
-};
-
-/*
-* Traits for an HMENU.
-*/
-class HandleTraitsHMenu : public BaseHandleTraitsT<HMENU> {
- public:
-  // Calls DestroyMenu to destroy the menu.
-  static bool Close(HandleType h) {
-    return (::DestroyMenu(h) != FALSE);
-  }
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(HandleTraitsHMenu);
-};
-
-/*
-* Traits for an HCRYPTKEY.
-*/
-class HandleTraitsHCryptKey : public BaseHandleTraitsT<HCRYPTKEY> {
- public:
-  static bool Close(HandleType h) {
-    return (::CryptDestroyKey(h) != FALSE);
-  }
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(HandleTraitsHCryptKey);
-};
-
-/*
-* Traits for an HCRYPTHASH.
-*/
-class HandleTraitsHCryptHash : public BaseHandleTraitsT<HCRYPTHASH> {
- public:
-  static bool Close(HandleType h) {
-    return (::CryptDestroyHash(h) != FALSE);
-  }
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(HandleTraitsHCryptHash);
-};
-
-/*
- * Traits for LoadLibrary/FreeLibrary.
- */
-class HandleTraitsLibrary : public BaseHandleTraitsT<HMODULE> {
- public:
-  static bool Close(HandleType h) {
-    return (::FreeLibrary(h) != FALSE);
-  }
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(HandleTraitsLibrary);
-};
-
-
-/*
-* Win32 handle types.  Add new ones here as you need them.
-* Note that GDI handle types should be kept in common/gdi_smart_ptr.h
-* rather than here.
-*/
-typedef HandleT<HANDLE, HandleTraitsWin32Handle> AutoHandle;
-typedef HandleT<HANDLE, HandleTraitsFindHandle> AutoFindHandle;
-typedef HandleT<HMENU, HandleTraitsHMenu> AutoHMenu;
-typedef HandleT<HCRYPTHASH, HandleTraitsHCryptHash> AutoHCryptHash;
-typedef HandleT<HCRYPTKEY, HandleTraitsHCryptKey> AutoHCryptKey;
-typedef HandleT<HINSTANCE, HandleTraitsLibrary> AutoLibrary;
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_SMART_HANDLE_H_
diff --git a/base/sta.cc b/base/sta.cc
deleted file mode 100644
index 86604d4..0000000
--- a/base/sta.cc
+++ /dev/null
@@ -1,353 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/sta.h"
-
-#include <atlbase.h>
-#include <atlwin.h>
-#include "base/scoped_ptr.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/sta_call.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-namespace {
-
-class CallDispatcher;
-
-// ApartmentState maintains the state of the apartment. It keeps a reference
-// to a call dispatcher. The dispatcher is basically a window object that
-// handles user messages corresponding to each call.
-//
-// ApartmentState is a singleton. It's lifetime is controlled by the
-// 'InitializeApartment' and 'UnintializeApartment'.
-//
-// The current implementation is limited to the main STA. Creating multiple
-// apartments in a process is not possible.
-//
-// TODO(omaha): implement a simple reference counting of the threads to make
-// sure the all the calling threads have returned when the apt is destroyed.
-
-class ApartmentState {
- public:
-  ApartmentState(DWORD thread_id, CallDispatcher* call_disp)
-      : thread_id_(thread_id), call_dispatcher_(call_disp) {}
-
-  ~ApartmentState() {
-    ASSERT1(ref_cnt_ == 0);
-  }
-
-  // Initialize the state of the singleton.
-  static HRESULT Initialize(DWORD reserved);
-
-  // Uninitialize the state of the singleton.
-  static HRESULT Uninitialize();
-
-  // Accessors.
-  static ApartmentState* apartment_state() {
-    return apartment_state_;
-  }
-
-  CallDispatcher& call_dispatcher() const {
-    ASSERT(call_dispatcher_.get(),
-      (_T("'InitializeApartment' has not been called.")));
-    return *call_dispatcher_;
-  }
-
-  DWORD thread_id() const {
-    ASSERT(thread_id_,
-      (_T("'InitializeApartment' has not been called.")));
-    return thread_id_;
-  }
-
- private:
-  static int ref_cnt_;    // the reference count of init/uninit.
-
-  const DWORD thread_id_;   // thread that called the InitializeApartment
-  scoped_ptr<CallDispatcher> call_dispatcher_;
-
-  static ApartmentState* apartment_state_;    // the instance of the state
-  DISALLOW_EVIL_CONSTRUCTORS(ApartmentState);
-};
-
-
-// CallDispatcher uses functors to cross call from the caller's thread to
-// this apartment thread (main thread).
-class CallDispatcher
-    : public CWindowImpl<CallDispatcher,
-                         CWindow,
-                         CWinTraits<WS_OVERLAPPED, WS_EX_TOOLWINDOW> > {
- public:
-  explicit CallDispatcher(DWORD options);
-  ~CallDispatcher();
-
-  // Two-phase initialization
-  HRESULT Init();
-
-  // The initiator of the cross call.
-  HRESULT DoCrossApartmentCall(BaseFunctor* caller, void* presult);
-
- private:
-  static const UINT WM_METHOD_CALL = WM_USER + 0x100;
-  static const UINT WM_METHOD_CALL_COMPLETE = WM_USER + 0x101;
-
-  BEGIN_MSG_MAP(CallDispatcher)
-    MESSAGE_HANDLER(WM_METHOD_CALL, OnMethodCall)
-  END_MSG_MAP()
-
- private:
-  LRESULT OnMethodCall(UINT uMsg, WPARAM wParam,
-    LPARAM lParam, BOOL& bHandled);
-
-  DWORD options_;
-
-  // Currently only one option is supported for testing purposes.
-  // It testing mode, this option disables the cross-call mechanism and
-  // directly calls the functor in the same thread as the invoker.
-  static const DWORD kTestingMode = DWORD(-1);
-};
-
-// initialize the static data memebers
-ApartmentState* ApartmentState::apartment_state_ = 0;
-int ApartmentState::ref_cnt_ = 0;
-
-HRESULT ApartmentState::Initialize(DWORD reserved) {
-  CORE_LOG(L3, (_T("[ApartmentState::Initialize]")));
-  ASSERT(ref_cnt_ >= 0, (_T("Apartment Reference Counting")));
-  if (ref_cnt_ < 0) return E_UNEXPECTED;
-
-  DWORD thread_id = ::GetCurrentThreadId();
-  ASSERT1(thread_id);
-
-  if (ref_cnt_ > 0) {
-    ASSERT(apartment_state(), (_T("Apartment State is 0.")));
-    bool same_thread = thread_id == apartment_state()->thread_id();
-    // if initialized multiple times verify the thread identity just in case
-    ASSERT(same_thread, (_T("Wrong Thread.")));
-    if (!same_thread) return E_UNEXPECTED;
-    ++ref_cnt_;
-    return S_OK;
-  }
-
-  ASSERT1(ref_cnt_ == 0);
-
-  // do the initialization of the apartment
-  scoped_ptr<CallDispatcher> call_disp(new CallDispatcher(reserved));
-  RET_IF_FAILED(call_disp->Init());
-  scoped_ptr<ApartmentState> ap_state(
-    new ApartmentState(thread_id, call_disp.get()));
-
-  call_disp.release();
-  ApartmentState::apartment_state_ = ap_state.release();
-
-  ++ref_cnt_;
-  return S_OK;
-}
-
-HRESULT ApartmentState::Uninitialize() {
-  ASSERT(ref_cnt_ > 0, (_T("Apartment Reference Counting")));
-  if (ref_cnt_ <= 0) return E_UNEXPECTED;
-
-  DWORD thread_id = ::GetCurrentThreadId();
-  ASSERT1(thread_id);
-
-  ASSERT(apartment_state(), (_T("Apartment State is 0.")));
-  bool same_thread = thread_id == apartment_state()->thread_id();
-  // verify the thread identity just in case
-  ASSERT(same_thread, (_T("Wrong Thread.")));
-  if (!same_thread) return E_UNEXPECTED;
-
-  if (--ref_cnt_ == 0) {
-    delete ApartmentState::apartment_state();
-    ApartmentState::apartment_state_ = 0;
-  }
-
-  return S_OK;
-}
-
-CallDispatcher::CallDispatcher(DWORD options) : options_(options) {
-  // TODO(omaha): Log
-}
-
-CallDispatcher::~CallDispatcher() {
-  // TODO(omaha): Log
-  if (m_hWnd) {
-    DestroyWindow();
-  }
-}
-
-HRESULT CallDispatcher::Init() {
-  // Create a message-only window for the dispatcher. It is not visible,
-  // has no z-order, cannot be enumerated, and does not receive broadcast
-  // messages. The window simply dispatches messages.
-  const TCHAR kWndName[] = _T("{FFE21900-612E-44a9-8424-3FC71B382E61}");
-  HWND hwnd = Create(HWND_MESSAGE, NULL, kWndName);
-  return hwnd ? S_OK : HRESULT_FROM_WIN32(::GetLastError());
-}
-
-//
-LRESULT CallDispatcher::OnMethodCall(UINT, WPARAM wParam,
-                                     LPARAM result, BOOL&) {
-  CORE_LOG(L6, (_T("[CallDispatcher::OnMethodCall]")));
-
-  ASSERT1(wParam);
-  BaseFunctor& call = *reinterpret_cast<BaseFunctor*>(wParam);
-
-  // presult is non-zero if the method or function has a return type.
-  // presult is zero for void methods and functions.
-
-  void* presult = reinterpret_cast<void*>(result);
-
-  ASSERT(
-    ApartmentState::apartment_state()->thread_id() == ::GetCurrentThreadId(),
-    (_T("Wrong Thread")));
-
-  // the function object virtual call;
-  call(presult);
-
-  bool is_async = call.is_async();
-  // For async calls, do not post a message, because the caller will not be
-  // waiting for the call to complete.
-  if (!is_async &&
-      !::PostThreadMessage(call.thread_id(), WM_METHOD_CALL_COMPLETE, 0, 0)) {
-    DWORD error = ::GetLastError();
-    CORE_LOG(LEVEL_ERROR,
-        (_T("[CallDispatcher::OnMethodCall - PostThreadMessage][%d]"), error));
-    ASSERT(false, (_T("Failed to PostThreadMessage.")));
-
-    // TODO(omaha): raise here.
-  }
-
-  // DO NOT ACCESS THE CALL OBJECT FROM DOWN ON. IN THE CASE OF A SYNCHRONOUS
-  // CALL THE CALL OBJECT MAY HAVE ALREADY DESTROYED.
-
-  if (is_async) {
-    // Auto cleanup of the call object in the case of a async call.
-    delete &call;
-  }
-
-  CORE_LOG(L6, (_T("CallDispatcher::OnMethodCall returns.")));
-  return true;
-}
-
-//
-HRESULT CallDispatcher::DoCrossApartmentCall(BaseFunctor* call,
-                                             void* presult) {
-  CORE_LOG(L6, (_T("[CallDispatcher::DoCrossApartmentCall]")));
-
-  ASSERT(IsWindow(), (_T("The dispatcher must have a window.")));
-  bool is_async = call->is_async();
-  if (options_ == kTestingMode) {
-    (*call)(presult);
-    if (is_async) {
-      // We need to delete the functor as if we were the callee.
-      delete call;
-    }
-    return S_OK;
-  }
-
-  if (!is_async) {
-    // Usually it is a mistake to call a synchronous method from the main STA
-    // to the main STA.
-
-    DWORD thread_id = ApartmentState::apartment_state()->thread_id();
-    ASSERT(thread_id != ::GetCurrentThreadId(), (_T("Wrong Thread")));
-
-    ASSERT(GetWindowThreadID() != ::GetCurrentThreadId(),
-           (_T("DoCrossApartmentCall calling its own thread.")));
-  }
-
-  if (!PostMessage(WM_METHOD_CALL,
-                   reinterpret_cast<WPARAM>(call),
-                   reinterpret_cast<LPARAM>(presult))) {
-    DWORD err = ::GetLastError();
-    CORE_LOG(LEVEL_ERROR,
-        (_T("[CallDispatcher::DoCrossApartmentCall - PostMessage][%d]"), err));
-    ASSERT(false, (_T("Failed to PostMessage.")));
-
-    return HRESULT_FROM_WIN32(err);
-  }
-
-  // Once the call has been made, do not access the state of the functor as
-  // the other end might have already executed the call and delete the functor.
-  // This is true for asyncronous calls but it would not hurt for synchronous
-  // calls as well.
-  call = NULL;
-
-  if (is_async) {
-    // Do not wait for the call to complete. The call will complete at
-    // some time in the future and the call object is going to be cleaned up.
-    return S_OK;
-  }
-
-  // Pump all messages, waiting for WM_METHOD_CALL_COMPLETE or WM_QUIT.
-  MSG msg;
-  SetZero(msg);
-  int ret = 0;
-  while ((ret = ::GetMessage(&msg, 0, 0, 0)) != 0) {
-    if (ret == -1) {
-      DWORD error = ::GetLastError();
-      CORE_LOG(LEVEL_ERROR,
-               (_T("[CallDispatcher::DoCrossApartmentCall - GetMessage][%d]"),
-               error));
-      // TODO(omaha): raise here.
-    }
-
-    if (msg.message == WM_METHOD_CALL_COMPLETE) {
-      break;
-    }
-
-    ::DispatchMessage(&msg);
-  }
-
-  // Repost the WM_QUIT message to properly exit all message loops.
-  if (msg.message == WM_QUIT) {
-    ASSERT1(ret == 0);
-    ::PostQuitMessage(msg.wParam);
-  }
-
-  CORE_LOG(L6, (_T("CallDispatcher::DoCrossApartmentCall returns")));
-  return S_OK;
-}
-
-}  // namespace
-
-void BaseFunctor::DoInvoke(void* presult) {
-  ASSERT(ApartmentState::apartment_state(),
-    (_T("Did you forgot to call 'InitializeApartment'?")));
-
-  CallDispatcher& call_dispatcher =
-    ApartmentState::apartment_state()->call_dispatcher();
-
-  HRESULT hr = call_dispatcher.DoCrossApartmentCall(this, presult);
-
-  if (FAILED(hr)) {
-    ASSERT(false, (_T("Failed to call across apartments.")));
-    // TODO(omaha): log, report, raise.
-  }
-}
-
-HRESULT InitializeApartment(DWORD reserved) {
-  return ApartmentState::Initialize(reserved);
-}
-
-HRESULT UninitializeApartment() {
-  return ApartmentState::Uninitialize();
-}
-
-}  // namespace omaha
-
diff --git a/base/sta.h b/base/sta.h
deleted file mode 100644
index 073f17c..0000000
--- a/base/sta.h
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// STA initializes a custom non-COM Single Threaded Apartment to facilitate
-// calling of functions and object methods in the thread of the STA. This is
-// useful when creating a simple threading model based on a main thread and
-// several worker threads, especially for client components that have a UI or
-// use the COM STA models.
-//
-// The current implementation only supports initializing the main STA, which is
-// the STA created by the main thread of the process. This is usually the UI
-// thread. Having multiple STA in a process is not possible yet.
-//
-// This custom STA does not interfere with the COM STAs.
-//
-// In order for the STA to work properly, the STA thread must keep processing
-// messages and not block, just like in the COM STA case.
-
-#ifndef OMAHA_COMMON_STA_H__
-#define OMAHA_COMMON_STA_H__
-
-#include <windows.h>
-#include "omaha/base/debug.h"
-#include "omaha/base/scoped_any.h"
-
-namespace omaha {
-
-// Initializes the STA apartment. The 'reserved' parameter must be 0.
-// InitializeApartment and UninitializeApartment are reference-counted.
-HRESULT InitializeApartment(DWORD reserved);
-
-// Uninitializes the STA apartment.
-HRESULT UninitializeApartment();
-
-// A scoped_sta smart pointer is provided to manage the calls to
-// InitializeApartment and UninitializeApartment.
-inline HRESULT smart_sta_init_helper(DWORD reserved) {
-  return InitializeApartment(reserved);
-}
-
-inline void smart_uninit_helper(HRESULT result) {
-  if (result == S_OK) {
-    VERIFY1(SUCCEEDED(UninitializeApartment()));
-  }
-}
-
-typedef close_fun<void (*)(HRESULT), smart_uninit_helper> close_sta;
-
-typedef value_const<HRESULT, E_UNEXPECTED> sta_not_init;
-
-typedef scoped_any<HRESULT, close_sta, sta_not_init> scoped_sta_close;
-
-struct scoped_sta {
-  explicit scoped_sta(DWORD reserved)
-      : result_(smart_sta_init_helper(reserved)) {}
-
-  HRESULT result() const { return get(result_); }
-
- private:
-  const scoped_sta_close result_;
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_STA_H__
-
diff --git a/base/sta_call.h b/base/sta_call.h
deleted file mode 100644
index 4727fa9..0000000
--- a/base/sta_call.h
+++ /dev/null
@@ -1,1117 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// sta_call.h generics for cross apartment calling.
-//
-// The code is using compile-time and run-time polymorphism to create
-// type-safe call wrappers that can be used to cross call from a
-// worker thread to an STA thread. The current implementation only
-// supports calling the main STA.
-//
-// Functions as well as object methods can be called.
-//
-// Examples:
-// class X {
-//   public:
-//     int Add(int i, int j) { return i + j; }
-// };
-//
-//
-// namespace {
-//   int Add(long i, long j) { return i + j; }
-// }
-//
-// X x;
-// int sum = CallMethod(&x, X::Add, 10, 20);
-// int j = CallFunction(Add, -10, 10);
-//
-// The central piece of machinery is a hierarchy of functors. A functor is
-// instantiated by a function template (CallFunction or CallMethod) and its
-// 'Invoke' method gets called.
-// Calling 'Invoke' will send the functor using 'SendMessage'
-// to a window. The window message handler picks up the functor and
-// calls the functor virtual operator().
-// This virtual call is what actually calls the specified function or the
-// method, the only difference being that the call is now made in a thread
-// different than the thread that called 'Invoke'. There is a partial
-// specialization of the templates for void, so that void type is supported
-// as a return type.
-//
-//
-// !!! Limitations !!!
-//
-// There are a few important design and implementation limitations. They are
-// mostly related to template parameters ambiguities (T or T&) especially
-// for overloaded names or const types. The limitations are significant although
-// the code is useful enough as it is in most of the cases.
-// However, when using the code it is frustrating to discover that it does not
-// compile for obvious and useful cases, a constant reminder that a better
-// solution is to be seeked.
-//
-//
-// The implementation does not support calling all 'stdcall' calling convention.
-//
-// The design does not support calling functions or methods that use pass by
-// reference arguments: f(std::string&) .
-//
-// The design does not support well calling functions or methods that take
-// pointer to const types parameters : f(const std::string*) .
-//
-// The implementation does not support calling methods of const objects.
-//
-// To reduce the number of templates that get instantiated, the types of the
-// arguments of the call must match exactly the types of parameters of the
-// function or method . In some cases static_casts mey be required
-// at the point of the call. Example: CallMethod(f, static_cast<long>(10));
-
-#ifndef OMAHA_COMMON_STA_CALL_H__
-#define OMAHA_COMMON_STA_CALL_H__
-
-#include "base/scoped_ptr.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-
-namespace omaha {
-
-// C4347: 'function template' is called instead of 'function'
-#pragma warning(disable : 4347)
-
-// The Base Functor is the base of the functor hierarchy.
-class BaseFunctor {
- public:
-  explicit BaseFunctor(bool is_async) :
-      thread_id_(::GetCurrentThreadId()),
-      is_async_(is_async) {
-    CORE_LOG(L6, (_T("[BaseFunctor::BaseFunctor]")));
-  }
-
-  // Functors are polymorphic objects.
-  virtual ~BaseFunctor() {
-    CORE_LOG(L6, (_T("[BaseFunctor::~BaseFunctor]")));
-  }
-
-  // Abstract virtual function call operator. This is always called
-  // in the callee thread by the dispatcher of the apartment.
-  virtual void operator()(void* presult) = 0;
-
-  // The thread id of the calling thread.
-  DWORD thread_id() const { return thread_id_; }
-
-  bool is_async() const { return is_async_; }
-
- protected:
-
-  // Invoke is called by each of the derived functors. This is how
-  // the  cross thread invocation is made and the result of the invocation
-  // is retrieved. Invoke is always called in the caller thread.
-  template <typename R>
-  R Invoke() {
-    R r = R();      // ensure r is initialized even for primitive types.
-    if (!is_async_) {
-      DoInvoke(&r);
-    } else {
-      // We handle the async calls as if the call returns void.
-      DoInvoke(0);
-    }
-    return r;
-  }
-
-  // non-template method to be called by the derived functors
-  // specialized for void.
-  void Invoke() {
-    // When the argument of the invocation is 0, we are not
-    // interested in the result.
-    DoInvoke(0);
-  }
-
- private:
-  void DoInvoke(void* presult);   // Does the actual invocation.
-  DWORD thread_id_;               // The thread id of the calling thread.
-  bool is_async_;                 // True for async calls.
-
-  DISALLOW_EVIL_CONSTRUCTORS(BaseFunctor);
-};
-
-//
-// 0-ary method functor.
-//
-template <class T, typename R>
-class MethodFunctor0 : public BaseFunctor {
- public:
-  MethodFunctor0(bool is_async, T* pt, R (T::*pm)()) :
-      BaseFunctor(is_async), pobj_(pt), pm_(pm) {}
-
-  virtual void operator()(void* presult) {
-    ASSERT(pobj_, (_T("Null object.")));
-    if (presult) {
-      *static_cast<R*>(presult) = (pobj_->*pm_)();
-    } else {
-      (pobj_->*pm_)();
-    }
-  }
-
-  R Invoke() {
-    // Don't forget to call the base implementation.
-    return BaseFunctor::Invoke<R>();
-  }
-
- private:
-  T* pobj_;
-  R (T::*pm_)();
-};
-
-//
-// 0-ary partial specialization for void return types.
-//
-template <class T>
-class MethodFunctor0<T, void> : public BaseFunctor {
- public:
-  MethodFunctor0(bool is_async, T* pt, void (T::*pm)()) :
-      BaseFunctor(is_async), pobj_(pt), pm_(pm) {}
-
-  virtual void operator()(void* presult) {
-    ASSERT(pobj_, (_T("Null object.")));
-    ASSERT1(!presult);
-    presult;  //  unreferenced formal parameter
-
-    // the actual call. There is no return value when the return type is void.
-    (pobj_->*pm_)();
-  }
-
-  // Bring in the name from the Base
-  using BaseFunctor::Invoke;
-
- private:
-  T* pobj_;
-  void (T::*pm_)();
-};
-
-//
-// 0-ary functor and specialization for void.
-//
-template <typename R>
-class Functor0 : public BaseFunctor {
- public:
-  Functor0(bool is_async, R (*pf)()) :
-      BaseFunctor(is_async), pf_(pf) {}
-
-  virtual void operator()(void* presult) {
-    if (presult) {
-      *static_cast<R*>(presult) = (*pf_)();
-    } else {
-      (*pf_)();
-    }
-  }
-
-  R Invoke() {
-    return BaseFunctor::Invoke<R>();
-  }
-
- private:
-  R (*pf_)();
-};
-
-template <>
-class Functor0<void> : public BaseFunctor {
- public:
-  Functor0(bool is_async, void (*pf)()) :
-      BaseFunctor(is_async), pf_(pf) {}
-
-  virtual void operator()(void* presult) {
-    ASSERT1(!presult);
-    presult;  // unreferenced formal parameter
-
-    (*pf_)();
-  }
-
-  using BaseFunctor::Invoke;
-
- private:
-  void (*pf_)();
-};
-
-
-//
-// 1-ary
-//
-template <class T, typename R, typename P>
-class MethodFunctor1 : public BaseFunctor {
- public:
-  MethodFunctor1(bool is_async, T* pt, R (T::*pm)(P), P p) :
-      BaseFunctor(is_async), pobj_(pt), pm_(pm), p_(p) {}
-
-  virtual void operator()(void* presult) {
-    ASSERT(pobj_, (_T("Null object.")));
-    if (presult) {
-      *static_cast<R*>(presult) = (pobj_->*pm_)(p_);
-    } else {
-      (pobj_->*pm_)(p_);
-    }
-  }
-
-  R Invoke() {
-    return BaseFunctor::Invoke<R>();
-  }
-
- private:
-  T* pobj_;
-  R (T::*pm_)(P);
-  P p_;
-};
-
-template <class T, typename P>
-class MethodFunctor1<T, void, P> : public BaseFunctor {
- public:
-  MethodFunctor1(bool is_async, T* pt, void (T::*pm)(P), P p) :
-      BaseFunctor(is_async), pobj_(pt), pm_(pm), p_(p) {}
-
-  virtual void operator()(void* presult) {
-    ASSERT(pobj_, (_T("Null object.")));
-    ASSERT1(!presult);
-    presult;  //  unreferenced formal parameter
-
-    (pobj_->*pm_)(p_);
-  }
-
-  using BaseFunctor::Invoke;
-
- private:
-  T* pobj_;
-  void (T::*pm_)(P);
-  P p_;
-};
-
-template <typename R, typename P1>
-class Functor1 : public BaseFunctor {
- public:
-  Functor1(bool is_async, R (*pf)(P1), P1 p1) :
-      BaseFunctor(is_async), pf_(pf), p1_(p1) {}
-
-  virtual void operator()(void* presult) {
-    if (presult) {
-      *static_cast<R*>(presult) = (*pf_)(p1_);
-    } else {
-      (*pf_)(p1_);
-    }
-  }
-
-  R Invoke() {
-    return BaseFunctor::Invoke<R>();
-  }
-
- private:
-  R (*pf_)(P1);
-  P1 p1_;
-};
-
-template <typename P1>
-class Functor1<void, P1> : public BaseFunctor {
- public:
-  Functor1(bool is_async, void (*pf)(P1), P1 p1) :
-      BaseFunctor(is_async), pf_(pf), p1_(p1) {}
-
-  virtual void operator()(void* presult) {
-    ASSERT1(!presult);
-    presult;  //  unreferenced formal parameter
-
-    (*pf_)(p1_);
-  }
-
-  using BaseFunctor::Invoke;
-
- private:
-  void (*pf_)(P1);
-  P1 p1_;
-};
-
-
-//
-// 2-ary
-//
-template <class T, typename R, typename P1, typename P2>
-class MethodFunctor2 : public BaseFunctor {
- public:
-  MethodFunctor2(bool is_async, T* pt, R (T::*pm)(P1, P2), P1 p1, P2 p2) :
-      BaseFunctor(is_async), pobj_(pt), pm_(pm), p1_(p1), p2_(p2) {}
-
-  virtual void operator()(void* presult) {
-    ASSERT(pobj_, (_T("Null object.")));
-    if (presult) {
-      *static_cast<R*>(presult) = (pobj_->*pm_)(p1_, p2_);
-    } else {
-      (pobj_->*pm_)(p1_, p2_);
-    }
-  }
-
-  R Invoke() {
-    return BaseFunctor::Invoke<R>();
-  }
-
- private:
-  T* pobj_;
-  R (T::*pm_)(P1, P2);
-  P1 p1_;
-  P2 p2_;
-};
-
-template <class T, typename P1, typename P2>
-class MethodFunctor2<T, void, P1, P2> : public BaseFunctor {
- public:
-  MethodFunctor2(bool is_async, T* pt, void (T::*pm)(P1, P2), P1 p1, P2 p2) :
-      BaseFunctor(is_async), pobj_(pt), pm_(pm), p1_(p1), p2_(p2) {}
-
-  virtual void operator()(void* presult) {
-    ASSERT(pobj_, (_T("Null object.")));
-    ASSERT1(!presult);
-    presult;  //  unreferenced formal parameter
-
-    (pobj_->*pm_)(p1_, p2_);
-  }
-
-  using BaseFunctor::Invoke;
-
- private:
-  T* pobj_;
-  void (T::*pm_)(P1, P2);
-  P1 p1_;
-  P2 p2_;
-};
-
-template <typename R, typename P1, typename P2>
-class Functor2 : public BaseFunctor {
- public:
-  Functor2(bool is_async, R (*pf)(P1, P2), P1 p1, P2 p2) :
-      BaseFunctor(is_async), pf_(pf), p1_(p1), p2_(p2) {}
-
-  virtual void operator()(void* presult) {
-    if (presult) {
-      *static_cast<R*>(presult) = pf_(p1_, p2_);
-    } else {
-      pf_(p1_, p2_);
-    }
-  }
-
-  R Invoke() {
-    return BaseFunctor::Invoke<R>();
-  }
-
- private:
-  R (*pf_)(P1, P2);
-  P1 p1_;
-  P2 p2_;
-};
-
-template <typename P1, typename P2>
-class Functor2<void, P1, P2> : public BaseFunctor {
- public:
-  Functor2(bool is_async, void (*pf)(P1, P2), P1 p1, P2 p2) :
-      BaseFunctor(is_async), pf_(pf), p1_(p1), p2_(p2) {}
-
-  virtual void operator()(void* presult) {
-    ASSERT1(!presult);
-    presult;  //  unreferenced formal parameter
-
-    (*pf_)(p1_, p2_);
-  }
-
-  using BaseFunctor::Invoke;
-
- private:
-  void (*pf_)(P1, P2);
-  P1 p1_;
-  P2 p2_;
-};
-
-//
-// 3-ary
-//
-template <class T, typename R, typename P1, typename P2, typename P3>
-class MethodFunctor3 : public BaseFunctor {
- public:
-  MethodFunctor3(bool is_async,
-                 T* pt,
-                 R (T::*pm)(P1, P2, P3),
-                 P1 p1,
-                 P2 p2,
-                 P3 p3) :
-      BaseFunctor(is_async), pobj_(pt), pm_(pm), p1_(p1), p2_(p2), p3_(p3) {}
-
-  virtual void operator()(void* presult) {
-    ASSERT(pobj_, (_T("Null object.")));
-    if (presult) {
-      *static_cast<R*>(presult) = (pobj_->*pm_)(p1_, p2_, p3_);
-    } else {
-      (pobj_->*pm_)(p1_, p2_, p3_);
-    }
-  }
-
-  R Invoke() {
-    return BaseFunctor::Invoke<R>();
-  }
-
- private:
-  T* pobj_;
-  R (T::*pm_)(P1, P2, P3);
-  P1 p1_;
-  P2 p2_;
-  P3 p3_;
-};
-
-template <class T, typename P1, typename P2, typename P3>
-class MethodFunctor3<T, void, P1, P2, P3> : public BaseFunctor {
- public:
-  MethodFunctor3(bool is_async,
-                 T* pt,
-                 void (T::*pm)(P1, P2, P3),
-                 P1 p1,
-                 P2 p2,
-                 P3 p3) :
-      BaseFunctor(is_async), pobj_(pt), pm_(pm), p1_(p1), p2_(p2), p3_(p3) {}
-
-  virtual void operator()(void* presult) {
-    ASSERT(pobj_, (_T("Null object.")));
-    ASSERT1(!presult);
-    presult;  //  unreferenced formal parameter
-
-    (pobj_->*pm_)(p1_, p2_, p3_);
-  }
-
-  using BaseFunctor::Invoke;
-
- private:
-  T* pobj_;
-  void (T::*pm_)(P1, P2, P3);
-  P1 p1_;
-  P2 p2_;
-  P3 p3_;
-};
-
-
-template <typename R, typename P1, typename P2, typename P3>
-class Functor3 : public BaseFunctor {
- public:
-  Functor3(bool is_async, R (*pf)(P1, P2, P3), P1 p1, P2 p2, P3 p3) :
-      BaseFunctor(is_async), pf_(pf), p1_(p1), p2_(p2), p3_(p3) {}
-  virtual void operator()(void* presult) {
-    if (presult) {
-      *static_cast<R*>(presult) = (*pf_)(p1_, p2_, p3_);
-    } else {
-      (*pf_)(p1_, p2_, p3_);
-    }
-  }
-
-  R Invoke() {
-    return BaseFunctor::Invoke<R>();
-  }
-
- private:
-  R (*pf_)(P1, P2, P3);
-  P1 p1_;
-  P2 p2_;
-  P3 p3_;
-};
-
-template <typename P1, typename P2, typename P3>
-class Functor3<void, P1, P2, P3> : public BaseFunctor {
- public:
-  Functor3(bool is_async, void (*pf)(P1, P2, P3), P1 p1, P2 p2, P3 p3) :
-      BaseFunctor(is_async), pf_(pf), p1_(p1), p2_(p2), p3_(p3) {}
-
-  virtual void operator()(void* presult) {
-    ASSERT1(!presult);
-    presult;  //  unreferenced formal parameter
-
-    (*pf_)(p1_, p2_, p3_);
-  }
-
-  using BaseFunctor::Invoke;
-
- private:
-  void (*pf_)(P1, P2, P3);
-  P1 p1_;
-  P2 p2_;
-  P3 p3_;
-};
-
-//
-// 4-ary
-//
-template <class T,
-          typename R,
-          typename P1,
-          typename P2,
-          typename P3,
-          typename P4>
-class MethodFunctor4 : public BaseFunctor {
- public:
-  MethodFunctor4(bool is_async,
-                 T* pt,
-                 R (T::*pm)(P1, P2, P3, P4),
-                 P1 p1,
-                 P2 p2,
-                 P3 p3,
-                 P4 p4) :
-      BaseFunctor(is_async),
-      pobj_(pt),
-      pm_(pm),
-      p1_(p1),
-      p2_(p2),
-      p3_(p3),
-      p4_(p4) {}
-
-  virtual void operator()(void* presult) {
-    ASSERT(pobj_, (_T("Null object.")));
-    if (presult) {
-      *static_cast<R*>(presult) = (pobj_->*pm_)(p1_, p2_, p3_, p4_);
-    } else {
-      (pobj_->*pm_)(p1_, p2_, p3_, p4_);
-    }
-  }
-
-  R Invoke() {
-    return BaseFunctor::Invoke<R>();
-  }
-
- private:
-  T* pobj_;
-  R (T::*pm_)(P1, P2, P3, P4);
-  P1 p1_;
-  P2 p2_;
-  P3 p3_;
-  P4 p4_;
-};
-
-template <class T, typename P1, typename P2, typename P3, typename P4>
-class MethodFunctor4<T, void, P1, P2, P3, P4> : public BaseFunctor {
- public:
-  MethodFunctor4(bool is_async,
-                 T* pt,
-                 void (T::*pm)(P1, P2, P3, P4),
-                 P1 p1,
-                 P2 p2,
-                 P3 p3,
-                 P4 p4) :
-      BaseFunctor(is_async),
-      pobj_(pt),
-      pm_(pm),
-      p1_(p1),
-      p2_(p2),
-      p3_(p3),
-      p4_(p4) {}
-
-  virtual void operator()(void* presult) {
-    ASSERT(pobj_, (_T("Null object.")));
-    ASSERT1(!presult);
-    presult;  //  unreferenced formal parameter
-
-    (pobj_->*pm_)(p1_, p2_, p3_, p4_);
-  }
-
-  using BaseFunctor::Invoke;
-
- private:
-  T* pobj_;
-  void (T::*pm_)(P1, P2, P3, P4);
-  P1 p1_;
-  P2 p2_;
-  P3 p3_;
-  P4 p4_;
-};
-
-
-template <typename R, typename P1, typename P2, typename P3, typename P4>
-class Functor4 : public BaseFunctor {
- public:
-  Functor4(bool is_async, R (*pf)(P1, P2, P3, P4), P1 p1, P2 p2, P3 p3, P4 p4) :
-      BaseFunctor(is_async), pf_(pf), p1_(p1), p2_(p2), p3_(p3), p4_(p4) {}
-
-  virtual void operator()(void* presult) {
-    if (presult) {
-      *static_cast<R*>(presult) = (*pf_)(p1_, p2_, p3_, p4_);
-    } else {
-      (*pf_)(p1_, p2_, p3_, p4_);
-    }
-  }
-
-  R Invoke() {
-    return BaseFunctor::Invoke<R>();
-  }
-
- private:
-  R (*pf_)(P1, P2, P3, P4);
-  P1 p1_;
-  P2 p2_;
-  P3 p3_;
-  P4 p4_;
-};
-
-template <typename P1, typename P2, typename P3, typename P4>
-class Functor4<void, P1, P2, P3, P4> : public BaseFunctor {
- public:
-  Functor4(bool is_async,
-           void (*pf)(P1, P2, P3, P4),
-           P1 p1,
-           P2 p2,
-           P3 p3,
-           P4 p4) :
-      BaseFunctor(is_async), pf_(pf), p1_(p1), p2_(p2), p3_(p3), p4_(p4) {}
-
-  virtual void operator()(void* presult) {
-    ASSERT1(!presult);
-    presult;  //  unreferenced formal parameter
-
-    (*pf_)(p1_, p2_, p3_, p4_);
-  }
-
-  using BaseFunctor::Invoke;
-
- private:
-  void (*pf_)(P1, P2, P3, P4);
-  P1 p1_;
-  P2 p2_;
-  P3 p3_;
-  P4 p4_;
-};
-
-//
-// 5-ary
-//
-template <class T,
-          typename R,
-          typename P1,
-          typename P2,
-          typename P3,
-          typename P4,
-          typename P5>
-class MethodFunctor5 : public BaseFunctor {
- public:
-  MethodFunctor5(bool is_async,
-                 T* pt,
-                 R (T::*pm)(P1, P2, P3, P4, P5),
-                 P1 p1,
-                 P2 p2,
-                 P3 p3,
-                 P4 p4,
-                 P5 p5) :
-      BaseFunctor(is_async),
-      pobj_(pt),
-      pm_(pm),
-      p1_(p1),
-      p2_(p2),
-      p3_(p3),
-      p4_(p4),
-      p5_(p5) {}
-
-  virtual void operator()(void* presult) {
-    ASSERT(pobj_, (_T("Null object.")));
-    if (presult) {
-      *static_cast<R*>(presult) = (pobj_->*pm_)(p1_, p2_, p3_, p4_, p5_);
-    } else {
-      (pobj_->*pm_)(p1_, p2_, p3_, p4_, p5_);
-    }
-  }
-
-  R Invoke() {
-    return BaseFunctor::Invoke<R>();
-  }
-
- private:
-  T* pobj_;
-  R (T::*pm_)(P1, P2, P3, P4, P5);
-  P1 p1_;
-  P2 p2_;
-  P3 p3_;
-  P4 p4_;
-  P5 p5_;
-};
-
-template <class T,
-          typename P1,
-          typename P2,
-          typename P3,
-          typename P4,
-          typename P5>
-class MethodFunctor5<T, void, P1, P2, P3, P4, P5> : public BaseFunctor {
- public:
-  MethodFunctor5(bool is_async,
-                 T* pt,
-                 void (T::*pm)(P1, P2, P3, P4, P5),
-                 P1 p1,
-                 P2 p2,
-                 P3 p3,
-                 P4 p4,
-                 P5 p5) :
-      BaseFunctor(is_async),
-      pobj_(pt),
-      pm_(pm),
-      p1_(p1),
-      p2_(p2),
-      p3_(p3),
-      p4_(p4),
-      p5_(p5) {}
-
-  virtual void operator()(void* presult) {
-    ASSERT(pobj_, (_T("Null object.")));
-    ASSERT1(!presult);
-    presult;  //  unreferenced formal parameter
-
-    (pobj_->*pm_)(p1_, p2_, p3_, p4_, p5_);
-  }
-
-  using BaseFunctor::Invoke;
-
- private:
-  T* pobj_;
-  void (T::*pm_)(P1, P2, P3, P4, P5);
-  P1 p1_;
-  P2 p2_;
-  P3 p3_;
-  P4 p4_;
-  P5 p5_;
-};
-
-template <typename R,
-          typename P1,
-          typename P2,
-          typename P3,
-          typename P4,
-          typename P5>
-class Functor5 : public BaseFunctor {
- public:
-  Functor5(bool is_async,
-           R (*pf)(P1, P2, P3, P4, P5),
-           P1 p1,
-           P2 p2,
-           P3 p3,
-           P4 p4,
-           P5 p5) :
-      BaseFunctor(is_async),
-      pf_(pf),
-      p1_(p1),
-      p2_(p2),
-      p3_(p3),
-      p4_(p4),
-      p5_(p5) {}
-  virtual void operator()(void* presult) {
-    if (presult) {
-      *static_cast<R*>(presult) = (*pf_)(p1_, p2_, p3_, p4_, p5_);
-    } else {
-      (*pf_)(p1_, p2_, p3_, p4_, p5_);
-    }
-  }
-
-  R Invoke() {
-    return BaseFunctor::Invoke<R>();
-  }
-
- private:
-  R (*pf_)(P1, P2, P3, P4, P5);
-  P1 p1_;
-  P2 p2_;
-  P3 p3_;
-  P4 p4_;
-  P5 p5_;
-};
-
-template <typename P1, typename P2, typename P3, typename P4, typename P5>
-class Functor5<void, P1, P2, P3, P4, P5> : public BaseFunctor {
- public:
-  Functor5(bool is_async,
-           void (*pf)(P1, P2, P3, P4, P5),
-           P1 p1,
-           P2 p2,
-           P3 p3,
-           P4 p4,
-           P5 p5) :
-      BaseFunctor(is_async),
-      pf_(pf),
-      p1_(p1),
-      p2_(p2),
-      p3_(p3),
-      p4_(p4),
-      p5_(p5) {}
-
-  virtual void operator()(void* presult) {
-    ASSERT1(!presult);
-    presult;  //  unreferenced formal parameter
-
-    (*pf_)(p1_, p2_, p3_, p4_, p5_);
-  }
-
-  using BaseFunctor::Invoke;
-
- private:
-  void (*pf_)(P1, P2, P3, P4, P5);
-  P1 p1_;
-  P2 p2_;
-  P3 p3_;
-  P4 p4_;
-  P5 p5_;
-};
-
-
-// This is what the clients of the STA code instantiate and call.
-//
-// Synchronous Callers.
-//
-template <class T, typename R>
-R CallMethod(T* object, R (T::*pm)()) {
-  return MethodFunctor0<T, R>(false, object, pm).Invoke();
-}
-
-template <typename R>
-R CallFunction(R (*pf)()) {
-  return Functor0<R>(false, pf).Invoke();
-}
-
-template <class T, typename R, typename P>
-R CallMethod(T* object, R (T::*pm)(P), P p) {
-  return MethodFunctor1<T, R, P>(false, object, pm, p).Invoke();
-}
-
-template <typename R, typename P>
-R CallFunction(R (*pf)(P), P p) {
-  return Functor1<R, P>(false, pf, p).Invoke();
-}
-
-template <class T, typename R, typename P1, typename P2>
-R CallMethod(T* object, R (T::*pm)(P1, P2), P1 p1, P2 p2) {
-  return MethodFunctor2<T, R, P1, P2>(false, object, pm, p1, p2).Invoke();
-}
-
-template <typename R, typename P1, typename P2>
-R CallFunction(R (*pf)(P1, P2), P1 p1, P2 p2) {
-  return Functor2<R, P1, P2>(false, pf, p1, p2).Invoke();
-}
-
-template <class T, typename R, typename P1, typename P2, typename P3>
-R CallMethod(T* object, R (T::*pm)(P1, P2, P3), P1 p1, P2 p2, P3 p3) {
-  return MethodFunctor3<T, R, P1, P2, P3>(false,
-                                          object, pm, p1, p2, p3).Invoke();
-}
-
-template <typename R, typename P1, typename P2, typename P3>
-R CallFunction(R (*pf)(P1, P2, P3), P1 p1, P2 p2, P3 p3) {
-  return Functor3<R, P1, P2, P3>(false, pf, p1, p2, p3).Invoke();
-}
-
-template <class T,
-          typename R,
-          typename P1,
-          typename P2,
-          typename P3,
-          typename P4>
-R CallMethod(T* object,
-             R (T::*pm)(P1, P2, P3, P4),
-             P1 p1,
-             P2 p2,
-             P3 p3,
-             P4 p4) {
-  return MethodFunctor4<T, R, P1, P2, P3, P4>(false,
-                                              object,
-                                              pm,
-                                              p1,
-                                              p2,
-                                              p3,
-                                              p4).Invoke();
-}
-
-template <typename R, typename P1, typename P2, typename P3, typename P4>
-R CallFunction(R (*pf)(P1, P2, P3, P4), P1 p1, P2 p2, P3 p3, P4 p4) {
-  return Functor4<R, P1, P2, P3, P4>(false, pf, p1, p2, p3, p4).Invoke();
-}
-
-template <class T,
-          typename R,
-          typename P1,
-          typename P2,
-          typename P3,
-          typename P4,
-          typename P5>
-R CallMethod(T* object,
-             R (T::*pm)(P1, P2, P3, P4, P5),
-             P1 p1,
-             P2 p2,
-             P3 p3,
-             P4 p4,
-             P5 p5) {
-  return MethodFunctor5<T, R, P1, P2, P3, P4, P5>(false,
-                                                  object,
-                                                  pm,
-                                                  p1,
-                                                  p2,
-                                                  p3,
-                                                  p4,
-                                                  p5).Invoke();
-}
-
-template <typename R,
-          typename P1,
-          typename P2,
-          typename P3,
-          typename P4,
-          typename P5>
-R CallFunction(R (*pf)(P1, P2, P3, P4, P5), P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {
-  return Functor5<R, P1, P2, P3, P4, P5>(false,
-                                         pf,
-                                         p1,
-                                         p2,
-                                         p3,
-                                         p4,
-                                         p5).Invoke();
-}
-
-//
-// Asynchronous Callers.
-//
-template <class T, typename R>
-void CallMethodAsync(T* object, R (T::*pm)()) {
-  scoped_ptr<MethodFunctor0<T, R> > fun(
-      new MethodFunctor0<T, R>(true, object, pm));
-  fun->Invoke();
-  fun.release();
-}
-
-template <typename R>
-void CallFunctionAsync(R (*pf)()) {
-  scoped_ptr<Functor0<R> > fun(new Functor0<R>(true, pf));
-  fun->Invoke();
-  fun.release();
-}
-
-template <class T, typename R, typename P>
-void CallMethodAsync(T* object, R (T::*pm)(P), P p) {
-  scoped_ptr<MethodFunctor1<T, R, P> > fun(
-      new MethodFunctor1<T, R, P>(true, object, pm, p));
-  fun->Invoke();
-  fun.release();
-}
-
-template <typename R, typename P>
-void CallFunctionAsync(R (*pf)(P), P p) {
-  scoped_ptr<Functor1<R, P> > fun(new Functor1<R, P>(true, pf, p));
-  fun->Invoke();
-  fun.release();
-}
-
-template <class T, typename R, typename P1, typename P2>
-void CallMethodAsync(T* object, R (T::*pm)(P1, P2), P1 p1, P2 p2) {
-  scoped_ptr<MethodFunctor2<T, R, P1, P2> > fun(
-      new MethodFunctor2<T, R, P1, P2>(true, object, pm, p1, p2));
-  fun->Invoke();
-  fun.release();
-}
-
-template <typename R, typename P1, typename P2>
-void CallFunctionAsync(R (*pf)(P1, P2), P1 p1, P2 p2) {
-  scoped_ptr<Functor2<R, P1, P2> > fun(
-      new Functor2<R, P1, P2>(true, pf, p1, p2));
-  fun->Invoke();
-  fun.release();
-}
-
-template <class T, typename R, typename P1, typename P2, typename P3>
-void CallMethodAsync(T* object, R (T::*pm)(P1, P2, P3), P1 p1, P2 p2, P3 p3) {
-  scoped_ptr<MethodFunctor3<T, R, P1, P2, P3> > fun(
-      new MethodFunctor3<T, R, P1, P2, P3>(true, object, pm, p1, p2, p3));
-  fun->Invoke();
-  fun.release();
-}
-
-template <typename R, typename P1, typename P2, typename P3>
-void CallFunctionAsync(R (*pf)(P1, P2, P3), P1 p1, P2 p2, P3 p3) {
-  scoped_ptr<Functor3<R, P1, P2, P3> > fun(
-      new Functor3<R, P1, P2, P3>(true, pf, p1, p2, p3));
-  fun->Invoke();
-  fun.release();
-}
-
-template <class T,
-          typename R,
-          typename P1,
-          typename P2,
-          typename P3,
-          typename P4>
-void CallMethodAsync(T* obj,
-                     R (T::*pm)(P1, P2, P3, P4),
-                     P1 p1,
-                     P2 p2,
-                     P3 p3,
-                     P4 p4) {
-  scoped_ptr<MethodFunctor4<T, R, P1, P2, P3, P4> > fun(
-      new MethodFunctor4<T, R, P1, P2, P3, P4>(true, obj, pm, p1, p2, p3, p4));
-  fun->Invoke();
-  fun.release();
-}
-
-template <typename R, typename P1, typename P2, typename P3, typename P4>
-void CallFunctionAsync(R (*pf)(P1, P2, P3, P4), P1 p1, P2 p2, P3 p3, P4 p4) {
-  scoped_ptr<Functor4<R, P1, P2, P3, P4> > fun(
-      new Functor4<R, P1, P2, P3, P4>(true, pf, p1, p2, p3, p4));
-  fun->Invoke();
-  fun.release();
-}
-
-template <class T,
-          typename R,
-          typename P1,
-          typename P2,
-          typename P3,
-          typename P4,
-          typename P5>
-void CallMethodAsync(T* object,
-                     R (T::*pm)(P1, P2, P3, P4, P5),
-                     P1 p1,
-                     P2 p2,
-                     P3 p3,
-                     P4 p4,
-                     P5 p5) {
-  scoped_ptr<MethodFunctor5<T, R, P1, P2, P3, P4, P5> > fun(
-      new MethodFunctor5<T, R, P1, P2, P3, P4, P5>(true,
-                                                   object,
-                                                   pm,
-                                                   p1,
-                                                   p2,
-                                                   p3,
-                                                   p4,
-                                                   p5));
-  fun->Invoke();
-  fun.release();
-}
-
-template <typename R,
-          typename P1,
-          typename P2,
-          typename P3,
-          typename P4,
-          typename P5>
-void CallFunctionAsync(R (*pf)(P1, P2, P3, P4, P5),
-                       P1 p1,
-                       P2 p2,
-                       P3 p3,
-                       P4 p4,
-                       P5 p5) {
-  scoped_ptr<Functor5<R, P1, P2, P3, P4, P5> > fun(
-      new Functor5<R, P1, P2, P3, P4, P5>(true, pf, p1, p2, p3, p4, p5));
-  fun->Invoke();
-  fun.release();
-}
-
-#pragma warning(default : 4347)
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_STA_CALL_H__
-
diff --git a/base/sta_unittest.cc b/base/sta_unittest.cc
deleted file mode 100644
index e7a000f..0000000
--- a/base/sta_unittest.cc
+++ /dev/null
@@ -1,288 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include <atlstr.h>
-#include "omaha/base/sta.h"
-#include "omaha/base/sta_call.h"
-#include "omaha/base/thread.h"
-#include "omaha/base/utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-class X {
- public:
-  void f() {}
-  void f(int) {}
-  void f(unsigned int, X*) {}
-  void f(bool, char, long*) {}
-
-  static void g() {}
-  static void g(int) {}
-  static void g(unsigned int, X*) {}
-  static void g(bool, char, long*) {}
-};
-
-class Y {
- public:
-  HRESULT f() { return S_OK; }
-  HRESULT f(int) { return S_OK; }
-  HRESULT f(unsigned int, X*) { return S_OK; }
-  HRESULT f(bool, char, long*) { return S_OK; }
-
-  static HRESULT g() { return S_OK; }
-  static HRESULT g(int) { return S_OK; }
-  static HRESULT g(unsigned int, X*) { return S_OK; }
-  static HRESULT g(bool, char, long*) { return S_OK; }
-};
-
-class Z {
- public:
-  void f(char, signed char, unsigned char) {}
-
-  void f(Y*) {}
-  // void f(const Y*) {} // not supported !!!
-
-  void m() {}
-  void m() const {}
-};
-
-class Test {
- public:
-  int Add(int i, int j) { return i + j; }
-  void Add(int i, int j, int* sum) { *sum = i + j; }
-};
-
-int Add(long i, long j) { return i + j; }
-void Add(long i, long j, long* sum) { *sum = i + j; }
-
-void Print(const char*) {}
-void Print1(CString*) {}
-
-}  // namespace
-
-class CompileTest : public Runnable {
- protected:
-  virtual void Run();
-};
-
-void CompileTest::Run() {
-  X x;
-  Y y;
-
-  CallFunction(X::g);
-  CallFunction(X::g, 10);
-  CallFunction(X::g, static_cast<unsigned int>(10), &x);
-  CallFunction(X::g, true, 'a', static_cast<long*>(0));
-
-  CallFunction(Y::g);
-  CallFunction(Y::g, 10);
-  CallFunction(Y::g, static_cast<unsigned int>(10), &x);
-  CallFunction(Y::g, true, 'a', static_cast<long*>(0));
-
-  CallMethod(&x, &X::f);
-  CallMethod(&x, &X::f, 10);
-  CallMethod(&x, &X::f, static_cast<unsigned int>(10), &x);
-  CallMethod(&x, &X::f, true, 'a', static_cast<long*>(0));
-
-  CallMethod(&y, &Y::f);
-  CallMethod(&y, &Y::f, 20);
-  CallMethod(&y, &Y::f, static_cast<unsigned int>(10), &x);
-  CallMethod(&y, &Y::f, true, 'a', static_cast<long*>(0));
-
-  Z z;
-  CallMethod(&z,
-             &Z::f,
-             'a',
-             static_cast<signed char>('a'),
-             static_cast<unsigned char>('a'));
-
-
-  CallMethod(&z, &Z::f, &y);
-
-  // Does not compile: template parameter 'P' is ambiguous
-  // const Y cy;
-  // CallMethod(&z, &Z::f, &cy);
-
-  CallMethod(&z, &Z::m);
-
-  // Does not compile: template parameter 'T' is ambiguous
-  // const Z cz;
-  // CallMethod(&cz, &Z::m);
-
-  // Does not compile: cannot convert from 'const Z *' to 'Z *const '
-  // const Z cz;
-  // CallMethod<const Z, void>(&cz, &Z::m);
-
-  CString msg(_T("test"));
-  CallFunction(Print, "test");
-  CallFunction(Print1, &msg);
-}
-
-class RuntimeTest : public Runnable {
- protected:
-  virtual void Run();
-};
-
-void RuntimeTest::Run() {
-  Test test;
-  ASSERT_EQ(CallMethod(&test, &Test::Add, 10, 20), 30);
-
-  int sum(0);
-  CallMethod(&test, &Test::Add, -10, 20, &sum);
-  ASSERT_EQ(sum, 10);
-
-  {
-  ASSERT_EQ(CallFunction(Add, long(10), long(20)), 30);
-
-  long sum = 0;
-  CallFunction(Add, long(10), long(-20), &sum);
-  ASSERT_EQ(sum, -10);
-  }
-}
-
-
-class AsyncTest : public Runnable {
- protected:
-  virtual void Run();
-};
-
-void AsyncTest::Run() {
-  static X x;
-  static Y y;
-
-  CallFunctionAsync(X::g);
-  CallFunctionAsync(X::g, 10);
-  CallFunctionAsync(X::g, static_cast<unsigned int>(10), &x);
-  CallFunctionAsync(X::g, true, 'a', static_cast<long*>(0));
-
-  CallFunctionAsync(Y::g);
-  CallFunctionAsync(Y::g, 10);
-  CallFunctionAsync(Y::g, static_cast<unsigned int>(10), &x);
-  CallFunctionAsync(Y::g, true, 'a', static_cast<long*>(0));
-
-  CallMethodAsync(&x, &X::f);
-  CallMethodAsync(&x, &X::f, 10);
-  CallMethodAsync(&x, &X::f, static_cast<unsigned int>(10), &x);
-  CallMethodAsync(&x, &X::f, true, 'a', static_cast<long*>(0));
-
-  CallMethodAsync(&y, &Y::f);
-  CallMethodAsync(&y, &Y::f, 20);
-  CallMethodAsync(&y, &Y::f, static_cast<unsigned int>(10), &x);
-  CallMethodAsync(&y, &Y::f, true, 'a', static_cast<long*>(0));
-
-  static Z z;
-  CallMethodAsync(&z,
-                  &Z::f,
-                  'a',
-                  static_cast<signed char>('a'),
-                  static_cast<unsigned char>('a'));
-
-
-  CallMethodAsync(&z, &Z::f, &y);
-
-  // Does not compile: template parameter 'P' is ambiguous
-  // const Y cy;
-  // CallMethod(&z, &Z::f, &cy);
-
-  CallMethodAsync(&z, &Z::m);
-
-  // Does not compile: template parameter 'T' is ambiguous
-  // const Z cz;
-  // CallMethod(&cz, &Z::m);
-
-  // Does not compile: cannot convert from 'const Z *' to 'Z *const '
-  // const Z cz;
-  // CallMethod<const Z, void>(&cz, &Z::m);
-
-  CString msg(_T("test"));
-  CallFunctionAsync(Print, "test");
-  CallFunctionAsync(Print1, &msg);
-
-  WaitWithMessageLoopTimed(1000);
-}
-
-
-TEST(STATest, CompileTest) {
-  ASSERT_SUCCEEDED(InitializeApartment(0));
-
-  Thread t;
-  CompileTest compile_test;
-  t.Start(&compile_test);
-  EXPECT_TRUE(WaitWithMessageLoop(t.GetThreadHandle()));
-
-  ASSERT_SUCCEEDED(UninitializeApartment());
-}
-
-TEST(STATest, RuntimeTest) {
-  ASSERT_SUCCEEDED(InitializeApartment(0));
-
-  Thread t;
-  RuntimeTest runtime_test;
-  t.Start(&runtime_test);
-  EXPECT_TRUE(WaitWithMessageLoop(t.GetThreadHandle()));
-
-  ASSERT_SUCCEEDED(UninitializeApartment());
-}
-
-
-TEST(STATest, AsyncTest) {
-  ASSERT_SUCCEEDED(InitializeApartment(0));
-
-  Thread t;
-  AsyncTest async_test;
-  t.Start(&async_test);
-  EXPECT_TRUE(WaitWithMessageLoop(t.GetThreadHandle()));
-
-  ASSERT_SUCCEEDED(UninitializeApartment());
-}
-
-TEST(STATest, ApartmentRefCounting) {
-  // Check the reference counting is working.
-  ASSERT_SUCCEEDED(InitializeApartment(0));
-  ASSERT_SUCCEEDED(InitializeApartment(0));
-  ASSERT_SUCCEEDED(UninitializeApartment());
-  ASSERT_SUCCEEDED(UninitializeApartment());
-
-  // The call below will raise an assert in the the STA code.
-  ExpectAsserts expect_asserts;
-  ASSERT_EQ(E_UNEXPECTED, UninitializeApartment());
-}
-
-TEST(STATest, ScopedSTA) {
-  {
-    scoped_sta sta(0);
-    ASSERT_SUCCEEDED(sta.result());
-  }
-  {
-    scoped_sta sta(0);
-    ASSERT_SUCCEEDED(sta.result());
-  }
-  {
-    scoped_sta sta1(0);
-    scoped_sta sta2(0);
-    ASSERT_SUCCEEDED(sta1.result());
-    ASSERT_SUCCEEDED(sta2.result());
-  }
-
-  ExpectAsserts expect_asserts;
-  ASSERT_EQ(E_UNEXPECTED, UninitializeApartment());
-}
-
-}  // namespace omaha
-
diff --git a/base/static_assert.h b/base/static_assert.h
deleted file mode 100644
index b494742..0000000
--- a/base/static_assert.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// static_assert.h
-//
-// Compile-time asserts
-//
-// Based on the one from boost:
-// http://www.boost.org/boost/static_assert.hpp
-//
-// Usage:
-//
-// kStaticAssert(constant_boolean_expression);
-//
-// This can appear at file scope or within a block (anyplace a typedef
-// is OK).
-//
-// TODO(omaha): deprecate and replace with the static assert in base/basictypes
-#ifndef OMAHA_COMMON_STATIC_ASSERT_H_
-#define OMAHA_COMMON_STATIC_ASSERT_H_
-
-template <bool> struct STATIC_ASSERTION_FAILURE;
-
-template <> struct STATIC_ASSERTION_FAILURE<true> { enum { value = 1 }; };
-
-template<int> struct static_assert_test{};
-
-#define STATIC_ASSERT( B ) \
-typedef static_assert_test<\
-  sizeof(STATIC_ASSERTION_FAILURE< (bool)( B ) >)>\
-    static_assert_typedef_ ##  __LINE__
-
-#endif  // OMAHA_COMMON_STATIC_ASSERT_H_
diff --git a/base/statregex.h b/base/statregex.h
deleted file mode 100644
index 50b47e5..0000000
--- a/base/statregex.h
+++ /dev/null
@@ -1,1357 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Reuses most of the functionality of the classes within atlmfc_vc80 statreg.h.
-// The only functional difference is that GenerateError() returns a unique
-// HRESULT based on the component CLSID/APPID as well as one of the E_ATL_XXX
-// codes, instead of the generic DISP_E_EXCEPTION.
-
-#ifndef OMAHA_BASE_STATREGEX_H__
-#define OMAHA_BASE_STATREGEX_H__
-
-#include <atlbase.h>
-#include <statreg.h>
-
-namespace omaha {
-
-class RegObject;
-
-class RegParser
-{
-public:
-  RegParser(RegObject* pRegObj);
-
-  HRESULT  PreProcessBuffer(__in_z LPTSTR lpszReg, __deref_out_z LPTSTR* ppszReg);
-  HRESULT  RegisterBuffer(__in_z LPTSTR szReg, BOOL bRegister);
-
-protected:
-
-  void    SkipWhiteSpace();
-  HRESULT NextToken(__out_ecount_z(MAX_VALUE) LPTSTR szToken);
-  HRESULT AddValue(__in CRegKey& rkParent, __in_z_opt LPCTSTR szValueName, __out_ecount_z(MAX_VALUE) LPTSTR szToken);
-  BOOL    CanForceRemoveKey(LPCTSTR szKey);
-  BOOL    HasSubKeys(HKEY hkey);
-  BOOL    HasValues(HKEY hkey);
-  HRESULT RegisterSubkeys(__out_ecount_z(MAX_VALUE) LPTSTR szToken, __in HKEY hkParent, __in BOOL bRegister, __in BOOL bInRecovery = FALSE);
-  BOOL    IsSpace(TCHAR ch);
-  LPTSTR  m_pchCur;
-
-  RegObject*     m_pRegObj;
-  unsigned long guid_prefix_;
-
-  HRESULT GenerateError(UINT registrar_error) {
-    return MAKE_HRESULT(SEVERITY_ERROR, registrar_error, guid_prefix_);
-  }
-
-  //HRESULT HandleReplacements(LPTSTR& szToken);
-  HRESULT SkipAssignment(__inout_ecount_z(MAX_VALUE) LPTSTR szToken);
-
-  BOOL    EndOfVar() { return chQuote == *m_pchCur && chQuote != *CharNext(m_pchCur); }
-  static LPTSTR StrChr(__in_z LPTSTR lpsz, __in TCHAR ch);
-  static HKEY HKeyFromString(__in_z LPTSTR szToken);
-  static BYTE ChToByte(const TCHAR ch);
-  static BOOL VTFromRegType(LPCTSTR szValueType, VARTYPE& vt);
-  static const TCHAR* const rgszNeverDelete[];
-  static const int cbNeverDelete;
-  static const int MAX_VALUE = 4096;
-  static const int MAX_TYPE = 4096;
-
-  // Implementation Helper
-  class CParseBuffer
-  {
-  public:
-    int nPos;
-    int nSize;
-    LPTSTR p;
-    CParseBuffer(int nInitial)
-    {
-      if (nInitial < 100)
-        nInitial = 1000;
-      nPos = 0;
-      nSize = nInitial;
-      p = (LPTSTR) ::ATL::AtlCoTaskMemCAlloc(nSize,static_cast<ULONG>(sizeof(TCHAR)));
-      if (p != NULL)
-        *p = NULL;
-    }
-    ~CParseBuffer()
-    {
-      CoTaskMemFree(p);
-    }
-    BOOL Append(const TCHAR* pch, int nChars)
-    {
-      ATLASSERT(p != NULL);
-      int newSize = nPos + nChars + 1;
-      if ((newSize <= nPos) || (newSize <= nChars))
-        return FALSE;
-
-      if (newSize >= nSize)
-      {
-        while (newSize >= nSize) {
-          if (nSize > INT_MAX / 2)
-          return FALSE;
-          nSize *= 2;
-        }
-        LPTSTR pTemp = (LPTSTR)::ATL::AtlCoTaskMemRecalloc(p, nSize, sizeof(TCHAR));
-        if (pTemp == NULL)
-          return FALSE;
-        p = pTemp;
-      }
-      if ((nPos < 0) || (nPos >= nSize) || nSize - nPos > nSize)
-        return FALSE;
-
-#pragma warning(push)
-#pragma warning(disable: 22008)
-      /* Prefast false warning is fired here despite the all above checks */
-      Checked::memcpy_s(p + nPos, (nSize-nPos) * sizeof(TCHAR), pch, int(nChars * sizeof(TCHAR)));
-      nPos += nChars;
-      *(p + nPos) = NULL;
-#pragma warning(pop)
-      return TRUE;
-    }
-
-    BOOL AddChar(const TCHAR* pch)
-    {
-#ifndef _UNICODE
-      int nChars = int(CharNext(pch) - pch);
-#else
-      int nChars = 1;
-#endif
-      return Append(pch, nChars);
-
-    }
-    BOOL AddString(LPCOLESTR lpsz)
-    {
-      if (lpsz == NULL)
-      {
-        return FALSE;
-      }
-      USES_CONVERSION_EX;
-      LPCTSTR lpszT = OLE2CT_EX(lpsz, _ATL_SAFE_ALLOCA_DEF_THRESHOLD);
-      if (lpszT == NULL)
-      {
-        return FALSE;
-      }
-      return Append(lpszT, (int)lstrlen(lpszT));
-    }
-    LPTSTR Detach()
-    {
-      LPTSTR lp = p;
-      p = NULL;
-      nSize = nPos = 0;
-      return lp;
-    }
-
-  };
-};
-
-class RegObject  : public IRegistrarBase
-{
-public:
-
-  STDMETHOD(QueryInterface)(const IID &,void ** )
-  {
-    ATLASSERT(_T("statically linked in RegObject is not a com object. Do not callthis function"));
-    return E_NOTIMPL;
-  }
-
-  STDMETHOD_(ULONG, AddRef)(void)
-  {
-    ATLASSERT(_T("statically linked in RegObject is not a com object. Do not callthis function"));
-    return 1;
-  }
-  STDMETHOD_(ULONG, Release)(void)
-  {
-    ATLASSERT(_T("statically linked in RegObject is not a com object. Do not callthis function"));
-    return 0;
-  }
-
-  virtual ~RegObject(){ClearReplacements();}
-  HRESULT FinalConstruct() { return m_csMap.Init(); }
-  void FinalRelease() {}
-
-  // Map based methods
-  HRESULT STDMETHODCALLTYPE AddReplacement(LPCOLESTR lpszKey, LPCOLESTR lpszItem);
-  HRESULT STDMETHODCALLTYPE ClearReplacements();
-  LPCOLESTR StrFromMap(__in_z LPTSTR lpszKey);
-
-  // Register via a given mechanism
-  HRESULT STDMETHODCALLTYPE ResourceRegister(LPCOLESTR pszFileName, UINT nID, LPCOLESTR pszType);
-  HRESULT STDMETHODCALLTYPE ResourceRegisterSz(LPCOLESTR pszFileName, LPCOLESTR pszID, LPCOLESTR pszType);
-  HRESULT STDMETHODCALLTYPE ResourceUnregister(LPCOLESTR pszFileName, UINT nID, LPCOLESTR pszType);
-  HRESULT STDMETHODCALLTYPE ResourceUnregisterSz(LPCOLESTR pszFileName, LPCOLESTR pszID, LPCOLESTR pszType);
-  HRESULT STDMETHODCALLTYPE FileRegister(LPCOLESTR bstrFileName)
-  {
-    return CommonFileRegister(bstrFileName, TRUE);
-  }
-
-  HRESULT STDMETHODCALLTYPE FileUnregister(LPCOLESTR bstrFileName)
-  {
-    return CommonFileRegister(bstrFileName, FALSE);
-  }
-
-  HRESULT STDMETHODCALLTYPE StringRegister(LPCOLESTR bstrData)
-  {
-    return RegisterWithString(bstrData, TRUE);
-  }
-
-  HRESULT STDMETHODCALLTYPE StringUnregister(LPCOLESTR bstrData)
-  {
-    return RegisterWithString(bstrData, FALSE);
-  }
-
-protected:
-
-  HRESULT CommonFileRegister(LPCOLESTR pszFileName, BOOL bRegister);
-  HRESULT RegisterFromResource(LPCOLESTR pszFileName, LPCTSTR pszID, LPCTSTR pszType, BOOL bRegister);
-  HRESULT RegisterWithString(LPCOLESTR pszData, BOOL bRegister);
-
-  static HRESULT GenerateError(UINT) {return DISP_E_EXCEPTION;}
-
-  CExpansionVector                m_RepMap;
-  CComObjectThreadModel::AutoDeleteCriticalSection      m_csMap;
-};
-
-inline HRESULT STDMETHODCALLTYPE RegObject::AddReplacement(LPCOLESTR lpszKey, LPCOLESTR lpszItem)
-{
-  if (lpszKey == NULL || lpszItem == NULL)
-    return E_INVALIDARG;
-  m_csMap.Lock();
-  USES_CONVERSION_EX;
-
-  LPCTSTR lpszT = OLE2CT_EX(lpszKey, _ATL_SAFE_ALLOCA_DEF_THRESHOLD);
-
-#ifndef _UNICODE
-  if(lpszT == NULL)
-    return E_OUTOFMEMORY;
-#endif
-
-  BOOL bRet = m_RepMap.Add(lpszT, lpszItem);
-
-  m_csMap.Unlock();
-  return bRet ? S_OK : E_OUTOFMEMORY;
-}
-
-inline HRESULT RegObject::RegisterFromResource(LPCOLESTR bstrFileName, LPCTSTR szID,
-                     LPCTSTR szType, BOOL bRegister)
-{
-  USES_CONVERSION_EX;
-
-  HRESULT     hr;
-  RegParser  parser(this);
-  HINSTANCE   hInstResDll;
-  HRSRC       hrscReg;
-  HGLOBAL     hReg;
-  DWORD       dwSize;
-  LPSTR       szRegA;
-  CTempBuffer<TCHAR, 1024> szReg;
-
-  LPCTSTR lpszBSTRFileName = OLE2CT_EX(bstrFileName, _ATL_SAFE_ALLOCA_DEF_THRESHOLD);
-#ifndef _UNICODE
-  if (lpszBSTRFileName == NULL)
-  {
-    return E_OUTOFMEMORY;
-  }
-#endif // _UNICODE
-
-  hInstResDll = LoadLibraryEx(lpszBSTRFileName, NULL, LOAD_LIBRARY_AS_DATAFILE);
-
-  if (NULL == hInstResDll)
-  {
-    ATLTRACE(atlTraceRegistrar, 0, _T("Failed to LoadLibrary on %s\n"), bstrFileName);
-    hr = AtlHresultFromLastError();
-    goto ReturnHR;
-  }
-
-  hrscReg =FindResource((HMODULE)hInstResDll, szID, szType);
-
-  if (NULL == hrscReg)
-  {
-    ATLTRACE(atlTraceRegistrar, 0, (HIWORD(szID) == NULL) ?
-      _T("Failed to FindResource on ID:%d TYPE:%s\n") :
-      _T("Failed to FindResource on ID:%s TYPE:%s\n"),
-      szID, szType);
-    hr = AtlHresultFromLastError();
-    goto ReturnHR;
-  }
-  hReg = LoadResource((HMODULE)hInstResDll, hrscReg);
-
-  if (NULL == hReg)
-  {
-    ATLTRACE(atlTraceRegistrar, 0, _T("Failed to LoadResource\n"));
-    hr = AtlHresultFromLastError();
-    goto ReturnHR;
-  }
-
-  dwSize = SizeofResource((HMODULE)hInstResDll, hrscReg);
-  szRegA = (LPSTR)hReg;
-
-  // Allocate extra space for NULL.
-  if (dwSize + 1 < dwSize)
-    return E_OUTOFMEMORY;
-  ATLTRY(szReg.Allocate(dwSize + 1));
-  if (szReg == NULL)
-  {
-    hr = E_OUTOFMEMORY;
-    goto ReturnHR;
-  }
-
-#ifdef _UNICODE
-  DWORD uniSize = ::MultiByteToWideChar(_AtlGetConversionACP(), 0, szRegA, dwSize, szReg, dwSize);
-  if (uniSize == 0)
-  {
-    hr = AtlHresultFromLastError();
-    goto ReturnHR;
-  }
-  // Append a NULL at the end.
-  szReg[uniSize] = NULL;
-#else
-  Checked::memcpy_s(szReg, dwSize, szRegA, dwSize);
-  // Append a NULL at the end.
-     szReg[dwSize] = NULL;
-#endif
-
-
-
-  hr = parser.RegisterBuffer(szReg, bRegister);
-
-ReturnHR:
-
-  if (NULL != hInstResDll)
-    FreeLibrary((HMODULE)hInstResDll);
-  return hr;
-}
-
-inline HRESULT STDMETHODCALLTYPE RegObject::ResourceRegister(LPCOLESTR szFileName, UINT nID, LPCOLESTR szType)
-{
-  USES_CONVERSION_EX;
-
-  LPCTSTR lpszT = OLE2CT_EX(szType, _ATL_SAFE_ALLOCA_DEF_THRESHOLD);
-#ifndef _UNICODE
-  if (lpszT == NULL)
-  {
-    return E_OUTOFMEMORY;
-  }
-#endif // _UNICODE
-
-  return RegisterFromResource(szFileName, MAKEINTRESOURCE(nID), lpszT, TRUE);
-}
-
-inline HRESULT STDMETHODCALLTYPE RegObject::ResourceRegisterSz(LPCOLESTR szFileName, LPCOLESTR szID, LPCOLESTR szType)
-{
-  USES_CONVERSION_EX;
-  if (szID == NULL || szType == NULL)
-    return E_INVALIDARG;
-
-  LPCTSTR lpszID = OLE2CT_EX(szID, _ATL_SAFE_ALLOCA_DEF_THRESHOLD);
-  LPCTSTR lpszType = OLE2CT_EX(szType, _ATL_SAFE_ALLOCA_DEF_THRESHOLD);
-#ifndef _UNICODE
-  if (lpszID == NULL || lpszType==NULL)
-  {
-    return E_OUTOFMEMORY;
-  }
-#endif // _UNICODE
-  return RegisterFromResource(szFileName, lpszID, lpszType, TRUE);
-}
-
-inline HRESULT STDMETHODCALLTYPE RegObject::ResourceUnregister(LPCOLESTR szFileName, UINT nID, LPCOLESTR szType)
-{
-  USES_CONVERSION_EX;
-
-  LPCTSTR lpszT = OLE2CT_EX(szType, _ATL_SAFE_ALLOCA_DEF_THRESHOLD);
-#ifndef _UNICODE
-  if (lpszT == NULL)
-  {
-    return E_OUTOFMEMORY;
-  }
-#endif // _UNICODE
-  return RegisterFromResource(szFileName, MAKEINTRESOURCE(nID), lpszT, FALSE);
-}
-
-inline HRESULT STDMETHODCALLTYPE RegObject::ResourceUnregisterSz(LPCOLESTR szFileName, LPCOLESTR szID, LPCOLESTR szType)
-{
-  USES_CONVERSION_EX;
-  if (szID == NULL || szType == NULL)
-    return E_INVALIDARG;
-
-  LPCTSTR lpszID = OLE2CT_EX(szID, _ATL_SAFE_ALLOCA_DEF_THRESHOLD);
-  LPCTSTR lpszType = OLE2CT_EX(szType, _ATL_SAFE_ALLOCA_DEF_THRESHOLD);
-#ifndef _UNICODE
-  if (lpszID == NULL || lpszType == NULL)
-  {
-    return E_OUTOFMEMORY;
-  }
-#endif // _UNICODE
-
-  return RegisterFromResource(szFileName, lpszID, lpszType, FALSE);
-}
-
-inline HRESULT RegObject::RegisterWithString(LPCOLESTR bstrData, BOOL bRegister)
-{
-  USES_CONVERSION_EX;
-  RegParser  parser(this);
-
-  LPCTSTR szReg = OLE2CT_EX(bstrData, _ATL_SAFE_ALLOCA_DEF_THRESHOLD);
-#ifndef _UNICODE
-  if (szReg == NULL)
-  {
-    return E_OUTOFMEMORY;
-  }
-#endif // _UNICODE
-
-  HRESULT hr = parser.RegisterBuffer((LPTSTR)szReg, bRegister);
-
-  return hr;
-}
-
-inline HRESULT RegObject::ClearReplacements()
-{
-  m_csMap.Lock();
-  HRESULT hr = m_RepMap.ClearReplacements();
-  m_csMap.Unlock();
-  return hr;
-}
-
-
-inline LPCOLESTR RegObject::StrFromMap(__in_z LPTSTR lpszKey)
-{
-  m_csMap.Lock();
-  LPCOLESTR lpsz = m_RepMap.Lookup(lpszKey);
-  if (lpsz == NULL) // not found!!
-    ATLTRACE(atlTraceRegistrar, 0, _T("Map Entry not found\n"));
-  m_csMap.Unlock();
-  return lpsz;
-}
-
-inline HRESULT RegObject::CommonFileRegister(LPCOLESTR bstrFileName, BOOL bRegister)
-{
-  USES_CONVERSION_EX;
-
-  RegParser  parser(this);
-
-  LPCTSTR lpszBSTRFileName = OLE2CT_EX(bstrFileName, _ATL_SAFE_ALLOCA_DEF_THRESHOLD);
-#ifndef _UNICODE
-  if (lpszBSTRFileName == NULL)
-  {
-    return E_OUTOFMEMORY;
-  }
-#endif // _UNICODE
-
-  HANDLE hFile = CreateFile(lpszBSTRFileName, GENERIC_READ, 0, NULL,
-                OPEN_EXISTING,
-                FILE_ATTRIBUTE_READONLY,
-                NULL);
-  if (INVALID_HANDLE_VALUE == hFile)
-  {
-    ATLTRACE2(atlTraceRegistrar, 0, _T("Failed to CreateFile on %s\n"), lpszBSTRFileName);
-    return AtlHresultFromLastError();
-  }
-
-  HRESULT hRes = S_OK;
-  DWORD cbRead;
-  DWORD cbFile = GetFileSize(hFile, NULL); // No HiOrder DWORD required
-
-  CTempBuffer<char, 1024> szReg;
-  // Extra space for NULL.
-  ATLTRY(szReg.Allocate(cbFile + 1));
-  if (szReg == NULL)
-  {
-    hRes = E_OUTOFMEMORY;
-    goto ReturnHR;
-  }
-
-  if (ReadFile(hFile, szReg, cbFile, &cbRead, NULL) == 0)
-  {
-    ATLTRACE2(atlTraceRegistrar, 0, "Read Failed on file%s\n", lpszBSTRFileName);
-    hRes =  AtlHresultFromLastError();
-  }
-  if (SUCCEEDED(hRes))
-  {
-    szReg[cbRead] = NULL;
-
-#ifdef _UNICODE
-    CTempBuffer<WCHAR, 1024> szConverted;
-    ATLTRY(szConverted.Allocate(cbFile + 1));
-    if (szConverted == NULL)
-    {
-      hRes =  E_OUTOFMEMORY;
-      goto ReturnHR;
-
-    }
-    if (::MultiByteToWideChar(_AtlGetConversionACP(), 0, szReg, cbFile + 1, szConverted, cbFile + 1) == 0)
-    {
-      hRes = AtlHresultFromLastError();
-      goto ReturnHR;
-    }
-
-
-
-
-#else
-    LPTSTR szConverted = szReg;
-#endif
-    hRes = parser.RegisterBuffer(szConverted, bRegister);
-  }
-ReturnHR:
-  CloseHandle(hFile);
-  return hRes;
-}
-
-__declspec(selectany) const TCHAR* const RegParser::rgszNeverDelete[] =
-{
-  _T("AppID"),
-  _T("CLSID"),
-  _T("Component Categories"),
-  _T("FileType"),
-  _T("Interface"),
-  _T("Hardware"),
-  _T("Mime"),
-  _T("SAM"),
-  _T("SECURITY"),
-  _T("SYSTEM"),
-  _T("Software"),
-  _T("TypeLib")
-};
-
-__declspec(selectany) const int RegParser::cbNeverDelete = sizeof(rgszNeverDelete) / sizeof(LPCTSTR*);
-
-
-inline BOOL RegParser::VTFromRegType(LPCTSTR szValueType, VARTYPE& vt)
-{
-  struct typemap
-  {
-    LPCTSTR lpsz;
-    VARTYPE vt;
-  };
-#pragma warning (push)
-#pragma warning (disable : 4640)  // construction of local static object is not thread-safe
-
-  static const typemap map[] = {
-    {szStringVal, VT_BSTR},
-    {multiszStringVal, VT_BSTR | VT_BYREF},
-    {szDwordVal,  VT_UI4},
-    {szBinaryVal, VT_UI1}
-  };
-
-#pragma warning (pop)
-
-  for (int i=0;i<sizeof(map)/sizeof(typemap);i++)
-  {
-    if (!lstrcmpi(szValueType, map[i].lpsz))
-    {
-      vt = map[i].vt;
-      return TRUE;
-    }
-  }
-
-  return FALSE;
-
-}
-
-inline BYTE RegParser::ChToByte(const TCHAR ch)
-{
-  switch (ch)
-  {
-    case '0':
-    case '1':
-    case '2':
-    case '3':
-    case '4':
-    case '5':
-    case '6':
-    case '7':
-    case '8':
-    case '9':
-        return (BYTE) (ch - '0');
-    case 'A':
-    case 'B':
-    case 'C':
-    case 'D':
-    case 'E':
-    case 'F':
-        return (BYTE) (10 + (ch - 'A'));
-    case 'a':
-    case 'b':
-    case 'c':
-    case 'd':
-    case 'e':
-    case 'f':
-        return (BYTE) (10 + (ch - 'a'));
-    default:
-        ATLASSERT(FALSE);
-        ATLTRACE(atlTraceRegistrar, 0, _T("Bogus value %c passed as binary Hex value\n"), ch);
-        return 0;
-  }
-}
-
-inline HKEY RegParser::HKeyFromString(__in_z LPTSTR szToken)
-{
-  struct keymap
-  {
-    LPCTSTR lpsz;
-    HKEY hkey;
-  };
-  static const keymap map[] = {
-    {_T("HKCR"), HKEY_CLASSES_ROOT},
-    {_T("HKCU"), HKEY_CURRENT_USER},
-    {_T("HKLM"), HKEY_LOCAL_MACHINE},
-    {_T("HKU"),  HKEY_USERS},
-    {_T("HKPD"), HKEY_PERFORMANCE_DATA},
-    {_T("HKDD"), HKEY_DYN_DATA},
-    {_T("HKCC"), HKEY_CURRENT_CONFIG},
-    {_T("HKEY_CLASSES_ROOT"), HKEY_CLASSES_ROOT},
-    {_T("HKEY_CURRENT_USER"), HKEY_CURRENT_USER},
-    {_T("HKEY_LOCAL_MACHINE"), HKEY_LOCAL_MACHINE},
-    {_T("HKEY_USERS"), HKEY_USERS},
-    {_T("HKEY_PERFORMANCE_DATA"), HKEY_PERFORMANCE_DATA},
-    {_T("HKEY_DYN_DATA"), HKEY_DYN_DATA},
-    {_T("HKEY_CURRENT_CONFIG"), HKEY_CURRENT_CONFIG}
-  };
-
-  for (int i=0;i<sizeof(map)/sizeof(keymap);i++)
-  {
-    if (!lstrcmpi(szToken, map[i].lpsz))
-      return map[i].hkey;
-  }
-  return NULL;
-}
-
-inline LPTSTR RegParser::StrChr(__in_z LPTSTR lpsz, __in TCHAR ch)
-{
-  LPTSTR p = NULL;
-
-  if (lpsz == NULL)
-    return NULL;
-
-  while (*lpsz)
-  {
-    if (*lpsz == ch)
-    {
-      p = lpsz;
-      break;
-    }
-    lpsz = CharNext(lpsz);
-  }
-  return p;
-}
-
-inline RegParser::RegParser(RegObject* pRegObj)
-{
-  m_pRegObj           = pRegObj;
-  m_pchCur            = NULL;
-
-  CString guid(m_pRegObj->StrFromMap(_T("CLSID")));
-  if (guid.IsEmpty()) {
-    guid = m_pRegObj->StrFromMap(_T("APPID"));
-  }
-
-  guid_prefix_ = _tcstoul(guid.Mid(1, 4), NULL, 16);
-
-  ATLASSERT(guid_prefix_);
-}
-
-inline BOOL RegParser::IsSpace(TCHAR ch)
-{
-  switch (ch)
-  {
-    case _T(' '):
-    case _T('\t'):
-    case _T('\r'):
-    case _T('\n'):
-        return TRUE;
-  }
-
-  return FALSE;
-}
-
-inline void RegParser::SkipWhiteSpace()
-{
-  while(IsSpace(*m_pchCur))
-    m_pchCur = CharNext(m_pchCur);
-}
-
-inline HRESULT RegParser::NextToken(__out_ecount_z(MAX_VALUE) LPTSTR szToken)
-{
-  SkipWhiteSpace();
-
-  // NextToken cannot be called at EOS
-  if (NULL == *m_pchCur)
-    return GenerateError(E_ATL_UNEXPECTED_EOS);
-
-  LPCTSTR szOrig = szToken;
-  // handle quoted value / key
-  if (chQuote == *m_pchCur)
-  {
-    m_pchCur = CharNext(m_pchCur);
-
-    while (NULL != *m_pchCur && !EndOfVar())
-    {
-      if (chQuote == *m_pchCur) // If it is a quote that means we must skip it
-        m_pchCur = CharNext(m_pchCur);
-
-      LPTSTR pchPrev = m_pchCur;
-      m_pchCur = CharNext(m_pchCur);
-
-      INT_PTR nChars = m_pchCur - pchPrev;
-
-      // Make sure we have room for nChars plus terminating NULL
-      if ((szToken + nChars + 1) >= szOrig + MAX_VALUE)
-        return GenerateError(E_ATL_VALUE_TOO_LARGE);
-
-      for (int i = 0; i < (int)nChars; i++, szToken++, pchPrev++)
-        *szToken = *pchPrev;
-    }
-
-    if (NULL == *m_pchCur)
-    {
-      ATLTRACE(atlTraceRegistrar, 0, _T("NextToken : Unexpected End of File\n"));
-      return GenerateError(E_ATL_UNEXPECTED_EOS);
-    }
-
-    *szToken = NULL;
-    m_pchCur = CharNext(m_pchCur);
-  }
-
-  else
-  {
-    // Handle non-quoted ie parse up till first "White Space"
-    while (NULL != *m_pchCur && !IsSpace(*m_pchCur))
-    {
-      LPTSTR pchPrev = m_pchCur;
-      m_pchCur = CharNext(m_pchCur);
-
-      INT_PTR nChars = m_pchCur - pchPrev;
-
-      // Make sure we have room for nChars plus terminating NULL
-      if ((szToken + nChars + 1) >= szOrig + MAX_VALUE)
-        return GenerateError(E_ATL_VALUE_TOO_LARGE);
-
-      for (int i = 0; i < (int)nChars; i++, szToken++, pchPrev++)
-        *szToken = *pchPrev;
-    }
-
-    *szToken = NULL;
-  }
-  return S_OK;
-}
-
-inline HRESULT RegParser::AddValue(__in CRegKey& rkParent, __in_z_opt LPCTSTR szValueName, __out_ecount_z(MAX_VALUE) LPTSTR szToken)
-{
-  HRESULT hr;
-
-  TCHAR    szValue[MAX_VALUE];
-  VARTYPE     vt = VT_EMPTY;
-  LONG        lRes = ERROR_SUCCESS;
-  UINT        nIDRes = 0;
-
-  if (FAILED(hr = NextToken(szValue)))
-    return hr;
-  if (!VTFromRegType(szValue, vt))
-  {
-    ATLTRACE(atlTraceRegistrar, 0, _T("%s Type not supported\n"), szValue);
-    return GenerateError(E_ATL_TYPE_NOT_SUPPORTED);
-  }
-
-  SkipWhiteSpace();
-  if (FAILED(hr = NextToken(szValue)))
-    return hr;
-
-  switch (vt)
-  {
-  case VT_BSTR:
-    {
-      lRes = rkParent.SetStringValue(szValueName, szValue);
-      ATLTRACE(atlTraceRegistrar, 2, _T("Setting Value %s at %s\n"), szValue, !szValueName ? _T("default") : szValueName);
-      break;
-    }
-  case VT_BSTR | VT_BYREF:
-    {
-      ATLTRACE(atlTraceRegistrar, 2, _T("Setting Value %s at %s\n"), szValue, !szValueName ? _T("default") : szValueName);
-      int nLen = lstrlen(szValue) + 2; //Allocate space for double null termination.
-      CTempBuffer<TCHAR, 256> pszDestValue;
-      //nLen should be >= the max size of the target buffer.
-      ATLTRY(pszDestValue.Allocate(nLen));
-      if (pszDestValue != NULL)
-      {
-        TCHAR* p = pszDestValue;
-        TCHAR* q = szValue;
-        nLen = 0;
-        while (*q != _T('\0'))
-        {
-          TCHAR* r = CharNext(q);
-          if (*q == _T('\\') && *r == _T('0'))
-          {
-            *p++ = NULL;
-            q = CharNext(r);
-          }
-          else
-          {
-            *p = *q;
-#ifndef _UNICODE
-            if (IsDBCSLeadByte(*q))
-            {
-              p++;
-              q++;
-              //Protect from Lead byte followed by the zero terminator.May skip beyond the end of the string.
-              if (*q == _T('\0')) { break; }
-              *p = *q;
-            }
-#endif
-            p++;
-            q++;
-          }
-          nLen ++;
-        }
-         //Always terminate with 2 NULLs.
-        *p = NULL;
-        p++;
-          *p = NULL;
-        lRes = rkParent.SetMultiStringValue(szValueName, pszDestValue);
-      }
-      else
-      {
-        lRes = ERROR_OUTOFMEMORY;
-      }
-    }
-    break;
-  case VT_UI4:
-    {
-      ULONG ulVal;
-      USES_CONVERSION_EX;
-
-      LPOLESTR lpszV = T2OLE_EX(szValue, _ATL_SAFE_ALLOCA_DEF_THRESHOLD);
-  #ifndef _UNICODE
-      if(lpszV == NULL)
-        return E_OUTOFMEMORY;
-  #endif
-      VarUI4FromStr(lpszV, 0, 0, &ulVal);
-
-      lRes = rkParent.SetDWORDValue(szValueName, ulVal);
-      ATLTRACE(atlTraceRegistrar, 2, _T("Setting Value %d at %s\n"), ulVal, !szValueName ? _T("default") : szValueName);
-      break;
-    }
-  case VT_UI1:
-    {
-      int cbValue = lstrlen(szValue);
-      if (cbValue & 0x00000001)
-      {
-        ATLTRACE(atlTraceRegistrar, 0, _T("Binary Data does not fall on BYTE boundries\n"));
-        return E_FAIL;
-      }
-      int cbValDiv2 = cbValue/2;
-      CTempBuffer<BYTE, 256> rgBinary;
-      ATLTRY(rgBinary.Allocate(cbValDiv2));
-      if (rgBinary == NULL)
-        return E_FAIL;
-      memset(rgBinary, 0, cbValDiv2);
-      for (int irg = 0; irg < cbValue; irg++)
-        rgBinary[(irg/2)] |= (ChToByte(szValue[irg])) << (4*(1 - (irg & 0x00000001)));
-      lRes = RegSetValueEx(rkParent, szValueName, 0, REG_BINARY, rgBinary, cbValDiv2);
-      break;
-    }
-  }
-
-  if (ERROR_SUCCESS != lRes)
-  {
-    nIDRes = E_ATL_VALUE_SET_FAILED;
-    return AtlHresultFromWin32(lRes);
-  }
-
-  if (FAILED(hr = NextToken(szToken)))
-    return hr;
-
-  return S_OK;
-}
-
-inline BOOL RegParser::CanForceRemoveKey(LPCTSTR szKey)
-{
-  for (int iNoDel = 0; iNoDel < cbNeverDelete; iNoDel++)
-    if (!lstrcmpi(szKey, rgszNeverDelete[iNoDel]))
-       return FALSE;                       // We cannot delete it
-
-  return TRUE;
-}
-
-inline BOOL RegParser::HasSubKeys(HKEY hkey)
-{
-  DWORD       cbSubKeys = 0;
-
-  if (RegQueryInfoKey(hkey, NULL, NULL, NULL,
-                 &cbSubKeys, NULL, NULL,
-                 NULL, NULL, NULL, NULL, NULL) != ERROR_SUCCESS)
-  {
-    ATLTRACE(atlTraceRegistrar, 0, _T("Should not be here!!\n"));
-    ATLASSERT(FALSE);
-    return FALSE;
-  }
-
-  return cbSubKeys > 0;
-}
-
-inline BOOL RegParser::HasValues(HKEY hkey)
-{
-  DWORD       cbValues = 0;
-
-  LONG lResult = RegQueryInfoKey(hkey, NULL, NULL, NULL,
-                  NULL, NULL, NULL,
-                  &cbValues, NULL, NULL, NULL, NULL);
-  if (ERROR_SUCCESS != lResult)
-  {
-    ATLTRACE(atlTraceRegistrar, 0, _T("RegQueryInfoKey Failed "));
-    ATLASSERT(FALSE);
-    return FALSE;
-  }
-
-  if (1 == cbValues)
-  {
-    DWORD cbMaxName= MAX_VALUE;
-    TCHAR szValueName[MAX_VALUE];
-    // Check to see if the Value is default or named
-    lResult = RegEnumValue(hkey, 0, szValueName, &cbMaxName, NULL, NULL, NULL, NULL);
-    if (ERROR_SUCCESS == lResult && (szValueName[0] != NULL))
-      return TRUE; // Named Value means we have a value
-    return FALSE;
-  }
-
-  return cbValues > 0; // More than 1 means we have a non-default value
-}
-
-inline HRESULT RegParser::SkipAssignment(__inout_ecount_z(MAX_VALUE) LPTSTR szToken)
-{
-  HRESULT hr;
-  TCHAR szValue[MAX_VALUE];
-
-  if (*szToken == chEquals)
-  {
-    if (FAILED(hr = NextToken(szToken)))
-      return hr;
-    // Skip assignment
-    SkipWhiteSpace();
-    if (FAILED(hr = NextToken(szValue)))
-      return hr;
-    if (FAILED(hr = NextToken(szToken)))
-      return hr;
-  }
-
-  return S_OK;
-}
-
-inline HRESULT RegParser::PreProcessBuffer(__in_z LPTSTR lpszReg, __deref_out_z LPTSTR* ppszReg)
-{
-  ATLASSERT(lpszReg != NULL);
-  ATLASSERT(ppszReg != NULL);
-
-  if (lpszReg == NULL || ppszReg == NULL)
-    return E_POINTER;
-
-  *ppszReg = NULL;
-  int nSize = lstrlen(lpszReg)*2;
-  CParseBuffer pb(nSize);
-  if (pb.p == NULL)
-    return E_OUTOFMEMORY;
-  m_pchCur = lpszReg;
-  HRESULT hr = S_OK;
-
-  while (*m_pchCur != NULL) // look for end
-  {
-    if (*m_pchCur == _T('%'))
-    {
-      m_pchCur = CharNext(m_pchCur);
-      if (*m_pchCur == _T('%'))
-      {
-        if (!pb.AddChar(m_pchCur))
-        {
-          hr = E_OUTOFMEMORY;
-          break;
-        }
-      }
-      else
-      {
-        LPTSTR lpszNext = StrChr(m_pchCur, _T('%'));
-        if (lpszNext == NULL)
-        {
-          ATLTRACE(atlTraceRegistrar, 0, _T("Error no closing %% found\n"));
-          hr = GenerateError(E_ATL_UNEXPECTED_EOS);
-          break;
-        }
-        if ((lpszNext-m_pchCur) > 31)
-        {
-          hr = E_FAIL;
-          break;
-        }
-        int nLength = int(lpszNext - m_pchCur);
-        TCHAR buf[32];
-        Checked::tcsncpy_s(buf, _countof(buf), m_pchCur, nLength);
-        LPCOLESTR lpszVar = m_pRegObj->StrFromMap(buf);
-        if (lpszVar == NULL)
-        {
-          hr = GenerateError(E_ATL_NOT_IN_MAP);
-          break;
-        }
-        if (!pb.AddString(lpszVar))
-        {
-          hr = E_OUTOFMEMORY;
-          break;
-        }
-
-        while (m_pchCur != lpszNext)
-          m_pchCur = CharNext(m_pchCur);
-      }
-    }
-    else
-    {
-      if (!pb.AddChar(m_pchCur))
-      {
-        hr = E_OUTOFMEMORY;
-        break;
-      }
-    }
-
-    m_pchCur = CharNext(m_pchCur);
-  }
-  if (SUCCEEDED(hr))
-    *ppszReg = pb.Detach();
-  return hr;
-}
-
-inline HRESULT RegParser::RegisterBuffer(__in_z LPTSTR szBuffer, __in BOOL bRegister)
-{
-  TCHAR   szToken[MAX_VALUE];
-  HRESULT hr = S_OK;
-
-  LPTSTR szReg = NULL;
-  hr = PreProcessBuffer(szBuffer, &szReg);
-  if (FAILED(hr))
-    return hr;
-
-  ATLTRACE(atlTraceRegistrar, 0, _T("%s\n"), szReg);
-
-  m_pchCur = szReg;
-
-  // Preprocess szReg
-
-  while (NULL != *m_pchCur)
-  {
-    if (FAILED(hr = NextToken(szToken)))
-      break;
-    HKEY hkBase;
-    if ((hkBase = HKeyFromString(szToken)) == NULL)
-    {
-      ATLTRACE(atlTraceRegistrar, 0, _T("HKeyFromString failed on %s\n"), szToken);
-      hr = GenerateError(E_ATL_BAD_HKEY);
-      break;
-    }
-
-    if (FAILED(hr = NextToken(szToken)))
-      break;
-
-    if (chLeftBracket != *szToken)
-    {
-      ATLTRACE(atlTraceRegistrar, 0, _T("Syntax error, expecting a {, found a %s\n"), szToken);
-      hr = GenerateError(E_ATL_MISSING_OPENKEY_TOKEN);
-      break;
-    }
-    if (bRegister)
-    {
-      LPTSTR szRegAtRegister = m_pchCur;
-      hr = RegisterSubkeys(szToken, hkBase, bRegister);
-      if (FAILED(hr))
-      {
-        ATLTRACE(atlTraceRegistrar, 0, _T("Failed to register, cleaning up!\n"));
-        m_pchCur = szRegAtRegister;
-        RegisterSubkeys(szToken, hkBase, FALSE);
-        break;
-      }
-    }
-    else
-    {
-      if (FAILED(hr = RegisterSubkeys(szToken, hkBase, bRegister)))
-        break;
-    }
-
-    SkipWhiteSpace();
-  }
-  CoTaskMemFree(szReg);
-  return hr;
-}
-
-inline HRESULT RegParser::RegisterSubkeys(__out_ecount_z(MAX_VALUE) LPTSTR szToken, __in HKEY hkParent, __in BOOL bRegister, __in BOOL bRecover)
-{
-  CRegKey keyCur;
-  LONG    lRes;
-  TCHAR  szKey[_MAX_PATH];
-  BOOL    bDelete = TRUE;
-  BOOL    bInRecovery = bRecover;
-  HRESULT hr = S_OK;
-
-  ATLTRACE(atlTraceRegistrar, 2, _T("Num Els = %d\n"), cbNeverDelete);
-  if (FAILED(hr = NextToken(szToken)))
-    return hr;
-
-
-  while (*szToken != chRightBracket) // Continue till we see a }
-  {
-
-
-    bDelete = TRUE;
-    BOOL bTokenDelete = !lstrcmpi(szToken, szDelete);
-
-    if (!lstrcmpi(szToken, szForceRemove) || bTokenDelete)
-    {
-      if (FAILED(hr = NextToken(szToken)))
-        break;
-
-      if (bRegister)
-      {
-        CRegKey rkForceRemove;
-
-        if (StrChr(szToken, chDirSep) != NULL)
-          return GenerateError(E_ATL_COMPOUND_KEY);
-
-        if (CanForceRemoveKey(szToken))
-        {
-          rkForceRemove.Attach(hkParent);
-          // Error not returned. We will overwrite the values any way.
-          rkForceRemove.RecurseDeleteKey(szToken);
-          rkForceRemove.Detach();
-        }
-        if (bTokenDelete)
-        {
-          if (FAILED(hr = NextToken(szToken)))
-            break;
-          if (FAILED(hr = SkipAssignment(szToken)))
-            break;
-          goto EndCheck;
-        }
-      }
-
-    }
-
-    if (!lstrcmpi(szToken, szNoRemove))
-    {
-      bDelete = FALSE;    // set even for register
-      if (FAILED(hr = NextToken(szToken)))
-        break;
-    }
-
-    if (!lstrcmpi(szToken, szValToken)) // need to add a value to hkParent
-    {
-      TCHAR  szValueName[_MAX_PATH];
-
-
-
-      if (FAILED(hr = NextToken(szValueName)))
-        break;
-      if (FAILED(hr = NextToken(szToken)))
-        break;
-
-      if (*szToken != chEquals)
-        return GenerateError(E_ATL_EXPECTING_EQUAL);
-
-      if (bRegister)
-      {
-        CRegKey rk;
-
-        rk.Attach(hkParent);
-        hr = AddValue(rk, szValueName, szToken);
-        rk.Detach();
-
-        if (FAILED(hr))
-          return hr;
-
-        goto EndCheck;
-      }
-      else
-      {
-        if (!bRecover && bDelete)
-        {
-          ATLTRACE(atlTraceRegistrar, 1, _T("Deleting %s\n"), szValueName);
-          // We have to open the key for write to be able to delete.
-          CRegKey rkParent;
-          lRes = rkParent.Open(hkParent, NULL, KEY_WRITE);
-          if (lRes == ERROR_SUCCESS)
-          {
-            lRes = rkParent.DeleteValue(szValueName);
-            if (lRes != ERROR_SUCCESS && lRes != ERROR_FILE_NOT_FOUND)
-            {
-              // Key not present is not an error
-              hr = AtlHresultFromWin32(lRes);
-              break;
-            }
-          }
-          else
-          {
-            hr = AtlHresultFromWin32(lRes);
-            break;
-          }
-        }
-        if (FAILED(hr = SkipAssignment(szToken)))
-          break;
-        continue;  // can never have a subkey
-      }
-    }
-
-    if (StrChr(szToken, chDirSep) != NULL)
-      return GenerateError(E_ATL_COMPOUND_KEY);
-
-    if (bRegister)
-    {
-      lRes = keyCur.Open(hkParent, szToken, KEY_READ | KEY_WRITE);
-      if (ERROR_SUCCESS != lRes)
-      {
-        // Failed all access try read only
-        lRes = keyCur.Open(hkParent, szToken, KEY_READ);
-        if (ERROR_SUCCESS != lRes)
-        {
-          // Finally try creating it
-          ATLTRACE(atlTraceRegistrar, 2, _T("Creating key %s\n"), szToken);
-          lRes = keyCur.Create(hkParent, szToken, REG_NONE, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE);
-          if (lRes != ERROR_SUCCESS)
-            return AtlHresultFromWin32(lRes);
-        }
-      }
-
-      if (FAILED(hr = NextToken(szToken)))
-        break;
-
-
-      if (*szToken == chEquals)
-      {
-        if (FAILED(hr = AddValue(keyCur, NULL, szToken))) // NULL == default
-          break;
-      }
-    }
-    else //Unregister
-    {
-      if (!bRecover)
-      {
-         lRes = keyCur.Open(hkParent, szToken, KEY_READ);
-
-      }
-      else
-        lRes = ERROR_FILE_NOT_FOUND;
-
-
-      // Open failed set recovery mode
-      if (lRes != ERROR_SUCCESS)
-        bRecover = true;
-
-      // TRACE out Key open status and if in recovery mode
-#ifdef _DEBUG
-      if (!bRecover)
-        ATLTRACE(atlTraceRegistrar, 1, _T("Opened Key %s\n"), szToken);
-      else
-        ATLTRACE(atlTraceRegistrar, 0, _T("Ignoring Open key on %s : In Recovery mode\n"), szToken);
-#endif //_DEBUG
-
-      // Remember Subkey
-      Checked::tcsncpy_s(szKey, _countof(szKey), szToken, _TRUNCATE);
-
-      if (FAILED(hr = NextToken(szToken)))
-        break;
-      if (FAILED(hr = SkipAssignment(szToken)))
-        break;
-
-      if (*szToken == chLeftBracket && lstrlen(szToken) == 1)
-      {
-        hr = RegisterSubkeys(szToken, keyCur.m_hKey, bRegister, bRecover);
-        // In recover mode ignore error
-        if (FAILED(hr) && !bRecover)
-          break;
-        // Skip the }
-        if (FAILED(hr = NextToken(szToken)))
-          break;
-      }
-
-#ifdef _DEBUG
-      if (bRecover != bInRecovery)
-        ATLTRACE(atlTraceRegistrar, 0, _T("Ending Recovery Mode\n"));
-#endif
-      bRecover = bInRecovery;
-
-      if (lRes == ERROR_FILE_NOT_FOUND)
-        // Key already not present so not an error.
-        continue;
-
-      if (lRes != ERROR_SUCCESS)
-      {
-        // We are recovery mode continue on errors else break
-        if (bRecover)
-          continue;
-        else
-        {
-          hr = AtlHresultFromWin32(lRes);
-          break;
-        }
-      }
-
-      // If in recovery mode
-      if (bRecover && HasSubKeys(keyCur))
-      {
-        // See if the KEY is in the NeverDelete list and if so, don't
-        if (CanForceRemoveKey(szKey) && bDelete)
-        {
-          ATLTRACE(atlTraceRegistrar, 0, _T("Deleting non-empty subkey %s by force\n"), szKey);
-          // Error not returned since we are in recovery mode. The error that caused recovery mode is returned
-          keyCur.RecurseDeleteKey(szKey);
-        }
-        continue;
-      }
-
-      BOOL bHasSubKeys=HasSubKeys(keyCur);
-      lRes = keyCur.Close();
-      if (lRes != ERROR_SUCCESS)
-      return AtlHresultFromWin32(lRes);
-
-      if (bDelete&& !bHasSubKeys)
-      {
-        ATLTRACE(atlTraceRegistrar, 0, _T("Deleting Key %s\n"), szKey);
-        CRegKey rkParent;
-        rkParent.Attach(hkParent);
-        lRes = rkParent.DeleteSubKey(szKey);
-        rkParent.Detach();
-        if (lRes != ERROR_SUCCESS)
-        {
-
-          hr = AtlHresultFromWin32(lRes);
-          break;
-        }
-      }
-
-
-
-
-    }
-
-EndCheck:
-
-    if (bRegister)
-    {
-      if (*szToken == chLeftBracket && lstrlen(szToken) == 1)
-      {
-        if (FAILED(hr = RegisterSubkeys(szToken, keyCur.m_hKey, bRegister, FALSE)))
-          break;
-        if (FAILED(hr = NextToken(szToken)))
-          break;
-      }
-    }
-  }
-
-  return hr;
-}
-
-};  //namespace omaha
-
-#endif  //OMAHA_BASE_STATREGEX_H__
-
diff --git a/base/store_watcher.h b/base/store_watcher.h
deleted file mode 100644
index fb55e24..0000000
--- a/base/store_watcher.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-//
-// A simple interface for monitoring changes
-// happening to a store.
-//
-#ifndef OMAHA_COMMON_STORE_WATCHER_H_
-#define OMAHA_COMMON_STORE_WATCHER_H_
-
-#include "omaha/base/synchronized.h"
-
-namespace omaha {
-
-// Allows for monitoring changes happening to a store
-// (independant of what the underlying store is).
-class StoreWatcher {
- public:
-  StoreWatcher() {}
-  virtual ~StoreWatcher() {}
-
-  // Called to create/reset the event that gets signaled
-  // any time the store changes.  Access the created
-  // event using change_event().
-  virtual HRESULT EnsureEventSetup() = 0;
-
-  // Indicates if any changes have occured
-  bool HasChangeOccurred() const {
-    return IsHandleSignaled(change_event());
-  }
-
-  // Get the event that is signaled on store changes.
-  // Note:
-  //   * This event will remain constant until the class is destroyed.
-  //   * One should call EnsureEventSetup to set-up the event.
-  //   * The event is only signaled on the next change and remains signaled.
-  //     Do not call ::ResetEvent(). Call EnsureEventSetup() to reset
-  //     the event and wait for more changes.
-  virtual HANDLE change_event() const = 0;
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(StoreWatcher);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_STORE_WATCHER_H_
diff --git a/base/string.cc b/base/string.cc
deleted file mode 100644
index a206660..0000000
--- a/base/string.cc
+++ /dev/null
@@ -1,3391 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/string.h"
-
-#include <wininet.h>        // For INTERNET_MAX_URL_LENGTH.
-#include <algorithm>
-#include <cstdlib>
-#include "base/scoped_ptr.h"
-#include "omaha/base/commontypes.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/localization.h"
-#include "omaha/base/logging.h"
-
-namespace omaha {
-
-namespace {
-// Testing shows that only the following ASCII characters are
-// considered spaces by GetStringTypeA: 9-13, 32, 160.
-// Rather than call GetStringTypeA with no locale, as we used to,
-// we look up the values directly in a precomputed array.
-
-SELECTANY byte spaces[256] = {
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 1,  // 0-9
-  1, 1, 1, 1, 0, 0, 0, 0, 0, 0,  // 10-19
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 20-29
-  0, 0, 1, 0, 0, 0, 0, 0, 0, 0,  // 30-39
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 40-49
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 50-59
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 60-69
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 70-79
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 80-89
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 90-99
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 100-109
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 110-119
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 120-129
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 130-139
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 140-149
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 150-159
-  1, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 160-169
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 170-179
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 180-189
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 190-199
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 200-209
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 210-219
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 220-229
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 230-239
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 240-249
-  0, 0, 0, 0, 0, 1,              // 250-255
-};
-}  // namespace
-
-const TCHAR* const kFalse = _T("false");
-const TCHAR* const kTrue  = _T("true");
-
-bool IsSpaceW(WCHAR c) {
-  // GetStringTypeW considers these characters to be spaces:
-  // 9-13, 32, 133, 160, 5760, 8192-8203, 8232, 8233, 12288
-  if (c < 256)
-    return (c == 133 || IsSpaceA((char) (c & 0xff)));
-
-  return (c >= 8192 && c <= 8203) || c == 8232 ||
-    c == 8233 || c == 12288;
-}
-
-bool IsSpaceA(char c) {
-  return spaces[static_cast<unsigned char>(c)] == 1;
-}
-
-int TrimCString(CString &s) {
-  int len = Trim(s.GetBuffer());
-  s.ReleaseBufferSetLength(len);
-  return len;
-}
-
-void MakeLowerCString(CString & s) {
-  int len = s.GetLength();
-  String_FastToLower(s.GetBuffer());
-  s.ReleaseBufferSetLength(len);
-}
-
-int Trim(TCHAR *s) {
-  ASSERT(s, (L""));
-
-  // First find end of leading spaces
-  TCHAR *start = s;
-  while (*start) {
-    if (!IsSpace(*start))
-      break;
-    ++start;
-  }
-
-  // Now search for the end, remembering the start of the last spaces
-  TCHAR *end = start;
-  TCHAR *last_space = end;
-  while (*end) {
-    if (!IsSpace(*end))
-      last_space = end + 1;
-    ++end;
-  }
-
-  // Copy the part we want
-  int len = last_space - start;
-  // lint -e{802}  Conceivably passing a NULL pointer
-  memmove(s, start, len * sizeof(TCHAR));
-
-  // 0 terminate
-  s[len] = 0;
-
-  return len;
-}
-
-void TrimString(CString& s, const TCHAR* delimiters) {
-  s = s.Trim(delimiters);
-}
-
-// Strip the first token from the front of argument s.  A token is a
-// series of consecutive non-blank characters - unless the first
-// character is a double-quote ("), in that case the token is the full
-// quoted string
-CString StripFirstQuotedToken(const CString& s) {
-  const int npos = -1;
-
-  // Make a writeable copy
-  CString str(s);
-
-  // Trim any surrounding blanks (and tabs, for the heck of it)
-  TrimString(str, L" \t");
-
-  // Too short to have a second token
-  if (str.GetLength() <= 1)
-    return L"";
-
-  // What kind of token are we stripping?
-  if (str[0] == L'\"') {
-    // Remove leading quoting string
-    int i = str.Find(L"\"", 1);
-    if (i != npos)
-      i++;
-    return str.Mid(i);
-  } else {
-    // Remove leading token
-    int i = str.FindOneOf(L" \t");
-    if (i != npos)
-      i++;
-    return str.Mid(i);
-  }
-}
-
-// A block of text to separate lines, and back
-void TextToLines(const CString& text, const TCHAR* delimiter, std::vector<CString>* lines) {
-  ASSERT(delimiter, (L""));
-  ASSERT(lines, (L""));
-
-  size_t delimiter_len = ::lstrlen(delimiter);
-  int b = 0;
-  int e = 0;
-
-  for (b = 0; e != -1 && b < text.GetLength(); b = e + delimiter_len) {
-    e = text.Find(delimiter, b);
-    if (e != -1) {
-      ASSERT1(e - b > 0);
-      lines->push_back(text.Mid(b, e - b));
-    } else {
-      lines->push_back(text.Mid(b));
-    }
-  }
-}
-
-void LinesToText(const std::vector<CString>& lines, const TCHAR* delimiter, CString* text) {
-  ASSERT(delimiter, (L""));
-  ASSERT(text, (L""));
-
-  size_t delimiter_len = ::lstrlen(delimiter);
-  size_t len = 0;
-  for (size_t i = 0; i < lines.size(); ++i) {
-    len += lines[i].GetLength() + delimiter_len;
-  }
-  text->Empty();
-  text->Preallocate(len);
-  for (std::vector<CString>::size_type i = 0; i < lines.size(); ++i) {
-    text->Append(lines[i]);
-    if (delimiter_len) {
-      text->Append(delimiter);
-    }
-  }
-}
-
-int CleanupWhitespaceCString(CString &s) {
-  int len = CleanupWhitespace(s.GetBuffer());
-  s.ReleaseBufferSetLength(len);
-  return len;
-}
-
-int CleanupWhitespace(TCHAR *str) {
-  ASSERT(str, (L""));
-
-  TCHAR *src      = str;
-  TCHAR *dest     = str;
-  int    spaces   = 0;
-  bool   at_start = true;
-  while (true) {
-    // At end of string?
-    TCHAR c = *src;
-    if (0 == c)
-      break;
-
-    // Look for whitespace; copy it over if not whitespace
-    if (IsSpace(c)) {
-      ++spaces;
-    }
-    else {
-      *dest++ = c;
-      at_start = false;
-      spaces = 0;
-    }
-
-    // Write only first consecutive space (but skip space at start)
-    if (1 == spaces && !at_start)
-      *dest++ = ' ';
-
-    ++src;
-  }
-
-  // Remove trailing space, if any
-  if (dest > str && *(dest - 1) == L' ')
-    --dest;
-
-  // 0-terminate
-  *dest = 0;
-
-  return dest - str;
-}
-
-// Take 1 single hexadecimal "digit" (as a character) and return its decimal value
-// Returns -1 if given invalid hex digit
-int HexDigitToDec(const TCHAR digit) {
-  if (digit >= L'A' && digit <= L'F')
-    return 10 + (digit - L'A');
-  else if (digit >= L'a' && digit <= L'f')
-    return 10 + (digit - L'a');
-  else if (digit >= L'0' && digit <= L'9')
-    return (digit - L'0');
-  else
-    return -1;
-}
-
-// Convert the 2 hex chars at positions <pos> and <pos>+1 in <s> to a char (<char_out>)
-// Note: scanf was giving me troubles, so here's the manual version
-// Extracted char gets written to <char_out>, which must be allocated by
-// the caller; return true on success or false if parameters are incorrect
-// or string does not have 2 hex digits at the specified position
-// NOTE: <char_out> is NOT a string, just a pointer to a char for the result
-bool ExtractChar(const CString & s, int pos, unsigned char * char_out) {
-  // char_out may be NULL
-
-  if (s.GetLength() < pos + 1) {
-    return false;
-  }
-
-  if (pos < 0 || NULL == char_out) {
-    ASSERT(0, (_T("invalid params: pos<0 or char_out is NULL")));
-    return false;
-  }
-
-  TCHAR c1 = s.GetAt(pos);
-  TCHAR c2 = s.GetAt(pos+1);
-
-  int p1 = HexDigitToDec(c1);
-  int p2 = HexDigitToDec(c2);
-
-  if (p1 == -1 || p2 == -1) {
-    return false;
-  }
-
-  *char_out = (unsigned char)(p1 * 16 + p2);
-  return true;
-}
-
-WCHAR *ToWide (const char *s, int len) {
-    ASSERT (s, (L""));
-    WCHAR *w = new WCHAR [len+1]; if (!w) { return NULL; }
-    // int rc = MultiByteToWideChar (CP_ACP, 0, s.GetString(), (int)s.GetLength()+1, w, s.GetLength()+1);
-    // TODO(omaha): why would it ever be the case that rc > len?
-    int rc = MultiByteToWideChar (CP_ACP, 0, s, len, w, len);
-    if (rc > len) { delete [] w; return NULL; }
-    // ASSERT (rc <= len, (L""));
-    w[rc]=L'\0';
-    return w;
-}
-
-const byte *BufferContains (const byte *buf, uint32 buf_len, const byte *data, uint32 data_len) {
-  ASSERT(data, (L""));
-  ASSERT(buf, (L""));
-
-  for (uint32 i = 0; i < buf_len; i++) {
-    uint32 j = i;
-    uint32 k = 0;
-    uint32 len = 0;
-    while (j < buf_len && k < data_len && buf[j++] == data[k++]) { len++; }
-    if (len == data_len) { return buf + i; }
-  }
-  return 0;
-}
-
-// Converting the Ansi Multibyte String into unicode string. The multibyte
-// string is encoded using the specified codepage.
-// The code is pretty much like the U2W function, except the codepage can be
-// any valid windows CP.
-BOOL AnsiToWideString(const char *from, int length, UINT codepage, CString *to) {
-  ASSERT(from, (L""));
-  ASSERT(to, (L""));
-  ASSERT1(length >= -1);
-  // Figure out how long the string is
-  int req_chars = MultiByteToWideChar(codepage, 0, from, length, NULL, 0);
-
-  if (req_chars <= 0) {
-    UTIL_LOG(LEVEL_WARNING, (_T("MultiByteToWideChar Failed ")));
-    *to = AnsiToWideString(from, length);
-    return FALSE;
-  }
-
-  TCHAR *buffer = to->GetBufferSetLength(req_chars);
-  int conv_chars = MultiByteToWideChar(codepage, 0, from, length, buffer, req_chars);
-  if (conv_chars == 0) {
-    UTIL_LOG(LEVEL_WARNING, (_T("MultiByteToWideChar Failed ")));
-    to->ReleaseBuffer(0);
-    *to = AnsiToWideString(from, length);
-    return FALSE;
-  }
-
-  // Something truly horrible happened.
-  ASSERT (req_chars == conv_chars, (L"MBToWide returned unexpected value: GetLastError()=%d",GetLastError()));
-  // If length was inferred, conv_chars includes the null terminator.
-  // Adjust the length here to remove null termination,
-  // because we use the length-qualified CString constructor,
-  // which automatically adds null termination given an unterminated array.
-  if (-1 == length) { --conv_chars; }
-  to->ReleaseBuffer(conv_chars);
-  return TRUE;
-}
-
-// CStringW(const char* from) did not cast all character properly
-// so we write our own.
-CString AnsiToWideString(const char *from, int length) {
-  ASSERT(from, (L""));
-  ASSERT1(length >= -1);
-  if (length < 0)
-    length = strlen(from);
-  CString to;
-  TCHAR *buffer = to.GetBufferSetLength(length);
-  for (int i = 0; i < length; ++i)
-      buffer[i] = static_cast<UINT8>(from[i]);
-  to.ReleaseBuffer(length);
-  return to;
-}
-
-
-// Transform a unicode string into UTF8, as represented in an ASCII string
-CStringA WideToUtf8(const CString& w) {
-  // Add a cutoff. If it's all ascii, convert it directly
-  const TCHAR* input = static_cast<const TCHAR*>(w.GetString());
-  int input_len = w.GetLength(), i;
-  for (i = 0; i < input_len; ++i) {
-    if (input[i] > 127) {
-      break;
-    }
-  }
-
-  // If we made it to the end without breaking, then it's all ANSI, so do a quick convert
-  if (i == input_len) {
-    return WideToAnsiDirect(w);
-  }
-
-  // Figure out how long the string is
-  int req_bytes = ::WideCharToMultiByte(CP_UTF8, 0, w, -1, NULL, 0, NULL, NULL);
-
-  scoped_array<char> utf8_buffer(new char[req_bytes]);
-
-  int conv_bytes = ::WideCharToMultiByte(CP_UTF8, 0, w, -1, utf8_buffer.get(), req_bytes, NULL, NULL);
-  ASSERT1(req_bytes == conv_bytes);
-
-  // conv_bytes includes the null terminator, when we read this in, don't read the terminator
-  CStringA out(utf8_buffer.get(), conv_bytes - 1);
-
-  return out;
-}
-
-CString Utf8ToWideChar(const char* utf8, uint32 num_bytes) {
-  ASSERT1(utf8);
-  if (num_bytes == 0) {
-    return CString();
-  }
-
-  uint32 number_of_wide_chars = ::MultiByteToWideChar(CP_UTF8, 0, utf8, num_bytes, NULL, 0);
-  number_of_wide_chars += 1;  // make room for NULL terminator
-
-  CString ret_string;
-  TCHAR* buffer = ret_string.GetBuffer(number_of_wide_chars);
-  DWORD number_of_characters_copied = ::MultiByteToWideChar(CP_UTF8, 0, utf8, num_bytes, buffer, number_of_wide_chars);
-  ASSERT1(number_of_characters_copied == number_of_wide_chars - 1);
-  buffer[number_of_wide_chars - 1] = _T('\0');  // ensure there is a NULL terminator
-  ret_string.ReleaseBuffer();
-
-  // Strip the byte order marker if there is one in the document.
-  if (ret_string[0] == kUnicodeBom) {
-    ret_string = ret_string.Right(ret_string.GetLength() - 1);
-  }
-
-  if (number_of_characters_copied > 0) {
-    return ret_string;
-  }
-
-  // Failure case
-  return CString();
-}
-
-CString Utf8BufferToWideChar(const std::vector<uint8>& buffer) {
-  CString result;
-  if (!buffer.empty()) {
-    result = Utf8ToWideChar(
-        reinterpret_cast<const char*>(&buffer.front()), buffer.size());
-  }
-  return result;
-}
-
-CString AbbreviateString (const CString & title, int32 max_len) {
-    ASSERT (max_len, (L""));
-    CString s(title);
-    TrimCString(s);  // remove whitespace at start/end
-    if (s.GetLength() > max_len) {
-        s = s.Left (max_len - 2);
-        CString orig(s);
-        // remove partial words
-        while (s.GetLength() > 1 && !IsSpace(s[s.GetLength()-1])) { s = s.Left (s.GetLength() - 1); }
-        // but not if it would make the string very short
-        if (s.GetLength() < max_len / 2) { s = orig; }
-        s += _T("..");
-        }
-
-    return s;
-}
-
-CString GetAbsoluteUri(const CString& uri) {
-  int i = String_FindString(uri, _T("://"));
-  if (i==-1) return uri;
-
-  // add trailing / if none exists
-  int j = String_FindChar(uri, L'/',i+3);
-  if (j==-1) return (uri+NOTRANSL(_T("/")));
-
-  // remove duplicate trailing slashes
-  int len = uri.GetLength();
-  if (len > 1 && uri.GetAt(len-1) == '/' && uri.GetAt(len-2) == '/') {
-    CString new_uri(uri);
-    int new_len = new_uri.GetLength();
-    while (new_len > 1 && new_uri.GetAt(new_len-1) == '/' && new_uri.GetAt(new_len-2) == '/') {
-      new_len--;
-      new_uri = new_uri.Left(new_len);
-    }
-    return new_uri;
-  }
-  else return uri;
-}
-
-// requires that input have a PROTOCOL (http://) for proper behavior
-// items with the "file" protocol are returned as is (what is the hostname in that case? C: ? doesn't make sense)
-// TODO(omaha): loosen requirement
-// includes http://, e.g. http://www.google.com/
-CString GetUriHostName(const CString& uri, bool strip_leading) {
-  if (String_StartsWith(uri,NOTRANSL(_T("file:")),true)) return uri;
-
-  // correct any "errors"
-  CString s(GetAbsoluteUri(uri));
-
-  // Strip the leading "www."
-  if (strip_leading)
-  {
-    int index_www = String_FindString(s, kStrLeadingWww);
-    if (index_www != -1)
-      ReplaceCString (s, kStrLeadingWww, _T(""));
-  }
-
-  int i = String_FindString(s, _T("://"));
-  if(i==-1) return uri;
-  int j = String_FindChar(s, L'/',i+3);
-  if(j==-1) return uri;
-  return s.Left(j+1);
-}
-
-// requires that input have a PROTOCOL (http://) for proper behavior
-// TODO(omaha): loosen requirement
-// removes the http:// and the extra slash '/' at the end.
-// http://www.google.com/ -> www.google.com (or google.com if strip_leading = true)
-CString GetUriHostNameHostOnly(const CString& uri, bool strip_leading) {
-  CString s(GetUriHostName(uri,strip_leading));
-
-  // remove protocol
-  int i = String_FindString (s, _T("://"));
-  if(i==-1) return s;
-  CString ss(s.Right (s.GetLength() - i-3));
-
-  // remove the last '/'
-  int j = ss.ReverseFind('/');
-  if (j == -1) return ss;
-  return ss.Left(j);
-}
-
-CString AbbreviateUri(const CString& uri, int32 max_len) {
-  ASSERT1(max_len);
-  ASSERT1(!uri.IsEmpty());
-
-  CString s(uri);
-  VERIFY1(String_FindString (s, _T("://")));
-
-  TrimCString(s);
-  // SKIP_LOC_BEGIN
-  RemoveFromStart (s, _T("ftp://"), false);
-  RemoveFromStart (s, _T("http://"), false);
-  RemoveFromStart (s, _T("https://"), false);
-  RemoveFromStart (s, _T("www."), false);
-  RemoveFromStart (s, _T("ftp."), false);
-  RemoveFromStart (s, _T("www-"), false);
-  RemoveFromStart (s, _T("ftp-"), false);
-  RemoveFromEnd (s, _T(".htm"));
-  RemoveFromEnd (s, _T(".html"));
-  RemoveFromEnd (s, _T(".asp"));
-  // SKIP_LOC_END
-  if (s.GetLength() > max_len) {
-    // try to keep the portion after the last /
-    int32 last_slash = s.ReverseFind ((TCHAR)'/');
-    CString after_last_slash;
-    if (last_slash == -1) { after_last_slash = _T(""); }
-    else { after_last_slash = s.Right (uri.GetLength() - last_slash - 1); }
-    if (after_last_slash.GetLength() > max_len / 2) {
-        after_last_slash = after_last_slash.Right (max_len / 2);
-    }
-    s = s.Left (max_len - after_last_slash.GetLength() - 2);
-    s += "..";
-    s += after_last_slash;
-  }
-  return s;
-}
-
-// normalized version of a URI intended to map duplicates to the same string
-// the normalized URI is not a valid URI
-CString NormalizeUri (const CString & uri) {
-  CString s(uri);
-  TrimCString(s);
-  MakeLowerCString(s);
-  // SKIP_LOC_BEGIN
-  ReplaceCString (s, _T(":80"), _T(""));
-
-  RemoveFromEnd (s, _T("/index.html"));
-  RemoveFromEnd (s, _T("/welcome.html"));  // old netscape standard
-  RemoveFromEnd (s, _T("/"));
-
-  RemoveFromStart (s, _T("ftp://"), false);
-  RemoveFromStart (s, _T("http://"), false);
-  RemoveFromStart (s, _T("https://"), false);
-  RemoveFromStart (s, _T("www."), false);
-  RemoveFromStart (s, _T("ftp."), false);
-  RemoveFromStart (s, _T("www-"), false);
-  RemoveFromStart (s, _T("ftp-"), false);
-
-  ReplaceCString (s, _T("/./"), _T("/"));
-  // SKIP_LOC_END
-
-  // TODO(omaha):
-  // fixup URLs like a/b/../../c
-  // while ($s =~ m!\/\.\.\!!) {
-  //    $s =~ s!/[^/]*/\.\./!/!;
-  //    }
-
-  // TODO(omaha):
-  // unescape characters
-  // Note from RFC1630:  "Sequences which start with a percent sign
-  // but are not followed by two hexadecimal characters are reserved
-  // for future extension"
-  // $str =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg if defined $str;
-
-  return s;
-}
-
-CString RemoveInternetProtocolHeader (const CString& url) {
-  int find_colon_slash_slash = String_FindString(url, NOTRANSL(L"://"));
-  if( find_colon_slash_slash != -1 ) {
-    // remove PROTOCOL://
-    return url.Right(url.GetLength() - find_colon_slash_slash - 3);
-  } else if (String_StartsWith(url, NOTRANSL(L"mailto:"), true)) {
-    // remove "mailto:"
-    return url.Right(url.GetLength() - 7);
-  } else {
-    // return as is
-    return url;
-  }
-}
-
-HRESULT ConvertFileUriToLocalPath(const CString& uri, CString* path_out) {
-  ASSERT1(path_out);
-  ASSERT1(uri.GetLength() < INTERNET_MAX_URL_LENGTH);
-
-  if (uri.IsEmpty()) {
-    return E_INVALIDARG;
-  }
-
-  DWORD buf_len = MAX_PATH;
-  HRESULT hr = ::PathCreateFromUrl(uri,
-                                   CStrBuf(*path_out, MAX_PATH),
-                                   &buf_len,
-                                   NULL);
-  return hr;
-}
-
-void RemoveFromStart (CString & s, const TCHAR* remove, bool ignore_case) {
-  ASSERT(remove, (L""));
-
-  // Remove the characters if it is the prefix
-  if (String_StartsWith(s, remove, ignore_case))
-    s.Delete(0, lstrlen(remove));
-}
-
-bool String_EndsWith(const TCHAR *str, const TCHAR *end_str, bool ignore_case) {
-  ASSERT(end_str, (L""));
-  ASSERT(str, (L""));
-
-  int str_len = lstrlen(str);
-  int end_len = lstrlen(end_str);
-
-  // Definitely false if the suffix is longer than the string
-  if (end_len > str_len)
-    return false;
-
-  const TCHAR *str_ptr = str + str_len;
-  const TCHAR *end_ptr = end_str + end_len;
-
-  while (end_ptr >= end_str) {
-    // Check for matching characters
-    TCHAR c1 = *str_ptr;
-    TCHAR c2 = *end_ptr;
-
-    if (ignore_case) {
-      c1 = Char_ToLower(c1);
-      c2 = Char_ToLower(c2);
-    }
-
-    if (c1 != c2)
-      return false;
-
-    --str_ptr;
-    --end_ptr;
-  }
-
-  // if we haven't failed out, it must be ok!
-  return true;
-}
-
-CString String_MakeEndWith(const TCHAR* str, const TCHAR* end_str, bool ignore_case) {
-  if (String_EndsWith(str, end_str, ignore_case)) {
-    return str;
-  } else {
-    CString r(str);
-    r += end_str;
-    return r;
-  }
-}
-
-void RemoveFromEnd (CString & s, const TCHAR* remove) {
-  ASSERT(remove, (L""));
-
-  // If the suffix is shorter than the string, don't bother
-  int remove_len = lstrlen(remove);
-  if (s.GetLength() < remove_len) return;
-
-  // If the suffix is equal
-  int suffix_begin = s.GetLength() - remove_len;
-  if (0 == lstrcmp(s.GetString() + suffix_begin, remove))
-    s.Delete(suffix_begin, remove_len);
-}
-
-CString ElideIfNeeded (const CString & input_string, int max_len, int min_len) {
-  ASSERT (min_len <= max_len, (L""));
-  ASSERT (max_len >= TSTR_SIZE(kEllipsis)+1, (L""));
-  ASSERT (min_len >= TSTR_SIZE(kEllipsis)+1, (L""));
-
-  CString s = input_string;
-
-  s.TrimRight();
-  if (s.GetLength() > max_len) {
-    int truncate_at = max_len - TSTR_SIZE(kEllipsis);
-    // find first space going backwards from character one after the truncation point
-    while (truncate_at >= min_len && !IsSpace(s.GetAt(truncate_at)))
-      truncate_at--;
-
-    // skip the space(s)
-    while (truncate_at >= min_len && IsSpace(s.GetAt(truncate_at)))
-      truncate_at--;
-
-    truncate_at++;
-
-    if (truncate_at <= min_len || truncate_at > (max_len - static_cast<int>(TSTR_SIZE(kEllipsis)))) {
-      // we weren't able to break at a word boundary, may as well use more of the string
-      truncate_at = max_len - TSTR_SIZE(kEllipsis);
-
-      // skip space(s)
-      while (truncate_at > 0 && IsSpace(s.GetAt(truncate_at-1)))
-        truncate_at--;
-    }
-
-    s = s.Left(truncate_at);
-    s += kEllipsis;
-  }
-
-  UTIL_LOG(L6, (L"elide (%d %d) %s -> %s", min_len, max_len, input_string, s));
-  return s;
-}
-
-// these functions untested
-// UTF8 parameter supported on XP/2000 only
-HRESULT AnsiToUTF8 (char * src, int src_len, char * dest, int *dest_len) {
-  ASSERT (dest_len, (L""));
-  ASSERT (dest, (L""));
-  ASSERT (src, (L""));
-
-  // First use MultiByteToWideChar(CP_UTF8, ...) to convert to Unicode
-  // then use WideCharToMultiByte to convert from Unicode to UTF8
-  WCHAR *unicode = new WCHAR [(src_len + 1) * sizeof (TCHAR)]; ASSERT (unicode, (L""));
-  int chars_written = MultiByteToWideChar (CP_ACP, 0, src, src_len, unicode, src_len);
-  ASSERT (chars_written == src_len, (L""));
-  char *unmappable = " ";
-  BOOL unmappable_characters = false;
-  *dest_len = WideCharToMultiByte (CP_UTF8, 0, unicode, chars_written, dest, *dest_len, unmappable, &unmappable_characters);
-  delete [] unicode;
-  return S_OK;
-}
-
-// Convert Wide to ANSI directly. Use only when it is all ANSI
-CStringA WideToAnsiDirect(const CString & in) {
-  int in_len = in.GetLength();
-  const TCHAR * in_buf = static_cast<const TCHAR*>(in.GetString());
-
-  CStringA out;
-  unsigned char * out_buf = (unsigned char *)out.GetBufferSetLength(in_len);
-
-  for(int i = 0; i < in_len; ++i)
-    out_buf[i] = static_cast<unsigned char>(in_buf[i]);
-
-  out.ReleaseBuffer(in_len);
-  return out;
-}
-
-HRESULT UCS2ToUTF8 (LPCWSTR src, int src_len, char * dest, int *dest_len) {
-  ASSERT(dest_len, (L""));
-  ASSERT(dest, (L""));
-
-  *dest_len = WideCharToMultiByte (CP_UTF8, 0, src, src_len, dest, *dest_len, NULL,NULL);
-  return S_OK;
-}
-
-HRESULT UTF8ToUCS2 (const char * src, int src_len, LPWSTR dest, int *dest_len) {
-  ASSERT (dest_len, (L""));
-  ASSERT (src, (L""));
-
-  *dest_len = MultiByteToWideChar (CP_UTF8, 0, src, src_len, dest, *dest_len);
-  ASSERT (*dest_len == src_len, (L""));
-  return S_OK;
-}
-
-HRESULT UTF8ToAnsi (char * src, int, char * dest, int *dest_len) {
-  ASSERT(dest_len, (L""));
-  ASSERT(dest, (L""));
-  ASSERT(src, (L""));
-
-  src; dest; dest_len;  // unreferenced formal parameter
-
-  // First use MultiByteToWideChar(CP_UTF8, ...) to convert to Unicode
-  // then use WideCharToMultiByte to convert from Unicode to ANSI
-  return E_FAIL;
-}
-
-// clean up a string so it can be included within a JavaScript string
-// mainly involves escaping characters
-CString SanitizeString(const CString & in, DWORD mode) {
-  CString out(in);
-
-  if (mode & kSanHtml) {
-    // SKIP_LOC_BEGIN
-    ReplaceCString(out, _T("&"), _T("&amp;"));
-    ReplaceCString(out, _T("<"), _T("&lt;"));
-    ReplaceCString(out, _T(">"), _T("&gt;"));
-    // SKIP_LOC_END
-  }
-
-  if ((mode & kSanXml) == kSanXml) {
-    // SKIP_LOC_BEGIN
-    ReplaceCString(out, _T("'"), _T("&apos;"));
-    ReplaceCString(out, _T("\""), _T("&quot;"));
-    // SKIP_LOC_END
-  }
-
-  // Note that this SAN_JAVASCRIPT and kSanXml should not be used together.
-  ASSERT ((mode & (kSanJs | kSanXml)) != (kSanJs | kSanXml), (L""));
-
-  if ((mode & kSanJs) == kSanJs) {
-    // SKIP_LOC_BEGIN
-    ReplaceCString(out, _T("\\"), _T("\\\\"));
-    ReplaceCString(out, _T("\'"), _T("\\\'"));
-    ReplaceCString(out, _T("\""), _T("\\\""));
-    ReplaceCString(out, _T("\n"), _T(" "));
-    ReplaceCString(out, _T("\t"), _T(" "));
-    // SKIP_LOC_END
-  }
-
-  if ((mode & kSanHtmlInput) == kSanHtmlInput) {
-    // SKIP_LOC_BEGIN
-    ReplaceCString(out, _T("\""), _T("&quot;"));
-    ReplaceCString(out, _T("'"), _T("&#39;"));
-    // SKIP_LOC_END
-  }
-
-  return out;
-}
-
-// Bolds the periods used for abbreviation.  Call this after HighlightTerms.
-CString BoldAbbreviationPeriods(const CString & in) {
-  CString out(in);
-  CString abbrev;
-  for (int i = 0; i < kAbbreviationPeriodLength; ++i)
-    abbrev += _T(".");
-  ReplaceCString(out, abbrev, NOTRANSL(_T("<b>")) + abbrev + NOTRANSL(_T("</b>")));
-  return out;
-}
-
-// Unescape a escaped sequence leading by a percentage symbol '%',
-// and converted the unescaped sequence (in UTF8) into unicode.
-// Inputs:  src is the input string.
-//          pos is the starting position.
-// Returns: true if a EOS(null) char was encounted.
-//          out contains the unescaped and converted unicode string.
-//          consumed_length is how many bytes in the src string have been
-//          unescaped.
-// We can avoid the expensive UTF8 conversion step if there are no higher
-// ansi characters So if there aren't any, just convert it ANSI-to-WIDE
-// directly, which is cheaper.
-inline bool UnescapeSequence(const CString &src, int pos,
-                             CStringW *out, int *consumed_length) {
-  ASSERT1(out);
-  ASSERT1(consumed_length);
-
-  int length = src.GetLength();
-  // (input_len - pos) / 3 is enough for un-escaping the (%xx)+ sequences.
-  int max_dst_length = (length - pos) / 3;
-  scoped_array<char> unescaped(new char[max_dst_length]);
-  char *buf = unescaped.get();
-  if (buf == NULL) {  // no enough space ???
-    *consumed_length = 0;
-    return false;
-  }
-  char *dst = buf;
-  bool is_utf8 = false;
-  // It is possible that there is a null character '\0' in the sequence.
-  // Because the CStringT does't support '\0' in it, we stop
-  // parsing the input string when it is encounted.
-  bool eos_encounted = false;
-  uint8 ch;
-  int s = pos;
-  while (s + 2 < length && src[s] == '%' && !eos_encounted &&
-         ExtractChar(src, s + 1, &ch)) {
-    if (ch != 0)
-      *dst++ = ch;
-    else
-      eos_encounted = true;
-    if (ch >= 128)
-      is_utf8 = true;
-    s += 3;
-  }
-
-  ASSERT1(dst <= buf + max_dst_length);  // just to make sure
-
-  *consumed_length = s - pos;
-  if (is_utf8)
-    AnsiToWideString(buf, dst - buf, CP_UTF8, out);
-  else
-    *out = AnsiToWideString(buf, dst - buf);
-  return eos_encounted;
-}
-
-// There is an encoding called "URL-encoding". This function takes a URL-encoded string
-// and converts it back to the original representation
-// example: "?q=moon+doggy_%25%5E%26&" = "moon doggy_%^&"
-CString Unencode(const CString &input) {
-  const int input_len = input.GetLength();
-  const TCHAR *src = input.GetString();
-  // input_len is enough for containing the unencoded string.
-  CString out;
-  TCHAR *head = out.GetBuffer(input_len);
-  TCHAR *dst = head;
-  int s = 0;
-  bool eos_encounted = false;
-  bool is_utf8 = false;
-  CStringW fragment;
-  int consumed_length = 0;
-  while (s < input_len && !eos_encounted) {
-    switch (src[s]) {
-      case '+' :
-        *dst++ = ' ';
-        ASSERT1(dst <= head + input_len);
-        ++s;
-        break;
-      case '%' :
-        eos_encounted =
-          UnescapeSequence(input, s, &fragment, &consumed_length);
-        if (consumed_length > 0) {
-          s += consumed_length;
-          ASSERT1(dst + fragment.GetLength() <= head + input_len);
-          for (int i = 0; i < fragment.GetLength(); ++i)
-            *dst++ = fragment[i];
-        } else {
-          *dst++ = src[s++];
-          ASSERT1(dst <= head + input_len);
-        }
-        break;
-      default:
-        *dst++ = src[s];
-        ASSERT1(dst <= head + input_len);
-        ++s;
-    }
-  }
-  int out_len = dst - head;
-  out.ReleaseBuffer(out_len);
-  return out;
-}
-
-CString GetTextInbetween(const CString &input, const CString &start, const CString &end) {
-  int start_index = String_FindString(input, start);
-  if (start_index == -1)
-    return L"";
-
-  start_index += start.GetLength();
-  int end_index = String_FindString(input, end, start_index);
-  if (end_index == -1)
-    return L"";
-
-  return input.Mid(start_index, end_index - start_index);
-}
-
-// Given a string, get the parameter and url-unencode it
-CString GetParam(const CString & input, const CString & key) {
-  CString my_key(_T("?"));
-  my_key.Append(key);
-  my_key += L'=';
-
-  return Unencode(GetTextInbetween(input, my_key, NOTRANSL(L"?")));
-}
-
-// Get an xml-like field from a string
-CString GetField (const CString & input, const CString & field) {
-  CString start_field(NOTRANSL(_T("<")));
-  start_field += field;
-  start_field += L'>';
-
-  int32 start = String_FindString(input, start_field);
-  if (start == -1) { return _T(""); }
-  start += 2 + lstrlen (field);
-
-  CString end_field(NOTRANSL(_T("</")));
-  end_field += field;
-  end_field += L'>';
-
-  int32 end = String_FindString(input, end_field);
-  if (end == -1) { return _T(""); }
-
-  return input.Mid (start, end - start);
-}
-
-// ------------------------------------------------------------
-// Finds a whole word match in the query.
-// If the word has non-spaces either before or after, it will not qualify as
-//   a match.  i.e. "pie!" is not a match because of the exclamation point.
-// TODO(omaha): Add parameter that will consider punctuation acceptable.
-//
-// Optionally will look for a colon at the end.
-// If not found, return -1.
-int FindWholeWordMatch (const CString &query,
-  const CString &word_to_match,
-  const bool end_with_colon,
-  const int index_begin) {
-  if (word_to_match.IsEmpty()) {
-    return -1;
-  }
-
-  int index_word_begin = index_begin;
-
-  // Keep going until we find a whole word match, or the string ends.
-  do {
-    index_word_begin = String_FindString (query, word_to_match, index_word_begin);
-
-    if (-1 == index_word_begin) {
-      return index_word_begin;
-    }
-
-    // If it's not a whole word match, keep going.
-    if (index_word_begin > 0 &&
-      !IsSpaceW (query[index_word_begin - 1])) {
-      goto LoopEnd;
-    }
-
-    if (end_with_colon) {
-      int index_colon = String_FindChar (query, L':', index_word_begin);
-
-      // If there is no colon in the string, return now.
-      if (-1 == index_colon) {
-        return -1;
-      }
-
-      // If there is text between the end of the word and the colon, keep going.
-      if (index_colon - index_word_begin != word_to_match.GetLength()) {
-        goto LoopEnd;
-      }
-    } else {
-      // If there are more chars left after this word/phrase, and
-      // they are not spaces, return.
-      if (query.GetLength() > index_word_begin + word_to_match.GetLength() &&
-        !IsSpaceW (query.GetAt (index_word_begin + word_to_match.GetLength()))) {
-        goto LoopEnd;
-      }
-    }
-
-    // It fits all the requirements, so return the index to the beginning of the word.
-    return index_word_begin;
-
-LoopEnd:
-    ++index_word_begin;
-
-  } while (-1 != index_word_begin);
-
-  return index_word_begin;
-}
-
-// --------------------------------------------------------
-// Do whole-word replacement in "str".
-void ReplaceWholeWord (const CString &string_to_replace,
-  const CString &replacement,
-  const bool trim_whitespace,
-  CString *str) {
-  ASSERT (str, (L"ReplaceWholeWord"));
-
-  if (string_to_replace.IsEmpty() || str->IsEmpty()) {
-    return;
-  }
-
-  int index_str = 0;
-  do {
-    index_str = FindWholeWordMatch (*str, string_to_replace, false, index_str);
-
-    if (-1 != index_str) {
-      // Get the strings before and after, and trim whitespace.
-      CString str_before_word(str->Left (index_str));
-      if (trim_whitespace) {
-        str_before_word.TrimRight();
-      }
-
-      CString str_after_word(str->Mid (index_str + string_to_replace.GetLength()));
-      if (trim_whitespace) {
-        str_after_word.TrimLeft();
-      }
-
-      *str = str_before_word + replacement + str_after_word;
-      index_str += replacement.GetLength() + 1;
-    }
-  } while (index_str != -1);
-}
-
-// --------------------------------------------------------
-// Reverse (big-endian<->little-endian) the shorts that make up
-// Unicode characters in a byte array of Unicode chars
-HRESULT ReverseUnicodeByteOrder(byte* unicode_string, int size_in_bytes) {
-  ASSERT (unicode_string, (L""));
-
-  // If odd # of bytes, just leave the last one alone
-  for (int i = 0; i < size_in_bytes - 1; i += 2) {
-    byte b = unicode_string[i];
-    unicode_string[i] = unicode_string[i+1];
-    unicode_string[i+1] = b;
-  }
-
-  return S_OK;
-}
-
-// case insensitive strstr
-// adapted from http://c.snippets.org/snip_lister.php?fname=stristr.c
-const char *stristr(const char *string, const char *pattern)
-{
-  ASSERT (pattern, (L""));
-  ASSERT (string, (L""));
-  ASSERT (string && pattern, (L""));
-  char *pattern_ptr, *string_ptr;
-  const char *start;
-
-  for (start = string; *start != 0; start++)
-  {
-    // find start of pattern in string
-    for ( ; ((*start!=0) && (String_ToUpperA(*start) != String_ToUpperA(*pattern))); start++)
-     ;
-    if (0 == *start)
-     return NULL;
-
-    pattern_ptr = (char *)pattern;
-    string_ptr = (char *)start;
-
-    while (String_ToUpperA(*string_ptr) == String_ToUpperA(*pattern_ptr))
-    {
-      string_ptr++;
-      pattern_ptr++;
-
-      // if end of pattern then pattern was found
-      if (0 == *pattern_ptr)
-        return (start);
-    }
-  }
-
-  return NULL;
-}
-
-// case insensitive Unicode strstr
-// adapted from http://c.snippets.org/snip_lister.php?fname=stristr.c
-const WCHAR *stristrW(const WCHAR *string, const WCHAR *pattern)
-{
-  ASSERT (pattern, (L""));
-  ASSERT (string, (L""));
-  ASSERT (string && pattern, (L""));
-  const WCHAR *start;
-
-  for (start = string; *start != 0; start++)
-  {
-    // find start of pattern in string
-    for ( ; ((*start!=0) && (String_ToUpper(*start) != String_ToUpper(*pattern))); start++)
-     ;
-    if (0 == *start)
-     return NULL;
-
-    const WCHAR *pattern_ptr = pattern;
-    const WCHAR *string_ptr = start;
-
-    while (String_ToUpper(*string_ptr) == String_ToUpper(*pattern_ptr))
-    {
-      string_ptr++;
-      pattern_ptr++;
-
-      // if end of pattern then pattern was found
-      if (0 == *pattern_ptr)
-        return (start);
-    }
-  }
-
-  return NULL;
-}
-
-// case sensitive Unicode strstr
-// adapted from http://c.snippets.org/snip_lister.php?fname=stristr.c
-const WCHAR *strstrW(const WCHAR *string, const WCHAR *pattern)
-{
-  ASSERT (pattern, (L""));
-  ASSERT (string, (L""));
-  ASSERT (string && pattern, (L""));
-  const WCHAR *start;
-
-  for (start = string; *start != 0; start++)
-  {
-    // find start of pattern in string
-    for ( ; ((*start!=0) && (*start != *pattern)); start++)
-     ;
-    if (0 == *start)
-     return NULL;
-
-    const WCHAR *pattern_ptr = pattern;
-    const WCHAR *string_ptr = start;
-
-    while (*string_ptr == *pattern_ptr)
-    {
-      string_ptr++;
-      pattern_ptr++;
-
-      // if end of pattern then pattern was found
-      if (0 == *pattern_ptr)
-        return (start);
-    }
-  }
-
-  return NULL;
-}
-
-// -------------------------------------------------------------------------
-// Helper function
-float GetLenWithWordWrap (const float len_so_far,
-  const float len_to_add,
-  const uint32 len_line) {
-  // lint -save -e414  Possible division by 0
-  ASSERT (len_line != 0, (L""));
-
-  float len_total = len_so_far + len_to_add;
-
-  // Figure out if we need to word wrap by seeing if adding the second
-  // string will cause us to span more lines than before.
-  uint32 num_lines_before = static_cast<uint32> (len_so_far / len_line);
-  uint32 num_lines_after = static_cast<uint32> (len_total / len_line);
-
-  // If it just barely fit onto the line, do not wrap to the next line.
-  if (num_lines_after > 0 && (len_total / len_line - num_lines_after == 0)) {
-    --num_lines_after;
-  }
-
-  if (num_lines_after > num_lines_before)  {
-    // Need to word wrap.
-    // lint -e{790}  Suspicious truncation
-    return num_lines_after * len_line + len_to_add;
-  }
-  else
-    return len_total;
-
-  // lint -restore
-}
-
-int CalculateBase64EscapedLen(int input_len, bool do_padding) {
-  // these formulae were copied from comments that used to go with the base64
-  // encoding functions
-  int intermediate_result = 8 * input_len + 5;
-  ASSERT(intermediate_result > 0,(L""));     // make sure we didn't overflow
-  int len = intermediate_result / 6;
-  if (do_padding) len = ((len + 3) / 4) * 4;
-  return len;
-}
-
-// Base64Escape does padding, so this calculation includes padding.
-int CalculateBase64EscapedLen(int input_len) {
-  return CalculateBase64EscapedLen(input_len, true);
-}
-
-// Base64Escape
-//   Largely based on b2a_base64 in google/docid_encryption.c
-//
-//
-int Base64EscapeInternal(const char *src, int szsrc,
-                         char *dest, int szdest, const char *base64,
-                         bool do_padding)
-{
-  ASSERT(base64, (L""));
-  ASSERT(dest, (L""));
-  ASSERT(src, (L""));
-
-  static const char kPad64 = '=';
-
-  if (szsrc <= 0) return 0;
-
-  char *cur_dest = dest;
-  const unsigned char *cur_src = reinterpret_cast<const unsigned char*>(src);
-
-  // Three bytes of data encodes to four characters of cyphertext.
-  // So we can pump through three-byte chunks atomically.
-  while (szsrc > 2) { /* keep going until we have less than 24 bits */
-    if( (szdest -= 4) < 0 ) return 0;
-    cur_dest[0] = base64[cur_src[0] >> 2];
-    cur_dest[1] = base64[((cur_src[0] & 0x03) << 4) + (cur_src[1] >> 4)];
-    cur_dest[2] = base64[((cur_src[1] & 0x0f) << 2) + (cur_src[2] >> 6)];
-    cur_dest[3] = base64[cur_src[2] & 0x3f];
-
-    cur_dest += 4;
-    cur_src += 3;
-    szsrc -= 3;
-  }
-
-  /* now deal with the tail (<=2 bytes) */
-  switch (szsrc) {
-case 0:
-  // Nothing left; nothing more to do.
-  break;
-case 1:
-  // One byte left: this encodes to two characters, and (optionally)
-  // two pad characters to round out the four-character cypherblock.
-  if( (szdest -= 2) < 0 ) return 0;
-  cur_dest[0] = base64[cur_src[0] >> 2];
-  cur_dest[1] = base64[(cur_src[0] & 0x03) << 4];
-  cur_dest += 2;
-  if (do_padding) {
-    if( (szdest -= 2) < 0 ) return 0;
-    cur_dest[0] = kPad64;
-    cur_dest[1] = kPad64;
-    cur_dest += 2;
-  }
-  break;
-case 2:
-  // Two bytes left: this encodes to three characters, and (optionally)
-  // one pad character to round out the four-character cypherblock.
-  if( (szdest -= 3) < 0 ) return 0;
-  cur_dest[0] = base64[cur_src[0] >> 2];
-  cur_dest[1] = base64[((cur_src[0] & 0x03) << 4) + (cur_src[1] >> 4)];
-  cur_dest[2] = base64[(cur_src[1] & 0x0f) << 2];
-  cur_dest += 3;
-  if (do_padding) {
-    if( (szdest -= 1) < 0 ) return 0;
-    cur_dest[0] = kPad64;
-    cur_dest += 1;
-  }
-  break;
-default:
-  // Should not be reached: blocks of 3 bytes are handled
-  // in the while loop before this switch statement.
-  ASSERT(false, (L"Logic problem? szsrc = %S",szsrc));
-  break;
-  }
-  return (cur_dest - dest);
-}
-
-#define kBase64Chars  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
-
-#define kWebSafeBase64Chars "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
-
-int Base64Escape(const char *src, int szsrc, char *dest, int szdest) {
-  ASSERT(dest, (L""));
-  ASSERT(src, (L""));
-
-  return Base64EscapeInternal(src, szsrc, dest, szdest, kBase64Chars, true);
-}
-int WebSafeBase64Escape(const char *src, int szsrc, char *dest,
-  int szdest, bool do_padding) {
-    ASSERT(dest, (L""));
-    ASSERT(src, (L""));
-
-    return Base64EscapeInternal(src, szsrc, dest, szdest,
-      kWebSafeBase64Chars, do_padding);
-  }
-
-void Base64Escape(const char *src, int szsrc,
-                  CStringA* dest, bool do_padding)
-{
-  ASSERT(src, (L""));
-  ASSERT(dest,(L""));
-  const int max_escaped_size = CalculateBase64EscapedLen(szsrc, do_padding);
-  dest->Empty();
-  const int escaped_len = Base64EscapeInternal(src, szsrc,
-      dest->GetBufferSetLength(max_escaped_size + 1), max_escaped_size + 1,
-    kBase64Chars,
-    do_padding);
-  ASSERT(max_escaped_size <= escaped_len,(L""));
-  dest->ReleaseBuffer(escaped_len);
-}
-
-void WebSafeBase64Escape(const char *src, int szsrc,
-                         CStringA *dest, bool do_padding)
-{
-  ASSERT(src, (L""));
-  ASSERT(dest,(L""));
-  const int max_escaped_size =
-    CalculateBase64EscapedLen(szsrc, do_padding);
-  dest->Empty();
-  const int escaped_len = Base64EscapeInternal(src, szsrc,
-    dest->GetBufferSetLength(max_escaped_size + 1), max_escaped_size + 1,
-    kWebSafeBase64Chars,
-    do_padding);
-  ASSERT(max_escaped_size <= escaped_len,(L""));
-  dest->ReleaseBuffer(escaped_len);
-}
-
-void WebSafeBase64Escape(const CStringA& src, CStringA* dest) {
-  ASSERT(dest,(L""));
-  int encoded_len = CalculateBase64EscapedLen(src.GetLength());
-  scoped_array<char> buf(new char[encoded_len]);
-  int len = WebSafeBase64Escape(src,src.GetLength(), buf.get(), encoded_len, false);
-  dest->SetString(buf.get(), len);
-}
-
-// ----------------------------------------------------------------------
-// int Base64Unescape() - base64 decoder
-//
-// Check out
-// http://www.cis.ohio-state.edu/htbin/rfc/rfc2045.html for formal
-// description, but what we care about is that...
-//   Take the encoded stuff in groups of 4 characters and turn each
-//   character into a code 0 to 63 thus:
-//           A-Z map to 0 to 25
-//           a-z map to 26 to 51
-//           0-9 map to 52 to 61
-//           +(- for WebSafe) maps to 62
-//           /(_ for WebSafe) maps to 63
-//   There will be four numbers, all less than 64 which can be represented
-//   by a 6 digit binary number (aaaaaa, bbbbbb, cccccc, dddddd respectively).
-//   Arrange the 6 digit binary numbers into three bytes as such:
-//   aaaaaabb bbbbcccc ccdddddd
-//   Equals signs (one or two) are used at the end of the encoded block to
-//   indicate that the text was not an integer multiple of three bytes long.
-// ----------------------------------------------------------------------
-int Base64UnescapeInternal(const char *src, int len_src,
-                           char *dest, int len_dest, const char* unbase64) {
-  ASSERT (unbase64, (L""));
-  ASSERT (src, (L""));
-
-  static const char kPad64 = '=';
-
-  int decode;
-  int destidx = 0;
-  int state = 0;
-  // Used an unsigned char, since ch is used as an array index (into unbase64).
-  unsigned char ch = 0;
-  while (len_src-- && (ch = *src++) != '\0')  {
-    if (IsSpaceA(ch))  // Skip whitespace
-      continue;
-
-    if (ch == kPad64)
-      break;
-
-    decode = unbase64[ch];
-    if (decode == 99)  // A non-base64 character
-      return (-1);
-
-    // Four cyphertext characters decode to three bytes.
-    // Therefore we can be in one of four states.
-    switch (state) {
-      case 0:
-        // We're at the beginning of a four-character cyphertext block.
-        // This sets the high six bits of the first byte of the
-        // plaintext block.
-        if (dest) {
-          if (destidx >= len_dest)
-            return (-1);
-          // lint -e{734} Loss of precision
-          dest[destidx] = static_cast<char>(decode << 2);
-        }
-        state = 1;
-        break;
-      case 1:
-        // We're one character into a four-character cyphertext block.
-        // This sets the low two bits of the first plaintext byte,
-        // and the high four bits of the second plaintext byte.
-        // However, if this is the end of data, and those four
-        // bits are zero, it could be that those four bits are
-        // leftovers from the encoding of data that had a length
-        // of one mod three.
-        if (dest) {
-          if (destidx >= len_dest)
-            return (-1);
-          // lint -e{734} Loss of precision
-          dest[destidx]   |=  decode >> 4;
-          if (destidx + 1 >= len_dest) {
-            if (0 != (decode & 0x0f))
-              return (-1);
-            else
-              ;
-          } else {
-            // lint -e{734} Loss of precision
-            dest[destidx+1] = static_cast<char>((decode & 0x0f) << 4);
-          }
-        }
-        destidx++;
-        state = 2;
-        break;
-      case 2:
-        // We're two characters into a four-character cyphertext block.
-        // This sets the low four bits of the second plaintext
-        // byte, and the high two bits of the third plaintext byte.
-        // However, if this is the end of data, and those two
-        // bits are zero, it could be that those two bits are
-        // leftovers from the encoding of data that had a length
-        // of two mod three.
-        if (dest) {
-          if (destidx >= len_dest)
-            return (-1);
-          // lint -e{734} Loss of precision
-          dest[destidx]   |=  decode >> 2;
-          if (destidx +1 >= len_dest) {
-            if (0 != (decode & 0x03))
-              return (-1);
-            else
-              ;
-          } else {
-            // lint -e{734} Loss of precision
-            dest[destidx+1] = static_cast<char>((decode & 0x03) << 6);
-          }
-        }
-        destidx++;
-        state = 3;
-        break;
-      case 3:
-        // We're at the last character of a four-character cyphertext block.
-        // This sets the low six bits of the third plaintext byte.
-        if (dest) {
-          if (destidx >= len_dest)
-            return (-1);
-          // lint -e{734} Loss of precision
-          dest[destidx] |= decode;
-        }
-        destidx++;
-        state = 0;
-        break;
-
-    default:
-      ASSERT (false, (L""));
-      break;
-    }
-  }
-
-  // We are done decoding Base-64 chars.  Let's see if we ended
-  //      on a byte boundary, and/or with erroneous trailing characters.
-  if (ch == kPad64) {               // We got a pad char
-    if ((state == 0) || (state == 1))
-      return (-1);  // Invalid '=' in first or second position
-    if (len_src == 0) {
-      if (state == 2)  // We run out of input but we still need another '='
-        return (-1);
-      // Otherwise, we are in state 3 and only need this '='
-    } else {
-      if (state == 2) {  // need another '='
-        while ((ch = *src++) != '\0' && (len_src-- > 0)) {
-          if (!IsSpaceA(ch))
-            break;
-        }
-        if (ch != kPad64)
-          return (-1);
-      }
-      // state = 1 or 2, check if all remain padding is space
-      while ((ch = *src++) != '\0' && (len_src-- > 0)) {
-        if (!IsSpaceA(ch))
-          return(-1);
-      }
-    }
-  } else {
-    // We ended by seeing the end of the string.  Make sure we
-    //      have no partial bytes lying around.  Note that we
-    //      do not require trailing '=', so states 2 and 3 are okay too.
-    if (state == 1)
-      return (-1);
-  }
-
-  return (destidx);
-}
-
-int Base64Unescape(const char *src, int len_src, char *dest, int len_dest) {
-  ASSERT(dest, (L""));
-  ASSERT(src, (L""));
-
-  static const char UnBase64[] = {
-     99,      99,      99,      99,      99,      99,      99,      99,
-     99,      99,      99,      99,      99,      99,      99,      99,
-     99,      99,      99,      99,      99,      99,      99,      99,
-     99,      99,      99,      99,      99,      99,      99,      99,
-     99,      99,      99,      99,      99,      99,      99,      99,
-     99,      99,      99,      62/*+*/, 99,      99,      99,      63/*/ */,
-     52/*0*/, 53/*1*/, 54/*2*/, 55/*3*/, 56/*4*/, 57/*5*/, 58/*6*/, 59/*7*/,
-     60/*8*/, 61/*9*/, 99,      99,      99,      99,      99,      99,
-     99,       0/*A*/,  1/*B*/,  2/*C*/,  3/*D*/,  4/*E*/,  5/*F*/,  6/*G*/,
-      7/*H*/,  8/*I*/,  9/*J*/, 10/*K*/, 11/*L*/, 12/*M*/, 13/*N*/, 14/*O*/,
-     15/*P*/, 16/*Q*/, 17/*R*/, 18/*S*/, 19/*T*/, 20/*U*/, 21/*V*/, 22/*W*/,
-     23/*X*/, 24/*Y*/, 25/*Z*/, 99,      99,      99,      99,      99,
-     99,      26/*a*/, 27/*b*/, 28/*c*/, 29/*d*/, 30/*e*/, 31/*f*/, 32/*g*/,
-     33/*h*/, 34/*i*/, 35/*j*/, 36/*k*/, 37/*l*/, 38/*m*/, 39/*n*/, 40/*o*/,
-     41/*p*/, 42/*q*/, 43/*r*/, 44/*s*/, 45/*t*/, 46/*u*/, 47/*v*/, 48/*w*/,
-     49/*x*/, 50/*y*/, 51/*z*/, 99,      99,      99,      99,      99,
-     99,      99,      99,      99,      99,      99,      99,      99,
-     99,      99,      99,      99,      99,      99,      99,      99,
-     99,      99,      99,      99,      99,      99,      99,      99,
-     99,      99,      99,      99,      99,      99,      99,      99,
-     99,      99,      99,      99,      99,      99,      99,      99,
-     99,      99,      99,      99,      99,      99,      99,      99,
-     99,      99,      99,      99,      99,      99,      99,      99,
-     99,      99,      99,      99,      99,      99,      99,      99,
-     99,      99,      99,      99,      99,      99,      99,      99,
-     99,      99,      99,      99,      99,      99,      99,      99,
-     99,      99,      99,      99,      99,      99,      99,      99,
-     99,      99,      99,      99,      99,      99,      99,      99,
-     99,      99,      99,      99,      99,      99,      99,      99,
-     99,      99,      99,      99,      99,      99,      99,      99,
-     99,      99,      99,      99,      99,      99,      99,      99,
-     99,      99,      99,      99,      99,      99,      99,      99
-  };
-
-  // The above array was generated by the following code
-  // #include <sys/time.h>
-  // #include <stdlib.h>
-  // #include <string.h>
-  // main()
-  // {
-  //   static const char Base64[] =
-  //     "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-  //   char *pos;
-  //   int idx, i, j;
-  //   printf("    ");
-  //   for (i = 0; i < 255; i += 8) {
-  //     for (j = i; j < i + 8; j++) {
-  //       pos = strchr(Base64, j);
-  //       if ((pos == NULL) || (j == 0))
-  //         idx = 99;
-  //       else
-  //         idx = pos - Base64;
-  //       if (idx == 99)
-  //         printf(" %2d,     ", idx);
-  //       else
-  //         printf(" %2d/*%c*/,", idx, j);
-  //     }
-  //     printf("\n    ");
-  //   }
-  // }
-
-  return Base64UnescapeInternal(src, len_src, dest, len_dest, UnBase64);
-}
-
-int WebSafeBase64Unescape(const char *src, int szsrc, char *dest, int szdest) {
-  ASSERT(dest, (L""));
-  ASSERT(src, (L""));
-
-  static const char UnBase64[] = {
-    99,      99,      99,      99,      99,      99,      99,      99,
-      99,      99,      99,      99,      99,      99,      99,      99,
-      99,      99,      99,      99,      99,      99,      99,      99,
-      99,      99,      99,      99,      99,      99,      99,      99,
-      99,      99,      99,      99,      99,      99,      99,      99,
-      99,      99,      99,      99,      99,      62/*-*/, 99,      99,
-      52/*0*/, 53/*1*/, 54/*2*/, 55/*3*/, 56/*4*/, 57/*5*/, 58/*6*/, 59/*7*/,
-      60/*8*/, 61/*9*/, 99,      99,      99,      99,      99,      99,
-      99,       0/*A*/,  1/*B*/,  2/*C*/,  3/*D*/,  4/*E*/,  5/*F*/,  6/*G*/,
-      7/*H*/,  8/*I*/,  9/*J*/, 10/*K*/, 11/*L*/, 12/*M*/, 13/*N*/, 14/*O*/,
-      15/*P*/, 16/*Q*/, 17/*R*/, 18/*S*/, 19/*T*/, 20/*U*/, 21/*V*/, 22/*W*/,
-      23/*X*/, 24/*Y*/, 25/*Z*/, 99,      99,      99,      99,      63/*_*/,
-      99,      26/*a*/, 27/*b*/, 28/*c*/, 29/*d*/, 30/*e*/, 31/*f*/, 32/*g*/,
-      33/*h*/, 34/*i*/, 35/*j*/, 36/*k*/, 37/*l*/, 38/*m*/, 39/*n*/, 40/*o*/,
-      41/*p*/, 42/*q*/, 43/*r*/, 44/*s*/, 45/*t*/, 46/*u*/, 47/*v*/, 48/*w*/,
-      49/*x*/, 50/*y*/, 51/*z*/, 99,      99,      99,      99,      99,
-      99,      99,      99,      99,      99,      99,      99,      99,
-      99,      99,      99,      99,      99,      99,      99,      99,
-      99,      99,      99,      99,      99,      99,      99,      99,
-      99,      99,      99,      99,      99,      99,      99,      99,
-      99,      99,      99,      99,      99,      99,      99,      99,
-      99,      99,      99,      99,      99,      99,      99,      99,
-      99,      99,      99,      99,      99,      99,      99,      99,
-      99,      99,      99,      99,      99,      99,      99,      99,
-      99,      99,      99,      99,      99,      99,      99,      99,
-      99,      99,      99,      99,      99,      99,      99,      99,
-      99,      99,      99,      99,      99,      99,      99,      99,
-      99,      99,      99,      99,      99,      99,      99,      99,
-      99,      99,      99,      99,      99,      99,      99,      99,
-      99,      99,      99,      99,      99,      99,      99,      99,
-      99,      99,      99,      99,      99,      99,      99,      99,
-      99,      99,      99,      99,      99,      99,      99,      99
-  };
-  // The above array was generated by the following code
-  // #include <sys/time.h>
-  // #include <stdlib.h>
-  // #include <string.h>
-  // main()
-  // {
-  //   static const char Base64[] =
-  //     "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
-  //   char *pos;
-  //   int idx, i, j;
-  //   printf("    ");
-  //   for (i = 0; i < 255; i += 8) {
-  //     for (j = i; j < i + 8; j++) {
-  //       pos = strchr(Base64, j);
-  //       if ((pos == NULL) || (j == 0))
-  //         idx = 99;
-  //       else
-  //         idx = pos - Base64;
-  //       if (idx == 99)
-  //         printf(" %2d,     ", idx);
-  //       else
-  //         printf(" %2d/*%c*/,", idx, j);
-  //     }
-  //     printf("\n    ");
-  //   }
-  // }
-
-  return Base64UnescapeInternal(src, szsrc, dest, szdest, UnBase64);
-}
-
-bool IsHexDigit (WCHAR c) {
-  return (((c >= L'a') && (c <= L'f'))
-     || ((c >= L'A') && (c <= L'F'))
-     || ((c >= L'0') && (c <= L'9')));
-}
-
-int HexDigitToInt (WCHAR c) {
-  return ((c >= L'a') ? ((c - L'a') + 10) :
-          (c >= L'A') ? ((c - L'A') + 10) :
-          (c - L'0'));
-}
-
-// ----------------------------------------------------------------------
-// int QuotedPrintableUnescape()
-//
-// Check out http://www.cis.ohio-state.edu/htbin/rfc/rfc2045.html for
-// more details, only briefly implemented. But from the web...
-// Quoted-printable is an encoding method defined in the MIME
-// standard. It is used primarily to encode 8-bit text (such as text
-// that includes foreign characters) into 7-bit US ASCII, creating a
-// document that is mostly readable by humans, even in its encoded
-// form. All MIME compliant applications can decode quoted-printable
-// text, though they may not necessarily be able to properly display the
-// document as it was originally intended. As quoted-printable encoding
-// is implemented most commonly, printable ASCII characters (values 33
-// through 126, excluding 61), tabs and spaces that do not appear at the
-// end of lines, and end-of-line characters are not encoded. Other
-// characters are represented by an equal sign (=) immediately followed
-// by that character's hexadecimal value. Lines that are longer than 76
-// characters are shortened by line breaks, with the equal sign marking
-// where the breaks occurred.
-//
-// Update: we really want QuotedPrintableUnescape to conform to rfc2047,
-// which expands the q encoding. In particular, it specifices that _'s are
-// to be treated as spaces.
-// ----------------------------------------------------------------------
-int QuotedPrintableUnescape(const WCHAR *source, int slen,
-                            WCHAR *dest, int len_dest) {
-  ASSERT(dest, (L""));
-  ASSERT(source, (L""));
-
-  WCHAR* d = dest;
-  const WCHAR* p = source;
-
-  while (*p != '\0' && p < source+slen && d < dest+len_dest) {
-    switch (*p) {
-      case '=':
-        if (p == source+slen-1) {
-          // End of line, no need to print the =..
-          return (d-dest);
-        }
-        // if its valid, convert to hex and insert
-        if (p < source+slen-2 && IsHexDigit(p[1]) && IsHexDigit(p[2])) {
-          // lint -e{734} Loss of precision
-          *d++ = static_cast<WCHAR>(
-                    HexDigitToInt(p[1]) * 16 + HexDigitToInt(p[2]));
-          p += 3;
-        } else {
-          p++;
-        }
-        break;
-      case '_':   // According to rfc2047, _'s are to be treated as spaces
-        *d++ = ' '; p++;
-        break;
-      default:
-        *d++ = *p++;
-        break;
-    }
-  }
-  return (d-dest);
-}
-
-// TODO(omaha): currently set not to use IsCharUpper because that is relatively slow
-// this is used in the QUIB; consider if we need to use IsCharUpper or a replacement
-bool String_IsUpper(TCHAR c) {
-  return (c >= 'A' && c <= 'Z');
-  // return (IsCharUpper (c));
-}
-
-// Replacement for the CRT toupper(c)
-int String_ToUpper(int c) {
-  // If it's < 128, then convert is ourself, which is far cheaper than the system conversion
-  if (c < 128)
-    return String_ToUpperA(static_cast<char>(c));
-
-  TCHAR * p_c = reinterpret_cast<TCHAR *>(c);
-  int conv_c = reinterpret_cast<int>(::CharUpper(p_c));
-  return conv_c;
-}
-
-// Replacement for the CRT toupper(c)
-char String_ToUpperA(char c) {
-  if (c >= 'a' && c <= 'z') return (c - ('a' - 'A'));
-  return c;
-}
-
-void String_ToLower(TCHAR* str) {
-  ASSERT1(str);
-  ::CharLower(str);
-}
-
-void String_ToUpper(TCHAR* str) {
-  ASSERT1(str);
-  ::CharUpper(str);
-}
-
-// String comparison based on length
-// Replacement for the CRT strncmp(i)
-int String_StrNCmp(const TCHAR * str1, const TCHAR * str2, uint32 len, bool ignore_case) {
-  ASSERT(str2, (L""));
-  ASSERT(str1, (L""));
-
-  TCHAR c1, c2;
-
-  if (len == 0)
-    return 0;
-
-  // compare each char
-  // TODO(omaha): If we use a lot of case sensitive compares consider having 2 loops.
-  do {
-    c1 = *str1++;
-    c2 = *str2++;
-    if (ignore_case) {
-      c1 = (TCHAR)String_ToLowerChar((int)(c1));  // lint !e507  Suspicious truncation
-      c2 = (TCHAR)String_ToLowerChar((int)(c2));  // lint !e507
-    }
-  } while ( (--len) && c1 && (c1 == c2) );
-
-  return (int)(c1 - c2);
-}
-
-// TODO(omaha): Why do we introduce this behaviorial difference?
-// Replacement for strncpy() - except ALWAYS ends string with null
-TCHAR* String_StrNCpy(TCHAR* destination, const TCHAR* source, uint32 len) {
-  ASSERT (source, (L""));
-  ASSERT (destination, (L""));
-
-  TCHAR* result = destination;
-
-  ASSERT (0 != len, (L""));     // Too short a destination for even the null character
-
-  while (*source && len) {
-    *destination++ = *source++;
-    len--;
-  }
-
-  // If we ran out of space, back up one
-  if (0 == len) {
-    destination--;
-  }
-
-  // Null-terminate the string
-  *destination = _T('\0');
-
-  return result;
-}
-
-// check if a string starts with another string
-bool String_StartsWith(const TCHAR *str, const TCHAR *start_str,
-                            bool ignore_case) {
-  ASSERT(start_str, (L""));
-  ASSERT(str, (L""));
-
-  while (0 != *str) {
-    // Check for matching characters
-    TCHAR c1 = *str;
-    TCHAR c2 = *start_str;
-
-    // Reached the end of start_str?
-    if (0 == c2)
-      return true;
-
-    if (ignore_case) {
-      c1 = (TCHAR)String_ToLowerChar((int)(c1));  // lint !e507  Suspicious truncation
-      c2 = (TCHAR)String_ToLowerChar((int)(c2));  // lint !e507  Suspicious truncation
-    }
-
-    if (c1 != c2)
-      return false;
-
-    ++str;
-    ++start_str;
-  }
-
-  // If str is shorter than start_str, no match.  If equal size, match.
-  return 0 == *start_str;
-}
-
-// check if a string starts with another string
-bool String_StartsWithA(const char *str, const char *start_str, bool ignore_case) {
-  ASSERT(start_str, (L""));
-  ASSERT(str, (L""));
-
-  while (0 != *str) {
-    // Check for matching characters
-    char c1 = *str;
-    char c2 = *start_str;
-
-    // Reached the end of start_str?
-    if (0 == c2)
-      return true;
-
-    if (ignore_case) {
-      c1 = String_ToLowerCharAnsi(c1);
-      c2 = String_ToLowerCharAnsi(c2);
-    }
-
-    if (c1 != c2)
-      return false;
-
-    ++str;
-    ++start_str;
-  }
-
-  // If str is shorter than start_str, no match.  If equal size, match.
-  return 0 == *start_str;
-}
-
-// the wrapper version below actually increased code size as of 5/31/04
-// perhaps because the int64 version is larger and in some EXE/DLLs we only need the int32 version
-
-// converts a string to an int
-// Does not check for overflow
-// is the direct int32 version significantly faster for our usage?
-// int32 String_StringToInt(const TCHAR * str) {
-//    ASSERT(str, (L""));
-//    return static_cast<int32>(String_StringToInt64 (str));
-// }
-
-// converts a string to an int
-// Does not check for overflow
-int32 String_StringToInt(const TCHAR * str) {
-  ASSERT(str, (L""));
-
-  int c;              // current char
-  int32 total;         // current total
-  int sign;           // if '-', then negative, otherwise positive
-
-  // remove spaces
-  while ( *str == _T(' '))
-      ++str;
-
-  c = (int)*str++;
-  sign = c;           // save sign indication
-  if (c == _T('-') || c == _T('+'))
-      c = (int)*str++;    // skip sign
-
-  total = 0;
-
-  while ((c = String_CharToDigit(static_cast<TCHAR>(c))) != -1 ) {
-      total = 10 * total + c;     // accumulate digit
-      c = *str++;    // get next char
-  }
-
-  if (sign == '-')
-    return -total;
-  else
-    return total;   // return result, negated if necessary
-}
-
-// converts a string to an int64
-// Does not check for overflow
-int64 String_StringToInt64(const TCHAR * str) {
-  ASSERT(str, (L""));
-
-  int c;  // current char
-  int64 total;  // current total
-  int sign;
-
-  while (*str == ' ') ++str;  // skip space
-
-  c = (int)*str++;
-  sign = c;           /* save sign indication */
-  if (c == '-' || c == '+')
-    c = (int)*str++;
-
-  total = 0;
-
-  while ((c = String_CharToDigit(static_cast<TCHAR>(c))) != -1) {
-    total = 10 * total + c;     /* accumulate digit */
-    c = *str++;    /* get next char */
-  }
-
-  if (sign == '-')
-    return -total;
-  else
-    return total;
-}
-
-// A faster version of the ::CharLower command. We first check if all characters are in low ANSI
-// If so, we can convert it ourselves [which is about 10x faster]
-// Otherwise, ask the system to do it for us.
-TCHAR * String_FastToLower(TCHAR * str) {
-  ASSERT(str, (L""));
-
-  TCHAR * p = str;
-  while (*p) {
-    // If we can't process it ourselves, then do it with the API
-    if (*p > 127)
-      return ::CharLower(str);
-    ++p;
-  }
-
-  // If we're still here, do it ourselves
-  p = str;
-  while (*p) {
-    // Lower case it
-    if (*p >= L'A' && *p <= 'Z')
-      *p |= 0x20;
-    ++p;
-  }
-
-  return str;
-}
-
-// Convert a size_t to a CString
-CString sizet_to_str(const size_t & i) {
-  CString out;
-  out.Format(NOTRANSL(_T("%u")),i);
-  return out;
-}
-
-// Convert an int to a CString
-CString itostr(const int i) {
-  return String_Int64ToString(i, 10);
-}
-
-// Convert a uint to a CString
-CString itostr(const uint32 i) {
-  return String_Int64ToString(i, 10);
-}
-
-// converts an int to a string
-// Does not check for overflow
-CString String_Int64ToString(int64 value, int radix) {
-  ASSERT(radix > 0, (L""));
-
-  // Space big enough for it in binary, plus the sign
-  TCHAR temp[66];
-
-  bool negative = false;
-  if (value < 0) {
-    negative = true;
-    value = -value;
-  }
-
-  int pos = 0;
-
-  // Add digits in reverse order
-  do {
-    TCHAR digit = (TCHAR) (value % radix);
-    if (digit > 9)
-      temp[pos] = L'a' + digit - 10;
-    else
-      temp[pos] = L'0' + digit;
-
-    pos++;
-    value /= radix;
-  } while (value > 0);
-
-  if (negative)
-    temp[pos++] = L'-';
-
-  // Reverse it before making a CString out of it
-  int start = 0, end = pos - 1;
-  while (start < end) {
-    TCHAR t = temp[start];
-    temp[start] = temp[end];
-    temp[end] = t;
-
-    end--;
-    start++;
-  }
-
-  return CString(temp, pos);
-}
-
-// converts an uint64 to a string
-// Does not check for overflow
-CString String_Uint64ToString(uint64 value, int radix) {
-  ASSERT1(radix > 0);
-
-  CString ret;
-
-  const uint32 kMaxUint64Digits = 65;
-
-  // Space big enough for it in binary
-  TCHAR* temp = ret.GetBufferSetLength(kMaxUint64Digits);
-
-  int pos = 0;
-
-  // Add digits in reverse order
-  do {
-    TCHAR digit = static_cast<TCHAR>(value % radix);
-    if (digit > 9) {
-      temp[pos] = _T('a') + digit - 10;
-    } else {
-      temp[pos] = _T('0') + digit;
-    }
-
-    pos++;
-    value /= radix;
-  } while (value > 0 && pos < kMaxUint64Digits);
-
-  ret.ReleaseBuffer(pos);
-
-  // Reverse it before making a CString out of it
-  ret.MakeReverse();
-
-  return ret;
-}
-
-// converts an double to a string specifies the number of digits after
-// the decimal point
-CString String_DoubleToString(double value, int point_digits) {
-  int64 int_val = (int64) value;
-
-  // Deal with integer part
-  CString result(String_Int64ToString(int_val, 10));
-
-  if (point_digits > 0) {
-    result.AppendChar(L'.');
-
-    // get the fp digits
-    double rem_val = value - int_val;
-    if (rem_val < 0)
-      rem_val = -rem_val;
-
-    // multiply w/ the requested number of significant digits
-    // construct the string in place
-    for(int i=0; i<point_digits; i++) {
-      // TODO(omaha): I have seen 1.2 turn into 1.1999999999999, and generate that string.
-      // We should round better. For now, I'll add a quick fix to favor high
-      rem_val += 1e-12;
-      rem_val *= 10;
-      // Get the ones digit
-      int64 int_rem_dig = std::min(10LL, static_cast<int64>(rem_val));
-      result += static_cast<TCHAR>(int_rem_dig + L'0');
-      rem_val = rem_val - int_rem_dig;
-    }
-  }
-
-  return result;
-}
-
-double String_StringToDouble (const TCHAR *s) {
-  ASSERT(s, (L""));
-
-  double value, power;
-  int i = 0, sign;
-
-  while (IsSpaceW(s[i])) i++;
-
-  // get sign
-  sign = (s[i] == '-') ? -1 : 1;
-  if (s[i] == '+' || s[i] == '-') i++;
-
-  for (value = 0.0; s[i] >= '0' && s[i] <= '9'; i++)
-    value = 10.0 * value + (s[i] - '0');
-
-  if (s[i] == '.') i++;
-
-  for (power = 1.0; s[i] >= '0' && s[i] <= '9'; i++) {
-    value = 10.0 * value + (s[i] - '0');
-    power *= 10.0;
-  }
-
-  return sign * value / power;
-}
-
-// Converts a character to a digit
-// if the character is not a digit return -1 (same as CRT)
-int32 String_CharToDigit(const TCHAR c) {
-  return ((c) >= '0' && (c) <= '9' ? (c) - '0' : -1);
-}
-
-bool String_IsDigit (const TCHAR c) {
-  return ((c) >= '0' && (c) <= '9');
-}
-
-TCHAR String_DigitToChar(unsigned int n) {
-  ASSERT1(n < 10);
-  return static_cast<TCHAR>(_T('0') + n % 10);
-}
-
-// Returns true if an identifier character: letter, digit, or "_"
-bool String_IsIdentifierChar(const TCHAR c) {
-  return ((c >= _T('A') && c <= _T('Z')) ||
-          (c >= _T('a') && c <= _T('z')) ||
-          (c >= _T('0') && c <= _T('9')) ||
-          c == _T('_'));
-}
-
-// Returns true if the string has letters in it.
-// This is used by the keyword extractor to downweight numbers,
-// IDs (sequences of numbers like social security numbers), etc.
-bool String_HasAlphabetLetters (const TCHAR * str) {
-  ASSERT (str, (L""));
-
-  while (*str != '\0') {
-    // if (iswalpha (*str)) {
-    // Note that IsCharAlpha is slower but we want to avoid the CRT
-    if (IsCharAlpha (*str)) {
-      return true;
-    }
-    ++str;
-  }
-
-  return false;
-}
-
-CString String_LargeIntToApproximateString(uint64 value, bool base_ten, int* power) {
-  uint32 to_one_decimal;
-
-  uint32 gig         = base_ten ? 1000000000 : (1<<30);
-  uint32 gig_div_10  = base_ten ?  100000000 : (1<<30)/10;
-  uint32 meg         = base_ten ?    1000000 : (1<<20);
-  uint32 meg_div_10  = base_ten ?     100000 : (1<<20)/10;
-  uint32 kilo        = base_ten ?       1000 : (1<<10);
-  uint32 kilo_div_10 = base_ten ?        100 : (1<<10)/10;
-
-  if (value >= gig) {
-    if (power) *power = 3;
-    to_one_decimal = static_cast<uint32>(value / gig_div_10);
-  } else if (value >= meg) {
-    if (power) *power = 2;
-    to_one_decimal = static_cast<uint32>(value / meg_div_10);
-  } else if (value >= kilo) {
-    if (power) *power = 1;
-    to_one_decimal = static_cast<uint32>(value / kilo_div_10);
-  } else {
-    if (power) *power = 0;
-    return String_Int64ToString(static_cast<uint32>(value), 10 /*radix*/);
-  }
-
-  uint32 whole_part = to_one_decimal / 10;
-
-  if (whole_part < 10)
-    return Show(0.1 * static_cast<double>(to_one_decimal), 1);
-
-  return String_Int64ToString(whole_part, 10 /*radix*/);
-}
-
-int String_FindString(const TCHAR *s1, const TCHAR *s2) {
-  ASSERT(s2, (L""));
-  ASSERT(s1, (L""));
-
-  // Naive implementation, but still oodles better than ATL's implementation
-  // (which deals with variable character widths---we don't).
-
-  const TCHAR *found = _tcsstr(s1, s2);
-  if (NULL == found)
-    return -1;
-
-  return found - s1;
-}
-
-int String_FindString(const TCHAR *s1, const TCHAR *s2, int start_pos) {
-  ASSERT(s2, (L""));
-  ASSERT(s1, (L""));
-
-  // Naive implementation, but still oodles better than ATL's implementation
-  // (which deals with variable character widths---we don't).
-
-  int skip = start_pos;
-
-  const TCHAR *s = s1;
-  while (skip && *s) {
-    ++s;
-    --skip;
-  }
-  if (!(*s))
-    return -1;
-
-  const TCHAR *found = _tcsstr(s, s2);
-  if (NULL == found)
-    return -1;
-
-  return found - s1;
-}
-
-int String_FindChar(const TCHAR *str, const TCHAR c) {
-  ASSERT (str, (L""));
-  const TCHAR *s = str;
-  while (*s) {
-    if (*s == c)
-      return s - str;
-    ++s;
-  }
-
-  return -1;
-}
-
-// taken from wcsrchr, modified to behave in the CString way
-int String_ReverseFindChar(const TCHAR * str,TCHAR c) {
-  ASSERT (str, (L""));
-  TCHAR *start = (TCHAR *)str;
-
-  while (*str++)                       /* find end of string */
-    ;
-  /* search towards front */
-  while (--str != start && *str != (TCHAR)c)
-    ;
-
-  if (*str == (TCHAR)c)             /* found ? */
-    return( str - start );
-
-  return -1;
-}
-
-int String_FindChar(const TCHAR *str, const TCHAR c, int start_pos) {
-  ASSERT (str, (L""));
-  int n = 0;
-  const TCHAR *s = str;
-  while (*s) {
-    if (n++ >= start_pos && *s == c)
-      return s - str;
-    ++s;
-  }
-
-  return -1;
-}
-
-bool String_Contains(const TCHAR *s1, const TCHAR *s2) {
-  ASSERT(s2, (L""));
-  ASSERT(s1, (L""));
-
-  return -1 != String_FindString(s1, s2);
-}
-
-void String_ReplaceChar(TCHAR *str, TCHAR old_char, TCHAR new_char) {
-  ASSERT (str, (L""));
-  while (*str) {
-    if (*str == old_char)
-      *str = new_char;
-
-    ++str;
-  }
-}
-
-void String_ReplaceChar(CString & str, TCHAR old_char, TCHAR new_char) {
-  String_ReplaceChar (str.GetBuffer(), old_char, new_char);
-  str.ReleaseBuffer();
-}
-
-int ReplaceCString (CString & src, const TCHAR *from, const TCHAR *to) {
-  ASSERT(to, (L""));
-  ASSERT(from, (L""));
-
-  return ReplaceCString(src, from, lstrlen(from), to, lstrlen(to), kRepMax);
-}
-
-// A special version of the replace function which takes advantage of CString properties
-// to make it much faster when the string grows
-// 1) It will resize the string in place if possible. Even if it has to 'grow' the string
-// 2) It will cutoff after a maximum number of matches
-// 3) It expects sizing data to be passed to it
-int ReplaceCString (CString & src, const TCHAR *from, unsigned int from_len,
-                                   const TCHAR *to, unsigned int to_len,
-                                   unsigned int max_matches) {
-  ASSERT (from, (L""));
-  ASSERT (to, (L""));
-  ASSERT (from[0] != '\0', (L""));
-  int i = 0, j = 0;
-  unsigned int matches = 0;
-
-  // Keep track of the matches, it's easier than recalculating them
-  unsigned int match_pos_stack[kExpectedMaxReplaceMatches];
-
-  // We might need to dynamically allocate space for the matches
-  bool dynamic_allocate = false;
-  unsigned int * match_pos = (unsigned int*)match_pos_stack;
-  unsigned int max_match_size = kExpectedMaxReplaceMatches;
-
-  // Is the string getting bigger?
-  bool longer = to_len > from_len;
-
-  // don't compute the lengths unless we know we need to
-  int src_len = src.GetLength();
-  int cur_len = src_len;
-
-  // Trick: We temporarily add 1 extra character to the string. The first char from the from
-  // string. This way we can avoid searching for NULL, since we are guaranteed to find it
-  TCHAR * buffer = src.GetBufferSetLength(src_len+1);
-  const TCHAR from_0 = from[0];
-  buffer[src_len] = from[0];
-
-  while (i < cur_len) {
-    // If we have too many matches, then re-allocate to a dynamic buffer that is
-    // twice as big as the one we are currently using
-    if (longer && (matches == max_match_size)) {
-      // Double the buffer size, and copy it over
-      unsigned int * temp = new unsigned int[max_match_size * 2];
-      memcpy(temp, match_pos, matches * sizeof(unsigned int));
-      if (dynamic_allocate)
-        delete [] match_pos;  // lint !e424  Inappropriate deallocation
-      match_pos = temp;
-
-      max_match_size *= 2;
-      dynamic_allocate = true;
-    }
-
-    // If we have the maximum number of matches already, then stop
-    if (matches >= max_matches) {
-      break;
-    }
-
-    // For each potential match
-    // Note: oddly enough, this is the most expensive line in the function under normal usage. So I am optimizing the heck out of it
-    TCHAR * buf_ptr = buffer + i;
-    while (*buf_ptr != from_0) { ++buf_ptr; }
-    i = buf_ptr - buffer;
-
-    // We're done!
-    if (i >= cur_len)
-      break;
-
-    // buffer is not NULL terminated, we replaced the NULL above
-    while (i < cur_len && buffer[i] && buffer[i] == from[j]) {
-      ++i; ++j;
-      if (from[j] == '\0') {  // found match
-
-        if (!longer) {  // modify in place
-
-          memcpy ((byte *)(buffer+i) - (sizeof (TCHAR) * from_len), (byte *)to, sizeof (TCHAR) * to_len);
-          // if there are often a lot of replacements, it would be faster to create a new string instead
-          // of using memmove
-
-          // TODO(omaha): - memmove will cause n^2 behavior in strings with multiple matches since it will be moved many times...
-          if (to_len < from_len) { memmove ((byte *)(buffer+i) - (sizeof (TCHAR) * (from_len - to_len)),
-                                          (byte *)(buffer+i), (src_len - i + 1) * sizeof (TCHAR)); }
-
-          i -= (from_len - to_len);
-          cur_len -= (from_len - to_len);
-        }
-        else
-          match_pos[matches] = i - from_len;
-
-        ++matches;
-
-        break;
-      }
-    }
-
-    j = 0;
-  }
-
-  if (to_len <= from_len)
-    src_len -= matches * (from_len - to_len);
-
-  // if the new string is longer we do another pass now that we know how long the new string needs to be
-  if (matches && to_len > from_len) {
-    src.ReleaseBuffer(src_len);
-
-    int new_len = src_len + matches * (to_len - from_len);
-    buffer = src.GetBufferSetLength(new_len);
-
-    // It's easier to assemble it backwards...
-    int temp_end = new_len;
-    for(i = matches-1; i >= 0; --i) {
-      // Figure out where the trailing portion isthe trailing portion
-      int len = src_len - match_pos[i] - from_len;
-      int start  = match_pos[i] + from_len;
-      int dest   = temp_end - len;
-      memmove(buffer+dest, buffer+start, (len) * sizeof(TCHAR));
-
-      // copy the new item
-      memcpy(buffer + dest - to_len, to, to_len * sizeof(TCHAR));
-
-      // Update the pointers
-      temp_end = dest - to_len;
-      src_len = match_pos[i];
-
-    }
-    src_len = new_len;
-  }
-
-  src.ReleaseBuffer(src_len);
-  if (dynamic_allocate)
-    delete [] match_pos;  // lint !e673  Possibly inappropriate deallocation
-
-  return matches;
-}
-
-/*
-   The following 2 functions will do replacement on TCHAR* directly. They is currently unused.
-   Feel free to put it back if you need to.
-*/
-int ReplaceString (TCHAR *src, const TCHAR *from, const TCHAR *to, TCHAR **out, int *out_len) {
-  ASSERT(out_len, (L""));
-  ASSERT(out, (L""));
-  ASSERT(to, (L""));
-  ASSERT(from, (L""));
-  ASSERT(src, (L""));
-
-  bool created_new_string;
-  int matches = ReplaceStringMaybeInPlace (src, from, to, out, out_len, &created_new_string);
-  if (!created_new_string) {
-      *out = new TCHAR [(*out_len)+1];
-      if (!(*out)) { *out = src; return 0; }
-      _tcscpy_s(*out, *out_len + 1, src);
-  }
-
-  return matches;
-}
-
-int ReplaceStringMaybeInPlace (TCHAR *src, const TCHAR *from, const TCHAR *to, TCHAR **out, int *out_len, bool *created_new_string) {
-  ASSERT (created_new_string, (L""));
-  ASSERT (out_len, (L""));
-  ASSERT (src, (L""));
-  ASSERT (from, (L""));
-  ASSERT (to, (L""));
-  ASSERT (out, (L""));
-  ASSERT (from[0] != '\0', (L""));
-  int i = 0, j = 0;
-  int matches = 0;
-
-  // don't compute the lengths unless we know we need to
-  int from_len = -1, to_len = -1, src_len = -1;
-
-  *created_new_string = false;
-  *out = src;
-
-  while (src[i]) {
-    while (src[i] && src[i] != from[0]) { i++; }
-    while (src[i] && src[i] == from[j]) {
-      i++; j++;
-      if (from[j] == '\0') {  // found match
-        if (from_len == -1) {  // compute lengths if not known
-          from_len = lstrlen (from);
-          to_len = lstrlen (to);
-          src_len = lstrlen (src);
-        }
-
-        matches++;
-
-        if (to_len <= from_len) {  // modify in place
-          memcpy ((byte *)(src+i) - (sizeof (TCHAR) * from_len), (byte *)to, sizeof (TCHAR) * to_len);
-          // if there are often a lot of replacements, it would be faster to create a new string instead
-          // of using memmove
-          if (to_len < from_len) { memmove ((byte *)(src+i) - (sizeof (TCHAR) * (from_len - to_len)),
-                                            (byte *)(src+i), (src_len - i + 1) * sizeof (TCHAR)); }
-          i -= (from_len - to_len);
-        }
-
-        break;
-      }
-    }
-
-    j = 0;
-  }
-
-  *out_len = i;
-
-  // if the new string is longer we do another pass now that we know how long the new string needs to be
-  if (matches && to_len > from_len) {
-      ASSERT (src_len == i, (L""));
-      int new_len = src_len + matches * (to_len - from_len);
-      *out = new TCHAR [new_len+1];
-      if (!(*out)) { *out = src; *out_len = lstrlen (src); return 0; }
-      *created_new_string = true;
-      i = 0; j = 0; int k = 0;
-
-      while (src[i]) {
-          while (src[i] && src[i] != from[0]) {
-              (*out)[k++] = src[i++];
-          }
-          while (src[i] && src[i] == from[j]) {
-              (*out)[k++] = src[i++];
-              j++;
-
-              if (from[j] == '\0') {  // found match
-                  k -= from_len;
-                  ASSERT (k >= 0, (L""));
-                  memcpy ((byte *)((*out)+k), (byte *)to, sizeof (TCHAR) * to_len);
-                  k += to_len;
-                  break;
-              }
-          }
-
-          j = 0;
-      }
-
-      (*out)[k] = '\0';
-      ASSERT (k == new_len, (L""));
-      *out_len = new_len;
-  }
-
-  return matches;
-}
-
-/****************************************************************************
-* wcstol, wcstoul(nptr,endptr,ibase) - Convert ascii string to long un/signed int.
-*
-* modified from:
-*
-* wcstol.c - Contains C runtimes wcstol and wcstoul
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*   Purpose:
-*       Convert an ascii string to a long 32-bit value.  The base
-*       used for the caculations is supplied by the caller.  The base
-*       must be in the range 0, 2-36.  If a base of 0 is supplied, the
-*       ascii string must be examined to determine the base of the
-*       number:
-*           (a) First char = '0', second char = 'x' or 'X',
-*               use base 16.
-*           (b) First char = '0', use base 8
-*           (c) First char in range '1' - '9', use base 10.
-*
-*       If the 'endptr' value is non-NULL, then wcstol/wcstoul places
-*       a pointer to the terminating character in this value.
-*       See ANSI standard for details
-*
-*Entry:
-*       nptr == NEAR/FAR pointer to the start of string.
-*       endptr == NEAR/FAR pointer to the end of the string.
-*       ibase == integer base to use for the calculations.
-*
-*       string format: [whitespace] [sign] [0] [x] [digits/letters]
-*
-*Exit:
-*       Good return:
-*           result
-*
-*       Overflow return:
-*           wcstol -- LONG_MAX or LONG_MIN
-*           wcstoul -- ULONG_MAX
-*           wcstol/wcstoul -- errno == ERANGE
-*
-*       No digits or bad base return:
-*           0
-*           endptr = nptr*
-*
-*Exceptions:
-*       None.
-*
-*******************************************************************************/
-
-// flag values */
-#define kFlUnsigned   (1)       // wcstoul called */
-#define kFlNeg        (2)       // negative sign found */
-#define kFlOverflow   (4)       // overflow occured */
-#define kFlReaddigit  (8)       // we've read at least one correct digit */
-
-static unsigned long __cdecl wcstoxl (const wchar_t *nptr, wchar_t **endptr, int ibase, int flags) {
-  ASSERT(nptr, (L""));
-
-  const wchar_t *p;
-  wchar_t c;
-  unsigned long number;
-  unsigned digval;
-  unsigned long maxval;
-  // #ifdef _MT
-  // pthreadlocinfo ptloci = _getptd()->ptlocinfo;
-
-  // if ( ptloci != __ptlocinfo )
-  //    ptloci = __updatetlocinfo();
-  // #endif  // _MT */
-
-  p = nptr;           // p is our scanning pointer */
-  number = 0;         // start with zero */
-
-  c = *p++;           // read char */
-
-  // #ifdef _MT
-  //        while ( __iswspace_mt(ptloci, c) )
-  // #else  // _MT */
-  while (c == ' ')
-  //        while ( iswspace(c) )
-  // #endif  // _MT */
-      c = *p++;       // skip whitespace */
-
-  if (c == '-') {
-      flags |= kFlNeg;    // remember minus sign */
-      c = *p++;
-  }
-  else if (c == '+')
-      c = *p++;       // skip sign */
-
-  if (ibase < 0 || ibase == 1 || ibase > 36) {
-      // bad base! */
-      if (endptr)
-          // store beginning of string in endptr */
-          *endptr = const_cast<wchar_t *>(nptr);
-      return 0L;      // return 0 */
-  }
-  else if (ibase == 0) {
-      // determine base free-lance, based on first two chars of
-      // string */
-      if (String_CharToDigit(c) != 0)
-          ibase = 10;
-      else if (*p == L'x' || *p == L'X')
-          ibase = 16;
-      else
-          ibase = 8;
-  }
-
-  if (ibase == 16) {
-      // we might have 0x in front of number; remove if there */
-      if (String_CharToDigit(c) == 0 && (*p == L'x' || *p == L'X')) {
-          ++p;
-          c = *p++;   // advance past prefix */
-      }
-  }
-
-  // if our number exceeds this, we will overflow on multiply */
-  maxval = ULONG_MAX / ibase;
-
-  for (;;) {  // exit in middle of loop */
-
-      // convert c to value */
-      if ( (digval = String_CharToDigit(c)) != (unsigned) -1 )
-          ;
-      else if (c >= 'A' && c <= 'F') { digval = c - 'A' + 10; }
-      else if (c >= 'a' && c <= 'f') { digval = c - 'a' + 10; }
-      // else if ( __ascii_iswalpha(c))
-      //     digval = __ascii_towupper(c) - L'A' + 10;
-      else
-          break;
-
-      if (digval >= (unsigned)ibase)
-          break;      // exit loop if bad digit found */
-
-      // record the fact we have read one digit */
-      flags |= kFlReaddigit;
-
-      // we now need to compute number = number * base + digval,
-      // but we need to know if overflow occured.  This requires
-      // a tricky pre-check. */
-
-      if (number < maxval || (number == maxval &&
-      (unsigned long)digval <= ULONG_MAX % ibase)) {
-          // we won't overflow, go ahead and multiply */
-          number = number * ibase + digval;
-      }
-      else {
-          // we would have overflowed -- set the overflow flag */
-          flags |= kFlOverflow;
-      }
-
-      c = *p++;       // read next digit */
-  }
-
-  --p;                // point to place that stopped scan */
-
-  if (!(flags & kFlReaddigit)) {
-      // no number there; return 0 and point to beginning of string */
-      if (endptr)
-          // store beginning of string in endptr later on */
-          p = nptr;
-      number = 0L;        // return 0 */
-  }
-  // lint -save -e648 -e650  Overflow in -LONG_MIN
-#pragma warning(push)
-// C4287 : unsigned/negative constant mismatch.
-// The offending expression is number > -LONG_MIN. -LONG_MIN overflows and
-// technically -LONG_MIN == LONG_MIN == 0x80000000. It should actually
-// result in a compiler warning, such as C4307: integral constant overflow.
-// Anyway, in the expression (number > -LONG_MIN) the right operand is converted
-// to unsigned long, so the expression is actually evaluated as
-// number > 0x80000000UL. The code is probably correct but subtle, to say the
-// least.
-#pragma warning(disable : 4287)
-  else if ( (flags & kFlOverflow) ||
-        ( !(flags & kFlUnsigned) &&
-          ( ( (flags & kFlNeg) && (number > -LONG_MIN) ) ||
-            ( !(flags & kFlNeg) && (number > LONG_MAX) ) ) ) )
-  {
-      // overflow or signed overflow occurred */
-      // errno = ERANGE;
-      if ( flags & kFlUnsigned )
-          number = ULONG_MAX;
-      else if ( flags & kFlNeg )
-        // lint -e{648, 650}  Overflow in -LONG_MIN
-        number = (unsigned long)(-LONG_MIN);
-      else
-        number = LONG_MAX;
-  }
-#pragma warning(pop)
-  // lint -restore
-
-  if (endptr != NULL)
-      // store pointer to char that stopped the scan */
-      *endptr = const_cast<wchar_t *>(p);
-
-  if (flags & kFlNeg)
-      // negate result if there was a neg sign */
-      number = (unsigned long)(-(long)number);
-
-  return number;          // done. */
-}
-
-long __cdecl Wcstol (const wchar_t *nptr, wchar_t **endptr, int ibase) {
-  ASSERT(endptr, (L""));
-  ASSERT(nptr, (L""));
-
-  return (long) wcstoxl(nptr, endptr, ibase, 0);
-}
-
-unsigned long __cdecl Wcstoul (const wchar_t *nptr, wchar_t **endptr, int ibase) {
-  // endptr may be NULL
-  ASSERT(nptr, (L""));
-
-  return wcstoxl(nptr, endptr, ibase, kFlUnsigned);
-}
-
-// Functions on arrays of strings
-
-// Returns true iff s is in the array strings (case-insensitive compare)
-bool String_MemberOf(const TCHAR* const* strings, const TCHAR* s) {
-  ASSERT(s, (L""));
-  // strings may be NULL
-
-  const int s_length = lstrlen(s);
-  if (strings == NULL)
-    return false;
-  for (; *strings != NULL; strings++) {
-    if (0 == String_StrNCmp(*strings, s, s_length, true)) {
-      return true;      // Found equal string
-    }
-  }
-  return false;
-}
-
-// Returns index of s in the array of strings (or -1 for missing) (case-insensitive compare)
-int String_IndexOf(const TCHAR* const* strings, const TCHAR* s) {
-  ASSERT(s, (L""));
-  // strings may be NULL
-
-  const int s_length = lstrlen(s);
-  if (strings == NULL)
-    return -1;
-  for (int i = 0; *strings != NULL; i++, strings++) {
-    if (0 == String_StrNCmp(*strings, s, s_length, true)) {
-      return i;      // Found equal string
-    }
-  }
-  return -1;
-}
-
-// The internal format is a int64.
-time64 StringToTime(const CString & time) {
-  return static_cast<time64>(String_StringToInt64(time));
-}
-
-// See above comment from StringToTime.
-// Just show it as a INT64 for now
-// NOTE: this will truncating it to INT64, which may lop off some times in the future
-CString TimeToString(const time64 & time) {
-  return String_Int64ToString(static_cast<int64>(time), 10);
-}
-
-const TCHAR *FindStringASpaceStringB (const TCHAR *s, const TCHAR *a, const TCHAR *b) {
-  ASSERT(s, (L""));
-  ASSERT(a, (L""));
-  ASSERT(b, (L""));
-
-  const TCHAR *search_from = s;
-  const TCHAR *pos;
-  while (*search_from && (pos = stristrW (search_from, a)) != NULL) {
-      const TCHAR *start = pos;
-      pos += lstrlen(a);
-      search_from = pos;
-      while (*pos == ' ' || *pos == '\t') pos++;
-      if (!String_StrNCmp (pos, b, lstrlen(b), true)) return start;
-  }
-
-  return 0;
-}
-
-bool IsAlphaA (const char c) {
-  return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
-}
-
-bool IsDigitA (const char c) {
-  return (c >= '0' && c <= '9');
-}
-
-void SafeStrCat (TCHAR *dest, const TCHAR *src, int dest_buffer_len) {
-  _tcscat_s(dest, dest_buffer_len, src);
-}
-
-// extracts next float in a string
-// skips any non-digit characters
-// return position after end of float
-const TCHAR *ExtractNextDouble (const TCHAR *s, double *f) {
-  ASSERT (f, (L""));
-  ASSERT (s, (L""));
-
-  CString num;
-  while (*s && !String_IsDigit (*s)) s++;
-  while (*s && (*s == '.' || String_IsDigit (*s))) { num += *s; s++; }
-  ASSERT (num.GetLength(), (L""));
-  *f = String_StringToDouble (num);
-  return s;
-}
-
-TCHAR *String_PathFindExtension(const TCHAR *path) {
-  ASSERT(path, (L""));
-
-  // Documentation says PathFindExtension string must be of max length
-  // MAX_PATH but a trusted tester hit the ASSERT and we don't really
-  // need it here, so commented out. We can't address where it is
-  // called because it's called from ATL code.
-  // ASSERT(lstrlen(path)<=MAX_PATH, (L""));
-
-  // point to terminating NULL
-  const TCHAR *ret = path + lstrlen(path);
-  const TCHAR *pos = ret;
-
-  while (--pos >= path) {
-    if (*pos == '.')
-      return const_cast<TCHAR *>(pos);
-  }
-
-  return const_cast<TCHAR *>(ret);
-}
-
-char String_ToLowerCharAnsi(char c) {
-  if (c >= 'A' && c <= 'Z') return (c + ('a' - 'A'));
-  return c;
-}
-
-int String_ToLowerChar(int c) {
-  // If it's < 128, then convert is ourself, which is far cheaper than the system conversion
-  if (c < 128)
-    return String_ToLowerCharAnsi(static_cast<char>(c));
-
-  return Char_ToLower(static_cast<TCHAR>(c));
-}
-
-
-bool String_PathRemoveFileSpec(TCHAR *path) {
-  ASSERT (path, (L""));
-
-  int len, pos;
-  len = pos = lstrlen (path);
-
-  // You might think that the SHLWAPI API does not change "c:\windows" -> "c:\"
-  // when c:\windows is a directory, but it does.
-
-  // If we don't want to match this weird API we can use the following to check
-  // for directories:
-
-  // Check if we are already a directory.
-  WIN32_FILE_ATTRIBUTE_DATA attrs;
-  // Failure (if file does not exist) is OK.
-  BOOL success = GetFileAttributesEx(path, GetFileExInfoStandard, &attrs);
-  UTIL_LOG(L4, (_T("[String_PathRemoveFileSpec][path %s][success %d][dir %d]"),
-                path,
-                success,
-                attrs.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
-  if (success && (attrs.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
-    // Remove trailing backslash, if any.
-    if (path[pos-1] == '\\')
-      path[pos-1] = '\0';
-    return 1;
-  }
-
-  // Find last backslash.
-  while (pos && path[pos] != '\\') pos--;
-  if (!pos && path[pos] != '\\') return 0;
-
-  ASSERT (pos < len, (L""));
-
-  // The documentation says it removes backslash but it doesn't for c:\.
-  if (!pos || path[pos-1] == ':' || (pos == 1 && path[0] == '\\'))
-    // Keep the backslash in this case.
-    path[pos+1] = '\0';
-  else
-    path[pos] = '\0';
-
-  return 1;
-}
-
-void String_EndWithChar(TCHAR *str, TCHAR c) {
-  ASSERT (str, (L""));
-  int len = lstrlen(str);
-  if (len == 0 || str[len - 1] != c) {
-    str[len] = c;
-    str[len + 1] = 0;
-  }
-}
-
-bool StartsWithBOM(const TCHAR* string) {
-  ASSERT(string, (L""));
-  wchar_t c = string[0];
-  if (c == 0xFFFE || c == 0xFEFF)
-    return true;
-  else
-    return false;
-}
-
-const TCHAR* StringAfterBOM(const TCHAR* string) {
-  ASSERT(string, (L""));
-  return &string[StartsWithBOM(string) ? 1 : 0];
-}
-
-bool String_StringToDecimalIntChecked(const TCHAR* str, int* value) {
-  ASSERT1(str);
-  ASSERT1(value);
-
-  if (_set_errno(0)) {
-    return false;
-  }
-
-  TCHAR* end_ptr = NULL;
-  *value = _tcstol(str, &end_ptr, 10);
-  ASSERT1(end_ptr);
-
-  if (errno) {
-    ASSERT1(ERANGE == errno);
-    // Overflow or underflow.
-    return false;
-  } else if (*value == 0) {
-    // The value returned could be an error code. tcsltol returns
-    // zero when it cannot convert the string. However we need to
-    // distinguish a real zero. Thus check to see if end_ptr is not the start
-    // of the string (str is not an empty string) and is pointing to a '\0'.
-    // If not, we have an error.
-    if ((str == end_ptr) || (*end_ptr != '\0')) {
-      return false;
-    }
-  } else if (*end_ptr != '\0') {
-    // The end_ptr is pointing at a character that is
-    // not the end of the string. Only part of the string could be converted.
-    return false;
-  }
-
-  return true;
-}
-
-bool CLSIDToCString(const GUID& guid, CString* str) {
-  ASSERT(str, (L""));
-
-  LPOLESTR string_guid = NULL;
-  if (::StringFromCLSID(guid, &string_guid) != S_OK) {
-    return false;
-  }
-  *str = string_guid;
-  ::CoTaskMemFree(string_guid);
-
-  return true;
-}
-
-HRESULT String_StringToBool(const TCHAR* str, bool* value) {
-  ASSERT1(str);
-  ASSERT1(value);
-
-  // This method now performs a case-insentitive
-  // culture aware compare. We should however be ok as we are only comparing
-  // latin characters.
-  if (_tcsicmp(kFalse, str) == 0) {
-    *value = false;
-  } else if (_tcsicmp(kTrue, str) == 0) {
-    *value = true;
-  } else {
-    // we found another string. should error out.
-    return E_FAIL;
-  }
-  return S_OK;
-}
-
-HRESULT String_BoolToString(bool value, CString* string) {
-  ASSERT1(string);
-  *string = value ? kTrue : kFalse;
-  return S_OK;
-}
-
-CString String_ReplaceIgnoreCase(const CString& string,
-                                 const CString& token,
-                                 const CString& replacement) {
-  int token_length = token.GetLength();
-  if (!token_length) {
-    return string;
-  }
-
-  CString string_lowercase(string);
-  CString token_lowercase(token);
-  string_lowercase.MakeLower();
-  token_lowercase.MakeLower();
-
-  CString output(string);
-  int replacement_length = replacement.GetLength();
-
-  int index = 0;
-  int output_index = 0;
-
-  for (int new_index = 0;
-       (new_index = string_lowercase.Find(token_lowercase, index)) != -1;
-       index = new_index + token_length) {
-    output_index += new_index - index;
-    output.Delete(output_index, token_length);
-    output.Insert(output_index, replacement);
-    output_index += replacement_length;
-  }
-
-  return output;
-}
-
-// Escape and unescape strings (shlwapi-based implementation).
-// The intended usage for these APIs is escaping strings to make up
-// URLs, for example building query strings.
-//
-// Pass false to the flag segment_only to escape the url. This will not
-// cause the conversion of the # (%23), ? (%3F), and / (%2F) characters.
-
-// Characters that must be encoded include any characters that have no
-// corresponding graphic character in the US-ASCII coded character
-// set (hexadecimal 80-FF, which are not used in the US-ASCII coded character
-// set, and hexadecimal 00-1F and 7F, which are control characters),
-// blank spaces, "%" (which is used to encode other characters),
-// and unsafe characters (<, >, ", #, {, }, |, \, ^, ~, [, ], and ').
-//
-// The input and output strings can't be longer than INTERNET_MAX_URL_LENGTH
-
-HRESULT StringEscape(const CString& str_in,
-                     bool segment_only,
-                     CString* str_out) {
-  ASSERT1(str_out);
-  ASSERT1(str_in.GetLength() < INTERNET_MAX_URL_LENGTH);
-
-  DWORD buf_len = INTERNET_MAX_URL_LENGTH + 1;
-  HRESULT hr = ::UrlEscape(str_in, str_out->GetBufferSetLength(buf_len), &buf_len,
-    segment_only ? URL_ESCAPE_PERCENT | URL_ESCAPE_SEGMENT_ONLY : URL_ESCAPE_PERCENT);
-  if (SUCCEEDED(hr)) {
-    str_out->ReleaseBuffer();
-    ASSERT1(buf_len <= INTERNET_MAX_URL_LENGTH);
-  }
-  return hr;
-}
-
-HRESULT StringUnescape(const CString& str_in, CString* str_out) {
-  ASSERT1(str_out);
-  ASSERT1(str_in.GetLength() < INTERNET_MAX_URL_LENGTH);
-
-  DWORD buf_len = INTERNET_MAX_URL_LENGTH + 1;
-  HRESULT hr = ::UrlUnescape(const_cast<TCHAR*>(str_in.GetString()),
-    str_out->GetBufferSetLength(buf_len), &buf_len, 0);
-  if (SUCCEEDED(hr)) {
-    str_out->ReleaseBuffer(buf_len + 1);
-    ASSERT1(buf_len <= INTERNET_MAX_URL_LENGTH);
-  }
-  return hr;
-}
-
-bool String_StringToTristate(const TCHAR* str, Tristate* value) {
-  ASSERT1(str);
-  ASSERT1(value);
-
-  int numerical_value = 0;
-  if (!String_StringToDecimalIntChecked(str, &numerical_value)) {
-    return false;
-  }
-
-  switch (numerical_value) {
-    case 0:
-      *value = TRISTATE_FALSE;
-      break;
-    case 1:
-      *value = TRISTATE_TRUE;
-      break;
-    case 2:
-      *value = TRISTATE_NONE;
-      break;
-    default:
-      return false;
-  }
-
-  return true;
-}
-
-// Extracts the name and value from a string that contains a name/value pair.
-bool ParseNameValuePair(const CString& token,
-                        TCHAR separator,
-                        CString* name,
-                        CString* value) {
-  ASSERT1(name);
-  ASSERT1(value);
-
-  int separator_index = token.Find(separator);
-  if ((separator_index == -1) ||  // Not a name-value pair.
-      (separator_index == 0) ||  // No name was supplied.
-      (separator_index == (token.GetLength() - 1))) {  // No value was supplied.
-    return false;
-  }
-
-  *name = token.Left(separator_index);
-  *value = token.Right(token.GetLength() - separator_index - 1);
-
-  ASSERT1(token.GetLength() == name->GetLength() + value->GetLength() + 1);
-
-  // It's not possible for the name to contain the separator.
-  ASSERT1(-1 == name->Find(separator));
-  if (-1 != value->Find(separator)) {
-    // The value contains the separator.
-    return false;
-  }
-
-  return true;
-}
-
-bool SplitCommandLineInPlace(TCHAR *command_line,
-                             TCHAR **first_argument_parameter,
-                             TCHAR **remaining_arguments_parameter) {
-  if (!command_line ||
-      !first_argument_parameter ||
-      !remaining_arguments_parameter) {
-    return false;
-  }
-
-  TCHAR end_char;
-  TCHAR *&first_argument = *first_argument_parameter;
-  TCHAR *&remaining_arguments = *remaining_arguments_parameter;
-  if (_T('\"') == *command_line) {
-    end_char = _T('\"');
-    first_argument = remaining_arguments = command_line + 1;
-  } else {
-    end_char = _T(' ');
-    first_argument = remaining_arguments = command_line;
-  }
-  // Search for the end of the first argument
-  while (end_char != *remaining_arguments && '\0' != *remaining_arguments) {
-    ++remaining_arguments;
-  }
-  if (end_char == *remaining_arguments) {
-    *remaining_arguments = '\0';
-    do {
-      // Skip the spaces between the first argument and the remaining arguments.
-      ++remaining_arguments;
-    } while (_T(' ') == *remaining_arguments);
-  }
-  return true;
-}
-
-bool ContainsOnlyAsciiChars(const CString& str) {
-  for (int i = 0; i < str.GetLength(); ++i) {
-    if (str[i] > 0x7F) {
-      return false;
-    }
-  }
-  return true;
-}
-CString BytesToHex(const uint8* bytes, size_t num_bytes) {
-  CString result;
-  if (bytes) {
-    result.Preallocate(num_bytes * sizeof(TCHAR));
-    static const TCHAR* const kHexChars = _T("0123456789abcdef");
-    for (size_t i = 0; i != num_bytes; ++i) {
-      result.AppendChar(kHexChars[(bytes[i] >> 4)]);
-      result.AppendChar(kHexChars[(bytes[i] & 0xf)]);
-    }
-  }
-  return result;
-}
-
-CString BytesToHex(const std::vector<uint8>& bytes) {
-  CString result;
-  if (!bytes.empty()) {
-    result.SetString(BytesToHex(&bytes.front(), bytes.size()));
-  }
-  return result;
-}
-
-void JoinStrings(const std::vector<CString>& components,
-                 const TCHAR* delim,
-                 CString* result) {
-  ASSERT1(result);
-  result->Empty();
-
-  // Compute length so we can reserve memory.
-  size_t length = 0;
-  size_t delim_length = delim ? _tcslen(delim) : 0;
-  for (size_t i = 0; i != components.size(); ++i) {
-    if (i != 0) {
-      length += delim_length;
-    }
-    length += components[i].GetLength();
-  }
-
-  result->Preallocate(length);
-
-  for (size_t i = 0; i != components.size(); ++i) {
-    if (i != 0 && delim) {
-      result->Append(delim, delim_length);
-    }
-    result->Append(components[i]);
-  }
-}
-
-void JoinStringsInArray(const TCHAR* components[],
-                        int num_components,
-                        const TCHAR* delim,
-                        CString* result) {
-  ASSERT1(result);
-  result->Empty();
-
-  for (int i = 0; i != num_components; ++i) {
-    if (i != 0 && delim) {
-      result->Append(delim);
-    }
-    if (components[i]) {
-      result->Append(components[i]);
-    }
-  }
-}
-
-CString FormatResourceMessage(uint32 resource_id, ...) {
-  CString format;
-  const bool is_loaded = !!format.LoadString(resource_id);
-
-  if (!is_loaded) {
-    return CString();
-  }
-
-  va_list arg_list;
-  va_start(arg_list, resource_id);
-
-  CString formatted;
-  formatted.FormatMessageV(format, &arg_list);
-
-  va_end(arg_list);
-
-  return formatted;
-}
-
-CString FormatErrorCode(DWORD error_code) {
-  CString error_code_string;
-  if (FAILED(error_code)) {
-    error_code_string.Format(_T("0x%08x"), error_code);
-  } else {
-    error_code_string.Format(_T("%u"), error_code);
-  }
-  return error_code_string;
-}
-
-HRESULT WideStringToUtf8UrlEncodedString(const CString& str, CString* out) {
-  ASSERT1(out);
-
-  out->Empty();
-  if (str.IsEmpty()) {
-    return S_OK;
-  }
-
-  // Utf8 encode the Utf16 string first. Next urlencode it.
-  CStringA utf8str = WideToUtf8(str);
-  ASSERT1(!utf8str.IsEmpty());
-  DWORD buf_len = INTERNET_MAX_URL_LENGTH;
-  CStringA escaped_utf8_name;
-  HRESULT hr = ::UrlEscapeA(utf8str,
-                            CStrBufA(escaped_utf8_name, buf_len),
-                            &buf_len,
-                            0);
-  ASSERT1(buf_len <= INTERNET_MAX_URL_LENGTH);
-  ASSERT1(escaped_utf8_name.GetLength() == static_cast<int>(buf_len));
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[UrlEscapeA failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  *out = CString(escaped_utf8_name);
-  return S_OK;
-}
-
-HRESULT Utf8UrlEncodedStringToWideString(const CString& str, CString* out) {
-  ASSERT1(out);
-
-  out->Empty();
-  if (str.IsEmpty()) {
-    return S_OK;
-  }
-
-  // The value is a utf8 encoded url escaped string that is stored as a
-  // unicode string. Because of this, it should contain only ascii chars.
-  if (!ContainsOnlyAsciiChars(str)) {
-    UTIL_LOG(LE, (_T("[String contains non ascii chars]")));
-    return E_INVALIDARG;
-  }
-
-  CStringA escaped_utf8_val = WideToAnsiDirect(str);
-  DWORD buf_len = INTERNET_MAX_URL_LENGTH;
-  CStringA unescaped_val;
-  HRESULT hr = ::UrlUnescapeA(const_cast<char*>(escaped_utf8_val.GetString()),
-                              CStrBufA(unescaped_val, buf_len),
-                              &buf_len,
-                              0);
-  ASSERT1(unescaped_val.GetLength() == static_cast<int>(buf_len));
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[UrlUnescapeA failed][0x%08x]"), hr));
-    return hr;
-  }
-  ASSERT1(buf_len == static_cast<DWORD>(unescaped_val.GetLength()));
-  ASSERT1(buf_len <= INTERNET_MAX_URL_LENGTH);
-  CString app_name = Utf8ToWideChar(unescaped_val,
-                                    unescaped_val.GetLength());
-  if (app_name.IsEmpty()) {
-    return E_INVALIDARG;
-  }
-
-  *out = app_name;
-  return S_OK;
-}
-
-}  // namespace omaha
-
diff --git a/base/string.h b/base/string.h
deleted file mode 100644
index 7706341..0000000
--- a/base/string.h
+++ /dev/null
@@ -1,542 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_BASE_STRING_H_
-#define OMAHA_BASE_STRING_H_
-
-#include <windows.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-
-namespace omaha {
-
-#define STR_SIZE(str) (arraysize(str)-1)  // number of characters in char array (only for single-byte string literals!!!)
-#define TSTR_SIZE(tstr) (arraysize(tstr)-1)  // like STR_SIZE but works on _T("string literal") ONLY!!!
-
-#define kEllipsis L".."
-
-// The number of replacements matches we expect, before we start allocating extra memory
-// to process it. This is an optimizing constant
-#define kExpectedMaxReplaceMatches 100
-
-// TODO(omaha): above each of these function names, we should
-// define what we expect the implementation to do. that way,
-// implementers will know what is desired. an example would probably
-// make things easiest.
-CString AbbreviateString (const CString & title, int32 max_len);
-CString AbbreviateUri (const CString & uri, int32 max_len);
-CString NormalizeUri (const CString & uri);
-
-// removes "http://", "ftp://", "mailto:" or "file://" (note that the "file" protocol is
-// like: "file:///~/calendar", this method removes only the first two slashes
-CString RemoveInternetProtocolHeader (const CString& url);
-
-// Converts a file:// URI to a valid Windows path.
-HRESULT ConvertFileUriToLocalPath(const CString& uri, CString* path_out);
-
-void RemoveFromStart (CString & s, const TCHAR* remove, bool ignore_case);
-void RemoveFromEnd (CString & s, const TCHAR* remove);
-
-// Limit string to max length, truncating and adding ellipsis if needed
-// Attempts to not leave a partial word at the end, unless min_len is reached
-CString ElideIfNeeded (const CString & input_string, int max_len, int min_len);
-
-// The ability to clean up a string for relevant target audiences. Add flags accordingly
-
-// Sanitizes for insertion in an HTML document, uses the basic literals [<>&]
-#define kSanHtml 0x1
-
-// XML is the HTML replacements, and a few more
-#define kSanXml (kSanHtml | 0x2)
-
-// Javascript has a seperate set of encodings [which is a superset of HTML replacements]
-#define kSanJs (kSanHtml | 0x4)
-
-// For input fields on HTML documents
-#define kSanHtmlInput 0x8
-
-// TODO(omaha): be consistent on use of int/uint32/int32 for lengths
-
-// The input length of the string does not include the null terminator.
-// Caller deletes the returned buffer.
-WCHAR *ToWide (const char *s, int len);
-
-// returns pointer to data if found otherwise NULL
-const byte *BufferContains (const byte *buf, uint32 buf_len, const byte *data, uint32 data_len);
-
-// Given a string, 'protect' the characters that are invalid for a given mode
-// For instance, kSanHtml will replace < with the HTML literal equivalent
-// If kSanHtml is used, and bold_periods is true, then periods used for url abbreviation are bolded.
-// NOTE: If you call AbbreviateLinkForDisplay before this function, then there might be periods
-// used for abbreviation.  BoldAbbreviationPeriods should be called after HighlightTerms.
-CString SanitizeString(const CString & in, DWORD mode);
-
-// Bolds the periods used for abbreviation.  Call this after HighlightTerms.
-CString BoldAbbreviationPeriods(const CString & in);
-
-// Unencode a URL encoded string
-CString Unencode(const CString & input);
-
-CString GetTextInbetween(const CString &input, const CString &start, const CString &end);
-
-// Given a ? seperated string, extract a particular segment, and URL-Unencode it
-CString GetParam(const CString & input, const CString & key);
-
-// Given an XML style string, extract the contents of a <INPUT>...</INPUT> pair
-CString GetField (const CString & input, const CString & field);
-
-// Finds a whole word match in the query, followed by a ":".
-// If not found, return -1.
-//
-// Note: this is case sensitive.
-int FindWholeWordMatch (const CString &query,
-  const CString &word_to_match,
-  const bool end_with_colon,
-  const int index_begin);
-
-// Do whole-word replacement in "str".
-// This does not do partial matches (unlike CString::Replace),
-//   e.g.  CString::Replace will replace "ie" within "pie" and
-// this function will not.
-//
-// Note: this is case sensitive.
-void ReplaceWholeWord (const CString &string_to_replace,
-  const CString &replacement,
-  const bool trim_whitespace,
-  CString *str);
-
-// Convert Wide to ANSI directly. Use only when it is all ANSI
-CStringA WideToAnsiDirect(const CString & in);
-
-// Transform a unicode string into UTF8, used primarily by the webserver
-CStringA WideToUtf8(const CString& w);
-
-// Converts the UTF-8 encoded buffer to an in-memory Unicode (wide character)
-// string.
-// @param utf8 A non-NULL pointer to a UTF-8 encoded buffer that has at
-// least num_bytes valid characters.
-// @param num_bytes Number of bytes to process from utf8.
-// @return The Unicode string represented by utf8 (or that part of it
-// specified by num_bytes).  If the UTF-8 representation of the string started
-// with a byte-order marker (BOM), it will be ignored and not included in the
-// returned string.  On failure, the function returns the empty string.
-CString Utf8ToWideChar(const char* utf8, uint32 num_bytes);
-CString Utf8BufferToWideChar(const std::vector<uint8>& buffer);
-
-// Dealing with Unicode BOM
-bool StartsWithBOM(const TCHAR* string);
-const TCHAR* StringAfterBOM(const TCHAR* string);
-
-// Convert an ANSI string into Widechar string, according to the specified
-// codepage. The input length can be -1, if the string is null terminated, and
-// the actual length will be used internally.
-BOOL AnsiToWideString(const char *from, int length, UINT codepage, CString *to);
-
-// Convert char to Wchar directly
-CString AnsiToWideString(const char *from, int length);
-
-// these functions untested
-// they should not be used unless tested
-// HRESULT AnsiToUTF8 (char * src, int src_len, char * dest, int *dest_len);
-// HRESULT UTF8ToAnsi (char * src, int src_len, char * dest, int *dest_len);
-// HRESULT UCS2ToUTF8 (LPCWSTR src, int src_len, char * dest, int *dest_len);
-// HRESULT UTF8ToUCS2 (char * src, int src_len, LPWSTR dest, int *dest_len);
-
-// "Absolute" is perhaps not the right term, this normalizes the Uri
-// given http://www.google.com changes to correct http://www.google.com/
-// given http://www.google.com// changes to correct http://www.google.com/
-// given http://www.google.com/home.html returns the same
-CString GetAbsoluteUri(const CString& uri);
-
-// Reverse (big-endian<->little-endian) the shorts that make up
-// Unicode characters in a byte array of Unicode chars
-HRESULT ReverseUnicodeByteOrder(byte* unicode_string, int size_in_bytes);
-
-// given http://google.com/bobby this returns http://google.com/
-// If strip_leading is specified, it will turn
-// http://www.google.com into http://google.com
-#define kStrLeadingWww _T("www.")
-// TODO(omaha): no default parameters
-CString GetUriHostName(const CString& uri, bool strip_leading = false);
-CString GetUriHostNameHostOnly(const CString& uri, bool strip_leading_www);
-
-const char *stristr(const char *string, const char *pattern);
-const WCHAR *stristrW(const WCHAR *string, const WCHAR *pattern);
-const WCHAR *strstrW(const WCHAR *string, const WCHAR *pattern);
-
-// Add len_to_add to len_so_far, assuming that if it exceeds the
-// length of the line, it will word wrap onto the next line.  Returns
-// the total length of all the lines summed together.
-float GetLenWithWordWrap (const float len_so_far,
-  const float len_to_add,
-  const uint32 len_line);
-
-// ----------------------------------------------------------------------
-// QuotedPrintableUnescape()
-//    Copies "src" to "dest", rewriting quoted printable escape sequences
-//    =XX to their ASCII equivalents. src is not null terminated, instead
-//    specify len. I recommend that slen<len_dest, but we honour len_dest
-//    anyway.
-//    RETURNS the length of dest.
-// ----------------------------------------------------------------------
-int QuotedPrintableUnescape(const WCHAR *src, int slen, WCHAR *dest, int len_dest);
-
-// Return the length to use for the output buffer given to the base64 escape
-// routines. Make sure to use the same value for do_padding in both.
-// This function may return incorrect results if given input_len values that
-// are extremely high, which should happen rarely.
-int CalculateBase64EscapedLen(int input_len, bool do_padding);
-// Use this version when calling Base64Escape without a do_padding arg.
-int CalculateBase64EscapedLen(int input_len);
-
-// ----------------------------------------------------------------------
-// Base64Escape()
-// WebSafeBase64Escape()
-//    Encode "src" to "dest" using base64 encoding.
-//    src is not null terminated, instead specify len.
-//    'dest' should have at least CalculateBase64EscapedLen() length.
-//    RETURNS the length of dest.
-//    The WebSafe variation use '-' instead of '+' and '_' instead of '/'
-//    so that we can place the out in the URL or cookies without having
-//    to escape them.  It also has an extra parameter "do_padding",
-//    which when set to false will prevent padding with "=".
-// ----------------------------------------------------------------------
-int Base64Escape(const char *src, int slen, char *dest, int szdest);
-int WebSafeBase64Escape(const char *src, int slen, char *dest,
-                        int szdest, bool do_padding);
-void WebSafeBase64Escape(const CStringA& src, CStringA* dest);
-
-void Base64Escape(const char *src, int szsrc,
-                  CStringA* dest, bool do_padding);
-void WebSafeBase64Escape(const char *src, int szsrc,
-                         CStringA* dest, bool do_padding);
-
-// ----------------------------------------------------------------------
-// Base64Unescape()
-//    Copies "src" to "dest", where src is in base64 and is written to its
-//    ASCII equivalents. src is not null terminated, instead specify len.
-//    I recommend that slen<len_dest, but we honour len_dest anyway.
-//    RETURNS the length of dest.
-//    The WebSafe variation use '-' instead of '+' and '_' instead of '/'.
-// ----------------------------------------------------------------------
-int Base64Unescape(const char *src, int slen, char *dest, int len_dest);
-int WebSafeBase64Unescape(const char *src, int slen, char *dest, int szdest);
-
-#ifdef UNICODE
-#define IsSpace IsSpaceW
-#else
-#define IsSpace IsSpaceA
-#endif
-
-bool IsSpaceW(WCHAR c);
-bool IsSpaceA(char c);
-
-// Remove all leading and trailing whitespace from s.
-// Returns the new length of the string (not including 0-terminator)
-int TrimCString(CString &s);
-int Trim(TCHAR *s);
-
-// Trims all characters in the delimiter string from both ends of the
-// string s
-void TrimString(CString& s, const TCHAR* delimiters);
-
-// Strip the first token from the front of argument s.  A token is a
-// series of consecutive non-blank characters - unless the first
-// character is a double-quote ("), in that case the token is the full
-// quoted string
-CString StripFirstQuotedToken(const CString& s);
-
-// A block of text to separate lines, and back
-void TextToLines(const CString& text, const TCHAR* delimiter, std::vector<CString>* lines);
-// (LinesToText puts a delimiter at the end of the last line too)
-void LinesToText(const std::vector<CString>& lines, const TCHAR* delimiter, CString* text);
-
-// Make a CString lower case
-void MakeLowerCString(CString & s);
-
-// Clean up the string: replace all whitespace with spaces, and
-// replace consecutive spaces with one.
-// Returns the new length of the string (not including 0-terminator)
-int CleanupWhitespaceCString(CString &s);
-int CleanupWhitespace(TCHAR *s);
-
-int HexDigitToInt (WCHAR c);
-bool IsHexDigit (WCHAR c);
-
-// Converts to lower, but does so much faster if the string is ANSI
-TCHAR * String_FastToLower(TCHAR * str);
-
-// Replacement for the CRT toupper(c)
-int String_ToUpper(int c);
-
-// Replacement for the CRT toupper(c)
-char String_ToUpperA(char c);
-
-// Converts str to lowercase in place.
-void String_ToLower(TCHAR* str);
-
-// Converts str to uppercase in place.
-void String_ToUpper(TCHAR* str);
-
-bool String_IsUpper(TCHAR c);
-
-// String comparison based on length
-// Replacement for the CRT strncmp(i)
-int String_StrNCmp(const TCHAR * str1, const TCHAR * str2, uint32 len, bool ignore_case);
-
-// Replacement for strncpy() - except ALWAYS ends string with null
-TCHAR* String_StrNCpy(TCHAR* destination, const TCHAR* source, uint32 len);
-
-// check if str starts with start_str
-bool String_StartsWith(const TCHAR *str, const TCHAR *start_str, bool ignore_case);
-
-// check if str starts with start_str, for char *
-bool String_StartsWithA(const char *str, const char *start_str, bool ignore_case);
-
-// check if str ends with end_str
-bool String_EndsWith(const TCHAR *str, const TCHAR *end_str, bool ignore_case);
-
-// If the input string str doesn't already end with the string end_str,
-// make it end with the string end_str.
-CString String_MakeEndWith(const TCHAR *str, const TCHAR* end_str, bool ignore_case);
-
-// converts an int to a string
-CString String_Int64ToString(int64 value, int radix);
-
-// converts an uint64 to a string
-CString String_Uint64ToString(uint64 value, int radix);
-
-// Convert numeric types to CString
-CString sizet_to_str(const size_t & i);
-CString itostr(const int i);
-CString itostr(const uint32 i);
-
-// converts a large number to an approximate value, like "1.2G" or "900M"
-// base_ten = true if based on powers of 10 (like disk space) otherwise based
-// on powers of two.  power = 0 for *10^0, 1 for *10^3 or 2^10, 2 for *10^6
-// or 2^20, and 3 for *10^9 or 2^30, in other words: no units, K, M, or G.
-CString String_LargeIntToApproximateString(uint64 value, bool base_ten, int* power);
-
-// converts a string to an  int
-// Does not check for overflow
-int32 String_StringToInt(const TCHAR * str);
-
-int64 String_StringToInt64(const TCHAR * str);
-
-// converts an double to a string
-// specifies the number of digits after the decimal point
-// TODO(omaha): Make this work for negative values
-CString String_DoubleToString(double value, int point_digits);
-
-// convert string to double
-double String_StringToDouble (const TCHAR *s);
-
-// Converts a character to a digit
-// if the character is not a digit return -1
-int32 String_CharToDigit(const TCHAR c);
-
-// returns true if ASCII digit
-bool String_IsDigit(const TCHAR c);
-
-// Converts the digit to a character.
-TCHAR String_DigitToChar(unsigned int n);
-
-// Returns true if an identifier character: letter, digit, or "_"
-bool String_IsIdentifierChar(const TCHAR c);
-
-// Returns true if the string has letters in it.
-// This is used by the keyword extractor to downweight numbers,
-// IDs (sequences of numbers like social security numbers), etc.
-bool String_HasAlphabetLetters (const TCHAR *str);
-
-// Return the index of the first occurrence of s2 in s1, or -1 if none.
-int String_FindString(const TCHAR *s1, const TCHAR *s2);
-int String_FindString(const TCHAR *s1, const TCHAR *s2, int start_pos);
-
-// Return the index of the first occurrence of c in s1, or -1 if none.
-int String_FindChar(const TCHAR *str, const TCHAR c);
-// start from index start_pos
-int String_FindChar(const TCHAR *str, const TCHAR c, int start_pos);
-
-// Return the index of the first occurrence of c in string, or -1 if none.
-int String_ReverseFindChar(const TCHAR * str, TCHAR c);
-
-bool String_Contains(const TCHAR *s1, const TCHAR *s2);
-
-// Replace old_char with new_char in str.
-void String_ReplaceChar(TCHAR *str, TCHAR old_char, TCHAR new_char);
-void String_ReplaceChar(CString & str, TCHAR old_char, TCHAR new_char);
-
-// Append the given character to the string if it doesn't already end with it.
-// There must be room in the string to append the character if necessary.
-void String_EndWithChar(TCHAR *str, TCHAR c);
-
-// A special version of the replace function which takes advantage of CString properties
-// to make it much faster when the string grows
-
-// NOTE: it CANNOT match more than kMaxReplaceMatches instances within the string
-// do not use this function if that is a possibility
-
-// The maximum number of replacements to perform. Essentially infinite
-const unsigned int kRepMax = kuint32max;
-int ReplaceCString (CString & src, const TCHAR *from, unsigned int from_len,
-                                   const TCHAR *to, unsigned int to_len,
-                                   unsigned int max_matches);
-
-// replace from with to in src
-// on memory allocation error, returns the original string
-int ReplaceString (TCHAR *src, const TCHAR *from, const TCHAR *to, TCHAR **out, int *out_len);
-
-// replace from with to in src
-// will replace in place if length(to) <= length(from) and return *out == src
-// WILL CREATE NEW OUTPUT BUFFER OTHERWISE and set created_new_string to true
-// on memory allocation error, returns the original string
-int ReplaceStringMaybeInPlace (TCHAR *src, const TCHAR *from, const TCHAR *to, TCHAR **out, int *out_len, bool *created_new_string);
-
-// you really want to use the straight TCHAR version above. you know it
-// on memory allocation error, returns the original string
-int ReplaceCString (CString & src, const TCHAR *from, const TCHAR *to);
-
-long __cdecl Wcstol (const wchar_t *nptr, wchar_t **endptr, int ibase);
-unsigned long __cdecl Wcstoul (const wchar_t *nptr, wchar_t **endptr, int ibase);
-
-// Functions on arrays of strings
-
-// Returns true iff s is in the array strings (case-insensitive compare)
-bool String_MemberOf(const TCHAR* const* strings, const TCHAR* s);
-// Returns index of s in the array of strings (or -1 for missing) (case-insensitive compare)
-int String_IndexOf(const TCHAR* const* strings, const TCHAR* s);
-
-// Serializes a time64 to a string, and then loads it out again, this string it not for human consumption
-time64 StringToTime(const CString & time);
-CString TimeToString(const time64 & time);
-
-// looks for string A followed by any number of spaces/tabs followed by string b
-// returns starting position of a if found, NULL if not
-// case insensitive
-const TCHAR *FindStringASpaceStringB (const TCHAR *s, const TCHAR *a, const TCHAR *b);
-
-bool IsAlphaA (const char c);
-bool IsDigitA (const char c);
-
-// TODO(omaha): deprecate since we have secure CRT now.
-// dest_buffer_len includes the NULL
-// always NULL terminates
-// dest must be a valid string with length < dest_buffer_len
-void SafeStrCat (TCHAR *dest, const TCHAR *src, int dest_buffer_len);
-
-const TCHAR *ExtractNextDouble (const TCHAR *s, double *f);
-
-TCHAR *String_PathFindExtension(const TCHAR *path);
-
-inline TCHAR Char_ToLower(TCHAR c) {
-// C4302: truncation from 'type 1' to 'type 2'
-#pragma  warning(disable : 4302)
-  return reinterpret_cast<TCHAR>(::CharLower(reinterpret_cast<TCHAR*>(c)));
-#pragma warning(default : 4302)
-}
-
-// @returns the lowercase character (type is int to be consistent with the CRT)
-int String_ToLowerChar(int c);
-
-// Replacement for the CRT tolower(c)
-char String_ToLowerCharAnsi(char c);
-
-bool String_PathRemoveFileSpec(TCHAR *path);
-
-// Escapes and unescapes strings (shlwapi-based implementation).
-// The indended usage for these APIs is escaping strings to make up
-// URLs, for example building query strings.
-//
-// Pass false to the flag segment_only to escape the url. This will not
-// cause the conversion of the # (%23), ? (%3F), and / (%2F) characters.
-HRESULT StringEscape(const CString& str_in,
-                     bool segment_only,
-                     CString* str_out);
-
-HRESULT StringUnescape(const CString& str_in, CString* str_out);
-
-// Converts a string to an int, performs all the necessary
-// checks to ensure that the string is correct.
-// Tests for overflow and non-int strings.
-bool String_StringToDecimalIntChecked(const TCHAR* str, int* value);
-
-// Converts CLSID to a string.
-bool CLSIDToCString(const GUID& guid, CString* str);
-
-// Converts a string to a bool.
-HRESULT String_StringToBool(const TCHAR* str, bool* value);
-
-// Convert boolean to its string representation.
-HRESULT String_BoolToString(bool value, CString* string);
-
-// Similar to ATL::CStringT::Replace() except that it ignores case.
-CString String_ReplaceIgnoreCase(const CString& string,
-                                 const CString& token,
-                                 const CString& replacement);
-// Converts a string to a Tristate enum.
-bool String_StringToTristate(const TCHAR* str, Tristate* value);
-
-// Extracts the name and value from a string that contains a name/value pair.
-bool ParseNameValuePair(const CString& token, TCHAR separator,
-                        CString* name, CString* value);
-
-// Splits a command line buffer into two parts in place:
-// first argument (which could be path to executable) and remaining arguments.
-// Note that the same pointer can be used for both command_line and
-// either of the remaining parameters.
-bool SplitCommandLineInPlace(TCHAR *command_line,
-                             TCHAR **first_argument,
-                             TCHAR **remaining_arguments);
-
-// Returns true if the unicode string only contains ascii values.
-bool ContainsOnlyAsciiChars(const CString& str);
-// Converts a buffer of bytes to a hex string.
-CString BytesToHex(const uint8* bytes, size_t num_bytes);
-
-// Converts a vector of bytes to a hex string.
-CString BytesToHex(const std::vector<uint8>& bytes);
-
-void JoinStrings(const std::vector<CString>& components,
-                 const TCHAR* delim,
-                 CString* result);
-
-void JoinStringsInArray(const TCHAR* components[],
-                        int num_components,
-                        const TCHAR* delim,
-                        CString* result);
-
-// Formats the specified message ID.
-// It is similar to CStringT::FormatMessage() but it returns an empty string
-// instead of throwing when the message ID cannot be loaded.
-CString FormatResourceMessage(uint32 resource_id, ...);
-
-// Formats an error code as an 8-digit HRESULT-style hex number or an unsigned
-// integer depending on whether it matches the HRESULT failure format.
-CString FormatErrorCode(DWORD error_code);
-
-// Converts the unicode string into a utf8 encoded, urlencoded string.
-// The resulting ascii string is returned in a wide CString.
-HRESULT WideStringToUtf8UrlEncodedString(const CString& str, CString* out);
-
-// Converts a string that is in the utf8 representation and is urlencoded
-// into a unicode string.
-HRESULT Utf8UrlEncodedStringToWideString(const CString& str, CString* out);
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_STRING_H_
diff --git a/base/string_unittest.cc b/base/string_unittest.cc
deleted file mode 100644
index 99fc571..0000000
--- a/base/string_unittest.cc
+++ /dev/null
@@ -1,1751 +0,0 @@
-// Copyright 2003-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "base/basictypes.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/localization.h"
-#include "omaha/base/string.h"
-#include "omaha/base/time.h"
-#include "omaha/base/timer.h"
-#include "omaha/base/tr_rand.h"
-#include "omaha/testing/resource.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(StringTest, IntToString) {
-  ASSERT_STREQ(String_Int64ToString(0, 10), L"0");
-  ASSERT_STREQ(String_Int64ToString(1, 10), L"1");
-  ASSERT_STREQ(String_Int64ToString(-1, 10), L"-1");
-  ASSERT_STREQ(String_Int64ToString(123456789, 10), L"123456789");
-  ASSERT_STREQ(String_Int64ToString(-123456789, 10), L"-123456789");
-  ASSERT_STREQ(String_Int64ToString(1234567890987654321, 10),
-               L"1234567890987654321");
-  ASSERT_STREQ(String_Int64ToString(-1234567890987654321, 10),
-               L"-1234567890987654321");
-  ASSERT_STREQ(String_Int64ToString(0xabcdef, 16), L"abcdef");
-  ASSERT_STREQ(String_Int64ToString(0x101fff, 16), L"101fff");
-  ASSERT_STREQ(String_Int64ToString(0x999999, 16), L"999999");
-  ASSERT_STREQ(String_Int64ToString(0x0, 16), L"0");
-
-  ASSERT_STREQ(String_Int64ToString(01234, 8), L"1234");
-  ASSERT_STREQ(String_Int64ToString(0, 8), L"0");
-  ASSERT_STREQ(String_Int64ToString(0777, 8), L"777");
-  ASSERT_STREQ(String_Int64ToString(0123456, 8), L"123456");
-
-  ASSERT_STREQ(String_Int64ToString(0, 2), L"0");
-  ASSERT_STREQ(String_Int64ToString(0xf, 2), L"1111");
-  ASSERT_STREQ(String_Int64ToString(0x5ad1, 2), L"101101011010001");
-  ASSERT_STREQ(String_Int64ToString(-1, 2), L"-1");
-}
-
-TEST(StringTest, UintToString) {
-  ASSERT_STREQ(String_Uint64ToString(0, 10), L"0");
-  ASSERT_STREQ(String_Uint64ToString(1, 10), L"1");
-  ASSERT_STREQ(String_Uint64ToString(123456789, 10), L"123456789");
-  ASSERT_STREQ(String_Uint64ToString(1234567890987654321, 10),
-               L"1234567890987654321");
-  ASSERT_STREQ(String_Uint64ToString(18446744073709551615, 10),
-               L"18446744073709551615");
-
-  ASSERT_STREQ(String_Uint64ToString(0xabcdef, 16), L"abcdef");
-  ASSERT_STREQ(String_Uint64ToString(0x101fff, 16), L"101fff");
-  ASSERT_STREQ(String_Uint64ToString(0x999999, 16), L"999999");
-  ASSERT_STREQ(String_Uint64ToString(0x0, 16), L"0");
-  ASSERT_STREQ(String_Uint64ToString(0xffffffffffffffff, 16), L"ffffffffffffffff");
-
-  ASSERT_STREQ(String_Uint64ToString(01234, 8), L"1234");
-  ASSERT_STREQ(String_Uint64ToString(0, 8), L"0");
-  ASSERT_STREQ(String_Uint64ToString(0777, 8), L"777");
-  ASSERT_STREQ(String_Uint64ToString(0123456, 8), L"123456");
-
-  ASSERT_STREQ(String_Uint64ToString(0, 2), L"0");
-  ASSERT_STREQ(String_Uint64ToString(0xf, 2), L"1111");
-  ASSERT_STREQ(String_Uint64ToString(0x5ad1, 2), L"101101011010001");
-}
-
-TEST(StringTest, DoubleToString) {
-  ASSERT_STREQ(String_DoubleToString(1.234, 1), L"1.2");
-  ASSERT_STREQ(String_DoubleToString(0.0, 0), L"0");
-  ASSERT_STREQ(String_DoubleToString(0.0, 2), L"0.00");
-  ASSERT_STREQ(String_DoubleToString(199.234, 2), L"199.23");
-  ASSERT_STREQ(String_DoubleToString(-199.234, 2), L"-199.23");
-  ASSERT_STREQ(String_DoubleToString(199.23490776, 5), L"199.23490");
-  ASSERT_STREQ(String_DoubleToString(-1.0001, 1), L"-1.0");
-  ASSERT_STREQ(String_DoubleToString(123456789.987654321, 3), L"123456789.987");
-}
-
-TEST(StringTest, StrNCpy) {
-  TCHAR * str1 = L"test str 1234";
-  TCHAR * str2 = L"test str 12";
-  TCHAR * str3 = L"Test StR 1234";
-
-  // check case sensitive
-  ASSERT_TRUE(0 == String_StrNCmp(str1, str2, 10, false));
-  ASSERT_TRUE(0 == String_StrNCmp(str1, str2, 11, false));
-
-  // check case in-sensitive
-  ASSERT_TRUE(0 == String_StrNCmp(str2, str3, 10, true));
-  ASSERT_TRUE(0 == String_StrNCmp(str2, str3, 11, true));
-}
-
-TEST(StringTest, StartsWith) {
-  ASSERT_TRUE(String_StartsWith(L"", L"", false));
-  ASSERT_TRUE(String_StartsWith(L"Joe", L"", false));
-  ASSERT_TRUE(String_StartsWith(L"Joe", L"J", false));
-  ASSERT_TRUE(String_StartsWith(L"Joe\\", L"J", false));
-  ASSERT_TRUE(String_StartsWith(L"Joe", L"Joe", false));
-  ASSERT_TRUE(String_StartsWith(L"The quick brown fox", L"The quic", false));
-  ASSERT_FALSE(String_StartsWith(L"", L"J", false));
-  ASSERT_FALSE(String_StartsWith(L"Joe", L"Joe2", false));
-  ASSERT_FALSE(String_StartsWith(L"The quick brown fox", L"The quiC", false));
-
-  ASSERT_TRUE(String_StartsWith(L"", L"", true));
-  ASSERT_TRUE(String_StartsWith(L"Joe", L"j", true));
-  ASSERT_TRUE(String_StartsWith(L"The quick brown fox", L"The quiC", true));
-}
-
-TEST(StringTest, StartsWithA) {
-  ASSERT_TRUE(String_StartsWithA("", "", false));
-  ASSERT_TRUE(String_StartsWithA("Joe", "", false));
-  ASSERT_TRUE(String_StartsWithA("Joe", "J", false));
-  ASSERT_TRUE(String_StartsWithA("Joe\\", "J", false));
-  ASSERT_TRUE(String_StartsWithA("Joe", "Joe", false));
-  ASSERT_TRUE(String_StartsWithA("The quick brown fox", "The quic", false));
-  ASSERT_FALSE(String_StartsWithA("", "J", false));
-  ASSERT_FALSE(String_StartsWithA("Joe", "Joe2", false));
-  ASSERT_FALSE(String_StartsWithA("The quick brown fox", "The quiC", false));
-
-  ASSERT_TRUE(String_StartsWithA("", "", true));
-  ASSERT_TRUE(String_StartsWithA("Joe", "j", true));
-  ASSERT_TRUE(String_StartsWithA("The quick brown fox", "The quiC", true));
-}
-
-TEST(StringTest, EndsWith) {
-  // Case sensitive
-
-  // Empty suffix
-  ASSERT_TRUE(String_EndsWith(L"", L"", false));
-  ASSERT_TRUE(String_EndsWith(L"Joe", L"", false));
-
-  // Partial suffix
-  ASSERT_TRUE(String_EndsWith(L"Joe", L"e", false));
-  ASSERT_TRUE(String_EndsWith(L"Joe\\", L"\\", false));
-  ASSERT_TRUE(String_EndsWith(L"The quick brown fox", L"n fox", false));
-
-  // Suffix == String
-  ASSERT_TRUE(String_EndsWith(L"Joe", L"Joe", false));
-  ASSERT_TRUE(String_EndsWith(L"The quick brown fox",
-                              L"The quick brown fox",
-                              false));
-
-  // Fail cases
-  ASSERT_FALSE(String_EndsWith(L"", L"J", false));
-  ASSERT_FALSE(String_EndsWith(L"Joe", L"Joe2", false));
-  ASSERT_FALSE(String_EndsWith(L"Joe", L"2Joe", false));
-  ASSERT_FALSE(String_EndsWith(L"The quick brown fox", L"n foX", false));
-
-  // Check case insensitive
-
-  // Empty suffix
-  ASSERT_TRUE(String_EndsWith(L"", L"", true));
-  ASSERT_TRUE(String_EndsWith(L"Joe", L"", true));
-
-  // Partial suffix
-  ASSERT_TRUE(String_EndsWith(L"Joe", L"E", true));
-  ASSERT_TRUE(String_EndsWith(L"The quick brown fox", L"n FOX", true));
-
-  // Suffix == String
-  ASSERT_TRUE(String_EndsWith(L"Joe", L"JOE", true));
-  ASSERT_TRUE(String_EndsWith(L"The quick brown fox",
-                              L"The quick brown FOX",
-                              true));
-
-  // Fail cases
-  ASSERT_FALSE(String_EndsWith(L"The quick brown fox", L"s", true));
-  ASSERT_FALSE(String_EndsWith(L"The quick brown fox", L"Xs", true));
-  ASSERT_FALSE(String_EndsWith(L"The quick brown fox", L"the brown foX", true));
-}
-
-TEST(StringTest, Unencode) {
-  // Normal, correct usage.
-  // char 0x25 is '%'
-  ASSERT_STREQ(Unencode(L"?q=moon+doggy_%25%5E%26"), L"?q=moon doggy_%^&");
-  ASSERT_STREQ(Unencode(L"%54%68%69%73+%69%73%09%61%20%74%65%73%74%0A"),
-               L"This is\ta test\n");
-  ASSERT_STREQ(Unencode(L"This+is%09a+test%0a"), L"This is\ta test\n");
-
-  // NULL char.
-  ASSERT_STREQ(Unencode(L"Terminated%00before+this"), L"Terminated");
-  ASSERT_STREQ(Unencode(L"invalid+%a%25"), L"invalid %a%");
-  ASSERT_STREQ(Unencode(L"invalid+%25%41%37"), L"invalid %A7");
-  ASSERT_STREQ(Unencode(L"not a symbol %RA"), L"not a symbol %RA");
-  ASSERT_STREQ(Unencode(L"%ag"), L"%ag");
-  ASSERT_STREQ(Unencode(L"dontdecode%dont"), L"dontdecode%dont");
-  ASSERT_STREQ(Unencode(L""), L"");
-  ASSERT_STREQ(Unencode(L"%1"), L"%1");
-  ASSERT_STREQ(Unencode(L"\x100"), L"\x100");
-  ASSERT_STREQ(Unencode(L"this is%20a%20wide%20char%20\x345"),
-               L"this is a wide char \x345");
-  ASSERT_STREQ(Unencode(L"a utf8 string %E7%BC%9c %E4%B8%8a = 2"),
-               L"a utf8 string \x7f1c \x4e0a = 2");
-}
-
-#if 0
-static const struct {
-  const char *ansi;
-  const TCHAR *wide;
-  UINT cp;
-} kAnsi2WideTests[] = {
-  { "\xc8\xae\xc1\xbe", L"\x72ac\x8f86", CP_GB2312},
-  { "\xa5\x69\xb1\x4e\xc2\xb2\xc5\xe9",
-    L"\x53ef\x5c07\x7c21\x9ad4", CP_BIG5},
-  { "\xE7\xBC\x96\xE4\xB8\x8B", L"\x7f16\x4e0b", CP_UTF8},
-  { "ascii", L"ascii", CP_GB2312},
-  { "\x3C\x20\xE7\xBC\x96", L"\x003c\x0020\x00E7\x00BC\x0096", 0 },
-};
-
-bool TestAnsiToWideString() {
-  for (size_t i = 0; i < arraysize(kAnsi2WideTests); ++i) {
-    CStringW out;
-    if (kAnsi2WideTests[i].cp == 0) {
-      out = AnsiToWideString(kAnsi2WideTests[i].ansi,
-                             strlen(kAnsi2WideTests[i].ansi));
-    } else {
-      AnsiToWideString(kAnsi2WideTests[i].ansi,
-                       strlen(kAnsi2WideTests[i].ansi),
-                       kAnsi2WideTests[i].cp, &out);
-    }
-    CHK(out == kAnsi2WideTests[i].wide);
-  }
-  return true;
-}
-#endif
-
-TEST(StringTest, Show) {
-  ASSERT_STREQ(Show(0), _T("0"));
-  ASSERT_STREQ(Show(1), _T("1"));
-  ASSERT_STREQ(Show(-1), _T("-1"));
-}
-
-
-// Test international strings.
-TEST(StringTest, International) {
-  CString tabs_by_lang[] = {
-      _T("Web    Prente    Groepe    Gids    "),                    // Afrikaans
-      _T("Web    Fotografitë    Grupet    Drejtoriumi    "),        // Albanian
-      // Amharic is missing, that doesn't show in normal windows fonts
-      _T("ويب    صور    مجموعات    الدليل     "),                    // Arabic
-      _T("Web   Şəkillər   Qruplar   Qovluq   "),                   // Azerbaijani
-      _T("Web   Irudiak   Taldeak   Direktorioa   "),               // Basque
-      _T("Ўэб    Малюнкі    Групы    Каталёг    "),                 // Belarusian
-      _T("Antorjal    Chitraboli    Gosthi    Bishoy-Talika    "),  // Bengali
-      _T("MakarJal    Chhaya    Jerow    Nirdeshika    "),          // Bihari
-      _T("Veb   Imeges   Gruoops   Durectury "),                    // Bork
-      _T("Internet    Slike    Grupe    Katalog    "),              // Bosnian
-      _T("Gwiad    Skeudennoù    Strolladoù    Roll    "),          // Breton
-      _T("Мрежата    Изображения    Групи    Директория    "),      // Bulgarian
-      _T("Web    Imatges    Grups    Directori    "),               // Catalan
-      _T("所有网站    图像    网上论坛    网页目录    "),                            // Chinese Simplified
-      _T("所有網頁    圖片    網上論壇    網頁目錄     "),                            // Chinese Traditional
-      _T("Web    Slike    Grupe    Imenik    "),                    // Croatian
-      _T("Web    Obrázky    Skupiny    Adresář    "),               // Czech
-      _T("Nettet    Billeder    Grupper    Katalog    "),           // Danish
-      _T("Het Internet    Afbeeldingen    Discussiegroepen    Gids    "),  // Dutch
-      _T("Web    Images    Gwoups    Diwectowy    "),               // Elmer
-      _T("Web    Images    Groups    News    Froogle    more »"),   // English
-      _T("TTT    Bildoj    Grupoj    Katalogo     "),               // Esperanto
-      _T("Veeb    Pildid    Grupid    Kataloog    "),               // Estonian
-      _T("Netið    Myndir    Bólkar    Øki    "),                   // Faroese
-      _T("Web    Mga Larawan    Mga Grupo    Direktoryo    "),      // Filipino
-      _T("Web    Kuvat    Keskusteluryhmät    Hakemisto    "),      // Finnish
-      _T("Web    Images    Groupes    Annuaire    Actualités    "),  // French
-      _T("Web   Printsjes   Diskusjegroepen   Directory   "),       // Frisian
-      _T("Web    Imaxes    Grupos    Directorio    "),              // Galician
-      _T("ინტერნეტი   სურათები   ჯგუფები   კატალოგი   "),                      // Georgian
-      _T("Web    Bilder    Groups    Verzeichnis    News    "),     // German
-      _T("Ιστός    Eικόνες    Ομάδες    Κατάλογος    "),            // Greek
-      _T("Ñanduti   Ta'anga   Atypy   Sãmbyhypy "),                 // Guarani
-      _T("jalu    Chhabi    Sangathan    Shabdakosh    "),          // Gujarati
-      _T("n0rM4L s33rCh    1|\\/|4935    6r00pZ    d1r3c70rY    "),  // Hacker
-      _T("אתרים ברשת    תמונות    קבוצות דיון    מדריך האתרים     "),  // Hebrew
-      _T("वेब    छवियाँ    समूह    निर्देशिका    "),                             // Hindi
-      _T("Web    Képek    Csoportok    Címtár    "),                // Hungarian
-      _T("Vefur    Myndir    Hópar    Flokkar    "),                // Icelandic
-      _T("Web    Gambar    Grup    Direktori    "),                 // Indonesian
-      _T("Web    Imagines    Gruppos    Catalogo  "),               // Interlingua
-      _T("An Gréasán    Íomhánna    Grúpaí    Eolaire    "),        // Irish
-      _T("Web    Immagini    Gruppi    Directory    News Novità!    "),  // Italian
-      _T("ウェブ    イメージ    グループ    ディレクトリ    "),                        // Japanese
-      _T("Web    Gambar - gambar    Paguyuban    Bagian    "),      // Javanese
-      _T("antharajAla    chitragaLu    gumpugaLu    Huduku vibhaagagaLu    "),  // Kannada
-      _T("Daqmey pat    naghmey beQ    ghommey    mem    "),        // Klingon
-      _T("웹 문서    이미지    뉴스그룹    디렉토리    "),                            // Klingon
-      _T("Желе   Суроттор   Группалар   Тизме   "),                 // Kyrgyz
-      _T("Tela   Imagines   Circuli   Index "),                     // Latin
-      _T("Internets    Attēli    Vēstkopas    Katalogs"),           // Latvian
-      _T("Internetas    Vaizdai    Grupės    Katalogas    "),       // Lithuanian
-      _T("Мрежа    Слики    Групи    Директориум    "),             // Macedonian
-      _T("Jaringan    Imej    Kumpulan    Direktori    "),          // Malay
-      _T("വെബ്    ചിത്രങ്ങള്    സംഘങ്ങള്    ഡയറക്ടറി    "),                     // Malayalam
-      _T("Web    Stampi    Gruppi    Direttorju    "),              // Maltese
-      _T("वेबशोध    चित्रशोध    ग्रूप्स    डिरेक्टरी    "),                          // Marathi
-      _T("वेब    तस्वीर    समूह    डाइरेक्टरी    "),                            // Nepali
-      _T("Nett    Bilder    Grupper    Katalog    "),               // Norwegian
-      _T("Veven    Bilete    Grupper    Katalog    "),              // Norwegian (Nynorsk)
-      _T("Ret    Imatges    Grops    Directori    "),               // Occitan
-      _T("web   chitra   goSThi   prasanga tAlikA "),               // Oriya
-      _T("وب    تصويرها    گروهها    فهرست     "),                  // Persian
-      _T("ebway    imagesyay    oupsgray    Irectoryday    "),      // P. Latin
-      _T("WWW    Grafika    Grupy dyskusyjne    Katalog   "),       // Polish
-      _T("Web    Imagens    Grupos    Diretório    "),              // Potruguese (Brazil)
-      _T("Web    Imagens    Grupos    Directório  "),               // Potruguese (Portugal)
-      _T("Web/Zaal    Tasveraan    Gutt    Directory    "),         // Punjabi
-      _T("Web    Imagini    Grupuri    Director    "),              // Romanian
-      _T("Веб    Картинки    Группы    Каталог  "),                 // Russian
-      _T("Lìon    Dealbhan    Cuantail    Eòlaire    "),            // Scots Gaelic
-      _T("Интернет    Слике    Групе    Каталог    "),              // Serbian
-      _T("Internet    Slike    Grupe    Spisak    "),               // Serbo-Croatian
-      _T("Web   Ponahalo   Dihlopha   Tshupetso "),                 // Sesotho
-      _T("WEB    Roopa    Kandayam    Namawaliya    "),             // Sinhalese
-      _T("Web    Obrázky    Skupiny    Katalóg    "),               // Slovak
-      _T("Internet    Slike    Skupine    Imenik    "),             // Slovenian
-      _T("La Web    Imágenes    Grupos    Directorio    News ¡Nuevo!    "),  // Spanish
-      _T("Web   Gambar   Grup   Direktori "),                       // Sudanese
-      _T("Mtandao    Picha    Vikundi    Orodha    "),              // Swahili
-      _T("Nätet    Bilder    Grupper    Kategori    "),             // Swedish
-      _T("வலை    படங்கள்    குழுக்கள்    விபரக்கோவை    "),          // Tamil
-      _T("వెబ్    చిత్రాలు    సమూహములు    darshini    "),                        // Telugu
-      _T("เว็บ    รูปภาพ    กลุ่มข่าว    สารบบเว็บ    "),                            // Thai
-      // Tigrinya is missing, that doesn't show in normal windows fonts
-      _T("Web    Grafikler    Gruplar    Dizin    "),               // Turkish
-      _T("Web   Suratlar   Toparlar   Düzine "),                    // Turkmen
-      _T("tintan   Nfonyin   Akuokuo   Krataa nhwemu "),            // Twi
-      _T("Веб    Зображення    Групи    Каталог    "),              // Ukrainian
-      _T("ويب    تصاوير    گروہ    فہرست         ")                           // Urdu
-      _T("To'r    Tasvirlar    Gruppalar    Papka    "),            // Uzbek
-      _T("Internet    Hình Ảnh    Nhóm    Thư Mục    "),            // Vietnamese
-      _T("Y We    Lluniau    Grwpiau    Cyfeiriadur    "),          // Welsh
-      _T("Web   Imifanekiso   Amaqela   Isilawuli "),               // Xhosa
-      _T("װעב    בילדער    גרופּעס    פּאַפּקע     "),                  // Yiddish
-      _T("I-web   Izithombe   Amaqembu   Uhlu lwamafayela   "),     // Zulu
-  };
-
-  int i = 0;
-  for(i = 0; i < arraysize(tabs_by_lang); ++i) {
-    // Get the cannonical lower version with ::CharLower
-    CString true_lower(tabs_by_lang[i]);
-    ::CharLower(true_lower.GetBuffer());
-    true_lower.ReleaseBuffer();
-
-    // Get the lower version with String_ToLower,
-    CString low_temp(tabs_by_lang[i]);
-    String_ToLower(low_temp.GetBuffer());
-    low_temp.ReleaseBuffer();
-
-    // make sure they match
-    ASSERT_STREQ(low_temp, true_lower);
-
-    // Now make sure they match letter by letter
-    for(int j = 0; j < tabs_by_lang[i].GetLength(); ++j) {
-      TCHAR cur_char = tabs_by_lang[i].GetAt(j);
-
-      TCHAR low1 = static_cast<TCHAR>(String_ToLowerChar(cur_char));
-
-      ASSERT_EQ(low1, true_lower.GetAt(j));
-      ASSERT_EQ(Char_ToLower(cur_char), true_lower.GetAt(j));
-
-      // Check the Ansi version if applicable
-      if (cur_char < 128)
-        ASSERT_EQ(String_ToLowerChar(static_cast<char>(cur_char)),
-                  true_lower.GetAt(j));
-    }
-
-    // Test out the CString conversion
-    CString temp(tabs_by_lang[i]);
-    MakeLowerCString(temp);
-    ASSERT_STREQ(temp, true_lower);
-
-    // Test out the fast version
-    temp = tabs_by_lang[i];
-    String_FastToLower(temp.GetBuffer());
-    temp.ReleaseBuffer();
-
-    ASSERT_STREQ(temp, true_lower);
-
-    // Make sure that the normal CString::Trim works the same as our fast one
-    CString trim_normal(tabs_by_lang[i]);
-    trim_normal.Trim();
-
-    CString trim_fast(tabs_by_lang[i]);
-    TrimCString(trim_fast);
-
-    ASSERT_STREQ(trim_normal, trim_fast);
-  }
-}
-
-void TestReplaceString (TCHAR *src, TCHAR *from, TCHAR *to, TCHAR *expected) {
-  ASSERT_TRUE(expected);
-  ASSERT_TRUE(to);
-  ASSERT_TRUE(from);
-  ASSERT_TRUE(src);
-
-  size_t new_src_size = _tcslen(src) + 1;
-  TCHAR* new_src = new TCHAR[new_src_size];
-
-  _tcscpy_s(new_src, new_src_size, src);
-
-  Timer tchar (false);
-  Timer tchar2 (false);
-  Timer cstring (false);
-  Timer orig_cstring (false);
-
-  // int iterations = 10000;
-  int iterations = 10;
-
-  int out_len;
-  TCHAR *out;
-
-  for (int i = 0; i < iterations; i++) {
-      _tcscpy_s(new_src, new_src_size, src);
-      bool created_new_string = false;
-
-      tchar.Start();
-      ReplaceString (new_src, from, to, &out, &out_len);
-      tchar.Stop();
-
-      ASSERT_STREQ(out, expected);
-      delete [] out;
-  }
-
-  for (int i = 0; i < iterations; i++) {
-      _tcscpy_s(new_src, new_src_size, src);
-      bool created_new_string = false;
-
-      tchar2.Start();
-      ReplaceStringMaybeInPlace (new_src, from, to, &out,
-                                 &out_len, &created_new_string);
-      tchar2.Stop();
-
-      ASSERT_STREQ(out, expected);
-      if (out != new_src) { delete [] out; }
-  }
-
-  for (int i = 0; i < iterations; i++) {
-      CString src_string(src);
-
-      orig_cstring.Start();
-      src_string.Replace (from, to);
-      orig_cstring.Stop();
-
-      ASSERT_STREQ(src_string, CString(expected));
-  }
-
-  for (int i = 0; i < iterations; i++) {
-      CString src_string(src);
-
-      cstring.Start();
-      ReplaceCString (src_string, from, to);
-      cstring.Stop();
-
-      ASSERT_STREQ(src_string, CString(expected));
-  }
-
-  delete [] new_src;
-}
-
-TEST(StringTest, ReplaceCString) {
-  CString t;
-  t = _T("a a a b ");
-  ReplaceCString(t, _T("a"), 1, _T("d"), 1, 5);
-  ASSERT_STREQ(_T("d d d b "), t);
-
-  t = _T("a a a b ");
-  ReplaceCString(t, _T("b"), 1, _T("d"), 1, 5);
-  ASSERT_STREQ(_T("a a a d "), t);
-
-  t = _T("a a a b ");
-  ReplaceCString(t, _T("a"), 1, _T("d"), 1, 1);
-  ASSERT_STREQ(_T("d a a b "), t);
-
-  t = _T("a a a b ");
-  ReplaceCString(t, _T("a"), 1, _T("dd"), 2, 5);
-  ASSERT_STREQ(_T("dd dd dd b "), t);
-
-  ReplaceCString(t, _T("dd"), 2, _T("dddd"), 4, 5);
-  ASSERT_STREQ(_T("dddd dddd dddd b "), t);
-
-  ReplaceCString(t, _T("dd"), 2, _T("dddd"), 4, 5);
-  ASSERT_STREQ(_T("dddddddd dddddddd dddddd b "), t);
-
-  ReplaceCString(t, _T("dddddddd"), 8, _T("dddd"), 4, 2);
-  ASSERT_STREQ(_T("dddd dddd dddddd b "), t);
-
-  ReplaceCString(t, _T("d"), 1, _T("a"), 1, 2);
-  ASSERT_STREQ(_T("aadd dddd dddddd b "), t);
-
-  ReplaceCString(t, _T("d d"), 3, _T("c"), 1, 2);
-  ASSERT_STREQ(_T("aadcddcddddd b "), t);
-
-  ReplaceCString(t, _T("c"), 1, _T("1234567890"), 10, 2);
-  ASSERT_STREQ(_T("aad1234567890dd1234567890ddddd b "), t);
-
-  ReplaceCString(t, _T("1"), 1, _T("1234567890"), 10, 2);
-  ASSERT_STREQ(_T("aad1234567890234567890dd1234567890234567890ddddd b "), t);
-
-  ReplaceCString(t, _T("1234567890"), 10, _T(""), 0, 2);
-  ASSERT_STREQ(_T("aad234567890dd234567890ddddd b "), t);
-
-  t = _T("a aa aa b ");
-  ReplaceCString(t, _T("aa"), 2, _T("b"), 1, 5);
-  ASSERT_STREQ(_T("a b b b "), t);
-
-  t = _T("moo a aa aa b ");
-  ReplaceCString(t, _T("aa"), 2, _T("b"), 1, 5);
-  ASSERT_STREQ(_T("moo a b b b "), t);
-
-  // Time to test some big strings
-  int test_sizes[] = {200, 500, 900, 10000};
-
-  int i;
-  for(i = 0; i < arraysize(test_sizes); ++i) {
-    CString in, out;
-    for(int j = 0; j < test_sizes[i]; ++j) {
-      in += L'a';
-      out += _T("bb");
-    }
-    CString bak_in(in);
-
-    // Make it a bit bigger
-    int times = ReplaceCString(in, _T("a"), 1, _T("bb"), 2, kRepMax);
-    ASSERT_EQ(times, test_sizes[i]);
-    ASSERT_EQ(out, in);
-
-    // Make it bigger still
-    times = ReplaceCString(in, _T("bb"), 2, _T("ccc"), 3, kRepMax);
-    ASSERT_EQ(times, test_sizes[i]);
-
-    // Same size swap
-    times = ReplaceCString(in, _T("c"), 1, _T("d"), 1, kRepMax);
-    ASSERT_EQ(times, test_sizes[i] * 3);
-
-    // Make it smaller again
-    times = ReplaceCString(in, _T("ddd"), 3, _T("a"), 1, kRepMax);
-    ASSERT_EQ(times, test_sizes[i]);
-    ASSERT_EQ(bak_in, in);
-  }
-}
-
-TEST(StringTest, GetField) {
-  CString s(_T("<a>a</a><b>123</b><c>aa\ndd</c>"));
-
-  CString a(GetField (s, L"a"));
-  ASSERT_STREQ(a, L"a");
-
-  CString b(GetField (s, L"b"));
-  ASSERT_STREQ(b, L"123");
-
-  CString c(GetField (s, L"c"));
-  ASSERT_STREQ(c, L"aa\ndd");
-}
-
-TEST(StringTest, String_HasAlphabetLetters) {
-  ASSERT_TRUE(String_HasAlphabetLetters (L"abc"));
-  ASSERT_TRUE(String_HasAlphabetLetters (L"X"));
-  ASSERT_TRUE(String_HasAlphabetLetters (L" pie "));
-  ASSERT_FALSE(String_HasAlphabetLetters (L"1"));
-  ASSERT_FALSE(String_HasAlphabetLetters (L"0"));
-  ASSERT_FALSE(String_HasAlphabetLetters (L"010"));
-  ASSERT_FALSE(String_HasAlphabetLetters (L"314-159"));
-  ASSERT_TRUE(String_HasAlphabetLetters (L"pie0"));
-}
-
-TEST(StringTest, String_LargeIntToApproximateString) {
-  int power;
-  ASSERT_TRUE(String_LargeIntToApproximateString(10LL, true, &power) == _T("10") && power == 0);
-  ASSERT_TRUE(String_LargeIntToApproximateString(99LL, true, &power) == _T("99") && power == 0);
-  ASSERT_TRUE(String_LargeIntToApproximateString(990LL, true, &power) == _T("990") && power == 0);
-  ASSERT_TRUE(String_LargeIntToApproximateString(999LL, true, &power) == _T("999") && power == 0);
-
-  ASSERT_TRUE(String_LargeIntToApproximateString(1000LL, true, &power) == _T("1.0") && power == 1);
-  ASSERT_TRUE(String_LargeIntToApproximateString(1200LL, true, &power) == _T("1.2") && power == 1);
-  ASSERT_TRUE(String_LargeIntToApproximateString(7500LL, true, &power) == _T("7.5") && power == 1);
-  ASSERT_TRUE(String_LargeIntToApproximateString(9900LL, true, &power) == _T("9.9") && power == 1);
-  ASSERT_TRUE(String_LargeIntToApproximateString(10000LL, true, &power) == _T("10") && power == 1);
-  ASSERT_TRUE(String_LargeIntToApproximateString(11000LL, true, &power) == _T("11") && power == 1);
-  ASSERT_TRUE(String_LargeIntToApproximateString(987654LL, true, &power) == _T("987") && power == 1);
-
-  ASSERT_TRUE(String_LargeIntToApproximateString(1000000LL, true, &power) == _T("1.0") && power == 2);
-  ASSERT_TRUE(String_LargeIntToApproximateString(1300000LL, true, &power) == _T("1.3") && power == 2);
-  ASSERT_TRUE(String_LargeIntToApproximateString(987654321LL, true, &power) == _T("987") && power == 2);
-
-  ASSERT_TRUE(String_LargeIntToApproximateString(1000000000LL, true, &power) == _T("1.0") && power == 3);
-  ASSERT_TRUE(String_LargeIntToApproximateString(1999999999LL, true, &power) == _T("1.9") && power == 3);
-  ASSERT_TRUE(String_LargeIntToApproximateString(20000000000LL, true, &power) == _T("20") && power == 3);
-  ASSERT_TRUE(String_LargeIntToApproximateString(1000000000000LL, true, &power) == _T("1000") && power == 3);
-  ASSERT_TRUE(String_LargeIntToApproximateString(12345678901234LL, true, &power) == _T("12345") && power == 3);
-
-  ASSERT_TRUE(String_LargeIntToApproximateString(1023LL, false, &power) == _T("1023") && power == 0);
-
-  ASSERT_TRUE(String_LargeIntToApproximateString(1024LL, false, &power) == _T("1.0") && power == 1);
-  ASSERT_TRUE(String_LargeIntToApproximateString(1134LL, false, &power) == _T("1.1") && power == 1);
-  ASSERT_TRUE(String_LargeIntToApproximateString(10240LL, false, &power) == _T("10") && power == 1);
-
-  ASSERT_TRUE(String_LargeIntToApproximateString(5242880LL, false, &power) == _T("5.0") && power == 2);
-
-  ASSERT_TRUE(String_LargeIntToApproximateString(1073741824LL, false, &power) == _T("1.0") && power == 3);
-  ASSERT_TRUE(String_LargeIntToApproximateString(17179869184LL, false, &power) == _T("16") && power == 3);
-}
-
-TEST(StringTest, FindWholeWordMatch) {
-  // words with spaces before / after
-  ASSERT_EQ(0, FindWholeWordMatch (L"pi", L"pi", false, 0));
-  ASSERT_EQ(1, FindWholeWordMatch (L" pi", L"pi", false, 0));
-  ASSERT_EQ(1, FindWholeWordMatch (L" pi ", L"pi", false, 0));
-  ASSERT_EQ(0, FindWholeWordMatch (L"pi ", L"pi", false, 0));
-
-  // partial matches
-  ASSERT_EQ(-1, FindWholeWordMatch (L"pie ", L"pi", false, 0));
-  ASSERT_EQ(-1, FindWholeWordMatch (L" pie ", L"pi", false, 0));
-  ASSERT_EQ(-1, FindWholeWordMatch (L"pie", L"pi", false, 0));
-  ASSERT_EQ(-1, FindWholeWordMatch (L" pie", L"pi", false, 0));
-
-  // partial match with non-alphanumeric chars
-  ASSERT_EQ(-1, FindWholeWordMatch (L" pumpkin_pie ", L"pie", false, 0));
-  ASSERT_EQ(-1, FindWholeWordMatch (L" pie_crust ", L"pie", false, 0));
-  ASSERT_EQ(-1, FindWholeWordMatch (L"tartar", L"tar", false, 0));
-  ASSERT_EQ(-1, FindWholeWordMatch (L"pie!", L"pie", false, 0));
-}
-
-TEST(StringTest, ReplaceWholeWord) {
-  CString str (L"pie");
-  ReplaceWholeWord (L"ie", L"..", false, &str);
-  ASSERT_STREQ(str, L"pie");
-
-  ReplaceWholeWord (L"pie", L"..", false, &str);
-  ASSERT_STREQ(str, L"..");
-
-  str = L"banana pie";
-  ReplaceWholeWord (L"pie", L"..", false, &str);
-  ASSERT_STREQ(str, L"banana ..");
-
-  str = L"banana pie";
-  ReplaceWholeWord (L"banana", L"..", false, &str);
-  ASSERT_STREQ(str, L".. pie");
-
-  str = L"banana pie";
-  ReplaceWholeWord (L"banana pie", L" .. ", false, &str);
-  ASSERT_STREQ(str, L" .. ");
-
-  str = L"banana pie";
-  ReplaceWholeWord (L"pi", L" .. ", false, &str);
-  ASSERT_STREQ(str, L"banana pie");
-
-  str = L"ishniferatsu";
-  ReplaceWholeWord (L"era", L" .. ", false, &str);
-  ASSERT_STREQ(str, L"ishniferatsu");
-
-  str = L"i i i hi ii i";
-  ReplaceWholeWord (L"i", L"you", false, &str);
-  ASSERT_STREQ(str, L"you you you hi ii you");
-
-  str = L"a nice cream cheese pie";
-  ReplaceWholeWord (L"cream cheese", L"..", false, &str);
-  ASSERT_STREQ(str, L"a nice .. pie");
-
-  // ---
-  // Test replacement with whitespace trimming
-
-  // Replace in the middle of the string.
-  str = L"a nice cream cheese pie";
-  ReplaceWholeWord (L"cream cheese", L"..", true, &str);
-  ASSERT_STREQ(str, L"a nice..pie");
-
-  // Replace in the beginning of the string.
-  str = L"a nice cream cheese pie";
-  ReplaceWholeWord (L"a nice", L"..", true, &str);
-  ASSERT_STREQ(str, L"..cream cheese pie");
-
-  // Replace in the end of the string.
-  str = L"a nice cream cheese pie";
-  ReplaceWholeWord (L"pie", L"..", true, &str);
-  ASSERT_STREQ(str, L"a nice cream cheese..");
-}
-
-
-TEST(StringTest, TestReplaceString) {
-  // timing for replace string, for the specific tests below shows:
-  //
-  // the TCHAR version is always faster than CRT CString::Replace
-  //
-  // the CString version is faster than CRT CString::Replace:
-  // - always if the replacement is shorter
-  // - if the source string is longer than ~60 characters if the replacement is
-  //   longer
-  //
-  // based on our current usage of CString::Replace, I expect the new CString
-  // version is faster on average than CRT CString::Replace
-  //
-  // non-CRT CString::Replace is much slower, so all of these should be much
-  // faster than that
-
-  TestReplaceString(L"that's what i changed -it was propagating the error code but i ..", L" .. ", L"<b> .. </b>", L"that's what i changed -it was propagating the error code but i ..");
-  TestReplaceString(L"news.com.url", L".url", L"", L"news.com");
-  TestReplaceString(L"news.com..url", L".url", L"", L"news.com.");
-  TestReplaceString(L"news.com.u.url", L".url", L"", L"news.com.u");
-  TestReplaceString(L"abanana pie banana", L"banana", L"c", L"ac pie c");
-  TestReplaceString(L"bananabananabanana", L"banana", L"c", L"ccc");
-  TestReplaceString(L"abanana pie banana", L"banana", L"cabanapie", L"acabanapie pie cabanapie");
-  TestReplaceString(L"bananabananabanana", L"banana", L"cabanapie", L"cabanapiecabanapiecabanapie");
-  TestReplaceString(L"banana pie banana pie", L"banana", L"c", L"c pie c pie");
-  TestReplaceString(L"banana pie banana pie", L"pie", L"z", L"banana z banana z");
-  TestReplaceString(L"banana pie banana pie", L"banana", L"bananacabana", L"bananacabana pie bananacabana pie");
-  TestReplaceString(L"banana pie banana pie", L"pie", L"pietie", L"banana pietie banana pietie");
-  TestReplaceString(L"banana pie banana pie", L"tie", L"pietie", L"banana pie banana pie");
-  TestReplaceString(L"banana pie banana pie banana pie banana pie banana pie", L"banana", L"bananacab", L"bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie");
-  TestReplaceString(L"banana pie banana pie banana pie banana pie banana pie banana pie banana pie", L"banana", L"bananacab", L"bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie");
-  TestReplaceString(L"banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie", L"banana", L"bananacab", L"bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie");
-  TestReplaceString(L"banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie", L"banana", L"bananacab", L"bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie bananacab pie");
-  TestReplaceString(L"banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie", L"banana", L"cab", L"cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie cab pie");
-  TestReplaceString(L"news", L"news", L"", L"");
-  TestReplaceString(L"&nbsp;", L"&nbsp;", L"", L"");
-  TestReplaceString(L"&nbsp;&nbsp;&nbsp;", L"&nbsp;", L"", L"");
-  TestReplaceString(L"&nbsp; &nbsp;&nbsp;", L"&nbsp;", L"", L" ");
-}
-
-
-TEST(StringTest, GetAbsoluteUri) {
-  ASSERT_STREQ(GetAbsoluteUri(L"http://www.google.com"),
-               L"http://www.google.com/");
-  ASSERT_STREQ(GetAbsoluteUri(L"http://www.google.com/"),
-               L"http://www.google.com/");
-  ASSERT_STREQ(GetAbsoluteUri(L"http://www.google.com//"),
-               L"http://www.google.com/");
-  ASSERT_STREQ(GetAbsoluteUri(L"http://www.google.com/test"),
-               L"http://www.google.com/test");
-}
-
-void TestTrim(const TCHAR *str, const TCHAR *result) {
-  ASSERT_TRUE(result);
-  ASSERT_TRUE(str);
-
-  size_t ptr_size = _tcslen(str) + 1;
-  TCHAR* ptr = new TCHAR[ptr_size];
-  _tcscpy_s(ptr, ptr_size, str);
-
-  int len = Trim(ptr);
-  ASSERT_STREQ(ptr, result);
-  ASSERT_EQ(len, lstrlen(result));
-
-  delete [] ptr;
-}
-
-TEST(StringTest, Trim) {
-  TestTrim(L"", L"");
-  TestTrim(L" ", L"");
-  TestTrim(L"\t", L"");
-  TestTrim(L"\n", L"");
-  TestTrim(L"\n\t    \t \n", L"");
-  TestTrim(L"    joe", L"joe");
-  TestTrim(L"joe      ", L"joe");
-  TestTrim(L"    joe      ", L"joe");
-  TestTrim(L"joe smith    ", L"joe smith");
-  TestTrim(L"     joe smith    ", L"joe smith");
-  TestTrim(L"     joe   smith    ", L"joe   smith");
-  TestTrim(L"     The quick brown fox,\tblah", L"The quick brown fox,\tblah");
-  TestTrim(L" \tblah\n    joe smith    ", L"blah\n    joe smith");
-}
-
-// IsSpaceA1 is much faster without the cache clearing (which is what happends
-// in release mode)
-// IsSpaceA1 is roughly the same speed as IsSpaceA2 with cache clearing (in
-// debug mode)
-// IsSpaceA3 is always much slower
-
-static const byte spacesA[256] = {
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 1,  // 0-9
-  1, 1, 1, 1, 0, 0, 0, 0, 0, 0,  // 10-19
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 20-29
-  0, 0, 1, 0, 0, 0, 0, 0, 0, 0,  // 30-39
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 40-49
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 50-59
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 60-69
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 70-79
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 80-89
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 90-99
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 100-109
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 110-119
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 120-129
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 130-139
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 140-149
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 150-159
-  1, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 160-169
-};
-
-bool IsSpaceA1(char c) {
-  return spacesA[c] == 1;
-}
-
-bool IsSpaceA2(char c) {
-  // return (c==32);
-  // if (c>32) { return 0; }
-  // most characters >32, check first for that case
-  if (c>32 && c!=160) { return 0; }
-  if (c==32) { return 1; }
-  if (c>=9&&c<=13) return 1; else return 0;
-}
-
-bool IsSpaceA3(char c) {
-  WORD result;
-  if (GetStringTypeA(0, CT_CTYPE1, &c, 1, &result)) {
-    return (0 != (result & C1_SPACE));
-  }
-  return false;
-}
-
-void TestIsSpace (char *s) {
-    ASSERT_TRUE(s);
-
-    Timer t1 (false);
-    Timer t2 (false);
-    Timer t3 (false);
-
-    // int iterations = 10000;
-    int iterations = 100;
-    int len = strlen (s);
-
-    // used to try to clear the processor cache
-    int dlen = 100000;
-    char *dummy = new char [dlen];
-    for (int i = 0; i < dlen; i++) {
-      dummy[i] = static_cast<char>(tr_rand() % 256);
-    }
-
-    int num_spaces = 0;
-    int n = iterations * len;
-    for (int i = 0; i < iterations; i++) {
-        t1.Start();
-        for (int j = 0; j < len; j++) {
-            num_spaces += IsSpaceA1 (s[j]);
-        }
-        t1.Stop();
-        // this cache clearing code gets optimized out in release mode
-        int d2 = 0;
-        for (int i = 0; i < dlen; i++) { d2 += dummy[i]; }
-    }
-
-    num_spaces = 0;
-    for (int i = 0; i < iterations; i++) {
-        t2.Start();
-        for (int j = 0; j < len; j++) {
-            num_spaces += IsSpaceA2 (s[j]);
-        }
-        t2.Stop();
-        int d2 = 0;
-        for (int i = 0; i < dlen; i++) { d2 += dummy[i]; }
-    }
-
-    num_spaces = 0;
-    for (int i = 0; i < iterations; i++) {
-        t3.Start();
-        for (int j = 0; j < len; j++) {
-            num_spaces += IsSpaceA3 (s[j]);
-        }
-        t3.Stop();
-        int d2 = 0;
-        for (int i = 0; i < dlen; i++) { d2 += dummy[i]; }
-    }
-}
-
-TEST(StringTest, IsSpace) {
-  TestIsSpace("banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie banana pie");
-  TestIsSpace("sdlfhdkgheorutsgj sdlj aoi oaj gldjg opre gdsfjng oate yhdnv ;zsj fpoe v;kjae hgpaieh dajlgn aegh avn WEIf h9243y 9814cu 902t7 9[-32 [O8W759 RC90817 V9pDAHc n( ny(7LKFJAOISF *&^*^%$$%#*&^(*_*)_^& 67% 796%&$*^$ 8)6 (^ 08&^ )*^ 9-7=90z& +(^ )^* %9%4386 $& (& &+ 7- &(_* ");
-}
-
-void TestCleanupWhitespace(const TCHAR *str, const TCHAR *result) {
-  ASSERT_TRUE(result);
-  ASSERT_TRUE(str);
-
-  size_t ptr_size = _tcslen(str) + 1;
-  TCHAR* ptr = new TCHAR[ptr_size];
-  _tcscpy_s(ptr, ptr_size, str);
-
-  int len = CleanupWhitespace(ptr);
-  ASSERT_STREQ(ptr, result);
-  ASSERT_EQ(len, lstrlen(result));
-
-  delete [] ptr;
-}
-
-TEST(StringTest, CleanupWhitespace) {
-  TestCleanupWhitespace(L"", L"");
-  TestCleanupWhitespace(L"a    ", L"a");
-  TestCleanupWhitespace(L"    a", L"a");
-  TestCleanupWhitespace(L" a   ", L"a");
-  TestCleanupWhitespace(L"\t\n\r a   ", L"a");
-  TestCleanupWhitespace(L"  \n   a  \t   \r ", L"a");
-  TestCleanupWhitespace(L"a      b", L"a b");
-  TestCleanupWhitespace(L"   a \t\n\r     b", L"a b");
-  TestCleanupWhitespace(L"   vool                 voop", L"vool voop");
-  TestCleanupWhitespace(L"thisisaverylongstringwithsometext",
-                        L"thisisaverylongstringwithsometext");
-  TestCleanupWhitespace(L"thisisavery   longstringwithsometext",
-                        L"thisisavery longstringwithsometext");
-}
-
-void TestWcstoul (TCHAR *string, int radix, unsigned long expected) {
-    ASSERT_TRUE(string);
-
-    wchar_t *ptr;
-    int v = Wcstoul (string, &ptr, radix);
-    ASSERT_EQ(v, expected);
-
-#ifdef DEBUG
-    int v2 = wcstoul (string, &ptr, radix);
-    ASSERT_EQ(v, v2);
-#endif
-}
-
-TEST(StringTest, Wcstoul) {
-  TestWcstoul(L"625", 16, 1573);
-  TestWcstoul(L" 625", 16, 1573);
-  TestWcstoul(L"a3", 16, 163);
-  TestWcstoul(L"A3", 16, 163);
-  TestWcstoul(L"  A3", 16, 163);
-  TestWcstoul(L" 12445", 10, 12445);
-  TestWcstoul(L"12445778", 10, 12445778);
-}
-
-TEST(StringTest, IsDigit) {
-  ASSERT_TRUE(String_IsDigit('0'));
-  ASSERT_TRUE(String_IsDigit('1'));
-  ASSERT_TRUE(String_IsDigit('2'));
-  ASSERT_TRUE(String_IsDigit('3'));
-  ASSERT_TRUE(String_IsDigit('4'));
-  ASSERT_TRUE(String_IsDigit('5'));
-  ASSERT_TRUE(String_IsDigit('6'));
-  ASSERT_TRUE(String_IsDigit('7'));
-  ASSERT_TRUE(String_IsDigit('8'));
-  ASSERT_TRUE(String_IsDigit('9'));
-  ASSERT_FALSE(String_IsDigit('a'));
-  ASSERT_FALSE(String_IsDigit('b'));
-  ASSERT_FALSE(String_IsDigit('z'));
-  ASSERT_FALSE(String_IsDigit('A'));
-  ASSERT_FALSE(String_IsDigit(' '));
-  ASSERT_FALSE(String_IsDigit('#'));
-}
-
-TEST(StringTest, IsUpper) {
-  ASSERT_FALSE(String_IsUpper('0'));
-  ASSERT_FALSE(String_IsUpper(' '));
-  ASSERT_FALSE(String_IsUpper('#'));
-  ASSERT_FALSE(String_IsUpper('a'));
-  ASSERT_FALSE(String_IsUpper('z'));
-  ASSERT_TRUE(String_IsUpper('A'));
-  ASSERT_TRUE(String_IsUpper('B'));
-  ASSERT_TRUE(String_IsUpper('C'));
-  ASSERT_TRUE(String_IsUpper('D'));
-  ASSERT_TRUE(String_IsUpper('H'));
-  ASSERT_TRUE(String_IsUpper('Y'));
-  ASSERT_TRUE(String_IsUpper('Z'));
-}
-
-TEST(StringTest, StringToDouble) {
-  ASSERT_DOUBLE_EQ(String_StringToDouble(L"625"), 625);
-  ASSERT_DOUBLE_EQ(String_StringToDouble(L"-625"), -625);
-  ASSERT_DOUBLE_EQ(String_StringToDouble(L"-6.25"), -6.25);
-  ASSERT_DOUBLE_EQ(String_StringToDouble(L"6.25"), 6.25);
-  ASSERT_DOUBLE_EQ(String_StringToDouble(L"0.00"), 0);
-  ASSERT_DOUBLE_EQ(String_StringToDouble(L" 55.1"), 55.1);
-  ASSERT_DOUBLE_EQ(String_StringToDouble(L" 55.001"), 55.001);
-  ASSERT_DOUBLE_EQ(String_StringToDouble(L"  1.001"), 1.001);
-}
-
-TEST(StringTest, StringToInt) {
-  ASSERT_EQ(String_StringToInt(L"625"), 625);
-  ASSERT_EQ(String_StringToInt(L"6"), 6);
-  ASSERT_EQ(String_StringToInt(L"0"), 0);
-  ASSERT_EQ(String_StringToInt(L" 122"), 122);
-  ASSERT_EQ(String_StringToInt(L"a"), 0);
-  ASSERT_EQ(String_StringToInt(L" a"), 0);
-}
-
-TEST(StringTest, StringToInt64) {
-  ASSERT_EQ(String_StringToInt64(L"119600064000000000"),
-            119600064000000000uI64);
-  ASSERT_EQ(String_StringToInt64(L" 119600064000000000"),
-            119600064000000000uI64);
-  ASSERT_EQ(String_StringToInt64(L"625"), 625);
-  ASSERT_EQ(String_StringToInt64(L"6"), 6);
-  ASSERT_EQ(String_StringToInt64(L"0"), 0);
-  ASSERT_EQ(String_StringToInt64(L" 122"), 122);
-  ASSERT_EQ(String_StringToInt64(L"a"), 0);
-  ASSERT_EQ(String_StringToInt64(L" a"), 0);
-}
-
-void TestEndWithChar(const TCHAR *s, char c, const TCHAR *expected) {
-  ASSERT_TRUE(expected);
-  ASSERT_TRUE(s);
-
-  TCHAR buf[5000];
-  _tcscpy(buf, s);
-  String_EndWithChar(buf, c);
-  ASSERT_STREQ(buf, expected);
-}
-
-TEST(StringTest, EndWithChar) {
-  TestEndWithChar(L"", L'a', L"a");
-  TestEndWithChar(L"", L'\\', L"\\");
-  TestEndWithChar(L"a", L'a', L"a");
-  TestEndWithChar(L"a", L'b', L"ab");
-  TestEndWithChar(L"abcdefghij", L'a', L"abcdefghija");
-  TestEndWithChar(L"abcdefghij", L'\\', L"abcdefghij\\");
-}
-
-TEST(StringTest, HexDigitToInt) {
-  ASSERT_EQ(HexDigitToInt(L'0'), 0);
-  ASSERT_EQ(HexDigitToInt(L'1'), 1);
-  ASSERT_EQ(HexDigitToInt(L'2'), 2);
-  ASSERT_EQ(HexDigitToInt(L'3'), 3);
-  ASSERT_EQ(HexDigitToInt(L'4'), 4);
-  ASSERT_EQ(HexDigitToInt(L'5'), 5);
-  ASSERT_EQ(HexDigitToInt(L'6'), 6);
-  ASSERT_EQ(HexDigitToInt(L'7'), 7);
-  ASSERT_EQ(HexDigitToInt(L'8'), 8);
-  ASSERT_EQ(HexDigitToInt(L'9'), 9);
-  ASSERT_EQ(HexDigitToInt(L'A'), 10);
-  ASSERT_EQ(HexDigitToInt(L'a'), 10);
-  ASSERT_EQ(HexDigitToInt(L'B'), 11);
-  ASSERT_EQ(HexDigitToInt(L'b'), 11);
-  ASSERT_EQ(HexDigitToInt(L'C'), 12);
-  ASSERT_EQ(HexDigitToInt(L'c'), 12);
-  ASSERT_EQ(HexDigitToInt(L'D'), 13);
-  ASSERT_EQ(HexDigitToInt(L'd'), 13);
-  ASSERT_EQ(HexDigitToInt(L'E'), 14);
-  ASSERT_EQ(HexDigitToInt(L'e'), 14);
-  ASSERT_EQ(HexDigitToInt(L'F'), 15);
-  ASSERT_EQ(HexDigitToInt(L'f'), 15);
-}
-
-TEST(StringTest, IsHexDigit) {
-  ASSERT_TRUE(IsHexDigit(L'0'));
-  ASSERT_TRUE(IsHexDigit(L'1'));
-  ASSERT_TRUE(IsHexDigit(L'2'));
-  ASSERT_TRUE(IsHexDigit(L'3'));
-  ASSERT_TRUE(IsHexDigit(L'4'));
-  ASSERT_TRUE(IsHexDigit(L'5'));
-  ASSERT_TRUE(IsHexDigit(L'6'));
-  ASSERT_TRUE(IsHexDigit(L'7'));
-  ASSERT_TRUE(IsHexDigit(L'8'));
-  ASSERT_TRUE(IsHexDigit(L'9'));
-  ASSERT_TRUE(IsHexDigit(L'a'));
-  ASSERT_TRUE(IsHexDigit(L'A'));
-  ASSERT_TRUE(IsHexDigit(L'b'));
-  ASSERT_TRUE(IsHexDigit(L'B'));
-  ASSERT_TRUE(IsHexDigit(L'c'));
-  ASSERT_TRUE(IsHexDigit(L'C'));
-  ASSERT_TRUE(IsHexDigit(L'd'));
-  ASSERT_TRUE(IsHexDigit(L'D'));
-  ASSERT_TRUE(IsHexDigit(L'e'));
-  ASSERT_TRUE(IsHexDigit(L'E'));
-  ASSERT_TRUE(IsHexDigit(L'f'));
-  ASSERT_TRUE(IsHexDigit(L'F'));
-
-  for(TCHAR digit = static_cast<TCHAR>(127); digit < 10000; ++digit) {
-    ASSERT_FALSE(IsHexDigit(digit));
-  }
-}
-
-TEST(StringTest, Remove) {
-  CString temp_remove;
-
-  // Remove everything
-  temp_remove = _T("ftp://");
-  RemoveFromStart (temp_remove, _T("ftp://"), false);
-  ASSERT_STREQ(temp_remove, _T(""));
-
-  // Remove all but 1 letter
-  temp_remove = _T("ftp://a");
-  RemoveFromStart (temp_remove, _T("ftp://"), false);
-  ASSERT_STREQ(temp_remove, _T("a"));
-
-  // Remove the first instance
-  temp_remove = _T("ftp://ftp://");
-  RemoveFromStart (temp_remove, _T("ftp://"), false);
-  ASSERT_STREQ(temp_remove, _T("ftp://"));
-
-  // Remove normal
-  temp_remove = _T("ftp://taz the tiger");
-  RemoveFromStart (temp_remove, _T("ftp://"), false);
-  ASSERT_STREQ(temp_remove, _T("taz the tiger"));
-
-  // Wrong prefix
-  temp_remove = _T("ftp:/taz the tiger");
-  RemoveFromStart (temp_remove, _T("ftp://"), false);
-  ASSERT_STREQ(temp_remove, _T("ftp:/taz the tiger"));
-
-  // Not long enough
-  temp_remove = _T("ftp:/");
-  RemoveFromStart (temp_remove, _T("ftp://"), false);
-  ASSERT_STREQ(temp_remove, _T("ftp:/"));
-
-  // Remove nothing
-  temp_remove = _T("ftp:/");
-  RemoveFromStart (temp_remove, _T(""), false);
-  ASSERT_STREQ(temp_remove, _T("ftp:/"));
-
-  // Remove 1 character
-  temp_remove = _T("ftp:/");
-  RemoveFromStart (temp_remove, _T("f"), false);
-  ASSERT_STREQ(temp_remove, _T("tp:/"));
-
-  // Wrong case
-  temp_remove = _T("ftp:/");
-  RemoveFromStart (temp_remove, _T("F"), false);
-  ASSERT_STREQ(temp_remove, _T("ftp:/"));
-
-  // Remove everything
-  temp_remove = _T(".edu");
-  RemoveFromEnd (temp_remove, _T(".edu"));
-  ASSERT_STREQ(temp_remove, _T(""));
-
-  // Remove all but 1 letter
-  temp_remove = _T("a.edu");
-  RemoveFromEnd(temp_remove, _T(".edu"));
-  ASSERT_STREQ(temp_remove, _T("a"));
-
-  // Remove the first instance
-  temp_remove = _T(".edu.edu");
-  RemoveFromEnd(temp_remove, _T(".edu"));
-  ASSERT_STREQ(temp_remove, _T(".edu"));
-
-  // Remove normal
-  temp_remove = _T("ftp://taz the tiger.edu");
-  RemoveFromEnd(temp_remove, _T(".edu"));
-  ASSERT_STREQ(temp_remove, _T("ftp://taz the tiger"));
-
-  // Wrong suffix
-  temp_remove = _T("ftp:/taz the tiger.edu");
-  RemoveFromEnd(temp_remove, _T("/edu"));
-  ASSERT_STREQ(temp_remove, _T("ftp:/taz the tiger.edu"));
-
-  // Not long enough
-  temp_remove = _T("edu");
-  RemoveFromEnd(temp_remove, _T(".edu"));
-  ASSERT_STREQ(temp_remove, _T("edu"));
-
-  // Remove nothing
-  temp_remove = _T(".edu");
-  RemoveFromEnd(temp_remove, _T(""));
-  ASSERT_STREQ(temp_remove, _T(".edu"));
-
-  // Remove 1 character
-  temp_remove = _T(".edu");
-  RemoveFromEnd(temp_remove, _T("u"));
-  ASSERT_STREQ(temp_remove, _T(".ed"));
-
-  // Wrong case
-  temp_remove = _T(".edu");
-  RemoveFromEnd(temp_remove, _T("U"));
-  ASSERT_STREQ(temp_remove, _T(".edu"));
-}
-
-TEST(StringTest, WideToAnsiDirect) {
-  CString temp_convert;
-  ASSERT_STREQ("", WideToAnsiDirect(_T("")));
-  ASSERT_STREQ("a", WideToAnsiDirect(_T("a")));
-  ASSERT_STREQ("moon doggy", WideToAnsiDirect(_T("moon doggy")));
-
-  // Generate a string of all characters 0-255.
-  const int kNumChars = 256;
-  TCHAR nasty_chars[kNumChars];
-  for (int i = 0; i < kNumChars; ++i) {
-    nasty_chars[i] = static_cast<TCHAR>(i);
-  }
-  CString temp(nasty_chars, kNumChars);
-
-  // Convert it and make sure it matches.
-  CStringA out = WideToAnsiDirect(temp);
-  ASSERT_EQ(out.GetLength(), kNumChars);
-  for (int i = 0; i < kNumChars; ++i) {
-    ASSERT_EQ(static_cast<unsigned char>(nasty_chars[i]),
-              static_cast<unsigned char>(out.GetAt(i)));
-  }
-}
-
-TEST(StringTest, FindStringASpaceStringB) {
-  ASSERT_TRUE(FindStringASpaceStringB(L"content-type: text/html", L"content-type:", L"text/html"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"content-TYPE: text/html", L"content-type:", L"text/html"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"content-TYPE: text/HTML", L"content-type:", L"text/html"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"content-TYPE: text/HTML", L"content-type:", L"text/HTML"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"content-TYPE: text/HTML", L"content-TYPE:", L"text/HTML"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"content-type:text/html", L"content-type:", L"text/html"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"content-type:  text/html", L"content-type:", L"text/html"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"content-type:   text/html", L"content-type:", L"text/html"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"content-type: sdfjsldkgjsdg content-type:    text/html", L"content-type:", L"text/html"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"content-type: content-type: sdfjsldkgjsdg content-type:    text/html", L"content-type:", L"text/html"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"content-type:content-type: sdfjsldkgjsdg content-type:    text/html", L"content-type:", L"text/html"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"content-type:content-type:    text/html", L"content-type:", L"text/html"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"test/html content-type:content-type:    text/html", L"content-type:", L"text/html"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"content-type:    text/html", L"content-type:", L"text/html"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"content-type:\ttext/html", L"content-type:", L"text/html"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"content-type:\t text/html", L"content-type:", L"text/html"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"Content-Type:\t text/html", L"content-type:", L"text/html"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"aasd content-type: text/html", L"content-type:", L"text/html"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"aa content-TYPE: text/html", L"content-type:", L"text/html"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"text.html  content-TYPE: text/HTML", L"content-type:", L"text/html"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"text/html content-TYPE: text/HTML", L"content-type:", L"text/HTML"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"AAAA content-TYPE: text/HTML", L"content-TYPE:", L"text/HTML"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"content-type:text/html AAAAA", L"content-type:", L"text/html"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"content-type:  text/html", L"content-type:", L"text/html"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"content-type:   text/htmlaaa", L"content-type:", L"text/html"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"content-type:    text/html  asdsdg content-type", L"content-type:", L"text/html"));
-  ASSERT_TRUE(FindStringASpaceStringB(L"content-type:\ttext/htmlconttent-type:te", L"content-type:", L"text/html"));
-
-  ASSERT_FALSE(FindStringASpaceStringB(L"content-type:  a  text/html", L"content-type:", L"text/html"));
-  ASSERT_FALSE(FindStringASpaceStringB(L"content-type:  content-type:  a  text/html", L"content-type:", L"text/html"));
-  ASSERT_FALSE(FindStringASpaceStringB(L"content-type: b text/html  content-type:  a  text/html", L"content-type:", L"text/html"));
-  ASSERT_FALSE(FindStringASpaceStringB(L"content-type:-text/html", L"content-type:", L"text/html"));
-  ASSERT_FALSE(FindStringASpaceStringB(L"content-type:\ntext/html", L"content-type:", L"text/html"));
-  ASSERT_FALSE(FindStringASpaceStringB(L"content-type:  a  TEXT/html", L"content-type:", L"text/html"));
-  ASSERT_FALSE(FindStringASpaceStringB(L"content-type:  a  html/text", L"content-type:", L"text/html"));
-  ASSERT_FALSE(FindStringASpaceStringB(L"a dss content-type:  a  text/html", L"content-type:", L"text/html"));
-  ASSERT_FALSE(FindStringASpaceStringB(L"text/html content-type:-text/html", L"content-type:", L"text/html"));
-  ASSERT_FALSE(FindStringASpaceStringB(L"text/html sdfsd fcontent-type:\ntext/html", L"content-type:", L"text/html"));
-  ASSERT_FALSE(FindStringASpaceStringB(L"AAAA content-type:  a  TEXT/html", L"content-type:", L"text/html"));
-  ASSERT_FALSE(FindStringASpaceStringB(L"content-type:  a  html/text AAA", L"content-type:", L"text/html"));
-  ASSERT_FALSE(FindStringASpaceStringB(L"content-type:", L"content-type:", L"text/html"));
-  ASSERT_FALSE(FindStringASpaceStringB(L"content-type:content-type:", L"content-type:", L"text/html"));
-  ASSERT_FALSE(FindStringASpaceStringB(L"content-type:content-type: content-type:", L"content-type:", L"text/html"));
-}
-
-TEST(StringTest, ElideIfNeeded) {
-  ASSERT_STREQ(ElideIfNeeded(L"1234 6789 1234", 3, 3), L"1..");
-  ASSERT_STREQ(ElideIfNeeded(L"1234 6789 1234", 4, 3), L"12..");
-  ASSERT_STREQ(ElideIfNeeded(L"1234 6789 1234", 5, 3), L"123..");
-  ASSERT_STREQ(ElideIfNeeded(L"1234 6789 1234", 6, 3), L"1234..");
-  ASSERT_STREQ(ElideIfNeeded(L"1234 6789 1234", 7, 3), L"1234..");
-  ASSERT_STREQ(ElideIfNeeded(L"1234 6789 1234", 8, 3), L"1234..");
-  ASSERT_STREQ(ElideIfNeeded(L"1234 6789 1234", 9, 3), L"1234..");
-  ASSERT_STREQ(ElideIfNeeded(L"1234 6789 1234", 10, 3), L"1234..");
-  ASSERT_STREQ(ElideIfNeeded(L"1234 6789 1234", 11, 3), L"1234 6789..");
-  ASSERT_STREQ(ElideIfNeeded(L"1234 6789 1234", 12, 3), L"1234 6789..");
-  ASSERT_STREQ(ElideIfNeeded(L"1234 6789 1234", 13, 3), L"1234 6789..");
-  ASSERT_STREQ(ElideIfNeeded(L"1234 6789 1234", 14, 3), L"1234 6789 1234");
-  ASSERT_STREQ(ElideIfNeeded(L"1234 6789 1234", 15, 3), L"1234 6789 1234");
-  ASSERT_STREQ(ElideIfNeeded(L"1234 6789 1234", 16, 3), L"1234 6789 1234");
-  ASSERT_STREQ(ElideIfNeeded(L"1234 6789 1234", 17, 3), L"1234 6789 1234");
-
-  ASSERT_STREQ(ElideIfNeeded(L"1234 6789 1234", 7, 6), L"1234..");
-  ASSERT_STREQ(ElideIfNeeded(L"1234 6789 1234", 8, 6), L"1234 6..");
-  ASSERT_STREQ(ElideIfNeeded(L"1234 6789 1234", 9, 6), L"1234 67..");
-  ASSERT_STREQ(ElideIfNeeded(L"1234 6789 1234", 10, 6), L"1234 678..");
-  ASSERT_STREQ(ElideIfNeeded(L"1234 6789 1234", 11, 6), L"1234 6789..");
-  ASSERT_STREQ(ElideIfNeeded(L"1234 6789 1234", 12, 6), L"1234 6789..");
-}
-
-TEST(StringTest, SafeStrCat) {
-  const int kDestLen = 7;
-  TCHAR dest[kDestLen];
-  lstrcpyn(dest, L"short", kDestLen);
-  ASSERT_LT(lstrlen(dest), kDestLen);
-
-  dest[kDestLen-1] = 'a';
-  lstrcpyn(dest, L"medium123", kDestLen);
-  ASSERT_EQ(dest[kDestLen - 1], '\0');
-  ASSERT_LT(lstrlen(dest), kDestLen);
-
-  lstrcpyn(dest, L"longerlonger", kDestLen);
-  ASSERT_EQ(dest[kDestLen - 1], '\0');
-  ASSERT_LT(lstrlen(dest), kDestLen);
-
-  lstrcpyn(dest, L"12", kDestLen);
-  SafeStrCat(dest, L"3456", kDestLen);
-  ASSERT_EQ(dest[kDestLen - 1], '\0');
-  ASSERT_LT(lstrlen(dest), kDestLen);
-}
-
-void TestPathFindExtension(const TCHAR *s) {
-  ASSERT_STREQ(String_PathFindExtension(s), PathFindExtension(s));
-}
-
-TEST(StringTest, TestPathFindExtension) {
-  TestPathFindExtension(L"c:\\test.tmp");
-  TestPathFindExtension(L"c:\\test.temp");
-  TestPathFindExtension(L"c:\\t\\e\\st.temp");
-  TestPathFindExtension(L"c:\\a.temp");
-  TestPathFindExtension(L"\\aaa\\a.temp");
-  TestPathFindExtension(L"\\a\\a.temp");
-  TestPathFindExtension(L"\\a\\a.temp");
-  TestPathFindExtension(L"\\a\\a.t....emp");
-  TestPathFindExtension(L"\\a.a.a...a\\a.t....emp");
-  TestPathFindExtension(L"\\a\\a\\bbbb\\ddddddddddddddd.temp");
-  TestPathFindExtension(L"\\a\\a\\bbbb\\ddddddddddddddd.te___124567mp");
-  TestPathFindExtension(L"\\a\\a\\bbbb\\ddddddd.dddddddd.te___124567mp");
-}
-
-TEST(StringTest, TextToLinesAndBack) {
-  const TCHAR sample_input[]  = L"Now is the time\r\nfor all good men\r\nto come to the aid of their country";
-  const TCHAR* sample_lines[] = { L"Now is the time", L"for all good men", L"to come to the aid of their country" };
-  const TCHAR sample_output1[] = L"Now is the time\nfor all good men\nto come to the aid of their country\n";
-  const TCHAR sample_output2[] = L"Now is the timefor all good mento come to the aid of their country";
-
-  CString text_in(sample_input);
-  std::vector<CString> lines;
-  CString text_out;
-
-  TextToLines(text_in, L"\r\n", &lines);
-  ASSERT_EQ(lines.size(), 3);
-  for (size_t i = 0; i < arraysize(sample_lines); ++i) {
-    ASSERT_TRUE(0 == lines[i].Compare(sample_lines[i]));
-  }
-  LinesToText(lines, L"\n", &text_out);
-  ASSERT_TRUE(0 == text_out.Compare(sample_output1));
-  LinesToText(lines, L"", &text_out);
-  ASSERT_TRUE(0 == text_out.Compare(sample_output2));
-}
-
-CString TrimStdString(const TCHAR* str) {
-  CString s(str);
-  TrimString(s, L" \t");
-  return s;
-}
-
-TEST(StringTest, TrimString) {
-  ASSERT_STREQ(L"abc", TrimStdString(L"abc"));
-  ASSERT_STREQ(L"abc", TrimStdString(L" abc "));
-  ASSERT_STREQ(L"a c", TrimStdString(L" a c  "));
-  ASSERT_STREQ(L"abc", TrimStdString(L" \tabc\t "));
-  ASSERT_STREQ(L"", TrimStdString(L""));
-  ASSERT_STREQ(L"", TrimStdString(L"   "));
-}
-
-TEST(StringTest, StripFirstQuotedToken) {
-  ASSERT_STREQ(StripFirstQuotedToken(L""), L"");
-  ASSERT_STREQ(StripFirstQuotedToken(L"a" ), L"");
-  ASSERT_STREQ(StripFirstQuotedToken(L"  a b  "), L"b");
-  ASSERT_STREQ(StripFirstQuotedToken(L"\"abc\" def"), L" def");
-  ASSERT_STREQ(StripFirstQuotedToken(L"  \"abc def\" ghi  "), L" ghi");
-  ASSERT_STREQ(StripFirstQuotedToken(L"\"abc\"   \"def\" "), L"   \"def\"");
-}
-
-TEST(StringTest, EscapeUnescape) {
-  CString original_str(_T("test <>\"#{}|\\^[]?%&/"));
-  CString escaped_str;
-  ASSERT_SUCCEEDED(StringEscape(original_str, true, &escaped_str));
-  ASSERT_STREQ(escaped_str,
-               _T("test%20%3C%3E%22%23%7B%7D%7C%5C%5E%5B%5D%3F%25%26%2F"));
-  CString unescaped_str;
-  ASSERT_SUCCEEDED(StringUnescape(escaped_str, &unescaped_str));
-  ASSERT_STREQ(original_str, unescaped_str);
-
-  original_str = _T("foo.test path?app=1");
-  ASSERT_SUCCEEDED(StringEscape(original_str, false, &escaped_str));
-  ASSERT_STREQ(escaped_str,
-               _T("foo.test%20path?app=1"));
-  ASSERT_SUCCEEDED(StringUnescape(escaped_str, &unescaped_str));
-  ASSERT_STREQ(original_str, unescaped_str);
-}
-
-TEST(StringTest, ReplaceIgnoreCase) {
-  EXPECT_STREQ(_T("AddddAddddAB"),
-               String_ReplaceIgnoreCase(_T("ABCABCAB"), _T("bc"), _T("dddd")));
-  EXPECT_STREQ(_T("AdAdAd"),
-               String_ReplaceIgnoreCase(_T("ABCABCABC"), _T("bc"), _T("d")));
-}
-
-TEST(StringTest, String_StringToDecimalIntChecked) {
-  int value = 0;
-
-  // This code before the first valid case verifies that errno is properly
-  // cleared and there are no dependencies on prior code.
-  EXPECT_EQ(0, _set_errno(ERANGE));
-
-  // Valid Cases
-  EXPECT_TRUE(String_StringToDecimalIntChecked(_T("935"), &value));
-  EXPECT_EQ(value, 935);
-  EXPECT_TRUE(String_StringToDecimalIntChecked(_T("-935"), &value));
-  EXPECT_EQ(value, -935);
-  EXPECT_TRUE(String_StringToDecimalIntChecked(_T("0"), &value));
-  EXPECT_EQ(value, 0);
-  EXPECT_TRUE(String_StringToDecimalIntChecked(_T("2147483647"), &value));
-  EXPECT_EQ(value, LONG_MAX);
-  EXPECT_TRUE(String_StringToDecimalIntChecked(_T("-2147483648"), &value));
-  EXPECT_EQ(value, LONG_MIN);
-  EXPECT_TRUE(String_StringToDecimalIntChecked(_T(" 0"), &value));
-  EXPECT_EQ(value, 0);
-
-  // Failing Cases
-  EXPECT_FALSE(String_StringToDecimalIntChecked(_T(""), &value));
-  EXPECT_FALSE(String_StringToDecimalIntChecked(_T("2147483648"), &value));
-  EXPECT_EQ(value, LONG_MAX);
-  EXPECT_FALSE(String_StringToDecimalIntChecked(_T("-2147483649"), &value));
-  EXPECT_EQ(value, LONG_MIN);
-  EXPECT_FALSE(String_StringToDecimalIntChecked(_T("0x935"), &value));
-  EXPECT_FALSE(String_StringToDecimalIntChecked(_T("nine"), &value));
-  EXPECT_FALSE(String_StringToDecimalIntChecked(_T("9nine"), &value));
-  EXPECT_FALSE(String_StringToDecimalIntChecked(_T("nine9"), &value));
-
-  // A valid case after an overflow verifies that this method clears errno.
-  EXPECT_FALSE(String_StringToDecimalIntChecked(_T("2147483648"), &value));
-  EXPECT_TRUE(String_StringToDecimalIntChecked(_T("935"), &value));
-}
-TEST(StringTest, String_StringToTristate) {
-  Tristate value = TRISTATE_NONE;
-
-  // Valid Cases
-  EXPECT_TRUE(String_StringToTristate(_T("0"), &value));
-  EXPECT_EQ(value, TRISTATE_FALSE);
-  EXPECT_TRUE(String_StringToTristate(_T("1"), &value));
-  EXPECT_EQ(value, TRISTATE_TRUE);
-  EXPECT_TRUE(String_StringToTristate(_T("2"), &value));
-  EXPECT_EQ(value, TRISTATE_NONE);
-
-  // Invalid Cases
-  EXPECT_FALSE(String_StringToTristate(_T("-1"), &value));
-  EXPECT_FALSE(String_StringToTristate(_T("3"), &value));
-  EXPECT_FALSE(String_StringToTristate(_T(""), &value));
-}
-
-TEST(StringTest, ParseNameValuePair) {
-  CString name;
-  CString value;
-
-  // Valid Cases
-  EXPECT_TRUE(ParseNameValuePair(_T("xx=yyzz"), _T('='), &name, &value));
-  EXPECT_EQ(name, _T("xx"));
-  EXPECT_EQ(value, _T("yyzz"));
-  EXPECT_TRUE(ParseNameValuePair(_T("x=3?\\/\r\n "), _T('='), &name, &value));
-  EXPECT_EQ(name, _T("x"));
-  EXPECT_EQ(value, _T("3?\\/\r\n "));
-  EXPECT_TRUE(ParseNameValuePair(_T("3?google"), _T('?'), &name, &value));
-  EXPECT_EQ(name, _T("3"));
-  EXPECT_EQ(value, _T("google"));
-
-  // Invalid Cases
-  EXPECT_FALSE(ParseNameValuePair(_T(""), _T('='), &name, &value));
-  EXPECT_FALSE(ParseNameValuePair(_T(" "), _T('='), &name, &value));
-  EXPECT_FALSE(ParseNameValuePair(_T("="), _T('='), &name, &value));
-  EXPECT_FALSE(ParseNameValuePair(_T("x="), _T('='), &name, &value));
-  EXPECT_FALSE(ParseNameValuePair(_T("=y"), _T('='), &name, &value));
-  EXPECT_FALSE(ParseNameValuePair(_T("="), _T('='), &name, &value));
-  EXPECT_FALSE(ParseNameValuePair(_T("xxyyzz"), _T('='), &name, &value));
-  EXPECT_FALSE(ParseNameValuePair(_T("xx yyzz"), _T('='), &name, &value));
-  EXPECT_FALSE(ParseNameValuePair(_T("xx==yyzz"), _T('='), &name, &value));
-  EXPECT_FALSE(ParseNameValuePair(_T("xx=yy=zz"), _T('='), &name, &value));
-}
-
-TEST(StringTest, SplitCommandLineInPlace) {
-  const TCHAR * const test_long_paths[] = {
-    _T("c:\\Program Files\\Google\\App\\App.exe"),
-    _T("c:\\Program Files\\Google\\App\\Long Name App.exe"),
-  };
-  const TCHAR * const test_short_paths[] = {
-    _T("notepad.exe"),
-  };
-  const TCHAR * const test_arguments[] = {
-    _T("/a=\"some text\""),
-    _T("/a /b /c"),
-    _T(""),
-  };
-  TCHAR command_line[1024] = {};
-  TCHAR* path = NULL;
-  TCHAR* arguments = NULL;
-  for (int ii = 0; ii < ARRAYSIZE(test_arguments) ; ++ii) {
-    for (int jj = 0; jj < ARRAYSIZE(test_long_paths) ; ++jj) {
-      _snwprintf_s(command_line, ARRAYSIZE(command_line), _TRUNCATE,
-          _T("\"%s\" %s"), test_long_paths[jj], test_arguments[ii]);
-      EXPECT_EQ(true, SplitCommandLineInPlace(command_line, &path, &arguments));
-      EXPECT_STREQ(test_long_paths[jj], path);
-      EXPECT_STREQ(test_arguments[ii], arguments);
-    }
-    for (int kk = 0; kk < ARRAYSIZE(test_short_paths) ; ++kk) {
-      _snwprintf_s(command_line, ARRAYSIZE(command_line), _TRUNCATE,
-          _T("%s %s"), test_short_paths[kk], test_arguments[ii]);
-      EXPECT_EQ(true, SplitCommandLineInPlace(command_line, &path, &arguments));
-      EXPECT_STREQ(test_short_paths[kk], path);
-      EXPECT_STREQ(test_arguments[ii], arguments);
-    }
-  }
-}
-
-TEST(StringTest, ContainsOnlyAsciiChars) {
-  CString test(_T("hello worlr"));
-  ASSERT_TRUE(ContainsOnlyAsciiChars(test));
-
-  TCHAR non_ascii[] = {0x4345, 0x1234, 0x2000};
-  ASSERT_FALSE(ContainsOnlyAsciiChars(non_ascii));
-}
-TEST(StringTest, BytesToHex) {
-  EXPECT_STREQ(BytesToHex(NULL, 0), _T(""));
-  uint8 i = 0;
-  EXPECT_STREQ(BytesToHex(&i, sizeof(i)), _T("00"));
-  i = 0x7f;
-  EXPECT_STREQ(BytesToHex(&i, sizeof(i)), _T("7f"));
-  i = 0xff;
-  EXPECT_STREQ(BytesToHex(&i, sizeof(i)), _T("ff"));
-
-  // Assumes little-endian representation of integers.
-  const uint32 array[] = {0x67452301, 0xefcdab89};
-  EXPECT_STREQ(BytesToHex(reinterpret_cast<const uint8*>(array), sizeof(array)),
-               _T("0123456789abcdef"));
-
-  const uint8* first = reinterpret_cast<const uint8*>(array);
-  const uint8* last  = first + sizeof(array);
-  EXPECT_STREQ(BytesToHex(std::vector<uint8>(first, last)),
-               _T("0123456789abcdef"));
-}
-
-TEST(StringTest, JoinStrings) {
-  std::vector<CString> components;
-  const TCHAR* delim = _T("-");
-  CString result;
-
-  JoinStrings(components, delim, &result);
-  EXPECT_TRUE(result.IsEmpty());
-  JoinStrings(components, NULL, &result);
-  EXPECT_TRUE(result.IsEmpty());
-
-  components.push_back(CString(_T("foo")));
-  JoinStrings(components, delim, &result);
-  EXPECT_STREQ(result, (_T("foo")));
-  JoinStrings(components, NULL, &result);
-  EXPECT_STREQ(result, (_T("foo")));
-
-  components.push_back(CString(_T("bar")));
-  JoinStrings(components, delim, &result);
-  EXPECT_STREQ(result, (_T("foo-bar")));
-  JoinStrings(components, NULL, &result);
-  EXPECT_STREQ(result, (_T("foobar")));
-
-  components.push_back(CString(_T("baz")));
-  JoinStrings(components, delim, &result);
-  EXPECT_STREQ(result, (_T("foo-bar-baz")));
-  JoinStrings(components, NULL, &result);
-  EXPECT_STREQ(result, (_T("foobarbaz")));
-
-
-  JoinStringsInArray(NULL, 0, delim, &result);
-  EXPECT_TRUE(result.IsEmpty());
-  JoinStringsInArray(NULL, 0, NULL, &result);
-  EXPECT_TRUE(result.IsEmpty());
-
-  const TCHAR* array1[] = {_T("foo")};
-  JoinStringsInArray(array1, arraysize(array1), delim, &result);
-  EXPECT_STREQ(result, (_T("foo")));
-  JoinStringsInArray(array1, arraysize(array1), NULL, &result);
-  EXPECT_STREQ(result, (_T("foo")));
-
-  const TCHAR* array2[] = {_T("foo"), _T("bar")};
-  JoinStringsInArray(array2, arraysize(array2), delim, &result);
-  EXPECT_STREQ(result, (_T("foo-bar")));
-  JoinStringsInArray(array2, arraysize(array2), NULL, &result);
-  EXPECT_STREQ(result, (_T("foobar")));
-
-  const TCHAR* array3[] = {_T("foo"), _T("bar"), _T("baz")};
-  JoinStringsInArray(array3, arraysize(array3), delim, &result);
-  EXPECT_STREQ(result, (_T("foo-bar-baz")));
-  JoinStringsInArray(array3, arraysize(array3), NULL, &result);
-  EXPECT_STREQ(result, (_T("foobarbaz")));
-
-  const TCHAR* array_null_1[] = {NULL};
-  JoinStringsInArray(array_null_1, arraysize(array_null_1), delim, &result);
-  EXPECT_STREQ(result, (_T("")));
-
-  const TCHAR* array_null_2[] = {NULL, NULL};
-  JoinStringsInArray(array_null_2, arraysize(array_null_2), delim, &result);
-  EXPECT_STREQ(result, (_T("-")));
-}
-
-TEST(StringTest, String_ToUpper) {
-  // String_ToUpper is a wrapper over ::CharUpper.
-  TCHAR s[] = _T("foo");
-  String_ToUpper(s);
-  EXPECT_STREQ(s, _T("FOO"));
-}
-
-TEST(StringTest, FormatResourceMessage_Valid) {
-  EXPECT_STREQ(
-      _T("Thanks for installing Gears."),
-      FormatResourceMessage(IDS_BUNDLE_INSTALLED_SUCCESSFULLY, _T("Gears")));
-
-  EXPECT_STREQ(
-      _T("The installer encountered error 12345: Action failed."),
-      FormatResourceMessage(IDS_INSTALLER_FAILED_WITH_MESSAGE,
-                            _T("12345"),
-                            _T("Action failed.")));
-}
-
-TEST(StringTest, FormatResourceMessage_IdNotFound) {
-  EXPECT_STREQ(_T(""), FormatResourceMessage(100000, "foo", 9));
-}
-
-TEST(StringTest, FormatErrorCode) {
-  EXPECT_STREQ(_T("0xffffffff"), FormatErrorCode(static_cast<DWORD>(-1)));
-  EXPECT_STREQ(_T("0"), FormatErrorCode(0));
-  EXPECT_STREQ(_T("567"), FormatErrorCode(567));
-  EXPECT_STREQ(_T("2147483647"), FormatErrorCode(0x7fffffff));
-  EXPECT_STREQ(_T("0x80000000"), FormatErrorCode(0x80000000));
-  EXPECT_STREQ(_T("0x80000001"), FormatErrorCode(0x80000001));
-  EXPECT_STREQ(_T("0x8fffffff"), FormatErrorCode(0x8fffffff));
-}
-
-TEST(StringTest, Utf8BufferToWideChar) {
-  // Unicode Greek capital letters.
-  const TCHAR expected_string[] = {913, 914, 915, 916, 917, 918, 919, 920,
-                                   921, 922, 923, 924, 925, 926, 927, 928,
-                                   929, 931, 932, 933, 934, 935, 936, 937, 0};
-  // Greek capital letters UTF-8 encoded.
-  const char buffer[] = "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ";
-  CString actual_string = Utf8BufferToWideChar(
-      std::vector<uint8>(buffer, buffer + arraysize(buffer)));
-  EXPECT_STREQ(expected_string, actual_string);
-
-  EXPECT_STREQ(_T(""), Utf8BufferToWideChar(std::vector<uint8>()));
-}
-
-TEST(StringTest, WideStringToUtf8UrlEncodedStringRoundTrip) {
-  CString unicode_string;
-  ASSERT_TRUE(unicode_string.LoadString(IDS_ESCAPE_TEST));
-
-  // Convert from unicode to a wide representation of utf8,url encoded string.
-  CString utf8encoded_str;
-  ASSERT_HRESULT_SUCCEEDED(WideStringToUtf8UrlEncodedString(unicode_string,
-                                                            &utf8encoded_str));
-  ASSERT_FALSE(utf8encoded_str.IsEmpty());
-
-  // Reconvert from the utf8, url encoded string to the wide version.
-  CString out;
-  ASSERT_HRESULT_SUCCEEDED(Utf8UrlEncodedStringToWideString(utf8encoded_str,
-                                                            &out));
-  ASSERT_FALSE(out.IsEmpty());
-  ASSERT_STREQ(unicode_string, out);
-}
-
-TEST(StringTest, WideStringToUtf8UrlEncodedStringEmptyString) {
-  CString unicode_string;
-
-  // Convert from unicode to a wide representation of utf8,url encoded string.
-  CString utf8encoded_str;
-  ASSERT_HRESULT_SUCCEEDED(WideStringToUtf8UrlEncodedString(unicode_string,
-                                                            &utf8encoded_str));
-  ASSERT_TRUE(utf8encoded_str.IsEmpty());
-}
-
-TEST(StringTest, WideStringToUtf8UrlEncodedStringSpaces) {
-  CString unicode_string(_T("   "));
-  CStringA expected("%20%20%20");
-  CString exp(expected);
-
-  // Convert from unicode to a wide representation of utf8,url encoded string.
-  CString utf8encoded_str;
-  ASSERT_HRESULT_SUCCEEDED(WideStringToUtf8UrlEncodedString(unicode_string,
-                                                            &utf8encoded_str));
-  ASSERT_STREQ(exp, utf8encoded_str);
-}
-
-TEST(StringTest, WideStringToUtf8UrlEncodedStringTestString) {
-  CString unicode_string(_T("Test Str/ing&values=&*^%$#"));
-  CStringA ansi_exp("Test%20Str/ing%26values=%26*%5E%$#");
-  CString exp(ansi_exp);
-
-  // Convert from unicode to a wide representation of utf8,url encoded string.
-  CString utf8encoded_str;
-  ASSERT_HRESULT_SUCCEEDED(WideStringToUtf8UrlEncodedString(unicode_string,
-                                                            &utf8encoded_str));
-  ASSERT_STREQ(exp, utf8encoded_str);
-}
-
-TEST(StringTest, WideStringToUtf8UrlEncodedStringSimpleTestString) {
-  CString unicode_string(_T("TestStr"));
-  CStringA ansi_exp("TestStr");
-  CString exp(ansi_exp);
-
-  // Convert from unicode to a wide representation of utf8,url encoded string.
-  CString utf8encoded_str;
-  ASSERT_HRESULT_SUCCEEDED(WideStringToUtf8UrlEncodedString(unicode_string,
-                                                            &utf8encoded_str));
-  ASSERT_STREQ(exp, utf8encoded_str);
-}
-
-TEST(StringTest, Utf8UrlEncodedStringToWideStringEmpty) {
-  // Convert from wide representation of utf8,url encoded string to unicode.
-  CString unicode_string;
-  CString utf8encoded_str;
-  ASSERT_HRESULT_SUCCEEDED(Utf8UrlEncodedStringToWideString(utf8encoded_str,
-                                                            &unicode_string));
-  ASSERT_TRUE(unicode_string.IsEmpty());
-}
-
-TEST(StringTest, Utf8UrlEncodedStringToWideStringSpaces) {
-  CString exp(_T("   "));
-  CStringA utf8("%20%20%20");
-  CString utf8encoded_str(utf8);
-
-  // Convert from wide representation of utf8,url encoded string to unicode.
-  CString unicode_string;
-  ASSERT_HRESULT_SUCCEEDED(Utf8UrlEncodedStringToWideString(utf8encoded_str,
-                                                            &unicode_string));
-  ASSERT_STREQ(exp, unicode_string);
-}
-
-TEST(StringTest, Utf8UrlEncodedStringToWideStringSimpleString) {
-  CString exp(_T("TestStr"));
-  CStringA utf8("TestStr");
-  CString utf8encoded_str(utf8);
-
-  // Convert from wide representation of utf8,url encoded string to unicode.
-  CString unicode_string;
-  ASSERT_HRESULT_SUCCEEDED(Utf8UrlEncodedStringToWideString(utf8encoded_str,
-                                                            &unicode_string));
-  ASSERT_STREQ(exp, unicode_string);
-}
-
-TEST(StringTest, ConvertFileUriToLocalPath) {
-  CString path_out;
-
-  EXPECT_HRESULT_SUCCEEDED(ConvertFileUriToLocalPath(
-    _T("file:///c:/test/path/one/test.txt"), &path_out));
-  EXPECT_STREQ(_T("c:\\test\\path\\one\\test.txt"), path_out);
-
-  EXPECT_HRESULT_SUCCEEDED(ConvertFileUriToLocalPath(
-    _T("file:///d:/path%20with%20spaces/test.txt"), &path_out));
-  EXPECT_STREQ(_T("d:\\path with spaces\\test.txt"), path_out);
-
-  EXPECT_HRESULT_SUCCEEDED(ConvertFileUriToLocalPath(
-    _T("file://e|/pipe_for_colon/test.txt"), &path_out));
-  EXPECT_STREQ(_T("e:\\pipe_for_colon\\test.txt"), path_out);
-
-  // The unescaped & is illegal in both URIs and Win32 paths, and the escaped
-  // bracket is illegal in a Win32 path.  However, we should pass them through
-  // and allow the file system layer to reject it at an appropriate spot.
-  EXPECT_HRESULT_SUCCEEDED(ConvertFileUriToLocalPath(
-    _T("file://f:/path_with_illegal_characters/te&st%60.txt"), &path_out));
-  EXPECT_STREQ(_T("f:\\path_with_illegal_characters\\te&st%60.txt"), path_out);
-
-  EXPECT_HRESULT_SUCCEEDED(ConvertFileUriToLocalPath(
-    _T("file://g:/url_has_get_arguments/test.txt?q=abcde"), &path_out));
-  EXPECT_STREQ(_T("g:\\url_has_get_arguments\\test.txt"), path_out);
-
-  EXPECT_HRESULT_FAILED(ConvertFileUriToLocalPath(
-    _T("i:\\actual_path_instead_of_url\\test.txt"), &path_out));
-  EXPECT_HRESULT_FAILED(ConvertFileUriToLocalPath(
-    _T("http://uri_uses_another_scheme.com/test.txt"), &path_out));
-  EXPECT_HRESULT_FAILED(ConvertFileUriToLocalPath(_T("not_a_uri"), &path_out));
-  EXPECT_HRESULT_FAILED(ConvertFileUriToLocalPath(_T(""), &path_out));
-}
-
-}  // namespace omaha
-
diff --git a/base/synchronized.cc b/base/synchronized.cc
deleted file mode 100644
index d8a9b65..0000000
--- a/base/synchronized.cc
+++ /dev/null
@@ -1,512 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Defines methods of classes used to encapsulate
-// the synchronization primitives.
-
-#include "omaha/base/synchronized.h"
-
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/system.h"
-#include "omaha/base/system_info.h"
-#include "omaha/base/user_info.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-typedef HANDLE WINAPI CreateMutexExFunction(
-  LPSECURITY_ATTRIBUTES attributes,
-  const WCHAR* name,
-  DWORD flags,
-  DWORD desired_access
-);
-
-#define CREATE_EVENT_MANUAL_RESET 0x01
-typedef HANDLE WINAPI CreateEventExFunction(
-  LPSECURITY_ATTRIBUTES attributes,
-  const WCHAR* name,
-  DWORD flags,
-  DWORD desired_access
-);
-
-CreateMutexExFunction* create_mutex_ex_function = NULL;
-CreateEventExFunction* create_event_ex_function = NULL;
-
-void EnsureCreateEx() {
-  if ((create_mutex_ex_function && create_event_ex_function) ||
-      !SystemInfo::IsRunningOnVistaOrLater()) {
-    return;
-  }
-
-  HMODULE kernel32_module = ::GetModuleHandle(_T("kernel32.dll"));
-  if (!kernel32_module) {
-    ASSERT(kernel32_module,
-           (_T("[GetModuleHandle error 0x%x]"), ::GetLastError()));
-    return;
-  }
-  GPA(kernel32_module, "CreateMutexExW", &create_mutex_ex_function);
-  ASSERT(create_mutex_ex_function,
-         (_T("[GPA error 0x%x]"), ::GetLastError()));
-
-  GPA(kernel32_module, "CreateEventExW", &create_event_ex_function);
-  ASSERT(create_event_ex_function,
-         (_T("[GPA error 0x%x]"), ::GetLastError()));
-}
-
-HANDLE CreateMutexWithSyncAccess(const TCHAR* name,
-                                 LPSECURITY_ATTRIBUTES lock_attributes) {
-  EnsureCreateEx();
-  if (create_mutex_ex_function) {
-    return create_mutex_ex_function(lock_attributes, name, 0,
-                                    SYNCHRONIZE |
-                                    MUTEX_MODIFY_STATE);  // for ReleaseMutex
-  }
-  return ::CreateMutex(lock_attributes, false, name);
-}
-
-HANDLE CreateEventWithSyncAccess(const TCHAR* name,
-                                 LPSECURITY_ATTRIBUTES event_attributes) {
-  EnsureCreateEx();
-  if (create_event_ex_function) {
-    return create_event_ex_function(event_attributes, name,
-                                    CREATE_EVENT_MANUAL_RESET,
-                                    SYNCHRONIZE |
-                                    EVENT_MODIFY_STATE);  // for Set/Reset, etc.
-  }
-  return ::CreateEvent(event_attributes, true, false, name);
-}
-
-// c-tor will take mutex.
-AutoSync::AutoSync(const Lockable *pLock)
-    : lock_(pLock),
-      first_time_(true) {
-  ASSERT(lock_, (L""));
-  VERIFY(lock_->Lock(), (L"Failed to lock in constructor"));
-}
-
-// c-tor will take mutex.
-AutoSync::AutoSync(const Lockable &rLock)
-    : lock_(&rLock),
-      first_time_(true) {
-  ASSERT(lock_, (L""));
-  VERIFY(lock_->Lock(), (L"Failed to lock in constructor"));
-}
-
-// d-tor will release mutex.
-AutoSync::~AutoSync() {
-  ASSERT(lock_, (L""));
-  VERIFY(lock_->Unlock(), (L"Failed to unlock in denstructor"));
-}
-
-// Allows to write the for loop of __mutexBlock macro
-bool AutoSync::FirstTime() {
-  if (first_time_) {
-     first_time_ = false;
-     return true;
-  }
-  return false;
-}
-
-// Constructor.
-GLock::GLock() : mutex_(NULL) {
-}
-
-bool GLock::InitializeWithSecAttr(const TCHAR* name,
-                                  LPSECURITY_ATTRIBUTES lock_attributes) {
-  ASSERT(!mutex_, (L""));
-
-#if defined(DEBUG) || defined(ASSERT_IN_RELEASE)
-  name_ = name;
-#endif
-
-  mutex_ = CreateMutexWithSyncAccess(name, lock_attributes);
-  return mutex_ != NULL;
-}
-
-// Create mutex return the status of creation. Sets to default DACL.
-bool GLock::Initialize(const TCHAR* name) {
-  return InitializeWithSecAttr(name, NULL);
-}
-
-// Clean up.
-GLock::~GLock() {
-  if (mutex_) {
-    VERIFY(::CloseHandle(mutex_), (_T("")));
-  }
-};
-
-// Wait until signaled.
-bool GLock::Lock() const {
-  return Lock(INFINITE);
-}
-
-bool GLock::Lock(DWORD dwMilliseconds) const {
-  ASSERT1(mutex_);
-
-  DWORD ret = ::WaitForSingleObject(mutex_, dwMilliseconds);
-  if (ret == WAIT_OBJECT_0) {
-    return true;
-  } else if (ret == WAIT_ABANDONED) {
-    UTIL_LOG(LE, (_T("[GLock::Lock - mutex was abandoned %s]"), name_));
-    return true;
-  }
-  return false;
-}
-
-// Release.
-bool GLock::Unlock() const {
-  ASSERT1(mutex_);
-
-  bool ret = (false != ::ReleaseMutex(mutex_));
-  ASSERT(ret, (_T("ReleaseMutex failed.  Err=%i"), ::GetLastError()));
-
-  return ret;
-}
-
-LLock::LLock() {
-  InitializeCriticalSection(&critical_section_);
-}
-
-LLock::~LLock() {
-  DeleteCriticalSection(&critical_section_);
-}
-
-bool LLock::Lock() const {
-  EnterCriticalSection(&critical_section_);
-  return true;
-}
-
-// not very precise funcion, but OK for our goals.
-bool LLock::Lock(DWORD wait_ms) const {
-  if (::TryEnterCriticalSection(&critical_section_))
-    return true;
-  DWORD ticks_at_the_begin_of_wait = GetTickCount();
-  do {
-    ::Sleep(0);
-    if (::TryEnterCriticalSection(&critical_section_)) {
-      return true;
-    }
-  } while (::GetTickCount() - ticks_at_the_begin_of_wait <  wait_ms);
-  return false;
-}
-
-bool LLock::Unlock() const {
-  LeaveCriticalSection(&critical_section_);
-  return true;
-}
-
-// LockCount is initialized to a value of -1; a value of 0 or greater indicates
-// that the critical section is held or owned. When LockCount is not equal
-// to -1, the OwningThread field contains the thread id that owns the section.
-DWORD LLock::GetOwner() const {
-  return critical_section_.LockCount != -1 ?
-         reinterpret_cast<DWORD>(critical_section_.OwningThread) : 0;
-}
-
-// Use this c-tor for interprocess gates.
-Gate::Gate(const TCHAR * event_name) : gate_(NULL) {
-  VERIFY(Initialize(event_name), (_T("")));
-}
-
-// Use this c-tor for in-process gates.
-Gate::Gate() : gate_(NULL) {
-  VERIFY(Initialize(NULL), (_T("")));
-}
-
-// clean up.
-Gate::~Gate() {
-  VERIFY(CloseHandle(gate_), (_T("")));
-}
-
-bool Gate::Initialize(const TCHAR * event_name) {
-  // event_name may be NULL
-  ASSERT1(gate_ == NULL);
-
-  // Create the event. The gate is initially closed.
-  // if this is in process gate we don't name event, otherwise we do.
-  // Created with default permissions.
-  gate_ = CreateEventWithSyncAccess(event_name, NULL);
-  return (NULL != gate_);
-}
-
-// Open the gate. Anyone can go through.
-bool Gate::Open() {
-  return FALSE != SetEvent(gate_);
-}
-
-// Shut the gate closed.
-bool Gate::Close() {
-  return FALSE != ResetEvent(gate_);
-}
-
-bool Gate::Wait(DWORD msec) {
-  return WAIT_OBJECT_0 == WaitForSingleObject(gate_, msec);
-}
-
-// Returns S_OK, and sets selected_gate to zero based index of the gate that
-// was opened
-// Returns E_FAIL if timeout occured or gate was abandoned.
-HRESULT Gate::WaitAny(Gate const * const *gates,
-                      int num_gates,
-                      DWORD msec,
-                      int *selected_gate) {
-  ASSERT1(selected_gate);
-  ASSERT1(gates);
-
-  return WaitMultipleHelper(gates, num_gates, msec, selected_gate, false);
-}
-
-// Returns S_OK if all gates were opened
-// Returns E_FAIL if timeout occured or gate was abandoned.
-HRESULT Gate::WaitAll(Gate const * const *gates, int num_gates, DWORD msec) {
-  ASSERT1(gates);
-
-  return WaitMultipleHelper(gates, num_gates, msec, NULL, true);
-}
-
-HRESULT Gate::WaitMultipleHelper(Gate const * const *gates,
-                                 int num_gates,
-                                 DWORD msec,
-                                 int *selected_gate,
-                                 bool wait_all) {
-  ASSERT1(gates);
-  ASSERT(num_gates > 0, (_T("There must be at least 1 gate")));
-
-  if ( num_gates <= 0 ) {
-    return E_FAIL;
-  }
-  HANDLE *gate_array = new HANDLE[ num_gates ];
-  ASSERT1(gate_array);
-  for ( int i = 0 ; i < num_gates ; ++i ) {
-    gate_array[ i ] = gates[ i ]->gate_;
-  }
-  DWORD res = WaitForMultipleObjects(num_gates,
-                                     gate_array,
-                                     wait_all ? TRUE : FALSE,
-                                     msec);
-  delete[] gate_array;
-
-#pragma warning(disable : 4296)
-// C4296: '>=' : expression is always true
-  if (WAIT_OBJECT_0 <= res && res < (WAIT_OBJECT_0 + num_gates)) {
-    if (selected_gate) {
-      *selected_gate = res - WAIT_OBJECT_0;
-    }
-    return S_OK;
-  }
-#pragma warning(default : 4296)
-  return E_FAIL;
-}
-
-bool WaitAllowRepaint(const Gate& gate, DWORD msec) {
-  DWORD wait = 0;
-  HANDLE gate_handle = gate;
-  while ((wait = ::MsgWaitForMultipleObjects(1,
-                                             &gate_handle,
-                                             FALSE,
-                                             msec,
-                                             QS_PAINT)) == WAIT_OBJECT_0 + 1) {
-    MSG msg;
-    if (::PeekMessage(&msg, NULL, WM_PAINT, WM_PAINT, PM_REMOVE) ||
-        ::PeekMessage(&msg, NULL, WM_NCPAINT, WM_NCPAINT, PM_REMOVE)) {
-      ::TranslateMessage(&msg);
-      ::DispatchMessage(&msg);
-    }
-  }
-  return (wait == WAIT_OBJECT_0);
-}
-
-// SimpleLock
-// TODO(omaha): Replace InterlockedCompareExchange with
-// InterlockedCompareExchangeAcquire
-// and InterlockedDecrement with InterlockedDecrementRelease for Windows 2003
-
-bool SimpleLock::Lock() const {
-  while (1 == ::InterlockedCompareExchange(&lock_, 1, 0))
-    ::SleepEx(0, TRUE);
-  return true;
-}
-
-bool SimpleLock::Unlock() const {
-  ::InterlockedDecrement(&lock_);
-  return true;
-}
-
-// same with a delay in the loop to prevent CPU usage with significant
-// contention
-
-bool SimpleLockWithDelay::Lock() const {
-  while (1 == ::InterlockedCompareExchange(&lock_, 1, 0))
-    ::SleepEx(25, FALSE);
-  return true;
-}
-
-bool SimpleLockWithDelay::Unlock() const {
-  ::InterlockedDecrement(&lock_);
-  return true;
-}
-
-
-CriticalSection::CriticalSection()
-: number_entries_(0) {
-  InitializeCriticalSection(&critical_section_);
-}
-
-// allow only one thread to hold a lock
-CriticalSection::~CriticalSection() {
-  // we should not have to do anything in the destructor
-  ASSERT(!number_entries_, (_T("critical section destroyed while active")));
-  while (number_entries_) {
-    LeaveCriticalSection(&critical_section_);
-    number_entries_--;
-  }
-
-  DeleteCriticalSection(&critical_section_);
-}
-
-// enter the critical section
-// entries may be nested
-void CriticalSection::Enter() {
-  EnterCriticalSection(&critical_section_);
-  number_entries_++;
-}
-
-// exit the critical section
-// number of exits must match number of entries
-void CriticalSection::Exit() {
-  LeaveCriticalSection(&critical_section_);
-  number_entries_--;
-}
-
-// Take a CriticalSection and lock it
-SingleLock::SingleLock(CriticalSection * cs) {
-  ASSERT(cs, (L""));
-  critical_section_ = cs;
-  critical_section_->Enter();
-}
-
-// If we haven't freed it yet, do so now since we fell out of scope
-SingleLock::~SingleLock() {
-  if (critical_section_) {
-    critical_section_->Exit();
-    critical_section_ = NULL;
-  }
-}
-
-// Explicitly unlock
-HRESULT SingleLock::Unlock() {
-  // If they did not
-  if (critical_section_ == NULL)
-    return S_FALSE;
-
-  critical_section_->Exit();
-  critical_section_ = NULL;
-  return S_OK;
-}
-
-// Encapsulation for kernel Event. Initializes and destroys with it's lifetime
-void EventObj::Init(const TCHAR * event_name) {
-  ASSERT(event_name, (L""));
-
-  h_ = ::CreateEvent(NULL, false, false, event_name);
-  ASSERT1(h_);
-}
-
-EventObj::~EventObj() {
-  if (h_) {
-    VERIFY(CloseHandle(h_), (L""));
-    h_ = NULL;
-  }
-}
-
-BOOL EventObj::SetEvent() {
-  ASSERT(h_, (L""));
-  return ::SetEvent(h_);
-}
-
-// Is the given handle signaled?
-//
-// Typically used for events.
-bool IsHandleSignaled(HANDLE h) {
-  ASSERT(h != NULL &&
-         h != INVALID_HANDLE_VALUE, (_T("")));
-
-  DWORD result = ::WaitForSingleObject(h, 0);
-  if (result == WAIT_OBJECT_0) {
-    return true;
-  }
-
-  ASSERT(result == WAIT_TIMEOUT,
-         (_T("unexpected result value: %u (hr=0x%x)"),
-          result, HRESULTFromLastError()));
-  return false;
-}
-
-
-// Create an id for the events/mutexes that can be used at the given scope.
-// TODO(omaha): Error handling.
-void CreateSyncId(const TCHAR* id, SyncScope scope, CString* sync_id) {
-  ASSERT1(id);
-  ASSERT1(sync_id);
-
-  CString postfix;
-  switch (scope) {
-    default:
-      ASSERT1(false);
-      break;
-
-    case SYNC_LOCAL:
-      sync_id->SetString(_T("Local\\"));
-      // no postfix for local ids
-      break;
-
-    case SYNC_USER:
-    case SYNC_GLOBAL:
-      sync_id->SetString(_T("Global\\"));
-
-      if (scope == SYNC_GLOBAL) {
-        // (MSDN insists that you can create objects with the same name with the
-        // prefixes "Global\" and "Local\" in a system "running Terminal
-        // Services". And it also assures that XP when running Fast User
-        // Switching uses Terminal Services. But when you try to create two
-        // objects with the same name but in the different namespaces on an
-        // XP Pro workstation NOT running Fast User Switching you can't - you
-        // get ERROR_ALREADY_EXISTS. And the reason is that in the Object table,
-        // Global and Local are both symlinks to the same object directory.
-        // Yet every technique that you can use to interrogate the system on
-        // whether or not the system is "running Terminal Services" says that
-        // the system is, in fact, running Terminal Services.
-        // Which is exactly what you'd expect, yet you can't create the
-        // two objects with the same name in different workspaces.  So we change
-        // the name slightly.)
-        postfix.SetString(_T("_global"));
-      } else {
-        ASSERT1(scope == SYNC_USER);
-        // make the postfix the sid
-        VERIFY1(SUCCEEDED(omaha::user_info::GetProcessUser(NULL,
-                                                           NULL,
-                                                           &postfix)));
-      }
-      break;
-  }
-
-  sync_id->Append(id);
-  sync_id->Append(postfix);
-}
-
-}  // namespace omaha
-
diff --git a/base/synchronized.h b/base/synchronized.h
deleted file mode 100644
index 20d7208..0000000
--- a/base/synchronized.h
+++ /dev/null
@@ -1,358 +0,0 @@
-// Copyright 2004-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Declares some classes and macros to encapsulate
-// the synchronization primitives.
-
-// TODO(omaha): remove dependency on atlstr
-
-#ifndef OMAHA_BASE_SYNCHRONIZED_H_
-#define OMAHA_BASE_SYNCHRONIZED_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-// This macros are used to create a unique name
-// We need to go through two steps of expansion.
-// Macro kMakeName1 will expand to string + number
-// and macro kMakeName1 will put them together to create
-// the unique name.
-#define MAKE_NAME2(x, y) x##y
-#define MAKE_NAME1(x, y) MAKE_NAME2(x, y)
-#define MAKE_NAME(x) MAKE_NAME1(x, __COUNTER__)
-
-// Declare the interface in implement mutual
-// exclusion. For in process mutual exclusion
-// simple critical sections can be used. For
-// interprocess mutual exclusion some named
-// kernel mode object will have to be used.
-struct Lockable {
-  virtual ~Lockable() {}
-  virtual bool Lock() const = 0;
-  virtual bool Unlock() const = 0;
-};
-
-// Scope based mutual exclusion. Locks
-// the object on construction and unlocks
-// during destruction. Very convinient to use
-// with the macros __mutexScope and __mutexBlock
-class AutoSync {
-  bool first_time_;
- public:
-  explicit AutoSync(const Lockable *pLock);
-  explicit AutoSync(const Lockable &rLock);
-  ~AutoSync();
-  // this function is only needed to use with
-  // the macro __mutexBlock
-  bool FirstTime();
- private:
-  const Lockable * lock_;
-  DISALLOW_EVIL_CONSTRUCTORS(AutoSync);
-};
-
-// the usaage:
-// class A : public Lockable {
-//
-//
-//
-//  void foo(){
-//   __mutexScope(this);
-// ......
-// .......
-// everything is synchronized till the end of the
-// function or the time it returns (from any place)
-// } // end foo.
-//
-// void bar() {
-// ......
-// ...... do something here.
-// ......
-//   __mutexBlock(this){
-//    .... do some other stuff
-//    ....
-//    ....
-//    } everything is synchronized till here
-//
-// }; // end class A
-
-//
-#define __mutexScope(lock) AutoSync MAKE_NAME(hiddenLock)(lock)
-#define __mutexBlock(lock) \
-    for (AutoSync hiddenLock(lock); hiddenLock.FirstTime(); )
-
-// GLock stands for global lock.
-// Implementaion of Lockable to allow mutual exclusion
-// between different processes.
-// For in-process mutual exclusion use LLock - local lock
-class GLock : public Lockable {
- public:
-  GLock();
-  virtual ~GLock();
-
-  // Create mutex returns the status of creation. Use ::GetLastError for
-  // error information.
-  bool InitializeWithSecAttr(const TCHAR* name,
-                             LPSECURITY_ATTRIBUTES lock_attributes);
-
-  // Create mutex return the status of creation. Sets to default DACL.
-  bool Initialize(const TCHAR* name);
-
-  virtual bool Lock() const;
-  virtual bool Lock(DWORD dwMilliseconds) const;
-  virtual bool Unlock() const;
-
- private:
-#if defined(DEBUG) || defined(ASSERT_IN_RELEASE)
-  CString name_;
-#endif
-  mutable HANDLE mutex_;
-  DISALLOW_EVIL_CONSTRUCTORS(GLock);
-};
-
-// FakeGLock looks like a GLock, but none of its methods do anything.
-// Only used with SharedMemoryPtr, in cases where locking is not required or
-// desired.
-class FakeGLock : public Lockable {
- public:
-  FakeGLock() {}
-  virtual ~FakeGLock() {}
-  bool InitializeWithSecAttr(const TCHAR*, LPSECURITY_ATTRIBUTES) {
-    return true;
-  }
-  bool Initialize(const TCHAR*) { return true; }
-  virtual bool Lock() const { return true; }
-  virtual bool Lock(DWORD) const { return true; }
-  virtual bool Unlock() const { return true; }
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(FakeGLock);
-};
-
-// LLock stands for local lock.
-// means works only inside the process.
-// use GLock - global lock for inter-process
-// guarded access to data.
-class LLock : public Lockable {
- public:
-  LLock();
-  virtual ~LLock();
-  virtual bool Lock() const;
-  virtual bool Lock(DWORD wait_ms) const;
-  virtual bool Unlock() const;
-
-  // Returns the thread id of the owner or 0 if the lock is not owned.
-  DWORD GetOwner() const;
- private:
-  mutable CRITICAL_SECTION        critical_section_;
-  DISALLOW_EVIL_CONSTRUCTORS(LLock);
-};
-
-// A gate is a synchronization object used to either stop all
-// threads from proceeding through a point or to allow them all to proceed.
-class Gate {
- public:
-  // In process gate.
-  Gate();
-
-  // Interprocess gate.
-  explicit Gate(const TCHAR * event_name);
-
-  ~Gate();
-
-  // Open the gate.
-  bool Open();
-
-  // Close the gate.
-  bool Close();
-
-  // Wait to enter the gate.
-  bool Wait(DWORD msec);
-
-  // Conversion from the object to a HANDLE.
-  operator HANDLE() const {return gate_;}
-
-  // Returns S_OK, and sets selected_gate to zero based index of the gate that
-  // was opened.
-  // Returns E_FAIL if timeout occured or gate was abandoned.
-  static HRESULT WaitAny(Gate const * const *gates,
-                         int num_gates,
-                         DWORD msec,
-                         int *selected_gate);
-
-  // Returns S_OK if all gates were opened
-  // Returns E_FAIL if timeout occured or gate was abandoned.
-  static HRESULT WaitAll(Gate const * const *gates, int num_gates, DWORD msec);
-
- private:
-  bool Initialize(const TCHAR * event_name);
-  static HRESULT WaitMultipleHelper(Gate const * const *gates,
-                                    int num_gates,
-                                    DWORD msec,
-                                    int *selected_gate,
-                                    bool wait_all);
-  HANDLE gate_;
-  DISALLOW_EVIL_CONSTRUCTORS(Gate);
-};
-
-bool WaitAllowRepaint(const Gate& gate, DWORD msec);
-
-class AutoGateKeeper {
- public:
-  explicit AutoGateKeeper(Gate *gate) : gate_(gate) {
-    gate_->Open();
-  }
-  ~AutoGateKeeper() {
-    gate_->Close();
-  }
- private:
-  Gate *gate_;
-  DISALLOW_EVIL_CONSTRUCTORS(AutoGateKeeper);
-};
-
-// A very simple rather fast lock - if uncontested.  USE ONLY AS A GLOBAL OBJECT
-// (i.e., DECLARED AT FILE SCOPE or as a STATIC CLASS MEMBER) - this is not
-// enforced.  Uses interlocked instructions on an int to get a fast user-mode
-// lock.  (Locks the bus and does a couple of memory references so it isn't
-// free.)  Spin-waits to get the lock.  Has the advantage that it needs no
-// initialization - thus has no order-of-evaluation problems with respect to
-// other global objects.  Does not work (causes deadlock) if locked twice by
-// the same thread. (Has no constructor so is initialized to 0 by C++.
-// This is why it must be a global or static class member: it doesn't initialize
-// itself to 0.  This is also why it doesn't inherit from Lockable, which would
-// make it need to initialize a virtual table.)
-struct SimpleLock {
-  bool Lock() const;
-  bool Unlock() const;
- private:
-  mutable volatile long lock_;
-};
-
-struct SimpleLockWithDelay {
-  bool Lock() const;
-  bool Unlock() const;
- private:
-  mutable volatile long lock_;
-};
-
-class AutoSimpleLock {
- public:
-  explicit AutoSimpleLock(const SimpleLock& lock)
-      : lock_(lock) { lock_.Lock(); }
-  ~AutoSimpleLock() { lock_.Unlock(); }
- private:
-  const SimpleLock& lock_;
-  DISALLOW_EVIL_CONSTRUCTORS(AutoSimpleLock);
-};
-
-class AutoSimpleLockWithDelay {
- public:
-  explicit AutoSimpleLockWithDelay(const SimpleLockWithDelay& lock)
-      : lock_(lock) { lock_.Lock(); }
-  ~AutoSimpleLockWithDelay() { lock_.Unlock(); }
- private:
-  const SimpleLockWithDelay& lock_;
-  DISALLOW_EVIL_CONSTRUCTORS(AutoSimpleLockWithDelay);
-};
-
-
-// allow only one thread to hold a lock
-class CriticalSection {
- public:
-  CriticalSection();
-  ~CriticalSection();
-
-  void Enter();
-  void Exit();
-
- private:
-  CRITICAL_SECTION critical_section_;
-  uint32 number_entries_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(CriticalSection);
-};
-
-// A class that manages a CriticalSection with its lifetime, you pass
-// it one in the constructor and then it will either be freed in the
-// destructor or implicitly [but only once]
-class SingleLock {
- public:
-  // TODO(omaha): Not sure if immediately locking is a good idea;
-  // the API is asymmetrical (there's an Unlock but no Lock).
-
-  // Lock a critical section immediately
-  explicit SingleLock(CriticalSection * cs);
-
-  // If we have not explicitly unlocked it, this destructor will
-  ~SingleLock();
-
-  // Release the lock explicitly [should be called only once, after that
-  // does nothing. If we do not do so, the destructor will]
-  HRESULT Unlock();
-
- private:
-  CriticalSection * critical_section_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(SingleLock);
-};
-
-// Encapsulation for kernel Event. Initializes and destroys with it's lifetime
-class EventObj {
- public:
-  explicit EventObj(const TCHAR * event_name) {
-    Init(event_name);
-  }
-  ~EventObj();
-  void Init(const TCHAR * event_name);
-  BOOL SetEvent();
-  HANDLE GetHandle() { return h_; }
-
- private:
-  HANDLE h_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(EventObj);
-};
-
-// Is the given handle signaled?
-//
-// Typically used for events.
-bool IsHandleSignaled(HANDLE h);
-
-
-enum SyncScope {
-  // local to a session
-  SYNC_LOCAL,
-
-  // global scope but the name is decorated to make it unique for the user
-  SYNC_USER,
-
-  // a globally scoped name
-  SYNC_GLOBAL,
-};
-
-// Create an id for the events/mutexes that can be used at the given scope
-void CreateSyncId(const TCHAR* id, SyncScope scope, CString* sync_id);
-
-// If any place needs to create a mutex that multiple
-// processes need to access, use this.
-HANDLE CreateMutexWithSyncAccess(const TCHAR* name,
-                                 LPSECURITY_ATTRIBUTES lock_attributes);
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_SYNCHRONIZED_H_
-
diff --git a/base/synchronized_unittest.cc b/base/synchronized_unittest.cc
deleted file mode 100644
index 6b9352a..0000000
--- a/base/synchronized_unittest.cc
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/synchronized.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(LLockTest, GetOwner) {
-  LLock lock;
-
-  EXPECT_EQ(0, lock.GetOwner());
-
-  EXPECT_TRUE(lock.Lock());
-  EXPECT_EQ(::GetCurrentThreadId(), lock.GetOwner());
-
-  EXPECT_TRUE(lock.Unlock());
-  EXPECT_EQ(0, lock.GetOwner());
-}
-
-}  // namespace omaha
-
diff --git a/base/system.cc b/base/system.cc
deleted file mode 100644
index b60f183..0000000
--- a/base/system.cc
+++ /dev/null
@@ -1,1086 +0,0 @@
-// Copyright 2004-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/system.h"
-
-#include <objidl.h>
-#include <psapi.h>
-#include <winioctl.h>
-#include <wtsapi32.h>
-#include "omaha/base/commands.h"
-#include "omaha/base/commontypes.h"
-#include "omaha/base/const_config.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/disk.h"
-#include "omaha/base/dynamic_link_kernel32.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/module_utils.h"
-#include "omaha/base/path.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/string.h"
-#include "omaha/base/system_info.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-
-namespace omaha {
-
-// Constant
-const TCHAR kNeedRebootHiddenFileSuffix[] = _T(".needreboot");
-
-HRESULT System::WaitForDiskActivity(const uint32 max_delay_milliseconds,
-                                    const uint32 sleep_time_ms,
-                                    uint32 *time_waited) {
-  ASSERT(time_waited, (L""));
-  uint32 sleep_time = sleep_time_ms;
-  if (sleep_time < 20) { sleep_time = 20; }
-  else if (sleep_time > 1000) { sleep_time = 1000; }
-  HRESULT r;
-  *time_waited = 0;
-  uint64 writes = 0;
-  uint64 new_writes = 0;
-  // get current counters
-  if (FAILED(r=GetDiskActivityCounters(NULL, &writes, NULL, NULL))) {
-    return r;
-  }
-
-  // wait until a write - reads may be cached
-  while (1) {
-    if (FAILED(r=GetDiskActivityCounters(NULL, &new_writes, NULL, NULL))) {
-      return r;
-    }
-    if (new_writes > writes) { return S_OK; }
-    if (*time_waited > max_delay_milliseconds) { return E_FAIL; }
-    SleepEx(sleep_time, TRUE);
-    *time_waited += sleep_time;
-  }
-}
-
-HRESULT System::GetDiskActivityCounters(uint64* reads,
-                                        uint64* writes,
-                                        uint64* bytes_read,
-                                        uint64* bytes_written) {
-  if (reads) {
-    *reads = 0;
-  }
-
-  if (writes) {
-    *writes = 0;
-  }
-
-  if (bytes_read) {
-    *bytes_read = 0;
-  }
-
-  if (bytes_written) {
-    *bytes_written = 0;
-  }
-
-  // Don't want to risk displaying UI errors here
-  DisableThreadErrorUI disable_error_dialog_box;
-
-  // for all drives
-  for (int drive = 0; ; drive++) {
-    struct _DISK_PERFORMANCE perf_data;
-    const int max_device_len = 50;
-
-    // check whether we can access this device
-    CString device_name;
-    device_name.Format(_T("\\\\.\\PhysicalDrive%d"), drive);
-    scoped_handle device(::CreateFile(device_name, 0,
-                                      FILE_SHARE_READ | FILE_SHARE_WRITE,
-                                      NULL, OPEN_EXISTING, 0, NULL));
-
-    if (get(device) == INVALID_HANDLE_VALUE) {
-      if (!drive) {
-        UTIL_LOG(LEVEL_ERROR, (_T("[Failed to access drive %i][0x%x]"),
-                               drive,
-                               HRESULTFromLastError()));
-      }
-      break;
-    }
-
-    // disk performance counters must be on (diskperf -y on older machines;
-    // defaults to on on newer windows)
-    DWORD size = 0;
-    if (::DeviceIoControl(get(device),
-                          IOCTL_DISK_PERFORMANCE,
-                          NULL,
-                          0,
-                          &perf_data,
-                          sizeof(_DISK_PERFORMANCE),
-                          &size,
-                          NULL)) {
-      if (reads) {
-        *reads += perf_data.ReadCount;
-      }
-
-      if (writes) {
-        *writes += perf_data.WriteCount;
-      }
-
-      if (bytes_read) {
-        *bytes_read += perf_data.BytesRead.QuadPart;
-      }
-
-      if (bytes_written) {
-        *bytes_written += perf_data.BytesWritten.QuadPart;
-      }
-    } else {
-      HRESULT hr = HRESULTFromLastError();
-      UTIL_LOG(LEVEL_ERROR,
-               (_T("[System::GetDiskActivityCounters - failed to ")
-                _T("DeviceIoControl][0x%x]"), hr));
-      return hr;
-    }
-  }
-
-  return S_OK;
-}
-
-HRESULT System::GetDiskStatistics(const TCHAR* path,
-                                  uint64 *free_bytes_current_user,
-                                  uint64 *total_bytes_current_user,
-                                  uint64 *free_bytes_all_users) {
-  ASSERT1(path);
-  ASSERT1(free_bytes_current_user);
-  ASSERT1(total_bytes_current_user);
-  ASSERT1(free_bytes_all_users);
-  ASSERT1(sizeof(LARGE_INTEGER) == sizeof(uint64));  // NOLINT
-
-  DisableThreadErrorUI disable_error_dialog_box;
-
-  if (!::GetDiskFreeSpaceEx(
-           path,
-           reinterpret_cast<PULARGE_INTEGER>(free_bytes_current_user),
-           reinterpret_cast<PULARGE_INTEGER>(total_bytes_current_user),
-           reinterpret_cast<PULARGE_INTEGER>(free_bytes_all_users))) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR,
-             (_T("[Failed to GetDiskFreeSpaceEx][%s][0x%x]"), path, hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT System::GetProcessMemoryStatistics(uint64 *current_working_set,
-                                           uint64 *peak_working_set,
-                                           uint64 *min_working_set_size,
-                                           uint64 *max_working_set_size) {
-  HANDLE process_handle = GetCurrentProcess();
-  HRESULT hr = S_OK;
-
-  DWORD min_size(0), max_size(0);
-  if (GetProcessWorkingSetSize(process_handle, &min_size, &max_size)) {
-    UTIL_LOG(L2, (_T("[working set][min: %lu][max: %lu]"), min_size, max_size));
-    if (min_working_set_size) {
-      *min_working_set_size = min_size;
-    }
-    if (max_working_set_size) {
-      *max_working_set_size = max_size;
-    }
-  } else {
-    if (min_working_set_size) {
-      *min_working_set_size = 0;
-    }
-    if (max_working_set_size) {
-      *max_working_set_size = 0;
-    }
-    hr = E_FAIL;
-  }
-
-  if (current_working_set) { *current_working_set = 0; }
-  if (peak_working_set) { *peak_working_set = 0; }
-
-  // including this call (w/psapi.lib) adds 24k to the process memory
-  // according to task manager in one test, memory usage according to task
-  // manager increased by 4k after calling this
-  PROCESS_MEMORY_COUNTERS counters = { sizeof(counters), 0 };
-  if (GetProcessMemoryInfo(process_handle,
-                           &counters,
-                           sizeof(PROCESS_MEMORY_COUNTERS))) {
-    if (current_working_set) {
-      *current_working_set = counters.WorkingSetSize;
-    }
-    if (peak_working_set) {
-      *peak_working_set = counters.PeakWorkingSetSize;
-    }
-    UTIL_LOG(L2, (_T("[working set][current: %s][peak: %s]"),
-                  String_Int64ToString(*current_working_set, 10),
-                  String_Int64ToString(*peak_working_set, 10)));
-  } else {
-    if (current_working_set) {
-      *current_working_set = 0;
-    }
-    if (peak_working_set) {
-      *peak_working_set = 0;
-    }
-    hr = E_FAIL;
-  }
-
-  return hr;
-}
-
-HRESULT System::MaxPhysicalMemoryAvailable(uint64* max_bytes) {
-  ASSERT1(max_bytes);
-
-  *max_bytes = 0;
-
-  uint32 memory_load_percentage = 0;
-  uint64 free_physical_memory = 0;
-
-  RET_IF_FAILED(System::GetGlobalMemoryStatistics(&memory_load_percentage,
-    &free_physical_memory, NULL, NULL, NULL, NULL, NULL));
-
-  UTIL_LOG(L4, (_T("mem load %u max physical memory available %s"),
-                memory_load_percentage,
-                String_Int64ToString(free_physical_memory, 10)));
-
-  *max_bytes = free_physical_memory;
-
-  return S_OK;
-}
-
-HRESULT System::GetGlobalMemoryStatistics(uint32 *memory_load_percentage,
-                                          uint64 *free_physical_memory,
-                                          uint64 *total_physical_memory,
-                                          uint64 *free_paged_memory,
-                                          uint64 *total_paged_memory,
-                                          uint64 *process_free_virtual_memory,
-                                          uint64 *process_total_virtual_mem) {
-  MEMORYSTATUSEX status;
-  status.dwLength = sizeof(status);
-  if (!GlobalMemoryStatusEx(&status)) {
-    UTIL_LOG(LEVEL_ERROR, (_T("memory status error %u"), GetLastError()));
-    return E_FAIL;
-  }
-  if (memory_load_percentage) { *memory_load_percentage = status.dwMemoryLoad; }
-  if (free_physical_memory) { *free_physical_memory = status.ullAvailPhys; }
-  if (total_physical_memory) { *total_physical_memory = status.ullTotalPhys; }
-  if (free_paged_memory) { *free_paged_memory = status.ullAvailPageFile; }
-  if (total_paged_memory) { *total_paged_memory = status.ullTotalPageFile; }
-  if (process_free_virtual_memory) {
-    *process_free_virtual_memory = status.ullAvailVirtual;
-  }
-  if (process_total_virtual_mem) {
-    *process_total_virtual_mem = status.ullTotalVirtual;
-  }
-  // GetPerformanceInfo;
-  return S_OK;
-}
-
-void System::FreeProcessWorkingSet() {
-  // -1,-1 is a special signal to the OS to temporarily trim the working set
-  // size to 0.  See MSDN for further information.
-  ::SetProcessWorkingSetSize(::GetCurrentProcess(), (SIZE_T)-1, (SIZE_T)-1);
-}
-
-HRESULT System::SetThreadPriority(enum Priority priority) {
-  int pri;
-
-  switch (priority) {
-    case LOW: pri = THREAD_PRIORITY_BELOW_NORMAL; break;
-    case HIGH: pri = THREAD_PRIORITY_HIGHEST; break;
-    case NORMAL: pri = THREAD_PRIORITY_NORMAL; break;
-    case IDLE: pri = THREAD_PRIORITY_IDLE; break;
-    default: return E_FAIL;
-  }
-
-  if (::SetThreadPriority(GetCurrentThread(), pri)) {
-    return S_OK;
-  } else {
-    return E_FAIL;
-  }
-}
-
-HRESULT System::SetProcessPriority(enum Priority priority) {
-  DWORD pri = 0;
-  switch (priority) {
-    case LOW: pri = BELOW_NORMAL_PRIORITY_CLASS; break;
-    case HIGH: pri = ABOVE_NORMAL_PRIORITY_CLASS; break;
-    case NORMAL: pri = NORMAL_PRIORITY_CLASS; break;
-    case IDLE: return E_INVALIDARG;
-    default: return E_INVALIDARG;
-  }
-
-  DWORD pid = ::GetCurrentProcessId();
-
-  scoped_handle handle(::OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid));
-  if (!valid(handle)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LE, (_T("[::OpenProcess failed][%u][0x%x]"), pid, hr));
-    return hr;
-  }
-
-  if (!::SetPriorityClass(get(handle), pri)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LE, (_T("[::SetPriorityClass failed][%u][0x%x]"), pid, hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// start another process painlessly via ::CreateProcess. Use the
-// ShellExecuteProcessXXX variants instead of these methods where possible,
-// since ::ShellExecuteEx has better behavior on Windows Vista.
-// When using this method, avoid using process_name - see
-// http://blogs.msdn.com/oldnewthing/archive/2006/05/15/597984.aspx.
-HRESULT System::StartProcess(const TCHAR* process_name,
-                             TCHAR* command_line,
-                             PROCESS_INFORMATION* pi) {
-  ASSERT1(pi);
-  ASSERT1(command_line || process_name);
-  ASSERT(!process_name, (_T("Avoid using process_name. See method comment.")));
-
-  STARTUPINFO si = {sizeof(si), 0};
-
-  // Feedback cursor is off while the process is starting.
-  si.dwFlags = STARTF_FORCEOFFFEEDBACK;
-
-  UTIL_LOG(L3, (_T("[System::StartProcess][process %s][cmd %s]"),
-                process_name, command_line));
-
-  BOOL success = ::CreateProcess(
-      process_name,     // Module name
-      command_line,     // Command line
-      NULL,             // Process handle not inheritable
-      NULL,             // Thread handle not inheritable
-      FALSE,            // Set handle inheritance to FALSE
-      0,                // No creation flags
-      NULL,             // Use parent's environment block
-      NULL,             // Use parent's starting directory
-      &si,              // Pointer to STARTUPINFO structure
-      pi);              // Pointer to PROCESS_INFORMATION structure
-
-  if (!success) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR,
-             (_T("[System::StartProcess][::CreateProcess failed][0x%x]"), hr));
-    return hr;
-  }
-
-  OPT_LOG(L1, (_T("[Started process][%u]"), pi->dwProcessId));
-
-  return S_OK;
-}
-
-// start another process painlessly via ::CreateProcess. Use the
-// ShellExecuteProcessXXX variants instead of these methods where possible,
-// since ::ShellExecuteEx has better behavior on Windows Vista.
-HRESULT System::StartProcessWithArgsAndInfo(const TCHAR *process_name,
-                                            const TCHAR *cmd_line_arguments,
-                                            PROCESS_INFORMATION *pi) {
-  ASSERT1(process_name && cmd_line_arguments && pi);
-
-  CString command_line(process_name);
-  EnclosePath(&command_line);
-  command_line.AppendChar(_T(' '));
-  command_line.Append(cmd_line_arguments);
-  return System::StartProcess(NULL, CStrBuf(command_line), pi);
-}
-
-// start another process painlessly via ::CreateProcess. Use the
-// ShellExecuteProcessXXX variants instead of these methods where possible,
-// since ::ShellExecuteEx has better behavior on Windows Vista.
-HRESULT System::StartProcessWithArgs(const TCHAR *process_name,
-                                     const TCHAR *cmd_line_arguments) {
-  ASSERT1(process_name && cmd_line_arguments);
-  PROCESS_INFORMATION pi = {0};
-  HRESULT hr = System::StartProcessWithArgsAndInfo(process_name,
-                                                   cmd_line_arguments,
-                                                   &pi);
-  if (SUCCEEDED(hr)) {
-    ::CloseHandle(pi.hProcess);
-    ::CloseHandle(pi.hThread);
-  }
-  return hr;
-}
-
-HRESULT System::StartCommandLine(const TCHAR* command_line_to_execute) {
-  ASSERT1(command_line_to_execute);
-
-  CString command_line(command_line_to_execute);
-  PROCESS_INFORMATION pi = {0};
-  HRESULT hr = System::StartProcess(NULL, CStrBuf(command_line), &pi);
-  if (SUCCEEDED(hr)) {
-    ::CloseHandle(pi.hProcess);
-    ::CloseHandle(pi.hThread);
-  }
-  return hr;
-}
-
-// TODO(omaha3): Unit test this method.
-HRESULT System::StartProcessAsUser(HANDLE user_token,
-                                   const CString& executable_path,
-                                   const CString& parameters,
-                                   LPWSTR desktop,
-                                   PROCESS_INFORMATION* pi) {
-  UTIL_LOG(L3, (_T("[StartProcessAsUser][%s][%s][%s]"),
-                executable_path, parameters, desktop));
-  ASSERT1(pi);
-
-  CString cmd(executable_path);
-  EnclosePath(&cmd);
-  cmd.AppendChar(_T(' '));
-  cmd.Append(parameters);
-
-  STARTUPINFO startup_info = { sizeof(startup_info) };
-  startup_info.lpDesktop = desktop;
-  DWORD creation_flags(0);
-
-  void* environment_block(NULL);
-  if (!::CreateEnvironmentBlock(&environment_block, user_token, TRUE)) {
-    HRESULT hr = HRESULTFromLastError();
-    ASSERT(false, (_T("[::CreateEnvironmentBlock failed][0x%x]"), hr));
-    return hr;
-  }
-
-  ON_SCOPE_EXIT(::DestroyEnvironmentBlock, environment_block);
-
-  creation_flags |= CREATE_UNICODE_ENVIRONMENT;
-  BOOL success = ::CreateProcessAsUser(user_token,
-                                       0,
-                                       CStrBuf(cmd, MAX_PATH),
-                                       0,
-                                       0,
-                                       false,
-                                       creation_flags,
-                                       environment_block,
-                                       0,
-                                       &startup_info,
-                                       pi);
-
-  if (!success) {
-    HRESULT hr(HRESULTFromLastError());
-    UTIL_LOG(LE, (_T("[::CreateProcessAsUser failed][%s][0x%x]"), cmd, hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// start another process painlessly via ::ShellExecuteEx. Use this method
-// instead of the StartProcessXXX methods that use ::CreateProcess where
-// possible, since ::ShellExecuteEx has better behavior on Windows Vista.
-//
-// ShellExecuteExEnsureParent displays the PID of the started process if it is
-// returned. It is only returned if the mask includes SEE_MASK_NOCLOSEPROCESS.
-// Therefore, we always set this flag and pass a handle. If the caller did not
-// request the handle, we close it.
-HRESULT System::ShellExecuteProcess(const TCHAR* file_name_to_execute,
-                                    const TCHAR* command_line_parameters,
-                                    HWND hwnd,
-                                    HANDLE* process_handle) {
-  ASSERT1(file_name_to_execute);
-
-  UTIL_LOG(L3, (_T("[System::ShellExecuteProcess]")
-                _T("[file_name_to_execute '%s' command_line_parameters '%s']"),
-                file_name_to_execute, command_line_parameters));
-
-  SHELLEXECUTEINFO sei = {0};
-  sei.cbSize = sizeof(sei);
-  // SEE_MASK_NOZONECHECKS is set below to work around a problem in systems that
-  // had Internet Explorer 7 Beta installed. See http://b/804674.
-  // This only works for Windows XP SP1 and later.
-  sei.fMask = SEE_MASK_NOCLOSEPROCESS |  // Set hProcess to process handle.
-              SEE_MASK_FLAG_NO_UI     |  // Do not display an error message box.
-              SEE_MASK_NOZONECHECKS   |  // Do not perform a zone check.
-              SEE_MASK_NOASYNC;          // Wait to complete before returning.
-  sei.lpVerb = _T("open");
-  sei.lpFile = file_name_to_execute;
-  sei.lpParameters = command_line_parameters;
-  sei.nShow = SW_SHOWNORMAL;
-  sei.hwnd = hwnd;
-
-  // Use ShellExecuteExEnsureParent to ensure that we always have a parent
-  // window. We need to use the HWND property to be acknowledged as a foreground
-  // application on Windows Vista. Otherwise, the elevation prompt will appear
-  // minimized on the taskbar.
-  if (!ShellExecuteExEnsureParent(&sei)) {
-    HRESULT hr(HRESULTFromLastError());
-    OPT_LOG(LEVEL_ERROR, (_T("[Failed to ::ShellExecuteEx][%s][%s][0x%08x]"),
-                          file_name_to_execute, command_line_parameters, hr));
-    return hr;
-  }
-
-  if (process_handle) {
-    *process_handle = sei.hProcess;
-  } else {
-    ::CloseHandle(sei.hProcess);
-  }
-
-  return S_OK;
-}
-
-// start another process painlessly via ::ShellExecuteEx. Use this method
-// instead of the StartProcessXXX methods that use ::CreateProcess where
-// possible, since ::ShellExecuteEx has better behavior on Windows Vista.
-HRESULT System::ShellExecuteCommandLine(const TCHAR* command_line_to_execute,
-                                        HWND hwnd,
-                                        HANDLE* process_handle) {
-  ASSERT1(command_line_to_execute);
-
-  CString exe;
-  CString args;
-
-  HRESULT hr = CommandParsingSimple::SplitExeAndArgs(command_line_to_execute,
-                                                     &exe,
-                                                     &args);
-
-  if (SUCCEEDED(hr)) {
-    hr = System::ShellExecuteProcess(exe, args, hwnd, process_handle);
-    if (FAILED(hr)) {
-      UTIL_LOG(LEVEL_ERROR, (_T("[System::ShellExecuteProcess failed]")
-                             _T("[%s][%s][0x%08x]"), exe, args, hr));
-    }
-  }
-
-  return hr;
-}
-
-// returns the number of ms the system has had no user input
-int System::GetUserIdleTime() {
-  LASTINPUTINFO last_input_info;
-  last_input_info.cbSize = sizeof(LASTINPUTINFO);
-  // get time in windows ticks since system start of last activity
-  BOOL b = GetLastInputInfo(&last_input_info);
-  if (b == TRUE) {
-    return (GetTickCount()-last_input_info.dwTime);  // compute idle time
-  }
-  return 0;
-}
-
-bool System::IsUserIdle() {
-  // Only notify when the user has been idle less than this time
-  static int user_idle_threshold_ms = kUserIdleThresholdMs;
-
-  bool is_user_idle = (GetUserIdleTime() > user_idle_threshold_ms);
-  UTIL_LOG(L2, (_T("System::IsUserIdle() %s; user_idle_threshold_ms = %d"),
-                is_user_idle ? _T("TRUE") : _T("FALSE"),
-                user_idle_threshold_ms));
-  return is_user_idle;
-}
-
-bool System::IsUserBusy() {
-  // The user is busy typing or interacting with another application
-  // if the user is below the minimum threshold:
-  static int user_idle_min_threshold_ms = kUserIdleMinThresholdMs;
-  // The user is probably not paying attention
-  // if the user is above the maximum threshold:
-  static int user_idle_max_threshold_ms = kUserIdleMaxThresholdMs;
-
-  int user_idle_time = GetUserIdleTime();
-  bool is_user_busy = user_idle_time < user_idle_min_threshold_ms ||
-    user_idle_time > user_idle_max_threshold_ms;
-  UTIL_LOG(L2, (_T("[System::IsUserBusy() %s][user_idle_time = %d]")
-                _T("[user_idle_min_threshold_ms = %d]")
-                _T("[user_idle_max_threshold_ms = %d]"),
-                is_user_busy? _T("TRUE") : _T("FALSE"),
-                user_idle_time,
-                user_idle_min_threshold_ms,
-                user_idle_max_threshold_ms));
-  return is_user_busy;
-}
-
-bool System::IsScreensaverRunning() {
-  // NT 4.0 and below require testing OpenDesktop("screen-saver")
-  // We require W2K or better so we have an easier way
-  DWORD result = 0;
-  ::SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, &result, 0);
-  bool is_screensaver_running = (result != FALSE);
-  UTIL_LOG(L2, (_T("System::IsScreensaverRunning() %s"),
-                is_screensaver_running? _T("TRUE") : _T("FALSE")));
-  return is_screensaver_running;
-}
-
-bool System::IsWorkstationLocked() {
-  bool is_workstation_locked = true;
-  HDESK inputdesk = ::OpenInputDesktop(0, 0, GENERIC_READ);
-  if (NULL != inputdesk)  {
-    TCHAR name[256];
-    DWORD needed = arraysize(name);
-    BOOL ok = ::GetUserObjectInformation(inputdesk,
-                                         UOI_NAME,
-                                         name,
-                                         sizeof(name),
-                                         &needed);
-    ::CloseDesktop(inputdesk);
-    if (ok) {
-      is_workstation_locked = (0 != lstrcmpi(name, NOTRANSL(_T("default"))));
-    }
-  }
-
-  UTIL_LOG(L2, (_T("System::IsWorkstationLocked() %s"),
-                is_workstation_locked? _T("TRUE") : _T("FALSE")));
-  return is_workstation_locked;
-}
-
-bool System::IsUserAway() {
-  return IsScreensaverRunning() || IsWorkstationLocked();
-}
-
-uint32 System::GetProcessHandleCount() {
-  typedef LONG (CALLBACK *Fun)(HANDLE, int32, PVOID, ULONG, PULONG);
-
-  // This new version of getting the number of open handles works on win2k.
-  HMODULE h = GetModuleHandle(_T("ntdll.dll"));
-  Fun NtQueryInformationProcess =
-      reinterpret_cast<Fun>(::GetProcAddress(h, "NtQueryInformationProcess"));
-
-  if (!NtQueryInformationProcess) {
-    UTIL_LOG(LEVEL_ERROR, (_T("[NtQueryInformationProcess failed][0x%x]"),
-                           HRESULTFromLastError()));
-    return 0;
-  }
-
-  DWORD count = 0;
-  VERIFY(NtQueryInformationProcess(GetCurrentProcess(),
-                                   kProcessHandleCount,
-                                   &count,
-                                   sizeof(count),
-                                   NULL) >= 0, (L""));
-
-  return count;
-}
-
-uint32 System::GetProcessHandleCountOld() {
-  typedef BOOL (CALLBACK * Fun)(HANDLE, PDWORD);
-
-  // GetProcessHandleCount not available on win2k
-  HMODULE handle = GetModuleHandle(_T("kernel32"));
-  Fun f = reinterpret_cast<Fun>(GetProcAddress(handle,
-                                               "GetProcessHandleCount"));
-
-  if (!f) return 0;
-
-  DWORD count = 0;
-  VERIFY((*f)(GetCurrentProcess(), &count), (L""));
-  return count;
-
-  //  DWORD GetGuiResources (HANDLE hProcess, DWORD uiFlags);
-  //  Parameters, hProcess
-  //  [in] Handle to the process. The handle must have the
-  //  PROCESS_QUERY_INFORMATION access right. For more information, see Process
-  //  Security and Access Rights.
-  //  uiFlags
-  //  [in] GUI object type. This parameter can be one of the following values.
-  //  Value          Meaning
-  //  GR_GDIOBJECTS  Return the count of GDI objects.
-  //  GR_USEROBJECTS Return the count of USER objects.
-}
-
-void System::GetGuiObjectCount(uint32 *gdi, uint32 *user) {
-  if (gdi) {
-    *gdi = GetGuiResources(GetCurrentProcess(), GR_GDIOBJECTS);
-  }
-  if (user) {
-    *user = GetGuiResources(GetCurrentProcess(), GR_USEROBJECTS);
-  }
-}
-
-HRESULT System::GetRebootCheckDummyFileName(const TCHAR* base_file,
-                                            CString* dummy_file) {
-  ASSERT1(dummy_file);
-
-  if (base_file && *base_file) {
-    ASSERT1(File::Exists(base_file));
-    dummy_file->SetString(base_file);
-  } else {
-    RET_IF_FAILED(GetModuleFileName(NULL, dummy_file));
-  }
-  dummy_file->Append(_T(".needreboot"));
-  return S_OK;
-}
-
-// Is the system being rebooted?
-bool System::IsRebooted(const TCHAR* base_file) {
-  CString dummy_file;
-  if (SUCCEEDED(GetRebootCheckDummyFileName(base_file, &dummy_file))) {
-    if (File::Exists(dummy_file)) {
-      // If the file exists but it is not found in the
-      // PendingFileRenameOperations, (probably becaused that this key is messed
-      // up and thus the system restart fails to delete the file), re-add it
-      if (!File::AreMovesPendingReboot(dummy_file, true)) {
-        File::MoveAfterReboot(dummy_file, NULL);
-      }
-      return false;
-    } else {
-      return true;
-    }
-  }
-  return false;
-}
-
-// Mark the system as reboot required
-HRESULT System::MarkAsRebootRequired(const TCHAR* base_file) {
-  // Create a dummy file if needed
-  CString dummy_file;
-  RET_IF_FAILED(GetRebootCheckDummyFileName(base_file, &dummy_file));
-  if (File::Exists(dummy_file)) {
-    return S_OK;
-  }
-
-  File file;
-  RET_IF_FAILED(file.Open(dummy_file, true, false));
-  RET_IF_FAILED(file.Close());
-
-  // Hide it
-  DWORD file_attr = ::GetFileAttributes(dummy_file);
-  if (file_attr == INVALID_FILE_ATTRIBUTES ||
-      !::SetFileAttributes(dummy_file, file_attr | FILE_ATTRIBUTE_HIDDEN)) {
-    return HRESULTFromLastError();
-  }
-
-  // Mark it as being deleted after reboot
-  return File::MoveAfterReboot(dummy_file, NULL);
-}
-
-// Unmark the system as reboot required
-HRESULT System::UnmarkAsRebootRequired(const TCHAR* base_file) {
-  CString dummy_file;
-  RET_IF_FAILED(GetRebootCheckDummyFileName(base_file, &dummy_file));
-
-  return File::RemoveFromMovesPendingReboot(dummy_file, false);
-}
-
-// Restart the computer
-HRESULT System::RestartComputer() {
-  RET_IF_FAILED(AdjustPrivilege(SE_SHUTDOWN_NAME, true));
-
-  if (!::ExitWindowsEx(EWX_REBOOT, SHTDN_REASON_MAJOR_APPLICATION |
-                       SHTDN_REASON_MINOR_INSTALLATION |
-                       SHTDN_REASON_FLAG_PLANNED)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[System::RestartComputer - failed to")
-                           _T(" ExitWindowsEx][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// The implementation works on all Windows versions. On NT and XP the screen
-// saver is actually stored in registry at
-// HKEY_CURRENT_USER\Control Panel\Desktop\SCRNSAVE.EXE but the
-// GetPrivateProfileString call is automatically mapped to the registry
-HRESULT System::GetCurrentScreenSaver(CString* fileName) {
-  if (!fileName) return E_POINTER;
-
-  DWORD nChars = ::GetPrivateProfileString(_T("boot"),
-                                           _T("SCRNSAVE.EXE"),
-                                           _T(""),
-                                           fileName->GetBuffer(MAX_PATH),
-                                           MAX_PATH,
-                                           _T("system.ini"));
-  fileName->ReleaseBufferSetLength(nChars);
-
-  return S_OK;
-}
-
-HRESULT System::CoCreateInstanceAsAdmin(HWND hwnd,
-                                        REFCLSID rclsid,
-                                        REFIID riid,
-                                        void** ppv) {
-  UTIL_LOG(L6, (_T("[CoCreateInstanceAsAdmin][%d][%s][%s]"),
-                hwnd, GuidToString(rclsid), GuidToString(riid)));
-
-  if (vista_util::IsUserAdmin()) {
-    return ::CoCreateInstance(rclsid, NULL, CLSCTX_LOCAL_SERVER, riid, ppv);
-  }
-
-  if (!SystemInfo::IsRunningOnVistaOrLater()) {
-    return E_ACCESSDENIED;
-  }
-
-  CString moniker_name(_T("Elevation:Administrator!new:"));
-  moniker_name += GuidToString(rclsid);
-  BIND_OPTS3 bo;
-  SetZero(bo);
-  bo.cbStruct = sizeof(bo);
-  bo.hwnd = hwnd;
-  bo.dwClassContext = CLSCTX_LOCAL_SERVER;
-
-  return ::CoGetObject(moniker_name, &bo, riid, ppv);
-}
-
-HRESULT System::IsPrivilegeEnabled(const TCHAR* privilege, bool* present) {
-  ASSERT1(privilege);
-  ASSERT1(present);
-
-  *present = false;
-
-  scoped_handle token;
-  if (!::OpenProcessToken(::GetCurrentProcess(),
-                          TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
-                          address(token))) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[System::IsPrivilegeEnabled - failed to ")
-                           _T("OpenProcessToken][0x%x]"), hr));
-    return hr;
-  }
-
-  LUID luid = {0};
-  if (!::LookupPrivilegeValue(NULL, privilege, &luid)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[System::IsPrivilegeEnabled - failed to")
-                           _T("LookupPrivilegeValue][0x%x]"), hr));
-    return hr;
-  }
-
-  PRIVILEGE_SET required_privilege = {0};
-  required_privilege.PrivilegeCount = 1;
-  required_privilege.Control = PRIVILEGE_SET_ALL_NECESSARY;
-  required_privilege.Privilege[0].Luid = luid;
-
-  BOOL result = FALSE;
-  if (!::PrivilegeCheck(get(token), &required_privilege, &result)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[System::IsPrivilegeEnabled - failed to")
-                           _T("PrivilegeCheck][0x%x]"), hr));
-    return hr;
-  }
-
-  if (required_privilege.Privilege[0].Attributes &
-      SE_PRIVILEGE_USED_FOR_ACCESS) {
-    *present = true;
-  }
-
-  return S_OK;
-}
-
-// Attempts to adjust current process privileges.
-// Only process running with administrator privileges will succeed.
-HRESULT System::AdjustPrivilege(const TCHAR* privilege, bool enable) {
-  ASSERT1(privilege);
-
-  scoped_handle token;
-  if (!::OpenProcessToken(::GetCurrentProcess(),
-                          TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
-                          address(token))) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[System::AdjustPrivilege - failed to ")
-                           _T("OpenProcessToken][0x%x]"), hr));
-    return hr;
-  }
-
-  LUID luid = {0};
-  if (!::LookupPrivilegeValue(NULL, privilege, &luid)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[System::AdjustPrivilege - failed to")
-                           _T("LookupPrivilegeValue][0x%x]"), hr));
-    return hr;
-  }
-
-  TOKEN_PRIVILEGES privs;
-  privs.PrivilegeCount = 1;
-  privs.Privileges[0].Luid = luid;
-  privs.Privileges[0].Attributes = enable ? SE_PRIVILEGE_ENABLED : 0;
-
-  if (!::AdjustTokenPrivileges(get(token), FALSE, &privs, 0, NULL, 0)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[System::AdjustPrivilege - failed to ")
-                           _T("AdjustTokenPrivileges][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-DWORD System::WTSGetActiveConsoleSessionId()  {
-  typedef DWORD (* Fun)();
-
-  HINSTANCE hInst = ::GetModuleHandle(_T("kernel32.dll"));
-  ASSERT1(hInst);
-  Fun pfn = reinterpret_cast<Fun>(::GetProcAddress(
-                                      hInst,
-                                      "WTSGetActiveConsoleSessionId"));
-  return !pfn ? kInvalidSessionId : (*pfn)();
-}
-
-// Get the session the current process is running under
-DWORD System::GetCurrentSessionId() {
-  DWORD session_id = kInvalidSessionId;
-  DWORD* session_id_ptr = NULL;
-  DWORD bytes_returned = 0;
-
-  if (::WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE,
-                                   WTS_CURRENT_SESSION,
-                                   WTSSessionId,
-                                   reinterpret_cast<LPTSTR*>(&session_id_ptr),
-                                   &bytes_returned)) {
-    ASSERT1(bytes_returned == sizeof(*session_id_ptr));
-    session_id = *session_id_ptr;
-    ::WTSFreeMemory(session_id_ptr);
-    UTIL_LOG(L6, (_T("[System::GetCurrentSessionId]")
-                  _T("[session_id from ::WTSQuerySessionInformation][%d]"),
-                  session_id));
-    return session_id;
-  }
-
-  // ::WTSQuerySessionInformation can fail if we are not running
-  // in a Terminal Services scenario, in which case, we use
-  // ::ProcessIdToSessionId()
-  if (::ProcessIdToSessionId(::GetCurrentProcessId(), &session_id)) {
-    UTIL_LOG(L6,  (_T("[System::GetCurrentSessionId]")
-                   _T("[session_id from ::ProcessIdToSessionId][%d]"),
-                   session_id));
-    return session_id;
-  }
-
-  UTIL_LOG(LEVEL_ERROR,
-           (_T("[System::GetCurrentSessionId - both")
-            _T("::WTSQuerySessionInformation and ")
-            _T("::ProcessIdToSessionId failed][0x%x]"),
-            ::GetLastError()));
-
-  return kInvalidSessionId;
-}
-
-// Get the best guess as to the currently active session, or kInvalidSessionId
-// if there is no active session.
-DWORD System::GetActiveSessionId() {
-  // WTSGetActiveConsoleSessionId retrieves the Terminal Services session
-  // currently attached to the physical console.
-  DWORD active_session_id = WTSGetActiveConsoleSessionId();
-
-  if (IsSessionActive(active_session_id)) {
-    UTIL_LOG(L6, (_T("[System::GetActiveSessionId]")
-                  _T("[Active session id from ::WTSGetActiveConsoleSessionId]")
-                  _T("[%d]"), active_session_id));
-
-    return active_session_id;
-  }
-
-  // WTSGetActiveConsoleSessionId works for FUS, but it does not work for TS
-  // servers where the current active session is always the console. We then use
-  // a different method as below. We get all the sessions that are present on
-  // the system, to see if we can find an active session.
-  active_session_id = kInvalidSessionId;
-  WTS_SESSION_INFO* session_info = NULL;
-  DWORD num_sessions = 0;
-  if (::WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE, 0, 1,
-                              &session_info, &num_sessions)) {
-    // Pick the first active session we can find
-    for (DWORD i = 0 ; i < num_sessions; ++i) {
-      if (session_info[i].State == WTSActive) {
-        // There is a user logged on to the WinStation associated with the
-        // session.
-        active_session_id = session_info[i].SessionId;
-        break;
-      }
-    }
-
-    ::WTSFreeMemory(session_info);
-    UTIL_LOG(L6, (_T("[System::GetActiveSessionId]")
-                  _T("[Active session id from ::WTSEnumerateSessions][0x%x]"),
-                  active_session_id));
-
-    return active_session_id;
-  }
-
-  UTIL_LOG(LEVEL_ERROR,
-           (_T("[System::GetActiveSessionId - ")
-           _T("Both ::WTSGetActiveConsoleSessionId and ::WTSEnumerateSessions ")
-           _T("failed][0x%x]"),
-           ::GetLastError()));
-
-  return kInvalidSessionId;
-}
-
-// Is there a user logged on and active in the specified session?
-bool System::IsSessionActive(DWORD session_id) {
-  if (kInvalidSessionId == session_id) {
-    return false;
-  }
-
-  WTS_CONNECTSTATE_CLASS wts_connect_state = WTSDisconnected;
-  WTS_CONNECTSTATE_CLASS* ptr_wts_connect_state = NULL;
-  DWORD bytes_returned = 0;
-  if (::WTSQuerySessionInformation(
-          WTS_CURRENT_SERVER_HANDLE,
-          session_id,
-          WTSConnectState,
-          reinterpret_cast<LPTSTR*>(&ptr_wts_connect_state),
-          &bytes_returned)) {
-    ASSERT1(bytes_returned == sizeof(*ptr_wts_connect_state));
-    wts_connect_state = *ptr_wts_connect_state;
-    ::WTSFreeMemory(ptr_wts_connect_state);
-
-    UTIL_LOG(L6, (_T("[System::IsSessionActive]")
-                  _T("[wts_connect_state %d]"), wts_connect_state));
-    return WTSActive == wts_connect_state;
-  }
-
-  UTIL_LOG(LE, (_T("[WTSQuerySessionInformation failed][0x%x]"),
-                ::GetLastError()));
-  return false;
-}
-
-// Is the current process running under WinSta0
-bool System::IsCurrentProcessInteractive() {
-  // Use a non-scoped handle, since a handle retrieved via
-  // ::GetProcessWindowStation() should not be closed.
-  HWINSTA handle_window_station(::GetProcessWindowStation());
-  DWORD len = 0;
-  CString str_window_station;
-
-  if (!handle_window_station || handle_window_station == INVALID_HANDLE_VALUE) {
-    UTIL_LOG(LEVEL_ERROR,
-             (_T("[System::IsCurrentProcessInteractive - ")
-              _T("::GetProcessWindowStation() failed (%d)]"),
-              ::GetLastError()));
-    return false;
-  }
-
-  if (!::GetUserObjectInformation(handle_window_station,
-                                  UOI_NAME,
-                                  CStrBuf(str_window_station, MAX_PATH),
-                                  MAX_PATH,
-                                  &len)) {
-    UTIL_LOG(LEVEL_ERROR,
-             (_T("[System::IsCurrentProcessInteractive - ")
-              _T("::GetUserObjectInfoformation(hWinSta) failed (%d)]"),
-              ::GetLastError()));
-    return false;
-  }
-
-  UTIL_LOG(L6, (_T("[System::IsCurrentProcessInteractive]")
-                _T("[WindowStation name][%s]"),
-                str_window_station));
-  return (str_window_station == _T("WinSta0"));
-}
-
-// is the current process running under WinSta0 for the currently active session
-bool System::IsCurrentProcessActiveAndInteractive() {
-  return IsSessionActive(GetCurrentSessionId()) &&
-         IsCurrentProcessInteractive();
-}
-
-bool System::IsRunningOnBatteries() {
-  SYSTEM_POWER_STATUS system_power_status = {0};
-  if (::GetSystemPowerStatus(&system_power_status)) {
-    bool has_battery = !(system_power_status.BatteryFlag & 128);
-    bool ac_status_offline = system_power_status.ACLineStatus == 0;
-    return ac_status_offline && has_battery;
-  }
-  return false;
-}
-
-}  // namespace omaha
-
diff --git a/base/system.h b/base/system.h
deleted file mode 100644
index 9285b6c..0000000
--- a/base/system.h
+++ /dev/null
@@ -1,231 +0,0 @@
-// Copyright 2004-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// system functions for checking disk space / memory usage / etc.
-
-#ifndef OMAHA_BASE_SYSTEM_H_
-#define OMAHA_BASE_SYSTEM_H_
-
-#include <atlstr.h>
-#include <base/basictypes.h>
-
-namespace omaha {
-
-#define kMaxRegistryBackupWaitMs 3000
-#define kMaxRegistryRestoreWaitMs 30000
-
-// amount of time the user must have no input before we declare them idle
-// used by outlook addin, outlook_cap, and filecap.
-#define kUserIdleThresholdMs 30000
-
-// The user is busy typing or interacting with another application
-// if the user is below the minimum threshold.
-#define kUserIdleMinThresholdMs 30000
-
-// The user is probably not paying attention
-// if the user is above the maximum threshold.
-#define kUserIdleMaxThresholdMs 600000
-
-const DWORD kInvalidSessionId = 0xFFFFFFFF;
-
-class System {
-  public:
-
-    // disk activity.
-
-    // waits up to specified time for disk activity to occur; sleeps in
-    // increments of sleep_time.
-    static HRESULT WaitForDiskActivity(uint32 max_delay_milliseconds,
-                                       uint32 sleep_time_ms,
-                                       uint32 *time_waited);
-    // disk activity counters; may require admin on some machines? should return
-    // E_FAIL if so.
-    static HRESULT GetDiskActivityCounters(uint64 *reads,
-                                           uint64 *writes,
-                                           uint64 *bytes_read,
-                                           uint64 *bytes_written);
-
-    // disk statistics.
-
-    // disk total and free space.
-    // Path is either the root of a drive or an existing folder on a drive; the
-    // statistics are for that drive.
-    static HRESULT GetDiskStatistics(const TCHAR* path,
-                                     uint64 *free_bytes_current_user,
-                                     uint64 *total_bytes_current_user,
-                                     uint64 *free_bytes_all_users);
-
-    enum Priority {
-        LOW,
-        HIGH,
-        NORMAL,
-        IDLE
-    };
-
-    // functions to alter process/thread priority.
-    static HRESULT SetThreadPriority(enum Priority priority);
-    static HRESULT SetProcessPriority(enum Priority priority);
-
-    // The three functions below start background processes via ::CreateProcess.
-    // Use the ShellExecuteProcessXXX functions when starting foreground
-    // processes.
-    static HRESULT StartProcessWithArgs(const TCHAR *process_name,
-                                        const TCHAR *cmd_line_arguments);
-    static HRESULT StartProcessWithArgsAndInfo(const TCHAR *process_name,
-                                               const TCHAR *cmd_line_arguments,
-                                               PROCESS_INFORMATION *pi);
-    static HRESULT StartCommandLine(const TCHAR* command_line_to_execute);
-    static HRESULT StartProcess(const TCHAR *process_name,
-                                TCHAR *command_line,
-                                PROCESS_INFORMATION *pi);
-
-    // Start the process with the provided token, in the specified desktop of
-    // the token's session. The caller needs to be SYSTEM.
-    static HRESULT StartProcessAsUser(HANDLE user_token,
-                                      const CString& executable_path,
-                                      const CString& parameters,
-                                      LPWSTR desktop,
-                                      PROCESS_INFORMATION* pi);
-
-    // start another process painlessly via ::ShellExecuteEx. Use this method
-    // instead of the StartProcessXXX methods that use ::CreateProcess where
-    // possible, since ::ShellExecuteEx has better behavior on Vista.
-    static HRESULT ShellExecuteProcess(const TCHAR* file_name_to_execute,
-                                       const TCHAR* command_line_parameters,
-                                       HWND hwnd,
-                                       HANDLE* process_handle);
-
-    // start another process painlessly via ::ShellExecuteEx. Use this method
-    // instead of the StartProcessXXX methods that use ::CreateProcess where
-    // possible, since ::ShellExecuteEx has better behavior on Vista.
-    static HRESULT ShellExecuteCommandLine(const TCHAR* command_line_to_execute,
-                                           HWND hwnd,
-                                           HANDLE* process_handle);
-
-    // memory statistics.
-
-    // max amount of memory that can be allocated without paging.
-    static HRESULT MaxPhysicalMemoryAvailable(uint64 *max_bytes);
-
-    // global memory stats
-    static HRESULT GetGlobalMemoryStatistics(
-                       uint32 *memory_load_percentage,
-                       uint64 *free_physical_memory,
-                       uint64 *total_physical_memory,
-                       uint64 *free_paged_memory,
-                       uint64 *total_paged_memory,
-                       uint64 *process_free_virtual_memory,
-                       uint64 *process_total_virtual_memory);
-
-    // process memory stats
-    static HRESULT GetProcessMemoryStatistics(uint64 *current_working_set,
-                                              uint64 *peak_working_set,
-                                              uint64 *min_working_set_size,
-                                              uint64 *max_working_set_size);
-
-    // TODO(omaha): determine if using this where we do with machines
-    // with slow disks causes noticeable slowdown
-
-    // reduce process working set - beware of possible negative performance
-    // implications - this function frees (to the page cache) all used pages,
-    // minimizing the working set - but could lead to additional page faults
-    // when the process continues. If the process continues soon enough the
-    // pages will still be in the page cache so they'll be relatively cheap
-    // soft page faults. This function is best used to reduce memory footprint
-    // when a component is about to go idle for "awhile".
-    static void FreeProcessWorkingSet();
-
-    // returns the number of ms the system has had no user input.
-    static int GetUserIdleTime();
-
-    // from ntddk.h, used as a parameter to get the process handle count.
-    static const int kProcessHandleCount = 20;
-    static uint32 GetProcessHandleCount();
-    static uint32 GetProcessHandleCountOld();
-
-    static void GetGuiObjectCount(uint32 *gdi, uint32 *user);
-
-    static bool IsUserIdle();
-    static bool IsUserBusy();
-    static bool IsScreensaverRunning();
-    static bool IsWorkstationLocked();
-    static bool IsUserAway();
-
-    // Is the system requiring reboot.
-    static bool IsRebooted(const TCHAR* base_file);
-
-    // Mark the system as reboot required.
-    static HRESULT MarkAsRebootRequired(const TCHAR* base_file);
-
-    // Unmark the system as reboot required.
-    static HRESULT UnmarkAsRebootRequired(const TCHAR* base_file);
-
-    // Restart the computer.
-    static HRESULT RestartComputer();
-
-    // Get the full path name of the screen saver program currently selected.
-    // If no screen saver is selected then "fileName" is empty.
-    static HRESULT GetCurrentScreenSaver(CString* fileName);
-
-    // Create an instance of a COM Local Server class using either plain vanilla
-    // CoCreateInstance, or using the Elevation moniker if Vista or later and
-    // the user is not an elevated admin.
-    static HRESULT CoCreateInstanceAsAdmin(HWND hwnd,
-                                           REFCLSID rclsid,
-                                           REFIID riid,
-                                           void** ppv);
-
-    // Attempts to adjust current process privileges.
-    // Only process running with administrator privileges will succeed.
-    static HRESULT AdjustPrivilege(const TCHAR* privilege, bool enable);
-
-    // Checks if the given privilege is enabled for the current process.
-    static HRESULT IsPrivilegeEnabled(const TCHAR* privilege, bool* present);
-
-    // Dynamically links and calls ::WTSGetActiveConsoleSessionId(). Returns
-    // kInvalidSessionId if it cannot find the export in kernel32.dll.
-    static DWORD WTSGetActiveConsoleSessionId();
-
-    // Get the session the current process is running under.
-    static DWORD GetCurrentSessionId();
-
-    // Get the best guess as to the currently active session,
-    // or kInvalidSessionId if there is no active session.
-    static DWORD GetActiveSessionId();
-
-    // Is there a user logged on and active in the specified session?
-    static bool IsSessionActive(DWORD session_id);
-
-    // Is the current process running under WinSta0.
-    static bool IsCurrentProcessInteractive();
-
-    // is the current process running under WinSta0 for the currently active
-    // session.
-    static bool IsCurrentProcessActiveAndInteractive();
-
-    // Returns true if a system battery is detected and the AC line
-    // status is 'offline', otherwise it returns false.
-    static bool IsRunningOnBatteries();
-
-  private:
-    static HRESULT GetRebootCheckDummyFileName(const TCHAR* base_file,
-                                               CString* dummy_file);
-    DISALLOW_EVIL_CONSTRUCTORS(System);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_SYSTEM_H_
-
diff --git a/base/system_info.cc b/base/system_info.cc
deleted file mode 100644
index 3df007e..0000000
--- a/base/system_info.cc
+++ /dev/null
@@ -1,467 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/system_info.h"
-#include "base/basictypes.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/process.h"
-#include "omaha/base/string.h"
-
-namespace omaha {
-
-bool SystemInfo::OSWinXPSP2OrLater() {
-  OSVersionType os_type(OS_WINDOWS_UNKNOWN);
-  DWORD sp(0);
-
-  HRESULT hr = CategorizeOS(&os_type, &sp);
-  if (FAILED(hr)) {
-    ASSERT(false, (_T("[CategorizeOS failed][0x%x]"), hr));
-    return false;
-  }
-
-  return ((os_type == SystemInfo::OS_WINDOWS_XP && sp >= 2) ||
-          os_type > SystemInfo::OS_WINDOWS_XP);
-}
-
-bool SystemInfo::IsRunningOnW2K() {
-  OSVERSIONINFO os_info = {0};
-  os_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-
-  if (!::GetVersionEx(&os_info)) {
-    ASSERT(false, (_T("GetVersionEx")));
-    return false;
-  }
-
-  return os_info.dwMajorVersion == 5 && os_info.dwMinorVersion == 0;
-}
-
-bool SystemInfo::IsRunningOnXPOrLater() {
-  OSVersionType os_type(OS_WINDOWS_UNKNOWN);
-
-  HRESULT hr = CategorizeOS(&os_type, NULL);
-  if (FAILED(hr)) {
-    ASSERT(false, (_T("[Failed to get os type][0x%x]"), hr));
-    return false;
-  }
-
-  return os_type >= SystemInfo::OS_WINDOWS_XP;
-}
-
-bool SystemInfo::IsRunningOnXPSP1OrLater() {
-  OSVersionType os_type(OS_WINDOWS_UNKNOWN);
-  DWORD sp(0);
-
-  HRESULT hr = CategorizeOS(&os_type, &sp);
-  if (FAILED(hr)) {
-    ASSERT(false, (_T("[Failed to get os type][0x%x]"), hr));
-    return false;
-  }
-
-  return ((os_type == SystemInfo::OS_WINDOWS_XP && sp >= 1) ||
-          os_type > SystemInfo::OS_WINDOWS_XP);
-}
-
-
-bool SystemInfo::IsRunningOnVistaOrLater() {
-  OSVersionType os_type(OS_WINDOWS_UNKNOWN);
-  DWORD sp(0);
-
-  HRESULT hr = CategorizeOS(&os_type, &sp);
-  if (FAILED(hr)) {
-    ASSERT(false, (_T("[Failed to get os type][0x%x]"), hr));
-    return false;
-  }
-
-  return (os_type >= OS_WINDOWS_VISTA);
-}
-
-bool SystemInfo::IsRunningOnVistaRTM() {
-  OSVersionType os_type(OS_WINDOWS_UNKNOWN);
-  DWORD sp(0);
-
-  HRESULT hr = CategorizeOS(&os_type, &sp);
-  if (FAILED(hr)) {
-    ASSERT(false, (_T("[Failed to get os type][0x%x]"), hr));
-    return false;
-  }
-
-  return (os_type == SystemInfo::OS_WINDOWS_VISTA && sp == 0);
-}
-
-HRESULT SystemInfo::CategorizeOS(OSVersionType* os_ver, DWORD* sp) {
-  static OSVersionType os_ver_cached(OS_WINDOWS_UNKNOWN);
-  // Hopefully, Windows doesn't release a SP that's kuint32max.
-  static DWORD sp_cached(kuint32max);
-
-  ASSERT(os_ver, (_T("")));
-
-  if (sp) {
-    *sp = 0;
-  }
-
-  if (os_ver_cached == OS_WINDOWS_UNKNOWN || sp_cached == kuint32max) {
-    // Use GetVersionEx to get OS and Service Pack information.
-    OSVERSIONINFOEX osviex;
-    ::ZeroMemory(&osviex, sizeof(OSVERSIONINFOEX));
-    osviex.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
-    BOOL r = ::GetVersionEx(reinterpret_cast<OSVERSIONINFO *>(&osviex));
-
-    // If ::GetVersionEx fails when given an OSVERSIONINFOEX then we're running
-    // on NT4.0SP5 or earlier.
-    if (!r) {
-      os_ver_cached = OS_WINDOWS_9X_OR_NT;
-    } else {
-      switch (osviex.dwPlatformId) {
-        case VER_PLATFORM_WIN32_NT:
-          // Windows 7 beta 1 reports the same major version as Vista does.
-          if (osviex.dwMajorVersion == 6 && osviex.dwMinorVersion == 1) {
-            os_ver_cached = OS_WINDOWS_7;
-          } else if (osviex.dwMajorVersion == 6 && osviex.dwMinorVersion == 0) {
-            os_ver_cached = OS_WINDOWS_VISTA;
-          } else if (osviex.dwMajorVersion == 5 && osviex.dwMinorVersion == 2) {
-            os_ver_cached = OS_WINDOWS_SERVER_2003;
-          } else if (osviex.dwMajorVersion == 5 && osviex.dwMinorVersion == 1) {
-            os_ver_cached = OS_WINDOWS_XP;
-          } else if (osviex.dwMajorVersion == 5 && osviex.dwMinorVersion == 0) {
-            os_ver_cached = OS_WINDOWS_2000;
-          } else if (osviex.dwMajorVersion <= 4) {
-            os_ver_cached = OS_WINDOWS_9X_OR_NT;
-            break;
-          } else {
-            os_ver_cached = OS_WINDOWS_UNKNOWN;
-            break;
-          }
-          sp_cached = osviex.wServicePackMajor;
-          break;
-
-        case VER_PLATFORM_WIN32_WINDOWS:
-        case VER_PLATFORM_WIN32s:
-        default:
-          os_ver_cached = OS_WINDOWS_9X_OR_NT;
-          break;
-      }
-    }
-
-    OPT_LOG(L1, (_T("[OS][version: %s][service pack: %d]"),
-                 OSVersionTypeAsString(os_ver_cached),
-                 sp_cached));
-  }
-
-  ASSERT1(os_ver_cached != OS_WINDOWS_UNKNOWN && sp_cached != kuint32max);
-
-  *os_ver = os_ver_cached;
-  if (sp) {
-    *sp = sp_cached;
-  }
-
-  return S_OK;
-}
-
-const wchar_t* SystemInfo::OSVersionTypeAsString(OSVersionType t) {
-  switch (t) {
-    case OS_WINDOWS_9X_OR_NT:    return _T("OS_WINDOWS_9X_OR_NT");
-    case OS_WINDOWS_2000:        return _T("OS_WINDOWS_2000");
-    case OS_WINDOWS_XP:          return _T("OS_WINDOWS_XP");
-    case OS_WINDOWS_SERVER_2003: return _T("OS_WINDOWS_SERVER_2003");
-    case OS_WINDOWS_UNKNOWN:     return _T("OS_WINDOWS_UNKNOWN");
-    case OS_WINDOWS_VISTA:       return _T("OS_WINDOWS_VISTA");
-    case OS_WINDOWS_7:           return _T("OS_WINDOWS_7");
-    default:                     return _T("<unknown>");
-  }
-}
-
-// The following code which names the operating system comes from MSDN article
-// "Getting the System Version"
-#define kNullChar (_T('\0'))
-bool SystemInfo::GetSystemVersion(int* major_version,
-                                  int* minor_version,
-                                  int* service_pack_major,
-                                  int* service_pack_minor,
-                                  TCHAR*  name_buf,
-                                  size_t name_buf_len) {
-  ASSERT1(major_version);
-  ASSERT1(minor_version);
-  ASSERT1(service_pack_major);
-  ASSERT1(service_pack_minor);
-  ASSERT1(name_buf);
-  ASSERT1(0 < name_buf_len);
-
-  // Clear the name to start with.
-  name_buf[0] = kNullChar;
-
-  DWORD buf_len = MAX_PATH;
-  TCHAR buffer[MAX_PATH];
-  TCHAR format_buffer[64];
-
-  buffer[0] = kNullChar;
-
-  OSVERSIONINFOEX osvi;
-  BOOL ver_info_exists;
-
-  // Try calling GetVersionEx using the OSVERSIONINFOEX structure.
-  // If that fails, try using the OSVERSIONINFO structure.
-  ::ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
-  osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
-
-  ver_info_exists = ::GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&osvi));
-  if (!ver_info_exists) {
-    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-    if (!::GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&osvi))) {
-      return false;
-    }
-  }
-
-  *major_version      = osvi.dwMajorVersion;
-  *minor_version      = osvi.dwMinorVersion;
-  *service_pack_major = osvi.wServicePackMajor;
-  *service_pack_minor = osvi.wServicePackMinor;
-
-  switch (osvi.dwPlatformId) {
-    // Test for the Windows NT product family.
-    case VER_PLATFORM_WIN32_NT:
-
-      // Test for the specific product family.
-      if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) {
-        SafeStrCat(buffer,
-                   _T("Microsoft Windows Server 2003 family, "),
-                   buf_len);
-      }
-
-      if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1) {
-        SafeStrCat(buffer, _T("Microsoft Windows XP "), buf_len);
-      }
-
-      if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0) {
-        SafeStrCat(buffer, _T("Microsoft Windows 2000 "), buf_len);
-      }
-
-      if (osvi.dwMajorVersion <= 4) {
-        SafeStrCat(buffer, _T("Microsoft Windows NT "), buf_len);
-      }
-
-      // Test for specific product on Windows NT 4.0 SP6 and later.
-      if (ver_info_exists) {
-        // Test for the workstation type.
-        if (osvi.wProductType == VER_NT_WORKSTATION) {
-          if (osvi.dwMajorVersion == 4) {
-            SafeStrCat(buffer, _T("Workstation 4.0 "), buf_len);
-          } else if (osvi.wSuiteMask & VER_SUITE_PERSONAL) {
-            SafeStrCat(buffer, _T("Home Edition "), buf_len);
-          } else {
-            SafeStrCat(buffer, _T("Professional "), buf_len);
-          }
-        } else if (osvi.wProductType == VER_NT_SERVER ||
-                   osvi.wProductType == VER_NT_DOMAIN_CONTROLLER) {
-          // server type.
-          if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) {
-            if (osvi.wSuiteMask & VER_SUITE_DATACENTER) {
-              SafeStrCat(buffer, _T("Datacenter Edition "), buf_len);
-            } else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) {
-              SafeStrCat(buffer, _T("Enterprise Edition "), buf_len);
-            } else if (osvi.wSuiteMask == VER_SUITE_BLADE) {
-              SafeStrCat(buffer, _T("Web Edition "), buf_len);
-            } else {
-              SafeStrCat(buffer, _T("Standard Edition "), buf_len);
-            }
-          } else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0) {
-            if (osvi.wSuiteMask & VER_SUITE_DATACENTER) {
-              SafeStrCat(buffer, _T("Datacenter Server "), buf_len);
-            } else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) {
-              SafeStrCat(buffer, _T("Advanced Server "), buf_len);
-            } else {
-              SafeStrCat(buffer, _T("Server "), buf_len);
-            }
-          } else {
-            // Windows NT 4.0.
-            if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) {
-              SafeStrCat(buffer,
-                         _T("Server 4.0, Enterprise Edition "),
-                         buf_len);
-            } else {
-              SafeStrCat(buffer, _T("Server 4.0 "), buf_len);
-            }
-          }
-        }
-      } else {
-        // Test for specific product on Windows NT 4.0 SP5 and earlier.
-        HKEY hKey;
-        TCHAR product_type[64] = {0};
-        DWORD dwBufLen = arraysize(product_type);
-        LONG lRet;
-
-        // TODO(omaha): should we use the RegKey API for consistency.
-        lRet = ::RegOpenKeyEx(
-                   HKEY_LOCAL_MACHINE,
-                   _T("SYSTEM\\CurrentControlSet\\Control\\ProductOptions"),
-                   0,
-                   KEY_QUERY_VALUE,
-                   &hKey);
-        if (lRet != ERROR_SUCCESS) {
-          return false;
-        }
-
-        lRet = ::RegQueryValueEx(hKey,
-                                 _T("ProductType"),
-                                 NULL,
-                                 NULL,
-                                 reinterpret_cast<byte *>(product_type),
-                                 &dwBufLen);
-        if ((lRet != ERROR_SUCCESS) || (dwBufLen > arraysize(product_type))) {
-          return false;
-        }
-
-        ::RegCloseKey(hKey);
-
-        if (::lstrcmpi(_T("WINNT"), product_type) == 0) {
-          SafeStrCat(buffer, _T("Workstation "), buf_len);
-        }
-        if (::lstrcmpi(_T("LANMANNT"), product_type) == 0) {
-          SafeStrCat(buffer, _T("Server "), buf_len);
-        }
-        if (::lstrcmpi(_T("SERVERNT"), product_type) == 0) {
-          SafeStrCat(buffer, _T("Advanced Server "), buf_len);
-        }
-
-        ::wsprintf(format_buffer,
-                   _T("%d.%d "),
-                   osvi.dwMajorVersion,
-                   osvi.dwMinorVersion);
-        SafeStrCat(buffer, format_buffer, buf_len);
-      }
-
-      // Display service pack (if any) and build number.
-      if (osvi.dwMajorVersion == 4 &&
-          ::lstrcmpi(osvi.szCSDVersion, _T("Service Pack 6")) == 0) {
-        HKEY hKey;
-        LONG lRet;
-
-        // Test for SP6 versus SP6a.
-        lRet = ::RegOpenKeyEx(
-                   HKEY_LOCAL_MACHINE,
-                   _T("SOFTWARE\\Microsoft\\Windows NT\\")
-                       _T("CurrentVersion\\Hotfix\\Q246009"),
-                   0,
-                   KEY_QUERY_VALUE,
-                   &hKey);
-        if (lRet == ERROR_SUCCESS) {
-          ::wsprintf(format_buffer,
-                     _T("Service Pack 6a (Build %d)"),
-                     osvi.dwBuildNumber & 0xFFFF);
-          SafeStrCat(buffer, format_buffer, buf_len);
-        } else {
-          // Windows NT 4.0 prior to SP6a.
-          ::wsprintf(format_buffer, _T("%s (Build %d)"),
-                      osvi.szCSDVersion,
-                      osvi.dwBuildNumber & 0xFFFF);
-          SafeStrCat(buffer, format_buffer, buf_len);
-        }
-        ::RegCloseKey(hKey);
-      } else {
-        // Windows NT 3.51 and earlier or Windows 2000 and later.
-        ::wsprintf(format_buffer,
-                   _T("%s (Build %d)"),
-                   osvi.szCSDVersion,
-                   osvi.dwBuildNumber & 0xFFFF);
-        SafeStrCat(buffer, format_buffer, buf_len);
-      }
-
-      break;
-
-      // Test for the Windows 95 product family.
-    case VER_PLATFORM_WIN32_WINDOWS:
-
-      if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0) {
-        SafeStrCat(buffer, _T("Microsoft Windows 95 "), buf_len);
-        if (osvi.szCSDVersion[1] == 'C' || osvi.szCSDVersion[1] == 'B') {
-          SafeStrCat(buffer, _T("OSR2 "), buf_len);
-        }
-      }
-
-      if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10) {
-        SafeStrCat(buffer, _T("Microsoft Windows 98 "), buf_len);
-        if (osvi.szCSDVersion[1] == 'A') {
-          SafeStrCat(buffer, _T("SE "), buf_len);
-        }
-      }
-
-      if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90) {
-        SafeStrCat(buffer,
-                   _T("Microsoft Windows Millennium Edition"),
-                   buf_len);
-      }
-      break;
-
-    case VER_PLATFORM_WIN32s:
-
-      SafeStrCat(buffer, _T("Microsoft Win32s"), buf_len);
-      break;
-
-  default:
-    SafeStrCat(buffer, _T("Unknown operating system"), buf_len);
-    break;
-  }
-  // SKIP_LOC_END
-
-  // Remove trailing space, if any.
-  DWORD buffer_len = ::lstrlen(buffer);
-  if (buffer[buffer_len-1] == kNullChar) {
-    buffer[buffer_len-1] = kNullChar;
-  }
-
-  // Copy to destination argument.
-  String_StrNCpy(name_buf, buffer, name_buf_len);
-
-  return true;
-}
-
-DWORD SystemInfo::GetProcessorArchitecture() {
-  static DWORD processor_architecture_cached(PROCESSOR_ARCHITECTURE_UNKNOWN);
-
-  if (processor_architecture_cached == PROCESSOR_ARCHITECTURE_UNKNOWN) {
-    typedef void (WINAPI * GetSystemInfoFunc)(LPSYSTEM_INFO);
-
-    HMODULE handle = ::GetModuleHandle(_T("kernel32"));
-    ASSERT1(handle);
-    GetSystemInfoFunc get_native_system_info =
-        reinterpret_cast<GetSystemInfoFunc>(::GetProcAddress(
-                                                handle,
-                                                "GetNativeSystemInfo"));
-
-    if (get_native_system_info != NULL) {
-      SYSTEM_INFO sys_info = {0};
-
-      get_native_system_info(&sys_info);
-
-      processor_architecture_cached = sys_info.wProcessorArchitecture;
-    } else {
-      // If we couldn't get the _native_ system info, then we must be on OS
-      // earlier than XP, so can't be 64-bit anyway. Assume Intel.
-      processor_architecture_cached = PROCESSOR_ARCHITECTURE_INTEL;
-    }
-  }
-
-  return processor_architecture_cached;
-}
-
-bool SystemInfo::Is64BitWindows() {
-#if defined(_WIN64)
-  return true;
-#else
-  return Process::IsWow64(::GetCurrentProcessId());
-#endif
-}
-
-}  // namespace omaha
diff --git a/base/system_info.h b/base/system_info.h
deleted file mode 100644
index 6755812..0000000
--- a/base/system_info.h
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// TODO(omaha): this code should be updated according to code published by
-// Microsoft at http://msdn.microsoft.com/en-us/library/ms724429(VS.85).aspx.
-// We need a more rigorous clasification of versions.
-
-#ifndef OMAHA_BASE_SYSTEM_INFO_H_
-#define OMAHA_BASE_SYSTEM_INFO_H_
-
-#include <windows.h>
-#include <tchar.h>
-
-namespace omaha {
-
-// TODO(omaha): refactor to use a namespace.
-class SystemInfo {
- public:
-  // Find out if the OS is at least Windows 2000
-  // Service pack 4. If OS version is less than that
-  // will return false, all other cases true.
-  static bool OSWin2KSP4OrLater() {
-    // Use GetVersionEx to get OS and Service Pack information.
-    OSVERSIONINFOEX osviex;
-    ::ZeroMemory(&osviex, sizeof(osviex));
-    osviex.dwOSVersionInfoSize = sizeof(osviex);
-    BOOL success = ::GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&osviex));
-    // If this failed we're on Win9X or a pre NT4SP6 OS.
-    if (!success) {
-      return false;
-    }
-
-    if (osviex.dwMajorVersion < 5) {
-      return false;
-    }
-    if (osviex.dwMajorVersion > 5) {
-      return true;    // way beyond Windows XP.
-    }
-    if (osviex.dwMinorVersion >= 1) {
-      return true;    // Windows XP or better.
-    }
-    if (osviex.wServicePackMajor >= 4) {
-      return true;    // Windows 2000 SP4.
-    }
-
-    return false;     // Windows 2000, < SP4.
-  }
-
-  // Returns true if the OS is at least XP SP2.
-  static bool OSWinXPSP2OrLater();
-
-  // CategorizeOS returns a categorization of what operating system is running,
-  // and the service pack level.
-  // NOTE: Please keep this in the order of increasing OS versions
-  enum OSVersionType {
-    OS_WINDOWS_UNKNOWN = 1,
-    OS_WINDOWS_9X_OR_NT,
-    OS_WINDOWS_2000,
-    OS_WINDOWS_XP,
-    OS_WINDOWS_SERVER_2003,
-    OS_WINDOWS_VISTA,
-    OS_WINDOWS_7
-  };
-  static HRESULT CategorizeOS(OSVersionType* os_version, DWORD* service_pack);
-  static const wchar_t* OSVersionTypeAsString(OSVersionType t);
-
-  // Returns true if the current operating system is Windows 2000.
-  static bool IsRunningOnW2K();
-
-  // Are we running on Windows XP or later.
-  static bool IsRunningOnXPOrLater();
-
-  // Are we running on Windows XP SP1 or later.
-  static bool IsRunningOnXPSP1OrLater();
-
-  // Are we running on Windows Vista or later.
-  static bool IsRunningOnVistaOrLater();
-
-  static bool IsRunningOnVistaRTM();
-
-  // Returns the version and the name of the operating system.
-  static bool GetSystemVersion(int* major_version,
-                               int* minor_version,
-                               int* service_pack_major,
-                               int* service_pack_minor,
-                               TCHAR* name_buf,
-                               size_t name_buf_len);
-
-  // Returns the processor architecture. We use wProcessorArchitecture in
-  // SYSTEM_INFO returned by ::GetNativeSystemInfo() to detect the processor
-  // architecture of the installed operating system. Note the "Native" in the
-  // function name - this is important. See
-  // http://msdn.microsoft.com/en-us/library/ms724340.aspx.
-  static DWORD GetProcessorArchitecture();
-
-  // Returns whether this is a 64-bit Windows system.
-  static bool Is64BitWindows();
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_SYSTEM_INFO_H_
-
diff --git a/base/system_info_unittest.cc b/base/system_info_unittest.cc
deleted file mode 100644
index 77ef45f..0000000
--- a/base/system_info_unittest.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <atlstr.h>
-#include "omaha/base/system_info.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(SystemInfoTest, SystemInfo) {
-  SystemInfo::OSVersionType os_type = SystemInfo::OS_WINDOWS_UNKNOWN;
-  DWORD service_pack = 0;
-  ASSERT_SUCCEEDED(SystemInfo::CategorizeOS(&os_type, &service_pack));
-}
-
-TEST(SystemInfoTest, GetSystemVersion) {
-  int major_version(0);
-  int minor_version(0);
-  int service_pack_major(0);
-  int service_pack_minor(0);
-
-  CString name;
-  ASSERT_TRUE(SystemInfo::GetSystemVersion(&major_version,
-                                           &minor_version,
-                                           &service_pack_major,
-                                           &service_pack_minor,
-                                           CStrBuf(name, MAX_PATH),
-                                           MAX_PATH));
-  EXPECT_NE(0, major_version);
-  EXPECT_EQ(0, service_pack_minor);
-
-  EXPECT_FALSE(name.IsEmpty());
-}
-
-TEST(SystemInfoTest, Is64BitWindows) {
-  DWORD arch(SystemInfo::GetProcessorArchitecture());
-
-  if (arch == PROCESSOR_ARCHITECTURE_INTEL) {
-    EXPECT_FALSE(SystemInfo::Is64BitWindows());
-  } else {
-    EXPECT_TRUE(SystemInfo::Is64BitWindows());
-  }
-}
-
-TEST(SystemInfoTest, GetProcessorArchitecture) {
-  DWORD arch(SystemInfo::GetProcessorArchitecture());
-
-  // TODO(omaha3): Maybe we could look for the presence of a wow6432 key in the
-  // registry to detect.
-  EXPECT_TRUE(arch == PROCESSOR_ARCHITECTURE_INTEL ||
-              arch == PROCESSOR_ARCHITECTURE_AMD64);
-}
-
-}  // namespace omaha
-
diff --git a/base/system_unittest.cc b/base/system_unittest.cc
deleted file mode 100644
index 4eae206..0000000
--- a/base/system_unittest.cc
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-// System unittest
-//
-// TODO(omaha): there are some untested functions: memory stats, thread
-// priorities, getdirsize (that's mine), backup/restore of registry trees.. not
-// sure how high priority it is to test these things but should probably be
-// added
-
-#include "omaha/base/system.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(SystemTest, System) {
-    uint32 time_waited = 0;
-    ASSERT_SUCCEEDED(System::WaitForDiskActivity(10000, 25, &time_waited));
-
-    uint64 free_bytes_current_user = 0;
-    uint64 total_bytes_current_user = 0;
-    uint64 free_bytes_all_users = 0;
-    ASSERT_SUCCEEDED(System::GetDiskStatistics(_T("C:\\"),
-                                               &free_bytes_current_user,
-                                               &total_bytes_current_user,
-                                               &free_bytes_all_users));
-
-    ASSERT_EQ(System::GetProcessHandleCount(),
-              System::GetProcessHandleCountOld());
-}
-
-// Assume the workstations and PULSE are not running on batteries. The test
-// fails on laptops running on batteries.
-TEST(SystemTest, IsRunningOnBatteries) {
-  ASSERT_FALSE(System::IsRunningOnBatteries());
-}
-
-TEST(SystemTest, GetProcessMemoryStatistics) {
-  uint64 current_working_set(0);
-  uint64 peak_working_set(0);
-  uint64 min_working_set_size(0);
-  uint64 max_working_set_size(0);
-  ASSERT_HRESULT_SUCCEEDED(
-    System::GetProcessMemoryStatistics(&current_working_set,
-                                       &peak_working_set,
-                                       &min_working_set_size,
-                                       &max_working_set_size));
-  EXPECT_LT(0, current_working_set);
-  EXPECT_LT(0, peak_working_set);
-  EXPECT_LT(0, min_working_set_size);
-  EXPECT_LT(0, max_working_set_size);
-}
-
-TEST(SystemTest, GetProcessHandleCount) {
-  DWORD handle_count(0);
-  ASSERT_TRUE(::GetProcessHandleCount(::GetCurrentProcess(), &handle_count));
-  EXPECT_LE(0u, handle_count);
-  EXPECT_EQ(handle_count, System::GetProcessHandleCount());
-}
-
-}  // namespace omaha
-
diff --git a/base/thread.cc b/base/thread.cc
deleted file mode 100644
index a3abf4a..0000000
--- a/base/thread.cc
+++ /dev/null
@@ -1,169 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/thread.h"
-
-#include "omaha/base/debug.h"
-#include "omaha/base/exception_barrier.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/time.h"
-
-namespace omaha {
-
-// The system keeps an event associated with the thread message queue for a
-// while even after the thread is dead. It can appear as a handle leak in the
-// unit test but in fact it is not.
-
-Thread::Thread() : thread_id_(0), thread_(NULL) {
-}
-
-Thread::~Thread() {
-  if (thread_) {
-    VERIFY1(CloseHandle(thread_));
-  }
-  thread_ = NULL;
-}
-
-// This is the thread proc function as required by win32.
-DWORD __stdcall Thread::Prepare(void* this_pointer) {
-  ExceptionBarrier eb;
-
-  ASSERT1(this_pointer);
-  Thread   * this_thread =  reinterpret_cast<Thread*>(this_pointer);
-  Runnable * this_runner =  this_thread->runner_;
-
-  // Create a message queue. Our thread should have one.
-  MSG message = {0};
-  PeekMessage(&message, NULL, WM_USER, WM_USER, PM_NOREMOVE);
-
-  // Start method is waiting on this gate to be open in order
-  // to proceed. By opening gate we say: OK thread is running.
-  this_thread->start_gate_.Open();
-
-  // Now call the interface method. We are done.
-  UTIL_LOG(L4, (L"Thread::Prepare calling thread's Run()"));
-  this_runner->Run();
-
-  return 0;
-}
-
-// Starts the thread. It does not return until the thread is started.
-bool Thread::Start(Runnable* runner) {
-  ASSERT1(runner);
-
-  // Allow the thread object to be reused by cleaning its state up.
-  if (thread_) {
-    VERIFY1(CloseHandle(thread_));
-  }
-  start_gate_.Close();
-
-  runner_ = runner;
-  thread_ = CreateThread(NULL,              // default security attributes
-                         0,                 // use default stack size
-                         &Thread::Prepare,  // thread function
-                         this,              // argument to thread function
-                         0,                 // use default creation flags
-                         &thread_id_);      // returns the thread identifier
-  if (!thread_) {
-    return false;
-  }
-  // Wait until the newly created thread opens the gate for us.
-  return start_gate_.Wait(INFINITE);
-}
-
-DWORD Thread::GetThreadId() const {
-  return thread_id_;
-}
-
-HANDLE Thread::GetThreadHandle() const {
-  return thread_;
-}
-
-bool Thread::Suspend() {
-  return (static_cast<DWORD>(-1) != SuspendThread(thread_));
-}
-
-bool Thread::Resume() {
-  return (static_cast<DWORD>(-1) != ResumeThread(thread_));
-}
-
-bool Thread::Terminate(int exit_code) {
-  return TRUE == TerminateThread(thread_, exit_code);
-}
-
-bool Thread::SetPriority(int priority) {
-  return TRUE == SetThreadPriority(thread_, priority);
-}
-
-bool Thread::GetPriority(int* priority) const {
-  if (!priority) {
-    return false;
-  }
-  *priority = GetThreadPriority(thread_);
-  return THREAD_PRIORITY_ERROR_RETURN != *priority;
-}
-
-// Waits for handle to become signaled.
-bool Thread::WaitTillExit(DWORD msec) const {
-  if (!Running()) {
-    return true;
-  }
-  return WAIT_OBJECT_0 == WaitForSingleObject(thread_, msec);
-}
-
-// Checks if the thread is running.
-bool Thread::Running() const {
-  if (NULL == thread_) {
-    return false;
-  }
-  return WAIT_TIMEOUT == WaitForSingleObject(thread_, 0);
-}
-
-// Executes an APC request.
-void __stdcall Thread::APCProc(ULONG_PTR param) {
-  ApcInfo* pInfo = reinterpret_cast<ApcInfo*>(param);
-  if (pInfo) {
-    if (pInfo->receiver_) {
-      pInfo->receiver_->OnApc(pInfo->param_);
-    }
-    // Deallocates what was allocated in QueueApc.
-    delete pInfo;
-  }
-}
-
-// ApcReceiver wants to execute its OnApc function in the
-// context of this thread.
-bool Thread::QueueApc(ApcReceiver* receiver, ULONG_PTR param) {
-  ASSERT1(receiver);
-  if (!Running()) {
-    // No reason to queue anything to not running thread.
-    return true;
-  }
-
-  // This allocation will be freed in Thread::APCProc
-  ApcInfo* pInfo = new ApcInfo();
-  pInfo->receiver_ = receiver;
-  pInfo->param_    = param;
-  return 0 != QueueUserAPC(&Thread::APCProc,
-                           thread_,
-                           reinterpret_cast<ULONG_PTR>(pInfo));
-}
-
-bool Thread::PostMessage(UINT msg, WPARAM wparam, LPARAM lparam) {
-  return TRUE == PostThreadMessage(thread_id_, msg, wparam, lparam);
-}
-
-}  // namespace omaha
-
diff --git a/base/thread.h b/base/thread.h
deleted file mode 100644
index bf576b9..0000000
--- a/base/thread.h
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Defines interface Runnable and class Thread.
-//
-// Thread encapsulates win32 primitives of creating and
-// manipulating win32 threads.
-
-#ifndef OMAHA_COMMON_THREAD_H__
-#define OMAHA_COMMON_THREAD_H__
-
-#include "omaha/base/synchronized.h"
-
-namespace omaha {
-
-// Any class which requires part of its execution in a
-// separate thread should be derived from Runnable interface.
-// It can have member variable of type Thread. When the
-// thread needs to be launched one does something like that.
-//  A::func() {
-//    thread_.start(this);
-//  }
-
-class Runnable {
-  friend class Thread;
- protected:
-  Runnable() {}
-  virtual ~Runnable() {}
-  virtual void Run() = 0;
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(Runnable);
-};
-
-// Any class devived from this one will be able to call
-// Thread function QueueApc and have the function OnApc get
-// executed in context of this thread. Thread must be in alertable
-// state to be able to execute the apc function.
-class ApcReceiver {
-  friend class Thread;
- protected:
-  ApcReceiver() {}
-  virtual ~ApcReceiver() {}
-  virtual void OnApc(ULONG_PTR param) = 0;
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(ApcReceiver);
-};
-
-// This class encapsulates win32 thread management functions.
-class Thread {
- public:
-  Thread();
-  ~Thread();
-
-  bool Start(Runnable* runner);
-  bool Suspend();
-  bool Resume();
-  bool Terminate(int exit_code);
-  bool SetPriority(int priority);
-  bool GetPriority(int* priority) const;
-  DWORD GetThreadId() const;
-  HANDLE GetThreadHandle() const;
-
-  // Checks if the thread is running.
-  bool Running() const;
-
-  // Waits until thread exits.
-  bool WaitTillExit(DWORD msec) const;
-
-  // Queues an APC to the ApcReceiver.
-  bool QueueApc(ApcReceiver* receiver, ULONG_PTR param);
-
-  // Posts message to a thread.
-  bool PostMessage(UINT msg, WPARAM wparam, LPARAM lparam);
- private:
-  static DWORD __stdcall Prepare(void* thisPointer);      // Thread proc.
-  static void __stdcall APCProc(ULONG_PTR dwParam);
-
-  Runnable* runner_;     // Interface to work with.
-  HANDLE    thread_;
-  DWORD     thread_id_;
-  Gate start_gate_;     // Synchronizes the thread start.
-
-  struct ApcInfo {
-    ApcReceiver* receiver_;
-    ULONG_PTR    param_;
-  };
-
-  DISALLOW_EVIL_CONSTRUCTORS(Thread);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_THREAD_H__
diff --git a/base/thread_pool.cc b/base/thread_pool.cc
deleted file mode 100644
index e614dc4..0000000
--- a/base/thread_pool.cc
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/thread_pool.h"
-
-#include "base/scoped_ptr.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/exception_barrier.h"
-#include "omaha/base/logging.h"
-
-namespace omaha {
-
-namespace {
-
-// Context keeps track the information necessary to execute a work item
-// inside a thread pool thread.
-class Context {
- public:
-  Context(ThreadPool* pool, UserWorkItem* work_item)
-      : pool_(pool),
-        work_item_(work_item) {
-    ASSERT1(pool);
-    ASSERT1(work_item);
-  }
-
-  ThreadPool*   pool() const { return pool_; }
-  UserWorkItem* work_item() const { return work_item_; }
-
- private:
-  ThreadPool*   pool_;
-  UserWorkItem* work_item_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(Context);
-};
-
-// Returns true if delta time since 'baseline' is greater or equal than
-// 'milisecs'. Note: GetTickCount wraps around every ~48 days.
-bool TimeHasElapsed(DWORD baseline, DWORD milisecs) {
-  DWORD current = ::GetTickCount();
-  DWORD wrap_bias = 0;
-  if (current < baseline) {
-    wrap_bias = static_cast<DWORD>(0xFFFFFFFF);
-  }
-  return (current - baseline + wrap_bias) >= milisecs ? true : false;
-}
-
-}   // namespace
-
-
-DWORD WINAPI ThreadPool::ThreadProc(void* param) {
-  ExceptionBarrier eb;
-  UTIL_LOG(L4, (_T("[ThreadPool::ThreadProc]")));
-  ASSERT1(param);
-  Context* context = static_cast<Context*>(param);
-  context->pool()->ProcessWorkItem(context->work_item());
-  delete context;
-  return 0;
-}
-
-ThreadPool::ThreadPool()
-    : work_item_count_(0),
-      shutdown_delay_(0) {
-  UTIL_LOG(L2, (_T("[ThreadPool::ThreadPool]")));
-}
-
-ThreadPool::~ThreadPool() {
-  UTIL_LOG(L2, (_T("[ThreadPool::~ThreadPool]")));
-
-  if (!shutdown_event_) {
-    return;
-  }
-
-  DWORD baseline_tick_count = ::GetTickCount();
-  if (::SetEvent(get(shutdown_event_))) {
-    while (work_item_count_ != 0) {
-      ::Sleep(1);
-      if (TimeHasElapsed(baseline_tick_count, shutdown_delay_)) {
-        UTIL_LOG(LE, (_T("[ThreadPool::~ThreadPool][timeout elapsed]")));
-        break;
-      }
-    }
-  }
-}
-
-HRESULT ThreadPool::Initialize(int shutdown_delay) {
-  shutdown_delay_ = shutdown_delay;
-  reset(shutdown_event_, ::CreateEvent(NULL, true, false, NULL));
-  return shutdown_event_ ? S_OK : HRESULTFromLastError();
-}
-
-void ThreadPool::ProcessWorkItem(UserWorkItem* work_item) {
-  ASSERT1(work_item);
-  work_item->Process();
-  delete work_item;
-  ::InterlockedDecrement(&work_item_count_);
-}
-
-HRESULT ThreadPool::QueueUserWorkItem(UserWorkItem* work_item, uint32 flags) {
-  UTIL_LOG(L4, (_T("[ThreadPool::QueueUserWorkItem]")));
-  ASSERT1(work_item);
-
-  scoped_ptr<Context> context(new Context(this, work_item));
-  work_item->set_shutdown_event(get(shutdown_event_));
-  ::InterlockedIncrement(&work_item_count_);
-  if (!::QueueUserWorkItem(&ThreadPool::ThreadProc, context.get(), flags)) {
-    ::InterlockedDecrement(&work_item_count_);
-    return HRESULTFromLastError();
-  }
-
-  // The thread pool has the ownership of the work item thereon.
-  context.release();
-  return S_OK;
-}
-
-}   // namespace omaha
-
diff --git a/base/thread_pool.h b/base/thread_pool.h
deleted file mode 100644
index a18f6f2..0000000
--- a/base/thread_pool.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_BASE_THREAD_POOL_H_
-#define OMAHA_BASE_THREAD_POOL_H_
-
-#include <windows.h>
-#include "base/basictypes.h"
-#include "omaha/base/scoped_any.h"
-
-namespace omaha {
-
-class UserWorkItem {
- public:
-  UserWorkItem() : shutdown_event_(NULL) {}
-  virtual ~UserWorkItem() {}
-
-  // Template method interface
-  void Process() { DoProcess(); }
-
-  HANDLE shutdown_event() const { return shutdown_event_; }
-  void set_shutdown_event(HANDLE shutdown_event) {
-    shutdown_event_ = shutdown_event;
-  }
-
- private:
-  // Executes the work item.
-  virtual void DoProcess() = 0;
-
-  // It is the job of implementers to watch for the signaling of this event
-  // and shutdown correctly. This event is set when the thread pool is closing.
-  // Do not close this event as is owned by the thread pool.
-  HANDLE shutdown_event_;
-  DISALLOW_EVIL_CONSTRUCTORS(UserWorkItem);
-};
-
-class ThreadPool {
- public:
-  ThreadPool();
-
-  // The destructor might block for 'shutdown_delay'.
-  ~ThreadPool();
-
-  HRESULT Initialize(int shutdown_delay);
-
-  // Returns true if any work items are still in progress.
-  bool HasWorkItems() const { return (0 != work_item_count_); }
-
-  // Adds a work item to the queue. If the add fails the ownership of the
-  // work items remains with the caller.
-  HRESULT QueueUserWorkItem(UserWorkItem* work_item, uint32 flags);
-
- private:
-  // Calls UserWorkItem::Process() in the context of the worker thread.
-  void ProcessWorkItem(UserWorkItem* work_item);
-
-  // This is the thread callback required by the underlying windows API.
-  static DWORD WINAPI ThreadProc(void* context);
-
-  // Approximate number of work items in the pool.
-  volatile LONG work_item_count_;
-
-  // This event signals when the thread pool destructor is in progress.
-  scoped_event shutdown_event_;
-
-  // How many milliseconds to wait for the work items to finish when
-  // the thread pool is shutting down. The shutdown delay resolution is ~10ms.
-  int shutdown_delay_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(ThreadPool);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_THREAD_POOL_H_
-
diff --git a/base/thread_pool_callback.h b/base/thread_pool_callback.h
deleted file mode 100644
index 52eac45..0000000
--- a/base/thread_pool_callback.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2004-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_BASE_THREAD_POOL_CALLBACK_H_
-#define OMAHA_BASE_THREAD_POOL_CALLBACK_H_
-
-#include <windows.h>
-#include "base/basictypes.h"
-#include "omaha/base/thread_pool.h"
-
-namespace omaha {
-
-template <typename T>
-class ThreadPoolCallBack0 : public UserWorkItem {
- public:
-  explicit ThreadPoolCallBack0(T* obj, void (T::*fun)())
-      : obj_(obj), fun_(fun) {}
- private:
-  virtual void DoProcess() {
-    (obj_->*fun_)();
-  }
-  T* obj_;
-  void (T::*fun_)();
-
-  DISALLOW_COPY_AND_ASSIGN(ThreadPoolCallBack0);
-};
-
-template <typename T, typename P1>
-class ThreadPoolCallBack1 : public UserWorkItem {
- public:
-  explicit ThreadPoolCallBack1(T* obj, void (T::*fun)(P1), P1 p1)
-      : obj_(obj), fun_(fun), p1_(p1) {}
- private:
-  virtual void DoProcess() {
-    (obj_->*fun_)(p1_);
-  }
-  T* obj_;
-  void (T::*fun_)(P1);
-  P1 p1_;
-
-  DISALLOW_COPY_AND_ASSIGN(ThreadPoolCallBack1);
-};
-
-template <typename P1>
-class StaticThreadPoolCallBack1 : public UserWorkItem {
- public:
-  explicit StaticThreadPoolCallBack1(void (*fun)(P1), P1 p1)
-      : fun_(fun), p1_(p1) {}
- private:
-  virtual void DoProcess() {
-    (*fun_)(p1_);
-  }
-
-  void (*fun_)(P1);
-  P1 p1_;
-
-  DISALLOW_COPY_AND_ASSIGN(StaticThreadPoolCallBack1);
-};
-
-template <typename T, typename P1, typename P2>
-class ThreadPoolCallBack2 : public UserWorkItem {
- public:
-  explicit ThreadPoolCallBack2(T* obj, void (T::*fun)(P1, P2), P1 p1, P2 p2)
-      : obj_(obj), fun_(fun), p1_(p1), p2_(p2) {}
- private:
-  virtual void DoProcess() {
-    (obj_->*fun_)(p1_, p2_);
-  }
-  T* obj_;
-  void (T::*fun_)(P1, P2);
-  P1 p1_;
-  P2 p2_;
-
-  DISALLOW_COPY_AND_ASSIGN(ThreadPoolCallBack2);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_THREAD_POOL_CALLBACK_H_
-
diff --git a/base/thread_pool_unittest.cc b/base/thread_pool_unittest.cc
deleted file mode 100644
index 389c883..0000000
--- a/base/thread_pool_unittest.cc
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/thread_pool.h"
-#include "omaha/base/timer.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-volatile LONG g_completed_count = 0;
-
-// Increments the global count by 1.
-class MyJob1 : public UserWorkItem {
- public:
-  MyJob1() {}
-
- private:
-  virtual void DoProcess() { ::InterlockedExchangeAdd(&g_completed_count, 1); }
-
-  DISALLOW_EVIL_CONSTRUCTORS(MyJob1);
-};
-
-// Increments the global count by 2.
-class MyJob2 : public UserWorkItem {
- public:
-  MyJob2() {}
-
- private:
-  virtual void DoProcess() { ::InterlockedExchangeAdd(&g_completed_count, 2); }
-
-  DISALLOW_EVIL_CONSTRUCTORS(MyJob2);
-};
-
-// Increments the global count by 3.
-class MyJob3 : public UserWorkItem {
- public:
-  MyJob3() {}
-
- private:
-  virtual void DoProcess() { ::InterlockedExchangeAdd(&g_completed_count, 3); }
-
-  DISALLOW_EVIL_CONSTRUCTORS(MyJob3);
-};
-
-HRESULT QueueMyJob1(ThreadPool* thread_pool) {
-  scoped_ptr<MyJob1> job(new MyJob1);
-  HRESULT hr = thread_pool->QueueUserWorkItem(job.get(), WT_EXECUTEDEFAULT);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  job.release();
-  return S_OK;
-}
-
-HRESULT QueueMyJob2(ThreadPool* thread_pool) {
-  scoped_ptr<MyJob2> job(new MyJob2);
-  HRESULT hr = thread_pool->QueueUserWorkItem(job.get(), WT_EXECUTEDEFAULT);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  job.release();
-  return S_OK;
-}
-
-HRESULT QueueMyJob3(ThreadPool* thread_pool) {
-  scoped_ptr<MyJob3> job(new MyJob3);
-  HRESULT hr = thread_pool->QueueUserWorkItem(job.get(), WT_EXECUTEDEFAULT);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  job.release();
-  return S_OK;
-}
-
-}   // namespace
-
-// Creates several jobs to increment a global counter by different values and
-// then it checks the value is correct.
-TEST(ThreadPoolTest, ThreadPool) {
-  const int kShutdownDelayMs = 0;
-  const int kNumJobsEachType = 100;
-
-  ThreadPool thread_pool;
-  ASSERT_HRESULT_SUCCEEDED(thread_pool.Initialize(kShutdownDelayMs));
-
-  for (int i = 0; i != kNumJobsEachType; ++i) {
-    EXPECT_HRESULT_SUCCEEDED(QueueMyJob1(&thread_pool));
-    EXPECT_HRESULT_SUCCEEDED(QueueMyJob2(&thread_pool));
-    EXPECT_HRESULT_SUCCEEDED(QueueMyJob3(&thread_pool));
-  }
-
-  const int kMaxWaitForJobsMs = 2000;
-  LowResTimer t(true);
-  while (thread_pool.HasWorkItems() &&
-         t.GetMilliseconds() < kMaxWaitForJobsMs) {
-    ::Sleep(100);
-  }
-  EXPECT_EQ(g_completed_count, 6 * kNumJobsEachType);
-}
-
-}   // namespace omaha
-
diff --git a/base/time.cc b/base/time.cc
deleted file mode 100644
index 7c6d91c..0000000
--- a/base/time.cc
+++ /dev/null
@@ -1,504 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Time functions
-
-#include "omaha/base/time.h"
-#include "omaha/base/commontypes.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-// Date Constants
-
-#define kNumOfDays 7
-#define kNumOfMonth 12
-
-static const TCHAR kRFC822_DateDelimiters[]    = _T(" ,:");
-static const TCHAR kRFC822_TimeDelimiter[]     = _T(":");
-SELECTANY const TCHAR* kRFC822_Day[kNumOfDays] = {
-  _T("Mon"),
-  _T("Tue"),
-  _T("Wed"),
-  _T("Thu"),
-  _T("Fri"),
-  _T("Sat"),
-  _T("Sun") };
-
-SELECTANY const TCHAR* kRFC822_Month[kNumOfMonth] = {
-  _T("Jan"),
-  _T("Feb"),
-  _T("Mar"),
-  _T("Apr"),
-  _T("May"),
-  _T("Jun"),
-  _T("Jul"),
-  _T("Aug"),
-  _T("Sep"),
-  _T("Oct"),
-  _T("Nov"),
-  _T("Dec") };
-
-struct TimeZoneInfo {
-  const TCHAR* zone_name;
-  int hour_dif;
-};
-
-SELECTANY TimeZoneInfo kRFC822_TimeZone[] = {
-  { _T("UT"),  0 },
-  { _T("GMT"), 0 },
-  { _T("EST"), -5 },
-  { _T("EDT"), -4 },
-  { _T("CST"), -6 },
-  { _T("CDT"), -5 },
-  { _T("MST"), -7 },
-  { _T("MDT"), -6 },
-  { _T("PST"), -8 },
-  { _T("PDT"), -7 },
-  { _T("A"),   -1 },  // Military time zones
-  { _T("B"),   -2 },
-  { _T("C"),   -3 },
-  { _T("D"),   -4 },
-  { _T("E"),   -5 },
-  { _T("F"),   -6 },
-  { _T("G"),   -7 },
-  { _T("H"),   -8 },
-  { _T("I"),   -9 },
-  { _T("K"),   -10 },
-  { _T("L"),   -11 },
-  { _T("M"),   -12 },
-  { _T("N"),    1 },
-  { _T("O"),    2 },
-  { _T("P"),    3 },
-  { _T("Q"),    4 },
-  { _T("R"),    5 },
-  { _T("S"),    6 },
-  { _T("T"),    7 },
-  { _T("U"),    8 },
-  { _T("V"),    9 },
-  { _T("W"),    10 },
-  { _T("X"),    11 },
-  { _T("Y"),    12 },
-  { _T("Z"),    0 },
-};
-
-SELECTANY const TCHAR *days[] =
-  { L"Sun", L"Mon", L"Tue", L"Wed", L"Thu", L"Fri", L"Sat" };
-
-SELECTANY const TCHAR *months[] = {
-  L"Jan",
-  L"Feb",
-  L"Mar",
-  L"Apr",
-  L"May",
-  L"Jun",
-  L"Jul",
-  L"Aug",
-  L"Sep",
-  L"Oct",
-  L"Nov",
-  L"Dec"
-};
-
-// NOTE: so long as the output is used internally only, no localization is
-// needed here.
-CString ConvertTimeToGMTString(const FILETIME *ft) {
-  ASSERT(ft, (L""));
-
-  CString s;
-  SYSTEMTIME st;
-  if (!FileTimeToSystemTime(ft, &st)) {
-    return L"";
-  }
-
-  // same as FormatGmt(_T("%a, %d %b %Y %H:%M:%S GMT"));
-  s.Format(NOTRANSL(L"%s, %02d %s %d %02d:%02d:%02d GMT"), days[st.wDayOfWeek],
-    st.wDay, months[st.wMonth-1], st.wYear, st.wHour, st.wMinute, st.wSecond);
-  return s;
-}
-
-time64 ConvertTime16ToTime64(uint16 time16) {
-  return time16 * kTimeGranularity + kStart100NsTime;
-}
-
-uint16 ConvertTime64ToTime16(time64 time) {
-  ASSERT1(time >= kStart100NsTime);
-
-  time64 t64 = (time - kStart100NsTime) / kTimeGranularity;
-  ASSERT1(t64 <= kTime16Max);
-
-  return static_cast<uint16>(t64);
-}
-
-time64 TimeTToTime64(const time_t& old_value) {
-  FILETIME file_time;
-  TimeTToFileTime(old_value, &file_time);
-  return FileTimeToTime64(file_time);
-}
-
-#ifdef _DEBUG
-void ComputeStartTime() {
-    SYSTEMTIME start_system_time = kStartSystemTime;
-    time64 start_100ns_time = SystemTimeToTime64(&start_system_time);
-    UTIL_LOG(L1, (_T("posting list starting time = %s\n"),
-                  String_Int64ToString(start_100ns_time, 10)));
-}
-#endif
-
-// Time management
-
-// Allow the unittest to override.
-static time64 time_override = 0;
-
-// #ifdef UNITTEST
-void SetTimeOverride(const time64 & time_new) {
-  time_override = time_new;
-}
-
-// #endif
-
-time64 GetCurrent100NSTime() {
-  if (time_override != 0)
-    return time_override;
-
-  // In order gte the 100ns time we shouldn't use SystemTime
-  // as it's granularity is 1 ms. Below is the correct implementation.
-  // On the other hand the system clock granularity is 15 ms, so we
-  // are not gaining much by having the timestamp in nano-sec
-  // If we decide to go with ms, divide "time64 time" by 10000
-  // SYSTEMTIME sys_time;
-  // GetLocalTime(&sys_time);
-  // return SystemTimeToTime64(&sys_time);
-
-  // get the current time in 100-nanoseconds intervals
-  FILETIME file_time;
-  ::GetSystemTimeAsFileTime(&file_time);
-
-  time64 time = FileTimeToTime64(file_time);
-  return time;
-}
-
-time64 GetCurrentMsTime() {
-  return GetCurrent100NSTime() / kMillisecsTo100ns;
-}
-
-time64 SystemTimeToTime64(const SYSTEMTIME* sys_time) {
-  ASSERT1(sys_time);
-
-  FILETIME file_time;
-  SetZero(file_time);
-
-  if (!::SystemTimeToFileTime(sys_time, &file_time)) {
-    UTIL_LOG(LE,
-             (_T("[SystemTimeToTime64 - failed to SystemTimeToFileTime][0x%x]"),
-              HRESULTFromLastError()));
-    return 0;
-  }
-
-  return FileTimeToTime64(file_time);
-}
-
-// returns a value compatible with EXE/DLL timestamps
-// and the C time() function
-// NOTE: behavior is independent of wMilliseconds value
-int32 SystemTimeToInt32(const SYSTEMTIME *sys_time) {
-  ASSERT(sys_time, (L""));
-
-  time64 t64 = SystemTimeToTime64(sys_time);
-  int32 t32 = 0;
-
-  if (t64 != 0) {
-    t32 = Time64ToInt32(t64);
-  }
-  return t32;
-}
-
-int32 Time64ToInt32(const time64 & time) {
-  // convert to 32-bit format
-  // time() (32-bit) measures seconds since 1970/01/01 00:00:00 (UTC)
-  // FILETIME (64-bit) measures 100-ns intervals since 1601/01/01 00:00:00 (UTC)
-
-  // seconds between 1601 and 1970
-  time64 t32 = (time / kSecsTo100ns) -
-               ((time64(60*60*24) * time64(365*369 + 89)));
-  ASSERT(t32 == (t32 & 0x7FFFFFFF), (L""));  // make sure it fits
-
-  // cast at the end (avoids overflow/underflow when computing 32-bit value)
-  return static_cast<int32>(t32);
-}
-
-time64 Int32ToTime64(const int32 & time) {
-  // convert to 64-bit format
-  // time() (32-bit) measures seconds since 1970/01/01 00:00:00 (UTC)
-  // FILETIME (64-bit) measures 100-ns intervals since 1601/01/01 00:00:00 (UTC)
-
-  // seconds between 1601 and 1970
-  time64 t64 = (static_cast<time64>(time) +
-               (time64(60*60*24) * time64(365*369 + 89))) * kSecsTo100ns;
-  return t64;
-}
-
-// TODO(omaha): The next 2 functions can fail if FileTimeToLocalFileTime or
-// FileTimeToSystemTime fails.
-// Consider having it return a HRESULT. Right now if FileTimeToSystemTime fails,
-// it returns an undefined value.
-
-// Convert a uint to a genuine systemtime
-SYSTEMTIME Time64ToSystemTime(const time64& time) {
-  FILETIME file_time;
-  SetZero(file_time);
-  Time64ToFileTime(time, &file_time);
-
-  SYSTEMTIME sys_time;
-  SetZero(sys_time);
-  if (!FileTimeToSystemTime(&file_time, &sys_time)) {
-    UTIL_LOG(LE, (_T("[Time64ToSystemTime]")
-                  _T("[failed to FileTimeToSystemTime][0x%x]"),
-                  HRESULTFromLastError()));
-  }
-
-  return sys_time;
-}
-
-
-// Convert a uint to a genuine localtime
-// Should ONLY be used for display, since internally we use only UTC
-SYSTEMTIME Time64ToLocalTime(const time64& time) {
-  FILETIME file_time;
-  SetZero(file_time);
-  Time64ToFileTime(time, &file_time);
-
-  FILETIME local_file_time;
-  SetZero(local_file_time);
-  if (!FileTimeToLocalFileTime(&file_time, &local_file_time)) {
-    UTIL_LOG(LE, (_T("[Time64ToLocalTime]")
-                  _T("[failed to FileTimeToLocalFileTime][0x%x]"),
-                  HRESULTFromLastError()));
-  }
-
-  SYSTEMTIME local_time;
-  SetZero(local_time);
-  if (!FileTimeToSystemTime(&local_file_time, &local_time)) {
-    UTIL_LOG(LE, (_T("[Time64ToLocalTime]")
-                  _T("[failed to FileTimeToSystemTime][0x%x]"),
-                  HRESULTFromLastError()));
-  }
-
-  return local_time;
-}
-
-time64 FileTimeToTime64(const FILETIME & file_time) {
-  return static_cast<time64>(
-      file_time.dwHighDateTime) << 32 | file_time.dwLowDateTime;
-}
-
-void Time64ToFileTime(const time64 & time, FILETIME *ft) {
-  ASSERT(ft, (L""));
-
-  ft->dwHighDateTime = static_cast<DWORD>(time >> 32);
-  ft->dwLowDateTime = static_cast<DWORD>(time & 0xffffffff);
-}
-
-// Convert from FILETIME to time_t
-time_t FileTimeToTimeT(const FILETIME& file_time) {
-  return static_cast<time_t>(
-      (FileTimeToTime64(file_time) - kTimeTConvValue) / kSecsTo100ns);
-}
-
-// Convert from time_t to FILETIME
-void TimeTToFileTime(const time_t& time, FILETIME* file_time) {
-  ASSERT1(file_time);
-
-  LONGLONG ll = Int32x32To64(time, kSecsTo100ns) + kTimeTConvValue;
-  file_time->dwLowDateTime = static_cast<DWORD>(ll);
-  file_time->dwHighDateTime = static_cast<DWORD>(ll >> 32);
-}
-
-// Parses RFC 822 Date/Time format
-//    5.  DATE AND TIME SPECIFICATION
-//     5.1.  SYNTAX
-//
-//     date-time   =  [ day "," ] date time        ; dd mm yy
-//                                                 ;  hh:mm:ss zzz
-//     day         =  "Mon"  / "Tue" /  "Wed"  / "Thu"
-//                 /  "Fri"  / "Sat" /  "Sun"
-//
-//     date        =  1*2DIGIT month 2DIGIT        ; day month year
-//                                                 ;  e.g. 20 Jun 82
-//
-//     month       =  "Jan"  /  "Feb" /  "Mar"  /  "Apr"
-//                 /  "May"  /  "Jun" /  "Jul"  /  "Aug"
-//                 /  "Sep"  /  "Oct" /  "Nov"  /  "Dec"
-//
-//     time        =  hour zone                    ; ANSI and Military
-//
-//     hour        =  2DIGIT ":" 2DIGIT [":" 2DIGIT]
-//                                                 ; 00:00:00 - 23:59:59
-//
-//     zone        =  "UT"  / "GMT"                ; Universal Time
-//                                                 ; North American : UT
-//                 /  "EST" / "EDT"                ;  Eastern:  - 5/ - 4
-//                 /  "CST" / "CDT"                ;  Central:  - 6/ - 5
-//                 /  "MST" / "MDT"                ;  Mountain: - 7/ - 6
-//                 /  "PST" / "PDT"                ;  Pacific:  - 8/ - 7
-//                 /  1ALPHA                       ; Military: Z = UT;
-//                                                 ;  A:-1; (J not used)
-//                                                 ;  M:-12; N:+1; Y:+12
-//                 / ( ("+" / "-") 4DIGIT )        ; Local differential
-//                                                 ;  hours+min. (HHMM)
-// return local time if ret_local_time == true,
-// return time is GMT / UTC time otherwise
-bool RFC822DateToSystemTime(const TCHAR* str_RFC822_date,
-                            SYSTEMTIME* psys_time,
-                            bool ret_local_time) {
-  ASSERT(str_RFC822_date != NULL, (L""));
-  ASSERT(psys_time != NULL, (L""));
-
-  CString str_date = str_RFC822_date;
-  CString str_token;
-  int cur_pos = 0;
-
-  str_token= str_date.Tokenize(kRFC822_DateDelimiters, cur_pos);
-  if (str_token == "")
-    return false;
-
-  int i = 0;
-  for (i = 0; i < kNumOfDays; i++) {
-    if (str_token == kRFC822_Day[i]) {
-      str_token = str_date.Tokenize(kRFC822_DateDelimiters, cur_pos);
-      if (str_token == "")
-        return false;
-      break;
-    }
-  }
-
-  int day = String_StringToInt(str_token);
-  if (day < 0 || day > 31)
-    return false;
-
-  str_token = str_date.Tokenize(kRFC822_DateDelimiters, cur_pos);
-  if (str_token == "")
-    return false;
-
-  int month = -1;
-  for (i = 0; i < kNumOfMonth; i++) {
-    if (str_token == kRFC822_Month[i]) {
-      month = i+1;  // month is 1 based number
-      break;
-    }
-  }
-  if (month == -1)  // month not found
-    return false;
-
-  str_token = str_date.Tokenize(kRFC822_DateDelimiters, cur_pos);
-  if (str_token == "")
-    return false;
-
-  int year = String_StringToInt(str_token);
-  if (year < 100)  // two digit year format, convert to 1950 - 2050 range
-    if (year < 50)
-      year += 2000;
-    else
-      year += 1900;
-
-  str_token = str_date.Tokenize(kRFC822_DateDelimiters, cur_pos);
-  if (str_token == "")
-    return false;
-
-  int hour = String_StringToInt(str_token);
-  if (hour < 0 || hour > 23)
-    return false;
-
-  str_token = str_date.Tokenize(kRFC822_DateDelimiters, cur_pos);
-  if (str_token == "")
-    return false;
-
-  int minute = String_StringToInt(str_token);
-  if (minute < 0 || minute > 59)
-    return false;
-
-  str_token = str_date.Tokenize(kRFC822_DateDelimiters, cur_pos);
-  if (str_token == "")
-    return false;
-
-  int second = 0;
-  // distingushed between XX:XX and XX:XX:XX time formats
-  if (str_token.GetLength() == 2 &&
-      String_IsDigit(str_token[0]) &&
-      String_IsDigit(str_token[1])) {
-    second = String_StringToInt(str_token);
-    if (second < 0 || second > 59)
-      return false;
-
-    str_token = str_date.Tokenize(kRFC822_DateDelimiters, cur_pos);
-    if (str_token == "")
-      return false;
-  }
-
-  int bias = 0;
-  if (str_token[0] == '+' ||
-      str_token[0] == '-' ||
-      String_IsDigit(str_token[0])) {  // numeric format
-    int zone = String_StringToInt(str_token);
-
-    // zone is in HHMM format, need to convert to the number of minutes
-    bias = (zone / 100) * 60 + (zone % 100);
-  } else {  // text format
-    for (i = 0; i < sizeof(kRFC822_TimeZone) / sizeof(TimeZoneInfo); i++)
-      if (str_token == kRFC822_TimeZone[i].zone_name) {
-        bias = kRFC822_TimeZone[i].hour_dif * 60;
-        break;
-      }
-  }
-
-  SYSTEMTIME mail_time;
-  memset(&mail_time, 0, sizeof(mail_time));
-
-  mail_time.wYear   = static_cast<WORD>(year);
-  mail_time.wMonth  = static_cast<WORD>(month);
-  mail_time.wDay    = static_cast<WORD>(day);
-  mail_time.wHour   = static_cast<WORD>(hour);
-  mail_time.wMinute = static_cast<WORD>(minute);
-  mail_time.wSecond = static_cast<WORD>(second);
-
-  // TzSpecificLocalTimeToSystemTime() is incompatible with Win 2000,
-  // convert time manually here
-  time64 time_64 = SystemTimeToTime64(&mail_time);
-  time_64 = time_64 - (bias*kMinsTo100ns);
-
-  *psys_time = Time64ToSystemTime(time_64);
-
-  if (ret_local_time) {
-    TIME_ZONE_INFORMATION local_time_zone_info;
-    SYSTEMTIME universal_time = *psys_time;
-
-    if (GetTimeZoneInformation(&local_time_zone_info) == TIME_ZONE_ID_INVALID) {
-      return false;
-    }
-    if (!SystemTimeToTzSpecificLocalTime(&local_time_zone_info,
-                                    &universal_time,
-                                    psys_time)) {
-      return false;
-    }
-  }
-  return true;
-}
-
-}  // namespace omaha
-
diff --git a/base/time.h b/base/time.h
deleted file mode 100644
index 60c6083..0000000
--- a/base/time.h
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Time functions
-
-#ifndef OMAHA_BASE_TIME_H_
-#define OMAHA_BASE_TIME_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-#define kMicrosecsTo100ns (10ULL)
-#define kMillisecsTo100ns (10000ULL)
-#define kSecsTo100ns (1000 * kMillisecsTo100ns)
-#define kMinsTo100ns (60 * kSecsTo100ns)
-#define kHoursTo100ns (60 * kMinsTo100ns)
-#define kDaysTo100ns (24 * kHoursTo100ns)
-
-// Jan 1 1980 was tuesday (day 2)
-#define kStartSystemTime {1980, 1, 2, 1, 0, 0, 0, 0}
-
-// this is Jan 1 1980 in time64
-#define kStart100NsTime (119600064000000000uI64)
-#define kTimeGranularity (kDaysTo100ns)
-
-// 2^15-1 because we use signed delta times
-#define kTime16Max ((1 << 15) - 1)
-
-// Constant value used in conversion between FILETIME and time_t
-// It is the time difference between January 1, 1601 and January 1, 1970
-#define kTimeTConvValue (116444736000000000)
-
-typedef uint16 time16;
-typedef uint64 time64;
-
-time64 ConvertTime16ToTime64(uint16 time16);
-uint16 ConvertTime64ToTime16(time64 time);
-
-#ifdef _DEBUG
-void ComputeStartTime();
-#endif
-
-uint64 GetCurrent100NSTime();
-
-uint64 GetCurrentMsTime();
-
-// Note - these return 0 if we can't convert the time
-time64 SystemTimeToTime64(const SYSTEMTIME *sys_time);
-
-// Conversions to/from values compatible with
-// EXE/DLL timestamps and the C time() function
-// NOTE: behavior is independent of wMilliseconds value
-int32  SystemTimeToInt32(const SYSTEMTIME *sys_time);
-int32  Time64ToInt32(const time64 & time);
-time64 Int32ToTime64(const int32 & time);
-time64 TimeTToTime64(const time_t& old_value);
-
-// Returns the system time in GMT
-SYSTEMTIME Time64ToSystemTime(const time64 & time);
-
-// Returns the system time in the computer's time zone
-SYSTEMTIME Time64ToLocalTime(const time64 & time);
-
-// Returns the UTC (system) time given the local time
-SYSTEMTIME LocalTimeToSystemTime(const SYSTEMTIME *local_time);
-
-// This returns a standard formatted string that represents
-// the UTC time corresponding to 'ft'.  This is suitable for use
-// in e.g. HTTP headers.
-//
-// @note IMPORTANT!  This does not return a localized string - it's
-// always in English.  The string returned is intended for use in
-// machine-readable contexts, i.e. HTTP headers and thus should not
-// be localized.
-CString ConvertTimeToGMTString(const FILETIME *ft);
-
-// Convert to and from FileTime
-time64 FileTimeToTime64(const FILETIME & file_time);
-void Time64ToFileTime(const time64 & time, FILETIME *ft);
-
-void SetTimeOverride(const time64 & time_new);
-
-// Convert from FILETIME to time_t
-time_t FileTimeToTimeT(const FILETIME& file_time);
-
-// Convert from time_t to FILETIME
-void TimeTToFileTime(const time_t& time, FILETIME* file_time);
-
-// Parses RFC 822 Date/Time format
-//    5.  DATE AND TIME SPECIFICATION
-//     5.1.  SYNTAX
-//
-//     date-time   =  [ day "," ] date time        ; dd mm yy
-//                                                 ;  hh:mm:ss zzz
-//     day         =  "Mon"  / "Tue" /  "Wed"  / "Thu"
-//                 /  "Fri"  / "Sat" /  "Sun"
-//
-//     date        =  1*2DIGIT month 2DIGIT        ; day month year
-//                                                 ;  e.g. 20 Jun 82
-//
-//     month       =  "Jan"  /  "Feb" /  "Mar"  /  "Apr"
-//                 /  "May"  /  "Jun" /  "Jul"  /  "Aug"
-//                 /  "Sep"  /  "Oct" /  "Nov"  /  "Dec"
-//
-//     time        =  hour zone                    ; ANSI and Military
-//
-//     hour        =  2DIGIT ":" 2DIGIT [":" 2DIGIT]
-//                                                 ; 00:00:00 - 23:59:59
-//
-//     zone        =  "UT"  / "GMT"                ; Universal Time
-//                                                 ; North American : UT
-//                 /  "EST" / "EDT"                ;  Eastern:  - 5/ - 4
-//                 /  "CST" / "CDT"                ;  Central:  - 6/ - 5
-//                 /  "MST" / "MDT"                ;  Mountain: - 7/ - 6
-//                 /  "PST" / "PDT"                ;  Pacific:  - 8/ - 7
-//                 /  1ALPHA                       ; Military: Z = UT;
-//                                                 ;  A:-1; (J not used)
-//                                                 ;  M:-12; N:+1; Y:+12
-//                 / ( ("+" / "-") 4DIGIT )        ; Local differential
-//                                                 ;  hours+min. (HHMM)
-// return local time if ret_local_time == true,
-// return time is GMT / UTC time otherwise
-bool RFC822DateToSystemTime(const TCHAR* str_RFC822_date,
-                            SYSTEMTIME* psys_time,
-                            bool ret_local_time);
-
-// TODO(omaha): overlap in functionality with FileTimeToTime64. Consider
-// removing this one.
-inline int64 FileTimeToInt64(const FILETIME& filetime) {
-  LARGE_INTEGER large_int = {filetime.dwLowDateTime, filetime.dwHighDateTime};
-  return large_int.QuadPart;
-}
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_TIME_H_
diff --git a/base/time_unittest.cc b/base/time_unittest.cc
deleted file mode 100644
index 60f13de..0000000
--- a/base/time_unittest.cc
+++ /dev/null
@@ -1,189 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Time unittest
-
-#include <atltime.h>
-
-#include "omaha/base/time.h"
-#include "omaha/base/utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-// Test generation of int32 time values (which uses Time64ToInt32 internally).
-TEST(TimeTest, SystemTimeToInt32NearEpoch) {
-  // Try a simple value near the start of int32 time.
-  SYSTEMTIME system_time = {1970,  // year
-                            1,     // month (1 == January)
-                            0,     // day of week (0 == Sunday)
-                            2,     // day of month
-                            0,     // hour
-                            0,     // minute
-                            0,     // second
-                            0};    // msec
-  system_time.wMilliseconds = 0;
-  int32 time1 = SystemTimeToInt32(&system_time);
-  system_time.wMilliseconds = 999;
-  int32 time2 = SystemTimeToInt32(&system_time);
-
-  // Make sure result is independent of milliseconds value.
-  ASSERT_EQ(time1, time2);
-
-  // 00:00:00 on 1970/01/02 should return the number of seconds in 1 day.
-  ASSERT_EQ(time1, (60*60*24));
-}
-
-// Test an empirical value taken from running dumpbin.exe on a DLL.
-// (IMPORTANT: ran this *after* setting machine's time zone to GMT,
-//  without daylight savings).
-// 40AEE7AA time date stamp Sat May 22 05:39:54 2004
-TEST(TimeTest, SystemTimeToInt32) {
-  SYSTEMTIME system_time = {2004, 5, 6, 22, 5, 39, 54, 0};
-  int32 time = SystemTimeToInt32(&system_time);
-  ASSERT_EQ(time, 0x40AEE7AA);
-}
-
-// Test conversion between int32 and time64 values.
-// By testing SystemTimeToInt32 above, we've already checked Time64ToInt32
-// against empirical values, so it's okay to simply test back-and-forth
-// conversion here.
-TEST(TimeTest, Conversion) {
-  // Simple checks when starting with int32 values, because time64 has more
-  // precision.
-  ASSERT_EQ(Time64ToInt32(Int32ToTime64(0x12345678)), 0x12345678);
-  ASSERT_EQ(Time64ToInt32(Int32ToTime64(INT_MAX)), INT_MAX);
-  ASSERT_EQ(Time64ToInt32(Int32ToTime64(0)), 0);
-
-  // Extra conversions when going opposite direction because int32 has less
-  // precision.
-  ASSERT_EQ(Int32ToTime64(Time64ToInt32(Int32ToTime64(0x12345678))),
-            Int32ToTime64(0x12345678));
-  ASSERT_EQ(Int32ToTime64(Time64ToInt32(Int32ToTime64(INT_MAX))),
-            Int32ToTime64(INT_MAX));
-  ASSERT_EQ(Int32ToTime64(Time64ToInt32(Int32ToTime64(0))),
-            Int32ToTime64(0));
-}
-
-void TimeToStringTest(FILETIME *ft, bool daylight_savings_time) {
-  CTime t(*ft, daylight_savings_time);
-  CString date1(t.FormatGmt(_T("%a, %d %b %Y %H:%M:%S GMT")));
-  CString date2(ConvertTimeToGMTString(ft));
-
-  ASSERT_STREQ(date1, date2);
-}
-
-TEST(TimeTest, TimeToStringTest) {
-  bool daylight_savings_time = false;
-  TIME_ZONE_INFORMATION tz;
-  if (GetTimeZoneInformation(&tz) == TIME_ZONE_ID_DAYLIGHT) {
-    daylight_savings_time = true;
-  }
-
-  FILETIME file_time;
-  ::GetSystemTimeAsFileTime(&file_time);
-  TimeToStringTest(&file_time, daylight_savings_time);
-
-  uint64 t = FileTimeToTime64(file_time);
-
-  // months
-  for (int i = 0; i < 13; i++) {
-    t += (24 * kHoursTo100ns) * 28;
-    Time64ToFileTime(t, &file_time);
-    TimeToStringTest(&file_time, daylight_savings_time);
-  }
-
-  // days
-  for (int i = 0; i < 30; i++) {
-    t += (24 * kHoursTo100ns);
-    Time64ToFileTime(t, &file_time);
-    TimeToStringTest(&file_time, daylight_savings_time);
-  }
-
-  // hours
-  for (int i = 0; i < 24; i++) {
-    t += (24 * kHoursTo100ns);
-    Time64ToFileTime(t, &file_time);
-    TimeToStringTest(&file_time, daylight_savings_time);
-  }
-}
-
-TEST(TimeTest, RFC822TimeParsing) {
-  SYSTEMTIME time = {0};
-  ASSERT_TRUE(RFC822DateToSystemTime(_T("Mon, 16 May 2005 15:44:18 -0700"),
-                                     &time,
-                                     false));
-  ASSERT_EQ(time.wYear , 2005);
-  ASSERT_EQ(time.wMonth , 5);
-  ASSERT_EQ(time.wDay , 16);
-  ASSERT_EQ(time.wHour , 22);
-  ASSERT_EQ(time.wMinute , 44);
-  ASSERT_EQ(time.wSecond , 18);
-
-  ASSERT_TRUE(RFC822DateToSystemTime(_T("Mon, 16 May 2005 15:44:18 -0700"),
-                                     &time,
-                                     true));
-  ASSERT_EQ(time.wYear , 2005);
-  ASSERT_EQ(time.wMonth , 5);
-  ASSERT_EQ(time.wDay , 16);
-  ASSERT_TRUE(time.wHour == 15 || time.wHour == 14);  // daylight saving time
-  ASSERT_EQ(time.wMinute , 44);
-  ASSERT_EQ(time.wSecond , 18);
-
-  ASSERT_TRUE(RFC822DateToSystemTime(_T("Tue, 17 May 2005 02:56:18 +0400"),
-                                     &time,
-                                     false));
-  ASSERT_EQ(time.wYear , 2005);
-  ASSERT_EQ(time.wMonth , 5);
-  ASSERT_EQ(time.wDay , 16);
-  ASSERT_EQ(time.wHour , 22);
-  ASSERT_EQ(time.wMinute , 56);
-  ASSERT_EQ(time.wSecond , 18);
-
-  ASSERT_TRUE(RFC822DateToSystemTime(_T("Tue, 17 May 2005 02:56:18 +0400"),
-                                     &time,
-                                     true));
-  ASSERT_EQ(time.wYear , 2005);
-  ASSERT_EQ(time.wMonth , 5);
-  ASSERT_EQ(time.wDay , 16);
-  ASSERT_TRUE(time.wHour == 15 || time.wHour == 14);  // daylight saving time
-  ASSERT_EQ(time.wMinute , 56);
-  ASSERT_EQ(time.wSecond , 18);
-}
-
-TEST(TimeTest, FileTimeToInt64) {
-  {
-  FILETIME file_time = {0};
-  EXPECT_EQ(0, FileTimeToInt64(file_time));
-  }
-
-  {
-  FILETIME file_time = {LONG_MAX, 0};
-  EXPECT_EQ(LONG_MAX, FileTimeToInt64(file_time));
-  }
-
-  {
-  FILETIME file_time = {ULONG_MAX, 0};
-  EXPECT_EQ(ULONG_MAX, FileTimeToInt64(file_time));
-  }
-
-  {
-  FILETIME file_time = {ULONG_MAX, ULONG_MAX};
-  EXPECT_EQ(kuint64max, FileTimeToInt64(file_time));
-  }
-}
-
-}  // namespace omaha
-
diff --git a/base/timer.cc b/base/timer.cc
deleted file mode 100644
index 60ffa7e..0000000
--- a/base/timer.cc
+++ /dev/null
@@ -1,218 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Timing
-
-#include "omaha/base/timer.h"
-#include "omaha/base/commontypes.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/string.h"
-#include "omaha/base/time.h"
-
-namespace omaha {
-
-// LowResTimer class is implemented on top of ::GetTickCount.
-// ::GetTickCount wraps around every 49.7 days. The code can't handle
-// this condition so there is a small probability that something can go
-// wrong.
-LowResTimer::LowResTimer(bool running)
-    : running_(false), iterations_(0), elapsed_(0), start_(0) {
-  if (running) {
-    Start();
-  }
-}
-
-LowResTimer::~LowResTimer() {
-}
-
-void LowResTimer::Reset() {
-  elapsed_ = 0;
-  running_ = 0;
-  iterations_ = 0;
-}
-
-void LowResTimer::Start() {
-  ASSERT1(!running_);
-
-  start_ = ::GetTickCount();
-  running_ = 1;
-}
-
-uint32 LowResTimer::Stop() {
-  ASSERT1(running_);
-
-  uint32 stop = ::GetTickCount();
-  ASSERT1(stop >= start_);
-  uint32 diff = stop - start_;
-  elapsed_ += diff;
-  iterations_++;
-  running_ = 0;
-  return diff;
-}
-
-uint32 LowResTimer::GetMilliseconds() const {
-  uint32 running_time = 0;
-  if (running_) {
-    uint32 now = ::GetTickCount();
-    ASSERT1(now >= start_);
-    running_time = now - start_;
-  }
-  return elapsed_ + running_time;
-}
-
-// statics
-// get the frequency only once
-SELECTANY time64 Timer::count_freq_ = 0;
-
-Timer::Timer(bool running)
-    : running_(0), iterations_(0), elapsed_(0), start_(0), split_(0) {
-  // initialize only once
-  if (count_freq_ == 0) {
-    count_freq_ = GetRdtscFrequency();
-    if (count_freq_ <= 1) {
-       UTIL_LOG(LEVEL_ERROR,
-          (_T("[Timer::Timer - high-res counter not supported]")));
-       count_freq_ = 1;
-    }
-  }
-  if (running) {
-    Start();
-  }
-}
-
-Timer::~Timer() {
-}
-
-void Timer::Reset() {
-  elapsed_ = 0;
-  running_ = 0;
-  iterations_ = 0;
-}
-
-void Timer::Start() {
-  ASSERT1(!running_);
-
-  start_ = GetRdtscCounter();
-  split_ = start_;
-  running_ = 1;
-}
-
-void Timer::Split(double* split_time_ms, double* total_time_ms) {
-  ASSERT1(running_);
-
-  time64 now = GetRdtscCounter();
-  if (split_time_ms) {
-    *split_time_ms = PerfCountToNanoSeconds(now - split_)/ 1000000;
-  }
-  if (total_time_ms) {
-    *total_time_ms =
-        PerfCountToNanoSeconds(elapsed_ + (now - start_)) / 1000000;
-  }
-  split_ = now;
-}
-
-time64 Timer::Stop() {
-  ASSERT1(running_);
-
-  time64 stop = GetRdtscCounter();
-  time64 diff = stop - start_;
-  elapsed_ += diff;
-  iterations_++;
-  running_ = 0;
-  return diff;
-}
-
-double Timer::GetNanoseconds() const {
-  time64 running_time = 0;
-  if (running_) {
-    time64 now = GetRdtscCounter();
-    running_time = now - start_;
-  }
-  return PerfCountToNanoSeconds(elapsed_ + running_time);
-}
-
-#ifdef _DEBUG
-CString Timer::DebugString() const {
-  CString s;
-  double seconds = GetSeconds();
-  if (iterations_) {
-    s.Format(_T("%s sec %d iterations %s sec/iteration"),
-             String_DoubleToString(seconds, 3), iterations_,
-             String_DoubleToString(seconds/iterations_, 3));
-  } else {
-    s.Format(_T("%s sec"), String_DoubleToString(seconds, 3));
-  }
-  return s;
-}
-#endif
-
-// Computes the frequency (ticks/sec) for the CPU tick-count timer (RDTSC)
-// Don't call this function frequently, because computing the frequency is slow
-// (relatively).
-//
-// TODO(omaha): check return values, and return 0 on failure.
-// But hard to imagine a machine where our program will install/run but this
-// will fail.
-time64 Timer::GetRdtscFrequency() {
-  //
-  // Get elapsed RDTSC and elapsed QPC over same time period
-  //
-
-  // compute length of time period to measure
-  time64 freq_qpc = 0;  // ticks per second
-  ::QueryPerformanceFrequency(reinterpret_cast<LARGE_INTEGER*>(&freq_qpc));
-
-  // fraction of second to run timers for; tradeoff b/w speed and accuracy;
-  // 1/1000 (1 msec) seems like good tradeoff
-  time64 interval_qpc = freq_qpc / 1000;
-
-  // get timer values over same time period
-  time64 begin_qpc = 0;
-  time64 end_qpc = 0;
-
-  ::QueryPerformanceCounter(reinterpret_cast<LARGE_INTEGER*>(&begin_qpc));
-
-  time64 begin_rdtsc = Timer::GetRdtscCounter();
-
-  // spin and protect against infinite loop, if QPC does something wacky
-  int count = 0;
-  const int count_max = 200000;
-  do {
-    ::QueryPerformanceCounter(reinterpret_cast<LARGE_INTEGER*>(&end_qpc));
-    ++count;
-  } while ((end_qpc - begin_qpc) < interval_qpc  &&  count < count_max);
-
-  ::QueryPerformanceCounter(reinterpret_cast<LARGE_INTEGER*>(&end_qpc));
-  time64 end_rdtsc = Timer::GetRdtscCounter();
-
-  ASSERT(count < count_max, (_T("If this assert fires, your machine is either ")
-                             _T("very fast, or very broken.  Increase the ")
-                             _T("value of const_max to fix this assert.")));
-
-  //
-  // Compute RDTSC frequency from QPC frequency
-  //
-
-  time64 diff_qpc = end_qpc - begin_qpc;
-  time64 diff_rdtsc = end_rdtsc - begin_rdtsc;
-
-  time64 freq_rdtsc = freq_qpc * diff_rdtsc / diff_qpc;
-
-  return freq_rdtsc;
-}
-
-}  // namespace omaha
-
diff --git a/base/timer.h b/base/timer.h
deleted file mode 100644
index 3198d31..0000000
--- a/base/timer.h
+++ /dev/null
@@ -1,186 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Timing
-
-#ifndef OMAHA_BASE_TIMER_H_
-#define OMAHA_BASE_TIMER_H_
-
-#include "omaha/base/time.h"
-
-namespace omaha {
-
-// Low resolution timer which can be used to time loops. The resolution depends
-// on the platform and can be expected to be about 10 ms on Windows 2000 and up.
-class LowResTimer {
- public:
-  explicit LowResTimer(bool running);
-  ~LowResTimer();
-
-  // LowResTimer keeps track of elapsed time, which can consist of multiple
-  // Start()-Stop() intervals.
-  void Start();
-
-  // Returns time between Start and Stop call and increments the time elapsed.
-  uint32 Stop();
-  void Reset();
-
-  // Return time in seconds, milliseconds.
-  double GetSeconds() const;
-  uint32 GetMilliseconds() const;
-
-  // Gets the number of iteration this timer was started/stopped.
-  uint32 GetIterations() const { return iterations_; }
-  bool IsRunning() const { return running_; }
-
- private:
-
-  bool running_;
-  uint32 start_;
-  uint32 elapsed_;
-  uint32 iterations_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(LowResTimer);
-};
-
-inline double LowResTimer::GetSeconds() const {
-  return static_cast<double>(GetMilliseconds()) / 1000;
-}
-
-// WARNING - Timer is implemented on top of RDTSC and
-// QueryPerformanceCounter which have undefined behavior when running
-// on multi-core, speedstep, bugs in HAL, certain chipsets, etc.
-// Do not use the Timer in production code where the execution flow
-// depends on timing. Timer is primarily intended to be used for
-// code profiling and performance measurements.
-class Timer {
- public:
-  explicit Timer(bool running);
-  ~Timer();
-
-  // Timer keeps track of elapsed time, which can consist of multiple
-  // Start()-Stop() intervals.
-  void Start();
-
-  // returns time for last split (elapsed time since Start() or time since
-  // last Split(), whichever came last) as well as total elapsed time.
-  void Split(double* split_time_ms, double* total_time_ms);
-
-  // returns time elapsed (in hi-res perf-counts) between Start and Stop call
-  // and increments the time elapsed_
-  time64 Stop();
-  void Reset();
-
-  // return time in seconds, milliseconds, etc.
-  double GetSeconds() const;
-  double GetMilliseconds() const;
-  double GetMicroseconds() const;
-  double GetNanoseconds() const;
-  time64 Get100Nanoseconds() const;
-
-  // TODO(omaha): Probably should have been a static method, or even
-  // standalone func convert the high-perf counter to nano-seconds
-  double PerfCountToNanoSeconds(time64 perf_count) const;
-
-  // get the number of iteration this timer was started/stopped
-  uint32 GetIterations() const { return iterations_; }
-  bool IsRunning() const { return running_; }
-
-  // useful funcs beyond just the Timer class
-  static time64 GetRdtscCounter();  // return perf-counter value
-  static time64 GetRdtscFrequency();  // return perf-counter frequency
-
-    // outputs total time, number of iterations, and the average time
-#ifdef _DEBUG
-  CString DebugString() const;
-#endif
-
- private:
-
-  bool running_;
-  time64 start_;
-  time64 split_;
-  time64 elapsed_;
-  uint32 iterations_;
-  static time64 count_freq_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(Timer);
-};
-
-// lint -e{533}  Function should return a value
-// lint -e{31}   Redefinition of symbol
-__forceinline time64 Timer::GetRdtscCounter() { __asm rdtsc }
-
-inline double Timer::PerfCountToNanoSeconds(time64 perf_count) const {
-  return (static_cast<double>(perf_count) / static_cast<double>(count_freq_)) *
-         static_cast<double>(1000000000.0);
-}
-
-inline double Timer::GetSeconds() const {
-  return GetNanoseconds() / 1000000000;
-}
-
-inline double Timer::GetMilliseconds() const {
-  return GetNanoseconds() / 1000000;
-}
-
-inline double Timer::GetMicroseconds() const {
-  return GetNanoseconds() / 1000;
-}
-
-inline time64 Timer::Get100Nanoseconds() const {
-  return (time64) GetNanoseconds() / 100;
-}
-
-// Helper class which starts the timer in its constructor and stops it
-// in its destructor.  This prevents accidentally leaving the timer running
-// if a function has an early exit.
-//
-// Usage:
-//
-// class A {
-//   Timer timer_;
-//
-//   void foo(){
-//     TimerScope (timer_);
-//   ......
-//   }  // end foo
-//
-// Everything is timed till the end of the function or when it returns
-// from any place.
-
-class TimerScope {
- public:
-  explicit TimerScope(Timer *timer) : timer_(timer) {
-    if (timer_) {
-      timer_->Start();
-    }
-  }
-
-  ~TimerScope() {
-    if (timer_ && timer_->IsRunning()) {
-      timer_->Stop();
-    }
-  }
-
- private:
-  Timer *timer_;
-  DISALLOW_EVIL_CONSTRUCTORS(TimerScope);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_TIMER_H_
-
diff --git a/base/timer_unittest.cc b/base/timer_unittest.cc
deleted file mode 100644
index 71058c4..0000000
--- a/base/timer_unittest.cc
+++ /dev/null
@@ -1,235 +0,0 @@
-// Copyright 2003-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Timer unittest
-
-#include <cmath>
-#include "omaha/base/time.h"
-#include "omaha/base/timer.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-// The accuracy of the unit test measurements is expected to be within 50 ms.
-// The error varies depending on how the unit test process gets scheduled.
-// The timer test is prone to failing when run by Pulse. Consider diabling the
-// test completely.
-const int kErrorMs = 50;
-
-// The tests that use the Timer class are flaky (see warning in timer.h),
-// and Timer isn't used in production Omaha code, so we leave out everything
-// but the LowResTimer test.
-// TODO(omaha): Is there a better way to do this? Maybe not run on build system?
-#if 0
-
-class TimerTest : public testing::Test {
- protected:
-  // Set up a test so that we can measure the same time interval using the
-  // low and high resolution timers. If the difference between them is too
-  // big then we consider that the high resolution time is busted and we
-  // stop running the unit tests.
-  // The high resolution timer may have undefined behavior, see the header
-  // file for more comments.
-  static void SetUpTestCase() {
-    const int kSleepMs = 100;
-    const int kDiffMs = 1;
-    LowResTimer t(false);
-    Timer u(false);
-    t.Start();
-    u.Start();
-    ::Sleep(kSleepMs);
-    busted_ = abs(t.GetMilliseconds()- u.GetMilliseconds()) >= kErrorMs;
-  }
-
-  void PrintError() {
-    // This is going to print "Test Foo is busted but passed."
-    printf("is busted but ");
-  }
-
-  static bool busted_;
-};
-
-bool TimerTest::busted_ = false;
-
-#endif  // #if 0
-
-TEST(TimerTest, LowResTimer) {
-  // This test was flaky on the build machine.
-  // TODO(omaha): Is this still the case? Can we improve the test?
-  if (omaha::IsBuildSystem()) {
-    return;
-  }
-
-  LowResTimer t(false);
-
-  const int kSleep1 = 100;
-  t.Start();
-  ::Sleep(kSleep1);
-  uint32 elapsedMs = t.Stop();
-
-  // For the first run of the timer the elapsed value must be equal to
-  // the timer interval.
-  EXPECT_EQ(elapsedMs, t.GetMilliseconds());
-
-  // About 100 ms now.
-  EXPECT_NEAR(kSleep1, elapsedMs, kErrorMs);
-
-  // Test the accessors of different time units.
-  EXPECT_DOUBLE_EQ(t.GetSeconds() * 1000, t.GetMilliseconds());
-
-  const int kSleep2 = 10;
-  t.Start();
-  ::Sleep(kSleep2);
-  elapsedMs = t.Stop();
-  EXPECT_NEAR(kSleep2, elapsedMs, kErrorMs);
-
-  // About 110 ms now.
-  EXPECT_NEAR(kSleep1 + kSleep2, t.GetMilliseconds(), 2 * kErrorMs);
-
-  const int kSleep3 = 50;
-  t.Start();
-  ::Sleep(kSleep3);
-  elapsedMs = t.Stop();
-  EXPECT_NEAR(kSleep3, elapsedMs, kErrorMs);
-
-  // About 160 ms now.
-  EXPECT_NEAR(kSleep1 + kSleep2 + kSleep3, t.GetMilliseconds(), 3 * kErrorMs);
-
-  t.Reset();
-  EXPECT_EQ(0, t.GetMilliseconds());
-}
-
-// Tests disabled, see comment at top of file.
-#if 0
-// Test that values from RTDSC change quickly.
-TEST_F(TimerTest, RTDSC) {
-  uint32 last = 0;
-  for (int i = 0; i < 10; ++i) {
-    uint64 counter = Timer::GetRdtscCounter();
-    uint32 a = *(reinterpret_cast<uint32 *>(&counter));
-    ASSERT_NE(a, last);
-    last = a;
-  }
-}
-
-// Compare everything as ms units for uniformity.
-
-TEST_F(TimerTest, Timer) {
-  if (busted_) {
-    PrintError();
-    return;
-  }
-
-  Timer t(false);
-
-  const int kSleep1 = 100;
-  t.Start();
-  ::Sleep(kSleep1);
-  time64 elapsed = t.Stop();
-
-  // For the first run of the timer the elapsed value must be equal to
-  // the timer interval.
-  EXPECT_DOUBLE_EQ(t.PerfCountToNanoSeconds(elapsed) / 1000000,
-                   t.GetNanoseconds() / 1000000);
-
-  // About 100 ms now.
-  EXPECT_NEAR(kSleep1, t.PerfCountToNanoSeconds(elapsed) / 1000000, kErrorMs);
-
-  // Test the accessors of different time units.
-  EXPECT_DOUBLE_EQ(t.GetSeconds() * 1000, t.GetMilliseconds());
-  EXPECT_DOUBLE_EQ(t.GetMilliseconds() * 1000, t.GetMicroseconds());
-  EXPECT_DOUBLE_EQ(t.GetMicroseconds() * 1000, t.GetNanoseconds());
-
-  EXPECT_NEAR(t.Get100Nanoseconds() * 100.0, t.GetNanoseconds(), 100);
-
-  const int kSleep2 = 10;
-  t.Start();
-  ::Sleep(kSleep2);
-  elapsed = t.Stop();
-  EXPECT_NEAR(kSleep2, t.PerfCountToNanoSeconds(elapsed) / 1000000, kErrorMs);
-
-  // About 110 ms now.
-  EXPECT_NEAR(kSleep1 + kSleep2, t.GetMilliseconds(), 2 * kErrorMs);
-
-  const int kSleep3 = 50;
-  t.Start();
-  ::Sleep(kSleep3);
-  elapsed = t.Stop();
-  EXPECT_NEAR(kSleep3, t.PerfCountToNanoSeconds(elapsed) / 1000000, kErrorMs);
-
-  // About 160 ms now.
-  EXPECT_NEAR(kSleep1 + kSleep2 + kSleep3, t.GetMilliseconds(), 3 * kErrorMs);
-
-  t.Reset();
-  EXPECT_DOUBLE_EQ(0, t.GetMilliseconds());
-}
-
-TEST_F(TimerTest, TimerSplit) {
-  if (busted_) {
-    PrintError();
-    return;
-  }
-
-  const int kSleep1 = 50;
-  const int kSleep2 = 125;
-  const int kSleep3 = 25;
-
-  double split1(0), split2(0), split3(0);
-  double elapsed1(0), elapsed2(0);
-
-  Timer t(false);
-  t.Start();
-  ::Sleep(kSleep1);
-  t.Split(&split1, &elapsed1);
-  EXPECT_NEAR(split1, kSleep1, kErrorMs);
-  EXPECT_NEAR(elapsed1, kSleep1, kErrorMs);
-  EXPECT_DOUBLE_EQ(split1, elapsed1);
-
-  ::Sleep(kSleep2);
-  t.Split(&split2, &elapsed2);
-  EXPECT_NEAR(split2, kSleep2, kErrorMs);
-  EXPECT_DOUBLE_EQ(split1 + split2, elapsed2);
-
-  ::Sleep(kSleep3);
-  t.Split(&split3, NULL);
-  t.Stop();
-  EXPECT_NEAR(split3, kSleep3, kErrorMs);
-  EXPECT_NEAR(split1 + split2 + split3, t.GetMilliseconds(), kErrorMs);
-}
-
-// Time QueryPerformanceCounter
-TEST_F(TimerTest, QueryPerformanceCounter) {
-  if (busted_) {
-    PrintError();
-    return;
-  }
-
-  Timer t(false);
-  t.Start();
-
-  const int kIterations = 100;
-  LARGE_INTEGER count = {0};
-  for (int i = 0; i < kIterations; i++) {
-    ASSERT_TRUE(::QueryPerformanceCounter(&count));
-  }
-
-  t.Stop();
-
-  // Expect the call to take anywhere up to 1000 nano seconds.
-  EXPECT_NEAR(t.GetNanoseconds() / kIterations, 500, 500);
-}
-#endif  // #if 0
-
-}  // namespace omaha
diff --git a/base/tr_rand.cc b/base/tr_rand.cc
deleted file mode 100644
index 70ca496..0000000
--- a/base/tr_rand.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-//
-// Simple pseudo-random number generator.
-// Not intended for anything but random-to-humans numbers.
-// Very fast, and has a period of 32768 for all seed values (including zero).
-// Returns values in the range 0..0xFFFF (inclusive).
-//
-
-#include "omaha/base/tr_rand.h"
-
-namespace omaha {
-
-static int rand_val = 0;
-
-void tr_srand(unsigned int seed) {
-  rand_val = seed & 0xFFFF;
-}
-
-int tr_rand() {
-  rand_val = ((rand_val * 75) + 1) & 0xFFFF;
-  return rand_val;
-}
-
-}  // namespace omaha
-
diff --git a/base/tr_rand.h b/base/tr_rand.h
deleted file mode 100644
index e7469f5..0000000
--- a/base/tr_rand.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Simple pseudo-random number generator.
-// Not intended for anything but random-to-humans numbers.
-// Very fast, and has a period of 32768 for all seed values (including zero).
-// Returns values in the range 0..0xFFFF (inclusive).
-//
-
-#ifndef OMAHA_COMMON_TR_RAND_H_
-#define OMAHA_COMMON_TR_RAND_H_
-
-namespace omaha {
-
-#define kMaximumRandomValue 65535
-
-// Same prototypes as CRT srand/rand
-void tr_srand(unsigned int seed);
-int tr_rand();
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_TR_RAND_H_
diff --git a/base/tr_rand_unittest.cc b/base/tr_rand_unittest.cc
deleted file mode 100644
index 64a1500..0000000
--- a/base/tr_rand_unittest.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-
-#include <cstring>
-#include "omaha/base/tr_rand.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(TRRandTest, TRRand) {
-  int min_period = +99999;
-  int max_period = -99999;
-
-  int min_period_at = -99999;
-  int max_period_at = -99999;
-
-  byte hits[65536] = {0};
-  memset(hits, 0, sizeof(hits));
-
-  // Compute minimum and maximum period by considering all possible seed values.
-  for (int seed = 0; seed < 65536; ++seed) {
-    // See if value is part of some known sequence we've traversed.
-    // If multiple values map to same next-val, this check could cause us to
-    // report a min_period that's too short. But a long min_period still
-    // indicates success.
-    if (hits[seed]) { continue; }
-
-    // Compute length of period starting at this seed.
-    tr_srand(seed);
-    int i = seed;
-    int period = 0;
-    do {
-      ++hits[i];
-      ++period;
-      i = tr_rand();
-      ASSERT_GE(i, 0);
-    } while (hits[i] == 0);
-
-    // Update stats.
-    if (period < min_period) {
-      min_period = period;
-      min_period_at = seed;
-    }
-    if (period > max_period) {
-      max_period = period;
-      max_period_at = seed;
-    }
-  }
-  ASSERT_GE(min_period, (0xFFFF / 2));
-}
-
-}  // namespace omaha
-
diff --git a/base/type_utils.h b/base/type_utils.h
deleted file mode 100644
index edbd286..0000000
--- a/base/type_utils.h
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_TYPE_UTILS_H_
-#define OMAHA_COMMON_TYPE_UTILS_H_
-
-namespace omaha {
-
-//
-// Detecting convertibility and inheritence at compile time
-// (Extracted from: Modern C++ Design)
-//
-
-// Evaluates true if U inherites from T publically, or if T and U are same type
-#define SUPERSUBCLASS(T, U) \
-  (ConversionUtil<const U*, const T*>::exists && \
-  !ConversionUtil<const T*, const void*>::same_type)
-
-// Evaluates true only if U inherites from T publically
-#define SUPERSUBCLASS_STRICT(T, U) \
-  (SUPERSUBCLASS(T, U) && \
-  !ConversionUtil<const T, const U>::same_type)
-
-// Perform type test
-template <class T, class U>
-class ConversionUtil {
- private:
-  typedef char Small;
-  class Big {
-    char dummy[2];
-  };
-  static Small Test(U);
-  static Big Test(...);
-  static T MakeT();
-
- public:
-  // Tell whether there is ConversionUtil from T to U
-  enum { exists = sizeof(Test(MakeT())) == sizeof(Small) };
-
-  // Tells whether there are ConversionUtils between T and U in both directions
-  enum { exists_2way = exists && ConversionUtil<U, T>::exists };
-
-  // Tells whether there are same type
-  enum { same_type = false };
-};
-
-// Perform same type test through partial template specialization
-template<class T>
-class ConversionUtil<T, T> {
- public:
-  enum { exists = 1, exists_2way = 1, same_type = 1 };
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_TYPE_UTILS_H_
diff --git a/base/user_info.cc b/base/user_info.cc
deleted file mode 100644
index a02faf1..0000000
--- a/base/user_info.cc
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright 2004-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/base/user_info.h"
-
-#include <windows.h>
-#include <security.h>
-#include <secext.h>
-#include <sddl.h>
-#include <lmcons.h>
-#include <atlsecurity.h>
-#include "base/scoped_ptr.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/scoped_any.h"
-
-namespace omaha {
-
-namespace user_info {
-
-HRESULT GetProcessUser(CString* name, CString* domain, CString* sid) {
-  CSid current_sid;
-
-  HRESULT hr = GetProcessUserSid(&current_sid);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (sid != NULL) {
-    *sid = current_sid.Sid();
-  }
-  if (name != NULL) {
-    *name = current_sid.AccountName();
-  }
-  if (domain != NULL) {
-    *domain = current_sid.Domain();
-  }
-  return S_OK;
-}
-
-HRESULT GetProcessUserSid(CSid* sid) {
-  ASSERT1(sid);
-
-  CAccessToken token;
-  if (!token.GetProcessToken(TOKEN_QUERY) || !token.GetUser(sid)) {
-    HRESULT hr = HRESULTFromLastError();
-
-    // Assert only if thread_sid is populated. This is to eliminate other
-    // reasons for GetProcessToken/GetUser to fail.
-    CString thread_sid;
-    ASSERT(FAILED(GetThreadUserSid(&thread_sid)),
-           (_T("[Did you mean to call GetThreadUserSid?][0x%x][%s]"),
-            hr, thread_sid));
-
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT IsLocalSystemUser(bool* is_local_system, CString* user_sid) {
-  ASSERT1(is_local_system);
-
-  CString sid;
-  HRESULT hr = GetProcessUser(NULL, NULL, &sid);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  *is_local_system = sid.CompareNoCase(kLocalSystemSid) == 0;
-  if (user_sid) {
-    user_sid->SetString(sid);
-  }
-  return S_OK;
-}
-
-HRESULT GetThreadUserSid(CString* sid) {
-  ASSERT1(sid);
-  CAccessToken access_token;
-  CSid user_sid;
-  if (access_token.GetThreadToken(TOKEN_READ) &&
-      access_token.GetUser(&user_sid)) {
-    sid->SetString(user_sid.Sid());
-    return S_OK;
-  } else {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(L2, (_T("[GetThreadUserSid failed][0x%x]"), hr));
-    return hr;
-  }
-}
-
-HRESULT GetEffectiveUserSid(CString* sid) {
-  HRESULT hr = GetThreadUserSid(sid);
-  return SUCCEEDED(hr) ? hr : GetProcessUser(NULL, NULL, sid);
-}
-
-bool IsRunningAsSystem() {
-  CString sid;
-  return SUCCEEDED(GetEffectiveUserSid(&sid)) ? IsLocalSystemSid(sid) : false;
-}
-
-bool IsThreadImpersonating() {
-  CAccessToken access_token;
-  return access_token.GetThreadToken(TOKEN_READ);
-}
-
-}  // namespace user_info
-
-}  // namespace omaha
-
diff --git a/base/user_info.h b/base/user_info.h
deleted file mode 100644
index d94452c..0000000
--- a/base/user_info.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2004-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Class UserInfo: Information related to the current user or other users on
-// this machine.
-//
-// TODO(omaha): seems we can merge this module with user_rights.
-
-#ifndef OMAHA_COMMON_USER_INFO_H__
-#define OMAHA_COMMON_USER_INFO_H__
-
-#include <windows.h>
-#include <atlsecurity.h>
-#include <atlstr.h>
-
-namespace omaha {
-
-namespace user_info {
-
-// Gets the user name, domain, and the SID associated with the access token
-// of the current process.
-HRESULT GetProcessUser(CString* name, CString* domain, CString* sid);
-
-// Gets SID associated with the access token of the current process.
-HRESULT GetProcessUserSid(CSid* sid);
-
-// Gets the user SID associated with the access token of the current thread if
-// the thread is impersonating. If the thread is not impersonating, the API
-// fails with ERROR_NO_TOKEN.
-HRESULT GetThreadUserSid(CString* sid);
-
-// Gets the user SID associated with the access token of the current thread if
-// the thread is impersonating. Otherwise, gets the SID associated with the
-// access token of the current process.
-HRESULT GetEffectiveUserSid(CString* sid);
-
-// TODO(omaha): deprecate weird API.
-// Looks at the current user SID and checks if it's the same as the
-// LocalSystem user.
-HRESULT IsLocalSystemUser(bool* is_local_system,
-                          CString* user_sid);     // optional.
-
-// Returns true if the caller's impersonation or process access token user
-// is LOCAL_SYSTEM.
-bool IsRunningAsSystem();
-
-// Returns true if the current thread is impersonating.
-bool IsThreadImpersonating();
-
-}  // namespace user_info
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_USER_INFO_H__
diff --git a/base/user_info_unittest.cc b/base/user_info_unittest.cc
deleted file mode 100644
index c938d3d..0000000
--- a/base/user_info_unittest.cc
+++ /dev/null
@@ -1,140 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/constants.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/scoped_impersonation.h"
-#include "omaha/base/user_info.h"
-#include "omaha/testing/unit_test.h"
-
-// We can't make any assumption about the context the unit test runs, however
-// we expect the calls to succeed.
-namespace omaha {
-
-namespace {
-
-const TCHAR kNtNonUniqueIdPrefix[] = _T("S-1-5-21-");
-const int kNtNonUniqueIdPrefixLength = arraysize(kNtNonUniqueIdPrefix) - 1;
-
-}  // namespace
-
-TEST(UserInfoTest, GetProcessUser) {
-  CString name, domain, sid;
-  EXPECT_HRESULT_SUCCEEDED(user_info::GetProcessUser(&name, &domain, &sid));
-
-  EXPECT_FALSE(name.IsEmpty());
-  EXPECT_FALSE(domain.IsEmpty());
-  if (user_info::IsRunningAsSystem()) {
-    EXPECT_STREQ(kLocalSystemSid, sid);
-  } else {
-    EXPECT_STREQ(kNtNonUniqueIdPrefix, sid.Left(kNtNonUniqueIdPrefixLength));
-  }
-}
-
-TEST(UserInfoTest, GetProcessUser_SidOnly) {
-  CString name, domain, sid1;
-  EXPECT_HRESULT_SUCCEEDED(user_info::GetProcessUser(&name, &domain, &sid1));
-
-  if (user_info::IsRunningAsSystem()) {
-    EXPECT_STREQ(kLocalSystemSid, sid1);
-  } else {
-    EXPECT_STREQ(kNtNonUniqueIdPrefix, sid1.Left(kNtNonUniqueIdPrefixLength));
-  }
-
-  CString sid2;
-  EXPECT_HRESULT_SUCCEEDED(user_info::GetProcessUser(NULL, NULL, &sid2));
-  EXPECT_STREQ(sid1, sid2);
-}
-
-
-TEST(UserInfoTest, GetProcessUserSid) {
-  CSid sid;
-  EXPECT_HRESULT_SUCCEEDED(user_info::GetProcessUserSid(&sid));
-
-  const CString name = sid.AccountName();
-  EXPECT_FALSE(name.IsEmpty());
-  const CString sid_string = sid.Sid();
-  if (user_info::IsRunningAsSystem()) {
-    EXPECT_STREQ(kLocalSystemSid, sid_string);
-  } else {
-    EXPECT_STREQ(kNtNonUniqueIdPrefix,
-                 sid_string.Left(kNtNonUniqueIdPrefixLength));
-  }
-
-  EXPECT_EQ(1, sid.GetPSID()->Revision);
-
-  const SID_IDENTIFIER_AUTHORITY kNtAuthority = SECURITY_NT_AUTHORITY;
-  const SID_IDENTIFIER_AUTHORITY* authority =
-      sid.GetPSID_IDENTIFIER_AUTHORITY();
-  for (int i = 0; i < arraysize(authority->Value); ++i) {
-    EXPECT_EQ(kNtAuthority.Value[i], authority->Value[i]);
-  }
-
-  UCHAR expected_auth_count = user_info::IsRunningAsSystem() ?  1 : 5;
-  EXPECT_EQ(expected_auth_count, sid.GetSubAuthorityCount());
-
-  DWORD expected_authority = user_info::IsRunningAsSystem() ?
-                                 SECURITY_LOCAL_SYSTEM_RID :
-                                 SECURITY_NT_NON_UNIQUE;
-  EXPECT_EQ(expected_authority, sid.GetSubAuthority(0));
-  EXPECT_LT(static_cast<DWORD>(DOMAIN_USER_RID_MAX), sid.GetSubAuthority(4));
-}
-
-// Expect the unit tests do not run impersonated.
-TEST(UserInfoTest, GetThreadUserSid) {
-  CString thread_sid;
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_NO_TOKEN),
-            user_info::GetThreadUserSid(&thread_sid));
-}
-
-// Expect the unit tests do not run impersonated.
-// TODO(omaha3): Assuming we are running as admin, is there anything we can
-// impersonate so that this important path gets tested?
-TEST(UserInfoTest, GetEffectiveUserSid) {
-  CString thread_sid;
-  EXPECT_HRESULT_SUCCEEDED(user_info::GetEffectiveUserSid(&thread_sid));
-  CSid process_sid;
-  EXPECT_HRESULT_SUCCEEDED(user_info::GetProcessUserSid(&process_sid));
-  EXPECT_STREQ(process_sid.Sid(), thread_sid);
-}
-
-TEST(UserInfoTest, IsLocalSystemUser) {
-  bool is_system = false;
-  CString sid;
-  EXPECT_HRESULT_SUCCEEDED(user_info::IsLocalSystemUser(&is_system, &sid));
-}
-
-TEST(UserInfoTest, IsThreadImpersonating) {
-  EXPECT_FALSE(user_info::IsThreadImpersonating());
-
-  scoped_handle process_token;
-  EXPECT_NE(0, ::OpenProcessToken(GetCurrentProcess(),
-                                  TOKEN_ALL_ACCESS,
-                                  address(process_token)));
-
-  scoped_handle restricted_token;
-  EXPECT_NE(0, ::CreateRestrictedToken(get(process_token),
-                                       DISABLE_MAX_PRIVILEGE,
-                                       0, NULL,
-                                       0, NULL,
-                                       0, NULL,
-                                       address(restricted_token)));
-
-  scoped_impersonation impersonate_user(get(restricted_token));
-
-  EXPECT_TRUE(user_info::IsThreadImpersonating());
-}
-
-}  // namespace omaha
diff --git a/base/user_rights.cc b/base/user_rights.cc
deleted file mode 100644
index 4526e92..0000000
--- a/base/user_rights.cc
+++ /dev/null
@@ -1,231 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/user_rights.h"
-#include <lm.h>
-#include <wtsapi32.h>
-#include "base/scoped_ptr.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/system_info.h"
-#include "omaha/base/vistautil.h"
-
-namespace omaha {
-
-bool UserRights::TokenIsAdmin(HANDLE token) {
-  return BelongsToGroup(token, DOMAIN_ALIAS_RID_ADMINS);
-}
-
-bool UserRights::UserIsAdmin() {
-  return BelongsToGroup(NULL, DOMAIN_ALIAS_RID_ADMINS);
-}
-
-bool UserRights::UserIsUser() {
-  return BelongsToGroup(NULL, DOMAIN_ALIAS_RID_USERS);
-}
-
-bool UserRights::UserIsPowerUser() {
-  return BelongsToGroup(NULL, DOMAIN_ALIAS_RID_POWER_USERS);
-}
-
-bool UserRights::UserIsGuest() {
-  return BelongsToGroup(NULL, DOMAIN_ALIAS_RID_GUESTS);
-}
-
-bool UserRights::BelongsToGroup(HANDLE token, int group_id) {
-  SID_IDENTIFIER_AUTHORITY nt_authority = SECURITY_NT_AUTHORITY;
-  PSID group = NULL;
-
-  BOOL check = ::AllocateAndInitializeSid(&nt_authority,
-                                          2,
-                                          SECURITY_BUILTIN_DOMAIN_RID,
-                                          group_id,
-                                          0,
-                                          0,
-                                          0,
-                                          0,
-                                          0,
-                                          0,
-                                          &group);
-  if (check) {
-    if (!::CheckTokenMembership(token, group, &check)) {
-      check = false;
-    }
-    ::FreeSid(group);
-  }
-  return !!check;
-}
-
-bool UserRights::UserIsRestricted() {
-  scoped_handle token;
-  if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, address(token))) {
-    UTIL_LOG(LE, (_T("[UserRights::UserIsRestricted - OpenProcessToken failed]")
-                  _T("[0x%08x]"), HRESULTFromLastError()));
-    return true;
-  }
-
-  return !!::IsTokenRestricted(get(token));
-}
-
-bool UserRights::UserIsLowOrUntrustedIntegrity() {
-  if (SystemInfo::IsRunningOnVistaOrLater()) {
-    MANDATORY_LEVEL integrity_level = MandatoryLevelUntrusted;
-    if (FAILED(vista_util::GetProcessIntegrityLevel(0, &integrity_level)) ||
-        integrity_level == MandatoryLevelUntrusted ||
-        integrity_level == MandatoryLevelLow) {
-      return true;
-    }
-  }
-
-  return false;
-}
-
-HRESULT UserRights::UserIsLoggedOnInteractively(bool* is_logged_on) {
-  ASSERT1(is_logged_on);
-
-  *is_logged_on = false;
-
-  HRESULT hr = S_OK;
-
-  // Get the user associated with the current process.
-  WKSTA_USER_INFO_1* user_info = NULL;
-  NET_API_STATUS status = ::NetWkstaUserGetInfo(
-                              NULL,
-                              1,
-                              reinterpret_cast<uint8**>(&user_info));
-  if (status != NERR_Success || user_info == NULL) {
-    UTIL_LOG(LE, (_T("[NetWkstaUserGetInfo failed][%u]"), status));
-    return HRESULT_FROM_WIN32(status);
-  }
-  ON_SCOPE_EXIT(::NetApiBufferFree, user_info);
-
-  UTIL_LOG(L2, (_T("[wks domain=%s][wks user=%s]"),
-                user_info->wkui1_logon_domain, user_info->wkui1_username));
-
-  PWTS_SESSION_INFOW session_info = NULL;
-  const DWORD kVersion = 1;
-  DWORD num_sessions = 0;
-  if (!::WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE,
-                              0,
-                              kVersion,
-                              &session_info,
-                              &num_sessions)) {
-    hr = HRESULTFromLastError();
-    UTIL_LOG(LE, (_T("[WTSEnumerateSessions failed][0x%08x]"), hr));
-    return hr;
-  }
-  ON_SCOPE_EXIT(::WTSFreeMemory, session_info);
-
-  // Loop through all active sessions to see whether one of the sessions
-  // belongs to current user. If so, regard this user as "logged-on".
-  for (DWORD i = 0; i < num_sessions; ++i) {
-    TCHAR* domain_name = NULL;
-    DWORD domain_name_len = 0;
-    if (!::WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE,
-                                      session_info[i].SessionId,
-                                      WTSDomainName,
-                                      &domain_name,
-                                      &domain_name_len)) {
-      hr = HRESULTFromLastError();
-      UTIL_LOG(LE, (_T("[WTSQuerySessionInformation failed][0x%08x]"), hr));
-      continue;
-    }
-    ON_SCOPE_EXIT(::WTSFreeMemory, domain_name);
-
-    TCHAR* user_name = NULL;
-    DWORD user_name_len = 0;
-    if (!::WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE,
-                                      session_info[i].SessionId,
-                                      WTSUserName,
-                                      &user_name,
-                                      &user_name_len)) {
-      hr = HRESULTFromLastError();
-      UTIL_LOG(LE, (_T("[WTSQuerySessionInformation failed][0x%08x]"), hr));
-      continue;
-    }
-    ON_SCOPE_EXIT(::WTSFreeMemory, user_name);
-
-    UTIL_LOG(L2, (_T("[ts domain=%s][ts user=%s][station=%s]"),
-                  domain_name,
-                  user_name,
-                  session_info[i].pWinStationName));
-
-    // Occasionally, the domain name and user name could not be retrieved when
-    // the program is started just at logon time.
-    if (!(domain_name && *domain_name && user_name && *user_name)) {
-      hr = E_FAIL;
-      continue;
-    }
-
-    if (_tcsicmp(user_info->wkui1_logon_domain, domain_name) == 0 &&
-        _tcsicmp(user_info->wkui1_username, user_name) == 0) {
-      *is_logged_on = true;
-      return S_OK;
-    }
-  }
-
-  return hr;
-}
-
-// Returns a token with TOKEN_ALL_ACCESS rights. At the moment, we only require
-// TOKEN_QUERY | TOKEN_ASSIGN_PRIMARY, but requirements may change in the
-// future.
-HRESULT UserRights::GetCallerToken(CAccessToken* token) {
-  ASSERT1(token);
-
-  CComPtr<IUnknown> security_context;
-  HRESULT hr = ::CoGetCallContext(IID_PPV_ARGS(&security_context));
-  if (SUCCEEDED(hr)) {
-    return token->OpenCOMClientToken(TOKEN_ALL_ACCESS) ? S_OK :
-                                                         HRESULTFromLastError();
-  } else if (hr != RPC_E_CALL_COMPLETE) {
-    UTIL_LOG(LE, (_T("[::CoGetCallContext failed][0x%x]"), hr));
-    return hr;
-  }
-
-  // RPC_E_CALL_COMPLETE indicates an in-proc intra-apartment call. Return the
-  // current process token.
-  return token->OpenThreadToken(TOKEN_ALL_ACCESS) ? S_OK :
-                                                    HRESULTFromLastError();
-}
-
-bool UserRights::VerifyCallerIsAdmin() {
-  CAccessToken impersonated_token;
-  if (FAILED(GetCallerToken(&impersonated_token))) {
-    return false;
-  }
-  return TokenIsAdmin(impersonated_token.GetHandle());
-}
-
-bool UserRights::VerifyCallerIsSystem() {
-  CAccessToken impersonated_token;
-  if (FAILED(GetCallerToken(&impersonated_token))) {
-    return false;
-  }
-
-  CSid sid;
-  if (!impersonated_token.GetUser(&sid)) {
-    return false;
-  }
-
-  return sid == Sids::System();
-}
-
-}  // namespace omaha
-
diff --git a/base/user_rights.h b/base/user_rights.h
deleted file mode 100644
index 01aefd6..0000000
--- a/base/user_rights.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// This class finds out different user rights on the system.
-// For example it can find out if the user is an administrator.
-
-#ifndef OMAHA_BASE_USER_RIGHTS_H_
-#define OMAHA_BASE_USER_RIGHTS_H_
-
-#include <windows.h>
-#include <atlsecurity.h>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-class UserRights {
- public:
-
-  // Returns true if token is a member of the local Administrators group.
-  static bool TokenIsAdmin(HANDLE token);
-
-  // Returns true if the user belongs to the local Administrators group.
-  static bool UserIsAdmin();
-
-  // Returns true if the user belongs to the Users group.
-  static bool UserIsUser();
-
-  // Returns true if the user belongs to the Power User group.
-  static bool UserIsPowerUser();
-
-  // Returns true if the user is a Guest.
-  static bool UserIsGuest();
-
-  // Returns true if the owner of the current process has a restricted token.
-  static bool UserIsRestricted();
-
-  // Returns true if the owner of the current process runs under low or
-  // untrusted integrity on Vista.
-  static bool UserIsLowOrUntrustedIntegrity();
-
-  // Returns true if the owner of the current process has an interactive
-  // session: console, terminal services, or fast user switching.
-  static HRESULT UserIsLoggedOnInteractively(bool* is_logged_on);
-
-  // Gets the COM caller's impersonation token. If not in an inter-apartment COM
-  // call, returns the current process token.
-  static HRESULT GetCallerToken(CAccessToken* token);
-
-  static bool VerifyCallerIsAdmin();
-
-  static bool VerifyCallerIsSystem();
-
-  // Returns true if the owner of the current process is the primary logon token
-  // for the current interactive session: console, terminal services, or fast
-  // user switching.
-  static bool BelongsToGroup(HANDLE token, int group_id);
-
- private:
-  DISALLOW_IMPLICIT_CONSTRUCTORS(UserRights);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_USER_RIGHTS_H_
-
diff --git a/base/user_rights_unittest.cc b/base/user_rights_unittest.cc
deleted file mode 100644
index 435507f..0000000
--- a/base/user_rights_unittest.cc
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/testing/unit_test.h"
-#include "omaha/base/user_rights.h"
-
-namespace omaha {
-
-TEST(UserRightsTest, UserIsLoggedOnInteractively) {
-  if (IsTestRunByLocalSystem()) {
-    return;
-  }
-
-  bool is_logged_on(false);
-  EXPECT_HRESULT_SUCCEEDED(
-    UserRights::UserIsLoggedOnInteractively(&is_logged_on));
-  EXPECT_TRUE(is_logged_on);
-}
-
-}  // namespace omaha
-
diff --git a/base/utils.cc b/base/utils.cc
deleted file mode 100644
index fbd0f0a..0000000
--- a/base/utils.cc
+++ /dev/null
@@ -1,2044 +0,0 @@
-// Copyright 2003-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/utils.h"
-
-#include <ras.h>
-#include <regstr.h>
-#include <urlmon.h>
-#include <wincrypt.h>
-#include <ATLComTime.h>
-#include <atlpath.h>
-#include <map>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/const_addresses.h"
-#include "omaha/base/const_config.h"
-#include "omaha/base/const_timeouts.h"
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/process.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/shell.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/string.h"
-#include "omaha/base/system.h"
-#include "omaha/base/system_info.h"
-#include "omaha/base/time.h"
-#include "omaha/base/user_info.h"
-#include "omaha/base/user_rights.h"
-#include "omaha/base/vistautil.h"
-
-namespace omaha {
-
-namespace {
-
-// Private object namespaces for Vista processes.
-const TCHAR* const kGoopdateBoundaryDescriptor = _T("GoogleUpdate_BD");
-const TCHAR* const kGoopdatePrivateNamespace = _T("GoogleUpdate");
-const TCHAR* const kGoopdatePrivateNamespacePrefix = _T("GoogleUpdate\\");
-
-// Helper for IsPrivateNamespaceAvailable().
-// For simplicity, the handles opened here are leaked. We need these until
-// process exit, at which point they will be cleaned up automatically by the OS.
-bool EnsurePrivateNamespaceAvailable() {
-  HANDLE boundary_descriptor =
-      CreateBoundaryDescriptorWWrap(kGoopdateBoundaryDescriptor, 0);
-  if (NULL == boundary_descriptor) {
-    DWORD last_error(::GetLastError());
-    UTIL_LOG(LE, (_T("CreateBoundaryDescriptor failed[%d]"), last_error));
-    return false;
-  }
-
-  char sid[SECURITY_MAX_SID_SIZE] = {0};
-  DWORD size = sizeof(sid);
-  // Mark the boundary descriptor with the Admins Group SID. Consequently, all
-  // admins, including SYSTEM, will create objects in the same private
-  // namespace.
-  if (!::CreateWellKnownSid(WinBuiltinAdministratorsSid, NULL, sid, &size)) {
-    UTIL_LOG(LE, (_T("[::CreateWellKnownSid failed][%d]"), ::GetLastError()));
-    return false;
-  }
-  if (!AddSIDToBoundaryDescriptorWrap(&boundary_descriptor, sid)) {
-    UTIL_LOG(LE, (_T("[AddSIDToBoundaryDescriptor failed][%d]"),
-                  ::GetLastError()));
-    return false;
-  }
-
-  NamedObjectAttributes attr;
-  GetAdminDaclSecurityAttributes(&attr.sa, GENERIC_ALL);
-  // The private namespace created here will be used to create objects of the
-  // form "GoogleUpdate\xyz". As the article "Object Namespaces" on MSDN
-  // explains, these kernel objects are safe from squatting attacks from lower
-  // integrity processes.
-  HANDLE namespace_handle =
-      CreatePrivateNamespaceWWrap(&attr.sa,
-                                  boundary_descriptor,
-                                  kGoopdatePrivateNamespace);
-  if (namespace_handle) {
-    return true;
-  }
-  ASSERT(ERROR_ALREADY_EXISTS == ::GetLastError(),
-         (_T("CreatePrivateNamespaceW failed: %d"), ::GetLastError()));
-
-  // Another process has already created the namespace. Attempt to open.
-  namespace_handle = OpenPrivateNamespaceWWrap(boundary_descriptor,
-                                               kGoopdatePrivateNamespace);
-  if (namespace_handle || ::GetLastError() == ERROR_DUP_NAME) {
-    // ERROR_DUP_NAME indicates that we have called CreatePrivateNamespaceWWrap
-    // or OpenPrivateNamespaceWWrap before in the same process. Either way, we
-    // can now create objects prefixed with our private namespace.
-    return true;
-  }
-
-  ASSERT(namespace_handle, (_T("[Could not open private namespace][%d]"),
-                            ::GetLastError()));
-  return false;
-}
-
-}  // namespace
-
-// Returns 0 if an error occurs.
-ULONGLONG VersionFromString(const CString& s) {
-  int pos(0);
-  unsigned int quad[4] = {0, 0, 0, 0};
-
-  for (int i = 0; i < 4; ++i) {
-    CString q = s.Tokenize(_T("."), pos);
-    if (pos == -1) {
-      return 0;
-    }
-
-    int quad_value(0);
-    if (!String_StringToDecimalIntChecked(q, &quad_value)) {
-      return 0;
-    }
-
-    quad[i] = static_cast<unsigned int>(quad_value);
-
-    if (kuint16max < quad[i]) {
-      return 0;
-    }
-  }
-
-  if (s.GetLength() + 1 != pos) {
-    return 0;
-  }
-
-  return MAKEDLLVERULL(quad[0], quad[1], quad[2], quad[3]);
-}
-
-CString StringFromVersion(ULONGLONG version) {
-  const WORD version_major = HIWORD(version >> 32);
-  const WORD version_minor = LOWORD(version >> 32);
-  const WORD version_build = HIWORD(version);
-  const WORD version_patch = LOWORD(version);
-
-  CString version_string;
-  version_string.Format((_T("%u.%u.%u.%u")),
-                        version_major,
-                        version_minor,
-                        version_build,
-                        version_patch);
-  return version_string;
-}
-
-CString GetCurrentDir() {
-  TCHAR cur_dir[MAX_PATH] = {0};
-  if (!::GetCurrentDirectory(MAX_PATH, cur_dir)) {
-    return CString(_T('.'));
-  }
-  return CString(cur_dir);
-}
-
-HRESULT GetNewFileNameInDirectory(const CString& dir, CString* file_name) {
-  ASSERT1(file_name);
-
-  GUID guid = {0};
-  HRESULT hr = ::CoCreateGuid(&guid);
-  if (FAILED(hr)) {
-    CORE_LOG(LEVEL_WARNING, (_T("[CoCreateGuid failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  CString guid_file_name = GuidToString(guid);
-  CPath file_path(dir);
-  file_path.Append(guid_file_name);
-
-  *file_name = static_cast<const TCHAR*>(file_path);
-  return S_OK;
-}
-
-// determines if a time is in the distant past, present, or future
-TimeCategory GetTimeCategory(const time64 system_time) {
-  time64 now = GetCurrent100NSTime();
-
-  // Times more than a few days in the future are wrong [I will allow a little
-  // leeway, since it could be set in another future time zone, or a program
-  // that likes UNC]]
-  if (system_time > (now + kDaysTo100ns * 5)) {
-    return FUTURE;
-  }
-
-  // times more than 40 years ago are wrong
-  if (system_time < (now - kDaysTo100ns * 365 * 40)) {
-    return PAST;
-  }
-
-  return PRESENT;
-}
-
-// Determine if a given time is probably valid
-bool IsValidTime(const time64 t) {
-  return (GetTimeCategory(t) == PRESENT);
-}
-
-LARGE_INTEGER MSto100NSRelative(DWORD ms) {
-  const __int64 convert_ms_to_100ns_units = 1000 /*ms/us*/ * 10 /*us/100ns*/;
-  __int64 timeout_100ns = static_cast<__int64>(ms) * convert_ms_to_100ns_units;
-  LARGE_INTEGER timeout = {0};
-  timeout.QuadPart = -timeout_100ns;
-  return timeout;
-}
-
-// Local System and admins get admin_access_mask. Authenticated non-admins get
-// non_admin_access_mask access.
-void GetEveryoneDaclSecurityDescriptor(CSecurityDesc* sd,
-                                       ACCESS_MASK admin_access_mask,
-                                       ACCESS_MASK non_admin_access_mask) {
-  ASSERT1(sd);
-
-  CDacl dacl;
-  dacl.AddAllowedAce(Sids::System(), admin_access_mask);
-  dacl.AddAllowedAce(Sids::Admins(), admin_access_mask);
-  dacl.AddAllowedAce(Sids::Interactive(), non_admin_access_mask);
-
-  sd->SetDacl(dacl);
-  sd->MakeAbsolute();
-}
-
-void GetAdminDaclSecurityDescriptor(CSecurityDesc* sd, ACCESS_MASK accessmask) {
-  ASSERT1(sd);
-
-  CDacl dacl;
-  dacl.AddAllowedAce(Sids::System(), accessmask);
-  dacl.AddAllowedAce(Sids::Admins(), accessmask);
-
-  sd->SetOwner(Sids::Admins());
-  sd->SetGroup(Sids::Admins());
-  sd->SetDacl(dacl);
-  sd->MakeAbsolute();
-}
-
-void GetAdminDaclSecurityAttributes(CSecurityAttributes* sec_attr,
-                                    ACCESS_MASK accessmask) {
-  ASSERT1(sec_attr);
-  CSecurityDesc sd;
-  GetAdminDaclSecurityDescriptor(&sd, accessmask);
-  sec_attr->Set(sd);
-}
-
-HRESULT InitializeClientSecurity() {
-  return ::CoInitializeSecurity(
-      NULL,
-      -1,
-      NULL,   // Let COM choose what authentication services to register.
-      NULL,
-      RPC_C_AUTHN_LEVEL_PKT_PRIVACY,  // Data integrity and encryption.
-      RPC_C_IMP_LEVEL_IMPERSONATE,    // Allow server to impersonate.
-      NULL,
-      EOAC_DYNAMIC_CLOAKING,
-      NULL);
-}
-
-HRESULT InitializeServerSecurity(bool allow_calls_from_medium) {
-  CSecurityDesc sd;
-  DWORD eole_auth_capabilities = EOAC_DYNAMIC_CLOAKING;
-  if (allow_calls_from_medium) {
-    GetEveryoneDaclSecurityDescriptor(&sd,
-                                      COM_RIGHTS_EXECUTE,
-                                      COM_RIGHTS_EXECUTE);
-    sd.SetOwner(Sids::Admins());
-    sd.SetGroup(Sids::Admins());
-  } else if (user_info::IsRunningAsSystem()) {
-    GetAdminDaclSecurityDescriptor(&sd, COM_RIGHTS_EXECUTE);
-  }
-
-  HRESULT hr = ::CoInitializeSecurity(
-      const_cast<SECURITY_DESCRIPTOR*>(sd.GetPSECURITY_DESCRIPTOR()),
-      -1,
-      NULL,
-      NULL,
-      RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
-      RPC_C_IMP_LEVEL_IDENTIFY,
-      NULL,
-      eole_auth_capabilities,
-      NULL);
-  ASSERT(SUCCEEDED(hr), (_T("[InitializeServerSecurity failed][0x%x]"), hr));
-  return hr;
-}
-
-// The IGlobalOptions interface is supported from Vista onwards. Callers
-// should probably ignore the HRESULT returned, since it is not a critical error
-// if turning off exception handling fails.
-HRESULT DisableCOMExceptionHandling() {
-  CComPtr<IGlobalOptions> options;
-  HRESULT hr = options.CoCreateInstance(CLSID_GlobalOptions);
-  if (SUCCEEDED(hr)) {
-    hr = options->Set(COMGLB_EXCEPTION_HANDLING, COMGLB_EXCEPTION_DONOT_HANDLE);
-  }
-
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[DisableCOMExceptionHandling failed][0x%x]"), hr));
-  }
-
-  return hr;
-}
-
-// This function is not thread-safe.
-bool IsPrivateNamespaceAvailable(bool is_machine) {
-  static bool is_initialized = false;
-  static bool is_available = false;
-
-  if (!is_machine) {
-    // TODO(Omaha): From a security viewpoint, private namespaces do not add
-    // much value for the User Omaha. But from a uniformity perspective, makes
-    // sense to use for both.
-    return false;
-  }
-
-  if (is_initialized) {
-    return is_available;
-  }
-
-  if (!SystemInfo::IsRunningOnVistaOrLater()) {
-    is_available = false;
-    is_initialized = true;
-    return false;
-  }
-
-  is_available = EnsurePrivateNamespaceAvailable();
-  is_initialized = true;
-  return is_available;
-}
-
-
-void GetNamedObjectAttributes(const TCHAR* base_name,
-                              bool is_machine,
-                              NamedObjectAttributes* attr) {
-  ASSERT1(base_name);
-  ASSERT1(attr);
-
-  // TODO(Omaha): Enable this code after we have a better understanding of
-  // Private Object Namespaces.
-#if 0
-  if (IsPrivateNamespaceAvailable(is_machine)) {
-    attr->name = kGoopdatePrivateNamespacePrefix;
-  } else {
-    ASSERT1(!SystemInfo::IsRunningOnVistaOrLater());
-#endif
-
-  attr->name = omaha::kGlobalPrefix;
-
-  if (!is_machine) {
-    CString user_sid;
-    VERIFY1(SUCCEEDED(omaha::user_info::GetProcessUser(NULL, NULL, &user_sid)));
-    attr->name += user_sid;
-  } else {
-    // Grant access to administrators and system.
-    GetAdminDaclSecurityAttributes(&attr->sa, GENERIC_ALL);
-  }
-
-  attr->name += base_name;
-  UTIL_LOG(L1, (_T("[GetNamedObjectAttributes][named_object=%s]"), attr->name));
-}
-
-// For now, required_ace_flags is only supported for SE_REGISTRY_KEY objects.
-// INHERITED_ACE may be added to the read ACE flags, so it is excluded from
-// the comparison with required_ace_flags.
-HRESULT AddAllowedAce(const TCHAR* object_name,
-                      SE_OBJECT_TYPE object_type,
-                      const CSid& sid,
-                      ACCESS_MASK required_permissions,
-                      uint8 required_ace_flags) {
-  ASSERT1(SE_REGISTRY_KEY == object_type || !required_ace_flags);
-  ASSERT1(0 == (required_ace_flags & INHERITED_ACE));
-
-  CDacl dacl;
-  if (!AtlGetDacl(object_name, object_type, &dacl)) {
-    return HRESULTFromLastError();
-  }
-
-  int ace_count = dacl.GetAceCount();
-  for (int i = 0; i < ace_count; ++i) {
-    CSid sid_entry;
-    ACCESS_MASK existing_permissions = 0;
-    BYTE existing_ace_flags = 0;
-    dacl.GetAclEntry(i,
-                     &sid_entry,
-                     &existing_permissions,
-                     NULL,
-                     &existing_ace_flags);
-    if (sid_entry == sid &&
-        required_permissions == (existing_permissions & required_permissions) &&
-        required_ace_flags == (existing_ace_flags & ~INHERITED_ACE)) {
-      return S_OK;
-    }
-  }
-
-  if (!dacl.AddAllowedAce(sid, required_permissions, required_ace_flags) ||
-      !AtlSetDacl(object_name, object_type, dacl)) {
-    return HRESULTFromLastError();
-  }
-
-  return S_OK;
-}
-
-HRESULT CreateDir(const TCHAR* in_dir,
-                  LPSECURITY_ATTRIBUTES security_attr) {
-  ASSERT1(in_dir);
-  CString path;
-  if (!PathCanonicalize(CStrBuf(path, MAX_PATH), in_dir)) {
-    return E_FAIL;
-  }
-  // Standardize path on backslash so Find works.
-  path.Replace(_T('/'), _T('\\'));
-  int next_slash = path.Find(_T('\\'));
-  while (true) {
-    int len = 0;
-    if (next_slash == -1) {
-      len = path.GetLength();
-    } else {
-      len = next_slash;
-    }
-    CString dir(path.Left(len));
-    // The check for File::Exists should not be needed. However in certain
-    // cases, i.e. when the program is run from a n/w drive or from the
-    // root drive location, the first CreateDirectory fails with an
-    // E_ACCESSDENIED instead of a ALREADY_EXISTS. Hence we protect the call
-    // with the exists.
-    if (!File::Exists(dir)) {
-      if (!::CreateDirectory(dir, security_attr)) {
-        DWORD error = ::GetLastError();
-        if (ERROR_FILE_EXISTS != error && ERROR_ALREADY_EXISTS != error) {
-          return HRESULT_FROM_WIN32(error);
-        }
-      }
-    }
-    if (next_slash == -1) {
-      break;
-    }
-    next_slash = path.Find(_T('\\'), next_slash + 1);
-  }
-
-  return S_OK;
-}
-
-HRESULT GetFolderPath(int csidl, CString* path) {
-  if (!path) {
-    return E_INVALIDARG;
-  }
-
-  TCHAR buffer[MAX_PATH] = {0};
-  HRESULT hr = ::SHGetFolderPath(NULL, csidl, NULL, SHGFP_TYPE_CURRENT, buffer);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  *path = buffer;
-  return S_OK;
-}
-
-// Delete directory files. If failed, try to schedule deletion at next reboot
-HRESULT DeleteDirectoryFiles(const TCHAR* dir_name) {
-  ASSERT1(dir_name);
-  return DeleteWildcardFiles(dir_name, _T("*"));
-}
-
-// Delete a set of wildcards within dir_name.
-// If unable to delete immediately, try to schedule deletion at next reboot
-HRESULT DeleteWildcardFiles(const TCHAR* dir_name, const TCHAR* wildcard_name) {
-  ASSERT1(dir_name);
-  ASSERT1(wildcard_name);
-
-  HRESULT hr = S_OK;
-
-  WIN32_FIND_DATA find_data;
-  SetZero(find_data);
-
-  CString find_file(dir_name);
-  find_file += _T('\\');
-  find_file += wildcard_name;
-
-  scoped_hfind hfind(::FindFirstFile(find_file, &find_data));
-  if (!hfind) {
-    if (::GetLastError() == ERROR_NO_MORE_FILES) {
-      return S_OK;
-    } else {
-      hr = HRESULTFromLastError();
-      UTIL_LOG(LEVEL_ERROR, (_T("[DeleteWildcardFiles]")
-                             _T("[failed to get first file][0x%08x]"), hr));
-      return hr;
-    }
-  }
-
-  do {
-    if (!(find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
-      CString specific_file_name(dir_name);
-      specific_file_name += _T('\\');
-      specific_file_name += find_data.cFileName;
-      if (!::DeleteFile(specific_file_name)) {
-        if (!SUCCEEDED(hr = File::DeleteAfterReboot(specific_file_name))) {
-          UTIL_LOG(LEVEL_ERROR, (_T("[DeleteWildcardFiles]")
-                                 _T("[failed to delete after reboot]")
-                                 _T("[%s][0x%08x]"), specific_file_name, hr));
-        }
-      }
-    }
-  } while (::FindNextFile(get(hfind), &find_data));
-
-  if (::GetLastError() != ERROR_NO_MORE_FILES) {
-    hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[DeleteWildcardFiles]")
-                           _T("[failed to get next file][0x%08x]"), hr));
-  }
-
-  return hr;
-}
-
-// Delete directory and files within. If failed, try to schedule deletion at
-// next reboot
-// TODO(Omaha) - the code to delete the directory is complicated,
-// especially the way the result code is built from hr and hr1. I wonder if we
-// could simplify this by reimplementing it on top of SHFileOperation and
-// also save a few tens of bytes in the process.
-HRESULT DeleteDirectory(const TCHAR* dir_name) {
-  ASSERT1(dir_name);
-
-  if (!SafeDirectoryNameForDeletion(dir_name)) {
-    return E_FAIL;
-  }
-
-  // Make sure the directory exists (it is ok if it doesn't)
-  DWORD dir_attributes = ::GetFileAttributes(dir_name);
-  if (dir_attributes == INVALID_FILE_ATTRIBUTES) {
-    if (::GetLastError() == ERROR_FILE_NOT_FOUND)
-      return S_OK;  // Ok if directory is missing
-    else
-      return HRESULTFromLastError();
-  }
-  // Confirm it is a directory
-  if (!(dir_attributes & FILE_ATTRIBUTE_DIRECTORY)) {
-    return E_FAIL;
-  }
-
-  // Try to delete all files at best effort
-  // Return the first HRESULT error encountered
-
-  // First delete all the normal files
-  HRESULT hr = DeleteDirectoryFiles(dir_name);
-
-  // Recursively delete any subdirectories
-
-  WIN32_FIND_DATA find_data = {0};
-
-  CString find_file(dir_name);
-  find_file += _T("\\*");
-
-  // Note that the follows are enclosed in a block because we need to close the
-  // find handle before deleting the directorty itself
-  {
-    scoped_hfind hfind(::FindFirstFile(find_file, &find_data));
-    if (!hfind) {
-      if (::GetLastError() == ERROR_NO_MORE_FILES) {
-        return hr;
-      } else {
-        HRESULT hr1 = HRESULTFromLastError();
-        UTIL_LOG(LEVEL_ERROR, (_T("[DeleteDirectory]")
-                               _T("[failed to get first file][0x%08x]"), hr1));
-        return SUCCEEDED(hr) ? hr1 : hr;
-      }
-    }
-
-    do {
-      if (find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
-        if (String_StrNCmp(find_data.cFileName, _T("."), 2, false) == 0 ||
-            String_StrNCmp(find_data.cFileName, _T(".."), 3, false) == 0) {
-          continue;
-        }
-
-        CString sub_dir(dir_name);
-        sub_dir += _T("\\");
-        sub_dir += find_data.cFileName;
-        HRESULT hr1 = DeleteDirectory(sub_dir);
-        if (SUCCEEDED(hr) && FAILED(hr1)) {
-          hr = hr1;
-        }
-      }
-    }
-    while (::FindNextFile(get(hfind), &find_data));
-  }
-
-  // Delete the empty directory itself
-  if (!::RemoveDirectory(dir_name)) {
-    HRESULT hr1 = E_FAIL;
-    if (FAILED(hr1 = File::DeleteAfterReboot(dir_name))) {
-      UTIL_LOG(LE, (_T("[DeleteDirectory][failed to delete after reboot]")
-                    _T("[%s][0x%08x]"), dir_name, hr1));
-    }
-
-    if (SUCCEEDED(hr) && FAILED(hr1)) {
-      hr = hr1;
-    }
-  }
-
-  return hr;
-}
-
-// Returns true if this directory name is 'safe' for deletion (doesn't contain
-// "..", doesn't specify a drive root)
-bool SafeDirectoryNameForDeletion(const TCHAR* dir_name) {
-  ASSERT1(dir_name);
-
-  // empty name isn't allowed
-  if (!(dir_name && *dir_name)) {
-    return false;
-  }
-
-  // require a character other than \/:. after the last :
-  // disallow anything with ".."
-  bool ok = false;
-  for (const TCHAR* s = dir_name; *s; ++s) {
-    if (*s != _T('\\') && *s != _T('/') && *s != _T(':') && *s != _T('.')) {
-      ok = true;
-    }
-    if (*s == _T('.') && s > dir_name && *(s-1) == _T('.')) {
-      return false;
-    }
-    if (*s == _T(':')) {
-      ok = false;
-    }
-  }
-  return ok;
-}
-
-// Utility function that deletes either a file or directory,
-// before or after reboot
-HRESULT DeleteBeforeOrAfterReboot(const TCHAR* targetname) {
-  if (!File::Exists(targetname)) {
-    return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
-  }
-
-  HRESULT hr = E_FAIL;
-  if (File::IsDirectory(targetname)) {
-    // DeleteDirectory will schedule deletion at next reboot if it cannot delete
-    // immediately.
-    hr = DeleteDirectory(targetname);
-  } else  {
-    hr = File::Remove(targetname);
-    // If failed, schedule deletion at next reboot
-    if (FAILED(hr)) {
-      UTIL_LOG(L1, (_T("[DeleteBeforeOrAfterReboot]")
-                    _T("[trying to delete after reboot][%s]"), targetname));
-      hr = File::DeleteAfterReboot(targetname);
-    }
-  }
-
-  if (FAILED(hr)) {
-    UTIL_LOG(L1, (_T("[DeleteBeforeOrAfterReboot]")
-                  _T("[failed to delete][%s][0x%08x]"), targetname, hr));
-  }
-
-  return hr;
-}
-
-
-// Internal implementation of the safe version of getting size of all files in
-// a directory. It is able to abort the counting if one of the maximum criteria
-// is reached.
-HRESULT InternalSafeGetDirectorySize(const TCHAR* dir_name,
-                                     uint64* size,
-                                     HANDLE shutdown_event,
-                                     uint64 max_size,
-                                     int curr_file_count,
-                                     int max_file_count,
-                                     int curr_depth,
-                                     int max_depth,
-                                     DWORD end_time_ms) {
-  ASSERT1(dir_name && *dir_name);
-  ASSERT1(size);
-
-  CString dir_find_name = String_MakeEndWith(dir_name, _T("\\"), false);
-  dir_find_name += _T("*");
-  WIN32_FIND_DATA find_data = {0};
-  scoped_hfind hfind(::FindFirstFile(dir_find_name, &find_data));
-  if (!hfind) {
-    return ::GetLastError() == ERROR_NO_MORE_FILES ? S_OK :
-                                                     HRESULTFromLastError();
-  }
-
-  do {
-    // Bail out if shutting down
-    if (shutdown_event && IsHandleSignaled(shutdown_event)) {
-      return E_ABORT;
-    }
-
-    // Bail out if reaching maximum running time
-    if (end_time_ms && ::GetTickCount() >= end_time_ms) {
-      UTIL_LOG(L6, (_T("[InternalSafeGetDirectorySize]")
-                    _T("[reaching max running time][%s][%u]"),
-                    dir_name, end_time_ms));
-      return E_ABORT;
-    }
-
-    // Skip reparse point since it might be a hard link which could cause an
-    // infinite recursive directory loop.
-    if (find_data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {
-      continue;
-    }
-
-    if (find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
-      // Skip . and ..
-      if (String_StrNCmp(find_data.cFileName, _T("."), 2, false) == 0 ||
-          String_StrNCmp(find_data.cFileName, _T(".."), 3, false) == 0) {
-        continue;
-      }
-
-      // Bail out if reaching maximum depth
-      if (max_depth && curr_depth + 1 >= max_depth) {
-        UTIL_LOG(L6, (_T("[InternalSafeGetDirectorySize]")
-                      _T("[reaching max depth][%s][%u]"), dir_name, max_depth));
-        return E_ABORT;
-      }
-
-      // Walk over sub-directory
-      CString sub_dir_name = String_MakeEndWith(dir_name, _T("\\"), false);
-      sub_dir_name += find_data.cFileName;
-      RET_IF_FAILED(InternalSafeGetDirectorySize(sub_dir_name,
-                                                 size,
-                                                 shutdown_event,
-                                                 max_size,
-                                                 curr_file_count,
-                                                 max_file_count,
-                                                 curr_depth + 1,
-                                                 max_depth,
-                                                 end_time_ms));
-    } else {
-      // Bail out if reaching maximum number of files
-      ++curr_file_count;
-      if (max_file_count && curr_file_count >= max_file_count) {
-        UTIL_LOG(L6, (_T("[InternalSafeGetDirectorySize]")
-                      _T("[reaching max file count][%s][%u]"),
-                      dir_name, max_file_count));
-        return E_ABORT;
-      }
-
-      // Count the file size
-      uint64 file_size =
-          ((static_cast<uint64>((find_data.nFileSizeHigh)) << 32)) +
-          static_cast<uint64>(find_data.nFileSizeLow);
-      *size += file_size;
-
-      // Bail out if reaching maximum size
-      if (max_size && *size >= max_size) {
-        UTIL_LOG(L6, (_T("[InternalSafeGetDirectorySize]")
-                      _T("[reaching max size][%s][%u]"), dir_name, max_size));
-        return E_ABORT;
-      }
-    }
-  } while (::FindNextFile(get(hfind), &find_data));
-
-  return ::GetLastError() == ERROR_NO_MORE_FILES ? S_OK :
-                                                   HRESULTFromLastError();
-}
-
-// The safe version of getting size of all files in a directory
-// It is able to abort the counting if one of the maximum criteria is reached
-HRESULT SafeGetDirectorySize(const TCHAR* dir_name,
-                             uint64* size,
-                             HANDLE shutdown_event,
-                             uint64 max_size,
-                             int max_file_count,
-                             int max_depth,
-                             int max_running_time_ms) {
-  ASSERT1(dir_name && *dir_name);
-  ASSERT1(size);
-
-  *size = 0;
-
-  DWORD end_time = 0;
-  if (max_running_time_ms > 0) {
-    end_time = ::GetTickCount() + max_running_time_ms;
-  }
-  return InternalSafeGetDirectorySize(dir_name,
-                                      size,
-                                      shutdown_event,
-                                      max_size,
-                                      0,
-                                      max_file_count,
-                                      0,
-                                      max_depth,
-                                      end_time);
-}
-
-// Get size of all files in a directory
-HRESULT GetDirectorySize(const TCHAR* dir_name, uint64* size) {
-  ASSERT1(dir_name && *dir_name);
-  ASSERT1(size);
-  return SafeGetDirectorySize(dir_name, size, NULL, 0, 0, 0, 0);
-}
-
-// Handles the logic to determine the handle that was signaled
-// as a result of calling *WaitForMultipleObjects.
-HRESULT GetSignaledObjectPosition(uint32 cnt, DWORD res, uint32* pos) {
-  ASSERT1(pos);
-
-  if (res == WAIT_FAILED) {
-    return S_FALSE;
-  }
-
-#pragma warning(disable : 4296)
-  // C4296: '>=' : expression is always true
-  if ((res >= WAIT_OBJECT_0) && (res < WAIT_OBJECT_0 + cnt)) {
-    *pos = res - WAIT_OBJECT_0;
-    return S_OK;
-  }
-#pragma warning(default : 4296)
-
-  if ((res >= WAIT_ABANDONED_0) && (res < WAIT_ABANDONED_0 + cnt)) {
-    *pos = res - WAIT_ABANDONED_0;
-    return S_OK;
-  }
-  return E_INVALIDARG;
-}
-
-// Supports all of the other WaitWithMessage* functions.
-//
-// Returns:
-//    S_OK when the message loop should continue.
-//    S_FALSE when it receives something that indicates the
-//      loop should quit.
-//    E_* only when GetMessage failed
-//
-// This function is not exposed outside of this file.  Only
-// friendly wrappers of it are.
-HRESULT WaitWithMessageLoopAnyInternal(
-    const HANDLE* phandles,
-    uint32 cnt,
-    uint32* pos,
-    MessageHandlerInternalInterface* message_handler) {
-  ASSERT1(pos && message_handler);
-  // cnt and phandles are either both zero or both not zero.
-  ASSERT1(!cnt == !phandles);
-
-  // Loop until an error happens or the wait is satisfied by a signaled
-  // object or an abandoned mutex.
-  for (;;) {
-    MSG msg = {0};
-
-    // Process the messages in the input queue.
-    while (::PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE)) {
-      BOOL ret = false;
-      if ((ret = ::GetMessage(&msg, NULL, 0, 0)) != 0) {
-        if (ret == -1) {
-          HRESULT hr = HRESULTFromLastError();
-          UTIL_LOG(LE, (_T("[WaitWithMessageLoopAnyInternal]")
-                        _T("[GetMessage failed][0x%08x]"), hr));
-          return hr;
-        }
-        message_handler->Process(&msg, &phandles, &cnt);
-      } else {
-        // We need to re-post the quit message we retrieved so that it could
-        // propagate to the outer layer. Otherwise, the program will seem to
-        // "get stuck" in its shutdown code.
-        ::PostQuitMessage(msg.wParam);
-        return S_FALSE;
-      }
-
-      // WaitForMultipleObjects fails if cnt == 0.
-      if (cnt) {
-        // Briefly check the state of the handle array to see if something
-        // has signaled as we processed a message.
-        ASSERT1(phandles);
-        DWORD res = ::WaitForMultipleObjects(cnt, phandles, false, 0);
-        ASSERT1(res != WAIT_FAILED);
-        HRESULT hr = GetSignaledObjectPosition(cnt, res, pos);
-        if (SUCCEEDED(hr)) {
-          return hr;
-        }
-      }
-    }
-
-    // The wait with message. It is satisfied by either the objects getting
-    // signaled or when messages enter the message queue.
-    // TODO(omaha): implementing timeout is a little bit tricky since we
-    // want the timeout on the handles only and the native API does not
-    // have this semantic.
-    //
-    // TODO(omaha): use a waitable timer to implement the timeout.
-    //
-    // When cnt is zero then the execution flow waits here until messages
-    // arrive in the input queue. Unlike WaitForMultipleObjects,
-    // MsgWaitForMultipleObjects does not error out when cnt == 0.
-    const DWORD timeout = INFINITE;
-    DWORD res(::MsgWaitForMultipleObjects(cnt, phandles, false, timeout,
-                                          QS_ALLINPUT));
-    ASSERT((res != WAIT_FAILED),
-           (_T("[MsgWaitForMultipleObjects returned WAIT_FAILED][%u]"),
-            ::GetLastError()));
-
-    ASSERT1(res != WAIT_TIMEOUT);
-
-    HRESULT hr = GetSignaledObjectPosition(cnt, res, pos);
-    if (SUCCEEDED(hr)) {
-      return hr;
-    }
-  }
-}
-
-// The simplest implementation of a message processor
-void BasicMessageHandler::Process(MSG* msg) {
-  ASSERT1(msg);
-  ::TranslateMessage(msg);
-  ::DispatchMessage(msg);
-}
-
-class BasicMessageHandlerInternal : public BasicMessageHandler,
-                                    public MessageHandlerInternalInterface {
- public:
-  BasicMessageHandlerInternal() {}
-  virtual void Process(MSG* msg, const HANDLE**, uint32*) {
-    BasicMessageHandler::Process(msg);
-  }
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(BasicMessageHandlerInternal);
-};
-
-
-bool WaitWithMessageLoopAny(const std::vector<HANDLE>& handles, uint32* pos) {
-  BasicMessageHandlerInternal msg_handler;
-  return WaitWithMessageLoopAnyInternal(&handles.front(), handles.size(), pos,
-                                        &msg_handler) != S_FALSE;
-}
-
-bool WaitWithMessageLoopAll(const std::vector<HANDLE>& handles) {
-  // make a copy of the vector, as objects must be removed from the
-  // wait array as they get signaled.
-  std::vector<HANDLE> h(handles);
-
-  // The function is mainly implemented in terms of WaitWithMessageLoopAny
-
-  // loop until all objects are signaled.
-  while (!h.empty()) {
-    uint32 pos(static_cast<uint32>(-1));
-    if (!WaitWithMessageLoopAny(h, &pos)) return false;
-    ASSERT1(pos < h.size());
-    h.erase(h.begin() + pos);   // remove the signaled object and loop
-  }
-
-  return true;
-}
-
-bool WaitWithMessageLoop(HANDLE h) {
-  BasicMessageHandlerInternal msg_handler;
-  uint32 pos(static_cast<uint32>(-1));
-  bool res =
-    WaitWithMessageLoopAnyInternal(&h, 1, &pos, &msg_handler) != S_FALSE;
-  if (res) {
-    // It's the first and the only handle that it is signaled.
-    ASSERT1(pos == 0);
-  }
-  return res;
-}
-
-// Wait with message loop for a certain period of time
-bool WaitWithMessageLoopTimed(DWORD ms) {
-  scoped_timer timer(::CreateWaitableTimer(NULL,
-                                           true,   // manual reset
-                                           NULL));
-  ASSERT1(get(timer));
-  LARGE_INTEGER timeout = MSto100NSRelative(ms);
-  BOOL timer_ok = ::SetWaitableTimer(get(timer),
-                                     &timeout,
-                                     0,
-                                     NULL,
-                                     NULL,
-                                     false);
-  ASSERT1(timer_ok);
-  return WaitWithMessageLoop(get(timer));
-}
-
-MessageLoopWithWait::MessageLoopWithWait() : message_handler_(NULL) {
-}
-
-void MessageLoopWithWait::set_message_handler(
-    MessageHandlerInterface* message_handler) {
-  message_handler_ = message_handler;
-}
-
-// The message loop and handle callback routine.
-HRESULT MessageLoopWithWait::Process() {
-  while (true) {
-    ASSERT1(callback_handles_.size() == callbacks_.size());
-
-    // The implementation allows for an empty array of handles. Taking the
-    // address of elements in an empty container is not allowed so we must
-    // deal with this case here.
-    size_t pos(0);
-    HRESULT hr = WaitWithMessageLoopAnyInternal(
-        callback_handles_.empty() ? NULL : &callback_handles_.front(),
-        callback_handles_.size(),
-        &pos,
-        this);
-
-    // In addition to E_*, S_FALSE should cause a return to happen here.
-    if (hr != S_OK) {
-      return hr;
-    }
-
-    ASSERT1(pos < callback_handles_.size());
-    ASSERT1(callback_handles_.size() == callbacks_.size());
-
-    HANDLE signaled_handle = callback_handles_[pos];
-    WaitCallbackInterface* callback_interface = callbacks_[pos];
-    RemoveHandleAt(pos);
-
-    if (!callback_interface->HandleSignaled(signaled_handle)) {
-      return S_OK;
-    }
-  }
-}
-
-// Handles one messgae and adjust the handles and cnt as appropriate after
-// handling the message.
-void MessageLoopWithWait::Process(MSG* msg, const HANDLE** handles,
-                                  uint32* cnt) {
-  ASSERT1(msg && handles && cnt);
-
-  if (message_handler_) {
-    message_handler_->Process(msg);
-  }
-
-  // Set the handles and count again because they may have changed
-  // while processing the message.
-  *handles = callback_handles_.empty() ? NULL : &callback_handles_.front();
-  *cnt = callback_handles_.size();
-}
-// Starts waiting on the given handle
-bool MessageLoopWithWait::RegisterWaitForSingleObject(
-    HANDLE handle, WaitCallbackInterface* callback) {
-  ASSERT1(callback_handles_.size() == callbacks_.size());
-  ASSERT1(callback != NULL);
-
-  if (callback_handles_.size() >= MAXIMUM_WAIT_OBJECTS - 1) {
-    return false;
-  }
-
-  // In case the user is registering a handle, that they previous added
-  // remove the previous one before adding it back into the array.
-  UnregisterWait(handle);
-  callback_handles_.push_back(handle);
-  callbacks_.push_back(callback);
-
-  ASSERT1(callback_handles_.size() == callbacks_.size());
-  return true;
-}
-
-// Finds the given handle and stops waiting on it
-bool MessageLoopWithWait::UnregisterWait(HANDLE handle) {
-  ASSERT1(callback_handles_.size() == callbacks_.size());
-
-  for (uint32 index = 0; index < callback_handles_.size() ; index++) {
-    if (callback_handles_[index] == handle) {
-      RemoveHandleAt(index);
-      return true;
-    }
-  }
-  return false;
-}
-
-// Removes the wait handle at the given position
-void MessageLoopWithWait::RemoveHandleAt(uint32 pos) {
-  ASSERT1(callback_handles_.size() == callbacks_.size());
-  ASSERT1(pos < callback_handles_.size());
-
-  callback_handles_.erase(callback_handles_.begin() + pos);
-  callbacks_.erase(callbacks_.begin() + pos);
-
-  ASSERT1(callback_handles_.size() == callbacks_.size());
-}
-
-HRESULT CallEntryPoint0(const TCHAR* dll_path,
-                        const char* function_name,
-                        HRESULT* result) {
-  ASSERT1(dll_path);
-  ASSERT1(::lstrlen(dll_path) > 0);
-  ASSERT1(function_name);
-  ASSERT1(::strlen(function_name) > 0);
-  ASSERT1(result);
-
-  scoped_library dll(::LoadLibrary(dll_path));
-  if (!dll) {
-    return HRESULTFromLastError();
-  }
-
-  HRESULT (*proc)() = reinterpret_cast<HRESULT (*)()>(
-      ::GetProcAddress(get(dll), function_name));
-  if (!proc) {
-    return HRESULT_FROM_WIN32(ERROR_INVALID_FUNCTION);
-  }
-
-  *result = (proc)();
-  return S_OK;
-}
-
-// Register a DLL
-HRESULT RegisterDll(const TCHAR* dll_path) {
-  HRESULT hr = S_OK;
-  HRESULT hr_call = CallEntryPoint0(dll_path, "DllRegisterServer", &hr);
-  if (SUCCEEDED(hr_call)) {
-    return hr;
-  }
-  return hr_call;
-}
-
-// Unregister a DLL
-HRESULT UnregisterDll(const TCHAR* dll_path) {
-  HRESULT hr = S_OK;
-  HRESULT hr_call = CallEntryPoint0(dll_path, "DllUnregisterServer", &hr);
-  if (SUCCEEDED(hr_call)) {
-    return hr;
-  }
-  return hr_call;
-}
-
-// Register/unregister an EXE
-HRESULT RegisterOrUnregisterExe(const TCHAR* exe_path, const TCHAR* cmd_line) {
-  ASSERT1(exe_path);
-  ASSERT1(cmd_line);
-
-  // cmd_line parameter really contains the arguments to be passed
-  // on the process creation command line.
-  PROCESS_INFORMATION pi = {0};
-  HRESULT hr = System::StartProcessWithArgsAndInfo(exe_path, cmd_line, &pi);
-  if (FAILED(hr)) {
-    UTIL_LOG(LEVEL_WARNING, (_T("[RegisterOrUnregisterExe]")
-                             _T("[failed to start process]")
-                             _T("[%s][%s][0x%08x]"), exe_path, cmd_line, hr));
-    return hr;
-  }
-  // Take ownership of the handles for clean up.
-  scoped_thread thread(pi.hThread);
-  scoped_process process(pi.hProcess);
-
-  // ATL COM servers return an HRESULT on exit. There is a case in which they
-  // return -1 which seems like a bug in ATL. It appears there is no
-  // documented convention on what a local server would return for errors.
-  // There is a possibility that a server would return Windows errors.
-
-  // Wait on the process to exit and return the exit code of the process.
-  DWORD result(::WaitForSingleObject(get(process), INFINITE));
-  DWORD exit_code(0);
-  if (result == WAIT_OBJECT_0 &&
-      ::GetExitCodeProcess(get(process), &exit_code)) {
-    return static_cast<HRESULT>(exit_code);
-  } else {
-    return HRESULT_FROM_WIN32(ERROR_TIMEOUT);
-  }
-}
-
-// Register a COM Local Server
-HRESULT RegisterServer(const TCHAR* exe_path) {
-  return RegisterOrUnregisterExe(exe_path, _T("/RegServer"));
-}
-
-// Unregister a COM Local Server
-HRESULT UnregisterServer(const TCHAR* exe_path) {
-  return RegisterOrUnregisterExe(exe_path, _T("/UnregServer"));
-}
-
-// Register a Service
-HRESULT RegisterService(const TCHAR* exe_path) {
-  return RegisterOrUnregisterExe(exe_path, _T("/Service"));
-}
-
-// Unregister a Service
-HRESULT UnregisterService(const TCHAR* exe_path) {
-  // Unregistering a service is via UnregServer
-  return RegisterOrUnregisterExe(exe_path, _T("/UnregServer"));
-}
-
-// Adapted from gds installer/install/work_list.cpp: InstallServiceExecutable
-HRESULT RunService(const TCHAR* service_name) {
-  scoped_service manager(::OpenSCManager(NULL,  // local machine
-                                         NULL,  // ServicesActive database
-                                         STANDARD_RIGHTS_READ));
-  ASSERT1(get(manager));
-  if (!get(manager)) {
-    return HRESULTFromLastError();
-  }
-
-  scoped_service service(::OpenService(get(manager), service_name,
-                                       SERVICE_START));
-  ASSERT1(get(service));
-  if (!get(service)) {
-    return HRESULTFromLastError();
-  }
-
-  UTIL_LOG(L2, (_T("start service")));
-  if (!::StartService(get(service), 0, NULL)) {
-    return HRESULTFromLastError();
-  }
-  return S_OK;
-}
-
-
-HRESULT ReadEntireFile(const TCHAR* filepath,
-                       uint32 max_len,
-                       std::vector<byte>* buffer_out) {
-  return ReadEntireFileShareMode(filepath, max_len, 0, buffer_out);
-}
-
-HRESULT ReadEntireFileShareMode(const TCHAR* filepath,
-                                uint32 max_len,
-                                DWORD share_mode,
-                                std::vector<byte>* buffer_out) {
-  ASSERT1(filepath);
-  ASSERT1(buffer_out);
-
-  File file;
-  HRESULT hr = file.OpenShareMode(filepath, false, false, share_mode);
-  if (FAILED(hr)) {
-    // File missing.
-    return hr;
-  }
-
-  ON_SCOPE_EXIT_OBJ(file, &File::Close);
-
-  uint32 file_len = 0;
-  hr = file.GetLength(&file_len);
-  if (FAILED(hr)) {
-    // Should never happen
-    return hr;
-  }
-
-  if (max_len != 0 && file_len > max_len) {
-    // Too large to consider
-    return MEM_E_INVALID_SIZE;
-  }
-
-  if (file_len == 0) {
-    buffer_out->clear();
-    return S_OK;
-  }
-
-  int old_size = buffer_out->size();
-  buffer_out->resize(old_size + file_len);
-
-  uint32 bytes_read = 0;
-  hr = file.ReadFromStartOfFile(file_len,
-                                &(*buffer_out)[old_size],
-                                &bytes_read);
-  if (FAILED(hr)) {
-    // I/O error of some kind
-    return hr;
-  }
-
-  if (bytes_read != file_len) {
-    // Unexpected length. This could happen when reading a file someone else
-    // is writing to such as log files.
-    ASSERT1(false);
-    return E_UNEXPECTED;
-  }
-
-  // All's well that ends well
-  return S_OK;
-}
-
-HRESULT WriteEntireFile(const TCHAR * filepath,
-                        const std::vector<byte>& buffer_in) {
-  ASSERT1(filepath);
-
-  // File::WriteAt doesn't implement clear-on-open-for-write semantics,
-  // so just delete the file if it exists instead of writing into it.
-
-  if (File::Exists(filepath)) {
-    HRESULT hr = File::Remove(filepath);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  File file;
-  HRESULT hr = file.Open(filepath, true, false);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  ON_SCOPE_EXIT_OBJ(file, &File::Close);
-
-  uint32 bytes_written = 0;
-  hr = file.WriteAt(0, &buffer_in.front(), buffer_in.size(), 0, &bytes_written);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  if (bytes_written != buffer_in.size()) {
-    // This shouldn't happen, caller needs to investigate what's up.
-    ASSERT1(false);
-    return E_UNEXPECTED;
-  }
-
-  return S_OK;
-}
-
-// Conversions between a byte stream and a std::string
-HRESULT BufferToString(const std::vector<byte>& buffer_in, CStringA* str_out) {
-  ASSERT1(str_out);
-  str_out->Append(reinterpret_cast<const char*>(&buffer_in.front()),
-                  buffer_in.size());
-  return S_OK;
-}
-
-HRESULT StringToBuffer(const CStringA& str_in, std::vector<byte>* buffer_out) {
-  ASSERT1(buffer_out);
-  buffer_out->assign(str_in.GetString(),
-                     str_in.GetString() + str_in.GetLength());
-  return S_OK;
-}
-
-HRESULT BufferToString(const std::vector<byte>& buffer_in, CString* str_out) {
-  ASSERT1(str_out);
-
-  size_t len2 = buffer_in.size();
-  ASSERT1(len2 % 2 == 0);
-  size_t len = len2 / 2;
-
-  str_out->Append(reinterpret_cast<const TCHAR*>(&buffer_in.front()), len);
-
-  return S_OK;
-}
-
-HRESULT StringToBuffer(const CString& str_in, std::vector<byte>* buffer_out) {
-  ASSERT1(buffer_out);
-
-  size_t len = str_in.GetLength();
-  size_t len2 = len * 2;
-
-  buffer_out->resize(len2);
-  ::memcpy(&buffer_out->front(), str_in.GetString(), len2);
-
-  return S_OK;
-}
-
-HRESULT RegSplitKeyvalueName(const CString& keyvalue_name,
-                             CString* key_name,
-                             CString* value_name) {
-  ASSERT1(key_name);
-  ASSERT1(value_name);
-
-  const TCHAR kDefault[] = _T("\\(default)");
-
-  if (String_EndsWith(keyvalue_name, _T("\\"), false)) {
-    key_name->SetString(keyvalue_name, keyvalue_name.GetLength() - 1);
-    value_name->Empty();
-  } else if (String_EndsWith(keyvalue_name, kDefault, true)) {
-    key_name->SetString(keyvalue_name,
-                        keyvalue_name.GetLength() - TSTR_SIZE(kDefault));
-    value_name->Empty();
-  } else {
-    int last_slash = String_ReverseFindChar(keyvalue_name, _T('\\'));
-    if (last_slash == -1) {
-      // No slash found - bizzare and wrong
-      return E_FAIL;
-    }
-    key_name->SetString(keyvalue_name, last_slash);
-    value_name->SetString(keyvalue_name.GetString() + last_slash + 1,
-                          keyvalue_name.GetLength() - last_slash - 1);
-  }
-
-  return S_OK;
-}
-
-HRESULT ExpandEnvLikeStrings(const TCHAR* src,
-                             const std::map<CString, CString>& keywords,
-                             CString* dest) {
-  ASSERT1(src);
-  ASSERT1(dest);
-
-  const TCHAR kMarker = _T('%');
-
-  dest->Empty();
-
-  // Loop while finding the marker in the string
-  HRESULT hr = S_OK;
-  int pos = 0;
-  int marker_pos1 = -1;
-  while ((marker_pos1 = String_FindChar(src, kMarker, pos)) != -1) {
-    // Try to find the right marker
-    int marker_pos2 = -1;
-    const TCHAR* s = src + marker_pos1 + 1;
-    for (; *s; ++s) {
-      if (*s == kMarker) {
-        marker_pos2 = s - src;
-        break;
-      }
-      if (!String_IsIdentifierChar(*s)) {
-        break;
-      }
-    }
-    if (marker_pos2 == -1) {
-      // Unmatched marker found, skip
-      dest->Append(src + pos, marker_pos1 - pos + 1);
-      pos = marker_pos1 + 1;
-      continue;
-    }
-
-    // Get the name - without the % markers on each end
-    CString name(src + marker_pos1 + 1, marker_pos2 - marker_pos1 - 1);
-
-    bool found = false;
-    for (std::map<CString, CString>::const_iterator it(keywords.begin());
-         it != keywords.end();
-         ++it) {
-      if (_tcsicmp(it->first, name) == 0) {
-        dest->Append(src + pos, marker_pos1 - pos);
-        dest->Append(it->second);
-        found = true;
-        break;
-      }
-    }
-    if (!found) {
-      // No mapping found
-      UTIL_LOG(LE, (_T("[ExpandEnvLikeStrings]")
-                    _T("[no mapping found for '%s' in '%s']"), name, src));
-      dest->Append(src + pos, marker_pos2 - pos + 1);
-      hr = HRESULT_FROM_WIN32(ERROR_NOT_FOUND);
-    }
-
-    pos = marker_pos2 + 1;
-  }
-
-  int len = _tcslen(src);
-  if (pos < len) {
-    dest->Append(src + pos, len - pos);
-  }
-
-  return hr;
-}
-
-bool IsRegistryPath(const TCHAR* path) {
-  return String_StartsWith(path, _T("HKLM\\"), false) ||
-         String_StartsWith(path, _T("HKCU\\"), false) ||
-         String_StartsWith(path, _T("HKCR\\"), false) ||
-         String_StartsWith(path, _T("HKEY_LOCAL_MACHINE\\"), false) ||
-         String_StartsWith(path, _T("HKEY_CURRENT_USER\\"), false) ||
-         String_StartsWith(path, _T("HKEY_CLASSES_ROOT\\"), false);
-}
-
-bool IsUrl(const TCHAR* path) {
-  // Currently we only check for "http://" and "https://"
-  return String_StartsWith(path, kHttpProto, true) ||
-         String_StartsWith(path, kHttpsProto, true);
-}
-
-
-CString GuidToString(const GUID& guid) {
-  TCHAR guid_str[40] = {0};
-  VERIFY1(::StringFromGUID2(guid, guid_str, arraysize(guid_str)));
-  String_ToUpper(guid_str);
-  return guid_str;
-}
-
-HRESULT StringToGuidSafe(const CString& str, GUID* guid) {
-  ASSERT1(guid);
-  TCHAR* s = const_cast<TCHAR*>(str.GetString());
-  return ::IIDFromString(s, guid);
-}
-
-// Helper function to convert a variant containing a list of strings
-void VariantToStringList(VARIANT var, std::vector<CString>* list) {
-  ASSERT1(list);
-
-  list->clear();
-
-  ASSERT1(V_VT(&var) == VT_DISPATCH);
-  CComPtr<IDispatch> obj = V_DISPATCH(&var);
-  ASSERT1(obj);
-
-  CComVariant var_length;
-  VERIFY1(SUCCEEDED(obj.GetPropertyByName(_T("length"), &var_length)));
-  ASSERT1(V_VT(&var_length) == VT_I4);
-  int length = V_I4(&var_length);
-
-  for (int i = 0; i < length; ++i) {
-    CComVariant value;
-    VERIFY1(SUCCEEDED(obj.GetPropertyByName(itostr(i), &value)));
-    if (V_VT(&value) == VT_BSTR) {
-      list->push_back(V_BSTR(&value));
-    } else {
-      ASSERT1(false);
-    }
-  }
-}
-
-
-HRESULT GetCurrentProcessHandle(HANDLE* handle) {
-  ASSERT1(handle);
-  scoped_process real_handle;
-  HANDLE pseudo_handle = ::GetCurrentProcess();
-  bool res = ::DuplicateHandle(
-    pseudo_handle,         // this process pseudo-handle
-    pseudo_handle,         // handle to duplicate
-    pseudo_handle,         // the process receiving the handle
-    address(real_handle),  // this process real handle
-    0,                     // ignored
-    false,                 // don't inherit this handle
-    DUPLICATE_SAME_ACCESS) != 0;
-
-  *handle = NULL;
-  if (!res) {
-    return HRESULTFromLastError();
-  }
-  *handle = release(real_handle);
-  return S_OK;
-}
-
-HRESULT DuplicateTokenIntoCurrentProcess(HANDLE source_process,
-                                         HANDLE token_to_duplicate,
-                                         CAccessToken* duplicated_token) {
-  ASSERT1(source_process);
-  ASSERT1(token_to_duplicate);
-  ASSERT1(duplicated_token);
-
-  scoped_handle alt_token;
-  bool res = ::DuplicateHandle(
-      source_process,                 // Process whose handle needs duplicating.
-      token_to_duplicate,             // Handle to duplicate.
-      ::GetCurrentProcess(),          // Current process receives the handle.
-      address(alt_token),             // Duplicated handle.
-      TOKEN_ALL_ACCESS,               // Access requested for the new handle.
-      false,                          // Do not inherit the new handle.
-      DUPLICATE_SAME_ACCESS) != 0;    // Same access as token_to_duplicate.
-
-  if (!res) {
-    HRESULT hr = HRESULTFromLastError();
-    CORE_LOG(LE, (_T("[DuplicateTokenIntoCurrentProcess failed][0x%x]"), hr));
-    return hr;
-  }
-
-  duplicated_token->Attach(release(alt_token));
-  return S_OK;
-}
-
-
-// get a time64 value
-// NOTE: If the value is greater than the
-// max value, then SetValue will be called using the max_value.
-HRESULT GetLimitedTimeValue(const TCHAR* full_key_name, const TCHAR* value_name,
-                            time64 max_time, time64* value,
-                            bool* limited_value) {
-  ASSERT1(full_key_name);
-  ASSERT1(value);
-  STATIC_ASSERT(sizeof(time64) == sizeof(DWORD64));
-
-  if (limited_value) {
-    *limited_value = false;
-  }
-  HRESULT hr = RegKey::GetValue(full_key_name, value_name, value);
-  if (SUCCEEDED(hr) && *value > max_time) {
-    *value = max_time;
-
-    // Use a different hr for the setting of the value b/c
-    // the returned hr should reflect the success/failure of reading the key
-    HRESULT set_value_hr = RegKey::SetValue(full_key_name, value_name, *value);
-    ASSERT(SUCCEEDED(set_value_hr),
-           (_T("GetLimitedTimeValue - failed when setting a value: 0x%08x]"),
-            set_value_hr));
-    if (SUCCEEDED(set_value_hr) && limited_value) {
-      *limited_value = true;
-    }
-  }
-  return hr;
-}
-
-// get a time64 value trying reg keys successively if there is a
-// failure in getting a value.
-HRESULT GetLimitedTimeValues(const TCHAR* full_key_names[],
-                             int key_names_length,
-                             const TCHAR* value_name,
-                             time64 max_time,
-                             time64* value,
-                             bool* limited_value) {
-  ASSERT1(full_key_names);
-  ASSERT1(value);
-  ASSERT1(key_names_length > 0);
-
-  HRESULT hr = E_FAIL;
-  for (int i = 0; i < key_names_length; ++i) {
-    hr = GetLimitedTimeValue(full_key_names[i], value_name, max_time, value,
-                             limited_value);
-    if (SUCCEEDED(hr)) {
-      return hr;
-    }
-  }
-  return hr;
-}
-
-// Wininet.dll (and especially the version that comes with IE7, with 01/12/07
-// timestamp) incorrectly initializes Rasman.dll. As a result, there is a race
-// condition that causes double-free on a memory from process heap.
-// This causes memory corruption in the heap that may later produce a variety
-// of ill effects, most frequently a crash with a callstack that contains
-// wininet and rasman, or ntdll!RtlAllocHeap. The root cause is that
-// Rasapi32!LoadRasmanDllAndInit is not thread safe and can start very involved
-// process of initialization on 2 threads at the same time. It's a bug.
-// Solution: in the begining of the program, trigger synchronous load of
-// rasman dll. The easy way is to call a public ras api that does synchronous
-// initialization, which is what we do here.
-void EnsureRasmanLoaded() {
-  RASENTRYNAME ras_entry_name = {0};
-  DWORD size_bytes = sizeof(ras_entry_name);
-  DWORD number_of_entries = 0;
-  ras_entry_name.dwSize = size_bytes;
-  // we don't really need results of this method,
-  // it simply triggers RASAPI32!LoadRasmanDllAndInit() internally.
-  ::RasEnumEntries(NULL,
-                   NULL,
-                   &ras_entry_name,
-                   &size_bytes,
-                   &number_of_entries);
-}
-
-// Appends two reg keys. Handles the situation where there are traling
-// back slashes in one and leading back slashes in two.
-CString AppendRegKeyPath(const CString& one, const CString& two) {
-  CString leftpart(one);
-  int length = leftpart.GetLength();
-  int i = 0;
-  for (i = length - 1; i >= 0; --i) {
-    if (leftpart[i] != _T('\\')) {
-      break;
-    }
-  }
-  leftpart = leftpart.Left(i+1);
-
-  CString rightpart(two);
-  int lengthr = rightpart.GetLength();
-  for (i = 0; i < lengthr; ++i) {
-    if (rightpart[i] != _T('\\')) {
-      break;
-    }
-  }
-  rightpart = rightpart.Right(lengthr - i);
-
-  CString result;
-  SafeCStringFormat(&result, _T("%s\\%s"), leftpart, rightpart);
-  return result;
-}
-
-CString AppendRegKeyPath(const CString& one, const CString& two,
-                         const CString& three) {
-  CString result = AppendRegKeyPath(one, two);
-  result = AppendRegKeyPath(result, three);
-  return result;
-}
-
-
-HRESULT GetUserKeysFromHkeyUsers(std::vector<CString>* key_names) {
-  ASSERT1(key_names);
-  CORE_LOG(L3, (_T("[GetUserKeysFromHkeyUsers]")));
-
-  TCHAR user_key_name[MAX_PATH] = {0};
-  int i = 0;
-  while (::RegEnumKey(HKEY_USERS, i++, user_key_name, MAX_PATH) !=
-                      ERROR_NO_MORE_ITEMS) {
-        byte sid_buffer[SECURITY_MAX_SID_SIZE] = {0};
-    PSID sid = reinterpret_cast<PSID>(sid_buffer);
-    if (::ConvertStringSidToSid(user_key_name, &sid) != 0) {
-      // We could convert the string SID into a real SID. If not
-      // we just ignore.
-      DWORD size = MAX_PATH;
-      DWORD size_domain = MAX_PATH;
-      SID_NAME_USE sid_type = SidTypeComputer;
-      TCHAR user_name[MAX_PATH] = {0};
-      TCHAR domain_name[MAX_PATH] = {0};
-
-      if (::LookupAccountSid(NULL, sid, user_name, &size,
-                             domain_name, &size_domain, &sid_type) == 0) {
-        HRESULT hr = HRESULTFromLastError();
-        CORE_LOG(LW, (_T("[GetUserKeysFromHkeyUsers LookupAccountSid failed]")
-                      _T("[0x%08x]"), hr));
-        continue;
-      }
-
-      if (sid_type == SidTypeUser) {
-        // Change the RunAs keys for the user goopdates to point to the
-        // machine install.
-        CString user_reg_key_name = AppendRegKeyPath(USERS_KEY, user_key_name);
-        key_names->push_back(user_reg_key_name);
-      }
-    }
-  }
-
-  return S_OK;
-}
-
-HRESULT IsSystemProcess(bool* is_system_process) {
-  CAccessToken current_process_token;
-  if (!current_process_token.GetProcessToken(TOKEN_QUERY,
-                                             ::GetCurrentProcess())) {
-    HRESULT hr = HRESULTFromLastError();
-    ASSERT(false, (_T("CAccessToken::GetProcessToken failed: 0x%08x"), hr));
-    return hr;
-  }
-  CSid logon_sid;
-  if (!current_process_token.GetUser(&logon_sid)) {
-    HRESULT hr = HRESULTFromLastError();
-    ASSERT(false, (_T("CAccessToken::GetUser failed: 0x%08x"), hr));
-    return hr;
-  }
-  *is_system_process = logon_sid == Sids::System();
-  return S_OK;
-}
-
-HRESULT IsUserLoggedOn(bool* is_logged_on) {
-  ASSERT1(is_logged_on);
-  bool is_local_system(false);
-  HRESULT hr = IsSystemProcess(&is_local_system);
-  if (SUCCEEDED(hr) && is_local_system) {
-    *is_logged_on = true;
-    return S_OK;
-  }
-  return UserRights::UserIsLoggedOnInteractively(is_logged_on);
-}
-
-bool IsClickOnceDisabled() {
-  CComPtr<IInternetZoneManager> zone_mgr;
-  HRESULT hr =  zone_mgr.CoCreateInstance(CLSID_InternetZoneManager);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[InternetZoneManager CreateInstance fail][0x%08x]"), hr));
-    return true;
-  }
-
-  DWORD policy = URLPOLICY_DISALLOW;
-  size_t policy_size = sizeof(policy);
-  hr = zone_mgr->GetZoneActionPolicy(URLZONE_INTERNET,
-                                     URLACTION_MANAGED_UNSIGNED,
-                                     reinterpret_cast<BYTE*>(&policy),
-                                     policy_size,
-                                     URLZONEREG_DEFAULT);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[GetZoneActionPolicy failed][0x%08x]"), hr));
-    return true;
-  }
-
-  return policy == URLPOLICY_DISALLOW;
-}
-
-// This function only uses kernel32, and it is safe to call from DllMain.
-HRESULT PinModuleIntoProcess(const CString& module_name) {
-  ASSERT1(!module_name.IsEmpty());
-  static HMODULE module_handle = NULL;
-  typedef BOOL (WINAPI *Fun)(DWORD flags,
-                             LPCWSTR module_name,
-                             HMODULE* module_handle);
-
-  HINSTANCE kernel_instance = ::GetModuleHandle(_T("kernel32.dll"));
-  ASSERT1(kernel_instance);
-  Fun pfn = NULL;
-  if (GPA(kernel_instance, "GetModuleHandleExW", &pfn)) {
-    if ((*pfn)(GET_MODULE_HANDLE_EX_FLAG_PIN, module_name, &module_handle)) {
-      return S_OK;
-    }
-    ASSERT(false, (_T("GetModuleHandleExW() failed: %d"), ::GetLastError()));
-  }
-
-  module_handle = ::LoadLibrary(module_name);
-  ASSERT(NULL != module_handle, (_T("LoadLibrary fail: %d"), ::GetLastError()));
-  if (NULL == module_handle) {
-    return HRESULTFromLastError();
-  }
-
-  return S_OK;
-}
-
-bool ShellExecuteExEnsureParent(LPSHELLEXECUTEINFO shell_exec_info) {
-  UTIL_LOG(L3, (_T("[ShellExecuteExEnsureParent]")));
-
-  ASSERT1(shell_exec_info);
-  bool shell_exec_succeeded(false);
-  DWORD last_error(ERROR_SUCCESS);
-
-  {
-    // hwnd_parent window is destroyed at the end of the scope when the
-    // destructor of scoped_window calls ::DestroyWindow.
-    scoped_window hwnd_parent;
-
-    if (!shell_exec_info->hwnd && vista_util::IsVistaOrLater()) {
-      reset(hwnd_parent, CreateForegroundParentWindowForUAC());
-
-      if (!hwnd_parent) {
-        last_error = ::GetLastError();
-        UTIL_LOG(LE, (_T("[CreateDummyOverlappedWindow failed]")));
-        // Restore last error in case the logging reset it.
-        ::SetLastError(last_error);
-        return false;
-      }
-
-      shell_exec_info->hwnd = get(hwnd_parent);
-
-      // If elevation is required on Vista, call ::SetForegroundWindow(). This
-      // will make sure that the elevation prompt, as well as the elevated
-      // process window comes up in the foreground. It will also ensure that in
-      // the case where the elevation prompt is cancelled, the error dialog
-      // shown from this process comes up in the foreground.
-      if (shell_exec_info->lpVerb &&
-          _tcsicmp(shell_exec_info->lpVerb, _T("runas")) == 0) {
-        if (!::SetForegroundWindow(get(hwnd_parent))) {
-          UTIL_LOG(LW, (_T("[SetForegroundWindow failed][%d]"),
-                        ::GetLastError()));
-        }
-      }
-    }
-
-    shell_exec_succeeded = !!::ShellExecuteEx(shell_exec_info);
-
-    if (shell_exec_succeeded) {
-      if (shell_exec_info->hProcess) {
-        DWORD pid = Process::GetProcessIdFromHandle(shell_exec_info->hProcess);
-        OPT_LOG(L1, (_T("[Started process][%u]"), pid));
-        if (!::AllowSetForegroundWindow(pid)) {
-          UTIL_LOG(LW, (_T("[AllowSetForegroundWindow failed][%d]"),
-                        ::GetLastError()));
-        }
-      } else {
-        OPT_LOG(L1, (_T("[Started process][PID unknown]")));
-      }
-    } else {
-      last_error = ::GetLastError();
-      UTIL_LOG(LE, (_T("[ShellExecuteEx failed][%s][%s][0x%08x]"),
-                    shell_exec_info->lpFile, shell_exec_info->lpParameters,
-                    last_error));
-    }
-  }
-
-  // The implicit ::DestroyWindow call from the scoped_window could have reset
-  // the last error, so restore it.
-  ::SetLastError(last_error);
-
-  return shell_exec_succeeded;
-}
-
-// Loads and unloads advapi32.dll for every call. If performance is an issue
-// consider keeping the dll always loaded and holding the pointer to the
-// RtlGenRandom in a static variable.
-// Use the function with care. While the function is documented, it may be
-// altered or made unavailable in future versions of the operating system.
-bool GenRandom(void* buffer, size_t buffer_length) {
-  ASSERT1(buffer);
-  scoped_library lib(::LoadLibrary(_T("ADVAPI32.DLL")));
-  if (lib) {
-    typedef BOOLEAN (APIENTRY *RtlGenRandomType)(void*, ULONG);
-    RtlGenRandomType rtl_gen_random = reinterpret_cast<RtlGenRandomType>(
-        ::GetProcAddress(get(lib), "SystemFunction036"));
-    return rtl_gen_random && rtl_gen_random(buffer, buffer_length);
-  }
-
-  // Use CAPI to generate randomness for systems which do not support
-  // RtlGenRandomType, for instance Windows 2000.
-  const uint32 kCspFlags = CRYPT_VERIFYCONTEXT | CRYPT_SILENT;
-  HCRYPTPROV csp = NULL;
-  if (::CryptAcquireContext(&csp, NULL, NULL, PROV_RSA_FULL, kCspFlags)) {
-    if (::CryptGenRandom(csp, buffer_length, static_cast<BYTE*>(buffer))) {
-      return true;
-    }
-  }
-  VERIFY1(::CryptReleaseContext(csp, 0));
-  return false;
-}
-
-// Assumes the path in command is properly enclosed if necessary.
-HRESULT ConfigureRunAtStartup(const CString& root_key_name,
-                              const CString& run_value_name,
-                              const CString& command,
-                              bool install) {
-  UTIL_LOG(L3, (_T("[ConfigureRunAtStartup]")));
-
-  const CString key_path = AppendRegKeyPath(root_key_name, REGSTR_PATH_RUN);
-  HRESULT hr(S_OK);
-
-  if (install) {
-    hr = RegKey::SetValue(key_path, run_value_name, command);
-  } else {
-    hr = RegKey::DeleteValue(key_path, run_value_name);
-  }
-
-  return hr;
-}
-
-HRESULT GetExePathFromCommandLine(const TCHAR* command_line,
-                                  CString* exe_path) {
-  ASSERT1(exe_path);
-  CString command_line_str(command_line);
-  command_line_str.Trim(_T(' '));
-  if (command_line_str.IsEmpty()) {
-    // ::CommandLineToArgvW parses the current process command line for blank
-    // strings. We do not want this behavior.
-    return E_INVALIDARG;
-  }
-
-  int argc = 0;
-  wchar_t** argv = ::CommandLineToArgvW(command_line_str, &argc);
-  if (argc == 0 || !argv) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LE, (_T("[::CommandLineToArgvW failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  *exe_path = argv[0];
-  ::LocalFree(argv);
-  exe_path->Trim(_T(' '));
-  ASSERT1(!exe_path->IsEmpty());
-  return S_OK;
-}
-
-// Tries to open the _MSIExecute mutex and tests its state. MSI sets the
-// mutex when processing sequence tables. This indicates MSI is busy.
-// The function returns S_OK if the mutex is not owned by MSI or the mutex has
-// not been created.
-HRESULT WaitForMSIExecute(int timeout_ms) {
-  const TCHAR* mutex_name = _T("Global\\_MSIExecute");
-  scoped_mutex mutex(::OpenMutex(SYNCHRONIZE, false, mutex_name));
-  if (!mutex) {
-    DWORD error = ::GetLastError();
-    return (error == ERROR_FILE_NOT_FOUND) ? S_OK : HRESULT_FROM_WIN32(error);
-  }
-  UTIL_LOG(L3, (_T("[Wait for _MSIExecute]")));
-  switch (::WaitForSingleObject(get(mutex), timeout_ms)) {
-    case WAIT_OBJECT_0:
-    case WAIT_ABANDONED:
-      VERIFY1(::ReleaseMutex(get(mutex)));
-      return S_OK;
-    case WAIT_TIMEOUT:
-      return HRESULT_FROM_WIN32(ERROR_TIMEOUT);
-    case WAIT_FAILED:
-      return HRESULTFromLastError();
-    default:
-      return E_FAIL;
-  }
-}
-
-CString GetEnvironmentVariableAsString(const TCHAR* name) {
-  CString value;
-  size_t value_length = ::GetEnvironmentVariable(name, NULL, 0);
-  if (value_length) {
-    VERIFY1(::GetEnvironmentVariable(name,
-                                     CStrBuf(value, value_length),
-                                     value_length));
-  }
-  return value;
-}
-
-// States are documented at
-// http://technet.microsoft.com/en-us/library/cc721913.aspx.
-bool IsWindowsInstalling() {
-  static const TCHAR kVistaSetupStateKey[] =
-      _T("Software\\Microsoft\\Windows\\CurrentVersion\\Setup\\State");
-  static const TCHAR kImageStateValueName[] = _T("ImageState");
-  static const TCHAR kImageStateUnuseableValue[] =
-      _T("IMAGE_STATE_UNDEPLOYABLE");
-  static const TCHAR kImageStateGeneralAuditValue[] =
-      _T("IMAGE_STATE_GENERALIZE_RESEAL_TO_AUDIT");
-  static const TCHAR kImageStateSpecialAuditValue[] =
-      _T("IMAGE_STATE_SPECIALIZE_RESEAL_TO_AUDIT");
-
-  static const TCHAR kXPSetupStateKey[] = _T("System\\Setup");
-  static const TCHAR kAuditFlagValueName[] = _T("AuditInProgress");
-
-  if (vista_util::IsVistaOrLater()) {
-    RegKey vista_setup_key;
-    HRESULT hr =
-        vista_setup_key.Open(HKEY_LOCAL_MACHINE, kVistaSetupStateKey, KEY_READ);
-    if (SUCCEEDED(hr)) {
-      CString state;
-      hr = vista_setup_key.GetValue(kImageStateValueName, &state);
-      if (SUCCEEDED(hr) &&
-          !state.IsEmpty() &&
-          (0 == state.CompareNoCase(kImageStateUnuseableValue) ||
-           0 == state.CompareNoCase(kImageStateGeneralAuditValue) ||
-           0 == state.CompareNoCase(kImageStateSpecialAuditValue)))
-        return true;  // Vista is still installing.
-    }
-  } else {
-    RegKey xp_setup_key;
-    HRESULT hr =
-        xp_setup_key.Open(HKEY_LOCAL_MACHINE, kXPSetupStateKey, KEY_READ);
-    if (SUCCEEDED(hr)) {
-      DWORD audit_flag(0);
-      hr = xp_setup_key.GetValue(kAuditFlagValueName, &audit_flag);
-      if (SUCCEEDED(hr) && 0 != audit_flag)
-        return true;  // XP is still installing.
-    }
-  }
-  return false;
-}
-
-HRESULT GetGuid(CString* guid) {
-  GUID guid_local = {0};
-  HRESULT hr = ::CoCreateGuid(&guid_local);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  *guid = GuidToString(guid_local);
-  return S_OK;
-}
-
-CString GetMessageForSystemErrorCode(DWORD error_code) {
-  CORE_LOG(L3, (_T("[GetMessageForSystemErrorCode][%u]"), error_code));
-
-  TCHAR* system_allocated_buffer = NULL;
-  const DWORD kFormatOptions = FORMAT_MESSAGE_ALLOCATE_BUFFER |
-                               FORMAT_MESSAGE_FROM_SYSTEM |
-                               FORMAT_MESSAGE_IGNORE_INSERTS |
-                               FORMAT_MESSAGE_MAX_WIDTH_MASK;
-  DWORD tchars_written = ::FormatMessage(
-      kFormatOptions,
-      NULL,
-      error_code,
-      0,
-      reinterpret_cast<LPWSTR>(&system_allocated_buffer),
-      0,
-      NULL);
-
-  CString message;
-  if (tchars_written > 0) {
-    message = system_allocated_buffer;
-  } else {
-    UTIL_LOG(LW, (_T("[::FormatMessage failed][%u]"), ::GetLastError()));
-  }
-
-  VERIFY1(!::LocalFree(system_allocated_buffer));
-
-  return message;
-}
-
-}  // namespace omaha
diff --git a/base/utils.h b/base/utils.h
deleted file mode 100644
index cfed08b..0000000
--- a/base/utils.h
+++ /dev/null
@@ -1,903 +0,0 @@
-// Copyright 2003-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_BASE_UTILS_H_
-#define OMAHA_BASE_UTILS_H_
-
-#include <windows.h>
-#include <accctrl.h>
-#include <aclapi.h>
-#include <sddl.h>
-#include <shellapi.h>
-#include <shlobj.h>
-#include <atlstr.h>
-#include <atlsecurity.h>
-#include <atlwin.h>
-#include <memory.h>
-#include <map>
-#include <vector>
-#include "base/basictypes.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/static_assert.h"
-#include "omaha/base/user_info.h"
-
-namespace omaha {
-
-// These definitions are not in any current Microsoft SDK header file. Taken
-// from platformsdk/v6_1/files/Include/ObjIdl.h.
-MIDL_INTERFACE("0000015B-0000-0000-C000-000000000046")
-IGlobalOptions : public IUnknown {
- public:
-    virtual HRESULT STDMETHODCALLTYPE Set(
-        /* [in] */ DWORD dwProperty,
-        /* [in] */ ULONG_PTR dwValue) = 0;
-
-    virtual HRESULT STDMETHODCALLTYPE Query(
-        /* [in] */ DWORD dwProperty,
-        /* [out] */ ULONG_PTR *pdwValue) = 0;
-};
-
-enum __MIDL___MIDL_itf_objidl_0000_0047_0001 {
-  COMGLB_EXCEPTION_HANDLING  = 1,
-  COMGLB_APPID  = 2
-};
-
-enum __MIDL___MIDL_itf_objidl_0000_0047_0002 {
-  COMGLB_EXCEPTION_HANDLE  = 0,
-  COMGLB_EXCEPTION_DONOT_HANDLE  = 1
-};
-
-// Determines whether to run ClickOnce components. This constant is not defined
-// in the SDK headers.
-#ifndef URLACTION_MANAGED_UNSIGNED
-#define URLACTION_MANAGED_UNSIGNED (0x00002004)
-#endif
-
-ULONGLONG VersionFromString(const CString& s);
-
-CString StringFromVersion(ULONGLONG version);
-
-// Gets current directory
-CString GetCurrentDir();
-
-// Creates a unique file name using a new guid. Does not check for
-// presence of this file in the directory.
-HRESULT GetNewFileNameInDirectory(const CString& dir, CString* file_name);
-
-// Gets security descriptor with a DACL that grants the admin_access_mask to
-// Admins and System, and the non_admin_access_mask to Interactive.
-void GetEveryoneDaclSecurityDescriptor(CSecurityDesc* sd,
-                                       ACCESS_MASK admin_access_mask,
-                                       ACCESS_MASK non_admin_access_mask);
-
-// Get security descriptor containing a DACL that grants the ACCESS_MASK access
-// to admins and system.
-void GetAdminDaclSecurityDescriptor(CSecurityDesc* sd, ACCESS_MASK accessmask);
-
-// Get security attributes containing a DACL that grant the ACCESS_MASK access
-// to admins and system.
-void GetAdminDaclSecurityAttributes(CSecurityAttributes* sec_attr,
-                                    ACCESS_MASK accessmask);
-
-// This method is intended to be called by same or lower integrity COM clients.
-// Calls ::CoInitializeSecurity with the default DACL. Servers are allowed to
-// impersonate the client.
-HRESULT InitializeClientSecurity();
-
-// This method calls ::CoInitializeSecurity with security settings and ACLs of
-// callers that are allowed access to the COM server. Clients can only identify
-// the server, and custom marshaling as well as activate-as-activator are
-// disallowed.
-// * If the bool is set, a DACL that provides COM_RIGHTS_EXECUTE access
-// for medium-integrity callers is set.
-// * If the bool is not set, but the caller is Local System, the function will
-// set a security descriptor that also allows the Administrators group access to
-// the COM server.
-HRESULT InitializeServerSecurity(bool allow_calls_from_medium);
-
-// Ensures that the COM marshaling machinery does not eat crashes.
-HRESULT DisableCOMExceptionHandling();
-
-// Merges an Allowed ACE into a named object. If the ACE already exists in the
-// DACL with the same permissions (or a superset) and the same ACE flags, the
-// merge is skipped.
-HRESULT AddAllowedAce(const TCHAR* object_name,
-                      SE_OBJECT_TYPE object_type,
-                      const CSid& sid,
-                      ACCESS_MASK required_permissions,
-                      uint8 required_ace_flags);
-
-struct NamedObjectAttributes {
-  CString name;
-  CSecurityAttributes sa;
-};
-
-// For machine and local system, the prefix would be "Global\G{obj_name}".
-// For user, the prefix would be "Global\G{user_sid}{obj_name}".
-// For machine objects, returns a security attributes that gives permissions to
-// both Admins and SYSTEM. This allows for cases where SYSTEM creates the named
-// object first. The default DACL for SYSTEM will not allow Admins access.
-void GetNamedObjectAttributes(const TCHAR* base_name,
-                              bool is_machine,
-                              NamedObjectAttributes* attr);
-
-// Returns true if the current process is running as SYSTEM.
-HRESULT IsSystemProcess(bool* is_system_process);
-
-// Returns true if the user of the current process is Local System or it has an
-// interactive session: console, terminal services, or fast user switching.
-HRESULT IsUserLoggedOn(bool* is_logged_on);
-
-// Returns true if URLACTION_MANAGED_UNSIGNED is disabled for the Internet zone
-// for the current user.
-bool IsClickOnceDisabled();
-
-// Wrapper around ::GetProcAddress().
-template <typename T>
-bool GPA(HMODULE module, const char* function_name, T* function_pointer) {
-  ASSERT1(module);
-  ASSERT1(function_name);
-  ASSERT1(function_pointer);
-
-  *function_pointer = reinterpret_cast<T>(::GetProcAddress(module,
-                                                           function_name));
-  if (NULL == *function_pointer) {
-    UTIL_LOG(LW, (_T("GetProcAddress failed [%s]"), CA2T(function_name)));
-  }
-  return NULL != *function_pointer;
-}
-
-#define GPA_WRAP(module,                                                    \
-                 function,                                                  \
-                 proto,                                                     \
-                 call,                                                      \
-                 calling_convention,                                        \
-                 result_type,                                               \
-                 result_error)                                              \
-typedef result_type (calling_convention *function##_pointer) proto;         \
-inline result_type function##Wrap proto {                                   \
-  HINSTANCE module_instance = ::GetModuleHandle(_T(#module));               \
-  ASSERT1(module_instance);                                                 \
-  if (!module_instance) {                                                   \
-    return result_error;                                                    \
-  }                                                                         \
-  function##_pointer fn = NULL;                                             \
-  return GPA(module_instance, #function, &fn) ? (*fn) call : result_error;  \
-}
-
-GPA_WRAP(kernel32.dll,
-         AttachConsole,
-         (DWORD process_id),
-         (process_id),
-         WINAPI,
-         BOOL,
-         0);
-
-// Private Object Namespaces for Vista and above. More information here:
-// http://msdn2.microsoft.com/en-us/library/ms684295(VS.85).aspx
-GPA_WRAP(kernel32.dll,
-         CreateBoundaryDescriptorW,
-         (LPCWSTR boundary_name, ULONG flags),
-         (boundary_name, flags),
-         WINAPI,
-         HANDLE,
-         NULL);
-GPA_WRAP(kernel32.dll,
-         AddSIDToBoundaryDescriptor,
-         (HANDLE* boundary_descriptor, PSID required_sid),
-         (boundary_descriptor, required_sid),
-         WINAPI,
-         BOOL,
-         FALSE);
-GPA_WRAP(kernel32.dll,
-         CreatePrivateNamespaceW,
-         (LPSECURITY_ATTRIBUTES private_namespace_attributes, LPVOID boundary_descriptor, LPCWSTR alias_prefix),  // NOLINT
-         (private_namespace_attributes, boundary_descriptor, alias_prefix),
-         WINAPI,
-         HANDLE,
-         NULL);
-GPA_WRAP(kernel32.dll,
-         OpenPrivateNamespaceW,
-         (LPVOID boundary_descriptor, LPCWSTR alias_prefix),
-         (boundary_descriptor, alias_prefix),
-         WINAPI,
-         HANDLE,
-         NULL);
-
-bool IsPrivateNamespaceAvailable();
-
-
-HRESULT PinModuleIntoProcess(const CString& module_name);
-
-// Creates a directory with default security.
-//   S_OK:    Created directory
-//   S_FALSE: Directory already existed
-//   E_FAIL:  Couldn't create
-HRESULT CreateDir(const TCHAR* dirname, LPSECURITY_ATTRIBUTES security_attr);
-
-// Gets the path for the specified special folder.
-HRESULT GetFolderPath(int csidl, CString* path);
-
-// Returns true if this directory name is 'safe' for deletion:
-//  - it doesn't contain ".."
-//  - it doesn't specify a drive root
-bool SafeDirectoryNameForDeletion(const TCHAR* dir_name);
-
-// Deletes a directory and its files.
-HRESULT DeleteDirectory(const TCHAR* ir_name);
-
-// Deletes all files in a directory.
-HRESULT DeleteDirectoryFiles(const TCHAR* dir_name);
-
-// Deletes all files in a directory matching a wildcard.
-HRESULT DeleteWildcardFiles(const TCHAR* dir_name, const TCHAR* wildcard_name);
-
-// Deletes either a file or directory before or after reboot.
-HRESULT DeleteBeforeOrAfterReboot(const TCHAR* targetname);
-
-// Gets the size of all files in a directory.
-// Aborts counting if one of the maximum criteria is reached.
-HRESULT SafeGetDirectorySize(const TCHAR* dir_name,
-                             uint64* size,
-                             HANDLE shutdown_event,
-                             uint64 max_size,
-                             int max_depth,
-                             int max_file_count,
-                             int max_running_time_ms);
-
-// Gets size of all files in a directory.
-HRESULT GetDirectorySize(const TCHAR* dir_name, uint64* size);
-
-enum TimeCategory {
-  PAST = 0,  // older than 40 years from now
-  FUTURE,    // in the future by > 1 day
-  PRESENT,   // neither ANCIENT nor FUTURE
-};
-
-TimeCategory GetTimeCategory(time64 t);
-
-// Returns true if a given time is likely to be valid.
-bool IsValidTime(time64 t);
-
-// Gets a time64 value.
-// If the value is greater than the
-// max value, then SetValue will be called using the max_value.
-//
-//  Args:
-//   full_key_name:   the reg keyto read to get the time value.
-//   value_name:      the name for the reg key value to be read.
-//                    (may be NULL to get the default value)
-//   max_time:        the maximum value for the reg key.
-//   value:           the time value read.  May not be set on failure.
-//   limited_value:   true iff will be set if the value was
-//                    changed (and resaved). (NULL is allowable.)
-HRESULT GetLimitedTimeValue(const TCHAR* full_key_name,
-                            const TCHAR* value_name,
-                            time64 max_time,
-                            time64* value,
-                            bool* limited_value);
-
-// Gets a time64 value trying reg keys successively if there is a
-// failure in getting a value.
-//
-// Typically used when there is a user value and a default value if the
-// user has none.
-//
-//  Args:
-//   full_key_names:  a list of reg keys to try successively (starting
-//                    with index 0) to read to get the time value.  The
-//                    attempts stops as soon as there is a successful read or
-//                    when all keys have been tried.
-//   key_names_length: number of keys in full_key_names.
-//   value_name:      the name for the reg key value to be read.
-//                    (may be NULL to get the default value)
-//   max_time:        the maximum value for the reg key.
-//   value:           the time value read.  May not be set on failure.
-//   limited_value:   true iff will be set if the value was
-//                    changed (and resaved). (NULL is allowable.)
-HRESULT GetLimitedTimeValues(const TCHAR* full_key_names[],
-                             int key_names_length,
-                             const TCHAR* value_name,
-                             time64 max_time,
-                             time64* value,
-                             bool* limited_value);
-
-// Convert milliseconds to a relative time in units of 100ns, suitable for use
-// with waitable timers
-LARGE_INTEGER MSto100NSRelative(DWORD ms);
-
-// TODO(omaha): remove from public interface.
-inline void WINAPI NullAPCFunc(ULONG_PTR) {}
-
-// Forces rasman.dll load to avoid a crash in wininet.
-void EnsureRasmanLoaded();
-
-// Returns if the HRESULT argument is a COM error
-// TODO(omaha): use an ANONYMOUS_VARIABLE to avoid the situation in which the
-// macro gets called like RET_IF_FAILED(hr);
-// For now, use a quick fix hr -> __hr. Leading underscore names are not to be
-// used in application code.
-#define RET_IF_FAILED(x)    \
-    do {                    \
-      HRESULT __hr(x);      \
-      if (FAILED(__hr)) {   \
-        return __hr;        \
-      }                     \
-    } while (false)
-
-// return error if the first argument evaluates to false
-#define RET_IF_FALSE(x, err)  \
-  do {                        \
-    if (!(x)) {               \
-      return err;             \
-    }                         \
-  } while (false)
-
-// return false if the HRESULT argument is a COM error
-#define RET_FALSE_IF_FAILED(x)  \
-  do {                          \
-    if (FAILED(x)) {            \
-      return false;             \
-    }                           \
-  } while (false)
-
-// return true if the HRESULT argument is a COM error
-#define RET_TRUE_IF_FAILED(x)   \
-  do {                          \
-    if (FAILED(x)) {            \
-      return true;              \
-    }                           \
-  } while (false)
-
-// return if the HRESULT argument evaluates to FAILED - but also assert
-// if failed
-#define RET_IF_FAILED_ASSERT(x, msg) \
-    do {                             \
-      HRESULT hr(x);                 \
-      if (FAILED(hr)) {              \
-        ASSERT(false, msg);          \
-        return hr;                   \
-      }                              \
-    } while (false)
-
-
-// return if the HRESULT argument evaluates to FAILED - but also log an error
-// message if failed
-#define RET_IF_FAILED_LOG(x, cat, msg) \
-    do {                               \
-      HRESULT hr(x);                   \
-      if (FAILED(hr)) {                \
-        LC_LOG(cat, LEVEL_ERROR, msg); \
-        return hr;                     \
-      }                                \
-    } while (false)
-
-// return if the HRESULT argument evaluates to FAILED - but also REPORT an error
-// message if failed
-#define RET_IF_FAILED_REPORT(x, msg, n) \
-    do {                                \
-      HRESULT hr(x);                    \
-      if (FAILED(hr)) {                 \
-        REPORT(false, R_ERROR, msg, n); \
-        return hr;                      \
-      }                                 \
-    } while (false)
-
-// Initializes a POD to zero.
-// Using this function requires discipline. Don't use for types that have a
-// v-table or virtual bases.
-template <typename T>
-inline void SetZero(T& p) {   // NOLINT
-  // Guard against the easy mistake of
-  //    foo(int *p) { SetZero(p); } instead of
-  //                  SetZero(*p);
-  // which it should be.
-  STATIC_ASSERT(sizeof(p) != sizeof(void*));    // NOLINT
-
-  // A POD (plain old data) object has one of these data types:
-  // a fundamental type, union, struct, array,
-  // or class--with no constructor. PODs don't have virtual functions or
-  // virtual bases.
-
-  // Test to see if the type has constructors.
-  union CtorTest {
-      T t;
-      int i;
-  };
-
-  // TODO(omaha): There might be a way to test if the type has virtuals
-  // For now, if we zero a type with virtuals by mistake, it is going to crash
-  // predictable at run-time when the virtuals are called.
-
-  memset(&p, 0, sizeof(T));
-}
-
-inline void SecureSetZero(CString* p) {
-  ASSERT1(p);
-  if (!p->IsEmpty()) {
-    ::SecureZeroMemory(p->GetBufferSetLength(p->GetLength()),
-                       p->GetLength() * sizeof(TCHAR));
-    p->ReleaseBuffer();
-  }
-}
-
-inline void SecureSetZero(CComVariant* p) {
-  ASSERT1(p);
-  ASSERT1(V_VT(p) == VT_BSTR);
-  uint32 byte_len = ::SysStringByteLen(V_BSTR(p));
-  if (byte_len > 0) {
-    ::SecureZeroMemory(V_BSTR(p), byte_len);
-  }
-}
-
-// CreateForegroundParentWindowForUAC creates a WS_POPUP | WS_VISIBLE with zero
-// size, of the STATIC WNDCLASS. It uses the default running EXE module
-// handle for creation.
-//
-// A visible centered foreground window is needed as the parent in Windows 7 and
-// above, to allow the UAC prompt to come up in the foreground, centered.
-// Otherwise, the elevation prompt will be minimized on the taskbar. A zero size
-// window works. A plain vanilla WS_POPUP allows the window to be free of
-// adornments. WS_EX_TOOLWINDOW prevents the task bar from showing the
-// zero-sized window.
-//
-// Returns NULL on failure. Call ::GetLastError() to get extended error
-// information on failure.
-inline HWND CreateForegroundParentWindowForUAC() {
-  CWindow foreground_parent;
-  if (foreground_parent.Create(_T("STATIC"), NULL, NULL, NULL,
-                               WS_POPUP | WS_VISIBLE, WS_EX_TOOLWINDOW)) {
-    foreground_parent.CenterWindow(NULL);
-    ::SetForegroundWindow(foreground_parent);
-  }
-  return foreground_parent.Detach();
-}
-
-// TODO(omaha): move the definition and ShellExecuteExEnsureParent function
-// below into shell.h
-
-#if (NTDDI_VERSION < NTDDI_WINXPSP1)
-// This value is not defined in the header, but has no effect on older OSes.
-#define SEE_MASK_NOZONECHECKS      0x00800000
-#endif
-
-// ShellExecuteExEnsureParent is a wrapper around ::ShellExecuteEx.
-// It ensures that we always have a parent window. In elevation scenarios, we
-// need to use the HWND property to be acknowledged as a foreground application
-// on Windows Vista. Otherwise, the elevation prompt will appear minimized on
-// the taskbar The UAC elevation mechanism uses the HWND as part of determining
-// whether the elevation is a foreground elevation.
-//
-// A better place for this might be in the Process class. However, to
-// reduce dependencies for the stub, placing this in utils.
-//
-// Return values:
-//   ShellExecuteExEnsureParent returns TRUE on success, and FALSE on failure.
-//   Call ::GetLastError() to get the extended error information on failure.
-//
-// Args:
-//   shell_exec_info structure pointer, filled in, with an optional HWND.
-//   The structure is not validated. If the HWND is NULL, it creates one.
-bool ShellExecuteExEnsureParent(LPSHELLEXECUTEINFO shell_exec_info);
-
-//
-// Wait with a message loop.
-// Returns true if the wait completed successfully and false in case of an
-// error.
-//
-
-// Waits with a message loop until any of the synchronization objects is
-// signaled. Return the index of the object that satisfied the wait.
-bool WaitWithMessageLoopAny(const std::vector<HANDLE>& handles, uint32* pos);
-
-// Waits with message loop until all the synchronization objects are signaled.
-bool WaitWithMessageLoopAll(const std::vector<HANDLE>& handles);
-
-// Waits with message loop until the synchronization object is signaled.
-bool WaitWithMessageLoop(HANDLE h);
-
-// Waits with message loop for a certain period of time
-bool WaitWithMessageLoopTimed(DWORD ms);
-
-//
-// TODO(omaha): message handler classes should go in other module.
-//
-// Handles windows messages
-class MessageHandlerInterface {
- public:
-  virtual ~MessageHandlerInterface() {}
-  // Does the translate/dispatch for one window message
-  // msg is never NULL.
-  virtual void Process(MSG* msg) = 0;
-};
-
-// The simplest working implementation of a message handler.
-// It does TranslateMessage/DispatchMessage.
-class BasicMessageHandler : public MessageHandlerInterface {
- public:
-  BasicMessageHandler() {}
-  virtual void Process(MSG* msg);
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(BasicMessageHandler);
-};
-
-// An internal detail (used to handle messages
-// and adjust the handles/cnt as needed).
-class MessageHandlerInternalInterface {
- public:
-  virtual ~MessageHandlerInternalInterface() {}
-  // Does the translate/dispatch for one window message
-  // msg is never NULL and may change the handles and cnt (which are
-  // never NULL).
-  virtual void Process(MSG* msg, const HANDLE** handles, uint32* cnt) = 0;
-};
-
-// The callback for MessageLoopInterface::RegisterWaitForSingleObject
-class WaitCallbackInterface {
- public:
-  virtual ~WaitCallbackInterface() {}
-  // Return false from this method to terminate the message loop.
-  virtual bool HandleSignaled(HANDLE handle) = 0;
-};
-
-// This is similar to a threadpool interface
-// but this is done on the main message loop instead.
-//
-// Important: These method calls are *not* threadsafe and
-// should only be done on the message loop thread.
-class MessageLoopInterface {
- public:
-  virtual ~MessageLoopInterface() {}
-  // sets-up a callback for when the handle becomes signaled
-  //   * the callback happens on the main thread.
-  //   * the handle/callback is removed when
-  //     the callback is made.
-  //   * If the handle becomes invalid while it is being waited on,
-  //     the message loop will exit.
-  //   * If the handle has already been registered,
-  //     then adding it again will essentially replace the
-  //     previous callback with the new one.
-  virtual bool RegisterWaitForSingleObject(HANDLE handle,
-                                           WaitCallbackInterface* callback) = 0;
-
-  // stops watching for the handle to be signaled
-  virtual bool UnregisterWait(HANDLE handle) = 0;
-};
-
-// An implementation of the MessageLoopInterface
-class MessageLoopWithWait : public MessageLoopInterface,
-                            private MessageHandlerInternalInterface {
- public:
-  MessageLoopWithWait();
-
-  // This method needs to be called before the "Process()"
-  // method or else "Process()" will crash.
-  //
-  // Args:
-  //    message_handler: handles any messages that occur
-  //       *Note* It is the callers responsibility to keep
-  //       message_handler around while this class exists
-  //       and the *caller* should free message_handler
-  //       after that.
-  void set_message_handler(MessageHandlerInterface* message_handler);
-
-  // sets-up a callback for when the handle becomes signaled
-  virtual bool RegisterWaitForSingleObject(HANDLE handle,
-                                           WaitCallbackInterface* callback);
-
-  // stops watching for the handle to be signaled
-  virtual bool UnregisterWait(HANDLE handle);
-
-  // The message loop and handle callback routine
-  HRESULT Process();
-
- private:
-  // Handles one messgae and adjus tthe handles and cnt as appropriate after
-  // handling the message
-  virtual void Process(MSG* msg, const HANDLE** handles, uint32* cnt);
-
-  void RemoveHandleAt(uint32 pos);
-
-  MessageHandlerInterface* message_handler_;
-
-  // Handles that are checked for being signaled.
-  std::vector<HANDLE> callback_handles_;
-
-  // What to call when a handle is signaled.
-  std::vector<WaitCallbackInterface*> callbacks_;
-  DISALLOW_EVIL_CONSTRUCTORS(MessageLoopWithWait);
-};
-
-// Calls an entry point that may be exposed from a DLL
-//   It is an error if the DLL is missing or can't be loaded
-//   If the entry point is missing the error returned is
-//   ERROR_INVALID_FUNCTION (as an HRESULT).
-//   Otherwise, if the function is called successfully then
-//   CallEntryPoint0 return S_OK and the result parameter is set to the
-//   return value from the function call.
-HRESULT CallEntryPoint0(const TCHAR* dll_path,
-                        const char* function_name,
-                        HRESULT* result);
-
-// (Un)Registers a COM DLL with the system.  Returns S_FALSE if entry
-// point missing (so that it you can call (Un)RegisterDll on any DLL
-// without worrying whether the DLL is actually a COM server or not).
-HRESULT RegisterDll(const TCHAR* dll_path);
-HRESULT UnregisterDll(const TCHAR* dll_path);
-
-// (Un)Registers a COM Local Server with the system.
-HRESULT RegisterServer(const TCHAR* exe_path);
-HRESULT UnregisterServer(const TCHAR* exe_path);
-HRESULT RegisterOrUnregisterExe(const TCHAR* exe_path, const TCHAR* cmd_line);
-
-// (Un)Registers a COM Service with the system.
-HRESULT RegisterService(const TCHAR* exe_path);
-HRESULT UnregisterService(const TCHAR* exe_path);
-
-// Starts a service.
-HRESULT RunService(const TCHAR* service_name);
-
-// Read an entire file into a memory buffer. Use this function when you need
-// exclusive access to the file.
-// Returns MEM_E_INVALID_SIZE if the file size is larger than max_len (unless
-// max_len == 0, in which case it is ignored)
-HRESULT ReadEntireFile(const TCHAR* filepath,
-                       uint32 max_len,
-                       std::vector<byte>* buffer_out);
-
-// Allows specifying a sharing mode such as FILE_SHARE_READ. Otherwise,
-// this is identical to ReadEntireFile.
-HRESULT ReadEntireFileShareMode(const TCHAR* filepath,
-                                uint32 max_len,
-                                DWORD share_mode,
-                                std::vector<byte>* buffer_out);
-
-// Writes an entire file from a memory buffer
-HRESULT WriteEntireFile(const TCHAR * filepath,
-                        const std::vector<byte>& buffer_in);
-
-// Conversions between a byte stream and a std::string
-HRESULT BufferToString(const std::vector<byte>& buffer_in, CStringA* str_out);
-HRESULT BufferToString(const std::vector<byte>& buffer_in, CString* str_out);
-HRESULT StringToBuffer(const CStringA& str_in, std::vector<byte>* buffer_out);
-HRESULT StringToBuffer(const CString& str_in, std::vector<byte>* buffer_out);
-
-// Splits a "full regkey name" into a key name part and a value name part.
-// Handles "(default)" as a value name.  Treats a trailing "/" as "(default)".
-HRESULT RegSplitKeyvalueName(const CString& keyvalue_name,
-                             CString* key_name,
-                             CString* value_name);
-
-// Expands string with embedded special variables which are enclosed
-// in '%' pair. For example, "%PROGRAMFILES%\Google" expands to
-// "C:\Program Files\Google".
-// If any of the embedded variable can not be expanded, we will leave it intact
-// and return HRESULT_FROM_WIN32(ERROR_NOT_FOUND)
-HRESULT ExpandEnvLikeStrings(const TCHAR* src,
-                             const std::map<CString, CString>& keywords,
-                             CString* dest);
-
-// Returns true if the path represents a registry path.
-bool IsRegistryPath(const TCHAR* path);
-
-// Returns true if the path is a URL.
-bool IsUrl(const TCHAR* path);
-
-// Converts GUID to string.
-CString GuidToString(const GUID& guid);
-
-// Converts string to GUID.
-HRESULT StringToGuidSafe(const CString& str, GUID* guid);
-
-// Converts a variant containing a list of strings.
-void VariantToStringList(VARIANT var, std::vector<CString>* list);
-
-// Appends two registry key paths, takes care of extra separators in the
-// beginning or end of the key.
-CString AppendRegKeyPath(const CString& one, const CString& two);
-CString AppendRegKeyPath(const CString& one,
-                         const CString& two,
-                         const CString& three);
-
-// Returns the list of user keys that are present within the HKEY_USERS key
-// the method only returns the keys of the users and takes care of,
-// removing the well known sids. The returned values are the complete values
-// from the root of the registry
-HRESULT GetUserKeysFromHkeyUsers(std::vector<CString>* key_names);
-
-// Use when a function should be able to
-// be replaced with another implementation. Usually,
-// this is done for testing code only.
-//
-// Typical usage:
-//
-//  typedef bool BoolPreferenceFunctionType();
-//  CallInterceptor<BoolPreferenceFunctionType> should_send_stats_interceptor;
-//  BoolPreferenceFunctionType* ReplaceShouldSendStatsFunction(
-//      BoolPreferenceFunctionType* replacement) {
-//    return should_send_stats_interceptor.ReplaceFunction(replacement);
-//  }
-template <typename R>
-class CallInterceptor {
- public:
-  CallInterceptor() {
-    interceptor_ = NULL;
-  }
-
-  R* ReplaceFunction(R* replacement) {
-    R* old = interceptor_;
-    interceptor_ = replacement;
-    return old;
-  }
-
-  R* interceptor() {
-    return interceptor_;
-  }
-
- private:
-  R* interceptor_;
-  DISALLOW_EVIL_CONSTRUCTORS(CallInterceptor);
-};
-
-// Gets a handle of the current process. The handle is a real handle
-// and the caller must close it
-HRESULT GetCurrentProcessHandle(HANDLE* handle);
-
-// Duplicates the given token from the source_process into the current process.
-HRESULT DuplicateTokenIntoCurrentProcess(HANDLE source_process,
-                                         HANDLE token_to_duplicate,
-                                         CAccessToken* duplicated_token);
-
-// Helper class for an ATL module that registers a custom AccessPermission
-// to allow local calls from interactive users and the system account.
-// Derive from this class as well as CAtlModuleT (or a derivative).
-// Override RegisterAppId() and UnregisterAppId(), and delegate to the
-// corresponding functions in this class.
-template <class T>
-class LocalCallAccessPermissionHelper {
- public:
-  HRESULT RegisterAppId() throw() {
-    // Local call permissions allowed for Interactive Users and Local System
-    static LPCTSTR ALLOW_LOCAL_CALL_SDDL =
-        _T("O:BAG:BAD:(A;;0x3;;;IU)(A;;0x3;;;SY)");
-
-    UTIL_LOG(L1, (_T("[LocalCallAccessPermissionHelper::RegisterAppId]")));
-
-    // First call the base ATL module implementation, so the AppId is registered
-    RET_IF_FAILED(T::UpdateRegistryAppId(TRUE));
-
-    // Next, write the AccessPermission value
-    RegKey key_app_id;
-    RET_IF_FAILED(key_app_id.Open(HKEY_CLASSES_ROOT, _T("AppID"), KEY_WRITE));
-
-    RegKey key;
-    RET_IF_FAILED(key.Create(key_app_id.Key(), T::GetAppIdT()));
-    CSecurityDesc sd;
-    RET_IF_FALSE(sd.FromString(ALLOW_LOCAL_CALL_SDDL), HRESULTFromLastError());
-    RET_IF_FAILED(key.SetValue(
-        _T("AccessPermission"),
-        reinterpret_cast<const byte*>(sd.GetPSECURITY_DESCRIPTOR()),
-        sd.GetLength()));
-
-    UTIL_LOG(L1, (_T("[LocalCallAccessPermissionHelper::RegisterAppId]")
-                  _T("[succeeded]")));
-    return S_OK;
-  }
-
-  HRESULT UnregisterAppId() throw() {
-    // First remove the AccesPermission entry.
-    RegKey key_app_id;
-    RET_IF_FAILED(key_app_id.Open(HKEY_CLASSES_ROOT, _T("AppID"), KEY_WRITE));
-
-    RegKey key;
-    RET_IF_FAILED(key.Open(key_app_id.Key(), T::GetAppIdT(), KEY_WRITE));
-    VERIFY1(SUCCEEDED(key.DeleteValue(_T("AccessPermission"))));
-
-    // Now, call the base ATL module implementation to unregister the AppId
-    RET_IF_FAILED(T::UpdateRegistryAppId(FALSE));
-
-    UTIL_LOG(L1, (_T("[LocalCallAccessPermissionHelper::UnregisterAppId'")
-                  _T("[succeeded]")));
-    return S_OK;
-  }
-};
-
-// Returns true if the argument is a guid.
-inline bool IsGuid(const TCHAR* s) {
-  if (!s) return false;
-  GUID guid = {0};
-  return SUCCEEDED(StringToGuidSafe(s, &guid));
-}
-
-inline bool IsLocalSystemSid(const TCHAR* sid) {
-  ASSERT1(sid);
-  return _tcsicmp(sid, kLocalSystemSid) == 0;
-}
-
-// Fills a buffer with cryptographically random bytes.
-bool GenRandom(void* buffer, size_t buffer_length);
-
-// Deletes an object. The functor is useful in for_each algorithms.
-struct DeleteFun {
-  template <class T> void operator()(T ptr) { delete ptr; }
-};
-
-// Sets or clears the specified value in the Run key to the specified command.
-HRESULT ConfigureRunAtStartup(const CString& root_key_name,
-                              const CString& run_value_name,
-                              const CString& command,
-                              bool install);
-
-// Cracks a command line and returns the program name, which is the first
-// whitespace separated token.
-HRESULT GetExePathFromCommandLine(const TCHAR* command_line,
-                                  CString* exe_path);
-
-// Waits for MSI to complete, if MSI is busy installing or uninstalling apps.
-HRESULT WaitForMSIExecute(int timeout_ms);
-
-// Returns the value of the specified environment variable.
-CString GetEnvironmentVariableAsString(const TCHAR* name);
-
-// Returns true if the OS is installing (e.g., Audit Mode at an OEM factory).
-// NOTE: This is unreliable on Windows Vista and later. Some computers remain in
-// one of the incomplete states even after OOBE. See http://b/1690617.
-bool IsWindowsInstalling();
-
-// TODO(omaha): unit test.
-inline uint64 GetGuidMostSignificantUint64(const GUID& guid) {
-  return (static_cast<uint64>(guid.Data1) << 32) +
-         (static_cast<uint64>(guid.Data2) << 16) +
-         static_cast<uint64>(guid.Data3);
-}
-
-// Calls either ATL::InterlockedExchangePointer if ATL headers are included,
-// or ::InterlockedExchangePointer. ATL slightly redefines the SDK function
-// with the same name.
-template <typename T>
-inline T* interlocked_exchange_pointer(T* volatile * target,
-                                       const T* value) {
-  return static_cast<T*>(InterlockedExchangePointer(
-      reinterpret_cast<void**>(const_cast<T**>(target)),
-      const_cast<T*>(value)));
-}
-
-// Gets a guid from the system (for user id, etc.)
-// The guid will be of the form: {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
-HRESULT GetGuid(CString* guid);
-
-// Returns the message for an error code in the user's language or an
-// empty string if an error occurs. The function does not support
-// "insert sequences". The sequence will be returned in the string.
-CString GetMessageForSystemErrorCode(DWORD error_code);
-
-// Ceil function for integer types. Returns the quotient of the two
-// numbers (m/n) rounded upwards to the nearest integer.
-// T should be unsigned integer type, such as unsigned short, unsigned long,
-// unsigned int etc.
-template <typename T>
-inline T CeilingDivide(T m, T n) {
-  ASSERT1(n != 0);
-
-  return (m + n - 1) / n;
-}
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_UTILS_H_
diff --git a/base/utils_unittest.cc b/base/utils_unittest.cc
deleted file mode 100644
index 582a490..0000000
--- a/base/utils_unittest.cc
+++ /dev/null
@@ -1,749 +0,0 @@
-// Copyright 2003-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <ATLComTime.h>
-#include <atltypes.h>
-#include <atlwin.h>
-#include <map>
-#include <vector>
-#include "omaha/base/app_util.h"
-#include "omaha/base/atl_regexp.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/dynamic_link_kernel32.h"
-#include "omaha/base/file.h"
-#include "omaha/base/module_utils.h"
-#include "omaha/base/path.h"
-#include "omaha/base/shell.h"
-#include "omaha/base/string.h"
-#include "omaha/base/time.h"
-#include "omaha/base/user_info.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/system_info.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-// Make sure that the time functions work.
-TEST(UtilsTest, Time) {
-  // TODO(omaha): - add a test from string to time and back again.
-  // Further test the time converters.
-  time64 now = GetCurrent100NSTime();
-  ASSERT_TRUE(StringToTime(TimeToString(now)) == now);
-
-  // Test GetTimeCategory.
-  ASSERT_EQ(PAST,
-            GetTimeCategory(static_cast<time64>(0)));
-  ASSERT_EQ(PRESENT,
-            GetTimeCategory(static_cast<time64>(now)));
-  ASSERT_EQ(PRESENT,
-            GetTimeCategory(static_cast<time64>(now - kDaysTo100ns)));
-  ASSERT_EQ(PRESENT,
-            GetTimeCategory(static_cast<time64>(now - 365 * kDaysTo100ns)));
-  // A little bit in the future is also considered present.
-  ASSERT_EQ(PRESENT,
-            GetTimeCategory(static_cast<time64>(now + kDaysTo100ns)));
-  ASSERT_EQ(PRESENT,
-            GetTimeCategory(static_cast<time64>(
-                now - 30 * 365 * kDaysTo100ns)));
-  ASSERT_EQ(PAST,
-            GetTimeCategory(static_cast<time64>(
-                now - 50 * 365 * kDaysTo100ns)));
-  ASSERT_EQ(FUTURE,
-            GetTimeCategory(static_cast<time64>(now + kDaysTo100ns * 6)));
-  ASSERT_EQ(FUTURE,
-            GetTimeCategory(static_cast<time64>(now + 365 * kDaysTo100ns)));
-
-  // Test IsValidTime.
-  ASSERT_FALSE(IsValidTime(static_cast<time64>(0)));
-  ASSERT_TRUE(IsValidTime(static_cast<time64>(now)));
-  ASSERT_TRUE(IsValidTime(static_cast<time64>(now - 365 * kDaysTo100ns)));
-  ASSERT_TRUE(IsValidTime(static_cast<time64>(now - 10 * 365 * kDaysTo100ns)));
-  ASSERT_TRUE(IsValidTime(static_cast<time64>(now + kDaysTo100ns)));
-  ASSERT_FALSE(IsValidTime(static_cast<time64>(now - 50 * 365 * kDaysTo100ns)));
-  ASSERT_FALSE(IsValidTime(static_cast<time64>(now + 50 * 365 * kDaysTo100ns)));
-  ASSERT_FALSE(IsValidTime(static_cast<time64>(now + kDaysTo100ns * 6)));
-}
-
-TEST(UtilsTest, GetFolderPath_Success) {
-  CString path;
-  EXPECT_SUCCEEDED(GetFolderPath(CSIDL_PROGRAM_FILES, &path));
-  BOOL isWow64 = FALSE;
-  EXPECT_SUCCEEDED(Kernel32::IsWow64Process(GetCurrentProcess(), &isWow64));
-  CString expected_path = isWow64 ?
-      _T("C:\\Program Files (x86)") : _T("C:\\Program Files");
-  EXPECT_STREQ(expected_path, path);
-}
-
-TEST(UtilsTest, GetFolderPath_Errors) {
-  CString path;
-  EXPECT_EQ(E_INVALIDARG, GetFolderPath(0x7fff, &path));
-  EXPECT_TRUE(path.IsEmpty());
-  EXPECT_EQ(E_INVALIDARG, GetFolderPath(CSIDL_PROGRAM_FILES, NULL));
-}
-
-TEST(UtilsTest, CallEntryPoint0) {
-  HRESULT hr(E_FAIL);
-  ASSERT_FAILED(CallEntryPoint0(L"random-nonsense.dll", "foobar", &hr));
-}
-
-TEST(UtilsTest, ReadEntireFile) {
-  TCHAR directory[MAX_PATH] = {0};
-  ASSERT_TRUE(GetModuleDirectory(NULL, directory));
-  CString file_name;
-  file_name.Format(_T("%s\\unittest_support\\declaration.txt"), directory);
-
-  std::vector<byte> buffer;
-  ASSERT_FAILED(ReadEntireFile(L"C:\\F00Bar\\ImaginaryFile", 0, &buffer));
-
-  ASSERT_SUCCEEDED(ReadEntireFile(file_name, 0, &buffer));
-  ASSERT_EQ(9405, buffer.size());
-  buffer.resize(0);
-  ASSERT_FAILED(ReadEntireFile(L"C:\\WINDOWS\\Greenstone.bmp", 1000, &buffer));
-}
-
-// TODO(omaha): Need a test for WriteEntireFile
-// TEST(UtilsTest, WriteEntireFile) {
-// }
-
-TEST(UtilsTest, RegSplitKeyvalueName) {
-  CString key_name, value_name;
-  ASSERT_SUCCEEDED(RegSplitKeyvalueName(CString(L"HKLM\\Foo\\"),
-                                        &key_name,
-                                        &value_name));
-  ASSERT_STREQ(key_name, L"HKLM\\Foo");
-  ASSERT_TRUE(value_name.IsEmpty());
-
-  ASSERT_SUCCEEDED(RegSplitKeyvalueName(CString(L"HKLM\\Foo\\(default)"),
-                                        &key_name,
-                                        &value_name));
-  ASSERT_STREQ(key_name, L"HKLM\\Foo");
-  ASSERT_TRUE(value_name.IsEmpty());
-
-  ASSERT_SUCCEEDED(RegSplitKeyvalueName(CString(L"HKLM\\Foo\\Bar"),
-                                        &key_name,
-                                        &value_name));
-  ASSERT_STREQ(key_name, L"HKLM\\Foo");
-  ASSERT_STREQ(value_name, L"Bar");
-}
-
-TEST(UtilsTest, ExpandEnvLikeStrings) {
-  std::map<CString, CString> mapping;
-  ASSERT_SUCCEEDED(Shell::GetSpecialFolderKeywordsMapping(&mapping));
-
-  CString out;
-  ASSERT_SUCCEEDED(ExpandEnvLikeStrings(
-      L"Foo%WINDOWS%Bar%SYSTEM%Zebra%WINDOWS%%SYSTEM%", mapping, &out));
-
-  // This should work, but CmpHelperSTRCASEEQ is not overloaded for wchars.
-  // ASSERT_STRCASEEQ(out, L"FooC:\\WINDOWSBarC:\\WINDOWS\\system32Zebra"
-  //                       L"C:\\WINDOWSC:\\WINDOWS\\system32");
-  ASSERT_EQ(out.CompareNoCase(L"FooC:\\WINDOWSBarC:\\WINDOWS\\system32Zebra"
-                              L"C:\\WINDOWSC:\\WINDOWS\\system32"),
-            0);
-  ASSERT_FAILED(ExpandEnvLikeStrings(L"Foo%WINDOWS%%BAR%Zebra", mapping, &out));
-}
-
-TEST(UtilsTest, GetCurrentProcessHandle) {
-  scoped_process proc;
-  ASSERT_SUCCEEDED(GetCurrentProcessHandle(address(proc)));
-  ASSERT_TRUE(valid(proc));
-}
-
-TEST(UtilsTest, DuplicateTokenIntoCurrentProcess) {
-  CAccessToken process_token;
-  EXPECT_TRUE(process_token.GetProcessToken(TOKEN_ALL_ACCESS));
-
-  CAccessToken duplicated_token;
-  EXPECT_SUCCEEDED(DuplicateTokenIntoCurrentProcess(::GetCurrentProcess(),
-                                                    process_token.GetHandle(),
-                                                    &duplicated_token));
-
-  CSid process_sid;
-  EXPECT_TRUE(process_token.GetUser(&process_sid));
-
-  CSid duplicated_sid;
-  EXPECT_TRUE(duplicated_token.GetUser(&duplicated_sid));
-
-  EXPECT_STREQ(process_sid.Sid(), duplicated_sid.Sid());
-}
-
-TEST(UtilsTest, IsGuid) {
-  EXPECT_FALSE(IsGuid(NULL));
-  EXPECT_FALSE(IsGuid(_T("")));
-  EXPECT_FALSE(IsGuid(_T("{}")));
-  EXPECT_FALSE(IsGuid(_T("a")));
-  EXPECT_FALSE(IsGuid(_T("CA3045BFA6B14fb8A0EFA615CEFE452C")));
-
-  // Missing {}
-  EXPECT_FALSE(IsGuid(_T("CA3045BF-A6B1-4fb8-A0EF-A615CEFE452C")));
-
-  // Invalid char X
-  EXPECT_FALSE(IsGuid(_T("{XA3045BF-A6B1-4fb8-A0EF-A615CEFE452C}")));
-
-  // Invalid binary char 0x200
-  EXPECT_FALSE(IsGuid(_T("{\0x200a3045bf-a6b1-4fb8-a0ef-a615cefe452c}")));
-
-  // Missing -
-  EXPECT_FALSE(IsGuid(_T("{CA3045BFA6B14fb8A0EFA615CEFE452C}")));
-
-  // Double quotes
-  EXPECT_FALSE(IsGuid(_T("\"{ca3045bf-a6b1-4fb8-a0ef-a615cefe452c}\"")));
-
-  EXPECT_TRUE(IsGuid(_T("{00000000-0000-0000-0000-000000000000}")));
-  EXPECT_TRUE(IsGuid(_T("{CA3045BF-A6B1-4fb8-A0EF-A615CEFE452C}")));
-  EXPECT_TRUE(IsGuid(_T("{ca3045bf-a6b1-4fb8-a0ef-a615cefe452c}")));
-}
-
-// GUIDs cannot be compared in GTest because there is no << operator. Therefore,
-// we must treat them as strings. All these tests rely on GuidToString working.
-#define EXPECT_GUID_EQ(expected, actual) \
-    EXPECT_STREQ(GuidToString(expected), GuidToString(actual))
-
-TEST(UtilsTest, StringToGuidSafe_InvalidString) {
-  GUID guid = {0};
-
-  EXPECT_EQ(E_INVALIDARG, StringToGuidSafe(_T(""), &guid));
-  EXPECT_EQ(E_INVALIDARG, StringToGuidSafe(_T("{}"), &guid));
-  EXPECT_EQ(E_INVALIDARG, StringToGuidSafe(_T("a"), &guid));
-  EXPECT_EQ(E_INVALIDARG,
-      StringToGuidSafe(_T("CA3045BFA6B14fb8A0EFA615CEFE452C"), &guid));
-
-  // Missing {}
-  EXPECT_EQ(E_INVALIDARG,
-      StringToGuidSafe(_T("CA3045BF-A6B1-4fb8-A0EF-A615CEFE452C"), &guid));
-
-  // Invalid char X
-  EXPECT_EQ(CO_E_IIDSTRING,
-      StringToGuidSafe(_T("{XA3045BF-A6B1-4fb8-A0EF-A615CEFE452C}"), &guid));
-
-  // Invalid binary char 0x200
-  EXPECT_EQ(E_INVALIDARG,
-            StringToGuidSafe(_T("{\0x200a3045bf-a6b1-4fb8-a0ef-a615cefe452c}"),
-                             &guid));
-
-  // Missing -
-  EXPECT_EQ(E_INVALIDARG,
-            StringToGuidSafe(_T("{CA3045BFA6B14fb8A0EFA615CEFE452C}"), &guid));
-
-  // Double quotes
-  EXPECT_EQ(E_INVALIDARG,
-            StringToGuidSafe(_T("\"{ca3045bf-a6b1-4fb8-a0ef-a615cefe452c}\""),
-                             &guid));
-}
-
-TEST(UtilsTest, StringToGuidSafe_ValidString) {
-  const GUID kExpectedGuid = {0xCA3045BF, 0xA6B1, 0x4FB8,
-                              {0xA0, 0xEF, 0xA6, 0x15, 0xCE, 0xFE, 0x45, 0x2C}};
-  GUID guid = kExpectedGuid;
-
-  EXPECT_SUCCEEDED(
-      StringToGuidSafe(_T("{00000000-0000-0000-0000-000000000000}"), &guid));
-  EXPECT_GUID_EQ(GUID_NULL, guid);
-
-  guid = GUID_NULL;
-  EXPECT_SUCCEEDED(
-      StringToGuidSafe(_T("{CA3045BF-A6B1-4fb8-A0EF-A615CEFE452C}"), &guid));
-  EXPECT_GUID_EQ(kExpectedGuid, guid);
-
-  guid = GUID_NULL;
-  EXPECT_SUCCEEDED(
-      StringToGuidSafe(_T("{ca3045bf-a6b1-4fb8-a0ef-a615cefe452c}"), &guid));
-  EXPECT_GUID_EQ(kExpectedGuid, guid);
-}
-
-TEST(UtilsTest, VersionFromString_ValidVersion) {
-  EXPECT_EQ(MAKEDLLVERULL(42, 1, 21, 12345),
-            VersionFromString(_T("42.1.21.12345")));
-}
-
-TEST(UtilsTest, VersionFromString_VersionZero) {
-  EXPECT_EQ(0, VersionFromString(_T("0.0.0.0")));
-}
-
-TEST(UtilsTest, VersionFromString_VersionUpperLimits) {
-  EXPECT_EQ(MAKEDLLVERULL(0xffff, 0xffff, 0xffff, 0xffff),
-            VersionFromString(_T("65535.65535.65535.65535")));
-  EXPECT_EQ(0, VersionFromString(_T("65536.65536.65536.65536")));
-  EXPECT_EQ(0, VersionFromString(_T("1.2.65536.65536")));
-}
-
-TEST(UtilsTest, VersionFromString_IntegerOverflow) {
-  EXPECT_EQ(0, VersionFromString(_T("1.2.3.4294967296")));
-}
-
-TEST(UtilsTest, VersionFromString_NegativeVersion) {
-  EXPECT_EQ(0, VersionFromString(_T("1.2.3.-22")));
-}
-
-TEST(UtilsTest, VersionFromString_TooFewElements) {
-  EXPECT_EQ(0, VersionFromString(_T("1.1.1")));
-}
-
-TEST(UtilsTest, VersionFromString_ExtraPeriod) {
-  EXPECT_EQ(0, VersionFromString(_T("1.1.2.3.")));
-}
-
-TEST(UtilsTest, VersionFromString_TooManyElements) {
-  EXPECT_EQ(0, VersionFromString(_T("1.1.2.3.4")));
-}
-
-TEST(UtilsTest, VersionFromString_Char) {
-  EXPECT_EQ(0, VersionFromString(_T("1.B.3.4")));
-  EXPECT_EQ(0, VersionFromString(_T("1.2.3.B")));
-  EXPECT_EQ(0, VersionFromString(_T("1.2.3.9B")));
-}
-
-TEST(UtilsTest, StringFromVersion_ValidVersion) {
-  EXPECT_STREQ(_T("42.1.21.12345"),
-               StringFromVersion(MAKEDLLVERULL(42, 1, 21, 12345)));
-}
-
-TEST(UtilsTest, StringFromVersion_VersionZero) {
-  EXPECT_STREQ(_T("0.0.0.0"), StringFromVersion(0));
-}
-
-TEST(UtilsTest, StringFromVersion_VersionUpperLimits) {
-  EXPECT_STREQ(
-      _T("65535.65535.65535.65535"),
-      StringFromVersion(MAKEDLLVERULL(0xffff, 0xffff, 0xffff, 0xffff)));
-}
-
-TEST(UtilsTest, IsLocalSystemSid) {
-  EXPECT_TRUE(IsLocalSystemSid(kLocalSystemSid));
-  EXPECT_TRUE(IsLocalSystemSid(_T("S-1-5-18")));
-  EXPECT_TRUE(IsLocalSystemSid(_T("s-1-5-18")));
-
-  EXPECT_FALSE(IsLocalSystemSid(_T("")));
-  EXPECT_FALSE(IsLocalSystemSid(_T("S-1-5-17")));
-}
-
-// There is a very small probability the test could fail.
-TEST(UtilsTest, GenRandom) {
-  int random_int = 0;
-  EXPECT_TRUE(GenRandom(&random_int, sizeof(random_int)));
-  EXPECT_NE(random_int, 0);
-
-  int another_random_int = 0;
-  EXPECT_TRUE(GenRandom(&another_random_int, sizeof(another_random_int)));
-  EXPECT_NE(another_random_int, 0);
-
-  EXPECT_NE(random_int, another_random_int);
-}
-
-// Counts instances of the class.
-class Counter {
- public:
-  Counter() {
-    ++instance_count_;
-  }
-  ~Counter() {
-    --instance_count_;
-  }
-  static int instance_count() { return instance_count_; }
- private:
-  static int instance_count_;
-  DISALLOW_EVIL_CONSTRUCTORS(Counter);
-};
-
-int Counter::instance_count_ = 0;
-
-// Checks if the functor is actually calling the destructor of the type.
-TEST(UtilsTest, DeleteFun) {
-  EXPECT_EQ(Counter::instance_count(), 0);
-  Counter* counter = new Counter;
-  EXPECT_EQ(Counter::instance_count(), 1);
-  DeleteFun().operator()(counter);
-  EXPECT_EQ(Counter::instance_count(), 0);
-
-  // Checks if the template can be instantiated for some common built in types.
-  int* pointer_int = NULL;
-  DeleteFun().operator()(pointer_int);
-
-  const char* pointer_char = NULL;
-  DeleteFun().operator()(pointer_char);
-}
-
-TEST(UtilsTest, IsUserLoggedOn) {
-  bool is_logged_on(false);
-  ASSERT_HRESULT_SUCCEEDED(IsUserLoggedOn(&is_logged_on));
-  ASSERT_TRUE(is_logged_on);
-}
-
-TEST(UtilsTest, IsClickOnceDisabled) {
-  EXPECT_FALSE(IsClickOnceDisabled());
-}
-
-TEST(UtilsTest, ConfigureRunAtStartup) {
-  const TCHAR kRunKeyPath[] =
-      _T("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run");
-
-  RegKey::DeleteKey(kRegistryHiveOverrideRoot, true);
-  OverrideRegistryHives(kRegistryHiveOverrideRoot);
-
-  EXPECT_FALSE(RegKey::HasKey(kRunKeyPath));
-
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            ConfigureRunAtStartup(USER_KEY_NAME, _T("FooApp"),
-                                  _T("\"foo.exe\""), false));
-  EXPECT_FALSE(RegKey::HasKey(kRunKeyPath));
-
-  EXPECT_SUCCEEDED(ConfigureRunAtStartup(USER_KEY_NAME, _T("FooApp"),
-                                         _T("\"C:\\foo.exe\" /x"), true));
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kRunKeyPath, _T("FooApp"), &value));
-  EXPECT_STREQ(_T("\"C:\\foo.exe\" /x"), value);
-
-  EXPECT_SUCCEEDED(ConfigureRunAtStartup(USER_KEY_NAME, _T("FooApp"),
-                                         _T("\"foo.exe\""), false));
-  EXPECT_FALSE(RegKey::HasValue(kRunKeyPath, _T("FooApp")));
-  EXPECT_TRUE(RegKey::HasKey(kRunKeyPath));
-
-  RestoreRegistryHives();
-  EXPECT_SUCCEEDED(RegKey::DeleteKey(kRegistryHiveOverrideRoot, true));
-}
-
-TEST(UtilsTest, ValidPath) {
-  CString cmd_line =
-      _T("\"C:\\Program Files\\Internet Explorer\\iexplore.exe\" -nohome");
-  CString exe_path;
-  EXPECT_SUCCEEDED(GetExePathFromCommandLine(cmd_line, &exe_path));
-  EXPECT_STREQ(_T("C:\\Program Files\\Internet Explorer\\iexplore.exe"),
-               exe_path);
-}
-
-TEST(UtilsTest, InvalidPath) {
-  CString cmd_line = _T("");
-  CString exe_path;
-  EXPECT_FAILED(GetExePathFromCommandLine(cmd_line, &exe_path));
-  EXPECT_TRUE(exe_path.IsEmpty());
-}
-
-TEST(UtilsTest, PinModuleIntoProcess) {
-  const TCHAR module_name[] = _T("icmp.dll");
-  const void* kNullModule = NULL;
-
-  // The module should not be loaded at this time.
-  EXPECT_EQ(kNullModule, ::GetModuleHandle(module_name));
-
-  // Loads and unloads the module.
-  {
-    scoped_library module(::LoadLibrary(module_name));
-    EXPECT_TRUE(module);
-    EXPECT_NE(kNullModule, ::GetModuleHandle(module_name));
-  }
-  EXPECT_EQ(kNullModule, ::GetModuleHandle(module_name));
-
-  // Loads, pins, and unloads the module.
-  {
-    scoped_library module(::LoadLibrary(module_name));
-    EXPECT_TRUE(module);
-    EXPECT_NE(kNullModule, ::GetModuleHandle(module_name));
-    PinModuleIntoProcess(module_name);
-  }
-  EXPECT_NE(kNullModule, ::GetModuleHandle(module_name));
-}
-
-// Assumes Windows is installed on the C: drive.
-TEST(UtilsTest, GetEnvironmentVariableAsString) {
-  EXPECT_STREQ(_T("C:"), GetEnvironmentVariableAsString(_T("SystemDrive")));
-  EXPECT_STREQ(_T("Windows_NT"), GetEnvironmentVariableAsString(_T("OS")));
-  EXPECT_STREQ(_T(""), GetEnvironmentVariableAsString(_T("FOO")));
-}
-
-TEST(UtilsTest, IsWindowsInstalling_Normal) {
-  EXPECT_FALSE(IsWindowsInstalling());
-}
-
-TEST(UtilsTest, IsWindowsInstalling_Installing_Vista_InvalidValues) {
-  if (!vista_util::IsVistaOrLater()) {
-    return;
-  }
-
-  RegKey::DeleteKey(kRegistryHiveOverrideRoot, true);
-  OverrideRegistryHives(kRegistryHiveOverrideRoot);
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(
-      _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-      _T("ImageState"),
-      _T("")));
-  EXPECT_FALSE(IsWindowsInstalling());
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(
-      _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-      _T("ImageState"),
-      _T("foo")));
-  EXPECT_FALSE(IsWindowsInstalling());
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(
-      _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-      _T("ImageState"),
-      static_cast<DWORD>(1)));
-  ExpectAsserts expect_asserts;  // RegKey asserts because value type is wrong.
-  EXPECT_FALSE(IsWindowsInstalling());
-
-  RestoreRegistryHives();
-  EXPECT_SUCCEEDED(RegKey::DeleteKey(kRegistryHiveOverrideRoot, true));
-}
-
-TEST(UtilsTest, IsWindowsInstalling_Installing_Vista_ValidStates) {
-  if (!vista_util::IsVistaOrLater()) {
-    return;
-  }
-
-  RegKey::DeleteKey(kRegistryHiveOverrideRoot, true);
-  OverrideRegistryHives(kRegistryHiveOverrideRoot);
-
-  // These states return false in the original implementation.
-  EXPECT_SUCCEEDED(RegKey::SetValue(
-      _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-      _T("ImageState"),
-      _T("IMAGE_STATE_COMPLETE")));
-  EXPECT_FALSE(IsWindowsInstalling());
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(
-      _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-      _T("ImageState"),
-      _T("IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE")));
-  EXPECT_FALSE(IsWindowsInstalling());
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(
-      _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-      _T("ImageState"),
-      _T("IMAGE_STATE_SPECIALIZE_RESEAL_TO_OOBE")));
-  EXPECT_FALSE(IsWindowsInstalling());
-
-  // These states are specified in the original implementation.
-  EXPECT_SUCCEEDED(RegKey::SetValue(
-      _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-      _T("ImageState"),
-      _T("IMAGE_STATE_UNDEPLOYABLE")));
-  EXPECT_TRUE(IsWindowsInstalling());
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(
-      _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-      _T("ImageState"),
-      _T("IMAGE_STATE_GENERALIZE_RESEAL_TO_AUDIT")));
-  EXPECT_TRUE(IsWindowsInstalling());
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(
-      _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-      _T("ImageState"),
-      _T("IMAGE_STATE_SPECIALIZE_RESEAL_TO_AUDIT")));
-  EXPECT_TRUE(IsWindowsInstalling());
-
-  RestoreRegistryHives();
-  EXPECT_SUCCEEDED(RegKey::DeleteKey(kRegistryHiveOverrideRoot, true));
-}
-
-TEST(UtilsTest, AddAllowedAce) {
-  CString test_file_path = ConcatenatePath(
-      app_util::GetCurrentModuleDirectory(), _T("TestAddAllowedAce.exe"));
-  EXPECT_SUCCEEDED(File::Remove(test_file_path));
-
-  EXPECT_SUCCEEDED(File::Copy(
-      ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                      _T("GoogleUpdate.exe")),
-      test_file_path,
-      false));
-
-  CDacl dacl;
-  EXPECT_TRUE(AtlGetDacl(test_file_path, SE_FILE_OBJECT, &dacl));
-  const int original_ace_count = dacl.GetAceCount();
-
-  EXPECT_SUCCEEDED(AddAllowedAce(test_file_path,
-                                 SE_FILE_OBJECT,
-                                 Sids::Dialup(),
-                                 FILE_GENERIC_READ,
-                                 0));
-
-  dacl.SetEmpty();
-  EXPECT_TRUE(AtlGetDacl(test_file_path, SE_FILE_OBJECT, &dacl));
-  EXPECT_EQ(original_ace_count + 1, dacl.GetAceCount());
-
-  // Add the same access. No ACE is added.
-  EXPECT_SUCCEEDED(AddAllowedAce(test_file_path,
-                                 SE_FILE_OBJECT,
-                                 Sids::Dialup(),
-                                 FILE_GENERIC_READ,
-                                 0));
-  dacl.SetEmpty();
-  EXPECT_TRUE(AtlGetDacl(test_file_path, SE_FILE_OBJECT, &dacl));
-  EXPECT_EQ(original_ace_count + 1, dacl.GetAceCount());
-
-  // Add a subset of the existing access. No ACE is added.
-  EXPECT_EQ(FILE_READ_ATTRIBUTES, FILE_GENERIC_READ & FILE_READ_ATTRIBUTES);
-  EXPECT_SUCCEEDED(AddAllowedAce(test_file_path,
-                                 SE_FILE_OBJECT,
-                                 Sids::Dialup(),
-                                 FILE_READ_ATTRIBUTES,
-                                 0));
-  dacl.SetEmpty();
-  EXPECT_TRUE(AtlGetDacl(test_file_path, SE_FILE_OBJECT, &dacl));
-  EXPECT_EQ(original_ace_count + 1, dacl.GetAceCount());
-
-  // Add more access. An ACE is added.
-  EXPECT_SUCCEEDED(AddAllowedAce(test_file_path,
-                                 SE_FILE_OBJECT,
-                                 Sids::Dialup(),
-                                 FILE_ALL_ACCESS,
-                                 0));
-  dacl.SetEmpty();
-  EXPECT_TRUE(AtlGetDacl(test_file_path, SE_FILE_OBJECT, &dacl));
-  EXPECT_EQ(original_ace_count + 2, dacl.GetAceCount());
-
-  // TODO(omaha): An assert occurs because the ACE flags are being used on a
-  // file object. Add a new test to use a registry key.
-  ExpectAsserts expect_asserts;
-
-  // Different ACE flags. An ACE is added.
-  const BYTE kTestAce = CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE;
-  const BYTE kTestAceSubset = CONTAINER_INHERIT_ACE;
-  EXPECT_SUCCEEDED(AddAllowedAce(test_file_path,
-                                 SE_FILE_OBJECT,
-                                 Sids::Dialup(),
-                                 FILE_ALL_ACCESS,
-                                 kTestAce));
-  dacl.SetEmpty();
-  EXPECT_TRUE(AtlGetDacl(test_file_path, SE_FILE_OBJECT, &dacl));
-  EXPECT_EQ(original_ace_count + 3, dacl.GetAceCount());
-
-  // Subset of existing ACE flags. An ACE is added because flags must be exact.
-  EXPECT_SUCCEEDED(AddAllowedAce(test_file_path,
-                                 SE_FILE_OBJECT,
-                                 Sids::Dialup(),
-                                 FILE_ALL_ACCESS,
-                                 kTestAceSubset));
-  dacl.SetEmpty();
-  EXPECT_TRUE(AtlGetDacl(test_file_path, SE_FILE_OBJECT, &dacl));
-  EXPECT_EQ(original_ace_count + 4, dacl.GetAceCount());
-
-  // Same flags. An ACE should not be added because all values match.
-  // TODO(omaha): This does not work, possibly because the object is a file.
-  // Try the test using a registry key.
-  EXPECT_SUCCEEDED(AddAllowedAce(test_file_path,
-                                 SE_FILE_OBJECT,
-                                 Sids::Dialup(),
-                                 FILE_ALL_ACCESS,
-                                 kTestAceSubset));
-  dacl.SetEmpty();
-  EXPECT_TRUE(AtlGetDacl(test_file_path, SE_FILE_OBJECT, &dacl));
-  EXPECT_EQ(original_ace_count + 5, dacl.GetAceCount());
-
-  EXPECT_SUCCEEDED(File::Remove(test_file_path));
-}
-
-TEST(UtilsTest, CreateForegroundParentWindowForUAC) {
-  CWindow foreground_parent;
-  foreground_parent.Attach(CreateForegroundParentWindowForUAC());
-  EXPECT_TRUE(foreground_parent.IsWindow());
-  EXPECT_TRUE(foreground_parent.IsWindowVisible());
-
-  CRect foreground_rect;
-  EXPECT_TRUE(foreground_parent.GetWindowRect(&foreground_rect));
-  EXPECT_EQ(0, foreground_rect.Width());
-  EXPECT_EQ(0, foreground_rect.Height());
-
-  EXPECT_TRUE((WS_POPUP | WS_VISIBLE) & foreground_parent.GetStyle());
-  EXPECT_TRUE(WS_EX_TOOLWINDOW & foreground_parent.GetExStyle());
-
-  EXPECT_TRUE(foreground_parent.DestroyWindow());
-}
-
-// Test the atomic exchange of pointer values.
-TEST(UtilsTest, interlocked_exchange_pointer) {
-  const int i = 10;
-  const int j = 20;
-
-  const int* volatile pi = &i;
-  const int* pj = &j;
-
-  const int* old_pi = pi;
-
-  // pi and pj point to i and j respectively.
-  EXPECT_EQ(10, *pi);
-  EXPECT_EQ(20, *pj);
-
-  // After the exchange pi<-pj, both pointers point to the same value, in this
-  // case j.
-  int* result = interlocked_exchange_pointer(const_cast<int**>(&pi), pj);
-  EXPECT_EQ(*pj, *pi);
-  EXPECT_EQ(old_pi, result);
-  EXPECT_EQ(10, *old_pi);
-  EXPECT_EQ(20, *pi);
-
-  // Exchanging a pointer with self is idempotent.
-  old_pi = interlocked_exchange_pointer(const_cast<int**>(&pi), pi);
-  EXPECT_EQ(pi, old_pi);
-  EXPECT_EQ(20, *pi);
-
-  // Exchanging a pointer with NULL.
-  interlocked_exchange_pointer(const_cast<int**>(&pi), static_cast<int*>(NULL));
-  EXPECT_EQ(NULL, pi);
-}
-
-TEST(UtilsTest, GetGuid)  {
-  CString guid;
-  EXPECT_HRESULT_SUCCEEDED(GetGuid(&guid));
-
-  // ATL regexp has many problems including:
-  // * not supporting {n} to repeat a previous item n times.
-  // * not allowing matching on - unless the items around the dash are
-  // enclosed in {}.
-  AtlRE guid_regex(_T("^{\\{{\\h\\h\\h\\h\\h\\h\\h\\h}-{\\h\\h\\h\\h}-{\\h\\h\\h\\h}-{\\h\\h\\h\\h}-{\\h\\h\\h\\h\\h\\h\\h\\h\\h\\h\\h\\h}\\}}$"));   // NOLINT
-
-  CString matched_guid;
-  EXPECT_TRUE(AtlRE::PartialMatch(guid, guid_regex, &matched_guid));
-  EXPECT_STREQ(guid, matched_guid);
-
-  // Missing {}.
-  guid = _T("5F5280C6-9674-429b-9FEB-551914EF96B8");
-  EXPECT_FALSE(AtlRE::PartialMatch(guid, guid_regex));
-
-  // Missing -.
-  guid = _T("{5F5280C6.9674-429b-9FEB-551914EF96B8}");
-  EXPECT_FALSE(AtlRE::PartialMatch(guid, guid_regex));
-
-  // Whitespaces.
-  guid = _T(" {5F5280C6.9674-429b-9FEB-551914EF96B8}");
-  EXPECT_FALSE(AtlRE::PartialMatch(guid, guid_regex));
-
-  guid = _T("{5F5280C6.9674-429b-9FEB-551914EF96B8} ");
-  EXPECT_FALSE(AtlRE::PartialMatch(guid, guid_regex));
-
-  // Empty string.
-  guid = _T("");
-  EXPECT_FALSE(AtlRE::PartialMatch(guid, guid_regex));
-}
-
-TEST(UtilsTest, GetMessageForSystemErrorCode) {
-  CString message = GetMessageForSystemErrorCode(99);
-  EXPECT_TRUE(message.IsEmpty());
-
-  message = GetMessageForSystemErrorCode(ERROR_TOO_MANY_SEMAPHORES);
-  EXPECT_FALSE(message.IsEmpty());
-}
-
-TEST(UtilsTest, CeilingDivide) {
-  EXPECT_EQ(0, CeilingDivide(0, 1));
-  EXPECT_EQ(1, CeilingDivide(1, 1));
-  EXPECT_EQ(1, CeilingDivide(1, 2));
-  EXPECT_EQ(2, CeilingDivide(6, 3));
-  EXPECT_EQ(4, CeilingDivide(7, 2));
-}
-
-}  // namespace omaha
-
diff --git a/base/vista_utils.cc b/base/vista_utils.cc
deleted file mode 100644
index 8a21507..0000000
--- a/base/vista_utils.cc
+++ /dev/null
@@ -1,483 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/vista_utils.h"
-
-#include <vector>
-#include "base/scoped_ptr.h"
-#include "omaha/base/commontypes.h"
-#include "omaha/base/const_utils.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/proc_utils.h"
-#include "omaha/base/process.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/smart_handle.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/system.h"
-#include "omaha/base/system_info.h"
-#include "omaha/base/user_info.h"
-#include "omaha/base/user_rights.h"
-#include "omaha/base/utils.h"
-
-#define LOW_INTEGRITY_SDDL_SACL_A     NOTRANSL("S:(ML;;NW;;;LW)")
-#define LOW_INTEGRITY_SID_W           NOTRANSL(L"S-1-16-4096")
-
-namespace omaha {
-
-namespace vista {
-
-namespace {
-
-// TODO(Omaha): Unit test for this method.
-HRESULT RunAsUser(const CString& command_line,
-                  HANDLE user_token,
-                  bool run_as_current_user) {
-  if (INVALID_HANDLE_VALUE == user_token) {
-    return E_INVALIDARG;
-  }
-
-  CString cmd(command_line);
-
-  STARTUPINFO startup_info = { sizeof(startup_info) };
-  PROCESS_INFORMATION process_info = {0};
-
-  DWORD creation_flags(0);
-  void* environment_block(NULL);
-  ON_SCOPE_EXIT(::DestroyEnvironmentBlock, environment_block);
-  if (::CreateEnvironmentBlock(&environment_block, user_token, FALSE)) {
-    creation_flags |= CREATE_UNICODE_ENVIRONMENT;
-  } else {
-    ASSERT(false, (_T("::CreateEnvironmentBlock failed %d"), ::GetLastError()));
-    environment_block = NULL;
-  }
-
-  // ::CreateProcessAsUser() does not work unless the caller is SYSTEM. Does not
-  // matter if the user token is for the current user.
-  BOOL success = run_as_current_user ?
-      ::CreateProcess(0, CStrBuf(cmd, MAX_PATH), 0, 0, false, creation_flags,
-                      environment_block, 0, &startup_info, &process_info) :
-      ::CreateProcessAsUser(user_token, 0, CStrBuf(cmd, MAX_PATH), 0, 0, false,
-                            creation_flags, environment_block, 0, &startup_info,
-                            &process_info);
-
-  if (!success) {
-    HRESULT hr(HRESULTFromLastError());
-    UTIL_LOG(LE, (_T("[RunAsUser failed][cmd=%s][hresult=0x%x]"), cmd, hr));
-    return hr;
-  }
-
-  VERIFY1(::CloseHandle(process_info.hThread));
-  VERIFY1(::CloseHandle(process_info.hProcess));
-
-  return S_OK;
-}
-
-}  // namespace
-
-bool IsProcessProtected() {
-  if (!SystemInfo::IsRunningOnVistaOrLater()) {
-    return false;
-  }
-
-  AutoHandle token;
-  VERIFY1(::OpenProcessToken(GetCurrentProcess(),
-                             TOKEN_QUERY | TOKEN_QUERY_SOURCE,
-                             &token.receive()));
-
-  // Get the Integrity level.
-  DWORD length_needed;
-  BOOL b = ::GetTokenInformation(token,
-                                 TokenIntegrityLevel,
-                                 NULL,
-                                 0,
-                                 &length_needed);
-  ASSERT1(b == FALSE);
-  if (b) {
-    return false;
-  }
-
-  // The first call to GetTokenInformation is just to get the buffer size
-  if (::GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
-    return false;
-  }
-
-  scoped_ptr<TOKEN_MANDATORY_LABEL> integration_level;
-
-  integration_level.reset(reinterpret_cast<TOKEN_MANDATORY_LABEL*>(
-      new char[length_needed]));
-  if (integration_level.get() == NULL) {
-    return false;
-  }
-
-  if (!::GetTokenInformation(token,
-                             TokenIntegrityLevel,
-                             integration_level.get(),
-                             length_needed,
-                             &length_needed)) {
-    return false;
-  }
-
-  wchar_t* sid_str = NULL;
-  VERIFY1(::ConvertSidToStringSid(integration_level->Label.Sid, &sid_str));
-  bool ret = ::lstrcmpW(sid_str, LOW_INTEGRITY_SID_W) == 0;
-  ::LocalFree(sid_str);
-
-  return ret;
-}
-
-HRESULT AllowProtectedProcessAccessToSharedObject(const TCHAR* name) {
-  if (!SystemInfo::IsRunningOnVistaOrLater()) {
-    return S_FALSE;
-  }
-
-  ASSERT1(name != NULL);
-
-  PSECURITY_DESCRIPTOR psd = NULL;
-  VERIFY1(::ConvertStringSecurityDescriptorToSecurityDescriptorA(
-              LOW_INTEGRITY_SDDL_SACL_A,
-              SDDL_REVISION_1,
-              &psd,
-              NULL));
-
-  BOOL sacl_present = FALSE;
-  BOOL sacl_defaulted = FALSE;
-  PACL sacl = NULL;
-  VERIFY1(::GetSecurityDescriptorSacl(psd,
-                                      &sacl_present,
-                                      &sacl,
-                                      &sacl_defaulted));
-
-  DWORD ret = ::SetNamedSecurityInfoW(const_cast<TCHAR*>(name),
-                                      SE_KERNEL_OBJECT,
-                                      LABEL_SECURITY_INFORMATION,
-                                      NULL,
-                                      NULL,
-                                      NULL,
-                                      sacl);
-
-  ::LocalFree(psd);
-
-  return HRESULT_FROM_WIN32(ret);
-}
-
-HRESULT RunAsCurrentUser(const CString& command_line) {
-  scoped_handle token;
-  if (!::OpenProcessToken(::GetCurrentProcess(),
-                          TOKEN_QUERY | TOKEN_DUPLICATE,
-                          address(token))) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LE, (_T("[RunAsCurrentUser: OpenProcessToken failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return RunAsUser(command_line, get(token), true);
-}
-
-static HRESULT StartInternetExplorerAsUser(HANDLE user_token,
-                                           const CString& options) {
-  // Internet Explorer path
-  CString ie_file_path;
-  HRESULT result = RegKey::GetValue(kRegKeyIeClass,
-                                    kRegValueIeClass,
-                                    &ie_file_path);
-  ASSERT1(SUCCEEDED(result));
-
-  if (SUCCEEDED(result)) {
-    CString command_line(ie_file_path);
-    command_line += _T(' ');
-    command_line += options;
-    UTIL_LOG(L5, (_T("[StartInternetExplorerAsUser]")
-                  _T("[Running IExplore with command line][%s]"),
-                  command_line));
-    result = RunAsUser(command_line, user_token, false);
-  }
-  return result;
-}
-
-//
-// Constants used by RestartIEUser()
-//
-// The IEUser executable name
-const TCHAR* kIEUser = _T("IEUSER.EXE");
-
-// The maximum number of simultaneous
-// logged on users in FUS that we support
-const int kMaximumUsers = 16;
-
-
-// Restart IEUser processs. This is to allow for
-// IEUser.exe to refresh it's ElevationPolicy cache. Due to a bug
-// within IE7, IEUser.exe does not refresh it's cache unless it
-// is restarted in the manner below. If the cache is not refreshed
-// IEUser does not respect any new ElevationPolicies that a fresh
-// setup program installs for an ActiveX control or BHO. This code
-// is adapted from Toolbar.
-HRESULT RestartIEUser() {
-  // Use the service to restart IEUser.
-  // This allows us to restart IEUser for:
-  //   (a) Multiple users for the first-install case
-  //       (we currently only restart IEUser for the current interactive user)
-  //   (b) Even if we are started in an elevated mode
-
-  if (!SystemInfo::IsRunningOnVistaOrLater()) {
-    UTIL_LOG(L5, (_T("[RestartIEUser - not running on Vista - Exiting]")));
-    return S_OK;
-  }
-
-  // The restart should be attempted from the system account
-  bool is_system_process = false;
-  if (FAILED(IsSystemProcess(&is_system_process)) || !is_system_process) {
-    ASSERT1(false);
-    return E_ACCESSDENIED;
-  }
-
-  // Get the list of users currently running IEUser.exe processes.
-  scoped_handle ieuser_users[kMaximumUsers];
-  int number_of_users = 0;
-  Process::GetUsersOfProcesses(kIEUser, kMaximumUsers, ieuser_users,
-                               &number_of_users);
-
-  UTIL_LOG(L5, (_T("[RestartIEUser]")
-                _T("[number_of_users running IEUser %d]"), number_of_users));
-
-  if (!number_of_users) {
-    UTIL_LOG(L5, (_T("[RestartIEUser][No IEUser processes running]")));
-    return S_OK;
-  }
-
-  // Kill current IEUser processes.
-  ProcessTerminator pt(kIEUser);
-  const int kKillWaitTimeoutMs = 5000;
-  bool found = false;
-  const int kill_method = (ProcessTerminator::KILL_METHOD_4_TERMINATE_PROCESS);
-
-  RET_IF_FAILED(pt.KillTheProcess(kKillWaitTimeoutMs,
-                                  &found,
-                                  kill_method,
-                                  false));
-
-  // Restart them.
-  HRESULT result = S_OK;
-  for (int i = 0; i < number_of_users; i++) {
-    // To start a new ieuser.exe, simply start iexplore.exe as a normal user
-    // The -embedding prevents IE from opening a window
-    HRESULT restart_result = StartInternetExplorerAsUser(get(ieuser_users[i]),
-                                                         _T("-embedding"));
-    if (FAILED(restart_result)) {
-      UTIL_LOG(LEVEL_ERROR, (_T("[StartInternetExplorerAsUser failed][0x%x]"),
-                             restart_result));
-      result = restart_result;
-    }
-  }
-
-  return result;
-}
-
-HRESULT GetExplorerPidForCurrentUserOrSession(uint32* pid) {
-  ASSERT1(pid);
-  std::vector<uint32> pids;
-  HRESULT hr = GetProcessPidsForActiveUserOrSession(kExplorer, &pids);
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[Did not find explorer.exe processes][0x%x]"), hr));
-    return hr;
-  }
-
-  CORE_LOG(L1, (_T("[Found %u instance(s) of explorer.exe]"), pids.size()));
-
-  *pid = pids[0];   // Return only the first instance of explorer.exe.
-  return S_OK;
-}
-
-HRESULT GetExplorerTokenForLoggedInUser(HANDLE* token) {
-  UTIL_LOG(L3, (_T("[GetExplorerTokenForLoggedInUser]")));
-  ASSERT1(token);
-
-  // TODO(omaha): One can set the windows shell to be other than
-  // explorer.exe, handle this case. One way to handle this is to
-  // read the regkey
-  // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
-  // The only problem with this is it can be overriden with the user reg keys.
-  // Need to figure out a method to do this.
-  // Also consider using the interactive user before picking the first explorer
-  // process i.e. the active user.
-  std::vector<uint32> processes;
-  DWORD flags = EXCLUDE_CURRENT_PROCESS;
-  std::vector<CString> command_lines;
-  CString explorer_file_name(kExplorer);
-  CString user_sid;
-
-  HRESULT hr = Process::FindProcesses(flags,
-                                      explorer_file_name,
-                                      true,
-                                      user_sid,
-                                      command_lines,
-                                      &processes);
-  if (FAILED(hr)) {
-    CORE_LOG(LEVEL_ERROR, (_T("[FindProcesses failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  std::vector<uint32>::const_iterator iter = processes.begin();
-  for (; iter != processes.end(); ++iter) {
-    uint32 explorer_pid = *iter;
-    scoped_handle exp(::OpenProcess(PROCESS_QUERY_INFORMATION | SYNCHRONIZE,
-                                    false,
-                                    explorer_pid));
-    if (exp) {
-      if (::OpenProcessToken(get(exp),
-                             TOKEN_DUPLICATE | TOKEN_QUERY | TOKEN_IMPERSONATE,
-                             token)) {
-        // TODO(omaha): Consider using the GetWindowsAccountDomainSid
-        // method here. This method returns the domain SID associated
-        // with the passed in SID. This allows us to detect if the user is a
-        // domain user. We should prefer domain users over normal users,
-        // as in corporate environments, these users will be more likely to
-        // allow to be tunneled through a proxy.
-        return S_OK;
-      } else {
-        hr = HRESULTFromLastError();
-        CORE_LOG(LEVEL_WARNING, (_T("[OpenProcessToken failed][0x%08x]"), hr));
-      }
-    } else {
-      hr = HRESULTFromLastError();
-      CORE_LOG(LEVEL_WARNING, (_T("[OpenProcess failed][0x%08x]"), hr));
-    }
-  }
-
-  return hr;
-}
-
-HRESULT GetPidsInSession(const TCHAR* exe_name,
-                         const TCHAR* user_sid,
-                         DWORD session_id,
-                         std::vector<uint32>* pids) {
-  ASSERT1(pids);
-  ASSERT1(exe_name);
-  ASSERT1(*exe_name);
-  UTIL_LOG(L3, (_T("[GetPidsInSession][%s][sid=%s][session=%d]"),
-                exe_name, user_sid, session_id));
-
-  pids->clear();
-
-  DWORD flags = EXCLUDE_CURRENT_PROCESS;
-  if (user_sid != NULL) {
-    flags |= INCLUDE_ONLY_PROCESS_OWNED_BY_USER;
-  }
-  std::vector<CString> command_lines;
-  HRESULT hr = Process::FindProcessesInSession(session_id,
-                                               flags,
-                                               exe_name,
-                                               true,
-                                               user_sid,
-                                               command_lines,
-                                               pids);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  return pids->empty() ? HRESULT_FROM_WIN32(ERROR_NOT_FOUND) : S_OK;
-}
-
-HRESULT GetProcessPidsForActiveUserOrSession(const TCHAR* exe_name,
-                                             std::vector<uint32>* pids) {
-  bool is_system = false;
-  HRESULT hr = IsSystemProcess(&is_system);
-  if (FAILED(hr)) {
-    NET_LOG(LE, (_T("[IsSystemProcess failed][0x%x]"), hr));
-    return hr;
-  }
-
-  if (is_system) {
-    return vista::GetPidsInSession(exe_name,
-                                   NULL,
-                                   System::GetActiveSessionId(),
-                                   pids);
-  }
-
-  CString user_sid;
-  // If this call fails, we are still ok.
-  omaha::user_info::GetProcessUser(NULL, NULL, &user_sid);
-  DWORD current_session = System::GetCurrentSessionId();
-  if (FAILED(vista::GetPidsInSession(exe_name,
-                                     user_sid,
-                                     current_session,
-                                     pids))) {
-    // In the case of RunAs, the processes may be under a different identity
-    // than the current sid. So if we are unable to find a process under the
-    // current user's sid, we search for processes running in the current
-    // session regardless of the sid they are running under.
-    return vista::GetPidsInSession(exe_name,
-                                   NULL,
-                                   current_session,
-                                   pids);
-  }
-
-  return S_OK;
-}
-
-
-
-HRESULT StartProcessWithTokenOfProcess(uint32 pid,
-                                       const CString& command_line) {
-  UTIL_LOG(L5, (_T("[StartProcessWithTokenOfProcess]")
-                _T("[pid %u][command_line '%s']"), pid, command_line));
-
-  // Get the token from process.
-  scoped_handle user_token;
-  HRESULT hr = Process::GetImpersonationToken(pid, address(user_token));
-  if (FAILED(hr)) {
-    CORE_LOG(LEVEL_ERROR, (_T("[GetImpersonationToken failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  // Start process using the token.
-  UTIL_LOG(L5, (_T("[StartProcessWithTokenOfProcess][Running process %s]"),
-                command_line));
-  hr = RunAsUser(command_line, get(user_token), false);
-
-  if (FAILED(hr)) {
-    UTIL_LOG(LEVEL_ERROR,
-      (_T("[Vista::StartProcessWithTokenOfProcess - RunAsUser failed][0x%x]"),
-      hr));
-  }
-
-  return hr;
-}
-
-HRESULT GetLoggedOnUserToken(HANDLE* token) {
-  ASSERT1(token);
-  *token = NULL;
-
-  uint32 pid = 0;
-  HRESULT hr = GetExplorerPidForCurrentUserOrSession(&pid);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  hr = Process::GetImpersonationToken(pid, token);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  ASSERT1(*token);
-  return S_OK;
-}
-
-}  // namespace vista
-
-}  // namespace omaha
-
diff --git a/base/vista_utils.h b/base/vista_utils.h
deleted file mode 100644
index def9b4e..0000000
--- a/base/vista_utils.h
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_VISTA_UTILS_H__
-#define OMAHA_COMMON_VISTA_UTILS_H__
-
-#include <windows.h>
-#include <aclapi.h>
-#include <sddl.h>
-#include <userenv.h>
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-// Constants.
-const TCHAR* const kExplorer = _T("EXPLORER.EXE");
-const TCHAR* const kIExplore = _T("IEXPLORE.EXE");
-
-namespace vista {
-
-// Returns true if the current process is running in 'protected mode'.
-bool IsProcessProtected();
-
-// Allows processes that run under protected mode access to a shared kernel
-// object such as mapped memory.
-//
-// Returns S_OK if successful, S_FALSE if not running on vista, or an
-// error value.
-HRESULT AllowProtectedProcessAccessToSharedObject(const TCHAR* name);
-
-// Restarts IEUser process if we can. This is to allow for
-// IEUser.exe to refresh it's ElevationPolicy cache. Due to a bug
-// within IE7, IEUser.exe does not refresh it's cache unless it
-// is restarted in the manner below. If the cache is not refreshed
-// IEUser does not respect any new ElevationPolicies that a fresh
-// setup program installs for an ActiveX control or BHO. This code
-// is adapted from Toolbar.
-HRESULT RestartIEUser();
-
-// TODO(Omaha): Move these to a different utils file, since these are not
-// Vista-specific.
-// TODO(Omaha): rename for consistency with
-// GetProcessPidsForActiveUserOrSession.
-//
-// Gets current user's explorer.exe pid. If that fails, gets the pid of any
-// explorer.exe running in the current session.
-HRESULT GetExplorerPidForCurrentUserOrSession(uint32* pid);
-
-// Returns the TOKEN of the explorer process of any user that is logged in.
-HRESULT GetExplorerTokenForLoggedInUser(HANDLE* token);
-
-// Retrieves a primary token for one of the logged on users. The logged on
-// user is either the current user or a user logged on in the same session as
-// the current user. The caller must close the token handle.
-// If this function is called before the dependent services of Remote
-// Desktop Services have started, an RPC_S_INVALID_BINDING error code may
-// be returned.
-HRESULT GetLoggedOnUserToken(HANDLE* token);
-
-// Get PIDs for the processes running with the specified executable, user_sid,
-// and session_id. user_sid can be blank, in which case, the search will
-// encompass all processes with the given name in session_id. The session
-// always has to be a valid session, hence the name GetPidsInSession().
-HRESULT GetPidsInSession(const TCHAR* exe_name,
-                         const TCHAR* user_sid,
-                         DWORD session_id,
-                         std::vector<uint32>* pids);
-
-// Get the handle of exe_name running under the active user or active session.
-// If the call is made from the SYSTEM account, returns PIDs for exe_name
-// in the currently active user session. If the call is made from a user account
-// returns PIDs for that user, or if that cannot be found, in the current
-// session.
-HRESULT GetProcessPidsForActiveUserOrSession(const TCHAR* exe_name,
-                                             std::vector<uint32>* pids);
-
-// Starts process with the token obtained from the specified process.
-HRESULT StartProcessWithTokenOfProcess(uint32 pid,
-                                       const CString& command_line);
-
-// Runs the command on behalf of the current user. Creates a fresh environment
-// block based on the user's token.
-HRESULT RunAsCurrentUser(const CString& command_line);
-
-}  // namespace vista
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_VISTA_UTILS_H__
-
diff --git a/base/vista_utils_unittest.cc b/base/vista_utils_unittest.cc
deleted file mode 100644
index 675899c..0000000
--- a/base/vista_utils_unittest.cc
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/app_util.h"
-#include "omaha/base/path.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vista_utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace vista {
-
-// Exercises RunAsUser() with explorer token. For Vista, the call to
-// StartProcessWithTokenOfProcess() will succeed only if the caller is SYSTEM.
-TEST(VistaUtilsTest, StartProcessWithExplorerTokenTest) {
-  CString path = ConcatenatePath(app_util::GetSystemDir(), _T("cmd.exe"));
-  EnclosePath(&path);
-  path += _T(" /c exit 702");
-  uint32 pid(0);
-  EXPECT_SUCCEEDED(GetExplorerPidForCurrentUserOrSession(&pid));
-
-  HRESULT hr = StartProcessWithTokenOfProcess(pid, path);
-  if (!vista_util::IsVistaOrLater()) {
-    EXPECT_SUCCEEDED(hr);
-    return;
-  }
-
-  bool is_system = false;
-  EXPECT_SUCCEEDED(IsSystemProcess(&is_system));
-  if (is_system) {
-    EXPECT_SUCCEEDED(hr);
-    return;
-  }
-
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_PRIVILEGE_NOT_HELD), hr);
-}
-
-// Exercises RunAsUser() with current user token.
-TEST(VistaUtilsTest, RunAsCurrentUserTest) {
-  CString path = ConcatenatePath(app_util::GetSystemDir(), _T("cmd.exe"));
-  EnclosePath(&path);
-  path += _T(" /c exit 702");
-  EXPECT_SUCCEEDED(vista::RunAsCurrentUser(path));
-}
-
-}  // namespace vista
-
-}  // namespace omaha
-
diff --git a/base/vistautil.cc b/base/vistautil.cc
deleted file mode 100644
index 45aecea..0000000
--- a/base/vistautil.cc
+++ /dev/null
@@ -1,585 +0,0 @@
-// Copyright 2006-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/vistautil.h"
-#include <accctrl.h>
-#include <Aclapi.h>
-#include <Sddl.h>
-#include <ShellAPI.h>
-#include <shlobj.h>
-#include "base/scoped_ptr.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/process.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vista_utils.h"
-#include "omaha/third_party/smartany/scoped_any.h"
-
-namespace omaha {
-
-namespace vista_util {
-
-static SID_IDENTIFIER_AUTHORITY mandatory_label_auth =
-    SECURITY_MANDATORY_LABEL_AUTHORITY;
-
-
-static HRESULT GetSidIntegrityLevel(PSID sid, MANDATORY_LEVEL* level) {
-  if (!IsValidSid(sid))
-    return E_FAIL;
-
-  SID_IDENTIFIER_AUTHORITY* authority = GetSidIdentifierAuthority(sid);
-  if (!authority)
-    return E_FAIL;
-
-  if (memcmp(authority, &mandatory_label_auth,
-      sizeof(SID_IDENTIFIER_AUTHORITY)))
-    return E_FAIL;
-
-  PUCHAR count = GetSidSubAuthorityCount(sid);
-  if (!count || *count != 1)
-    return E_FAIL;
-
-  DWORD* rid = GetSidSubAuthority(sid, 0);
-  if (!rid)
-    return E_FAIL;
-
-  if ((*rid & 0xFFF) != 0 || *rid > SECURITY_MANDATORY_PROTECTED_PROCESS_RID)
-    return E_FAIL;
-
-  *level = static_cast<MANDATORY_LEVEL>(*rid >> 12);
-  return S_OK;
-}
-
-// Will return S_FALSE and MandatoryLevelMedium if the acl is NULL
-static HRESULT GetAclIntegrityLevel(PACL acl, MANDATORY_LEVEL* level,
-    bool* and_children) {
-  *level = MandatoryLevelMedium;
-  if (and_children)
-    *and_children = false;
-  if (!acl) {
-    // This is the default label value if the acl was empty
-    return S_FALSE;
-  }
-
-  SYSTEM_MANDATORY_LABEL_ACE* mandatory_label_ace;
-  if (!GetAce(acl, 0, reinterpret_cast<void**>(&mandatory_label_ace)))
-    return S_FALSE;
-
-  if (mandatory_label_ace->Header.AceType != SYSTEM_MANDATORY_LABEL_ACE_TYPE)
-    return S_FALSE;
-
-  if (!(mandatory_label_ace->Mask & SYSTEM_MANDATORY_LABEL_NO_WRITE_UP)) {
-    // I have found that if this flag is not set, a low integrity label doesn't
-    // prevent writes from being virtualized.  MS provides zero documentation.
-    // I just did an MSDN search, a Google search, and a search of the Beta
-    // Vista SDKs, and no docs. TODO(omaha): Check docs again periodically.
-    // For now, act as if no label was set, and default to medium.
-    return S_FALSE;
-  }
-
-  if (and_children) {
-    *and_children = ((mandatory_label_ace->Header.AceFlags &
-        (OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE))
-        == (OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE));
-  }
-
-  return GetSidIntegrityLevel(reinterpret_cast<SID*>(&mandatory_label_ace->
-      SidStart), level);
-}
-
-// If successful, the caller needs to free the ACL using LocalFree()
-// on failure, returns NULL
-static ACL* CreateMandatoryLabelAcl(MANDATORY_LEVEL level, bool and_children) {
-  int ace_size = sizeof(SYSTEM_MANDATORY_LABEL_ACE)
-      - sizeof(DWORD) + GetSidLengthRequired(1);
-  int acl_size = sizeof(ACL) + ace_size;
-
-  ACL* acl = reinterpret_cast<ACL*>(LocalAlloc(LPTR, acl_size));
-  if (!acl)
-    return NULL;
-
-  bool failed = true;
-  if (InitializeAcl(acl, acl_size, ACL_REVISION)) {
-    if (level > 0) {
-      SYSTEM_MANDATORY_LABEL_ACE* ace = reinterpret_cast<
-          SYSTEM_MANDATORY_LABEL_ACE*>(LocalAlloc(LPTR, ace_size));
-      if (ace) {
-        ace->Header.AceType = SYSTEM_MANDATORY_LABEL_ACE_TYPE;
-        ace->Header.AceFlags = and_children ?
-            (OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE) : 0;
-        ace->Header.AceSize = static_cast<WORD>(ace_size);
-        ace->Mask = SYSTEM_MANDATORY_LABEL_NO_WRITE_UP;
-
-        SID* sid = reinterpret_cast<SID*>(&ace->SidStart);
-
-        if (InitializeSid(sid, &mandatory_label_auth, 1)) {
-          *GetSidSubAuthority(sid, 0) = static_cast<DWORD>(level) << 12;
-          failed = !AddAce(acl, ACL_REVISION, 0, ace, ace_size);
-        }
-        LocalFree(ace);
-      }
-    }
-  }
-  if (failed) {
-    LocalFree(acl);
-    acl = NULL;
-  }
-  return acl;
-}
-
-
-TCHAR* AllocFullRegPath(HKEY root, const TCHAR* subkey) {
-  if (!subkey)
-    return NULL;
-
-  const TCHAR* root_string;
-
-  if (root == HKEY_CURRENT_USER)
-    root_string = _T("CURRENT_USER\\");
-  else if (root == HKEY_LOCAL_MACHINE)
-    root_string = _T("MACHINE\\");
-  else if (root == HKEY_CLASSES_ROOT)
-    root_string = _T("CLASSES_ROOT\\");
-  else if (root == HKEY_USERS)
-    root_string = _T("USERS\\");
-  else
-    return NULL;
-
-  size_t root_size = _tcslen(root_string);
-  size_t size = root_size + _tcslen(subkey) + 1;
-  TCHAR* result = reinterpret_cast<TCHAR*>(LocalAlloc(LPTR,
-      size * sizeof(TCHAR)));
-  if (!result)
-    return NULL;
-
-  memcpy(result, root_string, size * sizeof(TCHAR));
-  memcpy(result + root_size, subkey, (1 + size - root_size) * sizeof(TCHAR));
-  return result;
-}
-
-
-bool IsUserNonElevatedAdmin() {
-  // If pre-Vista return false;
-  if (!IsVistaOrLater()) {
-    return false;
-  }
-
-  bool non_elevated_admin = false;
-  scoped_handle token;
-  if (::OpenProcessToken(::GetCurrentProcess(), TOKEN_READ, address(token))) {
-    TOKEN_ELEVATION_TYPE elevation_type = TokenElevationTypeDefault;
-    DWORD infoLen = 0;
-    if (::GetTokenInformation(get(token),
-                              TokenElevationType,
-                              reinterpret_cast<void*>(&elevation_type),
-                              sizeof(elevation_type),
-                              &infoLen)) {
-      if (elevation_type == TokenElevationTypeLimited) {
-        non_elevated_admin = true;
-      }
-    }
-  }
-
-  return non_elevated_admin;
-}
-
-bool IsUserAdmin() {
-  // Determine if the user is part of the adminstators group. This will return
-  // true in case of XP and 2K if the user belongs to admin group. In case of
-  // Vista, it only returns true if the admin is running elevated.
-  SID_IDENTIFIER_AUTHORITY nt_authority = SECURITY_NT_AUTHORITY;
-  PSID administrators_group = NULL;
-  BOOL result = ::AllocateAndInitializeSid(&nt_authority,
-                                           2,
-                                           SECURITY_BUILTIN_DOMAIN_RID,
-                                           DOMAIN_ALIAS_RID_ADMINS,
-                                           0, 0, 0, 0, 0, 0,
-                                           &administrators_group);
-  if (result) {
-    if (!::CheckTokenMembership(NULL, administrators_group, &result)) {
-      result = false;
-    }
-    ::FreeSid(administrators_group);
-  }
-  return !!result;
-}
-
-bool IsVistaOrLater() {
-  static bool known = false;
-  static bool is_vista = false;
-  if (!known) {
-    OSVERSIONINFOEX osvi = { 0 };
-    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
-    osvi.dwMajorVersion = 6;
-    DWORDLONG conditional = 0;
-    VER_SET_CONDITION(conditional, VER_MAJORVERSION, VER_GREATER_EQUAL);
-    is_vista = !!VerifyVersionInfo(&osvi, VER_MAJORVERSION, conditional);
-    // If the Win32 API failed for some other reason, callers may incorrectly
-    // perform non-Vista operations. Assert we don't see any other failures.
-    ASSERT1(is_vista || ERROR_OLD_WIN_VERSION == ::GetLastError());
-    known = true;
-  }
-  return is_vista;
-}
-
-HRESULT IsUserRunningSplitToken(bool* is_split_token) {
-  ASSERT1(is_split_token);
-
-  if (!IsVistaOrLater()) {
-    *is_split_token = false;
-    return S_OK;
-  }
-
-  scoped_handle process_token;
-  if (!::OpenProcessToken(::GetCurrentProcess(),
-                          TOKEN_QUERY,
-                          address(process_token))) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(L1, (_T("[OpenProcessToken failed][0x%x]"), hr));
-    return hr;
-  }
-
-  TOKEN_ELEVATION_TYPE elevation_type = TokenElevationTypeDefault;
-  DWORD size_returned = 0;
-  if (!::GetTokenInformation(get(process_token),
-                             TokenElevationType,
-                             &elevation_type,
-                             sizeof(elevation_type),
-                             &size_returned)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(L1, (_T("[GetTokenInformation failed][0x%x]"), hr));
-    return hr;
-  }
-
-  *is_split_token = elevation_type == TokenElevationTypeFull ||
-                    elevation_type == TokenElevationTypeLimited;
-  ASSERT1(*is_split_token || elevation_type == TokenElevationTypeDefault);
-
-  return S_OK;
-}
-
-bool IsUACMaybeOn() {
-  ASSERT1(vista_util::IsVistaOrLater());
-
-  // The presence of a split token definitively indicates that UAC is on. But
-  // the absence does not necessarily indicate that UAC is off.
-  bool is_split_token = false;
-  if (SUCCEEDED(IsUserRunningSplitToken(&is_split_token)) && is_split_token) {
-    return true;
-  }
-
-  const TCHAR* key_name = _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\")
-                          _T("CurrentVersion\\Policies\\System");
-
-  DWORD enable_lua = 0;
-  return FAILED(RegKey::GetValue(key_name, _T("EnableLUA"), &enable_lua)) ||
-         enable_lua;
-}
-
-bool IsElevatedWithUACMaybeOn() {
-  return IsUserAdmin() && IsVistaOrLater() && IsUACMaybeOn();
-}
-
-HRESULT RunElevated(const TCHAR* file_path,
-                    const TCHAR* parameters,
-                    int show_window,
-                    DWORD* exit_code) {
-  UTIL_LOG(L1, (_T("[Running elevated][%s][%s]"), file_path, parameters));
-
-  ASSERT1(vista_util::IsVistaOrLater());
-  ASSERT1(!vista_util::IsUserAdmin());
-
-  SHELLEXECUTEINFO shell_execute_info;
-  shell_execute_info.cbSize = sizeof(SHELLEXECUTEINFO);
-  shell_execute_info.fMask = SEE_MASK_FLAG_NO_UI     |
-                             SEE_MASK_NOZONECHECKS   |
-                             SEE_MASK_NOASYNC;
-  if (exit_code != NULL) {
-    shell_execute_info.fMask |= SEE_MASK_NOCLOSEPROCESS;
-  }
-  shell_execute_info.hProcess = NULL;
-  shell_execute_info.hwnd = NULL;
-  shell_execute_info.lpVerb = L"runas";
-  shell_execute_info.lpFile = file_path;
-  shell_execute_info.lpParameters = parameters;
-  shell_execute_info.lpDirectory = NULL;
-  shell_execute_info.nShow = show_window;
-  shell_execute_info.hInstApp = NULL;
-
-  if (!ShellExecuteExEnsureParent(&shell_execute_info)) {
-    return AtlHresultFromLastError();
-  }
-
-  scoped_process process(shell_execute_info.hProcess);
-
-  // Wait for the end of the spawned process, if needed
-  if (exit_code) {
-    WaitForSingleObject(get(process), INFINITE);
-    VERIFY1(GetExitCodeProcess(get(process), exit_code));
-    UTIL_LOG(L1, (_T("[Elevated process exited][PID: %u][exit code: %u]"),
-                  Process::GetProcessIdFromHandle(get(process)), *exit_code));
-  } else {
-    UTIL_LOG(L1, (_T("[Elevated process exited][PID: %u]"),
-                  Process::GetProcessIdFromHandle(get(process))));
-  }
-
-  return S_OK;
-}
-
-
-HRESULT GetProcessIntegrityLevel(DWORD process_id, MANDATORY_LEVEL* level) {
-  if (!IsVistaOrLater())
-    return E_NOTIMPL;
-
-  if (process_id == 0)
-    process_id = ::GetCurrentProcessId();
-
-  HRESULT result = E_FAIL;
-  HANDLE process = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, process_id);
-  if (process != NULL) {
-    HANDLE current_token;
-    if (OpenProcessToken(process,
-                         TOKEN_QUERY | TOKEN_QUERY_SOURCE,
-                         &current_token)) {
-      DWORD label_size = 0;
-      TOKEN_MANDATORY_LABEL* label;
-      GetTokenInformation(current_token, TokenIntegrityLevel,
-          NULL, 0, &label_size);
-      if (label_size && (label = reinterpret_cast<TOKEN_MANDATORY_LABEL*>
-          (LocalAlloc(LPTR, label_size))) != NULL) {
-        if (GetTokenInformation(current_token, TokenIntegrityLevel,
-            label, label_size, &label_size)) {
-          result = GetSidIntegrityLevel(label->Label.Sid, level);
-        }
-        LocalFree(label);
-      }
-      CloseHandle(current_token);
-    }
-    CloseHandle(process);
-  }
-  return result;
-}
-
-
-HRESULT GetFileOrFolderIntegrityLevel(const TCHAR* file,
-    MANDATORY_LEVEL* level, bool* and_children) {
-  if (!IsVistaOrLater())
-    return E_NOTIMPL;
-
-  PSECURITY_DESCRIPTOR descriptor;
-  PACL acl = NULL;
-
-  DWORD result = GetNamedSecurityInfo(const_cast<TCHAR*>(file), SE_FILE_OBJECT,
-      LABEL_SECURITY_INFORMATION, NULL, NULL, NULL, &acl, &descriptor);
-  if (result != ERROR_SUCCESS)
-    return HRESULT_FROM_WIN32(result);
-
-  HRESULT hr = GetAclIntegrityLevel(acl, level, and_children);
-  LocalFree(descriptor);
-  return hr;
-}
-
-
-HRESULT SetFileOrFolderIntegrityLevel(const TCHAR* file,
-    MANDATORY_LEVEL level, bool and_children) {
-  if (!IsVistaOrLater())
-    return E_NOTIMPL;
-
-  ACL* acl = CreateMandatoryLabelAcl(level, and_children);
-  if (!acl)
-    return E_FAIL;
-
-  DWORD result = SetNamedSecurityInfo(const_cast<TCHAR*>(file), SE_FILE_OBJECT,
-      LABEL_SECURITY_INFORMATION, NULL, NULL, NULL, acl);
-  LocalFree(acl);
-  return HRESULT_FROM_WIN32(result);
-}
-
-
-HRESULT GetRegKeyIntegrityLevel(HKEY root, const TCHAR* subkey,
-    MANDATORY_LEVEL* level, bool* and_children) {
-  if (!IsVistaOrLater())
-    return E_NOTIMPL;
-
-  TCHAR* reg_path = AllocFullRegPath(root, subkey);
-  if (!reg_path)
-    return E_FAIL;
-
-  PSECURITY_DESCRIPTOR descriptor;
-  PACL acl = NULL;
-
-  DWORD result = GetNamedSecurityInfo(reg_path, SE_REGISTRY_KEY,
-      LABEL_SECURITY_INFORMATION, NULL, NULL, NULL, &acl, &descriptor);
-  if (result != ERROR_SUCCESS) {
-    LocalFree(reg_path);
-    return HRESULT_FROM_WIN32(result);
-  }
-
-  HRESULT hr = GetAclIntegrityLevel(acl, level, and_children);
-  LocalFree(descriptor);
-  LocalFree(reg_path);
-  return hr;
-}
-
-
-HRESULT SetRegKeyIntegrityLevel(HKEY root, const TCHAR* subkey,
-    MANDATORY_LEVEL level, bool and_children) {
-  if (!IsVistaOrLater())
-    return E_NOTIMPL;
-
-  TCHAR* reg_path = AllocFullRegPath(root, subkey);
-  if (!reg_path)
-    return E_FAIL;
-
-  ACL* acl = CreateMandatoryLabelAcl(level, and_children);
-  if (!acl) {
-    LocalFree(reg_path);
-    return E_FAIL;
-  }
-
-  DWORD result = SetNamedSecurityInfo(reg_path, SE_REGISTRY_KEY,
-      LABEL_SECURITY_INFORMATION, NULL, NULL, NULL, acl);
-  LocalFree(acl);
-  LocalFree(reg_path);
-  return HRESULT_FROM_WIN32(result);
-}
-
-
-CSecurityDesc* BuildSecurityDescriptor(const TCHAR* sddl_sacl,
-                                       ACCESS_MASK mask) {
-  if (!IsVistaOrLater()) {
-    return NULL;
-  }
-
-  scoped_ptr<CSecurityDesc> security_descriptor(new CSecurityDesc);
-  security_descriptor->FromString(sddl_sacl);
-
-  // Fill out the rest of the security descriptor from the process token.
-  CAccessToken token;
-  if (!token.GetProcessToken(TOKEN_QUERY)) {
-    return NULL;
-  }
-
-  // The owner.
-  CSid sid_owner;
-  if (!token.GetOwner(&sid_owner)) {
-    return NULL;
-  }
-  security_descriptor->SetOwner(sid_owner);
-
-  // The group.
-  CSid sid_group;
-  if (!token.GetPrimaryGroup(&sid_group)) {
-    return NULL;
-  }
-  security_descriptor->SetGroup(sid_group);
-
-  // The discretionary access control list.
-  CDacl dacl;
-  if (!token.GetDefaultDacl(&dacl)) {
-    return NULL;
-  }
-
-  // Add an access control entry mask for the current user.
-  // This is what grants this user access from lower integrity levels.
-  CSid sid_user;
-  if (!token.GetUser(&sid_user)) {
-    return NULL;
-  }
-
-  if (!dacl.AddAllowedAce(sid_user, mask)) {
-    return NULL;
-  }
-
-  // Lastly, save the dacl to this descriptor.
-  security_descriptor->SetDacl(dacl);
-  return security_descriptor.release();
-};
-
-CSecurityDesc* CreateLowIntegritySecurityDesc(ACCESS_MASK mask) {
-  return BuildSecurityDescriptor(LOW_INTEGRITY_SDDL_SACL, mask);
-}
-
-CSecurityDesc* CreateMediumIntegritySecurityDesc(ACCESS_MASK mask) {
-  return BuildSecurityDescriptor(MEDIUM_INTEGRITY_SDDL_SACL, mask);
-}
-
-HRESULT AddLowIntegritySaclToExistingDesc(CSecurityDesc* sd) {
-  ASSERT1(sd);
-  ASSERT1(sd->GetPSECURITY_DESCRIPTOR());
-
-  if (!IsVistaOrLater()) {
-    return S_FALSE;
-  }
-
-  CSecurityDesc sd_low;
-  if (!sd_low.FromString(LOW_INTEGRITY_SDDL_SACL)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LE, (_T("[Failed to parse LOW_INTEGRITY_SDDL_SACL][0x%x]"), hr));
-    return hr;
-  }
-
-  // Atl::CSacl does not support SYSTEM_MANDATORY_LABEL_ACE_TYPE.
-  BOOL sacl_present = FALSE;
-  BOOL sacl_defaulted = FALSE;
-  PACL sacl = NULL;
-  if (!::GetSecurityDescriptorSacl(
-             const_cast<SECURITY_DESCRIPTOR*>(sd_low.GetPSECURITY_DESCRIPTOR()),
-             &sacl_present,
-             &sacl,
-             &sacl_defaulted) ||
-      !sacl) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LE, (_T("[Failed to get the low integrity SACL][0x%x]"), hr));
-    return hr;
-  }
-
-  ACL_SIZE_INFORMATION acl_size = {0};
-  if (!::GetAclInformation(sacl,
-                           &acl_size,
-                           sizeof(acl_size),
-                           AclSizeInformation)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LE, (_T("[Failed to get AclSizeInformation][0x%x]"), hr));
-    return hr;
-  }
-
-  // The CSecurityDesc destructor expects the memory to have been malloced.
-  PACL new_sacl = static_cast<PACL>(malloc(acl_size.AclBytesInUse));
-  ::CopyMemory(new_sacl, sacl, acl_size.AclBytesInUse);
-
-  CSacl sacl_empty;
-  sd->SetSacl(sacl_empty);
-
-  if (!::SetSecurityDescriptorSacl(
-             const_cast<SECURITY_DESCRIPTOR*>(sd->GetPSECURITY_DESCRIPTOR()),
-             sacl_present,
-             new_sacl,
-             sacl_defaulted))  {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LE, (_T("[Failed to set the low integrity SACL][0x%x]"), hr));
-    free(new_sacl);
-    return hr;
-  }
-
-  return S_OK;
-}
-
-}  // namespace vista_util
-
-}  // namespace omaha
-
diff --git a/base/vistautil.h b/base/vistautil.h
deleted file mode 100644
index e0ebdb7..0000000
--- a/base/vistautil.h
+++ /dev/null
@@ -1,165 +0,0 @@
-// Copyright 2006-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_BASE_VISTAUTIL_H_
-#define OMAHA_BASE_VISTAUTIL_H_
-
-#include <windows.h>
-#include <tchar.h>
-#include <accctrl.h>
-#include <Aclapi.h>
-#include <Sddl.h>
-#include <WinNT.h>
-#include <atlsecurity.h>
-
-namespace omaha {
-
-// SACLs are normally used for auditing, but Vista also uses them to
-// determine integrity levels.
-// For more info, http://www.google.com/search?q=SDDL+for+Mandatory+Labels
-// S = SACL
-// ML = Mandatory label (aka integrity level)
-// NW = No write up (integrity levels less than low cannot gain access)
-// LW = Low Integrity Level (What IE normally runs in)
-
-// The LABEL_SECURITY_INFORMATION SDDL SACL for medium integrity.
-// L"S:(ML;;NW;;;ME)"
-#define MEDIUM_INTEGRITY_SDDL_SACL  SDDL_SACL             \
-                                    SDDL_DELIMINATOR      \
-                                    SDDL_ACE_BEGIN        \
-                                    SDDL_MANDATORY_LABEL  \
-                                    SDDL_SEPERATOR        \
-                                    SDDL_SEPERATOR        \
-                                    SDDL_NO_WRITE_UP      \
-                                    SDDL_SEPERATOR        \
-                                    SDDL_SEPERATOR        \
-                                    SDDL_SEPERATOR        \
-                                    SDDL_ML_MEDIUM        \
-                                    SDDL_ACE_END
-
-// The LABEL_SECURITY_INFORMATION SDDL SACL for low integrity.
-// L"S:(ML;;NW;;;LW)"
-#define LOW_INTEGRITY_SDDL_SACL     SDDL_SACL             \
-                                    SDDL_DELIMINATOR      \
-                                    SDDL_ACE_BEGIN        \
-                                    SDDL_MANDATORY_LABEL  \
-                                    SDDL_SEPERATOR        \
-                                    SDDL_SEPERATOR        \
-                                    SDDL_NO_WRITE_UP      \
-                                    SDDL_SEPERATOR        \
-                                    SDDL_SEPERATOR        \
-                                    SDDL_SEPERATOR        \
-                                    SDDL_ML_LOW           \
-                                    SDDL_ACE_END
-
-namespace vista_util {
-
-// This is fast, since it caches the answer after first run.
-bool IsVistaOrLater();
-
-// Is the user running on Vista or later with a split-token.
-HRESULT IsUserRunningSplitToken(bool* is_split_token);
-
-// Returns true if the user has a split token, or if the EnableLUA key is set
-// to 1. EnableLUA is only really effective after a reboot, and the value there
-// may not reflect the exact state of the running machine. So this function
-// needs to be used with care.
-bool IsUACMaybeOn();
-
-// Returns true if running at High integrity with UAC possibly enabled. As the
-// name indicates, UAC being on or off is not 100% accurate. So this function
-// needs to be used with care.
-bool IsElevatedWithUACMaybeOn();
-
-// Returns true if the process is running under credentials of an user
-// belonging to the admin group in case of pre-Vista and in case Vista
-// returns true if the user is running as an elevated admin.
-bool IsUserAdmin();
-
-// Returns true if the user is running as a non-elevated admin in case of
-// Vista. In case of XP always returns false.
-bool IsUserNonElevatedAdmin();
-
-// Determine the mandatory level of a process
-//   processID, the process to query, or (0) to use the current process
-//   On Vista, level should alwys be filled in with either
-//     MandatoryLevelLow (IE)
-//     MandatoryLevelMedium(user), or
-//     MandatoryLevelHigh( Elevated Admin)
-//   On error, level remains unchanged
-HRESULT GetProcessIntegrityLevel(DWORD processID, MANDATORY_LEVEL* level);
-
-// Elevated processes need to be careful how they launch child processes
-// to avoid having them inherit too many credentials or not being able to
-// elevate their own IE processes normally.  Microsoft's advice from
-// http://msdn.microsoft.com/library/en-us/ietechcol/dnwebgen/protectedmode.asp
-// will launch a low integrity IE, but that IE cannot elevate properly since
-// it was running from the wrong token. The best method I can gather is to find
-// an existing process on the machine running at normal user rights, and launch
-// this process impersonating that token rather than trying to adjust token
-// privileges of the elevated token.  TODO(omaha): Implement and test this.
-HRESULT CreateProcessAsNormalUserFromElevatedAdmin(const TCHAR* commandline,
-    STARTUPINFO* startup_info, PROCESS_INFORMATION* process_info);
-
-// Starts a new elevated process. file_path specifies the program to be run.
-// If exit_code is not null, the function waits until the spawned process has
-// completed. The exit code of the process is returned therein.
-// If exit_code is null, the function will return after spawning the program
-// and will not wait for completion.
-// show_window is one of the SW_* constants to specify how the window is
-// opened.
-HRESULT RunElevated(const TCHAR* file_path, const TCHAR* parameters,
-    int show_window, DWORD* exit_code);
-
-// If there is no specific integrity level defined, return S_FALSE (1) and set
-// level to MandatoryLevelMedium (the Vista default)
-HRESULT GetFileOrFolderIntegrityLevel(const TCHAR* file,
-    MANDATORY_LEVEL* level, bool* and_children);
-
-// A level of MandatoryLevelUntrusted (0) will remove the integrity level for
-// this file and all children
-HRESULT SetFileOrFolderIntegrityLevel(const TCHAR* file,
-    MANDATORY_LEVEL level, bool and_children);
-
-// If there is no specific integrity level defined, return S_FALSE (1) and set
-// level to MandatoryLevelMedium (the Vista default)
-// root must be one of the 4 pre-defined roots: HKLM, HKCU, HKCR, HCU
-HRESULT GetRegKeyIntegrityLevel(HKEY root, const TCHAR* subkey,
-    MANDATORY_LEVEL* level, bool* and_children);
-
-// A level of MandatoryLevelUntrusted (0) will remove the integrity label
-// root must be one of the 4 pre-defined roots: HKLM, HKCU, HKCR, HCU
-HRESULT SetRegKeyIntegrityLevel(HKEY root, const TCHAR* subkey,
-    MANDATORY_LEVEL level, bool and_children);
-
-// Creates a security descriptor that can be used to make an object accessible
-// from the specified integrity level. When not running on Windows Vista or
-// in case of errors, the function returns NULL, which results in using
-// the default security descriptor.
-// The caller must take ownership of the returned security descriptor.
-// Mask will be added as an allowed ACE of the DACL.
-// For example, use MUTEX_ALL_ACCESS for shared mutexes.
-CSecurityDesc* CreateLowIntegritySecurityDesc(ACCESS_MASK mask);
-CSecurityDesc* CreateMediumIntegritySecurityDesc(ACCESS_MASK mask);
-
-// For Vista or later, add the low integrity SACL to an existing CSecurityDesc.
-HRESULT AddLowIntegritySaclToExistingDesc(CSecurityDesc* sd);
-
-}  // namespace vista_util
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_VISTAUTIL_H_
-
diff --git a/base/vistautil_unittest.cc b/base/vistautil_unittest.cc
deleted file mode 100644
index 521c487..0000000
--- a/base/vistautil_unittest.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <shlobj.h>
-#include "omaha/base/reg_key.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace vista_util {
-
-TEST(VistaUtilTest, IsUserAdmin) {
-  bool is_admin = !!::IsUserAnAdmin();
-  EXPECT_EQ(is_admin, IsUserAdmin());
-}
-
-// Tests the code returns true if Vista or later.
-TEST(VistaUtilTest, IsUACMaybeOn) {
-  if (!IsVistaOrLater()) {
-    std::wcout << _T("\tSkipping test because not running on Vista or later.")
-               << std::endl;
-    return;
-  }
-
-  bool is_uac_maybe_on = false;
-
-  bool is_split_token = false;
-  if (SUCCEEDED(IsUserRunningSplitToken(&is_split_token)) && is_split_token) {
-    is_uac_maybe_on = true;
-  } else {
-    const TCHAR* key_name = _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\")
-                            _T("CurrentVersion\\Policies\\System");
-
-    DWORD enable_lua = 0;
-    is_uac_maybe_on =
-        FAILED(RegKey::GetValue(key_name, _T("EnableLUA"), &enable_lua)) ||
-        enable_lua;
-  }
-
-  EXPECT_EQ(is_uac_maybe_on, IsUACMaybeOn());
-}
-
-TEST(VistaUtilTest, IsElevatedWithUACMaybeOn) {
-  EXPECT_EQ(IsUserAdmin() && IsVistaOrLater() && IsUACMaybeOn(),
-            IsElevatedWithUACMaybeOn());
-}
-
-}  // namespace vista_util
-
-}  // namespace omaha
-
diff --git a/base/window_utils.cc b/base/window_utils.cc
deleted file mode 100644
index 0c9f49d..0000000
--- a/base/window_utils.cc
+++ /dev/null
@@ -1,147 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/window_utils.h"
-
-#include "base/basictypes.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/string.h"
-
-namespace omaha {
-
-namespace {
-
-struct FindProcessWindowsRecord {
-  uint32 process_id;
-  uint32 window_flags;
-  CSimpleArray<HWND>* windows;
-};
-
-BOOL CALLBACK FindProcessWindowsEnumProc(HWND hwnd, LPARAM lparam) {
-  FindProcessWindowsRecord* enum_record =
-      reinterpret_cast<FindProcessWindowsRecord*>(lparam);
-  ASSERT1(enum_record);
-
-  DWORD process_id = 0;
-  ::GetWindowThreadProcessId(hwnd, &process_id);
-
-  // Only count this window if it is in the right process
-  // and it satisfies all specified window requirements.
-  if (enum_record->process_id != process_id) {
-    return true;
-  }
-  if ((enum_record->window_flags & kWindowMustBeTopLevel) &&
-      ::GetParent(hwnd)) {
-    return true;
-  }
-
-  if ((enum_record->window_flags & kWindowMustHaveSysMenu) &&
-      !(GetWindowLong(hwnd, GWL_STYLE) & WS_SYSMENU)) {
-    return true;
-  }
-
-  if ((enum_record->window_flags & kWindowMustBeVisible) &&
-      !::IsWindowVisible(hwnd)) {
-    return true;
-  }
-
-  enum_record->windows->Add(hwnd);
-  return true;
-}
-
-}  // namespace
-
-bool WindowUtils::FindProcessWindows(uint32 process_id,
-                                     uint32 window_flags,
-                                     CSimpleArray<HWND>* windows) {
-  ASSERT1(windows);
-  windows->RemoveAll();
-  FindProcessWindowsRecord enum_record = {0};
-  enum_record.process_id = process_id;
-  enum_record.window_flags = window_flags;
-  enum_record.windows = windows;
-  ::EnumWindows(FindProcessWindowsEnumProc,
-                reinterpret_cast<LPARAM>(&enum_record));
-  int num_windows = enum_record.windows->GetSize();
-  return num_windows > 0;
-}
-
-void WindowUtils::MakeWindowForeground(HWND wnd) {
-  if (!IsWindowVisible(wnd)) {
-    // If the window is hidden and we call SetWindowPos with SWP_SHOWWINDOW
-    // then the window will be visible.
-    // If the caller wants it visible they should do it themselves first.
-    return;
-  }
-  if (!SetWindowPos(wnd,
-                    HWND_TOP,
-                    0,
-                    0,
-                    0,
-                    0,
-                    SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW)) {
-    UTIL_LOG(LE, (_T("[WindowUtils::MakeWindowForeground]")
-                  _T("[SetWindowPos failed][0x%08x]"), HRESULTFromLastError()));
-  }
-}
-
-bool WindowUtils::IsMainWindow(HWND wnd) {
-  return NULL == ::GetParent(wnd) && IsWindowVisible(wnd);
-}
-
-bool WindowUtils::HasSystemMenu(HWND wnd) {
-  return (GetWindowLong(wnd, GWL_STYLE) & WS_SYSMENU) != 0;
-}
-
-// The system displays the system large icon in the ALT+TAB dialog box.
-// We do not need any small icon in the window caption. However, setting
-// ICON_BIG has the side effect of the window displaying a scaled down
-// version of it in the window caption. We could not find any way to
-// hide that icon, including setting the icon to NULL or handling WM_GETICON
-// message.
-HRESULT WindowUtils::SetWindowIcon(HWND hwnd, WORD icon_id, HICON* hicon) {
-  ASSERT1(hwnd);
-  ASSERT1(hicon);
-  *hicon = NULL;
-
-  const int cx = ::GetSystemMetrics(SM_CXICON);
-  const int cy = ::GetSystemMetrics(SM_CYICON);
-  HINSTANCE exe_instance = static_cast<HINSTANCE>(::GetModuleHandle(NULL));
-  HICON icon = reinterpret_cast<HICON>(::LoadImage(exe_instance,
-                                                   MAKEINTRESOURCE(icon_id),
-                                                   IMAGE_ICON,
-                                                   cx,
-                                                   cy,
-                                                   LR_DEFAULTCOLOR));
-  if (!icon) {
-    HRESULT hr = HRESULTFromLastError();
-    CORE_LOG(LE, (_T("[SetWindowIcon - LoadImage failed][0x%x]"), hr));
-    return hr;
-  }
-
-  ::SendMessage(hwnd,
-                WM_SETICON,
-                ICON_BIG,
-                reinterpret_cast<LPARAM>(icon));
-  *hicon = icon;
-  return S_OK;
-}
-
-
-}  // namespace omaha
-
diff --git a/base/window_utils.h b/base/window_utils.h
deleted file mode 100644
index 798e066..0000000
--- a/base/window_utils.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#ifndef OMAHA_BASE_WINDOW_UTILS_H_
-#define OMAHA_BASE_WINDOW_UTILS_H_
-
-#include <atlcoll.h>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-// Flags for window requirements.
-const uint32 kWindowMustBeTopLevel  =  0x00000001;
-const uint32 kWindowMustHaveSysMenu =  0x00000002;
-const uint32 kWindowMustBeVisible   =  0x00000004;
-
-class WindowUtils {
- public:
-  // Finds all the primary windows owned by the given process. For the
-  // purposes of this function, primary windows are top-level, have a system
-  // menu, and are visible.
-  static bool FindProcessWindows(uint32 process_id,
-                                 uint32 window_flags,
-                                 CSimpleArray<HWND>* windows);
-
-  // Forces the window to the foreground.
-  static void MakeWindowForeground(HWND wnd);
-
-  // Returns true if the window is the "main window" of a process:
-  // if it's Visible, and Top Level
-  static bool IsMainWindow(HWND wnd);
-
-  // Returns true if the window has a System Menu
-  static bool HasSystemMenu(HWND wnd);
-
-  // Sets a window's icon to the specified icon embedded within the running exe
-  // module.
-  static HRESULT SetWindowIcon(HWND hwnd, WORD icon_id, HICON* hicon);
-
- private:
-  DISALLOW_IMPLICIT_CONSTRUCTORS(WindowUtils);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_WINDOW_UTILS_H_
diff --git a/base/wmi_query.cc b/base/wmi_query.cc
deleted file mode 100644
index a124262..0000000
--- a/base/wmi_query.cc
+++ /dev/null
@@ -1,204 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/base/wmi_query.h"
-
-#include <atlcomcli.h>
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-WmiQuery::WmiQuery() : at_end_(true) {
-}
-
-WmiQuery::~WmiQuery() {
-}
-
-HRESULT WmiQuery::Connect(const TCHAR* resource) {
-  UTIL_LOG(L6, (_T("[WmiQuery::Connect][resource=%s]"), resource));
-  ASSERT1(resource && *resource);
-
-  CComBSTR object_path;
-  HRESULT hr = object_path.Append(resource);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = wbem_.CoCreateInstance(__uuidof(WbemLocator));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Connect to WMI through the IWbemLocator::ConnectServer method. This
-  // call can block up to 2 minutes on XP or indefinitely on Windows 2000 if
-  // the server is broken.
-  hr = wbem_->ConnectServer(object_path,                      // object path
-                            NULL,                             // username
-                            NULL,                             // password
-                            NULL,                             // locale
-                            WBEM_FLAG_CONNECT_USE_MAX_WAIT,   // security flags
-                            NULL,                             // authority
-                            0,                                // context
-                            &service_);                       // namespace
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Set security levels on the proxy.
-  hr = ::CoSetProxyBlanket(service_,
-                           RPC_C_AUTHN_WINNT,
-                           RPC_C_AUTHZ_NONE,
-                           NULL,
-                           RPC_C_AUTHN_LEVEL_CALL,
-                           RPC_C_IMP_LEVEL_IMPERSONATE,
-                           NULL,
-                           EOAC_NONE);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT WmiQuery::Query(const TCHAR* query) {
-  UTIL_LOG(L6, (_T("[WmiQuery::Query][query=%s]"), query));
-  ASSERT1(query && *query);
-
-  CComBSTR query_language, query_string;
-  HRESULT hr = query_language.Append(_T("WQL"));
-  if (FAILED(hr)) {
-    return hr;
-  }
-  hr = query_string.Append(query);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  uint32 flags = WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY;
-  hr = service_->ExecQuery(query_language,
-                           query_string,
-                           flags,
-                           NULL,
-                           &enumerator_);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  at_end_ = false;
-  return Next();
-}
-
-HRESULT WmiQuery::Next() {
-  UTIL_LOG(L6, (_T("[WmiQuery::Next]")));
-
-  ASSERT1(!at_end_);
-
-  ULONG ret = 0;
-  HRESULT hr = enumerator_->Next(WBEM_INFINITE, 1, &obj_, &ret);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  at_end_ = ret == 0;
-  return S_OK;
-}
-
-bool WmiQuery::AtEnd() {
-  return at_end_;
-}
-
-HRESULT WmiQuery::GetValue(const TCHAR* name, CComVariant* value) {
-  ASSERT1(name && *name);
-  ASSERT1(value);
-  ASSERT1(!at_end_ && obj_);
-
-  value->Clear();
-
-  CComBSTR name_string;
-  HRESULT hr = name_string.Append(name);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  hr = obj_->Get(name_string, 0, value, 0, 0);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT WmiQuery::GetValue(const TCHAR* name, CString* value) {
-  ASSERT1(name && *name);
-  ASSERT1(value);
-
-  CComVariant var;
-  HRESULT hr = GetValue(name, &var);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  ASSERT1(V_VT(&var) == VT_BSTR);
-  value->SetString(var.bstrVal);
-  return S_OK;
-}
-
-HRESULT WmiQuery::GetValue(const TCHAR* name, bool* value) {
-  ASSERT1(name && *name);
-  ASSERT1(value);
-
-  CComVariant var;
-  HRESULT hr = GetValue(name, &var);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  ASSERT1(V_VT(&var) == VT_BOOL);
-  *value = var.boolVal != 0;
-  return S_OK;
-}
-
-HRESULT WmiQuery::GetValue(const TCHAR* name, int* value) {
-  ASSERT1(name && *name);
-  ASSERT1(value);
-
-  CComVariant var;
-  HRESULT hr = GetValue(name, &var);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  ASSERT1(V_VT(&var) == VT_I4);
-  *value = var.lVal;
-  return S_OK;
-}
-
-HRESULT WmiQuery::GetValue(const TCHAR* name, uint32* value) {
-  ASSERT1(name && *name);
-  ASSERT1(value);
-
-  CComVariant var;
-  HRESULT hr = GetValue(name, &var);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  ASSERT1(V_VT(&var) == VT_UI4);
-  *value = var.ulVal;
-  return S_OK;
-}
-
-}  // namespace omaha
-
diff --git a/base/wmi_query.h b/base/wmi_query.h
deleted file mode 100644
index c631056..0000000
--- a/base/wmi_query.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_WMI_QUERY_H_
-#define OMAHA_COMMON_WMI_QUERY_H_
-
-#include <windows.h>
-#include <wbemidl.h>
-#include <atlbase.h>
-#include <atlcomcli.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-class WmiQuery {
- public:
-  WmiQuery();
-  ~WmiQuery();
-
-  // Connects to the server to get WMI service.
-  HRESULT Connect(const TCHAR* resource);
-
-  // Queries the service.
-  HRESULT Query(const TCHAR* query);
-
-  // Reads the next row.
-  HRESULT Next();
-
-  // Returns true at the end.
-  bool AtEnd();
-
-  // Gets the value of the named property.
-  HRESULT GetValue(const TCHAR* name, CComVariant* value);
-  HRESULT GetValue(const TCHAR* name, CString* value);
-  HRESULT GetValue(const TCHAR* name, bool* value);
-  HRESULT GetValue(const TCHAR* name, int* value);
-  HRESULT GetValue(const TCHAR* name, uint32* value);
-
- private:
-  CComPtr<IWbemLocator> wbem_;
-  CComPtr<IWbemServices> service_;
-  CComPtr<IEnumWbemClassObject> enumerator_;
-  CComPtr<IWbemClassObject> obj_;
-  bool at_end_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(WmiQuery);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_WMI_QUERY_H_
-
diff --git a/base/wmi_query_unittest.cc b/base/wmi_query_unittest.cc
deleted file mode 100644
index acdf92a..0000000
--- a/base/wmi_query_unittest.cc
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/wmi_query.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(WmiQueryTest, WmiQuery) {
-  WmiQuery wq;
-  ASSERT_HRESULT_SUCCEEDED(wq.Connect(_T("root\\CIMV2")));
-  ASSERT_HRESULT_SUCCEEDED(wq.Query(_T("select * from Win32_OperatingSystem")));
-
-  CString manufacturer;
-  EXPECT_HRESULT_SUCCEEDED(wq.GetValue(_T("Manufacturer"), &manufacturer));
-  EXPECT_STREQ(_T("Microsoft Corporation"), manufacturer);
-
-  // Expect a retail build of the OS.
-  bool is_debug(true);
-  EXPECT_HRESULT_SUCCEEDED(wq.GetValue(_T("Debug"), &is_debug));
-  EXPECT_FALSE(is_debug);
-
-  int max_number_of_processes(0);
-  EXPECT_HRESULT_SUCCEEDED(wq.GetValue(_T("MaxNumberOfProcesses"),
-                           &max_number_of_processes));
-  EXPECT_EQ(-1, max_number_of_processes);
-}
-
-}  // namespace omaha
-
diff --git a/base/wtl_atlapp_wrapper.h b/base/wtl_atlapp_wrapper.h
deleted file mode 100644
index 17b0227..0000000
--- a/base/wtl_atlapp_wrapper.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Use this header instead of using WTL's atlapp.h directly.
-//
-// WTL80 uses deprecated _vswprintf calls which may be unsafe. Disables the
-// deprecation warning until WTL is fully compatible with VC 9.0.
-//
-// WTL80 uses min and max macros, which are disabled in the build. The work
-// around is to use std::min and std::max.
-
-#include <algorithm>
-using std::min;
-using std::max;
-
-#pragma warning(push)
-#pragma warning(disable : 4265 4996)
-// 4265: class has virtual functions, but destructor is not virtual
-// 4996: 'function' was declared deprecated
-
-#include <atlapp.h>
-
-#pragma warning(pop)
-
diff --git a/base/xml_utils.cc b/base/xml_utils.cc
deleted file mode 100644
index db7fe97..0000000
--- a/base/xml_utils.cc
+++ /dev/null
@@ -1,874 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// xml_utils.cpp
-//
-// Utilities for working with XML files via MSXML.
-
-#include "omaha/base/xml_utils.h"
-
-#include <msxml2.h>
-#include <atlsafe.h>
-#include <vector>
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-XMLFQName::XMLFQName() {}
-
-XMLFQName::XMLFQName(const TCHAR* u, const TCHAR* b)
-    : uri(u && ::_tcslen(u) ? u : 0),
-      base(b && ::_tcslen(b) ? b : 0) {}
-
-XMLFQName::~XMLFQName() {}
-
-HRESULT CoCreateSafeDOMDocument(IXMLDOMDocument** my_xmldoc) {
-  ASSERT1(my_xmldoc && !*my_xmldoc);
-  if (!my_xmldoc) {
-    UTIL_LOG(LE, (L"[CoCreateSafeDOMDocument E_INVALIDARG]"));
-    return E_INVALIDARG;
-  }
-  *my_xmldoc = NULL;
-  CComPtr<IXMLDOMDocument> xml_doc;
-  HRESULT hr = xml_doc.CoCreateInstance(__uuidof(DOMDocument2));
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[xml_doc.CoCreateInstance failed][0x%x]"), hr));
-    return hr;
-  }
-  ASSERT1(xml_doc);
-  hr = xml_doc->put_resolveExternals(VARIANT_FALSE);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[put_resolveExternals failed][0x%x]"), hr));
-    return hr;
-  }
-  *my_xmldoc = xml_doc.Detach();
-  return S_OK;
-}
-
-HRESULT LoadXMLFromFile(const TCHAR* xmlfile,
-                        bool preserve_whitespace,
-                        IXMLDOMDocument** xmldoc) {
-  ASSERT1(xmlfile);
-  ASSERT1(xmldoc);
-  ASSERT1(!*xmldoc);
-
-  *xmldoc = NULL;
-  CComPtr<IXMLDOMDocument> my_xmldoc;
-  HRESULT hr = CoCreateSafeDOMDocument(&my_xmldoc);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[CoCreateSafeDOMDocument failed][0x%x]"), hr));
-    return hr;
-  }
-  hr = my_xmldoc->put_preserveWhiteSpace(VARIANT_BOOL(preserve_whitespace));
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[put_preserveWhiteSpace failed][0x%x]"), hr));
-    return hr;
-  }
-  CComBSTR my_xmlfile(xmlfile);
-  VARIANT_BOOL is_successful(VARIANT_FALSE);
-  hr = my_xmldoc->load(CComVariant(my_xmlfile), &is_successful);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[my_xmldoc->load failed][0x%x]"), hr));
-    return hr;
-  }
-  if (!is_successful) {
-    CComPtr<IXMLDOMParseError> error;
-    CString error_message;
-    hr = GetXMLParseError(my_xmldoc, &error);
-    if (FAILED(hr)) {
-      UTIL_LOG(LE, (_T("[GetXMLParseError failed][0x%x]"), hr));
-      return hr;
-    }
-    ASSERT1(error);
-    HRESULT error_code = 0;
-    hr = InterpretXMLParseError(error, &error_code, &error_message);
-    if (FAILED(hr)) {
-      UTIL_LOG(LE, (_T("[InterpretXMLParseError failed][0x%x]"), hr));
-      return hr;
-    }
-    UTIL_LOG(LE, (L"[LoadXMLFromFile '%s'][parse error: %s]",
-                  xmlfile, error_message));
-    ASSERT1(FAILED(error_code));
-    return FAILED(error_code) ? error_code : CI_E_XML_LOAD_ERROR;
-  }
-  *xmldoc = my_xmldoc.Detach();
-  return S_OK;
-}
-
-HRESULT LoadXMLFromMemory(const TCHAR* xmlstring,
-                          bool preserve_whitespace,
-                          IXMLDOMDocument** xmldoc) {
-  ASSERT1(xmlstring);
-  ASSERT1(xmldoc);
-  ASSERT1(!*xmldoc);
-
-  *xmldoc = NULL;
-  CComPtr<IXMLDOMDocument> my_xmldoc;
-  RET_IF_FAILED(CoCreateSafeDOMDocument(&my_xmldoc));
-  RET_IF_FAILED(my_xmldoc->put_preserveWhiteSpace(
-                               VARIANT_BOOL(preserve_whitespace)));
-  CComBSTR xmlmemory(xmlstring);
-  VARIANT_BOOL is_successful(VARIANT_FALSE);
-  RET_IF_FAILED(my_xmldoc->loadXML(xmlmemory, &is_successful));
-  if (!is_successful) {
-    CComPtr<IXMLDOMParseError> error;
-    CString error_message;
-    RET_IF_FAILED(GetXMLParseError(my_xmldoc, &error));
-    ASSERT1(error);
-    HRESULT error_code = 0;
-    RET_IF_FAILED(InterpretXMLParseError(error, &error_code, &error_message));
-    UTIL_LOG(LE, (L"[LoadXMLFromMemory][parse error: %s]", error_message));
-    ASSERT1(FAILED(error_code));
-    return FAILED(error_code) ? error_code : CI_E_XML_LOAD_ERROR;
-  }
-  *xmldoc = my_xmldoc.Detach();
-  return S_OK;
-}
-
-HRESULT LoadXMLFromRawData(const std::vector<byte>& xmldata,
-                           bool preserve_whitespace,
-                           IXMLDOMDocument** xmldoc) {
-  ASSERT1(xmldoc);
-  ASSERT1(!*xmldoc);
-
-  *xmldoc = NULL;
-  if (!xmldata.size()) {
-    return E_INVALIDARG;
-  }
-
-  CComPtr<IXMLDOMDocument> my_xmldoc;
-  RET_IF_FAILED(CoCreateSafeDOMDocument(&my_xmldoc));
-  RET_IF_FAILED(my_xmldoc->put_preserveWhiteSpace(
-                              VARIANT_BOOL(preserve_whitespace)));
-
-  CComSafeArray<byte> xmlsa;
-  xmlsa.Add(xmldata.size(), &xmldata.front());
-  CComVariant xmlvar(xmlsa);
-
-  VARIANT_BOOL is_successful(VARIANT_FALSE);
-  RET_IF_FAILED(my_xmldoc->load(xmlvar, &is_successful));
-  if (!is_successful) {
-    CComPtr<IXMLDOMParseError> error;
-    CString error_message;
-    RET_IF_FAILED(GetXMLParseError(my_xmldoc, &error));
-    ASSERT1(error);
-    HRESULT error_code = 0;
-    RET_IF_FAILED(InterpretXMLParseError(error, &error_code, &error_message));
-    UTIL_LOG(LE, (_T("[LoadXMLFromRawData][parse error: %s]"), error_message));
-    ASSERT1(FAILED(error_code));
-    return FAILED(error_code) ? error_code : CI_E_XML_LOAD_ERROR;
-  }
-  *xmldoc = my_xmldoc.Detach();
-  return S_OK;
-}
-
-HRESULT SaveXMLToFile(IXMLDOMDocument* xmldoc, const TCHAR* xmlfile) {
-  ASSERT1(xmldoc);
-  ASSERT1(xmlfile);
-
-  CComBSTR my_xmlfile(xmlfile);
-  RET_IF_FAILED(xmldoc->save(CComVariant(my_xmlfile)));
-  return S_OK;
-}
-
-HRESULT SaveXMLToMemory(IXMLDOMDocument* xmldoc, CString* xmlstring) {
-  ASSERT1(xmldoc);
-  ASSERT1(xmlstring);
-
-  CComBSTR xmlmemory;
-  RET_IF_FAILED(xmldoc->get_xml(&xmlmemory));
-  *xmlstring = xmlmemory;
-
-  return S_OK;
-}
-
-HRESULT SaveXMLToRawData(IXMLDOMDocument* xmldoc, std::vector<byte>* buffer) {
-  ASSERT1(xmldoc);
-  ASSERT1(buffer);
-
-  CComPtr<IStream> stream;
-  HRESULT hr = ::CreateStreamOnHGlobal(NULL, TRUE, &stream);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  ASSERT1(stream);
-
-  hr = xmldoc->save(CComVariant(stream));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // To get the exact size of the stream, we have to use the seek function.
-  LARGE_INTEGER li = {0, 0};
-  ULARGE_INTEGER uli = {0, 0};
-  hr = stream->Seek(li, STREAM_SEEK_END, &uli);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  buffer->resize(static_cast<size_t>(uli.QuadPart));
-
-  HGLOBAL hglobal = NULL;
-  hr = ::GetHGlobalFromStream(stream, &hglobal);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  memcpy_s(&buffer->front(),
-           buffer->size(),
-           ::GlobalLock(hglobal),
-           buffer->size());
-  ::GlobalUnlock(hglobal);
-
-  return S_OK;
-}
-
-HRESULT CanonicalizeXML(const TCHAR* xmlstring, CString* canonical_xmlstring) {
-  ASSERT1(xmlstring);
-  ASSERT1(canonical_xmlstring);
-
-  // Round-trip through MSXML, having it strip whitespace.
-
-  CComPtr<IXMLDOMDocument> xmldoc;
-  RET_IF_FAILED(CoCreateSafeDOMDocument(&xmldoc));
-  RET_IF_FAILED(xmldoc->put_preserveWhiteSpace(VARIANT_FALSE));
-  {
-    CComBSTR xmlmemory(StringAfterBOM(xmlstring));
-    VARIANT_BOOL is_successful(VARIANT_FALSE);
-    RET_IF_FAILED(xmldoc->loadXML(xmlmemory, &is_successful));
-    if (!is_successful) {
-      CComPtr<IXMLDOMParseError> error;
-      CString error_message;
-      RET_IF_FAILED(GetXMLParseError(xmldoc, &error));
-      ASSERT1(error);
-      HRESULT error_code = 0;
-      RET_IF_FAILED(InterpretXMLParseError(error, &error_code, &error_message));
-      UTIL_LOG(LE, (L"[CanonicalizeXML][parse error: %s]", error_message));
-      ASSERT1(FAILED(error_code));
-      return FAILED(error_code) ? error_code : CI_E_XML_LOAD_ERROR;
-    }
-  }
-  std::vector<CString> lines;
-  {
-    CComBSTR xmlmemory2;
-    RET_IF_FAILED(xmldoc->get_xml(&xmlmemory2));
-    TextToLines(CString(xmlmemory2), L"\r\n", &lines);
-  }
-  {
-    for (size_t i = 0; i < lines.size(); ++i) {
-      TrimString(lines[i], L" \t");
-    }
-    LinesToText(lines, L"", canonical_xmlstring);
-  }
-
-  return S_OK;
-}
-
-bool operator==(const XMLFQName& u, const XMLFQName& v) {
-  if (u.uri && v.uri) {
-    // Both uris are non-null -> compare all the components.
-    return !_tcscmp(u.uri, v.uri) && !_tcscmp(u.base, v.base);
-  } else if (!u.uri && !v.uri) {
-    // Both uris are null -> only compare the base names.
-    return !_tcscmp(u.base ? u.base : __T(""), v.base ? v.base : __T(""));
-  } else {
-    // Either uri is null -> the names are in different namespaces.
-    return false;
-  }
-}
-
-bool operator!=(const XMLFQName& u, const XMLFQName& v) {
-  return !(u == v);
-}
-
-bool operator<(const XMLFQName& u, const XMLFQName &v) {
-  if (u.uri && v.uri) {
-    return (_tcscmp(u.uri, v.uri) < 0) ||
-            ((_tcscmp(u.uri, v.uri) == 0) && (_tcscmp(u.base, v.base) < 0));
-  } else if (!u.uri && !v.uri) {
-    return _tcscmp(u.base, v.base) < 0;
-  } else {
-    return false;
-  }
-}
-
-bool operator>(const XMLFQName& u, const XMLFQName& v) {
-  return v < u;
-}
-
-bool operator<=(const XMLFQName& u, const XMLFQName& v) {
-  return !(v < u);
-}
-
-bool operator>=(const XMLFQName& u, const XMLFQName& v) {
-  return !(u < v);
-}
-
-bool EqualXMLName(const XMLFQName& u, const XMLFQName& v) {
-  return u == v;
-}
-
-// msxml returns a null uri for nodes that don't belong to a namespace.
-bool EqualXMLName(IXMLDOMNode* pnode, const XMLFQName& u) {
-  CComBSTR name;
-  CComBSTR uri;
-  if (FAILED(pnode->get_baseName(&name)) ||
-      FAILED(pnode->get_namespaceURI(&uri))) {
-    return false;
-  }
-  return EqualXMLName(XMLFQName(uri, name), u);
-}
-
-inline bool EqualXMLName(const XMLFQName& u, IXMLDOMNode* pnode) {
-  return EqualXMLName(pnode, u);
-}
-
-HRESULT GetXMLFQName(IXMLDOMNode* node, XMLFQName* name) {
-  ASSERT1(node);
-  ASSERT1(name);
-
-  CComBSTR basename, uri;
-  RET_IF_FAILED(node->get_baseName(&basename));
-  RET_IF_FAILED(node->get_namespaceURI(&uri));
-  *name = XMLFQName(uri, basename);
-  return S_OK;
-}
-
-CString XMLFQNameToString(const XMLFQName& fqname) {
-  CString name;
-  if (fqname.uri) {
-    name += fqname.uri;
-    name += L":";
-  }
-  if (fqname.base) {
-    name += fqname.base;
-  }
-  return name;
-}
-
-CString NodeToString(IXMLDOMNode* pnode) {
-  ASSERT1(pnode);
-
-  XMLFQName node_name;
-  if (SUCCEEDED(GetXMLFQName(pnode, &node_name))) {
-    return XMLFQNameToString(node_name);
-  }
-  return L"";
-}
-
-HRESULT CreateXMLNode(IXMLDOMDocument* xmldoc,
-                      int node_type,
-                      const TCHAR* node_name,
-                      const TCHAR* namespace_uri,
-                      const TCHAR* text,
-                      IXMLDOMNode** node_out) {
-  ASSERT1(xmldoc);
-  ASSERT1(node_name);
-  // namespace_uri can be NULL
-  // text can be NULL
-  ASSERT1(node_out);
-  ASSERT1(!*node_out);
-
-  *node_out = NULL;
-  CComPtr<IXMLDOMNode> new_node;
-  CComBSTR node_name_string, namespace_uri_string;
-  RET_IF_FAILED(node_name_string.Append(node_name));
-  RET_IF_FAILED(namespace_uri_string.Append(namespace_uri));
-  RET_IF_FAILED(xmldoc->createNode(CComVariant(node_type),
-                                   node_name_string,
-                                   namespace_uri_string,
-                                   &new_node));
-  ASSERT1(new_node);
-
-  // If any text was supplied, put it in the node
-  if (text && text[0]) {
-    RET_IF_FAILED(new_node->put_text(CComBSTR(text)));
-  }
-
-  *node_out = new_node.Detach();
-  return S_OK;
-}
-
-HRESULT AppendXMLNode(IXMLDOMNode* xmlnode, IXMLDOMNode* new_child) {
-  ASSERT1(xmlnode);
-  ASSERT1(new_child);
-
-  CComPtr<IXMLDOMNode> useless;
-  RET_IF_FAILED(xmlnode->appendChild(new_child, &useless));
-  return S_OK;
-}
-
-HRESULT AppendXMLNode(IXMLDOMNode* xmlnode, const TCHAR* text) {
-  ASSERT1(xmlnode);
-  // text can be NULL
-
-  if (text && text[0]) {
-    CComPtr<IXMLDOMDocument> xml_doc;
-    CComPtr<IXMLDOMText> text_node;
-    RET_IF_FAILED(xmlnode->get_ownerDocument(&xml_doc));
-    ASSERT1(xml_doc);
-    RET_IF_FAILED(xml_doc->createTextNode(CComBSTR(text), &text_node));
-    RET_IF_FAILED(AppendXMLNode(xmlnode, text_node));
-  }
-  return S_OK;
-}
-
-HRESULT AddXMLAttributeNode(IXMLDOMNode* xmlnode, IXMLDOMAttribute* new_child) {
-  ASSERT1(xmlnode);
-  ASSERT1(new_child);
-
-  CComPtr<IXMLDOMNamedNodeMap> attributes;
-  CComPtr<IXMLDOMNode> useless;
-  RET_IF_FAILED(xmlnode->get_attributes(&attributes));
-  RET_IF_FAILED(attributes->setNamedItem(new_child, &useless));
-  return S_OK;
-}
-
-HRESULT AddXMLAttributeNode(IXMLDOMElement* xmlelement,
-                            const TCHAR* attribute_name,
-                            const TCHAR* attribute_value) {
-  ASSERT1(xmlelement);
-  ASSERT1(attribute_name);
-  // attribute_value can be NULL
-
-  RET_IF_FAILED(xmlelement->setAttribute(CComBSTR(attribute_name),
-                                         CComVariant(attribute_value)));
-  return S_OK;
-}
-
-HRESULT AddXMLAttributeNode(IXMLDOMNode* xmlnode,
-                            const TCHAR* attribute_namespace,
-                            const TCHAR* attribute_name,
-                            const TCHAR* attribute_value) {
-  ASSERT1(xmlnode);
-  ASSERT1(attribute_name);
-  // attribute_namespace can be NULL
-  // attribute_value can be NULL
-
-  CComPtr<IXMLDOMDocument> xmldoc;
-  RET_IF_FAILED(xmlnode->get_ownerDocument(&xmldoc));
-  ASSERT1(xmldoc);
-
-  CComPtr<IXMLDOMNode> attribute_node;
-  RET_IF_FAILED(CreateXMLNode(xmldoc,
-                              NODE_ATTRIBUTE,
-                              attribute_name,
-                              attribute_namespace,
-                              attribute_value,
-                              &attribute_node));
-  CComQIPtr<IXMLDOMAttribute> attribute(attribute_node);
-  ASSERT1(attribute);
-  RET_IF_FAILED(AddXMLAttributeNode(xmlnode, attribute));
-  return S_OK;
-}
-
-HRESULT RemoveXMLChildrenByName(IXMLDOMNode* xmlnode, const XMLFQName& name) {
-  ASSERT1(xmlnode);
-
-  CComPtr<IXMLDOMNodeList> node_list;
-  RET_IF_FAILED(xmlnode->get_childNodes(&node_list));
-  ASSERT1(node_list);
-
-  bool found = false;
-  do {
-    found = false;
-    long count = 0;   // NOLINT
-    RET_IF_FAILED(node_list->get_length(&count));
-    RET_IF_FAILED(node_list->reset());
-
-    for (int i = 0; i < count; ++i) {
-      CComPtr<IXMLDOMNode> child_node, useless;
-      RET_IF_FAILED(node_list->get_item(i, &child_node));
-      ASSERT1(child_node);
-      if (EqualXMLName(child_node, name)) {
-        RET_IF_FAILED(xmlnode->removeChild(child_node, &useless));
-        // Start loop over: the list is "alive" and changes when you remove a
-        // node from it. Yes this seems to be n^2 but in fact we expect at
-        // most one each of <Hash> and/or <Size> nodes.
-        found = true;
-        break;
-      }
-    }
-  } while (found);
-
-  return S_OK;
-}
-
-HRESULT GetXMLChildByName(IXMLDOMElement* xmlnode,
-                          const TCHAR* child_name,
-                          IXMLDOMNode** xmlchild) {
-  ASSERT1(xmlnode);
-  ASSERT1(child_name);
-  ASSERT1(xmlchild);
-  ASSERT1(!*xmlchild);
-
-  *xmlchild = NULL;
-  CComPtr<IXMLDOMNodeList> node_list;
-  long node_list_length = 0;    // NOLINT
-  RET_IF_FAILED(xmlnode->getElementsByTagName(CComBSTR(child_name),
-                                              &node_list));
-  ASSERT1(node_list);
-  RET_IF_FAILED(node_list->get_length(&node_list_length));
-  if (node_list_length <= 0) {
-    return HRESULT_FROM_WIN32(ERROR_NOT_FOUND);
-  }
-  // Should only be one child node with name we're looking for.
-  if (node_list_length > 1) {
-    return CI_E_INVALID_MANIFEST;
-  }
-  RET_IF_FAILED(node_list->reset());
-  RET_IF_FAILED(node_list->get_item(0, xmlchild));
-  ASSERT1(*xmlchild);
-  return S_OK;
-}
-
-HRESULT InsertXMLBeforeItem(IXMLDOMNode* xmlnode,
-                            IXMLDOMNode* new_child,
-                            size_t item_number) {
-  ASSERT1(xmlnode);
-  ASSERT1(new_child);
-
-  CComPtr<IXMLDOMNodeList> child_list;
-  CComPtr<IXMLDOMNode> refchild, useless;
-
-  RET_IF_FAILED(xmlnode->get_childNodes(&child_list));
-  ASSERT1(child_list);
-  RET_IF_FAILED(child_list->get_item(item_number, &refchild));
-  ASSERT1(refchild);
-  RET_IF_FAILED(xmlnode->insertBefore(new_child,
-                                      CComVariant(refchild),
-                                      &useless));
-  return S_OK;
-}
-
-HRESULT GetXMLParseError(IXMLDOMDocument* xmldoc,
-                         IXMLDOMParseError** parse_error) {
-  ASSERT1(xmldoc);
-  ASSERT1(parse_error);
-  ASSERT1(!*parse_error);
-
-  *parse_error = NULL;
-  CComPtr<IXMLDOMParseError> error;
-  RET_IF_FAILED(xmldoc->get_parseError(&error));
-  HRESULT error_code = 0;
-  HRESULT hr = error->get_errorCode(&error_code);
-  if (hr == S_OK) {
-    *parse_error = error.Detach();
-    return S_OK;
-  } else if (hr == S_FALSE) {
-    // No parse error
-    return S_FALSE;
-  } else {
-    return hr;
-  }
-}
-
-HRESULT InterpretXMLParseError(IXMLDOMParseError* parse_error,
-                               HRESULT* error_code,
-                               CString* message) {
-  ASSERT1(parse_error);
-  ASSERT1(error_code);
-  ASSERT1(message);
-
-  long line = 0;      // NOLINT
-  long char_pos = 0;  // NOLINT
-  CComBSTR src_text, reason;
-  RET_IF_FAILED(parse_error->get_errorCode(error_code));
-  RET_IF_FAILED(parse_error->get_line(&line));
-  RET_IF_FAILED(parse_error->get_linepos(&char_pos));
-  RET_IF_FAILED(parse_error->get_srcText(&src_text));
-  RET_IF_FAILED(parse_error->get_reason(&reason));
-
-  // Wild guess.
-  size_t size_estimate = src_text.Length() + reason.Length() + 100;
-
-  // TODO(omaha): think about replacing this call to _snwprintf with a
-  // safestring function.
-  std::vector<TCHAR> s(size_estimate);
-  _snwprintf_s(&s.front(), size_estimate, _TRUNCATE,
-               L"%d(%d) : error 0x%08lx: %s\n  %s",
-               line, char_pos, *error_code,
-               reason ? reason : L"",
-               src_text ? src_text : L"<no source text>");
-  // _snwprintf doesn't terminate the string with a null if
-  // the formatted string fills the entire buffer.
-  s[s.size()- 1] = L'\0';
-  *message = &s.front();
-  return S_OK;
-}
-
-HRESULT GetNumChildren(IXMLDOMNode* node, int* num_children) {
-  ASSERT1(node);
-  ASSERT1(num_children);
-
-  *num_children = 0;
-  CComPtr<IXMLDOMNodeList> children;
-  RET_IF_FAILED(node->get_childNodes(&children));
-  ASSERT1(children);
-
-  long len = 0;   // NOLINT
-  RET_IF_FAILED(children->get_length(&len));
-  *num_children = len;
-  return S_OK;
-}
-
-int GetNumAttributes(IXMLDOMNode* node) {
-  ASSERT1(node);
-
-  CComPtr<IXMLDOMNamedNodeMap> attr_map;
-  if (FAILED(node->get_attributes(&attr_map))) {
-    return 0;
-  }
-  ASSERT1(attr_map);
-  long len = 0;   // NOLINT
-  if (FAILED(attr_map->get_length(&len))) {
-    return 0;
-  }
-  return len;
-}
-
-bool HasAttribute(IXMLDOMNode* node, const TCHAR* attr_name) {
-  ASSERT1(node);
-  ASSERT1(attr_name);
-
-  CComPtr<IXMLDOMNamedNodeMap> attr_map;
-  if (FAILED(node->get_attributes(&attr_map))) {
-    return false;
-  }
-  if (!attr_map) {
-    return false;
-  }
-
-  CComBSTR temp_attr_name(attr_name);
-  CComPtr<IXMLDOMNode> attribute_node;
-  if (FAILED(attr_map->getNamedItem(static_cast<BSTR>(temp_attr_name),
-                                    &attribute_node))) {
-    return false;
-  }
-
-  return attribute_node != NULL;
-}
-
-HRESULT ReadBooleanAttribute(IXMLDOMNode* node,
-                             const TCHAR* attr_name,
-                             bool* value) {
-  CORE_LOG(L4, (_T("[ReadBooleanAttribute][%s]"), attr_name));
-  ASSERT1(node);
-  ASSERT1(attr_name);
-  ASSERT1(value);
-
-  CComBSTR node_value;
-  HRESULT hr = ReadAttribute(node, attr_name, &node_value);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[ReadAttribute failed][%s][0x%x]"), attr_name, hr));
-    return hr;
-  }
-
-  hr = String_StringToBool(static_cast<TCHAR*>(node_value),
-                           value);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[String_StringToBool failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT ReadIntAttribute(IXMLDOMNode* node,
-                         const TCHAR* attr_name,
-                         int* value) {
-  CORE_LOG(L4, (_T("[ReadIntAttribute][%s]"), attr_name));
-  ASSERT1(node);
-  ASSERT1(attr_name);
-  ASSERT1(value);
-
-  CComBSTR node_value;
-  HRESULT hr = ReadAttribute(node, attr_name, &node_value);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[ReadAttribute failed][%s][0x%x]"), attr_name, hr));
-    return hr;
-  }
-
-  if (!String_StringToDecimalIntChecked(
-          static_cast<const TCHAR*>(node_value), value)) {
-          return GOOPDATEXML_E_STRTOUINT;
-  }
-  return S_OK;
-}
-
-HRESULT ReadGuidAttribute(IXMLDOMNode* node,
-                          const TCHAR* attr_name,
-                          GUID* value) {
-  CORE_LOG(L4, (_T("[ReadGuidAttribute][%s]"), attr_name));
-  ASSERT1(node);
-  ASSERT1(attr_name);
-  ASSERT1(value);
-
-  CComBSTR node_value;
-  HRESULT hr = ReadAttribute(node, attr_name, &node_value);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[ReadAttribute failed][%s][0x%x]"), attr_name, hr));
-    return hr;
-  }
-
-  hr = StringToGuidSafe(static_cast<TCHAR*>(node_value), value);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[StringToGuidSafe failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT ReadStringAttribute(IXMLDOMNode* node,
-                            const TCHAR* attr_name,
-                            CString* value) {
-  CORE_LOG(L4, (_T("[ReadStringAttribute][%s]"), attr_name));
-  ASSERT1(node);
-  ASSERT1(attr_name);
-  ASSERT1(value);
-
-  CComBSTR node_value;
-  HRESULT hr = ReadAttribute(node, attr_name, &node_value);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[ReadAttribute failed][%s][0x%x]"), attr_name, hr));
-    return hr;
-  }
-
-  // Will extract the underlying string.
-  *value = static_cast<TCHAR*>(node_value);
-
-  return S_OK;
-}
-
-HRESULT ReadAttribute(IXMLDOMNode* node,
-                      const TCHAR* attr_name,
-                      BSTR* value) {
-  CORE_LOG(L4, (_T("[ReadAttribute][%s]"), attr_name));
-  ASSERT1(node);
-  ASSERT1(attr_name);
-  ASSERT1(value);
-
-  // First read the attributes.
-  CComPtr<IXMLDOMNamedNodeMap> attributes;
-  HRESULT hr = node->get_attributes(&attributes);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[get_attributes failed][0x%x]"), hr));
-    return hr;
-  }
-
-  if (!attributes) {
-    CORE_LOG(LE, (_T("[Msxml S_FALSE return]")));
-    return E_FAIL;  // Protect against msxml S_FALSE return.
-  }
-
-  CComPtr<IXMLDOMNode> attribute_node;
-  CComVariant node_value;
-  CComBSTR temp_attr_name(attr_name);
-
-  // Get the attribute using a named node.
-  hr = attributes->getNamedItem(static_cast<BSTR>(temp_attr_name),
-                                &attribute_node);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[getNamedItem failed][0x%x]"), hr));
-    return hr;
-  }
-
-  if (!attribute_node) {
-    CORE_LOG(LE, (_T("[Msxml S_FALSE return]")));
-    return E_FAIL;  // Protect against msxml S_FALSE return.
-  }
-
-  hr = attribute_node->get_nodeValue(&node_value);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[get_nodeValue failed][0x%x]"), hr));
-    return hr;
-  }
-
-  if (node_value.vt == VT_EMPTY) {
-    CORE_LOG(LE, (_T("[node_value.vt == VT_EMPTY]")));
-    return E_FAIL;
-  }
-
-  // Extract the variant into a BSTR.
-  node_value.CopyTo(value);
-
-  return S_OK;
-}
-
-HRESULT ReadStringValue(IXMLDOMNode* node, CString* value) {
-  CORE_LOG(L4, (_T("[ReadStringValue]")));
-  ASSERT1(node);
-  ASSERT1(value);
-
-  CComPtr<IXMLDOMNodeList> child_nodes;
-  HRESULT hr = node->get_childNodes(&child_nodes);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[get_childNodes failed][0x%x]"), hr));
-    return hr;
-  }
-  if (!child_nodes) {
-    CORE_LOG(LE, (_T("[Msxml S_FALSE return]")));
-    return E_FAIL;  // Protect against msxml S_FALSE return.
-  }
-
-  long count = 0;  // NOLINT
-  hr = child_nodes->get_length(&count);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  ASSERT(count == 1, (_T("count: %u"), count));
-  CComPtr<IXMLDOMNode> child_node;
-  hr = child_nodes->nextNode(&child_node);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  DOMNodeType type = NODE_INVALID;
-  hr = child_node->get_nodeType(&type);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[get_nodeType failed][0x%x]"), hr));
-    return hr;
-  }
-
-  if (type != NODE_TEXT) {
-    CORE_LOG(LE, (_T("[Invalid nodeType][%d]"), type));
-    return E_INVALIDARG;
-  }
-
-  CComVariant node_value;
-  hr = child_node->get_nodeValue(&node_value);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[get_nodeValue failed][0x%x]"), hr));
-    return hr;
-  }
-
-  if (node_value.vt != VT_BSTR) {
-    CORE_LOG(LE, (_T("[node_value.vt != VT_BSTR][%d]"), node_value.vt));
-    return E_INVALIDARG;
-  }
-
-  *value = V_BSTR(&node_value);
-  return S_OK;
-}
-
-}  // namespace omaha
-
diff --git a/base/xml_utils.h b/base/xml_utils.h
deleted file mode 100644
index b67bef8..0000000
--- a/base/xml_utils.h
+++ /dev/null
@@ -1,288 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// xml_utils.h
-//
-// Utilities for working with XML files via MSXML.
-
-#ifndef OMAHA_BASE_XML_UTILS_H_
-#define OMAHA_BASE_XML_UTILS_H_
-
-#include <windows.h>
-#include <objbase.h>
-#include <msxml.h>
-#include <atlstr.h>
-#include <utility>
-#include <vector>
-
-namespace omaha {
-
-// Creates a DOMDocument that disallows external definitions to be included and
-// resolved as part of the XML document stream at parse time.
-HRESULT CoCreateSafeDOMDocument(IXMLDOMDocument** my_xmldoc);
-
-// xmlfile can be any specified encoding.
-HRESULT LoadXMLFromFile(const TCHAR* xmlfile,
-                        bool preserve_whitespace,
-                        IXMLDOMDocument** xmldoc);
-
-// xmlstring must be UTF-16 or UCS-2.
-HRESULT LoadXMLFromMemory(const TCHAR* xmlstring,
-                          bool preserve_whitespace,
-                          IXMLDOMDocument** xmldoc);
-
-// xmldata can be any raw data supported by xml parser
-HRESULT LoadXMLFromRawData(const std::vector<byte>& xmldata,
-                           bool preserve_whitespace,
-                           IXMLDOMDocument** xmldoc);
-
-// xmlfile is in encoding specified in the XML document.
-HRESULT SaveXMLToFile(IXMLDOMDocument* xmldoc, const TCHAR * xmlfile);
-
-// xmlstring is in UCS-2
-HRESULT SaveXMLToMemory(IXMLDOMDocument* xmldoc, CString* xmlstring);
-
-// buffer is in the encoding specified in the XML document.
-HRESULT SaveXMLToRawData(IXMLDOMDocument* xmldoc, std::vector<byte>* buffer);
-
-// Canonicalizes the XML string so you can compute a signature on it.
-// This is not the official canonicalization but a cheaper scheme which
-// depends on the whitespace stripping capability of MSXML.
-//
-// xmlstring is in UTF-16 or UCS-2
-HRESULT CanonicalizeXML(const TCHAR* xmlstring, CString* canonical_xmlstring);
-
-
-// Dealing with element/attribute names: the combination of a base name
-// and a namespace URI is a fully-qualified XML name, or: XMLFQName.
-
-// We can't just typedef a std::pair because we need proper comparison operators
-// in case we want to stick a XMLFQName into a standard collection.
-struct XMLFQName {
-  XMLFQName();
-  XMLFQName(const TCHAR* u, const TCHAR* b);
-  ~XMLFQName();
-
-  CString uri;
-  CString base;
-};
-
-bool operator==(const XMLFQName& u, const XMLFQName& v);
-bool operator!=(const XMLFQName& u, const XMLFQName& v);
-bool operator< (const XMLFQName& u, const XMLFQName& v);
-bool operator> (const XMLFQName& u, const XMLFQName& v);
-bool operator<=(const XMLFQName& u, const XMLFQName& v);
-bool operator>=(const XMLFQName& u, const XMLFQName& v);
-
-bool EqualXMLName(const XMLFQName& u, const XMLFQName& v);
-bool EqualXMLName(IXMLDOMNode* pnode, const XMLFQName& u);
-bool EqualXMLName(const XMLFQName& u, IXMLDOMNode* pnode);
-
-// Returns the FQ name from the node.
-HRESULT GetXMLFQName(IXMLDOMNode* node, XMLFQName* name);
-
-// Returns a string version of an XMLFQName suitable for debugging use.
-CString XMLFQNameToString(const XMLFQName& fqname);
-
-// Returns a string version of a node's name suitable for debugging use.
-CString NodeToString(IXMLDOMNode* pnode);
-
-//
-// Routines for dealing with fragments of DOM trees.
-//
-// Creates an XMLDOMNode of the given type with a given name and optional text.
-HRESULT CreateXMLNode(IXMLDOMDocument* xmldoc,
-                      int node_type,
-                      const TCHAR* node_name,
-                      const TCHAR* namespace_uri,
-                      const TCHAR* text,
-                      IXMLDOMNode** node_out);
-
-// Adds newchild as a child node of xmlnode after all existing children.
-HRESULT AppendXMLNode(IXMLDOMNode* xmlnode, IXMLDOMNode* new_child);
-
-// Adds text as a child node of xmlnode after all existing children.
-HRESULT AppendXMLNode(IXMLDOMNode* xmlnode, const TCHAR* text);
-
-// Adds newchild as an attribute node of xmlnode replacing existing
-// attribute with same name.
-HRESULT AddXMLAttributeNode(IXMLDOMNode* xmlnode, IXMLDOMAttribute* new_child);
-
-// Adds name/value pair as an attribute node of xmlnode replacing
-// existing attribute with same name.
-HRESULT AddXMLAttributeNode(IXMLDOMElement* xmlelement,
-                            const TCHAR* attribute_name,
-                            const TCHAR* attribute_value);
-
-// Adds name/value pair as an attribute node of xmlnode replacing
-// existing attribute with same name.
-// Can add attributes to nodes other than IXMLDOMElement.
-// Can add attributes with non-null namespaces.
-HRESULT AddXMLAttributeNode(IXMLDOMNode* xmlnode,
-                            const TCHAR* attribute_namespace,
-                            const TCHAR* attribute_name,
-                            const TCHAR* attribute_value);
-
-// Removes all children of the given node that have the specified name.
-HRESULT RemoveXMLChildrenByName(IXMLDOMNode* xmlnode, const XMLFQName& name);
-
-// Gets a child of a given node by name
-HRESULT GetXMLChildByName(IXMLDOMElement* xmlnode,
-                          const TCHAR* child_name,
-                          IXMLDOMNode** xmlchild);
-
-// Adds newchild as a child node of xmlnode, before the exiting
-// child item_number.
-HRESULT InsertXMLBeforeItem(IXMLDOMNode* xmlnode,
-                            IXMLDOMNode* new_child,
-                            size_t item_number);
-
-// Gets parse error information after a failed load.
-HRESULT GetXMLParseError(IXMLDOMDocument* xmldoc,
-                         IXMLDOMParseError** parse_error);
-
-// Interprets parse error.
-HRESULT InterpretXMLParseError(IXMLDOMParseError* parse_error,
-                               HRESULT* error_code,
-                               CString* message);
-
-// Gets the number of children of this node.
-HRESULT GetNumChildren(IXMLDOMNode* pnode, int* num_children);
-
-// Gets the number of attributes of this node.
-int GetNumAttributes(IXMLDOMNode* pnode);
-
-// Returns true if the specified attribute is in this node.
-bool HasAttribute(IXMLDOMNode* node, const TCHAR* attr_name);
-
-// Reads and parses attributes of nodes.
-HRESULT ReadBooleanAttribute(IXMLDOMNode* node,
-                             const TCHAR* attr_name,
-                             bool* value);
-HRESULT ReadIntAttribute(IXMLDOMNode* node,
-                         const TCHAR* attr_name,
-                         int* value);
-HRESULT ReadGuidAttribute(IXMLDOMNode* node,
-                          const TCHAR* attr_name,
-                          GUID* value);
-HRESULT ReadStringAttribute(IXMLDOMNode* node,
-                            const TCHAR* attr_name,
-                            CString* value);
-
-// Reads an attribute as a BSTR, given the node and the name of the attribute.
-// This is a helper for the other ReadXXXAttribute methods.
-HRESULT ReadAttribute(IXMLDOMNode* node,
-                      const TCHAR* attr_name,
-                      BSTR* value);
-
-// Reads the string value of a node element, either TEXT or CDATA.
-HRESULT ReadStringValue(IXMLDOMNode* node, CString* value);
-
-// Maps over a list of XML DOM nodes of some kind, executing a function or
-// a member function against each node in the list.
-// Passes a cookie along to each function call useful for accumulating results.
-// Template class List is usually a IXMLDOMNodeList or a IXMLDOMNamedNodeMap.
-template <class List, class Cookie>
-HRESULT ForEachNodeInList(List list,
-                          HRESULT (*fun)(IXMLDOMNode*, Cookie),
-                          Cookie cookie) {
-  ASSERT1(list);  // List assumed to be a pointer type or smart pointer type
-  ASSERT1(fun);
-
-  long len = 0;   // NOLINT
-  RET_IF_FAILED(list->get_length(&len));
-  for (long i = 0; i != len; ++i) {   // NOLINT
-    CComPtr<IXMLDOMNode> node;
-    RET_IF_FAILED(list->get_item(i, &node));
-    ASSERT1(node);
-    RET_IF_FAILED(fun(node, cookie));
-  }
-  return S_OK;
-}
-
-// Same as ForEachNodeInList but it calls a member function of an object.
-template <class List, class Object, class Cookie>
-HRESULT ForEachNodeInListObj(List list,
-                             Object* object,
-                             HRESULT (Object::*mem_fun)(IXMLDOMNode*, Cookie),
-                             Cookie cookie) {
-  ASSERT1(list);
-  ASSERT1(object);
-  ASSERT1(fun);
-
-  long len = 0;   // NOLINT
-  RET_IF_FAILED(list->get_length(&len));
-  for (long i = 0; i != len; ++i) {   // NOLINT
-    CComPtr<IXMLDOMNode> node;
-    RET_IF_FAILED(list->get_item(i, &node));
-    ASSERT1(node);
-    RET_IF_FAILED((object->*fun)(node, cookie));
-  }
-  return S_OK;
-}
-
-// Maps over the attributes of a node, executing a function against each
-// attribute. Passes a cookie along to each function call.
-template <typename Cookie>
-HRESULT ForEachAttribute(IXMLDOMNode* node,
-                         HRESULT (*fun)(IXMLDOMNode*, Cookie),
-                         Cookie cookie) {
-  ASSERT1(node);
-  ASSERT1(fun);
-
-  CComPtr<IXMLDOMNamedNodeMap> attr_list;
-  RET_IF_FAILED(node->get_attributes(&attr_list));
-  ASSERT1(attr_list);
-  RET_IF_FAILED(ForEachNodeInList(attr_list, fun, cookie));
-  return S_OK;
-}
-
-// Maps over the children nodes of a node, executing a function against
-// each child node. Passes a cookie along to each function call.
-template <typename Cookie>
-HRESULT ForEachChildNode(IXMLDOMNode* node,
-                         HRESULT (*fun)(IXMLDOMNode*, Cookie),
-                         Cookie cookie) {
-  ASSERT1(node);
-  ASSERT1(fun);
-
-  CComPtr<IXMLDOMNodeList> child_list;
-  RET_IF_FAILED(node->get_childNodes(&child_list));
-  ASSERT1(child_list);
-  RET_IF_FAILED(ForEachNodeInList(child_list, fun, cookie));
-  return S_OK;
-}
-
-// Same as ForEachChildNode but it calls a member function of an object.
-template <typename Object, typename Cookie>
-HRESULT ForEachChildNodeObj(IXMLDOMNode* node,
-                            Object* object,
-                            HRESULT (Object::*mem_fun)(IXMLDOMNode*, Cookie),
-                            Cookie cookie) {
-  ASSERT1(node);
-  ASSERT1(object);
-  ASSERT1(fun);
-
-  CComPtr<IXMLDOMNodeList> child_list;
-  RET_IF_FAILED(node->get_childNodes(&child_list));
-  ASSERT1(child_list);
-  RET_IF_FAILED(ForEachNodeInListObj(child_list, object, mem_fun, cookie));
-  return S_OK;
-}
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_XML_UTILS_H_
-
diff --git a/base/xml_utils_unittest.cc b/base/xml_utils_unittest.cc
deleted file mode 100644
index 0e7d865..0000000
--- a/base/xml_utils_unittest.cc
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-#include <atlstr.h>
-#include <vector>
-#include "omaha/base/file.h"
-#include "omaha/base/module_utils.h"
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/xml_utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-const TCHAR kTestXMLFile[] = _T("manifest.xml");
-const TCHAR kTempXMLFile[] = _T("foobar.xml");
-
-const XMLFQName fqLowNoURI(NULL, _T("Bar"));
-const XMLFQName fqLowNoURI2(NULL, _T("Bar"));
-const XMLFQName fqHighNoURI(NULL, _T("Foo"));
-const XMLFQName fqLowURI(_T("Zebra"), _T("Bar"));
-const XMLFQName fqLowURI2(_T("Zebra"), _T("Bar"));
-const XMLFQName fqHighURI(_T("Zebra"), _T("Foo"));
-const XMLFQName fqDifferentURI(_T("Xray"), _T("Bar"));
-
-TEST(XmlUtilsTest, XMLFQName) {
-  ASSERT_TRUE(fqLowNoURI == fqLowNoURI2);
-  ASSERT_TRUE(fqHighNoURI == fqHighNoURI);
-  ASSERT_TRUE(fqLowNoURI != fqHighNoURI);
-  ASSERT_TRUE(fqLowNoURI != fqLowURI);
-  ASSERT_TRUE(fqLowNoURI < fqHighNoURI);
-  ASSERT_TRUE(fqLowNoURI <= fqHighNoURI);
-  ASSERT_TRUE(fqHighNoURI > fqLowNoURI);
-  ASSERT_TRUE(fqHighNoURI >= fqLowNoURI);
-  ASSERT_TRUE(fqLowURI == fqLowURI2);
-  ASSERT_TRUE(fqHighURI == fqHighURI);
-  ASSERT_TRUE(fqLowURI != fqHighURI);
-  ASSERT_TRUE(fqLowURI < fqHighURI);
-  ASSERT_TRUE(fqLowURI <= fqHighURI);
-  ASSERT_TRUE(fqHighURI > fqLowURI);
-  ASSERT_TRUE(fqHighURI >= fqLowURI);
-  ASSERT_TRUE(fqLowURI != fqDifferentURI);
-}
-
-TEST(XmlUtilsTest, LoadSave) {
-  scoped_co_init co_init;
-
-  // Get some directory and file names to start with.
-  TCHAR directory[MAX_PATH] = {0};
-  ASSERT_TRUE(GetModuleDirectory(NULL, directory));
-  CString test_file;
-  test_file.Format(_T("%s\\unittest_support\\%s"), directory, kTestXMLFile);
-
-  TCHAR temp_path[MAX_PATH] = {0};
-  ASSERT_TRUE(::GetTempPath(MAX_PATH, temp_path));
-  CString temp_file;
-  temp_file.AppendFormat(_T("%s%s"), temp_path, kTempXMLFile);
-
-  // Test loading and storing to a file.
-  CComPtr<IXMLDOMDocument> xmldoc;
-  ASSERT_SUCCEEDED(LoadXMLFromFile(test_file, true, &xmldoc));
-  ASSERT_TRUE(xmldoc);
-  ASSERT_SUCCEEDED(SaveXMLToFile(xmldoc, temp_file));
-
-  // Test loading and storing raw UTF8 data to memory.
-  std::vector<byte> buffer_utf8;
-  ASSERT_SUCCEEDED(ReadEntireFile(temp_file, 0, &buffer_utf8));
-
-  CComPtr<IXMLDOMDocument> xmldoc2;
-  ASSERT_SUCCEEDED(LoadXMLFromRawData(buffer_utf8, true, &xmldoc2));
-  ASSERT_TRUE(xmldoc2);
-  std::vector<byte> xml_utf8;
-  ASSERT_SUCCEEDED(SaveXMLToRawData(xmldoc2, &xml_utf8));
-
-  CStringA input_utf8(reinterpret_cast<char*>(&buffer_utf8.front()),
-                      buffer_utf8.size());
-  CStringA output_utf8(reinterpret_cast<char*>(&xml_utf8.front()),
-                       xml_utf8.size());
-  ASSERT_STREQ(input_utf8, output_utf8);
-
-  // Test loading and storing Unicode to memory.
-  // The input must be Unicode for the calls below, but our test file is UTF-8.
-  // So read it and convert it to Unicode.
-  int len(::MultiByteToWideChar(CP_UTF8,
-                                0, /*flags*/
-                                reinterpret_cast<const char*>(&buffer_utf8[0]),
-                                buffer_utf8.size(),
-                                NULL,
-                                0));
-  std::vector<wchar_t> buffer_unicode(len+1);
-  int len2(::MultiByteToWideChar(CP_UTF8,
-                                 0, /*flags*/
-                                 reinterpret_cast<const char*>(&buffer_utf8[0]),
-                                 buffer_utf8.size(),
-                                 &buffer_unicode[0],
-                                 len));
-  ASSERT_EQ(len, len2);
-  buffer_unicode[len] = 0;  // null terminate the unicode string.
-
-  // Now round-trip the load from memory and save to memory.
-  xmldoc2 = NULL;
-  ASSERT_SUCCEEDED(LoadXMLFromMemory(&buffer_unicode.front(), true, &xmldoc2));
-  ASSERT_TRUE(xmldoc2);
-  CString xmlmemory;
-  ASSERT_SUCCEEDED(SaveXMLToMemory(xmldoc2, &xmlmemory));
-
-  // Now compare that the result of the round-trip is the same as the input.
-  CString input(&buffer_unicode.front());
-  CString output(xmlmemory);
-  // Except must first remove the " encoding="UTF-8"" attribute from the
-  // input string.
-  ReplaceCString(input, L" encoding=\"UTF-8\"", L"");
-  ASSERT_STREQ(input, output);
-
-  // Clean up.
-  ASSERT_SUCCEEDED(File::Remove(temp_file));
-}
-
-}  // namespace omaha
-
diff --git a/build.scons b/build.scons
deleted file mode 100644
index 32c8509..0000000
--- a/build.scons
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-
-Import('env')
-
-env.Replicate('$STAGING_DIR', '$MAIN_DIR/VERSION')
diff --git a/clickonce/add_trusturlparams.py b/clickonce/add_trusturlparams.py
deleted file mode 100644
index 18a7357..0000000
--- a/clickonce/add_trusturlparams.py
+++ /dev/null
@@ -1,106 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2008-2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-"""
-mage.exe does not provide a way to add the trustURLParameters attribute to an
-application manifest. This script fills that gap. It also adds in the
-localized display name, to get around issues with the Python commands
-module.
-"""
-
-import sys
-import os
-import getopt
-import commands
-
-
-def _AddTrustURLParametersAndName(manifest_file, output_file, display_name):
-  f_in = open(manifest_file, 'r')
-  manifest_contents = f_in.read()
-  f_in.close()
-
-  manifest_contents = manifest_contents.replace('<deployment ', \
-      '<deployment trustURLParameters="true" ')
-  manifest_contents = manifest_contents.replace('\"xxxXXXxxx', \
-      '\"%s' % display_name)
-
-  f_out = open(output_file, 'w')
-  # Works without needing to write the codecs.BOM_UTF8 at the beginning of the
-  # file. May need to write this at some point though.
-  f_out.write(manifest_contents)
-  f_out.close()
-
-
-def _Usage():
-  """Prints out script usage information."""
-  print """
-add_trusturlparams.py: Modify the given manifest file by adding in a
-trustURLParameters=true to the deployment section. Also substitutes
-the dummy name xxxXXXxxx with the localized display name.
-
-Usage:
-  add_trusturlparams.py [--help
-                         | --manifest_file filename
-                         | --output_file filename
-                           --display_name {i18n display name}]
-
-Options:
-  --help                    Show this information.
-  --manifest_file filename     Path/name of input/output manifest file.
-  --output_file filename       Path/name of an optional output manifest file.
-  --display_name  name         i18n display name.
-"""
-
-
-def _Main():
-  # use getopt to parse the option and argument list; this may raise, but
-  # don't catch it
-  _ARGUMENT_LIST = ["help", "manifest_file=", "output_file=", "display_name="]
-  (opts, args) = getopt.getopt(sys.argv[1:], "", _ARGUMENT_LIST)
-  if not opts or ("--help", "") in opts:
-    _Usage()
-    sys.exit()
-
-  manifest_file = ""
-  output_file = ""
-  display_name = ""
-
-  for (o, v) in opts:
-    if o == "--manifest_file":
-      manifest_file = v
-    if o == "--output_file":
-      output_file = v
-    if o == "--display_name":
-      display_name = v
-
-  # make sure we have work to do
-  if not manifest_file:
-    raise SystemExit("no manifest_filename specified")
-  if not display_name:
-    raise SystemExit("no display_name specified")
-
-  # overwrite existing file if no separate output specified
-  if not output_file:
-    output_file = manifest_file
-
-  _AddTrustURLParametersAndName(manifest_file, output_file, display_name)
-  sys.exit()
-
-
-if __name__ == "__main__":
-  _Main()
-
diff --git a/clickonce/build.scons b/clickonce/build.scons
deleted file mode 100644
index 7453dcf..0000000
--- a/clickonce/build.scons
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-# Note: The localized ClickOnce deployment manifest is generated in
-# installers/build.scons.
-
-
-Import('env')
-
-clickonce_name = 'clickonce_bootstrap'
-clickonce_binary = clickonce_name + '.exe'
-clickonce_res = clickonce_name + '.res'
-
-
-#
-# Build the .res file.
-#
-env.RES(target=clickonce_res, source='clickonce_bootstrap.rc')
-
-
-#
-# Generate the executable.
-#
-exe_action = 'csc.exe /target:winexe /platform:x86 /out:$TARGET /win32res:%s '\
-    '$SOURCES' % (env.File(clickonce_res).path)
-
-exe_output = env.Command(
-    target=clickonce_binary,
-    source='clickonce_bootstrap.cs',
-    action=exe_action
-)
-
-# Inform Hammer that the .res file must be built before the executeable
-env.Requires(exe_output, clickonce_res)
-
-clickonce_deploy_dir = '$TARGET_ROOT/Clickonce_Deployment'
-clickonce_deploy_bin_dir = clickonce_deploy_dir + '/bin'
-
-# Copy executable into Clickonce deployment directory.
-replicate_output = env.Replicate(clickonce_deploy_bin_dir, exe_output)
-
-
-#
-# Generate the application manifest.
-#
-
-omaha_versions_info = env['omaha_versions_info']
-version_string = omaha_versions_info[0].GetVersionString()
-
-generate_manifest_action = ('@mage -New Application -ToFile $TARGET -Name %s'
-    ' -Version %s -FromDirectory %s -Processor x86 -TrustLevel FullTrust' % (
-    clickonce_name, version_string, env.Dir(clickonce_deploy_bin_dir).abspath))
-
-unsigned_manifest = env.Command(
-    target=clickonce_binary + '.manifest',
-    source=replicate_output,
-    action=generate_manifest_action
-)
-
-# Sign the application manifest.
-manifest_target = '%s/%s.manifest' % (clickonce_deploy_dir, clickonce_binary)
-signed_manifest = env.SignDotNetManifest(manifest_target, unsigned_manifest)
-
-
-# Instruct Hammer to regenerate the manifests when either of these
-# executables change
-env.Depends(
-    target = [
-        unsigned_manifest,
-        signed_manifest,
-        ],
-    dependency = [
-        '%s/%s' % (clickonce_deploy_bin_dir, clickonce_binary),
-        '%s/GoogleUpdateSetup.exe' % (clickonce_deploy_bin_dir),
-        ]
-)
diff --git a/clickonce/clickonce_bootstrap.cs b/clickonce/clickonce_bootstrap.cs
deleted file mode 100644
index 4a48eb1..0000000
--- a/clickonce/clickonce_bootstrap.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// C# stub that allows a ClickOnce install of an Omaha application.
-
-using System;
-using System.Deployment.Application;
-using System.Diagnostics;
-using System.IO;
-using System.Security;
-using System.Security.Permissions;
-using System.Windows.Forms;
-using System.Web;
-
-namespace ClickOnceBootstrap {
-  static class ClickOnceEntry {
-    [STAThread]
-    static void Main() {
-      try {
-        // Try to get FullTrust. Will throw if we cannot get it.
-        new PermissionSet(PermissionState.Unrestricted).Demand();
-
-        if (!ApplicationDeployment.IsNetworkDeployed) {
-          // Only support running via ClickOnce.
-          return;
-        }
-
-        string query_string =
-            ApplicationDeployment.CurrentDeployment.ActivationUri.Query;
-        if (query_string.Length < 2) {
-          // Query string will be of the form "?xyz=abc". Should have atleast
-          // a question mark and atleast a single character to qualify as a
-          // valid query string. Hence the check against "2".
-          return;
-        }
-        // Remove the '?' prefix.
-        query_string = query_string.Substring(1);
-        query_string = HttpUtility.UrlDecode(query_string);
-        string setup_path = Path.Combine(Application.StartupPath,
-                                          "GoogleUpdateSetup.exe");
-
-        ProcessStartInfo psi = new ProcessStartInfo();
-        psi.FileName = setup_path;
-        psi.Verb = "open";
-        psi.Arguments = "/installsource clickonce /install \"";
-        psi.Arguments += query_string;
-        psi.Arguments += "\"";
-        Process.Start(psi);
-      } catch(Exception e) {
-        MessageBox.Show(e.ToString());
-        return;
-      }
-
-      return;
-    }
-  }
-}
-
diff --git a/clickonce/clickonce_bootstrap.manifest b/clickonce/clickonce_bootstrap.manifest
deleted file mode 100644
index 005db1b..0000000
--- a/clickonce/clickonce_bootstrap.manifest
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
-  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
-    <security>
-      <requestedPrivileges>
-        <requestedExecutionLevel level="asInvoker" />
-      </requestedPrivileges>
-    </security>
-  </trustInfo>
-  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
-    <application>
-      <!--The ID below indicates application support for Windows Vista -->
-      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
-      <!--The ID below indicates application support for Windows 7 -->
-      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
-    </application>
-  </compatibility>
-</assembly>
diff --git a/clickonce/clickonce_bootstrap.rc b/clickonce/clickonce_bootstrap.rc
deleted file mode 100644
index f291ca9..0000000
--- a/clickonce/clickonce_bootstrap.rc
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-1 24 "clickonce_bootstrap.manifest"
-
diff --git a/client/build.scons b/client/build.scons
deleted file mode 100644
index a9e51a4..0000000
--- a/client/build.scons
+++ /dev/null
@@ -1,109 +0,0 @@
-# Copyright 2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-local_env = env.Clone()
-
-local_env['CPPPATH'] += [
-    '$OBJ_ROOT',  # Needed for generated files.
-    ]
-
-inputs = [
-    'bundle_creator.cc',
-    'bundle_installer.cc',
-    'client_metrics.cc',
-    'client_utils.cc',
-    'help_url_builder.cc',
-    'install.cc',
-    'install_apps.cc',
-    'install_self.cc',
-    'shutdown_events.cc',
-    'ua.cc',
-    ]
-
-# Build these into a library.
-local_env.ComponentStaticLibrary('client', inputs)
-
-no_xml_parser_test_env = env.Clone()
-no_xml_parser_test_env.OmahaUnittest(
-    name='install_self_no_xml_parser_unittest',
-    source=[
-        'install_self_unittest_no_xml_parser.cc',
-    ],
-    LIBS=[
-        '$LIB_DIR/breakpad.lib',
-        '$LIB_DIR/client.lib',
-        '$LIB_DIR/common.lib',
-        '$LIB_DIR/google_update_recovery.lib',
-        '$LIB_DIR/logging.lib',       # Required by statsreport.
-        '$LIB_DIR/service.lib',
-        '$LIB_DIR/setup.lib',
-        '$LIB_DIR/statsreport.lib',   # Required by anything using metrics.
-        '$LIB_DIR/ui.lib',
-        'crypt32.lib',    # Required by base.
-        'msi.lib',        # Required by setup.
-        'mstask.lib',     # Required by common.
-        'taskschd.lib',
-        'wininet.lib',
-        'wintrust.lib',   # Required by base.
-
-        # TODO(omaha3): These are required because setup must include
-        # service_main.h, which includes all the COM headers.
-        # The test source also includes fake definitions for IIDs from
-        # omaha3_idl, bits, and iphlpapi.lib.
-        '$LIB_DIR/core.lib',
-        '$LIB_DIR/goopdate_lib.lib',
-        '$LIB_DIR/net.lib',
-        '$LIB_DIR/security.lib',
-    ],
-    all_in_one=False,
-    COMPONENT_TEST_SIZE='small',
-)
-
-utils_test_env = env.Clone()
-utils_test_env.OmahaUnittest(
-    name='client_utils_unittest',
-    source=[
-        'client_utils_unittest.cc',
-    ],
-    LIBS=[
-        '$LIB_DIR/client.lib',
-        '$LIB_DIR/common.lib',
-        '$LIB_DIR/logging.lib',       # Required by statsreport.
-        '$LIB_DIR/omaha3_idl.lib',
-        '$LIB_DIR/statsreport.lib',
-        '$LIB_DIR/ui.lib',
-    ],
-    all_in_one=False,
-    COMPONENT_TEST_SIZE='small',
-    is_small_tests_using_resources=True,
-)
-
-help_url_builder_test_env = env.Clone()
-help_url_builder_test_env.OmahaUnittest(
-    name='help_url_builder_unittest',
-    source=[
-        'help_url_builder_test.cc',
-    ],
-    LIBS=[
-        '$LIB_DIR/client.lib',
-        '$LIB_DIR/common.lib',
-        '$LIB_DIR/omaha3_idl.lib',  # Required by common
-    ],
-    all_in_one=False,
-    COMPONENT_TEST_SIZE='small',
-    is_small_tests_using_resources=True,
-)
diff --git a/client/bundle_creator.cc b/client/bundle_creator.cc
deleted file mode 100644
index 49495f3..0000000
--- a/client/bundle_creator.cc
+++ /dev/null
@@ -1,475 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/client/bundle_creator.h"
-#include <atlsafe.h>
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vista_utils.h"
-#include "omaha/client/client_utils.h"
-#include "omaha/common/command_line.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/common/lang.h"
-#include "omaha/common/update3_utils.h"
-#include "goopdate/omaha3_idl.h"
-
-namespace omaha {
-
-namespace bundle_creator {
-
-namespace internal {
-
-// display_language and install_source can be empty.
-HRESULT SetBundleProperties(const CString& display_language,
-                            const CString& display_name,
-                            const CString& install_source,
-                            const CString& session_id,
-                            IAppBundle* app_bundle) {
-  ASSERT1(!display_name.IsEmpty());
-  ASSERT1(app_bundle);
-
-  CString process_language = lang::GetLanguageForProcess(display_language);
-  HRESULT hr = app_bundle->put_displayLanguage(CComBSTR(process_language));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = app_bundle->put_displayName(CComBSTR(display_name));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = app_bundle->put_sessionId(CComBSTR(session_id));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (!install_source.IsEmpty()) {
-    hr = app_bundle->put_installSource(CComBSTR(install_source));
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  return S_OK;
-}
-
-// Do not use the apps member of extra_args. Those values are handled by
-// PopulateAppSpecificData.
-HRESULT PopulateCommonData(const CommandLineExtraArgs& extra_args,
-                           bool is_eula_accepted,
-                           IApp* app) {
-  ASSERT1(app);
-
-  HRESULT hr = S_OK;
-
-  // Set as soon as possible so pings can occur in error cases.
-  hr = app->put_isEulaAccepted(is_eula_accepted ? VARIANT_TRUE : VARIANT_FALSE);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (!extra_args.language.IsEmpty()) {
-    hr = app->put_language(CComBSTR(extra_args.language));
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  if (!IsEqualGUID(GUID_NULL, extra_args.installation_id)) {
-    hr = app->put_iid(CComBSTR(GuidToString(extra_args.installation_id)));
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  if (!extra_args.brand_code.IsEmpty()) {
-    hr = app->put_brandCode(CComBSTR(extra_args.brand_code));
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  if (!extra_args.client_id.IsEmpty()) {
-    hr = app->put_clientId(CComBSTR(extra_args.client_id));
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  if (!extra_args.referral_id.IsEmpty()) {
-    hr = app->put_referralId(CComBSTR(extra_args.referral_id));
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  if (extra_args.browser_type != BROWSER_UNKNOWN) {
-    hr = app->put_browserType(extra_args.browser_type);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  hr = app->put_usageStatsEnable(extra_args.usage_stats_enable);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT PopulateAppSpecificData(const CommandLineAppArgs& app_args,
-                                IApp* app) {
-  ASSERT1(app);
-
-  HRESULT hr = app->put_displayName(CComBSTR(app_args.app_name));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (!app_args.ap.IsEmpty()) {
-    hr = app->put_ap(CComBSTR(app_args.ap));
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  if (!app_args.tt_token.IsEmpty()) {
-    hr = app->put_ttToken(CComBSTR(app_args.tt_token));
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  if (!app_args.encoded_installer_data.IsEmpty()) {
-    CString decoded_installer_data;
-    HRESULT hr = Utf8UrlEncodedStringToWideString(
-                     app_args.encoded_installer_data,
-                     &decoded_installer_data);
-    ASSERT(SUCCEEDED(hr), (_T("[Utf8UrlEncodedStringToWideString][0x%x]"), hr));
-    if (FAILED(hr) || CString(decoded_installer_data).Trim().IsEmpty()) {
-      return GOOPDATE_E_INVALID_INSTALLER_DATA_IN_APPARGS;
-    }
-
-    hr = app->put_clientInstallData(CComBSTR(decoded_installer_data));
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  if (!app_args.install_data_index.IsEmpty()) {
-    hr = app->put_serverInstallDataIndex(CComBSTR(app_args.install_data_index));
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  if (!app_args.experiment_labels.IsEmpty()) {
-    hr = app->put_labels(CComBSTR(app_args.experiment_labels));
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  return S_OK;
-}
-
-// Obtains tokens and passes them to put_altTokens when running as Local System.
-// Does not do anything for per-user instances or when not run as Local System.
-HRESULT SetAltTokens(bool is_machine, IAppBundle* app_bundle) {
-  ASSERT1(app_bundle);
-
-  if (!is_machine) {
-    return S_OK;
-  }
-
-  bool is_local_system = false;
-  HRESULT hr = IsSystemProcess(&is_local_system);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (!is_local_system) {
-    // Do not need alternate tokens.
-    return S_OK;
-  }
-
-  CAccessToken primary_token;
-  hr = primary_token.GetProcessToken(TOKEN_ALL_ACCESS) ?
-           S_OK : HRESULTFromLastError();
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[GetProcessToken failed][0x%x]"), hr));
-    return hr;
-  }
-
-  CAccessToken impersonation_token;
-  HANDLE user_token = NULL;
-
-  vista::GetLoggedOnUserToken(&user_token);
-
-  if (user_token) {
-    impersonation_token.Attach(user_token);
-  } else if (!primary_token.CreateImpersonationToken(&impersonation_token)) {
-    hr = HRESULTFromLastError();
-    CORE_LOG(LE, (_T("[CreateImpersonationToken failed][0x%x]"), hr));
-    return hr;
-  }
-
-  hr = app_bundle->put_altTokens(
-      reinterpret_cast<ULONG_PTR>(impersonation_token.GetHandle()),
-      reinterpret_cast<ULONG_PTR>(primary_token.GetHandle()),
-      ::GetCurrentProcessId());
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[put_altTokens failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-}  // namespace internal
-
-HRESULT Create(bool is_machine,
-               const CString& display_language,
-               const CString& install_source,
-               const CString& session_id,
-               bool is_interactive,
-               IAppBundle** app_bundle) {
-  CORE_LOG(L2, (_T("[bundle_creator::Create]")));
-  ASSERT1(app_bundle);
-
-  CComPtr<IGoogleUpdate3> server;
-  HRESULT hr = update3_utils::CreateGoogleUpdate3Class(is_machine, &server);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[CreateGoogleUpdate3Class][0x%08x]"), hr));
-    return hr;
-  }
-
-  CComPtr<IAppBundle> app_bundle_ptr;
-  hr = update3_utils::CreateAppBundle(server, &app_bundle_ptr);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[CreateAppBundle failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  hr = internal::SetBundleProperties(display_language,
-                                     client_utils::GetUpdateAllAppsBundleName(),
-                                     install_source,
-                                     session_id,
-                                     app_bundle_ptr);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = internal::SetAltTokens(is_machine, app_bundle_ptr);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = app_bundle_ptr->put_priority(is_interactive ?
-                                        INSTALL_PRIORITY_HIGH :
-                                        INSTALL_PRIORITY_LOW);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = app_bundle_ptr->initialize();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  *app_bundle = app_bundle_ptr.Detach();
-  return S_OK;
-}
-
-HRESULT CreateFromCommandLine(bool is_machine,
-                              bool is_eula_accepted,
-                              bool is_offline,
-                              const CString& offline_directory,
-                              const CommandLineExtraArgs& extra_args,
-                              const CString& install_source,
-                              const CString& session_id,
-                              bool is_interactive,
-                              IAppBundle** app_bundle) {
-  CORE_LOG(L2, (_T("[bundle_creator::CreateFromCommandLine]")));
-  ASSERT1(app_bundle);
-
-  CComPtr<IGoogleUpdate3> server;
-  HRESULT hr = update3_utils::CreateGoogleUpdate3Class(is_machine, &server);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[CreateGoogleUpdate3Class][0x%08x]"), hr));
-    return hr;
-  }
-
-  CComPtr<IAppBundle> app_bundle_ptr;
-  hr = update3_utils::CreateAppBundle(server, &app_bundle_ptr);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[CreateAppBundle failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  hr = internal::SetBundleProperties(extra_args.language,
-                                     extra_args.bundle_name,
-                                     install_source,
-                                     session_id,
-                                     app_bundle_ptr);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (is_offline) {
-    CString offline_dir(offline_directory);
-    if (offline_dir.IsEmpty()) {
-      // For Omaha2 compatibility.
-      offline_dir = is_machine ?
-          ConfigManager::Instance()->GetMachineSecureOfflineStorageDir() :
-          ConfigManager::Instance()->GetUserOfflineStorageDir();
-    }
-
-    hr = app_bundle_ptr->put_offlineDirectory(CComBSTR(offline_dir));
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  hr = internal::SetAltTokens(is_machine, app_bundle_ptr);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = app_bundle_ptr->put_priority(is_interactive ?
-                                        INSTALL_PRIORITY_HIGH :
-                                        INSTALL_PRIORITY_LOW);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = app_bundle_ptr->initialize();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  for (size_t i = 0; i < extra_args.apps.size(); ++i) {
-    const CommandLineAppArgs& app_args(extra_args.apps[i]);
-
-    const CComBSTR app_id(GuidToString(app_args.app_guid));
-
-    CComPtr<IApp> app;
-    hr = update3_utils::CreateApp(app_id, app_bundle_ptr, &app);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = internal::PopulateCommonData(extra_args, is_eula_accepted, app);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = internal::PopulateAppSpecificData(app_args, app);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  *app_bundle = app_bundle_ptr.Detach();
-  return S_OK;
-}
-
-HRESULT CreateForOnDemand(bool is_machine,
-                          const CString& app_id,
-                          const CString& install_source,
-                          const CString& session_id,
-                          HANDLE impersonation_token,
-                          HANDLE primary_token,
-                          IAppBundle** app_bundle) {
-  CORE_LOG(L2, (_T("[bundle_creator::CreateForOnDemand]")));
-  ASSERT1(app_bundle);
-
-  CComPtr<IGoogleUpdate3> server;
-  HRESULT hr = update3_utils::CreateGoogleUpdate3Class(is_machine, &server);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[CreateGoogleUpdate3Class failed][0x%x]"), hr));
-    return hr;
-  }
-
-  CComPtr<IAppBundle> app_bundle_ptr;
-  hr = update3_utils::CreateAppBundle(server, &app_bundle_ptr);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[CreateAppBundle failed][0x%x]"), hr));
-    return hr;
-  }
-
-  // ::CoSetProxyBlanket() settings are per proxy. For OnDemand, after
-  // unmarshaling the interface, we need to set the blanket on this new proxy.
-  // The proxy blanket on the IAppBundle interface are set explicitly only for
-  // OnDemand, because OnDemand is a unique case of being a COM server as well
-  // as a COM client. The default security settings set for the OnDemand COM
-  // server are more restrictive and rightly so, as compared to the settings
-  // that we set for a COM client such as our Omaha3 UI. Hence the need to
-  // explicitly set the proxy blanket settings and lower the security
-  // requirements only when calling out on this interface.
-  hr = update3_utils::SetProxyBlanketAllowImpersonate(app_bundle_ptr);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (is_machine) {
-    hr = app_bundle_ptr->put_altTokens(
-        reinterpret_cast<ULONG_PTR>(impersonation_token),
-        reinterpret_cast<ULONG_PTR>(primary_token),
-        ::GetCurrentProcessId());
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[put_altTokens failed][0x%x]"), hr));
-      return hr;
-    }
-  }
-
-  hr = internal::SetBundleProperties(CString(),
-                                     _T("On Demand Bundle"),
-                                     install_source,
-                                     session_id,
-                                     app_bundle_ptr);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = app_bundle_ptr->initialize();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CComPtr<IApp> app;
-  hr = update3_utils::CreateInstalledApp(CComBSTR(app_id),
-                                         app_bundle_ptr,
-                                         &app);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[CreateInstalledApp failed][0x%x]"), hr));
-    return hr;
-  }
-
-  *app_bundle = app_bundle_ptr.Detach();
-  return S_OK;
-}
-
-}  // namespace bundle_creator
-
-}  // namespace omaha
diff --git a/client/bundle_creator.h b/client/bundle_creator.h
deleted file mode 100644
index 36d21d3..0000000
--- a/client/bundle_creator.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_CLIENT_BUNDLE_CREATOR_H_
-#define OMAHA_CLIENT_BUNDLE_CREATOR_H_
-
-#include <windows.h>
-#include <atlsafe.h>
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "goopdate/omaha3_idl.h"
-
-namespace omaha {
-
-struct CommandLineExtraArgs;
-
-namespace bundle_creator {
-
-// Creates app bundle interface, initializes it with default properties and
-// the given install source.
-HRESULT Create(bool is_machine,
-               const CString& display_language,
-               const CString& install_source,
-               const CString& session_id,
-               bool is_interactive,
-               IAppBundle** app_bundle);
-
-// Creates app bundle interface that contains the apps specified in extra_args.
-// The apps properties are intialized based on the extra_args and other
-// arguments.
-HRESULT CreateFromCommandLine(bool is_machine,
-                              bool is_eula_accepted,
-                              bool is_offline,
-                              const CString& offline_directory,
-                              const CommandLineExtraArgs& extra_args,
-                              const CString& install_source,
-                              const CString& session_id,
-                              bool is_interactive,
-                              IAppBundle** app_bundle);
-
-// Creates app bundle interface that contains the given app (app_id).
-HRESULT CreateForOnDemand(bool is_machine,
-                          const CString& app_id,
-                          const CString& install_source,
-                          const CString& session_id,
-                          HANDLE impersonation_token,
-                          HANDLE primary_token,
-                          IAppBundle** app_bundle);
-
-}  // namespace bundle_creator
-
-}  // namespace omaha
-
-#endif  // OMAHA_CLIENT_BUNDLE_CREATOR_H_
diff --git a/client/bundle_creator_test.cc b/client/bundle_creator_test.cc
deleted file mode 100644
index aa82c3a..0000000
--- a/client/bundle_creator_test.cc
+++ /dev/null
@@ -1,386 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/app_util.h"
-#include "omaha/base/browser_utils.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/path.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/system.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/client/bundle_creator.h"
-#include "omaha/client/client_utils.h"
-#include "omaha/common/command_line.h"
-#include "omaha/common/command_line_builder.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/common/update3_utils.h"
-#include "omaha/goopdate/goopdate.h"
-#include "omaha/goopdate/resource_manager.h"
-#include "omaha/goopdate/worker.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-const TCHAR kUpdateDevKey[]               = MACHINE_REG_UPDATE;
-const TCHAR kMachineGoopdateClientsKey[]  = MACHINE_REG_CLIENTS_GOOPDATE;
-const TCHAR kMachineGoopdateStateKey[]    = MACHINE_REG_CLIENT_STATE_GOOPDATE;
-
-}   // namespace
-
-class BundleCreatorTest : public testing::Test {
- protected:
-  BundleCreatorTest() {}
-
-  static void SetUpTestCase() {
-    // Goopdate instance is required by Worker instance.
-    goopdates_.reset(new Goopdate(true));
-
-    EXPECT_SUCCEEDED(ResourceManager::Create(
-        true, app_util::GetCurrentModuleDirectory(), _T("en")));
-
-    const CString shell_path = goopdate_utils::BuildGoogleUpdateExePath(true);
-    EXPECT_SUCCEEDED(RegKey::SetValue(kUpdateDevKey,
-                                      kRegValueInstalledPath,
-                                      shell_path));
-
-    EXPECT_SUCCEEDED(RegKey::SetValue(kUpdateDevKey,
-                                      kRegValueInstalledVersion,
-                                      GetVersionString()));
-
-    EXPECT_SUCCEEDED(RegKey::SetValue(kMachineGoopdateClientsKey,
-                                      kRegValueProductVersion,
-                                      GetVersionString()));
-
-    EXPECT_SUCCEEDED(RegKey::SetValue(kMachineGoopdateStateKey,
-                                      kRegValueProductVersion,
-                                      GetVersionString()));
-
-    CopyGoopdateFiles(GetGoogleUpdateMachinePath(), GetVersionString());
-  }
-
-  static void TearDownTestCase() {
-    ResourceManager::Delete();
-
-    // bundle_creator::Create*() methods indirectly creates Worker instance,
-    // delete it here (to avoid interference with other tests).
-    Worker::DeleteInstance();
-
-    goopdates_.reset();
-  }
-
-  virtual void SetUp() {
-    RegisterOrUnregisterGoopdateLocalServer(true);
-  }
-
-  virtual void TearDown() {
-    RegisterOrUnregisterGoopdateLocalServer(false);
-  }
-
-  static void VerifyAppMatchesCommandLineArguments(
-      const CommandLineExtraArgs extra_arg,
-      const CommandLineAppArgs& app_arg,
-      IApp* app) {
-    // Verify common data.
-    CComBSTR language;
-    EXPECT_SUCCEEDED(app->get_language(&language));
-    EXPECT_STREQ(extra_arg.language, language);
-
-    CComBSTR iid;
-    EXPECT_SUCCEEDED(app->get_iid(&iid));
-
-    GUID installation_id = {0};
-    EXPECT_SUCCEEDED(StringToGuidSafe(CString(iid), &installation_id));
-    EXPECT_TRUE(extra_arg.installation_id == installation_id);
-
-    CComBSTR brand_code;
-    EXPECT_SUCCEEDED(app->get_brandCode(&brand_code));
-    EXPECT_STREQ(extra_arg.brand_code, brand_code);
-
-    CComBSTR client_id;
-    EXPECT_SUCCEEDED(app->get_clientId(&client_id));
-    EXPECT_STREQ(extra_arg.client_id, client_id);
-
-    CComBSTR referral_id;
-    EXPECT_SUCCEEDED(app->get_referralId(&referral_id));
-    EXPECT_STREQ(extra_arg.referral_id, referral_id);
-
-    UINT browser_type = 0;
-    EXPECT_SUCCEEDED(app->get_browserType(&browser_type));
-    EXPECT_EQ(extra_arg.browser_type, browser_type);
-
-    // Verify app specific data.
-    CComBSTR app_name;
-    EXPECT_SUCCEEDED(app->get_displayName(&app_name));
-    EXPECT_STREQ(app_arg.app_name, app_name);
-
-    CComBSTR tt_token;
-    EXPECT_SUCCEEDED(app->get_ttToken(&tt_token));
-    EXPECT_STREQ(app_arg.tt_token, tt_token);
-
-    CComBSTR ap;
-    EXPECT_SUCCEEDED(app->get_ap(&ap));
-    EXPECT_STREQ(app_arg.ap, ap);
-  }
-
-  static void CreateAppRegistryState(const CString& app_id, bool is_machine) {
-    CString clients_key_name = AppendRegKeyPath(
-        ConfigManager::Instance()->registry_clients(is_machine),
-        app_id);
-    RegKey client_key;
-    ASSERT_SUCCEEDED(client_key.Create(clients_key_name));
-
-    CString current_version(_T("1.0.0.0"));
-    ASSERT_SUCCEEDED(client_key.SetValue(kRegValueProductVersion,
-                                         current_version));
-  }
-
-  static void RemoveAppRegistryState(const CString& app_id, bool is_machine) {
-    CString clients_key_name = AppendRegKeyPath(
-        ConfigManager::Instance()->registry_clients(is_machine),
-        app_id);
-    EXPECT_SUCCEEDED(RegKey::DeleteKey(clients_key_name));
-  }
-
-  static scoped_ptr<Goopdate> goopdates_;
-};
-
-scoped_ptr<Goopdate> BundleCreatorTest::goopdates_;
-
-TEST_F(BundleCreatorTest, Create) {
-  const CString kDisplayLanguage = _T("en");
-  const CString kInstallSource = _T("TestInstallSource");
-  const CString kSessionId = _T("{6cb069db-b073-4a40-9983-846a3819876a}");
-  const bool is_machine = true;
-  const bool is_interactive = false;
-
-  CComPtr<IAppBundle> app_bundle;
-  ASSERT_SUCCEEDED(bundle_creator::Create(is_machine,
-                                          kDisplayLanguage,
-                                          kInstallSource,
-                                          kSessionId,
-                                          is_interactive,
-                                          &app_bundle));
-  CComBSTR display_name;
-  EXPECT_SUCCEEDED(app_bundle->get_displayName(&display_name));
-  EXPECT_STREQ(client_utils::GetUpdateAllAppsBundleName(), display_name);
-
-  CComBSTR install_source;
-  EXPECT_SUCCEEDED(app_bundle->get_installSource(&install_source));
-  EXPECT_STREQ(kInstallSource, install_source);
-
-  CComBSTR session_id;
-  EXPECT_SUCCEEDED(app_bundle->get_sessionId(&session_id));
-  EXPECT_STREQ(kSessionId, session_id);
-
-  long num_apps = 0;  // NOLINT(runtime/int)
-  EXPECT_SUCCEEDED(app_bundle->get_Count(&num_apps));
-  EXPECT_EQ(0, num_apps);
-
-  long priority = INSTALL_PRIORITY_LOW;  // NOLINT(runtime/int)
-  EXPECT_SUCCEEDED(app_bundle->get_priority(&priority));
-  EXPECT_EQ(is_interactive ? INSTALL_PRIORITY_HIGH : INSTALL_PRIORITY_LOW,
-            priority);
-
-  CComBSTR display_language;
-  EXPECT_SUCCEEDED(app_bundle->get_displayLanguage(&display_language));
-  EXPECT_STREQ(kDisplayLanguage, display_language);
-}
-
-TEST_F(BundleCreatorTest, CreateFromCommandLine) {
-  const CString kDisplayLanguage = _T("en");
-  const CString kTestBundleName = _T("CommandLineTestBundle");
-  const GUID kInstallationId = {
-    0x9a67c0e6, 0xe6f6, 0x400d,
-    {0xa4, 0x30, 0xe3, 0xfe, 0x54, 0xcc, 0x10, 0x43}
-  };
-  const CString kBrandCode = _T("GOOG");
-  const CString kClientId = _T("TestClient");
-  const CString kReferralId = _T("TestReferral");
-  const BrowserType kBrowserType = BROWSER_CHROME;
-
-  const CString kInstallSource = _T("TestInstallSourceCmdLine");
-  const CString kSessionId = _T("{6cb069db-b073-4a40-9983-846a3819876a}");
-  const bool is_machine = true;
-  const bool is_interactive = true;
-  const bool is_eula_accepted = true;
-  const bool is_offline = true;
-  const CString offline_directory = _T("C:\\GoogleUpdateUnitTest");
-
-  const GUID kApp1Id = {
-    0x433bd902, 0x6c0d, 0x4115,
-    {0x97, 0xe8, 0x4f, 0xa8, 0x2e, 0x1f, 0x4b, 0x8f}
-  };
-  const CString kApp1Name = _T("Test App1");
-  const CString kApp1AdditionalParameter = _T("App1 AP");
-  const CString kApp1Tttoken = _T("T1");
-
-  const GUID kApp2Id = {
-    0x83ed8a95, 0xc4e2, 0x4da8,
-    {0xbd, 0x0c, 0x00, 0xb9, 0xdf, 0xac, 0x6c, 0x88}
-  };
-  const CString kApp2Name = _T("Test App2");
-  const CString kApp2AdditionalParameter = _T("App2 AP");
-  const CString kApp2Tttoken = _T("T2");
-
-  CommandLineAppArgs app1;
-  app1.app_guid = kApp1Id;
-  app1.app_name = kApp1Name;
-  app1.needs_admin = NEEDS_ADMIN_YES;
-  app1.ap = kApp1AdditionalParameter;
-  app1.tt_token = kApp1Tttoken;
-
-  CommandLineAppArgs app2;
-  app2.app_guid = kApp2Id;
-  app2.app_name = kApp2Name;
-  app2.needs_admin = NEEDS_ADMIN_NO;
-  app2.ap = kApp2AdditionalParameter;
-  app2.tt_token = kApp2Tttoken;
-
-  CommandLineExtraArgs extra_args;
-  extra_args.bundle_name = kTestBundleName;
-  extra_args.installation_id = kInstallationId;
-  extra_args.brand_code = kBrandCode;
-  extra_args.client_id = kClientId;
-  extra_args.referral_id = kReferralId;
-  extra_args.language = kDisplayLanguage;
-  extra_args.browser_type = kBrowserType;
-  extra_args.apps.push_back(app1);
-  extra_args.apps.push_back(app2);
-
-  CComPtr<IAppBundle> app_bundle;
-  ASSERT_SUCCEEDED(bundle_creator::CreateFromCommandLine(
-      is_machine,
-      is_eula_accepted,
-      is_offline,
-      offline_directory,
-      extra_args,
-      kInstallSource,
-      kSessionId,
-      is_interactive,
-      &app_bundle));
-
-  CComBSTR display_name;
-  EXPECT_SUCCEEDED(app_bundle->get_displayName(&display_name));
-  EXPECT_STREQ(kTestBundleName, display_name);
-
-  CComBSTR install_source;
-  EXPECT_SUCCEEDED(app_bundle->get_installSource(&install_source));
-  EXPECT_STREQ(kInstallSource, install_source);
-
-  CComBSTR session_id;
-  EXPECT_SUCCEEDED(app_bundle->get_sessionId(&session_id));
-  EXPECT_STREQ(kSessionId, session_id);
-
-  long priority = INSTALL_PRIORITY_LOW;  // NOLINT(runtime/int)
-  EXPECT_SUCCEEDED(app_bundle->get_priority(&priority));
-  EXPECT_EQ(is_interactive ? INSTALL_PRIORITY_HIGH : INSTALL_PRIORITY_LOW,
-            priority);
-
-  CComBSTR display_language;
-  EXPECT_SUCCEEDED(app_bundle->get_displayLanguage(&display_language));
-  EXPECT_STREQ(kDisplayLanguage, display_language);
-
-  long num_apps = 0;  // NOLINT(runtime/int)
-  EXPECT_SUCCEEDED(app_bundle->get_Count(&num_apps));
-  EXPECT_EQ(2, num_apps);
-
-  for (long i = 0; i < num_apps; ++i) {  // NOLINT(runtime/int)
-    CComPtr<IApp> app;
-    EXPECT_SUCCEEDED(update3_utils::GetApp(app_bundle, i, &app));
-
-    CComBSTR app_id;
-    EXPECT_SUCCEEDED(app->get_appId(&app_id));
-    GUID app_guid = {0};
-    EXPECT_SUCCEEDED(StringToGuidSafe(CString(app_id), &app_guid));
-
-    if (app_guid == kApp1Id) {
-      VerifyAppMatchesCommandLineArguments(extra_args, app1, app);
-    } else {
-      EXPECT_TRUE(kApp2Id == app_guid);
-      VerifyAppMatchesCommandLineArguments(extra_args, app2, app);
-    }
-  }
-}
-
-TEST_F(BundleCreatorTest, CreateForOnDemand) {
-  const CString& kAppId = _T("{5dace97e-9d8f-430b-acc7-ef04708b4725}");
-  const CString kInstallSource = _T("TestInstallSourceOnDemand");
-  const CString kSessionId = _T("{6cb069db-b073-4a40-9983-846a3819876a}");
-  const bool is_machine = true;
-
-  // Create app registry key to make it "installed".
-  CreateAppRegistryState(kAppId, is_machine);
-
-  CAccessToken process_token;
-  if (is_machine) {
-    process_token.GetEffectiveToken(TOKEN_ALL_ACCESS);
-  }
-
-  CComPtr<IAppBundle> app_bundle;
-  HRESULT hr = bundle_creator::CreateForOnDemand(is_machine,
-                                                 kAppId,
-                                                 kInstallSource,
-                                                 kSessionId,
-                                                 process_token.GetHandle(),
-                                                 process_token.GetHandle(),
-                                                 &app_bundle);
-  RemoveAppRegistryState(kAppId, is_machine);
-  ASSERT_SUCCEEDED(hr);
-
-  CComBSTR install_source;
-  EXPECT_SUCCEEDED(app_bundle->get_installSource(&install_source));
-  EXPECT_STREQ(kInstallSource, install_source);
-
-  CComBSTR session_id;
-  EXPECT_SUCCEEDED(app_bundle->get_sessionId(&session_id));
-  EXPECT_STREQ(kSessionId, session_id);
-
-  long num_apps = 0;  // NOLINT(runtime/int)
-  EXPECT_SUCCEEDED(app_bundle->get_Count(&num_apps));
-  EXPECT_EQ(1, num_apps);
-
-  long priority = INSTALL_PRIORITY_LOW;  // NOLINT(runtime/int)
-  EXPECT_SUCCEEDED(app_bundle->get_priority(&priority));
-  EXPECT_EQ(INSTALL_PRIORITY_HIGH, priority);
-}
-
-TEST_F(BundleCreatorTest, CreateForOnDemand_NonExistApp) {
-  const CString& kAppId = _T("{52e24bf9-d7d0-4b6e-b12d-9cef51fa45f2}");
-  const CString kInstallSource = _T("TestInstallSourceOnDemand");
-  const CString kSessionId = _T("{6cb069db-b073-4a40-9983-846a3819876a}");
-  const bool is_machine = true;
-
-  CAccessToken process_token;
-  if (is_machine) {
-    process_token.GetEffectiveToken(TOKEN_ALL_ACCESS);
-  }
-
-  CComPtr<IAppBundle> app_bundle;
-  EXPECT_FAILED(bundle_creator::CreateForOnDemand(
-      is_machine,
-      kAppId,
-      kInstallSource,
-      kSessionId,
-      process_token.GetHandle(),
-      process_token.GetHandle(),
-      &app_bundle));
-}
-
-}  // namespace omaha
diff --git a/client/bundle_installer.cc b/client/bundle_installer.cc
deleted file mode 100644
index 970e67a..0000000
--- a/client/bundle_installer.cc
+++ /dev/null
@@ -1,1138 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/client/bundle_installer.h"
-#include <atlsafe.h>
-#include "base/scoped_ptr.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/client/client_utils.h"
-#include "omaha/client/help_url_builder.h"
-#include "omaha/client/resource.h"
-#include "omaha/client/shutdown_events.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/common/update3_utils.h"
-#include "goopdate/omaha3_idl.h"
-
-namespace omaha {
-
-namespace internal {
-
-CString GetAppDisplayName(IApp* app) {
-  ASSERT1(app);
-
-  CComBSTR app_name;
-  HRESULT hr = app->get_displayName(&app_name);
-  if (SUCCEEDED(hr)) {
-    ASSERT1(app_name.Length());
-    if (app_name.Length()) {
-      return CString(app_name);
-    }
-  } else {
-    CORE_LOG(LW, (_T("[get_displayName failed][0x%08x]"), hr));
-  }
-  return client_utils::GetDefaultApplicationName();
-}
-
-CString BuildAppNameList(const std::vector<CString>& app_names) {
-  ASSERT1(!app_names.empty());
-
-  CString list = app_names[0];
-  for (size_t i = 1; i < app_names.size(); ++i) {
-    list.FormatMessage(IDS_APPLICATION_NAME_CONCATENATION, list, app_names[i]);
-  }
-
-  return list;
-}
-
-CompletionCodes ConvertPostInstallActionToCompletionCode(
-    PostInstallAction post_install_action,
-    bool is_browser_type_supported,
-    bool is_error_state) {
-  switch (post_install_action) {
-    case POST_INSTALL_ACTION_EXIT_SILENTLY_ON_LAUNCH_COMMAND:
-      return COMPLETION_CODE_EXIT_SILENTLY_ON_LAUNCH_COMMAND;
-
-    case POST_INSTALL_ACTION_LAUNCH_COMMAND:
-      return COMPLETION_CODE_LAUNCH_COMMAND;
-
-    case POST_INSTALL_ACTION_RESTART_BROWSER:
-      if (is_browser_type_supported) {
-        return COMPLETION_CODE_RESTART_BROWSER;
-      } else {
-        return COMPLETION_CODE_RESTART_BROWSER_NOTICE_ONLY;
-      }
-
-    case POST_INSTALL_ACTION_RESTART_ALL_BROWSERS:
-      if (is_browser_type_supported) {
-        return COMPLETION_CODE_RESTART_ALL_BROWSERS;
-      } else {
-        return COMPLETION_CODE_RESTART_ALL_BROWSERS_NOTICE_ONLY;
-      }
-
-    case POST_INSTALL_ACTION_REBOOT:
-      // We don't support reboot, always notice_only
-      return COMPLETION_CODE_REBOOT_NOTICE_ONLY;
-
-    case POST_INSTALL_ACTION_EXIT_SILENTLY:
-      return COMPLETION_CODE_EXIT_SILENTLY;
-
-    case POST_INSTALL_ACTION_DEFAULT:
-      if (is_error_state) {
-        return COMPLETION_CODE_ERROR;
-      } else {
-        return COMPLETION_CODE_SUCCESS;
-      }
-
-    default:
-      ASSERT1(false);
-      return COMPLETION_CODE_SUCCESS;
-  }
-}
-
-HRESULT GetCompletionInformation(IApp* app,
-                                 CurrentState* current_state,
-                                 AppCompletionInfo* completion_info,
-                                 bool is_browser_type_supported) {
-  ASSERT1(app);
-  ASSERT1(current_state);
-  ASSERT1(completion_info);
-
-  *current_state = STATE_INIT;
-
-  // If the COM call fails, which may be why we encountered an error, this
-  // could be "Google Application", which is weird, especially in the mixed
-  // results UI.
-  completion_info->display_name = internal::GetAppDisplayName(app);
-
-  CComBSTR app_id;
-  HRESULT hr = app->get_appId(&app_id);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[get_appId failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  completion_info->app_id = app_id;
-
-  CComPtr<ICurrentState> icurrent_state;
-  hr = update3_utils::GetAppCurrentState(app, current_state, &icurrent_state);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[GetNextVersionState failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  ASSERT1(*current_state == STATE_INSTALL_COMPLETE ||
-          *current_state == STATE_NO_UPDATE ||
-          *current_state == STATE_ERROR);
-
-  hr = icurrent_state->get_errorCode(&completion_info->error_code);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  LONG extra_code1 = 0;
-  hr = icurrent_state->get_extraCode1(&extra_code1);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  completion_info->extra_code1 = static_cast<int>(extra_code1);
-
-  CComBSTR message;
-  hr = icurrent_state->get_completionMessage(&message);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  completion_info->completion_message = message;
-
-  LONG installer_result = 0;
-  hr = icurrent_state->get_installerResultCode(&installer_result);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  completion_info->installer_result_code = installer_result;
-
-  VARIANT_BOOL is_canceled = VARIANT_TRUE;
-  hr = icurrent_state->get_isCanceled(&is_canceled);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  completion_info->is_canceled = (is_canceled == VARIANT_TRUE);
-
-  CComBSTR post_install_launch_command_line;
-  hr = icurrent_state->get_postInstallLaunchCommandLine(
-           &post_install_launch_command_line);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  completion_info->post_install_launch_command_line =
-      post_install_launch_command_line;
-
-  CORE_LOG(L5, (_T("[GetCompletionInformation][%s][state: u][code: 0x%08x]")
-                _T("[extra code: %d][message: '%s'][installer: %u]"),
-                app_id, *current_state,
-                completion_info->error_code,
-                completion_info->extra_code1,
-                message, installer_result));
-
-  CComBSTR post_install_url;
-  hr = icurrent_state->get_postInstallUrl(&post_install_url);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  completion_info->post_install_url = post_install_url;
-
-  LONG post_install_action = static_cast<LONG>(POST_INSTALL_ACTION_DEFAULT);
-  hr = icurrent_state->get_postInstallAction(&post_install_action);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  completion_info->completion_code = ConvertPostInstallActionToCompletionCode(
-      static_cast<PostInstallAction>(post_install_action),
-      is_browser_type_supported,
-      *current_state == STATE_ERROR);
-
-  ASSERT1(SUCCEEDED(completion_info->error_code) ||
-          completion_info->installer_result_code == 0 ||
-          completion_info->error_code == GOOPDATEINSTALL_E_INSTALLER_FAILED);
-
-  return S_OK;
-}
-
-void GetAppCompletionMessage(IApp* app,
-                             AppCompletionInfo* app_info,
-                             bool is_browser_type_supported) {
-  ASSERT1(app);
-  ASSERT1(app_info);
-
-  CurrentState current_state = STATE_INIT;
-
-  HRESULT hr = GetCompletionInformation(app,
-                                        &current_state,
-                                        app_info,
-                                        is_browser_type_supported);
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[GetCompletionInformation failed][0x%08x]"), hr));
-    // Treat the failure as an app failure.
-    app_info->completion_message.FormatMessage(
-        IDS_INSTALL_FAILED_WITH_ERROR_CODE,
-        hr);
-    app_info->error_code = hr;
-    app_info->extra_code1 = 0;
-    return;
-  }
-
-  ASSERT1(current_state == STATE_INSTALL_COMPLETE ||
-          current_state == STATE_NO_UPDATE ||
-          current_state == STATE_ERROR);
-  ASSERT1(!app_info->completion_message.IsEmpty());
-  ASSERT1(current_state != STATE_NO_UPDATE ||
-          app_info->error_code == S_OK     ||
-          app_info->error_code == GOOPDATE_E_UPDATE_DEFERRED);
-
-  app_info->is_noupdate = current_state == STATE_NO_UPDATE;
-
-  // If it is not a success or noupdate, we must report a failure in error_code.
-  if (current_state != STATE_INSTALL_COMPLETE &&
-      current_state != STATE_NO_UPDATE) {
-    ASSERT1(FAILED(app_info->error_code));
-    if (SUCCEEDED(app_info->error_code)) {
-      app_info->error_code = E_FAIL;
-      app_info->extra_code1 = 0;
-    }
-  }
-
-  if (!app_info->completion_message.IsEmpty()) {
-    return;
-  }
-
-  ASSERT(false, (_T("There should always be a completion message.")));
-
-  // The message is empty. Return a default message.
-  if (current_state == STATE_INSTALL_COMPLETE) {
-    app_info->completion_message.LoadString(
-        IDS_APPLICATION_INSTALLED_SUCCESSFULLY);
-  } else if (current_state == STATE_NO_UPDATE) {
-    VERIFY1(app_info->completion_message.LoadString(IDS_NO_UPDATE_RESPONSE));
-  } else {
-    ASSERT1(current_state == STATE_ERROR);
-    app_info->completion_message.FormatMessage(
-        IDS_INSTALL_FAILED_WITH_ERROR_CODE,
-        E_FAIL);
-  }
-}
-
-CString BuildResultStringForApps(uint32 group_name_resource_id,
-                                 const std::vector<CString>& apps) {
-  CString app_result_string;
-  ASSERT1(!apps.empty());
-
-  // The header (i.e. "Failed:") should be in bold.
-  const TCHAR* const kAppListHeaderFormatOpen = _T("<b>");
-  const TCHAR* const kAppListHeaderFormatClose = _T("</b>");
-
-  CString apps_list = internal::BuildAppNameList(apps);
-  app_result_string.FormatMessage(group_name_resource_id,
-                                  kAppListHeaderFormatOpen,
-                                  kAppListHeaderFormatClose,
-                                  apps_list);
-  return app_result_string;
-}
-
-// TODO(omaha): If we end up leaving is_noupdate in AppCompletionInfo,
-// eliminate is_only_no_update parameter.
-CString GetBundleCompletionMessage(
-    const CString& bundle_name,
-    const std::vector<AppCompletionInfo>& apps_info,
-    bool is_only_no_update,
-    bool is_canceled) {
-  ASSERT1(!apps_info.empty());
-  // TODO(omaha): Enable this assert if GetUpdateAllAppsBundleName() is
-  // changed to a different string.
-  // ASSERT(bundle_name != SHORT_COMPANY_NAME _T(" Application"),
-  //        (_T("Do not pass default bundle name to this function.")));
-
-  CString bundle_message;
-
-  if (is_only_no_update) {
-    VERIFY1(bundle_message.LoadString(IDS_NO_UPDATE_RESPONSE));
-    return bundle_message;
-  }
-
-  std::vector<CString> succeeded_apps;
-  std::vector<CString> failed_apps;
-  std::vector<CString> canceled_apps;
-  CString first_failure_message;
-  for (size_t i = 0; i < apps_info.size(); ++i) {
-    const AppCompletionInfo& app_info = apps_info[i];
-    ASSERT1(!app_info.display_name.IsEmpty());
-    ASSERT1(!app_info.completion_message.IsEmpty());
-
-    if (SUCCEEDED(app_info.error_code)) {
-      succeeded_apps.push_back(app_info.display_name);
-    } else if (app_info.is_canceled) {
-      canceled_apps.push_back(app_info.display_name);
-    } else {
-      failed_apps.push_back(app_info.display_name);
-
-      // For now, we only display the first error message when all apps fail.
-      // Remember that message.
-      if (first_failure_message.IsEmpty()) {
-        first_failure_message = app_info.completion_message;
-      }
-    }
-  }
-
-  CString canceled_apps_str;
-  if (!canceled_apps.empty()) {
-    canceled_apps_str = BuildResultStringForApps(
-        IDS_BUNDLE_MIXED_RESULTS_CANCELED_APPS, canceled_apps);
-  }
-
-  CString succeeded_apps_str;
-  if (!succeeded_apps.empty()) {
-    succeeded_apps_str = BuildResultStringForApps(
-        IDS_BUNDLE_MIXED_RESULTS_SUCCEEDED_APPS, succeeded_apps);
-  }
-  CString failed_apps_str;
-  if (!failed_apps.empty()) {
-    failed_apps_str = BuildResultStringForApps(
-        IDS_BUNDLE_MIXED_RESULTS_FAILED_APPS, failed_apps);
-  }
-
-  // For mixed results, display the succeeded, failed and canceled app lists on
-  // their own lines below the main message with a newline between the message
-  // and lists.
-  const TCHAR* const kLayoutForTwoGroups = _T("%s\n\n%s\n%s");
-  const TCHAR* const kLayoutForThreeGroups = _T("%s\n\n%s\n%s\n%s");
-
-  if (!failed_apps_str.IsEmpty()) {
-    // At least one app fails to install, display a failure message.
-    uint32 message_id =
-        failed_apps.size() == 1 ?
-            IDS_BUNDLE_MIXED_RESULTS_MESSAGE_ONE_FAILURE :
-            IDS_BUNDLE_MIXED_RESULTS_MESSAGE_MULTIPLE_FAILURES;
-    CString message;
-    VERIFY1(message.LoadString(message_id));
-
-    if (!succeeded_apps.empty() && !canceled_apps.empty()) {
-      SafeCStringFormat(&bundle_message, kLayoutForThreeGroups,
-                        message,
-                        succeeded_apps_str,
-                        failed_apps_str,
-                        canceled_apps_str);
-    } else if (!succeeded_apps.empty()) {
-      SafeCStringFormat(&bundle_message, kLayoutForTwoGroups,
-                        message,
-                        succeeded_apps_str,
-                        failed_apps_str);
-    } else if (!canceled_apps.empty()) {
-      SafeCStringFormat(&bundle_message, kLayoutForTwoGroups,
-                        message,
-                        failed_apps_str,
-                        canceled_apps_str);
-    } else {
-      bundle_message = first_failure_message;
-    }
-  } else if (!canceled_apps_str.IsEmpty()) {
-    // No failed app, but some are canceled.
-    if (!succeeded_apps_str.IsEmpty()) {
-      CString message;
-      VERIFY1(message.LoadString(
-          IDS_BUNDLE_INSTALLED_SUCCESSFULLY_AFTER_CANCEL));
-      SafeCStringFormat(&bundle_message, kLayoutForTwoGroups,
-                        message,
-                        succeeded_apps_str,
-                        canceled_apps_str);
-    } else {
-      // Only canceled app, no UI will be displayed.
-      VERIFY1(bundle_message.LoadString(IDS_CANCELED));
-    }
-  } else {
-    // All successes. Display a client-specific completion message that includes
-    // the bundle name.
-    // There is no special handling of apps with noupdate.
-    ASSERT1(succeeded_apps.size() == apps_info.size());
-    ASSERT1(first_failure_message.IsEmpty());
-    if (is_canceled) {
-      VERIFY1(bundle_message.LoadString(
-          IDS_BUNDLE_INSTALLED_SUCCESSFULLY_AFTER_CANCEL));
-    } else if (bundle_name.IsEmpty()) {
-      VERIFY1(
-          bundle_message.LoadString(IDS_APPLICATION_INSTALLED_SUCCESSFULLY));
-    } else {
-      bundle_message.FormatMessage(IDS_BUNDLE_INSTALLED_SUCCESSFULLY,
-                                   bundle_name);
-    }
-  }
-
-  ASSERT1(!bundle_message.IsEmpty());
-  return bundle_message;
-}
-
-}  // namespace internal
-
-BundleInstaller::BundleInstaller(HelpUrlBuilder* help_url_builder,
-                                 bool is_update_all_apps,
-                                 bool is_update_check_only,
-                                 bool is_browser_type_supported)
-    : help_url_builder_(help_url_builder),
-      observer_(NULL),
-      parent_window_(NULL),
-      state_(kInit),
-      result_(E_UNEXPECTED),
-      is_canceled_(false),
-      is_update_all_apps_(is_update_all_apps),
-      is_update_check_only_(is_update_check_only),
-      is_browser_type_supported_(is_browser_type_supported) {
-}
-
-BundleInstaller::~BundleInstaller() {
-  Uninitialize();
-}
-
-LRESULT BundleInstaller::OnTimer(UINT msg,
-                                 WPARAM wparam,
-                                 LPARAM,
-                                 BOOL& handled) {  // NOLINT
-  VERIFY1(msg == WM_TIMER);
-  VERIFY1(wparam == kPollingTimerId);
-
-  // set_observer() must be called before starting the message loop.
-  ASSERT1(observer_);
-
-  if (!PollServer()) {
-    CORE_LOG(L1, (_T("[BundleInstaller::OnTimer][Stopping polling timer]")));
-
-    // Ignore return value. KillTimer does not remove WM_TIMER messages already
-    // posted to the message queue.
-    KillTimer(kPollingTimerId);
-  }
-
-  handled = true;
-  return 0;
-}
-
-HRESULT BundleInstaller::Initialize() {
-  CORE_LOG(L3, (_T("[BundleInstaller::Initialize]")));
-
-  // Create a message-only window for the timer. It is not visible,
-  // has no z-order, cannot be enumerated, and does not receive broadcast
-  // messages. The window simply dispatches messages.
-  const TCHAR kWndName[] = _T("{139455DE-14E2-4d54-93B5-9E6ADDC04B4E}");
-  if (!Create(HWND_MESSAGE, NULL, kWndName)) {
-    return HRESULTFromLastError();
-  }
-
-  if (!SetTimer(kPollingTimerId, kPollingTimerPeriodMs)) {
-    return HRESULTFromLastError();
-  }
-
-  return S_OK;
-}
-
-void BundleInstaller::Uninitialize() {
-  if (IsWindow()) {
-    // This may fail if it was already killed when the bundle completed.
-    KillTimer(kPollingTimerId);
-
-    DestroyWindow();
-  }
-}
-
-void BundleInstaller::SetBundleParentWindow(HWND parent_window) {
-  ASSERT1(parent_window);
-  parent_window_ = parent_window;
-}
-
-HRESULT BundleInstaller::ListenToShutdownEvent(bool is_machine) {
-  ASSERT1(!shutdown_callback_.get());
-  HRESULT hr = ShutdownEvents::CreateShutdownHandler(
-      is_machine, this, address(shutdown_callback_));
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("CreateShutdownHandler failed][0x%08x]"), hr));
-  }
-
-  return hr;
-}
-
-void BundleInstaller::StopListenToShutdownEvent(bool is_machine) {
-  UNREFERENCED_PARAMETER(is_machine);
-  shutdown_callback_.reset();
-}
-
-HRESULT BundleInstaller::InstallBundle(bool is_machine,
-                                       bool listen_to_shutdown_event,
-                                       IAppBundle* app_bundle,
-                                       InstallProgressObserver* observer) {
-  ASSERT1(app_bundle);
-  ASSERT1(!app_bundle_);
-  app_bundle_.Attach(app_bundle);
-  app_bundle_->put_parentHWND(reinterpret_cast<ULONG_PTR>(parent_window_));
-
-  observer_ = observer;
-
-  if (listen_to_shutdown_event) {
-    ListenToShutdownEvent(is_machine);
-  }
-
-  _pAtlModule->Lock();
-
-  message_loop_.Run();
-  CORE_LOG(L2, (_T("[message_loop_.Run() returned]")));
-
-  if (listen_to_shutdown_event) {
-    StopListenToShutdownEvent(is_machine);
-  }
-
-  observer_ = NULL;
-
-  // Installer should not hold any reference to app bundle after installation.
-  ASSERT1(!app_bundle_);
-
-  CORE_LOG(L1, (_T("InstallBundle returning][0x%08x]"), result()));
-  return result();
-}
-
-// Shutdown() is called from a thread in the OS threadpool. The PostMessage
-// marshals the call over to the UI thread, which is where DoClose needs to be
-// (and is) called from.
-LRESULT BundleInstaller::OnClose(UINT,
-                                 WPARAM,
-                                 LPARAM,
-                                 BOOL& handled) {         // NOLINT
-  CORE_LOG(L3, (_T("[BundleInstaller::OnClose]")));
-
-  DoClose();
-  handled = true;
-  return 0;
-}
-
-// Assumes that we can call OnComplete multiple times.
-void BundleInstaller::DoClose() {
-  CORE_LOG(L1, (_T("[BundleInstaller::DoClose]")));
-  if (kComplete != state_) {
-    CORE_LOG(L1,
-             (_T("[UI closed before install completed. Likely canceled.]")));
-    DoCancel();
-  }
-}
-
-void BundleInstaller::DoExit() {
-  CORE_LOG(L1, (_T("[BundleInstaller::DoExit]")));
-  ASSERT(state_ == kComplete, (_T("[State not complete yet, cannot exit!]")));
-
-  _pAtlModule->Unlock();
-}
-
-void BundleInstaller::DoCancel() {
-  CancelBundle();
-  is_canceled_ = true;
-}
-
-// Unless a catastrophic/unrecoverable error occurs, bundle processing should
-// continue, resulting in NotifyBundleInstallComplete() being called and S_OK
-// being returned up the callstack.
-//
-// The following classes of errors can be returned by DoPollServer().
-// * Errors returned by methods in this class (e.g. E_FAIL).
-//   The state_ may already have been set to kComplete
-//   * (e.g. GOOPDATE_E_NO_UPDATE_RESPONSE) or not (e.g. E_FAIL).
-// * Errors returned by utility methods (e.g. by goopdate_utils methods).
-// * COM errors returned due to API or sever failures.
-// * Errors returned by COM methods (e.g. by install()).
-//
-// Specifically note that app errors are not returned up the call stack. These
-// are handled and reported by NotifyBundleInstallComplete().
-//
-// Thus, for all errors returned by DoPollServer() except those returned by COM
-// methods (not property methods), the client knows the error description.
-// TODO(omaha3): What should we do for the COM method errors? There is currently
-// no error API for the bundle. Also, errors returned by these calls may not
-// be Omaha-specific errors. They could be COM errors (e.g. server unavailable),
-// in which case calling a COM method would not work.
-//
-// DoPollServer() handles some client-side errors
-// (e.g. GOOPDATE_E_NO_UPDATE_RESPONSE) by setting state_ to kComplete. All
-// other errors must be handled by calling Complete().
-// In all error cases, the bundle must be canceled.
-bool BundleInstaller::PollServer() {
-  HRESULT hr = DoPollServer();
-
-  // Handle the error unless it has already been handled.
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[DoPollServer failed][0x%08x][%d]"), hr, state_));
-
-    CancelBundle();
-
-    if (state_ != kComplete) {
-      CString message;
-      message.FormatMessage(IDS_INSTALL_FAILED_WITH_ERROR_CODE, hr);
-      BundleCompletionInfo bundle_info(COMPLETION_CODE_ERROR, hr, message);
-      Complete(bundle_info);
-    }
-  }
-
-  return state_ != kComplete;
-}
-
-HRESULT BundleInstaller::result() {
-  ASSERT1(kComplete == state_);
-  return result_;
-}
-
-// Polls the server for the state of the job and updates the UI.
-// Not thread safe. There should only be one installation per process. Do we
-// need to worry about multiple WM_TIMER events at the same time or does the
-// message loop ensure this doesn't happen?
-HRESULT BundleInstaller::DoPollServer() {
-  CORE_LOG(L3, (_T("[BundleInstaller::DoPollServer][%u]"), state_));
-  ASSERT1(observer_);
-  switch (state_) {
-    case kInit:
-      return HandleInitState();
-    case kProcessing:
-      return HandleProcessingState();
-    case kComplete:
-      return S_OK;
-    default:
-      ASSERT1(false);
-      return E_FAIL;
-  }
-}
-
-// Checks whether the update check is complete, and if so, gets the number of
-// apps with updates available.
-HRESULT BundleInstaller::HandleUpdateAvailable() {
-  CORE_LOG(L3, (_T("[BundleInstaller::HandleUpdateAvailable]")));
-  ASSERT1(!apps_.empty());
-  ASSERT1(app_bundle_);
-
-  if (is_update_all_apps_) {
-    // Nothing to do. The bundle will automatically continue on to the download.
-    return S_OK;
-  }
-
-  // The bundle will not automatically continue. Initiate the download and
-  // install if appropriate.
-
-  VARIANT_BOOL is_busy = VARIANT_TRUE;
-  HRESULT hr = app_bundle_->isBusy(&is_busy);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (is_busy) {
-    // An update is available, but other apps may still be being processed.
-    // Wait until bundle is not busy to indicate all apps have been processed.
-    return S_OK;
-  }
-
-  // The only purpose of this call now is to call NotifyUpdateAvailable().
-  int num_updates = 0;
-  hr = HandleUpdateCheckResults(&num_updates);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  CORE_LOG(L2, (_T("[Update check complete][updates: %d]"), num_updates));
-  ASSERT1(num_updates);
-
-  if (is_update_check_only_) {
-    return NotifyBundleUpdateCheckOnlyComplete();
-  }
-
-  // TODO(omaha): Do we handle an unexpected number of apps correctly?
-  // (i.e. apps_.size() != num_updates)
-  // This includes one of n apps reporting no update during an install.
-
-  return app_bundle_->install();
-}
-
-// Populates apps_. This must be done here because updateAllApps() adds apps
-// to app_bundle_.
-HRESULT BundleInstaller::HandleInitState() {
-  CORE_LOG(L3, (_T("[BundleInstaller::HandleInitState]")));
-  ASSERT1(observer_);
-  ASSERT1(app_bundle_);
-
-  state_ = kProcessing;
-  HRESULT hr = is_update_all_apps_ ?
-                   app_bundle_->updateAllApps() :
-                   app_bundle_->checkForUpdate();
-  if (FAILED(hr)) {
-    return hr;
-  }
-  observer_->OnCheckingForUpdate();
-
-  long count = 0;  // NOLINT
-  hr = app_bundle_->get_Count(&count);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  ASSERT1(count > 0);
-
-  for (long i = 0; i != count; ++i) {  // NOLINT
-    CComPtr<IApp> app;
-    hr = update3_utils::GetApp(app_bundle_, i, &app);
-    if (FAILED(hr)) {
-      return hr;
-    }
-    apps_.push_back(AdaptIApp(app));
-  }
-
-  ASSERT1(!apps_.empty());
-  return S_OK;
-}
-
-// Iterates through the apps until it finds one in a non-terminal state.
-// If all apps are in a terminal state, calls NotifyBundleInstallComplete().
-// Assumes that apps are processed serially in order. If this changes, we need
-// to change the algorithm to avoid a bad UI experience.
-// TODO(omaha): For things like creating a log that might be visible in the UI,
-// we would need to guarantee that we always report each major state for each
-// app. This would also require changing this algorithm. In addition, the COM
-// server would need to return information for all previous AppStates
-// (i.e. download progress while in the install phase).
-HRESULT BundleInstaller::HandleProcessingState() {
-  CORE_LOG(L3, (_T("[BundleInstaller::HandleProcessingState]")));
-  ASSERT1(observer_);
-  ASSERT1(!apps_.empty());
-
-  const ComPtrIApp* app_to_process = NULL;
-
-  for (size_t i = 0; i < apps_.size(); ++i) {
-    CurrentState current_state = STATE_INIT;
-    CComPtr<ICurrentState> icurrent_state;
-    const ComPtrIApp& app = apps_[i];
-    HRESULT hr = update3_utils::GetAppCurrentState(app,
-                                                   &current_state,
-                                                   &icurrent_state);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[GetNextVersionState failed][0x%08x]"), hr));
-      return hr;
-    }
-
-    switch (current_state) {
-      case STATE_INSTALL_COMPLETE:
-      case STATE_NO_UPDATE:
-      case STATE_ERROR:
-        // Terminal state - nothing to do for this app. Check the next app.
-        continue;
-      case STATE_WAITING_TO_CHECK_FOR_UPDATE:
-      case STATE_CHECKING_FOR_UPDATE:
-        return S_OK;
-      case STATE_UPDATE_AVAILABLE:
-        return HandleUpdateAvailable();
-      case STATE_WAITING_TO_DOWNLOAD:
-        observer_->OnWaitingToDownload(internal::GetAppDisplayName(app));
-        return S_OK;
-      case STATE_RETRYING_DOWNLOAD:
-        ASSERT(false, (_T("Unsupported")));
-        return S_OK;  // Keep checking in order to be forwards compatible.
-      case STATE_DOWNLOADING:
-      case STATE_DOWNLOAD_COMPLETE:
-      case STATE_EXTRACTING:
-      case STATE_APPLYING_DIFFERENTIAL_PATCH:
-      case STATE_READY_TO_INSTALL:
-        return NotifyDownloadProgress(app, icurrent_state);
-      case STATE_WAITING_TO_INSTALL:
-        return NotifyWaitingToInstall(app);
-      case STATE_INSTALLING:
-        return NotifyInstallProgress(app, icurrent_state);
-      case STATE_PAUSED:
-        ASSERT(false, (_T("Unsupported")));
-        return S_OK;  // Keep checking in order to be forwards compatible.
-      case STATE_INIT:
-      default:
-        ASSERT1(false);
-        return S_OK;  // Keep checking in order to be forwards compatible.
-                      // Cannot support new terminal states, though.
-    }
-  }
-
-  // No apps were in non-terminal states. The bundle may still be busy, though,
-  // because app states are updated separately from the bundle state.
-  // TODO(omaha): Should we wait for the bundle to complete? If not, we may need
-  // to add appropriate waits and checks for any completion UI bundle actions
-  // that require that the AppBundle is not busy.
-
-  return NotifyBundleInstallComplete();
-}
-
-HRESULT BundleInstaller::NotifyUpdateAvailable(IApp* app) {
-  CORE_LOG(L3, (_T("[BundleInstaller::NotifyUpdateAvailable]")));
-  ASSERT1(app);
-  ASSERT1(observer_);
-
-  CComPtr<IAppVersion> next_version;
-  HRESULT hr = update3_utils::GetNextAppVersion(app, &next_version);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CComBSTR ver;
-  hr = next_version->get_version(&ver);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CORE_LOG(L3, (_T("[Next Version Update Available][%s]"), CString(ver)));
-
-  // TODO(omaha3): Until we force app teams to provide a version, the string
-  // may be empty.
-  observer_->OnUpdateAvailable(internal::GetAppDisplayName(app), CString(ver));
-  return S_OK;
-}
-
-HRESULT BundleInstaller::NotifyDownloadProgress(IApp* app,
-                                                ICurrentState* icurrent_state) {
-  CORE_LOG(L3, (_T("[BundleInstaller::NotifyDownloadProgress]")));
-  ASSERT1(icurrent_state);
-  ASSERT1(observer_);
-
-  int time_remaining_ms = kCurrentStateProgressUnknown;
-  int percentage = 0;
-  time64 next_retry_time = 0;
-  GetAppDownloadProgress(icurrent_state,
-                         &time_remaining_ms,
-                         &percentage,
-                         &next_retry_time);
-  if (next_retry_time != 0) {
-    observer_->OnWaitingRetryDownload(internal::GetAppDisplayName(app),
-                                      next_retry_time);
-  } else {
-    observer_->OnDownloading(internal::GetAppDisplayName(app),
-                             time_remaining_ms,
-                             percentage);
-  }
-  return S_OK;
-}
-
-// Starts the install unless the UI prevents the install from starting, in which
-// case it remains in the same state to be checked again next cycle.
-HRESULT BundleInstaller::NotifyWaitingToInstall(IApp* app) {
-  CORE_LOG(L3, (_T("[BundleInstaller::NotifyWaitingToInstall]")));
-  ASSERT1(app);
-  ASSERT1(observer_);
-
-  // can_start_install is ignored because download and install are no longer
-  // discrete phases.
-  bool can_start_install = false;
-  observer_->OnWaitingToInstall(internal::GetAppDisplayName(app),
-                                &can_start_install);
-
-  return S_OK;
-}
-
-HRESULT BundleInstaller::NotifyInstallProgress(IApp* app,
-                                               ICurrentState* icurrent_state) {
-  CORE_LOG(L3, (_T("[BundleInstaller::NotifyInstallProgress]")));
-  ASSERT1(app);
-  ASSERT1(icurrent_state);
-  ASSERT1(observer_);
-
-  // TODO(omaha3): Get the install progress and time for the current app.
-  // Handle kCurrentStateProgressUnknown appropriately.
-  UNREFERENCED_PARAMETER(icurrent_state);
-
-  observer_->OnInstalling(internal::GetAppDisplayName(app));
-
-  return S_OK;
-}
-
-// Only used by legacy OnDemand.
-HRESULT BundleInstaller::NotifyBundleUpdateCheckOnlyComplete() {
-  CORE_LOG(L3, (_T("[BundleInstaller::NotifyBundleUpdateCheckOnlyComplete]")));
-
-  BundleCompletionInfo info(COMPLETION_CODE_SUCCESS,
-                            S_OK,
-                            _T("OK"));  // Not used by legacy OnDemand.
-
-  Complete(info);
-  return S_OK;
-}
-
-// Assumes the AppBundle has completed and all apps are in a terminal state.
-// In other words, AppBundle::Cancel does not need to be called.
-// For now, append the completion message(s) from each app. If any app failed,
-// display the failure UI and set this objects result to the app error.
-// TODO(omaha3): Improve the UI for bundles. It does not currently handle
-// restart browser, etc. Nor is the output production-ready as it just appends
-// the completion strings and assumes L2R. We at least need prettier printing,
-// maybe each message on its own line. Also, our error messages are inconsistent
-// in whether they specify the app's name.
-HRESULT BundleInstaller::NotifyBundleInstallComplete() {
-  CORE_LOG(L3, (_T("[BundleInstaller::NotifyBundleInstallComplete]")));
-  ASSERT1(!apps_.empty());
-  ASSERT1(app_bundle_);
-
-  bool is_only_no_update = true;
-
-  std::vector<AppCompletionInfo> apps_info;
-  HRESULT bundle_result = S_OK;
-
-  // Get the completion info for each app and set the bundle result.
-  for (size_t i = 0; i < apps_.size(); ++i) {
-    const ComPtrIApp& app = apps_[i];
-    AppCompletionInfo app_info;
-    internal::GetAppCompletionMessage(app,
-                                      &app_info,
-                                      is_browser_type_supported_);
-
-    CORE_LOG(L1, (_T("[App completion][%Iu][%s]"), i, app_info.ToString()));
-    apps_info.push_back(app_info);
-
-    is_only_no_update &= app_info.is_noupdate;
-
-    ASSERT1(bundle_result == S_OK || FAILED(bundle_result));
-    if (FAILED(app_info.error_code) && SUCCEEDED(bundle_result)) {
-      // This is the first app failure. Use this as the result.
-      bundle_result = app_info.error_code;
-    }
-  }
-
-  ASSERT1(bundle_result == S_OK || !is_only_no_update);
-
-  CComBSTR bundle_name;
-  if (FAILED(app_bundle_->get_displayName(&bundle_name))) {
-    bundle_name.Empty();
-  }
-
-  CString current_bundle_message = internal::GetBundleCompletionMessage(
-                                       CString(bundle_name),
-                                       apps_info,
-                                       is_only_no_update,
-                                       is_canceled_);
-  ASSERT1(!current_bundle_message.IsEmpty());
-  CompletionCodes completion_code = COMPLETION_CODE_SUCCESS;
-  if (FAILED(bundle_result)) {
-    completion_code = COMPLETION_CODE_ERROR;
-  } else if (is_canceled_) {
-    // User tried to cancel but bundle is installed.
-    completion_code = COMPLETION_CODE_INSTALL_FINISHED_BEFORE_CANCEL;
-  }
-  BundleCompletionInfo bundle_info(completion_code,
-                                   bundle_result,
-                                   current_bundle_message);
-  bundle_info.apps_info = apps_info;  // Copying simplifies the code above.
-
-  // The exit code will be non-zero if any app failed to install.
-  // TODO(omaha3): What if apps have different settings? It seems anyone calling
-  // Omaha would expect to get an error code in this case. We need to make sure
-  // this doesn't cause undesirable behavior in the parent process(es).
-  Complete(bundle_info);
-  return S_OK;
-}
-
-// If an update is available, this method also sets relevant information from
-// the update response.
-// This function, and thus, NotifyUpdateAvailable() is only called if using
-// a phased install where the bundle waits after the update check (in other
-// words, !is_update_all_apps_). Currently, NotifyUpdateAvailable() only does
-// something in the legacy OnDemand case, so this is okay.
-HRESULT BundleInstaller::HandleUpdateCheckResults(int* num_updates) {
-  CORE_LOG(L1, (_T("[BundleInstaller::HandleUpdateCheckResults]")));
-  ASSERT1(num_updates);
-
-  *num_updates = 0;
-
-  for (size_t i = 0; i < apps_.size(); ++i) {
-    CurrentState current_state = STATE_INIT;
-    CComPtr<ICurrentState> icurrent_state;
-    const ComPtrIApp& app = apps_[i];
-    HRESULT hr = update3_utils::GetAppCurrentState(app,
-                                                   &current_state,
-                                                   &icurrent_state);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[GetAppCurrentState failed][0x%08x]"), hr));
-      return hr;
-    }
-
-    if (current_state == STATE_NO_UPDATE || current_state == STATE_ERROR) {
-      // Continue to process other apps.
-      // The error information, if applicable, will be reported elsewhere.
-      continue;
-    } else if (current_state != STATE_UPDATE_AVAILABLE) {
-      // The update check may not be complete or may be in an unexpected state.
-      ASSERT1(false);
-      return E_FAIL;
-    }
-
-    ++*num_updates;
-    VERIFY1(SUCCEEDED(NotifyUpdateAvailable(app)));
-  }
-
-  return S_OK;
-}
-
-// Assumes icurrent_state represents an app in one of the downloading states.
-// TODO(omaha3): Since this method does not check the current state, it's
-// possible to be in Download Complete or later but not report 100%. The server
-// should ensure it reports 100% and 0 time in these cases.
-void BundleInstaller::GetAppDownloadProgress(ICurrentState* icurrent_state,
-                                             int* time_remaining_ms,
-                                             int* percentage,
-                                             time64* next_retry_time) {
-  ASSERT1(icurrent_state);
-  ASSERT1(time_remaining_ms);
-  ASSERT1(percentage);
-
-  LONG local_time_remaining_ms = kCurrentStateProgressUnknown;
-  if (FAILED(icurrent_state->get_downloadTimeRemainingMs(
-          &local_time_remaining_ms))) {
-    local_time_remaining_ms = kCurrentStateProgressUnknown;
-  }
-
-  int local_percentage = 0;
-  ULONG bytes = 0;
-  ULONG bytes_total = 0;
-  if (FAILED(icurrent_state->get_bytesDownloaded(&bytes)) ||
-      FAILED(icurrent_state->get_totalBytesToDownload(&bytes_total))) {
-    local_percentage = 0;
-  } else {
-    ASSERT1(bytes <= bytes_total);
-    local_percentage = static_cast<int>(100ULL * bytes / bytes_total);
-    ASSERT1(0 <= local_percentage && local_percentage <= 100);
-  }
-
-
-  ULONGLONG local_next_retry_time = 0;
-  if (FAILED(icurrent_state->get_nextRetryTime(&local_next_retry_time))) {
-    local_next_retry_time = 0;
-  }
-
-  *time_remaining_ms = local_time_remaining_ms;
-  *percentage = local_percentage;
-  *next_retry_time = static_cast<time64>(local_next_retry_time);
-
-  // TODO(omaha3): For now, this client treats extracting and patching as part
-  // of downloading. Add UI support for these phases.
-
-  CORE_LOG(L4, (_T("[AppDownloadProgress]")
-                _T("[bytes %u][bytes_total %u][percentage %d][ms %d]"),
-                bytes, bytes_total, *percentage, *time_remaining_ms));
-}
-
-void BundleInstaller::CancelBundle() {
-  CORE_LOG(L1, (_T("[BundleInstaller::CancelBundle]")));
-  if (app_bundle_) {
-    VERIFY1(SUCCEEDED(app_bundle_->stop()));
-  }
-}
-
-// error_code is copied to result_, which is the return code for this object.
-void BundleInstaller::Complete(const BundleCompletionInfo& bundle_info) {
-  CORE_LOG(L1, (_T("[BundleInstaller::Complete][%s]"), bundle_info.ToString()));
-  ASSERT1(observer_);
-  ASSERT1(!bundle_info.bundle_completion_message.IsEmpty());
-
-  CString help_url;
-  if (bundle_info.completion_code == COMPLETION_CODE_ERROR) {
-    std::vector<HelpUrlBuilder::AppResult> app_install_results;
-    for (size_t i = 0; i < bundle_info.apps_info.size(); ++i) {
-      const AppCompletionInfo& info = bundle_info.apps_info[i];
-      // TODO(omaha3): Pass info.extra_code to HelpUrlBuilder as well so that
-      // the help URL has both extra code and installer result code.
-      app_install_results.push_back(
-          HelpUrlBuilder::AppResult(info.app_id,
-                                    info.error_code,
-                                    info.installer_result_code));
-    }
-
-    if (help_url_builder_.get()) {
-      VERIFY1(SUCCEEDED(help_url_builder_->BuildUrl(app_install_results,
-                                                    &help_url)));
-      ASSERT1(!help_url.IsEmpty());
-    }
-  }
-
-  // Set result_ and state_ before calling OnComplete on the observer.
-  // Otherwise, we end up calling BundleInstaller::Complete() recursively from
-  // DoClose().
-  result_ = bundle_info.bundle_result;
-  state_ = kComplete;
-
-  ReleaseAppBundle();
-
-  // TODO(omaha3): We need to expose some more items to the observer, such as
-  // install_manifest.install_actions[].success_action. There are a lot of
-  // things we need to expose together: success action, restart browser,
-  // terminate all browsers, url, and maybe others. Let's take
-  // the opportunity to standardize these even if the registry and config APIs
-  // are not ideal (i.e. success_url should not imply an action as it does in
-  // the config).
-
-  ObserverCompletionInfo observer_info(bundle_info.completion_code);
-  // TODO(omaha3): Consider moving the creation of the bundle completion
-  // message from this class to the observer.
-  observer_info.completion_text = bundle_info.bundle_completion_message;
-  observer_info.help_url = help_url;
-  observer_info.apps_info = bundle_info.apps_info;
-
-  observer_->OnComplete(observer_info);
-}
-
-// Omaha event pings are sent in AppBundle destructor. Release app_bundle_ and
-// its related interfaces explicitly so that the pings can be sent sooner.
-void BundleInstaller::ReleaseAppBundle() {
-  CORE_LOG(L3, (_T("[ReleaseAppBundle]")));
-  apps_.clear();
-  app_bundle_ = NULL;
-}
-
-}  // namespace omaha
diff --git a/client/bundle_installer.h b/client/bundle_installer.h
deleted file mode 100644
index 44cc601..0000000
--- a/client/bundle_installer.h
+++ /dev/null
@@ -1,242 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#ifndef OMAHA_CLIENT_BUNDLE_INSTALLER_H_
-#define OMAHA_CLIENT_BUNDLE_INSTALLER_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/wtl_atlapp_wrapper.h"
-#include "goopdate/omaha3_idl.h"
-#include "omaha/client/install_progress_observer.h"
-
-namespace omaha {
-
-// TODO(omaha): These should be declared in their own file.
-namespace internal {
-
-CString GetAppDisplayName(IApp* app);
-
-// Builds a list of app names of the format "one, two, three".
-// TODO(omaha): If this does not end up using AppCompletionInfo, move it to
-// client_utils.
-CString BuildAppNameList(const std::vector<CString>& app_names);
-
-// Helper function that returns the error information from the ICurrentState.
-HRESULT GetCompletionInformation(IApp* app,
-                                 CurrentState* current_state,
-                                 AppCompletionInfo* app_info);
-
-// Gets the completion message for an app.
-void GetAppCompletionMessage(IApp* app,
-                             AppCompletionInfo* app_info);
-
-// Gets the completion message for the bundle.
-// If the bundle name cannot be obtained, pass an empty string in bundle_name.
-// TODO(omaha): If AppCompletionInfo is exposed, maybe move to client_utils.
-CString GetBundleCompletionMessage(
-    const CString& bundle_name,
-    const std::vector<AppCompletionInfo>& apps_info,
-    bool is_only_no_update,
-    bool is_canceled);
-
-}  // namespace internal
-
-class HelpUrlBuilder;
-class ShutdownCallback;
-
-class BundleInstaller
-    : public CWindowImpl<BundleInstaller,
-                         CWindow,
-                         CWinTraits<WS_OVERLAPPED, WS_EX_TOOLWINDOW> > {
- public:
-  // Takes ownership of help_url_builder.
-  BundleInstaller(HelpUrlBuilder* help_url_builder,
-                  bool is_update_all_apps,
-                  bool is_update_check_only,
-                  bool is_browser_type_supported);
-  ~BundleInstaller();
-
-  HRESULT Initialize();
-  void Uninitialize();
-
-  // Installs a bundle. The installer takes the ownership of the bundle and
-  // releases the inteface before function returns.
-  HRESULT InstallBundle(bool is_machine,
-                        bool listen_to_shutdown_event,
-                        IAppBundle* app_bundle,
-                        InstallProgressObserver* observer);
-
-  void SetBundleParentWindow(HWND parent_window);
-
-  // Message loop that pumps messages during installation.
-  CMessageLoop* message_loop() { return &message_loop_; }
-
-  // Handles asynchronous requests for the application to close.
-  void DoClose();
-
-  // Handles requests to exit the BundleInstaller message loop. Should only be
-  // called after the BundleInstaller is in the kComplete state, i.e., after
-  // OnComplete().
-  void DoExit();
-
-  // Handles asynchronous requests to cancel install.
-  void DoCancel();
-
-  // Polls the COM server and advances the install state appropriately.
-  // Returns true if the caller should continue polling.
-  bool PollServer();
-
-  HRESULT result();
-
- private:
-  enum State {
-    kInit,
-    kProcessing,
-    kComplete,
-  };
-
-  // Contains additional information about the bundle completion.
-  struct BundleCompletionInfo {
-    CompletionCodes completion_code;
-    HRESULT bundle_result;  // Result to return up call stack on completion.
-    CString bundle_completion_message;
-    std::vector<AppCompletionInfo> apps_info;
-
-    BundleCompletionInfo(CompletionCodes code,
-                         HRESULT result,
-                         const CString& message)
-        : completion_code(code),
-          bundle_result(result),
-          bundle_completion_message(message) {}
-
-#ifdef DEBUG
-    CString ToString() const {
-      CString result;
-      SafeCStringFormat(&result, _T("[BundleCompletionInfo][%d][0x%x][%s]"),
-                        completion_code,
-                        bundle_result,
-                        bundle_completion_message);
-      for (size_t i = 0; i < apps_info.size(); ++i) {
-        SafeCStringAppendFormat(&result, _T("[%s]"), apps_info[i].ToString());
-      }
-      return result;
-    }
-#endif
-  };
-
-  // Does the work for PollServer.
-  HRESULT DoPollServer();
-
-  // Performs the polling while checking for update.
-  HRESULT HandleUpdateAvailable();
-
-  // Handles the first call to PollServer().
-  HRESULT HandleInitState();
-
-  // Performs all subsequent calls to PollServer() until the state is complete.
-  HRESULT HandleProcessingState();
-
-  // Makes installer listen to the shutdown event.
-  HRESULT ListenToShutdownEvent(bool is_machine);
-
-  // Stops listening to the shutdown event if the installer is currently
-  // listening. Otherwise no effect.
-  void StopListenToShutdownEvent(bool is_machine);
-
-  // These functions update the UI during HandleProcessingState().
-  // TODO(omaha): Rename these to Notify*.
-  HRESULT NotifyUpdateAvailable(IApp* app);
-  HRESULT NotifyDownloadProgress(IApp* app, ICurrentState* icurrent_state);
-  HRESULT NotifyWaitingToInstall(IApp* app);
-  HRESULT NotifyInstallProgress(IApp* app, ICurrentState* icurrent_state);
-  HRESULT NotifyBundleUpdateCheckOnlyComplete();
-  HRESULT NotifyBundleInstallComplete();
-
-  // Helper functions for the Notify* functions.
-  HRESULT HandleUpdateCheckResults(int* num_updates);
-  void GetAppDownloadProgress(ICurrentState* icurrent_state,
-                              int* time_remaining_ms,
-                              int* percentage,
-                              time64* next_retry_time);
-
-  void CancelBundle();
-
-  // Sets the state to complete and informs the UI.
-  void Complete(const BundleCompletionInfo& bundle_info);
-
-  BEGIN_MSG_MAP(BundleInstaller)
-    MESSAGE_HANDLER(WM_CLOSE, OnClose)
-    MESSAGE_HANDLER(WM_TIMER, OnTimer)
-  END_MSG_MAP()
-
-  static const int kPollingTimerId = 1;
-  static const int kPollingTimerPeriodMs = 100;
-
-  // The main use case for this OnClose() handler is the shutdown handler via a
-  // PostMessage in the /UA scenario.
-  LRESULT OnClose(UINT msg,
-                  WPARAM wparam,
-                  LPARAM lparam,
-                  BOOL& handled);  // NOLINT
-
-  // Calls BundleInstaller::PollServer() at periodic intervals.
-  LRESULT OnTimer(UINT msg,
-                  WPARAM wparam,
-                  LPARAM lparam,
-                  BOOL& handled);  // NOLINT
-
-  void ReleaseAppBundle();
-
-  InstallProgressObserver* observer_;
-  scoped_ptr<HelpUrlBuilder> help_url_builder_;
-
-  // The bundle to be installed.
-  CComPtr<IAppBundle> app_bundle_;
-
-  // Bundle parent window.
-  HWND parent_window_;
-
-  // Message loop that pumps messages during installation.
-  CMessageLoop message_loop_;
-
-  // Shutdown event listener.
-  scoped_ptr<ShutdownCallback> shutdown_callback_;
-
-  // The apps in app_bundle_. Allows easier and quicker access to the apps than
-  // going through app_bundle_.
-  typedef CComPtr<IApp> ComPtrIApp;
-  typedef CAdapt<ComPtrIApp> AdaptIApp;
-  std::vector<AdaptIApp> apps_;
-
-  State state_;
-  HRESULT result_;
-  bool is_canceled_;
-
-  const bool is_update_all_apps_;
-  const bool is_update_check_only_;  // Only used by legacy OnDemand.
-  const bool is_browser_type_supported_;
-
-  DISALLOW_IMPLICIT_CONSTRUCTORS(BundleInstaller);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_CLIENT_BUNDLE_INSTALLER_H_
diff --git a/client/bundle_installer_unittest.cc b/client/bundle_installer_unittest.cc
deleted file mode 100644
index d94110b..0000000
--- a/client/bundle_installer_unittest.cc
+++ /dev/null
@@ -1,386 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/error.h"
-#include "omaha/client/bundle_installer.h"
-#include "omaha/client/resource.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-using internal::BuildAppNameList;
-
-class BuildAppNameListTest : public testing::Test {
- public:
- protected:
-  std::vector<CString> app_names_;
-};
-
-TEST_F(BuildAppNameListTest, OneApp) {
-  app_names_.push_back(_T("Test App1"));
-  EXPECT_STREQ(_T("Test App1"), BuildAppNameList(app_names_));
-}
-
-TEST_F(BuildAppNameListTest, TwoApps) {
-  app_names_.push_back(_T("Test App1"));
-  app_names_.push_back(_T("Next App2"));
-  EXPECT_STREQ(_T("Test App1, Next App2"), BuildAppNameList(app_names_));
-}
-
-TEST_F(BuildAppNameListTest, ManyApps) {
-  app_names_.push_back(_T("Test App1"));
-  app_names_.push_back(_T("Next App2"));
-  app_names_.push_back(_T("My App3"));
-  app_names_.push_back(_T("Your App4"));
-  app_names_.push_back(_T("Other App5"));
-  EXPECT_STREQ(_T("Test App1, Next App2, My App3, Your App4, Other App5"),
-               BuildAppNameList(app_names_));
-}
-
-// TODO(omaha): Load "ar" resources and enable after we get translations.
-TEST_F(BuildAppNameListTest, DISABLED_ManyApps_Bidi) {
-  app_names_.push_back(_T("Test App1"));
-  app_names_.push_back(_T("Next App2"));
-  app_names_.push_back(_T("My App3"));
-  app_names_.push_back(_T("Your App4"));
-  app_names_.push_back(_T("Other App5"));
-  EXPECT_STREQ(_T("Other App5, Your App4, My App3, Next App2, Test App1"),
-               BuildAppNameList(app_names_));
-}
-
-class GetBundleCompletionMessageTest : public testing::Test {
- public:
- protected:
-  void AddSucceededAppInfo(int id) {
-    AppCompletionInfo app_info;
-    app_info.display_name.Format(_T("AppSucceeded%d"), id);
-    app_info.app_id.Format(_T("app_id_s_%d"), id);
-    app_info.error_code = 0;
-    app_info.extra_code1 = 0;
-    app_info.completion_message = kSuccessAppCompletionMessage;
-    app_info.installer_result_code = 0;
-    app_info.is_canceled = false;
-    apps_info_.push_back(app_info);
-  }
-
-  void AddFailedAppInfo(int id, bool make_error_info_unique) {
-    AppCompletionInfo app_info;
-    app_info.display_name.Format(_T("AppFailed%d"), id);
-    app_info.app_id.Format(_T("app_id_f_%d"), id);
-    app_info.error_code = 0x80070001;
-    app_info.extra_code1 = 123;
-    app_info.completion_message = kFailedAppCompletionMessage;
-    app_info.installer_result_code = 111;
-    app_info.is_canceled = false;
-    if (make_error_info_unique) {
-      app_info.error_code += id;
-      app_info.completion_message.AppendFormat(_T(" AppName:%s."),
-                                               app_info.display_name);
-      app_info.extra_code1 += id;
-      app_info.installer_result_code += id;
-    }
-
-    apps_info_.push_back(app_info);
-  }
-
-  void AddCanceledAppInfo(int id) {
-    AppCompletionInfo app_info;
-    app_info.display_name.Format(_T("AppCanceled%d"), id);
-    app_info.app_id.Format(_T("app_id_f_%d"), id);
-    app_info.error_code = GOOPDATE_E_CANCELLED;
-    app_info.extra_code1 = 0;
-    app_info.completion_message = kCanceledAppCompletionMessage;
-    app_info.installer_result_code = 0;
-    app_info.is_canceled = true;
-
-    apps_info_.push_back(app_info);
-  }
-
-  static const TCHAR* kBundleDisplayName;
-  static const TCHAR* kSuccessAppCompletionMessage;
-  static const TCHAR* kFailedAppCompletionMessage;
-  static const TCHAR* kCanceledAppCompletionMessage;
-  std::vector<AppCompletionInfo> apps_info_;
-};
-
-const TCHAR* GetBundleCompletionMessageTest::kBundleDisplayName =
-    _T("TestBundle");
-const TCHAR* GetBundleCompletionMessageTest::kSuccessAppCompletionMessage =
-    _T("App is installed successfully and is ready to use.");
-const TCHAR* GetBundleCompletionMessageTest::kFailedAppCompletionMessage =
-    _T("Failed to install the app.");
-const TCHAR* GetBundleCompletionMessageTest::kCanceledAppCompletionMessage =
-    _T("Installation is canceled by user.");
-
-TEST_F(GetBundleCompletionMessageTest, SingleAppSucceeded) {
-  AddSucceededAppInfo(1);
-
-  CString bundle_message = internal::GetBundleCompletionMessage(
-                                       kBundleDisplayName,
-                                       apps_info_,
-                                       false,   // is_only_no_update
-                                       false);  // is_canceled
-  // Bundle install succeeded, the completion message should be based on
-  // IDS_BUNDLE_INSTALLED_SUCCESSFULLY.
-  CString expected_message;
-  expected_message.Format(_T("Thanks for installing %s."), kBundleDisplayName);
-
-  EXPECT_STREQ(expected_message, bundle_message);
-}
-
-TEST_F(GetBundleCompletionMessageTest, MultipleAppsSucceeded) {
-  AddSucceededAppInfo(1);
-  AddSucceededAppInfo(2);
-  AddSucceededAppInfo(3);
-
-  CString bundle_message = internal::GetBundleCompletionMessage(
-                                       kBundleDisplayName,
-                                       apps_info_,
-                                       false,   // is_only_no_update
-                                       false);  // is_canceled
-  // Bundle install succeeded, the completion message should be based on
-  // IDS_BUNDLE_INSTALLED_SUCCESSFULLY.
-  CString expected_message;
-  expected_message.Format(_T("Thanks for installing %s."), kBundleDisplayName);
-
-  EXPECT_STREQ(expected_message, bundle_message);
-}
-
-TEST_F(GetBundleCompletionMessageTest, OneFailedAppWithSuccessApps) {
-  AddSucceededAppInfo(1);
-  AddFailedAppInfo(2, false);
-  AddSucceededAppInfo(3);
-
-  CString bundle_message = internal::GetBundleCompletionMessage(
-                                       kBundleDisplayName,
-                                       apps_info_,
-                                       false,   // is_only_no_update
-                                       false);  // is_canceled
-
-  CString expected_message =
-      _T("An application failed to install.\n\n")
-      _T("<b>Succeeded:</b> AppSucceeded1, AppSucceeded3\n")
-      _T("<b>Failed:</b> AppFailed2");
-  EXPECT_STREQ(expected_message, bundle_message);
-}
-
-TEST_F(GetBundleCompletionMessageTest, MulitpleFailedAppsWithSuccessApps) {
-  AddSucceededAppInfo(1);
-  AddFailedAppInfo(2, false);
-  AddSucceededAppInfo(3);
-  AddFailedAppInfo(4, false);
-  AddFailedAppInfo(5, false);
-
-  CString bundle_message = internal::GetBundleCompletionMessage(
-                                       kBundleDisplayName,
-                                       apps_info_,
-                                       false,   // is_only_no_update
-                                       false);  // is_canceled
-
-  CString expected_message =
-      _T("Some applications failed to install.\n\n")
-      _T("<b>Succeeded:</b> AppSucceeded1, AppSucceeded3\n")
-      _T("<b>Failed:</b> AppFailed2, AppFailed4, AppFailed5");
-  EXPECT_STREQ(expected_message, bundle_message);
-}
-
-TEST_F(GetBundleCompletionMessageTest, OneFailedAppOnly) {
-  AddFailedAppInfo(1, false);
-
-  CString bundle_message = internal::GetBundleCompletionMessage(
-                                       kBundleDisplayName,
-                                       apps_info_,
-                                       false,   // is_only_no_update
-                                       false);  // is_canceled
-
-  EXPECT_STREQ(kFailedAppCompletionMessage, bundle_message);
-}
-
-TEST_F(GetBundleCompletionMessageTest, AllAppsFailWithSameError) {
-  AddFailedAppInfo(1, false);
-  AddFailedAppInfo(2, false);
-  AddFailedAppInfo(3, false);
-
-  CString bundle_message = internal::GetBundleCompletionMessage(
-                                       kBundleDisplayName,
-                                       apps_info_,
-                                       false,   // is_only_no_update
-                                       false);  // is_canceled
-
-  EXPECT_STREQ(kFailedAppCompletionMessage, bundle_message);
-}
-
-
-TEST_F(GetBundleCompletionMessageTest, AllAppsFailWithUniqueError) {
-  AddFailedAppInfo(1, true);
-  AddFailedAppInfo(2, true);
-  AddFailedAppInfo(3, true);
-
-  CString bundle_message = internal::GetBundleCompletionMessage(
-                                       kBundleDisplayName,
-                                       apps_info_,
-                                       false,   // is_only_no_update
-                                       false);  // is_canceled
-
-  CString expected_message = kFailedAppCompletionMessage;
-  expected_message.AppendFormat(_T(" AppName:%s."), apps_info_[0].display_name);
-  EXPECT_STREQ(expected_message, bundle_message);
-}
-
-TEST_F(GetBundleCompletionMessageTest, BundleCanceled) {
-  AddCanceledAppInfo(1);
-  AddCanceledAppInfo(4);
-  AddCanceledAppInfo(7);
-
-  CString bundle_message = internal::GetBundleCompletionMessage(
-                                       kBundleDisplayName,
-                                       apps_info_,
-                                       false,   // is_only_no_update
-                                       true);   // is_canceled
-
-  CString expected_message;
-  EXPECT_TRUE(expected_message.LoadString(IDS_CANCELED));
-  EXPECT_STREQ(expected_message, bundle_message);
-}
-
-TEST_F(GetBundleCompletionMessageTest, AppSucceededAfterCancel) {
-  AddSucceededAppInfo(1);
-
-  CString bundle_message = internal::GetBundleCompletionMessage(
-                                       kBundleDisplayName,
-                                       apps_info_,
-                                       false,   // is_only_no_update
-                                       true);   // is_canceled
-
-  EXPECT_STREQ(_T("Installation completed before it could be canceled."),
-               bundle_message);
-}
-
-TEST_F(GetBundleCompletionMessageTest, AppCanceledWithSuccesses) {
-  AddSucceededAppInfo(1);
-  AddSucceededAppInfo(2);
-  AddSucceededAppInfo(3);
-  AddCanceledAppInfo(4);
-  AddCanceledAppInfo(5);
-
-  CString bundle_message = internal::GetBundleCompletionMessage(
-                                       kBundleDisplayName,
-                                       apps_info_,
-                                       false,   // is_only_no_update
-                                       true);   // is_canceled
-
-  CString expected_message =
-      _T("Installation completed before it could be canceled.\n\n")
-      _T("<b>Succeeded:</b> AppSucceeded1, AppSucceeded2, AppSucceeded3\n")
-      _T("<b>Canceled:</b> AppCanceled4, AppCanceled5");
-  EXPECT_STREQ(expected_message, bundle_message);
-}
-
-TEST_F(GetBundleCompletionMessageTest, AppsCanceledWithSuccessesAndOneFailure) {
-  AddSucceededAppInfo(1);
-  AddSucceededAppInfo(2);
-  AddFailedAppInfo(3, false);
-  AddCanceledAppInfo(4);
-  AddCanceledAppInfo(5);
-  AddCanceledAppInfo(6);
-
-  CString bundle_message = internal::GetBundleCompletionMessage(
-                                       kBundleDisplayName,
-                                       apps_info_,
-                                       false,   // is_only_no_update
-                                       true);   // is_canceled
-  CString expected_message =
-      _T("An application failed to install.\n\n")
-      _T("<b>Succeeded:</b> AppSucceeded1, AppSucceeded2\n")
-      _T("<b>Failed:</b> AppFailed3\n")
-      _T("<b>Canceled:</b> AppCanceled4, AppCanceled5, AppCanceled6");
-  EXPECT_STREQ(expected_message, bundle_message);
-}
-
-TEST_F(GetBundleCompletionMessageTest,
-       AppsCanceledWithSuccessesAndMultipleFailures) {
-  AddSucceededAppInfo(1);
-  AddSucceededAppInfo(2);
-  AddFailedAppInfo(3, false);
-  AddFailedAppInfo(4, false);
-  AddCanceledAppInfo(5);
-  AddCanceledAppInfo(6);
-
-  CString bundle_message = internal::GetBundleCompletionMessage(
-                                       kBundleDisplayName,
-                                       apps_info_,
-                                       false,   // is_only_no_update
-                                       true);   // is_canceled
-
-  CString expected_message =
-      _T("Some applications failed to install.\n\n")
-      _T("<b>Succeeded:</b> AppSucceeded1, AppSucceeded2\n")
-      _T("<b>Failed:</b> AppFailed3, AppFailed4\n")
-      _T("<b>Canceled:</b> AppCanceled5, AppCanceled6");
-  EXPECT_STREQ(expected_message, bundle_message);
-}
-
-TEST_F(GetBundleCompletionMessageTest, AppsCanceledWithOneFailure) {
-  AddFailedAppInfo(1, false);
-  AddCanceledAppInfo(2);
-  AddCanceledAppInfo(3);
-
-  CString bundle_message = internal::GetBundleCompletionMessage(
-                                       kBundleDisplayName,
-                                       apps_info_,
-                                       false,   // is_only_no_update
-                                       true);   // is_canceled
-
-  CString expected_message =
-      _T("An application failed to install.\n\n")
-      _T("<b>Failed:</b> AppFailed1\n")
-      _T("<b>Canceled:</b> AppCanceled2, AppCanceled3");
-  EXPECT_STREQ(expected_message, bundle_message);
-}
-
-TEST_F(GetBundleCompletionMessageTest, AppFailedAfterCancel) {
-  AddFailedAppInfo(1, false);
-
-  CString bundle_message = internal::GetBundleCompletionMessage(
-                                       kBundleDisplayName,
-                                       apps_info_,
-                                       false,   // is_only_no_update
-                                       true);   // is_canceled
-
-  EXPECT_STREQ(kFailedAppCompletionMessage, bundle_message);
-}
-
-TEST_F(GetBundleCompletionMessageTest, AppsCanceledWithMultipleFailures) {
-  AddFailedAppInfo(1, false);
-  AddFailedAppInfo(2, false);
-  AddFailedAppInfo(3, false);
-  AddCanceledAppInfo(4);
-  AddCanceledAppInfo(5);
-  AddCanceledAppInfo(6);
-
-  CString bundle_message = internal::GetBundleCompletionMessage(
-                                       kBundleDisplayName,
-                                       apps_info_,
-                                       false,   // is_only_no_update
-                                       true);   // is_canceled
-
-  CString expected_message =
-      _T("Some applications failed to install.\n\n")
-      _T("<b>Failed:</b> AppFailed1, AppFailed2, AppFailed3\n")
-      _T("<b>Canceled:</b> AppCanceled4, AppCanceled5, AppCanceled6");
-  EXPECT_STREQ(expected_message, bundle_message);
-}
-
-}  // namespace omaha
diff --git a/client/client_metrics.cc b/client/client_metrics.cc
deleted file mode 100644
index 3225110..0000000
--- a/client/client_metrics.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/client/client_metrics.h"
-
-namespace omaha {
-
-DEFINE_METRIC_count(client_another_install_in_progress);
-DEFINE_METRIC_count(client_another_update_in_progress);
-
-}  // namespace omaha
diff --git a/client/client_metrics.h b/client/client_metrics.h
deleted file mode 100644
index 606e0be..0000000
--- a/client/client_metrics.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Declares the usage metrics used by the client module.
-
-#ifndef OMAHA_CLIENT_CLIENT_METRICS_H_
-#define OMAHA_CLIENT_CLIENT_METRICS_H_
-
-#include "omaha/statsreport/metrics.h"
-
-namespace omaha {
-
-// How many times the install client encountered another /install process
-// for the same bundle already running.
-// This metric was named worker_another_install_in_progress in Omaha 2.
-DECLARE_METRIC_count(client_another_install_in_progress);
-
-// How many times the update client encountered another /ua process already
-// running.
-// This metric was named worker_another_install_in_progress in Omaha 2.
-DECLARE_METRIC_count(client_another_update_in_progress);
-
-}  // namespace omaha
-
-#endif  // OMAHA_CLIENT_CLIENT_METRICS_H_
diff --git a/client/client_utils.cc b/client/client_utils.cc
deleted file mode 100644
index ab430d4..0000000
--- a/client/client_utils.cc
+++ /dev/null
@@ -1,192 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/client/client_utils.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/client/help_url_builder.h"
-#include "omaha/common/goopdate_utils.h"
-#include "goopdate/omaha3_idl.h"
-#include "omaha/ui/complete_wnd.h"
-#include "omaha/ui/yes_no_dialog.h"
-
-namespace omaha {
-
-namespace client_utils {
-
-namespace {
-
-// Assumes this is not a silent process.
-// Uses bundle_name in the title if provided; otherwise displays generic title.
-bool DisplayErrorInMessageBox(const CString& error_text,
-                              const CString& bundle_name) {
-  CString msg_box_title = GetInstallerDisplayName(bundle_name);
-  return (0 != ::MessageBox(NULL, error_text, msg_box_title, MB_OK));
-}
-
-class ErrorWndEvents : public CompleteWndEvents {
- public:
-  explicit ErrorWndEvents(bool is_machine) : is_machine_(is_machine) {}
-
-  // TODO(omaha3): Not sure if we need to do anything for DoClose.
-  virtual void DoClose() {}
-
-  virtual void DoExit() {
-    ::PostQuitMessage(0);
-  }
-
-  // TODO(omaha3): Use the specified browser if available.
-  // TODO(omaha3): Need to address elevated Vista installs. We could ask the
-  // non-elevated /install instance to launch the browser for us using some
-  // type of notification pipe like we use for out-of-process crashes.
-  virtual bool DoLaunchBrowser(const CString& url) {
-    CORE_LOG(L2, (_T("[ErrorWndEvents::DoLaunchBrowser %s]"), url));
-    return SUCCEEDED(goopdate_utils::LaunchBrowser(
-        is_machine_, BROWSER_DEFAULT, url));
-  }
-
- private:
-  bool is_machine_;
-
-  DISALLOW_IMPLICIT_CONSTRUCTORS(ErrorWndEvents);
-};
-
-bool CanLaunchBrowser() {
-  if (!vista_util::IsElevatedWithUACMaybeOn()) {
-    return true;
-  }
-
-  CComPtr<IProcessLauncher> launcher;
-  return SUCCEEDED(launcher.CoCreateInstance(CLSID_ProcessLauncherClass,
-                                             NULL,
-                                             CLSCTX_LOCAL_SERVER));
-}
-
-}  // namespace
-
-
-// Assumes this is an interactive instance.
-// If the Omaha UI fails to initialize, displays the error in a message box.
-// Thus, some UI should always be displayed.
-bool DisplayError(bool is_machine,
-                  const CString& bundle_name,
-                  HRESULT error,
-                  int extra_code,
-                  const CString& error_text,
-                  const CString& app_id,
-                  const CString& language_id,
-                  const GUID& iid,
-                  const CString& brand_code) {
-  CMessageLoop message_loop;
-  CompleteWnd error_wnd(&message_loop, NULL);
-
-  error_wnd.set_is_machine(is_machine);
-  error_wnd.set_bundle_name(bundle_name);
-  CString help_url;
-  HelpUrlBuilder url_builder(is_machine, language_id, iid, brand_code);
-  std::vector<HelpUrlBuilder::AppResult> app_install_result;
-  app_install_result.push_back(HelpUrlBuilder::AppResult(app_id,
-                                                         error,
-                                                         extra_code));
-
-  // When running elevated and ProcessLauncherClass is not registered, the
-  // browser launch from the link will fail. Don't display a link that will not
-  // work.
-  if (CanLaunchBrowser()) {
-    VERIFY1(SUCCEEDED(url_builder.BuildUrl(app_install_result, &help_url)));
-  }
-
-  HRESULT hr = error_wnd.Initialize();
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("UI initialize failed][0x%08x]"), hr));
-    bool result = DisplayErrorInMessageBox(error_text, bundle_name);
-    ASSERT1(result);
-    error_wnd.DestroyWindow();  // Window will not get to destroy itself.
-    return result;
-  }
-
-  ErrorWndEvents error_wnd_events(is_machine);
-  // error_wnd_events must not be destroyed until CMessageLoop::Run() returns.
-  error_wnd.SetEventSink(&error_wnd_events);
-
-  error_wnd.Show();
-  error_wnd.DisplayCompletionDialog(false, error_text, help_url);
-  message_loop.Run();
-  return true;
-}
-
-bool DisplayContinueAsNonAdmin(const CString& bundle_name,
-                               bool* should_continue) {
-  ASSERT1(should_continue);
-  *should_continue = false;
-
-  CString title(client_utils::GetInstallerDisplayName(bundle_name));
-  CString text;
-  text.FormatMessage(IDS_CONTINUE_AS_NONADMIN, bundle_name);
-
-  CMessageLoop message_loop;
-  YesNoDialog continue_dialog(&message_loop, NULL);
-  HRESULT hr = continue_dialog.Initialize(title, text);
-
-  if (FAILED(hr)) {
-    int button_id = ::MessageBox(NULL, text, title, MB_YESNO);
-    *should_continue = button_id == IDYES;
-    return button_id != 0;
-  }
-
-  VERIFY1(SUCCEEDED(continue_dialog.Show()));
-  message_loop.Run();
-
-  *should_continue = continue_dialog.yes_clicked();
-  return true;
-}
-
-CString GetDefaultApplicationName() {
-  CString company_name;
-  VERIFY1(company_name.LoadString(IDS_FRIENDLY_COMPANY_NAME));
-
-  CString default_app_name;
-  default_app_name.FormatMessage(IDS_DEFAULT_APP_DISPLAY_NAME, company_name);
-  return default_app_name;
-}
-
-CString GetDefaultBundleName() {
-  return GetDefaultApplicationName();
-}
-
-CString GetUpdateAllAppsBundleName() {
-  // TODO(omaha3): If we ever productize interactive updates, we will need a
-  // different string. This may be okay for the title bar, but it looks weird
-  // in the completion strings. The current implementation uses the same string
-  // for both.
-  return GetDefaultApplicationName();
-}
-
-// If bundle_name is empty, the friendly company name is used.
-CString GetInstallerDisplayName(const CString& bundle_name) {
-  CString display_name = bundle_name;
-  if (display_name.IsEmpty()) {
-    VERIFY1(display_name.LoadString(IDS_FRIENDLY_COMPANY_NAME));
-  }
-
-  CString installer_name;
-  installer_name.FormatMessage(IDS_INSTALLER_DISPLAY_NAME, display_name);
-  return installer_name;
-}
-
-}  // namespace client_utils
-
-}  // namespace omaha
diff --git a/client/client_utils.h b/client/client_utils.h
deleted file mode 100644
index ccaf693..0000000
--- a/client/client_utils.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_CLIENT_CLIENT_UTILS_H_
-#define OMAHA_CLIENT_CLIENT_UTILS_H_
-
-#include <windows.h>
-#include <atlstr.h>
-
-namespace omaha {
-
-namespace client_utils {
-
-// Displays the error message in a new UI instance.
-// Returns whether a UI was successfully displayed. Resources must be loaded.
-bool DisplayError(bool is_machine,
-                  const CString& bundle_name,
-                  HRESULT error,
-                  int extra_code1,
-                  const CString& error_text,
-                  const CString& app_id,
-                  const CString& language_id,
-                  const GUID& iid,
-                  const CString& brand_code);
-
-// Displays a dialog prompting the user to choose to continue with installing
-// the bundle on a per-user basis. should_continue is set to true if the user
-// chooses to proceed.
-// Returns whether a UI was successfully displayed. Resources must be loaded.
-bool DisplayContinueAsNonAdmin(const CString& bundle_name,
-                               bool* should_continue);
-
-CString GetDefaultApplicationName();
-
-CString GetDefaultBundleName();
-
-CString GetUpdateAllAppsBundleName();
-
-CString GetInstallerDisplayName(const CString& bundle_name);
-
-}  // namespace client_utils
-
-}  // namespace omaha
-
-#endif  // OMAHA_CLIENT_CLIENT_UTILS_H_
diff --git a/client/client_utils_unittest.cc b/client/client_utils_unittest.cc
deleted file mode 100644
index 334ecc4..0000000
--- a/client/client_utils_unittest.cc
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/constants.h"
-#include "omaha/client/client_utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace client_utils {
-
-// TODO(omaha): These tests are of questionable value - they just check
-// that the string resources for the language of your dev/build box
-// matches a concatenation of the strings in main.scons.  This means
-// that they're only useful for certain languages, and they add extra
-// hurdles when you're attempting to customize Omaha in its open source
-// form.  We should decide later whether to keep these tests at all -
-// for now, we just enable them on official builds.
-
-#ifdef GOOGLE_UPDATE_BUILD
-TEST(ClientUtilsTest, GetDefaultApplicationName) {
-  EXPECT_STREQ(SHORT_COMPANY_NAME _T(" Application"),
-               GetDefaultApplicationName());
-}
-
-TEST(ClientUtilsTest, GetDefaultBundleName) {
-  EXPECT_STREQ(SHORT_COMPANY_NAME _T(" Application"), GetDefaultBundleName());
-}
-
-TEST(ClientUtilsTest, GetUpdateAllAppsBundleName) {
-  EXPECT_STREQ(SHORT_COMPANY_NAME _T(" Application"),
-               GetUpdateAllAppsBundleName());
-}
-
-TEST(ClientUtilsTest, GetInstallerDisplayName_EmptyBundleName) {
-  EXPECT_STREQ(SHORT_COMPANY_NAME _T(" Installer"),
-               GetInstallerDisplayName(CString()));
-}
-#endif  // GOOGLE_UPDATE_BUILD
-
-TEST(ClientUtilsTest, GetInstallerDisplayName_WithBundleName) {
-  EXPECT_STREQ(_T("My App Installer"), GetInstallerDisplayName(_T("My App")));
-}
-
-}  // namespace client_utils
-
-}  // namespace omaha
diff --git a/client/help_url_builder.cc b/client/help_url_builder.cc
deleted file mode 100644
index dba65f2..0000000
--- a/client/help_url_builder.cc
+++ /dev/null
@@ -1,159 +0,0 @@
-// Copyright 2008 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-#include "omaha/client/help_url_builder.h"
-#include <windows.h>
-#include <atlstr.h>
-#include <vector>
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/goopdate_utils.h"
-#include "goopdate/omaha3_idl.h"
-#include "omaha/net/http_client.h"
-
-namespace omaha {
-
-namespace {
-
-// Query element name-value pair.
-typedef std::pair<CString, CString> QueryElement;
-
-// Builds a query string from the provided name-value pairs.
-// The string does not begin or end in a pair separator.
-HRESULT BuildQueryString(const std::vector<QueryElement>& elements,
-                         CString* query) {
-  ASSERT1(query);
-
-  query->Empty();
-
-  for (size_t i = 0; i < elements.size(); ++i) {
-    CString escaped_str;
-    HRESULT hr = StringEscape(elements[i].second, false, &escaped_str);
-    if (FAILED(hr)) {
-      CORE_LOG(LEVEL_WARNING, (_T("[StringEscape failed][0x%08x]"), hr));
-      return hr;
-    }
-
-    CString element;
-    element.FormatMessage(_T("%1=%2"), elements[i].first, escaped_str);
-
-    if (0 < i) {
-      query->Append(_T("&"));
-    }
-    query->Append(element);
-  }
-
-  return S_OK;
-}
-
-}   // namespace
-
-HRESULT HelpUrlBuilder::BuildUrl(const std::vector<AppResult>& app_results,
-                                 CString* help_url) const {
-  ASSERT1(help_url);
-  help_url->Empty();
-
-  CString more_info_url;
-  VERIFY1(SUCCEEDED(ConfigManager::Instance()->GetMoreInfoUrl(&more_info_url)));
-
-  const TCHAR* const kHelpLinkSourceId = _T("gethelp");
-  HRESULT hr = BuildHttpGetString(more_info_url,
-                                  app_results,
-                                  GetVersionString(),
-                                  kHelpLinkSourceId,
-                                  help_url);
-  if (FAILED(hr)) {
-    // Make sure a failed URL is not displayed.
-    help_url->Empty();
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT HelpUrlBuilder::BuildHttpGetString(
-    const CString& service_url,
-    const std::vector<AppResult>& app_results,
-    const CString& goopdate_version,
-    const CString& source_id,
-    CString* get_request) const {
-  ASSERT1(get_request);
-  if (service_url.IsEmpty()) {
-    return E_INVALIDARG;
-  }
-  ASSERT1(_T('?') == service_url.GetAt(service_url.GetLength() - 1) ||
-          _T('&') == service_url.GetAt(service_url.GetLength() - 1));
-
-  CString os_version;
-  CString service_pack;
-  HRESULT hr = goopdate_utils::GetOSInfo(&os_version, &service_pack);
-  if (FAILED(hr)) {
-    CORE_LOG(LEVEL_WARNING, (_T("[GetOSInfo failed][0x%08x]"), hr));
-  }
-  const CString iid_string =
-      ::IsEqualGUID(GUID_NULL, iid_) ? _T("") : GuidToString(iid_);
-
-  std::vector<QueryElement> elements;
-  elements.push_back(QueryElement(_T("hl"), language_));
-
-  CString error_code_str;
-  CString extra_code_str;
-  CString element_name;
-  for (std::vector<AppResult>::size_type i = 0; i < app_results.size(); ++i) {
-    error_code_str.Format(_T("0x%x"), app_results[i].error_code);
-    extra_code_str.Format(_T("%d"), app_results[i].extra_code);
-    element_name.Format(_T("app.%d"), i);
-    elements.push_back(QueryElement(element_name, app_results[i].guid));
-    element_name.Format(_T("ec.%d"), i);
-    elements.push_back(QueryElement(element_name, error_code_str));
-    element_name.Format(_T("ex.%d"), i);
-    elements.push_back(QueryElement(element_name, extra_code_str));
-  }
-
-  elements.push_back(QueryElement(_T("guver"), goopdate_version));
-  elements.push_back(QueryElement(_T("m"), is_machine_ ? _T("1") : _T("0")));
-  elements.push_back(QueryElement(_T("os"), os_version));
-  elements.push_back(QueryElement(_T("sp"), service_pack));
-  elements.push_back(QueryElement(_T("iid"), iid_string));
-  elements.push_back(QueryElement(_T("brand"), brand_));
-  elements.push_back(QueryElement(_T("source"), source_id));
-
-  CString test_source = ConfigManager::Instance()->GetTestSource();
-  if (!test_source.IsEmpty()) {
-    elements.push_back(QueryElement(_T("testsource"), test_source));
-  }
-
-  CString query;
-  hr = BuildQueryString(elements, &query);
-  if (FAILED(hr)) {
-    CORE_LOG(LEVEL_WARNING, (_T("[BuildQueryString failed][0x%08x]"), hr));
-    return hr;
-  }
-  get_request->FormatMessage(_T("%1%2"), service_url, query);
-
-  // The length should be smaller than the maximum allowed get length.
-  ASSERT1(get_request->GetLength() <= INTERNET_MAX_URL_LENGTH);
-  if (get_request->GetLength() > INTERNET_MAX_URL_LENGTH) {
-    return E_FAIL;
-  }
-
-  return S_OK;
-}
-
-}  // namespace omaha
diff --git a/client/help_url_builder.h b/client/help_url_builder.h
deleted file mode 100644
index a230e47..0000000
--- a/client/help_url_builder.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_CLIENT_HELP_URL_BUILDER_H_
-#define OMAHA_CLIENT_HELP_URL_BUILDER_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include <vector>
-#include "omaha/base/debug.h"
-#include "omaha/common/goopdate_utils.h"
-
-namespace omaha {
-
-class HelpUrlBuilder {
- public:
-  struct AppResult {
-    AppResult(CString app_guid,
-              HRESULT install_error_code,
-              int install_extra_code) :
-        guid(app_guid),
-        error_code(install_error_code),
-        extra_code(install_extra_code) {}
-
-    CString guid;
-    HRESULT error_code;
-    int extra_code;
-  };
-
-  HelpUrlBuilder(bool is_machine,
-                 const CString& language,
-                 const GUID& iid,
-                 const CString& brand) :
-    is_machine_(is_machine),
-    language_(language),
-    iid_(iid),
-    brand_(brand) {}
-
-  HRESULT BuildUrl(const std::vector<AppResult>& app_results,
-                   CString* help_url) const;
-
- private:
-  // Creates the query string based on the passed service_url and arguments.
-  // service_url must end in a '?' or '&'.
-  HRESULT BuildHttpGetString(
-      const CString& service_url,
-      const std::vector<AppResult>& app_results,
-      const CString& goopdate_version,
-      const CString& source_id,
-      CString* get_request) const;
-
- private:
-  const bool is_machine_;
-  const CString language_;
-  const GUID iid_;
-  const CString brand_;
-
-  friend class HelpUrlBuilderTest;
-  DISALLOW_COPY_AND_ASSIGN(HelpUrlBuilder);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_CLIENT_HELP_URL_BUILDER_H_
diff --git a/client/help_url_builder_test.cc b/client/help_url_builder_test.cc
deleted file mode 100644
index d2e4901..0000000
--- a/client/help_url_builder_test.cc
+++ /dev/null
@@ -1,454 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-#include <atlpath.h>
-#include <atlsecurity.h>
-#include <atlstr.h>
-#include <vector>
-#include "omaha/base/error.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/client/help_url_builder.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/net/http_client.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-#define APP_GUID  _T("{B7BAF788-9D64-49c3-AFDC-B336AB12F332}")
-#define APP_GUID2 _T("{6D2DF75B-11F0-41CA-9874-79DE4568527C}")
-const TCHAR* const kAppGuid  = APP_GUID;
-const TCHAR* const kAppGuid2 = APP_GUID2;
-
-const TCHAR kStringAlmostTooLongForUrl[] =
-    _T("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");  // NOLINT
-
-// Verifies that one of the expected OS strings was found in the url.
-// Returns the position along with the length of the OS string.
-int VerifyOSInUrl(const CString& url, int* length) {
-  ASSERT1(length);
-  *length = 0;
-
-  // The strings are in descending version order to avoid breaking on a
-  // substring of the version we are looking for.
-  // TODO(omaha): This is a maintenance problem. Consider eliminating the
-  // "&sp=" at the very least.
-  const TCHAR* kExpectedOsStrings[] = {_T("6.1&sp=Service%20Pack%201"),
-                                       _T("6.1&sp="),
-                                       _T("6.0&sp=Service%20Pack%201"),
-                                       _T("6.0&sp="),
-                                       _T("5.2&sp=Service%20Pack%202"),
-                                       _T("5.2&sp=Service%20Pack%201"),
-                                       _T("5.1&sp=Service%20Pack%203"),
-                                       _T("5.1&sp=Service%20Pack%202"),
-                                      };
-
-  bool found = false;
-  int this_pos = 0;
-
-  for (int i = 0; i < arraysize(kExpectedOsStrings); ++i) {
-    this_pos = url.Find(kExpectedOsStrings[i]);
-    if (-1 != this_pos) {
-      found = true;
-      *length = _tcslen(kExpectedOsStrings[i]);
-      break;
-    }
-  }
-
-  EXPECT_TRUE(found);
-  return this_pos;
-}
-
-}  // namespace
-
-class HelpUrlBuilderTest : public testing::Test {
- protected:
-  HRESULT BuildHttpGetString(
-      const CString& base_url,
-      const std::vector<HelpUrlBuilder::AppResult>& app_results,
-      const CString& goopdate_version,
-      bool is_machine,
-      const CString& language,
-      const GUID& iid,
-      const CString& brand_code,
-      const CString& source_id,
-      CString* get_request) const {
-    HelpUrlBuilder url_builder(is_machine, language, iid, brand_code);
-    return url_builder.BuildHttpGetString(base_url,
-                                          app_results,
-                                          goopdate_version,
-                                          source_id,
-                                          get_request);
-  }
-
-  HelpUrlBuilderTest() : hive_override_key_name_(kRegistryHiveOverrideRoot),
-                         module_version_(GetVersion()) {
-  }
-
-  virtual void SetUp() {
-    RegKey::DeleteKey(hive_override_key_name_, true);
-    OverrideRegistryHives(hive_override_key_name_);
-    InitializeVersion(kFakeVersion);
-  }
-
-  virtual void TearDown() {
-    InitializeVersion(module_version_);
-    RestoreRegistryHives();
-    ASSERT_SUCCEEDED(RegKey::DeleteKey(hive_override_key_name_, true));
-  }
-
-  CString hive_override_key_name_;
-  const ULONGLONG module_version_;
-
-  static const ULONGLONG kFakeVersion = 0x0005000600070008;
-};
-
-TEST_F(HelpUrlBuilderTest, BuildHttpGetString_MachineNoTestSource) {
-  CString expected_str_before_os(
-      _T("http://www.google.com/hello.py?code=123&hl=en&")
-      _T("app.0=%7BB7BAF788-9D64-49c3-AFDC-B336AB12F332%7D&")
-      _T("ec.0=0xa&ex.0=22&")
-      _T("guver=1.0.51.0&m=1&os="));
-  CString expected_str_after_os(
-      _T("&iid=%7B0F973A20-C484-462B-952C-5D9A459E3326%7D")  // Upper case 'B'.
-      _T("&brand=GoOG&source=click"));
-  bool expected_test_source = false;
-
-#if defined(DEBUG) || !OFFICIAL_BUILD
-  // TestSource is always set for these builds. It may be set for opt official
-  // builds but this is not guaranteed.
-  expected_str_after_os.Append(_T("&testsource="));
-  expected_test_source = true;
-#endif
-
-  CString url_req;
-  std::vector<HelpUrlBuilder::AppResult> app_results;
-  app_results.push_back(HelpUrlBuilder::AppResult(kAppGuid, 10, 22));
-  EXPECT_SUCCEEDED(BuildHttpGetString(
-      _T("http://www.google.com/hello.py?code=123&"),
-      app_results,
-      _T("1.0.51.0"),
-      true,
-      _T("en"),
-      StringToGuid(_T("{0F973A20-C484-462b-952C-5D9A459E3326}")),
-      _T("GoOG"),
-      _T("click"),
-      &url_req));
-
-  EXPECT_EQ(-1, url_req.FindOneOf(_T("{}")));
-
-  EXPECT_LE(expected_str_before_os.GetLength(), url_req.GetLength());
-  EXPECT_EQ(0, url_req.Find(expected_str_before_os)) <<
-      _T("Expected: ") << expected_str_before_os.GetString() << std::endl <<
-      _T("At beginning of: ") << url_req.GetString();
-  int os_fragment_len = 0;
-  EXPECT_EQ(expected_str_before_os.GetLength(),
-            VerifyOSInUrl(url_req, &os_fragment_len)) <<
-      _T("Expected OS string not found in: ") << url_req.GetString();
-
-  EXPECT_EQ(expected_str_before_os.GetLength() + os_fragment_len,
-            url_req.Find(expected_str_after_os)) <<
-      _T("Expected: ") << expected_str_after_os.GetString() << std::endl <<
-      _T("At end of: ") << url_req.GetString();
-
-  if (expected_test_source) {
-    CString expected_testsource_str =
-        ConfigManager::Instance()->GetTestSource();
-    int expected_testsource_start = expected_str_before_os.GetLength() +
-                                    os_fragment_len +
-                                    expected_str_after_os.GetLength();
-    EXPECT_EQ(expected_testsource_start, url_req.Find(expected_testsource_str));
-    EXPECT_EQ(expected_testsource_start + expected_testsource_str.GetLength(),
-              url_req.GetLength());
-  } else {
-    EXPECT_EQ(expected_str_before_os.GetLength() +
-              os_fragment_len +
-              expected_str_after_os.GetLength(),
-              url_req.GetLength());
-
-    EXPECT_EQ(-1, url_req.Find(_T("testsource")));
-  }
-}
-
-TEST_F(HelpUrlBuilderTest, BuildHttpGetString_UserWithTestSource) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueTestSource,
-                                    _T("dev")));
-
-  const CString expected_str_before_os(
-      _T("http://www.google.com/hello.py?hl=de&")
-      _T("app.0=%7BB7BAF788-9D64-49c3-AFDC-B336AB12F332%7D&")
-      _T("ec.0=0xffffffff&ex.0=99&")
-      _T("guver=foo%20bar&m=0&os="));
-  const CString expected_str_after_os(
-      _T("&iid=%7B0F973A20-C484-462B-952C-5D9A459E3326%7D")  // Upper case 'B'.
-      _T("&brand=GGLE&source=clack")
-      _T("&testsource="));
-
-  CString url_req;
-  std::vector<HelpUrlBuilder::AppResult> app_results;
-  app_results.push_back(HelpUrlBuilder::AppResult(kAppGuid, 0xffffffff, 99));
-  EXPECT_SUCCEEDED(BuildHttpGetString(
-      _T("http://www.google.com/hello.py?"),
-      app_results,
-      _T("foo bar"),
-      false,
-      _T("de"),
-      StringToGuid(_T("{0F973A20-C484-462b-952C-5D9A459E3326}")),
-      _T("GGLE"),
-      _T("clack"),
-      &url_req));
-  EXPECT_LE(expected_str_before_os.GetLength(), url_req.GetLength());
-  EXPECT_EQ(0, url_req.Find(expected_str_before_os));
-
-  int os_fragment_len = 0;
-  EXPECT_EQ(expected_str_before_os.GetLength(),
-            VerifyOSInUrl(url_req, &os_fragment_len)) <<
-      _T("Expected: ") << expected_str_before_os.GetString() << std::endl <<
-      _T("At beginning of: ") << url_req.GetString();
-
-  EXPECT_EQ(expected_str_before_os.GetLength() + os_fragment_len,
-            url_req.Find(expected_str_after_os)) <<
-      _T("Expected OS string not found in: ") << url_req.GetString();
-
-  const CString expected_testsource_str = _T("dev");
-
-  int expected_testsource_start = expected_str_before_os.GetLength() +
-                                  os_fragment_len +
-                                  expected_str_after_os.GetLength();
-  EXPECT_EQ(expected_testsource_start, url_req.Find(expected_testsource_str));
-  EXPECT_EQ(expected_testsource_start + expected_testsource_str.GetLength(),
-            url_req.GetLength());
-}
-
-// IID and brand code are emtpy if not present.
-TEST_F(HelpUrlBuilderTest, BuildHttpGetString_NoIidOrBrandCode) {
-  const CString expected_str_before_os(
-      _T("http://www.google.com/hello.py?hl=en&")
-      _T("app.0=%7BB7BAF788-9D64-49c3-AFDC-B336AB12F332%7D&")
-      _T("ec.0=0xffffffff&ex.0=99&")
-      _T("guver=foo%20bar&m=1&os="));
-  const CString expected_str_after_os(_T("&iid=&brand=&source=cluck"));
-
-  CString url_req;
-  std::vector<HelpUrlBuilder::AppResult> app_results;
-  app_results.push_back(HelpUrlBuilder::AppResult(
-      _T("{B7BAF788-9D64-49c3-AFDC-B336AB12F332}"), 0xffffffff, 99));
-  EXPECT_SUCCEEDED(BuildHttpGetString(
-      _T("http://www.google.com/hello.py?"),
-      app_results,
-      _T("foo bar"),
-      true,
-      _T("en"),
-      GUID_NULL,
-      _T(""),
-      _T("cluck"),
-      &url_req));
-
-  EXPECT_EQ(0, url_req.Find(expected_str_before_os)) <<
-      _T("Expected: ") << expected_str_before_os.GetString() << std::endl <<
-      _T("At beginning of: ") << url_req.GetString();
-
-  EXPECT_LT(0, url_req.Find(expected_str_after_os));
-
-  CString expected_test_src;
-#if defined(DEBUG) || !OFFICIAL_BUILD
-  expected_test_src = _T("&testsource=auto");
-#endif
-  const CString expected_iid_str(_T("&iid=&brand=&source=cluck"));
-  EXPECT_EQ(url_req.GetLength() -
-            expected_iid_str.GetLength() -
-            expected_test_src.GetLength(),
-            url_req.Find(expected_iid_str));
-}
-
-TEST_F(HelpUrlBuilderTest, BuildHttpGetString_UrlTooLong) {
-  EXPECT_LT(INTERNET_MAX_URL_LENGTH, arraysize(kStringAlmostTooLongForUrl) + 5);
-
-  ExpectAsserts expect_asserts;  // BuildHttpGetString asserts on URL length.
-  CString url_req;
-  std::vector<HelpUrlBuilder::AppResult> app_results;
-  app_results.push_back(HelpUrlBuilder::AppResult(
-      _T("{B7BAF788-9D64-49c3-AFDC-B336AB12F332}"), 0xffffffff, 99));
-  EXPECT_EQ(E_FAIL, BuildHttpGetString(
-      _T("http://www.google.com/hello.py?"),
-      app_results,
-      _T("foo bar"),
-      true,
-      _T("en"),
-      GUID_NULL,
-      _T(""),
-      kStringAlmostTooLongForUrl,
-      &url_req));
-}
-
-TEST_F(HelpUrlBuilderTest, BuildHttpGetString_MultipleApps) {
-  CString expected_str_before_os(
-      _T("http://www.google.com/hello.py?code=123&hl=en&")
-      _T("app.0=%7BB7BAF788-9D64-49c3-AFDC-B336AB12F332%7D&")
-      _T("ec.0=0x80000001&ex.0=1000&")
-      _T("app.1=%7B6D2DF75B-11F0-41CA-9874-79DE4568527C%7D&")
-      _T("ec.1=0x0&ex.1=0&")
-      _T("guver=1.0.51.22&m=1&os="));
-  CString expected_str_after_os(
-      _T("&iid=%7B0F973A20-C484-462B-952C-5D9A459E3326%7D")  // Upper case 'B'.
-      _T("&brand=TEST&source=click"));
-  bool expected_test_source = false;
-
-#if defined(DEBUG) || !OFFICIAL_BUILD
-  // TestSource is always set for these builds. It may be set for opt official
-  // builds but this is not guaranteed.
-  expected_str_after_os.Append(_T("&testsource="));
-  expected_test_source = true;
-#endif
-
-  CString url_req;
-  std::vector<HelpUrlBuilder::AppResult> app_results;
-  app_results.push_back(HelpUrlBuilder::AppResult(kAppGuid, 0x80000001, 1000));
-  app_results.push_back(HelpUrlBuilder::AppResult(kAppGuid2, 0, 0));
-  EXPECT_SUCCEEDED(BuildHttpGetString(
-      _T("http://www.google.com/hello.py?code=123&"),
-      app_results,
-      _T("1.0.51.22"),
-      true,
-      _T("en"),
-      StringToGuid(_T("{0F973A20-C484-462b-952C-5D9A459E3326}")),
-      _T("TEST"),
-      _T("click"),
-      &url_req));
-
-  EXPECT_EQ(-1, url_req.FindOneOf(_T("{}")));
-
-  EXPECT_LE(expected_str_before_os.GetLength(), url_req.GetLength());
-  EXPECT_EQ(0, url_req.Find(expected_str_before_os)) <<
-      _T("Expected: ") << expected_str_before_os.GetString() << std::endl <<
-      _T("At beginning of: ") << url_req.GetString();
-  int os_fragment_len = 0;
-  EXPECT_EQ(expected_str_before_os.GetLength(),
-            VerifyOSInUrl(url_req, &os_fragment_len)) <<
-      _T("Expected OS string not found in: ") << url_req.GetString();
-
-  EXPECT_EQ(expected_str_before_os.GetLength() + os_fragment_len,
-            url_req.Find(expected_str_after_os)) <<
-      _T("Expected: ") << expected_str_after_os.GetString() << std::endl <<
-      _T("At end of: ") << url_req.GetString();
-
-  if (expected_test_source) {
-    CString expected_testsource_str =
-        ConfigManager::Instance()->GetTestSource();
-    int expected_testsource_start = expected_str_before_os.GetLength() +
-                                    os_fragment_len +
-                                    expected_str_after_os.GetLength();
-    EXPECT_EQ(expected_testsource_start, url_req.Find(expected_testsource_str));
-    EXPECT_EQ(expected_testsource_start + expected_testsource_str.GetLength(),
-              url_req.GetLength());
-  } else {
-    EXPECT_EQ(expected_str_before_os.GetLength() +
-              os_fragment_len +
-              expected_str_after_os.GetLength(),
-              url_req.GetLength());
-
-    EXPECT_EQ(-1, url_req.Find(_T("testsource")));
-  }
-}
-
-// Machine ID must be set or it will be randomly generated in some cases.
-TEST_F(HelpUrlBuilderTest, BuildGetHelpUrl_User) {
-  // The URL has a begin, middle which is OS-specific and not checked, and end.
-  const CString kExpetedUrlBegin =
-      _T("http://www.google.com/support/installer/?hl=en-GB&")
-      _T("app.0=%7Btest-user-app-id%7D&ec.0=0x80004005&ex.0=-2147418113&")
-      _T("guver=5.6.7.8&m=0&os=");
-  const CString kExpectedUrlAfterOs = _T("iid=&brand=&source=gethelp")
-#if defined(DEBUG) || !OFFICIAL_BUILD
-      // TestSource is always set for these builds.
-      _T("&testsource=");
-#else
-      // TestSource never set for other builds because registry is overridden.
-      ;  // NOLINT
-#endif
-
-  CString url;
-  HelpUrlBuilder  url_builder(false, _T("en-GB"), GUID_NULL, _T(""));
-  std::vector<HelpUrlBuilder::AppResult> app_results;
-  app_results.push_back(
-      HelpUrlBuilder::AppResult(_T("{test-user-app-id}"),
-                                E_FAIL,
-                                static_cast<DWORD>(E_UNEXPECTED)));
-  EXPECT_SUCCEEDED(url_builder.BuildUrl(app_results, &url));
-
-  EXPECT_STREQ(kExpetedUrlBegin, url.Left(kExpetedUrlBegin.GetLength()));
-  EXPECT_NE(-1, url.Find(kExpectedUrlAfterOs))
-      << kExpectedUrlAfterOs.GetString() << std::endl
-      << _T(" not found in ") << std::endl << url.GetString();
-}
-
-TEST_F(HelpUrlBuilderTest, BuildGetHelpUrl_Machine) {
-  // The URL has a begin, middle which is OS-specific and not checked, and end.
-  const CString kExpetedUrlBegin =
-      _T("http://www.google.com/support/installer/?hl=en-GB&")
-      _T("app.0=%7Btest-machine-app-id%7D&ec.0=0x80004004&ex.0=99&")
-      _T("guver=5.6.7.8&m=1&os=");
-  const CString kExpectedUrlAfterOs =
-      _T("iid=%7B326ADA1D-06AA-4C16-8101-5FC3FEBC852A%7D&")  // Upper case 'C'.
-      _T("brand=GOOG&source=gethelp")
-#if defined(DEBUG) || !OFFICIAL_BUILD
-      // TestSource is always set for these builds.
-      _T("&testsource=");
-#else
-      // TestSource never set for other builds because registry is overridden.
-      ;  // NOLINT
-#endif
-
-  const GUID kIid = StringToGuid(_T("{326ADA1D-06AA-4c16-8101-5FC3FEBC852A}"));
-  CString url;
-  HelpUrlBuilder  url_builder(true, _T("en-GB"), kIid, _T("GOOG"));
-  std::vector<HelpUrlBuilder::AppResult> app_results;
-  app_results.push_back(HelpUrlBuilder::AppResult(_T("{test-machine-app-id}"),
-                                                  E_ABORT,
-                                                  99));
-  EXPECT_SUCCEEDED(url_builder.BuildUrl(app_results, &url));
-
-  EXPECT_STREQ(kExpetedUrlBegin, url.Left(kExpetedUrlBegin.GetLength()));
-  EXPECT_NE(-1, url.Find(kExpectedUrlAfterOs))
-      << kExpectedUrlAfterOs.GetString() << std::endl
-      << _T(" not found in ") << std::endl << url.GetString();
-}
-
-// Makes BuildHttpGetString fail by making the URL too long.
-// The call succeeds, but the url is empty.
-TEST_F(HelpUrlBuilderTest, BuildGetHelpUrl_BuildFails) {
-  EXPECT_LT(INTERNET_MAX_URL_LENGTH, arraysize(kStringAlmostTooLongForUrl) + 5);
-
-  ExpectAsserts expect_asserts;  // BuildHttpGetString asserts on URL length.
-  CString url;
-  HelpUrlBuilder  url_builder(false, _T("en-GB"), GUID_NULL, _T(""));
-  std::vector<HelpUrlBuilder::AppResult> app_results;
-  app_results.push_back(
-      HelpUrlBuilder::AppResult(kStringAlmostTooLongForUrl,
-                                E_FAIL,
-                                static_cast<DWORD>(E_UNEXPECTED)));
-  EXPECT_EQ(E_FAIL, url_builder.BuildUrl(app_results, &url));
-  EXPECT_TRUE(url.IsEmpty());
-}
-
-}  // namespace omaha
diff --git a/client/install.cc b/client/install.cc
deleted file mode 100644
index 7e27ce3..0000000
--- a/client/install.cc
+++ /dev/null
@@ -1,830 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/client/install.h"
-#include "omaha/client/install_internal.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/path.h"
-#include "omaha/base/process.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/string.h"
-#include "omaha/base/time.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/client/client_utils.h"
-#include "omaha/client/install_self.h"
-#include "omaha/client/resource.h"
-#include "omaha/common/app_registry_utils.h"
-#include "omaha/common/command_line_builder.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/common/oem_install_utils.h"
-#include "omaha/common/ping.h"
-#include "omaha/setup/setup_metrics.h"
-#include "omaha/ui/splash_screen.h"
-
-namespace omaha {
-
-namespace {
-
-// Returns whether elevation is required.
-bool IsElevationRequired(bool is_machine) {
-  return is_machine && !vista_util::IsUserAdmin();
-}
-
-}  // namespace
-
-namespace internal {
-
-// TODO(omaha3): Make this elevate the metainstaller instead of
-// GoogleUpdate.exe so the files are extracted to a secure location.
-// May need to add all languages to the metainstaller's version resources so
-// the user sees the localized string in the UAC.
-// TODO(omaha3): We will need to save the metainstaller for OneClick
-// cross-installs. We may need to change the metainstaller behavior to not
-// use the tag if any command line args are provided. This will allow us to
-// reuse a tagged metainstaller that we saved for other purposes, such as
-// OneClick cross-installs.
-// TODO(omaha3): The "metainstaller" may also be some type of wrapper around
-// a differential update. We'll address that later. This wrapper should not
-// need localized resource strings since it always runs silently.
-HRESULT DoElevation(bool is_interactive,
-                    bool is_install_elevated_instance,
-                    const CString& cmd_line,
-                    DWORD* exit_code) {
-  ASSERT1(exit_code);
-  ASSERT1(IsElevationRequired(true));
-
-  if (!is_interactive) {
-    return GOOPDATE_E_SILENT_INSTALL_NEEDS_ELEVATION;
-  }
-
-  if (is_install_elevated_instance) {
-    // This can happen if UAC is disabled. See http://b/1187784.
-    CORE_LOG(LE, (_T("[Install elevated process requires elevation]")));
-    return GOOPDATE_E_INSTALL_ELEVATED_PROCESS_NEEDS_ELEVATION;
-  }
-
-  HRESULT hr = ElevateAndWait(cmd_line, exit_code);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[ElevateAndWait failed][%s][0x%08x]"), cmd_line, hr));
-  }
-
-  return hr;
-}
-
-// Assumes it is running with the necessary privileges.
-HRESULT DoInstall(bool is_machine,
-                  bool is_app_install,
-                  bool is_eula_required,
-                  bool is_oem_install,
-                  const CString& current_version,
-                  const CommandLineArgs& args,
-                  const CString& session_id,
-                  SplashScreen* splash_screen,
-                  int* extra_code1,
-                  bool* has_setup_succeeded,
-                  bool* has_launched_handoff,
-                  bool* has_ui_been_displayed) {
-  ASSERT1(!IsElevationRequired(is_machine));
-  ASSERT1(extra_code1);
-  ASSERT1(splash_screen);
-  ASSERT1(has_setup_succeeded);
-  ASSERT1(has_launched_handoff);
-  ASSERT1(has_ui_been_displayed);
-
-  *extra_code1 = 0;
-
-  // TODO(omaha3): We may need to take an "installing apps" lock here if
-  // is_app_install. There was code in Omaha 2 that relied on the fact that
-  // the Setup lock was held while the install worker was launched, even in
-  // handoff scenarios. This allowed checking for the Setup lock and running
-  // install workers to be sufficient to ensure that the number of Clients keys
-  // was stable. Note that Omaha 2 also held the shutdown event while the worker
-  // was launched.
-  // TODO(omaha3): Consider taking the Setup lock in this file (via a public
-  // method in Setup) and releasing it. This would allow us to address the above
-  // issue and maybe the EULA not accepted issue.
-  // TODO(omaha3): We may also want to call ShouldInstall after a Lock(0) to
-  // determine whether we even need to display the splash screen or we can skip
-  // it and Setup altogether and just launch the /handoff process.
-
-  HRESULT hr = install_self::InstallSelf(is_machine,
-                                         is_eula_required,
-                                         is_oem_install,
-                                         current_version,
-                                         args.install_source,
-                                         args.extra,
-                                         session_id,
-                                         extra_code1);
-  *has_setup_succeeded = SUCCEEDED(hr);
-  if (FAILED(hr)) {
-    OPT_LOG(LE, (_T("[InstallSelf failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  if (!is_app_install) {
-    return S_OK;
-  }
-
-  hr = InstallApplications(is_machine,
-                           is_eula_required,
-                           args,
-                           session_id,
-                           splash_screen,
-                           has_ui_been_displayed,
-                           has_launched_handoff);
-  if (FAILED(hr)) {
-    OPT_LOG(LE, (_T("[InstallApplications failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-};
-
-HRESULT InstallApplications(bool is_machine,
-                            bool is_eula_required,
-                            const CommandLineArgs& args,
-                            const CString& session_id,
-                            SplashScreen* splash_screen,
-                            bool* has_ui_been_displayed,
-                            bool* has_launched_handoff) {
-  ASSERT1(has_ui_been_displayed);
-  ASSERT1(has_launched_handoff);
-
-  *has_launched_handoff = false;
-
-  CString offline_dir;
-  const bool is_offline_install = CopyOfflineFiles(is_machine,
-                                                   args.extra.apps,
-                                                   &offline_dir);
-  if (!is_offline_install && oem_install_utils::IsOemInstalling(is_machine)) {
-    return GOOPDATE_E_OEM_WITH_ONLINE_INSTALLER;
-  }
-  if (!is_offline_install && is_eula_required) {
-    return GOOPDATE_E_EULA_REQURED_WITH_ONLINE_INSTALLER;
-  }
-
-  // Start the handoff to install the app.
-  scoped_process handoff_process;
-  HRESULT hr = LaunchHandoffProcess(is_machine,
-                                    offline_dir,
-                                    args,
-                                    session_id,
-                                    address(handoff_process));
-  if (FAILED(hr)) {
-    OPT_LOG(LE, (_T("[Failed to launch installed instance][0x%08x]"), hr));
-    return hr;
-  }
-
-  *has_launched_handoff = true;
-
-  OPT_LOG(L1, (_T("[Waiting for application install to complete]")));
-  uint32 exit_code(0);
-  hr = WaitForProcessExit(get(handoff_process),
-                          splash_screen,
-                          has_ui_been_displayed,
-                          &exit_code);
-
-  if (FAILED(hr)) {
-    OPT_LOG(LE, (_T("[Failed waiting for app install][0x%08x]"), hr));
-    return hr;
-  }
-  if (exit_code) {
-    OPT_LOG(LE, (_T("[Handoff exited with error][0x%08x]"), exit_code));
-    ASSERT1(FAILED(exit_code));
-    return exit_code;
-  }
-
-  return S_OK;
-}
-
-// The behavior depends on the OS:
-//  1. OS < Vista  : Fail.
-//  2. OS >= Vista : Try to elevate - causes a UAC dialog.
-// We should be here only in case of initial machine installs when the user is
-// not an elevated admin.
-HRESULT ElevateAndWait(const CString& cmd_line, DWORD* exit_code) {
-  OPT_LOG(L1, (_T("[Elevating][%s]"), cmd_line));
-  ASSERT1(!vista_util::IsUserAdmin());
-  ASSERT1(exit_code);
-
-  if (!vista_util::IsVistaOrLater()) {
-    // TODO(omaha): We could consider to ask for credentials here.
-    // This TODO existed in Omaha 1. How would we even do this?
-    CORE_LOG(LE, (_T("[Non Admin trying to install admin app]")));
-    ++metric_setup_machine_app_non_admin;
-    return GOOPDATE_E_NONADMIN_INSTALL_ADMIN_APP;
-  }
-
-  CString cmd_line_elevated(GetCmdLineTail(cmd_line));
-  cmd_line_elevated.AppendFormat(_T(" /%s"), kCmdLineInstallElevated);
-
-  HRESULT hr = goopdate_utils::StartElevatedSelfWithArgsAndWait(
-      cmd_line_elevated, exit_code);
-  if (FAILED(hr)) {
-    OPT_LOG(LE, (_T("[Starting elevated GoogleUpdate.exe failed][%s][0x%08x]"),
-                 cmd_line, hr));
-
-    // TODO(omaha3): Report hr somehow. Was reported in extra code in Omaha 2.
-    if (vista_util::IsUserNonElevatedAdmin()) {
-      return GOOPDATE_E_ELEVATION_FAILED_ADMIN;
-    } else {
-      return GOOPDATE_E_ELEVATION_FAILED_NON_ADMIN;
-    }
-  }
-
-  return S_OK;
-}
-
-bool CopyOfflineFiles(bool is_machine,
-                      const std::vector<CommandLineAppArgs>& apps,
-                      CString* offline_dir) {
-  ASSERT1(offline_dir);
-  offline_dir->Empty();
-
-  if (apps.empty()) {
-    return false;
-  }
-
-  GUID guid(GUID_NULL);
-  VERIFY1(SUCCEEDED(::CoCreateGuid(&guid)));
-  CString parent_offline_dir(
-      is_machine ?
-      ConfigManager::Instance()->GetMachineSecureOfflineStorageDir() :
-      ConfigManager::Instance()->GetUserOfflineStorageDir());
-  CString unique_offline_dir =
-      ConcatenatePath(parent_offline_dir, GuidToString(guid));
-  VERIFY1(SUCCEEDED(CreateDir(unique_offline_dir, NULL)));
-
-  HRESULT hr = CopyOfflineManifest(unique_offline_dir);
-  if (FAILED(hr)) {
-    CORE_LOG(L3, (_T("[CopyOfflineManifest failed][0x%08x]"), hr));
-    return false;
-  }
-
-  for (size_t i = 0; i < apps.size(); ++i) {
-    const GUID& app_id = apps[i].app_guid;
-    HRESULT hr = CopyOfflineFilesForApp(GuidToString(app_id),
-                                        unique_offline_dir);
-    if (FAILED(hr)) {
-      ASSERT(false, (_T("[CopyOfflineFilesForApp failed][0x%08x]"), hr));
-      return false;
-    }
-  }
-
-  CORE_LOG(L3, (_T("[CopyOfflineFiles done][%s]"), unique_offline_dir));
-  *offline_dir = unique_offline_dir;
-  return true;
-}
-
-HRESULT CopyOfflineManifest(const CString& offline_dir) {
-  CORE_LOG(L3, (_T("[CopyOfflineManifest][%s]"), offline_dir));
-
-  // Copy offline manifest into "<offline_dir>\<kOfflineManifestFileName>".
-  CString setup_temp_dir(app_util::GetCurrentModuleDirectory());
-  CString source_manifest_path = ConcatenatePath(setup_temp_dir,
-                                                 kOfflineManifestFileName);
-  if (!File::Exists(source_manifest_path)) {
-    return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
-  }
-  CString dest_manifest_path = ConcatenatePath(offline_dir,
-                                               kOfflineManifestFileName);
-  HRESULT hr = File::Copy(source_manifest_path, dest_manifest_path, true);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[File copy failed][%s][%s][0x%08x]"),
-                   source_manifest_path, dest_manifest_path, hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT CopyOfflineFilesForApp(const CString& app_id,
-                               const CString& offline_dir) {
-  CORE_LOG(L3, (_T("[CopyOfflineFilesForApp][%s][%s]"),
-                 app_id, offline_dir));
-
-  CString setup_temp_dir(app_util::GetCurrentModuleDirectory());
-  CString pattern;
-  // Copy the installer files that are named with the pattern "*.<app_id>" to
-  // the directory "<offline_dir>\<app_id>".
-  pattern.Format(_T("*.%s"), app_id);
-  std::vector<CString> files;
-  HRESULT hr = FindFiles(setup_temp_dir, pattern, &files);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[FindFiles failed][0x%08x]"), hr));
-    return hr;
-  }
-  if (files.empty()) {
-    CORE_LOG(LE, (_T("[FindFiles found no files]")));
-    return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
-  }
-
-  CString offline_app_dir = ConcatenatePath(offline_dir, app_id);
-  if (File::IsDirectory(offline_app_dir)) {
-    VERIFY1(SUCCEEDED(DeleteDirectoryFiles(offline_app_dir)));
-  } else {
-    hr = CreateDir(offline_app_dir, NULL);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[CreateDir failed][%s]"), offline_app_dir));
-      return hr;
-    }
-  }
-
-  for (size_t i = 0; i < files.size(); ++i) {
-    const CString& file_name = files[i];
-    ASSERT1(file_name.GetLength() > app_id.GetLength());
-
-    CPath renamed_file_name(file_name);
-    renamed_file_name.RemoveExtension();
-    ASSERT1(file_name.Left(file_name.GetLength() - app_id.GetLength() - 1) ==
-            static_cast<const CString&>(renamed_file_name));
-    CString new_file_path = ConcatenatePath(offline_app_dir, renamed_file_name);
-    CORE_LOG(L4, (_T("[new_file_path][%s]"), new_file_path));
-
-    CString source_file_path = ConcatenatePath(setup_temp_dir, file_name);
-    hr = File::Copy(source_file_path, new_file_path, true);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[Copy failed][%s][%s]"),
-                    source_file_path, new_file_path));
-      return hr;
-    }
-  }
-
-  return S_OK;
-}
-
-
-// TODO(omaha3): This implementation requires updating this code whenever a
-// new option is added. We could do a string replace of "/install" with
-// "/handoff", but we'd need to remove things such as /oem. Alternatively,
-// allow a CommandLineBuilder to be populated with existing args. Doing
-// replacement would allow us to only pass one copy of the command line to
-// Install() instead of passing both the string and struct. Be sure to handle
-// /appargs when making any changes.
-// TODO(omaha): Extract the command line building and unit test it.
-HRESULT LaunchHandoffProcess(bool is_machine,
-                             const CString& offline_dir,
-                             const CommandLineArgs& install_args,
-                             const CString& session_id,
-                             HANDLE* process) {   // process can be NULL.
-  CORE_LOG(L2, (_T("[LaunchHandoffProcess]")));
-
-  // The install source has been either specified or set to a default value by
-  // the time the execution flow reaches this function. The install source is
-  // propagated to the handoff process except in certain offline install cases,
-  // such as a tagged offline installer or an offline installer that did not
-  // have an install source.
-  //
-  // TODO(omaha): refactor so that the handling of the install source is
-  // encapsulated in just one module.
-  ASSERT1(!install_args.install_source.IsEmpty());
-  ASSERT1(!install_args.extra_args_str.IsEmpty());
-
-  CommandLineBuilder builder(COMMANDLINE_MODE_HANDOFF_INSTALL);
-
-  builder.set_is_silent_set(install_args.is_silent_set);
-  builder.set_is_eula_required_set(install_args.is_eula_required_set);
-  builder.set_extra_args(install_args.extra_args_str);
-  builder.set_app_args(install_args.app_args_str);
-  builder.set_install_source(install_args.install_source);
-  builder.set_session_id(session_id);
-
-  if (!offline_dir.IsEmpty()) {
-    builder.SetOfflineDir(offline_dir);
-    const CString& install_source(install_args.install_source);
-    if (install_source == kCmdLineInstallSource_InstallDefault ||
-        install_source == kCmdLineInstallSource_TaggedMetainstaller) {
-      builder.set_install_source(kCmdLineInstallSource_Offline);
-    }
-  }
-
-  CString cmd_line = builder.GetCommandLineArgs();
-
-  HRESULT hr = goopdate_utils::StartGoogleUpdateWithArgs(is_machine,
-                                                         cmd_line,
-                                                         process);
-  if (FAILED(hr)) {
-    OPT_LOG(LE, (_T("[Google Update hand off failed][%s][0x%08x]"),
-                 cmd_line, hr));
-    // TODO(omaha3): Report hr somehow. Was reported in extra code in Omaha 2.
-    return GOOPDATE_E_HANDOFF_FAILED;
-  }
-
-  return S_OK;
-}
-
-HRESULT WaitForProcessExit(HANDLE process,
-                           SplashScreen* splash_screen,
-                           bool* has_ui_been_displayed,
-                           uint32* exit_code) {
-  CORE_LOG(L3, (_T("[WaitForProcessExit]")));
-  ASSERT1(process);
-  ASSERT1(exit_code);
-  ASSERT1(has_ui_been_displayed);
-  *exit_code = 0;
-
-  int res = ::WaitForInputIdle(process, INFINITE);
-  if (res == 0) {
-    *has_ui_been_displayed = true;
-  }
-  if (splash_screen) {
-    splash_screen->Dismiss();
-  }
-
-  res = ::WaitForSingleObject(process, INFINITE);
-  ASSERT1(WAIT_OBJECT_0 == res);
-  if (WAIT_FAILED == res) {
-    DWORD error = ::GetLastError();
-    CORE_LOG(LE, (_T("[::WaitForMultipleObjects failed][%u]"), error));
-    return HRESULT_FROM_WIN32(error);
-  }
-
-  // Get the exit code.
-  DWORD local_exit_code = 0;
-  if (::GetExitCodeProcess(process, &local_exit_code)) {
-    CORE_LOG(L2, (_T("[process exited][PID %u][exit code 0x%08x]"),
-                  Process::GetProcessIdFromHandle(process), local_exit_code));
-    *exit_code = local_exit_code;
-  } else {
-    DWORD error = ::GetLastError();
-    CORE_LOG(LE, (_T("[::GetExitCodeProcess failed][%u]"), error));
-    return HRESULT_FROM_WIN32(error);
-  }
-
-  return S_OK;
-}
-
-// TODO(omaha): needs to handle errors when loading the strings.
-CString GetErrorText(HRESULT error, const CString& bundle_name) {
-  ASSERT1(!bundle_name.IsEmpty());
-
-  CString error_text;
-
-  switch (error) {
-    case GOOPDATE_E_INSTALL_ELEVATED_PROCESS_NEEDS_ELEVATION:
-    case GOOPDATE_E_NONADMIN_INSTALL_ADMIN_APP:
-      error_text.FormatMessage(IDS_NEED_ADMIN_TO_INSTALL, bundle_name);
-      break;
-    case GOOPDATE_E_ELEVATION_FAILED_ADMIN:
-    case GOOPDATE_E_ELEVATION_FAILED_NON_ADMIN:
-      error_text.FormatMessage(IDS_ELEVATION_FAILED, bundle_name);
-      break;
-    case GOOPDATE_E_FAILED_TO_GET_LOCK:
-    case GOOPDATE_E_FAILED_TO_GET_LOCK_MATCHING_INSTALL_PROCESS_RUNNING:
-    case GOOPDATE_E_FAILED_TO_GET_LOCK_NONMATCHING_INSTALL_PROCESS_RUNNING:
-    case GOOPDATE_E_FAILED_TO_GET_LOCK_UPDATE_PROCESS_RUNNING:
-      {
-        CString company_name;
-        VERIFY1(company_name.LoadString(IDS_FRIENDLY_COMPANY_NAME));
-        error_text.FormatMessage(IDS_APPLICATION_INSTALLING_GOOGLE_UPDATE,
-                                 company_name,
-                                 bundle_name);
-      }
-      break;
-    case GOOPDATE_E_INSTANCES_RUNNING:
-      {
-        CString company_name;
-        VERIFY1(company_name.LoadString(IDS_FRIENDLY_COMPANY_NAME));
-        error_text.FormatMessage(IDS_INSTANCES_RUNNING_AFTER_SHUTDOWN,
-                                 company_name,
-                                 bundle_name);
-      }
-      break;
-    case GOOPDATE_E_RUNNING_INFERIOR_MSXML:
-      error_text.FormatMessage(IDS_WINDOWS_IS_NOT_UP_TO_DATE, bundle_name);
-      break;
-    case GOOPDATE_E_HANDOFF_FAILED:
-      error_text.FormatMessage(IDS_HANDOFF_FAILED, bundle_name);
-      break;
-    default:
-      {
-        CString product_name;
-        VERIFY1(product_name.LoadString(IDS_PRODUCT_DISPLAY_NAME));
-        error_text.FormatMessage(IDS_SETUP_FAILED, product_name, error);
-      }
-      break;
-  }
-
-  return error_text;
-}
-
-// Displays an error in the Google Update UI and sends a ping if allowed.
-void HandleInstallError(HRESULT error,
-                        int extra_code1,
-                        const CString& session_id,
-                        bool is_machine,
-                        bool is_interactive,
-                        bool is_eula_required,
-                        bool is_oem_install,
-                        const CString& current_version,
-                        const CString& install_source,
-                        const CommandLineExtraArgs& extra_args,
-                        bool has_setup_succeeded,
-                        bool has_launched_handoff,
-                        bool* has_ui_been_displayed) {
-  ASSERT1(FAILED(error));
-  ASSERT1(has_ui_been_displayed);
-
-  const CString& bundle_name(extra_args.bundle_name);
-  const CString error_text(GetErrorText(error, bundle_name));
-
-  OPT_LOG(LE, (_T("[Failed to install][0x%08x][%s]"), error, error_text));
-
-  if (is_interactive && !*has_ui_been_displayed) {
-    CString primary_app_id;
-    if (!extra_args.apps.empty()) {
-      primary_app_id = GuidToString(extra_args.apps[0].app_guid);
-    }
-    *has_ui_been_displayed = client_utils::DisplayError(
-                                 is_machine,
-                                 bundle_name,
-                                 error,
-                                 extra_code1,
-                                 error_text,
-                                 primary_app_id,
-                                 extra_args.language,
-                                 extra_args.installation_id,
-                                 extra_args.brand_code);
-  }
-
-  // Send an EVENT_INSTALL_COMPLETE ping for Omaha and wait for the ping to be
-  // sent. This ping may cause a firewall prompt since the process sending the
-  // ping may run from a temporary directory.
-  //
-  // An EVENT_INSTALL_COMPLETE ping for the apps is also sent in the case the
-  /// handoff process did not launch successfully, otherwise, the handoff
-  // process is responsible for sending this ping.
-  //
-  // Setup can fail before setting either eula or oem states in the
-  // registry. Therefore, ConfigManager::CanUseNetwork can't be called yet.
-  if (is_eula_required || is_oem_install) {
-    return;
-  }
-  Ping ping(is_machine, session_id, install_source);
-  ping.LoadAppDataFromExtraArgs(extra_args);
-  if (!has_setup_succeeded) {
-    PingEventPtr setup_install_complete_ping_event(
-        new PingEvent(PingEvent::EVENT_INSTALL_COMPLETE,        //  Type 2.
-                      PingEvent::EVENT_RESULT_ERROR,
-                      error,
-                      extra_code1));
-    const CString next_version(GetVersionString());
-    ping.BuildOmahaPing(current_version,
-                        next_version,
-                        setup_install_complete_ping_event);
-  }
-  if (!has_launched_handoff) {
-    PingEventPtr install_complete_ping_event(
-        new PingEvent(PingEvent::EVENT_INSTALL_COMPLETE,         //  Type 2.
-                      PingEvent::EVENT_RESULT_ERROR,
-                      error,
-                      extra_code1));
-    ping.BuildAppsPing(install_complete_ping_event);
-  }
-  HRESULT hr = ping.Send(false);
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[Ping::Send failed][0x%x]"), hr));
-  }
-}
-
-}  // namespace internal
-
-// This function handles command-line installs. This is the only function that
-// can install Omaha in non-update cases. If elevation is required, the function
-// elevates an instance of Omaha and waits for that instance to exit before
-// returning. If needed, the function starts a handoff process to install the
-// applications and waits for the handoff process to exit.
-//
-// 'install_cmd_line' parameter is the command line for the current instance and
-// used to elevate if necessary.
-// 'args' parameter is the parsed args corresponding to install_cmd_line and it
-// is used to build the handoff command line if necessary.
-HRESULT Install(bool is_interactive,
-                bool is_app_install,
-                bool is_eula_required,
-                bool is_oem_install,
-                bool is_install_elevated_instance,
-                const CString& install_cmd_line,
-                const CommandLineArgs& args,
-                bool* is_machine,
-                bool* has_ui_been_displayed) {
-  ASSERT1(!install_cmd_line.IsEmpty());
-  ASSERT1(is_machine);
-  ASSERT1(has_ui_been_displayed);
-
-  CORE_LOG(L2, (_T("[Install][%d][%d][%s]"),
-                *is_machine, is_interactive, install_cmd_line));
-  ++metric_setup_install_total;
-  if (is_install_elevated_instance) {
-    ++metric_setup_uac_succeeded;
-  }
-
-  if (!*is_machine &&
-      vista_util::IsVistaOrLater() &&
-      vista_util::IsUserAdmin()) {
-    ++metric_setup_user_app_admin;
-  }
-
-  // Allocate a session ID to connect all update checks and pings involved
-  // with this run of Omaha.  This will need to be passed along to any child
-  // processes we create.
-  CString session_id;
-  VERIFY1(SUCCEEDED(GetGuid(&session_id)));
-
-  // 'current_version' corresponds to the value of 'pv' read from
-  // registry. This value is either empty, in the case of a new install or
-  // the version of the installed Omaha before the setup code ran.
-  CString current_version;
-  app_registry_utils::GetAppVersion(*is_machine,
-                                    kGoogleUpdateAppId,
-                                    &current_version);
-
-  bool has_setup_succeeded  = false;
-  bool has_launched_handoff = false;
-
-  if (IsElevationRequired(*is_machine)) {
-    ASSERT1(!ConfigManager::Instance()->IsWindowsInstalling());
-
-    DWORD exit_code = 0;
-    HRESULT hr = internal::DoElevation(is_interactive,
-                                       is_install_elevated_instance,
-                                       install_cmd_line,
-                                       &exit_code);
-
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[DoElevation failed][%s][0x%08x]"),
-                    install_cmd_line, hr));
-
-      bool attempt_per_user_install = false;
-      if (is_interactive &&
-          args.extra.apps[0].needs_admin == NEEDS_ADMIN_PREFERS) {
-        if (hr == GOOPDATE_E_NONADMIN_INSTALL_ADMIN_APP ||
-            hr == GOOPDATE_E_INSTALL_ELEVATED_PROCESS_NEEDS_ELEVATION) {
-          attempt_per_user_install = true;
-        } else {
-          *has_ui_been_displayed = client_utils::DisplayContinueAsNonAdmin(
-              args.extra.bundle_name, &attempt_per_user_install);
-        }
-      }
-
-      if (attempt_per_user_install) {
-        *is_machine = false;
-        CString no_admin_cmd_line(String_ReplaceIgnoreCase(install_cmd_line,
-                                                           kNeedsAdminPrefers,
-                                                           kNeedsAdminNo));
-        CommandLineArgs no_admin_args = args;
-        no_admin_args.extra.apps[0].needs_admin = NEEDS_ADMIN_NO;
-        no_admin_args.extra_args_str = String_ReplaceIgnoreCase(
-            no_admin_args.extra_args_str, kNeedsAdminPrefers, kNeedsAdminNo);
-
-        return Install(is_interactive,
-                       is_app_install,
-                       is_eula_required,
-                       is_oem_install,
-                       is_install_elevated_instance,
-                       no_admin_cmd_line,
-                       no_admin_args,
-                       is_machine,
-                       has_ui_been_displayed);
-      }
-
-      internal::HandleInstallError(hr,
-                                   0,
-                                   session_id,
-                                   *is_machine,
-                                   is_interactive,
-                                   is_eula_required,
-                                   is_oem_install,
-                                   current_version,
-                                   args.install_source,
-                                   args.extra,
-                                   has_setup_succeeded,
-                                   has_launched_handoff,
-                                   has_ui_been_displayed);
-      return hr;
-    }
-
-    // TODO(omaha): waiting for input idle of an elevated process fails if the
-    // caller is not elevated. The code assumes that the elevated process
-    // displays UI if the elevation succeeded. It is possible that the elevated
-    // process ran but had terminated before displaying UI. This is an uncommon
-    // case and for simplicity, it is not handled here.
-    *has_ui_been_displayed = true;
-
-    return exit_code;
-  }
-
-  SplashScreen splash_screen(args.extra.bundle_name);
-  if (is_interactive) {
-    splash_screen.Show();
-  }
-
-  int extra_code1 = 0;
-  HRESULT hr = internal::DoInstall(*is_machine,
-                                   is_app_install,
-                                   is_eula_required,
-                                   is_oem_install,
-                                   current_version,
-                                   args,
-                                   session_id,
-                                   &splash_screen,
-                                   &extra_code1,
-                                   &has_setup_succeeded,
-                                   &has_launched_handoff,
-                                   has_ui_been_displayed);
-  if (is_interactive) {
-    splash_screen.Dismiss();
-  }
-
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[DoInstall failed][0x%08x]"), hr));
-    internal::HandleInstallError(hr,
-                                 extra_code1,
-                                 session_id,
-                                 *is_machine,
-                                 is_interactive,
-                                 is_eula_required,
-                                 is_oem_install,
-                                 current_version,
-                                 args.install_source,
-                                 args.extra,
-                                 has_setup_succeeded,
-                                 has_launched_handoff,
-                                 has_ui_been_displayed);
-    return hr;
-  }
-
-  if (!is_app_install) {
-    // TODO(omaha): Display UI if we want to support interactive Omaha-only
-    // installs.
-    ASSERT1(!is_interactive);
-    // TODO(omaha3): Figure out a way to send a ping from the installed location
-    // for Omaha-only install success.
-  }
-
-  ++metric_setup_install_succeeded;
-  return S_OK;
-}
-
-HRESULT OemInstall(bool is_interactive,
-                   bool is_app_install,
-                   bool is_eula_required,
-                   bool is_install_elevated_instance,
-                   const CString& install_cmd_line,
-                   const CommandLineArgs& args,
-                   bool* is_machine,
-                   bool* has_ui_been_displayed) {
-  ASSERT1(is_machine);
-  ASSERT1(has_ui_been_displayed);
-
-  // OEM is handled as a special case, and the state must be correct before
-  // calling Install().
-  HRESULT hr = oem_install_utils::SetOemInstallState(*is_machine);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[SetOemInstallState failed][0x%x]"), hr));
-    return hr;
-  }
-
-  hr = Install(is_interactive,
-               is_app_install,
-               is_eula_required,
-               true,
-               is_install_elevated_instance,
-               install_cmd_line,
-               args,
-               is_machine,
-               has_ui_been_displayed);
-
-  if (FAILED(hr)) {
-    VERIFY1(SUCCEEDED(oem_install_utils::ResetOemInstallState(*is_machine)));
-    return hr;
-  }
-
-  ASSERT1(oem_install_utils::IsOemInstalling(*is_machine));
-  return S_OK;
-}
-
-}  // namespace omaha
diff --git a/client/install.h b/client/install.h
deleted file mode 100644
index 666b453..0000000
--- a/client/install.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Functions related to the /install process.
-
-#ifndef OMAHA_CLIENT_INSTALL_H_
-#define OMAHA_CLIENT_INSTALL_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include "omaha/common/const_goopdate.h"
-
-namespace omaha {
-
-struct CommandLineArgs;
-
-// Elevates if necessary and then installs.
-HRESULT Install(bool is_interactive,
-                bool is_app_install,
-                bool is_eula_required,
-                bool is_oem_install,
-                bool is_install_elevated_instance,
-                const CString& install_cmd_line,
-                const CommandLineArgs& args,
-                bool* is_machine,
-                bool* has_ui_been_displayed);
-
-// Installs Omaha and/or apps in OEM state.
-HRESULT OemInstall(bool is_interactive,
-                   bool is_app_install,
-                   bool is_eula_required,
-                   bool is_install_elevated_instance,
-                   const CString& install_cmd_line,
-                   const CommandLineArgs& args,
-                   bool* is_machine,
-                   bool* has_ui_been_displayed);
-
-}  // namespace omaha
-
-#endif  // OMAHA_CLIENT_INSTALL_H_
diff --git a/client/install_apps.cc b/client/install_apps.cc
deleted file mode 100644
index b0e0cc5..0000000
--- a/client/install_apps.cc
+++ /dev/null
@@ -1,626 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/client/install_apps.h"
-#include <atlsafe.h>
-#include "base/scoped_ptr.h"
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/reactor.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/shutdown_callback.h"
-#include "omaha/base/shutdown_handler.h"
-#include "omaha/base/string.h"
-#include "omaha/base/time.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vista_utils.h"
-#include "omaha/client/bundle_creator.h"
-#include "omaha/client/bundle_installer.h"
-#include "omaha/client/client_metrics.h"
-#include "omaha/client/client_utils.h"
-#include "omaha/client/help_url_builder.h"
-#include "omaha/client/install_apps_internal.h"
-#include "omaha/client/install_progress_observer.h"
-#include "omaha/client/resource.h"
-#include "omaha/common/command_line.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/common/lang.h"
-#include "omaha/common/ping.h"
-#include "omaha/common/update3_utils.h"
-#include "goopdate/omaha3_idl.h"
-#include "omaha/ui/progress_wnd.h"
-
-namespace omaha {
-
-namespace {
-
-// Implements the UI progress window.
-class SilentProgressObserver : public InstallProgressObserver {
- public:
-  explicit SilentProgressObserver(BundleInstaller* installer)
-      : installer_(installer) {
-    ASSERT1(installer);
-  }
-
-  virtual void OnCheckingForUpdate() {
-    CORE_LOG(L3, (_T("[SilentProgressObserver::OnCheckingForUpdate]")));
-  }
-
-  virtual void OnUpdateAvailable(const CString& app_name,
-                                 const CString& version_string) {
-    CORE_LOG(L3, (_T("[SilentProgressObserver::OnUpdateAvailable][%s][%s]"),
-                  app_name, version_string));
-    UNREFERENCED_PARAMETER(app_name);
-    UNREFERENCED_PARAMETER(version_string);
-  }
-
-  virtual void OnWaitingToDownload(const CString& app_name) {
-    CORE_LOG(L3, (_T("[SilentProgressObserver::OnWaitingToDownload][%s]"),
-                  app_name));
-    UNREFERENCED_PARAMETER(app_name);
-  }
-
-  virtual void OnDownloading(const CString& app_name,
-                             int time_remaining_ms,
-                             int pos) {
-    CORE_LOG(L5, (_T("[SilentProgressObserver::OnDownloading]")
-                  _T("[%s][remaining ms=%d][pos=%d]"),
-                  app_name, time_remaining_ms, pos));
-    UNREFERENCED_PARAMETER(app_name);
-    UNREFERENCED_PARAMETER(time_remaining_ms);
-    UNREFERENCED_PARAMETER(pos);
-  }
-
-  virtual void OnWaitingRetryDownload(const CString& app_name,
-                                      time64 next_retry_time) {
-    CORE_LOG(L5, (_T("[SilentProgressObserver::OnWaitingRetryDownload]")
-                  _T("[%s][next retry time=%llu]"),
-                  app_name, next_retry_time));
-    UNREFERENCED_PARAMETER(app_name);
-    UNREFERENCED_PARAMETER(next_retry_time);
-  }
-
-  virtual void OnWaitingToInstall(const CString& app_name,
-                                  bool* can_start_install) {
-    CORE_LOG(L3, (_T("[SilentProgressObserver::OnWaitingToInstall][%s]"),
-                  app_name));
-    ASSERT1(can_start_install);
-    UNREFERENCED_PARAMETER(app_name);
-    UNREFERENCED_PARAMETER(can_start_install);
-  }
-
-  virtual void OnInstalling(const CString& app_name) {
-    CORE_LOG(L5, (_T("[SilentProgressObserver::OnInstalling][%s]"), app_name));
-    UNREFERENCED_PARAMETER(app_name);
-  }
-
-  virtual void OnPause() {
-    CORE_LOG(L3, (_T("[SilentProgressObserver::OnPause]")));
-  }
-
-  // Terminates the message loop.
-  virtual void OnComplete(const ObserverCompletionInfo& observer_info) {
-    CORE_LOG(L3, (_T("[SilentProgressObserver::OnComplete][%s]"),
-                  observer_info.ToString()));
-    UNREFERENCED_PARAMETER(observer_info);
-
-    installer_->DoExit();
-    CORE_LOG(L1, (_T("[SilentProgressObserver][DoExit() called]")));
-  }
-
- private:
-  BundleInstaller *const installer_;
-};
-
-class OnDemandEvents : public OnDemandEventsInterface {
- public:
-  explicit OnDemandEvents(BundleInstaller* installer)
-      : installer_(installer) {
-    ASSERT1(installer);
-  }
-  virtual void DoClose() {
-    installer_->DoClose();
-  }
-  virtual void DoExit() {
-    installer_->DoExit();
-  }
-
- private:
-  BundleInstaller *const installer_;
-};
-
-// This ATL module is used for BundleInstaller message loop shutdown intrinsics.
-// It is also needed for cases where the Update3 server COM objects are created
-// inproc.
-class BundleAtlModule : public CAtlExeModuleT<BundleAtlModule> {
- public:
-  explicit BundleAtlModule() : allow_post_quit_(false) {
-    // Disable the delay on shutdown mechanism in CAtlExeModuleT.
-    m_bDelayShutdown = false;
-  }
-  ~BundleAtlModule() {}
-
-  LONG Unlock() throw() {
-    LONG lRet = CComGlobalsThreadModel::Decrement(&m_nLockCnt);
-
-    if (lRet == 0 && allow_post_quit_) {
-      ::PostThreadMessage(m_dwMainThreadID, WM_QUIT, 0, 0);
-    }
-
-    return lRet;
-  }
-
-  // BundleAtlModule will only post WM_QUIT if enable_quit() is called, to avoid
-  // spurious WM_QUITs during bundle initialization.
-  void enable_quit() {
-    allow_post_quit_ = true;
-  }
-
- private:
-  bool allow_post_quit_;
-
-  DISALLOW_COPY_AND_ASSIGN(BundleAtlModule);
-};
-
-}  // namespace
-
-namespace internal {
-
-bool IsBrowserRestartSupported(BrowserType browser_type) {
-  return (browser_type != BROWSER_UNKNOWN &&
-          browser_type != BROWSER_DEFAULT &&
-          browser_type < BROWSER_MAX);
-}
-
-InstallAppsWndEvents::InstallAppsWndEvents(bool is_machine,
-                                           BundleInstaller* installer,
-                                           BrowserType browser_type)
-    : is_machine_(is_machine),
-      installer_(installer),
-      browser_type_(browser_type) {
-  ASSERT1(installer_);
-}
-
-void InstallAppsWndEvents::DoClose() {
-  ASSERT1(installer_);
-  installer_->DoClose();
-}
-
-void InstallAppsWndEvents::DoExit() {
-  ASSERT1(installer_);
-  installer_->DoExit();
-}
-
-void InstallAppsWndEvents::DoCancel() {
-  ASSERT1(installer_);
-  installer_->DoCancel();
-}
-
-// TODO(omaha3): Need to address elevated Vista installs. Since we are doing
-// a handoff, we know that Omaha is installed and can do de-elevation.
-// However, BuildGetHelpUrl will return an empty string right now. Best to
-// just solve the general problem.
-bool InstallAppsWndEvents::DoLaunchBrowser(const CString& url) {
-  CORE_LOG(L2, (_T("[InstallAppsWndEvents::DoLaunchBrowser %s]"), url));
-  const BrowserType browser = BROWSER_UNKNOWN == browser_type_ ?
-                              BROWSER_DEFAULT :
-                              browser_type_;
-  return SUCCEEDED(goopdate_utils::LaunchBrowser(is_machine_, browser, url));
-}
-
-// Restarts the browser(s) and returns whether the browser was successfully
-// restarted.
-bool InstallAppsWndEvents::DoRestartBrowser(bool terminate_all_browsers,
-                                            const std::vector<CString>& urls) {
-  // UI should not trigger this call back if the browser type is unknown.
-  // Instead it should ask user to restart the browser(s) manually.
-  ASSERT1(IsBrowserRestartSupported(browser_type_));
-
-  BrowserType browser = browser_type_;
-  if (browser == BROWSER_DEFAULT) {
-    GetDefaultBrowserType(&browser);
-  }
-
-  TerminateBrowserResult browser_res;
-  TerminateBrowserResult default_res;
-  if (terminate_all_browsers) {
-    VERIFY1(SUCCEEDED(goopdate_utils::TerminateAllBrowsers(browser,
-                                                           &browser_res,
-                                                           &default_res)));
-  } else {
-    VERIFY1(SUCCEEDED(goopdate_utils::TerminateBrowserProcesses(browser,
-                                                                &browser_res,
-                                                                &default_res)));
-  }
-
-  BrowserType default_browser_type = BROWSER_UNKNOWN;
-  HRESULT hr = GetDefaultBrowserType(&default_browser_type);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[GetDefaultBrowserType failed][0x%08x]"), hr));
-  }
-
-  BrowserType browser_to_restart = BROWSER_UNKNOWN;
-  if (!goopdate_utils::GetBrowserToRestart(browser,
-                                           default_browser_type,
-                                           browser_res,
-                                           default_res,
-                                           &browser_to_restart)) {
-    CORE_LOG(LE, (_T("[GetBrowserToRestart returned false. Not launching.]")));
-    return false;
-  }
-  ASSERT1(IsBrowserRestartSupported(browser_to_restart));
-
-  bool succeeded = true;
-  for (size_t i = 0; i < urls.size(); ++i) {
-    succeeded &= SUCCEEDED(goopdate_utils::LaunchBrowser(is_machine_,
-                                                         browser_to_restart,
-                                                         urls[i]));
-  }
-
-  return succeeded;
-}
-
-// Initiates a reboot and returns whether it was iniated successfully.
-bool InstallAppsWndEvents::DoReboot() {
-  ASSERT(false, (_T("Not implemented.")));
-  return false;
-}
-
-CString GetBundleDisplayName(IAppBundle* app_bundle) {
-  if (!app_bundle) {
-    return client_utils::GetDefaultBundleName();
-  }
-
-  CComBSTR bundle_name;
-  HRESULT hr = app_bundle->get_displayName(&bundle_name);
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[get_displayName failed][0x%08x]"), hr));
-  }
-
-  return (SUCCEEDED(hr) && bundle_name.Length()) ?
-      CString(bundle_name) : client_utils::GetDefaultBundleName();
-}
-
-HRESULT CreateClientUI(bool is_machine,
-                       BrowserType browser_type,
-                       BundleInstaller* installer,
-                       IAppBundle* app_bundle,
-                       InstallProgressObserver** observer,
-                       OmahaWndEvents** ui_sink) {
-  ASSERT1(installer);
-  ASSERT1(observer);
-  ASSERT1(!*observer);
-  ASSERT1(ui_sink);
-  ASSERT1(!*ui_sink);
-
-  scoped_ptr<ProgressWnd> progress_wnd(
-      new ProgressWnd(installer->message_loop(), NULL));
-  ScopeGuard destroy_window_guard = MakeObjGuard(*progress_wnd,
-                                                 &ProgressWnd::DestroyWindow);
-
-  progress_wnd->set_is_machine(is_machine);
-  progress_wnd->set_bundle_name(internal::GetBundleDisplayName(app_bundle));
-
-  HRESULT hr = progress_wnd->Initialize();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  scoped_ptr<internal::InstallAppsWndEvents> progress_wnd_events(
-      new internal::InstallAppsWndEvents(is_machine, installer, browser_type));
-  progress_wnd->SetEventSink(progress_wnd_events.get());
-
-  progress_wnd->Show();
-  installer->SetBundleParentWindow(progress_wnd->m_hWnd);
-
-  destroy_window_guard.Dismiss();
-  *observer = progress_wnd.release();
-  *ui_sink = progress_wnd_events.release();
-  return S_OK;
-}
-
-// The order of construction is important because it ensures the objects are
-// deleted in a safe order (objects before their dependencies).
-// Any early returns before the message loop is run must call
-// progress_wnd.DestroyWindow(). Errors do not need to be reported in a UI
-// because they are handled further up the call stack.
-HRESULT DoInstallApps(BundleInstaller* installer,
-                      IAppBundle* app_bundle,
-                      bool is_machine,
-                      bool is_interactive,
-                      bool is_update_all_apps,
-                      BrowserType browser_type,
-                      bool* has_ui_been_displayed) {
-  CORE_LOG(L2, (_T("[DoInstallApps]")));
-  ASSERT1(installer);
-  ASSERT1(has_ui_been_displayed);
-
-  scoped_ptr<InstallProgressObserver> observer;
-  scoped_ptr<OmahaWndEvents> ui_sink;
-  bool listen_to_shutdown_event = false;
-
-  CComPtr<IAppBundle> app_bundle_ptr;
-  app_bundle_ptr.Attach(app_bundle);
-
-  HRESULT hr = S_OK;
-  if (is_interactive) {
-    hr = CreateClientUI(is_machine,
-                        browser_type,
-                        installer,
-                        app_bundle,
-                        address(observer),
-                        address(ui_sink));
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("CreateClientUI failed][0x%08x]"), hr));
-      return hr;
-    }
-    *has_ui_been_displayed = true;
-  } else {
-    observer.reset(new SilentProgressObserver(installer));
-    if (is_update_all_apps) {
-      listen_to_shutdown_event = true;
-    }
-  }
-
-  hr = installer->InstallBundle(is_machine,
-                                listen_to_shutdown_event,
-                                app_bundle_ptr.Detach(),
-                                observer.get());
-
-  observer.reset();
-
-  // ui_sink must be destroyed after observer and before installer.
-  ui_sink.reset();
-
-  CORE_LOG(L1, (_T("DoInstallApps returning][0x%08x]"), hr));
-  return hr;
-}
-
-void HandleInstallAppsError(HRESULT error,
-                            int extra_code1,
-                            bool is_machine,
-                            bool is_interactive,
-                            bool is_eula_accepted,
-                            bool is_oem_install,
-                            const CString& install_source,
-                            const CommandLineExtraArgs& extra_args,
-                            const CString& session_id,
-                            bool* has_ui_been_displayed) {
-  ASSERT1(FAILED(error));
-  ASSERT1(has_ui_been_displayed);
-
-  const CString& bundle_name = extra_args.bundle_name;
-  ASSERT1(!bundle_name.IsEmpty());
-
-  CString error_text;
-
-  switch (error) {
-    case GOOPDATE_E_USER_AND_ELEVATED_WITH_UAC_ON:
-      error_text.FormatMessage(IDS_USER_SHOULD_NOT_RUN_ELEVATED_WITH_UAC_ON,
-                               bundle_name);
-      break;
-    default: {
-      CString product_name;
-      VERIFY1(product_name.LoadString(IDS_PRODUCT_DISPLAY_NAME));
-      error_text.FormatMessage(IDS_SETUP_FAILED, product_name, error);
-      break;
-    }
-  }
-
-  OPT_LOG(LE, (_T("[Failed to install apps][0x%08x][%s]"), error, error_text));
-
-  if (is_interactive && !*has_ui_been_displayed) {
-    CString primary_app_id;
-    if (!extra_args.apps.empty()) {
-      primary_app_id = GuidToString(extra_args.apps[0].app_guid);
-    }
-
-    *has_ui_been_displayed = client_utils::DisplayError(
-                                 is_machine,
-                                 bundle_name,
-                                 error,
-                                 extra_code1,
-                                 error_text,
-                                 primary_app_id,
-                                 extra_args.language,
-                                 extra_args.installation_id,
-                                 extra_args.brand_code);
-  }
-
-  if (!is_eula_accepted || is_oem_install) {
-    return;
-  }
-
-  // Send an install complete ping and do not wait for the ping to be sent.
-  // Since Omaha has been installed at this point, it should be able to
-  // send this ping without blocking the user flow.
-  Ping ping(is_machine, session_id, install_source);
-  ping.LoadAppDataFromExtraArgs(extra_args);
-  PingEventPtr ping_event(
-      new PingEvent(PingEvent::EVENT_INSTALL_COMPLETE,
-                    PingEvent::EVENT_RESULT_HANDOFF_ERROR,
-                    error,
-                    extra_code1));
-  ping.BuildAppsPing(ping_event);
-  HRESULT send_result = ping.Send(true);
-  if (FAILED(send_result)) {
-    CORE_LOG(LW, (_T("[Ping::Send failed][0x%x]"), send_result));
-  }
-}
-
-}  // namespace internal
-
-HRESULT UpdateAppOnDemand(bool is_machine,
-                          const CString& app_id,
-                          bool is_update_check_only,
-                          const CString& session_id,
-                          HANDLE impersonation_token,
-                          HANDLE primary_token,
-                          OnDemandObserver* observer) {
-  CORE_LOG(L2, (_T("[UpdateAppOnDemand][%d][%s][%d]"),
-                is_machine, app_id, is_update_check_only));
-
-  const TCHAR* install_source = is_update_check_only ?
-                                kCmdLineInstallSource_OnDemandCheckForUpdate :
-                                kCmdLineInstallSource_OnDemandUpdate;
-  CComPtr<IAppBundle> app_bundle;
-  HRESULT hr = bundle_creator::CreateForOnDemand(is_machine,
-                                                 app_id,
-                                                 install_source,
-                                                 session_id,
-                                                 impersonation_token,
-                                                 primary_token,
-                                                 &app_bundle);
-  if (SUCCEEDED(hr)) {
-    BundleInstaller installer(NULL,   // No help URL for on-demand.
-                              false,  // Is not update all apps.
-                              is_update_check_only,
-                              false);
-    hr = installer.Initialize();
-    if (SUCCEEDED(hr)) {
-      OnDemandEvents install_events(&installer);
-      observer->SetEventSink(&install_events);
-
-      // TODO(omaha3): Listen to shutdown event during installation?
-      return installer.InstallBundle(is_machine,
-                                     false,
-                                     app_bundle.Detach(),
-                                     observer);
-    }
-  }
-
-  // The observer must be notified that the bundle has completed with an error
-  // since the bundle will not be processed.
-  observer->OnComplete(ObserverCompletionInfo(COMPLETION_CODE_ERROR));
-  return hr;
-}
-
-HRESULT InstallApps(bool is_machine,
-                    bool is_interactive,
-                    bool is_eula_accepted,
-                    bool is_oem_install,
-                    bool is_offline,
-                    const CString& offline_directory,
-                    const CommandLineExtraArgs& extra_args,
-                    const CString& install_source,
-                    const CString& session_id,
-                    bool* has_ui_been_displayed) {
-  CORE_LOG(L2, (_T("[InstallApps][is_machine: %u][is_interactive: %u]")
-      _T("[is_eula_accepted: %u][is_oem_install: %u][is_offline: %u]")
-      _T("[offline_directory: %s]"), is_machine, is_interactive,
-      is_eula_accepted, is_oem_install, is_offline, offline_directory));
-  ASSERT1(has_ui_been_displayed);
-
-  BundleAtlModule atl_module;
-
-  CComPtr<IAppBundle> app_bundle;
-  HRESULT hr = bundle_creator::CreateFromCommandLine(is_machine,
-                                                     is_eula_accepted,
-                                                     is_offline,
-                                                     offline_directory,
-                                                     extra_args,
-                                                     install_source,
-                                                     session_id,
-                                                     is_interactive,
-                                                     &app_bundle);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[bundle_creator::CreateFromCommandLine][0x%08x]"), hr));
-    internal::HandleInstallAppsError(hr,
-                                     0,
-                                     is_machine,
-                                     is_interactive,
-                                     is_eula_accepted,
-                                     is_oem_install,
-                                     install_source,
-                                     extra_args,
-                                     session_id,
-                                     has_ui_been_displayed);
-    return hr;
-  }
-
-  BundleInstaller installer(
-      new HelpUrlBuilder(is_machine,
-                         extra_args.language,
-                         extra_args.installation_id,
-                         extra_args.brand_code),
-      false,  //  is_update_all_apps
-      false,  //  is_update_check_only
-      internal::IsBrowserRestartSupported(extra_args.browser_type));
-  hr = installer.Initialize();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  atl_module.enable_quit();
-  return internal::DoInstallApps(&installer,
-                                 app_bundle.Detach(),
-                                 is_machine,
-                                 is_interactive,
-                                 false,  // Is not update all apps.
-                                 extra_args.browser_type,
-                                 has_ui_been_displayed);
-}
-
-HRESULT UpdateAllApps(bool is_machine,
-                      bool is_interactive,
-                      const CString& install_source,
-                      const CString& display_language,
-                      const CString& session_id,
-                      bool* has_ui_been_displayed) {
-  CORE_LOG(L2, (_T("[UpdateAllApps][%u][%u]"), is_machine, is_interactive));
-  ASSERT1(has_ui_been_displayed);
-
-  BundleAtlModule atl_module;
-
-  CComPtr<IAppBundle> app_bundle;
-  HRESULT hr = bundle_creator::Create(is_machine,
-                                      display_language,
-                                      install_source,
-                                      session_id,
-                                      is_interactive,
-                                      &app_bundle);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[bundle_creator::Create failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  BundleInstaller installer(new HelpUrlBuilder(is_machine,
-                                               display_language,
-                                               GUID_NULL,
-                                               CString()),
-                            true,   //  is_update_all_apps
-                            false,  //  is_update_check_only
-                            BROWSER_UNKNOWN);
-  hr = installer.Initialize();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  atl_module.enable_quit();
-  return internal::DoInstallApps(&installer,
-                                 app_bundle.Detach(),
-                                 is_machine,
-                                 is_interactive,
-                                 true,        // Is update all apps.
-                                 BROWSER_UNKNOWN,
-                                 has_ui_been_displayed);
-}
-
-}  // namespace omaha
diff --git a/client/install_apps.h b/client/install_apps.h
deleted file mode 100644
index 46a91fd..0000000
--- a/client/install_apps.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Functions for installing applications.
-
-#ifndef OMAHA_CLIENT_INSTALL_APPS_H_
-#define OMAHA_CLIENT_INSTALL_APPS_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include "omaha/client/install_progress_observer.h"
-
-namespace omaha {
-
-struct CommandLineExtraArgs;
-
-// TODO(omaha): Similar definitions with just DoClose() appear elsewhere.
-// Is there a common name we can give these?
-class OnDemandEventsInterface {
- public:
-  virtual ~OnDemandEventsInterface() {}
-  virtual void DoClose() = 0;
-  virtual void DoExit() = 0;
-};
-
-class OnDemandObserver : public InstallProgressObserver {
- public:
-  virtual void SetEventSink(OnDemandEventsInterface* event_sink) = 0;
-};
-
-// TODO(omaha3): Should these be in a class or namespace?
-
-HRESULT UpdateAppOnDemand(bool is_machine,
-                          const CString& app_id,
-                          bool is_update_check_only,
-                          const CString& session_id,
-                          HANDLE impersonation_token,
-                          HANDLE primary_token,
-                          OnDemandObserver* observer);
-
-HRESULT InstallApps(bool is_machine,
-                    bool is_interactive,
-                    bool is_eula_accepted,
-                    bool is_oem_install,
-                    bool is_offline,
-                    const CString& offline_dir,
-                    const CommandLineExtraArgs& extra_args,
-                    const CString& install_source,
-                    const CString& session_id,
-                    bool* has_ui_been_displayed);
-
-HRESULT UpdateAllApps(bool is_machine,
-                      bool is_interactive,
-                      const CString& install_source,
-                      const CString& display_language,
-                      const CString& session_id,
-                      bool* has_ui_been_displayed);
-
-}  // namespace omaha
-
-#endif  // OMAHA_CLIENT_INSTALL_APPS_H_
diff --git a/client/install_apps_internal.h b/client/install_apps_internal.h
deleted file mode 100644
index 5eb41d6..0000000
--- a/client/install_apps_internal.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#ifndef OMAHA_CLIENT_INSTALL_APPS_INTERNAL_H_
-#define OMAHA_CLIENT_INSTALL_APPS_INTERNAL_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include <vector>
-#include "omaha/base/browser_utils.h"
-#include "goopdate/omaha3_idl.h"
-#include "omaha/ui/progress_wnd.h"
-
-namespace omaha {
-
-class AppBundle;
-class BundleInstaller;
-struct CommandLineExtraArgs;
-
-namespace internal {
-
-// TODO(omaha): Figure out how to handle pause requests.
-class InstallAppsWndEvents : public ProgressWndEvents {
- public:
-  InstallAppsWndEvents(bool is_machine,
-                       BundleInstaller* installer,
-                       BrowserType browser_type);
-
-  virtual void DoClose();
-  virtual void DoExit();
-  virtual void DoCancel();
-  virtual bool DoLaunchBrowser(const CString& url);
-
-  // When a valid browser type is specified in the command line, that type of
-  // browser will be restarted.
-  virtual bool DoRestartBrowser(bool restart_all_browsers,
-                                const std::vector<CString>& urls);
-  virtual bool DoReboot();
-
- private:
-  bool is_machine_;
-  BundleInstaller* installer_;
-  BrowserType browser_type_;
-
-  DISALLOW_IMPLICIT_CONSTRUCTORS(InstallAppsWndEvents);
-};
-
-// On success, the caller takes ownership of observer and ui_sink.
-HRESULT CreateClientUI(bool is_machine,
-                       BrowserType browser_type,
-                       BundleInstaller* installer,
-                       AppBundle* app_bundle,
-                       InstallProgressObserver** observer,
-                       OmahaWndEvents** ui_sink);
-
-// Does the work for InstallApps, allowing the COM server to be mocked.
-HRESULT DoInstallApps(BundleInstaller* installer,
-                      IAppBundle* app_bundle,
-                      bool is_machine,
-                      bool is_interactive,
-                      bool is_update_all_apps,
-                      BrowserType browser_type,
-                      bool* has_ui_been_displayed);
-
-// Displays an error message and reports the error as appropriate.
-void HandleInstallAppsError(HRESULT error,
-                            int extra_code1,
-                            bool is_machine,
-                            bool is_interactive,
-                            bool is_eula_required,
-                            bool is_oem_install,
-                            const CommandLineExtraArgs& extra_args,
-                            bool* has_ui_been_displayed);
-
-}  // namespace internal
-
-}  // namespace omaha
-
-#endif  // OMAHA_CLIENT_INSTALL_APPS_INTERNAL_H_
diff --git a/client/install_apps_unittest.cc b/client/install_apps_unittest.cc
deleted file mode 100644
index 1367346..0000000
--- a/client/install_apps_unittest.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/client/install_apps.h"
-#include "omaha/client/install_apps_internal.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-}  // namespace omaha
diff --git a/client/install_internal.h b/client/install_internal.h
deleted file mode 100644
index 33a2211..0000000
--- a/client/install_internal.h
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_CLIENT_INSTALL_INTERNAL_H_
-#define OMAHA_CLIENT_INSTALL_INTERNAL_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "omaha/common/command_line.h"
-
-namespace omaha {
-
-class SplashScreen;
-
-namespace internal {
-
-// Elevates TBD and waits for it to exit.
-HRESULT DoElevation(bool is_interactive,
-                    bool is_install_elevated_instance,
-                    const CString& cmd_line,
-                    DWORD* exit_code);
-
-// Installs Omaha if necessary and app(s) if is_app_install.
-HRESULT DoInstall(bool is_machine,
-                  bool is_app_install,
-                  bool is_eula_required,
-                  bool is_oem_install,
-                  const CString& current_version,
-                  const CommandLineArgs& args,
-                  const CString& session_id,
-                  SplashScreen* splash_screen,
-                  int* extra_code1,
-                  bool* has_setup_succeeded,
-                  bool* has_launched_handoff,
-                  bool* has_ui_been_displayed);
-
-// Installs the specified applications.
-HRESULT InstallApplications(bool is_machine,
-                            bool is_eula_required,
-                            const CommandLineArgs& args,
-                            const CString& session_id,
-                            SplashScreen* splash_screen,
-                            bool* has_ui_been_displayed,
-                            bool* has_launched_handoff);
-
-// Starts Omaha elevated if possible and waits for it to exit.
-// The same arguments are passed to the elevated instance.
-HRESULT ElevateAndWait(const CString& cmd_line, DWORD* exit_code);
-
-// CopyOfflineManifest() and CopyOfflineFilesForApp() find and copy the offline
-// manifest and offline files respectively, from the current module directory to
-// the offline_dir. offline_dir is typically an unique directory under the
-// Google\Update\Offline\ directory.
-// The offline manifest is copied to offline_dir\<kOfflineManifestFileName>.
-// The binaries are in the format "file.<app_id>". Each file is copied to the
-// offline_dir under the subdirectory "<app_id>", as "file". For instance,
-// "Installer.msi.<app_id>" is copied as "<app_id>/Installer.msi".
-HRESULT CopyOfflineManifest(const CString& offline_dir);
-HRESULT CopyOfflineFilesForApp(const CString& app_id,
-                               const CString& offline_dir);
-
-// For all the applications that have been requested in the apps parameter, copy
-// the offline binaries.
-bool CopyOfflineFiles(bool is_machine,
-                      const std::vector<CommandLineAppArgs>& apps,
-                      CString* offline_dir);
-
-// Launches a /handoff process from the installed location to install the app.
-HRESULT LaunchHandoffProcess(bool is_machine,
-                             const CString& offline_dir,
-                             const CommandLineArgs& install_args,
-                             const CString& session_id,
-                             HANDLE* process);
-
-// Waits for the process to exit and returns the exit code.
-HRESULT WaitForProcessExit(HANDLE process,
-                           SplashScreen* splash_screen,
-                           bool* has_ui_been_displayed,
-                           uint32* exit_code);
-
-// Displays an error message and reports the error as appropriate.
-void HandleInstallError(HRESULT error,
-                        int extra_code1,
-                        const CString& session_id,
-                        bool is_machine,
-                        bool is_interactive,
-                        bool is_eula_required,
-                        bool is_oem_install,
-                        const CString& current_version,
-                        const CString& install_source,
-                        const CommandLineExtraArgs& extra_args,
-                        bool has_setup_succeeded,
-                        bool has_launched_handoff,
-                        bool* has_ui_been_displayed);
-
-// Returns the error text for the corresponding error value.
-CString GetErrorText(HRESULT error, const CString& bundle_name);
-
-}  // namespace internal
-
-}  // namespace omaha
-
-#endif  // OMAHA_CLIENT_INSTALL_INTERNAL_H_
diff --git a/client/install_progress_observer.h b/client/install_progress_observer.h
deleted file mode 100644
index a3b2c1a..0000000
--- a/client/install_progress_observer.h
+++ /dev/null
@@ -1,152 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_CLIENT_INSTALL_PROGRESS_OBSERVER_H_
-#define OMAHA_CLIENT_INSTALL_PROGRESS_OBSERVER_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include <vector>
-
-#include "omaha/base/safe_format.h"
-#include "omaha/base/time.h"
-
-namespace omaha {
-
-// TODO(omaha3): These specify the completion UI to display not the job
-// result as they did in Omaha 2.
-// Some of them may not be necessary depending on how information is
-// communicated to the observer. For example, should the COM API allow reboot/
-// restart browser AND launchcmd?
-// If we keep this enum, rename to something like CompletionTypes to make it
-// clear that it is describing the desired behavior of the observer. This also
-// differentiates the name from LegacyCompetionCodes.
-// TODO(omaha): If the codes below change, need a conversion method to convert
-// to LegacyCompletionCodes.
-typedef enum {
-  COMPLETION_CODE_SUCCESS = 1,
-  COMPLETION_CODE_EXIT_SILENTLY,
-  COMPLETION_CODE_ERROR = COMPLETION_CODE_SUCCESS + 2,
-  COMPLETION_CODE_RESTART_ALL_BROWSERS,
-  COMPLETION_CODE_REBOOT,
-  COMPLETION_CODE_RESTART_BROWSER,
-  COMPLETION_CODE_RESTART_ALL_BROWSERS_NOTICE_ONLY,
-  COMPLETION_CODE_REBOOT_NOTICE_ONLY,
-  COMPLETION_CODE_RESTART_BROWSER_NOTICE_ONLY,
-  COMPLETION_CODE_LAUNCH_COMMAND,
-  COMPLETION_CODE_EXIT_SILENTLY_ON_LAUNCH_COMMAND,
-  COMPLETION_CODE_INSTALL_FINISHED_BEFORE_CANCEL,
-} CompletionCodes;
-
-inline bool IsCompletionCodeSuccess(CompletionCodes completion_code) {
-  switch (completion_code) {
-    case COMPLETION_CODE_SUCCESS:
-    case COMPLETION_CODE_EXIT_SILENTLY:
-    case COMPLETION_CODE_RESTART_ALL_BROWSERS:
-    case COMPLETION_CODE_REBOOT:
-    case COMPLETION_CODE_RESTART_BROWSER:
-    case COMPLETION_CODE_RESTART_ALL_BROWSERS_NOTICE_ONLY:
-    case COMPLETION_CODE_REBOOT_NOTICE_ONLY:
-    case COMPLETION_CODE_RESTART_BROWSER_NOTICE_ONLY:
-    case COMPLETION_CODE_LAUNCH_COMMAND:
-    case COMPLETION_CODE_EXIT_SILENTLY_ON_LAUNCH_COMMAND:
-    case COMPLETION_CODE_INSTALL_FINISHED_BEFORE_CANCEL:
-      return true;
-
-    case COMPLETION_CODE_ERROR:
-    default:
-      return false;
-  }
-}
-
-struct AppCompletionInfo {
-  CString display_name;
-  CString app_id;
-  CString completion_message;
-  CompletionCodes completion_code;
-  HRESULT error_code;
-  int extra_code1;
-  uint32 installer_result_code;
-  bool is_canceled;
-  bool is_noupdate;  // noupdate response from server
-  CString post_install_launch_command_line;
-  CString post_install_url;
-
-  AppCompletionInfo() : completion_code(COMPLETION_CODE_SUCCESS),
-                        error_code(S_OK),
-                        extra_code1(0),
-                        installer_result_code(0),
-                        is_canceled(false),
-                        is_noupdate(false) {}
-
-#ifdef DEBUG
-  CString ToString() const {
-    CString result;
-    SafeCStringFormat(&result,
-        _T("[AppCompletionInfo][%s][%s][0x%x][%d][%d][%d][%d][cmd_line=%s]"),
-        app_id, completion_message, error_code, extra_code1,
-        installer_result_code, is_canceled, is_noupdate,
-        post_install_launch_command_line);
-    return result;
-  }
-#endif
-};
-
-struct ObserverCompletionInfo {
-  CompletionCodes completion_code;
-  CString completion_text;
-  CString help_url;
-  std::vector<AppCompletionInfo> apps_info;
-
-  explicit ObserverCompletionInfo(CompletionCodes code)
-      : completion_code(code) {}
-
-#ifdef DEBUG
-  CString ToString() const {
-    CString result;
-    SafeCStringFormat(&result, _T("[ObserverCompletionInfo][code=%d][text=%s]"),
-                      completion_code, completion_text);
-    for (size_t i = 0; i < apps_info.size(); ++i) {
-      result.AppendFormat(_T("[%s]"), apps_info[i].ToString());
-    }
-    return result;
-  }
-#endif
-};
-
-// TODO(omaha3): This is bundle-centric. Add support for individual app-updates
-// when we have a better idea of the new bundle-supporting UI.
-class InstallProgressObserver {
- public:
-  virtual ~InstallProgressObserver() {}
-  virtual void OnCheckingForUpdate() = 0;
-  virtual void OnUpdateAvailable(const CString& app_name,
-                                 const CString& version_string) = 0;
-  virtual void OnWaitingToDownload(const CString& app_name) = 0;
-  virtual void OnDownloading(const CString& app_name,
-                             int time_remaining_ms,
-                             int pos) = 0;
-  virtual void OnWaitingRetryDownload(const CString& app_name,
-                                      time64 next_retry_time) = 0;
-  virtual void OnWaitingToInstall(const CString& app_name,
-                                  bool* can_start_install) = 0;
-  virtual void OnInstalling(const CString& app_name) = 0;
-  virtual void OnPause() = 0;
-  virtual void OnComplete(const ObserverCompletionInfo& observer_info) = 0;
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_CLIENT_INSTALL_PROGRESS_OBSERVER_H_
diff --git a/client/install_self.cc b/client/install_self.cc
deleted file mode 100644
index 601055b..0000000
--- a/client/install_self.cc
+++ /dev/null
@@ -1,411 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/client/install_self.h"
-#include "omaha/client/install_self_internal.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/base/xml_utils.h"
-#include "omaha/client/client_utils.h"
-#include "omaha/common/app_registry_utils.h"
-#include "omaha/common/command_line.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/ping.h"
-#include "omaha/setup/setup.h"
-#include "omaha/setup/setup_metrics.h"
-
-namespace omaha {
-
-namespace install_self {
-
-namespace {
-
-// Returns whether elevation is required.
-bool IsElevationRequired(bool is_machine) {
-  return is_machine && !vista_util::IsUserAdmin();
-}
-
-}  // namespace
-
-namespace internal {
-
-HRESULT DoSelfUpdate(bool is_machine, int* extra_code1) {
-  ASSERT1(extra_code1);
-
-  *extra_code1 = 0;
-
-  HRESULT hr = DoInstallSelf(is_machine, true, false, false, extra_code1);
-  if (FAILED(hr)) {
-    PersistUpdateErrorInfo(is_machine, hr, *extra_code1, GetVersionString());
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// Does not need to update the UI during Omaha install. This should be quick
-// with a simple throbbing UI. UI will transition when product install begins.
-HRESULT DoInstallSelf(bool is_machine,
-                      bool is_self_update,
-                      bool is_eula_required,
-                      bool set_keepalive,
-                      int* extra_code1) {
-  ASSERT1(extra_code1);
-  ASSERT1(!is_self_update || !is_eula_required);
-  ASSERT1(!IsElevationRequired(is_machine));
-
-  *extra_code1 = 0;
-
-  // TODO(omaha3): This needs to be in some type of lock(s) when
-  // !is_eula_required. See comments for SetEulaNotAccepted.
-  // TODO(omaha3): Integrate CL 11232530 - fix for bug 1866730 - from mainline.
-  // The Omaha 2 implementation of EULA [not] accepted was completely changed in
-  // this CL, which has not been integrated yet.
-  // TODO(omaha3): Code running in install-related processes before this point
-  // need to check for /eularequired before sending pings OR we need to move
-  // this before any pings can be sent. Even the latter is insufficient for
-  // the non-elevated machine install instance on Vista.
-  HRESULT hr = SetEulaRequiredState(is_machine, is_eula_required);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Checking system requirements here keeps requirements checks for other
-  // modules out of Setup.
-  // It is possible that an older metainstaller would fail the install for
-  // system requirements that are not required for the installed version when
-  // doing a handoff install.
-  hr = CheckSystemRequirements();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  Setup setup(is_machine);
-  setup.set_is_self_update(is_self_update);
-  hr = setup.Install(set_keepalive);
-  *extra_code1 = setup.extra_code1();
-
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Setup::Install failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  // All Omaha installs are "offline" because there is no update check.
-  const CString omaha_client_state_key_path =
-      ConfigManager::Instance()->registry_client_state_goopdate(is_machine);
-  app_registry_utils::PersistSuccessfulInstall(omaha_client_state_key_path,
-                                               is_self_update,
-                                               !is_self_update);  // is_offline
-
-  CORE_LOG(L1, (_T("[Setup successfully completed]")));
-
-  return S_OK;
-}
-
-HRESULT CheckSystemRequirements() {
-  // Validate that key OS components are installed.
-  if (!HasXmlParser()) {
-    return GOOPDATE_E_RUNNING_INFERIOR_MSXML;
-  }
-
-  return S_OK;
-}
-
-bool HasXmlParser() {
-  CComPtr<IXMLDOMDocument> my_xmldoc;
-  HRESULT hr = CoCreateSafeDOMDocument(&my_xmldoc);
-  const bool ret = SUCCEEDED(hr);
-  CORE_LOG(L3, (_T("[HasXmlParser returned %d][0x%08x]"), ret, hr));
-  return ret;
-}
-
-// Failing to set the state fails installation because this would prevent
-// updates or allow updates that should not be allowed.
-HRESULT SetEulaRequiredState(bool is_machine, bool is_eula_required) {
-  ASSERT1(!IsElevationRequired(is_machine));
-
-  const bool eula_accepted = !is_eula_required;
-  HRESULT hr = eula_accepted ? SetEulaAccepted(is_machine) :
-                               SetEulaNotAccepted(is_machine);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[set EULA accepted state failed][accepted=%d][0x%08x]"),
-                   eula_accepted, hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// Does not write the registry if Google Update is already installed as
-// determined by the presence of 2 or more registered apps. In those cases, we
-// assume the existing EULA state is correct and do not want to disable updates
-// for an existing installation.
-// Assumes it is called with appropriate synchronization protection such that it
-// can reliably check the number of registered clients.
-// TODO(omaha3): How do we assure the above assumption?
-HRESULT SetEulaNotAccepted(bool is_machine) {
-  CORE_LOG(L4, (_T("[SetEulaNotAccepted][%d]"), is_machine));
-
-  size_t num_clients(0);
-  if (SUCCEEDED(app_registry_utils::GetNumClients(is_machine, &num_clients)) &&
-      num_clients >= 2) {
-    CORE_LOG(L4, (_T(" [Apps registered. Not setting eulaaccepted=0.]")));
-    return S_OK;
-  }
-
-  const ConfigManager* cm = ConfigManager::Instance();
-  return RegKey::SetValue(cm->registry_update(is_machine),
-                          kRegValueOmahaEulaAccepted,
-                          static_cast<DWORD>(0));
-}
-
-HRESULT SetInstallationId(const CString& omaha_client_state_key_path,
-                          const GUID& iid) {
-  if (GUID_NULL != iid) {
-    return RegKey::SetValue(omaha_client_state_key_path,
-                            kRegValueInstallationId,
-                            GuidToString(iid));
-  }
-
-  return S_OK;
-}
-
-// Persist experiment labels that are specific to Google Update itself during
-// an initial install.  These are specified in a tag using "omahaexperiments";
-// once it's on the machine, Google Update's experiment labels will be read
-// and modified like any other app on the system.
-HRESULT SetExperimentLabels(const CString& omaha_client_state_key_path,
-                            const CString& experiment_labels) {
-  if (!experiment_labels.IsEmpty()) {
-    return RegKey::SetValue(omaha_client_state_key_path,
-                            kRegValueExperimentLabels,
-                            experiment_labels);
-  }
-
-  return S_OK;
-}
-
-void PersistUpdateErrorInfo(bool is_machine,
-                            HRESULT error,
-                            int extra_code1,
-                            const CString& version) {
-  const TCHAR* update_key_name =
-      ConfigManager::Instance()->registry_update(is_machine);
-  VERIFY1(SUCCEEDED(RegKey::SetValue(update_key_name,
-                                     kRegValueSelfUpdateErrorCode,
-                                     static_cast<DWORD>(error))));
-  VERIFY1(SUCCEEDED(RegKey::SetValue(update_key_name,
-                                     kRegValueSelfUpdateExtraCode1,
-                                     static_cast<DWORD>(extra_code1))));
-  VERIFY1(SUCCEEDED(RegKey::SetValue(update_key_name,
-                                     kRegValueSelfUpdateVersion,
-                                     version)));
-}
-
-}  // namespace internal
-
-// Returns false if the values cannot be deleted to avoid skewing the log data
-// with a single user pinging repeatedly with the same data.
-bool ReadAndClearUpdateErrorInfo(bool is_machine,
-                                 DWORD* error_code,
-                                 DWORD* extra_code1,
-                                 CString* version) {
-  ASSERT1(error_code);
-  ASSERT1(extra_code1);
-  ASSERT1(version);
-
-  const TCHAR* update_key_name =
-      ConfigManager::Instance()->registry_update(is_machine);
-  RegKey update_key;
-  HRESULT hr = update_key.Open(update_key_name);
-  if (FAILED(hr)) {
-    ASSERT1(false);
-    return false;
-  }
-
-  if (!update_key.HasValue(kRegValueSelfUpdateErrorCode)) {
-    ASSERT1(!update_key.HasValue(kRegValueSelfUpdateExtraCode1));
-    return false;
-  }
-
-  VERIFY1(SUCCEEDED(update_key.GetValue(kRegValueSelfUpdateErrorCode,
-                                        error_code)));
-  ASSERT1(FAILED(*error_code));
-
-  VERIFY1(SUCCEEDED(update_key.GetValue(kRegValueSelfUpdateExtraCode1,
-                                        extra_code1)));
-
-  VERIFY1(SUCCEEDED(update_key.GetValue(kRegValueSelfUpdateVersion, version)));
-
-  if (FAILED(update_key.DeleteValue(kRegValueSelfUpdateErrorCode)) ||
-      FAILED(update_key.DeleteValue(kRegValueSelfUpdateExtraCode1)) ||
-      FAILED(update_key.DeleteValue(kRegValueSelfUpdateVersion))) {
-    ASSERT1(false);
-    return false;
-  }
-
-  return true;
-}
-
-HRESULT SetEulaAccepted(bool is_machine) {
-  CORE_LOG(L4, (_T("[SetEulaAccepted][%d]"), is_machine));
-  const TCHAR* update_key_name =
-      ConfigManager::Instance()->registry_update(is_machine);
-  return RegKey::HasKey(update_key_name) ?
-      RegKey::DeleteValue(update_key_name, kRegValueOmahaEulaAccepted) :
-      S_OK;
-}
-
-HRESULT InstallSelf(bool is_machine,
-                    bool is_eula_required,
-                    bool is_oem_install,
-                    const CString& current_version,
-                    const CString& install_source,
-                    const CommandLineExtraArgs& extra_args,
-                    const CString& session_id,
-                    int* extra_code1) {
-  CORE_LOG(L2, (_T("[InstallSelf]")));
-
-  HRESULT hr = internal::DoInstallSelf(is_machine,
-                                       false,
-                                       is_eula_required,
-                                       extra_args.runtime_only,
-                                       extra_code1);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[DoInstallSelf failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  // Set Omaha's optional IID, experiment labels, and branding.
-  // IID and experiment labels are always written on install; branding will
-  // only be written if no branding exists, which should only be true on the
-  // first install.
-  const CString omaha_client_state_key_path =
-      ConfigManager::Instance()->registry_client_state_goopdate(is_machine);
-
-  // TODO(omaha): move SetInstallationId to app_registry_utils
-  VERIFY1(SUCCEEDED(internal::SetInstallationId(omaha_client_state_key_path,
-                                                extra_args.installation_id)));
-  VERIFY1(SUCCEEDED(internal::SetExperimentLabels(
-      omaha_client_state_key_path,
-      extra_args.experiment_labels)));
-  VERIFY1(SUCCEEDED(app_registry_utils::SetGoogleUpdateBranding(
-      omaha_client_state_key_path,
-      extra_args.brand_code,
-      extra_args.client_id)));
-
-  if (is_eula_required || is_oem_install) {
-    return S_OK;
-  }
-
-  // Send a successful EVENT_INSTALL_COMPLETE ping and do not wait for the
-  // completion of the ping. This reduces the overall latency of Omaha
-  // installs. The 'curent_version' parameter represent the version of
-  // Omaha before the setup has run.
-  Ping install_ping(is_machine, session_id, install_source);
-  PingEventPtr setup_install_complete_ping_event(
-      new PingEvent(PingEvent::EVENT_INSTALL_COMPLETE,
-                    PingEvent::EVENT_RESULT_SUCCESS,
-                    hr,
-                    *extra_code1));
-  const CString next_version(GetVersionString());
-  install_ping.LoadAppDataFromExtraArgs(extra_args);
-  install_ping.BuildOmahaPing(current_version,
-                              next_version,
-                              setup_install_complete_ping_event);
-  HRESULT send_result = install_ping.Send(true);
-  if (FAILED(send_result)) {
-    CORE_LOG(LW, (_T("[InstallPing::Send failed][0x%x]"), send_result));
-  }
-
-  return S_OK;
-}
-
-HRESULT UpdateSelf(bool is_machine, const CString& session_id) {
-  CORE_LOG(L2, (_T("[UpdateSelf]")));
-
-  ++metric_setup_update_self_total;
-
-  // 'current_version' corresponds to the value of 'pv' read from the registry.
-  CString current_version;
-  app_registry_utils::GetAppVersion(is_machine,
-                                    kGoogleUpdateAppId,
-                                    &current_version);
-
-  int extra_code1 = 0;
-  const HRESULT hr = internal::DoSelfUpdate(is_machine, &extra_code1);
-  if (SUCCEEDED(hr)) {
-    ++metric_setup_update_self_succeeded;
-  } else {
-    CORE_LOG(LE, (_T("[DoSelfUpdate failed][0x%08x]"), hr));
-  }
-
-  // If a self-update failed because an uninstall of that Omaha is in progress,
-  // don't bother with an update failure ping; the uninstall ping will suffice.
-  if (hr == GOOPDATE_E_FAILED_TO_GET_LOCK_UNINSTALL_PROCESS_RUNNING) {
-    return hr;
-  }
-
-  if (!ConfigManager::Instance()->CanUseNetwork(is_machine)) {
-    return hr;
-  }
-
-  // Send an update complete ping and wait for send to complete.
-  PingEvent::Results result = SUCCEEDED(hr) ?
-                              PingEvent::EVENT_RESULT_SUCCESS :
-                              PingEvent::EVENT_RESULT_ERROR;
-
-  const CString next_version(GetVersionString());
-
-  PingEventPtr update_complete_ping_event(
-      new PingEvent(PingEvent::EVENT_UPDATE_COMPLETE, result, hr, extra_code1));
-
-  Ping ping(is_machine, session_id, kCmdLineInstallSource_SelfUpdate);
-  ping.LoadOmahaDataFromRegistry();
-  ping.BuildOmahaPing(current_version,
-                      next_version,
-                      update_complete_ping_event);
-  ping.Send(false);
-
-  return hr;
-}
-
-HRESULT Repair(bool is_machine) {
-  CORE_LOG(L2, (_T("[Repair]")));
-  int extra_code1 = 0;
-  return internal::DoSelfUpdate(is_machine, &extra_code1);
-}
-
-void CheckInstallStateConsistency(bool is_machine) {
-  Setup::CheckInstallStateConsistency(is_machine);
-}
-
-HRESULT UninstallSelf(bool is_machine, bool send_uninstall_ping) {
-  CORE_LOG(L2, (_T("[UninstallSelf]")));
-  Setup setup(is_machine);
-  return setup.Uninstall(send_uninstall_ping);
-}
-
-}  // namespace install_self
-
-}  // namespace omaha
diff --git a/client/install_self.h b/client/install_self.h
deleted file mode 100644
index 9930413..0000000
--- a/client/install_self.h
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Functions related to the installing Omaha.
-
-#ifndef OMAHA_CLIENT_INSTALL_SELF_H_
-#define OMAHA_CLIENT_INSTALL_SELF_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include "omaha/common/ping_event.h"
-
-namespace omaha {
-
-struct CommandLineExtraArgs;
-
-namespace install_self {
-
-// Marks Omaha EULA as accepted by deleting the registry value.
-// Does not touch apps' EULA state.
-HRESULT SetEulaAccepted(bool is_machine);
-
-// Installs Omaha in the /install case. Does not install any applications.
-HRESULT InstallSelf(bool is_machine,
-                    bool is_eula_required,
-                    bool is_oem_install,
-                    const CString& current_version,
-                    const CString& install_source,
-                    const CommandLineExtraArgs& extra_args,
-                    const CString& session_id,
-                    int* extra_code1);
-
-// Updates Omaha.
-HRESULT UpdateSelf(bool is_machine, const CString& session_id);
-
-// Repairs Omaha. Used for Code Red recovery.
-HRESULT Repair(bool is_machine);
-
-// Verifies that Omaha is either properly installed or uninstalled completely.
-void CheckInstallStateConsistency(bool is_machine);
-
-// Uninstalls all Omaha versions if Omaha can be uninstalled.
-HRESULT UninstallSelf(bool is_machine, bool send_uninstall_ping);
-
-// Reads the error info for silent updates from the registry if present and
-// deletes it. Returns true if the data is valid.
-bool ReadAndClearUpdateErrorInfo(bool is_machine,
-                                 DWORD* error_code,
-                                 DWORD* extra_code1,
-                                 CString* version);
-
-}  // namespace install_self
-
-}  // namespace omaha
-
-#endif  // OMAHA_CLIENT_INSTALL_SELF_H_
diff --git a/client/install_self_internal.h b/client/install_self_internal.h
deleted file mode 100644
index abee77f..0000000
--- a/client/install_self_internal.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_CLIENT_INSTALL_SELF_INTERNAL_H_
-#define OMAHA_CLIENT_INSTALL_SELF_INTERNAL_H_
-
-#include <windows.h>
-#include <atlstr.h>
-
-namespace omaha {
-
-namespace install_self {
-
-namespace internal {
-
-// Performs a self-update.
-HRESULT DoSelfUpdate(bool is_machine, int* extra_code1);
-
-// Does the actual work of installing Omaha for all cases.
-HRESULT DoInstallSelf(bool is_machine,
-                      bool is_self_update,
-                      bool is_eula_required,
-                      bool set_keepalive,
-                      int* extra_code1);
-
-// Checks that the Omaha system requirements are met. Returns an error if not.
-HRESULT CheckSystemRequirements();
-
-// Returns true if it can instantiate MSXML parser.
-bool HasXmlParser();
-
-// Sets or clears the flag that prevents Google Update from using the network
-// until the EULA has been accepted based on whether the eularequired flag
-// appears on the command line.
-HRESULT SetEulaRequiredState(bool is_machine, bool is_eula_required);
-
-// Marks Google Update EULA as not accepted if it is not already installed.
-// Does not touch apps' EULA state.
-HRESULT SetEulaNotAccepted(bool is_machine);
-
-// Sets Omaha's IID in registry if one is specified, replacing existing IID.
-HRESULT SetInstallationId(const CString& omaha_client_state_key_path,
-                          const GUID& iid);
-
-// TODO(omaha3): Maybe find a different home for these two methods.
-// Writes error info for silent updates to the registry so the installed Omaha
-// can send an update failed ping.
-void PersistUpdateErrorInfo(bool is_machine,
-                            HRESULT error,
-                            int extra_code1,
-                            const CString& version);
-
-}  // namespace internal
-
-}  // namespace install_self
-
-}  // namespace omaha
-
-#endif  // OMAHA_CLIENT_INSTALL_SELF_INTERNAL_H_
diff --git a/client/install_self_unittest.cc b/client/install_self_unittest.cc
deleted file mode 100644
index 43608dc..0000000
--- a/client/install_self_unittest.cc
+++ /dev/null
@@ -1,878 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/constants.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/client/install_self.h"
-#include "omaha/client/install_self_internal.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace install_self {
-
-namespace {
-
-const TCHAR* const kAppMachineClientStatePath =
-    _T("HKLM\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientState\\{50DA5C89-FF97-4536-BF3F-DF54C2F02EA8}\\");
-
-const TCHAR* const kAppUserClientStatePath =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientState\\{50DA5C89-FF97-4536-BF3F-DF54C2F02EA8}\\");
-
-}  // namespace
-
-class RegistryProtectedInstallSelfTest
-    : public RegistryProtectedTest {
-};
-
-TEST(InstallTest, CheckSystemRequirements) {
-  EXPECT_SUCCEEDED(internal::CheckSystemRequirements());
-}
-
-TEST(InstallTest, HasXmlParser_True) {
-  EXPECT_TRUE(internal::HasXmlParser());
-}
-
-// A few tests for the public method. The bulk of the cases are covered by
-// SetEulaRequiredState tests.
-TEST_F(RegistryProtectedInstallSelfTest,
-       SetEulaAccepted_Machine_KeyDoesNotExist) {
-  EXPECT_EQ(S_OK, SetEulaAccepted(true));
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(RegistryProtectedInstallSelfTest,
-       SetEulaAccepted_Machine_ValueDoesNotExist) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(MACHINE_REG_UPDATE));
-  EXPECT_EQ(S_FALSE, SetEulaAccepted(true));
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(RegistryProtectedInstallSelfTest, SetEulaAccepted_Machine_ExistsZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_CLIENT_STATE_GOOPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-
-  EXPECT_SUCCEEDED(SetEulaAccepted(true));
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-
-  // ClientState for Google Update (never used) and other apps is not affected.
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(MACHINE_REG_CLIENT_STATE_GOOPDATE,
-                   _T("eulaaccepted"),
-                   &value));
-  EXPECT_EQ(0, value);
-  value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                   _T("eulaaccepted"),
-                   &value));
-  EXPECT_EQ(0, value);
-}
-
-TEST_F(RegistryProtectedInstallSelfTest, SetEulaAccepted_User_KeyDoesNotExist) {
-  EXPECT_EQ(S_OK, SetEulaAccepted(false));
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(RegistryProtectedInstallSelfTest,
-       SetEulaAccepted_User_ValueDoesNotExist) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(USER_REG_UPDATE));
-  EXPECT_EQ(S_FALSE, SetEulaAccepted(false));
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(RegistryProtectedInstallSelfTest, SetEulaAccepted_User_ExistsZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-
-  EXPECT_SUCCEEDED(SetEulaAccepted(false));
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, _T("eulaaccepted")));
-
-  // ClientState for Google Update (never used) and other apps is not affected.
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                   _T("eulaaccepted"),
-                   &value));
-  EXPECT_EQ(0, value);
-  value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppUserClientStatePath,
-                   _T("eulaaccepted"),
-                   &value));
-  EXPECT_EQ(0, value);
-}
-
-// TODO(omaha3): Enable once the EULA support is finalized. The tests were
-// significantly changed in the mainline.
-#if 0
-TEST_F(SetupRegistryProtectedMachineTest,
-       SetEulaRequiredState_NotRequired_KeyDoesNotExist) {
-  SetModeInstall();
-  args_.is_eula_required_set = false;
-  EXPECT_EQ(S_OK, SetEulaRequiredState());
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(SetupRegistryProtectedMachineTest,
-       SetEulaRequiredState_NotRequired_ValueDoesNotExist) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(MACHINE_REG_UPDATE));
-  SetModeInstall();
-  args_.is_eula_required_set = false;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(SetupRegistryProtectedMachineTest,
-       SetEulaRequiredState_NotRequired_ExistsZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_CLIENT_STATE_GOOPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-
-  SetModeInstall();
-  args_.is_eula_required_set = false;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-
-  // ClientState for Google Update (never used) and other apps is not affected.
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(MACHINE_REG_CLIENT_STATE_GOOPDATE,
-                   _T("eulaaccepted"),
-                   &value));
-  EXPECT_EQ(0, value);
-  value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                   _T("eulaaccepted"),
-                   &value));
-  EXPECT_EQ(0, value);
-}
-
-TEST_F(SetupRegistryProtectedMachineTest,
-       SetEulaRequiredState_NotRequired_ExistsOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  SetModeInstall();
-  args_.is_eula_required_set = false;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(SetupRegistryProtectedMachineTest,
-       SetEulaRequiredState_NotRequired_ExistsOther) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(8000)));
-  SetModeInstall();
-  args_.is_eula_required_set = false;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(SetupRegistryProtectedMachineTest,
-       SetEulaRequiredState_NotRequired_ExistsString) {
-  EXPECT_SUCCEEDED(
-      RegKey::SetValue(MACHINE_REG_UPDATE, _T("eulaaccepted"), _T("0")));
-  SetModeInstall();
-  args_.is_eula_required_set = false;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(SetupRegistryProtectedMachineTest,
-       SetEulaRequiredState_NotRequired_ValueDoesNotExistAlreadyInstalled) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-
-  SetModeInstall();
-  args_.is_eula_required_set = false;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(SetupRegistryProtectedMachineTest,
-       SetEulaRequiredState_NotRequired_ExistsZeroAlreadyInstalled) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-
-  SetModeInstall();
-  args_.is_eula_required_set = false;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(SetupRegistryProtectedMachineTest,
-       SetEulaRequiredState_Required_DoesNotExist) {
-  SetModeInstall();
-  args_.is_eula_required_set = true;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(MACHINE_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-}
-
-TEST_F(SetupRegistryProtectedMachineTest,
-       SetEulaRequiredState_Required_ExistsZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_CLIENT_STATE_GOOPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-
-  SetModeInstall();
-  args_.is_eula_required_set = true;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(MACHINE_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-
-  // ClientState for Google Update (never used) and other apps is not affected.
-  value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(MACHINE_REG_CLIENT_STATE_GOOPDATE,
-                   _T("eulaaccepted"),
-                   &value));
-  EXPECT_EQ(0, value);
-  value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                   _T("eulaaccepted"),
-                   &value));
-  EXPECT_EQ(0, value);
-}
-
-// The existing value is ignored if there are not two registered apps. This is
-// an artifact of the implementation and not a requirement.
-TEST_F(SetupRegistryProtectedMachineTest,
-       SetEulaRequiredState_Required_ExistsOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  SetModeInstall();
-  args_.is_eula_required_set = true;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(MACHINE_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-}
-
-TEST_F(SetupRegistryProtectedMachineTest,
-       SetEulaRequiredState_Required_ExistsOther) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(8000)));
-  SetModeInstall();
-  args_.is_eula_required_set = true;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(MACHINE_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-}
-
-TEST_F(SetupRegistryProtectedMachineTest,
-       SetEulaRequiredState_Required_ExistsString) {
-  EXPECT_SUCCEEDED(
-      RegKey::SetValue(MACHINE_REG_UPDATE, _T("eulaaccepted"), _T("0")));
-  SetModeInstall();
-  args_.is_eula_required_set = true;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(MACHINE_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-}
-
-// One app is not sufficient for detecting that Google Update is already
-// installed.
-TEST_F(SetupRegistryProtectedMachineTest,
-       SetEulaRequiredState_Required_ValueDoesNotExistOneAppRegistered) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientsPath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-
-  SetModeInstall();
-  args_.is_eula_required_set = true;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(MACHINE_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-}
-
-// Even Google Update registered is not sufficient for detecting that Google
-// Update is already installed.
-TEST_F(SetupRegistryProtectedMachineTest,
-       SetEulaRequiredState_Required_ValueDoesNotExistGoogleUpdateRegistered) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_CLIENT_STATE,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-
-  SetModeInstall();
-  args_.is_eula_required_set = true;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(MACHINE_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-}
-
-// Important: The existing state is not changed because two apps are registered.
-TEST_F(SetupRegistryProtectedMachineTest,
-       SetEulaRequiredState_Required_ValueDoesNotExistTwoAppsRegistered) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientsPath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kApp2MachineClientsPath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-
-  SetModeInstall();
-  args_.is_eula_required_set = true;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-}
-
-// The existing state is not changed because Google Update is already
-// installed, but there is no way to differentiate this from writing 0.
-TEST_F(SetupRegistryProtectedMachineTest,
-       SetEulaRequiredState_Required_ExistsZeroTwoAppsRegistered) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientsPath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kApp2MachineClientsPath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-
-  SetModeInstall();
-  args_.is_eula_required_set = true;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(MACHINE_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-}
-
-// The existing state is not changed because Google Update is already installed.
-TEST_F(SetupRegistryProtectedMachineTest,
-       SetEulaRequiredState_Required_ExistsOneTwoAppsRegistered) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientsPath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kApp2MachineClientsPath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-
-  SetModeInstall();
-  args_.is_eula_required_set = true;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(MACHINE_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(1, value);
-}
-
-TEST_F(SetupRegistryProtectedUserTest,
-       SetEulaRequiredState_NotRequired_KeyDoesNotExist) {
-  SetModeInstall();
-  args_.is_eula_required_set = false;
-  EXPECT_EQ(S_OK, SetEulaRequiredState());
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(SetupRegistryProtectedUserTest,
-       SetEulaRequiredState_NotRequired_ValueDoesNotExist) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(USER_REG_UPDATE));
-  SetModeInstall();
-  args_.is_eula_required_set = false;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(SetupRegistryProtectedUserTest,
-       SetEulaRequiredState_NotRequired_ExistsZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-
-  SetModeInstall();
-  args_.is_eula_required_set = false;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, _T("eulaaccepted")));
-
-  // ClientState for Google Update (never used) and other apps is not affected.
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                   _T("eulaaccepted"),
-                   &value));
-  EXPECT_EQ(0, value);
-  value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppUserClientStatePath,
-                   _T("eulaaccepted"),
-                   &value));
-  EXPECT_EQ(0, value);
-}
-
-TEST_F(SetupRegistryProtectedUserTest,
-       SetEulaRequiredState_NotRequired_ExistsOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  SetModeInstall();
-  args_.is_eula_required_set = false;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(SetupRegistryProtectedUserTest,
-       SetEulaRequiredState_NotRequired_ExistsOther) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(8000)));
-  SetModeInstall();
-  args_.is_eula_required_set = false;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(SetupRegistryProtectedUserTest,
-       SetEulaRequiredState_NotRequired_ExistsString) {
-  EXPECT_SUCCEEDED(
-      RegKey::SetValue(USER_REG_UPDATE, _T("eulaaccepted"), _T("0")));
-  SetModeInstall();
-  args_.is_eula_required_set = false;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(SetupRegistryProtectedUserTest,
-       SetEulaRequiredState_NotRequired_ValueDoesNotExistAlreadyInstalled) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-
-  SetModeInstall();
-  args_.is_eula_required_set = false;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(SetupRegistryProtectedUserTest,
-       SetEulaRequiredState_NotRequired_ExistsZeroAlreadyInstalled) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-
-  SetModeInstall();
-  args_.is_eula_required_set = false;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(SetupRegistryProtectedUserTest,
-       SetEulaRequiredState_Required_DoesNotExist) {
-  SetModeInstall();
-  args_.is_eula_required_set = true;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(USER_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-}
-
-TEST_F(SetupRegistryProtectedUserTest,
-       SetEulaRequiredState_Required_ExistsZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-
-  SetModeInstall();
-  args_.is_eula_required_set = true;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(USER_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-
-  // ClientState for Google Update (never used) and other apps is not affected.
-  value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                   _T("eulaaccepted"),
-                   &value));
-  EXPECT_EQ(0, value);
-  value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppUserClientStatePath,
-                   _T("eulaaccepted"),
-                   &value));
-  EXPECT_EQ(0, value);
-}
-
-// The existing value is ignored if there are not two registered apps. This is
-// an artifact of the implementation and not a requirement.
-TEST_F(SetupRegistryProtectedUserTest,
-       SetEulaRequiredState_Required_ExistsOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  SetModeInstall();
-  args_.is_eula_required_set = true;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(USER_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-}
-
-TEST_F(SetupRegistryProtectedUserTest,
-       SetEulaRequiredState_Required_ExistsOther) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(8000)));
-  SetModeInstall();
-  args_.is_eula_required_set = true;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(USER_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-}
-
-TEST_F(SetupRegistryProtectedUserTest,
-       SetEulaRequiredState_Required_ExistsString) {
-  EXPECT_SUCCEEDED(
-      RegKey::SetValue(USER_REG_UPDATE, _T("eulaaccepted"), _T("0")));
-  SetModeInstall();
-  args_.is_eula_required_set = true;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(USER_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-}
-
-// One app is not sufficient for detecting that Google Update is already
-// installed.
-TEST_F(SetupRegistryProtectedUserTest,
-       SetEulaRequiredState_Required_ValueDoesNotExistOneAppRegistered) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientsPath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-
-  SetModeInstall();
-  args_.is_eula_required_set = true;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(USER_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-}
-
-// Even Google Update registered is not sufficient for detecting that Google
-// Update is already installed.
-TEST_F(SetupRegistryProtectedUserTest,
-       SetEulaRequiredState_Required_ValueDoesNotExistGoogleUpdateRegistered) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENT_STATE,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-
-  SetModeInstall();
-  args_.is_eula_required_set = true;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(USER_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-}
-
-// Important: The existing state is not changed because two apps are registered.
-TEST_F(SetupRegistryProtectedUserTest,
-       SetEulaRequiredState_Required_ValueDoesNotExistTwoAppsRegistered) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientsPath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kApp2UserClientsPath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-
-  SetModeInstall();
-  args_.is_eula_required_set = true;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, _T("eulaaccepted")));
-}
-
-// The existing state is not changed because Google Update is already
-// installed, but there is no way to differentiate this from writing 0.
-TEST_F(SetupRegistryProtectedUserTest,
-       SetEulaRequiredState_Required_ExistsZeroTwoAppsRegistered) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientsPath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kApp2UserClientsPath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-
-  SetModeInstall();
-  args_.is_eula_required_set = true;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(USER_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-}
-
-// The existing state is not changed because Google Update is already installed.
-TEST_F(SetupRegistryProtectedUserTest,
-       SetEulaRequiredState_Required_ExistsOneTwoAppsRegistered) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientsPath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kApp2UserClientsPath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-
-  SetModeInstall();
-  args_.is_eula_required_set = true;
-  EXPECT_SUCCEEDED(SetEulaRequiredState());
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(USER_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(1, value);
-}
-#endif
-
-TEST_F(RegistryProtectedInstallSelfTest, PersistUpdateErrorInfo_User) {
-  internal::PersistUpdateErrorInfo(false, 0x98765432, 77, _T("1.2.3.4"));
-
-  DWORD value(0);
-  EXPECT_SUCCEEDED(RegKey::GetValue(USER_REG_UPDATE,
-                                    kRegValueSelfUpdateErrorCode,
-                                    &value));
-  EXPECT_EQ(0x98765432, value);
-
-  EXPECT_SUCCEEDED(RegKey::GetValue(USER_REG_UPDATE,
-                                    kRegValueSelfUpdateExtraCode1,
-                                    &value));
-  EXPECT_EQ(77, value);
-
-  CString version;
-  EXPECT_SUCCEEDED(RegKey::GetValue(USER_REG_UPDATE,
-                                    kRegValueSelfUpdateVersion,
-                                    &version));
-  EXPECT_FALSE(version.IsEmpty());
-  EXPECT_STREQ(_T("1.2.3.4"), version);
-}
-
-TEST_F(RegistryProtectedInstallSelfTest, PersistUpdateErrorInfo_Machine) {
-  internal::PersistUpdateErrorInfo(true, 0x98765430, 0x12345678, _T("2.3.4.5"));
-
-  DWORD value(0);
-  EXPECT_SUCCEEDED(RegKey::GetValue(MACHINE_REG_UPDATE,
-                                    kRegValueSelfUpdateErrorCode,
-                                    &value));
-  EXPECT_EQ(0x98765430, value);
-
-  EXPECT_SUCCEEDED(RegKey::GetValue(MACHINE_REG_UPDATE,
-                                    kRegValueSelfUpdateExtraCode1,
-                                    &value));
-  EXPECT_EQ(0x12345678, value);
-
-  CString version;
-  EXPECT_SUCCEEDED(RegKey::GetValue(MACHINE_REG_UPDATE,
-                                    kRegValueSelfUpdateVersion,
-                                    &version));
-  EXPECT_FALSE(version.IsEmpty());
-  EXPECT_STREQ(_T("2.3.4.5"), version);
-}
-
-TEST_F(RegistryProtectedInstallSelfTest,
-       ReadAndClearUpdateErrorInfo_User_KeyDoesNotExist) {
-  DWORD self_update_error_code(0);
-  DWORD self_update_extra_code1(0);
-  CString self_update_version;
-  ExpectAsserts expect_asserts;
-  EXPECT_FALSE(ReadAndClearUpdateErrorInfo(false,
-                                           &self_update_error_code,
-                                           &self_update_extra_code1,
-                                           &self_update_version));
-}
-
-TEST_F(RegistryProtectedInstallSelfTest,
-       ReadAndClearUpdateErrorInfo_Machine_KeyDoesNotExist) {
-  DWORD self_update_error_code(0);
-  DWORD self_update_extra_code1(0);
-  CString self_update_version;
-  ExpectAsserts expect_asserts;
-  EXPECT_FALSE(ReadAndClearUpdateErrorInfo(true,
-                                           &self_update_error_code,
-                                           &self_update_extra_code1,
-                                           &self_update_version));
-}
-
-TEST_F(RegistryProtectedInstallSelfTest,
-       ReadAndClearUpdateErrorInfo_User_UpdateErrorCodeDoesNotExist) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(USER_REG_UPDATE));
-  DWORD self_update_error_code(0);
-  DWORD self_update_extra_code1(0);
-  CString self_update_version;
-  EXPECT_FALSE(ReadAndClearUpdateErrorInfo(false,
-                                           &self_update_error_code,
-                                           &self_update_extra_code1,
-                                           &self_update_version));
-}
-
-TEST_F(RegistryProtectedInstallSelfTest,
-       ReadAndClearUpdateErrorInfo_Machine_UpdateErrorCodeDoesNotExist) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(MACHINE_REG_UPDATE));
-  DWORD self_update_error_code(0);
-  DWORD self_update_extra_code1(0);
-  CString self_update_version;
-  EXPECT_FALSE(ReadAndClearUpdateErrorInfo(true,
-                                           &self_update_error_code,
-                                           &self_update_extra_code1,
-                                           &self_update_version));
-}
-
-TEST_F(RegistryProtectedInstallSelfTest,
-       ReadAndClearUpdateErrorInfo_User_AllValuesPresent) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    kRegValueSelfUpdateErrorCode,
-                                    static_cast<DWORD>(0x87654321)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    kRegValueSelfUpdateExtraCode1,
-                                    static_cast<DWORD>(55)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    kRegValueSelfUpdateVersion,
-                                    _T("0.2.4.8")));
-
-  DWORD self_update_error_code(0);
-  DWORD self_update_extra_code1(0);
-  CString self_update_version;
-  EXPECT_TRUE(ReadAndClearUpdateErrorInfo(false,
-                                          &self_update_error_code,
-                                          &self_update_extra_code1,
-                                          &self_update_version));
-
-  EXPECT_EQ(0x87654321, self_update_error_code);
-  EXPECT_EQ(55, self_update_extra_code1);
-  EXPECT_STREQ(_T("0.2.4.8"), self_update_version);
-}
-
-TEST_F(RegistryProtectedInstallSelfTest,
-       ReadAndClearUpdateErrorInfo_Machine_AllValuesPresent) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    kRegValueSelfUpdateErrorCode,
-                                    static_cast<DWORD>(0x87654321)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    kRegValueSelfUpdateExtraCode1,
-                                    static_cast<DWORD>(55)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    kRegValueSelfUpdateVersion,
-                                    _T("0.2.4.8")));
-
-  DWORD self_update_error_code(0);
-  DWORD self_update_extra_code1(0);
-  CString self_update_version;
-  EXPECT_TRUE(ReadAndClearUpdateErrorInfo(true,
-                                          &self_update_error_code,
-                                          &self_update_extra_code1,
-                                          &self_update_version));
-
-  EXPECT_EQ(0x87654321, self_update_error_code);
-  EXPECT_EQ(55, self_update_extra_code1);
-  EXPECT_STREQ(_T("0.2.4.8"), self_update_version);
-}
-
-TEST_F(RegistryProtectedInstallSelfTest,
-       ReadAndClearUpdateErrorInfo_User_ValuesPresentInMachineOnly) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    kRegValueSelfUpdateErrorCode,
-                                    static_cast<DWORD>(0x87654321)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    kRegValueSelfUpdateExtraCode1,
-                                    static_cast<DWORD>(55)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    kRegValueSelfUpdateVersion,
-                                    _T("0.2.4.8")));
-
-  DWORD self_update_error_code(0);
-  DWORD self_update_extra_code1(0);
-  CString self_update_version;
-  ExpectAsserts expect_asserts;
-  EXPECT_FALSE(ReadAndClearUpdateErrorInfo(false,
-                                           &self_update_error_code,
-                                           &self_update_extra_code1,
-                                           &self_update_version));
-}
-
-}  // namespace install_self
-
-}  // namespace omaha
diff --git a/client/install_self_unittest_no_xml_parser.cc b/client/install_self_unittest_no_xml_parser.cc
deleted file mode 100644
index a5cb98d..0000000
--- a/client/install_self_unittest_no_xml_parser.cc
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/constants.h"
-#include "omaha/base/error.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/client/install_self_internal.h"
-#include "omaha/testing/omaha_unittest.h"
-#include "omaha/testing/unit_test.h"
-
-// Overriding HKLM causes HasXmlParser() to fail on Vista.
-// These tests must be run independently because other tests may use the XML
-// parser, making it available despite the HKLM overriding.
-
-// This test links against code that requires the following symbols but the test
-// does not use them. See the TODO in the build.scons. Rather than link against
-// more libs, define these symbols here.
-//
-// From omaha3_idl.lib.
-EXTERN_C const GUID IID_IGoogleUpdate3 = GUID_NULL;
-EXTERN_C const GUID IID_IAppBundle = GUID_NULL;
-EXTERN_C const GUID IID_IApp = GUID_NULL;
-EXTERN_C const GUID IID_IAppVersion = GUID_NULL;
-EXTERN_C const GUID IID_IPackage = GUID_NULL;
-EXTERN_C const GUID IID_ICurrentState = GUID_NULL;
-EXTERN_C const GUID IID_IGoogleUpdate3Web = GUID_NULL;
-EXTERN_C const GUID IID_IGoogleUpdate3WebSecurity = GUID_NULL;
-EXTERN_C const GUID IID_IAppBundleWeb = GUID_NULL;
-EXTERN_C const GUID IID_IAppWeb = GUID_NULL;
-EXTERN_C const GUID IID_IAppVersionWeb = GUID_NULL;
-EXTERN_C const GUID CLSID_ProcessLauncherClass = GUID_NULL;
-EXTERN_C const GUID IID_IGoogleUpdate = GUID_NULL;
-EXTERN_C const GUID IID_IGoogleUpdateCore = GUID_NULL;
-EXTERN_C const GUID IID_IProgressWndEvents = GUID_NULL;
-EXTERN_C const GUID LIBID_GoogleUpdate3Lib = GUID_NULL;
-EXTERN_C const GUID IID_ICoCreateAsync = GUID_NULL;
-EXTERN_C const GUID IID_ICoCreateAsyncStatus = GUID_NULL;
-EXTERN_C const GUID IID_IOneClickProcessLauncher = GUID_NULL;
-EXTERN_C const GUID IID_ICredentialDialog = GUID_NULL;
-EXTERN_C const GUID IID_IProcessLauncher = GUID_NULL;
-// From bits.lib.
-EXTERN_C const GUID IID_IBackgroundCopyCallback = GUID_NULL;
-// From iphlpapi.lib.
-#include <iphlpapi.h>  // NOLINT
-DWORD WINAPI GetIfTable(PMIB_IFTABLE, PULONG, BOOL) { return 0; }
-
-namespace omaha {
-
-TEST_F(RegistryProtectedTest, InstallOmaha_XmlParserNotPresent) {
-  if (!vista_util::IsVistaOrLater()) {
-    std::wcout << _T("\tTest did not run because it requires Vista or later.")
-               << std::endl;
-    return;
-  }
-  int extra_code1 = 0;
-  EXPECT_EQ(GOOPDATE_E_RUNNING_INFERIOR_MSXML,
-            install_self::internal::DoInstallSelf(false,
-                                                  false,
-                                                  false,
-                                                  false,
-                                                  &extra_code1));
-  EXPECT_EQ(0, extra_code1);
-  EXPECT_FALSE(RegKey::HasKey(USER_REG_GOOGLE));
-}
-
-// Overriding HKLM causes HasXmlParser() to fail on Vista.
-TEST_F(RegistryProtectedTest, CheckSystemRequirements_XmlParserNotPresent) {
-  if (!vista_util::IsVistaOrLater()) {
-    std::wcout << _T("\tTest did not run because it requires Vista or later.")
-               << std::endl;
-    return;
-  }
-  EXPECT_EQ(GOOPDATE_E_RUNNING_INFERIOR_MSXML,
-            install_self::internal::CheckSystemRequirements());
-}
-
-// Overriding HKLM causes HasXmlParser() to fail on Vista.
-TEST_F(RegistryProtectedTest, HasXmlParser_NotPresent) {
-  if (!vista_util::IsVistaOrLater()) {
-    std::wcout << _T("\tTest did not run because it requires Vista or later.")
-               << std::endl;
-    return;
-  }
-  EXPECT_FALSE(install_self::internal::HasXmlParser());
-}
-
-}  // namespace omaha
diff --git a/client/install_unittest.cc b/client/install_unittest.cc
deleted file mode 100644
index 6a14daa..0000000
--- a/client/install_unittest.cc
+++ /dev/null
@@ -1,785 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <mstask.h>
-#include "omaha/base/app_util.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/path.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/shell.h"
-#include "omaha/base/time.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/client/install.h"
-#include "omaha/client/install_internal.h"
-#include "omaha/client/install_self_internal.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/scheduled_task_utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-const TCHAR* const kExpectedIid = _T("{A972BB39-CCA3-4F25-9737-3308F5FA19B5}");
-const TCHAR* const kExpectedBrand = _T("GOOG");
-const TCHAR* const kExpectedClientId = _T("some_partner");
-
-const TCHAR* const kXpSystemSetupKey = _T("HKLM\\System\\Setup");
-const TCHAR* const kVistaSetupStateKey =
-    _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State");
-
-// Assumes the fixture is inherited from RegistryProtectedInstallTest,
-// RegistryProtectedWithComInterfacesPrimedInstallTest if is_machine.
-// If is_machine, the test must run
-// scheduled_task_utils::UninstallGoopdateTasks(true)) upon completion.
-// The method used to prevent installing Omaha still results in Setup attempting
-// to start the Core. When is_machine is true, this includes starting the
-// service or scheduled task. If neither are installed, this fails with an
-// assert. To avoid the assert, install the scheduled tasks. This is simpler
-// than installing the service and copying files such that it will succeed.
-// TODO(omaha3): Use a different method of avoiding running Setup; maybe a mock.
-void PreventSetupFromRunning(bool is_machine) {
-  const TCHAR* const kFutureVersionString = _T("10.9.8.7");
-  EXPECT_SUCCEEDED(RegKey::SetValue(is_machine ?
-                                        MACHINE_REG_CLIENTS_GOOPDATE :
-                                        USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    kFutureVersionString));
-
-  if (!is_machine) {
-    return;
-  }
-  const CString task_path = ConcatenatePath(
-                                app_util::GetCurrentModuleDirectory(),
-                                _T("unittest_support\\SaveArguments.exe"));
-  EXPECT_SUCCEEDED(scheduled_task_utils::InstallGoopdateTasks(task_path, true));
-}
-
-}  // namespace
-
-class InstallHandoffTest : public testing::Test {
- protected:
-  explicit InstallHandoffTest(bool is_machine)
-      : omaha_path_(is_machine ? GetGoogleUpdateMachinePath() :
-                                 GetGoogleUpdateUserPath()),
-        path_(ConcatenatePath(omaha_path_, kVersionString)) {
-  }
-
-  virtual void SetUp() {
-    // Save the existing version if present.
-    RegKey::GetValue(USER_REG_CLIENTS_GOOPDATE,
-                     kRegValueProductVersion,
-                     &existing_version_);
-    InstallFiles();
-  }
-
-  virtual void TearDown() {
-    EXPECT_SUCCEEDED(DeleteDirectory(path_));
-    if (existing_version_.IsEmpty()) {
-      EXPECT_SUCCEEDED(RegKey::DeleteValue(USER_REG_CLIENTS_GOOPDATE,
-                                           kRegValueProductVersion));
-    } else {
-      EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                        kRegValueProductVersion,
-                                        existing_version_));
-    }
-  }
-
-  void InstallFiles() {
-    DeleteDirectory(path_);
-    EXPECT_FALSE(File::IsDirectory(path_));
-
-    EXPECT_SUCCEEDED(CreateDir(path_, NULL));
-
-    EXPECT_SUCCEEDED(File::Copy(
-        ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                        kOmahaShellFileName),
-        omaha_path_ + kOmahaShellFileName,
-        false));
-
-    EXPECT_SUCCEEDED(File::Copy(
-        ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                        kOmahaDllName),
-        ConcatenatePath(path_, kOmahaDllName),
-        false));
-
-    EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                      kRegValueProductVersion,
-                                      kVersionString));
-  }
-
-  CString existing_version_;  // Saves the existing version from the registry.
-  const CString omaha_path_;
-  const CString path_;
-  static const TCHAR* const kVersionString;
-  static const TCHAR* const kAppGuid_;
-  static const TCHAR* const kSessionId_;
-};
-
-const TCHAR* const InstallHandoffTest::kVersionString = _T("9.8.7.6");
-const TCHAR* const InstallHandoffTest::kAppGuid_ =
-    _T("{01D33078-BA95-4da6-A3FC-F31593FD4AA2}");
-const TCHAR* const InstallHandoffTest::kSessionId_ =
-    _T("{6cb069db-b073-4a40-9983-846a3819876a}");
-
-class InstallHandoffUserTest : public InstallHandoffTest {
- protected:
-  InstallHandoffUserTest()
-      : InstallHandoffTest(false) {
-  }
-};
-
-class RegistryProtectedInstallTest
-    : public RegistryProtectedTest {
- protected:
-  virtual void SetUp() {
-    RegistryProtectedTest::SetUp();
-
-    args_.extra.bundle_name = _T("bundle");  // Avoids assert in error cases.
-    args_.install_source    = _T("unittest");
-  }
-
-  CommandLineArgs args_;
-};
-
-// Primes the Task Scheduler and XML interfaces before overriding the registry
-// so the interfaces are available after overriding HKLM. This is necessary to
-// allow tests to be run individually.
-class RegistryProtectedWithComInterfacesPrimedInstallTest
-    : public RegistryProtectedInstallTest {
- protected:
-  virtual void SetUp() {
-    CComPtr<ITaskScheduler> scheduler;
-    EXPECT_SUCCEEDED(scheduler.CoCreateInstance(CLSID_CTaskScheduler,
-                                                NULL,
-                                                CLSCTX_INPROC_SERVER));
-
-    EXPECT_TRUE(install_self::internal::HasXmlParser());
-
-    // Prime the special folder mapping. For some reason this works on
-    // Windows XP but calling functions like
-    // ConfigManager::GetMachineGoopdateInstallDir does not.
-    typedef std::map<CString, CString> mapping;
-    mapping folder_map;
-    ASSERT_SUCCEEDED(Shell::GetSpecialFolderKeywordsMapping(&folder_map));
-
-    RegistryProtectedInstallTest::SetUp();
-
-    // mpr.dll requires that the HwOrder key is present to be able to
-    // initialize (http://support.microsoft.com/kb/329316). On Windows Vista and
-    // later, its absence causes IPersistFile.Save() in
-    // scheduled_task_utils::CreateScheduledTask() to fail with
-    // ERROR_DLL_INIT_FAILED.
-    EXPECT_SUCCEEDED(RegKey::CreateKey(
-        _T("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\")
-        _T("NetworkProvider\\HwOrder")));
-  }
-};
-
-class InAuditModeTest
-    : public RegistryProtectedWithComInterfacesPrimedInstallTest {
- protected:
-  virtual void SetUp() {
-    RegistryProtectedWithComInterfacesPrimedInstallTest::SetUp();
-
-    if (vista_util::IsVistaOrLater()) {
-      EXPECT_SUCCEEDED(RegKey::SetValue(kVistaSetupStateKey,
-                                        _T("ImageState"),
-                                        _T("IMAGE_STATE_UNDEPLOYABLE")));
-    } else {
-      EXPECT_SUCCEEDED(RegKey::SetValue(kXpSystemSetupKey,
-                                        _T("AuditInProgress"),
-                                        static_cast<DWORD>(1)));
-    }
-
-    EXPECT_TRUE(ConfigManager::Instance()->IsWindowsInstalling());
-  }
-};
-
-TEST_F(InAuditModeTest, OemInstall_NotOffline) {
-  if (!vista_util::IsUserAdmin()) {
-    std::wcout << _T("\tTest did not run because the user is not an admin.")
-               << std::endl;
-    return;
-  }
-
-  PreventSetupFromRunning(true);
-
-  bool is_machine = true;
-  bool has_ui_been_displayed = false;
-  EXPECT_EQ(GOOPDATE_E_OEM_WITH_ONLINE_INSTALLER,
-            OemInstall(false,          // is_interactive
-                       true,           // is_app_install
-                       false,          // is_eula_required
-                       false,          // is_install_elevated_instance
-                       _T("unused"),   // install_cmd_line
-                       args_,
-                       &is_machine,
-                       &has_ui_been_displayed));
-  EXPECT_FALSE(has_ui_been_displayed);
-
-  EXPECT_SUCCEEDED(scheduled_task_utils::UninstallGoopdateTasks(true));
-}
-
-TEST_F(RegistryProtectedWithComInterfacesPrimedInstallTest,
-       Install_NotAppInstall_User_NoBrandSpecified_NoExistingBrand) {
-  if (vista_util::IsElevatedWithUACMaybeOn()) {
-    std::wcout << _T("\tSkipping test because user is elevated with UAC on.")
-               << std::endl;
-    return;
-  }
-
-  PreventSetupFromRunning(false);
-
-  bool is_machine = false;
-  bool has_ui_been_displayed = false;
-  EXPECT_EQ(S_OK, Install(false,         // is_interactive
-                          false,         // is_app_install
-                          false,         // is_eula_required
-                          false,         // is_oem_install
-                          false,         // is_install_elevated_instance
-                          _T("foo"),     // install_cmd_line
-                          args_,
-                          &is_machine,
-                          &has_ui_been_displayed));
-  EXPECT_FALSE(has_ui_been_displayed);
-
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                kRegValueInstallationId));
-  EXPECT_STREQ(_T("GGLS"), GetSzValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                      kRegValueBrandCode));
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                kRegValueClientId));
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                kRegValueReferralId));
-
-  const DWORD install_time = GetDwordValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                           kRegValueInstallTimeSec);
-  EXPECT_GE(now, install_time);
-  EXPECT_GE(static_cast<uint32>(200), now - install_time);
-}
-
-TEST_F(RegistryProtectedWithComInterfacesPrimedInstallTest,
-       Install_NotAppInstall_User_BrandSpecified_NoExistingBrand) {
-  if (vista_util::IsElevatedWithUACMaybeOn()) {
-    std::wcout << _T("\tSkipping test because user is elevated with UAC on.")
-               << std::endl;
-    return;
-  }
-
-  PreventSetupFromRunning(false);
-
-  args_.extra.installation_id = StringToGuid(kExpectedIid);
-  args_.extra.brand_code = kExpectedBrand;
-  args_.extra.client_id = kExpectedClientId;
-
-  bool is_machine = false;
-  bool has_ui_been_displayed = false;
-  EXPECT_EQ(S_OK, Install(false,         // is_interactive
-                          false,         // is_app_install
-                          false,         // is_eula_required
-                          false,         // is_oem_install
-                          false,         // is_install_elevated_instance
-                          _T("foo"),     // install_cmd_line
-                          args_,
-                          &is_machine,
-                          &has_ui_been_displayed));
-  EXPECT_FALSE(has_ui_been_displayed);
-
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  EXPECT_STREQ(kExpectedIid, GetSzValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                        kRegValueInstallationId));
-  EXPECT_STREQ(kExpectedBrand, GetSzValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                          kRegValueBrandCode));
-  EXPECT_STREQ(kExpectedClientId, GetSzValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                             kRegValueClientId));
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                kRegValueReferralId));
-
-  const DWORD install_time = GetDwordValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                           kRegValueInstallTimeSec);
-  EXPECT_GE(now, install_time);
-  EXPECT_GE(static_cast<uint32>(200), now - install_time);
-}
-
-TEST_F(RegistryProtectedWithComInterfacesPrimedInstallTest,
-       Install_NotAppInstall_User_BrandSpecified_ExistingBrandAndInstallTime) {
-  if (vista_util::IsElevatedWithUACMaybeOn()) {
-    std::wcout << _T("\tSkipping test because user is elevated with UAC on.")
-               << std::endl;
-    return;
-  }
-
-  PreventSetupFromRunning(false);
-
-  const TCHAR* const kExistingBrand = _T("GOOG");
-  const DWORD kExistingInstallTime = 1234567;
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                    kRegValueBrandCode,
-                                    kExistingBrand));
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                    kRegValueInstallTimeSec,
-                                    kExistingInstallTime));
-
-  args_.extra.installation_id = StringToGuid(kExpectedIid);
-  args_.extra.brand_code = kExpectedBrand;
-  args_.extra.client_id = kExpectedClientId;
-
-  bool is_machine = false;
-  bool has_ui_been_displayed = false;
-  EXPECT_EQ(S_OK, Install(false,         // is_interactive
-                          false,         // is_app_install
-                          false,         // is_eula_required
-                          false,         // is_oem_install
-                          false,         // is_install_elevated_instance
-                          _T("foo"),     // install_cmd_line
-                          args_,
-                          &is_machine,
-                          &has_ui_been_displayed));
-  EXPECT_FALSE(has_ui_been_displayed);
-
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  EXPECT_STREQ(kExpectedIid, GetSzValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                        kRegValueInstallationId));
-  EXPECT_STREQ(kExistingBrand, GetSzValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                          kRegValueBrandCode));
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                kRegValueClientId));
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                kRegValueReferralId));
-
-  EXPECT_EQ(kExistingInstallTime, GetDwordValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                                kRegValueInstallTimeSec));
-}
-
-TEST_F(RegistryProtectedWithComInterfacesPrimedInstallTest,
-       Install_NotAppInstall_Machine_BrandSpecified_NoExistingBrand) {
-  PreventSetupFromRunning(true);
-
-  args_.extra.installation_id = StringToGuid(kExpectedIid);
-  args_.extra.brand_code = kExpectedBrand;
-  args_.extra.client_id = kExpectedClientId;
-
-  bool is_machine = true;
-  bool has_ui_been_displayed = false;
-  EXPECT_SUCCEEDED(Install(false,         // is_interactive
-                           false,         // is_app_install
-                           false,         // is_eula_required
-                           false,         // is_oem_install
-                           false,         // is_install_elevated_instance
-                           _T("foo"),     // install_cmd_line
-                           args_,
-                           &is_machine,
-                           &has_ui_been_displayed));
-  EXPECT_FALSE(has_ui_been_displayed);
-
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  CString iid;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(MACHINE_REG_CLIENT_STATE_GOOPDATE, _T("iid"), &iid));
-  EXPECT_STREQ(kExpectedIid, iid);
-
-  CString brand;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(MACHINE_REG_CLIENT_STATE_GOOPDATE, _T("brand"), &brand));
-  EXPECT_STREQ(kExpectedBrand, brand);
-
-  CString client_id;
-  EXPECT_SUCCEEDED(RegKey::GetValue(MACHINE_REG_CLIENT_STATE_GOOPDATE,
-                                    _T("client"),
-                                    &client_id));
-  EXPECT_STREQ(kExpectedClientId, client_id);
-
-  EXPECT_FALSE(
-      RegKey::HasValue(MACHINE_REG_CLIENT_STATE_GOOPDATE, _T("referral")));
-
-  DWORD install_time(0);
-  EXPECT_SUCCEEDED(RegKey::GetValue(MACHINE_REG_CLIENT_STATE_GOOPDATE,
-                                    _T("InstallTime"),
-                                    &install_time));
-  EXPECT_GE(now, install_time);
-  EXPECT_GE(static_cast<uint32>(200), now - install_time);
-
-  EXPECT_SUCCEEDED(scheduled_task_utils::UninstallGoopdateTasks(true));
-}
-
-
-TEST_F(RegistryProtectedWithComInterfacesPrimedInstallTest,
-       Install_EulaRequiredNotOffline_User) {
-  if (vista_util::IsElevatedWithUACMaybeOn()) {
-    std::wcout << _T("\tSkipping test because user is elevated with UAC on.")
-               << std::endl;
-    return;
-  }
-
-  PreventSetupFromRunning(false);
-
-  bool is_machine = false;
-  bool has_ui_been_displayed = false;
-  EXPECT_EQ(GOOPDATE_E_EULA_REQURED_WITH_ONLINE_INSTALLER,
-            Install(false,          // is_interactive
-                    true,           // is_app_install
-                    true,           // is_eula_required
-                    false,          // is_oem_install
-                    false,          // is_install_elevated_instance
-                    _T("unused"),   // install_cmd_line
-                    args_,
-                    &is_machine,
-                    &has_ui_been_displayed));
-  EXPECT_FALSE(has_ui_been_displayed);
-}
-
-TEST_F(RegistryProtectedWithComInterfacesPrimedInstallTest,
-       Install_EulaRequiredNotOffline_Machine) {
-  if (!vista_util::IsUserAdmin()) {
-    std::wcout << _T("\tTest did not run because the user is not an admin.")
-               << std::endl;
-    return;
-  }
-
-  PreventSetupFromRunning(true);
-
-  bool is_machine = true;
-  bool has_ui_been_displayed = false;
-  EXPECT_EQ(GOOPDATE_E_EULA_REQURED_WITH_ONLINE_INSTALLER,
-            Install(false,          // is_interactive
-                    true,           // is_app_install
-                    true,           // is_eula_required
-                    false,          // is_oem_install
-                    false,          // is_install_elevated_instance
-                    _T("unused"),   // install_cmd_line
-                    args_,
-                    &is_machine,
-                    &has_ui_been_displayed));
-  EXPECT_FALSE(has_ui_been_displayed);
-
-  EXPECT_SUCCEEDED(scheduled_task_utils::UninstallGoopdateTasks(true));
-}
-
-TEST_F(RegistryProtectedInstallTest, Install_NeedsElevation_Silent) {
-  if (vista_util::IsUserAdmin()) {
-    std::wcout << _T("\tTest did not run because the user IS an admin.")
-               << std::endl;
-    return;
-  }
-
-  bool is_machine = true;
-  bool has_ui_been_displayed = false;
-  EXPECT_EQ(GOOPDATE_E_SILENT_INSTALL_NEEDS_ELEVATION,
-            Install(false,          // is_interactive
-                    true,           // is_app_install
-                    false,          // is_eula_required
-                    false,          // is_oem_install
-                    false,          // is_install_elevated_instance
-                    _T("unused"),   // install_cmd_line
-                    args_,
-                    &is_machine,
-                    &has_ui_been_displayed));
-  EXPECT_FALSE(has_ui_been_displayed);
-}
-
-// Tests that non-app installs can request elevation.
-// TODO(omaha3): Once the elevation code is finalized, figure out a way to cause
-// it to fail without a UAC prompt. Then change the expected error code to a
-// list of possible values.
-TEST_F(RegistryProtectedInstallTest, Install_NeedsElevation_NotAppInstall) {
-  if (vista_util::IsUserAdmin()) {
-    std::wcout << _T("\tTest did not run because the user IS an admin.")
-               << std::endl;
-    return;
-  }
-
-  bool is_machine = true;
-  bool has_ui_been_displayed = false;
-  EXPECT_NE(GOOPDATE_E_SILENT_INSTALL_NEEDS_ELEVATION,
-            Install(true,           // is_interactive
-                    false,          // is_app_install
-                    false,          // is_eula_required
-                    false,          // is_oem_install
-                    false,          // is_install_elevated_instance
-                    _T("unused"),   // install_cmd_line
-                    args_,
-                    &is_machine,
-                    &has_ui_been_displayed));
-  EXPECT_FALSE(has_ui_been_displayed);
-}
-
-TEST_F(RegistryProtectedInstallTest, Install_NeedsElevation_ElevatedInstance) {
-  if (vista_util::IsUserAdmin()) {
-    std::wcout << _T("\tTest did not run because the user IS an admin.")
-               << std::endl;
-    return;
-  }
-
-  bool is_machine = true;
-
-  // is_interactive is true to get past that check.
-  bool has_ui_been_displayed = false;
-  EXPECT_EQ(GOOPDATE_E_INSTALL_ELEVATED_PROCESS_NEEDS_ELEVATION,
-            Install(true,           // is_interactive
-                    true,           // is_app_install
-                    false,          // is_eula_required
-                    false,          // is_oem_install
-                    true,           // is_install_elevated_instance
-                    _T("unused"),   // install_cmd_line
-                    args_,
-                    &is_machine,
-                    &has_ui_been_displayed));
-  EXPECT_FALSE(has_ui_been_displayed);
-}
-
-// This test will never run because developers do not run XP as non-admin.
-// TODO(omaha3): Implement some way to fake/mock IsUserAdmin(), etc.
-TEST_F(RegistryProtectedInstallTest, Install_NeedsElevation_XpNonAdmin) {
-  if (vista_util::IsVistaOrLater()) {
-    std::wcout << _T("\tTest did not run because OS is Vista or later.")
-               << std::endl;
-    return;
-  }
-  if (vista_util::IsUserAdmin()) {
-    std::wcout << _T("\tTest did not run because the user IS an admin.")
-               << std::endl;
-    return;
-  }
-
-  bool is_machine = true;
-
-  // is_interactive is true to get past that check.
-  bool has_ui_been_displayed = false;
-  EXPECT_EQ(GOOPDATE_E_NONADMIN_INSTALL_ADMIN_APP,
-            Install(true,           // is_interactive
-                    true,           // is_app_install
-                    false,          // is_eula_required
-                    false,          // is_oem_install
-                    false,          // is_install_elevated_instance
-                    _T("unused"),   // install_cmd_line
-                    args_,
-                    &is_machine,
-                    &has_ui_been_displayed));
-  EXPECT_FALSE(has_ui_been_displayed);
-}
-
-
-// TODO(omaha3): Once the elevation code is finalized, figure out a way to cause
-// it to fail before the UAC prompt and test GOOPDATE_E_ELEVATION_FAILED_ADMIN
-// and GOOPDATE_E_ELEVATION_FAILED_NON_ADMIN. Check the command line used for
-// elevation if possible.
-
-// TODO(omaha3): If UI ends up not being handled in this method, test
-// is_interactive variations too.
-
-// TODO(omaha3): Test more success cases, including Setup and handoff.
-
-// TODO(omaha3): Enable when support for offline builds is finalized.
-#if 0
-class SetupOfflineInstallerTest : public testing::Test {
- protected:
-  static bool CallCopyOfflineFiles(const CommandLineArgs& args,
-                                   const CString& target_location) {
-    omaha::Setup setup(false, &args);
-    return setup.CopyOfflineFiles(target_location);
-  }
-
-  static HRESULT CallCopyOfflineFilesForGuid(const CString& app_guid,
-                                             const CString& target_location) {
-    return omaha::Setup::CopyOfflineFilesForGuid(app_guid, target_location);
-  }
-};
-
-TEST_F(SetupOfflineInstallerTest, ValidOfflineInstaller) {
-  CString guid_string = _T("{CDABE316-39CD-43BA-8440-6D1E0547AEE6}");
-
-  CString offline_manifest_path(guid_string);
-  offline_manifest_path += _T(".gup");
-  offline_manifest_path = ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                                          offline_manifest_path);
-  EXPECT_SUCCEEDED(File::Copy(
-      ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                      _T("server_manifest_one_app.xml")),
-      offline_manifest_path,
-      false));
-
-  CString installer_exe = _T("foo_installer.exe");
-  CString tarred_installer_path;
-  tarred_installer_path.Format(_T("%s.%s"), installer_exe, guid_string);
-  tarred_installer_path = ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                                          tarred_installer_path);
-
-  EXPECT_SUCCEEDED(File::Copy(
-      ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                      kOmahaShellFileName),
-      tarred_installer_path,
-      false));
-
-  CommandLineArgs args;
-  CommandLineAppArgs app1;
-  app1.app_guid = StringToGuid(guid_string);
-  args.extra.apps.push_back(app1);
-  CString target_location = ConcatenatePath(
-                                app_util::GetCurrentModuleDirectory(),
-                                _T("offline_test"));
-
-  EXPECT_TRUE(CallCopyOfflineFiles(args, target_location));
-
-  CString target_manifest = ConcatenatePath(target_location,
-                                            guid_string + _T(".gup"));
-  EXPECT_TRUE(File::Exists(target_manifest));
-  CString target_file = ConcatenatePath(
-      ConcatenatePath(target_location, guid_string), installer_exe);
-  EXPECT_TRUE(File::Exists(target_file));
-
-  EXPECT_SUCCEEDED(DeleteDirectory(target_location));
-  EXPECT_SUCCEEDED(File::Remove(tarred_installer_path));
-  EXPECT_SUCCEEDED(File::Remove(offline_manifest_path));
-}
-
-TEST_F(SetupOfflineInstallerTest, NoOfflineInstaller) {
-  CString guid_string = _T("{CDABE316-39CD-43BA-8440-6D1E0547AEE6}");
-  CommandLineArgs args;
-  CommandLineAppArgs app1;
-  app1.app_guid = StringToGuid(guid_string);
-  args.extra.apps.push_back(app1);
-  CString target_location = ConcatenatePath(
-                                app_util::GetCurrentModuleDirectory(),
-                                _T("offline_test"));
-
-  EXPECT_FALSE(CallCopyOfflineFiles(args, target_location));
-}
-
-TEST_F(SetupOfflineInstallerTest, ValidCopyOfflineFilesForGuid) {
-  CString guid_string = _T("{CDABE316-39CD-43BA-8440-6D1E0547AEE6}");
-
-  CString offline_manifest_path(guid_string);
-  offline_manifest_path += _T(".gup");
-  offline_manifest_path = ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                                          offline_manifest_path);
-  EXPECT_SUCCEEDED(File::Copy(
-      ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                      _T("server_manifest_one_app.xml")),
-      offline_manifest_path,
-      false));
-
-  CString installer_exe = _T("foo_installer.exe");
-  CString tarred_installer_path;
-  tarred_installer_path.Format(_T("%s.%s"), installer_exe, guid_string);
-  tarred_installer_path = ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                                          tarred_installer_path);
-
-  EXPECT_SUCCEEDED(File::Copy(
-      ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                      kOmahaShellFileName),
-      tarred_installer_path,
-      false));
-
-  CString target_location = ConcatenatePath(
-                                app_util::GetCurrentModuleDirectory(),
-                                _T("offline_test"));
-
-  EXPECT_SUCCEEDED(CallCopyOfflineFilesForGuid(guid_string, target_location));
-
-  CString target_manifest = ConcatenatePath(target_location,
-                                            guid_string + _T(".gup"));
-  EXPECT_TRUE(File::Exists(target_manifest));
-  CString target_file = ConcatenatePath(
-      ConcatenatePath(target_location, guid_string), installer_exe);
-  EXPECT_TRUE(File::Exists(target_file));
-
-  EXPECT_SUCCEEDED(DeleteDirectory(target_location));
-  EXPECT_SUCCEEDED(File::Remove(tarred_installer_path));
-  EXPECT_SUCCEEDED(File::Remove(offline_manifest_path));
-}
-
-TEST_F(SetupOfflineInstallerTest, NoCopyOfflineFilesForGuid) {
-  CString guid_string = _T("{CDABE316-39CD-43BA-8440-6D1E0547AEE6}");
-  CString target_location = ConcatenatePath(
-                                app_util::GetCurrentModuleDirectory(),
-                                _T("offline_test"));
-
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            CallCopyOfflineFilesForGuid(guid_string, target_location));
-}
-#endif
-
-// TODO(omaha): Duplicate these tests for machine.
-TEST_F(InstallHandoffUserTest, InstallApplications_HandoffWithShellMissing) {
-  CString shell_path = ConcatenatePath(omaha_path_, kOmahaShellFileName);
-  EXPECT_TRUE(SUCCEEDED(File::DeleteAfterReboot(shell_path)) ||
-              !vista_util::IsUserAdmin());
-  EXPECT_FALSE(File::Exists(shell_path));
-
-  CommandLineArgs args;
-  args.extra_args_str = _T("appguid={BF85992F-2E0F-4700-9A6C-FEC9126CEE4B}&")
-                        _T("appname=Foo&needsadmin=False&");
-  args.install_source = _T("unittest");
-  bool ui_displayed = false;
-  bool has_launched_handoff = false;
-  EXPECT_EQ(GOOPDATE_E_HANDOFF_FAILED,
-            internal::InstallApplications(false,
-                                          false,
-                                          args,
-                                          kSessionId_,
-                                          NULL,
-                                          &has_launched_handoff,
-                                          &ui_displayed));
-// TODO(omaha3): Verify the actual error when this is implemented.
-#if 0
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), extra_code1);
-#endif
-  EXPECT_FALSE(ui_displayed);
-}
-
-TEST_F(InstallHandoffUserTest,
-       InstallApplications_HandoffWithGoopdateDllMissing) {
-  CString dll_path = ConcatenatePath(path_, kOmahaDllName);
-  EXPECT_SUCCEEDED(File::Remove(dll_path));
-  EXPECT_FALSE(File::Exists(dll_path));
-
-  CommandLineArgs args;
-  args.extra_args_str = _T("appguid={BF85992F-2E0F-4700-9A6C-FEC9126CEE4B}&")
-                        _T("appname=Foo&needsadmin=False&");
-  args.install_source = _T("unittest");
-  bool ui_displayed = false;
-  bool has_launched_handoff = false;
-  EXPECT_EQ(GOOGLEUPDATE_E_DLL_NOT_FOUND,
-            internal::InstallApplications(false,
-                                          false,
-                                          args,
-                                          kSessionId_,
-                                          NULL,
-                                          &ui_displayed,
-                                          &has_launched_handoff));
-// TODO(omaha3): Verify the actual error when this is implemented.
-#if 0
-  EXPECT_EQ(0, setup_->extra_code1());
-#endif
-// TODO(omaha3): ui_displayed is temporarily always set to true.
-#if 0
-  EXPECT_FALSE(ui_displayed);
-#else
-  EXPECT_TRUE(ui_displayed);
-#endif
-}
-
-}  // namespace omaha
diff --git a/client/resource.h b/client/resource.h
deleted file mode 100644
index 46e1241..0000000
--- a/client/resource.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_CLIENT_RESOURCE_H_
-#define OMAHA_CLIENT_RESOURCE_H_
-
-#include "omaha/goopdate/resources/goopdateres/goopdate.grh"
-
-#endif  // OMAHA_CLIENT_RESOURCE_H_
diff --git a/client/shutdown_events.cc b/client/shutdown_events.cc
deleted file mode 100644
index aa33021..0000000
--- a/client/shutdown_events.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/client/shutdown_events.h"
-#include <atlsafe.h>
-#include "base/scoped_ptr.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/reactor.h"
-#include "omaha/base/shutdown_handler.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/client/bundle_installer.h"
-
-namespace omaha {
-
-ShutdownEvents::ShutdownEvents(BundleInstaller* installer)
-    : installer_(installer) {
-  ASSERT1(installer);
-}
-
-ShutdownEvents::~ShutdownEvents() {
-  CORE_LOG(L2, (_T("[ShutdownEvents::~ShutdownEvents]")));
-  __mutexScope(lock_);
-
-  CORE_LOG(L2, (_T("[Destroying shutdown handler]")));
-  shutdown_handler_.reset();
-  reactor_.reset();
-}
-
-HRESULT ShutdownEvents::InitializeShutdownHandler(bool is_machine) {
-  CORE_LOG(L3, (_T("[InitializeShutdownHandler]")));
-
-  reactor_.reset(new Reactor);
-  shutdown_handler_.reset(new ShutdownHandler);
-  return shutdown_handler_->Initialize(reactor_.get(), this, is_machine);
-}
-
-// Shutdown() is called from a thread in the OS threadpool. The PostMessage
-// marshals the call over to the UI thread, which is where DoClose needs to be
-// (and is) called from.
-HRESULT ShutdownEvents::Shutdown() {
-  CORE_LOG(L2, (_T("[Shutdown]")));
-
-  __mutexScope(lock_);
-
-  CORE_LOG(L2, (_T("[Shutdown][IsWindow: %d]"), installer_->IsWindow()));
-  if (installer_->IsWindow()) {
-    installer_->PostMessage(WM_CLOSE, 0, 0);
-  }
-
-  return S_OK;
-}
-
-HRESULT ShutdownEvents::CreateShutdownHandler(
-    bool is_machine,
-    BundleInstaller* installer,
-    ShutdownCallback** shutdown_callback) {
-  ASSERT1(installer);
-  ASSERT1(shutdown_callback);
-  ASSERT1(!*shutdown_callback);
-
-  scoped_ptr<ShutdownEvents> shutdown_events(new ShutdownEvents(installer));
-  HRESULT hr = shutdown_events->InitializeShutdownHandler(is_machine);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[InitializeShutDownHandler failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  *shutdown_callback = shutdown_events.release();
-  return S_OK;
-}
-
-}  // namespace omaha
diff --git a/client/shutdown_events.h b/client/shutdown_events.h
deleted file mode 100644
index 04fef05..0000000
--- a/client/shutdown_events.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_CLIENT_SHUTDOWN_EVENTS_H_
-#define OMAHA_CLIENT_SHUTDOWN_EVENTS_H_
-
-#include <windows.h>
-#include <atlsafe.h>
-#include "base/scoped_ptr.h"
-#include "omaha/base/shutdown_callback.h"
-#include "omaha/base/synchronized.h"
-
-namespace omaha {
-
-class BundleInstaller;
-class Reactor;
-class ShutdownHandler;
-
-class ShutdownEvents : public ShutdownCallback {
- public:
-  explicit ShutdownEvents(BundleInstaller* installer);
-  virtual ~ShutdownEvents();
-
-  HRESULT InitializeShutdownHandler(bool is_machine);
-  HRESULT Shutdown();
-  static HRESULT CreateShutdownHandler(bool is_machine,
-                                       BundleInstaller* installer,
-                                       ShutdownCallback** shutdown_callback);
-
- private:
-  BundleInstaller* installer_;
-
-  LLock lock_;
-  scoped_ptr<Reactor> reactor_;
-  scoped_ptr<ShutdownHandler> shutdown_handler_;
-
-  DISALLOW_IMPLICIT_CONSTRUCTORS(ShutdownEvents);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_CLIENT_SHUTDOWN_EVENTS_H_
diff --git a/client/ua.cc b/client/ua.cc
deleted file mode 100644
index 20e0d91..0000000
--- a/client/ua.cc
+++ /dev/null
@@ -1,197 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// TODO(omaha): Dig out the RefHolder in scope_guard.h so we can use const
-// references instead pointers. This TODO was added for some code that no longer
-// exists, but it is still a good idea.
-
-#include "omaha/client/ua.h"
-#include "omaha/client/ua_internal.h"
-#include <windows.h>
-#include <atlstr.h>
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/program_instance.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/utils.h"
-#include "omaha/client/install_apps.h"
-#include "omaha/client/install_self.h"
-#include "omaha/client/client_metrics.h"
-#include "omaha/common/app_registry_utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/event_logger.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/common/ping.h"
-
-// Design Notes:
-// Following are the mutexes that are taken by the worker
-// 1. SingleUpdateWorker. Only taken by the update worker.
-// 2. SingleInstallWorker. This is application specific. Only taken by the
-//    install worker and for the specific application.
-// 3. Before install, the install manager takes the global install lock.
-// 4. A key thing to add to this code is after taking the install lock,
-//    to validate that the version of the applicaion that is present in the
-//    registry is the same as that we queried for. The reason to do this
-//    is to ensure that there are no races between update and install workers.
-// 5. Termination of the worker happens because of four reasons:
-//    a. Shutdown event - Only applicable to the update worker. When this event
-//       is signalled, the main thread comes out of the wait. It then tries to
-//       destroy the contained thread pool, which causes a timed wait for the
-//       worker thread. The worker thread is notified by setting a
-//       cancelled flag on the worker.
-//    b. Install completes, user closes UI - Only applicable for the
-//       interactive installs. In this case the main thread comes out of
-//       the message loop and deletes the thread pool. The delete happens
-//       immediately, since the worker is doing nothing.
-//    c. User cancels install - Only applicable in case if interactive installs.
-//       The main thread sets the cancelled flag on the workerjob and comes out
-//       of the message loop. It then tries to delete the thread pool, causing
-//       a timed wait. The worker job queries the cancelled flag periodically
-//       and quits as soon as possible.
-//    d. The update worker completes - In this case we do not run on a thread
-//       pool.
-
-namespace omaha {
-
-namespace {
-
-void WriteUpdateAppsStartEvent(bool is_machine) {
-  GoogleUpdateLogEvent update_event(EVENTLOG_INFORMATION_TYPE,
-                                    kWorkerStartEventId,
-                                    is_machine);
-  update_event.set_event_desc(_T("Update Apps start"));
-
-  ConfigManager& cm = *ConfigManager::Instance();
-
-  int au_check_period_ms = cm.GetAutoUpdateTimerIntervalMs();
-  int time_since_last_checked_sec = cm.GetTimeSinceLastCheckedSec(is_machine);
-  bool is_period_overridden = false;
-  int last_check_period_ms = cm.GetLastCheckPeriodSec(&is_period_overridden);
-
-  CString event_text;
-  SafeCStringFormat(&event_text,
-      _T("AuCheckPeriodMs=%d, TimeSinceLastCheckedSec=%d, ")
-      _T("LastCheckedPeriodSec=%d"),
-      au_check_period_ms, time_since_last_checked_sec, last_check_period_ms);
-
-  update_event.set_event_text(event_text);
-  update_event.WriteEvent();
-}
-
-}  // namespace
-
-namespace internal {
-
-// Ensures there is only one instance of /ua per session per Omaha instance.
-bool EnsureSingleUAProcess(bool is_machine, ProgramInstance** instance) {
-  ASSERT1(instance);
-  ASSERT1(!*instance);
-  NamedObjectAttributes single_ua_process_attr;
-  GetNamedObjectAttributes(kUpdateAppsSingleInstance,
-                           is_machine,
-                           &single_ua_process_attr);
-
-  *instance = new ProgramInstance(single_ua_process_attr.name);
-  return !(*instance)->EnsureSingleInstance();
-}
-
-}  // namespace internal
-
-// Always checks whether it should uninstall.
-// Checks for updates of all apps if the required period has elapsed, it is
-// being run on-demand, or an uninstall seems necessary. It will also send a
-// self-update failure ping in these cases if necessary.
-//
-// Calls UpdateAllApps(), which will call IAppBundle::updateAllApps(), even in
-// cases where an uninstall seems necessary. This allows an uninstall ping to
-// be sent for any uninstalled apps. Because the COM server does not know about
-// uninstall, the COM server will also do a final update check for the remaining
-// app - should be Omaha. It's possible that this update check could result in
-// a self-update, in which case the uninstall may fail and be delayed an hour.
-// See http://b/2814535.
-// Since all pings are sent by the AppBundle destructor, if the bundle has
-// normal or uninstall pings need, the network request could delay the exiting
-// of the COM server beyond the point where this client releases the IAppBundle.
-// and launches /uninstall. This could cause uninstall to fail if the ping takes
-// a long time.
-//
-// TODO(omaha): Test this method as it is very important.
-HRESULT UpdateApps(bool is_machine,
-                   bool is_interactive,
-                   bool is_on_demand,
-                   const CString& install_source,
-                   const CString& display_language,
-                   bool* has_ui_been_displayed) {
-  CORE_LOG(L1, (_T("[UpdateApps]")));
-  ASSERT1(has_ui_been_displayed);
-
-  WriteUpdateAppsStartEvent(is_machine);
-
-  scoped_ptr<ProgramInstance> single_ua_process;
-
-  if (internal::EnsureSingleUAProcess(is_machine, address(single_ua_process))) {
-    OPT_LOG(L1, (_T("[Another worker is already running. Exiting.]")));
-    ++metric_client_another_update_in_progress;
-    return GOOPDATE_E_UA_ALREADY_RUNNING;
-  }
-
-  if (ConfigManager::Instance()->CanUseNetwork(is_machine)) {
-    VERIFY1(SUCCEEDED(Ping::SendPersistedPings(is_machine)));
-  }
-
-  // Generate a session ID for network accesses.
-  CString session_id;
-  VERIFY1(SUCCEEDED(GetGuid(&session_id)));
-
-  // A tentative uninstall check is done here. There are stronger checks,
-  // protected by locks, which are done by Setup.
-  size_t num_clients(0);
-  const bool is_uninstall =
-      FAILED(app_registry_utils::GetNumClients(is_machine, &num_clients)) ||
-      num_clients <= 1;
-  CORE_LOG(L4, (_T("[UpdateApps][registered apps: %u]"), num_clients));
-
-  const bool should_check_for_updates =
-      goopdate_utils::ShouldCheckForUpdates(is_machine);
-
-  if (is_uninstall) {
-    // TODO(omaha3): The interactive /ua process will not exit without user
-    // interaction. This could cause the uninstall to fail.
-    CORE_LOG(L1, (_T("[/ua launching /uninstall]")));
-    return goopdate_utils::LaunchUninstallProcess(is_machine);
-  }
-
-  if (!(is_on_demand || should_check_for_updates)) {
-    OPT_LOG(L1, (_T("[Update check not needed at this time]")));
-    return S_OK;
-  }
-
-  HRESULT hr = UpdateAllApps(is_machine,
-                             is_interactive,
-                             install_source,
-                             display_language,
-                             session_id,
-                             has_ui_been_displayed);
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[UpdateAllApps failed][0x%08x]"), hr));
-  }
-  return hr;
-}
-
-}  // namespace omaha
diff --git a/client/ua.h b/client/ua.h
deleted file mode 100644
index b0392a5..0000000
--- a/client/ua.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Functions related to the /ua "update apps" process.
-
-#ifndef OMAHA_CLIENT_UA_H_
-#define OMAHA_CLIENT_UA_H_
-
-#include <windows.h>
-#include <atlstr.h>
-
-namespace omaha {
-
-// TODO(omaha3): Should this be in a class or namespace?
-
-// Performs the duties of the silent auto-update process /ua.
-HRESULT UpdateApps(bool is_machine,
-                   bool is_interactive,
-                   bool is_on_demand,
-                   const CString& install_source,
-                   const CString& display_language,
-                   bool* has_ui_been_displayed);
-
-}  // namespace omaha
-
-#endif  // OMAHA_CLIENT_UA_H_
diff --git a/client/ua_internal.h b/client/ua_internal.h
deleted file mode 100644
index 0e3de1b..0000000
--- a/client/ua_internal.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_CLIENT_UA_INTERNAL_H_
-#define OMAHA_CLIENT_UA_INTERNAL_H_
-
-#include <windows.h>
-
-namespace omaha {
-
-class ProgramInstance;
-
-namespace internal {
-
-bool EnsureSingleUAProcess(bool is_machine, ProgramInstance** instance);
-
-}  // namespace internal
-
-}  // namespace omaha
-
-#endif  // OMAHA_CLIENT_UA_INTERNAL_H_
diff --git a/common/app_registry_utils.cc b/common/app_registry_utils.cc
deleted file mode 100644
index 2b31846..0000000
--- a/common/app_registry_utils.cc
+++ /dev/null
@@ -1,488 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/common/app_registry_utils.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/experiment_labels.h"
-
-namespace omaha {
-
-namespace app_registry_utils {
-
-CString GetAppClientsKey(bool is_machine, const CString& app_guid) {
-  return AppendRegKeyPath(
-      ConfigManager::Instance()->registry_clients(is_machine),
-      app_guid);
-}
-
-CString GetAppClientStateKey(bool is_machine, const CString& app_guid) {
-  return AppendRegKeyPath(
-      ConfigManager::Instance()->registry_client_state(is_machine),
-      app_guid);
-}
-
-CString GetAppClientStateMediumKey(bool is_machine, const CString& app_guid) {
-  ASSERT1(is_machine);
-  UNREFERENCED_PARAMETER(is_machine);
-  return AppendRegKeyPath(
-      ConfigManager::Instance()->machine_registry_client_state_medium(),
-      app_guid);
-}
-
-// The EULA is assumed to be accepted unless eualaccepted=0 in the ClientState
-// key. For machine apps in this case, eulaccepted=1 in ClientStateMedium also
-// indicates acceptance and the value in ClientState is updated.
-bool IsAppEulaAccepted(bool is_machine,
-                       const CString& app_guid,
-                       bool require_explicit_acceptance) {
-  const CString state_key = GetAppClientStateKey(is_machine, app_guid);
-
-  DWORD eula_accepted = 0;
-  if (SUCCEEDED(RegKey::GetValue(state_key,
-                                 kRegValueEulaAccepted,
-                                 &eula_accepted))) {
-    if (0 != eula_accepted) {
-      return true;
-    }
-  } else {
-    if (!require_explicit_acceptance) {
-      return true;
-    }
-  }
-
-  if (!is_machine) {
-    return false;
-  }
-
-  eula_accepted = 0;
-  if (SUCCEEDED(RegKey::GetValue(
-                    GetAppClientStateMediumKey(is_machine, app_guid),
-                    kRegValueEulaAccepted,
-                    &eula_accepted))) {
-    if (0 == eula_accepted) {
-      return false;
-    }
-  } else {
-    return false;
-  }
-
-  VERIFY1(SUCCEEDED(RegKey::SetValue(state_key,
-                                     kRegValueEulaAccepted,
-                                     eula_accepted)));
-  return true;
-}
-
-// Does not need to set ClientStateMedium.
-HRESULT SetAppEulaNotAccepted(bool is_machine, const CString& app_guid) {
-  return RegKey::SetValue(GetAppClientStateKey(is_machine, app_guid),
-                          kRegValueEulaAccepted,
-                          static_cast<DWORD>(0));
-}
-
-// Deletes eulaaccepted from ClientState and ClientStateMedium.
-HRESULT ClearAppEulaNotAccepted(bool is_machine, const CString& app_guid) {
-  const CString state_key = GetAppClientStateKey(is_machine, app_guid);
-  if (RegKey::HasKey(state_key)) {
-    HRESULT hr = RegKey::DeleteValue(state_key, kRegValueEulaAccepted);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  if (!is_machine) {
-    return S_OK;
-  }
-
-  const CString state_medium_key =
-      GetAppClientStateMediumKey(is_machine, app_guid);
-  if (RegKey::HasKey(state_medium_key)) {
-    HRESULT hr = RegKey::DeleteValue(state_medium_key, kRegValueEulaAccepted);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  return S_OK;
-}
-
-// For machine apps, ClientStateMedium takes precedence.
-// Does not propogate the ClientStateMedium value to ClientState.
-bool AreAppUsageStatsEnabled(bool is_machine, const CString& app_guid) {
-  if (is_machine) {
-    DWORD stats_enabled = 0;
-    if (SUCCEEDED(RegKey::GetValue(GetAppClientStateMediumKey(is_machine,
-                                                              app_guid),
-                                   kRegValueUsageStats,
-                                   &stats_enabled))) {
-      return (TRISTATE_TRUE == stats_enabled);
-    }
-  }
-
-  DWORD stats_enabled = 0;
-  if (SUCCEEDED(RegKey::GetValue(GetAppClientStateKey(is_machine, app_guid),
-                              kRegValueUsageStats,
-                              &stats_enabled))) {
-    return (TRISTATE_TRUE == stats_enabled);
-  }
-
-  return false;
-}
-
-// Does nothing if usage_stats_enable is TRISTATE_NONE.
-// For machine apps, clears ClientStateMedium because the app may be reading it
-// if present.
-HRESULT SetUsageStatsEnable(bool is_machine,
-                            const CString& app_guid,
-                            Tristate usage_stats_enable) {
-  if (TRISTATE_NONE == usage_stats_enable) {
-    return S_OK;
-  }
-
-  const DWORD stats_enabled = (TRISTATE_TRUE == usage_stats_enable) ? 1 : 0;
-
-  HRESULT hr = RegKey::SetValue(GetAppClientStateKey(is_machine, app_guid),
-                                kRegValueUsageStats,
-                                stats_enabled);
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[Failed to set usagestats][0x%08x]"), hr));
-    return hr;
-  }
-
-  if (!is_machine) {
-    return S_OK;
-  }
-
-  const CString state_medium_key =
-      GetAppClientStateMediumKey(is_machine, app_guid);
-  if (RegKey::HasKey(state_medium_key)) {
-    hr = RegKey::DeleteValue(state_medium_key, kRegValueUsageStats);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  return S_OK;
-}
-
-// Google Update does not have a referral_id. Everything else is the same as for
-// apps.
-HRESULT SetGoogleUpdateBranding(const CString& client_state_key_path,
-                                const CString& brand_code,
-                                const CString& client_id) {
-  HRESULT hr(SetAppBranding(client_state_key_path,
-                            brand_code,
-                            client_id,
-                            CString()));
-
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  RegKey state_key;
-  hr = state_key.Open(client_state_key_path);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Legacy support for older versions that do not write the FirstInstallTime.
-  // This code ensures that FirstInstallTime always has a valid non-zero value.
-  DWORD install_time(0);
-  if (FAILED(state_key.GetValue(kRegValueInstallTimeSec, &install_time)) ||
-      !install_time) {
-    const DWORD now = Time64ToInt32(GetCurrent100NSTime());
-    VERIFY1(SUCCEEDED(state_key.SetValue(kRegValueInstallTimeSec, now)));
-    CORE_LOG(L3, (_T("[InstallTime missing. Setting it here.][%u]"), now));
-  }
-
-  return S_OK;
-}
-
-// Branding information is only written if a brand code is not already present.
-// We should only write it if this is the first install of Omaha to avoid giving
-// undue credit to a later installer source. Writing a default brand code
-// prevents future branded installations from setting their brand.
-// As suggested by PSO, there is no default client ID.
-// Assumes the specified Client State key has been created.
-HRESULT SetAppBranding(const CString& client_state_key_path,
-                       const CString& brand_code,
-                       const CString& client_id,
-                       const CString& referral_id) {
-  CORE_LOG(L3, (_T("[app_registry_utils::SetAppBranding][%s][%s][%s][%s]"),
-                client_state_key_path, brand_code, client_id, referral_id));
-
-  if (brand_code.GetLength() > kBrandIdLength) {
-    return E_INVALIDARG;
-  }
-
-  RegKey state_key;
-  HRESULT hr = state_key.Create(client_state_key_path);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CString existing_brand_code;
-  hr = state_key.GetValue(kRegValueBrandCode, &existing_brand_code);
-  if (!existing_brand_code.IsEmpty()) {
-    ASSERT1(SUCCEEDED(hr));
-    if (existing_brand_code.GetLength() > kBrandIdLength) {
-      // Bug 1358852: Brand code garbled with one click.
-      VERIFY1(SUCCEEDED(state_key.SetValue(kRegValueBrandCode,
-                            existing_brand_code.Left(kBrandIdLength))));
-    }
-    return S_OK;
-  }
-
-  const TCHAR* brand_code_to_write = brand_code.IsEmpty() ?
-                                     kDefaultGoogleUpdateBrandCode :
-                                     brand_code;
-  hr = state_key.SetValue(kRegValueBrandCode, brand_code_to_write);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (!client_id.IsEmpty()) {
-    hr = state_key.SetValue(kRegValueClientId, client_id);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  if (!referral_id.IsEmpty()) {
-    hr = state_key.SetValue(kRegValueReferralId, referral_id);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  const DWORD now = Time64ToInt32(GetCurrent100NSTime());
-  VERIFY1(SUCCEEDED(state_key.SetValue(kRegValueInstallTimeSec, now)));
-
-  return S_OK;
-}
-
-void PersistSuccessfulInstall(const CString& client_state_key_path,
-                              bool is_update,
-                              bool is_offline) {
-  CORE_LOG(L3,
-           (_T("[app_registry_utils::PersistSuccessfulInstall][%s][%d][%d]"),
-            client_state_key_path, is_update, is_offline));
-  ASSERT1(!is_update || !is_offline);
-
-  ClearUpdateAvailableStats(client_state_key_path);
-
-  if (!is_offline) {
-    // TODO(omaha): the semantics of this function are confusing in the
-    // case of recording a successful update check. Omaha knows
-    // precisely when an update check with the server is being made and it
-    // can call PersistSuccessfulUpdateCheck without making any other
-    // assumptions.
-    //
-    // Assumes that all updates are online.
-    PersistSuccessfulUpdateCheck(client_state_key_path);
-  }
-
-  if (is_update) {
-    const DWORD now = Time64ToInt32(GetCurrent100NSTime());
-    VERIFY1(SUCCEEDED(RegKey::SetValue(client_state_key_path,
-                                       kRegValueLastUpdateTimeSec,
-                                       now)));
-  }
-}
-
-void PersistSuccessfulUpdateCheck(const CString& client_state_key_path) {
-  CORE_LOG(L3, (_T("[app_registry_utils::PersistSuccessfulUpdateCheck][%s]"),
-                client_state_key_path));
-  const DWORD now = Time64ToInt32(GetCurrent100NSTime());
-  VERIFY1(SUCCEEDED(RegKey::SetValue(client_state_key_path,
-                                     kRegValueLastSuccessfulCheckSec,
-                                     now)));
-}
-
-void ClearUpdateAvailableStats(const CString& client_state_key_path) {
-  CORE_LOG(L3, (_T("[app_registry_utils::ClearUpdateAvailableStats][%s]"),
-                client_state_key_path));
-
-  RegKey state_key;
-  HRESULT hr = state_key.Open(client_state_key_path);
-  if (FAILED(hr)) {
-    return;
-  }
-
-  VERIFY1(SUCCEEDED(state_key.DeleteValue(kRegValueUpdateAvailableCount)));
-  VERIFY1(SUCCEEDED(state_key.DeleteValue(kRegValueUpdateAvailableSince)));
-}
-
-HRESULT GetNumClients(bool is_machine, size_t* num_clients) {
-  ASSERT1(num_clients);
-  RegKey reg_key;
-  HKEY root_key = is_machine ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
-  HRESULT hr = reg_key.Open(root_key, GOOPDATE_REG_RELATIVE_CLIENTS, KEY_READ);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  DWORD num_subkeys(0);
-  LONG error = ::RegQueryInfoKey(reg_key.Key(), NULL, NULL, NULL, &num_subkeys,
-                                 NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-  if (error != ERROR_SUCCESS) {
-    return HRESULT_FROM_WIN32(error);
-  }
-  *num_clients = num_subkeys;
-  return S_OK;
-}
-
-// Reads pv value from Clients key.
-void GetAppVersion(bool is_machine, const CString& app_id, CString* pv) {
-  ASSERT1(pv);
-  RegKey key;
-  CString key_name = GetAppClientsKey(is_machine, app_id);
-  HRESULT hr = key.Open(key_name, KEY_READ);
-  if (SUCCEEDED(hr)) {
-    key.GetValue(kRegValueProductVersion, pv);
-  }
-}
-
-// Reads the following values from the registry:
-//  ClientState key
-//    pv
-//    ap
-//    lang
-//    brand
-//    client
-//    iid
-//    experiment
-void GetClientStateData(bool is_machine,
-                        const CString& app_id,
-                        CString* pv,
-                        CString* ap,
-                        CString* lang,
-                        CString* brand_code,
-                        CString* client_id,
-                        CString* iid,
-                        CString* experiment_labels) {
-  RegKey key;
-
-  CString key_name = GetAppClientStateKey(is_machine, app_id);
-  HRESULT hr = key.Open(key_name, KEY_READ);
-  if (FAILED(hr)) {
-    return;
-  }
-
-  if (pv) {
-    key.GetValue(kRegValueProductVersion, pv);
-  }
-  if (ap) {
-    key.GetValue(kRegValueAdditionalParams, ap);
-  }
-  if (lang) {
-    key.GetValue(kRegValueLanguage, lang);
-  }
-  if (brand_code) {
-    key.GetValue(kRegValueBrandCode, brand_code);
-  }
-  if (client_id) {
-    key.GetValue(kRegValueClientId, client_id);
-  }
-  if (iid) {
-    key.GetValue(kRegValueInstallationId, iid);
-  }
-  if (experiment_labels) {
-    key.GetValue(kRegValueExperimentLabels, experiment_labels);
-  }
-}
-
-HRESULT GetUninstalledApps(bool is_machine,
-                           std::vector<CString>* app_ids) {
-  ASSERT1(app_ids);
-
-  RegKey client_state_key;
-  HRESULT hr = client_state_key.Open(
-      ConfigManager::Instance()->registry_client_state(is_machine),
-      KEY_READ);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  int num_sub_keys = client_state_key.GetSubkeyCount();
-  for (int i = 0; i < num_sub_keys; ++i) {
-    CString app_id;
-    hr = client_state_key.GetSubkeyNameAt(i, &app_id);
-    if (FAILED(hr)) {
-      continue;
-    }
-
-    // If the app is not registered, treat it as uninstalled.
-    if (!RegKey::HasValue(
-        app_registry_utils::GetAppClientsKey(is_machine, app_id),
-        kRegValueProductVersion)) {
-      app_ids->push_back(app_id);
-    }
-  }
-
-  return S_OK;
-}
-
-HRESULT RemoveClientState(bool is_machine, const CString& app_guid) {
-  const CString state_key = GetAppClientStateKey(is_machine, app_guid);
-  HRESULT state_hr = RegKey::DeleteKey(state_key, true);
-  if (!is_machine) {
-    return state_hr;
-  }
-
-  const CString state_medium_key = GetAppClientStateMediumKey(is_machine,
-                                                              app_guid);
-  HRESULT state_medium_hr = RegKey::DeleteKey(state_medium_key, true);
-  return FAILED(state_hr) ? state_hr : state_medium_hr;
-}
-
-void RemoveClientStateForApps(bool is_machine,
-                              const std::vector<CString>& apps) {
-  std::vector<CString>::const_iterator it;
-  for (it = apps.begin(); it != apps.end(); ++it) {
-    RemoveClientState(is_machine, *it);
-  }
-}
-
-HRESULT GetExperimentLabels(bool is_machine, const CString& app_id,
-                            CString* labels_out) {
-  ASSERT1(!app_id.IsEmpty());
-  ASSERT1(labels_out);
-
-  const CString state_key = GetAppClientStateKey(is_machine, app_id);
-  if (!RegKey::HasValue(state_key, kRegValueExperimentLabels)) {
-    return S_OK;
-  }
-
-  return RegKey::GetValue(state_key, kRegValueExperimentLabels, labels_out);
-}
-
-HRESULT SetExperimentLabels(bool is_machine, const CString& app_id,
-                            const CString& new_labels) {
-  ASSERT1(!app_id.IsEmpty());
-  ASSERT1(ExperimentLabels::IsStringValidLabelSet(new_labels));
-
-  return RegKey::SetValue(GetAppClientStateKey(is_machine, app_id),
-                          kRegValueExperimentLabels,
-                          new_labels);
-}
-
-}  // namespace app_registry_utils
-
-}  // namespace omaha
diff --git a/common/app_registry_utils.h b/common/app_registry_utils.h
deleted file mode 100644
index 091d7f0..0000000
--- a/common/app_registry_utils.h
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_APP_REGISTRY_UTILS_H_
-#define OMAHA_COMMON_APP_REGISTRY_UTILS_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include <vector>
-#include "omaha/base/constants.h"
-
-// Functions that modify the application state in the registry. This file should
-// only be included by AppManager, which manages the persisting of all
-// application information, ApplicationUsageData for similar reasons, and
-// self-install code, which must modify these values directly in some cases.
-
-namespace omaha {
-
-namespace app_registry_utils {
-
-// Returns the application registration path for the specified app.
-CString GetAppClientsKey(bool is_machine, const CString& app_guid);
-
-// Returns the application state path for the specified app.
-CString GetAppClientStateKey(bool is_machine, const CString& app_guid);
-
-// Returns the medium integrity application state path for the specified app.
-CString GetAppClientStateMediumKey(bool is_machine, const CString& app_guid);
-
-// Returns whether the EULA is accepted for the app.
-bool IsAppEulaAccepted(bool is_machine,
-                       const CString& app_guid,
-                       bool require_explicit_acceptance);
-
-// Sets eulaaccepted=0 in the app's ClientState.
-HRESULT SetAppEulaNotAccepted(bool is_machine, const CString& app_guid);
-
-// Clears any eulaaccepted=0 values for the app.
-HRESULT ClearAppEulaNotAccepted(bool is_machine, const CString& app_guid);
-
-// Determines whether usage stats are enabled for a specific app.
-bool AreAppUsageStatsEnabled(bool is_machine, const CString& app_guid);
-
-// Configures Omaha's collection of usage stats and crash reports.
-HRESULT SetUsageStatsEnable(bool is_machine,
-                            const CString& app_guid,
-                            Tristate usage_stats_enable);
-
-// Writes branding information for Google Update in the registry if it does not
-// already exist. Otherwise, the information remains unchanged.
-// Writes a default Omaha-specific brand code if one is not specified in args.
-HRESULT SetGoogleUpdateBranding(const CString& client_state_key_path,
-                                const CString& brand_code,
-                                const CString& client_id);
-
-// Writes branding information for apps in the registry if it does not
-// already exist. Otherwise, the information remains unchanged.
-// Writes a default Omaha-specific brand code if one is not specified in args.
-HRESULT SetAppBranding(const CString& client_state_key_path,
-                       const CString& brand_code,
-                       const CString& client_id,
-                       const CString& referral_id);
-
-// Updates the application state after a successful install or update.
-void PersistSuccessfulInstall(const CString& client_state_key_path,
-                              bool is_update,
-                              bool is_offline);
-
-// Updates the application state after a successful update check event, which
-// is either a "noupdate" response or a successful online update.
-void PersistSuccessfulUpdateCheck(const CString& client_state_key_path);
-
-// Clears the stored information about update available events for the app.
-// Call when an update has succeeded.
-void ClearUpdateAvailableStats(const CString& client_state_key_path);
-
-// Returns the number of clients registered under the "Clients" sub key.
-// Does not guarantee a consistent state. Caller should use appropriate locks if
-// necessary.
-HRESULT GetNumClients(bool is_machine, size_t* num_clients);
-
-// Reads app version from Clients key.
-void GetAppVersion(bool is_machine, const CString& app_id, CString* pv);
-
-// Reads persistent data for an application. The parameters can be NULL to
-// indicate that value is not required.
-void GetClientStateData(bool is_machine,
-                        const CString& app_id,
-                        CString* pv,
-                        CString* ap,
-                        CString* lang,
-                        CString* brand_code,
-                        CString* client_id,
-                        CString* iid,
-                        CString* experiment_labels);
-
-// Reads all uninstalled apps from the registry.
-HRESULT GetUninstalledApps(bool is_machine, std::vector<CString>* app_ids);
-
-// Removes the client state for the given app.
-HRESULT RemoveClientState(bool is_machine, const CString& app_guid);
-
-// Removes the client state for the apps.
-void RemoveClientStateForApps(bool is_machine,
-                              const std::vector<CString>& apps);
-
-// Retrieves experiment labels for an app from the Registry.
-HRESULT GetExperimentLabels(bool is_machine, const CString& app_id,
-                            CString* labels_out);
-
-// Overwrites the experiment labels for an app in the Registry.
-HRESULT SetExperimentLabels(bool is_machine, const CString& app_id,
-                            const CString& new_labels);
-
-}  // namespace app_registry_utils
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_APP_REGISTRY_UTILS_H_
diff --git a/common/app_registry_utils_unittest.cc b/common/app_registry_utils_unittest.cc
deleted file mode 100644
index e0e628d..0000000
--- a/common/app_registry_utils_unittest.cc
+++ /dev/null
@@ -1,2451 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/reg_key.h"
-#include "omaha/common/app_registry_utils.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-#define APP_GUID _T("{B7BAF788-9D64-49c3-AFDC-B336AB12F332}")
-const TCHAR* const kAppGuid = APP_GUID;
-const TCHAR* const kAppMachineClientStatePath =
-    _T("HKLM\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientState\\") APP_GUID;
-const TCHAR* const kAppUserClientStatePath =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientState\\") APP_GUID;
-const TCHAR* const kAppMachineClientStateMediumPath =
-    _T("HKLM\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientStateMedium\\") APP_GUID;
-
-// This should never exist. This contant is only used to verify it is not used.
-const TCHAR* const kAppUserClientStateMediumPath =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientStateMedium\\") APP_GUID;
-
-const TCHAR* const kOmahaMachineClientsPath =
-    _T("HKLM\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\Clients\\") GOOPDATE_APP_ID;
-
-const TCHAR* const kOmahaUserClientsPath =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\Clients\\") GOOPDATE_APP_ID;
-
-const TCHAR* const kOmahaMachineClientStatePath =
-    _T("HKLM\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientState\\") GOOPDATE_APP_ID;
-
-const TCHAR* const kOmahaUserClientStatePath =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientState\\") GOOPDATE_APP_ID;
-
-}  // namespace
-
-namespace app_registry_utils {
-
-TEST(AppRegistryUtilsTest, GetAppClientsKey) {
-  const TCHAR kAppGuid[] = _T("{F998D7E0-0CD3-434e-96B9-B8D3A295C3FB}");
-
-  EXPECT_STREQ(_T("HKCU\\Software\\") SHORT_COMPANY_NAME
-               _T("\\") PRODUCT_NAME _T("\\Clients\\")
-               _T("{F998D7E0-0CD3-434e-96B9-B8D3A295C3FB}"),
-               GetAppClientsKey(false, kAppGuid));
-  EXPECT_STREQ(_T("HKLM\\Software\\") SHORT_COMPANY_NAME
-               _T("\\") PRODUCT_NAME _T("\\Clients\\")
-               _T("{F998D7E0-0CD3-434e-96B9-B8D3A295C3FB}"),
-               GetAppClientsKey(true, kAppGuid));
-}
-
-TEST(AppRegistryUtilsTest, GetAppClientStateKey) {
-  const TCHAR kAppGuid[] = _T("{F998D7E0-0CD3-434e-96B9-B8D3A295C3FB}");
-
-  EXPECT_STREQ(_T("HKCU\\Software\\") SHORT_COMPANY_NAME
-               _T("\\") PRODUCT_NAME _T("\\ClientState\\")
-               _T("{F998D7E0-0CD3-434e-96B9-B8D3A295C3FB}"),
-               GetAppClientStateKey(false, kAppGuid));
-  EXPECT_STREQ(_T("HKLM\\Software\\") SHORT_COMPANY_NAME
-               _T("\\") PRODUCT_NAME _T("\\ClientState\\")
-               _T("{F998D7E0-0CD3-434e-96B9-B8D3A295C3FB}"),
-               GetAppClientStateKey(true, kAppGuid));
-}
-
-// This is an invalid case and causes an assert. Always returns HKLM path.
-TEST(AppRegistryUtilsTest, GetAppClientStateMediumKey_User) {
-  const TCHAR kAppGuid[] = _T("{F998D7E0-0CD3-434e-96B9-B8D3A295C3FB}");
-  ExpectAsserts expect_asserts;
-  EXPECT_STREQ(_T("HKLM\\Software\\") SHORT_COMPANY_NAME
-               _T("\\") PRODUCT_NAME _T("\\ClientStateMedium\\")
-               _T("{F998D7E0-0CD3-434e-96B9-B8D3A295C3FB}"),
-               GetAppClientStateMediumKey(false, kAppGuid));
-}
-
-TEST(AppRegistryUtilsTest, GetAppClientStateMediumKey_Machine) {
-  const TCHAR kAppGuid[] = _T("{F998D7E0-0CD3-434e-96B9-B8D3A295C3FB}");
-  EXPECT_STREQ(_T("HKLM\\Software\\") SHORT_COMPANY_NAME
-               _T("\\") PRODUCT_NAME _T("\\ClientStateMedium\\")
-               _T("{F998D7E0-0CD3-434e-96B9-B8D3A295C3FB}"),
-               GetAppClientStateMediumKey(true, kAppGuid));
-}
-
-// This is an invalid case and causes an assert.
-TEST(AppRegistryUtilsTest, GetAppClientStateMediumKey_UserAndMachineAreSame) {
-  const TCHAR kAppGuid[] = _T("{F998D7E0-0CD3-434e-96B9-B8D3A295C3FB}");
-  ExpectAsserts expect_asserts;
-  EXPECT_STREQ(GetAppClientStateMediumKey(true, kAppGuid),
-               GetAppClientStateMediumKey(false, kAppGuid));
-}
-
-class AppRegistryUtilsRegistryProtectedTest : public testing::Test {
- protected:
-  AppRegistryUtilsRegistryProtectedTest()
-      : hive_override_key_name_(kRegistryHiveOverrideRoot) {
-  }
-
-  CString hive_override_key_name_;
-
-  virtual void SetUp() {
-    RegKey::DeleteKey(hive_override_key_name_, true);
-    OverrideRegistryHives(hive_override_key_name_);
-  }
-
-  virtual void TearDown() {
-    RestoreRegistryHives();
-    ASSERT_SUCCEEDED(RegKey::DeleteKey(hive_override_key_name_, true));
-  }
-};
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_NotExplicit_NoKey) {
-  EXPECT_TRUE(IsAppEulaAccepted(true, kAppGuid, false));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_NotExplicit_ClientStateExists) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kAppMachineClientStatePath));
-  EXPECT_TRUE(IsAppEulaAccepted(true, kAppGuid, false));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_NotExplicit_ClientStateOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_TRUE(IsAppEulaAccepted(true, kAppGuid, false));
-  EXPECT_EQ(1, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_NotExplicit_ClientStateNegativeOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(-1)));
-  EXPECT_TRUE(IsAppEulaAccepted(true, kAppGuid, false));
-  EXPECT_EQ(-1, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_NotExplicit_ClientStateZero_MediumNotExist) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_FALSE(IsAppEulaAccepted(true, kAppGuid, false));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_NotExplicit_ClientStateZero_MediumExists) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kAppMachineClientStateMediumPath));
-  EXPECT_FALSE(IsAppEulaAccepted(true, kAppGuid, false));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_NotExplicit_ClientStateZero_MediumOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_TRUE(IsAppEulaAccepted(true, kAppGuid, false));
-  EXPECT_EQ(1, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(1, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-    IsAppEulaAccepted_Machine_NotExplicit_ClientStateZero_MediumNegativeOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(-1)));
-  EXPECT_TRUE(IsAppEulaAccepted(true, kAppGuid, false));
-  EXPECT_EQ(-1, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(-1, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-// Also tests that user values are not used.
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_NotExplicit_ClientStateZero_MediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_FALSE(IsAppEulaAccepted(true, kAppGuid, false));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("eulaaccepted")));
-  EXPECT_EQ(1, GetDwordValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(1, GetDwordValue(kAppUserClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-// ClientStateMedium does not override ClientState.
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_NotExplicit_ClientStateOne_MediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_TRUE(IsAppEulaAccepted(true, kAppGuid, false));
-  EXPECT_EQ(1, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-// Implicitly accepted because of the absence of eualaccepted=0.
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_NotExplicit_ClientStateNotExist_MediumOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_TRUE(IsAppEulaAccepted(true, kAppGuid, false));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(1, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-// Implicitly accepted because of the absence of eualaccepted=0.
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_NotExplicit_ClientStateNotExist_MediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_TRUE(IsAppEulaAccepted(true, kAppGuid, false));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_Explicit_NoKey) {
-  EXPECT_FALSE(IsAppEulaAccepted(true, kAppGuid, true));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_Explicit_ClientStateExists) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kAppMachineClientStatePath));
-  EXPECT_FALSE(IsAppEulaAccepted(true, kAppGuid, true));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_Explicit_ClientStateOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_TRUE(IsAppEulaAccepted(true, kAppGuid, true));
-  EXPECT_EQ(1, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_Explicit_ClientStateNegativeOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(-1)));
-  EXPECT_TRUE(IsAppEulaAccepted(true, kAppGuid, true));
-  EXPECT_EQ(-1, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_Explicit_ClientStateZero_MediumNotExist) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_FALSE(IsAppEulaAccepted(true, kAppGuid, true));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_Explicit_ClientStateZero_MediumExists) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kAppMachineClientStateMediumPath));
-  EXPECT_FALSE(IsAppEulaAccepted(true, kAppGuid, true));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_Explicit_ClientStateZero_MediumOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_TRUE(IsAppEulaAccepted(true, kAppGuid, true));
-  EXPECT_EQ(1, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(1, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_Explicit_ClientStateZero_MediumNegativeOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(-1)));
-  EXPECT_TRUE(IsAppEulaAccepted(true, kAppGuid, true));
-  EXPECT_EQ(-1, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(-1, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-// Also tests that user values are not used.
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_Explicit_ClientStateZero_MediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_FALSE(IsAppEulaAccepted(true, kAppGuid, true));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("eulaaccepted")));
-  EXPECT_EQ(1, GetDwordValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(1, GetDwordValue(kAppUserClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-// ClientStateMedium does not override ClientState.
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_Explicit_ClientStateOne_MediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_TRUE(IsAppEulaAccepted(true, kAppGuid, true));
-  EXPECT_EQ(1, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_Explicit_ClientStateNotExist_MediumOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_TRUE(IsAppEulaAccepted(true, kAppGuid, true));
-  EXPECT_EQ(1, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(1, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_Machine_Explicit_ClientStateNotExist_MediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_FALSE(IsAppEulaAccepted(true, kAppGuid, true));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-// ClientStateMedium is not supported for user apps.
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_User_NotExplicit_NoKey) {
-  EXPECT_TRUE(IsAppEulaAccepted(false, kAppGuid, false));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_User_NotExplicit_ClientStateExists) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kAppUserClientStatePath));
-  EXPECT_TRUE(IsAppEulaAccepted(false, kAppGuid, false));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_User_NotExplicit_ClientStateOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_TRUE(IsAppEulaAccepted(false, kAppGuid, false));
-  EXPECT_EQ(1, GetDwordValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_User_NotExplicit_ClientStateNegativeOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(-1)));
-  EXPECT_TRUE(IsAppEulaAccepted(false, kAppGuid, false));
-  EXPECT_EQ(-1, GetDwordValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_User_NotExplicit_ClientStateZero_MediumNotExist) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_FALSE(IsAppEulaAccepted(false, kAppGuid, false));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_User_NotExplicit_ClientStateZero_MediumExists) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kAppUserClientStateMediumPath));
-  EXPECT_FALSE(IsAppEulaAccepted(false, kAppGuid, false));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_User_NotExplicit_ClientStateZero_MediumOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_FALSE(IsAppEulaAccepted(false, kAppGuid, false));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(1, GetDwordValue(kAppUserClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_User_NotExplicit_ClientStateZero_MediumNegativeOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(-1)));
-  EXPECT_FALSE(IsAppEulaAccepted(false, kAppGuid, false));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(-1, GetDwordValue(kAppUserClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-// Also tests that machine values are not used.
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_User_NotExplicit_ClientStateZero_MediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_FALSE(IsAppEulaAccepted(false, kAppGuid, false));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStateMediumPath,
-                             _T("eulaaccepted")));
-  EXPECT_EQ(1, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(1, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-// ClientStateMedium is not used.
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_User_NotExplicit_ClientStateOne_MediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_TRUE(IsAppEulaAccepted(false, kAppGuid, false));
-  EXPECT_EQ(1, GetDwordValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-// Implicitly accepted because of the absence of eualaccepted=0.
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_User_NotExplicit_ClientStateNotExist_MediumOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_TRUE(IsAppEulaAccepted(false, kAppGuid, false));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(1, GetDwordValue(kAppUserClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-// Implicitly accepted because of the absence of eualaccepted=0.
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_User_NotExplicit_ClientStateNotExist_MediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_TRUE(IsAppEulaAccepted(false, kAppGuid, false));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_User_Explicit_NoKey) {
-  EXPECT_FALSE(IsAppEulaAccepted(false, kAppGuid, true));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_User_Explicit_ClientStateExists) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kAppUserClientStatePath));
-  EXPECT_FALSE(IsAppEulaAccepted(false, kAppGuid, true));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_User_Explicit_ClientStateOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_TRUE(IsAppEulaAccepted(false, kAppGuid, true));
-  EXPECT_EQ(1, GetDwordValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_User_Explicit_ClientStateNotExist_MediumOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_FALSE(IsAppEulaAccepted(false, kAppGuid, true));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(1, GetDwordValue(kAppUserClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       IsAppEulaAccepted_User_Explicit_ClientStateNotExist_MediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_FALSE(IsAppEulaAccepted(false, kAppGuid, true));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppEulaNotAccepted_Machine_NoKey) {
-  EXPECT_SUCCEEDED(SetAppEulaNotAccepted(true, kAppGuid));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppEulaNotAccepted_Machine_ClientStateExists) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kAppMachineClientStatePath));
-  EXPECT_SUCCEEDED(SetAppEulaNotAccepted(true, kAppGuid));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppEulaNotAccepted_Machine_ClientStateOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(SetAppEulaNotAccepted(true, kAppGuid));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppEulaNotAccepted_Machine_ClientStateZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(SetAppEulaNotAccepted(true, kAppGuid));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppEulaNotAccepted_Machine_ClientStateZero_ClientStateMediumOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(SetAppEulaNotAccepted(true, kAppGuid));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(1, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-// Also tests that user values are not affected.
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppEulaNotAccepted_Machine_ClientStateZero_ClientStateMediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(SetAppEulaNotAccepted(true, kAppGuid));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("eulaaccepted")));
-  EXPECT_EQ(1, GetDwordValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(1, GetDwordValue(kAppUserClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppEulaNotAccepted_User_NoKey) {
-  EXPECT_SUCCEEDED(SetAppEulaNotAccepted(false, kAppGuid));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppEulaNotAccepted_User_ClientStateExists) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kAppUserClientStatePath));
-  EXPECT_SUCCEEDED(SetAppEulaNotAccepted(false, kAppGuid));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppEulaNotAccepted_User_ClientStateOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(SetAppEulaNotAccepted(false, kAppGuid));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppEulaNotAccepted_User_ClientStateZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(SetAppEulaNotAccepted(false, kAppGuid));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppEulaNotAccepted_User_ClientStateZero_ClientStateMediumOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(SetAppEulaNotAccepted(false, kAppGuid));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(1, GetDwordValue(kAppUserClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-// Also tests that machine values are not affected.
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppEulaNotAccepted_User_ClientStateZero_ClientStateMediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(SetAppEulaNotAccepted(false, kAppGuid));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStateMediumPath,
-                             _T("eulaaccepted")));
-  EXPECT_EQ(1, GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(1, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       ClearAppEulaNotAccepted_Machine_NoKey) {
-  EXPECT_SUCCEEDED(ClearAppEulaNotAccepted(true, kAppGuid));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       ClearAppEulaNotAccepted_Machine_ClientStateExists) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kAppMachineClientStatePath));
-  EXPECT_SUCCEEDED(ClearAppEulaNotAccepted(true, kAppGuid));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       ClearAppEulaNotAccepted_Machine_ClientStateOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(ClearAppEulaNotAccepted(true, kAppGuid));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       ClearAppEulaNotAccepted_Machine_ClientStateZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(ClearAppEulaNotAccepted(true, kAppGuid));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       ClearAppEulaNotAccepted_Machine_ClientStateZero_ClientStateMediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(ClearAppEulaNotAccepted(true, kAppGuid));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("eulaaccepted")));
-}
-
-// Also tests that user values are not affected.
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       ClearAppEulaNotAccepted_Machine_ClientStateNone_ClientStateMediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(ClearAppEulaNotAccepted(true, kAppGuid));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("eulaaccepted")));
-  EXPECT_EQ(0,
-            GetDwordValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(0,
-            GetDwordValue(kAppUserClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       ClearAppEulaNotAccepted_User_NoKey) {
-  EXPECT_SUCCEEDED(ClearAppEulaNotAccepted(false, kAppGuid));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       ClearAppEulaNotAccepted_User_ClientStateExists) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kAppUserClientStatePath));
-  EXPECT_SUCCEEDED(ClearAppEulaNotAccepted(false, kAppGuid));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       ClearAppEulaNotAccepted_User_ClientStateOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(ClearAppEulaNotAccepted(false, kAppGuid));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       ClearAppEulaNotAccepted_User_ClientStateZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(ClearAppEulaNotAccepted(false, kAppGuid));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       ClearAppEulaNotAccepted_User_ClientStateZero_ClientStateMediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(ClearAppEulaNotAccepted(false, kAppGuid));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(0,
-            GetDwordValue(kAppUserClientStateMediumPath, _T("eulaaccepted")));
-}
-
-// Also tests that machine values are not affected.
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       ClearAppEulaNotAccepted_User_ClientStateNone_ClientStateMediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(ClearAppEulaNotAccepted(false, kAppGuid));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(0,
-            GetDwordValue(kAppUserClientStateMediumPath, _T("eulaaccepted")));
-  EXPECT_EQ(0,
-            GetDwordValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("eulaaccepted")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_Machine_NoKey) {
-  EXPECT_FALSE(AreAppUsageStatsEnabled(true, kAppGuid));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStatePath, _T("usagestats")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("usagestats")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_Machine_ClientStateExists) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kAppMachineClientStatePath));
-  EXPECT_FALSE(AreAppUsageStatsEnabled(true, kAppGuid));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStatePath, _T("usagestats")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("usagestats")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_Machine_ClientStateOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_TRUE(AreAppUsageStatsEnabled(true, kAppGuid));
-  EXPECT_EQ(1, GetDwordValue(kAppMachineClientStatePath, _T("usagestats")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("usagestats")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_Machine_ClientStateNegativeOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(-1)));
-  EXPECT_FALSE(AreAppUsageStatsEnabled(true, kAppGuid));
-  EXPECT_EQ(-1, GetDwordValue(kAppMachineClientStatePath, _T("usagestats")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("usagestats")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_Machine_ClientStateZero_MediumNotExist) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_FALSE(AreAppUsageStatsEnabled(true, kAppGuid));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStatePath, _T("usagestats")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("usagestats")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_Machine_ClientStateZero_MediumExists) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kAppMachineClientStateMediumPath));
-  EXPECT_FALSE(AreAppUsageStatsEnabled(true, kAppGuid));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStatePath, _T("usagestats")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("usagestats")));
-}
-
-// ClientStateMedium overrides ClientState.
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_Machine_ClientStateZero_MediumOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_TRUE(AreAppUsageStatsEnabled(true, kAppGuid));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStatePath, _T("usagestats")));
-  EXPECT_EQ(1, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("usagestats")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-    AreAppUsageStatsEnabled_Machine_ClientStateZero_MediumNegativeOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(-1)));
-  EXPECT_FALSE(AreAppUsageStatsEnabled(true, kAppGuid));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStatePath, _T("usagestats")));
-  EXPECT_EQ(-1, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("usagestats")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_Machine_ClientStateZero_MediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_FALSE(AreAppUsageStatsEnabled(true, kAppGuid));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStatePath, _T("usagestats")));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("usagestats")));
-}
-
-// ClientStateMedium overrides ClientState.
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_Machine_ClientStateOne_MediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_FALSE(AreAppUsageStatsEnabled(true, kAppGuid));
-  EXPECT_EQ(1, GetDwordValue(kAppMachineClientStatePath, _T("usagestats")));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("usagestats")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_Machine_ClientStateNotExist_MediumOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_TRUE(AreAppUsageStatsEnabled(true, kAppGuid));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStatePath, _T("usagestats")));
-  EXPECT_EQ(1, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("usagestats")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_Machine_ClientStateNotExist_MediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_FALSE(AreAppUsageStatsEnabled(true, kAppGuid));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStatePath, _T("usagestats")));
-  EXPECT_EQ(0, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("usagestats")));
-}
-
-// User does not affect machine.
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_Machine_UserOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_FALSE(AreAppUsageStatsEnabled(true, kAppGuid));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStatePath, _T("usagestats")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("usagestats")));
-  EXPECT_EQ(1, GetDwordValue(kAppUserClientStatePath, _T("usagestats")));
-  EXPECT_EQ(1, GetDwordValue(kAppUserClientStateMediumPath,
-                             _T("usagestats")));
-}
-
-// ClientStateMedium is not supported for user apps.
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_User_NoKey) {
-  EXPECT_FALSE(AreAppUsageStatsEnabled(false, kAppGuid));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStatePath, _T("usagestats")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("usagestats")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_User_ClientStateExists) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kAppUserClientStatePath));
-  EXPECT_FALSE(AreAppUsageStatsEnabled(false, kAppGuid));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStatePath, _T("usagestats")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("usagestats")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_User_ClientStateOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_TRUE(AreAppUsageStatsEnabled(false, kAppGuid));
-  EXPECT_EQ(1, GetDwordValue(kAppUserClientStatePath, _T("usagestats")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("usagestats")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_User_ClientStateNegativeOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(-1)));
-  EXPECT_FALSE(AreAppUsageStatsEnabled(false, kAppGuid));
-  EXPECT_EQ(-1, GetDwordValue(kAppUserClientStatePath, _T("usagestats")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("usagestats")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_User_ClientStateZero_MediumNotExist) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_FALSE(AreAppUsageStatsEnabled(false, kAppGuid));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStatePath, _T("usagestats")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("usagestats")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_User_ClientStateZero_MediumExists) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kAppUserClientStateMediumPath));
-  EXPECT_FALSE(AreAppUsageStatsEnabled(false, kAppGuid));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStatePath, _T("usagestats")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("usagestats")));
-}
-
-// ClientStateMedium is not used.
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_User_ClientStateZero_MediumOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_FALSE(AreAppUsageStatsEnabled(false, kAppGuid));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStatePath, _T("usagestats")));
-  EXPECT_EQ(1, GetDwordValue(kAppUserClientStateMediumPath,
-                             _T("usagestats")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_User_ClientStateZero_MediumNegativeOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(-1)));
-  EXPECT_FALSE(AreAppUsageStatsEnabled(false, kAppGuid));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStatePath, _T("usagestats")));
-  EXPECT_EQ(-1, GetDwordValue(kAppUserClientStateMediumPath,
-                             _T("usagestats")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_User_ClientStateZero_MediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_FALSE(AreAppUsageStatsEnabled(false, kAppGuid));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStatePath, _T("usagestats")));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStateMediumPath,
-                             _T("usagestats")));
-}
-
-// ClientStateMedium is not used.
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_User_ClientStateOne_MediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_TRUE(AreAppUsageStatsEnabled(false, kAppGuid));
-  EXPECT_EQ(1, GetDwordValue(kAppUserClientStatePath, _T("usagestats")));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStateMediumPath,
-                             _T("usagestats")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_User_ClientStateNotExist_MediumOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_FALSE(AreAppUsageStatsEnabled(false, kAppGuid));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStatePath, _T("usagestats")));
-  EXPECT_EQ(1, GetDwordValue(kAppUserClientStateMediumPath,
-                             _T("usagestats")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_User_ClientStateNotExist_MediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_FALSE(AreAppUsageStatsEnabled(false, kAppGuid));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStatePath, _T("usagestats")));
-  EXPECT_EQ(0, GetDwordValue(kAppUserClientStateMediumPath,
-                             _T("usagestats")));
-}
-
-// Machine does not affect user.
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       AreAppUsageStatsEnabled_User_MachineOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_FALSE(AreAppUsageStatsEnabled(false, kAppGuid));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStatePath, _T("usagestats")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStateMediumPath, _T("usagestats")));
-  EXPECT_EQ(1, GetDwordValue(kAppMachineClientStatePath, _T("usagestats")));
-  EXPECT_EQ(1, GetDwordValue(kAppMachineClientStateMediumPath,
-                             _T("usagestats")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest, SetUsageStatsEnable_Machine_Off) {
-  EXPECT_SUCCEEDED(SetUsageStatsEnable(true, kAppGuid, TRISTATE_FALSE));
-
-  ASSERT_TRUE(RegKey::HasKey(kAppMachineClientStatePath));
-  ASSERT_TRUE(RegKey::HasValue(kAppMachineClientStatePath,
-                               _T("usagestats")));
-  ASSERT_FALSE(RegKey::HasKey(kAppUserClientStatePath));
-
-  DWORD enable_value = 1;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    _T("usagestats"),
-                                    &enable_value));
-  EXPECT_EQ(0, enable_value);
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest, SetUsageStatsEnable_User_Off) {
-  EXPECT_SUCCEEDED(SetUsageStatsEnable(false, kAppGuid, TRISTATE_FALSE));
-
-  ASSERT_TRUE(RegKey::HasKey(kAppUserClientStatePath));
-  ASSERT_TRUE(RegKey::HasValue(kAppUserClientStatePath,
-                               _T("usagestats")));
-  ASSERT_FALSE(RegKey::HasKey(kAppMachineClientStatePath));
-
-  DWORD enable_value = 1;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppUserClientStatePath,
-                                    _T("usagestats"),
-                                    &enable_value));
-  EXPECT_EQ(0, enable_value);
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest, SetUsageStatsEnable_Machine_On) {
-  EXPECT_SUCCEEDED(SetUsageStatsEnable(true, kAppGuid, TRISTATE_TRUE));
-
-  ASSERT_TRUE(RegKey::HasKey(kAppMachineClientStatePath));
-  ASSERT_TRUE(RegKey::HasValue(kAppMachineClientStatePath,
-                               _T("usagestats")));
-  ASSERT_FALSE(RegKey::HasKey(kAppUserClientStatePath));
-
-  DWORD enable_value = 0;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    _T("usagestats"),
-                                    &enable_value));
-  EXPECT_EQ(1, enable_value);
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest, SetUsageStatsEnable_User_On) {
-  EXPECT_SUCCEEDED(SetUsageStatsEnable(false, kAppGuid, TRISTATE_TRUE));
-
-  ASSERT_TRUE(RegKey::HasKey(kAppUserClientStatePath));
-  ASSERT_TRUE(RegKey::HasValue(kAppUserClientStatePath,
-                               _T("usagestats")));
-  ASSERT_FALSE(RegKey::HasKey(kAppMachineClientStatePath));
-
-  DWORD enable_value = 0;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppUserClientStatePath,
-                                    _T("usagestats"),
-                                    &enable_value));
-  EXPECT_EQ(1, enable_value);
-}
-
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetUsageStatsEnable_Machine_None) {
-  EXPECT_SUCCEEDED(SetUsageStatsEnable(true, kAppGuid, TRISTATE_NONE));
-  ASSERT_FALSE(RegKey::HasKey(MACHINE_REG_UPDATE));
-  ASSERT_FALSE(RegKey::HasKey(USER_REG_UPDATE));
-
-  EXPECT_SUCCEEDED(SetUsageStatsEnable(false, kAppGuid, TRISTATE_NONE));
-  ASSERT_FALSE(RegKey::HasKey(USER_REG_UPDATE));
-  ASSERT_FALSE(RegKey::HasKey(MACHINE_REG_UPDATE));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetUsageStatsEnable_Machine_Overwrite) {
-  EXPECT_SUCCEEDED(SetUsageStatsEnable(true, kAppGuid, TRISTATE_FALSE));
-
-  ASSERT_TRUE(RegKey::HasKey(kAppMachineClientStatePath));
-  ASSERT_TRUE(RegKey::HasValue(kAppMachineClientStatePath,
-                               _T("usagestats")));
-  ASSERT_FALSE(RegKey::HasKey(kAppUserClientStatePath));
-
-  DWORD enable_value = 1;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    _T("usagestats"),
-                                    &enable_value));
-  EXPECT_EQ(0, enable_value);
-
-  EXPECT_SUCCEEDED(SetUsageStatsEnable(true, kAppGuid, TRISTATE_TRUE));
-
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    _T("usagestats"),
-                                    &enable_value));
-  EXPECT_EQ(1, enable_value);
-
-  EXPECT_SUCCEEDED(SetUsageStatsEnable(true, kAppGuid, TRISTATE_FALSE));
-
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    _T("usagestats"),
-                                    &enable_value));
-  EXPECT_EQ(0, enable_value);
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetUsageStatsEnable_Machine_NoneDoesNotOverwrite) {
-  EXPECT_SUCCEEDED(SetUsageStatsEnable(true, kAppGuid, TRISTATE_FALSE));
-
-  ASSERT_TRUE(RegKey::HasKey(kAppMachineClientStatePath));
-  ASSERT_TRUE(RegKey::HasValue(kAppMachineClientStatePath,
-                               _T("usagestats")));
-  ASSERT_FALSE(RegKey::HasKey(kAppUserClientStatePath));
-
-  DWORD enable_value = 1;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    _T("usagestats"),
-                                    &enable_value));
-  EXPECT_EQ(0, enable_value);
-
-  EXPECT_SUCCEEDED(SetUsageStatsEnable(true, kAppGuid, TRISTATE_NONE));
-
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    _T("usagestats"),
-                                    &enable_value));
-  EXPECT_EQ(0, enable_value);
-
-  EXPECT_SUCCEEDED(SetUsageStatsEnable(true, kAppGuid, TRISTATE_TRUE));
-
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    _T("usagestats"),
-                                    &enable_value));
-  EXPECT_EQ(1, enable_value);
-
-  EXPECT_SUCCEEDED(SetUsageStatsEnable(true, kAppGuid, TRISTATE_NONE));
-
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    _T("usagestats"),
-                                    &enable_value));
-  EXPECT_EQ(1, enable_value);
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetUsageStatsEnable_Machine_ClientStateMediumCleared) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(0)));
-
-  EXPECT_SUCCEEDED(SetUsageStatsEnable(true, kAppGuid, TRISTATE_TRUE));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("usagestats")));
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(SetUsageStatsEnable(true, kAppGuid, TRISTATE_FALSE));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStateMediumPath, _T("usagestats")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetUsageStatsEnable_Machine_NoneDoesNotClearClientStateMedium) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(1)));
-
-  EXPECT_SUCCEEDED(SetUsageStatsEnable(true, kAppGuid, TRISTATE_NONE));
-
-  DWORD enable_value = 0;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStateMediumPath,
-                                    _T("usagestats"),
-                                    &enable_value));
-  EXPECT_EQ(1, enable_value);
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetUsageStatsEnable_User_ClientStateMediumNotCleared) {
-  // User and machine values should not be cleared.
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(0)));
-
-  // True does not clear them.
-  EXPECT_SUCCEEDED(SetUsageStatsEnable(false, kAppGuid, TRISTATE_TRUE));
-  DWORD enable_value = 1;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppUserClientStateMediumPath,
-                                    _T("usagestats"),
-                                    &enable_value));
-  EXPECT_EQ(0, enable_value);
-  enable_value = 1;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStateMediumPath,
-                                    _T("usagestats"),
-                                    &enable_value));
-  EXPECT_EQ(0, enable_value);
-
-  // False does not clear them.
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(SetUsageStatsEnable(false, kAppGuid, TRISTATE_FALSE));
-  enable_value = 0;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppUserClientStateMediumPath,
-                                    _T("usagestats"),
-                                    &enable_value));
-  EXPECT_EQ(1, enable_value);
-  enable_value = 0;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStateMediumPath,
-                                    _T("usagestats"),
-                                    &enable_value));
-  EXPECT_EQ(1, enable_value);
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest, GetNumClients) {
-  size_t num_clients(0);
-
-  // Fails when no "Clients" key.
-  EXPECT_HRESULT_FAILED(GetNumClients(true, &num_clients));
-  EXPECT_HRESULT_FAILED(GetNumClients(false, &num_clients));
-
-  // Tests no subkeys.
-  const TCHAR* keys_to_create[] = { MACHINE_REG_CLIENTS, USER_REG_CLIENTS };
-  EXPECT_HRESULT_SUCCEEDED(RegKey::CreateKeys(keys_to_create,
-                                              arraysize(keys_to_create)));
-  EXPECT_HRESULT_SUCCEEDED(GetNumClients(true, &num_clients));
-  EXPECT_EQ(0, num_clients);
-  EXPECT_HRESULT_SUCCEEDED(GetNumClients(false, &num_clients));
-  EXPECT_EQ(0, num_clients);
-
-  // Subkeys should be counted. Values should not be counted.
-  RegKey machine_key;
-  EXPECT_HRESULT_SUCCEEDED(machine_key.Open(HKEY_LOCAL_MACHINE,
-                                            GOOPDATE_REG_RELATIVE_CLIENTS));
-  EXPECT_HRESULT_SUCCEEDED(machine_key.SetValue(_T("name"), _T("value")));
-  EXPECT_HRESULT_SUCCEEDED(GetNumClients(true, &num_clients));
-  EXPECT_EQ(0, num_clients);
-
-  const TCHAR* app_id = _T("{AA5523E3-40C0-4b85-B074-4BBA09559CCD}");
-  EXPECT_HRESULT_SUCCEEDED(machine_key.Create(machine_key.Key(), app_id));
-  EXPECT_HRESULT_SUCCEEDED(GetNumClients(true, &num_clients));
-  EXPECT_EQ(1, num_clients);
-
-  // Tests user scenario.
-  RegKey user_key;
-  EXPECT_HRESULT_SUCCEEDED(user_key.Open(HKEY_CURRENT_USER,
-                                         GOOPDATE_REG_RELATIVE_CLIENTS));
-  EXPECT_HRESULT_SUCCEEDED(user_key.SetValue(_T("name"), _T("value")));
-  EXPECT_HRESULT_SUCCEEDED(GetNumClients(false, &num_clients));
-  EXPECT_EQ(0, num_clients);
-
-  EXPECT_HRESULT_SUCCEEDED(user_key.Create(user_key.Key(), app_id));
-  EXPECT_HRESULT_SUCCEEDED(GetNumClients(false, &num_clients));
-  EXPECT_EQ(1, num_clients);
-}
-
-// This test verifies that InstallTime is created afresh for Omaha if it does
-// not exist, and even if the brand code is already set.
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetGoogleUpdateBranding_BrandAlreadyExistsAllEmpty) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    _T("EFGH")));
-
-  EXPECT_SUCCEEDED(SetGoogleUpdateBranding(kAppMachineClientStatePath,
-                                           _T(""),
-                                           _T("")));
-
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    &value));
-  EXPECT_STREQ(_T("EFGH"), value);
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueClientId,
-                             &value));
-  DWORD install_time = 0;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueInstallTimeSec,
-                                    &install_time));
-  EXPECT_GE(now, install_time);
-  EXPECT_GE(static_cast<uint32>(200), now - install_time);
-}
-
-// This test verifies that InstallTime remains unchanged for Omaha if it already
-// exists and the brand code is already set.
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetGoogleUpdateBranding_AllAlreadyExistAllEmpty) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    _T("EFGH")));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueClientId,
-                                    _T("existing_partner")));
-  const DWORD kInstallTime = 1234567890;
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueInstallTimeSec,
-                                    kInstallTime));
-
-  EXPECT_SUCCEEDED(SetGoogleUpdateBranding(kAppMachineClientStatePath,
-                                           _T(""),
-                                           _T("")));
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    &value));
-  EXPECT_STREQ(_T("EFGH"), value);
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueClientId,
-                                    &value));
-  EXPECT_STREQ(_T("existing_partner"), value);
-  EXPECT_EQ(kInstallTime,
-            GetDwordValue(kAppMachineClientStatePath, kRegValueInstallTimeSec));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest, SetAppBranding_KeyDoesNotExist) {
-  EXPECT_SUCCEEDED(SetAppBranding(kAppMachineClientStatePath,
-                                  _T("ABCD"),
-                                  _T("some_partner"),
-                                  _T("referrer")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest, SetAppBranding_AllEmpty) {
-  ASSERT_SUCCEEDED(RegKey::CreateKey(kAppMachineClientStatePath));
-
-  EXPECT_SUCCEEDED(SetAppBranding(kAppMachineClientStatePath,
-                                  _T(""),
-                                  _T(""),
-                                  _T("")));
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    &value));
-  EXPECT_STREQ(_T("GGLS"), value);
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueClientId,
-                             &value));
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueReferralId,
-                             &value));
-  DWORD install_time = 0;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueInstallTimeSec,
-                                    &install_time));
-  EXPECT_GE(now, install_time);
-  EXPECT_GE(static_cast<uint32>(200), now - install_time);
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest, SetAppBranding_BrandCodeOnly) {
-  ASSERT_SUCCEEDED(RegKey::CreateKey(kAppMachineClientStatePath));
-
-  EXPECT_SUCCEEDED(SetAppBranding(kAppMachineClientStatePath,
-                                  _T("ABCD"),
-                                  _T(""),
-                                  _T("")));
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    &value));
-  EXPECT_STREQ(_T("ABCD"), value);
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueClientId,
-                             &value));
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueReferralId,
-                             &value));
-  DWORD install_time = 0;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueInstallTimeSec,
-                                    &install_time));
-  EXPECT_GE(now, install_time);
-  EXPECT_GE(static_cast<uint32>(200), now - install_time);
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest, SetAppBranding_BrandCodeTooLong) {
-  EXPECT_EQ(E_INVALIDARG, SetAppBranding(kAppMachineClientStatePath,
-                                         _T("CHMGon.href)}"),
-                                         _T(""),
-                                         _T("")));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest, SetAppBranding_ClientIdOnly) {
-  ASSERT_SUCCEEDED(RegKey::CreateKey(kAppMachineClientStatePath));
-
-  EXPECT_SUCCEEDED(SetAppBranding(kAppMachineClientStatePath,
-                                  _T(""),
-                                  _T("some_partner"),
-                                  _T("")));
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    &value));
-  EXPECT_STREQ(_T("GGLS"), value);
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueClientId,
-                                    &value));
-  EXPECT_STREQ(_T("some_partner"), value);
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueReferralId,
-                             &value));
-  DWORD install_time = 0;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueInstallTimeSec,
-                                    &install_time));
-  EXPECT_GE(now, install_time);
-  EXPECT_GE(static_cast<uint32>(200), now - install_time);
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest, SetAppBranding_AllValid) {
-  ASSERT_SUCCEEDED(RegKey::CreateKey(kAppMachineClientStatePath));
-
-  EXPECT_SUCCEEDED(SetAppBranding(kAppMachineClientStatePath,
-                                  _T("ABCD"),
-                                  _T("some_partner"),
-                                  _T("referrer")));
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    &value));
-  EXPECT_STREQ(_T("ABCD"), value);
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueClientId,
-                                    &value));
-  EXPECT_STREQ(_T("some_partner"), value);
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueReferralId,
-                                    &value));
-  EXPECT_STREQ(_T("referrer"), value);
-  DWORD install_time(0);
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueInstallTimeSec,
-                                    &install_time));
-  EXPECT_GE(now, install_time);
-  EXPECT_GE(static_cast<uint32>(200), now - install_time);
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppBranding_BrandAlreadyExistsAllEmpty) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    _T("EFGH")));
-
-  EXPECT_SUCCEEDED(SetAppBranding(kAppMachineClientStatePath,
-                                  _T(""),
-                                  _T(""),
-                                  _T("")));
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    &value));
-  EXPECT_STREQ(_T("EFGH"), value);
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueClientId,
-                             &value));
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueReferralId,
-                             &value));
-  DWORD dword_value(0);
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueInstallTimeSec,
-                             &dword_value));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppBranding_BrandAlreadyExistsBrandCodeOnly) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    _T("EFGH")));
-
-  EXPECT_SUCCEEDED(SetAppBranding(kAppMachineClientStatePath,
-                                  _T("ABCD"),
-                                  _T(""),
-                                  _T("")));
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    &value));
-  EXPECT_STREQ(_T("EFGH"), value);
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueClientId,
-                             &value));
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueReferralId,
-                             &value));
-  DWORD dword_value(0);
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueInstallTimeSec,
-                             &dword_value));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppBranding_ExistingBrandTooLong) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    _T("CHMG4CUTNt")));
-
-  EXPECT_SUCCEEDED(SetAppBranding(kAppMachineClientStatePath,
-                                  _T("ABCD"),
-                                  _T(""),
-                                  _T("")));
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    &value));
-  EXPECT_STREQ(_T("CHMG"), value);
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueClientId,
-                             &value));
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueReferralId,
-                             &value));
-  DWORD dword_value(0);
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueInstallTimeSec,
-                             &dword_value));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppBranding_BrandAlreadyExistsCliendIdOnly) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    _T("EFGH")));
-
-  EXPECT_SUCCEEDED(SetAppBranding(kAppMachineClientStatePath,
-                                  _T(""),
-                                  _T("some_partner"),
-                                  _T("")));
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    &value));
-  EXPECT_STREQ(_T("EFGH"), value);
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueClientId,
-                             &value));
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueReferralId,
-                             &value));
-  DWORD dword_value(0);
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueInstallTimeSec,
-                             &dword_value));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppBranding_BrandAlreadyExistsBothValid) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    _T("EFGH")));
-
-  EXPECT_SUCCEEDED(SetAppBranding(kAppMachineClientStatePath,
-                                  _T("ABCD"),
-                                  _T("some_partner"),
-                                  _T("")));
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    &value));
-  EXPECT_STREQ(_T("EFGH"), value);
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueClientId,
-                             &value));
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueReferralId,
-                             &value));
-  DWORD dword_value(0);
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueInstallTimeSec,
-                             &dword_value));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppBranding_ClientIdAlreadyExistsAllEmtpy) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueClientId,
-                                    _T("existing_partner")));
-
-  EXPECT_SUCCEEDED(SetAppBranding(kAppMachineClientStatePath,
-                                  _T(""),
-                                  _T(""),
-                                  _T("")));
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    &value));
-  EXPECT_STREQ(_T("GGLS"), value);
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueClientId,
-                                    &value));
-  EXPECT_STREQ(_T("existing_partner"), value);
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueReferralId,
-                             &value));
-  DWORD install_time = 0;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueInstallTimeSec,
-                                    &install_time));
-  EXPECT_GE(now, install_time);
-  EXPECT_GE(static_cast<uint32>(200), now - install_time);
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppBranding_ClientIdAlreadyExistsBrandCodeOnly) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueClientId,
-                                    _T("existing_partner")));
-
-  EXPECT_SUCCEEDED(SetAppBranding(kAppMachineClientStatePath,
-                                  _T("ABCE"),
-                                  _T(""),
-                                  _T("")));
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    &value));
-  EXPECT_STREQ(_T("ABCE"), value);
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueClientId,
-                                    &value));
-  EXPECT_STREQ(_T("existing_partner"), value);
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueReferralId,
-                             &value));
-  DWORD install_time = 0;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueInstallTimeSec,
-                                    &install_time));
-  EXPECT_GE(now, install_time);
-  EXPECT_GE(static_cast<uint32>(200), now - install_time);
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppBranding_ClientIdAlreadyExistsCliendIdOnly) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueClientId,
-                                    _T("existing_partner")));
-
-  EXPECT_SUCCEEDED(SetAppBranding(kAppMachineClientStatePath,
-                                  _T(""),
-                                  _T("some_partner"),
-                                  _T("")));
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    &value));
-  EXPECT_STREQ(_T("GGLS"), value);
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueClientId,
-                                    &value));
-  EXPECT_STREQ(_T("some_partner"), value);
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueReferralId,
-                             &value));
-  DWORD install_time = 0;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueInstallTimeSec,
-                                    &install_time));
-  EXPECT_GE(now, install_time);
-  EXPECT_GE(static_cast<uint32>(200), now - install_time);
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppBranding_ClientIdAlreadyExistsBothValid) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueClientId,
-                                    _T("existing_partner")));
-
-  EXPECT_SUCCEEDED(SetAppBranding(kAppMachineClientStatePath,
-                                  _T("ABCD"),
-                                  _T("some_partner"),
-                                  _T("")));
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    &value));
-  EXPECT_STREQ(_T("ABCD"), value);
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueClientId,
-                                    &value));
-  EXPECT_STREQ(_T("some_partner"), value);
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueReferralId,
-                             &value));
-  DWORD install_time = 0;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueInstallTimeSec,
-                                    &install_time));
-  EXPECT_GE(now, install_time);
-  EXPECT_GE(static_cast<uint32>(200), now - install_time);
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppBranding_AllAlreadyExistAllEmpty) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    _T("EFGH")));
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueClientId,
-                                    _T("existing_partner")));
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueReferralId,
-                                    __T("existingreferrerid")));
-  const DWORD kInstallTime = 1234567890;
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueInstallTimeSec,
-                                    kInstallTime));
-
-  EXPECT_SUCCEEDED(SetAppBranding(kAppMachineClientStatePath,
-                                  _T(""),
-                                  _T(""),
-                                  _T("")));
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    &value));
-  EXPECT_STREQ(_T("EFGH"), value);
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueClientId,
-                                    &value));
-  EXPECT_STREQ(_T("existing_partner"), value);
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueReferralId,
-                                    &value));
-  EXPECT_STREQ(__T("existingreferrerid"), value);
-  EXPECT_EQ(kInstallTime,
-            GetDwordValue(kAppMachineClientStatePath, kRegValueInstallTimeSec));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppBranding_AllAlreadyExistBrandCodeOnly) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    _T("EFGH")));
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueClientId,
-                                    _T("existing_partner")));
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueReferralId,
-                                    __T("existingreferrerid")));
-  const DWORD kInstallTime = 1234567890;
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueInstallTimeSec,
-                                    kInstallTime));
-
-  EXPECT_SUCCEEDED(SetAppBranding(kAppMachineClientStatePath,
-                                  _T("ABCD"),
-                                  _T(""),
-                                  _T("")));
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    &value));
-  EXPECT_STREQ(_T("EFGH"), value);
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueClientId,
-                                    &value));
-  EXPECT_STREQ(_T("existing_partner"), value);
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueReferralId,
-                                    &value));
-  EXPECT_STREQ(__T("existingreferrerid"), value);
-  EXPECT_EQ(kInstallTime,
-            GetDwordValue(kAppMachineClientStatePath, kRegValueInstallTimeSec));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppBranding_BothAlreadyExistCliendIdOnly) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    _T("EFGH")));
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueClientId,
-                                    _T("existing_partner")));
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueReferralId,
-                                    __T("existingreferrerid")));
-
-  EXPECT_SUCCEEDED(SetAppBranding(kAppMachineClientStatePath,
-                                  _T(""),
-                                  _T("some_partner"),
-                                  _T("")));
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    &value));
-  EXPECT_STREQ(_T("EFGH"), value);
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueClientId,
-                                    &value));
-  EXPECT_STREQ(_T("existing_partner"), value);
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueReferralId,
-                                    &value));
-  EXPECT_STREQ(__T("existingreferrerid"), value);
-  DWORD dword_value(0);
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueInstallTimeSec,
-                             &dword_value));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppBranding_BothAlreadyExistBothValid) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    _T("EFGH")));
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueClientId,
-                                    _T("existing_partner")));
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueReferralId,
-                                    _T("existingreferrerid")));
-
-  EXPECT_SUCCEEDED(SetAppBranding(kAppMachineClientStatePath,
-                                  _T("ABCD"),
-                                  _T("some_partner"),
-                                  _T("")));
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    &value));
-  EXPECT_STREQ(_T("EFGH"), value);
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueClientId,
-                                    &value));
-  EXPECT_STREQ(_T("existing_partner"), value);
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueReferralId,
-                                    &value));
-  EXPECT_STREQ(_T("existingreferrerid"), value);
-  DWORD dword_value(0);
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueInstallTimeSec,
-                             &dword_value));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       SetAppBranding_InstallTimeAlreadyExistsBrandCodeOnly) {
-  const DWORD kExistingInstallTime = 1234567890;
-  ASSERT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    kRegValueInstallTimeSec,
-                                    kExistingInstallTime));
-
-  EXPECT_SUCCEEDED(SetAppBranding(kAppMachineClientStatePath,
-                                  _T("ABCE"),
-                                  _T(""),
-                                  _T("")));
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueBrandCode,
-                                    &value));
-  EXPECT_STREQ(_T("ABCE"), value);
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueClientId,
-                             &value));
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            RegKey::GetValue(kAppMachineClientStatePath,
-                             kRegValueReferralId,
-                             &value));
-  DWORD install_time = 0;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    kRegValueInstallTimeSec,
-                                    &install_time));
-  EXPECT_NE(kExistingInstallTime, install_time);
-  EXPECT_GE(now, install_time);
-  EXPECT_GE(static_cast<uint32>(200), now - install_time);
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest, GetAppVersion_User) {
-  const CString expected_pv = _T("1.0");
-
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaUserClientsPath,
-                                            kRegValueProductVersion,
-                                            expected_pv));
-
-  CString actual_pv;
-  GetAppVersion(false, kGoogleUpdateAppId, &actual_pv);
-  EXPECT_STREQ(expected_pv, actual_pv);
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest, GetAppVersion_Machine) {
-  const CString expected_pv = _T("1.0");
-
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaMachineClientsPath,
-                                            kRegValueProductVersion,
-                                            expected_pv));
-
-  CString actual_pv;
-  GetAppVersion(true, kGoogleUpdateAppId, &actual_pv);
-  EXPECT_STREQ(expected_pv, actual_pv);
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       GetClientStateData_User) {
-  const CString expected_pv           = _T("1.0");
-  const CString expected_ap           = _T("additional parameters");
-  const CString expected_lang         = _T("some lang");
-  const CString expected_brand_code   = _T("some brand");
-  const CString expected_client_id    = _T("some client id");
-  const CString expected_iid          =
-      _T("{7C0B6E56-B24B-436b-A960-A6EA201E886F}");
-  const CString expected_experiment_label =
-      _T("some_experiment=a|Fri, 14 Aug 2015 16:13:03 GMT");
-
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaUserClientStatePath,
-                                            kRegValueProductVersion,
-                                            expected_pv));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaUserClientStatePath,
-                                            kRegValueAdditionalParams,
-                                            expected_ap));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaUserClientStatePath,
-                                            kRegValueLanguage,
-                                            expected_lang));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaUserClientStatePath,
-                                            kRegValueBrandCode,
-                                            expected_brand_code));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaUserClientStatePath,
-                                            kRegValueClientId,
-                                            expected_client_id));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaUserClientStatePath,
-                                            kRegValueInstallationId,
-                                            expected_iid));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaUserClientStatePath,
-                                            kRegValueExperimentLabels,
-                                            expected_experiment_label));
-
-  CString actual_pv, actual_ap, actual_lang, actual_brand_code,
-      actual_client_id, actual_experiment_label, actual_iid;
-
-  GetClientStateData(false,
-                     kGoogleUpdateAppId,
-                     &actual_pv,
-                     &actual_ap,
-                     &actual_lang,
-                     &actual_brand_code,
-                     &actual_client_id,
-                     &actual_iid,
-                     &actual_experiment_label);
-
-  EXPECT_STREQ(expected_pv, actual_pv);
-  EXPECT_STREQ(expected_ap, actual_ap);
-  EXPECT_STREQ(expected_lang, actual_lang);
-  EXPECT_STREQ(expected_brand_code, actual_brand_code);
-  EXPECT_STREQ(expected_client_id, actual_client_id);
-  EXPECT_STREQ(expected_iid, actual_iid);
-  EXPECT_STREQ(expected_experiment_label, actual_experiment_label);
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest,
-       GetGoogleUpdatePersistentData_Machine) {
-  const CString expected_pv           = _T("1.0");
-  const CString expected_ap           = _T("additional parameters");
-  const CString expected_lang         = _T("some lang");
-  const CString expected_brand_code   = _T("some brand");
-  const CString expected_client_id    = _T("some client id");
-  const CString expected_iid          =
-      _T("{7C0B6E56-B24B-436b-A960-A6EA201E886F}");
-  const CString expected_experiment_label =
-      _T("some_experiment=a|Fri, 14 Aug 2015 16:13:03 GMT");
-
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaMachineClientStatePath,
-                                            kRegValueProductVersion,
-                                            expected_pv));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaMachineClientStatePath,
-                                            kRegValueAdditionalParams,
-                                            expected_ap));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaMachineClientStatePath,
-                                            kRegValueLanguage,
-                                            expected_lang));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaMachineClientStatePath,
-                                            kRegValueBrandCode,
-                                            expected_brand_code));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaMachineClientStatePath,
-                                            kRegValueClientId,
-                                            expected_client_id));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaMachineClientStatePath,
-                                            kRegValueInstallationId,
-                                            expected_iid));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaMachineClientStatePath,
-                                            kRegValueExperimentLabels,
-                                            expected_experiment_label));
-
-  CString actual_pv, actual_ap, actual_lang, actual_brand_code,
-      actual_client_id, actual_experiment_label, actual_iid;
-
-  GetClientStateData(true,
-                     kGoogleUpdateAppId,
-                     &actual_pv,
-                     &actual_ap,
-                     &actual_lang,
-                     &actual_brand_code,
-                     &actual_client_id,
-                     &actual_iid,
-                     &actual_experiment_label);
-
-  EXPECT_STREQ(expected_pv, actual_pv);
-  EXPECT_STREQ(expected_ap, actual_ap);
-  EXPECT_STREQ(expected_lang, actual_lang);
-  EXPECT_STREQ(expected_brand_code, actual_brand_code);
-  EXPECT_STREQ(expected_client_id, actual_client_id);
-  EXPECT_STREQ(expected_iid, actual_iid);
-  EXPECT_STREQ(expected_experiment_label, actual_experiment_label);
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest, RemoveClientState_Machine) {
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                            kRegValueProductVersion,
-                                            _T("1.1")));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                            kRegValueProductVersion,
-                                            _T("1.1")));
-  RemoveClientState(true, GOOPDATE_APP_ID);
-  EXPECT_TRUE(RegKey::HasValue(kAppMachineClientStatePath,
-                               kRegValueProductVersion));
-  EXPECT_TRUE(RegKey::HasValue(kAppMachineClientStateMediumPath,
-                               kRegValueProductVersion));
-  EXPECT_HRESULT_SUCCEEDED(RemoveClientState(true, kAppGuid));
-  EXPECT_FALSE(RegKey::HasValue(kAppMachineClientStatePath,
-                                kRegValueProductVersion));
-  EXPECT_FALSE(RegKey::HasValue(kAppMachineClientStateMediumPath,
-                                kRegValueProductVersion));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest, RemoveClientState_User) {
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                            kRegValueProductVersion,
-                                            _T("1.1")));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                            kRegValueProductVersion,
-                                            _T("1.1")));
-  RemoveClientState(false, GOOPDATE_APP_ID);
-  EXPECT_TRUE(RegKey::HasValue(kAppUserClientStatePath,
-                               kRegValueProductVersion));
-  EXPECT_HRESULT_SUCCEEDED(RemoveClientState(false, kAppGuid));
-  EXPECT_FALSE(RegKey::HasValue(kAppUserClientStatePath,
-                                kRegValueProductVersion));
-
-  // For user case, StateMedium key is not deleted.
-  EXPECT_TRUE(RegKey::HasValue(kAppUserClientStateMediumPath,
-                               kRegValueProductVersion));
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest, GetUninstalledApps_Machine) {
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaMachineClientsPath,
-                                            kRegValueProductVersion,
-                                            _T("1.0")));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaMachineClientStatePath,
-                                            kRegValueProductVersion,
-                                            _T("1.0")));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                            kRegValueProductVersion,
-                                            _T("1.1")));
-
-  std::vector<CString> uninstalled_apps;
-  GetUninstalledApps(true, &uninstalled_apps);
-  EXPECT_EQ(1, uninstalled_apps.size());
-  EXPECT_STREQ(kAppGuid, uninstalled_apps[0]);
-
-  RemoveClientStateForApps(true, uninstalled_apps);
-  uninstalled_apps.clear();
-  GetUninstalledApps(true, &uninstalled_apps);
-  EXPECT_EQ(0, uninstalled_apps.size());
-}
-
-TEST_F(AppRegistryUtilsRegistryProtectedTest, GetUninstalledApps_User) {
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaUserClientsPath,
-                                            kRegValueProductVersion,
-                                            _T("1.0")));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaUserClientStatePath,
-                                            kRegValueProductVersion,
-                                            _T("1.0")));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                            kRegValueProductVersion,
-                                            _T("1.1")));
-
-  std::vector<CString> uninstalled_apps;
-  GetUninstalledApps(false, &uninstalled_apps);
-  EXPECT_EQ(1, uninstalled_apps.size());
-  EXPECT_STREQ(kAppGuid, uninstalled_apps[0]);
-
-  RemoveClientStateForApps(false, uninstalled_apps);
-  uninstalled_apps.clear();
-  GetUninstalledApps(false, &uninstalled_apps);
-  EXPECT_EQ(0, uninstalled_apps.size());
-}
-
-}  // namespace app_registry_utils
-
-}  // namespace omaha
diff --git a/common/build.scons b/common/build.scons
deleted file mode 100644
index a1d601d..0000000
--- a/common/build.scons
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright 2009-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-local_env = env.Clone()
-
-local_env['CPPPATH'] += [
-    '$OBJ_ROOT',  # Needed for generated files.
-    ]
-
-inputs = [
-    'app_registry_utils.cc',
-    'command_line.cc',
-    'command_line_builder.cc',
-    'config_manager.cc',
-    'event_logger.cc',
-    'experiment_labels.cc',
-    'extra_args_parser.cc',
-    'goopdate_command_line_validator.cc',
-    'goopdate_utils.cc',
-    'lang.cc',
-    'oem_install_utils.cc',
-    'ping.cc',
-    'ping_event.cc',
-    'scheduled_task_utils.cc',
-    'stats_uploader.cc',
-    'update3_utils.cc',
-    'update_request.cc',
-    'update_response.cc',
-    'webplugin_utils.cc',
-    'web_services_client.cc',
-    'xml_const.cc',
-    'xml_parser.cc',
-    '$LIB_DIR/logging.lib',       # Required by statsreport below
-    '$LIB_DIR/omaha3_idl.lib',    # Required by common
-    '$LIB_DIR/statsreport.lib',   # Required by common
-    ]
-
-# Build these into a library.
-local_env.ComponentStaticLibrary('common', inputs)
-
-customization_test_env = env.Clone()
-customization_test_env.OmahaUnittest(
-    name='omaha_customization_unittest',
-    source=[
-        'omaha_customization_unittest.cc',
-    ],
-    LIBS=[
-        '$LIB_DIR/common',
-    ],
-    all_in_one=False,
-    COMPONENT_TEST_SIZE='small',
-)
diff --git a/common/command_line.cc b/common/command_line.cc
deleted file mode 100644
index c7e78f6..0000000
--- a/common/command_line.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/common/command_line.h"
-#include "omaha/base/command_line_parser.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/common/goopdate_command_line_validator.h"
-
-namespace omaha {
-
-// Returns a pointer to the second token in the cmd_line parameter or an
-// empty string. See the implementation in vc7\crt\src\wincmdln.c
-//
-// TODO(omaha): consider moving this function into the tiny shell, as it
-// is logically part of our modified runtime environment.
-TCHAR* GetCmdLineTail(const TCHAR* cmd_line) {
-  ASSERT1(cmd_line);
-  bool in_quote = false;
-
-  // Skip past program name (first token in command line).
-  // Check for and handle quoted program name.
-
-  while ((*cmd_line > _T(' ')) ||
-         (*cmd_line && in_quote)) {
-    // Flip the in_quote if current character is '"'.
-    if (*cmd_line == _T('"')) {
-      in_quote = !in_quote;
-    }
-    ++cmd_line;
-  }
-
-  // Skip past any white space preceeding the second token.
-  while (*cmd_line && (*cmd_line <= _T(' '))) {
-    cmd_line++;
-  }
-
-  return const_cast<TCHAR*>(cmd_line);
-}
-
-// Assumption: The metainstaller has verified that space ' ' and
-// double quote '"' characters do not appear in the "extra" arguments.
-// This is important so that attackers can't create tags that provide a valid
-// extra argument string followed by other commands.
-HRESULT ParseCommandLine(const TCHAR* cmd_line, CommandLineArgs* args) {
-  ASSERT1(cmd_line);
-  ASSERT1(args);
-  CORE_LOG(L3, (_T("[ParseCommandLine][%s]"), cmd_line));
-
-  CommandLineParser parser;
-  HRESULT hr = parser.ParseFromString(cmd_line);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[ParseCommandLine][ParseFromString failed][0x%x]"), hr));
-    return hr;
-  }
-
-  GoopdateCommandLineValidator validator;
-  hr = validator.Setup();
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[ParseCommandLine][Validator Setup failed][0x%x]"), hr));
-    return hr;
-  }
-
-  hr = validator.Validate(&parser, args);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[ParseCommandLine][Validate failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-}  // namespace omaha
-
diff --git a/common/command_line.h b/common/command_line.h
deleted file mode 100644
index a465f9f..0000000
--- a/common/command_line.h
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// TODO(omaha): consider making all what can be passed on the command line
-// "arguments". Our terminology to separate them in commands and options is not
-// consistent.
-
-#ifndef OMAHA_COMMON_COMMAND_LINE_H_
-#define OMAHA_COMMON_COMMAND_LINE_H_
-
-#include <tchar.h>
-#include <atlstr.h>
-#include <vector>
-#include "omaha/base/constants.h"
-#include "omaha/base/browser_utils.h"
-#include "omaha/common/const_goopdate.h"
-
-namespace omaha {
-
-// Replacement for the C runtime function to process the command line.
-// The first token of the command line in Windows is the process name.
-// What gets passed to WinMain by the C runtime must not include the first
-// token. Since our tiny shell does not use the C runtime we must handle
-// the command line by ourselves.
-TCHAR* GetCmdLineTail(const TCHAR* cmd_line);
-
-struct CommandLineAppArgs {
-  CommandLineAppArgs()
-      : app_guid(GUID_NULL),
-        needs_admin(NEEDS_ADMIN_NO) {}
-
-  GUID app_guid;
-  CString app_name;
-  NeedsAdmin needs_admin;
-  CString ap;
-  CString tt_token;
-  CString encoded_installer_data;
-  CString install_data_index;
-  CString experiment_labels;
-};
-
-// Values may be sent in pings or stats. Do not remove or reuse existing values.
-typedef enum CommandLineMode {
-  COMMANDLINE_MODE_UNKNOWN = 0,
-  COMMANDLINE_MODE_NOARGS = 1,
-  COMMANDLINE_MODE_CORE = 2,
-  COMMANDLINE_MODE_SERVICE = 3,
-  COMMANDLINE_MODE_REGSERVER = 4,
-  COMMANDLINE_MODE_UNREGSERVER = 5,
-  COMMANDLINE_MODE_NETDIAGS = 6,
-  COMMANDLINE_MODE_CRASH = 7,
-  COMMANDLINE_MODE_REPORTCRASH = 8,
-  COMMANDLINE_MODE_INSTALL = 9,
-  COMMANDLINE_MODE_UPDATE = 10,
-  // Obsolete: COMMANDLINE_MODE_IG = 11,
-  COMMANDLINE_MODE_HANDOFF_INSTALL = 12,
-  // Obsolete: COMMANDLINE_MODE_UG = 13,
-  COMMANDLINE_MODE_UA = 14,
-  COMMANDLINE_MODE_RECOVER = 15,
-  COMMANDLINE_MODE_WEBPLUGIN = 16,
-  COMMANDLINE_MODE_CODE_RED_CHECK = 17,
-  COMMANDLINE_MODE_COMSERVER = 18,
-  // Obsolete: COMMANDLINE_MODE_LEGACYUI = 19,
-  // Obsolete: COMMANDLINE_MODE_LEGACY_MANIFEST_HANDOFF = 20,
-  COMMANDLINE_MODE_REGISTER_PRODUCT = 21,
-  COMMANDLINE_MODE_UNREGISTER_PRODUCT = 22,
-  COMMANDLINE_MODE_SERVICE_REGISTER = 23,
-  COMMANDLINE_MODE_SERVICE_UNREGISTER = 24,
-  COMMANDLINE_MODE_CRASH_HANDLER = 25,
-  COMMANDLINE_MODE_COMBROKER = 26,
-  COMMANDLINE_MODE_ONDEMAND = 27,
-  COMMANDLINE_MODE_MEDIUM_SERVICE = 28,
-  COMMANDLINE_MODE_UNINSTALL = 29,
-  COMMANDLINE_MODE_PING = 30,
-};
-
-struct CommandLineExtraArgs {
-  CommandLineExtraArgs()
-      : installation_id(GUID_NULL),
-        browser_type(BROWSER_UNKNOWN),
-        usage_stats_enable(TRISTATE_NONE),
-        runtime_only(false) {}
-
-  CString bundle_name;
-  GUID installation_id;
-  CString brand_code;
-  CString client_id;
-  CString experiment_labels;
-  CString referral_id;
-  CString language;
-  BrowserType browser_type;
-  Tristate usage_stats_enable;
-  bool runtime_only;
-
-  std::vector<CommandLineAppArgs> apps;
-};
-
-struct CommandLineArgs {
-  CommandLineArgs()
-      : mode(COMMANDLINE_MODE_UNKNOWN),
-        is_interactive_set(false),
-        is_machine_set(false),
-        is_crash_handler_disabled(false),
-        is_install_elevated(false),
-        is_silent_set(false),
-        is_eula_required_set(false),
-        is_offline_set(false),
-        is_oem_set(false) {}
-
-  CommandLineMode mode;
-  bool is_interactive_set;
-  bool is_machine_set;
-  bool is_crash_handler_disabled;
-  bool is_install_elevated;
-  bool is_silent_set;
-  bool is_eula_required_set;
-  bool is_offline_set;
-  bool is_oem_set;
-  CString extra_args_str;
-  CString app_args_str;
-  CString install_source;
-  CString crash_filename;
-  CString custom_info_filename;
-  CString legacy_manifest_path;
-  CString webplugin_urldomain;
-  CString webplugin_args;
-  CString code_red_metainstaller_path;
-  CString ping_string;
-  CString offline_dir;
-  CString session_id;
-  CommandLineExtraArgs extra;
-};
-
-// Parses the goopdate command line.
-HRESULT ParseCommandLine(const TCHAR* cmd_line, CommandLineArgs* args);
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_COMMAND_LINE_H_
diff --git a/common/command_line_builder.cc b/common/command_line_builder.cc
deleted file mode 100644
index 8c24041..0000000
--- a/common/command_line_builder.cc
+++ /dev/null
@@ -1,496 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/common/command_line_builder.h"
-#include <shellapi.h>
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/path.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/common/command_line.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/const_goopdate.h"
-
-namespace omaha {
-
-CommandLineBuilder::CommandLineBuilder(CommandLineMode mode)
-    : mode_(mode),
-      is_interactive_set_(false),
-      is_machine_set_(false),
-      is_silent_set_(false),
-      is_eula_required_set_(false) {
-}
-
-CommandLineBuilder::~CommandLineBuilder() {
-}
-
-void CommandLineBuilder::set_is_interactive_set(bool is_interactive_set) {
-  ASSERT1(mode_ == COMMANDLINE_MODE_REPORTCRASH);
-  is_interactive_set_ = is_interactive_set;
-}
-
-void CommandLineBuilder::set_is_machine_set(bool is_machine_set) {
-  ASSERT1(mode_ == COMMANDLINE_MODE_REPORTCRASH);
-  is_machine_set_ = is_machine_set;
-}
-
-void CommandLineBuilder::set_is_silent_set(bool is_silent_set) {
-  ASSERT1(mode_ == COMMANDLINE_MODE_INSTALL ||
-          mode_ == COMMANDLINE_MODE_HANDOFF_INSTALL);
-  is_silent_set_ = is_silent_set;
-}
-
-void CommandLineBuilder::set_is_eula_required_set(bool is_eula_required_set) {
-  ASSERT1(mode_ == COMMANDLINE_MODE_INSTALL ||
-          mode_ == COMMANDLINE_MODE_HANDOFF_INSTALL);
-  is_eula_required_set_ = is_eula_required_set;
-}
-
-void CommandLineBuilder::set_extra_args(const CString& extra_args) {
-  ASSERT1(mode_ == COMMANDLINE_MODE_INSTALL ||
-          mode_ == COMMANDLINE_MODE_HANDOFF_INSTALL ||
-          mode_ == COMMANDLINE_MODE_REGISTER_PRODUCT ||
-          mode_ == COMMANDLINE_MODE_UNREGISTER_PRODUCT);
-  extra_args_ = extra_args;
-}
-
-void CommandLineBuilder::set_app_args(const CString& app_args) {
-  ASSERT1(mode_ == COMMANDLINE_MODE_INSTALL ||
-          mode_ == COMMANDLINE_MODE_HANDOFF_INSTALL);
-  app_args_ = app_args;
-}
-
-void CommandLineBuilder::set_install_source(const CString& install_source) {
-  ASSERT1(mode_ == COMMANDLINE_MODE_WEBPLUGIN ||
-          mode_ == COMMANDLINE_MODE_INSTALL ||
-          mode_ == COMMANDLINE_MODE_HANDOFF_INSTALL ||
-          mode_ == COMMANDLINE_MODE_UA);
-  install_source_ = install_source;
-}
-
-void CommandLineBuilder::set_session_id(const CString& session_id) {
-  ASSERT1(mode_ == COMMANDLINE_MODE_INSTALL ||
-          mode_ == COMMANDLINE_MODE_HANDOFF_INSTALL ||
-          mode_ == COMMANDLINE_MODE_UPDATE);
-  session_id_ = session_id;
-}
-
-void CommandLineBuilder::set_crash_filename(const CString& crash_filename) {
-  ASSERT1(mode_ == COMMANDLINE_MODE_REPORTCRASH);
-  crash_filename_ = crash_filename;
-}
-
-void CommandLineBuilder::set_custom_info_filename(
-    const CString& custom_info_filename) {
-  ASSERT1(mode_ == COMMANDLINE_MODE_REPORTCRASH);
-  custom_info_filename_ = custom_info_filename;
-}
-
-void CommandLineBuilder::set_webplugin_url_domain(
-    const CString& webplugin_url_domain) {
-  ASSERT1(mode_ == COMMANDLINE_MODE_WEBPLUGIN);
-  webplugin_url_domain_ = webplugin_url_domain;
-}
-
-void CommandLineBuilder::set_webplugin_args(const CString& webplugin_args) {
-  ASSERT1(mode_ == COMMANDLINE_MODE_WEBPLUGIN);
-  webplugin_args_ = webplugin_args;
-}
-
-void CommandLineBuilder::set_code_red_metainstaller_path(
-    const CString& code_red_metainstaller_path) {
-  ASSERT1(mode_ == COMMANDLINE_MODE_RECOVER);
-  code_red_metainstaller_path_ = code_red_metainstaller_path;
-}
-
-void CommandLineBuilder::set_ping_string(const CString& ping_string) {
-  ASSERT1(mode_ == COMMANDLINE_MODE_PING);
-  ping_string_ = ping_string;
-}
-
-void CommandLineBuilder::SetOfflineDir(const CString& offline_dir) {
-  ASSERT1(mode_ == COMMANDLINE_MODE_HANDOFF_INSTALL);
-  offline_dir_ = offline_dir;
-  ::PathRemoveBackslash(CStrBuf(offline_dir_, MAX_PATH));
-}
-
-CString CommandLineBuilder::GetCommandLineArgs() const {
-  CString cmd_line_args;
-
-  switch (mode_) {
-    case COMMANDLINE_MODE_NOARGS:
-      cmd_line_args.Empty();
-      break;
-    case COMMANDLINE_MODE_CORE:
-      cmd_line_args = GetCore();
-      break;
-    case COMMANDLINE_MODE_SERVICE:
-      cmd_line_args = GetService();
-      break;
-    case COMMANDLINE_MODE_REGSERVER:
-      cmd_line_args = GetRegServer();
-      break;
-    case COMMANDLINE_MODE_UNREGSERVER:
-      cmd_line_args = GetUnregServer();
-      break;
-    case COMMANDLINE_MODE_NETDIAGS:
-      cmd_line_args = GetNetDiags();
-      break;
-    case COMMANDLINE_MODE_CRASH:
-      cmd_line_args = GetCrash();
-      break;
-    case COMMANDLINE_MODE_REPORTCRASH:
-      cmd_line_args = GetReportCrash();
-      break;
-    case COMMANDLINE_MODE_INSTALL:
-      cmd_line_args = GetInstall();
-      break;
-    case COMMANDLINE_MODE_UPDATE:
-      cmd_line_args = GetUpdate();
-      break;
-    case COMMANDLINE_MODE_HANDOFF_INSTALL:
-      cmd_line_args = GetHandoffInstall();
-      break;
-    case COMMANDLINE_MODE_UA:
-      cmd_line_args = GetUA();
-      break;
-    case COMMANDLINE_MODE_RECOVER:
-      cmd_line_args = GetRecover();
-      break;
-    case COMMANDLINE_MODE_WEBPLUGIN:
-      cmd_line_args = GetWebPlugin();
-      break;
-    case COMMANDLINE_MODE_CODE_RED_CHECK:
-      cmd_line_args = GetCodeRedCheck();
-      break;
-    case COMMANDLINE_MODE_COMSERVER:
-      cmd_line_args = GetComServer();
-      break;
-    case COMMANDLINE_MODE_REGISTER_PRODUCT:
-      cmd_line_args = GetRegisterProduct();
-      break;
-    case COMMANDLINE_MODE_UNREGISTER_PRODUCT:
-      cmd_line_args = GetUnregisterProduct();
-      break;
-    case COMMANDLINE_MODE_SERVICE_REGISTER:
-      cmd_line_args = GetServiceRegister();
-      break;
-    case COMMANDLINE_MODE_SERVICE_UNREGISTER:
-      cmd_line_args = GetServiceUnregister();
-      break;
-    case COMMANDLINE_MODE_CRASH_HANDLER:
-      cmd_line_args = GetCrashHandler();
-      break;
-    case COMMANDLINE_MODE_COMBROKER:
-      cmd_line_args = GetComBroker();
-      break;
-    case COMMANDLINE_MODE_ONDEMAND:
-      cmd_line_args = GetOnDemand();
-      break;
-    case COMMANDLINE_MODE_MEDIUM_SERVICE:
-      cmd_line_args = GetMediumService();
-      break;
-    case COMMANDLINE_MODE_UNINSTALL:
-      cmd_line_args = GetUninstall();
-      break;
-    case COMMANDLINE_MODE_PING:
-      cmd_line_args = GetPing();
-      break;
-    case COMMANDLINE_MODE_UNKNOWN:
-    default:
-      ASSERT1(false);
-      break;
-  }
-
-#ifdef _DEBUG
-  CString full_command_line;
-  SafeCStringFormat(&full_command_line, _T("gu.exe %s"), cmd_line_args);
-  CommandLineArgs args;
-  ASSERT1(SUCCEEDED(ParseCommandLine(full_command_line, &args)));
-#endif
-
-  return cmd_line_args;
-}
-
-CString CommandLineBuilder::GetCommandLine(const CString& program_name) const {
-  // Do not pass the results of the the /update builder to GoogleUpdate.exe.
-  // The command line for /update is intended to be passed to a metainstaller.
-  // See GetUpdate() for more information.
-  ASSERT1(COMMANDLINE_MODE_UPDATE != mode_ ||
-          -1 == program_name.Find(kOmahaShellFileName));
-
-  // Always enclose the program name in double quotes.
-  CString enclosed_program_name(program_name);
-  EnclosePath(&enclosed_program_name);
-  CString cmd_line;
-  SafeCStringFormat(&cmd_line, _T("%s %s"),
-                    enclosed_program_name,
-                    GetCommandLineArgs());
-  return cmd_line;
-}
-
-CString CommandLineBuilder::GetSingleSwitch(const CString& switch_name) const {
-  CString cmd_line;
-  cmd_line.Format(_T("/%s"), switch_name);
-  return cmd_line;
-}
-
-CString CommandLineBuilder::GetCore() const {
-  return GetSingleSwitch(kCmdLineCore);
-}
-
-CString CommandLineBuilder::GetCrashHandler() const {
-  return GetSingleSwitch(kCmdLineCrashHandler);
-}
-
-CString CommandLineBuilder::GetService() const {
-  return GetSingleSwitch(kCmdLineService);
-}
-
-CString CommandLineBuilder::GetServiceRegister() const {
-  return GetSingleSwitch(kCmdLineRegisterService);
-}
-
-CString CommandLineBuilder::GetServiceUnregister() const {
-  return GetSingleSwitch(kCmdLineUnregisterService);
-}
-
-CString CommandLineBuilder::GetRegServer() const {
-  return GetSingleSwitch(kCmdRegServer);
-}
-
-CString CommandLineBuilder::GetUnregServer() const {
-  return GetSingleSwitch(kCmdUnregServer);
-}
-
-CString CommandLineBuilder::GetNetDiags() const {
-  return GetSingleSwitch(kCmdLineNetDiags);
-}
-
-CString CommandLineBuilder::GetCrash() const {
-  CString cmd_line = GetSingleSwitch(kCmdLineCrash);
-  return cmd_line;
-}
-
-CString CommandLineBuilder::GetReportCrash() const {
-  ASSERT1(!crash_filename_.IsEmpty());
-  if (crash_filename_.IsEmpty()) {
-    return CString();
-  }
-  CString cmd_line = GetSingleSwitch(kCmdLineReport);
-  if (is_interactive_set_) {
-    SafeCStringAppendFormat(&cmd_line, _T(" /%s"), kCmdLineInteractive);
-  }
-  CString enclosed_crash_filename_(crash_filename_);
-  EnclosePath(&enclosed_crash_filename_);
-  SafeCStringAppendFormat(&cmd_line, _T(" %s"), enclosed_crash_filename_);
-  if (is_machine_set()) {
-    SafeCStringAppendFormat(&cmd_line, _T(" /%s"), kCmdLineMachine);
-  }
-
-  if (!custom_info_filename_.IsEmpty()) {
-    CString enclosed_custom_info_filename_(custom_info_filename_);
-    EnclosePath(&enclosed_custom_info_filename_);
-    SafeCStringAppendFormat(&cmd_line, _T(" /%s %s"),
-                            kCmdLineCustomInfoFileName,
-                            enclosed_custom_info_filename_);
-  }
-
-  return cmd_line;
-}
-
-CString CommandLineBuilder::GetExtraAndAppArgs(
-    const TCHAR* extra_switch_name) const {
-  ASSERT1(extra_switch_name && *extra_switch_name);
-  ASSERT1(!extra_args_.IsEmpty());
-  if (extra_args_.IsEmpty()) {
-    return CString();
-  }
-
-  CString cmd_line;
-  CString enclosed_extra_args_(extra_args_);
-  EnclosePath(&enclosed_extra_args_);
-  SafeCStringFormat(&cmd_line, _T("/%s %s"),
-                    extra_switch_name,
-                    enclosed_extra_args_);
-
-  if (!app_args_.IsEmpty()) {
-    CString enclosed_app_args = app_args_;
-    EnclosePath(&enclosed_app_args);
-    SafeCStringAppendFormat(&cmd_line, _T(" /%s %s"),
-                            kCmdLineAppArgs,
-                            enclosed_app_args);
-  }
-
-  return cmd_line;
-}
-
-// Does not support /oem or /eularequired because we would never build that
-// internally.
-CString CommandLineBuilder::GetInstall() const {
-  CString cmd_line(GetExtraAndAppArgs(kCmdLineInstall));
-  if (cmd_line.IsEmpty()) {
-    return CString();
-  }
-
-  if (!install_source_.IsEmpty()) {
-    SafeCStringAppendFormat(&cmd_line, _T(" /%s %s"),
-                            kCmdLineInstallSource,
-                            install_source_);
-  }
-  if (!session_id_.IsEmpty()) {
-    SafeCStringAppendFormat(&cmd_line, _T(" /%s \"%s\""),
-                            kCmdLineSessionId,
-                            session_id_);
-  }
-  if (is_silent_set_) {
-    SafeCStringAppendFormat(&cmd_line, _T(" /%s"), kCmdLineSilent);
-  }
-  return cmd_line;
-}
-
-CString CommandLineBuilder::GetUpdate() const {
-  CString cmd_line;
-  cmd_line.Format(_T("/%s"), kCmdLineUpdate);
-  if (!session_id_.IsEmpty()) {
-    SafeCStringAppendFormat(&cmd_line, _T(" /%s \"%s\""),
-                            kCmdLineSessionId,
-                            session_id_);
-  }
-  return cmd_line;
-}
-
-CString CommandLineBuilder::GetHandoffInstall() const {
-  CString cmd_line(GetExtraAndAppArgs(kCmdLineAppHandoffInstall));
-  if (cmd_line.IsEmpty()) {
-    return CString();
-  }
-
-  if (!install_source_.IsEmpty()) {
-    SafeCStringAppendFormat(&cmd_line, _T(" /%s %s"),
-                            kCmdLineInstallSource,
-                            install_source_);
-  }
-  if (!session_id_.IsEmpty()) {
-    SafeCStringAppendFormat(&cmd_line, _T(" /%s \"%s\""),
-                            kCmdLineSessionId,
-                            session_id_);
-  }
-  if (is_silent_set_) {
-    SafeCStringAppendFormat(&cmd_line, _T(" /%s"), kCmdLineSilent);
-  }
-  if (is_eula_required_set_) {
-    SafeCStringAppendFormat(&cmd_line, _T(" /%s"), kCmdLineEulaRequired);
-  }
-  if (!offline_dir_.IsEmpty()) {
-    SafeCStringAppendFormat(&cmd_line, _T(" /%s \"%s\""),
-                            kCmdLineOfflineDir,
-                            offline_dir_);
-  }
-  return cmd_line;
-}
-
-CString CommandLineBuilder::GetUA() const {
-  ASSERT1(!install_source_.IsEmpty());
-  if (install_source_.IsEmpty()) {
-    return CString();
-  }
-
-  CString cmd_line(GetSingleSwitch(kCmdLineUpdateApps));
-  SafeCStringAppendFormat(&cmd_line, _T(" /%s %s"),
-                          kCmdLineInstallSource,
-                          install_source_);
-
-  return cmd_line;
-}
-
-CString CommandLineBuilder::GetRecover() const {
-  ASSERT1(!code_red_metainstaller_path_.IsEmpty());
-  if (code_red_metainstaller_path_.IsEmpty()) {
-    return CString();
-  }
-  CString cmd_line;
-  SafeCStringFormat(&cmd_line, _T("/%s %s"),
-                    kCmdLineRecover,
-                    code_red_metainstaller_path_);
-  return cmd_line;
-}
-
-CString CommandLineBuilder::GetWebPlugin() const {
-  ASSERT1(!webplugin_url_domain_.IsEmpty());
-  ASSERT1(!webplugin_args_.IsEmpty());
-  ASSERT1(!install_source_.IsEmpty());
-  if (webplugin_url_domain_.IsEmpty() ||
-      webplugin_args_.IsEmpty() ||
-      install_source_.IsEmpty()) {
-    return CString();
-  }
-  CString cmd_line;
-  CString enclosed_webplugin_url_domain_(webplugin_url_domain_);
-  CString enclosed_webplugin_args_(webplugin_args_);
-  EnclosePath(&enclosed_webplugin_url_domain_);
-  EnclosePath(&enclosed_webplugin_args_);
-  // TODO(omaha): Do we want this to handle the urlencoding for us?
-  SafeCStringFormat(&cmd_line, _T("/%s %s %s /%s %s"),
-                    kCmdLineWebPlugin,
-                    enclosed_webplugin_url_domain_,
-                    enclosed_webplugin_args_,
-                    kCmdLineInstallSource,
-                    install_source_);
-  return cmd_line;
-}
-
-CString CommandLineBuilder::GetCodeRedCheck() const {
-  return GetSingleSwitch(kCmdLineCodeRedCheck);
-}
-
-CString CommandLineBuilder::GetComServer() const {
-  return kCmdLineComServerDash;
-}
-
-CString CommandLineBuilder::GetComBroker() const {
-  return kCmdLineComBroker;
-}
-
-CString CommandLineBuilder::GetOnDemand() const {
-  return kCmdLineOnDemand;
-}
-
-CString CommandLineBuilder::GetMediumService() const {
-  return GetSingleSwitch(kCmdLineMediumService);
-}
-
-CString CommandLineBuilder::GetUninstall() const {
-  return GetSingleSwitch(kCmdLineUninstall);
-}
-
-CString CommandLineBuilder::GetRegisterProduct() const {
-  ASSERT1(app_args_.IsEmpty());
-  return GetExtraAndAppArgs(kCmdLineRegisterProduct);
-}
-
-CString CommandLineBuilder::GetUnregisterProduct() const {
-  ASSERT1(app_args_.IsEmpty());
-  return GetExtraAndAppArgs(kCmdLineUnregisterProduct);
-}
-
-CString CommandLineBuilder::GetPing() const {
-  CString cmd_line;
-  SafeCStringFormat(&cmd_line, _T("/%s %s"), kCmdLinePing, ping_string_);
-  return cmd_line;
-}
-
-}  // namespace omaha
diff --git a/common/command_line_builder.h b/common/command_line_builder.h
deleted file mode 100644
index bdd9e68..0000000
--- a/common/command_line_builder.h
+++ /dev/null
@@ -1,145 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_COMMAND_LINE_BUILDER_H__
-#define OMAHA_COMMON_COMMAND_LINE_BUILDER_H__
-
-#include <windows.h>
-#include <atlstr.h>
-
-#include "base/basictypes.h"
-#include "omaha/common/command_line.h"
-
-namespace omaha {
-
-// This class builds a GoogleUpdate.exe command line and makes sure it's
-// valid against the GoopdateCommandLineValidator.
-class CommandLineBuilder {
- public:
-  explicit CommandLineBuilder(CommandLineMode mode);
-  ~CommandLineBuilder();
-
-  CommandLineMode mode() const { return mode_; }
-
-  bool is_interactive_set() const { return is_interactive_set_; }
-  void set_is_interactive_set(bool is_interactive_set);
-
-  bool is_machine_set() const { return is_machine_set_; }
-  void set_is_machine_set(bool is_machine_set);
-
-  bool is_silent_set() const { return is_silent_set_; }
-  void set_is_silent_set(bool is_silent_set);
-
-  bool is_eula_required_set() const { return is_eula_required_set_; }
-  void set_is_eula_required_set(bool is_eula_required_set);
-
-  CString extra_args() const { return extra_args_; }
-  void set_extra_args(const CString& extra_args);
-
-  CString app_args() const { return app_args_; }
-  void set_app_args(const CString& app_args);
-
-  CString install_source() const { return install_source_; }
-  void set_install_source(const CString& install_source);
-
-  CString session_id() const { return session_id_; }
-  void set_session_id(const CString& session_id);
-
-  CString crash_filename() const { return crash_filename_; }
-  void set_crash_filename(const CString& crash_filename);
-
-  CString custom_info_filename() const { return custom_info_filename_; }
-  void set_custom_info_filename(const CString& custom_info_filename);
-
-  CString webplugin_url_domain() const { return webplugin_url_domain_; }
-  void set_webplugin_url_domain(const CString& webplugin_url_domain);
-
-  CString webplugin_args() const { return webplugin_args_; }
-  void set_webplugin_args(const CString& webplugin_args);
-
-  CString code_red_metainstaller_path() const {
-    return code_red_metainstaller_path_;
-  }
-  void set_code_red_metainstaller_path(
-      const CString& code_red_metainstaller_path);
-
-  CString ping_string() const { return ping_string_; }
-  void set_ping_string(const CString& ping_string);
-
-  CString offline_dir() const { return offline_dir_; }
-
-  // Sets the offline directory after removing any trailing backslash.
-  void SetOfflineDir(const CString& offline_dir);
-
-  // Outputs the proper command line string for the properties that are set.
-  // If the properties aren't in a valid combination, function will assert.
-  CString GetCommandLineArgs()  const;
-
-  CString GetCommandLine(const CString& program_name) const;
-
- private:
-  CString GetSingleSwitch(const CString& switch_name) const;
-  CString GetExtraAndAppArgs(const TCHAR* extra_switch_name) const;
-
-  CString GetCore() const;
-  CString GetCrashHandler() const;
-  CString GetService() const;
-  CString GetServiceRegister() const;
-  CString GetServiceUnregister() const;
-  CString GetRegServer() const;
-  CString GetUnregServer() const;
-  CString GetNetDiags() const;
-  CString GetCrash() const;
-  CString GetReportCrash() const;
-  CString GetInstall() const;
-  CString GetUpdate() const;
-  CString GetHandoffInstall() const;
-  CString GetUA() const;
-  CString GetRecover() const;
-  CString GetWebPlugin() const;
-  CString GetCodeRedCheck() const;
-  CString GetComServer() const;
-  CString GetComBroker() const;
-  CString GetOnDemand() const;
-  CString GetMediumService() const;
-  CString GetUninstall() const;
-  CString GetRegisterProduct() const;
-  CString GetUnregisterProduct() const;
-  CString GetPing() const;
-
-  const CommandLineMode mode_;
-  bool is_interactive_set_;
-  bool is_machine_set_;
-  bool is_silent_set_;
-  bool is_eula_required_set_;
-  CString extra_args_;
-  CString app_args_;
-  CString install_source_;
-  CString crash_filename_;
-  CString custom_info_filename_;
-  CString webplugin_url_domain_;
-  CString webplugin_args_;
-  CString code_red_metainstaller_path_;
-  CString ping_string_;
-  CString offline_dir_;
-  CString session_id_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(CommandLineBuilder);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_COMMAND_LINE_BUILDER_H__
-
diff --git a/common/command_line_builder_unittest.cc b/common/command_line_builder_unittest.cc
deleted file mode 100644
index 41f053d..0000000
--- a/common/command_line_builder_unittest.cc
+++ /dev/null
@@ -1,446 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/common/command_line_builder.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(CommandLineBuilder, BuildUnknown) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_UNKNOWN);
-  ExpectAsserts expect_asserts;
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T(""), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildNoArgs) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_NOARGS);
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T(""), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildCore) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_CORE);
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/c"), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildService) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_SERVICE);
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/svc"), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildMediumService) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_MEDIUM_SERVICE);
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/medsvc"), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildRegServer) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_REGSERVER);
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/regserver"), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildUnregServer) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_UNREGSERVER);
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/unregserver"), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildNetDiags) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_NETDIAGS);
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/netdiags"), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildCrashNoFilename) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_CRASH);
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/crash"), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildReportCrash) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_REPORTCRASH);
-  ExpectAsserts expect_asserts;  // Missing filename.
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T(""), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildReportCrashWithFilename) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_REPORTCRASH);
-  builder.set_crash_filename(_T("foo.dmp"));
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/report \"foo.dmp\""), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildReportCrashWithFilenameMachine) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_REPORTCRASH);
-  builder.set_crash_filename(_T("foo.dmp"));
-  builder.set_is_machine_set(true);
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/report \"foo.dmp\" /machine"), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildReportCrashWithEnclosedFilename) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_REPORTCRASH);
-  builder.set_crash_filename(_T("\"foo.dmp\""));
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/report \"foo.dmp\""), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildReportCrashWithCustomInfo) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_REPORTCRASH);
-  ExpectAsserts expect_asserts;  // Missing filename.
-  builder.set_custom_info_filename(_T("foo.txt"));
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T(""), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildReportCrashWithFileanameWithCustomInfo) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_REPORTCRASH);
-  builder.set_crash_filename(_T("foo.dmp"));
-  builder.set_custom_info_filename(_T("foo.txt"));
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/report \"foo.dmp\" /custom_info_filename \"foo.txt\""),
-               cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildReportCrashWithFileanameWithCustomInfoMachine) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_REPORTCRASH);
-  builder.set_crash_filename(_T("foo.dmp"));
-  builder.set_custom_info_filename(_T("foo.txt"));
-  builder.set_is_machine_set(true);
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(
-      _T("/report \"foo.dmp\" /machine /custom_info_filename \"foo.txt\""),
-      cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildReportCrashWithEnclosedFileanameWithCustomInfo) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_REPORTCRASH);
-  builder.set_crash_filename(_T("\"foo.dmp\""));
-  builder.set_custom_info_filename(_T("\"foo.txt\""));
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/report \"foo.dmp\" /custom_info_filename \"foo.txt\""),
-               cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildReportCrashInteractiveWithFilename) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_REPORTCRASH);
-  builder.set_crash_filename(_T("foo.dmp"));
-  builder.set_is_interactive_set(true);
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/report /i \"foo.dmp\""), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildReportCrashMachineInteractiveWithFilename) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_REPORTCRASH);
-  builder.set_crash_filename(_T("foo.dmp"));
-  builder.set_is_machine_set(true);
-  builder.set_is_interactive_set(true);
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/report /i \"foo.dmp\" /machine"), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildInstall) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_INSTALL);
-  ExpectAsserts expect_asserts;  // Missing parameters.
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T(""), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildInstallWithExtraArgs) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_INSTALL);
-  builder.set_extra_args(_T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-                         _T("appname=YouTubeUploader&needsadmin=False&")
-                         _T("lang=en"));
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/install \"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-               _T("appname=YouTubeUploader&needsadmin=False&lang=en\""),
-               cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildInstallWithExtraArgsSilent) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_INSTALL);
-  builder.set_extra_args(_T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-                         _T("appname=YouTubeUploader&needsadmin=False&")
-                         _T("lang=en"));
-  builder.set_is_silent_set(true);
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/install \"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-               _T("appname=YouTubeUploader&needsadmin=False&lang=en\" /silent"),
-               cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildInstallWithExtraArgsSessionId) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_INSTALL);
-  builder.set_extra_args(_T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-                         _T("appname=YouTubeUploader&needsadmin=False&")
-                         _T("lang=en"));
-  builder.set_session_id(_T("{756dfdc2-0ef0-44b7-bfb1-21a4be6a1213}"));
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/install \"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-               _T("appname=YouTubeUploader&needsadmin=False&lang=en\"")
-               _T(" /sessionid \"{756dfdc2-0ef0-44b7-bfb1-21a4be6a1213}\""),
-               cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildUpdate) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_UPDATE);
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/update"), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildUpdateWithSessionId) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_UPDATE);
-  builder.set_session_id(_T("{756dfdc2-0ef0-44b7-bfb1-21a4be6a1213}"));
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(
-      _T("/update /sessionid \"{756dfdc2-0ef0-44b7-bfb1-21a4be6a1213}\""),
-      cmd_line);
-}
-
-// The /update builder works when not used with GoogleUpdate.exe.
-TEST(CommandLineBuilder, BuildUpdateAndGetCommandLineWithNonGoogleUpdateExe) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_UPDATE);
-  CString cmd_line = builder.GetCommandLine(_T("C:\\GoogleUpdateSetup_en.exe"));
-  EXPECT_STREQ(_T("\"C:\\GoogleUpdateSetup_en.exe\" /update"), cmd_line);
-}
-
-// The /update builder should not be used with GoogleUpdate.exe directly.
-TEST(CommandLineBuilder, BuildUpdateAndGetCommandLineWithGoogleUpdateExe) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_UPDATE);
-  ExpectAsserts expect_asserts;
-  CString cmd_line = builder.GetCommandLine(_T("C:\\GoogleUpdate.exe"));
-  EXPECT_STREQ(_T("\"C:\\GoogleUpdate.exe\" /update"), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildComServer) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_COMSERVER);
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("-Embedding"), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildComBroker) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_COMBROKER);
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/broker"), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildOnDemand) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_ONDEMAND);
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/ondemand"), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildCodeRedCheck) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_CODE_RED_CHECK);
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/cr"), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildWebPlugin) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_WEBPLUGIN);
-  ExpectAsserts expect_asserts;
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T(""), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildWebPluginWithUrlArgsAndInstallSource) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_WEBPLUGIN);
-  builder.set_webplugin_args(_T("piargs"));
-  builder.set_webplugin_url_domain(_T("http://www.google.com/"));
-  builder.set_install_source(_T("oneclick"));
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/pi \"http://www.google.com/\" \"piargs\"")
-               _T(" /installsource oneclick"),
-               cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildRecover) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_RECOVER);
-  ExpectAsserts expect_asserts;
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T(""), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildRecoverWithMIPath) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_RECOVER);
-  builder.set_code_red_metainstaller_path(_T("foo.exe"));
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/recover foo.exe"), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildUA) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_UA);
-  ExpectAsserts expect_asserts;
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T(""), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildUAWithInstallSource) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_UA);
-  builder.set_install_source(_T("blah"));
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/ua /installsource blah"), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildHandoffInstall) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_HANDOFF_INSTALL);
-  ExpectAsserts expect_asserts;  // Missing extra args.
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T(""), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildHandoffInstallWithExtraArgs) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_HANDOFF_INSTALL);
-  builder.set_extra_args(_T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-                         _T("appname=YouTubeUploader&needsadmin=False&")
-                         _T("lang=en"));
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/handoff \"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-               _T("appname=YouTubeUploader&needsadmin=False&lang=en\""),
-               cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildHandoffInstallWithExtraArgsSessionId) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_HANDOFF_INSTALL);
-  builder.set_extra_args(_T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-                         _T("appname=YouTubeUploader&needsadmin=False&")
-                         _T("lang=en"));
-  builder.set_session_id(_T("{756dfdc2-0ef0-44b7-bfb1-21a4be6a1213}"));
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/handoff \"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-               _T("appname=YouTubeUploader&needsadmin=False&lang=en\"")
-               _T(" /sessionid \"{756dfdc2-0ef0-44b7-bfb1-21a4be6a1213}\""),
-               cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildHandoffInstallWithExtraArgsOffline) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_HANDOFF_INSTALL);
-  builder.set_extra_args(_T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-                         _T("appname=YouTubeUploader&needsadmin=False&")
-                         _T("lang=en"));
-  builder.set_install_source(_T("offline"));
-  builder.SetOfflineDir(_T("c:\\offline_dir\\"));
-
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/handoff \"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-               _T("appname=YouTubeUploader&needsadmin=False&lang=en\"")
-               _T(" /installsource offline")
-               _T(" /offlinedir \"c:\\offline_dir\""),
-               cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildHandoffInstallWithExtraArgsSilentOffline) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_HANDOFF_INSTALL);
-  builder.set_extra_args(_T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-                         _T("appname=YouTubeUploader&needsadmin=False&")
-                         _T("lang=en"));
-  builder.set_install_source(_T("offline"));
-  builder.set_is_silent_set(true);
-  builder.SetOfflineDir(_T("c:\\offline dir"));
-
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/handoff \"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-               _T("appname=YouTubeUploader&needsadmin=False&lang=en\"")
-               _T(" /installsource offline")
-               _T(" /silent /offlinedir \"c:\\offline dir\""),
-               cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildHandoffWithAppArgsSilentOffline) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_HANDOFF_INSTALL);
-  builder.set_extra_args(_T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-                         _T("appname=YouTubeUploader&needsadmin=False&")
-                         _T("lang=en"));
-  builder.set_app_args(_T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-                       _T("installerdata=foobar%45"));
-  builder.set_install_source(_T("offline"));
-  builder.set_is_silent_set(true);
-  builder.SetOfflineDir(_T("c:\\offline dir"));
-
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/handoff \"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-               _T("appname=YouTubeUploader&needsadmin=False&lang=en\"")
-               _T(" /appargs \"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-               _T("installerdata=foobar%45\"")
-               _T(" /installsource offline")
-               _T(" /silent /offlinedir \"c:\\offline dir\""),
-               cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildHandoffWithAppArgsSilentOfflineEulaRequired) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_HANDOFF_INSTALL);
-  builder.set_extra_args(_T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-                         _T("appname=YouTubeUploader&needsadmin=False&")
-                         _T("lang=en"));
-  builder.set_app_args(_T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-                       _T("installerdata=foobar%45"));
-  builder.set_install_source(_T("offline"));
-  builder.set_is_silent_set(true);
-  builder.set_is_eula_required_set(true);
-  builder.SetOfflineDir(_T("c:\\offline dir"));
-
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/handoff \"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-               _T("appname=YouTubeUploader&needsadmin=False&lang=en\"")
-               _T(" /appargs \"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-               _T("installerdata=foobar%45\"")
-               _T(" /installsource offline")
-               _T(" /silent /eularequired /offlinedir \"c:\\offline dir\""),
-               cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildRegisterProduct) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_REGISTER_PRODUCT);
-  builder.set_extra_args(_T("appguid={7DD3DAE3-87F1-4CFE-8BF4-452C74421401}&")
-                         _T("appname=Google Toolbar&needsadmin=True&")
-                         _T("lang=en"));
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/registerproduct ")
-               _T("\"appguid={7DD3DAE3-87F1-4CFE-8BF4-452C74421401}&")
-               _T("appname=Google Toolbar&needsadmin=True&lang=en\""),
-               cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildUnregisterProduc) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_UNREGISTER_PRODUCT);
-  builder.set_extra_args(_T("appguid={7DD3DAE3-87F1-4CFE-8BF4-452C74421401}&")
-                         _T("needsadmin=True&lang=en"));
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/unregisterproduct ")
-               _T("\"appguid={7DD3DAE3-87F1-4CFE-8BF4-452C74421401}&")
-               _T("needsadmin=True&lang=en\""),
-               cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildUninstall) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_UNINSTALL);
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/uninstall"), cmd_line);
-}
-
-TEST(CommandLineBuilder, BuildPing) {
-  CommandLineBuilder builder(COMMANDLINE_MODE_PING);
-  builder.set_ping_string(_T("foo"));
-  CString cmd_line = builder.GetCommandLineArgs();
-  EXPECT_STREQ(_T("/ping foo"), cmd_line);
-}
-
-}  // namespace omaha
-
diff --git a/common/command_line_unittest.cc b/common/command_line_unittest.cc
deleted file mode 100644
index 758bdb8..0000000
--- a/common/command_line_unittest.cc
+++ /dev/null
@@ -1,1233 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/utils.h"
-#include "omaha/common/command_line.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-// Used by extra_args_parser_unittest.cc.
-void VerifyCommandLineExtraArgs(const CommandLineExtraArgs& expected_val,
-                                const CommandLineExtraArgs& actual_val);
-
-namespace {
-
-#define YOUTUBEUPLOADEREN_TAG_WITHOUT_QUOTES \
-    _T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&") \
-    _T("appname=YouTubeUploader&needsadmin=False&lang=en")
-
-#define YOUTUBEUPLOADEREN_APP_ARGS_WITHOUT_QUOTES \
-    _T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&") \
-    _T("installerdata=YouTube%20Uploader%20Data")
-
-#define YOUTUBEUPLOADEREN_TAG \
-    _T("\"") YOUTUBEUPLOADEREN_TAG_WITHOUT_QUOTES _T("\"")
-
-#define YOUTUBEUPLOADEREN_APP_ARGS \
-    _T("\"") YOUTUBEUPLOADEREN_APP_ARGS_WITHOUT_QUOTES _T("\"")
-
-void VerifyCommandLineArgs(const CommandLineArgs& expected,
-                           const CommandLineArgs& actual) {
-  EXPECT_EQ(expected.mode, actual.mode);
-
-  EXPECT_EQ(expected.is_interactive_set, actual.is_interactive_set);
-  EXPECT_EQ(expected.is_machine_set, actual.is_machine_set);
-  EXPECT_EQ(expected.is_install_elevated, actual.is_install_elevated);
-  EXPECT_EQ(expected.is_silent_set, actual.is_silent_set);
-  EXPECT_EQ(expected.is_eula_required_set, actual.is_eula_required_set);
-  EXPECT_EQ(expected.is_offline_set, actual.is_offline_set);
-  EXPECT_EQ(expected.is_oem_set, actual.is_oem_set);
-
-  EXPECT_STREQ(expected.extra_args_str, actual.extra_args_str);
-  EXPECT_STREQ(expected.app_args_str, actual.app_args_str);
-  EXPECT_STREQ(expected.install_source, actual.install_source);
-  EXPECT_STREQ(expected.crash_filename, actual.crash_filename);
-  EXPECT_STREQ(expected.custom_info_filename, actual.custom_info_filename);
-  EXPECT_STREQ(expected.legacy_manifest_path, actual.legacy_manifest_path);
-  EXPECT_STREQ(expected.webplugin_urldomain, actual.webplugin_urldomain);
-  EXPECT_STREQ(expected.webplugin_args, actual.webplugin_args);
-  EXPECT_STREQ(expected.code_red_metainstaller_path,
-               actual.code_red_metainstaller_path);
-  EXPECT_STREQ(expected.offline_dir, actual.offline_dir);
-
-  VerifyCommandLineExtraArgs(expected.extra, actual.extra);
-}
-
-void VerifyArgsWithSingleYouTubeUploaderEnApp(
-    const CommandLineArgs& expected_without_app,
-    const CommandLineArgs& actual,
-    bool expect_app_args,
-    bool expect_language) {
-  CommandLineArgs expected(expected_without_app);
-
-  const GUID expected_guid = {0xA4F7B07B, 0xB9BD, 0x4A33,
-                              {0xB1, 0x36, 0x96, 0xD2, 0xAD, 0xFB, 0x60, 0xCB}};
-  CommandLineAppArgs app_args;
-  app_args.app_guid = expected_guid;
-  app_args.app_name = _T("YouTubeUploader");
-  app_args.needs_admin = NEEDS_ADMIN_NO;
-  if (expected.extra_args_str.IsEmpty()) {
-    expected.extra_args_str = YOUTUBEUPLOADEREN_TAG_WITHOUT_QUOTES;
-  }
-  if (expect_language) {
-    expected.extra.language = _T("en");
-  }
-  if (expect_app_args) {
-    expected.app_args_str =
-        YOUTUBEUPLOADEREN_APP_ARGS_WITHOUT_QUOTES;
-    app_args.encoded_installer_data = _T("YouTube%20Uploader%20Data");
-  }
-
-  expected.extra.apps.push_back(app_args);
-  expected.extra.bundle_name = _T("YouTubeUploader");
-  VerifyCommandLineArgs(expected, actual);
-}
-
-}  // namespace
-
-void VerifyCommandLineExtraArgs(const CommandLineExtraArgs& expected_val,
-                                const CommandLineExtraArgs& actual_val) {
-  EXPECT_STREQ(expected_val.bundle_name, actual_val.bundle_name);
-  EXPECT_STREQ(GuidToString(expected_val.installation_id),
-               GuidToString(actual_val.installation_id));
-  EXPECT_STREQ(expected_val.brand_code, actual_val.brand_code);
-  EXPECT_STREQ(expected_val.client_id, actual_val.client_id);
-  EXPECT_STREQ(expected_val.experiment_labels,
-               actual_val.experiment_labels);
-  EXPECT_STREQ(expected_val.referral_id, actual_val.referral_id);
-  EXPECT_STREQ(expected_val.language, actual_val.language);
-  EXPECT_EQ(expected_val.browser_type, actual_val.browser_type);
-  EXPECT_EQ(expected_val.usage_stats_enable, actual_val.usage_stats_enable);
-  EXPECT_EQ(expected_val.runtime_only, actual_val.runtime_only);
-
-  EXPECT_EQ(expected_val.apps.size(), actual_val.apps.size());
-
-  for (size_t i = 0; i < actual_val.apps.size(); ++i) {
-    CommandLineAppArgs expected = expected_val.apps[i];
-    CommandLineAppArgs actual = actual_val.apps[i];
-
-    EXPECT_STREQ(GuidToString(expected.app_guid),
-                 GuidToString(actual.app_guid));
-    EXPECT_STREQ(expected.app_name, actual.app_name);
-    EXPECT_EQ(expected.needs_admin, actual.needs_admin);
-    EXPECT_STREQ(expected.ap, actual.ap);
-    EXPECT_STREQ(expected.tt_token, actual.tt_token);
-    EXPECT_STREQ(expected.encoded_installer_data,
-                 actual.encoded_installer_data);
-    EXPECT_STREQ(expected.install_data_index, actual.install_data_index);
-    EXPECT_STREQ(expected.experiment_labels, actual.experiment_labels);
-  }
-}
-
-class CommandLineTest : public testing::Test {
- protected:
-  CommandLineArgs args_;
-  CommandLineArgs expected_;
-};
-
-TEST(CommandLineSimpleTest, GetCmdLineTail1) {
-  EXPECT_STREQ(_T(""),  GetCmdLineTail(_T("")));
-}
-
-TEST(CommandLineSimpleTest, GetCmdLineTail2) {
-  EXPECT_STREQ(_T(""), GetCmdLineTail(_T("a")));
-}
-TEST(CommandLineSimpleTest, GetCmdLineTail3) {
-  EXPECT_STREQ(_T(""), GetCmdLineTail(_T("goopdate.exe")));
-}
-
-TEST(CommandLineSimpleTest, GetCmdLineTail4) {
-  // Double quotes.
-  EXPECT_STREQ(_T(""), GetCmdLineTail(_T("\"Google Update.exe\"")));
-}
-
-TEST(CommandLineSimpleTest, GetCmdLineTail5) {
-  // Argument.
-  EXPECT_STREQ(_T("foobar"), GetCmdLineTail(_T("goopdate.exe foobar")));
-}
-
-TEST(CommandLineSimpleTest, GetCmdLineTail6) {
-  // Double quotes and argument.
-  EXPECT_STREQ(_T("foobar"),
-               GetCmdLineTail(_T("\"Google Update.exe\" foobar")));
-}
-
-TEST(CommandLineSimpleTest, GetCmdLineTail7) {
-  // Double quotes and inner double quote and argument.
-  EXPECT_STREQ(_T("foobar"),
-               GetCmdLineTail(_T("\"Google\"\" Update.exe\" foobar")));
-}
-
-TEST(CommandLineSimpleTest, GetCmdLineTail8) {
-  // Double quotes and two arguments.
-  EXPECT_STREQ(_T("foo bar"),
-               GetCmdLineTail(_T("\"Google Update.exe\" foo bar")));
-}
-
-TEST(CommandLineSimpleTest, GetCmdLineTail9) {
-  // Double quotes and one argument with quotes.
-  EXPECT_STREQ(_T("\"foo bar\""),
-               GetCmdLineTail(_T("\"Google Update.exe\" \"foo bar\"")));
-}
-
-TEST(CommandLineSimpleTest, GetCmdLineTail10) {
-  // \t as white space.
-  EXPECT_STREQ(_T("foo bar"),
-               GetCmdLineTail(_T("\"Google Update.exe\"\tfoo bar")));
-}
-
-TEST(CommandLineSimpleTest, GetCmdLineTail11) {
-  // Trailing space.
-  EXPECT_STREQ(_T("foo bar "),
-               GetCmdLineTail(_T("\"Google Update.exe\" foo bar ")));
-}
-
-//
-// This block contains the positive test cases for each of the command lines.
-// If you add a new command line parameter permutation, add a test case here.
-//
-
-// TODO(omaha): Add some negative failure cases to the command lines (like
-// /install without "extraargs").
-
-// TODO(omaha): This is an Omaha1 back-compat issue.  Omaha2 should _never_
-// call googleupdate.exe with no arguments.  So when we stop supporting Omaha1
-// handoffs we should remove this support.
-  // Parse empty command line.
-TEST_F(CommandLineTest, ParseCommandLine_Empty) {
-  const TCHAR* kCmdLine = _T("");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_NOARGS;
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path>
-// Remember that by convention the OS is passing us the program executable
-// name as the first token in the command line and the parsing code skips that.
-TEST_F(CommandLineTest, ParseCommandLine_ProgramNameOnly) {
-  const TCHAR* kCmdLine = _T("goopdate.exe");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_NOARGS;
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path> /svc
-TEST_F(CommandLineTest, ParseCommandLine_Svc) {
-  const TCHAR* kCmdLine = _T("\"C:\\Program Files\\Google\\Common\\Update\\")
-                           _T("1.0.18.0\\goopdate.exe\" /svc");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_SERVICE;
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path> /medsvc
-TEST_F(CommandLineTest, ParseCommandLine_MedSvc) {
-  const TCHAR* kCmdLine = _T("\"C:\\Program Files\\Google\\Common\\Update\\")
-                           _T("1.0.18.0\\goopdate.exe\" /medsvc");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_MEDIUM_SERVICE;
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path> -Embedding. The -Embedding text is injected via COM.
-TEST_F(CommandLineTest, ParseCommandLine_Server) {
-  const TCHAR* kCmdLine = _T("goopdate.exe -Embedding");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_COMSERVER;
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path> /broker. Used for the special COM broker mode.
-TEST_F(CommandLineTest, ParseCommandLine_Broker) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /broker");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_COMBROKER;
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path> /ondemand.
-TEST_F(CommandLineTest, ParseCommandLine_OnDemand) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /ondemand");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_ONDEMAND;
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path> /install "extraargs"
-// Also tests that bundle_name takes the first app's appname when no bundlename
-// is specified.
-TEST_F(CommandLineTest, ParseCommandLine_Install) {
-  const TCHAR* kCmdLine =
-      _T("goopdate.exe /install ")
-      _T("\"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-      _T("appname=YouTubeUploader&needsadmin=False&")
-      _T("appguid={C7A9A2F5-C4F9-42d3-8A8B-55086A205468}&")
-      _T("appname=TestApp&needsadmin=true&lang=en\"");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_INSTALL;
-
-  expected_.extra_args_str = _T("appguid=")
-                             _T("{A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-                             _T("appname=YouTubeUploader&needsadmin=False&")
-                             _T("appguid=")
-                             _T("{C7A9A2F5-C4F9-42d3-8A8B-55086A205468}&")
-                             _T("appname=TestApp&needsadmin=true&lang=en");
-  CommandLineAppArgs app_args;
-  const GUID expected_guid = {0xA4F7B07B, 0xB9BD, 0x4A33,
-                              {0xB1, 0x36, 0x96, 0xD2, 0xAD, 0xFB, 0x60, 0xCB}};
-  app_args.app_guid = expected_guid;
-  app_args.app_name = _T("YouTubeUploader");
-  app_args.needs_admin = NEEDS_ADMIN_NO;
-  expected_.extra.apps.push_back(app_args);
-
-  CommandLineAppArgs app_args1;
-  app_args1.app_guid =
-      StringToGuid(_T("{C7A9A2F5-C4F9-42d3-8A8B-55086A205468}"));
-  app_args1.app_name = _T("TestApp");
-  app_args1.needs_admin = NEEDS_ADMIN_YES;
-  expected_.extra.apps.push_back(app_args1);
-
-  expected_.extra.bundle_name = _T("YouTubeUploader");
-  expected_.extra.language = _T("en");
-
-  VerifyCommandLineArgs(expected_, args_);
-
-  EXPECT_STREQ(_T("YouTubeUploader"), args_.extra.bundle_name);
-}
-
-// Parse: <path> /install "bundlename=My%20Bundle&extraargs"
-// Tests bundlename override of appname.
-TEST_F(CommandLineTest, ParseCommandLine_Install_BundleName) {
-  const TCHAR* kCmdLine =
-      _T("goopdate.exe /install ")
-      _T("\"bundlename=My%20Bundle&")
-      _T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-      _T("appname=YouTubeUploader&needsadmin=False&\"");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_INSTALL;
-
-  expected_.extra_args_str = _T("bundlename=My%20Bundle&appguid=")
-                             _T("{A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-                             _T("appname=YouTubeUploader&needsadmin=False&");
-  CommandLineAppArgs app_args;
-  const GUID expected_guid = {0xA4F7B07B, 0xB9BD, 0x4A33,
-                              {0xB1, 0x36, 0x96, 0xD2, 0xAD, 0xFB, 0x60, 0xCB}};
-  app_args.app_guid = expected_guid;
-  app_args.app_name = _T("YouTubeUploader");
-  app_args.needs_admin = NEEDS_ADMIN_NO;
-  expected_.extra.apps.push_back(app_args);
-
-  expected_.extra.bundle_name = _T("My Bundle");
-
-  VerifyCommandLineArgs(expected_, args_);
-
-  EXPECT_STREQ(_T("My Bundle"), args_.extra.bundle_name);
-}
-
-// Parse: <path> /install "extraargs" /oem
-TEST_F(CommandLineTest, ParseCommandLine_InstallWithOem) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /install ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /oem");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_INSTALL;
-  expected_.is_oem_set = true;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse: <path> /install "extraargs" [/oem
-// This tests how we handle a switch with a bracket, which represents optional
-// parameters in a rule, when it appears in an actual command line.
-TEST_F(CommandLineTest, ParseCommandLine_InstallWithOemIgnored) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /install ") YOUTUBEUPLOADEREN_TAG
-                          _T(" [/oem");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_INSTALL;
-  expected_.is_oem_set = false;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse: <path> /install "extraargs" /appargs <appargs>
-TEST_F(CommandLineTest, ParseCommandLine_InstallWithAppArgs) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /install ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /appargs ") YOUTUBEUPLOADEREN_APP_ARGS;
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_INSTALL;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, true, true);
-}
-
-// Parse: <path> /install "extraargs" /oem /appargs <appargs>
-TEST_F(CommandLineTest, ParseCommandLine_InstallWithOemAppArgs) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /install ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /oem")
-                          _T(" /appargs ") YOUTUBEUPLOADEREN_APP_ARGS;
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_INSTALL;
-  expected_.is_oem_set = true;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, true, true);
-}
-
-// Parse: <path> /install "extraargs" /appargs <appargs> /silent
-TEST_F(CommandLineTest, ParseCommandLine_InstallWithAppArgsSilent) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /install ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /appargs ") YOUTUBEUPLOADEREN_APP_ARGS
-                          _T(" /silent");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_INSTALL;
-  expected_.is_silent_set = true;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, true, true);
-}
-
-// Parse: <path> /install "extraargs" /oem /appargs <appargs> /silent
-TEST_F(CommandLineTest, ParseCommandLine_InstallWithOemAppArgsSilent) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /install ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /oem")
-                          _T(" /appargs ") YOUTUBEUPLOADEREN_APP_ARGS
-                          _T(" /silent");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_INSTALL;
-  expected_.is_oem_set = true;
-  expected_.is_silent_set = true;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, true, true);
-}
-
-// Parse:
-//  <path> /install "extraargs" /oem /appargs <appargs> /silent /eularequired
-TEST_F(CommandLineTest,
-       ParseCommandLine_InstallWithOemAppArgsSilentEulaRequired) {
-  const TCHAR* kCmdLine =
-      _T("goopdate.exe /install ") YOUTUBEUPLOADEREN_TAG
-      _T(" /oem")
-      _T(" /appargs ") YOUTUBEUPLOADEREN_APP_ARGS
-      _T(" /silent")
-      _T(" /eularequired");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_INSTALL;
-  expected_.is_oem_set = true;
-  expected_.is_silent_set = true;
-  expected_.is_eula_required_set = true;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, true, true);
-}
-
-// Parse: <path> /install "extraargs" /eularequired
-TEST_F(CommandLineTest, ParseCommandLine_InstallEulaRequired) {
-  const TCHAR* kCmdLine =
-      _T("goopdate.exe /install ") YOUTUBEUPLOADEREN_TAG
-      _T(" /eularequired");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_INSTALL;
-  expected_.is_eula_required_set = true;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse: <path> /install "extraargs" /oem /installsource oneclick
-TEST_F(CommandLineTest, ParseCommandLine_InstallWithOemAndSource) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /install ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /oem")
-                          _T(" /installsource oneclick");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_INSTALL;
-  expected_.is_oem_set = true;
-  expected_.install_source = _T("oneclick");
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse: <path> /install "extraargs" /installsource oneclick
-TEST_F(CommandLineTest, ParseCommandLine_InstallWithSource) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /install ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /installsource oneclick");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_INSTALL;
-  expected_.install_source = _T("oneclick");
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse: <path> /install "extraargs" /silent
-TEST_F(CommandLineTest, ParseCommandLine_InstallSilent) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /install ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /silent");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_INSTALL;
-  expected_.is_silent_set = true;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse: <path> /install "extraargs" /silent /oem
-TEST_F(CommandLineTest, ParseCommandLine_InstallSilentWithOem) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /install ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /silent")
-                          _T(" /oem");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_INSTALL;
-  expected_.is_silent_set = true;
-  expected_.is_oem_set = true;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse: <path> /install "extraargs" /installsource oneclick /silent
-TEST_F(CommandLineTest, ParseCommandLine_InstallSilentWithSource) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /install ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /installsource oneclick")
-                          _T(" /silent");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_INSTALL;
-  expected_.install_source = _T("oneclick");
-  expected_.is_silent_set = true;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse: <path> /install "extraargs" /installelevated
-TEST_F(CommandLineTest, ParseCommandLine_InstallElevated) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /install ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /installelevated");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_INSTALL;
-  expected_.is_install_elevated = true;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse: <path> /install "extraargs" /installelevated /installsource oneclick
-TEST_F(CommandLineTest, ParseCommandLine_InstallElevatedWithSource) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /install ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /installelevated /installsource oneclick");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_INSTALL;
-  expected_.is_install_elevated = true;
-  expected_.install_source = _T("oneclick");
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse: <path> /install "extraargs" /sessionid "guid"
-TEST_F(CommandLineTest, ParseCommandLine_InstallSessionId) {
-  const TCHAR* kCmdLine =
-      _T("goopdate.exe /install ") YOUTUBEUPLOADEREN_TAG
-      _T(" /sessionid \"{756dfdc2-0ef0-44b7-bfb1-21a4be6a1213}\"");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_INSTALL;
-  expected_.session_id = _T("{756dfdc2-0ef0-44b7-bfb1-21a4be6a1213}");
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse: <path> /ig "extraargs"
-TEST_F(CommandLineTest, ParseCommandLine_LegacyOmaha2Ig) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /ig ") YOUTUBEUPLOADEREN_TAG;
-  EXPECT_FAILED(ParseCommandLine(kCmdLine, &args_));
-}
-
-// Parse: <path> /handoff "extraargs"
-TEST_F(CommandLineTest, ParseCommandLine_Handoff) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /handoff ") YOUTUBEUPLOADEREN_TAG;
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_HANDOFF_INSTALL;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse: <path> /handoff "extraargs" /offlinedir "c:\dir\ "
-TEST_F(CommandLineTest, ParseCommandLine_OfflineDirTrailingBackslashSpace) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /handoff ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /offlinedir \"c:\\offline dir\\ \"");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_HANDOFF_INSTALL;
-  expected_.is_offline_set = true;
-  expected_.offline_dir = _T("c:\\offline dir");
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse: <path> /handoff "extraargs" /offlinedir "c:\dir\\"
-TEST_F(CommandLineTest,
-       ParseCommandLine_OfflineDirTrailingDoubleBackslashNoSpace) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /handoff ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /offlinedir \"c:\\offline dir\\\\\"");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_HANDOFF_INSTALL;
-  expected_.is_offline_set = true;
-  expected_.offline_dir = _T("c:\\offline dir");
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse: <path> /handoff "extraargs" /offlinedir "c:\dir\"
-TEST_F(CommandLineTest, ParseCommandLine_OfflineDirTrailingBackslashNoSpace) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /handoff ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /offlinedir \"c:\\offline dir\\\"");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_HANDOFF_INSTALL;
-  expected_.is_offline_set = true;
-  expected_.offline_dir = _T("c:\\offline dir");
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse: <path> /handoff "extraargs" /installsource "asd"
-TEST_F(CommandLineTest, ParseCommandLine_HandoffWithSource) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /handoff ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /installsource oneclick");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_HANDOFF_INSTALL;
-  expected_.install_source = _T("oneclick");
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse: <path> /handoff "extraargs" /installsource offline /offlineinstall
-TEST_F(CommandLineTest, ParseCommandLine_HandoffWithSourceOffline) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /handoff ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /installsource offline")
-                          _T(" /offlineinstall");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_HANDOFF_INSTALL;
-  expected_.install_source = _T("offline");
-  expected_.is_offline_set = true;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse: <path> /handoff "extraargs" /appargs <appargs>
-//               /installsource offline /offlinedir "dir"
-TEST_F(CommandLineTest, ParseCommandLine_HandoffWithAppArgsSourceOffline) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /handoff ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /appargs ") YOUTUBEUPLOADEREN_APP_ARGS
-                          _T(" /installsource offline")
-                          _T(" /offlinedir \"c:\\offline_dir\"");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_HANDOFF_INSTALL;
-  expected_.install_source = _T("offline");
-  expected_.is_offline_set = true;
-  expected_.offline_dir = _T("c:\\offline_dir");
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, true, true);
-}
-
-// Parse: <path> /handoff "extraargs" /silent
-TEST_F(CommandLineTest, ParseCommandLine_HandoffSilent) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /handoff ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /silent");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_HANDOFF_INSTALL;
-  expected_.is_silent_set = true;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse: <path> /handoff "extraargs" /silent /offlineinstall
-TEST_F(CommandLineTest,
-       ParseCommandLine_HandoffSilentOfflineWithoutInstallSource) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /handoff ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /silent")
-                          _T(" /offlineinstall");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_HANDOFF_INSTALL;
-  expected_.is_silent_set = true;
-  expected_.is_offline_set = true;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse: <path> /handoff "extraargs" /installsource "asd" /silent
-TEST_F(CommandLineTest, ParseCommandLine_HandoffSilentWithSource) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /handoff ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /installsource oneclick")
-                          _T(" /silent");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_HANDOFF_INSTALL;
-  expected_.install_source = _T("oneclick");
-  expected_.is_silent_set = true;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse:
-//   <path> /handoff "extraargs" /installsource offline /silent /offlineinstall
-TEST_F(CommandLineTest, ParseCommandLine_HandoffSilentWithSourceOffline) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /handoff ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /installsource offline")
-                          _T(" /silent")
-                          _T(" /offlineinstall");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_HANDOFF_INSTALL;
-  expected_.install_source = _T("offline");
-  expected_.is_silent_set = true;
-  expected_.is_offline_set = true;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse: <path> /handoff "extraargs" /appargs <appargs>
-TEST_F(CommandLineTest, ParseCommandLine_HandoffWithAppArgs) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /handoff ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /appargs ") YOUTUBEUPLOADEREN_APP_ARGS;
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_HANDOFF_INSTALL;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, true, true);
-}
-
-// Parse: <path> /handoff "extraargs" /appargs <appargs> /silent
-TEST_F(CommandLineTest, ParseCommandLine_HandoffSilentWithAppArgs) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /handoff ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /appargs ") YOUTUBEUPLOADEREN_APP_ARGS
-                          _T(" /silent");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_HANDOFF_INSTALL;
-  expected_.is_silent_set = true;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, true, true);
-}
-
-// Parse: <path> /handoff "extraargs" /appargs <appargs>
-//               /installsource offline /silent /offlineinstall
-TEST_F(CommandLineTest,
-       ParseCommandLine_HandoffSilentWithAppArgsSourceOffline) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /handoff ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /appargs ") YOUTUBEUPLOADEREN_APP_ARGS
-                          _T(" /installsource offline")
-                          _T(" /silent")
-                          _T(" /offlineinstall");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_HANDOFF_INSTALL;
-  expected_.install_source = _T("offline");
-  expected_.is_silent_set = true;
-  expected_.is_offline_set = true;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, true, true);
-}
-
-// Parse: <path> /handoff "extraargs" /appargs <appargs>
-//               /installsource offline /silent /offlineinstall /eularequired
-TEST_F(CommandLineTest,
-       ParseCommandLine_HandoffSilentWithAppArgsSourceOfflineEulaRequired) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /handoff ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /appargs ") YOUTUBEUPLOADEREN_APP_ARGS
-                          _T(" /installsource offline")
-                          _T(" /silent")
-                          _T(" /offlineinstall")
-                          _T(" /eularequired");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_HANDOFF_INSTALL;
-  expected_.install_source = _T("offline");
-  expected_.is_silent_set = true;
-  expected_.is_offline_set = true;
-  expected_.is_eula_required_set = true;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, true, true);
-}
-
-// Parse: <path> /handoff "extraargs" /eularequired
-TEST_F(CommandLineTest, ParseCommandLine_HandoffEulaRequired) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /handoff ") YOUTUBEUPLOADEREN_TAG
-                          _T(" /eularequired");
-
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_HANDOFF_INSTALL;
-  expected_.is_eula_required_set = true;
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse: <path> /handoff "extraargs" /sessionid "guid"
-TEST_F(CommandLineTest, ParseCommandLine_HandoffSessionId) {
-  const TCHAR* kCmdLine =
-      _T("goopdate.exe /handoff ") YOUTUBEUPLOADEREN_TAG
-      _T(" /sessionid \"{756dfdc2-0ef0-44b7-bfb1-21a4be6a1213}\"");
-
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_HANDOFF_INSTALL;
-  expected_.session_id = _T("{756dfdc2-0ef0-44b7-bfb1-21a4be6a1213}");
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, true);
-}
-
-// Parse: <path> /ug
-TEST_F(CommandLineTest, ParseCommandLine_LegacyOmaha2Ug) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /ug");
-  EXPECT_FAILED(ParseCommandLine(kCmdLine, &args_));
-}
-
-// Parse: <path> /ua
-TEST_F(CommandLineTest, ParseCommandLine_UaNoInstallSource) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /ua");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_UA;
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path> /ua /installsource core
-TEST_F(CommandLineTest, ParseCommandLine_Ua) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /ua /installsource core");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_UA;
-  expected_.install_source = _T("core");
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path> /update
-TEST_F(CommandLineTest, ParseCommandLine_Update) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /update");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_UPDATE;
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path> /update /sessionid "guid"
-TEST_F(CommandLineTest, ParseCommandLine_UpdateSessionId) {
-  const TCHAR* kCmdLine =
-      _T("goopdate.exe /update");
-      _T(" /sessionid \"{756dfdc2-0ef0-44b7-bfb1-21a4be6a1213}\"");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_UPDATE;
-  expected_.session_id = _T("{756dfdc2-0ef0-44b7-bfb1-21a4be6a1213}");
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path> /netdiags
-TEST_F(CommandLineTest, ParseCommandLine_NetDiags) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /netdiags");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_NETDIAGS;
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path> /regserver
-TEST_F(CommandLineTest, ParseCommandLine_Regserver) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /regserver");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_REGSERVER;
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path> /unregserver
-TEST_F(CommandLineTest, ParseCommandLine_Unregserver) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /unregserver");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_UNREGSERVER;
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path> /registerproduct
-TEST_F(CommandLineTest, ParseCommandLine_RegisterProduct) {
-  const TCHAR* kCmdLine =
-      _T("goopdate.exe /registerproduct ")
-      _T("\"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-      _T("appname=YouTubeUploader&needsadmin=False\"");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_REGISTER_PRODUCT;
-  expected_.extra_args_str = _T("appguid=")
-                             _T("{A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-                             _T("appname=YouTubeUploader&needsadmin=False");
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, false);
-}
-
-// Parse: <path> /registerproduct /installsource enterprisemsi
-TEST_F(CommandLineTest, ParseCommandLine_RegisterProductWithInstallSource) {
-  const TCHAR* kCmdLine =
-      _T("goopdate.exe /registerproduct ")
-      _T("\"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-      _T("appname=YouTubeUploader&needsadmin=False\"")
-      _T(" /installsource enterprisemsi");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-  expected_.mode = COMMANDLINE_MODE_REGISTER_PRODUCT;
-  expected_.install_source = _T("enterprisemsi");
-  expected_.extra_args_str = _T("appguid=")
-                             _T("{A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-                             _T("appname=YouTubeUploader&needsadmin=False");
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, false);
-}
-
-// Parse: <path> /unregisterproduct
-TEST_F(CommandLineTest, ParseCommandLine_UnregisterProduct) {
-  const TCHAR* kCmdLine =
-      _T("goopdate.exe /unregisterproduct ")
-      _T("\"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-      _T("appname=YouTubeUploader&needsadmin=False\"");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_UNREGISTER_PRODUCT;
-  expected_.extra_args_str = _T("appguid=")
-                             _T("{A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-                             _T("appname=YouTubeUploader&needsadmin=False");
-  VerifyArgsWithSingleYouTubeUploaderEnApp(expected_, args_, false, false);
-}
-
-// Parse: <path> /c
-TEST_F(CommandLineTest, ParseCommandLine_Core) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /c");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_CORE;
-  expected_.is_crash_handler_disabled = false;
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path> /c /nocrashserver
-TEST_F(CommandLineTest, ParseCommandLine_CoreNoCrashHandler) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /c /nocrashserver");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_CORE;
-  expected_.is_crash_handler_disabled = true;
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path> /crash
-TEST_F(CommandLineTest, ParseCommandLine_Crash) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /crash");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_CRASH;
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path> /report crash_file
-TEST_F(CommandLineTest, ParseCommandLine_Report) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /report C:\\foo\\crash.dmp");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_REPORTCRASH;
-  expected_.crash_filename = _T("C:\\foo\\crash.dmp");
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path> /report crash_file /machine
-TEST_F(CommandLineTest, ParseCommandLine_ReportMachine) {
-  const TCHAR* kCmdLine =
-      _T("goopdate.exe /report C:\\foo\\crash.dmp /machine");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_REPORTCRASH;
-  expected_.crash_filename = _T("C:\\foo\\crash.dmp");
-  expected_.is_machine_set = true;
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path> /report crash_file
-TEST_F(CommandLineTest, ParseCommandLine_ReportWithCustomInfo) {
-  const TCHAR* kCmdLine =
-    _T("goopdate.exe /report C:\\foo.dmp /custom_info_filename C:\\foo.txt");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_REPORTCRASH;
-  expected_.crash_filename = _T("C:\\foo.dmp");
-  expected_.custom_info_filename = _T("C:\\foo.txt");
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path> /report /i crash_file
-TEST_F(CommandLineTest, ParseCommandLine_ReportInteractive) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /report /i C:\\foo\\crash.dmp");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_REPORTCRASH;
-  expected_.is_interactive_set = true;
-  expected_.crash_filename = _T("C:\\foo\\crash.dmp");
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path> /report /i crash_file /machine
-TEST_F(CommandLineTest, ParseCommandLine_ReportMachineInteractive) {
-  const TCHAR*
-      kCmdLine = _T("goopdate.exe /report /i C:\\foo\\crash.dmp /machine");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_REPORTCRASH;
-  expected_.is_machine_set = true;
-  expected_.is_interactive_set = true;
-  expected_.crash_filename = _T("C:\\foo\\crash.dmp");
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-TEST_F(CommandLineTest, ParseCommandLine_CodeRedCheck) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /cr");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_CODE_RED_CHECK;
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-TEST_F(CommandLineTest, ParseCommandLine_WebPlugin) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /pi \"http://gears.google.com/\" ")
-                          _T("\"/install foo\" /installsource oneclick ");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_WEBPLUGIN;
-  expected_.webplugin_urldomain = _T("http://gears.google.com/");
-  expected_.webplugin_args = _T("/install foo");
-  expected_.install_source = _T("oneclick");
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-TEST_F(CommandLineTest, ParseCommandLine_WebPluginUrlEscaped) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /pi \"http://gears.google.com/\" ")
-                          _T("\"/install%20foo\" /installsource oneclick ");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_WEBPLUGIN;
-  expected_.webplugin_urldomain = _T("http://gears.google.com/");
-  expected_.webplugin_args = _T("/install foo");
-  expected_.install_source = _T("oneclick");
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-TEST_F(CommandLineTest, ParseCommandLine_WebPluginTestStringTrim) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /pi ")
-                          _T("\"  http://gears.google.com/   \"  ")
-                          _T("\"/install foo\" /installsource oneclick ");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_WEBPLUGIN;
-  expected_.webplugin_urldomain = _T("http://gears.google.com/");
-  expected_.webplugin_args = _T("/install foo");
-  expected_.install_source = _T("oneclick");
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-TEST_F(CommandLineTest, ParseCommandLine_LegacyOmaha1UiNoLanguage) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /ui \"manifestfilename.xml\"");
-  EXPECT_FAILED(ParseCommandLine(kCmdLine, &args_));
-}
-
-TEST_F(CommandLineTest, ParseCommandLine_LegacyOmaha1UiWithLanguage) {
-  const TCHAR* kCmdLine =
-      _T("goopdate.exe /ui /lang fr \"manifestfilename.xml\"");
-  EXPECT_FAILED(ParseCommandLine(kCmdLine, &args_));
-}
-
-TEST_F(CommandLineTest, ParseCommandLine_LegacyOmaha1UiUser) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /uiuser file.gup");
-  EXPECT_FAILED(ParseCommandLine(kCmdLine, &args_));
-}
-
-TEST_F(CommandLineTest, ParseCommandLine_Recover) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /recover repairfile.exe");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_RECOVER;
-  expected_.code_red_metainstaller_path = _T("repairfile.exe");
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-TEST_F(CommandLineTest, ParseCommandLine_RecoverMachine) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /recover /machine repfile.exe");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_RECOVER;
-  expected_.is_machine_set = true;
-  expected_.code_red_metainstaller_path = _T("repfile.exe");
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path> /uninstall
-TEST_F(CommandLineTest, ParseCommandLine_Uninstall) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /uninstall");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_UNINSTALL;
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-// Parse: <path> /ping foo
-TEST_F(CommandLineTest, ParseCommandLine_Ping) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /ping foo");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_PING;
-  expected_.ping_string = _T("foo");
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-//
-// These are additional failure cases against the command line parsing.
-// Everything from here on down should fail ParseCommandLine().
-//
-
-
-// Parse: <path> manifest_file
-TEST_F(CommandLineTest, ParseCommandLine_GoopdateJustArg) {
-  const TCHAR* kCmdLine = _T("goopdate.exe \"foo bar\"");
-  ExpectAsserts expect_asserts;
-  EXPECT_FAILED(ParseCommandLine(kCmdLine, &args_));
-}
-
-// Parse: <path> /install manifest_file manifest_file
-// Fails since this is an invalid command line set.
-TEST_F(CommandLineTest, ParseCommandLine_Invalid) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /install \"foo bar\" foobar");
-  EXPECT_FAILED(ParseCommandLine(kCmdLine, &args_));
-}
-
-// Parse: <path> /recover
-TEST_F(CommandLineTest, Recover_WithoutFile) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /recover");
-  EXPECT_FAILED(ParseCommandLine(kCmdLine, &args_));
-}
-
-// Parse: <path> /machine
-TEST_F(CommandLineTest, MachineWithoutRecover) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /machine");
-  EXPECT_FAILED(ParseCommandLine(kCmdLine, &args_));
-}
-
-TEST_F(CommandLineTest, ExtraArgsHasDoubleQuoteInTheMiddle) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /install \"some_\"file\"");
-  EXPECT_FAILED(ParseCommandLine(kCmdLine, &args_));
-}
-
-TEST_F(CommandLineTest, CommandsNotSeparatedBySpaces) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /recover/machine");
-  EXPECT_FAILED(ParseCommandLine(kCmdLine, &args_));
-}
-
-TEST_F(CommandLineTest, CommandsDoNotHaveForwardSlashes) {
-  const TCHAR* kCmdLine = _T("goopdate.exe recover machine");
-  ExpectAsserts expect_asserts;
-  EXPECT_FAILED(ParseCommandLine(kCmdLine, &args_));
-}
-
-TEST_F(CommandLineTest, UnknownParameter) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /someunknowncommand");
-  EXPECT_FAILED(ParseCommandLine(kCmdLine, &args_));
-}
-
-TEST_F(CommandLineTest, UiWithLangNoLanguage) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /ui /lang \"manifestfilename.xml\"");
-  EXPECT_FAILED(ParseCommandLine(kCmdLine, &args_));
-}
-
-TEST_F(CommandLineTest, WebPluginInstallSourceInvalid_IncorrectValue) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /installsource invalid /pi ")
-                          _T("\"  http://gears.google.com/   \"  ");
-  EXPECT_FAILED(ParseCommandLine(kCmdLine, &args_));
-}
-
-TEST_F(CommandLineTest, WebPluginInstallSourceInvalid_Empty) {
-  const TCHAR* kCmdLine = _T("goopdate.exe /installsource /pi ")
-                          _T("\"  http://gears.google.com/   \"  ");
-  EXPECT_FAILED(ParseCommandLine(kCmdLine, &args_));
-}
-
-// Parse: <path> /handoff "extraargs" /lang "en"
-TEST_F(CommandLineTest, ParseCommandLine_HandoffLegacyOmaha1ToOmaha2) {
-  const TCHAR* kCmdLine =
-      _T("goopdate.exe /handoff ")
-      _T("\"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-      _T("appname=YouTubeUploader&needsadmin=False\"")
-      _T(" /lang en");
-  EXPECT_FAILED(ParseCommandLine(kCmdLine, &args_));
-}
-
-// Parse: <path> /handoff "extraargs" /installsource "asd" /lang "en"
-TEST_F(CommandLineTest,
-       ParseCommandLine_HandoffWithSourceLegacyOmaha1ToOmaha2) {
-  const TCHAR* kCmdLine =
-      _T("goopdate.exe /handoff ")
-      _T("\"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-      _T("appname=YouTubeUploader&needsadmin=False\"")
-      _T(" /installsource oneclick /lang en");
-  EXPECT_FAILED(ParseCommandLine(kCmdLine, &args_));
-}
-
-// Parse: <path> /handoff "extraargs" /installsource "oneclick" /lang "en"
-TEST_F(CommandLineTest,
-       ParseCommandLine_HandoffWithSourceLegacyOmaha1ToOmaha2Both) {
-  const TCHAR* kCmdLine =
-      _T("goopdate.exe /handoff ")
-      _T("\"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-      _T("appname=YouTubeUploader&needsadmin=False&lang=en\"")
-      _T(" /installsource oneclick /lang en");
-  EXPECT_FAILED(ParseCommandLine(kCmdLine, &args_));
-}
-
-// Parse: <path> /install "extraargs" /lang en
-TEST_F(CommandLineTest, ParseCommandLine_InstallLegacyOmaha1) {
-  const TCHAR* kCmdLine =
-      _T("goopdate.exe /install ")
-      _T("\"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-      _T("appname=YouTubeUploader&needsadmin=False&")
-      _T("appguid={C7A9A2F5-C4F9-42d3-8A8B-55086A205468}&")
-      _T("appname=TestApp&needsadmin=true\" /lang en");
-  EXPECT_FAILED(ParseCommandLine(kCmdLine, &args_));
-}
-
-// Parse: <path> /install "extraargs" /installsource oneclick /lang en
-TEST_F(CommandLineTest, ParseCommandLine_InstallWithSourceLegacyOmaha1) {
-  const TCHAR* kCmdLine =
-      _T("goopdate.exe /install ")
-      _T("\"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-      _T("appname=YouTubeUploader&needsadmin=False\"")
-      _T(" /installsource oneclick /lang en");
-  EXPECT_FAILED(ParseCommandLine(kCmdLine, &args_));
-}
-
-TEST_F(CommandLineTest, ParseCommandLine_NeedsAdmin_Prefers) {
-  const TCHAR* kCmdLine =
-      _T("goopdate.exe /install ")
-      _T("\"bundlename=My%20Bundle&")
-      _T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-      _T("appname=YouTubeUploader&needsadmin=Prefers&\"");
-  EXPECT_SUCCEEDED(ParseCommandLine(kCmdLine, &args_));
-
-  expected_.mode = COMMANDLINE_MODE_INSTALL;
-
-  expected_.extra_args_str = _T("bundlename=My%20Bundle&appguid=")
-                             _T("{A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
-                             _T("appname=YouTubeUploader&needsadmin=Prefers&");
-  CommandLineAppArgs app_args;
-  const GUID expected_guid = {0xA4F7B07B, 0xB9BD, 0x4A33,
-                              {0xB1, 0x36, 0x96, 0xD2, 0xAD, 0xFB, 0x60, 0xCB}};
-  app_args.app_guid = expected_guid;
-  app_args.app_name = _T("YouTubeUploader");
-  app_args.needs_admin = NEEDS_ADMIN_PREFERS;
-  expected_.extra.apps.push_back(app_args);
-
-  expected_.extra.bundle_name = _T("My Bundle");
-
-  VerifyCommandLineArgs(expected_, args_);
-}
-
-}  // namespace omaha
diff --git a/common/config_manager.cc b/common/config_manager.cc
deleted file mode 100644
index 7524539..0000000
--- a/common/config_manager.cc
+++ /dev/null
@@ -1,817 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/common/config_manager.h"
-#include <lm.h>
-#include <shlobj.h>
-#include <shlwapi.h>
-#include <wininet.h>
-#include <atlstr.h>
-#include <atlsecurity.h>
-#include <math.h>
-#include "omaha/base/app_util.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/const_addresses.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/string.h"
-#include "omaha/base/time.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/app_registry_utils.h"
-#include "omaha/common/const_group_policy.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/oem_install_utils.h"
-
-namespace omaha {
-
-namespace {
-
-HRESULT GetDir(int csidl,
-               const CString& path_tail,
-               bool create_dir,
-               CString* dir) {
-  ASSERT1(dir);
-
-  CString path;
-  HRESULT hr = GetFolderPath(csidl | CSIDL_FLAG_DONT_VERIFY, &path);
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("GetDir failed to find path][%d][0x%08x]"), csidl, hr));
-    return hr;
-  }
-  if (!::PathAppend(CStrBuf(path, MAX_PATH), path_tail)) {
-    CORE_LOG(LW, (_T("GetDir failed to append path][%s][%s]"), path, path_tail));
-    return GOOPDATE_E_PATH_APPEND_FAILED;
-  }
-  dir->SetString(path);
-
-  // Try to create the directory. Continue if the directory can't be created.
-  if (create_dir) {
-    hr = CreateDir(path, NULL);
-    if (FAILED(hr)) {
-      CORE_LOG(LW, (_T("[GetDir failed to create dir][%s][0x%08x]"), path, hr));
-    }
-  }
-  return S_OK;
-}
-
-// The app-specific value overrides the disable all value so read the former
-// first. If it doesn't exist, read the "disable all" value.
-bool GetEffectivePolicyForApp(const TCHAR* apps_default_value_name,
-                              const TCHAR* app_prefix_name,
-                              const GUID& app_guid,
-                              DWORD* effective_policy) {
-  ASSERT1(apps_default_value_name);
-  ASSERT1(app_prefix_name);
-  ASSERT1(effective_policy);
-
-  CString app_value_name(app_prefix_name);
-  app_value_name.Append(GuidToString(app_guid));
-
-  HRESULT hr = RegKey::GetValue(kRegKeyGoopdateGroupPolicy,
-                                app_value_name,
-                                effective_policy);
-  if (SUCCEEDED(hr)) {
-    return true;
-  } else {
-    CORE_LOG(L4, (_T("[Failed to read Group Policy value][%s]"),
-                  app_value_name));
-  }
-
-  hr = RegKey::GetValue(kRegKeyGoopdateGroupPolicy,
-                        apps_default_value_name,
-                        effective_policy);
-  if (SUCCEEDED(hr)) {
-    return true;
-  } else {
-    CORE_LOG(L4, (_T("[Failed to read Group Policy value][%s]"),
-                  apps_default_value_name));
-  }
-
-  return false;
-}
-
-// Gets the raw update check period override value in seconds from the registry.
-// The value must be processed for limits and overflow before using.
-// Checks UpdateDev and Group Policy.
-// Returns true if either override was successefully read.
-bool GetLastCheckPeriodSecFromRegistry(DWORD* period_sec) {
-  ASSERT1(period_sec);
-
-  DWORD update_dev_sec = 0;
-  if (SUCCEEDED(RegKey::GetValue(MACHINE_REG_UPDATE_DEV,
-                                 kRegValueLastCheckPeriodSec,
-                                 &update_dev_sec))) {
-    CORE_LOG(L5, (_T("['LastCheckPeriodSec' override %d]"), update_dev_sec));
-    *period_sec = update_dev_sec;
-    return true;
-  }
-
-  DWORD group_policy_minutes = 0;
-  if (SUCCEEDED(RegKey::GetValue(kRegKeyGoopdateGroupPolicy,
-                                 kRegValueAutoUpdateCheckPeriodOverrideMinutes,
-                                 &group_policy_minutes))) {
-    CORE_LOG(L5, (_T("[Group Policy check period override %d]"),
-                  group_policy_minutes));
-
-
-    *period_sec = (group_policy_minutes > UINT_MAX / 60) ?
-                  UINT_MAX :
-                  group_policy_minutes * 60;
-
-    return true;
-  }
-
-  return false;
-}
-
-}  // namespace
-
-LLock ConfigManager::lock_;
-ConfigManager* ConfigManager::config_manager_ = NULL;
-
-ConfigManager* ConfigManager::Instance() {
-  __mutexScope(lock_);
-  if (!config_manager_) {
-    config_manager_ = new ConfigManager();
-  }
-  return config_manager_;
-}
-
-void ConfigManager::DeleteInstance() {
-  delete config_manager_;
-}
-
-ConfigManager::ConfigManager() {
-  CString current_module_directory(app_util::GetCurrentModuleDirectory());
-
-  CString path;
-  HRESULT hr = GetDir(CSIDL_LOCAL_APPDATA,
-                      CString(OMAHA_REL_GOOPDATE_INSTALL_DIR),
-                      false,
-                      &path);
-
-  is_running_from_official_user_dir_ =
-      SUCCEEDED(hr) ? (String_StrNCmp(path,
-                                      current_module_directory,
-                                      path.GetLength(),
-                                      true) == 0) :
-                      false;
-
-  hr = GetDir(CSIDL_PROGRAM_FILES,
-              CString(OMAHA_REL_GOOPDATE_INSTALL_DIR),
-              false,
-              &path);
-
-  is_running_from_official_machine_dir_ =
-      SUCCEEDED(hr) ? (String_StrNCmp(path,
-                                      current_module_directory,
-                                      path.GetLength(),
-                                      true) == 0) :
-                      false;
-}
-
-CString ConfigManager::GetUserDownloadStorageDir() const {
-  CString path;
-  VERIFY1(SUCCEEDED(GetDir(CSIDL_LOCAL_APPDATA,
-                           CString(OMAHA_REL_DOWNLOAD_STORAGE_DIR),
-                           true,
-                           &path)));
-  return path;
-}
-
-CString ConfigManager::GetUserInstallWorkingDir() const {
-  CString path;
-  VERIFY1(SUCCEEDED(GetDir(CSIDL_LOCAL_APPDATA,
-                           CString(OMAHA_REL_INSTALL_WORKING_DIR),
-                           true,
-                           &path)));
-  return path;
-}
-
-CString ConfigManager::GetUserOfflineStorageDir() const {
-  CString path;
-  VERIFY1(SUCCEEDED(GetDir(CSIDL_LOCAL_APPDATA,
-                           CString(OMAHA_REL_OFFLINE_STORAGE_DIR),
-                           true,
-                           &path)));
-  return path;
-}
-
-CString ConfigManager::GetUserGoopdateInstallDirNoCreate() const {
-  CString path;
-  VERIFY1(SUCCEEDED(GetDir(CSIDL_LOCAL_APPDATA,
-                           CString(OMAHA_REL_GOOPDATE_INSTALL_DIR),
-                           false,
-                           &path)));
-  return path;
-}
-
-CString ConfigManager::GetUserGoopdateInstallDir() const {
-  CString path;
-  VERIFY1(SUCCEEDED(GetDir(CSIDL_LOCAL_APPDATA,
-                           CString(OMAHA_REL_GOOPDATE_INSTALL_DIR),
-                           true,
-                           &path)));
-  return path;
-}
-
-bool ConfigManager::IsRunningFromUserGoopdateInstallDir() const {
-  return is_running_from_official_user_dir_;
-}
-
-CString ConfigManager::GetUserCrashReportsDir() const {
-  CString path;
-  VERIFY1(SUCCEEDED(GetDir(CSIDL_LOCAL_APPDATA,
-                           CString(OMAHA_REL_CRASH_DIR),
-                           true,
-                           &path)));
-  return path;
-}
-
-CString ConfigManager::GetMachineCrashReportsDir() const {
-  CString path;
-  VERIFY1(SUCCEEDED(GetDir(CSIDL_PROGRAM_FILES,
-                           CString(OMAHA_REL_CRASH_DIR),
-                           true,
-                           &path)));
-  return path;
-}
-
-CString ConfigManager::GetMachineSecureDownloadStorageDir() const {
-  CString path;
-  VERIFY1(SUCCEEDED(GetDir(CSIDL_PROGRAM_FILES,
-                           CString(OMAHA_REL_DOWNLOAD_STORAGE_DIR),
-                           true,
-                           &path)));
-  return path;
-}
-
-CString ConfigManager::GetMachineInstallWorkingDir() const {
-  CString path;
-  VERIFY1(SUCCEEDED(GetDir(CSIDL_PROGRAM_FILES,
-                           CString(OMAHA_REL_INSTALL_WORKING_DIR),
-                           true,
-                           &path)));
-  return path;
-}
-
-CString ConfigManager::GetMachineSecureOfflineStorageDir() const {
-  CString path;
-  VERIFY1(SUCCEEDED(GetDir(CSIDL_PROGRAM_FILES,
-                           CString(OMAHA_REL_OFFLINE_STORAGE_DIR),
-                           true,
-                           &path)));
-  return path;
-}
-
-CString ConfigManager::GetTempDownloadDir() const {
-  CString temp_download_dir(app_util::GetTempDirForImpersonatedOrCurrentUser());
-  ASSERT1(temp_download_dir);
-  HRESULT hr = CreateDir(temp_download_dir, NULL);
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[GetDir failed to create dir][%s][0x%08x]"),
-        temp_download_dir, hr));
-  }
-  return temp_download_dir;
-}
-
-int ConfigManager::GetPackageCacheSizeLimitMBytes() const {
-  DWORD kDefaultCacheStorageLimit = 500;  // 500 MB
-  DWORD kMaxCacheStorageLimit = 5000;     // 5 GB
-
-  DWORD cache_size_limit = 0;
-  if (FAILED(RegKey::GetValue(kRegKeyGoopdateGroupPolicy,
-                              kRegValueCacheSizeLimitMBytes,
-                              &cache_size_limit)) ||
-      cache_size_limit > kMaxCacheStorageLimit ||
-      cache_size_limit == 0) {
-    cache_size_limit = kDefaultCacheStorageLimit;
-  }
-
-  return static_cast<int>(cache_size_limit);
-}
-
-int ConfigManager::GetPackageCacheExpirationTimeDays() const {
-  DWORD kDefaultCacheLifeTimeInDays = 180;  // 180 days.
-  DWORD kMaxCacheLifeTimeInDays = 1800;     // Roughly 5 years.
-
-  DWORD cache_life_limit = 0;
-  if (FAILED(RegKey::GetValue(kRegKeyGoopdateGroupPolicy,
-                              kRegValueCacheLifeLimitDays,
-                              &cache_life_limit)) ||
-      cache_life_limit > kMaxCacheLifeTimeInDays ||
-      cache_life_limit == 0) {
-    cache_life_limit = kDefaultCacheLifeTimeInDays;
-  }
-
-  return static_cast<int>(cache_life_limit);
-}
-
-CString ConfigManager::GetMachineGoopdateInstallDirNoCreate() const {
-  CString path;
-  VERIFY1(SUCCEEDED(GetDir(CSIDL_PROGRAM_FILES,
-                           CString(OMAHA_REL_GOOPDATE_INSTALL_DIR),
-                           false,
-                           &path)));
-  return path;
-}
-
-CString ConfigManager::GetMachineGoopdateInstallDir() const {
-  CString path;
-  VERIFY1(SUCCEEDED(GetDir(CSIDL_PROGRAM_FILES,
-                           CString(OMAHA_REL_GOOPDATE_INSTALL_DIR),
-                           true,
-                           &path)));
-  return path;
-}
-
-bool ConfigManager::IsRunningFromMachineGoopdateInstallDir() const {
-  return is_running_from_official_machine_dir_;
-}
-
-HRESULT ConfigManager::GetPingUrl(CString* url) const {
-  ASSERT1(url);
-
-  if (SUCCEEDED(RegKey::GetValue(MACHINE_REG_UPDATE_DEV,
-                                 kRegValueNamePingUrl,
-                                 url))) {
-    CORE_LOG(L5, (_T("['ping url' override %s]"), *url));
-    return S_OK;
-  }
-
-  *url = kUrlPing;
-  return S_OK;
-}
-
-HRESULT ConfigManager::GetUpdateCheckUrl(CString* url) const {
-  ASSERT1(url);
-
-  if (SUCCEEDED(RegKey::GetValue(MACHINE_REG_UPDATE_DEV,
-                                 kRegValueNameUrl,
-                                 url))) {
-    CORE_LOG(L5, (_T("['update check url' override %s]"), *url));
-    return S_OK;
-  }
-
-  *url = kUrlUpdateCheck;
-  return S_OK;
-}
-
-HRESULT ConfigManager::GetCrashReportUrl(CString* url) const {
-  ASSERT1(url);
-
-  if (SUCCEEDED(RegKey::GetValue(MACHINE_REG_UPDATE_DEV,
-                                 kRegValueNameCrashReportUrl,
-                                 url))) {
-    CORE_LOG(L5, (_T("['crash report url' override %s]"), *url));
-    return S_OK;
-  }
-
-  *url = kUrlCrashReport;
-  return S_OK;
-}
-
-HRESULT ConfigManager::GetMoreInfoUrl(CString* url) const {
-  ASSERT1(url);
-
-  if (SUCCEEDED(RegKey::GetValue(MACHINE_REG_UPDATE_DEV,
-                                 kRegValueNameGetMoreInfoUrl,
-                                 url))) {
-    CORE_LOG(L5, (_T("['more info url' override %s]"), *url));
-    return S_OK;
-  }
-
-  *url = kUrlMoreInfo;
-  return S_OK;
-}
-
-HRESULT ConfigManager::GetUsageStatsReportUrl(CString* url) const {
-  ASSERT1(url);
-
-  if (SUCCEEDED(RegKey::GetValue(MACHINE_REG_UPDATE_DEV,
-                                 kRegValueNameUsageStatsReportUrl,
-                                 url))) {
-    CORE_LOG(L5, (_T("['usage stats report url' override %s]"), *url));
-    return S_OK;
-  }
-
-  *url = kUrlUsageStatsReport;
-  return S_OK;
-}
-
-// Returns the override from the registry locations if present. Otherwise,
-// returns the default value.
-// Default value is different value for internal users to make update checks
-// more aggresive.
-// Ensures returned value is between kMinLastCheckPeriodSec and INT_MAX except
-// when the override is 0, which indicates updates are disabled.
-int ConfigManager::GetLastCheckPeriodSec(bool* is_overridden) const {
-  ASSERT1(is_overridden);
-  DWORD registry_period_sec = 0;
-  *is_overridden = GetLastCheckPeriodSecFromRegistry(&registry_period_sec);
-  if (*is_overridden) {
-    if (0 == registry_period_sec) {
-      return 0;
-    }
-    const int period_sec = registry_period_sec > INT_MAX ?
-                           INT_MAX :
-                           static_cast<int>(registry_period_sec);
-
-    if (period_sec < kMinLastCheckPeriodSec) {
-      return kMinLastCheckPeriodSec;
-    }
-    return period_sec;
-  }
-
-  // Returns a lower value for internal users.
-  if (IsInternalUser()) {
-    return kLastCheckPeriodInternalUserSec;
-  }
-
-  return kLastCheckPeriodSec;
-}
-
-// All time values are in seconds.
-int ConfigManager::GetTimeSinceLastCheckedSec(bool is_machine) const {
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-  const uint32 last_checked = GetLastCheckedTime(is_machine);
-  if (now < last_checked) {
-    CORE_LOG(LW, (_T("[possible time warp detected]")
-                  _T("[now %u][last checked %u]"), now, last_checked));
-  }
-  const int time_difference = abs(static_cast<int>(now - last_checked));
-  bool is_period_overridden = false;
-  CORE_LOG(L3, (_T("[now %u][last checked %u][update interval %u]")
-                _T("[time difference %u]"),
-                now, last_checked, GetLastCheckPeriodSec(&is_period_overridden),
-                time_difference));
-  return time_difference;
-}
-
-DWORD ConfigManager::GetLastCheckedTime(bool is_machine) const {
-  const TCHAR* reg_update_key = is_machine ? MACHINE_REG_UPDATE:
-                                             USER_REG_UPDATE;
-  DWORD last_checked_time = 0;
-  if (SUCCEEDED(RegKey::GetValue(reg_update_key,
-                                 kRegValueLastChecked,
-                                 &last_checked_time))) {
-    return last_checked_time;
-  }
-  return 0;
-}
-
-HRESULT ConfigManager::SetLastCheckedTime(bool is_machine, DWORD time) const {
-  const TCHAR* reg_update_key = is_machine ? MACHINE_REG_UPDATE:
-                                             USER_REG_UPDATE;
-  return RegKey::SetValue(reg_update_key, kRegValueLastChecked, time);
-}
-
-DWORD ConfigManager::GetInstallTime(bool is_machine) {
-  const CString client_state_key_name =
-      ConfigManager::Instance()->registry_client_state_goopdate(is_machine);
-  DWORD update_time(0);
-  if (SUCCEEDED(RegKey::GetValue(client_state_key_name,
-                                 kRegValueLastUpdateTimeSec,
-                                 &update_time))) {
-    return update_time;
-  }
-
-  DWORD install_time(0);
-  if (SUCCEEDED(RegKey::GetValue(client_state_key_name,
-                                 kRegValueInstallTimeSec,
-                                 &install_time))) {
-    return install_time;
-  }
-
-  return 0;
-}
-
-bool ConfigManager::Is24HoursSinceInstall(bool is_machine) {
-  const int kDaySec = 24 * 60 * 60;
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  const uint32 install_time = GetInstallTime(is_machine);
-  if (now < install_time) {
-    CORE_LOG(LW, (_T("[Incorrect clock time detected]")
-                  _T("[now %u][install_time %u]"), now, install_time));
-  }
-  const int time_difference = abs(static_cast<int>(now - install_time));
-  return time_difference >= kDaySec;
-}
-
-// Uses app_registry_utils because this needs to be called in the server and
-// client and it is a best effort so locking isn't necessary.
-bool ConfigManager::CanCollectStats(bool is_machine) const {
-  if (RegKey::HasValue(MACHINE_REG_UPDATE_DEV, kRegValueForceUsageStats)) {
-    return true;
-  }
-
-  // TODO(omaha): This should actually be iterating over registered products
-  // rather than present ClientState keys. These are identical in most cases.
-  const TCHAR* state_key_name = registry_client_state(is_machine);
-
-  RegKey state_key;
-  HRESULT hr = state_key.Open(state_key_name, KEY_READ);
-  if (FAILED(hr)) {
-    return false;
-  }
-
-  int num_sub_keys = state_key.GetSubkeyCount();
-  for (int i = 0; i < num_sub_keys; ++i) {
-    CString sub_key_name;
-    if (FAILED(state_key.GetSubkeyNameAt(i, &sub_key_name))) {
-      continue;
-    }
-
-    if (app_registry_utils::AreAppUsageStatsEnabled(is_machine, sub_key_name)) {
-      return true;
-    }
-  }
-
-  return false;
-}
-
-// Overrides OverInstall in debug builds.
-bool ConfigManager::CanOverInstall() const {
-#ifdef DEBUG
-  DWORD value = 0;
-  if (SUCCEEDED(RegKey::GetValue(MACHINE_REG_UPDATE_DEV,
-                                 kRegValueNameOverInstall,
-                                 &value))) {
-    CORE_LOG(L5, (_T("['OverInstall' override %d]"), value));
-    return value != 0;
-  }
-#endif
-  return !OFFICIAL_BUILD;
-}
-
-// Overrides AuCheckPeriodMs. Implements a lower bound value. Returns INT_MAX
-// if the registry value exceeds INT_MAX.
-int ConfigManager::GetAutoUpdateTimerIntervalMs() const {
-  DWORD interval(0);
-  if (SUCCEEDED(RegKey::GetValue(MACHINE_REG_UPDATE_DEV,
-                                 kRegValueAuCheckPeriodMs,
-                                 &interval))) {
-    int ret_val = 0;
-    if (interval > INT_MAX) {
-      ret_val = INT_MAX;
-    } else if (interval < kMinAUCheckPeriodMs) {
-      ret_val = kMinAUCheckPeriodMs;
-    } else {
-      ret_val = interval;
-    }
-    ASSERT1(ret_val >= kMinAUCheckPeriodMs);
-    CORE_LOG(L5, (_T("['AuCheckPeriodMs' override %d]"), interval));
-    return ret_val;
-  }
-
-  // Returns a lower value for internal users.
-  if (IsInternalUser()) {
-    return kAUCheckPeriodInternalUserMs;
-  }
-
-  return kAUCheckPeriodMs;
-}
-
-int ConfigManager::GetUpdateWorkerStartUpDelayMs() const {
-  int au_timer_interval_ms = GetAutoUpdateTimerIntervalMs();
-
-  // If the AuCheckPeriod is overriden then use that as the delay.
-  if (RegKey::HasValue(MACHINE_REG_UPDATE_DEV, kRegValueAuCheckPeriodMs)) {
-    return au_timer_interval_ms;
-  }
-
-  int random_delay = 0;
-  if (!GenRandom(&random_delay, sizeof(random_delay))) {
-    return au_timer_interval_ms;
-  }
-
-  // Scale the au_check_period number to be between
-  // kUpdateTimerStartupDelayMinMs and kUpdateTimerStartupDelayMaxMs.
-  int scale = kUpdateTimerStartupDelayMaxMs - kUpdateTimerStartupDelayMinMs;
-  ASSERT1(scale >= 0);
-
-  int random_addition = abs(random_delay) % scale;
-  ASSERT1(random_addition < scale);
-
-  au_timer_interval_ms = kUpdateTimerStartupDelayMinMs + random_addition;
-  ASSERT1(au_timer_interval_ms >= kUpdateTimerStartupDelayMinMs &&
-          au_timer_interval_ms <= kUpdateTimerStartupDelayMaxMs);
-
-  return au_timer_interval_ms;
-}
-
-// Overrides CodeRedCheckPeriodMs. Implements a lower bound value. Returns
-// INT_MAX if the registry value exceeds INT_MAX.
-int ConfigManager::GetCodeRedTimerIntervalMs() const {
-  DWORD interval(0);
-  if (SUCCEEDED(RegKey::GetValue(MACHINE_REG_UPDATE_DEV,
-                                 kRegValueCrCheckPeriodMs,
-                                 &interval))) {
-    int ret_val = 0;
-    if (interval > INT_MAX) {
-      ret_val = INT_MAX;
-    } else if (interval < kMinCodeRedCheckPeriodMs) {
-      ret_val = kMinCodeRedCheckPeriodMs;
-    } else {
-      ret_val = interval;
-    }
-    ASSERT1(ret_val >= kMinCodeRedCheckPeriodMs);
-    CORE_LOG(L5, (_T("['CrCheckPeriodMs' override %d]"), interval));
-    return ret_val;
-  }
-  return kCodeRedCheckPeriodMs;
-}
-
-// Returns true if logging is enabled for the event type.
-// Logging of errors and warnings is enabled by default.
-bool ConfigManager::CanLogEvents(WORD event_type) const {
-  const TCHAR* reg_update_key = MACHINE_REG_UPDATE_DEV;
-  DWORD log_events_level = LOG_EVENT_LEVEL_NONE;
-  if (SUCCEEDED(RegKey::GetValue(reg_update_key,
-                                 kRegValueEventLogLevel,
-                                 &log_events_level))) {
-    switch (log_events_level) {
-      case LOG_EVENT_LEVEL_ALL:
-        return true;
-      case LOG_EVENT_LEVEL_WARN_AND_ERROR:
-        return event_type == EVENTLOG_ERROR_TYPE ||
-               event_type == EVENTLOG_WARNING_TYPE;
-      case LOG_EVENT_LEVEL_NONE:
-      default:
-        return false;
-    }
-  }
-
-  return event_type == EVENTLOG_ERROR_TYPE ||
-         event_type == EVENTLOG_WARNING_TYPE;
-}
-
-CString ConfigManager::GetTestSource() const {
-  CString test_source;
-  HRESULT hr = RegKey::GetValue(MACHINE_REG_UPDATE_DEV,
-                                kRegValueTestSource,
-                                &test_source);
-  if (SUCCEEDED(hr)) {
-    if (test_source.IsEmpty()) {
-      test_source = kRegValueTestSourceAuto;
-    }
-    return test_source;
-  }
-
-  DWORD interval = 0;
-  hr = RegKey::GetValue(MACHINE_REG_UPDATE_DEV,
-                        kRegValueAuCheckPeriodMs,
-                        &interval);
-  if (SUCCEEDED(hr)) {
-    return kRegValueTestSourceAuto;
-  }
-
-#if defined(DEBUG) || !OFFICIAL_BUILD
-  test_source = kRegValueTestSourceAuto;
-#endif
-
-  return test_source;
-}
-
-HRESULT ConfigManager::GetNetConfig(CString* net_config) {
-  ASSERT1(net_config);
-  CString val;
-  HRESULT hr = RegKey::GetValue(MACHINE_REG_UPDATE_DEV,
-                                kRegValueNetConfig,
-                                &val);
-  if (SUCCEEDED(hr)) {
-    *net_config = val;
-  }
-  return hr;
-}
-
-// Returns false if running in the context of an OEM install or waiting for a
-// EULA to be accepted.
-bool ConfigManager::CanUseNetwork(bool is_machine) const {
-  DWORD eula_accepted(0);
-  HRESULT hr = RegKey::GetValue(registry_update(is_machine),
-                                kRegValueOmahaEulaAccepted,
-                                &eula_accepted);
-  if (SUCCEEDED(hr) && 0 == eula_accepted) {
-    CORE_LOG(L3, (_T("[CanUseNetwork][eulaaccepted=0][false]")));
-    return false;
-  }
-
-  if (oem_install_utils::IsOemInstalling(is_machine)) {
-    CORE_LOG(L3, (_T("[CanUseNetwork][OEM installing][false]")));
-    return false;
-  }
-
-  return true;
-}
-
-// USE oem_install_utils::IsOemInstalling() INSTEAD in most cases.
-bool ConfigManager::IsWindowsInstalling() const {
-#if !OFFICIAL_BUILD
-  DWORD value = 0;
-  if (SUCCEEDED(RegKey::GetValue(MACHINE_REG_UPDATE_DEV,
-                                 kRegValueNameWindowsInstalling,
-                                 &value))) {
-    CORE_LOG(L3, (_T("['WindowsInstalling' override %d]"), value));
-    return value != 0;
-  }
-#endif
-
-  return omaha::IsWindowsInstalling();
-}
-
-// Checks if the computer name ends with ".google.com" or the NetBIOS domain is
-// "google".
-bool ConfigManager::IsInternalUser() const {
-  CORE_LOG(L4, (_T("[ConfigManager::IsInternalUser]")));
-  TCHAR dns_name[INTERNET_MAX_HOST_NAME_LENGTH] = {0};
-  DWORD dns_name_size(arraysize(dns_name));
-  if (::GetComputerNameEx(ComputerNameDnsFullyQualified,
-                          dns_name, &dns_name_size)) {
-     CORE_LOG(L4, (_T("[dns name %s]"), dns_name));
-     if (String_EndsWith(dns_name, kCompanyInternalDnsName, true)) {
-       return true;
-     }
-  }
-
-  WKSTA_INFO_100* info = NULL;
-  int kInformationLevel = 100;
-  NET_API_STATUS status = ::NetWkstaGetInfo(NULL,
-                                            kInformationLevel,
-                                            reinterpret_cast<BYTE**>(&info));
-  ON_SCOPE_EXIT(::NetApiBufferFree, info);
-  if (status == NERR_Success) {
-    CORE_LOG(L4, (_T("[netbios name %s]"), info->wki100_langroup));
-    if (info->wki100_langroup &&
-        _tcsicmp(info->wki100_langroup, kCompanyInternalLanGroupName) == 0) {
-      return true;
-    }
-  }
-  return false;
-}
-
-bool ConfigManager::CanInstallApp(const GUID& app_guid) const {
-  // Google Update should never be checking whether it can install itself.
-  ASSERT1(!::IsEqualGUID(kGoopdateGuid, app_guid));
-
-  DWORD effective_policy = 0;
-  if (!GetEffectivePolicyForApp(kRegValueInstallAppsDefault,
-                                kRegValueInstallAppPrefix,
-                                app_guid,
-                                &effective_policy)) {
-    return kInstallPolicyDefault;
-  }
-
-  return kPolicyDisabled != effective_policy;
-}
-
-// Self-updates cannot be disabled.
-bool ConfigManager::CanUpdateApp(const GUID& app_guid,
-                                 bool is_manual) const {
-  if (::IsEqualGUID(kGoopdateGuid, app_guid)) {
-    return true;
-  }
-
-  DWORD effective_policy = 0;
-  if (!GetEffectivePolicyForApp(kRegValueUpdateAppsDefault,
-                                kRegValueUpdateAppPrefix,
-                                app_guid,
-                                &effective_policy)) {
-    return kUpdatePolicyDefault;
-  }
-
-  if (kPolicyDisabled == effective_policy) {
-    return false;
-  }
-  if ((kPolicyManualUpdatesOnly == effective_policy) && !is_manual) {
-    return false;
-  }
-
-  return kUpdatePolicyDefault;
-}
-
-bool ConfigManager::AlwaysAllowCrashUploads() const {
-  DWORD always_allow_crash_uploads = 0;
-  RegKey::GetValue(MACHINE_REG_UPDATE_DEV,
-                   kRegValueAlwaysAllowCrashUploads,
-                   &always_allow_crash_uploads);
-  return always_allow_crash_uploads != 0;
-}
-
-}  // namespace omaha
diff --git a/common/config_manager.h b/common/config_manager.h
deleted file mode 100644
index ece20a2..0000000
--- a/common/config_manager.h
+++ /dev/null
@@ -1,256 +0,0 @@
-// Copyright 2005-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// The configuration manager that is used to provide the locations of the
-// directory and the registration entries that are to be used by goopdate.
-
-// TODO(omaha): consider removing some of the functions below and have a
-// parameter is_machine instead. This is consistent with the rest of the code
-// and it reduces the number of functions in the public interface.
-
-#ifndef OMAHA_COMMON_CONFIG_MANAGER_H_
-#define OMAHA_COMMON_CONFIG_MANAGER_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/synchronized.h"
-
-namespace omaha {
-
-class ConfigManager {
- public:
-  const TCHAR* user_registry_clients() const { return USER_REG_CLIENTS; }
-  const TCHAR* user_registry_clients_goopdate() const {
-    return USER_REG_CLIENTS_GOOPDATE;
-  }
-  const TCHAR* user_registry_client_state() const {
-    return USER_REG_CLIENT_STATE;
-  }
-  const TCHAR* user_registry_client_state_goopdate() const {
-    return USER_REG_CLIENT_STATE_GOOPDATE;
-  }
-  const TCHAR* user_registry_update() const { return USER_REG_UPDATE; }
-  const TCHAR* user_registry_google() const { return USER_REG_GOOGLE; }
-
-  const TCHAR* machine_registry_clients() const { return MACHINE_REG_CLIENTS; }
-  const TCHAR* machine_registry_clients_goopdate() const {
-    return MACHINE_REG_CLIENTS_GOOPDATE;
-  }
-  const TCHAR* machine_registry_client_state() const {
-    return MACHINE_REG_CLIENT_STATE;
-  }
-  const TCHAR* machine_registry_client_state_goopdate() const {
-    return MACHINE_REG_CLIENT_STATE_GOOPDATE;
-  }
-  const TCHAR* machine_registry_client_state_medium() const {
-    return MACHINE_REG_CLIENT_STATE_MEDIUM;
-  }
-  const TCHAR* machine_registry_update() const { return MACHINE_REG_UPDATE; }
-  const TCHAR* machine_registry_google() const { return MACHINE_REG_GOOGLE; }
-
-  const TCHAR* registry_clients(bool is_machine) const {
-    return is_machine ? machine_registry_clients() : user_registry_clients();
-  }
-  const TCHAR* registry_clients_goopdate(bool is_machine) const {
-    return is_machine ? machine_registry_clients_goopdate() :
-                        user_registry_clients_goopdate();
-  }
-  const TCHAR* registry_client_state(bool is_machine) const {
-    return is_machine ? machine_registry_client_state() :
-                        user_registry_client_state();
-  }
-  const TCHAR* registry_client_state_goopdate(bool is_machine) const {
-    return is_machine ? machine_registry_client_state_goopdate() :
-                        user_registry_client_state_goopdate();
-  }
-  const TCHAR* registry_update(bool is_machine) const {
-    return is_machine ? machine_registry_update() : user_registry_update();
-  }
-  const TCHAR* registry_google(bool is_machine) const {
-    return is_machine ? machine_registry_google() : user_registry_google();
-  }
-
-  // Gets the temporary download dir for the current thread token:
-  // %UserProfile%/AppData/Local/Temp
-  CString GetTempDownloadDir() const;
-
-  // Gets the total disk size limit for cached packages. When this limit is hit,
-  // packages should be deleted from oldest until total size is below the limit.
-  int GetPackageCacheSizeLimitMBytes() const;
-
-  // Gets the package cache life limit. If a cached package is older than this
-  // limit, it should be removed.
-  int GetPackageCacheExpirationTimeDays() const;
-
-  // Creates download data dir:
-  // %UserProfile%/Application Data/Google/Update/Download
-  // This is the root of the package cache for the user.
-  // TODO(omaha): consider renaming.
-  CString GetUserDownloadStorageDir() const;
-
-  // Creates install data dir:
-  // %UserProfile%/Application Data/Google/Update/Install
-  // Files pending user installs are copied in this directory.
-  CString GetUserInstallWorkingDir() const;
-
-  // Creates offline data dir:
-  // %UserProfile%/Application Data/Google/Update/Offline
-  CString GetUserOfflineStorageDir() const;
-
-  // Returns goopdate install dir:
-  // %UserProfile%/Application Data/Google/Update
-  CString GetUserGoopdateInstallDirNoCreate() const;
-
-  // Creates goopdate install dir:
-  // %UserProfile%/Application Data/Google/Update
-  CString GetUserGoopdateInstallDir() const;
-
-  // Checks if the running program is executing from the User Goopdate dir.
-  bool IsRunningFromUserGoopdateInstallDir() const;
-
-  // Creates crash reports dir:
-  // %UserProfile%/Local Settings/Application Data/Google/CrashReports
-  CString GetUserCrashReportsDir() const;
-
-  // Creates crash reports dir: %ProgramFiles%/Google/CrashReports
-  CString GetMachineCrashReportsDir() const;
-
-  // Creates machine download data dir:
-  // %ProgramFiles%/Google/Update/Download
-  // This directory is the root of the package cache for the machine.
-  // TODO(omaha): consider renaming.
-  CString GetMachineSecureDownloadStorageDir() const;
-
-  // Creates install data dir:
-  // %ProgramFiles%/Google/Update/Install
-  // Files pending machine installs are copied in this directory.
-  CString GetMachineInstallWorkingDir() const;
-
-  // Creates machine offline data dir:
-  // %ProgramFiles%/Google/Update/Offline
-  CString GetMachineSecureOfflineStorageDir() const;
-
-  // Creates machine Gogole Update install dir:
-  // %ProgramFiles%/Google/Update
-  CString GetMachineGoopdateInstallDirNoCreate() const;
-
-  // Creates machine Gogole Update install dir:
-  // %ProgramFiles%/Google/Update
-  CString GetMachineGoopdateInstallDir() const;
-
-  // Checks if the running program is executing from the User Goopdate dir.
-  bool IsRunningFromMachineGoopdateInstallDir() const;
-
-  // Returns the service endpoint where the install/update/uninstall pings
-  // are being sent.
-  HRESULT GetPingUrl(CString* url) const;
-
-  // Returns the service endpoint where the update checks are sent.
-  HRESULT GetUpdateCheckUrl(CString* url) const;
-
-  // Returns the service endpoint where the crashes are sent.
-  HRESULT GetCrashReportUrl(CString* url) const;
-
-  // Returns the web page url where the 'Get Help' requests are sent.
-  HRESULT GetMoreInfoUrl(CString* url) const;
-
-  // Returns the service endpoint where the usage stats requests are sent.
-  HRESULT GetUsageStatsReportUrl(CString* url) const;
-
-  // Returns the time interval between update checks in seconds.
-  // 0 indicates updates are disabled.
-  int GetLastCheckPeriodSec(bool* is_overridden) const;
-
-  // Returns the number of seconds since the last successful update check.
-  int GetTimeSinceLastCheckedSec(bool is_machine) const;
-
-  // Gets and sets the last time a successful server update check was made.
-  DWORD GetLastCheckedTime(bool is_machine) const;
-  HRESULT SetLastCheckedTime(bool is_machine, DWORD time) const;
-
-  // Checks registry to see if user has enabled us to collect anonymous
-  // usage stats.
-  bool CanCollectStats(bool is_machine) const;
-
-  // Returns true if over-installing with the same version is allowed.
-  bool CanOverInstall() const;
-
-  // Returns the Autoupdate timer interval. This is the frequency of the
-  // auto update timer run by the core.
-  int GetAutoUpdateTimerIntervalMs() const;
-
-  // Returns the wait time in ms to start the first worker.
-  int GetUpdateWorkerStartUpDelayMs() const;
-
-  // Returns the Code Red timer interval. This is the frequency of the
-  // code red timer run by the core.
-  int GetCodeRedTimerIntervalMs() const;
-
-  // Returns true if event logging to the Windows Event Log is enabled.
-  bool CanLogEvents(WORD event_type) const;
-
-  // Retrieves TestSource which is to be set on dev, qa, and prober machines.
-  CString GetTestSource() const;
-
-  // Returns true if it is okay to do update checks and send pings.
-  bool CanUseNetwork(bool is_machine) const;
-
-  // Returns true if running in Windows Audit mode (OEM install).
-  // USE OemInstall::IsOemInstalling() INSTEAD in most cases.
-  bool IsWindowsInstalling() const;
-
-  // Returns true if the user is considered an internal user.
-  bool IsInternalUser() const;
-
-  // Returns true if installation of the specified app is allowed.
-  bool CanInstallApp(const GUID& app_guid) const;
-
-  // Returns true if updates are allowed for the specified app.
-  bool CanUpdateApp(const GUID& app_guid, bool is_manual) const;
-
-  // Returns true if crash uploading is allowed all the time, no matter the
-  // build flavor or other configuration parameters.
-  bool AlwaysAllowCrashUploads() const;
-
-  // Returns the network configuration override as a string.
-  static HRESULT GetNetConfig(CString* configuration_override);
-
-  // Gets the time when Goopdate was last updated or installed.
-  static DWORD GetInstallTime(bool is_machine);
-
-  // Returns true if it has been more than 24 hours since Goopdate was updated
-  // or installed.
-  static bool Is24HoursSinceInstall(bool is_machine);
-
-  static ConfigManager* Instance();
-  static void DeleteInstance();
-
- private:
-  static LLock lock_;
-  static ConfigManager* config_manager_;
-
-  ConfigManager();
-
-  bool is_running_from_official_user_dir_;
-  bool is_running_from_official_machine_dir_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(ConfigManager);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_CONFIG_MANAGER_H_
diff --git a/common/config_manager_unittest.cc b/common/config_manager_unittest.cc
deleted file mode 100644
index 73bcc7b..0000000
--- a/common/config_manager_unittest.cc
+++ /dev/null
@@ -1,1581 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <limits.h>
-#include "omaha/base/const_addresses.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/file.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/string.h"
-#include "omaha/base/system_info.h"
-#include "omaha/base/time.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-// OMAHA_KEY_REL == "Software\Google\Update"
-#define OMAHA_KEY_REL \
-    _T("Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-
-
-#define APP_GUID1 _T("{6762F466-8863-424f-817C-5757931F346E}")
-const TCHAR* const kAppGuid1 = APP_GUID1;
-const TCHAR* const kAppMachineClientStatePath1 =
-    _T("HKLM\\") OMAHA_KEY_REL _T("\\ClientState\\") APP_GUID1;
-const TCHAR* const kAppUserClientStatePath1 =
-    _T("HKCU\\") OMAHA_KEY_REL _T("\\ClientState\\") APP_GUID1;
-const TCHAR* const kAppMachineClientStateMediumPath1 =
-    _T("HKLM\\") OMAHA_KEY_REL _T("\\ClientStateMedium\\") APP_GUID1;
-
-#define APP_GUID2 _T("{8A0FDD16-D4B7-4167-893F-1386F2A2F0FB}")
-const TCHAR* const kAppGuid2 = APP_GUID2;
-const TCHAR* const kAppMachineClientStatePath2 =
-    _T("HKLM\\") OMAHA_KEY_REL _T("\\ClientState\\") APP_GUID2;
-const TCHAR* const kAppUserClientStatePath2 =
-    _T("HKCU\\") OMAHA_KEY_REL _T("\\ClientState\\") APP_GUID2;
-
-const TCHAR* const kPolicyKey =
-    _T("HKLM\\Software\\Policies\\")
-    SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME _T("\\");
-const TCHAR* const kInstallPolicyApp1 = _T("Install") APP_GUID1;
-const TCHAR* const kInstallPolicyApp2 = _T("Install") APP_GUID2;
-const TCHAR* const kUpdatePolicyApp1 = _T("Update") APP_GUID1;
-const TCHAR* const kUpdatePolicyApp2 = _T("Update") APP_GUID2;
-
-// Helper to write policies to the registry. Eliminates ambiguity of which
-// overload of SetValue to use without the need for static_cast.
-HRESULT SetPolicy(const TCHAR* policy_name, DWORD value) {
-  return RegKey::SetValue(kPolicyKey, policy_name, value);
-}
-
-// DeleteDirectory can fail with ERROR_PATH_NOT_FOUND if the parent directory
-// does not exist. Consider this a success for testing purposes.
-HRESULT DeleteTestDirectory(const TCHAR* dir) {
-  HRESULT hr = DeleteDirectory(dir);
-  if (hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)) {
-    return S_OK;
-  }
-  return hr;
-}
-
-}  // namespace
-
-class ConfigManagerNoOverrideTest : public testing::Test {
- protected:
-  ConfigManagerNoOverrideTest()
-      : cm_(ConfigManager::Instance()) {
-  }
-
-  bool CanInstallApp(const TCHAR* guid) {
-    return cm_->CanInstallApp(StringToGuid(guid));
-  }
-
-  bool CanUpdateApp(const TCHAR* guid, bool is_manual) {
-    return cm_->CanUpdateApp(StringToGuid(guid), is_manual);
-  }
-
-  ConfigManager* cm_;
-};
-
-class ConfigManagerTest : public ConfigManagerNoOverrideTest {
- protected:
-  ConfigManagerTest()
-      : hive_override_key_name_(kRegistryHiveOverrideRoot) {
-  }
-
-  virtual void SetUp() {
-    RegKey::DeleteKey(hive_override_key_name_, true);
-    OverrideRegistryHives(hive_override_key_name_);
-  }
-
-  virtual void TearDown() {
-    RestoreRegistryHives();
-    EXPECT_SUCCEEDED(RegKey::DeleteKey(hive_override_key_name_, true));
-  }
-
-  void CanCollectStatsHelper(bool is_machine);
-  void CanCollectStatsIgnoresOppositeHiveHelper(bool is_machine);
-  HRESULT SetFirstInstallTime(bool is_machine, DWORD time);
-  HRESULT DeleteFirstInstallTime(bool is_machine);
-  HRESULT SetUpdateTime(bool is_machine, DWORD time);
-  HRESULT DeleteUpdateTime(bool is_machine);
-
-  CString hive_override_key_name_;
-};
-
-void ConfigManagerTest::CanCollectStatsHelper(bool is_machine) {
-  const TCHAR* app1_state_key_name = is_machine ? kAppMachineClientStatePath1 :
-                                                  kAppUserClientStatePath1;
-
-  EXPECT_FALSE(cm_->CanCollectStats(is_machine));
-
-  // Test the 'UsageStats' override.
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueForceUsageStats,
-                                    _T("")));
-  EXPECT_TRUE(cm_->CanCollectStats(is_machine));
-  EXPECT_SUCCEEDED(RegKey::DeleteValue(MACHINE_REG_UPDATE_DEV,
-                                       kRegValueForceUsageStats));
-
-  DWORD val = 1;
-  EXPECT_SUCCEEDED(RegKey::SetValue(app1_state_key_name,
-                                    _T("usagestats"),
-                                    val));
-  EXPECT_TRUE(cm_->CanCollectStats(is_machine));
-
-  val = 2;  // invalid value
-  EXPECT_SUCCEEDED(RegKey::SetValue(app1_state_key_name,
-                                    _T("usagestats"),
-                                    val));
-  EXPECT_FALSE(cm_->CanCollectStats(is_machine));
-
-  val = 0;
-  EXPECT_SUCCEEDED(RegKey::SetValue(app1_state_key_name,
-                                    _T("usagestats"),
-                                    val));
-  EXPECT_FALSE(cm_->CanCollectStats(is_machine));
-
-  // One 0 and one 1 results in true. The alphabetical order of the GUIDs is
-  // important assuming GetSubkeyNameAt returns subkeys in alphabetical order.
-  const TCHAR* app2_state_key_name = is_machine ? kAppMachineClientStatePath2 :
-                                                  kAppUserClientStatePath2;
-  val = 1;
-  EXPECT_SUCCEEDED(RegKey::SetValue(app2_state_key_name,
-                                    _T("usagestats"),
-                                    val));
-  EXPECT_TRUE(cm_->CanCollectStats(is_machine));
-}
-
-void ConfigManagerTest::CanCollectStatsIgnoresOppositeHiveHelper(
-    bool is_machine) {
-  const TCHAR* app1_state_key_name = is_machine ? kAppMachineClientStatePath1 :
-                                                  kAppUserClientStatePath1;
-
-  EXPECT_FALSE(cm_->CanCollectStats(is_machine));
-
-  DWORD val = 1;
-  EXPECT_SUCCEEDED(RegKey::SetValue(app1_state_key_name,
-                                    _T("usagestats"),
-                                    val));
-  EXPECT_TRUE(cm_->CanCollectStats(is_machine));
-  EXPECT_FALSE(cm_->CanCollectStats(!is_machine));
-}
-
-HRESULT ConfigManagerTest::SetFirstInstallTime(bool is_machine, DWORD time) {
-  return RegKey::SetValue(cm_->registry_client_state_goopdate(is_machine),
-                          kRegValueInstallTimeSec,
-                          time);
-}
-
-HRESULT ConfigManagerTest::DeleteFirstInstallTime(bool is_machine) {
-  if (!RegKey::HasValue(cm_->registry_client_state_goopdate(is_machine),
-                        kRegValueInstallTimeSec)) {
-    return S_OK;
-  }
-
-  return RegKey::DeleteValue(cm_->registry_client_state_goopdate(is_machine),
-                             kRegValueInstallTimeSec);
-}
-
-HRESULT ConfigManagerTest::SetUpdateTime(bool is_machine, DWORD time) {
-  return RegKey::SetValue(cm_->registry_client_state_goopdate(is_machine),
-                          kRegValueLastUpdateTimeSec,
-                          time);
-}
-
-HRESULT ConfigManagerTest::DeleteUpdateTime(bool is_machine) {
-  if (!RegKey::HasValue(cm_->registry_client_state_goopdate(is_machine),
-                        kRegValueLastUpdateTimeSec)) {
-    return S_OK;
-  }
-
-  return RegKey::DeleteValue(cm_->registry_client_state_goopdate(is_machine),
-                             kRegValueLastUpdateTimeSec);
-}
-
-TEST_F(ConfigManagerNoOverrideTest, RegistryKeys) {
-  EXPECT_STREQ(_T("HKCU\\") OMAHA_KEY_REL _T("\\Clients\\"),
-               cm_->user_registry_clients());
-  EXPECT_STREQ(_T("HKLM\\") OMAHA_KEY_REL _T("\\Clients\\"),
-               cm_->machine_registry_clients());
-  EXPECT_STREQ(_T("HKCU\\") OMAHA_KEY_REL _T("\\Clients\\"),
-               cm_->registry_clients(false));
-  EXPECT_STREQ(_T("HKLM\\") OMAHA_KEY_REL _T("\\Clients\\"),
-               cm_->registry_clients(true));
-
-  EXPECT_STREQ(_T("HKCU\\") OMAHA_KEY_REL _T("\\Clients\\") GOOPDATE_APP_ID,
-               cm_->user_registry_clients_goopdate());
-  EXPECT_STREQ(_T("HKLM\\") OMAHA_KEY_REL _T("\\Clients\\") GOOPDATE_APP_ID,
-               cm_->machine_registry_clients_goopdate());
-  EXPECT_STREQ(_T("HKCU\\") OMAHA_KEY_REL _T("\\Clients\\") GOOPDATE_APP_ID,
-               cm_->registry_clients_goopdate(false));
-  EXPECT_STREQ(_T("HKLM\\") OMAHA_KEY_REL _T("\\Clients\\") GOOPDATE_APP_ID,
-               cm_->registry_clients_goopdate(true));
-
-  EXPECT_STREQ(_T("HKCU\\") OMAHA_KEY_REL _T("\\ClientState\\"),
-               cm_->user_registry_client_state());
-  EXPECT_STREQ(_T("HKLM\\") OMAHA_KEY_REL _T("\\ClientState\\"),
-               cm_->machine_registry_client_state());
-  EXPECT_STREQ(_T("HKCU\\") OMAHA_KEY_REL _T("\\ClientState\\"),
-               cm_->registry_client_state(false));
-  EXPECT_STREQ(_T("HKLM\\") OMAHA_KEY_REL _T("\\ClientState\\"),
-               cm_->registry_client_state(true));
-
-  EXPECT_STREQ(_T("HKCU\\") OMAHA_KEY_REL _T("\\ClientState\\") GOOPDATE_APP_ID,
-               cm_->user_registry_client_state_goopdate());
-  EXPECT_STREQ(_T("HKLM\\") OMAHA_KEY_REL _T("\\ClientState\\") GOOPDATE_APP_ID,
-               cm_->machine_registry_client_state_goopdate());
-  EXPECT_STREQ(_T("HKCU\\") OMAHA_KEY_REL _T("\\ClientState\\") GOOPDATE_APP_ID,
-               cm_->registry_client_state_goopdate(false));
-  EXPECT_STREQ(_T("HKLM\\") OMAHA_KEY_REL _T("\\ClientState\\") GOOPDATE_APP_ID,
-               cm_->registry_client_state_goopdate(true));
-
-  EXPECT_STREQ(_T("HKLM\\") OMAHA_KEY_REL _T("\\ClientStateMedium\\"),
-               cm_->machine_registry_client_state_medium());
-
-  EXPECT_STREQ(_T("HKCU\\") OMAHA_KEY_REL _T("\\"),
-               cm_->user_registry_update());
-  EXPECT_STREQ(_T("HKLM\\") OMAHA_KEY_REL _T("\\"),
-               cm_->machine_registry_update());
-  EXPECT_STREQ(_T("HKCU\\") OMAHA_KEY_REL _T("\\"),
-               cm_->registry_update(false));
-  EXPECT_STREQ(_T("HKLM\\") OMAHA_KEY_REL _T("\\"),
-               cm_->registry_update(true));
-
-  EXPECT_STREQ(_T("HKCU\\Software\\") COMPANY_NAME_IDENTIFIER _T("\\"),
-               cm_->user_registry_google());
-  EXPECT_STREQ(_T("HKLM\\Software\\") COMPANY_NAME_IDENTIFIER _T("\\"),
-               cm_->machine_registry_google());
-  EXPECT_STREQ(_T("HKCU\\Software\\") COMPANY_NAME_IDENTIFIER _T("\\"),
-               cm_->registry_google(false));
-  EXPECT_STREQ(_T("HKLM\\Software\\") COMPANY_NAME_IDENTIFIER _T("\\"),
-               cm_->registry_google(true));
-}
-
-TEST_F(ConfigManagerNoOverrideTest, GetUserCrashReportsDir) {
-  const CString expected_path = GetGoogleUserPath() + _T("CrashReports");
-  EXPECT_SUCCEEDED(DeleteTestDirectory(expected_path));
-  EXPECT_STREQ(expected_path, cm_->GetUserCrashReportsDir());
-  EXPECT_TRUE(File::Exists(expected_path));
-}
-
-// Should run before the subdirectory tests to ensure the directory is created.
-TEST_F(ConfigManagerNoOverrideTest, GetUserGoopdateInstallDir) {
-  const CString expected_path = GetGoogleUserPath() + _T("Update");
-  EXPECT_STREQ(expected_path, cm_->GetUserGoopdateInstallDir());
-  EXPECT_TRUE(File::Exists(expected_path));
-}
-
-TEST_F(ConfigManagerNoOverrideTest, GetUserDownloadStorageDir) {
-  const CString expected_path = GetGoogleUpdateUserPath() + _T("Download");
-  EXPECT_SUCCEEDED(DeleteTestDirectory(expected_path));
-  EXPECT_STREQ(expected_path, cm_->GetUserDownloadStorageDir());
-  EXPECT_TRUE(File::Exists(expected_path));
-}
-
-TEST_F(ConfigManagerNoOverrideTest, GetUserInstallWorkingDir) {
-  const CString expected_path = GetGoogleUpdateUserPath() + _T("Install");
-  EXPECT_SUCCEEDED(DeleteTestDirectory(expected_path));
-  EXPECT_STREQ(expected_path, cm_->GetUserInstallWorkingDir());
-  EXPECT_TRUE(File::Exists(expected_path));
-}
-
-TEST_F(ConfigManagerNoOverrideTest, GetUserOfflineStorageDir) {
-  const CString expected_path = GetGoogleUpdateUserPath() + _T("Offline");
-  EXPECT_SUCCEEDED(DeleteTestDirectory(expected_path));
-  EXPECT_STREQ(expected_path, cm_->GetUserOfflineStorageDir());
-  EXPECT_TRUE(File::Exists(expected_path));
-}
-
-TEST_F(ConfigManagerNoOverrideTest, IsRunningFromUserGoopdateInstallDir) {
-  EXPECT_FALSE(cm_->IsRunningFromUserGoopdateInstallDir());
-}
-
-TEST_F(ConfigManagerNoOverrideTest, GetTempDownloadDir) {
-  TCHAR expected_path[MAX_PATH] = {0};
-  ASSERT_NE(0, ::GetTempPath(MAX_PATH, expected_path));
-
-  EXPECT_STREQ(expected_path, cm_->GetTempDownloadDir());
-  EXPECT_TRUE(File::Exists(expected_path));
-}
-
-TEST_F(ConfigManagerNoOverrideTest, GetMachineCrashReportsDir) {
-  CString program_files;
-  EXPECT_SUCCEEDED(GetFolderPath(CSIDL_PROGRAM_FILES, &program_files));
-  const CString expected_path =
-      program_files + _T("\\") + SHORT_COMPANY_NAME + _T("\\CrashReports");
-  EXPECT_SUCCEEDED(DeleteTestDirectory(expected_path));
-  EXPECT_STREQ(expected_path, cm_->GetMachineCrashReportsDir());
-  EXPECT_TRUE(File::Exists(expected_path) || !vista_util::IsUserAdmin());
-}
-
-// Should run before the subdirectory tests to ensure the directory is created.
-TEST_F(ConfigManagerNoOverrideTest, GetMachineGoopdateInstallDir) {
-  CString expected_path = GetGoogleUpdateMachinePath();
-  EXPECT_STREQ(expected_path, cm_->GetMachineGoopdateInstallDir());
-  EXPECT_TRUE(File::Exists(expected_path) || !vista_util::IsUserAdmin());
-}
-
-TEST_F(ConfigManagerNoOverrideTest, GetMachineSecureDownloadStorageDir) {
-  CString expected_path = GetGoogleUpdateMachinePath() + _T("\\Download");
-  EXPECT_SUCCEEDED(DeleteTestDirectory(expected_path));
-  EXPECT_STREQ(expected_path, cm_->GetMachineSecureDownloadStorageDir());
-  EXPECT_TRUE(File::Exists(expected_path) || !vista_util::IsUserAdmin());
-}
-
-TEST_F(ConfigManagerNoOverrideTest, GetMachineInstallWorkingDir) {
-  CString expected_path = GetGoogleUpdateMachinePath() + _T("\\Install");
-  EXPECT_SUCCEEDED(DeleteTestDirectory(expected_path));
-  EXPECT_STREQ(expected_path, cm_->GetMachineInstallWorkingDir());
-  EXPECT_TRUE(File::Exists(expected_path) || !vista_util::IsUserAdmin());
-}
-
-TEST_F(ConfigManagerNoOverrideTest, GetMachineSecureOfflineStorageDir) {
-  CString expected_path = GetGoogleUpdateMachinePath() + _T("\\Offline");
-  EXPECT_SUCCEEDED(DeleteTestDirectory(expected_path));
-  EXPECT_STREQ(expected_path, cm_->GetMachineSecureOfflineStorageDir());
-  EXPECT_TRUE(File::Exists(expected_path) || !vista_util::IsUserAdmin());
-}
-
-TEST_F(ConfigManagerNoOverrideTest, IsRunningFromMachineGoopdateInstallDir) {
-  EXPECT_FALSE(cm_->IsRunningFromMachineGoopdateInstallDir());
-}
-
-// Tests the GetUpdateCheckUrl override.
-TEST_F(ConfigManagerTest, GetUpdateCheckUrl) {
-  CString url;
-  EXPECT_SUCCEEDED(cm_->GetUpdateCheckUrl(&url));
-  EXPECT_STREQ(url, kUrlUpdateCheck);
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueNameUrl,
-                                    _T("http://updatecheck/")));
-  url.Empty();
-  EXPECT_SUCCEEDED(cm_->GetUpdateCheckUrl(&url));
-  EXPECT_STREQ(url, _T("http://updatecheck/"));
-}
-
-// Tests the GetPingUrl override.
-TEST_F(ConfigManagerTest, GetPingUrl) {
-  CString url;
-  EXPECT_SUCCEEDED(cm_->GetPingUrl(&url));
-  EXPECT_STREQ(url, kUrlPing);
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueNamePingUrl,
-                                    _T("http://ping/")));
-  url.Empty();
-  EXPECT_SUCCEEDED(cm_->GetPingUrl(&url));
-  EXPECT_STREQ(url, _T("http://ping/"));
-}
-
-// Tests the GetCrashReportUrl override.
-TEST_F(ConfigManagerTest, GetCrashReportUrl) {
-  CString url;
-  EXPECT_SUCCEEDED(cm_->GetCrashReportUrl(&url));
-  EXPECT_STREQ(url, kUrlCrashReport);
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueNameCrashReportUrl,
-                                    _T("http://crashreport/")));
-  url.Empty();
-  EXPECT_SUCCEEDED(cm_->GetCrashReportUrl(&url));
-  EXPECT_STREQ(url, _T("http://crashreport/"));
-}
-
-// Tests the GetMoreInfoUrl override.
-TEST_F(ConfigManagerTest, GetMoreInfoUrl) {
-  CString url;
-  EXPECT_SUCCEEDED(cm_->GetMoreInfoUrl(&url));
-  EXPECT_STREQ(url, kUrlMoreInfo);
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueNameGetMoreInfoUrl,
-                                    _T("http://moreinfo/")));
-  url.Empty();
-  EXPECT_SUCCEEDED(cm_->GetMoreInfoUrl(&url));
-  EXPECT_STREQ(url, _T("http://moreinfo/"));
-}
-
-// Tests the GetUsageStatsReportUrl override.
-TEST_F(ConfigManagerTest, GetUsageStatsReportUrl) {
-  CString url;
-  EXPECT_SUCCEEDED(cm_->GetUsageStatsReportUrl(&url));
-  EXPECT_STREQ(url, kUrlUsageStatsReport);
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueNameUsageStatsReportUrl,
-                                    _T("http://usagestatsreport/")));
-  url.Empty();
-  EXPECT_SUCCEEDED(cm_->GetUsageStatsReportUrl(&url));
-  EXPECT_STREQ(url, _T("http://usagestatsreport/"));
-}
-
-// Tests LastCheckPeriodSec override.
-TEST_F(ConfigManagerTest, GetLastCheckPeriodSec_Default) {
-  bool is_overridden = true;
-  if (cm_->IsInternalUser()) {
-    EXPECT_EQ(kLastCheckPeriodInternalUserSec,
-              cm_->GetLastCheckPeriodSec(&is_overridden));
-  } else {
-    EXPECT_EQ(kLastCheckPeriodSec, cm_->GetLastCheckPeriodSec(&is_overridden));
-  }
-  EXPECT_FALSE(is_overridden);
-}
-
-TEST_F(ConfigManagerTest, GetLastCheckPeriodSec_UpdateDevOverride) {
-  // Zero is a special value meaning disabled.
-  DWORD val = 0;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueLastCheckPeriodSec,
-                                    val));
-  bool is_overridden = false;
-  EXPECT_EQ(0, cm_->GetLastCheckPeriodSec(&is_overridden));
-  EXPECT_TRUE(is_overridden);
-
-  val = kMinLastCheckPeriodSec - 1;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueLastCheckPeriodSec,
-                                    val));
-  is_overridden = false;
-  EXPECT_EQ(kMinLastCheckPeriodSec, cm_->GetLastCheckPeriodSec(&is_overridden));
-  EXPECT_TRUE(is_overridden);
-
-  val = INT_MAX + static_cast<uint32>(1);
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueLastCheckPeriodSec,
-                                    val));
-  is_overridden = false;
-  EXPECT_EQ(INT_MAX, cm_->GetLastCheckPeriodSec(&is_overridden));
-  EXPECT_TRUE(is_overridden);
-
-  val = 1000;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueLastCheckPeriodSec,
-                                    val));
-  is_overridden = false;
-  EXPECT_EQ(1000, cm_->GetLastCheckPeriodSec(&is_overridden));
-  EXPECT_TRUE(is_overridden);
-
-  EXPECT_SUCCEEDED(RegKey::DeleteValue(MACHINE_REG_UPDATE_DEV,
-                                       kRegValueLastCheckPeriodSec));
-  is_overridden = true;
-  if (cm_->IsInternalUser()) {
-    EXPECT_EQ(kLastCheckPeriodInternalUserSec,
-              cm_->GetLastCheckPeriodSec(&is_overridden));
-  } else {
-    EXPECT_EQ(kLastCheckPeriodSec, cm_->GetLastCheckPeriodSec(&is_overridden));
-  }
-  EXPECT_FALSE(is_overridden);
-}
-
-TEST_F(ConfigManagerTest, GetLastCheckPeriodSec_GroupPolicyOverride) {
-  const DWORD kOverrideMinutes = 16000;
-  const DWORD kExpectedSeconds = kOverrideMinutes * 60;
-  EXPECT_SUCCEEDED(SetPolicy(_T("AutoUpdateCheckPeriodMinutes"),
-                             kOverrideMinutes));
-  bool is_overridden = false;
-  EXPECT_EQ(kExpectedSeconds, cm_->GetLastCheckPeriodSec(&is_overridden));
-  EXPECT_TRUE(is_overridden);
-}
-
-TEST_F(ConfigManagerTest, GetLastCheckPeriodSec_GroupPolicyOverride_TooLow) {
-  const DWORD kOverrideMinutes = 1;
-  EXPECT_SUCCEEDED(SetPolicy(_T("AutoUpdateCheckPeriodMinutes"),
-                             kOverrideMinutes));
-  bool is_overridden = false;
-  EXPECT_EQ(kMinLastCheckPeriodSec, cm_->GetLastCheckPeriodSec(&is_overridden));
-  EXPECT_TRUE(is_overridden);
-}
-
-TEST_F(ConfigManagerTest, GetLastCheckPeriodSec_GroupPolicyOverride_Zero) {
-  const DWORD kOverrideMinutes = 0;
-  EXPECT_SUCCEEDED(SetPolicy(_T("AutoUpdateCheckPeriodMinutes"),
-                             kOverrideMinutes));
-  bool is_overridden = false;
-  EXPECT_EQ(0, cm_->GetLastCheckPeriodSec(&is_overridden));
-  EXPECT_TRUE(is_overridden);
-}
-
-TEST_F(ConfigManagerTest,
-       GetLastCheckPeriodSec_GroupPolicyOverride_Overflow_SecondsConversion) {
-  const DWORD kOverrideMinutes = UINT_MAX;
-  EXPECT_SUCCEEDED(SetPolicy(_T("AutoUpdateCheckPeriodMinutes"),
-                             kOverrideMinutes));
-  bool is_overridden = false;
-  EXPECT_EQ(INT_MAX, cm_->GetLastCheckPeriodSec(&is_overridden));
-  EXPECT_TRUE(is_overridden);
-
-  const DWORD kOverrideMinutes2 = INT_MAX + static_cast<uint32>(1);
-  EXPECT_SUCCEEDED(SetPolicy(_T("AutoUpdateCheckPeriodMinutes"),
-                             kOverrideMinutes2));
-  is_overridden = false;
-  EXPECT_EQ(INT_MAX, cm_->GetLastCheckPeriodSec(&is_overridden));
-  EXPECT_TRUE(is_overridden);
-
-  const DWORD kOverrideMinutes3 = 0xf0000000;
-  EXPECT_SUCCEEDED(SetPolicy(_T("AutoUpdateCheckPeriodMinutes"),
-                             kOverrideMinutes3));
-  is_overridden = false;
-  EXPECT_EQ(INT_MAX, cm_->GetLastCheckPeriodSec(&is_overridden));
-  EXPECT_TRUE(is_overridden);
-}
-
-// Overflow the integer but not the minutes to seconds conversion.
-TEST_F(ConfigManagerTest,
-       GetLastCheckPeriodSec_GroupPolicyOverride_Overflow_Int) {
-  const DWORD kOverrideMinutes = UINT_MAX / 60;
-  EXPECT_GT(UINT_MAX, kOverrideMinutes);
-
-  EXPECT_SUCCEEDED(SetPolicy(_T("AutoUpdateCheckPeriodMinutes"),
-                             kOverrideMinutes));
-  bool is_overridden = false;
-  EXPECT_EQ(INT_MAX, cm_->GetLastCheckPeriodSec(&is_overridden));
-  EXPECT_TRUE(is_overridden);
-}
-
-// UpdateDev takes precedence over the Group Policy override.
-TEST_F(ConfigManagerTest,
-       GetLastCheckPeriodSec_GroupPolicyAndUpdateDevOverrides) {
-  const DWORD kGroupPolicyOverrideMinutes = 100;
-  EXPECT_SUCCEEDED(SetPolicy(_T("AutoUpdateCheckPeriodMinutes"),
-                             kGroupPolicyOverrideMinutes));
-  const DWORD kUpdateDevOverrideSeconds = 70;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueLastCheckPeriodSec,
-                                    kUpdateDevOverrideSeconds));
-
-  bool is_overridden = false;
-  EXPECT_EQ(kUpdateDevOverrideSeconds,
-            cm_->GetLastCheckPeriodSec(&is_overridden));
-  EXPECT_TRUE(is_overridden);
-}
-
-TEST_F(ConfigManagerTest, CanCollectStats_LegacyLocationNewName) {
-  DWORD val = 1;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("usagestats"),
-                                    val));
-  EXPECT_FALSE(cm_->CanCollectStats(true));
-}
-
-TEST_F(ConfigManagerTest, CanCollectStats_MachineOnly) {
-  CanCollectStatsHelper(true);
-}
-
-TEST_F(ConfigManagerTest, CanCollectStats_UserOnly) {
-  CanCollectStatsHelper(false);
-}
-
-// This tests that the legacy conversion is honored.
-TEST_F(ConfigManagerTest, CanCollectStats_GoopdateGuidIsChecked) {
-  EXPECT_FALSE(cm_->CanCollectStats(true));
-
-  DWORD val = 1;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_CLIENT_STATE_GOOPDATE,
-                                    _T("usagestats"),
-                                    val));
-  EXPECT_TRUE(cm_->CanCollectStats(true));
-}
-
-TEST_F(ConfigManagerTest, CanCollectStats_MachineIgnoresUser) {
-  CanCollectStatsIgnoresOppositeHiveHelper(true);
-}
-
-TEST_F(ConfigManagerTest, CanCollectStats_UserIgnoresMachine) {
-  CanCollectStatsIgnoresOppositeHiveHelper(false);
-}
-// Unfortunately, the app's ClientStateMedium key is not checked if there is no
-// corresponding ClientState key.
-TEST_F(ConfigManagerTest,
-       CanCollectStats_Machine_ClientStateMediumOnly_AppClientStateKeyMissing) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath1,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_FALSE(cm_->CanCollectStats(true));
-}
-
-TEST_F(ConfigManagerTest,
-       CanCollectStats_Machine_ClientStateMediumOnly_AppClientStateKeyExists) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kAppMachineClientStatePath1));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath1,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_TRUE(cm_->CanCollectStats(true));
-}
-
-TEST_F(ConfigManagerTest,
-       CanCollectStats_Machine_ClientStateMediumInvalid) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kAppMachineClientStatePath1));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath1,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(2)));
-  EXPECT_FALSE(cm_->CanCollectStats(true));
-}
-
-TEST_F(ConfigManagerTest, CanCollectStats_User_ClientStateMediumOnly) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kAppUserClientStatePath1));
-  EXPECT_SUCCEEDED(RegKey::SetValue(
-      _T("HKCU\\") OMAHA_KEY_REL _T("\\ClientStateMedium\\") APP_GUID1,
-      _T("usagestats"),
-      static_cast<DWORD>(1)));
-  EXPECT_FALSE(cm_->CanCollectStats(false));
-}
-
-TEST_F(ConfigManagerTest,
-       CanCollectStats_Machine_ClientStateZeroClientStateMediumOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath1,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_FALSE(cm_->CanCollectStats(true));
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath1,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_TRUE(cm_->CanCollectStats(true));
-}
-
-TEST_F(ConfigManagerTest,
-       CanCollectStats_Machine_ClientStateOneClientStateMediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath1,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_TRUE(cm_->CanCollectStats(true));
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath1,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_FALSE(cm_->CanCollectStats(true));
-}
-
-// Tests OverInstall override.
-TEST_F(ConfigManagerTest, CanOverInstall) {
-  EXPECT_EQ(cm_->CanOverInstall(), !OFFICIAL_BUILD);
-
-  DWORD val = 1;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueNameOverInstall,
-                                    val));
-#ifdef DEBUG
-  EXPECT_TRUE(cm_->CanOverInstall());
-#else
-  EXPECT_EQ(!OFFICIAL_BUILD, cm_->CanOverInstall());
-#endif
-
-  val = 0;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueNameOverInstall,
-                                    val));
-#ifdef DEBUG
-  EXPECT_FALSE(cm_->CanOverInstall());
-#else
-  EXPECT_EQ(!OFFICIAL_BUILD, cm_->CanOverInstall());
-#endif
-}
-
-// Tests AuCheckPeriodMs override.
-TEST_F(ConfigManagerTest, GetAutoUpdateTimerIntervalMs) {
-  EXPECT_EQ(cm_->IsInternalUser() ? kAUCheckPeriodInternalUserMs :
-                                    kAUCheckPeriodMs,
-            cm_->GetAutoUpdateTimerIntervalMs());
-
-  DWORD val = 0;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueAuCheckPeriodMs,
-                                    val));
-  EXPECT_EQ(kMinAUCheckPeriodMs, cm_->GetAutoUpdateTimerIntervalMs());
-
-  val = kMinAUCheckPeriodMs - 1;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueAuCheckPeriodMs,
-                                    val));
-  EXPECT_EQ(kMinAUCheckPeriodMs, cm_->GetAutoUpdateTimerIntervalMs());
-
-  val = 30000;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueAuCheckPeriodMs,
-                                    val));
-  EXPECT_EQ(val, cm_->GetAutoUpdateTimerIntervalMs());
-
-  val = INT_MAX;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueAuCheckPeriodMs,
-                                    val));
-  EXPECT_EQ(val, cm_->GetAutoUpdateTimerIntervalMs());
-
-  // Tests overflow with large positive numbers.
-  val = INT_MAX;
-  ++val;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueAuCheckPeriodMs,
-                                    val));
-  EXPECT_EQ(INT_MAX, cm_->GetAutoUpdateTimerIntervalMs());
-
-  val = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueAuCheckPeriodMs,
-                                    val));
-  EXPECT_EQ(INT_MAX, cm_->GetAutoUpdateTimerIntervalMs());
-}
-
-// Tests CrCheckPeriodMs override.
-TEST_F(ConfigManagerTest, GetCodeRedTimerIntervalMs) {
-  EXPECT_EQ(kCodeRedCheckPeriodMs, cm_->GetCodeRedTimerIntervalMs());
-
-  DWORD val = 0;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueCrCheckPeriodMs,
-                                    val));
-  EXPECT_EQ(kMinCodeRedCheckPeriodMs, cm_->GetCodeRedTimerIntervalMs());
-
-  val = kMinCodeRedCheckPeriodMs - 1;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueCrCheckPeriodMs,
-                                    val));
-  EXPECT_EQ(kMinCodeRedCheckPeriodMs, cm_->GetCodeRedTimerIntervalMs());
-
-  val = 60000;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueCrCheckPeriodMs,
-                                    val));
-  EXPECT_EQ(val, cm_->GetCodeRedTimerIntervalMs());
-
-  val = INT_MAX;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueCrCheckPeriodMs,
-                                    val));
-  EXPECT_EQ(val, cm_->GetCodeRedTimerIntervalMs());
-
-  // Tests overflow with large positive numbers.
-  val = INT_MAX;
-  ++val;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueCrCheckPeriodMs,
-                                    val));
-  EXPECT_EQ(INT_MAX, cm_->GetCodeRedTimerIntervalMs());
-
-  val = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                      kRegValueCrCheckPeriodMs,
-                                      val));
-  EXPECT_EQ(INT_MAX, cm_->GetCodeRedTimerIntervalMs());
-}
-
-// Tests CanLogEvents override.
-TEST_F(ConfigManagerTest, CanLogEvents_WithOutOverride) {
-  EXPECT_FALSE(cm_->CanLogEvents(EVENTLOG_SUCCESS));
-  EXPECT_TRUE(cm_->CanLogEvents(EVENTLOG_ERROR_TYPE));
-  EXPECT_TRUE(cm_->CanLogEvents(EVENTLOG_WARNING_TYPE));
-  EXPECT_FALSE(cm_->CanLogEvents(EVENTLOG_INFORMATION_TYPE));
-  EXPECT_FALSE(cm_->CanLogEvents(EVENTLOG_AUDIT_SUCCESS));
-  EXPECT_FALSE(cm_->CanLogEvents(EVENTLOG_AUDIT_FAILURE));
-}
-
-TEST_F(ConfigManagerTest, CanLogEvents) {
-  EXPECT_FALSE(cm_->CanLogEvents(EVENTLOG_INFORMATION_TYPE));
-
-  DWORD val = LOG_EVENT_LEVEL_ALL;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueEventLogLevel,
-                                    val));
-  EXPECT_TRUE(cm_->CanLogEvents(EVENTLOG_SUCCESS));
-  EXPECT_TRUE(cm_->CanLogEvents(EVENTLOG_ERROR_TYPE));
-  EXPECT_TRUE(cm_->CanLogEvents(EVENTLOG_WARNING_TYPE));
-  EXPECT_TRUE(cm_->CanLogEvents(EVENTLOG_INFORMATION_TYPE));
-  EXPECT_TRUE(cm_->CanLogEvents(EVENTLOG_AUDIT_SUCCESS));
-  EXPECT_TRUE(cm_->CanLogEvents(EVENTLOG_AUDIT_FAILURE));
-
-  val = LOG_EVENT_LEVEL_WARN_AND_ERROR;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueEventLogLevel,
-                                    val));
-  EXPECT_FALSE(cm_->CanLogEvents(EVENTLOG_SUCCESS));
-  EXPECT_TRUE(cm_->CanLogEvents(EVENTLOG_ERROR_TYPE));
-  EXPECT_TRUE(cm_->CanLogEvents(EVENTLOG_WARNING_TYPE));
-  EXPECT_FALSE(cm_->CanLogEvents(EVENTLOG_INFORMATION_TYPE));
-  EXPECT_FALSE(cm_->CanLogEvents(EVENTLOG_AUDIT_SUCCESS));
-  EXPECT_FALSE(cm_->CanLogEvents(EVENTLOG_AUDIT_FAILURE));
-}
-
-// Tests GetTestSource override.
-TEST_F(ConfigManagerTest, GetTestSource_Dev) {
-  CString expected_value;
-#if DEBUG || !OFFICIAL_BUILD
-  expected_value = kRegValueTestSourceAuto;
-#endif
-
-  CString test_source = cm_->GetTestSource();
-  EXPECT_STREQ(expected_value, test_source);
-  ASSERT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueTestSource,
-                                   _T("dev")));
-  test_source = cm_->GetTestSource();
-  EXPECT_STREQ(_T("dev"), test_source);
-}
-
-TEST_F(ConfigManagerTest, GetTestSource_EmptyRegKey) {
-  CString expected_value;
-
-#if DEBUG || !OFFICIAL_BUILD
-  expected_value = kRegValueTestSourceAuto;
-#endif
-
-  CString test_source = cm_->GetTestSource();
-  EXPECT_STREQ(expected_value, test_source);
-  ASSERT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueTestSource,
-                                   _T("")));
-  test_source = cm_->GetTestSource();
-  EXPECT_STREQ(kRegValueTestSourceAuto, test_source);
-}
-
-//
-// CanUseNetwork tests.
-//
-
-// Covers UpdateEulaAccepted case.
-TEST_F(ConfigManagerTest, CanUseNetwork_Machine_Normal) {
-  EXPECT_TRUE(cm_->CanUseNetwork(true));
-}
-
-// Covers UpdateEulaAccepted case.
-TEST_F(ConfigManagerTest, CanUseNetwork_User_Normal) {
-  EXPECT_TRUE(cm_->CanUseNetwork(false));
-}
-
-// These cover the not OEM install mode cases.
-TEST_F(ConfigManagerTest, CanUseNetwork_Machine_UpdateEulaNotAccepted) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_FALSE(cm_->CanUseNetwork(true));
-}
-
-TEST_F(ConfigManagerTest,
-       CanUseNetwork_Machine_UpdateEulaNotAccepted_AppEulaAccepted) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath1,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_FALSE(cm_->CanUseNetwork(true));
-}
-
-TEST_F(ConfigManagerTest, CanUseNetwork_Machine_AppEulaNotAccepted) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath1,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_TRUE(cm_->CanUseNetwork(true));
-}
-
-TEST_F(ConfigManagerTest, CanUseNetwork_Machine_AppEulaAccepted) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath1,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_TRUE(cm_->CanUseNetwork(true));
-}
-
-TEST_F(ConfigManagerTest, CanUseNetwork_Machine_UserUpdateEulaNotAccepted) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_TRUE(cm_->CanUseNetwork(true));
-}
-
-TEST_F(ConfigManagerTest, CanUseNetwork_User_UpdateEulaNotAccepted) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_FALSE(cm_->CanUseNetwork(false));
-}
-
-TEST_F(ConfigManagerTest,
-       CanUseNetwork_User_UpdateEulaNotAccepted_AppEulaAccepted) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath1,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_FALSE(cm_->CanUseNetwork(false));
-}
-
-TEST_F(ConfigManagerTest, CanUseNetwork_User_AppEulaNotAccepted) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath1,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_TRUE(cm_->CanUseNetwork(false));
-}
-
-TEST_F(ConfigManagerTest, CanUseNetwork_User_AppEulaAccepted) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath1,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_TRUE(cm_->CanUseNetwork(false));
-}
-
-TEST_F(ConfigManagerTest, CanUseNetwork_User_MachineUpdateEulaNotAccepted) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_TRUE(cm_->CanUseNetwork(false));
-}
-
-// TODO(omaha): Figure out a way to test the result.
-TEST_F(ConfigManagerTest, IsInternalUser) {
-  cm_->IsInternalUser();
-}
-
-TEST_F(ConfigManagerTest, IsWindowsInstalling_Normal) {
-  EXPECT_FALSE(cm_->IsWindowsInstalling());
-}
-
-// While this test passes, the return value of IsWindowsInstalling() is not
-// fully tested because the account is not Administrator.
-TEST_F(ConfigManagerTest, IsWindowsInstalling_Installing_Vista_InvalidValues) {
-  if (!vista_util::IsVistaOrLater()) {
-    return;
-  }
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(
-      _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-      _T("ImageState"),
-      _T("")));
-  EXPECT_FALSE(cm_->IsWindowsInstalling());
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(
-      _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-      _T("ImageState"),
-      _T("foo")));
-  EXPECT_FALSE(cm_->IsWindowsInstalling());
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(
-      _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-      _T("ImageState"),
-      static_cast<DWORD>(1)));
-  ExpectAsserts expect_asserts;  // RegKey asserts because value type is wrong.
-  EXPECT_FALSE(cm_->IsWindowsInstalling());
-}
-
-// TODO(omaha): This test fails because the account is not Administrator. Maybe
-// just delete them if this is the final implementation of Audit Mode detection.
-TEST_F(ConfigManagerTest, IsWindowsInstalling_Installing_Vista_ValidStates) {
-  if (!vista_util::IsVistaOrLater()) {
-    return;
-  }
-
-  // These states return false in the original implementation.
-  EXPECT_SUCCEEDED(RegKey::SetValue(
-      _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-      _T("ImageState"),
-      _T("IMAGE_STATE_COMPLETE")));
-  EXPECT_FALSE(cm_->IsWindowsInstalling());
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(
-      _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-      _T("ImageState"),
-      _T("IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE")));
-  EXPECT_FALSE(cm_->IsWindowsInstalling());
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(
-      _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-      _T("ImageState"),
-      _T("IMAGE_STATE_SPECIALIZE_RESEAL_TO_OOBE")));
-  EXPECT_FALSE(cm_->IsWindowsInstalling());
-
-  // These states are specified in the original implementation.
-  EXPECT_SUCCEEDED(RegKey::SetValue(
-      _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-      _T("ImageState"),
-      _T("IMAGE_STATE_UNDEPLOYABLE")));
-  EXPECT_TRUE(cm_->IsWindowsInstalling());
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(
-      _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-      _T("ImageState"),
-      _T("IMAGE_STATE_GENERALIZE_RESEAL_TO_AUDIT")));
-  EXPECT_TRUE(cm_->IsWindowsInstalling());
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(
-      _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-      _T("ImageState"),
-      _T("IMAGE_STATE_SPECIALIZE_RESEAL_TO_AUDIT")));
-  EXPECT_TRUE(cm_->IsWindowsInstalling());
-}
-
-TEST_F(ConfigManagerTest, CanInstallApp_NoGroupPolicy) {
-  EXPECT_TRUE(CanInstallApp(kAppGuid1));
-}
-
-TEST_F(ConfigManagerTest, CanInstallApp_DifferentAppDisabled) {
-  EXPECT_SUCCEEDED(SetPolicy(kInstallPolicyApp2, 0));
-  EXPECT_TRUE(CanInstallApp(kAppGuid1));
-}
-
-TEST_F(ConfigManagerTest, CanInstallApp_NoDefaultValue_AppDisabled) {
-  EXPECT_SUCCEEDED(SetPolicy(kInstallPolicyApp1, 0));
-  EXPECT_FALSE(CanInstallApp(kAppGuid1));
-}
-
-TEST_F(ConfigManagerTest, CanInstallApp_NoDefaultValue_AppEnabled) {
-  EXPECT_SUCCEEDED(SetPolicy(kInstallPolicyApp1, 1));
-  EXPECT_TRUE(CanInstallApp(kAppGuid1));
-}
-
-TEST_F(ConfigManagerTest, CanInstallApp_NoDefaultValue_AppInvalid) {
-  EXPECT_SUCCEEDED(SetPolicy(kInstallPolicyApp1, 2));
-  EXPECT_TRUE(CanInstallApp(kAppGuid1));
-}
-
-TEST_F(ConfigManagerTest, CanInstallApp_DefaultDisabled_NoAppValue) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("InstallDefault"), 0));
-  EXPECT_FALSE(CanInstallApp(kAppGuid1));
-}
-
-TEST_F(ConfigManagerTest, CanInstallApp_DefaultDisabled_AppDisabled) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("InstallDefault"), 0));
-  EXPECT_SUCCEEDED(SetPolicy(kInstallPolicyApp1, 0));
-  EXPECT_FALSE(CanInstallApp(kAppGuid1));
-}
-
-TEST_F(ConfigManagerTest, CanInstallApp_DefaultDisabled_AppEnabled) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("InstallDefault"), 0));
-  EXPECT_SUCCEEDED(SetPolicy(kInstallPolicyApp1, 1));
-  EXPECT_TRUE(CanInstallApp(kAppGuid1));
-}
-
-// Invalid value defaulting to true overrides the InstallDefault disable.
-TEST_F(ConfigManagerTest, CanInstallApp_DefaultDisabled_AppInvalid) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("InstallDefault"), 0));
-  EXPECT_SUCCEEDED(SetPolicy(kInstallPolicyApp1, 2));
-  EXPECT_TRUE(CanInstallApp(kAppGuid1));
-}
-
-TEST_F(ConfigManagerTest, CanInstallApp_DefaultEnabled_NoAppValue) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("InstallDefault"), 1));
-  EXPECT_TRUE(CanInstallApp(kAppGuid1));
-}
-
-TEST_F(ConfigManagerTest, CanInstallApp_DefaultEnabled_AppDisabled) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("InstallDefault"), 1));
-  EXPECT_SUCCEEDED(SetPolicy(kInstallPolicyApp1, 0));
-  EXPECT_FALSE(CanInstallApp(kAppGuid1));
-}
-
-TEST_F(ConfigManagerTest, CanInstallApp_DefaultEnabled_AppEnabled) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("InstallDefault"), 1));
-  EXPECT_SUCCEEDED(SetPolicy(kInstallPolicyApp1, 1));
-  EXPECT_TRUE(CanInstallApp(kAppGuid1));
-}
-
-TEST_F(ConfigManagerTest, CanInstallApp_DefaultEnabled_AppInvalid) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("InstallDefault"), 1));
-  EXPECT_SUCCEEDED(SetPolicy(kInstallPolicyApp1, 2));
-  EXPECT_TRUE(CanInstallApp(kAppGuid1));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_NoGroupPolicy) {
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_DifferentAppDisabled) {
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp2, 0));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_DifferentAppManualOnly) {
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp2, 2));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_NoDefaultValue_AppDisabled) {
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 0));
-  EXPECT_FALSE(CanUpdateApp(kAppGuid1, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_NoDefaultValue_AppEnabled) {
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 1));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_NoDefaultValue_AppManualOnly) {
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 2));
-  EXPECT_FALSE(CanUpdateApp(kAppGuid1, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_DefaultDisabled_NoAppValue) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 0));
-  EXPECT_FALSE(CanUpdateApp(kAppGuid1, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_DefaultDisabled_AppDisabled) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 0));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 0));
-  EXPECT_FALSE(CanUpdateApp(kAppGuid1, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_DefaultDisabled_AppEnabled) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 0));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 1));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_DefaultDisabled_AppManualOnly) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 0));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 2));
-  EXPECT_FALSE(CanUpdateApp(kAppGuid1, false));
-}
-
-// Invalid value defaulting to true overrides the UpdateDefault disable.
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_DefaultDisabled_AppInvalid) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 0));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 3));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_DefaultEnabled_NoAppValue) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 1));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_DefaultEnabled_AppDisabled) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 1));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 0));
-  EXPECT_FALSE(CanUpdateApp(kAppGuid1, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_DefaultEnabled_AppEnabled) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 1));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 1));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_DefaultEnabled_AppManualOnly) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 1));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 2));
-  EXPECT_FALSE(CanUpdateApp(kAppGuid1, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_DefaultEnabled_AppInvalid) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 1));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 3));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_DefaultManualOnly_NoAppValue) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 2));
-  EXPECT_FALSE(CanUpdateApp(kAppGuid1, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_DefaultManualOnly_AppDisabled) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 2));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 0));
-  EXPECT_FALSE(CanUpdateApp(kAppGuid1, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_DefaultManualOnly_AppEnabled) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 2));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 1));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_DefaultManualOnly_AppManualOnly) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 2));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 2));
-  EXPECT_FALSE(CanUpdateApp(kAppGuid1, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_DefaultManualOnly_AppInvalid) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 2));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 3));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_DefaultInvalid_NoAppValue) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 3));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_Omaha_DefaultDisabled) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 0));
-  EXPECT_TRUE(CanUpdateApp(kGoogleUpdateAppId, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_Omaha_DefaultManualOnly) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 2));
-  EXPECT_TRUE(CanUpdateApp(kGoogleUpdateAppId, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Auto_Omaha_AppDisabled) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("Update") GOOPDATE_APP_ID, 0));
-  EXPECT_TRUE(CanUpdateApp(kGoogleUpdateAppId, false));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_NoGroupPolicy) {
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_DifferentAppDisabled) {
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp2, 0));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_DifferentAppManualOnly) {
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp2, 2));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_NoDefaultValue_AppDisabled) {
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 0));
-  EXPECT_FALSE(CanUpdateApp(kAppGuid1, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_NoDefaultValue_AppEnabled) {
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 1));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_NoDefaultValue_AppManualOnly) {
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 2));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_DefaultDisabled_NoAppValue) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 0));
-  EXPECT_FALSE(CanUpdateApp(kAppGuid1, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_DefaultDisabled_AppDisabled) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 0));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 0));
-  EXPECT_FALSE(CanUpdateApp(kAppGuid1, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_DefaultDisabled_AppEnabled) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 0));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 1));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_DefaultDisabled_AppManualOnly) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 0));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 2));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, true));
-}
-
-// Invalid value defaulting to true overrides the UpdateDefault disable.
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_DefaultDisabled_AppInvalid) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 0));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 3));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_DefaultEnabled_NoAppValue) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 1));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_DefaultEnabled_AppDisabled) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 1));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 0));
-  EXPECT_FALSE(CanUpdateApp(kAppGuid1, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_DefaultEnabled_AppEnabled) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 1));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 1));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_DefaultEnabled_AppManualOnly) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 1));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 2));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_DefaultEnabled_AppInvalid) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 1));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 3));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_DefaultManualOnly_NoAppValue) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 2));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_DefaultManualOnly_AppDisabled) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 2));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 0));
-  EXPECT_FALSE(CanUpdateApp(kAppGuid1, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_DefaultManualOnly_AppEnabled) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 2));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 1));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_DefaultManualOnly_AppManualOnly) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 2));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 2));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Maual_DefaultManualOnly_AppInvalid) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 2));
-  EXPECT_SUCCEEDED(SetPolicy(kUpdatePolicyApp1, 3));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_DefaultInvalid_NoAppValue) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 3));
-  EXPECT_TRUE(CanUpdateApp(kAppGuid1, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_Omaha_DefaultDisabled) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 0));
-  EXPECT_TRUE(CanUpdateApp(kGoogleUpdateAppId, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_Omaha_DefaultManualOnly) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("UpdateDefault"), 2));
-  EXPECT_TRUE(CanUpdateApp(kGoogleUpdateAppId, true));
-}
-
-TEST_F(ConfigManagerTest, CanUpdateApp_Manual_Omaha_AppDisabled) {
-  EXPECT_SUCCEEDED(SetPolicy(_T("Update") GOOPDATE_APP_ID, 0));
-  EXPECT_TRUE(CanUpdateApp(kGoogleUpdateAppId, true));
-}
-
-TEST_F(ConfigManagerTest, GetPackageCacheSizeLimitMBytes_Default) {
-  EXPECT_EQ(500, cm_->GetPackageCacheSizeLimitMBytes());
-}
-
-TEST_F(ConfigManagerTest, GetPackageCacheSizeLimitMBytes_Override_TooBig) {
-  EXPECT_SUCCEEDED(SetPolicy(kRegValueCacheSizeLimitMBytes, 8192));
-  EXPECT_EQ(500, cm_->GetPackageCacheSizeLimitMBytes());
-}
-
-TEST_F(ConfigManagerTest, GetPackageCacheSizeLimitMBytes_Override_TooSmall) {
-  EXPECT_SUCCEEDED(SetPolicy(kRegValueCacheSizeLimitMBytes, 0));
-  EXPECT_EQ(500, cm_->GetPackageCacheSizeLimitMBytes());
-}
-
-TEST_F(ConfigManagerTest, GetPackageCacheSizeLimitMBytes_Override_Valid) {
-  EXPECT_SUCCEEDED(SetPolicy(kRegValueCacheSizeLimitMBytes, 250));
-  EXPECT_EQ(250, cm_->GetPackageCacheSizeLimitMBytes());
-}
-
-TEST_F(ConfigManagerTest, GetPackageCacheExpirationTimeDays_Default) {
-  EXPECT_EQ(180, cm_->GetPackageCacheExpirationTimeDays());
-}
-
-TEST_F(ConfigManagerTest, GetPackageCacheExpirationTimeDays_Override_TooBig) {
-  EXPECT_SUCCEEDED(SetPolicy(kRegValueCacheLifeLimitDays, 3600));
-  EXPECT_EQ(180, cm_->GetPackageCacheExpirationTimeDays());
-}
-
-TEST_F(ConfigManagerTest, GetPackageCacheExpirationTimeDays_Override_TooSmall) {
-  EXPECT_SUCCEEDED(SetPolicy(kRegValueCacheLifeLimitDays, 0));
-  EXPECT_EQ(180, cm_->GetPackageCacheExpirationTimeDays());
-}
-
-TEST_F(ConfigManagerTest, GetPackageCacheExpirationTimeDays_Override_Valid) {
-  EXPECT_SUCCEEDED(SetPolicy(kRegValueCacheLifeLimitDays, 60));
-  EXPECT_EQ(60, cm_->GetPackageCacheExpirationTimeDays());
-}
-
-TEST_F(ConfigManagerTest, LastCheckedTime) {
-  DWORD time = 500;
-  EXPECT_SUCCEEDED(cm_->SetLastCheckedTime(true, time));
-  EXPECT_EQ(time, cm_->GetLastCheckedTime(true));
-
-  time = 77003;
-  EXPECT_SUCCEEDED(cm_->SetLastCheckedTime(false, time));
-  EXPECT_EQ(time, cm_->GetLastCheckedTime(false));
-}
-
-// Tests GetDir indirectly.
-TEST_F(ConfigManagerTest, GetDir) {
-  RestoreRegistryHives();
-
-  CString user_install_dir = cm_->GetUserGoopdateInstallDir();
-  CString user_profile;
-  ASSERT_NE(0, ::GetEnvironmentVariable(_T("USERPROFILE"),
-                                        CStrBuf(user_profile, MAX_PATH),
-                                        MAX_PATH));
-  ASSERT_TRUE(String_StartsWith(user_install_dir, user_profile, true));
-}
-
-TEST_F(ConfigManagerTest, GetUpdateWorkerStartUpDelayMs_Repeated) {
-  if (!SystemInfo::IsRunningOnXPOrLater()) {
-    std::wcout << _T("\tTest did not run because GenRandom breaks on Windows ")
-               << _T("2000 if the registry keys are overridden.") << std::endl;
-    return;
-  }
-
-  // Test the UpdateDelay multiple times.
-  for (int i = 0; i < 10; ++i) {
-    int random = cm_->GetUpdateWorkerStartUpDelayMs();
-    EXPECT_GE(random, kUpdateTimerStartupDelayMinMs);
-    EXPECT_LE(random, kUpdateTimerStartupDelayMaxMs);
-  }
-}
-
-TEST_F(ConfigManagerTest, GetUpdateWorkerStartUpDelayMs) {
-  if (!SystemInfo::IsRunningOnXPOrLater()) {
-    std::wcout << _T("\tTest did not run because GenRandom breaks on Windows ")
-               << _T("2000 if the registry keys are overridden.") << std::endl;
-    return;
-  }
-
-  int random = cm_->GetUpdateWorkerStartUpDelayMs();
-  EXPECT_GE(random, kUpdateTimerStartupDelayMinMs);
-  EXPECT_LE(random, kUpdateTimerStartupDelayMaxMs);
-
-  int num_times_to_try_for_diff_number = 3;
-  // We run the method num_times_to_try_for_diff_number times to make
-  // sure that at least one of these returns a number that is different
-  // from the one that is returned above. This is needed, since the
-  // method returns a number between kUpdateTimerStartupDelayMinMs and
-  // kUpdateTimerStartupDelayMaxMs.
-  // If this fails a lot we should disable the if check below.
-  bool found_one_not_equal = false;
-  for (int i = 0; i < num_times_to_try_for_diff_number; ++i) {
-    int random_compare = cm_->GetUpdateWorkerStartUpDelayMs();
-
-    EXPECT_GE(random_compare, kUpdateTimerStartupDelayMinMs);
-    EXPECT_LE(random_compare, kUpdateTimerStartupDelayMaxMs);
-
-    if (random_compare != random) {
-      found_one_not_equal = true;
-      break;
-    }
-  }
-
-  EXPECT_TRUE(found_one_not_equal);
-}
-
-TEST_F(ConfigManagerTest, GetUpdateWorkerStartUpDelayMs_Override) {
-  // Test that the initial delay time to launch a worker can be overriden.
-  DWORD val = 3320;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueAuCheckPeriodMs,
-                                    val));
-
-  int random = cm_->GetUpdateWorkerStartUpDelayMs();
-  EXPECT_EQ(val, random);
-}
-
-TEST_F(ConfigManagerTest, GetTimeSinceLastCheckedSec_User) {
-  // First, there is no value present in the registry.
-  uint32 now_sec = Time64ToInt32(GetCurrent100NSTime());
-  int time_since_last_checked_sec = cm_->GetTimeSinceLastCheckedSec(false);
-  EXPECT_EQ(now_sec, time_since_last_checked_sec);
-
-  // Second, write the 'now' time.
-  EXPECT_HRESULT_SUCCEEDED(cm_->SetLastCheckedTime(false, now_sec));
-  time_since_last_checked_sec = cm_->GetTimeSinceLastCheckedSec(false);
-  EXPECT_EQ(0, time_since_last_checked_sec);
-}
-
-TEST_F(ConfigManagerTest, GetTimeSinceLastCheckedSec_Machine) {
-  uint32 now_sec = Time64ToInt32(GetCurrent100NSTime());
-  int time_since_last_checked_sec = cm_->GetTimeSinceLastCheckedSec(true);
-  EXPECT_EQ(now_sec, time_since_last_checked_sec);
-
-  EXPECT_HRESULT_SUCCEEDED(cm_->SetLastCheckedTime(true, now_sec));
-  time_since_last_checked_sec = cm_->GetTimeSinceLastCheckedSec(true);
-  EXPECT_EQ(0, time_since_last_checked_sec);
-}
-
-TEST_F(ConfigManagerTest, GetNetConfig) {
-  CString actual_value;
-  EXPECT_HRESULT_FAILED(cm_->GetNetConfig(&actual_value));
-
-  const CString expected_value = _T("proxy:8080");
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueNetConfig,
-                                    expected_value));
-
-  EXPECT_HRESULT_SUCCEEDED(cm_->GetNetConfig(&actual_value));
-  EXPECT_STREQ(expected_value, actual_value);
-}
-
-TEST_F(ConfigManagerTest, GetInstallTime) {
-  EXPECT_SUCCEEDED(DeleteUpdateTime(false));
-  EXPECT_SUCCEEDED(DeleteFirstInstallTime(false));
-  EXPECT_EQ(0, ConfigManager::GetInstallTime(false));
-
-  DWORD time = 500;
-  EXPECT_SUCCEEDED(SetFirstInstallTime(false, time));
-  EXPECT_EQ(time, ConfigManager::GetInstallTime(false));
-
-  time = 1000;
-  EXPECT_SUCCEEDED(SetUpdateTime(false, time));
-  EXPECT_EQ(time, ConfigManager::GetInstallTime(false));
-
-  EXPECT_SUCCEEDED(DeleteFirstInstallTime(false));
-  EXPECT_EQ(time, ConfigManager::GetInstallTime(false));
-}
-
-TEST_F(ConfigManagerTest, Is24HoursSinceInstall) {
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-  const int k12HourPeriodSec = 12 * 60 * 60;
-  const int k48HourPeriodSec = 48 * 60 * 60;
-
-  const uint32 first_install_12 = now - k12HourPeriodSec;
-  const uint32 first_install_48 = now - k48HourPeriodSec;
-
-  EXPECT_SUCCEEDED(SetFirstInstallTime(false, first_install_12));
-  EXPECT_FALSE(ConfigManager::Is24HoursSinceInstall(false));
-
-  EXPECT_SUCCEEDED(SetFirstInstallTime(false, first_install_48));
-  EXPECT_TRUE(ConfigManager::Is24HoursSinceInstall(false));
-
-  EXPECT_SUCCEEDED(SetUpdateTime(false, first_install_12));
-  EXPECT_FALSE(ConfigManager::Is24HoursSinceInstall(false));
-
-  EXPECT_SUCCEEDED(SetUpdateTime(false, first_install_48));
-  EXPECT_TRUE(ConfigManager::Is24HoursSinceInstall(false));
-}
-
-TEST_F(ConfigManagerTest, AlwaysAllowCrashUploads) {
-  EXPECT_FALSE(cm_->AlwaysAllowCrashUploads());
-
-  DWORD value = 1;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueAlwaysAllowCrashUploads,
-                                    value));
-
-  EXPECT_TRUE(cm_->AlwaysAllowCrashUploads());
-
-  value = 0;
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueAlwaysAllowCrashUploads,
-                                    value));
-
-  EXPECT_FALSE(cm_->AlwaysAllowCrashUploads());
-}
-
-}  // namespace omaha
diff --git a/common/const_cmd_line.h b/common/const_cmd_line.h
deleted file mode 100644
index 1a96083..0000000
--- a/common/const_cmd_line.h
+++ /dev/null
@@ -1,310 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Constants used as command line arguments.
-
-#ifndef OMAHA_COMMON_CONST_CMD_LINE_H__
-#define OMAHA_COMMON_CONST_CMD_LINE_H__
-
-namespace omaha {
-
-//
-// Externally initiated modes.
-// These modes are invoked by or on metainstallers or by the OneClick plugin  .
-//
-
-// The "install" switch indicates installing Omaha and the app.
-const TCHAR* const kCmdLineInstall = _T("install");
-
-// The "installelevated" switch indicates installing after elevating.
-const TCHAR* const kCmdLineInstallElevated = _T("installelevated");
-
-// The "update" switch indicates an Omaha self-update.
-const TCHAR* const kCmdLineUpdate = _T("update");
-
-// The "recover" switch indicates Omaha is to be repaired due to a
-// Code Red scenario.
-const TCHAR* const kCmdLineRecover = _T("recover");
-
-// The "pi" switch indicates that this came from a webplugin.
-// Requires two subarguments "siteurl" and "{args}" where
-// siteurl is the base URL where the plugin ran from and {args}
-// are the args to pass on once validation is complete.
-const TCHAR* const kCmdLineWebPlugin = _T("pi");
-
-//
-// Main operating modes
-//
-
-// The "c" option indicates a core process.
-const TCHAR* const kCmdLineCore = _T("c");
-
-// Specifies to not kick off the crash handler from the Core.
-const TCHAR* const kCmdLineNoCrashHandler = _T("nocrashserver");
-
-// The "crashhandler" option indicates a crash handler process.
-const TCHAR* const kCmdLineCrashHandler = _T("crashhandler");
-
-// Types of "Workers"
-
-// The "handoff" switch indicates a worker to perform an interactive install of
-// an application.
-const TCHAR* const kCmdLineAppHandoffInstall = _T("handoff");
-
-// The "ig" switch was used in Omaha 2 to indicate a worker to finish installing
-// Omaha and perform an interactive install of an application.
-// ig = Install Google Update.
-const TCHAR* const kCmdLineLegacyFinishGoogleUpdateInstall = _T("ig");
-
-// The "ua" switch indicates a worker to perform an update check for all
-// applications.
-// ua = Update Applications.
-const TCHAR* const kCmdLineUpdateApps = _T("ua");
-
-// The "cr" switch indicates that the worker has been invoked to perform a Code
-// Red check.
-const TCHAR* const kCmdLineCodeRedCheck = _T("cr");
-
-// The "registerproduct" switch will register a product GUID in Clients and
-// install only Omaha.
-const TCHAR* const kCmdLineRegisterProduct = _T("registerproduct");
-
-// The "unregisterproduct" switch will unregister a product GUID from Clients.
-const TCHAR* const kCmdLineUnregisterProduct = _T("unregisterproduct");
-
-//
-// Minor modes
-//
-
-// The "svc" switch indicates that Omaha runs as a service that only accepts
-// calls from high integrity COM callers.
-const TCHAR* const kCmdLineService = _T("svc");
-
-// The "medsvc" switch indicates that Omaha runs as a service that accepts
-// calls from medium integrity COM callers.
-const TCHAR* const kCmdLineMediumService = _T("medsvc");
-
-// The "regsvc" switch is used to register the service. Only used by unit
-// tests at the moment.
-const TCHAR* const kCmdLineRegisterService = _T("regsvc");
-
-// The "unregsvc" switch is used to unregister the service. Only used by
-// unit tests at the moment.
-const TCHAR* const kCmdLineUnregisterService = _T("unregsvc");
-
-// The "/comsvc" switch indicates that has the service is being invoked via COM.
-// This switch will be passed in via ServiceParameters.
-const TCHAR* const kCmdLineServiceComServer = _T("/comsvc");
-
-// The "regserver" switch indicates that Omaha should do its Windows
-// service COM server registration including coclasses and its APPID.
-const TCHAR* const kCmdRegServer = _T("regserver");
-
-// The "unregserver" switch indicates that Omaha should undo its
-// COM registration.
-const TCHAR* const kCmdUnregServer = _T("unregserver");
-
-// The "report" switch makes Omaha upload the crash report.
-const TCHAR* const kCmdLineReport = _T("report");
-
-// The "custom_info_filename" switch specifies the file that contains custom
-// crash info.
-const TCHAR* const kCmdLineCustomInfoFileName = _T("custom_info_filename");
-
-// The "Embedding" switch indicates that the worker has been invoked to launch
-// the browser. The -Embedding switch is automatically added by COM when
-// launching the COM server.
-const TCHAR* const kCmdLineComServer = _T("Embedding");
-const TCHAR* const kCmdLineComServerDash = _T("-Embedding");
-
-// Activates broker mode. Broker mode is intended to facilitate communication
-// between low-integrity clients and the high-integrity Omaha DCOM service.
-const TCHAR* const kCmdLineComBroker = _T("/broker");
-
-// Activates OnDemand mode.
-const TCHAR* const kCmdLineOnDemand = _T("/ondemand");
-
-// The "uninstall" switch indicates that Omaha should uninstall if appropriate.
-const TCHAR* const kCmdLineUninstall = _T("uninstall");
-
-// The "ping" switch makes Omaha send a ping with the specified string. The
-// string is expected to be web safe base64 encoded and it will be decoded
-// before sending it to the server.
-const TCHAR* const kCmdLinePing = _T("ping");
-
-//
-// Non-product modes
-// These are used for debug, testing, etc.
-//
-
-// Run network diagnostics.
-const TCHAR* const kCmdLineNetDiags = _T("netdiags");
-
-// The "crash" switch indicates that Omaha should crash upon startup.
-// This option is used to test the crash reporting system.
-const TCHAR* const kCmdLineCrash = _T("crash");
-
-//
-// Parameters for other modes
-//
-
-// The "silent" switch specifies that normally interactive modes should run
-// silently.
-const TCHAR* const kCmdLineSilent = _T("silent");
-
-const TCHAR* const kCmdLineLegacyOfflineInstall = _T("offlineinstall");
-const TCHAR* const kCmdLineOfflineDir = _T("offlinedir");
-
-// The "oem" switch specifies that this is an OEM install in Sysprep mode in an
-// OEM factory.
-const TCHAR* const kCmdLineOem = _T("oem");
-
-// The "eularequired" switch specifies that a EULA must be accepted before
-// checking for updates or pinging.
-const TCHAR* const kCmdLineEulaRequired = _T("eularequired");
-
-// The "machine" switch specifies to repair machine Omaha when specified with
-// "recover". Also used to tell the setup phase 2 worker to do a machine install
-// when doing a recover setup.
-const TCHAR* const kCmdLineMachine = _T("machine");
-
-// The "i" switch indicates that the crash has happend in an
-// interactive process which has a UI up. The switch is an option for
-// the "report" switch.
-const TCHAR* const kCmdLineInteractive = _T("i");
-
-// The "sessionid" switch indicates that a specific session ID should be used by
-// this instance of Omaha for network requests.  This switch is an option for
-// the "install", "handoff", and "update" modes.
-const TCHAR* const kCmdLineSessionId = _T("sessionid");
-
-// The "installsource" switch that is used to pass the source of installation
-// for ping tracking.  For example:  "/installsource OneClick".
-const TCHAR* const kCmdLineInstallSource = _T("installsource");
-
-// installsource values generated internally by Omaha.
-const TCHAR* const kCmdLineInstallSource_TaggedMetainstaller = _T("taggedmi");
-const TCHAR* const kCmdLineInstallSource_OneClick = _T("oneclick");
-const TCHAR* const kCmdLineInstallSource_ClickOnce = _T("clickonce");
-const TCHAR* const kCmdLineInstallSource_Offline = _T("offline");
-const TCHAR* const kCmdLineInstallSource_InstallDefault = _T("otherinstallcmd");
-const TCHAR* const kCmdLineInstallSource_Scheduler = _T("scheduler");
-const TCHAR* const kCmdLineInstallSource_Core = _T("core");
-const TCHAR* const kCmdLineInstallSource_OnDemandUpdate = _T("ondemandupdate");
-const TCHAR* const kCmdLineInstallSource_OnDemandCheckForUpdate =
-    _T("ondemandcheckforupdate");
-const TCHAR* const kCmdLineInstallSource_OnDemandUA = _T("ondemandua");
-const TCHAR* const kCmdLineInstallSource_SelfUpdate = _T("selfupdate");
-const TCHAR* const kCmdLineInstallSource_Update3Web = _T("update3web");
-const TCHAR* const kCmdLineInstallSource_Update3Web_NewApps =
-    _T("update3web-newapps");
-const TCHAR* const kCmdLineInstallSource_Update3Web_OnDemand =
-    _T("update3web-ondemand");
-const TCHAR* const kCmdLineInstallSource_Update3Web_Components =
-    _T("update3web-components");
-
-// This install source is not used as a command line argument but internally
-// created by Omaha.
-const TCHAR* const kInstallSource_Uninstall = _T("uninstall");
-
-//
-// "Extra" arguments provided in the metainstaller tag.
-//
-
-// "bundlename" extra argument is the name of the bundle being installed. If not
-// specified, the first app's appname is used.
-const TCHAR* const kExtraArgBundleName = _T("bundlename");
-
-// "lang" extra argument tells Omaha the language of the product the user is
-// installing.
-const TCHAR* const kExtraArgLanguage = _T("lang");
-
-// "usagestats" extra argument tells Omaha the user has agreed to provide
-// usage stats, crashreports etc.
-const TCHAR* const kExtraArgUsageStats = _T("usagestats");
-
-// "iid" extra argument is a unique value for this installation session.
-// It can be used to follow the progress from the website to installation
-// completion.
-const TCHAR* const kExtraArgInstallationId = _T("iid");
-
-// "brand" extra argument is the Brand Code used for branding.
-// If a brand value already exists on the system, it is ignored.
-// This value is used to set the initial brand for Omaha and the client app.
-const TCHAR* const kExtraArgBrandCode = _T("brand");
-
-// "client" extra argument is the Client ID used for branding.
-// If a client value already exists on the system, it is ignored.
-// This value is used to set the initial client for Omaha and the client app.
-const TCHAR* const kExtraArgClientId = _T("client");
-
-// "experiments" extra argument is a set of experiment labels used to track
-// installs that are included in experiments.  Use "experiments" for
-// per-app arguments; use "omahaexperiments" for Omaha-specific labels.
-const TCHAR* const kExtraArgExperimentLabels = _T("experiments");
-const TCHAR* const kExtraArgOmahaExperimentLabels = _T("omahaexperiments");
-
-// "referral" extra argument is a referral ID used for tracking referrals.
-const TCHAR* const kExtraArgReferralId = _T("referral");
-
-// "ap" extra argument tells Omaha to set the ap value in the registry.
-const TCHAR* const kExtraArgAdditionalParameters = _T("ap");
-
-// "tttoken" extra argument tells Omaha to set the TT value in the registry.
-const TCHAR* const kExtraArgTTToken = _T("tttoken");
-
-// "browser" extra argument tells Omaha which browser to restart on
-// successful install.
-const TCHAR* const kExtraArgBrowserType = _T("browser");
-
-// "runtime" extra argument tells Omaha to only install itself, staying on
-// the system without any associated application for at least 24 hours.
-// This is used to expose our COM API to a process that will install
-// applications via that API after the meta-installer exits.
-const TCHAR* const kExtraArgRuntime = _T("runtime");
-
-// The list of arguments that are needed for a meta-installer, to
-// indicate which application is being installed. These are stamped
-// inside the meta-installer binary.
-const TCHAR* const kExtraArgAppGuid = _T("appguid");
-const TCHAR* const kExtraArgAppName = _T("appname");
-const TCHAR* const kExtraArgNeedsAdmin = _T("needsadmin");
-const TCHAR* const kExtraArgInstallDataIndex = _T("installdataindex");
-
-// App arguments are arguments explicitly passed on the command line. They are
-// formatted similar to the regular extra args. For example:
-//     /appargs "appguid={GUID}&installerdata=BlahData"
-// Unlike the regular extra args, they are not embedded in the executable.
-const TCHAR* const kCmdLineAppArgs = _T("appargs");
-
-// This switch allows extra data to be communicated to the application
-// installer. The extra data needs to be URL-encoded. The data will be decoded
-// and written to the file, that is then passed in the command line to the
-// application installer in the form "/installerdata=blah.dat". One per
-// application.
-const TCHAR* const kExtraArgInstallerData = _T("installerdata");
-
-//
-// Parsing characters
-//
-
-const TCHAR* const kExtraArgsSeparators        = _T("&");
-const TCHAR* const kDisallowedCharsInExtraArgs = _T("/");
-const TCHAR        kNameValueSeparatorChar     = _T('=');
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_CONST_CMD_LINE_H__
-
diff --git a/common/const_goopdate.h b/common/const_goopdate.h
deleted file mode 100644
index d05dbf4..0000000
--- a/common/const_goopdate.h
+++ /dev/null
@@ -1,294 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Goopdate constants - Reduces dependencies on goopdate.h for names that
-// are needed outside Goopdate.
-//
-// TODO(omaha): it appears that the string constants below are not
-// optimized out the program image even if not used. Figure out why they still
-// show up in the tiny shell in optimized builds.
-
-#ifndef OMAHA_COMMON_CONST_GOOPDATE_H_
-#define OMAHA_COMMON_CONST_GOOPDATE_H_
-
-#include <tchar.h>
-#include "omaha/base/constants.h"
-
-// TODO(omaha3): Many of these values are specific to the COM server and a few
-// may apply to the client. Move most of them to the goopdate directory.
-
-namespace omaha {
-
-enum ActiveStates {
-  ACTIVE_NOTRUN = 0,
-  ACTIVE_RUN,
-  ACTIVE_UNKNOWN
-};
-
-// Specifies what Omaha should do on successful installation.
-enum SuccessfulInstallAction {
-  SUCCESS_ACTION_DEFAULT = 0,
-  SUCCESS_ACTION_EXIT_SILENTLY,
-  SUCCESS_ACTION_EXIT_SILENTLY_ON_LAUNCH_CMD,
-};
-
-// Specifies the type of result the app installer returned.
-enum InstallerResultType {
-  INSTALLER_RESULT_UNKNOWN,
-  INSTALLER_RESULT_SUCCESS,
-  INSTALLER_RESULT_ERROR_MSI,
-  INSTALLER_RESULT_ERROR_SYSTEM,
-  INSTALLER_RESULT_ERROR_OTHER,
-};
-
-// The enumeration of the events. Some of the events are used in IPC,
-// these are named events, the rest are not named. Of the named events there
-// are two types the global and the local events.
-// Global Events:
-// The events which are global are indicated with the Global suffix in the
-// enum. These events have the Global prefix attached to the event name and
-// are used for IPC across terminal server sessions, these events are used
-// as barriers, i.e. all waiting threads are release on these events.
-// Local Events:
-// The local counter parts of these events have the Local prefix attached
-// to their names, and dont have any suffix in the enum names. The local events
-// are used to release only one thread, this works as we know that there is
-// only one user goopdate process in a user session and one machine goopdate.
-// The local events also have the user sid added to the event name. This is to
-// work around a bug in win2K and on XP where in case of TS, the event names
-// will collide, inspite of the name changes.
-enum GoopdateEvents {
-  EVENT_INVALID = -1,
-  EVENT_KILL_MESSAGE_LOOP = 0,
-  EVENT_UPDATE_TIMER,
-  EVENT_NEW_MANIFEST,          // Used in IPC.
-  EVENT_QUIET_MODE,            // Used in IPC.
-  EVENT_LEGACY_QUIET_MODE,     // Only used to shut down pre-i18n goopdates.
-  EVENT_CODE_RED_TIMER,
-};
-
-// Represents the values that are used by the application to indicate its
-// requirement for admin.
-enum NeedsAdmin {
-  NEEDS_ADMIN_NO = 0,   // The application will install per user.
-  NEEDS_ADMIN_YES,      // The application will install machine-wide.
-  NEEDS_ADMIN_PREFERS,  // The application will install machine-wide if
-                        // permissions allow, else will install per-user.
-};
-
-// Using extern or intern linkage for these strings yields the same code size
-// for the executable DLL.
-
-// The string representation of the NeedsAdmin enum as specified in the tag or
-// command line. This is eventually parsed into the needs_admin member of
-// CommandLineAppArgs.
-const TCHAR* const kNeedsAdminNo = _T("&needsadmin=false");
-const TCHAR* const kNeedsAdminYes = _T("&needsadmin=true");
-const TCHAR* const kNeedsAdminPrefers = _T("&needsadmin=prefers");
-
-// Environment variable inherited by an installer child process that indicates
-// whether GoogleUpdate is running as user or machine.
-const TCHAR* const kEnvVariableIsMachine = APP_NAME_IDENTIFIER _T("IsMachine");
-
-// Registry values read from the Clients key for transmitting custom install
-// errors, messages, etc. On an update, the InstallerXXX values are renamed to
-// LastInstallerXXX values. The LastInstallerXXX values remain around until the
-// next update.
-const TCHAR* const kRegValueInstallerResult      = _T("InstallerResult");
-const TCHAR* const kRegValueInstallerError       = _T("InstallerError");
-const TCHAR* const kRegValueInstallerExtraCode1  = _T("InstallerExtraCode1");
-const TCHAR* const kRegValueInstallerResultUIString =
-    _T("InstallerResultUIString");
-const TCHAR* const kRegValueInstallerSuccessLaunchCmdLine =
-    _T("InstallerSuccessLaunchCmdLine");
-
-const TCHAR* const kRegValueLastInstallerResult =
-    _T("LastInstallerResult");
-const TCHAR* const kRegValueLastInstallerError =
-    _T("LastInstallerError");
-const TCHAR* const kRegValueLastInstallerExtraCode1 =
-    _T("LastInstallerExtraCode1");
-const TCHAR* const kRegValueLastInstallerResultUIString =
-    _T("LastInstallerResultUIString");
-const TCHAR* const kRegValueLastInstallerSuccessLaunchCmdLine =
-    _T("LastInstallerSuccessLaunchCmdLine");
-
-
-// Registry subkey in an app's Clients key that contains its commands.
-const TCHAR* const kCommandsRegKeyName       = _T("Commands");
-
-// Registry values read from the Clients commands key.
-const TCHAR* const kRegValueCommandLine      = _T("CommandLine");
-const TCHAR* const kRegValueSendsPings       = _T("SendsPings");
-const TCHAR* const kRegValueWebAccessible    = _T("WebAccessible");
-const TCHAR* const kRegValueReportingId      = _T("ReportingId");
-
-// Registry value in an app's Clients key that contains a registration update
-// hook CLSID.
-const TCHAR* const kRegValueUpdateHookClsid  = _T("RegistrationUpdateHook");
-
-// Registry values read from the Clients key and stored in the ClientState key.
-const TCHAR* const kRegValueLanguage         = _T("lang");
-const TCHAR* const kRegValueAppName          = _T("name");
-const TCHAR* const kRegValueProductVersion   = _T("pv");
-
-// Registry values stored in the ClientState key.
-const TCHAR* const kRegValueAdditionalParams = _T("ap");
-const TCHAR* const kRegValueBrandCode        = _T("brand");
-const TCHAR* const kRegValueBrowser          = _T("browser");
-const TCHAR* const kRegValueClientId         = _T("client");
-const TCHAR* const kRegValueDidRun           = _T("dr");
-const TCHAR* const kRegValueExperimentLabels = _T("experiment_labels");
-const TCHAR* const kRegValueInstallationId   = _T("iid");
-const TCHAR* const kRegValueOemInstall       = _T("oeminstall");
-const TCHAR* const kRegValueReferralId       = _T("referral");
-
-// This two registries hold client UTC timestamp of server's midnight of the day
-// that last active ping/roll call happened.
-const TCHAR* const kRegValueActivePingDayStartSec = _T("ActivePingDayStartSec");
-const TCHAR* const kRegValueRollCallDayStartSec   = _T("RollCallDayStartSec");
-
-// Registry values stored in the ClientState key related to Omaha's actions.
-// A "successful check" means "noupdate" received from the server or an update
-// was successfully applied.
-const TCHAR* const kRegValueInstallTimeSec          = _T("InstallTime");
-const TCHAR* const kRegValueLastSuccessfulCheckSec  = _T("LastCheckSuccess");
-const TCHAR* const kRegValueLastUpdateTimeSec       = _T("UpdateTime");
-
-// Registry values stored in the ClientState or ClientStateMedium keys.
-// Use accessor methods rather than reading them directly.
-const TCHAR* const kRegValueEulaAccepted     = _T("eulaaccepted");
-const TCHAR* const kRegValueUsageStats       = _T("usagestats");
-
-// Registry values stored in the ClientState key for Omaha's internal use.
-const TCHAR* const kRegValueTTToken               = _T("tttoken");
-const TCHAR* const kRegValueUpdateAvailableCount  = _T("UpdateAvailableCount");
-const TCHAR* const kRegValueUpdateAvailableSince  = _T("UpdateAvailableSince");
-
-// Registry values stored in the Update key.
-const TCHAR* const kRegValueDelayOmahaUninstall   = _T("DelayUninstall");
-const TCHAR* const kRegValueOmahaEulaAccepted     = _T("eulaaccepted");
-// TODO(omaha3): Consider renaming these if there is not a upgrade problem.
-// If we can't consider moving all "gupdate" values to the customization file.
-const TCHAR* const kRegValueServiceName           = _T("omaha_service_name");
-const TCHAR* const kRegValueMediumServiceName     = _T("omaham_service_name");
-const TCHAR* const kRegValueTaskNameC             = _T("omaha_task_name_c");
-const TCHAR* const kRegValueTaskNameUA            = _T("omaha_task_name_ua");
-const TCHAR* const kRegValueLastChecked           = _T("LastChecked");
-const TCHAR* const kRegValueOemInstallTimeSec     = _T("OemInstallTime");
-const TCHAR* const kRegValueCacheSizeLimitMBytes  = _T("PackageCacheSizeLimit");
-const TCHAR* const kRegValueCacheLifeLimitDays    = _T("PackageCacheLifeLimit");
-const TCHAR* const kRegValueInstalledPath         = _T("path");
-const TCHAR* const kRegValueUserId                = _T("uid");
-const TCHAR* const kRegValueSelfUpdateExtraCode1  = _T("UpdateCode1");
-const TCHAR* const kRegValueSelfUpdateErrorCode   = _T("UpdateError");
-const TCHAR* const kRegValueSelfUpdateVersion     = _T("UpdateVersion");
-const TCHAR* const kRegValueInstalledVersion      = _T("version");
-
-// TODO(omaha3): Consider moving all "gupdate" values to the customization file.
-// Use a non-gupdate name for the new medium service.
-const TCHAR* const kServicePrefix               = _T("omaha");
-const TCHAR* const kMediumServicePrefix         = _T("omaham");
-
-const TCHAR* const kScheduledTaskNameUserPrefix =
-    APP_NAME_IDENTIFIER _T("TaskUser");
-const TCHAR* const kScheduledTaskNameMachinePrefix =
-    APP_NAME_IDENTIFIER _T("TaskMachine");
-const TCHAR* const kScheduledTaskNameCoreSuffix = _T("Core");
-const TCHAR* const kScheduledTaskNameUASuffix   = _T("UA");
-
-const TCHAR* const kServiceFileName              = kOmahaShellFileName;
-const char*  const kGoopdateDllEntryAnsi         = "DllEntry";
-
-
-// Event Id's used for reporting in the event log.
-// Crash Report events.
-const int kCrashReportEventId        = 1;
-const int kCrashUploadEventId        = 2;
-
-// Update Check events.
-const int kUpdateCheckEventId        = 11;
-const int kUpdateEventId             = 12;
-const int kUninstallEventId          = 13;
-const int kWorkerStartEventId        = 14;
-const int kDownloadEventId           = 15;
-
-// Network Request events.
-const int kNetworkRequestEventId     = 20;
-
-// Maximum value the server can respond for elapsed_seconds attribute in
-// <daystart ...> element. The value is one day plus an hour ("fall back"
-// daylight savings).
-const int kMaxTimeSinceMidnightSec   = ((24 + 1) * 60 * 60);
-
-// Maximum time to keep the Installation ID. If the app was installed longer
-// than this time ago, the Installation ID will be deleted regardless of
-// whether the application has been run or not.
-const int kMaxLifeOfInstallationIDSec = (7 * 24 * 60 * 60);  // 7 days
-
-// Documented in the IDL for certain properties of ICurrentState.
-const int kCurrentStateProgressUnknown = -1;
-
-// COM ProgIDs.
-#define kProgIDUpdate3COMClassUser \
-    APP_NAME_IDENTIFIER _T(".Update3COMClassUser")
-#define kProgIDUpdate3COMClassService \
-    APP_NAME_IDENTIFIER _T(".Update3COMClassService")
-
-const TCHAR* const kProgIDOnDemandUser =
-    APP_NAME_IDENTIFIER _T(".OnDemandCOMClassUser");
-#define kProgIDOnDemandMachine \
-    APP_NAME_IDENTIFIER _T(".OnDemandCOMClassMachine")
-const TCHAR* const kProgIDOnDemandMachineFallback =
-    APP_NAME_IDENTIFIER _T(".OnDemandCOMClassMachineFallback");
-const TCHAR* const kProgIDOnDemandSvc =
-    APP_NAME_IDENTIFIER _T(".OnDemandCOMClassSvc");
-
-const TCHAR* const kProgIDUpdate3WebUser =
-    APP_NAME_IDENTIFIER _T(".Update3WebUser");
-#define kProgIDUpdate3WebMachine \
-    APP_NAME_IDENTIFIER _T(".Update3WebMachine")
-const TCHAR* const kProgIDUpdate3WebMachineFallback =
-    APP_NAME_IDENTIFIER _T(".Update3WebMachineFallback");
-const TCHAR* const kProgIDUpdate3WebSvc =
-    APP_NAME_IDENTIFIER _T(".Update3WebSvc");
-
-const TCHAR* const kProgIDGoogleUpdateCoreService =
-    APP_NAME_IDENTIFIER _T(".CoreClass");
-const TCHAR* const kProgIDGoogleUpdateCoreMachine =
-    APP_NAME_IDENTIFIER _T(".CoreMachineClass");
-
-const TCHAR* const kProgIDProcessLauncher =
-    APP_NAME_IDENTIFIER _T(".ProcessLauncher");
-
-const TCHAR* const kProgIDOneClickProcessLauncherUser =
-    _T(SHORT_COMPANY_NAME_ANSI) _T(".OneClickProcessLauncherUser");
-const TCHAR* const kProgIDOneClickProcessLauncherMachine =
-    _T(SHORT_COMPANY_NAME_ANSI) _T(".OneClickProcessLauncherMachine");
-
-const TCHAR* const kProgIDCoCreateAsync =
-    APP_NAME_IDENTIFIER _T(".CoCreateAsync");
-
-const TCHAR* const kProgIDCredentialDialogUser =
-    APP_NAME_IDENTIFIER _T(".CredentialDialogUser");
-const TCHAR* const kProgIDCredentialDialogMachine =
-    APP_NAME_IDENTIFIER _T(".CredentialDialogMachine");
-
-// Offline v3 manifest name.
-const TCHAR* const kOfflineManifestFileName = _T("OfflineManifest.gup");
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_CONST_GOOPDATE_H_
diff --git a/common/const_group_policy.h b/common/const_group_policy.h
deleted file mode 100644
index 903b2d5..0000000
--- a/common/const_group_policy.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_CONST_GROUP_POLICY_H_
-#define OMAHA_COMMON_CONST_GROUP_POLICY_H_
-
-#include <tchar.h>
-#include "omaha/base/constants.h"
-
-namespace omaha {
-
-// Key containing Omaha Group Policy settings. All policies are in HKLM.
-// TODO(omaha): Rename Omaha.
-const TCHAR* const kRegKeyGoopdateGroupPolicy =
-    MACHINE_KEY GOOPDATE_POLICIES_RELATIVE;
-
-// Preferences Categroy.
-const TCHAR* const kRegValueAutoUpdateCheckPeriodOverrideMinutes =
-    _T("AutoUpdateCheckPeriodMinutes");
-
-// Applications Categroy.
-// The prefix strings have the app's GUID appended to them.
-const TCHAR* const kRegValueInstallAppsDefault  = _T("InstallDefault");
-const TCHAR* const kRegValueInstallAppPrefix    = _T("Install");
-const TCHAR* const kRegValueUpdateAppsDefault   = _T("UpdateDefault");
-const TCHAR* const kRegValueUpdateAppPrefix     = _T("Update");
-
-const bool kInstallPolicyDefault    = true;
-const bool kUpdatePolicyDefault     = true;
-
-const int kPolicyDisabled           = 0;
-const int kPolicyEnabled            = 1;
-const int kPolicyManualUpdatesOnly  = 2;
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_CONST_GROUP_POLICY_H_
diff --git a/common/controlled_object.h b/common/controlled_object.h
deleted file mode 100644
index 26431ae..0000000
--- a/common/controlled_object.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// This class is similar to CComContainedObject. The primary difference is with
-// respect to QueryInterface, which this class handles itself, as opposed to
-// CComContainedObject that delegates that to the outer unknown.
-
-#ifndef OMAHA_COMMON_CONTROLLED_OBJECT_H_
-#define OMAHA_COMMON_CONTROLLED_OBJECT_H_
-
-#include <atlcom.h>
-#include "base/scoped_ptr.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/scoped_ptr_address.h"
-
-namespace omaha {
-
-template <class Base>
-class ControlledObject : public CComContainedObject<Base> {
- public:
-  typedef CComContainedObject<Base> BaseClass;
-  typedef ControlledObject<Base> ControlledObj;
-
-  // The base class CComContainedObject stores pv, and delegates to this
-  // controlling unknown subsequent calls to the lifetime methods
-  // AddRef/Release.
-  explicit ControlledObject(void* pv) : BaseClass(pv) {}
-  virtual ~ControlledObject() {}
-
-  STDMETHOD(QueryInterface)(REFIID iid, void** ppv) throw() {
-    return _InternalQueryInterface(iid, ppv);
-  }
-
-  // TODO(omaha): ASSERT on controlling_unknown. The unit tests need to be
-  // fixed for this.
-  static HRESULT WINAPI CreateInstance(IUnknown* controlling_unknown,
-                                       ControlledObj** pp) throw() {
-    ASSERT1(pp);
-    if (!controlling_unknown) {
-      CORE_LOG(LW, (_T("[CreateInstance - controlling_unknown is NULL]")));
-    }
-
-    *pp = NULL;
-    scoped_ptr<ControlledObj> p(new ControlledObj(controlling_unknown));
-    if (!p.get()) {
-      return E_OUTOFMEMORY;
-    }
-
-    HRESULT hr = p->FinalConstruct();
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    *pp = p.release();
-    return S_OK;
-  }
-
-  template <class Q>
-  HRESULT STDMETHODCALLTYPE QueryInterface(Q** pp) throw() {
-    return QueryInterface(__uuidof(Q), reinterpret_cast<void**>(pp));
-  }
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_CONTROLLED_OBJECT_H_
-
diff --git a/common/event_logger.cc b/common/event_logger.cc
deleted file mode 100644
index 54b1634..0000000
--- a/common/event_logger.cc
+++ /dev/null
@@ -1,225 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/common/event_logger.h"
-
-#include <sddl.h>
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/user_info.h"
-#include "omaha/common/config_manager.h"
-
-namespace omaha {
-
-void LogEventHelper(WORD type, DWORD id, size_t count, const TCHAR** strings,
-                    const TCHAR* ctx) {
-  ASSERT1(count <= kint16max);
-  if (!ConfigManager::Instance()->CanLogEvents(type)) {
-    return;
-  }
-
-  // Include the circular logging buffer in the event log if the type is a
-  // warning or an error.
-  CStringA data(ctx);
-  CString context = GetLogging()->GetHistory();
-  if (!context.IsEmpty()) {
-    SafeCStringAAppendFormat(&data, "\n[More context: %S]", context);
-  }
-
-  HRESULT hr = EventLogger::ReportEvent(EventLogger::kSourceName,
-                                        type,
-                                        EventLogger::kDefaultCategory,
-                                        id,
-                                        static_cast<WORD>(count),
-                                        strings,
-                                        data.GetLength(),
-                                        data.GetBuffer());
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[Failed to log event][0x%08x]"), hr));
-  }
-}
-
-CString BuildEventSourceRegistryKeyName(const TCHAR* src_name) {
-  ASSERT1(src_name);
-  CString key_name;
-  SafeCStringFormat(&key_name,
-                    _T("HKLM\\SYSTEM\\CurrentControlSet\\Services\\EventLog\\")
-                    _T("Application\\%s"),
-                    src_name);
-  return key_name;
-}
-
-HRESULT EventLogger::AddEventSource(const TCHAR* src_name,
-                                    const TCHAR* msg_dll_path) {
-  ASSERT1(src_name);
-  if (!src_name) return E_INVALIDARG;
-  ASSERT1(msg_dll_path);
-  if (!msg_dll_path) return E_INVALIDARG;
-
-  // Create the event source as a subkey of the "Application" log.
-  RegKey reg_key;
-  HRESULT hr = reg_key.Create(BuildEventSourceRegistryKeyName(src_name));
-  if (FAILED(hr)) return hr;
-
-  // Set the name of the message file. RegKey class can't set REG_EXPAND_SZ
-  // values so we must use the low level OS call.
-  int result = ::RegSetValueEx(reg_key.Key(),
-                               _T("EventMessageFile"),
-                               0,
-                               REG_EXPAND_SZ,
-                               reinterpret_cast<const byte*>(msg_dll_path),
-                               (_tcslen(msg_dll_path) + 1) * sizeof(TCHAR));
-  if (result != ERROR_SUCCESS) return HRESULT_FROM_WIN32(result);
-
-  // Set the supported event types.
-  DWORD types = EVENTLOG_ERROR_TYPE |
-                EVENTLOG_WARNING_TYPE |
-                EVENTLOG_INFORMATION_TYPE;
-  hr = reg_key.SetValue(_T("TypesSupported"), types);
-  if (FAILED(hr)) return hr;
-
-  return S_OK;
-}
-
-HRESULT EventLogger::RemoveEventSource(const TCHAR* src_name) {
-  ASSERT1(src_name);
-  if (!src_name) return E_INVALIDARG;
-
-  // RegKey::DeleteKey  returns S_FALSE when attempting to delete
-  // a key that is not there.
-  HRESULT hr = RegKey::DeleteKey(BuildEventSourceRegistryKeyName(src_name),
-                                 false);
-  return SUCCEEDED(hr) ? S_OK : hr;
-}
-
-
-HRESULT EventLogger::ReportEvent(const TCHAR* src_name,
-                                 WORD type,
-                                 WORD category,
-                                 DWORD id,
-                                 WORD count,
-                                 const TCHAR** strings,
-                                 size_t buf_size,
-                                 void* buffer) {
-  ASSERT1(src_name);
-  ASSERT1(type == EVENTLOG_SUCCESS ||
-          type == EVENTLOG_ERROR_TYPE ||
-          type == EVENTLOG_WARNING_TYPE ||
-          type == EVENTLOG_INFORMATION_TYPE);
-
-  //  Opens the log on the local computer.
-  HANDLE hlog = ::RegisterEventSource(NULL, src_name);
-  if (!hlog) {
-    return HRESULTFromLastError();
-  }
-
-  // Best effort to get the sid for the current effective user. The event
-  // logging provides for logging the sid at no cost so that the user shows up
-  // in the event log.
-  CString sid_string;
-  VERIFY1(SUCCEEDED(user_info::GetEffectiveUserSid(&sid_string)));
-  PSID psid = NULL;
-  if (!sid_string.IsEmpty()) {
-    VERIFY1(::ConvertStringSidToSid(sid_string, &psid));
-    ASSERT1(psid);
-  }
-
-  HRESULT hr = E_FAIL;
-  if (::ReportEvent(hlog,       // Event log handle.
-                    type,       // Event type.
-                    category,   // Event category.
-                    id,         // Event identifier.
-                    psid,       // User security identifier.
-                    count,      // Number of substitution strings.
-                    buf_size,   // Size of binary data.
-                    strings,    // Pointer to strings.
-                    buffer)) {  // Binary data.
-    hr = S_OK;
-  } else {
-    hr = HRESULTFromLastError();
-  }
-
-  ::LocalFree(psid);
-  VERIFY1(::DeregisterEventSource(hlog));
-  return hr;
-}
-
-HRESULT EventLogger::ReadLastEvent(const TCHAR* src_name, EVENTLOGRECORD* rec) {
-  if (!(rec && src_name)) {
-    return E_INVALIDARG;
-  }
-  HANDLE hlog = ::OpenEventLog(NULL, src_name);
-  if (!hlog) {
-    return HRESULTFromLastError();
-  }
-  HRESULT hr = E_FAIL;
-  DWORD bytes_read(0), bytes_needed(0);
-  const DWORD read_flags = EVENTLOG_BACKWARDS_READ | EVENTLOG_SEQUENTIAL_READ;
-  if (::ReadEventLog(hlog,              // Event log handle.
-                     read_flags,        // Reverse chronological order.
-                     0,                 // Not used.
-                     rec,               // Read buffer.
-                     rec->Length,       // Size of read buffer.
-                     &bytes_read,       // Number of bytes read.
-                     &bytes_needed)) {  // Number of bytes required.
-    hr = S_OK;
-  } else {
-    hr = HRESULTFromLastError();
-  }
-  ::CloseEventLog(hlog);
-  return hr;
-}
-
-// TODO(omaha): Decide whether to use IDS_PRODUCT_DISPLAY_NAME instead.
-// On one hand this string makes it to the event viewer, on
-// the other hand the same string is used to register an event log for an
-// application in registry. We do not expect the mapping to change when the user
-// changes languages or there are multiple users for a per-machine install that
-// are using different languages., however we may decide to do so.
-const TCHAR* const EventLogger::kSourceName = kAppName;
-
-void GoogleUpdateLogEvent::WriteEvent() {
-  ASSERT1(!event_desc_.IsEmpty());
-  ASSERT1(type_ != 0);
-  ASSERT1(id_ != 0);
-
-  const DWORD pid(::GetCurrentProcessId());
-  const TCHAR* ver = GetVersionString();
-
-  const ConfigManager& cm = *ConfigManager::Instance();
-  CString msg;
-  SafeCStringFormat(&msg, _T("\n%s.\npid=%d, ver=%s, machine=%d, extern=%d"),
-                    event_desc_, pid, ver, is_machine_, !cm.IsInternalUser());
-#if DEBUG
-  msg.Append(_T(", debug"));
-#endif
-#if !OFFICIAL_BUILD
-  msg.Append(_T(", private"));
-#endif
-
-  if (!event_text_.IsEmpty()) {
-    SafeCStringAppendFormat(&msg, _T("\n%s"), event_text_);
-  }
-
-  LogEvent(static_cast<WORD>(type_), id_, msg);
-}
-
-}  // namespace omaha
-
diff --git a/common/event_logger.h b/common/event_logger.h
deleted file mode 100644
index 8a2c89f..0000000
--- a/common/event_logger.h
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Event Logger provides a simple mechanism to log events to Windows
-// Event Log. A few overloads are defined to simplify logging by reducing
-// the number of parameters that must be provided. The overloads are
-// implemented in terms of the EventLogger class.
-//
-// The event logging works in both debug and optimized builds. This is not
-// a substitute for the debug log. Instead it is a way to provide some level
-// of transparency into what Google Update is doing at runtime and to help
-// diagnosing end user issues.
-//
-// Familiarity with Windows Event Log is helpful in understanding how
-// these wrappers are to be used. Windows Event Log uses localized strings
-// in a message file and it substitutes string insterts that correspond to
-// formatting characters in the message string. In addtion, the log is able
-// to record raw data, herein provided by a context string, which may be
-// useful to provide some context around the formatted message.
-
-// TODO(omaha): Provide some control for the verbosity level in the log.
-// TODO(omaha): Perhaps there is a better way to define the overloaded
-// wrappers below. I chose a compromise between the easy of use while not
-// mixing up different string parameters that have different meanings.
-
-#ifndef OMAHA_COMMON_EVENT_LOGGER_H_
-#define OMAHA_COMMON_EVENT_LOGGER_H_
-
-#include <atlstr.h>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-void LogEventHelper(WORD type, DWORD id, size_t count, const TCHAR** strings,
-                    const TCHAR* ctx);
-
-// Logs an event to the Application log
-inline void LogEvent(WORD type, DWORD id) {
-  LogEventHelper(type, id, 0, NULL, NULL);
-}
-
-inline void LogEvent(WORD type, DWORD id, const TCHAR* s) {
-  const TCHAR* strings[] = {s};
-  LogEventHelper(type, id, arraysize(strings), strings, NULL);
-}
-
-inline void LogEvent(WORD type, DWORD id, const TCHAR* s1, const TCHAR* s2) {
-  const TCHAR* strings[] = {s1, s2};
-  LogEventHelper(type, id, arraysize(strings), strings, NULL);
-}
-
-inline void LogEvent(WORD type, DWORD id, const TCHAR* s1, const TCHAR* s2,
-                     const TCHAR* s3) {
-  const TCHAR* strings[] = {s1, s2, s3};
-  LogEventHelper(type, id, arraysize(strings), strings, NULL);
-}
-
-// Logs an event to the Application log with a context string.
-inline void LogEventContext(WORD type, DWORD id, const TCHAR* ctx) {
-  LogEventHelper(type, id, 0, NULL, ctx);
-}
-
-inline void LogEventContext(WORD type, DWORD id, const TCHAR* s,
-                            const TCHAR* ctx) {
-  const TCHAR* strings[] = {s};
-  LogEventHelper(type, id, arraysize(strings), strings, ctx);
-}
-
-inline void LogEventContext(WORD type, DWORD id, const TCHAR* s1,
-                            const TCHAR* s2, const TCHAR* ctx) {
-  const TCHAR* strings[] = {s1, s2};
-  LogEventHelper(type, id, arraysize(strings), strings, ctx);
-}
-
-inline void LogEventContext(WORD type, DWORD id, const TCHAR* s1,
-                            const TCHAR* s2, const TCHAR* s3,
-                            const TCHAR* ctx) {
-  const TCHAR* strings[] = {s1, s2, s3};
-  LogEventHelper(type, id, arraysize(strings), strings, ctx);
-}
-
-class EventLogger {
- public:
-  // Creates an event source for the "Application" log so that EventViewer can
-  // map event identifier codes to message strings.
-  static HRESULT AddEventSource(
-      const TCHAR* src_name,       // Event source name.
-      const TCHAR* msg_dll_path);  // Path for message DLL.
-
-  static HRESULT RemoveEventSource(
-      const TCHAR* src_name);      // Event source name.
-
-  // Writes an entry at the end of event log that contains the source name.
-  static HRESULT ReportEvent(
-      const TCHAR* src_name,       // Event source name.
-      WORD type,                   // Type of the event to be logged.
-      WORD category,               // Event category.
-      DWORD id,                    // Event identifier.
-      WORD count,                  // Count of insert strings.
-      const TCHAR** strings,       // Insert strings.
-      size_t buf_size,             // Size of binary data to append.
-      void* buffer);               // Buffer containing the binary data.
-
-  // Reads the topmost event log record.
-  static HRESULT ReadLastEvent(const TCHAR* src_name, EVENTLOGRECORD* rec);
-
-  // Default name for the event source.
-  static const TCHAR* const kSourceName;
-
-  // Default event category.
-  static const WORD kDefaultCategory = 0;
-};
-
-class GoogleUpdateLogEvent {
- public:
-  GoogleUpdateLogEvent(int type, int id, bool is_machine)
-      : type_(type),
-        id_(id),
-        is_machine_(is_machine) {}
-  GoogleUpdateLogEvent() : type_(0), id_(0), is_machine_(false) {}
-  ~GoogleUpdateLogEvent() {}
-  void WriteEvent();
-  void set_event_desc(const CString& desc) { event_desc_ = desc; }
-  void set_event_text(const CString& text) { event_text_ = text; }
-
- private:
-  CString event_desc_;
-  CString event_text_;
-  int type_;
-  int id_;
-  bool is_machine_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(GoogleUpdateLogEvent);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_EVENT_LOGGER_H_
-
diff --git a/common/event_logger_unittest.cc b/common/event_logger_unittest.cc
deleted file mode 100644
index 175a0e1..0000000
--- a/common/event_logger_unittest.cc
+++ /dev/null
@@ -1,182 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include <stdio.h>
-#include <stdarg.h>
-
-#include "base/basictypes.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/error.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/event_logger.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-class EventLoggerTest : public testing::Test {
- protected:
-  virtual void SetUp() {
-    EXPECT_SUCCEEDED(RegKey::DeleteKey(kRegistryHiveOverrideRoot, true));
-    OverrideRegistryHives(kRegistryHiveOverrideRoot);
-
-    // Enable logging of events.
-    DWORD log_events = LOG_EVENT_LEVEL_ALL;
-    EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                      kRegValueEventLogLevel, log_events));
-  }
-
-  virtual void TearDown() {
-    RestoreRegistryHives();
-    EXPECT_SUCCEEDED(RegKey::DeleteKey(kRegistryHiveOverrideRoot, true));
-  }
-};
-
-TEST_F(EventLoggerTest, AddEventSource) {
-  if (!vista_util::IsUserAdmin()) {
-    std::wcout << _T("\tTest did not run because the user is not an admin.")
-               << std::endl;
-    return;
-  }
-
-  // Registers the "Google Update" event source for the "Application" log
-  EXPECT_SUCCEEDED(EventLogger::AddEventSource(EventLogger::kSourceName,
-                                               _T("path")));
-
-  const TCHAR key_name[] = _T("HKLM\\SYSTEM\\CurrentControlSet\\Services\\")
-                           _T("EventLog\\Application\\")
-                           _T(OMAHA_APP_NAME_ANSI);
-  EXPECT_TRUE(RegKey::HasKey(key_name));
-
-  CString s;
-  EXPECT_SUCCEEDED(RegKey::GetValue(key_name, _T("EventMessageFile"), &s));
-  EXPECT_STREQ(s.GetString(), _T("path"));
-
-  DWORD types(0);
-  EXPECT_SUCCEEDED(RegKey::GetValue(key_name, _T("TypesSupported"), &types));
-  EXPECT_EQ(types,
-      EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE);
-
-  // Removes the "OmahaUnitTest" event source.
-  EXPECT_SUCCEEDED(EventLogger::RemoveEventSource(EventLogger::kSourceName));
-  EXPECT_FALSE(RegKey::HasKey(key_name));
-  EXPECT_TRUE(RegKey::HasKey(
-      _T("HKLM\\SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application")));
-}
-
-TEST_F(EventLoggerTest, ReportEvent) {
-  if (!vista_util::IsUserAdmin()) {
-    std::wcout << _T("\tTest did not run because the user is not an admin.")
-               << std::endl;
-    return;
-  }
-
-  EXPECT_SUCCEEDED(EventLogger::AddEventSource(EventLogger::kSourceName,
-                                               _T("path")));
-
-  const TCHAR* strings[] = {_T("foo"), _T("bar")};
-  byte buf[] = {0xaa, 0x55, 0};
-
-  const int kEventId = 100;
-  EXPECT_SUCCEEDED(EventLogger::ReportEvent(EventLogger::kSourceName,
-                                            EVENTLOG_WARNING_TYPE,
-                                            0,
-                                            kEventId,
-                                            arraysize(strings),
-                                            strings,
-                                            arraysize(buf),
-                                            buf));
-  // Read the record at the top to do a brief sanity check.
-  const size_t kBufferSize = 1024 * 64;
-  byte buffer[kBufferSize] = {0};
-  EVENTLOGRECORD* rec = reinterpret_cast<EVENTLOGRECORD*>(buffer);
-  rec->Length = kBufferSize;
-  EXPECT_SUCCEEDED(EventLogger::ReadLastEvent(EventLogger::kSourceName, rec));
-  EXPECT_EQ(rec->EventID, kEventId);
-  EXPECT_EQ(rec->EventType, EVENTLOG_WARNING_TYPE);
-  EXPECT_EQ(rec->EventCategory, 0);
-  EXPECT_EQ(rec->NumStrings, 2);
-  const TCHAR* src = reinterpret_cast<const TCHAR*>(
-      reinterpret_cast<byte*>(rec) + sizeof EVENTLOGRECORD);
-  EXPECT_STREQ(src, EventLogger::kSourceName);
-  const TCHAR* s2 = (LPTSTR) ((LPBYTE) rec + rec->StringOffset);
-  EXPECT_SUCCEEDED(EventLogger::RemoveEventSource(EventLogger::kSourceName));
-}
-
-TEST_F(EventLoggerTest, LogEvent_LoggingDisabled) {
-  // Disable logging.
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueEventLogLevel,
-                                    static_cast<DWORD>(0)));
-
-  const size_t kBufferSize = 1024 * 64;
-  byte buffer[kBufferSize] = {0};
-  EVENTLOGRECORD* rec = reinterpret_cast<EVENTLOGRECORD*>(buffer);
-  rec->Length = kBufferSize;
-  EXPECT_SUCCEEDED(EventLogger::ReadLastEvent(EventLogger::kSourceName, rec));
-  int record_number = rec->RecordNumber;
-
-  // Logging is disabled, expect no event is logged.
-  LogEvent(EVENTLOG_INFORMATION_TYPE, 10);
-  rec->Length = kBufferSize;
-  EXPECT_SUCCEEDED(EventLogger::ReadLastEvent(EventLogger::kSourceName, rec));
-  EXPECT_EQ(record_number, rec->RecordNumber);
-}
-
-TEST_F(EventLoggerTest, LogEvent) {
-  const size_t kBufferSize = 1024 * 64;
-  byte buffer[kBufferSize] = {0};
-  EVENTLOGRECORD* rec = reinterpret_cast<EVENTLOGRECORD*>(buffer);
-
-  LogEvent(EVENTLOG_INFORMATION_TYPE, 10);
-  rec->Length = kBufferSize;
-  EXPECT_SUCCEEDED(EventLogger::ReadLastEvent(EventLogger::kSourceName, rec));
-  EXPECT_EQ(10, rec->EventID);
-
-  LogEvent(EVENTLOG_INFORMATION_TYPE, 11, _T("s1"));
-  rec->Length = kBufferSize;
-  EXPECT_SUCCEEDED(EventLogger::ReadLastEvent(EventLogger::kSourceName, rec));
-  EXPECT_EQ(11, rec->EventID);
-
-  LogEvent(EVENTLOG_INFORMATION_TYPE, 12, _T("s1"), _T("s2"));
-  rec->Length = kBufferSize;
-  EXPECT_SUCCEEDED(EventLogger::ReadLastEvent(EventLogger::kSourceName, rec));
-  EXPECT_EQ(12, rec->EventID);
-}
-
-TEST_F(EventLoggerTest, LogEventContext) {
-  const size_t kBufferSize = 1024 * 64;
-  byte buffer[kBufferSize] = {0};
-  EVENTLOGRECORD* rec = reinterpret_cast<EVENTLOGRECORD*>(buffer);
-
-  LogEventContext(EVENTLOG_INFORMATION_TYPE, 20, _T("foo"));
-  rec->Length = kBufferSize;
-  EXPECT_SUCCEEDED(EventLogger::ReadLastEvent(EventLogger::kSourceName, rec));
-  EXPECT_EQ(20, rec->EventID);
-
-  LogEventContext(EVENTLOG_INFORMATION_TYPE, 21, _T("s1"), _T("bar"));
-  rec->Length = kBufferSize;
-  EXPECT_SUCCEEDED(EventLogger::ReadLastEvent(EventLogger::kSourceName, rec));
-  EXPECT_EQ(21, rec->EventID);
-
-  LogEventContext(EVENTLOG_INFORMATION_TYPE, 22,
-                  _T("s1"), _T("s2"), _T("foobar"));
-  rec->Length = kBufferSize;
-  EXPECT_SUCCEEDED(EventLogger::ReadLastEvent(EventLogger::kSourceName, rec));
-  EXPECT_EQ(22, rec->EventID);
-}
-
-}  // namespace omaha
diff --git a/common/experiment_labels.cc b/common/experiment_labels.cc
deleted file mode 100644
index ecf270e..0000000
--- a/common/experiment_labels.cc
+++ /dev/null
@@ -1,286 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Utility class to manage a set of experiment labels.  Experiment labels
-// are a set of key/value pairs used to track an install's "membership" in
-// A/B experiment groups issued by the Omaha server.  Keys are strings with
-// a limited character set (Perl \w, plus a few characters), while values
-// consist of a string and an expiration date.  Label sets are stored per-app
-// and transmitted to the server as part of requests (pings / update checks),
-// and a delta is potentially returned from the server with each response.
-//
-// Experiment labels are serialized with key/value separated by an equals, and
-// value/expiration by a pipe symbol; the expiration is represented in RFC822
-// format.  For example: "test_key=test_value|Fri, 14 Aug 2015 16:13:03 GMT".
-// If an app participates in multiple experiments simultaneously, labels are
-// concatenated with semicolon delimiters.
-
-#include "omaha/common/experiment_labels.h"
-
-#include "omaha/base/debug.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/common/app_registry_utils.h"
-
-namespace omaha {
-
-ExperimentLabels::ExperimentLabels() : labels_(), preserve_expired_(false) {}
-
-ExperimentLabels::~ExperimentLabels() {}
-
-int ExperimentLabels::NumLabels() const {
-  return labels_.size();
-}
-
-bool ExperimentLabels::ContainsKey(const CString& key) const {
-  ASSERT1(!key.IsEmpty());
-  return labels_.find(key) != labels_.end();
-}
-
-void ExperimentLabels::GetLabelByIndex(int index, CString* key, CString* value,
-                                       time64* expiration) const {
-  ASSERT1(index >= 0);
-  ASSERT1(static_cast<LabelMap::size_type>(index) < labels_.size());
-
-  LabelMap::const_iterator cit = labels_.begin();
-  std::advance(cit, static_cast<LabelMap::size_type>(index));
-  if (key) {
-    *key = cit->first;
-  }
-  if (value) {
-    *value = cit->second.first;
-  }
-  if (expiration) {
-    *expiration = cit->second.second;
-  }
-}
-
-bool ExperimentLabels::FindLabelByKey(const CString& key, CString* value,
-                                      time64* expiration) const {
-  ASSERT1(!key.IsEmpty());
-  LabelMap::const_iterator cit = labels_.find(key);
-  if (labels_.end() == cit) {
-    return false;
-  }
-
-  if (value) {
-    *value = cit->second.first;
-  }
-  if (expiration) {
-    *expiration = cit->second.second;
-  }
-  return true;
-}
-
-bool ExperimentLabels::SetLabel(const CString& key, const CString& value,
-                                time64 expiration) {
-  if (!IsLabelContentValid(key) || !IsLabelContentValid(value)) {
-    return false;
-  }
-  if (expiration < GetCurrent100NSTime() && !preserve_expired_) {
-    return false;
-  }
-  labels_[key] = std::make_pair(value, expiration);
-  return true;
-}
-
-bool ExperimentLabels::ClearLabel(const CString& key) {
-  LabelMap::iterator it = labels_.find(key);
-  if (labels_.end() == it) {
-    return false;
-  }
-  labels_.erase(it);
-  return true;
-}
-
-void ExperimentLabels::ExpireLabels() {
-  time64 current_time = GetCurrent100NSTime();
-  for (LabelMap::iterator it = labels_.begin(); it != labels_.end(); ++it) {
-    if (it->second.second < current_time) {
-      it = labels_.erase(it);
-      if (it == labels_.end()) {
-        break;
-      }
-    }
-  }
-}
-
-void ExperimentLabels::ClearAllLabels() {
-  labels_.clear();
-}
-
-CString ExperimentLabels::Serialize() const {
-  CString serialized;
-  time64 current_time = GetCurrent100NSTime();
-  for (LabelMap::const_iterator cit = labels_.begin();
-       cit != labels_.end();
-       ++cit) {
-    if (preserve_expired_ || cit->second.second >= current_time) {
-      if (!serialized.IsEmpty()) {
-        serialized.Append(L";");
-      }
-      FILETIME ft = {};
-      Time64ToFileTime(cit->second.second, &ft);
-      SafeCStringAppendFormat(&serialized, L"%s=%s|%s",
-                              cit->first,
-                              cit->second.first,
-                              ConvertTimeToGMTString(&ft));
-    }
-  }
-  return serialized;
-}
-
-bool ExperimentLabels::Deserialize(const CString& label_list) {
-  LabelMap new_labels;
-  if (DoDeserialize(&new_labels, label_list, preserve_expired_)) {
-    std::swap(labels_, new_labels);
-    return true;
-  }
-  return false;
-}
-
-bool ExperimentLabels::DeserializeAndApplyDelta(const CString& label_list) {
-  LabelMap merged_labels = labels_;
-  if (DoDeserialize(&merged_labels, label_list, false)) {
-    std::swap(labels_, merged_labels);
-    return true;
-  }
-  return false;
-}
-
-void ExperimentLabels::SetPreserveExpiredLabels(bool preserve) {
-  preserve_expired_ = preserve;
-}
-
-HRESULT ExperimentLabels::WriteToRegistry(bool is_machine,
-                                          const CString& app_id) {
-  return app_registry_utils::SetExperimentLabels(is_machine, app_id,
-                                                 Serialize());
-}
-
-HRESULT ExperimentLabels::ReadFromRegistry(bool is_machine,
-                                           const CString& app_id) {
-  CString label_list;
-  HRESULT hr = app_registry_utils::GetExperimentLabels(is_machine, app_id,
-                                                       &label_list);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  return Deserialize(label_list) ? S_OK : E_FAIL;
-}
-
-bool ExperimentLabels::IsStringValidLabelSet(const CString& label_list) {
-  ExperimentLabels labels;
-  return labels.Deserialize(label_list);
-}
-
-bool ExperimentLabels::IsLabelContentValid(const CString& str) {
-  if (str.IsEmpty()) {
-    return false;
-  }
-  for (int i = 0; i < str.GetLength(); ++i) {
-    wchar_t ch = str[i];
-    if (!((ch >= L'+' && ch <= L'-') ||
-          (ch >= L'0' && ch <= L':') ||
-          (ch >= L'A' && ch <= L'Z') ||
-          (ch >= L'a' && ch <= L'z') ||
-          (ch == L'_') || (ch == L' '))) {
-      return false;
-    }
-  }
-  return true;
-}
-
-bool ExperimentLabels::SplitCombinedLabel(const CString& combined, CString* key,
-                                          CString* value, time64* expiration) {
-  ASSERT1(!combined.IsEmpty());
-  ASSERT1(key);
-  ASSERT1(value);
-  ASSERT1(expiration);
-
-  int value_offset = combined.Find(L'=');
-  if (value_offset <= 0 || value_offset == combined.GetLength()) {
-    return false;
-  }
-  *key = combined.Left(value_offset);
-  if (!IsLabelContentValid(*key)) {
-    return false;
-  }
-  ++value_offset;
-
-  int expiration_offset = combined.Find(L'|', value_offset);
-  if (expiration_offset <= value_offset ||
-      expiration_offset == combined.GetLength()) {
-    return false;
-  }
-  *value = combined.Mid(value_offset, expiration_offset - value_offset);
-  if (!IsLabelContentValid(*value)) {
-    return false;
-  }
-  ++expiration_offset;
-
-  CString expiration_string = combined.Mid(expiration_offset);
-  if (!IsLabelContentValid(expiration_string)) {
-    return false;
-  }
-  SYSTEMTIME system_time = {};
-  if (!RFC822DateToSystemTime(expiration_string, &system_time, false)) {
-    return false;
-  }
-  *expiration = SystemTimeToTime64(&system_time);
-
-  return true;
-}
-
-bool ExperimentLabels::DoDeserialize(LabelMap* map, const CString& label_list,
-                                     bool accept_expired) {
-  ASSERT1(map);
-
-  if (label_list.IsEmpty()) {
-    return true;
-  }
-
-  time64 current_time = GetCurrent100NSTime();
-
-  for (int offset = 0;;) {
-    CString combined_label = label_list.Tokenize(L";", offset);
-    if (combined_label.IsEmpty()) {
-      if (offset < 0) {
-        break;  // Natural end-of-string reached.
-      }
-      return false;
-    }
-
-    CString key;
-    CString value;
-    time64 expiration = 0;
-    if (!SplitCombinedLabel(combined_label, &key, &value, &expiration)) {
-      return false;
-    }
-
-    // If the label is well-formatted but expired, we accept the input, but
-    // do not add it to the map and do not emit an error.  If there is already
-    // a label in the map with that key, delete it.
-    if (accept_expired || expiration > current_time) {
-      (*map)[key] = std::make_pair(value, expiration);
-    } else {
-      map->erase(key);
-    }
-  }
-
-  return true;
-}
-
-}  // namespace omaha
-
diff --git a/common/experiment_labels.h b/common/experiment_labels.h
deleted file mode 100644
index 66e3dfe..0000000
--- a/common/experiment_labels.h
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Utility class to manage a set of experiment labels.  Experiment labels
-// are a set of key/value pairs used to track an install's "membership" in
-// A/B experiment groups issued by the Omaha server.  Keys are strings with
-// a limited character set (Perl \w, plus a few characters), while values
-// consist of a string and an expiration date.  Label sets are stored per-app
-// and transmitted to the server as part of requests (pings / update checks),
-// and a delta is potentially returned from the server with each response.
-//
-// Experiment labels are serialized with key/value separated by an equals, and
-// value/expiration by a pipe symbol; the expiration is represented in RFC822
-// format.  For example: "test_key=test_value|Fri, 14 Aug 2015 16:13:03 GMT".
-// If an app participates in multiple experiments simultaneously, labels are
-// concatenated with semicolon delimiters.
-
-#ifndef OMAHA_COMMON_EXPERIMENT_LABELS_H_
-#define OMAHA_COMMON_EXPERIMENT_LABELS_H_
-
-#include <atlstr.h>
-
-#include <map>
-#include <utility>
-
-#include "base/basictypes.h"
-#include "omaha/base/time.h"
-
-namespace omaha {
-
-class ExperimentLabels {
- public:
-  ExperimentLabels();
-  ~ExperimentLabels();
-
-  // Returns the number of labels in the store.
-  int NumLabels() const;
-
-  // Returns true if a label with this key exists in the store.
-  bool ContainsKey(const CString& key) const;
-
-  // Returns the contents of the Nth label in the experiment set.  Output
-  // parameters are allowed to be NULL.  If index is out of range, asserts
-  // on a debug build.
-  //
-  // NOTE: This method is O(n), and indexes are not stable with respect to
-  // insertion order; it should not be called from any hot path.  Unit tests
-  // and diagnostic tools should use this to enumerate keys.
-  void GetLabelByIndex(int index,
-                       CString* key,
-                       CString* value,
-                       time64* expiration) const;
-
-  // If a label with this key exists, returns true and writes the value and
-  // expiration to the output parameters.  Output parameters are allowed
-  // to be NULL.  If no such key exists, returns false and leaves the outputs
-  // unchanged.
-  bool FindLabelByKey(const CString& key,
-                      CString* value,
-                      time64* expiration) const;
-
-  // Attempts to set a label in the store, either adding a new one or updating
-  // the value/expiration of an existing one.  Returns true on success.
-  bool SetLabel(const CString& key, const CString& value, time64 expiration);
-
-  // Clears a label in the store.  Returns true if a label with that key exists
-  // (it is removed); returns false if no label with that key exists.
-  bool ClearLabel(const CString& key);
-
-  // Removes any labels from the store whose expiration dates have passed.
-  void ExpireLabels();
-
-  // Removes all labels from the store.
-  void ClearAllLabels();
-
-  // Concatenates and emits all labels in the store in an XML-friendly format.
-  CString Serialize() const;
-
-  // Replaces the current contents of the store with new labels from an
-  // XML-friendly string.  On success, returns true; the store reflects the
-  // input exactly, with all prior contents are lost.  On failure, returns
-  // false and the store's contents are unchanged.
-  bool Deserialize(const CString& label_list);
-
-  // Applies the contents of a label list as a delta against the current
-  // contents of the store.  On success, returns true, and:
-  // * Any expired labels in the list are deleted from the store.
-  // * Unexpired labels in the list will be added to the store.  If any keys
-  //   already exist in the store, they are overwritten with the input.
-  // * Labels that are in the store but not in the input are left unmodified.
-  // On failure, returns false, and the store's contents are unchanged.
-  // This function's behavior is not modified by SetPreserveExpiredLabels()!
-  bool DeserializeAndApplyDelta(const CString& label_list);
-
-  // Modifies the store's handling of labels with expiration dates in the past.
-  // By default, SetLabel() will fail to add expired labels, Deserialize() will
-  // silently discard them, and Serialize() will not emit them.  Following a
-  // call to SetPreserveExpiredLabels(true), these functions will accept and/or
-  // include expired labels.
-  void SetPreserveExpiredLabels(bool preserve);
-
-  // Serializes a set of experiment labels to application data in the Registry.
-  HRESULT WriteToRegistry(bool is_machine, const CString& app_id);
-
-  // Deserializes a set of experiment labels from the Registry.
-  HRESULT ReadFromRegistry(bool is_machine, const CString& app_id);
-
-  // Returns true if the supplied string is a valid experiment label set.
-  static bool IsStringValidLabelSet(const CString& label_list);
-
- private:
-  typedef std::map<CString, std::pair<CString, time64> > LabelMap;
-
-  // Returns true if all characters are in the range [a-zA-Z0-9_\-+,: ].
-  // (Perl \w, plus the punctuation necessary for RFC822 dates.)
-  static bool IsLabelContentValid(const CString& str);
-
-  // Given an input string of the form "key=value|rfc822_date", converts it
-  // into separate key, value, and integer expiration dates.
-  static bool SplitCombinedLabel(const CString& combined,
-                                 CString* key,
-                                 CString* value,
-                                 time64* expiration);
-
-  // Splits an input string and applies it against an existing internal map.
-  static bool DoDeserialize(LabelMap* map,
-                            const CString& label_list,
-                            bool accept_expired);
-
-  LabelMap labels_;
-  bool preserve_expired_;
-
-  DISALLOW_COPY_AND_ASSIGN(ExperimentLabels);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_EXPERIMENT_LABELS_H_
-
diff --git a/common/experiment_labels_unittest.cc b/common/experiment_labels_unittest.cc
deleted file mode 100644
index 1cc0e50..0000000
--- a/common/experiment_labels_unittest.cc
+++ /dev/null
@@ -1,729 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/common/experiment_labels.h"
-#include "omaha/testing/resource.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-#define LABEL_DELIMITER_KV _T("=")
-#define LABEL_DELIMITER_EX _T("|")
-#define LABEL_DELIMITER_LA _T(";")
-
-#define LABELONE_KEY      _T("test_key_1")
-#define LABELONE_VALUE    _T("test_value_1")
-#define LABELONE_EXP_STR  _T("Fri, 14 Aug 2015 16:13:03 GMT")
-#define LABELONE_EXP_INT  130840423830000000uI64
-#define LABELONE_COMBINED LABELONE_KEY \
-                          LABEL_DELIMITER_KV \
-                          LABELONE_VALUE \
-                          LABEL_DELIMITER_EX \
-                          LABELONE_EXP_STR
-
-#define LABELTWO_KEY      _T("test_key_2")
-#define LABELTWO_VALUE    _T("test_value_2")
-#define LABELTWO_EXP_STR  _T("Thu, 27 Nov 2014 23:59:59 GMT")
-#define LABELTWO_EXP_INT  130616063990000000uI64
-#define LABELTWO_COMBINED LABELTWO_KEY \
-                          LABEL_DELIMITER_KV \
-                          LABELTWO_VALUE \
-                          LABEL_DELIMITER_EX \
-                          LABELTWO_EXP_STR
-
-#define LABELOLD_KEY      _T("test_key_old")
-#define LABELOLD_VALUE    _T("test_value_old")
-#define LABELOLD_EXP_STR  _T("Mon, 04 Jan 2010 08:00:00 GMT")
-#define LABELOLD_EXP_INT  129070656000000000uI64
-#define LABELOLD_COMBINED LABELOLD_KEY \
-                          LABEL_DELIMITER_KV \
-                          LABELOLD_VALUE \
-                          LABEL_DELIMITER_EX \
-                          LABELOLD_EXP_STR
-
-
-const TCHAR* const kLabelOneKey =      LABELONE_KEY;
-const TCHAR* const kLabelOneValue =    LABELONE_VALUE;
-const TCHAR* const kLabelOneExpStr =   LABELONE_EXP_STR;
-const time64       kLabelOneExpInt =   LABELONE_EXP_INT;
-const TCHAR* const kLabelOneCombined = LABELONE_COMBINED;
-
-const TCHAR* const kLabelTwoKey =      LABELTWO_KEY;
-const TCHAR* const kLabelTwoValue =    LABELTWO_VALUE;
-const TCHAR* const kLabelTwoExpStr =   LABELTWO_EXP_STR;
-const time64       kLabelTwoExpInt =   LABELTWO_EXP_INT;
-const TCHAR* const kLabelTwoCombined = LABELTWO_COMBINED;
-
-const TCHAR* const kLabelOldKey =      LABELOLD_KEY;
-const TCHAR* const kLabelOldValue =    LABELOLD_VALUE;
-const TCHAR* const kLabelOldExpStr =   LABELOLD_EXP_STR;
-const time64       kLabelOldExpInt =   LABELOLD_EXP_INT;
-const TCHAR* const kLabelOldCombined = LABELOLD_COMBINED;
-
-const TCHAR* const kLabelNewCombined = LABELONE_COMBINED
-                                       LABEL_DELIMITER_LA
-                                       LABELTWO_COMBINED;
-
-const TCHAR* const kLabelAllCombined = LABELONE_COMBINED
-                                       LABEL_DELIMITER_LA
-                                       LABELTWO_COMBINED
-                                       LABEL_DELIMITER_LA
-                                       LABELOLD_COMBINED;
-
-}  // end namespace
-
-TEST(ExperimentLabelsTest, Empty) {
-  ExperimentLabels el;
-
-  EXPECT_EQ(0, el.NumLabels());
-  EXPECT_FALSE(el.ContainsKey(kLabelOneKey));
-  EXPECT_FALSE(el.ContainsKey(kLabelTwoKey));
-  EXPECT_FALSE(el.ContainsKey(kLabelOldKey));
-  EXPECT_FALSE(el.FindLabelByKey(kLabelOneKey, NULL, NULL));
-  EXPECT_FALSE(el.FindLabelByKey(kLabelTwoKey, NULL, NULL));
-  EXPECT_FALSE(el.FindLabelByKey(kLabelOldKey, NULL, NULL));
-}
-
-TEST(ExperimentLabelsTest, BasicOperations) {
-  ExperimentLabels el;
-
-  EXPECT_EQ(0, el.NumLabels());
-  EXPECT_FALSE(el.ContainsKey(kLabelOneKey));
-  EXPECT_FALSE(el.ContainsKey(kLabelTwoKey));
-  EXPECT_FALSE(el.ContainsKey(kLabelOldKey));
-
-  // Start by adding a single label.
-  EXPECT_TRUE(el.SetLabel(kLabelOneKey, kLabelOneValue, kLabelOneExpInt));
-  EXPECT_EQ(1, el.NumLabels());
-  EXPECT_TRUE(el.ContainsKey(kLabelOneKey));
-  EXPECT_FALSE(el.ContainsKey(kLabelTwoKey));
-  EXPECT_FALSE(el.ContainsKey(kLabelOldKey));
-
-  // Add both future labels now.
-  EXPECT_TRUE(el.SetLabel(kLabelTwoKey, kLabelTwoValue, kLabelTwoExpInt));
-  EXPECT_EQ(2, el.NumLabels());
-  EXPECT_TRUE(el.ContainsKey(kLabelOneKey));
-  EXPECT_TRUE(el.ContainsKey(kLabelTwoKey));
-  EXPECT_FALSE(el.ContainsKey(kLabelOldKey));
-
-  // Clear the first label; it should not appear.
-  EXPECT_TRUE(el.ClearLabel(kLabelOneKey));
-  EXPECT_EQ(1, el.NumLabels());
-  EXPECT_FALSE(el.ContainsKey(kLabelOneKey));
-  EXPECT_TRUE(el.ContainsKey(kLabelTwoKey));
-  EXPECT_FALSE(el.ContainsKey(kLabelOldKey));
-
-  // ClearLabel should return false if the key isn't present.
-  EXPECT_FALSE(el.ClearLabel(kLabelOldKey));
-
-  // ClearAllLabels should clear all labels.
-  el.ClearAllLabels();
-  EXPECT_EQ(0, el.NumLabels());
-  EXPECT_FALSE(el.ContainsKey(kLabelOneKey));
-  EXPECT_FALSE(el.ContainsKey(kLabelTwoKey));
-  EXPECT_FALSE(el.ContainsKey(kLabelOldKey));
-}
-
-TEST(ExperimentLabelsTest, SetInvalidParameters) {
-  ExperimentLabels el;
-
-  // Verify that our core test parameters are okay by adding a key, then
-  // clearing all.
-  EXPECT_TRUE(el.SetLabel(kLabelOneKey, kLabelOneValue, kLabelOneExpInt));
-  el.ClearAllLabels();
-
-  // Don't allow zero length names or values, or expirations in the past.
-  EXPECT_FALSE(el.SetLabel(_T(""), kLabelOneValue, kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(kLabelOneKey, _T(""), kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(kLabelOneKey, kLabelOneValue, 0));
-
-  // Explicitly validate that names and values do not contain delimiters,
-  // quotes, angle brackets, question marks, or ampersands, as these could
-  // break parsing at the label-string, extraargs, or XML levels.
-  EXPECT_FALSE(el.SetLabel(_T("=test"), kLabelOneValue, kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(_T("te=st"), kLabelOneValue, kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(_T("test="), kLabelOneValue, kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(_T("|test"), kLabelOneValue, kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(_T("te|st"), kLabelOneValue, kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(_T("test|"), kLabelOneValue, kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(_T("test<"), kLabelOneValue, kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(_T("test>"), kLabelOneValue, kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(_T("test&"), kLabelOneValue, kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(_T("test?"), kLabelOneValue, kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(_T("test^"), kLabelOneValue, kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(_T("test'"), kLabelOneValue, kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(_T("test\""), kLabelOneValue, kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(kLabelOneKey, _T("=test"), kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(kLabelOneKey, _T("te=st"), kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(kLabelOneKey, _T("test="), kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(kLabelOneKey, _T("|test"), kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(kLabelOneKey, _T("te|st"), kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(kLabelOneKey, _T("test|"), kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(kLabelOneKey, _T("test<"), kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(kLabelOneKey, _T("test>"), kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(kLabelOneKey, _T("test&"), kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(kLabelOneKey, _T("test?"), kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(kLabelOneKey, _T("test^"), kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(kLabelOneKey, _T("test'"), kLabelOneExpInt));
-  EXPECT_FALSE(el.SetLabel(kLabelOneKey, _T("test\""), kLabelOneExpInt));
-  EXPECT_EQ(0, el.NumLabels());
-
-  // Allow an expiration in the past if and only if we override the default
-  // preserve-expired-labels setting.
-  el.SetPreserveExpiredLabels(true);
-  EXPECT_TRUE(el.SetLabel(kLabelOneKey, kLabelOneValue, kLabelOldExpInt));
-  EXPECT_EQ(1, el.NumLabels());
-}
-
-TEST(ExperimentLabelsTest, SetWillOverwrite) {
-  ExperimentLabels el;
-  CString value;
-  time64 expiration;
-
-  EXPECT_TRUE(el.SetLabel(kLabelOneKey, kLabelOneValue, kLabelOneExpInt));
-
-  EXPECT_EQ(1, el.NumLabels());
-  EXPECT_TRUE(el.FindLabelByKey(kLabelOneKey, &value, &expiration));
-  EXPECT_STREQ(value, kLabelOneValue);
-  EXPECT_EQ(expiration, kLabelOneExpInt);
-
-  EXPECT_TRUE(el.SetLabel(kLabelOneKey, kLabelTwoValue, kLabelTwoExpInt));
-
-  EXPECT_EQ(1, el.NumLabels());
-  EXPECT_TRUE(el.FindLabelByKey(kLabelOneKey, &value, &expiration));
-  EXPECT_STREQ(value, kLabelTwoValue);
-  EXPECT_EQ(expiration, kLabelTwoExpInt);
-}
-
-TEST(ExperimentLabelsTest, FindLabelByKey) {
-  ExperimentLabels el;
-  CString value;
-  time64 expiration;
-
-  EXPECT_TRUE(el.SetLabel(kLabelOneKey, kLabelOneValue, kLabelOneExpInt));
-  EXPECT_TRUE(el.SetLabel(kLabelTwoKey, kLabelTwoValue, kLabelTwoExpInt));
-  EXPECT_EQ(2, el.NumLabels());
-
-  // Safely return partial values if either or both out parameters are NULL.
-  EXPECT_TRUE(el.FindLabelByKey(kLabelOneKey, NULL, NULL));
-  EXPECT_TRUE(el.FindLabelByKey(kLabelOneKey, &value, NULL));
-  EXPECT_STREQ(value, kLabelOneValue);
-  EXPECT_TRUE(el.FindLabelByKey(kLabelOneKey, NULL, &expiration));
-  EXPECT_EQ(expiration, kLabelOneExpInt);
-
-  // Overwrite values if they already have values.
-  EXPECT_TRUE(el.FindLabelByKey(kLabelTwoKey, &value, &expiration));
-  EXPECT_STREQ(value, kLabelTwoValue);
-  EXPECT_EQ(expiration, kLabelTwoExpInt);
-
-  // If the key isn't present, return false; both out-params are unmodified.
-  EXPECT_FALSE(el.FindLabelByKey(kLabelOldKey, &value, &expiration));
-  EXPECT_STREQ(value, kLabelTwoValue);
-  EXPECT_EQ(expiration, kLabelTwoExpInt);
-}
-
-TEST(ExperimentLabelsTest, Serialize_Empty) {
-  ExperimentLabels el;
-
-  CString serialized = el.Serialize();
-  EXPECT_STREQ(serialized, _T(""));
-}
-
-TEST(ExperimentLabelsTest, Serialize_Single_Valid) {
-  ExperimentLabels el;
-
-  EXPECT_TRUE(el.SetLabel(kLabelOneKey, kLabelOneValue, kLabelOneExpInt));
-  EXPECT_EQ(1, el.NumLabels());
-
-  CString serialized = el.Serialize();
-  EXPECT_STREQ(serialized, kLabelOneCombined);
-}
-
-TEST(ExperimentLabelsTest, Serialize_Single_Expired) {
-  ExperimentLabels el;
-
-  el.SetPreserveExpiredLabels(true);
-  EXPECT_TRUE(el.SetLabel(kLabelOldKey, kLabelOldValue, kLabelOldExpInt));
-  EXPECT_EQ(1, el.NumLabels());
-
-  el.SetPreserveExpiredLabels(false);
-  CString serialized = el.Serialize();
-  EXPECT_STREQ(serialized, _T(""));
-
-  el.SetPreserveExpiredLabels(true);
-  serialized = el.Serialize();
-  EXPECT_STREQ(serialized, kLabelOldCombined);
-}
-
-TEST(ExperimentLabelsTest, Serialize_Multi_Valid) {
-  ExperimentLabels el;
-
-  EXPECT_TRUE(el.SetLabel(kLabelOneKey, kLabelOneValue, kLabelOneExpInt));
-  EXPECT_TRUE(el.SetLabel(kLabelTwoKey, kLabelTwoValue, kLabelTwoExpInt));
-  EXPECT_EQ(2, el.NumLabels());
-
-  CString serialized = el.Serialize();
-  EXPECT_STREQ(serialized, kLabelNewCombined);
-}
-
-TEST(ExperimentLabelsTest, Serialize_Multi_Valid_Expired) {
-  ExperimentLabels el;
-
-  el.SetPreserveExpiredLabels(true);
-  EXPECT_TRUE(el.SetLabel(kLabelOneKey, kLabelOneValue, kLabelOneExpInt));
-  EXPECT_TRUE(el.SetLabel(kLabelTwoKey, kLabelTwoValue, kLabelTwoExpInt));
-  EXPECT_TRUE(el.SetLabel(kLabelOldKey, kLabelOldValue, kLabelOldExpInt));
-  EXPECT_EQ(3, el.NumLabels());
-
-  el.SetPreserveExpiredLabels(false);
-  CString serialized = el.Serialize();
-  EXPECT_STREQ(serialized, kLabelNewCombined);
-
-  el.SetPreserveExpiredLabels(true);
-  serialized = el.Serialize();
-  EXPECT_STREQ(serialized, kLabelAllCombined);
-}
-
-
-TEST(ExperimentLabelsTest, Deserialize_EmptyString) {
-  ExperimentLabels el;
-
-  EXPECT_TRUE(el.Deserialize(_T("")));
-  EXPECT_EQ(0, el.NumLabels());
-}
-
-TEST(ExperimentLabelsTest, Deserialize_Single_Valid) {
-  ExperimentLabels el;
-
-  EXPECT_TRUE(el.Deserialize(kLabelOneCombined));
-  EXPECT_EQ(1, el.NumLabels());
-
-  CString key;
-  CString value;
-  time64 expiration;
-  el.GetLabelByIndex(0, &key, &value, &expiration);
-  EXPECT_STREQ(key, kLabelOneKey);
-  EXPECT_STREQ(value, kLabelOneValue);
-  EXPECT_EQ(expiration, kLabelOneExpInt);
-}
-
-TEST(ExperimentLabelsTest, Deserialize_Multi_Valid) {
-  ExperimentLabels el;
-
-  EXPECT_TRUE(el.Deserialize(kLabelNewCombined));
-  EXPECT_EQ(2, el.NumLabels());
-
-  CString key;
-  CString value;
-  time64 expiration;
-  el.GetLabelByIndex(0, &key, &value, &expiration);
-  EXPECT_STREQ(key, kLabelOneKey);
-  EXPECT_STREQ(value, kLabelOneValue);
-  EXPECT_EQ(expiration, kLabelOneExpInt);
-  el.GetLabelByIndex(1, &key, &value, &expiration);
-  EXPECT_STREQ(key, kLabelTwoKey);
-  EXPECT_STREQ(value, kLabelTwoValue);
-  EXPECT_EQ(expiration, kLabelTwoExpInt);
-}
-
-TEST(ExperimentLabelsTest, Deserialize_Single_Valid_Expired) {
-  ExperimentLabels el;
-
-  EXPECT_TRUE(el.Deserialize(kLabelOldCombined));
-  EXPECT_EQ(0, el.NumLabels());
-
-  el.SetPreserveExpiredLabels(true);
-  EXPECT_TRUE(el.Deserialize(kLabelOldCombined));
-  EXPECT_EQ(1, el.NumLabels());
-
-  CString key;
-  CString value;
-  time64 expiration;
-  el.GetLabelByIndex(0, &key, &value, &expiration);
-  EXPECT_STREQ(key, kLabelOldKey);
-  EXPECT_STREQ(value, kLabelOldValue);
-  EXPECT_EQ(expiration, kLabelOldExpInt);
-}
-
-TEST(ExperimentLabelsTest, Deserialize_Multi_Valid_Expired) {
-  ExperimentLabels el;
-
-  EXPECT_TRUE(el.Deserialize(kLabelAllCombined));
-  EXPECT_EQ(2, el.NumLabels());
-  EXPECT_TRUE(el.ContainsKey(kLabelOneKey));
-  EXPECT_TRUE(el.ContainsKey(kLabelTwoKey));
-  EXPECT_FALSE(el.ContainsKey(kLabelOldKey));
-
-  el.ClearAllLabels();
-
-  el.SetPreserveExpiredLabels(true);
-  EXPECT_TRUE(el.Deserialize(kLabelAllCombined));
-  EXPECT_EQ(3, el.NumLabels());
-  EXPECT_TRUE(el.ContainsKey(kLabelOneKey));
-  EXPECT_TRUE(el.ContainsKey(kLabelTwoKey));
-  EXPECT_TRUE(el.ContainsKey(kLabelOldKey));
-}
-
-TEST(ExperimentLabelsTest, Deserialize_Invalid_ZeroLengthKey) {
-  ExperimentLabels el;
-
-  // Base case: "=valid_value|valid_exp"
-  const TCHAR* const invalid_segment = LABEL_DELIMITER_KV
-                                       LABELONE_VALUE
-                                       LABEL_DELIMITER_EX
-                                       LABELONE_EXP_STR;
-  EXPECT_FALSE(el.Deserialize(invalid_segment));
-  EXPECT_EQ(0, el.NumLabels());
-
-  // Variant case 1: "=valid_value|valid_exp;valid_key=valid_value|valid_exp"
-  CString variant1 = invalid_segment;
-  variant1.Append(LABEL_DELIMITER_LA);
-  variant1.Append(LABELTWO_COMBINED);
-  EXPECT_FALSE(el.Deserialize(variant1));
-  EXPECT_EQ(0, el.NumLabels());
-
-  // Variant case 2: "valid_key=valid_value|valid_exp;=valid_value|valid_exp"
-  CString variant2 = LABELTWO_COMBINED;
-  variant2.Append(LABEL_DELIMITER_LA);
-  variant2.Append(invalid_segment);
-  EXPECT_FALSE(el.Deserialize(variant2));
-  EXPECT_EQ(0, el.NumLabels());
-}
-
-TEST(ExperimentLabelsTest, Deserialize_Invalid_ZeroLengthValue) {
-  ExperimentLabels el;
-
-  // Base case: "valid_key=|valid_exp"
-  const TCHAR* const invalid_segment = LABELONE_KEY
-                                       LABEL_DELIMITER_KV
-                                       LABEL_DELIMITER_EX
-                                       LABELONE_EXP_STR;
-  EXPECT_FALSE(el.Deserialize(invalid_segment));
-  EXPECT_EQ(0, el.NumLabels());
-
-  // Variant case 1: "valid_key=|valid_exp;valid_key=valid_value|valid_exp"
-  CString variant1 = invalid_segment;
-  variant1.Append(LABEL_DELIMITER_LA);
-  variant1.Append(LABELTWO_COMBINED);
-  EXPECT_FALSE(el.Deserialize(variant1));
-  EXPECT_EQ(0, el.NumLabels());
-
-  // Variant case 2: "valid_key=valid_value|valid_exp;valid_key=|valid_exp"
-  el.ClearAllLabels();
-  CString variant2 = LABELTWO_COMBINED;
-  variant2.Append(LABEL_DELIMITER_LA);
-  variant2.Append(invalid_segment);
-  EXPECT_FALSE(el.Deserialize(variant2));
-  EXPECT_EQ(0, el.NumLabels());
-}
-
-TEST(ExperimentLabelsTest, Deserialize_Invalid_ZeroLengthDate) {
-  ExperimentLabels el;
-
-  // Base case: "valid_key=valid_value|"
-  const TCHAR* const invalid_segment = LABELONE_KEY
-                                       LABEL_DELIMITER_KV
-                                       LABELONE_VALUE
-                                       LABEL_DELIMITER_EX;
-  EXPECT_FALSE(el.Deserialize(invalid_segment));
-  EXPECT_EQ(0, el.NumLabels());
-
-  // Variant case 1: "valid_key=valid_value|;valid_key=valid_value|valid_exp"
-  CString variant1 = invalid_segment;
-  variant1.Append(LABEL_DELIMITER_LA);
-  variant1.Append(LABELTWO_COMBINED);
-  EXPECT_FALSE(el.Deserialize(variant1));
-  EXPECT_EQ(0, el.NumLabels());
-
-  // Variant case 2: "valid_key=valid_value|valid_exp;valid_key=valid_value|"
-  CString variant2 = LABELTWO_COMBINED;
-  variant2.Append(LABEL_DELIMITER_LA);
-  variant2.Append(invalid_segment);
-  EXPECT_FALSE(el.Deserialize(variant2));
-  EXPECT_EQ(0, el.NumLabels());
-}
-
-TEST(ExperimentLabelsTest, Deserialize_Invalid_ExtraDelimiters) {
-  ExperimentLabels el;
-
-  // Repeated equals: "k==v|e"
-  EXPECT_FALSE(el.Deserialize(LABELONE_KEY
-                              LABEL_DELIMITER_KV
-                              LABEL_DELIMITER_KV
-                              LABELONE_VALUE
-                              LABEL_DELIMITER_EX
-                              LABELONE_EXP_STR));
-
-  // Repeated pipe: "k=v||e"
-  EXPECT_FALSE(el.Deserialize(LABELONE_KEY
-                              LABEL_DELIMITER_KV
-                              LABELONE_VALUE
-                              LABEL_DELIMITER_EX
-                              LABEL_DELIMITER_EX
-                              LABELONE_EXP_STR));
-
-  // Degenerate: "=|;=|"
-  EXPECT_FALSE(el.Deserialize(LABEL_DELIMITER_KV
-                              LABEL_DELIMITER_EX
-                              LABEL_DELIMITER_LA
-                              LABEL_DELIMITER_KV
-                              LABEL_DELIMITER_EX));
-
-  EXPECT_EQ(0, el.NumLabels());
-}
-
-TEST(ExperimentLabelsTest, Deserialize_Valid_ExtraLabelDelimiters) {
-  ExperimentLabels el;
-
-  // We support (but discourage) leading/trailing/repeated separators;
-  // for example, "k=v|e;;;;k=v|e" should cleanly parse (two keys), as
-  // should ";;;k=v|e" and "k=v|e;;;" (one key each) and ";;;;;" (no keys).
-
-  // Repeated separator: "k=v|e;;k=v|e"
-  EXPECT_TRUE(el.Deserialize(LABELONE_COMBINED
-                             LABEL_DELIMITER_LA
-                             LABEL_DELIMITER_LA
-                             LABELTWO_COMBINED));
-  EXPECT_EQ(2, el.NumLabels());
-  el.ClearAllLabels();
-
-  // Leading separator: ";k=v|e"
-  EXPECT_TRUE(el.Deserialize(LABEL_DELIMITER_LA LABELONE_COMBINED));
-  EXPECT_EQ(1, el.NumLabels());
-  el.ClearAllLabels();
-
-  // Trailing separator: "k=v|e;"
-  EXPECT_TRUE(el.Deserialize(LABELONE_COMBINED LABEL_DELIMITER_LA));
-  EXPECT_EQ(1, el.NumLabels());
-  el.ClearAllLabels();
-
-  // Degenerate: ";;;"
-  EXPECT_TRUE(el.Deserialize(LABEL_DELIMITER_LA
-                             LABEL_DELIMITER_LA
-                             LABEL_DELIMITER_LA));
-  EXPECT_EQ(0, el.NumLabels());
-}
-
-TEST(ExperimentLabelsTest, Deserialize_Invalid_MissingDelimiters) {
-  ExperimentLabels el;
-
-  // Missing all delimiters, single string (kve)
-  EXPECT_FALSE(el.Deserialize(LABELONE_KEY
-                              LABELONE_VALUE
-                              LABELONE_EXP_STR));
-
-  // Missing expiration delimiter, single string (k=ve)
-  EXPECT_FALSE(el.Deserialize(LABELONE_KEY
-                              LABEL_DELIMITER_KV
-                              LABELONE_VALUE
-                              LABELONE_EXP_STR));
-
-  // Missing value delimiter, single string (kv|e)
-  EXPECT_FALSE(el.Deserialize(LABELONE_KEY
-                              LABELONE_VALUE
-                              LABEL_DELIMITER_EX
-                              LABELONE_EXP_STR));
-
-  // Missing label delimiter, multi-label (k=v|ek=v|e)
-  EXPECT_FALSE(el.Deserialize(LABELONE_COMBINED LABELTWO_COMBINED));
-
-  // Missing value+exp delimiter, multi-label, first (kve;k=v|e)
-  EXPECT_FALSE(el.Deserialize(LABELONE_KEY
-                              LABELONE_VALUE
-                              LABELONE_EXP_STR
-                              LABEL_DELIMITER_LA
-                              LABELTWO_COMBINED));
-
-  // Missing value+exp delimiter, multi-label, second (k=v|e;kve)
-  EXPECT_FALSE(el.Deserialize(LABELONE_COMBINED
-                              LABEL_DELIMITER_LA
-                              LABELTWO_KEY
-                              LABELTWO_VALUE
-                              LABELTWO_EXP_STR));
-
-  // Missing value delimiter, multi-label, first (kv|e;k=v|e)
-  EXPECT_FALSE(el.Deserialize(LABELONE_KEY
-                              LABELONE_VALUE
-                              LABEL_DELIMITER_EX
-                              LABELONE_EXP_STR
-                              LABEL_DELIMITER_LA
-                              LABELTWO_COMBINED));
-
-  // Missing value delimiter, multi-label, second (k=v|e;kv|e)
-  EXPECT_FALSE(el.Deserialize(LABELONE_COMBINED
-                              LABEL_DELIMITER_LA
-                              LABELTWO_KEY
-                              LABELTWO_VALUE
-                              LABEL_DELIMITER_EX
-                              LABELTWO_EXP_STR));
-
-  // Missing expiration delimiter, multi-label, first (k=ve;k=v|e)
-  EXPECT_FALSE(el.Deserialize(LABELONE_KEY
-                              LABEL_DELIMITER_KV
-                              LABELONE_VALUE
-                              LABELONE_EXP_STR
-                              LABEL_DELIMITER_LA
-                              LABELTWO_COMBINED));
-
-  // Missing expiration delimiter, multi-label, second (k=v|e;k=ve)
-  EXPECT_FALSE(el.Deserialize(LABELONE_COMBINED
-                              LABEL_DELIMITER_LA
-                              LABELTWO_KEY
-                              LABEL_DELIMITER_KV
-                              LABELTWO_VALUE
-                              LABELTWO_EXP_STR));
-
-  EXPECT_EQ(0, el.NumLabels());
-}
-
-TEST(ExperimentLabelsTest, DeserializeAndApplyDelta_Append) {
-  ExperimentLabels el;
-
-  EXPECT_TRUE(el.SetLabel(kLabelOneKey, kLabelOneValue, kLabelOneExpInt));
-  EXPECT_EQ(1, el.NumLabels());
-  EXPECT_TRUE(el.DeserializeAndApplyDelta(kLabelTwoCombined));
-  EXPECT_EQ(2, el.NumLabels());
-
-  CString value;
-  time64 expiration;
-  EXPECT_TRUE(el.FindLabelByKey(kLabelOneKey, &value, &expiration));
-  EXPECT_STREQ(value, kLabelOneValue);
-  EXPECT_EQ(expiration, kLabelOneExpInt);
-  EXPECT_TRUE(el.FindLabelByKey(kLabelTwoKey, &value, &expiration));
-  EXPECT_STREQ(value, kLabelTwoValue);
-  EXPECT_EQ(expiration, kLabelTwoExpInt);
-}
-
-TEST(ExperimentLabelsTest, DeserializeAndApplyDelta_Append_Expired) {
-  ExperimentLabels el;
-
-  EXPECT_TRUE(el.SetLabel(kLabelOneKey, kLabelOneValue, kLabelOneExpInt));
-  EXPECT_EQ(1, el.NumLabels());
-  EXPECT_TRUE(el.ContainsKey(kLabelOneKey));
-  EXPECT_FALSE(el.ContainsKey(kLabelOldKey));
-
-  EXPECT_TRUE(el.DeserializeAndApplyDelta(kLabelOldCombined));
-  EXPECT_EQ(1, el.NumLabels());
-  EXPECT_TRUE(el.ContainsKey(kLabelOneKey));
-  EXPECT_FALSE(el.ContainsKey(kLabelOldKey));
-}
-
-TEST(ExperimentLabelsTest, DeserializeAndApplyDelta_Overwrite_Single) {
-  ExperimentLabels el;
-
-  EXPECT_TRUE(el.SetLabel(kLabelOneKey, kLabelOldValue, kLabelOneExpInt));
-  EXPECT_EQ(1, el.NumLabels());
-  EXPECT_TRUE(el.ContainsKey(kLabelOneKey));
-  EXPECT_FALSE(el.ContainsKey(kLabelTwoKey));
-
-  CString value;
-  time64 expiration;
-  EXPECT_TRUE(el.FindLabelByKey(kLabelOneKey, &value, &expiration));
-  EXPECT_STREQ(value, kLabelOldValue);
-  EXPECT_EQ(expiration, kLabelOneExpInt);
-
-  EXPECT_TRUE(el.DeserializeAndApplyDelta(kLabelOneCombined));
-  EXPECT_EQ(1, el.NumLabels());
-  EXPECT_TRUE(el.ContainsKey(kLabelOneKey));
-  EXPECT_FALSE(el.ContainsKey(kLabelTwoKey));
-
-  EXPECT_TRUE(el.FindLabelByKey(kLabelOneKey, &value, &expiration));
-  EXPECT_STREQ(value, kLabelOneValue);
-  EXPECT_EQ(expiration, kLabelOneExpInt);
-}
-
-TEST(ExperimentLabelsTest, DeserializeAndApplyDelta_Overwrite_Multi) {
-  ExperimentLabels el;
-
-  EXPECT_TRUE(el.SetLabel(kLabelOneKey, kLabelOldValue, kLabelOneExpInt));
-  EXPECT_EQ(1, el.NumLabels());
-  EXPECT_TRUE(el.ContainsKey(kLabelOneKey));
-  EXPECT_FALSE(el.ContainsKey(kLabelTwoKey));
-
-  EXPECT_TRUE(el.DeserializeAndApplyDelta(kLabelNewCombined));
-  EXPECT_EQ(2, el.NumLabels());
-  EXPECT_TRUE(el.ContainsKey(kLabelOneKey));
-  EXPECT_TRUE(el.ContainsKey(kLabelTwoKey));
-
-  CString value;
-  time64 expiration;
-  EXPECT_TRUE(el.FindLabelByKey(kLabelOneKey, &value, &expiration));
-  EXPECT_STREQ(value, kLabelOneValue);
-  EXPECT_EQ(expiration, kLabelOneExpInt);
-  EXPECT_TRUE(el.FindLabelByKey(kLabelTwoKey, &value, &expiration));
-  EXPECT_STREQ(value, kLabelTwoValue);
-  EXPECT_EQ(expiration, kLabelTwoExpInt);
-}
-
-TEST(ExperimentLabelsTest, DeserializeAndApplyDelta_Overwrite_Single_Expired) {
-  ExperimentLabels el;
-
-  EXPECT_TRUE(el.SetLabel(kLabelOldKey, kLabelOldValue, kLabelOneExpInt));
-  EXPECT_TRUE(el.SetLabel(kLabelTwoKey, kLabelTwoValue, kLabelTwoExpInt));
-  EXPECT_EQ(2, el.NumLabels());
-  EXPECT_TRUE(el.ContainsKey(kLabelOldKey));
-  EXPECT_TRUE(el.ContainsKey(kLabelTwoKey));
-
-  EXPECT_TRUE(el.DeserializeAndApplyDelta(kLabelOldCombined));
-  EXPECT_EQ(1, el.NumLabels());
-  EXPECT_FALSE(el.ContainsKey(kLabelOldKey));
-  EXPECT_TRUE(el.ContainsKey(kLabelTwoKey));
-}
-
-TEST(ExperimentLabelsTest, DeserializeAndApplyDelta_Overwrite_Multi_Expired) {
-  ExperimentLabels el;
-
-  EXPECT_TRUE(el.SetLabel(kLabelOneKey, kLabelTwoValue, kLabelOneExpInt));
-  EXPECT_TRUE(el.SetLabel(kLabelTwoKey, kLabelOneValue, kLabelTwoExpInt));
-  EXPECT_TRUE(el.SetLabel(kLabelOldKey, kLabelOldValue, kLabelOneExpInt));
-  EXPECT_EQ(3, el.NumLabels());
-  EXPECT_TRUE(el.ContainsKey(kLabelOneKey));
-  EXPECT_TRUE(el.ContainsKey(kLabelTwoKey));
-  EXPECT_TRUE(el.ContainsKey(kLabelOldKey));
-
-  EXPECT_TRUE(el.DeserializeAndApplyDelta(kLabelAllCombined));
-  EXPECT_EQ(2, el.NumLabels());
-  EXPECT_TRUE(el.ContainsKey(kLabelOneKey));
-  EXPECT_TRUE(el.ContainsKey(kLabelTwoKey));
-  EXPECT_FALSE(el.ContainsKey(kLabelOldKey));
-}
-
-TEST(ExperimentLabelsTest, Expire) {
-  ExperimentLabels el;
-
-  el.SetPreserveExpiredLabels(true);
-  EXPECT_TRUE(el.SetLabel(kLabelOneKey, kLabelOneValue, kLabelOneExpInt));
-  EXPECT_TRUE(el.SetLabel(kLabelTwoKey, kLabelTwoValue, kLabelTwoExpInt));
-  EXPECT_TRUE(el.SetLabel(kLabelOldKey, kLabelOldValue, kLabelOldExpInt));
-  EXPECT_EQ(3, el.NumLabels());
-
-  el.ExpireLabels();
-  EXPECT_EQ(2, el.NumLabels());
-  EXPECT_TRUE(el.ContainsKey(kLabelOneKey));
-  EXPECT_TRUE(el.ContainsKey(kLabelTwoKey));
-  EXPECT_FALSE(el.ContainsKey(kLabelOldKey));
-
-  EXPECT_TRUE(el.SetLabel(kLabelOneKey, kLabelOneValue, kLabelOldExpInt));
-  el.ExpireLabels();
-  EXPECT_EQ(1, el.NumLabels());
-  EXPECT_FALSE(el.ContainsKey(kLabelOneKey));
-  EXPECT_TRUE(el.ContainsKey(kLabelTwoKey));
-  EXPECT_FALSE(el.ContainsKey(kLabelOldKey));
-}
-
-}  // namespace omaha
-
diff --git a/common/extra_args_parser.cc b/common/extra_args_parser.cc
deleted file mode 100644
index f6658a5..0000000
--- a/common/extra_args_parser.cc
+++ /dev/null
@@ -1,319 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/common/extra_args_parser.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/command_line.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/goopdate_utils.h"
-
-namespace omaha {
-
-namespace {
-
-HRESULT ConvertUtf8UrlEncodedString(const CString& encoded_string,
-                                    CString* unencoded_string) {
-  CString trimmed_val = encoded_string;
-  trimmed_val.Trim();
-  if (trimmed_val.IsEmpty()) {
-    return E_INVALIDARG;
-  }
-
-  // The value is a utf8 encoded url escaped string that is stored as a
-  // unicode string, convert it into a wide string.
-  CString app_name;
-  HRESULT hr = Utf8UrlEncodedStringToWideString(trimmed_val, unencoded_string);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT Validate(const TCHAR* extra_args) {
-  CString extra_args_str(extra_args);
-  if (extra_args_str.IsEmpty()) {
-    return E_INVALIDARG;
-  }
-
-  if (-1 != extra_args_str.FindOneOf(kDisallowedCharsInExtraArgs)) {
-    // A '/' was found in the "extra" arguments or "extra" arguments were
-    // not specified before the next command.
-    return E_INVALIDARG;
-  }
-
-  return S_OK;
-}
-
-// Handles tokens from the app arguments string.
-HRESULT HandleAppArgsToken(const CString& token,
-                           CommandLineExtraArgs* args,
-                           int* cur_app_args_index) {
-  ASSERT1(args);
-  ASSERT1(cur_app_args_index);
-  ASSERT1(*cur_app_args_index < static_cast<int>(args->apps.size()));
-
-  CString name;
-  CString value;
-  if (!ParseNameValuePair(token, kNameValueSeparatorChar, &name, &value)) {
-    return E_INVALIDARG;
-  }
-
-  if (name.CompareNoCase(kExtraArgAppGuid) == 0) {
-    *cur_app_args_index = -1;
-    for (size_t i = 0; i < args->apps.size(); ++i) {
-      if (!value.CompareNoCase(GuidToString(args->apps[i].app_guid))) {
-        *cur_app_args_index = i;
-        break;
-      }
-    }
-
-    if (-1 == *cur_app_args_index) {
-      return E_INVALIDARG;
-    }
-  } else if (name.CompareNoCase(kExtraArgInstallerData) == 0) {
-    if (-1 == *cur_app_args_index) {
-      return E_INVALIDARG;
-    }
-    args->apps[*cur_app_args_index].encoded_installer_data = value;
-  } else {
-    // Unrecognized token
-    return E_INVALIDARG;
-  }
-
-  return S_OK;
-}
-
-HRESULT ParseAppArgs(const TCHAR* app_args, CommandLineExtraArgs* args) {
-  if (!app_args || !*app_args) {
-    return S_OK;
-  }
-
-  HRESULT hr = Validate(app_args);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  int cur_app_args_index = -1;
-  int pos = 0;
-  CString input_str = app_args;
-  CString token = input_str.Tokenize(kExtraArgsSeparators, pos);
-  while (!token.IsEmpty()) {
-    hr = HandleAppArgsToken(token, args, &cur_app_args_index);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    token = input_str.Tokenize(kExtraArgsSeparators, pos);
-  }
-
-  return S_OK;
-}
-
-HRESULT StringToNeedsAdmin(const TCHAR* str, NeedsAdmin* value) {
-  ASSERT1(str);
-  ASSERT1(value);
-
-  const TCHAR* const kFalse   = _T("false");
-  const TCHAR* const kTrue    = _T("true");
-  const TCHAR* const kPrefers = _T("prefers");
-
-  if (_tcsicmp(kFalse, str) == 0) {
-    *value = NEEDS_ADMIN_NO;
-  } else if (_tcsicmp(kTrue, str) == 0) {
-    *value = NEEDS_ADMIN_YES;
-  } else if (_tcsicmp(kPrefers, str) == 0) {
-    *value = NEEDS_ADMIN_PREFERS;
-  } else {
-    return E_INVALIDARG;
-  }
-  return S_OK;
-}
-
-}  // namespace
-
-// If no bundle name is specified, the first app's name is used.
-// TODO(omaha): There is no enforcement of required or optional values of
-// the extra arguments. Come up with a way to enforce this.
-// TODO(omaha): If we prefix extra_args with '/' and replace all '=' with ' '
-// and all & with '/' then we should be able to use the CommandLineParser
-// class to pull out the values here.  We'd need to define scenarios for all
-// permutations of ExtraArgs, but this shouldn't be difficult to get the right
-// ones.
-
-HRESULT ExtraArgsParser::Parse(const TCHAR* extra_args,
-                               const TCHAR* app_args,
-                               CommandLineExtraArgs* args) {
-  HRESULT hr = ParseExtraArgs(extra_args, args);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return ParseAppArgs(app_args, args);
-}
-
-HRESULT ExtraArgsParser::ParseExtraArgs(const TCHAR* extra_args,
-                                        CommandLineExtraArgs* args) {
-  HRESULT hr = Validate(extra_args);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  first_app_ = true;
-  int pos = 0;
-  CString input_str(extra_args);
-  CString token = input_str.Tokenize(kExtraArgsSeparators, pos);
-  while (!token.IsEmpty()) {
-    CORE_LOG(L2, (_T("[ExtraArgsParser::Parse][token=%s]"), token));
-    hr = HandleToken(token, args);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    // Continue parsing
-    token = input_str.Tokenize(kExtraArgsSeparators, pos);
-  }
-
-  // Save the arguments for the last application.
-  args->apps.push_back(cur_extra_app_args_);
-
-  ASSERT1(!(args->runtime_only && args->apps[0].app_guid != GUID_NULL));
-
-  if (args->bundle_name.IsEmpty()) {
-    ASSERT1(!args->apps.empty());
-    args->bundle_name = args->apps[0].app_name;
-  }
-
-  return S_OK;
-}
-
-// Handles tokens from the extra arguments string.
-HRESULT ExtraArgsParser::HandleToken(const CString& token,
-                                     CommandLineExtraArgs* args) {
-  CString name;
-  CString value;
-  if (!ParseNameValuePair(token, kNameValueSeparatorChar, &name, &value)) {
-    return E_INVALIDARG;
-  }
-
-  // The first set of args apply to all apps. They may occur at any point, but
-  // only the last occurrence is recorded.
-  if (name.CompareNoCase(kExtraArgBundleName) == 0) {
-    if (value.GetLength() > kMaxNameLength) {
-      return E_INVALIDARG;
-    }
-    HRESULT hr = ConvertUtf8UrlEncodedString(value,
-                                             &args->bundle_name);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  } else if (name.CompareNoCase(kExtraArgInstallationId) == 0) {
-    ASSERT1(!value.IsEmpty());
-    if (FAILED(StringToGuidSafe(value, &args->installation_id))) {
-      return E_INVALIDARG;
-    }
-  } else if (name.CompareNoCase(kExtraArgBrandCode) == 0) {
-    if (value.GetLength() > kBrandIdLength) {
-      return E_INVALIDARG;
-    }
-    args->brand_code = value;
-  } else if (name.CompareNoCase(kExtraArgClientId) == 0) {
-    args->client_id = value;
-  } else if (name.CompareNoCase(kExtraArgOmahaExperimentLabels) == 0) {
-    HRESULT hr = ConvertUtf8UrlEncodedString(value,
-                                             &args->experiment_labels);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  } else if (name.CompareNoCase(kExtraArgReferralId) == 0) {
-    args->referral_id = value;
-  } else if (name.CompareNoCase(kExtraArgBrowserType) == 0) {
-    BrowserType type = BROWSER_UNKNOWN;
-    if (SUCCEEDED(goopdate_utils::ConvertStringToBrowserType(value, &type))) {
-      args->browser_type = type;
-    }
-  } else if (name.CompareNoCase(kExtraArgLanguage) == 0) {
-    if (value.GetLength() > kLangMaxLength) {
-      return E_INVALIDARG;
-    }
-    // Even if we don't support the language, we want to pass it to the
-    // installer. Omaha will pick its language later. See http://b/1336966.
-    args->language = value;
-  } else if (name.CompareNoCase(kExtraArgUsageStats) == 0) {
-    if (!String_StringToTristate(value, &args->usage_stats_enable)) {
-      return E_INVALIDARG;
-    }
-  } else if (name.CompareNoCase(kExtraArgRuntime) == 0) {
-    if (!args->apps.empty() || cur_extra_app_args_.app_guid != GUID_NULL) {
-      return E_INVALIDARG;
-    }
-    args->runtime_only = true;
-
-  // The following args are per-app.
-  } else if (name.CompareNoCase(kExtraArgAdditionalParameters) == 0) {
-    cur_extra_app_args_.ap = value;
-  } else if (name.CompareNoCase(kExtraArgTTToken) == 0) {
-    cur_extra_app_args_.tt_token = value;
-  } else if (name.CompareNoCase(kExtraArgExperimentLabels) == 0) {
-    HRESULT hr = ConvertUtf8UrlEncodedString(
-        value,
-        &cur_extra_app_args_.experiment_labels);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  } else if (name.CompareNoCase(kExtraArgAppGuid) == 0) {
-    if (!first_app_) {
-      // Save the arguments for the application we have been processing.
-      args->apps.push_back(cur_extra_app_args_);
-    }
-    cur_extra_app_args_ = CommandLineAppArgs();
-
-    HRESULT hr = StringToGuidSafe(value, &cur_extra_app_args_.app_guid);
-    if (FAILED(hr)) {
-      return hr;
-    }
-    if (cur_extra_app_args_.app_guid == GUID_NULL || args->runtime_only) {
-      return E_INVALIDARG;
-    }
-    first_app_ = false;
-  } else if (name.CompareNoCase(kExtraArgAppName) == 0) {
-    if (value.GetLength() > kMaxNameLength) {
-      return E_INVALIDARG;
-    }
-    HRESULT hr = ConvertUtf8UrlEncodedString(value,
-                                             &cur_extra_app_args_.app_name);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  } else if (name.CompareNoCase(kExtraArgNeedsAdmin) == 0) {
-    if (FAILED(StringToNeedsAdmin(value, &cur_extra_app_args_.needs_admin))) {
-      return E_INVALIDARG;
-    }
-  } else if (name.CompareNoCase(kExtraArgInstallDataIndex) == 0) {
-    cur_extra_app_args_.install_data_index = value;
-  } else {
-    // Unrecognized token
-    return E_INVALIDARG;
-  }
-
-  return S_OK;
-}
-
-}  // namespace omaha
diff --git a/common/extra_args_parser.h b/common/extra_args_parser.h
deleted file mode 100644
index 797ce72..0000000
--- a/common/extra_args_parser.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_EXTRA_ARGS_PARSER_H__
-#define OMAHA_COMMON_EXTRA_ARGS_PARSER_H__
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-#include "omaha/common/command_line.h"
-
-namespace omaha {
-
-// This class handles tokenizing and parsing the ExtraArgs portion of the
-// command line.
-// The format of the extra arguments is as follows:
-// appguid={}&.....appguid={}....
-// appguid has to be the first value of the extra arguments.
-// Each appguid defines one product.
-class ExtraArgsParser {
- public:
-  ExtraArgsParser() : first_app_(false) {}
-
-  // Parses the extra_args (the tag) and app_args (/appargs) strings, storing
-  // the results in args.
-  HRESULT Parse(const TCHAR* extra_args,
-                const TCHAR* app_args,
-                CommandLineExtraArgs* args);
-
- private:
-  HRESULT ParseExtraArgs(const TCHAR* extra_args, CommandLineExtraArgs* args);
-
-  // Performs validation against extra_args and if it's valid, stores the
-  // extra_args value into args->extra_args.
-  HRESULT HandleToken(const CString& token, CommandLineExtraArgs* args);
-
-  CommandLineAppArgs cur_extra_app_args_;
-  bool first_app_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(ExtraArgsParser);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_EXTRA_ARGS_PARSER_H__
diff --git a/common/extra_args_parser_unittest.cc b/common/extra_args_parser_unittest.cc
deleted file mode 100644
index 00f96a2..0000000
--- a/common/extra_args_parser_unittest.cc
+++ /dev/null
@@ -1,1663 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/command_line.h"
-#include "omaha/common/extra_args_parser.h"
-#include "omaha/testing/resource.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-extern void VerifyCommandLineArgs(const CommandLineArgs& expected,
-                                  const CommandLineArgs& actual);
-
-extern void VerifyCommandLineExtraArgs(const CommandLineExtraArgs& expected,
-                                       const CommandLineExtraArgs& actual);
-
-void VerifyBrowserType(const CommandLineExtraArgs& args,
-                       const CString& app_guid,
-                       BrowserType type) {
-  CommandLineAppArgs app_args;
-  app_args.app_guid = StringToGuid(app_guid);
-
-  CommandLineExtraArgs expected;
-  expected.browser_type = type;
-  expected.apps.push_back(app_args);
-
-  VerifyCommandLineExtraArgs(expected, args);
-}
-
-// TODO(omaha): Consider eliminating most uses of this method. The tests will
-// actually be less lines now that the parameters have grown so much.
-void VerifyExtraArgsHaveSpecificValues(
-         const CommandLineExtraArgs& args,
-         const CString& expected_app_guid,
-         const CString& expected_app_name,
-         const CString& expected_app_experiment_labels,
-         NeedsAdmin expected_needs_admin,
-         Tristate expected_usage_stats_enable,
-         bool expected_runtime_only,
-         const CString& expected_bundle_name,
-         const GUID& expected_installation_id,
-         const CString& expected_brand_code,
-         const CString& expected_client_id,
-         const CString& expected_omaha_experiment_labels,
-         const CString& expected_referral_id,
-         const CString& expected_ap,
-         const CString& expected_tt,
-         const CString& expected_encoded_installer_data,
-         const CString& expected_install_data_index) {
-  CommandLineAppArgs app_args;
-  app_args.app_guid = StringToGuid(expected_app_guid);
-  app_args.app_name = expected_app_name;
-  app_args.needs_admin = expected_needs_admin;
-  app_args.ap = expected_ap;
-  app_args.tt_token = expected_tt;
-  app_args.encoded_installer_data = expected_encoded_installer_data;
-  app_args.install_data_index = expected_install_data_index;
-  app_args.experiment_labels = expected_app_experiment_labels;
-
-  CommandLineExtraArgs expected;
-  expected.apps.push_back(app_args);
-  expected.bundle_name = expected_bundle_name;
-  expected.installation_id = expected_installation_id;
-  expected.brand_code = expected_brand_code;
-  expected.client_id = expected_client_id;
-  expected.experiment_labels = expected_omaha_experiment_labels;
-  expected.referral_id = expected_referral_id;
-  expected.usage_stats_enable = expected_usage_stats_enable;
-  expected.runtime_only = expected_runtime_only;
-
-  VerifyCommandLineExtraArgs(expected, args);
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsInvalidValueNameIsSupersetOfValidName) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={D0324988-DA8A-49e5-BCE5-925FCD04EAB7}&")
-                       _T("appname1=Hello");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsAppNameSpaceForValue) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={D0324988-DA8A-49e5-BCE5-925FCD04EAB7}&")
-                       _T("appname= ");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsAppNameValid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-
-  CString app_guid = _T("{D0324988-DA8A-49e5-BCE5-925FCD04EAB7}");
-  CString extra_args = _T("appguid={D0324988-DA8A-49e5-BCE5-925FCD04EAB7}&")
-                       _T("appname=Test");
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-
-  CommandLineAppArgs app_args;
-
-  app_args.app_name = _T("Test");
-  app_args.app_guid = StringToGuid(app_guid);
-  CommandLineExtraArgs expected;
-  expected.apps.push_back(app_args);
-  expected.bundle_name = _T("Test");
-
-  VerifyCommandLineExtraArgs(expected, args);
-}
-
-// This must work because the enterprise MSI code assumes spaces are allowed.
-TEST(ExtraArgsParserTest, ExtraArgumentsAppNameWithSpace) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={D0324988-DA8A-49e5-BCE5-925FCD04EAB7}&")
-                       _T("appname=Test App");
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-
-  CommandLineAppArgs app_args;
-  app_args.app_guid =
-      StringToGuid(_T("{D0324988-DA8A-49e5-BCE5-925FCD04EAB7}"));
-  app_args.app_name = _T("Test App");
-
-  CommandLineExtraArgs expected;
-  expected.apps.push_back(app_args);
-  expected.bundle_name = _T("Test App");
-
-  VerifyCommandLineExtraArgs(expected, args);
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsAppNameWithSpaceAtEnd) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={D0324988-DA8A-49e5-BCE5-925FCD04EAB7}&")
-                       _T("appname= T Ap p ");
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-
-  CommandLineAppArgs app_args;
-  app_args.app_guid =
-      StringToGuid(_T("{D0324988-DA8A-49e5-BCE5-925FCD04EAB7}"));
-  app_args.app_name = _T("T Ap p");
-
-  CommandLineExtraArgs expected;
-  expected.apps.push_back(app_args);
-  expected.bundle_name = _T("T Ap p");
-
-  VerifyCommandLineExtraArgs(expected, args);
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsAppNameWithMultipleSpaces) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={D0324988-DA8A-49e5-BCE5-925FCD04EAB7}&")
-                       _T("appname= T Ap p");
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-
-  CommandLineAppArgs app_args;
-  app_args.app_guid =
-      StringToGuid(_T("{D0324988-DA8A-49e5-BCE5-925FCD04EAB7}"));
-  app_args.app_name = _T("T Ap p");
-
-  CommandLineExtraArgs expected;
-  expected.apps.push_back(app_args);
-  expected.bundle_name = _T("T Ap p");
-
-  VerifyCommandLineExtraArgs(expected, args);
-}
-
-// The size of the application name is limited to 512 wide chars.
-TEST(ExtraArgsParserTest, ExtraArgumentsAppNameTooLong) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString str(_T('a'), 513);
-  CString extra_args;
-  extra_args.Format(_T("appguid={D0324988-DA8A-49e5-BCE5-925FCD04EAB7}&")
-                    _T("appname=%s"), str);
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsAppNameUnicode) {
-  // Read the non-ascii string from the resources, and convert
-  // it into a utf8 encoded, url escaped string.
-  CString non_ascii_name;
-  ASSERT_TRUE(non_ascii_name.LoadString(IDS_ESCAPE_TEST));
-
-  CString wide_tag;
-  ASSERT_HRESULT_SUCCEEDED(WideStringToUtf8UrlEncodedString(non_ascii_name,
-                                                            &wide_tag));
-
-  ExtraArgsParser parser;
-  CommandLineExtraArgs args;
-  CString extra_args;
-  extra_args.Format(_T("appguid={D0324988-DA8A-49e5-BCE5-925FCD04EAB7}&")
-                    _T("appname=%s"), wide_tag);
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-
-  CommandLineAppArgs app_args;
-  app_args.app_name = non_ascii_name;
-  app_args.app_guid =
-      StringToGuid(_T("{D0324988-DA8A-49e5-BCE5-925FCD04EAB7}"));
-
-  CommandLineExtraArgs expected;
-  expected.apps.push_back(app_args);
-  expected.bundle_name = non_ascii_name;
-
-  VerifyCommandLineExtraArgs(expected, args);
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsAppNameUnicode2) {
-  // Read the non-ascii string from the resources, and convert
-  // it into a utf8 encoded, url escaped string.
-  CString non_ascii_name;
-  ASSERT_TRUE(non_ascii_name.LoadString(IDS_ESCAPE_TEST1));
-
-  CString escaped(_T("%E0%A4%B8%E0%A5%8D%E0%A4%A5%E0%A4%BE%E0%A4%AA%E0%A4%BF")
-                  _T("%E0%A4%A4%20%E0%A4%95%E0%A4%B0%20%E0%A4%B0%E0%A4%B9%E0")
-                  _T("%A4%BE%20%E0%A4%B9%E0%A5%88%E0%A5%A4"));
-
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-
-  CString extra_args;
-  extra_args.Format(_T("appguid={D0324988-DA8A-49e5-BCE5-925FCD04EAB7}&")
-                    _T("appname=%s"), escaped);
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-
-  CommandLineAppArgs app_args;
-  app_args.app_name = non_ascii_name;
-  app_args.app_guid =
-      StringToGuid(_T("{D0324988-DA8A-49e5-BCE5-925FCD04EAB7}"));
-
-  CommandLineExtraArgs expected;
-  expected.apps.push_back(app_args);
-  expected.bundle_name = non_ascii_name;
-
-  VerifyCommandLineExtraArgs(expected, args);
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsAppGuidValid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}");
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-
-  CommandLineAppArgs app_args;
-  const GUID guid = {0x8617EE50, 0xF91C, 0x4DC1,
-                          {0xB9, 0x37, 0x09, 0x69, 0xEE, 0xF5, 0x9B, 0x0B}};
-  app_args.app_guid = guid;
-
-  CommandLineExtraArgs expected;
-  expected.apps.push_back(app_args);
-
-  VerifyCommandLineExtraArgs(expected, args);
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsAppGuidNotAValidGuid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0}");
-  EXPECT_EQ(E_INVALIDARG, parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsAppGuidNotAGuid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid=myguid");
-  EXPECT_EQ(E_INVALIDARG, parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsNeedsAdminInvalid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("needsadmin=Hello");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsNeedsAdminSpaceForValue) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("needsadmin= ");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsNeedsAdminTrueUpperCaseT) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("")
-                       _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("needsadmin=True");
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-
-  CommandLineAppArgs app_args;
-  app_args.needs_admin = NEEDS_ADMIN_YES;
-  app_args.app_guid =
-      StringToGuid(_T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"));
-
-  CommandLineExtraArgs expected;
-  expected.apps.push_back(app_args);
-
-  VerifyCommandLineExtraArgs(expected, args);
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsNeedsAdminTrueLowerCaseT) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("")
-                       _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("needsadmin=true");
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-
-  CommandLineAppArgs app_args;
-  app_args.needs_admin = NEEDS_ADMIN_YES;
-  app_args.app_guid =
-      StringToGuid(_T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"));
-
-  CommandLineExtraArgs expected;
-  expected.apps.push_back(app_args);
-
-  VerifyCommandLineExtraArgs(expected, args);
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsNeedsFalseUpperCaseF) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("")
-                       _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("needsadmin=False");
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-
-  CommandLineAppArgs app_args;
-  app_args.needs_admin = NEEDS_ADMIN_NO;
-  app_args.app_guid =
-      StringToGuid(_T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"));
-
-  CommandLineExtraArgs expected;
-  expected.apps.push_back(app_args);
-
-  VerifyCommandLineExtraArgs(expected, args);
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsNeedsAdminFalseLowerCaseF) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("")
-                       _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("needsadmin=false");
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-
-  CommandLineAppArgs app_args;
-  app_args.needs_admin = NEEDS_ADMIN_NO;
-  app_args.app_guid =
-      StringToGuid(_T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"));
-
-  CommandLineExtraArgs expected;
-  expected.apps.push_back(app_args);
-
-  VerifyCommandLineExtraArgs(expected, args);
-}
-
-//
-// Test the handling of the contents of the extra arguments.
-//
-
-TEST(ExtraArgsParserTest, ExtraArgumentsAssignmentOnly) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("=");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsExtraAssignment1) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=1=");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsExtraAssignment2) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("=usagestats=1");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsExtraAssignment3) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=1&=");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsExtraAssignment4) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("=&usagestats=1");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsValueWithoutName) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("=hello");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-
-// Also tests ending extra arguments with '='.
-TEST(ExtraArgsParserTest, ExtraArgumentsNameWithoutValue) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsNameWithoutValueBeforeNextArgument) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("")
-                       _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=&client=hello");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest,
-     ExtraArgumentsNameWithoutArgumentSeparatorAfterIntValue) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("")
-                       _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=1client=hello");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest,
-     ExtraArgumentsNameWithoutArgumentSeparatorAfterStringValue) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("")
-                       _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=yesclient=hello");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsHaveDoubleAmpersand) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("")
-                       _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=1&&client=hello");
-
-  CString app_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                     _T("installerdata=foobar");
-
-  // Ideally, this would flag an error.
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, app_args, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_TRUE,
-      false,
-      _T(""),
-      GUID_NULL,
-      _T(""),
-      _T("hello"),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T("foobar"),
-      _T(""));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsAmpersandOnly) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("&");
-
-  // Ideally, this would flag an error.
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{00000000-0000-0000-0000-000000000000}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_NONE,
-      false,
-      _T(""),
-      GUID_NULL,
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsBeginInAmpersand) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("&appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=1");
-
-  // Ideally, this would flag an error.
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_TRUE,
-      false,
-      _T(""),
-      GUID_NULL,
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsEndInAmpersand) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("&appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=1&");
-
-  // Ideally, this would flag an error.
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_TRUE,
-      false,
-      _T(""),
-      GUID_NULL,
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsEmptyString) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsWhiteSpaceOnly1) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T(" ");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsWhiteSpaceOnly2) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("\t");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsWhiteSpaceOnly3) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("\r");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsWhiteSpaceOnly4) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("\n");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsWhiteSpaceOnly5) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("\r\n");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-
-//
-// Test the parsing of the extra command and its arguments into a string.
-//
-
-TEST(ExtraArgsParserTest, ExtraArgumentsOneValid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("&appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=1");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_TRUE,
-      false,
-      _T(""),
-      GUID_NULL,
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsTwoValid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("&appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=1&client=hello");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_TRUE,
-      false,
-      _T(""),
-      GUID_NULL,
-      _T(""),
-      _T("hello"),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsHaveSwitchInTheMiddle) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=1/other_value=9");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsHaveDoubleQuoteInTheMiddle) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=1\"/other_value=9");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest,
-       ExtraArgumentsHaveDoubleQuoteInTheMiddleAndNoForwardSlash) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=1\"other_value=9");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsHaveSpaceAndForwardSlashBeforeQuote) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=1 /other_value=9");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsHaveForwardSlashBeforeQuote) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=1/other_value=9");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsSpecifiedTwice) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=1\" \"client=10");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsWhiteSpaceBeforeArgs1) {
-  CommandLineExtraArgs args;
-  // TODO(omaha): This one passes now due to different whitespace
-  // handling.  Remove it?  Is this really a problem to have?
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T(" usagestats=1");
-  ExtraArgsParser parser;
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsWhiteSpaceBeforeArgs2) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("\tappguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=1");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsWhiteSpaceBeforeArgs3) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("\rappguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=1");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsWhiteSpaceBeforeArgs4) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("\nappguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}")
-                       _T("&usagestats=1");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsWhiteSpaceBeforeArgs5) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("\r\nusagestats=1");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsForwardSlash1) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("/");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsForwardSlash2) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("/ appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsBackwardSlash1) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("\\");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsBackwardSlash2) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("\\appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ExtraArgumentsBackwardSlash3) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("\\ appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-//
-// Test specific extra commands.
-//
-
-TEST(ExtraArgsParserTest, UsageStatsOutsideExtraCommand) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("/usagestats");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, UsageStatsOn) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=1");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_TRUE,
-      false,
-      _T(""),
-      GUID_NULL,
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""));
-}
-
-TEST(ExtraArgsParserTest, UsageStatsOff) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=0");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_FALSE,
-      false,
-      _T(""),
-      GUID_NULL,
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""));
-}
-
-// This commandline has no effect, but it's permitted.
-TEST(ExtraArgsParserTest, UsageStatsNone) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=2");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_NONE,
-      false,
-      _T(""),
-      GUID_NULL,
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""));
-}
-
-TEST(ExtraArgsParserTest, UsageStatsInvalidPositiveValue) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=3");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, UsageStatsInvalidNegativeValue) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=-1");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, UsageStatsValueIsString) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("usagestats=true");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, BundleNameValid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("bundlename=Google%20Bundle");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_NONE,
-      false,
-      _T("Google Bundle"),
-      GUID_NULL,
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""));
-}
-
-TEST(ExtraArgsParserTest, BundleNameNotPresentButAppNameIs) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("appname=Google%20Chrome");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-      _T("Google Chrome"),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_NONE,
-      false,
-      _T("Google Chrome"),
-      GUID_NULL,
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""));
-}
-TEST(ExtraArgsParserTest, BundleNameNorAppNamePresent) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_NONE,
-      false,
-      _T(""),
-      GUID_NULL,
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""));
-}
-
-TEST(ExtraArgsParserTest, BundleNameNotPresentAndNoApp) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("browser=0");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{00000000-0000-0000-0000-000000000000}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_NONE,
-      false,
-      _T(""),
-      GUID_NULL,
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""));
-}
-
-TEST(ExtraArgsParserTest, InstallationGuidValid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("iid={98CEC468-9429-4984-AEDE-4F53C6A14869}");
-  const GUID expected_guid = {0x98CEC468, 0x9429, 0x4984,
-                              {0xAE, 0xDE, 0x4F, 0x53, 0xC6, 0xA1, 0x48, 0x69}};
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_NONE,
-      false,
-      _T(""),
-      expected_guid,
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""));
-}
-
-TEST(ExtraArgsParserTest, InstallationGuidMissingBraces) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("iid=98CEC468-9429-4984-AEDE-4F53C6A14869");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, InstallationGuidMissingDashes) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("iid=98CEC46894294984AEDE4F53C6A14869");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, InstallationGuidMissingCharacter) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("iid=98CEC468-9429-4984-AEDE-4F53C6A1486");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, InstallationGuidIsString) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("iid=hello");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, BrandCodeValid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("brand=GOOG");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_NONE,
-      false,
-      _T(""),
-      GUID_NULL,
-      _T("GOOG"),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""));
-}
-
-TEST(ExtraArgsParserTest, BrandCodeTooLong) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("brand=CHMI\xe3\x83\xbb");
-
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, ClientIdValid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("client=some_partner");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_NONE,
-      false,
-      _T(""),
-      GUID_NULL,
-      _T(""),
-      _T("some_partner"),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""));
-}
-
-TEST(ExtraArgsParserTest, OmahaExperimentIdValid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("omahaexperiments=experiment%3DgroupA%7Cexpir");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_NONE,
-      false,
-      _T(""),
-      GUID_NULL,
-      _T(""),
-      _T(""),
-      _T("experiment=groupA|expir"),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""));
-}
-
-TEST(ExtraArgsParserTest, AppExperimentIdValid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("experiments=experiment%3DgroupA%7Cexpir");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-      _T(""),
-      _T("experiment=groupA|expir"),
-      NEEDS_ADMIN_NO,
-      TRISTATE_NONE,
-      false,
-      _T(""),
-      GUID_NULL,
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""));
-}
-
-TEST(ExtraArgsParserTest, ReferralIdValid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("referral=ABCD123");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_NONE,
-      false,
-      _T(""),
-      GUID_NULL,
-      _T(""),
-      _T(""),
-      _T(""),
-      _T("ABCD123"),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""));
-}
-
-TEST(ExtraArgsParserTest, ApValid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("ap=developer");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_NONE,
-      false,
-      _T(""),
-      GUID_NULL,
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T("developer"),
-      _T(""),
-      _T(""),
-      _T(""));
-}
-
-TEST(ExtraArgsParserTest, TTValid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("tttoken=7839g93");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_NONE,
-      false,
-      _T(""),
-      GUID_NULL,
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T("7839g93"),
-      _T(""),
-      _T(""));
-}
-
-TEST(ExtraArgsParserTest, AppArgsValid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("tttoken=7839g93");
-
-  CString app_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                     _T("installerdata=%E0%A4foobar");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, app_args, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_NONE,
-      false,
-      _T(""),
-      GUID_NULL,
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T("7839g93"),
-      _T("%E0%A4foobar"),
-      _T(""));
-}
-
-TEST(ExtraArgsParserTest, AppArgsInvalidAppGuid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("tttoken=7839g93");
-
-  CString app_args = _T("appguid={E135384F-85A2-4328-B07D-2CF70313D505}&")
-                     _T("installerdata=%E0%A4foobar");
-
-  EXPECT_EQ(E_INVALIDARG, parser.Parse(extra_args, app_args, &args));
-}
-
-TEST(ExtraArgsParserTest, AppArgsInvalidAttribute) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("tttoken=7839g93");
-
-  CString app_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                     _T("tttoken=foobar");
-
-  EXPECT_EQ(E_INVALIDARG, parser.Parse(extra_args, app_args, &args));
-}
-
-TEST(ExtraArgsParserTest, InstallerDataNotAllowedInExtraArgs) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("appname=TestApp2&")
-                       _T("needsadmin=true&")
-                       _T("installerdata=Hello%20World");
-
-  EXPECT_EQ(E_INVALIDARG, parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, InstallDataIndexValid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("installdataindex=foobar");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_NONE,
-      false,
-      _T(""),
-      GUID_NULL,
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T("foobar"));
-}
-
-TEST(ExtraArgsParserTest, BrowserTypeValid_0) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("browser=0");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyBrowserType(args,
-                    _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-                    BROWSER_UNKNOWN);
-}
-
-TEST(ExtraArgsParserTest, BrowserTypeValid_1) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("browser=1");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyBrowserType(args,
-                    _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-                    BROWSER_DEFAULT);
-}
-
-TEST(ExtraArgsParserTest, BrowserTypeValid_2) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("browser=2");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyBrowserType(args,
-                    _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-                    BROWSER_IE);
-}
-
-TEST(ExtraArgsParserTest, BrowserTypeValid_3) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("browser=3");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyBrowserType(args,
-                    _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-                    BROWSER_FIREFOX);
-}
-
-TEST(ExtraArgsParserTest, BrowserTypeValid_4) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("browser=4");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyBrowserType(args,
-                    _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-                    BROWSER_CHROME);
-}
-
-TEST(ExtraArgsParserTest, BrowserTypeInvalid) {
-  EXPECT_EQ(5, BROWSER_MAX) <<
-      _T("Browser type may have been added. Add new Valid_n test and change ")
-      _T("browser values in extra args strings below.");
-
-  CommandLineExtraArgs args1;
-  ExtraArgsParser parser1;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("browser=5");
-
-  EXPECT_SUCCEEDED(parser1.Parse(extra_args, NULL, &args1));
-  VerifyBrowserType(args1,
-                    _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-                    BROWSER_UNKNOWN);
-
-  CommandLineExtraArgs args2;
-  ExtraArgsParser parser2;
-  extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-               _T("browser=9");
-
-  EXPECT_SUCCEEDED(parser2.Parse(extra_args, NULL, &args2));
-  VerifyBrowserType(args2,
-                    _T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"),
-                    BROWSER_UNKNOWN);
-}
-
-TEST(ExtraArgsParserTest, ValidLang) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("lang=en");
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  EXPECT_STREQ(_T("en"), args.language);
-}
-
-// Language must be passed even if not supported. See http://b/1336966.
-TEST(ExtraArgsParserTest, UnsupportedLang) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("lang=foobar");
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  EXPECT_STREQ(_T("foobar"), args.language);
-}
-
-TEST(ExtraArgsParserTest, LangTooLong) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("lang=morethan10chars");
-  EXPECT_FAILED(parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, RuntimeValid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("runtime=true");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{00000000-0000-0000-0000-000000000000}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_NONE,
-      true,
-      _T(""),
-      GUID_NULL,
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""));
-}
-
-TEST(ExtraArgsParserTest, RuntimeWithExtraArgs) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("runtime=true&")
-                       _T("bundlename=Google%20Bundle&")
-                       _T("brand=GOOG&")
-                       _T("usagestats=1");
-
-  EXPECT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-  VerifyExtraArgsHaveSpecificValues(
-      args,
-      _T("{00000000-0000-0000-0000-000000000000}"),
-      _T(""),
-      _T(""),
-      NEEDS_ADMIN_NO,
-      TRISTATE_TRUE,
-      true,
-      _T("Google Bundle"),
-      GUID_NULL,
-      _T("GOOG"),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""),
-      _T(""));
-}
-
-
-TEST(ExtraArgsParserTest, RuntimeBeforeAppGuid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("runtime=true&")
-                       _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}");
-
-  EXPECT_EQ(E_INVALIDARG, parser.Parse(extra_args, NULL, &args));
-}
-
-TEST(ExtraArgsParserTest, RuntimeAfterAppGuid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("runtime=true");
-
-  EXPECT_EQ(E_INVALIDARG, parser.Parse(extra_args, NULL, &args));
-}
-
-//
-// Test multiple applications in the extra arguments
-//
-TEST(ExtraArgsParserTestMultipleEntries, TestNotStartingWithAppGuid) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appname=TestApp&")
-                       _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("appname=TestApp&")
-                       _T("appname=false&")
-                       _T("iid={98CEC468-9429-4984-AEDE-4F53C6A14869}&")
-                       _T("ap=test_ap&")
-                       _T("tttoken=foobar&")
-                       _T("usagestats=1&")
-                       _T("browser=2&");
-  EXPECT_HRESULT_SUCCEEDED(parser.Parse(extra_args, NULL, &args));
-}
-
-// This also tests that the last occurrence of a global extra arg is the one
-// that is saved.
-TEST(ExtraArgsParserTestMultipleEntries, ThreeApplications) {
-  CommandLineExtraArgs args;
-  ExtraArgsParser parser;
-  CString extra_args = _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                       _T("appname=TestApp&")
-                       _T("needsadmin=false&")
-                       _T("iid={98CEC468-9429-4984-AEDE-4F53C6A14869}&")
-                       _T("ap=test_ap&")
-                       _T("tttoken=foobar&")
-                       _T("usagestats=1&")
-                       _T("browser=2&")
-                       _T("brand=GOOG&")
-                       _T("client=_some_client&")
-                       _T("experiments=_experiment_a&")
-                       _T("referral=A123456789&")
-                       _T("appguid={5E46DE36-737D-4271-91C1-C062F9FE21D9}&")
-                       _T("appname=TestApp2&")
-                       _T("needsadmin=true&")
-                       _T("experiments=_experiment_b&")
-                       _T("iid={98CEC468-9429-4984-AEDE-4F53C6A14869}&")
-                       _T("ap=test_ap2&")
-                       _T("tttoken=foobar2&")
-                       _T("usagestats=0&")
-                       _T("browser=3&")
-                       _T("brand=g00g&")
-                       _T("client=_different_client&")
-                       _T("appguid={5F46DE36-737D-4271-91C1-C062F9FE21D9}&")
-                       _T("appname=TestApp3&")
-                       _T("needsadmin=prefers&");
-
-  CString app_args = _T("appguid={5F46DE36-737D-4271-91C1-C062F9FE21D9}&")
-                     _T("installerdata=installerdata_app3&")
-                     _T("appguid={8617EE50-F91C-4DC1-B937-0969EEF59B0B}&")
-                     _T("installerdata=installerdata_app1");
-
-  EXPECT_HRESULT_SUCCEEDED(parser.Parse(extra_args, app_args, &args));
-
-  CommandLineAppArgs input1;
-  input1.app_guid = StringToGuid(_T("{8617EE50-F91C-4DC1-B937-0969EEF59B0B}"));
-  input1.app_name = _T("TestApp");
-  input1.needs_admin = NEEDS_ADMIN_NO;
-  input1.ap = _T("test_ap");
-  input1.tt_token = _T("foobar");
-  input1.encoded_installer_data = _T("installerdata_app1");
-  input1.experiment_labels = _T("_experiment_a");
-
-  CommandLineAppArgs input2;
-  input2.app_guid = StringToGuid(_T("{5E46DE36-737D-4271-91C1-C062F9FE21D9}"));
-  input2.app_name = _T("TestApp2");
-  input2.needs_admin = NEEDS_ADMIN_YES;
-  input2.ap = _T("test_ap2");
-  input2.tt_token = _T("foobar2");
-  input2.experiment_labels = _T("_experiment_b");
-
-  CommandLineAppArgs input3;
-  input3.app_guid = StringToGuid(_T("{5F46DE36-737D-4271-91C1-C062F9FE21D9}"));
-  input3.app_name = _T("TestApp3");
-  input3.encoded_installer_data = _T("installerdata_app3");
-  input3.needs_admin = NEEDS_ADMIN_PREFERS;
-
-  CommandLineExtraArgs expected;
-  expected.apps.push_back(input1);
-  expected.apps.push_back(input2);
-  expected.apps.push_back(input3);
-  expected.bundle_name = _T("TestApp");
-  expected.installation_id = StringToGuid(
-      _T("{98CEC468-9429-4984-AEDE-4F53C6A14869}"));
-  expected.brand_code = _T("g00g");
-  expected.client_id = _T("_different_client");
-  expected.referral_id = _T("A123456789");
-  expected.browser_type = BROWSER_FIREFOX;
-  expected.usage_stats_enable = TRISTATE_FALSE;
-
-  VerifyCommandLineExtraArgs(expected, args);
-}
-
-}  // namespace omaha
diff --git a/common/goopdate_command_line_validator.cc b/common/goopdate_command_line_validator.cc
deleted file mode 100644
index a115c81..0000000
--- a/common/goopdate_command_line_validator.cc
+++ /dev/null
@@ -1,485 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/common/goopdate_command_line_validator.h"
-#include "omaha/base/command_line_parser.h"
-#include "omaha/base/command_line_validator.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/path.h"
-#include "omaha/base/string.h"
-#include "omaha/common/command_line.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/extra_args_parser.h"
-
-namespace omaha {
-
-GoopdateCommandLineValidator::GoopdateCommandLineValidator() {
-}
-
-GoopdateCommandLineValidator::~GoopdateCommandLineValidator() {
-}
-
-HRESULT GoopdateCommandLineValidator::Setup() {
-  validator_.reset(new CommandLineValidator);
-
-  CString cmd_line;
-
-  // gu.exe
-  cmd_line.Empty();
-  CreateScenario(cmd_line, &GoopdateCommandLineValidator::OnNoArgs);
-
-  // gu.exe /c [/nocrashserver
-  cmd_line.Format(_T("/%s [/%s"), kCmdLineCore, kCmdLineNoCrashHandler);
-  CreateScenario(cmd_line, &GoopdateCommandLineValidator::OnCore);
-
-  // gu.exe /crashhandler
-  cmd_line.Format(_T("/%s"), kCmdLineCrashHandler);
-  CreateScenario(cmd_line, &GoopdateCommandLineValidator::OnCrashHandler);
-
-  // gu.exe /svc
-  cmd_line.Format(_T("/%s"), kCmdLineService);
-  CreateScenario(cmd_line, &GoopdateCommandLineValidator::OnService);
-
-  // gu.exe /medsvc
-  cmd_line.Format(_T("/%s"), kCmdLineMediumService);
-  CreateScenario(cmd_line, &GoopdateCommandLineValidator::OnMediumService);
-
-  // gu.exe /regsvc
-  cmd_line.Format(_T("/%s"), kCmdLineRegisterService);
-  CreateScenario(cmd_line, &GoopdateCommandLineValidator::OnServiceRegister);
-
-  // gu.exe /unregsvc
-  cmd_line.Format(_T("/%s"), kCmdLineUnregisterService);
-  CreateScenario(cmd_line, &GoopdateCommandLineValidator::OnServiceUnregister);
-
-  // gu.exe /regserver
-  cmd_line.Format(_T("/%s"), kCmdRegServer);
-  CreateScenario(cmd_line, &GoopdateCommandLineValidator::OnRegServer);
-
-  // gu.exe /unregserver
-  cmd_line.Format(_T("/%s"), kCmdUnregServer);
-  CreateScenario(cmd_line, &GoopdateCommandLineValidator::OnUnregServer);
-
-  // gu.exe /netdiags
-  cmd_line.Format(_T("/%s"), kCmdLineNetDiags);
-  CreateScenario(cmd_line, &GoopdateCommandLineValidator::OnNetDiags);
-
-  // gu.exe /crash
-  cmd_line.Format(_T("/%s"), kCmdLineCrash);
-  CreateScenario(cmd_line, &GoopdateCommandLineValidator::OnCrash);
-
-  // gu.exe -Embedding. The -Embedding text is injected via COM.
-  CreateScenario(kCmdLineComServerDash,
-                 &GoopdateCommandLineValidator::OnComServer);
-
-  // COM server mode, but only for the broker.
-  CreateScenario(kCmdLineComBroker, &GoopdateCommandLineValidator::OnComBroker);
-
-  // COM server mode, but only for the OnDemand.
-  CreateScenario(kCmdLineOnDemand, &GoopdateCommandLineValidator::OnDemand);
-
-  // gu.exe /install <extraargs> [/appargs <appargs> [/installsource source
-  //        [/silent [/eularequired [/oem [/installelevated [/sessionid <sid>
-  cmd_line.Format(_T("/%s extra [/%s appargs [/%s src [/%s [/%s [/%s [/%s ")
-                  _T("[/%s sid"),
-                  kCmdLineInstall,
-                  kCmdLineAppArgs,
-                  kCmdLineInstallSource,
-                  kCmdLineSilent,
-                  kCmdLineEulaRequired,
-                  kCmdLineOem,
-                  kCmdLineInstallElevated,
-                  kCmdLineSessionId);
-  CreateScenario(cmd_line, &GoopdateCommandLineValidator::OnInstall);
-
-  // gu.exe /update [/sessionid <sid>
-  cmd_line.Format(_T("/%s [/%s sid"), kCmdLineUpdate, kCmdLineSessionId);
-  CreateScenario(cmd_line, &GoopdateCommandLineValidator::OnUpdate);
-
-  // gu.exe /handoff <extraargs> [/appargs <appargs> [/installsource source
-  //        [/silent [/eularequired [/offlineinstall [/offlinedir <dir>
-  //        [/sessionid <sid>
-  cmd_line.Format(_T("/%s extra [/%s appargs [/%s src [/%s [/%s [/%s [/%s dir ")
-                  _T("[/%s sid"),
-                  kCmdLineAppHandoffInstall,
-                  kCmdLineAppArgs,
-                  kCmdLineInstallSource,
-                  kCmdLineSilent,
-                  kCmdLineEulaRequired,
-                  kCmdLineLegacyOfflineInstall,
-                  kCmdLineOfflineDir,
-                  kCmdLineSessionId);
-  CreateScenario(cmd_line,
-                 &GoopdateCommandLineValidator::OnInstallHandoffWorker);
-
-  // gu.exe /ua [/installsource source [/machine
-  cmd_line.Format(_T("/%s [/%s source [/%s"),
-                  kCmdLineUpdateApps, kCmdLineInstallSource, kCmdLineMachine);
-  CreateScenario(cmd_line,
-                 &GoopdateCommandLineValidator::OnUpdateApps);
-
-  // gu.exe /report <crash_filename> [/machine
-  //        [/custom_info <custom_info_filename>
-  cmd_line.Format(_T("/%s filename [/%s [/%s customfilename"),
-                  kCmdLineReport,
-                  kCmdLineMachine,
-                  kCmdLineCustomInfoFileName);
-  CreateScenario(cmd_line, &GoopdateCommandLineValidator::OnReportCrash);
-
-  // gu.exe /report /i <crash_filename> [/machine
-  cmd_line.Format(_T("/%s /%s filename [/%s"),
-                  kCmdLineReport,
-                  kCmdLineInteractive,
-                  kCmdLineMachine);
-  CreateScenario(cmd_line,
-                 &GoopdateCommandLineValidator::OnReportCrashInteractive);
-
-  // gu.exe /pi <domainurl> <args> /installsource <oneclick|update3web>
-  cmd_line.Format(_T("/%s domainurl args /%s src"),
-                  kCmdLineWebPlugin,
-                  kCmdLineInstallSource);
-  CreateScenario(cmd_line, &GoopdateCommandLineValidator::OnWebPlugin);
-
-  // gu.exe /cr
-  cmd_line.Format(_T("/%s"), kCmdLineCodeRedCheck);
-  CreateScenario(cmd_line, &GoopdateCommandLineValidator::OnCodeRed);
-
-  // gu.exe /recover <repair_file>
-  cmd_line.Format(_T("/%s repairfile"), kCmdLineRecover);
-  CreateScenario(cmd_line, &GoopdateCommandLineValidator::OnRecover);
-
-  // gu.exe /recover /machine <repair_file>
-  cmd_line.Format(_T("/%s /%s repairfile"), kCmdLineRecover, kCmdLineMachine);
-  CreateScenario(cmd_line, &GoopdateCommandLineValidator::OnRecoverMachine);
-
-  // gu.exe /uninstall
-  cmd_line.Format(_T("/%s"), kCmdLineUninstall);
-  CreateScenario(cmd_line, &GoopdateCommandLineValidator::OnUninstall);
-
-  // gu.exe /registerproduct "extraargs" [/installsource source
-  cmd_line.Format(_T("/%s extraargs [/%s source"),
-                  kCmdLineRegisterProduct,
-                  kCmdLineInstallSource);
-  CreateScenario(cmd_line, &GoopdateCommandLineValidator::OnRegisterProduct);
-
-  // gu.exe /unregisterproduct "extraargs"
-  cmd_line.Format(_T("/%s extraargs"), kCmdLineUnregisterProduct);
-  CreateScenario(cmd_line, &GoopdateCommandLineValidator::OnUnregisterProduct);
-
-  // gu.exe /ping pingstring
-  cmd_line.Format(_T("/%s pingstring"), kCmdLinePing);
-  CreateScenario(cmd_line, &GoopdateCommandLineValidator::OnPing);
-
-  return S_OK;
-}
-
-// TODO(Omaha): Add check that each scenario is unique and does not overlap an
-// existing one in DBG builds.
-HRESULT GoopdateCommandLineValidator::Validate(const CommandLineParser* parser,
-                                               CommandLineArgs* args) {
-  ASSERT1(parser);
-  ASSERT1(args);
-
-  parser_ = parser;
-  args_ = args;
-
-  CString scenario_name;
-  HRESULT hr = validator_->Validate(*parser_, &scenario_name);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[GoopdateCommandLineValidator::Validate Failed][0x%x]"),
-                  hr));
-    return hr;
-  }
-
-  MapScenarioHandlersIter iter = scenario_handlers_.find(scenario_name);
-  if (iter == scenario_handlers_.end()) {
-    ASSERT1(false);
-    return GOOGLEUPDATE_COMMANDLINE_E_NO_SCENARIO_HANDLER;
-  }
-
-  ScenarioHandler handler = (*iter).second;
-  return (this->*handler)();
-}
-
-void GoopdateCommandLineValidator::CreateScenario(const TCHAR* cmd_line,
-                                                  ScenarioHandler handler) {
-  // Prepend the program name onto the cmd_line.
-  CString scenario_cmd_line;
-  scenario_cmd_line.Format(_T("prog.exe %s"), cmd_line);
-
-  CString scenario_name;
-  validator_->CreateScenarioFromCmdLine(scenario_cmd_line, &scenario_name);
-  // TODO(omaha): Make sure it doesn't already exist.
-  scenario_handlers_[scenario_name] = handler;
-}
-
-HRESULT GoopdateCommandLineValidator::GetExtraAndAppArgs(const CString& name) {
-  HRESULT hr = parser_->GetSwitchArgumentValue(name,
-                                               0,
-                                               &args_->extra_args_str);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = parser_->GetSwitchArgumentValue(kCmdLineAppArgs,
-                                       0,
-                                       &args_->app_args_str);
-  if (FAILED(hr)) {
-    args_->app_args_str.Empty();
-  }
-
-  ExtraArgsParser extra_args_parser;
-  return extra_args_parser.Parse(args_->extra_args_str,
-                                 args_->app_args_str,
-                                 &args_->extra);
-}
-
-HRESULT GoopdateCommandLineValidator::OnNoArgs() {
-  args_->mode = COMMANDLINE_MODE_NOARGS;
-  return S_OK;
-}
-
-HRESULT GoopdateCommandLineValidator::OnCore() {
-  args_->mode = COMMANDLINE_MODE_CORE;
-  args_->is_crash_handler_disabled = parser_->HasSwitch(kCmdLineNoCrashHandler);
-
-  return S_OK;
-}
-
-HRESULT GoopdateCommandLineValidator::OnCrashHandler() {
-  args_->mode = COMMANDLINE_MODE_CRASH_HANDLER;
-  return S_OK;
-}
-
-HRESULT GoopdateCommandLineValidator::OnService() {
-  args_->mode = COMMANDLINE_MODE_SERVICE;
-  return S_OK;
-}
-
-HRESULT GoopdateCommandLineValidator::OnMediumService() {
-  args_->mode = COMMANDLINE_MODE_MEDIUM_SERVICE;
-  return S_OK;
-}
-
-HRESULT GoopdateCommandLineValidator::OnServiceRegister() {
-  args_->mode = COMMANDLINE_MODE_SERVICE_REGISTER;
-  return S_OK;
-}
-
-HRESULT GoopdateCommandLineValidator::OnServiceUnregister() {
-  args_->mode = COMMANDLINE_MODE_SERVICE_UNREGISTER;
-  return S_OK;
-}
-
-HRESULT GoopdateCommandLineValidator::OnRegServer() {
-  args_->mode = COMMANDLINE_MODE_REGSERVER;
-  return S_OK;
-}
-
-HRESULT GoopdateCommandLineValidator::OnUnregServer() {
-  args_->mode = COMMANDLINE_MODE_UNREGSERVER;
-  return S_OK;
-}
-
-HRESULT GoopdateCommandLineValidator::OnNetDiags() {
-  args_->mode = COMMANDLINE_MODE_NETDIAGS;
-  return S_OK;
-}
-
-HRESULT GoopdateCommandLineValidator::OnCrash() {
-  args_->mode = COMMANDLINE_MODE_CRASH;
-  return S_OK;
-}
-
-HRESULT GoopdateCommandLineValidator::OnComServer() {
-  args_->mode = COMMANDLINE_MODE_COMSERVER;
-  return S_OK;
-}
-
-HRESULT GoopdateCommandLineValidator::OnComBroker() {
-  args_->mode = COMMANDLINE_MODE_COMBROKER;
-  return S_OK;
-}
-
-HRESULT GoopdateCommandLineValidator::OnDemand() {
-  args_->mode = COMMANDLINE_MODE_ONDEMAND;
-  return S_OK;
-}
-
-HRESULT GoopdateCommandLineValidator::OnInstall() {
-  args_->mode = COMMANDLINE_MODE_INSTALL;
-  parser_->GetSwitchArgumentValue(kCmdLineInstallSource,
-                                  0,
-                                  &args_->install_source);
-  parser_->GetSwitchArgumentValue(kCmdLineSessionId,
-                                  0,
-                                  &args_->session_id);
-  args_->is_silent_set = parser_->HasSwitch(kCmdLineSilent);
-  args_->is_eula_required_set = parser_->HasSwitch(kCmdLineEulaRequired);
-  args_->is_oem_set = parser_->HasSwitch(kCmdLineOem);
-  args_->is_install_elevated = parser_->HasSwitch(kCmdLineInstallElevated);
-  return GetExtraAndAppArgs(kCmdLineInstall);
-}
-
-HRESULT GoopdateCommandLineValidator::OnUpdate() {
-  args_->mode = COMMANDLINE_MODE_UPDATE;
-  parser_->GetSwitchArgumentValue(kCmdLineSessionId,
-                                  0,
-                                  &args_->session_id);
-  return S_OK;
-}
-
-HRESULT GoopdateCommandLineValidator::OnInstallHandoffWorker() {
-  args_->mode = COMMANDLINE_MODE_HANDOFF_INSTALL;
-  parser_->GetSwitchArgumentValue(kCmdLineInstallSource,
-                                  0,
-                                  &args_->install_source);
-  parser_->GetSwitchArgumentValue(kCmdLineSessionId,
-                                  0,
-                                  &args_->session_id);
-  args_->is_silent_set = parser_->HasSwitch(kCmdLineSilent);
-  args_->is_eula_required_set = parser_->HasSwitch(kCmdLineEulaRequired);
-  args_->is_offline_set = parser_->HasSwitch(kCmdLineLegacyOfflineInstall) ||
-                          parser_->HasSwitch(kCmdLineOfflineDir);
-
-  if (SUCCEEDED(parser_->GetSwitchArgumentValue(kCmdLineOfflineDir,
-                                                0,
-                                                &args_->offline_dir))) {
-    RemoveMismatchedEndQuoteInDirectoryPath(&args_->offline_dir);
-    ::PathRemoveBackslash(CStrBuf(args_->offline_dir, MAX_PATH));
-  }
-
-  return GetExtraAndAppArgs(kCmdLineAppHandoffInstall);
-}
-
-HRESULT GoopdateCommandLineValidator::OnUpdateApps() {
-  args_->mode = COMMANDLINE_MODE_UA;
-  args_->is_machine_set = parser_->HasSwitch(kCmdLineMachine);
-  parser_->GetSwitchArgumentValue(kCmdLineInstallSource,
-                                  0,
-                                  &args_->install_source);
-  return S_OK;
-}
-
-HRESULT GoopdateCommandLineValidator::OnReportCrash() {
-  args_->mode = COMMANDLINE_MODE_REPORTCRASH;
-  args_->is_machine_set = parser_->HasSwitch(kCmdLineMachine);
-  parser_->GetSwitchArgumentValue(kCmdLineCustomInfoFileName,
-                                  0,
-                                  &args_->custom_info_filename);
-  return parser_->GetSwitchArgumentValue(kCmdLineReport,
-                                         0,
-                                         &args_->crash_filename);
-}
-
-HRESULT GoopdateCommandLineValidator::OnReportCrashInteractive() {
-  args_->mode = COMMANDLINE_MODE_REPORTCRASH;
-  args_->is_interactive_set = true;
-  args_->is_machine_set = parser_->HasSwitch(kCmdLineMachine);
-  return parser_->GetSwitchArgumentValue(kCmdLineInteractive,
-                                         0,
-                                         &args_->crash_filename);
-}
-
-HRESULT GoopdateCommandLineValidator::OnWebPlugin() {
-  HRESULT hr = parser_->GetSwitchArgumentValue(kCmdLineInstallSource,
-                                               0,
-                                               &args_->install_source);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  // Validate install_source value.
-  args_->install_source.MakeLower();
-  if ((args_->install_source.Compare(kCmdLineInstallSource_OneClick) != 0) &&
-      (args_->install_source.Compare(kCmdLineInstallSource_Update3Web) != 0)) {
-    args_->install_source.Empty();
-    return E_INVALIDARG;
-  }
-
-  args_->mode = COMMANDLINE_MODE_WEBPLUGIN;
-
-  CString urldomain;
-  hr = parser_->GetSwitchArgumentValue(kCmdLineWebPlugin,
-                                       0,
-                                       &urldomain);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  hr = StringUnescape(urldomain, &args_->webplugin_urldomain);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CString webplugin_args;
-  hr = parser_->GetSwitchArgumentValue(kCmdLineWebPlugin,
-                                       1,
-                                       &webplugin_args);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  return StringUnescape(webplugin_args, &args_->webplugin_args);
-}
-
-HRESULT GoopdateCommandLineValidator::OnCodeRed() {
-  args_->mode = COMMANDLINE_MODE_CODE_RED_CHECK;
-  return S_OK;
-}
-
-HRESULT GoopdateCommandLineValidator::OnRecover() {
-  args_->mode = COMMANDLINE_MODE_RECOVER;
-  return parser_->GetSwitchArgumentValue(
-      kCmdLineRecover,
-      0,
-      &args_->code_red_metainstaller_path);
-}
-
-HRESULT GoopdateCommandLineValidator::OnRecoverMachine() {
-  args_->mode = COMMANDLINE_MODE_RECOVER;
-  args_->is_machine_set = true;
-  return parser_->GetSwitchArgumentValue(
-      kCmdLineMachine,
-      0,
-      &args_->code_red_metainstaller_path);
-}
-
-HRESULT GoopdateCommandLineValidator::OnUninstall() {
-  args_->mode = COMMANDLINE_MODE_UNINSTALL;
-  return S_OK;
-}
-
-HRESULT GoopdateCommandLineValidator::OnRegisterProduct() {
-  args_->mode = COMMANDLINE_MODE_REGISTER_PRODUCT;
-  parser_->GetSwitchArgumentValue(kCmdLineInstallSource,
-                                  0,
-                                  &args_->install_source);
-  return GetExtraAndAppArgs(kCmdLineRegisterProduct);
-}
-
-HRESULT GoopdateCommandLineValidator::OnUnregisterProduct() {
-  args_->mode = COMMANDLINE_MODE_UNREGISTER_PRODUCT;
-  return GetExtraAndAppArgs(kCmdLineUnregisterProduct);
-}
-
-HRESULT GoopdateCommandLineValidator::OnPing() {
-  args_->mode = COMMANDLINE_MODE_PING;
-  return parser_->GetSwitchArgumentValue(kCmdLinePing,
-                                         0,
-                                         &args_->ping_string);
-}
-
-}  // namespace omaha
-
diff --git a/common/goopdate_command_line_validator.h b/common/goopdate_command_line_validator.h
deleted file mode 100644
index 0b1c1f4..0000000
--- a/common/goopdate_command_line_validator.h
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_GOOPDATE_COMMAND_LINE_VALIDATOR_H__
-#define OMAHA_COMMON_GOOPDATE_COMMAND_LINE_VALIDATOR_H__
-
-#include <windows.h>
-#include <atlstr.h>
-
-#include <map>
-
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-
-namespace omaha {
-
-struct CommandLineArgs;
-class CommandLineParser;
-class CommandLineValidator;
-
-// Validates all of the command line permutations for googleupdate.exe.
-class GoopdateCommandLineValidator {
- public:
-  typedef HRESULT (GoopdateCommandLineValidator::*ScenarioHandler)();
-  typedef std::map<CString, ScenarioHandler> MapScenarioHandlers;
-  typedef MapScenarioHandlers::iterator MapScenarioHandlersIter;
-
-  GoopdateCommandLineValidator();
-  ~GoopdateCommandLineValidator();
-
-  // Sets up the scenarios.
-  HRESULT Setup();
-
-  // Validates a pre-parsed parser against the scenarios and returns a
-  // CommandLineArgs structure filled in with the proper values.
-  HRESULT Validate(const CommandLineParser* parser, CommandLineArgs* args);
-
- private:
-  // Specific command-line scenario handlers.
-  HRESULT OnNoArgs();
-  HRESULT OnCore();
-  HRESULT OnCrashHandler();
-  HRESULT OnService();
-  HRESULT OnMediumService();
-  HRESULT OnServiceRegister();
-  HRESULT OnServiceUnregister();
-  HRESULT OnRegServer();
-  HRESULT OnUnregServer();
-  HRESULT OnNetDiags();
-  HRESULT OnCrash();
-  HRESULT OnComServer();
-  HRESULT OnComBroker();
-  HRESULT OnDemand();
-  HRESULT OnInstall();
-  HRESULT OnUpdate();
-  HRESULT OnInstallHandoffWorker();
-  HRESULT OnUpdateApps();
-  HRESULT OnReportCrash();
-  HRESULT OnReportCrashInteractive();
-  HRESULT OnWebPlugin();
-  HRESULT OnCodeRed();
-  HRESULT OnRecover();
-  HRESULT OnRecoverMachine();
-  HRESULT OnUninstall();
-  HRESULT OnRegisterProduct();
-  HRESULT OnUnregisterProduct();
-  HRESULT OnPing();
-
-  void CreateScenario(const TCHAR* cmd_line, ScenarioHandler handler);
-
-  HRESULT GetExtraAndAppArgs(const CString& switch_name);
-
-  const CommandLineParser* parser_;
-  CommandLineArgs* args_;
-  scoped_ptr<CommandLineValidator> validator_;
-  MapScenarioHandlers scenario_handlers_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(GoopdateCommandLineValidator);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_GOOPDATE_COMMAND_LINE_VALIDATOR_H__
-
diff --git a/common/goopdate_utils.cc b/common/goopdate_utils.cc
deleted file mode 100644
index bb350af..0000000
--- a/common/goopdate_utils.cc
+++ /dev/null
@@ -1,1393 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/common/goopdate_utils.h"
-#include <atlsecurity.h>
-#include "omaha/base/app_util.h"
-#include "omaha/base/const_addresses.h"
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/const_utils.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/path.h"
-#include "omaha/base/proc_utils.h"
-#include "omaha/base/process.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/scoped_impersonation.h"
-#include "omaha/base/service_utils.h"
-#include "omaha/base/string.h"
-#include "omaha/base/system.h"
-#include "omaha/base/system_info.h"
-#include "omaha/base/user_info.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vista_utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/command_line_builder.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/oem_install_utils.h"
-#include "omaha/statsreport/metrics.h"
-#include "goopdate/omaha3_idl.h"
-
-namespace omaha {
-
-namespace goopdate_utils {
-
-namespace {
-
-const int kTerminateBrowserTimeoutMs = 60000;
-
-bool IsMachineProcessWithoutPrivileges(bool is_machine_process) {
-  return is_machine_process && !vista_util::IsUserAdmin();
-}
-
-HRESULT LaunchImpersonatedCmdLine(const CString& cmd_line) {
-  CORE_LOG(L3, (_T("[LaunchImpersonatedCmdLine][%s]"), cmd_line));
-
-  scoped_handle impersonation_token;
-  HRESULT hr = vista::GetLoggedOnUserToken(address(impersonation_token));
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[GetLoggedOnUserToken failed][0x%x]"), hr));
-    return hr;
-  }
-
-  scoped_impersonation impersonate_user(get(impersonation_token));
-  hr = HRESULT_FROM_WIN32(impersonate_user.result());
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[impersonation failed][0x%x]"), hr));
-    return hr;
-  }
-
-  CComPtr<IProcessLauncher> launcher;
-  hr = launcher.CoCreateInstance(CLSID_ProcessLauncherClass,
-                                 NULL,
-                                 CLSCTX_LOCAL_SERVER);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[CoCreateInstance IProcessLauncher failed][0x%x]"), hr));
-    return hr;
-  }
-
-  hr = launcher->LaunchCmdLine(cmd_line);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[IProcessLauncher.LaunchBrowser failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT LaunchImpersonatedBrowser(BrowserType type, const CString& url) {
-  CORE_LOG(L3, (_T("[LaunchImpersonatedBrowser][%u][%s]"), type, url));
-
-  scoped_handle impersonation_token;
-  HRESULT hr = vista::GetLoggedOnUserToken(address(impersonation_token));
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[GetLoggedOnUserToken failed][0x%x]"), hr));
-    return hr;
-  }
-
-  scoped_impersonation impersonate_user(get(impersonation_token));
-  hr = HRESULT_FROM_WIN32(impersonate_user.result());
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[impersonation failed][0x%x]"), hr));
-    return hr;
-  }
-
-  CComPtr<IProcessLauncher> launcher;
-  hr = launcher.CoCreateInstance(CLSID_ProcessLauncherClass,
-                                 NULL,
-                                 CLSCTX_LOCAL_SERVER);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[CoCreateInstance IProcessLauncher failed][0x%x]"), hr));
-    return hr;
-  }
-
-  hr = launcher->LaunchBrowser(type, url);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[IProcessLauncher.LaunchBrowser failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-}  // namespace
-
-HRESULT LaunchCmdLine(bool is_machine, const CString& cmd_line) {
-  CORE_LOG(L3, (_T("[LaunchCmdLine][%d][%s]"), is_machine, cmd_line));
-
-  if (is_machine && vista_util::IsVistaOrLater() && vista_util::IsUserAdmin()) {
-    return LaunchImpersonatedCmdLine(cmd_line);
-  }
-
-  HRESULT hr = System::ShellExecuteCommandLine(cmd_line, NULL, NULL);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ShellExecuteCommandLine failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT LaunchBrowser(bool is_machine, BrowserType type, const CString& url) {
-  CORE_LOG(L3, (_T("[LaunchBrowser][%d][%u][%s]"), is_machine, type, url));
-
-  if (is_machine && vista_util::IsVistaOrLater() && vista_util::IsUserAdmin()) {
-    // Other than having a service launch the browser using CreateProcessAsUser,
-    // there is no easy solution if we are unable to launch the browser
-    // impersonated.
-    return LaunchImpersonatedBrowser(type, url);
-  }
-
-  HRESULT hr = RunBrowser(type, url);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[RunBrowser failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-CString BuildGoogleUpdateExeDir(bool is_machine) {
-  ConfigManager& cm = *ConfigManager::Instance();
-  return is_machine ? cm.GetMachineGoopdateInstallDir() :
-                      cm.GetUserGoopdateInstallDir();
-}
-
-CString BuildGoogleUpdateExePath(bool is_machine) {
-  CORE_LOG(L3, (_T("[BuildGoogleUpdateExePath][%d]"), is_machine));
-
-  CPath full_file_path(BuildGoogleUpdateExeDir(is_machine));
-  VERIFY1(full_file_path.Append(kOmahaShellFileName));
-
-  return full_file_path;
-}
-
-CString BuildGoogleUpdateServicesPath(bool is_machine) {
-  CORE_LOG(L3, (_T("[BuildGoogleUpdateServicesPath][%d]"), is_machine));
-
-  CPath full_file_path(BuildInstallDirectory(is_machine, GetVersionString()));
-  VERIFY1(full_file_path.Append(kCrashHandlerFileName));
-
-  return full_file_path;
-}
-
-HRESULT StartElevatedSelfWithArgsAndWait(const TCHAR* args, DWORD* exit_code) {
-  ASSERT1(args);
-  ASSERT1(exit_code);
-  CORE_LOG(L3, (_T("[StartElevatedSelfWithArgsAndWait]")));
-
-  // Get the process executable.
-  TCHAR filename[MAX_PATH] = {0};
-  if (::GetModuleFileName(NULL, filename, MAX_PATH) == 0) {
-    HRESULT hr = HRESULTFromLastError();
-    CORE_LOG(LEVEL_ERROR, (_T("[GetModuleFileName failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  // Launch self elevated and wait.
-  *exit_code = 0;
-  CORE_LOG(L1,
-      (_T("[RunElevated filename='%s'][arguments='%s']"), filename, args));
-  // According to the MSDN documentation for ::ShowWindow: "nCmdShow. This
-  // parameter is ignored the first time an application calls ShowWindow, if
-  // the program that launched the application provides a STARTUPINFO
-  // structure.". We want to force showing the UI window. So we pass in
-  // SW_SHOWNORMAL.
-  HRESULT hr(vista_util::RunElevated(filename, args, SW_SHOWNORMAL, exit_code));
-  CORE_LOG(L2, (_T("[elevated instance exit code][%u]"), *exit_code));
-  if (FAILED(hr)) {
-    CORE_LOG(LEVEL_ERROR, (_T("[RunElevated failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT StartGoogleUpdateWithArgs(bool is_machine,
-                                  const TCHAR* args,
-                                  HANDLE* process) {
-  CORE_LOG(L3, (_T("[StartGoogleUpdateWithArgs][%d][%s]"),
-                is_machine, args ? args : _T("")));
-
-  CString exe_path = BuildGoogleUpdateExePath(is_machine);
-
-  CORE_LOG(L3, (_T("[command line][%s][%s]"), exe_path, args ? args : _T("")));
-
-  HRESULT hr = System::ShellExecuteProcess(exe_path, args, NULL, process);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[can't start process][%s][0x%08x]"), exe_path, hr));
-    return hr;
-  }
-  return S_OK;
-}
-
-HRESULT StartCrashHandler(bool is_machine) {
-  CORE_LOG(L3, (_T("[StartCrashHandler]")));
-
-  ASSERT1(!is_machine || user_info::IsRunningAsSystem());
-
-  CString exe_path = BuildGoogleUpdateServicesPath(is_machine);
-  CommandLineBuilder builder(COMMANDLINE_MODE_CRASH_HANDLER);
-  CString cmd_line = builder.GetCommandLineArgs();
-  return System::StartProcessWithArgs(exe_path, cmd_line);
-}
-
-bool IsRunningFromOfficialGoopdateDir(bool is_machine) {
-  const ConfigManager& cm = *ConfigManager::Instance();
-  bool is_official_dir = is_machine ?
-                         cm.IsRunningFromMachineGoopdateInstallDir() :
-                         cm.IsRunningFromUserGoopdateInstallDir();
-  CORE_LOG(L3, (_T("[running from official dir][%d]"), is_official_dir));
-  return is_official_dir;
-}
-
-CString GetHKRoot() {
-  return IsRunningFromOfficialGoopdateDir(true) ? _T("HKLM") : _T("HKCU");
-}
-
-HRESULT InitializeSecurity() {
-  // Creates a security descriptor in absolute format and includes the owner
-  // and the primary group.  We grant access to admins and system.
-  CSecurityDesc security_descriptor;
-  if (SystemInfo::IsRunningOnVistaOrLater()) {
-    // To allow for low-integrity IE to call into IGoogleUpdate.
-    security_descriptor.FromString(LOW_INTEGRITY_SDDL_SACL);
-  }
-  security_descriptor.SetOwner(Sids::Admins());
-  security_descriptor.SetGroup(Sids::Admins());
-  CDacl dacl;
-  dacl.AddAllowedAce(Sids::System(), COM_RIGHTS_EXECUTE);
-  dacl.AddAllowedAce(Sids::Admins(), COM_RIGHTS_EXECUTE);
-  dacl.AddAllowedAce(Sids::AuthenticatedUser(), COM_RIGHTS_EXECUTE);
-
-  security_descriptor.SetDacl(dacl);
-  security_descriptor.MakeAbsolute();
-
-  SECURITY_DESCRIPTOR* sd = const_cast<SECURITY_DESCRIPTOR*>(
-      security_descriptor.GetPSECURITY_DESCRIPTOR());
-
-  return ::CoInitializeSecurity(
-      sd,
-      -1,
-      NULL,   // Let COM choose what authentication services to register.
-      NULL,
-      RPC_C_AUTHN_LEVEL_PKT_PRIVACY,  // Data integrity and encryption.
-      RPC_C_IMP_LEVEL_IDENTIFY,       // Only allow a server to identify.
-      NULL,
-      EOAC_DYNAMIC_CLOAKING | EOAC_NO_CUSTOM_MARSHAL,
-      NULL);
-}
-
-// This is only used for legacy handoff support.
-CString GetProductName(const CString& app_guid) {
-  const TCHAR* product_name = NULL;
-  const TCHAR gears_guid[]   = _T("{283EAF47-8817-4c2b-A801-AD1FADFB7BAA}");
-  const TCHAR google_talk_plugin[]  =
-      _T("{D0AB2EBC-931B-4013-9FEB-C9C4C2225C8C}");
-  const TCHAR youtube_uploader_guid[] =
-      _T("{A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}");
-
-  if (app_guid.CompareNoCase(gears_guid) == 0) {
-    product_name = _T("Gears");
-  } else if (app_guid.CompareNoCase(google_talk_plugin) == 0) {
-      product_name = _T("Google Talk Plugin");
-  } else if (app_guid.CompareNoCase(youtube_uploader_guid) == 0) {
-      product_name = _T("YouTube Uploader");
-  } else {
-      product_name = _T("Google App");
-  }
-  return product_name;
-}
-
-HRESULT RedirectHKCR(bool is_machine) {
-  RegKey classes_key;
-  HRESULT hr = classes_key.Open(is_machine ?
-                                HKEY_LOCAL_MACHINE :
-                                HKEY_CURRENT_USER,
-                                _T("Software\\Classes"),
-                                KEY_ALL_ACCESS);
-  if (FAILED(hr)) {
-    ASSERT(FALSE, (_T("RedirectHKCR - key.Open(%d) fail %d"), is_machine, hr));
-    return hr;
-  }
-
-  LONG result = ::RegOverridePredefKey(HKEY_CLASSES_ROOT, classes_key.Key());
-  if (result != ERROR_SUCCESS) {
-    ASSERT(false, (_T("RedirectHKCR - RegOverridePredefKey fail %d"), result));
-    return HRESULT_FROM_WIN32(result);
-  }
-
-  return S_OK;
-}
-
-HRESULT RemoveRedirectHKCR() {
-  LONG result = ::RegOverridePredefKey(HKEY_CLASSES_ROOT, NULL);
-  if (result != ERROR_SUCCESS) {
-    ASSERT(FALSE, (_T("RemoveRedirectHKCR - RegOverridePredefKey %d"), result));
-    return HRESULT_FROM_WIN32(result);
-  }
-
-  return S_OK;
-}
-
-HRESULT RegisterTypeLib(bool is_admin,
-                        const CComBSTR& path,
-                        ITypeLib* type_lib) {
-  // Typelib registration.
-  CORE_LOG(L3, (_T("[Registering TypeLib]")));
-  HRESULT hr = S_OK;
-  if (!is_admin &&
-      SUCCEEDED(goopdate_utils::RegisterTypeLibForUser(type_lib, path, NULL))) {
-    return S_OK;
-  }
-
-  // For Admin cases, we use ::RegisterTypeLib().
-  // For platforms where ::RegisterTypeLibForUser is not available, we register
-  // with ::RegisterTypeLib, and rely on HKCR=>HKCU redirection.
-  hr = ::RegisterTypeLib(type_lib, path, NULL);
-  ASSERT(SUCCEEDED(hr), (_T("[TypeLib registration failed][0x%08x]"), hr));
-  return hr;
-}
-
-HRESULT UnRegisterTypeLib(bool is_admin, const CComBSTR&, ITypeLib* type_lib) {
-  // Typelib unregistration.
-  CORE_LOG(L3, (_T("[Unregistering Typelib]")));
-  TLIBATTR* tlib_attr = NULL;
-  HRESULT hr = type_lib->GetLibAttr(&tlib_attr);
-  ASSERT(SUCCEEDED(hr), (_T("[GetLibAttr failed][0x%08x]"), hr));
-  if (FAILED(hr)) {
-    return hr;
-  }
-  ON_SCOPE_EXIT_OBJ(*type_lib, &ITypeLib::ReleaseTLibAttr, tlib_attr);
-
-  if (!is_admin &&
-      SUCCEEDED(goopdate_utils::UnRegisterTypeLibForUser(
-          tlib_attr->guid,
-          tlib_attr->wMajorVerNum,
-          tlib_attr->wMinorVerNum,
-          tlib_attr->lcid,
-          tlib_attr->syskind))) {
-    return S_OK;
-  }
-
-  // For Admin cases, we use ::UnRegisterTypeLib().
-  // For platforms where ::UnRegisterTypeLibForUser is not available, we
-  // unregister with ::UnRegisterTypeLib, and rely on HKCR=>HKCU redirection.
-  hr = ::UnRegisterTypeLib(tlib_attr->guid,
-                           tlib_attr->wMajorVerNum,
-                           tlib_attr->wMinorVerNum,
-                           tlib_attr->lcid,
-                           tlib_attr->syskind);
-
-  // We assert before the check for TYPE_E_REGISTRYACCESS below because we want
-  // to catch the case where we're trying to unregister more than once because
-  // that would be a bug.
-  ASSERT(SUCCEEDED(hr),
-         (_T("[UnRegisterTypeLib failed.  ")
-          _T("This is likely a multiple unregister bug.][0x%08x]"), hr));
-
-  // If you try to unregister a type library that's already unregistered,
-  // it will return with this failure, which is OK.
-  if (hr == TYPE_E_REGISTRYACCESS) {
-    hr = S_OK;
-  }
-
-  return hr;
-}
-
-HRESULT RegisterOrUnregisterModule(bool is_machine,
-                                   bool register_server,
-                                   RegisterOrUnregisterFunction registrar,
-                                   void* data) {
-  ASSERT1(registrar);
-
-  // ATL by default registers the control to HKCR and we want to register
-  // either in HKLM, or in HKCU, depending on whether we are laying down
-  // the system googleupdate, or the user googleupdate.
-  // We solve this for the user goopdate case by:
-  // * Having the RGS file take a HKROOT parameter that translates to either
-  //   HKLM or HKCU.
-  // * Redirecting HKCR to HKCU\software\classes, for a user installation, to
-  //   cover Proxy registration.
-  // For the machine case, we still redirect HKCR to HKLM\\Software\\Classes,
-  // to ensure that Proxy registration happens in HKLM.
-  HRESULT hr = RedirectHKCR(is_machine);
-  ASSERT1(SUCCEEDED(hr));
-  if (FAILED(hr)) {
-    return hr;
-  }
-  // We need to stop redirecting at the end of this function.
-  ON_SCOPE_EXIT(RemoveRedirectHKCR);
-
-  hr = (*registrar)(data, register_server);
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[RegisterOrUnregisterModule failed][%d][0x%08x]"),
-                  register_server, hr));
-    ASSERT1(!register_server);
-  }
-
-  return hr;
-}
-
-HRESULT RegisterOrUnregisterModuleWithTypelib(
-    bool is_machine,
-    bool register_server,
-    RegisterOrUnregisterFunction registrar,
-    void* data) {
-  ASSERT1(registrar);
-
-  // By default, ATL registers the control to HKCR and we want to register
-  // either in HKLM, or in HKCU, depending on whether we are laying down
-  // the machine googleupdate, or the user googleupdate.
-  // We solve this for the user goopdate case by:
-  // * Having the RGS file take a HKROOT parameter that translates to either
-  //   HKLM or HKCU.
-  // * Redirecting HKCR to HKCU\software\classes, for a user installation, to
-  //   cover AppId and TypeLib registration
-  // * All the above makes ATL work correctly for 2K/XP. However on Win2K3
-  //   and Vista, redirection does not work by itself, because in these
-  //   platforms, RegisterTypeLib writes explicitly to HKLM\Software\Classes.
-  //   We need to specifically call the new RegisterTypeLibForUser() API.
-  //   So, we do that as well.
-  // For the machine case, we still redirect HKCR to HKLM\\Software\\Classes,
-  // because otherwise RegisterTypeLib ends up overwriting HKCU if the key
-  // already exists in HKCU.
-  HRESULT hr = RedirectHKCR(is_machine);
-  ASSERT1(SUCCEEDED(hr));
-  if (FAILED(hr)) {
-    return hr;
-  }
-  // We need to stop redirecting at the end of this function.
-  ON_SCOPE_EXIT(RemoveRedirectHKCR);
-
-  // load the type library.
-  CComPtr<ITypeLib> type_lib;
-  CComBSTR path;
-  hr = ::AtlLoadTypeLib(_AtlBaseModule.GetModuleInstance(), NULL, &path,
-                        &type_lib);
-  if (FAILED(hr)) {
-    ASSERT(false, (_T("[AtlLoadTypeLib failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  if (register_server) {
-    hr = (*registrar)(data, register_server);
-    if (FAILED(hr)) {
-      ASSERT(false, (_T("[Module registration failed][0x%08x]"), hr));
-      return hr;
-    }
-
-    return RegisterTypeLib(is_machine, path, type_lib);
-  } else {
-    hr = UnRegisterTypeLib(is_machine, path, type_lib);
-    if (FAILED(hr)) {
-      ASSERT(false, (_T("[UnRegisterTypeLib failed][0x%08x]"), hr));
-      return hr;
-    }
-
-    return (*registrar)(data, register_server);
-  }
-}
-
-HRESULT RegisterTypeLibForUser(ITypeLib* lib,
-                               OLECHAR* path,
-                               OLECHAR* help_dir) {
-  CORE_LOG(L3, (_T("[RegisterTypeLibForUser]")));
-  ASSERT1(lib);
-  ASSERT1(path);
-  // help_dir can be NULL.
-
-  const TCHAR* library_name = _T("oleaut32.dll");
-  scoped_library module(static_cast<HINSTANCE>(::LoadLibrary(library_name)));
-  if (!module) {
-    HRESULT hr = HRESULTFromLastError();
-    CORE_LOG(LEVEL_ERROR,
-        (_T("[LoadLibrary failed][%s][0x%08x]"), library_name, hr));
-    return hr;
-  }
-
-  // RegisterTypeLibForUser function from oleaut32.dll.
-  typedef HRESULT(__stdcall *PF)(ITypeLib*, OLECHAR*, OLECHAR*);
-
-  const char* function_name = "RegisterTypeLibForUser";
-  PF fp = reinterpret_cast<PF>(::GetProcAddress(get(module), function_name));
-  if (!fp) {
-    HRESULT hr = HRESULTFromLastError();
-    CORE_LOG(LEVEL_ERROR,
-             (_T("[GetProcAddress failed][%s][0x%08x]"),
-              function_name, library_name, hr));
-    return hr;
-  }
-
-  CORE_LOG(L3, (_T("[Calling RegisterTypelibForUser in oleaut]")));
-  HRESULT hr = fp(lib, path, help_dir);
-  if (FAILED(hr)) {
-    CORE_LOG(LEVEL_ERROR, (_T("[regtypelib_for_user failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT UnRegisterTypeLibForUser(REFGUID lib_id,
-                                 WORD major_ver_num,
-                                 WORD minor_ver_num,
-                                 LCID lcid,
-                                 SYSKIND syskind) {
-  CORE_LOG(L3, (_T("[UnRegisterTypeLibForUser]")));
-
-  const TCHAR* library_name = _T("oleaut32.dll");
-  scoped_library module(static_cast<HINSTANCE>(::LoadLibrary(library_name)));
-  if (!module) {
-    HRESULT hr = HRESULTFromLastError();
-    CORE_LOG(LEVEL_ERROR,
-        (_T("[LoadLibrary failed][%s][0x%08x]"), library_name, hr));
-    return hr;
-  }
-
-  // UnRegisterTypeLibForUser function from oleaut32.dll.
-  typedef HRESULT (__stdcall *PF)(REFGUID, WORD, WORD, LCID, SYSKIND);
-
-  const char* function_name = "UnRegisterTypeLibForUser";
-  PF fp = reinterpret_cast<PF>(::GetProcAddress(get(module), function_name));
-  if (!fp) {
-    HRESULT hr = HRESULTFromLastError();
-    CORE_LOG(LEVEL_ERROR,
-             (_T("[GetProcAddress failed][%s][0x%08x]"),
-              function_name, library_name, hr));
-    return hr;
-  }
-
-  CORE_LOG(L3, (_T("[Calling UnRegisterTypeLibForUser in oleaut]")));
-  HRESULT hr = fp(lib_id, major_ver_num, minor_ver_num, lcid, syskind);
-  if (FAILED(hr)) {
-    CORE_LOG(LEVEL_ERROR, (_T("[unregtypelib_for_user failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// TODO(omaha): This method's name is much more specific than what it does. Can
-// we just copy the code to scheduled task and service code and eliminate it?
-// Reads the current value under {HKLM|HKCU}\Google\Update\value_name. Returns
-// default_val if value_name does not exist.
-CString GetCurrentVersionedName(bool is_machine,
-                                const TCHAR* value_name,
-                                const TCHAR* default_val) {
-  CORE_LOG(L3, (_T("[ConfigManager::GetCurrentVersionedName]")));
-  ASSERT1(value_name && *value_name);
-  ASSERT1(default_val && *default_val);
-
-  const TCHAR* key_name = is_machine ? MACHINE_REG_UPDATE : USER_REG_UPDATE;
-  CString name;
-  HRESULT hr(RegKey::GetValue(key_name, value_name, &name));
-  if (FAILED(hr)) {
-    CORE_LOG(L4, (_T("[GetValue failed][%s][0x%x][Using default name][%s]"),
-                  value_name, hr, default_val));
-    name = default_val;
-  }
-
-  CORE_LOG(L3, (_T("[Versioned Name][%s]"), name));
-  return name;
-}
-
-// Creates a unique name of the form "{prefix}1c9b3d6baf90df3" and stores it in
-// the registry under HKLM/HKCU\Google\Update\value_name. Subsequent
-// invocations of GetCurrentTaskName() will return this new value.
-HRESULT CreateAndSetVersionedNameInRegistry(bool is_machine,
-                                            const TCHAR* prefix,
-                                            const TCHAR* value_name) {
-  ASSERT1(prefix && *prefix);
-  ASSERT1(value_name && *value_name);
-
-  // TODO(omaha): Move from service_utils.h since it is used for other purposes.
-  CString name(ServiceInstall::GenerateServiceName(prefix));
-  CORE_LOG(L3, (_T("Versioned name[%s][%s][%s]"), prefix, value_name, name));
-
-  const TCHAR* key_name = is_machine ? MACHINE_REG_UPDATE : USER_REG_UPDATE;
-  return RegKey::SetValue(key_name, value_name, name);
-}
-
-HRESULT TerminateAllBrowsers(
-    BrowserType type,
-    TerminateBrowserResult* browser_res,
-    TerminateBrowserResult* default_res) {
-  UTIL_LOG(L3, (_T("[TerminateAllBrowsers][%d]"), type));
-  ASSERT1(default_res);
-  ASSERT1(browser_res);
-
-  if (type == BROWSER_UNKNOWN ||
-      type == BROWSER_DEFAULT ||
-      type >= BROWSER_MAX) {
-    ASSERT1(false);
-    return E_INVALIDARG;
-  }
-
-  const BrowserType kFirstBrowser = BROWSER_IE;
-  const int kNumSupportedBrowsers = BROWSER_MAX - kFirstBrowser;
-
-  BrowserType default_type = BROWSER_UNKNOWN;
-  HRESULT hr = GetDefaultBrowserType(&default_type);
-  if (FAILED(hr)) {
-    UTIL_LOG(LW, (_T("[GetDefaultBrowserType failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  TerminateBrowserResult terminate_results[kNumSupportedBrowsers];
-
-  for (int browser = 0; browser < kNumSupportedBrowsers; ++browser) {
-    const BrowserType browser_type =
-        static_cast<BrowserType>(kFirstBrowser + browser);
-    hr = TerminateBrowserProcess(browser_type,
-                                 CString(),
-                                 0,
-                                 &terminate_results[browser].found);
-    if (FAILED(hr)) {
-      UTIL_LOG(LW, (_T("[TerminateBrowserProcess failed][%u][0x%08x]"),
-                    browser_type, hr));
-    }
-  }
-
-  // Now wait for the all browser instances to die.
-  // TODO(omaha): Wait for all processes at once rather than waiting for
-  // (kTerminateBrowserTimeoutMs * # supported browsers) ms.
-  for (int browser = 0; browser < kNumSupportedBrowsers; ++browser) {
-    const BrowserType browser_type =
-        static_cast<BrowserType>(kFirstBrowser + browser);
-    hr = WaitForBrowserToDie(browser_type,
-                             CString(),
-                             kTerminateBrowserTimeoutMs);
-    if (FAILED(hr)) {
-      UTIL_LOG(LW, (_T("[WaitForBrowserToDie failed][%u][0x%08x]"),
-                    browser_type, hr));
-    } else {
-      terminate_results[browser].could_terminate = true;
-    }
-  }
-
-  *browser_res = terminate_results[type - kFirstBrowser];
-  *default_res = terminate_results[default_type - kFirstBrowser];
-
-  return S_OK;
-}
-
-// default_type can be BROWSER_UNKNOWN.
-// If browsers that must be closed could not be terminated, false is returned.
-// This method and TerminateBrowserProcesses assume the user did not shutdown
-// the specified browser. They restart and shutdown, respectively, the default
-// browser when the specified browser is not found. The reason for this may have
-// been that the the specified (stamped) browser could be in a bad state on the
-// machine and trying to start it would fail.
-// This may also be required to support hosted cases (i.e. AOL and Maxthon).
-// TODO(omaha): If we assume the stamped browser is okay, check whether the
-// specified browser is installed rather than relying on whether the browser was
-// running. It is perfectly valid for the browser to not be running.
-// TODO(omaha): Why not try the default browser if browsers that require
-// shutdown failed to terminate.
-bool GetBrowserToRestart(BrowserType type,
-                         BrowserType default_type,
-                         const TerminateBrowserResult& res,
-                         const TerminateBrowserResult& def_res,
-                         BrowserType* browser_type) {
-  ASSERT1(browser_type);
-  ASSERT1(type != BROWSER_UNKNOWN &&
-          type != BROWSER_DEFAULT &&
-          type < BROWSER_MAX);
-  ASSERT1(default_type != BROWSER_DEFAULT && default_type < BROWSER_MAX);
-  UTIL_LOG(L3, (_T("[GetBrowserToRestart][%d]"), type));
-
-  *browser_type = BROWSER_UNKNOWN;
-
-  if (res.found) {
-    switch (type) {
-      case BROWSER_IE:
-        *browser_type = BROWSER_IE;
-        return true;
-      case BROWSER_FIREFOX:   // Only one process.
-      case BROWSER_CHROME:    // One process per plug-in, even for upgrades.
-        if (res.could_terminate) {
-          *browser_type = type;
-          return true;
-        }
-        return false;
-      case BROWSER_UNKNOWN:
-      case BROWSER_DEFAULT:
-      case BROWSER_MAX:
-      default:
-        break;
-    }
-  }
-
-  // We did not find the browser that we wanted to restart. Hence we need to
-  // determine if we could shutdown the default browser.
-  switch (default_type) {
-    case BROWSER_IE:
-      *browser_type = BROWSER_IE;
-      return true;
-    case BROWSER_FIREFOX:
-    case BROWSER_CHROME:
-      if (!def_res.found || def_res.found && def_res.could_terminate) {
-        *browser_type = default_type;
-        return true;
-      }
-      break;
-    case BROWSER_UNKNOWN:
-    case BROWSER_DEFAULT:
-    case BROWSER_MAX:
-    default:
-      break;
-  }
-
-  return false;
-}
-
-// See the comments about the default browser above GetBrowserToRestart.
-HRESULT TerminateBrowserProcesses(BrowserType type,
-                                  TerminateBrowserResult* browser_res,
-                                  TerminateBrowserResult* default_res) {
-  UTIL_LOG(L3, (_T("[TerminateBrowserProcesses][%d]"), type));
-  ASSERT1(browser_res);
-  ASSERT1(default_res);
-
-  browser_res->could_terminate = false;
-  default_res->could_terminate = false;
-
-  if (type == BROWSER_UNKNOWN ||
-      type == BROWSER_DEFAULT ||
-      type >= BROWSER_MAX) {
-    ASSERT1(false);
-    return E_UNEXPECTED;
-  }
-
-  CString sid;
-  HRESULT hr = user_info::GetProcessUser(NULL, NULL, &sid);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[GetProcessUser failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  hr = TerminateBrowserProcess(type,
-                               sid,
-                               kTerminateBrowserTimeoutMs,
-                               &browser_res->found);
-  if (FAILED(hr)) {
-    UTIL_LOG(LW, (_T("[TerminateBrowserProcess failed][0x%08x]"), hr));
-  } else {
-    browser_res->could_terminate = true;
-  }
-
-  // Since no instances of the browser type exist, we try to find and kill
-  // all instances of the default browser.
-  if (!browser_res->found) {
-    // We dont want to try and terminate the default browser, if it is the
-    // same as the browser that we tried above.
-
-    BrowserType default_type = BROWSER_UNKNOWN;
-    hr = GetDefaultBrowserType(&default_type);
-    if (FAILED(hr)) {
-      UTIL_LOG(LW, (_T("[GetDefaultBrowserType failed][0x%08x]"), hr));
-    }
-
-    UTIL_LOG(L3, (_T("[Trying to kill the default browser %d]"), default_type));
-    if (default_type != type) {
-      hr = TerminateBrowserProcess(BROWSER_DEFAULT,
-                                   sid,
-                                   kTerminateBrowserTimeoutMs,
-                                   &default_res->found);
-      if (FAILED(hr)) {
-        UTIL_LOG(LW, (_T("[TerminateBrowserProcess failed][0x%08x]"), hr));
-      } else {
-        default_res->could_terminate = true;
-      }
-    }
-  }
-
-  return hr;
-}
-
-HRESULT GetBrowserImagePathFromProcess(BrowserType type,
-                                       uint32 explorer_pid,
-                                       CString* path) {
-  ASSERT1(path);
-
-  if (type == BROWSER_UNKNOWN || type >= BROWSER_MAX) {
-    ASSERT1(false);
-    return E_UNEXPECTED;
-  }
-
-  if (type == BROWSER_DEFAULT) {
-    return GetDefaultBrowserPath(path);
-  }
-
-  CString user_sid;
-  HRESULT hr = Process::GetProcessOwner(explorer_pid, &user_sid);
-  if (FAILED(hr)) {
-    UTIL_LOG(LEVEL_WARNING, (_T("[GetProcessOwner failed.][0x%08x]"), hr));
-    return hr;
-  }
-
-  CString browser_name;
-  hr = BrowserTypeToProcessName(type, &browser_name);
-  if (FAILED(hr)) {
-    UTIL_LOG(LW, (_T("[BrowserTypeToProcessName failed.][0x%08x]"), hr));
-    return hr;
-  }
-
-  hr = Process::GetImagePath(browser_name, user_sid, path);
-  if (FAILED(hr)) {
-    UTIL_LOG(LW, (_T("[GetImagePath failed.][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT ConvertStringToBrowserType(const CString& text, BrowserType* type) {
-  ASSERT1(type != NULL);
-
-  if (text.GetLength() != 1) {
-    return GOOPDATEUTILS_E_BROWSERTYPE;
-  }
-
-  int browser_type = 0;
-  if (!String_StringToDecimalIntChecked(text, &browser_type)) {
-    return GOOPDATEUTILS_E_BROWSERTYPE;
-  }
-
-  if (browser_type >= BROWSER_MAX) {
-    return GOOPDATEUTILS_E_BROWSERTYPE;
-  }
-
-  *type = static_cast<BrowserType>(browser_type);
-  return S_OK;
-}
-
-CString ConvertBrowserTypeToString(BrowserType type) {
-  CString text = itostr(static_cast<int>(type));
-  ASSERT1(!text.IsEmpty());
-  return text;
-}
-
-HRESULT GetOSInfo(CString* os_version, CString* service_pack) {
-  ASSERT1(os_version);
-  ASSERT1(service_pack);
-
-  OSVERSIONINFO os_version_info = { 0 };
-  os_version_info.dwOSVersionInfoSize = sizeof(os_version_info);
-  if (!::GetVersionEx(&os_version_info)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LW, (_T("[GetVersionEx failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  os_version->Format(_T("%d.%d"),
-                     os_version_info.dwMajorVersion,
-                     os_version_info.dwMinorVersion);
-  *service_pack = os_version_info.szCSDVersion;
-  return S_OK;
-}
-
-CPath BuildInstallDirectory(bool is_machine, const CString& version) {
-  ConfigManager& cm = *ConfigManager::Instance();
-  CPath install_dir(is_machine ? cm.GetMachineGoopdateInstallDir() :
-                                 cm.GetUserGoopdateInstallDir());
-  VERIFY1(install_dir.Append(version));
-
-  return install_dir;
-}
-
-// This method does a very specific job of searching for install workers,
-// for the user and machine omaha. It also includes the on-demand updates COM
-// server, because we treat it similar to interactive installs, and selfupdate.
-//
-// In machine case we search in all the accounts since the install worker can be
-// running in any admin account and the machine update worker runs as SYSTEM.
-// In the user case, we only search the user's account.
-// In both cases, the Needsadmin command line parameter is checked for
-// true/false in the machine/user case, respectively.
-//
-// Only adds processes to the input vector; does not clear it.
-//
-// TODO(omaha): For now we search for the needs_admin=true in the command
-// line to determine a machine install. Another option of identifying omaha's
-// is to use the presence of a named mutex. So the user omaha will create
-// Global\<sid>\Mutex and the machine will create Global\Mutex, in here then
-// we can test for the presence of the name to decide if an interactive
-// omaha is running.
-// TODO(omaha): Consider further filtering the processes based on whether
-// the owner is elevated in case of machine omaha.
-// Looks for the /ig command line used in Omaha 2.
-HRESULT GetInstallWorkerProcesses(bool is_machine,
-                                  std::vector<uint32>* processes) {
-  ASSERT1(processes);
-
-  CString user_sid;
-  DWORD flags = EXCLUDE_CURRENT_PROCESS |
-                EXCLUDE_PARENT_PROCESS  |
-                INCLUDE_PROCESS_COMMAND_LINE_CONTAINING_STRING;
-
-  std::vector<CString> command_lines;
-  CString command_line_to_include;
-  command_line_to_include.Format(_T("/%s"), kCmdLineInstall);
-  command_lines.push_back(command_line_to_include);
-  command_line_to_include.Format(_T("/%s"), kCmdLineInstallElevated);
-  command_lines.push_back(command_line_to_include);
-  command_line_to_include.Format(_T("/%s"), kCmdLineAppHandoffInstall);
-  command_lines.push_back(command_line_to_include);
-  command_line_to_include.Format(_T("/%s"), kCmdLineUpdate);
-  command_lines.push_back(command_line_to_include);
-  command_line_to_include.Format(_T("/%s"),
-                                 kCmdLineLegacyFinishGoogleUpdateInstall);
-  command_lines.push_back(command_line_to_include);
-  command_lines.push_back(kCmdLineComServerDash);
-
-  if (!is_machine) {
-    // Search only the same sid as the current user.
-    flags |= INCLUDE_ONLY_PROCESS_OWNED_BY_USER;
-
-    HRESULT hr = user_info::GetProcessUser(NULL, NULL, &user_sid);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[GetProcessUser failed][0x%08x]"), hr));
-      return hr;
-    }
-  }
-
-  std::vector<uint32> all_install_worker_processes;
-  HRESULT hr = Process::FindProcesses(flags,
-                                      kOmahaShellFileName,
-                                      true,
-                                      user_sid,
-                                      command_lines,
-                                      &all_install_worker_processes);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[FindProcesses failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  CString official_path;
-  hr = GetFolderPath(is_machine ? CSIDL_PROGRAM_FILES : CSIDL_LOCAL_APPDATA,
-                     &official_path);
-  ASSERT1(SUCCEEDED(hr));
-  ASSERT1(!official_path.IsEmpty());
-
-  for (size_t i = 0; i < all_install_worker_processes.size(); ++i) {
-    CString cmd_line;
-    const uint32 process = all_install_worker_processes[i];
-    if (SUCCEEDED(Process::GetCommandLine(process, &cmd_line))) {
-      cmd_line.MakeLower();
-      // TODO(omaha): FindProcess method does not allow regex's to be specified
-      // along with the include command line. Change Process to allow this.
-      if (cmd_line.Find(is_machine ? kNeedsAdminYes : kNeedsAdminNo) != -1) {
-        CORE_LOG(L4, (_T("[Including process][%s]"), cmd_line));
-        processes->push_back(process);
-      }
-
-      // A needsadmin=prefers instance could be installing either for machine or
-      // for user.
-      if (cmd_line.Find(kNeedsAdminPrefers) != -1) {
-        CORE_LOG(L4, (_T("[Including process][%s]"), cmd_line));
-        processes->push_back(process);
-      }
-
-      // The -Embedding does not have a needsAdmin. Decide whether to include it
-      // if it matches the official path for the requested instance type.
-      CString exe_path;
-      if (cmd_line.Find(kCmdLineComServerDash) != -1 &&
-          SUCCEEDED(GetExePathFromCommandLine(cmd_line, &exe_path)) &&
-          String_StrNCmp(official_path, exe_path, official_path.GetLength(),
-                         true) == 0) {
-        CORE_LOG(L4, (_T("[Including process][%s]"), cmd_line));
-        processes->push_back(process);
-      }
-    }
-  }
-
-  return S_OK;
-}
-
-// The event name saved to the environment variable does not contain the
-// decoration added by GetNamedObjectAttributes.
-HRESULT CreateUniqueEventInEnvironment(const CString& var_name,
-                                       bool is_machine,
-                                       HANDLE* unique_event) {
-  ASSERT1(unique_event);
-
-  GUID event_guid = GUID_NULL;
-  HRESULT hr = ::CoCreateGuid(&event_guid);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[::CoCreateGuid failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  CString event_name(GuidToString(event_guid));
-  NamedObjectAttributes attr;
-  GetNamedObjectAttributes(event_name, is_machine, &attr);
-
-  hr = CreateEvent(&attr, unique_event);
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[CreateEvent failed in CreateUniqueEventInEnvironment]"),
-                  _T("[%s][0x%08x]"), var_name, hr));
-    return hr;
-  }
-
-  CORE_LOG(L3, (_T("[created unique event][%s][%s]"), var_name, event_name));
-
-  if (!::SetEnvironmentVariable(var_name, event_name)) {
-    DWORD error = ::GetLastError();
-    CORE_LOG(LE, (_T("[::SetEnvironmentVariable failed][%d]"), error));
-    return HRESULT_FROM_WIN32(error);
-  }
-
-  return S_OK;
-}
-
-HRESULT OpenUniqueEventFromEnvironment(const CString& var_name,
-                                       bool is_machine,
-                                       HANDLE* unique_event) {
-  ASSERT1(unique_event);
-
-  TCHAR event_name[MAX_PATH] = {0};
-  if (!::GetEnvironmentVariable(var_name, event_name, arraysize(event_name))) {
-    DWORD error = ::GetLastError();
-    CORE_LOG(LW, (_T("[Failed to read environment variable][%s][%d]"),
-                  var_name, error));
-    return HRESULT_FROM_WIN32(error);
-  }
-
-  CORE_LOG(L3, (_T("[read unique event][%s][%s]"), var_name, event_name));
-
-  NamedObjectAttributes attr;
-  GetNamedObjectAttributes(event_name, is_machine, &attr);
-  *unique_event = ::OpenEvent(EVENT_ALL_ACCESS, false, attr.name);
-
-  if (!*unique_event) {
-    DWORD error = ::GetLastError();
-    CORE_LOG(LW, (_T("[::OpenEvent failed][%s][%d]"), attr.name, error));
-    return HRESULT_FROM_WIN32(error);
-  }
-
-  return S_OK;
-}
-
-// The caller is responsible for reseting the event and closing the handle.
-HRESULT CreateEvent(NamedObjectAttributes* event_attr, HANDLE* event_handle) {
-  ASSERT1(event_handle);
-  ASSERT1(event_attr);
-  ASSERT1(!event_attr->name.IsEmpty());
-  *event_handle = ::CreateEvent(&event_attr->sa,
-                                true,   // manual reset
-                                false,  // not signaled
-                                event_attr->name);
-
-  if (!*event_handle) {
-    DWORD error = ::GetLastError();
-    CORE_LOG(LEVEL_ERROR, (_T("[::CreateEvent failed][%d]"), error));
-    return HRESULT_FROM_WIN32(error);
-  }
-
-  return S_OK;
-}
-
-bool IsTestSource() {
-  return !ConfigManager::Instance()->GetTestSource().IsEmpty();
-}
-
-HRESULT ReadNameValuePairsFromFile(const CString& file_path,
-                                   const CString& group_name,
-                                   std::map<CString, CString>* pairs) {
-  ASSERT1(pairs);
-
-  if (!File::Exists(file_path)) {
-    return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
-  }
-
-  pairs->clear();
-
-  TCHAR str_buf[32768] = {0};
-
-  // Retrieve all key names in the section requested.
-  DWORD buf_count = ::GetPrivateProfileString(group_name,
-                                              NULL,
-                                              NULL,
-                                              str_buf,
-                                              arraysize(str_buf),
-                                              file_path);
-
-  DWORD offset = 0;
-  while (offset < buf_count) {
-    TCHAR val_buf[1024] = {0};
-    CString current_key = &(str_buf[offset]);
-    DWORD val_count = ::GetPrivateProfileString(group_name,
-                                                current_key,
-                                                NULL,
-                                                val_buf,
-                                                arraysize(val_buf),
-                                                file_path);
-    (*pairs)[current_key] = val_buf;
-    offset += current_key.GetLength() + 1;
-  }
-
-  return S_OK;
-}
-
-HRESULT WriteNameValuePairsToFile(const CString& file_path,
-                                  const CString& group_name,
-                                  const std::map<CString, CString>& pairs) {
-  std::map<CString, CString>::const_iterator it = pairs.begin();
-  for (; it != pairs.end(); ++it) {
-    if (!::WritePrivateProfileString(group_name,
-                                     it->first,
-                                     it->second,
-                                     file_path)) {
-      return HRESULTFromLastError();
-    }
-  }
-
-  return S_OK;
-}
-
-bool IsAppInstallWorkerRunning(bool is_machine) {
-  CORE_LOG(L3, (_T("[IsAppInstallWorkerRunning][%d]"), is_machine));
-  std::vector<uint32> processes;
-  VERIFY1(SUCCEEDED(GetInstallWorkerProcesses(is_machine, &processes)));
-  return !processes.empty();
-}
-
-// Returns true if the version does not begin with "1.0." or "1.1.".
-bool IsGoogleUpdate2OrLater(const CString& version) {
-  const ULONGLONG kFirstOmaha2Version = MAKEDLLVERULL(1, 2, 0, 0);
-  ULONGLONG version_number = VersionFromString(version);
-  ASSERT1(0 != version_number);
-
-  if (kFirstOmaha2Version <= version_number) {
-    return true;
-  }
-
-  return false;
-}
-
-HRESULT WriteInstallerDataToTempFile(const CString& installer_data,
-                                     CString* installer_data_file_path) {
-  ASSERT1(installer_data_file_path);
-
-  // TODO(omaha): consider eliminating the special case and simply create an
-  // empty file.
-  CORE_LOG(L2, (_T("[WriteInstallerDataToTempFile][data=%s]"), installer_data));
-  if (installer_data.IsEmpty()) {
-    return S_FALSE;
-  }
-
-  CString temp_file;
-  if (!::GetTempFileName(app_util::GetTempDir(),
-                         _T("gui"),
-                         0,
-                         CStrBuf(temp_file, MAX_PATH))) {
-    HRESULT hr = HRESULTFromLastError();
-    CORE_LOG(LE, (_T("[::GetTempFileName failed][0x08%x]"), hr));
-    return hr;
-  }
-
-  scoped_hfile file_handle(::CreateFile(temp_file,
-                                        GENERIC_WRITE,
-                                        FILE_SHARE_READ,
-                                        NULL,
-                                        CREATE_ALWAYS,
-                                        FILE_ATTRIBUTE_NORMAL,
-                                        NULL));
-  if (!file_handle) {
-    HRESULT hr = HRESULTFromLastError();
-    CORE_LOG(LE, (_T("[::CreateFile failed][0x08%x]"), hr));
-    return hr;
-  }
-
-  CStringA installer_data_utf8_bom;
-  SafeCStringAFormat(&installer_data_utf8_bom, "%c%c%c%s",
-                     0xEF, 0xBB, 0xBF, WideToUtf8(installer_data));
-
-  DWORD bytes_written = 0;
-  if (!::WriteFile(get(file_handle),
-                   installer_data_utf8_bom,
-                   installer_data_utf8_bom.GetLength(),
-                   &bytes_written,
-                   NULL)) {
-    HRESULT hr = HRESULTFromLastError();
-    CORE_LOG(LE, (_T("[::WriteFile failed][0x08%x]"), hr));
-    return hr;
-  }
-
-  *installer_data_file_path = temp_file;
-  return S_OK;
-}
-
-// Returns true if the absolute difference between time moments is greater than
-// the interval between update checks.
-// Deals with clocks rolling backwards, in scenarios where the clock indicates
-// some time in the future, for example next year, last_checked_ is updated to
-// reflect that time, and then the clock is adjusted back to present.
-bool ShouldCheckForUpdates(bool is_machine) {
-  ConfigManager* cm = ConfigManager::Instance();
-  bool is_period_overridden = false;
-  const int update_interval = cm->GetLastCheckPeriodSec(&is_period_overridden);
-  if (0 == update_interval) {
-    ASSERT1(is_period_overridden);
-    OPT_LOG(L1, (_T("[ShouldCheckForUpdates returned 0][checks disabled]")));
-    return false;
-  }
-
-  const int time_difference = cm->GetTimeSinceLastCheckedSec(is_machine);
-
-  const bool result = time_difference >= update_interval ? true : false;
-  CORE_LOG(L3, (_T("[ShouldCheckForUpdates returned %d][%u]"),
-                result, is_period_overridden));
-  return result;
-}
-
-HRESULT UpdateLastChecked(bool is_machine) {
-  // Set the last check value to the current value.
-  DWORD now = Time64ToInt32(GetCurrent100NSTime());
-  CORE_LOG(L3, (_T("[UpdateLastChecked][now %d]"), now));
-  HRESULT hr = ConfigManager::Instance()->SetLastCheckedTime(is_machine, now);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[SetLastCheckedTime failed][0x%08x]"), hr));
-    return hr;
-  }
-  return S_OK;
-}
-
-HRESULT LaunchUninstallProcess(bool is_machine) {
-  CORE_LOG(L2, (_T("[LaunchUninstallProcess]")));
-  CString exe_path = BuildGoogleUpdateExePath(is_machine);
-  CommandLineBuilder builder(COMMANDLINE_MODE_UNINSTALL);
-  CString cmd_line = builder.GetCommandLineArgs();
-  return System::StartProcessWithArgs(exe_path, cmd_line);
-}
-
-HANDLE GetImpersonationTokenForMachineProcess(bool is_machine) {
-  if (!is_machine) {
-    return NULL;
-  }
-
-  CAccessToken access_token;
-  if (access_token.GetThreadToken(TOKEN_READ)) {
-    return NULL;
-  }
-
-  bool is_local_system(false);
-  VERIFY1(SUCCEEDED(IsSystemProcess(&is_local_system)));
-  if (!is_local_system) {
-    return NULL;
-  }
-
-  HANDLE handle = NULL;
-  HRESULT hr = vista::GetLoggedOnUserToken(&handle);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[GetLoggedOnUserToken failed][0x%x]"), hr));
-    return NULL;
-  }
-
-  return handle;
-}
-
-HRESULT EnableSEHOP(bool enable) {
-  CORE_LOG(L3, (_T("[EnableSEHOP][%d]"), enable));
-  CString omaha_ifeo_key_path;
-  omaha_ifeo_key_path.Format(_T("%s\\%s"),
-                             kRegKeyImageFileExecutionOptions,
-                             kOmahaShellFileName);
-  return enable ?
-      RegKey::SetValue(omaha_ifeo_key_path, kRegKeyDisableSEHOPValue,
-                       static_cast<DWORD>(0)) :
-      RegKey::DeleteValue(omaha_ifeo_key_path, kRegKeyDisableSEHOPValue);
-}
-
-DEFINE_METRIC_count(opt_in_uid_generated);
-HRESULT CreateUserId(bool is_machine) {
-  // Do not create user ID when doing OEM installation - to avoid a large
-  // number of machines have the same ID.
-  if (oem_install_utils::IsOemInstalling(is_machine)) {
-    return E_FAIL;
-  }
-
-  GLock user_id_lock;
-  NamedObjectAttributes lock_attr;
-  GetNamedObjectAttributes(kOptUserIdLock, is_machine, &lock_attr);
-  if (!user_id_lock.InitializeWithSecAttr(lock_attr.name, &lock_attr.sa)) {
-    return E_FAIL;
-  }
-
-  __mutexScope(user_id_lock);
-  RegKey update_key;
-  const ConfigManager& config_manager = *ConfigManager::Instance();
-  HRESULT hr = update_key.Create(config_manager.registry_update(is_machine));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (update_key.HasValue(kRegValueUserId)) {
-    return S_OK;
-  }
-
-  CString user_id;
-  hr = GetGuid(&user_id);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = update_key.SetValue(kRegValueUserId, user_id);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  ++metric_opt_in_uid_generated;
-  CORE_LOG(L3, (_T("[Create unique user ID: %s]"), user_id));
-  return S_OK;
-}
-
-void DeleteUserId(bool is_machine) {
-  RegKey::DeleteValue(ConfigManager::Instance()->registry_update(is_machine),
-                      kRegValueUserId);
-}
-
-CString GetUserIdLazyInit(bool is_machine) {
-  const ConfigManager& config_manager = *ConfigManager::Instance();
-  if (oem_install_utils::IsOemInstalling(is_machine) ||
-      !config_manager.CanCollectStats(is_machine)) {
-    DeleteUserId(is_machine);
-    return CString();
-  }
-
-  if (!RegKey::HasValue(config_manager.registry_update(is_machine),
-                        kRegValueUserId)) {
-    VERIFY1(SUCCEEDED(CreateUserId(is_machine)));
-  }
-
-  CString user_id;
-  RegKey::GetValue(config_manager.registry_update(is_machine),
-                   kRegValueUserId,
-                   &user_id);
-  return user_id;
-}
-
-}  // namespace goopdate_utils
-
-}  // namespace omaha
diff --git a/common/goopdate_utils.h b/common/goopdate_utils.h
deleted file mode 100644
index 2cbdf9d..0000000
--- a/common/goopdate_utils.h
+++ /dev/null
@@ -1,265 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_GOOPDATE_UTILS_H_
-#define OMAHA_COMMON_GOOPDATE_UTILS_H_
-
-#include <windows.h>
-#include <atlpath.h>
-#include <atlstr.h>
-#include <map>
-#include <vector>
-// TODO(omaha3): Move all browser related functions into browser_utils or some
-// similar file so we can avoid including browser_utils.h in this header. This
-// is especially important because of the duplicate BrowserType definition.
-#include "omaha/base/browser_utils.h"
-
-namespace omaha {
-
-class NetworkRequest;
-class UpdateResponse;
-struct NamedObjectAttributes;
-
-// Represents the Result of an attempt to terminate the browser.
-struct TerminateBrowserResult {
-  TerminateBrowserResult()
-      : found(false),
-        could_terminate(false) {
-  }
-
-  TerminateBrowserResult(bool f, bool terminate)
-      : found(f),
-        could_terminate(terminate) {
-  }
-
-  bool found;
-  bool could_terminate;
-};
-
-namespace goopdate_utils {
-
-typedef HRESULT (*RegisterOrUnregisterFunction)(void* data, bool is_register);
-
-// Builds the directory of the Google Update executable.
-CString BuildGoogleUpdateExeDir(bool is_machine);
-
-// Builds the path of the Google Update version found in the registry. The
-// command line is of the form "<install location>\googleupdate.exe"
-CString BuildGoogleUpdateExePath(bool is_machine);
-
-CString BuildGoogleUpdateServicesPath(bool is_machine);
-
-// Returns true if the currently executing binary is running from the
-// Machine/User Goopdate directory, or a directory under it.
-bool IsRunningFromOfficialGoopdateDir(bool is_machine);
-
-// If running the installed machine instance, returns HKLM. Else returns HKCU.
-CString GetHKRoot();
-
-// Starts an instance of the Google Update version found in the registry.
-// Only use to start interactive processes because it uses ::ShellExecuteEx().
-// args can be NULL.
-// process can be NULL. If not NULL, caller is responsible for closing handle.
-HRESULT StartGoogleUpdateWithArgs(bool is_machine,
-                                  const TCHAR* args,
-                                  HANDLE* process);
-
-// Starts an instance of GoogleCrashHandler.exe.
-HRESULT StartCrashHandler(bool is_machine);
-
-// Starts self in an elevated mode using the "Runas" verb.
-HRESULT StartElevatedSelfWithArgsAndWait(const TCHAR* args, DWORD* exit_code);
-
-// Registers security and sets the security values for the GoogleUpdate
-// process when running as a COM server.
-HRESULT InitializeSecurity();
-
-// GetProductName is temporary and must be removed after the TT release.
-// Gets the product name for a app guid.
-CString GetProductName(const CString& app_guid);
-
-// Returns true if it is a development or test machine.
-bool IsTestSource();
-
-HRESULT RedirectHKCR(bool is_machine);
-
-HRESULT RemoveRedirectHKCR();
-
-HRESULT RegisterTypeLib(bool is_admin,
-                        const CComBSTR& path,
-                        ITypeLib* type_lib);
-HRESULT UnRegisterTypeLib(bool is_admin,
-                          const CComBSTR&,
-                          ITypeLib* type_lib);
-
-HRESULT RegisterOrUnregisterModule(bool is_machine,
-                                   bool register_server,
-                                   RegisterOrUnregisterFunction registrar,
-                                   void* data);
-
-HRESULT RegisterOrUnregisterModuleWithTypelib(
-    bool is_machine,
-    bool register_server,
-    RegisterOrUnregisterFunction registrar,
-    void* data);
-
-// Registers the typelib that is passed in.
-// Wrapper for the RegisterTypeLibForUser that is defined in the
-// Vista oleaut32. Uses GetProcAddress to call into the method.
-HRESULT RegisterTypeLibForUser(ITypeLib* lib,
-                               OLECHAR* path,
-                               OLECHAR* help_dir);
-
-// Unregisters the typelib that is passed in.
-// Wrapper for the UnRegisterTypeLibForUser in Vista ole. Uses GetProcAddress
-// to call into the real method.
-HRESULT UnRegisterTypeLibForUser(REFGUID lib_id,
-                                 WORD major_ver_num,
-                                 WORD minor_ver_num,
-                                 LCID lcid,
-                                 SYSKIND syskind);
-
-CString GetCurrentVersionedName(bool is_machine,
-                                const TCHAR* value_name,
-                                const TCHAR* default_val);
-
-HRESULT CreateAndSetVersionedNameInRegistry(bool is_machine,
-                                            const TCHAR* prefix,
-                                            const TCHAR* value_name);
-
-// Returns the absolute path of the browser image.
-HRESULT GetBrowserImagePathFromProcess(BrowserType type,
-                                       uint32 explorer_pid,
-                                       CString* path);
-
-// Terminates all browser processes for the current user.
-HRESULT TerminateBrowserProcesses(BrowserType type,
-                                  TerminateBrowserResult* browser_res,
-                                  TerminateBrowserResult* default_res);
-
-// Terminates instances of all known browsers. Currently, the known browsers are
-// Firefox, IE and Chrome.
-HRESULT TerminateAllBrowsers(BrowserType type,
-                             TerminateBrowserResult* browser_res,
-                             TerminateBrowserResult* default_res);
-
-
-// Converts from string to the BrowserType enum.
-HRESULT ConvertStringToBrowserType(const CString& text, BrowserType* type);
-
-// Converts from BrowserType to string.
-CString ConvertBrowserTypeToString(BrowserType type);
-
-// Returns the browser to restart.
-bool GetBrowserToRestart(BrowserType type,
-                         BrowserType default_type,
-                         const TerminateBrowserResult& res,
-                         const TerminateBrowserResult& def_res,
-                         BrowserType* browser_type);
-
-// Obtains the OS version and service pack.
-HRESULT GetOSInfo(CString* os_version, CString* service_pack);
-
-// Returns the install directory for the specified version.
-CPath BuildInstallDirectory(bool is_machine, const CString& version);
-
-// Launches the command line. On Vista and later, for a machine install, this
-// method will launch the process at medium/low integrity, by impersonating the
-// medium integrity token of the active user.
-HRESULT LaunchCmdLine(bool is_machine, const CString& cmd_line);
-
-// Launches the browser. On Vista and later, for a machine install, this method
-// will launch the browser at medium/low integrity, by impersonating the medium
-// integrity token of the active user.
-HRESULT LaunchBrowser(bool is_machine, BrowserType type, const CString& url);
-
-// Gets a list of install worker processes relevant to user/machine instances.
-HRESULT GetInstallWorkerProcesses(bool is_machine,
-                                  std::vector<uint32>* processes);
-
-// Creates a unique event name and stores it in the specified environment var.
-HRESULT CreateUniqueEventInEnvironment(const CString& var_name,
-                                       bool is_machine,
-                                       HANDLE* unique_event);
-
-// Obtains a unique event name from specified environment var and opens it.
-HRESULT OpenUniqueEventFromEnvironment(const CString& var_name,
-                                       bool is_machine,
-                                       HANDLE* unique_event);
-
-// Creates an event based on the provided attributes.
-HRESULT CreateEvent(NamedObjectAttributes* event_attr, HANDLE* event_handle);
-
-HRESULT ReadNameValuePairsFromFile(const CString& file_path,
-                                   const CString& group_name,
-                                   std::map<CString, CString>* pairs);
-
-HRESULT WriteNameValuePairsToFile(const CString& file_path,
-                                  const CString& group_name,
-                                  const std::map<CString, CString>& pairs);
-
-// Returns true is any of the install workers is running.
-bool IsAppInstallWorkerRunning(bool is_machine);
-
-// Returns whether the version is an "Omaha 2" version or later.
-bool IsGoogleUpdate2OrLater(const CString& version);
-
-// Converts the installer_data value to UTF8. Then writes this UTF8 data
-// prefixed with the UTF8 BOM of EF BB BF to a temp file. Returns the path to
-// temp file that was created.  The returned path will be quote-enclosed by
-// EnclosePath().
-HRESULT WriteInstallerDataToTempFile(const CString& installer_data,
-                                     CString* installer_data_file_path);
-
-// TODO(omaha): Move these two to ua_internal.h.
-// Returns true if a server update check is due.
-bool ShouldCheckForUpdates(bool is_machine);
-
-// Updates LastChecked to now. Call after successful update check for all apps.
-HRESULT UpdateLastChecked(bool is_machine);
-
-// Launches the /uninstall process.
-HRESULT LaunchUninstallProcess(bool is_machine);
-
-// Returns a token that can be used to impersonate in the case of a
-// machine process. The caller has ownership of the token that is returned and
-// it must close the handle. The token corresponds to the primary token for
-// the current or one of the logged on users but only if the caller is a
-// machine process running as local system and not impersonated.
-// This is a very specialized function,intended to be called by local system
-// processes making network calls where the caller is not impersonated.
-HANDLE GetImpersonationTokenForMachineProcess(bool is_machine);
-
-// Enables or disables Structured Exception Handler Overwrite Protection a.k.a
-// SEHOP for machine Omaha. More information on SEHOP: http://goo.gl/1hfD.
-HRESULT EnableSEHOP(bool enable);
-
-// Creates a user unique id and saves it in registry if the machine is not in
-// the OEM install mode.
-HRESULT CreateUserId(bool is_machine);
-
-// Deletes the user id from registry.
-void DeleteUserId(bool is_machine);
-
-// Lazy creates (if necessary) and returns the user ID in registry if the
-// machine is NOT in OEM install state and current user opts in usage stats.
-// Otherwise deletes the user ID from the registry and returns empty string.
-CString GetUserIdLazyInit(bool is_machine);
-
-}  // namespace goopdate_utils
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_GOOPDATE_UTILS_H_
diff --git a/common/goopdate_utils_unittest.cc b/common/goopdate_utils_unittest.cc
deleted file mode 100644
index 0b2434c..0000000
--- a/common/goopdate_utils_unittest.cc
+++ /dev/null
@@ -1,1630 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-#include <atlpath.h>
-#include <atlsecurity.h>
-#include <atlstr.h>
-#include <map>
-#include <vector>
-#include "omaha/base/app_util.h"
-#include "omaha/base/browser_utils.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/const_utils.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/path.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/scoped_ptr_cotask.h"
-#include "omaha/base/string.h"
-#include "omaha/base/time.h"
-#include "omaha/base/user_info.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/base/vista_utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/const_group_policy.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/common/oem_install_utils.h"
-#include "omaha/testing/resource.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-#define DUMMY_CLSID  _T("{6FC94136-0D4C-450e-99C2-BCDA72A9C8F0}")
-const TCHAR* hkcr_key_name = _T("HKCR\\CLSID\\") DUMMY_CLSID;
-const TCHAR* hklm_key_name = _T("HKLM\\Software\\Classes\\CLSID\\") DUMMY_CLSID;
-const TCHAR* hkcu_key_name = _T("HKCU\\Software\\Classes\\CLSID\\") DUMMY_CLSID;
-
-const TCHAR* kAppId = _T("{3DAE8C13-C394-481E-8163-4E7A7699084F}");
-
-}  // namespace
-
-namespace goopdate_utils {
-
-static void Cleanup() {
-  ASSERT_SUCCEEDED(RemoveRedirectHKCR());
-
-  RegKey::DeleteKey(hkcr_key_name, true);
-  RegKey::DeleteKey(hklm_key_name, true);
-  RegKey::DeleteKey(hkcu_key_name, true);
-}
-
-static void TestGetBrowserToRestart(BrowserType stamped,
-                                    bool found1,
-                                    bool killed1,
-                                    BrowserType def_browser,
-                                    bool found2,
-                                    bool killed2,
-                                    BrowserType expected) {
-  TerminateBrowserResult res(found1, killed1);
-  TerminateBrowserResult def(found2, killed2);
-
-  BrowserType type = BROWSER_UNKNOWN;
-  if (expected == BROWSER_UNKNOWN) {
-    EXPECT_FALSE(GetBrowserToRestart(stamped,
-                                     def_browser,
-                                     res,
-                                     def,
-                                     &type))
-        << _T("stamped: ") << stamped << _T(" ") << found1 << _T(" ") << killed1
-        << _T("   default: ") << def_browser << _T(" ") << found2 << _T(" ")
-        << killed2;
-  } else {
-    EXPECT_TRUE(GetBrowserToRestart(stamped,
-                                    def_browser,
-                                    res,
-                                    def,
-                                    &type))
-        << _T("stamped: ") << stamped << _T(" ") << found1 << _T(" ") << killed1
-        << _T("   default: ") << def_browser << _T(" ") << found2 << _T(" ")
-        << killed2;
-  }
-  EXPECT_EQ(expected, type)
-      << _T("stamped: ") << stamped << _T(" ") << found1 << _T(" ") << killed1
-      << _T("   default: ") << def_browser << _T(" ") << found2 << _T(" ")
-      << killed2;
-}
-
-// TerminateAllBrowsers is not tested with valid browser values because the
-// tests would terminate developers' browsers.
-
-TEST(GoopdateUtilsTest, GetBrowserToRestart_StampedUnknown) {
-  ExpectAsserts expect_asserts;
-  TestGetBrowserToRestart(BROWSER_UNKNOWN, false, false,
-                          BROWSER_IE, false, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_UNKNOWN, true, false,
-                          BROWSER_IE, false, false,
-                          BROWSER_IE);
-}
-
-TEST(GoopdateUtilsTest, GetBrowserToRestart_DefaultUnknown) {
-  TestGetBrowserToRestart(BROWSER_IE, false, false,
-                          BROWSER_UNKNOWN, false, false,
-                          BROWSER_UNKNOWN);
-}
-
-TEST(GoopdateUtilsTest, GetBrowserToRestart_StampedAndDefaultUnknown) {
-  ExpectAsserts expect_asserts;
-  TestGetBrowserToRestart(BROWSER_UNKNOWN, false, false,
-                          BROWSER_UNKNOWN, false, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_UNKNOWN, true, false,
-                          BROWSER_UNKNOWN, false, false,
-                          BROWSER_UNKNOWN);
-}
-
-TEST(GoopdateUtilsTest, GetBrowserToRestart_StampedDefault) {
-  ExpectAsserts expect_asserts;
-  TestGetBrowserToRestart(BROWSER_DEFAULT, false, false,
-                          BROWSER_IE, false, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_DEFAULT, true, false,
-                          BROWSER_IE, false, false,
-                          BROWSER_IE);
-}
-
-TEST(GoopdateUtilsTest, GetBrowserToRestart_DefaultDefault) {
-  ExpectAsserts expect_asserts;
-  TestGetBrowserToRestart(BROWSER_IE, false, false,
-                          BROWSER_DEFAULT, false, false,
-                          BROWSER_UNKNOWN);
-}
-
-TEST(GoopdateUtilsTest, GetBrowserToRestart_StampedAndDefaultDefault) {
-  ExpectAsserts expect_asserts;
-  TestGetBrowserToRestart(BROWSER_DEFAULT, false, false,
-                          BROWSER_DEFAULT, false, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_DEFAULT, true, false,
-                          BROWSER_DEFAULT, false, false,
-                          BROWSER_UNKNOWN);
-}
-
-TEST(GoopdateUtilsTest, GetBrowserToRestart_StampedMax) {
-  ExpectAsserts expect_asserts;
-  TestGetBrowserToRestart(BROWSER_MAX, false, false,
-                          BROWSER_IE, false, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_MAX, true, false,
-                          BROWSER_IE, false, false,
-                          BROWSER_IE);
-}
-
-TEST(GoopdateUtilsTest, GetBrowserToRestart_DefaultMax) {
-  ExpectAsserts expect_asserts;
-  TestGetBrowserToRestart(BROWSER_IE, false, false,
-                          BROWSER_MAX, false, false,
-                          BROWSER_UNKNOWN);
-}
-
-TEST(GoopdateUtilsTest, GetBrowserToRestart_StampedAndDefaultMax) {
-  ExpectAsserts expect_asserts;
-  TestGetBrowserToRestart(BROWSER_MAX, false, false,
-                          BROWSER_MAX, false, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_MAX, true, false,
-                          BROWSER_MAX, false, false,
-                          BROWSER_UNKNOWN);
-}
-
-TEST(GoopdateUtilsTest, GetBrowserToRestart_TypeIE_DefaultIE) {
-  TestGetBrowserToRestart(BROWSER_IE, false, false,
-                          BROWSER_IE, false, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, false, false,
-                          BROWSER_IE, false, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, false, false,
-                          BROWSER_IE, true, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, false, false,
-                          BROWSER_IE, true, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, false, true,
-                          BROWSER_IE, false, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, false, true,
-                          BROWSER_IE, false, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, false, true,
-                          BROWSER_IE, true, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, false, true,
-                          BROWSER_IE, true, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, false,
-                          BROWSER_IE, false, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, false,
-                          BROWSER_IE, false, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, false,
-                          BROWSER_IE, true, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, false,
-                          BROWSER_IE, true, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, true,
-                          BROWSER_IE, false, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, true,
-                          BROWSER_IE, false, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, true,
-                          BROWSER_IE, true, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, true,
-                          BROWSER_IE, true, true,
-                          BROWSER_IE);
-}
-
-TEST(GoopdateUtilsTest, GetBrowserToRestart_TypeIE_DefaultFirefox) {
-  TestGetBrowserToRestart(BROWSER_IE, false, false,
-                          BROWSER_FIREFOX, false, false,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_IE, false, false,
-                          BROWSER_FIREFOX, false, true,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_IE, false, false,
-                          BROWSER_FIREFOX, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_IE, false, false,
-                          BROWSER_FIREFOX, true, true,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_IE, false, true,
-                          BROWSER_FIREFOX, false, false,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_IE, false, true,
-                          BROWSER_FIREFOX, false, true,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_IE, false, true,
-                          BROWSER_FIREFOX, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_IE, false, true,
-                          BROWSER_FIREFOX, true, true,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_IE, true, false,
-                          BROWSER_FIREFOX, false, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, false,
-                          BROWSER_FIREFOX, false, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, false,
-                          BROWSER_FIREFOX, true, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, false,
-                          BROWSER_FIREFOX, true, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, true,
-                          BROWSER_FIREFOX, false, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, true,
-                          BROWSER_FIREFOX, false, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, true,
-                          BROWSER_FIREFOX, true, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, true,
-                          BROWSER_FIREFOX, true, true,
-                          BROWSER_IE);
-}
-
-TEST(GoopdateUtilsTest, GetBrowserToRestart_TypeIE_DefaultChrome) {
-  TestGetBrowserToRestart(BROWSER_IE, false, false,
-                          BROWSER_CHROME, false, false,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_IE, false, false,
-                          BROWSER_CHROME, false, true,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_IE, false, false,
-                          BROWSER_CHROME, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_IE, false, false,
-                          BROWSER_CHROME, true, true,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_IE, false, true,
-                          BROWSER_CHROME, false, false,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_IE, false, true,
-                          BROWSER_CHROME, false, true,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_IE, false, true,
-                          BROWSER_CHROME, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_IE, false, true,
-                          BROWSER_CHROME, true, true,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_IE, true, false,
-                          BROWSER_CHROME, false, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, false,
-                          BROWSER_CHROME, false, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, false,
-                          BROWSER_CHROME, true, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, false,
-                          BROWSER_CHROME, true, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, true,
-                          BROWSER_CHROME, false, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, true,
-                          BROWSER_CHROME, false, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, true,
-                          BROWSER_CHROME, true, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, true,
-                          BROWSER_CHROME, true, true,
-                          BROWSER_IE);
-}
-
-TEST(GoopdateUtilsTest, GetBrowserToRestart_TypeIE_DefaultUnknown) {
-  TestGetBrowserToRestart(BROWSER_IE, false, false,
-                          BROWSER_UNKNOWN, false, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_IE, false, false,
-                          BROWSER_UNKNOWN, false, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_IE, false, false,
-                          BROWSER_UNKNOWN, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_IE, false, false,
-                          BROWSER_UNKNOWN, true, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_IE, false, true,
-                          BROWSER_UNKNOWN, false, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_IE, false, true,
-                          BROWSER_UNKNOWN, false, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_IE, false, true,
-                          BROWSER_UNKNOWN, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_IE, false, true,
-                          BROWSER_UNKNOWN, true, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_IE, true, false,
-                          BROWSER_UNKNOWN, false, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, false,
-                          BROWSER_UNKNOWN, false, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, false,
-                          BROWSER_UNKNOWN, true, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, false,
-                          BROWSER_UNKNOWN, true, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, true,
-                          BROWSER_UNKNOWN, false, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, true,
-                          BROWSER_UNKNOWN, false, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, true,
-                          BROWSER_UNKNOWN, true, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_IE, true, true,
-                          BROWSER_UNKNOWN, true, true,
-                          BROWSER_IE);
-}
-
-TEST(GoopdateUtilsTest, GetBrowserToRestart_TypeFirefox_DefaultIE) {
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, false,
-                          BROWSER_IE, false, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, false,
-                          BROWSER_IE, false, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, false,
-                          BROWSER_IE, true, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, false,
-                          BROWSER_IE, true, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, true,
-                          BROWSER_IE, false, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, true,
-                          BROWSER_IE, false, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, true,
-                          BROWSER_IE, true, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, true,
-                          BROWSER_IE, true, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, false,
-                          BROWSER_IE, false, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, false,
-                          BROWSER_IE, false, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, false,
-                          BROWSER_IE, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, false,
-                          BROWSER_IE, true, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, true,
-                          BROWSER_IE, false, false,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, true,
-                          BROWSER_IE, false, true,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, true,
-                          BROWSER_IE, true, false,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, true,
-                          BROWSER_IE, true, true,
-                          BROWSER_FIREFOX);
-}
-
-TEST(GoopdateUtilsTest, GetBrowserToRestart_TypeFirefox_DefaultFirefox) {
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, false,
-                          BROWSER_FIREFOX, false, false,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, false,
-                          BROWSER_FIREFOX, false, true,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, false,
-                          BROWSER_FIREFOX, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, false,
-                          BROWSER_FIREFOX, true, true,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, true,
-                          BROWSER_FIREFOX, false, false,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, true,
-                          BROWSER_FIREFOX, false, true,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, true,
-                          BROWSER_FIREFOX, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, true,
-                          BROWSER_FIREFOX, true, true,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, false,
-                          BROWSER_FIREFOX, false, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, false,
-                          BROWSER_FIREFOX, false, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, false,
-                          BROWSER_FIREFOX, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, false,
-                          BROWSER_FIREFOX, true, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, true,
-                          BROWSER_FIREFOX, false, false,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, true,
-                          BROWSER_FIREFOX, false, true,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, true,
-                          BROWSER_FIREFOX, true, false,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, true,
-                          BROWSER_FIREFOX, true, true,
-                          BROWSER_FIREFOX);
-}
-
-TEST(GoopdateUtilsTest, GetBrowserToRestart_TypeFirefox_DefaultChrome) {
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, false,
-                          BROWSER_CHROME, false, false,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, false,
-                          BROWSER_CHROME, false, true,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, false,
-                          BROWSER_CHROME, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, false,
-                          BROWSER_CHROME, true, true,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, true,
-                          BROWSER_CHROME, false, false,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, true,
-                          BROWSER_CHROME, false, true,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, true,
-                          BROWSER_CHROME, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, true,
-                          BROWSER_CHROME, true, true,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, false,
-                          BROWSER_CHROME, false, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, false,
-                          BROWSER_CHROME, false, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, false,
-                          BROWSER_CHROME, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, false,
-                          BROWSER_CHROME, true, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, true,
-                          BROWSER_CHROME, false, false,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, true,
-                          BROWSER_CHROME, false, true,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, true,
-                          BROWSER_CHROME, true, false,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, true,
-                          BROWSER_CHROME, true, true,
-                          BROWSER_FIREFOX);
-}
-
-TEST(GoopdateUtilsTest, GetBrowserToRestart_TypeFirefox_DefaultUnknown) {
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, false,
-                          BROWSER_UNKNOWN, false, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, false,
-                          BROWSER_UNKNOWN, false, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, false,
-                          BROWSER_UNKNOWN, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, false,
-                          BROWSER_UNKNOWN, true, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, true,
-                          BROWSER_UNKNOWN, false, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, true,
-                          BROWSER_UNKNOWN, false, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, true,
-                          BROWSER_UNKNOWN, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, false, true,
-                          BROWSER_UNKNOWN, true, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, false,
-                          BROWSER_UNKNOWN, false, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, false,
-                          BROWSER_UNKNOWN, false, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, false,
-                          BROWSER_UNKNOWN, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, false,
-                          BROWSER_UNKNOWN, true, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, true,
-                          BROWSER_UNKNOWN, false, false,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, true,
-                          BROWSER_UNKNOWN, false, true,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, true,
-                          BROWSER_UNKNOWN, true, false,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_FIREFOX, true, true,
-                          BROWSER_UNKNOWN, true, true,
-                          BROWSER_FIREFOX);
-}
-
-TEST(GoopdateUtilsTest, GetBrowserToRestart_TypeChrome_DefaultIE) {
-  TestGetBrowserToRestart(BROWSER_CHROME, false, false,
-                          BROWSER_IE, false, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, false,
-                          BROWSER_IE, false, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, false,
-                          BROWSER_IE, true, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, false,
-                          BROWSER_IE, true, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, true,
-                          BROWSER_IE, false, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, true,
-                          BROWSER_IE, false, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, true,
-                          BROWSER_IE, true, false,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, true,
-                          BROWSER_IE, true, true,
-                          BROWSER_IE);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, false,
-                          BROWSER_IE, false, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, false,
-                          BROWSER_IE, false, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, false,
-                          BROWSER_IE, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, false,
-                          BROWSER_IE, true, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, true,
-                          BROWSER_IE, false, false,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, true,
-                          BROWSER_IE, false, true,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, true,
-                          BROWSER_IE, true, false,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, true,
-                          BROWSER_IE, true, true,
-                          BROWSER_CHROME);
-}
-
-TEST(GoopdateUtilsTest, GetBrowserToRestart_TypeChrome_DefaultFirefox) {
-  TestGetBrowserToRestart(BROWSER_CHROME, false, false,
-                          BROWSER_FIREFOX, false, false,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, false,
-                          BROWSER_FIREFOX, false, true,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, false,
-                          BROWSER_FIREFOX, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, false,
-                          BROWSER_FIREFOX, true, true,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, true,
-                          BROWSER_FIREFOX, false, false,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, true,
-                          BROWSER_FIREFOX, false, true,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, true,
-                          BROWSER_FIREFOX, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, true,
-                          BROWSER_FIREFOX, true, true,
-                          BROWSER_FIREFOX);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, false,
-                          BROWSER_FIREFOX, false, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, false,
-                          BROWSER_FIREFOX, false, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, false,
-                          BROWSER_FIREFOX, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, false,
-                          BROWSER_FIREFOX, true, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, true,
-                          BROWSER_FIREFOX, false, false,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, true,
-                          BROWSER_FIREFOX, false, true,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, true,
-                          BROWSER_FIREFOX, true, false,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, true,
-                          BROWSER_FIREFOX, true, true,
-                          BROWSER_CHROME);
-}
-
-TEST(GoopdateUtilsTest, GetBrowserToRestart_TypeChrome_DefaultChrome) {
-  TestGetBrowserToRestart(BROWSER_CHROME, false, false,
-                          BROWSER_CHROME, false, false,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, false,
-                          BROWSER_CHROME, false, true,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, false,
-                          BROWSER_CHROME, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, false,
-                          BROWSER_CHROME, true, true,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, true,
-                          BROWSER_CHROME, false, false,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, true,
-                          BROWSER_CHROME, false, true,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, true,
-                          BROWSER_CHROME, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, true,
-                          BROWSER_CHROME, true, true,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, false,
-                          BROWSER_CHROME, false, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, false,
-                          BROWSER_CHROME, false, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, false,
-                          BROWSER_CHROME, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, false,
-                          BROWSER_CHROME, true, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, true,
-                          BROWSER_CHROME, false, false,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, true,
-                          BROWSER_CHROME, false, true,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, true,
-                          BROWSER_CHROME, true, false,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, true,
-                          BROWSER_CHROME, true, true,
-                          BROWSER_CHROME);
-}
-
-TEST(GoopdateUtilsTest, GetBrowserToRestart_TypeChrome_DefaultUnknown) {
-  TestGetBrowserToRestart(BROWSER_CHROME, false, false,
-                          BROWSER_UNKNOWN, false, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, false,
-                          BROWSER_UNKNOWN, false, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, false,
-                          BROWSER_UNKNOWN, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, false,
-                          BROWSER_UNKNOWN, true, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, true,
-                          BROWSER_UNKNOWN, false, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, true,
-                          BROWSER_UNKNOWN, false, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, true,
-                          BROWSER_UNKNOWN, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, false, true,
-                          BROWSER_UNKNOWN, true, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, false,
-                          BROWSER_UNKNOWN, false, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, false,
-                          BROWSER_UNKNOWN, false, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, false,
-                          BROWSER_UNKNOWN, true, false,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, false,
-                          BROWSER_UNKNOWN, true, true,
-                          BROWSER_UNKNOWN);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, true,
-                          BROWSER_UNKNOWN, false, false,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, true,
-                          BROWSER_UNKNOWN, false, true,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, true,
-                          BROWSER_UNKNOWN, true, false,
-                          BROWSER_CHROME);
-  TestGetBrowserToRestart(BROWSER_CHROME, true, true,
-                          BROWSER_UNKNOWN, true, true,
-                          BROWSER_CHROME);
-}
-
-TEST(GoopdateUtilsTest, ConvertStringToBrowserType) {
-  BrowserType type = BROWSER_UNKNOWN;
-  ASSERT_SUCCEEDED(ConvertStringToBrowserType(_T("0"), &type));
-  ASSERT_EQ(BROWSER_UNKNOWN, type);
-
-  ASSERT_SUCCEEDED(ConvertStringToBrowserType(_T("1"), &type));
-  ASSERT_EQ(BROWSER_DEFAULT, type);
-
-  ASSERT_SUCCEEDED(ConvertStringToBrowserType(_T("2"), &type));
-  ASSERT_EQ(BROWSER_IE, type);
-
-  ASSERT_SUCCEEDED(ConvertStringToBrowserType(_T("3"), &type));
-  ASSERT_EQ(BROWSER_FIREFOX, type);
-
-  ASSERT_SUCCEEDED(ConvertStringToBrowserType(_T("4"), &type));
-  ASSERT_EQ(BROWSER_CHROME, type);
-
-  ASSERT_FAILED(ConvertStringToBrowserType(_T("5"), &type));
-  ASSERT_FAILED(ConvertStringToBrowserType(_T("asdf"), &type));
-  ASSERT_FAILED(ConvertStringToBrowserType(_T("234"), &type));
-  ASSERT_FAILED(ConvertStringToBrowserType(_T("-1"), &type));
-}
-
-TEST(GoopdateUtilsTest, RedirectHKCRTest) {
-  RegKey key;
-  Cleanup();
-
-  if (vista_util::IsUserAdmin()) {
-    // Only run this part of the test for Admins, because non-admins cannot
-    // write to HKLM.
-
-    // Without redirection, a HKCR write should write HKLM\Software\Classes,
-    // assuming that the key does not already exist in HKCU.
-    ASSERT_SUCCEEDED(key.Create(hkcr_key_name));
-    ASSERT_TRUE(RegKey::HasKey(hklm_key_name));
-    ASSERT_FALSE(RegKey::HasKey(hkcu_key_name));
-
-    Cleanup();
-
-    ASSERT_SUCCEEDED(RedirectHKCR(true));
-
-    // With HKLM redirection, a HKCR write should write HKLM\Software\Classes.
-    ASSERT_SUCCEEDED(key.Create(hkcr_key_name));
-    ASSERT_TRUE(RegKey::HasKey(hklm_key_name));
-    ASSERT_FALSE(RegKey::HasKey(hkcu_key_name));
-
-    Cleanup();
-  } else {
-    std::wcout << _T("\tPart of this test did not run because the user ")
-                  _T("is not an admin.") << std::endl;
-  }
-
-  ASSERT_SUCCEEDED(RedirectHKCR(false));
-
-  // With HKCU redirection, a HKCR write should write HKCU\Software\Classes.
-  ASSERT_SUCCEEDED(key.Create(hkcr_key_name));
-  ASSERT_FALSE(RegKey::HasKey(hklm_key_name));
-  ASSERT_TRUE(RegKey::HasKey(hkcu_key_name));
-
-  ASSERT_SUCCEEDED(RemoveRedirectHKCR());
-
-  if (vista_util::IsUserAdmin()) {
-    // Without redirection, the following HKCR writes should write
-    // HKCU\Software\Classes.
-    // This is because the key already exists in HKCU from the writes above.
-    ASSERT_SUCCEEDED(key.Create(hkcr_key_name));
-    ASSERT_EQ(user_info::IsRunningAsSystem(), RegKey::HasKey(hklm_key_name));
-    ASSERT_TRUE(RegKey::HasKey(hkcu_key_name));
-  } else {
-    std::wcout << _T("\tPart of this test did not run because the user ")
-                  _T("is not an admin.") << std::endl;
-  }
-
-  Cleanup();
-}
-
-TEST(GoopdateUtilsTest, GetOSInfo) {
-  CString os_version;
-  CString service_pack;
-  EXPECT_SUCCEEDED(GetOSInfo(&os_version, &service_pack));
-  EXPECT_TRUE(!os_version.IsEmpty());
-}
-
-class GoopdateUtilsRegistryProtectedTest : public testing::Test {
- protected:
-  GoopdateUtilsRegistryProtectedTest()
-      : hive_override_key_name_(kRegistryHiveOverrideRoot) {
-  }
-
-  CString hive_override_key_name_;
-
-  virtual void SetUp() {
-    RegKey::DeleteKey(hive_override_key_name_, true);
-    OverrideRegistryHives(hive_override_key_name_);
-  }
-
-  virtual void TearDown() {
-    RestoreRegistryHives();
-    ASSERT_SUCCEEDED(RegKey::DeleteKey(hive_override_key_name_, true));
-  }
-};
-
-class GoopdateUtilsRegistryProtectedBooleanTest
-    : public ::testing::TestWithParam<bool> {
- protected:
-  GoopdateUtilsRegistryProtectedBooleanTest()
-      : hive_override_key_name_(kRegistryHiveOverrideRoot) {
-  }
-
-  CString hive_override_key_name_;
-
-  virtual void SetUp() {
-    RegKey::DeleteKey(hive_override_key_name_, true);
-    OverrideRegistryHives(hive_override_key_name_);
-  }
-
-  virtual void TearDown() {
-    RestoreRegistryHives();
-    ASSERT_SUCCEEDED(RegKey::DeleteKey(hive_override_key_name_, true));
-  }
-};
-
-// Some methods used by goopdate_utils rely on registry entries that are
-// overridden in the registry, so we need to write it.
-class GoopdateUtilsRegistryProtectedWithMachineFolderPathsTest
-    : public GoopdateUtilsRegistryProtectedTest {
- protected:
-  virtual void SetUp() {
-    // The tests start GoogleUpdate processes running as user and these
-    // processes need the following registry value.
-    ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                      kRegValueInstalledVersion,
-                                      GetVersionString()));
-
-    GoopdateUtilsRegistryProtectedTest::SetUp();
-
-    // Creates a registry value for the Windows shell functions to work when
-    // the registry hives are redirected.
-    const TCHAR kWindowsCurrentVersionKeyPath[] =
-        _T("HKLM\\Software\\Microsoft\\Windows\\CurrentVersion");
-    const TCHAR kProgramFilesDirValueName[] = _T("ProgramFilesDir");
-    const TCHAR kProgramFilesPath[] = _T("C:\\Program Files");
-    ASSERT_SUCCEEDED(RegKey::SetValue(kWindowsCurrentVersionKeyPath,
-                                      kProgramFilesDirValueName,
-                                      kProgramFilesPath));
-  }
-};
-
-// Some methods used by goopdate_utils rely on registry entries that are
-// overridden in the registry, so we need to write it.
-class GoopdateUtilsRegistryProtectedWithUserFolderPathsTest
-    : public GoopdateUtilsRegistryProtectedTest {
- protected:
-  virtual void SetUp() {
-  const TCHAR kUserShellKeyPath[] =
-        _T("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\")
-        _T("User Shell Folders");
-    const TCHAR kLocalAppDataValueDirName[] = _T("Local AppData");
-    const TCHAR kLocalAppDataPath[] =
-        _T("%USERPROFILE%\\Local Settings\\Application Data");
-
-    GoopdateUtilsRegistryProtectedTest::SetUp();
-    ASSERT_SUCCEEDED(RegKey::SetValueExpandSZ(kUserShellKeyPath,
-                                              kLocalAppDataValueDirName,
-                                              kLocalAppDataPath));
-  }
-};
-
-class VersionProtectedTest : public RegistryProtectedTest {
- protected:
-  VersionProtectedTest()
-      : RegistryProtectedTest(),
-        module_version_(GetVersion()) {
-  }
-
-  virtual void SetUp() {
-    RegistryProtectedTest::SetUp();
-    InitializeVersion(kFakeVersion);
-  }
-
-  virtual void TearDown() {
-    InitializeVersion(module_version_);
-    RegistryProtectedTest::TearDown();
-  }
-
-  const ULONGLONG module_version_;
-  static const ULONGLONG kFakeVersion = 0x0005000600070008;
-};
-
-// pv should be ignored.
-TEST_F(GoopdateUtilsRegistryProtectedWithMachineFolderPathsTest,
-       BuildGoogleUpdateExePath_MachineVersionFound) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_CLIENTS_GOOPDATE,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-
-  CString path = BuildGoogleUpdateExePath(true);
-  CString program_files_path;
-  EXPECT_SUCCEEDED(GetFolderPath(CSIDL_PROGRAM_FILES, &program_files_path));
-  EXPECT_STREQ(program_files_path + _T("\\") + SHORT_COMPANY_NAME +
-               _T("\\") + PRODUCT_NAME + _T("\\GoogleUpdate.exe"),
-               path);
-}
-
-TEST_F(GoopdateUtilsRegistryProtectedWithMachineFolderPathsTest,
-       BuildGoogleUpdateExePath_MachineVersionNotFound) {
-  // Test when the key doesn't exist.
-  CString path = BuildGoogleUpdateExePath(true);
-  CString program_files_path;
-  EXPECT_SUCCEEDED(GetFolderPath(CSIDL_PROGRAM_FILES, &program_files_path));
-  EXPECT_STREQ(program_files_path + _T("\\") + SHORT_COMPANY_NAME +
-               _T("\\") + PRODUCT_NAME + _T("\\GoogleUpdate.exe"),
-               path);
-
-  // Test when the key exists but the value doesn't.
-  ASSERT_SUCCEEDED(RegKey::CreateKey(MACHINE_REG_CLIENTS_GOOPDATE));
-  path = BuildGoogleUpdateExePath(true);
-  EXPECT_STREQ(program_files_path + _T("\\") + SHORT_COMPANY_NAME +
-               _T("\\") + PRODUCT_NAME + _T("\\GoogleUpdate.exe"),
-               path);
-}
-
-// pv should be ignored.
-TEST_F(GoopdateUtilsRegistryProtectedWithUserFolderPathsTest,
-       BuildGoogleUpdateExePath_UserVersionFound) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-
-  CString path = BuildGoogleUpdateExePath(false);
-
-  CString user_appdata;
-  EXPECT_SUCCEEDED(GetFolderPath(CSIDL_LOCAL_APPDATA, &user_appdata));
-  CString expected_path;
-  expected_path.Format(_T("%s\\") SHORT_COMPANY_NAME _T("\\")
-                       PRODUCT_NAME _T("\\GoogleUpdate.exe"),
-                       user_appdata);
-  EXPECT_STREQ(expected_path, path);
-}
-
-TEST_F(GoopdateUtilsRegistryProtectedWithUserFolderPathsTest,
-       BuildGoogleUpdateExePath_UserVersionNotFound) {
-  CString user_appdata;
-  EXPECT_SUCCEEDED(GetFolderPath(CSIDL_LOCAL_APPDATA, &user_appdata));
-  CString expected_path;
-  expected_path.Format(_T("%s\\") SHORT_COMPANY_NAME _T("\\")
-                       PRODUCT_NAME _T("\\GoogleUpdate.exe"),
-                       user_appdata);
-
-  // Test when the key doesn't exist.
-  CString path = BuildGoogleUpdateExePath(false);
-  EXPECT_STREQ(expected_path, path);
-
-  // Test when the key exists but the value doesn't.
-  ASSERT_SUCCEEDED(RegKey::CreateKey(USER_REG_CLIENTS_GOOPDATE));
-  path = BuildGoogleUpdateExePath(false);
-  EXPECT_STREQ(expected_path, path);
-}
-
-// The version is no longer used by StartGoogleUpdateWithArgs, so the return
-// value depends on whether program_files\Google\Update\GoogleUpdate.exe exists.
-// The arguments must be valid to avoid displaying invalid command line error.
-TEST_F(GoopdateUtilsRegistryProtectedWithMachineFolderPathsTest,
-       StartGoogleUpdateWithArgs_MachineVersionVersionDoesNotExist) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_CLIENTS_GOOPDATE,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-  const TCHAR* kArgs = _T("/cr");
-  HRESULT hr = StartGoogleUpdateWithArgs(true, kArgs, NULL);
-  EXPECT_TRUE(S_OK == hr || HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) == hr);
-}
-
-// The version is no longer used by StartGoogleUpdateWithArgs, so the return
-// value depends on whether <user_folder>\Google\Update\GoogleUpdate.exe exists.
-// The arguments must be valid to avoid displaying invalid command line error.
-TEST_F(GoopdateUtilsRegistryProtectedWithUserFolderPathsTest,
-       StartGoogleUpdateWithArgs_UserVersionVersionDoesNotExist) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-  const TCHAR* kArgs = _T("/cr");
-  HRESULT hr = StartGoogleUpdateWithArgs(false, kArgs, NULL);
-  EXPECT_TRUE(S_OK == hr || HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) == hr);
-}
-
-TEST(GoopdateUtilsTest, BuildInstallDirectory_Machine) {
-  const CPath dir = BuildInstallDirectory(true, _T("1.2.3.0"));
-  CString program_files_path;
-  EXPECT_SUCCEEDED(GetFolderPath(CSIDL_PROGRAM_FILES, &program_files_path));
-  EXPECT_STREQ(program_files_path + _T("\\") + SHORT_COMPANY_NAME +
-               _T("\\") + PRODUCT_NAME + _T("\\1.2.3.0"), dir);
-}
-
-TEST(GoopdateUtilsTest, BuildInstallDirectory_User) {
-  CPath expected_path(GetGoogleUpdateUserPath());
-  expected_path.Append(_T("4.5.6.7"));
-  EXPECT_STREQ(expected_path,
-               BuildInstallDirectory(false, _T("4.5.6.7")));
-}
-
-TEST(GoopdateUtilsTest, ConvertBrowserTypeToString) {
-  for (int i = 0; i < BROWSER_MAX; ++i) {
-    CString str_type = ConvertBrowserTypeToString(
-        static_cast<BrowserType>(i));
-    BrowserType type = BROWSER_UNKNOWN;
-    ASSERT_HRESULT_SUCCEEDED(
-        ConvertStringToBrowserType(str_type, &type));
-    ASSERT_EQ(static_cast<int>(type), i);
-  }
-}
-
-TEST(GoopdateUtilsTest, UniqueEventInEnvironment_User) {
-  const TCHAR* kEnvVarName = _T("SOME_ENV_VAR_FOR_TEST");
-  scoped_event created_event;
-  scoped_event opened_event;
-
-  ASSERT_HRESULT_SUCCEEDED(CreateUniqueEventInEnvironment(
-      kEnvVarName,
-      false,
-      address(created_event)));
-  ASSERT_TRUE(created_event);
-  EXPECT_EQ(WAIT_TIMEOUT, ::WaitForSingleObject(get(created_event), 0));
-
-  TCHAR event_name[MAX_PATH] = {0};
-  EXPECT_TRUE(
-      ::GetEnvironmentVariable(kEnvVarName, event_name, arraysize(event_name)));
-
-  ASSERT_HRESULT_SUCCEEDED(OpenUniqueEventFromEnvironment(
-      kEnvVarName,
-      false,
-      address(opened_event)));
-  ASSERT_TRUE(opened_event);
-
-  EXPECT_TRUE(::SetEvent(get(opened_event)));
-  EXPECT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(get(created_event), 0));
-
-  EXPECT_TRUE(::SetEnvironmentVariable(kEnvVarName, NULL));
-}
-
-TEST(GoopdateUtilsTest, UniqueEventInEnvironment_Machine) {
-  const TCHAR* kEnvVarName = _T("OTHER_ENV_VAR_FOR_TEST");
-  scoped_event created_event;
-  scoped_event opened_event;
-  TCHAR event_name[MAX_PATH] = {0};
-
-  if (!vista_util::IsUserAdmin()) {
-    EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_INVALID_OWNER),
-              CreateUniqueEventInEnvironment(kEnvVarName,
-                                             true,
-                                             address(created_event)));
-    EXPECT_FALSE(created_event);
-
-    EXPECT_FALSE(::GetEnvironmentVariable(kEnvVarName,
-                                          event_name,
-                                          arraysize(event_name)));
-    return;
-  }
-
-  ASSERT_HRESULT_SUCCEEDED(CreateUniqueEventInEnvironment(
-      kEnvVarName,
-      true,
-      address(created_event)));
-  ASSERT_TRUE(created_event);
-  EXPECT_EQ(WAIT_TIMEOUT, ::WaitForSingleObject(get(created_event), 0));
-
-  EXPECT_TRUE(
-      ::GetEnvironmentVariable(kEnvVarName, event_name, arraysize(event_name)));
-
-  ASSERT_HRESULT_SUCCEEDED(OpenUniqueEventFromEnvironment(
-      kEnvVarName,
-      true,
-      address(opened_event)));
-  ASSERT_TRUE(opened_event);
-
-  EXPECT_TRUE(::SetEvent(get(opened_event)));
-  EXPECT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(get(created_event), 0));
-
-  EXPECT_TRUE(::SetEnvironmentVariable(kEnvVarName, NULL));
-}
-
-TEST(GoopdateUtilsTest, UniqueEventInEnvironment_UserMachineMismatch) {
-  const TCHAR* kEnvVarName = _T("ENV_VAR_FOR_MIXED_TEST");
-  scoped_event created_event;
-  scoped_event opened_event;
-
-  ASSERT_HRESULT_SUCCEEDED(CreateUniqueEventInEnvironment(
-      kEnvVarName,
-      false,
-      address(created_event)));
-  ASSERT_TRUE(created_event);
-  EXPECT_EQ(WAIT_TIMEOUT, ::WaitForSingleObject(get(created_event), 0));
-
-  TCHAR event_name[MAX_PATH] = {0};
-  EXPECT_TRUE(
-      ::GetEnvironmentVariable(kEnvVarName, event_name, arraysize(event_name)));
-
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            OpenUniqueEventFromEnvironment(kEnvVarName,
-                                           true,
-                                           address(opened_event)));
-
-  EXPECT_TRUE(::SetEnvironmentVariable(kEnvVarName, NULL));
-}
-
-TEST(GoopdateUtilsTest, OpenUniqueEventFromEnvironment_EnvVarDoesNotExist) {
-  const TCHAR* kEnvVarName = _T("ANOTHER_ENV_VAR_FOR_TEST");
-  scoped_event opened_event;
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND),
-            OpenUniqueEventFromEnvironment(kEnvVarName,
-                                           false,
-                                           address(opened_event)));
-}
-
-TEST(GoopdateUtilsTest, OpenUniqueEventFromEnvironment_EventDoesNotExist) {
-  const TCHAR* kEnvVarName = _T("YET_ANOTHER_ENV_VAR_FOR_TEST");
-
-  EXPECT_TRUE(::SetEnvironmentVariable(kEnvVarName, _T("foo")));
-
-  scoped_event opened_event;
-    EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-              OpenUniqueEventFromEnvironment(kEnvVarName,
-                                             false,
-                                             address(opened_event)));
-
-  EXPECT_TRUE(::SetEnvironmentVariable(kEnvVarName, NULL));
-}
-
-
-CString GetTempFile() {
-  TCHAR temp_path[MAX_PATH] = {0};
-  TCHAR temp_file[MAX_PATH] = {0};
-
-  EXPECT_LT(::GetTempPath(arraysize(temp_path), temp_path),
-            arraysize(temp_path));
-  EXPECT_NE(0, ::GetTempFileName(temp_path, _T("ut_"), 0, temp_file));
-  return CString(temp_file);
-}
-
-typedef std::map<CString, CString> StringMap;
-typedef StringMap::const_iterator StringMapIter;
-
-TEST(GoopdateUtilsTest, ReadNameValuePairsFromFileTest_MissingFile) {
-  CString temp_file = GetTempFile();
-  ::DeleteFile(temp_file);
-
-  ASSERT_FALSE(File::Exists(temp_file));
-
-  StringMap pairs_read;
-  ASSERT_FAILED(ReadNameValuePairsFromFile(temp_file,
-                                           _T("my_group"),
-                                           &pairs_read));
-  ASSERT_EQ(0, pairs_read.size());
-}
-
-TEST(GoopdateUtilsTest, ReadNameValuePairsFromFileTest_ReadEmpty) {
-  CString temp_file = GetTempFile();
-  ON_SCOPE_EXIT(::DeleteFile, temp_file.GetString());
-  File file_write;
-  EXPECT_SUCCEEDED(file_write.Open(temp_file, true, false));
-  file_write.Close();
-
-  StringMap pairs_read;
-  ASSERT_SUCCEEDED(ReadNameValuePairsFromFile(temp_file,
-                                              _T("my_group"),
-                                              &pairs_read));
-  ASSERT_EQ(0, pairs_read.size());
-}
-
-void ValidateStringMapEquality(const StringMap& expected,
-                               const StringMap& actual) {
-  ASSERT_EQ(expected.size(), actual.size());
-
-  StringMapIter it_expected = expected.begin();
-  for (; it_expected != expected.end(); ++it_expected) {
-    StringMapIter it_actual = actual.find(it_expected->first);
-    ASSERT_TRUE(it_actual != actual.end());
-    ASSERT_STREQ(it_expected->second, it_actual->second);
-  }
-}
-
-TEST(GoopdateUtilsTest, ReadNameValuePairsFromFileTest_ReadOnePair) {
-  CString group = _T("my_group");
-
-  StringMap pairs_write;
-  pairs_write[_T("some_name")] = _T("some_value");
-
-  CString temp_file = GetTempFile();
-  ON_SCOPE_EXIT(::DeleteFile, temp_file.GetString());
-  ASSERT_SUCCEEDED(WriteNameValuePairsToFile(temp_file, group, pairs_write));
-  ASSERT_TRUE(File::Exists(temp_file));
-
-  StringMap pairs_read;
-  ASSERT_SUCCEEDED(ReadNameValuePairsFromFile(temp_file, group, &pairs_read));
-
-  ValidateStringMapEquality(pairs_write, pairs_read);
-}
-
-TEST(GoopdateUtilsTest, ReadNameValuePairsFromFileTest_ReadManyPairs) {
-  CString group = _T("my_group");
-
-  StringMap pairs_write;
-  const int kCountPairs = 10;
-  for (int i = 1; i <= kCountPairs; ++i) {
-    CString name;
-    name.Format(_T("name%d"), i);
-    CString value;
-    value.Format(_T("value%d"), i);
-    pairs_write[name] = value;
-  }
-
-  CString temp_file = GetTempFile();
-  ON_SCOPE_EXIT(::DeleteFile, temp_file.GetString());
-  ASSERT_SUCCEEDED(WriteNameValuePairsToFile(temp_file, group, pairs_write));
-  ASSERT_TRUE(File::Exists(temp_file));
-
-  StringMap pairs_read;
-  ASSERT_SUCCEEDED(ReadNameValuePairsFromFile(temp_file, group, &pairs_read));
-
-  ValidateStringMapEquality(pairs_write, pairs_read);
-}
-
-TEST(GoopdateUtilsTest, IsGoogleUpdate2OrLater_LegacyVersions) {
-  EXPECT_FALSE(IsGoogleUpdate2OrLater(_T("1.0.0.0")));
-  EXPECT_FALSE(IsGoogleUpdate2OrLater(_T("1.1.103.9")));
-  EXPECT_FALSE(IsGoogleUpdate2OrLater(_T("1.1.65535.65535")));
-}
-
-TEST(GoopdateUtilsTest, IsGoogleUpdate2OrLater_Omaha2AndLater) {
-  EXPECT_TRUE(IsGoogleUpdate2OrLater(_T("1.2.0.0")));
-  EXPECT_TRUE(IsGoogleUpdate2OrLater(_T("1.2.0111.2222")));
-  EXPECT_TRUE(IsGoogleUpdate2OrLater(_T("1.3.456.7890")));
-  EXPECT_TRUE(IsGoogleUpdate2OrLater(_T("2.0.0.0")));
-}
-
-TEST(GoopdateUtilsTest, IsGoogleUpdate2OrLater_VersionZero) {
-  ExpectAsserts expect_asserts;
-  EXPECT_FALSE(IsGoogleUpdate2OrLater(_T("0.0.0.0")));
-}
-
-TEST(GoopdateUtilsTest, IsGoogleUpdate2OrLater_VersionUpperLimits) {
-  EXPECT_TRUE(IsGoogleUpdate2OrLater(_T("65535.65535.65535.65535")));
-
-  ExpectAsserts expect_asserts;
-  EXPECT_FALSE(IsGoogleUpdate2OrLater(_T("65536.65536.65536.65536")));
-  EXPECT_FALSE(IsGoogleUpdate2OrLater(_T("1.2.65536.65536")));
-  EXPECT_FALSE(IsGoogleUpdate2OrLater(_T("1.1.65536.65536")));
-}
-
-TEST(GoopdateUtilsTest, IsGoogleUpdate2OrLater_TooFewElements) {
-  ExpectAsserts expect_asserts;
-  EXPECT_FALSE(IsGoogleUpdate2OrLater(_T("1.1.1")));
-}
-
-TEST(GoopdateUtilsTest, IsGoogleUpdate2OrLater_ExtraPeriod) {
-  ExpectAsserts expect_asserts;
-  EXPECT_FALSE(IsGoogleUpdate2OrLater(_T("1.1.2.3.")));
-}
-
-TEST(GoopdateUtilsTest, IsGoogleUpdate2OrLater_TooManyElements) {
-  ExpectAsserts expect_asserts;
-  EXPECT_FALSE(IsGoogleUpdate2OrLater(_T("1.1.2.3.4")));
-}
-
-TEST(GoopdateUtilsTest, IsGoogleUpdate2OrLater_Char) {
-  ExpectAsserts expect_asserts;
-  EXPECT_FALSE(IsGoogleUpdate2OrLater(_T("1.B.3.4")));
-  EXPECT_FALSE(IsGoogleUpdate2OrLater(_T("1.2.3.B")));
-  EXPECT_FALSE(IsGoogleUpdate2OrLater(_T("1.2.3.9B")));
-}
-
-TEST(GoopdateUtilsTest, WriteInstallerDataToTempFile) {
-  CStringA utf8_bom;
-  utf8_bom.Format("%c%c%c", 0xEF, 0xBB, 0xBF);
-
-  std::vector<CString> list_installer_data;
-  list_installer_data.push_back(_T(""));
-  list_installer_data.push_back(_T("hello\n"));
-  list_installer_data.push_back(_T("good bye"));
-  list_installer_data.push_back(_T("  there  you\n     go "));
-  list_installer_data.push_back(_T("\"http://foo.bar.org/?q=stuff&h=other\""));
-  list_installer_data.push_back(_T("foo\r\nbar\n"));
-  list_installer_data.push_back(_T("foo\n\rbar"));    // LFCR is not recognized.
-  list_installer_data.push_back(_T("this is a string over 1024 characters.  ------------------------------01------------------------------02------------------------------03------------------------------04------------------------------05------------------------------06------------------------------07------------------------------08------------------------------09------------------------------10------------------------------11------------------------------12------------------------------13------------------------------14------------------------------15------------------------------16------------------------------17------------------------------18------------------------------19------------------------------20------------------------------21------------------------------22------------------------------23------------------------------24------------------------------25------------------------------26------------------------------27------------------------------28------------------------------29------------------------------30------------------------------31------------------------------32------------------------------33------------------------------34------------------------------35------------------------------36------------------------------37------------------------------38------------------------------39------------------------------40 end.")); //NOLINT
-
-  std::vector<CStringA> expected_installer_data;
-  expected_installer_data.push_back("");
-  expected_installer_data.push_back("hello\n");
-  expected_installer_data.push_back("good bye");
-  expected_installer_data.push_back("  there  you\n     go ");
-  expected_installer_data.push_back("\"http://foo.bar.org/?q=stuff&h=other\"");
-  expected_installer_data.push_back("foo\r\nbar\n");
-  expected_installer_data.push_back("foo\n\rbar");
-  expected_installer_data.push_back("this is a string over 1024 characters.  ------------------------------01------------------------------02------------------------------03------------------------------04------------------------------05------------------------------06------------------------------07------------------------------08------------------------------09------------------------------10------------------------------11------------------------------12------------------------------13------------------------------14------------------------------15------------------------------16------------------------------17------------------------------18------------------------------19------------------------------20------------------------------21------------------------------22------------------------------23------------------------------24------------------------------25------------------------------26------------------------------27------------------------------28------------------------------29------------------------------30------------------------------31------------------------------32------------------------------33------------------------------34------------------------------35------------------------------36------------------------------37------------------------------38------------------------------39------------------------------40 end."); //NOLINT
-
-  ASSERT_EQ(expected_installer_data.size(), list_installer_data.size());
-
-  for (size_t i = 0; i < list_installer_data.size(); ++i) {
-    CString installer_data = list_installer_data[i];
-    SCOPED_TRACE(installer_data);
-
-    CString file_path;
-    HRESULT hr = WriteInstallerDataToTempFile(installer_data, &file_path);
-    ON_SCOPE_EXIT(::DeleteFile, file_path.GetString());
-    EXPECT_SUCCEEDED(hr);
-
-    // TODO(omaha): consider eliminating the special case.
-    // WriteInstallerDataToTempFile() will return S_FALSE with "" data.
-    if (S_OK == hr) {
-      File file;
-      const int kBufferLen = 4096;
-      std::vector<byte> data_line(kBufferLen);
-      EXPECT_SUCCEEDED(file.Open(file_path, false, false));
-      uint32 bytes_read(0);
-      EXPECT_SUCCEEDED(file.Read(data_line.size(),
-                                 &data_line.front(),
-                                 &bytes_read));
-      data_line.resize(bytes_read);
-      data_line.push_back(0);
-      EXPECT_STREQ(utf8_bom + expected_installer_data[i],
-                   reinterpret_cast<const char*>(&data_line.front()));
-      EXPECT_SUCCEEDED(file.Close());
-    } else {
-      EXPECT_TRUE(installer_data.IsEmpty());
-    }
-  }
-}
-
-TEST_F(GoopdateUtilsRegistryProtectedTest, UpdateLastChecked) {
-  EXPECT_SUCCEEDED(UpdateLastChecked(false));
-  EXPECT_FALSE(ShouldCheckForUpdates(false));
-
-  ConfigManager::Instance()->SetLastCheckedTime(false, 0);
-  EXPECT_TRUE(ShouldCheckForUpdates(false));
-}
-
-TEST_F(GoopdateUtilsRegistryProtectedTest,
-       ShouldCheckForUpdates_NoLastCheckedPresent) {
-  EXPECT_TRUE(ShouldCheckForUpdates(false));
-}
-
-TEST_F(GoopdateUtilsRegistryProtectedTest,
-       ShouldCheckForUpdates_LastCheckedPresent) {
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  ConfigManager::Instance()->SetLastCheckedTime(false, now - 10);
-  EXPECT_FALSE(ShouldCheckForUpdates(false));
-
-  ConfigManager::Instance()->SetLastCheckedTime(false,
-                                                now - kLastCheckPeriodSec - 1);
-  EXPECT_TRUE(ShouldCheckForUpdates(false));
-}
-
-TEST_F(GoopdateUtilsRegistryProtectedTest,
-       ShouldCheckForUpdates_LastCheckedInFuture) {
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  // The absolute difference is within the check period.
-  ConfigManager::Instance()->SetLastCheckedTime(false, now + 600);
-  EXPECT_FALSE(ShouldCheckForUpdates(false));
-
-  // The absolute difference is greater than the check period.
-  ConfigManager::Instance()->SetLastCheckedTime(false,
-                                                now + kLastCheckPeriodSec + 1);
-  EXPECT_TRUE(ShouldCheckForUpdates(false));
-}
-
-TEST_F(GoopdateUtilsRegistryProtectedTest,
-       ShouldCheckForUpdates_PeriodZero) {
-  EXPECT_SUCCEEDED(
-      RegKey::SetValue(kRegKeyGoopdateGroupPolicy,
-                       kRegValueAutoUpdateCheckPeriodOverrideMinutes,
-                       static_cast<DWORD>(0)));
-
-  EXPECT_FALSE(ShouldCheckForUpdates(false));
-}
-
-TEST_F(GoopdateUtilsRegistryProtectedTest,
-       ShouldCheckForUpdates_PeriodOverride) {
-  const DWORD kOverrideMinutes = 10;
-  const DWORD kOverrideSeconds = kOverrideMinutes * 60;
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  EXPECT_SUCCEEDED(
-      RegKey::SetValue(kRegKeyGoopdateGroupPolicy,
-                       kRegValueAutoUpdateCheckPeriodOverrideMinutes,
-                       kOverrideMinutes));
-
-  ConfigManager::Instance()->SetLastCheckedTime(false, now - 10);
-  EXPECT_FALSE(ShouldCheckForUpdates(false));
-
-  ConfigManager::Instance()->SetLastCheckedTime(false,
-                                                now - kOverrideSeconds - 1);
-  EXPECT_TRUE(ShouldCheckForUpdates(false));
-}
-
-TEST_P(GoopdateUtilsRegistryProtectedBooleanTest, CreateUserId) {
-  const bool is_machine = GetParam();
-  CString user_id1, user_id2;
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueForceUsageStats,
-                                    _T("1")));
-
-  EXPECT_SUCCEEDED(goopdate_utils::CreateUserId(is_machine));
-  user_id1 = goopdate_utils::GetUserIdLazyInit(is_machine);
-
-  // If user id exists, CreateUserId() should not create a new one.
-  EXPECT_SUCCEEDED(goopdate_utils::CreateUserId(is_machine));
-  user_id2 = goopdate_utils::GetUserIdLazyInit(is_machine);
-  EXPECT_STREQ(user_id1, user_id2);
-
-  goopdate_utils::DeleteUserId(is_machine);
-
-  // Recreate user id should result in a different id.
-  user_id2 = goopdate_utils::GetUserIdLazyInit(is_machine);
-  EXPECT_STRNE(user_id1, user_id2);
-
-  // Id generation should fail if machine is in OEM install state.
-  const DWORD now = Time64ToInt32(GetCurrent100NSTime());
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("OemInstallTime"),
-                                    now));
-  if (is_machine) {
-    ASSERT_TRUE(oem_install_utils::IsOemInstalling(is_machine));
-    EXPECT_FAILED(goopdate_utils::CreateUserId(is_machine));
-  } else {
-    ASSERT_FALSE(oem_install_utils::IsOemInstalling(is_machine));
-    EXPECT_SUCCEEDED(goopdate_utils::CreateUserId(is_machine));
-  }
-}
-
-TEST_F(GoopdateUtilsRegistryProtectedTest,
-       GenerateUserId_EachUserShouldHaveHisOwnHive) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueForceUsageStats,
-                                    _T("1")));
-
-  CString machine_user_id = goopdate_utils::GetUserIdLazyInit(true);
-  CString user_id = goopdate_utils::GetUserIdLazyInit(false);
-  EXPECT_STRNE(machine_user_id, user_id);
-}
-
-TEST_P(GoopdateUtilsRegistryProtectedBooleanTest, GetOptInUserId_UpdateDev) {
-  const bool is_machine = GetParam();
-
-  CString user_id = goopdate_utils::GetUserIdLazyInit(is_machine);
-  EXPECT_TRUE(user_id.IsEmpty());
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueForceUsageStats,
-                                    _T("1")));
-
-  user_id = goopdate_utils::GetUserIdLazyInit(is_machine);
-  EXPECT_FALSE(user_id.IsEmpty());
-
-  EXPECT_STREQ(user_id, goopdate_utils::GetUserIdLazyInit(is_machine));
-
-  GUID guid = GUID_NULL;
-  EXPECT_SUCCEEDED(StringToGuidSafe(user_id, &guid));
-}
-
-TEST_P(GoopdateUtilsRegistryProtectedBooleanTest, GetOptInUserId_AppOptIn) {
-  const bool is_machine = GetParam();
-  CString user_id = goopdate_utils::GetUserIdLazyInit(is_machine);
-  EXPECT_TRUE(user_id.IsEmpty());
-
-  CString key_path =
-      ConfigManager::Instance()->registry_client_state(is_machine);
-  key_path = AppendRegKeyPath(key_path, kAppId);
-  EXPECT_SUCCEEDED(RegKey::SetValue(key_path,
-                                    kRegValueForceUsageStats,
-                                    static_cast<DWORD>(1)));
-
-  user_id = goopdate_utils::GetUserIdLazyInit(is_machine);
-  EXPECT_FALSE(user_id.IsEmpty());
-
-  GUID guid = GUID_NULL;
-  EXPECT_SUCCEEDED(StringToGuidSafe(user_id, &guid));
-}
-
-TEST_F(GoopdateUtilsRegistryProtectedTest, GetOptInUserId_UserNotOptIn) {
-  const bool is_machine = false;
-
-  EXPECT_TRUE(goopdate_utils::GetUserIdLazyInit(is_machine).IsEmpty());
-
-  EXPECT_SUCCEEDED(goopdate_utils::CreateUserId(is_machine));
-  EXPECT_TRUE(
-      RegKey::HasValue(ConfigManager::Instance()->registry_update(is_machine),
-                       kRegValueUserId));
-  EXPECT_TRUE(goopdate_utils::GetUserIdLazyInit(is_machine).IsEmpty());
-
-  // ID should be removed.
-  EXPECT_FALSE(
-      RegKey::HasValue(ConfigManager::Instance()->registry_update(is_machine),
-                       kRegValueUserId));
-}
-
-TEST_P(GoopdateUtilsRegistryProtectedBooleanTest,
-       GetOptInUserId_OemInstalling) {
-  const bool is_machine = GetParam();
-  EXPECT_SUCCEEDED(goopdate_utils::CreateUserId(is_machine));
-
-  const DWORD now = Time64ToInt32(GetCurrent100NSTime());
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("OemInstallTime"),
-                                    now));
-  EXPECT_EQ(is_machine, oem_install_utils::IsOemInstalling(is_machine));
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueForceUsageStats,
-                                    _T("1")));
-
-  if (is_machine) {
-    EXPECT_TRUE(goopdate_utils::GetUserIdLazyInit(is_machine).IsEmpty());
-
-    EXPECT_SUCCEEDED(RegKey::DeleteValue(MACHINE_REG_UPDATE,
-                                         _T("OemInstallTime")));
-    EXPECT_FALSE(goopdate_utils::GetUserIdLazyInit(is_machine).IsEmpty());
-  } else {
-    EXPECT_FALSE(goopdate_utils::GetUserIdLazyInit(is_machine).IsEmpty());
-  }
-}
-
-INSTANTIATE_TEST_CASE_P(MachineOrUser,
-                        GoopdateUtilsRegistryProtectedBooleanTest,
-                        ::testing::Bool());
-
-}  // namespace goopdate_utils
-
-}  // namespace omaha
diff --git a/common/install_manifest.h b/common/install_manifest.h
deleted file mode 100644
index 6333f68..0000000
--- a/common/install_manifest.h
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Defines the installation manifest, which is specific to each application and
-// version. This is a quasi-static data structure returned by the server in
-// the update response.
-
-#ifndef OMAHA_COMMON_INSTALL_MANIFEST_H_
-#define OMAHA_COMMON_INSTALL_MANIFEST_H_
-
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "omaha/common/const_goopdate.h"
-
-namespace omaha {
-
-namespace xml {
-
-struct InstallPackage {
-  InstallPackage() : is_required(false), size(0) {}
-
-  CString name;
-  CString version;
-  bool is_required;
-  int size;
-  CString hash;
-};
-
-struct InstallAction {
-  InstallAction()
-      : install_event(static_cast<InstallEvent>(0)),
-        needs_admin(NEEDS_ADMIN_NO),
-        terminate_all_browsers(false),
-        success_action(SUCCESS_ACTION_DEFAULT) {}
-
-  enum InstallEvent { kPreInstall = 1, kInstall, kUpdate, kPostInstall };
-
-  InstallEvent install_event;
-
-  // Whether the action should be run as admin. This may differ from whether the
-  // app is_machine.
-  // TODO(omaha3): This value is defined in the protocol but not implemented:
-  //  * It is not yet set by the XML parser.
-  //  * This should probably be renamed run_elevated since it is more likely to
-  //    be used to run de-elevated from an elevated Omaha instance.
-  //  * What should machine Omaha do if there is no logged in user and the
-  //    action cannot be de-elevated?
-  //  * This should default to the bundle's is_machine.
-  //  * Assert if !is_machine and needs_admin == NEEDS_ADMIN_YES.
-  NeedsAdmin needs_admin;
-
-  // TODO(omaha3): Need some more thinking here. On one hand, overloading this
-  // is tempting. On the other hand, it may be hard to read.
-  // This could also be SuccessfulInstallActions such as "launch_browser", or
-  // "terminate_all_browsers". The program_params in the case of
-  // "launch_browser" would be the URL to navigate to.
-  CString program_to_run;
-  CString program_arguments;
-
-  CString success_url;       // URL to launch the browser on success.
-  bool terminate_all_browsers;
-  SuccessfulInstallAction success_action;  // Action after install success.
-};
-
-// TODO(omaha3): Should all these really be public members?
-struct InstallManifest {
-  CString name;       // TBD.
-  CString version;
-  std::vector<InstallPackage> packages;
-  // TODO(omaha3): Maybe this should be a map or array of kPostInstall + 1 ptrs.
-  std::vector<InstallAction> install_actions;
-};
-
-}  // namespace xml
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_INSTALL_MANIFEST_H_
diff --git a/common/lang.cc b/common/lang.cc
deleted file mode 100644
index a14ca6f..0000000
--- a/common/lang.cc
+++ /dev/null
@@ -1,381 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/common/lang.h"
-#include <windows.h>
-#include <set>
-#include <map>
-#include <vector>
-#include "omaha/base/constants.h"
-#include "omaha/base/commontypes.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/file_ver.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/path.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/goopdate_utils.h"
-
-namespace omaha {
-
-namespace lang {
-
-namespace {
-
-const LANGID kFallbackLangID = 0x0409;
-const TCHAR* const kFallbackLanguage = _T("en");
-
-// This is the structure of the table which contains the language identifier
-// and the associated language string.
-struct LangIDAndPath {
-  LANGID langid;
-  TCHAR lang[12];
-};
-const LangIDAndPath kLanguageTranslationTable[] = {
-  // First we collect all main languages here which need special treatment.
-  // Special treatment might be necessary because of:
-  //  1.) Google has a special region code which is "Google specific". They
-  //      trump everything and should be at the beginning. (e.g. "iw")
-  //  2.) Usually a lot of languages are like "en-US", "en-GB",... and start
-  //      with the main language. However some languages like Norwegian do not
-  //      follow this scheme and we put them therefore at the top.
-  // The matching algorithm will look first for the full match, but at the same
-  // time it will look for a partial match. We want to add therefore the partial
-  // matches as high as possible to get them as a fallback.
-  { 0x0409, _T("en")         },  // _T("English (United States)")
-  { 0x040d, _T("iw")         },  // _T("Hebrew")
-  { 0x0464, _T("fil")        },  // _T("Tagalog")
-  { 0x0414, _T("no")         },  // _T("Norwegian (Bokmal, Norway)")
-
-  // and then we have all dialects here:
-  // { 0x041c, _T("sq-AL")      },  // _T("Albanian (Albania)")")
-  // { 0x0484, _T("gsw-FR")     },  // _T("Alsatian (France)")
-  { 0x045e, _T("am")  },  // _T("am-ET")      },  // _T("Amharic (Ethiopia)")
-  { 0x1401, _T("ar")  },  // _T("ar-DZ")      },  // _T("Arabic (Algeria)")
-  { 0x3c01, _T("ar")  },  // _T("ar-BH")      },  // _T("Arabic (Bahrain)")
-  { 0x0c01, _T("ar")  },  // _T("ar-EG")      },  // _T("Arabic (Egypt)")
-  { 0x0801, _T("ar")  },  // _T("ar-IQ")      },  // _T("Arabic (Iraq)")
-  { 0x2c01, _T("ar")  },  // _T("ar-JO")      },  // _T("Arabic (Jordan)")
-  { 0x3401, _T("ar")  },  // _T("ar-KW")      },  // _T("Arabic (Kuwait)")
-  { 0x3001, _T("ar")  },  // _T("ar-LB")      },  // _T("Arabic (Lebanon)")
-  { 0x1001, _T("ar")  },  // _T("ar-LY")      },  // _T("Arabic (Libya)")
-  { 0x1801, _T("ar")  },  // _T("ar-MA")      },  // _T("Arabic (Morocco)")
-  { 0x2001, _T("ar")  },  // _T("ar-OM")      },  // _T("Arabic (Oman)")
-  { 0x4001, _T("ar")  },  // _T("ar-QA")      },  // _T("Arabic (Qatar)")
-  { 0x0401, _T("ar")  },  // _T("ar-SA")      },  // _T("Arabic (Saudi Arabia)")
-  { 0x2801, _T("ar")  },  // _T("ar-SY")      },  // _T("Arabic (Syria)")
-  { 0x1c01, _T("ar")  },  // _T("ar-TN")      },  // _T("Arabic (Tunisia)")
-  { 0x3801, _T("ar")  },  // _T("ar-AE")      },  // _T("Arabic (U.A.E.)")
-  { 0x2401, _T("ar")  },  // _T("ar-YE")      },  // _T("Arabic (Yemen)")
-  { 0x042b, _T("ar")  },  // _T("hy-AM")      },  // _T("Armenian (Armenia)")
-  // { 0x044d, _T("as-IN")      },  // _T("Assamese (India)")
-  // { 0x082c, _T("az-Cyrl-AZ") },  // _T("Azeri (Azerbaijan, Cyrillic)")
-  // { 0x042c, _T("az-Latn-AZ") },  // _T("Azeri (Azerbaijan, Latin)")
-  // { 0x046d, _T("ba-RU")      },  // _T("Bashkir (Russia)")
-  // { 0x042d, _T("eu-ES")      },  // _T("Basque (Basque)")
-  // { 0x0423, _T("be-BY")      },  // _T("Belarusian (Belarus)")
-  { 0x0445, _T("bn")  },  // _T("bn-IN")      },  // _T("Bengali (India)")
-  // { 0x201a, _T("bs-Cyrl-BA") },  // _T("Bosnian (Bosnia and Herzegovina,
-  //                                       Cyrillic)")
-  // { 0x141a, _T("bs-Latn-BA") },  // _T("Bosnian (Bosnia and Herzegovina,
-  //                                       Latin)")
-  // { 0x047e, _T("br-FR")      },  // _T("Breton (France)")
-  { 0x0402, _T("bg")  },  // _T("bg-BG")   },  // _T("Bulgarian (Bulgaria)")
-  { 0x0403, _T("ca")  },  // _T("ca-ES")   },  // _T("Catalan (Catalan)")
-  { 0x0c04, _T("zh-HK") },  // _T("zh-HK")     // _T("Chinese
-                            //   (Hong Kong SAR, PRC)")
-  { 0x1404, _T("zh-TW") },  // _T("zh-MO")   },  // _T("Chinese (Macao SAR)")
-  { 0x0804, _T("zh-CN") },  // _T("zh-CN")   },  // _T("Chinese (PRC)")
-  { 0x1004, _T("zh-CN") },  // _T("zh-SG")   },  // _T("Chinese (Singapore)")
-  { 0x0404, _T("zh-TW") },  // _T("Chinese (Taiwan)")
-  { 0x101a, _T("hr")    },  // _T("hr-BA")   },  // _T("Croatian
-                            //   (Bosnia and Herzegovina, Latin)")
-  { 0x041a, _T("hr")    },  // _T("hr-HR")   },  // _T("Croatian (Croatia)")
-  { 0x0405, _T("cs")    },  // _T("cs-CZ")   },  // _T("Czech (Czech Republic)")
-  { 0x0406, _T("da")    },  // _T("da-DK")   },  // _T("Danish (Denmark)")
-  // { 0x048c, _T("gbz-AF")     },  // _T("Dari (Afghanistan)")
-  // { 0x0465, _T("dv-MV")      },  // _T("Divehi (Maldives)")
-  { 0x0813, _T("nl")  },  // _T("nl-BE")   },  // _T("Dutch (Belgium)")
-  { 0x0413, _T("nl")  },  // _T("nl-NL")   },  // _T("Dutch (Netherlands)")
-  { 0x0c09, _T("en")  },  // _T("en-AU")   },  // _T("English (Australia)")
-  { 0x2809, _T("en")  },  // _T("en-BZ")   },  // _T("English (Belize)")
-  { 0x1009, _T("en")  },  // _T("en-CA")   },  // _T("English (Canada)")
-  { 0x2409, _T("en")  },  // _T("en-029")  },  // _T("English (Caribbean)")
-  { 0x4009, _T("en")  },  // _T("en-IN")   },  // _T("English (India)")
-  { 0x1809, _T("en")  },  // _T("en-IE")   },  // _T("English (Ireland)")
-  { 0x2009, _T("en")  },  // _T("en-JM")   },  // _T("English (Jamaica)")
-  { 0x4409, _T("en")  },  // _T("en-MY")   },  // _T("English (Malaysia)")
-  { 0x1409, _T("en")  },  // _T("en-NZ")   },  // _T("English (New Zealand)")
-  { 0x3409, _T("en")  },  // _T("en-PH")   },  // _T("English (Philippines)")
-  { 0x4809, _T("en")  },  // _T("en-SG")   },  // _T("English (Singapore)")
-  { 0x1c09, _T("en")  },  // _T("en-ZA")   },  // _T("English (South Africa)")
-  { 0x2c09, _T("en")  },  // _T("en-TT")   },  // _T("English
-                          //   (Trinidad and Tobago)")
-  { 0x0809, _T("en-GB") },  // _T("English (United Kingdom)")
-  { 0x3009, _T("en")    },  // _T("en-ZW")      },  // _T("English (Zimbabwe)")
-  { 0x0425, _T("et")  },  // _T("et-EE")   },  // _T("Estonian (Estonia)")
-  // { 0x0438, _T("fo-FO")  },  // _T("Faroese (Faroe Islands)")
-  { 0x0464, _T("fil") },  // _T("fil-PH")    },  // _T("Filipino (Philippines)")
-  { 0x040b, _T("fi")  },  // _T("fi-FI")      },  // _T("Finnish (Finland)")
-  { 0x080c, _T("fr")  },  // _T("fr-BE")      },  // _T("French (Belgium)")
-  { 0x0c0c, _T("fr")  },  // _T("fr-CA")      },  // _T("French (Canada)")
-  { 0x040c, _T("fr")  },  // _T("fr-FR")      },  // _T("French (France)")
-  { 0x140c, _T("fr")  },  // _T("fr-LU")      },  // _T("French (Luxembourg)")
-  { 0x180c, _T("fr")  },  // _T("fr-MC")      },  // _T("French (Monaco)")
-  { 0x100c, _T("fr")  },  // _T("fr-CH")      },  // _T("French (Switzerland)")
-  // { 0x0462, _T("fy-NL")      },  // _T("Frisian (Netherlands)")
-  // { 0x0456, _T("gl-ES")      },  // _T("Galician (Spain)")
-  // { 0x0437, _T("ka-GE")      },  // _T("Georgian (Georgia)")
-  { 0x0c07, _T("de")  },  // _T("de-AT")   },  // _T("German (Austria)")
-  { 0x0407, _T("de")  },  // _T("de-DE")   },  // _T("German (Germany)")
-  { 0x1407, _T("de")  },  // _T("de-LI")   },  // _T("German (Liechtenstein)")
-  { 0x1007, _T("de")  },  // _T("de-LU")   },  // _T("German (Luxembourg)")
-  { 0x0807, _T("de")  },  // _T("de-CH")   },  // _T("German (Switzerland)")
-  { 0x0408, _T("el")  },  // _T("el-GR")   },  // _T("Greek (Greece)")
-  // { 0x046f, _T("kl-GL")      },  // _T("Greenlandic (Greenland)")
-  { 0x0447, _T("gu")  },  // _T("gu-IN")      },  // _T("Gujarati (India)")
-  // { 0x0468, _T("ha-Latn-NG") },  // _T("Hausa (Nigeria, Latin)")
-  // { 0x040d, _T("he-IL")      },  // _T("Hebrew (Israel)")
-  { 0x0439, _T("hi")  },  // _T("hi-IN")   },  // _T("Hindi (India)")
-  { 0x040e, _T("hu")  },  // _T("hu-HU")   },  // _T("Hungarian (Hungary)")
-  { 0x040f, _T("is")  },  // _T("is-IS")      },  // _T("Icelandic (Iceland)")
-  // { 0x0470, _T("ig-NG")      },  // _T("Igbo (Nigeria)")
-  { 0x0421, _T("id")  },  // _T("id-ID")    },  // _T("Indonesian (Indonesia)")
-  // { 0x085d, _T("iu-Latn-CA") },  // _T("Inuktitut (Canada, Latin)")
-  // { 0x045d, _T("iu-Cans-CA") },  // _T("Inuktitut (Canada, Syllabics)")
-  // { 0x083c, _T("ga-IE")      },  // _T("Irish (Ireland)")
-  { 0x0410, _T("it")  },  // _T("it-IT")      },  // _T("Italian (Italy)")
-  { 0x0810, _T("it")  },  // _T("it-CH")      },  // _T("Italian (Switzerland)")
-  { 0x0411, _T("ja")  },  // _T("ja-JP")      },  // _T("Japanese (Japan)")
-  { 0x044b, _T("kn")  },  // _T("kn-IN")      },  // _T("Kannada (India)")
-  // { 0x043f, _T("kk-KZ")      },  // _T("Kazakh (Kazakhstan)")
-  // { 0x0453, _T("kh-KH")      },  // _T("Khmer (Cambodia)")
-  // { 0x0486, _T("qut-GT")     },  // _T("K'iche (Guatemala)")
-  // { 0x0487, _T("rw-RW")      },  // _T("Kinyarwanda (Rwanda)")
-  // { 0x0457, _T("kok-IN")     },  // _T("Konkani (India)")
-  { 0x0812, _T("ko")         },  // _T("ko-Jo")      },  // _T("Korean (Johab)")
-  { 0x0412, _T("ko")         },  // _T("ko-KR")      },  // _T("Korean (Korea)")
-  // { 0x0440, _T("ky-KG")      },  // _T("Kyrgyz (Kyrgyzstan)")
-  // { 0x0454, _T("lo-LA")      },  // _T("Lao (Lao PDR)")
-  { 0x0426, _T("lv")  },  // _T("lv-LV")   },  // _T("Latvian (Latvia)")
-  { 0x0427, _T("lt")  },  // _T("lt-LT")   },  // _T("Lithuanian (Lithuania)")
-  // { 0x082e, _T("dsb-DE")     },  // _T("Lower Sorbian (Germany)")
-  // { 0x046e, _T("lb-LU")      },  // _T("Luxembourgish (Luxembourg)")
-  // { 0x042f, _T("mk-MK")      },  // _T("Macedonian (Macedonia, FYROM)")
-  { 0x083e, _T("ms")  },  // _T("ms-BN")  },  // _T("Malay (Brunei Darussalam)")
-  { 0x043e, _T("ms")  },  // _T("ms-MY")      },  // _T("Malay (Malaysia)")
-  { 0x044c, _T("ml")  },  // _T("ml-IN")      },  // _T("Malayalam (India)")
-  // { 0x043a, _T("mt-MT")      },  // _T("Maltese (Malta)")
-  // { 0x0481, _T("mi-NZ")      },  // _T("Maori (New Zealand)")
-  // { 0x047a, _T("arn-CL")     },  // _T("Mapudungun (Chile)")
-  { 0x044e, _T("mr")  },  // _T("mr-IN")      },  // _T("Marathi (India)")
-  // { 0x047c, _T("moh-CA")     },  // _T("Mohawk (Canada)")
-  // { 0x0450, _T("mn-Cyrl-MN") },  // _T("Mongolian (Mongolia)")
-  // { 0x0850, _T("mn-Mong-CN") },  // _T("Mongolian (PRC)")
-  // { 0x0461, _T("ne-NP")      },  // _T("Nepali (Nepal)")
-  // { 0x0414, _T("nb-NO")      },  // _T("Norwegian (Bokmal, Norway)")
-  // { 0x0814, _T("nn-NO")      },  // _T("Norwegian (Nynorsk, Norway)")
-  // { 0x0482, _T("oc-FR")      },  // _T("Occitan (France)")
-  // { 0x0448, _T("or-IN") },  // _T("Oriya (India)")
-  // { 0x0463, _T("ps-AF") },  // _T("Pashto (Afghanistan)")
-  { 0x0429, _T("fa")  },  // _T("fa-IR")      },  // _T("Persian (Iran)")
-  { 0x0415, _T("pl")  },  // _T("pl-PL")      },  // _T("Polish (Poland)")
-  { 0x0416, _T("pt-BR")      },  // _T("Portuguese (Brazil)")
-  { 0x0816, _T("pt-PT")      },  // _T("Portuguese (Portugal)")
-  // { 0x0446, _T("pa-IN")      },  // _T("Punjabi (India)")
-  // { 0x046b, _T("quz-BO")     },  // _T("Quechua (Bolivia)")
-  // { 0x086b, _T("quz-EC")     },  // _T("Quechua (Ecuador)")
-  // { 0x0c6b, _T("quz-PE")     },  // _T("Quechua (Peru)")
-  { 0x0418, _T("ro")  },  // _T("ro-RO")      },  // _T("Romanian (Romania)")
-  // { 0x0417, _T("rm-CH")      },  // _T("Romansh (Switzerland)")
-  { 0x0419, _T("ru")  },  // _T("ru-RU")      },  // _T("Russian (Russia)")
-  // { 0x243b, _T("smn-FI")     },  // _T("Sami (Inari, Finland)")
-  // { 0x103b, _T("smj-NO")     },  // _T("Sami (Lule, Norway)")
-  // { 0x143b, _T("smj-SE")     },  // _T("Sami (Lule, Sweden)")
-  // { 0x0c3b, _T("se-FI")      },  // _T("Sami (Northern, Finland)")
-  // { 0x043b, _T("se-NO")      },  // _T("Sami (Northern, Norway)")
-  // { 0x083b, _T("se-SE")      },  // _T("Sami (Northern, Sweden)")
-  // { 0x203b, _T("sms-FI")     },  // _T("Sami (Skolt, Finland)")
-  // { 0x183b, _T("sma-NO")     },  // _T("Sami (Southern, Norway)")
-  // { 0x1c3b, _T("sma-SE")     },  // _T("Sami (Southern, Sweden)")
-  // { 0x044f, _T("sa-IN")      },  // _T("Sanskrit (India)")
-  { 0x1c1a, _T("sr")  },  // _T("sr-Cyrl-BA") },  // _T("Serbian
-                          //   (Bosnia and Herzegovina, Cyrillic)")
-  { 0x181a, _T("sr")  },  // _T("sr-Latn-BA") },  // _T("Serbian
-                          //   (Bosnia and Herzegovina, Latin)")
-  { 0x0c1a, _T("sr")  },  // _T("sr-Cyrl-CS") },  // _T("Serbian
-                          //   (Serbia and Montenegro, Cyrillic)")
-  { 0x081a, _T("sr")  },  // _T("sr-Latn-CS") },  // _T("Serbian
-                          //   (Serbia and Montenegro, Latin)")
-  // { 0x046c, _T("ns-ZA")      },  // _T("Sesotho sa Leboa/Northern Sotho
-  //                                       (South Africa)")
-  // { 0x0432, _T("tn-ZA")      },  // _T("Setswana/Tswana (South Africa)")
-  // { 0x045b, _T("si-LK")      },  // _T("Sinhala (Sri Lanka)")
-  { 0x041b, _T("sk")  },  // _T("sk-SK")   },  // _T("Slovak (Slovakia)")
-  { 0x0424, _T("sl")  },  // _T("sl-SI")   },  // _T("Slovenian (Slovenia)")
-  { 0x2c0a, _T("es-419") },  // _T("es-AR")   },  // _T("Spanish (Argentina)")
-  { 0x400a, _T("es-419") },  // _T("es-BO")   },  // _T("Spanish (Bolivia)")
-  { 0x340a, _T("es-419") },  // _T("es-CL")   },  // _T("Spanish (Chile)")
-  { 0x240a, _T("es-419") },  // _T("es-CO")   },  // _T("Spanish (Colombia)")
-  { 0x140a, _T("es-419") },  // _T("es-CR")   },  // _T("Spanish (Costa Rica)")
-  { 0x1c0a, _T("es-419") },  // _T("es-DO")   },  // _T("Spanish
-                                                  //     (Dominican Republic)")
-  { 0x300a, _T("es-419") },  // _T("es-EC")   },  // _T("Spanish (Ecuador)")
-  { 0x440a, _T("es-419") },  // _T("es-SV")   },  // _T("Spanish (El Salvador)")
-  { 0x100a, _T("es-419") },  // _T("es-GT")   },  // _T("Spanish (Guatemala)")
-  { 0x480a, _T("es-419") },  // _T("es-HN")   },  // _T("Spanish (Honduras)")
-  { 0x080a, _T("es-419") },  // _T("es-MX")   },  // _T("Spanish (Mexico)")
-  { 0x4c0a, _T("es-419") },  // _T("es-NI")   },  // _T("Spanish (Nicaragua)")
-  { 0x180a, _T("es-419") },  // _T("es-PA")   },  // _T("Spanish (Panama)")
-  { 0x3c0a, _T("es-419") },  // _T("es-PY")   },  // _T("Spanish (Paraguay)")
-  { 0x280a, _T("es-419") },  // _T("es-PE")   },  // _T("Spanish (Peru)")
-  { 0x500a, _T("es-419") },  // _T("es-PR")   },  // _T("Spanish (Puerto Rico)")
-  { 0x0c0a, _T("es")     },  // _T("es-ES")   },  // _T("Spanish (Spain)")
-  { 0x040a, _T("es")     },  // _T("es-ES_tradnl")   },
-                             // _T("Spanish (Spain, Traditional Sort)")
-  { 0x540a, _T("es-419") },  // _T("es-US")   },  // _T("Spanish
-                                                  //     (United States)")
-  { 0x380a, _T("es-419") },  // _T("es-UY")   },  // _T("Spanish (Uruguay)")
-  { 0x200a, _T("es-419") },  // _T("es-VE")   },  // _T("Spanish (Venezuela)")
-  { 0x0441, _T("sw")  },  // _T("sw-KE")      },  // _T("Swahili (Kenya)")
-  { 0x081d, _T("sv")  },  // _T("sv-FI")      },  // _T("Swedish (Finland)")
-  { 0x041d, _T("sv")  },  // _T("sv-SE")      },  // _T("Swedish (Sweden)")
-  // { 0x045a, _T("syr-SY")     },  // _T("Syriac (Syria)")
-  // { 0x0428, _T("tg-Cyrl-TJ") },  // _T("Tajik (Tajikistan)")
-  // { 0x085f, _T("tmz-Latn-DZ")},  // _T("Tamazight (Algeria, Latin)")
-  { 0x0449, _T("ta")  },  // _T("ta-IN")      },  // _T("Tamil (India)")
-  // { 0x0444, _T("tt-RU") },  // _T("Tatar (Russia)")
-  { 0x044a, _T("te")  },  // _T("te-IN") }, // _T("Telugu (India)")
-  { 0x041e, _T("th")  },  // _T("th-TH")      },  // _T("Thai (Thailand)")
-  // { 0x0851, _T("bo-BT")      },  // _T("Tibetan (Bhutan)")
-  // { 0x0451, _T("bo-CN")      },  // _T("Tibetan (PRC)")
-  { 0x041f, _T("tr")  },  // _T("tr-TR")      },  // _T("Turkish (Turkey)")
-  // { 0x0442, _T("tk-TM")      },  // _T("Turkmen (Turkmenistan)")
-  // { 0x0480, _T("ug-CN")      },  // _T("Uighur (PRC)")
-  { 0x0422, _T("uk")  },  // _T("uk-UA")      },  // _T("Ukrainian (Ukraine)")
-  // { 0x042e, _T("wen-DE")     },  // _T("Upper Sorbian (Germany)")
-  // { 0x0820,  _T("tr-IN")      },  // _T("Urdu(India)")
-  { 0x0420, _T("ur")  },  // _T("ur-PK") },  // _T("Urdu (Pakistan)")
-  // { 0x0843, _T("uz-Cyrl-UZ") }, // _T("Uzbek (Uzbekistan, Cyrillic)")
-  // { 0x0443, _T("uz-Latn-UZ") },  // _T("Uzbek (Uzbekistan, Latin)")
-  { 0x042a, _T("vi")  },  // _T("vi-VN")      },  // _T("Vietnamese (Vietnam)")
-  // { 0x0452, _T("cy-GB")      },  // _T("Welsh (United Kingdom)")
-  // { 0x0488, _T("wo-SN")      },  // _T("Wolof (Senegal)")
-  // { 0x0434, _T("xh-ZA")      },  // _T("Xhosa/isiXhosa (South Africa)")
-  // { 0x0485, _T("sah-RU")     },  // _T("Yakut (Russia)")
-  // { 0x0478, _T("ii-CN")      },  // _T("Yi (PRC)")
-  // { 0x046a, _T("yo-NG") }, // _T("Yoruba (Nigeria)")
-  // { 0x0435, _T("zu-ZA") }, // _T("Zulu/isiZulu (South Africa)")
-  { 0x0000, _T("")           }   // The list termination.
-};
-}
-
-CString GetDefaultLanguage(bool is_system) {
-  return GetLanguageForLangID(GetDefaultLanguageID(is_system));
-}
-
-LANGID GetDefaultLanguageID(bool is_system) {
-  LANGID langid = is_system ? ::GetSystemDefaultLangID()
-                            : ::GetUserDefaultLangID();
-  if (IsLanguageIDSupported(langid)) {
-    return langid;
-  }
-
-  return kFallbackLangID;
-}
-
-// If an exact match is not found, returns "en".
-CString GetLanguageForLangID(LANGID langid) {
-  ASSERT1(langid != 0);
-
-  for (int i = 0; kLanguageTranslationTable[i].langid; ++i) {
-    if (kLanguageTranslationTable[i].langid == langid) {
-      return kLanguageTranslationTable[i].lang;
-    }
-  }
-
-  return kFallbackLanguage;
-}
-
-bool IsLanguageIDSupported(LANGID langid) {
-  for (int i = 0; kLanguageTranslationTable[i].langid; ++i) {
-    if (langid == kLanguageTranslationTable[i].langid) {
-      return true;
-    }
-  }
-
-  return false;
-}
-
-bool IsLanguageSupported(const CString& language) {
-  for (int i = 0; kLanguageTranslationTable[i].langid; ++i) {
-    if (language.CompareNoCase(kLanguageTranslationTable[i].lang) == 0) {
-      return true;
-    }
-  }
-
-  return false;
-}
-
-void GetSupportedLanguages(std::vector<CString>* codes) {
-  ASSERT1(codes);
-  std::set<CString> languages;
-
-  for (int i = 0; kLanguageTranslationTable[i].langid; ++i) {
-    languages.insert(CString(kLanguageTranslationTable[i].lang));
-  }
-
-  for (std::set<CString>::const_iterator it = languages.begin();
-       it != languages.end();
-       ++it) {
-    codes->push_back(*it);
-  }
-}
-
-// Returns user default language if requested language is not supported.
-CString GetLanguageForProcess(const CString& requested_language) {
-  if (!requested_language.IsEmpty() &&
-      IsLanguageSupported(requested_language)) {
-    return requested_language;
-  }
-
-  return GetDefaultLanguage(false);
-}
-
-CString GetWrittenLanguage(const CString& requested_language) {
-  CString written_language(requested_language);
-
-  // Handle specific special cases
-  // * Chinese (Hong Kong) - separate language but uses the zh-TW as written
-  //   language.
-  // * Hebrew synonyms - convert he to iw.
-  if (!requested_language.CompareNoCase(_T("zh-HK"))) {
-    written_language = _T("zh-TW");
-  } else if (!requested_language.CompareNoCase(_T("he"))) {
-    written_language = _T("iw");
-  }
-
-  ASSERT1(IsLanguageSupported(written_language));
-  return written_language;
-}
-
-bool DoesSupportedLanguageUseDifferentId(const CString& requested_language) {
-  return (requested_language.CompareNoCase(_T("zh-HK")) == 0);
-}
-
-}  // namespace lang
-
-}  // namespace omaha
diff --git a/common/lang.h b/common/lang.h
deleted file mode 100644
index 83cb8a9..0000000
--- a/common/lang.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_LANG_H_
-#define OMAHA_COMMON_LANG_H_
-
-#include <atlstr.h>
-#include <map>
-#include <vector>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-namespace lang {
-
-CString GetDefaultLanguage(bool is_system);
-LANGID GetDefaultLanguageID(bool is_system);
-
-CString GetLanguageForLangID(LANGID langid);
-
-bool IsLanguageIDSupported(LANGID langid);
-bool IsLanguageSupported(const CString& language);
-void GetSupportedLanguages(std::vector<CString>* codes);
-
-// Returnes requested_language if supported. Otherwise returns current user's
-// language if supported or "en" if both of them are not supported.
-CString GetLanguageForProcess(const CString& requested_language);
-
-// Returns the written language name for a given language. For most languages,
-// the names are exactly same. There are very few exceptions. For example, the
-// written language of zh-HK is zh-TW.
-CString GetWrittenLanguage(const CString& requested_language);
-
-// Returns whether a language and its corresponding supported language have
-// different names.
-bool DoesSupportedLanguageUseDifferentId(const CString& requested_language);
-
-}  // namespace lang
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_LANG_H_
diff --git a/common/lang_unittest.cc b/common/lang_unittest.cc
deleted file mode 100644
index 10c1582..0000000
--- a/common/lang_unittest.cc
+++ /dev/null
@@ -1,250 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-#include <map>
-#include <vector>
-#include "omaha/base/app_util.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/file.h"
-#include "omaha/base/path.h"
-#include "omaha/base/string.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/lang.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-const int kNumberOfLanguages = 56;
-
-}  // namespace
-
-class LanguageManagerTest : public testing::Test {
- protected:
-  CString GetLang(LANGID langid) {
-    return lang::GetLanguageForLangID(langid);
-  }
-};
-
-TEST_F(LanguageManagerTest, GetLanguageForLangID_NoLangID) {
-  EXPECT_STREQ(_T("en"), lang::GetLanguageForLangID(0xFFFF));
-}
-
-TEST_F(LanguageManagerTest, IsLanguageSupported) {
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("en")));
-
-  EXPECT_FALSE(lang::IsLanguageSupported(_T("")));
-  EXPECT_FALSE(lang::IsLanguageSupported(_T("non-existing lang")));
-  EXPECT_FALSE(lang::IsLanguageSupported(_T("en-US")));
-}
-
-TEST_F(LanguageManagerTest, GetLanguageForLangID_SupportedIds) {
-  EXPECT_STREQ(_T("am"), GetLang(MAKELANGID(LANG_AMHARIC, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("ar"), GetLang(MAKELANGID(LANG_ARABIC, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("bg"), GetLang(MAKELANGID(LANG_BULGARIAN, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("ca"), GetLang(MAKELANGID(LANG_CATALAN, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("cs"), GetLang(MAKELANGID(LANG_CZECH, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("da"), GetLang(MAKELANGID(LANG_DANISH, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("de"), GetLang(MAKELANGID(LANG_GERMAN, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("el"), GetLang(MAKELANGID(LANG_GREEK, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("en"), GetLang(MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("en-GB"), GetLang(MAKELANGID(LANG_ENGLISH,
-                                               SUBLANG_ENGLISH_UK)));
-  EXPECT_STREQ(_T("es"), GetLang(MAKELANGID(LANG_SPANISH,
-                                            SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("es"), GetLang(MAKELANGID(LANG_SPANISH,
-                                            SUBLANG_SPANISH)));
-  EXPECT_STREQ(_T("es-419"), GetLang(MAKELANGID(LANG_SPANISH,
-                                                SUBLANG_SPANISH_MEXICAN)));
-  EXPECT_STREQ(_T("es"), GetLang(MAKELANGID(LANG_SPANISH,
-                                            SUBLANG_SPANISH_MODERN)));
-  EXPECT_STREQ(_T("es-419"), GetLang(MAKELANGID(LANG_SPANISH,
-                                                SUBLANG_SPANISH_GUATEMALA)));
-  EXPECT_STREQ(_T("es-419"), GetLang(MAKELANGID(LANG_SPANISH,
-                                                SUBLANG_SPANISH_COSTA_RICA)));
-  EXPECT_STREQ(_T("es-419"), GetLang(MAKELANGID(LANG_SPANISH,
-                                                SUBLANG_SPANISH_PANAMA)));
-  EXPECT_STREQ(_T("es-419"), GetLang(MAKELANGID(
-      LANG_SPANISH,
-      SUBLANG_SPANISH_DOMINICAN_REPUBLIC)));
-  EXPECT_STREQ(_T("es-419"), GetLang(MAKELANGID(LANG_SPANISH,
-                                                SUBLANG_SPANISH_VENEZUELA)));
-  EXPECT_STREQ(_T("es-419"), GetLang(MAKELANGID(LANG_SPANISH,
-                                                SUBLANG_SPANISH_COLOMBIA)));
-  EXPECT_STREQ(_T("es-419"), GetLang(MAKELANGID(LANG_SPANISH,
-                                                SUBLANG_SPANISH_PERU)));
-  EXPECT_STREQ(_T("es-419"), GetLang(MAKELANGID(LANG_SPANISH,
-                                                SUBLANG_SPANISH_ARGENTINA)));
-  EXPECT_STREQ(_T("es-419"), GetLang(MAKELANGID(LANG_SPANISH,
-                                                SUBLANG_SPANISH_ECUADOR)));
-  EXPECT_STREQ(_T("es-419"), GetLang(MAKELANGID(LANG_SPANISH,
-                                                SUBLANG_SPANISH_CHILE)));
-  EXPECT_STREQ(_T("es-419"), GetLang(MAKELANGID(LANG_SPANISH,
-                                                SUBLANG_SPANISH_URUGUAY)));
-  EXPECT_STREQ(_T("es-419"), GetLang(MAKELANGID(LANG_SPANISH,
-                                                SUBLANG_SPANISH_PARAGUAY)));
-  EXPECT_STREQ(_T("es-419"), GetLang(MAKELANGID(LANG_SPANISH,
-                                                SUBLANG_SPANISH_BOLIVIA)));
-  EXPECT_STREQ(_T("es-419"), GetLang(MAKELANGID(LANG_SPANISH,
-                                                SUBLANG_SPANISH_EL_SALVADOR)));
-  EXPECT_STREQ(_T("es-419"), GetLang(MAKELANGID(LANG_SPANISH,
-                                                SUBLANG_SPANISH_HONDURAS)));
-  EXPECT_STREQ(_T("es-419"), GetLang(MAKELANGID(LANG_SPANISH,
-                                                SUBLANG_SPANISH_NICARAGUA)));
-  EXPECT_STREQ(_T("es-419"), GetLang(MAKELANGID(LANG_SPANISH,
-                                                SUBLANG_SPANISH_PUERTO_RICO)));
-  EXPECT_STREQ(_T("et"), GetLang(MAKELANGID(LANG_ESTONIAN,
-                                            SUBLANG_ESTONIAN_ESTONIA)));
-  EXPECT_STREQ(_T("fi"), GetLang(MAKELANGID(LANG_FINNISH, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("fil"), GetLang(MAKELANGID(LANG_FILIPINO, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("fr"), GetLang(MAKELANGID(LANG_FRENCH, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("hi"), GetLang(MAKELANGID(LANG_HINDI, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("hr"), GetLang(MAKELANGID(LANG_CROATIAN, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("hr"), GetLang(MAKELANGID(LANG_SERBIAN,
-                                            SUBLANG_SERBIAN_CROATIA)));
-  EXPECT_STREQ(_T("hu"), GetLang(MAKELANGID(LANG_HUNGARIAN, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("id"), GetLang(MAKELANGID(LANG_INDONESIAN, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("it"), GetLang(MAKELANGID(LANG_ITALIAN, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("iw"), GetLang(MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("ja"), GetLang(MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("ko"), GetLang(MAKELANGID(LANG_KOREAN, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("lt"), GetLang(MAKELANGID(LANG_LITHUANIAN, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("lv"), GetLang(MAKELANGID(LANG_LATVIAN, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("nl"), GetLang(MAKELANGID(LANG_DUTCH, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("no"), GetLang(MAKELANGID(LANG_NORWEGIAN, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("pl"), GetLang(MAKELANGID(LANG_POLISH, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("pt-BR"), GetLang(MAKELANGID(LANG_PORTUGUESE,
-                                               SUBLANG_PORTUGUESE_BRAZILIAN)));
-  EXPECT_STREQ(_T("pt-PT"), GetLang(MAKELANGID(LANG_PORTUGUESE,
-                                               SUBLANG_PORTUGUESE)));
-  EXPECT_STREQ(_T("ro"), GetLang(MAKELANGID(LANG_ROMANIAN, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("ru"), GetLang(MAKELANGID(LANG_RUSSIAN, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("sk"), GetLang(MAKELANGID(LANG_SLOVAK, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("sl"), GetLang(MAKELANGID(LANG_SLOVENIAN, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("sr"), GetLang(
-      MAKELANGID(LANG_SERBIAN, SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC)));
-  EXPECT_STREQ(_T("sr"), GetLang(
-      MAKELANGID(LANG_SERBIAN, SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN)));
-  EXPECT_STREQ(_T("sr"), GetLang(MAKELANGID(LANG_SERBIAN,
-                                            SUBLANG_SERBIAN_CYRILLIC)));
-  EXPECT_STREQ(_T("sr"), GetLang(MAKELANGID(LANG_SERBIAN,
-                                            SUBLANG_SERBIAN_LATIN)));
-  EXPECT_STREQ(_T("sv"), GetLang(MAKELANGID(LANG_SWEDISH, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("sw"), GetLang(MAKELANGID(LANG_SWAHILI, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("th"), GetLang(MAKELANGID(LANG_THAI, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("tr"), GetLang(MAKELANGID(LANG_TURKISH, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("uk"), GetLang(MAKELANGID(LANG_UKRAINIAN, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("vi"), GetLang(MAKELANGID(LANG_VIETNAMESE, SUBLANG_DEFAULT)));
-  EXPECT_STREQ(_T("zh-HK"), GetLang(MAKELANGID(LANG_CHINESE,
-                                               SUBLANG_CHINESE_HONGKONG)));
-  EXPECT_STREQ(_T("zh-TW"), GetLang(MAKELANGID(LANG_CHINESE,
-                                               SUBLANG_CHINESE_MACAU)));
-  EXPECT_STREQ(_T("zh-CN"), GetLang(MAKELANGID(LANG_CHINESE,
-                                               SUBLANG_CHINESE_SIMPLIFIED)));
-  EXPECT_STREQ(_T("zh-CN"), GetLang(MAKELANGID(LANG_CHINESE,
-                                               SUBLANG_CHINESE_SINGAPORE)));
-  EXPECT_STREQ(_T("zh-TW"), GetLang(MAKELANGID(LANG_CHINESE,
-                                               SUBLANG_CHINESE_TRADITIONAL)));
-}
-
-// Unsupported languages and sublanguages fall back to "en".
-TEST_F(LanguageManagerTest, GetLanguageForLangID_UnsupportedSubLang) {
-  // LANG_NEUTRAL is unsupported.
-  EXPECT_STREQ(_T("en"), GetLang(MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)));
-  // LANG_AFRIKAANS is unsupported.
-  EXPECT_STREQ(_T("en"), GetLang(MAKELANGID(LANG_AFRIKAANS, SUBLANG_NEUTRAL)));
-  // SUBLANG_NEUTRAL is unsupported.
-  EXPECT_STREQ(_T("en"), GetLang(MAKELANGID(LANG_SPANISH, SUBLANG_NEUTRAL)));
-  // SUBLANG_SYS_DEFAULT is unsupported. It happens to be 2, which is not
-  // supported for Hungarian but is for English, Spanish, and others/
-  EXPECT_STREQ(_T("en"),
-               GetLang(MAKELANGID(LANG_HUNGARIAN, SUBLANG_SYS_DEFAULT)));
-  EXPECT_STREQ(_T("es-419"),
-               GetLang(MAKELANGID(LANG_SPANISH, SUBLANG_SYS_DEFAULT)));
-  // 0x3f is an invalid sublang. There is a "es" file.
-  EXPECT_STREQ(_T("en"), GetLang(MAKELANGID(LANG_SPANISH, 0x3f)));
-  // 0x3f is an invalid sublang. There is not a "zh" file.
-  EXPECT_STREQ(_T("en"), GetLang(MAKELANGID(LANG_CHINESE, 0x3f)));
-}
-
-TEST_F(LanguageManagerTest, TestCountLanguagesInTranslationTable) {
-  std::vector<CString> languages;
-  lang::GetSupportedLanguages(&languages);
-  EXPECT_EQ(kNumberOfLanguages, languages.size());
-}
-
-TEST_F(LanguageManagerTest, TestAppropriateLanguagesInTranslationTable) {
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("am")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("ar")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("bg")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("bn")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("ca")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("cs")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("da")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("de")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("el")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("en-GB")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("en")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("es-419")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("es")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("et")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("fa")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("fi")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("fil")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("fr")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("gu")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("hi")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("hr")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("hu")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("id")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("is")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("it")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("iw")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("ja")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("kn")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("ko")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("lt")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("lv")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("ml")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("mr")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("ms")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("nl")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("no")));
-  EXPECT_FALSE(lang::IsLanguageSupported(_T("or")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("pl")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("pt-BR")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("pt-PT")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("ro")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("ru")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("sk")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("sl")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("sr")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("sv")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("sw")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("ta")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("te")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("th")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("tr")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("uk")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("ur")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("vi")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("zh-CN")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("zh-HK")));
-  EXPECT_TRUE(lang::IsLanguageSupported(_T("zh-TW")));
-}
-
-}  // namespace omaha
diff --git a/common/oem_install_utils.cc b/common/oem_install_utils.cc
deleted file mode 100644
index 1358dfe..0000000
--- a/common/oem_install_utils.cc
+++ /dev/null
@@ -1,120 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-//
-// *** Documentation for OEM Installs ***
-//
-// A /oem install requires:
-//  * Per-machine install
-//  * Running as admin
-//  * Running in Windows audit mode (ConfigManager::IsWindowsInstalling())
-//  * Offline installer (determined in LaunchHandoffProcess())
-//
-// If the first three conditions are met, SetOemInstallState() writes the
-// OemInstallTime registry value, which is used by IsOemInstalling() along with
-// other logic to determine whether Omaha is running in an OEM install
-// environment. Other objects use IsOemInstalling() - not
-// ConfigureManager::IsWindowsInstalling() - to determine whether to run in a
-// disabled mode for OEM factory installations. For example, the core exits
-// immediately without checking for updates or Code Red events, no instances
-// ping, and persistent IDs are not saved.
-
-#include "omaha/common/oem_install_utils.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/time.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/goopdate_utils.h"
-
-namespace omaha {
-
-namespace oem_install_utils {
-
-HRESULT SetOemInstallState(bool is_machine) {
-  bool is_windows_installing = ConfigManager::Instance()->IsWindowsInstalling();
-  if (!is_machine || !vista_util::IsUserAdmin() || !is_windows_installing) {
-    return GOOPDATE_E_OEM_NOT_MACHINE_AND_PRIVILEGED_AND_AUDIT_MODE;
-  }
-
-  const DWORD now = Time64ToInt32(GetCurrent100NSTime());
-
-  OPT_LOG(L1, (_T("[Beginning OEM install][%u]"), now));
-
-  goopdate_utils::DeleteUserId(is_machine);
-
-  return RegKey::SetValue(
-      ConfigManager::Instance()->machine_registry_update(),
-      kRegValueOemInstallTimeSec,
-      now);
-}
-
-HRESULT ResetOemInstallState(bool is_machine) {
-  if (!is_machine) {
-    return E_INVALIDARG;
-  }
-
-  OPT_LOG(L1, (_T("[Reset OEM install state][%u]"),
-      Time64ToInt32(GetCurrent100NSTime())));
-
-  HRESULT hr = RegKey::DeleteValue(
-      ConfigManager::Instance()->machine_registry_update(),
-      kRegValueOemInstallTimeSec);
-
-  return hr;
-}
-
-// Always returns false if !is_machine. This prevents ever blocking per-user
-// instances.
-// Returns true if OEM install time is present and it has been less than
-// kMinOemModeSec since the OEM install.
-// Non-OEM installs can never be blocked from updating because OEM install time
-// will not be present.
-bool IsOemInstalling(bool is_machine) {
-  if (!is_machine) {
-    return false;
-  }
-
-  DWORD oem_install_time_seconds = 0;
-  if (FAILED(RegKey::GetValue(MACHINE_REG_UPDATE,
-                              kRegValueOemInstallTimeSec,
-                              &oem_install_time_seconds))) {
-    CORE_LOG(L3, (_T("[IsOemInstalling][OemInstallTime not found]")));
-    return false;
-  }
-
-  const uint32 now_seconds = Time64ToInt32(GetCurrent100NSTime());
-  if (now_seconds < oem_install_time_seconds) {
-    CORE_LOG(LW, (_T("[possible time warp detected][now %u][last checked %u]"),
-                  now_seconds, oem_install_time_seconds));
-  }
-  const int time_difference_seconds =
-      abs(static_cast<int>(now_seconds - oem_install_time_seconds));
-
-  ASSERT1(0 <= time_difference_seconds);
-  const bool result = time_difference_seconds < kMinOemModeSec ? true : false;
-
-  CORE_LOG(L3, (_T("[now %u][OEM install time %u][time difference %u][%d]"),
-                now_seconds, oem_install_time_seconds, time_difference_seconds,
-                result));
-  return result;
-}
-
-}  // namespace oem_install_utils
-
-}  // namespace omaha
diff --git a/common/oem_install_utils.h b/common/oem_install_utils.h
deleted file mode 100644
index 2ff0953..0000000
--- a/common/oem_install_utils.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_OEM_INSTALL_UTILS_H_
-#define OMAHA_COMMON_OEM_INSTALL_UTILS_H_
-
-#include <windows.h>
-
-namespace omaha {
-
-namespace oem_install_utils {
-
-// Writes OEM install beginning timestamp in the registry.
-HRESULT SetOemInstallState(bool is_machine);
-
-// Removes OEM install beginning timestamp from the registry.
-HRESULT ResetOemInstallState(bool is_machine);
-
-// Returns true if running in the context of an OEM install.
-bool IsOemInstalling(bool is_machine);
-
-}  // namespace oem_install_utils
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_OEM_INSTALL_UTILS_H_
diff --git a/common/oem_install_utils_test.cc b/common/oem_install_utils_test.cc
deleted file mode 100644
index 5dfde4f..0000000
--- a/common/oem_install_utils_test.cc
+++ /dev/null
@@ -1,458 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/string.h"
-#include "omaha/base/time.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/oem_install_utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-const TCHAR* const kVistaSetupStateKey =
-    _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State");
-const TCHAR* const kXpSystemSetupKey = _T("HKLM\\System\\Setup");
-
-}  // namespace
-
-class OemInstallTest : public testing::Test {
- protected:
-  OemInstallTest() : cm_(ConfigManager::Instance()) {
-  }
-
-  virtual void SetUp() {
-    RegKey::DeleteKey(kRegistryHiveOverrideRoot, true);
-    OverrideRegistryHives(kRegistryHiveOverrideRoot);
-  }
-
-  virtual void TearDown() {
-    RestoreRegistryHives();
-    EXPECT_SUCCEEDED(RegKey::DeleteKey(kRegistryHiveOverrideRoot, true));
-  }
-
-  ConfigManager* cm_;
-};
-
-class AuditModeTest : public OemInstallTest {
- protected:
-  virtual void SetUp() {
-    OemInstallTest::SetUp();
-
-    if (vista_util::IsVistaOrLater()) {
-      EXPECT_SUCCEEDED(RegKey::SetValue(kVistaSetupStateKey,
-                                        _T("ImageState"),
-                                        _T("IMAGE_STATE_UNDEPLOYABLE")));
-    } else {
-      EXPECT_SUCCEEDED(RegKey::SetValue(kXpSystemSetupKey,
-                                        _T("AuditInProgress"),
-                                        static_cast<DWORD>(1)));
-    }
-
-    EXPECT_TRUE(ConfigManager::Instance()->IsWindowsInstalling());
-  }
-};
-
-TEST_F(OemInstallTest, SetOemInstallState_User) {
-  EXPECT_EQ(GOOPDATE_E_OEM_NOT_MACHINE_AND_PRIVILEGED_AND_AUDIT_MODE,
-            oem_install_utils::SetOemInstallState(false));
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, kRegValueOemInstallTimeSec));
-  EXPECT_FALSE(
-      RegKey::HasValue(MACHINE_REG_UPDATE, kRegValueOemInstallTimeSec));
-}
-
-TEST_F(AuditModeTest, SetOemInstallState_User) {
-  EXPECT_EQ(GOOPDATE_E_OEM_NOT_MACHINE_AND_PRIVILEGED_AND_AUDIT_MODE,
-            oem_install_utils::SetOemInstallState(false));
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, kRegValueOemInstallTimeSec));
-  EXPECT_FALSE(
-      RegKey::HasValue(MACHINE_REG_UPDATE, kRegValueOemInstallTimeSec));
-}
-
-TEST_F(OemInstallTest, SetOemInstallState_Machine) {
-  if (!vista_util::IsUserAdmin()) {
-    std::wcout << _T("\tTest did not cover expected path because not an admin.")
-               << std::endl;
-  }
-  EXPECT_EQ(GOOPDATE_E_OEM_NOT_MACHINE_AND_PRIVILEGED_AND_AUDIT_MODE,
-            oem_install_utils::SetOemInstallState(true));
-  EXPECT_FALSE(
-      RegKey::HasValue(MACHINE_REG_UPDATE, kRegValueOemInstallTimeSec));
-}
-
-TEST_F(AuditModeTest, SetOemInstallState_Machine) {
-  if (!vista_util::IsUserAdmin()) {
-    std::wcout << _T("\tTest did not run because the user is not an admin.")
-               << std::endl;
-    return;
-  }
-  EXPECT_SUCCEEDED(oem_install_utils::SetOemInstallState(true));
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  EXPECT_TRUE(RegKey::HasValue(MACHINE_REG_UPDATE, kRegValueOemInstallTimeSec));
-  const uint32 install_time = GetDwordValue(MACHINE_REG_UPDATE,
-                                            kRegValueOemInstallTimeSec);
-  EXPECT_GE(now, install_time);
-  EXPECT_GE(static_cast<uint32>(200), now - install_time);
-
-  EXPECT_TRUE(oem_install_utils::IsOemInstalling(true));
-  EXPECT_SUCCEEDED(oem_install_utils::ResetOemInstallState(true));
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE,
-                                kRegValueOemInstallTimeSec));
-  EXPECT_FALSE(oem_install_utils::IsOemInstalling(true));
-}
-
-TEST_F(AuditModeTest, SetOemInstallState_Machine_NeedsElevation) {
-  if (vista_util::IsUserAdmin()) {
-    std::wcout << _T("\tTest did not run because the user IS an admin.")
-               << std::endl;
-    return;
-  }
-
-  EXPECT_EQ(GOOPDATE_E_OEM_NOT_MACHINE_AND_PRIVILEGED_AND_AUDIT_MODE,
-            oem_install_utils::SetOemInstallState(true));
-  EXPECT_FALSE(
-      RegKey::HasValue(MACHINE_REG_UPDATE, kRegValueOemInstallTimeSec));
-}
-
-//
-// IsOemInstalling tests.
-//
-
-TEST_F(OemInstallTest, IsOemInstalling_Machine_Normal) {
-  EXPECT_FALSE(oem_install_utils::IsOemInstalling(true));
-}
-
-TEST_F(OemInstallTest, IsOemInstalling_User_Normal) {
-  EXPECT_FALSE(oem_install_utils::IsOemInstalling(false));
-}
-
-TEST_F(OemInstallTest,
-       IsOemInstalling_Machine_OemInstallTimeNow_NotAuditMode) {
-  const DWORD now_seconds = Time64ToInt32(GetCurrent100NSTime());
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("OemInstallTime"),
-                                    now_seconds));
-
-  EXPECT_TRUE(oem_install_utils::IsOemInstalling(true));
-}
-
-TEST_F(OemInstallTest, IsOemInstalling_Machine_OemInstallTimeNow_AuditMode) {
-  const DWORD now_seconds = Time64ToInt32(GetCurrent100NSTime());
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("OemInstallTime"),
-                                    now_seconds));
-
-  if (vista_util::IsVistaOrLater()) {
-    EXPECT_SUCCEEDED(RegKey::SetValue(
-        _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-        _T("ImageState"),
-        _T("IMAGE_STATE_UNDEPLOYABLE")));
-  } else {
-    EXPECT_SUCCEEDED(RegKey::SetValue(_T("HKLM\\System\\Setup"),
-                                      _T("AuditInProgress"),
-                                      static_cast<DWORD>(1)));
-  }
-  EXPECT_TRUE(cm_->IsWindowsInstalling());
-
-  EXPECT_TRUE(oem_install_utils::IsOemInstalling(true));
-}
-
-TEST_F(OemInstallTest,
-       IsOemInstalling_Machine_OemInstallTime71HoursAgo_NotAuditMode) {
-  const DWORD kDesiredDifferenceSeconds = 71 * 60 * 60;  // 71 hours.
-  const DWORD now_seconds = Time64ToInt32(GetCurrent100NSTime());
-  EXPECT_GT(now_seconds, kDesiredDifferenceSeconds);
-  const DWORD install_time_seconds = now_seconds - kDesiredDifferenceSeconds;
-  EXPECT_LT(install_time_seconds, now_seconds);
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("OemInstallTime"),
-                                    install_time_seconds));
-
-  EXPECT_TRUE(oem_install_utils::IsOemInstalling(true));
-}
-
-TEST_F(OemInstallTest,
-       IsOemInstalling_Machine_OemInstallTime71HoursAgo_AuditMode) {
-  const DWORD kDesiredDifferenceSeconds = 71 * 60 * 60;  // 71 hours.
-  const DWORD now_seconds = Time64ToInt32(GetCurrent100NSTime());
-  EXPECT_GT(now_seconds, kDesiredDifferenceSeconds);
-  const DWORD install_time_seconds = now_seconds - kDesiredDifferenceSeconds;
-  EXPECT_LT(install_time_seconds, now_seconds);
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("OemInstallTime"),
-                                    install_time_seconds));
-
-  if (vista_util::IsVistaOrLater()) {
-    EXPECT_SUCCEEDED(RegKey::SetValue(
-        _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-        _T("ImageState"),
-        _T("IMAGE_STATE_UNDEPLOYABLE")));
-  } else {
-    EXPECT_SUCCEEDED(RegKey::SetValue(_T("HKLM\\System\\Setup"),
-                                      _T("AuditInProgress"),
-                                      static_cast<DWORD>(1)));
-  }
-  EXPECT_TRUE(cm_->IsWindowsInstalling());
-
-  EXPECT_TRUE(oem_install_utils::IsOemInstalling(true));
-}
-
-TEST_F(OemInstallTest,
-       IsOemInstalling_Machine_OemInstallTime73HoursAgo_NotAuditMode) {
-  const DWORD kDesiredDifferenceSeconds = 73 * 60 * 60;  // 73 hours.
-  const DWORD now_seconds = Time64ToInt32(GetCurrent100NSTime());
-  EXPECT_GT(now_seconds, kDesiredDifferenceSeconds);
-  const DWORD install_time_seconds = now_seconds - kDesiredDifferenceSeconds;
-  EXPECT_LT(install_time_seconds, now_seconds);
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("OemInstallTime"),
-                                    install_time_seconds));
-
-  EXPECT_FALSE(oem_install_utils::IsOemInstalling(true));
-}
-
-TEST_F(OemInstallTest,
-       IsOemInstalling_Machine_OemInstallTime73HoursAgo_AuditMode) {
-  const DWORD kDesiredDifferenceSeconds = 73 * 60 * 60;  // 73 hours.
-  const DWORD now_seconds = Time64ToInt32(GetCurrent100NSTime());
-  EXPECT_GT(now_seconds, kDesiredDifferenceSeconds);
-  const DWORD install_time_seconds = now_seconds - kDesiredDifferenceSeconds;
-  EXPECT_LT(install_time_seconds, now_seconds);
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("OemInstallTime"),
-                                    install_time_seconds));
-
-  if (vista_util::IsVistaOrLater()) {
-    EXPECT_SUCCEEDED(RegKey::SetValue(
-        _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-        _T("ImageState"),
-        _T("IMAGE_STATE_UNDEPLOYABLE")));
-  } else {
-    EXPECT_SUCCEEDED(RegKey::SetValue(_T("HKLM\\System\\Setup"),
-                                      _T("AuditInProgress"),
-                                      static_cast<DWORD>(1)));
-  }
-  EXPECT_TRUE(cm_->IsWindowsInstalling());
-
-  EXPECT_FALSE(oem_install_utils::IsOemInstalling(true));
-}
-
-TEST_F(OemInstallTest,
-       IsOemInstalling_Machine_OemInstallTime71HoursInFuture_NotAuditMode) {
-  const DWORD kDesiredDifferenceSeconds = 71 * 60 * 60;  // 71 hours.
-  const DWORD now_seconds = Time64ToInt32(GetCurrent100NSTime());
-  const DWORD install_time_seconds = now_seconds + kDesiredDifferenceSeconds;
-  EXPECT_GT(install_time_seconds, now_seconds);
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("OemInstallTime"),
-                                    install_time_seconds));
-
-  EXPECT_TRUE(oem_install_utils::IsOemInstalling(true));
-}
-
-TEST_F(OemInstallTest,
-       IsOemInstalling_Machine_OemInstallTime71HoursInFuture_AuditMode) {
-  const DWORD kDesiredDifferenceSeconds = 71 * 60 * 60;  // 71 hours.
-  const DWORD now_seconds = Time64ToInt32(GetCurrent100NSTime());
-  const DWORD install_time_seconds = now_seconds + kDesiredDifferenceSeconds;
-  EXPECT_GT(install_time_seconds, now_seconds);
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("OemInstallTime"),
-                                    install_time_seconds));
-
-  if (vista_util::IsVistaOrLater()) {
-    EXPECT_SUCCEEDED(RegKey::SetValue(
-        _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-        _T("ImageState"),
-        _T("IMAGE_STATE_UNDEPLOYABLE")));
-  } else {
-    EXPECT_SUCCEEDED(RegKey::SetValue(_T("HKLM\\System\\Setup"),
-                                      _T("AuditInProgress"),
-                                      static_cast<DWORD>(1)));
-  }
-  EXPECT_TRUE(cm_->IsWindowsInstalling());
-
-  EXPECT_TRUE(oem_install_utils::IsOemInstalling(true));
-}
-
-TEST_F(OemInstallTest,
-       IsOemInstalling_Machine_OemInstallTime73HoursInFuture_NotAuditMode) {
-  const DWORD kDesiredDifferenceSeconds = 73 * 60 * 60;  // 73 hours.
-  const DWORD now_seconds = Time64ToInt32(GetCurrent100NSTime());
-  const DWORD install_time_seconds = now_seconds + kDesiredDifferenceSeconds;
-  EXPECT_GT(install_time_seconds, now_seconds);
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("OemInstallTime"),
-                                    install_time_seconds));
-
-  EXPECT_FALSE(oem_install_utils::IsOemInstalling(true));
-}
-
-TEST_F(OemInstallTest,
-       IsOemInstalling_Machine_OemInstallTime73HoursInFuture_AuditMode) {
-  const DWORD kDesiredDifferenceSeconds = 73 * 60 * 60;  // 73 hours.
-  const DWORD now_seconds = Time64ToInt32(GetCurrent100NSTime());
-  const DWORD install_time_seconds = now_seconds + kDesiredDifferenceSeconds;
-  EXPECT_GT(install_time_seconds, now_seconds);
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("OemInstallTime"),
-                                    install_time_seconds));
-
-  if (vista_util::IsVistaOrLater()) {
-    EXPECT_SUCCEEDED(RegKey::SetValue(
-        _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-        _T("ImageState"),
-        _T("IMAGE_STATE_UNDEPLOYABLE")));
-  } else {
-    EXPECT_SUCCEEDED(RegKey::SetValue(_T("HKLM\\System\\Setup"),
-                                      _T("AuditInProgress"),
-                                      static_cast<DWORD>(1)));
-  }
-  EXPECT_TRUE(cm_->IsWindowsInstalling());
-
-  EXPECT_FALSE(oem_install_utils::IsOemInstalling(true));
-}
-
-TEST_F(OemInstallTest,
-       IsOemInstalling_Machine_OemInstallTimeZero_NotAuditMode) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("OemInstallTime"),
-                                    static_cast<DWORD>(0)));
-
-  EXPECT_FALSE(oem_install_utils::IsOemInstalling(true));
-}
-
-TEST_F(OemInstallTest,
-       IsOemInstalling_Machine_OemInstallTimeZero_AuditMode) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("OemInstallTime"),
-                                    static_cast<DWORD>(0)));
-
-  if (vista_util::IsVistaOrLater()) {
-    EXPECT_SUCCEEDED(RegKey::SetValue(
-        _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-        _T("ImageState"),
-        _T("IMAGE_STATE_UNDEPLOYABLE")));
-  } else {
-    EXPECT_SUCCEEDED(RegKey::SetValue(_T("HKLM\\System\\Setup"),
-                                      _T("AuditInProgress"),
-                                      static_cast<DWORD>(1)));
-  }
-  EXPECT_TRUE(cm_->IsWindowsInstalling());
-
-  EXPECT_FALSE(oem_install_utils::IsOemInstalling(true));
-}
-
-TEST_F(OemInstallTest,
-       IsOemInstalling_Machine_OemInstallTimeWrongType_NotAuditMode) {
-  const uint32 now_seconds = Time64ToInt32(GetCurrent100NSTime());
-  const CString now_string = itostr(now_seconds);
-  EXPECT_FALSE(now_string.IsEmpty());
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("OemInstallTime"),
-                                    now_string));
-
-  EXPECT_FALSE(oem_install_utils::IsOemInstalling(true));
-}
-
-TEST_F(OemInstallTest,
-       IsOemInstalling_Machine_OemInstallTimeWrongType_AuditMode) {
-  const uint32 now_seconds = Time64ToInt32(GetCurrent100NSTime());
-  const CString now_string = itostr(now_seconds);
-  EXPECT_FALSE(now_string.IsEmpty());
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("OemInstallTime"),
-                                    now_string));
-
-  if (vista_util::IsVistaOrLater()) {
-    EXPECT_SUCCEEDED(RegKey::SetValue(
-        _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-        _T("ImageState"),
-        _T("IMAGE_STATE_UNDEPLOYABLE")));
-  } else {
-    EXPECT_SUCCEEDED(RegKey::SetValue(_T("HKLM\\System\\Setup"),
-                                      _T("AuditInProgress"),
-                                      static_cast<DWORD>(1)));
-  }
-  EXPECT_TRUE(cm_->IsWindowsInstalling());
-
-  EXPECT_FALSE(oem_install_utils::IsOemInstalling(true));
-}
-
-TEST_F(OemInstallTest, IsOemInstalling_Machine_NoOemInstallTime_AuditMode) {
-  if (vista_util::IsVistaOrLater()) {
-    EXPECT_SUCCEEDED(RegKey::SetValue(
-        _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-        _T("ImageState"),
-        _T("IMAGE_STATE_UNDEPLOYABLE")));
-  } else {
-    EXPECT_SUCCEEDED(RegKey::SetValue(_T("HKLM\\System\\Setup"),
-                                      _T("AuditInProgress"),
-                                      static_cast<DWORD>(1)));
-  }
-  EXPECT_TRUE(cm_->IsWindowsInstalling());
-
-  EXPECT_FALSE(oem_install_utils::IsOemInstalling(true));
-}
-
-TEST_F(OemInstallTest,
-       IsOemInstalling_User_OemInstallTimeNow_NotAuditMode) {
-  const DWORD now_seconds = Time64ToInt32(GetCurrent100NSTime());
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("OemInstallTime"),
-                                    now_seconds));
-
-  EXPECT_FALSE(oem_install_utils::IsOemInstalling(false));
-}
-
-TEST_F(OemInstallTest, IsOemInstalling_User_OemInstallTimeNow_AuditMode) {
-  const DWORD now_seconds = Time64ToInt32(GetCurrent100NSTime());
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("OemInstallTime"),
-                                    now_seconds));
-
-  if (vista_util::IsVistaOrLater()) {
-    EXPECT_SUCCEEDED(RegKey::SetValue(
-        _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-        _T("ImageState"),
-        _T("IMAGE_STATE_UNDEPLOYABLE")));
-  } else {
-    EXPECT_SUCCEEDED(RegKey::SetValue(_T("HKLM\\System\\Setup"),
-                                      _T("AuditInProgress"),
-                                      static_cast<DWORD>(1)));
-  }
-  EXPECT_TRUE(cm_->IsWindowsInstalling());
-
-  EXPECT_FALSE(oem_install_utils::IsOemInstalling(false));
-}
-
-}  // namespace omaha
diff --git a/common/omaha_customization_unittest.cc b/common/omaha_customization_unittest.cc
deleted file mode 100644
index c28c737..0000000
--- a/common/omaha_customization_unittest.cc
+++ /dev/null
@@ -1,408 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Tests the constants that vary depending on the customization of Omaha.
-// The test checks for the Google Update variations, but can be modified for
-// your purposes.
-
-#include <tchar.h>
-#include "omaha/base/const_addresses.h"
-#include "omaha/base/const_config.h"
-#include "omaha/base/const_debug.h"
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/process.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/const_group_policy.h"
-#include "omaha/common/omaha_customization_proxy_clsid.h"
-#include "omaha/testing/omaha_customization_test.h"
-
-// TODO(omaha): Make use of EXPECT_GU_STREQ, etc.
-
-namespace omaha {
-
-TEST(OmahaCustomizationTest, Constants_BuildFiles) {
-  // Primary main.scons values.
-
-  // TODO(omaha): Most of these tests are of extremely questionable
-  // value, as they're just checking that certain #defines exist and
-  // haven't changed.  But, unanticipated changes to most of these
-  // would cause build breaks anyways!  Consider deleting them.
-#ifdef GOOGLE_UPDATE_BUILD
-  EXPECT_STREQ("Google Inc.", FULL_COMPANY_NAME_ANSI);
-  EXPECT_STREQ("Google", SHORT_COMPANY_NAME_ANSI);
-  EXPECT_STREQ("Update", PRODUCT_NAME_ANSI);
-
-  EXPECT_STREQ("google", COMPANY_DOMAIN_BASE_ANSI);
-  EXPECT_STREQ("google.com", COMPANY_DOMAIN_ANSI);
-
-  EXPECT_STREQ("Google Update", OMAHA_APP_NAME_ANSI);
-#endif  // GOOGLE_UPDATE_BUILD
-
-  EXPECT_STREQ("goopdate", MAIN_DLL_BASE_NAME_ANSI);
-
-  const GUID kActualProxyClsidIsMachineGuid = PROXY_CLSID_IS_MACHINE;
-  EXPECT_TRUE(::IsEqualGUID(kProxyClsidIsMachineGuid,
-                            kActualProxyClsidIsMachineGuid));
-
-  const GUID kActualProxyClsidIsUserGuid = PROXY_CLSID_IS_USER;
-  EXPECT_TRUE(::IsEqualGUID(kProxyClsidIsUserGuid,
-                            kActualProxyClsidIsUserGuid));
-
-  // VERSION file values. Only the relatively stable ones are tested.
-  // The versions may or may not match in non-Google Update builds.
-#ifdef GOOGLE_UPDATE_BUILD
-  EXPECT_STREQ("9", ONECLICK_PLUGIN_VERSION_ANSI);
-  // TODO(omaha): Change the name to ANSI.
-  EXPECT_STREQ("3", UPDATE_PLUGIN_VERSION_ANSI);
-#else
-  std::wcout << _T("Did not test version values.") << std::endl;
-#endif
-
-  // Primary omaha_version_utils values.
-  EXPECT_STREQ(_T("npGoogleOneClick"), ONECLICK_PLUGIN_NAME);
-  EXPECT_STREQ(_T("npGoogleUpdate"), UPDATE_PLUGIN_NAME);
-  EXPECT_STREQ(_T("GoopdateBho"), BHO_NAME);
-
-  // Filenames from omaha_version_utils.
-  EXPECT_STREQ(
-      _T("npGoogleOneClick") _T(ONECLICK_PLUGIN_VERSION_ANSI) _T(".dll"),
-      ONECLICK_PLUGIN_FILENAME);
-  EXPECT_STREQ(_T("npGoogleUpdate") _T(UPDATE_PLUGIN_VERSION_ANSI) _T(".dll"),
-               UPDATE_PLUGIN_FILENAME);
-  EXPECT_STREQ(_T("GoopdateBho.dll"), BHO_FILENAME);
-}
-
-TEST(OmahaCustomizationTest, Constants_Names) {
-  // Company and product names.
-
-  // TODO(omaha): Most of these tests are of extremely questionable
-  // value, as they're just checking that certain #defines exist and
-  // haven't changed.  But, unanticipated changes to most of these
-  // would cause build breaks anyways!  Consider deleting them.
-#ifdef GOOGLE_UPDATE_BUILD
-  EXPECT_STREQ(_T("Google Inc."), kFullCompanyName);
-  EXPECT_STREQ(_T("Google"), SHORT_COMPANY_NAME);
-  EXPECT_STREQ(_T("Google"), kShortCompanyName);
-  EXPECT_STREQ(_T("Update"), PRODUCT_NAME);
-
-  EXPECT_STREQ(_T("google.com"), COMPANY_DOMAIN);
-
-  // Full app name.
-  EXPECT_STREQ(_T("Google Update"), kAppName);
-
-  // Identifiers.
-  EXPECT_STREQ(_T("Google"), COMPANY_NAME_IDENTIFIER);
-  EXPECT_STREQ(_T("Update"), PRODUCT_NAME_IDENTIFIER);
-  EXPECT_STREQ(_T("GoogleUpdate"), APP_NAME_IDENTIFIER);
-
-  // Other values based on the app name.
-  EXPECT_STREQ(_T("_Google_Update_"), kLockPrefix);
-#endif  // GOOGLE_UPDATE_BUILD
-
-  // Filename bases
-  EXPECT_STREQ(_T("GoogleUpdate"), MAIN_EXE_BASE_NAME);
-  EXPECT_STREQ(_T("goopdate"), MAIN_DLL_BASE_NAME);
-}
-
-TEST(OmahaCustomizationTest, Constants_Filenames) {
-  EXPECT_STREQ(_T("GoogleUpdate.exe"), kOmahaShellFileName);
-  EXPECT_STREQ(_T("GoogleCrashHandler.exe"), kCrashHandlerFileName);
-  EXPECT_STREQ(_T("goopdate.dll"), kOmahaDllName);
-  EXPECT_STREQ(_T("goopdateres_%s.dll"), kOmahaResourceDllNameFormat);
-  EXPECT_STREQ(_T("GoogleUpdateBroker.exe"), kOmahaBrokerFileName);
-  EXPECT_STREQ(_T("GoogleUpdateOnDemand.exe"), kOmahaOnDemandFileName);
-  EXPECT_STREQ(_T("psmachine.dll"), kPSFileNameMachine);
-  EXPECT_STREQ(_T("psuser.dll"), kPSFileNameUser);
-}
-
-TEST(OmahaCustomizationTest, Constants_Certificate) {
-  EXPECT_STREQ(_T("Google Inc"), kCertificateSubjectName);
-}
-
-TEST(OmahaCustomizationTest, Constants_OmahaAppId_String) {
-  EXPECT_STREQ(_T("{430FD4D0-B729-4F61-AA34-91526481799D}"), GOOPDATE_APP_ID);
-  EXPECT_STREQ(_T("{430FD4D0-B729-4F61-AA34-91526481799D}"),
-               kGoogleUpdateAppId);
-}
-
-TEST(OmahaCustomizationTest, Constants_OmahaAppId_GUID) {
-  const GUID kExpectedGoogleUpdateGuid =
-      {0x430FD4D0, 0xB729, 0x4F61,
-       {0xAA, 0x34, 0x91, 0x52, 0x64, 0x81, 0x79, 0x9D}};
-  EXPECT_TRUE(::IsEqualGUID(kExpectedGoogleUpdateGuid, kGoopdateGuid));
-  EXPECT_STREQ(_T("{430FD4D0-B729-4F61-AA34-91526481799D}"),
-               GuidToString(kGoopdateGuid));
-}
-
-TEST(OmahaCustomizationTest, Constants_OmahaAppId_GUIDAndStringMatch) {
-  EXPECT_STREQ(kGoogleUpdateAppId, GuidToString(kGoopdateGuid));
-}
-
-TEST(OmahaCustomizationTest, Constants_Directories) {
-  EXPECT_STREQ(_T("Offline"), OFFLINE_DIR_NAME);
-  EXPECT_GU_STREQ(_T("Google"), OMAHA_REL_COMPANY_DIR);
-  EXPECT_GU_STREQ(_T("Google\\CrashReports"), OMAHA_REL_CRASH_DIR);
-  EXPECT_GU_STREQ(_T("Google\\Update"), OMAHA_REL_GOOPDATE_INSTALL_DIR);
-  EXPECT_GU_STREQ(_T("Google\\Update\\Log"), OMAHA_REL_LOG_DIR);
-  EXPECT_GU_STREQ(_T("Google\\Update\\Offline"),
-                  OMAHA_REL_OFFLINE_STORAGE_DIR);
-  EXPECT_GU_STREQ(_T("Google\\Update\\Download"),
-                  OMAHA_REL_DOWNLOAD_STORAGE_DIR);
-  EXPECT_GU_STREQ(_T("Google\\Update\\Install"),
-                  OMAHA_REL_INSTALL_WORKING_DIR);
-}
-
-TEST(OmahaCustomizationTest, Constants_RegistryKeys_NotCustomized) {
-  EXPECT_STREQ(_T("HKLM"), MACHINE_KEY_NAME);
-  EXPECT_STREQ(_T("HKLM\\"), MACHINE_KEY);
-  EXPECT_STREQ(_T("HKCU"), USER_KEY_NAME);
-  EXPECT_STREQ(_T("HKCU\\"), USER_KEY);
-  EXPECT_STREQ(_T("HKU\\"), USERS_KEY);
-}
-
-TEST(OmahaCustomizationTest, Constants_RegistryKeys) {
-  EXPECT_GU_STREQ(_T("Software\\Google\\"), COMPANY_MAIN_KEY);
-  EXPECT_GU_STREQ(_T("Software\\Google\\Update\\"), GOOPDATE_MAIN_KEY);
-  EXPECT_GU_STREQ(_T("Software\\Google\\Update\\Clients\\"), GOOPDATE_REG_RELATIVE_CLIENTS);  // NOLINT
-  EXPECT_GU_STREQ(_T("Software\\Google\\Update\\ClientState\\"), GOOPDATE_REG_RELATIVE_CLIENT_STATE);  // NOLINT
-  EXPECT_GU_STREQ(_T("Software\\Google\\Update\\ClientStateMedium\\"), GOOPDATE_REG_RELATIVE_CLIENT_STATE_MEDIUM);  // NOLINT
-  EXPECT_GU_STREQ(_T("Software\\Policies\\Google\\"), COMPANY_POLICIES_MAIN_KEY);
-  EXPECT_GU_STREQ(_T("Software\\Policies\\Google\\Update\\"), GOOPDATE_POLICIES_RELATIVE);  // NOLINT
-
-  EXPECT_GU_STREQ(_T("HKCU\\Software\\Google\\"), USER_REG_GOOGLE);
-  EXPECT_GU_STREQ(_T("HKCU\\Software\\Google\\Update\\"), USER_REG_UPDATE);
-  EXPECT_GU_STREQ(_T("HKCU\\Software\\Google\\Update\\Clients\\"), USER_REG_CLIENTS);  // NOLINT
-  EXPECT_GU_STREQ(_T("HKCU\\Software\\Google\\Update\\Clients\\{430FD4D0-B729-4F61-AA34-91526481799D}"), USER_REG_CLIENTS_GOOPDATE);  // NOLINT
-  EXPECT_GU_STREQ(_T("HKCU\\Software\\Google\\Update\\ClientState\\"), USER_REG_CLIENT_STATE);  // NOLINT
-  EXPECT_GU_STREQ(_T("HKCU\\Software\\Google\\Update\\ClientState\\{430FD4D0-B729-4F61-AA34-91526481799D}"), USER_REG_CLIENT_STATE_GOOPDATE);  // NOLINT
-
-  EXPECT_GU_STREQ(_T("HKLM\\Software\\Google\\"), MACHINE_REG_GOOGLE);
-  EXPECT_GU_STREQ(_T("HKLM\\Software\\Google\\Update\\"), MACHINE_REG_UPDATE);
-  EXPECT_GU_STREQ(_T("HKLM\\Software\\Google\\Update\\Clients\\"), MACHINE_REG_CLIENTS);  // NOLINT
-  EXPECT_GU_STREQ(_T("HKLM\\Software\\Google\\Update\\Clients\\{430FD4D0-B729-4F61-AA34-91526481799D}"), MACHINE_REG_CLIENTS_GOOPDATE);  // NOLINT
-  EXPECT_GU_STREQ(_T("HKLM\\Software\\Google\\Update\\ClientState\\"), MACHINE_REG_CLIENT_STATE);  // NOLINT
-  EXPECT_GU_STREQ(_T("HKLM\\Software\\Google\\Update\\ClientState\\{430FD4D0-B729-4F61-AA34-91526481799D}"), MACHINE_REG_CLIENT_STATE_GOOPDATE);  // NOLINT
-  EXPECT_GU_STREQ(_T("HKLM\\Software\\Google\\Update\\ClientStateMedium\\"), MACHINE_REG_CLIENT_STATE_MEDIUM);  // NOLINT
-
-  EXPECT_GU_STREQ(_T("HKLM\\Software\\Google\\UpdateDev\\"), MACHINE_REG_UPDATE_DEV);  // NOLINT
-}
-
-TEST(OmahaCustomizationTest, Constants_RegistryKeys_GroupPolicy) {
-  EXPECT_GU_STREQ(_T("Software\\Policies\\Google\\Update\\"), GOOPDATE_POLICIES_RELATIVE);  // NOLINT
-  EXPECT_GU_STREQ(_T("HKLM\\Software\\Policies\\Google\\Update\\"), kRegKeyGoopdateGroupPolicy);  // NOLINT
-}
-
-TEST(OmahaCustomizationTest, Constants_RegistryValues) {
-  EXPECT_GU_STREQ(_T("Google Update"), kRunValueName);
-}
-
-TEST(OmahaCustomizationTest, Constants_MsiMsp) {
-  EXPECT_STREQ(_T("GoogleUpdateHelper.msi"), kHelperInstallerName);
-  EXPECT_STREQ(_T("{A92DAB39-4E2C-4304-9AB6-BC44E68B55E2}"),
-               kHelperInstallerProductGuid);
-  EXPECT_STREQ(_T("GoogleUpdateHelperPatch.msp"), kHelperPatchName);
-  EXPECT_STREQ(_T("{E0D0D2C9-5836-4023-AB1D-54EC3B90AD03}"), kHelperPatchGuid);
-}
-
-TEST(OmahaCustomizationTest, Constants_CompatibleShellVersions) {
-  EXPECT_EQ(2, arraysize(kCompatibleOlderShellVersions));
-  EXPECT_EQ(0x0001000200830007, kCompatibleOlderShellVersions[0]);
-  EXPECT_EQ(0x0001000200B70009, kCompatibleOlderShellVersions[1]);
-}
-
-TEST(OmahaCustomizationTest, Constants_BrandCode) {
-  EXPECT_STREQ(_T("GGLS"), kDefaultGoogleUpdateBrandCode);
-}
-
-TEST(OmahaCustomizationTest, Constants_Addresses) {
-  EXPECT_STREQ(_T("www.google.com"), kGoogleHttpServer);
-  EXPECT_STREQ(_T("tools.google.com"), kGoopdateServer);
-  EXPECT_STREQ(_T("https://tools.google.com/service/update2"), kUrlUpdateCheck);
-  EXPECT_STREQ(_T("http://tools.google.com/service/update2"), kUrlPing);
-  EXPECT_STREQ(_T("http://clients2.google.com/cr/report"), kUrlCrashReport);
-  EXPECT_STREQ(_T("http://www.google.com/support/installer/?"), kUrlMoreInfo);
-  EXPECT_STREQ(_T("http://cr-tools.clients.google.com/service/check2"),
-               kUrlCodeRedCheck);
-  EXPECT_STREQ(_T("http://clients5.google.com/tbproxy/usagestats"),
-               kUrlUsageStatsReport);
-}
-
-TEST(OmahaCustomizationTest, Constants_Config) {
-  EXPECT_GU_STREQ(_T("Software\\Google\\Update\\Shared"), kCiRegKeyShared);
-}
-
-TEST(OmahaCustomizationTest, Constants_Debug) {
-  EXPECT_GU_STREQ(_T("GoogleUpdate-debug"), kCiDebugDirectory);
-}
-
-TEST(OmahaCustomizationTest, Constants_Logging) {
-  EXPECT_STREQ(_T("GoogleUpdate.ini"), kLogConfigFileName);
-  EXPECT_STREQ(_T("GoogleUpdate.log"), kDefaultLogFileName);
-}
-
-// These should not change during customization.
-TEST(OmahaCustomizationTest, Constants_ObjectNames_Prefixes) {
-  EXPECT_GU_STREQ(_T("Global\\G"), kGlobalPrefix);
-}
-
-TEST(OmahaCustomizationTest, Constants_ObjectNames_Pipes) {
-  EXPECT_GU_STREQ(_T("\\\\.\\pipe\\GoogleCrashServices"), kCrashPipeNamePrefix);
-}
-
-TEST(OmahaCustomizationTest, Constants_ObjectNames_MutexesAndEvents) {
-  EXPECT_STREQ(_T("{A9A86B93-B54E-4570-BE89-42418507707B}"), kSetupMutex);
-  EXPECT_STREQ(_T("{A0C1F415-D2CE-4ddc-9B48-14E56FD55162}"), kShutdownEvent);
-  EXPECT_STREQ(_T("{B5665124-2B19-40e2-A7BC-B44321E72C4B}"),
-               kCoreSingleInstance);
-  EXPECT_STREQ(_T("{C4F406E5-F024-4e3f-89A7-D5AB7663C3CD}"),
-               kCrashHandlerSingleInstance);
-  EXPECT_STREQ(_T("{D0BB2EF1-C183-4cdb-B218-040922092869}"),
-               kUpdateAppsSingleInstance);
-  EXPECT_STREQ(_T("%s-{F707E94F-D66B-4525-AD84-B1DA87D6A971}"),
-               kInstallAppSingleInstance);
-  EXPECT_STREQ(_T("{0A175FBE-AEEC-4fea-855A-2AA549A88846}"),
-               kInstallManagerSerializer);
-  EXPECT_STREQ(_T("{C68009EA-1163-4498-8E93-D5C4E317D8CE}"),
-               kMetricsSerializer);
-  EXPECT_STREQ(_T("{0E900C7B-04B0-47f9-81B0-F8D94F2DF01B}"),
-               kNetworkConfigLock);
-  EXPECT_STREQ(_T("{66CC0160-ABB3-4066-AE47-1CA6AD5065C8}"),
-               kRegistryAccessMutex);
-}
-
-TEST(OmahaCustomizationTest, Constants_ObjectNames_SharedMemory) {
-  EXPECT_GU_STREQ(_T("Global\\GoogleUpdate3"),
-                  kGoogleUpdate3SharedMemoryName);
-  EXPECT_GU_STREQ(_T("Global\\GoogleUpdateCore"),
-                  kGoogleUpdateCoreSharedMemoryName);
-}
-
-TEST(OmahaCustomizationTest, Constants_Services) {
-  EXPECT_GU_STREQ(_T("gupdate_service_name"), kRegValueServiceName);
-  EXPECT_GU_STREQ(_T("gupdatem_service_name"), kRegValueMediumServiceName);
-  EXPECT_GU_STREQ(_T("gupdate_task_name_c"), kRegValueTaskNameC);
-  EXPECT_GU_STREQ(_T("gupdate_task_name_ua"), kRegValueTaskNameUA);
-
-  EXPECT_GU_STREQ(_T("gupdate"), kServicePrefix);
-  EXPECT_GU_STREQ(_T("gupdatem"), kMediumServicePrefix);
-
-  EXPECT_STREQ(_T("GoogleUpdate.exe"), kServiceFileName);
-}
-
-TEST(OmahaCustomizationTest, Constants_ScheduledTasks) {
-  EXPECT_GU_STREQ(_T("GoogleUpdateTaskUser"), kScheduledTaskNameUserPrefix);
-  EXPECT_GU_STREQ(_T("GoogleUpdateTaskMachine"), kScheduledTaskNameMachinePrefix);
-}
-
-TEST(OmahaCustomizationTest, Constants_Plugins) {
-  EXPECT_GU_STREQ(_T("Google.OneClickCtrl.") _T(ONECLICK_PLUGIN_VERSION_ANSI),
-                  kOneClickProgId);
-  EXPECT_STREQ(
-      "application/x-vnd.google.oneclickctrl." ONECLICK_PLUGIN_VERSION_ANSI,
-      kOneClickPluginMimeTypeAnsi);
-}
-
-TEST(OmahaCustomizationTest, Constants_HostCheck) {
-  EXPECT_EQ(4, arraysize(kSiteLockPatternStrings));
-  EXPECT_STREQ(_T("^(gears)|(mail)|(tools)|(www)|(desktop)|(pack)\\.google\\.com$"), kSiteLockPatternStrings[0]);  // NOLINT
-  EXPECT_STREQ(_T("^www\\.google\\.(ad)|(bg)|(ca)|(cn)|(cz)|(de)|(es)|(fi)|(fr)|(gr)|(hr)|(hu)|(it)|(ki)|(kr)|(lt)|(lv)|(nl)|(no)|(pl)|(pt)|(ro)|(ru)|(sk)|(sg)|(sl)|(sr)|(vn)$"), kSiteLockPatternStrings[1]);  // NOLINT
-  EXPECT_STREQ(_T("^www\\.google\\.co\\.(hu)|(id)|(il)|(it)|(jp)|(kr)|(th)|(uk)$"), kSiteLockPatternStrings[2]);  // NOLINT
-  EXPECT_STREQ(_T("^www\\.google\\.com\\.(ar)|(au)|(br)|(cn)|(et)|(gr)|(hr)|(ki)|(lv)|(om)|(pl)|(pt)|(ru)|(sg)|(sv)|(tr)|(vn)$"), kSiteLockPatternStrings[3]);  // NOLINT
-}
-
-//
-// ConfigManager keys.
-//
-
-TEST(OmahaCustomizationTest, ConfigManager_RegistryKeys) {
-  const ConfigManager& cm = *ConfigManager::Instance();
-
-  EXPECT_GU_STREQ(_T("HKCU\\Software\\Google\\Update\\Clients\\"), cm.user_registry_clients());  // NOLINT
-  EXPECT_GU_STREQ(_T("HKLM\\Software\\Google\\Update\\Clients\\"), cm.machine_registry_clients());  // NOLINT
-  EXPECT_GU_STREQ(_T("HKCU\\Software\\Google\\Update\\Clients\\"), cm.registry_clients(false));  // NOLINT
-  EXPECT_GU_STREQ(_T("HKLM\\Software\\Google\\Update\\Clients\\"), cm.registry_clients(true));  // NOLINT
-
-  EXPECT_GU_STREQ(_T("HKCU\\Software\\Google\\Update\\Clients\\{430FD4D0-B729-4F61-AA34-91526481799D}"), cm.user_registry_clients_goopdate());  // NOLINT
-  EXPECT_GU_STREQ(_T("HKLM\\Software\\Google\\Update\\Clients\\{430FD4D0-B729-4F61-AA34-91526481799D}"), cm.machine_registry_clients_goopdate());  // NOLINT
-  EXPECT_GU_STREQ(_T("HKCU\\Software\\Google\\Update\\Clients\\{430FD4D0-B729-4F61-AA34-91526481799D}"), cm.registry_clients_goopdate(false));  // NOLINT
-  EXPECT_GU_STREQ(_T("HKLM\\Software\\Google\\Update\\Clients\\{430FD4D0-B729-4F61-AA34-91526481799D}"), cm.registry_clients_goopdate(true));  // NOLINT
-
-  EXPECT_GU_STREQ(_T("HKCU\\Software\\Google\\Update\\ClientState\\"), cm.user_registry_client_state());  // NOLINT
-  EXPECT_GU_STREQ(_T("HKLM\\Software\\Google\\Update\\ClientState\\"), cm.machine_registry_client_state());  // NOLINT
-  EXPECT_GU_STREQ(_T("HKCU\\Software\\Google\\Update\\ClientState\\"), cm.registry_client_state(false));  // NOLINT
-  EXPECT_GU_STREQ(_T("HKLM\\Software\\Google\\Update\\ClientState\\"), cm.registry_client_state(true));  // NOLINT
-
-  EXPECT_GU_STREQ(_T("HKCU\\Software\\Google\\Update\\ClientState\\{430FD4D0-B729-4F61-AA34-91526481799D}"), cm.user_registry_client_state_goopdate());  // NOLINT
-  EXPECT_GU_STREQ(_T("HKLM\\Software\\Google\\Update\\ClientState\\{430FD4D0-B729-4F61-AA34-91526481799D}"), cm.machine_registry_client_state_goopdate());  // NOLINT
-  EXPECT_GU_STREQ(_T("HKCU\\Software\\Google\\Update\\ClientState\\{430FD4D0-B729-4F61-AA34-91526481799D}"), cm.registry_client_state_goopdate(false));  // NOLINT
-  EXPECT_GU_STREQ(_T("HKLM\\Software\\Google\\Update\\ClientState\\{430FD4D0-B729-4F61-AA34-91526481799D}"), cm.registry_client_state_goopdate(true));  // NOLINT
-
-  EXPECT_GU_STREQ(_T("HKLM\\Software\\Google\\Update\\ClientStateMedium\\"), cm.machine_registry_client_state_medium());  // NOLINT
-
-  EXPECT_GU_STREQ(_T("HKCU\\Software\\Google\\Update\\"), cm.user_registry_update());  // NOLINT
-  EXPECT_GU_STREQ(_T("HKLM\\Software\\Google\\Update\\"), cm.machine_registry_update());  // NOLINT
-  EXPECT_GU_STREQ(_T("HKCU\\Software\\Google\\Update\\"), cm.registry_update(false));  // NOLINT
-  EXPECT_GU_STREQ(_T("HKLM\\Software\\Google\\Update\\"), cm.registry_update(true));  // NOLINT
-
-  EXPECT_GU_STREQ(_T("HKCU\\Software\\Google\\"), cm.user_registry_google());
-  EXPECT_GU_STREQ(_T("HKLM\\Software\\Google\\"), cm.machine_registry_google());
-  EXPECT_GU_STREQ(_T("HKCU\\Software\\Google\\"), cm.registry_google(false));
-  EXPECT_GU_STREQ(_T("HKLM\\Software\\Google\\"), cm.registry_google(true));
-}
-
-TEST(OmahaCustomizationTest, IsInternalUser) {
-  if (IsBuildSystem()) {
-  // The build system is not configured the same.
-  // This may or may not be true in non-Google Update builds.
-#ifdef GOOGLE_UPDATE_BUILD
-    EXPECT_FALSE(ConfigManager::Instance()->IsInternalUser());
-#else
-  std::wcout << _T("Did not test IsInternalUser.") << std::endl;
-#endif
-  } else {
-    EXPECT_TRUE(ConfigManager::Instance()->IsInternalUser());
-  }
-}
-
-//
-// Test helpers.
-//
-
-TEST(OmahaCustomizationTest, GetGoogleUserPath) {
-  EXPECT_STREQ(GetLocalAppDataPath() + SHORT_COMPANY_NAME + _T("\\"),
-               GetGoogleUserPath());
-}
-
-TEST(OmahaCustomizationTest, GetGoogleUpdateUserPath) {
-  EXPECT_STREQ(GetLocalAppDataPath() + SHORT_COMPANY_NAME + _T("\\")
-                                     + PRODUCT_NAME + _T("\\"),
-               GetGoogleUpdateUserPath());
-}
-
-// Assumes Program Files is in the normal location.
-TEST(OmahaCustomizationTest, GetGoogleUpdateMachinePath) {
-  CString expected_machine_path;
-  EXPECT_SUCCEEDED(GetFolderPath(CSIDL_PROGRAM_FILES | CSIDL_FLAG_DONT_VERIFY,
-                                 &expected_machine_path));
-  expected_machine_path.Append(_T("\\") SHORT_COMPANY_NAME
-                               _T("\\") PRODUCT_NAME);
-  EXPECT_STREQ(expected_machine_path, GetGoogleUpdateMachinePath());
-}
-
-}  // namespace omaha
diff --git a/common/ping.cc b/common/ping.cc
deleted file mode 100644
index 181df73..0000000
--- a/common/ping.cc
+++ /dev/null
@@ -1,440 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/common/ping.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/scoped_impersonation.h"
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vista_utils.h"
-#include "omaha/common/app_registry_utils.h"
-#include "omaha/common/command_line.h"
-#include "omaha/common/command_line_builder.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/common/update_request.h"
-#include "omaha/common/update_response.h"
-#include "omaha/goopdate/app.h"
-#include "omaha/goopdate/app_bundle.h"
-#include "omaha/goopdate/update_request_utils.h"
-#include "omaha/goopdate/update_response_utils.h"
-
-namespace omaha {
-
-const TCHAR* const Ping::kRegKeyPing = _T("Pings");
-const time64 Ping::kPingExpiry100ns  = 10 * kDaysTo100ns;  // 10 days.
-
-Ping::Ping(bool is_machine,
-           const CString& session_id,
-           const CString& install_source)
-    : is_machine_(is_machine),
-      ping_request_(xml::UpdateRequest::Create(is_machine,
-                                               session_id,
-                                               install_source,
-                                               CString())) {
-}
-
-Ping::~Ping() {
-}
-
-void Ping::BuildRequest(const App* app, bool is_update_check) {
-  update_request_utils::BuildRequest(app, is_update_check, ping_request_.get());
-}
-
-void Ping::LoadAppDataFromExtraArgs(const CommandLineExtraArgs& extra_args) {
-  const CString installation_id = GuidToString(extra_args.installation_id);
-  for (size_t i = 0; i != extra_args.apps.size(); ++i) {
-    AppData app_data;
-    app_data.app_id = GuidToString(extra_args.apps[i].app_guid);
-    app_data.language = extra_args.language;
-    app_data.brand_code = extra_args.brand_code;
-    app_data.client_id = extra_args.client_id;
-    app_data.installation_id = installation_id;
-    app_data.experiment_labels = extra_args.apps[i].experiment_labels;
-    apps_data_.push_back(app_data);
-  }
-
-  omaha_data_.app_id = kGoogleUpdateAppId;
-  omaha_data_.language = extra_args.language;
-  omaha_data_.brand_code = extra_args.brand_code;
-  omaha_data_.client_id = extra_args.client_id;
-  omaha_data_.installation_id = installation_id;
-  omaha_data_.experiment_labels = extra_args.experiment_labels;
-}
-
-void Ping::LoadOmahaDataFromRegistry() {
-  omaha_data_.app_id = kGoogleUpdateAppId;
-  app_registry_utils::GetClientStateData(
-      is_machine_,
-      kGoogleUpdateAppId,
-      NULL,
-      NULL,         // ap is not used yet.
-      &omaha_data_.language,
-      &omaha_data_.brand_code,
-      &omaha_data_.client_id,
-      &omaha_data_.installation_id,
-      &omaha_data_.experiment_labels);
-}
-
-void Ping::LoadAppDataFromRegistry(const std::vector<CString>& app_ids) {
-  for (size_t i = 0; i != app_ids.size(); ++i) {
-    AppData app_data;
-    app_data.app_id = app_ids[i];
-    app_registry_utils::GetClientStateData(
-        is_machine_,
-        app_data.app_id,
-        &app_data.pv,
-        NULL,         // ap is not used yet.
-        &app_data.language,
-        &app_data.brand_code,
-        &app_data.client_id,
-        &app_data.installation_id,
-        &app_data.experiment_labels);
-    apps_data_.push_back(app_data);
-  }
-
-  LoadOmahaDataFromRegistry();
-}
-
-HRESULT Ping::Send(bool is_fire_and_forget) {
-  CORE_LOG(L3, (_T("[Ping::Send]")));
-
-  ASSERT1(ConfigManager::Instance()->CanUseNetwork(is_machine_));
-
-  if (ping_request_->IsEmpty()) {
-    CORE_LOG(L3, (_T("[Ping::Send did not send empty ping]")));
-    return S_FALSE;
-  }
-
-  CString request_string;
-  HRESULT hr = BuildRequestString(&request_string);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[BuildRequestString failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  const DWORD wait_timeout_ms = is_fire_and_forget ? 0 : INFINITE;
-  hr = SendUsingGoogleUpdate(request_string, wait_timeout_ms);
-  if (SUCCEEDED(hr)) {
-    return hr;
-  }
-
-  CORE_LOG(LE, (_T("[Ping::SendUsingGoogleUpdate failed][0x%x]"), hr));
-
-  hr = SendInProcess(request_string);
-  if (SUCCEEDED(hr)) {
-    return hr;
-  }
-
-  CORE_LOG(LE, (_T("[Ping::SendInProcess failed][0x%x]"), hr));
-
-  return PersistPing(is_machine_, request_string);
-}
-
-void Ping::BuildOmahaPing(const CString& version,
-                          const CString& next_version,
-                          const PingEventPtr& ping_event) {
-  xml::request::App app(BuildOmahaApp(version, next_version));
-  app.ping_events.push_back(ping_event);
-  ping_request_->AddApp(app);
-}
-
-void Ping::BuildOmahaPing(const CString& version,
-                          const CString& next_version,
-                          const PingEventPtr& ping_event1,
-                          const PingEventPtr& ping_event2) {
-  xml::request::App app(BuildOmahaApp(version, next_version));
-  app.ping_events.push_back(ping_event1);
-  app.ping_events.push_back(ping_event2);
-  ping_request_->AddApp(app);
-}
-
-xml::request::App Ping::BuildOmahaApp(const CString& version,
-                                      const CString& next_version) const {
-  xml::request::App app;
-
-  app.app_id         = omaha_data_.app_id;
-  app.lang           = omaha_data_.language;
-  app.brand_code     = omaha_data_.brand_code;
-  app.client_id      = omaha_data_.client_id;
-  app.experiments    = omaha_data_.experiment_labels;
-  app.iid            = omaha_data_.installation_id;
-
-  app.version        = version;
-  app.next_version   = next_version;
-
-  return app;
-}
-
-void Ping::BuildAppsPing(const PingEventPtr& ping_event) {
-  for (size_t i = 0; i != apps_data_.size(); ++i) {
-    xml::request::App app;
-
-    app.version        = apps_data_[i].pv;
-    app.app_id         = apps_data_[i].app_id;
-    app.lang           = apps_data_[i].language;
-    app.brand_code     = apps_data_[i].brand_code;
-    app.client_id      = apps_data_[i].client_id;
-    app.experiments    = apps_data_[i].experiment_labels;
-    app.iid            = apps_data_[i].installation_id;
-
-    app.ping_events.push_back(ping_event);
-    ping_request_->AddApp(app);
-  }
-}
-
-HRESULT Ping::SendUsingGoogleUpdate(const CString& request_string,
-                                    DWORD wait_timeout_ms) const {
-  CStringA request_string_utf8(WideToUtf8(request_string));
-  CStringA ping_string_utf8;
-  WebSafeBase64Escape(request_string_utf8, &ping_string_utf8);
-
-  CommandLineBuilder builder(COMMANDLINE_MODE_PING);
-  builder.set_ping_string(Utf8ToWideChar(ping_string_utf8,
-                                         ping_string_utf8.GetLength()));
-  CString args = builder.GetCommandLineArgs();
-
-  scoped_process ping_process;
-  HRESULT hr = goopdate_utils::StartGoogleUpdateWithArgs(is_machine_,
-                                                         args,
-                                                         address(ping_process));
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[failed to start ping process][0x%08x]"), hr));
-    return hr;
-  }
-
-  if (wait_timeout_ms) {
-    DWORD result = ::WaitForSingleObject(get(ping_process), wait_timeout_ms);
-    DWORD exit_code(0);
-    if (result == WAIT_OBJECT_0 &&
-        ::GetExitCodeProcess(get(ping_process), &exit_code)) {
-      ASSERT1(exit_code == 0 || FAILED(exit_code));
-      return (exit_code == 0) ? S_OK : exit_code;
-    } else {
-      if (result == WAIT_TIMEOUT) {
-        CORE_LOG(LW, (_T("[ping process did not finish in time][pid=%u]"),
-            ::GetProcessId(get(ping_process))));
-        VERIFY1(::TerminateProcess(get(ping_process), UINT_MAX));
-      }
-      return E_FAIL;
-    }
-  }
-
-  return S_OK;
-}
-
-HRESULT Ping::SendInProcess(const CString& request_string) const {
-  HRESULT hr = SendString(is_machine_, HeadersVector(), request_string);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[SendString failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT Ping::BuildRequestString(CString* request_string) const {
-  ASSERT1(request_string);
-  return ping_request_->Serialize(request_string);
-}
-
-CString Ping::GetPingRegPath(bool is_machine) {
-  CString ping_reg_path = is_machine ? MACHINE_REG_UPDATE : USER_REG_UPDATE;
-  return AppendRegKeyPath(ping_reg_path, kRegKeyPing);
-}
-
-HRESULT Ping::LoadPersistedPings(bool is_machine, PingsVector* pings) {
-  ASSERT1(pings);
-
-  RegKey ping_reg_key;
-  HRESULT hr = ping_reg_key.Open(GetPingRegPath(is_machine), KEY_READ);
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[Unable to open Ping regkey][0x%x]"), hr));
-    return hr;
-  }
-
-  int num_pings = ping_reg_key.GetValueCount();
-  for (int i = 0; i < num_pings; ++i) {
-    CString persisted_time_string;
-    hr = ping_reg_key.GetValueNameAt(i, &persisted_time_string, NULL);
-    if (FAILED(hr)) {
-      CORE_LOG(LW, (_T("[GetValueNameAt failed][%d]"), i));
-      continue;
-    }
-
-    time64 persisted_time = _tcstoui64(persisted_time_string, NULL, 10);
-    if (persisted_time == 0 || persisted_time == _UI64_MAX) {
-      CORE_LOG(LW, (_T("[Incorrect time value][%s]"), persisted_time_string));
-      continue;
-    }
-
-    CString ping_string;
-    hr = ping_reg_key.GetValue(persisted_time_string, &ping_string);
-    if (FAILED(hr)) {
-      CORE_LOG(LW, (_T("[GetValue failed][%s]"), persisted_time_string));
-      continue;
-    }
-
-    pings->push_back(std::make_pair(persisted_time, ping_string));
-  }
-
-  return S_OK;
-}
-
-bool Ping::IsPingExpired(time64 persisted_time) {
-  const time64 now = GetCurrent100NSTime();
-
-  if (now < persisted_time) {
-    CORE_LOG(LW, (_T("[Incorrect clock time][%I64u][%I64u]"),
-                  now, persisted_time));
-    return true;
-  }
-
-  const time64 time_difference = now - persisted_time;
-  CORE_LOG(L3, (_T("[%I64u][%I64u][%I64u]"),
-                now, persisted_time, time_difference));
-
-  const bool result = time_difference >= kPingExpiry100ns;
-  CORE_LOG(L3, (_T("[IsPingExpired][%d]"), result));
-  return result;
-}
-
-HRESULT Ping::DeletePersistedPing(bool is_machine, time64 persisted_time) {
-  CString persisted_time_string;
-  persisted_time_string.Format(_T("%I64u"), persisted_time);
-  CORE_LOG(L3, (_T("[Ping::DeletePersistedPing][%s]"), persisted_time_string));
-
-  CString ping_reg_path(GetPingRegPath(is_machine));
-  HRESULT hr = RegKey::DeleteValue(ping_reg_path, persisted_time_string);
-
-  if (RegKey::IsKeyEmpty(ping_reg_path)) {
-    VERIFY1(SUCCEEDED(RegKey::DeleteKey(ping_reg_path)));
-  }
-
-  return hr;
-}
-
-HRESULT Ping::PersistPing(bool is_machine, const CString& ping_string) {
-  CString time_now_str;
-  time_now_str.Format(_T("%I64u"), GetCurrent100NSTime());
-  CORE_LOG(L3, (_T("[Ping::PersistPing][%s][%s]"), time_now_str, ping_string));
-
-  return RegKey::SetValue(GetPingRegPath(is_machine),
-                          time_now_str,
-                          ping_string);
-}
-
-HRESULT Ping::SendPersistedPings(bool is_machine) {
-  PingsVector pings;
-  HRESULT hr = LoadPersistedPings(is_machine, &pings);
-  if (FAILED(hr) && (hr != HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND))) {
-    return hr;
-  }
-
-  for (size_t i = 0; i != pings.size(); ++i) {
-    time64 persisted_time = pings[i].first;
-    int32 request_age = Time64ToInt32(GetCurrent100NSTime()) -
-                        Time64ToInt32(persisted_time);
-    const CString& ping_string(pings[i].second);
-
-    CORE_LOG(L3, (_T("[Resending ping][%I64u][%d][%s]"),
-                  persisted_time, request_age, ping_string));
-
-    CString request_age_string;
-    request_age_string.Format(_T("%d"), request_age);
-    HeadersVector headers;
-    headers.push_back(std::make_pair(kHeaderXRequestAge, request_age_string));
-
-    hr = SendString(is_machine, headers, ping_string);
-
-    if (SUCCEEDED(hr) || IsPingExpired(persisted_time)) {
-      CORE_LOG(L3, (_T("[Deleting ping][0x%x]"), hr));
-      VERIFY1(SUCCEEDED(DeletePersistedPing(is_machine, persisted_time)));
-    }
-  }
-
-  return S_OK;
-}
-
-// TODO(omaha): Ping support for authenticated proxies.
-HRESULT Ping::SendString(bool is_machine,
-                         const HeadersVector& headers,
-                         const CString& request_string) {
-  ASSERT1(ConfigManager::Instance()->CanUseNetwork(is_machine));
-
-  CORE_LOG(L3, (_T("[ping request string][%s]"), request_string));
-
-  CString url;
-  ConfigManager::Instance()->GetPingUrl(&url);
-
-  // Impersonate the user if the caller is machine, running as local system,
-  // and a user is logged on to the system.
-  scoped_handle impersonation_token(
-      goopdate_utils::GetImpersonationTokenForMachineProcess(is_machine));
-  scoped_impersonation impersonate_user(get(impersonation_token));
-
-  WebServicesClient web_service_client(is_machine);
-  HRESULT hr(web_service_client.Initialize(url, headers, false));
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[WebServicesClient::Initialize failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  scoped_ptr<xml::UpdateResponse> response(xml::UpdateResponse::Create());
-  hr = web_service_client.SendString(&request_string, response.get());
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[WebServicesClient::SendString failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  // If a ping is sent but the response is corrupted in some way (or we can't
-  // persist the labels for some reason), returning a failure code would result
-  // in the ping being persisted and re-sent later.  For this reason, we always
-  // return a success code if we sent the ping, even if following actions fail.
-  VERIFY1(SUCCEEDED(update_response_utils::ApplyExperimentLabelDeltas(
-      is_machine,
-      response.get())));
-
-  return S_OK;
-}
-
-HRESULT Ping::HandlePing(bool is_machine, const CString& ping_string) {
-  CORE_LOG(L3, (_T("[Ping::HandlePing][%s]"), ping_string));
-
-  CStringA ping_string_utf8(WideToUtf8(ping_string));
-
-  CStringA request_string_utf8;
-  int out_buffer_length = ping_string_utf8.GetLength();
-  char* out_buffer = request_string_utf8.GetBufferSetLength(out_buffer_length);
-
-  out_buffer_length = WebSafeBase64Unescape(ping_string_utf8,
-                                            ping_string_utf8.GetLength(),
-                                            out_buffer,
-                                            out_buffer_length);
-  ASSERT1(out_buffer_length <= ping_string_utf8.GetLength());
-  request_string_utf8.ReleaseBufferSetLength(out_buffer_length);
-
-  CString request_string(Utf8ToWideChar(request_string_utf8,
-                                        request_string_utf8.GetLength()));
-
-  return Ping::SendString(is_machine, HeadersVector(), request_string);
-}
-
-}  // namespace omaha
-
diff --git a/common/ping.h b/common/ping.h
deleted file mode 100644
index 7cff0e6..0000000
--- a/common/ping.h
+++ /dev/null
@@ -1,209 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Functions related to the sending the setup pings. The functionality provided
-// by this class is used in by install, handoff, and update features.
-// This is an overview of how the setup pings work.
-// In the case of install, the execution flow includes the following steps:
-// elevation if needed, setting up Omaha, and installing the applications
-// specified in the tag.
-// The code guarantees that an EVENT_INSTALL_COMPLETE(2) ping for Omaha is sent
-// in all cases, except trivial errors that may happen before the execution flow
-// reaches the Install function.
-// A EVENT_INSTALL_COMPLETE(2) ping for the apps is also sent in all cases.
-//
-// Where the code fails affects how the pings are generated and sent, as
-// following:
-// * if the elevation was required but the elevated process failed to run,
-//   then both pings are sent from the medium integrity /install
-//   process.
-// * if the Omaha setup code ran but it errored out or the handoff failed to
-//   launch, then both pings are sent from the /install process or the
-//   elevated /install process if elevation was successful. The pings will be
-//   split in two different http transactions in the case setup completed
-//   successfully but it failed to handoff.
-// * if the /handoff process launched but an error occured in the handoff
-//   process itself, then the Omaha "2" ping is sent from the /install process
-//   and the apps "2" ping is sent from the /handoff process.
-//   The apps ping is only sent if the handoff code did not proceed far enough
-//   to create a bundle of  applications. Beyond that point, the bundle takes
-//   over the responsibility of sending "2" pings for each app in the bundle.
-//
-// There is an IPC mechanism between /install and /handoff processes based
-// on detected input idle to avoid overlapping error handling and
-// displaying redundant error messages in different processes. Usually ping
-// handling, error handling, and displaying error UI is done in the same layer.
-// When an error happens in the chain of /install, elevated install,
-// and /handoff  processes, then UI is displayed by one of these processes only
-// if the child process did not display UI. Since UI is displayed in the
-// /handoff process in both the success and error cases, this information can't
-// be useful to handle the pings, therefore pings only rely on a weaker
-// guarantee, which is whether the child process has launched or not.
-
-// TODO(omaha): unify the install and bundle pings mechanisms. There is
-// no facility to cancel the install pings in the current implementation.
-
-// TODO(omaha): use a pimpl to avoid the dependency on UpdateRequest.
-
-#ifndef OMAHA_COMMON_PING_H_
-#define OMAHA_COMMON_PING_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include <utility>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/common/ping_event.h"
-#include "omaha/common/update_request.h"
-#include "omaha/common/web_services_client.h"
-#include "third_party/gtest/include/gtest/gtest.h"
-
-namespace omaha {
-
-struct CommandLineExtraArgs;
-class App;
-
-class Ping {
- public:
-  Ping(bool is_machine,
-       const CString& session_id,
-       const CString& install_source);
-  ~Ping();
-
-  // TODO(omaha): Consider moving everything except the functionality that
-  // actually sends the pings out of the Ping class into builder classes. A
-  // dependency on the model App is not desirable here.
-  void BuildRequest(const App* app, bool is_update_check);
-
-  // Loads app data from a location other than the Omaha state machine.
-  void LoadAppDataFromExtraArgs(const CommandLineExtraArgs& extra_args);
-  void LoadAppDataFromRegistry(const std::vector<CString>& apps);
-  void LoadOmahaDataFromRegistry();
-
-  // Builds pings for Omaha or apps loaded previously.
-  void BuildOmahaPing(const CString& version,
-                      const CString& next_version,
-                      const PingEventPtr& ping_event);
-
-  void BuildOmahaPing(const CString& version,
-                      const CString& next_version,
-                      const PingEventPtr& ping_event1,
-                      const PingEventPtr& ping_event2);
-
-  void BuildAppsPing(const PingEventPtr& ping_event);
-
-  // Serializes a ping request as a string.
-  HRESULT BuildRequestString(CString* request_string) const;
-
-  // Sends the ping events. The pings could be sent out-of-process,
-  // using the installed Omaha or in-process, if the out-of-process delivery
-  // fails.
-  //
-  // Sending pings is attempted out-of-process first, with a timeout
-  // of 60 seconds, after which the in-process delivery kicks in. The pinging
-  // process pinging is terminated before the in-process pinging is attempted
-  // in order to avoid duplicate pings and prevent run away processes.
-  //
-  // The 'is_fire_and_forget' argument only applies to the out-of-process
-  // delivery mechanism. This allows the execution flow to return to the caller
-  // as soon as possible and it is useful for sending success pings.
-  // The in-process pinging is always blocking.
-  //
-  // If the caller is local system and a user is logged on, the function
-  // impersonatates that user.
-  //
-  // The function returns S_OK if the ping was successfully sent using either
-  // mechanism.
-  HRESULT Send(bool is_fire_and_forget);
-
-  // Sends all persisted pings. Deletes successful or expired pings.
-  static HRESULT SendPersistedPings(bool is_machine);
-
-  // Sends a ping string to the server, in-process. The ping_string must be web
-  // safe base64 encoded and it will be decoded before the ping is sent.
-  static HRESULT HandlePing(bool is_machine, const CString& ping_string);
-
- private:
-  FRIEND_TEST(PingTest, BuildOmahaPing);
-  FRIEND_TEST(PingTest, BuildOmahaPingWithSessionOverride);
-  FRIEND_TEST(PingTest, BuildAppsPing);
-  FRIEND_TEST(PingTest, BuildAppsPingFromRegistry);
-  FRIEND_TEST(PingTest, SendString);
-  FRIEND_TEST(PingTest, SendInProcess);
-  FRIEND_TEST(PingTest, IsPingExpired_PastTime);
-  FRIEND_TEST(PingTest, IsPingExpired_CurrentTime);
-  FRIEND_TEST(PingTest, IsPingExpired_FutureTime);
-  FRIEND_TEST(PingTest, LoadPersistedPings_NoPersistedPings);
-  FRIEND_TEST(PingTest, LoadPersistedPings);
-  FRIEND_TEST(PingTest, PersistPing);
-  FRIEND_TEST(PingTest, DeletePersistedPing);
-  FRIEND_TEST(PingTest, PersistPing_Load_Delete);
-  FRIEND_TEST(PingTest, SendPersistedPings);
-  FRIEND_TEST(PingTest, DISABLED_SendUsingGoogleUpdate);
-
-  typedef std::vector<std::pair<time64, CString> > PingsVector;
-  static const TCHAR* const kRegKeyPing;
-  static const time64 kPingExpiry100ns;
-
-  // Sends pings using the installed GoogleUpdate, which runs in the
-  // ping mode. the function waits for the pings to be sent if wait_timeout_ms
-  // is not zero. Returns S_OK if the pings have been successfully sent.
-  HRESULT SendUsingGoogleUpdate(const CString& request_string,
-                                DWORD wait_timeout_ms) const;
-
-  // Sends ping events in process. Returns S_OK if the pings have been
-  // sent to the server and the server response is 200 OK;
-  HRESULT SendInProcess(const CString& request_string) const;
-
-  xml::request::App BuildOmahaApp(const CString& version,
-                                  const CString& next_version) const;
-
-  // Persistent Ping utility functions.
-  static CString GetPingRegPath(bool is_machine);
-  static HRESULT LoadPersistedPings(bool is_machine, PingsVector* pings);
-  static bool IsPingExpired(time64 persisted_time);
-  static HRESULT DeletePersistedPing(bool is_machine, time64 persisted_time);
-  static HRESULT PersistPing(bool is_machine, const CString& ping_string);
-
-  // Sends a string to the server.
-  static HRESULT SendString(bool is_machine,
-                            const HeadersVector& headers,
-                            const CString& request_string);
-
-  bool is_machine_;
-
-  // Information about apps.
-  struct AppData {
-    CString app_id;
-    CString language;
-    CString brand_code;
-    CString client_id;
-    CString installation_id;
-    CString pv;
-    CString experiment_labels;
-  };
-  std::vector<AppData> apps_data_;
-  AppData omaha_data_;
-
-  scoped_ptr<xml::UpdateRequest> ping_request_;
-
-  DISALLOW_COPY_AND_ASSIGN(Ping);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_PING_H_
-
diff --git a/common/ping_event.cc b/common/ping_event.cc
deleted file mode 100644
index 83a2b8a..0000000
--- a/common/ping_event.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/common/ping_event.h"
-#include "omaha/base/string.h"
-#include "omaha/base/xml_utils.h"
-#include "omaha/common/xml_const.h"
-
-namespace omaha {
-
-HRESULT PingEvent::ToXml(IXMLDOMNode* parent_node) const {
-  HRESULT hr = AddXMLAttributeNode(parent_node,
-                                   xml::kXmlNamespace,
-                                   xml::attribute::kEventType,
-                                   itostr(event_type_));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = AddXMLAttributeNode(parent_node,
-                           xml::kXmlNamespace,
-                           xml::attribute::kEventResult,
-                           itostr(event_result_));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = AddXMLAttributeNode(parent_node,
-                           xml::kXmlNamespace,
-                           xml::attribute::kErrorCode,
-                           itostr(error_code_));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return AddXMLAttributeNode(parent_node,
-                             xml::kXmlNamespace,
-                             xml::attribute::kExtraCode1,
-                             itostr(extra_code1_));
-}
-
-CString PingEvent::ToString() const {
-  CString ping_str;
-  ping_str.Format(_T("%s=%s, %s=%s, %s=%s, %s=%s"),
-      xml::attribute::kEventType, itostr(event_type_),
-      xml::attribute::kEventResult, itostr(event_result_),
-      xml::attribute::kErrorCode, itostr(error_code_),
-      xml::attribute::kExtraCode1, itostr(extra_code1_));
-
-  return ping_str;
-}
-
-}  // namespace omaha
-
diff --git a/common/ping_event.h b/common/ping_event.h
deleted file mode 100644
index 7551418..0000000
--- a/common/ping_event.h
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_PING_EVENT_H_
-#define OMAHA_COMMON_PING_EVENT_H_
-
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "omaha/base/debug.h"
-#include "third_party/bar/shared_ptr.h"
-
-namespace omaha {
-
-class PingEvent {
- public:
-  // The extra code represents the file order as defined by the setup.
-  static const int kSetupFilesExtraCodeMask = 0x00000100;
-
-  // The extra code represents a state of the app state machine.
-  static const int kAppStateExtraCodeMask   = 0x10000000;
-
-  // When updating this enum, also update the protocol file on the server.
-  // These values get reported to the server, so do not change existing ones.
-  //
-  // Checkpoints:
-  //  "EVENT_INSTALL_*" events report the progress of initial installs.
-  //  "EVENT_UPDATE_*" events report the progress of silent updates.
-  //  These checkpoints represent the "START" or "FINISH" of a phase.
-  // Actions:
-  //  "EVENT_*_BEGIN" events report the start of a specific action (i.e. job).
-  //  "EVENT_*_COMPLETE" events represent the end of such actions and report
-  // successful completion or the error that occurred during the action.
-  enum Types {
-    EVENT_UNKNOWN = 0,
-    EVENT_INSTALL_DOWNLOAD_FINISH = 1,
-    EVENT_INSTALL_COMPLETE = 2,
-    EVENT_UPDATE_COMPLETE = 3,
-    EVENT_UNINSTALL = 4,
-    EVENT_INSTALL_DOWNLOAD_START = 5,
-    EVENT_INSTALL_INSTALLER_START = 6,
-    // Never used = 7
-    // No longer used - EVENT_INSTALLED_GOOPDATE_STARTED = 8,
-    EVENT_INSTALL_APPLICATION_BEGIN = 9,
-
-    // Install Setup events.
-    // No longer used - EVENT_SETUP_INSTALL_BEGIN = 10,
-    // No longer used - EVENT_SETUP_INSTALL_COMPLETE = 11,
-
-    // Update Events.
-    // The Update Event = 3 above is used for update completion.
-    EVENT_UPDATE_APPLICATION_BEGIN = 12,
-    EVENT_UPDATE_DOWNLOAD_START = 13,
-    EVENT_UPDATE_DOWNLOAD_FINISH = 14,
-    EVENT_UPDATE_INSTALLER_START = 15,
-
-    // Self-update Setup events.
-    // No longer used - EVENT_SETUP_UPDATE_BEGIN = 16,
-    // No longer used - EVENT_SETUP_UPDATE_COMPLETE = 17,
-
-    // Ping when installed via /registerproduct.
-    EVENT_REGISTER_PRODUCT_COMPLETE = 20,
-
-    // Ping when an end user first boots a new system with an OEM-installed app.
-    EVENT_INSTALL_OEM_FIRST_CHECK = 30,
-
-    // App Command Events
-    EVENT_APP_COMMAND_BEGIN = 40,
-    EVENT_APP_COMMAND_COMPLETE = 41,
-
-    // Failure report events - not part of the normal flow.
-    // No longer used - EVENT_SETUP_INSTALL_FAILURE = 100,
-    // No longer used - EVENT_GOOPDATE_DLL_FAILURE = 101,
-    // No longer used - EVENT_SETUP_COM_SERVER_FAILURE = 102,
-    // No longer used - EVENT_SETUP_UPDATE_FAILURE = 103,
-  };
-
-  // When updating this enum, also update the identical one in
-  // omaha_extensions.proto.
-  // These values get reported to the server, so do not change existing ones.
-  enum Results {
-    EVENT_RESULT_ERROR = 0,
-    EVENT_RESULT_SUCCESS = 1,
-    EVENT_RESULT_SUCCESS_REBOOT = 2,
-    //  EVENT_RESULT_SUCCESS_RESTART_BROWSER = 3,
-    EVENT_RESULT_CANCELLED = 4,
-    EVENT_RESULT_INSTALLER_ERROR_MSI = 5,
-    EVENT_RESULT_INSTALLER_ERROR_OTHER = 6,
-    //  EVENT_RESULT_NOUPDATE = 7,
-    EVENT_RESULT_INSTALLER_ERROR_SYSTEM = 8,
-    EVENT_RESULT_UPDATE_DEFERRED = 9,
-    EVENT_RESULT_HANDOFF_ERROR = 10,
-  };
-
-  PingEvent(Types type,
-            Results result,
-            int error_code,
-            int extra_code1)
-      : event_type_(type),
-        event_result_(result),
-        error_code_(error_code),
-        extra_code1_(extra_code1) {
-    ASSERT1(EVENT_UNKNOWN != event_type_);
-  }
-  virtual ~PingEvent() {}
-
-  virtual HRESULT ToXml(IXMLDOMNode* parent_node) const;
-  virtual CString ToString() const;
-
- private:
-  const Types event_type_;
-  const Results event_result_;
-  const int error_code_;
-  const int extra_code1_;
-};
-
-typedef shared_ptr<const PingEvent> PingEventPtr;
-typedef std::vector<PingEventPtr> PingEventVector;
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_PING_EVENT_H_
-
diff --git a/common/ping_test.cc b/common/ping_test.cc
deleted file mode 100644
index f073f7e..0000000
--- a/common/ping_test.cc
+++ /dev/null
@@ -1,366 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <string.h>
-#include "omaha/base/string.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/command_line.h"
-#include "omaha/common/ping.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-class PingTest : public testing::Test {
-};
-
-TEST_F(PingTest, BuildOmahaPing) {
-  PingEventPtr ping_event1(
-      new PingEvent(PingEvent::EVENT_INSTALL_COMPLETE,
-                    PingEvent::EVENT_RESULT_SUCCESS,
-                    10,
-                    20));
-
-  PingEventPtr ping_event2(
-      new PingEvent(PingEvent::EVENT_INSTALL_COMPLETE,
-                    PingEvent::EVENT_RESULT_SUCCESS,
-                    30,
-                    40));
-
-  CommandLineExtraArgs command_line_extra_args;
-  StringToGuidSafe(_T("{DE06587E-E5AB-4364-A46B-F3AC733007B3}"),
-                   &command_line_extra_args.installation_id);
-  command_line_extra_args.brand_code = _T("GGLS");
-  command_line_extra_args.client_id  = _T("a client id");
-  command_line_extra_args.language   = _T("en");
-
-  // Machine ping.
-  Ping install_ping(true, _T("session"), _T("oneclick"));
-  install_ping.LoadAppDataFromExtraArgs(command_line_extra_args);
-  install_ping.BuildOmahaPing(_T("1.0.0.0"),
-                              _T("2.0.0.0"),
-                              ping_event1,
-                              ping_event2);
-
-  CString expected_ping_request_substring;
-  expected_ping_request_substring.Format(_T("<app appid=\"{430FD4D0-B729-4F61-AA34-91526481799D}\" version=\"1.0.0.0\" nextversion=\"2.0.0.0\" lang=\"en\" brand=\"GGLS\" client=\"a client id\" iid=\"{DE06587E-E5AB-4364-A46B-F3AC733007B3}\"><event eventtype=\"2\" eventresult=\"1\" errorcode=\"10\" extracode1=\"20\"/><event eventtype=\"2\" eventresult=\"1\" errorcode=\"30\" extracode1=\"40\"/></app>"));  // NOLINT
-
-  CString actual_ping_request;
-  install_ping.BuildRequestString(&actual_ping_request);
-
-  // The ping_request_string contains some data that depends on the machine
-  // environment, such as operating system version. Look for a partial match in
-  // the string corresponding to the <app> element.
-  EXPECT_NE(-1, actual_ping_request.Find(expected_ping_request_substring));
-}
-
-TEST_F(PingTest, BuildAppsPing) {
-  const TCHAR* const kOmahaUserClientStatePath =
-      _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-      _T("\\ClientState\\") GOOPDATE_APP_ID;
-
-  const CString expected_pv           = _T("1.3.23.0");
-  const CString expected_lang         = _T("en");
-  const CString expected_brand_code   = _T("GGLS");
-  const CString expected_client_id    = _T("someclientid");
-  const CString expected_iid          =
-      _T("{7C0B6E56-B24B-436b-A960-A6EA201E886F}");
-  const CString expected_experiment_label =
-      _T("some_experiment=a|Fri, 14 Aug 2015 16:13:03 GMT");
-
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaUserClientStatePath,
-                                            kRegValueProductVersion,
-                                            expected_pv));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaUserClientStatePath,
-                                            kRegValueLanguage,
-                                            expected_lang));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaUserClientStatePath,
-                                            kRegValueBrandCode,
-                                            expected_brand_code));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaUserClientStatePath,
-                                            kRegValueClientId,
-                                            expected_client_id));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaUserClientStatePath,
-                                            kRegValueInstallationId,
-                                            expected_iid));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaUserClientStatePath,
-                                            kRegValueExperimentLabels,
-                                            expected_experiment_label));
-
-  PingEventPtr ping_event(
-      new PingEvent(PingEvent::EVENT_INSTALL_COMPLETE,
-                    PingEvent::EVENT_RESULT_SUCCESS,
-                    34,
-                    6));
-
-  Ping apps_ping(false, _T("unittest"), _T("InstallSource_Foo"));
-  std::vector<CString> apps;
-  apps.push_back(GOOPDATE_APP_ID);
-  apps_ping.LoadAppDataFromRegistry(apps);
-  apps_ping.BuildAppsPing(ping_event);
-
-  CString expected_ping_request_substring;
-  expected_ping_request_substring.Format(_T("<app appid=\"{430FD4D0-B729-4F61-AA34-91526481799D}\" version=\"1.3.23.0\" nextversion=\"\" lang=\"en\" brand=\"GGLS\" client=\"someclientid\" experiments=\"some_experiment=a|Fri, 14 Aug 2015 16:13:03 GMT\" iid=\"{7C0B6E56-B24B-436b-A960-A6EA201E886F}\"><event eventtype=\"2\" eventresult=\"1\" errorcode=\"34\" extracode1=\"6\"/></app>"));  // NOLINT
-
-  CString actual_ping_request;
-  apps_ping.BuildRequestString(&actual_ping_request);
-
-  EXPECT_NE(-1, actual_ping_request.Find(expected_ping_request_substring));
-}
-
-TEST_F(PingTest, SendString) {
-  CString request_string = _T("<?xml version=\"1.0\" encoding=\"UTF-8\"?><request protocol=\"3.0\" version=\"1.3.23.0\" ismachine=\"1\" sessionid=\"unittest\" installsource=\"oneclick\" testsource=\"dev\" requestid=\"{EC821C33-E4EE-4E75-BC85-7E9DFC3652F5}\" periodoverridesec=\"7407360\"><os platform=\"win\" version=\"6.0\" sp=\"Service Pack 1\"/><app appid=\"{430FD4D0-B729-4F61-AA34-91526481799D}\" version=\"1.0.0.0\" nextversion=\"2.0.0.0\" lang=\"en\" brand=\"GGLS\" client=\"a client id\" iid=\"{DE06587E-E5AB-4364-A46B-F3AC733007B3}\"><event eventtype=\"10\" eventresult=\"1\" errorcode=\"0\" extracode1=\"0\"/></app></request>");   // NOLINT
-  EXPECT_HRESULT_SUCCEEDED(Ping::SendString(false,
-                                            HeadersVector(),
-                                            request_string));
-
-  // 400 Bad Request returned by the server.
-  EXPECT_EQ(0x80042190, Ping::SendString(false, HeadersVector(), _T("")));
-}
-
-TEST_F(PingTest, HandlePing) {
-  CString request_string = _T("<?xml version=\"1.0\" encoding=\"UTF-8\"?><request protocol=\"3.0\" version=\"1.3.23.0\" ismachine=\"1\" sessionid=\"unittest\" installsource=\"oneclick\" testsource=\"dev\" requestid=\"{EC821C33-E4EE-4E75-BC85-7E9DFC3652F5}\" periodoverridesec=\"7407360\"><os platform=\"win\" version=\"6.0\" sp=\"Service Pack 1\"/><app appid=\"{430FD4D0-B729-4F61-AA34-91526481799D}\" version=\"1.0.0.0\" nextversion=\"2.0.0.0\" lang=\"en\" brand=\"GGLS\" client=\"a client id\" iid=\"{DE06587E-E5AB-4364-A46B-F3AC733007B3}\"><event eventtype=\"10\" eventresult=\"1\" errorcode=\"0\" extracode1=\"0\"/></app></request>");   // NOLINT
-
-  CStringA request_string_utf8(WideToUtf8(request_string));
-  CStringA ping_string_utf8;
-  WebSafeBase64Escape(request_string_utf8, &ping_string_utf8);
-
-  EXPECT_HRESULT_SUCCEEDED(
-      Ping::HandlePing(false, Utf8ToWideChar(ping_string_utf8,
-                                             ping_string_utf8.GetLength())));
-
-  // 400 Bad Request returned by the server.
-  EXPECT_EQ(0x80042190, Ping::HandlePing(false, _T("")));
-}
-
-TEST_F(PingTest, SendInProcess) {
-  PingEventPtr ping_event(
-      new PingEvent(PingEvent::EVENT_INSTALL_COMPLETE,
-                    PingEvent::EVENT_RESULT_SUCCESS,
-                    0,
-                    0));
-
-  CommandLineExtraArgs command_line_extra_args;
-  StringToGuidSafe(_T("{DE06587E-E5AB-4364-A46B-F3AC733007B3}"),
-                   &command_line_extra_args.installation_id);
-  command_line_extra_args.brand_code = _T("GGLS");
-  command_line_extra_args.client_id  = _T("a client id");
-  command_line_extra_args.language   = _T("en");
-
-  // User ping.
-  Ping install_ping(false, _T("unittest"), _T("oneclick"));
-  install_ping.LoadAppDataFromExtraArgs(command_line_extra_args);
-  install_ping.BuildOmahaPing(_T("1.0.0.0"), _T("2.0.0.0"), ping_event);
-
-  CString request_string;
-  EXPECT_HRESULT_SUCCEEDED(install_ping.BuildRequestString(&request_string));
-  EXPECT_HRESULT_SUCCEEDED(install_ping.SendInProcess(request_string));
-}
-
-TEST_F(PingTest, IsPingExpired_PastTime) {
-  const time64 time = GetCurrent100NSTime() - (Ping::kPingExpiry100ns + 1);
-  EXPECT_TRUE(Ping::IsPingExpired(time));
-}
-
-TEST_F(PingTest, IsPingExpired_CurrentTime) {
-  const time64 time = GetCurrent100NSTime();
-  EXPECT_FALSE(Ping::IsPingExpired(time));
-}
-
-TEST_F(PingTest, IsPingExpired_FutureTime) {
-  const time64 time = GetCurrent100NSTime() + 10;
-  EXPECT_TRUE(Ping::IsPingExpired(time));
-}
-
-TEST_F(PingTest, LoadPersistedPings_NoPersistedPings) {
-  Ping::PingsVector pings;
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            Ping::LoadPersistedPings(false, &pings));
-  EXPECT_EQ(0, pings.size());
-}
-
-TEST_F(PingTest, LoadPersistedPings) {
-  CString ping_reg_path(Ping::GetPingRegPath(false));
-
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(ping_reg_path,
-                                            _T("1"),
-                                            _T("Test Ping String 1")));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(ping_reg_path,
-                                            _T("2"),
-                                            _T("Test Ping String 2")));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(ping_reg_path,
-                                            _T("3"),
-                                            _T("Test Ping String 3")));
-
-  Ping::PingsVector pings;
-  EXPECT_HRESULT_SUCCEEDED(Ping::LoadPersistedPings(false, &pings));
-  EXPECT_EQ(3, pings.size());
-
-  EXPECT_EQ(1, pings[0].first);
-  EXPECT_EQ(2, pings[1].first);
-  EXPECT_EQ(3, pings[2].first);
-  EXPECT_STREQ(_T("Test Ping String 1"), pings[0].second);
-  EXPECT_STREQ(_T("Test Ping String 2"), pings[1].second);
-  EXPECT_STREQ(_T("Test Ping String 3"), pings[2].second);
-
-  EXPECT_HRESULT_SUCCEEDED(RegKey::DeleteKey(ping_reg_path));
-}
-
-TEST_F(PingTest, PersistPing) {
-  EXPECT_HRESULT_SUCCEEDED(Ping::PersistPing(false, _T("Test Ping String 1")));
-  ::Sleep(15);
-  EXPECT_HRESULT_SUCCEEDED(Ping::PersistPing(false, _T("Test Ping String 2")));
-  ::Sleep(15);
-  EXPECT_HRESULT_SUCCEEDED(Ping::PersistPing(false, _T("Test Ping String 3")));
-
-  Ping::PingsVector pings;
-  EXPECT_HRESULT_SUCCEEDED(Ping::LoadPersistedPings(false, &pings));
-  EXPECT_EQ(3, pings.size());
-
-  EXPECT_FALSE(Ping::IsPingExpired(pings[0].first));
-  EXPECT_FALSE(Ping::IsPingExpired(pings[1].first));
-  EXPECT_FALSE(Ping::IsPingExpired(pings[2].first));
-  EXPECT_STREQ(_T("Test Ping String 1"), pings[0].second);
-  EXPECT_STREQ(_T("Test Ping String 2"), pings[1].second);
-  EXPECT_STREQ(_T("Test Ping String 3"), pings[2].second);
-
-  EXPECT_HRESULT_SUCCEEDED(RegKey::DeleteKey(Ping::GetPingRegPath(false)));
-}
-
-TEST_F(PingTest, DeletePersistedPing) {
-  CString ping_reg_path(Ping::GetPingRegPath(false));
-
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(ping_reg_path,
-                                            _T("1"),
-                                            _T("Test Ping String 1")));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(ping_reg_path,
-                                            _T("2"),
-                                            _T("Test Ping String 2")));
-
-  EXPECT_HRESULT_SUCCEEDED(Ping::DeletePersistedPing(false, 1));
-  EXPECT_HRESULT_SUCCEEDED(Ping::DeletePersistedPing(false, 2));
-
-  EXPECT_FALSE(RegKey::HasKey(ping_reg_path));
-}
-
-TEST_F(PingTest, SendPersistedPings) {
-  PingEventPtr ping_event(
-      new PingEvent(PingEvent::EVENT_INSTALL_COMPLETE,
-                    PingEvent::EVENT_RESULT_SUCCESS,
-                    0,
-                    0));
-
-  CommandLineExtraArgs command_line_extra_args;
-  StringToGuidSafe(_T("{DE06587E-E5AB-4364-A46B-F3AC733007B3}"),
-                   &command_line_extra_args.installation_id);
-  command_line_extra_args.brand_code = _T("GGLS");
-  command_line_extra_args.client_id  = _T("a client id");
-  command_line_extra_args.language   = _T("en");
-
-  // User ping.
-  Ping install_ping(false, _T("unittest"), _T("oneclick"));
-  install_ping.LoadAppDataFromExtraArgs(command_line_extra_args);
-  install_ping.BuildOmahaPing(_T("1.0.0.0"), _T("2.0.0.0"), ping_event);
-
-  CString request_string;
-  EXPECT_HRESULT_SUCCEEDED(install_ping.BuildRequestString(&request_string));
-  EXPECT_HRESULT_SUCCEEDED(Ping::PersistPing(false, request_string));
-
-  EXPECT_HRESULT_SUCCEEDED(Ping::SendPersistedPings(false));
-
-  EXPECT_FALSE(RegKey::HasKey(Ping::GetPingRegPath(false)));
-}
-
-// The tests below rely on the out-of-process mechanism to send install pings.
-// Enable the test to debug the sending code.
-TEST_F(PingTest, DISABLED_SendUsingGoogleUpdate) {
-  PingEventPtr ping_event(
-      new PingEvent(PingEvent::EVENT_INSTALL_COMPLETE,
-                    PingEvent::EVENT_RESULT_SUCCESS,
-                    0,
-                    0));
-
-  CommandLineExtraArgs command_line_extra_args;
-  StringToGuidSafe(_T("{DE06587E-E5AB-4364-A46B-F3AC733007B3}"),
-                   &command_line_extra_args.installation_id);
-  command_line_extra_args.brand_code = _T("GGLS");
-  command_line_extra_args.client_id  = _T("a client id");
-  command_line_extra_args.language   = _T("en");
-
-  // User ping and wait for completion.
-  Ping install_ping(false, _T("unittest"), _T("oneclick"));
-  install_ping.LoadAppDataFromExtraArgs(command_line_extra_args);
-  install_ping.BuildOmahaPing(_T("1.0.0.0"), _T("2.0.0.0"), ping_event);
-
-  const int kWaitForPingProcessToCompleteMs = 60000;
-  CString request_string;
-  EXPECT_HRESULT_SUCCEEDED(install_ping.BuildRequestString(&request_string));
-  EXPECT_HRESULT_SUCCEEDED(install_ping.SendUsingGoogleUpdate(
-      request_string, kWaitForPingProcessToCompleteMs));
-}
-
-TEST_F(PingTest, Send_Empty) {
-  CommandLineExtraArgs command_line_extra_args;
-  Ping install_ping(false, _T("unittest"), _T("oneclick"));
-  EXPECT_EQ(S_FALSE, install_ping.Send(false));
-}
-
-TEST_F(PingTest, DISABLED_Send) {
-  PingEventPtr ping_event(
-      new PingEvent(PingEvent::EVENT_INSTALL_COMPLETE,
-                    PingEvent::EVENT_RESULT_SUCCESS,
-                    0,
-                    0));
-
-  CommandLineExtraArgs command_line_extra_args;
-  StringToGuidSafe(_T("{DE06587E-E5AB-4364-A46B-F3AC733007B3}"),
-                   &command_line_extra_args.installation_id);
-  command_line_extra_args.brand_code = _T("GGLS");
-  command_line_extra_args.client_id  = _T("a client id");
-  command_line_extra_args.language   = _T("en");
-
-  // User ping and wait for completion.
-  Ping install_ping(false, _T("unittest"), _T("oneclick"));
-  install_ping.LoadAppDataFromExtraArgs(command_line_extra_args);
-  install_ping.BuildOmahaPing(_T("1.0.0.0"), _T("2.0.0.0"), ping_event);
-
-  EXPECT_HRESULT_SUCCEEDED(install_ping.Send(false));
-}
-
-TEST_F(PingTest, DISABLED_SendFireAndForget) {
-  PingEventPtr ping_event(
-      new PingEvent(PingEvent::EVENT_INSTALL_COMPLETE,
-                    PingEvent::EVENT_RESULT_SUCCESS,
-                    0,
-                    0));
-
-  CommandLineExtraArgs command_line_extra_args;
-  StringToGuidSafe(_T("{DE06587E-E5AB-4364-A46B-F3AC733007B3}"),
-                   &command_line_extra_args.installation_id);
-  command_line_extra_args.brand_code = _T("GGLS");
-  command_line_extra_args.client_id  = _T("a client id");
-  command_line_extra_args.language   = _T("en");
-
-  // User ping and do not wait for completion.
-  Ping install_ping(false, _T("unittest"), _T("oneclick"));
-  install_ping.LoadAppDataFromExtraArgs(command_line_extra_args);
-  install_ping.BuildOmahaPing(_T("1.0.0.0"), _T("2.0.0.0"), ping_event);
-
-  EXPECT_HRESULT_SUCCEEDED(install_ping.Send(true));
-}
-
-}  // namespace omaha
-
diff --git a/common/progress_sampler.h b/common/progress_sampler.h
deleted file mode 100644
index 18d8b41..0000000
--- a/common/progress_sampler.h
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_PROGRESS_SAMPLER_H_
-#define OMAHA_COMMON_PROGRESS_SAMPLER_H_
-
-#include <windows.h>
-#include <algorithm>
-#include <queue>
-#include "omaha/base/debug.h"
-#include "omaha/base/time.h"
-
-namespace omaha {
-
-// This class keeps track of the input data (samples) and helps to calculate
-// the average progress based on that.
-//
-// Example usage:
-//   // Create a sampler that keep samples within last 500ms and calculates
-//   // average progress only if minimum time range 100ms is reached.
-//   ProgressSampler<int> progress_sampler(500, 100);
-//   ASSERT1(!progress_sampler.HasEnoughSamples());
-//
-//   progress_sampler.AddSample(0, 100);
-//   ASSERT1(!progress_sampler.HasEnoughSamples());
-//
-//   progress_sampler.AddSample(20, 200);
-//   // Minimum time range 100ms has not been reached yet.
-//   ASSERT1(!progress_sampler.HasEnoughSamples());
-//
-//   progress_sampler.AddSample(200, 300);
-//   ASSERT1(progress_sampler.HasEnoughSamples());
-//   // Samples in queue: [(0, 100), (20, 200), (200, 300)].
-//   // Average speed: (300-100) / (200-0) = 1.
-//   ASSERT1(1 == progress_sampler.GetAverageProgressPerMs());
-//
-//   progress_sampler.AddSample(520, 450);
-//   // The first sample value was added at timeline 0 is now out of
-//   // range (500ms) and thus discarded.
-//   // Samples in queue now: [(20, 200), (200, 300), [520, 450)].
-//   // Average speed: (520-20) / (450-200) = 2.
-//   ASSERT1(2 == progress_sampler.GetAverageProgressPerMs());
-template<typename T> class ProgressSampler {
- public:
-  ProgressSampler(int sample_time_range_ms, int minimum_range_required_ms)
-      : sample_time_range_ms_(sample_time_range_ms),
-        minimum_range_required_ms_(minimum_range_required_ms) {
-      ASSERT1(minimum_range_required_ms > 0);
-  }
-
-  void AddSampleWithCurrentTimeStamp(T sample_value) {
-    AddSample(GetCurrent100NSTime() / kMillisecsTo100ns, sample_value);
-  }
-
-  void AddSample(uint64 timestamp_in_ms, T sample_value) {
-    if (!samples_.empty() &&
-        (sample_value < samples_.back().value ||          // Value regression.
-         timestamp_in_ms < samples_.back().timestamp)) {  // Clock regression.
-      Reset();
-      return;
-    }
-
-    samples_.push(Sample(timestamp_in_ms, sample_value));
-
-    // Discard old data that is out of range.
-    while (samples_.back().timestamp - samples_.front().timestamp >
-           sample_time_range_ms_ && samples_.size() > 2) {
-      samples_.pop();
-    }
-  }
-
-  bool HasEnoughSamples() const {
-    if (samples_.size() < 2) {
-      return false;
-    }
-
-    ASSERT1(samples_.back().timestamp >= samples_.front().timestamp);
-    return (samples_.back().timestamp - samples_.front().timestamp >
-            minimum_range_required_ms_);
-  }
-
-  T GetAverageProgressPerMs() const {
-    if (!HasEnoughSamples()) {
-      return kUnknownProgressPerMs;
-    }
-
-    uint64 time_diff = samples_.back().timestamp - samples_.front().timestamp;
-    ASSERT1(time_diff > 0);
-    return (samples_.back().value - samples_.front().value) /
-            static_cast<T>(time_diff);
-  }
-
-  void Reset() {
-    std::queue<Sample> empty_queue;
-    std::swap(samples_, empty_queue);
-  }
-
-  static const T kUnknownProgressPerMs = static_cast<T>(-1);
-
- private:
-  const uint64 sample_time_range_ms_;
-  const uint64 minimum_range_required_ms_;
-
-  struct Sample {
-    Sample(uint64 local_timestamp, T local_value)
-        : timestamp(local_timestamp), value(local_value) {
-    }
-
-    uint64  timestamp;
-    T value;
-  };
-  std::queue<Sample> samples_;
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_PROGRESS_SAMPLER_H_
diff --git a/common/protocol_definition.h b/common/protocol_definition.h
deleted file mode 100644
index 34f8295..0000000
--- a/common/protocol_definition.h
+++ /dev/null
@@ -1,241 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Definitions for the request and response data structures that are part of
-// the xml protocol. Each attribute or element that occurs in the xml protocol
-// has a definition here. The request and response xml artifacts are defined
-// inside their corresponding namespaces.
-
-#ifndef OMAHA_COMMON_PROTOCOL_DEFINITION_H_
-#define OMAHA_COMMON_PROTOCOL_DEFINITION_H_
-
-#include <vector>
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/install_manifest.h"
-#include "omaha/common/ping_event.h"
-
-namespace omaha {
-
-namespace xml {
-
-namespace request {
-
-// Defines the structure of the Omaha protocol update request.
-// The structure of the request is:
-//
-// Request | --- OS
-//         | -<- App | --- UpdateCheck
-//                   | --- Data
-//                   | --- Ping
-//                   | -<- PingEvent
-//
-// The xml parser traverses this data structure in order to serialize it. The
-// names of the members of structures closely match the names of the elements
-// and attributes in the xml document.
-//
-// TODO(omaha): briefly document the members.
-
-struct OS {
-  CString platform;
-  CString version;
-  CString service_pack;
-  CString arch;
-};
-
-struct UpdateCheck {
-  UpdateCheck() : is_valid(false), is_update_disabled(false) {}
-
-  // TODO(omaha): this member is not serialized. Use pointers to indicate
-  // optional elements instead of is_valid.
-  bool is_valid;
-
-  bool is_update_disabled;
-
-  CString tt_token;
-};
-
-// For now, only a single "install" data is supported.
-struct Data {
-  CString install_data_index;
-};
-
-// didrun element. The element is named "ping" for legacy reasons.
-struct Ping {
-  Ping() : active(ACTIVE_UNKNOWN),
-           days_since_last_active_ping(0),
-           days_since_last_roll_call(0) {}
-
-  ActiveStates active;
-  int days_since_last_active_ping;
-  int days_since_last_roll_call;
-};
-
-struct App {
-    App() : install_time_diff_sec(0) {}
-
-    CString app_id;
-
-    CString version;
-
-    CString next_version;
-
-    CString ap;
-
-    CString lang;
-
-    CString iid;
-
-    CString brand_code;
-
-    CString client_id;
-
-    CString experiments;
-
-    int install_time_diff_sec;
-
-    // Optional update check.
-    UpdateCheck update_check;
-
-    // Optional data.
-    Data data;
-
-    // Optional 'did run' ping.
-    Ping ping;
-
-    // Progress/result pings.
-    PingEventVector ping_events;
-  };
-
-struct Request {
-  Request() : is_machine(false), check_period_sec(-1) {}
-
-  bool is_machine;
-
-  CString uid;
-
-  CString protocol_version;
-
-  CString omaha_version;
-
-  CString install_source;
-
-  CString origin_url;
-
-  // Identifies the source of the request as a test/production prober system.
-  CString test_source;
-
-  // Unique identifier for this request, used to associate the same request
-  // received multiple times on the server.
-  CString request_id;
-
-  // Unique identifier for this session, used to correlate multiple requests
-  // associated with a single operation by the Omaha client.
-  CString session_id;
-
-  // Time between update checks in seconds.
-  // TODO(omaha): see if we can enforce by convention that -1 means it is
-  // using the default value.
-  int check_period_sec;
-
-  OS os;
-
-  std::vector<App> apps;
-};
-
-}  // namespace request
-
-namespace response {
-
-// Defines an Omaha protocol update response. The structure of the response is:
-//
-// Response | --- DayStart
-//          | -<- App | --- UpdateCheck | --- Urls
-//                                      | --- InstallManifest | --- Packages
-//                                                            | --- Actions
-//                    | --- Data
-//                    | --- Ping
-//                    | -<- Event
-//
-// The xml parser traverses the xml dom and populates the data members of
-// the response. The names of the members of structures closely match the names
-// of the elements and attributes in the xml document.
-//
-// TODO(omaha): briefly document the members.
-
-struct UpdateCheck {
-  CString status;
-
-  CString tt_token;
-
-  CString error_url;         // URL describing error.
-
-  std::vector<CString> urls;
-
-  InstallManifest install_manifest;
-};
-
-// For now, only a single "install" data is supported.
-struct Data {
-  CString status;
-
-  CString install_data_index;
-  CString install_data;
-};
-
-struct Ping {
-  CString status;
-};
-
-struct Event {
-  CString status;
-};
-
-struct App {
-  CString status;
-
-  // TODO(omaha): rename to app_id.
-  CString appid;
-
-  CString experiments;
-
-  UpdateCheck update_check;
-
-  std::vector<Data> data;
-
-  Ping ping;
-
-  std::vector<Event> events;
-};
-
-struct DayStart {
-  DayStart() : elapsed_seconds(0) {}
-
-  int elapsed_seconds;
-};
-
-struct Response {
-  CString protocol;
-  DayStart day_start;
-  std::vector<App> apps;
-};
-
-}  // namespace response
-
-}  // namespace xml
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_PROTOCOL_DEFINITION_H_
-
diff --git a/common/protocol_definition_test.cc b/common/protocol_definition_test.cc
deleted file mode 100644
index bb69599..0000000
--- a/common/protocol_definition_test.cc
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-#include "omaha/common/protocol_definition.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(XmlRequestPingTest, ConstructorDefaultValue) {
-  xml::request::Ping ping;
-
-  const bool was_active = ping.active == ACTIVE_RUN;
-  const bool need_active = ping.active != ACTIVE_UNKNOWN;
-  const bool has_sent_a_today = ping.days_since_last_active_ping == 0;
-  const bool need_a = was_active && !has_sent_a_today;
-  const bool need_r = ping.days_since_last_roll_call != 0;
-
-  EXPECT_FALSE(need_active);
-  EXPECT_FALSE(need_a);
-  EXPECT_FALSE(need_r);
-}
-
-}  // namespace omaha
diff --git a/common/scheduled_task_utils.cc b/common/scheduled_task_utils.cc
deleted file mode 100644
index f922f13..0000000
--- a/common/scheduled_task_utils.cc
+++ /dev/null
@@ -1,1076 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "omaha/common/scheduled_task_utils.h"
-#include "omaha/common/scheduled_task_utils_internal.h"
-#include <corerror.h>
-#include <lmcons.h>
-#include <lmsname.h>
-#include <mstask.h>
-#include <atlsecurity.h>
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/scoped_ptr_cotask.h"
-#include "omaha/base/service_utils.h"
-#include "omaha/base/string.h"
-#include "omaha/base/system_info.h"
-#include "omaha/base/time.h"
-#include "omaha/base/timer.h"
-#include "omaha/base/user_info.h"
-#include "omaha/base/utils.h"
-#include "omaha/client/resource.h"
-#include "omaha/common/command_line_builder.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/goopdate_utils.h"
-
-namespace omaha {
-
-namespace scheduled_task_utils {
-
-namespace internal {
-
-CString GetCurrentTaskNameCore(bool is_machine) {
-  UTIL_LOG(L3, (_T("[GetCurrentTaskNameCore][%d]"), is_machine));
-
-  CString default_name(GetDefaultGoopdateTaskName(is_machine,
-                                                  COMMANDLINE_MODE_CORE));
-  return goopdate_utils::GetCurrentVersionedName(is_machine,
-                                                 kRegValueTaskNameC,
-                                                 default_name);
-}
-
-HRESULT CreateAndSetVersionedTaskNameCoreInRegistry(
-    bool is_machine) {
-  UTIL_LOG(L3, (_T("[CreateAndSetVersionedTaskNameCoreInRegistry][%d]"),
-                is_machine));
-
-  CString default_name(GetDefaultGoopdateTaskName(is_machine,
-                                                  COMMANDLINE_MODE_CORE));
-  return goopdate_utils::CreateAndSetVersionedNameInRegistry(
-             is_machine,
-             default_name,
-             kRegValueTaskNameC);
-}
-
-CString GetCurrentTaskNameUA(bool is_machine) {
-  UTIL_LOG(L3, (_T("[GetCurrentTaskNameUA][%d]"), is_machine));
-
-  CString default_name(GetDefaultGoopdateTaskName(is_machine,
-                                                  COMMANDLINE_MODE_UA));
-  return goopdate_utils::GetCurrentVersionedName(is_machine,
-                                                 kRegValueTaskNameUA,
-                                                 default_name);
-}
-
-HRESULT CreateAndSetVersionedTaskNameUAInRegistry(bool machine) {
-  UTIL_LOG(L3, (_T("[CreateAndSetVersionedTaskNameUAInRegistry][%d]"),
-                machine));
-
-  CString default_name(GetDefaultGoopdateTaskName(machine,
-                                                  COMMANDLINE_MODE_UA));
-  return goopdate_utils::CreateAndSetVersionedNameInRegistry(
-             machine,
-             default_name,
-             kRegValueTaskNameUA);
-}
-
-bool IsInstalledScheduledTask(const TCHAR* task_name) {
-  ASSERT1(task_name && *task_name);
-
-  CComPtr<ITaskScheduler> scheduler;
-  HRESULT hr = scheduler.CoCreateInstance(CLSID_CTaskScheduler,
-                                          NULL,
-                                          CLSCTX_INPROC_SERVER);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITaskScheduler.CoCreateInstance failed][0x%x]"), hr));
-    return false;
-  }
-
-  CComPtr<ITask> task;
-  hr = scheduler->Activate(task_name,
-                           __uuidof(ITask),
-                           reinterpret_cast<IUnknown**>(&task));
-
-  UTIL_LOG(L3, (_T("[IsInstalledScheduledTask returned][0x%x]"), hr));
-  return COR_E_FILENOTFOUND == hr ? false : true;
-}
-
-DWORD GetScheduledTaskPriority(const TCHAR* task_name) {
-  ASSERT1(task_name && *task_name);
-
-  CComPtr<ITaskScheduler> scheduler;
-  HRESULT hr = scheduler.CoCreateInstance(CLSID_CTaskScheduler,
-                                          NULL,
-                                          CLSCTX_INPROC_SERVER);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITaskScheduler.CoCreateInstance failed][0x%x]"), hr));
-    return 0;
-  }
-
-  CComPtr<ITask> task;
-  hr = scheduler->Activate(task_name,
-                           __uuidof(ITask),
-                           reinterpret_cast<IUnknown**>(&task));
-
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[GetScheduledTaskPriority][Activate failed][0x%x]"), hr));
-    return 0;
-  }
-
-  DWORD priority = 0;
-  hr = task->GetPriority(&priority);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITask.GetMostRecentRunTime failed][0x%x]"), hr));
-    return 0;
-  }
-
-  ASSERT1(priority);
-  return priority;
-}
-
-bool HasScheduledTaskEverRun(const TCHAR* task_name) {
-  ASSERT1(task_name && *task_name);
-
-  CComPtr<ITaskScheduler> scheduler;
-  HRESULT hr = scheduler.CoCreateInstance(CLSID_CTaskScheduler,
-                                          NULL,
-                                          CLSCTX_INPROC_SERVER);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITaskScheduler.CoCreateInstance failed][0x%x]"), hr));
-    return false;
-  }
-
-  CComPtr<ITask> task;
-  hr = scheduler->Activate(task_name,
-                           __uuidof(ITask),
-                           reinterpret_cast<IUnknown**>(&task));
-
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[HasScheduledTaskEverRun][Activate failed][0x%x]"), hr));
-    return false;
-  }
-
-  SYSTEMTIME recent_run_time = {0};
-  hr = task->GetMostRecentRunTime(&recent_run_time);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITask.GetMostRecentRunTime failed][0x%x]"), hr));
-    return false;
-  }
-
-  // hr == SCHED_S_TASK_HAS_NOT_RUN if the task has never run.
-  return hr == S_OK;
-}
-
-HRESULT GetScheduledTaskStatus(const TCHAR* task_name) {
-  ASSERT1(task_name && *task_name);
-
-  CComPtr<ITaskScheduler> scheduler;
-  HRESULT hr = scheduler.CoCreateInstance(CLSID_CTaskScheduler,
-                                          NULL,
-                                          CLSCTX_INPROC_SERVER);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITaskScheduler.CoCreateInstance failed][0x%x]"), hr));
-    return hr;
-  }
-
-  CComPtr<ITask> task;
-  hr = scheduler->Activate(task_name,
-                           __uuidof(ITask),
-                           reinterpret_cast<IUnknown**>(&task));
-
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[GetScheduledTaskStatus: Activate failed][0x%x]"), hr));
-    return hr;
-  }
-
-  HRESULT task_status(S_OK);
-  hr = task->GetStatus(&task_status);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITask.GetStatus failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return task_status;
-}
-
-HRESULT GetScheduledTaskExitCode(const TCHAR* task_name) {
-  ASSERT1(task_name && *task_name);
-
-  CComPtr<ITaskScheduler> scheduler;
-  HRESULT hr = scheduler.CoCreateInstance(CLSID_CTaskScheduler,
-                                          NULL,
-                                          CLSCTX_INPROC_SERVER);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITaskScheduler.CoCreateInstance failed][0x%x]"), hr));
-    return hr;
-  }
-
-  CComPtr<ITask> task;
-  hr = scheduler->Activate(task_name,
-                           __uuidof(ITask),
-                           reinterpret_cast<IUnknown**>(&task));
-
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITask.Activate failed][0x%x]"), hr));
-    return hr;
-  }
-
-  DWORD exit_code(0);
-  hr = task->GetExitCode(&exit_code);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITask.GetExitCode failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return hr == SCHED_S_TASK_HAS_NOT_RUN ? hr : exit_code;
-}
-
-HRESULT StartScheduledTask(const TCHAR* task_name) {
-  ASSERT1(task_name && *task_name);
-
-  if (v2::IsTaskScheduler2APIAvailable()) {
-    return v2::StartScheduledTask(task_name);
-  }
-
-  if (GetScheduledTaskStatus(task_name) == SCHED_S_TASK_RUNNING) {
-    return S_OK;
-  }
-
-  CComPtr<ITaskScheduler> scheduler;
-  HRESULT hr = scheduler.CoCreateInstance(CLSID_CTaskScheduler,
-                                          NULL,
-                                          CLSCTX_INPROC_SERVER);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITaskScheduler.CoCreateInstance failed][0x%x]"), hr));
-    return hr;
-  }
-
-  CComPtr<ITask> task;
-  hr = scheduler->Activate(task_name,
-                           __uuidof(ITask),
-                           reinterpret_cast<IUnknown**>(&task));
-
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITaskScheduler.Activate failed][0x%x]"), hr));
-    return hr;
-  }
-
-  hr = task->Run();
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITask.Run failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return hr;
-}
-
-HRESULT StopScheduledTask(const TCHAR* task_name) {
-  ASSERT1(task_name && *task_name);
-
-  if (v2::IsTaskScheduler2APIAvailable()) {
-    return v2::StopScheduledTask(task_name);
-  }
-
-  if (GetScheduledTaskStatus(task_name) != SCHED_S_TASK_RUNNING) {
-    return S_OK;
-  }
-
-  CComPtr<ITaskScheduler> scheduler;
-  HRESULT hr = scheduler.CoCreateInstance(CLSID_CTaskScheduler,
-                                          NULL,
-                                          CLSCTX_INPROC_SERVER);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITaskScheduler.CoCreateInstance failed][0x%x]"), hr));
-    return hr;
-  }
-
-  CComPtr<ITask> task;
-  hr = scheduler->Activate(task_name,
-                           __uuidof(ITask),
-                           reinterpret_cast<IUnknown**>(&task));
-
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITaskScheduler.Activate failed][0x%x]"), hr));
-    return hr;
-  }
-
-  hr = task->Terminate();
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITask.Run failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return hr;
-}
-
-HRESULT CreateLogonTrigger(ITask* task) {
-  ASSERT1(task);
-
-  CComPtr<ITaskTrigger> trigger;
-  WORD index = 0;
-
-  // Create a trigger to run on every user logon.
-  HRESULT hr = task->CreateTrigger(&index, &trigger);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITask.CreateTrigger failed][0x%x]"), hr));
-    return hr;
-  }
-
-  TASK_TRIGGER trigger_config = {0};
-  trigger_config.cbTriggerSize = sizeof(trigger_config);
-  // These are required parameters. A past start date is good.
-  trigger_config.wBeginDay = 1;
-  trigger_config.wBeginMonth = 1;
-  trigger_config.wBeginYear = 1999;
-
-  // Run on every user logon.
-  trigger_config.TriggerType = TASK_EVENT_TRIGGER_AT_LOGON;
-
-  hr = trigger->SetTrigger(&trigger_config);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITaskTrigger.SetTrigger failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT CreatePeriodicTrigger(ITask* task, bool create_hourly_trigger) {
-  ASSERT1(task);
-
-  CComPtr<ITaskTrigger> trigger;
-  WORD index = 0;
-
-  // Create a trigger to run every day.
-  HRESULT hr = task->CreateTrigger(&index, &trigger);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITask.CreateTrigger failed][0x%x]"), hr));
-    return hr;
-  }
-
-  // Start time set to 5 minutes from the current time.
-  time64 start_time = GetCurrent100NSTime() + (5 * kMinsTo100ns);
-  SYSTEMTIME sys_time = Time64ToSystemTime(start_time);
-  SYSTEMTIME locale_time = {0};
-  hr = SystemTimeToTzSpecificLocalTime(NULL, &sys_time, &locale_time);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[SystemTimeToTzSpecificLocalTime failed][0x%x]"), hr));
-    return hr;
-  }
-
-  TASK_TRIGGER trigger_config = {0};
-  trigger_config.cbTriggerSize = sizeof(trigger_config);
-  trigger_config.wBeginYear = locale_time.wYear;
-  trigger_config.wBeginMonth = locale_time.wMonth;
-  trigger_config.wBeginDay = locale_time.wDay;
-  trigger_config.wStartHour = locale_time.wHour;
-  trigger_config.wStartMinute = locale_time.wMinute;
-
-  trigger_config.TriggerType = TASK_TIME_TRIGGER_DAILY;
-  trigger_config.Type.Daily.DaysInterval = 1;  // every 1 day
-
-  if (create_hourly_trigger) {
-    // The task will be run daily at 24 hour intervals. And the task will be
-    // repeated every au_timer_interval_minutes within a single 24 hour
-    // interval.
-    const DWORD kTaskTrigger24HoursDuration = 24 * 60;
-    int au_timer_interval_minutes =
-        ConfigManager::Instance()->GetAutoUpdateTimerIntervalMs() / (60 * 1000);
-    ASSERT1(au_timer_interval_minutes > 0 &&
-            au_timer_interval_minutes < kTaskTrigger24HoursDuration);
-
-    trigger_config.MinutesDuration = kTaskTrigger24HoursDuration;
-    trigger_config.MinutesInterval = au_timer_interval_minutes;
-  }
-
-  hr = trigger->SetTrigger(&trigger_config);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITaskTrigger.SetTrigger failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT CreateScheduledTask(ITask* task,
-                            const TCHAR* task_path,
-                            const TCHAR* task_parameters,
-                            const TCHAR* task_comment,
-                            bool is_machine,
-                            bool create_logon_trigger,
-                            bool create_daily_trigger,
-                            bool create_hourly_trigger) {
-  ASSERT1(task);
-  ASSERT1(task_path && *task_path);
-  ASSERT1(task_parameters);
-  ASSERT1(task_comment && *task_comment);
-  ASSERT1(create_logon_trigger || create_daily_trigger);
-  ASSERT1(!create_logon_trigger || (create_logon_trigger && is_machine));
-  ASSERT1(!create_hourly_trigger ||
-          (create_hourly_trigger && create_daily_trigger));
-
-  UTIL_LOG(L3, (_T("[CreateScheduledTask][%s][%s][%d]"),
-                task_path, task_parameters, is_machine));
-
-  HRESULT hr = task->SetApplicationName(task_path);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITask.SetApplicationName failed][0x%x]"), hr));
-    return hr;
-  }
-
-  hr = task->SetParameters(task_parameters);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITask.SetParameters failed][0x%x]"), hr));
-    return hr;
-  }
-
-  hr = task->SetComment(task_comment);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITask.SetComment failed][0x%x]"), hr));
-    return hr;
-  }
-
-  if (is_machine) {
-    // Run using SYSTEM credentials, by passing in an empty username string.
-    hr = task->SetAccountInformation(_T(""), NULL);
-  } else {
-    // Run as current user.
-    // For the user task, we set TASK_FLAG_RUN_ONLY_IF_LOGGED_ON, so that we do
-    // not need the user password for task creation.
-    hr = task->SetFlags(TASK_FLAG_RUN_ONLY_IF_LOGGED_ON);
-    if (FAILED(hr)) {
-      UTIL_LOG(LE, (_T("[ITask.SetFlags failed][0x%x]"), hr));
-      return hr;
-    }
-
-    CString user_name;
-    DWORD buffer_size = UNLEN + 1;
-    if (!::GetUserName(CStrBuf(user_name, buffer_size), &buffer_size)) {
-      hr = HRESULTFromLastError();
-      UTIL_LOG(LE, (_T("[::GetUserName failed][0x%x]"), hr));
-      return hr;
-    }
-    hr = task->SetAccountInformation(user_name, NULL);
-  }
-
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITask.SetAccountInformation failed][0x%x]"), hr));
-    return hr;
-  }
-
-  // The default is to run for a finite number of days. We want to run
-  // indefinitely.
-  // Due to a bug introduced in Vista, and propogated to Windows 7, setting the
-  // MaxRunTime to INFINITE results in the task only running for 72 hours. For
-  // these operating systems, setting the RunTime to "INFINITE - 1" gets the
-  // desired behavior of allowing an "infinite" run of the task.
-  DWORD max_time = INFINITE - (SystemInfo::IsRunningOnVistaOrLater() ? 1 : 0);
-  hr = task->SetMaxRunTime(max_time);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITask.SetMaxRunTime failed][0x%x]"), hr));
-    return hr;
-  }
-
-  CComPtr<ITaskTrigger> trigger;
-  WORD index = 0;
-
-  if (create_logon_trigger && is_machine) {
-    // Create a trigger to run on every user logon. Non-admin users are not able
-    // to create logon triggers, so we create only for machine.
-    hr = CreateLogonTrigger(task);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  if (create_daily_trigger) {
-    hr = CreatePeriodicTrigger(task, create_hourly_trigger);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  // Save task.
-  CComQIPtr<IPersistFile> persist(task);
-  if (!persist) {
-    hr = E_NOINTERFACE;
-    UTIL_LOG(LE, (_T("[ITask.QueryInterface IPersistFile failed][0x%x]"), hr));
-    return hr;
-  }
-
-  hr = persist->Save(NULL, TRUE);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[IPersistFile.Save failed][0x%x]"), hr));
-    return hr;
-  }
-
-  if (is_machine) {
-    return S_OK;
-  }
-
-  // Adjust privileges to explicitly allow the current user to be able to
-  // manipulate this task. User applications, and consequently, Omaha, can be
-  // installed in an elevated mode. This can happen, for instance, if the user
-  // installs on XP, then upgrades to Vista. Or chooses "Run as Administrator"
-  // when running the meta-installer on Vista. Subsequently, Omaha running at
-  // medium integrity needs to be able to manipulate the installed task.
-  scoped_ptr_cotask<OLECHAR> job_file;
-  hr = persist->GetCurFile(address(job_file));
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[IPersistFile.GetCurFile failed][0x%x]"), hr));
-    return hr;
-  }
-
-  persist.Release();
-
-  CAccessToken token;
-  CSid current_sid;
-  if (!token.GetEffectiveToken(TOKEN_QUERY) || !token.GetUser(&current_sid)) {
-    hr = HRESULTFromLastError();
-    UTIL_LOG(LE, (_T("[Failed to get current user sid][0x%x]"), hr));
-    return hr;
-  }
-
-  hr = AddAllowedAce(job_file.get(),
-                     SE_FILE_OBJECT,
-                     current_sid,
-                     FILE_ALL_ACCESS,
-                     0);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[Could not adjust DACL][%s][0x%x]"), job_file.get(), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT UpgradeScheduledTask(const TCHAR* task_name,
-                             const TCHAR* task_path,
-                             const TCHAR* task_parameters,
-                             const TCHAR* task_comment,
-                             bool is_machine,
-                             bool create_logon_trigger,
-                             bool create_daily_trigger,
-                             bool create_hourly_trigger) {
-  ASSERT1(task_name && *task_name);
-  ASSERT1(IsInstalledScheduledTask(task_name));
-
-  UTIL_LOG(L3, (_T("[UpgradeScheduledTask][%s][%s][%s][%d]"),
-                task_name, task_path, task_parameters, is_machine));
-
-  // TODO(Omaha): Perhaps pass the ITaskScheduler around where possible.
-  CComPtr<ITaskScheduler> scheduler;
-  HRESULT hr = scheduler.CoCreateInstance(CLSID_CTaskScheduler,
-                                          NULL,
-                                          CLSCTX_INPROC_SERVER);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITaskScheduler.CoCreateInstance failed][0x%x]"), hr));
-    return hr;
-  }
-
-  CComPtr<ITask> task;
-  hr = scheduler->Activate(task_name,
-                           __uuidof(ITask),
-                           reinterpret_cast<IUnknown**>(&task));
-
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[UpgradeScheduledTask][Activate failed][0x%x]"), hr));
-    return hr;
-  }
-
-  // Delete existing triggers. CreateScheduledTask() will recreate them anew.
-  WORD trigger_count(0);
-  hr = task->GetTriggerCount(&trigger_count);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITaskScheduler.GetTriggerCount failed][0x%x]"), hr));
-    return hr;
-  }
-
-  for (int i = 0; i < trigger_count; ++i) {
-    hr = task->DeleteTrigger(0);
-    if (FAILED(hr)) {
-      UTIL_LOG(LE, (_T("[ITaskScheduler.DeleteTrigger failed][0x%x]"), hr));
-      return hr;
-    }
-  }
-
-  return CreateScheduledTask(task,
-                             task_path,
-                             task_parameters,
-                             task_comment,
-                             is_machine,
-                             create_logon_trigger,
-                             create_daily_trigger,
-                             create_hourly_trigger);
-}
-
-// TODO(Omaha): Change the apis to avoid specifying hourly and daily triggers.
-HRESULT InstallScheduledTask(const TCHAR* task_name,
-                             const TCHAR* task_path,
-                             const TCHAR* task_parameters,
-                             const TCHAR* task_comment,
-                             bool is_machine,
-                             bool create_logon_trigger,
-                             bool create_daily_trigger,
-                             bool create_hourly_trigger) {
-  if (IsInstalledScheduledTask(task_name)) {
-    return UpgradeScheduledTask(task_name,
-                                task_path,
-                                task_parameters,
-                                task_comment,
-                                is_machine,
-                                create_logon_trigger,
-                                create_daily_trigger,
-                                create_hourly_trigger);
-  }
-
-  CComPtr<ITaskScheduler> scheduler;
-  HRESULT hr = scheduler.CoCreateInstance(CLSID_CTaskScheduler,
-                                          NULL,
-                                          CLSCTX_INPROC_SERVER);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITaskScheduler.CoCreateInstance failed][0x%x]"), hr));
-    return hr;
-  }
-
-  CComPtr<ITask> task;
-  hr = scheduler->NewWorkItem(task_name,
-                              CLSID_CTask,
-                              __uuidof(ITask),
-                              reinterpret_cast<IUnknown**>(&task));
-
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITaskScheduler.NewWorkItem failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return CreateScheduledTask(task,
-                             task_path,
-                             task_parameters,
-                             task_comment,
-                             is_machine,
-                             create_logon_trigger,
-                             create_daily_trigger,
-                             create_hourly_trigger);
-}
-
-HRESULT UninstallScheduledTask(const TCHAR* task_name) {
-  ASSERT1(task_name && *task_name);
-
-  CComPtr<ITaskScheduler> scheduler;
-  HRESULT hr = scheduler.CoCreateInstance(CLSID_CTaskScheduler,
-                                          NULL,
-                                          CLSCTX_INPROC_SERVER);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITaskScheduler.CoCreateInstance failed][0x%x]"), hr));
-    return hr;
-  }
-
-  // Stop the task before deleting it. Ignore return value.
-  VERIFY1(SUCCEEDED(StopScheduledTask(task_name)));
-
-  // delete the task.
-  hr = scheduler->Delete(task_name);
-  if (FAILED(hr) && COR_E_FILENOTFOUND != hr) {
-    UTIL_LOG(LE, (_T("[GetScheduledTaskStatus][Delete failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT UninstallScheduledTasks(const TCHAR* task_prefix) {
-  ASSERT1(task_prefix && *task_prefix);
-
-  CComPtr<ITaskScheduler> scheduler;
-  HRESULT hr = scheduler.CoCreateInstance(CLSID_CTaskScheduler,
-                                          NULL,
-                                          CLSCTX_INPROC_SERVER);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITaskScheduler.CoCreateInstance failed][0x%x]"), hr));
-    return hr;
-  }
-
-  CComPtr<IEnumWorkItems> enum_items;
-  hr = scheduler->Enum(&enum_items);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITaskScheduler.Enum failed][0x%x]"), hr));
-    return hr;
-  }
-
-  TCHAR** task_names = NULL;
-  DWORD task_count = 0;
-  while (enum_items->Next(1, &task_names, &task_count) == S_OK) {
-    ASSERT1(task_count == 1);
-    scoped_co_task_ptr task_names_guard(task_names);
-    scoped_co_task_ptr task_name_guard(task_names[0]);
-
-    if (String_StartsWith(task_names[0], task_prefix, true)) {
-      UninstallScheduledTask(task_names[0]);
-    }
-  }
-
-  return S_OK;
-}
-
-// Returns the task name Omaha used to install in Omaha 1.2.x.
-CString GetOmaha1LegacyTaskName(bool is_machine) {
-  const TCHAR* const kLegacyOmaha1TaskNameMachine = _T("GoogleUpdateTask");
-  const TCHAR* const kLegacyOmaha1TaskNameUser = _T("GoogleUpdateTaskUser");
-  return is_machine ? kLegacyOmaha1TaskNameMachine : kLegacyOmaha1TaskNameUser;
-}
-
-// Returns the task name Omaha used to install in Omaha 2 before the
-// "GoogleUpdate.exe does not run all the time" refactoring.
-CString GetOmaha2LegacyTaskName(bool is_machine) {
-  const TCHAR* kLegacyOmaha2TaskNameUserPrefix = _T("GoogleUpdateTaskUser");
-  const TCHAR* kLegacyOmaha2TaskNameMachine = _T("GoogleUpdateTaskMachine");
-  if (is_machine) {
-    return kLegacyOmaha2TaskNameMachine;
-  }
-
-  CString task_name_user = kLegacyOmaha2TaskNameUserPrefix;
-  CString user_sid;
-  VERIFY1(SUCCEEDED(user_info::GetProcessUser(NULL, NULL, &user_sid)));
-  task_name_user += user_sid;
-  return task_name_user;
-}
-
-HRESULT WaitForTaskStatus(const TCHAR* task_name, HRESULT status, int time_ms) {
-  int kSleepBetweenRetriesMs = 100;
-  Timer timer(true);
-  while (timer.GetMilliseconds() < time_ms) {
-    if (GetScheduledTaskStatus(task_name) == status) {
-      return status;
-    }
-    ::Sleep(kSleepBetweenRetriesMs);
-  }
-  return GetScheduledTaskStatus(task_name);
-}
-
-namespace v2 {
-
-bool IsTaskScheduler2APIAvailable() {
-  CComPtr<ITaskService> task_service;
-  return SUCCEEDED(task_service.CoCreateInstance(CLSID_TaskScheduler,
-                                                 NULL,
-                                                 CLSCTX_INPROC_SERVER));
-}
-
-HRESULT GetRegisteredTask(const TCHAR* task_name, IRegisteredTask** task) {
-  ASSERT1(IsTaskScheduler2APIAvailable());
-  ASSERT1(task_name && *task_name);
-  ASSERT1(task);
-
-  CComPtr<ITaskService> task_service;
-  HRESULT hr = task_service.CoCreateInstance(CLSID_TaskScheduler,
-                                             NULL,
-                                             CLSCTX_INPROC_SERVER);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITaskService.CoCreateInstance failed][0x%x]"), hr));
-    return hr;
-  }
-
-  hr = task_service->Connect(CComVariant(), CComVariant(),
-                             CComVariant(), CComVariant());
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ITaskService::Connect failed][0x%x]"), hr));
-    return hr;
-  }
-
-  CComPtr<ITaskFolder> task_folder;
-  hr = task_service->GetFolder(CComBSTR(_T("\\")) , &task_folder);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[Cannot get Root Folder pointer][0x%x]"), hr));
-    return hr;
-  }
-
-  CComPtr<IRegisteredTask> registered_task;
-  hr = task_folder->GetTask(CComBSTR(task_name), &registered_task);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[Cannot get the registered task][0x%x]"), hr));
-    return hr;
-  }
-
-  *task = registered_task.Detach();
-  return S_OK;
-}
-
-bool IsScheduledTaskRunning(const TCHAR* task_name) {
-  ASSERT1(IsTaskScheduler2APIAvailable());
-  ASSERT1(task_name && *task_name);
-
-  CComPtr<IRegisteredTask> registered_task;
-  HRESULT hr = GetRegisteredTask(task_name, &registered_task);
-  if (FAILED(hr)) {
-    return false;
-  }
-
-  CComPtr<IRunningTaskCollection> running_task_collection;
-  hr = registered_task->GetInstances(0, &running_task_collection);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[IRegisteredTask.GetInstances failed][0x%x]"), hr));
-    return false;
-  }
-
-  long count = 0;
-  hr = running_task_collection->get_Count(&count);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[IRunningTaskCollection.get_Count failed][0x%x]"), hr));
-    return false;
-  }
-
-  return count > 0;
-}
-
-HRESULT StartScheduledTask(const TCHAR* task_name) {
-  ASSERT1(IsTaskScheduler2APIAvailable());
-  ASSERT1(task_name && *task_name);
-
-  if (IsScheduledTaskRunning(task_name)) {
-    return S_OK;
-  }
-
-  CComPtr<IRegisteredTask> registered_task;
-  HRESULT hr = GetRegisteredTask(task_name, &registered_task);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = registered_task->Run(CComVariant(), NULL);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[IRegisteredTask.Run failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return hr;
-}
-
-HRESULT StopScheduledTask(const TCHAR* task_name) {
-  ASSERT1(IsTaskScheduler2APIAvailable());
-  ASSERT1(task_name && *task_name);
-
-  if (!IsScheduledTaskRunning(task_name)) {
-    return S_OK;
-  }
-
-  CComPtr<IRegisteredTask> registered_task;
-  HRESULT hr = GetRegisteredTask(task_name, &registered_task);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CComPtr<IRunningTaskCollection> running_task_collection;
-  hr = registered_task->GetInstances(0, &running_task_collection);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[IRegisteredTask.GetInstances failed][0x%x]"), hr));
-    return hr;
-  }
-
-  long count = 0;
-  hr = running_task_collection->get_Count(&count);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[IRunningTaskCollection.get_Count failed][0x%x]"), hr));
-    return hr;
-  }
-
-  if (count <= 0) {
-    return S_OK;
-  }
-
-  for (long i = 0; i < count; ++i) {
-    CComPtr<IRunningTask> running_task;
-    hr = running_task_collection->get_Item(CComVariant(i+1), &running_task);
-    if (FAILED(hr)) {
-      UTIL_LOG(LE, (_T("[IRunningTaskCollection.get_Item][%d][0x%x]"), i, hr));
-      return hr;
-    }
-
-    hr = running_task->Stop();
-    if (FAILED(hr)) {
-      UTIL_LOG(LE, (_T("[IRunningTask.Stop failed][%d][0x%x]"), i, hr));
-      return hr;
-    }
-  }
-
-  return S_OK;
-}
-
-}  // namespace v2
-
-}  // namespace internal
-
-CString GetDefaultGoopdateTaskName(bool is_machine, CommandLineMode mode) {
-  ASSERT1(mode == COMMANDLINE_MODE_CORE || mode == COMMANDLINE_MODE_UA);
-
-  CString task_name;
-  if (is_machine) {
-    task_name = kScheduledTaskNameMachinePrefix;
-  } else {
-    task_name = kScheduledTaskNameUserPrefix;
-    CString user_sid;
-    VERIFY1(SUCCEEDED(user_info::GetProcessUser(NULL, NULL, &user_sid)));
-    task_name += user_sid;
-  }
-
-  task_name += (mode == COMMANDLINE_MODE_CORE) ? kScheduledTaskNameCoreSuffix :
-                                                 kScheduledTaskNameUASuffix;
-  return task_name;
-}
-
-HRESULT InstallGoopdateTaskForMode(const TCHAR* task_path,
-                                   bool is_machine,
-                                   CommandLineMode mode) {
-  ASSERT1(mode == COMMANDLINE_MODE_CORE || mode == COMMANDLINE_MODE_UA);
-
-  CommandLineBuilder builder(mode);
-  if (mode == COMMANDLINE_MODE_UA) {
-    builder.set_install_source(kCmdLineInstallSource_Scheduler);
-  }
-  const CString task_parameters = builder.GetCommandLineArgs();
-
-  CString company_name;
-  VERIFY1(company_name.LoadString(IDS_FRIENDLY_COMPANY_NAME));
-  CString task_description;
-  task_description.FormatMessage(IDS_SCHEDULED_TASK_DESCRIPTION, company_name);
-
-  CString task_name(mode == COMMANDLINE_MODE_CORE ?
-                    internal::GetCurrentTaskNameCore(is_machine) :
-                    internal::GetCurrentTaskNameUA(is_machine));
-  if (internal::IsInstalledScheduledTask(task_name)) {
-    HRESULT hr = internal::InstallScheduledTask(task_name,
-                                                task_path,
-                                                task_parameters,
-                                                task_description,
-                                                is_machine,
-                                                mode == COMMANDLINE_MODE_CORE &&
-                                                is_machine,
-                                                true,
-                                                mode == COMMANDLINE_MODE_UA);
-
-    if (SUCCEEDED(hr)) {
-      return hr;
-    }
-
-    // Try to uninstall the task that we failed to upgrade. Then create a new
-    // task name, and fall through to install that.
-    internal::UninstallScheduledTask(task_name);
-    if (mode == COMMANDLINE_MODE_CORE) {
-      VERIFY1(SUCCEEDED(
-      internal::CreateAndSetVersionedTaskNameCoreInRegistry(is_machine)));
-      task_name = internal::GetCurrentTaskNameCore(is_machine);
-    } else {
-      VERIFY1(SUCCEEDED(
-      internal::CreateAndSetVersionedTaskNameUAInRegistry(is_machine)));
-      task_name = internal::GetCurrentTaskNameUA(is_machine);
-    }
-    ASSERT1(!internal::IsInstalledScheduledTask(task_name));
-  }
-
-  return internal::InstallScheduledTask(task_name,
-                                        task_path,
-                                        task_parameters,
-                                        task_description,
-                                        is_machine,
-                                        mode == COMMANDLINE_MODE_CORE &&
-                                        is_machine,
-                                        true,
-                                        mode == COMMANDLINE_MODE_UA);
-}
-
-HRESULT InstallGoopdateTasks(const TCHAR* task_path, bool is_machine) {
-  HRESULT hr = InstallGoopdateTaskForMode(task_path,
-                                          is_machine,
-                                          COMMANDLINE_MODE_CORE);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return InstallGoopdateTaskForMode(task_path, is_machine, COMMANDLINE_MODE_UA);
-}
-
-HRESULT UninstallGoopdateTasks(bool is_machine) {
-  VERIFY1(SUCCEEDED(internal::UninstallScheduledTask(
-      internal::GetCurrentTaskNameCore(is_machine))));
-  VERIFY1(SUCCEEDED(internal::UninstallScheduledTask(
-      internal::GetCurrentTaskNameUA(is_machine))));
-
-  // Try to uninstall any tasks that we failed to update during a previous
-  // overinstall. It is possible that we fail to uninstall these again here.
-  VERIFY1(SUCCEEDED(internal::UninstallScheduledTasks(
-      scheduled_task_utils::GetDefaultGoopdateTaskName(is_machine,
-                                                 COMMANDLINE_MODE_CORE))));
-  VERIFY1(SUCCEEDED(internal::UninstallScheduledTasks(
-      scheduled_task_utils::GetDefaultGoopdateTaskName(is_machine,
-                                                 COMMANDLINE_MODE_UA))));
-  return S_OK;
-}
-
-HRESULT UninstallLegacyGoopdateTasks(bool is_machine) {
-  const CString& legacy_omaha1_task =
-      internal::GetOmaha1LegacyTaskName(is_machine);
-  VERIFY1(SUCCEEDED(internal::UninstallScheduledTask(legacy_omaha1_task)));
-
-  const CString& legacy_omaha2_task =
-      internal::GetOmaha2LegacyTaskName(is_machine);
-  VERIFY1(SUCCEEDED(internal::UninstallScheduledTask(legacy_omaha2_task)));
-
-  return S_OK;
-}
-
-HRESULT StartGoopdateTaskCore(bool is_machine) {
-  return internal::StartScheduledTask(
-             internal::GetCurrentTaskNameCore(is_machine));
-}
-
-bool IsInstalledGoopdateTaskUA(bool is_machine) {
-  return internal::IsInstalledScheduledTask(
-                             internal::GetCurrentTaskNameUA(is_machine));
-}
-
-bool IsDisabledGoopdateTaskUA(bool is_machine) {
-  const CString& task_name(internal::GetCurrentTaskNameUA(is_machine));
-  return internal::GetScheduledTaskStatus(task_name) == SCHED_S_TASK_DISABLED;
-}
-
-HRESULT GetExitCodeGoopdateTaskUA(bool is_machine) {
-  const CString& task_name(internal::GetCurrentTaskNameUA(is_machine));
-  return internal::GetScheduledTaskExitCode(task_name);
-}
-
-bool IsUATaskHealthy(bool is_machine) {
-  if (!ServiceUtils::IsServiceRunning(SERVICE_SCHEDULE)) {
-    UTIL_LOG(LW, (_T("[Task Scheduler Service is not running]")));
-    return false;
-  }
-
-  if (!IsInstalledGoopdateTaskUA(is_machine)) {
-    UTIL_LOG(LW, (_T("[UA Task not installed]")));
-    return false;
-  }
-
-  if (IsDisabledGoopdateTaskUA(is_machine)) {
-    UTIL_LOG(LW, (_T("[UA Task disabled]")));
-    return false;
-  }
-
-  return true;
-}
-
-}  // namespace scheduled_task_utils
-
-}  // namespace omaha
diff --git a/common/scheduled_task_utils.h b/common/scheduled_task_utils.h
deleted file mode 100644
index f669618..0000000
--- a/common/scheduled_task_utils.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_SCHEDULED_TASK_UTILS_H_
-#define OMAHA_COMMON_SCHEDULED_TASK_UTILS_H_
-
-#include <windows.h>
-#include <atlstr.h>
-// TODO(omaha3): Try to avoid depending on goopdate command line in these files.
-// If Omaha 3 ends up needing multiple tasks, consider using a bool or
-// task-specific enum instead.
-#include "omaha/common/command_line.h"
-
-namespace omaha {
-
-namespace scheduled_task_utils {
-
-// This method will return the default scheduled task name. This default value
-// is also used as the prefix for generating unique task names.
-CString GetDefaultGoopdateTaskName(bool is_machine, CommandLineMode mode);
-
-HRESULT InstallGoopdateTasks(const TCHAR* task_path, bool is_machine);
-HRESULT UninstallGoopdateTasks(bool is_machine);
-HRESULT UninstallLegacyGoopdateTasks(bool is_machine);
-HRESULT StartGoopdateTaskCore(bool is_machine);
-bool IsInstalledGoopdateTaskUA(bool is_machine);
-bool IsDisabledGoopdateTaskUA(bool is_machine);
-HRESULT GetExitCodeGoopdateTaskUA(bool is_machine);
-bool IsUATaskHealthy(bool is_machine);
-
-}  // namespace scheduled_task_utils
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_SCHEDULED_TASK_UTILS_H_
diff --git a/common/scheduled_task_utils_internal.h b/common/scheduled_task_utils_internal.h
deleted file mode 100644
index c7a5c2d..0000000
--- a/common/scheduled_task_utils_internal.h
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_SCHEDULED_TASK_UTILS_INTERNAL_H_
-#define OMAHA_COMMON_SCHEDULED_TASK_UTILS_INTERNAL_H_
-
-#include <windows.h>
-#include <taskschd.h>
-
-namespace omaha {
-
-namespace scheduled_task_utils {
-
-namespace internal {
-
-// Gets the current name, say "GoogleUpdateTaskMachineCore", of the
-// GoogleUpdateCore scheduled task, either from the registry, or a default
-// value if there is no registration.
-CString GetCurrentTaskNameCore(bool is_machine);
-
-// Creates a unique name, say "GoogleUpdateTaskMachineCore1c9b3d6baf90df3", of
-// the GoogleUpdateCore scheduled task, and stores it in the registry.
-// Subsequent invocations of GetCurrentTaskNameCore() will return this new
-// value.
-HRESULT CreateAndSetVersionedTaskNameCoreInRegistry(bool machine);
-
-// Gets the current name, say "GoogleUpdateTaskMachineUA", of the
-// GoogleUpdateUA scheduled task, either from the registry, or a default value
-// if there is no registration.
-CString GetCurrentTaskNameUA(bool is_machine);
-
-// Creates a unique name, say "GoogleUpdateTaskMachineUA1c9b3d6baf90df3", of
-// the GoogleUpdateUA scheduled task, and stores it in the registry.
-// Subsequent invocations of GetCurrentTaskNameUA() will return this new
-// value.
-HRESULT CreateAndSetVersionedTaskNameUAInRegistry(bool machine);
-
-// Installs a scheduled task. The task will run as either as SYSTEM or the
-// current user. The task will be triggered at each user logon, and/or
-// fixed intervals.
-HRESULT InstallScheduledTask(const TCHAR* task_name,
-                             const TCHAR* task_path,
-                             const TCHAR* task_parameters,
-                             const TCHAR* task_comment,
-                             bool is_machine,
-                             bool create_logon_trigger,
-                             bool create_daily_trigger,
-                             bool create_hourly_trigger);
-
-// Deletes a scheduled task.
-HRESULT UninstallScheduledTask(const TCHAR* task_name);
-
-// Deletes all scheduled tasks with the given prefix.
-HRESULT UninstallScheduledTasks(const TCHAR* task_prefix);
-
-// Runs a scheduled task immediately.
-HRESULT StartScheduledTask(const TCHAR* task_name);
-
-// Returns true if the scheduled task exists.
-bool IsInstalledScheduledTask(const TCHAR* task_name);
-
-// Returns the priority at which the scheduled task process will run. Returns 0
-// on failure.
-DWORD GetScheduledTaskPriority(const TCHAR* task_name);
-
-// Returns true if the scheduled task ever ran.
-bool HasScheduledTaskEverRun(const TCHAR* task_name);
-
-// Returns a status code on success. List of status codes at
-// http://msdn2.microsoft.com/en-us/library/aa381263.aspx
-HRESULT GetScheduledTaskStatus(const TCHAR* task_name);
-
-// Stops the task if it is already running.
-HRESULT StopScheduledTask(const TCHAR* task_name);
-
-// Waits for the task to change its status to the specified status value and
-// returns the status of the task. If the status did not change within the
-// time, it returns the status of the task at the end of the wait.
-HRESULT WaitForTaskStatus(const TCHAR* task_name, HRESULT status, int time_ms);
-
-namespace v2 {
-
-// Task Scheduler 2.0 API helpers.
-bool IsTaskScheduler2APIAvailable();
-HRESULT GetRegisteredTask(const TCHAR* task_name, IRegisteredTask** task);
-bool IsScheduledTaskRunning(const TCHAR* task_name);
-HRESULT StartScheduledTask(const TCHAR* task_name);
-HRESULT StopScheduledTask(const TCHAR* task_name);
-
-}  // namespace v2
-
-}  // namespace internal
-
-}  // namespace scheduled_task_utils
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_SCHEDULED_TASK_UTILS_INTERNAL_H_
-
diff --git a/common/scheduled_task_utils_unittest.cc b/common/scheduled_task_utils_unittest.cc
deleted file mode 100644
index 8c921ed..0000000
--- a/common/scheduled_task_utils_unittest.cc
+++ /dev/null
@@ -1,304 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-#include <atlstr.h>
-#include <mstask.h>
-#include "omaha/base/app_util.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/path.h"
-#include "omaha/base/scoped_ptr_cotask.h"
-#include "omaha/base/user_info.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/scheduled_task_utils.h"
-#include "omaha/common/scheduled_task_utils_internal.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-const int kMaxWaitForProcessMs                  = 120000;
-
-const TCHAR kLongRunningProcessesRelativePath[] =
-    _T("unittest_support\\does_not_shutdown\\GoogleUpdate.exe");
-
-CString GetLongRunningProcessPath() {
-  const CString module_dir(app_util::GetCurrentModuleDirectory());
-  return ConcatenatePath(module_dir, kLongRunningProcessesRelativePath);
-}
-
-}  // namespace
-
-namespace scheduled_task_utils {
-
-using internal::GetCurrentTaskNameCore;
-using internal::GetCurrentTaskNameUA;
-using internal::GetScheduledTaskStatus;
-using internal::HasScheduledTaskEverRun;
-using internal::StartScheduledTask;
-using internal::StopScheduledTask;
-using internal::WaitForTaskStatus;
-
-namespace v2 = internal::v2;
-
-using vista_util::IsUserAdmin;
-
-namespace internal {
-
-void StopScheduledTaskAndVerifyReadyState(const CString& task_name) {
-  // For some reason, StopScheduleTask may not successfully stop the task
-  // even it returns S_OK. So try to stop multiple times.
-  for (int i = 0; i < 3; ++i) {
-    EXPECT_SUCCEEDED(StopScheduledTask(task_name));
-
-    if (SCHED_S_TASK_READY == WaitForTaskStatus(task_name,
-                                                SCHED_S_TASK_READY,
-                                                kMsPerSec)) {
-      break;
-    }
-  }
-  EXPECT_EQ(SCHED_S_TASK_READY, GetScheduledTaskStatus(task_name));
-}
-
-TEST(ScheduledTaskUtilsTest, ScheduledTasks) {
-  const TCHAR kSchedTestTaskName[]            = _T("TestScheduledTask");
-  const TCHAR kScheduledTaskExecutable[]      = _T("netstat.exe");
-  const TCHAR kScheduledTaskParameters[]      = _T("20");
-  const TCHAR kSchedTestTaskComment[]         = _T("Google Test Task");
-
-  const CString task_path = ConcatenatePath(app_util::GetSystemDir(),
-                                            kScheduledTaskExecutable);
-  // Install/uninstall.
-  EXPECT_SUCCEEDED(InstallScheduledTask(kSchedTestTaskName,
-                                        task_path,
-                                        _T(""),
-                                        kSchedTestTaskComment,
-                                        IsUserAdmin(),
-                                        IsUserAdmin(),
-                                        true,
-                                        true));
-  EXPECT_SUCCEEDED(UninstallScheduledTask(kSchedTestTaskName));
-
-  // Calling InstallScheduledTask twice should succeed.
-  for (int i = 0; i < 2; ++i) {
-    EXPECT_SUCCEEDED(InstallScheduledTask(kSchedTestTaskName,
-                                          task_path,
-                                          _T(""),
-                                          kSchedTestTaskComment,
-                                          IsUserAdmin(),
-                                          IsUserAdmin(),
-                                          true,
-                                          true));
-  }
-
-  // "Upgrade" to a new version, which now has parameters.
-  EXPECT_SUCCEEDED(InstallScheduledTask(kSchedTestTaskName,
-                                        task_path,
-                                        kScheduledTaskParameters,
-                                        kSchedTestTaskComment,
-                                        IsUserAdmin(),
-                                        IsUserAdmin(),
-                                        true,
-                                        true));
-
-  EXPECT_FALSE(HasScheduledTaskEverRun(kSchedTestTaskName));
-
-  // Start and stop.
-  EXPECT_EQ(SCHED_S_TASK_HAS_NOT_RUN,
-            GetScheduledTaskStatus(kSchedTestTaskName));
-  EXPECT_SUCCEEDED(StartScheduledTask(kSchedTestTaskName));
-  EXPECT_EQ(SCHED_S_TASK_RUNNING,
-            WaitForTaskStatus(kSchedTestTaskName,
-                              SCHED_S_TASK_RUNNING,
-                              kMaxWaitForProcessMs));
-
-  EXPECT_TRUE(HasScheduledTaskEverRun(kSchedTestTaskName));
-
-  StopScheduledTaskAndVerifyReadyState(kSchedTestTaskName);
-
-  // Finally, uninstall.
-  EXPECT_SUCCEEDED(UninstallScheduledTask(kSchedTestTaskName));
-}
-
-TEST(ScheduledTaskUtilsTest, ScheduledTasksV2) {
-  if (!v2::IsTaskScheduler2APIAvailable()) {
-    std::wcout << _T("\tTest did not run because this OS does not support the ")
-                  _T("Task Scheduler 2.0 API.") << std::endl;
-    return;
-  }
-
-  const TCHAR kSchedTestTaskName[]            = _T("TestScheduledTaskV2");
-  const TCHAR kScheduledTaskExecutable[]      = _T("netstat.exe");
-  const TCHAR kScheduledTaskParameters[]      = _T("20");
-  const TCHAR kSchedTestTaskComment[]         = _T("Google Test Task V2");
-
-  const CString task_path = ConcatenatePath(app_util::GetSystemDir(),
-                                            kScheduledTaskExecutable);
-  EXPECT_SUCCEEDED(InstallScheduledTask(kSchedTestTaskName,
-                                        task_path,
-                                        _T(""),
-                                        kSchedTestTaskComment,
-                                        IsUserAdmin(),
-                                        IsUserAdmin(),
-                                        true,
-                                        true));
-
-  // Start and stop.
-  EXPECT_FALSE(v2::IsScheduledTaskRunning(kSchedTestTaskName));
-  EXPECT_SUCCEEDED(v2::StartScheduledTask(kSchedTestTaskName));
-  EXPECT_TRUE(v2::IsScheduledTaskRunning(kSchedTestTaskName));
-
-  EXPECT_SUCCEEDED(v2::StopScheduledTask(kSchedTestTaskName));
-  EXPECT_FALSE(v2::IsScheduledTaskRunning(kSchedTestTaskName));
-
-  // Finally, uninstall.
-  EXPECT_SUCCEEDED(UninstallScheduledTask(kSchedTestTaskName));
-}
-
-}  // namespace internal
-
-
-TEST(ScheduledTaskUtilsTest, GoopdateTasks) {
-  const CString task_name = GetCurrentTaskNameCore(IsUserAdmin());
-  const CString task_path = GetLongRunningProcessPath();
-
-  // Install/uninstall.
-  EXPECT_SUCCEEDED(InstallGoopdateTasks(task_path, IsUserAdmin()));
-  EXPECT_SUCCEEDED(UninstallGoopdateTasks(IsUserAdmin()));
-
-  EXPECT_SUCCEEDED(InstallGoopdateTasks(task_path, IsUserAdmin()));
-  EXPECT_FALSE(HasScheduledTaskEverRun(task_name));
-
-  // Start and stop.
-  EXPECT_EQ(SCHED_S_TASK_HAS_NOT_RUN, GetScheduledTaskStatus(task_name));
-  EXPECT_SUCCEEDED(StartGoopdateTaskCore(IsUserAdmin()));
-
-  EXPECT_EQ(SCHED_S_TASK_RUNNING,
-            WaitForTaskStatus(task_name,
-                              SCHED_S_TASK_RUNNING,
-                              kMaxWaitForProcessMs));
-
-  EXPECT_TRUE(HasScheduledTaskEverRun(task_name));
-
-  internal::StopScheduledTaskAndVerifyReadyState(task_name);
-
-  // Finally, uninstall.
-  EXPECT_SUCCEEDED(UninstallGoopdateTasks(IsUserAdmin()));
-}
-
-TEST(ScheduledTaskUtilsTest, GoopdateTaskInUseOverinstall) {
-  const CString task_path = GetLongRunningProcessPath();
-  EXPECT_SUCCEEDED(InstallGoopdateTasks(task_path, IsUserAdmin()));
-
-  CString original_task_name(GetCurrentTaskNameCore(IsUserAdmin()));
-
-  // Open the file underlying the current task in exclusive mode, so that
-  // InstallGoopdateTasks() is forced to create a new task.
-  CComPtr<ITaskScheduler> scheduler;
-  EXPECT_SUCCEEDED(scheduler.CoCreateInstance(CLSID_CTaskScheduler,
-                                              NULL,
-                                              CLSCTX_INPROC_SERVER));
-  CComPtr<ITask> task;
-  EXPECT_SUCCEEDED(scheduler->Activate(original_task_name,
-                                       __uuidof(ITask),
-                                       reinterpret_cast<IUnknown**>(&task)));
-  CComQIPtr<IPersistFile> persist(task);
-  EXPECT_TRUE(persist);
-  scoped_ptr_cotask<OLECHAR> job_file;
-  EXPECT_SUCCEEDED(persist->GetCurFile(address(job_file)));
-  persist.Release();
-
-  File file;
-  EXPECT_SUCCEEDED(file.OpenShareMode(job_file.get(), false, false, 0));
-
-  EXPECT_SUCCEEDED(InstallGoopdateTasks(task_path, IsUserAdmin()));
-  CString new_task_name(GetCurrentTaskNameCore(IsUserAdmin()));
-  EXPECT_STRNE(original_task_name, new_task_name);
-
-  // Cleanup.
-  file.Close();
-  EXPECT_SUCCEEDED(UninstallGoopdateTasks(IsUserAdmin()));
-}
-
-TEST(ScheduledTaskUtilsTest, GetExitCodeGoopdateTaskUA) {
-  const CString task_name = GetCurrentTaskNameUA(IsUserAdmin());
-  const CString task_path = ConcatenatePath(
-                                app_util::GetCurrentModuleDirectory(),
-                                _T("unittest_support\\SaveArguments.exe"));
-
-  EXPECT_SUCCEEDED(InstallGoopdateTasks(task_path, IsUserAdmin()));
-  EXPECT_EQ(SCHED_S_TASK_HAS_NOT_RUN,
-            GetExitCodeGoopdateTaskUA(IsUserAdmin()));
-  EXPECT_FALSE(HasScheduledTaskEverRun(task_name));
-
-  // Start the task and wait for it to run and become ready again. The task
-  // runs a program that returns right away. Sometimes the task does not run
-  // for unknown reason. Attempting to run the task multiple times does not
-  // work. This remains a flaky test.
-  EXPECT_SUCCEEDED(StartScheduledTask(task_name));
-  EXPECT_EQ(SCHED_S_TASK_READY,
-            WaitForTaskStatus(task_name,
-                              SCHED_S_TASK_READY,
-                              kMaxWaitForProcessMs));
-  EXPECT_TRUE(HasScheduledTaskEverRun(task_name));
-  EXPECT_EQ(S_OK, GetExitCodeGoopdateTaskUA(IsUserAdmin()));
-
-  EXPECT_SUCCEEDED(File::Remove(
-      ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                      _T("unittest_support\\saved_arguments.txt"))));
-  EXPECT_SUCCEEDED(UninstallGoopdateTasks(IsUserAdmin()));
-}
-
-TEST(ScheduledTaskUtilsTest, GetDefaultGoopdateTaskName_Core_Machine) {
-  CString expected_task_name(kScheduledTaskNameMachinePrefix);
-  expected_task_name += kScheduledTaskNameCoreSuffix;
-  EXPECT_STREQ(expected_task_name,
-               GetDefaultGoopdateTaskName(true, COMMANDLINE_MODE_CORE));
-}
-
-TEST(ScheduledTaskUtilsTest, GetDefaultGoopdateTaskName_Core_User) {
-  CString expected_task_name_user = kScheduledTaskNameUserPrefix;
-  CString user_sid;
-  EXPECT_SUCCEEDED(user_info::GetProcessUser(NULL, NULL, &user_sid));
-  expected_task_name_user += user_sid;
-  expected_task_name_user += kScheduledTaskNameCoreSuffix;
-  EXPECT_STREQ(expected_task_name_user,
-               GetDefaultGoopdateTaskName(false, COMMANDLINE_MODE_CORE));
-}
-
-TEST(ScheduledTaskUtilsTest, GetDefaultGoopdateTaskName_UA_Machine) {
-  CString expected_task_name(kScheduledTaskNameMachinePrefix);
-  expected_task_name += kScheduledTaskNameUASuffix;
-  EXPECT_STREQ(expected_task_name,
-               GetDefaultGoopdateTaskName(true, COMMANDLINE_MODE_UA));
-}
-
-TEST(ScheduledTaskUtilsTest, GetDefaultGoopdateTaskName_UA_User) {
-  CString expected_task_name_user = kScheduledTaskNameUserPrefix;
-  CString user_sid;
-  EXPECT_SUCCEEDED(user_info::GetProcessUser(NULL, NULL, &user_sid));
-  expected_task_name_user += user_sid;
-  expected_task_name_user += kScheduledTaskNameUASuffix;
-  EXPECT_STREQ(expected_task_name_user,
-               GetDefaultGoopdateTaskName(false, COMMANDLINE_MODE_UA));
-}
-
-}  // namespace scheduled_task_utils
-
-}  // namespace omaha
-
diff --git a/common/stats_uploader.cc b/common/stats_uploader.cc
deleted file mode 100644
index 9e41f11..0000000
--- a/common/stats_uploader.cc
+++ /dev/null
@@ -1,283 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/common/stats_uploader.h"
-#include <atlbase.h>
-#include <atlconv.h>
-#include <atlstr.h>
-#include <ctime>
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/scoped_impersonation.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vista_utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/net/network_config.h"
-#include "omaha/net/network_request.h"
-#include "omaha/net/simple_request.h"
-#include "omaha/statsreport/aggregator-win32.h"
-#include "omaha/statsreport/const-win32.h"
-#include "omaha/statsreport/formatter.h"
-#include "omaha/statsreport/metrics.h"
-#include "omaha/statsreport/persistent_iterator-win32.h"
-
-using stats_report::g_global_metrics;
-
-using stats_report::kCountsKeyName;
-using stats_report::kTimingsKeyName;
-using stats_report::kIntegersKeyName;
-using stats_report::kBooleansKeyName;
-using stats_report::kStatsKeyFormatString;
-using stats_report::kLastTransmissionTimeValueName;
-
-using stats_report::Formatter;
-using stats_report::MetricsAggregatorWin32;
-using stats_report::PersistentMetricsIteratorWin32;
-
-namespace omaha {
-
-namespace {
-
-HRESULT ResetPersistentMetrics(RegKey* key) {
-  ASSERT1(key);
-  HRESULT result = S_OK;
-  DWORD now_sec = static_cast<DWORD>(time(NULL));
-  HRESULT hr = key->SetValue(kLastTransmissionTimeValueName, now_sec);
-  if (FAILED(hr)) {
-    result = hr;
-  }
-  hr = key->DeleteSubKey(kCountsKeyName);
-  if (FAILED(hr)) {
-    result = hr;
-  }
-  hr = key->DeleteSubKey(kTimingsKeyName);
-  if (FAILED(hr)) {
-    result = hr;
-  }
-  hr = key->DeleteSubKey(kIntegersKeyName);
-  if (FAILED(hr)) {
-    result = hr;
-  }
-  hr = key->DeleteSubKey(kBooleansKeyName);
-  if (FAILED(hr)) {
-    result = hr;
-  }
-  return result;
-}
-
-// Returns S_OK without uploading in OEM mode.
-HRESULT UploadMetrics(bool is_machine,
-                      const TCHAR* extra_url_data,
-                      const TCHAR* content) {
-  ASSERT1(content);
-
-  CString uid = goopdate_utils::GetUserIdLazyInit(is_machine);
-
-  // Impersonate the user if the caller is machine, running as local system,
-  // and a user is logged on to the system.
-  scoped_handle impersonation_token(
-      goopdate_utils::GetImpersonationTokenForMachineProcess(is_machine));
-  scoped_impersonation impersonate_user(get(impersonation_token));
-
-  // Do not access the network during an OEM install.
-  if (!ConfigManager::Instance()->CanUseNetwork(is_machine)) {
-    CORE_LOG(L1, (_T("[Stats not uploaded because network use prohibited]")));
-    return GOOPDATE_E_CANNOT_USE_NETWORK;
-  }
-
-  const TCHAR* version = GetVersionString();
-  CString test_source(ConfigManager::Instance()->GetTestSource());
-
-  CString url;
-  HRESULT hr = ConfigManager::Instance()->GetUsageStatsReportUrl(&url);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[GetUsageStatsReportUrl failed][0x%08x]"), hr));
-    return hr;
-  }
-  SafeCStringAppendFormat(&url, _T("?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s&%s"),
-      kMetricsServerParamSourceId,  kMetricsProductName,
-      kMetricsServerParamVersion,   version,
-      kMetricsServerParamIsMachine, is_machine ? _T("1") : _T("0"),
-      kMetricsServerTestSource,     test_source,
-      kMetricsServerUserId,         uid,
-      extra_url_data);
-
-  CORE_LOG(L3, (_T("[upload usage stats][%s]"), content));
-
-  NetworkConfig* network_config = NULL;
-  NetworkConfigManager& network_manager = NetworkConfigManager::Instance();
-  hr = network_manager.GetUserNetworkConfig(&network_config);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[GetUserNetworkConfig failed][0x%08x]"), hr));
-    return hr;
-  }
-  NetworkRequest network_request(network_config->session());
-
-  network_request.set_num_retries(1);
-  network_request.AddHttpRequest(new SimpleRequest);
-
-  // PostRequest falls back to https.
-  std::vector<uint8> response_buffer;
-  return PostRequest(&network_request, true, url, content, &response_buffer);
-}
-
-HRESULT ReportMetrics(bool is_machine,
-                      const TCHAR* extra_url_data,
-                      DWORD interval) {
-  PersistentMetricsIteratorWin32 it(kMetricsProductName, is_machine), end;
-  Formatter formatter(CT2A(kMetricsProductName), interval);
-
-  for (; it != end; ++it) {
-    formatter.AddMetric(*it);
-  }
-
-  return UploadMetrics(is_machine, extra_url_data, CA2T(formatter.output()));
-}
-
-HRESULT DoResetMetrics(bool is_machine) {
-  CString key_name;
-  key_name.Format(kStatsKeyFormatString, kMetricsProductName);
-  HKEY parent_key = is_machine ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
-  RegKey key;
-  HRESULT hr = key.Create(parent_key, key_name);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Unable to create metrics key][0x%08x]"), hr));
-    return hr;
-  }
-  return ResetPersistentMetrics(&key);
-}
-
-HRESULT DoAggregateMetrics(bool is_machine) {
-  MetricsAggregatorWin32 aggregator(g_global_metrics,
-                                    kMetricsProductName,
-                                    is_machine);
-  if (!aggregator.AggregateMetrics()) {
-    CORE_LOG(LW, (_T("[Metrics aggregation failed for unknown reasons]")));
-    return GOOPDATE_E_METRICS_AGGREGATE_FAILED;
-  }
-  return S_OK;
-}
-
-HRESULT DoAggregateAndReportMetrics(bool is_machine, bool force_report) {
-  CString key_name;
-  key_name.Format(kStatsKeyFormatString, kMetricsProductName);
-  HKEY parent_key = is_machine ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
-  RegKey key;
-  HRESULT hr = key.Create(parent_key, key_name);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Unable to create metrics key][0x%08x]"), hr));
-    return hr;
-  }
-
-  DWORD now_sec = static_cast<DWORD>(time(NULL));
-
-  DWORD last_transmission_sec(0);
-  hr = key.GetValue(kLastTransmissionTimeValueName, &last_transmission_sec);
-
-  // Reset and start over if last transmission time is missing or hinky.
-  if (FAILED(hr) || last_transmission_sec > now_sec) {
-    CORE_LOG(LW, (_T("[hinky or missing last transmission time][%u][now: %u]"),
-                  last_transmission_sec, now_sec));
-    ResetPersistentMetrics(&key);
-    return S_OK;
-  }
-
-  hr = DoAggregateMetrics(is_machine);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[DoAggregateMetrics failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  DWORD time_since_last_transmission = now_sec - last_transmission_sec;
-  if (!force_report &&
-      time_since_last_transmission < kMetricsUploadIntervalSec) {
-    CORE_LOG(L1, (_T("[Stats upload not needed][last: %u][now: %u]"),
-                  last_transmission_sec, now_sec));
-    return S_OK;
-  }
-
-  // Report the metrics, reset the metrics, and update 'LastTransmission'.
-  hr = ReportMetrics(is_machine, NULL, time_since_last_transmission);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Stats upload failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  VERIFY1(SUCCEEDED(ResetPersistentMetrics(&key)));
-  CORE_LOG(L3, (_T("[Stats upload successful]")));
-  return S_OK;
-}
-
-bool InitializeLock(GLock* lock, bool is_machine) {
-  ASSERT1(lock);
-  NamedObjectAttributes attributes;
-  GetNamedObjectAttributes(kMetricsSerializer, is_machine, &attributes);
-  return lock->InitializeWithSecAttr(attributes.name, &attributes.sa);
-}
-
-}  // namespace
-
-
-HRESULT ResetMetrics(bool is_machine) {
-  CORE_LOG(L2, (_T("[ResetMetrics]")));
-  GLock lock;
-  if (!InitializeLock(&lock, is_machine)) {
-    return GOOPDATE_E_METRICS_LOCK_INIT_FAILED;
-  }
-  __mutexScope(lock);
-  return DoResetMetrics(is_machine);
-}
-
-HRESULT AggregateMetrics(bool is_machine) {
-  CORE_LOG(L2, (_T("[AggregateMetrics]")));
-
-  if (!ConfigManager::Instance()->CanCollectStats(is_machine)) {
-    return S_OK;
-  }
-
-  GLock lock;
-  if (!InitializeLock(&lock, is_machine)) {
-    return GOOPDATE_E_METRICS_LOCK_INIT_FAILED;
-  }
-  __mutexScope(lock);
-  return DoAggregateMetrics(is_machine);
-}
-
-HRESULT AggregateAndReportMetrics(bool is_machine, bool force_report) {
-  CORE_LOG(L2, (_T("[AggregateAndReportMetrics]")));
-
-  if (!ConfigManager::Instance()->CanCollectStats(is_machine)) {
-    return S_OK;
-  }
-
-  GLock lock;
-  if (!InitializeLock(&lock, is_machine)) {
-    return GOOPDATE_E_METRICS_LOCK_INIT_FAILED;
-  }
-  __mutexScope(lock);
-  return DoAggregateAndReportMetrics(is_machine, force_report);
-}
-
-}  // namespace omaha
-
diff --git a/common/stats_uploader.h b/common/stats_uploader.h
deleted file mode 100644
index 49dca19..0000000
--- a/common/stats_uploader.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Constants for the statsreport library.
-
-#ifndef OMAHA_COMMON_STATS_UPLOADER_H__
-#define OMAHA_COMMON_STATS_UPLOADER_H__
-
-#include <windows.h>
-#include <tchar.h>
-
-namespace omaha {
-
-// The product name is chosen so that the stats are persisted under
-// the Google Update registry key for the machine or user, respectively.
-const TCHAR* const kMetricsProductName           = _T("Update");
-
-const TCHAR* const kMetricsServerParamSourceId   = _T("sourceid");
-const TCHAR* const kMetricsServerParamVersion    = _T("v");
-const TCHAR* const kMetricsServerParamIsMachine  = _T("ismachine");
-const TCHAR* const kMetricsServerTestSource      = _T("testsource");
-const TCHAR* const kMetricsServerUserId          = _T("ui");
-
-// Metrics are uploaded every 25 hours.
-const int kMetricsUploadIntervalSec              = 25 * 60 * 60;
-
-// Deletes existing metrics and initializes 'LastTransmission' to current time.
-HRESULT ResetMetrics(bool is_machine);
-
-// Aggregates metrics by saving them in registry.
-HRESULT AggregateMetrics(bool is_machine);
-
-// Aggregates and reports the metrics if needed, as defined by the metrics
-// upload interval. The interval is ignored when 'force_report' is true.
-HRESULT AggregateAndReportMetrics(bool is_machine, bool force_report);
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_STATS_UPLOADER_H__
-
diff --git a/common/stats_uploader_unittest.cc b/common/stats_uploader_unittest.cc
deleted file mode 100644
index a28248b..0000000
--- a/common/stats_uploader_unittest.cc
+++ /dev/null
@@ -1,262 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// All tests are user only.
-
-#include <windows.h>
-#include <limits.h>
-#include <ctime>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/error.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/common/stats_uploader.h"
-#include "omaha/statsreport/metrics.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-DEFINE_METRIC_bool(test_bool);
-
-}  // namespace
-
-class StatsUploaderTest : public testing::Test {
- protected:
-  // These tests assume that metric collection is enabled. Since HKLM is not
-  // overridden, save the existing value if present before overriding it.
-  static void SetUpTestCase() {
-    is_updatedev_usagestats_present_ =
-        SUCCEEDED(RegKey::GetValue(MACHINE_REG_UPDATE_DEV,
-                                   kRegValueForceUsageStats,
-                                   &existing_updatedev_usagestats_value_));
-
-    EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                      kRegValueForceUsageStats,
-                                      static_cast<DWORD>(1)));
-  }
-
-  static void TearDownTestCase() {
-    if (is_updatedev_usagestats_present_) {
-      EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                        kRegValueForceUsageStats,
-                                        existing_updatedev_usagestats_value_));
-    } else {
-      EXPECT_SUCCEEDED(RegKey::DeleteValue(MACHINE_REG_UPDATE_DEV,
-                                           kRegValueForceUsageStats));
-    }
-  }
-
-  virtual void SetUp() {
-    RegKey::DeleteKey(kRegistryHiveOverrideRoot);
-
-    // Overriding HKLM prevents the Windows DNS resolver from working.
-    // Only override HKCU and run the tests as user.
-    OverrideSpecifiedRegistryHives(kRegistryHiveOverrideRoot, false, true);
-    stats_report::g_global_metrics.Initialize();
-  }
-
-  virtual void TearDown() {
-    stats_report::g_global_metrics.Uninitialize();
-    RestoreRegistryHives();
-    RegKey::DeleteKey(kRegistryHiveOverrideRoot);
-  }
-
-  HRESULT GetMetricValue(const TCHAR* value_name, bool* value) {
-    CString key_name = key_name_ + CString(_T("Booleans"));
-
-    scoped_array<byte> buffer;
-    DWORD byte_count(0);
-    HRESULT hr = RegKey::GetValue(key_name,
-                                  value_name,
-                                  address(buffer),
-                                  &byte_count);
-    if (FAILED(hr)) {
-      return hr;
-    }
-    if (byte_count != sizeof(uint32)) {                         // NOLINT
-      return HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
-    }
-    *value = *reinterpret_cast<uint32*>(buffer.get()) != 0;
-    return S_OK;
-  }
-
-  HRESULT GetLastTrasmission(DWORD* last_transmission) {
-    const TCHAR value_name[] = _T("LastTransmission");
-    return RegKey::GetValue(key_name_, value_name, last_transmission);
-  }
-
-  HRESULT SetLastTransmission(DWORD last_transmission) {
-    const TCHAR value_name[] = _T("LastTransmission");
-    return RegKey::SetValue(key_name_, value_name, last_transmission);
-  }
-
-  bool AreMetricsEmpty() {
-    RegKey reg_key;
-    HRESULT hr = reg_key.Open(key_name_, KEY_READ);
-    if (FAILED(hr)) {
-      return true;
-    }
-    return reg_key.GetSubkeyCount() == 0;
-  }
-
-  static const TCHAR key_name_[];
-  static const TCHAR metric_name_[];
-
- private:
-  static bool is_updatedev_usagestats_present_;
-  static DWORD existing_updatedev_usagestats_value_;
-};
-
-const TCHAR StatsUploaderTest::key_name_[] =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME
-    _T("\\") PRODUCT_NAME _T("\\UsageStats\\Daily\\");
-const TCHAR StatsUploaderTest::metric_name_[] =  _T("test_bool");
-
-bool StatsUploaderTest::is_updatedev_usagestats_present_ = false;
-DWORD StatsUploaderTest::existing_updatedev_usagestats_value_ = 0;
-
-TEST_F(StatsUploaderTest, AggregateMetrics) {
-  bool value = false;
-  EXPECT_HRESULT_FAILED(GetMetricValue(metric_name_, &value));
-
-  metric_test_bool = true;
-  EXPECT_HRESULT_SUCCEEDED(AggregateMetrics(false));    // User.
-
-  EXPECT_HRESULT_SUCCEEDED(GetMetricValue(metric_name_, &value));
-  EXPECT_EQ(true, value);
-
-  metric_test_bool = false;
-  EXPECT_HRESULT_SUCCEEDED(AggregateMetrics(false));    // User.
-
-  EXPECT_HRESULT_SUCCEEDED(GetMetricValue(metric_name_, &value));
-  EXPECT_EQ(false, value);
-}
-
-TEST_F(StatsUploaderTest, AggregateAndReportMetrics) {
-  metric_test_bool = true;
-
-  // Metrics are not in the registry until they are aggregated.
-  bool value = false;
-  EXPECT_HRESULT_FAILED(GetMetricValue(metric_name_, &value));
-
-  // AggregateAndReportMetrics resets metrics and updates 'LastTransmission' to
-  // the current time since there was no 'LastTransmission'.
-  EXPECT_HRESULT_SUCCEEDED(AggregateAndReportMetrics(false, false));
-  EXPECT_TRUE(AreMetricsEmpty());
-  DWORD last_transmission(0);
-  EXPECT_HRESULT_SUCCEEDED(GetLastTrasmission(&last_transmission));
-  EXPECT_NE(0, last_transmission);
-
-  // AggregateAndReportMetrics aggregates but it does not report since
-  // 'LastTransmission is current.
-  EXPECT_HRESULT_SUCCEEDED(AggregateAndReportMetrics(false, false));
-  EXPECT_FALSE(AreMetricsEmpty());
-  EXPECT_HRESULT_SUCCEEDED(GetMetricValue(metric_name_, &value));
-  EXPECT_EQ(true, value);
-  DWORD previous_last_transmission = last_transmission;
-  EXPECT_HRESULT_SUCCEEDED(GetLastTrasmission(&last_transmission));
-  EXPECT_EQ(previous_last_transmission, last_transmission);
-
-  // Roll back 'Last Trasmission' by 26 hours. AggregateAndReportMetrics
-  // aggregates, reports metrics, and updates 'LastTransmission'.
-  metric_test_bool = true;
-  last_transmission -= 26 * 60 * 60;
-  EXPECT_HRESULT_SUCCEEDED(SetLastTransmission(last_transmission));
-  EXPECT_HRESULT_SUCCEEDED(AggregateAndReportMetrics(false, false));
-  EXPECT_TRUE(AreMetricsEmpty());
-  previous_last_transmission = last_transmission;
-  EXPECT_HRESULT_SUCCEEDED(GetLastTrasmission(&last_transmission));
-  EXPECT_NE(previous_last_transmission, last_transmission);
-
-  // Roll forward the 'LastTransmission' by 60 seconds.
-  // AggregateAndReportMetrics resets metrics and updates 'LastTransmission' to
-  // the current time since there 'LastTransmission' was in the future.
-  metric_test_bool = true;
-  last_transmission = static_cast<DWORD>(time(NULL)) + 60;
-  EXPECT_HRESULT_SUCCEEDED(SetLastTransmission(last_transmission));
-  EXPECT_HRESULT_SUCCEEDED(AggregateAndReportMetrics(false, false));
-  EXPECT_TRUE(AreMetricsEmpty());
-  EXPECT_HRESULT_SUCCEEDED(GetLastTrasmission(&last_transmission));
-  EXPECT_NE(0, last_transmission);
-
-  // Force reporting the metrics.
-  metric_test_bool = true;
-  EXPECT_HRESULT_SUCCEEDED(AggregateAndReportMetrics(false, true));
-  EXPECT_TRUE(AreMetricsEmpty());
-}
-
-TEST_F(StatsUploaderTest, ResetPersistentMetricsTest) {
-  const TCHAR* keys[] = {
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME _T("\\UsageStats\\Daily\\Timings"),  // NOLINT
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME _T("\\UsageStats\\Daily\\Counts"),   // NOLINT
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME _T("\\UsageStats\\Daily\\Integers"), // NOLINT
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME _T("\\UsageStats\\Daily\\Booleans"), // NOLINT
-  };
-  EXPECT_HRESULT_SUCCEEDED(RegKey::CreateKeys(keys, arraysize(keys)));
-  EXPECT_HRESULT_SUCCEEDED(ResetMetrics(false));    // User.
-
-  for (size_t i = 0; i != arraysize(keys); ++i) {
-    EXPECT_FALSE(RegKey::HasKey(keys[i]));
-  }
-  EXPECT_TRUE(AreMetricsEmpty());
-
-  DWORD last_transmission(ULONG_MAX);
-  EXPECT_HRESULT_SUCCEEDED(GetLastTrasmission(&last_transmission));
-  EXPECT_NE(0, last_transmission);
-}
-
-// AggregateAndReportMetrics aggregates, but is unable to report metrics and
-// does not update 'LastTransmission'.
-TEST_F(StatsUploaderTest,
-       AggregateAndReportMetrics_GoogleUpdateEulaNotAccepted_DoNotForce) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-
-  metric_test_bool = true;
-  DWORD last_transmission = 12345678;
-  EXPECT_HRESULT_SUCCEEDED(SetLastTransmission(last_transmission));
-  EXPECT_EQ(GOOPDATE_E_CANNOT_USE_NETWORK,
-            AggregateAndReportMetrics(false, false));
-  EXPECT_FALSE(AreMetricsEmpty());
-  DWORD previous_last_transmission = last_transmission;
-  EXPECT_HRESULT_SUCCEEDED(GetLastTrasmission(&last_transmission));
-  EXPECT_EQ(12345678, last_transmission);
-}
-
-// AggregateAndReportMetrics aggregates, but is unable to report metrics and
-// does not update 'LastTransmission'.
-TEST_F(StatsUploaderTest,
-       AggregateAndReportMetrics_GoogleUpdateEulaNotAccepted_Force) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-
-  metric_test_bool = true;
-  DWORD last_transmission = 12345678;
-  EXPECT_HRESULT_SUCCEEDED(SetLastTransmission(last_transmission));
-  EXPECT_EQ(GOOPDATE_E_CANNOT_USE_NETWORK,
-            AggregateAndReportMetrics(false, true));
-  EXPECT_FALSE(AreMetricsEmpty());
-  DWORD previous_last_transmission = last_transmission;
-  EXPECT_HRESULT_SUCCEEDED(GetLastTrasmission(&last_transmission));
-  EXPECT_EQ(12345678, last_transmission);
-}
-
-}  // namespace omaha
diff --git a/common/update3_utils.cc b/common/update3_utils.cc
deleted file mode 100644
index 61ff1b1..0000000
--- a/common/update3_utils.cc
+++ /dev/null
@@ -1,269 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/common/update3_utils.h"
-#include <atlsafe.h>
-#include "goopdate/omaha3_idl.h"
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/system.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/goopdate/google_update3.h"
-
-namespace omaha {
-
-namespace update3_utils {
-
-namespace {
-
-template <typename Update3COMClassT>
-HRESULT CreateGoogleUpdate3LocalClass(IGoogleUpdate3** server) {
-  CORE_LOG(L3, (_T("[CreateGoogleUpdate3LocalClass]")));
-  ASSERT1(server);
-
-  typedef CComObject<Update3COMClassT> Update3;
-  scoped_ptr<Update3> update3;
-  HRESULT hr = Update3::CreateInstance(address(update3));
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Update3 creation failed][0x%x]"), hr));
-    return hr;
-  }
-
-  hr = update3->QueryInterface(server);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Update3 QueryInterface failed][0x%x]"), hr));
-    return hr;
-  }
-
-  update3.release();
-
-  return S_OK;
-}
-
-}  // namespace
-
-HRESULT SetProxyBlanketAllowImpersonate(IUnknown* server) {
-  ASSERT1(server);
-
-  HRESULT hr = ::CoSetProxyBlanket(server, RPC_C_AUTHN_DEFAULT,
-      RPC_C_AUTHZ_DEFAULT, COLE_DEFAULT_PRINCIPAL, RPC_C_AUTHN_LEVEL_DEFAULT,
-      RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_DEFAULT);
-
-  // E_NOINTERFACE indicates an in-proc intra-apartment call.
-  if (FAILED(hr) && hr != E_NOINTERFACE) {
-    CORE_LOG(LE, (_T("[::CoSetProxyBlanket failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT CreateGoogleUpdate3Class(bool is_machine, IGoogleUpdate3** server) {
-  CORE_LOG(L3, (_T("[CreateGoogleUpdate3Class][%d]"), is_machine));
-  ASSERT1(server);
-
-  CComPtr<IGoogleUpdate3> com_server;
-  HRESULT hr = is_machine ? CreateGoogleUpdate3MachineClass(&com_server) :
-                            CreateGoogleUpdate3UserClass(&com_server);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = SetProxyBlanketAllowImpersonate(com_server);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  *server = com_server.Detach();
-  return S_OK;
-}
-
-// Tries to CoCreate the service CLSID first. If that fails, tries to create the
-// server in-proc. Finally, sets a security blanket on the interface to allow
-// the server to impersonate the client.
-HRESULT CreateGoogleUpdate3MachineClass(IGoogleUpdate3** machine_server) {
-  ASSERT1(machine_server);
-  ASSERT1(vista_util::IsUserAdmin());
-
-  CComPtr<IGoogleUpdate3> server;
-  HRESULT hr = server.CoCreateInstance(__uuidof(GoogleUpdate3ServiceClass));
-
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[CoCreate GoogleUpdate3ServiceClass failed][0x%x]"), hr));
-
-    hr = CreateGoogleUpdate3LocalClass<Update3COMClassService>(&server);
-    if (hr == GOOPDATE_E_INSTANCES_RUNNING) {
-      CORE_LOG(L3, (_T("[Retry CoCreate GoogleUpdate3ServiceClass]")));
-      hr = server.CoCreateInstance(__uuidof(GoogleUpdate3ServiceClass));
-    }
-
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[Create GoogleUpdate3MachineClass failed][0x%x]"), hr));
-      return hr;
-    }
-  }
-
-  ASSERT1(server);
-  *machine_server = server.Detach();
-  return S_OK;
-}
-
-// Tries to CoCreate the LocalServer CLSID first. If that fails, tries to create
-// the server in-proc.
-HRESULT CreateGoogleUpdate3UserClass(IGoogleUpdate3** user_server) {
-  ASSERT1(user_server);
-
-  CComPtr<IGoogleUpdate3> server;
-  HRESULT hr = server.CoCreateInstance(__uuidof(GoogleUpdate3UserClass));
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[CoCreate GoogleUpdate3UserClass failed][0x%x]"), hr));
-
-    // The primary reason for the LocalServer activation failing on Vista/Win7
-    // is that COM does not look at HKCU registration when the code is running
-    // elevated. We fall back to an in-proc mode. The in-proc mode is limited to
-    // one install at a time, so we use it only as a backup mechanism.
-    OPT_LOG(LE, (_T("[IsElevatedWithUACMaybeOn][%d]"),
-                 vista_util::IsElevatedWithUACMaybeOn()));
-    hr = CreateGoogleUpdate3LocalClass<Update3COMClassUser>(&server);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  ASSERT1(server);
-  *user_server = server.Detach();
-  return S_OK;
-}
-
-HRESULT CreateAppBundle(IGoogleUpdate3* server, IAppBundle** app_bundle) {
-  ASSERT1(server);
-  ASSERT1(app_bundle);
-
-  CComPtr<IDispatch> idispatch;
-  HRESULT hr = server->createAppBundle(&idispatch);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return idispatch.QueryInterface(app_bundle);
-}
-
-HRESULT CreateApp(BSTR app_id, IAppBundle* app_bundle, IApp** app) {
-  ASSERT1(app_id);
-  ASSERT1(app_bundle);
-  ASSERT1(app);
-
-  CComPtr<IDispatch> idispatch;
-  HRESULT hr = app_bundle->createApp(app_id, &idispatch);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return idispatch.QueryInterface(app);
-}
-
-HRESULT CreateInstalledApp(BSTR app_id, IAppBundle* app_bundle, IApp** app) {
-  ASSERT1(app_id);
-  ASSERT1(app_bundle);
-  ASSERT1(app);
-
-  CComPtr<IDispatch> idispatch;
-  HRESULT hr = app_bundle->createInstalledApp(app_id, &idispatch);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return idispatch.QueryInterface(app);
-}
-
-HRESULT CreateAllInstalledApps(IAppBundle* app_bundle) {
-  ASSERT1(app_bundle);
-
-  return app_bundle->createAllInstalledApps();
-}
-
-HRESULT GetApp(IAppBundle* app_bundle, long index, IApp** app) {  // NOLINT
-  ASSERT1(app_bundle);
-  ASSERT1(index >= 0);
-  ASSERT1(app);
-
-  CComPtr<IDispatch> app_idispatch;
-  HRESULT hr = app_bundle->get_Item(index, &app_idispatch);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  ASSERT1(app_idispatch);
-
-  return app_idispatch.QueryInterface(app);
-}
-
-HRESULT GetCurrentAppVersion(IApp* app, IAppVersion** app_version) {
-  ASSERT1(app);
-  ASSERT1(app_version);
-
-  CComPtr<IDispatch> idispatch;
-  HRESULT hr = app->get_currentVersion(&idispatch);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return idispatch.QueryInterface(app_version);
-}
-
-HRESULT GetNextAppVersion(IApp* app, IAppVersion** app_version) {
-  ASSERT1(app);
-  ASSERT1(app_version);
-
-  CComPtr<IDispatch> idispatch;
-  HRESULT hr = app->get_nextVersion(&idispatch);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return idispatch.QueryInterface(app_version);
-}
-
-HRESULT GetAppCurrentState(IApp* app,
-                           CurrentState* current_state,
-                           ICurrentState** icurrent_state) {
-  ASSERT1(app);
-  ASSERT1(current_state);
-  ASSERT1(icurrent_state);
-
-  CComPtr<IDispatch> idispatch;
-  HRESULT hr = app->get_currentState(&idispatch);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = idispatch.QueryInterface(icurrent_state);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  LONG state = 0;
-  hr = (*icurrent_state)->get_stateValue(&state);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  *current_state = static_cast<CurrentState>(state);
-  return S_OK;
-}
-
-}  // namespace update3_utils
-
-}  // namespace omaha
diff --git a/common/update3_utils.h b/common/update3_utils.h
deleted file mode 100644
index 20ef560..0000000
--- a/common/update3_utils.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Utilities for IGoogleUpdate3 and related interfaces.
-
-#ifndef OMAHA_COMMON_UPDATE3_UTILS_H_
-#define OMAHA_COMMON_UPDATE3_UTILS_H_
-
-#include <windows.h>
-#include <atlsafe.h>
-#include "goopdate/omaha3_idl.h"
-#include "omaha/base/debug.h"
-
-namespace omaha {
-
-namespace update3_utils {
-
-// Helper methods.
-HRESULT SetProxyBlanketAllowImpersonate(IUnknown* server);
-
-// Create methods.
-HRESULT CreateGoogleUpdate3Class(bool is_machine, IGoogleUpdate3** server);
-HRESULT CreateGoogleUpdate3MachineClass(IGoogleUpdate3** machine_server);
-HRESULT CreateGoogleUpdate3UserClass(IGoogleUpdate3** user_server);
-HRESULT CreateAppBundle(IGoogleUpdate3* server, IAppBundle** app_bundle);
-HRESULT CreateApp(BSTR app_id, IAppBundle* app_bundle, IApp** app);
-HRESULT CreateInstalledApp(BSTR app_id, IAppBundle* app_bundle, IApp** app);
-HRESULT CreateAllInstalledApps(IAppBundle* app_bundle);
-
-// Get methods.
-HRESULT GetApp(IAppBundle* app_bundle, long index, IApp** app);  // NOLINT
-HRESULT GetCurrentAppVersion(IApp* app, IAppVersion** app_version);
-HRESULT GetNextAppVersion(IApp* app, IAppVersion** app_version);
-
-// TODO(omaha): consider removing current_state parameter since it is
-// returned in the icurrent_state object as well.
-HRESULT GetAppCurrentState(IApp* app,
-                           CurrentState* current_state,
-                           ICurrentState** icurrent_state);
-
-}  // namespace update3_utils
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_UPDATE3_UTILS_H_
diff --git a/common/update_request.cc b/common/update_request.cc
deleted file mode 100644
index 22839ab..0000000
--- a/common/update_request.cc
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/common/update_request.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/system_info.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/common/xml_parser.h"
-
-namespace omaha {
-
-namespace xml {
-
-UpdateRequest::UpdateRequest() {
-}
-
-UpdateRequest::~UpdateRequest() {
-}
-
-// TODO(omaha): handle errors.
-UpdateRequest* UpdateRequest::Create(bool is_machine,
-                                     const CString& session_id,
-                                     const CString& install_source,
-                                     const CString& origin_url) {
-  scoped_ptr<UpdateRequest> update_request(new UpdateRequest);
-
-  request::Request& request = update_request->request_;
-
-  request.is_machine = is_machine;
-  request.protocol_version = _T("3.0");
-
-  request.uid = goopdate_utils::GetUserIdLazyInit(is_machine);
-
-  request.omaha_version = GetVersionString();
-  request.install_source = install_source;
-  request.origin_url = origin_url;
-  request.test_source = ConfigManager::Instance()->GetTestSource();
-
-  GUID req_id = GUID_NULL;
-  VERIFY1(SUCCEEDED(::CoCreateGuid(&req_id)));
-  request.request_id = GuidToString(req_id);
-
-  request.session_id = session_id;
-
-  request.os.platform = kPlatformWin;
-  VERIFY1(SUCCEEDED(goopdate_utils::GetOSInfo(&request.os.version,
-                                              &request.os.service_pack)));
-  request.os.arch = xml::ConvertProcessorArchitectureToString(
-      SystemInfo::GetProcessorArchitecture());
-
-  bool is_period_overridden = false;
-  const int check_period_sec =
-      ConfigManager::Instance()->GetLastCheckPeriodSec(&is_period_overridden);
-  if (is_period_overridden) {
-    request.check_period_sec = check_period_sec;
-  }
-
-  return update_request.release();
-}
-
-void UpdateRequest::AddApp(const request::App& app) {
-  request_.apps.push_back(app);
-}
-
-bool UpdateRequest::has_tt_token() const {
-  for (size_t i = 0; i != request_.apps.size(); ++i) {
-    const request::App& app(request_.apps[i]);
-    if (!app.update_check.tt_token.IsEmpty()) {
-      return true;
-    }
-  }
-  return false;
-}
-
-HRESULT UpdateRequest::Serialize(CString* buffer) const {
-  ASSERT1(buffer);
-  return XmlParser::SerializeRequest(*this, buffer);
-}
-
-bool UpdateRequest::IsEmpty() const {
-  return request_.apps.empty();
-}
-
-}  // namespace xml
-
-}  // namespace omaha
diff --git a/common/update_request.h b/common/update_request.h
deleted file mode 100644
index 4ab1535..0000000
--- a/common/update_request.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// UpdateRequest allows the caller to build an update request object and
-// serialize it as a string.
-
-#ifndef OMAHA_COMMON_UPDATE_REQUEST_H_
-#define OMAHA_COMMON_UPDATE_REQUEST_H_
-
-#include <windows.h>
-#include "base/basictypes.h"
-#include "omaha/common/protocol_definition.h"
-
-namespace omaha {
-
-namespace xml {
-
-class UpdateRequest {
- public:
-  ~UpdateRequest();
-
-  // Creates an instance of the class. Caller takes ownership.
-  static UpdateRequest* Create(bool is_machine,
-                               const CString& session_id,
-                               const CString& install_source,
-                               const CString& origin_url);
-
-  // Adds an 'app' element to the request.
-  void AddApp(const request::App& app);
-
-  // Returns true if the requests does not contain applications.
-  bool IsEmpty() const;
-
-  // Serializes the request into a buffer.
-  HRESULT Serialize(CString* buffer) const;
-
-  // Returns true if one of the applications in the request carries a
-  // trusted tester token.
-  bool has_tt_token() const;
-
-  const request::Request& request() const { return request_; }
-
- private:
-  friend class XmlParserTest;
-
-  UpdateRequest();
-
-  request::Request request_;
-
-  DISALLOW_COPY_AND_ASSIGN(UpdateRequest);
-};
-
-}  // namespace xml
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_UPDATE_REQUEST_H_
diff --git a/common/update_request_unittest.cc b/common/update_request_unittest.cc
deleted file mode 100644
index 1420b43..0000000
--- a/common/update_request_unittest.cc
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// TODO(omaha): write tests.
-// TODO(omaha): nice to mock the machine/user ids.
-#include "base/scoped_ptr.h"
-#include "omaha/common/update_request.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace xml {
-
-class UpdateRequestTest : public testing::Test {
-  virtual void SetUp() {}
-  virtual void TearDown() {}
-};
-
-TEST_F(UpdateRequestTest, Create_Machine) {
-  scoped_ptr<UpdateRequest> update_request(
-      UpdateRequest::Create(true, _T("unittest"), _T("unittest"), CString()));
-  ASSERT_TRUE(update_request.get());
-  EXPECT_TRUE(update_request->IsEmpty());
-}
-
-TEST_F(UpdateRequestTest, Create_User) {
-  scoped_ptr<UpdateRequest> update_request(
-      UpdateRequest::Create(false, _T("unittest"), _T("unittest"), CString()));
-
-  ASSERT_TRUE(update_request.get());
-  EXPECT_TRUE(update_request->IsEmpty());
-}
-
-}  // namespace xml
-
-}  // namespace omaha
-
diff --git a/common/update_response.cc b/common/update_response.cc
deleted file mode 100644
index 4f40ad3..0000000
--- a/common/update_response.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/common/update_response.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/xml_parser.h"
-
-namespace omaha {
-
-namespace xml {
-
-UpdateResponse::UpdateResponse() {
-}
-
-UpdateResponse::~UpdateResponse() {
-}
-
-UpdateResponse* UpdateResponse::Create() {
-  return new UpdateResponse;
-}
-
-HRESULT UpdateResponse::Deserialize(const std::vector<uint8>& buffer) {
-  return XmlParser::DeserializeResponse(buffer, this);
-}
-
-HRESULT UpdateResponse::DeserializeFromFile(const CString& filename) {
-  std::vector<uint8> buffer;
-  HRESULT hr = ReadEntireFile(filename, 0, &buffer);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  ASSERT1(!buffer.empty());
-  return Deserialize(buffer);
-}
-
-int UpdateResponse::GetElapsedSecondsSinceDayStart() const {
-  return response_.day_start.elapsed_seconds;
-}
-
-// Sets update_response's response_ member to response. Used by unit tests to
-// set the response without needing to craft corresponding XML. UpdateResponse
-// friends this function, allowing it to access the private member.
-void SetResponseForUnitTest(UpdateResponse* update_response,
-                            const response::Response& response) {
-  ASSERT1(update_response);
-  update_response->response_ = response;
-}
-
-}  // namespace xml
-
-}  // namespace omaha
diff --git a/common/update_response.h b/common/update_response.h
deleted file mode 100644
index 1880dc1..0000000
--- a/common/update_response.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// UpdateRequest allows the caller to deserialize an update request into
-// a corresponding object object.
-
-#ifndef OMAHA_COMMON_UPDATE_RESPONSE_H_
-#define OMAHA_COMMON_UPDATE_RESPONSE_H_
-
-#include <windows.h>
-#include <utility>
-#include <vector>
-#include "base/basictypes.h"
-#include "omaha/common/protocol_definition.h"
-
-namespace omaha {
-
-namespace xml {
-
-class UpdateResponse {
- public:
-  ~UpdateResponse();
-
-  // Creates an instance of the class. Caller takes ownership.
-  static UpdateResponse* Create();
-
-  // Initializes an update response from a xml document in a buffer.
-  HRESULT Deserialize(const std::vector<uint8>& buffer);
-
-  // Initializes an update response from a xml document in a file.
-  HRESULT DeserializeFromFile(const CString& filename);
-
-  int GetElapsedSecondsSinceDayStart() const;
-
-  const response::Response& response() const { return response_; }
-
- private:
-  friend class XmlParser;
-  friend class XmlParserTest;
-
-  // Sets response_ for unit testing.
-  friend void SetResponseForUnitTest(UpdateResponse* update_response,
-                                     const response::Response& response);
-
-  UpdateResponse();
-
-  response::Response response_;
-
-  DISALLOW_COPY_AND_ASSIGN(UpdateResponse);
-};
-
-typedef std::pair<HRESULT, CString> UpdateResponseResult;
-
-}  // namespace xml
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_UPDATE_RESPONSE_H_
-
diff --git a/common/web_services_client.cc b/common/web_services_client.cc
deleted file mode 100644
index 5926a3c..0000000
--- a/common/web_services_client.cc
+++ /dev/null
@@ -1,201 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/common/web_services_client.h"
-#include <atlstr.h>
-#include "omaha/base/const_addresses.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/update_request.h"
-#include "omaha/common/update_response.h"
-#include "omaha/net/cup_request.h"
-#include "omaha/net/network_config.h"
-#include "omaha/net/network_request.h"
-#include "omaha/net/simple_request.h"
-
-namespace omaha {
-
-WebServicesClient::WebServicesClient(bool is_machine)
-    : lock_(NULL),
-      is_machine_(is_machine) {
-}
-
-WebServicesClient::~WebServicesClient() {
-  CORE_LOG(L3, (_T("[WebServicesClient::~WebServicesClient]")));
-
-  delete &lock();
-  omaha::interlocked_exchange_pointer(&lock_, static_cast<Lockable*>(NULL));
-}
-
-HRESULT  WebServicesClient::Initialize(const CString& url,
-                                       const HeadersVector& headers,
-                                       bool use_cup) {
-  CORE_LOG(L3, (_T("[WebServicesClient::Initialize][%s][%d]"), url, use_cup));
-
-  omaha::interlocked_exchange_pointer(&lock_,
-                                      static_cast<Lockable*>(new LLock));
-  __mutexScope(lock());
-
-  url_ = url;
-
-  NetworkConfig* network_config = NULL;
-  NetworkConfigManager& network_manager = NetworkConfigManager::Instance();
-  HRESULT hr = network_manager.GetUserNetworkConfig(&network_config);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  const NetworkConfig::Session& session(network_config->session());
-
-  network_request_.reset(new NetworkRequest(session));
-
-  for (size_t i = 0; i < headers.size(); ++i) {
-    network_request_->AddHeader(headers[i].first, headers[i].second);
-  }
-
-  if (use_cup) {
-    network_request_->AddHttpRequest(new CupRequest(new SimpleRequest));
-  }
-  network_request_->AddHttpRequest(new SimpleRequest);
-  network_request_->set_num_retries(1);
-
-  return S_OK;
-}
-
-const Lockable& WebServicesClient::lock() const {
-  return *omaha::interlocked_exchange_pointer(&lock_, lock_);
-}
-
-CString WebServicesClient::url() const {
-  __mutexScope(lock());
-  return url_;
-}
-
-NetworkRequest* WebServicesClient::network_request() {
-  __mutexScope(lock());
-  return network_request_.get();
-}
-
-HRESULT WebServicesClient::Send(const xml::UpdateRequest* update_request,
-                                xml::UpdateResponse* update_response) {
-  CORE_LOG(L3, (_T("[WebServicesClient::Send]")));
-  ASSERT1(update_request);
-  ASSERT1(update_response);
-
-  if (!ConfigManager::Instance()->CanUseNetwork(is_machine_)) {
-    CORE_LOG(LE, (_T("[WebServicesClient::Send][network use prohibited]")));
-    return GOOPDATE_E_CANNOT_USE_NETWORK;
-  }
-
-  CString request_string;
-  HRESULT hr = update_request->Serialize(&request_string);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Serialize failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  ASSERT1(!request_string.IsEmpty());
-
-  // For security reasons, if there's tt_token in the request, we must
-  // set_preserve_protocol in network request to prevent it from replacing
-  // https with http scheme.
-  const bool need_preserve_https = update_request->has_tt_token();
-
-  return SendStringPreserveProtocol(need_preserve_https, &request_string,
-                                    update_response);
-}
-
-HRESULT WebServicesClient::SendString(const CString* request_string,
-                                      xml::UpdateResponse* update_response) {
-  CORE_LOG(L3, (_T("[WebServicesClient::SendString]")));
-  ASSERT1(request_string);
-  ASSERT1(update_response);
-
-  return SendStringPreserveProtocol(false, request_string, update_response);
-}
-
-HRESULT WebServicesClient::SendStringPreserveProtocol(
-    bool need_preserve_https,
-    const CString* request_string,
-    xml::UpdateResponse* update_response) {
-  CORE_LOG(L3, (_T("[WebServicesClient::SendStringPreserveProtocol]")));
-  ASSERT1(request_string);
-  ASSERT1(update_response);
-
-  CORE_LOG(L3, (_T("[sending web services request][%s]"), *request_string));
-
-  std::vector<uint8> response_buffer;
-
-  CString request_url = url();
-  ASSERT1(!need_preserve_https ||
-      String_StartsWith(request_url, kHttpsProtoScheme, true));
-  network_request_->set_preserve_protocol(need_preserve_https);
-  HRESULT hr = PostRequest(network_request_.get(), true,
-                           request_url, *request_string, &response_buffer);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[PostString failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  // The web services server is expected to reply with 200 OK if the
-  // transaction has been successful.
-  ASSERT1(is_http_success());
-  if (!is_http_success()) {
-    CORE_LOG(LE, (_T("[PostString returned success on a failed transaction]")));
-    return E_FAIL;
-  }
-
-  CString response_string = Utf8BufferToWideChar(response_buffer);
-  CORE_LOG(L3, (_T("[received web services response][%s]"), response_string));
-
-  hr = update_response->Deserialize(response_buffer);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[UpdateResponse::Deserialize failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-void WebServicesClient::Cancel() {
-  CORE_LOG(L3, (_T("[WebServicesClient::Cancel]")));
-  NetworkRequest* network_request(network_request());
-  if (network_request) {
-    network_request->Cancel();
-  }
-}
-
-void WebServicesClient::set_proxy_auth_config(const ProxyAuthConfig& config) {
-  ASSERT1(network_request());
-  network_request()->set_proxy_auth_config(config);
-}
-
-bool WebServicesClient::is_http_success() const {
-  return network_request_->http_status_code() == HTTP_STATUS_OK;
-}
-
-int WebServicesClient::http_status_code() const {
-  return network_request_->http_status_code();
-}
-
-CString WebServicesClient::http_trace() const {
-  return network_request_->trace();
-}
-
-}  // namespace omaha
diff --git a/common/web_services_client.h b/common/web_services_client.h
deleted file mode 100644
index 6ee00d9..0000000
--- a/common/web_services_client.h
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_WEB_SERVICES_CLIENT_H_
-#define OMAHA_COMMON_WEB_SERVICES_CLIENT_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include <utility>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/net/proxy_auth.h"
-
-namespace omaha {
-
-namespace xml {
-
-class UpdateRequest;
-class UpdateResponse;
-
-}  // namespace xml
-
-struct Lockable;
-class NetworkRequest;
-
-typedef std::vector<std::pair<CString, CString> > HeadersVector;
-
-class WebServicesClientInterface {
- public:
-  virtual ~WebServicesClientInterface() {}
-
-  virtual HRESULT Send(const xml::UpdateRequest* update_request,
-                       xml::UpdateResponse* update_response) = 0;
-
-  virtual HRESULT SendString(const CString* request_buffer,
-                             xml::UpdateResponse* response_buffer) = 0;
-
-  virtual void Cancel() = 0;
-
-  virtual void set_proxy_auth_config(const ProxyAuthConfig& config) = 0;
-
-  // Returns true if the http transaction completed with 200 OK.
-  virtual bool is_http_success() const = 0;
-
-  // Returns the last http request status code.
-  virtual int http_status_code() const = 0;
-
-  // Returns http request trace (for logging).
-  virtual CString http_trace() const = 0;
-};
-
-// Defines a class to send and receive protocol requests.
-class WebServicesClient : public WebServicesClientInterface {
- public:
-  explicit WebServicesClient(bool is_machine);
-  virtual ~WebServicesClient();
-
-  HRESULT  Initialize(const CString& url,
-                      const HeadersVector& headers,
-                      bool use_cup);
-
-  virtual HRESULT Send(const xml::UpdateRequest* update_request,
-                       xml::UpdateResponse* update_response);
-
-  virtual HRESULT SendString(const CString* request_buffer,
-                             xml::UpdateResponse* update_response);
-
-  virtual void Cancel();
-
-  virtual void set_proxy_auth_config(const ProxyAuthConfig& proxy_auth_config);
-
-  virtual bool is_http_success() const;
-
-  virtual int http_status_code() const;
-
-  virtual CString http_trace() const;
-
- private:
-  HRESULT SendStringPreserveProtocol(bool need_preserve_https,
-                                     const CString* request_buffer,
-                                     xml::UpdateResponse* update_response);
-
-  const Lockable& lock() const;
-
-  CString url() const;
-
-  NetworkRequest* network_request();
-
-  mutable Lockable* volatile lock_;   // Owned by this instance.
-
-  const bool is_machine_;
-  CString url_;
-
-  scoped_ptr<NetworkRequest> network_request_;
-
-  friend class WebServicesClientTest;
-  DISALLOW_EVIL_CONSTRUCTORS(WebServicesClient);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_WEB_SERVICES_CLIENT_H_
diff --git a/common/web_services_client_unittest.cc b/common/web_services_client_unittest.cc
deleted file mode 100644
index 5c11e30..0000000
--- a/common/web_services_client_unittest.cc
+++ /dev/null
@@ -1,245 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "base/scoped_ptr.h"
-#include "omaha/base/const_addresses.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/string.h"
-#include "omaha/base/vista_utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/update_request.h"
-#include "omaha/common/update_response.h"
-#include "omaha/common/web_services_client.h"
-#include "omaha/net/network_request.h"
-#include "omaha/testing/unit_test.h"
-
-using ::testing::_;
-
-namespace omaha {
-
-// TODO(omaha): test the machine case.
-
-class WebServicesClientTest : public testing::Test {
- protected:
-  virtual void SetUp() {
-    EXPECT_HRESULT_SUCCEEDED(
-        ConfigManager::Instance()->GetUpdateCheckUrl(&update_check_url_));
-
-    web_service_client_.reset(new WebServicesClient(false));
-
-    update_request_.reset(xml::UpdateRequest::Create(false,
-                                                     _T("unittest_sessionid"),
-                                                     _T("unittest_instsource"),
-                                                     CString()));
-    update_response_.reset(xml::UpdateResponse::Create());
-  }
-
-  virtual void TearDown() {
-    web_service_client_.reset();
-  }
-
-  NetworkRequest* network_request() const {
-    return web_service_client_->network_request();
-  }
-
-  CString update_check_url_;
-
-  scoped_ptr<WebServicesClient> web_service_client_;
-  scoped_ptr<xml::UpdateRequest> update_request_;
-  scoped_ptr<xml::UpdateResponse> update_response_;
-};
-
-TEST_F(WebServicesClientTest, Send) {
-  EXPECT_HRESULT_SUCCEEDED(web_service_client_->Initialize(update_check_url_,
-                                                           HeadersVector(),
-                                                           false));
-
-  // Test sending a user update check request.
-  EXPECT_HRESULT_SUCCEEDED(web_service_client_->Send(update_request_.get(),
-                                                     update_response_.get()));
-  EXPECT_TRUE(web_service_client_->is_http_success());
-
-  xml::response::Response response(update_response_->response());
-  EXPECT_STREQ(_T("3.0"), response.protocol);
-
-  NetworkRequest* network_request(network_request());
-
-  CString cookie;
-  EXPECT_HRESULT_FAILED(network_request->QueryHeadersString(
-      WINHTTP_QUERY_FLAG_REQUEST_HEADERS | WINHTTP_QUERY_COOKIE,
-      WINHTTP_HEADER_NAME_BY_INDEX,
-      &cookie));
-  EXPECT_TRUE(cookie.IsEmpty());
-
-  CString etag;
-  EXPECT_HRESULT_FAILED(network_request->QueryHeadersString(
-      WINHTTP_QUERY_ETAG, WINHTTP_HEADER_NAME_BY_INDEX, &etag));
-  EXPECT_TRUE(etag.IsEmpty());
-}
-
-TEST_F(WebServicesClientTest, SendUsingCup) {
-  EXPECT_HRESULT_SUCCEEDED(web_service_client_->Initialize(update_check_url_,
-                                                           HeadersVector(),
-                                                           true));
-
-  // Test sending a user update check request.
-  EXPECT_HRESULT_SUCCEEDED(web_service_client_->Send(update_request_.get(),
-                                                     update_response_.get()));
-  EXPECT_TRUE(web_service_client_->is_http_success());
-
-  xml::response::Response response(update_response_->response());
-  EXPECT_STREQ(_T("3.0"), response.protocol);
-
-  NetworkRequest* network_request(network_request());
-
-  CString no_request_age_header;
-  network_request->QueryHeadersString(
-      WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
-      _T("X-RequestAge"),
-      &no_request_age_header);
-
-  EXPECT_STREQ(_T(""), no_request_age_header);
-
-  // A CUP transaction has either a request or a response CUP cookie and
-  // the ETag response header.
-  CString request_cookie;
-  network_request->QueryHeadersString(
-      WINHTTP_QUERY_COOKIE | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
-      WINHTTP_HEADER_NAME_BY_INDEX,
-      &request_cookie);
-  const bool has_cup_request_cookie = request_cookie.Find(_T("c=")) != -1;
-
-  CString response_cookie;
-  network_request->QueryHeadersString(WINHTTP_QUERY_SET_COOKIE,
-                                      WINHTTP_HEADER_NAME_BY_INDEX,
-                                      &response_cookie);
-  const bool has_cup_response_cookie = response_cookie.Find(_T("c=")) != -1;
-
-  EXPECT_TRUE(has_cup_request_cookie || has_cup_response_cookie);
-
-  CString etag;
-  EXPECT_HRESULT_SUCCEEDED(network_request->QueryHeadersString(
-      WINHTTP_QUERY_ETAG, WINHTTP_HEADER_NAME_BY_INDEX, &etag));
-  EXPECT_FALSE(etag.IsEmpty());
-}
-
-TEST_F(WebServicesClientTest, SendForcingHttps) {
-  // Skips the test if the update check URL is not https.
-  if (!String_StartsWith(update_check_url_, kHttpsProtoScheme, true)) {
-    return;
-  }
-
-  EXPECT_HRESULT_SUCCEEDED(web_service_client_->Initialize(update_check_url_,
-                                                           HeadersVector(),
-                                                           true));
-
-  EXPECT_TRUE(update_request_->IsEmpty());
-
-  // Adds an application with non-empty tt_token to the update request.
-  // This should prevent the network stack from replacing https with
-  // CUP protocol.
-  xml::request::App app;
-  app.app_id = _T("{21CD0965-0B0E-47cf-B421-2D191C16C0E2}");
-  app.iid    = _T("{00000000-0000-0000-0000-000000000000}");
-  app.update_check.is_valid = true;
-  app.update_check.tt_token = _T("Test TT token");
-  update_request_->AddApp(app);
-
-  EXPECT_FALSE(update_request_->IsEmpty());
-  EXPECT_TRUE(update_request_->has_tt_token());
-
-  EXPECT_HRESULT_SUCCEEDED(web_service_client_->Send(update_request_.get(),
-                                                    update_response_.get()));
-  EXPECT_TRUE(web_service_client_->is_http_success());
-
-  // Do a couple of sanity checks on the parsing of the response.
-  xml::response::Response response(update_response_->response());
-  EXPECT_STREQ(_T("3.0"), response.protocol);
-  ASSERT_EQ(1, response.apps.size());
-  EXPECT_STREQ(_T("error-unknownApplication"), response.apps[0].status);
-}
-
-TEST_F(WebServicesClientTest, SendWithCustomHeader) {
-  HeadersVector headers;
-  headers.push_back(std::make_pair(_T("X-RequestAge"), _T("200")));
-
-  EXPECT_HRESULT_SUCCEEDED(web_service_client_->Initialize(update_check_url_,
-                                                           headers,
-                                                           true));
-
-  EXPECT_HRESULT_SUCCEEDED(web_service_client_->Send(update_request_.get(),
-                                                     update_response_.get()));
-  EXPECT_TRUE(web_service_client_->is_http_success());
-
-  xml::response::Response response(update_response_->response());
-  EXPECT_STREQ(_T("3.0"), response.protocol);
-
-  NetworkRequest* network_request(network_request());
-
-  CString request_age_header;
-  network_request->QueryHeadersString(
-      WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
-      _T("X-RequestAge"),
-      &request_age_header);
-
-  EXPECT_STREQ(_T("200"), request_age_header);
-}
-
-TEST_F(WebServicesClientTest, SendString) {
-  EXPECT_HRESULT_SUCCEEDED(web_service_client_->Initialize(update_check_url_,
-                                                           HeadersVector(),
-                                                           false));
-
-  // Test sending a user update check request.
-  CString request_string =
-    _T("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
-    _T("<request protocol=\"3.0\" testsource=\"dev\"></request>");
-  scoped_ptr<xml::UpdateResponse> response(xml::UpdateResponse::Create());
-  EXPECT_HRESULT_SUCCEEDED(web_service_client_->SendString(&request_string,
-                                                           response.get()));
-  EXPECT_TRUE(web_service_client_->is_http_success());
-}
-
-TEST_F(WebServicesClientTest, SendStringWithCustomHeader) {
-  HeadersVector headers;
-  headers.push_back(std::make_pair(_T("X-FooBar"), _T("424")));
-
-  EXPECT_HRESULT_SUCCEEDED(web_service_client_->Initialize(update_check_url_,
-                                                           headers,
-                                                           false));
-
-  // Test sending a user update check request.
-  CString request_string =
-    _T("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
-    _T("<request protocol=\"3.0\" testsource=\"dev\"></request>");
-  scoped_ptr<xml::UpdateResponse> response(xml::UpdateResponse::Create());
-  EXPECT_HRESULT_SUCCEEDED(web_service_client_->SendString(&request_string,
-                                                           response.get()));
-  EXPECT_TRUE(web_service_client_->is_http_success());
-
-  NetworkRequest* network_request(network_request());
-
-  CString foobar_header;
-  network_request->QueryHeadersString(
-      WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
-      _T("X-FooBar"),
-      &foobar_header);
-
-  EXPECT_STREQ(_T("424"), foobar_header);
-}
-
-}  // namespace omaha
-
diff --git a/common/webplugin_utils.cc b/common/webplugin_utils.cc
deleted file mode 100644
index 168199b..0000000
--- a/common/webplugin_utils.cc
+++ /dev/null
@@ -1,224 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/common/webplugin_utils.h"
-
-#include "omaha/base/app_util.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/path.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/string.h"
-#include "omaha/base/system.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/xml_utils.h"
-#include "omaha/common/command_line_builder.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/common/lang.h"
-#include "omaha/net/browser_request.h"
-#include "omaha/net/cup_request.h"
-#include "omaha/net/network_request.h"
-#include "omaha/net/simple_request.h"
-
-namespace omaha {
-
-namespace webplugin_utils {
-
-HRESULT BuildOneClickRequestString(const CommandLineArgs& args,
-                                   CString* request_str) {
-  if (NULL == request_str) {
-    return E_INVALIDARG;
-  }
-
-  // If we're not /webplugin or the urldomain is empty, something's wrong.
-  if (args.mode != COMMANDLINE_MODE_WEBPLUGIN ||
-      args.webplugin_urldomain.IsEmpty()) {
-    return E_UNEXPECTED;
-  }
-
-  const TCHAR* request_string_template = _T("?du=%s&args=%s");
-  CString request;
-
-  CString urldomain_escaped;
-  CString pluginargs_escaped;
-
-  StringEscape(args.webplugin_urldomain, false, &urldomain_escaped);
-  StringEscape(args.webplugin_args, false, &pluginargs_escaped);
-
-  SafeCStringFormat(&request, request_string_template,
-                    urldomain_escaped,
-                    pluginargs_escaped);
-
-  *request_str = request;
-  return S_OK;
-}
-
-HRESULT IsLanguageSupported(const CString& webplugin_args) {
-  CString cmd_line;
-  SafeCStringFormat(&cmd_line, _T("gu.exe %s"), webplugin_args);
-  CommandLineArgs parsed_args;
-  HRESULT hr = ParseCommandLine(cmd_line, &parsed_args);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[ParseCommandLine failed][0x%08x]"), hr));
-    return hr;
-  }
-
-
-  if (!lang::IsLanguageSupported(parsed_args.extra.language)) {
-    CORE_LOG(LE, (_T("Language not supported][%s]"),
-                  parsed_args.extra.language));
-    return GOOPDATE_E_ONECLICK_LANGUAGE_NOT_SUPPORTED;
-  }
-
-  return S_OK;
-}
-
-HRESULT BuildOneClickWorkerArgs(const CommandLineArgs& args,
-                                CString* oneclick_args) {
-  ASSERT1(oneclick_args);
-
-  // Since this is being called via WebPlugin only, we can rebuild the
-  // command line arguments from the valid params we can send on.
-  // For example, the web plugin will not send crash_cmd or debug_cmd
-  // or reg_server or unreg_server so we don't have to worry about those here.
-  CString cmd_line_args;
-  CommandLineArgs webplugin_cmdline_args;
-
-  // ParseCommandLine assumes the first argument is the program being run.
-  // Don't want to enforce that constraint on our callers, so we prepend with a
-  // fake exe name.
-  CString args_to_parse;
-  SafeCStringFormat(&args_to_parse, _T("%s %s"),
-                    kOmahaShellFileName,
-                    args.webplugin_args);
-
-  // Parse the arguments we received as the second parameter to /webplugin.
-  HRESULT hr = ParseCommandLine(args_to_parse, &webplugin_cmdline_args);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Silent and other non-standard installs could be malicious. Prevent them.
-  if (webplugin_cmdline_args.mode != COMMANDLINE_MODE_INSTALL) {
-    return E_INVALIDARG;
-  }
-  if (webplugin_cmdline_args.is_silent_set ||
-      webplugin_cmdline_args.is_eula_required_set) {
-    return E_INVALIDARG;
-  }
-
-  CommandLineBuilder builder(COMMANDLINE_MODE_INSTALL);
-  builder.set_extra_args(webplugin_cmdline_args.extra_args_str);
-
-  // We expect this value from the plugin.
-  ASSERT1(!args.install_source.IsEmpty());
-  if (args.install_source.IsEmpty()) {
-    return E_INVALIDARG;
-  }
-
-  builder.set_install_source(args.install_source);
-
-  *oneclick_args = builder.GetCommandLineArgs();
-
-  return S_OK;
-}
-
-// It is important that current_goopdate_path be the version path and not the
-// Update\ path.
-HRESULT CopyGoopdateToTempDir(const CPath& current_goopdate_path,
-                              CPath* goopdate_temp_path) {
-  ASSERT1(goopdate_temp_path);
-
-  // Create a unique directory in the user's temp directory.
-  TCHAR pathbuf[MAX_PATH] = {0};
-  DWORD ret = ::GetTempPath(arraysize(pathbuf), pathbuf);
-  if (0 == ret) {
-    return HRESULTFromLastError();
-  }
-  if (ret >= arraysize(pathbuf)) {
-    return E_FAIL;
-  }
-
-  GUID guid = GUID_NULL;
-  HRESULT hr = ::CoCreateGuid(&guid);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CString guid_str = GuidToString(guid);
-  CPath temp_path = pathbuf;
-  temp_path.Append(guid_str);
-  temp_path.Canonicalize();
-
-  hr = CreateDir(temp_path, NULL);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = File::CopyTree(current_goopdate_path, temp_path, true);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CORE_LOG(L2, (_T("[CopyGoopdateToTempDir][temp_path = %s]"), temp_path));
-  *goopdate_temp_path = temp_path;
-  return S_OK;
-}
-
-HRESULT DoOneClickInstall(const CommandLineArgs& args) {
-  CString cmd_line_args;
-  HRESULT hr = BuildOneClickWorkerArgs(args, &cmd_line_args);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[BuildOneClickWorkerArgs failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  CORE_LOG(L2, (_T("[DoOneClickInstall][cmd_line_args: %s]"), cmd_line_args));
-
-  // Check if we're running from the machine dir.
-  // If we're not, we must be running from user directory since OneClick only
-  // works against installed versions of Omaha.
-  CPath current_goopdate_path(app_util::GetCurrentModuleDirectory());
-  CPath goopdate_temp_path;
-  hr = CopyGoopdateToTempDir(current_goopdate_path, &goopdate_temp_path);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[CopyGoopdateToTempDir failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  CPath goopdate_temp_exe_path = goopdate_temp_path;
-  goopdate_temp_exe_path.Append(kOmahaShellFileName);
-
-  // Launch goopdate again with the updated command line arguments.
-  hr = System::ShellExecuteProcess(goopdate_temp_exe_path,
-                                   cmd_line_args,
-                                   NULL,
-                                   NULL);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[ShellExecuteProcess failed][%s][0x%08x]"),
-                  goopdate_temp_exe_path, hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-}  // namespace webplugin_utils
-
-}  // namespace omaha
-
diff --git a/common/webplugin_utils.h b/common/webplugin_utils.h
deleted file mode 100644
index adbb2ea..0000000
--- a/common/webplugin_utils.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_WEBPLUGIN_UTILS_H__
-#define OMAHA_COMMON_WEBPLUGIN_UTILS_H__
-
-#include <windows.h>
-#include <atlpath.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-#include "omaha/common/command_line.h"
-#include "omaha/common/config_manager.h"
-
-namespace omaha {
-
-namespace webplugin_utils {
-
-// Parses the arguments, extracts the language parameter, and verifies that we
-// support the requested language.
-HRESULT IsLanguageSupported(const CString& webplugin_args);
-
-// Copies required Goopdate files to a temp location before installing.
-HRESULT CopyGoopdateToTempDir(const CPath& current_goopdate_path,
-                              CPath* goopdate_temp_path);
-
-// Launches google_update.exe based on parameters sent with /webplugin.
-HRESULT DoOneClickInstall(const CommandLineArgs& args);
-
-// Creates request string for the webplugin URL check webservice call.
-HRESULT BuildOneClickRequestString(const CommandLineArgs& args,
-                                   CString* request_str);
-
-// Builds up the command line arguments to re-launch google_update.exe
-// when called with /pi.
-HRESULT BuildOneClickWorkerArgs(const CommandLineArgs& args, CString* args_out);
-
-}  // namespace webplugin_utils
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_WEBPLUGIN_UTILS_H__
diff --git a/common/webplugin_utils_unittest.cc b/common/webplugin_utils_unittest.cc
deleted file mode 100644
index c1c4e89..0000000
--- a/common/webplugin_utils_unittest.cc
+++ /dev/null
@@ -1,156 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/app_util.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/path.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/webplugin_utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace webplugin_utils {
-
-#define YOUTUBEUPLOADEREN_TAG \
-    _T("\"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&") \
-    _T("appname=YouTubeUploader&needsadmin=False&lang=en\"")
-
-
-TEST(WebPluginUtilsTest, BuildOneClickRequestString_NullOutParam) {
-  CommandLineArgs args;
-  EXPECT_EQ(E_INVALIDARG, BuildOneClickRequestString(args, NULL));
-}
-
-TEST(WebPluginUtilsTest, BuildOneClickRequestString_WrongArgs) {
-  CommandLineArgs args;
-  CString request;
-  EXPECT_EQ(E_UNEXPECTED, BuildOneClickRequestString(args, &request));
-}
-
-TEST(WebPluginUtilsTest, BuildOneClickRequestString_NoUrlDomain) {
-  CommandLineArgs args;
-  CString request;
-
-  args.mode = COMMANDLINE_MODE_WEBPLUGIN;
-  EXPECT_EQ(E_UNEXPECTED, BuildOneClickRequestString(args, &request));
-}
-
-TEST(WebPluginUtilsTest, BuildOneClickRequestString_Valid) {
-  CommandLineArgs args;
-  CString request;
-
-  args.mode = COMMANDLINE_MODE_WEBPLUGIN;
-  args.webplugin_urldomain = _T("http://www.google.com/");
-  args.webplugin_args = _T("/install \"appguid=")
-      _T("{8A69D345-D564-463c-AFF1-A69D9E530F96}")
-      _T("&appname=Google Chrome&needsadmin=true&lang=en\"");
-  EXPECT_EQ(S_OK, BuildOneClickRequestString(args, &request));
-
-  EXPECT_STREQ(_T("?du=http://www.google.com/&args=/install%20")
-               _T("%22appguid=%7B8A69D345-D564-463c-AFF1-A69D9E530F96")
-               _T("%7D%26appname=Google%20Chrome%26needsadmin=true%26")
-               _T("lang=en%22"),
-               request);
-}
-
-TEST(WebPluginUtilsTest, BuildOneClickWorkerArgs_Valid) {
-  CommandLineArgs args;
-  CString oneclick_args;
-
-  args.install_source = _T("oneclick");
-  args.webplugin_args = _T("/install \"appguid=")
-      _T("{8A69D345-D564-463c-AFF1-A69D9E530F96}")
-      _T("&appname=Google Chrome&needsadmin=true&lang=en\"");
-  EXPECT_EQ(S_OK, BuildOneClickWorkerArgs(args, &oneclick_args));
-
-  EXPECT_STREQ(_T("/install ")
-               _T("\"appguid={8A69D345-D564-463c-AFF1-A69D9E530F96}")
-               _T("&appname=Google Chrome&needsadmin=true&lang=en\" ")
-               _T("/installsource oneclick"),
-               oneclick_args);
-}
-
-// This tests valid command line args that are not valid to be sent through
-// to google_update.exe (e.g. /install).
-TEST(WebPluginUtilsTest, BuildOneClickWorkerArgs_Invalid) {
-  CommandLineArgs args;
-  CString oneclick_args;
-
-  args.install_source = _T("oneclick");
-
-  args.webplugin_args = _T("/handoff ") YOUTUBEUPLOADEREN_TAG;
-  EXPECT_EQ(E_INVALIDARG, BuildOneClickWorkerArgs(args, &oneclick_args));
-
-  args.webplugin_args = _T("/regserver");
-  EXPECT_EQ(E_INVALIDARG, BuildOneClickWorkerArgs(args, &oneclick_args));
-
-  args.webplugin_args = _T("/unregserver");
-  EXPECT_EQ(E_INVALIDARG, BuildOneClickWorkerArgs(args, &oneclick_args));
-
-  args.webplugin_args = _T("/install ") YOUTUBEUPLOADEREN_TAG _T(" /silent");
-  EXPECT_EQ(E_INVALIDARG, BuildOneClickWorkerArgs(args, &oneclick_args));
-}
-
-TEST(WebPluginUtilsTest, CopyGoopdateToTempDir) {
-  CPath current_goopdate_path(app_util::GetCurrentModuleDirectory());
-  current_goopdate_path.Append(_T("unittest_support\\omaha_1.3.x\\"));
-  CPath goopdate_temp_path;
-  ASSERT_SUCCEEDED(CopyGoopdateToTempDir(current_goopdate_path,
-                                         &goopdate_temp_path));
-
-  std::vector<CString> files;
-  EXPECT_HRESULT_SUCCEEDED(FindFilesEx(goopdate_temp_path, _T("*.*"), &files));
-
-  EXPECT_EQ(3, files.size());
-
-  std::map<CString, int> files_map;
-  for (size_t file_index = 0; file_index < files.size(); ++file_index) {
-    files_map[files[file_index]] = 1;
-  }
-
-  EXPECT_TRUE(files_map.find(_T("GoogleUpdate.exe")) != files_map.end());
-  EXPECT_TRUE(files_map.find(_T("goopdate.dll")) != files_map.end());
-  EXPECT_TRUE(files_map.find(_T("goopdateres_en.dll")) != files_map.end());
-
-  EXPECT_HRESULT_SUCCEEDED(DeleteDirectory(goopdate_temp_path));
-}
-
-TEST(WebPluginUtilsTest, IsLanguageSupported_InvalidArgs) {
-  CString args = _T("/en");
-  EXPECT_FAILED(IsLanguageSupported(args));
-}
-
-TEST(WebPluginUtilsTest, IsLanguageSupported_LangOK) {
-  CString args = _T("/install \"appguid=")
-                 _T("{8A69D345-D564-463c-AFF1-A69D9E530F96}")
-                 _T("&appname=Google Chrome&needsadmin=true&lang=en\"");
-  EXPECT_SUCCEEDED(IsLanguageSupported(args));
-}
-
-TEST(WebPluginUtilsTest, IsLanguageSupported_LangNotFound) {
-  CString args = _T("/install \"appguid=")
-                 _T("{8A69D345-D564-463c-AFF1-A69D9E530F96}")
-                 _T("&appname=Google Chrome&needsadmin=true&lang=zz\"");
-
-  EXPECT_EQ(GOOPDATE_E_ONECLICK_LANGUAGE_NOT_SUPPORTED,
-            IsLanguageSupported(args));
-}
-
-}  // namespace webplugin_utils
-
-}  // namespace omaha
-
diff --git a/common/xml_const.cc b/common/xml_const.cc
deleted file mode 100644
index 0122a2b..0000000
--- a/common/xml_const.cc
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/common/xml_const.h"
-
-namespace omaha {
-
-namespace xml {
-
-const TCHAR* const kXmlDirective =
-    _T("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
-
-const TCHAR* const kXmlNamespace = NULL;
-
-namespace element {
-
-const TCHAR* const kAction = _T("action");
-const TCHAR* const kActions = _T("actions");
-const TCHAR* const kApp = _T("app");
-const TCHAR* const kData = _T("data");
-const TCHAR* const kDayStart = _T("daystart");
-
-// ping element. The element is named "event" for legacy reasons.
-const TCHAR* const kEvent = _T("event");
-const TCHAR* const kManifest = _T("manifest");
-const TCHAR* const kOs = _T("os");
-const TCHAR* const kPackage = _T("package");
-const TCHAR* const kPackages = _T("packages");
-
-// didrun element. The element is named "ping" for legacy reasons.
-const TCHAR* const kPing = _T("ping");
-const TCHAR* const kRequest = _T("request");
-const TCHAR* const kResponse = _T("response");
-const TCHAR* const kUpdateCheck = _T("updatecheck");
-const TCHAR* const kUrl = _T("url");
-const TCHAR* const kUrls = _T("urls");
-
-}  // namespace element
-
-namespace attribute {
-
-const TCHAR* const kActive = _T("active");
-const TCHAR* const kAdditionalParameters = _T("ap");
-const TCHAR* const kAppBytesDownloaded = _T("downloaded");
-const TCHAR* const kAppBytesTotal = _T("total");
-const TCHAR* const kAppGuid = _T("appguid");
-const TCHAR* const kApplicationName = _T("appname");
-const TCHAR* const kAppId = _T("appid");
-const TCHAR* const kArch = _T("arch");
-const TCHAR* const kArguments = _T("arguments");
-const TCHAR* const kBrandCode = _T("brand");
-const TCHAR* const kBrowserType = _T("browser");
-const TCHAR* const kClientId = _T("client");
-const TCHAR* const kCodebase = _T("codebase");
-const TCHAR* const kCountry = _T("country");
-const TCHAR* const kDaysSinceLastActivePing = _T("a");
-const TCHAR* const kDaysSinceLastRollCall = _T("r");
-const TCHAR* const kDownloadTime = _T("download_time_ms");
-const TCHAR* const kElapsedSeconds = _T("elapsed_seconds");
-const TCHAR* const kErrorCode = _T("errorcode");
-const TCHAR* const kEvent = _T("event");
-const TCHAR* const kEventResult = _T("eventresult");
-const TCHAR* const kEventType = _T("eventtype");
-const TCHAR* const kErrorUrl = _T("errorurl");
-const TCHAR* const kExperiments = _T("experiments");
-const TCHAR* const kExtraCode1 = _T("extracode1");
-const TCHAR* const kHash = _T("hash");
-const TCHAR* const kIndex = _T("index");
-const TCHAR* const kInstalledAgeDays = _T("installage");
-const TCHAR* const kIsMachine = _T("ismachine");
-const TCHAR* const kInstallationId = _T("iid");
-const TCHAR* const kInstallSource = _T("installsource");
-const TCHAR* const kOriginURL = _T("originurl");
-const TCHAR* const kLang = _T("lang");
-const TCHAR* const kName = _T("name");
-const TCHAR* const kNextVersion = _T("nextversion");
-const TCHAR* const kParameter = _T("parameter");
-const TCHAR* const kPeriodOverrideSec = _T("periodoverridesec");
-const TCHAR* const kPlatform = _T("platform");
-const TCHAR* const kProtocol = _T("protocol");
-const TCHAR* const kRequestId = _T("requestid");
-const TCHAR* const kRequired = _T("required");
-const TCHAR* const kRun = _T("run");
-const TCHAR* const kServicePack = _T("sp");
-const TCHAR* const kSessionId = _T("sessionid");
-const TCHAR* const kSignature = _T("signature");
-const TCHAR* const kSize = _T("size");
-const TCHAR* const kStatus = _T("status");
-const TCHAR* const kSuccessAction = _T("onsuccess");
-const TCHAR* const kSuccessUrl = _T("successurl");
-const TCHAR* const kTestSource = _T("testsource");
-const TCHAR* const kTerminateAllBrowsers = _T("terminateallbrowsers");
-const TCHAR* const kTTToken = _T("tttoken");
-const TCHAR* const kUpdateDisabled = _T("updatedisabled");
-const TCHAR* const kUserId = _T("userid");
-const TCHAR* const kVersion = _T("version");
-const TCHAR* const kXmlns = _T("xmlns");
-
-}  // namespace attribute
-
-namespace value {
-
-const TCHAR* const kArchAmd64 = _T("x64");
-const TCHAR* const kArchIntel = _T("x86");
-const TCHAR* const kArchUnknown = _T("unknown");
-const TCHAR* const kFalse = _T("false");
-const TCHAR* const kInstall = _T("install");
-const TCHAR* const kInstallData = _T("install");
-const TCHAR* const kPostinstall = _T("postinstall");
-const TCHAR* const kPreinstall = _T("preinstall");
-const TCHAR* const kRequestType = _T("UpdateRequest");
-const TCHAR* const kStatusError = _T("error");
-const TCHAR* const kSuccessActionDefault = _T("default");
-const TCHAR* const kSuccessActionExitSilently = _T("exitsilently");
-const TCHAR* const kSuccessActionExitSilentlyOnLaunchCmd =
-    _T("exitsilentlyonlaunchcmd");
-const TCHAR* const kTrue = _T("true");
-const TCHAR* const kUpdate = _T("update");
-const TCHAR* const kVersion3 = _T("3.0");
-
-}  // namespace value
-
-}  // namespace xml
-
-}  // namespace omaha
diff --git a/common/xml_const.h b/common/xml_const.h
deleted file mode 100644
index e18ae9e..0000000
--- a/common/xml_const.h
+++ /dev/null
@@ -1,143 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_XML_CONST_H_
-#define OMAHA_COMMON_XML_CONST_H_
-
-#include <windows.h>
-#include <atlbase.h>
-#include <atlstr.h>
-
-namespace omaha {
-
-namespace xml {
-
-const int kGuidLen = 38;
-
-extern const TCHAR* const kXmlDirective;
-extern const TCHAR* const kXmlNamespace;
-
-namespace element {
-
-extern const TCHAR* const kAction;
-extern const TCHAR* const kActions;
-extern const TCHAR* const kApp;
-extern const TCHAR* const kData;
-extern const TCHAR* const kDayStart;
-
-// ping element. The element is named "event" for legacy reasons.
-extern const TCHAR* const kEvent;
-extern const TCHAR* const kManifest;
-extern const TCHAR* const kOs;
-extern const TCHAR* const kPackage;
-extern const TCHAR* const kPackages;
-
-// didrun element. The element is named "ping" for legacy reasons.
-extern const TCHAR* const kPing;
-extern const TCHAR* const kRequest;
-extern const TCHAR* const kResponse;
-extern const TCHAR* const kUpdateCheck;
-extern const TCHAR* const kUrl;
-extern const TCHAR* const kUrls;
-
-}  // namespace element
-
-namespace attribute {
-
-extern const TCHAR* const kActive;
-extern const TCHAR* const kAdditionalParameters;
-extern const TCHAR* const kAppBytesDownloaded;
-extern const TCHAR* const kAppBytesTotal;
-extern const TCHAR* const kAppGuid;
-extern const TCHAR* const kApplicationName;
-extern const TCHAR* const kAppId;
-extern const TCHAR* const kArch;
-extern const TCHAR* const kArguments;
-extern const TCHAR* const kBrandCode;
-extern const TCHAR* const kBrowserType;
-extern const TCHAR* const kClientId;
-extern const TCHAR* const kCodebase;
-extern const TCHAR* const kCountry;
-extern const TCHAR* const kDaysSinceLastActivePing;
-extern const TCHAR* const kDaysSinceLastRollCall;
-extern const TCHAR* const kDownloadTime;
-extern const TCHAR* const kElapsedSeconds;
-extern const TCHAR* const kErrorCode;
-extern const TCHAR* const kEvent;
-extern const TCHAR* const kEventResult;
-extern const TCHAR* const kEventType;
-extern const TCHAR* const kErrorUrl;
-extern const TCHAR* const kExperiments;
-extern const TCHAR* const kExtraCode1;
-extern const TCHAR* const kHash;
-extern const TCHAR* const kIndex;
-extern const TCHAR* const kInstalledAgeDays;
-extern const TCHAR* const kIsMachine;
-extern const TCHAR* const kInstallationId;
-extern const TCHAR* const kInstallSource;
-extern const TCHAR* const kLang;
-extern const TCHAR* const kName;
-extern const TCHAR* const kNextVersion;
-extern const TCHAR* const kOriginURL;
-extern const TCHAR* const kParameter;
-extern const TCHAR* const kPeriodOverrideSec;
-extern const TCHAR* const kPlatform;
-extern const TCHAR* const kProtocol;
-extern const TCHAR* const kRequestId;
-extern const TCHAR* const kRequired;
-extern const TCHAR* const kRun;
-extern const TCHAR* const kServicePack;
-extern const TCHAR* const kSessionId;
-extern const TCHAR* const kSignature;
-extern const TCHAR* const kSize;
-extern const TCHAR* const kStatus;
-extern const TCHAR* const kSuccessAction;
-extern const TCHAR* const kSuccessUrl;
-extern const TCHAR* const kTestSource;
-extern const TCHAR* const kTerminateAllBrowsers;
-extern const TCHAR* const kTTToken;
-extern const TCHAR* const kUpdateDisabled;
-extern const TCHAR* const kUserId;
-extern const TCHAR* const kVersion;
-extern const TCHAR* const kXmlns;
-
-}  // namespace attribute
-
-namespace value {
-
-extern const TCHAR* const kArchAmd64;
-extern const TCHAR* const kArchIntel;
-extern const TCHAR* const kArchUnknown;
-extern const TCHAR* const kFalse;
-extern const TCHAR* const kInstall;
-extern const TCHAR* const kInstallData;
-extern const TCHAR* const kPostinstall;
-extern const TCHAR* const kPreinstall;
-extern const TCHAR* const kRequestType;
-extern const TCHAR* const kStatusError;
-extern const TCHAR* const kSuccessActionDefault;
-extern const TCHAR* const kSuccessActionExitSilently;
-extern const TCHAR* const kSuccessActionExitSilentlyOnLaunchCmd;
-extern const TCHAR* const kTrue;
-extern const TCHAR* const kUpdate;
-extern const TCHAR* const kVersion3;
-
-}  // namespace value
-
-}  // namespace xml
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_XML_CONST_H_
diff --git a/common/xml_parser.cc b/common/xml_parser.cc
deleted file mode 100644
index 22c9eb1..0000000
--- a/common/xml_parser.cc
+++ /dev/null
@@ -1,1457 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/common/xml_parser.h"
-#include <stdlib.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/error.h"
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/xml_utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/common/update_request.h"
-#include "omaha/common/update_response.h"
-#include "omaha/common/xml_const.h"
-
-namespace omaha {
-
-namespace xml {
-
-namespace {
-
-// Helper structure similar with an std::pair but without a constructor.
-// Instance of it can be stored in arrays.
-template <typename Type1, typename Type2>
-struct Tuple {
-  Type1 first;
-  Type2 second;
-};
-
-// Converts a string to the SuccessfulInstallAction enum.
-HRESULT ConvertStringToSuccessfulInstallAction(
-    const CString& str,
-    SuccessfulInstallAction* successful_install_action) {
-  ASSERT1(successful_install_action);
-
-  const Tuple<const TCHAR*, SuccessfulInstallAction> tuples[] = {
-    { xml::value::kSuccessActionDefault,
-      SUCCESS_ACTION_DEFAULT },
-
-    { xml::value::kSuccessActionExitSilently,
-      SUCCESS_ACTION_EXIT_SILENTLY },
-
-    { xml::value::kSuccessActionExitSilentlyOnLaunchCmd,
-      SUCCESS_ACTION_EXIT_SILENTLY_ON_LAUNCH_CMD },
-  };
-
-  if (str.IsEmpty()) {
-    *successful_install_action = SUCCESS_ACTION_DEFAULT;
-    return S_OK;
-  }
-
-  for (size_t i = 0; i != arraysize(tuples); ++i) {
-    if (str.CompareNoCase(tuples[i].first) == 0) {
-      *successful_install_action = tuples[i].second;
-      return S_OK;
-    }
-  }
-
-  // Using the default action allows Omaha to be forward-compatible with
-  // new SuccessActions, meaning older versions will not fail if a config
-  // uses a new action.
-  ASSERT(false, (_T("[Unrecognized success action][%s]"), str));
-  *successful_install_action = SUCCESS_ACTION_DEFAULT;
-  return S_OK;
-}
-
-HRESULT ConvertStringToInstallEvent(
-    const CString& str,
-    InstallAction::InstallEvent* install_event) {
-  ASSERT1(install_event);
-
-  const Tuple<const TCHAR*, InstallAction::InstallEvent> tuples[] = {
-    {xml::value::kPreinstall,  InstallAction::kPreInstall},
-    {xml::value::kInstall,     InstallAction::kInstall},
-    {xml::value::kUpdate,      InstallAction::kUpdate},
-    {xml::value::kPostinstall, InstallAction::kPostInstall},
-  };
-
-  for (size_t i = 0; i != arraysize(tuples); ++i) {
-    if (str.CompareNoCase(tuples[i].first) == 0) {
-      *install_event = tuples[i].second;
-      return S_OK;
-    }
-  }
-
-  return E_INVALIDARG;
-}
-
-// Returns S_OK if each child element of the node is any of the elements
-// provided as an argument. This is useful to detect if the element contains
-// only known children.
-// TODO(omaha): implement.
-HRESULT AreChildrenAnyOf(IXMLDOMNode* node,
-                         const std::vector<const TCHAR*>& element_names) {
-  UNREFERENCED_PARAMETER(node);
-  UNREFERENCED_PARAMETER(element_names);
-
-  return S_OK;
-}
-
-// TODO(omaha): implement.
-HRESULT HasNoChildren(IXMLDOMNode* node) {
-  UNREFERENCED_PARAMETER(node);
-  return S_OK;
-}
-
-// Verify that the protocol version is understood. We accept
-// all version numbers where major version is the same as kExpectedVersion
-// which are greater than or equal to kExpectedVersion. In other words,
-// we handle future minor version number increases which should be
-// compatible.
-HRESULT VerifyProtocolCompatibility(const CString& actual_version,
-                                    const CString& expected_version) {
-  if (_tcscmp(actual_version, expected_version) != 0) {
-    const double version = String_StringToDouble(actual_version);
-    const double expected = String_StringToDouble(expected_version);
-    if (expected > version) {
-      return GOOPDATEXML_E_XMLVERSION;
-    }
-    const int version_major = static_cast<int>(version);
-    const int expected_major = static_cast<int>(expected);
-    if (version_major != expected_major) {
-      return GOOPDATEXML_E_XMLVERSION;
-    }
-  }
-  return S_OK;
-}
-
-}  // namespace
-
-CString ConvertProcessorArchitectureToString(DWORD arch) {
-  switch (arch) {
-    case PROCESSOR_ARCHITECTURE_INTEL:
-      return xml::value::kArchIntel;
-
-    case PROCESSOR_ARCHITECTURE_AMD64:
-      return xml::value::kArchAmd64;
-
-    default:
-      ASSERT1(false);
-      return xml::value::kArchUnknown;
-  };
-}
-
-// The ElementHandler classes should also be in an anonymous namespace but
-// the base class cannot be because it is used in the header file.
-
-// Defines the base class of a hierarchy that deals with validating and
-// parsing of a single node element in the dom. The implementation uses
-// the template method design pattern.
-class ElementHandler {
- public:
-  ElementHandler() {}
-  virtual ~ElementHandler() {}
-
-  HRESULT Handle(IXMLDOMNode* node, response::Response* response) {
-    ASSERT1(node);
-    ASSERT1(response);
-
-    HRESULT hr = Validate(node);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = Parse(node, response);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    return S_OK;
-  }
-
- private:
-  // Validates a node and returns S_OK in case of success.
-  virtual HRESULT Validate(IXMLDOMNode* node) {
-    UNREFERENCED_PARAMETER(node);
-    return S_OK;
-  }
-
-  // Parses the node and stores its values in the response.
-  virtual HRESULT Parse(IXMLDOMNode* node, response::Response* response) {
-    UNREFERENCED_PARAMETER(node);
-    UNREFERENCED_PARAMETER(response);
-    return S_OK;
-  }
-
-  DISALLOW_COPY_AND_ASSIGN(ElementHandler);
-};
-
-
-// Parses 'response'.
-class ResponseElementHandler : public ElementHandler {
- public:
-  static ElementHandler* Create() { return new ResponseElementHandler; }
-
- private:
-  virtual HRESULT Parse(IXMLDOMNode* node, response::Response* response) {
-    HRESULT hr = ReadStringAttribute(node,
-                                     xml::attribute::kProtocol,
-                                     &response->protocol);
-    if (FAILED(hr)) {
-      return hr;
-    }
-    hr = VerifyProtocolCompatibility(response->protocol, xml::value::kVersion3);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    return S_OK;
-  }
-};
-
-// Parses 'app'.
-class AppElementHandler : public ElementHandler {
- public:
-  static ElementHandler* Create() { return new AppElementHandler; }
-
- private:
-  virtual HRESULT Parse(IXMLDOMNode* node, response::Response* response) {
-    response::App app;
-
-    HRESULT hr = ReadStringAttribute(node, xml::attribute::kAppId, &app.appid);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = ReadStringAttribute(node, xml::attribute::kStatus, &app.status);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    // At present, the server may omit the following optional attributes if the
-    // contents would be empty strings.  Guard these reads appropriately.
-    // TODO(omaha3): If we adapt the server to send an empty string for these
-    // attributes, we can remove these checks.
-    if (HasAttribute(node, xml::attribute::kExperiments)) {
-      hr = ReadStringAttribute(node,
-                               xml::attribute::kExperiments,
-                               &app.experiments);
-      if (FAILED(hr)) {
-        return hr;
-      }
-    }
-
-    response->apps.push_back(app);
-    return S_OK;
-  }
-};
-
-
-// Parses 'updatecheck'.
-class UpdateCheckElementHandler : public ElementHandler {
- public:
-  static ElementHandler* Create() { return new UpdateCheckElementHandler; }
-
- private:
-  virtual HRESULT Parse(IXMLDOMNode* node, response::Response* response) {
-    response::UpdateCheck& update_check = response->apps.back().update_check;
-
-    ReadStringAttribute(node,
-                        xml::attribute::kTTToken,
-                        &update_check.tt_token);
-
-    ReadStringAttribute(node,
-                        xml::attribute::kErrorUrl,
-                        &update_check.error_url);
-
-    return ReadStringAttribute(node,
-                               xml::attribute::kStatus,
-                               &update_check.status);
-  }
-};
-
-
-// Parses 'urls'.
-class UrlsElementHandler : public ElementHandler {
- public:
-  static ElementHandler* Create() { return new UrlsElementHandler; }
-};
-
-
-// Parses 'url'.
-class UrlElementHandler : public ElementHandler {
- public:
-  static ElementHandler* Create() { return new UrlElementHandler; }
-
- private:
-  virtual HRESULT Parse(IXMLDOMNode* node, response::Response* response) {
-    CString url;
-    HRESULT hr = ReadStringAttribute(node, xml::attribute::kCodebase, &url);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    response::UpdateCheck& update_check = response->apps.back().update_check;
-    update_check.urls.push_back(url);
-
-    return S_OK;
-  }
-};
-
-
-// Parses 'manifest'.
-class ManifestElementHandler : public ElementHandler {
- public:
-  static ElementHandler* Create() { return new ManifestElementHandler; }
-
- private:
-  virtual HRESULT Parse(IXMLDOMNode* node, response::Response* response) {
-    InstallManifest& install_manifest =
-        response->apps.back().update_check.install_manifest;
-    // TODO(omaha3): Uncomment when version becomes a required value for
-    // version 2 configs.
-    /*return*/ ReadStringAttribute(node,
-                               xml::attribute::kVersion,
-                               &install_manifest.version);
-    return S_OK;
-  }
-};
-
-
-// Parses 'packages'.
-class PackagesElementHandler : public ElementHandler {
- public:
-  static ElementHandler* Create() { return new PackagesElementHandler; }
-};
-
-
-
-// Parses 'package'.
-class PackageElementHandler : public ElementHandler {
- public:
-  static ElementHandler* Create() { return new PackageElementHandler; }
-
- private:
-  virtual HRESULT Parse(IXMLDOMNode* node, response::Response* response) {
-    InstallPackage install_package;
-
-    HRESULT hr = ReadStringAttribute(node,
-                                     xml::attribute::kName,
-                                     &install_package.name);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    install_package.is_required = true;
-    hr = ReadBooleanAttribute(node,
-                              xml::attribute::kRequired,
-                              &install_package.is_required);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = ReadIntAttribute(node, xml::attribute::kSize, &install_package.size);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = ReadStringAttribute(node,
-                             xml::attribute::kHash,
-                             &install_package.hash);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    InstallManifest& install_manifest =
-        response->apps.back().update_check.install_manifest;
-    install_manifest.packages.push_back(install_package);
-
-    return S_OK;
-  }
-};
-
-// Parses 'actions'.
-class ActionsElementHandler : public ElementHandler {
- public:
-  static ElementHandler* Create() { return new ActionsElementHandler; }
-};
-
-
-// Parses 'action'.
-class ActionElementHandler : public ElementHandler {
- public:
-  static ElementHandler* Create() { return new ActionElementHandler; }
-
- private:
-  virtual HRESULT Parse(IXMLDOMNode* node, response::Response* response) {
-    InstallAction install_action;
-
-    CString event;
-    HRESULT hr = ReadStringAttribute(node, xml::attribute::kEvent, &event);
-    if (FAILED(hr)) {
-      return hr;
-    }
-    hr = ConvertStringToInstallEvent(event, &install_action.install_event);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    ReadStringAttribute(node,
-                        xml::attribute::kRun,
-                        &install_action.program_to_run);
-    ReadStringAttribute(node,
-                        xml::attribute::kArguments,
-                        &install_action.program_arguments);
-
-    ReadStringAttribute(node,
-                        xml::attribute::kSuccessUrl,
-                        &install_action.success_url);
-
-    ReadBooleanAttribute(node,
-                         xml::attribute::kTerminateAllBrowsers,
-                         &install_action.terminate_all_browsers);
-
-    CString success_action;
-    ReadStringAttribute(node,
-                        xml::attribute::kSuccessAction,
-                        &success_action);
-    ConvertStringToSuccessfulInstallAction(success_action,
-                                           &install_action.success_action);
-
-    InstallManifest& install_manifest =
-        response->apps.back().update_check.install_manifest;
-    install_manifest.install_actions.push_back(install_action);
-
-    return S_OK;
-  }
-};
-
-
-// Parses 'data'.
-class DataElementHandler : public ElementHandler {
- public:
-  static ElementHandler* Create() { return new DataElementHandler; }
-
- private:
-  virtual HRESULT Parse(IXMLDOMNode* node, response::Response* response) {
-    response->apps.back().data.push_back(response::Data());
-    response::Data& data = response->apps.back().data.back();
-
-    HRESULT hr = ReadStringAttribute(node,
-                                     xml::attribute::kStatus,
-                                     &data.status);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    CString data_name;
-    hr = ReadStringAttribute(node, xml::attribute::kName, &data_name);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    if (xml::value::kInstallData != data_name) {
-      return E_UNEXPECTED;
-    }
-
-    hr = ReadStringAttribute(node,
-                             xml::attribute::kIndex,
-                             &data.install_data_index);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    if (data.status != kResponseStatusOkValue) {
-      // There is no data, so do not try to read it.
-      return S_OK;
-    }
-
-    return ReadStringValue(node, &data.install_data);
-  }
-};
-
-
-// Parses 'ping'.
-class PingElementHandler : public ElementHandler {
- public:
-  static ElementHandler* Create() { return new PingElementHandler; }
-
- private:
-  virtual HRESULT Parse(IXMLDOMNode* node, response::Response* response) {
-    response::Ping& ping = response->apps.back().ping;
-    ReadStringAttribute(node, xml::attribute::kStatus, &ping.status);
-    ASSERT1(ping.status == kResponseStatusOkValue);
-    return S_OK;
-  }
-};
-
-
-// Parses 'event'.
-class EventElementHandler : public ElementHandler {
- public:
-  static ElementHandler* Create() { return new EventElementHandler; }
-
- private:
-  virtual HRESULT Parse(IXMLDOMNode* node, response::Response* response) {
-    response::Event event;
-    ReadStringAttribute(node, xml::attribute::kStatus, &event.status);
-    ASSERT1(event.status == kResponseStatusOkValue);
-    response::App& app = response->apps.back();
-    app.events.push_back(event);
-    return S_OK;
-  }
-};
-
-// Parses 'daystart'.
-class DayStartElementHandler : public ElementHandler {
- public:
-  static ElementHandler* Create() { return new DayStartElementHandler; }
-
- private:
-  virtual HRESULT Parse(IXMLDOMNode* node, response::Response* response) {
-    ReadIntAttribute(node,
-                     xml::attribute::kElapsedSeconds,
-                     &response->day_start.elapsed_seconds);
-    return S_OK;
-  }
-};
-
-namespace v2 {
-
-namespace element {
-
-const TCHAR* const kGUpdate = _T("gupdate");
-
-}  // namespace element
-
-namespace attributev2 {
-
-// Some v2 offline manifests were incorrectly authored as 'Version' with a
-// capital 'V'.
-const TCHAR* const kVersionProperCased = _T("Version");
-
-}  // namespace attribute
-
-namespace value {
-
-const TCHAR* const kVersion2 = _T("2.0");
-
-}  // namespace value
-
-// Parses Omaha v2 'gupdate'.
-class GUpdateElementHandler : public ElementHandler {
- public:
-  static ElementHandler* Create() { return new GUpdateElementHandler; }
-
- private:
-  virtual HRESULT Parse(IXMLDOMNode* node, response::Response* response) {
-    HRESULT hr = ReadStringAttribute(node,
-                                     xml::attribute::kProtocol,
-                                     &response->protocol);
-    if (FAILED(hr)) {
-      return hr;
-    }
-    return VerifyProtocolCompatibility(response->protocol,
-                                       value::kVersion2);
-  }
-};
-
-// Parses Omaha v2 'updatecheck'.
-class UpdateCheckElementHandler : public ElementHandler {
- public:
-  static ElementHandler* Create() { return new UpdateCheckElementHandler; }
-
- private:
-  virtual HRESULT Parse(IXMLDOMNode* node, response::Response* response) {
-    response::UpdateCheck& update_check = response->apps.back().update_check;
-
-    HRESULT hr = ReadStringAttribute(node,
-                                     xml::attribute::kStatus,
-                                     &update_check.status);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    if (update_check.status.CompareNoCase(kResponseStatusOkValue)) {
-      return S_OK;
-    }
-
-    InstallManifest& install_manifest = update_check.install_manifest;
-    if (FAILED(ReadStringAttribute(node,
-                                   xml::attribute::kVersion,
-                                   &install_manifest.version))) {
-      ReadStringAttribute(node,
-                          v2::attributev2::kVersionProperCased,
-                          &install_manifest.version);
-    }
-
-    CString url;
-    hr = ReadStringAttribute(node, xml::attribute::kCodebase, &url);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    int start_file_name_idx = url.ReverseFind(_T('/'));
-    if (start_file_name_idx <= 0) {
-      return GOOPDATEDOWNLOAD_E_INVALID_PATH;
-    }
-    CString base_url = url.Left(start_file_name_idx + 1);
-    update_check.urls.push_back(base_url);
-
-    CString package_name = url.Right(url.GetLength() - start_file_name_idx - 1);
-    if (package_name.IsEmpty()) {
-      return GOOPDATEDOWNLOAD_E_FILE_NAME_EMPTY;
-    }
-
-    InstallPackage install_package;
-    install_package.name = package_name;
-    install_package.is_required = true;
-    hr = ReadIntAttribute(node, xml::attribute::kSize, &install_package.size);
-    if (FAILED(hr)) {
-      return hr;
-    }
-    hr = ReadStringAttribute(node,
-                             xml::attribute::kHash,
-                             &install_package.hash);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    install_manifest.packages.push_back(install_package);
-
-    InstallAction install_action;
-    install_action.install_event = InstallAction::kInstall;
-    install_action.program_to_run = package_name;
-    ReadStringAttribute(node,
-                        xml::attribute::kArguments,
-                        &install_action.program_arguments);
-
-    install_manifest.install_actions.push_back(install_action);
-
-    InstallAction post_install_action;
-    if (SUCCEEDED(ParsePostInstallActions(node, &post_install_action))) {
-      install_manifest.install_actions.push_back(post_install_action);
-    }
-
-    return S_OK;
-  }
-
-  HRESULT ParsePostInstallActions(IXMLDOMNode* node,
-                                  InstallAction* post_install_action) {
-    InstallAction install_action;
-    CString success_action;
-    if (FAILED(ReadStringAttribute(node,
-                                   xml::attribute::kSuccessAction,
-                                   &success_action)) &&
-        FAILED(ReadStringAttribute(node,
-                                   xml::attribute::kSuccessUrl,
-                                   &install_action.success_url)) &&
-        FAILED(ReadBooleanAttribute(node,
-                                    xml::attribute::kTerminateAllBrowsers,
-                                    &install_action.terminate_all_browsers))) {
-      return HRESULT_FROM_WIN32(ERROR_NOT_FOUND);
-    }
-
-    install_action.install_event = InstallAction::kPostInstall;
-    ReadStringAttribute(node, xml::attribute::kSuccessAction, &success_action);
-    ConvertStringToSuccessfulInstallAction(success_action,
-                                           &install_action.success_action);
-    ReadStringAttribute(node,
-                        xml::attribute::kSuccessUrl,
-                        &install_action.success_url);
-    ReadBooleanAttribute(node,
-                         xml::attribute::kTerminateAllBrowsers,
-                         &install_action.terminate_all_browsers);
-    *post_install_action = install_action;
-    return S_OK;
-  }
-};
-
-}  // namespace v2
-
-XmlParser::XmlParser() {}
-
-void XmlParser::InitializeElementHandlers() {
-  const Tuple<const TCHAR*, ElementHandler* (*)()> tuples[] = {
-    {xml::element::kAction, &ActionElementHandler::Create},
-    {xml::element::kActions, &ActionsElementHandler::Create},
-    {xml::element::kApp, &AppElementHandler::Create},
-    {xml::element::kData, &DataElementHandler::Create},
-    {xml::element::kDayStart, &DayStartElementHandler::Create},
-    {xml::element::kEvent, &EventElementHandler::Create},
-    {xml::element::kManifest, &ManifestElementHandler::Create},
-    {xml::element::kPackage, &PackageElementHandler::Create},
-    {xml::element::kPackages, &PackagesElementHandler::Create},
-    {xml::element::kPing, &PingElementHandler::Create},
-    {xml::element::kResponse, &ResponseElementHandler::Create},
-    {xml::element::kUpdateCheck, &UpdateCheckElementHandler::Create},
-    {xml::element::kUrl, &UrlElementHandler::Create},
-    {xml::element::kUrls, &UrlsElementHandler::Create},
-  };
-
-  for (size_t i = 0; i != arraysize(tuples); ++i) {
-    VERIFY1(element_handler_factory_.Register(tuples[i].first,
-                                              tuples[i].second));
-  }
-}
-
-// The AppElementHandler and the DataElementHandler are shared, because the
-// format is identical between Omaha v2 and Omaha v3. We should make copies of
-// the shared classes if these elements diverge between v2 and v3. The worst
-// case scenario is that we break v2 compatibility if we do not do a
-// copy-on-write, which might be acceptable.
-void XmlParser::InitializeLegacyElementHandlers() {
-  const Tuple<const TCHAR*, ElementHandler* (*)()> tuples[] = {
-    {xml::element::kApp, &AppElementHandler::Create},
-    {xml::element::kData, &DataElementHandler::Create},
-    {v2::element::kGUpdate, &v2::GUpdateElementHandler::Create},
-    {xml::element::kUpdateCheck, &v2::UpdateCheckElementHandler::Create},
-  };
-
-  for (size_t i = 0; i != arraysize(tuples); ++i) {
-    VERIFY1(element_handler_factory_.Register(tuples[i].first,
-                                              tuples[i].second));
-  }
-}
-
-HRESULT XmlParser::SerializeRequest(const UpdateRequest& update_request,
-                                    CString* buffer) {
-  ASSERT1(buffer);
-
-  XmlParser xml_parser;
-
-  HRESULT hr = xml_parser.BuildDom(update_request.request());
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = xml_parser.GetXml(buffer);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT XmlParser::BuildDom(const request::Request& request) {
-  CORE_LOG(L3, (_T("[XmlParser::BuildDom]")));
-  HRESULT hr = CoCreateSafeDOMDocument(&document_);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  request_ = &request;
-
-  hr = BuildRequestElement();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// Extract the string out of the DOM, and add the initial processing
-// instruction. The xml property of the document converts to the document from
-// its original encoding to Unicode. As a result, the xml directive and the
-// desired encoding must be explicitely set here.
-HRESULT XmlParser::GetXml(CString* buffer) {
-  CORE_LOG(L3, (_T("[XmlParser::GetXml]")));
-
-  ASSERT1(buffer);
-
-  CComBSTR xml_body;
-  HRESULT hr = document_->get_xml(&xml_body);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  *buffer = kXmlDirective;
-  *buffer += xml_body;
-
-  // The xml string contains a CR LF pair at the end.
-  buffer->TrimRight(_T("\r\n"));
-
-  return S_OK;
-}
-
-
-HRESULT XmlParser::BuildRequestElement() {
-  CORE_LOG(L3, (_T("[XmlParser::BuildRequestElement]")));
-
-  CComPtr<IXMLDOMNode> element;
-  HRESULT hr = CreateElementNode(xml::element::kRequest, _T(""), &element);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  ASSERT1(request_);
-
-  // Add attributes to the top element:
-  // * protocol - protocol version
-  // * version - Omaha version
-  // * ismachine - is machine Omaha
-  // * installsource - install source
-  // * originurl - origin url, primarily set by Update3Web plugins
-  // * testsource - test source
-  // * requestid - unique request ID
-  // * periodoverridesec - override value for update check frequency
-
-  hr = AddXMLAttributeNode(element,
-                           kXmlNamespace,
-                           xml::attribute::kProtocol,
-                           request_->protocol_version);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = AddXMLAttributeNode(element,
-                           kXmlNamespace,
-                           xml::attribute::kVersion,
-                           request_->omaha_version);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = AddXMLAttributeNode(element,
-                           kXmlNamespace,
-                           xml::attribute::kIsMachine,
-                           request_->is_machine ? _T("1") : _T("0"));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = AddXMLAttributeNode(element,
-                           kXmlNamespace,
-                           xml::attribute::kSessionId,
-                           request_->session_id);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (!request_->uid.IsEmpty()) {
-    hr = AddXMLAttributeNode(element,
-                             kXmlNamespace,
-                             xml::attribute::kUserId,
-                             request_->uid);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  if (!request_->install_source.IsEmpty()) {
-    hr = AddXMLAttributeNode(element,
-                             kXmlNamespace,
-                             xml::attribute::kInstallSource,
-                             request_->install_source);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  if (!request_->origin_url.IsEmpty()) {
-    hr = AddXMLAttributeNode(element,
-                             kXmlNamespace,
-                             xml::attribute::kOriginURL,
-                             request_->origin_url);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  if (!request_->test_source.IsEmpty()) {
-    hr = AddXMLAttributeNode(element,
-                             kXmlNamespace,
-                             xml::attribute::kTestSource,
-                             request_->test_source);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  if (!request_->request_id.IsEmpty()) {
-    hr = AddXMLAttributeNode(element,
-                             kXmlNamespace,
-                             xml::attribute::kRequestId,
-                             request_->request_id);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  if (request_->check_period_sec != -1) {
-    hr = AddXMLAttributeNode(element,
-                             kXmlNamespace,
-                             xml::attribute::kPeriodOverrideSec,
-                             itostr(request_->check_period_sec));
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  hr = BuildOsElement(element);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Add the app element sequence to the request.
-  hr = BuildAppElement(element);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Add the request node to the document root.
-  CComPtr<IXMLDOMElement> element_node;
-  hr = element->QueryInterface(&element_node);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = document_->putref_documentElement(element_node);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT XmlParser::BuildOsElement(IXMLDOMNode* parent_node) {
-  CORE_LOG(L3, (_T("[XmlParser::BuildOsElement]")));
-
-  ASSERT1(parent_node);
-  ASSERT1(request_);
-
-  CComPtr<IXMLDOMNode> element;
-  HRESULT hr = CreateElementNode(xml::element::kOs, _T(""), &element);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = AddXMLAttributeNode(element,
-                           kXmlNamespace,
-                           xml::attribute::kPlatform,
-                           request_->os.platform);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = AddXMLAttributeNode(element,
-                           kXmlNamespace,
-                           xml::attribute::kVersion,
-                           request_->os.version);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = AddXMLAttributeNode(element,
-                           kXmlNamespace,
-                           xml::attribute::kServicePack,
-                           request_->os.service_pack);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = AddXMLAttributeNode(element,
-                           kXmlNamespace,
-                           xml::attribute::kArch,
-                           request_->os.arch);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = parent_node->appendChild(element, NULL);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// Create and add request's to the requests node.
-HRESULT XmlParser::BuildAppElement(IXMLDOMNode* parent_node) {
-  CORE_LOG(L3, (_T("[XmlParser::BuildAppElement]")));
-
-  ASSERT1(parent_node);
-  ASSERT1(request_);
-
-  for (size_t i = 0; i < request_->apps.size(); ++i) {
-    const request::App& app = request_->apps[i];
-
-    CComPtr<IXMLDOMNode> element;
-    HRESULT hr = CreateElementNode(xml::element::kApp, _T(""), &element);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    ASSERT1(IsGuid(app.app_id));
-    hr = AddXMLAttributeNode(element,
-                             kXmlNamespace,
-                             xml::attribute::kAppId,
-                             app.app_id);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = AddXMLAttributeNode(element,
-                             kXmlNamespace,
-                             xml::attribute::kVersion,
-                             app.version);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = AddXMLAttributeNode(element,
-                             kXmlNamespace,
-                             xml::attribute::kNextVersion,
-                             app.next_version);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    if (!app.ap.IsEmpty()) {
-      hr = AddXMLAttributeNode(element,
-                               kXmlNamespace,
-                               xml::attribute::kAdditionalParameters,
-                               app.ap);
-      if (FAILED(hr)) {
-        return hr;
-      }
-    }
-
-    hr = AddXMLAttributeNode(element,
-                             kXmlNamespace,
-                             xml::attribute::kLang,
-                             app.lang);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = AddXMLAttributeNode(element,
-                             kXmlNamespace,
-                             xml::attribute::kBrandCode,
-                             app.brand_code);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = AddXMLAttributeNode(element,
-                             kXmlNamespace,
-                             xml::attribute::kClientId,
-                             app.client_id);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    // TODO(omaha3): Determine whether or not the server is able to accept an
-    // empty string here.  If so, remove this IsEmpty() check, and always emit.
-    if (!app.experiments.IsEmpty()) {
-      hr = AddXMLAttributeNode(element,
-                               kXmlNamespace,
-                               xml::attribute::kExperiments,
-                               app.experiments);
-      if (FAILED(hr)) {
-        return hr;
-      }
-    }
-
-    // 0 seconds indicates unknown install time. A new install uses -1 days.
-    if (app.install_time_diff_sec) {
-      const int installed_full_days =
-          static_cast<int>(app.install_time_diff_sec) / kSecondsPerDay;
-      ASSERT1(installed_full_days >= 0 || installed_full_days == -1);
-      hr = AddXMLAttributeNode(element,
-                               kXmlNamespace,
-                               xml::attribute::kInstalledAgeDays,
-                               itostr(installed_full_days));
-      if (FAILED(hr)) {
-        return hr;
-      }
-    }
-
-    if (!app.iid.IsEmpty() && app.iid != GuidToString(GUID_NULL)) {
-      hr = AddXMLAttributeNode(element,
-                               kXmlNamespace,
-                               xml::attribute::kInstallationId,
-                               app.iid);
-      if (FAILED(hr)) {
-        return hr;
-      }
-    }
-
-    hr = BuildUpdateCheckElement(app, element);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = BuildPingRequestElement(app, element);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = BuildDataElement(app, element);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = BuildDidRunElement(app, element);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = parent_node->appendChild(element, NULL);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  return S_OK;
-}
-
-HRESULT XmlParser::BuildUpdateCheckElement(const request::App& app,
-                                           IXMLDOMNode* parent_node) {
-  CORE_LOG(L3, (_T("[XmlParser::BuildUpdateCheckElement]")));
-  ASSERT1(parent_node);
-
-  // Create a DOM element only if the update check member is valid.
-  if (!app.update_check.is_valid) {
-    return S_OK;
-  }
-
-  CComPtr<IXMLDOMNode> element;
-  HRESULT hr = CreateElementNode(xml::element::kUpdateCheck, _T(""), &element);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (app.update_check.is_update_disabled) {
-    hr = AddXMLAttributeNode(element,
-                             kXmlNamespace,
-                             xml::attribute::kUpdateDisabled,
-                             xml::value::kTrue);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  if (!app.update_check.tt_token.IsEmpty()) {
-    hr = AddXMLAttributeNode(element,
-                             kXmlNamespace,
-                             xml::attribute::kTTToken,
-                             app.update_check.tt_token);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  hr = parent_node->appendChild(element, NULL);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// Ping elements are called "event" elements for legacy reasons.
-HRESULT XmlParser::BuildPingRequestElement(const request::App& app,
-                                           IXMLDOMNode* parent_node) {
-  CORE_LOG(L3, (_T("[XmlParser::BuildPingRequestElement]")));
-  ASSERT1(parent_node);
-
-  // Create a DOM element only if there is are ping_events.
-  if (app.ping_events.empty()) {
-    return S_OK;
-  }
-
-  PingEventVector::const_iterator it;
-  for (it = app.ping_events.begin(); it != app.ping_events.end(); ++it) {
-    const PingEventPtr ping_event = *it;
-    CComPtr<IXMLDOMNode> element;
-    HRESULT hr = CreateElementNode(xml::element::kEvent, _T(""), &element);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = ping_event->ToXml(element);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = parent_node->appendChild(element, NULL);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  return S_OK;
-}
-
-HRESULT XmlParser::BuildDataElement(const request::App& app,
-                                    IXMLDOMNode* parent_node) {
-  CORE_LOG(L3, (_T("[XmlParser::BuildDataElement]")));
-  ASSERT1(parent_node);
-
-  // Create a DOM element only if there is a data object.
-  if (app.data.install_data_index.IsEmpty()) {
-    return S_OK;
-  }
-
-  ASSERT1(app.update_check.is_valid);
-
-  CComPtr<IXMLDOMNode> element;
-  HRESULT hr = CreateElementNode(xml::element::kData, _T(""), &element);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = AddXMLAttributeNode(element,
-                           kXmlNamespace,
-                           xml::attribute::kName,
-                           xml::value::kInstallData);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = AddXMLAttributeNode(element,
-                           kXmlNamespace,
-                           xml::attribute::kIndex,
-                           app.data.install_data_index);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = parent_node->appendChild(element, NULL);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT XmlParser::BuildDidRunElement(const request::App& app,
-                                      IXMLDOMNode* parent_node) {
-  CORE_LOG(L3, (_T("[XmlParser::BuildDidRunElement]")));
-  ASSERT1(parent_node);
-
-  bool was_active = app.ping.active == ACTIVE_RUN;
-  bool need_active = app.ping.active != ACTIVE_UNKNOWN;
-  bool has_sent_a_today = app.ping.days_since_last_active_ping == 0;
-  bool need_a = was_active && !has_sent_a_today;
-  bool need_r = app.ping.days_since_last_roll_call != 0;
-
-  // Create a DOM element only if the didrun object has actual state.
-  if (!need_active && !need_a && !need_r) {
-    return S_OK;
-  }
-
-  ASSERT1(app.update_check.is_valid);
-
-  CComPtr<IXMLDOMNode> element;
-  HRESULT hr = CreateElementNode(xml::element::kPing, _T(""), &element);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // TODO(omaha): Remove "active" attribute after transition.
-  if (need_active) {
-    const TCHAR* active_str(was_active ? _T("1") : _T("0"));
-    hr = AddXMLAttributeNode(element,
-                             kXmlNamespace,
-                             xml::attribute::kActive,
-                             active_str);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  if (need_a) {
-    hr = AddXMLAttributeNode(element,
-                             kXmlNamespace,
-                             xml::attribute::kDaysSinceLastActivePing,
-                             itostr(app.ping.days_since_last_active_ping));
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  if (need_r) {
-    hr = AddXMLAttributeNode(element,
-                             kXmlNamespace,
-                             xml::attribute::kDaysSinceLastRollCall,
-                             itostr(app.ping.days_since_last_roll_call));
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  hr = parent_node->appendChild(element, NULL);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT XmlParser::CreateElementNode(const TCHAR* name,
-                                     const TCHAR* value,
-                                     IXMLDOMNode** element) {
-  ASSERT1(name);
-  ASSERT1(value);
-  ASSERT1(element);
-
-  // When there is a namespace, the element names get o: prepended to avoid a
-  // size explosion where the namespace uri gets automatically added to every
-  // element by msxml.
-  CString namespace_qualified_name;
-  namespace_qualified_name.Format(kXmlNamespace ? _T("o:%s") : _T("%s"),
-                                  name);
-  ASSERT1(document_);
-  HRESULT hr = CreateXMLNode(document_,
-                             NODE_ELEMENT,
-                             namespace_qualified_name,
-                             kXmlNamespace,
-                             value,
-                             element);
-  return hr;
-}
-
-
-HRESULT XmlParser::DeserializeResponse(const std::vector<uint8>& buffer,
-                                       UpdateResponse* update_response) {
-  ASSERT1(update_response);
-
-  XmlParser xml_parser;
-  HRESULT hr = LoadXMLFromRawData(buffer, false, &xml_parser.document_);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  xml_parser.response_ = &update_response->response_;
-
-  hr = xml_parser.Parse();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT XmlParser::Parse() {
-  CORE_LOG(L3, (_T("[XmlParser::Parse]")));
-  ASSERT1(response_);
-
-  CComPtr<IXMLDOMElement> root_node;
-  HRESULT hr = document_->get_documentElement(&root_node);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  if (!root_node) {
-    return GOOPDATEXML_E_PARSE_ERROR;
-  }
-
-  CComBSTR root_name;
-  hr = root_node->get_baseName(&root_name);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (root_name == xml::element::kResponse) {
-    InitializeElementHandlers();
-    return TraverseDOM(root_node);
-  }
-
-  if (root_name == v2::element::kGUpdate) {
-    InitializeLegacyElementHandlers();
-    return TraverseDOM(root_node);
-  }
-
-  return GOOPDATEXML_E_RESPONSENODE;
-}
-
-HRESULT XmlParser::TraverseDOM(IXMLDOMNode* node) {
-  CORE_LOG(L5, (_T("[XmlParser::TraverseDOM]")));
-  ASSERT1(node);
-
-  HRESULT hr = VisitElement(node);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CComPtr<IXMLDOMNodeList> children_list;
-  hr = node->get_childNodes(&children_list);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  long num_children = 0;   // NOLINT
-  hr = children_list->get_length(&num_children);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  for (int i = 0; i < num_children; ++i) {
-    CComPtr<IXMLDOMNode> child_node;
-    hr = children_list->get_item(i, &child_node);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    DOMNodeType type = NODE_INVALID;
-    hr = child_node->get_nodeType(&type);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    ASSERT1(type == NODE_TEXT || type == NODE_ELEMENT || type == NODE_COMMENT);
-
-    if (type == NODE_ELEMENT) {
-      hr = TraverseDOM(child_node);
-      if (FAILED(hr)) {
-        return hr;
-      }
-    }
-  }
-
-  return S_OK;
-}
-
-HRESULT XmlParser::VisitElement(IXMLDOMNode* node) {
-  XMLFQName node_name;
-  HRESULT hr = GetXMLFQName(node, &node_name);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[GetXMLFQName failed][0x%x]"), hr));
-    return hr;
-  }
-
-  CORE_LOG(L4, (_T("[element name][%s:%s]"), node_name.uri, node_name.base));
-
-  // Ignore elements not understood.
-  ElementHandler* element_handler =
-      element_handler_factory_.CreateObject(node_name.base);
-  if (element_handler) {
-    return element_handler->Handle(node, response_);
-  } else {
-    CORE_LOG(LW, (_T("[VisitElement: don't know how to handle %s:%s]"),
-                  node_name.uri, node_name.base));
-  }
-  return S_OK;
-}
-
-}  // namespace xml
-
-}  // namespace omaha
-
diff --git a/common/xml_parser.h b/common/xml_parser.h
deleted file mode 100644
index 551b6cb..0000000
--- a/common/xml_parser.h
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Defines the Goopdate XML parser. The clients of this class are
-// UpdateRequest and UpdateResponse.
-
-#ifndef OMAHA_COMMON_XML_PARSER_H_
-#define OMAHA_COMMON_XML_PARSER_H_
-
-#include <windows.h>
-#include <objbase.h>
-#include <msxml2.h>
-#include <atlbase.h>
-#include <atlstr.h>
-#include <map>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/object_factory.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/update_request.h"
-#include "omaha/common/update_response.h"
-
-namespace omaha {
-
-namespace xml {
-
-class ElementHandler;
-
-CString ConvertProcessorArchitectureToString(DWORD processor_architecture);
-
-// Public static methods instantiate a temporary instance of this class, which
-// then parses the specified document. This avoids reusing instances of the
-// parser and dealing with stale and dirty data.
-class XmlParser {
- public:
-  // Parses the update response buffer and fills in the UpdateResponse. In case
-  // of errors, the UpdateResponse object may contain partial information up
-  // to the point of the parsing error.
-  // TODO(omaha): since the xml docs are strings we could use a CString as
-  // an input parameter, no reason why this should be a buffer.
-  static HRESULT DeserializeResponse(const std::vector<uint8>& buffer,
-                                     UpdateResponse* update_response);
-
-  // Generates the update request from the request node.
-  static HRESULT SerializeRequest(const UpdateRequest& update_request,
-                                  CString* buffer);
-
- private:
-  typedef Factory<ElementHandler, CString> ElementHandlerFactory;
-
-  XmlParser();
-  void InitializeElementHandlers();
-  void InitializeLegacyElementHandlers();
-
-  // Builds an XML object model corresponding to an xml request.
-  HRESULT BuildDom(const request::Request& request);
-
-  // Builds the 'request' element.
-  HRESULT BuildRequestElement();
-
-  // Creates the 'os' element.
-  HRESULT BuildOsElement(IXMLDOMNode* parent_node);
-
-  // Creates the 'app' element. This is usually a sequence of elements.
-  HRESULT BuildAppElement(IXMLDOMNode* parent_node);
-
-  // Creates the 'updatecheck' element for an application.
-  HRESULT BuildUpdateCheckElement(const request::App& app,
-                                  IXMLDOMNode* parent_node);
-
-  // Creates Ping aka 'event' elements for an application.
-  HRESULT BuildPingRequestElement(const request::App& app,
-                                  IXMLDOMNode* parent_node);
-
-  // Creates the 'data' element for an application.
-  HRESULT BuildDataElement(const request::App& app,
-                           IXMLDOMNode* parent_node);
-
-  // Creates the 'didrun' aka 'active' aka 'ping' element for an application.
-  HRESULT BuildDidRunElement(const request::App& app,
-                             IXMLDOMNode* parent_node);
-
-  // Serializes the DOM into a string.
-  HRESULT GetXml(CString* buffer);
-
-  // Creates an element in the Update2 xml namespace.
-  HRESULT CreateElementNode(const TCHAR* name,
-                            const TCHAR* value,
-                            IXMLDOMNode** element);
-
-  // Starts parsing of the xml document.
-  HRESULT Parse();
-
-  // Does a DFS traversal of the dom.
-  HRESULT TraverseDOM(IXMLDOMNode* node);
-
-  // Handles a single node during traversal.
-  HRESULT VisitElement(IXMLDOMNode* node);
-
-  // The current xml document.
-  CComPtr<IXMLDOMDocument> document_;
-
-  // The xml request being serialized. Not owned by this class.
-  const request::Request* request_;
-
-  // The xml response being deserialized. Not owned by this class.
-  response::Response* response_;
-
-  ElementHandlerFactory element_handler_factory_;
-
-  DISALLOW_COPY_AND_ASSIGN(XmlParser);
-};
-
-}  // namespace xml
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_XML_PARSER_H_
diff --git a/common/xml_parser_unittest.cc b/common/xml_parser_unittest.cc
deleted file mode 100644
index 908cae8..0000000
--- a/common/xml_parser_unittest.cc
+++ /dev/null
@@ -1,306 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-#include "base/utils.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/error.h"
-#include "omaha/common/xml_parser.h"
-#include "omaha/goopdate/update_response_utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace {
-
-const int kSeedManifestFileCount = 1;
-const int kSeedManifestResponseCount = 7;
-
-const int kExpectedRequestLength = 2048;
-
-}  // namespace
-
-namespace omaha {
-
-namespace xml {
-
-// TODO(omaha): there were many tests related to
-// updatedev_check_period_override and policy_check_period_override, which
-// the current parser is unaware of. These parameters must be handled outside
-// the parser itself. Not sure how we are handling them now.
-class XmlParserTest : public testing::Test {
- protected:
-  XmlParserTest() {
-  }
-
-  ~XmlParserTest() {
-  }
-
-  virtual void SetUp() {
-  }
-
-  virtual void TearDown() {
-  }
-
-  // Allows test fixtures access to implementation details of UpdateRequest.
-  request::Request& get_xml_request(UpdateRequest* update_request) {
-    return update_request->request_;
-  }
-};
-
-// Creates a machine update request and serializes it.
-TEST_F(XmlParserTest, GenerateRequestWithoutUserId_MachineUpdateRequest) {
-  // The origin URL contains an invalid XML character, the double-quote. The
-  // expectation is that this character should be escaped to "&quot;".
-  scoped_ptr<UpdateRequest> update_request(
-      UpdateRequest::Create(true,
-                            _T("unittest_session"),
-                            _T("unittest_install"),
-                            _T("http://go/foo/\"")));
-
-  request::Request& xml_request = get_xml_request(update_request.get());
-
-  xml_request.omaha_version = _T("1.2.3.4");
-  xml_request.test_source = _T("dev");
-  xml_request.request_id = _T("{387E2718-B39C-4458-98CC-24B5293C8383}");
-  xml_request.os.platform = _T("win");
-  xml_request.os.version = _T("6.0");
-  xml_request.os.service_pack = _T("Service Pack 1");
-  xml_request.os.arch = _T("x86");
-  xml_request.check_period_sec = 100000;
-  xml_request.uid.Empty();
-
-  request::App app1;
-  app1.app_id = _T("{8A69D345-D564-463C-AFF1-A69D9E530F96}");
-  app1.lang = _T("en");
-  app1.iid = GuidToString(GUID_NULL);  // Prevents assert.
-  app1.ap = _T("ap_with_update_check");
-  app1.update_check.is_valid = true;
-  app1.data.install_data_index = _T("verboselogging");
-  app1.ping.active = ACTIVE_NOTRUN;
-  app1.ping.days_since_last_active_ping = -1;
-  app1.ping.days_since_last_roll_call = 5;
-  xml_request.apps.push_back(app1);
-
-  request::App app2;
-  app2.app_id = _T("{AD3D0CC0-AD1E-4b1f-B98E-BAA41DCE396C}");
-  app2.lang = _T("en");
-  app2.iid = GuidToString(GUID_NULL);  // Prevents assert.
-  app2.version = _T("1.0");
-  app2.next_version = _T("2.0");
-  app2.ap = _T("ap_with_no_update_check");
-  app2.experiments = _T("url_exp_2=a|Fri, 14 Aug 2015 16:13:03 GMT");
-  xml_request.apps.push_back(app2);
-
-  CString expected_buffer = _T("<?xml version=\"1.0\" encoding=\"UTF-8\"?><request protocol=\"3.0\" version=\"1.2.3.4\" ismachine=\"1\" sessionid=\"unittest_session\" installsource=\"unittest_install\" originurl=\"http://go/foo/&quot;\" testsource=\"dev\" requestid=\"{387E2718-B39C-4458-98CC-24B5293C8383}\" periodoverridesec=\"100000\"><os platform=\"win\" version=\"6.0\" sp=\"Service Pack 1\" arch=\"x86\"/><app appid=\"{8A69D345-D564-463C-AFF1-A69D9E530F96}\" version=\"\" nextversion=\"\" ap=\"ap_with_update_check\" lang=\"en\" brand=\"\" client=\"\"><updatecheck/><data name=\"install\" index=\"verboselogging\"/><ping active=\"0\" r=\"5\"/></app><app appid=\"{AD3D0CC0-AD1E-4b1f-B98E-BAA41DCE396C}\" version=\"1.0\" nextversion=\"2.0\" ap=\"ap_with_no_update_check\" lang=\"en\" brand=\"\" client=\"\" experiments=\"url_exp_2=a|Fri, 14 Aug 2015 16:13:03 GMT\"/></request>");  // NOLINT
-
-  CString actual_buffer;
-  EXPECT_HRESULT_SUCCEEDED(XmlParser::SerializeRequest(*update_request,
-                                                       &actual_buffer));
-  EXPECT_STREQ(expected_buffer, actual_buffer);
-}
-
-// Creates a machine update request and serializes it.
-TEST_F(XmlParserTest, GenerateRequestWithUserId_MachineUpdateRequest) {
-  // The origin URL contains an invalid XML character, the double-quote. The
-  // expectation is that this character should be escaped to "&quot;".
-  scoped_ptr<UpdateRequest> update_request(
-      UpdateRequest::Create(true,
-                            _T("unittest_session"),
-                            _T("unittest_install"),
-                            _T("http://go/bar/\"")));
-
-  request::Request& xml_request = get_xml_request(update_request.get());
-
-  xml_request.uid = _T("{c5bcb37e-47eb-4331-a544-2f31101951ab}");
-
-  xml_request.omaha_version = _T("4.3.2.1");
-  xml_request.test_source = _T("dev");
-  xml_request.request_id = _T("{387E2718-B39C-4458-98CC-24B5293C8384}");
-  xml_request.os.platform = _T("win");
-  xml_request.os.version = _T("7.0");
-  xml_request.os.service_pack = _T("Service Pack 2");
-  xml_request.os.arch = _T("x64");
-  xml_request.check_period_sec = 200000;
-
-  request::App app1;
-  app1.app_id = _T("{8A69D345-D564-463C-AFF1-A69D9E530F97}");
-  app1.lang = _T("en");
-  app1.iid = GuidToString(GUID_NULL);  // Prevents assert.
-  app1.ap = _T("ap_with_update_check");
-  app1.update_check.is_valid = true;
-  app1.data.install_data_index = _T("verboselogging");
-  app1.ping.active = ACTIVE_NOTRUN;
-  app1.ping.days_since_last_active_ping = -1;
-  app1.ping.days_since_last_roll_call = 5;
-  xml_request.apps.push_back(app1);
-
-  request::App app2;
-  app2.app_id = _T("{AD3D0CC0-AD1E-4b1f-B98E-BAA41DCE396D}");
-  app2.lang = _T("en");
-  app2.iid = GuidToString(GUID_NULL);  // Prevents assert.
-  app2.version = _T("1.0");
-  app2.next_version = _T("2.0");
-  app2.ap = _T("ap_with_no_update_check");
-  app2.experiments = _T("url_exp_2=a|Fri, 14 Aug 2015 16:13:03 GMT");
-  xml_request.apps.push_back(app2);
-
-  CString expected_buffer = _T("<?xml version=\"1.0\" encoding=\"UTF-8\"?><request protocol=\"3.0\" version=\"4.3.2.1\" ismachine=\"1\" sessionid=\"unittest_session\" userid=\"{c5bcb37e-47eb-4331-a544-2f31101951ab}\" installsource=\"unittest_install\" originurl=\"http://go/bar/&quot;\" testsource=\"dev\" requestid=\"{387E2718-B39C-4458-98CC-24B5293C8384}\" periodoverridesec=\"200000\"><os platform=\"win\" version=\"7.0\" sp=\"Service Pack 2\" arch=\"x64\"/><app appid=\"{8A69D345-D564-463C-AFF1-A69D9E530F97}\" version=\"\" nextversion=\"\" ap=\"ap_with_update_check\" lang=\"en\" brand=\"\" client=\"\"><updatecheck/><data name=\"install\" index=\"verboselogging\"/><ping active=\"0\" r=\"5\"/></app><app appid=\"{AD3D0CC0-AD1E-4b1f-B98E-BAA41DCE396D}\" version=\"1.0\" nextversion=\"2.0\" ap=\"ap_with_no_update_check\" lang=\"en\" brand=\"\" client=\"\" experiments=\"url_exp_2=a|Fri, 14 Aug 2015 16:13:03 GMT\"/></request>");  // NOLINT
-
-  CString actual_buffer;
-  EXPECT_HRESULT_SUCCEEDED(XmlParser::SerializeRequest(*update_request,
-                                                       &actual_buffer));
-  EXPECT_STREQ(expected_buffer, actual_buffer);
-}
-
-// TODO(omaha3): Add a UserUpdateRequest test with more values (brand, etc.).
-
-// Parses a response for one application.
-TEST_F(XmlParserTest, Parse) {
-  // Array of two request strings that are almost same except the second one
-  // contains some unsupported elements that we expect to be ignored.
-  CStringA buffer_strings[] = {
-            "<?xml version=\"1.0\" encoding=\"UTF-8\"?><response protocol=\"3.0\"><daystart elapsed_seconds=\"8400\" /><app appid=\"{8A69D345-D564-463C-AFF1-A69D9E530F96}\" status=\"ok\" experiments=\"url_exp_2=a|Fri, 14 Aug 2015 16:13:03 GMT\"><updatecheck status=\"ok\"><urls><url codebase=\"http://cache.pack.google.com/edgedl/chrome/install/172.37/\"/></urls><manifest version=\"2.0.172.37\"><packages><package hash=\"NT/6ilbSjWgbVqHZ0rT1vTg1coE=\" name=\"chrome_installer.exe\" required=\"true\" size=\"9614320\"/></packages><actions><action arguments=\"--do-not-launch-chrome\" event=\"install\" needsadmin=\"false\" run=\"chrome_installer.exe\"/><action event=\"postinstall\" onsuccess=\"exitsilentlyonlaunchcmd\"/></actions></manifest></updatecheck><data index=\"verboselogging\" name=\"install\" status=\"ok\">{\n \"distribution\": {\n   \"verbose_logging\": true\n }\n}\n</data><ping status=\"ok\"/></app></response>",  // NOLINT
-            "<?xml version=\"1.0\" encoding=\"UTF-8\"?><response protocol=\"3.0\" ExtraUnsupportedAttribute=\"123\"><daystart elapsed_seconds=\"8400\" /><UnsupportedElement1 UnsupportedAttribute1=\"some value\" /><app appid=\"{8A69D345-D564-463C-AFF1-A69D9E530F96}\" status=\"ok\" experiments=\"url_exp_2=a|Fri, 14 Aug 2015 16:13:03 GMT\"><updatecheck status=\"ok\"><urls><url codebase=\"http://cache.pack.google.com/edgedl/chrome/install/172.37/\"/></urls><manifest version=\"2.0.172.37\"><packages><package hash=\"NT/6ilbSjWgbVqHZ0rT1vTg1coE=\" name=\"chrome_installer.exe\" required=\"true\" size=\"9614320\"/></packages><actions><action arguments=\"--do-not-launch-chrome\" event=\"install\" needsadmin=\"false\" run=\"chrome_installer.exe\"/><action event=\"postinstall\" onsuccess=\"exitsilentlyonlaunchcmd\"/></actions></manifest></updatecheck><data index=\"verboselogging\" name=\"install\" status=\"ok\">{\n \"distribution\": {\n   \"verbose_logging\": true\n }\n}\n</data><ping status=\"ok\"/></app><UnsupportedElement2 UnsupportedAttribute2=\"Unsupported value\" >Some strings inside an unsupported element, should be ignored.<ping status=\"ok\"/></UnsupportedElement2></response>",  // NOLINT
-  };
-
-  for (int i = 0; i < arraysize(buffer_strings); i++) {
-    std::vector<uint8> buffer(buffer_strings[i].GetLength());
-    memcpy(&buffer.front(), buffer_strings[i], buffer.size());
-
-    scoped_ptr<UpdateResponse> update_response(UpdateResponse::Create());
-    EXPECT_HRESULT_SUCCEEDED(XmlParser::DeserializeResponse(
-        buffer,
-        update_response.get()));
-
-    const response::Response& xml_response(update_response->response());
-
-    EXPECT_STREQ(_T("3.0"), xml_response.protocol);
-    EXPECT_EQ(1, xml_response.apps.size());
-
-    const response::App& app(xml_response.apps[0]);
-    EXPECT_STREQ(_T("{8A69D345-D564-463C-AFF1-A69D9E530F96}"), app.appid);
-    EXPECT_STREQ(_T("ok"), app.status);
-    EXPECT_STREQ(_T("url_exp_2=a|Fri, 14 Aug 2015 16:13:03 GMT"),
-        app.experiments);
-
-    const response::UpdateCheck& update_check(app.update_check);
-    EXPECT_STREQ(_T("ok"), update_check.status);
-    EXPECT_EQ(1, update_check.urls.size());
-    EXPECT_STREQ(
-        _T("http://cache.pack.google.com/edgedl/chrome/install/172.37/"),
-        update_check.urls[0]);
-
-    const InstallManifest& install_manifest(update_check.install_manifest);
-    EXPECT_STREQ(_T("2.0.172.37"), install_manifest.version);
-    EXPECT_EQ(1, install_manifest.packages.size());
-
-    const InstallPackage& install_package(install_manifest.packages[0]);
-    EXPECT_STREQ(_T("chrome_installer.exe"), install_package.name);
-    EXPECT_TRUE(install_package.is_required);
-    EXPECT_EQ(9614320, install_package.size);
-    EXPECT_STREQ(_T("NT/6ilbSjWgbVqHZ0rT1vTg1coE="), install_package.hash);
-
-    EXPECT_EQ(2, install_manifest.install_actions.size());
-
-    const InstallAction* install_action(&install_manifest.install_actions[0]);
-    EXPECT_EQ(InstallAction::kInstall, install_action->install_event);
-    EXPECT_EQ(NEEDS_ADMIN_NO, install_action->needs_admin);
-    EXPECT_STREQ(_T("chrome_installer.exe"), install_action->program_to_run);
-    EXPECT_STREQ(_T("--do-not-launch-chrome"),
-                 install_action->program_arguments);
-    EXPECT_FALSE(install_action->terminate_all_browsers);
-    EXPECT_EQ(SUCCESS_ACTION_DEFAULT, install_action->success_action);
-
-    install_action = &install_manifest.install_actions[1];
-    EXPECT_EQ(InstallAction::kPostInstall, install_action->install_event);
-    EXPECT_EQ(NEEDS_ADMIN_NO, install_action->needs_admin);
-    EXPECT_FALSE(install_action->terminate_all_browsers);
-    EXPECT_EQ(SUCCESS_ACTION_EXIT_SILENTLY_ON_LAUNCH_CMD,
-              install_action->success_action);
-
-    EXPECT_EQ(0, app.events.size());
-
-    CString value;
-    EXPECT_SUCCEEDED(update_response_utils::GetInstallData(app.data,
-                                                           _T("verboselogging"),
-                                                           &value));
-    EXPECT_STREQ(
-        _T("{\n \"distribution\": {\n   \"verbose_logging\": true\n }\n}\n"),
-        value);
-  }
-}
-
-// Parses a response for one application.
-TEST_F(XmlParserTest, Parse_InvalidDataStatusError) {
-  CStringA buffer_string = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><response protocol=\"3.0\"><app appid=\"{8A69D345-D564-463C-AFF1-A69D9E530F96}\" status=\"ok\"><updatecheck status=\"ok\"><urls><url codebase=\"http://cache.pack.google.com/edgedl/chrome/install/172.37/\"/></urls><manifest version=\"2.0.172.37\"><packages><package hash=\"NT/6ilbSjWgbVqHZ0rT1vTg1coE=\" name=\"chrome_installer.exe\" required=\"false\" size=\"9614320\"/></packages><actions><action arguments=\"--do-not-launch-chrome\" event=\"install\" needsadmin=\"false\" run=\"chrome_installer.exe\"/><action event=\"postinstall\" onsuccess=\"exitsilentlyonlaunchcmd\"/></actions></manifest></updatecheck><data index=\"verboselog\" name=\"install\" status=\"error-nodata\"/><ping status=\"ok\"/></app></response>";  // NOLINT
-  std::vector<uint8> buffer(buffer_string.GetLength());
-  memcpy(&buffer.front(), buffer_string, buffer.size());
-
-  scoped_ptr<UpdateResponse> update_response(UpdateResponse::Create());
-  EXPECT_HRESULT_SUCCEEDED(XmlParser::DeserializeResponse(
-      buffer,
-      update_response.get()));
-  const response::Response& xml_response(update_response->response());
-
-  EXPECT_STREQ(_T("3.0"), xml_response.protocol);
-  EXPECT_EQ(1, xml_response.apps.size());
-
-  const response::App& app(xml_response.apps[0]);
-  EXPECT_STREQ(_T("{8A69D345-D564-463C-AFF1-A69D9E530F96}"), app.appid);
-  EXPECT_STREQ(_T("ok"), app.status);
-
-  const response::UpdateCheck& update_check(app.update_check);
-  EXPECT_STREQ(_T("ok"), update_check.status);
-  EXPECT_EQ(1, update_check.urls.size());
-  EXPECT_STREQ(_T("http://cache.pack.google.com/edgedl/chrome/install/172.37/"),
-               update_check.urls[0]);
-
-  const InstallManifest& install_manifest(update_check.install_manifest);
-  EXPECT_STREQ(_T("2.0.172.37"), install_manifest.version);
-  EXPECT_EQ(1, install_manifest.packages.size());
-
-  const InstallPackage& install_package(install_manifest.packages[0]);
-  EXPECT_STREQ(_T("chrome_installer.exe"), install_package.name);
-  EXPECT_FALSE(install_package.is_required);
-  EXPECT_EQ(9614320, install_package.size);
-  EXPECT_STREQ(_T("NT/6ilbSjWgbVqHZ0rT1vTg1coE="), install_package.hash);
-
-  EXPECT_EQ(2, install_manifest.install_actions.size());
-
-  const InstallAction* install_action(&install_manifest.install_actions[0]);
-  EXPECT_EQ(InstallAction::kInstall, install_action->install_event);
-  EXPECT_EQ(NEEDS_ADMIN_NO, install_action->needs_admin);
-  EXPECT_STREQ(_T("chrome_installer.exe"), install_action->program_to_run);
-  EXPECT_STREQ(_T("--do-not-launch-chrome"), install_action->program_arguments);
-  EXPECT_FALSE(install_action->terminate_all_browsers);
-  EXPECT_EQ(SUCCESS_ACTION_DEFAULT, install_action->success_action);
-
-  install_action = &install_manifest.install_actions[1];
-  EXPECT_EQ(InstallAction::kPostInstall, install_action->install_event);
-  EXPECT_EQ(NEEDS_ADMIN_NO, install_action->needs_admin);
-  EXPECT_FALSE(install_action->terminate_all_browsers);
-  EXPECT_EQ(SUCCESS_ACTION_EXIT_SILENTLY_ON_LAUNCH_CMD,
-            install_action->success_action);
-
-  EXPECT_EQ(0, app.events.size());
-
-  CString value;
-  EXPECT_EQ(GOOPDATE_E_INVALID_INSTALL_DATA_INDEX,
-            update_response_utils::GetInstallData(app.data, _T("verboselog"),
-                                                  &value));
-}
-
-}  // namespace xml
-
-}  // namespace omaha
diff --git a/core/build.scons b/core/build.scons
deleted file mode 100644
index 406d0f2..0000000
--- a/core/build.scons
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-local_env = env.Clone()
-
-inputs = [
-    'core.cc',
-    'core_metrics.cc',
-    'crash_handler.cc',
-    'google_update_core.cc',
-    'scheduler.cc',
-    'system_monitor.cc',
-    ]
-
-local_env['CPPPATH'] += [
-    '$MAIN_DIR/third_party/breakpad/src/',
-
-    # Need to look in output dir to find .h files generated by midl compiler.
-    # This also allows Hammer to understand dependencies between this subdir
-    # and the .idl files in the goopdate folder.
-    '$OBJ_ROOT',
-    ]
-
-local_env.ComponentStaticLibrary('core', inputs)
diff --git a/core/core.cc b/core/core.cc
deleted file mode 100644
index d65dc64..0000000
--- a/core/core.cc
+++ /dev/null
@@ -1,424 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Core is the long-lived Omaha process. It runs one instance for the
-// machine and one instance for each user session, including console and TS
-// sessions.
-// If the same user is logged in multiple times, only one core process will
-// be running.
-
-#include "omaha/core/core.h"
-#include <lmsname.h>
-#include <atlsecurity.h>
-#include <algorithm>
-#include <map>
-#include <string>
-#include <vector>
-#include "omaha/base/app_util.h"
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/module_utils.h"
-#include "omaha/base/path.h"
-#include "omaha/base/program_instance.h"
-#include "omaha/base/reactor.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/service_utils.h"
-#include "omaha/base/shutdown_handler.h"
-#include "omaha/base/system.h"
-#include "omaha/base/time.h"
-#include "omaha/base/user_info.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/app_registry_utils.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/command_line_builder.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/oem_install_utils.h"
-#include "omaha/common/scheduled_task_utils.h"
-#include "omaha/common/stats_uploader.h"
-#include "omaha/core/core_metrics.h"
-#include "omaha/core/scheduler.h"
-#include "omaha/core/system_monitor.h"
-#include "omaha/goopdate/resource_manager.h"
-#include "omaha/goopdate/worker.h"
-#include "omaha/net/network_config.h"
-#include "omaha/setup/setup_service.h"
-
-namespace omaha {
-
-Core::Core()
-    : is_system_(false),
-      is_crash_handler_enabled_(false),
-      main_thread_id_(0) {
-  CORE_LOG(L1, (_T("[Core::Core]")));
-}
-
-Core::~Core() {
-  CORE_LOG(L1, (_T("[Core::~Core]")));
-  scheduler_.reset(NULL);
-  system_monitor_.reset(NULL);
-}
-
-// We always return S_OK, because the core can be invoked from the system
-// scheduler, and the scheduler does not work well if the process returns
-// an error. We do not depend on the return values from the Core elsewhere.
-HRESULT Core::Main(bool is_system, bool is_crash_handler_enabled) {
-  HRESULT hr = DoMain(is_system, is_crash_handler_enabled);
-  if (FAILED(hr)) {
-    OPT_LOG(LW, (_T("[Core::DoMain failed][0x%x]"), hr));
-  }
-
-  return S_OK;
-}
-
-bool Core::AreScheduledTasksHealthy() const {
-  if (!ServiceUtils::IsServiceRunning(SERVICE_SCHEDULE)) {
-    ++metric_core_run_task_scheduler_not_running;
-    CORE_LOG(LE, (_T("[Task Scheduler Service is not running]")));
-    return false;
-  }
-
-  if (!scheduled_task_utils::IsInstalledGoopdateTaskUA(is_system_)) {
-    ++metric_core_run_scheduled_task_missing;
-    CORE_LOG(LE, (_T("[UA Task not installed]")));
-    return false;
-  }
-
-  if (scheduled_task_utils::IsDisabledGoopdateTaskUA(is_system_)) {
-    ++metric_core_run_scheduled_task_disabled;
-    CORE_LOG(LE, (_T("[UA Task disabled]")));
-    return false;
-  }
-
-  HRESULT ua_task_last_exit_code =
-      scheduled_task_utils::GetExitCodeGoopdateTaskUA(is_system_);
-
-  if (ua_task_last_exit_code == SCHED_S_TASK_HAS_NOT_RUN &&
-      !ConfigManager::Is24HoursSinceInstall(is_system_)) {
-    // Not 24 hours yet since install or update. Let us give the UA task the
-    // benefit of the doubt, and assume all is well for right now.
-    CORE_LOG(L3, (_T("[Core::AreScheduledTasksHealthy]")
-                  _T("[Not yet 24 hours since install/update]")));
-    ua_task_last_exit_code = S_OK;
-  }
-
-  metric_core_run_scheduled_task_exit_code = ua_task_last_exit_code;
-
-  if (S_OK != ua_task_last_exit_code) {
-    CORE_LOG(LE, (_T("[UA Task exit code][0x%x]"), ua_task_last_exit_code));
-    return false;
-  }
-
-  return true;
-}
-
-bool Core::IsCheckingForUpdates() const {
-  if (!ConfigManager::Is24HoursSinceInstall(is_system_)) {
-    CORE_LOG(L3, (_T("[Core::IsCheckingForUpdates]")
-                  _T("[Not yet 24 hours since install/update]")));
-    return true;
-  }
-
-  const ConfigManager& cm = *ConfigManager::Instance();
-  const int k14DaysSec = 14 * 24 * 60 * 60;
-
-  if (cm.GetTimeSinceLastCheckedSec(is_system_) >= k14DaysSec) {
-    ++metric_core_run_not_checking_for_updates;
-    CORE_LOG(LE, (_T("[LastChecked older than 14 days]")));
-    return false;
-  }
-
-  return true;
-}
-
-// The Core will run all the time under the following conditions:
-//
-// * the task scheduler is not running, or
-// * the UA task is not installed, or
-// * the UA task is disabled, or
-// * the last exit code for the UA task is non-zero, or
-// * LastChecked time is older than 14 days.
-//
-// Under these conditions, Omaha uses the built-in scheduler hosted by the core
-// and it keeps the core running.
-bool Core::ShouldRunForever() const {
-  CORE_LOG(L3, (_T("[Core::ShouldRunForever]")));
-
-  // The methods are being called individually to enable metrics capture.
-  bool are_scheduled_tasks_healthy(AreScheduledTasksHealthy());
-  bool is_checking_for_updates(IsCheckingForUpdates());
-
-  bool result = !are_scheduled_tasks_healthy ||
-                !is_checking_for_updates;
-  CORE_LOG(L1, (_T("[Core::ShouldRunForever][%u]"), result));
-  return result;
-}
-
-
-HRESULT Core::DoMain(bool is_system, bool is_crash_handler_enabled) {
-  main_thread_id_ = ::GetCurrentThreadId();
-  is_system_ = is_system;
-  is_crash_handler_enabled_ = is_crash_handler_enabled;
-
-  CORE_LOG(L1, (_T("[is_system_: %d][is_crash_handler_enabled_: %d]"),
-                is_system_, is_crash_handler_enabled_));
-
-  const ConfigManager& cm = *ConfigManager::Instance();
-  if (oem_install_utils::IsOemInstalling(is_system_)) {
-    // Exit immediately while an OEM is installing Windows. This prevents cores
-    // or update workers from being started by the Scheduled Task or other means
-    // before the system is sealed.
-    OPT_LOG(L1, (_T("[Exiting because an OEM is installing Windows]")));
-    ASSERT1(is_system_);
-    return S_OK;
-  }
-
-  // Do a code red check as soon as possible.
-  StartCodeRed();
-
-  CORE_LOG(L2, (_T("[IsInternalUser: %d]"), cm.IsInternalUser()));
-
-  NamedObjectAttributes single_core_attr;
-  GetNamedObjectAttributes(kCoreSingleInstance, is_system_, &single_core_attr);
-  ProgramInstance instance(single_core_attr.name);
-  bool is_already_running = !instance.EnsureSingleInstance();
-  if (is_already_running) {
-    OPT_LOG(L1, (_T("[Another core instance is already running]")));
-    return S_OK;
-  }
-
-  // TODO(omaha): the user Omaha core should run at medium integrity level and
-  // it should deelevate itself if it does not, see bug 1549842.
-
-  // Start the crash handler if necessary.
-  if (is_crash_handler_enabled_) {
-    HRESULT hr = StartCrashHandler();
-    if (FAILED(hr)) {
-      OPT_LOG(LW, (_T("[Failed to start crash handler][0x%08x]"), hr));
-    }
-  }
-
-  if (!ShouldRunForever()) {
-    return S_OK;
-  }
-
-  // TODO(omaha): Delay starting update worker when run at startup.
-  StartUpdateWorkerInternal();
-
-  // Force the main thread to create a message queue so any future WM_QUIT
-  // message posted by the ShutdownHandler will be received. If the main
-  // thread does not have a message queue, the message can be lost.
-  MSG msg = {0};
-  ::PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
-
-  reactor_.reset(new Reactor);
-  shutdown_handler_.reset(new ShutdownHandler);
-  HRESULT hr = shutdown_handler_->Initialize(reactor_.get(), this, is_system_);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  scheduler_.reset(new Scheduler(*this));
-  hr = scheduler_->Initialize();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  system_monitor_.reset(new SystemMonitor(is_system_));
-  VERIFY1(SUCCEEDED(system_monitor_->Initialize(true)));
-  system_monitor_->set_observer(this);
-
-  // Start processing messages and events from the system.
-  return DoRun();
-}
-
-// Signals the core to shutdown. The shutdown method is called by a thread
-// running in the thread pool. It posts a WM_QUIT to the main thread, which
-// causes it to break out of the message loop. If the message can't be posted,
-// it terminates the process unconditionally.
-HRESULT Core::Shutdown() {
-  return ShutdownInternal();
-}
-
-HRESULT Core::ShutdownInternal() const {
-  LONG atl_module_count(const_cast<Core*>(this)->GetLockCount());
-  if (atl_module_count > 0) {
-    CORE_LOG(L1, (_T("[Core COM server in use][%d]"), atl_module_count));
-    return S_OK;
-  }
-
-  OPT_LOG(L1, (_T("[Google Update core is shutting down...]")));
-  ASSERT1(::GetCurrentThreadId() != main_thread_id_);
-  if (::PostThreadMessage(main_thread_id_, WM_QUIT, 0, 0)) {
-    return S_OK;
-  }
-
-  ASSERT(false, (_T("Failed to post WM_QUIT")));
-  uint32 exit_code = static_cast<uint32>(E_ABORT);
-  VERIFY1(::TerminateProcess(::GetCurrentProcess(), exit_code));
-  return S_OK;
-}
-
-void Core::LastCheckedDeleted() {
-  OPT_LOG(L1, (_T("[Core::LastCheckedDeleted]")));
-  VERIFY1(SUCCEEDED(StartUpdateWorker()));
-}
-
-void Core::NoRegisteredClients() {
-  OPT_LOG(L1, (_T("[Core::NoRegisteredClients]")));
-  VERIFY1(SUCCEEDED(StartUpdateWorker()));
-}
-
-HRESULT Core::DoRun() {
-  OPT_LOG(L1, (_T("[Core::DoRun]")));
-
-  // Trim the process working set to minimum. It does not need a more complex
-  // algorithm for now. Likely the working set will increase slightly over time
-  // as the core is handling events.
-  VERIFY1(::SetProcessWorkingSetSize(::GetCurrentProcess(),
-                                     static_cast<uint32>(-1),
-                                     static_cast<uint32>(-1)));
-  return DoHandleEvents();
-}
-
-HRESULT Core::DoHandleEvents() {
-  CORE_LOG(L1, (_T("[Core::DoHandleEvents]")));
-  MSG msg = {0};
-  int result = 0;
-  while ((result = ::GetMessage(&msg, 0, 0, 0)) != 0) {
-    ::DispatchMessage(&msg);
-    if (result == -1) {
-      break;
-    }
-  }
-  CORE_LOG(L3, (_T("[GetMessage returned %d]"), result));
-  return (result != -1) ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT Core::StartUpdateWorker() const {
-  if (!ShouldRunForever()) {
-    return ShutdownInternal();
-  }
-
-  return StartUpdateWorkerInternal();
-}
-
-HRESULT Core::StartUpdateWorkerInternal() const {
-  CORE_LOG(L2, (_T("[Core::StartUpdateWorkerInternal]")));
-
-  CString exe_path = goopdate_utils::BuildGoogleUpdateExePath(is_system_);
-  CommandLineBuilder builder(COMMANDLINE_MODE_UA);
-  builder.set_install_source(kCmdLineInstallSource_Core);
-  CString cmd_line = builder.GetCommandLineArgs();
-  HRESULT hr = System::StartProcessWithArgs(exe_path, cmd_line);
-  if (SUCCEEDED(hr)) {
-    ++metric_core_worker_succeeded;
-  } else {
-    CORE_LOG(LE, (_T("[can't start update worker][0x%08x]"), hr));
-  }
-  ++metric_core_worker_total;
-  return hr;
-}
-
-HRESULT Core::StartCodeRed() const {
-  if (RegKey::HasValue(MACHINE_REG_UPDATE_DEV, kRegValueNoCodeRedCheck)) {
-    CORE_LOG(LW, (_T("[Code Red is disabled for this system]")));
-    return E_ABORT;
-  }
-
-  CORE_LOG(L2, (_T("[Core::StartCodeRed]")));
-
-  CString exe_path = goopdate_utils::BuildGoogleUpdateExePath(is_system_);
-  CommandLineBuilder builder(COMMANDLINE_MODE_CODE_RED_CHECK);
-  CString cmd_line = builder.GetCommandLineArgs();
-  HRESULT hr = System::StartProcessWithArgs(exe_path, cmd_line);
-  if (SUCCEEDED(hr)) {
-    ++metric_core_cr_succeeded;
-  } else {
-    CORE_LOG(LE, (_T("[can't start Code Red worker][0x%08x]"), hr));
-  }
-  ++metric_core_cr_total;
-  return hr;
-}
-
-HRESULT Core::StartCrashHandler() const {
-  CORE_LOG(L2, (_T("[Core::StartCrashHandler]")));
-
-  HRESULT hr = goopdate_utils::StartCrashHandler(is_system_);
-  if (SUCCEEDED(hr)) {
-    ++metric_core_start_crash_handler_succeeded;
-  } else {
-    CORE_LOG(LE, (_T("[Cannot start Crash Handler][0x%08x]"), hr));
-  }
-  ++metric_core_start_crash_handler_total;
-  return hr;
-}
-
-void Core::AggregateMetrics() const {
-  CORE_LOG(L2, (_T("[aggregate core metrics]")));
-  CollectMetrics();
-  VERIFY1(SUCCEEDED(omaha::AggregateMetrics(is_system_)));
-}
-
-// Collects: working set, peak working set, handle count, process uptime,
-// user disk free space on the current drive, process kernel time, and process
-// user time.
-void Core::CollectMetrics() const {
-  uint64 working_set(0), peak_working_set(0);
-  VERIFY1(SUCCEEDED(System::GetProcessMemoryStatistics(&working_set,
-                                                       &peak_working_set,
-                                                       NULL,
-                                                       NULL)));
-  metric_core_working_set      = working_set;
-  metric_core_peak_working_set = peak_working_set;
-
-  metric_core_handle_count = System::GetProcessHandleCount();
-
-  FILETIME now = {0};
-  FILETIME creation_time = {0};
-  FILETIME exit_time = {0};
-  FILETIME kernel_time = {0};
-  FILETIME user_time = {0};
-
-  ::GetSystemTimeAsFileTime(&now);
-
-  VERIFY1(::GetProcessTimes(::GetCurrentProcess(),
-                            &creation_time,
-                            &exit_time,
-                            &kernel_time,
-                            &user_time));
-
-  ASSERT1(FileTimeToInt64(now) >= FileTimeToInt64(creation_time));
-  uint64 uptime_100ns = FileTimeToInt64(now) - FileTimeToInt64(creation_time);
-
-  metric_core_uptime_ms      = uptime_100ns / kMillisecsTo100ns;
-  metric_core_kernel_time_ms = FileTimeToInt64(kernel_time) / kMillisecsTo100ns;
-  metric_core_user_time_ms   = FileTimeToInt64(user_time) / kMillisecsTo100ns;
-
-  uint64 free_bytes_current_user(0);
-  uint64 total_bytes_current_user(0);
-  uint64 free_bytes_all_users(0);
-
-  CString directory_name(app_util::GetCurrentModuleDirectory());
-  VERIFY1(SUCCEEDED(System::GetDiskStatistics(directory_name,
-                                              &free_bytes_current_user,
-                                              &total_bytes_current_user,
-                                              &free_bytes_all_users)));
-  metric_core_disk_space_available = free_bytes_current_user;
-}
-
-}  // namespace omaha
diff --git a/core/core.h b/core/core.h
deleted file mode 100644
index 2ec0dc7..0000000
--- a/core/core.h
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-// Core uses a reactor design pattern to register event handlers for kernel
-// events, demultiplex them, and transfer control to the respective event
-// handlers.
-
-#ifndef OMAHA_CORE_CORE_H_
-#define OMAHA_CORE_CORE_H_
-
-#include <atlbase.h>
-#include <atlsecurity.h>
-#include <atlstr.h>
-#include <string>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/shutdown_callback.h"
-#include "omaha/core/google_update_core.h"
-#include "omaha/core/system_monitor.h"
-#include "omaha/goopdate/google_update3.h"
-
-namespace omaha {
-
-class Reactor;
-class Scheduler;
-class ShutdownHandler;
-
-// To support hosting ATL COM objects, Core derives from CAtlExeModuleT. Other
-// than the ATL module count, no functionality of CAtlExeModuleT is used.
-class Core
-    : public ShutdownCallback,
-      public SystemMonitorObserver,
-      public CAtlExeModuleT<Core> {
- public:
-  Core();
-  virtual ~Core();
-
-  // Executes the instance entry point with given parameters.
-  HRESULT Main(bool is_system, bool is_crash_handler_enabled);
-
-  // Starts an update worker process if the Core is meant to run all the time.
-  // If not, causes the Core to exit the process.
-  HRESULT StartUpdateWorker() const;
-
-  // Starts a code red process.
-  HRESULT StartCodeRed() const;
-
-  // Starts the crash handler.
-  HRESULT StartCrashHandler() const;
-
-  // Aggregates the core metrics.
-  void AggregateMetrics() const;
-
-  Reactor* reactor() const { return reactor_.get(); }
-  bool is_system() const { return is_system_; }
-
-  virtual LONG Unlock() throw() {
-    // We are long-running independent of the ATL module count, therefore
-    // transition to zero does not by itself unload the process.
-    return CAtlModuleT<Core>::Unlock();
-  }
-
- private:
-
-  HRESULT DoMain(bool is_system, bool is_crash_handler_enabled);
-
-  // Starts an update worker process.
-  HRESULT StartUpdateWorkerInternal() const;
-
-  bool AreScheduledTasksHealthy() const;
-  bool IsServiceHealthy() const;
-  bool IsCheckingForUpdates() const;
-  bool ShouldRunForever() const;
-
-  // ShutdownCallback interface.
-  // Signals the core to stop handling events and exit.
-  virtual HRESULT Shutdown();
-  virtual HRESULT ShutdownInternal() const;
-
-  // SystemMonitorObserver interface.
-  virtual void LastCheckedDeleted();
-  virtual void NoRegisteredClients();
-
-  HRESULT DoRun();
-  HRESULT DoHandleEvents();
-
-  // Collects ambient core metrics.
-  void CollectMetrics()const;
-
-  bool is_system_;
-
-  // True if the core has to kickoff the crash handler.
-  bool is_crash_handler_enabled_;
-
-  DWORD main_thread_id_;        // The id of the thread that runs Core::Main.
-
-  scoped_ptr<Reactor>               reactor_;
-  scoped_ptr<ShutdownHandler>       shutdown_handler_;
-  scoped_ptr<Scheduler>             scheduler_;
-  scoped_ptr<SystemMonitor>         system_monitor_;
-
-  friend class CoreUtilsTest;
-
-  DISALLOW_EVIL_CONSTRUCTORS(Core);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_CORE_CORE_H_
diff --git a/core/core_metrics.cc b/core/core_metrics.cc
deleted file mode 100644
index 4ad285a..0000000
--- a/core/core_metrics.cc
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/core/core_metrics.h"
-
-namespace omaha {
-
-DEFINE_METRIC_integer(core_working_set);
-DEFINE_METRIC_integer(core_peak_working_set);
-
-DEFINE_METRIC_integer(core_handle_count);
-
-DEFINE_METRIC_integer(core_uptime_ms);
-DEFINE_METRIC_integer(core_kernel_time_ms);
-DEFINE_METRIC_integer(core_user_time_ms);
-
-DEFINE_METRIC_integer(core_disk_space_available);
-
-DEFINE_METRIC_count(core_worker_total);
-DEFINE_METRIC_count(core_worker_succeeded);
-DEFINE_METRIC_count(core_cr_total);
-DEFINE_METRIC_count(core_cr_succeeded);
-
-DEFINE_METRIC_integer(core_cr_expected_timer_interval_ms);
-DEFINE_METRIC_integer(core_cr_actual_timer_interval_ms);
-
-DEFINE_METRIC_count(core_start_crash_handler_total);
-DEFINE_METRIC_count(core_start_crash_handler_succeeded);
-
-DEFINE_METRIC_count(core_run_not_checking_for_updates);
-DEFINE_METRIC_count(core_run_task_scheduler_not_running);
-DEFINE_METRIC_count(core_run_scheduled_task_missing);
-DEFINE_METRIC_count(core_run_scheduled_task_disabled);
-DEFINE_METRIC_count(core_run_service_missing);
-DEFINE_METRIC_count(core_run_service_disabled);
-DEFINE_METRIC_integer(core_run_scheduled_task_exit_code);
-
-}  // namespace omaha
-
diff --git a/core/core_metrics.h b/core/core_metrics.h
deleted file mode 100644
index f00af1b..0000000
--- a/core/core_metrics.h
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Declares the usage metrics used by core module.
-
-#ifndef OMAHA_CORE_CORE_METRICS_H_
-#define OMAHA_CORE_CORE_METRICS_H_
-
-#include "omaha/statsreport/metrics.h"
-
-namespace omaha {
-
-// Core process working set and peak working set.
-DECLARE_METRIC_integer(core_working_set);
-DECLARE_METRIC_integer(core_peak_working_set);
-
-// Core process handle count.
-DECLARE_METRIC_integer(core_handle_count);
-
-// Core process uptime, kernel, and user times.
-DECLARE_METRIC_integer(core_uptime_ms);
-DECLARE_METRIC_integer(core_kernel_time_ms);
-DECLARE_METRIC_integer(core_user_time_ms);
-
-// How much free space is availble on the current drive where Omaha is
-// installed.
-DECLARE_METRIC_integer(core_disk_space_available);
-
-// How many worker and code red processes are started by the core.
-DECLARE_METRIC_count(core_worker_total);
-DECLARE_METRIC_count(core_worker_succeeded);
-DECLARE_METRIC_count(core_cr_total);
-DECLARE_METRIC_count(core_cr_succeeded);
-
-// The period of code red checks.
-DECLARE_METRIC_integer(core_cr_expected_timer_interval_ms);
-DECLARE_METRIC_integer(core_cr_actual_timer_interval_ms);
-
-// How many times StartCrashHandler() was called.
-DECLARE_METRIC_count(core_start_crash_handler_total);
-// How many times StartCrashHandler() succeeded.
-DECLARE_METRIC_count(core_start_crash_handler_succeeded);
-
-// Service and scheduled task metrics.
-DECLARE_METRIC_count(core_run_not_checking_for_updates);
-DECLARE_METRIC_count(core_run_task_scheduler_not_running);
-DECLARE_METRIC_count(core_run_scheduled_task_missing);
-DECLARE_METRIC_count(core_run_scheduled_task_disabled);
-DECLARE_METRIC_count(core_run_service_missing);
-DECLARE_METRIC_count(core_run_service_disabled);
-DECLARE_METRIC_integer(core_run_scheduled_task_exit_code);
-
-}  // namespace omaha
-
-#endif  // OMAHA_CORE_CORE_METRICS_H_
-
diff --git a/core/core_unittest.cc b/core/core_unittest.cc
deleted file mode 100644
index e107ea6..0000000
--- a/core/core_unittest.cc
+++ /dev/null
@@ -1,218 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/base/app_util.h"
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/error.h"
-#include "omaha/base/path.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/thread.h"
-#include "omaha/base/time.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/common/scheduled_task_utils.h"
-#include "omaha/core/core.h"
-#include "omaha/setup/setup_service.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-// Runs the core on a different thread. Since the core captures the thread id
-// in its constructor, the core instance must be created on this thread, not
-// on the main thread.
-class CoreRunner : public Runnable {
- public:
-  explicit CoreRunner(bool is_machine) : is_machine_(is_machine) {}
-  virtual ~CoreRunner() {}
-
- private:
-  virtual void Run() {
-    Core core;
-    core.Main(is_machine_, false);         // Do not run the crash handler.
-  }
-
-  bool is_machine_;
-  DISALLOW_EVIL_CONSTRUCTORS(CoreRunner);
-};
-
-}  // namespace
-
-class CoreTest : public testing::Test {
- public:
-  CoreTest() : is_machine_(false) {}
-
-  virtual void SetUp() {
-    // The Core has it's own ATL module. ATL does not like having multiple ATL
-    // modules. This TestCase saves and restore the original ATL module to get
-    // around ATL's limitation. This is a hack.
-    original_atl_module_ = _pAtlModule;
-    _pAtlModule = NULL;
-
-    ASSERT_HRESULT_SUCCEEDED(IsSystemProcess(&is_machine_));
-
-    ConfigManager::Instance()->SetLastCheckedTime(is_machine_, 10);
-
-    NamedObjectAttributes attr;
-    GetNamedObjectAttributes(kShutdownEvent, is_machine_, &attr);
-    reset(shutdown_event_, ::CreateEvent(&attr.sa, true, false, attr.name));
-    ASSERT_TRUE(shutdown_event_);
-  }
-
-  virtual void TearDown() {
-     _pAtlModule = original_atl_module_;
-  }
-
-  HRESULT SignalShutdownEvent() {
-    EXPECT_TRUE(valid(shutdown_event_));
-    return ::SetEvent(get(shutdown_event_)) ? S_OK : HRESULTFromLastError();
-  }
-
-  HRESULT ResetShutdownEvent() {
-    EXPECT_TRUE(valid(shutdown_event_));
-    return ::ResetEvent(get(shutdown_event_)) ? S_OK : HRESULTFromLastError();
-  }
-
- protected:
-  bool is_machine_;
-  scoped_event shutdown_event_;
-
-  CAtlModule* original_atl_module_;
-};
-
-// Tests the core shutdown mechanism.
-TEST_F(CoreTest, Shutdown) {
-  // Signal existing core instances to shutdown, otherwise new instances
-  // can't start.
-  ASSERT_HRESULT_SUCCEEDED(SignalShutdownEvent());
-  ::Sleep(0);
-  ASSERT_HRESULT_SUCCEEDED(ResetShutdownEvent());
-
-  // Start a thread to run the core, signal the core to exit, and wait a while
-  // for the thread to exit. Terminate the thread if it is still running.
-  Thread thread;
-  CoreRunner core_runner(is_machine_);
-  EXPECT_TRUE(thread.Start(&core_runner));
-
-  // Give the core a little time to run before signaling it to exit.
-  ::Sleep(100);
-  EXPECT_HRESULT_SUCCEEDED(SignalShutdownEvent());
-  EXPECT_TRUE(thread.WaitTillExit(2000));
-  if (thread.Running()) {
-    // If you see a crash here, it was likely caused by Application Verifier.
-    // TODO(omaha): Is there a better way to exit? Should we wait longer?
-    thread.Terminate(-1);
-  }
-  EXPECT_HRESULT_SUCCEEDED(ResetShutdownEvent());
-}
-
-class CoreUtilsTest : public testing::Test {
- public:
-  CoreUtilsTest() : is_machine_(vista_util::IsUserAdmin()) {}
-
-  virtual void SetUp() {
-    // The Core has it's own ATL module. ATL does not like having multiple ATL
-    // modules. This TestCase saves and restore the original ATL module to get
-    // around ATL's limitation. This is a hack.
-    original_atl_module_ = _pAtlModule;
-    _pAtlModule = NULL;
-
-    // The Core must be created after the ATL module work around.
-    core_.reset(new Core);
-    core_->is_system_ = is_machine_;
-  }
-
-  virtual void TearDown() {
-    _pAtlModule = original_atl_module_;
-  }
-
-  bool AreScheduledTasksHealthy() {
-    return core_->AreScheduledTasksHealthy();
-  }
-
-  bool IsCheckingForUpdates() {
-    return core_->IsCheckingForUpdates();
-  }
-
-  static HRESULT DoInstallService(const TCHAR* service_cmd_line) {
-    return SetupUpdate3Service::DoInstallService(service_cmd_line);
-  }
-
-  static HRESULT DeleteService() {
-    return SetupUpdate3Service::DeleteService();
-  }
-
-  scoped_ptr<Core> core_;
-  bool is_machine_;
-
-  CAtlModule* original_atl_module_;
-};
-
-TEST_F(CoreUtilsTest, AreScheduledTasksHealthy) {
-  EXPECT_SUCCEEDED(scheduled_task_utils::UninstallGoopdateTasks(is_machine_));
-  EXPECT_FALSE(AreScheduledTasksHealthy());
-
-  CString task_path = ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                                      _T("LongRunningSilent.exe"));
-  EXPECT_SUCCEEDED(scheduled_task_utils::InstallGoopdateTasks(task_path,
-                                                              is_machine_));
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-  const int k12HourPeriodSec = 12 * 60 * 60;
-  const DWORD first_install_12 = now - k12HourPeriodSec;
-  EXPECT_SUCCEEDED(RegKey::SetValue(
-      ConfigManager::Instance()->registry_client_state_goopdate(is_machine_),
-      kRegValueInstallTimeSec,
-      first_install_12));
-  EXPECT_TRUE(AreScheduledTasksHealthy());
-
-  EXPECT_SUCCEEDED(scheduled_task_utils::UninstallGoopdateTasks(is_machine_));
-}
-
-TEST_F(CoreUtilsTest, IsCheckingForUpdates) {
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-  const int k12HourPeriodSec = 12 * 60 * 60;
-  const DWORD first_install_12_hours_back = now - k12HourPeriodSec;
-  EXPECT_SUCCEEDED(RegKey::SetValue(
-      ConfigManager::Instance()->registry_client_state_goopdate(is_machine_),
-      kRegValueInstallTimeSec,
-      first_install_12_hours_back));
-
-  ConfigManager::Instance()->SetLastCheckedTime(is_machine_, 10);
-  EXPECT_TRUE(IsCheckingForUpdates());
-
-  const int k48HourPeriodSec = 48 * 60 * 60;
-  const DWORD first_install_48_hours_back = now - k48HourPeriodSec;
-  EXPECT_SUCCEEDED(RegKey::SetValue(
-      ConfigManager::Instance()->registry_client_state_goopdate(is_machine_),
-      kRegValueInstallTimeSec,
-      first_install_48_hours_back));
-  EXPECT_FALSE(IsCheckingForUpdates());
-
-  EXPECT_SUCCEEDED(goopdate_utils::UpdateLastChecked(is_machine_));
-  EXPECT_TRUE(IsCheckingForUpdates());
-
-  const int k15DaysPeriodSec = 15 * 24 * 60 * 60;
-  const DWORD last_checked_15_days_back = now - k15DaysPeriodSec;
-  ConfigManager::Instance()->SetLastCheckedTime(is_machine_,
-                                                last_checked_15_days_back);
-  EXPECT_FALSE(IsCheckingForUpdates());
-}
-
-}  // namespace omaha
diff --git a/core/crash_handler.cc b/core/crash_handler.cc
deleted file mode 100644
index 222964c..0000000
--- a/core/crash_handler.cc
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// The CrashHandler is a long-lived Omaha process. It runs one instance for the
-// machine and one instance for each user session, including console and TS
-// sessions. If the user has turned off crash reporting, this process will not
-// run.
-
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/program_instance.h"
-#include "omaha/base/reactor.h"
-#include "omaha/base/shutdown_handler.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/core/crash_handler.h"
-#include "omaha/goopdate/crash.h"
-
-namespace omaha {
-
-CrashHandler::CrashHandler()
-    : is_system_(false),
-      main_thread_id_(0) {
-  CORE_LOG(L1, (_T("[CrashHandler::CrashHandler]")));
-}
-
-CrashHandler::~CrashHandler() {
-  CORE_LOG(L1, (_T("[CrashHandler::~CrashHandler]")));
-  Crash::StopServer();
-}
-
-HRESULT CrashHandler::Main(bool is_system) {
-  if (!ConfigManager::Instance()->CanCollectStats(is_system)) {
-    return S_OK;
-  }
-
-  main_thread_id_ = ::GetCurrentThreadId();
-  is_system_ = is_system;
-
-  NamedObjectAttributes single_CrashHandler_attr;
-  GetNamedObjectAttributes(kCrashHandlerSingleInstance,
-                           is_system,
-                           &single_CrashHandler_attr);
-  ProgramInstance instance(single_CrashHandler_attr.name);
-  bool is_already_running = !instance.EnsureSingleInstance();
-  if (is_already_running) {
-    OPT_LOG(L1, (_T("[another CrashHandler instance is already running]")));
-    return S_OK;
-  }
-
-  // Start the crash handler.
-  HRESULT hr = Crash::StartServer();
-  if (FAILED(hr)) {
-    OPT_LOG(LW, (_T("[Failed to start crash handler][0x%08x]"), hr));
-  }
-
-  // Force the main thread to create a message queue so any future WM_QUIT
-  // message posted by the ShutdownHandler will be received. If the main
-  // thread does not have a message queue, the message can be lost.
-  MSG msg = {0};
-  ::PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
-
-  reactor_.reset(new Reactor);
-  shutdown_handler_.reset(new ShutdownHandler);
-  hr = shutdown_handler_->Initialize(reactor_.get(), this, is_system_);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Start processing messages and events from the system.
-  return DoRun();
-}
-
-// Signals the CrashHandler to shutdown. The shutdown method is called by a
-// thread running in the thread pool. It posts a WM_QUIT to the main thread,
-// which causes it to break out of the message loop. If the message can't be
-// posted, it terminates the process unconditionally.
-HRESULT CrashHandler::Shutdown() {
-  OPT_LOG(L1, (_T("[CrashHandler::Shutdown]")));
-  ASSERT1(::GetCurrentThreadId() != main_thread_id_);
-  if (::PostThreadMessage(main_thread_id_, WM_QUIT, 0, 0)) {
-    return S_OK;
-  }
-
-  ASSERT(false, (_T("Failed to post WM_QUIT")));
-  uint32 exit_code = static_cast<uint32>(E_ABORT);
-  VERIFY1(::TerminateProcess(::GetCurrentProcess(), exit_code));
-  return S_OK;
-}
-
-HRESULT CrashHandler::DoRun() {
-  OPT_LOG(L1, (_T("[CrashHandler::DoRun]")));
-
-  // Trim the process working set to minimum. It does not need a more complex
-  // algorithm for now. Likely the working set will increase slightly over time
-  // as the CrashHandler is handling events.
-  VERIFY1(::SetProcessWorkingSetSize(::GetCurrentProcess(),
-                                     static_cast<uint32>(-1),
-                                     static_cast<uint32>(-1)));
-  return DoHandleEvents();
-}
-
-HRESULT CrashHandler::DoHandleEvents() {
-  CORE_LOG(L1, (_T("[CrashHandler::DoHandleEvents]")));
-  MSG msg = {0};
-  int result = 0;
-  while ((result = ::GetMessage(&msg, 0, 0, 0)) != 0) {
-    ::DispatchMessage(&msg);
-    if (result == -1) {
-      break;
-    }
-  }
-  CORE_LOG(L3, (_T("[GetMessage returned %d]"), result));
-  return (result != -1) ? S_OK : HRESULTFromLastError();
-}
-
-}  // namespace omaha
-
diff --git a/core/crash_handler.h b/core/crash_handler.h
deleted file mode 100644
index 8871db8..0000000
--- a/core/crash_handler.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_CORE_CRASH_HANDLER_H_
-#define OMAHA_CORE_CRASH_HANDLER_H_
-
-#include <windows.h>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/shutdown_callback.h"
-#include "third_party/breakpad/src/client/windows/crash_generation/client_info.h"
-#include "third_party/breakpad/src/client/windows/crash_generation/crash_generation_server.h"
-
-namespace omaha {
-
-class Reactor;
-class ShutdownHandler;
-
-class CrashHandler : public ShutdownCallback {
- public:
-  CrashHandler();
-  virtual ~CrashHandler();
-
-  // Executes the instance entry point with given parameters.
-  HRESULT Main(bool is_system);
-
-  Reactor* reactor() const { return reactor_.get(); }
-  bool is_system() const { return is_system_; }
-
- private:
-  typedef google_breakpad::CrashGenerationServer CrashGenerationServer;
-
-  // ShutdownCallback interface.
-  // Signals the CrashHandler to stop handling events and exit.
-  virtual HRESULT Shutdown();
-
-  HRESULT DoRun();
-  HRESULT DoHandleEvents();
-
-  bool is_system_;
-
-  DWORD main_thread_id_;  // The id of the thread that runs CrashHandler::Main.
-
-  scoped_ptr<Reactor>               reactor_;
-  scoped_ptr<ShutdownHandler>       shutdown_handler_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(CrashHandler);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_CORE_CRASH_HANDLER_H_
-
diff --git a/core/google_update_core.cc b/core/google_update_core.cc
deleted file mode 100644
index 94f6ef7..0000000
--- a/core/google_update_core.cc
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/core/google_update_core.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/exception_barrier.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/system.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/goopdate/app_command.h"
-
-namespace omaha {
-
-GoogleUpdateCoreBase::GoogleUpdateCoreBase() : StdMarshalInfo(true) {
-  CORE_LOG(L3, (_T("[GoogleUpdateCoreBase::GoogleUpdateCoreBase]")));
-}
-
-GoogleUpdateCoreBase::~GoogleUpdateCoreBase() {
-  CORE_LOG(L3, (_T("[GoogleUpdateCoreBase::~GoogleUpdateCoreBase]")));
-}
-
-STDMETHODIMP GoogleUpdateCoreBase::LaunchCmdElevated(const WCHAR* app_guid,
-                                                     const WCHAR* cmd_id,
-                                                     DWORD caller_proc_id,
-                                                     ULONG_PTR* proc_handle) {
-  CORE_LOG(L3, (_T("[GoogleUpdateCoreBase::LaunchCmdElevated]")
-                _T("[app %s][cmd %s][pid %d]"),
-                app_guid, cmd_id, caller_proc_id));
-
-  ExceptionBarrier barrier;
-
-  ASSERT1(app_guid);
-  ASSERT1(cmd_id);
-  ASSERT1(proc_handle);
-
-  if (!(IsGuid(app_guid) && cmd_id && _tcslen(cmd_id) && proc_handle)) {
-    return E_INVALIDARG;
-  }
-
-  scoped_process caller_proc_handle;
-  HRESULT hr = OpenCallerProcessHandle(caller_proc_id,
-                                       address(caller_proc_handle));
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[failed to open caller's handle][0x%x]"), hr));
-    return hr;
-  }
-
-  // Allocate a session ID for the ping that this call will generate.  (I'd
-  // really like to be able to pipe an external session ID through this API,
-  // but this is old and I don't feel comfortable changing the signature on it.)
-  CString session_id;
-  GetGuid(&session_id);
-
-  scoped_ptr<AppCommand> app_command;
-  // true == machine level
-  hr = AppCommand::Load(app_guid,
-                        true,
-                        cmd_id,
-                        session_id,
-                        address(app_command));
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[failed to load command configuration][0x%x]"), hr));
-    return hr;
-  }
-
-  // This is a pseudo handle that must not be closed.
-  HANDLE this_process_handle = ::GetCurrentProcess();
-
-  scoped_process command_process;
-  scoped_process duplicate_proc_handle;
-
-  hr = app_command->Execute(address(command_process));
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[failed to launch app command][0x%x]"), hr));
-    return hr;
-  }
-
-  DWORD desired_access = PROCESS_QUERY_INFORMATION | SYNCHRONIZE;
-  bool res = ::DuplicateHandle(
-      this_process_handle,             // Current process.
-      get(command_process),            // Process handle to duplicate.
-      get(caller_proc_handle),         // Process receiving the handle.
-      address(duplicate_proc_handle),  // Duplicated handle.
-      desired_access,                  // Access requested for the new handle.
-      false,                           // Don't inherit the new handle.
-      0) != 0;                         // Flags.
-
-  if (!res) {
-    hr = HRESULTFromLastError();
-    CORE_LOG(LE, (_T("[failed to duplicate the handle][0x%08x]"), hr));
-    return hr;
-  }
-
-  // Transfer the ownership of the new handle to the caller. The caller must
-  // close this handle.
-  *proc_handle = reinterpret_cast<ULONG_PTR>(release(duplicate_proc_handle));
-
-  return S_OK;
-}
-
-HRESULT GoogleUpdateCoreBase::OpenCallerProcessHandle(DWORD proc_id,
-                                                      HANDLE* proc_handle) {
-  ASSERT1(proc_handle);
-  *proc_handle = NULL;
-
-  HRESULT hr = ::CoImpersonateClient();
-  if (FAILED(hr)) {
-    return hr;
-  }
-  ON_SCOPE_EXIT(::CoRevertToSelf);
-
-  *proc_handle = ::OpenProcess(PROCESS_DUP_HANDLE, false, proc_id);
-  return *proc_handle ? S_OK : HRESULTFromLastError();
-}
-
-}  // namespace omaha
-
diff --git a/core/google_update_core.h b/core/google_update_core.h
deleted file mode 100644
index d05b3a4..0000000
--- a/core/google_update_core.h
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_CORE_GOOGLE_UPDATE_CORE_H_
-#define OMAHA_CORE_GOOGLE_UPDATE_CORE_H_
-
-#include <windows.h>
-#include <atlbase.h>
-#include <atlcom.h>
-#include <atlstr.h>
-#include "base/atlregmapex.h"
-#include "base/preprocessor_fun.h"
-#include "base/synchronized.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/goopdate/com_proxy.h"
-#include "omaha/goopdate/elevation_moniker_resource.h"
-#include "omaha/goopdate/non_localized_resource.h"
-
-// Generated by MIDL in the "BUILD_MODE.OBJ_ROOT + SETTINGS.SUBDIR".
-#include "goopdate/omaha3_idl.h"
-
-namespace omaha {
-
-#pragma warning(push)
-// Construction of local static object is not thread-safe
-#pragma warning(disable:4640)
-
-class ATL_NO_VTABLE GoogleUpdateCoreBase
-    : public CComObjectRootEx<CComMultiThreadModel>,
-      public IGoogleUpdateCore,
-      public StdMarshalInfo {
- public:
-  GoogleUpdateCoreBase();
-  virtual ~GoogleUpdateCoreBase();
-
-  BEGIN_COM_MAP(GoogleUpdateCoreBase)
-    COM_INTERFACE_ENTRY(IGoogleUpdateCore)
-    COM_INTERFACE_ENTRY(IStdMarshalInfo)
-  END_COM_MAP()
-
-  // Launches a command line elevated.
-  STDMETHOD(LaunchCmdElevated)(const WCHAR* app_guid,
-                               const WCHAR* cmd_id,
-                               DWORD caller_proc_id,
-                               ULONG_PTR* proc_handle);
- private:
-  // If the COM caller has permissions for process proc_id, opens and returns
-  // the process handle.
-  static HRESULT OpenCallerProcessHandle(DWORD proc_id, HANDLE* proc_handle);
-
-  friend class GoogleUpdateCoreTest;
-
-  DISALLOW_EVIL_CONSTRUCTORS(GoogleUpdateCoreBase);
-};
-
-template <bool is_service>
-class ATL_NO_VTABLE GoogleUpdateCore
-    : public GoogleUpdateCoreBase,
-      public CComCoClass<GoogleUpdateCore<is_service> > {
- public:
-  GoogleUpdateCore() {}
-  virtual ~GoogleUpdateCore() {}
-
-  DECLARE_NOT_AGGREGATABLE(GoogleUpdateCore)
-  DECLARE_REGISTRY_RESOURCEID_EX(is_service ? IDR_LOCAL_SERVICE_RGS :
-                                              IDR_LOCAL_SERVER_ELEVATION_RGS)
-
-  BEGIN_REGISTRY_MAP()
-    REGMAP_ENTRY(_T("PROGID"), is_service ? kProgIDGoogleUpdateCoreService :
-                                            kProgIDGoogleUpdateCoreMachine)
-    REGMAP_ENTRY(_T("VERSION"), _T("1"))
-    REGMAP_ENTRY(_T("NAME"), _T("GoogleUpdateCoreClass"))
-    REGMAP_ENTRY(_T("DESCRIPTION"), _T("Google Update Core Class"))
-    REGMAP_UUID(_T("CLSID"), is_service ?
-                             __uuidof(GoogleUpdateCoreClass) :
-                             __uuidof(GoogleUpdateCoreMachineClass))
-    REGMAP_ENTRY(L"ICONRESID", PP_STRINGIZE(IDI_ELEVATION_MONIKER_ICON))
-    REGMAP_ENTRY(L"STRINGRESID",
-                 PP_STRINGIZE(IDS_ELEVATION_MONIKER_DISPLAYNAME))
-    REGMAP_MODULE2(L"MODULE", kOmahaOnDemandFileName)
-  END_REGISTRY_MAP()
-
- private:
-
-  DISALLOW_EVIL_CONSTRUCTORS(GoogleUpdateCore);
-};
-
-typedef GoogleUpdateCore<false> GoogleUpdateCoreMachine;
-typedef GoogleUpdateCore<true> GoogleUpdateCoreService;
-
-#pragma warning(pop)
-
-}  // namespace omaha
-
-#endif  // OMAHA_CORE_GOOGLE_UPDATE_CORE_H_
diff --git a/core/google_update_core_unittest.cc b/core/google_update_core_unittest.cc
deleted file mode 100644
index ef4515d..0000000
--- a/core/google_update_core_unittest.cc
+++ /dev/null
@@ -1,212 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/app_util.h"
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/error.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/path.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/system.h"
-#include "omaha/base/timer.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/command_line_builder.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/core/google_update_core.h"
-#include "omaha/setup/setup_service.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-const TCHAR update_key[]      = MACHINE_REG_UPDATE;
-const TCHAR appid_key[]       = MACHINE_REG_CLIENTS_GOOPDATE;
-const TCHAR appid_state_key[] = MACHINE_REG_CLIENT_STATE_GOOPDATE;
-
-}  // namespace
-
-class GoogleUpdateCoreTest : public testing::Test {
- protected:
-  GoogleUpdateCoreTest() {
-  }
-
-  static void SetUpTestCase() {
-    if (vista_util::IsUserAdmin()) {
-      System::AdjustPrivilege(SE_DEBUG_NAME, true);
-      TerminateAllGoogleUpdateProcesses();
-    }
-
-    const CString shell_path = goopdate_utils::BuildGoogleUpdateExePath(true);
-    EXPECT_SUCCEEDED(RegKey::SetValue(update_key,
-                                      kRegValueInstalledPath,
-                                      shell_path));
-
-    EXPECT_SUCCEEDED(RegKey::SetValue(update_key,
-                                      kRegValueInstalledVersion,
-                                      GetVersionString()));
-
-    EXPECT_SUCCEEDED(RegKey::SetValue(appid_key,
-                                      kRegValueProductVersion,
-                                      GetVersionString()));
-
-    EXPECT_SUCCEEDED(RegKey::SetValue(appid_key, _T("fc"), _T("fc /?")));
-
-    EXPECT_SUCCEEDED(RegKey::SetValue(appid_state_key,
-                                      kRegValueProductVersion,
-                                      GetVersionString()));
-
-    CopyGoopdateFiles(GetGoogleUpdateMachinePath(), GetVersionString());
-  }
-
-  static void TearDownTestCase() {
-    if (vista_util::IsUserAdmin()) {
-      TerminateAllGoogleUpdateProcesses();
-    }
-
-    EXPECT_SUCCEEDED(RegKey::DeleteValue(appid_key, _T("fc")));
-  }
-
-  void DoLaunchCmdElevatedTests(IUnknown* core_object);
-};
-
-void GoogleUpdateCoreTest::DoLaunchCmdElevatedTests(IUnknown* core_object) {
-  CComQIPtr<IGoogleUpdateCore> google_update_core = core_object;
-  EXPECT_TRUE(google_update_core != NULL);
-  if (!google_update_core) {
-    return;
-  }
-
-  ULONG_PTR proc_handle = 0;
-  DWORD caller_proc_id = ::GetCurrentProcessId();
-
-  // Returns ERROR_BAD_IMPERSONATION_LEVEL when explicit security blanket is not
-  // set.
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_BAD_IMPERSONATION_LEVEL),
-            google_update_core->LaunchCmdElevated(kGoogleUpdateAppId,
-                                                  _T("cmd"),
-                                                  caller_proc_id,
-                                                  &proc_handle));
-  EXPECT_EQ(0, proc_handle);
-
-  // Sets a security blanket that will allow the server to impersonate the
-  // client.
-  EXPECT_SUCCEEDED(::CoSetProxyBlanket(google_update_core,
-      RPC_C_AUTHN_DEFAULT, RPC_C_AUTHZ_DEFAULT, COLE_DEFAULT_PRINCIPAL,
-      RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL,
-      EOAC_DEFAULT));
-
-  // Returns GOOPDATE_E_CORE_MISSING_CMD when the command is missing in
-  // the registry.
-  EXPECT_EQ(GOOPDATE_E_CORE_MISSING_CMD,
-            google_update_core->LaunchCmdElevated(kGoogleUpdateAppId,
-                                                  _T("cmd"),
-                                                  caller_proc_id,
-                                                  &proc_handle));
-  EXPECT_EQ(0, proc_handle);
-
-  // Returns E_INVALIDARG when the app_guid is not a guid.
-  EXPECT_EQ(E_INVALIDARG,
-            google_update_core->LaunchCmdElevated(_T("noguid"),
-                                                  _T("cmd"),
-                                                  caller_proc_id,
-                                                  &proc_handle));
-
-  EXPECT_SUCCEEDED(google_update_core->LaunchCmdElevated(kGoogleUpdateAppId,
-                                                         _T("fc"),
-                                                         caller_proc_id,
-                                                         &proc_handle));
-  EXPECT_NE(0, proc_handle);
-
-  // TODO(Omaha): Perhaps attempt some negative tests here, either by testing
-  // the permissions on the handle explicitly, or by attempting VM operations or
-  // such on the process handle, since it's a serious security issue if the
-  // handle permissions are too wide.
-  HANDLE handle = reinterpret_cast<HANDLE>(proc_handle);
-  EXPECT_NE(WAIT_FAILED, ::WaitForSingleObject(handle, 10000));
-  EXPECT_TRUE(::CloseHandle(handle));
-}
-
-TEST_F(GoogleUpdateCoreTest, LaunchCmdElevated_LocalServerRegistered) {
-  RegisterOrUnregisterGoopdateLocalServer(true);
-
-  CComPtr<IUnknown> local_server_com;
-  EXPECT_SUCCEEDED(System::CoCreateInstanceAsAdmin(
-      NULL, __uuidof(GoogleUpdateCoreMachineClass),
-      IID_PPV_ARGS(&local_server_com)));
-
-  DoLaunchCmdElevatedTests(local_server_com);
-
-  local_server_com.Release();
-
-  RegisterOrUnregisterGoopdateLocalServer(false);
-}
-
-TEST_F(GoogleUpdateCoreTest,
-       LaunchCmdElevated_ServiceAndLocalServerRegistered) {
-  RegisterOrUnregisterGoopdateService(true);
-  RegisterOrUnregisterGoopdateLocalServer(true);
-
-  CComPtr<IUnknown> service_com;
-  EXPECT_SUCCEEDED(
-      service_com.CoCreateInstance(__uuidof(GoogleUpdateCoreClass)));
-
-  DoLaunchCmdElevatedTests(service_com);
-
-  CComPtr<IUnknown> local_server_com;
-  EXPECT_SUCCEEDED(System::CoCreateInstanceAsAdmin(
-      NULL, __uuidof(GoogleUpdateCoreMachineClass),
-      IID_PPV_ARGS(&local_server_com)));
-
-  DoLaunchCmdElevatedTests(local_server_com);
-
-  service_com.Release();
-  local_server_com.Release();
-
-  RegisterOrUnregisterGoopdateLocalServer(false);
-  RegisterOrUnregisterGoopdateService(false);
-}
-
-TEST_F(GoogleUpdateCoreTest, LaunchCmdElevated_ServiceRunning) {
-  if (!vista_util::IsUserAdmin()) {
-    SUCCEED() << "\tTest did not run because the user is not an admin.";
-    return;
-  }
-
-  RegisterOrUnregisterGoopdateService(true);
-
-  // RegisterOrUnregisterGoopdateLocalServer is needed for handler registration.
-  RegisterOrUnregisterGoopdateLocalServer(true);
-
-  EXPECT_SUCCEEDED(SetupUpdateMediumService::StartService());
-  CComPtr<IUnknown> service_com;
-  EXPECT_SUCCEEDED(
-      service_com.CoCreateInstance(__uuidof(GoogleUpdateCoreClass)));
-
-  DoLaunchCmdElevatedTests(service_com);
-
-  service_com.Release();
-
-  RegisterOrUnregisterGoopdateLocalServer(false);
-  RegisterOrUnregisterGoopdateService(false);
-}
-
-}  // namespace omaha
-
diff --git a/core/scheduler.cc b/core/scheduler.cc
deleted file mode 100644
index d2363e7..0000000
--- a/core/scheduler.cc
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/core/scheduler.h"
-#include <algorithm>
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/highres_timer-win32.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/queue_timer.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/core/core.h"
-#include "omaha/core/core_metrics.h"
-
-namespace omaha {
-
-Scheduler::Scheduler(const Core& core)
-    : core_(core) {
-  CORE_LOG(L1, (_T("[Scheduler::Scheduler]")));
-}
-
-Scheduler::~Scheduler() {
-  CORE_LOG(L1, (_T("[Scheduler::~Scheduler]")));
-
-  if (update_timer_.get()) {
-    update_timer_.reset(NULL);
-  }
-
-  if (code_red_timer_.get()) {
-    code_red_timer_.reset(NULL);
-  }
-
-  if (timer_queue_) {
-    // The destructor blocks on deleting the timer queue and it waits for
-    // all timer callbacks to complete.
-    ::DeleteTimerQueueEx(timer_queue_, INVALID_HANDLE_VALUE);
-  }
-}
-
-HRESULT Scheduler::Initialize() {
-  CORE_LOG(L1, (_T("[Scheduler::Initialize]")));
-
-  timer_queue_ = ::CreateTimerQueue();
-  if (!timer_queue_) {
-    return HRESULTFromLastError();
-  }
-
-  cr_debug_timer_.reset(new HighresTimer);
-
-  update_timer_.reset(new QueueTimer(timer_queue_,
-                                     &Scheduler::TimerCallback,
-                                     this));
-  code_red_timer_.reset(new QueueTimer(timer_queue_,
-                                       &Scheduler::TimerCallback,
-                                       this));
-
-  ConfigManager* config_manager = ConfigManager::Instance();
-  int cr_timer_interval_ms = config_manager->GetCodeRedTimerIntervalMs();
-  VERIFY1(SUCCEEDED(ScheduleCodeRedTimer(cr_timer_interval_ms)));
-
-  int au_timer_interval_ms = config_manager->GetUpdateWorkerStartUpDelayMs();
-  VERIFY1(SUCCEEDED(ScheduleUpdateTimer(au_timer_interval_ms)));
-
-  return S_OK;
-}
-
-void Scheduler::TimerCallback(QueueTimer* timer) {
-  ASSERT1(timer);
-  Scheduler* scheduler = static_cast<Scheduler*>(timer->ctx());
-  ASSERT1(scheduler);
-  scheduler->HandleCallback(timer);
-}
-
-// First, do the useful work and then reschedule the timer. Otherwise, it is
-// possible that timer notifications overlap, and the timer can't be further
-// rescheduled: http://b/1228095
-void Scheduler::HandleCallback(QueueTimer* timer) {
-  ConfigManager* config_manager = ConfigManager::Instance();
-  if (update_timer_.get() == timer) {
-    core_.StartUpdateWorker();
-    int au_timer_interval_ms = config_manager->GetAutoUpdateTimerIntervalMs();
-    VERIFY1(SUCCEEDED(ScheduleUpdateTimer(au_timer_interval_ms)));
-  } else if (code_red_timer_.get() == timer) {
-    core_.StartCodeRed();
-    int actual_time_ms = static_cast<int>(cr_debug_timer_->GetElapsedMs());
-    metric_core_cr_actual_timer_interval_ms = actual_time_ms;
-    CORE_LOG(L3, (_T("[code red actual period][%d ms]"), actual_time_ms));
-    int cr_timer_interval_ms = config_manager->GetCodeRedTimerIntervalMs();
-    VERIFY1(SUCCEEDED(ScheduleCodeRedTimer(cr_timer_interval_ms)));
-  } else {
-    ASSERT1(false);
-  }
-
-  // Since core is a long lived process, aggregate its metrics once in a while.
-  core_.AggregateMetrics();
-}
-
-HRESULT Scheduler::ScheduleUpdateTimer(int interval_ms) {
-  HRESULT hr = update_timer_->Start(interval_ms, 0, WT_EXECUTEONLYONCE);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[can't start update queue timer][0x%08x]"), hr));
-  }
-  return hr;
-}
-
-HRESULT Scheduler::ScheduleCodeRedTimer(int interval_ms) {
-  metric_core_cr_expected_timer_interval_ms = interval_ms;
-  cr_debug_timer_->Start();
-  HRESULT hr = code_red_timer_->Start(interval_ms, 0, WT_EXECUTEONLYONCE);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[can't start Code Red queue timer][0x%08x]"), hr));
-  }
-  return hr;
-}
-
-}  // namespace omaha
-
diff --git a/core/scheduler.h b/core/scheduler.h
deleted file mode 100644
index 88ea5c8..0000000
--- a/core/scheduler.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// TODO(omaha): consider using a waitable timer registered with the reactor. It
-// seems a lot less code than using the QueueTimer class.
-
-#ifndef OMAHA_CORE_SCHEDULER_H__
-#define OMAHA_CORE_SCHEDULER_H__
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-
-namespace omaha {
-
-class Core;
-class HighresTimer;
-class QueueTimer;
-
-class Scheduler {
- public:
-  explicit Scheduler(const Core& core);
-  ~Scheduler();
-
-  // Starts the scheduler.
-  HRESULT Initialize();
-
- private:
-  static void TimerCallback(QueueTimer* timer);
-  void HandleCallback(QueueTimer* timer);
-  HRESULT ScheduleUpdateTimer(int interval_ms);
-  HRESULT ScheduleCodeRedTimer(int interval_ms);
-
-  const Core& core_;
-  HANDLE timer_queue_;
-  scoped_ptr<QueueTimer> update_timer_;
-  scoped_ptr<QueueTimer> code_red_timer_;
-
-  // Measures the actual time interval between code red events for debugging
-  // purposes. The timer is started when a code red alarm is set and then,
-  // the value of the timer is read when the alarm goes off.
-  scoped_ptr<HighresTimer> cr_debug_timer_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(Scheduler);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_CORE_SCHEDULER_H__
-
diff --git a/core/system_monitor.cc b/core/system_monitor.cc
deleted file mode 100644
index 7629db8..0000000
--- a/core/system_monitor.cc
+++ /dev/null
@@ -1,144 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/core/system_monitor.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/common/app_registry_utils.h"
-#include "omaha/common/const_goopdate.h"
-
-namespace omaha {
-
-SystemMonitor::SystemMonitor(bool is_machine)
-    : is_machine_(is_machine) {
-  ::InterlockedExchangePointer(reinterpret_cast<void**>(&observer_), NULL);
-}
-
-SystemMonitor::~SystemMonitor() {
-  if (m_hWnd) {
-    VERIFY1(DestroyWindow());
-  }
-}
-
-HRESULT SystemMonitor::Initialize(bool monitor_registry) {
-  if (monitor_registry) {
-    registry_monitor_.reset(new RegistryMonitor);
-    if (SUCCEEDED(registry_monitor_->Initialize())) {
-      HKEY root_key = is_machine_ ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
-      VERIFY1(SUCCEEDED(registry_monitor_->MonitorValue(
-          root_key,
-          GOOPDATE_MAIN_KEY,
-          kRegValueLastChecked,
-          REG_DWORD,
-          RegistryValueChangeCallback,
-          this)));
-      VERIFY1(SUCCEEDED(registry_monitor_->MonitorKey(
-          root_key,
-          GOOPDATE_REG_RELATIVE_CLIENTS,
-          RegistryKeyChangeCallback,
-          this)));
-      VERIFY1(SUCCEEDED(registry_monitor_->StartMonitoring()));
-    }
-  }
-
-  // Create a window to receive broadcast messages.
-  const TCHAR kWindowTitle[] = _T("{2D905E07-FC38-4b89-83E1-931D3630937F}");
-  VERIFY1(Create(NULL, NULL, kWindowTitle));
-  return S_OK;
-}
-
-LRESULT SystemMonitor::OnPowerBroadcast(UINT, WPARAM wparam,
-                                        LPARAM, BOOL& handled) {
-  CORE_LOG(L3, (_T("[SystemMonitor::OnPowerBroadcast][wparam %d]"), wparam));
-  UNREFERENCED_PARAMETER(wparam);
-  handled = true;
-  return 0;
-}
-
-LRESULT SystemMonitor::OnEndSession(UINT, WPARAM wparam,
-                                    LPARAM lparam, BOOL& handled) {
-  CORE_LOG(L3, (_T("[SystemMonitor::OnEndSession][wparam %d][lparam %x]"),
-                wparam, lparam));
-  UNREFERENCED_PARAMETER(wparam);
-  UNREFERENCED_PARAMETER(lparam);
-  handled = true;
-  return 0;
-}
-
-LRESULT SystemMonitor::OnQueryEndSession(UINT, WPARAM,
-                                         LPARAM lparam, BOOL& handled) {
-  CORE_LOG(L3, (_T("[SystemMonitor::OnQueryEndSession][lparam %x]"), lparam));
-  UNREFERENCED_PARAMETER(lparam);
-  handled = true;
-  return TRUE;
-}
-
-LRESULT SystemMonitor::OnWTSSessionChange(UINT, WPARAM wparam,
-                                          LPARAM lparam, BOOL& handled) {
-  CORE_LOG(L3, (_T("[SystemMonitor::OnWTSSessionChange][wparam %x][lparam %d]"),
-                wparam, lparam));
-  UNREFERENCED_PARAMETER(wparam);
-  UNREFERENCED_PARAMETER(lparam);
-  handled = true;
-  return 0;
-}
-
-void SystemMonitor::RegistryValueChangeCallback(const TCHAR* key_name,
-                                                const TCHAR* value_name,
-                                                RegistryChangeType change_type,
-                                                const void* new_value_data,
-                                                void* user_data) {
-  ASSERT1(key_name);
-  ASSERT1(value_name);
-  ASSERT1(user_data);
-
-  ASSERT1(_tcscmp(value_name, kRegValueLastChecked) == 0);
-
-  UNREFERENCED_PARAMETER(key_name);
-  UNREFERENCED_PARAMETER(value_name);
-  UNREFERENCED_PARAMETER(new_value_data);
-
-  SystemMonitor* system_monitor = static_cast<SystemMonitor*>(user_data);
-  if (change_type == REGISTRY_CHANGE_TYPE_DELETE &&
-      system_monitor->observer_) {
-    system_monitor->observer_->LastCheckedDeleted();
-  }
-}
-
-void SystemMonitor::RegistryKeyChangeCallback(const TCHAR* key_name,
-                                              void* user_data) {
-  ASSERT1(key_name);
-  ASSERT1(user_data);
-
-  UNREFERENCED_PARAMETER(key_name);
-  ASSERT1(_tcscmp(key_name, GOOPDATE_REG_RELATIVE_CLIENTS) == 0);
-
-  SystemMonitor* system_monitor = static_cast<SystemMonitor*>(user_data);
-  if (!system_monitor->observer_) {
-    return;
-  }
-
-  const bool is_machine = system_monitor->is_machine_;
-  size_t num_clients(0);
-  if (SUCCEEDED(app_registry_utils::GetNumClients(is_machine, &num_clients)) &&
-      num_clients <= 1) {
-    system_monitor->observer_->NoRegisteredClients();
-  }
-}
-
-}  // namespace omaha
diff --git a/core/system_monitor.h b/core/system_monitor.h
deleted file mode 100644
index 68bd16d..0000000
--- a/core/system_monitor.h
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// SystemMonitor receives session messages and power management messages.
-
-#ifndef OMAHA_CORE_SYSTEM_MONITOR_H_
-#define OMAHA_CORE_SYSTEM_MONITOR_H_
-
-#include <atlbase.h>
-#include <atlwin.h>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/registry_monitor_manager.h"
-
-namespace omaha {
-
-class SystemMonitorObserver {
- public:
-  virtual ~SystemMonitorObserver() {}
-
-  // Called when 'LastChecked' registry value is deleted.
-  virtual void LastCheckedDeleted() = 0;
-
-  // Called when there are no other clients that are registered besides Omaha.
-  virtual void NoRegisteredClients() = 0;
-};
-
-class SystemMonitor
-    : public CWindowImpl<SystemMonitor,
-                         CWindow,
-                         CWinTraits<WS_OVERLAPPED, WS_EX_TOOLWINDOW> > {
- public:
-  explicit SystemMonitor(bool is_machine);
-  ~SystemMonitor();
-
-  HRESULT Initialize(bool monitor_registry);
-
-  void set_observer(SystemMonitorObserver* observer) {
-    ::InterlockedExchangePointer(reinterpret_cast<void**>(&observer_),
-                                 observer);
-  }
-
-  BEGIN_MSG_MAP(SystemMonitor)
-    MESSAGE_HANDLER(WM_POWERBROADCAST,    OnPowerBroadcast)
-    MESSAGE_HANDLER(WM_QUERYENDSESSION,   OnQueryEndSession)
-    MESSAGE_HANDLER(WM_ENDSESSION,        OnEndSession)
-    MESSAGE_HANDLER(WM_WTSSESSION_CHANGE, OnWTSSessionChange)
-  END_MSG_MAP()
-
- private:
-  // Notifies the system monitor that a power-management event has occurred.
-  LRESULT OnPowerBroadcast(UINT msg, WPARAM wparam,
-                           LPARAM lparam, BOOL& handled);
-
-  // Notifies the system monitor a shutdown has been requested.
-  LRESULT OnQueryEndSession(UINT msg, WPARAM wparam,
-                            LPARAM lparam, BOOL& handled);
-
-  // Notifies the system monitor whether the session is ending.
-  LRESULT OnEndSession(UINT msg, WPARAM wparam,
-                       LPARAM lparam, BOOL& handled);
-
-  // Notifies the system monitor about changes in the session state.
-  LRESULT OnWTSSessionChange(UINT msg, WPARAM wparam,
-                             LPARAM lparam, BOOL& handled);
-
-  static void RegistryValueChangeCallback(const TCHAR* key_name,
-                                          const TCHAR* value_name,
-                                          RegistryChangeType change_type,
-                                          const void* new_value_data,
-                                          void* user_data);
-
-  static void RegistryKeyChangeCallback(const TCHAR* key_name,
-                                        void* user_data);
-
-  scoped_ptr<RegistryMonitor> registry_monitor_;
-  bool is_machine_;
-  SystemMonitorObserver* observer_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(SystemMonitor);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_CORE_SYSTEM_MONITOR_H_
-
diff --git a/core/system_monitor_unittest.cc b/core/system_monitor_unittest.cc
deleted file mode 100644
index 8bff9b7..0000000
--- a/core/system_monitor_unittest.cc
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/constants.h"
-#include "omaha/base/path.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/core/system_monitor.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-class SystemMonitorTest
-    : public testing::Test,
-      public SystemMonitorObserver {
- protected:
-  virtual void SetUp() {
-    RegKey::DeleteKey(kRegistryHiveOverrideRoot);
-    OverrideRegistryHives(kRegistryHiveOverrideRoot);
-    gate_.reset(new Gate);
-  }
-
-  virtual void TearDown() {
-    gate_.reset();
-    RestoreRegistryHives();
-    RegKey::DeleteKey(kRegistryHiveOverrideRoot);
-  }
-
-  // SystemMonitorObserver interface.
-  virtual void LastCheckedDeleted() {
-    gate_->Open();
-  }
-
-  virtual void NoRegisteredClients() {
-    gate_->Open();
-  }
-
-  void MonitorLastCheckedTest(bool is_machine);
-  void MonitorClientsTest(bool is_machine);
-
-  scoped_ptr<Gate> gate_;
-};
-
-void SystemMonitorTest::MonitorLastCheckedTest(bool is_machine) {
-  const TCHAR* key_name = is_machine ? MACHINE_REG_UPDATE : USER_REG_UPDATE;
-  DWORD last_checked_value(1);
-  ASSERT_HRESULT_SUCCEEDED(RegKey::SetValue(key_name,
-                                            kRegValueLastChecked,
-                                            last_checked_value));
-  SystemMonitor system_monitor(is_machine);
-  system_monitor.set_observer(this);
-  ASSERT_HRESULT_SUCCEEDED(system_monitor.Initialize(true));
-
-  // Trigger the callback first time.
-  EXPECT_HRESULT_SUCCEEDED(RegKey::DeleteValue(key_name,
-                                               kRegValueLastChecked));
-  EXPECT_TRUE(gate_->Wait(1000));
-  EXPECT_FALSE(RegKey::HasValue(key_name, kRegValueLastChecked));
-
-  // Trigger the callback second time.
-  last_checked_value = 2;
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(key_name,
-                                            kRegValueLastChecked,
-                                            last_checked_value));
-
-  // It takes a while for the registry monitor to detect the changes. There are
-  // two changes here: setting and deleting the values.
-  ::Sleep(50);
-  EXPECT_TRUE(gate_->Close());
-  EXPECT_HRESULT_SUCCEEDED(RegKey::DeleteValue(key_name,
-                                               kRegValueLastChecked));
-  EXPECT_TRUE(gate_->Wait(1000));
-  EXPECT_FALSE(RegKey::HasValue(key_name, kRegValueLastChecked));
-}
-
-void SystemMonitorTest::MonitorClientsTest(bool is_machine) {
-  const TCHAR* key_name = is_machine ? MACHINE_REG_CLIENTS : USER_REG_CLIENTS;
-  const TCHAR guid[] = _T("{4AAF2315-B7C8-4633-A1BA-884EFAB755F7}");
-
-  CString app_guid = ConcatenatePath(key_name, guid);
-  CString omaha_guid = ConcatenatePath(key_name, kGoogleUpdateAppId);
-  const TCHAR* keys_to_create[] = { app_guid, omaha_guid };
-  EXPECT_HRESULT_SUCCEEDED(RegKey::CreateKeys(keys_to_create,
-                                              arraysize(keys_to_create)));
-
-  SystemMonitor system_monitor(is_machine);
-  system_monitor.set_observer(this);
-  EXPECT_HRESULT_SUCCEEDED(system_monitor.Initialize(true));
-
-  EXPECT_HRESULT_SUCCEEDED(RegKey::DeleteKey(keys_to_create[0], true));
-  EXPECT_TRUE(gate_->Wait(1000));
-}
-
-TEST_F(SystemMonitorTest, SystemMonitor) {
-  SystemMonitor system_monitor(false);
-  ASSERT_HRESULT_SUCCEEDED(system_monitor.Initialize(false));
-  EXPECT_EQ(0, system_monitor.SendMessage(WM_POWERBROADCAST, 0, 0));
-  EXPECT_EQ(TRUE, system_monitor.SendMessage(WM_QUERYENDSESSION, 0, 0));
-  EXPECT_EQ(0, system_monitor.SendMessage(WM_ENDSESSION, 0, 0));
-  EXPECT_EQ(0, system_monitor.SendMessage(WM_WTSSESSION_CHANGE, 0, 0));
-}
-
-// Tests the callback gets called when the "LastChecked" is deleted and
-// the value is not recreated automatically by the monitor.
-TEST_F(SystemMonitorTest, DeleteLastChecked_User) {
-  MonitorLastCheckedTest(false);
-}
-
-TEST_F(SystemMonitorTest, DeleteLastChecked_Machine) {
-  MonitorLastCheckedTest(true);
-}
-
-TEST_F(SystemMonitorTest, MonitorClients_User) {
-  MonitorClientsTest(false);
-}
-
-TEST_F(SystemMonitorTest, MonitorClients_Machine) {
-  MonitorClientsTest(true);
-}
-
-}  // namespace omaha
-
diff --git a/data/GoogleUpdate.ini b/data/GoogleUpdate.ini
deleted file mode 100644
index 404a1b9..0000000
--- a/data/GoogleUpdate.ini
+++ /dev/null
@@ -1,6 +0,0 @@
-[LoggingLevel]
-LC_OPT=1
-
-[LoggingSettings]
-EnableLogging=1
-; MaxLogFileSize=1000000
diff --git a/data/OmahaTestCert.cer b/data/OmahaTestCert.cer
deleted file mode 100644
index 74d851b..0000000
--- a/data/OmahaTestCert.cer
+++ /dev/null
Binary files differ
diff --git a/data/OmahaTestCert.pfx b/data/OmahaTestCert.pfx
deleted file mode 100644
index f0ddb4b..0000000
--- a/data/OmahaTestCert.pfx
+++ /dev/null
Binary files differ
diff --git a/data/make_dev_system.reg b/data/make_dev_system.reg
deleted file mode 100644
index b845190..0000000
--- a/data/make_dev_system.reg
+++ /dev/null
Binary files differ
diff --git a/data/make_qa_system.reg b/data/make_qa_system.reg
deleted file mode 100644
index 855b8b4..0000000
--- a/data/make_qa_system.reg
+++ /dev/null
Binary files differ
diff --git a/data/omaha.ini b/data/omaha.ini
deleted file mode 100644
index fa4c1c6..0000000
--- a/data/omaha.ini
+++ /dev/null
@@ -1,18 +0,0 @@
-[LoggingLevel]
-LC_UTIL=0
-LC_SERVICE=3
-LC_CORE=3
-
-[LoggingSettings]
-EnableLogging=1
-ShowTime=1
-LogToFile=1
-AppendToFile=1
-LogToStdOut=0
-LogToOutputDebug=1
-LogFilePath=omaha.log
-
-[DebugSettings]
-SkipServerReport=1
-NoSendDumpToServer=1
-NoSendStackToServer=1
diff --git a/data/seed_manifest.xml b/data/seed_manifest.xml
deleted file mode 100644
index b840bba..0000000
--- a/data/seed_manifest.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gupdate protocol="3.0" signature="" xmlns="http://www.google.com/update2/install">
-<install appguid="{D6B08267-B440-4c85-9F79-E195E80D9937}" needsadmin="false" appname="Test App" lang="en-US"/>
-<install appguid="{D6B08267-B440-4c85-9F79-E195E80D9938}" needsadmin="false" appname="Test App" lang="en-US" browser="0"/>
-<install appguid="{D6B08267-B440-4c85-9F79-E195E80D9939}" needsadmin="false" appname="Test App" lang="en-US"  browser="1"/>
-<install appguid="{D6B08267-B440-4c85-9F79-E195E80D9940}" needsadmin="false" appname="Test App" lang="en-US" browser="2"/>
-<install appguid="{D6B08267-B440-4c85-9F79-E195E80D9941}" needsadmin="false" appname="Test App" lang="en-US" browser="3"/>
-<install appguid="{D6B08267-B440-4c85-9F79-E195E80D9942}" needsadmin="false" appname="Test App" lang="en-US" browser="4"/>
-<install appguid="{D6B08267-B440-4c85-9F79-E195E80D9943}" needsadmin="false" appname="Test App" lang="en-US" browser="5"/>
-</gupdate>
diff --git a/data/seed_manifest_v1.xml b/data/seed_manifest_v1.xml
deleted file mode 100644
index 39011e5..0000000
--- a/data/seed_manifest_v1.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<responses ver="1.0" signature="" xmlns="http://www.google.com/omaha/response">
-<install appguid="{D6B08267-B440-4c85-9F79-E195E80D9937}" needsadmin="false"/>
-<install appguid="{D6B08267-B440-4c85-9F79-E195E80D9938}" needsadmin="false"/>
-</responses>
diff --git a/data/seed_manifest_v9.xml b/data/seed_manifest_v9.xml
deleted file mode 100644
index c10ec67..0000000
--- a/data/seed_manifest_v9.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gupdate protocol="9.0" signature="" xmlns="http://www.google.com/update2/install">
-<install appguid="{D6B08267-B440-4c85-9F79-E195E80D9937}" needsadmin="false" appname="Test App" language="en-US"/>
-<install appguid="{D6B08267-B440-4c85-9F79-E195E80D9938}" needsadmin="false" appname="Test App" language="en-US"/>
-</gupdate>
diff --git a/data/seed_manifest_with_args.xml b/data/seed_manifest_with_args.xml
deleted file mode 100644
index 19afafc..0000000
--- a/data/seed_manifest_with_args.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gupdate protocol="2.0" signature="" xmlns="http://www.google.com/update2/install">
-  <install appguid="{283EAF47-8817-4c2b-A801-AD1FADFB7BAA}" needsadmin="true" iid="{874E4D29-8671-40C8-859F-4DECA4819999}" client="someclient" ap="1.0-dev"/>
-</gupdate>
diff --git a/data/server_manifest.xml b/data/server_manifest.xml
deleted file mode 100644
index 899c0bb..0000000
--- a/data/server_manifest.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gupdate xmlns="http://www.google.com/update2/response" protocol="2.0">
-<daystart elapsed_seconds="8400" />
-<app appid="{D6B08267-B440-4C85-9F79-E195E80D9937}" status="ok">
-  <updatecheck status="ok"
-               codebase="http://dl.google.com/foo/1.0.101.0/test_foo_v1.0.101.0.msi"
-               size="80896"
-               hash="6bPU7OnbKAGJ1LOw6fpIUuQl1FQ="
-               needsadmin="true"
-               successurl="http://testsuccessurl.com"
-               terminateallbrowsers="true"
-               onsuccess="exitsilently"/>
-  <data index="verboselogging" name="install" status="ok">
-  {
-    "distribution": {
-      "verbose_logging": true
-    }
-  }
-  </data>
-  <data index="skipfirstrun" name="install" status="ok">{
-    "distribution": {
-      "skip_first_run_ui": true,
-    }
-  }
-  </data>
-  <ping status="ok"/>
-</app>
-<app appid="{D6B08267-B440-4C85-9F79-E195E80D9936}" status="ok">
-  <updatecheck status="noupdate"/>
-  <ping status="ok"/>
-</app>
-<app appid="{104844D6-7DDA-460B-89F0-FBF8AFDD0A67}" status="ok">
-  <updatecheck status="ok"
-               codebase="http://dl.google.com/foo/1.0.102.0/user_foo_v1.0.102.0.msi"
-               size="630152"
-               hash="/XzRh1rpwqrDr6ashpmQnYZIzDI="
-               needsadmin="false"
-               arguments="/install"
-               unknownfeature="Tests behavior if server supports features client does not."/>
-  <ping status="ok"/>
-</app>
-<app appid="{884a01d9-fb67-430a-b491-28f960dd7309}" status="restricted"></app>
-<app appid="{8CF15C17-7BB5-433a-8E6C-C018D79D00B1}" status="ok">
-  <updatecheck status="error-osnotsupported"
-               errorurl="http://foo.google.com/support/article.py?id=12345&amp;hl=es-419&amp;os=5.1"/>
-  <ping status="ok"/>
-</app>
-</gupdate>
diff --git a/data/server_manifest_components.xml b/data/server_manifest_components.xml
deleted file mode 100644
index 33f8d27..0000000
--- a/data/server_manifest_components.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gupdate xmlns="http://www.google.com/update2/response" protocol="2.0">
-  <app appid="{D6B08267-B440-4C85-9F79-E195E80D9937}" status="ok">
-    <updatecheck status="ok"
-                 codebase="http://dl.google.com/foo/1.0.101.0/test_foo_v1.0.101.0.msi"
-                 size="80896"
-                 hash="6bPU7OnbKAGJ1LOw6fpIUuQl1FQ="
-                 needsadmin="true"
-                 successurl="http://testsuccessurl.com"
-                 terminateallbrowsers="true"
-                 onsuccess="exitsilently"/>
-    <ping status="ok"/>
-    <components>
-      <component appid="{65C42695-84A0-41C4-B70F-D2786F674592}" status="ok">
-        <updatecheck status="ok"
-                     codebase="http://dl.google.com/foo/set_comp1.msi"
-                     size="66324"
-                     hash="6bPU7OnbKAGJ1LOw6fpIUuQl1FQ="/>
-      </component>
-      <component appid="{B318029C-3607-48EB-8DBB-33E8BA17BAF1}" status="noupdate"/>
-      <component appid="{D76AE6FC-1633-4131-B782-896804795DCB}" status="ok">
-        <updatecheck status="ok"
-                     codebase="http://tools.google.com/happy/some_comp_inst.msi"
-                     size="829984"
-                     hash="6bPU7OnbKAGJ1LOw6fpIUuQl1FQ="/>
-      </component>
-      <component appid="{67A52AEE-6E9F-4411-B425-F210B962CD6F}" status="noupdate"/>
-    </components>
-  </app>
-  <app appid="{D6B08267-B440-4C85-9F79-E195E80D9936}" status="ok">
-    <updatecheck status="noupdate"/>
-    <components>
-      <component appid="{115493D4-6B38-4314-81B7-26B61F1766A9}" status="ok">
-        <updatecheck status="ok"
-                     codebase="http://foo.google.com/bar/something.exe"
-                     size="12345"
-                     hash="some_hash_value"/>
-      </component>
-    </components>
-    <ping status="ok"/>
-  </app>
-  <app appid="{104844D6-7DDA-460B-89F0-FBF8AFDD0A67}" status="ok">
-    <updatecheck status="ok"
-                 codebase="http://dl.google.com/foo/1.0.102.0/user_foo_v1.0.102.0.msi"
-                 size="630152"
-                 hash="/XzRh1rpwqrDr6ashpmQnYZIzDI="
-                 needsadmin="false"
-                 arguments="/install"/>
-    <ping status="ok"/>
-  </app>
-  <app appid="{884a01d9-fb67-430a-b491-28f960dd7309}" status="restricted"></app>
-</gupdate>
-
diff --git a/data/server_manifest_one_app.xml b/data/server_manifest_one_app.xml
deleted file mode 100644
index 3b3fd6b..0000000
--- a/data/server_manifest_one_app.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gupdate xmlns="http://www.google.com/update2/response" protocol="2.0">
-<app appid="{CDABE316-39CD-43BA-8440-6D1E0547AEE6}" status="ok">
-  <updatecheck status="ok"
-               codebase="http://dl.google.com/foo/1.0.101.0/foo_installer.exe"
-               size="82128"
-               hash="U4gBMUVwIPQners8SriHpHaWEKk="
-               needsadmin="true"
-               successurl="http://testsuccessurl.com"
-               onsuccess="exitsilentlyonlaunchcmd"
-               terminateallbrowsers="true"/>
-  <data index="verboselogging" name="install" status="ok">
-  {
-    "distribution": {
-      "verbose_logging": true
-    }
-  }
-  </data>
-  <ping status="ok"/>
-</app>
-</gupdate>
diff --git a/data/server_manifest_with_unsupported_tags.xml b/data/server_manifest_with_unsupported_tags.xml
deleted file mode 100644
index 935ecab..0000000
--- a/data/server_manifest_with_unsupported_tags.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gupdate xmlns="http://www.google.com/update2/response" protocol="2.0"
-         ExtraUnsupportedAttribute='123'>
-<UnsupportedElement1 UnsupportedAttribute1='some value' />
-<app appid="{D6B08267-B440-4C85-9F79-E195E80D9937}" status="ok">
-  <updatecheck status="ok"
-               codebase="http://dl.google.com/foo/1.0.101.0/test_foo_v1.0.101.0.msi"
-               size="80896"
-               hash="6bPU7OnbKAGJ1LOw6fpIUuQl1FQ="
-               needsadmin="true"
-               successurl="http://testsuccessurl.com"
-               terminateallbrowsers="true"
-               onsuccess="exitsilently"/>
-  <data index="verboselogging" name="install" status="ok">
-  {
-    "distribution": {
-      "verbose_logging": true
-    }
-  }
-  </data>
-  <data index="skipfirstrun" name="install" status="ok">{
-    "distribution": {
-      "skip_first_run_ui": true,
-    }
-  }
-  </data>
-  <ping status="ok"/>
-</app>
-<app appid="{D6B08267-B440-4C85-9F79-E195E80D9936}" status="ok">
-  <updatecheck status="noupdate"/>
-  <ping status="ok"/>
-</app>
-<app appid="{104844D6-7DDA-460B-89F0-FBF8AFDD0A67}" status="ok">
-  <updatecheck status="ok"
-               codebase="http://dl.google.com/foo/1.0.102.0/user_foo_v1.0.102.0.msi"
-               size="630152"
-               hash="/XzRh1rpwqrDr6ashpmQnYZIzDI="
-               needsadmin="false"
-               arguments="/install"
-               unknownfeature="Tests behavior if server supports features client does not."/>
-  <ping status="ok"/>
-</app>
-<app appid="{884a01d9-fb67-430a-b491-28f960dd7309}" status="restricted"></app>
-<app appid="{8CF15C17-7BB5-433a-8E6C-C018D79D00B1}" status="ok">
-  <updatecheck status="error-osnotsupported"
-               errorurl="http://foo.google.com/support/article.py?id=12345&amp;hl=es-419&amp;os=5.1"/>
-  <ping status="ok"/>
-</app>
-<UnsupportedElement2 UnsupportedAttribute2='Unsupported value' >
-  Some strings inside an unsupported element, should be ignored.
-  <ping status="ok"/>
-</UnsupportedElement2>
-</gupdate>
diff --git a/enterprise/__init__.py b/enterprise/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/enterprise/__init__.py
+++ /dev/null
diff --git a/enterprise/build.scons b/enterprise/build.scons
deleted file mode 100644
index f994429..0000000
--- a/enterprise/build.scons
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-# To build an ADM file:
-#  1) Add a file containing the apps definition (e.g. APPS in public_apps.py).
-#  2) Import that file below.
-#  3) Add a call to the following at the end of this file:
-#       build_group_policy_template.BuildGroupPolicyTemplate(
-#           env, '$STAGING_DIR/Omaha.adm', public_apps.APPS, 'public_apps.py')
-
-from enterprise import build_group_policy_template
-
-Import('env')
-
-env.BuildSConscript('installer')
diff --git a/enterprise/build_group_policy_template.py b/enterprise/build_group_policy_template.py
deleted file mode 100644
index b920d01..0000000
--- a/enterprise/build_group_policy_template.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-"""A Hammer-specific wrapper for generate_group_policy_template."""
-
-from omaha.enterprise import generate_group_policy_template
-
-
-def BuildGroupPolicyTemplate(env, target, apps, apps_file_path=None):
-  """Builds a Group Policy ADM template file, handling dependencies.
-
-  Causes WriteGroupPolicyTemplate() to be called at build time instead of as
-  part of the processing stage.
-
-  Args:
-    env: The environment.
-    target: ADM output file.
-    apps: A list of tuples containing information about each app. See
-        generate_group_policy_template for details.
-    apps_file_path: Optional path to the file that defines apps. Used to enforce
-        dependencies.
-  """
-
-  def _WriteAdmFile(target, source, env):
-    """Called during the build phase to generate and write the ADM file."""
-    source = source  # Avoid PyLint warning.
-    generate_group_policy_template.WriteGroupPolicyTemplate(
-        env.File(target[0]).abspath,
-        env['public_apps'])
-    return 0
-
-  adm_output = env.Command(
-      target=target,
-      source=[],
-      action=_WriteAdmFile,
-      public_apps=apps
-  )
-
-  # Force ADM file to rebuild whenever the script or apps data change.
-  dependencies = ['$MAIN_DIR/enterprise/generate_group_policy_template.py']
-  if apps_file_path:
-    dependencies.append(apps_file_path)
-  env.Depends(adm_output, dependencies)
diff --git a/enterprise/generate_group_policy_template.py b/enterprise/generate_group_policy_template.py
deleted file mode 100644
index a690609..0000000
--- a/enterprise/generate_group_policy_template.py
+++ /dev/null
@@ -1,432 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-"""Generates a Group Policy template file for Google Update policies.
-
-The resulting strings and files use CRLF as required by gpedit.msc.
-
-To unit test this module, just run the file from the command line.
-"""
-
-import codecs
-import filecmp
-import os
-import sys
-
-
-HORIZONTAL_RULE = ';%s\n' % ('-' * 78)
-MAIN_POLICY_KEY = 'Software\Policies\Google\Update'
-
-# pylint: disable-msg=C6004
-HEADER = """\
-CLASS MACHINE
-  CATEGORY !!Cat_Google
-    CATEGORY !!Cat_GoogleUpdate
-      KEYNAME \"""" + MAIN_POLICY_KEY + """\"
-      EXPLAIN !!Explain_GoogleUpdate
-"""
-
-PREFERENCES = """
-      CATEGORY !!Cat_Preferences
-        KEYNAME \"""" + MAIN_POLICY_KEY + """\"
-        EXPLAIN !!Explain_Preferences
-
-        POLICY !!Pol_AutoUpdateCheckPeriod
-          #if version >= 4
-            SUPPORTED !!Sup_GoogleUpdate1_2_145_5
-          #endif
-          EXPLAIN !!Explain_AutoUpdateCheckPeriod
-          PART !!Part_AutoUpdateCheckPeriod NUMERIC
-            VALUENAME AutoUpdateCheckPeriodMinutes
-            DEFAULT 1400  ; 23 hours 20 minutes.
-            MIN 60
-            MAX 43200     ; 30 days.
-            SPIN 60       ; Increment in hour chunks.
-          END PART
-          PART !!Part_DisableAllAutoUpdateChecks CHECKBOX
-            VALUENAME DisableAutoUpdateChecksCheckboxValue  ; Required, unused.
-            ACTIONLISTON
-              ; Writes over Part_AutoUpdateCheckPeriod. Assumes this runs last.
-              VALUENAME AutoUpdateCheckPeriodMinutes VALUE NUMERIC 0
-            END ACTIONLISTON
-            ACTIONLISTOFF
-              ; Do nothing. Let Part_AutoUpdateCheckPeriod take effect.
-            END ACTIONLISTOFF
-            VALUEOFF  NUMERIC 0
-            VALUEON   NUMERIC 1
-          END PART
-        END POLICY
-
-      END CATEGORY  ; Preferences
-"""
-
-APPLICATIONS_HEADER = """
-      CATEGORY !!Cat_Applications
-        KEYNAME \"""" + MAIN_POLICY_KEY + """\"
-        EXPLAIN !!Explain_Applications
-"""
-
-UPDATE_POLICY_ITEMLIST = """\
-            ITEMLIST
-              NAME  !!Name_AutomaticUpdates
-              VALUE NUMERIC 1
-              NAME  !!Name_ManualUpdates
-              VALUE NUMERIC 2
-              NAME  !!Name_UpdatesDisabled
-              VALUE NUMERIC 0
-            END ITEMLIST
-            REQUIRED"""
-
-APPLICATION_DEFAULTS = ("""
-        POLICY !!Pol_DefaultAllowInstallation
-          #if version >= 4
-            SUPPORTED !!Sup_GoogleUpdate1_2_145_5
-          #endif
-          EXPLAIN !!Explain_DefaultAllowInstallation
-          VALUENAME InstallDefault
-          VALUEOFF  NUMERIC 0
-          VALUEON   NUMERIC 1
-        END POLICY
-
-        POLICY !!Pol_DefaultUpdatePolicy
-          #if version >= 4
-            SUPPORTED !!Sup_GoogleUpdate1_2_145_5
-          #endif
-          EXPLAIN !!Explain_DefaultUpdatePolicy
-          PART !!Part_UpdatePolicy DROPDOWNLIST
-            VALUENAME UpdateDefault
-""" +
-UPDATE_POLICY_ITEMLIST + """
-          END PART
-        END POLICY
-""")
-
-APP_POLICIES_TEMPLATE = ("""
-        CATEGORY !!Cat_$AppLegalId$
-          KEYNAME \"""" + MAIN_POLICY_KEY + """\"
-
-          POLICY !!Pol_AllowInstallation
-            #if version >= 4
-              SUPPORTED !!Sup_GoogleUpdate1_2_145_5
-            #endif
-            EXPLAIN !!Explain_Install$AppLegalId$
-            VALUENAME Install$AppGuid$
-            VALUEOFF  NUMERIC 0
-            VALUEON   NUMERIC 1
-          END POLICY
-
-          POLICY !!Pol_UpdatePolicy
-            #if version >= 4
-              SUPPORTED !!Sup_GoogleUpdate1_2_145_5
-            #endif
-            EXPLAIN !!Explain_AutoUpdate$AppLegalId$
-            PART !!Part_UpdatePolicy DROPDOWNLIST
-              VALUENAME Update$AppGuid$
-""" +
-UPDATE_POLICY_ITEMLIST.replace('            ', '              ') + """
-            END PART
-          END POLICY
-
-        END CATEGORY  ; $AppName$
-""")
-
-APPLICATIONS_FOOTER = """
-      END CATEGORY  ; Applications
-
-    END CATEGORY  ; GoogleUpdate
-
-  END CATEGORY  ; Google
-"""
-
-# Policy names that are used in multiple locations.
-ALLOW_INSTALLATION_POLICY = 'Allow installation'
-DEFAULT_ALLOW_INSTALLATION_POLICY = ALLOW_INSTALLATION_POLICY + ' default'
-UPDATE_POLICY = 'Update policy override'
-DEFAULT_UPDATE_POLICY = UPDATE_POLICY + ' default'
-
-# Update policy options that are used in multiple locations.
-AUTOMATIC_UPDATES = 'Automatic silent updates'
-MANUAL_UPDATES = 'Manual updates only'
-UPDATES_DISABLED = 'Updates disabled'
-
-# Category names that are used in multiple locations.
-PREFERENCES_CATEGORY = 'Preferences'
-APPLICATIONS_CATEGORY = 'Applications'
-
-# The captions for update policy were selected such that they appear in order of
-# decreasing preference when organized alphabetically in gpedit.
-STRINGS_HEADER_AND_COMMON = ('\n' +
-HORIZONTAL_RULE +
-"""
-[strings]
-Sup_GoogleUpdate1_2_145_5=At least Google Update 1.2.145.5
-
-Cat_Google=Google
-Cat_GoogleUpdate=Google Update
-Cat_Preferences=""" + PREFERENCES_CATEGORY + """
-Cat_Applications=""" + APPLICATIONS_CATEGORY + """
-
-Pol_AutoUpdateCheckPeriod=Auto-update check period override
-Pol_DefaultAllowInstallation=""" + DEFAULT_ALLOW_INSTALLATION_POLICY + """
-Pol_AllowInstallation=""" + ALLOW_INSTALLATION_POLICY + """
-Pol_DefaultUpdatePolicy=""" + DEFAULT_UPDATE_POLICY + """
-Pol_UpdatePolicy=""" + UPDATE_POLICY + """
-
-Part_AutoUpdateCheckPeriod=Minutes between update checks
-Part_DisableAllAutoUpdateChecks=Disable all auto-update checks (not recommended)
-Part_UpdatePolicy=Policy
-
-Name_AutomaticUpdates=""" + AUTOMATIC_UPDATES + """ (recommended)
-Name_ManualUpdates=""" + MANUAL_UPDATES + """
-Name_UpdatesDisabled=""" + UPDATES_DISABLED + """
-
-""")
-
-STRINGS_APP_NAME_TEMPLATE = """\
-Cat_$AppLegalId$=$AppName$
-"""
-
-# pylint: disable-msg=C6310
-# pylint: disable-msg=C6013
-
-# "application's" should be preceeded by a different word in different contexts.
-# The word is specified by replacing the $PreApplicationWord$ token.
-STRINGS_UPDATE_POLICY_OPTIONS = """\
-    \\n\\nOptions:\\
-    \\n - """ + AUTOMATIC_UPDATES + """: Updates are automatically applied when they are found via the periodic update check.\\
-    \\n - """ + MANUAL_UPDATES + """: Updates are only applied when the user does a manual update check. (Not all apps provide an interface for this.)\\
-    \\n - """ + UPDATES_DISABLED + """: Never apply updates.\\
-    \\n\\nIf you select manual updates, you should periodically check for updates using $PreApplicationWord$ application's manual update mechanism if available. If you disable updates, you should periodically check for updates and distribute them to users."""
-
-STRINGS_COMMON_EXPLANATIONS = ("""
-Explain_GoogleUpdate=Policies to control the installation and updating of Google applications that use Google Update/Google Installer.
-
-""" +
-HORIZONTAL_RULE +
-'; ' + PREFERENCES_CATEGORY + '\n' +
-HORIZONTAL_RULE + """
-Explain_Preferences=General policies for Google Update.
-
-Explain_AutoUpdateCheckPeriod=Minimum number of minutes between automatic update checks.
-
-""" +
-HORIZONTAL_RULE +
-'; ' + APPLICATIONS_CATEGORY + '\n' +
-HORIZONTAL_RULE + """
-Explain_Applications=Policies for individual applications.\\
-    \\n\\nAn updated ADM template will be required to support Google applications released in the future.
-
-Explain_DefaultAllowInstallation=Specifies the default behavior for whether Google software can be installed using Google Update/Google Installer.\\
-    \\n\\nCan be overridden by the \"""" + ALLOW_INSTALLATION_POLICY + """\" for individual applications.\\
-    \\n\\nOnly affects installation of Google software using Google Update/Google Installer. Cannot prevent running the application installer directly or installation of Google software that does not use Google Update/Google Installer for installation.
-
-Explain_DefaultUpdatePolicy=Specifies the default policy for software updates from Google.\\
-    \\n\\nCan be overridden by the \"""" + UPDATE_POLICY + """\" for individual applications.\\
-""" +
-STRINGS_UPDATE_POLICY_OPTIONS.replace('$PreApplicationWord$', 'each') + """\\
-    \\n\\nOnly affects updates for Google software that uses Google Update for updates. Does not prevent auto-updates of Google software that does not use Google Update for updates.\\
-    \\n\\nUpdates for Google Update are not affected by this setting; Google Update will continue to update itself while it is installed.\\
-    \\n\\nWARNING: Disabing updates will also prevent updates of any new Google applications released in the future, possibly including dependencies for future versions of installed applications.
-
-""" +
-HORIZONTAL_RULE +
-'; Individual Applications\n' +
-HORIZONTAL_RULE)
-
-STRINGS_APP_POLICY_EXPLANATIONS_TEMPLATE = ("""
-; $AppName$
-Explain_Install$AppLegalId$=Specifies whether $AppName$ can be installed using Google Update/Google Installer.\\
-    \\n\\nIf this policy is not configured, $AppName$ can be installed as specified by \"""" + DEFAULT_ALLOW_INSTALLATION_POLICY + """\".
-
-Explain_AutoUpdate$AppLegalId$=Specifies how Google Update handles available $AppName$ updates from Google.\\
-    \\n\\nIf this policy is not configured, Google Update handles available updates as specified by \"""" + DEFAULT_UPDATE_POLICY + """\".\\
-""" +
-STRINGS_UPDATE_POLICY_OPTIONS.replace('$PreApplicationWord$', 'the') + '$AppUpdateExplainExtra$\n')
-
-# pylint: enable-msg=C6013
-# pylint: enable-msg=C6310
-# pylint: enable-msg=C6004
-
-
-def GenerateGroupPolicyTemplate(apps):
-  # pylint: disable-msg=C6114
-  """Generates a Group Policy template (ADM format)for the specified apps.
-
-  Replaces LF in strings above with CRLF as required by gpedit.msc.
-  When writing the resulting contents to a file, use binary mode to ensure the
-  CRLFs are preserved.
-
-  Args:
-    apps: A list of tuples containing information about each app.
-        Each element of the list is a tuple of:
-          * app name
-          * app ID
-          * optional string to append to the auto-update explanation
-            - Should start with a space or double new line (\n\n).
-
-  Returns:
-    String containing the contents of the .ADM file.
-  """
-  # pylint: enable-msg=C6114
-
-  def _CreateLegalIdentifier(input_string):
-    """Converts input_string to a legal identifier for ADM files.
-
-    Changes some characters that do not necessarily cause problems and may not
-    handle all cases.
-
-    Args:
-      input_string: Text to convert to a legal identifier.
-
-    Returns:
-      String containing a legal identifier based on input_string.
-    """
-
-    # pylint: disable-msg=C6004
-    return (input_string.replace(' ', '')
-                        .replace('&', '')
-                        .replace('=', '')
-                        .replace(';', '')
-                        .replace(',', '')
-                        .replace('.', '')
-                        .replace('?', '')
-                        .replace('=', '')
-                        .replace(';', '')
-                        .replace("'", '')
-                        .replace('"', '')
-                        .replace('\\', '')
-                        .replace('/', '')
-                        .replace('(', '')
-                        .replace(')', '')
-                        .replace('[', '')
-                        .replace(']', '')
-                        .replace('{', '')
-                        .replace('}', '')
-                        .replace('-', '')
-                        .replace('!', '')
-                        .replace('@', '')
-                        .replace('#', '')
-                        .replace('$', '')
-                        .replace('%', '')
-                        .replace('^', '')
-                        .replace('*', '')
-                        .replace('+', '')
-                        .replace(u'\u00a9', '')   # Copyright (C).
-                        .replace(u'\u00ae', '')   # Registered Trademark (R).
-                        .replace(u'\u2122', ''))  # Trademark (TM).
-
-    # pylint: enable-msg=C6004
-
-  def _WriteTemplateForApp(template, app):
-    """Writes the text for the specified app based on the template.
-
-    Replaces $AppName$, $AppLegalId$, $AppGuid$, and $AppUpdateExplainExtra$.
-
-    Args:
-      template: text to process and write.
-      app: tuple containing information about the app.
-
-    Returns:
-      String containing a copy of the template populated with app-specific
-      strings.
-    """
-
-    (app_name, app_guid, update_explain_extra) = app
-    # pylint: disable-msg=C6004
-    return (template.replace('$AppName$', app_name)
-                    .replace('$AppLegalId$', _CreateLegalIdentifier(app_name))
-                    .replace('$AppGuid$', app_guid)
-                    .replace('$AppUpdateExplainExtra$', update_explain_extra)
-           )
-    # pylint: enable-msg=C6004
-
-  def _WriteTemplateForAllApps(template, apps):
-    """Writes a copy of the template for each of the specified apps.
-
-    Args:
-      template: text to process and write.
-      apps: list of tuples containing information about the apps.
-
-    Returns:
-      String containing concatenated copies of the template for each app in
-      apps, each populated with the appropriate app-specific strings.
-    """
-
-    content = [_WriteTemplateForApp(template, app) for app in apps]
-    return ''.join(content)
-
-  target_contents = [
-      HEADER,
-      PREFERENCES,
-      APPLICATIONS_HEADER,
-      APPLICATION_DEFAULTS,
-      _WriteTemplateForAllApps(APP_POLICIES_TEMPLATE, apps),
-      APPLICATIONS_FOOTER,
-      STRINGS_HEADER_AND_COMMON,
-      _WriteTemplateForAllApps(STRINGS_APP_NAME_TEMPLATE, apps),
-      STRINGS_COMMON_EXPLANATIONS,
-      _WriteTemplateForAllApps(STRINGS_APP_POLICY_EXPLANATIONS_TEMPLATE, apps),
-      ]
-
-  # Join the sections of content then replace LF with CRLF.
-  return ''.join(target_contents).replace('\n', '\r\n')
-
-
-def WriteGroupPolicyTemplate(target_path, apps):
-  """Writes a Group Policy template (ADM format)for the specified apps.
-
-  The file is UTF-16 and contains CRLF on all platforms.
-
-  Args:
-    target_path: Output path of the .ADM template file.
-    apps: A list of tuples containing information about each app.
-        Each element of the list is a tuple of:
-          * app name
-          * app ID
-          * optional string to append to the auto-update explanation
-            - Should start with a space or double new line (\n\n).
-  """  # pylint: disable-msg=C6114
-
-  contents = GenerateGroupPolicyTemplate(apps)
-  f = codecs.open(target_path, 'wb', 'utf-16')
-  f.write(contents)
-  f.close()
-
-# Run a unit test when the module is run directly.
-if __name__ == '__main__':
-  TEST_APPS = [
-      ('Google Test Foo',
-       '{D6B08267-B440-4c85-9F79-E195E80D9937}',
-       ' Check http://www.google.com/test_foo/.'),
-      (u'Google User Test Foo\u00a9\u00ae\u2122',
-       '{104844D6-7DDA-460b-89F0-FBF8AFDD0A67}',
-       ' Check http://www.google.com/user_test_foo/.'),
-      ]
-  TEST_GOLD_FILENAME = 'test_gold.adm'
-  TEST_OUTPUT_FILENAME = 'test_out.adm'
-
-  module_dir = os.path.abspath(os.path.dirname(__file__))
-  gold_path = os.path.join(module_dir, TEST_GOLD_FILENAME)
-  output_path = os.path.join(module_dir, TEST_OUTPUT_FILENAME)
-
-  WriteGroupPolicyTemplate(output_path, TEST_APPS)
-
-  if filecmp.cmp(gold_path, output_path, shallow=False):
-    print 'PASS: Contents equal.'
-  else:
-    print 'FAIL: Contents not equal.'
-    sys.exit(-1)
diff --git a/enterprise/installer/__init__.py b/enterprise/installer/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/enterprise/installer/__init__.py
+++ /dev/null
diff --git a/enterprise/installer/build.scons b/enterprise/installer/build.scons
deleted file mode 100644
index 08eefb8..0000000
--- a/enterprise/installer/build.scons
+++ /dev/null
@@ -1,178 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-""" Build enterprise installers examples.
-
-  This file contains the product-specific information for building an
-  MSI for remote installation in the enterprise. Product teams should only
-  need to modify this file.
-  APPTEAMS:
-  There are two ways to build such an MSI depending on whether the product's
-  installer is or contains an MSI.
-"""
-
-Import('env')
-
-import urllib
-from enterprise.installer import build_enterprise_installer
-
-# APPTEAMS: Change this value to False.
-# Build the installer using build rules specific to Google Update builds.
-BUILDING_WITH_GOOGLE_UPDATE = True
-
-# We need to build the custom_actions dll.
-env.BuildSConscript('custom_actions')
-
-if BUILDING_WITH_GOOGLE_UPDATE and not env.Bit('no-tests'):
-  env.BuildSConscript('test')
-
-# APPTEAMS:
-# Note about versions: Each released build needs to have a different Build
-# number in the version "Major.Minor.Build.Qfe". The Qfe is ignored by MSI and
-# only increasing it may cause both the old and new versions of the this MSI
-# to exist side-by-side (http://msdn.microsoft.com/en-us/library/aa370859.aspx).
-
-# Custom action DLL name.
-# Set this to the path to the DLL containing the error display custom action.
-CUSTOM_ACTION_DLL = ('$STAGING_DIR/show_error_action.dll')
-
-#
-# Applications with EXE installers
-#
-# Use this section to build an MSI that contains Google Update and a product's
-# EXE installer. The EXE may not use an MSI installer internally.
-# MSI installers cannot be wrapped in this way because nested MSI installs are
-# discouraged, problematic, and deprecated from WiX.
-
-# APPTEAMS: Make appropriate call to BuildEnterpriseInstaller(). Example below.
-
-# This sample:
-#  * Builds multiple "products" (each product is actually a different version).
-#    Products are specified in an array of structures, which specify the values
-#    for each product.
-#  * Builds multiple pre-tagged brands and ap values for each "product."
-def _BuildSampleForTest():
-  ENTERPRISE_INSTALLER_PRODUCTS = [
-    ('Save Arguments', '0.1.2.0', '{7DD1EF7B-D075-47c0-BD51-F624ED87CCF0}',
-     '&brand=mkfi',
-     '$MAIN_DIR/testing/unittest_support/SaveArguments.exe',
-     '/install 0.1.2.0', '/donotregister', '/silentuninstall 0.1.2.0',
-     CUSTOM_ACTION_DLL,
-     'SaveArguments_Enterprise_Installer_0.1.2.0'),
-    ('Save Arguments', '0.1.3.0', '{7DD1EF7B-D075-47c0-BD51-F624ED87CCF0}',
-     '&brand=mkfi',
-     '$MAIN_DIR/testing/unittest_support/SaveArguments.exe',
-     '/install 0.1.3.0', '/donotregister', '/silentuninstall 0.1.3.0',
-     CUSTOM_ACTION_DLL,
-     'SaveArguments_Enterprise_Installer_0.1.3.0'),
-    ]
-
-  # Example of calling BuildEnterpriseInstaller with multiple brands and ap
-  # value combinations for each product.
-  BRAND_AP_COMBINATIONS = [
-    ('FOOB', 'foobar'),
-    #('ENTA', 'enterprise'),
-    #('ENTB', 'enterprise'),
-  ]
-
-  # Omaha only: Build the enterprise installer for each version of Omaha.
-  for omaha_version_info in env['omaha_versions_info']:
-    prefix = omaha_version_info.filename_prefix
-
-    for combo in BRAND_AP_COMBINATIONS:
-      for product in ENTERPRISE_INSTALLER_PRODUCTS:
-        (product_name, product_version, product_guid,
-         product_custom_params,
-         product_installer_path,
-         product_installer_install_command,
-         product_installer_disable_update_registration_arg,
-         product_uninstaller_additional_args,
-         show_error_action_dll,
-         msi_base_name) = product
-
-        product_custom_params = '&brand=' + combo[0] + '&ap=' + combo[1]
-
-        build_enterprise_installer.BuildEnterpriseInstaller(
-            env,
-            product_name, product_version, product_guid,
-            product_custom_params,
-            product_installer_path,
-            product_installer_install_command,
-            product_installer_disable_update_registration_arg,
-            product_uninstaller_additional_args,
-            prefix + msi_base_name + '_' + combo[0],
-            '$MAIN_DIR/enterprise/installer',
-            show_error_action_dll,
-            '$STAGING_DIR/%sGoogleUpdateSetup.exe' % prefix,
-            output_dir = '$TARGET_ROOT/Test_Installers'
-        )
-
-# Builds a sample enterprise installer based on a standalone installer.
-# TODO(omaha): Use a standalone installer that does not wrap an MSI. This
-# mechanism is not intended to be used for apps that use MSI installers.
-# As is, Omaha tries to install the MSI but fails because the Windows
-# Installer is busy. It takes a long time to fail because Omaha retries.
-# TODO(omaha): This is a bad example because it uses MSI. See above.
-def _BuildSampleStandaloneForTest():
-  # Omaha only: Build the enterprise installer for each version of Omaha.
-  for omaha_version_info in env['omaha_versions_info']:
-    prefix = omaha_version_info.filename_prefix
-
-    msi_base_name = 'TestFoo_Installer_1.0.101.0'
-    BRAND = 'ENTC'
-    AP = 'enterprise-C'
-    product_custom_params = '&brand=' + BRAND + '&ap=' + AP
-
-    # Sample installer data, encoded for the command line. This sample uses a
-    # JSON format but the format is app-specific.
-    product_installer_data = (
-        '{"enterprise":{"param1":true,"param2":true},"value1":"foo"}')
-    product_installer_data = urllib.quote(product_installer_data)
-
-    build_enterprise_installer.BuildEnterpriseInstallerFromStandaloneInstaller(
-        env,
-        'Test Foo',
-        '1.0.101.0',
-        '{D6B08267-B440-4c85-9F79-E195E80D9937}',
-        product_custom_params,
-        '/silentuninstall',
-        product_installer_data,
-        ('$TARGET_ROOT/Test_Installers/' +
-            '%sUNOFFICIAL_TestFooStandaloneInstaller.exe' % (prefix)),
-        CUSTOM_ACTION_DLL,
-        prefix + msi_base_name + '_' + BRAND,
-        '$MAIN_DIR/enterprise/installer',
-        output_dir = '$TARGET_ROOT/Test_Installers'
-    )
-
-if BUILDING_WITH_GOOGLE_UPDATE:
-  _BuildSampleForTest()
-  _BuildSampleStandaloneForTest()
-
-
-#
-# Applications with MSI installers
-#
-# To bundle Google Update with a product that has an MSI installer:
-#  * Build a .wixobj that contains the Google Update installation fragment
-#    by calling BuildGoogleUpdateFragment().
-#  * Include the ComponentGoogleUpdate component in the appropriate feature in
-#    the product's WiX code.
-#
-# For an example, see instances of "enterprise" in the following files:
-#  omaha/test/test_foo.wxs.xml
-#  omaha/test/build.scons
diff --git a/enterprise/installer/build_enterprise_installer.py b/enterprise/installer/build_enterprise_installer.py
deleted file mode 100644
index d09d47d..0000000
--- a/enterprise/installer/build_enterprise_installer.py
+++ /dev/null
@@ -1,530 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-"""Build an installer for use in enterprise situations.
-
-  This module contains the functionality required to build enterprise
-  installers (MSIs) for Omaha's various customers.
-
-  The supplied wxs templates need to have an XML extension because SCons
-  tries to apply WiX building rules to any input file with the .wxs suffix.
-
-  BuildGoogleUpdateFragment(): Build an update fragment into a .wixobj.
-  GenerateNameBasedGUID(): Generate a GUID based on the names supplied.
-  BuildEnterpriseInstaller(): Build an MSI installer for use in enterprises.
-"""
-
-import binascii
-import md5
-
-_GOOGLE_UPDATE_NAMESPACE_GUID = 'BE19B3E4502845af8B3E67A99FCDCFB1'
-
-
-def BuildGoogleUpdateFragment(env,
-                              metainstaller_path,
-                              product_name,
-                              product_version,
-                              product_guid,
-                              product_custom_params,
-                              wixobj_base_name,
-                              google_update_wxs_template_path):
-  """Build an update fragment into a WiX object.
-
-  Takes a supplied wix fragment, and turns it into a .wixobj object for later
-  inclusion into an MSI.
-
-  Args:
-    env: environment to build with
-    metainstaller_path: path to the Omaha metainstaller to include
-    product_name: name of the product the fragment is being built for
-    product_version: product version to be installed
-    product_guid: Omaha application ID of the product the fragment is being
-        built for
-    product_custom_params: custom values to be appended to the Omaha tag
-    wixobj_base_name: root of name for the wixobj
-    google_update_wxs_template_path: path to the fragment source
-
-  Returns:
-    Output object for the built wixobj.
-
-  Raises:
-    Nothing.
-  """
-
-  product_name_legal_identifier = product_name.replace(' ', '')
-
-  intermediate_base_name = wixobj_base_name + '_google_update_fragment'
-
-  copy_target = env.Command(
-      target=intermediate_base_name + '.wxs',
-      source=google_update_wxs_template_path,
-      action='@copy /y $SOURCE $TARGET',
-  )
-
-  wix_defines = [
-      '-dProductName="%s"' % product_name,
-      '-dProductNameLegalIdentifier="%s"' % product_name_legal_identifier,
-      '-dProductVersion=' + product_version,
-      '-dProductGuid="%s"' % product_guid,
-      '-dProductCustomParams="%s"' % product_custom_params,
-      '-dGoogleUpdateMetainstallerPath="%s"' % (
-          env.File(metainstaller_path).abspath),
-      ]
-
-  wixobj_output = env.Command(
-      target=intermediate_base_name + '.wixobj',
-      source=copy_target,
-      action='@candle.exe -nologo -out $TARGET $SOURCE ' + ' '.join(wix_defines)
-  )
-
-  # Force a rebuild of the .wixobj file when the metainstaller changes.
-  # Does not necessarily force rebuild of the MSI because hash does not change.
-  env.Depends(wixobj_output, metainstaller_path)
-
-  return wixobj_output
-
-
-def _BuildMsiForExe(env,
-                    product_name,
-                    product_version,
-                    product_guid,
-                    product_installer_path,
-                    product_installer_install_command,
-                    product_installer_disable_update_registration_arg,
-                    product_uninstaller_additional_args,
-                    msi_base_name,
-                    google_update_wixobj_output,
-                    enterprise_installer_dir,
-                    show_error_action_dll_path,
-                    metainstaller_path,
-                    output_dir):
-  """Build an MSI installer for use in enterprise situations.
-
-  Builds an MSI for the executable installer at product_installer_path using
-  the supplied details. Requires an existing Google Update installer fragment
-  as well as a path to a custom action DLL containing the logic to launch the
-  product's uninstaller.
-
-  This is intended to enable enterprise installation scenarios.
-
-  Args:
-    env: environment to build with
-    product_name: name of the product being built
-    product_version: product version to be installed
-    product_guid: product's Omaha application ID
-    product_installer_path: path to specific product installer
-    product_installer_install_command: command line args used to run product
-        installer in 'install' mode
-    product_installer_disable_update_registration_arg: command line args used
-        to run product installer in 'do not register' mode
-    product_uninstaller_additional_args: extra command line parameters that the
-        custom action dll will pass on to the product uninstaller, typically
-        you'll want to pass any extra arguments that will force the uninstaller
-        to run silently here.
-    msi_base_name: root of name for the MSI
-    google_update_wixobj_output: the MSI fragment containing the Omaha
-        installer.
-    enterprise_installer_dir: path to dir which contains
-        enterprise_installer.wxs.xml
-    show_error_action_dll_path: path to the error display custom action dll that
-        exports a ShowInstallerResultUIString method. This CA method will read
-        the LastInstallerResultUIString from the product's ClientState key in
-        the registry and display the string via MsiProcessMessage.
-    metainstaller_path: path to the Omaha metainstaller. Should be same file
-        used for google_update_wixobj_output. Used only to force rebuilds.
-    output_dir: path to the directory that will contain the resulting MSI
-
-  Returns:
-    Nothing.
-
-  Raises:
-    Nothing.
-  """
-
-  product_name_legal_identifier = product_name.replace(' ', '')
-  msi_name = msi_base_name + '.msi'
-
-  omaha_installer_namespace = binascii.a2b_hex(_GOOGLE_UPDATE_NAMESPACE_GUID)
-
-  # Include the .msi filename in the Product Code generation because "the
-  # product code must be changed if... the name of the .msi file has been
-  # changed" according to http://msdn.microsoft.com/en-us/library/aa367850.aspx.
-  msi_product_id = GenerateNameBasedGUID(
-      omaha_installer_namespace,
-      'Product %s %s' % (product_name, msi_base_name)
-  )
-  msi_upgradecode_guid = GenerateNameBasedGUID(
-      omaha_installer_namespace,
-      'Upgrade ' + product_name
-  )
-
-  copy_target = env.Command(
-      target=msi_base_name + '.wxs',
-      source=enterprise_installer_dir + '/enterprise_installer.wxs.xml',
-      action='@copy /y $SOURCE $TARGET',
-  )
-
-  # Disable warning LGHT1076 and internal check ICE61 on light.exe.  Details:
-  # http://blogs.msdn.com/astebner/archive/2007/02/13/building-an-msi-using-wix-v3-0-that-includes-the-vc-8-0-runtime-merge-modules.aspx
-  # http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/ICE61-Upgrade-VersionMax-format-is-wrong-td4396813.html # pylint: disable-msg=C6310
-  wix_env = env.Clone()
-  wix_env.Append(
-      WIXCANDLEFLAGS=[
-          '-dProductName=' + product_name,
-          '-dProductNameLegalIdentifier=' + product_name_legal_identifier,
-          '-dProductVersion=' + product_version,
-          '-dProductGuid=' + product_guid,
-          '-dProductInstallerPath=' + env.File(product_installer_path).abspath,
-          '-dProductInstallerInstallCommand=' + (
-              product_installer_install_command),
-          '-dProductInstallerDisableUpdateRegistrationArg=' + (
-              product_installer_disable_update_registration_arg),
-          '-dShowErrorCADll=' + env.File(show_error_action_dll_path).abspath,
-          '-dProductUninstallerAdditionalArgs=' + (
-              product_uninstaller_additional_args),
-          '-dMsiProductId=' + msi_product_id,
-          '-dMsiUpgradeCode=' + msi_upgradecode_guid,
-          ],
-      WIXLIGHTFLAGS=[
-          '-sw1076',
-          '-sice:ICE61',
-          ],
-  )
-
-  wix_output = wix_env.WiX(
-      target='unsigned_' + msi_name,
-      source=[copy_target, google_update_wixobj_output],
-  )
-
-  # Force a rebuild when the installer or metainstaller changes.
-  # The metainstaller change does not get passed through even though the .wixobj
-  # file is rebuilt because the hash of the .wixobj does not change.
-  # Also force a dependency on the CA DLL. Otherwise, it might not be built
-  # before the MSI.
-  wix_env.Depends(wix_output, [product_installer_path,
-                               metainstaller_path,
-                               show_error_action_dll_path])
-
-  sign_output = wix_env.SignedBinary(
-      target=msi_name,
-      source=wix_output,
-  )
-
-  env.Replicate(output_dir, sign_output)
-
-
-def GenerateNameBasedGUID(namespace, name):
-  """Generate a GUID based on the names supplied.
-
-  Follows a methodology recommended in Section 4.3 of RFC 4122 to generate
-  a "name-based UUID," which basically means that you want to control the
-  inputs to the GUID so that you can generate the same valid GUID each time
-  given the same inputs.
-
-  Args:
-    namespace: First part of identifier used to generate GUID
-    name: Second part of identifier used to generate GUID
-
-  Returns:
-    String representation of the generated GUID.
-
-  Raises:
-    Nothing.
-  """
-
-  # Generate 128 unique bits.
-  mymd5 = md5.new()
-  mymd5.update(namespace + name)
-  md5_hash = mymd5.digest()
-
-  # Set various reserved bits to make this a valid GUID.
-
-  # "Set the four most significant bits (bits 12 through 15) of the
-  # time_hi_and_version field to the appropriate 4-bit version number
-  # from Section 4.1.3."
-  version = ord(md5_hash[6])
-  version = 0x30 | (version & 0x0f)
-
-  # "Set the two most significant bits (bits 6 and 7) of the
-  # clock_seq_hi_and_reserved to zero and one, respectively."
-  clock_seq_hi_and_reserved = ord(md5_hash[8])
-  clock_seq_hi_and_reserved = 0x80 | (clock_seq_hi_and_reserved & 0x3f)
-
-  return (
-      '%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x' % (
-          ord(md5_hash[0]), ord(md5_hash[1]), ord(md5_hash[2]),
-          ord(md5_hash[3]),
-          ord(md5_hash[4]), ord(md5_hash[5]),
-          version, ord(md5_hash[7]),
-          clock_seq_hi_and_reserved, ord(md5_hash[9]),
-          ord(md5_hash[10]), ord(md5_hash[11]), ord(md5_hash[12]),
-          ord(md5_hash[13]), ord(md5_hash[14]), ord(md5_hash[15])))
-
-
-def ConvertToMSIVersionNumberIfNeeded(product_version):
-  """Change product_version to fit in an MSI version number if needed.
-
-  Some products use a 4-field version numbering scheme whereas MSI looks only
-  at the first three fields when considering version numbers. Furthermore, MSI
-  version fields have documented width restrictions of 8bits.8bits.16bits as
-  per http://msdn.microsoft.com/en-us/library/aa370859(VS.85).aspx
-
-  As such, the following scheme is used:
-
-  Product a.b.c.d -> a.(c>>8).(((c & 0xFF) << 8) + d)
-
-  So eg. 6.1.420.8 would become 6.1.41992.
-
-  This assumes:
-  1) we don't care about the product minor number, e.g. we will never reset
-     the 'c' number after an increase in 'b'.
-  2) 'd' will always be <= 255
-  3) 'c' is <= 65535
-
-  As a final note, if product_version is not of the format a.b.c.d then
-  this function returns the original product_version value.
-  """
-
-  try:
-    version_field_strings = product_version.split('.')
-    (major, minor, build, patch) = [int(x) for x in version_field_strings]
-  except:
-    # Couldn't parse the version number as a 4-term period-separated number,
-    # just return the original string.
-    return product_version
-
-  # Input version number was out of range. Return the original string.
-  if patch > 255 or build > 65535:
-    return product_string
-
-  msi_major = major
-  msi_minor = build >> 8
-  msi_build = ((build & 0xff) << 8) + patch
-
-  return str(msi_major) + '.' + str(msi_minor) + '.' + str(msi_build)
-
-
-def BuildEnterpriseInstaller(env,
-                             product_name,
-                             product_version,
-                             product_guid,
-                             product_custom_params,
-                             product_installer_path,
-                             product_installer_install_command,
-                             product_installer_disable_update_registration_arg,
-                             product_uninstaller_additional_args,
-                             msi_base_name,
-                             enterprise_installer_dir,
-                             show_error_action_dll_path,
-                             metainstaller_path,
-                             output_dir='$STAGING_DIR'):
-  """Build an installer for use in enterprise situations.
-
-  Builds an MSI using the supplied details and binaries. This MSI is
-  intended to enable enterprise installation scenarios.
-
-  Args:
-    env: environment to build with
-    product_name: name of the product being built
-    product_version: product version to be installed
-    product_guid: product's Omaha application ID
-    product_custom_params: custom values to be appended to the Omaha tag
-    product_installer_path: path to specific product installer
-    product_installer_install_command: command line args used to run product
-        installer in 'install' mode
-    product_installer_disable_update_registration_arg: command line args used
-        to run product installer in 'do not register' mode
-    product_uninstaller_additional_args: extra command line parameters that the
-        custom action dll will pass on to the product uninstaller, typically
-        you'll want to pass any extra arguments that will force the uninstaller
-        to run silently here.
-    msi_base_name: root of name for the MSI
-    enterprise_installer_dir: path to dir which contains
-        enterprise_installer.wxs.xml
-    show_error_action_dll_path: path to the error display custom action dll that
-        exports a ShowInstallerResultUIString method. This CA method will read
-        the LastInstallerResultUIString from the product's ClientState key in
-        the registry and display the string via MsiProcessMessage.
-    metainstaller_path: path to the Omaha metainstaller to include
-    output_dir: path to the directory that will contain the resulting MSI
-
-  Returns:
-    Nothing.
-
-  Raises:
-    Nothing.
-  """
-  product_version = ConvertToMSIVersionNumberIfNeeded(product_version)
-
-  google_update_wixobj_output = BuildGoogleUpdateFragment(
-      env,
-      metainstaller_path,
-      product_name,
-      product_version,
-      product_guid,
-      product_custom_params,
-      msi_base_name,
-      enterprise_installer_dir + '/google_update_installer_fragment.wxs.xml')
-
-  _BuildMsiForExe(
-      env,
-      product_name,
-      product_version,
-      product_guid,
-      product_installer_path,
-      product_installer_install_command,
-      product_installer_disable_update_registration_arg,
-      product_uninstaller_additional_args,
-      msi_base_name,
-      google_update_wixobj_output,
-      enterprise_installer_dir,
-      show_error_action_dll_path,
-      metainstaller_path,
-      output_dir)
-
-
-def BuildEnterpriseInstallerFromStandaloneInstaller(
-    env,
-    product_name,
-    product_version,
-    product_guid,
-    product_custom_params,
-    product_uninstaller_additional_args,
-    product_installer_data,
-    standalone_installer_path,
-    show_error_action_dll_path,
-    msi_base_name,
-    enterprise_installer_dir,
-    output_dir='$STAGING_DIR'):
-  """Build an installer for use in enterprise situations.
-
-  Builds an MSI around the supplied standalone installer. This MSI is
-  intended to enable enterprise installation scenarios while being as close
-  to a normal install as possible. It does not suffer from the separation of
-  Omaha and application install like the other methods do.
-
-  This method only works for installers that do not use an MSI.
-
-  Args:
-    env: environment to build with
-    product_name: name of the product being built
-    product_version: product version to be installed
-    product_guid: product's Omaha application ID
-    product_custom_params: custom values to be appended to the Omaha tag
-    product_uninstaller_additional_args: extra command line parameters that the
-        custom action dll will pass on to the product uninstaller, typically
-        you'll want to pass any extra arguments that will force the uninstaller
-        to run silently here.
-    product_installer_data: installer data to be passed to the
-        product installer at run time. This is useful as an alternative to
-        the product_installer_install_command parameter accepted by
-        BuildEnterpriseInstaller() since command line parameters can't be
-        passed to the product installer when it is wrapped in a standalone
-        installer.
-    standalone_installer_path: path to product's standalone installer
-    show_error_action_dll_path: path to the error display custom action dll that
-        exports a ShowInstallerResultUIString method. This CA method will read
-        the LastInstallerResultUIString from the product's ClientState key in
-        the registry and display the string via MsiProcessMessage.
-    msi_base_name: root of name for the MSI
-    enterprise_installer_dir: path to dir which contains
-        enterprise_standalone_installer.wxs.xml
-    output_dir: path to the directory that will contain the resulting MSI
-
-  Returns:
-    Target nodes.
-
-  Raises:
-    Nothing.
-  """
-  product_name_legal_identifier = product_name.replace(' ', '')
-  msi_name = msi_base_name + '.msi'
-  product_version = ConvertToMSIVersionNumberIfNeeded(product_version)
-
-  omaha_installer_namespace = binascii.a2b_hex(_GOOGLE_UPDATE_NAMESPACE_GUID)
-
-  # Include the .msi filename in the Product Code generation because "the
-  # product code must be changed if... the name of the .msi file has been
-  # changed" according to http://msdn.microsoft.com/en-us/library/aa367850.aspx.
-  msi_product_id = GenerateNameBasedGUID(
-      omaha_installer_namespace,
-      'Product %s %s' % (product_name, msi_base_name)
-  )
-  msi_upgradecode_guid = GenerateNameBasedGUID(
-      omaha_installer_namespace,
-      'Upgrade ' + product_name
-  )
-
-  # To allow for multiple versions of the same product to be generated,
-  # stick output in a subdirectory.
-  output_directory_name = product_guid + '.' + product_version
-
-  copy_target = env.Command(
-      target=output_directory_name + msi_base_name + '.wxs',
-      source=(enterprise_installer_dir +
-              '/enterprise_standalone_installer.wxs.xml'),
-      action='@copy /y $SOURCE $TARGET',
-  )
-
-  wix_env = env.Clone()
-  wix_candle_flags = [
-      '-dProductName=' + product_name,
-      '-dProductNameLegalIdentifier=' + product_name_legal_identifier,
-      '-dProductVersion=' + product_version,
-      '-dProductGuid="%s"' % product_guid,
-      '-dProductCustomParams="%s"' % product_custom_params,
-      '-dStandaloneInstallerPath=' + (
-          env.File(standalone_installer_path).abspath),
-      '-dShowErrorCADll=' + env.File(show_error_action_dll_path).abspath,
-      '-dProductUninstallerAdditionalArgs=' + (
-          product_uninstaller_additional_args),
-      '-dMsiProductId=' + msi_product_id,
-      '-dMsiUpgradeCode=' + msi_upgradecode_guid,
-  ]
-
-  if product_installer_data:
-    wix_candle_flags.append('-dProductInstallerData=' + product_installer_data)
-
-  wix_light_flags = [
-      '-sw1076',
-      '-sice:ICE61',
-  ]
-
-  wix_env.Append(
-      WIXCANDLEFLAGS=wix_candle_flags,
-      WIXLIGHTFLAGS=wix_light_flags
-  )
-
-  wix_output = wix_env.WiX(
-      target = output_directory_name + '/' + 'unsigned_' + msi_name,
-      source = [copy_target],
-  )
-
-  # Force a rebuild when the standalone installer changes.
-  # The metainstaller change does not get passed through even though the .wixobj
-  # file is rebuilt because the hash of the .wixobj does not change.
-  # Also force a dependency on the CA DLL. Otherwise, it might not be built
-  # before the MSI.
-  wix_env.Depends(wix_output, [standalone_installer_path,
-                               show_error_action_dll_path])
-
-  sign_output = wix_env.SignedBinary(
-      target=output_directory_name + '/' + msi_name,
-      source=wix_output,
-  )
-
-  return env.Replicate(output_dir + '/' + output_directory_name, sign_output)
diff --git a/enterprise/installer/custom_actions/build.scons b/enterprise/installer/custom_actions/build.scons
deleted file mode 100644
index 7c30817..0000000
--- a/enterprise/installer/custom_actions/build.scons
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009-2011 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-#
-# Build show_error_action.dll
-#
-dll_env = env.Clone(
-    # Build a dll, not a lib.
-    COMPONENT_STATIC = False,
-)
-
-dll_env.Append(
-    LIBS = [
-        ('libcmt.lib', 'libcmtd.lib')[dll_env.Bit('debug')],
-        ('libcpmt.lib', 'libcpmtd.lib')[dll_env.Bit('debug')],
-        'msi.lib',
-        ],
-)
-
-signed_target_name = 'show_error_action'
-target_name = signed_target_name + '_unsigned'
-
-dll_inputs = [
-    'show_error_action.cc',
-    'show_error_action.def',
-    ]
-
-unsigned_dll = dll_env.ComponentLibrary(
-    lib_name=target_name,
-    source=dll_inputs,
-)
-
-signed_dll = dll_env.SignedBinary(
-    target=signed_target_name + '.dll',
-    source=unsigned_dll,
-)
-
-dll_env.Replicate('$STAGING_DIR', signed_dll)
-dll_env.Replicate('$STAGING_DIR',
-                  [f for f in unsigned_dll if f.suffix == '.pdb'])
diff --git a/enterprise/installer/custom_actions/show_error_action.cc b/enterprise/installer/custom_actions/show_error_action.cc
deleted file mode 100644
index a44f052..0000000
--- a/enterprise/installer/custom_actions/show_error_action.cc
+++ /dev/null
@@ -1,285 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Author: grt
-//
-// A Windows Installer custom action that displays and logs an app installer's
-// InstallResultUIString via MsiProcessMessage.  The app's guid must be provided
-// by the MSI wrapper by way of the CustomActionData property.
-
-#include <windows.h>
-#include <msi.h>
-#include <msiquery.h>
-#include <objbase.h>
-#include <stdlib.h>
-
-#include <algorithm>
-#include <limits>
-#include <string>
-
-#define SOFTWARE_GOOGLE_UPDATE L"Software\\Google\\Update"
-#define SOFTWARE_GOOGLE_UPDATE_CLIENTSTATE \
-    SOFTWARE_GOOGLE_UPDATE L"\\ClientState"
-
-namespace {
-
-const int kGuidStringLength = 38;  // 128/4 + 4 dashes + 2 braces.
-const DWORD kInstallerResultFailedCustomError = 1;
-const wchar_t kPropertyCustomActionData[] = L"CustomActionData";
-const wchar_t kRegKeyClientState[] = SOFTWARE_GOOGLE_UPDATE_CLIENTSTATE;
-const wchar_t kRegKeyGoogleUpdate[] = SOFTWARE_GOOGLE_UPDATE;
-const wchar_t kRegValueLastInstallerResult[] = L"LastInstallerResult";
-const wchar_t kRegValueLastInstallerResultUIString[] =
-    L"LastInstallerResultUIString";
-
-// Gets the value of the property named |property_name|, putting it in
-// |property_value|. The anticipated length of the value can be provided in
-// |expected_length| to reduce overhead. Returns true if a (possibly empty)
-// value is read, or false on error.
-bool GetProperty(MSIHANDLE install,
-                 const wchar_t* property_name,
-                 int expected_length,
-                 std::wstring* property_value) {
-  DWORD value_len = static_cast<DWORD>(std::max(0, expected_length));
-  UINT result = ERROR_SUCCESS;
-  do {
-    // Make space to hold the string terminator.
-    property_value->resize(++value_len);
-    result = MsiGetProperty(install, property_name, &(*property_value)[0],
-                            &value_len);
-  } while (result == ERROR_MORE_DATA &&
-           value_len <= std::numeric_limits<DWORD>::max() - 1);
-
-  if (result == ERROR_SUCCESS)
-    property_value->resize(value_len);
-  else
-    property_value->clear();
-
-  return result == ERROR_SUCCESS;
-}
-
-// The type of a function that returns true if |c| is a valid char in a GUID.
-typedef bool (*IsGuidCharFn)(wchar_t c);
-
-// A function template that returns true if |c| equals some constant |C|.
-template<wchar_t C>
-bool IsChar(wchar_t c) {
-  return c == C;
-}
-
-// Returns true if |c| is a valid hex character.
-bool IsHexDigit(wchar_t c) {
-  return ((c >= L'0' && c <= '9') ||
-          (c >= L'a' && c <= 'f') ||
-          (c >= L'A' && c <= 'F'));
-}
-
-// Returns true if |guid| is a well-formed GUID.
-bool IsGuid(const std::wstring& guid) {
-  static const IsGuidCharFn kGuidCharValidators[] = {
-    IsChar<L'{'>,
-    IsHexDigit,
-    IsHexDigit,
-    IsHexDigit,
-    IsHexDigit,
-    IsHexDigit,
-    IsHexDigit,
-    IsHexDigit,
-    IsHexDigit,
-    IsChar<L'-'>,
-    IsHexDigit,
-    IsHexDigit,
-    IsHexDigit,
-    IsHexDigit,
-    IsChar<L'-'>,
-    IsHexDigit,
-    IsHexDigit,
-    IsHexDigit,
-    IsHexDigit,
-    IsChar<L'-'>,
-    IsHexDigit,
-    IsHexDigit,
-    IsHexDigit,
-    IsHexDigit,
-    IsChar<L'-'>,
-    IsHexDigit,
-    IsHexDigit,
-    IsHexDigit,
-    IsHexDigit,
-    IsHexDigit,
-    IsHexDigit,
-    IsHexDigit,
-    IsHexDigit,
-    IsHexDigit,
-    IsHexDigit,
-    IsHexDigit,
-    IsHexDigit,
-    IsChar<L'}'>,
-  };
-
-  if (guid.size() != _countof(kGuidCharValidators))
-    return false;
-
-  for (size_t i = 0, end = guid.size(); i < end; ++i) {
-    if (!kGuidCharValidators[i](guid[i]))
-      return false;
-  }
-
-  return true;
-}
-
-// Gets the app guid for the product being installed. Returns false if a value
-// that doesn't look like a GUID is read.
-bool GetProductGuid(MSIHANDLE install, std::wstring* guid) {
-  return GetProperty(install, kPropertyCustomActionData, kGuidStringLength,
-                     guid) &&
-         IsGuid(*guid);
-}
-
-// Populates |key_name| with the full name of |app_guid|'s ClientState registry
-// key.
-void GetAppClientStateKey(const std::wstring& app_guid,
-                          std::wstring* key_name) {
-  const size_t base_len = _countof(kRegKeyClientState) - 1;
-  key_name->reserve(base_len + 1 + app_guid.size());
-  key_name->assign(kRegKeyClientState, base_len);
-  key_name->append(1, L'\\');
-  key_name->append(app_guid);
-}
-
-// Reads the string value named |value_name| in registry key |key| into
-// |result_string|.  Returns ERROR_NOT_SUPPORTED if the value exists but is not
-// of type REG_SZ.
-LONG ReadRegistryStringValue(HKEY key, const wchar_t* value_name,
-                             std::wstring* result_string) {
-  LONG result;
-  DWORD type;
-  DWORD byte_length;
-
-  // Use all of the provided buffer.
-  result_string->resize(result_string->capacity());
-
-  // Figure out how much we can hold there, being careful about overflow.
-  byte_length = static_cast<DWORD>(std::min(
-      result_string->size(),
-      static_cast<size_t>(
-          std::numeric_limits<DWORD>::max() / sizeof(wchar_t))));
-  byte_length *= sizeof(wchar_t);
-
-  do {
-    // Read into the provided buffer.
-    BYTE* buffer = reinterpret_cast<BYTE*>(
-        result_string->empty() ? NULL : &(*result_string)[0]);
-    result = RegQueryValueEx(key, value_name, NULL, &type, buffer,
-                             &byte_length);
-    if (result == ERROR_SUCCESS) {
-      const size_t chars_read = byte_length / sizeof(wchar_t);
-      if (type != REG_SZ) {
-        // The value wasn't a string.
-        result = ERROR_NOT_SUPPORTED;
-      } else if (byte_length == 0) {
-        // The string was empty.
-        result_string->clear();
-      } else if ((*result_string)[chars_read - 1] != L'\0') {
-        // The string was not terminated.  Let std::basic_string do so.
-        result_string->resize(chars_read);
-      } else {
-        // The string was terminated.  Trim off the terminator.
-        result_string->resize(chars_read - 1);
-      }
-    } else if (result == ERROR_MORE_DATA) {
-      // Increase the buffer and try again.
-      result_string->resize(byte_length / sizeof(wchar_t));
-    }
-  } while (result == ERROR_MORE_DATA);
-
-  return result;
-}
-
-// Reads the DWORD value named |value_name| in registry key |key| into |value|.
-// Returns ERROR_NOT_SUPPORTED if the value exists but is not of type REG_DWORD.
-LONG ReadRegistryDwordValue(HKEY key, const wchar_t* value_name, DWORD* value) {
-  LONG result;
-  DWORD type;
-  DWORD byte_length = sizeof(*value);
-
-  result = RegQueryValueEx(key, value_name, NULL, &type,
-                           reinterpret_cast<BYTE*>(value), &byte_length);
-  if (result == ERROR_SUCCESS && type != REG_DWORD) {
-    // The value wasn't a DWORD.
-    result = ERROR_NOT_SUPPORTED;
-  }
-
-  return result;
-}
-
-// Checks to see if the app installer failed with a custom error and provided a
-// UI string.  If so, returns true and populates |result_string| with the UI
-// string.  Otherwise, returns false.
-bool GetLastInstallerResultUIString(const std::wstring& app_guid,
-                                    std::wstring* result_string) {
-  std::wstring client_state_name;
-  HKEY key = NULL;
-
-  GetAppClientStateKey(app_guid, &client_state_name);
-
-  // First try looking in the app's ClientState key.  Failing that, fall back to
-  // Google Update's own SOFTWARE\Google\Update key, into which GoogleUpdate.exe
-  // copies the app's value (see AppManager::ClearInstallerResultApiValues).
-  LONG result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, client_state_name.c_str(),
-                             NULL, KEY_QUERY_VALUE, &key);
-  if (result != ERROR_SUCCESS) {
-    result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, kRegKeyGoogleUpdate, NULL,
-                          KEY_QUERY_VALUE, &key);
-  }
-
-  if (result == ERROR_SUCCESS) {
-    // Is LastInstallerResult == INSTALLER_RESULT_FAILED_CUSTOM_ERROR?
-    DWORD last_installer_error = 0;
-    result = ReadRegistryDwordValue(key, kRegValueLastInstallerResult,
-                                    &last_installer_error);
-    if (result == ERROR_SUCCESS &&
-        last_installer_error == kInstallerResultFailedCustomError) {
-      result = ReadRegistryStringValue(
-          key, kRegValueLastInstallerResultUIString, result_string);
-    }
-
-    RegCloseKey(key);
-  }
-
-  return result == ERROR_SUCCESS;
-}
-
-}  // namespace
-
-// A DLL custom action entrypoint that performs the work described at the top
-// of this file.
-extern "C" UINT __stdcall ShowInstallerResultUIString(MSIHANDLE install) {
-  std::wstring app_guid;
-  std::wstring result_string;
-
-  if (GetProductGuid(install, &app_guid) &&
-      GetLastInstallerResultUIString(app_guid, &result_string) &&
-      !result_string.empty()) {
-    PMSIHANDLE record = MsiCreateRecord(0);
-    if (record != 0UL) {
-      UINT result = MsiRecordSetString(record, 0, result_string.c_str());
-      if (result == ERROR_SUCCESS)
-        MsiProcessMessage(install, INSTALLMESSAGE_ERROR, record);
-    }
-  }
-
-  return ERROR_SUCCESS;
-}
diff --git a/enterprise/installer/custom_actions/show_error_action.def b/enterprise/installer/custom_actions/show_error_action.def
deleted file mode 100644
index a5bdced..0000000
--- a/enterprise/installer/custom_actions/show_error_action.def
+++ /dev/null
@@ -1,2 +0,0 @@
-EXPORTS
-ShowInstallerResultUIString PRIVATE
diff --git a/enterprise/installer/enterprise_installer.wxs.xml b/enterprise/installer/enterprise_installer.wxs.xml
deleted file mode 100644
index 92cacfc..0000000
--- a/enterprise/installer/enterprise_installer.wxs.xml
+++ /dev/null
@@ -1,210 +0,0 @@
-<?xml version='1.0' encoding='windows-1252'?>
-<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
-  <?define CompanyFullName = 'Google, Inc.'?>
-  <?define Copyright = 'Copyright 2007-2010 Google Inc.'?>
-
-  <Product
-    Id='$(var.MsiProductId)'
-    Name='$(var.ProductName)'
-    Language='1033'
-    Codepage='1252'
-    UpgradeCode='$(var.MsiUpgradeCode)'
-    Version='$(var.ProductVersion)'
-    Manufacturer='$(var.CompanyFullName)'>
-
-    <Package
-      Id='*'
-      Description='$(var.ProductName) Installer'
-      Comments='$(var.Copyright)'
-      Manufacturer='$(var.CompanyFullName)'
-      Languages='1033'
-      SummaryCodepage='1252'
-      InstallerVersion='150'
-      InstallPrivileges='elevated'
-      Compressed='yes' />
-
-    <Upgrade Id='$(var.MsiUpgradeCode)'>
-      <UpgradeVersion Property='UPGRADING'
-                      OnlyDetect='no'
-                      Minimum='0.0.0.0' IncludeMinimum='yes'
-                      Maximum='$(var.ProductVersion)' IncludeMaximum='no' />
-      <UpgradeVersion Property='NEWERVERSIONDETECTED' 
-                      OnlyDetect='yes'
-                      Minimum='$(var.ProductVersion)' IncludeMinimum='yes' />
-    </Upgrade>
-
-    <!-- Per-machine installation - make sure product appears for all users. -->
-    <Property Id='ALLUSERS' Value='1' />
-
-    <?ifdef $(var.ProductIcon)?>
-      <!-- If var.ProductIcon is defined, use that as an icon in the ARP
-           dialog, otherwise rely on the ARP dialog's heuristics:
-           http://blogs.msdn.com/oldnewthing/archive/2004/07/09/178342.aspx -->
-      <Icon Id='icon.ico' SourceFile='$(var.ProductIcon)'/>
-      <Property Id='ARPPRODUCTICON' Value='icon.ico' />
-    <?endif?>
-
-    <!-- ARPNOMODIFY does two things:
-         1) Removes the 'Modify' button from the ARP dialog.
-         2) Causes the 'Remove' command to invoke msiexec /X instead of /I
-            (the intent being that WITH a Modify button, clicking either
-            Modify or Remove command will launch your installer UI). -->
-    <Property Id='ARPNOMODIFY' Value='1' />
-
-    <!-- Find the uninstall string to be used for the product. Only used for
-         uninstallation. -->
-    <Property Id='UNINSTALLCMDLINE'>
-      <RegistrySearch Id='UninstallCmdSearch'
-                      Root='HKLM'
-                      Type='raw'
-                      Key='Software\Google\Update\ClientState\$(var.ProductGuid)'
-                      Name='UninstallString'/>
-    </Property>
-    <Property Id='UNINSTALLCMDARGS'>
-      <RegistrySearch Id='UninstallArgSearch'
-                      Root='HKLM'
-                      Type='raw'
-                      Key='Software\Google\Update\ClientState\$(var.ProductGuid)'
-                      Name='UninstallArguments'/>
-    </Property>
-
-    <UI>
-      <Error Id='4000'>A newer version of the $(var.ProductName) enterprise installer is already installed.</Error>
-    </UI>
-
-    <!-- Eliminates "warning LGHT1076 : ICE71: The Media table has no entries."
-    -->
-    <Media Id='1' />
-
-    <Directory Id='TARGETDIR' Name='SourceDir'>
-      <Directory Id='ProgramFilesFolder'>
-      </Directory>
-    </Directory>
-
-    <Binary Id='$(var.ProductNameLegalIdentifier)Installer'
-            SourceFile='$(var.ProductInstallerPath)' />
-
-    <Binary Id='ShowInstallerResultUIStringDll'
-            SourceFile='$(var.ShowErrorCADll)' />
-
-    <Feature Id='Complete' Level='1'>
-      <ComponentRef Id='ComponentGoogleUpdate' />
-    </Feature>
-
-    <CustomAction Id='NewerVersionError' Error='4000'/>
-
-    <CustomAction Id='SetInstallerInstallCommandProperty'
-      Property='FullProductInstallerInstallCommand'
-      Value='$(var.ProductInstallerInstallCommand)'
-      Execute='immediate'
-      Return='check' />
-    <CustomAction 
-      Id='AppendDisableUpdateRegistrationArgToInstallerInstallCommandProperty'
-      Property='FullProductInstallerInstallCommand'
-      Value='[FullProductInstallerInstallCommand]
-             $(var.ProductInstallerDisableUpdateRegistrationArg)'
-      Execute='immediate'
-      Return='check' />
-    <!-- Send the ProductGuid to the ShowInstallerResultUIString custom action.
-         The value is accessed through the "CustomActionData" property from
-         within the action itself. -->
-    <CustomAction Id='SetAppGuidProperty'
-      Property='ShowInstallerResultUIString'
-      Value='$(var.ProductGuid)' />
-
-    <!-- A custom action to be executed on rollback to log and display the
-         LastInstallerResultUIString. -->
-    <CustomAction Id='ShowInstallerResultUIString'
-      BinaryKey='ShowInstallerResultUIStringDll'
-      DllEntry='ShowInstallerResultUIString'
-      Execute='rollback'
-      Impersonate='no' />
-
-    <CustomAction Id='Install$(var.ProductNameLegalIdentifier)'
-      BinaryKey='$(var.ProductNameLegalIdentifier)Installer'
-      Impersonate='no'
-      Execute='deferred'
-      ExeCommand='[FullProductInstallerInstallCommand]'
-      Return='check' />
-    <CustomAction Id='CallUninstaller.SetProperty'
-      Property='UninstallCmd'
-      Value='[UNINSTALLCMDLINE] $(var.ProductUninstallerAdditionalArgs)'
-      Execute='immediate'
-      Return='check' />
-    <CustomAction Id='CallUninstallerArgs.SetProperty'
-      Property='UninstallCmdArgs'
-      Value='[UNINSTALLCMDARGS]'
-      Execute='immediate'
-      Return='check' />
-    <CustomAction Id='CallUninstaller'
-      Property='UninstallCmd'
-      ExeCommand='[UninstallCmdArgs] $(var.ProductUninstallerAdditionalArgs)'
-      Impersonate='no'
-      Execute='deferred'
-      Return='check' />
-
-    <InstallExecuteSequence>
-      <RemoveExistingProducts After='InstallValidate' />
-
-      <Custom Action='NewerVersionError' After='FindRelatedProducts'>
-        NEWERVERSIONDETECTED
-      </Custom>
-
-      <!-- Any operations that rely on values, such as brand and usagestats, in
-           ClientState should not run until after
-           InstallGoogleUpdateAndRegister. This is sequenced before InstallFiles
-           so that can be used as well.
-           It is also advisable to write the Clients key after this point so
-           the specific values in the installer will replace the ones Google
-           Update writes as part of /registerproduct. -->
-      <!-- The app's uninstaller MUST delete the entire Clients key even if
-           values it didn't write are present. The Google Update Fragment writes
-           "pv" and "name" when it calls /registerproduct. While apps should
-           always write and cleanup "name", not all do and this can cause
-           problems.-->
-      <!-- TODO(omaha): Support Rollback? Need to determine whether Product
-           was installed before installing it and only add the rollback then.
-      <Custom Action='Rollback$(var.ProductNameLegalIdentifier)'
-              After='InstallFiles'>
-        (($ComponentGoogleUpdate>2) OR REINSTALL) AND (NOT $(var.ProductNameLegalIdentifier)_INSTALLED)
-      </Custom>
-      Change After='InstallFiles' below to
-      After='Rollback$(var.ProductNameLegalIdentifier)'. -->
-      <Custom Action='SetInstallerInstallCommandProperty'
-              After='InstallFiles'>
-        (($ComponentGoogleUpdate>2) OR REINSTALL)
-      </Custom>
-      <Custom Action='AppendDisableUpdateRegistrationArgToInstallerInstallCommandProperty'
-              After='SetInstallerInstallCommandProperty'>
-        (($ComponentGoogleUpdate>2) OR REINSTALL) AND DISABLE_UPDATES
-      </Custom>
-      <Custom Action='SetAppGuidProperty'
-              After='AppendDisableUpdateRegistrationArgToInstallerInstallCommandProperty'>
-        (($ComponentGoogleUpdate>2) OR REINSTALL)
-      </Custom>
-      <Custom Action='ShowInstallerResultUIString'
-              After='SetAppGuidProperty'>
-        (($ComponentGoogleUpdate>2) OR REINSTALL)
-      </Custom>
-      <Custom Action='Install$(var.ProductNameLegalIdentifier)'
-              After='ShowInstallerResultUIString'>
-        (($ComponentGoogleUpdate>2) OR REINSTALL)
-      </Custom>
-
-      <Custom Action='CallUninstallerArgs.SetProperty'
-              Before='CallUninstaller.SetProperty'>
-        $ComponentGoogleUpdate=2
-      </Custom>
-      <Custom Action='CallUninstaller.SetProperty'
-              Before='CallUninstaller'>
-        $ComponentGoogleUpdate=2
-      </Custom>
-      <Custom Action='CallUninstaller'
-              Before='RemoveFiles'>
-        $ComponentGoogleUpdate=2
-      </Custom>
-
-    </InstallExecuteSequence>
-
-  </Product>
-</Wix>
diff --git a/enterprise/installer/enterprise_standalone_installer.wxs.xml b/enterprise/installer/enterprise_standalone_installer.wxs.xml
deleted file mode 100644
index 2ca7d94..0000000
--- a/enterprise/installer/enterprise_standalone_installer.wxs.xml
+++ /dev/null
@@ -1,257 +0,0 @@
-<?xml version='1.0' encoding='windows-1252'?>
-<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
-  <?define CompanyFullName = 'Google, Inc.'?>
-  <?define Copyright = 'Copyright 2007-2010 Google Inc.'?>
-  <?define UpdateKeyPath = 'SOFTWARE\Google\Update' ?>
-  <?define InstallCommandBase='/silent /install "[ProductTag]" /installsource enterprisemsi'?>
-
-  <Product
-    Id='$(var.MsiProductId)'
-    Name='$(var.ProductName)'
-    Language='1033'
-    Codepage='1252'
-    UpgradeCode='$(var.MsiUpgradeCode)'
-    Version='$(var.ProductVersion)'
-    Manufacturer='$(var.CompanyFullName)'>
-
-    <Package
-      Id='*'
-      Description='$(var.ProductName) Installer'
-      Comments='$(var.Copyright)'
-      Manufacturer='$(var.CompanyFullName)'
-      Languages='1033'
-      SummaryCodepage='1252'
-      InstallerVersion='150'
-      InstallPrivileges='elevated'
-      Compressed='yes' />
-
-    <Upgrade Id='$(var.MsiUpgradeCode)'>
-      <UpgradeVersion Property='UPGRADING'
-                      OnlyDetect='no'
-                      Minimum='0.0.0.0' IncludeMinimum='yes'
-                      Maximum='$(var.ProductVersion)' IncludeMaximum='no' />
-      <UpgradeVersion Property='NEWERVERSIONDETECTED' 
-                      OnlyDetect='yes'
-                      Minimum='$(var.ProductVersion)' IncludeMinimum='yes' />
-    </Upgrade>
-
-    <!-- Per-machine installation - make sure product appears for all users. -->
-    <Property Id='ALLUSERS' Value='1' />
-
-    <?ifdef ProductIcon ?>
-      <!-- If var.ProductIcon is defined, use that as an icon in the ARP
-           dialog, otherwise rely on the ARP dialog's heuristics:
-           http://blogs.msdn.com/oldnewthing/archive/2004/07/09/178342.aspx -->
-      <Icon Id='icon.ico' SourceFile='$(var.ProductIcon)'/>
-      <Property Id='ARPPRODUCTICON' Value='icon.ico' />
-    <?endif?>
-
-    <!-- ARPNOMODIFY does two things:
-         1) Removes the 'Modify' button from the ARP dialog.
-         2) Causes the 'Remove' command to invoke msiexec /X instead of /I
-            (the intent being that WITH a Modify button, clicking either
-            Modify or Remove command will launch your installer UI). -->
-    <Property Id='ARPNOMODIFY' Value='1' />
-
-    <!-- Find the uninstall string to be used for the product. Only used for
-         uninstallation. -->
-    <Property Id='UNINSTALLCMDLINE'>
-      <RegistrySearch Id='UninstallCmdSearch'
-                      Root='HKLM'
-                      Type='raw'
-                      Key='Software\Google\Update\ClientState\$(var.ProductGuid)'
-                      Name='UninstallString'/>
-    </Property>
-    <Property Id='UNINSTALLCMDARGS'>
-      <RegistrySearch Id='UninstallArgSearch'
-                      Root='HKLM'
-                      Type='raw'
-                      Key='Software\Google\Update\ClientState\$(var.ProductGuid)'
-                      Name='UninstallArguments'/>
-    </Property>
-
-    <UI>
-      <Error Id='4000'>A newer version of the $(var.ProductName) enterprise installer is already installed.</Error>
-    </UI>
-
-    <!-- Eliminates "warning LGHT1076 : ICE71: The Media table has no entries."
-    -->
-    <Media Id='1' />
-
-    <Directory Id='TARGETDIR' Name='SourceDir'>
-      <Directory Id='ProgramFilesFolder'>
-        <Directory Id='GoogleProgramDir' Name='Google'>
-          <Directory Id='UpdateDir' Name='Update'>
-
-            <Component Id='ProductClientState'
-                       Guid='6B528A57-0CD8-4b26-85F8-1CA05523B8F1'>
-              <!-- Clear the last UI string before running the installer so we know
-                   that any value present upon rollback is fresh. -->
-              <RemoveRegistryValue Key='$(var.UpdateKeyPath)\ClientState\$(var.ProductGuid)'
-                                   Name='LastInstallerResultUIString'
-                                   Root='HKLM' />
-              <RemoveRegistryValue Key='$(var.UpdateKeyPath)'
-                                   Name='LastInstallerResultUIString'
-                                   Root='HKLM' />
-              <RegistryValue Id='NonEmptyComponent' Action='write'
-                             Root='HKLM'
-                             Key='$(var.UpdateKeyPath)\ClientState\$(var.ProductGuid)'
-                             Name='EnterpriseInstall' Type='string' Value='$(var.ProductVersion)' />
-            </Component>
-
-          </Directory>
-        </Directory>
-      </Directory>
-    </Directory>
-
-    <Feature Id='Complete' Level='1'>
-      <ComponentRef Id='ProductClientState' />
-    </Feature>
-
-    <!--TODO(omaha): Add "Standalone" after fixing the ProductName issue
-        in standalone_installer.py.-->
-    <Binary Id='$(var.ProductNameLegalIdentifier)Installer'
-            SourceFile='$(var.StandaloneInstallerPath)' />
-
-    <Binary Id='ShowInstallerResultUIStringDll'
-            SourceFile='$(var.ShowErrorCADll)' />
-
-    <CustomAction Id='NewerVersionError' Error='4000'/>
-
-    <CustomAction Id='SetProductTagProperty'
-      Property='ProductTag'
-      Value='appguid=$(var.ProductGuid)&amp;appname=$(var.ProductName)&amp;needsAdmin=True'
-      Execute='immediate'
-      Return='check' />
-    <CustomAction Id='AppendCustomParamsToProductTagProperty'
-      Property='ProductTag'
-      Value='[ProductTag]$(var.ProductCustomParams)'
-      Execute='immediate'
-      Return='check' />
-    <CustomAction Id='AppendBrandToProductTagProperty'
-      Property='ProductTag'
-      Value='[ProductTag]&amp;brand=[BRAND]'
-      Execute='immediate'
-      Return='check' />
-
-    <?ifdef ProductInstallerData ?>
-        <CustomAction Id='BuildInstallCommand'
-                      Property='InstallCommand'
-                      Value='$(var.InstallCommandBase) /appargs "appguid=$(var.ProductGuid)&amp;installerdata=$(var.ProductInstallerData)"'
-                      Execute='immediate'
-                      Return='check' />
-    <?else?>
-        <CustomAction Id='BuildInstallCommand'
-                      Property='InstallCommand'
-                      Value='$(var.InstallCommandBase)'
-                      Execute='immediate'
-                      Return='check' />
-    <?endif?>
-
-    <!-- Send the ProductGuid to the ShowInstallerResultUIString custom action.
-         The value is accessed through the "CustomActionData" property from
-         within the action itself. -->
-    <CustomAction Id='SetAppGuidProperty'
-      Property='ShowInstallerResultUIString'
-      Value='$(var.ProductGuid)' />
-
-    <!-- A custom action to be executed on rollback to log and display the
-         LastInstallerResultUIString. -->
-    <CustomAction Id='ShowInstallerResultUIString'
-      BinaryKey='ShowInstallerResultUIStringDll'
-      DllEntry='ShowInstallerResultUIString'
-      Execute='rollback'
-      Impersonate='no' />
-
-    <CustomAction Id='DoInstall'
-      BinaryKey='$(var.ProductNameLegalIdentifier)Installer'
-      Impersonate='no'
-      Execute='deferred'
-      ExeCommand='[InstallCommand]'
-      Return='check' />
-    <CustomAction Id='CallUninstaller.SetProperty'
-      Property='UninstallCmd'
-      Value='[UNINSTALLCMDLINE]'
-      Execute='immediate'
-      Return='check' />
-    <CustomAction Id='CallUninstallerArgs.SetProperty'
-      Property='UninstallCmdArgs'
-      Value='[UNINSTALLCMDARGS]'
-      Execute='immediate'
-      Return='check' />
-    <CustomAction Id='CallUninstaller'
-      Property='UninstallCmd'
-      ExeCommand='[UninstallCmdArgs] $(var.ProductUninstallerAdditionalArgs)'
-      Impersonate='no'
-      Execute='deferred'
-      Return='check' />
-
-    <InstallExecuteSequence>
-      <RemoveExistingProducts After='InstallValidate' />
-
-      <Custom Action='NewerVersionError' After='FindRelatedProducts'>
-        NEWERVERSIONDETECTED
-      </Custom>
-
-      <!-- Build tag property. -->
-      <Custom Action='SetProductTagProperty'
-              Before='AppendCustomParamsToProductTagProperty'>
-        (($ProductClientState>2) OR REINSTALL)
-      </Custom>
-      <Custom Action='AppendCustomParamsToProductTagProperty'
-              Before='AppendBrandToProductTagProperty'>
-        (($ProductClientState>2) OR REINSTALL)
-      </Custom>
-      <Custom Action='AppendBrandToProductTagProperty'
-              Before='BuildInstallCommand'>
-        (($ProductClientState>2) OR REINSTALL) AND (BRAND &lt;&gt; "")
-      </Custom>
-      <Custom Action='BuildInstallCommand'
-              Before='SetAppGuidProperty'>
-        (($ProductClientState>2) OR REINSTALL)
-      </Custom>
-      <Custom Action='SetAppGuidProperty'
-              Before='ShowInstallerResultUIString'>
-        (($ProductClientState>2) OR REINSTALL)
-      </Custom>
-      <Custom Action='ShowInstallerResultUIString'
-              Before='DoInstall'>
-        (($ProductClientState>2) OR REINSTALL)
-      </Custom>
-
-      <!-- TODO(omaha): Support Rollback? I do not think so because there are
-           very few cases where the app could be installed but Omaha would
-           report a failure. If we support rollback, need to determine whether
-           Product was installed before and only add the rollback then.
-      <Custom Action='Rollback$(var.ProductNameLegalIdentifier)'
-              After='InstallFiles'>
-        (($ProductClientState>2) OR REINSTALL) AND (NOT $(var.ProductNameLegalIdentifier)_INSTALLED)
-      </Custom>
-      Change After='InstallFiles' below to
-      After='Rollback$(var.ProductNameLegalIdentifier)'. -->
-
-      <Custom Action='DoInstall'
-              After='InstallFiles'>
-        (($ProductClientState>2) OR REINSTALL)
-      </Custom>
-
-      <Custom Action='CallUninstallerArgs.SetProperty'
-              Before='CallUninstaller.SetProperty'>
-        $ProductClientState=2
-      </Custom>
-      <Custom Action='CallUninstaller.SetProperty'
-              Before='CallUninstaller'>
-        $ProductClientState=2
-      </Custom>
-      <Custom Action='CallUninstaller'
-              Before='RemoveFiles'>
-        $ProductClientState=2
-      </Custom>
-
-      <!-- Google Update will uninstall itself if the product is the only app it
-           so no need to have an uninstall operation. -->
-
-    </InstallExecuteSequence>
-
-  </Product>
-</Wix>
diff --git a/enterprise/installer/google_update_installer_fragment.wxs.xml b/enterprise/installer/google_update_installer_fragment.wxs.xml
deleted file mode 100644
index 72f019f..0000000
--- a/enterprise/installer/google_update_installer_fragment.wxs.xml
+++ /dev/null
@@ -1,125 +0,0 @@
-<?xml version='1.0' encoding='windows-1252'?>
-<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
-  <?define UpdateKeyPath = 'SOFTWARE\Google\Update' ?>
-
-  <!-- This fragment assumes machine install (ALLUSER=1). -->
-
-  <Fragment Id='FragmentGoogleUpdate' >
-    <!-- Detect whether product is already registered with Google Update. -->
-    <Property Id='PRODUCT_REGISTERED_VERSION'>
-      <RegistrySearch Id='$(var.ProductNameLegalIdentifier)RegistrationSearch'
-                      Root='HKLM'
-                      Key='$(var.UpdateKeyPath)\Clients\$(var.ProductGuid)'
-                      Name='pv' Type='raw' />
-    </Property>
-
-    <Binary Id='GoogleUpdateSetup'
-            SourceFile='$(var.GoogleUpdateMetainstallerPath)' />
-
-    <!-- This fragment needs a component that can be referenced.
-         Components must be in Directory[Ref] elements and cannot be empty.
-         Thus, we have a registry value write that has no effect.
-         To avoid multiple Directory elements with the 'ProgramFilesFolder' Id,
-         assume that the product MSI has defined a it and reference it here. -->
-    <DirectoryRef Id='ProgramFilesFolder'>
-      <Directory Id='GoogleProgramDir' Name='Google'>
-        <Directory Id='UpdateDir' Name='Update'>
-
-          <Component Id='ComponentGoogleUpdate'
-                     Guid='6B528A57-0CD8-4b26-85F8-1CA05523B8F1'>
-            <!-- Clear the last UI string before running the installer so we know
-                 that any value present upon rollback is fresh. -->
-            <RemoveRegistryValue Key='$(var.UpdateKeyPath)\ClientState\$(var.ProductGuid)'
-                                 Name='LastInstallerResultUIString'
-                                 Root='HKLM' />
-            <RemoveRegistryValue Key='$(var.UpdateKeyPath)'
-                                 Name='LastInstallerResultUIString'
-                                 Root='HKLM' />
-            <?ifdef UsingGoogleUpdate_1_2_171_OrLater?>
-            <RegistryValue Id='NonEmptyComponent' Action='write'
-                           Root='HKLM'
-                           Key='$(var.UpdateKeyPath)\ClientState\$(var.ProductGuid)'
-                           Name='EnterpriseInstall' Type='string' Value='$(var.ProductVersion)' />
-            <?else?>
-            <RegistryValue Id='NonEmptyComponent' Action='write'
-                           Root='HKLM'
-                           Key='$(var.UpdateKeyPath)\ClientState\$(var.ProductGuid)'
-                           Name='EnterpriseInstall' Type='integer' Value='1' />
-            <?endif?>
-          </Component>
-
-        </Directory>
-      </Directory>
-    </DirectoryRef>
-
-    <CustomAction Id='SetProductTagProperty'
-      Property='ProductTag'
-      Value='appguid=$(var.ProductGuid)&amp;appname=$(var.ProductName)&amp;needsAdmin=True'
-      Execute='immediate'
-      Return='check' />
-    <CustomAction Id='AppendCustomParamsToProductTagProperty'
-      Property='ProductTag'
-      Value='[ProductTag]$(var.ProductCustomParams)'
-      Execute='immediate'
-      Return='check' />
-    <CustomAction Id='AppendBrandToProductTagProperty'
-      Property='ProductTag'
-      Value='[ProductTag]&amp;brand=[BRAND]'
-      Execute='immediate'
-      Return='check' />
-    <CustomAction Id='RollbackGoogleUpdateRegistration'
-      BinaryKey='GoogleUpdateSetup'
-      Impersonate='no'
-      Execute='rollback'
-      ExeCommand='/unregisterproduct "[ProductTag]"'
-      Return='check' />
-    <!-- TODO(omaha): If /registerproduct is deprecated in favor of an
-         "install Omaha only" switch, we might need to update this fragment to
-         write the pv value to the product's ClientState. Otherwise, Omaha
-         might uninstall itself before the product's normal install flow writes
-         these values. -->
-    <CustomAction Id='InstallGoogleUpdateAndRegister'
-      BinaryKey='GoogleUpdateSetup'
-      Impersonate='no'
-      Execute='deferred'
-      ExeCommand='/registerproduct "[ProductTag]" /installsource enterprisemsi'
-      Return='check' />
-
-    <InstallExecuteSequence>
-      <!-- Build tag property. -->
-      <Custom Action='SetProductTagProperty'
-              Before='AppendCustomParamsToProductTagProperty'>
-        (($ComponentGoogleUpdate>2) OR REINSTALL) AND (NOT DISABLE_UPDATES)
-      </Custom>
-      <Custom Action='AppendCustomParamsToProductTagProperty'
-              Before='AppendBrandToProductTagProperty'>
-        (($ComponentGoogleUpdate>2) OR REINSTALL) AND (NOT DISABLE_UPDATES)
-      </Custom>
-      <Custom Action='AppendBrandToProductTagProperty'
-              Before='RollbackGoogleUpdateRegistration'>
-        (($ComponentGoogleUpdate>2) OR REINSTALL) AND (NOT DISABLE_UPDATES) AND (BRAND &lt;&gt; "")
-      </Custom>
-
-      <!-- Install Google Update before 'InstallFiles' so that brand, etc. will
-           be present when the product is installed. -->
-      <Custom Action='RollbackGoogleUpdateRegistration'
-              Before='InstallGoogleUpdateAndRegister'
-              >
-        (($ComponentGoogleUpdate>2) OR REINSTALL) AND (NOT DISABLE_UPDATES) AND (PRODUCT_REGISTERED_VERSION = "")
-      </Custom>
-      <Custom Action='InstallGoogleUpdateAndRegister'
-              Before='InstallFiles'>
-        (($ComponentGoogleUpdate>2) OR REINSTALL) AND (NOT DISABLE_UPDATES)
-      </Custom>
-
-      <!-- Google Update will uninstall itself if the product is the only
-           registered product, so no need to have an uninstall operation.
-           Uninstall actions would not run when expected anyway if Omaha updates
-           the product using a normal MSI installer (without this fragment).
-           Information about this installer would be lost. Also, the uninstall
-           action might run during the first update.-->
-
-    </InstallExecuteSequence>
-
-  </Fragment>
-</Wix>
diff --git a/enterprise/installer/test/build.scons b/enterprise/installer/test/build.scons
deleted file mode 100644
index c618828..0000000
--- a/enterprise/installer/test/build.scons
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2011 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-""" Build enterprise installer test.
-"""
-
-Import('env')
-
-from standalone import standalone_installer
-
-# Build test_setup.exe
-test_setup_env = env.Clone()
-
-test_setup_env.Append(
-    LIBS = [
-        ('msvcrt', 'libcmtd')[test_setup_env.Bit('debug')],
-        ('msvcprt', 'libcpmtd')[test_setup_env.Bit('debug')],
-        ],
-)
-
-test_setup_env.FilterOut(
-    CPPDEFINES=['_WINDOWS'],
-    LINKFLAGS=['/SUBSYSTEM:WINDOWS'],
-)
-test_setup_env.Append(
-    CPPDEFINES=['_CONSOLE'],
-    LINKFLAGS=['/SUBSYSTEM:CONSOLE'],
-)
-
-target_name = 'test_setup'
-
-exe_inputs = [
-    'test_setup.cc',
-    ]
-
-test_setup_env.ComponentProgram(
-    prog_name = target_name,
-    source = exe_inputs,
-)
-
-# Build standalone and enterprise installers for test_setup using each version.
-for omaha_version_info in env['omaha_versions_info']:
-  prefix = omaha_version_info.filename_prefix
-
-  source_binary = '$OBJ_ROOT/mi_exe_stub/%smi_exe_stub.exe' % (prefix)
-
-  standalone_installer.BuildOfflineInstallersVersion(
-      env,
-      omaha_version_info,
-      '$STAGING_DIR',
-      source_binary,
-      '$MAIN_DIR/enterprise/installer/test/standalone_installers.txt',
-      '$MAIN_DIR/enterprise/installer/test',
-      prefix)
diff --git a/enterprise/installer/test/standalone_installers.txt b/enterprise/installer/test/standalone_installers.txt
deleted file mode 100644
index 1820fcf..0000000
--- a/enterprise/installer/test/standalone_installers.txt
+++ /dev/null
@@ -1 +0,0 @@
-('Failing Enterprise Test', 'TestStandaloneFailure', [('1.0.0.0', '$STAGING_DIR/test_setup.exe', '{665BDD8E-F40C-4384-A9C6-CA3CD5665C83}')], 'TestStandaloneFailureEnterprise', '', '/uninstall', True, '', '' )
diff --git a/enterprise/installer/test/test_setup.cc b/enterprise/installer/test/test_setup.cc
deleted file mode 100644
index bc193d9..0000000
--- a/enterprise/installer/test/test_setup.cc
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Author: grt
-//
-// A dummy app installer that does nothing more than write error information to
-// the registry as per the Google Update Installer Result API and return 1.
-
-#include <windows.h>
-
-#define GOOGLE_UPDATE_KEY L"SOFTWARE\\Google\\Update"
-#define TEST_SETUP_APP_GUID L"{665BDD8E-F40C-4384-A9C6-CA3CD5665C83}"
-
-namespace {
-
-const DWORD kInstallerResultFailedCustomError = 1;
-const wchar_t kErrorString[] = L"This is a detailed error message.";
-const wchar_t kRegClientStateKey[] =
-    GOOGLE_UPDATE_KEY L"\\ClientState\\" TEST_SETUP_APP_GUID;
-const wchar_t kRegInstallerResultValue[] = L"InstallerResult";
-const wchar_t kRegInstallerResultUIStringValue[] = L"InstallerResultUIString";
-
-void WriteFailureValues() {
-  HKEY client_state_key;
-  LONG result = RegCreateKeyEx(HKEY_LOCAL_MACHINE, kRegClientStateKey, 0, NULL,
-                               REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL,
-                               &client_state_key, NULL);
-  if (result == ERROR_SUCCESS) {
-    RegSetValueEx(
-        client_state_key, kRegInstallerResultValue, 0, REG_DWORD,
-        reinterpret_cast<const BYTE*>(&kInstallerResultFailedCustomError),
-        sizeof(kInstallerResultFailedCustomError));
-    RegSetValueEx(
-        client_state_key, kRegInstallerResultUIStringValue, 0, REG_SZ,
-        reinterpret_cast<const BYTE*>(&kErrorString),
-        sizeof(kErrorString));
-    RegCloseKey(client_state_key);
-  }
-}
-
-}  // namespace
-
-int wmain(int argc, wchar_t* argv[]) {
-  WriteFailureValues();
-  return 1;
-}
diff --git "a/enterprise/installer/test/\173665BDD8E-F40C-4384-A9C6-CA3CD5665C83\175.gup" "b/enterprise/installer/test/\173665BDD8E-F40C-4384-A9C6-CA3CD5665C83\175.gup"
deleted file mode 100644
index 1316f7e..0000000
--- "a/enterprise/installer/test/\173665BDD8E-F40C-4384-A9C6-CA3CD5665C83\175.gup"
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<response protocol="3.0">
-  <app appid="{665BDD8E-F40C-4384-A9C6-CA3CD5665C83}" status="ok">
-    <updatecheck status="ok">
-      <urls>
-        <url codebase="http://dl.google.com/edgedl/chrome/install/${INSTALLER_VERSION}/"/>
-      </urls>
-      <manifest version="${INSTALLER_VERSION}">
-        <packages>
-          <package name="test_setup.exe" hash="${INSTALLER_HASH}" size="${INSTALLER_SIZE}" required="true"/>
-        </packages>
-        <actions>
-          <action event="install" run="test_setup.exe" arguments="" needsadmin="false"/>
-          <action event="postinstall" onsuccess="exitsilentlyonlaunchcmd"/>
-        </actions>
-      </manifest>
-    </updatecheck>
-  </app>
-</response>
diff --git a/enterprise/test_gold.adm b/enterprise/test_gold.adm
deleted file mode 100644
index 2f3fc22..0000000
--- a/enterprise/test_gold.adm
+++ /dev/null
Binary files differ
diff --git a/google_update/GoogleUpdate.manifest b/google_update/GoogleUpdate.manifest
deleted file mode 100644
index a803afb..0000000
--- a/google_update/GoogleUpdate.manifest
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
-  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
-    <security>
-      <requestedPrivileges>
-        <requestedExecutionLevel level="asInvoker" />
-      </requestedPrivileges>
-    </security>
-  </trustInfo>
-  <dependency>
-    <dependentAssembly>
-        <assemblyIdentity
-            type="win32"
-            name="Microsoft.Windows.Common-Controls"
-            version="6.0.0.0"
-            processorArchitecture="X86"
-            publicKeyToken="6595b64144ccf1df"
-            language="*"
-        />
-    </dependentAssembly>
-  </dependency>
-  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
-    <application>
-      <!--The ID below indicates application support for Windows Vista -->
-      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
-      <!--The ID below indicates application support for Windows 7 -->
-      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
-    </application>
-  </compatibility>
-</assembly>
diff --git a/google_update/bin/Readme.txt b/google_update/bin/Readme.txt
deleted file mode 100644
index b30b79f..0000000
--- a/google_update/bin/Readme.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-This directory contains the saved "constant" version of the GoogleUpdate.exe
-shell. Using the same executable avoids firewall prompts in some cases when
-updating Google Update.
-
-This shell can only be used with goopdate.dll files that have been signed with
-the real certificate.
-
-When updating the shell, also change the expected version in
-..\google_update_unittest.cc.
diff --git a/google_update/bin/dbg/GoogleUpdate.exe b/google_update/bin/dbg/GoogleUpdate.exe
deleted file mode 100644
index c2b19ab..0000000
--- a/google_update/bin/dbg/GoogleUpdate.exe
+++ /dev/null
Binary files differ
diff --git a/google_update/bin/dbg/GoogleUpdate_unsigned.pdb b/google_update/bin/dbg/GoogleUpdate_unsigned.pdb
deleted file mode 100644
index c724477..0000000
--- a/google_update/bin/dbg/GoogleUpdate_unsigned.pdb
+++ /dev/null
Binary files differ
diff --git a/google_update/bin/opt/GoogleUpdate.exe b/google_update/bin/opt/GoogleUpdate.exe
deleted file mode 100644
index 1105e67..0000000
--- a/google_update/bin/opt/GoogleUpdate.exe
+++ /dev/null
Binary files differ
diff --git a/google_update/bin/opt/GoogleUpdate_unsigned.pdb b/google_update/bin/opt/GoogleUpdate_unsigned.pdb
deleted file mode 100644
index dc5f5d8..0000000
--- a/google_update/bin/opt/GoogleUpdate_unsigned.pdb
+++ /dev/null
Binary files differ
diff --git a/google_update/build.scons b/google_update/build.scons
deleted file mode 100644
index 77a6ee0..0000000
--- a/google_update/build.scons
+++ /dev/null
@@ -1,144 +0,0 @@
-#!/usr/bin/python2.4
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-# We always build the shell as GoogleUpdate_signed.exe.
-# For official builds, we copy the saved constant shell to the output directory.
-# For unofficial builds, we copy the built shell.
-# Otherwise, the goopdate.dll certificate check fails.
-#
-# Changes to this executable will not appear in offical builds until they are
-# included in an offical build and the resulting file is checked in to the
-# saved constant shell location.
-
-
-import omaha_version_utils
-
-Import('env')
-
-exe_env = env.Clone()
-
-# Only build the first version. We don't need a test version.
-omaha_version_info = exe_env['omaha_versions_info'][0]
-
-# The shell contains languages not supported by the rest of Omaha.
-# This is intended to allow us to add languages in the future without releasing
-# a new shell.
-shell_languages = omaha_version_utils.GetShellLanguagesForVersion(
-    omaha_version_info.GetVersion())
-
-# TODO(omaha): While there is a precompile.h, it does not actually use PCH.
-exe_env.Append(
-    CCFLAGS = [
-        '/wd4548',
-        '/wd4917',
-        '/wd4265',
-        '/FIgoogle_update/precompile.h',
-        ],
-    LIBS = [
-        'delayimp.lib',
-        'advapi32.lib',
-        'crypt32.lib',
-        'kernel32.lib',
-        'ole32.lib',
-        'shell32.lib',
-        'shlwapi.lib',
-        'user32.lib',
-        'wintrust.lib',
-        ('atls.lib', 'atlsd.lib')[exe_env.Bit('debug')],
-        ('libcmt.lib', 'libcmtd.lib')[exe_env.Bit('debug')],
-        ('libcpmt.lib', 'libcpmtd.lib')[exe_env.Bit('debug')],
-        ],
-    LINKFLAGS = [
-        '/NODEFAULTLIB',
-        '/MERGE:.rdata=.text'
-        '/DELAYLOAD:advapi32.dll',
-        '/DELAYLOAD:crypt32.dll',
-        '/DELAYLOAD:shell32.dll',
-        '/DELAYLOAD:shlwapi.dll',
-        '/DELAYLOAD:user32.dll',
-        '/DELAYLOAD:wintrust.dll',
-
-        # Forces the dependency on ole32.lib.
-        '/INCLUDE:_CoCreateGuid@4',
-        ],
-    RCFLAGS = [
-        '/DVERSION_MAJOR=%d' % omaha_version_info.version_major,
-        '/DVERSION_MINOR=%d' % omaha_version_info.version_minor,
-        '/DVERSION_BUILD=%d' % omaha_version_info.version_build,
-        '/DVERSION_PATCH=%d' % omaha_version_info.version_patch,
-        '/DVERSION_NUMBER_STRING=\\"%s\\"' % (
-            omaha_version_info.GetVersionString()),
-        ],
-)
-
-
-exe_inputs = [
-    'winmain.cc',
-     '../base/signaturevalidator.cc',
-     exe_env.RES('resource.rc'),
-     ]
-
-# Compile .rc files, then add the resulting .res files to the exe inputs.
-for language in shell_languages:
-  exe_inputs += exe_env.RES('generated_resources_%s.rc' % language)
-
-# Force a rebuild when the version changes. The en file should be enough to
-# rebuild all languages.
-Depends(exe_env['OBJ_ROOT'] + '/google_update/generated_resources_en.res',
-    exe_env['MAIN_DIR'] + '/VERSION')
-
-# Need to add custom suffix to avoid target conflict with
-# common/signaturevalidator.obj
-exe_env['OBJSUFFIX'] = '_gu' + exe_env['OBJSUFFIX']
-
-
-# We disable runtime stack check to avoid increasing the code size.
-# There is a compiler pragma to programmatically disable the stack checks
-# but for some reason it did not work.
-exe_env.FilterOut(CPPFLAGS = ['/GS'])
-
-# Disable stack checks for VC80. Stack checks are on by default.
-if exe_env['msc_ver'] >= 1400:
-  exe_env['CCFLAGS'] += ['/GS-']
-
-unsigned_exe_output = exe_env.ComponentProgram(
-    prog_name='GoogleUpdate_unsigned',
-    source=exe_inputs,
-)
-
-sign_output = env.SignedBinary(
-    target='GoogleUpdate_signed.exe',
-    source=unsigned_exe_output,
-)
-
-env.Replicate('$STAGING_DIR', sign_output)
-
-# Official builds should always use the checked in constant shell unless they
-# are being built with the test certificate, in which case the saved constant
-# shell would fail to validate the certificates in the build.
-if env.Bit('build_server') and not env.Bit('test_certificate'):
-  # Copy the constant shell from its checked in location.
-  source_shell = ('$MAIN_DIR/google_update/bin/%s/GoogleUpdate.exe' %
-      ('opt', 'dbg')[env.Bit('debug')])
-else:
-  # Use the version we just built.
-  source_shell = sign_output[0]
-
-env.Replicate('$STAGING_DIR', source_shell, REPLICATE_REPLACE=[('_signed', '')])
-env.Replicate(target='$STAGING_DIR',
-              source=sign_output[0],
-              REPLICATE_REPLACE=[('GoogleUpdate_signed', env['omaha_versions_info'][0].crash_handler_filename)]
-)
diff --git a/google_update/generated_resources_am.rc b/google_update/generated_resources_am.rc
deleted file mode 100644
index 412496c..0000000
--- a/google_update/generated_resources_am.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_ar.rc b/google_update/generated_resources_ar.rc
deleted file mode 100644
index 6b78c4c..0000000
--- a/google_update/generated_resources_ar.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_bg.rc b/google_update/generated_resources_bg.rc
deleted file mode 100644
index e4f5988..0000000
--- a/google_update/generated_resources_bg.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_bn.rc b/google_update/generated_resources_bn.rc
deleted file mode 100644
index aacd0a7..0000000
--- a/google_update/generated_resources_bn.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_ca.rc b/google_update/generated_resources_ca.rc
deleted file mode 100644
index b0349bc..0000000
--- a/google_update/generated_resources_ca.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_cs.rc b/google_update/generated_resources_cs.rc
deleted file mode 100644
index d3cb1b2..0000000
--- a/google_update/generated_resources_cs.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_da.rc b/google_update/generated_resources_da.rc
deleted file mode 100644
index 55bbcfa..0000000
--- a/google_update/generated_resources_da.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_de.rc b/google_update/generated_resources_de.rc
deleted file mode 100644
index 2815dfb..0000000
--- a/google_update/generated_resources_de.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_el.rc b/google_update/generated_resources_el.rc
deleted file mode 100644
index f6e86bf..0000000
--- a/google_update/generated_resources_el.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_en-GB.rc b/google_update/generated_resources_en-GB.rc
deleted file mode 100644
index 6f1f74c..0000000
--- a/google_update/generated_resources_en-GB.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_en.rc b/google_update/generated_resources_en.rc
deleted file mode 100644
index 0afd082..0000000
--- a/google_update/generated_resources_en.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_es-419.rc b/google_update/generated_resources_es-419.rc
deleted file mode 100644
index 6198aa0..0000000
--- a/google_update/generated_resources_es-419.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_es.rc b/google_update/generated_resources_es.rc
deleted file mode 100644
index d17e4a4..0000000
--- a/google_update/generated_resources_es.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_et.rc b/google_update/generated_resources_et.rc
deleted file mode 100644
index f0609f3..0000000
--- a/google_update/generated_resources_et.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_fa.rc b/google_update/generated_resources_fa.rc
deleted file mode 100644
index c55304b..0000000
--- a/google_update/generated_resources_fa.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_fi.rc b/google_update/generated_resources_fi.rc
deleted file mode 100644
index 430c736..0000000
--- a/google_update/generated_resources_fi.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_fil.rc b/google_update/generated_resources_fil.rc
deleted file mode 100644
index 0acfcc0..0000000
--- a/google_update/generated_resources_fil.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_fr.rc b/google_update/generated_resources_fr.rc
deleted file mode 100644
index 4caaa81..0000000
--- a/google_update/generated_resources_fr.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_gu.rc b/google_update/generated_resources_gu.rc
deleted file mode 100644
index d992a2d..0000000
--- a/google_update/generated_resources_gu.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_hi.rc b/google_update/generated_resources_hi.rc
deleted file mode 100644
index 35fc8b8..0000000
--- a/google_update/generated_resources_hi.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_hr.rc b/google_update/generated_resources_hr.rc
deleted file mode 100644
index 034b30f..0000000
--- a/google_update/generated_resources_hr.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_hu.rc b/google_update/generated_resources_hu.rc
deleted file mode 100644
index 1a0bcf1..0000000
--- a/google_update/generated_resources_hu.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_id.rc b/google_update/generated_resources_id.rc
deleted file mode 100644
index 70c62a8..0000000
--- a/google_update/generated_resources_id.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_is.rc b/google_update/generated_resources_is.rc
deleted file mode 100644
index 76a3420..0000000
--- a/google_update/generated_resources_is.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_it.rc b/google_update/generated_resources_it.rc
deleted file mode 100644
index bbf06e4..0000000
--- a/google_update/generated_resources_it.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_iw.rc b/google_update/generated_resources_iw.rc
deleted file mode 100644
index b0da73d..0000000
--- a/google_update/generated_resources_iw.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_ja.rc b/google_update/generated_resources_ja.rc
deleted file mode 100644
index 02c64ba..0000000
--- a/google_update/generated_resources_ja.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_kn.rc b/google_update/generated_resources_kn.rc
deleted file mode 100644
index 67de798..0000000
--- a/google_update/generated_resources_kn.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_ko.rc b/google_update/generated_resources_ko.rc
deleted file mode 100644
index 6269452..0000000
--- a/google_update/generated_resources_ko.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_lt.rc b/google_update/generated_resources_lt.rc
deleted file mode 100644
index 2612bae..0000000
--- a/google_update/generated_resources_lt.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_lv.rc b/google_update/generated_resources_lv.rc
deleted file mode 100644
index 943f5ad..0000000
--- a/google_update/generated_resources_lv.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_ml.rc b/google_update/generated_resources_ml.rc
deleted file mode 100644
index b702ce6..0000000
--- a/google_update/generated_resources_ml.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_mr.rc b/google_update/generated_resources_mr.rc
deleted file mode 100644
index b8bf1a5..0000000
--- a/google_update/generated_resources_mr.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_ms.rc b/google_update/generated_resources_ms.rc
deleted file mode 100644
index 541c703..0000000
--- a/google_update/generated_resources_ms.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_nl.rc b/google_update/generated_resources_nl.rc
deleted file mode 100644
index 2bb60b7..0000000
--- a/google_update/generated_resources_nl.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_no.rc b/google_update/generated_resources_no.rc
deleted file mode 100644
index 06f98b4..0000000
--- a/google_update/generated_resources_no.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_or.rc b/google_update/generated_resources_or.rc
deleted file mode 100644
index 88242e9..0000000
--- a/google_update/generated_resources_or.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_pl.rc b/google_update/generated_resources_pl.rc
deleted file mode 100644
index 0193115..0000000
--- a/google_update/generated_resources_pl.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_pt-BR.rc b/google_update/generated_resources_pt-BR.rc
deleted file mode 100644
index b9c1aef..0000000
--- a/google_update/generated_resources_pt-BR.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_pt-PT.rc b/google_update/generated_resources_pt-PT.rc
deleted file mode 100644
index df6b223..0000000
--- a/google_update/generated_resources_pt-PT.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_ro.rc b/google_update/generated_resources_ro.rc
deleted file mode 100644
index e8ccc74..0000000
--- a/google_update/generated_resources_ro.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_ru.rc b/google_update/generated_resources_ru.rc
deleted file mode 100644
index d2bd899..0000000
--- a/google_update/generated_resources_ru.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_sk.rc b/google_update/generated_resources_sk.rc
deleted file mode 100644
index 4f02548..0000000
--- a/google_update/generated_resources_sk.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_sl.rc b/google_update/generated_resources_sl.rc
deleted file mode 100644
index be44431..0000000
--- a/google_update/generated_resources_sl.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_sr.rc b/google_update/generated_resources_sr.rc
deleted file mode 100644
index 890cd3c..0000000
--- a/google_update/generated_resources_sr.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_sv.rc b/google_update/generated_resources_sv.rc
deleted file mode 100644
index fb1beef..0000000
--- a/google_update/generated_resources_sv.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_sw.rc b/google_update/generated_resources_sw.rc
deleted file mode 100644
index ebe51b1..0000000
--- a/google_update/generated_resources_sw.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_ta.rc b/google_update/generated_resources_ta.rc
deleted file mode 100644
index f8ad2b2..0000000
--- a/google_update/generated_resources_ta.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_te.rc b/google_update/generated_resources_te.rc
deleted file mode 100644
index 7fcf7ed..0000000
--- a/google_update/generated_resources_te.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_th.rc b/google_update/generated_resources_th.rc
deleted file mode 100644
index 4f75099..0000000
--- a/google_update/generated_resources_th.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_tr.rc b/google_update/generated_resources_tr.rc
deleted file mode 100644
index da5234b..0000000
--- a/google_update/generated_resources_tr.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_uk.rc b/google_update/generated_resources_uk.rc
deleted file mode 100644
index 9f93de5..0000000
--- a/google_update/generated_resources_uk.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_ur.rc b/google_update/generated_resources_ur.rc
deleted file mode 100644
index d02115e..0000000
--- a/google_update/generated_resources_ur.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_userdefault.rc b/google_update/generated_resources_userdefault.rc
deleted file mode 100644
index b17bcab..0000000
--- a/google_update/generated_resources_userdefault.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_vi.rc b/google_update/generated_resources_vi.rc
deleted file mode 100644
index 2136404..0000000
--- a/google_update/generated_resources_vi.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_zh-CN.rc b/google_update/generated_resources_zh-CN.rc
deleted file mode 100644
index f28e0c9..0000000
--- a/google_update/generated_resources_zh-CN.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_zh-HK.rc b/google_update/generated_resources_zh-HK.rc
deleted file mode 100644
index 0a80e81..0000000
--- a/google_update/generated_resources_zh-HK.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/generated_resources_zh-TW.rc b/google_update/generated_resources_zh-TW.rc
deleted file mode 100644
index aec1f7c..0000000
--- a/google_update/generated_resources_zh-TW.rc
+++ /dev/null
Binary files differ
diff --git a/google_update/google_update.grh b/google_update/google_update.grh
deleted file mode 100644
index 563bb97..0000000
--- a/google_update/google_update.grh
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-// This file is automatically generated by GRIT.  Do not edit.
-// Built on Thu Nov 18 11:10:52 2010
-
-#ifndef RESOURCE_636496767058__
-#define RESOURCE_636496767058__
-
-
-
-#endif // RESOURCE_636496767058__
diff --git a/google_update/google_update.ico b/google_update/google_update.ico
deleted file mode 100644
index 8420f53..0000000
--- a/google_update/google_update.ico
+++ /dev/null
Binary files differ
diff --git a/google_update/google_update_unittest.cc b/google_update/google_update_unittest.cc
deleted file mode 100644
index b8aea62..0000000
--- a/google_update/google_update_unittest.cc
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <atlpath.h>
-#include "omaha/base/app_util.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/file.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(GoogleUpdateTest, ShellVersion) {
-  CPath actual_shell_path(app_util::GetCurrentModuleDirectory());
-  ASSERT_TRUE(actual_shell_path.Append(kOmahaShellFileName));
-
-  ASSERT_TRUE(File::Exists(actual_shell_path));
-  const ULONGLONG actual_shell_version =
-      app_util::GetVersionFromFile(actual_shell_path);
-
-  EXPECT_TRUE(actual_shell_version);
-#if TEST_CERTIFICATE
-  EXPECT_EQ(OMAHA_BUILD_VERSION, actual_shell_version);
-  EXPECT_STREQ(OMAHA_BUILD_VERSION_STRING,
-               StringFromVersion(actual_shell_version));
-#else
-  // This version must be updated whenever the saved shell is updated.
-  EXPECT_STREQ(_T("1.2.183.21"), StringFromVersion(actual_shell_version));
-#endif
-}
-
-}  // namespace omaha
diff --git a/google_update/precompile.h b/google_update/precompile.h
deleted file mode 100644
index 8f30f0c..0000000
--- a/google_update/precompile.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOGLE_UPDATE_PRECOMPILE_H__
-#define OMAHA_GOOGLE_UPDATE_PRECOMPILE_H__
-
-#pragma runtime_checks("", off)
-
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-
-#include <windows.h>
-#include <shlwapi.h>
-#include <tchar.h>
-
-#pragma warning(push)
-// C4310: cast truncates constant value
-#pragma warning(disable : 4310)
-#include "base/basictypes.h"
-#pragma warning(pop)
-
-#endif  // OMAHA_GOOGLE_UPDATE_PRECOMPILE_H__
diff --git a/google_update/resource.h b/google_update/resource.h
deleted file mode 100644
index d2e8802..0000000
--- a/google_update/resource.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOGLE_UPDATE_RESOURCE_H_
-#define OMAHA_GOOGLE_UPDATE_RESOURCE_H_
-
-// Icons.
-#define IDI_APP                         101
-
-#endif // OMAHA_GOOGLE_UPDATE_RESOURCE_H_
diff --git a/google_update/resource.rc b/google_update/resource.rc
deleted file mode 100644
index a008c4d..0000000
--- a/google_update/resource.rc
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <afxres.h>
-#include "resource.h"
-
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-
-1 RT_MANIFEST "GoogleUpdate.manifest"
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDI_APP   ICON    "omaha/google_update/google_update.ico"
-
diff --git a/google_update/winmain.cc b/google_update/winmain.cc
deleted file mode 100644
index a307a0a..0000000
--- a/google_update/winmain.cc
+++ /dev/null
@@ -1,316 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// This is a small shell that loads a DLL calls its well known entry point.
-// The intention is to only depend on OS mechanisms and avoid the LIBC
-// dependency completely.
-// This indirection is done primarily to:
-// Play nicely with software firewalls. Most firewalls watch the executable
-// module making network requests and we do not want them to notify the user
-// after we've updated the program. The DLL can change independently of the
-// shell and we expect the shell to remain unchanged most of the time.
-//
-// Changes to this executable will not appear in offical builds until they are
-// included in an offical build and the resulting file is checked in to the
-// saved shell location.
-
-// Disable the RTC checks because this shell doesn't build with a CRT.
-#pragma runtime_checks("", off)
-
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-
-#include <windows.h>
-#include <shlobj.h>
-#include <shlwapi.h>
-#include <tchar.h>
-
-#include <atlbase.h>
-#include <atlpath.h>
-#include <atlstr.h>
-
-#include "omaha/base/constants.h"
-#include "omaha/base/error.h"
-#include "omaha/base/signaturevalidator.h"
-#include "omaha/common/const_goopdate.h"
-
-// TODO(omaha3): move to common.
-#include "omaha/goopdate/main.h"
-
-namespace omaha {
-
-// Disable the stack checks to keep the code size down.
-// The check_stack pragma did not really work. The stack checks had to be
-// disabled in the mk_file.
-#pragma check_stack()
-
-// Have to define this here since this is used in signaturevalidator.cc.
-// This is defined in error.cc, but that pulls in debug.cc, which has a lot
-// of additional dependencies we do not want.  Not worth it for just this
-// function.
-HRESULT HRESULTFromLastError() {
-  DWORD error_code = ::GetLastError();
-  return (error_code != NO_ERROR) ? HRESULT_FROM_WIN32(error_code) : E_FAIL;
-}
-
-// Adapted from File::Exists in file.cc.
-bool FileExists(const TCHAR* file_name) {
-  if (!file_name || !*file_name) {
-    return false;
-  }
-
-  WIN32_FILE_ATTRIBUTE_DATA attrs = {0};
-  return 0 != ::GetFileAttributesEx(file_name, ::GetFileExInfoStandard, &attrs);
-}
-
-// Adapted from vistautil.cc.
-bool IsVistaOrLater() {
-  static bool known = false;
-  static bool is_vista = false;
-  if (!known) {
-    OSVERSIONINFOEX osvi = {0};
-    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
-    osvi.dwMajorVersion = 6;
-    DWORDLONG conditional = 0;
-    VER_SET_CONDITION(conditional, VER_MAJORVERSION, VER_GREATER_EQUAL);
-    is_vista = !!::VerifyVersionInfo(&osvi, VER_MAJORVERSION, conditional);
-    known = true;
-  }
-  return is_vista;
-}
-
-// Checking the full path vs. just being somewhere in Program Files is important
-// because other programs may have lowered the ACLs of some subdirectories.
-bool IsRunningFromProgramFilesDirectory() {
-  // Get the HMODULE for the current process.
-  HMODULE module_handle = ::GetModuleHandle(NULL);
-  if (!module_handle) {
-    return false;
-  }
-
-  // Get the full path to the module based on the HMODULE.
-  CString module_path;
-  DWORD result = ::GetModuleFileName(module_handle,
-                                     module_path.GetBufferSetLength(MAX_PATH),
-                                     MAX_PATH);
-  module_handle = NULL;
-
-  if (result == 0) {
-    return false;
-  }
-
-  // Get the directory of the current process without the filename.
-  CPath path_temp(module_path);
-  path_temp.RemoveFileSpec();
-  module_path = static_cast<CString>(path_temp);
-
-  // Get the directory to %ProgramFiles%.
-  TCHAR folder_path_buffer[MAX_PATH] = {0};
-  HRESULT hr = ::SHGetFolderPath(NULL,
-                                 CSIDL_PROGRAM_FILES,
-                                 NULL,
-                                 SHGFP_TYPE_CURRENT,
-                                 folder_path_buffer);
-  if (FAILED(hr)) {
-    return false;
-  }
-
-  // Append the google/update install path onto %ProgramFiles%.
-  CString folder_path = folder_path_buffer;
-  if (!::PathAppend(CStrBuf(folder_path, MAX_PATH),
-                    OMAHA_REL_GOOPDATE_INSTALL_DIR)) {
-    return false;
-  }
-
-  folder_path.MakeLower();
-  module_path.MakeLower();
-
-  // Check if module_path starts with folder_path.
-  return (module_path.Find(folder_path) == 0);
-}
-
-// In the following case, we need to validate the signature of goopdate.dll
-// before loading it to maintain the chain of trust:
-//  * Not running from a secure location
-//  * Vista and later
-//  * Running elevated/with admin privileges
-//  * UAC is not disabled
-//
-// We explicitly do not perform the authenticode check when UAC is disabled
-// because the other conditions are all satisfied by the per-user instance of
-// Omaha installed for a member of the admin group. Without an explicit check,
-// an authenticode check would be performed every time the the per-user instance
-// runs in these configurations.
-// Skipping the authenticode check when UAC is disabled is also okay because the
-// user has opted to let all applications run with the same privilege, so there
-// is no need elevation of privileges.
-// TODO(omaha): Eliminate the supported cases where this shell runs elevated
-// from an unsecure location and replace the authenticode check with an error.
-HRESULT VerifySignatureIfNecessary(const TCHAR* file_path,
-                                   bool is_running_from_secure_location) {
-  if (is_running_from_secure_location ||
-      !IsVistaOrLater() ||
-      !::IsUserAnAdmin()) {
-    return S_OK;
-  }
-
-  // Verify the Authenticode signature but use only the local cache for
-  // revocation checks.
-  HRESULT hr = VerifySignature(file_path, false);
-#if TEST_CERTIFICATE
-  // The chain of trust will not validate on builds signed with the test
-  // certificate.
-  if (CERT_E_UNTRUSTEDROOT == hr) {
-    hr = S_OK;
-  }
-#endif
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Verify that there is a Google certificate and that it has not expired.
-  if (!VerifySigneeIsGoogle(file_path)) {
-    return GOOGLEUPDATE_E_VERIFY_SIGNEE_IS_GOOGLE_FAILED;
-  }
-
-  return S_OK;
-}
-
-HRESULT GetRegisteredVersion(bool is_machine, CString* version) {
-  HKEY key = NULL;
-  LONG res = ::RegOpenKeyEx(is_machine ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,
-                            GOOPDATE_REG_RELATIVE_CLIENTS GOOPDATE_APP_ID,
-                            0,
-                            KEY_READ,
-                            &key);
-  if (ERROR_SUCCESS != res) {
-    return HRESULT_FROM_WIN32(res);
-  }
-
-  DWORD type = 0;
-  DWORD version_length = 50;
-  res = ::SHQueryValueEx(key,
-                         omaha::kRegValueProductVersion,
-                         NULL,
-                         &type,
-                         CStrBuf(*version, version_length),
-                         &version_length);
-  if (ERROR_SUCCESS != res) {
-    return HRESULT_FROM_WIN32(res);
-  }
-
-  if (REG_SZ != type) {
-    return E_UNEXPECTED;
-  }
-
-  return S_OK;
-}
-
-HRESULT GetDllPath(HINSTANCE instance, bool is_machine, CString* dll_path) {
-  TCHAR base_path[MAX_PATH] = {0};
-  TCHAR path[MAX_PATH] = {0};
-
-  if (!::GetModuleFileName(instance, base_path, arraysize(base_path))) {
-    return HRESULTFromLastError();
-  }
-  ::PathRemoveFileSpec(base_path);
-
-  // Try the side-by-side DLL first.
-  _tcscpy_s(path, arraysize(path), base_path);
-  if (!::PathAppend(path, omaha::kOmahaDllName)) {
-    return HRESULTFromLastError();
-  }
-  if (FileExists(path)) {
-    *dll_path = path;
-    return S_OK;
-  }
-
-  // Try the version subdirectory.
-  _tcscpy_s(path, arraysize(path), base_path);
-  CString version;
-  HRESULT hr = GetRegisteredVersion(is_machine, &version);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  if (!::PathAppend(path, version)) {
-    return HRESULTFromLastError();
-  }
-  if (!::PathAppend(path, omaha::kOmahaDllName)) {
-    return HRESULTFromLastError();
-  }
-  if (!FileExists(path)) {
-    return GOOGLEUPDATE_E_DLL_NOT_FOUND;
-  }
-
-  *dll_path = path;
-  return S_OK;
-}
-
-}  // namespace omaha
-
-// Algorithm:
-//  * Looks for goopdate.dll in the current directory.
-//  * If it is not found, looks for goopdate.dll in a version subdirectory based
-//    on the version found in the registry.
-//  * Verifies the signature of the goopdate.dll file.
-//  * Loads the DLL and calls the entry point.
-int WINAPI _tWinMain(HINSTANCE instance,
-                     HINSTANCE,
-                     LPTSTR,
-                     int cmd_show) {
-  bool is_running_from_program_files =
-      omaha::IsRunningFromProgramFilesDirectory();
-
-  // We assume here that running from program files means we should check
-  // the machine install version and otherwise we should check the user
-  // version. This should be true in all end user cases except for initial
-  // installs from the temp directory, in which case the DLL should be in the
-  // same directory so this value does not get used.
-  // For developer use cases, the DLL should also be in the same directory.
-  bool is_machine = is_running_from_program_files;
-
-  CString dll_path;
-  HRESULT hr = omaha::GetDllPath(instance, is_machine, &dll_path);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = omaha::VerifySignatureIfNecessary(dll_path,
-                                         is_running_from_program_files);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  HMODULE module(::LoadLibraryEx(dll_path, NULL, 0));
-  if (!module) {
-    return omaha::HRESULTFromLastError();
-  }
-
-  DllEntry dll_entry = reinterpret_cast<DllEntry>(
-      ::GetProcAddress(module, omaha::kGoopdateDllEntryAnsi));
-  if (dll_entry) {
-    // We must send in GetCommandLine() and not cmd_line because the command
-    // line parsing code expects to have the program name as the first argument
-    // and cmd_line does not provide this.
-    hr = dll_entry(::GetCommandLine(), cmd_show);
-  } else {
-    hr = E_FAIL;
-  }
-
-  ::FreeLibrary(module);
-
-  return hr;
-}
diff --git a/goopdate/app.cc b/goopdate/app.cc
deleted file mode 100644
index 871f4d2..0000000
--- a/goopdate/app.cc
+++ /dev/null
@@ -1,1177 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app.h"
-#include "omaha/base/error.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/time.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/experiment_labels.h"
-#include "omaha/goopdate/app_manager.h"
-#include "omaha/goopdate/app_state.h"
-#include "omaha/goopdate/app_state_init.h"
-#include "omaha/goopdate/current_state.h"
-#include "omaha/goopdate/model.h"
-#include "omaha/goopdate/server_resource.h"
-#include "omaha/goopdate/string_formatter.h"
-
-namespace omaha {
-
-App::App(const GUID& app_guid, bool is_update, AppBundle* app_bundle)
-    : ModelObject(app_bundle->model()),
-      app_bundle_(app_bundle),
-      is_update_(is_update),
-      has_update_available_(false),
-      app_guid_(app_guid),
-      iid_(GUID_NULL),
-      install_time_diff_sec_(0),
-      is_eula_accepted_(TRISTATE_NONE),  // Cannot ping until set true.
-      browser_type_(BROWSER_UNKNOWN),
-      days_since_last_active_ping_(0),
-      days_since_last_roll_call_(0),
-      usage_stats_enable_(TRISTATE_NONE),
-      did_run_(ACTIVE_UNKNOWN),
-      is_canceled_(false),
-      completion_result_(PingEvent::EVENT_RESULT_SUCCESS),
-      installer_result_code_(0),
-      installer_result_extra_code1_(0),
-      post_install_action_(POST_INSTALL_ACTION_DEFAULT),
-      previous_total_download_bytes_(0),
-      download_start_time_ms_(0),
-      download_complete_time_ms_(0),
-      num_bytes_downloaded_(0) {
-  ASSERT1(!::IsEqualGUID(GUID_NULL, app_guid_));
-
-  current_version_.reset(new AppVersion(this));
-  next_version_.reset(new AppVersion(this));
-
-  // TODO(omaha):  set the working_version_ correctly to indicate which
-  // version of the app is modified: current version for components and
-  // next version for install/updates. The code do not support components yet
-  // and the working version in set to next always.
-  working_version_ = next_version_.get();
-  app_state_.reset(new fsm::AppStateInit);
-}
-
-// Destruction of App objects happens within the scope of their parent,
-// which controls the locking.
-App::~App() {
-  ASSERT1(model()->IsLockedByCaller());
-  working_version_ = NULL;
-  app_bundle_ = NULL;
-}
-
-STDMETHODIMP App::get_appId(BSTR* app_id) {
-  __mutexScope(model()->lock());
-  ASSERT1(app_id);
-  *app_id = GuidToString(app_guid_).AllocSysString();
-  return S_OK;
-}
-
-STDMETHODIMP App::get_language(BSTR* language) {
-  __mutexScope(model()->lock());
-  ASSERT1(language);
-  *language = language_.AllocSysString();
-  return S_OK;
-}
-
-STDMETHODIMP App::put_language(BSTR language) {
-  __mutexScope(model()->lock());
-  language_ = language;
-  return S_OK;
-}
-
-STDMETHODIMP App::get_ap(BSTR* ap) {
-  __mutexScope(model()->lock());
-  ASSERT1(ap);
-  *ap = ap_.AllocSysString();
-  return S_OK;
-}
-
-STDMETHODIMP App::put_ap(BSTR ap) {
-  __mutexScope(model()->lock());
-  ap_ = ap;
-  return S_OK;
-}
-
-STDMETHODIMP App::get_pv(BSTR* pv) {
-  __mutexScope(model()->lock());
-  ASSERT1(pv);
-  *pv = pv_.AllocSysString();
-  return S_OK;
-}
-
-STDMETHODIMP App::put_pv(BSTR pv) {
-  __mutexScope(model()->lock());
-  pv_ = pv;
-  return S_OK;
-}
-
-STDMETHODIMP App::get_ttToken(BSTR* tt_token) {
-  __mutexScope(model()->lock());
-  ASSERT1(tt_token);
-  *tt_token = tt_token_.AllocSysString();
-  return S_OK;
-}
-
-STDMETHODIMP App::put_ttToken(BSTR tt_token) {
-  __mutexScope(model()->lock());
-  tt_token_ = tt_token;
-  return S_OK;
-}
-
-STDMETHODIMP App::get_iid(BSTR* iid) {
-  __mutexScope(model()->lock());
-  ASSERT1(iid);
-  *iid = GuidToString(iid_).AllocSysString();
-  return S_OK;
-}
-
-STDMETHODIMP App::put_iid(BSTR iid) {
-  __mutexScope(model()->lock());
-  return StringToGuidSafe(iid, &iid_);
-}
-
-STDMETHODIMP App::get_brandCode(BSTR* brand_code) {
-  __mutexScope(model()->lock());
-  ASSERT1(brand_code);
-  *brand_code = brand_code_.AllocSysString();
-  return S_OK;
-}
-
-STDMETHODIMP App::put_brandCode(BSTR brand_code) {
-  __mutexScope(model()->lock());
-  brand_code_ = brand_code;
-  return S_OK;
-}
-
-STDMETHODIMP App::get_clientId(BSTR* client_id) {
-  __mutexScope(model()->lock());
-  ASSERT1(client_id);
-  *client_id = client_id_.AllocSysString();
-  return S_OK;
-}
-
-STDMETHODIMP App::put_clientId(BSTR client_id) {
-  __mutexScope(model()->lock());
-  client_id_ = client_id;
-  return S_OK;
-}
-
-STDMETHODIMP App::get_labels(BSTR* labels) {
-  __mutexScope(model()->lock());
-  ASSERT1(labels);
-  *labels = GetExperimentLabels().AllocSysString();
-  return S_OK;
-}
-
-STDMETHODIMP App::put_labels(BSTR labels) {
-  __mutexScope(model()->lock());
-  ExperimentLabels decoded_labels;
-  if (!decoded_labels.Deserialize(labels)) {
-    return E_INVALIDARG;
-  }
-  return decoded_labels.WriteToRegistry(app_bundle_->is_machine(),
-                                        app_guid_string());
-}
-
-STDMETHODIMP App::get_referralId(BSTR* referral_id) {
-  __mutexScope(model()->lock());
-  ASSERT1(referral_id);
-  *referral_id = referral_id_.AllocSysString();
-  return S_OK;
-}
-
-STDMETHODIMP App::put_referralId(BSTR referral_id) {
-  __mutexScope(model()->lock());
-  referral_id_ = referral_id;
-  return S_OK;
-}
-
-STDMETHODIMP App::get_installTimeDiffSec(UINT* install_time_diff_sec) {
-  __mutexScope(model()->lock());
-  ASSERT1(install_time_diff_sec);
-  *install_time_diff_sec = install_time_diff_sec_;
-  return S_OK;
-}
-
-STDMETHODIMP App::get_isEulaAccepted(VARIANT_BOOL* is_eula_accepted) {
-  __mutexScope(model()->lock());
-  ASSERT1(is_eula_accepted);
-  *is_eula_accepted = App::is_eula_accepted() ? VARIANT_TRUE : VARIANT_FALSE;
-  return S_OK;
-}
-
-STDMETHODIMP App::put_isEulaAccepted(VARIANT_BOOL is_eula_accepted) {
-  __mutexScope(model()->lock());
-  is_eula_accepted_ = is_eula_accepted ? TRISTATE_TRUE : TRISTATE_FALSE;
-  return S_OK;
-}
-
-STDMETHODIMP App::get_displayName(BSTR* display_name) {
-  __mutexScope(model()->lock());
-  ASSERT1(display_name);
-  *display_name = display_name_.AllocSysString();
-  return S_OK;
-}
-
-STDMETHODIMP App::put_displayName(BSTR display_name) {
-  __mutexScope(model()->lock());
-  display_name_ = display_name;
-  return S_OK;
-}
-
-STDMETHODIMP App::get_browserType(UINT* browser_type) {
-  __mutexScope(model()->lock());
-  ASSERT1(browser_type);
-  *browser_type = browser_type_;
-  return S_OK;
-}
-
-STDMETHODIMP App::put_browserType(UINT browser_type) {
-  __mutexScope(model()->lock());
-  if (browser_type >= BROWSER_MAX) {
-    return E_INVALIDARG;
-  }
-  browser_type_ = static_cast<BrowserType>(browser_type);
-  return S_OK;
-}
-
-STDMETHODIMP App::get_clientInstallData(BSTR* data) {
-  __mutexScope(model()->lock());
-  ASSERT1(data);
-  *data = client_install_data_.AllocSysString();
-  return S_OK;
-}
-
-STDMETHODIMP App::put_clientInstallData(BSTR data) {
-  __mutexScope(model()->lock());
-  client_install_data_ = data;
-  return S_OK;
-}
-
-STDMETHODIMP App::get_serverInstallDataIndex(BSTR* index) {
-  __mutexScope(model()->lock());
-  ASSERT1(index);
-  *index = server_install_data_index_.AllocSysString();
-  return S_OK;
-}
-
-STDMETHODIMP App::put_serverInstallDataIndex(BSTR index) {
-  __mutexScope(model()->lock());
-  server_install_data_index_ = index;
-  return S_OK;
-}
-
-STDMETHODIMP App::get_usageStatsEnable(UINT* usage_stats_enable) {
-  __mutexScope(model()->lock());
-  ASSERT1(usage_stats_enable);
-  *usage_stats_enable = usage_stats_enable_;
-  return S_OK;
-}
-
-STDMETHODIMP App::put_usageStatsEnable(UINT usage_stats_enable) {
-  __mutexScope(model()->lock());
-  if (usage_stats_enable > TRISTATE_NONE) {
-    return E_INVALIDARG;
-  }
-  usage_stats_enable_ = static_cast<Tristate>(usage_stats_enable);
-  return S_OK;
-}
-
-// TODO(omaha3): Replace decisions based on state() with calls to AppState.
-// In this case, there should be a GetCurrentState() method on AppState.
-STDMETHODIMP App::get_currentState(IDispatch** current_state) {
-  __mutexScope(model()->lock());
-
-  CORE_LOG(L3, (_T("[App::get_currentState][0x%p]"), this));
-  ASSERT1(current_state);
-
-  ULONGLONG bytes_downloaded = 0;
-  ULONGLONG total_bytes_to_download = 0;
-  ULONGLONG next_download_retry_time = 0;
-  LONG download_time_remaining_ms = kCurrentStateProgressUnknown;
-  LONG install_progress_percentage = kCurrentStateProgressUnknown;
-  LONG install_time_remaining_ms = kCurrentStateProgressUnknown;
-
-  HRESULT hr = S_OK;
-  switch (state()) {
-    case STATE_INIT:
-      break;
-    case STATE_WAITING_TO_CHECK_FOR_UPDATE:
-      break;
-    case STATE_CHECKING_FOR_UPDATE:
-      break;
-    case STATE_UPDATE_AVAILABLE:
-      break;
-    case STATE_NO_UPDATE:
-      ASSERT1(error_code() == S_OK ||
-              error_code() == GOOPDATE_E_UPDATE_DEFERRED);
-      ASSERT1(!completion_message_.IsEmpty());
-      ASSERT1(completion_result_ == PingEvent::EVENT_RESULT_SUCCESS ||
-              completion_result_ == PingEvent::EVENT_RESULT_UPDATE_DEFERRED);
-      ASSERT1(installer_result_code_ == 0);
-      break;
-    case STATE_WAITING_TO_DOWNLOAD:
-    case STATE_RETRYING_DOWNLOAD:
-    case STATE_DOWNLOADING:
-    case STATE_DOWNLOAD_COMPLETE:
-    case STATE_EXTRACTING:
-    case STATE_APPLYING_DIFFERENTIAL_PATCH:
-    case STATE_READY_TO_INSTALL:
-      hr = GetDownloadProgress(&bytes_downloaded,
-                               &total_bytes_to_download,
-                               &download_time_remaining_ms,
-                               &next_download_retry_time);
-      break;
-    case STATE_WAITING_TO_INSTALL:
-      break;
-    case STATE_INSTALLING:
-      // TODO(omaha3): Obtain install_progress_percentage and
-      // install_time_remaining_ms.
-      break;
-    case STATE_INSTALL_COMPLETE:
-      install_progress_percentage = 100;
-      install_time_remaining_ms = 0;
-
-      ASSERT1(error_code() == S_OK);
-      ASSERT1(!completion_message_.IsEmpty());
-      ASSERT1(completion_result_ == PingEvent::EVENT_RESULT_SUCCESS ||
-              completion_result_ == PingEvent::EVENT_RESULT_SUCCESS_REBOOT);
-      break;
-    case STATE_PAUSED:
-      break;
-    case STATE_ERROR:
-      ASSERT1(error_code() != S_OK);
-      ASSERT1(!completion_message_.IsEmpty());
-      ASSERT1(
-          completion_result_ == PingEvent::EVENT_RESULT_ERROR ||
-          completion_result_ == PingEvent::EVENT_RESULT_CANCELLED ||
-          completion_result_ == PingEvent::EVENT_RESULT_INSTALLER_ERROR_MSI ||
-          completion_result_ == PingEvent::EVENT_RESULT_INSTALLER_ERROR_OTHER ||
-          completion_result_ == PingEvent::EVENT_RESULT_INSTALLER_ERROR_SYSTEM);
-      break;
-    default:
-      ASSERT1(false);
-      hr = E_FAIL;
-      break;
-  }
-
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CComObject<CurrentAppState>* state_object = NULL;
-  hr = CurrentAppState::Create(state(),
-                               next_version()->version(),
-                               bytes_downloaded,
-                               total_bytes_to_download,
-                               download_time_remaining_ms,
-                               next_download_retry_time,
-                               install_progress_percentage,
-                               install_time_remaining_ms,
-                               is_canceled_,
-                               error_context_.error_code,
-                               error_context_.extra_code1,
-                               completion_message_,
-                               installer_result_code_,
-                               installer_result_extra_code1_,
-                               post_install_launch_command_line_,
-                               post_install_url_,
-                               post_install_action_,
-                               &state_object);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return state_object->QueryInterface(current_state);
-}
-
-// TODO(omaha3): If some packages are already cached, there may be awkward jumps
-// in progress if we don't filter those out of bytes_total from the beginning.
-// TODO(omaha3): For now we use the package's expected_size to calculate
-// bytes_total. This may or may not be what we want. See the TODO for
-// Package::OnProgress().
-// TODO(omaha3): Maybe optimize, especially in states other than
-// STATE_DOWNLOADING.
-HRESULT App::GetDownloadProgress(uint64* bytes_downloaded,
-                                 uint64* bytes_total,
-                                 LONG* time_remaining_ms,
-                                 uint64* next_retry_time) {
-  ASSERT1(model()->IsLockedByCaller());
-
-  ASSERT1(bytes_downloaded);
-  ASSERT1(bytes_total);
-  ASSERT1(time_remaining_ms);
-  ASSERT1(next_retry_time);
-
-  *bytes_downloaded = 0;
-  *bytes_total = 0;
-  *next_retry_time = 0;
-
-  *time_remaining_ms = kCurrentStateProgressUnknown;
-
-  for (size_t i = 0; i < working_version_->GetNumberOfPackages(); ++i) {
-    const Package* package = working_version_->GetPackage(i);
-
-    const uint64 package_bytes = package->bytes_downloaded();
-    ASSERT1((*bytes_downloaded + package_bytes > *bytes_downloaded) ||
-            package_bytes == 0);
-    *bytes_downloaded += package_bytes;
-
-    const uint64 package_size = package->expected_size();
-    ASSERT1(0 < package_size);
-    ASSERT1(*bytes_total + package_size > *bytes_total);
-    *bytes_total += package_size;
-
-    LONG package_remaining_time_ms =
-        package->GetEstimatedRemainingDownloadTimeMs();
-    if (*time_remaining_ms < package_remaining_time_ms) {
-      *time_remaining_ms = package_remaining_time_ms;
-    }
-
-    uint64 package_next_retry_time = package->next_download_retry_time();
-    if (package_bytes < package_size && package_next_retry_time != 0 &&
-        (*next_retry_time == 0 || *next_retry_time > package_next_retry_time)) {
-      *next_retry_time = package_next_retry_time;
-    }
-  }
-
-  ASSERT1(*bytes_downloaded <= *bytes_total);
-
-  ASSERT1(previous_total_download_bytes_ == *bytes_total ||
-          previous_total_download_bytes_ == 0);
-  previous_total_download_bytes_ = *bytes_total;
-
-  return S_OK;
-}
-
-AppBundle* App::app_bundle() {
-  __mutexScope(model()->lock());
-  return app_bundle_;
-}
-
-const AppBundle* App::app_bundle() const {
-  __mutexScope(model()->lock());
-  return app_bundle_;
-}
-
-AppVersion* App::current_version() {
-  __mutexScope(model()->lock());
-  return current_version_.get();
-}
-
-const AppVersion* App::current_version() const {
-  __mutexScope(model()->lock());
-  return current_version_.get();
-}
-
-AppVersion* App::next_version() {
-  __mutexScope(model()->lock());
-  return next_version_.get();
-}
-
-const AppVersion* App::next_version() const {
-  __mutexScope(model()->lock());
-  return next_version_.get();
-}
-
-CString App::app_guid_string() const {
-  return GuidToString(app_guid());
-}
-
-GUID App::app_guid() const {
-  __mutexScope(model()->lock());
-  return app_guid_;
-}
-
-void App::set_app_guid(const GUID& app_guid) {
-  __mutexScope(model()->lock());
-  app_guid_ = app_guid;
-}
-
-CString App::language() const {
-  __mutexScope(model()->lock());
-  return language_;
-}
-
-bool App::is_eula_accepted() const {
-  __mutexScope(model()->lock());
-  return is_eula_accepted_ == TRISTATE_TRUE;
-}
-
-CString App::display_name() const {
-  __mutexScope(model()->lock());
-  return display_name_;
-}
-
-CurrentState App::state() const {
-  __mutexScope(model()->lock());
-  return app_state_->state();
-}
-
-bool App::is_update() const {
-  __mutexScope(model()->lock());
-  ASSERT1(current_version_->version().IsEmpty() != is_update_);
-  return is_update_;
-}
-
-bool App::has_update_available() const {
-  __mutexScope(model()->lock());
-  return has_update_available_;
-}
-
-void App::set_has_update_available(bool has_update_available) {
-  __mutexScope(model()->lock());
-  has_update_available_ = has_update_available;
-}
-
-GUID App::iid() const {
-  __mutexScope(model()->lock());
-  return iid_;
-}
-
-CString App::client_id() const {
-  __mutexScope(model()->lock());
-  return client_id_;
-}
-
-CString App::GetExperimentLabels() const {
-  __mutexScope(model()->lock());
-  ExperimentLabels stored_labels;
-  VERIFY1(SUCCEEDED(stored_labels.ReadFromRegistry(app_bundle_->is_machine(),
-                                                   app_guid_string())));
-  return stored_labels.Serialize();
-}
-
-CString App::referral_id() const {
-  __mutexScope(model()->lock());
-  return referral_id_;
-}
-
-BrowserType App::browser_type() const {
-  __mutexScope(model()->lock());
-  return browser_type_;
-}
-
-Tristate App::usage_stats_enable() const {
-  __mutexScope(model()->lock());
-  return usage_stats_enable_;
-}
-
-CString App::client_install_data() const {
-  __mutexScope(model()->lock());
-  return client_install_data_;
-}
-
-CString App::server_install_data() const {
-  __mutexScope(model()->lock());
-  return server_install_data_;
-}
-
-void App::set_server_install_data(const CString& server_install_data) {
-  __mutexScope(model()->lock());
-  server_install_data_ = server_install_data;
-}
-
-CString App::brand_code() const {
-  __mutexScope(model()->lock());
-  return brand_code_;
-}
-
-// TODO(omaha): for better accuracy, compute the value when used.
-uint32 App::install_time_diff_sec() const {
-  __mutexScope(model()->lock());
-  return install_time_diff_sec_;
-}
-
-ActiveStates App::did_run() const {
-  __mutexScope(model()->lock());
-  return did_run_;
-}
-
-int App::days_since_last_active_ping() const {
-  __mutexScope(model()->lock());
-  return days_since_last_active_ping_;
-}
-
-void App::set_days_since_last_active_ping(int days) {
-  __mutexScope(model()->lock());
-  days_since_last_active_ping_ = days;
-}
-
-int App::days_since_last_roll_call() const {
-  __mutexScope(model()->lock());
-  return days_since_last_roll_call_;
-}
-
-void App::set_days_since_last_roll_call(int days) {
-  __mutexScope(model()->lock());
-  days_since_last_roll_call_ = days;
-}
-
-CString App::ap() const {
-  __mutexScope(model()->lock());
-  return ap_;
-}
-
-CString App::tt_token() const {
-  __mutexScope(model()->lock());
-  return tt_token_;
-}
-
-CString App::server_install_data_index() const {
-  __mutexScope(model()->lock());
-  return server_install_data_index_;
-}
-
-HRESULT App::error_code() const {
-  __mutexScope(model()->lock());
-  return error_context_.error_code;
-}
-
-ErrorContext App::error_context() const {
-  __mutexScope(model()->lock());
-  return error_context_;
-}
-
-int App::installer_result_code() const {
-  __mutexScope(model()->lock());
-  return installer_result_code_;
-}
-
-int App::installer_result_extra_code1() const {
-  __mutexScope(model()->lock());
-  return installer_result_extra_code1_;
-}
-
-const PingEventVector& App::ping_events() const {
-  __mutexScope(model()->lock());
-  return ping_events_;
-}
-
-AppVersion* App::working_version() {
-  __mutexScope(model()->lock());
-  return working_version_;
-}
-
-const AppVersion* App::working_version() const {
-  __mutexScope(model()->lock());
-  return working_version_;
-}
-
-CString App::FetchAndResetLogText() {
-  __mutexScope(model()->lock());
-  CString event_log_text(event_log_text_);
-  event_log_text_.Empty();
-
-  return event_log_text;
-}
-
-void App::LogTextAppendFormat(const TCHAR* format, ...) {
-  ASSERT1(format);
-
-  CString log_string;
-
-  va_list arguments;
-  va_start(arguments, format);
-  SafeCStringFormatV(&log_string, format, arguments);
-  va_end(arguments);
-
-  __mutexScope(model()->lock());
-  SafeCStringAppendFormat(&event_log_text_, _T("App=%s, Ver=%s, %s\n"),
-                          app_guid_string().GetString(),
-                          current_version()->version().GetString(),
-                          log_string.GetString());
-}
-
-void App::AddPingEvent(const PingEventPtr& ping_event) {
-  __mutexScope(model()->lock());
-  ping_events_.push_back(ping_event);
-  CORE_LOG(L3, (_T("[ping event added][%s]"), ping_event->ToString()));
-}
-
-HRESULT App::CheckGroupPolicy() const {
-  __mutexScope(model()->lock());
-
-  bool is_auto_update = false;
-
-  if (is_update_) {
-    if (!ConfigManager::Instance()->CanUpdateApp(
-             app_guid_,
-             !app_bundle_->is_auto_update())) {
-      return GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY;
-    }
-  } else {
-    ASSERT1(!is_auto_update);
-    if (!ConfigManager::Instance()->CanInstallApp(app_guid_)) {
-      return GOOPDATE_E_APP_INSTALL_DISABLED_BY_POLICY;
-    }
-  }
-
-  return S_OK;
-}
-
-void App::SetDownloadStartTime() {
-  __mutexScope(model()->lock());
-  ASSERT1(download_complete_time_ms_ == 0);
-  ASSERT1(num_bytes_downloaded_ == 0);
-
-  download_start_time_ms_ = GetCurrentMsTime();
-}
-
-void App::SetDownloadCompleteTime() {
-  __mutexScope(model()->lock());
-  download_complete_time_ms_ = GetCurrentMsTime();
-}
-
-void App::UpdateNumBytesDownloaded(uint64 num_bytes) {
-  __mutexScope(model()->lock());
-
-  CORE_LOG(L3, (_T("[RecordDownloadedBytes][new bytes downloaded: %llu]"),
-                num_bytes));
-  num_bytes_downloaded_ += num_bytes;
-}
-
-int App::GetDownloadTimeMs() const {
-  __mutexScope(model()->lock());
-
-  if (download_complete_time_ms_ < download_start_time_ms_) {
-    return 0;
-  }
-
-  return static_cast<int>(download_complete_time_ms_ - download_start_time_ms_);
-}
-
-uint64 App::num_bytes_downloaded() const {
-  __mutexScope(model()->lock());
-  return num_bytes_downloaded_;
-}
-
-uint64 App::GetPackagesTotalSize() const {
-  __mutexScope(model()->lock());
-
-  uint64 total_size = 0;
-  const size_t num_packages = working_version_->GetNumberOfPackages();
-  for (size_t i = 0; i < num_packages; ++i) {
-    total_size += working_version_->GetPackage(i)->expected_size();
-  }
-
-  return total_size;
-}
-
-//
-// State transition methods.
-// These should not do anything except acquire the lock if appropriate and call
-// the corresponding AppState method.
-//
-
-// This is the first transition. EULA acceptance must have been set by now.
-// Fail so that client developers realize quickly that something is wrong.
-// Otherwise, they might ship a client that installs apps that never update.
-void App::QueueUpdateCheck() {
-  __mutexScope(model()->lock());
-
-  ASSERT1(is_eula_accepted_ != TRISTATE_NONE);
-  if (is_eula_accepted_ == TRISTATE_NONE) {
-    CString message;
-    StringFormatter formatter(app_bundle_->display_language());
-    VERIFY1(SUCCEEDED(formatter.LoadString(IDS_INSTALL_FAILED, &message)));
-    Error(ErrorContext(GOOPDATE_E_CALL_UNEXPECTED), message);
-  }
-
-  app_state_->QueueUpdateCheck(this);
-}
-
-void App::PreUpdateCheck(xml::UpdateRequest* update_request) {
-  ASSERT1(update_request);
-  __mutexScope(model()->lock());
-  app_state_->PreUpdateCheck(this, update_request);
-}
-
-void App::PostUpdateCheck(HRESULT result,
-                          xml::UpdateResponse* update_response) {
-  ASSERT1(update_response);
-  __mutexScope(model()->lock());
-  app_state_->PostUpdateCheck(this, result, update_response);
-}
-
-void App::QueueDownload() {
-  __mutexScope(model()->lock());
-  app_state_->QueueDownload(this);
-}
-
-void App::QueueDownloadOrInstall() {
-  __mutexScope(model()->lock());
-  app_state_->QueueDownloadOrInstall(this);
-}
-
-// Does not take the lock because this is a blocking call.
-void App::Download(DownloadManagerInterface* download_manager) {
-  app_state_->Download(this, download_manager);
-}
-
-void App::Downloading() {
-  __mutexScope(model()->lock());
-  app_state_->Downloading(this);
-}
-
-void App::DownloadComplete() {
-  __mutexScope(model()->lock());
-  app_state_->DownloadComplete(this);
-}
-
-void App::MarkReadyToInstall() {
-  __mutexScope(model()->lock());
-  app_state_->MarkReadyToInstall(this);
-}
-
-void App::QueueInstall() {
-  __mutexScope(model()->lock());
-  app_state_->QueueInstall(this);
-}
-
-// Does not take the lock because this is a blocking call.
-void App::Install(InstallManagerInterface* install_manager) {
-  app_state_->Install(this, install_manager);
-}
-
-void App::Installing() {
-  __mutexScope(model()->lock());
-  app_state_->Installing(this);
-}
-
-void App::ReportInstallerComplete(const InstallerResultInfo& result_info) {
-  __mutexScope(model()->lock());
-  app_state_->ReportInstallerComplete(this,
-                                      result_info);
-}
-
-void App::Pause() {
-  __mutexScope(model()->lock());
-  return app_state_->Pause(this);
-}
-
-void App::Cancel() {
-  __mutexScope(model()->lock());
-  return app_state_->Cancel(this);
-}
-
-void App::Error(const ErrorContext& error_context, const CString& message) {
-  __mutexScope(model()->lock());
-  app_state_->Error(this, error_context, message);
-}
-
-void App::ChangeState(fsm::AppState* app_state) {
-  ASSERT1(app_state);
-  ASSERT1(model()->IsLockedByCaller());
-  CurrentState existing_state = app_state_->state();
-  app_state_.reset(app_state);
-  PingEventPtr ping_event(
-      app_state->CreatePingEvent(this, existing_state));
-  if (ping_event.get()) {
-    AddPingEvent(ping_event);
-  }
-}
-
-void App::SetError(const ErrorContext& error_context, const CString& message) {
-  ASSERT1(FAILED(error_context.error_code));
-  ASSERT1(!message.IsEmpty());
-  ASSERT1(model()->IsLockedByCaller());
-
-  error_context_      = error_context;
-  completion_message_ = message;
-
-  is_canceled_ = (error_context_.error_code == GOOPDATE_E_CANCELLED);
-  completion_result_  = is_canceled_ ? PingEvent::EVENT_RESULT_CANCELLED :
-                                       PingEvent::EVENT_RESULT_ERROR;
-}
-
-void App::SetNoUpdate(const ErrorContext& error_context,
-                      const CString& message) {
-  ASSERT1(!message.IsEmpty());
-  ASSERT1(model()->IsLockedByCaller());
-
-  error_context_      = error_context;
-  completion_message_ = message;
-
-  const bool is_deferred_update =
-      (error_context_.error_code == GOOPDATE_E_UPDATE_DEFERRED);
-  completion_result_  = is_deferred_update ?
-                        PingEvent::EVENT_RESULT_UPDATE_DEFERRED :
-                        PingEvent::EVENT_RESULT_SUCCESS;
-}
-
-void App::SetInstallerResult(const InstallerResultInfo& result_info) {
-  ASSERT1(result_info.type != INSTALLER_RESULT_UNKNOWN);
-  ASSERT1(!result_info.text.IsEmpty());
-  ASSERT1(model()->IsLockedByCaller());
-
-  completion_message_               = result_info.text;
-  installer_result_code_            = result_info.code;
-  installer_result_extra_code1_     = result_info.extra_code1;
-  post_install_launch_command_line_ =
-      result_info.post_install_launch_command_line;
-  post_install_url_                 = result_info.post_install_url;
-  post_install_action_              = result_info.post_install_action;
-
-  switch (result_info.type) {
-    case INSTALLER_RESULT_SUCCESS: {
-      error_context_.error_code = S_OK;
-
-      // TODO(omaha3): Determine whether a reboot is required. See TODO in
-      // InstallerWrapper.
-      const bool is_reboot_required = false;
-      completion_result_ = is_reboot_required ?
-                           PingEvent::EVENT_RESULT_SUCCESS_REBOOT :
-                           PingEvent::EVENT_RESULT_SUCCESS;
-
-      // We do not know whether Goopdate has succeeded because its installer has
-      // not completed.
-      if (!::IsEqualGUID(kGoopdateGuid, app_guid_)) {
-        AppManager::Instance()->PersistSuccessfulInstall(*this);
-      }
-      break;
-    }
-    case INSTALLER_RESULT_ERROR_MSI:
-      completion_result_ = PingEvent::EVENT_RESULT_INSTALLER_ERROR_MSI;
-      error_context_.error_code = GOOPDATEINSTALL_E_INSTALLER_FAILED;
-      break;
-    case INSTALLER_RESULT_ERROR_SYSTEM:
-      completion_result_ = PingEvent::EVENT_RESULT_INSTALLER_ERROR_SYSTEM;
-      error_context_.error_code = GOOPDATEINSTALL_E_INSTALLER_FAILED;
-      break;
-    case INSTALLER_RESULT_ERROR_OTHER:
-      completion_result_ = PingEvent::EVENT_RESULT_INSTALLER_ERROR_OTHER;
-      error_context_.error_code = GOOPDATEINSTALL_E_INSTALLER_FAILED;
-      break;
-    case INSTALLER_RESULT_UNKNOWN:
-    default:
-      ASSERT1(false);
-      completion_result_ = PingEvent::EVENT_RESULT_ERROR;
-      error_context_.error_code = E_FAIL;
-  }
-}
-
-CString App::GetInstallData() const {
-  __mutexScope(model()->lock());
-
-  ASSERT1(state() >= STATE_UPDATE_AVAILABLE &&
-          state() <= STATE_INSTALL_COMPLETE);
-
-  if (!client_install_data_.IsEmpty()) {
-    return client_install_data_;
-  }
-
-  return server_install_data_;
-}
-
-// IApp.
-STDMETHODIMP AppWrapper::get_currentVersion(IDispatch** current_version) {
-  __mutexScope(model()->lock());
-  return AppVersionWrapper::Create(controlling_ptr(),
-                                   wrapped_obj()->current_version(),
-                                   current_version);
-}
-
-STDMETHODIMP AppWrapper::get_nextVersion(IDispatch** next_version) {
-  __mutexScope(model()->lock());
-  return AppVersionWrapper::Create(controlling_ptr(),
-                                   wrapped_obj()->next_version(),
-                                   next_version);
-}
-
-// IApp.
-STDMETHODIMP AppWrapper::get_appId(BSTR* app_id) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_appId(app_id);
-}
-
-STDMETHODIMP AppWrapper::get_pv(BSTR* pv) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_pv(pv);
-}
-
-STDMETHODIMP AppWrapper::put_pv(BSTR pv) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_pv(pv);
-}
-
-STDMETHODIMP AppWrapper::get_language(BSTR* language) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_language(language);
-}
-
-STDMETHODIMP AppWrapper::put_language(BSTR language) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_language(language);
-}
-
-STDMETHODIMP AppWrapper::get_ap(BSTR* ap) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_ap(ap);
-}
-
-STDMETHODIMP AppWrapper::put_ap(BSTR ap) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_ap(ap);
-}
-
-STDMETHODIMP AppWrapper::get_ttToken(BSTR* tt_token) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_ttToken(tt_token);
-}
-
-STDMETHODIMP AppWrapper::put_ttToken(BSTR tt_token) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_ttToken(tt_token);
-}
-
-STDMETHODIMP AppWrapper::get_iid(BSTR* iid) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_iid(iid);
-}
-
-STDMETHODIMP AppWrapper::put_iid(BSTR iid) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_iid(iid);
-}
-
-STDMETHODIMP AppWrapper::get_brandCode(BSTR* brand_code) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_brandCode(brand_code);
-}
-
-STDMETHODIMP AppWrapper::put_brandCode(BSTR brand_code) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_brandCode(brand_code);
-}
-
-STDMETHODIMP AppWrapper::get_clientId(BSTR* client_id) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_clientId(client_id);
-}
-
-STDMETHODIMP AppWrapper::put_clientId(BSTR client_id) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_clientId(client_id);
-}
-
-STDMETHODIMP AppWrapper::get_labels(BSTR* labels) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_labels(labels);
-}
-
-STDMETHODIMP AppWrapper::put_labels(BSTR labels) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_labels(labels);
-}
-
-STDMETHODIMP AppWrapper::get_referralId(BSTR* referral_id) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_referralId(referral_id);
-}
-
-STDMETHODIMP AppWrapper::put_referralId(BSTR referral_id) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_referralId(referral_id);
-}
-
-STDMETHODIMP AppWrapper::get_installTimeDiffSec(UINT* install_time_diff_sec) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_installTimeDiffSec(install_time_diff_sec);
-}
-
-STDMETHODIMP AppWrapper::get_isEulaAccepted(VARIANT_BOOL* is_eula_accepted) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_isEulaAccepted(is_eula_accepted);
-}
-
-STDMETHODIMP AppWrapper::put_isEulaAccepted(VARIANT_BOOL is_eula_accepted) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_isEulaAccepted(is_eula_accepted);
-}
-
-STDMETHODIMP AppWrapper::get_displayName(BSTR* display_name) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_displayName(display_name);
-}
-
-STDMETHODIMP AppWrapper::put_displayName(BSTR display_name) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_displayName(display_name);
-}
-
-STDMETHODIMP AppWrapper::get_browserType(UINT* browser_type) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_browserType(browser_type);
-}
-
-STDMETHODIMP AppWrapper::put_browserType(UINT browser_type) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_browserType(browser_type);
-}
-
-STDMETHODIMP AppWrapper::get_clientInstallData(BSTR* data) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_clientInstallData(data);
-}
-
-STDMETHODIMP AppWrapper::put_clientInstallData(BSTR data) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_clientInstallData(data);
-}
-
-STDMETHODIMP AppWrapper::get_serverInstallDataIndex(BSTR* index) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_serverInstallDataIndex(index);
-}
-
-STDMETHODIMP AppWrapper::put_serverInstallDataIndex(BSTR index) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_serverInstallDataIndex(index);
-}
-
-STDMETHODIMP AppWrapper::get_usageStatsEnable(UINT* usage_stats_enable) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_usageStatsEnable(usage_stats_enable);
-}
-
-STDMETHODIMP AppWrapper::put_usageStatsEnable(UINT usage_stats_enable) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_usageStatsEnable(usage_stats_enable);
-}
-
-STDMETHODIMP AppWrapper::get_currentState(IDispatch** current_state_disp) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_currentState(current_state_disp);
-}
-
-
-// Sets app's app_state to state. Used by unit tests to set up the state to the
-// correct precondition for the test case. App friends this function, allowing
-// it to call the private member function.
-void SetAppStateForUnitTest(App* app, fsm::AppState* state) {
-  ASSERT1(app);
-  ASSERT1(state);
-  __mutexScope(app->model()->lock());
-  app->ChangeState(state);
-}
-
-}  // namespace omaha
diff --git a/goopdate/app.h b/goopdate/app.h
deleted file mode 100644
index 9e2dcd9..0000000
--- a/goopdate/app.h
+++ /dev/null
@@ -1,481 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Defines the App COM object exposed by the model. App tracks two versions:
-//  - the version currently installed
-//  - the future version to be updated to, if such a version exists
-
-#ifndef OMAHA_GOOPDATE_APP_H_
-#define OMAHA_GOOPDATE_APP_H_
-
-#include <atlbase.h>
-#include <atlcom.h>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "goopdate/omaha3_idl.h"
-#include "omaha/base/browser_utils.h"
-#include "omaha/base/constants.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/ping_event.h"
-#include "omaha/goopdate/com_wrapper_creator.h"
-#include "omaha/goopdate/installer_result_info.h"
-#include "omaha/goopdate/model_object.h"
-
-namespace omaha {
-
-// Stores the error codes associated with a particular error.
-struct ErrorContext {
-  ErrorContext() : error_code(S_OK), extra_code1(0) {}
-  explicit ErrorContext(HRESULT hr, int code1 = 0)
-      : error_code(hr),
-        extra_code1(code1) {}
-
-  HRESULT error_code;
-  int     extra_code1;
-
-  // Add more extra codes here as needed.
-};
-
-class DownloadManagerInterface;
-class InstallManagerInterface;
-
-namespace fsm {
-
-class AppState;
-
-}  // namespace fsm
-
-namespace xml {
-
-class UpdateRequest;
-class UpdateResponse;
-
-}  // namespace xml
-
-class AppBundle;
-class AppVersion;
-class CurrentAppState;
-
-class App : public ModelObject {
- public:
-  App(const GUID& app_guid, bool is_update, AppBundle* app_bundle);
-  virtual ~App();
-
-  AppVersion* current_version();
-  const AppVersion* current_version() const;
-
-  AppVersion* next_version();
-  const AppVersion* next_version() const;
-
-  AppBundle* app_bundle();
-  const AppBundle* app_bundle() const;
-
-  CString app_guid_string() const;
-
-  // TODO(omaha): refactor so that the app guid setter is only used by tests.
-  GUID app_guid() const;
-  void set_app_guid(const GUID& app_guid);
-
-  CString language() const;
-
-  bool is_eula_accepted() const;
-
-  CString display_name() const;
-
-  CurrentState state() const;
-
-  bool is_install() const { return !is_update(); }
-  bool is_update() const;
-
-  bool has_update_available() const;
-  void set_has_update_available(bool has_update_available);
-
-  GUID iid() const;
-
-  CString client_id() const;
-
-  CString GetExperimentLabels() const;
-
-  CString referral_id() const;
-
-  BrowserType browser_type() const;
-
-  Tristate usage_stats_enable() const;
-
-  CString client_install_data() const;
-
-  CString server_install_data() const;
-  void set_server_install_data(const CString& server_install_data);
-
-  CString brand_code() const;
-
-  uint32 install_time_diff_sec() const;
-
-  ActiveStates did_run() const;
-
-  int days_since_last_active_ping() const;
-  void set_days_since_last_active_ping(int days);
-
-  int days_since_last_roll_call() const;
-  void set_days_since_last_roll_call(int days);
-
-  CString ap() const;
-
-  CString tt_token() const;
-
-  CString server_install_data_index() const;
-
-  HRESULT error_code() const;
-
-  ErrorContext error_context() const;
-
-  int installer_result_code() const;
-
-  int installer_result_extra_code1() const;
-
-  const PingEventVector& ping_events() const;
-
-  AppVersion* working_version();
-  const AppVersion* working_version() const;
-
-  // IApp.
-  STDMETHOD(get_appId)(BSTR* app_id);
-
-  STDMETHOD(get_pv)(BSTR* pv);
-  STDMETHOD(put_pv)(BSTR pv);
-
-  STDMETHOD(get_language)(BSTR* language);
-  STDMETHOD(put_language)(BSTR language);
-
-  STDMETHOD(get_ap)(BSTR* ap);
-  STDMETHOD(put_ap)(BSTR ap);
-
-  STDMETHOD(get_ttToken)(BSTR* tt_token);
-  STDMETHOD(put_ttToken)(BSTR tt_token);
-
-  STDMETHOD(get_iid)(BSTR* iid);
-  STDMETHOD(put_iid)(BSTR iid);
-
-  STDMETHOD(get_brandCode)(BSTR* brand_code);
-  STDMETHOD(put_brandCode)(BSTR brand_code);
-
-  STDMETHOD(get_clientId)(BSTR* client_id);
-  STDMETHOD(put_clientId)(BSTR client_id);
-
-  STDMETHOD(get_labels)(BSTR* labels);
-  STDMETHOD(put_labels)(BSTR labels);
-
-  STDMETHOD(get_referralId)(BSTR* referral_id);
-  STDMETHOD(put_referralId)(BSTR referral_id);
-
-  STDMETHOD(get_installTimeDiffSec)(UINT* install_time_diff_sec);
-
-  STDMETHOD(get_isEulaAccepted)(VARIANT_BOOL* is_eula_accepted);
-  STDMETHOD(put_isEulaAccepted)(VARIANT_BOOL is_eula_accepted);
-
-  STDMETHOD(get_displayName)(BSTR* display_name);
-  STDMETHOD(put_displayName)(BSTR display_name);
-
-  STDMETHOD(get_browserType)(UINT* browser_type);
-  STDMETHOD(put_browserType)(UINT browser_type);
-
-  STDMETHOD(get_clientInstallData)(BSTR* data);
-  STDMETHOD(put_clientInstallData)(BSTR data);
-
-  STDMETHOD(get_serverInstallDataIndex)(BSTR* index);
-  STDMETHOD(put_serverInstallDataIndex)(BSTR index);
-
-  STDMETHOD(get_usageStatsEnable)(UINT* usage_stats_enable);
-  STDMETHOD(put_usageStatsEnable)(UINT usage_stats_enable);
-
-  STDMETHOD(get_currentState)(IDispatch** current_state);
-
-  // Sets the error context and the completion message.
-  void SetNoUpdate(const ErrorContext& error_context, const CString& message);
-  void SetError(const ErrorContext& error_context, const CString& message);
-
-  // Records the details of the installer success or failure.
-  void SetInstallerResult(const InstallerResultInfo& result_info);
-
-  // Gets the appropriate installer data regardless of the source. Only valid
-  // in STATE_UPDATE_AVAILABLE and later.
-  CString GetInstallData() const;
-
-
-  //
-  // App state machine transition conditions. These functions make
-  // the application change states.
-  //
-
-  // Sets the app to Waiting To Check.
-  void QueueUpdateCheck();
-
-  // Adds the app to the update request.
-  void PreUpdateCheck(xml::UpdateRequest* update_request);
-
-  // Processes the update response for the app.
-  void PostUpdateCheck(HRESULT result, xml::UpdateResponse* update_response);
-
-  // Sets the app to Waiting To Download.
-  void QueueDownload();
-
-  // Sets the app to Waiting To Download or Waiting To Install depending on the
-  // current state.
-  void QueueDownloadOrInstall();
-
-  // Initiates download of the app if necessary.
-  void Download(DownloadManagerInterface* download_manager);
-
-  // Reports that the download is in progress. May be called multiple times.
-  void Downloading();
-
-  // Reports that all packages have been downloaded.
-  void DownloadComplete();
-
-  // Sets the app to Ready To install.
-  void MarkReadyToInstall();
-
-  // Sets the app to Waiting To Install.
-  void QueueInstall();
-
-  // Initiates installation of the app.
-  void Install(InstallManagerInterface* install_manager);
-
-  // Reports that the install is in progress. May be called multiple times.
-  void Installing();
-
-  // Reports that the app installer has completed. Can be success or failure.
-  void ReportInstallerComplete(const InstallerResultInfo& result_info);
-
-  // TODO(omaha3): What does this pause?
-  void Pause();
-
-  // Cancels the app install.
-  void Cancel();
-
-  // Stops installation in the Error state.
-  void Error(const ErrorContext& error_context, const CString& message);
-
-  // For logging support.
-  CString FetchAndResetLogText();
-  void LogTextAppendFormat(const TCHAR* format, ...);
-
-  // Adds an event to the app's ping, which is sent when the bundle is
-  // destroyed. In most cases, pings should be added in
-  // AppState::CreatePingEvent().
-  void AddPingEvent(const PingEventPtr& ping_event);
-
-  // Returns an error if update/install, as determined by is_update_, is
-  // disabled by Group Policy.
-  HRESULT CheckGroupPolicy() const;
-
-  // Sets current time as download start time.
-  void SetDownloadStartTime();
-
-  // Sets current time as download complete time.
-  void SetDownloadCompleteTime();
-
-  // Updates num bytes downloaded by adding newly downloaded bytes.
-  void UpdateNumBytesDownloaded(uint64 num_bytes);
-
-  // Returns how long it takes for the download manager to download this app.
-  int GetDownloadTimeMs() const;
-
-  // Returns how many bytes are actually downloaded.
-  uint64 num_bytes_downloaded() const;
-
-  // Returns the size sum of all packages for this app.
-  uint64 GetPackagesTotalSize() const;
-
- private:
-  // TODO(omaha): accessing directly the data members bypasses locking. Review
-  // the places where members are accessed by friends and check the caller locks
-  // before going directly for the private members.
-  friend class AppManager;
-  friend class AppManagerTestBase;
-
-  // TODO(omaha3): Maybe use a mock in these tests instead.
-  friend class InstallManagerInstallAppTest;
-
-  friend class fsm::AppState;
-
-  // Sets the app state for unit testing.
-  friend void SetAppStateForUnitTest(App* app, fsm::AppState* state);
-
-  HRESULT GetDownloadProgress(uint64* bytes_downloaded,
-                              uint64* bytes_total,
-                              LONG* time_remaining_ms,
-                              uint64* next_retry_time);
-
-  void ChangeState(fsm::AppState* app_state);
-
-  scoped_ptr<fsm::AppState> app_state_;
-
-  scoped_ptr<AppVersion> current_version_;
-  scoped_ptr<AppVersion> next_version_;
-
-  // Alias to the version of the app that is being modified.
-  AppVersion* working_version_;
-
-  PingEventVector ping_events_;
-
-  CString event_log_text_;
-
-  // Weak reference to the containing bundle.
-  AppBundle* app_bundle_;
-
-  // True if the app is in the update scenario.
-  const bool is_update_;
-
-  // True if the server responded that an update is available for the app.
-  // This can happen in both install and update cases.
-  bool has_update_available_;
-
-  GUID app_guid_;
-  CString pv_;
-
-  // These values are stored in Clients. language can be in ClientState too.
-  CString language_;
-  CString display_name_;
-
-  // These values are stored in ClientState.
-  CString ap_;
-  CString tt_token_;
-  GUID iid_;
-  CString brand_code_;
-  CString client_id_;
-  // TODO(omaha3): Rename member and registry value to match the COM property.
-  CString referral_id_;
-  uint32 install_time_diff_sec_;
-  Tristate is_eula_accepted_;
-  BrowserType browser_type_;
-  int days_since_last_active_ping_;
-  int days_since_last_roll_call_;
-
-  // This value is stored in ClientState but not currently populated from there.
-  Tristate usage_stats_enable_;
-
-  // This value is stored by the clients in one of several registry locations.
-  ActiveStates did_run_;
-
-  // This value is not currently persisted in the registry.
-  CString server_install_data_index_;
-
-  // Contains the installer data string specified by the client (usually
-  // contained in /appdata).
-  CString client_install_data_;
-
-  // Contains the installer data string returned by the server for
-  // server_install_data_index_.
-  CString server_install_data_;
-
-  bool is_canceled_;
-  ErrorContext error_context_;
-  CString completion_message_;
-  PingEvent::Results completion_result_;
-  int installer_result_code_;
-  int installer_result_extra_code1_;
-  CString post_install_launch_command_line_;
-  CString post_install_url_;
-  PostInstallAction post_install_action_;
-
-  uint64 previous_total_download_bytes_;
-
-  // Values for download metrics.
-  uint64 download_start_time_ms_;
-  uint64 download_complete_time_ms_;
-  uint64 num_bytes_downloaded_;
-
-  DISALLOW_COPY_AND_ASSIGN(App);
-};
-
-class ATL_NO_VTABLE AppWrapper
-    : public ComWrapper<AppWrapper, App>,
-      public IDispatchImpl<IApp,
-                          &__uuidof(IApp),
-                          &CAtlModule::m_libid,
-                          kMajorTypeLibVersion,
-                          kMinorTypeLibVersion> {
- public:
-  // IApp.
-  STDMETHOD(get_currentVersion)(IDispatch** current);
-  STDMETHOD(get_nextVersion)(IDispatch** next);
-  STDMETHOD(get_currentState)(IDispatch** current_state_disp);
-
-  STDMETHOD(get_appId)(BSTR* app_id);
-
-  STDMETHOD(get_pv)(BSTR* pv);
-  STDMETHOD(put_pv)(BSTR pv);
-
-  STDMETHOD(get_language)(BSTR* language);
-  STDMETHOD(put_language)(BSTR language);
-
-  STDMETHOD(get_ap)(BSTR* ap);
-  STDMETHOD(put_ap)(BSTR ap);
-
-  STDMETHOD(get_ttToken)(BSTR* tt_token);
-  STDMETHOD(put_ttToken)(BSTR tt_token);
-
-  STDMETHOD(get_iid)(BSTR* iid);
-  STDMETHOD(put_iid)(BSTR iid);
-
-  STDMETHOD(get_brandCode)(BSTR* brand_code);
-  STDMETHOD(put_brandCode)(BSTR brand_code);
-
-  STDMETHOD(get_clientId)(BSTR* client_id);
-  STDMETHOD(put_clientId)(BSTR client_id);
-
-  STDMETHOD(get_labels)(BSTR* labels);
-  STDMETHOD(put_labels)(BSTR labels);
-
-  STDMETHOD(get_referralId)(BSTR* referral_id);
-  STDMETHOD(put_referralId)(BSTR referral_id);
-
-  STDMETHOD(get_installTimeDiffSec)(UINT* install_time_diff_sec);
-
-  STDMETHOD(get_isEulaAccepted)(VARIANT_BOOL* is_eula_accepted);
-  STDMETHOD(put_isEulaAccepted)(VARIANT_BOOL is_eula_accepted);
-
-  STDMETHOD(get_displayName)(BSTR* display_name);
-  STDMETHOD(put_displayName)(BSTR display_name);
-
-  STDMETHOD(get_browserType)(UINT* browser_type);
-  STDMETHOD(put_browserType)(UINT browser_type);
-
-  STDMETHOD(get_clientInstallData)(BSTR* data);
-  STDMETHOD(put_clientInstallData)(BSTR data);
-
-  STDMETHOD(get_serverInstallDataIndex)(BSTR* index);
-  STDMETHOD(put_serverInstallDataIndex)(BSTR index);
-
-  STDMETHOD(get_usageStatsEnable)(UINT* usage_stats_enable);
-  STDMETHOD(put_usageStatsEnable)(UINT usage_stats_enable);
-
- protected:
-  AppWrapper() {}
-  virtual ~AppWrapper() {}
-
-  BEGIN_COM_MAP(AppWrapper)
-    COM_INTERFACE_ENTRY(IApp)
-    COM_INTERFACE_ENTRY(IDispatch)
-  END_COM_MAP()
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(AppWrapper);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_H_
diff --git a/goopdate/app_bundle.cc b/goopdate/app_bundle.cc
deleted file mode 100644
index bcdc6fe..0000000
--- a/goopdate/app_bundle.cc
+++ /dev/null
@@ -1,896 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include"omaha/goopdate/app_bundle.h"
-#include <atlsafe.h>
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/scoped_impersonation.h"
-#include "omaha/base/user_rights.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/lang.h"
-#include "omaha/common/ping.h"
-#include "omaha/common/update_request.h"
-#include "omaha/common/update_response.h"
-#include "omaha/common/web_services_client.h"
-#include "omaha/goopdate/app_bundle_state_init.h"
-#include "omaha/goopdate/app_manager.h"
-#include "omaha/goopdate/model.h"
-#include "omaha/goopdate/update_request_utils.h"
-
-namespace omaha {
-
-namespace {
-
-const TCHAR* const kDefaultInstallSource = _T("unknown");
-
-}  // namespace
-
-AppBundle::AppBundle(bool is_machine, Model* model)
-    : ModelObject(model),
-      install_source_(kDefaultInstallSource),
-      is_machine_(is_machine),
-      is_auto_update_(false),
-      priority_(INSTALL_PRIORITY_HIGH),
-      parent_hwnd_(NULL),
-      user_work_item_(NULL),
-      display_language_(lang::GetDefaultLanguage(is_machine)) {
-  CORE_LOG(L3, (_T("[AppBundle::AppBundle][0x%p]"), this));
-  app_bundle_state_.reset(new fsm::AppBundleStateInit);
-}
-
-AppBundle::~AppBundle() {
-  CORE_LOG(L3, (_T("[AppBundle::~AppBundle][0x%p]"), this));
-
-  // Destruction of this object is not serialized. The lifetime of AppBundle
-  // objects is controlled by the client and multiple objects can destruct at
-  // the same time.
-  ASSERT1(!model()->IsLockedByCaller());
-
-  HRESULT hr = SendPingEvents();
-  CORE_LOG(L3, (_T("[SendPingEvents returned 0x%x]"), hr));
-
-  __mutexScope(model()->lock());
-  for (size_t i = 0; i < apps_.size(); ++i) {
-    delete apps_[i];
-  }
-
-  // If the thread running this AppBundle does not exit before the
-  // NetworkConfigManager::DeleteInstance() happens in GoopdateImpl::Main, the
-  // update_check_client_ destructor will crash. Resetting here explicitly.
-  update_check_client_.reset();
-
-  // Garbage-collect everything that has expired, including this object.
-  // The model holds weak references to AppBundle objects. Those weak
-  // references expire before the destructor for the object runs. Therefore, it
-  // is not possible to associate this object with any of the weak references
-  // in the model. Those weak references must be garbage collected.
-  model()->CleanupExpiredAppBundles();
-}
-
-ControllingPtr AppBundle::controlling_ptr() {
-  __mutexScope(model()->lock());
-  return shared_from_this();
-}
-
-bool AppBundle::is_pending_non_blocking_call() const {
-  __mutexScope(model()->lock());
-  return user_work_item_ != NULL;
-}
-
-void AppBundle::set_user_work_item(UserWorkItem* user_work_item) {
-  ASSERT(user_work_item, (_T("Use CompleteAsyncCall() instead.")));
-  __mutexScope(model()->lock());
-
-  user_work_item_ = user_work_item;
-}
-
-HANDLE AppBundle::impersonation_token() const {
-  __mutexScope(model()->lock());
-  return alt_impersonation_token_.GetHandle() ?
-         alt_impersonation_token_.GetHandle() :
-         impersonation_token_.GetHandle();
-}
-
-HANDLE AppBundle::primary_token() const {
-  __mutexScope(model()->lock());
-  return alt_primary_token_.GetHandle() ? alt_primary_token_.GetHandle() :
-                                          primary_token_.GetHandle();
-}
-
-HRESULT AppBundle::CaptureCallerImpersonationToken() {
-  __mutexScope(model()->lock());
-
-  if (!is_machine_) {
-    return S_OK;
-  }
-
-  if (impersonation_token_.GetHandle()) {
-    ::CloseHandle(impersonation_token_.Detach());
-  }
-
-  HRESULT hr = UserRights::GetCallerToken(&impersonation_token_);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[CaptureCallerImpersonationToken failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT AppBundle::CaptureCallerPrimaryToken() {
-  __mutexScope(model()->lock());
-
-  if (!is_machine_) {
-    return S_OK;
-  }
-
-  ASSERT1(impersonation_token_.GetHandle());
-  if (!UserRights::TokenIsAdmin(impersonation_token_.GetHandle())) {
-    ASSERT1(false);
-    return E_UNEXPECTED;
-  }
-
-  if (primary_token_.GetHandle()) {
-    ::CloseHandle(primary_token_.Detach());
-  }
-
-  if (!impersonation_token_.CreatePrimaryToken(&primary_token_)) {
-    HRESULT hr = HRESULTFromLastError();
-    CORE_LOG(LE, (_T("[CreatePrimaryToken failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-size_t AppBundle::GetNumberOfApps() const {
-  __mutexScope(model()->lock());
-  return apps_.size();
-}
-
-App* AppBundle::GetApp(size_t index) {
-  __mutexScope(model()->lock());
-
-  if (index >= GetNumberOfApps()) {
-    ASSERT1(false);
-    return NULL;
-  }
-
-  App* app = apps_[index];
-  ASSERT1(app);
-  return app;
-}
-
-CString AppBundle::FetchAndResetLogText() {
-  __mutexScope(model()->lock());
-
-  CString event_log_text;
-  for (size_t i = 0; i < apps_.size(); ++i) {
-    event_log_text += apps_[i]->FetchAndResetLogText();
-  }
-
-  return event_log_text;
-}
-
-HRESULT AppBundle::SendPingEvents() {
-  CORE_LOG(L3, (_T("[AppBundle::SendPingEvents]")));
-
-  scoped_impersonation impersonate_user(impersonation_token());
-
-  if (!ConfigManager::Instance()->CanUseNetwork(is_machine_)) {
-    CORE_LOG(L1, (_T("[Ping not sent because network use prohibited]")));
-    return S_OK;
-  }
-
-  Ping ping(is_machine_, session_id_, install_source_);
-
-  __mutexBlock(model()->lock()) {
-    for (size_t i = 0; i != apps_.size(); ++i) {
-      if (apps_[i]->is_eula_accepted()) {
-        ping.BuildRequest(apps_[i], false);
-      }
-    }
-
-    for (size_t i = 0; i != uninstalled_apps_.size(); ++i) {
-      if (uninstalled_apps_[i]->is_eula_accepted()) {
-        ping.BuildRequest(uninstalled_apps_[i], false);
-      }
-    }
-  }
-
-  CORE_LOG(L3, (_T("[AppBundle::SendPingEvents][sending ping events]")
-                _T("[%d uninstalled apps]"), uninstalled_apps_.size()));
-
-  // TODO(Omaha): Add sample to metric_ping_succeeded_ms or
-  // metric_ping_failed_ms based on the result of Send().
-  return ping.Send(false);
-}
-
-// IAppBundle.
-STDMETHODIMP AppBundle::get_displayName(BSTR* display_name) {
-  ASSERT1(display_name);
-  __mutexScope(model()->lock());
-  *display_name = display_name_.AllocSysString();
-  return S_OK;
-}
-
-STDMETHODIMP AppBundle::put_displayName(BSTR display_name) {
-  __mutexScope(model()->lock());
-  display_name_ = display_name;
-  return S_OK;
-}
-
-STDMETHODIMP AppBundle::get_installSource(BSTR* install_source) {
-  ASSERT1(install_source);
-  __mutexScope(model()->lock());
-  *install_source = install_source_.AllocSysString();
-  return S_OK;
-}
-
-STDMETHODIMP AppBundle::put_installSource(BSTR install_source) {
-  __mutexScope(model()->lock());
-  install_source_ = install_source;
-  return S_OK;
-}
-
-STDMETHODIMP AppBundle::get_originURL(BSTR* origin_url) {
-  ASSERT1(origin_url);
-  __mutexScope(model()->lock());
-  *origin_url = origin_url_.AllocSysString();
-  return S_OK;
-}
-
-STDMETHODIMP AppBundle::put_originURL(BSTR origin_url) {
-  __mutexScope(model()->lock());
-  origin_url_ = origin_url;
-  return S_OK;
-}
-
-STDMETHODIMP AppBundle::get_offlineDirectory(BSTR* offline_dir) {
-  ASSERT1(offline_dir);
-  __mutexScope(model()->lock());
-  *offline_dir = offline_dir_.AllocSysString();
-  return S_OK;
-}
-
-STDMETHODIMP AppBundle::put_offlineDirectory(BSTR offline_dir) {
-  CORE_LOG(L3, (_T("[AppBundle::put_offlineDirectory][%s]"), offline_dir));
-  __mutexScope(model()->lock());
-  offline_dir_ = offline_dir;
-  return S_OK;
-}
-
-STDMETHODIMP AppBundle::get_sessionId(BSTR* session_id) {
-  ASSERT1(session_id);
-  __mutexScope(model()->lock());
-  *session_id = session_id_.AllocSysString();
-  return S_OK;
-}
-
-STDMETHODIMP AppBundle::put_sessionId(BSTR session_id) {
-  CORE_LOG(L3, (_T("[AppBundle::put_sessionId][%s]"), session_id));
-  __mutexScope(model()->lock());
-  return app_bundle_state_->put_sessionId(this, session_id);
-}
-
-STDMETHODIMP AppBundle::get_priority(long* priority) {  // NOLINT
-  ASSERT1(priority);
-  __mutexScope(model()->lock());
-  *priority = priority_;
-  return S_OK;
-}
-
-STDMETHODIMP AppBundle::put_priority(long priority) {  // NOLINT
-  if ((priority < INSTALL_PRIORITY_LOW) || (priority > INSTALL_PRIORITY_HIGH)) {
-    return E_INVALIDARG;
-  }
-  __mutexScope(model()->lock());
-  priority_ = priority;
-  return S_OK;
-}
-
-STDMETHODIMP AppBundle::put_altTokens(ULONG_PTR impersonation_token,
-                                      ULONG_PTR primary_token,
-                                      DWORD caller_proc_id) {
-  ASSERT1(impersonation_token);
-  ASSERT1(primary_token);
-  ASSERT1(caller_proc_id);
-  __mutexScope(model()->lock());
-
-  return app_bundle_state_->put_altTokens(this,
-                                          impersonation_token,
-                                          primary_token,
-                                          caller_proc_id);
-}
-
-STDMETHODIMP AppBundle::put_parentHWND(ULONG_PTR hwnd) {
-  CORE_LOG(L3, (_T("[AppBundle::put_parentHWND][0x%x]"), hwnd));
-
-  __mutexScope(model()->lock());
-  parent_hwnd_ = reinterpret_cast<HWND>(hwnd);
-  update_check_client_->set_proxy_auth_config(GetProxyAuthConfig());
-  return S_OK;
-}
-
-CString AppBundle::display_language() const {
-  __mutexScope(model()->lock());
-  return display_language_;
-}
-
-STDMETHODIMP AppBundle::get_displayLanguage(BSTR* language) {
-  ASSERT1(language);
-  __mutexScope(model()->lock());
-  *language = display_language_.AllocSysString();
-  return S_OK;
-}
-
-STDMETHODIMP AppBundle::put_displayLanguage(BSTR language) {
-  __mutexScope(model()->lock());
-  if (::SysStringLen(language) == 0) {
-    return E_INVALIDARG;
-  }
-
-  if (!lang::IsLanguageSupported(language)) {
-    return E_INVALIDARG;
-  }
-
-  display_language_ = language;
-  return S_OK;
-}
-
-bool AppBundle::is_machine() const {
-  __mutexScope(model()->lock());
-  return is_machine_;
-}
-
-bool AppBundle::is_auto_update() const {
-  __mutexScope(model()->lock());
-  return is_auto_update_;
-}
-
-void AppBundle::set_is_auto_update(bool is_auto_update) {
-  __mutexScope(model()->lock());
-  is_auto_update_ = is_auto_update;
-}
-
-bool AppBundle::is_offline_install() const {
-  __mutexScope(model()->lock());
-  return !offline_dir_.IsEmpty();
-}
-
-const CString& AppBundle::offline_dir() const {
-  __mutexScope(model()->lock());
-  return offline_dir_;
-}
-
-const CString& AppBundle::session_id() const {
-  __mutexScope(model()->lock());
-  return session_id_;
-}
-
-int AppBundle::priority() const {
-  __mutexScope(model()->lock());
-  return priority_;
-}
-
-ProxyAuthConfig AppBundle::GetProxyAuthConfig() const {
-  __mutexScope(model()->lock());
-  return ProxyAuthConfig(parent_hwnd_, display_name_);
-}
-
-STDMETHODIMP AppBundle::initialize() {
-  __mutexScope(model()->lock());
-
-  // Ensure that clients that run as Local System were designed with alt tokens
-  // in mind. The alt tokens might not always be a different user, but at least
-  // the client considered the need to set the alt tokens.
-  // TODO(omaha): The /ua process should not need to call put_altTokens()
-  // when there is no logged in user. This may be causing issues on Windows 7.
-  bool alt_tokens_set(alt_impersonation_token_.GetHandle() &&
-                      alt_primary_token_.GetHandle());
-  ASSERT1(!is_machine_ ||
-          alt_tokens_set ||
-          !UserRights::VerifyCallerIsSystem());
-
-  return app_bundle_state_->Initialize(this);
-}
-
-// App is created with is_update=false because the caller is not using
-// information about any installed app. It is either a new or over-install.
-STDMETHODIMP AppBundle::createApp(BSTR app_id, App** app) {
-  CORE_LOG(L1, (_T("[AppBundle::createApp][%s][0x%p]"), app_id, this));
-  ASSERT1(app_id);
-  ASSERT1(app);
-
-  __mutexScope(model()->lock());
-
-  scoped_impersonation impersonate_user(impersonation_token());
-  HRESULT hr = impersonate_user.result();
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Impersonation failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return app_bundle_state_->CreateApp(this, app_id, app);
-}
-
-STDMETHODIMP AppBundle::createInstalledApp(BSTR app_id, App** app) {
-  CORE_LOG(L1, (_T("[AppBundle::createInstalledApp][%s][0x%p]"), app_id, this));
-  ASSERT1(app);
-
-  __mutexScope(model()->lock());
-
-
-  scoped_impersonation impersonate_user(impersonation_token());
-  HRESULT hr = impersonate_user.result();
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Impersonation failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return app_bundle_state_->CreateInstalledApp(this, app_id, app);
-}
-
-STDMETHODIMP AppBundle::createAllInstalledApps() {
-  CORE_LOG(L1, (_T("[AppBundle::createAllInstalledApps][0x%p]"), this));
-
-  __mutexScope(model()->lock());
-
-  scoped_impersonation impersonate_user(impersonation_token());
-  HRESULT hr = impersonate_user.result();
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Impersonation failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return app_bundle_state_->CreateAllInstalledApps(this);
-}
-
-STDMETHODIMP AppBundle::get_Count(long* count) {  // NOLINT
-  ASSERT1(count);
-
-  __mutexScope(model()->lock());
-
-  *count = apps_.size();
-
-  return S_OK;
-}
-
-STDMETHODIMP AppBundle::get_Item(long index, App** app) {  // NOLINT
-  ASSERT1(app);
-
-  __mutexScope(model()->lock());
-
-  if (index < 0 || static_cast<size_t>(index) >= apps_.size()) {
-    return HRESULT_FROM_WIN32(ERROR_INVALID_INDEX);
-  }
-
-  *app = apps_[index];
-  return S_OK;
-}
-
-WebServicesClientInterface* AppBundle::update_check_client() {
-  __mutexScope(model()->lock());
-  ASSERT1(update_check_client_.get());
-  return update_check_client_.get();
-}
-
-STDMETHODIMP AppBundle::checkForUpdate() {
-  CORE_LOG(L1, (_T("[AppBundle::checkForUpdate][0x%p]"), this));
-
-  __mutexScope(model()->lock());
-
-  scoped_impersonation impersonate_user(impersonation_token());
-  HRESULT hr = impersonate_user.result();
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Impersonation failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return app_bundle_state_->CheckForUpdate(this);
-}
-
-STDMETHODIMP AppBundle::download() {
-  CORE_LOG(L1, (_T("[AppBundle::download][0x%p]"), this));
-
-  __mutexScope(model()->lock());
-
-  scoped_impersonation impersonate_user(impersonation_token());
-  HRESULT hr = impersonate_user.result();
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Impersonation failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return app_bundle_state_->Download(this);
-}
-
-// Captures the primary token since it is the only function that needs it, and
-// to prevent any scenarios where one user sets up a bundle and another installs
-// the app(s) with the other user's credentials.
-STDMETHODIMP AppBundle::install() {
-  CORE_LOG(L1, (_T("[AppBundle::install][0x%p]"), this));
-
-  __mutexScope(model()->lock());
-
-  HRESULT hr = CaptureCallerPrimaryToken();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  scoped_impersonation impersonate_user(impersonation_token());
-  hr = impersonate_user.result();
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Impersonation failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return app_bundle_state_->Install(this);
-}
-
-STDMETHODIMP AppBundle::updateAllApps() {
-  CORE_LOG(L1, (_T("[AppBundle::updateAllApps][0x%p]"), this));
-
-  __mutexScope(model()->lock());
-
-  scoped_impersonation impersonate_user(impersonation_token());
-  HRESULT hr = impersonate_user.result();
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Impersonation failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return app_bundle_state_->UpdateAllApps(this);
-}
-
-STDMETHODIMP AppBundle::stop() {
-  CORE_LOG(L1, (_T("[AppBundle::stop][0x%p]"), this));
-
-  __mutexScope(model()->lock());
-
-  return app_bundle_state_->Stop(this);
-}
-
-STDMETHODIMP AppBundle::pause() {
-  CORE_LOG(L1, (_T("[AppBundle::pause][0x%p]"), this));
-
-  __mutexScope(model()->lock());
-
-  return app_bundle_state_->Pause(this);
-}
-
-STDMETHODIMP AppBundle::resume() {
-  CORE_LOG(L1, (_T("[AppBundle::resume][0x%p]"), this));
-
-  __mutexScope(model()->lock());
-
-  return app_bundle_state_->Resume(this);
-}
-
-STDMETHODIMP AppBundle::isBusy(VARIANT_BOOL* is_busy) {
-  CORE_LOG(L3, (_T("[AppBundle::isBusy][0x%p]"), this));
-  ASSERT1(is_busy);
-
-  __mutexScope(model()->lock());
-
-  *is_busy = IsBusy() ? VARIANT_TRUE : VARIANT_FALSE;
-  return S_OK;
-}
-
-STDMETHODIMP AppBundle::downloadPackage(BSTR app_id, BSTR package_name) {
-  CORE_LOG(L1, (_T("[AppBundle::downloadPackage][%s][%s]"),
-      app_id, package_name));
-
-  __mutexScope(model()->lock());
-
-  scoped_impersonation impersonate_user(impersonation_token());
-  HRESULT hr = impersonate_user.result();
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Impersonation failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return app_bundle_state_->DownloadPackage(this, app_id, package_name);
-}
-
-// TODO(omaha3): May need to provide aggregate status. See TODO in IDL file.
-STDMETHODIMP AppBundle::get_currentState(VARIANT* current_state) {
-  CORE_LOG(L3, (_T("[AppBundle::get_currentState][0x%p]"), this));
-  ASSERT1(current_state);
-  UNREFERENCED_PARAMETER(current_state);
-  ASSERT(false, (_T("Not implemented. Should not call at this time.")));
-  return E_NOTIMPL;
-}
-
-// This function is only called internal to the COM server and affects a
-// separate vector of Apps, so it can be called in any state.
-// It assumes all calls have a unique app_id.
-HRESULT AppBundle::CreateUninstalledApp(const CString& app_id, App** app) {
-  CORE_LOG(L1, (_T("[AppBundle::CreateUninstalledApp][%s][0x%p]"),
-                app_id, this));
-  ASSERT1(app);
-
-  __mutexScope(model()->lock());
-
-  GUID app_guid = {0};
-  HRESULT hr = StringToGuidSafe(app_id, &app_guid);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[invalid app id][%s]"), app_id));
-    return hr;
-  }
-
-  scoped_ptr<App> local_app(new App(app_guid, true, this));
-
-  hr = AppManager::Instance()->ReadUninstalledAppPersistentData(
-           local_app.get());
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[ReadUninstalledAppPersistentData failed][0x%x][%s]"),
-                  hr, app_id));
-    return hr;
-  }
-
-  uninstalled_apps_.push_back(local_app.get());
-
-  *app = local_app.release();
-  return S_OK;
-}
-
-void AppBundle::CompleteAsyncCall() {
-  __mutexScope(model()->lock());
-
-  ASSERT1(is_pending_non_blocking_call());
-
-  VERIFY1(SUCCEEDED(app_bundle_state_->CompleteAsyncCall(this)));
-
-  user_work_item_ = NULL;
-}
-
-bool AppBundle::IsBusy() const {
-  __mutexScope(model()->lock());
-  const bool is_busy = app_bundle_state_->IsBusy();
-  CORE_LOG(L3, (_T("[AppBundle::isBusy returned][0x%p][%u]"), this, is_busy));
-  return is_busy;
-}
-
-void AppBundle::ChangeState(fsm::AppBundleState* app_bundle_state) {
-  ASSERT1(app_bundle_state);
-  ASSERT1(model()->IsLockedByCaller());
-
-  app_bundle_state_.reset(app_bundle_state);
-}
-
-
-//
-// AppBundleWrapper implementation.
-//
-
-AppBundleWrapper::AppBundleWrapper() {
-  CORE_LOG(L3, (_T("[AppBundleWrapper::AppBundleWrapper][0x%p]"), this));
-}
-
-AppBundleWrapper::~AppBundleWrapper() {
-  CORE_LOG(L3, (_T("[AppBundleWrapper::~AppBundleWrapper][0x%p]"), this));
-}
-
-//
-// IAppBundle.
-//
-
-STDMETHODIMP AppBundleWrapper::get_displayName(BSTR* display_name) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_displayName(display_name);
-}
-
-STDMETHODIMP AppBundleWrapper::put_displayName(BSTR display_name) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_displayName(display_name);
-}
-
-STDMETHODIMP AppBundleWrapper::get_installSource(BSTR* install_source) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_installSource(install_source);
-}
-
-STDMETHODIMP AppBundleWrapper::put_installSource(BSTR install_source) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_installSource(install_source);
-}
-
-STDMETHODIMP AppBundleWrapper::get_originURL(BSTR* origin_url) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_originURL(origin_url);
-}
-
-STDMETHODIMP AppBundleWrapper::put_originURL(BSTR origin_url) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_originURL(origin_url);
-}
-
-STDMETHODIMP AppBundleWrapper::get_offlineDirectory(BSTR* offline_dir) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_offlineDirectory(offline_dir);
-}
-
-STDMETHODIMP AppBundleWrapper::put_offlineDirectory(BSTR offline_dir) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_offlineDirectory(offline_dir);
-}
-
-STDMETHODIMP AppBundleWrapper::get_sessionId(BSTR* session_id) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_sessionId(session_id);
-}
-
-STDMETHODIMP AppBundleWrapper::put_sessionId(BSTR session_id) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_sessionId(session_id);
-}
-
-STDMETHODIMP AppBundleWrapper::get_priority(long* priority) {  // NOLINT
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_priority(priority);
-}
-
-STDMETHODIMP AppBundleWrapper::put_priority(long priority) {  // NOLINT
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_priority(priority);
-}
-
-STDMETHODIMP AppBundleWrapper::put_altTokens(ULONG_PTR impersonation_token,
-                                             ULONG_PTR primary_token,
-                                             DWORD caller_proc_id) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_altTokens(impersonation_token,
-                                      primary_token,
-                                      caller_proc_id);
-}
-
-STDMETHODIMP AppBundleWrapper::put_parentHWND(ULONG_PTR hwnd) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_parentHWND(hwnd);
-}
-
-STDMETHODIMP AppBundleWrapper::get_displayLanguage(BSTR* language) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_displayLanguage(language);
-}
-STDMETHODIMP AppBundleWrapper::put_displayLanguage(BSTR language) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->put_displayLanguage(language);
-}
-
-STDMETHODIMP AppBundleWrapper::initialize() {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->initialize();
-}
-
-STDMETHODIMP AppBundleWrapper::createApp(BSTR app_id, IDispatch** app_disp) {
-  __mutexScope(model()->lock());
-
-  App* app = NULL;
-  HRESULT hr = wrapped_obj()->createApp(app_id, &app);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return AppWrapper::Create(controlling_ptr(), app, app_disp);
-}
-
-STDMETHODIMP AppBundleWrapper::createInstalledApp(BSTR appId,
-                                                  IDispatch** app_disp) {
-  __mutexScope(model()->lock());
-
-  App* app = NULL;
-  HRESULT hr = wrapped_obj()->createInstalledApp(appId, &app);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return AppWrapper::Create(controlling_ptr(), app, app_disp);
-}
-
-STDMETHODIMP AppBundleWrapper::createAllInstalledApps() {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->createAllInstalledApps();
-}
-
-STDMETHODIMP AppBundleWrapper::get_Count(long* count) {  // NOLINT
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_Count(count);
-}
-
-STDMETHODIMP AppBundleWrapper::get_Item(long index, IDispatch** app_disp) {  // NOLINT
-  __mutexScope(model()->lock());
-
-  App* app = NULL;
-  HRESULT hr = wrapped_obj()->get_Item(index, &app);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return AppWrapper::Create(controlling_ptr(), app, app_disp);
-}
-
-STDMETHODIMP AppBundleWrapper::checkForUpdate() {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->checkForUpdate();
-}
-
-STDMETHODIMP AppBundleWrapper::download() {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->download();
-}
-
-STDMETHODIMP AppBundleWrapper::install() {
-  if (wrapped_obj()->is_machine() && !UserRights::VerifyCallerIsAdmin()) {
-    ASSERT(false, (_T("AppBundle::install - Caller not an admin")));
-    return E_ACCESSDENIED;
-  }
-
-  __mutexScope(model()->lock());
-  return wrapped_obj()->install();
-}
-
-STDMETHODIMP AppBundleWrapper::updateAllApps() {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->updateAllApps();
-}
-
-STDMETHODIMP AppBundleWrapper::stop() {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->stop();
-}
-
-STDMETHODIMP AppBundleWrapper::pause() {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->pause();
-}
-
-STDMETHODIMP AppBundleWrapper::resume() {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->resume();
-}
-
-STDMETHODIMP AppBundleWrapper::isBusy(VARIANT_BOOL* is_busy) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->isBusy(is_busy);
-}
-
-STDMETHODIMP AppBundleWrapper::downloadPackage(BSTR app_id, BSTR package_name) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->downloadPackage(app_id, package_name);
-}
-
-STDMETHODIMP AppBundleWrapper::get_currentState(VARIANT* current_state) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_currentState(current_state);
-}
-
-
-// Sets app bundle's app_state to state. Used by unit tests to set up the state
-// to the correct precondition for the test case. AppBundle friends this
-// function, allowing it to call the private member function.
-void SetAppBundleStateForUnitTest(AppBundle* app_bundle,
-                                  fsm::AppBundleState* state) {
-  ASSERT1(app_bundle);
-  ASSERT1(state);
-  __mutexScope(app_bundle->model()->lock());
-  app_bundle->ChangeState(state);
-}
-
-}  // namespace omaha
diff --git a/goopdate/app_bundle.h b/goopdate/app_bundle.h
deleted file mode 100644
index 82fbd72..0000000
--- a/goopdate/app_bundle.h
+++ /dev/null
@@ -1,298 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Defines the AppBundle COM object exposed by the model.
-
-#ifndef OMAHA_GOOPDATE_APP_BUNDLE_H_
-#define OMAHA_GOOPDATE_APP_BUNDLE_H_
-
-#include <windows.h>
-#include <atlbase.h>
-#include <atlcom.h>
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "goopdate/omaha3_idl.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/goopdate/com_wrapper_creator.h"
-#include "omaha/goopdate/model_object.h"
-#include "omaha/net/proxy_auth.h"
-#include "third_party/bar/shared_ptr.h"
-
-namespace omaha {
-
-// TODO(omaha): needs to figure out a smaller public interface that
-// Worker expose for the model. AppBundle needs to delegate calls to Worker,
-// such as Pause, Resume, Update, Install, etc...
-
-class App;
-class Model;
-class WebServicesClientInterface;
-class UserWorkItem;
-
-namespace fsm {
-
-class AppBundleState;
-class AppBundleStateInit;
-
-}  // namespace fsm
-
-// AppBundle instances are reference-counted using shared pointers. Lifetime
-// of an AppBundle instance is controlled by both external and internal
-// outstanding references. External reference are the COM wrappers that depend
-// on the AppBundle, including its children in the object model.
-// Internal references to the AppBundle are maintained by several objects that
-// depend on the bundle objects.
-class AppBundle
-    : public ModelObject,
-      public enable_shared_from_this<AppBundle> {
- public:
-  AppBundle(bool is_machine, Model* model);
-  virtual ~AppBundle();
-
-  // IAppBundle.
-  STDMETHOD(get_displayName)(BSTR* display_name);
-  STDMETHOD(put_displayName)(BSTR display_name);
-  STDMETHOD(get_displayLanguage)(BSTR* language);
-  STDMETHOD(put_displayLanguage)(BSTR language);
-  STDMETHOD(get_installSource)(BSTR* install_source);
-  STDMETHOD(put_installSource)(BSTR install_source);
-  STDMETHOD(get_originURL)(BSTR* origin_url);
-  STDMETHOD(put_originURL)(BSTR origin_url);
-  STDMETHOD(get_offlineDirectory)(BSTR* offline_dir);
-  STDMETHOD(put_offlineDirectory)(BSTR offline_dir);
-  STDMETHOD(get_sessionId)(BSTR* session_id);
-  STDMETHOD(put_sessionId)(BSTR session_id);
-  STDMETHOD(get_priority)(long* priority);  // NOLINT
-  STDMETHOD(put_priority)(long priority);  // NOLINT
-  STDMETHOD(get_Count)(long* count);  // NOLINT
-  STDMETHOD(get_Item)(long index, App** app);  // NOLINT
-  STDMETHOD(put_altTokens)(ULONG_PTR impersonation_token,
-                           ULONG_PTR primary_token,
-                           DWORD caller_proc_id);
-  STDMETHOD(put_parentHWND)(ULONG_PTR hwnd);
-  STDMETHOD(initialize)();
-  STDMETHOD(createApp)(BSTR app_id, App** app);
-  STDMETHOD(createInstalledApp)(BSTR app_id, App** app);
-  STDMETHOD(createAllInstalledApps)();
-  STDMETHOD(checkForUpdate)();
-  STDMETHOD(download)();
-  STDMETHOD(install)();
-  STDMETHOD(updateAllApps)();
-  STDMETHOD(stop)();
-  STDMETHOD(pause)();
-  STDMETHOD(resume)();
-  STDMETHOD(isBusy)(VARIANT_BOOL* is_busy);
-  STDMETHOD(downloadPackage)(BSTR app_id, BSTR package_name);
-  STDMETHOD(get_currentState)(VARIANT* current_state);
-
-  // Creates an App for each uninstalled app and adds it to
-  HRESULT CreateUninstalledApp(const CString& app_id, App** app);
-
-  // Marks an asynchronous operation complete.
-  void CompleteAsyncCall();
-
-  bool IsBusy() const;
-
-  // Returns a shared pointer to this instance of the class under the
-  // assumption that the instance is already managed by a shared pointer.
-  // This shared pointer controls the lifetime of the app bundle object and
-  // all its children.
-  ControllingPtr controlling_ptr();
-
-  void set_user_work_item(UserWorkItem* user_work_item);
-
-  const CString& install_source() const { return install_source_; }
-
-  const CString& origin_url() const { return origin_url_; }
-
-  // Gets the impersonation token of the current COM caller.
-  HANDLE impersonation_token() const;
-
-  // Gets the primary token of the current COM caller.
-  HANDLE primary_token() const;
-
-  size_t GetNumberOfApps() const;
-
-  App* GetApp(size_t index);
-
-  WebServicesClientInterface* update_check_client();
-
-  bool is_machine() const;
-
-  bool is_auto_update() const;
-  void set_is_auto_update(bool is_auto_update);
-
-  bool is_offline_install() const;
-
-  const CString& offline_dir() const;
-
-  const CString& session_id() const;
-
-  CString display_language() const;
-
-  int priority() const;
-
-  ProxyAuthConfig GetProxyAuthConfig() const;
-
-  // Gathers accumulated event logs from all child apps and clears the
-  // log buffer in each app.
-  CString FetchAndResetLogText();
-
- private:
-  // Sets the state for unit testing.
-  friend void SetAppBundleStateForUnitTest(AppBundle* app_bundle,
-                                           fsm::AppBundleState* state);
-
-  // TODO(omaha): missing unit test.
-  // Sends the ping if the applications in the bundle have accumulated
-  // any ping events.
-  HRESULT SendPingEvents();
-
-  // These methods capture the current COM caller tokens.
-  HRESULT CaptureCallerImpersonationToken();
-  HRESULT CaptureCallerPrimaryToken();
-
-  void ChangeState(fsm::AppBundleState* app_bundle_state);
-
-  bool is_pending_non_blocking_call() const;
-
-  CString display_name_;
-  CString install_source_;
-  CString origin_url_;
-
-  bool is_machine_;
-
-  // True if the bundle is an update bundle.
-  bool is_auto_update_;
-
-  int priority_;
-
-  HWND parent_hwnd_;
-
-  CString offline_dir_;
-
-  // Contains the session ID - a unique marker that we include with each
-  // server communication (update checks, pings, etc.) in a single Omaha task.
-  // Clients are expected to set this on a bundle before calling initialize();
-  // if they don't, we will randomly generate one.
-  CString session_id_;
-
-  // The current non-blocking command object if any of them is executing.
-  // The class only checks whether the pointer is NULL to determine if a
-  // non-blocking call is pending. We use a pointer because it can be useful
-  // for debugging.
-  UserWorkItem* user_work_item_;
-
-  scoped_ptr<WebServicesClientInterface> update_check_client_;
-
-  // The apps in the bundle. Do not add to it directly; use AddApp() instead.
-  std::vector<App*> apps_;
-
-  // Uninstalled apps. Not accessible and only used to store Apps for
-  // uninstalled app IDs so that app uninstall pings can be sent along with
-  // other pings.
-  std::vector<App*> uninstalled_apps_;
-
-  scoped_ptr<fsm::AppBundleState> app_bundle_state_;
-
-  // Impersonation and primary tokens set by the client. Typically only
-  // set by the gupdatem service. The gupdatem service exposes a narrow
-  // interface to medium integrity clients. When a medium integrity client calls
-  // into the gupdatem service, the gupdatem service captures the token of the
-  // caller, and then calls put_altTokens() on the gupdate service, so that the
-  // gupdate service can use it for future download() and install() requests.
-  CAccessToken alt_impersonation_token_;
-  CAccessToken alt_primary_token_;
-
-  // The current COM caller's impersonation token.
-  CAccessToken impersonation_token_;
-
-  // The current COM caller's primary token. Lazy initialized at the install()
-  // entry point.
-  CAccessToken primary_token_;
-
-  // COM caller's display language.
-  CString display_language_;
-
-  friend class fsm::AppBundleState;
-  friend class fsm::AppBundleStateInit;
-
-  friend class AppBundleTest;
-  friend class WorkerTest;
-
-  DISALLOW_COPY_AND_ASSIGN(AppBundle);
-};
-
-class ATL_NO_VTABLE AppBundleWrapper
-    : public ComWrapper<AppBundleWrapper, AppBundle>,
-      public IDispatchImpl<IAppBundle,
-                           &__uuidof(IAppBundle),
-                           &CAtlModule::m_libid,
-                           kMajorTypeLibVersion,
-                           kMinorTypeLibVersion> {
- public:
-  AppBundleWrapper();
-  virtual ~AppBundleWrapper();
-
-  // IAppBundle.
-  STDMETHOD(get_displayName)(BSTR* display_name);
-  STDMETHOD(put_displayName)(BSTR display_name);
-  STDMETHOD(get_displayLanguage)(BSTR* language);
-  STDMETHOD(put_displayLanguage)(BSTR language);
-  STDMETHOD(get_installSource)(BSTR* install_source);
-  STDMETHOD(put_installSource)(BSTR install_source);
-  STDMETHOD(get_originURL)(BSTR* origin_url);
-  STDMETHOD(put_originURL)(BSTR origin_url);
-  STDMETHOD(get_offlineDirectory)(BSTR* offline_dir);
-  STDMETHOD(put_offlineDirectory)(BSTR offline_dir);
-  STDMETHOD(get_sessionId)(BSTR* session_id);
-  STDMETHOD(put_sessionId)(BSTR session_id);
-  STDMETHOD(get_priority)(long* priority);  // NOLINT
-  STDMETHOD(put_priority)(long priority);  // NOLINT
-  STDMETHOD(get_Count)(long* count);  // NOLINT
-  STDMETHOD(get_Item)(long index, IDispatch** app_disp);  // NOLINT
-  STDMETHOD(put_altTokens)(ULONG_PTR impersonation_token,
-                           ULONG_PTR primary_token,
-                           DWORD caller_proc_id);
-  STDMETHOD(put_parentHWND)(ULONG_PTR hwnd);
-  STDMETHOD(initialize)();
-  STDMETHOD(createApp)(BSTR app_id, IDispatch** app_disp);
-  STDMETHOD(createInstalledApp)(BSTR app_id, IDispatch** app_disp);
-  STDMETHOD(createAllInstalledApps)();
-  STDMETHOD(checkForUpdate)();
-  STDMETHOD(download)();
-  STDMETHOD(install)();
-  STDMETHOD(updateAllApps)();
-  STDMETHOD(stop)();
-  STDMETHOD(pause)();
-  STDMETHOD(resume)();
-  STDMETHOD(isBusy)(VARIANT_BOOL* is_busy);
-  STDMETHOD(downloadPackage)(BSTR app_id, BSTR package_name);
-  STDMETHOD(get_currentState)(VARIANT* current_state);
-
- private:
-  BEGIN_COM_MAP(AppBundleWrapper)
-    COM_INTERFACE_ENTRY(IAppBundle)
-    COM_INTERFACE_ENTRY(IDispatch)
-  END_COM_MAP()
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_BUNDLE_H_
diff --git a/goopdate/app_bundle_state.cc b/goopdate/app_bundle_state.cc
deleted file mode 100644
index 5fa69e1..0000000
--- a/goopdate/app_bundle_state.cc
+++ /dev/null
@@ -1,197 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_bundle_state.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/common/web_services_client.h"
-#include "omaha/goopdate/app_bundle_state_busy.h"
-#include "omaha/goopdate/model.h"
-
-namespace omaha {
-
-namespace fsm {
-
-HRESULT AppBundleState::put_altTokens(AppBundle* app_bundle,
-                                      ULONG_PTR impersonation_token,
-                                      ULONG_PTR primary_token,
-                                      DWORD caller_proc_id) {
-  UNREFERENCED_PARAMETER(impersonation_token);
-  UNREFERENCED_PARAMETER(primary_token);
-  UNREFERENCED_PARAMETER(caller_proc_id);
-  return HandleInvalidStateTransition(app_bundle, _T(__FUNCTION__));
-}
-
-HRESULT AppBundleState::put_sessionId(AppBundle* app_bundle, BSTR session_id) {
-  UNREFERENCED_PARAMETER(session_id);
-  return HandleInvalidStateTransition(app_bundle, _T(__FUNCTION__));
-}
-
-HRESULT AppBundleState::Initialize(AppBundle* app_bundle) {
-  return HandleInvalidStateTransition(app_bundle, _T(__FUNCTION__));
-}
-
-HRESULT AppBundleState::CreateApp(AppBundle* app_bundle,
-                                  const CString& app_id,
-                                  App** app) {
-  UNREFERENCED_PARAMETER(app_id);
-  UNREFERENCED_PARAMETER(app);
-  return HandleInvalidStateTransition(app_bundle, _T(__FUNCTION__));
-}
-
-HRESULT AppBundleState::CreateInstalledApp(AppBundle* app_bundle,
-                                           const CString& app_id,
-                                           App** app) {
-  UNREFERENCED_PARAMETER(app_id);
-  UNREFERENCED_PARAMETER(app);
-  return HandleInvalidStateTransition(app_bundle, _T(__FUNCTION__));
-}
-
-HRESULT AppBundleState::CreateAllInstalledApps(AppBundle* app_bundle) {
-  return HandleInvalidStateTransition(app_bundle, _T(__FUNCTION__));
-}
-
-HRESULT AppBundleState::CheckForUpdate(AppBundle* app_bundle) {
-  return HandleInvalidStateTransition(app_bundle, _T(__FUNCTION__));
-}
-
-HRESULT AppBundleState::Download(AppBundle* app_bundle) {
-  return HandleInvalidStateTransition(app_bundle, _T(__FUNCTION__));
-}
-
-HRESULT AppBundleState::Install(AppBundle* app_bundle) {
-  return HandleInvalidStateTransition(app_bundle, _T(__FUNCTION__));
-}
-
-HRESULT AppBundleState::UpdateAllApps(AppBundle* app_bundle) {
-  return HandleInvalidStateTransition(app_bundle, _T(__FUNCTION__));
-}
-
-HRESULT AppBundleState::Stop(AppBundle* app_bundle) {
-  return HandleInvalidStateTransition(app_bundle, _T(__FUNCTION__));
-}
-
-HRESULT AppBundleState::Pause(AppBundle* app_bundle) {
-  return HandleInvalidStateTransition(app_bundle, _T(__FUNCTION__));
-}
-
-HRESULT AppBundleState::Resume(AppBundle* app_bundle) {
-  return HandleInvalidStateTransition(app_bundle, _T(__FUNCTION__));
-}
-
-HRESULT AppBundleState::DownloadPackage(AppBundle* app_bundle,
-                                        const CString& app_id,
-                                        const CString& package_name) {
-  UNREFERENCED_PARAMETER(app_id);
-  UNREFERENCED_PARAMETER(package_name);
-  return HandleInvalidStateTransition(app_bundle, _T(__FUNCTION__));
-}
-
-HRESULT AppBundleState::CompleteAsyncCall(AppBundle* app_bundle) {
-  return HandleInvalidStateTransition(app_bundle, _T(__FUNCTION__));
-}
-
-bool AppBundleState::IsBusy() const {
-  return false;
-}
-
-void AppBundleState::AddAppToBundle(AppBundle* app_bundle, App* app) {
-  ASSERT1(app_bundle);
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-  app_bundle->apps_.push_back(app);
-}
-
-bool AppBundleState::IsPendingNonBlockingCall(AppBundle* app_bundle) {
-  ASSERT1(app_bundle);
-  return app_bundle->is_pending_non_blocking_call();
-}
-
-HRESULT AppBundleState::DoDownloadPackage(AppBundle* app_bundle,
-                                          const CString& app_id,
-                                          const CString& package_name) {
-  CORE_LOG(L3, (_T("[AppBundleState::DoDownloadPackage][0x%p]"), app_bundle));
-  ASSERT1(app_bundle);
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-  ASSERT1(!IsPendingNonBlockingCall(app_bundle));
-
-  GUID app_guid = {0};
-  HRESULT hr = StringToGuidSafe(app_id, &app_guid);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  App* app = NULL;
-  for (size_t i = 0; i != app_bundle->GetNumberOfApps(); ++i) {
-    App* candidate_app = app_bundle->GetApp(i);
-    if (::IsEqualGUID(candidate_app->app_guid(), app_guid)) {
-      app = candidate_app;
-      break;
-    }
-  }
-
-  if (!app) {
-    return E_INVALIDARG;
-  }
-
-  // Only packages of installed applications can be downloaded.
-  Package* package = NULL;
-  AppVersion* version = app->current_version();
-  for (size_t i = 0; i != version->GetNumberOfPackages(); ++i) {
-    if (version->GetPackage(i)->filename() == package_name) {
-      package = version->GetPackage(i);
-      break;
-    }
-  }
-
-  if (!package) {
-    return E_INVALIDARG;
-  }
-
-  hr = app_bundle->model()->DownloadPackage(package);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[DownloadPackage failed][0x%x][0x%p]"), hr, app_bundle));
-    return hr;
-  }
-
-  ChangeState(app_bundle, new AppBundleStateBusy);
-  return S_OK;
-}
-
-void AppBundleState::ChangeState(AppBundle* app_bundle, AppBundleState* state) {
-  ASSERT1(app_bundle);
-  ASSERT1(state);
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-  CORE_LOG(L3, (_T("[AppBundleState::ChangeState][0x%p][from: %u][to: %u]"),
-                app_bundle, state_, state->state_));
-
-  app_bundle->ChangeState(state);
-}
-
-HRESULT AppBundleState::HandleInvalidStateTransition(
-    AppBundle* app_bundle,
-    const TCHAR* function_name) {
-  UNREFERENCED_PARAMETER(app_bundle);
-  UNREFERENCED_PARAMETER(function_name);
-  ASSERT1(app_bundle);
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-  CORE_LOG(LE, (_T("[Invalid state transition][%s called while in %u]"),
-                function_name, state_));
-  return GOOPDATE_E_CALL_UNEXPECTED;
-}
-
-}  // namespace fsm
-
-}  // namespace omaha
diff --git a/goopdate/app_bundle_state.h b/goopdate/app_bundle_state.h
deleted file mode 100644
index 38ecb25..0000000
--- a/goopdate/app_bundle_state.h
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_APP_BUNDLE_STATE_H_
-#define OMAHA_GOOPDATE_APP_BUNDLE_STATE_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-class App;
-class AppBundle;
-class AppBundleTest;
-class WebServicesClientInterface;
-
-namespace fsm {
-
-// Defines the interface for encapsulating behavior associated with a particular
-// state of the AppBundle object.
-// All state transition calls should go through AppBundle, meaning it is the
-// only class that should use this interface.
-class AppBundleState {
- public:
-  virtual ~AppBundleState() {}
-
-  virtual HRESULT put_altTokens(AppBundle* app_bundle,
-                                ULONG_PTR impersonation_token,
-                                ULONG_PTR primary_token,
-                                DWORD caller_proc_id);
-  virtual HRESULT put_sessionId(AppBundle* app_bundle, BSTR session_id);
-  virtual HRESULT Initialize(AppBundle* app_bundle);
-  virtual HRESULT CreateApp(AppBundle* app_bundle,
-                            const CString& app_id,
-                            App** app);
-  virtual HRESULT CreateInstalledApp(AppBundle* app_bundle,
-                                     const CString& app_id,
-                                     App** app);
-  virtual HRESULT CreateAllInstalledApps(AppBundle* app_bundle);
-
-  virtual HRESULT CheckForUpdate(AppBundle* app_bundle);
-  virtual HRESULT Download(AppBundle* app_bundle);
-  virtual HRESULT Install(AppBundle* app_bundle);
-
-  virtual HRESULT UpdateAllApps(AppBundle* app_bundle);
-
-  virtual HRESULT Stop(AppBundle* app_bundle);
-  virtual HRESULT Pause(AppBundle* app_bundle);
-  virtual HRESULT Resume(AppBundle* app_bundle);
-
-  virtual HRESULT DownloadPackage(AppBundle* app_bundle,
-                                  const CString& app_id,
-                                  const CString& package_name);
-
-  virtual HRESULT CompleteAsyncCall(AppBundle* app_bundle);
-
-  virtual bool IsBusy() const;
-
- protected:
-  enum BundleState {
-    STATE_INIT,
-    STATE_INITIALIZED,
-    STATE_BUSY,
-    STATE_READY,
-    STATE_PAUSED,
-    STATE_STOPPED,
-  };
-
-
-  explicit AppBundleState(BundleState state) : state_(state) {}
-
-  // These functions provide pass-through access to private AppBundle members.
-  // TODO(omaha): remove paranoid asserts and implement inline.
-  void AddAppToBundle(AppBundle* app_bundle, App* app);
-  bool IsPendingNonBlockingCall(AppBundle* app_bundle);
-
-  HRESULT DoDownloadPackage(AppBundle* app_bundle,
-                            const CString& app_id,
-                            const CString& package_name);
-
-  // After calling this method, the old state (this object) is deleted and the
-  // code may not reference the members of the old state anymore.
-  void ChangeState(AppBundle* app_bundle, AppBundleState* state);
-
-  HRESULT HandleInvalidStateTransition(AppBundle* app_bundle,
-                                       const TCHAR* function_name);
-
- private:
-  friend class AppBundleTest;
-
-  BundleState state_;
-
-  DISALLOW_COPY_AND_ASSIGN(AppBundleState);
-};
-
-}  // namespace fsm
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_BUNDLE_STATE_H_
diff --git a/goopdate/app_bundle_state_busy.cc b/goopdate/app_bundle_state_busy.cc
deleted file mode 100644
index 51be42e..0000000
--- a/goopdate/app_bundle_state_busy.cc
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_bundle_state_busy.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/goopdate/app_bundle_state_paused.h"
-#include "omaha/goopdate/app_bundle_state_ready.h"
-#include "omaha/goopdate/app_bundle_state_stopped.h"
-#include "omaha/goopdate/model.h"
-
-namespace omaha {
-
-namespace fsm {
-
-HRESULT AppBundleStateBusy::Pause(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[AppBundleStateBusy::Pause][0x%p]"), app_bundle));
-  ASSERT1(app_bundle);
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-  ASSERT1(IsPendingNonBlockingCall(app_bundle));
-
-  HRESULT hr = app_bundle->model()->Pause(app_bundle);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Pause failed][0x%08x][0x%p]"), hr, app_bundle));
-    return hr;
-  }
-
-  ChangeState(app_bundle, new AppBundleStatePaused);
-  return S_OK;
-}
-
-HRESULT AppBundleStateBusy::Stop(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[AppBundleStateBusy::Stop][0x%p]"), app_bundle));
-  ASSERT1(app_bundle);
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-  ASSERT1(IsPendingNonBlockingCall(app_bundle));
-
-  HRESULT hr = app_bundle->model()->Stop(app_bundle);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Stop failed][0x%08x][0x%p]"), hr, app_bundle));
-    return hr;
-  }
-
-  // Handling Stop is non-blocking. The worker completes the pending bundle
-  // calls while the bundle remains in the stopped state.
-  ChangeState(app_bundle, new AppBundleStateStopped);
-  return S_OK;
-}
-
-HRESULT AppBundleStateBusy::CompleteAsyncCall(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[AppBundleStateBusy::CompleteAsyncCall][0x%p]"),
-                app_bundle));
-  ASSERT1(IsPendingNonBlockingCall(app_bundle));
-  ChangeState(app_bundle, new AppBundleStateReady);
-  return S_OK;
-}
-
-HRESULT AppBundleStateBusy::Download(AppBundle* app_bundle) {
-  UNREFERENCED_PARAMETER(app_bundle);
-  ASSERT1(IsPendingNonBlockingCall(app_bundle));
-  return GOOPDATE_E_NON_BLOCKING_CALL_PENDING;
-}
-
-HRESULT AppBundleStateBusy::Install(AppBundle* app_bundle) {
-  UNREFERENCED_PARAMETER(app_bundle);
-  ASSERT1(IsPendingNonBlockingCall(app_bundle));
-  return GOOPDATE_E_NON_BLOCKING_CALL_PENDING;
-}
-
-HRESULT AppBundleStateBusy::DownloadPackage(AppBundle* app_bundle,
-                                            const CString& app_id,
-                                            const CString& package_name) {
-  UNREFERENCED_PARAMETER(app_bundle);
-  UNREFERENCED_PARAMETER(app_id);
-  UNREFERENCED_PARAMETER(package_name);
-  ASSERT1(IsPendingNonBlockingCall(app_bundle));
-  return GOOPDATE_E_NON_BLOCKING_CALL_PENDING;
-}
-
-bool AppBundleStateBusy::IsBusy() const {
-  return true;
-}
-
-}  // namespace fsm
-
-}  // namespace omaha
diff --git a/goopdate/app_bundle_state_busy.h b/goopdate/app_bundle_state_busy.h
deleted file mode 100644
index de74262..0000000
--- a/goopdate/app_bundle_state_busy.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_APP_BUNDLE_STATE_BUSY_H_
-#define OMAHA_GOOPDATE_APP_BUNDLE_STATE_BUSY_H_
-
-#include "base/basictypes.h"
-#include "omaha/goopdate/app_bundle_state.h"
-
-namespace omaha {
-
-namespace fsm {
-
-class AppBundleStateBusy : public AppBundleState {
- public:
-  AppBundleStateBusy() : AppBundleState(STATE_BUSY) {}
-  virtual ~AppBundleStateBusy() {}
-
-  virtual HRESULT Stop(AppBundle* app_bundle);
-  virtual HRESULT Pause(AppBundle* app_bundle);
-
-  virtual HRESULT CompleteAsyncCall(AppBundle* app_bundle);
-
-  virtual bool IsBusy() const;
-
-  // These all return GOOPDATE_E_NON_BLOCKING_CALL_PENDING.
-  virtual HRESULT Download(AppBundle* app_bundle);
-  virtual HRESULT Install(AppBundle* app_bundle);
-  virtual HRESULT DownloadPackage(AppBundle* app_bundle,
-                                  const CString& app_id,
-                                  const CString& package_name);
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(AppBundleStateBusy);
-};
-
-}  // namespace fsm
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_BUNDLE_STATE_BUSY_H_
diff --git a/goopdate/app_bundle_state_init.cc b/goopdate/app_bundle_state_init.cc
deleted file mode 100644
index 7314cda..0000000
--- a/goopdate/app_bundle_state_init.cc
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_bundle_state_init.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/user_rights.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/web_services_client.h"
-#include "omaha/goopdate/app_bundle_state_initialized.h"
-#include "omaha/goopdate/model.h"
-
-namespace omaha {
-
-namespace fsm {
-
-HRESULT AppBundleStateInit::put_altTokens(AppBundle* app_bundle,
-                                          ULONG_PTR impersonation_token,
-                                          ULONG_PTR primary_token,
-                                          DWORD caller_proc_id) {
-  CORE_LOG(L3, (_T("[AppBundleStateInit::put_altTokens][0x%p]"), app_bundle));
-  ASSERT1(app_bundle);
-  ASSERT1(impersonation_token);
-  ASSERT1(primary_token);
-  ASSERT1(caller_proc_id);
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-
-  scoped_handle caller_proc_handle(::OpenProcess(PROCESS_DUP_HANDLE,
-                                                 false,
-                                                 caller_proc_id));
-  if (!get(caller_proc_handle)) {
-    return HRESULTFromLastError();
-  }
-
-  if (app_bundle->alt_impersonation_token_.GetHandle() ||
-      app_bundle->alt_primary_token_.GetHandle()) {
-    return E_UNEXPECTED;
-  }
-
-  HRESULT hr = DuplicateTokenIntoCurrentProcess(
-      get(caller_proc_handle),
-      reinterpret_cast<HANDLE>(impersonation_token),
-      &app_bundle->alt_impersonation_token_);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return DuplicateTokenIntoCurrentProcess(
-             get(caller_proc_handle),
-             reinterpret_cast<HANDLE>(primary_token),
-             &app_bundle->alt_primary_token_);
-}
-
-HRESULT AppBundleStateInit::put_sessionId(AppBundle* app_bundle,
-                                          BSTR session_id) {
-  CORE_LOG(L3, (_T("[AppBundleStateInit::put_sessionId][0x%p]"), app_bundle));
-  ASSERT1(app_bundle);
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-
-  if (!session_id) {
-    return E_POINTER;
-  }
-
-  ASSERT1(IsGuid(session_id));
-
-  app_bundle->session_id_ = session_id;
-  return S_OK;
-}
-
-// Captures the caller's imperonation token and uses it to initialize the ping
-// and WebServicesClient objects.
-// It is possible that one user could call this function and another admin user
-// could call subsequent methods with this impersonation token. Since it is only
-// used for network access, this is okay. The primary token, which is used for
-// installation, is only captured by install().
-// The WebServicesClient objects are created here instead of in the constructor
-// because the Initialize() function is not part of WebServicesClientInterface.
-// TODO(omaha): Enforce ordering - initialize must be called before any other
-// non-property functions. This code must move to AppBundleStateInit.
-HRESULT AppBundleStateInit::Initialize(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[AppBundleStateInit::Initialize][0x%p]"), app_bundle));
-  ASSERT1(app_bundle);
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-
-  // Clients should have set these properties before calling this function.
-  ASSERT1(!app_bundle->display_name_.IsEmpty());
-  ASSERT1(!app_bundle->display_language().IsEmpty());
-
-  // If the client hasn't set a session ID before calling this function,
-  // generate a random one for them.
-  if (app_bundle->session_id_.IsEmpty()) {
-    GetGuid(&app_bundle->session_id_);
-  }
-
-  HRESULT hr = app_bundle->CaptureCallerImpersonationToken();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  ASSERT1(!app_bundle->update_check_client_.get());
-  CString update_check_url;
-  VERIFY1(SUCCEEDED(
-      ConfigManager::Instance()->GetUpdateCheckUrl(&update_check_url)));
-  scoped_ptr<WebServicesClient> web_service_client;
-  web_service_client.reset(new WebServicesClient(app_bundle->is_machine()));
-  hr = web_service_client->Initialize(update_check_url, HeadersVector(), true);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Update check client init failed][0x%08x]"), hr));
-    return hr;
-  }
-  app_bundle->update_check_client_.reset(web_service_client.release());
-
-  ChangeState(app_bundle, new AppBundleStateInitialized);
-  return S_OK;
-}
-
-}  // namespace fsm
-
-}  // namespace omaha
diff --git a/goopdate/app_bundle_state_init.h b/goopdate/app_bundle_state_init.h
deleted file mode 100644
index 58566dc..0000000
--- a/goopdate/app_bundle_state_init.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_APP_BUNDLE_STATE_INIT_H_
-#define OMAHA_GOOPDATE_APP_BUNDLE_STATE_INIT_H_
-
-#include "base/basictypes.h"
-#include "omaha/goopdate/app_bundle_state.h"
-
-namespace omaha {
-
-namespace fsm {
-
-class AppBundleStateInit : public AppBundleState {
- public:
-  AppBundleStateInit() : AppBundleState(STATE_INIT) {}
-
-  virtual HRESULT put_altTokens(AppBundle* app_bundle,
-                                ULONG_PTR impersonation_token,
-                                ULONG_PTR primary_token,
-                                DWORD caller_proc_id);
-  virtual HRESULT put_sessionId(AppBundle* app_bundle, BSTR session_id);
-  virtual HRESULT Initialize(AppBundle* app_bundle);
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(AppBundleStateInit);
-};
-
-}  // namespace fsm
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_BUNDLE_STATE_INIT_H_
diff --git a/goopdate/app_bundle_state_initialized.cc b/goopdate/app_bundle_state_initialized.cc
deleted file mode 100644
index fc82eb8..0000000
--- a/goopdate/app_bundle_state_initialized.cc
+++ /dev/null
@@ -1,306 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_bundle_state_initialized.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/common/app_registry_utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/web_services_client.h"
-#include "omaha/goopdate/app_bundle_state_busy.h"
-#include "omaha/goopdate/app_bundle_state_paused.h"
-#include "omaha/goopdate/app_bundle_state_stopped.h"
-#include "omaha/goopdate/app_manager.h"
-#include "omaha/goopdate/model.h"
-
-namespace omaha {
-
-namespace fsm {
-
-HRESULT AppBundleStateInitialized::Pause(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[AppBundleStateInitialized::Pause][0x%p]"), app_bundle));
-  ASSERT1(app_bundle);
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-
-  ChangeState(app_bundle, new AppBundleStatePaused);
-  return S_OK;
-}
-
-HRESULT AppBundleStateInitialized::Stop(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[AppBundleStateInitialized::Stop][0x%p]"), app_bundle));
-  ASSERT1(app_bundle);
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-
-  ChangeState(app_bundle, new AppBundleStateStopped);
-  return S_OK;
-}
-
-// Remains in this state.
-HRESULT AppBundleStateInitialized::CreateApp(AppBundle* app_bundle,
-                                             const CString& app_id,
-                                             App** app) {
-  CORE_LOG(L3, (_T("[AppBundleStateInitialized::CreateApp][0x%p]"),
-                app_bundle));
-  ASSERT1(app_bundle);
-  ASSERT1(app);
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-
-  // TODO(omaha): consider enabling this runtime test. Currently, there are
-  // a few unit tests that break this assumption mostly during the setup of
-  // the unit test itself.
-#if 0
-  if (app_id.CompareNoCase(kGoogleUpdateAppId) == 0) {
-    CORE_LOG(LE, (_T("[Omaha itself can't be created as a new app]")));
-    return E_INVALIDARG;
-  }
-#endif
-
-  if (has_installed_app_) {
-    CORE_LOG(LE, (_T("[CreateApp][Installed app already in bundle]")));
-    return HandleInvalidStateTransition(app_bundle, _T(__FUNCTION__));
-  }
-
-  GUID app_guid = {0};
-  HRESULT hr = StringToGuidSafe(app_id, &app_guid);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[invalid app id][%s]"), app_id));
-    return hr;
-  }
-
-  scoped_ptr<App> local_app(new App(app_guid, false, app_bundle));
-  hr = AddApp(app_bundle, local_app.get());
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // When overinstalling, we want the install age for the existing install, so
-  // explicitly get it here. This is the only value read from the registry for
-  // installs.
-  AppManager::Instance()->ReadAppInstallTimeDiff(local_app.get());
-
-  *app = local_app.release();
-  has_new_app_ = true;
-  return S_OK;
-}
-
-// Remains in this state.
-HRESULT AppBundleStateInitialized::CreateInstalledApp(AppBundle* app_bundle,
-                                                      const CString& app_id,
-                                                      App** app) {
-  CORE_LOG(L3, (_T("[AppBundleStateInitialized::CreateInstalledApp][0x%p]"),
-                app_bundle));
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-
-  if (has_new_app_) {
-    CORE_LOG(LE, (_T("[CreateInstalledApp][New app already in bundle]")));
-    return HandleInvalidStateTransition(app_bundle, _T(__FUNCTION__));
-  }
-
-  // Make sure that the application registration is up to date.
-  HRESULT hr = AppManager::Instance()->RunRegistrationUpdateHook(app_id);
-  if (FAILED(hr)) {
-    CORE_LOG(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) == hr ? L3 : LW,
-             (_T("[RunRegistrationUpdateHook failed][%s][0x%x]"),
-             app_id, hr));
-  }
-
-  hr = AddInstalledApp(app_bundle, app_id, app);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// Remains in this state.
-// This function must explicitly check to ensure duplicate apps are not added
-// because AddInstalledApp errors are ignored. The check for an empty bundle
-// also covers the has_new_app_ case.
-HRESULT AppBundleStateInitialized::CreateAllInstalledApps(
-    AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[AppBundleStateInitialized::CreateAllInstalledApps][0x%p]"),
-                app_bundle));
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-
-  if (app_bundle->GetNumberOfApps() > 0) {
-    CORE_LOG(LE, (_T("[CreateAllInstalledApps][Bundle already has apps]")));
-    return HandleInvalidStateTransition(app_bundle, _T(__FUNCTION__));
-  }
-  ASSERT1(!has_new_app_);
-
-  // Make sure the list of installed applications is up to date. This is
-  // primarily important for Google Pack, which supports updating third-party
-  // applications that are not aware of Omaha registration, and hence will not
-  // update the registration during an install or uninstall outside of Pack.
-  AppManager& app_manager = *AppManager::Instance();
-  HRESULT hr = app_manager.RunAllRegistrationUpdateHooks();
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[RunAllRegistrationUpdateHooks failed][0x%x]"), hr));
-  }
-
-  AppIdVector registered_app_ids;
-  hr = app_manager.GetRegisteredApps(&registered_app_ids);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[GetRegisteredApps failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  for (size_t i = 0; i != registered_app_ids.size(); ++i) {
-    const CString& app_id = registered_app_ids[i];
-
-    ASSERT(RegKey::HasKey(app_registry_utils::GetAppClientStateKey(
-                              app_bundle->is_machine(), app_id)),
-           (_T("[Clients key without matching ClientState][%s]"), app_id));
-
-    App* app = NULL;
-    HRESULT hr = AddInstalledApp(app_bundle, app_id, &app);
-    if (FAILED(hr)) {
-      CORE_LOG(LW, (_T("[AddInstalledApp failed processing app][%s]"), app_id));
-    }
-  }
-
-  return S_OK;
-}
-
-// It is important that the lock is held for the entirety of this and similar
-// methods with asynchronous callbacks because CompleteAsyncCall() must not be
-// called before the state has been changed to busy.
-HRESULT AppBundleStateInitialized::CheckForUpdate(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[AppBundleStateInitialized::CheckForUpdate][0x%p]"),
-                app_bundle));
-  ASSERT1(app_bundle);
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-  ASSERT1(!IsPendingNonBlockingCall(app_bundle));
-
-  if (app_bundle->GetNumberOfApps() == 0) {
-    CORE_LOG(LE, (_T("[CheckForUpdate][No apps in bundle]")));
-    return HandleInvalidStateTransition(app_bundle, _T(__FUNCTION__));
-  }
-
-  ASSERT1(has_new_app_ != has_installed_app_);
-
-  HRESULT hr = app_bundle->model()->CheckForUpdate(app_bundle);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[CheckForUpdates failed][0x%x][0x%p]"), hr, app_bundle));
-    return hr;
-  }
-
-  ChangeState(app_bundle, new AppBundleStateBusy);
-  return S_OK;
-}
-
-HRESULT AppBundleStateInitialized::UpdateAllApps(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[AppBundleStateInitialized::UpdateAllApps][0x%p]"),
-                app_bundle));
-  ASSERT1(app_bundle);
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-  ASSERT1(!IsPendingNonBlockingCall(app_bundle));
-
-  if (app_bundle->GetNumberOfApps() != 0) {
-    CORE_LOG(LE, (_T("[UpdateAllApps][Apps already in bundle]")));
-    return HandleInvalidStateTransition(app_bundle, _T(__FUNCTION__));
-  }
-
-  app_bundle->set_is_auto_update(true);
-
-  HRESULT hr = app_bundle->createAllInstalledApps();
-  if (FAILED(hr)) {
-    return hr;
-  }
-  ASSERT1(app_bundle->GetNumberOfApps() > 0);
-
-  hr = app_bundle->model()->UpdateAllApps(app_bundle);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[UpdateAllApps failed][0x%08x][0x%p]"), hr, app_bundle));
-    return hr;
-  }
-
-  ChangeState(app_bundle, new AppBundleStateBusy);
-  return S_OK;
-}
-
-HRESULT AppBundleStateInitialized::DownloadPackage(
-    AppBundle* app_bundle,
-    const CString& app_id,
-    const CString& package_name) {
-  CORE_LOG(L3, (_T("[AppBundleStateInitialized::DownloadPackage][0x%p]"),
-                app_bundle));
-  ASSERT1(app_bundle);
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-
-  if (app_bundle->GetNumberOfApps() == 0 || has_new_app_) {
-    CORE_LOG(LE, (_T("[DownloadPackage][No existing apps in bundle]")));
-    return HandleInvalidStateTransition(app_bundle, _T(__FUNCTION__));
-  }
-
-  return DoDownloadPackage(app_bundle, app_id, package_name);
-}
-
-// App is created with is_update=true because using an installed app's
-// information, including a non-zero version, is an update.
-HRESULT AppBundleStateInitialized::AddInstalledApp(AppBundle* app_bundle,
-                                                   const CString& app_id,
-                                                   App** app) {
-  ASSERT1(app_bundle);
-  ASSERT1(app);
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-
-  GUID app_guid = {0};
-  HRESULT hr = StringToGuidSafe(app_id, &app_guid);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[invalid app id][%s]"), app_id));
-    return hr;
-  }
-
-  scoped_ptr<App> local_app(new App(app_guid, true, app_bundle));
-
-  hr = AppManager::Instance()->ReadAppPersistentData(local_app.get());
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[ReadAppPersistentData failed][0x%x][%s]"), hr, app_id));
-    return hr;
-  }
-
-  hr = AddApp(app_bundle, local_app.get());
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  has_installed_app_ = true;
-  *app = local_app.release();
-  return S_OK;
-}
-
-// Fails if the app already exists in the bundle.
-HRESULT AppBundleStateInitialized::AddApp(AppBundle* app_bundle, App* app) {
-  ASSERT1(app_bundle);
-  ASSERT1(app);
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-
-  for (size_t i = 0; i != app_bundle->GetNumberOfApps(); ++i) {
-    App* existing_app = app_bundle->GetApp(i);
-    if (::IsEqualGUID(existing_app->app_guid(), app->app_guid())) {
-      CORE_LOG(LE, (_T("[App already in bundle][%s]"), app->app_guid_string()));
-      return GOOPDATE_E_CALL_UNEXPECTED;
-    }
-  }
-
-  AddAppToBundle(app_bundle, app);
-  return S_OK;
-}
-
-}  // namespace fsm
-
-}  // namespace omaha
diff --git a/goopdate/app_bundle_state_initialized.h b/goopdate/app_bundle_state_initialized.h
deleted file mode 100644
index 01265e8..0000000
--- a/goopdate/app_bundle_state_initialized.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_APP_BUNDLE_STATE_INITIALIZED_H_
-#define OMAHA_GOOPDATE_APP_BUNDLE_STATE_INITIALIZED_H_
-
-#include "base/basictypes.h"
-#include "omaha/goopdate/app_bundle_state.h"
-
-namespace omaha {
-
-namespace fsm {
-
-class AppBundleStateInitialized : public AppBundleState {
- public:
-  AppBundleStateInitialized()
-      : AppBundleState(STATE_INITIALIZED),
-        has_new_app_(false),
-        has_installed_app_(false) {}
-  virtual ~AppBundleStateInitialized() {}
-
-  virtual HRESULT Stop(AppBundle* app_bundle);
-  virtual HRESULT Pause(AppBundle* app_bundle);
-  virtual HRESULT CreateApp(AppBundle* app_bundle,
-                            const CString& app_id,
-                            App** app);
-  virtual HRESULT CreateInstalledApp(AppBundle* app_bundle,
-                                     const CString& app_id,
-                                     App** app);
-  virtual HRESULT CreateAllInstalledApps(AppBundle* app_bundle);
-
-  virtual HRESULT CheckForUpdate(AppBundle* app_bundle);
-
-  virtual HRESULT UpdateAllApps(AppBundle* app_bundle);
-
-  virtual HRESULT DownloadPackage(AppBundle* app_bundle,
-                                  const CString& app_id,
-                                  const CString& package_name);
-
- private:
-  HRESULT AddInstalledApp(AppBundle* app_bundle,
-                          const CString& appId,
-                          App** app);
-
-  // Adds an app to app_bundle's apps_. Takes ownership of app when successful.
-  HRESULT AddApp(AppBundle* app_bundle, App* app);
-
-  bool has_new_app_;
-  bool has_installed_app_;
-
-  DISALLOW_COPY_AND_ASSIGN(AppBundleStateInitialized);
-};
-
-}  // namespace fsm
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_BUNDLE_STATE_INITIALIZED_H_
diff --git a/goopdate/app_bundle_state_paused.cc b/goopdate/app_bundle_state_paused.cc
deleted file mode 100644
index 2c62395..0000000
--- a/goopdate/app_bundle_state_paused.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_bundle_state_paused.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/goopdate/app_bundle_state_busy.h"
-#include "omaha/goopdate/app_bundle_state_ready.h"
-#include "omaha/goopdate/model.h"
-
-namespace omaha {
-
-namespace fsm {
-
-// Remains in this state since the bundle is already paused.
-HRESULT AppBundleStatePaused::Pause(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[AppBundleStatePaused::Pause][0x%p]"), app_bundle));
-  UNREFERENCED_PARAMETER(app_bundle);
-  return S_OK;
-}
-
-HRESULT AppBundleStatePaused::Resume(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[AppBundleStatePaused::Resume][0x%p]"), app_bundle));
-  ASSERT1(app_bundle);
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-
-  HRESULT hr = app_bundle->model()->Resume(app_bundle);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Resume failed][0x%08x][0x%p]"), hr, app_bundle));
-    return hr;
-  }
-
-  if (is_async_call_complete_) {
-    ChangeState(app_bundle, new AppBundleStateReady);
-  } else {
-    ChangeState(app_bundle, new AppBundleStateBusy);
-  }
-  return S_OK;
-}
-
-HRESULT AppBundleStatePaused::CompleteAsyncCall(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[AppBundleStatePaused::CompleteAsyncCall][0x%p]"),
-                app_bundle));
-  ASSERT1(app_bundle);
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-  ASSERT1(IsPendingNonBlockingCall(app_bundle));
-  UNREFERENCED_PARAMETER(app_bundle);
-  is_async_call_complete_ = true;
-  return S_OK;
-}
-
-}  // namespace fsm
-
-}  // namespace omaha
diff --git a/goopdate/app_bundle_state_paused.h b/goopdate/app_bundle_state_paused.h
deleted file mode 100644
index 1763eb2..0000000
--- a/goopdate/app_bundle_state_paused.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_APP_BUNDLE_STATE_PAUSED_H_
-#define OMAHA_GOOPDATE_APP_BUNDLE_STATE_PAUSED_H_
-
-#include "base/basictypes.h"
-#include "omaha/goopdate/app_bundle_state.h"
-
-namespace omaha {
-
-namespace fsm {
-
-class AppBundleStatePaused : public AppBundleState {
- public:
-  AppBundleStatePaused()
-      : AppBundleState(STATE_PAUSED),
-        is_async_call_complete_(false) {}
-  virtual ~AppBundleStatePaused() {}
-
-  // TODO(omaha): What should Stop() do?
-  virtual HRESULT Pause(AppBundle* app_bundle);
-  virtual HRESULT Resume(AppBundle* app_bundle);
-
-  virtual HRESULT CompleteAsyncCall(AppBundle* app_bundle);
-
- private:
-  // It is possible that an asynchronous operation will complete while in the
-  // paused state because pausing itself is asynchronous. Therefore,
-  // CompleteAsyncCall() may be called in this state. Remember whether
-  // it was so that we can transition to the correct state on Resume().
-  bool is_async_call_complete_;
-
-  DISALLOW_COPY_AND_ASSIGN(AppBundleStatePaused);
-};
-
-}  // namespace fsm
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_BUNDLE_STATE_PAUSED_H_
diff --git a/goopdate/app_bundle_state_ready.cc b/goopdate/app_bundle_state_ready.cc
deleted file mode 100644
index afe324e..0000000
--- a/goopdate/app_bundle_state_ready.cc
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_bundle_state_ready.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/goopdate/app_bundle_state_busy.h"
-#include "omaha/goopdate/model.h"
-
-namespace omaha {
-
-namespace fsm {
-
-HRESULT AppBundleStateReady::Download(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[AppBundleStateReady::Download][0x%p]"), app_bundle));
-  ASSERT1(app_bundle);
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-  ASSERT1(!IsPendingNonBlockingCall(app_bundle));
-
-  HRESULT hr = app_bundle->model()->Download(app_bundle);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Download failed][0x%08x][0x%p]"), hr, app_bundle));
-    return hr;
-  }
-
-  ChangeState(app_bundle, new AppBundleStateBusy);
-  return S_OK;
-}
-
-HRESULT AppBundleStateReady::Install(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[AppBundleStateReady::Install][0x%p]"), app_bundle));
-  ASSERT1(app_bundle);
-  ASSERT1(app_bundle->model()->IsLockedByCaller());
-  ASSERT1(!IsPendingNonBlockingCall(app_bundle));
-
-  HRESULT hr = app_bundle->model()->DownloadAndInstall(app_bundle);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Install failed][0x%08x][0x%p]"), hr, app_bundle));
-    return hr;
-  }
-
-  ChangeState(app_bundle, new AppBundleStateBusy);
-  return S_OK;
-}
-
-// Remains in this state since there is nothing to pause.
-HRESULT AppBundleStateReady::Pause(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[AppBundleStateReady::Pause][0x%p]"), app_bundle));
-  UNREFERENCED_PARAMETER(app_bundle);
-  return S_OK;
-}
-
-// Remains in this state since the bundle is not paused. This might occur if
-// Pause() was called while in this state.
-HRESULT AppBundleStateReady::Resume(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[AppBundleStateReady::Resume][0x%p]"), app_bundle));
-  UNREFERENCED_PARAMETER(app_bundle);
-  return S_OK;
-}
-
-HRESULT AppBundleStateReady::DownloadPackage(AppBundle* app_bundle,
-                                             const CString& app_id,
-                                             const CString& package_name) {
-  CORE_LOG(L3, (_T("[AppBundleStateReady::DownloadPackage][0x%p]"),
-                app_bundle));
-
-  // TODO(omaha): There may need to be some check here that the app is
-  // downloaded or installed.
-
-  return DoDownloadPackage(app_bundle, app_id, package_name);
-}
-
-}  // namespace fsm
-
-}  // namespace omaha
diff --git a/goopdate/app_bundle_state_ready.h b/goopdate/app_bundle_state_ready.h
deleted file mode 100644
index f4f38be..0000000
--- a/goopdate/app_bundle_state_ready.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_APP_BUNDLE_STATE_READY_H_
-#define OMAHA_GOOPDATE_APP_BUNDLE_STATE_READY_H_
-
-#include "base/basictypes.h"
-#include "omaha/goopdate/app_bundle_state.h"
-
-namespace omaha {
-
-namespace fsm {
-
-class AppBundleStateReady : public AppBundleState {
- public:
-  AppBundleStateReady() : AppBundleState(STATE_READY) {}
-  virtual ~AppBundleStateReady() {}
-
-  virtual HRESULT Download(AppBundle* app_bundle);
-  virtual HRESULT Install(AppBundle* app_bundle);
-
-  // TODO(omaha): What should Stop() do?
-  virtual HRESULT Pause(AppBundle* app_bundle);
-  virtual HRESULT Resume(AppBundle* app_bundle);
-
-  virtual HRESULT DownloadPackage(AppBundle* app_bundle,
-                                  const CString& app_id,
-                                  const CString& package_name);
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(AppBundleStateReady);
-};
-
-}  // namespace fsm
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_BUNDLE_STATE_READY_H_
diff --git a/goopdate/app_bundle_state_stopped.cc b/goopdate/app_bundle_state_stopped.cc
deleted file mode 100644
index d82911c..0000000
--- a/goopdate/app_bundle_state_stopped.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_bundle_state_stopped.h"
-#include "omaha/base/logging.h"
-
-namespace omaha {
-
-namespace fsm {
-
-HRESULT AppBundleStateStopped::Stop(AppBundle* app_bundle) {
-  UNREFERENCED_PARAMETER(app_bundle);
-  CORE_LOG(L3, (_T("[AppBundleStateStopped::Stop][0x%p]"), app_bundle));
-  return S_OK;
-}
-
-HRESULT AppBundleStateStopped::CompleteAsyncCall(AppBundle* app_bundle) {
-  UNREFERENCED_PARAMETER(app_bundle);
-  CORE_LOG(L3, (_T("[AppBundleStateStopped::CompleteAsyncCall][0x%p]"),
-      app_bundle));
-  return S_OK;
-}
-
-}  // namespace fsm
-
-}  // namespace omaha
-
diff --git a/goopdate/app_bundle_state_stopped.h b/goopdate/app_bundle_state_stopped.h
deleted file mode 100644
index bebbdc5..0000000
--- a/goopdate/app_bundle_state_stopped.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_APP_BUNDLE_STATE_STOPPED_H_
-#define OMAHA_GOOPDATE_APP_BUNDLE_STATE_STOPPED_H_
-
-#include "base/basictypes.h"
-#include "omaha/goopdate/app_bundle_state.h"
-
-namespace omaha {
-
-namespace fsm {
-
-class AppBundleStateStopped : public AppBundleState {
- public:
-  AppBundleStateStopped()
-      : AppBundleState(STATE_STOPPED) {}
-  virtual ~AppBundleStateStopped() {}
-
- private:
-
-  virtual HRESULT Stop(AppBundle* app_bundle);
-
-  virtual HRESULT CompleteAsyncCall(AppBundle* app_bundle);
-
-  DISALLOW_COPY_AND_ASSIGN(AppBundleStateStopped);
-};
-
-}  // namespace fsm
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_BUNDLE_STATE_STOPPED_H_
-
diff --git a/goopdate/app_bundle_unittest.cc b/goopdate/app_bundle_unittest.cc
deleted file mode 100644
index 13220f2..0000000
--- a/goopdate/app_bundle_unittest.cc
+++ /dev/null
@@ -1,2357 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <atlsecurity.h>
-#include "omaha/base/app_util.h"
-#include "omaha/base/error.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/thread_pool.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/lang.h"
-#include "omaha/goopdate/app_bundle_state_busy.h"
-#include "omaha/goopdate/app_bundle_state_initialized.h"
-#include "omaha/goopdate/app_bundle_state_paused.h"
-#include "omaha/goopdate/app_bundle_state_ready.h"
-#include "omaha/goopdate/app_bundle_state_stopped.h"
-#include "omaha/goopdate/app_manager.h"
-#include "omaha/goopdate/model.h"
-#include "omaha/goopdate/resource_manager.h"
-#include "omaha/goopdate/worker.h"
-#include "omaha/goopdate/worker_mock.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-const int kKnownError = 0x87658765;
-
-const TCHAR* const kDefaultAppName = _T("Google Application");
-
-const uint32 kInitialInstallTimeDiff = static_cast<uint32>(-1 * kSecondsPerDay);
-
-// TODO(omaha): there is a problem with this unit test. The model is built
-// bottom up. This makes it impossible to set the references to parents. Will
-// have to fix the code, eventually using Builder DP to create a bunch of
-// models containing bundles, apps, and such.
-
-
-// Helper functions.
-// TODO(omaha): helper functions need to go into their own compilation unit to
-// avoid dependencies between unit test modules.
-
-void ValidateFreshInstallDefaultValues(const App& app) {
-  EXPECT_FALSE(::IsEqualGUID(GUID_NULL, app.app_guid()));
-  EXPECT_TRUE(app.language().IsEmpty());
-  EXPECT_TRUE(app.ap().IsEmpty());
-  EXPECT_TRUE(app.tt_token().IsEmpty());
-  EXPECT_TRUE(::IsEqualGUID(GUID_NULL, app.iid()));
-  EXPECT_TRUE(app.brand_code().IsEmpty());
-  EXPECT_TRUE(app.client_id().IsEmpty());
-  EXPECT_TRUE(app.GetExperimentLabels().IsEmpty());
-  EXPECT_TRUE(app.referral_id().IsEmpty());
-  EXPECT_EQ(kInitialInstallTimeDiff, app.install_time_diff_sec());
-  EXPECT_FALSE(app.is_eula_accepted());
-  EXPECT_TRUE(app.display_name().IsEmpty());
-  EXPECT_EQ(BROWSER_UNKNOWN, app.browser_type());
-  EXPECT_TRUE(app.server_install_data_index().IsEmpty());
-  EXPECT_EQ(TRISTATE_NONE, app.usage_stats_enable());
-  EXPECT_TRUE(app.client_install_data().IsEmpty());
-  EXPECT_TRUE(app.server_install_data().IsEmpty());
-  EXPECT_EQ(ACTIVE_UNKNOWN, app.did_run());
-  EXPECT_EQ(0, app.days_since_last_active_ping());
-  EXPECT_EQ(0, app.days_since_last_roll_call());
-
-  EXPECT_TRUE(app.current_version()->version().IsEmpty());
-  EXPECT_TRUE(app.next_version()->version().IsEmpty());
-    // TODO(omaha3): Add all the new values (state_, etc.).
-}
-
-void PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(
-    bool is_machine,
-    App* expected_app0,
-    App* expected_app1,
-    App* expected_app2,
-    App* opposite_hive_app1,
-    App* opposite_hive_app2);
-
-void SetDisplayName(const CString& name, App* app);
-
-void ValidateExpectedValues(const App& expected, const App& actual) {
-  EXPECT_STREQ(GuidToString(expected.app_guid()),
-               GuidToString(actual.app_guid()));
-  EXPECT_STREQ(expected.language(), actual.language());
-  EXPECT_STREQ(expected.ap(), actual.ap());
-  EXPECT_STREQ(expected.tt_token(), actual.tt_token());
-  EXPECT_STREQ(GuidToString(expected.iid()), GuidToString(actual.iid()));
-  EXPECT_STREQ(expected.brand_code(), actual.brand_code());
-  EXPECT_STREQ(expected.client_id(), actual.client_id());
-  EXPECT_STREQ(expected.GetExperimentLabels(), actual.GetExperimentLabels());
-  EXPECT_STREQ(expected.referral_id(), actual.referral_id());
-  EXPECT_EQ(expected.install_time_diff_sec(), actual.install_time_diff_sec());
-  EXPECT_EQ(expected.is_eula_accepted(), actual.is_eula_accepted());
-  EXPECT_STREQ(expected.display_name(), actual.display_name());
-  EXPECT_EQ(expected.browser_type(), actual.browser_type());
-  EXPECT_STREQ(expected.server_install_data_index(),
-               actual.server_install_data_index());
-  EXPECT_EQ(expected.usage_stats_enable(), actual.usage_stats_enable());
-  EXPECT_STREQ(expected.client_install_data(), actual.client_install_data());
-  EXPECT_STREQ(expected.server_install_data(), actual.server_install_data());
-  EXPECT_EQ(expected.did_run(), actual.did_run());
-
-  EXPECT_STREQ(expected.current_version()->version(),
-               actual.current_version()->version());
-  EXPECT_STREQ(expected.next_version()->version(),
-               actual.next_version()->version());
-
-  // TODO(omaha3): Add all the new values (state(), etc.)?
-}
-
-using ::testing::_;
-using ::testing::Return;
-
-namespace {
-
-// TODO(omaha): At least some of these and where they are used have to be kept
-// in sync with app_manager_unittest.cc because the constants are hard-coded in
-// functions used by these tests. Break this coupling.
-const TCHAR* const kGuid1 = _T("{21CD0965-0B0E-47cf-B421-2D191C16C0E2}");
-const TCHAR* const kGuid2 = _T("{A979ACBD-1F55-4b12-A35F-4DBCA5A7CCB8}");
-const TCHAR* const kGuid3 = _T("{661045C5-4429-4140-BC48-8CEA241D1DEF}");
-const TCHAR* const kGuid4 = _T("{AAFA1CF9-E94F-42e6-A899-4CD27F37D5A7}");
-const TCHAR* const kGuid5 = _T("{3B1A3CCA-0525-4418-93E6-A0DB3398EC9B}");
-const TCHAR* const kGuid6 = _T("{F3F2CFD4-5F98-4bf0-ABB0-BEEEA46C62B4}");
-const TCHAR* const kGuid7 = _T("{6FD2272F-8583-4bbd-895A-E65F8003FC7B}");
-
-
-class DummyUserWorkItem : public UserWorkItem {
- private:
-  virtual void DoProcess() {}
-};
-
-ACTION_P(SetWorkItem, work_item) {
-  UNREFERENCED_ACTION_PARAMETERS;
-  arg0->set_user_work_item(work_item);
-  return 0;
-}
-
-}  // namespace
-
-class AppBundleNoBundleTest : public testing::Test {
- protected:
-  explicit AppBundleNoBundleTest(bool is_machine)
-      : is_machine_(is_machine) {}
-
-  virtual void SetUp() {
-    EXPECT_SUCCEEDED(AppManager::CreateInstance(is_machine_));
-
-    // By default, no Worker methods should be called, so use StrictMock.
-    // Override this behavior for specific methods in the individual test cases.
-    worker_.reset(new testing::StrictMock<MockWorker>);
-    model_.reset(new Model(worker_.get()));
-
-    EXPECT_CALL(*worker_, Lock()).WillRepeatedly(Return(2));
-    EXPECT_CALL(*worker_, Unlock()).WillRepeatedly(Return(1));
-  }
-
-  virtual void TearDown() {
-    AppManager::DeleteInstance();
-  }
-
-  const bool is_machine_;
-  scoped_ptr<MockWorker> worker_;
-  scoped_ptr<Model> model_;
-
- private:
-  DISALLOW_IMPLICIT_CONSTRUCTORS(AppBundleNoBundleTest);
-};
-
-class AppBundleTest : public AppBundleNoBundleTest {
- protected:
-  explicit AppBundleTest(bool is_machine) : AppBundleNoBundleTest(is_machine) {}
-
-  static void SetUpTestCase() {
-    EXPECT_EQ(STATE_INIT,         fsm::AppBundleState::STATE_INIT);
-    EXPECT_EQ(STATE_INITIALIZED,  fsm::AppBundleState::STATE_INITIALIZED);
-    EXPECT_EQ(STATE_BUSY,         fsm::AppBundleState::STATE_BUSY);
-    EXPECT_EQ(STATE_READY,        fsm::AppBundleState::STATE_READY);
-    EXPECT_EQ(STATE_PAUSED,       fsm::AppBundleState::STATE_PAUSED);
-    EXPECT_EQ(STATE_STOPPED,      fsm::AppBundleState::STATE_STOPPED);
-  }
-
-  virtual void SetUp() {
-    AppBundleNoBundleTest::SetUp();
-    app_bundle_ = model_->CreateAppBundle(is_machine_);
-    ASSERT_TRUE(app_bundle_.get());
-  }
-
-  virtual void TearDown() {
-    app_bundle_.reset();
-    AppBundleNoBundleTest::TearDown();
-  }
-
-  void TestPropertyReflexiveness() {
-    EXPECT_SUCCEEDED(app_bundle_->put_displayName(CComBSTR(_T("My Apps"))));
-    CComBSTR name(_T(""));
-    EXPECT_SUCCEEDED(app_bundle_->get_displayName(&name));
-    EXPECT_STREQ(_T("My Apps"), name);
-
-    EXPECT_SUCCEEDED(app_bundle_->put_displayLanguage(CComBSTR(_T("en"))));
-    CComBSTR lang(_T(""));
-    EXPECT_SUCCEEDED(app_bundle_->get_displayLanguage(&lang));
-    EXPECT_STREQ(_T("en"), lang);
-
-    EXPECT_SUCCEEDED(app_bundle_->put_installSource(CComBSTR(_T("unittest"))));
-    CComBSTR source(_T(""));
-    EXPECT_SUCCEEDED(app_bundle_->get_installSource(&source));
-    EXPECT_STREQ(_T("unittest"), source);
-
-    EXPECT_SUCCEEDED(app_bundle_->put_priority(INSTALL_PRIORITY_LOW));
-    long priority = INSTALL_PRIORITY_HIGH;  // NOLINT
-    EXPECT_SUCCEEDED(app_bundle_->get_priority(&priority));
-    EXPECT_EQ(INSTALL_PRIORITY_LOW, priority);
-  }
-
-  // A copy of the protected enum in AppBundleState, allowing the individual
-  // tests to use these values.
-  enum BundleState {
-    STATE_INIT,
-    STATE_INITIALIZED,
-    STATE_BUSY,
-    STATE_READY,
-    STATE_PAUSED,
-    STATE_STOPPED,
-  };
-
-  BundleState GetBundleState() {
-    return static_cast<BundleState>(app_bundle_->app_bundle_state_->state_);
-  }
-
-  shared_ptr<AppBundle> app_bundle_;
-
- private:
-  DISALLOW_IMPLICIT_CONSTRUCTORS(AppBundleTest);
-};
-
-class AppBundleUninitializedTest : public AppBundleTest {
- protected:
-  explicit AppBundleUninitializedTest(bool is_machine)
-      : AppBundleTest(is_machine) {}
-
-  void TestPropertyDefaults() {
-    CComBSTR name;
-    EXPECT_SUCCEEDED(app_bundle_->get_displayName(&name));
-    EXPECT_STREQ(_T(""), name);
-
-    CComBSTR lang;
-    EXPECT_SUCCEEDED(app_bundle_->get_displayLanguage(&lang));
-    EXPECT_STREQ(lang::GetDefaultLanguage(is_machine_), lang);
-
-    CComBSTR install_source;
-    EXPECT_SUCCEEDED(app_bundle_->get_installSource(&install_source));
-    EXPECT_STREQ(_T("unknown"), install_source);
-
-    CComBSTR offline_dir;
-    EXPECT_SUCCEEDED(app_bundle_->get_offlineDirectory(&offline_dir));
-    EXPECT_STREQ(_T(""), offline_dir);
-
-    long priority;  // NOLINT
-    EXPECT_SUCCEEDED(app_bundle_->get_priority(&priority));
-    EXPECT_EQ(INSTALL_PRIORITY_HIGH, priority);
-  }
-};
-
-class AppBundleUninitializedMachineTest : public AppBundleUninitializedTest {
- protected:
-  AppBundleUninitializedMachineTest() : AppBundleUninitializedTest(true) {}
-};
-
-class AppBundleUninitializedUserTest : public AppBundleUninitializedTest {
- protected:
-  AppBundleUninitializedUserTest() : AppBundleUninitializedTest(false) {}
-};
-
-TEST_F(AppBundleUninitializedMachineTest, Properties) {
-  TestPropertyDefaults();
-  TestPropertyReflexiveness();
-}
-
-TEST_F(AppBundleUninitializedUserTest, Properties) {
-  TestPropertyDefaults();
-  TestPropertyReflexiveness();
-}
-
-class AppBundleInitializedTest : public AppBundleTest {
- protected:
-  explicit AppBundleInitializedTest(bool is_machine)
-      : AppBundleTest(is_machine) {}
-
-  virtual void SetUp() {
-    AppBundleTest::SetUp();
-    // TODO(omaha): UserRights::GetCallerToken() fails with ERROR_NO_TOKEN
-    // when initialize() is called for a machine bundle during these tests.
-    // It might make sense to move theimpersonation stuff to the COM wrapper,
-    // but I am not sure how this would work with the AppBundleStates.
-    // If we can do something about this, call initialize() in all cases.
-    if (is_machine_) {
-      SetAppBundleStateForUnitTest(app_bundle_.get(),
-                                   new fsm::AppBundleStateInitialized);
-    } else {
-      EXPECT_SUCCEEDED(app_bundle_->put_displayName(CComBSTR(_T("My Bundle"))));
-      EXPECT_SUCCEEDED(app_bundle_->put_displayLanguage(CComBSTR(_T("en"))));
-      EXPECT_SUCCEEDED(app_bundle_->initialize());
-    }
-  }
-};
-
-class AppBundleNoBundleMachineTest : public AppBundleNoBundleTest {
- protected:
-  AppBundleNoBundleMachineTest() : AppBundleNoBundleTest(true) {}
-};
-
-class AppBundleNoBundleUserTest : public AppBundleNoBundleTest {
- protected:
-  AppBundleNoBundleUserTest() : AppBundleNoBundleTest(false) {}
-};
-
-class AppBundleInitializedMachineTest : public AppBundleInitializedTest {
- protected:
-  AppBundleInitializedMachineTest() : AppBundleInitializedTest(true) {}
-};
-
-class AppBundleInitializedUserTest : public AppBundleInitializedTest {
- protected:
-  AppBundleInitializedUserTest() : AppBundleInitializedTest(false) {}
-};
-
-
-// The creation of an app bundle inserts it in the model and increments
-// the server module count.
-TEST_F(AppBundleNoBundleUserTest, ConstructorAndDestructor) {
-  EXPECT_CALL(*worker_, Lock()).WillOnce(Return(2));
-  EXPECT_CALL(*worker_, Unlock()).WillOnce(Return(1));
-
-  shared_ptr<AppBundle> app_bundle(model_->CreateAppBundle(is_machine_));
-  EXPECT_TRUE(app_bundle.get());
-  EXPECT_EQ(1, model_->GetNumberOfAppBundles());
-  EXPECT_EQ(app_bundle.get(), model_->GetAppBundle(0).get());
-  app_bundle.reset();
-  EXPECT_EQ(0, model_->GetNumberOfAppBundles());
-}
-
-TEST_F(AppBundleNoBundleMachineTest, ConstructorAndDestructor) {
-  EXPECT_CALL(*worker_, Lock()).WillOnce(Return(2));
-  EXPECT_CALL(*worker_, Unlock()).WillOnce(Return(1));
-
-  shared_ptr<AppBundle> app_bundle(model_->CreateAppBundle(is_machine_));
-  EXPECT_TRUE(app_bundle.get());
-  EXPECT_EQ(1, model_->GetNumberOfAppBundles());
-  EXPECT_EQ(app_bundle.get(), model_->GetAppBundle(0).get());
-  app_bundle.reset();
-  EXPECT_EQ(0, model_->GetNumberOfAppBundles());
-}
-
-class AppBundlePopulatedRegistryTest : public AppBundleInitializedTest {
- protected:
-  explicit AppBundlePopulatedRegistryTest(bool is_machine)
-      : AppBundleInitializedTest(is_machine),
-        hive_override_key_name_(kRegistryHiveOverrideRoot) {}
-
-  virtual void SetUp() {
-    AppBundleInitializedTest::SetUp();
-
-    RegKey::DeleteKey(hive_override_key_name_);
-    OverrideRegistryHives(hive_override_key_name_);
-
-    EXPECT_SUCCEEDED(ResourceManager::Create(
-      is_machine_, app_util::GetCurrentModuleDirectory(), _T("en")));
-
-    dummy_app_bundle_for_expected_apps_ = model_->CreateAppBundle(is_machine_);
-    ASSERT_TRUE(dummy_app_bundle_for_expected_apps_.get());
-    // TODO(omaha): Address with the TODO in AppBundleInitializedTest::SetUp.
-    if (is_machine_) {
-      SetAppBundleStateForUnitTest(dummy_app_bundle_for_expected_apps_.get(),
-                                   new fsm::AppBundleStateInitialized);
-    } else {
-      EXPECT_SUCCEEDED(dummy_app_bundle_for_expected_apps_->put_displayName(
-                           CComBSTR(_T("My Bundle"))));
-      EXPECT_SUCCEEDED(dummy_app_bundle_for_expected_apps_->put_displayLanguage(
-                           CComBSTR(_T("en"))));
-      EXPECT_SUCCEEDED(dummy_app_bundle_for_expected_apps_->initialize());
-    }
-  }
-
-  virtual void TearDown() {
-    dummy_app_bundle_for_expected_apps_.reset();
-
-    ResourceManager::Delete();
-
-    RestoreRegistryHives();
-    RegKey::DeleteKey(hive_override_key_name_);
-
-    AppBundleInitializedTest::TearDown();
-  }
-
-  // App will be cleaned up when bundle is destroyed.
-  // This is a hack for creating registry data. Would be nice to have a
-  // different mechanism.
-  App* CreateExpectedApp(const TCHAR* app_id) {
-    App* app = NULL;
-    EXPECT_SUCCEEDED(
-        dummy_app_bundle_for_expected_apps_->createApp(CComBSTR(app_id), &app));
-    ASSERT1(app);
-    return app;
-  }
-
-  void PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(
-      App** expected_app0,
-      App** expected_app1,
-      App** expected_app2) {
-    *expected_app0 = CreateExpectedApp(kGuid1);
-    *expected_app1 = CreateExpectedApp(kGuid2);
-    *expected_app2 = CreateExpectedApp(kGuid3);
-    App* opposite_hive_app1 = CreateExpectedApp(kGuid6);
-    App* opposite_hive_app2 = CreateExpectedApp(kGuid7);
-    omaha::PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(
-        is_machine_,
-        *expected_app0,
-        *expected_app1,
-        *expected_app2,
-        opposite_hive_app1,
-        opposite_hive_app2);
-
-    // Reload install age since registry has been changed.
-    AppManager::Instance()->ReadAppInstallTimeDiff(*expected_app0);
-    AppManager::Instance()->ReadAppInstallTimeDiff(*expected_app1);
-    AppManager::Instance()->ReadAppInstallTimeDiff(*expected_app2);
-    AppManager::Instance()->ReadAppInstallTimeDiff(opposite_hive_app1);
-    AppManager::Instance()->ReadAppInstallTimeDiff(opposite_hive_app2);
-  }
-
-  CString hive_override_key_name_;
-  shared_ptr<AppBundle> dummy_app_bundle_for_expected_apps_;
-  LLock lock_;
-
-  DISALLOW_IMPLICIT_CONSTRUCTORS(AppBundlePopulatedRegistryTest);
-};
-
-class AppBundlePopulatedRegistryMachineTest
-    : public AppBundlePopulatedRegistryTest {
- protected:
-  AppBundlePopulatedRegistryMachineTest()
-      : AppBundlePopulatedRegistryTest(true) {}
-};
-
-class AppBundlePopulatedRegistryUserTest
-    : public AppBundlePopulatedRegistryTest {
- protected:
-  AppBundlePopulatedRegistryUserTest()
-      : AppBundlePopulatedRegistryTest(false) {}
-};
-
-TEST_F(AppBundleInitializedUserTest, CountAndItem_NoApps) {
-  EXPECT_EQ(0, app_bundle_->GetNumberOfApps());
-  long num_apps = 0;  // NOLINT
-  EXPECT_SUCCEEDED(app_bundle_->get_Count(&num_apps));
-  EXPECT_EQ(0, num_apps);
-
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(app_bundle_->GetApp(0));
-  }
-  App* app0_obtained = NULL;
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_INVALID_INDEX),
-            app_bundle_->get_Item(0, &app0_obtained));
-  EXPECT_FALSE(app0_obtained);
-
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(app_bundle_->GetApp(1));
-  }
-  App* app1_obtained = NULL;
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_INVALID_INDEX),
-            app_bundle_->get_Item(1, &app1_obtained));
-  EXPECT_FALSE(app1_obtained);
-}
-
-TEST_F(AppBundleInitializedUserTest, CountAndItem_OneApp) {
-  App* app0_created = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app0_created));
-
-  EXPECT_EQ(1, app_bundle_->GetNumberOfApps());
-  long num_apps = 0;  // NOLINT
-  EXPECT_SUCCEEDED(app_bundle_->get_Count(&num_apps));
-  EXPECT_EQ(1, num_apps);
-
-  EXPECT_TRUE(app_bundle_->GetApp(0));
-  App* app0_obtained = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->get_Item(0, &app0_obtained));
-  EXPECT_TRUE(app0_obtained);
-
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(app_bundle_->GetApp(1));
-  }
-  App* app1_obtained = NULL;
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_INVALID_INDEX),
-            app_bundle_->get_Item(1, &app1_obtained));
-  EXPECT_FALSE(app1_obtained);
-}
-
-TEST_F(AppBundleInitializedUserTest, CountAndItem_TwoApp) {
-  App* app0_created = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app0_created));
-  App* app1_created = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid2), &app1_created));
-
-  EXPECT_EQ(2, app_bundle_->GetNumberOfApps());
-  long num_apps = 0;  // NOLINT
-  EXPECT_SUCCEEDED(app_bundle_->get_Count(&num_apps));
-  EXPECT_EQ(2, num_apps);
-
-  EXPECT_TRUE(app_bundle_->GetApp(0));
-  App* app0_obtained = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->get_Item(0, &app0_obtained));
-  EXPECT_TRUE(app0_obtained);
-  EXPECT_EQ(app0_created, app0_obtained);
-
-  EXPECT_TRUE(app_bundle_->GetApp(1));
-  App* app1_obtained = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->get_Item(1, &app1_obtained));
-  EXPECT_TRUE(app1_obtained);
-
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(app_bundle_->GetApp(2));
-  }
-  App* app2_obtained = NULL;
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_INVALID_INDEX),
-            app_bundle_->get_Item(2, &app2_obtained));
-  EXPECT_FALSE(app2_obtained);
-}
-
-TEST_F(AppBundleInitializedUserTest, createApp) {
-  App* app0_created = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app0_created));
-  EXPECT_TRUE(app0_created);
-  EXPECT_EQ(1, app_bundle_->GetNumberOfApps());
-
-  App* app0 = app_bundle_->GetApp(0);
-  EXPECT_EQ(app0_created, app0);
-
-  EXPECT_STREQ(CString(kGuid1).MakeUpper(), app0->app_guid_string());
-  ValidateFreshInstallDefaultValues(*app0);
-}
-
-TEST_F(AppBundleInitializedUserTest, createApp_TwoApps) {
-  App* app0_created = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app0_created));
-  EXPECT_TRUE(app0_created);
-  EXPECT_EQ(1, app_bundle_->GetNumberOfApps());
-
-  App* app0 = app_bundle_->GetApp(0);
-  EXPECT_EQ(app0_created, app0);
-
-  EXPECT_STREQ(CString(kGuid1).MakeUpper(), app0->app_guid_string());
-  ValidateFreshInstallDefaultValues(*app0);
-
-  // Add a second app to the bundle.
-
-  App* app1_created = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid2), &app1_created));
-  EXPECT_TRUE(app1_created);
-  EXPECT_EQ(2, app_bundle_->GetNumberOfApps());
-
-  App* app1 = app_bundle_->GetApp(1);
-  EXPECT_EQ(app1_created, app1);
-
-  EXPECT_STREQ(CString(kGuid2).MakeUpper(), app1->app_guid_string());
-  ValidateFreshInstallDefaultValues(*app1);
-}
-
-TEST_F(AppBundleInitializedUserTest, createApp_SameAppTwice) {
-  App* app0_created = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app0_created));
-  EXPECT_TRUE(app0_created);
-  EXPECT_EQ(1, app_bundle_->GetNumberOfApps());
-
-  App* app0 = app_bundle_->GetApp(0);
-  EXPECT_EQ(app0_created, app0);
-
-  EXPECT_STREQ(CString(kGuid1).MakeUpper(), app0->app_guid_string());
-  ValidateFreshInstallDefaultValues(*app0);
-
-  // Attempt to add the same app to the bundle again.
-
-  App* app1_created = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createApp(CComBSTR(kGuid1), &app1_created));
-  EXPECT_FALSE(app1_created);
-  EXPECT_EQ(1, app_bundle_->GetNumberOfApps());
-}
-
-TEST_F(AppBundleInitializedUserTest, createApp_AfterUpdateCheck) {
-  DummyUserWorkItem dummy_work_item;
-  EXPECT_CALL(*worker_, CheckForUpdateAsync(_))
-      .WillOnce(SetWorkItem(&dummy_work_item));
-
-  App* app0_created = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app0_created));
-  EXPECT_SUCCEEDED(app_bundle_->checkForUpdate());
-
-  App* app1_created = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createApp(CComBSTR(kGuid2), &app1_created));
-
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-}
-
-TEST_F(AppBundleInitializedMachineTest, createApp) {
-  App* app0_created = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app0_created));
-  EXPECT_TRUE(app0_created);
-  EXPECT_EQ(1, app_bundle_->GetNumberOfApps());
-
-  App* app0 = app_bundle_->GetApp(0);
-  EXPECT_EQ(app0_created, app0);
-
-  EXPECT_STREQ(CString(kGuid1).MakeUpper(), app0->app_guid_string());
-  ValidateFreshInstallDefaultValues(*app0);
-}
-
-TEST_F(AppBundleInitializedUserTest, checkForUpdate_NoApps) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->checkForUpdate());
-}
-
-// Does not verify the update check occurs.
-TEST_F(AppBundleInitializedUserTest, checkForUpdate_OneApp) {
-  DummyUserWorkItem dummy_work_item;
-  EXPECT_CALL(*worker_, CheckForUpdateAsync(_))
-      .WillOnce(SetWorkItem(&dummy_work_item));
-
-  App* app = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app));
-
-  EXPECT_SUCCEEDED(app_bundle_->checkForUpdate());
-
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-}
-
-// Does not verify the update check occurs.
-TEST_F(AppBundleInitializedUserTest, checkForUpdate_TwoApps) {
-  DummyUserWorkItem dummy_work_item;
-  EXPECT_CALL(*worker_, CheckForUpdateAsync(_))
-      .WillOnce(SetWorkItem(&dummy_work_item));
-
-  App* app0 = NULL;
-  App* app1 = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app0));
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid2), &app1));
-
-  EXPECT_SUCCEEDED(app_bundle_->checkForUpdate());
-
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-}
-
-TEST_F(AppBundleInitializedUserTest, checkForUpdate_Twice) {
-  DummyUserWorkItem dummy_work_item;
-  EXPECT_CALL(*worker_, CheckForUpdateAsync(_))
-      .WillOnce(SetWorkItem(&dummy_work_item));
-
-  App* app = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app));
-
-  EXPECT_SUCCEEDED(app_bundle_->checkForUpdate());
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->checkForUpdate());
-}
-
-TEST_F(AppBundleInitializedUserTest, checkForUpdate_WhileBundleIsBusy) {
-  DummyUserWorkItem dummy_work_item;
-  EXPECT_CALL(*worker_, CheckForUpdateAsync(_))
-      .WillOnce(SetWorkItem(&dummy_work_item));
-
-  App* app = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app));
-
-  EXPECT_SUCCEEDED(app_bundle_->checkForUpdate());
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->checkForUpdate());
-
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-}
-
-// Does not verify the update check occurs.
-TEST_F(AppBundleInitializedMachineTest, checkForUpdate_OneApp) {
-  DummyUserWorkItem dummy_work_item;
-  EXPECT_CALL(*worker_, CheckForUpdateAsync(_))
-      .WillOnce(SetWorkItem(&dummy_work_item));
-
-  App* app = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app));
-
-  EXPECT_SUCCEEDED(app_bundle_->checkForUpdate());
-
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-}
-
-TEST_F(AppBundleInitializedUserTest, download_WithoutUpdateCheck) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->download());
-}
-
-// The AppBundle does not prevent this, but the apps may enter the error state.
-TEST_F(AppBundleInitializedUserTest, download_AfterInstall) {
-  DummyUserWorkItem dummy_work_item;
-  {
-    ::testing::InSequence dummy;
-    EXPECT_CALL(*worker_, CheckForUpdateAsync(_))
-        .WillOnce(SetWorkItem(&dummy_work_item));
-    EXPECT_CALL(*worker_, DownloadAndInstallAsync(_))
-        .WillOnce(SetWorkItem(&dummy_work_item));
-    EXPECT_CALL(*worker_, DownloadAsync(_))
-        .WillOnce(SetWorkItem(&dummy_work_item));
-  }
-
-  App* app = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app));
-
-  EXPECT_SUCCEEDED(app_bundle_->checkForUpdate());
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-  EXPECT_SUCCEEDED(app_bundle_->install());
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-
-  EXPECT_SUCCEEDED(app_bundle_->download());
-
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-}
-
-// The AppBundle does not prevent this, but the apps may enter the error state.
-TEST_F(AppBundleInitializedUserTest, download_Twice) {
-  DummyUserWorkItem dummy_work_item;
-  {
-    ::testing::InSequence dummy;
-    EXPECT_CALL(*worker_, CheckForUpdateAsync(_))
-        .WillOnce(SetWorkItem(&dummy_work_item));
-    EXPECT_CALL(*worker_, DownloadAsync(_))
-        .Times(2)
-        .WillRepeatedly(SetWorkItem(&dummy_work_item));
-  }
-
-  App* app = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app));
-
-  EXPECT_SUCCEEDED(app_bundle_->checkForUpdate());
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-  EXPECT_SUCCEEDED(app_bundle_->download());
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-
-  EXPECT_SUCCEEDED(app_bundle_->download());
-
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-}
-
-// Simulates the update check still in progress when download() is called.
-TEST_F(AppBundleInitializedUserTest, download_WhileBundleIsBusy) {
-  DummyUserWorkItem dummy_work_item;
-  EXPECT_CALL(*worker_, CheckForUpdateAsync(_))
-      .WillOnce(SetWorkItem(&dummy_work_item));
-
-  App* app = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app));
-
-  EXPECT_SUCCEEDED(app_bundle_->checkForUpdate());
-
-  EXPECT_EQ(GOOPDATE_E_NON_BLOCKING_CALL_PENDING, app_bundle_->download());
-
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-}
-
-// The AppBundle does not prevent this, but the apps may enter the error state.
-TEST_F(AppBundleInitializedMachineTest, download_Twice) {
-  DummyUserWorkItem dummy_work_item;
-  {
-    ::testing::InSequence dummy;
-    EXPECT_CALL(*worker_, CheckForUpdateAsync(_))
-        .WillOnce(SetWorkItem(&dummy_work_item));
-    EXPECT_CALL(*worker_, DownloadAsync(_))
-        .Times(2)
-        .WillRepeatedly(SetWorkItem(&dummy_work_item));
-  }
-
-  App* app = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app));
-
-  EXPECT_SUCCEEDED(app_bundle_->checkForUpdate());
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-  EXPECT_SUCCEEDED(app_bundle_->download());
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-
-  EXPECT_SUCCEEDED(app_bundle_->download());
-
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-}
-
-TEST_F(AppBundleInitializedUserTest, install_WithoutUpdateCheck) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->install());
-}
-
-TEST_F(AppBundleInitializedUserTest, install_WithoutDownload) {
-  DummyUserWorkItem dummy_work_item;
-  {
-    ::testing::InSequence dummy;
-    EXPECT_CALL(*worker_, CheckForUpdateAsync(_))
-        .WillOnce(SetWorkItem(&dummy_work_item));
-    EXPECT_CALL(*worker_, DownloadAndInstallAsync(_))
-        .WillOnce(SetWorkItem(&dummy_work_item));
-  }
-
-  App* app = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app));
-
-  EXPECT_SUCCEEDED(app_bundle_->checkForUpdate());
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-
-  EXPECT_SUCCEEDED(app_bundle_->install());
-
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-}
-
-TEST_F(AppBundleInitializedUserTest, install_AfterDownload) {
-  DummyUserWorkItem dummy_work_item;
-  {
-    ::testing::InSequence dummy;
-    EXPECT_CALL(*worker_, CheckForUpdateAsync(_))
-        .WillOnce(SetWorkItem(&dummy_work_item));
-    EXPECT_CALL(*worker_, DownloadAsync(_))
-        .WillOnce(SetWorkItem(&dummy_work_item));
-    EXPECT_CALL(*worker_, DownloadAndInstallAsync(_))
-        .WillOnce(SetWorkItem(&dummy_work_item));
-  }
-
-  App* app = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app));
-
-  EXPECT_SUCCEEDED(app_bundle_->checkForUpdate());
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-  EXPECT_SUCCEEDED(app_bundle_->download());
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-
-  EXPECT_SUCCEEDED(app_bundle_->install());
-
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-}
-
-// The AppBundle does not prevent this, but the apps may enter the error state.
-TEST_F(AppBundleInitializedUserTest, install_Twice) {
-  DummyUserWorkItem dummy_work_item;
-  {
-    ::testing::InSequence dummy;
-    EXPECT_CALL(*worker_, CheckForUpdateAsync(_))
-        .WillOnce(SetWorkItem(&dummy_work_item));
-    EXPECT_CALL(*worker_, DownloadAndInstallAsync(_))
-        .Times(2)
-        .WillRepeatedly(SetWorkItem(&dummy_work_item));
-  }
-
-  App* app = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app));
-
-  EXPECT_SUCCEEDED(app_bundle_->checkForUpdate());
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-  EXPECT_SUCCEEDED(app_bundle_->install());
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-
-  EXPECT_SUCCEEDED(app_bundle_->install());
-
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-}
-
-// TODO(omaha): These tests are disabled because CaptureCallerPrimaryToken()
-// fails. We could move this to AppBundleWrapper, but we would need to expose
-// some functions to AppBundleWrapper.
-TEST_F(AppBundleInitializedMachineTest, DISABLED_install_WithoutDownload) {
-  DummyUserWorkItem dummy_work_item;
-  {
-    ::testing::InSequence dummy;
-    EXPECT_CALL(*worker_, CheckForUpdateAsync(_))
-        .WillOnce(SetWorkItem(&dummy_work_item));
-    EXPECT_CALL(*worker_, DownloadAndInstallAsync(_))
-        .WillOnce(SetWorkItem(&dummy_work_item));
-  }
-
-  App* app = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app));
-
-  EXPECT_SUCCEEDED(app_bundle_->checkForUpdate());
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-
-  EXPECT_SUCCEEDED(app_bundle_->install());
-
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-}
-
-TEST_F(AppBundleInitializedMachineTest, DISABLED_install_AfterDownload) {
-  DummyUserWorkItem dummy_work_item;
-  {
-    ::testing::InSequence dummy;
-    EXPECT_CALL(*worker_, CheckForUpdateAsync(_))
-        .WillOnce(SetWorkItem(&dummy_work_item));
-    EXPECT_CALL(*worker_, DownloadAsync(_))
-        .WillOnce(SetWorkItem(&dummy_work_item));
-    EXPECT_CALL(*worker_, DownloadAndInstallAsync(_))
-        .WillOnce(SetWorkItem(&dummy_work_item));
-  }
-
-  App* app = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app));
-
-  EXPECT_SUCCEEDED(app_bundle_->checkForUpdate());
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-  EXPECT_SUCCEEDED(app_bundle_->download());
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-
-  EXPECT_SUCCEEDED(app_bundle_->install());
-
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-}
-
-// Simulates the update check still in progress when install is called.
-TEST_F(AppBundleInitializedUserTest, install_WhileBundleIsBusy) {
-  DummyUserWorkItem dummy_work_item;
-  EXPECT_CALL(*worker_, CheckForUpdateAsync(_))
-      .WillOnce(SetWorkItem(&dummy_work_item));
-
-  App* app = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app));
-
-  EXPECT_SUCCEEDED(app_bundle_->checkForUpdate());
-  EXPECT_EQ(GOOPDATE_E_NON_BLOCKING_CALL_PENDING, app_bundle_->install());
-
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-}
-
-// Also tests adding another app via the same method.
-TEST_F(AppBundlePopulatedRegistryUserTest, createInstalledApp_Present_TwoApps) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(&expected_app0,
-                                                              &expected_app1,
-                                                              &expected_app2);
-
-  App* app0_created = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createInstalledApp(CComBSTR(kGuid1),
-                                                   &app0_created));
-  EXPECT_TRUE(app0_created);
-  EXPECT_EQ(1, app_bundle_->GetNumberOfApps());
-
-  App* app0 = app_bundle_->GetApp(0);
-  EXPECT_EQ(app0_created, app0);
-  EXPECT_STREQ(CString(kGuid1).MakeUpper(), app0->app_guid_string());
-  EXPECT_SUCCEEDED(expected_app0->put_isEulaAccepted(VARIANT_TRUE));
-  ValidateExpectedValues(*expected_app0, *app0);
-
-  // Add a second app to the bundle.
-
-  App* app1_created = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createInstalledApp(CComBSTR(kGuid2),
-                                                   &app1_created));
-  EXPECT_TRUE(app1_created);
-  EXPECT_EQ(2, app_bundle_->GetNumberOfApps());
-
-  long num_apps = 0;  // NOLINT
-  EXPECT_SUCCEEDED(app_bundle_->get_Count(&num_apps));
-  EXPECT_EQ(2, num_apps);
-
-  App* app1 = app_bundle_->GetApp(1);
-  EXPECT_EQ(app1_created, app1);
-  EXPECT_STREQ(CString(kGuid2).MakeUpper(), app1->app_guid_string());
-  SetDisplayName(kDefaultAppName, expected_app1);
-  EXPECT_SUCCEEDED(expected_app1->put_isEulaAccepted(VARIANT_TRUE));
-  ValidateExpectedValues(*expected_app1, *app1);
-
-  // Verify COM methods return the same values as the C++ methods used above.
-  EXPECT_SUCCEEDED(app_bundle_->get_Count(&num_apps));
-  EXPECT_EQ(2, num_apps);
-  App* app0_obtained = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->get_Item(0, &app0_obtained));
-  EXPECT_EQ(app0, app0_obtained);
-  App* app1_obtained = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->get_Item(1, &app1_obtained));
-  EXPECT_EQ(app1, app1_obtained);
-}
-
-TEST_F(AppBundlePopulatedRegistryMachineTest, createInstalledApp_Present) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(&expected_app0,
-                                                              &expected_app1,
-                                                              &expected_app2);
-
-  App* app0_created = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createInstalledApp(CComBSTR(kGuid1),
-                                                   &app0_created));
-  EXPECT_TRUE(app0_created);
-  EXPECT_EQ(1, app_bundle_->GetNumberOfApps());
-
-  App* app0 = app_bundle_->GetApp(0);
-  EXPECT_EQ(app0_created, app0);
-  EXPECT_STREQ(CString(kGuid1).MakeUpper(), app0->app_guid_string());
-  EXPECT_SUCCEEDED(expected_app0->put_isEulaAccepted(VARIANT_TRUE));
-  ValidateExpectedValues(*expected_app0, *app0);
-
-  long num_apps = 0;  // NOLINT
-  EXPECT_SUCCEEDED(app_bundle_->get_Count(&num_apps));
-  EXPECT_EQ(1, num_apps);
-}
-
-// TODO(omaha3): Test that the same app can be added to different bundles for
-// each of the create methods.
-TEST_F(AppBundlePopulatedRegistryUserTest, createInstalledApp_SameAppTwice) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(&expected_app0,
-                                                              &expected_app1,
-                                                              &expected_app2);
-
-  App* app0_created = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createInstalledApp(CComBSTR(kGuid1),
-                                                   &app0_created));
-  EXPECT_TRUE(app0_created);
-  EXPECT_EQ(1, app_bundle_->GetNumberOfApps());
-
-  App* app0 = app_bundle_->GetApp(0);
-  EXPECT_EQ(app0_created, app0);
-  EXPECT_STREQ(CString(kGuid1).MakeUpper(), app0->app_guid_string());
-  EXPECT_SUCCEEDED(expected_app0->put_isEulaAccepted(VARIANT_TRUE));
-  ValidateExpectedValues(*expected_app0, *app0);
-
-  // Attempt to add the same app to the bundle again.
-
-  App* app1_created = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createInstalledApp(CComBSTR(kGuid1), &app1_created));
-  EXPECT_FALSE(app1_created);
-  EXPECT_EQ(1, app_bundle_->GetNumberOfApps());
-}
-
-TEST_F(AppBundlePopulatedRegistryUserTest, createInstalledApp_NotPresent) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(&expected_app0,
-                                                              &expected_app1,
-                                                              &expected_app2);
-
-  App* app0_created = NULL;
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            app_bundle_->createInstalledApp(
-                CComBSTR(_T("{2D5F8E16-B56B-496a-BA8B-3A0B5EC17F4F}")),
-                &app0_created));
-  EXPECT_FALSE(app0_created);
-  EXPECT_EQ(0, app_bundle_->GetNumberOfApps());
-}
-
-TEST_F(AppBundlePopulatedRegistryUserTest,
-       createInstalledApp_NoAppsRegistered) {
-  App* app0_created = NULL;
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            app_bundle_->createInstalledApp(CComBSTR(kGuid1), &app0_created));
-  EXPECT_FALSE(app0_created);
-  EXPECT_EQ(0, app_bundle_->GetNumberOfApps());
-}
-
-TEST_F(AppBundlePopulatedRegistryUserTest,
-       createInstalledApp_AfterUpdateCheck) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(&expected_app0,
-                                                              &expected_app1,
-                                                              &expected_app2);
-
-  DummyUserWorkItem dummy_work_item;
-  EXPECT_CALL(*worker_, CheckForUpdateAsync(_))
-      .WillOnce(SetWorkItem(&dummy_work_item));
-
-  App* app0_created = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createInstalledApp(CComBSTR(kGuid1),
-                                                   &app0_created));
-
-  EXPECT_SUCCEEDED(app_bundle_->checkForUpdate());
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-
-  App* app1_created = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createInstalledApp(CComBSTR(kGuid2), &app1_created));
-}
-
-TEST_F(AppBundlePopulatedRegistryUserTest, createAllInstalledApps) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(&expected_app0,
-                                                              &expected_app1,
-                                                              &expected_app2);
-  EXPECT_HRESULT_SUCCEEDED(RegKey::CreateKey(
-      AppendRegKeyPath(USER_REG_CLIENT_STATE, kGuid4)));  // Avoid assert.
-
-  // See comment in machine createAllInstalledApps test.
-  const CString incomplete_clients_key =
-      AppendRegKeyPath(USER_REG_CLIENTS, kGuid4);
-  EXPECT_TRUE(RegKey::HasKey(incomplete_clients_key));
-  EXPECT_FALSE(RegKey::HasValue(incomplete_clients_key,
-                                kRegValueProductVersion));
-
-  EXPECT_SUCCEEDED(app_bundle_->createAllInstalledApps());
-  EXPECT_EQ(2, app_bundle_->GetNumberOfApps());
-
-  App* app0 = app_bundle_->GetApp(0);
-  EXPECT_STREQ(CString(kGuid1).MakeUpper(), app0->app_guid_string());
-  EXPECT_SUCCEEDED(expected_app0->put_isEulaAccepted(VARIANT_TRUE));
-  ValidateExpectedValues(*expected_app0, *app0);
-
-  App* app1 = app_bundle_->GetApp(1);
-  EXPECT_STREQ(CString(kGuid2).MakeUpper(), app1->app_guid_string());
-  SetDisplayName(kDefaultAppName, expected_app1);
-  EXPECT_SUCCEEDED(expected_app1->put_isEulaAccepted(VARIANT_TRUE));
-  ValidateExpectedValues(*expected_app1, *app1);
-
-  // Verify COM methods return the same values as the C++ methods used above.
-  long num_registered_apps = 0;  // NOLINT
-  EXPECT_SUCCEEDED(app_bundle_->get_Count(&num_registered_apps));
-  EXPECT_EQ(2, num_registered_apps);
-  App* app0_obtained = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->get_Item(0, &app0_obtained));
-  EXPECT_EQ(app0, app0_obtained);
-  App* app1_obtained = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->get_Item(1, &app1_obtained));
-  EXPECT_EQ(app1, app1_obtained);
-}
-
-TEST_F(AppBundlePopulatedRegistryMachineTest, createAllInstalledApps) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(&expected_app0,
-                                                              &expected_app1,
-                                                              &expected_app2);
-  EXPECT_HRESULT_SUCCEEDED(RegKey::CreateKey(
-      AppendRegKeyPath(MACHINE_REG_CLIENT_STATE, kGuid4)));  // Avoid assert.
-
-  // An important part of this test is that processing continues and
-  // even though there is a key for an app that is not properly
-  // registered (e.g. it does not have a pv value or has an invalid pv value).
-  // Since this is so important, explicitly check registry was set up correctly.
-  // Invalid pv value type is checked in a separate test since it causes an
-  // assert.
-  // An app without a pv is not added to the bundle.
-  const CString incomplete_clients_key =
-      AppendRegKeyPath(MACHINE_REG_CLIENTS, kGuid4);
-  EXPECT_TRUE(RegKey::HasKey(incomplete_clients_key));
-  EXPECT_FALSE(RegKey::HasValue(incomplete_clients_key,
-                                kRegValueProductVersion));
-
-  EXPECT_SUCCEEDED(app_bundle_->createAllInstalledApps());
-  EXPECT_EQ(2, app_bundle_->GetNumberOfApps());
-
-  App* app0 = app_bundle_->GetApp(0);
-  EXPECT_STREQ(CString(kGuid1).MakeUpper(), app0->app_guid_string());
-  EXPECT_SUCCEEDED(expected_app0->put_isEulaAccepted(VARIANT_TRUE));
-  ValidateExpectedValues(*expected_app0, *app0);
-
-  App* app1 = app_bundle_->GetApp(1);
-  EXPECT_STREQ(CString(kGuid2).MakeUpper(), app1->app_guid_string());
-  SetDisplayName(kDefaultAppName, expected_app1);
-  EXPECT_SUCCEEDED(expected_app1->put_isEulaAccepted(VARIANT_TRUE));
-  ValidateExpectedValues(*expected_app1, *app1);
-
-  // Verify COM methods return the same values as the C++ methods used above.
-  long num_registered_apps = 0;  // NOLINT
-  EXPECT_SUCCEEDED(app_bundle_->get_Count(&num_registered_apps));
-  EXPECT_EQ(2, num_registered_apps);
-  App* app0_obtained = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->get_Item(0, &app0_obtained));
-  EXPECT_EQ(app0, app0_obtained);
-  App* app1_obtained = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->get_Item(1, &app1_obtained));
-  EXPECT_EQ(app1, app1_obtained);
-}
-
-TEST_F(AppBundlePopulatedRegistryUserTest,
-       createAllInstalledApps_InvalidPvValueType) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(&expected_app0,
-                                                              &expected_app1,
-                                                              &expected_app2);
-
-  // Incorrect data type for pv. See comment in machine createAllInstalledApps
-  // test.
-  // It is important that this value is alphabetically before the other AppIds.
-  // This allows us to test that processing continues despite the bad pv.
-  const TCHAR* const kInvalidPvTypeAppId =
-      _T("{0150B619-867C-4985-B193-ED309A23EE36}");
-  const CString invalid_pv_type_clients_key =
-      AppendRegKeyPath(USER_REG_CLIENTS, kInvalidPvTypeAppId);
-  const DWORD kInvalidPvDword = 0x3039;
-  const TCHAR* const kInvalidPvDwordAsString = _T("\x3039");
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(invalid_pv_type_clients_key,
-                                            kRegValueProductVersion,
-                                            kInvalidPvDword));
-  EXPECT_TRUE(RegKey::HasValue(invalid_pv_type_clients_key,
-                               kRegValueProductVersion));
-  DWORD value_type = REG_SZ;
-  EXPECT_SUCCEEDED(RegKey::GetValueType(invalid_pv_type_clients_key,
-                                        kRegValueProductVersion,
-                                        &value_type));
-  EXPECT_NE(REG_SZ, value_type);
-  App* invalid_pv_app = CreateExpectedApp(kInvalidPvTypeAppId);
-  invalid_pv_app->current_version()->set_version(kInvalidPvDwordAsString);
-  invalid_pv_app->set_days_since_last_active_ping(-1);
-  invalid_pv_app->set_days_since_last_roll_call(-1);
-  SetDisplayName(kDefaultAppName, invalid_pv_app);
-
-  {
-    // An assert occurs when reading the wrong value type.
-    ExpectAsserts expect_asserts;
-    EXPECT_SUCCEEDED(app_bundle_->createAllInstalledApps());
-  }
-
-  EXPECT_EQ(3, app_bundle_->GetNumberOfApps());
-
-  // The invalid pv app is added to the bundle with an unreadable pv.
-  App* app0 = app_bundle_->GetApp(0);
-  EXPECT_STREQ(kInvalidPvTypeAppId, app0->app_guid_string());
-  EXPECT_STREQ(kInvalidPvDwordAsString, app0->current_version()->version());
-  EXPECT_SUCCEEDED(invalid_pv_app->put_isEulaAccepted(VARIANT_TRUE));
-  ValidateExpectedValues(*invalid_pv_app, *app0);
-
-  App* app1 = app_bundle_->GetApp(1);
-  EXPECT_STREQ(CString(kGuid1).MakeUpper(), app1->app_guid_string());
-  EXPECT_SUCCEEDED(expected_app0->put_isEulaAccepted(VARIANT_TRUE));
-  ValidateExpectedValues(*expected_app0, *app1);
-
-  App* app2 = app_bundle_->GetApp(2);
-  EXPECT_STREQ(CString(kGuid2).MakeUpper(), app2->app_guid_string());
-  SetDisplayName(kDefaultAppName, expected_app1);
-  EXPECT_SUCCEEDED(expected_app1->put_isEulaAccepted(VARIANT_TRUE));
-  ValidateExpectedValues(*expected_app1, *app2);
-}
-
-TEST_F(AppBundlePopulatedRegistryUserTest,
-       createAllInstalledApps_NoAppsRegistered) {
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            app_bundle_->createAllInstalledApps());
-  EXPECT_EQ(0, app_bundle_->GetNumberOfApps());
-
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(app_bundle_->GetApp(0));
-  }
-}
-
-TEST_F(AppBundlePopulatedRegistryUserTest,
-       createAllInstalledApps_OneAppRegistered) {
-  CString clients_key_name = AppendRegKeyPath(USER_REG_CLIENTS, kGuid1);
-  EXPECT_SUCCEEDED(RegKey::SetValue(clients_key_name,
-                                    kRegValueProductVersion,
-                                    _T("1.0.0.0")));
-  EXPECT_HRESULT_SUCCEEDED(RegKey::CreateKey(
-      AppendRegKeyPath(USER_REG_CLIENT_STATE, kGuid1)));  // Avoid assert.
-
-  EXPECT_SUCCEEDED(app_bundle_->createAllInstalledApps());
-  EXPECT_EQ(1, app_bundle_->GetNumberOfApps());
-
-  App* app0 = app_bundle_->GetApp(0);
-  EXPECT_STREQ(CString(kGuid1).MakeUpper(), app0->app_guid_string());
-}
-
-TEST_F(AppBundlePopulatedRegistryUserTest,
-       createAllInstalledApps_AfterUpdateCheck) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(&expected_app0,
-                                                              &expected_app1,
-                                                              &expected_app2);
-  EXPECT_HRESULT_SUCCEEDED(RegKey::CreateKey(
-      AppendRegKeyPath(USER_REG_CLIENT_STATE, kGuid4)));  // Avoid assert.
-
-  DummyUserWorkItem dummy_work_item;
-  EXPECT_CALL(*worker_, CheckForUpdateAsync(_))
-      .WillOnce(SetWorkItem(&dummy_work_item));
-
-  EXPECT_SUCCEEDED(app_bundle_->createAllInstalledApps());
-
-  EXPECT_SUCCEEDED(app_bundle_->checkForUpdate());
-  app_bundle_->CompleteAsyncCall();  // Simulate thread completion.
-
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->createAllInstalledApps());
-}
-
-TEST_F(AppBundlePopulatedRegistryUserTest, createApp_After_createInstalledApp) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(&expected_app0,
-                                                              &expected_app1,
-                                                              &expected_app2);
-
-  App* app0_created = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createInstalledApp(CComBSTR(kGuid1),
-                                                   &app0_created));
-
-  App* app1_created = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createApp(CComBSTR(kGuid2), &app1_created));
-}
-
-TEST_F(AppBundlePopulatedRegistryUserTest, createApp_createAllInstalledApps) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(&expected_app0,
-                                                              &expected_app1,
-                                                              &expected_app2);
-  EXPECT_HRESULT_SUCCEEDED(RegKey::CreateKey(
-      AppendRegKeyPath(USER_REG_CLIENT_STATE, kGuid4)));  // Avoid assert.
-
-  EXPECT_SUCCEEDED(app_bundle_->createAllInstalledApps());
-
-  App* app0_created = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createApp(CComBSTR(kGuid1), &app0_created));
-}
-
-TEST_F(AppBundleInitializedUserTest, createInstalledApp_After_createApp) {
-  App* app0_created = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app0_created));
-
-  App* app1_created = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createInstalledApp(CComBSTR(kGuid2), &app1_created));
-}
-
-TEST_F(AppBundlePopulatedRegistryUserTest,
-       createInstalledApp_After_createAllInstalledApps) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(&expected_app0,
-                                                              &expected_app1,
-                                                              &expected_app2);
-  EXPECT_HRESULT_SUCCEEDED(RegKey::CreateKey(
-      AppendRegKeyPath(USER_REG_CLIENT_STATE, kGuid4)));  // Avoid assert.
-
-  EXPECT_SUCCEEDED(app_bundle_->createAllInstalledApps());
-
-  App* app0_created = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createInstalledApp(CComBSTR(kGuid1), &app0_created));
-}
-
-TEST_F(AppBundleInitializedUserTest, createAllInstalledApps_After_createApp) {
-  App* app0_created = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app0_created));
-
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->createAllInstalledApps());
-}
-
-TEST_F(AppBundlePopulatedRegistryUserTest,
-       createAllInstalledApps_After_createInstalledApp) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(&expected_app0,
-                                                              &expected_app1,
-                                                              &expected_app2);
-
-  App* app0_created = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createInstalledApp(CComBSTR(kGuid1),
-                                                   &app0_created));
-
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->createAllInstalledApps());
-}
-
-TEST_F(AppBundlePopulatedRegistryUserTest,
-       createAllInstalledApps_Twice) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(&expected_app0,
-                                                              &expected_app1,
-                                                              &expected_app2);
-
-  App* app0_created = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createInstalledApp(CComBSTR(kGuid1),
-                                                   &app0_created));
-
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->createAllInstalledApps());
-}
-
-// TODO(omaha): Enable if we end up needing such a function.
-#if 0
-TEST_F(AppBundlePopulatedRegistryMachineTest, createUninstalledApps) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(&expected_app0,
-                                                              &expected_app1,
-                                                              &expected_app2);
-
-  EXPECT_SUCCEEDED(app_bundle_->createUninstalledApps());
-  EXPECT_EQ(1, app_bundle_->GetNumberOfApps());
-
-  App* app0 = app_bundle_->GetApp(0);
-  EXPECT_STREQ(kGuid3, app0->app_guid_string());
-  ValidateExpectedValues(*expected_app2, *app0);
-}
-
-TEST_F(AppBundlePopulatedRegistryUserTest, createUninstalledApps) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(&expected_app0,
-                                                              &expected_app1,
-                                                              &expected_app2);
-
-  EXPECT_SUCCEEDED(app_bundle_->createUninstalledApps());
-  EXPECT_EQ(1, app_bundle_->GetNumberOfApps());
-
-  App* app0 = app_bundle_->GetApp(0);
-  EXPECT_STREQ(kGuid3, app0->app_guid_string());
-  ValidateExpectedValues(*expected_app2, *app0);
-}
-#endif
-
-//
-// State tests.
-//
-
-class AppBundleStateUserTest : public AppBundleTest {
- protected:
-  AppBundleStateUserTest()
-      : AppBundleTest(false),
-        hive_override_key_name_(kRegistryHiveOverrideRoot) {}
-
-  virtual void SetUp() {
-    AppBundleTest::SetUp();
-
-    RegKey::DeleteKey(hive_override_key_name_);
-    OverrideRegistryHives(hive_override_key_name_);
-  }
-
-  virtual void TearDown() {
-    RestoreRegistryHives();
-    RegKey::DeleteKey(hive_override_key_name_);
-
-    AppBundleTest::TearDown();
-  }
-
-  // Writing name avoids needing to create the ResourceManager.
-  void CreateClientsKeyForApp1() {
-    CString clients_key = AppendRegKeyPath(USER_REG_CLIENTS, kGuid1);
-    EXPECT_SUCCEEDED(RegKey::SetValue(clients_key,
-                                      kRegValueProductVersion,
-                                      _T("1.2.3.4")));
-    EXPECT_SUCCEEDED(RegKey::SetValue(clients_key,
-                                      kRegValueAppName,
-                                      _T("Test App")));
-  }
-
-  CString hive_override_key_name_;
-};
-
-
-class AppBundleStateInitUserTest : public AppBundleStateUserTest {
- protected:
-  AppBundleStateInitUserTest() : AppBundleStateUserTest() {}
-
-  virtual void SetUp() {
-    AppBundleStateUserTest::SetUp();
-
-    // Nothing to do since the budle starts in this state.
-  }
-};
-
-class AppBundleStateInitializedUserTest : public AppBundleStateUserTest {
- protected:
-  AppBundleStateInitializedUserTest() : AppBundleStateUserTest() {}
-
-  virtual void SetUp() {
-    AppBundleStateUserTest::SetUp();
-    EXPECT_SUCCEEDED(app_bundle_->put_displayName(CComBSTR(_T("My Bundle"))));
-    EXPECT_SUCCEEDED(app_bundle_->put_displayLanguage(CComBSTR(_T("en"))));
-    EXPECT_SUCCEEDED(app_bundle_->initialize());
-  }
-};
-
-class AppBundleStateBusyUserTest : public AppBundleStateUserTest {
- protected:
-  AppBundleStateBusyUserTest() : AppBundleStateUserTest() {}
-
-  virtual void SetUp() {
-    AppBundleStateUserTest::SetUp();
-
-    DummyUserWorkItem dummy_work_item;
-    app_bundle_->set_user_work_item(&dummy_work_item);
-
-    SetAppBundleStateForUnitTest(app_bundle_.get(),
-                                 new fsm::AppBundleStateBusy);
-  }
-};
-
-class AppBundleStateReadyUserTest : public AppBundleStateUserTest {
- protected:
-  AppBundleStateReadyUserTest() : AppBundleStateUserTest() {}
-
-  virtual void SetUp() {
-    AppBundleStateUserTest::SetUp();
-    EXPECT_SUCCEEDED(app_bundle_->put_displayName(CComBSTR(_T("My Bundle"))));
-    EXPECT_SUCCEEDED(app_bundle_->put_displayLanguage(CComBSTR(_T("en"))));
-    EXPECT_SUCCEEDED(app_bundle_->initialize());
-
-    // In all cases, the bundle should have at least one app.
-    // The downloadPackage test needs an installed app.
-    CreateClientsKeyForApp1();
-    App* app = NULL;
-    EXPECT_SUCCEEDED(app_bundle_->createInstalledApp(CComBSTR(kGuid1), &app));
-
-    SetAppBundleStateForUnitTest(app_bundle_.get(),
-                                 new fsm::AppBundleStateReady);
-  }
-};
-
-class AppBundleStatePausedUserTest : public AppBundleStateUserTest {
- protected:
-  AppBundleStatePausedUserTest() : AppBundleStateUserTest() {}
-
-  virtual void SetUp() {
-    AppBundleStateUserTest::SetUp();
-    SetAppBundleStateForUnitTest(app_bundle_.get(),
-                                 new fsm::AppBundleStatePaused);
-  }
-};
-
-class AppBundleStateStoppedUserTest : public AppBundleStateUserTest {
- protected:
-  AppBundleStateStoppedUserTest() : AppBundleStateUserTest() {}
-
-  virtual void SetUp() {
-    AppBundleStateUserTest::SetUp();
-    SetAppBundleStateForUnitTest(app_bundle_.get(),
-                                 new fsm::AppBundleStateStopped);
-  }
-};
-
-// Init.
-
-TEST_F(AppBundleStateInitUserTest, Properties) {
-  TestPropertyReflexiveness();
-  EXPECT_EQ(STATE_INIT, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitUserTest, CountAndItem) {
-  long num_apps = 0;  // NOLINT
-  EXPECT_SUCCEEDED(app_bundle_->get_Count(&num_apps));
-  EXPECT_EQ(0, num_apps);
-
-  App* app0_obtained = NULL;
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_INVALID_INDEX),
-            app_bundle_->get_Item(0, &app0_obtained));
-  EXPECT_FALSE(app0_obtained);
-
-  EXPECT_EQ(STATE_INIT, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitUserTest, put_altTokens) {
-  CAccessToken access_token;
-  access_token.GetProcessToken(TOKEN_DUPLICATE);
-  ULONG_PTR process_token =
-      reinterpret_cast<ULONG_PTR>(access_token.GetHandle());
-  EXPECT_SUCCEEDED(app_bundle_->put_altTokens(process_token,
-                                              process_token,
-                                              ::GetCurrentProcessId()));
-  EXPECT_EQ(STATE_INIT, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitUserTest, initialize) {
-  EXPECT_SUCCEEDED(app_bundle_->put_displayName(CComBSTR(_T("My Bundle"))));
-  EXPECT_SUCCEEDED(app_bundle_->put_displayLanguage(CComBSTR(_T("en"))));
-  EXPECT_SUCCEEDED(app_bundle_->initialize());
-  EXPECT_EQ(STATE_INITIALIZED, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitUserTest, createApp) {
-  App* app = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createApp(CComBSTR(kGuid1), &app));
-  EXPECT_EQ(STATE_INIT, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitUserTest, createInstalledApp) {
-  CreateClientsKeyForApp1();
-
-  App* app = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createInstalledApp(CComBSTR(kGuid1), &app));
-  EXPECT_EQ(STATE_INIT, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitUserTest, createAllInstalledApps) {
-  CreateClientsKeyForApp1();
-
-  App* app = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createAllInstalledApps());
-  EXPECT_EQ(STATE_INIT, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitUserTest, checkForUpdate) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->checkForUpdate());
-  EXPECT_EQ(STATE_INIT, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitUserTest, download) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->download());
-  EXPECT_EQ(STATE_INIT, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitUserTest, install) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->install());
-  EXPECT_EQ(STATE_INIT, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitUserTest, updateAllApps) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->updateAllApps());
-  EXPECT_EQ(STATE_INIT, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitUserTest, stop) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->stop());
-  EXPECT_EQ(STATE_INIT, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitUserTest, pause) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->pause());
-  EXPECT_EQ(STATE_INIT, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitUserTest, resume) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->resume());
-  EXPECT_EQ(STATE_INIT, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitUserTest, isBusy) {
-  VARIANT_BOOL is_busy = VARIANT_TRUE;
-  EXPECT_SUCCEEDED(app_bundle_->isBusy(&is_busy));
-  EXPECT_EQ(VARIANT_FALSE, is_busy);
-  EXPECT_EQ(STATE_INIT, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitUserTest, downloadPackage) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->downloadPackage(CComBSTR(kGuid1),
-                                         CComBSTR(_T("package"))));
-  EXPECT_EQ(STATE_INIT, GetBundleState());
-}
-
-// TODO(omaha): Check the state or remove this function.
-TEST_F(AppBundleStateInitUserTest, get_currentState) {
-  VARIANT current_state;
-  ExpectAsserts expect_asserts;  // Not yet implemented.
-  EXPECT_EQ(E_NOTIMPL, app_bundle_->get_currentState(&current_state));
-  EXPECT_EQ(STATE_INIT, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitUserTest, CompleteAsyncCall) {
-  {
-    ExpectAsserts expect_asserts;
-    app_bundle_->CompleteAsyncCall();
-  }
-
-  EXPECT_EQ(STATE_INIT, GetBundleState());
-}
-
-// Initialized.
-
-TEST_F(AppBundleStateInitializedUserTest, Properties) {
-  TestPropertyReflexiveness();
-  EXPECT_EQ(STATE_INITIALIZED, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitializedUserTest, CountAndItem) {
-  long num_apps = 0;  // NOLINT
-  EXPECT_SUCCEEDED(app_bundle_->get_Count(&num_apps));
-  EXPECT_EQ(0, num_apps);
-
-  App* app0_obtained = NULL;
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_INVALID_INDEX),
-            app_bundle_->get_Item(0, &app0_obtained));
-  EXPECT_FALSE(app0_obtained);
-
-  EXPECT_EQ(STATE_INITIALIZED, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitializedUserTest, put_altTokens) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->put_altTokens(1, 2, 3));
-  EXPECT_EQ(STATE_INITIALIZED, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitializedUserTest, initialize) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->initialize());
-  EXPECT_EQ(STATE_INITIALIZED, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitializedUserTest, createApp) {
-  App* app = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app));
-  EXPECT_EQ(STATE_INITIALIZED, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitializedUserTest, createInstalledApp) {
-  CreateClientsKeyForApp1();
-
-  App* app = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createInstalledApp(CComBSTR(kGuid1), &app));
-  EXPECT_EQ(STATE_INITIALIZED, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitializedUserTest, createAllInstalledApps) {
-  CreateClientsKeyForApp1();
-  EXPECT_HRESULT_SUCCEEDED(RegKey::CreateKey(
-      AppendRegKeyPath(USER_REG_CLIENT_STATE, kGuid1)));  // Avoid assert.
-
-  App* app = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createAllInstalledApps());
-  EXPECT_EQ(STATE_INITIALIZED, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitializedUserTest, checkForUpdate) {
-  App* app = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app));
-  DummyUserWorkItem dummy_work_item;
-  EXPECT_CALL(*worker_, CheckForUpdateAsync(_))
-      .WillOnce(SetWorkItem(&dummy_work_item));
-
-  EXPECT_SUCCEEDED(app_bundle_->checkForUpdate());
-  EXPECT_EQ(STATE_BUSY, GetBundleState());
-
-  EXPECT_FALSE(app_bundle_->is_auto_update());
-}
-
-TEST_F(AppBundleStateInitializedUserTest, download) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->download());
-  EXPECT_EQ(STATE_INITIALIZED, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitializedUserTest, install) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->install());
-  EXPECT_EQ(STATE_INITIALIZED, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitializedUserTest, updateAllApps) {
-  CreateClientsKeyForApp1();
-  EXPECT_HRESULT_SUCCEEDED(RegKey::CreateKey(
-      AppendRegKeyPath(USER_REG_CLIENT_STATE, kGuid1)));  // Avoid assert.
-
-  DummyUserWorkItem dummy_work_item;
-  EXPECT_CALL(*worker_, UpdateAllAppsAsync(_))
-      .WillOnce(SetWorkItem(&dummy_work_item));
-
-  EXPECT_SUCCEEDED(app_bundle_->updateAllApps());
-  EXPECT_EQ(STATE_BUSY, GetBundleState());
-
-  EXPECT_TRUE(app_bundle_->is_auto_update());
-}
-
-TEST_F(AppBundleStateInitializedUserTest, stop) {
-  EXPECT_SUCCEEDED(app_bundle_->stop());
-  EXPECT_EQ(STATE_STOPPED, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitializedUserTest, pause) {
-  EXPECT_SUCCEEDED(app_bundle_->pause());
-  EXPECT_EQ(STATE_PAUSED, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitializedUserTest, resume) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->resume());
-  EXPECT_EQ(STATE_INITIALIZED, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitializedUserTest, isBusy) {
-  VARIANT_BOOL is_busy = VARIANT_TRUE;
-  EXPECT_SUCCEEDED(app_bundle_->isBusy(&is_busy));
-  EXPECT_EQ(VARIANT_FALSE, is_busy);
-  EXPECT_EQ(STATE_INITIALIZED, GetBundleState());
-}
-
-// downloadPackage() returns E_INVALIDARG because the app has no packages.
-// TODO(omaha): Add the package so downloadPackage can succeed.
-TEST_F(AppBundleStateInitializedUserTest, downloadPackage) {
-  CreateClientsKeyForApp1();
-  App* app = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createInstalledApp(CComBSTR(kGuid1), &app));
-
-  EXPECT_EQ(
-      E_INVALIDARG,
-      app_bundle_->downloadPackage(CComBSTR(kGuid1), CComBSTR(_T("package"))));
-  EXPECT_EQ(STATE_INITIALIZED, GetBundleState());
-
-  EXPECT_FALSE(app_bundle_->is_auto_update());
-}
-
-TEST_F(AppBundleStateInitializedUserTest, get_currentState) {
-  VARIANT current_state;
-  ExpectAsserts expect_asserts;  // Not yet implemented.
-  EXPECT_EQ(E_NOTIMPL, app_bundle_->get_currentState(&current_state));
-  EXPECT_EQ(STATE_INITIALIZED, GetBundleState());
-}
-
-TEST_F(AppBundleStateInitializedUserTest, CompleteAsyncCall) {
-  {
-    ExpectAsserts expect_asserts;
-    app_bundle_->CompleteAsyncCall();
-  }
-
-  EXPECT_EQ(STATE_INITIALIZED, GetBundleState());
-}
-
-// Busy.
-
-TEST_F(AppBundleStateBusyUserTest, Properties) {
-  TestPropertyReflexiveness();
-  EXPECT_EQ(STATE_BUSY, GetBundleState());
-}
-
-TEST_F(AppBundleStateBusyUserTest, CountAndItem) {
-  long num_apps = 0;  // NOLINT
-  EXPECT_SUCCEEDED(app_bundle_->get_Count(&num_apps));
-  EXPECT_EQ(0, num_apps);
-
-  App* app0_obtained = NULL;
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_INVALID_INDEX),
-            app_bundle_->get_Item(0, &app0_obtained));
-  EXPECT_FALSE(app0_obtained);
-
-  EXPECT_EQ(STATE_BUSY, GetBundleState());
-}
-
-TEST_F(AppBundleStateBusyUserTest, put_altTokens) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->put_altTokens(1, 2, 3));
-  EXPECT_EQ(STATE_BUSY, GetBundleState());
-}
-
-TEST_F(AppBundleStateBusyUserTest, initialize) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->initialize());
-  EXPECT_EQ(STATE_BUSY, GetBundleState());
-}
-
-TEST_F(AppBundleStateBusyUserTest, createApp) {
-  App* app = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createApp(CComBSTR(kGuid1), &app));
-  EXPECT_EQ(STATE_BUSY, GetBundleState());
-}
-
-TEST_F(AppBundleStateBusyUserTest, createInstalledApp) {
-  CreateClientsKeyForApp1();
-
-  App* app = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createInstalledApp(CComBSTR(kGuid1), &app));
-  EXPECT_EQ(STATE_BUSY, GetBundleState());
-}
-
-TEST_F(AppBundleStateBusyUserTest, createAllInstalledApps) {
-  CreateClientsKeyForApp1();
-
-  App* app = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createAllInstalledApps());
-  EXPECT_EQ(STATE_BUSY, GetBundleState());
-}
-
-TEST_F(AppBundleStateBusyUserTest, checkForUpdate) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->checkForUpdate());
-  EXPECT_EQ(STATE_BUSY, GetBundleState());
-}
-
-TEST_F(AppBundleStateBusyUserTest, download) {
-  EXPECT_EQ(GOOPDATE_E_NON_BLOCKING_CALL_PENDING, app_bundle_->download());
-  EXPECT_EQ(STATE_BUSY, GetBundleState());
-}
-
-TEST_F(AppBundleStateBusyUserTest, install) {
-  EXPECT_EQ(GOOPDATE_E_NON_BLOCKING_CALL_PENDING, app_bundle_->install());
-  EXPECT_EQ(STATE_BUSY, GetBundleState());
-}
-
-TEST_F(AppBundleStateBusyUserTest, updateAllApps) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->updateAllApps());
-  EXPECT_EQ(STATE_BUSY, GetBundleState());
-}
-
-TEST_F(AppBundleStateBusyUserTest, stop_Succeeds) {
-  EXPECT_CALL(*worker_, Stop(app_bundle_.get()))
-      .WillOnce(Return(S_OK));
-
-  EXPECT_SUCCEEDED(app_bundle_->stop());
-  EXPECT_EQ(STATE_STOPPED, GetBundleState());
-}
-
-TEST_F(AppBundleStateBusyUserTest, stop_Fails) {
-  EXPECT_CALL(*worker_, Stop(app_bundle_.get()))
-      .WillOnce(Return(kKnownError));
-
-  EXPECT_EQ(kKnownError, app_bundle_->stop());
-  EXPECT_EQ(STATE_BUSY, GetBundleState());
-}
-
-TEST_F(AppBundleStateBusyUserTest, pause_Succeeds) {
-  EXPECT_CALL(*worker_, Pause(app_bundle_.get()))
-      .WillOnce(Return(S_OK));
-
-  EXPECT_EQ(S_OK, app_bundle_->pause());
-  EXPECT_EQ(STATE_PAUSED, GetBundleState());
-}
-
-TEST_F(AppBundleStateBusyUserTest, pause_Fails) {
-  EXPECT_CALL(*worker_, Pause(_))
-      .WillOnce(Return(kKnownError));
-
-  EXPECT_EQ(kKnownError, app_bundle_->pause());
-  EXPECT_EQ(STATE_BUSY, GetBundleState());
-}
-
-TEST_F(AppBundleStateBusyUserTest, resume) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->resume());
-  EXPECT_EQ(STATE_BUSY, GetBundleState());
-}
-
-TEST_F(AppBundleStateBusyUserTest, isBusy) {
-  VARIANT_BOOL is_busy = VARIANT_TRUE;
-  EXPECT_SUCCEEDED(app_bundle_->isBusy(&is_busy));
-  EXPECT_EQ(VARIANT_TRUE, is_busy);
-  EXPECT_EQ(STATE_BUSY, GetBundleState());
-}
-
-TEST_F(AppBundleStateBusyUserTest, downloadPackage) {
-  EXPECT_EQ(GOOPDATE_E_NON_BLOCKING_CALL_PENDING,
-            app_bundle_->downloadPackage(CComBSTR(kGuid1),
-                                         CComBSTR(_T("package"))));
-  EXPECT_EQ(STATE_BUSY, GetBundleState());
-}
-
-TEST_F(AppBundleStateBusyUserTest, get_currentState) {
-  VARIANT current_state;
-  ExpectAsserts expect_asserts;  // Not yet implemented.
-  EXPECT_EQ(E_NOTIMPL, app_bundle_->get_currentState(&current_state));
-  EXPECT_EQ(STATE_BUSY, GetBundleState());
-}
-
-TEST_F(AppBundleStateBusyUserTest, CompleteAsyncCall) {
-  app_bundle_->CompleteAsyncCall();
-
-  EXPECT_EQ(STATE_READY, GetBundleState());
-}
-
-// Ready.
-
-TEST_F(AppBundleStateReadyUserTest, Properties) {
-  TestPropertyReflexiveness();
-  EXPECT_EQ(STATE_READY, GetBundleState());
-}
-
-TEST_F(AppBundleStateReadyUserTest, CountAndItem) {
-  long num_apps = 0;  // NOLINT
-  EXPECT_SUCCEEDED(app_bundle_->get_Count(&num_apps));
-  EXPECT_EQ(1, num_apps);
-
-  App* app0_obtained = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->get_Item(0, &app0_obtained));
-  EXPECT_TRUE(app0_obtained);
-
-  EXPECT_EQ(STATE_READY, GetBundleState());
-}
-
-TEST_F(AppBundleStateReadyUserTest, put_altTokens) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->put_altTokens(1, 2, 3));
-  EXPECT_EQ(STATE_READY, GetBundleState());
-}
-
-TEST_F(AppBundleStateReadyUserTest, initialize) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->initialize());
-  EXPECT_EQ(STATE_READY, GetBundleState());
-}
-
-TEST_F(AppBundleStateReadyUserTest, createApp) {
-  App* app = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createApp(CComBSTR(kGuid1), &app));
-  EXPECT_EQ(STATE_READY, GetBundleState());
-}
-
-TEST_F(AppBundleStateReadyUserTest, createInstalledApp) {
-  CreateClientsKeyForApp1();
-
-  App* app = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createInstalledApp(CComBSTR(kGuid1), &app));
-  EXPECT_EQ(STATE_READY, GetBundleState());
-}
-
-TEST_F(AppBundleStateReadyUserTest, createAllInstalledApps) {
-  CreateClientsKeyForApp1();
-
-  App* app = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createAllInstalledApps());
-  EXPECT_EQ(STATE_READY, GetBundleState());
-}
-
-TEST_F(AppBundleStateReadyUserTest, checkForUpdate) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->checkForUpdate());
-  EXPECT_EQ(STATE_READY, GetBundleState());
-}
-
-TEST_F(AppBundleStateReadyUserTest, download) {
-  DummyUserWorkItem dummy_work_item;
-  EXPECT_CALL(*worker_, DownloadAsync(_))
-      .WillOnce(SetWorkItem(&dummy_work_item));
-
-  EXPECT_SUCCEEDED(app_bundle_->download());
-  EXPECT_EQ(STATE_BUSY, GetBundleState());
-
-  EXPECT_FALSE(app_bundle_->is_auto_update());
-}
-
-TEST_F(AppBundleStateReadyUserTest, install) {
-  DummyUserWorkItem dummy_work_item;
-  EXPECT_CALL(*worker_, DownloadAndInstallAsync(_))
-      .WillOnce(SetWorkItem(&dummy_work_item));
-
-  EXPECT_SUCCEEDED(app_bundle_->install());
-  EXPECT_EQ(STATE_BUSY, GetBundleState());
-
-  EXPECT_FALSE(app_bundle_->is_auto_update());
-}
-
-TEST_F(AppBundleStateReadyUserTest, updateAllApps) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->updateAllApps());
-  EXPECT_EQ(STATE_READY, GetBundleState());
-}
-
-TEST_F(AppBundleStateReadyUserTest, stop) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->stop());
-  EXPECT_EQ(STATE_READY, GetBundleState());
-}
-
-TEST_F(AppBundleStateReadyUserTest, pause) {
-  EXPECT_SUCCEEDED(app_bundle_->pause());
-  EXPECT_EQ(STATE_READY, GetBundleState());
-}
-
-TEST_F(AppBundleStateReadyUserTest, resume) {
-  EXPECT_SUCCEEDED(app_bundle_->resume());
-  EXPECT_EQ(STATE_READY, GetBundleState());
-}
-
-TEST_F(AppBundleStateReadyUserTest, isBusy) {
-  VARIANT_BOOL is_busy = VARIANT_TRUE;
-  EXPECT_SUCCEEDED(app_bundle_->isBusy(&is_busy));
-  EXPECT_EQ(VARIANT_FALSE, is_busy);
-  EXPECT_EQ(STATE_READY, GetBundleState());
-}
-
-// downloadPackage() returns E_INVALIDARG because the app has no packages.
-// TODO(omaha): Add the package so downloadPackage can succeed.
-TEST_F(AppBundleStateReadyUserTest, downloadPackage) {
-  EXPECT_EQ(
-      E_INVALIDARG,
-      app_bundle_->downloadPackage(CComBSTR(kGuid1), CComBSTR(_T("package"))));
-  EXPECT_EQ(STATE_READY, GetBundleState());
-}
-
-TEST_F(AppBundleStateReadyUserTest, get_currentState) {
-  VARIANT current_state;
-  ExpectAsserts expect_asserts;  // Not yet implemented.
-  EXPECT_EQ(E_NOTIMPL, app_bundle_->get_currentState(&current_state));
-  EXPECT_EQ(STATE_READY, GetBundleState());
-}
-
-TEST_F(AppBundleStateReadyUserTest, CompleteAsyncCall) {
-  {
-    ExpectAsserts expect_asserts;
-    app_bundle_->CompleteAsyncCall();
-  }
-
-  EXPECT_EQ(STATE_READY, GetBundleState());
-}
-
-// Paused.
-
-TEST_F(AppBundleStatePausedUserTest, Properties) {
-  TestPropertyReflexiveness();
-  EXPECT_EQ(STATE_PAUSED, GetBundleState());
-}
-
-TEST_F(AppBundleStatePausedUserTest, CountAndItem) {
-  long num_apps = 0;  // NOLINT
-  EXPECT_SUCCEEDED(app_bundle_->get_Count(&num_apps));
-  EXPECT_EQ(0, num_apps);
-
-  App* app0_obtained = NULL;
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_INVALID_INDEX),
-            app_bundle_->get_Item(0, &app0_obtained));
-  EXPECT_FALSE(app0_obtained);
-
-  EXPECT_EQ(STATE_PAUSED, GetBundleState());
-}
-
-TEST_F(AppBundleStatePausedUserTest, put_altTokens) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->put_altTokens(1, 2, 3));
-  EXPECT_EQ(STATE_PAUSED, GetBundleState());
-}
-
-TEST_F(AppBundleStatePausedUserTest, initialize) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->initialize());
-  EXPECT_EQ(STATE_PAUSED, GetBundleState());
-}
-
-TEST_F(AppBundleStatePausedUserTest, createApp) {
-  App* app = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createApp(CComBSTR(kGuid1), &app));
-  EXPECT_EQ(STATE_PAUSED, GetBundleState());
-}
-
-TEST_F(AppBundleStatePausedUserTest, createInstalledApp) {
-  CreateClientsKeyForApp1();
-
-  App* app = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createInstalledApp(CComBSTR(kGuid1), &app));
-  EXPECT_EQ(STATE_PAUSED, GetBundleState());
-}
-
-TEST_F(AppBundleStatePausedUserTest, createAllInstalledApps) {
-  CreateClientsKeyForApp1();
-
-  App* app = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createAllInstalledApps());
-  EXPECT_EQ(STATE_PAUSED, GetBundleState());
-}
-
-TEST_F(AppBundleStatePausedUserTest, checkForUpdate) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->checkForUpdate());
-  EXPECT_EQ(STATE_PAUSED, GetBundleState());
-}
-
-TEST_F(AppBundleStatePausedUserTest, download) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->download());
-  EXPECT_EQ(STATE_PAUSED, GetBundleState());
-}
-
-TEST_F(AppBundleStatePausedUserTest, install) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->install());
-  EXPECT_EQ(STATE_PAUSED, GetBundleState());
-}
-
-TEST_F(AppBundleStatePausedUserTest, updateAllApps) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->updateAllApps());
-  EXPECT_EQ(STATE_PAUSED, GetBundleState());
-}
-
-// This may change when implemented.
-TEST_F(AppBundleStatePausedUserTest, stop) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->stop());
-  EXPECT_EQ(STATE_PAUSED, GetBundleState());
-}
-
-TEST_F(AppBundleStatePausedUserTest, pause) {
-  EXPECT_SUCCEEDED(app_bundle_->pause());
-  EXPECT_EQ(STATE_PAUSED, GetBundleState());
-}
-
-TEST_F(AppBundleStatePausedUserTest, resume_Succeeds_AsyncCallNotCompleted) {
-  EXPECT_CALL(*worker_, Resume(app_bundle_.get()))
-      .WillOnce(Return(S_OK));
-
-  EXPECT_SUCCEEDED(app_bundle_->resume());
-  EXPECT_EQ(STATE_BUSY, GetBundleState());
-}
-
-TEST_F(AppBundleStatePausedUserTest, resume_Succeeds_AsyncCallCompleted) {
-  DummyUserWorkItem dummy_work_item;
-  app_bundle_->set_user_work_item(&dummy_work_item);
-  app_bundle_->CompleteAsyncCall();
-
-  EXPECT_CALL(*worker_, Resume(app_bundle_.get()))
-      .WillOnce(Return(S_OK));
-
-  EXPECT_SUCCEEDED(app_bundle_->resume());
-  EXPECT_EQ(STATE_READY, GetBundleState());
-}
-
-TEST_F(AppBundleStatePausedUserTest, resume_Fails_AsyncCallNotCompleted) {
-  EXPECT_CALL(*worker_, Resume(app_bundle_.get()))
-      .WillOnce(Return(kKnownError));
-
-  EXPECT_EQ(kKnownError, app_bundle_->resume());
-  EXPECT_EQ(STATE_PAUSED, GetBundleState());
-}
-
-TEST_F(AppBundleStatePausedUserTest, resume_Fails_AsyncCallCompleted) {
-  DummyUserWorkItem dummy_work_item;
-  app_bundle_->set_user_work_item(&dummy_work_item);
-  app_bundle_->CompleteAsyncCall();
-
-  EXPECT_CALL(*worker_, Resume(app_bundle_.get()))
-      .WillOnce(Return(kKnownError));
-
-  EXPECT_EQ(kKnownError, app_bundle_->resume());
-  EXPECT_EQ(STATE_PAUSED, GetBundleState());
-}
-
-TEST_F(AppBundleStatePausedUserTest, isBusy) {
-  VARIANT_BOOL is_busy = VARIANT_TRUE;
-  EXPECT_SUCCEEDED(app_bundle_->isBusy(&is_busy));
-  EXPECT_EQ(VARIANT_FALSE, is_busy);
-  EXPECT_EQ(STATE_PAUSED, GetBundleState());
-}
-
-TEST_F(AppBundleStatePausedUserTest, downloadPackage) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->downloadPackage(CComBSTR(kGuid1),
-                                         CComBSTR(_T("package"))));
-  EXPECT_EQ(STATE_PAUSED, GetBundleState());
-}
-
-TEST_F(AppBundleStatePausedUserTest, get_currentState) {
-  VARIANT current_state;
-  ExpectAsserts expect_asserts;  // Not yet implemented.
-  EXPECT_EQ(E_NOTIMPL, app_bundle_->get_currentState(&current_state));
-  EXPECT_EQ(STATE_PAUSED, GetBundleState());
-}
-
-// Remains Paused until resumed.
-TEST_F(AppBundleStatePausedUserTest, CompleteAsyncCall) {
-  DummyUserWorkItem dummy_work_item;
-  app_bundle_->set_user_work_item(&dummy_work_item);
-  SetAppBundleStateForUnitTest(app_bundle_.get(),
-                               new fsm::AppBundleStatePaused);
-
-  app_bundle_->CompleteAsyncCall();
-
-  EXPECT_EQ(STATE_PAUSED, GetBundleState());
-}
-
-// Stopped.
-
-TEST_F(AppBundleStateStoppedUserTest, Properties) {
-  TestPropertyReflexiveness();
-  EXPECT_EQ(STATE_STOPPED, GetBundleState());
-}
-
-TEST_F(AppBundleStateStoppedUserTest, CountAndItem) {
-  long num_apps = 0;  // NOLINT
-  EXPECT_SUCCEEDED(app_bundle_->get_Count(&num_apps));
-  EXPECT_EQ(0, num_apps);
-
-  App* app0_obtained = NULL;
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_INVALID_INDEX),
-            app_bundle_->get_Item(0, &app0_obtained));
-  EXPECT_FALSE(app0_obtained);
-
-  EXPECT_EQ(STATE_STOPPED, GetBundleState());
-}
-
-TEST_F(AppBundleStateStoppedUserTest, put_altTokens) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->put_altTokens(1, 2, 3));
-  EXPECT_EQ(STATE_STOPPED, GetBundleState());
-}
-
-TEST_F(AppBundleStateStoppedUserTest, initialize) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->initialize());
-  EXPECT_EQ(STATE_STOPPED, GetBundleState());
-}
-
-TEST_F(AppBundleStateStoppedUserTest, createApp) {
-  App* app = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createApp(CComBSTR(kGuid1), &app));
-
-  EXPECT_EQ(S_OK, app_bundle_->stop());
-  EXPECT_EQ(STATE_STOPPED, GetBundleState());
-}
-
-TEST_F(AppBundleStateStoppedUserTest, createInstalledApp) {
-  CreateClientsKeyForApp1();
-
-  App* app = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createInstalledApp(CComBSTR(kGuid1), &app));
-  EXPECT_EQ(STATE_STOPPED, GetBundleState());
-}
-
-TEST_F(AppBundleStateStoppedUserTest, createAllInstalledApps) {
-  CreateClientsKeyForApp1();
-
-  App* app = NULL;
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->createAllInstalledApps());
-  EXPECT_EQ(STATE_STOPPED, GetBundleState());
-}
-
-TEST_F(AppBundleStateStoppedUserTest, checkForUpdate) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->checkForUpdate());
-  EXPECT_EQ(STATE_STOPPED, GetBundleState());
-}
-
-TEST_F(AppBundleStateStoppedUserTest, download) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->download());
-  EXPECT_EQ(STATE_STOPPED, GetBundleState());
-}
-
-TEST_F(AppBundleStateStoppedUserTest, install) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->install());
-  EXPECT_EQ(STATE_STOPPED, GetBundleState());
-}
-
-TEST_F(AppBundleStateStoppedUserTest, updateAllApps) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->updateAllApps());
-  EXPECT_EQ(STATE_STOPPED, GetBundleState());
-}
-
-TEST_F(AppBundleStateStoppedUserTest, stop) {
-  EXPECT_EQ(S_OK, app_bundle_->stop());
-  EXPECT_EQ(STATE_STOPPED, GetBundleState());
-}
-
-TEST_F(AppBundleStateStoppedUserTest, pause) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->pause());
-  EXPECT_EQ(STATE_STOPPED, GetBundleState());
-}
-
-TEST_F(AppBundleStateStoppedUserTest, resume) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED, app_bundle_->resume());
-  EXPECT_EQ(STATE_STOPPED, GetBundleState());
-}
-
-TEST_F(AppBundleStateStoppedUserTest, isBusy) {
-  VARIANT_BOOL is_busy = VARIANT_TRUE;
-  EXPECT_SUCCEEDED(app_bundle_->isBusy(&is_busy));
-  EXPECT_EQ(VARIANT_FALSE, is_busy);
-  EXPECT_EQ(STATE_STOPPED, GetBundleState());
-}
-
-TEST_F(AppBundleStateStoppedUserTest, downloadPackage) {
-  EXPECT_EQ(GOOPDATE_E_CALL_UNEXPECTED,
-            app_bundle_->downloadPackage(CComBSTR(kGuid1),
-                                         CComBSTR(_T("package"))));
-  EXPECT_EQ(STATE_STOPPED, GetBundleState());
-}
-
-TEST_F(AppBundleStateStoppedUserTest, get_currentState) {
-  VARIANT current_state;
-  ExpectAsserts expect_asserts;  // Not yet implemented.
-  EXPECT_EQ(E_NOTIMPL, app_bundle_->get_currentState(&current_state));
-  EXPECT_EQ(STATE_STOPPED, GetBundleState());
-}
-
-TEST_F(AppBundleStateStoppedUserTest, CompleteAsyncCall) {
-  DummyUserWorkItem dummy_work_item;
-  app_bundle_->set_user_work_item(&dummy_work_item);
-
-  app_bundle_->CompleteAsyncCall();
-
-  EXPECT_EQ(STATE_STOPPED, GetBundleState());
-}
-
-}  // namespace omaha
diff --git a/goopdate/app_command.cc b/goopdate/app_command.cc
deleted file mode 100644
index 9757e1e..0000000
--- a/goopdate/app_command.cc
+++ /dev/null
@@ -1,454 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_command.h"
-
-#include "base/scoped_ptr.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/exception_barrier.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/system.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/ping.h"
-#include "omaha/common/ping_event.h"
-
-namespace omaha {
-
-namespace {
-
-// Sends a single ping event to the Omaha server, synchronously.
-void SendPing(const CString& app_guid,
-              bool is_machine,
-              const CString& session_id,
-              PingEvent::Types type,
-              PingEvent::Results result,
-              int error_code,
-              int extra_code) {
-  PingEventPtr ping_event(new PingEvent(type, result, error_code, extra_code));
-
-  Ping ping(is_machine, session_id, kCmdLineInstallSource_OneClick);
-  std::vector<CString> apps;
-  apps.push_back(app_guid);
-  ping.LoadAppDataFromRegistry(apps);
-  ping.BuildAppsPing(ping_event);
-  ping.Send(true);  // true == is_fire_and_forget
-}
-
-// Waits on a process to exit, sends a ping based on the outcome.
-// This is a COM object so that, during its lifetime, the process will not exit.
-// The instance is AddRef'd in the instantiating thread and Release'd by the
-// thread procedure when all work is completed.
-class ATL_NO_VTABLE CompletePingSender
-    : public CComObjectRootEx<CComMultiThreadModel>,
-      public IUnknown {
- public:
-  // Starts a wait on a process, belonging to the specified app and having the
-  // given reporting ID. Will send a ping when the process exits.
-  static void Start(const CString& app_guid,
-                    bool is_machine,
-                    const CString& session_id,
-                    int reporting_id,
-                    HANDLE process);
-
-  BEGIN_COM_MAP(CompletePingSender)
-  END_COM_MAP()
-
- protected:
-  CompletePingSender();
-  virtual ~CompletePingSender();
-
- private:
-  static HRESULT Create(const CString& app_guid,
-                        bool is_machine,
-                        const CString& session_id,
-                        int reporting_id,
-                        HANDLE process,
-                        CompletePingSender** sender);
-
-  // Sends an EVENT_APP_COMMAND_COMPLETE ping with data from member
-  // variables and parameters.
-  void SendCompletePing(PingEvent::Results result, int error_code);
-
-  // Waits for the process to exit, returning S_OK and the exit_code or the
-  // underlying error code if the wait fails.
-  HRESULT WaitForProcessExit(DWORD* exit_code);
-
-  // Waits until the process exits or timeout occurs, then sends a ping with
-  // the result. parameter is the CompletePingSender instance.
-  static DWORD WINAPI WaitFunction(void* parameter);
-
-  CString app_guid_;
-  bool is_machine_;
-  CString session_id_;
-  int reporting_id_;
-  scoped_process process_;
-
-  DISALLOW_COPY_AND_ASSIGN(CompletePingSender);
-};  // class CompletePingSender
-
-CompletePingSender::CompletePingSender() {
-}
-
-HRESULT CompletePingSender::Create(const CString& app_guid,
-                                   bool is_machine,
-                                   const CString& session_id,
-                                   int reporting_id,
-                                   HANDLE process,
-                                   CompletePingSender** sender) {
-  ASSERT1(process && sender);
-
-  scoped_process process_handle(process);
-  process = NULL;
-
-  typedef CComObject<CompletePingSender> ComObjectCompletePingSender;
-
-  scoped_ptr<ComObjectCompletePingSender> new_object;
-  HRESULT hr = ComObjectCompletePingSender::CreateInstance(address(new_object));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  new_object->app_guid_ = app_guid;
-  new_object->is_machine_ = is_machine;
-  new_object->session_id_ = session_id;
-  new_object->reporting_id_ = reporting_id;
-  reset(new_object->process_, release(process_handle));
-
-  new_object->AddRef();
-  *sender = new_object.release();
-  return S_OK;
-}
-
-CompletePingSender::~CompletePingSender() {
-}
-
-void CompletePingSender::Start(const CString& app_guid,
-                               bool is_machine,
-                               const CString& session_id,
-                               int reporting_id,
-                               HANDLE process) {
-  ASSERT1(process);
-
-  scoped_process process_handle(process);
-  process = NULL;
-
-  CComPtr<CompletePingSender> sender;
-  HRESULT hr = CompletePingSender::Create(app_guid,
-                                          is_machine,
-                                          session_id,
-                                          reporting_id,
-                                          release(process_handle),
-                                          &sender);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[failed to create CompletePingSender]"),
-                  _T("[0x%08x]"), hr));
-    return;
-  }
-
-  void* context =
-      reinterpret_cast<void *>(static_cast<CompletePingSender*>(sender));
-
-  scoped_handle thread(::CreateThread(NULL, 0, WaitFunction, context, 0, NULL));
-
-  if (thread) {
-    // In case of success, the thread is responsible for calling Release.
-    sender.Detach();
-  } else {
-    hr = HRESULTFromLastError();
-    CORE_LOG(LE, (_T("[failed to start wait thread for app command ")
-                  _T("process exit]") _T("[0x%08x]"), hr));
-    sender->SendCompletePing(PingEvent::EVENT_RESULT_ERROR, hr);
-  }
-}
-
-void CompletePingSender::SendCompletePing(PingEvent::Results result,
-                                          int error_code) {
-  SendPing(app_guid_,
-           is_machine_,
-           session_id_,
-           PingEvent::EVENT_APP_COMMAND_COMPLETE,
-           result,
-           error_code,
-           reporting_id_);
-}
-
-HRESULT CompletePingSender::WaitForProcessExit(DWORD* exit_code) {
-  ASSERT1(exit_code);
-  if (!exit_code) {
-    return E_INVALIDARG;
-  }
-
-  DWORD wait_result = ::WaitForSingleObject(get(process_), INFINITE);
-
-  if (wait_result == WAIT_TIMEOUT) {
-    return GOOPDATEINSTALL_E_INSTALLER_TIMED_OUT;
-  } else if (wait_result == WAIT_FAILED) {
-    return HRESULTFromLastError();
-  }
-
-  ASSERT1(wait_result == WAIT_OBJECT_0);
-
-  if (wait_result != WAIT_OBJECT_0) {
-    return E_UNEXPECTED;
-  }
-
-  if (!::GetExitCodeProcess(get(process_), exit_code)) {
-    return HRESULTFromLastError();
-  }
-
-  return S_OK;
-}
-
-DWORD WINAPI CompletePingSender::WaitFunction(void* parameter) {
-  scoped_co_init init_com_apt(COINIT_MULTITHREADED);
-  HRESULT hr = init_com_apt.hresult();
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[init_com_apt failed][0x%x]"), hr));
-    return 0;
-  }
-
-  CComPtr<CompletePingSender> instance(
-      reinterpret_cast<CompletePingSender*>(parameter));
-  DWORD exit_code = 0;
-  hr = instance->WaitForProcessExit(&exit_code);
-
-  PingEvent::Results result = PingEvent::EVENT_RESULT_SUCCESS;
-  int error_code = 0;
-
-  if (FAILED(hr)) {
-    result = PingEvent::EVENT_RESULT_ERROR;
-    error_code = hr;
-  } else {
-    switch (exit_code) {
-      case ERROR_SUCCESS_REBOOT_REQUIRED:
-        result = PingEvent::EVENT_RESULT_SUCCESS_REBOOT;
-        break;
-      case ERROR_SUCCESS:
-        result = PingEvent::EVENT_RESULT_SUCCESS;
-        break;
-      default:
-        result = PingEvent::EVENT_RESULT_INSTALLER_ERROR_OTHER;
-        error_code = exit_code;
-        break;
-    }
-  }
-
-  instance->SendCompletePing(result, error_code);
-
-  return 0;
-}
-
-// Attempts to read the command line from the given registry key and value.
-// Logs a message in case of failure.
-HRESULT ReadCommandLine(const CString& key_name,
-                        const CString& value_name,
-                        CString* command_line) {
-  HRESULT hr = RegKey::GetValue(key_name, value_name, command_line);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[failed to read command line]")
-                  _T("[key %s][value %s][0x%08x]"), key_name, value_name, hr));
-  }
-
-  return hr;
-}
-
-// Checks if the specified value exists in the registry under the specified key.
-// If so, attempts to read the value's DWORD contents into 'paramter'. Succeeds
-// iff the value is absent or a DWORD value is successfully read.
-HRESULT ReadCommandParameter(const CString& key_name,
-                             const CString& value_name,
-                             DWORD* parameter) {
-  if (!RegKey::HasValue(key_name, value_name)) {
-    return S_OK;
-  }
-
-  HRESULT hr = RegKey::GetValue(key_name, value_name, parameter);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[failed to read command parameter]")
-                  _T("[key %s][value %s][0x%08x]"), key_name, value_name, hr));
-  }
-
-  return hr;
-}
-
-}  // namespace
-
-AppCommand::AppCommand(const CString& app_guid,
-                       bool is_machine,
-                       const CString& cmd_id,
-                       const CString& cmd_line,
-                       bool sends_pings,
-                       const CString& session_id,
-                       bool is_web_accessible,
-                       DWORD reporting_id)
-  : app_guid_(app_guid),
-    is_machine_(is_machine),
-    cmd_id_(cmd_id),
-    session_id_(session_id),
-    cmd_line_(cmd_line),
-    sends_pings_(sends_pings),
-    reporting_id_(reporting_id),
-    is_web_accessible_(is_web_accessible) {
-}
-
-HRESULT AppCommand::Load(const CString& app_guid,
-                         bool is_machine,
-                         const CString& cmd_id,
-                         const CString& session_id,
-                         AppCommand** app_command) {
-  ASSERT1(app_command);
-
-  CString cmd_line;
-  DWORD sends_pings = 0;
-  DWORD is_web_accessible = 0;
-  DWORD reporting_id = 0;
-
-  ConfigManager* config_manager = ConfigManager::Instance();
-  CString clients_key_name = config_manager->registry_clients(is_machine);
-
-  CString app_key_name(AppendRegKeyPath(clients_key_name, app_guid));
-  CString command_key_name(
-      AppendRegKeyPath(app_key_name, kCommandsRegKeyName, cmd_id));
-
-  // Prefer the new layout, otherwise look for the legacy layout. See comments
-  // in app_command.h for description of each.
-  if (!RegKey::HasKey(command_key_name)) {
-    if (!RegKey::HasValue(app_key_name, cmd_id)) {
-      return GOOPDATE_E_CORE_MISSING_CMD;
-    }
-
-    // Legacy command layout.
-    HRESULT hr = ReadCommandLine(app_key_name, cmd_id, &cmd_line);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  } else {
-    // New command layout.
-    HRESULT hr = ReadCommandLine(command_key_name, kRegValueCommandLine,
-                                 &cmd_line);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = ReadCommandParameter(command_key_name, kRegValueSendsPings,
-                              &sends_pings);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = ReadCommandParameter(command_key_name, kRegValueWebAccessible,
-                              &is_web_accessible);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = ReadCommandParameter(command_key_name, kRegValueReportingId,
-                              &reporting_id);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  *app_command = new AppCommand(app_guid,
-                                is_machine,
-                                cmd_id,
-                                cmd_line,
-                                sends_pings != 0,
-                                session_id,
-                                is_web_accessible != 0,
-                                reporting_id);
-  return S_OK;
-}
-
-HRESULT AppCommand::Execute(HANDLE* process) const {
-  ASSERT1(process);
-  if (!process) {
-    return E_INVALIDARG;
-  }
-
-  *process = NULL;
-
-  CString cmd_line(cmd_line_);
-
-  PROCESS_INFORMATION pi = {0};
-  HRESULT hr = System::StartProcess(NULL, cmd_line.GetBuffer(), &pi);
-
-  if (sends_pings_) {
-    PingEvent::Results result = SUCCEEDED(hr) ?
-        PingEvent::EVENT_RESULT_SUCCESS : PingEvent::EVENT_RESULT_ERROR;
-
-    SendPing(app_guid_,
-             is_machine_,
-             session_id_,
-             PingEvent::EVENT_APP_COMMAND_BEGIN,
-             result,
-             hr,
-             reporting_id_);
-  }
-
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[failed to launch cmd][%s][0x%08x]"), cmd_line_, hr));
-    return hr;
-  }
-
-  ASSERT1(pi.hProcess);
-  VERIFY1(::CloseHandle(pi.hThread));
-
-  *process = pi.hProcess;
-
-  if (sends_pings_) {
-    StartBackgroundThread(pi.hProcess);
-  }
-
-  return S_OK;
-}
-
-// Starts a background thread with a duplicate of the process handle.
-// We need to duplicate the handle because the original handle will be returned
-// to the client.
-void AppCommand::StartBackgroundThread(HANDLE command_process) const {
-  HANDLE duplicate_process = NULL;
-
-  // This is a pseudo handle that need not be closed.
-  HANDLE this_process_handle = ::GetCurrentProcess();
-
-  if (::DuplicateHandle(this_process_handle, command_process,
-                        this_process_handle, &duplicate_process,
-                        NULL, false, DUPLICATE_SAME_ACCESS)) {
-    CompletePingSender::Start(app_guid_,
-                              is_machine_,
-                              session_id_,
-                              reporting_id_,
-                              duplicate_process);
-  } else {
-    CORE_LOG(LE, (_T("[failed call to DuplicateHandle][0x%08x]"),
-                  HRESULTFromLastError()));
-    SendPing(app_guid_,
-             is_machine_,
-             session_id_,
-             PingEvent::EVENT_APP_COMMAND_COMPLETE,
-             PingEvent::EVENT_RESULT_ERROR,
-             HRESULTFromLastError(),
-             reporting_id_);
-  }
-}
-
-}  // namespace omaha
diff --git a/goopdate/app_command.h b/goopdate/app_command.h
deleted file mode 100644
index ba57b7e..0000000
--- a/goopdate/app_command.h
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Apps may define commands using Registry entries. There are two supported
-// formats:
-//
-// Legacy Format:
-// ROOT\\Software\\Google\\Update\\Clients\\{app-guid}
-//   <command-id> = REG_SZ (command line)
-//
-// New Format:
-// ROOT\\Software\\Google\\Update\\Clients\\{app-guid}\\Commands\\<command-id>
-//   CommandLine   = REG_SZ
-//   SendsPings    = DWORD
-//   WebAccessible = DWORD
-//   ReportingId   = DWORD
-//
-// Only the command line is required, all other values default to 0. It is not
-// possible to set other values using the Legacy format.
-
-#ifndef OMAHA_GOOPDATE_APP_COMMAND_H__
-#define OMAHA_GOOPDATE_APP_COMMAND_H__
-
-#include <windows.h>
-#include <string>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-// Loads, provides metadata for, and executes named commands for installed
-// apps.
-class AppCommand {
- public:
-  static HRESULT Load(const CString& app_guid,
-                      bool is_machine,
-                      const CString& cmd_id,
-                      const CString& session_id,
-                      AppCommand** app_command);
-
-  // Executes the command at the current integrity level. If successful,
-  // the caller is responsible for closing the process HANDLE. This method does
-  // not enforce the 'web accessible' constraint (this is the caller's
-  // responsibility).
-  HRESULT Execute(HANDLE* process) const;
-
-  // Returns true if this command is allowed to be invoked through the
-  // OneClick control.
-  bool is_web_accessible() const { return is_web_accessible_; }
-
- private:
-  AppCommand(const CString& app_guid,
-             bool is_machine,
-             const CString& cmd_id,
-             const CString& cmd_line,
-             bool sends_pings,
-             const CString& session_id,
-             bool is_web_accessible,
-             DWORD reporting_id);
-
-  // Starts a thread which waits for the process to exit, sends a ping, and then
-  // terminates. Waits up to 15 minutes before aborting the wait. A ping is also
-  // sent if the wait times out or if a failure occurs while starting the
-  // thread, initializing the wait, or retrieving the process exit code.
-  //
-  // Duplicates the process HANDLE, leaving the caller with ownership of the
-  // passed handle.
-  //
-  // The thread holds a COM object until the work is completed in order to
-  // avoid early termination if all other clients of the process release their
-  // references.
-  void StartBackgroundThread(HANDLE process) const;
-
-  // Identifying information.
-  const CString app_guid_;
-  const bool is_machine_;
-  const CString cmd_id_;
-  const CString session_id_;
-
-  // Configuration from the registry.
-  const CString cmd_line_;
-  const bool sends_pings_;
-  const bool is_web_accessible_;
-  const int reporting_id_;
-
-  DISALLOW_COPY_AND_ASSIGN(AppCommand);
-};  // class AppCommand
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_COMMAND_H__
diff --git a/goopdate/app_command_unittest.cc b/goopdate/app_command_unittest.cc
deleted file mode 100644
index dc7ee8f..0000000
--- a/goopdate/app_command_unittest.cc
+++ /dev/null
@@ -1,221 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <io.h>
-#include <stdio.h>
-#include <atlstr.h>
-#include <atlsimpstr.h>
-#include <windows.h>
-#include "base/scoped_ptr.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/file.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/goopdate/app_command.h"
-#include "omaha/goopdate/app_unittest_base.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-const TCHAR* const kAppGuid1 = _T("{3B1A3CCA-0525-4418-93E6-A0DB3398EC9B}");
-
-const TCHAR* const kCmdLineExit0 = _T("cmd.exe /c \"exit 0\"");
-
-const TCHAR* const kCmdId1 = _T("command one");
-const TCHAR* const kCmdId2 = _T("command two");
-
-const TCHAR* const kSessionId = _T("unittest_session_id");
-
-const bool kTrue = true;
-const bool kFalse = false;
-
-const DWORD kOne = 1;
-const DWORD kTwo = 2;
-
-}  // namespace
-
-CString GetEchoCommandLine(CString string, CString output_file) {
-  CString command_line;
-  _sntprintf_s(CStrBuf(command_line, MAX_PATH),
-               MAX_PATH,
-               _TRUNCATE,
-               _T("cmd.exe /c \"echo %s > \"%s\"\""),
-               static_cast<const TCHAR*>(string),
-               static_cast<const TCHAR*>(output_file));
-  return command_line;
-}
-
-class AppCommandTest : public AppTestBaseWithRegistryOverride {
- protected:
-  // false == is_machine
-  AppCommandTest() : AppTestBaseWithRegistryOverride(false, true) {}
-
-  static void CreateAppClientKey(const CString& guid, bool is_machine) {
-    CString client_key_name = AppendRegKeyPath(
-        ConfigManager::Instance()->registry_clients(is_machine), guid);
-
-    RegKey client_key;
-
-    ASSERT_SUCCEEDED(client_key.Create(client_key_name));
-    ASSERT_SUCCEEDED(client_key.SetValue(kRegValueProductVersion,
-                                         _T("1.1.1.3")));
-    ASSERT_SUCCEEDED(client_key.SetValue(kRegValueAppName,
-                                         _T("Dispay Name of ") + guid));
-  }
-
-  static void CreateLegacyCommand(const CString& guid,
-                                  bool is_machine,
-                                  const CString& cmd_id,
-                                  const CString& cmd_line) {
-    CString client_key_name = AppendRegKeyPath(
-        ConfigManager::Instance()->registry_clients(is_machine), guid);
-
-    RegKey client_key;
-
-    ASSERT_SUCCEEDED(client_key.Create(client_key_name));
-    ASSERT_SUCCEEDED(client_key.SetValue(cmd_id, cmd_line));
-  }
-
-  static void CreateCommand(const CString& guid,
-                            bool is_machine,
-                            const CString& cmd_id,
-                            const CString& cmd_line,
-                            const bool* sends_pings,
-                            const bool* is_web_accessible,
-                            const DWORD* reporting_id) {
-    CString client_key_name = AppendRegKeyPath(
-        ConfigManager::Instance()->registry_clients(is_machine), guid);
-
-    CString command_key_name = AppendRegKeyPath(client_key_name,
-                                                kCommandsRegKeyName,
-                                                cmd_id);
-
-    RegKey command_key;
-
-    ASSERT_SUCCEEDED(command_key.Create(command_key_name));
-    ASSERT_SUCCEEDED(command_key.SetValue(kRegValueCommandLine, cmd_line));
-    if (sends_pings != NULL) {
-      ASSERT_SUCCEEDED(command_key.SetValue(
-          kRegValueSendsPings, static_cast<DWORD>(*sends_pings ? 1 : 0)));
-    }
-    if (is_web_accessible != NULL) {
-      ASSERT_SUCCEEDED(command_key.SetValue(
-          kRegValueWebAccessible,
-          static_cast<DWORD>(*is_web_accessible ? 1 : 0)));
-    }
-    if (reporting_id != NULL) {
-      ASSERT_SUCCEEDED(command_key.SetValue(kRegValueReportingId,
-                                            *reporting_id));
-    }
-  }
-};  // class AppCommandTest
-
-TEST_F(AppCommandTest, NoApp) {
-  scoped_ptr<AppCommand> app_command;
-  ASSERT_FAILED(AppCommand::Load(
-      kAppGuid1, false, kCmdId1, kSessionId, address(app_command)));
-}
-
-TEST_F(AppCommandTest, NoCmd) {
-  scoped_ptr<AppCommand> app_command;
-  CreateAppClientKey(kAppGuid1, false);
-  CreateCommand(
-      kAppGuid1, false, kCmdId1, kCmdLineExit0, &kTrue, &kFalse, &kOne);
-
-  ASSERT_FAILED(AppCommand::Load(
-      kAppGuid1, false, kCmdId2, kSessionId, address(app_command)));
-}
-
-TEST_F(AppCommandTest, WrongLevel) {
-  scoped_ptr<AppCommand> app_command;
-  CreateAppClientKey(kAppGuid1, true);
-  CreateCommand(
-      kAppGuid1, true, kCmdId1, kCmdLineExit0, &kTrue, &kFalse, &kOne);
-
-  ASSERT_FAILED(AppCommand::Load(
-      kAppGuid1, false, kCmdId1, kSessionId, address(app_command)));
-}
-
-TEST_F(AppCommandTest, LoadCommand) {
-  scoped_ptr<AppCommand> app_command;
-  CreateAppClientKey(kAppGuid1, true);
-  CreateCommand(
-      kAppGuid1, true, kCmdId1, kCmdLineExit0, &kTrue, &kFalse, &kOne);
-
-  ASSERT_SUCCEEDED(AppCommand::Load(
-      kAppGuid1, true, kCmdId1, kSessionId, address(app_command)));
-  ASSERT_FALSE(app_command->is_web_accessible());
-}
-
-TEST_F(AppCommandTest, LoadCommandDefaultValues) {
-  scoped_ptr<AppCommand> app_command;
-  CreateAppClientKey(kAppGuid1, true);
-  CreateCommand(
-      kAppGuid1, true, kCmdId1, kCmdLineExit0, NULL, NULL, NULL);
-
-  ASSERT_SUCCEEDED(AppCommand::Load(
-      kAppGuid1, true, kCmdId1, kSessionId, address(app_command)));
-  ASSERT_FALSE(app_command->is_web_accessible());
-}
-
-TEST_F(AppCommandTest, LoadWebAccessibleCommand) {
-  scoped_ptr<AppCommand> app_command;
-  CreateAppClientKey(kAppGuid1, true);
-  CreateCommand(
-      kAppGuid1, true, kCmdId1, kCmdLineExit0, NULL, &kTrue, NULL);
-
-  ASSERT_SUCCEEDED(AppCommand::Load(
-      kAppGuid1, true, kCmdId1, kSessionId, address(app_command)));
-  ASSERT_TRUE(app_command->is_web_accessible());
-}
-
-TEST_F(AppCommandTest, Execute) {
-  CString temp_file;
-  ASSERT_TRUE(::GetTempFileName(app_util::GetTempDir(),
-                                _T("omaha"),
-                                0,
-                                CStrBuf(temp_file, MAX_PATH)));
-
-  // GetTempFileName created an empty file. Delete it.
-  ASSERT_EQ(0, _tunlink(temp_file));
-
-  // Hopefully we will cause the file to be created. Cause its deletion at exit.
-  ON_SCOPE_EXIT(_tunlink, temp_file);
-
-  CString command_line = GetEchoCommandLine(_T("hello world!"), temp_file);
-
-  scoped_ptr<AppCommand> app_command;
-  CreateAppClientKey(kAppGuid1, true);
-  CreateCommand(
-      kAppGuid1, true, kCmdId1, command_line, &kTrue, &kTrue, NULL);
-
-  ASSERT_SUCCEEDED(AppCommand::Load(
-      kAppGuid1, true, kCmdId1, kSessionId, address(app_command)));
-
-  scoped_process process;
-  ASSERT_SUCCEEDED(app_command->Execute(address(process)));
-  ASSERT_EQ(WAIT_OBJECT_0, WaitForSingleObject(get(process), 16 * kMsPerSec));
-
-  ASSERT_TRUE(File::Exists(temp_file));
-}
-
-}  // namespace omaha
diff --git a/goopdate/app_manager.cc b/goopdate/app_manager.cc
deleted file mode 100644
index a517354..0000000
--- a/goopdate/app_manager.cc
+++ /dev/null
@@ -1,1336 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_manager.h"
-#include <algorithm>
-#include <cstdlib>
-#include <functional>
-#include <map>
-#include "base/scoped_ptr.h"
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/error.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/time.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/app_registry_utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/oem_install_utils.h"
-#include "omaha/goopdate/application_usage_data.h"
-#include "omaha/goopdate/model.h"
-#include "omaha/goopdate/server_resource.h"
-#include "omaha/goopdate/string_formatter.h"
-
-namespace omaha {
-
-namespace {
-
-const uint32 kInitialInstallTimeDiff = static_cast<uint32>(-1 * kSecondsPerDay);
-
-// Returns the number of days haven been passed since the given time.
-// The parameter time is in the same format as C time() returns.
-int GetNumberOfDaysSince(int time) {
-  ASSERT1(time >= 0);
-  const int now = Time64ToInt32(GetCurrent100NSTime());
-  ASSERT1(now >= time);
-
-  if (now < time) {
-    // In case the client computer clock is adjusted in between.
-    return 0;
-  }
-  return (now - time) / kSecondsPerDay;
-}
-
-// Determines if an application is registered with Omaha.
-class IsAppRegisteredFunc
-    : public std::unary_function<const CString&, HRESULT> {
- public:
-  explicit IsAppRegisteredFunc(const CString& guid)
-      : is_registered_(false),
-        guid_(guid) {}
-
-  bool is_registered() const { return is_registered_; }
-
-  HRESULT operator() (const CString& guid) {
-    if (guid.CompareNoCase(guid_) == 0) {
-      is_registered_ = true;
-    }
-    return S_OK;
-  }
- private:
-  CString guid_;
-  bool is_registered_;
-};
-
-// Enumerates all sub keys of the key and calls the functor for each of them,
-// ignoring errors to ensure all keys are processed.
-template <typename T>
-HRESULT EnumerateSubKeys(const TCHAR* key_name, T* functor) {
-  RegKey client_key;
-  HRESULT hr = client_key.Open(key_name, KEY_READ);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  int num_sub_keys = client_key.GetSubkeyCount();
-  for (int i = 0; i < num_sub_keys; ++i) {
-    CString sub_key_name;
-    hr = client_key.GetSubkeyNameAt(i, &sub_key_name);
-    if (SUCCEEDED(hr)) {
-      (*functor)(sub_key_name);
-    }
-  }
-
-  return S_OK;
-}
-
-}  // namespace
-
-typedef bool (*AppPredictFunc)(const AppManager& app_manager,
-                               const CString& app_id);
-
-bool IsUninstalledAppPredicate(const AppManager& app_manager,
-                               const CString& app_id) {
-  return app_manager.IsAppUninstalled(app_id);
-}
-
-bool IsAppOemInstalledAndEulaAcceptedPredicate(const AppManager& app_manager,
-                                               const CString& app_id) {
-  return app_manager.IsAppOemInstalledAndEulaAccepted(app_id);
-}
-
-bool IsRegisteredAppPredicate(const AppManager& app_manager,
-                              const CString& app_id) {
-  return app_manager.IsAppRegistered(app_id);
-}
-
-// Accumulates app IDs for apps that satisfies the predicate.
-class CollectProductsFunc
-    : public std::unary_function<const CString&, HRESULT> {
- public:
-  CollectProductsFunc(const AppPredictFunc predicate,
-                      const AppManager& app_manager,
-                      AppIdVector* app_ids)
-      : predicate_(predicate),
-        app_manager_(app_manager),
-        app_ids_(app_ids) {
-    ASSERT1(app_ids);
-  }
-
-  // Ignores errors and accumulates as many applications as possible.
-  HRESULT operator() (const CString& app_id) const {
-    if ((*predicate_)(app_manager_, app_id)) {
-      app_ids_->push_back(app_id);
-    }
-
-    return S_OK;
-  }
-
- private:
-  const AppPredictFunc predicate_;
-  const AppManager& app_manager_;
-  AppIdVector* const app_ids_;
-
-  DISALLOW_IMPLICIT_CONSTRUCTORS(CollectProductsFunc);
-};
-
-// Runs application registration hooks registered under Omaha AppIds.
-// Reads the Hook Clsid entry under Clients\{AppID}. CoCreates the CLSID. Calls
-// IRegistrationUpdateHook::UpdateRegistry().
-class RunRegistrationUpdateHooksFunc
-    : public std::unary_function<const CString&, HRESULT> {
- public:
-  explicit RunRegistrationUpdateHooksFunc(const AppManager& app_manager)
-      : app_manager_(app_manager) {
-  }
-
-  HRESULT operator() (const CString& app_id) {
-    GUID app_guid = GUID_NULL;
-    HRESULT hr = StringToGuidSafe(app_id, &app_guid);
-    if (FAILED(hr)) {
-      return hr;
-    }
-    RegKey client_key;
-    hr = app_manager_.OpenClientKey(app_guid, &client_key);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    CString hook_clsid_str;
-    hr = client_key.GetValue(kRegValueUpdateHookClsid, &hook_clsid_str);
-    if (FAILED(hr)) {
-      return hr;
-    }
-    GUID hook_clsid = GUID_NULL;
-    hr = StringToGuidSafe(hook_clsid_str, &hook_clsid);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    CORE_LOG(L3, (_T("[Update Hook Clsid][%s][%s]"), app_id, hook_clsid_str));
-
-    CComPtr<IRegistrationUpdateHook> registration_hook;
-    hr = registration_hook.CoCreateInstance(hook_clsid);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[IRegistrationUpdateHook CoCreate failed][0x%x]"), hr));
-      return hr;
-    }
-
-    hr = registration_hook->UpdateRegistry(CComBSTR(app_id),
-                                           app_manager_.is_machine_);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[registration_hook UpdateRegistry failed][0x%x]"), hr));
-      return hr;
-    }
-
-    return S_OK;
-  }
-
- private:
-  const AppManager& app_manager_;
-};
-
-AppManager* AppManager::instance_ = NULL;
-
-// We do not worry about contention on creation because only the Worker should
-// create AppManager during its initialization.
-HRESULT AppManager::CreateInstance(bool is_machine) {
-  ASSERT1(!instance_);
-  if (instance_) {
-    return S_OK;
-  }
-
-  AppManager* instance(new AppManager(is_machine));
-  if (!instance->InitializeRegistryLock()) {
-    HRESULT hr(HRESULTFromLastError());
-    delete instance;
-    return hr;
-  }
-
-  instance_ = instance;
-  return S_OK;
-}
-
-void AppManager::DeleteInstance() {
-  delete instance_;
-  instance_ = NULL;
-}
-
-AppManager* AppManager::Instance() {
-  ASSERT1(instance_);
-  return instance_;
-}
-
-HRESULT AppManager::ReadAppVersionNoLock(bool is_machine, const GUID& app_guid,
-                                         CString* version) {
-  ASSERT1(version);
-  CORE_LOG(L2, (_T("[ReadAppVersionNoLock][%s]"), GuidToString(app_guid)));
-
-  AppManager app_manager(is_machine);
-  RegKey client_key;
-  HRESULT hr = app_manager.OpenClientKey(app_guid, &client_key);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = client_key.GetValue(kRegValueProductVersion, version);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CORE_LOG(L3, (_T("[kRegValueProductVersion][%s]"), *version));
-  return S_OK;
-}
-
-AppManager::AppManager(bool is_machine)
-    : is_machine_(is_machine) {
-  CORE_LOG(L3, (_T("[AppManager::AppManager][is_machine=%d]"), is_machine));
-}
-
-// App installers should use similar code to create a lock to acquire while
-// modifying Omaha registry.
-bool AppManager::InitializeRegistryLock() {
-  NamedObjectAttributes lock_attr;
-  GetNamedObjectAttributes(kRegistryAccessMutex, is_machine_, &lock_attr);
-  return registry_access_lock_.InitializeWithSecAttr(lock_attr.name,
-                                                     &lock_attr.sa);
-}
-
-// Vulnerable to a race condition with installers. To prevent this, acquire
-// GetRegistryStableStateLock().
-bool AppManager::IsAppRegistered(const GUID& app_guid) const {
-  return IsAppRegistered(GuidToString(app_guid));
-}
-
-// Vulnerable to a race condition with installers. To prevent this, acquire
-// GetRegistryStableStateLock().
-bool AppManager::IsAppRegistered(const CString& app_id) const {
-  IsAppRegisteredFunc func(app_id);
-  HRESULT hr = EnumerateSubKeys(
-      ConfigManager::Instance()->registry_clients(is_machine_),
-      &func);
-  if (FAILED(hr)) {
-    return false;
-  }
-
-  return func.is_registered();
-}
-
-bool AppManager::IsAppUninstalled(const CString& app_id) const {
-  GUID app_guid = {0};
-  if (FAILED(StringToGuidSafe(app_id, &app_guid))) {
-    ASSERT1(false);
-    return false;
-  }
-  return IsAppUninstalled(app_guid);
-}
-
-// An app is considered uninstalled if:
-//  * The app's Clients key does not exist AND
-//  * The app's ClientState key exists and contains the pv value.
-// We check for the pv key value in the ClientState to prevent Omaha from
-// detecting the key created in the following scenarios as an uninstalled app.
-//  * Per-machine apps may write dr to per-user Omaha's key. Per-user Omaha
-//    must not detect this as an uninstalled app.
-//  * Omaha may create the app's ClientState key and write values from the
-//    metainstaller tag before running the installer, which creates the
-//    Clients key.
-bool AppManager::IsAppUninstalled(const GUID& app_guid) const {
-  if (IsAppRegistered(app_guid)) {
-    return false;
-  }
-
-  return RegKey::HasValue(GetClientStateKeyName(app_guid),
-                          kRegValueProductVersion);
-}
-
-bool AppManager::IsAppOemInstalledAndEulaAccepted(const CString& app_id) const {
-  GUID app_guid = GUID_NULL;
-  if (FAILED(StringToGuidSafe(app_id, &app_guid))) {
-    ASSERT1(false);
-    return false;
-  }
-
-  if (IsAppUninstalled(app_guid)) {
-    return false;
-  }
-
-  if (!app_registry_utils::IsAppEulaAccepted(is_machine_, app_id, false)) {
-    CORE_LOG(L3, (_T("[EULA not accepted for app %s, its OEM ping not sent.]"),
-                  app_id.GetString()));
-    return false;
-  }
-
-  return RegKey::HasValue(GetClientStateKeyName(app_guid), kRegValueOemInstall);
-}
-
-// Vulnerable to a race condition with installers. To prevent this, hold
-// GetRegistryStableStateLock() while calling this function and related
-// functions, such as ReadAppPersistentData().
-HRESULT AppManager::GetRegisteredApps(AppIdVector* app_ids) const {
-  ASSERT1(app_ids);
-
-  CollectProductsFunc func(IsRegisteredAppPredicate, *this, app_ids);
-
-  return EnumerateSubKeys(
-      ConfigManager::Instance()->registry_clients(is_machine_),
-      &func);
-}
-
-// Vulnerable to a race condition with installers. To prevent this, acquire
-// GetRegistryStableStateLock().
-HRESULT AppManager::GetUninstalledApps(AppIdVector* app_ids) const {
-  ASSERT1(app_ids);
-
-  CollectProductsFunc func(IsUninstalledAppPredicate, *this, app_ids);
-
-  return EnumerateSubKeys(
-      ConfigManager::Instance()->registry_client_state(is_machine_),
-      &func);
-}
-
-HRESULT AppManager::GetOemInstalledAndEulaAcceptedApps(
-    AppIdVector* app_ids) const {
-  ASSERT1(app_ids);
-
-  CollectProductsFunc func(IsAppOemInstalledAndEulaAcceptedPredicate,
-                           *this,
-                           app_ids);
-
-  return EnumerateSubKeys(
-      ConfigManager::Instance()->registry_client_state(is_machine_),
-      &func);
-}
-
-HRESULT AppManager::RunRegistrationUpdateHook(const CString& app_id) const {
-  return RunRegistrationUpdateHooksFunc(*this)(app_id);
-}
-
-// Vulnerable to a race condition with installers. We think this is acceptable.
-// If there is a future requirement for greater consistency, acquire
-// GetRegistryStableStateLock().
-HRESULT AppManager::RunAllRegistrationUpdateHooks() const {
-  RunRegistrationUpdateHooksFunc func(*this);
-  const TCHAR* key(ConfigManager::Instance()->registry_clients(is_machine_));
-  return EnumerateSubKeys(key, &func);
-}
-
-CString AppManager::GetClientKeyName(const GUID& app_guid) const {
-  return app_registry_utils::GetAppClientsKey(is_machine_,
-                                              GuidToString(app_guid));
-}
-
-CString AppManager::GetClientStateKeyName(const GUID& app_guid) const {
-  return app_registry_utils::GetAppClientStateKey(is_machine_,
-                                                  GuidToString(app_guid));
-}
-
-CString AppManager::GetClientStateMediumKeyName(const GUID& app_guid) const {
-  ASSERT1(is_machine_);
-  return app_registry_utils::GetAppClientStateMediumKey(is_machine_,
-                                                        GuidToString(app_guid));
-}
-
-// Assumes the registry access lock is held.
-HRESULT AppManager::OpenClientKey(const GUID& app_guid,
-                                  RegKey* client_key) const {
-  ASSERT1(client_key);
-  return client_key->Open(GetClientKeyName(app_guid), KEY_READ);
-}
-
-// Assumes the registry access lock is held.
-HRESULT AppManager::OpenClientStateKey(const GUID& app_guid,
-                                       REGSAM sam_desired,
-                                       RegKey* client_state_key) const {
-  ASSERT1(client_state_key);
-  CString key_name = GetClientStateKeyName(app_guid);
-  return client_state_key->Open(key_name, sam_desired);
-}
-
-// Also creates the ClientStateMedium key for machine apps, ensuring it exists
-// whenever ClientState exists.  Does not create ClientStateMedium for Omaha.
-// This function is called for self-updates, so it must explicitly avoid this.
-// Assumes the registry access lock is held.
-HRESULT AppManager::CreateClientStateKey(const GUID& app_guid,
-                                         RegKey* client_state_key) {
-  ASSERT1(client_state_key);
-  // TODO(omaha3): Add GetOwner() to GLock & add this to Open() functions too.
-  // ASSERT1(::GetCurrentThreadId() == registry_access_lock_.GetOwner());
-
-  const CString key_name = GetClientStateKeyName(app_guid);
-  HRESULT hr = client_state_key->Create(key_name);
-  if (FAILED(hr)) {
-    CORE_LOG(L3, (_T("[RegKey::Create failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  if (!is_machine_) {
-    return S_OK;
-  }
-
-  if (::IsEqualGUID(kGoopdateGuid, app_guid)) {
-    return S_OK;
-  }
-
-  const CString medium_key_name = GetClientStateMediumKeyName(app_guid);
-  hr = RegKey::CreateKey(medium_key_name);
-  if (FAILED(hr)) {
-    CORE_LOG(L3, (_T("[RegKey::Create ClientStateMedium failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// Reads the following values from the registry:
-//  Clients key
-//    pv
-//    lang
-//    name
-//  ClientState key
-//    lang (if not present in Clients)
-//    ap
-//    tttoken
-//    iid
-//    brand
-//    client
-//    experiment
-//    (referral is intentionally not read)
-//    InstallTime (converted to diff)
-//    oeminstall
-//  ClientState and ClientStateMedium key
-//    eulaaccepted
-//  ClientState key in HKCU/HKLM/Low integrity
-//    did run
-//
-// app_guid_ is set to the app_guid argument.
-// Note: pv is not read from ClientState into app_data. It's
-// presence is checked for an uninstall
-// TODO(omaha3): We will need to get ClientState's pv when reporting uninstalls.
-// Note: If the application is uninstalled, the Clients key may not exist.
-HRESULT AppManager::ReadAppPersistentData(App* app) {
-  ASSERT1(app);
-
-  const GUID& app_guid = app->app_guid();
-  const CString& app_guid_string = app->app_guid_string();
-
-  CORE_LOG(L2, (_T("[AppManager::ReadAppPersistentData][%s]"),
-                app_guid_string));
-
-  ASSERT1(app->model()->IsLockedByCaller());
-
-  __mutexScope(registry_access_lock_);
-
-  const bool is_eula_accepted =
-      app_registry_utils::IsAppEulaAccepted(is_machine_,
-                                            app_guid_string,
-                                            false);
-  app->is_eula_accepted_ = is_eula_accepted ? TRISTATE_TRUE : TRISTATE_FALSE;
-
-  bool client_key_exists = false;
-  RegKey client_key;
-  HRESULT hr = OpenClientKey(app_guid, &client_key);
-  if (SUCCEEDED(hr)) {
-    client_key_exists = true;
-
-    CString version;
-    hr = client_key.GetValue(kRegValueProductVersion, &version);
-    CORE_LOG(L3, (_T("[AppManager::ReadAppPersistentData]")
-                  _T("[%s][version=%s]"), app_guid_string, version));
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    app->current_version()->set_version(version);
-
-    // Language and name might not be written by installer, so ignore failures.
-    client_key.GetValue(kRegValueLanguage, &app->language_);
-    client_key.GetValue(kRegValueAppName, &app->display_name_);
-  }
-
-  // Ensure there is a valid display name.
-  if (app->display_name_.IsEmpty()) {
-    StringFormatter formatter(app->app_bundle()->display_language());
-
-    CString company_name;
-    VERIFY1(SUCCEEDED(formatter.LoadString(IDS_FRIENDLY_COMPANY_NAME,
-                                           &company_name)));
-
-    VERIFY1(SUCCEEDED(formatter.FormatMessage(&app->display_name_,
-                                              IDS_DEFAULT_APP_DISPLAY_NAME,
-                                              company_name)));
-  }
-
-  // If ClientState registry key doesn't exist, the function could return.
-  // Before opening the key, set days_since_last* to -1, which is the
-  // default value if reg key doesn't exist. If later we find that the values
-  // are readable, new values will overwrite current ones.
-  app->set_days_since_last_active_ping(-1);
-  app->set_days_since_last_roll_call(-1);
-
-  // The following do not rely on client_state_key, so check them before
-  // possibly returning if OpenClientStateKey fails.
-
-  // Reads the did run value.
-  ApplicationUsageData app_usage(is_machine_, vista_util::IsVistaOrLater());
-  app_usage.ReadDidRun(app_guid_string);
-
-  // Sets did_run regardless of the return value of ReadDidRun above. If read
-  // fails, active_state() should return ACTIVE_UNKNOWN which is intented.
-  app->did_run_ = app_usage.active_state();
-
-  // TODO(omaha3): Consider moving GetInstallTimeDiffSec() up here. Be careful
-  // that the results when ClientState does not exist are desirable. See the
-  // comments near that function and above set_days_since_last_active_ping call.
-
-  RegKey client_state_key;
-  hr = OpenClientStateKey(app_guid, KEY_READ, &client_state_key);
-  if (FAILED(hr)) {
-    // It is possible that the client state key has not yet been populated.
-    // In this case just return the information that we have gathered thus far.
-    // However if both keys do not exist, then we are doing something wrong.
-    CORE_LOG(LW, (_T("[AppManager::ReadAppPersistentData - No ClientState]")));
-    if (client_key_exists) {
-      return S_OK;
-    } else {
-      return hr;
-    }
-  }
-
-  // Read language from ClientState key if it was not found in the Clients key.
-  if (app->language().IsEmpty()) {
-    client_state_key.GetValue(kRegValueLanguage, &app->language_);
-  }
-
-  client_state_key.GetValue(kRegValueAdditionalParams, &app->ap_);
-  client_state_key.GetValue(kRegValueTTToken, &app->tt_token_);
-
-  CString iid;
-  client_state_key.GetValue(kRegValueInstallationId, &iid);
-  GUID iid_guid;
-  if (SUCCEEDED(StringToGuidSafe(iid, &iid_guid))) {
-    app->iid_ = iid_guid;
-  }
-
-  client_state_key.GetValue(kRegValueBrandCode, &app->brand_code_);
-  ASSERT1(app->brand_code_.GetLength() <= kBrandIdLength);
-  client_state_key.GetValue(kRegValueClientId, &app->client_id_);
-
-  // We do not need the referral_id.
-
-  DWORD last_active_ping_sec(0);
-  if (SUCCEEDED(client_state_key.GetValue(kRegValueActivePingDayStartSec,
-                                          &last_active_ping_sec))) {
-    int days_since_last_active_ping =
-        GetNumberOfDaysSince(static_cast<int32>(last_active_ping_sec));
-    app->set_days_since_last_active_ping(days_since_last_active_ping);
-  }
-
-  DWORD last_roll_call_sec(0);
-  if (SUCCEEDED(client_state_key.GetValue(kRegValueRollCallDayStartSec,
-                                          &last_roll_call_sec))) {
-    int days_since_last_roll_call =
-        GetNumberOfDaysSince(static_cast<int32>(last_roll_call_sec));
-    app->set_days_since_last_roll_call(days_since_last_roll_call);
-  }
-
-  app->install_time_diff_sec_ = GetInstallTimeDiffSec(app_guid);
-  // Generally GetInstallTimeDiffSec() shouldn't return kInitialInstallTimeDiff
-  // here. The only exception is in the unexpected case when ClientState exists
-  // without a pv.
-  ASSERT1((app->install_time_diff_sec_ != kInitialInstallTimeDiff) ||
-          !RegKey::HasValue(GetClientStateKeyName(app_guid),
-                            kRegValueProductVersion));
-
-  return S_OK;
-}
-
-void AppManager::ReadAppInstallTimeDiff(App* app) {
-  ASSERT1(app);
-  app->install_time_diff_sec_ = GetInstallTimeDiffSec(app->app_guid());
-}
-
-// Calls ReadAppPersistentData() to populate app and adds the following values
-// specific to uninstalled apps:
-//  ClientState key
-//    pv:  set as current_version()->version
-//
-// Since this is an uninstalled app, values from the Clients key should not be
-// populated.
-HRESULT AppManager::ReadUninstalledAppPersistentData(App* app) {
-  ASSERT1(app);
-  ASSERT1(!IsAppRegistered(app->app_guid_string()));
-
-  HRESULT hr = ReadAppPersistentData(app);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  ASSERT1(app->current_version()->version().IsEmpty());
-
-  RegKey client_state_key;
-  hr = OpenClientStateKey(app->app_guid(), KEY_READ, &client_state_key);
-  ASSERT(SUCCEEDED(hr), (_T("Uninstalled apps have a ClientState key.")));
-
-  CString version;
-  hr = client_state_key.GetValue(kRegValueProductVersion, &version);
-  CORE_LOG(L3, (_T("[AppManager::ReadAppPersistentData]")
-                _T("[%s][uninstalled version=%s]"),
-                app->app_guid_string(), version));
-  ASSERT(SUCCEEDED(hr), (_T("Uninstalled apps have a pv.")));
-  app->current_version()->set_version(version);
-
-  return S_OK;
-}
-
-// Sets the following values in the app's ClientState, to make them available to
-// the installer:
-//    lang
-//    ap
-//    brand (in SetAppBranding)
-//    client (in SetAppBranding)
-//    experiment
-//    referral (in SetAppBranding)
-//    InstallTime (in SetAppBranding; converted from diff)
-//    oeminstall (if appropriate)
-//    eulaaccepted (set/deleted)
-//    browser
-//    usagestats
-// Sets eulaaccepted=0 if the app is not already registered and the app's EULA
-// has not been accepted. Deletes eulaaccepted if the EULA has been accepted.
-// Only call for initial or over-installs. Do not call for updates to avoid
-// mistakenly replacing data, such as the application's language, and causing
-// unexpected changes to the app during a silent update.
-HRESULT AppManager::WritePreInstallData(const App& app) {
-  CORE_LOG(L2, (_T("[AppManager::WritePreInstallData][%s]"),
-                app.app_guid_string()));
-
-  ASSERT1(app.app_bundle()->is_machine() == is_machine_);
-
-  ASSERT1(IsRegistryStableStateLockedByCaller());
-  __mutexScope(registry_access_lock_);
-
-  RegKey client_state_key;
-  HRESULT hr = CreateClientStateKey(app.app_guid(), &client_state_key);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (app.is_eula_accepted()) {
-    hr = app_registry_utils::ClearAppEulaNotAccepted(is_machine_,
-                                                     app.app_guid_string());
-  } else {
-    if (!IsAppRegistered(app.app_guid())) {
-      hr = app_registry_utils::SetAppEulaNotAccepted(is_machine_,
-                                                     app.app_guid_string());
-    }
-  }
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (!app.language().IsEmpty()) {
-    VERIFY1(SUCCEEDED(client_state_key.SetValue(kRegValueLanguage,
-                                                app.language())));
-  }
-
-  if (app.ap().IsEmpty()) {
-    VERIFY1(SUCCEEDED(client_state_key.DeleteValue(kRegValueAdditionalParams)));
-  } else {
-    VERIFY1(SUCCEEDED(client_state_key.SetValue(kRegValueAdditionalParams,
-                                                app.ap())));
-  }
-
-  CString state_key_path = GetClientStateKeyName(app.app_guid());
-  VERIFY1(SUCCEEDED(app_registry_utils::SetAppBranding(state_key_path,
-                                                       app.brand_code(),
-                                                       app.client_id(),
-                                                       app.referral_id())));
-
-  if (app.GetExperimentLabels().IsEmpty()) {
-    VERIFY1(SUCCEEDED(client_state_key.DeleteValue(kRegValueExperimentLabels)));
-  } else {
-    VERIFY1(SUCCEEDED(client_state_key.SetValue(kRegValueExperimentLabels,
-                                                app.GetExperimentLabels())));
-  }
-
-  if (oem_install_utils::IsOemInstalling(is_machine_)) {
-    ASSERT1(is_machine_);
-    VERIFY1(SUCCEEDED(client_state_key.SetValue(kRegValueOemInstall, _T("1"))));
-  }
-
-  if (BROWSER_UNKNOWN == app.browser_type()) {
-    VERIFY1(SUCCEEDED(client_state_key.DeleteValue(kRegValueBrowser)));
-  } else {
-    DWORD browser_type = app.browser_type();
-    VERIFY1(SUCCEEDED(client_state_key.SetValue(kRegValueBrowser,
-                                                browser_type)));
-  }
-
-  if (TRISTATE_NONE != app.usage_stats_enable()) {
-    VERIFY1(SUCCEEDED(app_registry_utils::SetUsageStatsEnable(
-                          is_machine_,
-                          app.app_guid_string(),
-                          app.usage_stats_enable())));
-  }
-
-  return S_OK;
-}
-
-// All values are optional.
-void AppManager::ReadInstallerResultApiValues(
-    const GUID& app_guid,
-    InstallerResult* installer_result,
-    DWORD* installer_error,
-    DWORD* installer_extra_code1,
-    CString* installer_result_uistring,
-    CString* installer_success_launch_cmd) {
-  ASSERT1(installer_result);
-  ASSERT1(installer_error);
-  ASSERT1(installer_extra_code1);
-  ASSERT1(installer_result_uistring);
-  ASSERT1(installer_success_launch_cmd);
-
-  __mutexScope(registry_access_lock_);
-
-  RegKey client_state_key;
-  HRESULT hr = OpenClientStateKey(app_guid, KEY_READ, &client_state_key);
-  if (FAILED(hr)) {
-    return;
-  }
-
-  if (SUCCEEDED(client_state_key.GetValue(
-                    kRegValueInstallerResult,
-                    reinterpret_cast<DWORD*>(installer_result)))) {
-    CORE_LOG(L1, (_T("[InstallerResult in registry][%u]"), *installer_result));
-  }
-  if (*installer_result >= INSTALLER_RESULT_MAX) {
-    CORE_LOG(LW, (_T("[Unsupported InstallerResult value]")));
-    *installer_result = INSTALLER_RESULT_DEFAULT;
-  }
-
-  if (SUCCEEDED(client_state_key.GetValue(kRegValueInstallerError,
-                                          installer_error))) {
-    CORE_LOG(L1, (_T("[InstallerError in registry][%u]"), *installer_error));
-  }
-
-  if (SUCCEEDED(client_state_key.GetValue(kRegValueInstallerExtraCode1,
-                                          installer_extra_code1))) {
-    CORE_LOG(L1, (_T("[InstallerExtraCode1 in registry][%u]"),
-        *installer_extra_code1));
-  }
-
-  if (SUCCEEDED(client_state_key.GetValue(kRegValueInstallerResultUIString,
-                                          installer_result_uistring))) {
-    CORE_LOG(L1, (_T("[InstallerResultUIString in registry][%s]"),
-        *installer_result_uistring));
-  }
-
-  if (SUCCEEDED(client_state_key.GetValue(
-                    kRegValueInstallerSuccessLaunchCmdLine,
-                    installer_success_launch_cmd))) {
-    CORE_LOG(L1, (_T("[InstallerSuccessLaunchCmdLine in registry][%s]"),
-        *installer_success_launch_cmd));
-  }
-
-  ClearInstallerResultApiValues(app_guid);
-}
-
-void AppManager::ClearInstallerResultApiValues(const GUID& app_guid) {
-  const CString client_state_key_name = GetClientStateKeyName(app_guid);
-  const CString update_key_name =
-      ConfigManager::Instance()->registry_update(is_machine_);
-
-  ASSERT1(IsRegistryStableStateLockedByCaller());
-  __mutexScope(registry_access_lock_);
-
-  // Delete the old LastXXX values.  These may not exist, so don't care if they
-  // fail.
-  RegKey::DeleteValue(client_state_key_name,
-                      kRegValueLastInstallerResult);
-  RegKey::DeleteValue(client_state_key_name,
-                      kRegValueLastInstallerResultUIString);
-  RegKey::DeleteValue(client_state_key_name,
-                      kRegValueLastInstallerError);
-  RegKey::DeleteValue(client_state_key_name,
-                      kRegValueLastInstallerExtraCode1);
-  RegKey::DeleteValue(client_state_key_name,
-                      kRegValueLastInstallerSuccessLaunchCmdLine);
-
-  // Also delete any values from Google\Update.
-  // TODO(Omaha): This is a temporary fix for bug 1539293. See TODO below.
-  RegKey::DeleteValue(update_key_name,
-                      kRegValueLastInstallerResult);
-  RegKey::DeleteValue(update_key_name,
-                      kRegValueLastInstallerResultUIString);
-  RegKey::DeleteValue(update_key_name,
-                      kRegValueLastInstallerError);
-  RegKey::DeleteValue(update_key_name,
-                      kRegValueLastInstallerExtraCode1);
-  RegKey::DeleteValue(update_key_name,
-                      kRegValueLastInstallerSuccessLaunchCmdLine);
-
-  // Rename current InstallerResultXXX values to LastXXX.
-  RegKey::RenameValue(client_state_key_name,
-                      kRegValueInstallerResult,
-                      kRegValueLastInstallerResult);
-  RegKey::RenameValue(client_state_key_name,
-                      kRegValueInstallerError,
-                      kRegValueLastInstallerError);
-  RegKey::RenameValue(client_state_key_name,
-                      kRegValueInstallerExtraCode1,
-                      kRegValueLastInstallerExtraCode1);
-  RegKey::RenameValue(client_state_key_name,
-                      kRegValueInstallerResultUIString,
-                      kRegValueLastInstallerResultUIString);
-  RegKey::RenameValue(client_state_key_name,
-                      kRegValueInstallerSuccessLaunchCmdLine,
-                      kRegValueLastInstallerSuccessLaunchCmdLine);
-
-  // Copy over to the Google\Update key.
-  // TODO(Omaha3): This is a temporary fix for bug 1539293. Once Pack V2 is
-  // deprecated (Pack stops taking offline installers for new versions of
-  // Omaha apps), remove this. (It might be useful to leave the CopyValue calls
-  // in DEBUG builds only.)
-  RegKey::CopyValue(client_state_key_name,
-                    update_key_name,
-                    kRegValueLastInstallerResult);
-  RegKey::CopyValue(client_state_key_name,
-                    update_key_name,
-                    kRegValueLastInstallerError);
-  RegKey::CopyValue(client_state_key_name,
-                    update_key_name,
-                    kRegValueLastInstallerExtraCode1);
-  RegKey::CopyValue(client_state_key_name,
-                    update_key_name,
-                    kRegValueLastInstallerResultUIString);
-  RegKey::CopyValue(client_state_key_name,
-                    update_key_name,
-                    kRegValueLastInstallerSuccessLaunchCmdLine);
-}
-
-// Reads the following values from Clients:
-//    pv
-//    lang (if present)
-// name is not read. TODO(omaha3): May change if we persist name in registry.
-HRESULT AppManager::ReadInstallerRegistrationValues(App* app) {
-  ASSERT1(app);
-
-  const CString& app_guid_string = app->app_guid_string();
-
-  CORE_LOG(L2, (_T("[AppManager::ReadInstallerRegistrationValues][%s]"),
-                app_guid_string));
-
-  ASSERT1(app->model()->IsLockedByCaller());
-
-  __mutexScope(registry_access_lock_);
-
-  RegKey client_key;
-  if (FAILED(OpenClientKey(app->app_guid(), &client_key))) {
-    OPT_LOG(LE, (_T("[Installer did not create key][%s]"), app_guid_string));
-    return GOOPDATEINSTALL_E_INSTALLER_DID_NOT_WRITE_CLIENTS_KEY;
-  }
-
-  CString version;
-  if (FAILED(client_key.GetValue(kRegValueProductVersion, &version))) {
-    OPT_LOG(LE, (_T("[Installer did not register][%s]"), app_guid_string));
-    return GOOPDATEINSTALL_E_INSTALLER_DID_NOT_WRITE_CLIENTS_KEY;
-  }
-
-  if (version.IsEmpty()) {
-    OPT_LOG(LE, (_T("[Installer did not write version][%s]"), app_guid_string));
-    return GOOPDATEINSTALL_E_INSTALLER_DID_NOT_WRITE_CLIENTS_KEY;
-  }
-
-  app->next_version()->set_version(version);
-
-  CString language;
-  if (SUCCEEDED(client_key.GetValue(kRegValueLanguage, &language))) {
-    app->language_ = language;
-  }
-
-  return S_OK;
-}
-
-// Writes tttoken and updates relevant stats.
-void AppManager::PersistSuccessfulUpdateCheckResponse(
-    const App& app,
-    bool is_update_available) {
-  CORE_LOG(L2, (_T("[AppManager::PersistSuccessfulUpdateCheckResponse]")
-                _T("[%s][%d]"), app.app_guid_string(), is_update_available));
-  __mutexScope(registry_access_lock_);
-
-  VERIFY1(SUCCEEDED(SetTTToken(app)));
-
-  const CString client_state_key = GetClientStateKeyName(app.app_guid());
-
-  if (is_update_available) {
-    if (app.error_code() == GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY) {
-      // The error indicates is_update and updates are disabled by policy.
-      ASSERT1(app.is_update());
-      app_registry_utils::ClearUpdateAvailableStats(client_state_key);
-    } else if (app.is_update()) {
-      // Only record an update available event for updates.
-      // We have other mechanisms, including IID, to track install success.
-      UpdateUpdateAvailableStats(app.app_guid());
-    }
-  } else {
-    app_registry_utils::ClearUpdateAvailableStats(client_state_key);
-    app_registry_utils::PersistSuccessfulUpdateCheck(client_state_key);
-  }
-}
-
-// Writes the following values to the ClientState key:
-//    pv (should be value written by installer in Clients key)
-//    lang (should be value written by installer in Clients key)
-//    iid (set/deleted)
-//
-// Does not write the following values because they were set by
-// WritePreInstallData() and would not have changed during installation unless
-// modified directly by the app installer.
-//    ap
-//    brand
-//    client
-//    experiment
-//    referral
-//    InstallTime (converted from diff)
-//    oeminstall
-//    eulaaccepted
-//    browser
-//    usagestats
-// TODO(omaha3): Maybe we should delete referral at this point. Ask Chrome.
-//
-// Other values, such as tttoken were set after the update check.
-//
-// The caller is responsible for modifying the values in app_data as
-// appropriate, including:
-//   * Updating values in app_data to reflect installer's values (pv and lang)
-//   * Clearing iid if appropriate.
-//   * Clearing the did run value. TODO(omaha3): Depends on TODO below.
-void AppManager::PersistSuccessfulInstall(const App& app) {
-  CORE_LOG(L2, (_T("[AppManager::PersistSuccessfulInstall][%s]"),
-                app.app_guid_string()));
-
-  ASSERT1(IsRegistryStableStateLockedByCaller());
-  __mutexScope(registry_access_lock_);
-
-  ASSERT1(!::IsEqualGUID(kGoopdateGuid, app.app_guid()));
-
-  RegKey client_state_key;
-  VERIFY1(SUCCEEDED(CreateClientStateKey(app.app_guid(), &client_state_key)));
-
-  VERIFY1(SUCCEEDED(client_state_key.SetValue(kRegValueProductVersion,
-                                              app.next_version()->version())));
-
-  if (!app.language().IsEmpty()) {
-    VERIFY1(SUCCEEDED(client_state_key.SetValue(kRegValueLanguage,
-                                                app.language())));
-  }
-
-  if (::IsEqualGUID(app.iid(), GUID_NULL)) {
-    VERIFY1(SUCCEEDED(client_state_key.DeleteValue(kRegValueInstallationId)));
-  } else {
-    VERIFY1(SUCCEEDED(client_state_key.SetValue(
-                          kRegValueInstallationId,
-                          GuidToString(app.iid()))));
-  }
-
-  const CString client_state_key_path = GetClientStateKeyName(app.app_guid());
-  app_registry_utils::PersistSuccessfulInstall(client_state_key_path,
-                                               app.is_update(),
-                                               false);  // TODO(omaha3): offline
-}
-
-HRESULT AppManager::SynchronizeClientState(const GUID& app_guid) {
-  __mutexScope(registry_access_lock_);
-
-  RegKey client_key;
-  HRESULT hr = OpenClientKey(app_guid, &client_key);
-  if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) {
-    return S_OK;
-  }
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  RegKey client_state_key;
-  hr = CreateClientStateKey(app_guid, &client_state_key);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CString version;
-  client_key.GetValue(kRegValueProductVersion, &version);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  hr = client_state_key.SetValue(kRegValueProductVersion, version);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CString language;
-  client_key.GetValue(kRegValueLanguage, &language);
-  if (!language.IsEmpty()) {
-    return client_state_key.SetValue(kRegValueLanguage, language);
-  }
-
-  return S_OK;
-}
-
-// TODO(omaha3): tttoken is not currently read from the server response.
-// TODO(omaha3): When implementing offline, we must make sure that the tttoken
-// is not deleted by the offline response processing.
-// TODO(omaha3): Having the parser write the server's token to the same member
-// that is used for the value from the tag exposes this value to the COM setter.
-// It would be nice to avoid that, possibly by only allowing that setter to work
-// in certain states.
-HRESULT AppManager::SetTTToken(const App& app) {
-  CORE_LOG(L3, (_T("[AppManager::SetTTToken][token=%s]"), app.tt_token()));
-
-  __mutexScope(registry_access_lock_);
-
-  RegKey client_state_key;
-  HRESULT hr = CreateClientStateKey(app.app_guid(), &client_state_key);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (app.tt_token().IsEmpty()) {
-    return client_state_key.DeleteValue(kRegValueTTToken);
-  } else {
-    return client_state_key.SetValue(kRegValueTTToken, app.tt_token());
-  }
-}
-
-void AppManager::ClearOemInstalled(const AppIdVector& app_ids) {
-  __mutexScope(registry_access_lock_);
-
-  AppIdVector::const_iterator it;
-  for (it = app_ids.begin(); it != app_ids.end(); ++it) {
-    ASSERT1(IsAppOemInstalledAndEulaAccepted(*it));
-    RegKey state_key;
-
-    GUID app_guid = GUID_NULL;
-    HRESULT hr = StringToGuidSafe(*it, &app_guid);
-    if (FAILED(hr)) {
-      continue;
-    }
-
-    hr = OpenClientStateKey(app_guid, KEY_ALL_ACCESS, &state_key);
-    if (FAILED(hr)) {
-      continue;
-    }
-
-    VERIFY1(SUCCEEDED(state_key.DeleteValue(kRegValueOemInstall)));
-  }
-}
-
-void AppManager::UpdateUpdateAvailableStats(const GUID& app_guid) {
-  __mutexScope(registry_access_lock_);
-
-  RegKey state_key;
-  HRESULT hr = CreateClientStateKey(app_guid, &state_key);
-  if (FAILED(hr)) {
-    ASSERT1(false);
-    return;
-  }
-
-  DWORD update_available_count(0);
-  hr = state_key.GetValue(kRegValueUpdateAvailableCount,
-                          &update_available_count);
-  if (FAILED(hr)) {
-    update_available_count = 0;
-  }
-  ++update_available_count;
-  VERIFY1(SUCCEEDED(state_key.SetValue(kRegValueUpdateAvailableCount,
-                                       update_available_count)));
-
-  DWORD64 update_available_since_time(0);
-  hr = state_key.GetValue(kRegValueUpdateAvailableSince,
-                          &update_available_since_time);
-  if (FAILED(hr)) {
-    // There is no existing value, so this must be the first update notice.
-    VERIFY1(SUCCEEDED(state_key.SetValue(kRegValueUpdateAvailableSince,
-                                         GetCurrent100NSTime())));
-
-    // TODO(omaha): It would be nice to report the version that we were first
-    // told to update to. This is available in UpdateResponse but we do not
-    // currently send it down in update responses. If we start using it, add
-    // kRegValueFirstUpdateResponseVersion.
-  }
-}
-
-// Returns 0 for any values that are not found.
-void AppManager::ReadUpdateAvailableStats(
-    const GUID& app_guid,
-    DWORD* update_responses,
-    DWORD64* time_since_first_response_ms) {
-  ASSERT1(update_responses);
-  ASSERT1(time_since_first_response_ms);
-  *update_responses = 0;
-  *time_since_first_response_ms = 0;
-
-  __mutexScope(registry_access_lock_);
-
-  RegKey state_key;
-  HRESULT hr = OpenClientStateKey(app_guid, KEY_READ, &state_key);
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[App ClientState key does not exist][%s]"),
-                  GuidToString(app_guid)));
-    return;
-  }
-
-  DWORD update_responses_in_reg(0);
-  hr = state_key.GetValue(kRegValueUpdateAvailableCount,
-                          &update_responses_in_reg);
-  if (SUCCEEDED(hr)) {
-    *update_responses = update_responses_in_reg;
-  }
-
-  DWORD64 update_available_since_time(0);
-  hr = state_key.GetValue(kRegValueUpdateAvailableSince,
-                          &update_available_since_time);
-  if (SUCCEEDED(hr)) {
-    const DWORD64 current_time = GetCurrent100NSTime();
-    ASSERT1(update_available_since_time <= current_time);
-    const DWORD64 time_since_first_response_in_100ns =
-        current_time - update_available_since_time;
-    *time_since_first_response_ms =
-        time_since_first_response_in_100ns / kMillisecsTo100ns;
-  }
-}
-
-uint32 AppManager::GetInstallTimeDiffSec(const GUID& app_guid) const {
-  if (!IsAppRegistered(app_guid) && !IsAppUninstalled(app_guid)) {
-    return kInitialInstallTimeDiff;
-  }
-
-  RegKey client_state_key;
-  HRESULT hr = OpenClientStateKey(app_guid, KEY_READ, &client_state_key);
-  if (FAILED(hr)) {
-    return 0;
-  }
-
-  DWORD install_time(0);
-  DWORD install_time_diff_sec(0);
-  if (SUCCEEDED(client_state_key.GetValue(kRegValueInstallTimeSec,
-                                          &install_time))) {
-    const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-    if (0 != install_time && now >= install_time) {
-      install_time_diff_sec = now - install_time;
-      // TODO(omaha3): Restore this assert. In Omaha 2, this function gets
-      // called as part of installation verification and Job::UpdateJob(), so
-      // the value can be 0. This will not be the case in Omaha 3.
-      // ASSERT1(install_time_diff_sec != 0);
-    }
-  }
-
-  return install_time_diff_sec;
-}
-
-// Clear the Installation ID if at least one of the conditions is true:
-// 1) DidRun==yes. First run is the last time we want to use the Installation
-//    ID. So delete Installation ID if it is present.
-// 2) kMaxLifeOfInstallationIDSec has passed since the app was installed. This
-//    is to ensure that Installation ID is cleared even if DidRun is never set.
-// 3) The app is Omaha. Always delete Installation ID if it is present
-//    because DidRun does not apply.
-HRESULT AppManager::ClearInstallationId(const App& app) {
-  ASSERT1(app.model()->IsLockedByCaller());
-  __mutexScope(registry_access_lock_);
-
-  if (::IsEqualGUID(app.iid(), GUID_NULL)) {
-    return S_OK;
-  }
-
-  if ((ACTIVE_RUN == app.did_run()) ||
-      (kMaxLifeOfInstallationIDSec <= app.install_time_diff_sec()) ||
-      (::IsEqualGUID(kGoopdateGuid, app.app_guid()))) {
-    CORE_LOG(L1, (_T("[Deleting iid for app][%s]"), app.app_guid_string()));
-
-    RegKey client_state_key;
-    HRESULT hr = CreateClientStateKey(app.app_guid(), &client_state_key);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    return client_state_key.DeleteValue(kRegValueInstallationId);
-  }
-
-  return S_OK;
-}
-
-void AppManager::SetLastPingDayStartTime(const App& app,
-                                         int elapsed_seconds_since_day_start) {
-  ASSERT1(elapsed_seconds_since_day_start >= 0);
-  ASSERT1(elapsed_seconds_since_day_start < kMaxTimeSinceMidnightSec);
-  ASSERT1(app.model()->IsLockedByCaller());
-
-  __mutexScope(registry_access_lock_);
-
-  int now = Time64ToInt32(GetCurrent100NSTime());
-
-  RegKey client_state_key;
-  if (FAILED(CreateClientStateKey(app.app_guid(), &client_state_key))) {
-    return;
-  }
-
-  bool did_send_active_ping = (app.did_run() == ACTIVE_RUN &&
-                               app.days_since_last_active_ping() != 0);
-  if (did_send_active_ping) {
-    VERIFY1(SUCCEEDED(client_state_key.SetValue(
-        kRegValueActivePingDayStartSec,
-        static_cast<DWORD>(now - elapsed_seconds_since_day_start))));
-  }
-
-  bool did_send_roll_call = (app.days_since_last_roll_call() != 0);
-  if (did_send_roll_call) {
-    VERIFY1(SUCCEEDED(client_state_key.SetValue(
-        kRegValueRollCallDayStartSec,
-        static_cast<DWORD>(now - elapsed_seconds_since_day_start))));
-  }
-}
-
-// Writes the day start time when last active ping/roll call happened to
-// registry if the corresponding ping has been sent.
-// Removes installation id, if did run = true or if goopdate.
-// Clears did run.
-HRESULT AppManager::PersistUpdateCheckSuccessfullySent(
-    const App& app,
-    int elapsed_seconds_since_day_start) {
-  ASSERT1(app.model()->IsLockedByCaller());
-
-  ApplicationUsageData app_usage(app.app_bundle()->is_machine(),
-                                 vista_util::IsVistaOrLater());
-  VERIFY1(SUCCEEDED(app_usage.ResetDidRun(app.app_guid_string())));
-
-  SetLastPingDayStartTime(app, elapsed_seconds_since_day_start);
-
-  // Handle the installation id.
-  VERIFY1(SUCCEEDED(ClearInstallationId(app)));
-
-  return S_OK;
-}
-
-HRESULT AppManager::RemoveClientState(const GUID& app_guid) {
-  CORE_LOG(L2, (_T("[AppManager::RemoveClientState][%s]"),
-                GuidToString(app_guid)));
-  ASSERT1(IsRegistryStableStateLockedByCaller());
-  __mutexScope(registry_access_lock_);
-
-  ASSERT1(!IsAppRegistered(app_guid));
-
-  return app_registry_utils::RemoveClientState(is_machine_,
-                                               GuidToString(app_guid));
-}
-
-// TODO(omaha3): May not need these
-#if 0
-// Writes 0.0.0.1 to pv. This value avoids any special cases, such as initial
-// install rules, for 0.0.0.0, while being unlikely to be higher than the
-// product's actual current version.
-HRESULT AppManager::RegisterProduct(const GUID& product_guid,
-                                    const CString& product_name) {
-  const TCHAR* const kRegisterProductVersion = _T("0.0.0.1");
-
-  __mutexScope(GetRegistryStableStateLock());
-  RegKey client_key;
-  HRESULT hr = client_key.Create(GetClientKeyName(GUID_NULL, product_guid));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = client_key.SetValue(kRegValueProductVersion, kRegisterProductVersion);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // AppName is not a required parameter since it's only used for being able to
-  // easily tell what application is there when reading the registry.
-  VERIFY1(SUCCEEDED(client_key.SetValue(kRegValueAppName, product_name)));
-
-  return S_OK;
-}
-
-HRESULT AppManager::UnregisterProduct(const GUID& product_guid) {
-  __mutexScope(GetRegistryStableStateLock());
-  return RegKey::DeleteKey(GetClientKeyName(GUID_NULL, product_guid), true);
-}
-#endif
-
-}  // namespace omaha
diff --git a/goopdate/app_manager.h b/goopdate/app_manager.h
deleted file mode 100644
index 12e862b..0000000
--- a/goopdate/app_manager.h
+++ /dev/null
@@ -1,254 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_APP_MANAGER_H_
-#define OMAHA_GOOPDATE_APP_MANAGER_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "omaha/base/synchronized.h"
-
-namespace omaha {
-
-class App;
-class RegKey;
-
-typedef std::vector<CString> AppIdVector;
-
-// Manages the persistence of application state in the registry.
-// All functions that operate on model objects assume the call is protected by
-// the model lock.
-// All public functions hold a registry access lock for the duration of registry
-// accesses in that function. Unless otherwise noted, read operations may return
-// inconsistent/unstable state in some cases. Examples include:
-// * The app installer is running and modifying the registry (not all installers
-//   acquire this lock before modifying the registry).
-// * Omaha is in the process of installing an app, and the read occurred between
-//   registry operations (i.e. after WritePreInstallData() but before
-//   WriteAppPersistentData().
-// If your operation absolutely needs consistent/stable state, use the functions
-// that ensure this.
-// All write functions assume that the lock returned by
-// GetRegistryStableStateLock() is held. Reads do not require this lock to be
-// held.
-class AppManager {
- public:
-  // These values are a public API. Do not remove or move existing values.
-  enum InstallerResult {
-    INSTALLER_RESULT_SUCCESS = 0,
-    INSTALLER_RESULT_FAILED_CUSTOM_ERROR = 1,
-    INSTALLER_RESULT_FAILED_MSI_ERROR = 2,
-    INSTALLER_RESULT_FAILED_SYSTEM_ERROR = 3,
-    INSTALLER_RESULT_EXIT_CODE = 4,
-    INSTALLER_RESULT_DEFAULT = INSTALLER_RESULT_EXIT_CODE,
-    INSTALLER_RESULT_MAX,
-  };
-
-  static HRESULT CreateInstance(bool is_machine);
-  static void DeleteInstance();
-
-  static AppManager* Instance();
-
-  // Reads the "pv" value from Google\Update\Clients\{app_guid}, and is used by
-  // the Update3WebControl. This method does not take any locks, and is not
-  // recommended for use in any other scenario.
-  static HRESULT ReadAppVersionNoLock(bool is_machine, const GUID& app_guid,
-                                      CString* version);
-
-  bool IsAppRegistered(const GUID& app_guid) const;
-  bool IsAppUninstalled(const GUID& app_guid) const;
-
-  // Adds all registered products to bundle.
-  HRESULT GetRegisteredApps(AppIdVector* app_ids) const;
-
-  // Adds all uninstalled products to bundle.
-  HRESULT GetUninstalledApps(AppIdVector* app_ids) const;
-
-  // Adds all OEM installed apps that user has accepted EULA either explicitly
-  // or implicitly.
-  HRESULT GetOemInstalledAndEulaAcceptedApps(AppIdVector* app_ids) const;
-
-  // TODO(omaha3): Consider moving these two RegistrationUpdateHook functions
-  // out of this class. Instead, AppManager should expose a function to obtain
-  // the hook for each app.
-
-  // CoCreates and runs the HookClsid for app_id.
-  HRESULT RunRegistrationUpdateHook(const CString& app_id) const;
-
-  // CoCreates and runs HookClsids for registered products.
-  HRESULT RunAllRegistrationUpdateHooks() const;
-
-  // Populates the app object with the persisted state stored in the registry.
-  HRESULT ReadAppPersistentData(App* app);
-
-  // Populates the app object with the install time diff based on the install
-  // time stored in the registry.
-  // If the app is registered or has pv value, app's install time diff will be
-  // calculated based on InstallTime value from the registry, or 0 if the value
-  // is not there. For other cases, the install time diff will be -1 day.
-  void ReadAppInstallTimeDiff(App* app);
-
-  // Populates the app object with the persisted state for an uninstalled app
-  // stored in the registry.
-  HRESULT ReadUninstalledAppPersistentData(App* app);
-
-  // Sets dynamic install parameters that the installer or app may use.
-  // Call this method before calling the installer.
-  HRESULT WritePreInstallData(const App& app);
-
-  // Reads Installer Result API values the installer may have written to the
-  // registry. Clears all values after reading.
-  void ReadInstallerResultApiValues(const GUID& app_guid,
-                                    InstallerResult* installer_result,
-                                    DWORD* installer_error,
-                                    DWORD* installer_extra_code1,
-                                    CString* installer_result_uistring,
-                                    CString* installer_success_launch_cmd);
-
-  // Clears the Installer Result API values from the registry.
-  void ClearInstallerResultApiValues(const GUID& app_guid);
-
-  // Reads the values the app wrote to the Clients key and stores them in the
-  // app object. Replaces existing values.
-  HRESULT ReadInstallerRegistrationValues(App* app);
-
-  // Updates relevant values of the app object in the registry after a
-  // successful update check, which is either a "noupdate" response or an update
-  // available even if it will not be applied.
-  void PersistSuccessfulUpdateCheckResponse(const App& app,
-                                            bool is_update_available);
-
-  // Persists relevant values of the app object in the registry after a
-  // successful install.
-  void PersistSuccessfulInstall(const App& app);
-
-  // Copies product version and language from client key to client state key.
-  // Returns S_OK when the client key does not exist.
-  HRESULT SynchronizeClientState(const GUID& app_guid);
-
-  // Updates application state after an update check request has been
-  // successfully sent to the server.
-  HRESULT PersistUpdateCheckSuccessfullySent(
-      const App& app,
-      int elapsed_seconds_since_day_start);
-
-  // TODO(omaha3): Most of these methods should be eliminated or moved (i.e. to
-  // App) since we only want to write the registry in one or two functions.
-  // Can't make them all private in the meantime because unit tests use them.
-
-  // Clears the OEM-installed flag for the apps.
-  void ClearOemInstalled(const AppIdVector& app_ids);
-
-  // Obtains usage stats information from the stored information about update
-  // available events for the app.
-  void ReadUpdateAvailableStats(const GUID& app_guid,
-                                DWORD* update_responses,
-                                DWORD64* time_since_first_response_ms);
-
-  // Removes the ClientState and ClientStateMedium keys for the application.
-  HRESULT RemoveClientState(const GUID& app_guid);
-
-  // Returns a reference to the lock that ensures the registry is in a stable
-  // state (i.e. no app is being installed). Acquire this lock before calling
-  // read functions if you require a consistent/stable snapshot of the system
-  // (for example, to determine whether Omaha should install). Because this
-  // lock is held throughout app install, the Lock() call could block for
-  // seconds or more.
-  Lockable& GetRegistryStableStateLock() { return registry_stable_state_lock_; }
-
-  // Gets the time since InstallTime was written. Returns 0 if InstallTime
-  // could not be read. This could occur if the app is not already installed or
-  // there is no valid install time in the registry, which can occur for apps
-  // installed before installtime was implemented.
-  uint32 GetInstallTimeDiffSec(const GUID& app_guid) const;
-
-#if 0
-  HRESULT RegisterProduct(const GUID& product_guid,
-                          const CString& product_name);
-  HRESULT UnregisterProduct(const GUID& product_guid);
-#endif
-
-  bool IsAppRegistered(const CString& app_id) const;
-  bool IsAppUninstalled(const CString& app_id) const;
-  bool IsAppOemInstalledAndEulaAccepted(const CString& app_id) const;
-
- private:
-  explicit AppManager(bool is_machine);
-  ~AppManager() {}
-
-  bool InitializeRegistryLock();
-
-  CString GetClientKeyName(const GUID& app_guid) const;
-  CString GetClientStateKeyName(const GUID& app_guid) const;
-  CString GetClientStateMediumKeyName(const GUID& app_guid) const;
-
-  // Opens the app's Client key for read access.
-  HRESULT OpenClientKey(const GUID& app_guid, RegKey* client_key) const;
-  // Opens the app's ClientState key with the specified access.
-  HRESULT OpenClientStateKey(const GUID& app_guid,
-                             REGSAM sam_desired,
-                             RegKey* client_state_key) const;
-  // Creates the app's ClientState key.
-  HRESULT CreateClientStateKey(const GUID& app_guid, RegKey* client_state_key);
-
-  // Write the TT Token with what the server returned.
-  HRESULT SetTTToken(const App& app);
-
-  // Stores information about the update available event for the app.
-  // Call each time an update is available.
-  void UpdateUpdateAvailableStats(const GUID& app_guid);
-
-  HRESULT ClearInstallationId(const App& app);
-
-  // Writes the day start time when last active ping/roll call happened to
-  // registry.
-  void SetLastPingDayStartTime(const App& app,
-                               int elapsed_seconds_since_day_start);
-
-  bool IsRegistryStableStateLockedByCaller() const {
-    return ::GetCurrentThreadId() == registry_stable_state_lock_.GetOwner();
-  }
-
-  const bool is_machine_;
-
-  // Locks.
-  // If it is going to be acquired, registry_stable_state_lock_ should always be
-  // acquired before registry_access_lock_.
-  // registry_access_lock_ is only ever acquired by this class and app
-  // installers.
-
-  // Ensures that each function's access is on a stable snapshot of the
-  // registry, excluding values modified by the installer.
-  GLock registry_access_lock_;
-
-  // Ensures the registry is in a stable state (i.e. all apps are fully
-  // installed and no installer is running that might be modifying the
-  // registry.) Uninstalls are still an issue unless the app uninstaller informs
-  // Omaha that it is uninstalling the app.
-  LLock registry_stable_state_lock_;
-
-  static AppManager* instance_;
-
-  friend class RunRegistrationUpdateHooksFunc;
-  friend class AppManagerTestBase;
-
-  DISALLOW_COPY_AND_ASSIGN(AppManager);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_MANAGER_H_
diff --git a/goopdate/app_manager_unittest.cc b/goopdate/app_manager_unittest.cc
deleted file mode 100644
index f5b4727..0000000
--- a/goopdate/app_manager_unittest.cc
+++ /dev/null
@@ -1,2632 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <vector>
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/error.h"
-#include "omaha/base/highres_timer-win32.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/thread.h"
-#include "omaha/base/time.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/base/wmi_query.h"
-#include "omaha/common/app_registry_utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/goopdate/app_manager.h"
-#include "omaha/goopdate/app_unittest_base.h"
-#include "omaha/setup/setup_google_update.h"
-#include "omaha/testing/unit_test.h"
-
-using ::testing::_;
-using ::testing::Return;
-
-namespace omaha {
-
-// TODO(omaha): there is a problem with this unit test. The model is built
-// bottom up. This makes it impossible to set the references to parents. Will
-// have to fix the code, eventually using Builder DP to create a bunch of
-// models containing bundles, apps, and such.
-
-namespace {
-
-const TCHAR* const kGuid1 = _T("{21CD0965-0B0E-47cf-B421-2D191C16C0E2}");
-const TCHAR* const kGuid2 = _T("{A979ACBD-1F55-4b12-A35F-4DBCA5A7CCB8}");
-const TCHAR* const kGuid3 = _T("{661045C5-4429-4140-BC48-8CEA241D1DEF}");
-const TCHAR* const kGuid4 = _T("{AAFA1CF9-E94F-42e6-A899-4CD27F37D5A7}");
-const TCHAR* const kGuid5 = _T("{3B1A3CCA-0525-4418-93E6-A0DB3398EC9B}");
-const TCHAR* const kGuid6 = _T("{F3F2CFD4-5F98-4bf0-ABB0-BEEEA46C62B4}");
-const TCHAR* const kGuid7 = _T("{6FD2272F-8583-4bbd-895A-E65F8003FC7B}");
-const TCHAR* const kIid1  = _T("{F723495F-8ACF-4746-8240-643741C797B5}");
-
-const TCHAR* const kNonExistentClsid =
-    _T("{BC00156D-3B01-4ba3-9F5E-2C46E8B6E824}");
-
-const TCHAR* const kGuid1ClientsKeyPathUser =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME
-    _T("\\") PRODUCT_NAME _T("\\Clients\\")
-    _T("{21CD0965-0B0E-47cf-B421-2D191C16C0E2}");
-const TCHAR* const kGuid1ClientsKeyPathMachine =
-    _T("HKLM\\Software\\") SHORT_COMPANY_NAME
-    _T("\\") PRODUCT_NAME _T("\\Clients\\")
-    _T("{21CD0965-0B0E-47cf-B421-2D191C16C0E2}");
-const TCHAR* const kGuid1ClientStateKeyPathUser =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME
-    _T("\\") PRODUCT_NAME _T("\\ClientState\\")
-    _T("{21CD0965-0B0E-47cf-B421-2D191C16C0E2}");
-const TCHAR* const kGuid1ClientStateKeyPathMachine =
-    _T("HKLM\\Software\\") SHORT_COMPANY_NAME
-    _T("\\") PRODUCT_NAME _T("\\ClientState\\")
-    _T("{21CD0965-0B0E-47cf-B421-2D191C16C0E2}");
-
-const TCHAR* const kDefaultAppName = SHORT_COMPANY_NAME _T(" Application");
-
-const uint32 kInitialInstallTimeDiff = static_cast<uint32>(-1 * kSecondsPerDay);
-
-// Initializes a GLock in the same way AppManager does. Used for lock conflict
-// tests.
-void InitializeAppManagerRegistryLock(bool is_machine, GLock* lock) {
-  ASSERT1(lock);
-  NamedObjectAttributes lock_attr;
-  GetNamedObjectAttributes(kRegistryAccessMutex, is_machine, &lock_attr);
-  EXPECT_SUCCEEDED(lock->InitializeWithSecAttr(lock_attr.name, &lock_attr.sa));
-}
-
-}  // namespace
-
-// Helper functions defined in other test files.
-void ValidateExpectedValues(const App& expected, const App& actual);
-void VerifyHklmKeyHasMediumIntegrity(const CString& key_full_name);
-void VerifyHklmKeyHasDefaultIntegrity(const CString& key_full_name);
-
-class AppManagerTestBase : public AppTestBaseWithRegistryOverride {
- public:
-  static void SetDisplayName(const CString& name, App* app) {
-    ASSERT1(app);
-    app->display_name_ = name;
-  }
-
- protected:
-  // Creates the application registration entries based on the passed in data.
-  // If passed an application that is uninstalled, the function only creates
-  // the registration entries in the client state and no information is written
-  // in the clients.
-  static void CreateAppRegistryState(const App& app,
-                                     bool is_machine,
-                                     const CString& previous_version,
-                                     bool can_write_clients_key) {
-    CString clients_key_name = AppendRegKeyPath(
-        ConfigManager::Instance()->registry_clients(is_machine),
-        app.app_guid_string());
-    CString client_state_key_name = AppendRegKeyPath(
-        ConfigManager::Instance()->registry_client_state(is_machine),
-        app.app_guid_string());
-    const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-    RegKey client_key;
-    if (can_write_clients_key) {
-      ASSERT_SUCCEEDED(client_key.Create(clients_key_name));
-
-      CString current_version(app.current_version()->version());
-      if (!current_version.IsEmpty()) {
-        ASSERT_SUCCEEDED(client_key.SetValue(kRegValueProductVersion,
-                                             current_version));
-      }
-
-      if (!app.display_name_.IsEmpty()) {
-        ASSERT_SUCCEEDED(client_key.SetValue(kRegValueAppName,
-                                             app.display_name_));
-      }
-    }
-
-    RegKey client_state_key;
-    ASSERT_SUCCEEDED(client_state_key.Create(client_state_key_name));
-
-    if (!previous_version.IsEmpty()) {
-      ASSERT_SUCCEEDED(client_state_key.SetValue(kRegValueProductVersion,
-                                                 previous_version));
-    }
-
-    if (!app.language_.IsEmpty()) {
-      // TODO(omaha3): This is some interesting logic wrt Clients/ClientState.
-      // Does it still make sense for Omaha 3?
-      if (can_write_clients_key) {
-        ASSERT_SUCCEEDED(client_key.SetValue(kRegValueLanguage,
-                                             app.language_));
-      } else {
-        ASSERT_SUCCEEDED(client_state_key.SetValue(kRegValueLanguage,
-                                                   app.language_));
-      }
-    }
-
-    if (app.did_run_ != ACTIVE_UNKNOWN) {
-      CString dr = (app.did_run_ == ACTIVE_NOTRUN) ? _T("0") : _T("1");
-      ASSERT_SUCCEEDED(client_state_key.SetValue(kRegValueDidRun,
-                                                 dr));
-    }
-
-    if (!app.ap_.IsEmpty()) {
-      ASSERT_SUCCEEDED(client_state_key.SetValue(kRegValueAdditionalParams,
-                                                 app.ap_));
-    }
-
-    if (!app.tt_token_.IsEmpty()) {
-      ASSERT_SUCCEEDED(client_state_key.SetValue(kRegValueTTToken,
-                                                 app.tt_token_));
-    }
-
-    if (!::IsEqualGUID(app.iid_, GUID_NULL)) {
-      ASSERT_SUCCEEDED(client_state_key.SetValue(kRegValueInstallationId,
-                                                 GuidToString(app.iid_)));
-    }
-
-    if (!app.brand_code_.IsEmpty()) {
-      ASSERT_SUCCEEDED(client_state_key.SetValue(kRegValueBrandCode,
-                                                 app.brand_code_));
-    }
-
-    if (!app.client_id_.IsEmpty()) {
-      ASSERT_SUCCEEDED(client_state_key.SetValue(kRegValueClientId,
-                                                 app.client_id_));
-    }
-
-    if (!app.referral_id_.IsEmpty()) {
-      ASSERT_SUCCEEDED(client_state_key.SetValue(kRegValueReferralId,
-                                                 app.referral_id_));
-    }
-
-    if (!app.referral_id_.IsEmpty()) {
-      ASSERT_SUCCEEDED(client_state_key.SetValue(kRegValueReferralId,
-                                                 app.referral_id_));
-    }
-
-    if (app.install_time_diff_sec_) {
-      const DWORD install_time = now - app.install_time_diff_sec_;
-      ASSERT_SUCCEEDED(client_state_key.SetValue(kRegValueInstallTimeSec,
-                                                 install_time));
-    }
-
-    if (app.is_eula_accepted_ == TRISTATE_FALSE) {
-      ASSERT_SUCCEEDED(client_state_key.SetValue(_T("eulaaccepted"),
-                                                 static_cast<DWORD>(0)));
-    }
-
-    int days = app.days_since_last_active_ping();
-
-    if (days != -1) {
-      EXPECT_GE(days, 0);
-      ASSERT1(now > static_cast<uint32>(days * kSecondsPerDay));
-      uint32 last_active_time = now - days * kSecondsPerDay;
-
-      ASSERT_SUCCEEDED(client_state_key.SetValue(
-          kRegValueActivePingDayStartSec,
-          static_cast<DWORD>(last_active_time)));
-    }
-
-    days = app.days_since_last_roll_call();
-    if (days != -1) {
-      EXPECT_GE(days, 0);
-      EXPECT_GE(now, static_cast<uint32>(days * kSecondsPerDay));
-
-      uint32 last_roll_call_time = now - days * kSecondsPerDay;
-
-      ASSERT_SUCCEEDED(client_state_key.SetValue(
-          kRegValueRollCallDayStartSec,
-          static_cast<DWORD>(last_roll_call_time)));
-    }
-  }
-
-  // App will be cleaned up when bundle is destroyed.
-  // This is a hack for creating registry data. Would be nice to have a
-  // different mechanism.
-  App* CreateAppForRegistryPopulation(const TCHAR* app_id) {
-    App* app = NULL;
-    EXPECT_SUCCEEDED(
-        dummy_app_bundle_for_app_creation_->createApp(CComBSTR(app_id), &app));
-    ASSERT1(app);
-
-    // install_time_diff_sec_ is -1 day for new app. After that, the app
-    // becomes registered and the install age will be 0. So set the time to 0
-    // to make the expected value and actual equal.
-    app->install_time_diff_sec_ = 0;
-    return app;
-  }
-
-  static void PopulateExpectedApp1ClientsOnly(App* expected_app) {
-    ASSERT_TRUE(expected_app);
-    expected_app->current_version()->set_version(_T("1.1.1.3"));
-    expected_app->language_ = _T("abc");
-    expected_app->display_name_ = _T("My App");
-
-    // This is the result when Client State does not exist.
-    expected_app->install_time_diff_sec_ =
-        static_cast<uint32>(-1 * kSecondsPerDay);
-  }
-
-  static void PopulateExpectedApp1(App* expected_app) {
-    ASSERT_TRUE(expected_app);
-    expected_app->current_version()->set_version(_T("1.1.1.3"));
-    expected_app->language_ = _T("abc");
-    expected_app->display_name_ = _T("My App");
-    expected_app->ap_ = _T("Test ap");
-    expected_app->tt_token_ = _T("Test TT Token");
-    expected_app->iid_ =
-        StringToGuid(_T("{F723495F-8ACF-4746-8240-643741C797B5}"));
-    expected_app->brand_code_ = _T("GOOG");
-    expected_app->client_id_ = _T("someclient");
-    // Do not set referral_id or install_time_diff_sec because these are not
-    // expected in most cases.
-    expected_app->did_run_ = ACTIVE_RUN;
-    expected_app->set_days_since_last_active_ping(3);
-    expected_app->set_days_since_last_roll_call(1);
-  }
-
-  static void PopulateExpectedApp2(App* expected_app) {
-    ASSERT_TRUE(expected_app);
-    expected_app->current_version()->set_version(_T("1.2.1.3"));
-    expected_app->language_ = _T("de");
-    expected_app->ap_ = _T("beta");
-    expected_app->tt_token_ = _T("beta TT Token");
-    expected_app->iid_ =
-        StringToGuid(_T("{431EC961-CFD8-49ea-AB7B-2B99BCA274AD}"));
-    expected_app->brand_code_ = _T("GooG");
-    expected_app->client_id_ = _T("anotherclient");
-    expected_app->did_run_ = ACTIVE_NOTRUN;
-    expected_app->set_days_since_last_active_ping(100);
-    expected_app->set_days_since_last_roll_call(1);
-  }
-
-  static void PopulateExpectedUninstalledApp(const CString& uninstalled_version,
-                                             App* expected_app) {
-    ASSERT_TRUE(expected_app);
-    PopulateExpectedApp2(expected_app);
-
-    expected_app->current_version()->set_version(uninstalled_version);
-  }
-
-  static void SetAppInstallTimeDiffSec(App* app,
-                                       uint32 install_time_diff_sec) {
-    ASSERT_TRUE(app);
-    app->install_time_diff_sec_ = install_time_diff_sec;
-  }
-
-  explicit AppManagerTestBase(bool is_machine)
-      : AppTestBaseWithRegistryOverride(is_machine, true),
-        app_manager_(NULL),
-        app_(NULL),
-        guid1_(StringToGuid(kGuid1)) {}
-
-  virtual void SetUp() {
-    AppTestBaseWithRegistryOverride::SetUp();
-
-    app_manager_ = AppManager::Instance();
-    ASSERT_TRUE(app_manager_);
-
-    // Initialize the second bundle.
-    dummy_app_bundle_for_app_creation_ = model_->CreateAppBundle(is_machine_);
-    ASSERT_TRUE(dummy_app_bundle_for_app_creation_.get());
-
-    EXPECT_SUCCEEDED(dummy_app_bundle_for_app_creation_->put_displayName(
-                         CComBSTR(_T("My Bundle"))));
-    EXPECT_SUCCEEDED(dummy_app_bundle_for_app_creation_->put_displayLanguage(
-                         CComBSTR(_T("en"))));
-    EXPECT_SUCCEEDED(dummy_app_bundle_for_app_creation_->put_installSource(
-                         CComBSTR(_T("unittest"))));
-    // TODO(omaha3): Address with the TODO in AppBundleInitializedTest::SetUp().
-    if (is_machine_) {
-      SetAppBundleStateForUnitTest(dummy_app_bundle_for_app_creation_.get(),
-                                   new fsm::AppBundleStateInitialized);
-    } else {
-      EXPECT_SUCCEEDED(dummy_app_bundle_for_app_creation_->initialize());
-    }
-
-    EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app_));
-    ASSERT_TRUE(app_);
-  }
-
-  virtual void TearDown() {
-    app_manager_ = NULL;
-
-    AppTestBaseWithRegistryOverride::TearDown();
-  }
-
-  static void UpdateUpdateAvailableStats(const GUID& app_guid,
-                                         AppManager* app_manager) {
-    ASSERT1(app_manager);
-    app_manager->UpdateUpdateAvailableStats(app_guid);
-  }
-
-  CString GetClientKeyName(const GUID& app_guid) const {
-    return app_manager_->GetClientKeyName(app_guid);
-  }
-
-  static void SetAppGuid(const CString& guid, App* app) {
-    ASSERT1(app);
-    app->app_guid_ = StringToGuid(guid);
-  }
-
-  bool IsClientStateKeyPresent(const App& app) {
-    CString client_state_key_name = AppendRegKeyPath(
-        ConfigManager::Instance()->registry_client_state(is_machine_),
-        GuidToString(app.app_guid_));
-
-    return RegKey::HasKey(client_state_key_name);
-  }
-
-  // TODO(omaha3): In this test or elsewhere, test the new Omaha 3 behaviors:
-  // IID is deleted if GUID_NULL and dr is cleared.
-  // TODO(omaha3): Add checks for values set/not set by
-  // app_registry_utils::PersistSuccessfulInstall().
-  void PersistSuccessfulInstallTest() {
-    // Create the data the installer would have written. These values should
-    // not be read below because the caller is responsible for updating these
-    // values.
-    CString clients_key_name = AppendRegKeyPath(
-        ConfigManager::Instance()->registry_clients(is_machine_),
-        kGuid1);
-    EXPECT_SUCCEEDED(RegKey::SetValue(clients_key_name,
-                                     kRegValueProductVersion,
-                                     _T("9.8.7.6")));
-    EXPECT_SUCCEEDED(
-        RegKey::SetValue(clients_key_name, kRegValueLanguage, _T("fr")));
-
-    // Populate the App structure. For the most part, these values are not
-    // used. Exceptions are:
-    // * pv and language are written.
-    // * iid is written to the registry.
-    app_->display_name_ = _T("foo");
-    app_->next_version()->set_version(_T("4.5.6.7"));
-    app_->language_ = _T("de");
-    app_->ap_ = _T("test ap");
-    app_->tt_token_ = _T("test TT Token");
-    app_->iid_ =
-        StringToGuid(_T("{64333341-CA93-490d-9FB7-7FC5728721F4}"));
-    app_->brand_code_ = _T("g00g");
-    app_->client_id_ = _T("myclient");
-    app_->referral_id_ = _T("somereferrer");
-    app_->set_days_since_last_active_ping(-1);
-    app_->set_days_since_last_roll_call(-1);
-    EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_TRUE));
-
-    __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-
-    app_manager_->PersistSuccessfulInstall(*app_);
-
-    const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-    // Validate the results.
-    CString client_state_key_name = AppendRegKeyPath(
-        ConfigManager::Instance()->registry_client_state(is_machine_),
-        kGuid1);
-    RegKey client_state_key;
-    EXPECT_SUCCEEDED(client_state_key.Create(client_state_key_name));
-
-    ValidateClientStateMedium(is_machine_, kGuid1);
-
-    // Check version is based on app_ and not read from Clients key.
-    CString client_state_version;
-    EXPECT_SUCCEEDED(client_state_key.GetValue(kRegValueProductVersion,
-                                               &client_state_version));
-    EXPECT_STREQ(_T("4.5.6.7"), app_->next_version()->version());
-    EXPECT_STREQ(_T("4.5.6.7"), client_state_version);
-
-    // Check language is based on app_ and not read from Clients key.
-    CString language;
-    EXPECT_SUCCEEDED(client_state_key.GetValue(kRegValueLanguage, &language));
-    EXPECT_STREQ(_T("de"), app_->language_);
-    EXPECT_STREQ(_T("de"), language);
-
-    // Check iid is set correctly in ClientState.
-    CString iid;
-    EXPECT_SUCCEEDED(client_state_key.GetValue(kRegValueInstallationId, &iid));
-    EXPECT_STREQ(_T("{64333341-CA93-490D-9FB7-7FC5728721F4}"),
-                 GuidToString(app_->iid_));
-    EXPECT_STREQ(_T("{64333341-CA93-490D-9FB7-7FC5728721F4}"), iid);
-
-    DWORD last_successful_check(0);
-    EXPECT_SUCCEEDED(
-        client_state_key.GetValue(kRegValueLastSuccessfulCheckSec,
-                                  &last_successful_check));
-    EXPECT_GE(now, last_successful_check);
-    EXPECT_GE(static_cast<uint32>(200), now - last_successful_check);
-
-    // Check other values were not written.
-    EXPECT_EQ(4, client_state_key.GetValueCount());
-    EXPECT_FALSE(client_state_key.HasValue(kRegValueAdditionalParams));
-    EXPECT_FALSE(client_state_key.HasValue(kRegValueBrandCode));
-    EXPECT_FALSE(client_state_key.HasValue(kRegValueBrowser));
-    EXPECT_FALSE(client_state_key.HasValue(kRegValueClientId));
-    EXPECT_FALSE(client_state_key.HasValue(kRegValueDidRun));
-    EXPECT_FALSE(client_state_key.HasValue(kRegValueOemInstall));
-    EXPECT_FALSE(client_state_key.HasValue(kRegValueReferralId));
-    EXPECT_FALSE(client_state_key.HasValue(kRegValueEulaAccepted));
-    EXPECT_FALSE(client_state_key.HasValue(kRegValueUsageStats));
-    EXPECT_FALSE(client_state_key.HasValue(kRegValueInstallTimeSec));
-    EXPECT_FALSE(client_state_key.HasValue(kRegValueLastUpdateTimeSec));
-    EXPECT_FALSE(client_state_key.HasValue(kRegValueTTToken));
-    EXPECT_FALSE(client_state_key.HasValue(kRegValueActivePingDayStartSec));
-    EXPECT_FALSE(client_state_key.HasValue(kRegValueRollCallDayStartSec));
-
-    EXPECT_TRUE(app_registry_utils::IsAppEulaAccepted(is_machine_,
-                                                      kGuid1,
-                                                      false));
-  }
-
-  void PersistUpdateCheckSuccessfullySent_AllUpdated() {
-    const CString client_state_key_name = AppendRegKeyPath(
-        ConfigManager::Instance()->registry_client_state(is_machine_),
-        kGuid1);
-
-    // Create the test data.
-    App* expected_app = CreateAppForRegistryPopulation(kGuid1);
-    expected_app->current_version()->set_version(_T("1.0.0.0"));
-    expected_app->iid_ = StringToGuid(kIid1);
-    expected_app->did_run_ = ACTIVE_RUN;
-    // Set non-zero values for activities so that the registry values can
-    // be updated.
-    expected_app->set_days_since_last_active_ping(4);
-    expected_app->set_days_since_last_roll_call(2);
-    CreateAppRegistryState(*expected_app, is_machine_, _T(""), true);
-
-    __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-
-    __mutexBlock(app_->model()->lock()) {
-      EXPECT_SUCCEEDED(app_manager_->ReadAppPersistentData(app_));
-
-      // We only want to make sure the timestamps in the registry are updated
-      // and don't care about time_since_midnight_sec here, so just pass a 0 as
-      // the first parameter.
-      EXPECT_SUCCEEDED(
-          app_manager_->PersistUpdateCheckSuccessfullySent(*app_, 0));
-    }
-
-    // Validate the results.
-    RegKey client_state_key;
-    EXPECT_SUCCEEDED(client_state_key.Open(client_state_key_name));
-
-    // Check installation id removed.
-    EXPECT_FALSE(client_state_key.HasValue(kRegValueInstallationId));
-
-    // Check ping timestamps are updated.
-    const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-    DWORD last_active_ping_day_start_sec = 0;
-    EXPECT_SUCCEEDED(client_state_key.GetValue(kRegValueActivePingDayStartSec,
-        &last_active_ping_day_start_sec));
-    EXPECT_GE(now, last_active_ping_day_start_sec);
-    EXPECT_LE(now, last_active_ping_day_start_sec + kMaxTimeSinceMidnightSec);
-
-    DWORD last_roll_call_day_start_sec = 0;
-    EXPECT_SUCCEEDED(client_state_key.GetValue(kRegValueRollCallDayStartSec,
-        &last_roll_call_day_start_sec));
-    EXPECT_GE(now, last_roll_call_day_start_sec);
-    EXPECT_LE(now, last_roll_call_day_start_sec + kMaxTimeSinceMidnightSec);
-
-    // Check did_run is cleared.
-    CString did_run;
-    EXPECT_SUCCEEDED(client_state_key.GetValue(kRegValueDidRun, &did_run));
-    EXPECT_STREQ(_T("0"), did_run);
-
-    // Check that members in app_ are not changed.
-    EXPECT_TRUE(expected_app->iid() == app_->iid());
-    EXPECT_EQ(expected_app->days_since_last_active_ping(),
-              app_->days_since_last_active_ping());
-    EXPECT_EQ(expected_app->days_since_last_roll_call(),
-              app_->days_since_last_roll_call());
-    EXPECT_EQ(expected_app->did_run(), app_->did_run());
-  }
-
-  void PersistUpdateCheckSuccessfullySent_NotRun() {
-    const CString client_state_key_name = AppendRegKeyPath(
-        ConfigManager::Instance()->registry_client_state(is_machine_),
-        kGuid1);
-    const int kDaysSinceLastActivePing = 2;
-
-    // Create the test data.
-    App* expected_app = CreateAppForRegistryPopulation(kGuid1);
-    expected_app->current_version()->set_version(_T("1.0.0.0"));
-    expected_app->iid_ = StringToGuid(kIid1);
-    expected_app->did_run_ = ACTIVE_NOTRUN;
-    expected_app->set_days_since_last_active_ping(kDaysSinceLastActivePing);
-    expected_app->set_days_since_last_roll_call(0);
-    CreateAppRegistryState(*expected_app, is_machine_, _T(""), true);
-
-    // Choose a time that is close to current time but with some skew so that
-    // if the registry is rewritten, we won't write the same value again and
-    // the change would be detected.
-    const uint32 base_time = Time64ToInt32(GetCurrent100NSTime()) - 2;
-
-    RegKey client_state_key;
-    EXPECT_SUCCEEDED(client_state_key.Open(client_state_key_name));
-    uint32 last_active_time =
-        base_time - kDaysSinceLastActivePing * kSecondsPerDay;
-    ASSERT_SUCCEEDED(client_state_key.SetValue(
-        kRegValueActivePingDayStartSec,
-        static_cast<DWORD>(last_active_time)));
-
-    ASSERT_SUCCEEDED(client_state_key.SetValue(
-        kRegValueRollCallDayStartSec,
-        static_cast<DWORD>(base_time)));
-
-    __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-
-    __mutexBlock(app_->model()->lock()) {
-      EXPECT_SUCCEEDED(app_manager_->ReadAppPersistentData(app_));
-
-      // We only want to make sure the timestamps in the registry are updated
-      // and don't care about time_since_midnight_sec here, so just pass a 0 as
-      // the first parameter.
-      EXPECT_SUCCEEDED(
-          app_manager_->PersistUpdateCheckSuccessfullySent(*app_, 0));
-    }
-
-    // Validate the results.
-
-    // did_run is false so installation id should still exist.
-    CString iid;
-    EXPECT_SUCCEEDED(client_state_key.GetValue(kRegValueInstallationId, &iid));
-    EXPECT_STREQ(kIid1, iid);
-
-    // did_run is false so active ping timestamp should not be updated.
-    DWORD last_active_ping_day_start_sec = 0;
-    EXPECT_SUCCEEDED(client_state_key.GetValue(kRegValueActivePingDayStartSec,
-        &last_active_ping_day_start_sec));
-    EXPECT_EQ(last_active_time, last_active_ping_day_start_sec);
-
-    // Previous days_since_last_roll_call is 0 so that timestamp should
-    // not change.
-    DWORD last_roll_call_day_start_sec = 0;
-    EXPECT_SUCCEEDED(client_state_key.GetValue(kRegValueRollCallDayStartSec,
-        &last_roll_call_day_start_sec));
-    EXPECT_EQ(base_time, last_roll_call_day_start_sec);
-
-    // did_run is still not set.
-    CString did_run;
-    EXPECT_SUCCEEDED(client_state_key.GetValue(kRegValueDidRun, &did_run));
-    EXPECT_STREQ(_T("0"), did_run);
-
-    // Checks that members in app_ are not changed.
-    EXPECT_TRUE(expected_app->iid() == app_->iid());
-    EXPECT_EQ(expected_app->days_since_last_active_ping(),
-              app_->days_since_last_active_ping());
-    EXPECT_EQ(expected_app->days_since_last_roll_call(),
-              app_->days_since_last_roll_call());
-    EXPECT_EQ(expected_app->did_run(), app_->did_run());
-  }
-
-  void PersistUpdateCheckSuccessfullySent_NoPreviousPing() {
-    const CString client_state_key_name = AppendRegKeyPath(
-        ConfigManager::Instance()->registry_client_state(is_machine_),
-        kGuid1);
-    const int kDaysSinceLastActivePing = 2;
-
-    // Create the test data.
-    App* expected_app = CreateAppForRegistryPopulation(kGuid1);
-    expected_app->current_version()->set_version(_T("1.0.0.0"));
-    expected_app->iid_ = StringToGuid(kIid1);
-    expected_app->did_run_ = ACTIVE_UNKNOWN;
-    expected_app->set_days_since_last_active_ping(-1);
-    expected_app->set_days_since_last_roll_call(-1);
-    CreateAppRegistryState(*expected_app, is_machine_, _T(""), true);
-
-    __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-
-    __mutexBlock(app_->model()->lock()) {
-      EXPECT_SUCCEEDED(app_manager_->ReadAppPersistentData(app_));
-
-      // We only want to make sure the timestamps in the registry are updated
-      // and don't care about time_since_midnight_sec here, so just pass a 0 as
-      // the first parameter.
-      EXPECT_SUCCEEDED(
-          app_manager_->PersistUpdateCheckSuccessfullySent(*app_, 0));
-    }
-
-    // Validate the results.
-    RegKey client_state_key;
-    EXPECT_SUCCEEDED(client_state_key.Open(client_state_key_name));
-
-    // did_run is unknown so installation id should still exist.
-    CString iid;
-    EXPECT_SUCCEEDED(client_state_key.GetValue(kRegValueInstallationId, &iid));
-    EXPECT_STREQ(kIid1, iid);
-
-    const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-    // did_run is unknown so active ping timestamp should not be updated.
-    EXPECT_FALSE(client_state_key.HasValue(kRegValueActivePingDayStartSec));
-
-    DWORD last_roll_call_day_start_sec = 0;
-    EXPECT_SUCCEEDED(client_state_key.GetValue(kRegValueRollCallDayStartSec,
-        &last_roll_call_day_start_sec));
-    EXPECT_GE(now, last_roll_call_day_start_sec);
-    EXPECT_LE(now, last_roll_call_day_start_sec + kMaxTimeSinceMidnightSec);
-
-    // did_run is unknown.
-    CString did_run;
-    EXPECT_FALSE(client_state_key.HasValue(kRegValueDidRun));
-
-    // Checks that members in app_ are not changed.
-    EXPECT_TRUE(expected_app->iid() == app_->iid());
-    EXPECT_EQ(expected_app->days_since_last_active_ping(),
-              app_->days_since_last_active_ping());
-    EXPECT_EQ(expected_app->days_since_last_roll_call(),
-              app_->days_since_last_roll_call());
-    EXPECT_EQ(expected_app->did_run(), app_->did_run());
-  }
-
-  void SynchronizeClientStateTest(const CString& app_id) {
-    const CString client_state_key_name = AppendRegKeyPath(
-        ConfigManager::Instance()->registry_client_state(is_machine_),
-        app_id);
-
-    App* expected_app = CreateAppForRegistryPopulation(app_id);
-    PopulateExpectedApp1(expected_app);
-    expected_app->referral_id_ = _T("referrer");
-    EXPECT_SUCCEEDED(expected_app->put_isEulaAccepted(VARIANT_FALSE));
-    expected_app->install_time_diff_sec_ = 141516;
-    CreateAppRegistryState(*expected_app, is_machine_, _T(""), true);
-
-    EXPECT_TRUE(RegKey::HasValue(client_state_key_name, _T("referral")));
-
-    __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-
-    App* app = NULL;
-    EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(app_id), &app));
-    ASSERT_TRUE(app);
-
-    __mutexBlock(app_->model()->lock()) {
-      EXPECT_SUCCEEDED(app_manager_->ReadAppPersistentData(app));
-    }
-
-    EXPECT_TRUE(app->referral_id_.IsEmpty());
-
-    __mutexBlock(app_->model()->lock()) {
-      EXPECT_SUCCEEDED(app_manager_->SynchronizeClientState(app->app_guid()));
-    }
-
-    EXPECT_TRUE(app->referral_id_.IsEmpty());
-
-    const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-    EXPECT_TRUE(app->referral_id_.IsEmpty());
-
-    // Validate the results.
-    RegKey client_state_key;
-    EXPECT_SUCCEEDED(client_state_key.Open(client_state_key_name));
-
-    // Check version and language have been copied to client state.
-    EXPECT_STREQ(expected_app->current_version()->version(),
-                 GetSzValue(client_state_key_name, kRegValueProductVersion));
-    EXPECT_STREQ(expected_app->language_,
-                 GetSzValue(client_state_key_name, kRegValueLanguage));
-
-    // Check that ap, brand_code, and client_id, etc. are not changed.
-    EXPECT_STREQ(expected_app->ap_,
-                 GetSzValue(client_state_key_name, kRegValueAdditionalParams));
-    EXPECT_STREQ(expected_app->tt_token_,
-                 GetSzValue(client_state_key_name, kRegValueTTToken));
-    EXPECT_STREQ(expected_app->brand_code_,
-                 GetSzValue(client_state_key_name, kRegValueBrandCode));
-    EXPECT_STREQ(expected_app->client_id_,
-                 GetSzValue(client_state_key_name, kRegValueClientId));
-
-    // install_time_diff_sec should be roughly the same as now - installed.
-    const DWORD install_time =
-        GetDwordValue(client_state_key_name, kRegValueInstallTimeSec);
-    const DWORD calculated_install_diff = now - install_time;
-    EXPECT_GE(calculated_install_diff, expected_app->install_time_diff_sec_);
-    EXPECT_GE(static_cast<uint32>(500),
-              calculated_install_diff - expected_app->install_time_diff_sec_);
-
-    EXPECT_EQ(0, GetDwordValue(client_state_key_name, kRegValueEulaAccepted));
-    EXPECT_FALSE(expected_app->is_eula_accepted_);
-  }
-
-  void WritePreInstallDataTest(App* app, bool test_clearing_values) {
-    ASSERT1(is_machine_ == app->app_bundle()->is_machine());
-    const CString clients_key_name = AppendRegKeyPath(
-        ConfigManager::Instance()->registry_clients(is_machine_), kGuid1);
-    const CString client_state_key_name = AppendRegKeyPath(
-        ConfigManager::Instance()->registry_client_state(is_machine_),
-        kGuid1);
-
-    const bool expect_has_client_key = RegKey::HasKey(clients_key_name);
-
-    // Populate the test data.
-    app->brand_code_ = _T("GGLG");
-    app->client_id_ = _T("someclient");
-    app->referral_id_ = _T("referrer");
-    app->install_time_diff_sec_ = 657812;   // Not used.
-    app->usage_stats_enable_ = TRISTATE_TRUE;
-    app->browser_type_ = BROWSER_FIREFOX;
-    app->ap_ = _T("test_ap");
-    app->language_ = _T("en");
-
-    if (test_clearing_values) {
-      // Set values in registry and clear them in the app.
-      EXPECT_SUCCEEDED(RegKey::SetValue(
-                           kGuid1ClientsKeyPathUser,
-                           kRegValueBrowser,
-                           static_cast<DWORD>(app->browser_type())));
-      EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientsKeyPathUser,
-                                        kRegValueAdditionalParams,
-                                        app->ap()));
-
-      app->browser_type_ = BROWSER_UNKNOWN;
-      app->ap_.Empty();
-    }
-
-    __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-
-    EXPECT_SUCCEEDED(app_manager_->WritePreInstallData(*app));
-    const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-    // Validate the results.
-
-    // WritePreInstallData should never write to client_key, so it shouldn't
-    // exist if it did not before the function call.
-    EXPECT_EQ(expect_has_client_key, RegKey::HasKey(clients_key_name));
-
-    // ClientStateKey should exist.
-    RegKey client_state_key;
-    EXPECT_SUCCEEDED(client_state_key.Open(client_state_key_name));
-
-    ValidateClientStateMedium(is_machine_, kGuid1);
-
-    CString brand_code;
-    EXPECT_SUCCEEDED(client_state_key.GetValue(kRegValueBrandCode,
-                                               &brand_code));
-    EXPECT_STREQ(_T("GGLG"), brand_code);
-
-    CString client_id;
-    EXPECT_SUCCEEDED(client_state_key.GetValue(kRegValueClientId, &client_id));
-    EXPECT_STREQ(_T("someclient"), client_id);
-
-    CString referral_id;
-    EXPECT_SUCCEEDED(client_state_key.GetValue(kRegValueReferralId,
-                                               &referral_id));
-    EXPECT_STREQ(_T("referrer"), referral_id);
-
-    DWORD install_time(0);
-    EXPECT_SUCCEEDED(client_state_key.GetValue(kRegValueInstallTimeSec,
-                                               &install_time));
-    EXPECT_GE(now, install_time);
-    EXPECT_GE(static_cast<uint32>(200), now - install_time);
-
-    DWORD usage_stats_enable = 0;
-    EXPECT_SUCCEEDED(client_state_key.GetValue(_T("usagestats"),
-                                               &usage_stats_enable));
-    EXPECT_EQ(TRISTATE_TRUE, usage_stats_enable);
-
-    if (test_clearing_values) {
-      EXPECT_FALSE(client_state_key.HasValue(kRegValueBrowser));
-    } else {
-      DWORD browser_type = 0;
-      EXPECT_SUCCEEDED(client_state_key.GetValue(kRegValueBrowser,
-                                                 &browser_type));
-      EXPECT_EQ(BROWSER_FIREFOX, browser_type);
-    }
-
-    if (test_clearing_values) {
-      EXPECT_FALSE(client_state_key.HasValue(kRegValueAdditionalParams));
-    } else {
-      CString ap;
-      EXPECT_SUCCEEDED(client_state_key.GetValue(kRegValueAdditionalParams,
-                                                 &ap));
-      EXPECT_STREQ(_T("test_ap"), ap);
-    }
-
-    CString lang;
-    EXPECT_SUCCEEDED(client_state_key.GetValue(kRegValueLanguage, &lang));
-    EXPECT_STREQ(_T("en"), lang);
-
-    // Version should not be written to clientstate by WritePreInstallData().
-    EXPECT_FALSE(RegKey::HasValue(client_state_key_name,
-                                  kRegValueProductVersion));
-  }
-
-  static void ValidateClientStateMedium(bool is_machine,
-                                        const CString& app_guid) {
-    const CString client_state_medium_key_name = AppendRegKeyPath(
-        ConfigManager::Instance()->machine_registry_client_state_medium(),
-        app_guid);
-    if (is_machine) {
-      RegKey client_state_medium_key;
-      ASSERT_SUCCEEDED(
-          client_state_medium_key.Open(client_state_medium_key_name));
-      EXPECT_EQ(0, client_state_medium_key.GetValueCount());
-    } else {
-      EXPECT_FALSE(RegKey::HasKey(client_state_medium_key_name));
-      // There is no such thing as a user ClientStateMedium key.
-      const CString user_client_state_medium_key_name = AppendRegKeyPath(
-          USER_KEY GOOPDATE_REG_RELATIVE_CLIENT_STATE_MEDIUM,
-          app_guid);
-      EXPECT_FALSE(RegKey::HasKey(user_client_state_medium_key_name));
-      return;
-    }
-  }
-
-  // Uses SetupGoogleUpdate to create the ClientStateMedium key with the
-  // appropriate permissions. Used to test that the permissions are inherited.
-  void CreateClientStateMediumKey() {
-    SetupGoogleUpdate setup_google_update(true);
-
-    // On Windows 7, AddAllowedAce() can fail if the registry is redirected. So
-    // we ignore errors from this call.
-    setup_google_update.CreateClientStateMedium();
-  }
-
-  AppManager* app_manager_;
-  App* app_;
-  // A second bundle is necessary because the same bundle cannot have the same
-  // app in it more than once and many of these tests create an app to populate
-  // the registry and another to read it.
-  shared_ptr<AppBundle> dummy_app_bundle_for_app_creation_;
-
-  const GUID guid1_;
-
- private:
-  DISALLOW_IMPLICIT_CONSTRUCTORS(AppManagerTestBase);
-};
-
-// For most tests, the EULA should be accepted.
-class AppManagerMachineTest : public AppManagerTestBase {
- protected:
-  AppManagerMachineTest() : AppManagerTestBase(true) {}
-};
-
-class AppManagerUserTest : public AppManagerTestBase {
- protected:
-  AppManagerUserTest() : AppManagerTestBase(false) {}
-};
-
-// These fixtures are also used for ReadUninstalledAppPersistentData tests.
-class AppManagerReadAppPersistentDataMachineTest
-    : public AppManagerMachineTest {
-};
-
-class AppManagerReadAppPersistentDataUserTest
-    : public AppManagerUserTest {
-};
-
-class AppManagerWithBundleTest : public AppManagerTestBase {
- public:
-  explicit AppManagerWithBundleTest(bool is_machine)
-      : AppManagerTestBase(is_machine) {
-    // CoCreateInstance for registered hook CLSIDs returns ERROR_FILE_NOT_FOUND
-    // instead of REGDB_E_CLASSNOTREG without this WMI hack. This has to be done
-    // before the registry overriding that is done by the base class.
-    WmiQuery wmi_query;
-    EXPECT_SUCCEEDED(wmi_query.Connect(_T("root\\SecurityCenter")));
-  }
-
-  static void PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(
-    bool is_machine,
-    App* expected_app0,
-    App* expected_app1,
-    App* expected_app2,
-    App* opposite_hive_data1,
-    App* opposite_hive_data2);
-
- protected:
-
-  // Wrappers for static functions; simplifies callers using this test fixture.
-
-  void PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(
-      bool is_machine,
-      App** expected_app0,
-      App** expected_app1,
-      App** expected_app2) {
-    *expected_app0 = CreateAppForRegistryPopulation(kGuid1);
-    *expected_app1 = CreateAppForRegistryPopulation(kGuid2);
-    *expected_app2 = CreateAppForRegistryPopulation(kGuid3);
-    App* opposite_hive_data1 = CreateAppForRegistryPopulation(kGuid6);
-    App* opposite_hive_data2 = CreateAppForRegistryPopulation(kGuid7);
-    PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(
-        is_machine,
-        *expected_app0,
-        *expected_app1,
-        *expected_app2,
-        opposite_hive_data1,
-        opposite_hive_data2);
-  }
-
-  void PopulateForRegistrationUpdateHookTests(
-      bool is_machine,
-      App** expected_app0,
-      App** expected_app1,
-      App** expected_app2,
-      const CString& clsid_app0) {
-    PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(
-        is_machine,
-        expected_app0,
-        expected_app1,
-        expected_app2);
-
-    CString clients_key_name = AppendRegKeyPath(
-        ConfigManager::Instance()->registry_clients(is_machine),
-        (*expected_app0)->app_guid_string());
-    EXPECT_SUCCEEDED(RegKey::SetValue(clients_key_name,
-                                      kRegValueUpdateHookClsid,
-                                      clsid_app0));
-  }
-
- private:
-  DISALLOW_IMPLICIT_CONSTRUCTORS(AppManagerWithBundleTest);
-};
-
-class AppManagerWithBundleMachineTest : public AppManagerWithBundleTest {
- protected:
-  AppManagerWithBundleMachineTest() : AppManagerWithBundleTest(true) {}
-};
-
-class AppManagerWithBundleUserTest : public AppManagerWithBundleTest {
- protected:
-  AppManagerWithBundleUserTest() : AppManagerWithBundleTest(false) {}
-};
-
-class HoldAppManagerLock : public Runnable {
- public:
-  explicit HoldAppManagerLock(bool is_machine, const int period)
-      : period_(period) {
-    reset(lock_acquired_event_, ::CreateEvent(NULL, false, false, NULL));
-    reset(stop_event_, ::CreateEvent(NULL, false, false, NULL));
-
-    InitializeAppManagerRegistryLock(is_machine, &lock_);
-  }
-
-  virtual void Run() {
-    __mutexScope(lock_);
-
-    EXPECT_TRUE(::SetEvent(get(lock_acquired_event_)));
-
-    // TODO(omaha3): Could just use a sleep if we don't do more tests.
-    EXPECT_EQ(WAIT_TIMEOUT, ::WaitForSingleObject(get(stop_event_), period_));
-  }
-
-  void Stop() {
-    EXPECT_TRUE(::SetEvent(get(stop_event_)));
-  }
-
-  void WaitForLockToBeAcquired() {
-    EXPECT_EQ(WAIT_OBJECT_0,
-              ::WaitForSingleObject(get(lock_acquired_event_), 2000));
-  }
-
- private:
-  const int period_;
-  GLock lock_;
-  scoped_event lock_acquired_event_;
-  scoped_event stop_event_;
-
-  DISALLOW_IMPLICIT_CONSTRUCTORS(HoldAppManagerLock);
-};
-
-// Provide access to the member functions for other tests without requiring them
-// to know about the test fixture class.
-
-void PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(
-    bool is_machine,
-    App* expected_app0,
-    App* expected_app1,
-    App* expected_app2,
-    App* opposite_hive_data1,
-    App* opposite_hive_data2) {
-  AppManagerWithBundleTest::
-      PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(
-      is_machine,
-      expected_app0,
-      expected_app1,
-      expected_app2,
-      opposite_hive_data1,
-      opposite_hive_data2);
-}
-
-void SetDisplayName(const CString& name, App* app) {
-  AppManagerTestBase::SetDisplayName(name, app);
-}
-
-// TODO(omaha3): Maybe use this to test the similar code in install_apps.cc.
-#if 0
-TEST_F(AppManagerTest, ConvertCommandLineToProductData_Succeeds) {
-  CommandLineAppArgs extra1;
-  extra1.app_guid = guid1_;
-  extra1.app_name = _T("foo");
-  extra1.needs_admin = false;
-  extra1.ap = _T("Test ap");
-  extra1.tt_token = _T("Test TT Token");
-  extra1.encoded_installer_data = _T("%20foobar");
-  extra1.install_data_index = _T("foobar");
-
-  CommandLineAppArgs extra2;
-  extra2.app_guid = StringToGuid(kGuid2);
-  extra2.app_name = _T("bar");
-  extra2.needs_admin = true;    // This gets ignored.
-  extra2.ap = _T("beta");
-  extra2.tt_token = _T("beta TT Token");
-
-  CommandLineAppArgs extra3;
-  extra3.app_guid = StringToGuid(kGuid3);
-  extra3.app_name = _T("bar");
-  extra3.needs_admin = true;    // This gets ignored.
-  extra3.ap = _T("beta");
-  extra3.tt_token = _T("beta TT Token");
-
-  CommandLineArgs args;
-  args.is_interactive_set = true;  // Not used.
-  args.is_machine_set = true;  // Not used.
-  args.is_crash_handler_disabled = true;  // Not used.
-  args.is_eula_required_set = true;
-  args.is_eula_required_set = true;  // Not used.
-  args.webplugin_urldomain = _T("http://nothing.google.com");  // Not used.
-  args.webplugin_args = _T("blah");  // Not used.
-  args.install_source = _T("one_click");
-  args.code_red_metainstaller_path = _T("foo.exe");  // Not used.
-  args.legacy_manifest_path = _T("bar.exe");  // Not used.
-  args.crash_filename = _T("foo.dmp");  // Not used.
-  args.extra.installation_id = StringToGuid(kIid1);
-  args.extra.brand_code = _T("GOOG");
-  args.extra.client_id = _T("someclient");
-  args.extra.experiment = _T("exp1");
-  args.extra.referral_id = _T("referrer1");
-  args.extra.browser_type = BROWSER_IE;
-  args.extra.language = _T("abc");
-  args.extra.usage_stats_enable = TRISTATE_TRUE;
-  args.extra.apps.push_back(extra1);
-  args.extra.apps.push_back(extra2);
-  args.extra.apps.push_back(extra3);
-
-  AppData* expected_data1 = CreateAppData();
-  PopulateExpectedAppData1(guid1_, false, &expected_data1);
-  expected_data1.set_version(_T(""));  // Clear value.
-  expected_data1.set_previous_version(_T(""));  // Clear value.
-  expected_data1.set_did_run(ACTIVE_UNKNOWN);  // Clear value.
-  expected_data1.set_display_name(_T("foo"));
-  expected_data1.set_browser_type(BROWSER_IE);
-  expected_data1.set_install_source(_T("one_click"));
-  expected_data1.set_encoded_installer_data(_T("%20foobar"));
-  expected_data1.set_install_data_index(_T("foobar"));
-  expected_data1.set_usage_stats_enable(TRISTATE_TRUE);
-  expected_data1.set_referral_id(_T("referrer1"));
-  expected_data1.set_install_time_diff_sec(
-      static_cast<uint32>(-1 * kSecondsPerDay));  // New install.
-  expected_data1.set_is_eula_accepted(false);
-  expected_data1.set_days_since_last_active_ping(0);
-  expected_data1.set_days_since_last_roll_call(0);
-
-  AppData* expected_data2 = CreateAppData();
-
-  // Make the first app appear to already be installed but without an
-  // InstallTime. This affects install_time_diff_sec.
-  expected_data2.set_version(_T("4.5.6.7"));
-  CreateAppRegistryState(expected_data2);
-
-  PopulateExpectedAppData2(StringToGuid(kGuid2), false, &expected_data2);
-
-  expected_data2.set_version(_T(""));  // Clear value.
-  expected_data2.set_previous_version(_T(""));  // Clear value.
-  expected_data2.set_did_run(ACTIVE_UNKNOWN);  // Clear value.
-  expected_data2.set_language(_T("abc"));
-  expected_data2.set_display_name(_T("bar"));
-  expected_data2.set_browser_type(BROWSER_IE);
-  expected_data2.set_install_source(_T("one_click"));
-  expected_data2.set_usage_stats_enable(TRISTATE_TRUE);
-  // Override unique expected data because the args apply to all apps.
-  expected_data2.set_iid(StringToGuid(kIid1));
-  expected_data2.set_brand_code(_T("GOOG"));
-  expected_data2.set_client_id(_T("someclient"));
-  expected_data2.set_experiment(_T("exp1"));
-  expected_data2.set_referral_id(_T("referrer1"));
-  expected_data2.set_install_time_diff_sec(0);  // InstallTime is unknown.
-  expected_data2.set_is_eula_accepted(false);
-  expected_data2.set_days_since_last_active_ping(0);
-  expected_data2.set_days_since_last_roll_call(0);
-
-  AppData expected_data3(StringToGuid(kGuid3), false);
-
-  // Make the first app appear to already be installed with a valid InstallTime.
-  // This affects install_time_diff_sec.
-  expected_data3.set_version(_T("4.5.6.7"));
-  expected_data3.set_install_time_diff_sec(123456);  // Known original time.
-  CreateAppRegistryState(expected_data3);
-
-  PopulateExpectedAppData2(&expected_data3);
-  expected_data3.set_version(_T(""));  // Clear value.
-  expected_data3.set_previous_version(_T(""));  // Clear value.
-  expected_data3.set_did_run(AppData::ACTIVE_UNKNOWN);  // Clear value.
-  expected_data3.set_language(_T("abc"));
-  expected_data3.set_display_name(_T("bar"));
-  expected_data3.set_browser_type(BROWSER_IE);
-  expected_data3.set_install_source(_T("one_click"));
-  expected_data3.set_usage_stats_enable(TRISTATE_TRUE);
-  // Override unique expected data because the args apply to all apps.
-  expected_data3.set_iid(StringToGuid(kIid1));
-  expected_data3.set_brand_code(_T("GOOG"));
-  expected_data3.set_client_id(_T("someclient"));
-  expected_data3.set_referral_id(_T("referrer1"));
-  expected_data3.set_is_eula_accepted(false);
-  expected_data3.set_days_since_last_active_ping(0);
-  expected_data3.set_days_since_last_roll_call(0);
-
-  ProductDataVector products;
-  AppManager app_manager(false);
-  app_manager.ConvertCommandLineToProductData(args, &products);
-
-  ASSERT_EQ(3, products.size());
-  EXPECT_EQ(0, products[0].num_components());
-  EXPECT_EQ(0, products[1].num_components());
-  EXPECT_EQ(0, products[2].num_components());
-  ValidateExpectedValues(expected_data1, products[0].app_data());
-  ValidateExpectedValues(expected_data2, products[1].app_data());
-
-  // install_time_diff_sec may be off by a second or so.
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-  EXPECT_GE(products[2].app_data().install_time_diff_sec(),
-            expected_data3.install_time_diff_sec());
-  EXPECT_GE(static_cast<uint32>(500),
-            products[2].app_data().install_time_diff_sec() -
-            expected_data3.install_time_diff_sec());
-  // Fix up expected_data3 or it might fail verification.
-  expected_data3.set_install_time_diff_sec(
-      products[2].app_data().install_time_diff_sec());
-
-  ValidateExpectedValues(expected_data3, products[2].app_data());
-}
-#endif
-
-TEST_F(AppManagerMachineTest, WritePreInstallData) {
-  SetAppGuid(kGuid1, app_);
-  EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_TRUE));
-  WritePreInstallDataTest(app_, false);
-
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathMachine,
-                                _T("oeminstall")));
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathMachine,
-                                _T("eulaaccepted")));
-}
-
-TEST_F(AppManagerMachineTest, WritePreInstallData_IsOem) {
-  const DWORD now = Time64ToInt32(GetCurrent100NSTime());
-  ASSERT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("OemInstallTime"),
-                                    now));
-  if (vista_util::IsVistaOrLater()) {
-    ASSERT_SUCCEEDED(RegKey::SetValue(
-        _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State"),
-        _T("ImageState"),
-        _T("IMAGE_STATE_UNDEPLOYABLE")));
-  } else {
-    ASSERT_SUCCEEDED(RegKey::SetValue(_T("HKLM\\System\\Setup"),
-                                      _T("AuditInProgress"),
-                                      static_cast<DWORD>(1)));
-  }
-
-  SetAppGuid(kGuid1, app_);
-  EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_TRUE));
-  WritePreInstallDataTest(app_, false);
-
-  CString oeminstall;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kGuid1ClientStateKeyPathMachine,
-                                    _T("oeminstall"),
-                                    &oeminstall));
-  EXPECT_STREQ(_T("1"), oeminstall);
-
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathMachine,
-                                _T("eulaaccepted")));
-}
-
-// Creates the ClientStateMedium key with the appropriate permissions then
-// verifies that the created app subkey inherits those.
-// The Update key must be created first to avoid applying ClientStateMedium's
-// permissions to all its parent keys.
-// This keys in this test need to inherit the HKLM privileges, so put the
-// override root in HKLM.
-TEST_F(AppManagerMachineTest,
-       WritePreInstallData_CheckClientStateMediumPermissions) {
-  const TCHAR kRegistryHiveOverrideRootInHklm[] =
-      _T("HKLM\\Software\\") SHORT_COMPANY_NAME
-      _T("\\") PRODUCT_NAME _T("\\UnitTest\\");
-  RestoreRegistryHives();
-  hive_override_key_name_ = kRegistryHiveOverrideRootInHklm;
-  RegKey::DeleteKey(hive_override_key_name_);
-  OverrideRegistryHives(hive_override_key_name_);
-
-  EXPECT_SUCCEEDED(RegKey::CreateKey(
-      ConfigManager::Instance()->machine_registry_update()));
-  CreateClientStateMediumKey();
-
-  SetAppGuid(kGuid1, app_);
-  EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_TRUE));
-  WritePreInstallDataTest(app_, false);
-
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathMachine,
-                                _T("oeminstall")));
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathMachine,
-                                _T("eulaaccepted")));
-
-  const CString app_client_state_medium_key_name = AppendRegKeyPath(
-      _T("HKLM\\Software\\") SHORT_COMPANY_NAME
-      _T("\\") PRODUCT_NAME _T("\\ClientStateMedium\\"),
-      kGuid1);
-  VerifyHklmKeyHasMediumIntegrity(app_client_state_medium_key_name);
-  VerifyHklmKeyHasDefaultIntegrity(
-      _T("HKLM\\Software\\") SHORT_COMPANY_NAME
-      _T("\\") PRODUCT_NAME _T("\\ClientStateMedium\\"));
-}
-
-TEST_F(AppManagerMachineTest,
-       WritePreInstallData_ClearClientStateMediumUsageStats) {
-  const CString client_state_key_name =
-      AppendRegKeyPath(MACHINE_REG_CLIENT_STATE_MEDIUM, kGuid1);
-  EXPECT_SUCCEEDED(RegKey::SetValue(client_state_key_name,
-                                    _T("usagestats"),
-                                    static_cast<DWORD>(1)));
-
-  SetAppGuid(kGuid1, app_);
-  WritePreInstallDataTest(app_, false);
-
-  EXPECT_FALSE(RegKey::HasValue(client_state_key_name, _T("usagestats")));
-}
-
-// Tests the EULA accepted case too.
-TEST_F(AppManagerUserTest, WritePreInstallData) {
-  SetAppGuid(kGuid1, app_);
-  EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_TRUE));
-  WritePreInstallDataTest(app_, false);
-
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                _T("oeminstall")));
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                _T("eulaaccepted")));
-}
-
-TEST_F(AppManagerUserTest,
-       WritePreInstallData_EulaNotAcceptedAppNotRegistered) {
-  SetAppGuid(kGuid1, app_);
-  EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_FALSE));
-
-  WritePreInstallDataTest(app_, false);
-
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                _T("oeminstall")));
-
-  DWORD eula_accepted = 99;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kGuid1ClientStateKeyPathUser,
-                                    _T("eulaaccepted"),
-                                    &eula_accepted));
-  EXPECT_EQ(0, eula_accepted);
-}
-
-TEST_F(AppManagerUserTest,
-       WritePreInstallData_EulaNotAcceptedAppAlreadyInstalled) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientsKeyPathUser,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-
-  SetAppGuid(kGuid1, app_);
-  EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_FALSE));
-
-  WritePreInstallDataTest(app_, false);
-
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                _T("oeminstall")));
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                _T("eulaaccepted")));
-}
-
-TEST_F(AppManagerUserTest,
-       WritePreInstallData_EulaAcceptedAppAlreadyInstalled) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientsKeyPathUser,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-
-  SetAppGuid(kGuid1, app_);
-  EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_TRUE));
-
-  WritePreInstallDataTest(app_, false);
-
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                _T("oeminstall")));
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                _T("eulaaccepted")));
-}
-
-TEST_F(AppManagerUserTest,
-       WritePreInstallData_EulaAcceptedAppAlreadyInstalledAccepted) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientsKeyPathUser,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientStateKeyPathUser,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-
-  SetAppGuid(kGuid1, app_);
-  EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_TRUE));
-
-  WritePreInstallDataTest(app_, false);
-
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                _T("oeminstall")));
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                _T("eulaaccepted")));
-}
-
-TEST_F(AppManagerUserTest,
-       WritePreInstallData_EulaAcceptedAppAlreadyInstalledNotAccepted) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientsKeyPathUser,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientStateKeyPathUser,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-
-  SetAppGuid(kGuid1, app_);
-  EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_TRUE));
-
-  WritePreInstallDataTest(app_, false);
-
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                _T("oeminstall")));
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                _T("eulaaccepted")));
-}
-
-TEST_F(AppManagerReadAppPersistentDataMachineTest, NoApp) {
-  __mutexScope(app_->model()->lock());
-  EXPECT_FAILED(app_manager_->ReadAppPersistentData(app_));
-}
-
-// For new app, the install_time_diff_sec_ should be -1 day.
-TEST_F(AppManagerMachineTest, ReadAppInstallTimeDiff_NewApp) {
-  __mutexScope(app_->model()->lock());
-  app_manager_->ReadAppInstallTimeDiff(app_);
-  EXPECT_EQ(kInitialInstallTimeDiff, app_->install_time_diff_sec());
-}
-
-TEST_F(AppManagerUserTest, ReadAppInstallTimeDiff_NewApp) {
-  __mutexScope(app_->model()->lock());
-  app_manager_->ReadAppInstallTimeDiff(app_);
-  EXPECT_EQ(kInitialInstallTimeDiff, app_->install_time_diff_sec());
-}
-
-// For registered app, the install_time_diff_sec_ should be 0 if InstallTime
-// registry value does not exist.
-TEST_F(AppManagerMachineTest, ReadAppInstallTimeDiff_RegisteredApp) {
-  App* new_app = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedApp1(new_app);
-  CreateAppRegistryState(*new_app, is_machine_, _T("1.0.0.0"), true);
-
-  __mutexScope(app_->model()->lock());
-  app_manager_->ReadAppInstallTimeDiff(app_);
-  EXPECT_EQ(0, app_->install_time_diff_sec());
-}
-
-// For over-install app, the app is already registered. So
-// install_time_diff_sec_ will be read from InstallTime registry value if
-// exists. Otherwise it should be 0 as verified by the previous test case.
-TEST_F(AppManagerUserTest, ReadAppInstallTimeDiff_OverInstall) {
-  const uint32 kInstallTimeDiffSec = 100000;
-  App* over_install_app = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedApp1(over_install_app);
-  SetAppInstallTimeDiffSec(over_install_app, kInstallTimeDiffSec);
-  CreateAppRegistryState(*over_install_app, is_machine_, _T("1.1.1.1"), true);
-
-  __mutexScope(app_->model()->lock());
-  app_manager_->ReadAppInstallTimeDiff(app_);
-  EXPECT_GE(app_->install_time_diff_sec(), kInstallTimeDiffSec);
-  EXPECT_LE(app_->install_time_diff_sec(), kInstallTimeDiffSec + 1);
-}
-
-// For uninstalled app, the install_time_diff_sec_ will be read from registry
-// if InstallTime registry value exists.
-TEST_F(AppManagerMachineTest, ReadAppInstallTimeDiff_UninstalledApp) {
-  const uint32 kInstallTimeDiffSec = 123456;
-  App* uninstalled_app = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedUninstalledApp(_T("1.1.0.0"), uninstalled_app);
-  SetAppInstallTimeDiffSec(uninstalled_app, kInstallTimeDiffSec);
-  CreateAppRegistryState(*uninstalled_app, is_machine_, _T("1.1.0.0"), false);
-
-  __mutexScope(app_->model()->lock());
-  app_manager_->ReadAppInstallTimeDiff(app_);
-  EXPECT_GE(app_->install_time_diff_sec(), kInstallTimeDiffSec);
-  EXPECT_LE(app_->install_time_diff_sec(), kInstallTimeDiffSec + 1);
-}
-
-// A special case. If pv of the uninstalled app doesn't exist, then it is
-// considered not in uninstalled status. InstallTime should be ignored.
-TEST_F(AppManagerUserTest, ReadAppInstallTimeDiff_UninstalledAppWithoutPv) {
-  const uint32 kInstallTimeDiffSec = 112233;
-  App* uninstalled_app = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedUninstalledApp(_T("1.1.0.0"), uninstalled_app);
-  SetAppInstallTimeDiffSec(uninstalled_app, kInstallTimeDiffSec);
-  CreateAppRegistryState(*uninstalled_app, is_machine_, _T(""), false);
-
-  __mutexScope(app_->model()->lock());
-  app_manager_->ReadAppInstallTimeDiff(app_);
-  EXPECT_EQ(kInitialInstallTimeDiff, app_->install_time_diff_sec());
-}
-
-// Tests clearing of data that is already present when not present in app_.
-TEST_F(AppManagerUserTest,
-       WritePreInstallData_AppAlreadyInstalled_ClearExistingData) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientsKeyPathUser,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-
-  SetAppGuid(kGuid1, app_);
-
-  WritePreInstallDataTest(app_, true);
-
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                kRegValueBrowser));
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                kRegValueAdditionalParams));
-}
-
-// Tests clearing of data that is already present when not present in app_.
-TEST_F(AppManagerUserTest,
-       WritePreInstallData_AppAlreadyInstalled_OverwriteExistingData) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientsKeyPathUser,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientsKeyPathUser,
-                                    kRegValueBrowser,
-                                    static_cast<DWORD>(BROWSER_CHROME)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientsKeyPathUser,
-                                    kRegValueAdditionalParams,
-                                    _T("existingAP")));
-
-  SetAppGuid(kGuid1, app_);
-
-  WritePreInstallDataTest(app_, false);
-
-  EXPECT_EQ(BROWSER_FIREFOX, GetDwordValue(kGuid1ClientStateKeyPathUser,
-                                           kRegValueBrowser));
-  EXPECT_EQ(_T("test_ap"), GetSzValue(kGuid1ClientStateKeyPathUser,
-                                      kRegValueAdditionalParams));
-}
-
-// It is important that previous_version passed to CreateAppRegistryState() be
-// different than the current_version in PopulateExpectedApp1() to ensure the
-// version is populated from Clients and not ClientState.
-TEST_F(AppManagerReadAppPersistentDataUserTest, AppExists) {
-  App* expected_app = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedApp1(expected_app);
-  CreateAppRegistryState(*expected_app, is_machine_, _T("1.0.0.0"), true);
-
-  __mutexScope(app_->model()->lock());
-  EXPECT_SUCCEEDED(app_manager_->ReadAppPersistentData(app_));
-
-  EXPECT_SUCCEEDED(expected_app->put_isEulaAccepted(VARIANT_TRUE));
-  ValidateExpectedValues(*expected_app, *app_);
-}
-
-TEST_F(AppManagerReadAppPersistentDataMachineTest, AppExists) {
-  App* expected_app = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedApp1(expected_app);
-  CreateAppRegistryState(*expected_app, is_machine_, _T("1.0.0.0"), true);
-
-  __mutexScope(app_->model()->lock());
-  EXPECT_SUCCEEDED(app_manager_->ReadAppPersistentData(app_));
-
-  EXPECT_SUCCEEDED(expected_app->put_isEulaAccepted(VARIANT_TRUE));
-  ValidateExpectedValues(*expected_app, *app_);
-}
-
-TEST_F(AppManagerReadAppPersistentDataUserTest, AppExists_NoDisplayName) {
-  App* expected_app = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedApp1(expected_app);
-  SetDisplayName(_T(""), expected_app);
-  CreateAppRegistryState(*expected_app, is_machine_, _T("1.0.0.0"), true);
-
-  __mutexScope(app_->model()->lock());
-  EXPECT_SUCCEEDED(app_manager_->ReadAppPersistentData(app_));
-
-  SetDisplayName(kDefaultAppName, expected_app);
-
-  EXPECT_SUCCEEDED(expected_app->put_isEulaAccepted(VARIANT_TRUE));
-  ValidateExpectedValues(*expected_app, *app_);
-}
-
-TEST_F(AppManagerReadAppPersistentDataUserTest, AppExists_EmptyDisplayName) {
-  App* expected_app = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedApp1(expected_app);
-  CreateAppRegistryState(*expected_app, is_machine_, _T("1.0.0.0"), true);
-  EXPECT_SUCCEEDED(RegKey::SetValue(GetClientKeyName(guid1_),
-                                    kRegValueAppName,
-                                    _T("")));
-
-  __mutexScope(app_->model()->lock());
-  EXPECT_SUCCEEDED(app_manager_->ReadAppPersistentData(app_));
-
-  SetDisplayName(kDefaultAppName, expected_app);
-  EXPECT_SUCCEEDED(expected_app->put_isEulaAccepted(VARIANT_TRUE));
-  ValidateExpectedValues(*expected_app, *app_);
-}
-
-TEST_F(AppManagerReadAppPersistentDataUserTest, EulaNotAccepted) {
-  App* expected_app = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedApp1(expected_app);
-  CreateAppRegistryState(*expected_app, is_machine_, _T("1.0.0.0"), true);
-
-  // TODO(omaha): We should be able to eliminate the SetValue calls in
-  // AppManagerReadAppPersistentData* by moving put_isEulaAccepted() call above
-  // CreateAppRegistryState().
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientStateKeyPathUser,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(expected_app->put_isEulaAccepted(VARIANT_FALSE));
-
-  __mutexScope(app_->model()->lock());
-  EXPECT_SUCCEEDED(app_manager_->ReadAppPersistentData(app_));
-
-  ValidateExpectedValues(*expected_app, *app_);
-}
-
-TEST_F(AppManagerReadAppPersistentDataUserTest, EulaAccepted) {
-  App* expected_app = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedApp1(expected_app);
-  CreateAppRegistryState(*expected_app, is_machine_, _T("1.0.0.0"), true);
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientStateKeyPathUser,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(expected_app->put_isEulaAccepted(VARIANT_TRUE));
-
-  __mutexScope(app_->model()->lock());
-  EXPECT_SUCCEEDED(app_manager_->ReadAppPersistentData(app_));
-
-  ValidateExpectedValues(*expected_app, *app_);
-}
-
-TEST_F(AppManagerReadAppPersistentDataMachineTest, EulaNotAccepted) {
-  App* expected_app = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedApp1(expected_app);
-  CreateAppRegistryState(*expected_app, is_machine_, _T("1.0.0.0"), true);
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientStateKeyPathMachine,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(expected_app->put_isEulaAccepted(VARIANT_FALSE));
-
-  __mutexScope(app_->model()->lock());
-  EXPECT_SUCCEEDED(app_manager_->ReadAppPersistentData(app_));
-
-  ValidateExpectedValues(*expected_app, *app_);
-}
-
-TEST_F(AppManagerReadAppPersistentDataMachineTest, EulaAccepted) {
-  App* expected_app = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedApp1(expected_app);
-  CreateAppRegistryState(*expected_app, is_machine_, _T("1.0.0.0"), true);
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientStateKeyPathMachine,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(expected_app->put_isEulaAccepted(VARIANT_TRUE));
-
-  __mutexScope(app_->model()->lock());
-  EXPECT_SUCCEEDED(app_manager_->ReadAppPersistentData(app_));
-
-  ValidateExpectedValues(*expected_app, *app_);
-}
-
-TEST_F(AppManagerReadAppPersistentDataUserTest, TwoApps) {
-  App* app2 = NULL;
-  EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid2), &app2));
-  ASSERT_TRUE(app2);
-
-  App* expected_app1 = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedApp1(expected_app1);
-  CreateAppRegistryState(*expected_app1, is_machine_, _T("1.0.0.0"), true);
-
-  App* expected_app2 = CreateAppForRegistryPopulation(kGuid2);
-  PopulateExpectedApp1(expected_app2);
-  CreateAppRegistryState(*expected_app2, is_machine_, _T("1.0.0.0"), true);
-
-  __mutexScope(app_->model()->lock());
-
-  EXPECT_SUCCEEDED(app_manager_->ReadAppPersistentData(app_));
-  EXPECT_SUCCEEDED(expected_app1->put_isEulaAccepted(VARIANT_TRUE));
-  ValidateExpectedValues(*expected_app1, *app_);
-
-  EXPECT_SUCCEEDED(app_manager_->ReadAppPersistentData(app2));
-  EXPECT_SUCCEEDED(expected_app2->put_isEulaAccepted(VARIANT_TRUE));
-  ValidateExpectedValues(*expected_app2, *app2);
-}
-
-TEST_F(AppManagerReadAppPersistentDataUserTest, NoClientState) {
-  App* expected_app = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedApp1ClientsOnly(expected_app);
-  CreateAppRegistryState(*expected_app, is_machine_, _T("1.0.0.0"), true);
-
-  // CreateAppRegistryState always creates the ClientState key, so delete it.
-  EXPECT_SUCCEEDED(RegKey::DeleteKey(kGuid1ClientStateKeyPathUser));
-
-  EXPECT_FALSE(IsClientStateKeyPresent(*app_));
-
-  __mutexScope(app_->model()->lock());
-  EXPECT_SUCCEEDED(app_manager_->ReadAppPersistentData(app_));
-
-  EXPECT_SUCCEEDED(expected_app->put_isEulaAccepted(VARIANT_TRUE));
-  ValidateExpectedValues(*expected_app, *app_);
-}
-
-// This is the No Clients key case.
-TEST_F(AppManagerReadAppPersistentDataUserTest,
-       ReadUninstalledAppPersistentData_UninstalledApp) {
-  App* expected_app = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedUninstalledApp(_T("1.1.0.0"), expected_app);
-  CreateAppRegistryState(*expected_app, is_machine_, _T("1.1.0.0"), false);
-
-  __mutexScope(app_->model()->lock());
-  EXPECT_SUCCEEDED(app_manager_->ReadUninstalledAppPersistentData(app_));
-
-  SetDisplayName(kDefaultAppName, expected_app);
-  EXPECT_SUCCEEDED(expected_app->put_isEulaAccepted(VARIANT_TRUE));
-  ValidateExpectedValues(*expected_app, *app_);
-
-  // Explicitly verify the absence of a Clients key and the version since these
-  // are important to this test.
-  EXPECT_FALSE(RegKey::HasKey(
-      AppendRegKeyPath(ConfigManager::Instance()->registry_clients(is_machine_),
-      kGuid1)));
-  EXPECT_STREQ(_T("1.1.0.0"), expected_app->current_version()->version());
-
-  // Verify that ReadAppPersistentData does not populate the version.
-  app_->current_version()->set_version(_T(""));
-  expected_app->current_version()->set_version(_T(""));
-  EXPECT_SUCCEEDED(app_manager_->ReadAppPersistentData(app_));
-  SetDisplayName(kDefaultAppName, expected_app);
-  ValidateExpectedValues(*expected_app, *app_);
-  EXPECT_TRUE(expected_app->current_version()->version().IsEmpty());
-}
-
-TEST_F(AppManagerReadAppPersistentDataMachineTest,
-       ReadUninstalledAppPersistentData_UninstalledApp) {
-  App* expected_app = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedUninstalledApp(_T("1.1.0.0"), expected_app);
-  EXPECT_SUCCEEDED(expected_app->put_isEulaAccepted(VARIANT_TRUE));
-  CreateAppRegistryState(*expected_app, is_machine_, _T("1.1.0.0"), false);
-
-  __mutexScope(app_->model()->lock());
-  EXPECT_SUCCEEDED(app_manager_->ReadUninstalledAppPersistentData(app_));
-
-  SetDisplayName(kDefaultAppName, expected_app);
-  ValidateExpectedValues(*expected_app, *app_);
-
-  // Explicitly verify the absence of a Clients key and the version since these
-  // are important to this test.
-  EXPECT_FALSE(RegKey::HasKey(
-      AppendRegKeyPath(ConfigManager::Instance()->registry_clients(is_machine_),
-      kGuid1)));
-  EXPECT_STREQ(_T("1.1.0.0"), expected_app->current_version()->version());
-
-  // Verify that ReadAppPersistentData does not populate the version.
-  app_->current_version()->set_version(_T(""));
-  expected_app->current_version()->set_version(_T(""));
-  EXPECT_SUCCEEDED(app_manager_->ReadAppPersistentData(app_));
-  SetDisplayName(kDefaultAppName, expected_app);
-  ValidateExpectedValues(*expected_app, *app_);
-  EXPECT_TRUE(expected_app->current_version()->version().IsEmpty());
-}
-
-TEST_F(AppManagerReadAppPersistentDataUserTest,
-       ReadUninstalledAppPersistentData_EulaNotAccepted) {
-  App* expected_app = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedUninstalledApp(_T("1.1.0.0"), expected_app);
-  EXPECT_SUCCEEDED(expected_app->put_isEulaAccepted(VARIANT_FALSE));
-  CreateAppRegistryState(*expected_app, is_machine_, _T("1.1.0.0"), false);
-
-  __mutexScope(app_->model()->lock());
-  EXPECT_SUCCEEDED(app_manager_->ReadUninstalledAppPersistentData(app_));
-
-  SetDisplayName(kDefaultAppName, expected_app);
-  ValidateExpectedValues(*expected_app, *app_);
-}
-
-// Tests the case where Omaha has created the Client State key before running
-// the installer. Uses PopulateExpectedUninstalledApp then clears pv before
-// writing the data to the registry. is_uninstalled_ is not set to false until
-// after CreateAppRegistryState to prevent Client key from being created.
-TEST_F(AppManagerReadAppPersistentDataUserTest,
-       ClientStateExistsWithoutPvOrClientsKey) {
-  App* expected_app = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedUninstalledApp(_T(""), expected_app);
-  CreateAppRegistryState(*expected_app, is_machine_, _T(""), false);
-
-  // Update expected_app->install_time_diff_sec_ value here since related
-  // registry values have been changed. app_ will be created based on the
-  // new registry status so to make the objects match, reloading here is
-  // necessary.
-  app_manager_->ReadAppInstallTimeDiff(expected_app);
-
-  __mutexScope(app_->model()->lock());
-  EXPECT_SUCCEEDED(app_manager_->ReadAppPersistentData(app_));
-
-  SetDisplayName(kDefaultAppName, expected_app);
-  EXPECT_SUCCEEDED(expected_app->put_isEulaAccepted(VARIANT_TRUE));
-  ValidateExpectedValues(*expected_app, *app_);
-}
-
-TEST_F(AppManagerReadAppPersistentDataMachineTest,
-       ClientStateExistsWithoutPvOrClientsKey) {
-  App* expected_app = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedUninstalledApp(_T(""), expected_app);
-  CreateAppRegistryState(*expected_app, is_machine_, _T(""), false);
-
-  // Update expected_app->install_time_diff_sec_ value here since related
-  // registry values have been changed. app_ will be created based on the
-  // new registry status so to make the objects match, reloading here is
-  // necessary.
-  app_manager_->ReadAppInstallTimeDiff(expected_app);
-
-  __mutexScope(app_->model()->lock());
-  EXPECT_SUCCEEDED(app_manager_->ReadAppPersistentData(app_));
-
-  SetDisplayName(kDefaultAppName, expected_app);
-  EXPECT_SUCCEEDED(expected_app->put_isEulaAccepted(VARIANT_TRUE));
-  ValidateExpectedValues(*expected_app, *app_);
-}
-
-// An empty pv value is the same as a populated one for uninstall checks.
-TEST_F(AppManagerReadAppPersistentDataUserTest,
-       ClientStateExistsWithEmptyPvNoClientsKey) {
-  App* expected_app = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedUninstalledApp(_T(""), expected_app);
-  CreateAppRegistryState(*expected_app, is_machine_, _T(""), false);
-
-  // Write the empty pv value.
-  CString client_state_key_name = AppendRegKeyPath(
-      ConfigManager::Instance()->registry_client_state(false),
-      kGuid1);
-  EXPECT_SUCCEEDED(RegKey::SetValue(client_state_key_name,
-                                     kRegValueProductVersion,
-                                     _T("")));
-
-  __mutexScope(app_->model()->lock());
-  EXPECT_SUCCEEDED(app_manager_->ReadAppPersistentData(app_));
-
-  SetDisplayName(kDefaultAppName, expected_app);
-  EXPECT_SUCCEEDED(expected_app->put_isEulaAccepted(VARIANT_TRUE));
-  ValidateExpectedValues(*expected_app, *app_);
-}
-
-TEST_F(AppManagerUserTest,
-       ReadInstallerRegistrationValues_FailsWhenClientsKeyAbsent) {
-  __mutexBlock(app_->model()->lock()) {
-    EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_DID_NOT_WRITE_CLIENTS_KEY,
-              app_manager_->ReadInstallerRegistrationValues(app_));
-  }
-
-  EXPECT_TRUE(app_->next_version()->version().IsEmpty());
-  EXPECT_TRUE(app_->language().IsEmpty());
-
-  EXPECT_FALSE(RegKey::HasKey(kGuid1ClientsKeyPathUser));
-  EXPECT_FALSE(RegKey::HasKey(kGuid1ClientStateKeyPathUser));
-}
-
-TEST_F(AppManagerUserTest,
-       ReadInstallerRegistrationValues_FailsWhenVersionValueAbsent) {
-  ASSERT_SUCCEEDED(RegKey::CreateKey(kGuid1ClientsKeyPathUser));
-
-  __mutexBlock(app_->model()->lock()) {
-    EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_DID_NOT_WRITE_CLIENTS_KEY,
-              app_manager_->ReadInstallerRegistrationValues(app_));
-  }
-
-  EXPECT_TRUE(app_->next_version()->version().IsEmpty());
-  EXPECT_TRUE(app_->language().IsEmpty());
-
-  EXPECT_TRUE(RegKey::HasKey(kGuid1ClientsKeyPathUser));
-  EXPECT_FALSE(RegKey::HasKey(kGuid1ClientStateKeyPathUser));
-}
-
-TEST_F(AppManagerUserTest,
-       ReadInstallerRegistrationValues_FailsWhenVersionValueEmpty) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(kGuid1ClientsKeyPathUser,
-                                    kRegValueProductVersion,
-                                    _T("")));
-
-  __mutexBlock(app_->model()->lock()) {
-    EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_DID_NOT_WRITE_CLIENTS_KEY,
-              app_manager_->ReadInstallerRegistrationValues(app_));
-  }
-
-  EXPECT_TRUE(app_->next_version()->version().IsEmpty());
-  EXPECT_TRUE(app_->language().IsEmpty());
-
-  EXPECT_TRUE(RegKey::HasKey(kGuid1ClientsKeyPathUser));
-  EXPECT_FALSE(RegKey::HasKey(kGuid1ClientStateKeyPathUser));
-}
-
-TEST_F(AppManagerUserTest,
-       ReadInstallerRegistrationValues_SucceedsWhenStateKeyAbsent) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(kGuid1ClientsKeyPathUser,
-                                    kRegValueProductVersion,
-                                    _T("0.9.68.4")));
-
-  __mutexBlock(app_->model()->lock()) {
-    EXPECT_SUCCEEDED(app_manager_->ReadInstallerRegistrationValues(app_));
-  }
-
-  EXPECT_STREQ(_T("0.9.68.4"), app_->next_version()->version());
-  EXPECT_TRUE(app_->language().IsEmpty());
-}
-
-TEST_F(AppManagerUserTest,
-       ReadInstallerRegistrationValues_SucceedsWithLanguage) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(kGuid1ClientsKeyPathUser,
-                                    kRegValueProductVersion,
-                                    _T("0.9.68.4")));
-  ASSERT_SUCCEEDED(RegKey::SetValue(kGuid1ClientsKeyPathUser,
-                                    kRegValueLanguage,
-                                    _T("zh-TW")));
-
-  __mutexBlock(app_->model()->lock()) {
-    EXPECT_SUCCEEDED(app_manager_->ReadInstallerRegistrationValues(app_));
-  }
-
-  EXPECT_STREQ(_T("0.9.68.4"), app_->next_version()->version());
-  EXPECT_STREQ(_T("zh-TW"), app_->language());
-}
-
-TEST_F(AppManagerMachineTest,
-       ReadInstallerRegistrationValues_SucceedsWithLanguage) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(kGuid1ClientsKeyPathMachine,
-                                    kRegValueProductVersion,
-                                    _T("0.9.68.4")));
-  ASSERT_SUCCEEDED(RegKey::SetValue(kGuid1ClientsKeyPathMachine,
-                                    kRegValueLanguage,
-                                    _T("zh-TW")));
-
-  __mutexBlock(app_->model()->lock()) {
-    EXPECT_SUCCEEDED(app_manager_->ReadInstallerRegistrationValues(app_));
-  }
-
-  EXPECT_STREQ(_T("0.9.68.4"), app_->next_version()->version());
-  EXPECT_STREQ(_T("zh-TW"), app_->language());
-}
-
-TEST_F(AppManagerUserTest, PersistSuccessfulInstall) {
-  PersistSuccessfulInstallTest();
-}
-
-TEST_F(AppManagerMachineTest, PersistSuccessfulInstall) {
-  PersistSuccessfulInstallTest();
-}
-
-TEST_F(AppManagerUserTest, PersistUpdateCheckSuccessfullySent_AllUpdated) {
-  PersistUpdateCheckSuccessfullySent_AllUpdated();
-}
-
-TEST_F(AppManagerMachineTest, PersistUpdateCheckSuccessfullySent_AllUpdated) {
-  PersistUpdateCheckSuccessfullySent_AllUpdated();
-}
-
-TEST_F(AppManagerUserTest, PersistUpdateCheckSuccessfullySent_NotRun) {
-  PersistUpdateCheckSuccessfullySent_NotRun();
-}
-
-TEST_F(AppManagerMachineTest, PersistUpdateCheckSuccessfullySent_NotRun) {
-  PersistUpdateCheckSuccessfullySent_NotRun();
-}
-
-TEST_F(AppManagerUserTest, PersistUpdateCheckSuccessfullySent_NoPreviousPing) {
-  PersistUpdateCheckSuccessfullySent_NoPreviousPing();
-}
-
-TEST_F(AppManagerMachineTest,
-       PersistUpdateCheckSuccessfullySent_NoPreviousPing) {
-  PersistUpdateCheckSuccessfullySent_NoPreviousPing();
-}
-
-TEST_F(AppManagerUserTest, SynchronizeClientStateTest) {
-  SynchronizeClientStateTest(kGuid2);  // App ID must be different than app_.
-
-  ValidateClientStateMedium(is_machine_, kGuid2);
-}
-
-TEST_F(AppManagerMachineTest, SynchronizeClientStateTest) {
-  SynchronizeClientStateTest(kGuid2);  // App ID must be different than app_.
-
-  ValidateClientStateMedium(is_machine_, kGuid2);
-}
-
-// Should not create ClientStateMedium key.
-TEST_F(AppManagerMachineTest, SynchronizeClientState_Omaha) {
-  SynchronizeClientStateTest(kGoogleUpdateAppId);
-
-  const CString client_state_medium_key_name = AppendRegKeyPath(
-    ConfigManager::Instance()->machine_registry_client_state_medium(),
-    kGoogleUpdateAppId);
-  EXPECT_FALSE(RegKey::HasKey(client_state_medium_key_name));
-}
-
-TEST_F(AppManagerUserTest, UpdateUpdateAvailableStats_NoExistingStats) {
-  const time64 before_time_in_100ns(GetCurrent100NSTime());
-
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  UpdateUpdateAvailableStats(guid1_, app_manager_);
-
-  const time64 after_time_in_100ns(GetCurrent100NSTime());
-
-  DWORD update_available_count(0);
-  EXPECT_SUCCEEDED(RegKey::GetValue(kGuid1ClientStateKeyPathUser,
-                                    _T("UpdateAvailableCount"),
-                                    &update_available_count));
-  EXPECT_EQ(1, update_available_count);
-
-  DWORD64 update_available_since_time(0);
-  EXPECT_SUCCEEDED(RegKey::GetValue(kGuid1ClientStateKeyPathUser,
-                                    _T("UpdateAvailableSince"),
-                                    &update_available_since_time));
-  EXPECT_LE(before_time_in_100ns, update_available_since_time);
-  EXPECT_GE(after_time_in_100ns, update_available_since_time);
-  const DWORD64 time_since_first_update_available =
-      after_time_in_100ns - update_available_since_time;
-  EXPECT_GT(10 * kSecsTo100ns, time_since_first_update_available);
-}
-
-TEST_F(AppManagerUserTest, UpdateUpdateAvailableStats_WithExistingStats) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientStateKeyPathUser,
-                                    _T("UpdateAvailableCount"),
-                                    static_cast<DWORD>(123456)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientStateKeyPathUser,
-                                    _T("UpdateAvailableSince"),
-                                    static_cast<DWORD64>(9876543210)));
-
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  UpdateUpdateAvailableStats(guid1_, app_manager_);
-
-  DWORD update_available_count(0);
-  EXPECT_SUCCEEDED(RegKey::GetValue(kGuid1ClientStateKeyPathUser,
-                                    _T("UpdateAvailableCount"),
-                                    &update_available_count));
-  EXPECT_EQ(123457, update_available_count);
-
-  DWORD64 update_available_since_time(0);
-  EXPECT_SUCCEEDED(RegKey::GetValue(kGuid1ClientStateKeyPathUser,
-                                    _T("UpdateAvailableSince"),
-                                    &update_available_since_time));
-  EXPECT_EQ(9876543210, update_available_since_time);
-}
-
-// TODO(omaha3): Test PersistSuccessfulUpdateCheckResponse().
-// TODO(omaha): Move these tests to app_registry_utils_unittest.cc.
-#if 0
-TEST_F(AppManagerUserTest, ClearUpdateAvailableStats_KeyNotPresent) {
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  ClearUpdateAvailableStats(guid1_, app_manager_);
-}
-
-TEST_F(AppManagerUserTest, ClearUpdateAvailableStats_DataPresent) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientStateKeyPathUser,
-                                    _T("UpdateAvailableCount"),
-                                    static_cast<DWORD>(123456)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientStateKeyPathUser,
-                                    _T("UpdateAvailableSince"),
-                                    static_cast<DWORD64>(9876543210)));
-
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  ClearUpdateAvailableStats(guid1_, app_manager_);
-
-  EXPECT_TRUE(RegKey::HasKey(kGuid1ClientStateKeyPathUser));
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                _T("UpdateAvailableCount")));
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                _T("UpdateAvailableSince")));
-}
-#endif
-
-TEST_F(AppManagerUserTest, ReadUpdateAvailableStats_DataNotPresent) {
-  RegKey::CreateKey(kGuid1ClientStateKeyPathUser);
-
-  DWORD update_responses(1);
-  DWORD64 time_since_first_response_ms(1);
-  app_manager_->ReadUpdateAvailableStats(guid1_,
-                                         &update_responses,
-                                         &time_since_first_response_ms);
-
-  EXPECT_EQ(0, update_responses);
-  EXPECT_EQ(0, time_since_first_response_ms);
-}
-
-TEST_F(AppManagerUserTest, ReadUpdateAvailableStats_DataPresent) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientStateKeyPathUser,
-                                    _T("UpdateAvailableCount"),
-                                    static_cast<DWORD>(123456)));
-  const DWORD64 kUpdateAvailableSince =
-    GetCurrent100NSTime() - 2 * kMillisecsTo100ns;
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientStateKeyPathUser,
-                                    _T("UpdateAvailableSince"),
-                                    kUpdateAvailableSince));
-
-  DWORD update_responses(0);
-  DWORD64 time_since_first_response_ms(0);
-  app_manager_->ReadUpdateAvailableStats(guid1_,
-                                         &update_responses,
-                                         &time_since_first_response_ms);
-
-  EXPECT_EQ(123456, update_responses);
-  EXPECT_LE(2, time_since_first_response_ms);
-  EXPECT_GT(10 * kMsPerSec, time_since_first_response_ms);
-}
-
-// TODO(omaha): Move these tests to app_registry_utils_unittest.cc.
-#if 0
-TEST_F(AppManagerUserTest, PersistSuccessfulInstall_Install_Online) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientStateKeyPathUser,
-                                    _T("UpdateAvailableCount"),
-                                    static_cast<DWORD>(123456)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientStateKeyPathUser,
-                                    _T("UpdateAvailableSince"),
-                                    static_cast<DWORD64>(9876543210)));
-
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  app_manager_->PersistSuccessfulInstall(guid1_, false, false);
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  // Verify ClearUpdateAvailableStats() was called.
-  EXPECT_TRUE(RegKey::HasKey(kGuid1ClientStateKeyPathUser));
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                _T("UpdateAvailableCount")));
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                _T("UpdateAvailableSince")));
-
-  // Verify update check value is written but update value is not.
-  const uint32 last_check_sec = GetDwordValue(kGuid1ClientStateKeyPathUser,
-                                              kRegValueLastSuccessfulCheckSec);
-  EXPECT_GE(now, last_check_sec);
-  EXPECT_GE(static_cast<uint32>(200), now - last_check_sec);
-
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                kRegValueLastUpdateTimeSec));
-}
-
-TEST_F(AppManagerUserTest, PersistSuccessfulInstall_Install_Offline) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientStateKeyPathUser,
-                                    _T("UpdateAvailableCount"),
-                                    static_cast<DWORD>(123456)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientStateKeyPathUser,
-                                    _T("UpdateAvailableSince"),
-                                    static_cast<DWORD64>(9876543210)));
-
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  app_manager_->PersistSuccessfulInstall(guid1_, false, true);
-
-  // Verify ClearUpdateAvailableStats() was called.
-  EXPECT_TRUE(RegKey::HasKey(kGuid1ClientStateKeyPathUser));
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                _T("UpdateAvailableCount")));
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                _T("UpdateAvailableSince")));
-
-  // Verify update values are not written.
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                kRegValueLastSuccessfulCheckSec));
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                kRegValueLastUpdateTimeSec));
-}
-
-TEST_F(AppManagerUserTest, PersistSuccessfulInstall_Update_ExistingTimes) {
-  const DWORD kExistingUpdateValues = 0x70123456;
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientStateKeyPathUser,
-                                    _T("UpdateAvailableCount"),
-                                    static_cast<DWORD>(123456)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientStateKeyPathUser,
-                                    _T("UpdateAvailableSince"),
-                                    static_cast<DWORD64>(9876543210)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientStateKeyPathUser,
-                                    kRegValueLastSuccessfulCheckSec,
-                                    kExistingUpdateValues));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientStateKeyPathUser,
-                                    kRegValueLastUpdateTimeSec,
-                                    kExistingUpdateValues));
-
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  app_manager_->PersistSuccessfulInstall(guid1_, true, false);
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  // Verify ClearUpdateAvailableStats() was called.
-  EXPECT_TRUE(RegKey::HasKey(kGuid1ClientStateKeyPathUser));
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                _T("UpdateAvailableCount")));
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                _T("UpdateAvailableSince")));
-
-  // Verify update values updated.
-  const uint32 last_check_sec = GetDwordValue(kGuid1ClientStateKeyPathUser,
-                                              kRegValueLastSuccessfulCheckSec);
-  EXPECT_NE(kExistingUpdateValues, last_check_sec);
-  EXPECT_GE(now, last_check_sec);
-  EXPECT_GE(static_cast<uint32>(200), now - last_check_sec);
-
-  const uint32 last_update_sec =
-      GetDwordValue(kGuid1ClientStateKeyPathUser, kRegValueLastUpdateTimeSec);
-  EXPECT_NE(kExistingUpdateValues, last_update_sec);
-  EXPECT_GE(now, last_update_sec);
-  EXPECT_GE(static_cast<uint32>(200), now - last_update_sec);
-}
-
-TEST_F(AppManagerUserTest,
-       PersistSuccessfulInstall_Update_StateKeyDoesNotExist) {
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  app_manager_->PersistSuccessfulInstall(guid1_, true, false);
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  // Verify update values updated.
-  const uint32 last_check_sec = GetDwordValue(kGuid1ClientStateKeyPathUser,
-                                              kRegValueLastSuccessfulCheckSec);
-  EXPECT_GE(now, last_check_sec);
-  EXPECT_GE(static_cast<uint32>(200), now - last_check_sec);
-
-  const uint32 last_update_sec =
-      GetDwordValue(kGuid1ClientStateKeyPathUser, kRegValueLastUpdateTimeSec);
-  EXPECT_GE(now, last_update_sec);
-  EXPECT_GE(static_cast<uint32>(200), now - last_update_sec);
-}
-#endif
-
-// TODO(omaha): Move these tests to app_registry_utils_unittest.cc.
-#if 0
-TEST_F(AppManagerUserTest, PersistSuccessfulUpdateCheck_ExistingTime) {
-  const DWORD kExistingUpdateValue = 0x12345678;
-  EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientStateKeyPathUser,
-                                    kRegValueLastSuccessfulCheckSec,
-                                    kExistingUpdateValue));
-
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  app_manager_->PersistSuccessfulUpdateCheck(guid1_);
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  const uint32 last_check_sec = GetDwordValue(kGuid1ClientStateKeyPathUser,
-                                              kRegValueLastSuccessfulCheckSec);
-  EXPECT_NE(kExistingUpdateValue, last_check_sec);
-  EXPECT_GE(now, last_check_sec);
-  EXPECT_GE(static_cast<uint32>(200), now - last_check_sec);
-
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                kRegValueLastUpdateTimeSec));
-}
-
-TEST_F(AppManagerUserTest, PersistSuccessfulUpdateCheck_StateKeyDoesNotExist) {
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  app_manager_->PersistSuccessfulUpdateCheck(guid1_);
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  const uint32 last_check_sec = GetDwordValue(kGuid1ClientStateKeyPathUser,
-                                              kRegValueLastSuccessfulCheckSec);
-  EXPECT_GE(now, last_check_sec);
-  EXPECT_GE(static_cast<uint32>(200), now - last_check_sec);
-
-  EXPECT_FALSE(RegKey::HasValue(kGuid1ClientStateKeyPathUser,
-                                kRegValueLastUpdateTimeSec));
-}
-#endif
-
-TEST_F(AppManagerMachineTest, RemoveClientState_Uninstalled) {
-  App* expected_app = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedUninstalledApp(_T("1.1.0.0"), expected_app);
-  CreateAppRegistryState(*expected_app, is_machine_, _T("1.1.0.0"), false);
-
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  EXPECT_SUCCEEDED(app_manager_->RemoveClientState(guid1_));
-  EXPECT_FALSE(IsClientStateKeyPresent(*expected_app));
-}
-
-// TODO(omaha): Move implementation up to class definition.
-// Creates 2 registered app and 1 unregistered app and populates the parameters.
-// Each is written to the registry.
-// Also creates partial Clients and ClientState keys and creates a registered
-// and an unregistered app in the opposite registry hive.
-void AppManagerWithBundleTest::
-    PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(
-    bool is_machine,
-    App* expected_app0,
-    App* expected_app1,
-    App* expected_app2,
-    App* opposite_hive_data1,
-    App* opposite_hive_data2) {
-
-  PopulateExpectedApp1(expected_app0);
-  CreateAppRegistryState(*expected_app0, is_machine, _T("1.0.0.0"), true);
-
-  PopulateExpectedApp2(expected_app1);
-  CreateAppRegistryState(*expected_app1, is_machine, _T("1.1.0.0"), true);
-
-  PopulateExpectedUninstalledApp(_T("2.3.0.0"), expected_app2);
-  CreateAppRegistryState(*expected_app2, is_machine, _T("2.3.0.0"), false);
-
-  //
-  // Add incomplete Clients and ClientState entries.
-  //
-
-  // No pv.
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(
-      AppendRegKeyPath(is_machine ? MACHINE_REG_CLIENTS : USER_REG_CLIENTS,
-                       kGuid4),
-      _T("name"),
-      _T("foo")));
-
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(
-      AppendRegKeyPath(is_machine ? MACHINE_REG_CLIENT_STATE :
-                                    USER_REG_CLIENT_STATE,
-                       kGuid5),
-      kRegValueDidRun,
-      _T("1")));
-
-  // Add registered and unregistered app to the opposite registry hive.
-  PopulateExpectedApp2(opposite_hive_data1);
-  CreateAppRegistryState(*opposite_hive_data1,
-                         !is_machine,
-                         _T("1.1.0.0"),
-                         true);
-
-  PopulateExpectedUninstalledApp(_T("1.1.0.0"), opposite_hive_data2);
-  CreateAppRegistryState(*opposite_hive_data2,
-                         !is_machine,
-                         _T("1.1.0.0"),
-                         false);
-}
-
-TEST_F(AppManagerWithBundleMachineTest, GetRegisteredApps) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(
-      true,
-      &expected_app0,
-      &expected_app1,
-      &expected_app2);
-
-  // An important part of this test is that GetRegisteredApps() continues and
-  // returns success even though there is a key for an app that is not properly
-  // registered (e.g. it does not have a pv value or has an invalid pv value).
-  // Since this is so important, explicitly check registry was set up correctly.
-  // Invalid pv value type is checked in a separate test since it causes an
-  // assert.
-  // Since GetRegisteredApps() does not rely on pv, the app is still returned
-  // in the vector.
-  // Note that kGuid4 is not upper-cased like the other GUIDs. This is because
-  // the other GUIDs are converted to a GUID and back to a string by
-  // PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests().
-  const CString incomplete_clients_key =
-      AppendRegKeyPath(MACHINE_REG_CLIENTS, kGuid4);
-  EXPECT_TRUE(RegKey::HasKey(incomplete_clients_key));
-  EXPECT_FALSE(RegKey::HasValue(incomplete_clients_key,
-                                kRegValueProductVersion));
-
-  AppIdVector registered_app_ids;
-  EXPECT_SUCCEEDED(app_manager_->GetRegisteredApps(&registered_app_ids));
-  EXPECT_EQ(3, registered_app_ids.size());
-
-  EXPECT_STREQ(CString(kGuid1).MakeUpper(), registered_app_ids[0]);
-  EXPECT_STREQ(CString(kGuid2).MakeUpper(), registered_app_ids[1]);
-  EXPECT_STREQ(kGuid4, registered_app_ids[2]);
-}
-
-TEST_F(AppManagerWithBundleUserTest, GetRegisteredApps) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(
-      false,
-      &expected_app0,
-      &expected_app1,
-      &expected_app2);
-
-  // See comment in machine GetRegisteredApps test.
-  const CString incomplete_clients_key =
-      AppendRegKeyPath(USER_REG_CLIENTS, kGuid4);
-  EXPECT_TRUE(RegKey::HasKey(incomplete_clients_key));
-  EXPECT_FALSE(RegKey::HasValue(incomplete_clients_key,
-                                kRegValueProductVersion));
-
-  AppIdVector registered_app_ids;
-  EXPECT_SUCCEEDED(app_manager_->GetRegisteredApps(&registered_app_ids));
-  EXPECT_EQ(3, registered_app_ids.size());
-
-  EXPECT_STREQ(CString(kGuid1).MakeUpper(), registered_app_ids[0]);
-  EXPECT_STREQ(CString(kGuid2).MakeUpper(), registered_app_ids[1]);
-  EXPECT_STREQ(kGuid4, registered_app_ids[2]);
-}
-
-TEST_F(AppManagerWithBundleUserTest, GetRegisteredApps_InvalidPvValueType) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(
-      false,
-      &expected_app0,
-      &expected_app1,
-      &expected_app2);
-
-  // It is important that this value is alphabetically before the other AppIds.
-  // This allows us to test that processing continues despite the bad pv.
-  const TCHAR* const kInvalidPvTypeAppId =
-      _T("{0150B619-867C-4985-B193-ED309A23EE36}");
-  const CString invalid_pv_type_clients_key =
-      AppendRegKeyPath(USER_REG_CLIENTS, kInvalidPvTypeAppId);
-
-  // Incorrect data type for pv. See comment in machine GetRegisteredApps test.
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(invalid_pv_type_clients_key,
-                                            kRegValueProductVersion,
-                                            static_cast<DWORD>(12345)));
-  EXPECT_TRUE(RegKey::HasValue(invalid_pv_type_clients_key,
-                               kRegValueProductVersion));
-  DWORD value_type = REG_SZ;
-  EXPECT_SUCCEEDED(RegKey::GetValueType(invalid_pv_type_clients_key,
-                                        kRegValueProductVersion,
-                                        &value_type));
-  EXPECT_NE(REG_SZ, value_type);
-
-  AppIdVector registered_app_ids;
-  EXPECT_SUCCEEDED(app_manager_->GetRegisteredApps(&registered_app_ids));
-
-  EXPECT_EQ(4, registered_app_ids.size());
-
-  EXPECT_STREQ(kInvalidPvTypeAppId, registered_app_ids[0]);
-  EXPECT_STREQ(CString(kGuid1).MakeUpper(), registered_app_ids[1]);
-  EXPECT_STREQ(CString(kGuid2).MakeUpper(), registered_app_ids[2]);
-  EXPECT_STREQ(kGuid4, registered_app_ids[3]);
-}
-
-TEST_F(AppManagerWithBundleMachineTest, GetUninstalledApps) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(
-      true,
-      &expected_app0,
-      &expected_app1,
-      &expected_app2);
-
-  AppIdVector registered_app_ids;
-  EXPECT_SUCCEEDED(app_manager_->GetUninstalledApps(&registered_app_ids));
-  EXPECT_EQ(1, registered_app_ids.size());
-
-  EXPECT_STREQ(CString(kGuid3).MakeUpper(), registered_app_ids[0]);
-}
-
-TEST_F(AppManagerWithBundleUserTest, GetUninstalledApps) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateDataAndRegistryForRegisteredAndUnInstalledAppsTests(
-      false,
-      &expected_app0,
-      &expected_app1,
-      &expected_app2);
-
-  AppIdVector registered_app_ids;
-  EXPECT_SUCCEEDED(app_manager_->GetUninstalledApps(&registered_app_ids));
-  EXPECT_EQ(1, registered_app_ids.size());
-
-  EXPECT_STREQ(CString(kGuid3).MakeUpper(), registered_app_ids[0]);
-}
-
-TEST_F(AppManagerWithBundleMachineTest, GetOemInstalledAndEulaAcceptedApps) {
-  // Create an OEM installed app.
-  App* expected_app1 = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedApp1(expected_app1);
-  CreateAppRegistryState(*expected_app1, is_machine_, _T("1.0.0.0"), true);
-
-  CString client_state_key_name = AppendRegKeyPath(
-      ConfigManager::Instance()->registry_client_state(is_machine_),
-      expected_app1->app_guid_string());
-  RegKey client_state_key;
-  ASSERT_SUCCEEDED(client_state_key.Create(client_state_key_name));
-  ASSERT_SUCCEEDED(client_state_key.SetValue(kRegValueOemInstall, _T("1")));
-
-  // Create a non-OEM installed app.
-  App* expected_app2 = CreateAppForRegistryPopulation(kGuid2);
-  PopulateExpectedApp2(expected_app2);
-  CreateAppRegistryState(*expected_app2, is_machine_, _T("2.0.0.0"), true);
-
-  AppIdVector oem_installed_app_ids;
-  EXPECT_SUCCEEDED(
-      app_manager_->GetOemInstalledAndEulaAcceptedApps(&oem_installed_app_ids));
-  EXPECT_EQ(1, oem_installed_app_ids.size());
-  EXPECT_STREQ(expected_app1->app_guid_string().MakeUpper(),
-               oem_installed_app_ids[0]);
-
-  app_manager_->ClearOemInstalled(oem_installed_app_ids);
-  oem_installed_app_ids.clear();
-  EXPECT_SUCCEEDED(
-      app_manager_->GetOemInstalledAndEulaAcceptedApps(&oem_installed_app_ids));
-  EXPECT_EQ(0, oem_installed_app_ids.size());
-}
-
-TEST_F(AppManagerWithBundleUserTest, GetOemInstalledAndEulaAcceptedApps) {
-  // Create an OEM installed app.
-  App* expected_app1 = CreateAppForRegistryPopulation(kGuid1);
-  PopulateExpectedApp1(expected_app1);
-  CreateAppRegistryState(*expected_app1, is_machine_, _T("1.0.0.0"), true);
-
-  CString client_state_key_name = AppendRegKeyPath(
-      ConfigManager::Instance()->registry_client_state(is_machine_),
-      expected_app1->app_guid_string());
-  RegKey client_state_key;
-  ASSERT_SUCCEEDED(client_state_key.Create(client_state_key_name));
-  ASSERT_SUCCEEDED(client_state_key.SetValue(kRegValueOemInstall, _T("1")));
-
-  // Create a non-OEM installed app.
-  App* expected_app2 = CreateAppForRegistryPopulation(kGuid2);
-  PopulateExpectedApp2(expected_app2);
-  CreateAppRegistryState(*expected_app2, is_machine_, _T("2.0.0.0"), true);
-
-  AppIdVector oem_installed_app_ids;
-  EXPECT_SUCCEEDED(
-      app_manager_->GetOemInstalledAndEulaAcceptedApps(&oem_installed_app_ids));
-  EXPECT_EQ(1, oem_installed_app_ids.size());
-  EXPECT_STREQ(expected_app1->app_guid_string().MakeUpper(),
-               oem_installed_app_ids[0]);
-
-  app_manager_->ClearOemInstalled(oem_installed_app_ids);
-  oem_installed_app_ids.clear();
-  EXPECT_SUCCEEDED(
-      app_manager_->GetOemInstalledAndEulaAcceptedApps(&oem_installed_app_ids));
-  EXPECT_EQ(0, oem_installed_app_ids.size());
-}
-
-// TODO(omaha): Perhaps CoCreate some real hooks and test further for the
-// *UpdateHook* tests.
-TEST_F(AppManagerWithBundleMachineTest, RunRegistrationUpdateHook) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateForRegistrationUpdateHookTests(
-      true,
-      &expected_app0,
-      &expected_app1,
-      &expected_app2,
-      kNonExistentClsid);
-
-  EXPECT_EQ(REGDB_E_CLASSNOTREG,
-            app_manager_->RunRegistrationUpdateHook(CString(kGuid1)));
-
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            app_manager_->RunRegistrationUpdateHook(CString(kGuid7)));
-}
-
-TEST_F(AppManagerWithBundleUserTest, RunRegistrationUpdateHook) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateForRegistrationUpdateHookTests(
-      false,
-      &expected_app0,
-      &expected_app1,
-      &expected_app2,
-      kNonExistentClsid);
-
-  EXPECT_EQ(REGDB_E_CLASSNOTREG,
-            app_manager_->RunRegistrationUpdateHook(CString(kGuid1)));
-
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            app_manager_->RunRegistrationUpdateHook(CString(kGuid7)));
-}
-
-// TODO(omaha): The RunAllRegistrationUpdateHooks tests do not actually
-// CoCreate any hook. Need to find a way to test this.
-TEST_F(AppManagerWithBundleMachineTest, RunAllRegistrationUpdateHooks) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateForRegistrationUpdateHookTests(
-      true,
-      &expected_app0,
-      &expected_app1,
-      &expected_app2,
-      GuidToString(GUID_NULL));
-
-  EXPECT_SUCCEEDED(app_manager_->RunAllRegistrationUpdateHooks());
-}
-
-TEST_F(AppManagerWithBundleUserTest, RunAllRegistrationUpdateHooks) {
-  App *expected_app0, *expected_app1, *expected_app2;
-  PopulateForRegistrationUpdateHookTests(
-      false,
-      &expected_app0,
-      &expected_app1,
-      &expected_app2,
-      GuidToString(GUID_NULL));
-
-  EXPECT_SUCCEEDED(app_manager_->RunAllRegistrationUpdateHooks());
-}
-
-TEST_F(AppManagerMachineTest, AppLockContention) {
-  const int kLockHeldTimeMs = 500;
-  HoldAppManagerLock hold_lock(is_machine_, kLockHeldTimeMs);
-
-  Thread thread;
-  thread.Start(&hold_lock);
-  hold_lock.WaitForLockToBeAcquired();
-
-  HighresTimer lock_metrics_timer;
-  __mutexScope(app_->model()->lock());
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            app_manager_->ReadAppPersistentData(app_));
-
-  // -20 because this sometimes failed with 48x vs. 500.
-  EXPECT_LE(kLockHeldTimeMs - 20, lock_metrics_timer.GetElapsedMs());
-
-  thread.WaitTillExit(1000);
-}
-
-TEST_F(AppManagerUserTest, AppLockContention) {
-  const int kLockHeldTimeMs = 500;
-  HoldAppManagerLock hold_lock(is_machine_, kLockHeldTimeMs);
-
-  Thread thread;
-  thread.Start(&hold_lock);
-  hold_lock.WaitForLockToBeAcquired();
-
-  HighresTimer lock_metrics_timer;
-  __mutexScope(app_->model()->lock());
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            app_manager_->ReadAppPersistentData(app_));
-
-  // -20 because this sometimes failed with 48x vs. 500.
-  EXPECT_LE(kLockHeldTimeMs - 20, lock_metrics_timer.GetElapsedMs());
-
-  thread.WaitTillExit(1000);
-}
-
-TEST_F(AppManagerMachineTest, AppLock_MachineAndUser) {
-  GLock app_manager_user_lock;
-  InitializeAppManagerRegistryLock(false, &app_manager_user_lock);
-
-  __mutexScope(app_manager_user_lock);
-
-  HighresTimer lock_metrics_timer;
-  __mutexScope(app_->model()->lock());
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            app_manager_->ReadAppPersistentData(app_));
-
-  EXPECT_GT(40, lock_metrics_timer.GetElapsedMs())
-      << _T("No delay is expected because there should not be a conflict.");
-}
-
-TEST_F(AppManagerUserTest, ReadAppVersionNoLock_NoApp) {
-  CString version;
-  EXPECT_FAILED(AppManager::ReadAppVersionNoLock(is_machine_,
-                                                 StringToGuid(kGuid1),
-                                                 &version));
-}
-
-TEST_F(AppManagerUserTest, ReadAppVersionNoLock_RegisteredApp) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(kGuid1ClientsKeyPathUser,
-                                    kRegValueProductVersion,
-                                    _T("0.9.75.4")));
-
-  CString version;
-  EXPECT_SUCCEEDED(AppManager::ReadAppVersionNoLock(is_machine_,
-                                                    StringToGuid(kGuid1),
-                                                    &version));
-  EXPECT_STREQ(_T("0.9.75.4"), version);
-  EXPECT_SUCCEEDED(RegKey::DeleteKey(kGuid1ClientsKeyPathUser));
-}
-
-TEST_F(AppManagerMachineTest, ReadAppVersionNoLock_NoApp) {
-  CString version;
-  EXPECT_FAILED(AppManager::ReadAppVersionNoLock(is_machine_,
-                                                 StringToGuid(kGuid1),
-                                                 &version));
-}
-
-TEST_F(AppManagerMachineTest, ReadAppVersionNoLock_RegisteredApp) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(kGuid1ClientsKeyPathMachine,
-                                    kRegValueProductVersion,
-                                    _T("0.9.80.4")));
-
-  CString version;
-  EXPECT_SUCCEEDED(AppManager::ReadAppVersionNoLock(is_machine_,
-                                                    StringToGuid(kGuid1),
-                                                    &version));
-  EXPECT_STREQ(_T("0.9.80.4"), version);
-  EXPECT_SUCCEEDED(RegKey::DeleteKey(kGuid1ClientsKeyPathMachine));
-}
-
-}  // namespace omaha
diff --git a/goopdate/app_state.cc b/goopdate/app_state.cc
deleted file mode 100644
index bb75de0..0000000
--- a/goopdate/app_state.cc
+++ /dev/null
@@ -1,167 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_state.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/goopdate/app_state_error.h"
-#include "omaha/goopdate/model.h"
-#include "omaha/goopdate/server_resource.h"
-#include "omaha/goopdate/string_formatter.h"
-
-namespace omaha {
-
-namespace fsm {
-
-const PingEvent* AppState::CreatePingEvent(App* app,
-                                           CurrentState previous_state) const {
-  UNREFERENCED_PARAMETER(app);
-  UNREFERENCED_PARAMETER(previous_state);
-  return NULL;
-}
-
-void AppState::QueueUpdateCheck(App* app) {
-  HandleInvalidStateTransition(app, _T(__FUNCTION__));
-}
-
-void AppState::PreUpdateCheck(App* app, xml::UpdateRequest* update_request) {
-  UNREFERENCED_PARAMETER(update_request);
-  HandleInvalidStateTransition(app, _T(__FUNCTION__));
-}
-
-void AppState::PostUpdateCheck(App* app,
-                               HRESULT result,
-                               xml::UpdateResponse* update_response) {
-  UNREFERENCED_PARAMETER(result);
-  UNREFERENCED_PARAMETER(update_response);
-  HandleInvalidStateTransition(app, _T(__FUNCTION__));
-}
-
-void AppState::QueueDownload(App* app) {
-  HandleInvalidStateTransition(app, _T(__FUNCTION__));
-}
-
-void AppState::QueueDownloadOrInstall(App* app) {
-  HandleInvalidStateTransition(app, _T(__FUNCTION__));
-}
-
-void AppState::Download(App* app, DownloadManagerInterface* download_manager) {
-  ASSERT1(download_manager);
-  UNREFERENCED_PARAMETER(download_manager);
-  // Must acquire the lock here because app does not acquire it before calling
-  // this method.
-  __mutexScope(app->model()->lock());
-  HandleInvalidStateTransition(app, _T(__FUNCTION__));
-}
-
-void AppState::Downloading(App* app) {
-  HandleInvalidStateTransition(app, _T(__FUNCTION__));
-}
-
-void AppState::DownloadComplete(App* app) {
-  HandleInvalidStateTransition(app, _T(__FUNCTION__));
-}
-
-void AppState::MarkReadyToInstall(App* app) {
-  HandleInvalidStateTransition(app, _T(__FUNCTION__));
-}
-
-void AppState::QueueInstall(App* app) {
-  HandleInvalidStateTransition(app, _T(__FUNCTION__));
-}
-
-void AppState::Install(App* app, InstallManagerInterface* install_manager) {
-  ASSERT1(install_manager);
-  UNREFERENCED_PARAMETER(install_manager);
-  // Must acquire the lock here because app does not acquire it before calling
-  // this method.
-  __mutexScope(app->model()->lock());
-  HandleInvalidStateTransition(app, _T(__FUNCTION__));
-}
-
-void AppState::Installing(App* app) {
-  HandleInvalidStateTransition(app, _T(__FUNCTION__));
-}
-
-void AppState::ReportInstallerComplete(App* app,
-                                       const InstallerResultInfo& result_info) {
-  UNREFERENCED_PARAMETER(result_info);
-  HandleInvalidStateTransition(app, _T(__FUNCTION__));
-}
-
-void AppState::Pause(App* app) {
-  HandleInvalidStateTransition(app, _T(__FUNCTION__));
-}
-
-// TODO(omaha3): If Cancel is not valid during certain states, override this in
-// those states and decide what should happen. Consider Worker::StopAsync().
-void AppState::Cancel(App* app) {
-  ASSERT1(app);
-  ASSERT1(app->model()->IsLockedByCaller());
-  CORE_LOG(L3, (_T("[AppState::Cancel][0x%p]"), app));
-
-  const HRESULT hr = GOOPDATE_E_CANCELLED;
-  CString message;
-
-  StringFormatter formatter(app->app_bundle()->display_language());
-  VERIFY1(SUCCEEDED(formatter.LoadString(IDS_CANCELED, &message)));
-  app->SetError(ErrorContext(hr), message);
-  ChangeState(app, new AppStateError);
-}
-
-void AppState::Error(App* app,
-                     const ErrorContext& error_context,
-                     const CString& message) {
-  ASSERT1(app);
-  ASSERT1(app->model()->IsLockedByCaller());
-  CORE_LOG(LE, (_T("[AppState::Error][0x%p][0x%08x][%s]"),
-      app, error_context.error_code, message));
-
-  app->SetError(error_context, message);
-  ChangeState(app, new AppStateError);
-}
-
-void AppState::ChangeState(App* app, AppState* app_state) {
-  ASSERT1(app);
-  ASSERT1(app_state);
-  ASSERT1(app->model()->IsLockedByCaller());
-  CORE_LOG(L3, (_T("[AppState::ChangeState][0x%p][%d]"),
-                app, app_state->state()));
-
-  app->ChangeState(app_state);
-}
-
-// Avoid infinite recursion by calling the base class's Error() method.
-void AppState::HandleInvalidStateTransition(App* app,
-                                            const TCHAR* function_name) {
-  UNREFERENCED_PARAMETER(function_name);
-  ASSERT(false, (_T("Invalid state transition: %s called while in state %u."),
-                 function_name, state_));
-  const HRESULT hr = GOOPDATE_E_INVALID_STATE_TRANSITION;
-  StringFormatter formatter(app->app_bundle()->display_language());
-  CString message;
-  VERIFY1(SUCCEEDED(formatter.LoadString(IDS_INSTALL_FAILED, &message)));
-  AppState::Error(app, ErrorContext(hr, state_), message);
-}
-
-PingEvent::Results AppState::GetCompletionResult(const App& app) {
-  ASSERT1(app.model()->IsLockedByCaller());
-  return app.completion_result_;
-}
-
-}  // namespace fsm
-
-}  // namespace omaha
diff --git a/goopdate/app_state.h b/goopdate/app_state.h
deleted file mode 100644
index 9882025..0000000
--- a/goopdate/app_state.h
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_APP_STATE_H_
-#define OMAHA_GOOPDATE_APP_STATE_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/ping_event.h"
-#include "omaha/goopdate/installer_result_info.h"
-#include "goopdate/omaha3_idl.h"
-
-namespace omaha {
-
-class  App;
-struct ErrorContext;
-class  DownloadManagerInterface;
-class  InstallManagerInterface;
-
-namespace xml {
-
-class UpdateRequest;
-class UpdateResponse;
-
-}  // namespace xml
-
-namespace fsm {
-
-// Defines the interface for encapsulating behavior associated with a particular
-// state of the App object.
-// All state transition calls should go through App, meaning it is the only
-// class that should use this interface.
-class AppState {
- public:
-  virtual ~AppState() {}
-
-  // Design note: avoid switch and conditional statements on CurrentState. They
-  // break polymorphism and they are a poor substitute for RTTI.
-  CurrentState state() const { return state_; }
-
-  // Creates a ping event for the current state. The caller owns the returned
-  // object.
-  virtual const PingEvent* CreatePingEvent(App* app,
-                                           CurrentState previous_state) const;
-
-  virtual void QueueUpdateCheck(App* app);
-
-  virtual void PreUpdateCheck(App* app, xml::UpdateRequest* update_request);
-
-  virtual void PostUpdateCheck(App* app,
-                               HRESULT result,
-                               xml::UpdateResponse* update_response);
-
-  virtual void QueueDownload(App* app);
-
-  // Queues the download for a download and install operation.
-  virtual void QueueDownloadOrInstall(App* app);
-
-  virtual void Download(App* app, DownloadManagerInterface* download_manager);
-
-  virtual void Downloading(App* app);
-
-  virtual void DownloadComplete(App* app);
-
-  virtual void MarkReadyToInstall(App* app);
-
-  virtual void QueueInstall(App* app);
-
-  virtual void Install(App* app, InstallManagerInterface* install_manager);
-
-  virtual void Installing(App* app);
-
-  virtual void ReportInstallerComplete(App* app,
-                                       const InstallerResultInfo& result_info);
-
-  virtual void Pause(App* app);
-
-  virtual void Cancel(App* app);
-
-  virtual void Error(App* app,
-                     const ErrorContext& error_context,
-                     const CString& message);
-
- protected:
-  explicit AppState(CurrentState state) : state_(state) {}
-
-  // After calling this method, the old state (this object) is deleted and the
-  // code may not reference the members of the old state anymore.
-  void ChangeState(App* app, AppState* app_state);
-
-  void HandleInvalidStateTransition(App* app, const TCHAR* function_name);
-
-  static PingEvent::Results GetCompletionResult(const App& app);
-
- private:
-  // TODO(omaha): rename to CurrentStateId or similar.
-  const CurrentState state_;
-
-  DISALLOW_COPY_AND_ASSIGN(AppState);
-};
-
-}  // namespace fsm
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_STATE_H_
diff --git a/goopdate/app_state_checking_for_update.cc b/goopdate/app_state_checking_for_update.cc
deleted file mode 100644
index 5c936b3..0000000
--- a/goopdate/app_state_checking_for_update.cc
+++ /dev/null
@@ -1,247 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_state_checking_for_update.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/common/lang.h"
-#include "omaha/common/update_response.h"
-#include "omaha/goopdate/app_manager.h"
-#include "omaha/goopdate/app_state_no_update.h"
-#include "omaha/goopdate/app_state_update_available.h"
-#include "omaha/goopdate/model.h"
-#include "omaha/goopdate/server_resource.h"
-#include "omaha/goopdate/string_formatter.h"
-#include "omaha/goopdate/update_response_utils.h"
-#include "omaha/goopdate/worker_metrics.h"
-#include "omaha/goopdate/worker_utils.h"
-
-namespace omaha {
-
-namespace fsm {
-
-xml::UpdateResponseResult GetUpdateResponseResult(
-    const App* app,
-    const xml::UpdateResponse* update_response) {
-  ASSERT1(app);
-  ASSERT1(update_response);
-
-  const CString language = app->app_bundle()->display_language();
-
-  xml::UpdateResponseResult update_response_result =
-      update_response_utils::GetResult(update_response,
-                                       app->app_guid_string(),
-                                       language);
-
-  const bool is_omaha   = !!::IsEqualGUID(kGoopdateGuid, app->app_guid());
-  const bool has_update = update_response_result.first == S_OK &&
-                          app->is_update();
-
-  // Defer the update if the app is not Omaha, it has an update available, and
-  // an Omaha update is available at the same time.
-  if (!is_omaha  &&
-      has_update &&
-      update_response_utils::IsOmahaUpdateAvailable(update_response)) {
-    StringFormatter formatter(language);
-    CString text;
-    VERIFY1(SUCCEEDED(formatter.LoadString(IDS_NO_UPDATE_RESPONSE, &text)));
-    update_response_result = std::make_pair(GOOPDATE_E_UPDATE_DEFERRED, text);
-  }
-
-  return update_response_result;
-}
-
-AppStateCheckingForUpdate::AppStateCheckingForUpdate()
-    : AppState(STATE_CHECKING_FOR_UPDATE),
-      update_response_(NULL) {
-}
-
-// TODO(omaha3): Consider passing in an xml::response::App instead of a raw
-// xml::UpdateResponse to this method.
-void AppStateCheckingForUpdate::PostUpdateCheck(
-    App* app,
-    HRESULT update_check_result,
-    xml::UpdateResponse* update_response) {
-  CORE_LOG(L3, (_T("[AppStateCheckingForUpdate::PostUpdateCheck][0x%p]"), app));
-
-  ASSERT1(app);
-  ASSERT1(update_response);
-
-  ASSERT1(app->model()->IsLockedByCaller());
-
-  update_response_ = update_response;
-
-  const CString language = app->app_bundle()->display_language();
-
-  if (FAILED(update_check_result)) {
-    // TODO(omaha3): There is no guarantee that this is a actually network
-    // error. In Omaha 2, this was called much closer to the send. Making most
-    // errors, such as processing errors, app errors helps, but it could still
-    // be a parsing or other error.
-    CString error_message;
-    worker_utils::FormatMessageForNetworkError(update_check_result,
-                                               language,
-                                               &error_message);
-
-    Error(app, ErrorContext(update_check_result), error_message);
-    return;
-  }
-
-  PersistUpdateCheckSuccessfullySent(*app);
-
-  const xml::UpdateResponseResult update_response_result(
-      GetUpdateResponseResult(app, update_response));
-
-  const HRESULT& code    = update_response_result.first;
-  const CString& message = update_response_result.second;
-
-  if (SUCCEEDED(code)) {
-    HandleUpdateAvailable(app, code, message);
-  } else if (code == GOOPDATE_E_UPDATE_DEFERRED) {
-    HandleUpdateDeferred(app, code, message);
-  } else if (code == GOOPDATE_E_NO_UPDATE_RESPONSE) {
-    HandleNoUpdate(app, code, message);
-  } else {
-    HandleErrorResponse(app, code, message);
-  }
-}
-
-void AppStateCheckingForUpdate::HandleUpdateAvailable(App* app,
-                                                      HRESULT code,
-                                                      const CString& message) {
-  CORE_LOG(L3, (_T("[HandleUpdateAvailable][0x%p]"), app));
-
-  ASSERT1(app);
-  ASSERT1(SUCCEEDED(code));
-
-  UNREFERENCED_PARAMETER(code);
-  UNREFERENCED_PARAMETER(message);
-
-  app->set_has_update_available(true);
-
-  HRESULT hr = update_response_utils::BuildApp(update_response_, code, app);
-  if (FAILED(hr)) {
-    // Most of the errors that might actually be seen are likely to be due to
-    // response issues. Therefore, display a message about the server.
-    const CString language = app->app_bundle()->display_language();
-    StringFormatter formatter(language);
-    CString error_message;
-    VERIFY1(SUCCEEDED(formatter.LoadString(IDS_UNKNOWN_APPLICATION,
-                                           &error_message)));
-    Error(app, ErrorContext(hr), error_message);
-  }
-
-  const TCHAR* action = app->is_update() ? _T("update") : _T("install");
-  app->LogTextAppendFormat(_T("Status=%s"), action);
-
-  // Record the update available response regardless of how it is handled.
-  AppManager::Instance()->PersistSuccessfulUpdateCheckResponse(*app, true);
-
-  if (app->is_update()) {
-    if (::IsEqualGUID(kGoopdateGuid, app->app_guid())) {
-      ++metric_worker_self_updates_available;
-    } else {
-      ++metric_worker_app_updates_available;
-    }
-  }
-
-  ChangeState(app, new AppStateUpdateAvailable);
-}
-
-void AppStateCheckingForUpdate::HandleUpdateDeferred(App* app,
-                                                     HRESULT code,
-                                                     const CString& message) {
-  CORE_LOG(L3, (_T("[HandleUpdateDeferred][0x%p]"), app));
-
-  ASSERT1(app);
-  ASSERT1(code == GOOPDATE_E_UPDATE_DEFERRED);
-
-  ASSERT1(app->is_update());
-
-  app->SetNoUpdate(ErrorContext(code), message);
-  ChangeState(app, new AppStateNoUpdate);
-}
-
-void AppStateCheckingForUpdate::HandleNoUpdate(App* app,
-                                               HRESULT code,
-                                               const CString& message) {
-  CORE_LOG(L3, (_T("[HandleNoUpdate][0x%p]"), app));
-  ASSERT1(app);
-  ASSERT1(code == GOOPDATE_E_NO_UPDATE_RESPONSE);
-
-  app->LogTextAppendFormat(_T("Status=no-update"));
-
-  // For installs, no update is handled as an error.
-  if (!app->is_update()) {
-    Error(app, ErrorContext(code), message);
-    return;
-  }
-
-  VERIFY1(SUCCEEDED(update_response_utils::BuildApp(update_response_,
-                                                    code,
-                                                    app)));
-  AppManager::Instance()->PersistSuccessfulUpdateCheckResponse(*app, false);
-
-  app->SetNoUpdate(ErrorContext(S_OK), message);
-  ChangeState(app, new AppStateNoUpdate);
-}
-
-void AppStateCheckingForUpdate::HandleErrorResponse(App* app,
-                                                    HRESULT code,
-                                                    const CString& message) {
-  CORE_LOG(L3, (_T("[HandleErrorResponse][0x%p]"), app));
-
-  ASSERT1(app);
-  ASSERT1(FAILED(code));
-
-  CString log_status;
-  switch (code) {
-    case GOOPDATE_E_NO_SERVER_RESPONSE:
-      log_status = _T("no-response-received");
-      break;
-    case GOOPDATE_E_RESTRICTED_SERVER_RESPONSE:
-      log_status = _T("restricted");
-      break;
-    case GOOPDATE_E_UNKNOWN_APP_SERVER_RESPONSE:
-    case GOOPDATE_E_OS_NOT_SUPPORTED:
-    case GOOPDATE_E_INTERNAL_ERROR_SERVER_RESPONSE:
-    case GOOPDATE_E_SERVER_RESPONSE_NO_HASH:
-    case GOOPDATE_E_SERVER_RESPONSE_UNSUPPORTED_PROTOCOL:
-    case GOOPDATE_E_UNKNOWN_SERVER_RESPONSE:
-    default:
-      log_status = _T("error");
-      break;
-  }
-
-  app->LogTextAppendFormat(_T("Status=%s, Code=0x%08x"), log_status, code);
-
-  Error(app, ErrorContext(code), message);
-}
-
-void AppStateCheckingForUpdate::PersistUpdateCheckSuccessfullySent(
-    const App& app) {
-  AppManager& app_manager = *AppManager::Instance();
-  VERIFY1(SUCCEEDED(app_manager.PersistUpdateCheckSuccessfullySent(
-      app, update_response_->GetElapsedSecondsSinceDayStart())));
-
-  // Here we assume that some of the members in app object
-  // (days_since_last_active_ping_, days_since_last_roll_call_, iid_, did_run_)
-  // will not be used after the update check so there is no need to update them.
-}
-
-}  // namespace fsm
-
-}  // namespace omaha
diff --git a/goopdate/app_state_checking_for_update.h b/goopdate/app_state_checking_for_update.h
deleted file mode 100644
index 5563cd2..0000000
--- a/goopdate/app_state_checking_for_update.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_APP_STATE_CHECKING_FOR_UPDATE_H_
-#define OMAHA_GOOPDATE_APP_STATE_CHECKING_FOR_UPDATE_H_
-
-#include "base/basictypes.h"
-#include "omaha/goopdate/app_state.h"
-
-namespace omaha {
-
-namespace fsm {
-
-class AppStateCheckingForUpdate : public AppState {
- public:
-  AppStateCheckingForUpdate();
-  virtual ~AppStateCheckingForUpdate() {}
-
-  virtual void PostUpdateCheck(App* app,
-                               HRESULT result,
-                               xml::UpdateResponse* update_response);
-
- private:
-  void HandleUpdateAvailable(App* app, HRESULT code, const CString& message);
-  void HandleUpdateDeferred(App* app, HRESULT code, const CString& message);
-  void HandleNoUpdate(App* app, HRESULT code, const CString& message);
-  void HandleErrorResponse(App* app, HRESULT code, const CString& message);
-
-  void PersistUpdateCheckSuccessfullySent(const App& app);
-
-  xml::UpdateResponse* update_response_;
-
-  DISALLOW_COPY_AND_ASSIGN(AppStateCheckingForUpdate);
-};
-
-}  // namespace fsm
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_STATE_CHECKING_FOR_UPDATE_H_
diff --git a/goopdate/app_state_download_complete.cc b/goopdate/app_state_download_complete.cc
deleted file mode 100644
index 23b1286..0000000
--- a/goopdate/app_state_download_complete.cc
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_state_download_complete.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/goopdate/app_state_ready_to_install.h"
-#include "omaha/goopdate/download_complete_ping_event.h"
-#include "omaha/goopdate/model.h"
-
-namespace omaha {
-
-namespace fsm {
-
-AppStateDownloadComplete::AppStateDownloadComplete()
-    : AppState(STATE_DOWNLOAD_COMPLETE) {
-}
-
-const PingEvent* AppStateDownloadComplete::CreatePingEvent(
-    App* app,
-    CurrentState previous_state) const {
-  ASSERT1(app);
-  UNREFERENCED_PARAMETER(previous_state);
-
-  const PingEvent::Types event_type(app->is_update() ?
-      PingEvent::EVENT_UPDATE_DOWNLOAD_FINISH :
-      PingEvent::EVENT_INSTALL_DOWNLOAD_FINISH);
-
-  const HRESULT error_code = app->error_code();
-  ASSERT1(SUCCEEDED(error_code));
-
-  return new DownloadCompletePingEvent(event_type,
-                                       GetCompletionResult(*app),
-                                       error_code,
-                                       0,
-                                       app->GetDownloadTimeMs(),
-                                       app->num_bytes_downloaded(),
-                                       app->GetPackagesTotalSize());
-}
-
-// TODO(omaha3): When extraction and differential updates are supported, this
-// method will need to be copied/moved/changed to handle branches in the flow.
-void AppStateDownloadComplete::MarkReadyToInstall(App* app) {
-  CORE_LOG(L3,
-           (_T("[AppStateDownloadComplete::MarkReadyToInstall][0x%p]"), app));
-  ASSERT1(app);
-
-  ChangeState(app, new AppStateReadyToInstall);
-}
-
-}  // namespace fsm
-
-}  // namespace omaha
diff --git a/goopdate/app_state_download_complete.h b/goopdate/app_state_download_complete.h
deleted file mode 100644
index 9732522..0000000
--- a/goopdate/app_state_download_complete.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_APP_STATE_DOWNLOAD_COMPLETE_H_
-#define OMAHA_GOOPDATE_APP_STATE_DOWNLOAD_COMPLETE_H_
-
-#include "base/basictypes.h"
-#include "omaha/goopdate/app_state.h"
-
-namespace omaha {
-
-namespace fsm {
-
-class AppStateDownloadComplete : public AppState {
- public:
-  AppStateDownloadComplete();
-  virtual ~AppStateDownloadComplete() {}
-
-  virtual const PingEvent* CreatePingEvent(App* app,
-                                           CurrentState previous_state) const;
-
-  virtual void MarkReadyToInstall(App* app);
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(AppStateDownloadComplete);
-};
-
-}  // namespace fsm
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_STATE_DOWNLOAD_COMPLETE_H_
-
diff --git a/goopdate/app_state_downloading.cc b/goopdate/app_state_downloading.cc
deleted file mode 100644
index 6dc4cc1..0000000
--- a/goopdate/app_state_downloading.cc
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_state_downloading.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/goopdate/app_state_download_complete.h"
-#include "omaha/goopdate/model.h"
-
-namespace omaha {
-
-namespace fsm {
-
-AppStateDownloading::AppStateDownloading()
-    : AppState(STATE_DOWNLOADING) {
-}
-
-const PingEvent* AppStateDownloading::CreatePingEvent(
-    App* app,
-    CurrentState previous_state) const {
-  ASSERT1(app);
-  UNREFERENCED_PARAMETER(previous_state);
-
-  const PingEvent::Types event_type(app->is_update() ?
-      PingEvent::EVENT_UPDATE_DOWNLOAD_START :
-      PingEvent::EVENT_INSTALL_DOWNLOAD_START);
-
-  const HRESULT error_code = app->error_code();
-  ASSERT1(SUCCEEDED(error_code));
-
-  return new PingEvent(event_type, GetCompletionResult(*app), error_code, 0);
-}
-
-void AppStateDownloading::DownloadComplete(App* app) {
-  CORE_LOG(L3, (_T("[AppStateDownloading::DownloadComplete][%p]"), app));
-  ASSERT1(app);
-
-  app->SetDownloadCompleteTime();
-  ChangeState(app, new AppStateDownloadComplete);
-}
-
-}  // namespace fsm
-
-}  // namespace omaha
diff --git a/goopdate/app_state_downloading.h b/goopdate/app_state_downloading.h
deleted file mode 100644
index c310deb..0000000
--- a/goopdate/app_state_downloading.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_APP_STATE_DOWNLOADING_H_
-#define OMAHA_GOOPDATE_APP_STATE_DOWNLOADING_H_
-
-#include "base/basictypes.h"
-#include "omaha/goopdate/app_state.h"
-
-namespace omaha {
-
-namespace fsm {
-
-class AppStateDownloading : public AppState {
- public:
-  AppStateDownloading();
-  virtual ~AppStateDownloading() {}
-
-  virtual const PingEvent* CreatePingEvent(App* app,
-                                           CurrentState previous_state) const;
-
-  virtual void DownloadComplete(App* app);
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(AppStateDownloading);
-};
-
-}  // namespace fsm
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_STATE_DOWNLOADING_H_
-
diff --git a/goopdate/app_state_error.cc b/goopdate/app_state_error.cc
deleted file mode 100644
index 6d17864..0000000
--- a/goopdate/app_state_error.cc
+++ /dev/null
@@ -1,171 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_state_error.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/goopdate/model.h"
-
-namespace omaha {
-
-namespace fsm {
-
-AppStateError::AppStateError() : AppState(STATE_ERROR) {
-}
-
-const PingEvent* AppStateError::CreatePingEvent(
-    App* app,
-    CurrentState previous_state) const {
-  ASSERT1(app);
-
-  ASSERT1(FAILED(app->error_code()));
-
-  const PingEvent::Types event_type(app->is_update() ?
-      PingEvent::EVENT_UPDATE_COMPLETE :
-      PingEvent::EVENT_INSTALL_COMPLETE);
-
-  const PingEvent::Results result = GetCompletionResult(*app);
-
-  // Installer errors are reported in the ping in the case where the
-  // installer ran and failed. Otherwise, Omaha errors are reported.
-  //
-  // App extra codes are reported if set, otherwise the state of the state
-  // machine which caused the transition to the error state is encoded and
-  // reported.
-  const bool is_installer_error =
-      result == PingEvent::EVENT_RESULT_INSTALLER_ERROR_MSI    ||
-      result == PingEvent::EVENT_RESULT_INSTALLER_ERROR_OTHER  ||
-      result == PingEvent::EVENT_RESULT_INSTALLER_ERROR_SYSTEM;
-
-  HRESULT error_code = S_OK;
-  int extra_code1    = 0;
-
-  if (is_installer_error) {
-    error_code  = static_cast<HRESULT>(app->installer_result_code());
-    extra_code1 = app->installer_result_extra_code1();
-  } else {
-    const int app_extra_code1 = app->error_context().extra_code1;
-    error_code = app->error_code();
-    extra_code1 = app_extra_code1 ? app_extra_code1 :
-                          (PingEvent::kAppStateExtraCodeMask | previous_state);
-  }
-
-  // TODO(omaha): remove special case after the experiment is complete.
-  if (error_code == GOOPDATEDOWNLOAD_E_CACHING_FAILED ||
-      error_code == GOOPDATEINSTALL_E_INSTALLER_FAILED_START) {
-    extra_code1 = error_extra_code1();
-  }
-
-  // The error completion ping is sent whenever the application ended up in
-  // the error state:
-  // * in the install case always, since any install error is final.
-  // * in the update case only when an update has been available.
-  //
-  // In the update case, it is possible that the code errors out before it
-  // discovers that an update is available. Therefore, there is a window of
-  // uncertainty where the client did not get far enough to know if it was
-  // told by the server to update or not.
-  const bool can_ping = app->is_install() || app->has_update_available();
-  return can_ping ? new PingEvent(event_type, result, error_code, extra_code1) :
-                    NULL;
-}
-
-void AppStateError::DownloadComplete(App* app) {
-  CORE_LOG(L3, (_T("[AppStateError::DownloadComplete][0x%p]"), app));
-  UNREFERENCED_PARAMETER(app);
-}
-
-void AppStateError::MarkReadyToInstall(App* app) {
-  CORE_LOG(L3, (_T("[AppStateError::MarkReadyToInstall][0x%p]"), app));
-  UNREFERENCED_PARAMETER(app);
-}
-
-void AppStateError::PreUpdateCheck(App* app,
-                                   xml::UpdateRequest* update_request) {
-  CORE_LOG(L3, (_T("[AppStateError::PreUpdateCheck][%p]"), app));
-  ASSERT1(app);
-  UNREFERENCED_PARAMETER(app);
-  UNREFERENCED_PARAMETER(update_request);
-}
-
-void AppStateError::PostUpdateCheck(App* app,
-                               HRESULT result,
-                               xml::UpdateResponse* update_response) {
-  CORE_LOG(L3, (_T("[AppStateError::PostUpdateCheck][%p]"), app));
-  ASSERT1(app);
-  UNREFERENCED_PARAMETER(app);
-  UNREFERENCED_PARAMETER(result);
-  UNREFERENCED_PARAMETER(update_response);
-}
-
-void AppStateError::QueueDownload(App* app) {
-  CORE_LOG(L3, (_T("[AppStateError::QueueDownload][%p]"), app));
-  ASSERT1(app);
-  UNREFERENCED_PARAMETER(app);
-}
-
-void AppStateError::QueueDownloadOrInstall(App* app) {
-  CORE_LOG(L3, (_T("[AppStateError::QueueDownloadOrInstall][%p]"), app));
-  ASSERT1(app);
-  UNREFERENCED_PARAMETER(app);
-}
-
-void AppStateError::Download(
-    App* app,
-    DownloadManagerInterface* download_manager) {
-  CORE_LOG(L3, (_T("[AppStateError::Download][0x%p]"), app));
-  ASSERT1(app);
-  ASSERT1(download_manager);
-  UNREFERENCED_PARAMETER(app);
-  UNREFERENCED_PARAMETER(download_manager);
-}
-
-void AppStateError::QueueInstall(App* app) {
-  CORE_LOG(L3, (_T("[AppStateError::QueueInstall][%p]"), app));
-  ASSERT1(app);
-  UNREFERENCED_PARAMETER(app);
-}
-
-void AppStateError::Install(
-    App* app,
-    InstallManagerInterface* install_manager) {
-  CORE_LOG(L3, (_T("[AppStateError::Install][0x%p]"), app));
-  ASSERT1(app);
-  ASSERT1(install_manager);
-  UNREFERENCED_PARAMETER(app);
-  UNREFERENCED_PARAMETER(install_manager);
-}
-
-void AppStateError::Cancel(App* app) {
-  CORE_LOG(L3, (_T("[AppStateError::Cancel][0x%p]"), app));
-  ASSERT1(app);
-  UNREFERENCED_PARAMETER(app);
-}
-
-void AppStateError::Error(App* app,
-                          const ErrorContext& error_context,
-                          const CString& message) {
-  ASSERT1(app);
-  UNREFERENCED_PARAMETER(app);
-  UNREFERENCED_PARAMETER(error_context);
-  UNREFERENCED_PARAMETER(message);
-  CORE_LOG(L3, (_T("[app is already in the Error state]")
-      _T("[0x%p][app error=0x%x][this error=0x%x][%s]"),
-      app, app->error_code(), error_context.error_code, message));
-}
-
-}  // namespace fsm
-
-}  // namespace omaha
diff --git a/goopdate/app_state_error.h b/goopdate/app_state_error.h
deleted file mode 100644
index f759f72..0000000
--- a/goopdate/app_state_error.h
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_APP_STATE_ERROR_H_
-#define OMAHA_GOOPDATE_APP_STATE_ERROR_H_
-
-#include "base/basictypes.h"
-#include "omaha/goopdate/app_state.h"
-
-namespace omaha {
-
-namespace fsm {
-
-// The error state is idempotent. Further transitions from error state into
-// itself are allowed but have no effect. Therefore, the first error wins. One
-// scenario where this occurs is canceling the app. Canceling the app is not
-// blocking and it moves the app in the error state right away. The Error
-// method is called a second time, as the actual cancel code executes in the
-// thread pool.
-class AppStateError : public AppState {
- public:
-  AppStateError();
-  virtual ~AppStateError() {}
-
-  virtual const PingEvent* CreatePingEvent(App* app,
-                                           CurrentState previous_state) const;
-
-  // These calls are legal in this state but do nothing. This can occur when
-  // this app has encountered an error but bundle is still being processed.
-  // For instance, when cancelling a bundle during a download, the applications
-  // transition right away in the error state. The cancel event is handled at
-  // some point in the future. Depending on a race condition, the downloads may
-  // have succeeded or failed due to the cancellation. The race condition is
-  // resolved when the transition call reaches this object and the call is
-  // ignored.
-  virtual void DownloadComplete(App* app);
-  virtual void MarkReadyToInstall(App* app);
-
-  // These calls are legal in this state but do nothing. This can occur when
-  // this app has encountered an error or has been canceled but bundle is still
-  // being processed.
-  virtual void PreUpdateCheck(App* app, xml::UpdateRequest* update_request);
-  virtual void PostUpdateCheck(App* app,
-                               HRESULT result,
-                               xml::UpdateResponse* update_response);
-  virtual void QueueDownload(App* app);
-  virtual void QueueDownloadOrInstall(App* app);
-  virtual void Download(App* app, DownloadManagerInterface* download_manager);
-  virtual void QueueInstall(App* app);
-  virtual void Install(App* app, InstallManagerInterface* install_manager);
-
-  // Canceling while in a terminal state has no effect.
-  virtual void Cancel(App* app);
-
-  virtual void Error(App* app,
-                     const ErrorContext& error_context,
-                     const CString& message);
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(AppStateError);
-};
-
-}  // namespace fsm
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_STATE_ERROR_H_
diff --git a/goopdate/app_state_init.cc b/goopdate/app_state_init.cc
deleted file mode 100644
index b397a6b..0000000
--- a/goopdate/app_state_init.cc
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_state_init.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/goopdate/app_state_waiting_to_check_for_update.h"
-#include "omaha/goopdate/model.h"
-
-namespace omaha {
-
-namespace fsm {
-
-AppStateInit::AppStateInit() : AppState(STATE_INIT) {
-}
-
-void AppStateInit::QueueUpdateCheck(App* app) {
-  CORE_LOG(L3, (_T("[AppStateInit::QueueUpdateCheck][0x%p]"), app));
-  ASSERT1(app);
-
-  // Omaha should never be part of an app bundle in the install case. This is
-  // an important debug check to ensure that duplicate pings are not sent.
-  ASSERT1(!::IsEqualGUID(kGoopdateGuid, app->app_guid()) || app->is_update());
-  ChangeState(app, new AppStateWaitingToCheckForUpdate);
-}
-
-}  // namespace fsm
-
-}  // namespace omaha
diff --git a/goopdate/app_state_init.h b/goopdate/app_state_init.h
deleted file mode 100644
index 603abb3..0000000
--- a/goopdate/app_state_init.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_APP_STATE_INIT_H_
-#define OMAHA_GOOPDATE_APP_STATE_INIT_H_
-
-#include "base/basictypes.h"
-#include "omaha/goopdate/app_state.h"
-
-namespace omaha {
-
-namespace fsm {
-
-class AppStateInit : public AppState {
- public:
-  AppStateInit();
-  virtual ~AppStateInit() {}
-
-  virtual void QueueUpdateCheck(App* app);
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(AppStateInit);
-};
-
-}  // namespace fsm
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_STATE_INIT_H_
-
diff --git a/goopdate/app_state_install_complete.cc b/goopdate/app_state_install_complete.cc
deleted file mode 100644
index 3a3d0ef..0000000
--- a/goopdate/app_state_install_complete.cc
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/common/config_manager.h"
-#include "omaha/goopdate/app_state_install_complete.h"
-#include "omaha/base/logging.h"
-#include "omaha/goopdate/model.h"
-#include "omaha/goopdate/worker.h"
-
-namespace omaha {
-
-namespace fsm {
-
-AppStateInstallComplete::AppStateInstallComplete(App* app)
-    : AppState(STATE_INSTALL_COMPLETE) {
-  ASSERT1(app);
-
-  // Start the crash handler if an installer has indicated that it requires OOP
-  // crash handling.
-  bool is_machine = app->app_bundle()->is_machine();
-  if (ConfigManager::Instance()->CanCollectStats(is_machine) &&
-      (!is_machine || user_info::IsRunningAsSystem())) {
-    VERIFY1(SUCCEEDED(goopdate_utils::StartCrashHandler(is_machine)));
-  }
-
-  VERIFY1(SUCCEEDED(app->model()->PurgeAppLowerVersions(
-      app->app_guid_string(), app->next_version()->version())));
-}
-
-// Omaha installs and updates are two-step processes. Omaha is handled as a
-// special case in both installs and updates.
-//
-// In the install case, Omaha itself is installed by the /install process, which
-// is responsible for pinging. Omaha is never part of the bundle in this case.
-//
-// In update case, the Omaha update is run as a /update process first.
-// The install manager does not wait for that process to complete and, if the
-// launch of it was successful, it transitions the Omaha app into the install
-// complete state. No ping should be sent in this case. Next, the update process
-// runs, finishes the update of Omaha, and then it sends the
-// EVENT_UPDATE_COMPLETE ping.
-const PingEvent* AppStateInstallComplete::CreatePingEvent(
-    App* app,
-    CurrentState previous_state) const {
-  ASSERT1(app);
-  UNREFERENCED_PARAMETER(previous_state);
-
-  const PingEvent::Types event_type(app->is_update() ?
-      PingEvent::EVENT_UPDATE_COMPLETE :
-      PingEvent::EVENT_INSTALL_COMPLETE);
-
-  const bool is_omaha = !!::IsEqualGUID(kGoopdateGuid, app->app_guid());
-
-  const bool can_ping = !is_omaha;
-
-  const HRESULT error_code(app->error_code());
-  ASSERT1(SUCCEEDED(error_code));
-
-  return can_ping ?
-      new PingEvent(event_type, GetCompletionResult(*app), error_code, 0) :
-      NULL;
-}
-
-// Canceling while in a terminal state has no effect.
-void AppStateInstallComplete::Cancel(App* app) {
-  CORE_LOG(L3, (_T("[AppStateInstallComplete::Cancel][0x%p]"), app));
-  UNREFERENCED_PARAMETER(app);
-}
-
-// Terminal states should not transition to error.
-void AppStateInstallComplete::Error(App* app,
-                                    const ErrorContext& error_context,
-                                    const CString& message) {
-  UNREFERENCED_PARAMETER(error_context);
-  UNREFERENCED_PARAMETER(message);
-  HandleInvalidStateTransition(app, _T(__FUNCTION__));
-}
-
-}  // namespace fsm
-
-}  // namespace omaha
diff --git a/goopdate/app_state_install_complete.h b/goopdate/app_state_install_complete.h
deleted file mode 100644
index 8aa16c4..0000000
--- a/goopdate/app_state_install_complete.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_APP_STATE_INSTALL_COMPLETE_H_
-#define OMAHA_GOOPDATE_APP_STATE_INSTALL_COMPLETE_H_
-
-#include "base/basictypes.h"
-#include "omaha/goopdate/app_state.h"
-
-namespace omaha {
-
-namespace fsm {
-
-class AppStateInstallComplete : public AppState {
- public:
-  explicit AppStateInstallComplete(App* app);
-  virtual ~AppStateInstallComplete() {}
-
-  virtual const PingEvent* CreatePingEvent(App* app,
-                                           CurrentState previous_state) const;
-
-  virtual void Cancel(App* app);
-  virtual void Error(App* app,
-                     const ErrorContext& error_context,
-                     const CString& message);
- private:
-  DISALLOW_COPY_AND_ASSIGN(AppStateInstallComplete);
-};
-
-}  // namespace fsm
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_STATE_INSTALL_COMPLETE_H_
diff --git a/goopdate/app_state_installing.cc b/goopdate/app_state_installing.cc
deleted file mode 100644
index c9ac9f7..0000000
--- a/goopdate/app_state_installing.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_state_installing.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/goopdate/app_state_error.h"
-#include "omaha/goopdate/app_state_install_complete.h"
-#include "omaha/goopdate/model.h"
-
-namespace omaha {
-
-namespace fsm {
-
-AppStateInstalling::AppStateInstalling()
-    : AppState(STATE_INSTALLING) {
-}
-
-const PingEvent* AppStateInstalling::CreatePingEvent(
-    App* app,
-    CurrentState previous_state) const {
-  ASSERT1(app);
-  UNREFERENCED_PARAMETER(previous_state);
-
-  const PingEvent::Types event_type(app->is_update() ?
-      PingEvent::EVENT_UPDATE_INSTALLER_START :
-      PingEvent::EVENT_INSTALL_INSTALLER_START);
-
-
-  const HRESULT error_code = app->error_code();
-  ASSERT1(SUCCEEDED(error_code));
-
-  return new PingEvent(event_type, GetCompletionResult(*app), error_code, 0);
-}
-
-// The state does not change if already in the Installing state.
-void AppStateInstalling::Installing(App* app) {
-  CORE_LOG(L3, (_T("[AppStateInstalling::Installing][0x%p]"), app));
-  ASSERT1(app);
-  ASSERT(false, (_T("This might be valid when we support install progress.")));
-
-  UNREFERENCED_PARAMETER(app);
-}
-
-void AppStateInstalling::ReportInstallerComplete(
-    App* app,
-    const InstallerResultInfo& result_info) {
-  CORE_LOG(L3, (_T("[AppStateInstalling::ReportInstallerComplete][%p]"), app));
-  ASSERT1(app);
-
-  app->SetInstallerResult(result_info);
-
-  ChangeState(app, result_info.type == INSTALLER_RESULT_SUCCESS ?
-      static_cast<AppState*>(new AppStateInstallComplete(app)) :
-      static_cast<AppState*>(new AppStateError));
-}
-
-// Cancel in installing state has no effect because currently we cannot cancel
-// installers.. Override the function to avoid moving app into error state.
-// The app will automatically enter the completion state when the installer
-// completes.
-void AppStateInstalling::Cancel(App* app) {
-  CORE_LOG(L3, (_T("[AppStateInstalling::Cancel][0x%p]"), app));
-  ASSERT1(app);
-
-  UNREFERENCED_PARAMETER(app);
-}
-
-}  // namespace fsm
-
-}  // namespace omaha
diff --git a/goopdate/app_state_installing.h b/goopdate/app_state_installing.h
deleted file mode 100644
index 8c33e0f..0000000
--- a/goopdate/app_state_installing.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_APP_STATE_INSTALLING_H_
-#define OMAHA_GOOPDATE_APP_STATE_INSTALLING_H_
-
-#include "base/basictypes.h"
-#include "omaha/goopdate/app_state.h"
-
-namespace omaha {
-
-namespace fsm {
-
-class AppStateInstalling : public AppState {
- public:
-  AppStateInstalling();
-  virtual ~AppStateInstalling() {}
-
-  virtual const PingEvent* CreatePingEvent(App* app,
-                                           CurrentState previous_state) const;
-
-  virtual void Installing(App* app);
-
-  virtual void ReportInstallerComplete(App* app,
-                                       const InstallerResultInfo& result_info);
-
-  virtual void Cancel(App* app);
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(AppStateInstalling);
-};
-
-}  // namespace fsm
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_STATE_INSTALLING_H_
diff --git a/goopdate/app_state_no_update.cc b/goopdate/app_state_no_update.cc
deleted file mode 100644
index 2734b01..0000000
--- a/goopdate/app_state_no_update.cc
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_state_no_update.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/goopdate/model.h"
-
-namespace omaha {
-
-namespace fsm {
-
-AppStateNoUpdate::AppStateNoUpdate() : AppState(STATE_NO_UPDATE) {
-}
-
-const PingEvent* AppStateNoUpdate::CreatePingEvent(
-    App* app,
-    CurrentState previous_state) const {
-  ASSERT1(app);
-  UNREFERENCED_PARAMETER(previous_state);
-
-  // This state corresponds to the update case only. 'No updates' scenario in
-  // the installed case should be handled as errors by the state machine.
-  ASSERT1(app->is_update());
-
-  const PingEvent::Results completion_result = GetCompletionResult(*app);
-  ASSERT1(completion_result == PingEvent::EVENT_RESULT_SUCCESS ||
-          completion_result == PingEvent::EVENT_RESULT_UPDATE_DEFERRED);
-
-  // Creates a ping for deferred updates only.
-  if (completion_result == PingEvent::EVENT_RESULT_UPDATE_DEFERRED) {
-    // Omaha updates should never be deferred.
-    ASSERT1(!::IsEqualGUID(kGoopdateGuid, app->app_guid()));
-
-    const PingEvent::Types event_type(PingEvent::EVENT_UPDATE_COMPLETE);
-
-    const HRESULT error_code(app->error_code());
-    ASSERT1(error_code == GOOPDATE_E_UPDATE_DEFERRED);
-
-    return new PingEvent(event_type, completion_result, error_code, 0);
-  }
-
-  return NULL;
-}
-
-void AppStateNoUpdate::QueueDownload(App* app) {
-  CORE_LOG(L4, (_T("[AppStateNoUpdate::QueueDownload][%p]"), app));
-  ASSERT1(app);
-  UNREFERENCED_PARAMETER(app);
-}
-
-void AppStateNoUpdate::QueueDownloadOrInstall(App* app) {
-  CORE_LOG(L4, (_T("[AppStateNoUpdate::QueueDownloadOrInstall][%p]"), app));
-  ASSERT1(app);
-  UNREFERENCED_PARAMETER(app);
-}
-
-void AppStateNoUpdate::Download(
-    App* app,
-    DownloadManagerInterface* download_manager) {
-  CORE_LOG(L4, (_T("[AppStateNoUpdate::Download][0x%p]"), app));
-  ASSERT1(app);
-  ASSERT1(download_manager);
-  UNREFERENCED_PARAMETER(app);
-  UNREFERENCED_PARAMETER(download_manager);
-}
-
-void AppStateNoUpdate::QueueInstall(App* app) {
-  CORE_LOG(L4, (_T("[AppStateNoUpdate::QueueInstall][%p]"), app));
-  ASSERT1(app);
-  UNREFERENCED_PARAMETER(app);
-}
-
-void AppStateNoUpdate::Install(
-    App* app,
-    InstallManagerInterface* install_manager) {
-  CORE_LOG(L4, (_T("[AppStateNoUpdate::Install][0x%p]"), app));
-  ASSERT1(app);
-  ASSERT1(install_manager);
-  UNREFERENCED_PARAMETER(app);
-  UNREFERENCED_PARAMETER(install_manager);
-}
-
-// Canceling while in a terminal state has no effect.
-void AppStateNoUpdate::Cancel(App* app) {
-  CORE_LOG(L4, (_T("[AppStateNoUpdate::Cancel][0x%p]"), app));
-  ASSERT1(app);
-  UNREFERENCED_PARAMETER(app);
-}
-
-// Terminal states should not transition to error.
-void AppStateNoUpdate::Error(App* app,
-                             const ErrorContext& error_context,
-                             const CString& message) {
-  ASSERT1(app);
-  UNREFERENCED_PARAMETER(error_context);
-  UNREFERENCED_PARAMETER(message);
-  HandleInvalidStateTransition(app, _T(__FUNCTION__));
-}
-
-}  // namespace fsm
-
-}  // namespace omaha
diff --git a/goopdate/app_state_no_update.h b/goopdate/app_state_no_update.h
deleted file mode 100644
index 7a141ae..0000000
--- a/goopdate/app_state_no_update.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_APP_STATE_NO_UPDATE_H_
-#define OMAHA_GOOPDATE_APP_STATE_NO_UPDATE_H_
-
-#include "base/basictypes.h"
-#include "omaha/goopdate/app_state.h"
-
-namespace omaha {
-
-namespace fsm {
-
-class AppStateNoUpdate : public AppState {
- public:
-  AppStateNoUpdate();
-  virtual ~AppStateNoUpdate() {}
-
-  virtual const PingEvent* CreatePingEvent(App* app,
-                                           CurrentState previous_state) const;
-
-  // These calls are legal in this state but do nothing. This can occur when
-  // no update is available for this app but updates are available for other
-  // apps in the bundle.
-  virtual void QueueDownload(App* app);
-  virtual void QueueDownloadOrInstall(App* app);
-  virtual void Download(App* app, DownloadManagerInterface* download_manager);
-  virtual void QueueInstall(App* app);
-  virtual void Install(App* app, InstallManagerInterface* install_manager);
-
-  virtual void Cancel(App* app);
-  virtual void Error(App* app,
-                     const ErrorContext& error_context,
-                     const CString& message);
- private:
-  DISALLOW_COPY_AND_ASSIGN(AppStateNoUpdate);
-};
-
-}  // namespace fsm
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_STATE_NO_UPDATE_H_
diff --git a/goopdate/app_state_ready_to_install.cc b/goopdate/app_state_ready_to_install.cc
deleted file mode 100644
index f467176..0000000
--- a/goopdate/app_state_ready_to_install.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_state_ready_to_install.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/goopdate/app_state_waiting_to_install.h"
-
-namespace omaha {
-
-namespace fsm {
-
-AppStateReadyToInstall::AppStateReadyToInstall()
-    : AppState(STATE_READY_TO_INSTALL) {
-}
-
-void AppStateReadyToInstall::QueueDownloadOrInstall(App* app) {
-  CORE_LOG(L3, (_T("[AppStateReadyToInstall::QueueDownloadOrInstall][0x%p]"),
-                app));
-  ASSERT1(app);
-
-  QueueInstall(app);
-}
-
-void AppStateReadyToInstall::QueueInstall(App* app) {
-  CORE_LOG(L3, (_T("[AppStateReadyToInstall::QueueInstall][%p]"), app));
-  ASSERT1(app);
-
-  ChangeState(app, new AppStateWaitingToInstall);
-}
-
-}  // namespace fsm
-
-}  // namespace omaha
diff --git a/goopdate/app_state_ready_to_install.h b/goopdate/app_state_ready_to_install.h
deleted file mode 100644
index 13337a3..0000000
--- a/goopdate/app_state_ready_to_install.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_APP_STATE_READY_TO_INSTALL_H_
-#define OMAHA_GOOPDATE_APP_STATE_READY_TO_INSTALL_H_
-
-#include "base/basictypes.h"
-#include "omaha/goopdate/app_state.h"
-
-namespace omaha {
-
-namespace fsm {
-
-class AppStateReadyToInstall : public AppState {
- public:
-  AppStateReadyToInstall();
-  virtual ~AppStateReadyToInstall() {}
-
-  // Queues the install since the download is complete.
-  virtual void QueueDownloadOrInstall(App* app);
-
-  virtual void QueueInstall(App* app);
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(AppStateReadyToInstall);
-};
-
-}  // namespace fsm
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_STATE_READY_TO_INSTALL_H_
diff --git a/goopdate/app_state_update_available.cc b/goopdate/app_state_update_available.cc
deleted file mode 100644
index cebdfba..0000000
--- a/goopdate/app_state_update_available.cc
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_state_update_available.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/goopdate/app_state_waiting_to_download.h"
-#include "omaha/goopdate/model.h"
-#include "omaha/goopdate/server_resource.h"
-#include "omaha/goopdate/string_formatter.h"
-
-namespace omaha {
-
-namespace fsm {
-
-AppStateUpdateAvailable::AppStateUpdateAvailable()
-    : AppState(STATE_UPDATE_AVAILABLE) {
-}
-
-void AppStateUpdateAvailable::QueueDownload(App* app) {
-  CORE_LOG(L3, (_T("[AppStateUpdateAvailable::QueueDownload][0x%p]"), app));
-  ASSERT1(app);
-
-  HRESULT policy_hr = app->CheckGroupPolicy();
-  if (FAILED(policy_hr)) {
-    HandleGroupPolicyError(app, policy_hr);
-    return;
-  }
-
-  ChangeState(app, new AppStateWaitingToDownload);
-}
-
-void AppStateUpdateAvailable::QueueDownloadOrInstall(App* app) {
-  CORE_LOG(L3, (_T("[AppStateUpdateAvailable::QueueDownloadOrInstall][0x%p]"),
-                app));
-  ASSERT1(app);
-
-  QueueDownload(app);
-}
-
-void AppStateUpdateAvailable::HandleGroupPolicyError(App* app, HRESULT code) {
-  ASSERT1(app);
-  ASSERT1(code == GOOPDATE_E_APP_INSTALL_DISABLED_BY_POLICY ||
-          code == GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY);
-  CORE_LOG(L1, (_T("[Update available for disabled app][%s]"),
-                app->app_guid_string()));
-  app->LogTextAppendFormat(_T("Status=%s-disabled"),
-                           app->is_update() ? _T("update") : _T("install"));
-
-  StringFormatter formatter(app->app_bundle()->display_language());
-  CString error_message;
-  VERIFY1(SUCCEEDED(formatter.LoadString(
-                        IDS_APP_INSTALL_DISABLED_BY_GROUP_POLICY,
-                        &error_message)));
-  Error(app, ErrorContext(code), error_message);
-}
-
-}  // namespace fsm
-
-}  // namespace omaha
diff --git a/goopdate/app_state_update_available.h b/goopdate/app_state_update_available.h
deleted file mode 100644
index 547bb01..0000000
--- a/goopdate/app_state_update_available.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_APP_STATE_UPDATE_AVAILABLE_H_
-#define OMAHA_GOOPDATE_APP_STATE_UPDATE_AVAILABLE_H_
-
-#include "base/basictypes.h"
-#include "omaha/goopdate/app_state.h"
-
-namespace omaha {
-
-namespace fsm {
-
-class AppStateUpdateAvailable : public AppState {
- public:
-  AppStateUpdateAvailable();
-  virtual ~AppStateUpdateAvailable() {}
-
-  virtual void QueueDownload(App* app);
-
-  // Queues the download. Install will need to be queued separately.
-  virtual void QueueDownloadOrInstall(App* app);
-
- private:
-  // Moves the app to the Error state with an appropriate message.
-  void HandleGroupPolicyError(App* app, HRESULT code);
-
-  DISALLOW_COPY_AND_ASSIGN(AppStateUpdateAvailable);
-};
-
-}  // namespace fsm
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_STATE_UPDATE_AVAILABLE_H_
-
diff --git a/goopdate/app_state_waiting_to_check_for_update.cc b/goopdate/app_state_waiting_to_check_for_update.cc
deleted file mode 100644
index c9e18bd..0000000
--- a/goopdate/app_state_waiting_to_check_for_update.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_state_waiting_to_check_for_update.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/highres_timer-win32.h"
-#include "omaha/base/logging.h"
-#include "omaha/common/update_request.h"
-#include "omaha/goopdate/app_manager.h"
-#include "omaha/goopdate/app_state_checking_for_update.h"
-#include "omaha/goopdate/update_request_utils.h"
-#include "omaha/goopdate/model.h"
-#include "omaha/goopdate/server_resource.h"
-#include "omaha/goopdate/string_formatter.h"
-#include "omaha/goopdate/worker.h"
-#include "omaha/goopdate/worker_metrics.h"
-
-namespace omaha {
-
-namespace fsm {
-
-AppStateWaitingToCheckForUpdate::AppStateWaitingToCheckForUpdate()
-    : AppState(STATE_WAITING_TO_CHECK_FOR_UPDATE) {
-}
-
-void AppStateWaitingToCheckForUpdate::PreUpdateCheck(
-    App* app,
-    xml::UpdateRequest* update_request) {
-  CORE_LOG(L3, (_T("[AppStateWaitingToCheckForUpdate::PreUpdateCheck]")));
-  ASSERT1(app);
-  ASSERT1(update_request);
-
-  ASSERT1(app->model()->IsLockedByCaller());
-
-  const CString& current_version(app->current_version()->version());
-  if (!current_version.IsEmpty()) {
-    app->model()->PurgeAppLowerVersions(app->app_guid_string(),
-                                        current_version);
-  }
-
-  AppManager* app_manager(AppManager::Instance());
-
-  VERIFY1(SUCCEEDED(app_manager->SynchronizeClientState(app->app_guid())));
-
-  // Handle the normal flow and return. Abnormal cases are below.
-  if (app->is_eula_accepted()) {
-    update_request_utils::BuildRequest(app, true, update_request);
-    ChangeState(app, new AppStateCheckingForUpdate);
-    return;
-  }
-
-  // The app's EULA has not been accepted, so do not add this app to the update
-  // check. This means bundle size does not always match the request size.
-
-  ASSERT1(app->app_guid() != kGoopdateGuid);
-
-  // TODO(omaha3): Is there a better way to do this such that we don't need to
-  // know about offline installs here?
-  if (app->app_bundle()->is_offline_install()) {
-    // Offline installs do not need requests, so skip building the request.
-    ChangeState(app, new AppStateCheckingForUpdate);
-    return;
-  }
-
-  ASSERT1(app->is_update());
-  metric_worker_apps_not_updated_eula++;
-
-  StringFormatter formatter(app->app_bundle()->display_language());
-  CString message;
-  VERIFY1(SUCCEEDED(formatter.LoadString(IDS_INSTALL_FAILED, &message)));
-  Error(app,
-        ErrorContext(GOOPDATE_E_APP_UPDATE_DISABLED_EULA_NOT_ACCEPTED),
-        message);
-}
-
-}  // namespace fsm
-
-}  // namespace omaha
diff --git a/goopdate/app_state_waiting_to_check_for_update.h b/goopdate/app_state_waiting_to_check_for_update.h
deleted file mode 100644
index 9276363..0000000
--- a/goopdate/app_state_waiting_to_check_for_update.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_APP_STATE_WAITING_TO_CHECK_FOR_UPDATE_H_
-#define OMAHA_GOOPDATE_APP_STATE_WAITING_TO_CHECK_FOR_UPDATE_H_
-
-#include "base/basictypes.h"
-#include "omaha/goopdate/app_state.h"
-
-namespace omaha {
-
-namespace fsm {
-
-class AppStateWaitingToCheckForUpdate : public AppState {
- public:
-  AppStateWaitingToCheckForUpdate();
-  virtual ~AppStateWaitingToCheckForUpdate() {}
-
-  virtual void PreUpdateCheck(App* app, xml::UpdateRequest* update_request);
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(AppStateWaitingToCheckForUpdate);
-};
-
-}  // namespace fsm
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_STATE_WAITING_TO_CHECK_FOR_UPDATE_H_
-
diff --git a/goopdate/app_state_waiting_to_download.cc b/goopdate/app_state_waiting_to_download.cc
deleted file mode 100644
index 284d207..0000000
--- a/goopdate/app_state_waiting_to_download.cc
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_state_waiting_to_download.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/goopdate/app_state_download_complete.h"
-#include "omaha/goopdate/app_state_downloading.h"
-#include "omaha/goopdate/download_manager.h"
-#include "omaha/goopdate/model.h"
-
-namespace omaha {
-
-namespace fsm {
-
-AppStateWaitingToDownload::AppStateWaitingToDownload()
-    : AppState(STATE_WAITING_TO_DOWNLOAD) {
-}
-
-const PingEvent* AppStateWaitingToDownload::CreatePingEvent(
-    App* app,
-    CurrentState previous_state) const {
-  ASSERT1(app);
-  UNREFERENCED_PARAMETER(previous_state);
-
-  // Omaha 3 reports this ping later than Omaha 2 because the COM server does
-  // not know the client's intent when doing the update check.
-  const PingEvent::Types event_type(app->is_update() ?
-      PingEvent::EVENT_UPDATE_APPLICATION_BEGIN :
-      PingEvent::EVENT_INSTALL_APPLICATION_BEGIN);
-
-  const HRESULT error_code = app->error_code();
-  ASSERT1(SUCCEEDED(error_code));
-
-  return new PingEvent(event_type, GetCompletionResult(*app), error_code, 0);
-}
-
-void AppStateWaitingToDownload::Download(
-    App* app,
-    DownloadManagerInterface* download_manager) {
-  CORE_LOG(L3, (_T("[AppStateWaitingToDownload::Download][0x%p]"), app));
-  ASSERT1(app);
-  ASSERT1(download_manager);
-
-  app->SetDownloadStartTime();
-
-  // This is a blocking call on the network.
-  HRESULT hr = download_manager->DownloadApp(app);
-
-  app->LogTextAppendFormat(_T("Download result=0x%08x"), hr);
-}
-
-void AppStateWaitingToDownload::Downloading(App* app) {
-  CORE_LOG(L3, (_T("[AppStateWaitingToDownload::Downloading][%p]"), app));
-  ASSERT1(app);
-
-  ChangeState(app, new AppStateDownloading);
-}
-
-void AppStateWaitingToDownload::DownloadComplete(App* app) {
-  CORE_LOG(L3, (_T("[AppStateWaitingToDownload::DownloadComplete][%p]"), app));
-  CORE_LOG(L3, (_T("[Did not download anything - likely because all packages ")
-                _T("were cached - or OnProgress callback was never called.]")));
-  ASSERT1(app);
-
-  ChangeState(app, new AppStateDownloadComplete);
-}
-
-}  // namespace fsm
-
-}  // namespace omaha
-
diff --git a/goopdate/app_state_waiting_to_download.h b/goopdate/app_state_waiting_to_download.h
deleted file mode 100644
index ccdc359..0000000
--- a/goopdate/app_state_waiting_to_download.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_APP_STATE_WAITING_TO_DOWNLOAD_H_
-#define OMAHA_GOOPDATE_APP_STATE_WAITING_TO_DOWNLOAD_H_
-
-#include "base/basictypes.h"
-#include "omaha/goopdate/app_state.h"
-
-namespace omaha {
-
-namespace fsm {
-
-class AppStateWaitingToDownload : public AppState {
- public:
-  AppStateWaitingToDownload();
-  virtual ~AppStateWaitingToDownload() {}
-
-  virtual const PingEvent* CreatePingEvent(App* app,
-                                           CurrentState previous_state) const;
-
-  virtual void Download(App* app, DownloadManagerInterface* download_manager);
-  virtual void Downloading(App* app);
-  virtual void DownloadComplete(App* app);
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(AppStateWaitingToDownload);
-};
-
-}  // namespace fsm
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_STATE_WAITING_TO_DOWNLOAD_H_
-
diff --git a/goopdate/app_state_waiting_to_install.cc b/goopdate/app_state_waiting_to_install.cc
deleted file mode 100644
index ddd4ace..0000000
--- a/goopdate/app_state_waiting_to_install.cc
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_state_waiting_to_install.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/file.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/path.h"
-#include "omaha/base/utils.h"
-#include "omaha/goopdate/app_state_installing.h"
-#include "omaha/goopdate/install_manager.h"
-#include "omaha/goopdate/model.h"
-#include "omaha/goopdate/server_resource.h"
-#include "omaha/goopdate/string_formatter.h"
-
-namespace omaha {
-
-namespace fsm {
-
-AppStateWaitingToInstall::AppStateWaitingToInstall()
-    : AppState(STATE_WAITING_TO_INSTALL) {
-}
-
-void AppStateWaitingToInstall::Download(
-    App* app,
-    DownloadManagerInterface* download_manager) {
-  CORE_LOG(L3, (_T("[AppStateWaitingToInstall::Download][0x%p]"), app));
-  ASSERT1(app);
-  ASSERT1(download_manager);
-  UNREFERENCED_PARAMETER(app);
-  UNREFERENCED_PARAMETER(download_manager);
-}
-
-void AppStateWaitingToInstall::QueueInstall(App* app) {
-  CORE_LOG(L3, (_T("[AppStateWaitingToInstall::QueueInstall][%p]"), app));
-  ASSERT1(app);
-  UNREFERENCED_PARAMETER(app);
-}
-
-// Copies app packages and runs the installer. The packages are cleaned up
-// by the InstallManager constructor, when its instance will be created by
-// the next COM server that starts up.
-void AppStateWaitingToInstall::Install(
-    App* app,
-    InstallManagerInterface* install_manager) {
-  CORE_LOG(L3, (_T("[AppStateWaitingToInstall::Install][0x%p]"), app));
-  ASSERT1(app);
-  ASSERT1(install_manager);
-
-  CString guid;
-  HRESULT hr(GetGuid(&guid));
-  if (SUCCEEDED(hr)) {
-    const CString installer_dir(
-        ConcatenatePath(install_manager->install_working_dir(), guid));
-    hr = CopyAppVersionPackages(app->next_version(), installer_dir);
-    if (SUCCEEDED(hr)) {
-      install_manager->InstallApp(app, installer_dir);
-    }
-  }
-
-  if (FAILED(hr)) {
-    StringFormatter formatter(app->app_bundle()->display_language());
-    CString message;
-    VERIFY1(SUCCEEDED(formatter.LoadString(IDS_INSTALL_FAILED, &message)));
-    Error(app, ErrorContext(hr), message);
-  }
-}
-
-void AppStateWaitingToInstall::Installing(App* app) {
-  CORE_LOG(L3, (_T("[AppStateWaitingToInstall::Installing][%p]"), app));
-  ASSERT1(app);
-
-  ChangeState(app, new AppStateInstalling);
-}
-
-}  // namespace fsm
-
-}  // namespace omaha
diff --git a/goopdate/app_state_waiting_to_install.h b/goopdate/app_state_waiting_to_install.h
deleted file mode 100644
index 8864c9f..0000000
--- a/goopdate/app_state_waiting_to_install.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_APP_STATE_WAITING_TO_INSTALL_H_
-#define OMAHA_GOOPDATE_APP_STATE_WAITING_TO_INSTALL_H_
-
-#include "base/basictypes.h"
-#include "omaha/goopdate/app_state.h"
-
-namespace omaha {
-
-namespace fsm {
-
-class AppStateWaitingToInstall : public AppState {
- public:
-  AppStateWaitingToInstall();
-  virtual ~AppStateWaitingToInstall() {}
-
-  // These calls are legal in this state but do nothing. This can occur when the
-  // app has already been downloaded and the client calls AppBundle::install().
-  virtual void Download(App* app, DownloadManagerInterface* download_manager);
-  virtual void QueueInstall(App* app);
-
-  virtual void Install(App* app, InstallManagerInterface* install_manager);
-  virtual void Installing(App* app);
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(AppStateWaitingToInstall);
-};
-
-}  // namespace fsm
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_STATE_WAITING_TO_INSTALL_H_
diff --git a/goopdate/app_unittest.cc b/goopdate/app_unittest.cc
deleted file mode 100644
index f239890..0000000
--- a/goopdate/app_unittest.cc
+++ /dev/null
@@ -1,527 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <atlbase.h>
-#include <atlcom.h>
-#include "omaha/base/error.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/const_group_policy.h"
-#include "omaha/common/update_request.h"
-#include "omaha/common/update_response.h"
-#include "omaha/goopdate/app_state_checking_for_update.h"
-#include "omaha/goopdate/app_state_update_available.h"
-#include "omaha/goopdate/app_state_waiting_to_check_for_update.h"
-#include "omaha/goopdate/app_unittest_base.h"
-#include "omaha/testing/unit_test.h"
-
-using ::testing::_;
-
-namespace omaha {
-
-namespace {
-
-#define APP_ID1 _T("{D9F05AEA-BEDA-4f91-B216-BE45DAE330CB}");
-const TCHAR* const kAppId1 = APP_ID1
-const TCHAR* const kInstallPolicyApp1 = _T("Install") APP_ID1;
-const TCHAR* const kUpdatePolicyApp1 = _T("Update") APP_ID1;
-const TCHAR* const kAppId1ClientsKeyPathUser =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\")
-                           PRODUCT_NAME _T("\\Clients\\") APP_ID1;
-const TCHAR* const kGuid1ClientStateKeyPathUser =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\")
-                           PRODUCT_NAME _T("\\ClientState\\") APP_ID1;
-
-#define APP_ID2 _T("{EF3CACD4-89EB-46b7-B9BF-B16B15F08584}");
-const TCHAR* const kInstallPolicyApp2 = _T("Install") APP_ID2;
-const TCHAR* const kUpdatePolicyApp2 = _T("Update") APP_ID2;
-
-void SetPolicy(const CString& policy, DWORD value) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kRegKeyGoopdateGroupPolicy,
-                                    policy,
-                                    value));
-}
-
-}  // namespace
-
-class AppTest : public AppTestBaseWithRegistryOverride {
- protected:
-  explicit AppTest(bool use_strict_mock)
-      : AppTestBaseWithRegistryOverride(false,  // Always as user for now.
-                                        use_strict_mock),
-        app_(NULL) {}
-
-  virtual void SetUp() {
-    AppTestBaseWithRegistryOverride::SetUp();
-
-    update_response_.reset(xml::UpdateResponse::Create());
-  }
-
-  void AddAppResponse(const CString& status) {
-    xml::response::App app;
-    app.status = kResponseStatusOkValue;
-    app.appid = kAppId1;
-    app.update_check.status = status;
-
-    xml::response::Response response;
-    response.apps.push_back(app);
-
-    SetResponseForUnitTest(update_response_.get(), response);
-  }
-
-  App* app_;
-  scoped_ptr<xml::UpdateResponse> update_response_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(AppTest);
-};
-
-class AppInstallTest : public AppTest {
- protected:
-  AppInstallTest() : AppTest(true) {}
-
-  virtual void SetUp() {
-    AppTest::SetUp();
-    EXPECT_SUCCEEDED(
-        app_bundle_->createApp(CComBSTR(kAppId1), &app_));
-    ASSERT_TRUE(app_);
-  }
-};
-
-class AppManualUpdateTest : public AppTest {
- protected:
-  AppManualUpdateTest() : AppTest(true) {}
-  explicit AppManualUpdateTest(bool use_strict_mock)
-      : AppTest(use_strict_mock) {}
-
-  // Calling checkForUpdate() should leave AppBundle::is_auto_update as false.
-  virtual void SetUp() {
-    AppTest::SetUp();
-    EXPECT_SUCCEEDED(RegKey::SetValue(kAppId1ClientsKeyPathUser,
-                                      kRegValueProductVersion,
-                                      _T("1.2.3.4")));
-    EXPECT_SUCCEEDED(RegKey::SetValue(kAppId1ClientsKeyPathUser,
-                                      kRegValueAppName,
-                                      _T("Unit Test App")));
-    EXPECT_SUCCEEDED(app_bundle_->createInstalledApp(
-                         CComBSTR(kAppId1), &app_));
-    ASSERT_TRUE(app_);
-
-    EXPECT_CALL(*mock_worker_, CheckForUpdateAsync(_)).Times(1);
-    EXPECT_SUCCEEDED(app_bundle_->checkForUpdate());
-    EXPECT_FALSE(app_bundle_->is_auto_update());
-  }
-};
-
-class AppAutoUpdateTest : public AppManualUpdateTest  {
- protected:
-  AppAutoUpdateTest() : AppManualUpdateTest(false) {}
-
-  // Calling UpdateAllAppsAsync() sets AppBundle::is_auto_update.
-  virtual void SetUp() {
-    AppTest::SetUp();
-    EXPECT_SUCCEEDED(RegKey::SetValue(kAppId1ClientsKeyPathUser,
-                                      kRegValueProductVersion,
-                                      _T("1.2.3.4")));
-    EXPECT_SUCCEEDED(RegKey::SetValue(kGuid1ClientStateKeyPathUser,
-                                      kRegValueProductVersion,
-                                      _T("1.2.3.4")));
-    EXPECT_SUCCEEDED(RegKey::SetValue(kAppId1ClientsKeyPathUser,
-                                      kRegValueAppName,
-                                      _T("Unit Test App")));
-
-    EXPECT_CALL(*mock_worker_, UpdateAllAppsAsync(_)).Times(1);
-    EXPECT_SUCCEEDED(app_bundle_->updateAllApps());
-    EXPECT_TRUE(app_bundle_->is_auto_update());
-
-    app_= app_bundle_->GetApp(0);
-    ASSERT_TRUE(app_);
-  }
-};
-
-//
-// CheckGroupPolicy Tests.
-//
-
-TEST_F(AppInstallTest, CheckGroupPolicy_NoPolicy) {
-  EXPECT_SUCCEEDED(app_->CheckGroupPolicy());
-}
-
-TEST_F(AppManualUpdateTest, CheckGroupPolicy_NoPolicy) {
-  EXPECT_SUCCEEDED(app_->CheckGroupPolicy());
-}
-
-TEST_F(AppAutoUpdateTest, CheckGroupPolicy_NoPolicy) {
-  EXPECT_SUCCEEDED(app_->CheckGroupPolicy());
-}
-
-TEST_F(AppInstallTest, CheckGroupPolicy_InstallDisabled) {
-  SetPolicy(kInstallPolicyApp1, kPolicyDisabled);
-  EXPECT_EQ(GOOPDATE_E_APP_INSTALL_DISABLED_BY_POLICY,
-            app_->CheckGroupPolicy());
-}
-
-TEST_F(AppManualUpdateTest, CheckGroupPolicy_InstallDisabled) {
-  SetPolicy(kInstallPolicyApp1, kPolicyDisabled);
-  EXPECT_SUCCEEDED(app_->CheckGroupPolicy());
-}
-
-TEST_F(AppAutoUpdateTest, CheckGroupPolicy_InstallDisabled) {
-  SetPolicy(kInstallPolicyApp1, kPolicyDisabled);
-  EXPECT_SUCCEEDED(app_->CheckGroupPolicy());
-}
-
-TEST_F(AppInstallTest, CheckGroupPolicy_AllUpdatesDisabled) {
-  SetPolicy(kUpdatePolicyApp1, kPolicyDisabled);
-  EXPECT_SUCCEEDED(app_->CheckGroupPolicy());
-}
-
-TEST_F(AppManualUpdateTest, CheckGroupPolicy_AllUpdatesDisabled) {
-  SetPolicy(kUpdatePolicyApp1, kPolicyDisabled);
-  EXPECT_EQ(GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY, app_->CheckGroupPolicy());
-}
-
-TEST_F(AppAutoUpdateTest, CheckGroupPolicy_AllUpdatesDisabled) {
-  SetPolicy(kUpdatePolicyApp1, kPolicyDisabled);
-  EXPECT_EQ(GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY, app_->CheckGroupPolicy());
-}
-
-TEST_F(AppInstallTest, CheckGroupPolicy_AutoUpdatesDisabled) {
-  SetPolicy(kUpdatePolicyApp1, kPolicyManualUpdatesOnly);
-  EXPECT_SUCCEEDED(app_->CheckGroupPolicy());
-}
-
-TEST_F(AppManualUpdateTest, CheckGroupPolicy_AutoUpdatesDisabled) {
-  SetPolicy(kUpdatePolicyApp1, kPolicyManualUpdatesOnly);
-  EXPECT_SUCCEEDED(app_->CheckGroupPolicy());
-}
-
-TEST_F(AppAutoUpdateTest, CheckGroupPolicy_AutoUpdatesDisabled) {
-  SetPolicy(kUpdatePolicyApp1, kPolicyManualUpdatesOnly);
-  EXPECT_EQ(GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY, app_->CheckGroupPolicy());
-}
-
-//
-// PostUpdateCheck Tests.
-//
-
-TEST_F(AppInstallTest, PostUpdateCheck_NoUpdate) {
-  SetAppStateForUnitTest(app_, new fsm::AppStateCheckingForUpdate);
-  AddAppResponse(kResponseStatusNoUpdate);
-
-  app_->PostUpdateCheck(S_OK, update_response_.get());
-  EXPECT_EQ(STATE_ERROR, app_->state());
-  EXPECT_EQ(GOOPDATE_E_NO_UPDATE_RESPONSE, app_->error_code());
-}
-
-TEST_F(AppInstallTest, PostUpdateCheck_UpdateAvailable) {
-  SetAppStateForUnitTest(app_, new fsm::AppStateCheckingForUpdate);
-  AddAppResponse(kResponseStatusOkValue);
-
-  app_->PostUpdateCheck(S_OK, update_response_.get());
-  EXPECT_EQ(STATE_UPDATE_AVAILABLE, app_->state());
-  EXPECT_EQ(S_OK, app_->error_code());
-}
-
-// Policy is not checked by this function.
-TEST_F(AppInstallTest, PostUpdateCheck_UpdateAvailable_InstallDisabled) {
-  SetPolicy(kInstallPolicyApp1, kPolicyDisabled);
-  SetAppStateForUnitTest(app_, new fsm::AppStateCheckingForUpdate);
-  AddAppResponse(kResponseStatusOkValue);
-
-  app_->PostUpdateCheck(S_OK, update_response_.get());
-  EXPECT_EQ(STATE_UPDATE_AVAILABLE, app_->state());
-  EXPECT_EQ(S_OK, app_->error_code());
-}
-
-TEST_F(AppManualUpdateTest, PostUpdateCheck_NoUpdate) {
-  SetAppStateForUnitTest(app_, new fsm::AppStateCheckingForUpdate);
-  AddAppResponse(kResponseStatusNoUpdate);
-
-  app_->PostUpdateCheck(S_OK, update_response_.get());
-  EXPECT_EQ(STATE_NO_UPDATE, app_->state());
-  EXPECT_EQ(0, app_->error_code());
-}
-
-TEST_F(AppManualUpdateTest, PostUpdateCheck_UpdateAvailable) {
-  SetAppStateForUnitTest(app_, new fsm::AppStateCheckingForUpdate);
-  AddAppResponse(kResponseStatusOkValue);
-
-  app_->PostUpdateCheck(S_OK, update_response_.get());
-  EXPECT_EQ(STATE_UPDATE_AVAILABLE, app_->state());
-  EXPECT_EQ(S_OK, app_->error_code());
-}
-
-// Policy is not checked by this function.
-TEST_F(AppManualUpdateTest,
-       PostUpdateCheck_UpdateAvailable_AllUpdatesDisabled) {
-  SetPolicy(kUpdatePolicyApp1, kPolicyDisabled);
-  SetAppStateForUnitTest(app_, new fsm::AppStateCheckingForUpdate);
-  AddAppResponse(kResponseStatusOkValue);
-
-  app_->PostUpdateCheck(S_OK, update_response_.get());
-  EXPECT_EQ(STATE_UPDATE_AVAILABLE, app_->state());
-  EXPECT_EQ(S_OK, app_->error_code());
-}
-
-TEST_F(AppAutoUpdateTest, PostUpdateCheck_NoUpdate) {
-  SetAppStateForUnitTest(app_, new fsm::AppStateCheckingForUpdate);
-  AddAppResponse(kResponseStatusNoUpdate);
-
-  app_->PostUpdateCheck(S_OK, update_response_.get());
-  EXPECT_EQ(STATE_NO_UPDATE, app_->state());
-  EXPECT_EQ(0, app_->error_code());
-}
-
-TEST_F(AppAutoUpdateTest, PostUpdateCheck_UpdateAvailable) {
-  SetAppStateForUnitTest(app_, new fsm::AppStateCheckingForUpdate);
-  AddAppResponse(kResponseStatusOkValue);
-
-  app_->PostUpdateCheck(S_OK, update_response_.get());
-  EXPECT_EQ(STATE_UPDATE_AVAILABLE, app_->state());
-  EXPECT_EQ(S_OK, app_->error_code());
-}
-
-// Policy is not checked by this function.
-TEST_F(AppAutoUpdateTest, PostUpdateCheck_UpdateAvailable_AllUpdatesDisabled) {
-  SetPolicy(kUpdatePolicyApp1, kPolicyDisabled);
-  SetAppStateForUnitTest(app_, new fsm::AppStateCheckingForUpdate);
-  AddAppResponse(kResponseStatusOkValue);
-
-  app_->PostUpdateCheck(S_OK, update_response_.get());
-  EXPECT_EQ(STATE_UPDATE_AVAILABLE, app_->state());
-  EXPECT_EQ(S_OK, app_->error_code());
-}
-
-//
-// QueueDownload Tests.
-//
-
-TEST_F(AppInstallTest, QueueDownload_NoPolicy) {
-  SetAppStateForUnitTest(app_, new fsm::AppStateUpdateAvailable);
-
-  app_->QueueDownload();
-  EXPECT_EQ(STATE_WAITING_TO_DOWNLOAD, app_->state());
-  EXPECT_EQ(S_OK, app_->error_code());
-}
-
-TEST_F(AppInstallTest, QueueDownload_InstallDisabled) {
-  SetPolicy(kInstallPolicyApp1, kPolicyDisabled);
-  SetAppStateForUnitTest(app_, new fsm::AppStateUpdateAvailable);
-
-  app_->QueueDownload();
-  EXPECT_EQ(STATE_ERROR, app_->state());
-  EXPECT_EQ(GOOPDATE_E_APP_INSTALL_DISABLED_BY_POLICY, app_->error_code());
-}
-
-TEST_F(AppInstallTest,
-       QueueDownload_InstallDisabledForDifferentApp) {
-  SetPolicy(kInstallPolicyApp2, kPolicyDisabled);
-  SetAppStateForUnitTest(app_, new fsm::AppStateUpdateAvailable);
-
-  app_->QueueDownload();
-  EXPECT_EQ(STATE_WAITING_TO_DOWNLOAD, app_->state());
-  EXPECT_EQ(S_OK, app_->error_code());
-}
-
-TEST_F(AppInstallTest, QueueDownload_AllUpdatesDisabled) {
-  SetPolicy(kUpdatePolicyApp1, kPolicyDisabled);
-  SetAppStateForUnitTest(app_, new fsm::AppStateUpdateAvailable);
-
-  app_->QueueDownload();
-  EXPECT_EQ(STATE_WAITING_TO_DOWNLOAD, app_->state());
-  EXPECT_EQ(S_OK, app_->error_code());
-}
-
-TEST_F(AppManualUpdateTest, QueueDownload_NoPolicy) {
-  SetAppStateForUnitTest(app_, new fsm::AppStateUpdateAvailable);
-
-  app_->QueueDownload();
-  EXPECT_EQ(STATE_WAITING_TO_DOWNLOAD, app_->state());
-  EXPECT_EQ(S_OK, app_->error_code());
-}
-
-TEST_F(AppManualUpdateTest, QueueDownload_AllUpdatesDisabled) {
-  SetPolicy(kUpdatePolicyApp1, kPolicyDisabled);
-  SetAppStateForUnitTest(app_, new fsm::AppStateUpdateAvailable);
-
-  app_->QueueDownload();
-  EXPECT_EQ(STATE_ERROR, app_->state());
-  EXPECT_EQ(GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY, app_->error_code());
-}
-
-TEST_F(AppManualUpdateTest,
-       QueueDownload_AllUpdatesDisabledForDifferentApp) {
-  SetPolicy(kUpdatePolicyApp2, kPolicyDisabled);
-  SetAppStateForUnitTest(app_, new fsm::AppStateUpdateAvailable);
-
-  app_->QueueDownload();
-  EXPECT_EQ(STATE_WAITING_TO_DOWNLOAD, app_->state());
-  EXPECT_EQ(S_OK, app_->error_code());
-}
-
-TEST_F(AppManualUpdateTest, QueueDownload_AutoUpdatesDisabled) {
-  SetPolicy(kUpdatePolicyApp1, kPolicyManualUpdatesOnly);
-  SetAppStateForUnitTest(app_, new fsm::AppStateUpdateAvailable);
-
-  app_->QueueDownload();
-  EXPECT_EQ(STATE_WAITING_TO_DOWNLOAD, app_->state());
-  EXPECT_EQ(S_OK, app_->error_code());
-}
-
-TEST_F(AppManualUpdateTest, QueueDownload_InstallDisabled) {
-  SetPolicy(kInstallPolicyApp1, kPolicyDisabled);
-  SetAppStateForUnitTest(app_, new fsm::AppStateUpdateAvailable);
-
-  app_->QueueDownload();
-  EXPECT_EQ(STATE_WAITING_TO_DOWNLOAD, app_->state());
-  EXPECT_EQ(S_OK, app_->error_code());
-}
-
-TEST_F(AppAutoUpdateTest, QueueDownload_AllUpdatesDisabled_NoPolicy) {
-  SetAppStateForUnitTest(app_, new fsm::AppStateUpdateAvailable);
-
-  app_->QueueDownload();
-  EXPECT_EQ(STATE_WAITING_TO_DOWNLOAD, app_->state());
-  EXPECT_EQ(S_OK, app_->error_code());
-}
-
-TEST_F(AppAutoUpdateTest, QueueDownload_AllUpdatesDisabled) {
-  SetPolicy(kUpdatePolicyApp1, kPolicyDisabled);
-  SetAppStateForUnitTest(app_, new fsm::AppStateUpdateAvailable);
-
-  app_->QueueDownload();
-  EXPECT_EQ(STATE_ERROR, app_->state());
-  EXPECT_EQ(GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY, app_->error_code());
-}
-
-TEST_F(AppAutoUpdateTest, QueueDownload_AllUpdatesDisabledForDifferentApp) {
-  SetPolicy(kUpdatePolicyApp2, kPolicyDisabled);
-  SetAppStateForUnitTest(app_, new fsm::AppStateUpdateAvailable);
-
-  app_->QueueDownload();
-  EXPECT_EQ(STATE_WAITING_TO_DOWNLOAD, app_->state());
-  EXPECT_EQ(S_OK, app_->error_code());
-}
-
-TEST_F(AppAutoUpdateTest, QueueDownload_AutoUpdatesDisabled) {
-  SetPolicy(kUpdatePolicyApp1, kPolicyManualUpdatesOnly);
-  SetAppStateForUnitTest(app_, new fsm::AppStateUpdateAvailable);
-
-  app_->QueueDownload();
-  EXPECT_EQ(STATE_ERROR, app_->state());
-  EXPECT_EQ(GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY, app_->error_code());
-}
-
-TEST_F(AppAutoUpdateTest, QueueDownload_InstallDisabled) {
-  SetPolicy(kInstallPolicyApp1, kPolicyDisabled);
-  SetAppStateForUnitTest(app_, new fsm::AppStateUpdateAvailable);
-
-  app_->QueueDownload();
-  EXPECT_EQ(STATE_WAITING_TO_DOWNLOAD, app_->state());
-  EXPECT_EQ(S_OK, app_->error_code());
-}
-
-//
-// PreUpdateCheck Tests.
-//
-
-TEST_F(AppInstallTest, PreUpdateCheck_EulaAccepted) {
-  SetAppStateForUnitTest(app_, new fsm::AppStateWaitingToCheckForUpdate);
-  EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_TRUE));
-
-  scoped_ptr<xml::UpdateRequest> update_request;
-  update_request.reset(xml::UpdateRequest::Create(is_machine_,
-                                                  _T("unittest_sessionid"),
-                                                  _T("unittest_instsource"),
-                                                  CString()));
-  EXPECT_TRUE(update_request->IsEmpty());
-
-  app_->PreUpdateCheck(update_request.get());
-  EXPECT_EQ(STATE_CHECKING_FOR_UPDATE, app_->state());
-  EXPECT_EQ(S_OK, app_->error_code());
-  EXPECT_FALSE(update_request->IsEmpty());
-}
-
-TEST_F(AppAutoUpdateTest, PreUpdateCheck_EulaAccepted) {
-  SetAppStateForUnitTest(app_, new fsm::AppStateWaitingToCheckForUpdate);
-  EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_TRUE));
-
-  scoped_ptr<xml::UpdateRequest> update_request;
-  update_request.reset(xml::UpdateRequest::Create(is_machine_,
-                                                  _T("unittest_sessionid"),
-                                                  _T("unittest_instsource"),
-                                                  CString()));
-  EXPECT_TRUE(update_request->IsEmpty());
-
-  app_->PreUpdateCheck(update_request.get());
-  EXPECT_EQ(STATE_CHECKING_FOR_UPDATE, app_->state());
-  EXPECT_EQ(S_OK, app_->error_code());
-  EXPECT_FALSE(update_request->IsEmpty());
-}
-
-TEST_F(AppInstallTest, PreUpdateCheck_EulaNotAccepted_Online) {
-  SetAppStateForUnitTest(app_, new fsm::AppStateWaitingToCheckForUpdate);
-  EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_FALSE));
-
-  scoped_ptr<xml::UpdateRequest> update_request;
-  update_request.reset(xml::UpdateRequest::Create(is_machine_,
-                                                  _T("unittest_sessionid"),
-                                                  _T("unittest_instsource"),
-                                                  CString()));
-
-  ExpectAsserts expect_asserts;  // Asserts because not is_update.
-
-  app_->PreUpdateCheck(update_request.get());
-  EXPECT_EQ(STATE_ERROR, app_->state());
-  EXPECT_EQ(GOOPDATE_E_APP_UPDATE_DISABLED_EULA_NOT_ACCEPTED,
-            app_->error_code());
-  EXPECT_TRUE(update_request->IsEmpty()) << _T("Should not add request.");
-}
-
-TEST_F(AppInstallTest, PreUpdateCheck_EulaNotAccepted_Offline) {
-  SetAppStateForUnitTest(app_, new fsm::AppStateWaitingToCheckForUpdate);
-  EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_FALSE));
-  EXPECT_SUCCEEDED(app_bundle_->put_offlineDirectory(CComBSTR(_T("foo"))));
-
-  scoped_ptr<xml::UpdateRequest> update_request;
-  update_request.reset(xml::UpdateRequest::Create(is_machine_,
-                                                  _T("unittest_sessionid"),
-                                                  _T("unittest_instsource"),
-                                                  CString()));
-
-  app_->PreUpdateCheck(update_request.get());
-  EXPECT_EQ(STATE_CHECKING_FOR_UPDATE, app_->state());
-  EXPECT_EQ(S_OK, app_->error_code());
-  EXPECT_TRUE(update_request->IsEmpty()) << _T("Should not add request.");
-}
-
-TEST_F(AppAutoUpdateTest, PreUpdateCheck_EulaNotAccepted) {
-  SetAppStateForUnitTest(app_, new fsm::AppStateWaitingToCheckForUpdate);
-  EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_FALSE));
-
-  scoped_ptr<xml::UpdateRequest> update_request;
-  update_request.reset(xml::UpdateRequest::Create(is_machine_,
-                                                  _T("unittest_sessionid"),
-                                                  _T("unittest_instsource"),
-                                                  CString()));
-
-  app_->PreUpdateCheck(update_request.get());
-  EXPECT_EQ(STATE_ERROR, app_->state());
-  EXPECT_EQ(GOOPDATE_E_APP_UPDATE_DISABLED_EULA_NOT_ACCEPTED,
-            app_->error_code());
-  EXPECT_TRUE(update_request->IsEmpty()) << _T("Should not add request.");
-}
-
-}  // namespace omaha
diff --git a/goopdate/app_unittest_base.h b/goopdate/app_unittest_base.h
deleted file mode 100644
index 16ecc5a..0000000
--- a/goopdate/app_unittest_base.h
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Provides a base framework for unit tests that need an App object.
-
-#ifndef OMAHA_GOOPDATE_APP_UNITTEST_BASE_H_
-#define OMAHA_GOOPDATE_APP_UNITTEST_BASE_H_
-
-#include <atlbase.h>
-#include <atlcom.h>
-#include "base/scoped_ptr.h"
-#include "omaha/base/app_util.h"
-#include "omaha/goopdate/app_manager.h"
-#include "omaha/goopdate/app_bundle_state_initialized.h"
-#include "omaha/goopdate/model.h"
-#include "omaha/goopdate/resource_manager.h"
-#include "omaha/goopdate/worker_mock.h"
-#include "omaha/testing/unit_test.h"
-
-using ::testing::Return;
-
-namespace omaha {
-
-// Overrides the registry.
-class AppTestBase : public testing::Test {
- protected:
-  AppTestBase(bool is_machine, bool use_strict_mock)
-      : is_machine_(is_machine),
-        use_strict_mock_(use_strict_mock) {
-  }
-
-  virtual void SetUp() {
-    EXPECT_SUCCEEDED(AppManager::CreateInstance(is_machine_));
-
-    // Needed for error strings.
-    EXPECT_SUCCEEDED(ResourceManager::Create(
-                         is_machine_,
-                         app_util::GetCurrentModuleDirectory(),
-                         _T("en")));
-
-    if (use_strict_mock_) {
-      mock_worker_.reset(new testing::StrictMock<MockWorker>);
-    } else {
-      mock_worker_.reset(new testing::NiceMock<MockWorker>);
-    }
-
-    EXPECT_CALL(*mock_worker_, Lock()).WillRepeatedly(Return(2));
-    EXPECT_CALL(*mock_worker_, Unlock()).WillRepeatedly(Return(1));
-
-    model_.reset(new Model(mock_worker_.get()));
-
-    app_bundle_ = model_->CreateAppBundle(is_machine_);
-    ASSERT_TRUE(app_bundle_.get());
-
-    EXPECT_SUCCEEDED(app_bundle_->put_displayName(CComBSTR(_T("Test Bundle"))));
-    EXPECT_SUCCEEDED(app_bundle_->put_displayLanguage(CComBSTR(_T("en"))));
-    EXPECT_SUCCEEDED(app_bundle_->put_installSource(CComBSTR(_T("unittest"))));
-    // TODO(omaha3): Address with the TODO in AppBundleInitializedTest::SetUp()
-    // then remove app_bundle_state_initialized.h above.
-    if (is_machine_) {
-      SetAppBundleStateForUnitTest(app_bundle_.get(),
-                                   new fsm::AppBundleStateInitialized);
-    } else {
-      EXPECT_SUCCEEDED(app_bundle_->initialize());
-    }
-  }
-
-  virtual void TearDown() {
-    ResourceManager::Delete();
-    AppManager::DeleteInstance();
-  }
-
-  const bool is_machine_;
-  const bool use_strict_mock_;
-
-  CString hive_override_key_name_;
-
-  scoped_ptr<MockWorker> mock_worker_;
-  scoped_ptr<Model> model_;
-
-  shared_ptr<AppBundle> app_bundle_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(AppTestBase);
-};
-
-class AppTestBaseWithRegistryOverride : public AppTestBase {
- protected:
-  AppTestBaseWithRegistryOverride(bool is_machine, bool use_strict_mock)
-      : AppTestBase(is_machine, use_strict_mock),
-        hive_override_key_name_(kRegistryHiveOverrideRoot) {}
-
-  // Override the registry after initializing the AppBundle so that the latter
-  // has the correct network configuration in the event there are pings to send.
-  // TODO(omaha3): Ideally we would not send pings from tests: http://b/2911608.
-  virtual void SetUp() {
-    AppTestBase::SetUp();
-
-    RegKey::DeleteKey(hive_override_key_name_);
-    OverrideRegistryHives(hive_override_key_name_);
-  }
-
-  virtual void TearDown() {
-    RestoreRegistryHives();
-    RegKey::DeleteKey(hive_override_key_name_);
-
-    AppTestBase::TearDown();
-  }
-
-  CString hive_override_key_name_;
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_UNITTEST_BASE_H_
diff --git a/goopdate/app_version.cc b/goopdate/app_version.cc
deleted file mode 100644
index a3bcde0..0000000
--- a/goopdate/app_version.cc
+++ /dev/null
@@ -1,204 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/app_version.h"
-#include <atlsafe.h>
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/utils.h"
-#include "omaha/goopdate/model.h"
-
-namespace omaha {
-
-AppVersion::AppVersion(App* app)
-    : ModelObject(app->model()),
-      app_(app) {
-}
-
-// Destruction of App objects happens within the scope of their parent,
-// which controls the locking.
-AppVersion::~AppVersion() {
-  ASSERT1(model()->IsLockedByCaller());
-
-  for (size_t i = 0; i < packages_.size(); ++i) {
-    delete packages_[i];
-  }
-}
-
-CString AppVersion::version() const {
-  __mutexScope(model()->lock());
-  return version_;
-}
-
-void AppVersion::set_version(const CString& version) {
-  __mutexScope(model()->lock());
-  version_ = version;
-}
-
-App* AppVersion::app() {
-  __mutexScope(model()->lock());
-  return app_;
-}
-
-const App* AppVersion::app() const {
-  __mutexScope(model()->lock());
-  return app_;
-}
-
-// TODO(omaha3): It's unfortunate that the manifest can be empty. We need to
-// make a copy anyway in UpdateResponse::BuildApp, so maybe this class
-// should just expose a manifest object created in the constructor. On the
-// other hand, current_version may not have a manifest, so this would be an
-// empty object. Because the manifest must be created, AppData must friend
-// InstallManager tests and other tests that need a manifest. This could
-// probably be solved through mocking too.
-const xml::InstallManifest* AppVersion::install_manifest() const {
-  __mutexScope(model()->lock());
-  return install_manifest_.get();
-}
-
-void AppVersion::set_install_manifest(xml::InstallManifest* install_manifest) {
-  __mutexScope(model()->lock());
-  ASSERT1(install_manifest);
-  install_manifest_.reset(install_manifest);
-}
-
-size_t AppVersion::GetNumberOfPackages() const {
-  __mutexScope(model()->lock());
-  return packages_.size();
-}
-
-HRESULT AppVersion::AddPackage(const CString& filename,
-                               uint32 size,
-                               const CString& hash) {
-  __mutexScope(model()->lock());
-  Package* package = new Package(this);
-  package->SetFileInfo(filename, size, hash);
-  packages_.push_back(package);
-  return S_OK;
-}
-
-Package* AppVersion::GetPackage(size_t index) {
-  __mutexScope(model()->lock());
-
-  if (index >= GetNumberOfPackages()) {
-    ASSERT1(false);
-    return NULL;
-  }
-
-  return packages_[index];
-}
-
-const Package* AppVersion::GetPackage(size_t index) const {
-  __mutexScope(model()->lock());
-
-  if (index >= GetNumberOfPackages()) {
-    ASSERT1(false);
-    return NULL;
-  }
-
-  return packages_[index];
-}
-
-const std::vector<CString>& AppVersion::download_base_urls() const {
-  __mutexScope(model()->lock());
-  ASSERT1(!download_base_urls_.empty());
-  return download_base_urls_;
-}
-
-HRESULT AppVersion::AddDownloadBaseUrl(const CString& base_url) {
-  __mutexScope(model()->lock());
-  ASSERT1(!base_url.IsEmpty());
-  download_base_urls_.push_back(base_url);
-  return S_OK;
-}
-
-// IAppVersion.
-STDMETHODIMP AppVersion::get_version(BSTR* version) {
-  __mutexScope(model()->lock());
-  ASSERT1(version);
-  *version = version_.AllocSysString();
-  return S_OK;
-}
-
-STDMETHODIMP AppVersion::get_packageCount(long* count) {  // NOLINT
-  __mutexScope(model()->lock());
-
-  *count = GetNumberOfPackages();
-  return S_OK;
-}
-
-STDMETHODIMP AppVersion::get_package(long index, Package** package) {  // NOLINT
-  __mutexScope(model()->lock());
-
-  if (index < 0 || static_cast<size_t>(index) >= GetNumberOfPackages()) {
-    return HRESULT_FROM_WIN32(ERROR_INVALID_INDEX);
-  }
-
-  *package = GetPackage(index);
-  return S_OK;
-}
-
-STDMETHODIMP AppVersionWrapper::get_version(BSTR* version) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_version(version);
-}
-
-STDMETHODIMP AppVersionWrapper::get_packageCount(long* count) {  // NOLINT
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_packageCount(count);
-}
-
-STDMETHODIMP AppVersionWrapper::get_package(long index,  // NOLINT
-                                            IDispatch** package) {
-  __mutexScope(model()->lock());
-
-  Package* p = NULL;
-  HRESULT hr = wrapped_obj()->get_package(index, &p);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return PackageWrapper::Create(controlling_ptr(), p, package);
-}
-
-HRESULT CopyAppVersionPackages(const AppVersion* app_version,
-                               const CString& dir) {
-  ASSERT1(app_version);
-
-  HRESULT hr(CreateDir(dir, NULL));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  for (size_t i = 0; i != app_version->GetNumberOfPackages(); ++i) {
-    const Package* package = app_version->GetPackage(i);
-    ASSERT1(package);
-    if (package) {
-      hr = package->get(CComBSTR(dir));
-      if (FAILED(hr)) {
-        CORE_LOG(LE, (_T("[Package::get failed][%s][%s][0x%x]"),
-            package->filename(), dir, hr));
-        return hr;
-      }
-    }
-  }
-
-  return S_OK;
-}
-
-}  // namespace omaha
diff --git a/goopdate/app_version.h b/goopdate/app_version.h
deleted file mode 100644
index 0f1923c..0000000
--- a/goopdate/app_version.h
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Defines the AppVersion COM object exposed by the model.
-
-#ifndef OMAHA_GOOPDATE_APP_VERSION_H_
-#define OMAHA_GOOPDATE_APP_VERSION_H_
-
-#include <atlbase.h>
-#include <atlcom.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "goopdate/omaha3_idl.h"
-#include "omaha/base/constants.h"
-#include "omaha/common/install_manifest.h"
-#include "omaha/goopdate/com_wrapper_creator.h"
-#include "omaha/goopdate/model_object.h"
-
-namespace omaha {
-
-class App;
-class AppBundle;
-class Package;
-
-class AppVersion : public ModelObject {
- public:
-  explicit AppVersion(App* app);
-  virtual ~AppVersion();
-
-  // IAppVersion.
-  STDMETHOD(get_version)(BSTR* version);
-  STDMETHOD(get_packageCount)(long* count);  // NOLINT
-  STDMETHOD(get_package)(long index, Package** package);  // NOLINT
-
-  App* app();
-  const App* app() const;
-
-  CString version() const;
-  void set_version(const CString& version);
-
-  const xml::InstallManifest* install_manifest() const;
-  void set_install_manifest(xml::InstallManifest* install_manifest);
-
-  // Returns the number of packages that make up this app version.
-  size_t GetNumberOfPackages() const;
-
-  // Gets the package at the specified index.
-  Package* GetPackage(size_t index);
-  const Package* GetPackage(size_t index) const;
-
-  // Adds a package to this app version.
-  HRESULT AddPackage(const CString& filename, uint32 size, const CString& hash);
-
-  // Returns the list of download servers to use in order of preference.
-  const std::vector<CString>& download_base_urls() const;
-
-  // Adds a download server to the list of fallbacks. Servers are attempted in
-  // the order they are added.
-  HRESULT AddDownloadBaseUrl(const CString& server_url);
-
- private:
-
-  // product version "pv".
-  CString version_;
-
-  scoped_ptr<xml::InstallManifest> install_manifest_;
-
-  std::vector<Package*> packages_;
-
-  std::vector<CString> download_base_urls_;
-
-  App* app_;
-
-  DISALLOW_COPY_AND_ASSIGN(AppVersion);
-};
-
-class ATL_NO_VTABLE AppVersionWrapper
-    : public ComWrapper<AppVersionWrapper, AppVersion>,
-      public IDispatchImpl<IAppVersion,
-                           &__uuidof(IAppVersion),
-                           &CAtlModule::m_libid,
-                           kMajorTypeLibVersion,
-                           kMinorTypeLibVersion> {
- public:
-  // IAppVersion.
-  STDMETHOD(get_version)(BSTR* version);
-  STDMETHOD(get_packageCount)(long* count);  // NOLINT
-  STDMETHOD(get_package)(long index, IDispatch** package);  // NOLINT
-
- protected:
-  AppVersionWrapper() {}
-  virtual ~AppVersionWrapper() {}
-
-  BEGIN_COM_MAP(AppVersionWrapper)
-    COM_INTERFACE_ENTRY(IAppVersion)
-    COM_INTERFACE_ENTRY(IDispatch)
-  END_COM_MAP()
-
- private:
-  typedef ComWrapper<AppVersionWrapper, AppVersion> Creator;
-  friend class Creator;
-};
-
-// Copies all packages of an app version to the specified directory.
-HRESULT CopyAppVersionPackages(const AppVersion* app_version,
-                               const CString& dir);
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APP_VERSION_H_
diff --git a/goopdate/app_version_unittest.cc b/goopdate/app_version_unittest.cc
deleted file mode 100644
index e6eff36..0000000
--- a/goopdate/app_version_unittest.cc
+++ /dev/null
@@ -1,146 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <atlbase.h>
-#include <atlcom.h>
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/update3_utils.h"
-#include "omaha/goopdate/model.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-// TODO(omaha): there is a problem with this unit test. The model is built
-// bottom up. This makes it impossible to set the references to parents. Will
-// have to fix the code, eventually using Builder DP to create a bunch of
-// models containing bundles, apps, and such.
-
-#if 0
-
-const TCHAR* const kTestId = _T("{8260D23D-D23B-427F-AF1A-2CE36E6F073B}");
-
-class IDummyUnknownImpl : public IUnknown {
- public:
-  virtual ULONG STDMETHODCALLTYPE AddRef() {
-    return 1;
-  }
-  virtual ULONG STDMETHODCALLTYPE Release() {
-    return 1;
-  }
-  virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, void**) {
-    return E_NOTIMPL;
-  }
-};
-
-class AppVersionTest : public testing::Test {
- protected:
-  LLock lock_;
-};
-
-TEST_F(AppVersionTest, TestReadOnly) {
-  IDummyUnknownImpl dummy_unknown;
-  scoped_ptr<AppVersion> app_version;
-  EXPECT_SUCCEEDED(AppVersion::Create(&lock_,
-                                      &dummy_unknown,
-                                      true,
-                                      address(app_version)));
-
-  CComPtr<IAppDataReadOnly> version_data_ro;
-  EXPECT_SUCCEEDED(update3_utils::GetAppData(app_version.get(),
-                                             &version_data_ro));
-
-  CComPtr<IAppData> version_data_rw;
-  EXPECT_EQ(E_NOINTERFACE,
-            update3_utils::GetAppData(app_version.get(), &version_data_rw));
-
-  // Get the IDispatch interface, and verify that it is a read-only interface.
-  CComPtr<IDispatch> version_data_ro_dispatch;
-  EXPECT_SUCCEEDED(
-      version_data_ro.QueryInterface(&version_data_ro_dispatch));
-
-  CComVariant var;
-  EXPECT_SUCCEEDED(version_data_ro_dispatch.GetPropertyByName(_T("appGuid"),
-                                                              &var));
-  EXPECT_EQ(VT_BSTR, V_VT(&var));
-  EXPECT_STREQ(GuidToString(GUID_NULL), V_BSTR(&var));
-
-  var = kTestId;
-
-  // ITypeInfo::Invoke with a DISPATCH_PROPERTYPUT results in a
-  // DISP_E_BADPARAMCOUNT, and not in a DISP_E_MEMBERNOTFOUND, as I would have
-  // expected.
-  EXPECT_EQ(DISP_E_BADPARAMCOUNT,
-            version_data_ro_dispatch.PutPropertyByName(_T("appGuid"), &var));
-}
-
-TEST_F(AppVersionTest, TestReadWrite) {
-  IDummyUnknownImpl dummy_unknown;
-  scoped_ptr<AppVersion> app_version;
-  EXPECT_SUCCEEDED(AppVersion::Create(&lock_,
-                                      &dummy_unknown,
-                                      false,
-                                      address(app_version)));
-
-  CComPtr<IAppDataReadOnly> version_data_ro;
-  EXPECT_SUCCEEDED(update3_utils::GetAppData(app_version.get(),
-                                             &version_data_ro));
-
-  CComPtr<IAppData> version_data_rw;
-  EXPECT_SUCCEEDED(update3_utils::GetAppData(app_version.get(),
-                                             &version_data_rw));
-
-  CComPtr<IUnknown> version_data_ro_unknown;
-  EXPECT_SUCCEEDED(
-      version_data_ro.QueryInterface(&version_data_ro_unknown));
-
-  CComPtr<IUnknown> version_data_rw_unknown;
-  EXPECT_SUCCEEDED(
-      version_data_rw.QueryInterface(&version_data_rw_unknown));
-
-  // COM identity rule.
-  EXPECT_TRUE(version_data_ro_unknown == version_data_rw_unknown);
-
-  // Get the IDispatch interface, and verify that it is a read-write interface.
-  CComPtr<IDispatch> version_data_rw_dispatch;
-  EXPECT_SUCCEEDED(
-      version_data_rw.QueryInterface(&version_data_rw_dispatch));
-
-  CComVariant var;
-  EXPECT_SUCCEEDED(version_data_rw_dispatch.GetPropertyByName(_T("appGuid"),
-                                                              &var));
-  EXPECT_EQ(VT_BSTR, V_VT(&var));
-  EXPECT_STREQ(GuidToString(GUID_NULL), V_BSTR(&var));
-
-  var = kTestId;
-  EXPECT_SUCCEEDED(version_data_rw_dispatch.PutPropertyByName(_T("appGuid"),
-                                                              &var));
-
-  var.ClearToZero();
-  EXPECT_SUCCEEDED(version_data_rw_dispatch.GetPropertyByName(_T("appGuid"),
-                                                              &var));
-  EXPECT_EQ(VT_BSTR, V_VT(&var));
-  EXPECT_STREQ(kTestId, V_BSTR(&var));
-
-  // Verify that the read-only interface returns the same value for the appGuid.
-  CComBSTR app_id;
-  EXPECT_SUCCEEDED(version_data_ro->get_appId(&app_id));
-  EXPECT_STREQ(kTestId, app_id);
-}
-
-#endif
-
-}  // namespace omaha
diff --git a/goopdate/application_usage_data.cc b/goopdate/application_usage_data.cc
deleted file mode 100644
index f1cf39b..0000000
--- a/goopdate/application_usage_data.cc
+++ /dev/null
@@ -1,337 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/application_usage_data.h"
-#include "omaha/base/const_utils.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/string.h"
-#include "omaha/base/user_info.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/app_registry_utils.h"
-#include "omaha/common/const_goopdate.h"
-
-namespace omaha {
-
-namespace {
-
-HRESULT RegistryReadStringOrDword(const RegKey& key,
-                                  const CString& value_name,
-                                  CString* result) {
-  ASSERT1(result);
-  DWORD type = REG_NONE;
-  DWORD value = 0;
-
-  HRESULT hr = key.GetValueType(value_name, &type);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  switch (type) {
-    case REG_DWORD:
-      hr = key.GetValue(value_name, &value);
-      if (FAILED(hr)) {
-        return hr;
-      }
-      *result = itostr(static_cast<const uint32>(value));
-      return S_OK;
-    case REG_SZ:
-      return key.GetValue(value_name, result);
-    default:
-      return HRESULT_FROM_WIN32(ERROR_DATATYPE_MISMATCH);
-  }
-}
-
-}  // namespace
-
-ApplicationUsageData::ApplicationUsageData(bool is_machine,
-                                           bool check_low_integrity)
-    : exists_(false),
-      did_run_(false),
-      is_machine_(is_machine),
-      is_pre_update_check_(true),
-      check_low_integrity_(check_low_integrity) {
-}
-
-ApplicationUsageData::~ApplicationUsageData() {
-}
-
-HRESULT ApplicationUsageData::ReadDidRun(const CString& app_guid) {
-  CORE_LOG(L4, (_T("[ApplicationUsageData::ReadDidRun][%s]"), app_guid));
-  is_pre_update_check_ = true;
-  HRESULT hr = ProcessDidRun(app_guid);
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[ProcessDidRun failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-ActiveStates ApplicationUsageData::active_state() const {
-  if (exists()) {
-    return did_run() ? ACTIVE_RUN : ACTIVE_NOTRUN;
-  } else {
-    return ACTIVE_UNKNOWN;
-  }
-}
-
-HRESULT ApplicationUsageData::ResetDidRun(const CString& app_guid) {
-  CORE_LOG(L4, (_T("[ApplicationUsageData::ResetDidRun][%s]"), app_guid));
-  is_pre_update_check_ = false;
-  return ProcessDidRun(app_guid);
-}
-
-HRESULT ApplicationUsageData::ProcessDidRun(const CString& app_guid) {
-  CORE_LOG(L4, (_T("[ApplicationUsageData::ProcessDidRun][%s]"), app_guid));
-  return is_machine_ ? ProcessMachineDidRun(app_guid) :
-                       ProcessUserDidRun(app_guid);
-}
-
-HRESULT ApplicationUsageData::ProcessMachineDidRun(const CString& app_guid) {
-  ASSERT1(is_machine_);
-
-  // Logic is as follows:
-  // for each user under HKU\<sid>
-  //   pre/post process HKU\<sid>
-  //   if vista
-  //     pre/post process HKU\<lowintegrity IE>\<sid>
-  // pre/post process HKLM
-  RegKey users_key;
-  HRESULT hr = users_key.Open(USERS_KEY, KEY_READ);
-  if (SUCCEEDED(hr)) {
-    uint32 num_users = users_key.GetSubkeyCount();
-    for (uint32 i = 0; i < num_users; ++i) {
-      CString sub_key_name;
-      hr = users_key.GetSubkeyNameAt(i, &sub_key_name);
-      if (FAILED(hr)) {
-        CORE_LOG(LEVEL_WARNING, (_T("[Key enum failed.][0x%08x][%d][%s]"),
-                                 hr, i, USERS_KEY));
-        continue;
-      }
-
-      CString temp_key = AppendRegKeyPath(USERS_KEY,
-                                          sub_key_name,
-                                          GOOPDATE_REG_RELATIVE_CLIENT_STATE);
-      CString user_state_key_name = AppendRegKeyPath(temp_key, app_guid);
-      hr = ProcessKey(user_state_key_name);
-      if (FAILED(hr)) {
-        CORE_LOG(L4, (_T("[ProcessKey failed][%s][0x%08x]"), app_guid, hr));
-      }
-
-      if (check_low_integrity_) {
-        // If we are running on vista we need to also look at the low
-        // integrity IE key where IE can write to. Note that we cannot
-        // use the IEGetWriteableHKCU function since this function assumes
-        // that we are running with the user's credentials.
-        CString temp_key = AppendRegKeyPath(USERS_KEY,
-                                            sub_key_name,
-                                            USER_REG_VISTA_LOW_INTEGRITY_HKCU);
-        CString li_hkcu_name = AppendRegKeyPath(
-                                   AppendRegKeyPath(
-                                       temp_key,
-                                       sub_key_name,
-                                       GOOPDATE_REG_RELATIVE_CLIENT_STATE),
-                                   app_guid);
-        hr = ProcessKey(li_hkcu_name);
-        if (FAILED(hr)) {
-          CORE_LOG(L4, (_T("[ProcessKey failed][%s][0x%08x]"), app_guid, hr));
-        }
-      }
-    }  // End of for
-
-    // Now Process the machine did run value also.
-    CString machine_state_key_name =
-        app_registry_utils::GetAppClientStateKey(true, app_guid);
-    hr = ProcessBackWardCompatKey(machine_state_key_name);
-    if (FAILED(hr)) {
-      CORE_LOG(L4, (_T("[ProcessBackWardCompatKey failed][0x%08x][%s]"),
-                    hr, machine_state_key_name));
-    }
-  } else {
-    CORE_LOG(LW, (_T("[Key open failed.][0x%08x][%s]"), hr, USERS_KEY));
-  }
-
-  return S_OK;
-}
-
-HRESULT ApplicationUsageData::ProcessUserDidRun(const CString& app_guid) {
-  ASSERT1(!is_machine_);
-
-  // Logic:
-  // Pre/Post process HKCU\
-  // if vista:
-  //    Pre/Post process HKCU\LowIntegrity
-  CString state_key_name = app_registry_utils::GetAppClientStateKey(false,
-                                                                    app_guid);
-  HRESULT hr = ProcessKey(state_key_name);
-  if (FAILED(hr)) {
-      CORE_LOG(L4, (_T("[ProcessKey failed][0x%08x][%s]"),
-                    hr, state_key_name));
-  }
-
-  if (check_low_integrity_) {
-    // If we are running on vista we need to also look at the low
-    // integrity IE key where IE can write to. To avoid loading
-    // ieframe.dll into our process, we just use the registry
-    // key location directly instead of using IEGetWriteableHKCU
-    CString sid;
-    hr = user_info::GetProcessUser(NULL, NULL, &sid);
-    if (FAILED(hr)) {
-      CORE_LOG(LEVEL_WARNING, (_T("[GetProcessUser failed][0x%08x][%s]"),
-                               hr, app_guid));
-      return hr;
-    }
-
-    CString temp_name = AppendRegKeyPath(USER_KEY_NAME,
-                                         USER_REG_VISTA_LOW_INTEGRITY_HKCU,
-                                         sid);
-    CString lowintegrity_hkcu_name = AppendRegKeyPath(
-                                         temp_name,
-                                         GOOPDATE_REG_RELATIVE_CLIENT_STATE,
-                                         app_guid);
-    hr = ProcessKey(lowintegrity_hkcu_name);
-    if (FAILED(hr)) {
-      CORE_LOG(LEVEL_WARNING, (_T("[Could not ProcessKey][0x%08x][%s]"),
-                               hr, app_guid));
-    }
-  }
-
-  return S_OK;
-}
-
-HRESULT ApplicationUsageData::ProcessKey(const CString& key_name) {
-  return is_pre_update_check_ ? ProcessPreUpdateCheck(key_name) :
-                                ProcessPostUpdateCheck(key_name);
-}
-
-HRESULT ApplicationUsageData::ProcessPreUpdateCheck(const CString& key_name) {
-  // Read in the regkey value if it exists, and or it with the previous value.
-  RegKey key;
-  HRESULT hr = key.Open(key_name, KEY_READ);
-  if (FAILED(hr)) {
-    CORE_LOG(L4, (_T("[failed to open key][%s][0x%08x]"), key_name, hr));
-    return hr;
-  }
-
-  // Now that we have the key, we should try and read the value of the
-  // did run key.
-  CString did_run_str(_T("0"));
-  hr = RegistryReadStringOrDword(key, kRegValueDidRun, &did_run_str);
-  if (FAILED(hr)) {
-    CORE_LOG(L3, (_T("[RegKey::GetValue failed][0x%08x][%s][%s]"),
-                  hr, key_name, kRegValueDidRun));
-    return hr;
-  }
-
-  if (did_run_str == _T("1")) {
-    did_run_ = true;
-  }
-  exists_ = true;
-
-  return hr;
-}
-
-HRESULT ApplicationUsageData::ProcessBackWardCompatKey(
-    const CString& key_name) {
-  // This method exists to support the installers that have not been
-  // updated to write to the HKCU key. Remove when we have all the installers
-  // correcly updated.
-  if (is_pre_update_check_) {
-    // Read in the regkey value if it exists, and or it with the previous value.
-    RegKey key;
-    HRESULT hr = key.Open(key_name, KEY_READ);
-    if (FAILED(hr)) {
-      CORE_LOG(L4, (_T("[failed to open key][%s][0x%08x]"), key_name, hr));
-      return hr;
-    }
-
-    // Now that we have the key, we should try and read the value of the
-    // did run key.
-    CString did_run_str;
-    hr = RegistryReadStringOrDword(key, kRegValueDidRun, &did_run_str);
-    if (FAILED(hr)) {
-      CORE_LOG(L3, (_T("[RegKey::GetValue failed][0x%08x][%s][%s]"),
-                    hr, key_name, kRegValueDidRun));
-      return hr;
-    }
-
-    if (did_run_str == _T("1")) {
-      did_run_ = true;
-    }
-    exists_ = true;
-
-    return hr;
-  } else {
-    RegKey key;
-    HRESULT hr = key.Open(key_name);
-    if (FAILED(hr)) {
-      CORE_LOG(L4, (_T("[failed to open key][%s][0x%08x]"), key_name, hr));
-      return hr;
-    }
-
-    // If the value exists, then it means that the installer has been updated,
-    // and we delete the machine value.
-    if (exists_) {
-      hr = RegKey::DeleteValue(key_name, kRegValueDidRun);
-      if (FAILED(hr)) {
-        CORE_LOG(LEVEL_WARNING, (_T("[RegKey::DeleteValue failed][0x%08x][%s]"),
-                                 hr, key_name));
-        return hr;
-      }
-    } else {
-      // Since the value does not exist else where, we reset the value in the
-      // HKLM key to zero.
-      exists_ = true;
-      CString did_run_str;
-      hr = RegistryReadStringOrDword(key, kRegValueDidRun, &did_run_str);
-      if (SUCCEEDED(hr)) {
-        hr = key.SetValue(kRegValueDidRun, _T("0"));
-        if (FAILED(hr)) {
-          CORE_LOG(LEVEL_WARNING, (_T("[RegKey::SetValue failed][0x%08x][%s]"),
-                                   hr, key_name));
-          return hr;
-        }
-      }
-    }
-  }
-
-  return S_OK;
-}
-
-HRESULT ApplicationUsageData::ProcessPostUpdateCheck(const CString& key_name) {
-  RegKey key;
-  HRESULT hr = key.Open(key_name);
-  if (FAILED(hr)) {
-    CORE_LOG(L4, (_T("[failed to open key][%s][0x%08x]"), key_name, hr));
-    return hr;
-  }
-
-  CString did_run_str;
-  hr = RegistryReadStringOrDword(key, kRegValueDidRun, &did_run_str);
-  if (SUCCEEDED(hr)) {
-    exists_ = true;
-    hr = key.SetValue(kRegValueDidRun, _T("0"));
-    if (FAILED(hr)) {
-      CORE_LOG(LEVEL_WARNING, (_T("[RegKey::SetValue failed][0x%08x][%s]"),
-                               hr, key_name));
-      return hr;
-    }
-  }
-  return S_OK;
-}
-
-}  // namespace omaha
diff --git a/goopdate/application_usage_data.h b/goopdate/application_usage_data.h
deleted file mode 100644
index 2bde86d..0000000
--- a/goopdate/application_usage_data.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// application_usage_data.h : Includes methods to deal with application
-// usage data. Currently it only deals with the did_run key.
-// The class provides methods to process the application data, before and
-// after the update check. In case of the did_run key we read the key
-// pre-update check and clear it post-update check.
-
-#ifndef OMAHA_GOOPDATE_APPLICATION_USAGE_DATA_H__
-#define OMAHA_GOOPDATE_APPLICATION_USAGE_DATA_H__
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-enum ActiveStates;
-
-class ApplicationUsageData {
- public:
-  ApplicationUsageData(bool is_machine, bool check_low_integrity);
-  ~ApplicationUsageData();
-
-  // Reads the did run values for the application indentified by the app_guid.
-  HRESULT ReadDidRun(const CString& app_guid);
-
-  // Clears and performs the post processing after an update ckeck for the
-  // did run key.
-  HRESULT ResetDidRun(const CString& app_guid);
-
-  bool exists() const { return exists_; }
-  bool did_run() const { return did_run_; }
-  ActiveStates active_state() const;
-
- private:
-  // Processes the did run value for the machine goopdate.
-  HRESULT ProcessMachineDidRun(const CString& app_guid);
-
-  // Processes the did run value for the user goopdate.
-  HRESULT ProcessUserDidRun(const CString& app_guid);
-
-  // Calls the pre or the post update check methods based on the
-  // is_pre_update_check_ value.
-  HRESULT ProcessDidRun(const CString& app_guid);
-
-  // Pre or post process the key that is passed in.
-  HRESULT ProcessKey(const CString& key_name);
-
-  // Reads the did run value and populates did_run_ and exists_.
-  HRESULT ProcessPreUpdateCheck(const CString& key_name);
-
-  // Clears the did_run value.
-  HRESULT ProcessPostUpdateCheck(const CString& key_name);
-
-  // Reads and updates the did_run key for the machine. This is a backward
-  // compatibility requirement, since applications have not been updated to
-  // write to HKCU yet.
-  HRESULT ProcessBackWardCompatKey(const CString& key_name);
-
-  bool exists_;                // Whether the did_run value exists.
-  bool did_run_;               // The value of did_run.
-  bool is_machine_;            // Whether this is a machine instance.
-  bool is_pre_update_check_;   // Internal state of pre or post update.
-  bool check_low_integrity_;   // Whether to check the low integrity registry
-                               // location.
-
-  DISALLOW_EVIL_CONSTRUCTORS(ApplicationUsageData);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_APPLICATION_USAGE_DATA_H__
diff --git a/goopdate/application_usage_data_unittest.cc b/goopdate/application_usage_data_unittest.cc
deleted file mode 100644
index 82587c8..0000000
--- a/goopdate/application_usage_data_unittest.cc
+++ /dev/null
@@ -1,747 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// ApplicationUsageData unit tests
-
-#include "omaha/base/reg_key.h"
-#include "omaha/base/user_info.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/testing/unit_test.h"
-#include "omaha/goopdate/application_usage_data.h"
-
-namespace omaha {
-
-const TCHAR kAppDidRunValueName[] = _T("dr");
-const TCHAR kHKCUClientStateKeyName[] =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientState\\{6ACB7D4D-E5BA-48b0-85FE-A4051500A1BD}");
-const TCHAR kMachineClientState[] =
-    _T("HKLM\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientState\\{6ACB7D4D-E5BA-48b0-85FE-A4051500A1BD}");
-const TCHAR kLowIntegrityIEHKCU[] =
-    _T("HKCU\\Software\\Microsoft\\Internet Explorer\\")
-    _T("InternetRegistry\\REGISTRY\\USER\\");
-const TCHAR kAppGuid[] = _T("{6ACB7D4D-E5BA-48b0-85FE-A4051500A1BD}");
-const TCHAR kRelativeClientState[] =
-    _T("Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientState\\{6ACB7D4D-E5BA-48b0-85FE-A4051500A1BD}");
-
-// TODO(omaha): Expected and actual are reversed throughout this file. Fix.
-
-class ApplicationUsageDataTest : public testing::Test {
- protected:
-  virtual void SetUp() {
-    CString sid;
-    ASSERT_SUCCEEDED(user_info::GetProcessUser(NULL, NULL, &sid));
-    low_integrity_key_name_ = AppendRegKeyPath(kLowIntegrityIEHKCU,
-                                               sid,
-                                               kRelativeClientState);
-    TearDown();
-  }
-
-  virtual void TearDown() {
-    RegKey::DeleteKey(kHKCUClientStateKeyName);
-    RegKey::DeleteKey(kMachineClientState);
-    RegKey::DeleteKey(low_integrity_key_name_);
-  }
-
-  void CreateMachineDidRunValue(bool value) {
-    if (!vista_util::IsUserAdmin()) {
-      return;
-    }
-    RegKey key;
-    ASSERT_SUCCEEDED(key.Create(kMachineClientState));
-    ASSERT_SUCCEEDED(key.SetValue(kAppDidRunValueName,
-                                  value == true ? _T("1") : _T("0")));
-  }
-
-  void CreateMachineDidRunDwordValue(bool value) {
-    if (!vista_util::IsUserAdmin()) {
-      return;
-    }
-    RegKey key;
-    DWORD new_value = (value == true ? 1 : 0);
-    ASSERT_SUCCEEDED(key.Create(kMachineClientState));
-    ASSERT_SUCCEEDED(key.SetValue(kAppDidRunValueName, new_value));
-  }
-
-  bool MachineDidRunValueExists() {
-    if (!vista_util::IsUserAdmin()) {
-      return true;
-    }
-    RegKey key;
-    if (FAILED(key.Open(kMachineClientState))) {
-      return false;
-    }
-
-    CString did_run_str(_T("0"));
-    if (FAILED(key.GetValue(kAppDidRunValueName, &did_run_str))) {
-      return false;
-    }
-
-    return true;
-  }
-
-  void DeleteMachineDidRunValue() {
-    if (!vista_util::IsUserAdmin()) {
-      return;
-    }
-    ASSERT_SUCCEEDED(RegKey::DeleteValue(kMachineClientState,
-                                         kAppDidRunValueName));
-  }
-
-  void CheckMachineDidRunValue(bool expected) {
-    if (!vista_util::IsUserAdmin()) {
-      return;
-    }
-    RegKey key;
-    ASSERT_SUCCEEDED(key.Open(kMachineClientState));
-
-    CString did_run_str(_T("0"));
-    ASSERT_SUCCEEDED(key.GetValue(kAppDidRunValueName, &did_run_str));
-    bool value = (did_run_str == _T("1")) ? true : false;
-
-    ASSERT_EQ(value, expected);
-  }
-
-  void CreateUserDidRunValue(bool value) {
-    RegKey key;
-    ASSERT_SUCCEEDED(key.Create(kHKCUClientStateKeyName));
-    ASSERT_SUCCEEDED(key.SetValue(kAppDidRunValueName,
-                                  (value == true) ? _T("1") : _T("0")));
-  }
-
-  void CreateUserDidRunDwordValue(bool value) {
-    RegKey key;
-    DWORD new_value = (value == true ? 1 : 0);
-    ASSERT_SUCCEEDED(key.Create(kHKCUClientStateKeyName));
-    ASSERT_SUCCEEDED(key.SetValue(kAppDidRunValueName, new_value));
-  }
-
-  void DeleteUserDidRunValue() {
-    ASSERT_SUCCEEDED(RegKey::DeleteValue(kHKCUClientStateKeyName,
-                                         kAppDidRunValueName));
-  }
-
-  void CheckUserDidRunValue(bool expected) {
-    RegKey key;
-    ASSERT_SUCCEEDED(key.Open(kHKCUClientStateKeyName));
-
-    CString did_run_str(_T("0"));
-    ASSERT_SUCCEEDED(key.GetValue(kAppDidRunValueName, &did_run_str));
-    bool value = (did_run_str == _T("1")) ? true : false;
-
-    ASSERT_EQ(value, expected);
-  }
-
-  bool UserDidRunValueExists() {
-    RegKey key;
-    if (FAILED(key.Open(kHKCUClientStateKeyName))) {
-      return false;
-    }
-
-    CString did_run_str(_T("0"));
-    if (FAILED(key.GetValue(kAppDidRunValueName, &did_run_str))) {
-      return false;
-    }
-
-    return true;
-  }
-
-  void CreateLowIntegrityUserDidRunValue(bool value) {
-    RegKey key;
-    ASSERT_SUCCEEDED(key.Create(low_integrity_key_name_));
-    ASSERT_SUCCEEDED(key.SetValue(kAppDidRunValueName,
-                                  (value == true) ? _T("1") : _T("0")));
-  }
-
-  void CreateLowIntegrityUserDidRunDwordValue(bool value) {
-    RegKey key;
-    DWORD new_value = (value == true ? 1 : 0);
-    ASSERT_SUCCEEDED(key.Create(low_integrity_key_name_));
-    ASSERT_SUCCEEDED(key.SetValue(kAppDidRunValueName, new_value));
-  }
-
-  void DeleteLowIntegrityUserDidRunValue() {
-    ASSERT_SUCCEEDED(RegKey::DeleteValue(low_integrity_key_name_,
-                                         kAppDidRunValueName));
-  }
-
-  void CheckLowIntegrityUserDidRunValue(bool expected) {
-    RegKey key;
-    ASSERT_SUCCEEDED(key.Open(low_integrity_key_name_));
-
-    CString did_run_str(_T("0"));
-    ASSERT_SUCCEEDED(key.GetValue(kAppDidRunValueName, &did_run_str));
-    bool value = (did_run_str == _T("1")) ? true : false;
-
-    ASSERT_EQ(value, expected);
-  }
-
-  bool LowIntegrityUserDidRunValueExists() {
-    RegKey key;
-    if (FAILED(key.Open(low_integrity_key_name_))) {
-      return false;
-    }
-
-    CString did_run_str(_T("0"));
-    if (FAILED(key.GetValue(kAppDidRunValueName, &did_run_str))) {
-      return false;
-    }
-
-    return true;
-  }
-
-  // This method takes in machine_did_run, user_did_run and
-  // low_user_did_run as int's. The idea is that the test tries to simulate
-  // all of these values as being not-present, and if present then true or
-  // false.
-  // -1 indicates non-presense, 1 indicates true, and 0 false. The caller
-  // then loops over all these values to capture testing all the permutations.
-  void TestUserAndMachineDidRun(int machine_did_run,
-                                int user_did_run,
-                                int low_user_did_run,
-                                bool expected_exists,
-                                bool expected_did_run,
-                                int is_vista) {
-    ApplicationUsageData data(true, is_vista ? true : false);
-
-    // Set up the registry for the test.
-    if (machine_did_run != -1) {
-      CreateMachineDidRunValue((machine_did_run == 1) ? true: false);
-    }
-
-    if (user_did_run != -1) {
-      CreateUserDidRunValue((user_did_run == 1) ? true: false);
-    }
-
-    if (low_user_did_run != -1) {
-      CreateLowIntegrityUserDidRunValue((low_user_did_run == 1) ? true: false);
-    }
-
-    // Perform the test.
-    ASSERT_SUCCEEDED(data.ReadDidRun(kAppGuid));
-    ASSERT_EQ(data.exists(), expected_exists);
-    ASSERT_EQ(data.did_run(), expected_did_run);
-
-    // Check the return values.
-    if (machine_did_run == -1) {
-      ASSERT_FALSE(MachineDidRunValueExists());
-    } else {
-      CheckMachineDidRunValue((machine_did_run == 1) ? true: false);
-    }
-
-    if (user_did_run == -1) {
-      ASSERT_FALSE(UserDidRunValueExists());
-    } else {
-      CheckUserDidRunValue((user_did_run == 1) ? true: false);
-    }
-
-    if (low_user_did_run == -1) {
-      ASSERT_FALSE(LowIntegrityUserDidRunValueExists());
-    } else {
-      CheckLowIntegrityUserDidRunValue((low_user_did_run == 1) ? true: false);
-    }
-  }
-
-  void TestUserAndMachineDidRunPostProcess(int machine_did_run,
-                                           int user_did_run,
-                                           int low_user_did_run,
-                                           bool expected_exists,
-                                           int is_vista) {
-    ApplicationUsageData data(true, is_vista ? true : false);
-
-    // Setup the registry for the test.
-    if (machine_did_run != -1) {
-      CreateMachineDidRunValue((machine_did_run == 1) ? true: false);
-    }
-
-    if (user_did_run != -1) {
-      CreateUserDidRunValue((user_did_run == 1) ? true: false);
-    }
-
-    if (low_user_did_run != -1) {
-      CreateLowIntegrityUserDidRunValue((low_user_did_run == 1) ? true: false);
-    }
-
-    // Run the test.
-    ASSERT_SUCCEEDED(data.ResetDidRun(kAppGuid));
-    if (user_did_run == -1) {
-      ASSERT_FALSE(UserDidRunValueExists());
-    } else {
-      CheckUserDidRunValue(false);
-    }
-
-    if (low_user_did_run == -1) {
-      ASSERT_FALSE(LowIntegrityUserDidRunValueExists());
-    } else {
-      if (is_vista) {
-        CheckLowIntegrityUserDidRunValue(false);
-      } else {
-        CheckLowIntegrityUserDidRunValue((low_user_did_run == 1) ? true: false);
-      }
-    }
-
-    if (machine_did_run == -1) {
-      ASSERT_FALSE(MachineDidRunValueExists());
-    } else {
-      if (user_did_run != -1 ||  (is_vista && low_user_did_run != -1)) {
-        // This means that the user keys exists for this application
-        // we should have delete the machine key.
-        ASSERT_EQ(MachineDidRunValueExists(), false);
-      } else {
-        CheckMachineDidRunValue(false);
-      }
-    }
-
-    ASSERT_SUCCEEDED(data.ReadDidRun(kAppGuid));
-    ASSERT_EQ(data.exists(), expected_exists);
-    ASSERT_EQ(data.did_run(), false);
-  }
-
-  void UserTestDidRunPreProcess(int user_did_run,
-                                int low_user_did_run,
-                                int is_vista,
-                                bool expected_exists,
-                                bool expected_did_run) {
-    ApplicationUsageData data(false, is_vista ? true : false);
-
-    // Set up the registry for the test.
-    CreateMachineDidRunValue(true);
-
-    if (user_did_run != -1) {
-      CreateUserDidRunValue((user_did_run == 1) ? true: false);
-    }
-
-    if (low_user_did_run != -1) {
-      CreateLowIntegrityUserDidRunValue((low_user_did_run == 1) ? true: false);
-    }
-
-    // Perform the test.
-    ASSERT_SUCCEEDED(data.ReadDidRun(kAppGuid));
-    ASSERT_EQ(data.exists(), expected_exists);
-    ASSERT_EQ(data.did_run(), expected_did_run);
-
-    // The machine value should not have changed from what we set it to.
-    CheckMachineDidRunValue(true);
-    if (user_did_run == -1) {
-      // If we did not create the user value it should not exist.
-      ASSERT_FALSE(UserDidRunValueExists());
-    }
-
-    if (low_user_did_run == -1) {
-      // If we did not create the low integrity user value it should not exist.
-      ASSERT_FALSE(LowIntegrityUserDidRunValueExists());
-    }
-  }
-
-  void UserTestDidRunPostProcess(int user_did_run,
-                                 int low_user_did_run,
-                                 int is_vista) {
-    // Create a user ApplicationUsageData class.
-    ApplicationUsageData data(false, is_vista ? true : false);
-
-    // This should not affect the test.
-    CreateMachineDidRunValue(true);
-
-    if (user_did_run != -1) {
-      CreateUserDidRunValue((user_did_run == 1) ? true: false);
-    }
-
-    if (low_user_did_run != -1) {
-      CreateLowIntegrityUserDidRunValue((low_user_did_run == 1) ? true: false);
-    }
-
-    ASSERT_SUCCEEDED(data.ResetDidRun(kAppGuid));
-
-    // The machine did run shold never get affected.
-    CheckMachineDidRunValue(true);
-    if (user_did_run == -1) {
-      ASSERT_FALSE(UserDidRunValueExists());
-    } else {
-      // In all cases if the HKCU did run is set, it should get cleared.
-      CheckUserDidRunValue(false);
-    }
-
-    if (low_user_did_run == -1) {
-      ASSERT_FALSE(LowIntegrityUserDidRunValueExists());
-    } else {
-      // In case of vista, the low integrity user value should get reset.
-      CheckLowIntegrityUserDidRunValue(is_vista ? false :
-                                       (low_user_did_run == 1) ? true : false);
-    }
-  }
-
- private:
-  CString low_integrity_key_name_;
-};
-
-TEST_F(ApplicationUsageDataTest, ReadDidRunUser1) {
-  ApplicationUsageData data(true, false);
-
-  ASSERT_SUCCEEDED(data.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data.exists(), false);
-  ASSERT_EQ(data.did_run(), false);
-
-  // Test with false user value.
-  CreateUserDidRunValue(false);
-  ASSERT_SUCCEEDED(data.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data.exists(), true);
-  ASSERT_EQ(data.did_run(), false);
-}
-
-TEST_F(ApplicationUsageDataTest, ReadDwordDidRunUser1) {
-  ApplicationUsageData data(true, false);
-
-  ASSERT_SUCCEEDED(data.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data.exists(), false);
-  ASSERT_EQ(data.did_run(), false);
-
-  // Test with false user value.
-  CreateUserDidRunDwordValue(false);
-  ASSERT_SUCCEEDED(data.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data.exists(), true);
-  ASSERT_EQ(data.did_run(), false);
-}
-
-TEST_F(ApplicationUsageDataTest, ReadDidRunUser2) {
-  // Test with true user value.
-  ApplicationUsageData data1(true, false);
-  CreateUserDidRunValue(true);
-  ASSERT_SUCCEEDED(data1.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data1.exists(), true);
-  ASSERT_EQ(data1.did_run(), true);
-}
-
-TEST_F(ApplicationUsageDataTest, ReadDwordDidRunUser2) {
-  // Test with true user value.
-  ApplicationUsageData data1(true, false);
-  CreateUserDidRunDwordValue(true);
-  ASSERT_SUCCEEDED(data1.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data1.exists(), true);
-  ASSERT_EQ(data1.did_run(), true);
-}
-
-TEST_F(ApplicationUsageDataTest, ReadDidRunUser3) {
-  // low integrity user = false, vista
-  ApplicationUsageData data2(true, true);
-  CreateLowIntegrityUserDidRunValue(false);
-  ASSERT_SUCCEEDED(data2.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data2.exists(), true);
-  ASSERT_EQ(data2.did_run(), false);
-}
-
-TEST_F(ApplicationUsageDataTest, ReadDwordDidRunUser3) {
-  // low integrity user = false, vista
-  ApplicationUsageData data2(true, true);
-  CreateLowIntegrityUserDidRunDwordValue(false);
-  ASSERT_SUCCEEDED(data2.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data2.exists(), true);
-  ASSERT_EQ(data2.did_run(), false);
-}
-
-TEST_F(ApplicationUsageDataTest, ReadDidRunUser4) {
-  // low integrity user = true, vista
-  ApplicationUsageData data2(true, true);
-  CreateLowIntegrityUserDidRunValue(true);
-  ASSERT_SUCCEEDED(data2.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data2.exists(), true);
-  ASSERT_EQ(data2.did_run(), true);
-}
-
-TEST_F(ApplicationUsageDataTest, ReadDwordDidRunUser4) {
-  // low integrity user = true, vista
-  ApplicationUsageData data2(true, true);
-  CreateLowIntegrityUserDidRunDwordValue(true);
-  ASSERT_SUCCEEDED(data2.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data2.exists(), true);
-  ASSERT_EQ(data2.did_run(), true);
-}
-
-TEST_F(ApplicationUsageDataTest, ReadDidRunUser5) {
-  // low integrity user = true, not vista
-  ApplicationUsageData data2(true, false);
-  CreateLowIntegrityUserDidRunValue(true);
-  ASSERT_SUCCEEDED(data2.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data2.exists(), false);
-  ASSERT_EQ(data2.did_run(), false);
-}
-
-TEST_F(ApplicationUsageDataTest, ReadDwordDidRunUser5) {
-  // low integrity user = true, not vista
-  ApplicationUsageData data2(true, false);
-  CreateLowIntegrityUserDidRunDwordValue(true);
-  ASSERT_SUCCEEDED(data2.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data2.exists(), false);
-  ASSERT_EQ(data2.did_run(), false);
-}
-
-TEST_F(ApplicationUsageDataTest, ReadDidRunMachine1) {
-  if (!vista_util::IsUserAdmin()) {
-    return;
-  }
-
-  ApplicationUsageData data(true, true);
-
-  // create machine application key and test
-  CreateMachineDidRunValue(false);
-  ASSERT_SUCCEEDED(data.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data.exists(), true);
-  ASSERT_EQ(data.did_run(), false);
-}
-
-TEST_F(ApplicationUsageDataTest, ReadDwordDidRunMachine1) {
-  if (!vista_util::IsUserAdmin()) {
-    return;
-  }
-
-  ApplicationUsageData data(true, true);
-
-  // create machine application key and test
-  CreateMachineDidRunDwordValue(false);
-  ASSERT_SUCCEEDED(data.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data.exists(), true);
-  ASSERT_EQ(data.did_run(), false);
-}
-
-TEST_F(ApplicationUsageDataTest, ReadDidRunMachine2) {
-  if (!vista_util::IsUserAdmin()) {
-    return;
-  }
-
-  ApplicationUsageData data1(true, true);
-  CreateMachineDidRunValue(true);
-  ASSERT_SUCCEEDED(data1.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data1.exists(), true);
-  ASSERT_EQ(data1.did_run(), true);
-}
-
-TEST_F(ApplicationUsageDataTest, ReadDwordDidRunMachine2) {
-  if (!vista_util::IsUserAdmin()) {
-    return;
-  }
-
-  ApplicationUsageData data1(true, true);
-  CreateMachineDidRunDwordValue(true);
-  ASSERT_SUCCEEDED(data1.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data1.exists(), true);
-  ASSERT_EQ(data1.did_run(), true);
-}
-
-TEST_F(ApplicationUsageDataTest, ReadDidRunBoth1) {
-  if (!vista_util::IsUserAdmin()) {
-    return;
-  }
-
-  // We try all combinations of machine, user and low integrity user
-  // registry value for did run. -1 indicates the value does not exist
-  // 1 indicates true and 0 indicates false.
-  for (int vista = 0; vista < 2; ++vista) {
-    for (int machine = -1; machine < 2; ++machine) {
-      for (int user = -1; user < 2; ++user) {
-        for (int lowuser = -1; lowuser < 2; ++lowuser) {
-          bool expected_did_run = false;
-          bool expected_exists = false;
-
-          if (machine > -1 || user > -1 || (vista && lowuser > -1)) {
-            expected_exists = true;
-          }
-
-          if (machine > 0 || user > 0 || (vista && lowuser > 0)) {
-            expected_did_run = true;
-          }
-
-          TestUserAndMachineDidRun(machine, user, lowuser,
-                                   expected_exists,
-                                   expected_did_run,
-                                   vista);
-          TearDown();
-        }
-      }
-    }
-  }
-}
-
-TEST_F(ApplicationUsageDataTest, ResetDidRunUser1) {
-  ApplicationUsageData data(true, true);
-
-  // create user application key and test
-  CreateUserDidRunValue(false);
-  ASSERT_SUCCEEDED(data.ResetDidRun(kAppGuid));
-  CheckUserDidRunValue(false);
-
-  ASSERT_SUCCEEDED(data.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data.exists(), true);
-  ASSERT_EQ(data.did_run(), false);
-}
-
-TEST_F(ApplicationUsageDataTest, ResetDidRunUser2) {
-  ApplicationUsageData data1(true, true);
-  CreateUserDidRunValue(true);
-  ASSERT_SUCCEEDED(data1.ResetDidRun(kAppGuid));
-  CheckUserDidRunValue(false);
-
-  ASSERT_SUCCEEDED(data1.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data1.exists(), true);
-  ASSERT_EQ(data1.did_run(), false);
-}
-
-TEST_F(ApplicationUsageDataTest, ResetDidRunUser3) {
-  ApplicationUsageData data(true, true);
-
-  // create user application key and test
-  CreateUserDidRunDwordValue(false);
-  ASSERT_SUCCEEDED(data.ResetDidRun(kAppGuid));
-  CheckUserDidRunValue(false);
-
-  ASSERT_SUCCEEDED(data.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data.exists(), true);
-  ASSERT_EQ(data.did_run(), false);
-}
-
-TEST_F(ApplicationUsageDataTest, ResetDidRunUser4) {
-  ApplicationUsageData data1(true, true);
-  CreateUserDidRunDwordValue(true);
-  ASSERT_SUCCEEDED(data1.ResetDidRun(kAppGuid));
-  CheckUserDidRunValue(false);
-
-  ASSERT_SUCCEEDED(data1.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data1.exists(), true);
-  ASSERT_EQ(data1.did_run(), false);
-}
-
-TEST_F(ApplicationUsageDataTest, ResetDidRunMachine1) {
-  if (!vista_util::IsUserAdmin()) {
-    return;
-  }
-
-  ApplicationUsageData data(true, true);
-  CreateMachineDidRunValue(false);
-  ASSERT_SUCCEEDED(data.ResetDidRun(kAppGuid));
-  CheckMachineDidRunValue(false);
-
-  ASSERT_SUCCEEDED(data.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data.exists(), true);
-  ASSERT_EQ(data.did_run(), false);
-}
-
-TEST_F(ApplicationUsageDataTest, ResetDidRunMachine2) {
-  if (!vista_util::IsUserAdmin()) {
-    return;
-  }
-
-  ApplicationUsageData data1(true, true);
-  CreateMachineDidRunValue(true);
-  ASSERT_SUCCEEDED(data1.ResetDidRun(kAppGuid));
-  CheckMachineDidRunValue(false);
-
-  ASSERT_SUCCEEDED(data1.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data1.exists(), true);
-  ASSERT_EQ(data1.did_run(), false);
-}
-
-TEST_F(ApplicationUsageDataTest, ResetDidRunMachine3) {
-  if (!vista_util::IsUserAdmin()) {
-    return;
-  }
-
-  ApplicationUsageData data(true, true);
-  CreateMachineDidRunDwordValue(false);
-  ASSERT_SUCCEEDED(data.ResetDidRun(kAppGuid));
-  CheckMachineDidRunValue(false);
-
-  ASSERT_SUCCEEDED(data.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data.exists(), true);
-  ASSERT_EQ(data.did_run(), false);
-}
-
-TEST_F(ApplicationUsageDataTest, ResetDidRunMachine4) {
-  if (!vista_util::IsUserAdmin()) {
-    return;
-  }
-
-  ApplicationUsageData data1(true, true);
-  CreateMachineDidRunDwordValue(true);
-  ASSERT_SUCCEEDED(data1.ResetDidRun(kAppGuid));
-  CheckMachineDidRunValue(false);
-
-  ASSERT_SUCCEEDED(data1.ReadDidRun(kAppGuid));
-  ASSERT_EQ(data1.exists(), true);
-  ASSERT_EQ(data1.did_run(), false);
-}
-
-TEST_F(ApplicationUsageDataTest, ResetDidRunBoth) {
-  if (!vista_util::IsUserAdmin()) {
-    return;
-  }
-
-  // We try all combinations of machine, user and low integrity user
-  // registry value for did run. -1 indicates the value does not exist
-  // 1 indicates true and 0 indicates false.
-  for (int vista = 0; vista < 2; ++vista) {
-    for (int machine = -1; machine < 2; ++machine) {
-      for (int user = -1; user < 2; ++user) {
-        for (int lowuser = -1; lowuser < 2; ++lowuser) {
-          bool expected_exists = false;
-          if (machine > -1 || user > -1 || (vista && lowuser > -1)) {
-            expected_exists = true;
-          }
-
-          TestUserAndMachineDidRunPostProcess(machine, user, lowuser,
-                                              expected_exists,
-                                              vista);
-          TearDown();
-        }
-      }
-    }
-  }
-}
-
-TEST_F(ApplicationUsageDataTest, UserReadDidRunUser) {
-  for (int vista = 0; vista < 2; ++vista) {
-      for (int user = -1; user < 2; ++user) {
-        for (int lowuser = -1; lowuser < 2; ++lowuser) {
-          bool expected_exists = false;
-          bool expected_did_run = false;
-
-          if (user != -1 || (vista && lowuser != -1)) {
-            expected_exists = true;
-          }
-
-          if (user > 0 || (vista && lowuser > 0)) {
-            expected_did_run = true;
-          }
-
-          UserTestDidRunPreProcess(user, lowuser, vista, expected_exists,
-                                   expected_did_run);
-          TearDown();
-        }
-      }
-  }
-}
-
-TEST_F(ApplicationUsageDataTest, UserResetDidRunUser1) {
-  for (int vista = 0; vista < 2; ++vista) {
-    for (int user = -1; user < 2; ++user) {
-      for (int lowuser = -1; lowuser < 2; ++lowuser) {
-        UserTestDidRunPostProcess(user, lowuser, vista);
-        TearDown();
-      }
-    }
-  }
-}
-
-}  // namespace omaha
diff --git a/goopdate/broker_class_factory.h b/goopdate/broker_class_factory.h
deleted file mode 100644
index 4d1776a..0000000
--- a/goopdate/broker_class_factory.h
+++ /dev/null
@@ -1,162 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_BROKER_CLASS_FACTORY_H_
-#define OMAHA_GOOPDATE_BROKER_CLASS_FACTORY_H_
-
-#include <atlcom.h>
-#include "base/basictypes.h"
-#include "omaha/base/atlregmapex.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/system.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/goopdate/elevation_moniker_resource.h"
-
-namespace omaha {
-
-// This class factory delegates CoCreation to the template "clsid" and returns
-// the resulting interface to the caller. If unable to CoCreate "clsid",
-// BrokerClassFactory attempts to CoCreateAsAdmin and return "clsid2" to the
-// caller.
-template <const CLSID& clsid, const CLSID& clsid2>
-class BrokerClassFactory : public CComClassFactory {
- public:
-  BrokerClassFactory() {}
-
-  virtual ~BrokerClassFactory() {}
-
-  STDMETHOD(CreateInstance)(LPUNKNOWN outer_unk, REFIID riid, void** instance) {
-    CORE_LOG(L3, (_T("[BrokerClassFactory CreateInstance][%s]"),
-                  GuidToString(riid)));
-
-    // The LockServer combo is used to pulse the module count, which will
-    // shutdown the server after this CreateInstance() request completes,
-    // provided there are no other outstanding interface references being held
-    // by clients.
-    LockServer(TRUE);
-    ON_SCOPE_EXIT_OBJ(*this, &IClassFactory::LockServer, FALSE);
-
-    if (!instance) {
-      return E_POINTER;
-    }
-
-    *instance = NULL;
-
-    if (outer_unk) {
-      return CLASS_E_NOAGGREGATION;
-    }
-
-    HRESULT hr = ::CoCreateInstance(clsid,
-                                    outer_unk,
-                                    CLSCTX_ALL,
-                                    riid,
-                                    instance);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[Create failed][%s][0x%x]"), GuidToString(clsid), hr));
-
-      if (!vista_util::IsVistaOrLater() && !vista_util::IsUserAdmin()) {
-        return hr;
-      }
-
-      hr = System::CoCreateInstanceAsAdmin(NULL, clsid2, riid, instance);
-      if (FAILED(hr)) {
-        CORE_LOG(LE, (_T("[Create fail][%s][0x%x]"), GuidToString(clsid2), hr));
-        return hr;
-      }
-    }
-
-    return S_OK;
-  }
-};
-
-#pragma warning(push)
-// Construction of local static object is not thread-safe
-#pragma warning(disable:4640)
-
-// This class is used for COM registration and class factory registration and
-// instantiation of the delegate brokers. The class itself is not
-// instantiated. target_clsid is the CLSID that BrokerClassFactory
-// CoCreates and returns to the caller. If unable to CoCreate target_clsid,
-// BrokerClassFactory attempts to CoCreateAsAdmin target_clsid2. broker_clsid is
-// the CLSID that clients of the broker CoCreate.
-template <const CLSID& target_clsid, const CLSID& target_clsid2,
-          const CLSID& broker_clsid, const TCHAR* const broker_progid>
-class ATL_NO_VTABLE BrokerClassFactoryRegistrar
-    : public CComObjectRootEx<CComObjectThreadModel>,
-      public CComCoClass<BrokerClassFactoryRegistrar<target_clsid,
-                                                     target_clsid2,
-                                                     broker_clsid,
-                                                     broker_progid> > {
- public:
-  BrokerClassFactoryRegistrar() {
-    ASSERT1(false);
-  }
-
-  typedef BrokerClassFactory<target_clsid, target_clsid2> BrokerClassFactoryT;
-
-  DECLARE_CLASSFACTORY_EX(BrokerClassFactoryT);
-  DECLARE_NOT_AGGREGATABLE(BrokerClassFactoryRegistrar);
-  DECLARE_REGISTRY_RESOURCEID_EX(IDR_LOCAL_SERVER_ELEVATION_RGS)
-
-  BEGIN_REGISTRY_MAP()
-    REGMAP_ENTRY(_T("PROGID"), broker_progid)
-    REGMAP_ENTRY(_T("VERSION"), _T("1.0"))
-    REGMAP_ENTRY(L"DESCRIPTION", L"Google Update Broker Class Factory")
-    REGMAP_ENTRY(L"CLSID", broker_clsid)
-    REGMAP_ENTRY(L"ICONRESID", PP_STRINGIZE(IDI_ELEVATION_MONIKER_ICON))
-    REGMAP_ENTRY(L"STRINGRESID",
-                 PP_STRINGIZE(IDS_ELEVATION_MONIKER_DISPLAYNAME))
-    REGMAP_MODULE2(L"MODULE", kOmahaBrokerFileName)
-  END_REGISTRY_MAP()
-
-  BEGIN_COM_MAP(BrokerClassFactoryRegistrar)
-  END_COM_MAP()
-
- protected:
-  virtual ~BrokerClassFactoryRegistrar() {}
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(BrokerClassFactoryRegistrar);
-};
-
-#pragma warning(pop)
-
-extern TCHAR kOnDemandMachineBrokerProgId[];
-extern TCHAR kUpdate3WebMachineBrokerProgId[];
-
-// An OnDemand client CoCreates OnDemandMachineAppsClass, which
-// instantiates the class factory for the OnDemandMachineBroker typedef below.
-// The class factory in turn passes the CreateInstance through to
-// OnDemandMachineAppsServiceClass.
-typedef BrokerClassFactoryRegistrar<__uuidof(OnDemandMachineAppsServiceClass),
-                                    __uuidof(OnDemandMachineAppsFallbackClass),
-                                    __uuidof(OnDemandMachineAppsClass),
-                                    kOnDemandMachineBrokerProgId>
-                                    OnDemandMachineBroker;
-
-// The Pack web plugin client CoCreates GoogleUpdate3WebMachineClass, which
-// instantiates the class factory for the Update3WebBroker typedef below. The
-// class factory in turn passes the CreateInstance through to
-// GoogleUpdate3WebServiceClass.
-typedef BrokerClassFactoryRegistrar<
-    __uuidof(GoogleUpdate3WebServiceClass),
-    __uuidof(GoogleUpdate3WebMachineFallbackClass),
-    __uuidof(GoogleUpdate3WebMachineClass),
-    kUpdate3WebMachineBrokerProgId>
-    Update3WebMachineBroker;
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_BROKER_CLASS_FACTORY_H_
diff --git a/goopdate/broker_idl_datax.c b/goopdate/broker_idl_datax.c
deleted file mode 100644
index a1af835..0000000
--- a/goopdate/broker_idl_datax.c
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
diff --git a/goopdate/build.scons b/goopdate/build.scons
deleted file mode 100644
index 33f2d8f..0000000
--- a/goopdate/build.scons
+++ /dev/null
@@ -1,453 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-
-import omaha_version_utils
-
-Import('env')
-
-def BuildCOMForwarder(cmd_line_switch,
-                      signed_exe_name):
-  com_forwarder_env = env.Clone()
-
-  com_forwarder_env.FilterOut(CCFLAGS=['/GL', '/RTC1', '/GS'])
-  com_forwarder_env.FilterOut(LINKFLAGS=['/LTCG'])
-
-  com_forwarder_env.Append(
-      CCFLAGS=[
-          '/GS-',
-          '/Zl',
-      ],
-      CPPDEFINES = [
-          'CMD_LINE_SWITCH=_T(\\"%s\\")' % cmd_line_switch,
-      ],
-      LINKFLAGS=[
-          '/ENTRY:WinMainCRTStartup',
-      ],
-      LIBS=[
-          'libcmt.lib',
-          'shlwapi.lib',
-      ],
-  )
-  # The resource file used is the same as the one for GoogleUpdate.exe.
-  # The version resource used is the same as the one for goopdate.dll.
-  com_forwarder_inputs = [
-       com_forwarder_env.ComponentObject('%s.obj' % signed_exe_name,
-                                         'com_forwarder.cc'),
-       com_forwarder_env.RES('%s.res' % signed_exe_name,
-                             '../google_update/resource.rc'),
-       '$OBJ_ROOT/goopdate/goopdate_version.res',
-  ]
-
-  unsigned_broker = com_forwarder_env.ComponentProgram(
-      prog_name='%s_unsigned' % signed_exe_name,
-      source=com_forwarder_inputs,
-  )
-  signed_broker = com_forwarder_env.SignedBinary(
-      target='%s.exe' % signed_exe_name,
-      source=unsigned_broker,
-  )
-  env.Replicate('$STAGING_DIR', signed_broker)
-
-
-# Build the broker forwarder and legacy on-demand.
-BuildCOMForwarder('/broker', 'GoogleUpdateBroker')
-BuildCOMForwarder('/ondemand', 'GoogleUpdateOnDemand')
-
-#
-# Build COM libraries and headers.
-#
-midl_env = env.Clone()
-midl_env.Tool('midl')
-midl_env['MIDLFLAGS'] += [
-    '/Oicf',  # generate optimized stubless proxy/stub code
-    ]
-
-#
-# Generate omaha3_idl.idl. The output is an IDL file with a variant CLSID
-# for coclass GoogleComProxyMachineClass and GoogleComProxyUserClass.
-#
-generated_idl = env.Command(
-    target='omaha3_idl.idl',
-    source='$MAIN_DIR/goopdate/omaha3_idl.idl',
-    action=('python %s/tools/generate_omaha3_idl.py --idl_template_file '
-        '$SOURCE --idl_output_file $TARGET' % env['MAIN_DIR'])
-)
-
-# Compile the .idl file into .tlb, .c & .h files
-midl_input = 'omaha3_idl.idl'
-midl_outputs = midl_env.TypeLibrary(generated_idl)
-
-# Save the .idl and the produced .tlb and .h files so we can provide
-# them to clients.
-env.Replicate('$STAGING_DIR/idls', midl_input)
-for node in midl_outputs:
-  if not str(node).endswith('.c'):
-    env.Replicate('$STAGING_DIR/idls', node)
-
-midl_env.ComponentLibrary(
-    lib_name='omaha3_idl',
-    source='omaha3_idl_i.c',
-)
-
-handler_common_env = env.Clone()
-handler_common_env.Append(
-    CPPDEFINES = [
-        '_ATL_FREE_THREADED',
-    ],
-    CPPPATH = [
-        '$OBJ_ROOT',  # Needed for generated files.
-    ],
-    LIBS = [
-        '$LIB_DIR/base.lib',
-        '$LIB_DIR/goopdate_lib.lib',
-        ('atls.lib', 'atlsd.lib')[env.Bit('debug')],
-        ('libcmt.lib', 'libcmtd.lib')[env.Bit('debug')],
-        ('libcpmt.lib', 'libcpmtd.lib')[env.Bit('debug')],
-        'psapi.lib',
-        'netapi32.lib',
-        'rasapi32.lib',
-        'shlwapi.lib',
-        'userenv.lib',
-        'version.lib',
-        'wtsapi32.lib',
-    ],
-)
-
-def BuildGoogleUpdateHandlerDll(omaha_version_info, is_machine_handler, psname):
-  version_string = omaha_version_info.GetVersionString()
-  prefix = omaha_version_info.filename_prefix
-  handler_env = handler_common_env.Clone(COMPONENT_STATIC = False)
-
-  if prefix == 'TEST_':
-    handler_env['OBJPREFIX'] = handler_env.subst('test/$OBJPREFIX')
-  elif prefix:
-    raise Exception('ERROR: Unrecognized prefix "%s"' % prefix)
-
-  handler_env.Append(
-      CPPDEFINES = [
-          'IS_MACHINE_HANDLER=%d' % is_machine_handler,
-      ],
-      LIBS = [
-          '$LIB_DIR/common.lib',
-          'wininet.lib',
-          'rpcrt4.lib',
-      ],
-      RCFLAGS = [
-          '/DVERSION_MAJOR=%d' % omaha_version_info.version_major,
-          '/DVERSION_MINOR=%d' % omaha_version_info.version_minor,
-          '/DVERSION_BUILD=%d' % omaha_version_info.version_build,
-          '/DVERSION_PATCH=%d' % omaha_version_info.version_patch,
-          '/DVERSION_NUMBER_STRING=\\"%s\\"' % version_string,
-      ],
-  )
-
-  resource = handler_env.RES(target='%s%s_resource.res' % (prefix, psname),
-                             source='google_update_ps_resource.rc')
-
-  handler_env.Depends(
-      resource,
-      ['$MAIN_DIR/VERSION',
-       '$MAIN_DIR/base/generic_reg_file_dll_handler.rgs'])
-
-  target_name = '%s%s_unsigned' % (prefix, psname)
-
-  inputs = [
-      'google_update_ps.def',
-      resource,
-      prefix + 'goopdate_version.res',
-      ]
-  inputs += handler_env.Object('google_update_ps_%s.obj' % psname,
-                               '$OBJ_ROOT/goopdate/google_update_ps.cc')
-  inputs += handler_env.Object('omaha3_idl_datax_%s.obj' % psname,
-                               '$OBJ_ROOT/goopdate/omaha3_idl_datax.c')
-
-  unsigned_dll = handler_env.ComponentLibrary(
-      lib_name=target_name,
-      source=inputs,
-  )
-
-  signed_dll = handler_env.SignedBinary(
-      target='%s%s.dll' % (prefix, psname),
-      source=unsigned_dll,
-  )
-
-  env.Replicate('$STAGING_DIR', signed_dll)
-  env.Replicate('$STAGING_DIR', [f for f in unsigned_dll if f.suffix == '.pdb'])
-
-
-for omaha_version_info in env['omaha_versions_info']:
-  BuildGoogleUpdateHandlerDll(omaha_version_info, 1, 'psmachine')
-  BuildGoogleUpdateHandlerDll(omaha_version_info, 0, 'psuser')
-
-gd_env = env.Clone()
-
-# TODO(omaha3): Is it okay that other libs, such as common, do not define this.
-gd_env['CPPDEFINES'] += [
-    '_ATL_FREE_THREADED',
-    ]
-
-# Need to look in output dir to find .h files generated by midl compiler.
-gd_env['CPPPATH'] += [
-    '$OBJ_ROOT',  # Needed for generated files.
-    '$MAIN_DIR/third_party/breakpad/src/',
-    ]
-
-target_name = 'goopdate_lib'
-
-gd_inputs = [
-    'app.cc',
-    'app_bundle.cc',
-    'app_bundle_state.cc',
-    'app_bundle_state_busy.cc',
-    'app_bundle_state_init.cc',
-    'app_bundle_state_initialized.cc',
-    'app_bundle_state_paused.cc',
-    'app_bundle_state_ready.cc',
-    'app_bundle_state_stopped.cc',
-    'app_command.cc',
-    'app_manager.cc',
-    'app_state.cc',
-    'app_state_error.cc',
-    'app_state_init.cc',
-    'app_state_checking_for_update.cc',
-    'app_state_download_complete.cc',
-    'app_state_downloading.cc',
-    'app_state_install_complete.cc',
-    'app_state_installing.cc',
-    'app_state_no_update.cc',
-    'app_state_ready_to_install.cc',
-    'app_state_update_available.cc',
-    'app_state_waiting_to_check_for_update.cc',
-    'app_state_waiting_to_download.cc',
-    'app_state_waiting_to_install.cc',
-    'app_version.cc',
-    'application_usage_data.cc',
-    'code_red_check.cc',
-    'crash.cc',
-    'cocreate_async.cc',
-    'cred_dialog.cc',
-    'current_state.cc',
-    'download_complete_ping_event.cc',
-    'download_manager.cc',
-    'google_update.cc',
-    'goopdate.cc',
-    'goopdate_metrics.cc',
-    'install_manager.cc',
-    'installer_wrapper.cc',
-    'job_observer.cc',
-    'model.cc',
-    'model_object.cc',
-    'ondemand.cc',
-    'oneclick_process_launcher.cc',
-    'offline_utils.cc',
-    'string_formatter.cc',
-    'package.cc',
-    'package_cache.cc',
-    'process_launcher.cc',
-    'resource_manager.cc',
-    'update3web.cc',
-    'update_request_utils.cc',
-    'update_response_utils.cc',
-    'worker.cc',
-    'worker_utils.cc',
-    'worker_metrics.cc',
-    ]
-if env.Bit('use_precompiled_headers'):
-  gd_inputs += gd_env.EnablePrecompile(target_name)
-
-# Compile the library.
-gd_env.ComponentLibrary(target_name, gd_inputs)
-
-
-#
-# Build Goopdate DLL
-#
-for omaha_version_info in env['omaha_versions_info']:
-  prefix = omaha_version_info.filename_prefix
-
-  temp_env = env.Clone(COMPONENT_STATIC=False)
-
-  if prefix == 'TEST_':
-    temp_env['OBJPREFIX'] = temp_env.subst('test/$OBJPREFIX')
-  elif prefix:
-    raise Exception('ERROR: Unrecognized prefix "%s"' % prefix)
-
-  # Add languages that have version resources but are not fully supported.
-  translated_languages = omaha_version_utils.GetShellLanguagesForVersion(
-                             omaha_version_info.GetVersion())
-
-  temp_env.Append(
-      CPPPATH = [
-          '$MAIN_DIR/third_party/breakpad/src/',
-          '$OBJ_ROOT',
-          ],
-
-      # Do not add static dependencies on system import libraries. Prefer delay
-      # loading when possible. Only what is necessary must be loaded in the
-      # memory space when long-running.
-      LIBS = [
-          '$LIB_DIR/base.lib',
-          '$LIB_DIR/breakpad.lib',
-          '$LIB_DIR/client.lib',
-          '$LIB_DIR/common.lib',
-          '$LIB_DIR/core.lib',
-          '$LIB_DIR/google_update_recovery.lib',
-          '$LIB_DIR/goopdate_lib.lib',
-          '$LIB_DIR/logging.lib',
-          '$LIB_DIR/net.lib',
-          '$LIB_DIR/omaha3_idl.lib',
-          '$LIB_DIR/security.lib',
-          '$LIB_DIR/service.lib',
-          '$LIB_DIR/setup.lib',
-          '$LIB_DIR/statsreport.lib',
-          '$LIB_DIR/ui.lib',
-          ('atls.lib', 'atlsd.lib')[temp_env.Bit('debug')],
-          ('libcmt.lib', 'libcmtd.lib')[temp_env.Bit('debug')],
-          ('libcpmt.lib', 'libcpmtd.lib')[temp_env.Bit('debug')],
-          # TODO(omaha3): This must be linked in because we have UI in the DLL.
-          'bits.lib',
-          'comctl32.lib',
-          'crypt32.lib',
-          'delayimp.lib',
-          'iphlpapi.lib',
-          'msi.lib',
-          'msimg32.lib',
-          'mstask.lib',
-          'netapi32.lib',
-          'psapi.lib',
-          'rasapi32.lib',
-          'rpcns4.lib',
-          'rpcrt4.lib',
-          'shlwapi.lib',
-          'taskschd.lib',
-          'version.lib',
-          'userenv.lib',
-          'wininet.lib',
-          'wintrust.lib',
-          'ws2_32.lib',
-          'wtsapi32.lib',
-          ],
-      LINKFLAGS = [
-          '/DELAYLOAD:oleaut32.dll',
-          '/DELAYLOAD:psapi.dll',
-          '/DELAYLOAD:rasapi32.dll',
-          '/DELAYLOAD:shell32.dll',
-          '/DELAYLOAD:shlwapi.dll',
-          '/DELAYLOAD:userenv.dll',
-          '/DELAYLOAD:version.dll',
-          '/DELAYLOAD:wtsapi32.dll',
-
-          # Forces the dependency on ws2_32.lib.
-          '/INCLUDE:_WSAStartup@8',
-
-          # TODO(Omaha) - Choose a rebase address which does not conflict
-          # with other DLLs loaded in our process. For now, we just picked
-          # an arbitrary address.
-          '/BASE:0x18000000',
-          ],
-      RCFLAGS = [
-          '/DVERSION_MAJOR=%d' % omaha_version_info.version_major,
-          '/DVERSION_MINOR=%d' % omaha_version_info.version_minor,
-          '/DVERSION_BUILD=%d' % omaha_version_info.version_build,
-          '/DVERSION_PATCH=%d' % omaha_version_info.version_patch,
-          '/DVERSION_NUMBER_STRING=\\"%s\\"' % (
-              omaha_version_info.GetVersionString()),
-
-          # goopdate.dll is resource neutral.
-          '/DLANGUAGE_STRING=\\"en\\"',
-          ],
-  )
-
-  resource_res = temp_env.RES(
-      target=prefix + 'goopdate.res',
-      source='goopdate.rc',
-  )
-
-  # Force a rebuild when the .tlb changes.
-  temp_env.Depends(resource_res, '$OBJ_ROOT/goopdate/omaha3_idl.tlb')
-
-  version_res = temp_env.RES(
-      target=prefix + 'goopdate_version.res',
-      source='goopdate_version.rc'
-  )
-
-  # Force a rebuild when the version changes.
-  env.Depends(version_res, '$MAIN_DIR/VERSION')
-
-  target_name = prefix + 'goopdate_unsigned'
-
-  # main.cc is included here because the linker gets confused if we try to
-  # create a DLL without an entry point. There's probably a more accurate
-  # description of the problem and thus a different solution, but this worked.
-  inputs = [
-      'goopdate.def',
-      'main.cc',
-      resource_res,
-      version_res,
-      ]
-  if env.Bit('use_precompiled_headers'):
-    inputs += temp_env.EnablePrecompile(target_name)
-
-  for language in translated_languages:
-    lang_base_name = 'goopdate_dll/generated_resources_' + language
-    inputs += temp_env.RES(
-        target='resources/%s.res' % (prefix + lang_base_name),
-        source='resources/%s.rc' % lang_base_name,
-    )
-
-  unsigned_dll = temp_env.ComponentLibrary(
-      lib_name=target_name,
-      source=inputs,
-  )
-
-  signed_dll = temp_env.SignedBinary(
-      target=prefix + 'goopdate.dll',
-      source=unsigned_dll,
-  )
-
-  env.Replicate('$STAGING_DIR', signed_dll)
-  env.Replicate('$STAGING_DIR', [f for f in unsigned_dll if f.suffix == '.pdb'])
-
-
-customization_test_env = env.Clone()
-
-customization_test_env.Append(
-    LIBS = [
-        '$LIB_DIR/common.lib',
-    ],
-)
-
-customization_test_env['CPPPATH'] += [
-    '$OBJ_ROOT',  # Needed for generated files.
-    ]
-customization_test = customization_test_env.OmahaUnittest(
-    name='omaha_customization_goopdate_apis_unittest',
-    source=[
-        'omaha_customization_goopdate_apis_unittest.cc',
-        'omaha3_idl_i.obj',  # Needed for LIBID_*.
-    ],
-    all_in_one=False,
-    COMPONENT_TEST_SIZE='small',
-)
-
-# The test uses the DLL for its TypeLib.
-customization_test_env.Depends(customization_test, '$STAGING_DIR/goopdate.dll')
-
-
-# Build all the resource dlls.
-env.BuildSConscript('resources')
diff --git a/goopdate/cocreate_async.cc b/goopdate/cocreate_async.cc
deleted file mode 100644
index 31ba97e..0000000
--- a/goopdate/cocreate_async.cc
+++ /dev/null
@@ -1,192 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/cocreate_async.h"
-#include "base/basictypes.h"
-#include "base/debug.h"
-#include "omaha/base/scope_guard.h"
-#include "base/scoped_ptr_address.h"
-#include "omaha/base/system.h"
-#include "omaha/base/thread_pool_callback.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/goopdate/goopdate.h"
-
-namespace omaha {
-
-CoCreateAsync::CoCreateAsync() : StdMarshalInfo(true) {
-}
-
-STDMETHODIMP CoCreateAsync::createOmahaMachineServerAsync(
-    BSTR origin_url,
-    BOOL create_elevated,
-    ICoCreateAsyncStatus** status) {
-  CORE_LOG(L3, (L"[CoCreateAsync::createOmahaMachineServerAsync][%s][%d]",
-                origin_url, create_elevated));
-  ASSERT1(status);
-  ASSERT1(origin_url && wcslen(origin_url));
-  *status = NULL;
-
-  if (create_elevated &&
-      !vista_util::IsVistaOrLater() && !vista_util::IsUserAdmin()) {
-    return E_ACCESSDENIED;
-  }
-
-  typedef CComObject<CoCreateAsyncStatus> ComObjectAsyncStatus;
-  scoped_ptr<ComObjectAsyncStatus> async_status;
-  HRESULT hr = ComObjectAsyncStatus::CreateInstance(address(async_status));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = async_status->CreateOmahaMachineServerAsync(origin_url, create_elevated);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = async_status->QueryInterface(status);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  async_status.release();
-  return S_OK;
-}
-
-CoCreateAsyncStatus::CoCreateAsyncStatus() : is_done_(false), hr_(E_PENDING) {
-}
-
-HRESULT CoCreateAsyncStatus::CreateOmahaMachineServerAsync(
-    BSTR origin_url,
-    BOOL create_elevated) {
-  // Create a thread pool work item for deferred execution of the CoCreate. The
-  // thread pool owns this call back object.
-  typedef ThreadPoolCallBack2<CoCreateAsyncStatus,
-                              const CString,
-                              BOOL> CallBack;
-  scoped_ptr<CallBack>
-      callback(new CallBack(this,
-                            &CoCreateAsyncStatus::CreateOmahaMachineServer,
-                            origin_url,
-                            create_elevated));
-  HRESULT hr = Goopdate::Instance().QueueUserWorkItem(callback.get(),
-                                                      WT_EXECUTELONGFUNCTION);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[QueueUserWorkItem failed][0x%x]"), hr));
-    return hr;
-  }
-
-  VERIFY1(thread_started_gate_.Wait(INFINITE));
-
-  callback.release();
-  return S_OK;
-}
-
-void CoCreateAsyncStatus::CreateOmahaMachineServer(const CString origin_url,
-                                                   BOOL create_elevated) {
-  CORE_LOG(L3, (_T("[CoCreateAsyncStatus::CreateOmahaMachineServer][%s][%d]"),
-                origin_url, create_elevated));
-  AddRef();
-  ON_SCOPE_EXIT_OBJ(*this, &CoCreateAsyncStatus::Release);
-
-  VERIFY1(thread_started_gate_.Open());
-
-  HRESULT hr = E_FAIL;
-  CComPtr<IDispatch> ptr;
-
-  // Since the values of hr and ptr are being modified after the scope guard,
-  // the variables are passed by reference instead of by values using ByRef.
-  ON_SCOPE_EXIT_OBJ(*this,
-                    &CoCreateAsyncStatus::SetCreateInstanceResults,
-                    ByRef(hr),
-                    ByRef(ptr));
-
-  scoped_co_init init_com_apt(COINIT_MULTITHREADED);
-  hr = init_com_apt.hresult();
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[init_com_apt failed][0x%x]"), hr));
-    return;
-  }
-
-  CComPtr<IGoogleUpdate3WebSecurity> security;
-  REFCLSID clsid(__uuidof(GoogleUpdate3WebMachineClass));
-  hr = create_elevated ?
-      System::CoCreateInstanceAsAdmin(NULL, clsid, IID_PPV_ARGS(&security)) :
-      ::CoCreateInstance(clsid, NULL, CLSCTX_ALL, IID_PPV_ARGS(&security));
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[CoCreate failed][0x%x]"), hr));
-    return;
-  }
-
-  hr = security->setOriginURL(CComBSTR(origin_url));
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[setOriginURL failed][0x%x]"), hr));
-    return;
-  }
-
-  hr = security.QueryInterface(&ptr);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[QueryInterface failed][0x%x]"), hr));
-    return;
-  }
-}
-
-void CoCreateAsyncStatus::SetCreateInstanceResults(
-    const HRESULT& hr,
-    const CComPtr<IDispatch>& ptr) {
-  CORE_LOG(L3, (_T("[SetCreateInstanceResults][0x%x][0x%p]"), hr, ptr));
-  Lock();
-  ON_SCOPE_EXIT_OBJ(*this, &CoCreateAsyncStatus::Unlock);
-
-  hr_ = hr;
-  ptr_ = ptr;
-  is_done_ = true;
-}
-
-// ICoCreateAsyncStatus.
-STDMETHODIMP CoCreateAsyncStatus::get_isDone(VARIANT_BOOL* is_done) {
-  Lock();
-  ON_SCOPE_EXIT_OBJ(*this, &CoCreateAsyncStatus::Unlock);
-
-  ASSERT1(is_done);
-
-  *is_done = is_done_ ? VARIANT_TRUE : VARIANT_FALSE;
-  CORE_LOG(L3, (_T("[get_isDone][%d]"), is_done_));
-  return S_OK;
-}
-
-STDMETHODIMP CoCreateAsyncStatus::get_completionHResult(LONG* hr) {
-  Lock();
-  ON_SCOPE_EXIT_OBJ(*this, &CoCreateAsyncStatus::Unlock);
-
-  ASSERT1(hr);
-
-  *hr = hr_;
-  CORE_LOG(L3, (_T("[get_completionHResult][0x%x]"), hr_));
-  return S_OK;
-}
-
-STDMETHODIMP CoCreateAsyncStatus::get_createdInstance(IDispatch** instance) {
-  Lock();
-  ON_SCOPE_EXIT_OBJ(*this, &CoCreateAsyncStatus::Unlock);
-
-  ASSERT1(instance);
-
-  ptr_.CopyTo(instance);
-  CORE_LOG(L3, (_T("[get_createdInstance][0x%p]"), *instance));
-  return S_OK;
-}
-
-}  // namespace omaha
-
diff --git a/goopdate/cocreate_async.h b/goopdate/cocreate_async.h
deleted file mode 100644
index b59f19a..0000000
--- a/goopdate/cocreate_async.h
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_COCREATE_ASYNC_H_
-#define OMAHA_GOOPDATE_COCREATE_ASYNC_H_
-
-#include <atlbase.h>
-#include <oaidl.h>
-#include <oleauto.h>
-#include "goopdate/omaha3_idl.h"
-#include "omaha/base/atlregmapex.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/goopdate/com_proxy.h"
-#include "omaha/goopdate/non_localized_resource.h"
-
-namespace omaha {
-
-#pragma warning(push)
-// Construction of local static object is not thread-safe
-#pragma warning(disable:4640)
-
-class ATL_NO_VTABLE CoCreateAsync
-  : public CComObjectRootEx<CComObjectThreadModel>,
-    public CComCoClass<CoCreateAsync, &__uuidof(CoCreateAsyncClass)>,
-    public ICoCreateAsync,
-    public StdMarshalInfo {
- public:
-  CoCreateAsync();
-
-  STDMETHOD(createOmahaMachineServerAsync)(BSTR origin_url,
-                                           BOOL create_elevated,
-                                           ICoCreateAsyncStatus** status);
-
-  DECLARE_NOT_AGGREGATABLE(CoCreateAsync);
-  DECLARE_REGISTRY_RESOURCEID_EX(IDR_LOCAL_SERVER_RGS)
-
-  BEGIN_REGISTRY_MAP()
-    REGMAP_ENTRY(_T("HKROOT"),       goopdate_utils::GetHKRoot())
-    REGMAP_MODULE2(_T("MODULE"),     kOmahaBrokerFileName)
-    REGMAP_ENTRY(_T("VERSION"),      _T("1.0"))
-    REGMAP_ENTRY(_T("PROGID"),       kProgIDCoCreateAsync)
-    REGMAP_ENTRY(_T("DESCRIPTION"),  _T("CoCreateAsync"))
-    REGMAP_UUID(_T("CLSID"),         GetObjectCLSID())
-  END_REGISTRY_MAP()
-
-  BEGIN_COM_MAP(CoCreateAsync)
-    COM_INTERFACE_ENTRY(ICoCreateAsync)
-    COM_INTERFACE_ENTRY(IStdMarshalInfo)
-  END_COM_MAP()
-
- protected:
-  virtual ~CoCreateAsync() {}
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(CoCreateAsync);
-};
-
-class ATL_NO_VTABLE CoCreateAsyncStatus
-  : public CComObjectRootEx<CComObjectThreadModel>,
-    public IDispatchImpl<ICoCreateAsyncStatus,
-                         &__uuidof(ICoCreateAsyncStatus),
-                         &CAtlModule::m_libid,
-                         kMajorTypeLibVersion,
-                         kMinorTypeLibVersion> {
- public:
-  CoCreateAsyncStatus();
-  HRESULT CreateOmahaMachineServerAsync(BSTR origin_url, BOOL create_elevated);
-
-  // ICoCreateAsyncStatus.
-  STDMETHOD(get_isDone)(VARIANT_BOOL* is_done);
-  STDMETHOD(get_completionHResult)(LONG* hr);
-  STDMETHOD(get_createdInstance)(IDispatch** instance);
-
-  BEGIN_COM_MAP(CoCreateAsyncStatus)
-    COM_INTERFACE_ENTRY(ICoCreateAsyncStatus)
-    COM_INTERFACE_ENTRY(IDispatch)
-  END_COM_MAP()
-
- protected:
-  virtual ~CoCreateAsyncStatus() {}
-
- private:
-  void CreateOmahaMachineServer(const CString origin_url, BOOL create_elevated);
-  void SetCreateInstanceResults(const HRESULT& hr,
-                                const CComPtr<IDispatch>& ptr);
-
-  Gate thread_started_gate_;
-
-  bool is_done_;
-  HRESULT hr_;
-  CComPtr<IDispatch> ptr_;
-
-  DISALLOW_COPY_AND_ASSIGN(CoCreateAsyncStatus);
-};
-
-#pragma warning(pop)
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_COCREATE_ASYNC_H_
diff --git a/goopdate/code_red_check.cc b/goopdate/code_red_check.cc
deleted file mode 100644
index e591c6e..0000000
--- a/goopdate/code_red_check.cc
+++ /dev/null
@@ -1,211 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/code_red_check.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/scoped_impersonation.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vista_utils.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/goopdate/goopdate_metrics.h"
-#include "omaha/net/network_request.h"
-#include "omaha/net/bits_request.h"
-#include "omaha/net/simple_request.h"
-#include "omaha/recovery/client/google_update_recovery.h"
-
-namespace omaha {
-
-namespace {
-
-bool IsThreadImpersonatingUser() {
-  CAccessToken access_token;
-  return access_token.GetThreadToken(TOKEN_READ);
-}
-
-HRESULT DownloadCodeRedFile(const TCHAR* url,
-                            const TCHAR* file_path,
-                            void*,
-                            int* http_status_code) {
-  ASSERT1(url);
-  ASSERT1(file_path);
-  ASSERT1(http_status_code);
-  *http_status_code = 0;
-  NetworkConfig* network_config = NULL;
-  NetworkConfigManager& network_manager = NetworkConfigManager::Instance();
-  HRESULT hr = network_manager.GetUserNetworkConfig(&network_config);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  NetworkRequest network_request(network_config->session());
-
-  network_request.AddHttpRequest(new SimpleRequest);
-
-  // BITS takes the job to BG_JOB_STATE_TRANSIENT_ERROR when the server returns
-  // 204. After the "no progress time out", the BITS job errors out. Since
-  // BITS follows the WinHTTP in the fallback chain, the code is expected to
-  // execute only if WinHTTP fails to get a response from the server.
-
-  // BITS transfers files only when the job owner is logged on.
-  bool is_logged_on(false);
-  if (IsThreadImpersonatingUser()) {
-    // Code red download thread only impersonates to logged on user. So when
-    // impersonation happens, it means the user is logged on.
-    is_logged_on = true;
-  } else {
-    // Assumes the caller is not logged on if the function failed.
-    hr = IsUserLoggedOn(&is_logged_on);
-    ASSERT1(SUCCEEDED(hr) || !is_logged_on);
-  }
-  if (is_logged_on) {
-    BitsRequest* bits_request(new BitsRequest);
-    bits_request->set_minimum_retry_delay(kSecPerMin);
-    bits_request->set_no_progress_timeout(5 * kSecPerMin);
-    network_request.AddHttpRequest(bits_request);
-  }
-
-  hr = network_request.DownloadFile(CString(url), CString(file_path));
-  if (FAILED(hr)) {
-    return E_FAIL;
-  }
-
-  *http_status_code = network_request.http_status_code();
-  switch (network_request.http_status_code()) {
-    case HTTP_STATUS_OK:
-      return S_OK;
-    case HTTP_STATUS_NO_CONTENT:
-      return E_FAIL;
-    default:
-      return E_FAIL;
-  }
-}
-
-HRESULT CreateUniqueTempFileForLoggedOnUser(CString* target_file) {
-  ASSERT1(target_file);
-  CAccessToken access_token;
-  TCHAR buffer[MAX_PATH] = {0};
-  VERIFY1(access_token.GetThreadToken(TOKEN_READ));
-  HRESULT hr = ::SHGetFolderPath(NULL,
-                                 CSIDL_LOCAL_APPDATA,
-                                 access_token.GetHandle(),
-                                 SHGFP_TYPE_CURRENT,
-                                 buffer);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return GetNewFileNameInDirectory(buffer, target_file);
-}
-
-HRESULT DownloadCodeRedFileAsLoggedOnUser(const TCHAR* url,
-                                      const TCHAR* file_path,
-                                      void* callback_argument,
-                                      int* http_status_code) {
-  ASSERT1(http_status_code);
-  *http_status_code = 0;
-  scoped_handle logged_on_user_token(
-      goopdate_utils::GetImpersonationTokenForMachineProcess(true));
-  if (!valid(logged_on_user_token)) {
-    return E_FAIL;
-  }
-
-  HRESULT hr = S_OK;
-  CString download_target_path;
-  {
-    scoped_impersonation impersonate_user(get(logged_on_user_token));
-    hr = HRESULT_FROM_WIN32(impersonate_user.result());
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = CreateUniqueTempFileForLoggedOnUser(&download_target_path);
-    if (FAILED(hr)) {
-      return hr;
-    }
-    if (download_target_path.IsEmpty()) {
-      return E_FAIL;
-    }
-
-    hr = DownloadCodeRedFile(url,
-                             download_target_path,
-                             callback_argument,
-                             http_status_code);
-    if (FAILED(hr)) {
-      ::DeleteFile(download_target_path);
-      return hr;
-    }
-  }
-
-  const DWORD kMoveFlag = MOVEFILE_COPY_ALLOWED |
-                          MOVEFILE_REPLACE_EXISTING |
-                          MOVEFILE_WRITE_THROUGH;
-  if (!::MoveFileEx(download_target_path,
-                    file_path,
-                    kMoveFlag)) {
-    hr = HRESULT_FROM_WIN32(::GetLastError());
-  }
-
-  ::DeleteFile(download_target_path);
-  return hr;
-}
-
-// Download Callback for Code Red.
-// Returns S_OK when the download of the Code Red file succeeds and E_FAIL
-// otherwise.
-HRESULT CodeRedDownloadCallback(const TCHAR* url,
-                                const TCHAR* file_path,
-                                void* callback_argument) {
-  ++metric_cr_callback_total;
-
-  int http_status_code = 0;
-  HRESULT hr = DownloadCodeRedFileAsLoggedOnUser(url,
-                                                 file_path,
-                                                 callback_argument,
-                                                 &http_status_code);
-  if (FAILED(hr) && (http_status_code != HTTP_STATUS_NO_CONTENT)) {
-    hr = DownloadCodeRedFile(url,
-                             file_path,
-                             callback_argument,
-                             &http_status_code);
-  }
-
-  switch (http_status_code) {
-    case HTTP_STATUS_OK:
-      ++metric_cr_callback_status_200;
-      break;
-    case HTTP_STATUS_NO_CONTENT:
-      ++metric_cr_callback_status_204;
-      break;
-    default:
-      ++metric_cr_callback_status_other;
-      break;
-  }
-
-  return hr;
-}
-
-}  // namespace
-
-HRESULT CheckForCodeRed(bool is_machine, const CString& omaha_version) {
-  HRESULT hr = FixGoogleUpdate(kGoogleUpdateAppId,
-                               omaha_version,
-                               _T(""),     // Omaha doesn't have a language.
-                               is_machine,
-                               &CodeRedDownloadCallback,
-                               NULL);
-  CORE_LOG(L2, (_T("[FixGoogleUpdate returned 0x%08x]"), hr));
-  return hr;
-}
-
-}  // namespace omaha
diff --git a/goopdate/code_red_check.h b/goopdate/code_red_check.h
deleted file mode 100644
index 82fccbd..0000000
--- a/goopdate/code_red_check.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_CODE_RED_CHECK_H_
-#define OMAHA_GOOPDATE_CODE_RED_CHECK_H_
-
-#include <windows.h>
-#include <atlstr.h>
-
-namespace omaha {
-
-HRESULT CheckForCodeRed(bool is_machine, const CString& omaha_version);
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_CODE_RED_CHECK_H_
diff --git a/goopdate/com_forwarder.cc b/goopdate/com_forwarder.cc
deleted file mode 100644
index 629fbfe..0000000
--- a/goopdate/com_forwarder.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <shlwapi.h>
-#include <tchar.h>
-#include <strsafe.h>
-#include <windows.h>
-#include "base/basictypes.h"
-#include "omaha/base/constants.h"
-#include "omaha/common/const_cmd_line.h"
-
-// TODO(omaha): Use a registry override instead.
-#if !OFFICIAL_BUILD
-bool IsRunningFromStaging(const WCHAR* const command_line) {
-  return !wcscmp(command_line + (wcslen(command_line) - wcslen(L"staging")),
-                 L"staging");
-}
-#endif
-
-int WINAPI WinMain(HINSTANCE instance, HINSTANCE previous_instance,
-                   LPSTR cmd_line, int show) {
-  UNREFERENCED_PARAMETER(instance);
-  UNREFERENCED_PARAMETER(previous_instance);
-  UNREFERENCED_PARAMETER(cmd_line);
-  UNREFERENCED_PARAMETER(show);
-
-  WCHAR command_line[MAX_PATH * 2] = {};
-  if (0 == ::GetModuleFileName(NULL,
-                               command_line,
-                               arraysize(command_line))) {
-    return E_UNEXPECTED;
-  }
-
-  // TODO(omaha): Use the registry to get the path of the constant shell.
-  // Remove filename and move up one directory, because we want to use the
-  // constant shell GoogleUpdate.exe.
-  ::PathRemoveFileSpec(command_line);
-#if OFFICIAL_BUILD
-  ::PathRemoveFileSpec(command_line);
-#else
-  // This is to facilitate unit tests such as
-  // GoogleUpdateCoreTest.LaunchCmdElevated_LocalServerRegistered. If we are
-  // running from the staging directory, the shell is in the same directory.
-  if (!IsRunningFromStaging(command_line)) {
-    ::PathRemoveFileSpec(command_line);
-  }
-#endif
-
-  if (!::PathAppend(command_line, omaha::kOmahaShellFileName)) {
-    return E_UNEXPECTED;
-  }
-
-  if (FAILED(StringCchCat(command_line, arraysize(command_line), L" ")) ||
-      FAILED(StringCchCat(command_line, arraysize(command_line),
-                          CMD_LINE_SWITCH))) {
-    return E_UNEXPECTED;
-  }
-
-  STARTUPINFO si = { sizeof(si) };
-  // XXX: Normally, you should close the handles returned in
-  // PROCESS_INFORMATION. That step is skipped here since we are exiting
-  // immediately once the new process is created.
-  PROCESS_INFORMATION pi = {};
-  if (!::CreateProcess(
-          NULL,
-          command_line,
-          NULL,
-          NULL,
-          FALSE,
-          0,
-          NULL,
-          NULL,
-          &si,
-          &pi)) {
-    return E_UNEXPECTED;
-  }
-
-  return 0;
-}
diff --git a/goopdate/com_proxy.h b/goopdate/com_proxy.h
deleted file mode 100644
index 5d88bbf..0000000
--- a/goopdate/com_proxy.h
+++ /dev/null
@@ -1,234 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_COM_PROXY_H_
-#define OMAHA_GOOPDATE_COM_PROXY_H_
-
-#include <atlbase.h>
-#include <atlcom.h>
-#include <atlctl.h>
-#include "base/basictypes.h"
-#include "omaha/base/atlregmapex.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/goopdate/google_update_ps_resource.h"
-#include "goopdate/omaha3_idl.h"
-
-namespace omaha {
-
-// All[*] coclasses in omaha3_idl.idl do the following:
-// * Derive from StdMarshalInfo.
-// * Construct StdMarshalInfo(is_machine).
-// * Add a COM_INTERFACE_ENTRY(IStdMarshalInfo)
-//
-// [*] The proxy classes GoogleComProxy[XXX]Class, being proxies, do not follow
-// the steps above. In addition, the CurrentStateClass has a custom marshaler
-// and does not follow the steps above.
-//
-const IID kIIDsToRegister[] = {
-  __uuidof(IGoogleUpdate3),
-  __uuidof(IAppBundle),
-  __uuidof(IApp),
-  __uuidof(IAppVersion),
-  __uuidof(IPackage),
-  __uuidof(ICurrentState),
-
-  __uuidof(IRegistrationUpdateHook),
-
-  __uuidof(IGoogleUpdate3Web),
-  __uuidof(IGoogleUpdate3WebSecurity),
-  __uuidof(IAppBundleWeb),
-  __uuidof(IAppWeb),
-  __uuidof(IAppVersionWeb),
-  __uuidof(ICoCreateAsync),
-  __uuidof(ICoCreateAsyncStatus),
-  __uuidof(ICredentialDialog),
-
-  // Omaha2 IIDs:
-  __uuidof(IBrowserHttpRequest2),
-  __uuidof(IProcessLauncher),
-  __uuidof(IProgressWndEvents),
-  __uuidof(IJobObserver),
-  __uuidof(IGoogleUpdate),
-  __uuidof(IGoogleUpdateCore),
-};
-
-struct ComProxyMode {
-  static bool is_machine() {
-    return goopdate_utils::IsRunningFromOfficialGoopdateDir(true);
-  }
-
-  static const GUID& class_id() {
-    return is_machine() ? __uuidof(GoogleComProxyMachineClass) :
-                          __uuidof(GoogleComProxyUserClass);
-  }
-
-  static const GUID ps_clsid() {
-    if (is_machine()) {
-      GUID proxy_clsid = PROXY_CLSID_IS_MACHINE;
-      return proxy_clsid;
-    } else {
-      GUID proxy_clsid = PROXY_CLSID_IS_USER;
-      return proxy_clsid;
-    }
-  }
-
-  static const TCHAR* const hk_root() {
-    return is_machine() ? _T("HKLM") : _T("HKCU");
-  }
-};
-
-#pragma warning(push)
-
-// C4640: construction of local static object is not thread-safe
-#pragma warning(disable : 4640)
-
-// C4505: unreferenced IUnknown local functions have been removed
-#pragma warning(disable : 4505)
-
-class ATL_NO_VTABLE ComProxy
-    : public CComObjectRootEx<CComMultiThreadModel>,
-      public CComCoClass<ComProxy>,
-      public IUnknown {
- public:
-  ComProxy() {
-    CORE_LOG(L2, (_T("[ComProxy::ComProxy]")));
-  }
-
-  DECLARE_GET_CONTROLLING_UNKNOWN()
-  DECLARE_REGISTRY_RESOURCEID_EX(IDR_COM_PROXY_RGS);
-
-#pragma warning(push)
-// Construction of local static object is not thread-safe
-#pragma warning(disable:4640)
-  BEGIN_REGISTRY_MAP()
-    REGMAP_ENTRY(_T("HKROOT"), ComProxyMode::hk_root())
-    REGMAP_ENTRY(_T("CLSID"),  ComProxyMode::class_id())
-  END_REGISTRY_MAP()
-#pragma warning(pop)
-
-  BEGIN_COM_MAP(ComProxy)
-    COM_INTERFACE_ENTRY(IUnknown)
-    COM_INTERFACE_ENTRY_FUNC(__uuidof(IClientSecurity), 0, QueryInternal)
-    COM_INTERFACE_ENTRY_FUNC(__uuidof(IMultiQI), 0, QueryInternal)
-    COM_INTERFACE_ENTRY_AGGREGATE_BLIND(proxy_manager_.p)
-  END_COM_MAP()
-
-  static HRESULT WINAPI QueryInternal(void* ptr, REFIID iid,
-                                      void** retval, DWORD_PTR) {
-    ASSERT1(ptr);
-    ASSERT1(retval);
-    CORE_LOG(L2, (_T("[ComProxy::QueryInternal][%s]"), GuidToString(iid)));
-
-    ComProxy* this_ptr = reinterpret_cast<ComProxy*>(ptr);
-    return this_ptr->proxy_internal_unknown_->QueryInternalInterface(iid,
-                                                                     retval);
-  }
-
-  HRESULT FinalConstruct() {
-    CORE_LOG(L2, (_T("[ComProxy::FinalConstruct]")));
-
-    HRESULT hr = RegisterProxyStubs();
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[RegisterProxyStubs failed][0x%x]"), hr));
-      // If explicit registration failed, the registry-based proxy lookup
-      // mechanism may still work. Fall through.
-    }
-
-    hr = ::CoGetStdMarshalEx(GetControllingUnknown(),
-                             SMEXF_HANDLER,
-                             &proxy_manager_);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[::CoGetStdMarshalEx failed][0x%x]"), hr));
-      return hr;
-    }
-
-    return proxy_manager_.QueryInterface(&proxy_internal_unknown_);
-  }
-
-  void FinalRelease() {
-    CORE_LOG(L2, (_T("[ComProxy::FinalRelease]")));
-  }
-
-  static HRESULT RegisterProxyStubs() {
-    static LLock lock;
-    static bool is_registered = false;
-
-    __mutexScope(lock);
-
-    if (is_registered) {
-      return S_OK;
-    }
-
-    CORE_LOG(L2, (_T("[ComProxy::RegisterProxyStubs][Registering][%d]"),
-                  ComProxyMode::is_machine()));
-
-    const GUID ps_clsid = ComProxyMode::ps_clsid();
-    for (size_t i = 0; i < arraysize(kIIDsToRegister); ++i) {
-      HRESULT hr = ::CoRegisterPSClsid(kIIDsToRegister[i], ps_clsid);
-      if (FAILED(hr)) {
-        CORE_LOG(LE, (_T("[::CoRegisterPSClsid failed][%s][%s][0x%x]"),
-            GuidToString(kIIDsToRegister[i]), GuidToString(ps_clsid), hr));
-        return hr;
-      }
-    }
-
-    is_registered = true;
-    return S_OK;
-  }
-
- protected:
-  virtual ~ComProxy() {
-    CORE_LOG(L2, (_T("[ComProxy::~ComProxy]")));
-  }
-
-  CComPtr<IUnknown> proxy_manager_;
-  CComPtr<IInternalUnknown> proxy_internal_unknown_;
-
-  DISALLOW_COPY_AND_ASSIGN(ComProxy);
-};
-
-#pragma warning(pop)
-
-class StdMarshalInfo : public IStdMarshalInfo {
- public:
-  explicit StdMarshalInfo(bool is_machine) : is_machine_(is_machine) {
-    CORE_LOG(L6, (_T("[StdMarshalInfo::StdMarshalInfo][%d]"), is_machine));
-
-    VERIFY1(SUCCEEDED(ComProxy::RegisterProxyStubs()));
-  }
-
-  // IStdMarshalInfo.
-  STDMETHODIMP GetClassForHandler(DWORD context, void* ptr, CLSID* clsid) {
-    UNREFERENCED_PARAMETER(context);
-    UNREFERENCED_PARAMETER(ptr);
-
-    *clsid = is_machine_ ? __uuidof(GoogleComProxyMachineClass) :
-                           __uuidof(GoogleComProxyUserClass);
-    return S_OK;
-  }
-
- private:
-  bool is_machine_;
-
-  DISALLOW_COPY_AND_ASSIGN(StdMarshalInfo);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_COM_PROXY_H_
-
diff --git a/goopdate/com_wrapper_creator.h b/goopdate/com_wrapper_creator.h
deleted file mode 100644
index f367e13..0000000
--- a/goopdate/com_wrapper_creator.h
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// TODO(omaha): rename the file to match the name of the class.
-
-#ifndef OMAHA_GOOPDATE_COM_WRAPPER_CREATOR_H_
-#define OMAHA_GOOPDATE_COM_WRAPPER_CREATOR_H_
-
-#include <windows.h>
-#include <atlbase.h>
-#include <atlcom.h>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "base/scoped_ptr_address.h"
-#include "base/utils.h"
-#include "goopdate/omaha3_idl.h"
-#include "omaha/goopdate/model_object.h"
-#include "third_party/bar/shared_ptr.h"
-
-namespace omaha {
-
-class AppBundle;
-typedef shared_ptr<AppBundle> ControllingPtr;
-
-// Generalizes the creation of COM wrappers for a given class T.
-// It requires:
-//   * The wrapper class TWrapper derives from ComWrapper
-//   * The wrapped class T provides access to model instance
-template <typename TWrapper, typename T>
-class ComWrapper : public CComObjectRootEx<CComObjectThreadModel> {
- public:
-
-  static HRESULT Create(const ControllingPtr& controlling_ptr,
-                        T* t, IDispatch** t_wrapper) {
-    ASSERT1(t);
-    ASSERT1(t_wrapper);
-
-    ASSERT1(IsModelLockedByCaller(t->model()));
-
-    scoped_ptr<TComObject> t_com_object;
-    HRESULT hr = TComObject::CreateInstance(address(t_com_object));
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = t_com_object->QueryInterface(t_wrapper);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    t_com_object->model_ = t->model();
-    t_com_object->controlling_ptr_ = controlling_ptr;
-    t_com_object->wrapped_obj_ = t;
-
-    t_com_object.release();
-    return S_OK;
-  }
-
- protected:
-  ComWrapper() : model_(NULL), wrapped_obj_(NULL) {}
-
-  ~ComWrapper() {}
-
-  void FinalRelease() {
-    controlling_ptr_.reset();
-    wrapped_obj_ = NULL;
-  }
-
-  const Model* model() const {
-    return omaha::interlocked_exchange_pointer(&model_, model_);
-  }
-
-  const ControllingPtr& controlling_ptr() const {
-    ASSERT1(IsModelLockedByCaller(wrapped_obj_->model()));
-    return controlling_ptr_;
-  }
-
-  T* wrapped_obj() {
-    return omaha::interlocked_exchange_pointer(&wrapped_obj_, wrapped_obj_);
-  }
-
- private:
-
-  typedef CComObject<TWrapper> TComObject;
-
-  // The pointer is written and read from multiple threads and it is written
-  // to with the same value by the atomic pointer exchange, hence the volatile
-  // and mutable cv qualifiers respectively.
-  mutable Model* volatile model_;
-
-  ControllingPtr controlling_ptr_;
-
-  T* wrapped_obj_;
-
-  DISALLOW_COPY_AND_ASSIGN(ComWrapper);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_COM_WRAPPER_CREATOR_H_
-
diff --git a/goopdate/crash.cc b/goopdate/crash.cc
deleted file mode 100644
index b799046..0000000
--- a/goopdate/crash.cc
+++ /dev/null
@@ -1,1113 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// TODO(omaha): for reliability sake, the code that sets up the exception
-// handler should be very minimalist and not call so much outside of this
-// module. One idea is to split the crash module in two: one minimalist part
-// responsible for setting up the exception handler and one that is uploading
-// the crash.
-
-#include "omaha/goopdate/crash.h"
-
-#include <windows.h>
-#include <shlwapi.h>
-#include <atlbase.h>
-#include <atlstr.h>
-#include <cmath>
-#include <map>
-#include <string>
-#include <vector>
-#include "base/basictypes.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/const_addresses.h"
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/exception_barrier.h"
-#include "omaha/base/file.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/module_utils.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/path.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/time.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/command_line_builder.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/event_logger.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/common/stats_uploader.h"
-#include "omaha/goopdate/goopdate_metrics.h"
-#include "third_party/breakpad/src/client/windows/common/ipc_protocol.h"
-#include "third_party/breakpad/src/client/windows/crash_generation/client_info.h"
-#include "third_party/breakpad/src/client/windows/crash_generation/crash_generation_server.h"
-#include "third_party/breakpad/src/client/windows/sender/crash_report_sender.h"
-
-using google_breakpad::ClientInfo;
-using google_breakpad::CrashGenerationServer;
-using google_breakpad::CrashReportSender;
-using google_breakpad::CustomClientInfo;
-using google_breakpad::ExceptionHandler;
-using google_breakpad::ReportResult;
-
-namespace omaha {
-
-const ACCESS_MASK kPipeAccessMask = FILE_READ_ATTRIBUTES  |
-                                    FILE_READ_DATA        |
-                                    FILE_WRITE_ATTRIBUTES |
-                                    FILE_WRITE_DATA       |
-                                    SYNCHRONIZE;
-
-CString Crash::module_filename_;
-CString Crash::crash_dir_;
-CString Crash::checkpoint_file_;
-CString Crash::version_postfix_  = kCrashVersionPostfixString;
-CString Crash::crash_report_url_ = kUrlCrashReport;
-int Crash::max_reports_per_day_  = kCrashReportMaxReportsPerDay;
-ExceptionHandler* Crash::exception_handler_ = NULL;
-CrashGenerationServer* Crash::crash_server_ = NULL;
-
-bool Crash::is_machine_ = false;
-const TCHAR* const Crash::kDefaultProductName =
-    SHORT_COMPANY_NAME _T(" Error Reporting");
-
-HRESULT Crash::Initialize(bool is_machine) {
-  is_machine_ = is_machine;
-
-  HRESULT hr = GetModuleFileName(NULL, &module_filename_);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = InitializeCrashDir();
-  if (FAILED(hr)) {
-    return hr;
-  }
-  ASSERT1(!crash_dir_.IsEmpty());
-  CORE_LOG(L2, (_T("[crash dir %s]"), crash_dir_));
-
-  // The checkpoint file maintains state information for the crash report
-  // client, such as the number of reports per day successfully sent.
-  checkpoint_file_ = ConcatenatePath(crash_dir_, _T("checkpoint"));
-  if (checkpoint_file_.IsEmpty()) {
-    return GOOPDATE_E_PATH_APPEND_FAILED;
-  }
-
-  return S_OK;
-}
-
-HRESULT Crash::InstallCrashHandler(bool is_machine) {
-  CORE_LOG(L3, (_T("[Crash::InstallCrashHandler][is_machine %d]"), is_machine));
-
-  HRESULT hr = Initialize(is_machine);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[failed to initialize Crash][0x%08x]"), hr));
-    return hr;
-  }
-
-  // Only installs the exception handler if the process is not a crash report
-  // process. If the crash reporter crashes as well, this results in an
-  // infinite loop.
-  bool is_crash_report_process = false;
-  if (FAILED(IsCrashReportProcess(&is_crash_report_process)) ||
-      is_crash_report_process) {
-    return S_OK;
-  }
-
-  // Allocate this instance dynamically so that it is going to be
-  // around until the process terminates. Technically, this instance "leaks",
-  // but this is actually the correct behavior.
-  if (exception_handler_) {
-    delete exception_handler_;
-  }
-
-  MINIDUMP_TYPE dump_type = ConfigManager::Instance()->IsInternalUser() ?
-                                MiniDumpWithFullMemory : MiniDumpNormal;
-  exception_handler_ = new ExceptionHandler(crash_dir_.GetString(),
-                                            NULL,
-                                            &Crash::MinidumpCallback,
-                                            NULL,
-                                            ExceptionHandler::HANDLER_ALL,
-                                            dump_type,
-                                            NULL,
-                                            NULL);
-
-  // Breakpad does not get the exceptions that are not propagated to the
-  // UnhandledExceptionFilter. This is the case where we crashed on a stack
-  // which we do not own, such as an RPC stack. To get these exceptions we
-  // initialize a static ExceptionBarrier object.
-  ExceptionBarrier::set_handler(&Crash::EBHandler);
-
-  CORE_LOG(L2, (_T("[exception handler has been installed]")));
-  return S_OK;
-}
-
-void Crash::UninstallCrashHandler() {
-  ExceptionBarrier::set_handler(NULL);
-  delete exception_handler_;
-  exception_handler_ = NULL;
-
-  CORE_LOG(L2, (_T("[exception handler has been uninstalled]")));
-}
-
-HRESULT Crash::CrashHandler(bool is_machine,
-                            const google_breakpad::ClientInfo& client_info,
-                            const CString& crash_filename) {
-  // GoogleCrashHandler.exe is only aggregating metrics at process exit. Since
-  // GoogleCrashHandler.exe is long-running however, we hardly ever exit. As a
-  // consequence, the metrics below will be reported very infrequently. This
-  // call below will do additional aggregation of metrics, so that we can report
-  // the metrics below in a timely manner.
-  ON_SCOPE_EXIT(AggregateMetrics, is_machine);
-
-  // Count the number of crashes requested by applications.
-  ++metric_oop_crashes_requested;
-
-  DWORD pid = client_info.pid();
-  OPT_LOG(L1, (_T("[client requested dump][pid %d]"), pid));
-
-  ASSERT1(!crash_filename.IsEmpty());
-  if (crash_filename.IsEmpty()) {
-    OPT_LOG(L1, (_T("[no crash file]")));
-    ++metric_oop_crashes_crash_filename_empty;
-    return E_UNEXPECTED;
-  }
-
-  CString custom_info_filename;
-  HRESULT hr = CreateCustomInfoFile(crash_filename,
-                                    client_info.GetCustomInfo(),
-                                    &custom_info_filename);
-  if (FAILED(hr)) {
-    OPT_LOG(LE, (_T("[CreateCustomInfoFile failed][0x%08x]"), hr));
-    ++metric_oop_crashes_createcustominfofile_failed;
-    return hr;
-  }
-
-  // Start a sender process to handle the crash.
-  CommandLineBuilder builder(COMMANDLINE_MODE_REPORTCRASH);
-  builder.set_crash_filename(crash_filename);
-  builder.set_custom_info_filename(custom_info_filename);
-  builder.set_is_machine_set(is_machine);
-  CString cmd_line = builder.GetCommandLine(module_filename_);
-
-  hr = StartSenderWithCommandLine(&cmd_line);
-  if (FAILED(hr)) {
-    OPT_LOG(LE, (_T("[StartSenderWithCommandLine failed][0x%08x]"), hr));
-    ++metric_oop_crashes_startsenderwithcommandline_failed;
-    return hr;
-  }
-
-  OPT_LOG(L1, (_T("[client dump handled][pid %d]"), pid));
-  return S_OK;
-}
-
-// The implementation must be as simple as possible and use only the
-// resources it needs to start a reporter process and then exit.
-bool Crash::MinidumpCallback(const wchar_t* dump_path,
-                             const wchar_t* minidump_id,
-                             void*,
-                             EXCEPTION_POINTERS*,
-                             MDRawAssertionInfo*,
-                             bool succeeded) {
-  if (succeeded && *dump_path && *minidump_id) {
-    // We need a way to see if the crash happens while we are installing
-    // something. This is a tough spot to be doing anything at all since
-    // we've been handling a crash.
-    // TODO(omaha): redesign a better mechanism.
-    bool is_interactive = Crash::IsInteractive();
-
-    // TODO(omaha): format a command line without extra memory allocations.
-    CString crash_filename;
-    SafeCStringFormat(&crash_filename, _T("%s\\%s.dmp"),
-                      dump_path, minidump_id);
-    EnclosePath(&crash_filename);
-    StartReportCrash(is_interactive, crash_filename);
-
-    // For in-proc crash generation, ExceptionHandler either creates a Normal
-    // MiniDump, or a Full MiniDump, based on the dump_type. However, in the
-    // case of OOP crash generation both the Normal and Full dumps are created
-    // by the crash handling server, with the default full dump filename having
-    // a suffix of "-full.dmp". If Omaha switches to using OOP crash generation,
-    // this file is uploaded as well.
-    if (ConfigManager::Instance()->IsInternalUser()) {
-      SafeCStringFormat(&crash_filename, _T("%s\\%s-full.dmp"),
-                        dump_path, minidump_id);
-      EnclosePath(&crash_filename);
-      if (File::Exists(crash_filename)) {
-        StartReportCrash(is_interactive, crash_filename);
-      }
-    }
-  }
-
-  // There are two ways to stop execution of the current process: ExitProcess
-  // and TerminateProcess. Calling ExitProcess results in calling the
-  // destructors of the static objects before the process exits.
-  // TerminateProcess unconditionally stops the process so no user mode code
-  // executes beyond this point.
-  ::TerminateProcess(::GetCurrentProcess(),
-                     static_cast<UINT>(GOOPDATE_E_CRASH));
-  return true;
-}
-
-void Crash::StartReportCrash(bool is_interactive,
-                             const CString& crash_filename) {
-  // CommandLineBuilder escapes the program name before returning the
-  // command line to the caller.
-  CommandLineBuilder builder(COMMANDLINE_MODE_REPORTCRASH);
-  builder.set_is_interactive_set(is_interactive);
-  builder.set_crash_filename(crash_filename);
-  builder.set_is_machine_set(is_machine_);
-  CString cmd_line = builder.GetCommandLine(module_filename_);
-
-  // Set an environment variable which the crash reporter process will
-  // inherit. We don't want to install a crash handler for the reporter
-  // process to avoid an infinite loop in the case the reporting process
-  // crashes also. When the reporting process begins execution, the presence
-  // of this environment variable is tested, and the crash handler will not be
-  // installed.
-  if (::SetEnvironmentVariable(kNoCrashHandlerEnvVariableName, (_T("1")))) {
-    STARTUPINFO si = {sizeof(si)};
-    PROCESS_INFORMATION pi = {0};
-    if (::CreateProcess(NULL,
-                        cmd_line.GetBuffer(),
-                        NULL,
-                        NULL,
-                        false,
-                        0,
-                        NULL,
-                        NULL,
-                        &si,
-                        &pi)) {
-      ::CloseHandle(pi.hProcess);
-      ::CloseHandle(pi.hThread);
-    }
-  }
-}
-
-HRESULT Crash::StartSenderWithCommandLine(CString* cmd_line) {
-  TCHAR* env_vars = ::GetEnvironmentStrings();
-  if (env_vars == NULL) {
-    return HRESULTFromLastError();
-  }
-
-  // Add an environment variable to the crash reporter process to indicate it
-  // not to install a crash handler. This avoids an infinite loop in the case
-  // the reporting process crashes also. When the reporting process begins
-  // execution, the presence of this environment variable is tested, and the
-  // crash handler will not be installed.
-  CString new_var;
-  new_var.Append(kNoCrashHandlerEnvVariableName);
-  new_var.Append(_T("=1"));
-
-  // Compute the length of environment variables string. The format of the
-  // string is Name1=Value1\0Name2=Value2\0Name3=Value3\0\0.
-  const TCHAR* current = env_vars;
-  size_t env_vars_char_count = 0;
-  while (*current) {
-    size_t sub_length = _tcslen(current) + 1;
-    env_vars_char_count += sub_length;
-    current += sub_length;
-  }
-  // Add one to length to count the trailing NULL character marking the end of
-  // all environment variables.
-  ++env_vars_char_count;
-
-  // Copy the new environment variable and the existing variables in a new
-  // buffer.
-  size_t new_var_char_count = new_var.GetLength() + 1;
-  scoped_array<TCHAR> new_env_vars(
-      new TCHAR[env_vars_char_count + new_var_char_count]);
-  size_t new_var_byte_count = new_var_char_count * sizeof(TCHAR);
-  memcpy(new_env_vars.get(),
-         static_cast<const TCHAR*>(new_var),
-         new_var_byte_count);
-  size_t env_vars_byte_count = env_vars_char_count * sizeof(TCHAR);
-  memcpy(new_env_vars.get() + new_var_char_count,
-         env_vars,
-         env_vars_byte_count);
-  ::FreeEnvironmentStrings(env_vars);
-
-  STARTUPINFO si = {sizeof(si)};
-  PROCESS_INFORMATION pi = {0};
-  if (!::CreateProcess(NULL,
-                       cmd_line->GetBuffer(),
-                       NULL,
-                       NULL,
-                       false,
-                       CREATE_UNICODE_ENVIRONMENT,
-                       new_env_vars.get(),
-                       NULL,
-                       &si,
-                       &pi)) {
-    return HRESULTFromLastError();
-  }
-
-  ::CloseHandle(pi.hProcess);
-  ::CloseHandle(pi.hThread);
-  return S_OK;
-}
-
-HRESULT Crash::CreateCustomInfoFile(const CString& dump_file,
-                                    const CustomClientInfo& custom_client_info,
-                                    CString* custom_info_filepath) {
-  // Since goopdate_utils::WriteNameValuePairsToFile is implemented in terms
-  // of WritePrivateProfile API, relative paths are relative to the Windows
-  // directory instead of the current directory of the process.
-  ASSERT(!::PathIsRelative(dump_file), (_T("Path must be absolute")));
-
-  // Determine the path for custom info file.
-  CString filepath = GetPathRemoveExtension(dump_file);
-  SafeCStringAppendFormat(&filepath, _T(".txt"));
-
-  // Create a map of name/value pairs from custom client info.
-  std::map<CString, CString> custom_info_map;
-  for (size_t i = 0; i < custom_client_info.count; ++i) {
-    custom_info_map[custom_client_info.entries[i].name] =
-                    custom_client_info.entries[i].value;
-  }
-
-  HRESULT hr = goopdate_utils::WriteNameValuePairsToFile(filepath,
-                                                         kCustomClientInfoGroup,
-                                                         custom_info_map);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  *custom_info_filepath = filepath;
-  return S_OK;
-}
-
-// Backs up the crash and uploads it if allowed to.
-HRESULT Crash::DoSendCrashReport(bool can_upload,
-                                 bool is_out_of_process,
-                                 const CString& crash_filename,
-                                 const ParameterMap& parameters,
-                                 CString* report_id) {
-  ASSERT1(!crash_filename.IsEmpty());
-  ASSERT1(report_id);
-  report_id->Empty();
-
-  if (!File::Exists(crash_filename)) {
-    return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
-  }
-
-  CString product_name = GetProductName(parameters);
-  VERIFY1(SUCCEEDED(SaveLastCrash(crash_filename, product_name)));
-
-  HRESULT hr = S_OK;
-  if (can_upload) {
-    hr = UploadCrash(is_out_of_process, crash_filename, parameters, report_id);
-  } else {
-    CORE_LOG(L2, (_T("[crash uploads are not allowed]")));
-  }
-
-  return hr;
-}
-
-HRESULT Crash::UploadCrash(bool is_out_of_process,
-                           const CString& crash_filename,
-                           const ParameterMap& parameters,
-                           CString* report_id) {
-  ASSERT1(report_id);
-  report_id->Empty();
-
-  // Calling this avoids crashes in WinINet. See: http://b/1258692
-  EnsureRasmanLoaded();
-
-  ASSERT1(!crash_dir_.IsEmpty());
-  ASSERT1(!checkpoint_file_.IsEmpty());
-
-  // Do best effort to send the crash. If it can't communicate with the backend,
-  // it retries a few times over a few hours time interval.
-  HRESULT hr = S_OK;
-  for (int i = 0; i != kCrashReportAttempts; ++i) {
-    std::wstring report_code;
-    CrashReportSender sender(checkpoint_file_.GetString());
-    sender.set_max_reports_per_day(max_reports_per_day_);
-    CORE_LOG(L2, (_T("[Uploading crash report]")
-                  _T("[%s][%s]"), crash_report_url_, crash_filename));
-    ASSERT1(!crash_report_url_.IsEmpty());
-    ReportResult res = sender.SendCrashReport(crash_report_url_.GetString(),
-                                              parameters,
-                                              crash_filename.GetString(),
-                                              &report_code);
-    switch (res) {
-      case google_breakpad::RESULT_SUCCEEDED:
-        report_id->SetString(report_code.c_str());
-        hr = S_OK;
-        break;
-
-      case google_breakpad::RESULT_FAILED:
-        OPT_LOG(L2, (_T("[Crash report failed but it will retry sending]")));
-        ::Sleep(kCrashReportResendPeriodMs);
-        hr = E_FAIL;
-        break;
-
-      case google_breakpad::RESULT_REJECTED:
-        hr = GOOPDATE_E_CRASH_REJECTED;
-        break;
-
-      case google_breakpad::RESULT_THROTTLED:
-        hr = GOOPDATE_E_CRASH_THROTTLED;
-        break;
-
-      default:
-        hr = E_FAIL;
-        break;
-    };
-
-    // Continue the retry loop only when it could not contact the server.
-    if (res != google_breakpad::RESULT_FAILED) {
-      break;
-    }
-  }
-
-  CORE_LOG(L2, (_T("[crash report code = %s]"), *report_id));
-
-  // The event source for the out-of-process crashes is the product name.
-  // Therefore, in the event of an out-of-process crash, the log entry
-  // appears to be generated by the product that crashed.
-  CString product_name = is_out_of_process ? GetProductName(parameters) :
-                                             kAppName;
-  CString event_text;
-  uint16 event_type(0);
-  if (!report_id->IsEmpty()) {
-    event_type = EVENTLOG_INFORMATION_TYPE;
-    SafeCStringFormat(&event_text, _T("Crash uploaded. Id=%s."), *report_id);
-  } else {
-    ASSERT1(FAILED(hr));
-    event_type = EVENTLOG_WARNING_TYPE;
-    SafeCStringFormat(&event_text, _T("Crash not uploaded. Error=0x%x."), hr);
-  }
-  VERIFY1(SUCCEEDED(Crash::Log(event_type,
-                               kCrashUploadEventId,
-                               product_name,
-                               event_text)));
-
-  UpdateCrashUploadMetrics(is_out_of_process, hr);
-
-  return hr;
-}
-
-HRESULT Crash::SaveLastCrash(const CString& crash_filename,
-                             const CString& product_name) {
-  if (product_name.IsEmpty()) {
-    return E_INVALIDARG;
-  }
-  CString tmp;
-  SafeCStringFormat(&tmp, _T("%s-last.dmp"), product_name);
-  CString save_filename = ConcatenatePath(crash_dir_, tmp);
-  if (save_filename.IsEmpty()) {
-    return GOOPDATE_E_PATH_APPEND_FAILED;
-  }
-
-  CORE_LOG(L2, (_T("[Crash::SaveLastCrash]")
-                 _T("[to %s][from %s]"), save_filename, crash_filename));
-
-  return ::CopyFile(crash_filename,
-                    save_filename,
-                    false) ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT Crash::CleanStaleCrashes() {
-  CORE_LOG(L3, (_T("[Crash::CleanStaleCrashes]")));
-
-  // ??- sequence is a c++ trigraph corresponding to a ~. Escape it.
-  const TCHAR kWildCards[] = _T("???????\?-???\?-???\?-???\?-????????????.dmp");
-  std::vector<CString> crash_files;
-  HRESULT hr = File::GetWildcards(crash_dir_, kWildCards, &crash_files);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  time64 now = GetCurrent100NSTime();
-  for (size_t i = 0; i != crash_files.size(); ++i) {
-    CORE_LOG(L3, (_T("[found crash file][%s]"), crash_files[i]));
-    FILETIME creation_time = {0};
-    if (SUCCEEDED(File::GetFileTime(crash_files[i],
-                                    &creation_time,
-                                    NULL,
-                                    NULL))) {
-      double time_diff =
-          static_cast<double>(now - FileTimeToTime64(creation_time));
-      if (abs(time_diff) >= kDaysTo100ns) {
-        VERIFY1(::DeleteFile(crash_files[i]));
-      }
-    }
-  }
-
-  return S_OK;
-}
-
-HRESULT Crash::Report(bool can_upload_in_process,
-                      const CString& crash_filename,
-                      const CString& custom_info_filename,
-                      const CString& lang) {
-  const bool is_out_of_process = !custom_info_filename.IsEmpty();
-  HRESULT hr = S_OK;
-  if (is_out_of_process) {
-    hr = ReportProductCrash(true, crash_filename, custom_info_filename, lang);
-    ::DeleteFile(custom_info_filename);
-  } else {
-    hr = ReportGoogleUpdateCrash(can_upload_in_process,
-                                 crash_filename,
-                                 custom_info_filename,
-                                 lang);
-  }
-  ::DeleteFile(crash_filename);
-  CleanStaleCrashes();
-  return hr;
-}
-
-HRESULT Crash::ReportGoogleUpdateCrash(bool can_upload,
-                                       const CString& crash_filename,
-                                       const CString& custom_info_filename,
-                                       const CString& lang) {
-  OPT_LOG(L1, (_T("[Crash::ReportGoogleUpdateCrash]")));
-
-  UNREFERENCED_PARAMETER(custom_info_filename);
-
-  ++metric_crashes_total;
-
-  // Build the map of additional parameters to report along with the crash.
-  CString ver(GetVersionString() + version_postfix_);
-  CString uid = goopdate_utils::GetUserIdLazyInit(is_machine_);
-
-  ParameterMap parameters;
-  parameters[_T("prod")]    = _T("Update2");
-  parameters[_T("ver")]     = ver;
-  parameters[_T("userid")]  = uid;
-  parameters[_T("lang")]    = lang;
-
-  CString event_text;
-  SafeCStringFormat(&event_text,
-      _T("%s has encountered a fatal error.\r\n")
-      _T("ver=%s;lang=%s;id=%s;is_machine=%d;upload=%d;minidump=%s"),
-      kAppName,
-      ver, lang, uid, is_machine_, can_upload ? 1 : 0, crash_filename);
-  VERIFY1(SUCCEEDED(Crash::Log(EVENTLOG_ERROR_TYPE,
-                               kCrashReportEventId,
-                               kAppName,
-                               event_text)));
-
-  CString report_id;
-  return DoSendCrashReport(can_upload,
-                           false,             // Omaha crash.
-                           crash_filename,
-                           parameters,
-                           &report_id);
-}
-
-HRESULT Crash::ReportProductCrash(bool can_upload,
-                                  const CString& crash_filename,
-                                  const CString& custom_info_filename,
-                                  const CString& lang) {
-  OPT_LOG(L1, (_T("[Crash::ReportProductCrash]")));
-
-  UNREFERENCED_PARAMETER(lang);
-
-  // All product crashes must be uploaded.
-  ASSERT1(can_upload);
-
-  // Count the number of crashes the sender was requested to handle.
-  ++metric_oop_crashes_total;
-
-  std::map<CString, CString> parameters_temp;
-  HRESULT hr = goopdate_utils::ReadNameValuePairsFromFile(
-      custom_info_filename,
-      kCustomClientInfoGroup,
-      &parameters_temp);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  ParameterMap parameters;
-  std::map<CString, CString>::const_iterator iter;
-  for (iter = parameters_temp.begin(); iter != parameters_temp.end(); ++iter) {
-    parameters[iter->first.GetString()] = iter->second.GetString();
-  }
-
-  const CString product_name = GetProductName(parameters);
-  const std::wstring ver     = parameters[_T("ver")];
-
-  CString event_text;
-  SafeCStringFormat(&event_text,
-      _T("%s has encountered a fatal error.\r\n")
-      _T("ver=%s;is_machine=%d;minidump=%s"),
-      product_name, ver.c_str(), is_machine_, crash_filename);
-  VERIFY1(SUCCEEDED(Crash::Log(EVENTLOG_ERROR_TYPE,
-                               kCrashReportEventId,
-                               product_name,
-                               event_text)));
-
-  CString report_id;
-  return hr = DoSendCrashReport(can_upload,
-                                true,                  // Out of process crash.
-                                crash_filename,
-                                parameters,
-                                &report_id);
-}
-
-void __stdcall Crash::EBHandler(EXCEPTION_POINTERS* ptrs) {
-  if (exception_handler_) {
-    exception_handler_->WriteMinidumpForException(ptrs);
-  }
-}
-
-HRESULT Crash::GetExceptionInfo(const CString& crash_filename,
-                                MINIDUMP_EXCEPTION* ex_info) {
-  ASSERT1(ex_info);
-  ASSERT1(!crash_filename.IsEmpty());
-
-  // Dynamically link with the dbghelp to avoid runtime resource bloat.
-  scoped_library dbghelp(::LoadLibrary(_T("dbghelp.dll")));
-  if (!dbghelp) {
-    return HRESULTFromLastError();
-  }
-
-  typedef BOOL (WINAPI *MiniDumpReadDumpStreamFun)(void* base_of_dump,
-                                                   ULONG stream_number,
-                                                   MINIDUMP_DIRECTORY* dir,
-                                                   void** stream_pointer,
-                                                   ULONG* stream_size);
-
-  MiniDumpReadDumpStreamFun minidump_read_dump_stream =
-      reinterpret_cast<MiniDumpReadDumpStreamFun>(::GetProcAddress(get(dbghelp),
-                                                  "MiniDumpReadDumpStream"));
-  ASSERT1(minidump_read_dump_stream);
-  if (!minidump_read_dump_stream) {
-    return HRESULTFromLastError();
-  }
-
-  // The minidump file must be mapped in memory before reading the streams.
-  scoped_hfile file(::CreateFile(crash_filename,
-                                 GENERIC_READ,
-                                 FILE_SHARE_READ,
-                                 NULL,
-                                 OPEN_EXISTING,
-                                 FILE_ATTRIBUTE_READONLY,
-                                 NULL));
-  ASSERT1(file);
-  if (!file) {
-    return HRESULTFromLastError();
-  }
-  scoped_file_mapping file_mapping(::CreateFileMapping(get(file),
-                                                       NULL,
-                                                       PAGE_READONLY,
-                                                       0,
-                                                       0,
-                                                       NULL));
-  if (!file_mapping) {
-    return HRESULTFromLastError();
-  }
-  scoped_file_view base_of_dump(::MapViewOfFile(get(file_mapping),
-                                                FILE_MAP_READ,
-                                                0,
-                                                0,
-                                                0));
-  if (!base_of_dump) {
-    return HRESULTFromLastError();
-  }
-
-  // Read the exception stream and pick up the exception record.
-  MINIDUMP_DIRECTORY minidump_directory = {0};
-  void* stream_pointer = NULL;
-  ULONG stream_size = 0;
-  bool result = !!(*minidump_read_dump_stream)(get(base_of_dump),
-                                               ExceptionStream,
-                                               &minidump_directory,
-                                               &stream_pointer,
-                                               &stream_size);
-  if (!result) {
-    return HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
-  }
-  MINIDUMP_EXCEPTION_STREAM* exception_stream =
-      static_cast<MINIDUMP_EXCEPTION_STREAM*>(stream_pointer);
-  ASSERT1(stream_pointer);
-  ASSERT1(stream_size);
-
-  *ex_info = exception_stream->ExceptionRecord;
-  return S_OK;
-}
-
-bool Crash::IsInteractive() {
-  bool result = false;
-  ::EnumWindows(&Crash::EnumWindowsCallback, reinterpret_cast<LPARAM>(&result));
-  return result;
-}
-
-// Finds if the given window is in the current process.
-BOOL CALLBACK Crash::EnumWindowsCallback(HWND hwnd, LPARAM param) {
-  DWORD pid = 0;
-  ::GetWindowThreadProcessId(hwnd, &pid);
-  if (::IsWindowVisible(hwnd) && pid == ::GetCurrentProcessId() && param) {
-    *reinterpret_cast<bool*>(param) = true;
-    return false;
-  }
-  return true;
-}
-
-HRESULT Crash::InitializeCrashDir() {
-  crash_dir_.Empty();
-  ConfigManager* cm = ConfigManager::Instance();
-  CString dir = is_machine_ ? cm->GetMachineCrashReportsDir() :
-                              cm->GetUserCrashReportsDir();
-
-  if (is_machine_ && !dir.IsEmpty()) {
-    HRESULT hr = InitializeDirSecurity(&dir);
-    if (FAILED(hr)) {
-      CORE_LOG(LW, (_T("[failed to initialize crash dir security][0x%x]"), hr));
-      ::RemoveDirectory(dir);
-    }
-  }
-
-  // Use the temporary directory of the process if the crash directory can't be
-  // initialized for any reason. Users can't read files in other users'
-  // temporary directories so the temp dir is good option to still have
-  // crash handling.
-  if (dir.IsEmpty()) {
-    dir = app_util::GetTempDir();
-  }
-
-  if (dir.IsEmpty()) {
-    return GOOPDATE_E_CRASH_NO_DIR;
-  }
-
-  crash_dir_ = dir;
-  return S_OK;
-}
-
-HRESULT Crash::InitializeDirSecurity(CString* dir) {
-  ASSERT1(dir);
-
-  // Users can only read permissions on the crash dir.
-  CDacl dacl;
-  const uint8 kAceFlags = SUB_CONTAINERS_AND_OBJECTS_INHERIT;
-  if (!dacl.AddAllowedAce(Sids::System(), GENERIC_ALL, kAceFlags) ||
-      !dacl.AddAllowedAce(Sids::Admins(), GENERIC_ALL, kAceFlags) ||
-      !dacl.AddAllowedAce(Sids::Users(), READ_CONTROL, kAceFlags)) {
-    return GOOPDATE_E_CRASH_SECURITY_FAILED;
-  }
-
-  SECURITY_INFORMATION si = DACL_SECURITY_INFORMATION |
-                            PROTECTED_DACL_SECURITY_INFORMATION;
-  DWORD error = ::SetNamedSecurityInfo(dir->GetBuffer(),
-                                       SE_FILE_OBJECT,
-                                       si,
-                                       NULL,
-                                       NULL,
-                                       const_cast<ACL*>(dacl.GetPACL()),
-                                       NULL);
-  if (error != ERROR_SUCCESS) {
-    return HRESULT_FROM_WIN32(error);
-  }
-  return S_OK;
-}
-
-// Checks for the presence of an environment variable. We are not interested
-// in the value of the variable but only in its presence.
-HRESULT Crash::IsCrashReportProcess(bool* is_crash_report_process) {
-  ASSERT1(is_crash_report_process);
-  if (::GetEnvironmentVariable(kNoCrashHandlerEnvVariableName, NULL, 0)) {
-    *is_crash_report_process = true;
-    return S_OK;
-  } else {
-    DWORD error(::GetLastError());
-    *is_crash_report_process = false;
-    return error == ERROR_ENVVAR_NOT_FOUND ? S_OK : HRESULT_FROM_WIN32(error);
-  }
-}
-
-HRESULT Crash::Log(uint16 type,
-                   uint32 id,
-                   const TCHAR* source,
-                   const TCHAR* description) {
-  ASSERT1(source);
-  ASSERT1(description);
-  return EventLogger::ReportEvent(source,
-                                  type,
-                                  0,            // Category.
-                                  id,
-                                  1,            // Number of strings.
-                                  &description,
-                                  0,            // Raw data size.
-                                  NULL);        // Raw data.
-}
-
-CString Crash::GetProductName(const ParameterMap& parameters) {
-  // The crash is logged using the value of 'prod' if available or
-  // a default constant string otherwise.
-  CString product_name;
-  ParameterMap::const_iterator it = parameters.find(_T("prod"));
-  const bool is_found = it != parameters.end() && !it->second.empty();
-  return is_found ? it->second.c_str() : kDefaultProductName;
-}
-
-void Crash::UpdateCrashUploadMetrics(bool is_out_of_process, HRESULT hr) {
-  switch (hr) {
-    case S_OK:
-      if (is_out_of_process) {
-        ++metric_oop_crashes_uploaded;
-      } else {
-        ++metric_crashes_uploaded;
-      }
-      break;
-
-    case E_FAIL:
-      if (is_out_of_process) {
-        ++metric_oop_crashes_failed;
-      } else {
-        ++metric_crashes_failed;
-      }
-      break;
-
-    case GOOPDATE_E_CRASH_THROTTLED:
-      if (is_out_of_process) {
-        ++metric_oop_crashes_throttled;
-      } else {
-        ++metric_crashes_throttled;
-      }
-      break;
-
-    case GOOPDATE_E_CRASH_REJECTED:
-      if (is_out_of_process) {
-        ++metric_oop_crashes_rejected;
-      } else {
-        ++metric_crashes_rejected;
-      }
-      break;
-
-    default:
-      ASSERT1(false);
-      break;
-  }
-}
-
-int Crash::CrashNow() {
-#ifdef DEBUG
-  CORE_LOG(LEVEL_ERROR, (_T("[Crash::CrashNow]")));
-  int foo = 10;
-  int bar = foo - 10;
-  int baz = foo / bar;
-  return baz;
-#else
-  return 0;
-#endif
-}
-
-HRESULT Crash::CreateLowIntegrityDesc(CSecurityDesc* sd) {
-  ASSERT1(sd);
-  ASSERT1(!sd->GetPSECURITY_DESCRIPTOR());
-
-  if (!vista_util::IsVistaOrLater()) {
-    return S_FALSE;
-  }
-
-  return sd->FromString(LOW_INTEGRITY_SDDL_SACL) ? S_OK :
-                                                   HRESULTFromLastError();
-}
-
-bool Crash::AddPipeSecurityDaclToDesc(bool is_machine, CSecurityDesc* sd) {
-  ASSERT1(sd);
-
-  CAccessToken current_token;
-  if (!current_token.GetEffectiveToken(TOKEN_QUERY)) {
-    OPT_LOG(LE, (_T("[Failed to get current thread token]")));
-    return false;
-  }
-
-  CDacl dacl;
-  if (!current_token.GetDefaultDacl(&dacl)) {
-    OPT_LOG(LE, (_T("[Failed to get default DACL]")));
-    return false;
-  }
-
-  if (!is_machine) {
-    sd->SetDacl(dacl);
-    return true;
-  }
-
-  if (!dacl.AddAllowedAce(ATL::Sids::Users(), kPipeAccessMask)) {
-    OPT_LOG(LE, (_T("[Failed to setup pipe security]")));
-    return false;
-  }
-
-  if (!dacl.AddDeniedAce(ATL::Sids::Network(), FILE_ALL_ACCESS)) {
-    OPT_LOG(LE, (_T("[Failed to setup pipe security]")));
-    return false;
-  }
-
-  sd->SetDacl(dacl);
-  return true;
-}
-
-bool Crash::BuildPipeSecurityAttributes(bool is_machine,
-                                        CSecurityAttributes* sa) {
-  ASSERT1(sa);
-
-  CSecurityDesc sd;
-  HRESULT hr = CreateLowIntegrityDesc(&sd);
-  if (FAILED(hr)) {
-    OPT_LOG(LE, (_T("[Failed to CreateLowIntegrityDesc][0x%x]"), hr));
-    return false;
-  }
-
-  if (!AddPipeSecurityDaclToDesc(is_machine, &sd)) {
-    return false;
-  }
-
-  sa->Set(sd);
-
-#ifdef _DEBUG
-  // Print SDDL for debugging.
-  CString sddl;
-  sd.ToString(&sddl, OWNER_SECURITY_INFORMATION |
-                     GROUP_SECURITY_INFORMATION |
-                     DACL_SECURITY_INFORMATION  |
-                     SACL_SECURITY_INFORMATION  |
-                     LABEL_SECURITY_INFORMATION);
-  CORE_LOG(L1, (_T("[Pipe security SDDL][%s]"), sddl));
-#endif
-
-  return true;
-}
-
-bool Crash::BuildCrashDirSecurityAttributes(CSecurityAttributes* sa) {
-  ASSERT1(sa);
-
-  CDacl dacl;
-  CAccessToken current_token;
-
-  if (!current_token.GetEffectiveToken(TOKEN_QUERY)) {
-    OPT_LOG(LE, (_T("[Failed to get current thread token]")));
-    return false;
-  }
-
-  if (!current_token.GetDefaultDacl(&dacl)) {
-    OPT_LOG(LE, (_T("[Failed to get default DACL]")));
-    return false;
-  }
-
-  CSecurityDesc sd;
-  sd.SetDacl(dacl);
-  // Prevent the security settings on the parent folder of CrashReports folder
-  // from being inherited by children of CrashReports folder.
-  sd.SetControl(SE_DACL_PROTECTED, SE_DACL_PROTECTED);
-  sa->Set(sd);
-
-#ifdef _DEBUG
-  // Print SDDL for debugging.
-  CString sddl;
-  sd.ToString(&sddl);
-  CORE_LOG(L1, (_T("[Folder security SDDL][%s]"), sddl));
-#endif
-
-  return true;
-}
-
-HRESULT Crash::StartServer() {
-  CORE_LOG(L1, (_T("[Crash::StartServer]")));
-  ++metric_crash_start_server_total;
-
-  std::wstring dump_path(crash_dir_);
-
-  // Append the current user's sid to the pipe name so that machine and
-  // user instances of the crash server open different pipes.
-  CString user_sid;
-  HRESULT hr = user_info::GetProcessUser(NULL, NULL, &user_sid);
-  if (FAILED(hr)) {
-    OPT_LOG(LE, (_T("[user_info::GetProcessUser failed][0x%08x]"), hr));
-    return hr;
-  }
-  CString pipe_name(kCrashPipeNamePrefix);
-  SafeCStringAppendFormat(&pipe_name, _T("\\%s"), user_sid);
-
-  CSecurityAttributes pipe_sec_attrs;
-
-  // * If running as machine, use custom security attributes on the pipe to
-  // allow all users on the local machine to connect to it. Add the low
-  // integrity SACL to account for browser plugins.
-  // * If running as user, the default security descriptor for the
-  // pipe grants full control to the system account, administrators,
-  // and the creator owner. Add the low integrity SACL to account for browser
-  // plugins.
-  if (!BuildPipeSecurityAttributes(is_machine_, &pipe_sec_attrs)) {
-    return GOOPDATE_E_CRASH_SECURITY_FAILED;
-  }
-
-  scoped_ptr<CrashGenerationServer> crash_server(
-      new CrashGenerationServer(std::wstring(pipe_name),
-                                &pipe_sec_attrs,
-                                ClientConnectedCallback, NULL,
-                                ClientCrashedCallback, NULL,
-                                ClientExitedCallback, NULL,
-                                true, &dump_path));
-
-  if (!crash_server->Start()) {
-    CORE_LOG(LE, (_T("[CrashServer::Start failed]")));
-    return GOOPDATE_E_CRASH_START_SERVER_FAILED;
-  }
-
-  crash_server_ = crash_server.release();
-
-  ++metric_crash_start_server_succeeded;
-  return S_OK;
-}
-
-void Crash::StopServer() {
-  CORE_LOG(L1, (_T("[Crash::StopServer]")));
-  delete crash_server_;
-  crash_server_ = NULL;
-}
-
-
-void _cdecl Crash::ClientConnectedCallback(void* context,
-                                           const ClientInfo* client_info) {
-  ASSERT1(!context);
-  ASSERT1(client_info);
-  UNREFERENCED_PARAMETER(context);
-  OPT_LOG(L1, (_T("[Client connected][%d]"), client_info->pid()));
-}
-
-void _cdecl Crash::ClientCrashedCallback(void* context,
-                                         const ClientInfo* client_info,
-                                         const std::wstring* dump_path) {
-  ASSERT1(!context);
-  ASSERT1(client_info);
-  UNREFERENCED_PARAMETER(context);
-  OPT_LOG(L1, (_T("[Client crashed][%d]"), client_info->pid()));
-
-  CString crash_filename(dump_path ? dump_path->c_str() : NULL);
-  HRESULT hr = Crash::CrashHandler(is_machine_, *client_info, crash_filename);
-  if (FAILED(hr)) {
-    OPT_LOG(LE, (_T("[CrashHandler failed][0x%08x]"), hr));
-  }
-}
-
-void _cdecl Crash::ClientExitedCallback(void* context,
-                                        const ClientInfo* client_info) {
-  ASSERT1(!context);
-  ASSERT1(client_info);
-  UNREFERENCED_PARAMETER(context);
-  OPT_LOG(L1, (_T("[Client exited][%d]"), client_info->pid()));
-}
-
-}  // namespace omaha
-
diff --git a/goopdate/crash.h b/goopdate/crash.h
deleted file mode 100644
index 013dfd1..0000000
--- a/goopdate/crash.h
+++ /dev/null
@@ -1,293 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_CRASH_H__
-#define OMAHA_GOOPDATE_CRASH_H__
-
-#include <windows.h>
-#include <dbghelp.h>
-#include <atlsecurity.h>
-#include <atlstr.h>
-#include <map>
-#include "base/basictypes.h"
-#include "omaha/common/const_goopdate.h"
-#include "third_party/gtest/include/gtest/gtest_prod.h"
-#include "third_party/breakpad/src/client/windows/crash_generation/client_info.h"
-#include "third_party/breakpad/src/client/windows/crash_generation/crash_generation_server.h"
-#include "third_party/breakpad/src/client/windows/handler/exception_handler.h"
-
-namespace omaha {
-
-// Annotates the version reported along with the crash.
-const TCHAR* const kCrashVersionPostfixString =
-#if !OFFICIAL_BUILD
-  _T(".private")
-#endif
-#if DEBUG
-  _T(".debug")
-#endif
-  _T("");
-
-// Official builds can only send a few crashes per day. Debug builds including
-// all build modes for unit tests send unlimited number of crashes.
-const int kCrashReportMaxReportsPerDay =
-#if OFFICIAL_BUILD
-                                         5;
-#else
-                                         INT_MAX;
-#endif
-
-const TCHAR* const kNoCrashHandlerEnvVariableName =
-    _T("GOOGLE_UPDATE_NO_CRASH_HANDLER");
-
-// TODO(omaha): refactor so this is not a static class.
-// TODO(omaha): rename class name to better indicate its funtionality.
-class Crash {
- public:
-  typedef std::map<std::wstring, std::wstring> ParameterMap;
-
-  // Installs and uninstalls Breakpad exception handler. Calling the
-  // functions from DllMain results in undefined behavior, including
-  // deadlocks.
-  static HRESULT InstallCrashHandler(bool is_machine);
-  static void UninstallCrashHandler();
-
-  // Starts the server to listen for out-of-process crashes.
-  static HRESULT StartServer();
-
-  // Stops the crash server.
-  static void StopServer();
-
-  // Generates a divide by zero to trigger Breakpad dump in non-ship builds.
-  static int CrashNow();
-
-  // Handles out-of-process crash requests.
-  static HRESULT CrashHandler(bool is_machine,
-                              const google_breakpad::ClientInfo& client_info,
-                              const CString& crash_filename);
-
-  // Reports a crash by logging it to the Windows event log, saving a copy of
-  // the crash, and uploading it. After reporting the crash, the function
-  // deletes the crash file. Crashes that have a custom info file are
-  // considered product crashes and they are always handled out-of-process.
-  // These crashes are always uploaded.
-  // Crashes that do not specify a custom info file are considered Omaha
-  // internal crashes and they are handled in-process. In this case, the
-  // upload behavior is controlled by the value of can_upload_in_process
-  // parameter.
-  static HRESULT Report(bool can_upload_in_process,
-                        const CString& crash_filename,
-                        const CString& custom_info_filename,
-                        const CString& lang);
-
-  // Sets a version string which is appended to the 'ver' parameter sent
-  // with the crash report.
-  static void set_version_postfix(const TCHAR* version_postfix) {
-    version_postfix_ = version_postfix;
-  }
-
-  // Sets how many reports can be sent until the crash report sender starts
-  // rejecting and discarding crashes.
-  static void set_max_reports_per_day(int max_reports_per_day) {
-    max_reports_per_day_ = max_reports_per_day;
-  }
-
-  static void set_crash_report_url(const TCHAR* crash_report_url) {
-    crash_report_url_ = crash_report_url;
-  }
-
-  static bool is_machine() { return is_machine_; }
-
- private:
-
-  static HRESULT Initialize(bool is_machine);
-
-  // Reports a crash of Google Update. Does not delete the crash file.
-  static HRESULT ReportGoogleUpdateCrash(bool can_upload,
-                                         const CString& crash_filename,
-                                         const CString& custom_info_filename,
-                                         const CString& lang);
-
-  // Reports an out-of-process crash on behalf of another product. Does not
-  // delete the crash file.
-  static HRESULT ReportProductCrash(bool can_upload,
-                                    const CString& crash_filename,
-                                    const CString& custom_info_filename,
-                                    const CString& lang);
-
-  // Initializes the crash directory. Creates the directory if it does not
-  // exist.
-  static HRESULT InitializeCrashDir();
-
-  static HRESULT InitializeDirSecurity(CString* dir);
-
-  // Returns true if the current process is reporting an exception.
-  static HRESULT IsCrashReportProcess(bool* is_crash_report_process);
-
-  // Logs an entry in the Windows Event Log for the specified source.
-  static HRESULT Log(uint16 type,
-                     uint32 id,
-                     const TCHAR* source,
-                     const TCHAR* description);
-
-  // Starts the sender process with the environment variables setup such that
-  // the sender process doesn't register crash filter to avoid potential
-  // recursive crashes problem.
-  static HRESULT StartSenderWithCommandLine(CString* cmd_line);
-
-  // Creates a text file that contains name/value pairs of custom information.
-  // The text file is created in the same directory as the given dump file, but
-  // with a .txt extension. Stores the path of the text file created in the
-  // custom_info_filepath parameter.
-  // TODO(omaha): Move this functionality to breakpad. All the information
-  // needed to write custom information file is known when the dump is generated
-  // and hence breakpad could as easily create the text file.
-  static HRESULT CreateCustomInfoFile(
-      const CString& dump_file,
-      const google_breakpad::CustomClientInfo& client_info,
-      CString* custom_info_filepath);
-
-  // Sends a crash report. If sent successfully, report_id contains the
-  // report id generated by the crash server.
-  static HRESULT DoSendCrashReport(bool can_upload,
-                                   bool is_out_of_process,
-                                   const CString& crash_filename,
-                                   const ParameterMap& parameters,
-                                   CString* report_id);
-
-  // Callback function to run after the minidump has been written.
-  static bool MinidumpCallback(const wchar_t* dump_path,
-                               const wchar_t* minidump_id,
-                               void* context,
-                               EXCEPTION_POINTERS* exinfo,
-                               MDRawAssertionInfo* assertion,
-                               bool succeeded);
-
-  // Start an instance of /report.
-  static void StartReportCrash(bool is_interactive,
-                               const CString& crash_filename);
-
-  // Returns true if the crash has happened in an Omaha process which
-  // has a top level window up.
-  static bool IsInteractive();
-
-  // Returns the "prod" product name if found in the map or a default,
-  // constant string otherwise.
-  static CString GetProductName(const ParameterMap& parameters);
-
-  // Updates the crash metrics after uploading the crash.
-  static void UpdateCrashUploadMetrics(bool is_out_of_process, HRESULT hr);
-
-  // Uploads the crash, logs the result of the crash upload, and updates
-  // the crash metrics.
-  static HRESULT UploadCrash(bool is_out_of_process,
-                             const CString& crash_filename,
-                             const ParameterMap& parameters,
-                             CString* report_id);
-
-  // Creates a back up copy of the current crash for future debugging use cases.
-  static HRESULT SaveLastCrash(const CString& crash_filename,
-                               const CString& product_name);
-
-  // Cleans up stale crashes from the crash dir. Curently, crashes older than
-  // 1 day are deleted.
-  static HRESULT CleanStaleCrashes();
-
-  // Retrieves the minidump exception information from the minidump file.
-  static HRESULT GetExceptionInfo(const CString& crash_filename,
-                                  MINIDUMP_EXCEPTION* ex_info);
-
-  // Receives a top-level window and sets the param to true if the window
-  // belongs to this process.
-  static BOOL CALLBACK EnumWindowsCallback(HWND hwnd, LPARAM param);
-
-  // Callback function to run when an exception is passing through an
-  // exception barrier.
-  static void __stdcall EBHandler(EXCEPTION_POINTERS* ptrs);
-
-  // Callback function to run when a new client connects to the crash server.
-  static void _cdecl ClientConnectedCallback(
-      void* context,
-      const google_breakpad::ClientInfo* client_info);
-
-  // Callback function to run when a client signals a crash to the crash server.
-  static void _cdecl ClientCrashedCallback(
-      void* context,
-      const google_breakpad::ClientInfo* client_info,
-      const std::wstring* dump_path);
-
-  // Callback function to run when a client disconnects from the crash server.
-  static void _cdecl ClientExitedCallback(
-      void* context,
-      const google_breakpad::ClientInfo* client_info);
-
-  // Given an empty CSecurityDesc, creates a low integrity sacl within it.
-  static HRESULT CreateLowIntegrityDesc(CSecurityDesc* sd);
-
-  // Builds a security DACL to allow user processes to connect to the crash
-  // server named pipe, and sets the DACL on the CSecurityDesc.
-  static bool AddPipeSecurityDaclToDesc(bool is_machine, CSecurityDesc* sd);
-
-  // Builds a security attribute to allow user processes including low integrity
-  // to connect to the crash server named pipe.
-  static bool BuildPipeSecurityAttributes(bool is_machine,
-                                          CSecurityAttributes* sa);
-
-  // Builds a security attribute to allow full control for the Local System
-  // account and read/execute for the Administrators group, when the crash
-  // handler is running as Local System.
-  static bool BuildCrashDirSecurityAttributes(CSecurityAttributes* sa);
-
-  // TODO(omaha): fix static instances of class type not allowed.
-  static CString module_filename_;
-  static CString Crash::crash_dir_;
-  static CString Crash::checkpoint_file_;
-  static CString version_postfix_;
-
-  static CString crash_report_url_;
-  static int max_reports_per_day_;
-  static google_breakpad::ExceptionHandler* exception_handler_;
-  static google_breakpad::CrashGenerationServer* crash_server_;
-
-  static bool is_machine_;
-
-  static const int kCrashReportAttempts       = 3;
-  static const int kCrashReportResendPeriodMs = 1 * 60 * 60 * 1000;  // 1 hour.
-
-  // Default string to report out-of-process crashes with in the case
-  // 'prod' information is not available.
-  static const TCHAR* const kDefaultProductName;
-
-  friend class CrashTest;
-
-  FRIEND_TEST(CrashTest, CleanStaleCrashes);
-  FRIEND_TEST(CrashTest, CreateCustomInfoFile);
-  FRIEND_TEST(CrashTest, GetExceptionInfo);
-  FRIEND_TEST(CrashTest, GetProductName);
-  FRIEND_TEST(CrashTest, InstallCrashHandler);
-  FRIEND_TEST(CrashTest, IsCrashReportProcess);
-  FRIEND_TEST(CrashTest, Report_OmahaCrash);
-  FRIEND_TEST(CrashTest, Report_ProductCrash);
-  FRIEND_TEST(CrashTest, SaveLastCrash);
-  FRIEND_TEST(CrashTest, StartServer);
-  FRIEND_TEST(CrashTest, WriteMinidump);
-
-  DISALLOW_IMPLICIT_CONSTRUCTORS(Crash);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_CRASH_H__
-
diff --git a/goopdate/crash_unittest.cc b/goopdate/crash_unittest.cc
deleted file mode 100644
index 93f2f34..0000000
--- a/goopdate/crash_unittest.cc
+++ /dev/null
@@ -1,400 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <string>
-#include "omaha/base/app_util.h"
-#include "omaha/base/atl_regexp.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/const_addresses.h"
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/time.h"
-#include "omaha/base/user_info.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/event_logger.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/goopdate/crash.h"
-#include "omaha/testing/unit_test.h"
-
-// TODO(omaha): Modify the tests to avoid writing files to the staging
-// directory, which should not be modified after building.
-
-using google_breakpad::ClientInfo;
-using google_breakpad::CustomClientInfo;
-using google_breakpad::CustomInfoEntry;
-using google_breakpad::ExceptionHandler;
-
-namespace omaha {
-
-namespace {
-
-const TCHAR kMiniDumpFilename[]     = _T("minidump.dmp");
-const TCHAR kCustomInfoFilename[]   = _T("minidump.txt");
-const TCHAR kTestFilenamePattern[]  = _T("minidump.*");
-
-}  // namespace
-
-class CrashTest : public testing::Test {
- protected:
-  // Initialize the crash reporting for the machine case. The user case is
-  // simpler and specific tests can reinitialize for the user case if needed.
-  virtual void SetUp() {
-    module_dir_ = app_util::GetModuleDirectory(NULL);
-    EXPECT_HRESULT_SUCCEEDED(Crash::Initialize(true));
-  }
-
-  virtual void TearDown() {
-    EXPECT_HRESULT_SUCCEEDED(DeleteDirectory(Crash::crash_dir_));
-  }
-
-  static void CallbackHelper(const wchar_t* dump_path,
-                             const wchar_t* minidump_id) {
-    CString postfix_string(kCrashVersionPostfixString);
-    postfix_string.Append(_T(".ut"));
-    CString crash_filename;
-    crash_filename.Format(_T("%s\\%s.dmp"), dump_path, minidump_id);
-    Crash::set_max_reports_per_day(kMaxReportsPerDayFromUnittests);
-    Crash::set_version_postfix(postfix_string);
-    Crash::set_crash_report_url(kUrlCrashReport);
-    EXPECT_SUCCEEDED(Crash::Report(true, crash_filename, CString(), false));
-  }
-
-  static bool MinidumpCallback(const wchar_t* dump_path,
-                               const wchar_t* minidump_id,
-                               void* context,
-                               EXCEPTION_POINTERS*,
-                               MDRawAssertionInfo*,
-                               bool succeeded) {
-    EXPECT_TRUE(dump_path);
-    EXPECT_TRUE(minidump_id);
-    EXPECT_TRUE(!context);
-    EXPECT_SUCCEEDED(succeeded);
-
-    CallbackHelper(dump_path, minidump_id);
-    return true;
-  }
-
-  static void BuildPipeSecurityAttributesTest(bool is_machine) {
-    CSecurityAttributes pipe_sec_attrs;
-    EXPECT_TRUE(
-        Crash::BuildPipeSecurityAttributes(is_machine, &pipe_sec_attrs));
-    LPVOID sec_desc(pipe_sec_attrs.lpSecurityDescriptor);
-    CSecurityDesc sd1(*reinterpret_cast<SECURITY_DESCRIPTOR*>(sec_desc));
-    CString sddl1;
-
-    sd1.ToString(&sddl1, OWNER_SECURITY_INFORMATION |
-                         GROUP_SECURITY_INFORMATION |
-                         DACL_SECURITY_INFORMATION  |
-                         SACL_SECURITY_INFORMATION  |
-                         LABEL_SECURITY_INFORMATION);
-
-    CSecurityDesc sd2;
-    EXPECT_TRUE(Crash::AddPipeSecurityDaclToDesc(is_machine, &sd2));
-    EXPECT_HRESULT_SUCCEEDED(
-        vista_util::AddLowIntegritySaclToExistingDesc(&sd2));
-
-    CString sddl2;
-    sd2.ToString(&sddl2, OWNER_SECURITY_INFORMATION |
-                         GROUP_SECURITY_INFORMATION |
-                         DACL_SECURITY_INFORMATION  |
-                         SACL_SECURITY_INFORMATION  |
-                         LABEL_SECURITY_INFORMATION);
-
-    EXPECT_STREQ(sddl2, sddl1);
-
-    if (vista_util::IsVistaOrLater()) {
-      // The low integrity SACL is at the end of the SDDL string.
-      EXPECT_STREQ(LOW_INTEGRITY_SDDL_SACL,
-                   sddl1.Right(arraysize(LOW_INTEGRITY_SDDL_SACL) - 1));
-    }
-  }
-
-  static HRESULT StartSenderWithCommandLine(CString* cmd_line) {
-    return Crash::StartSenderWithCommandLine(cmd_line);
-  }
-
-  // Returns the strings of the last Update2 event in the event log.
-  static CString GetLastCrashEventStrings() {
-    const size_t kBufferSize = 1024;
-    uint8 buffer[kBufferSize] = {0};
-    EVENTLOGRECORD* rec = reinterpret_cast<EVENTLOGRECORD*>(buffer);
-
-    rec->Length = kBufferSize;
-    EXPECT_SUCCEEDED(EventLogger::ReadLastEvent(_T("Update2"), rec));
-    EXPECT_EQ(kCrashUploadEventId, rec->EventID);
-
-    const TCHAR* strings = reinterpret_cast<const TCHAR*>(
-        (reinterpret_cast<uint8*>(buffer + rec->StringOffset)));
-
-    return CString(strings);
-  }
-
-  CString module_dir_;
-
-  static const int kMaxReportsPerDayFromUnittests = INT_MAX;
-};
-
-TEST_F(CrashTest, CreateCustomInfoFile) {
-  CString expected_custom_info_file_path;
-  expected_custom_info_file_path.Format(_T("%s\\%s"),
-                                        module_dir_, kCustomInfoFilename);
-
-  CString crash_filename;
-  crash_filename.Format(_T("%s\\%s"), module_dir_, kMiniDumpFilename);
-  CustomInfoEntry info_entry(_T("foo"), _T("bar"));
-  CustomClientInfo custom_client_info = {&info_entry, 1};
-
-  CString actual_custom_info_filepath;
-  EXPECT_SUCCEEDED(Crash::CreateCustomInfoFile(crash_filename,
-                                               custom_client_info,
-                                               &actual_custom_info_filepath));
-  EXPECT_STREQ(expected_custom_info_file_path, actual_custom_info_filepath);
-  EXPECT_TRUE(File::Exists(actual_custom_info_filepath));
-  EXPECT_TRUE(::DeleteFile(actual_custom_info_filepath));
-
-  // Tests an invalid file name.
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_INVALID_NAME),
-            Crash::CreateCustomInfoFile(_T("C:\\\"minidump.dmp"),
-                                        custom_client_info,
-                                        &actual_custom_info_filepath));
-}
-
-// Tests sending an Omaha crash.
-TEST_F(CrashTest, Report_OmahaCrash) {
-  CString crash_filename;
-  crash_filename.Format(_T("%s\\%s"), module_dir_, kMiniDumpFilename);
-
-  ::DeleteFile(crash_filename);
-
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            Crash::Report(true, crash_filename, _T(""), _T("")));
-
-  // Copy the minidump and the corresponding info file.
-  CString test_dir;
-  test_dir.Format(_T("%s\\unittest_support"), module_dir_);
-  ASSERT_SUCCEEDED(File::CopyWildcards(test_dir,          // From.
-                                       module_dir_,       // To.
-                                       kTestFilenamePattern,
-                                       true));
-
-  ASSERT_TRUE(File::Exists(crash_filename));
-
-  ASSERT_SUCCEEDED(Crash::Report(true, crash_filename, _T(""), _T("")));
-
-  // The crash artifacts should be deleted after the crash is reported.
-  EXPECT_FALSE(File::Exists(crash_filename));
-}
-
-// Tests sending an out-of-process crash.
-// This test will write an entry with the source "Update2" in the Event Log.
-TEST_F(CrashTest, Report_ProductCrash) {
-  CString crash_filename;
-  CString custom_info_filename;
-  crash_filename.Format(_T("%s\\%s"), module_dir_, kMiniDumpFilename);
-  custom_info_filename.Format(_T("%s\\%s"), module_dir_, kCustomInfoFilename);
-
-  ::DeleteFile(crash_filename);
-  ::DeleteFile(custom_info_filename);
-
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            Crash::Report(true, crash_filename, custom_info_filename, _T("")));
-
-  // Copy the minidump and the corresponding info file.
-  CString test_dir;
-  test_dir.Format(_T("%s\\unittest_support"), module_dir_);
-  ASSERT_SUCCEEDED(File::CopyWildcards(test_dir,          // From.
-                                       module_dir_,       // To.
-                                       kTestFilenamePattern,
-                                       true));
-
-  ASSERT_TRUE(File::Exists(crash_filename));
-  ASSERT_TRUE(File::Exists(custom_info_filename));
-
-  ASSERT_SUCCEEDED(Crash::Report(true, crash_filename,
-                                 custom_info_filename, _T("")));
-
-  // Check the 'crash uploaded' event log.
-  const CString strings = GetLastCrashEventStrings();
-
-  // Verify that the strings include the Id token.
-  AtlRE crash_id_regex(_T("Id={\\h+}."));
-  CString crash_id;
-  EXPECT_TRUE(AtlRE::PartialMatch(strings, crash_id_regex, &crash_id));
-
-  // The crash artifacts should be deleted after the crash is reported.
-  EXPECT_FALSE(File::Exists(crash_filename));
-  EXPECT_FALSE(File::Exists(custom_info_filename));
-}
-
-// Tests generation of a minidump and uploading it to the staging server.
-TEST_F(CrashTest, WriteMinidump) {
-  ASSERT_TRUE(!Crash::crash_dir_.IsEmpty());
-
-  MINIDUMP_TYPE dump_type = MiniDumpNormal;
-  ExceptionHandler handler(Crash::crash_dir_.GetString(), NULL,
-                           &MinidumpCallback, NULL,
-                           ExceptionHandler::HANDLER_NONE,
-                           dump_type, NULL, NULL);
-  ASSERT_TRUE(handler.WriteMinidump());
-}
-
-// Tests the retrieval of the exception information from an existing mini dump.
-TEST_F(CrashTest, GetExceptionInfo) {
-  const uint32 kExceptionAddress  = 0x12345670;
-  const uint32 kExceptionCode     = 0xc0000005;
-
-  CString filename;
-  filename.AppendFormat(_T("%s\\unittest_support\\%s"),
-                        module_dir_, kMiniDumpFilename);
-  MINIDUMP_EXCEPTION ex_info = {0};
-  ASSERT_SUCCEEDED(Crash::GetExceptionInfo(filename, &ex_info));
-  EXPECT_EQ(kExceptionAddress, ex_info.ExceptionAddress);
-  EXPECT_EQ(kExceptionCode, ex_info.ExceptionCode);
-}
-
-TEST_F(CrashTest, IsCrashReportProcess) {
-  // Clear the environment variable.
-  ::SetEnvironmentVariable(kNoCrashHandlerEnvVariableName, NULL);
-
-  bool is_crash_report_process = false;
-  EXPECT_SUCCEEDED(Crash::IsCrashReportProcess(&is_crash_report_process));
-  EXPECT_FALSE(is_crash_report_process);
-
-  EXPECT_TRUE(::SetEnvironmentVariable(kNoCrashHandlerEnvVariableName,
-              _T("1")));
-  is_crash_report_process = false;
-  EXPECT_SUCCEEDED(Crash::IsCrashReportProcess(&is_crash_report_process));
-  EXPECT_TRUE(is_crash_report_process);
-
-  // Clear the environment variable.
-  EXPECT_TRUE(::SetEnvironmentVariable(kNoCrashHandlerEnvVariableName, NULL));
-}
-
-TEST_F(CrashTest, GetProductName) {
-  Crash::ParameterMap parameters;
-  EXPECT_STREQ(SHORT_COMPANY_NAME _T(" Error Reporting"),
-               Crash::GetProductName(parameters));
-
-  parameters[_T("prod")] = _T("Update2");
-  EXPECT_STREQ(_T("Update2"), Crash::GetProductName(parameters));
-}
-
-TEST_F(CrashTest, SaveLastCrash) {
-  // Copy a test file into the module directory to use as a crash file.
-  CString test_file;    // The unit test support file.
-  CString crash_file;   // The crash file to be backed up.
-  test_file.AppendFormat(_T("%s\\unittest_support\\%s"),
-                         module_dir_, kMiniDumpFilename);
-  crash_file.AppendFormat(_T("%s\\%s"), Crash::crash_dir_, kMiniDumpFilename);
-  EXPECT_TRUE(File::Exists(test_file));
-  EXPECT_TRUE(::CopyFile(test_file, crash_file, false));
-  EXPECT_TRUE(File::Exists(crash_file));
-
-  EXPECT_HRESULT_SUCCEEDED(Crash::SaveLastCrash(crash_file, _T("test")));
-
-  CString saved_crash_file;  // The name of backup crash file.
-  saved_crash_file.AppendFormat(_T("%s\\test-last.dmp"), Crash::crash_dir_);
-  EXPECT_TRUE(File::Exists(saved_crash_file));
-
-  EXPECT_TRUE(::DeleteFile(saved_crash_file));
-}
-
-TEST_F(CrashTest, StartServer) {
-  // Terminate all processes to avoid conflicts on the crash services pipe.
-  TerminateAllGoogleUpdateProcesses();
-
-  EXPECT_HRESULT_SUCCEEDED(Crash::StartServer());
-
-  // Try opening the crash services pipe.
-  CString user_sid;
-  EXPECT_HRESULT_SUCCEEDED(user_info::GetProcessUser(NULL, NULL, &user_sid));
-  CString pipe_name;
-  pipe_name.AppendFormat(_T("\\\\.\\pipe\\%sCrashServices\\%s"),
-                         SHORT_COMPANY_NAME, user_sid);
-  scoped_pipe pipe_handle(::CreateFile(pipe_name,
-                                       GENERIC_READ | GENERIC_WRITE,
-                                       FILE_SHARE_READ | FILE_SHARE_WRITE,
-                                       NULL,
-                                       OPEN_EXISTING,
-                                       0,
-                                       NULL));
-  EXPECT_TRUE(pipe_handle);
-
-  Crash::StopServer();
-}
-
-TEST_F(CrashTest, CleanStaleCrashes) {
-  // Copy a test file into the module directory to use as a crash file.
-  CString test_file;    // The unit test support file.
-  CString crash_file;   // The crash file to be backed up.
-  test_file.AppendFormat(_T("%s\\unittest_support\\%s"),
-                         module_dir_, kMiniDumpFilename);
-  crash_file.AppendFormat(_T("%s\\%s.dmp"),
-                          Crash::crash_dir_,
-                          _T("5695F1E0-95BD-4bc2-99C0-E9DCC0AC5274"));
-  EXPECT_TRUE(File::Exists(test_file));
-  EXPECT_TRUE(::CopyFile(test_file, crash_file, false));
-  EXPECT_TRUE(File::Exists(crash_file));
-
-  FILETIME time_created = {0};
-  time64 now = GetCurrent100NSTime();
-
-  // Create a time value 23 hours in the past. Expect the crash file remains.
-  Time64ToFileTime(now - 23 * kHoursTo100ns, &time_created);
-  EXPECT_HRESULT_SUCCEEDED(File::SetFileTime(crash_file, &time_created,
-                                             NULL, NULL));
-  Crash::CleanStaleCrashes();
-  EXPECT_TRUE(File::Exists(crash_file));
-
-  // Create a time value 25 hours in the past. Expect the crash file is deleted.
-  Time64ToFileTime(now - 25 * kHoursTo100ns, &time_created);
-  EXPECT_HRESULT_SUCCEEDED(File::SetFileTime(crash_file, &time_created,
-                                             NULL, NULL));
-  Crash::CleanStaleCrashes();
-  EXPECT_FALSE(File::Exists(crash_file));
-}
-
-// Installs and uninstalls the crash handler in the user case.
-TEST_F(CrashTest, InstallCrashHandler) {
-  EXPECT_HRESULT_SUCCEEDED(Crash::InstallCrashHandler(false));
-  Crash::UninstallCrashHandler();
-}
-
-// Makes sure that the security descriptor that BuildPipeSecurityAttributes
-// creates matches the security descriptor built by adding the DACL first, and
-// then using AddLowIntegritySaclToExistingDesc(). The latter method uses an
-// approach similar to what is documented in MSDN:
-// http://msdn.microsoft.com/en-us/library/bb625960.aspx
-//
-// Also, makes sure that the security descriptor that
-// BuildPipeSecurityAttributes creates has the low integrity SACL within it.
-TEST_F(CrashTest, BuildPipeSecurityAttributes) {
-  BuildPipeSecurityAttributesTest(true);
-  BuildPipeSecurityAttributesTest(false);
-}
-
-TEST_F(CrashTest, StartSenderWithCommandLine) {
-  // Negative test.
-  CString filename(_T("DoesNotExist.exe"));
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            StartSenderWithCommandLine(&filename));
-}
-
-}  // namespace omaha
-
diff --git a/goopdate/cred_dialog.cc b/goopdate/cred_dialog.cc
deleted file mode 100644
index e7d60f2..0000000
--- a/goopdate/cred_dialog.cc
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <wincred.h>
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/scoped_impersonation.h"
-#include "omaha/base/system_info.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/client/resource.h"
-#include "omaha/goopdate/cred_dialog.h"
-
-namespace omaha {
-
-STDMETHODIMP CredentialDialogBase::QueryUserForCredentials(
-    ULONG_PTR owner_hwnd,
-    BSTR server,
-    BSTR caption,
-    BSTR* username,
-    BSTR* password) {
-  ASSERT1(server && wcslen(server));
-  ASSERT1(caption);
-  ASSERT1(username);
-  ASSERT1(password);
-
-  CORE_LOG(L3, (_T("[LaunchCredentialDialog][COM server launching dialog]")));
-
-  if (!::IsWindow(reinterpret_cast<HWND>(owner_hwnd))) {
-    return E_INVALIDARG;
-  }
-
-  if (!server || !wcslen(server) || !caption) {
-    return E_INVALIDARG;
-  }
-
-  if (!username || !password) {
-    return E_POINTER;
-  }
-
-  CString message;
-  message.LoadString(IDS_PROXY_PROMPT_MESSAGE);
-  message.FormatMessage(message, server);
-
-  CString capt_cstr(caption);
-  if (capt_cstr.IsEmpty()) {
-    capt_cstr.LoadString(IDS_PRODUCT_DISPLAY_NAME);
-  }
-
-  CString user;
-  CString pass;
-  DWORD result = DisplayDialog(reinterpret_cast<HWND>(owner_hwnd),
-                               server,
-                               message,
-                               capt_cstr,
-                               &user,
-                               &pass);
-
-  if (result == NO_ERROR) {
-    user.SetSysString(username);
-    ::SecureZeroMemory(user.GetBuffer(), user.GetAllocLength() * sizeof(TCHAR));
-    pass.SetSysString(password);
-    ::SecureZeroMemory(pass.GetBuffer(), pass.GetAllocLength() * sizeof(TCHAR));
-    return S_OK;
-  }
-
-  return HRESULT_FROM_WIN32(result);
-}
-
-DWORD CredentialDialogBase::DisplayDialog(
-    HWND hwnd,
-    LPCTSTR server,
-    LPCTSTR message,
-    LPCTSTR caption,
-    CString* username_out,
-    CString* password_out) {
-  scoped_library credui_lib(::LoadLibrary(L"credui.dll"));
-  ASSERT1(credui_lib);
-  if (!credui_lib) {
-    CORE_LOG(L3, (_T("[CredUIPromptForCredentialsW not available]")));
-    return ERROR_NOT_READY;
-  }
-
-  typedef BOOL (__stdcall *CredUIPromptForCredentialsW_type)(
-      PCREDUI_INFO pUiInfo,
-      PCTSTR pszTargetName,
-      PCtxtHandle Reserved,
-      DWORD dwAuthError,
-      PCTSTR pszUserName,
-      ULONG ulUserNameMaxChars,
-      PCTSTR pszPassword,
-      ULONG ulPasswordMaxChars,
-      PBOOL pfSave,
-      DWORD dwFlags);
-  CredUIPromptForCredentialsW_type CredUIPromptForCredentialsW_fn =
-      reinterpret_cast<CredUIPromptForCredentialsW_type>(
-          GetProcAddress(get(credui_lib), "CredUIPromptForCredentialsW"));
-  ASSERT1(CredUIPromptForCredentialsW_fn || SystemInfo::IsRunningOnW2K());
-  if (!CredUIPromptForCredentialsW_fn) {
-    CORE_LOG(L3, (_T("[CredUIPromptForCredentialsW not available]")));
-    return ERROR_NOT_READY;
-  }
-
-  wchar_t temp_username[CREDUI_MAX_USERNAME_LENGTH + 1] = {};
-  wchar_t temp_password[CREDUI_MAX_PASSWORD_LENGTH + 1] = {};
-  BOOL check;
-  CREDUI_INFO info = {0};
-  info.cbSize = sizeof(info);
-  info.hwndParent = hwnd;
-  info.pszMessageText = message;
-  info.pszCaptionText = caption;
-
-  DWORD result;
-  do {
-    temp_username[0] = L'\0';
-    temp_password[0] = L'\0';
-    result = CredUIPromptForCredentialsW_fn(
-        &info,
-        server,
-        NULL,
-        0,
-        temp_username,
-        CREDUI_MAX_USERNAME_LENGTH,
-        temp_password,
-        CREDUI_MAX_PASSWORD_LENGTH,
-        &check,
-        CREDUI_FLAGS_ALWAYS_SHOW_UI | CREDUI_FLAGS_GENERIC_CREDENTIALS |
-        CREDUI_FLAGS_DO_NOT_PERSIST);
-    CORE_LOG(L3, (_T("[CredUIPromptForCredentialsW returned %d]"), result));
-  } while (result == NO_ERROR && (!temp_username[0] || !temp_password[0]));
-
-  if (result == NO_ERROR) {
-    username_out->SetString(temp_username);
-    password_out->SetString(temp_password);
-  }
-
-  ::SecureZeroMemory(temp_username, sizeof(temp_username));
-  ::SecureZeroMemory(temp_password, sizeof(temp_password));
-
-  return result;
-}
-
-}  // namespace omaha
-
diff --git a/goopdate/cred_dialog.h b/goopdate/cred_dialog.h
deleted file mode 100644
index 531e868..0000000
--- a/goopdate/cred_dialog.h
+++ /dev/null
@@ -1,190 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_CRED_DIALOG_H_
-#define OMAHA_GOOPDATE_CRED_DIALOG_H_
-
-#include <atlbase.h>
-#include <atlcom.h>
-#include "goopdate/omaha3_idl.h"
-#include "omaha/base/atlregmapex.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/goopdate/com_proxy.h"
-#include "omaha/goopdate/non_localized_resource.h"
-
-namespace omaha {
-
-#pragma warning(push)
-// Construction of local static object is not thread-safe
-#pragma warning(disable:4640)
-
-class ATL_NO_VTABLE CredentialDialogBase
-  : public CComObjectRootEx<CComObjectThreadModel>,
-    public ICredentialDialog,
-    public StdMarshalInfo {
- public:
-  explicit CredentialDialogBase(bool is_machine)
-      : StdMarshalInfo(is_machine),
-        is_machine_(is_machine) {}
-
-  BEGIN_COM_MAP(CredentialDialogBase)
-    COM_INTERFACE_ENTRY(IStdMarshalInfo)
-    COM_INTERFACE_ENTRY(ICredentialDialog)
-  END_COM_MAP()
-
-  // ICredentialDialog methods.
-  STDMETHOD(QueryUserForCredentials)(ULONG_PTR owner_hwnd,
-                                     BSTR server,
-                                     BSTR caption,
-                                     BSTR* username,
-                                     BSTR* password);
-
- protected:
-  virtual ~CredentialDialogBase() {}
-
- private:
-  bool is_machine_;
-
-  static HRESULT DoQueryUserForCredentials(
-      HWND hwnd,
-      BSTR server,
-      BSTR caption,
-      BSTR* username,
-      BSTR* password);
-
-  static DWORD DisplayDialog(
-      HWND hwnd,
-      LPCTSTR server,
-      LPCTSTR message,
-      LPCTSTR caption,
-      CString* username_out,
-      CString* password_out);
-
-  DISALLOW_COPY_AND_ASSIGN(CredentialDialogBase);
-};
-
-template <typename T>
-class ATL_NO_VTABLE CredentialDialog
-    : public CredentialDialogBase,
-      public CComCoClass<CredentialDialog<T> > {
- public:
-  CredentialDialog() : CredentialDialogBase(T::is_machine()) {}
-
-  DECLARE_NOT_AGGREGATABLE(CredentialDialog);
-  DECLARE_REGISTRY_RESOURCEID_EX(T::registry_res_id())
-
-  BEGIN_REGISTRY_MAP()
-    REGMAP_ENTRY(_T("HKROOT"), T::hk_root())
-    REGMAP_ENTRY(_T("VERSION"), _T("1.0"))
-    REGMAP_ENTRY(_T("PROGID"), T::prog_id())
-    REGMAP_ENTRY(_T("DESCRIPTION"), _T("GoogleUpdate CredentialDialog"))
-    REGMAP_ENTRY(_T("CLSID"), T::class_id())
-    REGMAP_MODULE2(_T("MODULE"), kOmahaOnDemandFileName)
-  END_REGISTRY_MAP()
-
- protected:
-  virtual ~CredentialDialog() {}
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(CredentialDialog);
-};
-
-
-struct CredentialDialogModeUser {
-  static bool is_machine() { return false; }
-  static const TCHAR* const prog_id() { return kProgIDCredentialDialogUser; }
-  static GUID class_id() { return __uuidof(CredentialDialogUserClass); }
-  static UINT registry_res_id() { return IDR_LOCAL_SERVER_RGS; }
-  static const TCHAR* const hk_root() { return _T("HKCU"); }
-};
-
-struct CredentialDialogModeMachine {
-  static bool is_machine() { return true; }
-  static const TCHAR* const prog_id() { return kProgIDCredentialDialogMachine; }
-  static GUID class_id() { return __uuidof(CredentialDialogMachineClass); }
-  static UINT registry_res_id() { return IDR_LOCAL_SERVER_RGS; }
-  static const TCHAR* const hk_root() { return _T("HKLM"); }
-};
-
-typedef CredentialDialog<CredentialDialogModeUser> CredentialDialogUser;
-typedef CredentialDialog<CredentialDialogModeMachine> CredentialDialogMachine;
-
-// A static function that decides whether to display the dialog in-process
-// or launch an out-of-process COM server for showing it, and automatically
-// handles BSTR/CString conversion.
-inline HRESULT LaunchCredentialDialog(
-    bool is_machine,
-    HWND owner_hwnd,
-    const CString& server,
-    const CString& caption,
-    CString* username_out,
-    CString* password_out) {
-  ASSERT1(username_out);
-  ASSERT1(password_out);
-
-  CAccessToken access_token;
-  if (!access_token.GetThreadToken(TOKEN_READ)) {
-    // If this thread is currently impersonating a user, that's perfect, as the
-    // COM server will be started under that user.  If not, verify that the
-    // process isn't running as LocalSystem/LocalService - we cannot show UI
-    // in that scenario without impersonating.
-    bool is_system = true;
-    HRESULT hr = IsSystemProcess(&is_system);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[CredDialog][IsSystemProcess failed][0x%08x]"), hr));
-      return hr;
-    }
-    if (is_system) {
-      CORE_LOG(LE, (_T("[CredDialog][Process running as SYSTEM - aborting]")));
-      return E_ABORT;
-    }
-  }
-
-  CComPtr<ICredentialDialog> dialog;
-  REFCLSID clsid = is_machine ? __uuidof(CredentialDialogMachineClass) :
-                                __uuidof(CredentialDialogUserClass);
-  HRESULT hr = dialog.CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[LaunchCredentialDialog][CoCreate failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  CComBSTR server_bstr(server);
-  CComBSTR caption_bstr(caption);
-  CComBSTR username_bstr;
-  CComBSTR password_bstr;
-  hr = dialog->QueryUserForCredentials(reinterpret_cast<ULONG_PTR>(owner_hwnd),
-                                       server_bstr,
-                                       caption_bstr,
-                                       &username_bstr,
-                                       &password_bstr);
-
-  if (SUCCEEDED(hr)) {
-    username_out->SetString(username_bstr);
-    password_out->SetString(password_bstr);
-  }
-  ::SecureZeroMemory(username_bstr.m_str, username_bstr.ByteLength());
-  ::SecureZeroMemory(password_bstr.m_str, password_bstr.ByteLength());
-
-  return hr;
-}
-
-#pragma warning(pop)
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_CRED_DIALOG_H_
-
diff --git a/goopdate/cred_dialog_unittest.cc b/goopdate/cred_dialog_unittest.cc
deleted file mode 100644
index d848bf3..0000000
--- a/goopdate/cred_dialog_unittest.cc
+++ /dev/null
@@ -1,154 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/constants.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/scoped_impersonation.h"
-#include "omaha/goopdate/cred_dialog.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-class CredentialDialogTest : public testing::Test {
- protected:
-  explicit CredentialDialogTest(bool is_machine)
-      : is_machine_(is_machine) {}
-
-  virtual void SetUp() {
-  }
-
-  virtual void TearDown() {
-  }
-
-  virtual bool ShouldRunTest() {
-    if (IsEnvironmentVariableSet(_T("OMAHA_TEST_UI"))) {
-      return true;
-    } else {
-      std::wcout << _T("\tThis test did not run because 'OMAHA_TEST_UI' is ")
-                    _T("not set in the environment.") << std::endl;
-      return false;
-    }
-  }
-
-  virtual void TestComObject(LPCTSTR server, LPCTSTR caption) {
-    REFCLSID clsid = is_machine_ ? __uuidof(CredentialDialogMachineClass)
-                                 : __uuidof(CredentialDialogUserClass);
-    CComPtr<ICredentialDialog> dialog;
-    EXPECT_SUCCEEDED(dialog.CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER));
-    if (dialog) {
-      CComBSTR server_bs(server);
-      CComBSTR caption_bs(caption);
-      CComBSTR user;
-      CComBSTR pass;
-      EXPECT_SUCCEEDED(dialog->QueryUserForCredentials(0,
-                                                       server_bs,
-                                                       caption_bs,
-                                                       &user,
-                                                       &pass));
-    }
-  }
-
-  virtual void TestAuto(LPCTSTR server, LPCTSTR caption) {
-    CString user;
-    CString pass;
-    EXPECT_SUCCEEDED(LaunchCredentialDialog(is_machine_,
-                                            NULL,
-                                            CString(server),
-                                            CString(caption),
-                                            &user,
-                                            &pass));
-  }
-
-  // TestAutoImpersonating() assumes that omaha_unittest.exe is being executed
-  // as LocalSystem; it will fail otherwise.
-  virtual void TestAutoImpersonating(LPCTSTR server, LPCTSTR caption) {
-    EXPECT_SUCCEEDED(InitializeClientSecurity());
-
-    // Manually load the COM proxy into the process before we start; it will
-    // assert on DLL load if we load it while impersonating.  (PSMachine should
-    // always be loaded already in a production environment; this is just an
-    // artifact of the unit test environment.)
-    CPath proxy_path(goopdate_utils::BuildInstallDirectory(
-                         is_machine_, omaha::GetVersionString()));
-    EXPECT_TRUE(proxy_path.Append(kPSFileNameMachine));
-    scoped_library psmachine_load(::LoadLibrary(proxy_path));
-    EXPECT_TRUE(!!psmachine_load);
-
-    scoped_handle logged_on_user_token(
-        goopdate_utils::GetImpersonationTokenForMachineProcess(is_machine_));
-    EXPECT_TRUE(valid(logged_on_user_token));
-    if (valid(logged_on_user_token)) {
-      scoped_impersonation impersonate_user(get(logged_on_user_token));
-      HRESULT hr = HRESULT_FROM_WIN32(impersonate_user.result());
-      EXPECT_SUCCEEDED(hr);
-      if (SUCCEEDED(hr)) {
-        TestAuto(server, caption);
-      }
-    }
-  }
-
-  const bool is_machine_;
-
- private:
-  DISALLOW_IMPLICIT_CONSTRUCTORS(CredentialDialogTest);
-};
-
-class CredentialDialogMachineTest : public CredentialDialogTest {
- protected:
-  CredentialDialogMachineTest() : CredentialDialogTest(true) {}
-};
-
-class CredentialDialogUserTest : public CredentialDialogTest {
- protected:
-  CredentialDialogUserTest() : CredentialDialogTest(false) {}
-};
-
-TEST_F(CredentialDialogUserTest, COM) {
-  if (ShouldRunTest()) {
-    TestComObject(_T("test-u-com-server"), _T("test-u-com-caption"));
-  }
-}
-
-TEST_F(CredentialDialogUserTest, Auto) {
-  if (ShouldRunTest()) {
-    TestAuto(_T("test-u-auto-server"), _T("test-u-auto-caption"));
-  }
-}
-
-TEST_F(CredentialDialogMachineTest, COM) {
-  if (ShouldRunTest()) {
-    TestComObject(_T("test-m-com-server"), _T("test-m-com-caption"));
-  }
-}
-
-TEST_F(CredentialDialogMachineTest, Auto) {
-  if (ShouldRunTest()) {
-    TestAuto(_T("test-m-auto-server"), _T("test-m-auto-caption"));
-  }
-}
-
-TEST_F(CredentialDialogMachineTest, Impersonating) {
-  bool is_system = false;
-  EXPECT_SUCCEEDED(IsSystemProcess(&is_system));
-  if (!is_system) {
-    std::wcout << _T("\tThis test is only meaningful when the unit test is ")
-                  _T("run as the SYSTEM account.") << std::endl;
-  } else {
-    TestAutoImpersonating(_T("test-m-imp-server"), _T("test-m-imp-caption"));
-  }
-}
-
-}  // end namespace omaha
-
diff --git a/goopdate/current_state.cc b/goopdate/current_state.cc
deleted file mode 100644
index 14ca0e3..0000000
--- a/goopdate/current_state.cc
+++ /dev/null
@@ -1,241 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/current_state.h"
-#include <atlsafe.h>
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-
-namespace omaha {
-
-HRESULT CurrentAppState::Create(
-    LONG state_value,
-    const CString& available_version,
-    ULONGLONG bytes_downloaded,
-    ULONGLONG total_bytes_to_download,
-    LONG download_time_remaining_ms,
-    ULONGLONG next_retry_time,
-    LONG install_progress_percentage,
-    LONG install_time_remaining_ms,
-    bool is_canceled,
-    LONG error_code,
-    LONG extra_code1,
-    const CString& completion_message,
-    LONG installer_result_code,
-    LONG installer_result_extra_code1,
-    const CString& post_install_launch_command_line,
-    const CString& post_install_url,
-    PostInstallAction post_install_action,
-    CComObject<CurrentAppState>** state) {
-  ASSERT1(state);
-  ASSERT1(state_value);
-
-  HRESULT hr = CComObject<CurrentAppState>::CreateInstance(state);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  (*state)->state_value_ = state_value;
-  (*state)->available_version_ = available_version.AllocSysString();
-  (*state)->bytes_downloaded_ = bytes_downloaded;
-  (*state)->total_bytes_to_download_ = total_bytes_to_download;
-  (*state)->download_time_remaining_ms_ = download_time_remaining_ms;
-  (*state)->next_retry_time_ = next_retry_time;
-  (*state)->install_progress_percentage_ = install_progress_percentage;
-  (*state)->install_time_remaining_ms_ = install_time_remaining_ms;
-  (*state)->is_canceled_ = is_canceled ? VARIANT_TRUE : VARIANT_FALSE;
-  (*state)->error_code_ = error_code;
-  (*state)->extra_code1_ = extra_code1;
-  (*state)->completion_message_ = completion_message.AllocSysString();
-  (*state)->installer_result_code_ = installer_result_code;
-  (*state)->installer_result_extra_code1_ = installer_result_extra_code1;
-  (*state)->post_install_launch_command_line_ =
-      post_install_launch_command_line.AllocSysString();
-  (*state)->post_install_url_ = post_install_url.AllocSysString();
-  (*state)->post_install_action_ = post_install_action;
-
-  return S_OK;
-}
-
-CurrentAppState::CurrentAppState()
-    : m_bRequiresSave(TRUE),
-      state_value_(0),
-      bytes_downloaded_(0),
-      total_bytes_to_download_(0),
-      download_time_remaining_ms_(0),
-      next_retry_time_(0),
-      install_progress_percentage_(0),
-      install_time_remaining_ms_(0),
-      is_canceled_(VARIANT_FALSE),
-      error_code_(0),
-      extra_code1_(0),
-      installer_result_code_(0),
-      installer_result_extra_code1_(0),
-      post_install_action_(0) {
-  CORE_LOG(L6, (_T("[CurrentAppState::CurrentAppState()")));
-}
-
-CurrentAppState::~CurrentAppState() {
-  CORE_LOG(L6, (_T("[CurrentAppState::~CurrentAppState()")));
-}
-
-// ICurrentState.
-// No locks are necessary because a copy of this object is returned to the
-// client.
-// TODO(omaha3): Perhaps we should set all the properties to valid values
-// regardless of the stateValue.
-// Or perhaps there are some good asserts we can and probably should do. Maybe
-// we need a helper method such as IsStateOrLater() that would handle the
-// non-contiguous issues, such as STATE_NO_UPDATE and STATE_PAUSED. Then, we
-// could ASSERT1(IsStateOrLater(STATE_UPDATE_AVAILABLE));
-
-STDMETHODIMP CurrentAppState::get_stateValue(LONG* state_value) {
-  ASSERT1(state_value);
-
-  *state_value = state_value_;
-  CORE_LOG(L6, (_T("[CurrentAppState::get_stateValue][%d]"), state_value_));
-  return S_OK;
-}
-
-STDMETHODIMP CurrentAppState::get_availableVersion(BSTR* available_version) {
-  ASSERT1(available_version);
-
-  *available_version = available_version_.Copy();
-  return S_OK;
-}
-
-STDMETHODIMP CurrentAppState::get_bytesDownloaded(ULONG* bytes_downloaded) {
-  ASSERT1(bytes_downloaded);
-
-  // Firefox does not support uint32...
-  if (bytes_downloaded_ > kint32max) {
-    return HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW);
-  }
-  *bytes_downloaded = static_cast<ULONG>(bytes_downloaded_);
-  return S_OK;
-}
-
-STDMETHODIMP CurrentAppState::get_totalBytesToDownload(
-    ULONG* total_bytes_to_download) {
-  ASSERT1(total_bytes_to_download);
-
-  // Firefox does not support uint32...
-  if (total_bytes_to_download_ > kint32max) {
-    return HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW);
-  }
-  *total_bytes_to_download = static_cast<ULONG>(total_bytes_to_download_);
-  return S_OK;
-}
-
-STDMETHODIMP CurrentAppState::get_downloadTimeRemainingMs(
-    LONG* download_time_remaining_ms) {
-  ASSERT1(download_time_remaining_ms);
-
-  *download_time_remaining_ms = download_time_remaining_ms_;
-  return S_OK;
-}
-
-STDMETHODIMP CurrentAppState::get_nextRetryTime(ULONGLONG* next_retry_time) {
-  ASSERT1(next_retry_time);
-
-  *next_retry_time = next_retry_time_;
-  return S_OK;
-}
-
-STDMETHODIMP CurrentAppState::get_installProgress(
-    LONG* install_progress_percentage) {
-
-  ASSERT1(install_progress_percentage);
-  *install_progress_percentage = install_progress_percentage_;
-  return S_OK;
-}
-
-STDMETHODIMP CurrentAppState::get_installTimeRemainingMs(
-    LONG* install_time_remaining_ms) {
-
-  ASSERT1(install_time_remaining_ms);
-  *install_time_remaining_ms = install_time_remaining_ms_;
-  return S_OK;
-}
-
-STDMETHODIMP CurrentAppState::get_isCanceled(VARIANT_BOOL* is_canceled) {
-  ASSERT1(is_canceled);
-
-  *is_canceled = is_canceled_;
-  return S_OK;
-}
-
-STDMETHODIMP CurrentAppState::get_errorCode(LONG* error_code) {
-  ASSERT1(error_code);
-
-  *error_code = error_code_;
-  return S_OK;
-}
-
-STDMETHODIMP CurrentAppState::get_extraCode1(LONG* extra_code1) {
-  ASSERT1(extra_code1);
-
-  *extra_code1 = extra_code1_;
-  return S_OK;
-}
-
-STDMETHODIMP CurrentAppState::get_completionMessage(
-    BSTR* completion_message) {
-  ASSERT1(completion_message);
-
-  *completion_message = completion_message_.Copy();
-  return S_OK;
-}
-
-STDMETHODIMP CurrentAppState::get_installerResultCode(
-    LONG* installer_result_code) {
-  ASSERT1(installer_result_code);
-
-  *installer_result_code = installer_result_code_;
-  return S_OK;
-}
-
-STDMETHODIMP CurrentAppState::get_installerResultExtraCode1(
-    LONG* installer_result_extra_code1) {
-  ASSERT1(installer_result_extra_code1);
-
-  *installer_result_extra_code1 = installer_result_extra_code1_;
-  return S_OK;
-}
-
-STDMETHODIMP CurrentAppState::get_postInstallLaunchCommandLine(
-    BSTR* post_install_launch_command_line) {
-  ASSERT1(post_install_launch_command_line);
-
-  *post_install_launch_command_line =
-      post_install_launch_command_line_.Copy();
-  return S_OK;
-}
-
-STDMETHODIMP CurrentAppState::get_postInstallUrl(BSTR* post_install_url) {
-  ASSERT1(post_install_url);
-
-  *post_install_url = post_install_url_.Copy();
-  return S_OK;
-}
-
-STDMETHODIMP CurrentAppState::get_postInstallAction(
-    LONG* post_install_action) {
-  ASSERT1(post_install_action);
-  *post_install_action = static_cast<LONG>(post_install_action_);
-  return S_OK;
-}
-
-}  // namespace omaha
diff --git a/goopdate/current_state.h b/goopdate/current_state.h
deleted file mode 100644
index ac0e743..0000000
--- a/goopdate/current_state.h
+++ /dev/null
@@ -1,165 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// The current state of the App.
-
-#ifndef OMAHA_GOOPDATE_CURRENT_STATE_H_
-#define OMAHA_GOOPDATE_CURRENT_STATE_H_
-
-#include <atlbase.h>
-#include <atlcom.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "goopdate/omaha3_idl.h"
-#include "omaha/base/atlregmapex.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/marshal_by_value.h"
-#include "omaha/goopdate/google_update_ps_resource.h"
-#include "omaha/common/goopdate_utils.h"
-
-namespace omaha {
-
-class ATL_NO_VTABLE CurrentAppState
-  : public CComObjectRootEx<CComObjectThreadModel>,
-    public CComCoClass<CurrentAppState>,
-    public IDispatchImpl<ICurrentState,
-                         &__uuidof(ICurrentState),
-                         &CAtlModule::m_libid,
-                         kMajorTypeLibVersion,
-                         kMinorTypeLibVersion>,
-    public IPersistStreamInitImpl<CurrentAppState>,
-    public MarshalByValue<CurrentAppState> {
- public:
-  static HRESULT Create(LONG state_value,
-                        const CString& available_version,
-                        ULONGLONG bytes_downloaded,
-                        ULONGLONG total_bytes_to_download,
-                        LONG download_time_remaining_ms,
-                        ULONGLONG next_retry_time,
-                        LONG install_progress_percentage,
-                        LONG install_time_remaining_ms,
-                        bool is_canceled,
-                        LONG error_code,
-                        LONG extra_code1,
-                        const CString& completion_message,
-                        LONG installer_result_code,
-                        LONG installer_result_extra_code1,
-                        const CString& success_launch_cmd_line,
-                        const CString& post_install_url,
-                        PostInstallAction post_install_action,
-                        CComObject<CurrentAppState>** current_state);
-  CurrentAppState();
-
-  static bool is_machine() {
-    return goopdate_utils::IsRunningFromOfficialGoopdateDir(true);
-  }
-
-  static const CLSID& GetObjectCLSID() {
-    return is_machine() ? __uuidof(CurrentStateMachineClass) :
-                          __uuidof(CurrentStateUserClass);
-  }
-
-  DECLARE_REGISTRY_RESOURCEID_EX(IDR_INPROC_SERVER_RGS)
-
-  #pragma warning(push)
-  // C4640: construction of local static object is not thread-safe
-  #pragma warning(disable : 4640)
-  BEGIN_REGISTRY_MAP()
-    REGMAP_ENTRY(_T("HKROOT"), is_machine() ? _T("HKLM") : _T("HKCU"))
-    REGMAP_ENTRY(_T("CLSID"), GetObjectCLSID())
-  END_REGISTRY_MAP()
-
-  BEGIN_PROP_MAP(CurrentAppState)
-    PROP_DATA_ENTRY("StateValue", state_value_, VT_I4)
-    PROP_DATA_ENTRY("AvailableVersion", available_version_, VT_BSTR)
-    PROP_DATA_ENTRY("BytesDownloaded", bytes_downloaded_, VT_UI8)
-    PROP_DATA_ENTRY("TotalBytesToDownload", total_bytes_to_download_, VT_UI8)
-    PROP_DATA_ENTRY("DownloadTimeRemainingMs", download_time_remaining_ms_,
-                    VT_I4)
-    PROP_DATA_ENTRY("NextRetryTime", next_retry_time_, VT_UI8)
-    PROP_DATA_ENTRY("InstallProgressPercentage", install_progress_percentage_,
-                    VT_I4)
-    PROP_DATA_ENTRY("InstallTimeRemainingMs", install_time_remaining_ms_, VT_I4)
-    PROP_DATA_ENTRY("IsCanceled", is_canceled_, VT_BOOL)
-    PROP_DATA_ENTRY("ErrorCode", error_code_, VT_I4)
-    PROP_DATA_ENTRY("ExtraCode1", extra_code1_, VT_I4)
-    PROP_DATA_ENTRY("CompletionMessage", completion_message_, VT_BSTR)
-    PROP_DATA_ENTRY("InstallerResultCode", installer_result_code_, VT_I4)
-    PROP_DATA_ENTRY("InstallerResultExtraCode1", installer_result_extra_code1_,
-                    VT_I4)
-    PROP_DATA_ENTRY("PostInstallLaunchCommandLine",
-                    post_install_launch_command_line_, VT_BSTR)
-    PROP_DATA_ENTRY("PostInstallUrl", post_install_url_, VT_BSTR)
-    PROP_DATA_ENTRY("PostInstallAction", post_install_action_, VT_I4)
-  END_PROP_MAP()
-  #pragma warning(pop)
-
-  // ICurrentState.
-  STDMETHOD(get_stateValue)(LONG* state_value);
-  STDMETHOD(get_availableVersion)(BSTR* available_version);
-  STDMETHOD(get_bytesDownloaded)(ULONG* bytes_downloaded);
-  STDMETHOD(get_totalBytesToDownload)(ULONG* total_bytes_to_download);
-  STDMETHOD(get_downloadTimeRemainingMs)(LONG* download_time_remaining_ms);
-  STDMETHOD(get_nextRetryTime)(ULONGLONG* next_retry_time);
-  STDMETHOD(get_installProgress)(LONG* install_progress_percentage);
-  STDMETHOD(get_installTimeRemainingMs)(LONG* install_time_remaining_ms);
-  STDMETHOD(get_isCanceled)(VARIANT_BOOL* is_canceled);
-  STDMETHOD(get_errorCode)(LONG* error_code);
-  STDMETHOD(get_extraCode1)(LONG* extra_code1);
-  STDMETHOD(get_completionMessage)(BSTR* completion_message);
-  STDMETHOD(get_installerResultCode)(LONG* installer_result_code);
-  STDMETHOD(get_installerResultExtraCode1)(LONG* installer_result_extra_code1);
-  STDMETHOD(get_postInstallLaunchCommandLine)(
-      BSTR* post_install_launch_command_line);
-  STDMETHOD(get_postInstallUrl)(BSTR* post_install_url);
-  STDMETHOD(get_postInstallAction)(LONG* post_install_action);
-
- protected:
-  virtual ~CurrentAppState();
-
-  BEGIN_COM_MAP(CurrentAppState)
-    COM_INTERFACE_ENTRY(ICurrentState)
-    COM_INTERFACE_ENTRY(IDispatch)
-    COM_INTERFACE_ENTRY(IMarshal)
-  END_COM_MAP()
-
-  BOOL m_bRequiresSave;
-
- private:
-  LONG state_value_;
-  CComBSTR available_version_;
-  ULONGLONG bytes_downloaded_;
-  ULONGLONG total_bytes_to_download_;
-  LONG download_time_remaining_ms_;
-  ULONGLONG next_retry_time_;
-  LONG install_progress_percentage_;
-  LONG install_time_remaining_ms_;
-  VARIANT_BOOL is_canceled_;
-  LONG error_code_;
-  LONG extra_code1_;
-  CComBSTR completion_message_;
-  LONG installer_result_code_;
-  LONG installer_result_extra_code1_;
-  CComBSTR post_install_launch_command_line_;
-  CComBSTR post_install_url_;
-  LONG post_install_action_;
-
-  DISALLOW_COPY_AND_ASSIGN(CurrentAppState);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_CURRENT_STATE_H_
diff --git a/goopdate/download_complete_ping_event.cc b/goopdate/download_complete_ping_event.cc
deleted file mode 100644
index f0a6b74..0000000
--- a/goopdate/download_complete_ping_event.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/download_complete_ping_event.h"
-#include "omaha/base/string.h"
-#include "omaha/base/xml_utils.h"
-#include "omaha/common/xml_const.h"
-
-namespace omaha {
-
-DownloadCompletePingEvent::DownloadCompletePingEvent(
-    Types type,
-    Results result,
-    int error_code,
-    int extra_code1,
-    int download_time_ms,
-    uint64 num_bytes_downloaded,
-    uint64 app_size)
-    : PingEvent(type, result, error_code, extra_code1),
-      download_time_ms_(download_time_ms),
-      num_bytes_downloaded_(num_bytes_downloaded),
-      app_size_(app_size) {
-}
-
-HRESULT DownloadCompletePingEvent::ToXml(IXMLDOMNode* parent_node) const {
-  HRESULT hr = PingEvent::ToXml(parent_node);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // No need to report download metrics if nothing is downloaded.
-  if (num_bytes_downloaded_ == 0) {
-    return S_OK;
-  }
-
-  hr = AddXMLAttributeNode(parent_node,
-                           xml::kXmlNamespace,
-                           xml::attribute::kDownloadTime,
-                           itostr(download_time_ms_));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = AddXMLAttributeNode(parent_node,
-                           xml::kXmlNamespace,
-                           xml::attribute::kAppBytesDownloaded,
-                           String_Uint64ToString(num_bytes_downloaded_, 10));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return AddXMLAttributeNode(parent_node,
-                             xml::kXmlNamespace,
-                             xml::attribute::kAppBytesTotal,
-                             String_Uint64ToString(app_size_, 10));
-}
-
-CString DownloadCompletePingEvent::ToString() const {
-  CString ping_str;
-  ping_str.Format(_T("%s, %s=%s, %s=%s, %s=%s"),
-      PingEvent::ToString(),
-      xml::attribute::kDownloadTime, itostr(download_time_ms_),
-      xml::attribute::kAppBytesDownloaded,
-      String_Uint64ToString(num_bytes_downloaded_, 10),
-      xml::attribute::kAppBytesTotal, String_Uint64ToString(app_size_, 10));
-
-  return ping_str;
-}
-
-}  // namespace omaha
-
diff --git a/goopdate/download_complete_ping_event.h b/goopdate/download_complete_ping_event.h
deleted file mode 100644
index bdaa965..0000000
--- a/goopdate/download_complete_ping_event.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_DOWNLOAD_COMPLETE_PING_EVENT_H_
-#define OMAHA_GOOPDATE_DOWNLOAD_COMPLETE_PING_EVENT_H_
-
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "omaha/common/ping_event.h"
-
-namespace omaha {
-
-class DownloadCompletePingEvent : public PingEvent {
- public:
-  DownloadCompletePingEvent(Types type,
-                            Results result,
-                            int error_code,
-                            int extra_code1,
-                            int download_time_ms,
-                            uint64 num_bytes_downloaded,
-                            uint64 app_size);
-  virtual ~DownloadCompletePingEvent() {}
-
-  virtual HRESULT ToXml(IXMLDOMNode* parent_node) const;
-  virtual CString ToString() const;
-
- private:
-  const int download_time_ms_;
-  const uint64 num_bytes_downloaded_;
-  const uint64 app_size_;
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_DOWNLOAD_COMPLETE_PING_EVENT_H_
diff --git a/goopdate/download_complete_ping_event_test.cc b/goopdate/download_complete_ping_event_test.cc
deleted file mode 100644
index fcd005e..0000000
--- a/goopdate/download_complete_ping_event_test.cc
+++ /dev/null
@@ -1,148 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/reg_key.h"
-#include "omaha/base/string.h"
-#include "omaha/common/ping.h"
-#include "omaha/goopdate/download_complete_ping_event.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-  const CString kPv = _T("1.3.23.0");
-  const CString kLang = _T("en");
-  const CString kBrandCode = _T("GOOG");
-  const CString kClientId = _T("testclientid");
-  const CString kIid = _T("{7C0B6E56-B24B-436b-A960-A6EA201E886D}");
-}  // namespace
-
-class DownloadCompletePingEventTest : public testing::Test {
- protected:
-  void SetUpRegistry() {
-    RegKey::DeleteKey(kRegistryHiveOverrideRoot);
-    OverrideRegistryHives(kRegistryHiveOverrideRoot);
-
-    const TCHAR* const kOmahaUserClientStatePath =
-        _T("HKCU\\Software\\") SHORT_COMPANY_NAME
-        _T("\\") PRODUCT_NAME
-        _T("\\ClientState\\") GOOPDATE_APP_ID;
-
-    EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaUserClientStatePath,
-                                              kRegValueProductVersion,
-                                              kPv));
-    EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaUserClientStatePath,
-                                              kRegValueLanguage,
-                                              kLang));
-    EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaUserClientStatePath,
-                                              kRegValueBrandCode,
-                                              kBrandCode));
-    EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaUserClientStatePath,
-                                              kRegValueClientId,
-                                              kClientId));
-    EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kOmahaUserClientStatePath,
-                                              kRegValueInstallationId,
-                                              kIid));
-  }
-
-  virtual void CleanUpRegistry() {
-    RestoreRegistryHives();
-    RegKey::DeleteKey(kRegistryHiveOverrideRoot);
-  }
-};
-
-TEST_F(DownloadCompletePingEventTest, BuildDownloadCompletePing) {
-  const int error_code = 34;
-  const int extra_code1 = 3333;
-  const int download_time_ms = 15000;
-  const uint64 num_bytes_downloaded = 4000000;
-  const uint64 app_packages_total_size = 8000000;
-
-  SetUpRegistry();
-  PingEventPtr ping_event(
-      new DownloadCompletePingEvent(PingEvent::EVENT_INSTALL_COMPLETE,
-                                    PingEvent::EVENT_RESULT_SUCCESS,
-                                    error_code,
-                                    extra_code1,
-                                    download_time_ms,
-                                    num_bytes_downloaded,
-                                    app_packages_total_size));
-
-  Ping ping(false, _T("unittest"), _T("InstallSource_Foo"));
-  std::vector<CString> apps;
-  apps.push_back(GOOPDATE_APP_ID);
-  ping.LoadAppDataFromRegistry(apps);
-  ping.BuildAppsPing(ping_event);
-  CleanUpRegistry();
-
-  CString expected_ping_request_substring;
-  expected_ping_request_substring.Format(
-      _T("<app appid=\"%s\" version=\"%s\" nextversion=\"\" lang=\"%s\" ")
-      _T("brand=\"%s\" client=\"%s\" iid=\"%s\">")
-      _T("<event eventtype=\"%d\" eventresult=\"%d\" ")
-      _T("errorcode=\"%d\" extracode1=\"%d\" ")
-      _T("download_time_ms=\"%d\" downloaded=\"%I64u\" total=\"%I64u\"/>")
-      _T("</app>"),
-      GOOPDATE_APP_ID, kPv, kLang, kBrandCode, kClientId, kIid,
-      PingEvent::EVENT_INSTALL_COMPLETE, PingEvent::EVENT_RESULT_SUCCESS,
-      error_code, extra_code1, download_time_ms, num_bytes_downloaded,
-      app_packages_total_size);
-
-  CString actual_ping_request;
-  ping.BuildRequestString(&actual_ping_request);
-  EXPECT_NE(-1, actual_ping_request.Find(expected_ping_request_substring));
-}
-
-TEST_F(DownloadCompletePingEventTest, BuildDownloadCompletePing_NoDownload) {
-  const int error_code = 888;
-  const int extra_code1 = 0;
-  const int download_time_ms = 15;
-  const uint64 num_bytes_downloaded = 0;  // 0 indicates no actual download.
-  const uint64 app_packages_total_size = 4000000;
-
-  SetUpRegistry();
-  PingEventPtr ping_event(
-      new DownloadCompletePingEvent(PingEvent::EVENT_INSTALL_COMPLETE,
-                                    PingEvent::EVENT_RESULT_SUCCESS,
-                                    error_code,
-                                    extra_code1,
-                                    download_time_ms,
-                                    num_bytes_downloaded,
-                                    app_packages_total_size));
-
-  Ping ping(false, _T("unittest"), _T("InstallSource_Foo"));
-  std::vector<CString> apps;
-  apps.push_back(GOOPDATE_APP_ID);
-  ping.LoadAppDataFromRegistry(apps);
-  ping.BuildAppsPing(ping_event);
-  CleanUpRegistry();
-
-  CString expected_ping_request_substring;
-  expected_ping_request_substring.Format(
-      _T("<app appid=\"%s\" version=\"%s\" nextversion=\"\" lang=\"%s\" ")
-      _T("brand=\"%s\" client=\"%s\" iid=\"%s\">")
-      _T("<event eventtype=\"%d\" eventresult=\"%d\" ")
-      _T("errorcode=\"%d\" extracode1=\"%d\"/>")
-      _T("</app>"),
-      GOOPDATE_APP_ID, kPv, kLang, kBrandCode, kClientId, kIid,
-      PingEvent::EVENT_INSTALL_COMPLETE, PingEvent::EVENT_RESULT_SUCCESS,
-      error_code, extra_code1);
-
-  CString actual_ping_request;
-  ping.BuildRequestString(&actual_ping_request);
-  EXPECT_NE(-1, actual_ping_request.Find(expected_ping_request_substring));
-}
-
-}  // namespace omaha
diff --git a/goopdate/download_manager.cc b/goopdate/download_manager.cc
deleted file mode 100644
index 49674c3..0000000
--- a/goopdate/download_manager.cc
+++ /dev/null
@@ -1,614 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// The download manager uses the network request to download the remote file.
-// Once the download is complete, the download manager stores the file in
-// the package cache, then it copies the file out to a location specified
-// by the caller.
-
-// TODO(omaha): the path where to copy the file is hardcoded. Change the
-// class interface to allow the path as a parameter.
-
-#include "omaha/goopdate/download_manager.h"
-#include <algorithm>
-#include <vector>
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/path.h"
-#include "omaha/base/scoped_impersonation.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/string.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/user_rights.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/goopdate/model.h"
-#include "omaha/goopdate/package_cache.h"
-#include "omaha/goopdate/server_resource.h"
-#include "omaha/goopdate/string_formatter.h"
-#include "omaha/goopdate/worker_metrics.h"
-#include "omaha/goopdate/worker_utils.h"
-#include "omaha/net/bits_request.h"
-#include "omaha/net/http_client.h"
-#include "omaha/net/network_request.h"
-#include "omaha/net/net_utils.h"
-#include "omaha/net/simple_request.h"
-
-namespace omaha {
-
-namespace {
-
-// Creates and initializes an instance of the NetworkRequest for the
-// DownloadManager to use. Defines the fallback chain: BITS, WinHttp.
-HRESULT CreateNetworkRequest(NetworkRequest** network_request_ptr) {
-  NetworkConfig* network_config = NULL;
-  NetworkConfigManager& network_manager = NetworkConfigManager::Instance();
-  HRESULT hr = network_manager.GetUserNetworkConfig(&network_config);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  const NetworkConfig::Session& session(network_config->session());
-  NetworkRequest* network_request(new NetworkRequest(session));
-
-  // TODO(omaha): provide a mechanism for different timeout values in
-  // silent and interactive downloads.
-
-  // BITS transfers files only when the job owner is logged on. If the process
-  // "Run As" another user, an empty BITS job gets created in suspended state
-  // but there is no way to manipulate the job, nor cancel it.
-  bool is_logged_on = false;
-  hr = UserRights::UserIsLoggedOnInteractively(&is_logged_on);
-  if (SUCCEEDED(hr) && is_logged_on) {
-    BitsRequest* bits_request(new BitsRequest);
-    bits_request->set_minimum_retry_delay(kSecPerMin);
-    bits_request->set_no_progress_timeout(5 * kSecPerMin);
-    network_request->AddHttpRequest(bits_request);
-  }
-
-  network_request->AddHttpRequest(new SimpleRequest);
-
-  network_request->set_num_retries(3);
-  *network_request_ptr = network_request;
-  return S_OK;
-}
-
-// TODO(omaha): Unit test this method.
-HRESULT ValidateSize(const CString& file_path, uint64 expected_size) {
-  CORE_LOG(L3, (_T("[ValidateSize][%s][%lld]"), file_path, expected_size));
-  ASSERT1(File::Exists(file_path));
-  ASSERT1(expected_size != 0);
-  ASSERT(expected_size <= UINT_MAX,
-         (_T("TODO(omaha): Add uint64 support to GetFileSizeUnopen().")));
-
-  uint32 file_size(0);
-  HRESULT hr = File::GetFileSizeUnopen(file_path, &file_size);
-  ASSERT1(SUCCEEDED(hr));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (0 == file_size) {
-    return GOOPDATEDOWNLOAD_E_FILE_SIZE_ZERO;
-  } else if (file_size < expected_size) {
-    return GOOPDATEDOWNLOAD_E_FILE_SIZE_SMALLER;
-  } else if (file_size > expected_size) {
-    return GOOPDATEDOWNLOAD_E_FILE_SIZE_LARGER;
-  }
-
-  ASSERT1(file_size == expected_size);
-  return S_OK;
-}
-
-}  // namespace
-
-DownloadManager::DownloadManager(bool is_machine)
-    : lock_(NULL), is_machine_(false) {
-  CORE_LOG(L3, (_T("[DownloadManager::DownloadManager]")));
-
-  omaha::interlocked_exchange_pointer(&lock_,
-                                      static_cast<Lockable*>(new LLock));
-  __mutexScope(lock());
-
-  is_machine_ = is_machine;
-
-  package_cache_root_ =
-      is_machine ?
-      ConfigManager::Instance()->GetMachineSecureDownloadStorageDir() :
-      ConfigManager::Instance()->GetUserDownloadStorageDir();
-
-  CORE_LOG(L3, (_T("[package_cache_root][%s]"), package_cache_root()));
-
-  package_cache_.reset(new PackageCache);
-}
-
-DownloadManager::~DownloadManager() {
-  CORE_LOG(L3, (_T("[DownloadManager::~DownloadManager]")));
-
-  ASSERT1(!IsBusy());
-
-  delete &lock();
-  omaha::interlocked_exchange_pointer(&lock_, static_cast<Lockable*>(NULL));
-}
-
-const Lockable& DownloadManager::lock() const {
-  return *omaha::interlocked_exchange_pointer(&lock_, lock_);
-}
-
-bool DownloadManager::is_machine() const {
-  __mutexScope(lock());
-  return is_machine_;
-}
-
-CString DownloadManager::package_cache_root() const {
-  __mutexScope(lock());
-  return package_cache_root_;
-}
-
-PackageCache* DownloadManager::package_cache() {
-  __mutexScope(lock());
-  return package_cache_.get();
-}
-
-const PackageCache* DownloadManager::package_cache() const {
-  __mutexScope(lock());
-  return package_cache_.get();
-}
-
-HRESULT DownloadManager::Initialize() {
-  HRESULT hr = package_cache()->Initialize(package_cache_root());
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[failed to initialize the package cache]0x%08x]"), hr));
-    return hr;
-  }
-
-  hr = package_cache()->PurgeOldPackagesIfNecessary();
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[PurgeOldPackagesIfNecessary failed][0x%08x]"), hr));
-  }
-
-  return S_OK;
-}
-
-CString DownloadManager::GetMessageForError(const ErrorContext& error_context,
-                                            const CString& language) {
-  CString message;
-  StringFormatter formatter(language);
-
-  switch (error_context.error_code) {
-    case SIGS_E_INVALID_SIGNATURE:
-    case GOOPDATEDOWNLOAD_E_FILE_SIZE_ZERO:
-    case GOOPDATEDOWNLOAD_E_FILE_SIZE_SMALLER:
-    case GOOPDATEDOWNLOAD_E_FILE_SIZE_LARGER:
-      VERIFY1(SUCCEEDED(formatter.LoadString(IDS_DOWNLOAD_HASH_MISMATCH,
-                                             &message)));
-      break;
-    case GOOPDATEDOWNLOAD_E_CACHING_FAILED:
-      VERIFY1(SUCCEEDED(formatter.FormatMessage(
-          &message, IDS_CACHING_ERROR, error_context.extra_code1, &message)));
-      break;
-    default:
-      if (!worker_utils::FormatMessageForNetworkError(error_context.error_code,
-                                                      language,
-                                                      &message)) {
-        VERIFY1(SUCCEEDED(formatter.LoadString(IDS_DOWNLOAD_ERROR, &message)));
-      }
-      break;
-  }
-
-  ASSERT1(!message.IsEmpty());
-  return message;
-}
-
-HRESULT DownloadManager::DownloadApp(App* app) {
-  CORE_LOG(L3, (_T("[DownloadManager::DownloadApp][0x%p]"), app));
-  ASSERT1(app);
-
-  // TODO(omaha3): Maybe rename these to include "app_". Maybe add package
-  // metrics too.
-  ++metric_worker_download_total;
-
-  // We assume the number of packages does not change after download is started.
-  // TODO(omaha3): Could be a problem if we allow installers to request more
-  // packages (http://b/1969071), but we will have lots of other problems then.
-  AppVersion* app_version = app->working_version();
-  const size_t num_packages = app_version->GetNumberOfPackages();
-
-  State* state = NULL;
-  HRESULT hr = CreateStateForApp(app, &state);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[CreateStateForApp failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  app->Downloading();
-
-  CString message;
-  hr = S_OK;
-
-  for (size_t i = 0; i < num_packages; ++i) {
-    Package* package(app_version->GetPackage(i));
-    hr = DoDownloadPackage(package, state);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[DoDownloadPackage failed][%s][%s][0x%08x][%Iu]"),
-                    app->display_name(), package->filename(), hr, i));
-      message = GetMessageForError(ErrorContext(hr, error_extra_code1()),
-                                   app->app_bundle()->display_language());
-      break;
-    }
-  }
-
-  if (SUCCEEDED(hr)) {
-    app->DownloadComplete();
-
-    // TODO(omaha3): Extract and apply differential update if necessary.
-
-    app->MarkReadyToInstall();
-  } else {
-    app->Error(ErrorContext(hr, error_extra_code1()), message);
-  }
-
-  if (SUCCEEDED(hr)) {
-    ++metric_worker_download_succeeded;
-  }
-
-  VERIFY1(SUCCEEDED(DeleteStateForApp(app)));
-
-  return hr;
-}
-
-HRESULT DownloadManager::DownloadPackage(Package* package) {
-  CORE_LOG(L3, (_T("[DownloadManager::DownloadPackage][0x%p]"), package));
-  ASSERT1(package);
-
-  UNREFERENCED_PARAMETER(package);
-
-  // TODO(omaha): implement in terms of DoDownloadPackage.
-
-  return E_NOTIMPL;
-}
-
-HRESULT DownloadManager::GetPackage(const Package* package,
-                                    const CString& dir) const {
-  const CString app_id(package->app_version()->app()->app_guid_string());
-  const CString version(package->app_version()->version());
-  const CString package_name(package->filename());
-
-  const PackageCache::Key key(app_id, version, package_name);
-
-  CORE_LOG(L3, (_T("[DownloadManager::GetPackage][%s]"), key.ToString()));
-
-  const CString dest_file(ConcatenatePath(dir, package_name));
-  CORE_LOG(L3, (_T("[destination file is '%s']"), dest_file));
-
-  const CString hash(package->expected_hash());
-  HRESULT hr = package_cache()->Get(key, dest_file, hash);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[failed to get from cache][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-bool DownloadManager::IsPackageAvailable(const Package* package) const {
-  const CString app_id(package->app_version()->app()->app_guid_string());
-  const CString version(package->app_version()->version());
-  const CString package_name(package->filename());
-
-  const PackageCache::Key key(app_id, version, package_name);
-
-  CORE_LOG(L3, (_T("[DownloadManager::IsPackageAvailable][%s]"),
-      key.ToString()));
-
-  const CString hash(package->expected_hash());
-  return package_cache()->IsCached(key, hash);
-}
-
-// Attempts a package download by trying the fallback urls. It does not
-// retry the download if the file validation fails.
-// Assumes the packages are not created or destroyed while method is running.
-HRESULT DownloadManager::DoDownloadPackage(Package* package, State* state) {
-  ASSERT1(package);
-  ASSERT1(state);
-
-  App* app = package->app_version()->app();
-  const CString app_id(app->app_guid_string());
-  const CString version(package->app_version()->version());
-  const CString package_name(package->filename());
-
-  const ConfigManager& cm = *ConfigManager::Instance();
-  // TODO(omaha): Since we don't currently have is_manual, check the least
-  // restrictive case of true. It would be nice if we had is_manual. We'll see.
-  ASSERT(SUCCEEDED(app->CheckGroupPolicy()),
-         (_T("Downloading package app for disallowed app.")));
-
-  if (app_id.IsEmpty() || package_name.IsEmpty()) {
-    return E_INVALIDARG;
-  }
-
-  PackageCache::Key key(app_id, version, package_name);
-
-  CORE_LOG(L3, (_T("[DownloadManager::DoDownloadPackage][%s]"),
-      key.ToString()));
-
-  const CString hash(package->expected_hash());
-
-  if (!package_cache()->IsCached(key, hash)) {
-    CORE_LOG(L3, (_T("[The package is not cached]")));
-
-    // TODO(omaha3): May need to consider the DownloadPackage case. Also, we may
-    // want a error code that does not include "UPDATE". If this is a valid
-    // case, need to add message for
-    // GOOPDATE_E_APP_UPDATE_DISABLED_EULA_NOT_ACCEPTED to GetMessageForError().
-    // As of 9/7/2010, the offline case does not allow downloading if the
-    // package cannot be found, so offline scenarios should never get here.
-    if (!app->is_eula_accepted()) {
-      ASSERT(false, (_T("Can't download because app EULA is not accepted.")));
-      return GOOPDATE_E_APP_UPDATE_DISABLED_EULA_NOT_ACCEPTED;
-    }
-
-    if (!ConfigManager::Instance()->CanUseNetwork(is_machine_)) {
-      CORE_LOG(LE, (_T("[DoDownloadPackage][network use prohibited]")));
-      return GOOPDATE_E_CANNOT_USE_NETWORK;
-    }
-
-    CString unique_filename_path;
-    HRESULT hr = BuildUniqueFileName(package_name, &unique_filename_path);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[BuildUniqueFileName failed][0x%08x]"), hr));
-      return hr;
-    }
-
-    NetworkRequest* network_request = state->network_request();
-
-    network_request->set_callback(package);
-
-    const std::vector<CString> download_base_urls(
-        package->app_version()->download_base_urls());
-
-    hr = E_FAIL;
-    for (size_t i = 0; i < download_base_urls.size() && FAILED(hr); ++i) {
-      // TODO(omaha3): Append nicely.
-      const CString url = download_base_urls[i] + package_name;
-
-      if (i > 0) {
-        CORE_LOG(L3, (_T("[retrying download with fallback base url][%s]"),
-                      url));
-      }
-      // TODO(omaha3): Increment a usage stat for the ith url being used.
-      // Supporting 3 or 4 should be enough.
-
-      CORE_LOG(L3, (_T("[starting file download][from '%s'][to '%s']"),
-                   url, unique_filename_path));
-
-      // Downloading a file is a blocking call. It assumes the model is not
-      // locked by the calling thread, otherwise other threads won't be able to
-      // to access the model until the file download is complete.
-      ASSERT1(!package->model()->IsLockedByCaller());
-
-      hr = network_request->DownloadFile(url, unique_filename_path);
-      if (FAILED(hr)) {
-        CORE_LOG(LW, (_T("[DownloadFile failed from url][0x%08x]['%s']['%s']"),
-                      hr, package_name, download_base_urls[i]));
-        worker_utils::AddHttpRequestDataToEventLog(
-            hr,
-            network_request->http_status_code(),
-            network_request->trace(),
-            is_machine_);
-        continue;
-      }
-
-      // A file has been successfully downloaded from current url. Validate
-      // and cache it.
-      hr = CallAsSelfAndImpersonate2(
-          this,
-          &DownloadManager::CachePackage,
-          static_cast<const Package*>(package),
-          static_cast<const CString*>(&unique_filename_path));
-      if (SUCCEEDED(hr)) {
-        break;
-      }
-
-      CORE_LOG(LE, (_T("[failed to cache package][0x%08x]"), hr));
-    }
-    VERIFY1(SUCCEEDED(network_request->Close()));
-    DeleteBeforeOrAfterReboot(unique_filename_path);
-
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[DownloadFile/caching failed from all urls][0x%08x]"),
-                    hr));
-      return hr;
-    }
-
-    // Assumes that downloaded bytes equal to the expected package size.
-    app->UpdateNumBytesDownloaded(package->expected_size());
-  } else {
-    CORE_LOG(L3, (_T("[package is cached]")));
-
-    // TODO(omaha3): We probably need to update the download stats that
-    // Package::OnProgress would set. It may be misleading to set
-    // bytes_downloaded to anything other than zero, but App uses this to
-    // calculate progress. I suppose we could add an is_complete field instead.
-    // There is a related issue with the callback not being called with the
-    // final size. See the TODO in the unit tests.
-  }
-
-  ASSERT1(package_cache()->IsCached(key, hash));
-  return S_OK;
-}
-
-void DownloadManager::Cancel(App* app) {
-  CORE_LOG(L3, (_T("[DownloadManager::Cancel][0x%p]"), app));
-  ASSERT1(app);
-
-  __mutexScope(lock());
-
-  for (size_t i = 0; i != download_state_.size(); ++i) {
-    if (app == download_state_[i]->app()) {
-      VERIFY1(SUCCEEDED(download_state_[i]->CancelNetworkRequest()));
-    }
-  }
-}
-
-void DownloadManager::CancelAll() {
-  CORE_LOG(L3, (_T("[DownloadManager::CancelAll]")));
-
-  __mutexScope(lock());
-
-  for (size_t i = 0; i != download_state_.size(); ++i) {
-    VERIFY1(SUCCEEDED(download_state_[i]->CancelNetworkRequest()));
-  }
-}
-
-bool DownloadManager::IsBusy() const {
-  __mutexScope(lock());
-  return !download_state_.empty();
-}
-
-HRESULT DownloadManager::PurgeAppLowerVersions(const CString& app_id,
-                                               const CString& version) {
-  return package_cache()->PurgeAppLowerVersions(app_id, version);
-}
-
-HRESULT DownloadManager::CachePackage(const Package* package,
-                                      const CString* filename_path) {
-  ASSERT1(package);
-  ASSERT1(filename_path);
-
-  const CString app_id(package->app_version()->app()->app_guid_string());
-  const CString version(package->app_version()->version());
-  const CString package_name(package->filename());
-  PackageCache::Key key(app_id, version, package_name);
-
-  const CString hash(package->expected_hash());
-
-  HRESULT hr = package_cache()->Put(key, *filename_path, hash);
-  if (hr != SIGS_E_INVALID_SIGNATURE) {
-    if (FAILED(hr)) {
-      set_error_extra_code1(static_cast<int>(hr));
-      return GOOPDATEDOWNLOAD_E_CACHING_FAILED;
-    }
-    return hr;
-  }
-
-  // Get a more specific error if possible.
-  // TODO(omaha): It would be nice to detect that we downloaded a proxy
-  // page and tell the user this. It would be even better if we could
-  // display it; that would require a lot more plumbing.
-  HRESULT size_hr = ValidateSize(*filename_path, package->expected_size());
-  if (FAILED(size_hr)) {
-    hr = size_hr;
-  }
-
-  return hr;
-}
-
-// The file is initially downloaded to a temporary unique name, to account
-// for the case where the same file is downloaded by multiple callers.
-HRESULT DownloadManager::BuildUniqueFileName(const CString& filename,
-                                             CString* unique_filename) {
-  ASSERT1(unique_filename);
-
-  GUID guid(GUID_NULL);
-  HRESULT hr = ::CoCreateGuid(&guid);
-  if (FAILED(hr)) {
-    CORE_LOG(L3, (_T("[CoCreateGuid failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  // Format of the unique file name is: <temp_download_dir>/<guid>-<filename>.
-  const CString temp_dir(ConfigManager::Instance()->GetTempDownloadDir());
-  CString temp_filename;
-  SafeCStringFormat(&temp_filename, _T("%s-%s"), GuidToString(guid), filename);
-  *unique_filename = ConcatenatePath(temp_dir, temp_filename);
-
-  return unique_filename->IsEmpty() ?
-         GOOPDATEDOWNLOAD_E_UNIQUE_FILE_PATH_EMPTY : S_OK;
-}
-
-HRESULT DownloadManager::CreateStateForApp(App* app, State** state) {
-  ASSERT1(app);
-  ASSERT1(state);
-
-  *state = NULL;
-
-  NetworkRequest* network_request = NULL;
-  HRESULT hr = CreateNetworkRequest(&network_request);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  ASSERT1(network_request);
-
-  const bool use_background_priority =
-                  (app->app_bundle()->priority() < INSTALL_PRIORITY_HIGH);
-  network_request->set_low_priority(use_background_priority);
-
-  network_request->set_proxy_auth_config(
-      app->app_bundle()->GetProxyAuthConfig());
-
-  scoped_ptr<State> state_ptr(new State(app, network_request));
-
-  __mutexBlock(lock()) {
-    download_state_.push_back(state_ptr.release());
-    *state = download_state_.back();
-  }
-
-  return S_OK;
-}
-
-HRESULT DownloadManager::DeleteStateForApp(App* app) {
-  ASSERT1(app);
-
-  __mutexScope(lock());
-
-  typedef std::vector<State*>::iterator Iter;
-  for (Iter it(download_state_.begin()); it != download_state_.end(); ++it) {
-    if (app == (*it)->app()) {
-      delete *it;
-      download_state_.erase(it);
-      return S_OK;
-    }
-  }
-
-  ASSERT1(false);
-
-  return E_UNEXPECTED;
-}
-
-DownloadManager::State::State(App* app, NetworkRequest* network_request)
-    : app_(app), network_request_(network_request) {
-  ASSERT1(app);
-  ASSERT1(network_request);
-}
-
-DownloadManager::State::~State() {
-}
-
-NetworkRequest* DownloadManager::State::network_request() const {
-  ASSERT1(ConfigManager::Instance()->CanUseNetwork(
-                                         app_->app_bundle()->is_machine()));
-
-  return network_request_.get();
-}
-
-HRESULT DownloadManager::State::CancelNetworkRequest() {
-  return network_request_->Cancel();
-}
-
-}  // namespace omaha
diff --git a/goopdate/download_manager.h b/goopdate/download_manager.h
deleted file mode 100644
index aa84232..0000000
--- a/goopdate/download_manager.h
+++ /dev/null
@@ -1,162 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_DOWNLOAD_MANAGER_H_
-#define OMAHA_GOOPDATE_DOWNLOAD_MANAGER_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-
-namespace omaha {
-
-class App;
-struct ErrorContext;
-class HttpClient;
-struct Lockable;        // TODO(omaha): make Lockable a class.
-class NetworkRequest;
-class Package;
-class PackageCache;
-
-// Public interface for the DownloadManager.
-class DownloadManagerInterface {
- public:
-  virtual ~DownloadManagerInterface() {}
-  virtual HRESULT Initialize() = 0;
-  virtual HRESULT PurgeAppLowerVersions(const CString& app_id,
-                                        const CString& version) = 0;
-  virtual HRESULT CachePackage(const Package* package,
-                               const CString* filename_path) = 0;
-  virtual HRESULT DownloadApp(App* app) = 0;
-  virtual HRESULT DownloadPackage(Package* package) = 0;
-  virtual HRESULT GetPackage(const Package* package,
-                             const CString& dir) const = 0;
-  virtual bool IsPackageAvailable(const Package* package) const = 0;
-  virtual void Cancel(App* app) = 0;
-  virtual void CancelAll() = 0;
-  virtual bool IsBusy() const = 0;
-};
-
-class DownloadManager : public DownloadManagerInterface {
- public:
-  explicit DownloadManager(bool is_machine);
-  virtual ~DownloadManager();
-
-  virtual HRESULT Initialize();
-
-  virtual HRESULT PurgeAppLowerVersions(const CString& app_id,
-                                        const CString& version);
-
-  virtual HRESULT CachePackage(const Package* package,
-                               const CString* filename_path);
-
-  // Downloads the specified app and stores its packages in the package cache.
-  //
-  // This is a blocking call. All errors are reported through the return value.
-  // Callers may use GetMessageForError() to convert this error value to an
-  // error message. Progress is reported via the NetworkRequestCallback
-  // method on the Package objects.
-  virtual HRESULT DownloadApp(App* app);
-
-  // Downloads the specified package and stores it in the package cache.
-  virtual HRESULT DownloadPackage(Package* package);
-
-  // Retrieves a package from the cache, if the package is locally available.
-  virtual HRESULT GetPackage(const Package* package, const CString& dir) const;
-
-  // Returns true if the specified package is in the package cache.
-  virtual bool IsPackageAvailable(const Package* package) const;
-
-  // Cancels the download of specified app and makes DownloadApp return to the
-  // caller at some point in the future. Cancel can be called multiple times
-  // until the DownloadApp returns.
-  virtual void Cancel(App* app);
-
-  // Cancels download of all apps currently downloading.
-  virtual void CancelAll();
-
-  // Returns true if applications are downloading.
-  virtual bool IsBusy() const;
-
-  // Returns a formatted message for the specified error in given language.
-  static CString GetMessageForError(const ErrorContext& error_context,
-                                    const CString& language);
-
- private:
-  // Maintains per-app download state.
-  class State {
-   public:
-    State(App* app, NetworkRequest* network_request);
-    ~State();
-
-    App* app() const { return app_; }
-
-    NetworkRequest* network_request() const;
-
-    HRESULT CancelNetworkRequest();
-
-   private:
-    // Not owned by this object.
-    App* app_;
-
-    scoped_ptr<NetworkRequest> network_request_;
-
-    DISALLOW_EVIL_CONSTRUCTORS(State);
-  };
-
-  // Creates a download state corresponding to the app. The state object is
-  // owned by the download manager. A pointer to the state object is returned
-  // to the caller.
-  HRESULT CreateStateForApp(App* app, State** state);
-
-  HRESULT DeleteStateForApp(App* app);
-
-  HRESULT DoDownloadPackage(Package* package, State* state);
-
-  bool is_machine() const;
-
-  CString package_cache_root() const;
-
-  PackageCache* package_cache();
-  const PackageCache* package_cache() const;
-
-  const Lockable& lock() const;
-
-  // Returns the full path to a unique filename.
-  static HRESULT BuildUniqueFileName(const CString& filename,
-                                     CString* unique_filename);
-
-  // Locks shared instance state for concurrent downloads. This lock is
-  // owned by this class.
-  mutable Lockable* volatile lock_;
-
-  bool is_machine_;
-
-  // The root of the package_cache.
-  CString package_cache_root_;
-
-  std::vector<State*> download_state_;
-
-  scoped_ptr<PackageCache> package_cache_;
-
-  friend class DownloadManagerTest;
-  DISALLOW_EVIL_CONSTRUCTORS(DownloadManager);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_DOWNLOAD_MANAGER_H_
diff --git a/goopdate/download_manager_unittest.cc b/goopdate/download_manager_unittest.cc
deleted file mode 100644
index 29b3ef1..0000000
--- a/goopdate/download_manager_unittest.cc
+++ /dev/null
@@ -1,1237 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// TODO(omaha): why so many dependencies for this unit test?
-
-#include <windows.h>
-#include <atlstr.h>
-#include "omaha/base/app_util.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/path.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/signatures.h"
-#include "omaha/base/thread_pool.h"
-#include "omaha/base/timer.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/base/vista_utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/goopdate/app_state_checking_for_update.h"
-#include "omaha/goopdate/app_state_waiting_to_download.h"
-#include "omaha/goopdate/app_unittest_base.h"
-#include "omaha/goopdate/download_manager.h"
-#include "omaha/goopdate/update_response_utils.h"
-#include "omaha/testing/unit_test.h"
-
-using ::testing::_;
-using ::testing::Return;
-
-namespace omaha {
-
-namespace {
-
-const TCHAR kUpdateBinHash[] = _T("YF2z/br/S6E3KTca0MT7qziJN44=");
-const TCHAR kUpdateBin1Hash[] = _T("tbYInfmArVRUD62Ex292vN4LtGQ=");
-
-const TCHAR kAppGuid1[] = _T("{0B35E146-D9CB-4145-8A91-43FDCAEBCD1E}");
-const TCHAR kAppGuid2[] = _T("{C7F2B395-A01C-4806-AA07-9163F66AFC48}");
-
-
-class DownloadAppWorkItem : public UserWorkItem {
- public:
-  DownloadAppWorkItem(DownloadManager* download_manager, App* app)
-      : download_manager_(download_manager), app_(app) {}
-
- private:
-  virtual void DoProcess() {
-    download_manager_->DownloadApp(app_);
-  }
-
-  DownloadManager* download_manager_;
-  App* app_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(DownloadAppWorkItem);
-};
-
-}  // namespace
-
-class DownloadManagerTest : public AppTestBase {
- public:
-  static HRESULT BuildUniqueFileName(const CString& filename,
-                                     CString* unique_filename) {
-    return DownloadManager::BuildUniqueFileName(filename,
-                                                unique_filename);
-  }
-
- protected:
-  explicit DownloadManagerTest(bool is_machine)
-      : AppTestBase(is_machine, true) {}
-
-  virtual void SetUp() {
-    AppTestBase::SetUp();
-
-    CleanupFiles();
-
-    download_manager_.reset(new DownloadManager(is_machine_));
-    EXPECT_SUCCEEDED(download_manager_->Initialize());
-  }
-
-  virtual void TearDown() {
-    download_manager_.reset();
-    CleanupFiles();
-
-    AppTestBase::TearDown();
-  }
-
-  virtual void CleanupFiles() = 0;
-
-  static HRESULT LoadBundleFromXml(AppBundle* app_bundle,
-                                   const CStringA& buffer_string) {
-    __mutexScope(app_bundle->model()->lock());
-
-    std::vector<uint8> buffer(buffer_string.GetLength());
-    memcpy(&buffer.front(), buffer_string, buffer.size());
-
-    scoped_ptr<xml::UpdateResponse> update_response(
-        xml::UpdateResponse::Create());
-    HRESULT hr = update_response->Deserialize(buffer);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    for (size_t i = 0; i != app_bundle->GetNumberOfApps(); ++i) {
-      hr = update_response_utils::BuildApp(update_response.get(),
-                                           S_OK,
-                                           app_bundle->GetApp(i));
-      if (FAILED(hr)) {
-        return hr;
-      }
-    }
-
-    return S_OK;
-  }
-
-  static void SetAppStateCheckingForUpdate(App* app) {
-    SetAppStateForUnitTest(app, new fsm::AppStateCheckingForUpdate);
-  }
-
-  static void SetAppStateWaitingToDownload(App* app) {
-    SetAppStateForUnitTest(app, new fsm::AppStateWaitingToDownload);
-  }
-
-  const CString cache_path_;
-  scoped_ptr<DownloadManager> download_manager_;
-};
-
-
-class DownloadManagerMachineTest : public DownloadManagerTest {
- protected:
-  DownloadManagerMachineTest() : DownloadManagerTest(true) {}
-
-  virtual void CleanupFiles() {
-    ConfigManager* cm(ConfigManager::Instance());
-    DeleteDirectory(cm->GetMachineInstallWorkingDir());
-    DeleteDirectory(cm->GetMachineSecureDownloadStorageDir());
-  }
-};
-
-class DownloadManagerUserTest : public DownloadManagerTest {
- protected:
-  DownloadManagerUserTest() : DownloadManagerTest(false) {}
-
-  virtual void CleanupFiles() {
-    ConfigManager* cm(ConfigManager::Instance());
-    DeleteDirectory(cm->GetUserInstallWorkingDir());
-    DeleteDirectory(cm->GetUserDownloadStorageDir());
-  }
-};
-
-TEST_F(DownloadManagerUserTest, DownloadApp_MultiplePackagesInOneApp) {
-  App* app = NULL;
-  ASSERT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kAppGuid1), &app));
-  EXPECT_SUCCEEDED(app->put_displayName(CComBSTR(_T("App1"))));
-  EXPECT_SUCCEEDED(app->put_isEulaAccepted(VARIANT_TRUE));  // Allow download.
-
-  // One app, two packages.
-  CStringA buffer_string =
-
-  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-  "<response protocol=\"3.0\">"
-    "<app appid=\"{0B35E146-D9CB-4145-8A91-43FDCAEBCD1E}\" status=\"ok\">"
-      "<updatecheck status=\"ok\">"
-        "<urls>"
-          "<url codebase=\"http://dl.google.com/update2/\"/>"
-        "</urls>"
-        "<manifest version=\"1.0\">"
-          "<packages>"
-            "<package "
-              "hash=\"YF2z/br/S6E3KTca0MT7qziJN44=\" "
-              "name=\"UpdateData.bin\" "
-              "required=\"true\" "
-              "size=\"2048\"/>"
-            "<package "
-              "hash=\"tbYInfmArVRUD62Ex292vN4LtGQ=\" "
-              "name=\"UpdateData1.bin\" "
-              "required=\"true\" "
-              "size=\"2048\"/>"
-          "</packages>"
-        "</manifest>"
-      "</updatecheck>"
-    "</app>"
-  "</response>";
-
-  EXPECT_HRESULT_SUCCEEDED(LoadBundleFromXml(app_bundle_.get(), buffer_string));
-  SetAppStateWaitingToDownload(app);
-
-  EXPECT_SUCCEEDED(download_manager_->DownloadApp(app));
-
-  // Tests the first package.
-  const Package* package = app->next_version()->GetPackage(0);
-  ASSERT_TRUE(package);
-  EXPECT_STREQ(_T("UpdateData.bin"), package->filename());
-  EXPECT_EQ(2048, package->expected_size());
-  EXPECT_STREQ(kUpdateBinHash, package->expected_hash());
-  EXPECT_EQ(2048, package->bytes_downloaded());
-  EXPECT_TRUE(download_manager_->IsPackageAvailable(package));
-
-  // Tests the second package.
-  package = app->next_version()->GetPackage(1);
-  ASSERT_TRUE(package);
-  EXPECT_STREQ(_T("UpdateData1.bin"), package->filename());
-  EXPECT_EQ(2048, package->expected_size());
-  EXPECT_STREQ(kUpdateBin1Hash, package->expected_hash());
-  EXPECT_EQ(2048, package->bytes_downloaded());
-  EXPECT_TRUE(download_manager_->IsPackageAvailable(package));
-}
-
-// Downloads multiple apps serially.
-TEST_F(DownloadManagerUserTest, DownloadApp_MultipleApps) {
-  App* app = NULL;
-  ASSERT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kAppGuid1), &app));
-  EXPECT_SUCCEEDED(app->put_displayName(CComBSTR(_T("App1"))));
-  EXPECT_SUCCEEDED(app->put_isEulaAccepted(VARIANT_TRUE));  // Allow download.
-
-  app = NULL;
-  ASSERT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kAppGuid2), &app));
-  EXPECT_SUCCEEDED(app->put_displayName(CComBSTR(_T("App2"))));
-  EXPECT_SUCCEEDED(app->put_isEulaAccepted(VARIANT_TRUE));  // Allow download.
-
-  // Two apps, one package each.
-  CStringA buffer_string =
-
-  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-  "<response protocol=\"3.0\">"
-    "<app appid=\"{0B35E146-D9CB-4145-8A91-43FDCAEBCD1E}\" status=\"ok\">"
-      "<updatecheck status=\"ok\">"
-        "<urls>"
-          "<url codebase=\"http://dl.google.com/update2/\"/>"
-        "</urls>"
-        "<manifest version=\"1.0\">"
-          "<packages>"
-            "<package "
-              "hash=\"YF2z/br/S6E3KTca0MT7qziJN44=\" "
-              "name=\"UpdateData.bin\" "
-              "required=\"true\" "
-              "size=\"2048\"/>"
-          "</packages>"
-        "</manifest>"
-      "</updatecheck>"
-    "</app>"
-    "<app appid=\"{C7F2B395-A01C-4806-AA07-9163F66AFC48}\" status=\"ok\">"
-      "<updatecheck status=\"ok\">"
-        "<urls>"
-          "<url codebase=\"http://dl.google.com/update2/\"/>"
-        "</urls>"
-        "<manifest version=\"2.0\">"
-          "<packages>"
-            "<package "
-              "hash=\"tbYInfmArVRUD62Ex292vN4LtGQ=\" "
-              "name=\"UpdateData1.bin\" "
-              "required=\"true\" "
-              "size=\"2048\"/>"
-          "</packages>"
-        "</manifest>"
-      "</updatecheck>"
-    "</app>"
-  "</response>";
-
-  EXPECT_HRESULT_SUCCEEDED(LoadBundleFromXml(app_bundle_.get(), buffer_string));
-
-  // Tests the first app.
-  app = app_bundle_->GetApp(0);
-  ASSERT_TRUE(app);
-  SetAppStateWaitingToDownload(app);
-  EXPECT_SUCCEEDED(download_manager_->DownloadApp(app));
-
-  const Package* package = app->next_version()->GetPackage(0);
-  ASSERT_TRUE(package);
-  EXPECT_STREQ(_T("UpdateData.bin"), package->filename());
-  EXPECT_EQ(2048, package->expected_size());
-  EXPECT_STREQ(kUpdateBinHash, package->expected_hash());
-  EXPECT_EQ(2048, package->bytes_downloaded());
-  EXPECT_TRUE(download_manager_->IsPackageAvailable(package));
-
-  // Tests the second app.
-  app = app_bundle_->GetApp(1);
-  ASSERT_TRUE(app);
-  SetAppStateWaitingToDownload(app);
-  EXPECT_SUCCEEDED(download_manager_->DownloadApp(app));
-
-  package = app->next_version()->GetPackage(0);
-  ASSERT_TRUE(package);
-  EXPECT_STREQ(_T("UpdateData1.bin"), package->filename());
-  EXPECT_EQ(2048, package->expected_size());
-  EXPECT_STREQ(kUpdateBin1Hash, package->expected_hash());
-  EXPECT_EQ(2048, package->bytes_downloaded());
-  EXPECT_TRUE(download_manager_->IsPackageAvailable(package));
-}
-
-// Downloads multiple apps concurrently. The test builds a bundle of two
-// apps, creates two thread pool work items to download the apps, waits
-// for the downloads to complete, and then checks the results of each download.
-// This is essentialy the same unit test as DownloadApp_MultipleApps done
-// concurrently instead of serially.
-TEST_F(DownloadManagerUserTest, DownloadApp_Concurrent) {
-  App* app = NULL;
-  ASSERT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kAppGuid1), &app));
-  EXPECT_SUCCEEDED(app->put_displayName(CComBSTR(_T("App1"))));
-  EXPECT_SUCCEEDED(app->put_isEulaAccepted(VARIANT_TRUE));  // Allow download.
-
-  app = NULL;
-  ASSERT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kAppGuid2), &app));
-  EXPECT_SUCCEEDED(app->put_displayName(CComBSTR(_T("App2"))));
-  EXPECT_SUCCEEDED(app->put_isEulaAccepted(VARIANT_TRUE));  // Allow download.
-
-  // Two apps, one package each.
-  CStringA buffer_string =
-
-  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-  "<response protocol=\"3.0\">"
-    "<app appid=\"{0B35E146-D9CB-4145-8A91-43FDCAEBCD1E}\" status=\"ok\">"
-      "<updatecheck status=\"ok\">"
-        "<urls>"
-          "<url codebase=\"http://dl.google.com/update2/\"/>"
-        "</urls>"
-        "<manifest version=\"1.0\">"
-          "<packages>"
-            "<package "
-              "hash=\"YF2z/br/S6E3KTca0MT7qziJN44=\" "
-              "name=\"UpdateData.bin\" "
-              "required=\"true\" "
-              "size=\"2048\"/>"
-          "</packages>"
-        "</manifest>"
-      "</updatecheck>"
-    "</app>"
-    "<app appid=\"{C7F2B395-A01C-4806-AA07-9163F66AFC48}\" status=\"ok\">"
-      "<updatecheck status=\"ok\">"
-        "<urls>"
-          "<url codebase=\"http://dl.google.com/update2/\"/>"
-        "</urls>"
-        "<manifest version=\"2.0\">"
-          "<packages>"
-            "<package "
-              "hash=\"tbYInfmArVRUD62Ex292vN4LtGQ=\" "
-              "name=\"UpdateData1.bin\" "
-              "required=\"true\" "
-              "size=\"2048\"/>"
-          "</packages>"
-        "</manifest>"
-      "</updatecheck>"
-    "</app>"
-  "</response>";
-
-  EXPECT_HRESULT_SUCCEEDED(LoadBundleFromXml(app_bundle_.get(), buffer_string));
-
-  // The thread pool waits up to 1 minute for the work items to complete when
-  // the thread pool object is destroyed.
-  const int kShutdownDelayMs = 60000;
-
-  ThreadPool thread_pool;
-  ASSERT_HRESULT_SUCCEEDED(thread_pool.Initialize(kShutdownDelayMs));
-
-  const int kNumApps = 2;
-
-  for (int i = 0; i != kNumApps; ++i) {
-    app = app_bundle_->GetApp(i);
-    SetAppStateWaitingToDownload(app);
-
-    scoped_ptr<DownloadAppWorkItem> work_item(
-        new DownloadAppWorkItem(download_manager_.get(), app));
-
-    // WT_EXECUTELONGFUNCTION causes the thread pool to use multiple threads.
-    ASSERT_HRESULT_SUCCEEDED(thread_pool.QueueUserWorkItem(
-                                 work_item.release(),
-                                 WT_EXECUTELONGFUNCTION));
-  }
-
-  // Poll the state of the download manager and wait up to 1 minute for the
-  // downloads to complete.
-  const int kTimeToWaitForDownloadsMs = 60000;
-  const int kTimeToSleepWhenPollingMs   = 10;
-
-  // Wait some time for the download manager to pick up the work items and
-  // become busy.
-  Timer timer(true);
-  while (timer.GetMilliseconds() < kTimeToWaitForDownloadsMs) {
-    if (download_manager_->IsBusy()) {
-      break;
-    }
-  }
-  timer.Reset();
-
-  // Wait for the download manager to exit its busy state.
-  timer.Start();
-  while (download_manager_->IsBusy() &&
-         timer.GetMilliseconds() < kTimeToWaitForDownloadsMs) {
-    ::Sleep(kTimeToSleepWhenPollingMs);
-  }
-
-  // Expect that downloads have completed in a reasonable time.
-  EXPECT_FALSE(download_manager_->IsBusy());
-
-  // Test the outcome of the two downloads.
-  app = app_bundle_->GetApp(0);
-  const Package* package = app->next_version()->GetPackage(0);
-  ASSERT_TRUE(package);
-  EXPECT_STREQ(_T("UpdateData.bin"), package->filename());
-  EXPECT_EQ(2048, package->expected_size());
-  EXPECT_STREQ(kUpdateBinHash, package->expected_hash());
-  EXPECT_EQ(2048, package->bytes_downloaded());
-  EXPECT_TRUE(download_manager_->IsPackageAvailable(package));
-
-  app = app_bundle_->GetApp(1);
-  package = app->next_version()->GetPackage(0);
-  ASSERT_TRUE(package);
-  EXPECT_STREQ(_T("UpdateData1.bin"), package->filename());
-  EXPECT_EQ(2048, package->expected_size());
-  EXPECT_STREQ(kUpdateBin1Hash, package->expected_hash());
-  EXPECT_EQ(2048, package->bytes_downloaded());
-  EXPECT_TRUE(download_manager_->IsPackageAvailable(package));
-
-  // Try to cancel the downloads if they could not complete in time and the
-  // download manager is still busy. The thread pool waits a while for the work
-  // items to complete after they have been canceled.
-  if (download_manager_->IsBusy()) {
-    for (int i = 0; i != kNumApps; ++i) {
-      download_manager_->Cancel(app_bundle_->GetApp(i));
-    }
-    return;
-  }
-}
-
-// Downloads multiple apps concurrently and cancels the downloads while they
-// are in progress. The test builds a bundle of two apps with one file each,
-// creates two thread pool work items to download the apps, waits for the
-// downloads to begin, and then cancels them.
-// TODO(omaha): Fix the intermittent failures.
-TEST_F(DownloadManagerUserTest, DISABLED_DownloadApp_Cancel) {
-  App* app = NULL;
-  ASSERT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kAppGuid1), &app));
-  EXPECT_SUCCEEDED(app->put_displayName(CComBSTR(_T("App1"))));
-  EXPECT_SUCCEEDED(app->put_isEulaAccepted(VARIANT_TRUE));  // Allow download.
-
-  app = NULL;
-  ASSERT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kAppGuid2), &app));
-  EXPECT_SUCCEEDED(app->put_displayName(CComBSTR(_T("App2"))));
-  EXPECT_SUCCEEDED(app->put_isEulaAccepted(VARIANT_TRUE));  // Allow download.
-
-  // Two apps, one package each.
-  CStringA buffer_string =
-
-  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-  "<response protocol=\"3.0\">"
-    "<app appid=\"{0B35E146-D9CB-4145-8A91-43FDCAEBCD1E}\" status=\"ok\">"
-      "<updatecheck status=\"ok\">"
-        "<urls>"
-          "<url codebase=\"http://dl.google.com/dl/edgedl/update2/\"/>"
-        "</urls>"
-        "<manifest version=\"1.0\">"
-          "<packages>"
-            "<package "
-              "hash=\"jCBqGodZn1Ms5oZ1U28LFUaQDXo=\" "
-              "name=\"UpdateData_10M.bin\" "
-              "required=\"true\" "
-              "size=\"10485760\"/>"
-          "</packages>"
-        "</manifest>"
-      "</updatecheck>"
-    "</app>"
-    "<app appid=\"{C7F2B395-A01C-4806-AA07-9163F66AFC48}\" status=\"ok\">"
-      "<updatecheck status=\"ok\">"
-        "<urls>"
-          "<url codebase=\"http://dl.google.com/dl/edgedl/update2/\"/>"
-        "</urls>"
-        "<manifest version=\"2.0\">"
-          "<packages>"
-            "<package "
-              "hash=\"jCBqGodZn1Ms5oZ1U28LFUaQDXo=\" "
-              "name=\"UpdateData_10M.bin\" "
-              "required=\"true\" "
-              "size=\"10485760\"/>"
-          "</packages>"
-        "</manifest>"
-      "</updatecheck>"
-    "</app>"
-  "</response>";
-
-  EXPECT_HRESULT_SUCCEEDED(LoadBundleFromXml(app_bundle_.get(), buffer_string));
-
-  // The thread pool waits up to 1 minute for the work items to complete when
-  // the thread pool object is destroyed.
-  const int kShutdownDelayMs = 60000;
-
-  ThreadPool thread_pool;
-  ASSERT_HRESULT_SUCCEEDED(thread_pool.Initialize(kShutdownDelayMs));
-
-  const int kNumApps = 2;
-
-  for (int i = 0; i != kNumApps; ++i) {
-    app = app_bundle_->GetApp(i);
-    SetAppStateWaitingToDownload(app);
-
-    scoped_ptr<DownloadAppWorkItem> work_item(
-        new DownloadAppWorkItem(download_manager_.get(), app));
-
-    ASSERT_HRESULT_SUCCEEDED(thread_pool.QueueUserWorkItem(
-                                 work_item.release(),
-                                 WT_EXECUTELONGFUNCTION));
-  }
-
-  for (int i = 0; i != kNumApps; ++i) {
-     app = app_bundle_->GetApp(i);
-     EXPECT_NE(STATE_ERROR, app->state());
-  }
-
-  // Poll the state of the download manager and wait up to 1 minute for the
-  // downloads to complete.
-  const int kTimeToWaitForDownloadsMs = 60000;
-  const int kTimeToSleepWhenPollingMs   = 10;
-
-  // Cancel the downloads as soon as all apps are downloading and
-  // wait until all apps have transitioned in the error state.
-  Timer timer(true);
-  bool is_done = false;
-  while (!is_done && timer.GetMilliseconds() < kTimeToWaitForDownloadsMs) {
-    int num_apps_downloading = 0;
-
-    for (int i = 0; i != kNumApps; ++i) {
-      app = app_bundle_->GetApp(i);
-      if (app->state() == STATE_DOWNLOADING) {
-        const Package* package = app->next_version()->GetPackage(0);
-        if (package->bytes_downloaded()) {
-          ++num_apps_downloading;
-        }
-      }
-    }
-
-    is_done = (num_apps_downloading == kNumApps);
-
-    ::Sleep(kTimeToSleepWhenPollingMs);
-  }
-
-  for (int i = 0; i != kNumApps; ++i) {
-    download_manager_->Cancel(app_bundle_->GetApp(i));
-  }
-
-  is_done = false;
-  while (!is_done && timer.GetMilliseconds() < kTimeToWaitForDownloadsMs) {
-    int num_apps_cancelled = 0;
-    for (int i = 0; i != kNumApps; ++i) {
-      app = app_bundle_->GetApp(i);
-      if (app->state() == STATE_ERROR) {
-        ++num_apps_cancelled;
-      }
-    }
-
-    is_done = (num_apps_cancelled == kNumApps);
-
-    ::Sleep(kTimeToSleepWhenPollingMs);
-  }
-
-  for (int i = 0; i != kNumApps; ++i) {
-    // Check the state of the app and the package after the cancel call.
-    app = app_bundle_->GetApp(i);
-    EXPECT_EQ(STATE_ERROR, app->state());
-
-    const Package* package = app->next_version()->GetPackage(0);
-    ASSERT_TRUE(package);
-    EXPECT_LT(0, package->bytes_downloaded());
-    VARIANT_BOOL is_available(false);
-    EXPECT_HRESULT_SUCCEEDED(package->get_isAvailable(&is_available));
-    EXPECT_FALSE(is_available);
-
-    // Check CurrentAppState members.
-    CComPtr<IDispatch> current_state_disp;
-    EXPECT_HRESULT_SUCCEEDED(app->get_currentState(&current_state_disp));
-    CComPtr<ICurrentState> current_state;
-    EXPECT_HRESULT_SUCCEEDED(
-        current_state_disp->QueryInterface(&current_state));
-
-    LONG state_value = 0;
-    EXPECT_HRESULT_SUCCEEDED(current_state->get_stateValue(&state_value));
-    EXPECT_EQ(STATE_ERROR, static_cast<CurrentState>(state_value));
-
-    LONG error_code = 0;
-    EXPECT_HRESULT_SUCCEEDED(current_state->get_errorCode(&error_code));
-    EXPECT_EQ(GOOPDATE_E_CANCELLED, error_code);
-
-    LONG extra_code1 = 0;
-    EXPECT_HRESULT_SUCCEEDED(current_state->get_errorCode(&extra_code1));
-    EXPECT_EQ(0, extra_code1);
-  }
-}
-
-// Common packages of different apps are not cached by the package cache and
-// will be redownloaded until the network cache is implemented.
-// TODO(omaha): fix unit test as soon as the network cache is implemented.
-TEST_F(DownloadManagerUserTest, DownloadApp_MultipleAppsCommonPackage) {
-  App* app = NULL;
-  ASSERT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kAppGuid1), &app));
-  EXPECT_SUCCEEDED(app->put_displayName(CComBSTR(_T("App1"))));
-  EXPECT_SUCCEEDED(app->put_isEulaAccepted(VARIANT_TRUE));  // Allow download.
-
-  app = NULL;
-  ASSERT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kAppGuid2), &app));
-  EXPECT_SUCCEEDED(app->put_displayName(CComBSTR(_T("App2"))));
-  EXPECT_SUCCEEDED(app->put_isEulaAccepted(VARIANT_TRUE));  // Allow download.
-
-  // Two apps, same package each.
-  CStringA buffer_string =
-
-  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-  "<response protocol=\"3.0\">"
-    "<app appid=\"{0B35E146-D9CB-4145-8A91-43FDCAEBCD1E}\" status=\"ok\">"
-      "<updatecheck status=\"ok\">"
-        "<urls>"
-          "<url codebase=\"http://dl.google.com/update2/\"/>"
-        "</urls>"
-        "<manifest version=\"1.0\">"
-          "<packages>"
-            "<package "
-              "hash=\"YF2z/br/S6E3KTca0MT7qziJN44=\" "
-              "name=\"UpdateData.bin\" "
-              "required=\"true\" "
-              "size=\"2048\"/>"
-          "</packages>"
-        "</manifest>"
-      "</updatecheck>"
-    "</app>"
-    "<app appid=\"{C7F2B395-A01C-4806-AA07-9163F66AFC48}\" status=\"ok\">"
-      "<updatecheck status=\"ok\">"
-        "<urls>"
-          "<url codebase=\"http://dl.google.com/update2/\"/>"
-        "</urls>"
-        "<manifest version=\"2.0\">"
-          "<packages>"
-          "<package "
-            "hash=\"YF2z/br/S6E3KTca0MT7qziJN44=\" "
-            "name=\"UpdateData.bin\" "
-            "required=\"true\" "
-            "size=\"2048\"/>"
-          "</packages>"
-        "</manifest>"
-      "</updatecheck>"
-    "</app>"
-  "</response>";
-
-  EXPECT_HRESULT_SUCCEEDED(LoadBundleFromXml(app_bundle_.get(), buffer_string));
-
-  // Tests the first app.
-  app = app_bundle_->GetApp(0);
-  ASSERT_TRUE(app);
-  SetAppStateWaitingToDownload(app);
-  EXPECT_SUCCEEDED(download_manager_->DownloadApp(app));
-
-  const Package* package = app->next_version()->GetPackage(0);
-  ASSERT_TRUE(package);
-  EXPECT_STREQ(_T("UpdateData.bin"), package->filename());
-  EXPECT_EQ(2048, package->expected_size());
-  EXPECT_STREQ(kUpdateBinHash, package->expected_hash());
-  EXPECT_EQ(2048, package->bytes_downloaded());
-  EXPECT_TRUE(download_manager_->IsPackageAvailable(package));
-
-  // Tests the second app. The package is redownloaded.
-  app = app_bundle_->GetApp(1);
-  ASSERT_TRUE(app);
-  SetAppStateWaitingToDownload(app);
-  EXPECT_SUCCEEDED(download_manager_->DownloadApp(app));
-
-  package = app->next_version()->GetPackage(0);
-  ASSERT_TRUE(package);
-  EXPECT_STREQ(_T("UpdateData.bin"), package->filename());
-  EXPECT_EQ(2048, package->expected_size());
-  EXPECT_STREQ(kUpdateBinHash, package->expected_hash());
-  EXPECT_EQ(2048, package->bytes_downloaded());
-  EXPECT_TRUE(download_manager_->IsPackageAvailable(package));
-}
-
-// Creates two bundles with the same app. The package corresponding to the
-// app in the second bundle must come from the cache.
-TEST_F(DownloadManagerUserTest, DownloadApp_FileAlreadyInCache) {
-  App* app = NULL;
-  ASSERT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kAppGuid1), &app));
-  EXPECT_SUCCEEDED(app->put_displayName(CComBSTR(_T("App1"))));
-  EXPECT_SUCCEEDED(app->put_isEulaAccepted(VARIANT_TRUE));  // Allow download.
-
-  CStringA buffer_string =
-
-  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-  "<response protocol=\"3.0\">"
-    "<app appid=\"{0B35E146-D9CB-4145-8A91-43FDCAEBCD1E}\" status=\"ok\">"
-      "<updatecheck status=\"ok\">"
-        "<urls>"
-          "<url codebase=\"http://dl.google.com/update2/\"/>"
-        "</urls>"
-        "<manifest version=\"1.0\">"
-          "<packages>"
-            "<package "
-              "hash=\"YF2z/br/S6E3KTca0MT7qziJN44=\" "
-              "name=\"UpdateData.bin\" "
-              "required=\"true\" "
-              "size=\"2048\"/>"
-          "</packages>"
-        "</manifest>"
-      "</updatecheck>"
-    "</app>"
-  "</response>";
-
-  EXPECT_HRESULT_SUCCEEDED(LoadBundleFromXml(app_bundle_.get(), buffer_string));
-  SetAppStateWaitingToDownload(app);
-
-  EXPECT_SUCCEEDED(download_manager_->DownloadApp(app));
-
-  // Tests the package and the bytes downloaded.
-  const Package* package = app->next_version()->GetPackage(0);
-  ASSERT_TRUE(package);
-  EXPECT_STREQ(_T("UpdateData.bin"), package->filename());
-  EXPECT_EQ(2048, package->expected_size());
-  EXPECT_STREQ(kUpdateBinHash, package->expected_hash());
-  EXPECT_EQ(2048, package->bytes_downloaded());
-  EXPECT_TRUE(download_manager_->IsPackageAvailable(package));
-
-  // Create the second app bundle.
-  shared_ptr<AppBundle> app_bundle2(model_->CreateAppBundle(false));
-  EXPECT_SUCCEEDED(app_bundle2->put_displayName(CComBSTR(_T("My Bundle"))));
-  EXPECT_SUCCEEDED(app_bundle2->put_displayLanguage(CComBSTR(_T("en"))));
-  EXPECT_SUCCEEDED(app_bundle2->initialize());
-
-  app = NULL;
-  ASSERT_SUCCEEDED(app_bundle2->createApp(CComBSTR(kAppGuid1), &app));
-  EXPECT_SUCCEEDED(app->put_displayName(CComBSTR(_T("App1"))));
-  // Since the package is cached, it does not matter if the EULA is accepted.
-  EXPECT_SUCCEEDED(app->put_isEulaAccepted(VARIANT_FALSE));
-
-  EXPECT_HRESULT_SUCCEEDED(LoadBundleFromXml(app_bundle2.get(), buffer_string));
-  SetAppStateWaitingToDownload(app);
-
-  EXPECT_SUCCEEDED(download_manager_->DownloadApp(app));
-
-  // Tests the package and the bytes downloaded.
-  package = app->next_version()->GetPackage(0);
-  ASSERT_TRUE(package);
-  EXPECT_STREQ(_T("UpdateData.bin"), package->filename());
-  EXPECT_EQ(2048, package->expected_size());
-  EXPECT_STREQ(kUpdateBinHash, package->expected_hash());
-
-  // No bytes are downloaded if the package has been cached already.
-  EXPECT_EQ(0, package->bytes_downloaded());
-  EXPECT_TRUE(download_manager_->IsPackageAvailable(package));
-}
-
-TEST_F(DownloadManagerUserTest, DownloadApp_404) {
-  App* app = NULL;
-  ASSERT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kAppGuid1), &app));
-  EXPECT_SUCCEEDED(app->put_displayName(CComBSTR(_T("404 Test"))));
-  EXPECT_SUCCEEDED(app->put_isEulaAccepted(VARIANT_TRUE));  // Allow download.
-
-  CStringA buffer_string =
-
-  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-  "<response protocol=\"3.0\">"
-    "<app appid=\"{0B35E146-D9CB-4145-8A91-43FDCAEBCD1E}\" status=\"ok\">"
-      "<updatecheck status=\"ok\">"
-        "<urls>"
-          "<url codebase=\"http://dl.google.com/update2/\"/>"
-        "</urls>"
-        "<manifest version=\"1.0\">"
-          "<packages>"
-            "<package "
-              "hash=\"YF2z/br/S6E3KTca0MT7qziJN44=\" "
-              "name=\"NoSuchFile-OmahaTest.exe\" "
-              "required=\"true\" "
-              "size=\"2048\"/>"
-          "</packages>"
-        "</manifest>"
-      "</updatecheck>"
-    "</app>"
-  "</response>";
-
-  EXPECT_HRESULT_SUCCEEDED(LoadBundleFromXml(app_bundle_.get(), buffer_string));
-  SetAppStateWaitingToDownload(app);
-
-  EXPECT_EQ(GOOPDATE_E_NETWORK_FIRST + 404,
-            download_manager_->DownloadApp(app));
-
-  const Package* package = app->next_version()->GetPackage(0);
-  ASSERT_TRUE(package);
-  EXPECT_STREQ(_T("NoSuchFile-OmahaTest.exe"), package->filename());
-  EXPECT_EQ(2048, package->expected_size());
-  EXPECT_STREQ(kUpdateBinHash, package->expected_hash());
-  EXPECT_EQ(0, package->bytes_downloaded());
-  EXPECT_FALSE(download_manager_->IsPackageAvailable(package));
-}
-
-TEST_F(DownloadManagerUserTest, DownloadApp_HashFailure) {
-  App* app = NULL;
-  ASSERT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kAppGuid1), &app));
-  EXPECT_SUCCEEDED(app->put_displayName(CComBSTR(_T("Hash Fail"))));
-  EXPECT_SUCCEEDED(app->put_isEulaAccepted(VARIANT_TRUE));  // Allow download.
-
-  // Provides the wrong hash for the package.
-  CStringA buffer_string =
-
-  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-  "<response protocol=\"3.0\">"
-    "<app appid=\"{0B35E146-D9CB-4145-8A91-43FDCAEBCD1E}\" status=\"ok\">"
-      "<updatecheck status=\"ok\">"
-        "<urls>"
-          "<url codebase=\"http://dl.google.com/update2/\"/>"
-        "</urls>"
-        "<manifest version=\"1.0\">"
-          "<packages>"
-            "<package "
-              "hash=\"tbYInfmArVRUD62Ex292vN4LtGQ=\" "
-              "name=\"UpdateData.bin\" "
-              "required=\"true\" "
-              "size=\"2048\"/>"
-          "</packages>"
-        "</manifest>"
-      "</updatecheck>"
-    "</app>"
-  "</response>";
-
-  EXPECT_HRESULT_SUCCEEDED(LoadBundleFromXml(app_bundle_.get(), buffer_string));
-  SetAppStateWaitingToDownload(app);
-
-  EXPECT_EQ(SIGS_E_INVALID_SIGNATURE,
-            download_manager_->DownloadApp(app));
-
-  const Package* package = app->next_version()->GetPackage(0);
-  ASSERT_TRUE(package);
-  EXPECT_STREQ(_T("UpdateData.bin"), package->filename());
-  EXPECT_EQ(2048, package->expected_size());
-  EXPECT_STREQ(kUpdateBin1Hash, package->expected_hash());
-  EXPECT_EQ(2048, package->bytes_downloaded());
-  EXPECT_FALSE(download_manager_->IsPackageAvailable(package));
-
-  // All bytes were downloaded even if the validation of the file has failed.
-  EXPECT_EQ(2048, package->bytes_downloaded());
-}
-
-TEST_F(DownloadManagerUserTest, DownloadApp_HashFailure_ActualSmaller) {
-  App* app = NULL;
-  ASSERT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kAppGuid1), &app));
-  EXPECT_SUCCEEDED(app->put_displayName(CComBSTR(_T("Hash Fail"))));
-  EXPECT_SUCCEEDED(app->put_isEulaAccepted(VARIANT_TRUE));  // Allow download.
-
-  // Provides the wrong hash for the package.
-  CStringA buffer_string =
-
-  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-  "<response protocol=\"3.0\">"
-    "<app appid=\"{0B35E146-D9CB-4145-8A91-43FDCAEBCD1E}\" status=\"ok\">"
-      "<updatecheck status=\"ok\">"
-        "<urls>"
-          "<url codebase=\"http://dl.google.com/update2/\"/>"
-        "</urls>"
-        "<manifest version=\"1.0\">"
-          "<packages>"
-            "<package "
-              "hash=\"tbYInfmArVRUD62Ex292vN4LtGQ=\" "
-              "name=\"UpdateData.bin\" "
-              "required=\"true\" "
-              "size=\"2048000\"/>"
-          "</packages>"
-        "</manifest>"
-      "</updatecheck>"
-    "</app>"
-  "</response>";
-
-  EXPECT_HRESULT_SUCCEEDED(LoadBundleFromXml(app_bundle_.get(), buffer_string));
-  SetAppStateWaitingToDownload(app);
-
-  EXPECT_EQ(GOOPDATEDOWNLOAD_E_FILE_SIZE_SMALLER,
-            download_manager_->DownloadApp(app));
-
-  const Package* package = app->next_version()->GetPackage(0);
-  ASSERT_TRUE(package);
-  EXPECT_STREQ(_T("UpdateData.bin"), package->filename());
-  EXPECT_EQ(2048000, package->expected_size());
-  EXPECT_STREQ(kUpdateBin1Hash, package->expected_hash());
-  EXPECT_EQ(2048, package->bytes_downloaded());
-  EXPECT_FALSE(download_manager_->IsPackageAvailable(package));
-
-  // Actual bytes were downloaded even if the validation of the file has failed.
-  EXPECT_EQ(2048, package->bytes_downloaded());
-}
-
-TEST_F(DownloadManagerUserTest, DownloadApp_HashFailure_ActualLarger) {
-  App* app = NULL;
-  ASSERT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kAppGuid1), &app));
-  EXPECT_SUCCEEDED(app->put_displayName(CComBSTR(_T("Hash Fail"))));
-  EXPECT_SUCCEEDED(app->put_isEulaAccepted(VARIANT_TRUE));  // Allow download.
-
-  // Provides the wrong hash for the package.
-  CStringA buffer_string =
-
-  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-  "<response protocol=\"3.0\">"
-    "<app appid=\"{0B35E146-D9CB-4145-8A91-43FDCAEBCD1E}\" status=\"ok\">"
-      "<updatecheck status=\"ok\">"
-        "<urls>"
-          "<url codebase=\"http://dl.google.com/update2/\"/>"
-        "</urls>"
-        "<manifest version=\"1.0\">"
-          "<packages>"
-            "<package "
-              "hash=\"tbYInfmArVRUD62Ex292vN4LtGQ=\" "
-              "name=\"UpdateData.bin\" "
-              "required=\"true\" "
-              "size=\"20\"/>"
-          "</packages>"
-        "</manifest>"
-      "</updatecheck>"
-    "</app>"
-  "</response>";
-
-  EXPECT_HRESULT_SUCCEEDED(LoadBundleFromXml(app_bundle_.get(), buffer_string));
-  SetAppStateWaitingToDownload(app);
-
-  EXPECT_EQ(GOOPDATEDOWNLOAD_E_FILE_SIZE_LARGER,
-            download_manager_->DownloadApp(app));
-
-  const Package* package = app->next_version()->GetPackage(0);
-  ASSERT_TRUE(package);
-  EXPECT_STREQ(_T("UpdateData.bin"), package->filename());
-  EXPECT_EQ(20, package->expected_size());
-  EXPECT_STREQ(kUpdateBin1Hash, package->expected_hash());
-  EXPECT_EQ(2048, package->bytes_downloaded());
-  EXPECT_FALSE(download_manager_->IsPackageAvailable(package));
-
-  // Actual bytes were downloaded even if the validation of the file has failed
-  // or expected a smaller file.
-  EXPECT_EQ(2048, package->bytes_downloaded());
-}
-
-TEST_F(DownloadManagerUserTest, DownloadApp_BaseUrlFallback) {
-  App* app = NULL;
-  ASSERT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kAppGuid1), &app));
-  EXPECT_SUCCEEDED(app->put_displayName(CComBSTR(_T("Hash Fail"))));
-  EXPECT_SUCCEEDED(app->put_isEulaAccepted(VARIANT_TRUE));  // Allow download.
-
-  // Provides the wrong hash for the package.
-  CStringA buffer_string =
-
-  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-  "<response protocol=\"3.0\">"
-    "<app appid=\"{0B35E146-D9CB-4145-8A91-43FDCAEBCD1E}\" status=\"ok\">"
-      "<updatecheck status=\"ok\">"
-        "<urls>"
-          "<url codebase=\"http://dl.google.com/update2/TEST_NOT_EXIST/\"/>"
-          "<url codebase=\"http://dl.google.com/update2/\"/>"
-        "</urls>"
-        "<manifest version=\"1.0\">"
-          "<packages>"
-            "<package "
-              "hash=\"YF2z/br/S6E3KTca0MT7qziJN44=\" "
-              "name=\"UpdateData.bin\" "
-              "required=\"true\" "
-              "size=\"2048\"/>"
-          "</packages>"
-        "</manifest>"
-      "</updatecheck>"
-    "</app>"
-  "</response>";
-
-  EXPECT_HRESULT_SUCCEEDED(LoadBundleFromXml(app_bundle_.get(), buffer_string));
-  SetAppStateWaitingToDownload(app);
-
-  EXPECT_SUCCEEDED(download_manager_->DownloadApp(app));
-  const Package* package = app->next_version()->GetPackage(0);
-  ASSERT_TRUE(package);
-  EXPECT_STREQ(_T("UpdateData.bin"), package->filename());
-  EXPECT_EQ(2048, package->expected_size());
-  EXPECT_STREQ(kUpdateBinHash, package->expected_hash());
-  EXPECT_EQ(2048, package->bytes_downloaded());
-  EXPECT_TRUE(download_manager_->IsPackageAvailable(package));
-}
-
-TEST_F(DownloadManagerUserTest, DownloadApp_FallbackToNextUrlIfCachingFails) {
-  App* app = NULL;
-  ASSERT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kAppGuid1), &app));
-  EXPECT_SUCCEEDED(
-      app->put_displayName(CComBSTR(_T("Hash Fails For First Url"))));
-  EXPECT_SUCCEEDED(app->put_isEulaAccepted(VARIANT_TRUE));  // Allow download.
-
-  // First URL points to a corrupted file.
-  CStringA buffer_string =
-
-  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-  "<response protocol=\"3.0\">"
-    "<app appid=\"{0B35E146-D9CB-4145-8A91-43FDCAEBCD1E}\" status=\"ok\">"
-      "<updatecheck status=\"ok\">"
-        "<urls>"
-          "<url codebase=\"http://dl.google.com/update2/test/fakedata/\"/>"
-          "<url codebase=\"http://dl.google.com/update2/\"/>"
-        "</urls>"
-        "<manifest version=\"1.0\">"
-          "<packages>"
-            "<package "
-              "hash=\"YF2z/br/S6E3KTca0MT7qziJN44=\" "
-              "name=\"UpdateData.bin\" "
-              "required=\"true\" "
-              "size=\"2048\"/>"
-          "</packages>"
-        "</manifest>"
-      "</updatecheck>"
-    "</app>"
-  "</response>";
-
-  EXPECT_HRESULT_SUCCEEDED(LoadBundleFromXml(app_bundle_.get(), buffer_string));
-  SetAppStateWaitingToDownload(app);
-
-  EXPECT_SUCCEEDED(download_manager_->DownloadApp(app));
-  const Package* package = app->next_version()->GetPackage(0);
-  ASSERT_TRUE(package);
-  EXPECT_STREQ(_T("UpdateData.bin"), package->filename());
-  EXPECT_EQ(2048, package->expected_size());
-  EXPECT_STREQ(kUpdateBinHash, package->expected_hash());
-  EXPECT_EQ(2048, package->bytes_downloaded());
-  EXPECT_TRUE(download_manager_->IsPackageAvailable(package));
-}
-
-TEST_F(DownloadManagerUserTest, DownloadApp_EulaNotAccepted) {
-  App* app = NULL;
-  ASSERT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kAppGuid1), &app));
-  EXPECT_SUCCEEDED(app->put_displayName(CComBSTR(_T("App1"))));
-
-  EXPECT_SUCCEEDED(app->put_isEulaAccepted(VARIANT_FALSE));
-
-  CStringA buffer_string =
-
-  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-  "<response protocol=\"3.0\">"
-    "<app appid=\"{0B35E146-D9CB-4145-8A91-43FDCAEBCD1E}\" status=\"ok\">"
-      "<updatecheck status=\"ok\">"
-        "<urls>"
-          "<url codebase=\"http://dl.google.com/update2/\"/>"
-        "</urls>"
-        "<manifest version=\"1.0\">"
-          "<packages>"
-            "<package "
-              "hash=\"YF2z/br/S6E3KTca0MT7qziJN44=\" "
-              "name=\"UpdateData.bin\" "
-              "required=\"true\" "
-              "size=\"2048\"/>"
-          "</packages>"
-        "</manifest>"
-      "</updatecheck>"
-    "</app>"
-  "</response>";
-
-  EXPECT_HRESULT_SUCCEEDED(LoadBundleFromXml(app_bundle_.get(), buffer_string));
-  SetAppStateWaitingToDownload(app);
-
-  ExpectAsserts expect_asserts;  // Eula not accepted causes asserts.
-
-  EXPECT_EQ(GOOPDATE_E_APP_UPDATE_DISABLED_EULA_NOT_ACCEPTED,
-            download_manager_->DownloadApp(app));
-
-  const Package* package = app->next_version()->GetPackage(0);
-  ASSERT_TRUE(package);
-  EXPECT_STREQ(_T("UpdateData.bin"), package->filename());
-  EXPECT_EQ(2048, package->expected_size());
-  EXPECT_STREQ(kUpdateBinHash, package->expected_hash());
-  EXPECT_EQ(0, package->bytes_downloaded());
-  EXPECT_FALSE(download_manager_->IsPackageAvailable(package));
-}
-
-TEST_F(DownloadManagerUserTest, GetPackage) {
-  App* app = NULL;
-  ASSERT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kAppGuid1), &app));
-  EXPECT_SUCCEEDED(app->put_displayName(CComBSTR(_T("App1"))));
-  EXPECT_SUCCEEDED(app->put_isEulaAccepted(VARIANT_TRUE));  // Allow download.
-
-  // One app, one package.
-  CStringA buffer_string =
-
-  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-  "<response protocol=\"3.0\">"
-    "<app appid=\"{0B35E146-D9CB-4145-8A91-43FDCAEBCD1E}\" status=\"ok\">"
-      "<updatecheck status=\"ok\">"
-        "<urls>"
-          "<url codebase=\"http://dl.google.com/update2/\"/>"
-        "</urls>"
-        "<manifest version=\"1.0\">"
-          "<packages>"
-            "<package "
-              "hash=\"YF2z/br/S6E3KTca0MT7qziJN44=\" "
-              "name=\"UpdateData.bin\" "
-              "required=\"true\" "
-              "size=\"2048\"/>"
-          "</packages>"
-        "</manifest>"
-      "</updatecheck>"
-    "</app>"
-  "</response>";
-
-  EXPECT_HRESULT_SUCCEEDED(LoadBundleFromXml(app_bundle_.get(), buffer_string));
-  SetAppStateWaitingToDownload(app);
-
-  const Package* package = app->next_version()->GetPackage(0);
-  ASSERT_TRUE(package);
-
-  EXPECT_FALSE(download_manager_->IsPackageAvailable(package));
-  EXPECT_SUCCEEDED(download_manager_->DownloadApp(app));
-  EXPECT_TRUE(download_manager_->IsPackageAvailable(package));
-
-  // Get a unique temp dir name. The directory is not created.
-  CString dir(GetUniqueTempDirectoryName());
-
-  // The call fails if the package destination directory does not exist.
-  EXPECT_FAILED(download_manager_->GetPackage(package, dir));
-
-  EXPECT_SUCCEEDED(CreateDir(dir, NULL));
-  EXPECT_SUCCEEDED(download_manager_->GetPackage(package, dir));
-
-  CString filename(ConcatenatePath(dir, package->filename()));
-  std::vector<CString> files;
-  files.push_back(filename);
-  EXPECT_SUCCEEDED(AuthenticateFiles(files, kUpdateBinHash));
-
-  // Getting the package the second time overwrites the destination file
-  // and succeeds.
-  EXPECT_SUCCEEDED(download_manager_->GetPackage(package, dir));
-
-  EXPECT_SUCCEEDED(DeleteDirectory(dir));
-}
-
-TEST_F(DownloadManagerUserTest, GetPackage_NotPresent) {
-  App* app = NULL;
-  ASSERT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kAppGuid1), &app));
-  EXPECT_SUCCEEDED(app->put_displayName(CComBSTR(_T("App1"))));
-
-  // One app, one package.
-  CStringA buffer_string =
-
-  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-  "<response protocol=\"3.0\">"
-    "<app appid=\"{0B35E146-D9CB-4145-8A91-43FDCAEBCD1E}\" status=\"ok\">"
-      "<updatecheck status=\"ok\">"
-        "<urls>"
-          "<url codebase=\"http://dl.google.com/update2/\"/>"
-        "</urls>"
-        "<manifest version=\"1.0\">"
-          "<packages>"
-            "<package "
-              "hash=\"YF2z/br/S6E3KTca0MT7qziJN44=\" "
-              "name=\"UpdateData.bin\" "
-              "required=\"true\" "
-              "size=\"2048\"/>"
-          "</packages>"
-        "</manifest>"
-      "</updatecheck>"
-    "</app>"
-  "</response>";
-
-  EXPECT_HRESULT_SUCCEEDED(LoadBundleFromXml(app_bundle_.get(), buffer_string));
-  SetAppStateWaitingToDownload(app);
-
-  const Package* package = app->next_version()->GetPackage(0);
-  ASSERT_TRUE(package);
-
-  EXPECT_FALSE(download_manager_->IsPackageAvailable(package));
-
-  // Get a unique temp dir name. The directory is not created.
-  CString dir(GetUniqueTempDirectoryName());
-
-  EXPECT_SUCCEEDED(CreateDir(dir, NULL));
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            download_manager_->GetPackage(package, dir));
-
-  EXPECT_SUCCEEDED(DeleteDirectory(dir));
-}
-
-TEST(DownloadManagerTest, BuildUniqueFileName) {
-  CString file1, file2;
-  EXPECT_SUCCEEDED(DownloadManagerTest::BuildUniqueFileName(_T("a"), &file1));
-  EXPECT_SUCCEEDED(DownloadManagerTest::BuildUniqueFileName(_T("a"), &file2));
-  EXPECT_STRNE(file1, file2);
-}
-
-TEST(DownloadManagerTest, GetMessageForError) {
-  const TCHAR* kEnglish = _T("en");
-  EXPECT_SUCCEEDED(ResourceManager::Create(
-      true, app_util::GetCurrentModuleDirectory(), kEnglish));
-
-  EXPECT_STREQ(
-      _T("The installer could not connect to the Internet. Ensure that your ")
-      _T("computer is connected to the Internet and your firewall allows ")
-      _T("GoogleUpdate.exe to connect then try again."),
-      DownloadManager::GetMessageForError(
-          ErrorContext(GOOPDATE_E_NO_NETWORK), kEnglish));
-
-  EXPECT_STREQ(
-      _T("The installer could not connect to the Internet because of ")
-      _T("an HTTP 401 Unauthorized response. This is likely a proxy ")
-      _T("configuration issue. Please configure the proxy server to allow ")
-      _T("network access and try again or contact your network administrator."),
-      DownloadManager::GetMessageForError(
-          ErrorContext(GOOPDATE_E_NETWORK_UNAUTHORIZED), kEnglish));
-
-  EXPECT_STREQ(
-      _T("The installer could not connect to the Internet because of ")
-      _T("an HTTP 403 Forbidden response. This is likely a proxy ")
-      _T("configuration issue. Please configure the proxy server to allow ")
-      _T("network access and try again or contact your network administrator."),
-      DownloadManager::GetMessageForError(
-          ErrorContext(GOOPDATE_E_NETWORK_FORBIDDEN), kEnglish));
-
-  EXPECT_STREQ(
-      _T("The installer could not connect to the Internet because a ")
-      _T("proxy server required user authentication. Please configure the ")
-      _T("proxy server to allow network access and try again or contact your ")
-      _T("network administrator."),
-      DownloadManager::GetMessageForError(
-          ErrorContext(GOOPDATE_E_NETWORK_PROXYAUTHREQUIRED),
-          kEnglish));
-
-  EXPECT_STREQ(
-      _T("The download failed."),
-      DownloadManager::GetMessageForError(ErrorContext(E_FAIL), kEnglish));
-
-  EXPECT_STREQ(
-      _T("Failed to cache the downloaded installer. Error: 0x80070005."),
-      DownloadManager::GetMessageForError(
-          ErrorContext(GOOPDATEDOWNLOAD_E_CACHING_FAILED, 0x80070005),
-          kEnglish));
-
-  ResourceManager::Delete();
-}
-
-}  // namespace omaha
diff --git a/goopdate/elevation_moniker_resource.h b/goopdate/elevation_moniker_resource.h
deleted file mode 100644
index 89136c4..0000000
--- a/goopdate/elevation_moniker_resource.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_ELEVATION_MONIKER_RESOURCE_H_
-#define OMAHA_GOOPDATE_ELEVATION_MONIKER_RESOURCE_H_
-
-#include "omaha/goopdate/resources/goopdate_dll/goopdate_dll.grh"
-
-#include "omaha/goopdate/non_localized_resource.h"
-
-#endif  // OMAHA_GOOPDATE_ELEVATION_MONIKER_RESOURCE_H_
diff --git a/goopdate/google_update.cc b/goopdate/google_update.cc
deleted file mode 100644
index cdd6625..0000000
--- a/goopdate/google_update.cc
+++ /dev/null
@@ -1,244 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Contains the ATL exe server registration.
-
-#include "omaha/goopdate/google_update.h"
-#include "goopdate/omaha3_idl.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/core/google_update_core.h"
-#include "omaha/goopdate/broker_class_factory.h"
-#include "omaha/goopdate/cocreate_async.h"
-#include "omaha/goopdate/cred_dialog.h"
-#include "omaha/goopdate/google_update3.h"
-#include "omaha/goopdate/omaha3_idl_datax.h"
-#include "omaha/goopdate/ondemand.h"
-#include "omaha/goopdate/oneclick_process_launcher.h"
-#include "omaha/goopdate/process_launcher.h"
-#include "omaha/goopdate/update3web.h"
-#include "omaha/goopdate/worker.h"
-
-namespace omaha {
-
-// Template arguments need to be non-const TCHAR arrays.
-TCHAR kOnDemandMachineBrokerProgId[] = kProgIDOnDemandMachine;
-TCHAR kUpdate3WebMachineBrokerProgId[] = kProgIDUpdate3WebMachine;
-TCHAR kHKRootUser[] = _T("HKCU");
-TCHAR kHKRootMachine[] = _T("HKLM");
-TCHAR kProgIDUpdate3COMClassUserLocal[] = kProgIDUpdate3COMClassUser;
-
-BEGIN_OBJECT_MAP(object_map_update3_user_mode)
-  OBJECT_ENTRY(__uuidof(GoogleUpdate3UserClass), Update3COMClassUser)
-END_OBJECT_MAP()
-
-BEGIN_OBJECT_MAP(object_map_broker_machine_mode)
-  OBJECT_ENTRY(__uuidof(OnDemandMachineAppsClass), OnDemandMachineBroker)
-  OBJECT_ENTRY(__uuidof(GoogleUpdate3WebMachineClass), Update3WebMachineBroker)
-  OBJECT_ENTRY(__uuidof(CoCreateAsyncClass), CoCreateAsync)
-  OBJECT_ENTRY(__uuidof(OneClickMachineProcessLauncherClass),
-                        OneClickProcessLauncher)
-END_OBJECT_MAP()
-
-BEGIN_OBJECT_MAP(object_map_ondemand_user_mode)
-  OBJECT_ENTRY(__uuidof(GoogleUpdate3WebUserClass), Update3WebUser)
-  OBJECT_ENTRY(__uuidof(OnDemandUserAppsClass), OnDemandUser)
-  OBJECT_ENTRY(__uuidof(CredentialDialogUserClass), CredentialDialogUser)
-  OBJECT_ENTRY(__uuidof(OneClickUserProcessLauncherClass),
-                        OneClickProcessLauncher)
-END_OBJECT_MAP()
-
-BEGIN_OBJECT_MAP(object_map_ondemand_machine_mode)
-  OBJECT_ENTRY(__uuidof(ProcessLauncherClass), ProcessLauncher)
-  OBJECT_ENTRY(__uuidof(GoogleUpdateCoreMachineClass), GoogleUpdateCoreMachine)
-  OBJECT_ENTRY(__uuidof(OnDemandMachineAppsFallbackClass),
-               OnDemandMachineFallback)
-  OBJECT_ENTRY(__uuidof(GoogleUpdate3WebMachineFallbackClass),
-               Update3WebMachineFallback)
-  OBJECT_ENTRY(__uuidof(CredentialDialogMachineClass), CredentialDialogMachine)
-END_OBJECT_MAP()
-
-_ATL_OBJMAP_ENTRY* GoogleUpdate::GetObjectMap() {
-  if (mode_ == kUpdate3Mode && !is_machine_) {
-    return object_map_update3_user_mode;
-  }
-
-  if (mode_ == kBrokerMode && is_machine_) {
-    return object_map_broker_machine_mode;
-  }
-
-  if (mode_ == kOnDemandMode && !is_machine_) {
-    return object_map_ondemand_user_mode;
-  }
-
-  if (mode_ == kOnDemandMode && is_machine_) {
-    return object_map_ondemand_machine_mode;
-  }
-
-  return NULL;
-}
-
-GoogleUpdate::GoogleUpdate(bool is_machine, ComServerMode mode)
-    : is_machine_(is_machine), mode_(mode) {
-  // Disable the delay on shutdown mechanism in CAtlExeModuleT.
-  m_bDelayShutdown = false;
-}
-
-GoogleUpdate::~GoogleUpdate() {
-  // GoogleUpdate is typically created on the stack. We reset the _pAtlModule
-  // here, to allow for cases such as /RegServer, where multiple instances of
-  // GoogleUpdate are created and destroyed serially.
-  _pAtlModule = NULL;
-}
-
-HRESULT GoogleUpdate::Main() {
-  HRESULT hr = E_FAIL;
-  if (!ParseCommandLine(::GetCommandLine(), &hr)) {
-    // This was either /RegServer or /UnregServer. Return early.
-    return hr;
-  }
-
-  hr = InitializeServerSecurity(is_machine_);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  DisableCOMExceptionHandling();
-
-  // TODO(omaha3): We do not call worker_->Run() from anywhere. This means that
-  // the ThreadPool and the ShutdownHandler within the Worker are not
-  // initialized. We need to eventually fix this.
-
-  CORE_LOG(L2, (_T("[Calling CAtlExeModuleT<GoogleUpdate>::WinMain]")));
-  return CAtlExeModuleT<GoogleUpdate>::WinMain(0);
-}
-
-HRESULT GoogleUpdate::RegisterClassObjects(DWORD, DWORD) throw() {
-  CORE_LOG(L3, (_T("[RegisterClassObjects]")));
-
-  for (_ATL_OBJMAP_ENTRY* entry = GetObjectMap();
-       entry && entry->pclsid != NULL;
-       entry++) {
-    HRESULT hr = entry->RegisterClassObject(CLSCTX_LOCAL_SERVER,
-                                            REGCLS_MULTIPLEUSE |
-                                            REGCLS_SUSPENDED);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[RegisterClassObject failed][%s][0x%x]"),
-                    GuidToString(*entry->pclsid), hr));
-      return hr;
-    }
-  }
-
-  return S_OK;
-}
-
-HRESULT GoogleUpdate::RevokeClassObjects() throw() {
-  CORE_LOG(L3, (_T("[RevokeClassObjects]")));
-
-  for (_ATL_OBJMAP_ENTRY* entry = GetObjectMap();
-       entry && entry->pclsid != NULL;
-       entry++) {
-    HRESULT hr = entry->RevokeClassObject();
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[RevokeClassObject failed][%s][0x%x]"),
-                    GuidToString(*entry->pclsid), hr));
-      return hr;
-    }
-  }
-
-  return S_OK;
-}
-
-HRESULT GoogleUpdate::RegisterOrUnregisterExe(bool is_register) {
-  CORE_LOG(L3, (_T("[RegisterOrUnregisterExe][%d]"), is_register));
-
-  for (_ATL_OBJMAP_ENTRY* entry = GetObjectMap();
-       entry && entry->pclsid != NULL;
-       entry++) {
-    HRESULT hr = entry->pfnUpdateRegistry(is_register);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[pfnUpdateRegistry failed][%d][0x%x][%s]"),
-                    is_register, hr, GuidToString(*entry->pclsid)));
-      return hr;
-    }
-  }
-
-  return S_OK;
-}
-
-HRESULT GoogleUpdate::RegisterOrUnregisterExe(void* data,
-                                              bool is_register) {
-  ASSERT1(data);
-  return reinterpret_cast<GoogleUpdate*>(data)->RegisterOrUnregisterExe(
-      is_register);
-}
-
-HRESULT RegisterOrUnregisterProxies(void* data, bool is_register) {
-  ASSERT1(data);
-  bool is_machine = *reinterpret_cast<bool*>(data);
-  CORE_LOG(L3, (_T("[RegisterOrUnregisterProxies][%d][%d]"),
-                is_machine, is_register));
-
-  CPath ps_dll(app_util::GetCurrentModuleDirectory());
-  if (!ps_dll.Append(is_machine ? kPSFileNameMachine : kPSFileNameUser)) {
-    return HRESULTFromLastError();
-  }
-
-  ASSERT1(!is_register || ps_dll.FileExists());
-  HRESULT hr = is_register ? RegisterDll(ps_dll) : UnregisterDll(ps_dll);
-  CORE_LOG(L3, (_T("[  PS][%s][0x%x]"), ps_dll, hr));
-  if (FAILED(hr) && is_register) {
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT GoogleUpdate::RegisterServer(BOOL, const CLSID*) throw() {
-  HRESULT hr = goopdate_utils::RegisterOrUnregisterModule(
-      is_machine_, true, &RegisterOrUnregisterProxies, &is_machine_);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return goopdate_utils::RegisterOrUnregisterModule(
-      is_machine_,
-      true,
-      &GoogleUpdate::RegisterOrUnregisterExe,
-      this);
-}
-
-HRESULT GoogleUpdate::UnregisterServer(BOOL, const CLSID*) throw() {
-  HRESULT hr = goopdate_utils::RegisterOrUnregisterModule(
-      is_machine_, false, &GoogleUpdate::RegisterOrUnregisterExe, this);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return goopdate_utils::RegisterOrUnregisterModule(
-      is_machine_, false, &RegisterOrUnregisterProxies, &is_machine_);
-}
-
-HRESULT GoogleUpdate::PreMessageLoop(int show_cmd) throw() {
-  return CAtlExeModuleT<GoogleUpdate>::PreMessageLoop(show_cmd);
-}
-
-HRESULT GoogleUpdate::PostMessageLoop() throw() {
-  return CAtlExeModuleT<GoogleUpdate>::PostMessageLoop();
-}
-
-}  // namespace omaha
diff --git a/goopdate/google_update.h b/goopdate/google_update.h
deleted file mode 100644
index b171942..0000000
--- a/goopdate/google_update.h
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Contains GoogleUpdate class which is the ATL exe module for the local
-// server that allows launching of the browser at medium integrity.
-
-#ifndef OMAHA_GOOPDATE_GOOGLE_UPDATE_H_
-#define OMAHA_GOOPDATE_GOOGLE_UPDATE_H_
-
-#include <windows.h>
-#include <atlbase.h>
-#include "base/scoped_ptr.h"
-#include "goopdate/omaha3_idl.h"
-#include "omaha/base/debug.h"
-
-namespace omaha {
-
-// TODO(omaha): Perhaps a better approach might be to use Adapter classes to
-// modify behavior instead of the mode being explicitly specified here. Consider
-// when making future changes.
-// It might also be a good idea to rename this class and file since it is more
-// a boilerplate for COM servers than it is related to "Google Update" or the
-// main Omaha 3 COM server since it als handles various brokers.
-class GoogleUpdate : public CAtlExeModuleT<GoogleUpdate> {
- public:
-  enum ComServerMode {
-    kUpdate3Mode,
-    kBrokerMode,
-    kOnDemandMode,
-  };
-
-  DECLARE_LIBID(LIBID_GoogleUpdate3Lib)
-
-  explicit GoogleUpdate(bool is_machine, ComServerMode mode);
-  ~GoogleUpdate();
-  HRESULT RegisterClassObjects(DWORD cls_ctx, DWORD flags) throw();
-  HRESULT RevokeClassObjects() throw();
-
-  // The base ATL classes have an implicit dependency on the second parameter
-  // to RegisterServer and UnregisterServer having a default value.
-  HRESULT RegisterServer(BOOL register_tlb, const CLSID* id = NULL) throw();
-  HRESULT UnregisterServer(BOOL unregister_tlb, const CLSID* id = NULL) throw();
-  HRESULT PreMessageLoop(int show_cmd) throw();
-  HRESULT PostMessageLoop() throw();
-  HRESULT Main();
-
-  // This is cloned from CAtlExeModuleT.Lock(). The one difference is the call
-  // to ::CoAddRefServerProcess(). See the description for Unlock() below for
-  // further information.
-  virtual LONG Lock() throw() {
-    ::CoAddRefServerProcess();
-    return CComGlobalsThreadModel::Increment(&m_nLockCnt);
-  }
-
-  // This is cloned from CAtlExeModuleT.Unlock(). The big difference is the call
-  // to ::CoReleaseServerProcess(), to ensure that the class factories are
-  // suspended once the lock count drops to zero. This fixes a a race condition
-  // where an activation request could come in in the middle of shutting down.
-  // This shutdown mechanism works with free threaded servers.
-  //
-  // There are race issues with the ATL  delayed shutdown mechanism, hence the
-  // associated code has been eliminated, and we have an assert to make sure
-  // m_bDelayShutdown is not set.
-  virtual LONG Unlock() throw() {
-    ASSERT1(!m_bDelayShutdown);
-
-    ::CoReleaseServerProcess();
-    LONG lRet = CComGlobalsThreadModel::Decrement(&m_nLockCnt);
-
-    if (lRet == 0) {
-      ::PostThreadMessage(m_dwMainThreadID, WM_QUIT, 0, 0);
-    }
-
-    return lRet;
-  }
-
- private:
-  _ATL_OBJMAP_ENTRY* GetObjectMap();
-  HRESULT RegisterOrUnregisterExe(bool is_register);
-  static HRESULT RegisterOrUnregisterExe(void* data, bool is_register);
-
-  ComServerMode mode_;
-  bool is_machine_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(GoogleUpdate);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_GOOGLE_UPDATE_H_
-
diff --git a/goopdate/google_update3.h b/goopdate/google_update3.h
deleted file mode 100644
index 20a43d1..0000000
--- a/goopdate/google_update3.h
+++ /dev/null
@@ -1,244 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_GOOGLE_UPDATE3_H_
-#define OMAHA_GOOPDATE_GOOGLE_UPDATE3_H_
-
-#include <atlbase.h>
-#include <atlcom.h>
-#include <atlstr.h>
-#include <vector>
-#include "goopdate/omaha3_idl.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/atlregmapex.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/error.h"
-#include "omaha/base/exception_barrier.h"
-#include "omaha/base/preprocessor_fun.h"
-#include "omaha/base/user_rights.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/goopdate/com_proxy.h"
-#include "omaha/goopdate/model.h"
-#include "omaha/goopdate/non_localized_resource.h"
-#include "omaha/goopdate/worker.h"
-#include "third_party/bar/shared_ptr.h"
-
-namespace omaha {
-
-// The ATL Singleton Class Factory does not work very well if errors happen in
-// CreateInstance(), the server continues running. This is because the module
-// count is not incremented or decremented. This class fixes the issue so that
-// on error, the server shuts down as expected.
-template <class T>
-class SingletonClassFactory : public CComClassFactorySingleton<T> {
- public:
-  SingletonClassFactory() {}
-  virtual ~SingletonClassFactory() {}
-
-  STDMETHOD(CreateInstance)(LPUNKNOWN unk, REFIID iid, void** obj) {
-    HRESULT hr = CComClassFactorySingleton<T>::CreateInstance(unk, iid, obj);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[SingletonClassFactory::CreateInstance failed][0x%x]")
-                    _T("[pulsing module count]"), hr));
-      LockServer(TRUE);
-      LockServer(FALSE);
-
-      return hr;
-    }
-
-    return hr;
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(SingletonClassFactory);
-};
-
-template <bool machine, const TCHAR* const progid, const GUID& clsid,
-          UINT registry_resid, const TCHAR* const hkroot>
-struct Update3COMClassMode {
-  static bool is_machine() { return machine; }
-  static const TCHAR* const prog_id() { return progid; }
-  static GUID class_id() { return clsid; }
-  static UINT registry_res_id() { return registry_resid; }
-  static const TCHAR* const hk_root() { return hkroot; }
-};
-
-#pragma warning(push)
-// C4640: construction of local static object is not thread-safe
-#pragma warning(disable : 4640)
-// C4505: unreferenced IUnknown local functions have been removed
-#pragma warning(disable : 4505)
-
-template <typename T>
-class ATL_NO_VTABLE Update3COMClass
-    : public CComObjectRootEx<CComObjectThreadModel>,
-      public CComCoClass<Update3COMClass<T> >,
-      public IDispatchImpl<IGoogleUpdate3,
-                           &__uuidof(IGoogleUpdate3),
-                           &CAtlModule::m_libid,
-                           kMajorTypeLibVersion,
-                           kMinorTypeLibVersion>,
-      public StdMarshalInfo {
- public:
-  typedef Update3COMClass<T> Update3COMClassT;
-  typedef SingletonClassFactory<Update3COMClassT> SingletonClassFactoryT;
-
-  Update3COMClass() : StdMarshalInfo(T::is_machine()), model_(NULL) {}
-  virtual ~Update3COMClass() {}
-
-  DECLARE_CLASSFACTORY_EX(SingletonClassFactoryT)
-  DECLARE_NOT_AGGREGATABLE(Update3COMClassT)
-  DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-  DECLARE_REGISTRY_RESOURCEID_EX(T::registry_res_id())
-
-  BEGIN_REGISTRY_MAP()
-    REGMAP_ENTRY(_T("HKROOT"), T::hk_root())
-    REGMAP_EXE_MODULE(_T("MODULE"))
-    REGMAP_ENTRY(_T("VERSION"), _T("1.0"))
-    REGMAP_ENTRY(_T("PROGID"), T::prog_id())
-    REGMAP_ENTRY(_T("DESCRIPTION"), _T("Update3COMClass"))
-    REGMAP_UUID(_T("CLSID"), T::class_id())
-  END_REGISTRY_MAP()
-
-  BEGIN_COM_MAP(Update3COMClassT)
-    COM_INTERFACE_ENTRY(IGoogleUpdate3)
-    COM_INTERFACE_ENTRY(IDispatch)
-    COM_INTERFACE_ENTRY(IStdMarshalInfo)
-  END_COM_MAP()
-
-  STDMETHODIMP get_Count(long* count) {  // NOLINT
-    ASSERT1(count);
-    ExceptionBarrier barrier;
-
-    __mutexScope(model()->lock());
-    *count = model()->GetNumberOfAppBundles();
-
-    return S_OK;
-  }
-
-  STDMETHODIMP get_Item(long index, IDispatch** app_bundle_wrapper) {  // NOLINT
-    ASSERT1(app_bundle_wrapper);
-    ExceptionBarrier barrier;
-
-    if (::IsUserAnAdmin() && !UserRights::VerifyCallerIsAdmin()) {
-      CORE_LOG(LE, (_T("[User is not an admin]")));
-      return E_ACCESSDENIED;
-    }
-
-    __mutexScope(model()->lock());
-
-    const size_t num_app_bundles(model()->GetNumberOfAppBundles());
-    if (index < 0 || static_cast<size_t>(index) >= num_app_bundles) {
-      return HRESULT_FROM_WIN32(ERROR_INVALID_INDEX);
-    }
-    shared_ptr<AppBundle> app_bundle(model()->GetAppBundle(index));
-    return AppBundleWrapper::Create(app_bundle->controlling_ptr(),
-                                    app_bundle.get(),
-                                    app_bundle_wrapper);
-  }
-
-  // Creates an AppBundle object and its corresponding COM wrapper.
-  STDMETHODIMP createAppBundle(IDispatch** app_bundle_wrapper) {
-    ASSERT1(app_bundle_wrapper);
-    ExceptionBarrier barrier;
-
-    __mutexScope(model()->lock());
-
-    shared_ptr<AppBundle> app_bundle(model()->CreateAppBundle(T::is_machine()));
-    return AppBundleWrapper::Create(app_bundle->controlling_ptr(),
-                                    app_bundle.get(),
-                                    app_bundle_wrapper);
-  }
-
-  HRESULT FinalConstruct() {
-    CORE_LOG(L2, (_T("[Update3COMClass::FinalConstruct]")));
-
-    HRESULT hr = InitializeWorker();
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[InitializeWorker failed][0x%x]"), hr));
-      return hr;
-    }
-
-    omaha::interlocked_exchange_pointer(&model_, Worker::Instance().model());
-    ASSERT1(model());
-
-    return S_OK;
-  }
-
-  void FinalRelease() {
-    CORE_LOG(L2, (_T("[Update3COMClass::FinalRelease]")));
-  }
-
- private:
-  static HRESULT InitializeWorker() {
-    static LLock lock;
-    static bool is_initialized = false;
-
-    __mutexScope(lock);
-
-    if (is_initialized) {
-      return S_OK;
-    }
-
-    CORE_LOG(L2, (_T("[InitializeWorker][%d]"), T::is_machine()));
-
-    HRESULT hr = Worker::Instance().Initialize(T::is_machine());
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    is_initialized = true;
-    return S_OK;
-  }
-
-  Model* model() {
-    return omaha::interlocked_exchange_pointer(&model_, model_);
-  }
-
-  // C++ root of the object model. Not owned by this instance.
-  mutable Model* volatile model_;
-
-  DISALLOW_COPY_AND_ASSIGN(Update3COMClass);
-};
-
-#pragma warning(pop)
-
-extern TCHAR kHKRootUser[];
-extern TCHAR kHKRootMachine[];
-extern TCHAR kHKRootService[];
-extern TCHAR kProgIDUpdate3COMClassUserLocal[];
-extern TCHAR kProgIDUpdate3COMClassMachineLocal[];
-extern TCHAR kProgIDUpdate3COMClassServiceLocal[];
-
-typedef Update3COMClassMode<false,
-                            kProgIDUpdate3COMClassUserLocal,
-                            __uuidof(GoogleUpdate3UserClass),
-                            IDR_LOCAL_SERVER_RGS,
-                            kHKRootUser> Update3COMClassModeUser;
-
-typedef Update3COMClassMode<true,
-                            kProgIDUpdate3COMClassServiceLocal,
-                            __uuidof(GoogleUpdate3ServiceClass),
-                            IDR_LOCAL_SERVICE_RGS,
-                            kHKRootService> Update3COMClassModeService;
-
-typedef Update3COMClass<Update3COMClassModeUser> Update3COMClassUser;
-typedef Update3COMClass<Update3COMClassModeService> Update3COMClassService;
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_GOOGLE_UPDATE3_H_
diff --git a/goopdate/google_update_idl_ps.def b/goopdate/google_update_idl_ps.def
deleted file mode 100644
index 5248b7c..0000000
--- a/goopdate/google_update_idl_ps.def
+++ /dev/null
@@ -1,20 +0,0 @@
-; Copyright 2010 Google Inc.
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-;      http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-; ========================================================================
-
-
-EXPORTS        DllGetClassObject    PRIVATE
-               DllCanUnloadNow      PRIVATE
-               DllRegisterServer    PRIVATE
-               DllUnregisterServer  PRIVATE
diff --git a/goopdate/google_update_proxy.h b/goopdate/google_update_proxy.h
deleted file mode 100644
index 6b39a47..0000000
--- a/goopdate/google_update_proxy.h
+++ /dev/null
@@ -1,224 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Defines SharedMemoryProxy to encapsulate marshaling and unmarshaling of
-// IGoogleUpdate3 and other interface pointers across process boundaries.
-//
-// TODO(omaha): seems possible to make it general purpose and move it to common.
-#ifndef OMAHA_GOOPDATE_GOOGLE_UPDATE_PROXY_H__
-#define OMAHA_GOOPDATE_GOOGLE_UPDATE_PROXY_H__
-
-#include <atlbase.h>
-#include <atlsecurity.h>
-#include "base/basictypes.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/shared_memory_ptr.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-
-namespace omaha {
-
-// Constants
-const size_t kMaxSizeInterfaceMarshalData = 256;
-const TCHAR* const kBrowserHttpRequestShareName = _T("IBrowserRequest2_");
-
-struct InterfaceMarshalData {
-  void InitializeSharedData(const CString&) {
-    SetZero(data_);
-    size_ = 0;
-  }
-  size_t size_;
-  uint8 data_[kMaxSizeInterfaceMarshalData];
-};
-
-class SharedMemoryAttributes {
- public:
-  SharedMemoryAttributes(const TCHAR* shared_memory_name,
-                         const CSecurityDesc& security_attributes)
-      : shared_memory_name_(shared_memory_name),
-        security_attributes_(security_attributes) {
-  }
-  const CString& GetSharedMemoryName() { return shared_memory_name_; }
-  LPSECURITY_ATTRIBUTES GetSecurityAttributes() {
-    return &security_attributes_;
-  }
-
- private:
-  CString shared_memory_name_;
-  CSecurityAttributes security_attributes_;
-  DISALLOW_EVIL_CONSTRUCTORS(SharedMemoryAttributes);
-};
-
-extern SharedMemoryAttributes low_integrity_attributes;
-extern SharedMemoryAttributes high_integrity_attributes;
-
-template <typename InterfaceType, typename LockType>
-class SharedMemoryProxy {
- public:
-  SharedMemoryProxy(bool read_only, SharedMemoryAttributes* attributes)
-      : shared_memory_ptr_(attributes->GetSharedMemoryName(),
-                           attributes->GetSecurityAttributes(),
-                           NULL,
-                           read_only) {
-    CORE_LOG(L3, (_T("[SharedMemoryProxy::SharedMemoryProxy]")));
-  }
-
-  ~SharedMemoryProxy() {
-    CORE_LOG(L3, (_T("[SharedMemoryProxy::~SharedMemoryProxy]")));
-  }
-
-  HRESULT GetObject(InterfaceType** interface_ptr) {
-    ASSERT1(interface_ptr);
-    ASSERT1(*interface_ptr == NULL);
-
-    CORE_LOG(L3, (_T("[SharedMemoryProxy::GetObject]")));
-
-    return UnmarshalInterface(interface_ptr);
-  }
-
-  HRESULT RegisterObject(InterfaceType* interface_ptr) {
-    ASSERT1(interface_ptr);
-    CORE_LOG(L3, (_T("[SharedMemoryProxy::RegisterObject]")));
-
-    return MarshalInterface(interface_ptr);
-  }
-
-  HRESULT RevokeObject() {
-    CORE_LOG(L3, (_T("[SharedMemoryProxy::RevokeObject]")));
-
-    if (!shared_memory_ptr_) {
-      OPT_LOG(LEVEL_ERROR, (_T("[Shared memory ptr error]")));
-      return GOOPDATE_E_INVALID_SHARED_MEMORY_PTR;
-    }
-
-    shared_memory_ptr_->size_ = 0;
-    SetZero(shared_memory_ptr_->data_);
-
-    return S_OK;
-  }
-
- private:
-  // Helpers.
-  HRESULT MarshalInterface(InterfaceType* interface_ptr) {
-    CORE_LOG(L3, (_T("[SharedMemoryProxy::MarshalInterface]")));
-
-    if (!shared_memory_ptr_) {
-      OPT_LOG(LEVEL_ERROR, (_T("[Shared memory ptr error]")));
-      return GOOPDATE_E_INVALID_SHARED_MEMORY_PTR;
-    }
-
-    // Marshal the interface.
-    scoped_hglobal hglobal(::GlobalAlloc(GHND, 0));
-    if (!valid(hglobal)) {
-      OPT_LOG(LEVEL_ERROR, (_T("[GlobalAlloc failed]")));
-      return E_OUTOFMEMORY;
-    }
-
-    CComPtr<IStream> stream;
-    HRESULT hr = ::CreateStreamOnHGlobal(get(hglobal), false, &stream);
-    if (FAILED(hr)) {
-      OPT_LOG(LEVEL_ERROR, (_T("[CreateStreamOnHGlobal failed][0x%08x]"), hr));
-      return hr;
-    }
-
-    // MSHLFLAGS_TABLEWEAK results in CO_E_OBJNOTREG if unmarshaling multiple
-    // times, so using MSHLFLAGS_TABLESTRONG.
-    hr = ::CoMarshalInterface(stream,
-                              __uuidof(InterfaceType),
-                              interface_ptr,
-                              MSHCTX_LOCAL,
-                              NULL,
-                              MSHLFLAGS_TABLESTRONG);
-    if (FAILED(hr)) {
-      OPT_LOG(LEVEL_ERROR, (_T("[CoMarshalInterface failed][0x%08x]"), hr));
-      return hr;
-    }
-
-    // Copy out the marshaled data.
-    STATSTG stat = {0};
-    hr = stream->Stat(&stat, STATFLAG_NONAME);
-    if (FAILED(hr)) {
-      OPT_LOG(LEVEL_ERROR, (_T("[IStream::Stat failed][0x%08x]"), hr));
-      return hr;
-    }
-    int64 size = static_cast<int64>(stat.cbSize.QuadPart);
-    if (!size || size > kMaxSizeInterfaceMarshalData) {
-      OPT_LOG(LEVEL_ERROR, (_T("[Bad size][%I64d]"), size));
-      return GOOPDATE_E_INVALID_INTERFACE_MARSHAL_SIZE;
-    }
-
-    byte* data = reinterpret_cast<byte*>(::GlobalLock(get(hglobal)));
-    if (!data) {
-      return HRESULTFromLastError();
-    }
-    memcpy(shared_memory_ptr_->data_, data, stat.cbSize.LowPart);
-    shared_memory_ptr_->size_ = stat.cbSize.LowPart;
-
-    ::GlobalUnlock(get(hglobal));
-
-    return S_OK;
-  }
-
-  HRESULT UnmarshalInterface(InterfaceType** interface_ptr) {
-    CORE_LOG(L3, (_T("[SharedMemoryProxy::UnmarshalInterface]")));
-
-    if (!shared_memory_ptr_) {
-      OPT_LOG(LEVEL_ERROR, (_T("[Shared memory ptr error]")));
-      return GOOPDATE_E_INVALID_SHARED_MEMORY_PTR;
-    }
-
-    size_t size = shared_memory_ptr_->size_;
-    if (!size || size > kMaxSizeInterfaceMarshalData) {
-      CORE_LOG(LEVEL_ERROR, (_T("[bad size][%d]"), size));
-      return GOOPDATE_E_INVALID_INTERFACE_MARSHAL_SIZE;
-    }
-
-    // Unmarshal the interface.
-    scoped_hglobal hglobal(::GlobalAlloc(GPTR, size));
-    if (!valid(hglobal)) {
-      OPT_LOG(LEVEL_ERROR, (_T("[GlobalAlloc failed]")));
-      return E_OUTOFMEMORY;
-    }
-    memcpy(get(hglobal), shared_memory_ptr_->data_, size);
-
-    CComPtr<IStream> stream;
-    HRESULT hr = ::CreateStreamOnHGlobal(get(hglobal), false, &stream);
-    if (FAILED(hr)) {
-      OPT_LOG(LEVEL_ERROR, (_T("[CreateStreamOnHGlobal failed][0x%08x]"), hr));
-      return hr;
-    }
-
-    hr = ::CoUnmarshalInterface(stream,
-                                __uuidof(InterfaceType),
-                                reinterpret_cast<void **>(interface_ptr));
-    if (FAILED(hr)) {
-      OPT_LOG(LEVEL_ERROR, (_T("[CoUnmarshalInterface failed][0x%08x]"), hr));
-      return hr;
-    }
-
-    return S_OK;
-  }
-
-  SharedMemoryPtr<LockType, InterfaceMarshalData> shared_memory_ptr_;
-  DISALLOW_EVIL_CONSTRUCTORS(SharedMemoryProxy);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_GOOGLE_UPDATE_PROXY_H__
-
diff --git a/goopdate/google_update_ps.cc b/goopdate/google_update_ps.cc
deleted file mode 100644
index 3de7216..0000000
--- a/goopdate/google_update_ps.cc
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <atlbase.h>
-#include "base/basictypes.h"
-#include "omaha/base/utils.h"
-#include "goopdate/omaha3_idl.h"
-#include "omaha/goopdate/com_proxy.h"
-#include "omaha/goopdate/current_state.h"
-#include "omaha/goopdate/omaha3_idl_datax.h"
-
-namespace omaha {
-
-// TODO(omaha): Try to see if a single proxy DLL can be used for both user and
-// machine.
-
-#if IS_MACHINE_HANDLER
-  OBJECT_ENTRY_AUTO(__uuidof(GoogleComProxyMachineClass), ComProxy)
-  OBJECT_ENTRY_AUTO(__uuidof(CurrentStateMachineClass), CurrentAppState)
-#else
-  OBJECT_ENTRY_AUTO(__uuidof(GoogleComProxyUserClass), ComProxy)
-  OBJECT_ENTRY_AUTO(__uuidof(CurrentStateUserClass), CurrentAppState)
-#endif
-
-namespace {
-
-class GoogleUpdatePSModule
-    : public CAtlDllModuleT<GoogleUpdatePSModule> {
- public:
-  GoogleUpdatePSModule() {}
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(GoogleUpdatePSModule);  // NOLINT
-} _AtlModule;
-
-}  // namespace
-
-}  // namespace omaha
-
-BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) {
-  HRESULT hr = omaha::_AtlModule.DllMain(reason, reserved);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return PrxDllMain(instance, reason, reserved);
-}
-
-STDAPI DllCanUnloadNow() {
-  if (omaha::_AtlModule.DllCanUnloadNow() == S_OK &&
-      PrxDllCanUnloadNow() == S_OK) {
-    return S_OK;
-  }
-
-  return S_FALSE;
-}
-
-STDAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void** ptr) {
-  HRESULT hr_atl = omaha::_AtlModule.DllGetClassObject(clsid, iid, ptr);
-  if (SUCCEEDED(hr_atl)) {
-    return hr_atl;
-  }
-
-  HRESULT hr_prx = PrxDllGetClassObject(clsid, iid, ptr);
-  if (FAILED(hr_prx)) {
-    CORE_LOG(LE, (_T("[DllGetClassObject failed][%s][%s][0x%x][0x%x]"),
-        omaha::GuidToString(clsid), omaha::GuidToString(iid), hr_atl, hr_prx));
-  }
-
-  return hr_prx;
-}
-
-STDAPI DllRegisterServer() {
-  HRESULT hr = omaha::_AtlModule.DllRegisterServer(false);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[DllRegisterServer failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return PrxDllRegisterServer();
-}
-
-STDAPI DllUnregisterServer() {
-  HRESULT hr = PrxDllUnregisterServer();
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[DllUnregisterServer failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return omaha::_AtlModule.DllUnregisterServer(false);
-}
-
diff --git a/goopdate/google_update_ps.def b/goopdate/google_update_ps.def
deleted file mode 100644
index 5248b7c..0000000
--- a/goopdate/google_update_ps.def
+++ /dev/null
@@ -1,20 +0,0 @@
-; Copyright 2010 Google Inc.
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-;      http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-; ========================================================================
-
-
-EXPORTS        DllGetClassObject    PRIVATE
-               DllCanUnloadNow      PRIVATE
-               DllRegisterServer    PRIVATE
-               DllUnregisterServer  PRIVATE
diff --git a/goopdate/google_update_ps_resource.h b/goopdate/google_update_ps_resource.h
deleted file mode 100644
index 8592e2c..0000000
--- a/goopdate/google_update_ps_resource.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_GOOGLE_UPDATE_PS_RESOURCE_H_
-#define OMAHA_GOOPDATE_GOOGLE_UPDATE_PS_RESOURCE_H_
-
-#define IDR_INPROC_SERVER_RGS                    101
-#define IDR_COM_PROXY_RGS                        103
-
-#endif  // OMAHA_GOOPDATE_GOOGLE_UPDATE_PS_RESOURCE_H_
diff --git a/goopdate/google_update_ps_resource.rc b/goopdate/google_update_ps_resource.rc
deleted file mode 100644
index 9875924..0000000
--- a/goopdate/google_update_ps_resource.rc
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// These include headers with absolute paths, which Resource Editor cannot load.
-#ifndef APSTUDIO_INVOKED
-#include "omaha/base/const_config.h"
-#include "omaha/goopdate/google_update_ps_resource.h"
-#endif  // APSTUDIO_INVOKED
-
-IDR_INPROC_SERVER_RGS REGISTRY "omaha/base/generic_reg_file_dll.rgs"
-IDR_COM_PROXY_RGS     REGISTRY "omaha/base/generic_reg_file_dll_handler.rgs"
-
-1 TYPELIB "goopdate\\omaha3_idl.tlb"
-
diff --git a/goopdate/goopdate.cc b/goopdate/goopdate.cc
deleted file mode 100644
index aeda0aa..0000000
--- a/goopdate/goopdate.cc
+++ /dev/null
@@ -1,1618 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// For interactive instances, do not access the network before displaying the
-// UI. This provides a better user experience - quick UI - when the network is
-// slow. It is also required to ensure that UI displayed event is signaled
-// before potentially waiting on a firewall prompt.
-//
-// Debugging notes:
-//  * Omaha initial install:
-//      /install "appguid={8A69D345-D564-463C-AFF1-A69D9E530F96}&appname=Google%20Chrome&needsadmin=False&lang=en"  // NOLINT
-//      /install "appguid={283EAF47-8817-4c2b-A801-AD1FADFB7BAA}&appname=Gears&needsadmin=True&lang=en"  // NOLINT
-//  * App install:
-//      /handoff "appguid={8A69D345-D564-463C-AFF1-A69D9E530F96}&appname=Google%20Chrome&needsadmin=False&lang=en"  // NOLINT
-//      /handoff "appguid={283EAF47-8817-4c2b-A801-AD1FADFB7BAA}&appname=Gears&needsadmin=True&lang=en"  // NOLINT
-//  * Silent install:
-//   * Add "/silent" to any of the above command lines (not to the tag).
-//  * Google Update self-update:
-//      /update
-//  * Update check for apps that need it:
-//      /ua
-//  * Core:
-//      /c
-//  * Cod Red check:
-//      /cr
-//  * Cod Red repair:
-//      /recover [/machine]
-//  * OneClick:
-//      /pi "http://www.google.com/" "/install%20%22appguid=%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26lang=en%26appname=Google%2520Chrome%26needsadmin=false" /installsource oneclick  // NOLINT
-//  * COM server:
-//      -Embedding
-
-#include "omaha/goopdate/goopdate.h"
-
-#include <atlstr.h>
-#include <new>
-#include "base/scoped_ptr.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/crash_if_specific_error.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/module_utils.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/proc_utils.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/system_info.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/client/client_utils.h"
-#include "omaha/client/install.h"
-#include "omaha/client/install_apps.h"
-#include "omaha/client/install_self.h"
-#include "omaha/client/resource.h"  // IDS_* are used in client modes only.
-#include "omaha/client/ua.h"
-#include "omaha/common/app_registry_utils.h"
-#include "omaha/common/command_line.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/common/ping.h"
-#include "omaha/common/lang.h"
-#include "omaha/common/oem_install_utils.h"
-#include "omaha/common/stats_uploader.h"
-#include "omaha/common/webplugin_utils.h"
-#include "omaha/core/core.h"
-#include "omaha/core/crash_handler.h"
-#include "omaha/goopdate/code_red_check.h"
-#include "omaha/goopdate/crash.h"
-#include "omaha/goopdate/google_update.h"
-#include "omaha/goopdate/goopdate_internal.h"
-#include "omaha/goopdate/goopdate_metrics.h"
-#include "omaha/goopdate/resource_manager.h"
-#include "omaha/net/net_diags.h"
-#include "omaha/service/service_main.h"
-#include "omaha/setup/setup_service.h"
-#include "third_party/breakpad/src/client/windows/sender/crash_report_sender.h"
-#include "third_party/breakpad/src/client/windows/handler/exception_handler.h"
-
-// TODO(omaha3): Where should we put this? In Omaha 2, it was in worker.cc.
-// TODO(omaha): fix this clunkiness and require explicit registration of the
-// http creators with the factory. Not ideal but better then linker options.
-#pragma comment(linker, "/INCLUDE:_kRegisterWinHttp")
-
-namespace omaha {
-
-namespace {
-
-#if DEBUG
-const TCHAR* const kBuildType = _T("dbg");
-#else
-const TCHAR* const kBuildType = _T("opt");
-#endif
-
-#if OFFICIAL_BUILD
-const TCHAR* const kOfficialBuild = _T("official");
-#else
-const TCHAR* const kOfficialBuild = _T("dev");
-#endif
-
-#if DEBUG
-// Returns true if the binary's version matches the installed version or this
-// mode does not require the versions to match.
-bool CheckRegisteredVersion(const CString& version,
-                            bool is_machine,
-                            CommandLineMode mode) {
-  switch (mode) {
-    // Modes that may run before or during installation or otherwise do not
-    // need to match the installed version.
-    case COMMANDLINE_MODE_UNKNOWN:
-    case COMMANDLINE_MODE_NOARGS:
-    case COMMANDLINE_MODE_REGSERVER:
-    case COMMANDLINE_MODE_UNREGSERVER:
-    case COMMANDLINE_MODE_NETDIAGS:
-    case COMMANDLINE_MODE_CRASH:
-    case COMMANDLINE_MODE_REPORTCRASH:
-    case COMMANDLINE_MODE_INSTALL:
-    case COMMANDLINE_MODE_UPDATE:
-    case COMMANDLINE_MODE_RECOVER:
-    case COMMANDLINE_MODE_WEBPLUGIN:
-    case COMMANDLINE_MODE_REGISTER_PRODUCT:
-    case COMMANDLINE_MODE_UNREGISTER_PRODUCT:
-    case COMMANDLINE_MODE_SERVICE_REGISTER:
-    case COMMANDLINE_MODE_SERVICE_UNREGISTER:
-    case COMMANDLINE_MODE_PING:
-      return true;
-
-    // COM servers and services that should only run after installation.
-    case COMMANDLINE_MODE_CORE:
-    case COMMANDLINE_MODE_SERVICE:
-    case COMMANDLINE_MODE_CODE_RED_CHECK:
-    case COMMANDLINE_MODE_COMSERVER:
-    case COMMANDLINE_MODE_CRASH_HANDLER:
-    case COMMANDLINE_MODE_COMBROKER:
-    case COMMANDLINE_MODE_ONDEMAND:
-    case COMMANDLINE_MODE_MEDIUM_SERVICE:
-
-    // Clients that should only run after installation and should match the
-    // installed version.
-    case COMMANDLINE_MODE_HANDOFF_INSTALL:
-    case COMMANDLINE_MODE_UA:
-    case COMMANDLINE_MODE_UNINSTALL:
-
-    default:
-      // This binary's version should be the installed version.
-      CString installed_version;
-      VERIFY1(SUCCEEDED(RegKey::GetValue(
-          ConfigManager::Instance()->registry_update(is_machine),
-          kRegValueInstalledVersion,
-          &installed_version)));
-      return version == installed_version;
-  }
-}
-#endif
-
-}  // namespace
-
-namespace detail {
-
-class GoopdateImpl {
- public:
-  GoopdateImpl(Goopdate* goopdate, bool is_local_system);
-  ~GoopdateImpl();
-
-  HRESULT Main(HINSTANCE instance, const TCHAR* cmd_line, int cmd_show);
-
-  HRESULT QueueUserWorkItem(UserWorkItem* work_item, uint32 flags);
-
-  void Stop();
-
-  bool is_local_system() const { return is_local_system_; }
-
- private:
-  HRESULT DoMain(HINSTANCE instance, const TCHAR* cmd_line, int cmd_show);
-
-  // Performs initialization that must be done as soon as the command line has
-  // been parsed and loads the resources. If this method succeeds, we can use
-  // the resources - for example, to display error messagse.
-  HRESULT InitializeGoopdateAndLoadResources();
-
-  // Executes the mode determined by DoMain().
-  HRESULT ExecuteMode(bool* has_ui_been_displayed);
-
-  // Returns whether a process is a machine process.
-  // Does not determine whether the process has the appropriate privileges.
-  bool IsMachineProcess();
-
-  bool ShouldCheckShutdownEvent(CommandLineMode mode);
-  bool IsShutdownEventSet();
-
-  HRESULT LoadResourceDllIfNecessary(CommandLineMode mode,
-                                     const CString& resource_dir);
-
-  HRESULT SetUsageStatsEnable();
-
-  // Handles error conditions by showing UI if appropriate.
-  void HandleError(HRESULT hr, bool has_ui_been_displayed);
-
-  // Handles response to /pi command.
-  HRESULT HandleWebPlugin();
-
-  // Handles responses to /cr command.
-  HRESULT HandleCodeRedCheck();
-
-  // Handles /report command.
-  HRESULT HandleReportCrash();
-
-  // Installs apps for the /handoff instance.
-  HRESULT DoHandoff(bool* has_ui_been_displayed);
-
-  // Updates all registered apps for the /ua instance.
-  HRESULT DoUpdateAllApps(bool* has_ui_been_displayed);
-
-  // Generates a divide by zero to trigger breakpad dump.
-  // Is only enabled in debug builds.
-  HRESULT DoCrash();
-
-  // Install Omaha.
-  HRESULT DoInstall(bool* has_ui_been_displayed);
-
-  // Silently update Omaha.
-  HRESULT DoSelfUpdate();
-
-  // Handles the recover command in Google Update.
-  HRESULT DoRecover();
-
-  // Uninstalls Omaha if appropriate.
-  HRESULT HandleUninstall();
-
-  // Pings the Omaha server with a string.
-  HRESULT HandlePing();
-
-  // TODO(omaha): Reconcile the two uninstall functions and paths.
-  void MaybeUninstallGoogleUpdate();
-
-  // Uninstalls Google Update if a /install process failed to install itself
-  // or the app and there are no other apps registered.
-  HRESULT UninstallIfNecessary();
-
-  // Called by operator new or operator new[] when they cannot satisfy
-  // a request for additional storage.
-  static void OutOfMemoryHandler();
-
-  static HRESULT CaptureOSMetrics();
-
-  HINSTANCE module_instance_;  // Current module instance.
-  CString cmd_line_;           // Command line, as provided by the OS.
-  int cmd_show_;
-
-  CommandLineArgs args_;       // Command line options and flags.
-
-  // True if the process belongs to a machine Omaha "session".
-  bool is_machine_;
-  bool is_local_system_;       // True if running as LOCAL_SYSTEM.
-  CString this_version_;       // Version of this Goopdate DLL.
-
-  // True if Omaha has been uninstalled by the Worker.
-  bool has_uninstalled_;
-
-  // Language identifier for the current user locale.
-  CString user_default_language_id_;
-
-  scoped_ptr<ThreadPool>      thread_pool_;
-
-  Goopdate* goopdate_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(GoopdateImpl);
-};
-
-GoopdateImpl::GoopdateImpl(Goopdate* goopdate, bool is_local_system)
-    : module_instance_(NULL),
-      cmd_show_(0),
-      is_local_system_(is_local_system),
-      has_uninstalled_(false),
-      goopdate_(goopdate) {
-  ASSERT1(goopdate);
-
-  ++metric_goopdate_constructor;
-
-  // The command line needs to be parsed to accurately determine if the current
-  // process is a machine process or not. Take an upfront guess before that.
-  is_machine_ = vista_util::IsUserAdmin() &&
-      goopdate_utils::IsRunningFromOfficialGoopdateDir(true);
-
-  // Install an error-handling mechanism which gets called when new operator
-  // fails to allocate memory.
-  VERIFY1(set_new_handler(&GoopdateImpl::OutOfMemoryHandler) == 0);
-
-  // Install the exception handler.
-  VERIFY1(SUCCEEDED(Crash::InstallCrashHandler(is_machine_)));
-
-  // Hints network configure manager how to create its singleton.
-  NetworkConfigManager::set_is_machine(is_machine_);
-
-  // Initialize the global metrics collection.
-  stats_report::g_global_metrics.Initialize();
-
-  // TODO(omaha): Support multiple HRESULT codes to crash on.
-  // TODO(omaha): Support passing in HRESULT codes via the command line,
-  // especially for "/update".
-  DWORD crash_specific_error = 0;
-  if (SUCCEEDED(RegKey::GetValue(MACHINE_REG_UPDATE_DEV,
-                                 kRegValueNameCrashIfSpecificError,
-                                 &crash_specific_error))) {
-    omaha::g_crash_specific_error = static_cast<HRESULT>(crash_specific_error);
-  }
-
-  static const int kThreadPoolShutdownDelayMs = 60000;
-  thread_pool_.reset(new ThreadPool);
-  HRESULT hr = thread_pool_->Initialize(kThreadPoolShutdownDelayMs);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[thread_pool_->Initialize failed][0x%08x]"), hr));
-  }
-}
-
-GoopdateImpl::~GoopdateImpl() {
-  CORE_LOG(L2, (_T("[GoopdateImpl::~GoopdateImpl]")));
-
-  ++metric_goopdate_destructor;
-
-  Stop();
-
-  // Bug 994348 does not repro anymore.
-  // If the assert fires, clean up the key, and fix the code if we have unit
-  // tests or application code that create the key.
-  ASSERT(!RegKey::HasKey(_T("HKEY_USERS\\.DEFAULT\\Software\\Google\\Update")),
-         (_T("This assert has fired because it has found the registry key at ")
-          _T("'HKEY_USERS\\.DEFAULT\\Software\\Google\\Update'. ")
-          _T("Please delete the key and report to omaha-core team if ")
-          _T("the assert fires again.")));
-
-  // The global metrics collection must be uninitialized before the metrics
-  // destructors are called.
-  stats_report::g_global_metrics.Uninitialize();
-
-  // Uninstall the exception handler. Program crashes are handled by Windows
-  // Error Reporting (WER) beyond this point.
-  Crash::UninstallCrashHandler();
-
-  // Reset the new handler.
-  set_new_handler(NULL);
-}
-
-HRESULT GoopdateImpl::QueueUserWorkItem(UserWorkItem* work_item, uint32 flags) {
-  CORE_LOG(L3, (_T("[GoopdateImpl::QueueUserWorkItem]")));
-  ASSERT1(work_item);
-
-  ASSERT1(thread_pool_.get());
-
-  return thread_pool_->QueueUserWorkItem(work_item, flags);
-}
-
-void GoopdateImpl::Stop() {
-  // The thread pool destructor waits for any remaining jobs to complete.
-  thread_pool_.reset();
-}
-
-// Assumes the resources are loaded and members are initialized.
-void GoopdateImpl::HandleError(HRESULT hr, bool has_ui_been_displayed) {
-  CORE_LOG(L3, (_T("[GoopdateImpl::HandleError][0x%x][%u]"),
-      hr, has_ui_been_displayed));
-
-  if (has_ui_been_displayed ||
-      !internal::CanDisplayUi(args_.mode, args_.is_silent_set)) {
-    return;
-  }
-
-  const CString& bundle_name = args_.extra.bundle_name;
-  CString primary_app_guid;
-  if (!args_.extra.apps.empty()) {
-    primary_app_guid = GuidToString(args_.extra.apps[0].app_guid);
-  }
-
-  CString error_text;
-  switch (hr) {
-    case GOOPDATE_E_UA_ALREADY_RUNNING:
-      error_text.FormatMessage(IDS_APPLICATION_ALREADY_INSTALLING,
-                               client_utils::GetUpdateAllAppsBundleName());
-      break;
-    case OMAHA_NET_E_WINHTTP_NOT_AVAILABLE:
-      ASSERT1(!bundle_name.IsEmpty());
-      error_text.FormatMessage(IDS_WINDOWS_IS_NOT_UP_TO_DATE,
-                               bundle_name);
-      break;
-    default:
-      // TODO(omaha3): This currently assumes that any error returned here is
-      // related to Setup.
-      CString product_name;
-      VERIFY1(product_name.LoadString(IDS_PRODUCT_DISPLAY_NAME));
-      error_text.FormatMessage(IDS_SETUP_FAILED, product_name, hr);
-      break;
-  }
-
-  VERIFY1(client_utils::DisplayError(is_machine_,
-               bundle_name,
-               hr,
-               0,
-               error_text,
-               primary_app_guid,
-               args_.extra.language,
-               args_.extra.installation_id,
-               args_.extra.brand_code));
-}
-
-HRESULT GoopdateImpl::Main(HINSTANCE instance,
-                           const TCHAR* cmd_line,
-                           int cmd_show) {
-  ++metric_goopdate_main;
-
-  HRESULT hr = DoMain(instance, cmd_line, cmd_show);
-
-  CORE_LOG(L2, (_T("[has_uninstalled_ is %d]"), has_uninstalled_));
-
-  // For install processes, verify the Google Update EULA has been accepted and
-  // we can use the network unless a) the command line specifies EULA is
-  // required or b) in OEM installing mode, which also prevents network use.
-  if ((COMMANDLINE_MODE_INSTALL == args_.mode ||
-       COMMANDLINE_MODE_HANDOFF_INSTALL == args_.mode) &&
-       SUCCEEDED(hr)) {
-    ASSERT1(args_.is_eula_required_set ||
-            ConfigManager::Instance()->CanUseNetwork(is_machine_) ||
-            oem_install_utils::IsOemInstalling(is_machine_));
-  }
-
-  // In the /install case, clean up if Google Update and/or app install did not
-  // complete successfully.
-  // Only aggregate the metrics if there is no chance that Google Update has
-  // or may be uninstalled and the process has the appropriate permissions.
-  // Uninstall will aggregate and report the metrics as appropriate.
-  bool did_install_uninstall_fail = false;
-  if (COMMANDLINE_MODE_INSTALL == args_.mode) {
-    did_install_uninstall_fail = FAILED(UninstallIfNecessary());
-  } else if (!has_uninstalled_) {
-    if (args_.mode == COMMANDLINE_MODE_UA) {
-      VERIFY1(SUCCEEDED(AggregateAndReportMetrics(is_machine_, false)));
-    } else if (!is_machine_ || vista_util::IsUserAdmin()) {
-      VERIFY1(SUCCEEDED(AggregateMetrics(is_machine_)));
-    }
-  }
-
-  Worker::DeleteInstance();
-
-  // Uninitializing the network configuration must happen after reporting the
-  // metrics. The call succeeds even if the network has not been initialized
-  // due to errors up the execution path.
-  NetworkConfigManager::DeleteInstance();
-
-  if (COMMANDLINE_MODE_INSTALL == args_.mode &&
-      args_.is_oem_set &&
-      SUCCEEDED(hr) &&
-      !oem_install_utils::IsOemInstalling(is_machine_)) {
-    ASSERT1(false);
-    hr = GOOPDATE_E_OEM_INSTALL_SUCCEEDED_BUT_NOT_IN_OEM_INSTALLING_MODE;
-  }
-
-  // Verify that Google Update is either completely installed or uninstalled.
-  // Do not check in the following cases:
-  // * Modes that may exit during Setup, during uninstall, or while Omaha
-  //   is partially installed.
-  // * The mode is unknown, which means the args were not be parsed.
-  // * /cr instance, which may exit after Omaha is uninstalled.
-  // * /install instance that would not have called Setup.Uninstall().
-  // * /install instance when Uninstall failed for some reason since the
-  //   the consistency check may expect the wrong state.
-  // * /update instance that failed due to an install/uninstall in progress.
-  if (COMMANDLINE_MODE_REGSERVER != args_.mode &&
-      COMMANDLINE_MODE_UNREGSERVER != args_.mode &&
-      COMMANDLINE_MODE_COMSERVER != args_.mode &&
-      COMMANDLINE_MODE_CODE_RED_CHECK != args_.mode &&
-      COMMANDLINE_MODE_SERVICE_REGISTER != args_.mode &&
-      COMMANDLINE_MODE_SERVICE_UNREGISTER != args_.mode &&
-      COMMANDLINE_MODE_UNKNOWN != args_.mode &&
-      !(COMMANDLINE_MODE_INSTALL == args_.mode &&
-        is_machine_ &&
-        !vista_util::IsUserAdmin()) &&
-      !(COMMANDLINE_MODE_UPDATE == args_.mode &&
-        GOOPDATE_E_FAILED_TO_GET_LOCK == hr) &&
-      !did_install_uninstall_fail) {
-    install_self::CheckInstallStateConsistency(is_machine_);
-  }
-
-  ResourceManager::Delete();
-
-  return hr;
-}
-
-HRESULT GoopdateImpl::DoMain(HINSTANCE instance,
-                             const TCHAR* cmd_line,
-                             int cmd_show) {
-  module_instance_ = instance;
-  cmd_line_ = cmd_line;
-  cmd_show_ = cmd_show;
-
-  // The system terminates the process without displaying a retry dialog box
-  // for the user. GoogleUpdate has no user state to be saved, therefore
-  // prompting the user for input is meaningless.
-  VERIFY1(SUCCEEDED(SetProcessSilentShutdown()));
-
-  VERIFY1(SUCCEEDED(CaptureOSMetrics()));
-
-  InitializeVersionFromModule(module_instance_);
-  this_version_ = GetVersionString();
-
-  TCHAR path[MAX_PATH] = {0};
-  VERIFY1(::GetModuleFileName(module_instance_, path, MAX_PATH));
-  OPT_LOG(L1, (_T("[%s][version %s][%s][%s]"),
-               path, this_version_, kBuildType, kOfficialBuild));
-
-  CORE_LOG(L2, (_T("[is system %d]")
-                _T("[elevated admin %d]")
-                _T("[non-elevated admin %d]")
-                _T("[testsource %s]"),
-                is_local_system_,
-                vista_util::IsUserAdmin(),
-                vista_util::IsUserNonElevatedAdmin(),
-                ConfigManager::Instance()->GetTestSource()));
-
-  HRESULT parse_hr = omaha::ParseCommandLine(cmd_line_, &args_);
-  if (FAILED(parse_hr)) {
-    CORE_LOG(LE, (_T("[Parse cmd line failed][0x%08x]"), parse_hr));
-    args_.mode = COMMANDLINE_MODE_UNKNOWN;
-    // Continue because we want to load the resources and display an error.
-  }
-
-  // TODO(omaha3): Interactive updates might be useful for debugging or even
-  // on-demand updates of all apps. Figure out how to expose this. For now, no
-  // install source, which should not happen normally, is used as the trigger.
-  // The simplest way to make this work is to set args_.is_silent_set
-  // accordingly. However, we also need a way for this to work for per-machine
-  // instances since IsMachineProcess() relies on being Local System. When we
-  // settle on a mechanism, we should update the parser and remove this.
-  if (args_.mode == COMMANDLINE_MODE_UA) {
-    args_.is_silent_set = !args_.install_source.IsEmpty();
-  }
-
-  HRESULT hr = InitializeGoopdateAndLoadResources();
-  if (FAILED(hr)) {
-    CORE_LOG(LE,
-             (_T("[InitializeGoopdateAndLoadResources failed][0x%08x]"), hr));
-    if (internal::CanDisplayUi(args_.mode, args_.is_silent_set)) {
-      // The resources are unavaliable, so we must use hard-coded text.
-      const TCHAR* const kMsgBoxTitle = _T("Google Installer");
-      CString message;
-      message.Format(_T("Installation failed with error 0x%08x."), hr);
-      VERIFY1(IDOK == ::MessageBox(NULL, message, kMsgBoxTitle, MB_OK));
-    }
-    return hr;
-  }
-  // The resources are now loaded and available if applicable for this instance.
-  // If there was no bundle name specified on the command line, we take the
-  // bundle name from the first app's name; if that has no name (or if there is
-  // no apps, as in a runtime-only install) it will be an empty string.
-  // Replace it with the localized installer name.
-  if (args_.extra.bundle_name.IsEmpty()) {
-    args_.extra.bundle_name.LoadString(IDS_PRODUCT_DISPLAY_NAME);
-  }
-
-  CORE_LOG(L2, (_T("[can use network %d]")
-                _T("[can collect stats %d]"),
-                ConfigManager::Instance()->CanUseNetwork(is_machine_),
-                ConfigManager::Instance()->CanCollectStats(is_machine_)));
-
-  bool has_ui_been_displayed = false;
-
-  if (!is_machine_ && vista_util::IsElevatedWithUACMaybeOn()) {
-    CORE_LOG(LW, (_T("User GoogleUpdate is possibly running in an unsupported ")
-                  _T("way, at High integrity with UAC possibly enabled.")));
-  }
-
-  if (FAILED(parse_hr)) {
-    ASSERT1(args_.mode == COMMANDLINE_MODE_UNKNOWN);
-    hr = parse_hr;
-  } else {
-    ASSERT1(args_.mode != COMMANDLINE_MODE_UNKNOWN);
-    // TODO(omaha): I would like to pass the mode as an argument, but there
-    // are so many uses for args_.mode and they could easily creep in. Consider
-    // eliminating the args_ member.
-    hr = ExecuteMode(&has_ui_been_displayed);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[ExecuteMode failed][0x%08x]"), hr));
-      // Continue and display error.
-    }
-  }
-
-  if (FAILED(hr)) {
-    HandleError(hr, has_ui_been_displayed);
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// Assumes the command line has been parsed.
-HRESULT GoopdateImpl::InitializeGoopdateAndLoadResources() {
-  // IsMachineProcess requires the command line be parsed first.
-  is_machine_ = IsMachineProcess();
-  OPT_LOG(L1, (_T("[is machine: %d]"), is_machine_));
-
-  if (!::SetEnvironmentVariable(kEnvVariableIsMachine,
-                                is_machine_ ? _T("1") : _T("0"))) {
-    HRESULT hr = HRESULTFromLastError();
-    CORE_LOG(LW, (_T("[::SetEnvironmentVariable failed][%s][0x%x]"),
-                  kEnvVariableIsMachine, hr));
-  }
-
-  // After parsing the command line, reinstall the crash handler to match the
-  // state of the process.
-  if (is_machine_ != Crash::is_machine()) {
-    VERIFY1(SUCCEEDED(Crash::InstallCrashHandler(is_machine_)));
-  }
-
-  // We have parsed the command line, and we are now resetting is_machine.
-  NetworkConfigManager::set_is_machine(
-      is_machine_ && vista_util::IsUserAdmin());
-
-  // Set the current directory to be the one that the DLL was launched from.
-  TCHAR module_directory[MAX_PATH] = {0};
-  if (!GetModuleDirectory(module_instance_, module_directory)) {
-     return HRESULTFromLastError();
-  }
-  if (!::SetCurrentDirectory(module_directory)) {
-    return HRESULTFromLastError();
-  }
-  OPT_LOG(L3, (_T("[Current dir][%s]"), module_directory));
-
-  // Set the usage stats as soon as possible, which is after the command line
-  // has been parsed, so that we can report crashes and other stats.
-  VERIFY1(SUCCEEDED(SetUsageStatsEnable()));
-
-  VERIFY1(SUCCEEDED(internal::PromoteAppEulaAccepted(is_machine_)));
-
-  if (ShouldCheckShutdownEvent(args_.mode) && IsShutdownEventSet()) {
-    return GOOPDATE_E_SHUTDOWN_SIGNALED;
-  }
-
-  HRESULT hr = LoadResourceDllIfNecessary(args_.mode, module_directory);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[LoadResourceDllIfNecessary failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// Assumes Goopdate is initialized and resources are loaded.
-HRESULT GoopdateImpl::ExecuteMode(bool* has_ui_been_displayed) {
-  ASSERT1(has_ui_been_displayed);
-
-  // Save the mode on the stack for post-mortem debugging purposes.
-  volatile CommandLineMode mode = args_.mode;
-
-  user_default_language_id_ = lang::GetDefaultLanguage(is_local_system_);
-
-  ASSERT1(CheckRegisteredVersion(GetVersionString(), is_machine_, mode));
-
-#pragma warning(push)
-// C4061: enumerator 'xxx' in switch of enum 'yyy' is not explicitly handled by
-// a case label.
-#pragma warning(disable : 4061)
-  switch (mode) {
-    // Delegate to the service or the core. Both have reliability requirements
-    // and resource constraints. Generally speaking, they do not use COM nor
-    // networking code.
-    case COMMANDLINE_MODE_SERVICE:
-      return omaha::Update3ServiceModule().Main(SW_HIDE);
-
-    case COMMANDLINE_MODE_MEDIUM_SERVICE:
-      return omaha::UpdateMediumServiceModule().Main(SW_HIDE);
-
-    case COMMANDLINE_MODE_SERVICE_REGISTER: {
-      HRESULT hr = SetupUpdate3Service::InstallService(
-                       app_util::GetModulePath(NULL));
-      if (FAILED(hr)) {
-        return hr;
-      }
-      return SetupUpdateMediumService::InstallService(
-                 app_util::GetModulePath(NULL));
-    }
-
-    case COMMANDLINE_MODE_SERVICE_UNREGISTER: {
-      HRESULT hr = SetupUpdate3Service::UninstallService();
-      if (FAILED(hr)) {
-        return hr;
-      }
-      return SetupUpdateMediumService::UninstallService();
-    }
-
-    default: {
-      scoped_co_init init_com_apt(COINIT_MULTITHREADED);
-      HRESULT hr = init_com_apt.hresult();
-      if (FAILED(hr)) {
-        return hr;
-      }
-
-      switch (mode) {
-        case COMMANDLINE_MODE_CORE:
-          return omaha::Core().Main(is_local_system_,
-                                    !args_.is_crash_handler_disabled);
-
-        case COMMANDLINE_MODE_CRASH_HANDLER:
-          return omaha::CrashHandler().Main(is_local_system_);
-
-        case COMMANDLINE_MODE_NOARGS:
-          return GOOPDATE_E_NO_ARGS;
-
-        case COMMANDLINE_MODE_UNREGISTER_PRODUCT:
-          // TODO(omaha3): Eliminate the need for this mode.
-          return E_FAIL;
-
-        case COMMANDLINE_MODE_COMBROKER:
-          return omaha::GoogleUpdate(is_machine_,
-                                     omaha::GoogleUpdate::kBrokerMode).Main();
-
-        case COMMANDLINE_MODE_ONDEMAND:
-         return omaha::GoogleUpdate(
-             is_machine_,
-             omaha::GoogleUpdate::kOnDemandMode).Main();
-
-        default: {
-          // Reference the network instance here so the singleton can be
-          // created before possible impersonation.
-          NetworkConfigManager::Instance();
-
-          switch (mode) {
-            case COMMANDLINE_MODE_WEBPLUGIN:
-              return HandleWebPlugin();
-
-            case COMMANDLINE_MODE_CODE_RED_CHECK:
-              return HandleCodeRedCheck();
-
-            case COMMANDLINE_MODE_NETDIAGS:
-              return NetDiags().Main();
-
-            case COMMANDLINE_MODE_REGISTER_PRODUCT:
-              // TODO(omaha3): Eliminate the need for this mode.
-              return E_FAIL;
-
-            case COMMANDLINE_MODE_INSTALL:
-              return DoInstall(has_ui_been_displayed);
-
-            case COMMANDLINE_MODE_UPDATE:
-              return DoSelfUpdate();
-
-            case COMMANDLINE_MODE_RECOVER:
-              return DoRecover();
-
-            case COMMANDLINE_MODE_HANDOFF_INSTALL:
-              return DoHandoff(has_ui_been_displayed);
-
-            case COMMANDLINE_MODE_UA:
-              return DoUpdateAllApps(has_ui_been_displayed);
-
-            case COMMANDLINE_MODE_CRASH:
-              return DoCrash();
-
-            case COMMANDLINE_MODE_REPORTCRASH:
-              return HandleReportCrash();
-
-            case COMMANDLINE_MODE_REGSERVER:
-            case COMMANDLINE_MODE_UNREGSERVER: {
-              hr = omaha::GoogleUpdate(
-                  is_machine_, omaha::GoogleUpdate::kUpdate3Mode).Main();
-              if (FAILED(hr)) {
-                return hr;
-              }
-              hr = omaha::GoogleUpdate(
-                  is_machine_, omaha::GoogleUpdate::kBrokerMode).Main();
-              if (FAILED(hr)) {
-                return hr;
-              }
-              return omaha::GoogleUpdate(
-                  is_machine_, omaha::GoogleUpdate::kOnDemandMode).Main();
-            }
-
-            case COMMANDLINE_MODE_COMSERVER:
-              return omaha::GoogleUpdate(
-                  is_machine_, omaha::GoogleUpdate::kUpdate3Mode).Main();
-
-            case COMMANDLINE_MODE_UNINSTALL:
-              return HandleUninstall();
-
-            case COMMANDLINE_MODE_PING:
-              return HandlePing();
-
-            default:
-              // We have a COMMANDLINE_MODE_ that isn't being handled.
-              ASSERT1(false);
-              OPT_LOG(LE, (_T("[Command line has unhandled mode]")));
-              return E_UNEXPECTED;
-          }
-        }
-      }
-    }
-  }
-#pragma warning(pop)
-}
-
-bool GoopdateImpl::IsMachineProcess() {
-  Tristate needs_admin(TRISTATE_NONE);
-  if (!args_.extra.apps.empty()) {
-    needs_admin = args_.extra.apps[0].needs_admin != NEEDS_ADMIN_NO ?
-        TRISTATE_TRUE : TRISTATE_FALSE;
-  }
-
-  return internal::IsMachineProcess(
-      args_.mode,
-      goopdate_utils::IsRunningFromOfficialGoopdateDir(true),
-      is_local_system_,
-      args_.is_machine_set,
-      needs_admin);
-}
-
-
-HRESULT GoopdateImpl::HandleReportCrash() {
-  ++metric_goopdate_handle_report_crash;
-  VERIFY1(SUCCEEDED(AggregateMetrics(is_machine_)));
-
-  // Catch exceptions to avoid reporting crashes when handling a crash.
-  // TODO(omaha): maybe let Windows handle the crashes when reporting crashes
-  // in certain interactive modes.
-  HRESULT hr = S_OK;
-  __try {
-    // Crashes are uploaded always in the out-of-process case.
-    //
-    // Google Update internal crashes are handled in-process. They are uploaded
-    // only for the users that have opted in sending usage stats and when
-    // network use is allowed, and from systems that are not development
-    // nor test.
-    // This default behavior can be overriden by an UpdatedDev parameter that
-    // allows crashes to be uploaded always.
-    //
-    // All GoogleUpdate crashes are logged in the Windows event log for
-    // applications, unless the logging is disabled by the administrator.
-    ConfigManager* cm = ConfigManager::Instance();
-    const bool can_upload_in_process = cm->AlwaysAllowCrashUploads() ||
-        (cm->CanCollectStats(is_machine_) &&
-         cm->CanUseNetwork(is_machine_)   &&
-         !goopdate_utils::IsTestSource());
-    hr = Crash::Report(can_upload_in_process,
-                       args_.crash_filename,
-                       args_.custom_info_filename,
-                       user_default_language_id_);
-  }
-  __except(EXCEPTION_EXECUTE_HANDLER) {
-    hr = E_FAIL;
-  }
-  return hr;
-}
-
-bool GoopdateImpl::ShouldCheckShutdownEvent(CommandLineMode mode) {
-  switch (mode) {
-    // Modes that may run before or during installation or otherwise do not
-    // need to listen to shutdown.
-    case COMMANDLINE_MODE_UNKNOWN:
-    case COMMANDLINE_MODE_NOARGS:
-    case COMMANDLINE_MODE_REGSERVER:
-    case COMMANDLINE_MODE_UNREGSERVER:
-    case COMMANDLINE_MODE_NETDIAGS:
-    case COMMANDLINE_MODE_CRASH:
-    case COMMANDLINE_MODE_REPORTCRASH:
-    case COMMANDLINE_MODE_RECOVER:
-    case COMMANDLINE_MODE_SERVICE_REGISTER:
-    case COMMANDLINE_MODE_SERVICE_UNREGISTER:
-
-    case COMMANDLINE_MODE_INSTALL:
-    case COMMANDLINE_MODE_UPDATE:
-    case COMMANDLINE_MODE_WEBPLUGIN:
-    case COMMANDLINE_MODE_CODE_RED_CHECK:
-    case COMMANDLINE_MODE_REGISTER_PRODUCT:
-    case COMMANDLINE_MODE_UNREGISTER_PRODUCT:
-    case COMMANDLINE_MODE_PING:
-      return false;
-
-    // Modes that should honor shutdown.
-    case COMMANDLINE_MODE_CORE:
-    case COMMANDLINE_MODE_SERVICE:
-    case COMMANDLINE_MODE_COMSERVER:
-    case COMMANDLINE_MODE_CRASH_HANDLER:
-    case COMMANDLINE_MODE_COMBROKER:
-    case COMMANDLINE_MODE_ONDEMAND:
-    case COMMANDLINE_MODE_MEDIUM_SERVICE:
-
-    case COMMANDLINE_MODE_HANDOFF_INSTALL:
-    case COMMANDLINE_MODE_UA:
-    case COMMANDLINE_MODE_UNINSTALL:
-      return true;
-
-    default:
-      ASSERT1(false);
-      return true;
-  }
-}
-
-bool GoopdateImpl::IsShutdownEventSet() {
-  NamedObjectAttributes attr;
-  GetNamedObjectAttributes(kShutdownEvent, is_machine_, &attr);
-  scoped_event shutdown_event(::OpenEvent(SYNCHRONIZE, false, attr.name));
-  if (!shutdown_event) {
-    return false;
-  }
-
-  return WAIT_OBJECT_0 == ::WaitForSingleObject(get(shutdown_event), 0);
-}
-
-// The resource dll is loaded only in the following cases:
-// 1. Initial setup: /install
-// 2. Handoff install: /handoff
-// 3. App update worker: /ua
-// 4. Various registrations.
-// 5. Modes where an error message needs to be displayed.
-HRESULT GoopdateImpl::LoadResourceDllIfNecessary(CommandLineMode mode,
-                                                 const CString& resource_dir) {
-  switch (mode) {
-    case COMMANDLINE_MODE_UNKNOWN:             // Displays an error using UI.
-    case COMMANDLINE_MODE_NOARGS:              // Displays an error using UI.
-    case COMMANDLINE_MODE_INSTALL:             // Has UI on errors.
-    case COMMANDLINE_MODE_UPDATE:              // Task and Service descriptions.
-    case COMMANDLINE_MODE_RECOVER:             // Writes strings to registry.
-    case COMMANDLINE_MODE_HANDOFF_INSTALL:     // Has optional UI.
-    case COMMANDLINE_MODE_UA:                  // Has optional UI.
-    case COMMANDLINE_MODE_COMSERVER:           // Returns strings to caller.
-    case COMMANDLINE_MODE_SERVICE:             // Returns strings to caller.
-    case COMMANDLINE_MODE_MEDIUM_SERVICE:      // TODO(omaha): Check & explain.
-    case COMMANDLINE_MODE_SERVICE_REGISTER:    // Requires the RGS resources.
-    case COMMANDLINE_MODE_SERVICE_UNREGISTER:  // Requires the RGS resources.
-    case COMMANDLINE_MODE_ONDEMAND:            // Worker, etc. load strings.
-      // Load the resource DLL for these modes.
-      break;
-
-    // For the Core, the resource DLL needs to be loaded when the Core is
-    // servicing IGoogleUpdate3. The Core loads the resource DLL after the Code
-    // Red kickoff, from within core.cc.
-    case COMMANDLINE_MODE_CORE:
-    case COMMANDLINE_MODE_REGSERVER:
-    case COMMANDLINE_MODE_UNREGSERVER:
-    case COMMANDLINE_MODE_NETDIAGS:
-    case COMMANDLINE_MODE_CRASH:
-    case COMMANDLINE_MODE_REPORTCRASH:
-    case COMMANDLINE_MODE_WEBPLUGIN:
-    case COMMANDLINE_MODE_CODE_RED_CHECK:
-    case COMMANDLINE_MODE_REGISTER_PRODUCT:
-    case COMMANDLINE_MODE_UNREGISTER_PRODUCT:
-    case COMMANDLINE_MODE_CRASH_HANDLER:
-    case COMMANDLINE_MODE_COMBROKER:
-    case COMMANDLINE_MODE_UNINSTALL:
-    case COMMANDLINE_MODE_PING:
-    default:
-      // These modes do not need the resource DLL.
-      ASSERT1(!internal::CanDisplayUi(mode, false));
-      return S_OK;
-  }
-
-  // TODO(omaha3): Consider not using ResourceManager in this file.
-  HRESULT hr = ResourceManager::Create(
-      is_machine_,
-      resource_dir,
-      lang::GetLanguageForProcess(args_.extra.language));
-  if (FAILED(hr)) {
-    ASSERT(false, (_T("ResourceManager::Create failed with 0x%08x"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// Writes the information for the primary app to enable Omaha to send usage
-// stats now. It will be set for each app in the args when they are installed.
-HRESULT GoopdateImpl::SetUsageStatsEnable() {
-  if (args_.extra.apps.empty()) {
-    return S_OK;
-  }
-
-  HRESULT hr = app_registry_utils::SetUsageStatsEnable(
-      args_.extra.apps[0].needs_admin != NEEDS_ADMIN_NO,
-      GuidToString(args_.extra.apps[0].app_guid),
-      args_.extra.usage_stats_enable);
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[SetUsageStatsEnable failed][0x%08x]"), hr));
-
-    if ((HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED) == hr) &&
-        args_.extra.apps[0].needs_admin &&
-        !vista_util::IsUserAdmin()) {
-      CORE_LOG(L3, (_T("[Process does not have permission to HKLM]")));
-      return S_OK;
-    }
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT GoopdateImpl::HandleCodeRedCheck() {
-  CORE_LOG(L2, (_T("[GoopdateImpl::HandleCodeRedCheck]")));
-  ++metric_cr_process_total;
-
-  // Call the utils method instead of member method because we want to execute
-  // as little code as possible.
-  bool is_machine = internal::IsMachineProcess(args_.mode,
-                                               false,   // machine dir
-                                               is_local_system_,
-                                               args_.is_machine_set,
-                                               TRISTATE_NONE);
-  ASSERT1(IsMachineProcess() == is_machine);
-
-  if (!ConfigManager::Instance()->CanUseNetwork(is_machine)) {
-    CORE_LOG(L1,
-             (_T("[Code Red check not sent because network use prohibited]")));
-    return GOOPDATE_E_CANNOT_USE_NETWORK;
-  }
-
-  CheckForCodeRed(is_machine, this_version_);
-  return S_OK;
-}
-
-// Even though http://b/1135173 is fixed, there is still a possibility that only
-// some of the files will be copied if Setup is currently running.
-// TODO(omaha3): If we save and use the metainstaller for OneClick, that may
-// address this.
-
-// If we're called with the /webplugin command, we need to handle it and exit.
-// This is called from the browser and the command line arguments come from the
-// website so we need to be restrictive of what we let past. If everything from
-// the plugin is valid, we'll relaunch goopdate with the proper commands.
-HRESULT GoopdateImpl::HandleWebPlugin() {
-  return webplugin_utils::DoOneClickInstall(args_);
-}
-
-HRESULT GoopdateImpl::DoInstall(bool* has_ui_been_displayed) {
-  OPT_LOG(L1, (_T("[GoopdateImpl::DoInstall]")));
-  ASSERT1(has_ui_been_displayed);
-
-  // Some /install command lines, such as /silent /install will not necessarily
-  // have an install source. To differentiate these from other sources, such as
-  // other clients using the COM API, specify a generic source for /install.
-  // TODO(omaha3): Updating two types of command line/args is undesirable, and
-  // this does not use CommandLineBuilder. This could be addressed in several
-  // ways. See the TODO above install.cc::LaunchHandoffProcess().
-  ASSERT1(args_.mode == COMMANDLINE_MODE_INSTALL);
-  CString install_command_line = cmd_line_;
-  CommandLineArgs install_args = args_;
-  if (args_.install_source.IsEmpty()) {
-    ASSERT1(-1 == cmd_line_.Find(kCmdLineInstallSource));
-    SafeCStringAppendFormat(&install_command_line, _T(" /%s %s"),
-                            kCmdLineInstallSource,
-                            kCmdLineInstallSource_InstallDefault);
-    install_args.install_source = kCmdLineInstallSource_InstallDefault;
-  }
-
-  HRESULT hr = S_OK;
-  if (args_.is_oem_set) {
-    hr = OemInstall(!args_.is_silent_set,       // is_interactive
-                    !args_.extra.runtime_only,  // is_app_install
-                    args_.is_eula_required_set,
-                    args_.is_install_elevated,
-                    install_command_line,
-                    install_args,
-                    &is_machine_,
-                    has_ui_been_displayed);
-  } else {
-    hr = Install(!args_.is_silent_set,          // is_interactive
-                 !args_.extra.runtime_only,     // is_app_install
-                 args_.is_eula_required_set,
-                 false,
-                 args_.is_install_elevated,
-                 install_command_line,
-                 install_args,
-                 &is_machine_,
-                 has_ui_been_displayed);
-  }
-
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Install failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT GoopdateImpl::DoSelfUpdate() {
-  OPT_LOG(L1, (_T("[GoopdateImpl::DoSelfUpdate]")));
-
-  HRESULT hr = install_self::UpdateSelf(is_machine_, args_.session_id);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[UpdateSelf failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// Attempts to launch the repair file elevated using the MSP. If elevation is
-// not needed or fails, attempts to install without elevating.
-// The code_red_metainstaller_path arg is the repair file.
-HRESULT GoopdateImpl::DoRecover() {
-  OPT_LOG(L1, (_T("[GoopdateImpl::DoRecover()]")));
-
-// TODO(omaha3): Enable. Maybe build without the builder.
-#if 0
-  CommandLineBuilder builder(COMMANDLINE_MODE_UPDATE);
-
-  HRESULT hr = S_OK;
-  if (LaunchRepairFileElevated(is_machine_,
-                               args_.code_red_metainstaller_path,
-                               builder.GetCommandLineArgs(),
-                               &hr)) {
-    ASSERT1(SUCCEEDED(hr));
-    return S_OK;
-  }
-#else
-  HRESULT hr = S_OK;
-#endif
-
-  if (FAILED(hr)) {
-    OPT_LOG(LW, (_T("[LaunchRepairFileElevated failed][0x%08x]"), hr));
-  }
-
-  hr = install_self::Repair(is_machine_);
-  if (FAILED(hr)) {
-    OPT_LOG(LE, (_T("[Non-elevated repair failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// Clears the EULA flag in the handoff instance in case an older installer that
-// does not know about the EULA flag is used to launch the install.
-// Failing to clear flag fails installation because this would prevent updates.
-HRESULT GoopdateImpl::DoHandoff(bool* has_ui_been_displayed) {
-  OPT_LOG(L1, (_T("[GoopdateImpl::DoHandoff]")));
-  ASSERT1(has_ui_been_displayed);
-
-  if (!args_.is_eula_required_set) {
-    HRESULT hr = install_self::SetEulaAccepted(is_machine_);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[install_self::SetEulaAccepted failed][0x%08x]"), hr));
-      return hr;
-    }
-  }
-
-  HRESULT hr = InitializeClientSecurity();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // If /sessionid wasn't specified on the command line, generate a random GUID
-  // to use for the session ID.  (This can happen if a metainstaller from the
-  // prior version does a handoff to a newer version.)
-  CString session_id = args_.session_id;
-  if (session_id.IsEmpty()) {
-    VERIFY1(SUCCEEDED(GetGuid(&session_id)));
-  }
-
-  hr = InstallApps(is_machine_,
-                   !args_.is_silent_set,  // is_interactive.
-                   !args_.is_eula_required_set,  // is_eula_accepted.
-                   args_.is_oem_set,
-                   args_.is_offline_set,
-                   args_.offline_dir,
-                   args_.extra,
-                   args_.install_source,
-                   session_id,
-                   has_ui_been_displayed);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Install failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT GoopdateImpl::DoUpdateAllApps(bool* has_ui_been_displayed ) {
-  OPT_LOG(L1, (_T("[GoopdateImpl::DoUpdateAllApps]")));
-  ASSERT1(has_ui_been_displayed);
-
-  bool is_interactive_update = !args_.is_silent_set;
-
-  // TODO(omaha3): Interactive is used as an indication of an on-demand request.
-  // It might also be useful to allow on-demand silent update requests.
-  // This was a request when we added the ability to disable updates.
-  // TODO(omaha3): These on-demand requests should also allow updates if the
-  // app update policy is set to on-demand in addition to silent auto.
-  const bool is_on_demand = is_interactive_update;
-
-  CString install_source = args_.install_source;
-
-  if (is_on_demand && install_source.IsEmpty()) {
-    // Set an install source for interactive/on-demand update all apps.
-    install_source = kCmdLineInstallSource_OnDemandUA;
-  }
-
-  // TODO(omaha): Consider moving InitializeClientSecurity calls inside
-  // install_apps.cc or maybe to update3_utils::CreateGoogleUpdate3Class().
-  HRESULT hr = InitializeClientSecurity();
-  if (FAILED(hr)) {
-    ASSERT1(false);
-    return is_interactive_update ? hr : S_OK;
-  }
-
-  hr = UpdateApps(is_machine_,
-                  is_interactive_update,
-                  is_on_demand,
-                  install_source,
-                  args_.extra.language,
-                  has_ui_been_displayed);
-  OPT_LOG(L2, (_T("[Update all apps process finished][0x%x]"), hr));
-
-  // The UA worker always returns S_OK. UA can be launched by the scheduled task
-  // or the core, neither of which wait for a return code. On Vista, returning
-  // an error code from the scheduled task reportedly causes issues with the
-  // task scheduler in rare cases, so returning S_OK helps with that as well.
-  // However, in interactive cases, we should return the actual error so that it
-  // can be reported to the user if necessary.
-  return is_interactive_update ? hr : S_OK;
-}
-
-HRESULT GoopdateImpl::DoCrash() {
-#if DEBUG
-  return static_cast<HRESULT>(Crash::CrashNow());
-#else
-  return S_OK;
-#endif
-}
-
-HRESULT GoopdateImpl::HandleUninstall() {
-  // TODO(omaha3): Why don't we always acquire this lock before uninstalling?
-  // We don't in the /install case. I guess it's important that we uninstall
-  // the first time in that case, but there's a chance that the case in the
-  // referenced bug could occur while a user is installing.
-
-  // Attempt a conditional uninstall and always return S_OK to avoid
-  // executing error handling code in the case of an actual uninstall.
-  // Do not attempt to uninstall if MSI is busy to avoid spurious uninstalls.
-  // See http://b/1436223. The call to WaitForMSIExecute blocks with a
-  // timeout. It is better to block here than block while holding the setup
-  // lock.
-  HRESULT hr = WaitForMSIExecute(kWaitForMSIExecuteMs);
-  CORE_LOG(L2, (_T("[WaitForMSIExecute returned 0x%08x]"), hr));
-  if (SUCCEEDED(hr)) {
-    MaybeUninstallGoogleUpdate();
-  }
-  return S_OK;
-}
-
-HRESULT GoopdateImpl::HandlePing() {
-  return Ping::HandlePing(is_machine_, args_.ping_string);
-}
-
-// TODO(omaha3): In Omaha 2, this was also called when /ig failed. There is a
-// separate call to UninstallSelf for /install in goopdate.cc. Should we call
-// this instead to ensure we ping? Should we try to only call from one location?
-// If we move it, make sure it is called regardless of LastChecked. See
-// http://b/2663423.
-
-// Uninstall is a tricky use case. Uninstall can primarily happen in three cases
-// and there are two mechanisms to uninstall. The cases in which Omaha
-// uninstalls are:
-// 1. The last registered application uninstalls. If Omaha is long-running,
-// Omaha monitors the Client keys and it will trigger an immediate uninstall in
-// this case.
-// 2. The core starts an update worker, if there are no registered
-// applications, the update worker will do the uninstall.
-// 3. An error, including user cancel, happens during Omaha or app installation
-// and there are no registered applications.
-// The uninstall is implemented in terms of the following mechanisms:
-// * An update worker launched with "/ua /uninstalled" by the core, in the
-// first two cases above.
-// * A direct uninstall, in the case of errors or user cancellations, in the
-// last case above.
-//
-// Omaha can uninstall only if there are no install workers running and no
-// registered applications. This check is done under the setup lock protection.
-// In addition, the uninstall worker takes the update worker lock. Acquiring
-// this lock is important since the silent installers can modify the
-// registration of apps and trigger uninstalls workers. Therefore, both
-// setup lock and the update worker locks are needed.
-//
-// In the direct uninstall case there is a small race condition, since there is
-// no other single lock that can be acquired to prevent changes to the
-// application registration. The code looks for install workers but the test is
-// racy if not protected by locks.
-void GoopdateImpl::MaybeUninstallGoogleUpdate() {
-  CORE_LOG(L1, (_T("[MaybeUninstallGoogleUpdate]")));
-  has_uninstalled_ =
-      !!SUCCEEDED(install_self::UninstallSelf(is_machine_, true));
-}
-
-// In dbg builds, also checks the post conditions of a /install process to
-// ensure that the registry is correctly populated or has been cleaned up.
-HRESULT GoopdateImpl::UninstallIfNecessary() {
-  ASSERT1(COMMANDLINE_MODE_INSTALL == args_.mode);
-  ASSERT(!has_uninstalled_, (_T("Worker doesn't uninstall in /install mode")));
-
-  if (is_machine_ && !vista_util::IsUserAdmin()) {
-    // The non-elevated instance, so do not try to uninstall.
-    return S_OK;
-  } else {
-    CORE_LOG(L2, (_T("[GoopdateImpl::Main /install][Uninstall if necessary]")));
-    // COM must be initialized in order to uninstall the scheduled task(s).
-    scoped_co_init init_com_apt(COINIT_MULTITHREADED);
-    return install_self::UninstallSelf(is_machine_, false);
-  }
-}
-
-void GoopdateImpl::OutOfMemoryHandler() {
-  ::RaiseException(EXCEPTION_ACCESS_VIOLATION,
-                   EXCEPTION_NONCONTINUABLE,
-                   0,
-                   NULL);
-}
-
-HRESULT GoopdateImpl::CaptureOSMetrics() {
-  int major_version(0);
-  int minor_version(0);
-  int service_pack_major(0);
-  int service_pack_minor(0);
-  TCHAR name[MAX_PATH] = {0};
-
-  HRESULT hr = SystemInfo::GetSystemVersion(&major_version,
-                                            &minor_version,
-                                            &service_pack_major,
-                                            &service_pack_minor,
-                                            name,
-                                            arraysize(name));
-  if (SUCCEEDED(hr)) {
-    metric_windows_major_version    = major_version;
-    metric_windows_minor_version    = minor_version;
-    metric_windows_sp_major_version = service_pack_major;
-    metric_windows_sp_minor_version = service_pack_minor;
-  }
-
-  return hr;
-}
-
-}  // namespace detail
-
-namespace internal {
-
-// TODO(omaha3): Consider moving to app_registry_utils.
-// Returns early if Google Update's EULA is already accepted, as indicated by
-// the lack of eulaaccepted in the Update key.
-// The apps' values are not modified or deleted.
-HRESULT PromoteAppEulaAccepted(bool is_machine) {
-  const TCHAR* update_key_name =
-      ConfigManager::Instance()->registry_update(is_machine);
-  if (!RegKey::HasValue(update_key_name, kRegValueOmahaEulaAccepted)) {
-    return S_OK;
-  }
-
-  const TCHAR* state_key_name =
-      ConfigManager::Instance()->registry_client_state(is_machine);
-
-  RegKey state_key;
-  HRESULT hr = state_key.Open(state_key_name, KEY_READ);
-  if (FAILED(hr)) {
-    if (HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) == hr) {
-      return S_FALSE;
-    }
-    return hr;
-  }
-
-  // TODO(omaha): This should actually be iterating over registered products
-  // rather than present ClientState keys. These are identical in most cases.
-  int num_sub_keys = state_key.GetSubkeyCount();
-  for (int i = 0; i < num_sub_keys; ++i) {
-    CString sub_key_name;
-    if (FAILED(state_key.GetSubkeyNameAt(i, &sub_key_name))) {
-      continue;
-    }
-
-    if (app_registry_utils::IsAppEulaAccepted(is_machine, sub_key_name, true)) {
-      ASSERT1(kGoogleUpdateAppId != sub_key_name);
-      return install_self::SetEulaAccepted(is_machine);
-    }
-  }
-
-  return S_OK;
-}
-
-// TODO(omaha): Use a registry override instead.
-#if !OFFICIAL_BUILD
-bool IsOmahaShellRunningFromStaging() {
-  return !app_util::GetModuleName(NULL).CompareNoCase(kOmahaShellFileName) &&
-         app_util::GetModuleDirectory(NULL).Right(_tcslen(_T("staging"))) ==
-         _T("staging");
-}
-#endif
-
-// TODO(omaha): needs_admin is only used for one case. Can we avoid it?
-bool IsMachineProcess(CommandLineMode mode,
-                      bool is_running_from_official_machine_directory,
-                      bool is_local_system,
-                      bool is_machine_override,
-                      Tristate needs_admin) {
-  switch (mode) {
-    // These "install" operations may not be running from the installed
-    // location.
-    case COMMANDLINE_MODE_INSTALL:
-    case COMMANDLINE_MODE_HANDOFF_INSTALL:
-    case COMMANDLINE_MODE_REGISTER_PRODUCT:
-    case COMMANDLINE_MODE_UNREGISTER_PRODUCT:
-      ASSERT1(TRISTATE_NONE != needs_admin);
-      return TRISTATE_TRUE == needs_admin;
-
-    // The following is a Code Red repair executable, which runs from temp dir.
-    case COMMANDLINE_MODE_RECOVER:
-      return is_machine_override;
-
-    // The following always runs as the user and may provide UI for on-demand
-    // installs and browser launches.
-    // The install location determines user vs. machine.
-    case COMMANDLINE_MODE_COMSERVER:
-    case COMMANDLINE_MODE_ONDEMAND:
-#if !OFFICIAL_BUILD
-      // Return machine == true. This is to facilitate unit tests such as
-      // GoogleUpdateCoreTest.LaunchCmdElevated_LocalServerRegistered.
-      if (IsOmahaShellRunningFromStaging()) {
-        return true;
-      }
-#endif
-
-      ASSERT1(goopdate_utils::IsRunningFromOfficialGoopdateDir(false) ||
-              goopdate_utils::IsRunningFromOfficialGoopdateDir(true) ||
-              _T("omaha_unittest.exe") == app_util::GetCurrentModuleName() ||
-              _T("GoogleUpdate_unsigned.exe") ==
-                  app_util::GetModuleName(NULL));  // Running in debugger.
-      return is_running_from_official_machine_directory;
-
-    // The broker forwarder is elevatable and always runs as the user it was
-    // created as.
-    case COMMANDLINE_MODE_COMBROKER:
-      return is_running_from_official_machine_directory;
-
-    // The following always runs as the user and is user-initiated.
-    case COMMANDLINE_MODE_WEBPLUGIN:
-      // The install location determines user vs. machine.
-      // This may not be the desired value when doing a cross-install or using
-      // the opposite plugin (i.e. user plugin is often used before the machine
-      // one).
-      ASSERT1(goopdate_utils::IsRunningFromOfficialGoopdateDir(false) ||
-              goopdate_utils::IsRunningFromOfficialGoopdateDir(true) ||
-              _T("omaha_unittest.exe") == app_util::GetCurrentModuleName());
-      return is_running_from_official_machine_directory;
-
-    // The following all run silently as the user for user installs or Local
-    // System for machine installs.
-    case COMMANDLINE_MODE_UPDATE:
-    case COMMANDLINE_MODE_CODE_RED_CHECK:
-      return is_local_system;
-
-    // The following all run silently as the user for user installs or Local
-    // System for machine installs.
-    case COMMANDLINE_MODE_UA:
-      return is_local_system ? true : is_machine_override;
-
-    // /ua runs silently as the user for user installs or Local System for
-    // machine installs. Interactive machine /ua may be run as the user if
-    // /machine is specified.
-    case COMMANDLINE_MODE_CORE:
-    case COMMANDLINE_MODE_CRASH_HANDLER:
-      return is_local_system;
-
-    // The following runs silently as Local System.
-    case COMMANDLINE_MODE_SERVICE:
-    case COMMANDLINE_MODE_MEDIUM_SERVICE:
-      ASSERT1(is_local_system);
-      return is_local_system;
-
-    // The following run as machine for all installs.
-    case COMMANDLINE_MODE_SERVICE_REGISTER:
-    case COMMANDLINE_MODE_SERVICE_UNREGISTER:
-      return true;
-
-    // The crashing process determines whether it was a machine or user omaha
-    // and correctly sets the /machine switch.
-    case COMMANDLINE_MODE_REPORTCRASH:
-      return is_machine_override;
-
-    // The following all run silently as the user for all installs.
-    case COMMANDLINE_MODE_REGSERVER:
-    case COMMANDLINE_MODE_UNREGSERVER:
-#if !OFFICIAL_BUILD
-      // Return machine == true. This is to facilitate unit tests such as
-      // GoogleUpdateCoreTest.LaunchCmdElevated_LocalServerRegistered.
-      if (IsOmahaShellRunningFromStaging()) {
-        return true;
-      }
-#endif
-
-      ASSERT1(goopdate_utils::IsRunningFromOfficialGoopdateDir(false) ||
-              goopdate_utils::IsRunningFromOfficialGoopdateDir(true) ||
-              _T("omaha_unittest.exe") == app_util::GetCurrentModuleName());
-      return is_running_from_official_machine_directory;
-
-    // The following may run as user or Local System. Thus, use the directory.
-    case COMMANDLINE_MODE_UNINSTALL:
-    case COMMANDLINE_MODE_PING:
-      ASSERT1(goopdate_utils::IsRunningFromOfficialGoopdateDir(false) ||
-              goopdate_utils::IsRunningFromOfficialGoopdateDir(true) ||
-              _T("omaha_unittest.exe") == app_util::GetCurrentModuleName());
-      return is_running_from_official_machine_directory;
-
-    // The following are miscellaneous modes that we do not expect to be running
-    // in the wild.
-    case COMMANDLINE_MODE_NOARGS:
-    case COMMANDLINE_MODE_UNKNOWN:
-    case COMMANDLINE_MODE_NETDIAGS:
-    case COMMANDLINE_MODE_CRASH:
-    default:
-      return is_running_from_official_machine_directory;
-  }
-}
-
-bool CanDisplayUi(CommandLineMode mode, bool is_silent) {
-  switch (mode) {
-    case COMMANDLINE_MODE_UNKNOWN:
-      // This mode is not one of our known silent modes. Therefore, we can
-      // display an error UI.
-      return true;
-
-    case COMMANDLINE_MODE_INSTALL:
-    case COMMANDLINE_MODE_HANDOFF_INSTALL:
-    case COMMANDLINE_MODE_UA:
-      // These modes have UI unless they are silent.
-      // UA is usually silent, but follows the same logic.
-      return !is_silent;
-
-    case COMMANDLINE_MODE_NOARGS:
-    case COMMANDLINE_MODE_CORE:
-    case COMMANDLINE_MODE_SERVICE:
-    case COMMANDLINE_MODE_REGSERVER:
-    case COMMANDLINE_MODE_UNREGSERVER:
-    case COMMANDLINE_MODE_NETDIAGS:
-    case COMMANDLINE_MODE_CRASH:
-    case COMMANDLINE_MODE_REPORTCRASH:
-    case COMMANDLINE_MODE_UPDATE:
-    case COMMANDLINE_MODE_RECOVER:
-    case COMMANDLINE_MODE_WEBPLUGIN:
-    case COMMANDLINE_MODE_CODE_RED_CHECK:
-    case COMMANDLINE_MODE_COMSERVER:
-    case COMMANDLINE_MODE_REGISTER_PRODUCT:
-    case COMMANDLINE_MODE_UNREGISTER_PRODUCT:
-    case COMMANDLINE_MODE_SERVICE_REGISTER:
-    case COMMANDLINE_MODE_SERVICE_UNREGISTER:
-    case COMMANDLINE_MODE_CRASH_HANDLER:
-    case COMMANDLINE_MODE_COMBROKER:
-    case COMMANDLINE_MODE_ONDEMAND:
-    case COMMANDLINE_MODE_MEDIUM_SERVICE:
-    case COMMANDLINE_MODE_UNINSTALL:
-    case COMMANDLINE_MODE_PING:
-    default:
-      // These modes are always silent.
-      return false;
-  }
-}
-
-}  // namespace internal
-
-Goopdate* Goopdate::instance_              = NULL;
-
-Goopdate& Goopdate::Instance() {
-  ASSERT1(instance_);
-  return *instance_;
-}
-
-Goopdate::Goopdate(bool is_local_system) {
-  CORE_LOG(L2, (_T("[Goopdate::Goopdate]")));
-  impl_.reset(new detail::GoopdateImpl(this, is_local_system));
-
-  ASSERT1(!instance_);
-  instance_ = this;
-}
-
-Goopdate::~Goopdate() {
-  CORE_LOG(L2, (_T("[Goopdate::~Goopdate]")));
-
-  Stop();
-
-  instance_ = NULL;
-}
-
-HRESULT Goopdate::Main(HINSTANCE instance,
-                       const TCHAR* cmd_line,
-                       int cmd_show) {
-  return impl_->Main(instance, cmd_line, cmd_show);
-}
-
-HRESULT Goopdate::QueueUserWorkItem(UserWorkItem* work_item, uint32 flags) {
-  return impl_->QueueUserWorkItem(work_item, flags);
-}
-
-void Goopdate::Stop() {
-  return impl_->Stop();
-}
-
-bool Goopdate::is_local_system() const {
-  return impl_->is_local_system();
-}
-
-}  // namespace omaha
diff --git a/goopdate/goopdate.def b/goopdate/goopdate.def
deleted file mode 100644
index 25f7cbb..0000000
--- a/goopdate/goopdate.def
+++ /dev/null
@@ -1,19 +0,0 @@
-; Copyright 2009 Google Inc.
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-;      http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-; ========================================================================
-
-
-EXPORTS
-  DllEntry            PRIVATE
-
diff --git a/goopdate/goopdate.h b/goopdate/goopdate.h
deleted file mode 100644
index 30b692b..0000000
--- a/goopdate/goopdate.h
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#ifndef OMAHA_GOOPDATE_GOOPDATE_H__
-#define OMAHA_GOOPDATE_GOOPDATE_H__
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/thread_pool.h"
-
-namespace omaha {
-
-namespace detail {
-
-class GoopdateImpl;
-
-}  // namespace detail
-
-struct CommandLineArgs;
-class ConfigManager;
-class ResourceManager;
-
-class Goopdate {
- public:
-  explicit Goopdate(bool is_local_system);
-  ~Goopdate();
-
-  // Gets the singleton instance of the class.
-  static Goopdate& Instance();
-
-  // Runs the entry point for the application.
-  HRESULT Main(HINSTANCE instance, const TCHAR* cmd_line, int cmd_show);
-
-  HRESULT QueueUserWorkItem(UserWorkItem* work_item, uint32 flags);
-
-  void Stop();
-
-  bool is_local_system() const;
-  CommandLineArgs args() const;
-
- private:
-  static Goopdate* instance_;
-
-  // Uses pimpl idiom to minimize dependencies on implementation details.
-  scoped_ptr<detail::GoopdateImpl> impl_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(Goopdate);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_GOOPDATE_H__
-
diff --git a/goopdate/goopdate.rc b/goopdate/goopdate.rc
deleted file mode 100644
index 1ede05b..0000000
--- a/goopdate/goopdate.rc
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// TODO(omaha3): Figure out what category of resources this file includes and
-// rename it and non_localized_resource.h. Is it DLL resources?
-
-#include <afxres.h>
-#include "omaha/goopdate/non_localized_resource.h"
-
-LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT
-IDI_ELEVATION_MONIKER_ICON        ICON "omaha/google_update/google_update.ico"
-
-IDR_LOCAL_SERVER_RGS              REGISTRY "omaha/base/generic_reg_file_local_server.rgs"
-IDR_LOCAL_SERVER_ELEVATION_RGS    REGISTRY "omaha/base/generic_reg_file_elevation_localserver.rgs"
-IDR_LOCAL_SERVER_IE_LOW_RGS       REGISTRY "omaha/base/generic_reg_file_ie_low_local_server.rgs"
-IDR_LOCAL_SERVICE_RGS             REGISTRY "omaha/base/generic_reg_file_localservice.rgs"
-
-IDR_GOOGLE_UPDATE3_SERVICE_APPID  REGISTRY "omaha/base/generic_reg_file_appid.rgs"
-
-1 TYPELIB "goopdate\\omaha3_idl.tlb"
diff --git a/goopdate/goopdate_internal.h b/goopdate/goopdate_internal.h
deleted file mode 100644
index 69d18c7..0000000
--- a/goopdate/goopdate_internal.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_GOOPDATE_INTERNAL_H_
-#define OMAHA_GOOPDATE_GOOPDATE_INTERNAL_H_
-
-#include <windows.h>
-#include "omaha/base/constants.h"
-#include "omaha/common/command_line.h"
-
-namespace omaha {
-
-namespace internal {
-
-// Marks Google Update's EULA as accepted if an app EULA has been accepted.
-HRESULT PromoteAppEulaAccepted(bool is_machine);
-
-// Returns whether a process is a machine process.
-// Does not determine whether the process has the appropriate privileges.
-bool IsMachineProcess(
-    CommandLineMode mode,
-    bool is_running_from_official_machine_directory,
-    bool is_local_system,  // Whether process is running as local system.
-    bool is_machine_override,  // True if machine cmd line override specified.
-    Tristate needs_admin);  // needsadmin value for primary app if present.
-
-// Returns whether UI can be displayed.
-bool CanDisplayUi(CommandLineMode mode, bool is_silent);
-
-}  // namespace internal
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_GOOPDATE_INTERNAL_H_
-
diff --git a/goopdate/goopdate_metrics.cc b/goopdate/goopdate_metrics.cc
deleted file mode 100644
index 679f443..0000000
--- a/goopdate/goopdate_metrics.cc
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/goopdate_metrics.h"
-
-namespace omaha {
-
-DEFINE_METRIC_integer(windows_major_version);
-DEFINE_METRIC_integer(windows_minor_version);
-DEFINE_METRIC_integer(windows_sp_major_version);
-DEFINE_METRIC_integer(windows_sp_minor_version);
-
-DEFINE_METRIC_count(crashes_total);
-DEFINE_METRIC_count(crashes_uploaded);
-DEFINE_METRIC_count(crashes_throttled);
-DEFINE_METRIC_count(crashes_rejected);
-DEFINE_METRIC_count(crashes_failed);
-
-DEFINE_METRIC_count(oop_crashes_requested);
-DEFINE_METRIC_count(oop_crashes_total);
-DEFINE_METRIC_count(oop_crashes_uploaded);
-DEFINE_METRIC_count(oop_crashes_throttled);
-DEFINE_METRIC_count(oop_crashes_rejected);
-DEFINE_METRIC_count(oop_crashes_failed);
-DEFINE_METRIC_count(oop_crashes_crash_filename_empty);
-DEFINE_METRIC_count(oop_crashes_createcustominfofile_failed);
-DEFINE_METRIC_count(oop_crashes_startsenderwithcommandline_failed);
-DEFINE_METRIC_count(oop_crash_start_sender);
-
-DEFINE_METRIC_count(goopdate_handle_report_crash);
-
-DEFINE_METRIC_count(crash_start_server_total);
-DEFINE_METRIC_count(crash_start_server_succeeded);
-
-DEFINE_METRIC_count(cr_process_total);
-DEFINE_METRIC_count(cr_callback_total);
-DEFINE_METRIC_count(cr_callback_status_200);
-DEFINE_METRIC_count(cr_callback_status_204);
-DEFINE_METRIC_count(cr_callback_status_other);
-
-DEFINE_METRIC_count(load_resource_dll_failed);
-
-DEFINE_METRIC_count(goopdate_constructor);
-DEFINE_METRIC_count(goopdate_destructor);
-DEFINE_METRIC_count(goopdate_main);
-
-}  // namespace omaha
diff --git a/goopdate/goopdate_metrics.h b/goopdate/goopdate_metrics.h
deleted file mode 100644
index 2b7dfdf..0000000
--- a/goopdate/goopdate_metrics.h
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Declares the usage metrics used by goopdate module.
-
-#ifndef OMAHA_GOOPDATE_GOOPDATE_METRICS_H_
-#define OMAHA_GOOPDATE_GOOPDATE_METRICS_H_
-
-#include "omaha/statsreport/metrics.h"
-
-namespace omaha {
-
-DECLARE_METRIC_integer(windows_major_version);
-DECLARE_METRIC_integer(windows_minor_version);
-DECLARE_METRIC_integer(windows_sp_major_version);
-DECLARE_METRIC_integer(windows_sp_minor_version);
-
-// Crash metrics.
-//
-// A crash can be handled in one of the following ways: uploaded, rejected by
-// the server, rejected by the client due to metering, or failed for other
-// reasons, such as the sender could not communicate with the crash server.
-
-// In process crash reporting metrics.
-DECLARE_METRIC_count(crashes_total);
-DECLARE_METRIC_count(crashes_uploaded);
-DECLARE_METRIC_count(crashes_throttled);
-DECLARE_METRIC_count(crashes_rejected);
-DECLARE_METRIC_count(crashes_failed);
-
-// Out of process crash reporting metrics.
-// The number of crashes requested by the applications should be close to the
-// total number of crashes handled by Omaha.
-DECLARE_METRIC_count(oop_crashes_requested);
-DECLARE_METRIC_count(oop_crashes_total);
-DECLARE_METRIC_count(oop_crashes_uploaded);
-DECLARE_METRIC_count(oop_crashes_throttled);
-DECLARE_METRIC_count(oop_crashes_rejected);
-DECLARE_METRIC_count(oop_crashes_failed);
-DECLARE_METRIC_count(oop_crashes_crash_filename_empty);
-DECLARE_METRIC_count(oop_crashes_createcustominfofile_failed);
-DECLARE_METRIC_count(oop_crashes_startsenderwithcommandline_failed);
-DECLARE_METRIC_count(oop_crash_start_sender);
-
-// Increments every time GoopdateImpl::HandleReportCrash is called.
-DECLARE_METRIC_count(goopdate_handle_report_crash);
-
-// How many times StartCrashServer() was called.
-DECLARE_METRIC_count(crash_start_server_total);
-// How many times StartCrashServer() succeeded.
-DECLARE_METRIC_count(crash_start_server_succeeded);
-
-// How many times the Code Red check process was launched.
-DECLARE_METRIC_count(cr_process_total);
-// How many times the Code Red download callback was called.
-DECLARE_METRIC_count(cr_callback_total);
-// How many times the Code Red download callback received 200 - OK.
-DECLARE_METRIC_count(cr_callback_status_200);
-// How many times the Code Red download callback received 204 - no content.
-DECLARE_METRIC_count(cr_callback_status_204);
-// How many times the Code Red download callback received some other status.
-// Only incremented if DownloadFile() succeeded.
-DECLARE_METRIC_count(cr_callback_status_other);
-
-// How many times GoopdateImpl::LoadResourceDll() failed to load the resource
-// DLL. Does not include modes that do not need the DLL.
-DECLARE_METRIC_count(load_resource_dll_failed);
-
-DECLARE_METRIC_count(goopdate_constructor);
-DECLARE_METRIC_count(goopdate_destructor);
-DECLARE_METRIC_count(goopdate_main);
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_GOOPDATE_METRICS_H_
diff --git a/goopdate/goopdate_unittest.cc b/goopdate/goopdate_unittest.cc
deleted file mode 100644
index 1950ab8..0000000
--- a/goopdate/goopdate_unittest.cc
+++ /dev/null
@@ -1,1002 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/constants.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/common/command_line.h"
-#include "omaha/goopdate/goopdate_internal.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-const TCHAR* const kAppMachineClientStatePath =
-    _T("HKLM\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientState\\{19BE47E4-CF32-48c1-94C4-046507F6A8A6}\\");
-const TCHAR* const kApp2MachineClientStatePath =
-    _T("HKLM\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientState\\{553B2D8C-E6A7-43ed-ACC9-A8BA5D34395F}\\");
-const TCHAR* const kAppUserClientStatePath =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientState\\{19BE47E4-CF32-48c1-94C4-046507F6A8A6}\\");
-const TCHAR* const kApp2UserClientStatePath =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientState\\{553B2D8C-E6A7-43ed-ACC9-A8BA5D34395F}\\");
-
-const TCHAR* const kAppMachineClientStateMediumPath =
-    _T("HKLM\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientStateMedium\\{19BE47E4-CF32-48c1-94C4-046507F6A8A6}\\");
-
-// Update this when new modes are added.
-const int kLastMode = COMMANDLINE_MODE_PING;
-
-}  // namespace
-
-class GoopdateRegistryProtectedTest : public testing::Test {
- protected:
-  GoopdateRegistryProtectedTest()
-      : hive_override_key_name_(kRegistryHiveOverrideRoot) {
-  }
-
-  CString hive_override_key_name_;
-
-  virtual void SetUp() {
-    RegKey::DeleteKey(hive_override_key_name_, true);
-    OverrideRegistryHives(hive_override_key_name_);
-  }
-
-  virtual void TearDown() {
-    RestoreRegistryHives();
-    ASSERT_SUCCEEDED(RegKey::DeleteKey(hive_override_key_name_, true));
-  }
-};
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_Machine_UpdateKeyDoesNotExist_NoAppKeys) {
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(true));
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_Machine_UpdateValueDoesNotExist_NoAppKeys) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(MACHINE_REG_UPDATE));
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(true));
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_Machine_UpdateValueDoesNotExist_AppKeyNoValue) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(true));
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_Machine_UpdateValueDoesNotExist_AppValueZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(true));
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_Machine_UpdateZero_NoAppKeys) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-
-  EXPECT_EQ(S_FALSE, internal::PromoteAppEulaAccepted(true));
-
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(MACHINE_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_Machine_UpdateZero_AppKeyNoValue) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(true));
-
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(MACHINE_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_Machine_UpdateZero_AppValueZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(true));
-
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(MACHINE_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-  value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(kAppMachineClientStatePath, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_Machine_UpdateZero_AppValueOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(true));
-
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(kAppMachineClientStatePath, _T("eulaaccepted"), &value));
-  EXPECT_EQ(1, value);
-}
-
-// Unfortunately, the app's ClientStateMedium key is not checked if there is no
-// corresponding ClientState key.
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_Machine_UpdateZero_OnlyMediumAppValueOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(true));
-
-  // The ClientStateMedium was not checked, so eulaaccepted = 0 still exists.
-  EXPECT_TRUE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    &value));
-  EXPECT_EQ(0, value);
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    &value));
-  EXPECT_EQ(1, value);
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_Machine_UpdateZero_MediumAppValueOneAndStateKey) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kAppMachineClientStatePath));
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(true));
-
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    &value));
-  EXPECT_EQ(1, value);
-  value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    &value));
-  EXPECT_EQ(1, value);
-}
-
-// The ClientStateMedium 1 is copied over the ClientState 0.
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_Machine_UpdateZero_AppZeroAppMediumOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(true));
-
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    &value));
-  EXPECT_EQ(1, value);
-  value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    &value));
-  EXPECT_EQ(1, value);
-}
-
-// The ClientStateMedium 0 is ignored and not copied.
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_Machine_UpdateZero_AppOneAppMediumZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(true));
-
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    &value));
-  EXPECT_EQ(1, value);
-  value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppMachineClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    &value));
-  EXPECT_EQ(0, value);
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_Machine_UpdateZero_FirstAppZeroSecondAppOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kApp2MachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(true));
-
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(kAppMachineClientStatePath, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-  value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kApp2MachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    &value));
-  EXPECT_EQ(1, value);
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_Machine_UpdateZero_FirstAppNoValueSecondAppOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kApp2MachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(true));
-
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppMachineClientStatePath, _T("eulaaccepted")));
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kApp2MachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    &value));
-  EXPECT_EQ(1, value);
-}
-
-// Asserts because this is an unexpected case.
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_Machine_UpdateZero_UpdateClientStateOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_CLIENT_STATE_GOOPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-
-  ExpectAsserts expect_asserts;
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(true));
-
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(MACHINE_REG_CLIENT_STATE_GOOPDATE,
-                                    _T("eulaaccepted"),
-                                    &value));
-  EXPECT_EQ(1, value);
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_Machine_UpdateZero_UserAppOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(true));
-
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(MACHINE_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-  value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(kAppUserClientStatePath, _T("eulaaccepted"), &value));
-  EXPECT_EQ(1, value);
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_Machine_UpdateOne_AppZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(true));
-
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(MACHINE_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(1, value);
-  value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(kAppMachineClientStatePath, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-}
-
-// The fact that the value is deleted also tells us that the method continued
-// processing because the value existed even though the value was not zero.
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_Machine_UpdateOne_AppOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(true));
-
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("eulaaccepted")));
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(kAppMachineClientStatePath, _T("eulaaccepted"), &value));
-  EXPECT_EQ(1, value);
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_User_UpdateKeyDoesNotExist_NoAppKeys) {
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(false));
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_User_UpdateValueDoesNotExist_NoAppKeys) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(USER_REG_UPDATE));
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(false));
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_User_UpdateValueDoesNotExist_AppKeyNoValue) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(false));
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_User_UpdateValueDoesNotExist_AppValueZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(false));
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, _T("eulaaccepted")));
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_User_UpdateZero_NoAppKeys) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-
-  EXPECT_EQ(S_FALSE, internal::PromoteAppEulaAccepted(false));
-
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(USER_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_User_UpdateZero_AppKeyNoValue) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(false));
-
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(USER_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStatePath, _T("eulaaccepted")));
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_User_UpdateZero_AppValueZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(false));
-
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(USER_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-  value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(kAppUserClientStatePath, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_User_UpdateZero_FirstAppZeroSecondAppOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kApp2UserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(false));
-
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, _T("eulaaccepted")));
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(kAppUserClientStatePath, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-  value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(kApp2UserClientStatePath, _T("eulaaccepted"), &value));
-  EXPECT_EQ(1, value);
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_User_UpdateZero_FirstAppNoValueSecondAppOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("pv"),
-                                    _T("1.2.3.4")));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kApp2UserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(false));
-
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, _T("eulaaccepted")));
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(kApp2UserClientStatePath, _T("eulaaccepted"), &value));
-  EXPECT_EQ(1, value);
-}
-
-// Asserts because this is an unexpected case.
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_User_UpdateZero_UpdateClientStateOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-
-  ExpectAsserts expect_asserts;
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(false));
-
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, _T("eulaaccepted")));
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                    _T("eulaaccepted"),
-                                    &value));
-  EXPECT_EQ(1, value);
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_User_UpdateOne_AppZero) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(false));
-
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(USER_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(1, value);
-  value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(kAppUserClientStatePath, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-}
-
-// The fact that the value is deleted also tells us that the method continued
-// processing because the value existed even though the value was not zero.
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_User_UpdateOne_AppOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(false));
-
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, _T("eulaaccepted")));
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(kAppUserClientStatePath, _T("eulaaccepted"), &value));
-  EXPECT_EQ(1, value);
-}
-
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_User_UpdateZero_MachineAppOne) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppMachineClientStatePath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(false));
-
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(USER_REG_UPDATE, _T("eulaaccepted"), &value));
-  EXPECT_EQ(0, value);
-  value = UINT_MAX;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(kAppMachineClientStatePath, _T("eulaaccepted"), &value));
-  EXPECT_EQ(1, value);
-}
-
-// ClientStateMedium is not used.
-TEST_F(GoopdateRegistryProtectedTest,
-       PromoteAppEulaAccepted_User_UpdateZero_MediumAppValueOneAndStateKey) {
-  const TCHAR* const kAppUserClientStateMediumPath =
-      _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-      _T("\\ClientStateMedium\\{19BE47E4-CF32-48c1-94C4-046507F6A8A6}\\");
-
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kAppUserClientStatePath));
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(0)));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kAppUserClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    static_cast<DWORD>(1)));
-
-  EXPECT_SUCCEEDED(internal::PromoteAppEulaAccepted(false));
-
-  DWORD value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(USER_REG_UPDATE,
-                                    _T("eulaaccepted"),
-                                    &value));
-  EXPECT_EQ(0, value);
-  EXPECT_FALSE(
-      RegKey::HasValue(kAppUserClientStatePath, _T("eulaaccepted")));
-  value = UINT_MAX;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kAppUserClientStateMediumPath,
-                                    _T("eulaaccepted"),
-                                    &value));
-  EXPECT_EQ(1, value);
-}
-
-//
-// IsMachineProcess tests.
-//
-
-class GoopdateIsMachineProcessTest : public testing::Test {
- protected:
-  bool FromMachineDirHelper(CommandLineMode mode) {
-    return internal::IsMachineProcess(mode,
-                                      true,
-                                      false,
-                                      false,
-                                      TRISTATE_NONE);
-  }
-
-  bool IsLocalSystemHelper(CommandLineMode mode) {
-    return internal::IsMachineProcess(mode,
-                                      false,
-                                      true,
-                                      false,
-                                      TRISTATE_NONE);
-  }
-
-  bool MachineOverrideHelper(CommandLineMode mode) {
-    return internal::IsMachineProcess(mode,
-                                      false,
-                                      false,
-                                      true,
-                                      TRISTATE_NONE);
-  }
-
-  bool NeedsAdminFalseHelper(CommandLineMode mode) {
-    return internal::IsMachineProcess(mode,
-                                      false,
-                                      false,
-                                      false,
-                                      TRISTATE_FALSE);
-  }
-
-  bool NeedsAdminTrueHelper(CommandLineMode mode) {
-    return internal::IsMachineProcess(mode,
-                                      false,
-                                      false,
-                                      false,
-                                      TRISTATE_TRUE);
-  }
-};
-
-// Unused function. Its sole purpose is to make sure that the unit tests below
-// were correctly updated when new modes were added.
-#pragma warning(push)
-// enumerator 'identifier' in switch of enum 'enumeration' is not explicitly
-// handled by a case label.
-// enumerator 'identifier' in switch of enum 'enumeration' is not handled.
-#pragma warning(1: 4061 4062)
-static void EnsureUnitTestUpdatedWithNewModes() {
-  CommandLineMode unused_mode;
-  switch (unused_mode) {
-    case COMMANDLINE_MODE_UNKNOWN:
-    case COMMANDLINE_MODE_NOARGS:
-    case COMMANDLINE_MODE_CORE:
-    case COMMANDLINE_MODE_SERVICE:
-    case COMMANDLINE_MODE_REGSERVER:
-    case COMMANDLINE_MODE_UNREGSERVER:
-    case COMMANDLINE_MODE_NETDIAGS:
-    case COMMANDLINE_MODE_CRASH:
-    case COMMANDLINE_MODE_REPORTCRASH:
-    case COMMANDLINE_MODE_INSTALL:
-    case COMMANDLINE_MODE_UPDATE:
-    case COMMANDLINE_MODE_HANDOFF_INSTALL:
-    case COMMANDLINE_MODE_UA:
-    case COMMANDLINE_MODE_RECOVER:
-    case COMMANDLINE_MODE_WEBPLUGIN:
-    case COMMANDLINE_MODE_CODE_RED_CHECK:
-    case COMMANDLINE_MODE_COMSERVER:
-    case COMMANDLINE_MODE_REGISTER_PRODUCT:
-    case COMMANDLINE_MODE_UNREGISTER_PRODUCT:
-    case COMMANDLINE_MODE_SERVICE_REGISTER:
-    case COMMANDLINE_MODE_SERVICE_UNREGISTER:
-    case COMMANDLINE_MODE_CRASH_HANDLER:
-    case COMMANDLINE_MODE_COMBROKER:
-    case COMMANDLINE_MODE_ONDEMAND:
-    case COMMANDLINE_MODE_MEDIUM_SERVICE:
-    case COMMANDLINE_MODE_UNINSTALL:
-    case COMMANDLINE_MODE_PING:
-    //
-    // When adding a new mode, be sure to update kLastMode too.
-    //
-      break;
-  }
-}
-#pragma warning(pop)
-
-TEST_F(GoopdateIsMachineProcessTest, IsMachineProcess_MachineDirOnly) {
-  EXPECT_TRUE(FromMachineDirHelper(COMMANDLINE_MODE_UNKNOWN));
-  EXPECT_TRUE(FromMachineDirHelper(COMMANDLINE_MODE_NOARGS));
-  EXPECT_FALSE(FromMachineDirHelper(COMMANDLINE_MODE_CORE));
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(FromMachineDirHelper(COMMANDLINE_MODE_SERVICE));
-  }
-  EXPECT_TRUE(FromMachineDirHelper(COMMANDLINE_MODE_REGSERVER));
-  EXPECT_TRUE(FromMachineDirHelper(COMMANDLINE_MODE_UNREGSERVER));
-  EXPECT_TRUE(FromMachineDirHelper(COMMANDLINE_MODE_NETDIAGS));
-  EXPECT_TRUE(FromMachineDirHelper(COMMANDLINE_MODE_CRASH));
-  // TODO(omaha): Change to machine.
-  EXPECT_FALSE(FromMachineDirHelper(COMMANDLINE_MODE_REPORTCRASH));
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(FromMachineDirHelper(COMMANDLINE_MODE_INSTALL));
-  }
-  EXPECT_FALSE(FromMachineDirHelper(COMMANDLINE_MODE_UPDATE));
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(FromMachineDirHelper(COMMANDLINE_MODE_HANDOFF_INSTALL));
-  }
-  EXPECT_FALSE(FromMachineDirHelper(COMMANDLINE_MODE_UA));
-  EXPECT_FALSE(FromMachineDirHelper(COMMANDLINE_MODE_RECOVER));
-  EXPECT_TRUE(FromMachineDirHelper(COMMANDLINE_MODE_WEBPLUGIN));
-  EXPECT_FALSE(FromMachineDirHelper(COMMANDLINE_MODE_CODE_RED_CHECK));
-  EXPECT_TRUE(FromMachineDirHelper(COMMANDLINE_MODE_COMSERVER));
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(FromMachineDirHelper(COMMANDLINE_MODE_REGISTER_PRODUCT));
-  }
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(FromMachineDirHelper(COMMANDLINE_MODE_UNREGISTER_PRODUCT));
-  }
-  EXPECT_TRUE(FromMachineDirHelper(COMMANDLINE_MODE_SERVICE_REGISTER));
-  EXPECT_TRUE(FromMachineDirHelper(COMMANDLINE_MODE_SERVICE_UNREGISTER));
-  EXPECT_FALSE(FromMachineDirHelper(COMMANDLINE_MODE_CRASH_HANDLER));
-  EXPECT_TRUE(FromMachineDirHelper(COMMANDLINE_MODE_COMBROKER));
-  EXPECT_TRUE(FromMachineDirHelper(COMMANDLINE_MODE_ONDEMAND));
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(FromMachineDirHelper(COMMANDLINE_MODE_MEDIUM_SERVICE));
-  }
-  EXPECT_TRUE(FromMachineDirHelper(COMMANDLINE_MODE_UNINSTALL));
-  EXPECT_TRUE(FromMachineDirHelper(COMMANDLINE_MODE_PING));
-  EXPECT_TRUE(FromMachineDirHelper(
-      static_cast<CommandLineMode>(kLastMode + 1)));
-}
-
-TEST_F(GoopdateIsMachineProcessTest, IsMachineProcess_IsLocalSystemOnly) {
-  EXPECT_FALSE(IsLocalSystemHelper(COMMANDLINE_MODE_UNKNOWN));
-  EXPECT_FALSE(IsLocalSystemHelper(COMMANDLINE_MODE_NOARGS));
-  EXPECT_TRUE(IsLocalSystemHelper(COMMANDLINE_MODE_CORE));
-  EXPECT_TRUE(IsLocalSystemHelper(COMMANDLINE_MODE_SERVICE));
-  EXPECT_FALSE(IsLocalSystemHelper(COMMANDLINE_MODE_REGSERVER));
-  EXPECT_FALSE(IsLocalSystemHelper(COMMANDLINE_MODE_UNREGSERVER));
-  EXPECT_FALSE(IsLocalSystemHelper(COMMANDLINE_MODE_NETDIAGS));
-  EXPECT_FALSE(IsLocalSystemHelper(COMMANDLINE_MODE_CRASH));
-  EXPECT_FALSE(IsLocalSystemHelper(COMMANDLINE_MODE_REPORTCRASH));
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(IsLocalSystemHelper(COMMANDLINE_MODE_INSTALL));
-  }
-  EXPECT_TRUE(IsLocalSystemHelper(COMMANDLINE_MODE_UPDATE));
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(IsLocalSystemHelper(COMMANDLINE_MODE_HANDOFF_INSTALL));
-  }
-  EXPECT_TRUE(IsLocalSystemHelper(COMMANDLINE_MODE_UA));
-  EXPECT_FALSE(IsLocalSystemHelper(COMMANDLINE_MODE_RECOVER));
-  EXPECT_FALSE(IsLocalSystemHelper(COMMANDLINE_MODE_WEBPLUGIN));
-  EXPECT_TRUE(IsLocalSystemHelper(COMMANDLINE_MODE_CODE_RED_CHECK));
-  EXPECT_FALSE(IsLocalSystemHelper(COMMANDLINE_MODE_COMSERVER));
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(IsLocalSystemHelper(COMMANDLINE_MODE_REGISTER_PRODUCT));
-  }
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(IsLocalSystemHelper(COMMANDLINE_MODE_UNREGISTER_PRODUCT));
-  }
-  EXPECT_TRUE(IsLocalSystemHelper(COMMANDLINE_MODE_SERVICE_REGISTER));
-  EXPECT_TRUE(IsLocalSystemHelper(COMMANDLINE_MODE_SERVICE_UNREGISTER));
-  EXPECT_TRUE(IsLocalSystemHelper(COMMANDLINE_MODE_CRASH_HANDLER));
-  EXPECT_FALSE(IsLocalSystemHelper(COMMANDLINE_MODE_COMBROKER));
-  EXPECT_FALSE(IsLocalSystemHelper(COMMANDLINE_MODE_ONDEMAND));
-  EXPECT_TRUE(IsLocalSystemHelper(COMMANDLINE_MODE_MEDIUM_SERVICE));
-  EXPECT_FALSE(IsLocalSystemHelper(COMMANDLINE_MODE_UNINSTALL));
-  EXPECT_FALSE(IsLocalSystemHelper(COMMANDLINE_MODE_PING));
-  EXPECT_FALSE(IsLocalSystemHelper(
-      static_cast<CommandLineMode>(kLastMode + 1)));
-}
-
-TEST_F(GoopdateIsMachineProcessTest, IsMachineProcess_MachineOverrideOnly) {
-  EXPECT_FALSE(MachineOverrideHelper(COMMANDLINE_MODE_UNKNOWN));
-  EXPECT_FALSE(MachineOverrideHelper(COMMANDLINE_MODE_NOARGS));
-  EXPECT_FALSE(MachineOverrideHelper(COMMANDLINE_MODE_CORE));
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(MachineOverrideHelper(COMMANDLINE_MODE_SERVICE));
-  }
-  EXPECT_FALSE(MachineOverrideHelper(COMMANDLINE_MODE_REGSERVER));
-  EXPECT_FALSE(MachineOverrideHelper(COMMANDLINE_MODE_UNREGSERVER));
-  EXPECT_FALSE(MachineOverrideHelper(COMMANDLINE_MODE_NETDIAGS));
-  EXPECT_FALSE(MachineOverrideHelper(COMMANDLINE_MODE_CRASH));
-  EXPECT_TRUE(MachineOverrideHelper(COMMANDLINE_MODE_REPORTCRASH));
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(MachineOverrideHelper(COMMANDLINE_MODE_INSTALL));
-  }
-  EXPECT_FALSE(MachineOverrideHelper(COMMANDLINE_MODE_UPDATE));
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(MachineOverrideHelper(COMMANDLINE_MODE_HANDOFF_INSTALL));
-  }
-  EXPECT_TRUE(MachineOverrideHelper(COMMANDLINE_MODE_UA));
-  EXPECT_TRUE(MachineOverrideHelper(COMMANDLINE_MODE_RECOVER));
-  EXPECT_FALSE(MachineOverrideHelper(COMMANDLINE_MODE_WEBPLUGIN));
-  EXPECT_FALSE(MachineOverrideHelper(COMMANDLINE_MODE_CODE_RED_CHECK));
-  EXPECT_FALSE(MachineOverrideHelper(COMMANDLINE_MODE_COMSERVER));
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(MachineOverrideHelper(COMMANDLINE_MODE_REGISTER_PRODUCT));
-  }
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(MachineOverrideHelper(COMMANDLINE_MODE_UNREGISTER_PRODUCT));
-  }
-  EXPECT_TRUE(MachineOverrideHelper(COMMANDLINE_MODE_SERVICE_REGISTER));
-  EXPECT_TRUE(MachineOverrideHelper(COMMANDLINE_MODE_SERVICE_UNREGISTER));
-  EXPECT_FALSE(MachineOverrideHelper(COMMANDLINE_MODE_CRASH_HANDLER));
-  EXPECT_FALSE(MachineOverrideHelper(COMMANDLINE_MODE_COMBROKER));
-  EXPECT_FALSE(MachineOverrideHelper(COMMANDLINE_MODE_ONDEMAND));
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(MachineOverrideHelper(COMMANDLINE_MODE_MEDIUM_SERVICE));
-  }
-  EXPECT_FALSE(MachineOverrideHelper(COMMANDLINE_MODE_UNINSTALL));
-  EXPECT_FALSE(MachineOverrideHelper(COMMANDLINE_MODE_PING));
-  EXPECT_FALSE(MachineOverrideHelper(
-      static_cast<CommandLineMode>(kLastMode + 1)));
-}
-
-TEST_F(GoopdateIsMachineProcessTest, IsMachineProcess_NeedsAdminFalseOnly) {
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_UNKNOWN));
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_NOARGS));
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_CORE));
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_SERVICE));
-  }
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_REGSERVER));
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_UNREGSERVER));
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_NETDIAGS));
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_CRASH));
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_REPORTCRASH));
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_INSTALL));
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_UPDATE));
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_HANDOFF_INSTALL));
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_UA));
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_RECOVER));
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_WEBPLUGIN));
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_CODE_RED_CHECK));
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_COMSERVER));
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_REGISTER_PRODUCT));
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_UNREGISTER_PRODUCT));
-  EXPECT_TRUE(NeedsAdminFalseHelper(COMMANDLINE_MODE_SERVICE_REGISTER));
-  EXPECT_TRUE(NeedsAdminFalseHelper(COMMANDLINE_MODE_SERVICE_UNREGISTER));
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_CRASH_HANDLER));
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_COMBROKER));
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_ONDEMAND));
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_MEDIUM_SERVICE));
-  }
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_UNINSTALL));
-  EXPECT_FALSE(NeedsAdminFalseHelper(COMMANDLINE_MODE_PING));
-  EXPECT_FALSE(NeedsAdminFalseHelper(
-      static_cast<CommandLineMode>(kLastMode + 1)));
-}
-
-TEST_F(GoopdateIsMachineProcessTest, IsMachineProcess_NeedsAdminTrueOnly) {
-  EXPECT_FALSE(NeedsAdminTrueHelper(COMMANDLINE_MODE_UNKNOWN));
-  EXPECT_FALSE(NeedsAdminTrueHelper(COMMANDLINE_MODE_NOARGS));
-  EXPECT_FALSE(NeedsAdminTrueHelper(COMMANDLINE_MODE_CORE));
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(NeedsAdminTrueHelper(COMMANDLINE_MODE_SERVICE));
-  }
-  EXPECT_FALSE(NeedsAdminTrueHelper(COMMANDLINE_MODE_REGSERVER));
-  EXPECT_FALSE(NeedsAdminTrueHelper(COMMANDLINE_MODE_UNREGSERVER));
-  EXPECT_FALSE(NeedsAdminTrueHelper(COMMANDLINE_MODE_NETDIAGS));
-  EXPECT_FALSE(NeedsAdminTrueHelper(COMMANDLINE_MODE_CRASH));
-  EXPECT_FALSE(NeedsAdminTrueHelper(COMMANDLINE_MODE_REPORTCRASH));
-  EXPECT_TRUE(NeedsAdminTrueHelper(COMMANDLINE_MODE_INSTALL));
-  EXPECT_FALSE(NeedsAdminTrueHelper(COMMANDLINE_MODE_UPDATE));
-  EXPECT_TRUE(NeedsAdminTrueHelper(COMMANDLINE_MODE_HANDOFF_INSTALL));
-  EXPECT_FALSE(NeedsAdminTrueHelper(COMMANDLINE_MODE_UA));
-  EXPECT_FALSE(NeedsAdminTrueHelper(COMMANDLINE_MODE_RECOVER));
-  EXPECT_FALSE(NeedsAdminTrueHelper(COMMANDLINE_MODE_WEBPLUGIN));
-  EXPECT_FALSE(NeedsAdminTrueHelper(COMMANDLINE_MODE_CODE_RED_CHECK));
-  EXPECT_FALSE(NeedsAdminTrueHelper(COMMANDLINE_MODE_COMSERVER));
-  EXPECT_TRUE(NeedsAdminTrueHelper(COMMANDLINE_MODE_REGISTER_PRODUCT));
-  EXPECT_TRUE(NeedsAdminTrueHelper(COMMANDLINE_MODE_UNREGISTER_PRODUCT));
-  EXPECT_TRUE(NeedsAdminTrueHelper(COMMANDLINE_MODE_SERVICE_REGISTER));
-  EXPECT_TRUE(NeedsAdminTrueHelper(COMMANDLINE_MODE_SERVICE_UNREGISTER));
-  EXPECT_FALSE(NeedsAdminTrueHelper(COMMANDLINE_MODE_CRASH_HANDLER));
-  EXPECT_FALSE(NeedsAdminTrueHelper(COMMANDLINE_MODE_COMBROKER));
-  EXPECT_FALSE(NeedsAdminTrueHelper(COMMANDLINE_MODE_ONDEMAND));
-  {
-    ExpectAsserts expect_asserts;
-    EXPECT_FALSE(NeedsAdminTrueHelper(COMMANDLINE_MODE_MEDIUM_SERVICE));
-  }
-  EXPECT_FALSE(NeedsAdminTrueHelper(COMMANDLINE_MODE_UNINSTALL));
-  EXPECT_FALSE(NeedsAdminTrueHelper(COMMANDLINE_MODE_PING));
-  EXPECT_FALSE(NeedsAdminTrueHelper(
-      static_cast<CommandLineMode>(kLastMode + 1)));
-}
-
-// Tests all modes plus an undefined one.
-TEST(GoopdateTest, CanDisplayUi_NotSilent) {
-  for (int mode = 0; mode <= kLastMode + 1; ++mode) {
-    const bool kExpected = mode == COMMANDLINE_MODE_UNKNOWN ||
-                           mode == COMMANDLINE_MODE_INSTALL ||
-                           mode == COMMANDLINE_MODE_HANDOFF_INSTALL ||
-                           mode == COMMANDLINE_MODE_UA;
-
-    EXPECT_EQ(kExpected,
-              internal::CanDisplayUi(static_cast<CommandLineMode>(mode),
-                                     false));
-  }
-}
-
-TEST(GoopdateTest, CanDisplayUi_Silent) {
-  int mode = 0;
-  // These two modes always return true.
-  for (; mode <= COMMANDLINE_MODE_UNKNOWN; ++mode) {
-    EXPECT_TRUE(internal::CanDisplayUi(static_cast<CommandLineMode>(mode),
-                                       true));
-  }
-
-  // Tests the remaining modes plus an undefined one.
-  for (; mode <= kLastMode + 1; ++mode) {
-    EXPECT_FALSE(internal::CanDisplayUi(static_cast<CommandLineMode>(mode),
-                                        true));
-  }
-}
-
-}  // namespace omaha
diff --git a/goopdate/goopdate_version.rc b/goopdate/goopdate_version.rc
deleted file mode 100644
index e2f94c9..0000000
--- a/goopdate/goopdate_version.rc
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2007 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// This file contains the unlocalized goopdate DLL version resources.
-
-#include <afxres.h>
-
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
-VS_VERSION_INFO VERSIONINFO
-// Resource Editor does not handle constants from main.scons.
-#ifndef APSTUDIO_INVOKED
- FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_BUILD,VERSION_PATCH
- PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_BUILD,VERSION_PATCH
-#endif  // APSTUDIO_INVOKED
- FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
-#if defined _DEBUG && OFFICIAL_BUILD
- FILEFLAGS VS_FF_DEBUG
-#elif defined _DEBUG
- FILEFLAGS VS_FF_DEBUG | VS_FF_PRIVATEBUILD
-#elif !OFFICIAL_BUILD
- FILEFLAGS VS_FF_PRIVATEBUILD
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS VOS_NT_WINDOWS32
- FILETYPE VFT_DLL
- FILESUBTYPE VFT2_UNKNOWN
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "040904b0"
-        BEGIN
-// Requires constants from mains.scons that cannot be loaded in Resource Editor.
-#ifndef APSTUDIO_INVOKED
-            VALUE "CompanyName", FULL_COMPANY_NAME_ANSI
-            VALUE "FileDescription", OMAHA_APP_NAME_ANSI
-            VALUE "FileVersion", VERSION_NUMBER_STRING
-            VALUE "InternalName", OMAHA_APP_NAME_ANSI
-            VALUE "LegalCopyright", OMAHA_COPYRIGHT_STRING_ENGLISH
-            VALUE "OriginalFilename", MAIN_DLL_BASE_NAME_ANSI ".dll"
-            VALUE "ProductName", OMAHA_APP_NAME_ANSI
-            VALUE "ProductVersion", VERSION_NUMBER_STRING
-  #ifdef _DEBUG
-            VALUE "Debug", ""
-  #endif
-  #if !OFFICIAL_BUILD
-            VALUE "PrivateBuild", BUILD_NUMBER
-  #endif
-#else
-            VALUE "_SpecialView",
-                  "Most values are not shown in Resource Editor because they "
-                  "require build file constants."
-#endif  // APSTUDIO_INVOKED
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x0409, 1200
-    END
-END
diff --git a/goopdate/install_manager.cc b/goopdate/install_manager.cc
deleted file mode 100644
index 9522f98..0000000
--- a/goopdate/install_manager.cc
+++ /dev/null
@@ -1,361 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/install_manager.h"
-#include <vector>
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/path.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/install_manifest.h"
-#include "omaha/goopdate/app_manager.h"
-#include "omaha/goopdate/installer_wrapper.h"
-#include "omaha/goopdate/model.h"
-#include "omaha/goopdate/server_resource.h"
-#include "omaha/goopdate/string_formatter.h"
-
-namespace omaha {
-
-namespace {
-
-// Number of tries when the MSI service is busy.
-// Updates are silent so we can wait longer.
-const int kNumMsiAlreadyRunningInteractiveMaxTries = 4;  // Up to 35 seconds.
-const int kNumMsiAlreadyRunningSilentMaxTries      = 7;  // Up to 6.25 minutes.
-
-// TODO(omaha): there can be more install actions for each install event.
-bool GetInstallActionForEvent(
-    const std::vector<xml::InstallAction>& install_actions,
-    xml::InstallAction::InstallEvent install_event,
-    xml::InstallAction* action) {
-  ASSERT1(action);
-
-  for (size_t i = 0; i < install_actions.size(); ++i) {
-    if (install_actions[i].install_event == install_event) {
-      *action = install_actions[i];
-      return true;
-    }
-  }
-
-  return false;
-}
-
-}  // namespace
-
-InstallManager::InstallManager(const Lockable* model_lock, bool is_machine)
-    : model_lock_(model_lock),
-      is_machine_(is_machine) {
-  CORE_LOG(L3, (_T("[InstallManager::InstallManager][%d]"), is_machine_));
-
-  install_working_dir_ =
-      is_machine ?
-      ConfigManager::Instance()->GetMachineInstallWorkingDir() :
-      ConfigManager::Instance()->GetUserInstallWorkingDir();
-  CORE_LOG(L3, (_T("[install_working_dir][%s]"), install_working_dir()));
-
-  VERIFY1(SUCCEEDED(DeleteDirectory(install_working_dir_)));
-  VERIFY1(SUCCEEDED(CreateDir(install_working_dir_, NULL)));
-
-  installer_wrapper_.reset(new InstallerWrapper(is_machine_));
-}
-
-InstallManager::~InstallManager() {
-  CORE_LOG(L3, (_T("[InstallManager::~InstallManager]")));
-}
-
-HRESULT InstallManager::Initialize() {
-  return installer_wrapper_->Initialize();
-}
-
-CString InstallManager::install_working_dir() const {
-  __mutexScope(model_lock_);
-  return install_working_dir_;
-}
-
-// For each app, set the state to STATE_INSTALLING, install it, and update the
-// state of the model after it completes.
-void InstallManager::InstallApp(App* app,  const CString& dir) {
-  CORE_LOG(L3, (_T("[InstallManager::InstallApp][0x%p]"), app));
-  ASSERT1(app);
-
-  const ConfigManager& cm = *ConfigManager::Instance();
-  // TODO(omaha): Since we don't currently have is_manual, check the least
-  // restrictive case of true. It would be nice if we had is_manual. We'll see.
-  ASSERT(SUCCEEDED(app->CheckGroupPolicy()),
-         (_T("Installing/updating app for which this is not allowed.")));
-  ASSERT(app->is_eula_accepted() ||
-         app->is_install() && app->app_bundle()->is_offline_install(),
-         (_T("update/online install of app for which EULA is not accepted.")));
-
-  // TODO(omaha3): This needs to be set/passed per app/bundle.
-  const int priority = app->app_bundle()->priority();
-  const int num_tries = (priority < INSTALL_PRIORITY_HIGH) ?
-                             kNumMsiAlreadyRunningSilentMaxTries :
-                             kNumMsiAlreadyRunningInteractiveMaxTries;
-  installer_wrapper_->set_num_tries_when_msi_busy(num_tries);
-
-  AppVersion* next_version = app->next_version();
-  ASSERT1(app->app_bundle()->is_machine() == is_machine_);
-
-  const CString current_version_string = app->current_version()->version();
-
-  HANDLE primary_token(app->app_bundle()->primary_token());
-
-  HRESULT hr = InstallApp(is_machine_,
-                          primary_token,
-                          current_version_string,
-                          *model_lock_,
-                          installer_wrapper_.get(),
-                          app,
-                          dir);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[InstallApp failed][0x%p][0x%08x]"), app, hr));
-  }
-
-  app->LogTextAppendFormat(_T("Install result=0x%08x"), hr);
-
-  ASSERT1(FAILED(hr) == (app->state() == STATE_ERROR));
-}
-
-HRESULT InstallManager::InstallApp(bool is_machine,
-                                   HANDLE user_token,
-                                   const CString& existing_version,
-                                   const Lockable& model_lock,
-                                   InstallerWrapper* installer_wrapper,
-                                   App* app,
-                                   const CString& dir) {
-  UNREFERENCED_PARAMETER(is_machine);
-  ASSERT1(installer_wrapper);
-  ASSERT1(app);
-
-  const bool is_update = app->is_update();
-
-  CString display_name;
-  GUID app_guid = {0};
-  CString installer_path;
-  // TODO(omaha3): Consider generating the installerdata file external to the
-  // InstallerWrapper and just adding the path to the arguments.
-  CString manifest_arguments;
-  CString installer_data;
-  CString expected_version;
-
-  AppManager& app_manager = *AppManager::Instance();
-  __mutexScope(app_manager.GetRegistryStableStateLock());
-
-  // TODO(omaha): If this does not get much simpler, extract method.
-  AppVersion& next_version = *(app->next_version());
-  ASSERT1(app->app_bundle()->is_machine() == is_machine);
-
-  CString language = app->app_bundle()->display_language();
-
-  // TODO(omaha): review the need for locking below.
-  __mutexBlock(model_lock) {
-    app->Installing();
-
-    app_guid = app->app_guid();
-
-    // The first package is always the Package Manager for the app.
-    // TODO(omaha3): Use program_to_run here instead of the installer_path. This
-    // will introduce complexity such as having to find the full path and
-    // handling the case where the file is not in the cache.
-    ASSERT1(next_version.GetNumberOfPackages() > 0);
-    if (next_version.GetNumberOfPackages() <= 0) {
-      HRESULT hr = E_FAIL;
-      const CString message = InstallerWrapper::GetMessageForError(hr,
-                                                                   CString(),
-                                                                   language);
-      app->Error(ErrorContext(hr), message);
-      return hr;
-    }
-    const Package& package_manager = *(next_version.GetPackage(0));
-    installer_path = ConcatenatePath(dir, package_manager.filename());
-
-    xml::InstallAction action;
-    const bool is_event_found = GetInstallActionForEvent(
-        next_version.install_manifest()->install_actions,
-        is_update ? xml::InstallAction::kUpdate : xml::InstallAction::kInstall,
-        &action);
-    ASSERT1(is_event_found);
-    if (is_event_found) {
-      manifest_arguments = action.program_arguments;
-
-      // If this is an Omaha self-update, append a switch to the argument list
-      // to set the session ID.
-      if (is_update && ::IsEqualGUID(app_guid, kGoopdateGuid)) {
-        SafeCStringAppendFormat(&manifest_arguments, _T(" /%s \"%s\""),
-                                kCmdLineSessionId,
-                                app->app_bundle()->session_id());
-      }
-    }
-
-    installer_data = app->GetInstallData();
-
-    expected_version = next_version.install_manifest()->version;
-
-    // TODO(omaha3): All app key registry writes and reads must be protected by
-    // some lock to prevent race conditions caused by multiple bundles
-    // installing the same app. This includes while writing the pre-install
-    // data, while the installer is running, and while checking application
-    // registration (basically the rest of this method). An app-specific lock
-    // similar to the app install lock in Omaha 2 seems to be appropriate.
-    // (Omaha 2 only took that during install - not updates - though.)
-    // Some app installers may also check the state of other apps (i.e. to check
-    // for version compatibility). Should we protect this case as well?
-    // Is it safest to use the installer lock for this? What is the performance
-    // impact. If we do use the installer lock, it would need to be acquired
-    // here instead of in the InstallerWrapper::InstallApp path.
-    if (!is_update) {
-      HRESULT hr = app_manager.WritePreInstallData(*app);
-      if (FAILED(hr)) {
-        CORE_LOG(LE, (_T("[AppManager::WritePreInstallData failed][0x%08x]")));
-        const CString message =
-            InstallerWrapper::GetMessageForError(hr, CString(), language);
-        app->Error(ErrorContext(hr), message);
-        return hr;
-      }
-    }
-  }
-
-  OPT_LOG(L1, (_T("[Installing][%s][%s][%s][%s][%s]"),
-               app->display_name(),
-               GuidToString(app_guid),
-               installer_path,
-               manifest_arguments,
-               installer_data));
-
-  InstallerResultInfo result_info;
-
-  HRESULT hr = installer_wrapper->InstallApp(user_token,
-                                             app_guid,
-                                             installer_path,
-                                             manifest_arguments,
-                                             installer_data,
-                                             language,
-                                             &result_info);
-
-  OPT_LOG(L1, (_T("[InstallApp returned][0x%x][%s][type:%d][code: %d][%s][%s]"),
-               hr, GuidToString(app_guid), result_info.type, result_info.code,
-               result_info.text, result_info.post_install_launch_command_line));
-
-  __mutexScope(model_lock);
-
-  if (SUCCEEDED(hr)) {
-    ASSERT1(result_info.type == INSTALLER_RESULT_SUCCESS);
-    // Skip checking application registration for Omaha self-updates because the
-    // installer has not completed.
-    if (!::IsEqualGUID(kGoopdateGuid, app_guid)) {
-      hr = app_manager.ReadInstallerRegistrationValues(app);
-      if (SUCCEEDED(hr)) {
-        hr = installer_wrapper->CheckApplicationRegistration(
-            app_guid,
-            next_version.version(),
-            expected_version,
-            existing_version,
-            is_update);
-      }
-    }
-  } else {
-    ASSERT1(result_info.type != INSTALLER_RESULT_SUCCESS);
-    ASSERT1(!result_info.text.IsEmpty() ||
-            result_info.type == INSTALLER_RESULT_UNKNOWN);
-  }
-
-  if (FAILED(hr)) {
-    // If we failed the install job and the product wasn't registered, it's safe
-    // to delete the ClientState key.  We need to remove it because it contains
-    // data like "ap", browsertype, language, etc. that need to be cleaned up in
-    // case user tries to install again in the future.
-    if (!is_update && !app_manager.IsAppRegistered(app->app_guid())) {
-      app_manager.RemoveClientState(app->app_guid());
-    }
-
-    if (hr == GOOPDATEINSTALL_E_INSTALLER_FAILED) {
-      ASSERT1(!result_info.text.IsEmpty());
-      app->ReportInstallerComplete(result_info);
-    } else {
-      // TODO(omaha3): If we end up having the installer filename above, pass it
-      // instead of installer_path.
-      const CString message = InstallerWrapper::GetMessageForError(
-                                  hr, installer_path, language);
-      app->Error(ErrorContext(hr), message);
-    }
-
-    return hr;
-  }
-
-  PopulateSuccessfulInstallResultInfo(app, &result_info);
-
-  app->ReportInstallerComplete(result_info);
-  return S_OK;
-}
-
-// Call this function only when installer succeeded.
-// This function sets the post install action and url based on installer result
-// info and app manifest. Note that the action may already have been set by
-// InstallerWrapper::GetInstallerResultHelper() in some cases. This function
-// only sets the action when necessary.
-void InstallManager::PopulateSuccessfulInstallResultInfo(
-    const App* app,
-    InstallerResultInfo* result_info) {
-  ASSERT1(result_info);
-  ASSERT1(result_info->type == INSTALLER_RESULT_SUCCESS);
-  ASSERT1(app);
-  ASSERT1(app->next_version()->install_manifest());
-
-  xml::InstallAction action;
-  if (GetInstallActionForEvent(
-          app->next_version()->install_manifest()->install_actions,
-          xml::InstallAction::kPostInstall,
-          &action)) {
-    result_info->post_install_url = action.success_url;
-
-    if (result_info->post_install_launch_command_line.IsEmpty() &&
-        action.success_action == SUCCESS_ACTION_EXIT_SILENTLY_ON_LAUNCH_CMD) {
-      CORE_LOG(LW, (_T("[Success action specified launchcmd, but cmd empty]")));
-    }
-
-    if (result_info->post_install_action ==
-            POST_INSTALL_ACTION_LAUNCH_COMMAND &&
-        action.success_action == SUCCESS_ACTION_EXIT_SILENTLY_ON_LAUNCH_CMD) {
-      result_info->post_install_action =
-          POST_INSTALL_ACTION_EXIT_SILENTLY_ON_LAUNCH_COMMAND;
-    } else if (result_info->post_install_action ==
-        POST_INSTALL_ACTION_DEFAULT) {
-      if (action.success_action == SUCCESS_ACTION_EXIT_SILENTLY) {
-        result_info->post_install_action = POST_INSTALL_ACTION_EXIT_SILENTLY;
-      } else if (!result_info->post_install_url.IsEmpty()) {
-        result_info->post_install_action = action.terminate_all_browsers ?
-            POST_INSTALL_ACTION_RESTART_ALL_BROWSERS :
-            POST_INSTALL_ACTION_RESTART_BROWSER;
-      }
-    }
-  }
-
-  // Load message based on post install action if not overridden.
-  if (result_info->text.IsEmpty()) {
-    StringFormatter formatter(app->app_bundle()->display_language());
-    VERIFY1(SUCCEEDED(formatter.LoadString(
-                          IDS_APPLICATION_INSTALLED_SUCCESSFULLY,
-                          &result_info->text)));
-  }
-}
-
-}  // namespace omaha
diff --git a/goopdate/install_manager.h b/goopdate/install_manager.h
deleted file mode 100644
index 3bfa248..0000000
--- a/goopdate/install_manager.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Defines a command object to be executed in the thread pool when the Install
-// method is called.
-
-#ifndef OMAHA_GOOPDATE_INSTALL_MANAGER_H_
-#define OMAHA_GOOPDATE_INSTALL_MANAGER_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/thread_pool.h"
-
-namespace omaha {
-
-class App;
-class AppVersion;
-class InstallerWrapper;
-struct InstallerResultInfo;
-struct Lockable;
-
-// Public interface for the InstallManager.
-class InstallManagerInterface {
- public:
-  virtual ~InstallManagerInterface() {}
-  virtual CString install_working_dir() const = 0;
-  virtual HRESULT Initialize() = 0;
-  virtual void InstallApp(App* app, const CString& dir) = 0;
-};
-
-class InstallManager : public InstallManagerInterface {
- public:
-  InstallManager(const Lockable* model_lock, bool is_machine_);
-  virtual ~InstallManager();
-
-  // Returns the base directory where the InstallManager expects application
-  // packages to be available before the install.
-  virtual CString install_working_dir() const;
-
-  virtual HRESULT Initialize();
-
-  // Installs an application. Expects the application packages to be present
-  // in the specified directory.
-  virtual void InstallApp(App* app, const CString& dir);
-
- private:
-  // TODO(omaha): Rename to avoid overload.
-  static HRESULT InstallApp(bool is_machine,
-                            HANDLE user_token,
-                            const CString& existing_version,
-                            const Lockable& model_lock,
-                            InstallerWrapper* installer_wrapper,
-                            App* app,
-                            const CString& dir);
-  static void PopulateSuccessfulInstallResultInfo(
-      const App* app,
-      InstallerResultInfo* result_info);
-
-  const Lockable* model_lock_;
-  const bool is_machine_;
-
-  // Base path where verified application packages are copied before install.
-  CString install_working_dir_;
-
-  scoped_ptr<InstallerWrapper> installer_wrapper_;
-
-  friend class InstallManagerInstallAppTest;
-
-  DISALLOW_COPY_AND_ASSIGN(InstallManager);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_INSTALL_MANAGER_H_
diff --git a/goopdate/install_manager_unittest.cc b/goopdate/install_manager_unittest.cc
deleted file mode 100644
index 96f0f79..0000000
--- a/goopdate/install_manager_unittest.cc
+++ /dev/null
@@ -1,1143 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <atlpath.h>
-#include <atlstr.h>
-#include "base/scoped_ptr.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/path.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/shell.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/system.h"
-#include "omaha/base/timer.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/common/install_manifest.h"
-#include "omaha/common/ping_event.h"
-#include "omaha/goopdate/app_bundle_state_initialized.h"
-#include "omaha/goopdate/app_state_waiting_to_install.h"
-#include "omaha/goopdate/app_unittest_base.h"
-#include "omaha/goopdate/installer_wrapper.h"
-#include "omaha/goopdate/install_manager.h"
-#include "omaha/testing/unit_test.h"
-
-using ::testing::_;
-using ::testing::Return;
-
-namespace omaha {
-
-// TODO(omaha): there is a problem with this unit test. The model is built
-// bottom up. This makes it impossible to set the references to parents. Will
-// have to fix the code, eventually using Builder DP to create a bunch of
-// models containing bundles, apps, and such.
-
-namespace {
-
-const TCHAR kAppId[] = _T("{B18BC01B-E0BD-4BF0-A33E-1133055E5FDE}");
-const GUID kAppGuid = {0xB18BC01B, 0xE0BD, 0x4BF0,
-                       {0xA3, 0x3E, 0x11, 0x33, 0x05, 0x5E, 0x5F, 0xDE}};
-const TCHAR kApp2Id[] = _T("{85794B39-42E5-457c-B567-4A0F2A0FB272}");
-
-const TCHAR kFullAppClientsKeyPath[] =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\Clients\\{B18BC01B-E0BD-4BF0-A33E-1133055E5FDE}");
-const TCHAR kFullAppClientStateKeyPath[] =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientState\\{B18BC01B-E0BD-4BF0-A33E-1133055E5FDE}");
-const TCHAR kFullFooAppClientKeyPath[] =
-    _T("HKLM\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\Clients\\{D6B08267-B440-4C85-9F79-E195E80D9937}");
-const TCHAR kFullFooAppClientStateKeyPath[] =
-    _T("HKLM\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientState\\{D6B08267-B440-4C85-9F79-E195E80D9937}");
-
-const TCHAR kFullApp2ClientsKeyPath[] =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\Clients\\{85794B39-42E5-457c-B567-4A0F2A0FB272}");
-
-const TCHAR kSetupFooV1RelativeLocation[] =
-  _T("unittest_support\\test_foo_v1.0.101.0.msi");
-const TCHAR kFooId[] = _T("{D6B08267-B440-4C85-9F79-E195E80D9937}");
-const TCHAR kFooVersion[] = _T("1.0.101.0");
-const TCHAR kFooInstallerBarPropertyArg[] = _T("PROPBAR=7");
-const TCHAR kFooInstallerBarValueName[] = _T("propbar");
-
-// Values related to using cmd.exe as an "installer".
-const TCHAR kCmdExecutable[] = _T("cmd.exe");
-const TCHAR kExecuteCommandAndTerminateSwitch[] = _T("/c %s");
-const TCHAR kExecuteTwoCommandsFormat[] = _T("\"%s & %s\"");
-
-const TCHAR kMsiInstallerBusyErrorMessage[] =
-    _T("Installation failed because the Windows Installer is busy. Please ")
-    _T("wait for any installers to finish, close all installer windows, and ")
-    _T("try installing again. If this problem persists, you may need ")
-    _T("to reboot your computer.");
-
-const TCHAR kMsiLogFormat[] = _T("%s.log");
-
-// brand, InstallTime, and LastCheckSuccess are automatically populated.
-const int kNumAutoPopulatedValues = 3;
-
-}  // namespace
-
-// Values and functions in installer_wrapper_unittest.cc.
-extern const TCHAR kRegExecutable[];
-extern const TCHAR kSetInstallerResultTypeMsiErrorRegCmdArgs[];
-extern const TCHAR kMsiInstallerBusyExitCodeCmd[];
-extern const TCHAR kError1619MessagePrefix[];
-extern const int kError1619MessagePrefixLength;
-void VerifyStringIsMsiPackageOpenFailedString(const CString& str);
-void UninstallTestMsi(const CString& installer_path);
-void AdjustMsiTries(InstallerWrapper* installer_wrapper);
-
-// TODO(omaha3): Test the rest of InstallManager.
-class InstallManagerTest : public testing::Test {
-  virtual void SetUp() {}
-  virtual void TearDown() {}
-};
-
-class InstallManagerInstallAppTest : public AppTestBaseWithRegistryOverride {
- protected:
-  explicit InstallManagerInstallAppTest(bool is_machine)
-      : AppTestBaseWithRegistryOverride(is_machine, false) {}
-
-  static void SetUpTestCase() {
-    CString system_path;
-    EXPECT_SUCCEEDED(Shell::GetSpecialFolder(CSIDL_SYSTEM,
-                                             false,
-                                             &system_path));
-    EXPECT_FALSE(system_path.IsEmpty());
-    cmd_exe_dir_ += system_path;
-
-    CPath cmd_exe_path;
-    cmd_exe_path.Combine(system_path, kCmdExecutable);
-    EXPECT_TRUE(File::Exists(cmd_exe_path));
-
-    CPath reg_path;
-    reg_path.Combine(system_path, kRegExecutable);
-    set_installer_result_type_msi_error_cmd_.Format(
-        _T("%s %s"),
-        reg_path, kSetInstallerResultTypeMsiErrorRegCmdArgs);
-  }
-
-  virtual void SetUp() {
-    AppTestBaseWithRegistryOverride::SetUp();
-
-    installer_wrapper_.reset(new InstallerWrapper(is_machine_));
-    EXPECT_SUCCEEDED(installer_wrapper_->Initialize());
-
-    ASSERT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kAppId), &app_));
-
-    SetAppStateWaitingToInstall(app_);
-  }
-
-  HRESULT InstallApp(const CString& existing_version,
-                     App* app,
-                     const CString& dir) {
-    ASSERT1(app);
-    return InstallManager::InstallApp(is_machine_,
-                                      NULL,
-                                      existing_version,
-                                      app->model()->lock(),
-                                      installer_wrapper_.get(),
-                                      app,
-                                      dir);
-  }
-
-  void SetArgumentsInManifest(const CString& arguments,
-                              const CString& expected_version,
-                              App* app) {
-    ASSERT1(app);
-
-    // TODO(omaha3): Consider using a mock object.
-    xml::InstallManifest* install_manifest = new xml::InstallManifest;
-    install_manifest->version = expected_version;
-
-    xml::InstallAction install_event_action;
-    install_event_action.install_event = xml::InstallAction::kInstall;
-    install_event_action.needs_admin = is_machine_ ? NEEDS_ADMIN_YES :
-                                                     NEEDS_ADMIN_NO;
-    // TODO(omaha3): Set install_event_action.program_to_run?
-    install_event_action.program_arguments = arguments;
-
-    install_manifest->install_actions.push_back(install_event_action);
-    app->next_version()->set_install_manifest(install_manifest);
-  }
-
-  void SetPostInstallActionInManifest(SuccessfulInstallAction success_action,
-                                      const CString& success_url,
-                                      bool terminate_all_browsers,
-                                      App* app) {
-    xml::InstallManifest* install_manifest = new xml::InstallManifest;
-    install_manifest->version = _T("1.2.3.4");
-
-    xml::InstallAction post_install_event_action;
-    post_install_event_action.install_event = xml::InstallAction::kPostInstall;
-    post_install_event_action.needs_admin = is_machine_ ? NEEDS_ADMIN_YES :
-                                                          NEEDS_ADMIN_NO;
-    post_install_event_action.success_url = success_url;
-    post_install_event_action.terminate_all_browsers = terminate_all_browsers;
-    post_install_event_action.success_action = success_action;
-    install_manifest->install_actions.push_back(post_install_event_action);
-    app->next_version()->set_install_manifest(install_manifest);
-  }
-
-  static void SetAppStateWaitingToInstall(App* app) {
-    SetAppStateForUnitTest(app, new fsm::AppStateWaitingToInstall);
-  }
-
-  static HRESULT GetResultCode(const App* app) {
-    return app->error_context_.error_code;
-  }
-
-  static CString GetCompletionMessage(const App* app) {
-    return app->completion_message_;
-  }
-
-  static PingEvent::Results GetCompletionResult(const App* app) {
-    return app->completion_result_;
-  }
-
-  static CString GetPostInstallLaunchCommandLine(const App* app) {
-    return app->post_install_launch_command_line_;
-  }
-
-  static CString GetPostInstallUrl(const App* app) {
-    return app->post_install_url_;
-  }
-
-  static PostInstallAction GetPostInstallAction(const App* app) {
-    return app->post_install_action_;
-  }
-
-  static void PopulateSuccessfulInstallResultInfo(
-      const App* app, InstallerResultInfo* result_info) {
-    return InstallManager::PopulateSuccessfulInstallResultInfo(
-        app, result_info);
-  }
-
-  scoped_ptr<InstallerWrapper> installer_wrapper_;
-
-  App* app_;
-
-  static CPath cmd_exe_dir_;
-  static CString set_installer_result_type_msi_error_cmd_;
-};
-
-CPath InstallManagerInstallAppTest::cmd_exe_dir_;
-CString InstallManagerInstallAppTest::set_installer_result_type_msi_error_cmd_;
-
-class InstallManagerInstallAppMachineTest
-    : public InstallManagerInstallAppTest {
- protected:
-  InstallManagerInstallAppMachineTest()
-    : InstallManagerInstallAppTest(true) {
-  }
-};
-
-class InstallManagerInstallAppUserTest : public InstallManagerInstallAppTest {
- protected:
-  InstallManagerInstallAppUserTest()
-    : InstallManagerInstallAppTest(false) {
-  }
-};
-
-//
-// Helper method tests
-//
-
-// TODO(omaha3): We may replace these with the tests from
-// installer_wrapper_unittest.cc if CheckApplicationRegistration() is moved to
-// InstallManager.
-#if 0
-TEST_F(InstallManagerInstallAppUserTest,
-       CheckApplicationRegistration_FailsWhenClientsKeyAbsent) {
-  AppData app_data(kAppGuid, is_machine_);
-  Job job(false, &ping_);
-  job.set_app_data(app_data);
-
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_DID_NOT_WRITE_CLIENTS_KEY,
-            CheckApplicationRegistration(CString(), &job));
-
-  EXPECT_FALSE(RegKey::HasKey(kFullAppClientsKeyPath));
-  EXPECT_FALSE(RegKey::HasKey(kFullAppClientStateKeyPath));
-}
-
-TEST_F(InstallManagerInstallAppUserTest,
-       CheckApplicationRegistration_FailsWhenVersionValueAbsent) {
-  ASSERT_SUCCEEDED(RegKey::CreateKey(kFullAppClientsKeyPath));
-
-  AppData app_data(kAppGuid, is_machine_);
-  Job job(false, &ping_);
-  job.set_app_data(app_data);
-
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_DID_NOT_WRITE_CLIENTS_KEY,
-            CheckApplicationRegistration(CString(), &job));
-
-  EXPECT_TRUE(RegKey::HasKey(kFullAppClientsKeyPath));
-  EXPECT_FALSE(RegKey::HasKey(kFullAppClientStateKeyPath));
-}
-
-TEST_F(InstallManagerInstallAppUserTest,
-       CheckApplicationRegistration_SucceedsWhenStateKeyAbsent) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(kFullAppClientsKeyPath,
-                                    kRegValueProductVersion,
-                                    _T("0.9.68.4")));
-
-  AppData app_data(kAppGuid, is_machine_);
-  Job job(false, &ping_);
-  job.set_app_data(app_data);
-
-  EXPECT_SUCCEEDED(CheckApplicationRegistration(CString(), &job));
-}
-
-TEST_F(InstallManagerInstallAppUserTest,
-       CheckApplicationRegistration_SucceedsWhenStateKeyPresent) {
-  const TCHAR* keys_to_create[] = {kFullAppClientsKeyPath,
-                                   kFullAppClientStateKeyPath};
-  ASSERT_SUCCEEDED(RegKey::CreateKeys(keys_to_create, 2));
-  ASSERT_TRUE(RegKey::HasKey(kFullAppClientsKeyPath));
-  ASSERT_TRUE(RegKey::HasKey(kFullAppClientStateKeyPath));
-  ASSERT_SUCCEEDED(RegKey::SetValue(kFullAppClientsKeyPath,
-                                    kRegValueProductVersion,
-                                    _T("0.9.70.0")));
-
-  AppData app_data(kAppGuid, is_machine_);
-  Job job(false, &ping_);
-  job.set_app_data(app_data);
-
-  // The install should succeed even if the version is the same.
-  EXPECT_SUCCEEDED(CheckApplicationRegistration(_T("0.9.70.0"), &job));
-}
-
-TEST_F(InstallManagerInstallAppUserTest,
-       CheckApplicationRegistration_UpdateSucceeds) {
-  const TCHAR* keys_to_create[] = {kFullAppClientsKeyPath,
-                                   kFullAppClientStateKeyPath};
-  ASSERT_SUCCEEDED(RegKey::CreateKeys(keys_to_create, 2));
-  ASSERT_TRUE(RegKey::HasKey(kFullAppClientsKeyPath));
-  ASSERT_TRUE(RegKey::HasKey(kFullAppClientStateKeyPath));
-  ASSERT_SUCCEEDED(RegKey::SetValue(kFullAppClientsKeyPath,
-                                    kRegValueProductVersion,
-                                    _T("0.9.70.0")));
-
-  AppData app_data(kAppGuid, is_machine_);
-  Job job(true, &ping_);
-  job.set_app_data(app_data);
-
-  EXPECT_SUCCEEDED(CheckApplicationRegistration(_T("0.9.70.1"), &job));
-}
-
-TEST_F(InstallManagerInstallAppUserTest,
-       CheckApplicationRegistration_UpdateFailsWhenVersionDoesNotChange) {
-  const TCHAR* keys_to_create[] = {kFullAppClientsKeyPath,
-                                   kFullAppClientStateKeyPath};
-  ASSERT_SUCCEEDED(RegKey::CreateKeys(keys_to_create,
-                                      arraysize(keys_to_create)));
-  ASSERT_TRUE(RegKey::HasKey(kFullAppClientsKeyPath));
-  ASSERT_TRUE(RegKey::HasKey(kFullAppClientStateKeyPath));
-  ASSERT_SUCCEEDED(RegKey::SetValue(kFullAppClientsKeyPath,
-                                    kRegValueProductVersion,
-                                    _T("0.9.70.0")));
-
-  AppData app_data(kAppGuid, is_machine_);
-  Job job(true, &ping_);
-  job.set_app_data(app_data);
-
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_DID_NOT_CHANGE_VERSION,
-            CheckApplicationRegistration(_T("0.9.70.0"), &job));
-}
-#endif
-
-//
-// Negative Tests
-//
-
-TEST_F(InstallManagerInstallAppUserTest,
-       InstallApp_InstallerWithoutFilenameExtension) {
-  app_->next_version()->AddPackage(_T("foo"), 100, _T("hash"));
-
-  // TODO(omaha): We should be able to eliminate this.
-  SetArgumentsInManifest(CString(), _T("1.2.3.4"), app_);
-
-  EXPECT_EQ(GOOPDATEINSTALL_E_FILENAME_INVALID,
-            InstallApp(_T(""), app_, _T("c:\\temp")));
-
-  EXPECT_EQ(STATE_ERROR, app_->state());
-  EXPECT_EQ(PingEvent::EVENT_RESULT_ERROR, GetCompletionResult(app_));
-  EXPECT_EQ(GOOPDATEINSTALL_E_FILENAME_INVALID, GetResultCode(app_));
-  EXPECT_STREQ(
-      _T("The installer filename c:\\temp\\foo is invalid or unsupported."),
-      GetCompletionMessage(app_));
-  EXPECT_TRUE(GetPostInstallLaunchCommandLine(app_).IsEmpty());
-  EXPECT_TRUE(GetPostInstallUrl(app_).IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, GetPostInstallAction(app_));
-}
-
-TEST_F(InstallManagerInstallAppUserTest,
-       InstallApp_UnsupportedInstallerFilenameExtension) {
-  app_->next_version()->AddPackage(_T("foo.bar"), 100, _T("hash"));
-
-  // TODO(omaha): We should be able to eliminate this.
-  SetArgumentsInManifest(CString(), _T("1.2.3.4"), app_);
-
-  EXPECT_EQ(GOOPDATEINSTALL_E_FILENAME_INVALID,
-            InstallApp(_T(""), app_, _T("c:\\temp")));
-
-  EXPECT_EQ(STATE_ERROR, app_->state());
-  EXPECT_EQ(PingEvent::EVENT_RESULT_ERROR, GetCompletionResult(app_));
-  EXPECT_EQ(GOOPDATEINSTALL_E_FILENAME_INVALID, GetResultCode(app_));
-  EXPECT_STREQ(
-      _T("The installer filename c:\\temp\\foo.bar is invalid or unsupported."),
-      GetCompletionMessage(app_));
-  EXPECT_TRUE(GetPostInstallLaunchCommandLine(app_).IsEmpty());
-  EXPECT_TRUE(GetPostInstallUrl(app_).IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, GetPostInstallAction(app_));
-}
-
-TEST_F(InstallManagerInstallAppUserTest, InstallApp_InstallerEmtpyFilename) {
-  // Package asserts that the filename and file path are not NULL.
-  ExpectAsserts expect_asserts;
-
-  app_->next_version()->AddPackage(_T(""), 100, _T("hash"));
-  // This test does not call
-  // app_->next_version()->GetPackage(0)->set_local_file_path().
-
-  // TODO(omaha): We should be able to eliminate this.
-  SetArgumentsInManifest(CString(), _T("1.2.3.4"), app_);
-
-  EXPECT_EQ(GOOPDATEINSTALL_E_FILENAME_INVALID,
-            InstallApp(_T(""), app_, NULL));
-
-  EXPECT_EQ(STATE_ERROR, app_->state());
-  EXPECT_EQ(PingEvent::EVENT_RESULT_ERROR, GetCompletionResult(app_));
-  EXPECT_EQ(GOOPDATEINSTALL_E_FILENAME_INVALID, GetResultCode(app_));
-  EXPECT_STREQ(_T("The installer filename \\ is invalid or unsupported."),
-               GetCompletionMessage(app_));
-  EXPECT_TRUE(GetPostInstallLaunchCommandLine(app_).IsEmpty());
-  EXPECT_TRUE(GetPostInstallUrl(app_).IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, GetPostInstallAction(app_));
-}
-
-TEST_F(InstallManagerInstallAppUserTest, InstallApp_NoPackage) {
-  // InstallApp asserts that there is at least one package.
-  ExpectAsserts expect_asserts;
-
-  EXPECT_EQ(E_FAIL, InstallApp(_T(""), app_, NULL));
-
-  EXPECT_EQ(STATE_ERROR, app_->state());
-  EXPECT_EQ(PingEvent::EVENT_RESULT_ERROR, GetCompletionResult(app_));
-  EXPECT_EQ(E_FAIL, GetResultCode(app_));
-  EXPECT_STREQ(
-      _T("Installation failed. Please try again."),
-      GetCompletionMessage(app_));
-  EXPECT_TRUE(GetPostInstallLaunchCommandLine(app_).IsEmpty());
-  EXPECT_TRUE(GetPostInstallUrl(app_).IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, GetPostInstallAction(app_));
-}
-
-TEST_F(InstallManagerInstallAppUserTest, InstallApp_ExeFileDoesNotExist) {
-  app_->next_version()->AddPackage(_T("foo.exe"), 100, _T("hash"));
-
-  // TODO(omaha): We should be able to eliminate this.
-  SetArgumentsInManifest(CString(), _T("1.2.3.4"), app_);
-
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_FAILED_START,
-            InstallApp(_T(""), app_, _T("c:\\temp")));
-
-  EXPECT_EQ(STATE_ERROR, app_->state());
-  EXPECT_EQ(PingEvent::EVENT_RESULT_ERROR, GetCompletionResult(app_));
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_FAILED_START, GetResultCode(app_));
-  EXPECT_STREQ(_T("The installer failed to start."),
-               GetCompletionMessage(app_));
-
-  EXPECT_FALSE(RegKey::HasKey(kFullAppClientsKeyPath));
-  EXPECT_FALSE(RegKey::HasKey(kFullAppClientStateKeyPath));
-  EXPECT_TRUE(GetPostInstallLaunchCommandLine(app_).IsEmpty());
-  EXPECT_TRUE(GetPostInstallUrl(app_).IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, GetPostInstallAction(app_));
-}
-
-//
-// EXE Installer Tests
-//
-
-// TODO(omaha3): Add InstallApp_ExeInstallerWithoutArgumentsSucceeds using
-// SaveArguments.exe. Do the same in InstallerWrapperUserTest.
-
-// TODO(omaha3): Add InstallApp tests that cause
-// ReadInstallerRegistrationValues & CheckApplicationRegistration to fail.
-
-// This test uses cmd.exe as an installer that leaves the payload
-// kPayloadFileName.
-TEST_F(InstallManagerInstallAppUserTest,
-       InstallApp_ExeInstallerWithArgumentsSucceeds) {
-  const TCHAR kPayloadFileName[] = _T("exe_payload.txt");
-  const TCHAR kCommandToExecute[] = _T("echo \"hi\" > %s");
-
-  CString full_command_to_execute;
-  full_command_to_execute.Format(kCommandToExecute, kPayloadFileName);
-  CString arguments;
-  arguments.Format(kExecuteCommandAndTerminateSwitch, full_command_to_execute);
-
-  EXPECT_SUCCEEDED(File::Remove(kPayloadFileName));
-  EXPECT_FALSE(File::Exists(kPayloadFileName));
-
-  // Create the Clients key since this isn't an actual installer.
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kFullAppClientsKeyPath));
-  EXPECT_TRUE(RegKey::HasKey(kFullAppClientsKeyPath));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kFullAppClientsKeyPath,
-                                    kRegValueProductVersion,
-                                    _T("0.10.69.5")));
-
-  app_->next_version()->AddPackage(kCmdExecutable, 100, _T("hash"));
-  EXPECT_SUCCEEDED(app_->put_displayName(CComBSTR(_T("Exe App"))));
-
-  SetArgumentsInManifest(arguments, _T("0.10.69.5"), app_);
-
-  EXPECT_SUCCEEDED(InstallApp(_T(""), app_, cmd_exe_dir_));
-
-  EXPECT_EQ(STATE_INSTALL_COMPLETE, app_->state());
-  EXPECT_EQ(PingEvent::EVENT_RESULT_SUCCESS, GetCompletionResult(app_));
-  EXPECT_EQ(S_OK, GetResultCode(app_));
-  EXPECT_STREQ(_T("Thanks for installing."), GetCompletionMessage(app_));
-  EXPECT_TRUE(GetPostInstallLaunchCommandLine(app_).IsEmpty());
-  EXPECT_TRUE(GetPostInstallUrl(app_).IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, GetPostInstallAction(app_));
-
-  RegKey state_key;
-  EXPECT_SUCCEEDED(state_key.Open(kFullAppClientStateKeyPath));
-  EXPECT_EQ(1 + kNumAutoPopulatedValues, state_key.GetValueCount());
-  EXPECT_STREQ(_T("0.10.69.5"), GetSzValue(kFullAppClientStateKeyPath,
-                                           kRegValueProductVersion));
-
-  EXPECT_TRUE(File::Exists(kPayloadFileName));
-  EXPECT_SUCCEEDED(File::Remove(kPayloadFileName));
-}
-
-TEST_F(InstallManagerInstallAppUserTest,
-       InstallApp_ExeInstallerReturnsNonZeroExitCode) {
-  const TCHAR kCommandToExecute[] = _T("exit 1");
-
-  CString arguments;
-  arguments.Format(kExecuteCommandAndTerminateSwitch, kCommandToExecute);
-
-  // Create the Clients key since this isn't an actual installer.
-  ASSERT_SUCCEEDED(RegKey::CreateKey(kFullAppClientsKeyPath));
-  ASSERT_TRUE(RegKey::HasKey(kFullAppClientsKeyPath));
-  ASSERT_SUCCEEDED(RegKey::SetValue(kFullAppClientsKeyPath,
-                                    kRegValueProductVersion,
-                                    _T("0.10.69.5")));
-
-  app_->next_version()->AddPackage(kCmdExecutable, 100, _T("hash"));
-
-  SetArgumentsInManifest(arguments, _T("0.10.69.5"), app_);
-
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_FAILED,
-            InstallApp(_T(""), app_, cmd_exe_dir_));
-
-  EXPECT_EQ(STATE_ERROR, app_->state());
-  EXPECT_EQ(PingEvent::EVENT_RESULT_INSTALLER_ERROR_OTHER,
-            GetCompletionResult(app_));
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_FAILED, GetResultCode(app_));
-  EXPECT_STREQ(_T("The installer encountered error 1."),
-               GetCompletionMessage(app_));
-  EXPECT_TRUE(GetPostInstallLaunchCommandLine(app_).IsEmpty());
-  EXPECT_TRUE(GetPostInstallUrl(app_).IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, GetPostInstallAction(app_));
-}
-
-TEST_F(InstallManagerInstallAppMachineTest, InstallApp_MsiInstallerSucceeds) {
-  if (!vista_util::IsUserAdmin()) {
-    std::wcout << _T("\tTest did not run because the user is not an admin.")
-               << std::endl;
-    return;
-  }
-
-  const CString kIid = _T("{F7598FEE-4BA9-4755-A1FC-6EB0A6F3D126}");
-
-  // We can't fake the registry keys because we are interacting with a real
-  // installer.
-  RestoreRegistryHives();
-
-  AdjustMsiTries(installer_wrapper_.get());
-
-  CString installer_dir(app_util::GetCurrentModuleDirectory());
-
-  CString installer_full_path(
-      ConcatenatePath(installer_dir, kSetupFooV1RelativeLocation));
-  ASSERT_TRUE(File::Exists(installer_full_path));
-
-  CString installer_log_full_path;
-  installer_log_full_path.Format(kMsiLogFormat, installer_full_path);
-
-  ASSERT_SUCCEEDED(File::Remove(installer_log_full_path));
-  ASSERT_FALSE(File::Exists(installer_log_full_path));
-
-  RegKey::DeleteKey(kFullFooAppClientKeyPath);
-  ASSERT_FALSE(RegKey::HasKey(kFullFooAppClientKeyPath));
-  RegKey::DeleteKey(kFullFooAppClientStateKeyPath);
-  ASSERT_FALSE(RegKey::HasKey(kFullFooAppClientStateKeyPath));
-
-  // Accepting the EULA prevents "eulaaccepted" value from being written.
-  EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_TRUE));
-
-  // TODO(omaha): This should be just a filename.
-  app_->next_version()->AddPackage(kSetupFooV1RelativeLocation,
-                                   100, _T("hash"));
-  app_->set_app_guid(StringToGuid(kFooId));
-  EXPECT_SUCCEEDED(app_->put_displayName(CComBSTR(_T("Foo"))));
-  EXPECT_SUCCEEDED(app_->put_iid(CComBSTR(kIid)));
-
-  // TODO(omaha): We should be able to eliminate this.
-  SetArgumentsInManifest(CString(), kFooVersion, app_);
-
-  EXPECT_SUCCEEDED(InstallApp(_T(""), app_, installer_dir));
-
-  EXPECT_EQ(STATE_INSTALL_COMPLETE, app_->state());
-  EXPECT_EQ(PingEvent::EVENT_RESULT_SUCCESS, GetCompletionResult(app_));
-  EXPECT_EQ(S_OK, GetResultCode(app_));
-  EXPECT_STREQ(_T("Thanks for installing."),
-               GetCompletionMessage(app_));
-  EXPECT_TRUE(GetPostInstallLaunchCommandLine(app_).IsEmpty());
-  EXPECT_TRUE(GetPostInstallUrl(app_).IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, GetPostInstallAction(app_));
-
-  EXPECT_TRUE(File::Exists(installer_log_full_path));
-
-  EXPECT_TRUE(RegKey::HasKey(kFullFooAppClientKeyPath));
-  EXPECT_TRUE(RegKey::HasKey(kFullFooAppClientStateKeyPath));
-  RegKey state_key;
-  EXPECT_SUCCEEDED(state_key.Open(kFullFooAppClientStateKeyPath));
-  EXPECT_EQ(2 + kNumAutoPopulatedValues, state_key.GetValueCount());
-  EXPECT_STREQ(kFooVersion, GetSzValue(kFullFooAppClientStateKeyPath,
-                                       kRegValueProductVersion));
-  EXPECT_FALSE(RegKey::HasValue(kFullFooAppClientStateKeyPath,
-                                kRegValueLanguage));
-  EXPECT_STREQ(kIid, GetSzValue(kFullFooAppClientStateKeyPath,
-                                kRegValueInstallationId));
-
-  // Verify the installer did not write a value that is to be written only in
-  // the presence of an MSI property that was not specified.
-  EXPECT_FALSE(RegKey::HasValue(kFullFooAppClientKeyPath,
-                                kFooInstallerBarValueName));
-
-  UninstallTestMsi(installer_full_path);
-
-  EXPECT_FALSE(RegKey::HasKey(kFullFooAppClientKeyPath));
-  EXPECT_SUCCEEDED(RegKey::DeleteKey(kFullFooAppClientKeyPath));
-}
-
-TEST_F(InstallManagerInstallAppMachineTest,
-       InstallApp_MsiInstallerWithArgumentSucceeds) {
-  if (!vista_util::IsUserAdmin()) {
-    std::wcout << _T("\tTest did not run because the user is not an admin.")
-               << std::endl;
-    return;
-  }
-
-  // We can't fake the registry keys because we are interacting with a real
-  // installer.
-  RestoreRegistryHives();
-
-  AdjustMsiTries(installer_wrapper_.get());
-
-  CString installer_dir(app_util::GetCurrentModuleDirectory());
-
-  CString installer_full_path(
-      ConcatenatePath(installer_dir, kSetupFooV1RelativeLocation));
-  ASSERT_TRUE(File::Exists(installer_full_path));
-
-  CString installer_log_full_path;
-  installer_log_full_path.Format(kMsiLogFormat, installer_full_path);
-
-  ASSERT_SUCCEEDED(File::Remove(installer_log_full_path));
-  ASSERT_FALSE(File::Exists(installer_log_full_path));
-
-  RegKey::DeleteKey(kFullFooAppClientKeyPath);
-  ASSERT_FALSE(RegKey::HasKey(kFullFooAppClientKeyPath));
-  RegKey::DeleteKey(kFullFooAppClientStateKeyPath);
-  ASSERT_FALSE(RegKey::HasKey(kFullFooAppClientStateKeyPath));
-
-  // Write an iid to verify it gets deleted below.
-  EXPECT_SUCCEEDED(
-      RegKey::SetValue(kFullFooAppClientStateKeyPath,
-                       kRegValueInstallationId,
-                       _T("{A30B6C0A-B491-473e-9D24-E1AC1BC1D42F}")));
-
-  // Accepting the EULA prevents "eulaaccepted" value from being written.
-  EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_TRUE));
-
-  // TODO(omaha): This should be just a filename.
-  app_->next_version()->AddPackage(kSetupFooV1RelativeLocation,
-                                   100, _T("hash"));
-  app_->set_app_guid(StringToGuid(kFooId));
-  EXPECT_SUCCEEDED(app_->put_displayName(CComBSTR(_T("Foo"))));
-
-  SetArgumentsInManifest(kFooInstallerBarPropertyArg, kFooVersion, app_);
-
-  EXPECT_SUCCEEDED(InstallApp(_T(""), app_, installer_dir));
-
-  EXPECT_EQ(STATE_INSTALL_COMPLETE, app_->state());
-  EXPECT_EQ(PingEvent::EVENT_RESULT_SUCCESS, GetCompletionResult(app_));
-  EXPECT_EQ(S_OK, GetResultCode(app_));
-  EXPECT_STREQ(_T("Thanks for installing."),
-               GetCompletionMessage(app_));
-  EXPECT_TRUE(GetPostInstallLaunchCommandLine(app_).IsEmpty());
-  EXPECT_TRUE(GetPostInstallUrl(app_).IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, GetPostInstallAction(app_));
-
-  EXPECT_TRUE(File::Exists(installer_log_full_path));
-
-  EXPECT_TRUE(RegKey::HasKey(kFullFooAppClientKeyPath));
-  EXPECT_TRUE(RegKey::HasKey(kFullFooAppClientStateKeyPath));
-  RegKey state_key;
-  EXPECT_SUCCEEDED(state_key.Open(kFullFooAppClientStateKeyPath));
-  EXPECT_EQ(1 + kNumAutoPopulatedValues, state_key.GetValueCount());
-  EXPECT_STREQ(kFooVersion, GetSzValue(kFullFooAppClientStateKeyPath,
-                                       kRegValueProductVersion));
-  EXPECT_FALSE(RegKey::HasValue(kFullFooAppClientStateKeyPath,
-                                kRegValueLanguage));
-  EXPECT_FALSE(RegKey::HasValue(kFullFooAppClientStateKeyPath,
-                                kRegValueInstallationId));
-
-  EXPECT_TRUE(RegKey::HasValue(kFullFooAppClientKeyPath,
-                               kFooInstallerBarValueName));
-  DWORD barprop_value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kFullFooAppClientKeyPath,
-                                    kFooInstallerBarValueName,
-                                    &barprop_value));
-  EXPECT_EQ(7, barprop_value);
-
-  UninstallTestMsi(installer_full_path);
-
-  EXPECT_FALSE(RegKey::HasKey(kFullFooAppClientKeyPath));
-  EXPECT_SUCCEEDED(RegKey::DeleteKey(kFullFooAppClientKeyPath));
-}
-
-// The use of kGoogleUpdateAppId is the key to this test.
-// Note that the version is not changed - this is the normal self-update case.
-// Among other things, this test verifies that CheckApplicationRegistration() is
-// not called for self-updates.
-TEST_F(InstallManagerInstallAppUserTest, InstallApp_UpdateOmahaSucceeds) {
-  CString arguments;
-  arguments.Format(kExecuteCommandAndTerminateSwitch, _T(""));
-
-  const CString kExistingVersion(_T("0.9.69.5"));
-
-  app_->next_version()->AddPackage(kCmdExecutable, 100, _T("hash"));
-  app_->set_app_guid(StringToGuid(kGoogleUpdateAppId));
-
-  // TODO(omaha3): This isn't supported yet.
-#if 0
-  isupdate = true
-#endif
-
-  SetArgumentsInManifest(arguments, _T("1.2.9.8"), app_);
-
-  // Because we don't actually run the Omaha installer, we need to make sure
-  // its Clients key and pv value exist to avoid an error.
-  ASSERT_SUCCEEDED(RegKey::CreateKey(USER_REG_CLIENTS_GOOPDATE));
-  ASSERT_TRUE(RegKey::HasKey(USER_REG_CLIENTS_GOOPDATE));
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    kExistingVersion));
-
-  EXPECT_SUCCEEDED(InstallApp(kExistingVersion, app_, cmd_exe_dir_));
-
-  EXPECT_EQ(STATE_INSTALL_COMPLETE, app_->state());
-  EXPECT_EQ(PingEvent::EVENT_RESULT_SUCCESS, GetCompletionResult(app_));
-  EXPECT_EQ(S_OK, GetResultCode(app_));
-  EXPECT_STREQ(_T("Thanks for installing."), GetCompletionMessage(app_));
-  EXPECT_TRUE(GetPostInstallLaunchCommandLine(app_).IsEmpty());
-  EXPECT_TRUE(GetPostInstallUrl(app_).IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, GetPostInstallAction(app_));
-
-  EXPECT_TRUE(RegKey::HasKey(USER_REG_CLIENTS_GOOPDATE));
-  CString version;
-  EXPECT_SUCCEEDED(RegKey::GetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    &version));
-  EXPECT_STREQ(kExistingVersion, version);
-}
-
-// The main purpose of this test is to ensure that self-updates don't fail if
-// Omaha's Clients key doesn't exist for some reason.
-// In other words, it tests that CheckApplicationRegistration() is not called.
-TEST_F(InstallManagerInstallAppUserTest,
-       InstallApp_UpdateOmahaSucceedsWhenClientsKeyAbsent) {
-  CString arguments;
-  arguments.Format(kExecuteCommandAndTerminateSwitch, _T(""));
-
-  const CString kExistingVersion(_T("0.9.69.5"));
-
-  app_->next_version()->AddPackage(kCmdExecutable, 100, _T("hash"));
-  app_->set_app_guid(StringToGuid(kGoogleUpdateAppId));
-
-  // TODO(omaha3): This isn't supported yet.
-#if 0
-  isupdate = true
-#endif
-
-  SetArgumentsInManifest(arguments, _T("1.2.9.8"), app_);
-
-  EXPECT_SUCCEEDED(InstallApp(kExistingVersion, app_, cmd_exe_dir_));
-
-  EXPECT_EQ(STATE_INSTALL_COMPLETE, app_->state());
-  EXPECT_EQ(PingEvent::EVENT_RESULT_SUCCESS, GetCompletionResult(app_));
-  EXPECT_EQ(S_OK, GetResultCode(app_));
-  EXPECT_STREQ(_T("Thanks for installing."), GetCompletionMessage(app_));
-  EXPECT_TRUE(GetPostInstallLaunchCommandLine(app_).IsEmpty());
-  EXPECT_TRUE(GetPostInstallUrl(app_).IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, GetPostInstallAction(app_));
-
-  EXPECT_FALSE(RegKey::HasKey(USER_REG_CLIENTS_GOOPDATE));
-}
-
-TEST_F(InstallManagerInstallAppUserTest,
-       InstallApp_InstallerDoesNotWriteClientsKey) {
-  CString arguments;
-  arguments.Format(kExecuteCommandAndTerminateSwitch, _T(""));
-
-  app_->next_version()->AddPackage(kCmdExecutable, 100, _T("hash"));
-  EXPECT_SUCCEEDED(app_->put_displayName(CComBSTR(_T("Some App"))));
-
-  SetArgumentsInManifest(arguments, _T("5.6.7.8"), app_);
-
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_DID_NOT_WRITE_CLIENTS_KEY,
-            InstallApp(_T(""), app_, cmd_exe_dir_));
-
-  EXPECT_FALSE(RegKey::HasKey(kFullAppClientsKeyPath));
-  EXPECT_FALSE(RegKey::HasKey(kFullAppClientStateKeyPath));
-
-  EXPECT_EQ(STATE_ERROR, app_->state());
-  EXPECT_EQ(PingEvent::EVENT_RESULT_ERROR, GetCompletionResult(app_));
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_DID_NOT_WRITE_CLIENTS_KEY,
-            GetResultCode(app_));
-  EXPECT_STREQ(
-      _T("Installation failed. Please try again."),
-      GetCompletionMessage(app_));
-  EXPECT_TRUE(GetPostInstallLaunchCommandLine(app_).IsEmpty());
-  EXPECT_TRUE(GetPostInstallUrl(app_).IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, GetPostInstallAction(app_));
-}
-
-// TODO(omaha3): Test for GOOPDATEINSTALL_E_INSTALLER_DID_NOT_CHANGE_VERSION
-// once is_update is supported.
-
-TEST_F(InstallManagerInstallAppUserTest,
-       InstallApp_InstallerFailureMsiFileDoesNotExist) {
-  CPath msi_dir(app_util::GetTempDir());
-  CPath msi_path(msi_dir);
-  msi_path.Append(_T("foo.msi"));
-  const CString log_path = msi_path + _T(".log");
-
-  AdjustMsiTries(installer_wrapper_.get());
-
-  ASSERT_SUCCEEDED(File::Remove(log_path));
-  ASSERT_FALSE(File::Exists(log_path));
-
-  app_->next_version()->AddPackage(_T("foo.msi"), 100, _T("hash"));
-
-  // TODO(omaha): We should be able to eliminate this.
-  SetArgumentsInManifest(CString(), _T("1.2.3.4"), app_);
-
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_FAILED,
-            InstallApp(_T(""), app_, msi_dir));
-
-  EXPECT_EQ(STATE_ERROR, app_->state());
-  EXPECT_EQ(PingEvent::EVENT_RESULT_INSTALLER_ERROR_MSI,
-            GetCompletionResult(app_));
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_FAILED, GetResultCode(app_));
-  const CString message = GetCompletionMessage(app_);
-  EXPECT_STREQ(kError1619MessagePrefix,
-               message.Left(kError1619MessagePrefixLength));
-  VerifyStringIsMsiPackageOpenFailedString(
-      message.Mid(kError1619MessagePrefixLength));
-  EXPECT_TRUE(GetPostInstallLaunchCommandLine(app_).IsEmpty());
-  EXPECT_TRUE(GetPostInstallUrl(app_).IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, GetPostInstallAction(app_));
-
-  // msiexec creates an empty log file.
-  EXPECT_TRUE(File::Exists(log_path));
-  EXPECT_SUCCEEDED(File::Remove(log_path));
-
-  EXPECT_FALSE(RegKey::HasKey(kFullAppClientsKeyPath));
-  EXPECT_FALSE(RegKey::HasKey(kFullAppClientStateKeyPath));
-}
-
-// Simulates the MSI busy error by having an exe installer return the error
-// as its exit code and specifying MSI error using Installer Result API.
-// Assumes reg.exe is in the path.
-// This works because the number of retries is set before InstallApp() and thus
-// defaults to 1 in the InstallerWrapper.
-TEST_F(InstallManagerInstallAppUserTest, InstallApp_MsiIsBusy_NoRetries) {
-  CString commands;
-  commands.Format(kExecuteTwoCommandsFormat,
-                  set_installer_result_type_msi_error_cmd_,
-                  kMsiInstallerBusyExitCodeCmd);
-
-  CString arguments;
-  arguments.Format(kExecuteCommandAndTerminateSwitch, commands);
-
-  app_->next_version()->AddPackage(kCmdExecutable, 100, _T("hash"));
-  EXPECT_SUCCEEDED(app_->put_displayName(CComBSTR(_T("Some App"))));
-
-  SetArgumentsInManifest(arguments, _T("1.2.3.4"), app_);
-
-  LowResTimer install_timer(true);
-
-  EXPECT_EQ(GOOPDATEINSTALL_E_MSI_INSTALL_ALREADY_RUNNING,
-            InstallApp(_T(""), app_, cmd_exe_dir_));
-
-  EXPECT_GT(2, install_timer.GetSeconds());  // Check Omaha did not retry.
-
-  EXPECT_EQ(STATE_ERROR, app_->state());
-  // Even though the error came from the installer, the error type is not
-  // set because we have a custom error for this case.
-  EXPECT_EQ(PingEvent::EVENT_RESULT_ERROR, GetCompletionResult(app_));
-  EXPECT_EQ(GOOPDATEINSTALL_E_MSI_INSTALL_ALREADY_RUNNING,
-            GetResultCode(app_));
-  EXPECT_STREQ(kMsiInstallerBusyErrorMessage, GetCompletionMessage(app_));
-  EXPECT_TRUE(GetPostInstallLaunchCommandLine(app_).IsEmpty());
-  EXPECT_TRUE(GetPostInstallUrl(app_).IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, GetPostInstallAction(app_));
-}
-
-// This test uses cmd.exe as an installer that leaves the payload files.
-TEST_F(InstallManagerInstallAppUserTest, InstallApp_InstallMultipleApps) {
-  const TCHAR kPayloadFileName1[] = _T("exe_payload1.txt");
-  const TCHAR kPayloadFileName2[] = _T("exe_payload2.txt");
-  const TCHAR kCommandToExecute[] = _T("echo \"hi\" > %s");
-
-  CString full_command_to_execute;
-  full_command_to_execute.Format(kCommandToExecute, kPayloadFileName1);
-  CString arguments1;
-  arguments1.Format(kExecuteCommandAndTerminateSwitch, full_command_to_execute);
-
-  full_command_to_execute.Format(kCommandToExecute, kPayloadFileName2);
-  CString arguments2;
-  arguments2.Format(kExecuteCommandAndTerminateSwitch, full_command_to_execute);
-
-  EXPECT_SUCCEEDED(File::Remove(kPayloadFileName1));
-  EXPECT_FALSE(File::Exists(kPayloadFileName1));
-  EXPECT_SUCCEEDED(File::Remove(kPayloadFileName2));
-  EXPECT_FALSE(File::Exists(kPayloadFileName2));
-
-  // Create the Clients key since this isn't an actual installer.
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kFullAppClientsKeyPath));
-  EXPECT_TRUE(RegKey::HasKey(kFullAppClientsKeyPath));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kFullAppClientsKeyPath,
-                                    kRegValueProductVersion,
-                                    _T("0.10.69.5")));
-
-  app_->next_version()->AddPackage(kCmdExecutable, 100, _T("hash"));
-  EXPECT_SUCCEEDED(app_->put_displayName(CComBSTR(_T("Exe App"))));
-
-  SetArgumentsInManifest(arguments1, _T("0.10.69.5"), app_);
-
-  EXPECT_SUCCEEDED(InstallApp(_T(""), app_, cmd_exe_dir_));
-
-  EXPECT_EQ(STATE_INSTALL_COMPLETE, app_->state());
-  EXPECT_EQ(PingEvent::EVENT_RESULT_SUCCESS, GetCompletionResult(app_));
-  EXPECT_EQ(S_OK, GetResultCode(app_));
-  EXPECT_STREQ(_T("Thanks for installing."), GetCompletionMessage(app_));
-  EXPECT_TRUE(GetPostInstallLaunchCommandLine(app_).IsEmpty());
-  EXPECT_TRUE(GetPostInstallUrl(app_).IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, GetPostInstallAction(app_));
-
-  EXPECT_TRUE(File::Exists(kPayloadFileName1));
-  EXPECT_SUCCEEDED(File::Remove(kPayloadFileName1));
-
-  // Run the second installer.
-
-  App* app2 = NULL;
-  ASSERT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kApp2Id), &app2));
-  SetAppStateWaitingToInstall(app2);
-
-  // Create the Clients key since this isn't an actual installer.
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kFullAppClientsKeyPath));
-  EXPECT_TRUE(RegKey::HasKey(kFullAppClientsKeyPath));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kFullApp2ClientsKeyPath,
-                                    kRegValueProductVersion,
-                                    _T("0.10.69.5")));
-
-  app2->next_version()->AddPackage(kCmdExecutable, 100, _T("hash"));
-  EXPECT_SUCCEEDED(app2->put_displayName(CComBSTR(_T("Exe App"))));
-
-  SetArgumentsInManifest(arguments2, _T("0.10.69.5"), app2);
-
-  EXPECT_SUCCEEDED(InstallApp(_T(""), app2, cmd_exe_dir_));
-
-  EXPECT_EQ(STATE_INSTALL_COMPLETE, app2->state());
-  EXPECT_EQ(PingEvent::EVENT_RESULT_SUCCESS, GetCompletionResult(app2));
-  EXPECT_EQ(S_OK, GetResultCode(app2));
-  EXPECT_STREQ(_T("Thanks for installing."), GetCompletionMessage(app2));
-  EXPECT_TRUE(GetPostInstallLaunchCommandLine(app_).IsEmpty());
-  EXPECT_TRUE(GetPostInstallUrl(app_).IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, GetPostInstallAction(app_));
-
-  EXPECT_TRUE(File::Exists(kPayloadFileName2));
-  EXPECT_SUCCEEDED(File::Remove(kPayloadFileName2));
-}
-
-TEST_F(InstallManagerInstallAppUserTest,
-       PopulateSuccessfulInstallResultInfo_ExitSilentlyOnLaunchCommandWithNoCommand) {  // NOLINT
-  SetPostInstallActionInManifest(SUCCESS_ACTION_EXIT_SILENTLY_ON_LAUNCH_CMD,
-                                 _T(""),
-                                 false,
-                                 app_);
-
-  InstallerResultInfo result_info;
-  result_info.type = INSTALLER_RESULT_SUCCESS;
-  PopulateSuccessfulInstallResultInfo(app_, &result_info);
-  EXPECT_TRUE(GetPostInstallLaunchCommandLine(app_).IsEmpty());
-  EXPECT_TRUE(GetPostInstallUrl(app_).IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info.post_install_action);
-}
-
-// Verify that launch command is converted to silently launch command
-// if success action is silently launch command. Also tests that launch cmd
-// takes precedence over URL.
-TEST_F(InstallManagerInstallAppUserTest,
-       PopulateSuccessfulInstallResultInfo_ExitSilentlyOnLaunchCommand) {
-  SetPostInstallActionInManifest(SUCCESS_ACTION_EXIT_SILENTLY_ON_LAUNCH_CMD,
-                                 _T("http://post_install_succeeded"),
-                                 true,
-                                 app_);
-
-  InstallerResultInfo result_info;
-  result_info.type = INSTALLER_RESULT_SUCCESS;
-  result_info.post_install_action = POST_INSTALL_ACTION_LAUNCH_COMMAND;
-  result_info.post_install_launch_command_line = _T("notepad.exe");
-  PopulateSuccessfulInstallResultInfo(app_, &result_info);
-
-  EXPECT_EQ(POST_INSTALL_ACTION_EXIT_SILENTLY_ON_LAUNCH_COMMAND,
-            result_info.post_install_action);
-}
-
-TEST_F(InstallManagerInstallAppUserTest,
-    PopulateSuccessfulInstallResultInfo_LaunchCommandWithDefaultSuccessAction) {
-  SetPostInstallActionInManifest(SUCCESS_ACTION_DEFAULT,
-                                 _T(""),
-                                 true,
-                                 app_);
-
-  InstallerResultInfo result_info;
-  result_info.type = INSTALLER_RESULT_SUCCESS;
-  result_info.post_install_action = POST_INSTALL_ACTION_LAUNCH_COMMAND;
-  result_info.post_install_launch_command_line = _T("notepad.exe");
-  PopulateSuccessfulInstallResultInfo(app_, &result_info);
-
-  EXPECT_EQ(POST_INSTALL_ACTION_LAUNCH_COMMAND,
-            result_info.post_install_action);
-}
-
-// Verify that default install action is converted to exit silently if
-// if success action is exit silently.
-TEST_F(InstallManagerInstallAppUserTest,
-       PopulateSuccessfulInstallResultInfo_ExitSilently) {
-  SetPostInstallActionInManifest(SUCCESS_ACTION_EXIT_SILENTLY,
-                                 _T(""),
-                                 false,
-                                 app_);
-
-  InstallerResultInfo result_info;
-  result_info.type = INSTALLER_RESULT_SUCCESS;
-  result_info.post_install_action = POST_INSTALL_ACTION_DEFAULT;
-  PopulateSuccessfulInstallResultInfo(app_, &result_info);
-
-  EXPECT_EQ(POST_INSTALL_ACTION_EXIT_SILENTLY, result_info.post_install_action);
-}
-
-TEST_F(InstallManagerInstallAppUserTest,
-       PopulateSuccessfulInstallResultInfo_RestartBrowser) {
-  SetPostInstallActionInManifest(SUCCESS_ACTION_DEFAULT,
-                                 _T("http://www.google.com/foo/installed_ok"),
-                                 false,
-                                 app_);
-
-  InstallerResultInfo result_info;
-  result_info.type = INSTALLER_RESULT_SUCCESS;
-  result_info.post_install_action = POST_INSTALL_ACTION_DEFAULT;
-  PopulateSuccessfulInstallResultInfo(app_, &result_info);
-
-  EXPECT_EQ(POST_INSTALL_ACTION_RESTART_BROWSER,
-            result_info.post_install_action);
-}
-
-TEST_F(InstallManagerInstallAppUserTest,
-       PopulateSuccessfulInstallResultInfo_RestartAllBrowsers) {
-  SetPostInstallActionInManifest(SUCCESS_ACTION_DEFAULT,
-                                 _T("http://www.google.com/gears/installed_ok"),
-                                 true,
-                                 app_);
-
-  InstallerResultInfo result_info;
-  result_info.type = INSTALLER_RESULT_SUCCESS;
-  result_info.post_install_action = POST_INSTALL_ACTION_DEFAULT;
-  PopulateSuccessfulInstallResultInfo(app_, &result_info);
-
-  EXPECT_EQ(POST_INSTALL_ACTION_RESTART_ALL_BROWSERS,
-            result_info.post_install_action);
-}
-
-TEST_F(InstallManagerInstallAppUserTest,
-       PopulateSuccessfulInstallResultInfo_NoPostInstallUrl) {
-  SetPostInstallActionInManifest(SUCCESS_ACTION_DEFAULT,
-                                 _T(""),
-                                 true,
-                                 app_);
-
-  InstallerResultInfo result_info;
-  result_info.type = INSTALLER_RESULT_SUCCESS;
-  result_info.post_install_action = POST_INSTALL_ACTION_DEFAULT;
-  PopulateSuccessfulInstallResultInfo(app_, &result_info);
-
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info.post_install_action);
-}
-
-
-TEST_F(InstallManagerInstallAppUserTest,
-       PopulateSuccessfulInstallResultInfo_RebootShouldNotBeOverridden) {
-  const SuccessfulInstallAction kSuccessActions[] = {
-    SUCCESS_ACTION_DEFAULT,
-    SUCCESS_ACTION_EXIT_SILENTLY,
-    SUCCESS_ACTION_EXIT_SILENTLY_ON_LAUNCH_CMD,
-  };
-
-  for (int i = 0; i < arraysize(kSuccessActions); ++i) {
-    SetPostInstallActionInManifest(kSuccessActions[i],
-                                   _T("http://foo/bar"),
-                                   true,
-                                   app_);
-
-    InstallerResultInfo result_info;
-    result_info.type = INSTALLER_RESULT_SUCCESS;
-    result_info.post_install_action = POST_INSTALL_ACTION_REBOOT;
-    result_info.post_install_launch_command_line = _T("foo.exe");
-    PopulateSuccessfulInstallResultInfo(app_, &result_info);
-
-    EXPECT_EQ(POST_INSTALL_ACTION_REBOOT, result_info.post_install_action);
-  }
-}
-
-}  // namespace omaha
diff --git a/goopdate/installer_result_info.h b/goopdate/installer_result_info.h
deleted file mode 100644
index d90de14..0000000
--- a/goopdate/installer_result_info.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_INSTALLER_RESULT_INFO_H_
-#define OMAHA_GOOPDATE_INSTALLER_RESULT_INFO_H_
-
-#include <atlstr.h>
-#include "goopdate/omaha3_idl.h"
-#include "omaha/common/const_goopdate.h"
-
-namespace omaha {
-
-// TODO(omaha3): perhaps rename "text" to "message".
-struct InstallerResultInfo {
-  InstallerResultInfo()
-      : type(INSTALLER_RESULT_UNKNOWN),
-        code(0),
-        extra_code1(0),
-        post_install_action(POST_INSTALL_ACTION_DEFAULT) {}
-
-  InstallerResultType type;
-  DWORD code;
-  DWORD extra_code1;
-  CString text;
-  CString post_install_launch_command_line;
-  CString post_install_url;
-  PostInstallAction post_install_action;
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_INSTALLER_RESULT_INFO_H_
diff --git a/goopdate/installer_wrapper.cc b/goopdate/installer_wrapper.cc
deleted file mode 100644
index ce9fea0..0000000
--- a/goopdate/installer_wrapper.cc
+++ /dev/null
@@ -1,723 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/installer_wrapper.h"
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/const_utils.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/path.h"
-#include "omaha/base/process.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/string.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/system_info.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/goopdate/app_manager.h"
-#include "omaha/goopdate/server_resource.h"
-#include "omaha/goopdate/string_formatter.h"
-#include "omaha/goopdate/worker_metrics.h"
-
-namespace omaha {
-
-namespace {
-
-CString BuildMsiCommandLine(const CString& arguments,
-                            const CString& msi_file_path,
-                            const CString& enclosed_installer_data_file_path) {
-  CORE_LOG(L3, (_T("[CreateMsiCommandLine]")));
-
-  CString command_line;
-  // Suppressing reboots can lead to an inconsistent state until the user
-  // reboots, but automatically rebooting is unacceptable. The user will be
-  // informed by the string for ERROR_SUCCESS_REBOOT_REQUIRED that a reboot is
-  // necessary. See http://b/1184091 for details.
-
-  if (!enclosed_installer_data_file_path.IsEmpty()) {
-    SafeCStringFormat(&command_line, _T("INSTALLERDATA=%s "),
-                      enclosed_installer_data_file_path);
-  }
-
-  SafeCStringAppendFormat(&command_line, _T("%s %s /qn /i \"%s\""),
-                          arguments,
-                          kMsiSuppressAllRebootsCmdLine,
-                          msi_file_path);
-
-  // The msiexec version in XP SP2 (V 3.01) and higher supports the /log switch.
-  if (SystemInfo::OSWinXPSP2OrLater()) {
-    CString logfile(msi_file_path);
-    logfile.Append(_T(".log"));
-
-    SafeCStringAppendFormat(&command_line, _T(" /log \"%s\""), logfile);
-  }
-
-  CORE_LOG(L2, (_T("[msiexec command line][%s]"), command_line));
-  return command_line;
-}
-
-// Gets the installer exit code.
-HRESULT GetInstallerExitCode(const Process& p, uint32* exit_code) {
-  ASSERT1(exit_code);
-
-  if (p.Running()) {
-    ASSERT(false,
-           (_T("GetInstallerExitCode called while the process is running.")));
-    return GOOPDATEINSTALL_E_INSTALLER_INTERNAL_ERROR;
-  }
-
-  if (!p.GetExitCode(exit_code)) {
-    ASSERT(false,
-           (_T("[Failed to get the installer exit code for some reason.]")));
-    return GOOPDATEINSTALL_E_INSTALLER_INTERNAL_ERROR;
-  }
-
-  CORE_LOG(L2, (_T("[Installer exit code][%u]"), *exit_code));
-
-  return S_OK;
-}
-
-// Gets the errors string for the specified system error.
-// Assumes error_code represents a system error.
-void GetSystemErrorString(uint32 error_code,
-                          const CString& language,
-                          CString* error_string) {
-  ASSERT1(error_string);
-  ASSERT1(ERROR_SUCCESS != error_code);
-
-  const CString error_code_string = FormatErrorCode(error_code);
-
-  StringFormatter formatter(language);
-
-  const CString error_message(GetMessageForSystemErrorCode(error_code));
-  if (!error_message.IsEmpty()) {
-    VERIFY1(SUCCEEDED(formatter.FormatMessage(error_string,
-                                              IDS_INSTALLER_FAILED_WITH_MESSAGE,
-                                              error_code_string,
-                                              error_message)));
-  } else {
-    VERIFY1(SUCCEEDED(formatter.FormatMessage(error_string,
-                                              IDS_INSTALLER_FAILED_NO_MESSAGE,
-                                              error_code_string)));
-  }
-
-  OPT_LOG(LEVEL_ERROR, (_T("[installer system error][%u][%s]"),
-                        error_code, *error_string));
-  ASSERT1(!error_string->IsEmpty());
-}
-
-}  // namespace
-
-InstallerWrapper::InstallerWrapper(bool is_machine)
-    : is_machine_(is_machine),
-      num_tries_when_msi_busy_(1) {
-  CORE_LOG(L3, (_T("[InstallerWrapper::InstallerWrapper]")));
-}
-
-InstallerWrapper::~InstallerWrapper() {
-  CORE_LOG(L3, (_T("[InstallerWrapper::~InstallerWrapper]")));
-}
-
-HRESULT InstallerWrapper::Initialize() {
-  NamedObjectAttributes lock_attr;
-  // TODO(omaha3): We might want to move this lock to the InstallManager.
-  GetNamedObjectAttributes(kInstallManagerSerializer, is_machine_, &lock_attr);
-  if (!installer_lock_.InitializeWithSecAttr(lock_attr.name, &lock_attr.sa)) {
-    OPT_LOG(LEVEL_ERROR, (_T("[Could not init Install Manager lock]")));
-    return GOOPDATEINSTALL_E_FAILED_INIT_INSTALLER_LOCK;
-  }
-
-  return S_OK;
-}
-
-// result_* will be populated if the installer ran and exited, regardless of the
-// return value.
-// Assumes the call is protected by some mechanism providing exclusive access
-// to the app's registry keys in Clients and ClientState.
-HRESULT InstallerWrapper::InstallApp(HANDLE user_token,
-                                   const GUID& app_guid,
-                                   const CString& installer_path,
-                                   const CString& arguments,
-                                   const CString& installer_data,
-                                   const CString& language,
-                                   InstallerResultInfo* result_info) {
-  ASSERT1(result_info);
-
-  HRESULT hr = DoInstallApp(user_token,
-                            app_guid,
-                            installer_path,
-                            arguments,
-                            installer_data,
-                            language,
-                            result_info);
-
-  ASSERT1((SUCCEEDED(hr) && result_info->type == INSTALLER_RESULT_SUCCESS) ||
-          (GOOPDATEINSTALL_E_INSTALLER_FAILED == hr &&
-           (result_info->type == INSTALLER_RESULT_ERROR_MSI ||
-            result_info->type == INSTALLER_RESULT_ERROR_SYSTEM ||
-            result_info->type == INSTALLER_RESULT_ERROR_OTHER)) ||
-          (GOOPDATEINSTALL_E_MSI_INSTALL_ALREADY_RUNNING == hr &&
-           (result_info->type == INSTALLER_RESULT_ERROR_MSI ||
-            result_info->type == INSTALLER_RESULT_ERROR_SYSTEM)) ||
-          (FAILED(hr) && result_info->type == INSTALLER_RESULT_UNKNOWN));
-  ASSERT1(!result_info->text.IsEmpty() ==
-              (GOOPDATEINSTALL_E_INSTALLER_FAILED == hr ||
-               GOOPDATEINSTALL_E_MSI_INSTALL_ALREADY_RUNNING == hr) ||
-          SUCCEEDED(hr));  // Successes may or may not have messages.
-
-  CORE_LOG(L3, (_T("[InstallApp result][0x%x][%s][type: %d][code: %d][%s][%s]"),
-                hr, GuidToString(app_guid), result_info->type,
-                result_info->code, result_info->text,
-                result_info->post_install_launch_command_line));
-  return hr;
-}
-
-CString InstallerWrapper::GetMessageForError(HRESULT error_code,
-                                             const CString& installer_filename,
-                                             const CString& language) {
-  CString message;
-  StringFormatter formatter(language);
-
-  switch (error_code) {
-    case GOOPDATEINSTALL_E_FILENAME_INVALID:
-      VERIFY1(SUCCEEDED(formatter.FormatMessage(&message,
-                                                IDS_INVALID_INSTALLER_FILENAME,
-                                                installer_filename)));
-      break;
-    case GOOPDATEINSTALL_E_INSTALLER_FAILED_START:
-      VERIFY1(SUCCEEDED(formatter.LoadString(IDS_INSTALLER_FAILED_TO_START,
-                                             &message)));
-      break;
-    case GOOPDATEINSTALL_E_INSTALLER_TIMED_OUT:
-      VERIFY1(SUCCEEDED(formatter.LoadString(IDS_INSTALLER_TIMED_OUT,
-                                             &message)));
-      break;
-    case GOOPDATEINSTALL_E_INSTALLER_DID_NOT_WRITE_CLIENTS_KEY:
-    case GOOPDATEINSTALL_E_INSTALLER_DID_NOT_CHANGE_VERSION:
-    case GOOPDATEINSTALL_E_INSTALLER_VERSION_MISMATCH:
-      VERIFY1(SUCCEEDED(formatter.LoadString(IDS_INSTALL_FAILED, &message)));
-      break;
-    case GOOPDATEINSTALL_E_MSI_INSTALL_ALREADY_RUNNING:
-      VERIFY1(SUCCEEDED(formatter.LoadString(IDS_MSI_INSTALL_ALREADY_RUNNING,
-                                             &message)));
-      break;
-    case GOOPDATEINSTALL_E_INSTALLER_FAILED:
-      ASSERT(false,
-             (_T("[GetOmahaErrorTextToReport]")
-              _T("GOOPDATEINSTALL_E_INSTALLER_FAILED should never be reported ")
-              _T("directly. The installer error string should be reported.")));
-      VERIFY1(SUCCEEDED(formatter.LoadString(IDS_INSTALL_FAILED, &message)));
-      break;
-    case GOOPDATEINSTALL_E_INSTALLER_INTERNAL_ERROR:
-    default:
-      ASSERT(false, (_T("[GetOmahaErrorTextToReport]")
-                     _T("[An Omaha error occurred that this method does not ")
-                     _T("know how to report.][0x%08x]"), error_code));
-      VERIFY1(SUCCEEDED(formatter.LoadString(IDS_INSTALL_FAILED, &message)));
-      break;
-  }
-
-  ASSERT1(!message.IsEmpty());
-  return message;
-}
-
-void InstallerWrapper::set_num_tries_when_msi_busy(
-    int num_tries_when_msi_busy) {
-  ASSERT1(num_tries_when_msi_busy >= 1);
-  num_tries_when_msi_busy_ = num_tries_when_msi_busy;
-}
-
-HRESULT InstallerWrapper::BuildCommandLineFromFilename(
-    const CString& file_path,
-    const CString& arguments,
-    const CString& installer_data,
-    CString* executable_path,
-    CString* command_line,
-    InstallerType* installer_type) {
-  CORE_LOG(L3, (_T("[BuildCommandLineFromFilename]")));
-
-  ASSERT1(executable_path);
-  ASSERT1(command_line);
-  ASSERT1(installer_type);
-
-  *executable_path = _T("");
-  *command_line = _T("");
-  *installer_type = UNKNOWN_INSTALLER;
-
-  // The app's installer owns the lifetime of installer data file if it has been
-  // created, so Omaha does not delete it.
-  CString enclosed_installer_data_file_path;
-
-  VERIFY1(SUCCEEDED(goopdate_utils::WriteInstallerDataToTempFile(
-      installer_data,
-      &enclosed_installer_data_file_path)));
-  if (!enclosed_installer_data_file_path.IsEmpty()) {
-    EnclosePath(&enclosed_installer_data_file_path);
-  }
-
-  // PathFindExtension returns the address of the trailing NUL character if an
-  // extension is not found. It does not return NULL.
-  const TCHAR* ext = ::PathFindExtension(file_path);
-  ASSERT1(ext);
-  if (*ext != _T('\0')) {
-    ext++;  // Skip the period.
-    if (0 == lstrcmpi(ext, _T("exe"))) {
-      *executable_path = file_path;
-      if (enclosed_installer_data_file_path.IsEmpty()) {
-        *command_line = arguments;
-      } else {
-        SafeCStringFormat(command_line, _T("%s /installerdata=%s"),
-                          arguments,
-                          enclosed_installer_data_file_path);
-      }
-      *installer_type = CUSTOM_INSTALLER;
-
-      CORE_LOG(L2, (_T("[BuildCommandLineFromFilename][exe][%s][%s]"),
-                    *executable_path, *command_line));
-    } else if (0 == lstrcmpi(ext, _T("msi"))) {
-      *executable_path = _T("msiexec");
-      *command_line = BuildMsiCommandLine(arguments,
-                                          file_path,
-                                          enclosed_installer_data_file_path);
-      *installer_type = MSI_INSTALLER;
-
-      CORE_LOG(L2, (_T("[BuildCommandLineFromFilename][msi][%s]"),
-                    *command_line));
-    } else {
-      *executable_path = _T("");
-      *command_line = _T("");
-      *installer_type = UNKNOWN_INSTALLER;
-
-      OPT_LOG(LE, (_T("[Unsupported extension '%s' in %s]"), ext, file_path));
-      return GOOPDATEINSTALL_E_FILENAME_INVALID;
-    }
-  } else {
-    OPT_LOG(LE, (_T("[No extension found in %s]"), file_path));
-    return GOOPDATEINSTALL_E_FILENAME_INVALID;
-  }
-
-  return S_OK;
-}
-
-// Calls DoExecuteAndWaitForInstaller to do the work. If an MSI installer
-// returns, ERROR_INSTALL_ALREADY_RUNNING waits and retries several times or
-// until the installation succeeds.
-HRESULT InstallerWrapper::ExecuteAndWaitForInstaller(
-    HANDLE user_token,
-    const GUID& app_guid,
-    const CString& executable_path,
-    const CString& command_line,
-    InstallerType installer_type,
-    const CString& language,
-    InstallerResultInfo* result_info) {
-  CORE_LOG(L3, (_T("[InstallerWrapper::ExecuteAndWaitForInstaller]")));
-  ASSERT1(result_info);
-  ASSERT1(num_tries_when_msi_busy_ >= 1);
-
-  ++metric_worker_install_execute_total;
-  if (MSI_INSTALLER == installer_type) {
-    ++metric_worker_install_execute_msi_total;
-  }
-
-  // Run the installer, retrying if necessary.
-  int retry_delay = kMsiAlreadyRunningRetryDelayBaseMs;
-  int num_tries(0);
-  HRESULT hr = GOOPDATEINSTALL_E_MSI_INSTALL_ALREADY_RUNNING;
-  for (num_tries = 0;
-       hr == GOOPDATEINSTALL_E_MSI_INSTALL_ALREADY_RUNNING &&
-       num_tries < num_tries_when_msi_busy_;
-       ++num_tries) {
-    // Reset the result info - it contains the previous error when retrying.
-    *result_info = InstallerResultInfo();
-
-    if (0 < num_tries) {
-      // Retrying - wait between attempts.
-      CORE_LOG(L1, (_T("[Retrying][%d]"), num_tries));
-      ::Sleep(retry_delay);
-      retry_delay *= 2;  // Double the retry delay next time.
-    }
-
-    hr = DoExecuteAndWaitForInstaller(user_token,
-                                      app_guid,
-                                      executable_path,
-                                      command_line,
-                                      installer_type,
-                                      language,
-                                      result_info);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[DoExecuteAndWaitForInstaller failed][0x%08x]"), hr));
-      return hr;
-    }
-    CORE_LOG(L1, (_T("[Installer result][%d][%d][%s]"),
-                  result_info->type, result_info->code, result_info->text));
-    ASSERT1(result_info->type != INSTALLER_RESULT_UNKNOWN);
-
-    if ((INSTALLER_RESULT_ERROR_MSI == result_info->type ||
-         INSTALLER_RESULT_ERROR_SYSTEM == result_info->type) &&
-        ERROR_INSTALL_ALREADY_RUNNING == result_info->code) {
-      hr = GOOPDATEINSTALL_E_MSI_INSTALL_ALREADY_RUNNING;
-    }
-  }
-
-  if (1 < num_tries) {
-    // Record metrics about the ERROR_INSTALL_ALREADY_RUNNING retries.
-// TODO(omaha3): If we're willing to have a single metric for installs and
-// updates, we can avoid knowing is_update.
-#if 0
-    if (!app_version_->is_update()) {
-#endif
-      ++metric_worker_install_msi_in_progress_detected_install;
-      if (result_info->type == INSTALLER_RESULT_SUCCESS) {
-        ++metric_worker_install_msi_in_progress_retry_succeeded_install;
-        metric_worker_install_msi_in_progress_retry_succeeded_tries_install
-            = num_tries;
-      }
-#if 0
-    } else {
-      ++metric_worker_install_msi_in_progress_detected_update;
-      if (result_info->type == INSTALLER_RESULT_SUCCESS) {
-        ++metric_worker_install_msi_in_progress_retry_succeeded_update;
-        metric_worker_install_msi_in_progress_retry_succeeded_tries_update
-            = num_tries;
-      }
-    }
-#endif
-  }
-
-  return hr;
-}
-
-HRESULT InstallerWrapper::DoExecuteAndWaitForInstaller(
-    HANDLE user_token,
-    const GUID& app_guid,
-    const CString& executable_path,
-    const CString& command_line,
-    InstallerType installer_type,
-    const CString& language,
-    InstallerResultInfo* result_info) {
-  OPT_LOG(L1, (_T("[Running installer][%s][%s][%s]"),
-               executable_path, command_line, GuidToString(app_guid)));
-  ASSERT1(result_info);
-
-  AppManager::Instance()->ClearInstallerResultApiValues(app_guid);
-
-  Process p(executable_path, NULL);
-  HRESULT hr = p.Start(command_line, user_token);
-  if (FAILED(hr)) {
-    OPT_LOG(LE, (_T("[p.Start fail][hr][%s][%s]"),
-        hr, executable_path, command_line));
-    set_error_extra_code1(static_cast<int>(hr));
-    return GOOPDATEINSTALL_E_INSTALLER_FAILED_START;
-  }
-
-  // TODO(omaha): InstallerWrapper should not special case Omaha. It is better
-  // to have an abstraction such as waiting or not for the installer to
-  // exit and let the App state machine special case Omaha. It's too low level
-  // to make a decision like this in the InstallerWrapper. Same for all
-  // kinds of tests on the call stack above this call that the app_guid is
-  // Omaha's guid.
-  if (::IsEqualGUID(app_guid, kGoopdateGuid)) {
-    // Do not wait for the installer when installing Omaha.
-    result_info->type = INSTALLER_RESULT_SUCCESS;
-    return S_OK;
-  }
-
-  if (!p.WaitUntilDead(kInstallerCompleteIntervalMs)) {
-    OPT_LOG(LEVEL_WARNING, (_T("[Installer has timed out]")
-                            _T("[%s][%s]"), executable_path, command_line));
-    return GOOPDATEINSTALL_E_INSTALLER_TIMED_OUT;
-  }
-
-  hr = GetInstallerResult(app_guid,
-                          installer_type,
-                          p,
-                          language,
-                          result_info);
-  if (FAILED(hr)) {
-    CORE_LOG(LEVEL_ERROR, (_T("[GetInstallerResult failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  if (result_info->type != INSTALLER_RESULT_SUCCESS) {
-    OPT_LOG(LE, (_T("[Installer failed][%s][%s][%u]"),
-                 executable_path, command_line, result_info->code));
-  }
-
-  return S_OK;
-}
-
-HRESULT InstallerWrapper::GetInstallerResult(const GUID& app_guid,
-                                           InstallerType installer_type,
-                                           const Process& p,
-                                           const CString& language,
-                                           InstallerResultInfo* result_info) {
-  CORE_LOG(L3, (_T("[InstallerWrapper::GetInstallerResult]")));
-  ASSERT1(result_info);
-
-  uint32 exit_code = 0;
-  HRESULT hr = GetInstallerExitCode(p, &exit_code);
-  if (FAILED(hr)) {
-    CORE_LOG(LEVEL_ERROR, (_T("[GetInstallerExitCode failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  GetInstallerResultHelper(app_guid,
-                           installer_type,
-                           exit_code,
-                           language,
-                           result_info);
-  return S_OK;
-}
-
-// The default InstallerResult behavior can be overridden in the registry.
-// By default, error_code is the exit code. For some InstallerResults, it
-// can be overridden by InstallerError in the registry.
-// The success string cannot be overridden.
-void InstallerWrapper::GetInstallerResultHelper(
-    const GUID& app_guid,
-    InstallerType installer_type,
-    uint32 exit_code,
-    const CString& language,
-    InstallerResultInfo* result_info) {
-  ASSERT1(result_info);
-
-  AppManager::InstallerResult installer_result =
-      AppManager::INSTALLER_RESULT_DEFAULT;
-  InstallerResultInfo result;
-
-  result.code = exit_code;
-
-  AppManager& app_manager = *AppManager::Instance();
-  app_manager.ReadInstallerResultApiValues(
-      app_guid,
-      &installer_result,
-      &result.code,
-      &result.extra_code1,
-      &result.text,
-      &result.post_install_launch_command_line);
-  OPT_LOG(L1, (_T("[InstallerResult][%s][%u]"),
-               GuidToString(app_guid), installer_result));
-
-  switch (installer_result) {
-    case AppManager::INSTALLER_RESULT_SUCCESS:
-      result.type = INSTALLER_RESULT_SUCCESS;
-      // TODO(omaha3): Support custom success messages.
-      break;
-    case AppManager::INSTALLER_RESULT_FAILED_CUSTOM_ERROR:
-      result.type = INSTALLER_RESULT_ERROR_OTHER;
-      break;
-    case AppManager::INSTALLER_RESULT_FAILED_MSI_ERROR:
-      result.type = INSTALLER_RESULT_ERROR_MSI;
-      break;
-    case AppManager::INSTALLER_RESULT_FAILED_SYSTEM_ERROR:
-      result.type = INSTALLER_RESULT_ERROR_SYSTEM;
-      break;
-    case AppManager::INSTALLER_RESULT_EXIT_CODE:
-      ASSERT(result.code == exit_code, (_T("InstallerError overridden")));
-      if (0 == exit_code) {
-        result.type = INSTALLER_RESULT_SUCCESS;
-        result.code = 0;
-      } else {
-        switch (installer_type) {
-          case MSI_INSTALLER:
-            result.type = INSTALLER_RESULT_ERROR_MSI;
-            break;
-          case UNKNOWN_INSTALLER:
-          case CUSTOM_INSTALLER:
-          case MAX_INSTALLER:
-          default:
-            result.type = INSTALLER_RESULT_ERROR_OTHER;
-            break;
-        }
-      }
-      break;
-    case AppManager::INSTALLER_RESULT_MAX:
-    default:
-      ASSERT1(false);
-      break;
-  }
-
-  // Handle the reboot required case.
-  if ((INSTALLER_RESULT_ERROR_MSI == result.type ||
-       INSTALLER_RESULT_ERROR_SYSTEM == result.type) &&
-      (ERROR_SUCCESS_REBOOT_REQUIRED == result.code)) {
-    // Reboot takes precedence over other actions.
-    result.type = INSTALLER_RESULT_SUCCESS;
-    result.code = 0;
-    result.post_install_action = POST_INSTALL_ACTION_REBOOT;
-  } else if (!result.post_install_launch_command_line.IsEmpty()) {
-    result.post_install_action = POST_INSTALL_ACTION_LAUNCH_COMMAND;
-  }
-
-  // InstallerResultInfo status has been finalized. Make sure all errors
-  // have error strings.
-  switch (result.type) {
-    case INSTALLER_RESULT_SUCCESS:
-      break;
-
-    case INSTALLER_RESULT_ERROR_MSI:
-    case INSTALLER_RESULT_ERROR_SYSTEM:
-      GetSystemErrorString(result.code, language, &result.text);
-      break;
-
-    case INSTALLER_RESULT_ERROR_OTHER:
-      if (result.text.IsEmpty()) {
-        result.text.FormatMessage(
-              IDS_INSTALLER_FAILED_NO_MESSAGE,
-              FormatErrorCode(result.code));
-      }
-      break;
-
-    case INSTALLER_RESULT_UNKNOWN:
-    default:
-      ASSERT1(false);
-  }
-
-  // TODO(omaha3): Serialize InstallerResultInfo.
-  // OPT_LOG(L1, (_T("[%s]"), result_info->ToString()));
-  *result_info = result;
-}
-
-// TODO(omaha3): Consider moving this method out of this class, maybe into
-// InstallManager.
-HRESULT InstallerWrapper::CheckApplicationRegistration(
-    const GUID& app_guid,
-    const CString& registered_version,
-    const CString& expected_version,
-    const CString& previous_version,
-    bool is_update) const {
-  const CString app_guid_string = GuidToString(app_guid);
-  CORE_LOG(L2, (_T("[InstallerWrapper::CheckApplicationRegistration][%s]"),
-                app_guid_string));
-  ASSERT(!::IsEqualGUID(kGoopdateGuid, app_guid),
-         (_T("Probably do not want to call this method for Omaha")));
-
-  if (registered_version.IsEmpty()) {
-    return GOOPDATEINSTALL_E_INSTALLER_DID_NOT_WRITE_CLIENTS_KEY;
-  }
-
-  CORE_LOG(L2, (_T("[CheckApplicationRegistration]")
-                _T("[guid=%s][registered=%s][expected=%s][previous=%s]"),
-                app_guid_string, registered_version, expected_version,
-                previous_version));
-
-  if (!expected_version.IsEmpty() && registered_version != expected_version) {
-    OPT_LOG(LE, (_T("[Registered version does not match expected][%s][%s][%s]"),
-                 app_guid_string, registered_version, expected_version));
-    // This is expected if a newer version is already installed. Do not fail
-    // here in that case. This only works for four-element version strings.
-    // If the version format is not recognized, VersionFromString() returns 0.
-
-    ULONGLONG registered_version_number = VersionFromString(registered_version);
-    ULONGLONG expected_version_number = VersionFromString(expected_version);
-
-    // Check that the version did not change, the registered version is newer,
-    // and neither VersionFromString() call failed.
-    if (is_update && registered_version != previous_version ||
-        registered_version_number < expected_version_number ||
-        !registered_version_number ||
-        !expected_version_number) {
-      return GOOPDATEINSTALL_E_INSTALLER_VERSION_MISMATCH;
-    }
-
-    CORE_LOG(L1, (_T("[Newer version already registered]")));
-  }
-
-  if (is_update && previous_version == registered_version) {
-    ASSERT1(!previous_version.IsEmpty());
-    ASSERT(expected_version.IsEmpty() ||
-           VersionFromString(expected_version) >
-               VersionFromString(previous_version) ||
-           VersionFromString(expected_version) == 0 ||
-           VersionFromString(previous_version) == 0,
-           (_T("expected_version should be > previous_version when ")
-            _T("is_update - possibly a bad update rule.")));
-
-    OPT_LOG(LE, (_T("[Installer did not change version][%s][%s]"),
-                 app_guid_string, previous_version));
-    return GOOPDATEINSTALL_E_INSTALLER_DID_NOT_CHANGE_VERSION;
-  }
-
-  return S_OK;
-}
-
-// Assumes installer_lock_ has been initialized.
-HRESULT InstallerWrapper::DoInstallApp(HANDLE user_token,
-                                     const GUID& app_guid,
-                                     const CString& installer_path,
-                                     const CString& arguments,
-                                     const CString& installer_data,
-                                     const CString& language,
-                                     InstallerResultInfo* result_info) {
-  CORE_LOG(L1, (_T("[InstallerWrapper::DoInstallApp][%s][%s][%s]"),
-               GuidToString(app_guid), installer_path, arguments));
-  ASSERT1(result_info);
-
-  CString executable_path;
-  CString command_line;
-  InstallerType installer_type = UNKNOWN_INSTALLER;
-
-  // TODO(omaha): Remove when http://b/1443404 is addressed.
-  const TCHAR* const kChromeGuid = _T("{8A69D345-D564-463C-AFF1-A69D9E530F96}");
-  const TCHAR* const kChromePerMachineArg = _T("--system-level");
-  CString modified_arguments = arguments;
-  if (kChromeGuid == GuidToString(app_guid) && is_machine_) {
-    modified_arguments.AppendFormat(_T(" %s"), kChromePerMachineArg);
-  }
-
-  HRESULT hr = BuildCommandLineFromFilename(installer_path,
-                                            modified_arguments,
-                                            installer_data,
-                                            &executable_path,
-                                            &command_line,
-                                            &installer_type);
-
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[BuildCommandLineFromFilename failed][0x%08x]"), hr));
-    ASSERT1(GOOPDATEINSTALL_E_FILENAME_INVALID == hr);
-    return hr;
-  }
-
-  // Acquire the global lock here. This will ensure that we are the only
-  // installer running of the multiple goopdates.
-  __mutexBlock(installer_lock_) {
-    hr = ExecuteAndWaitForInstaller(user_token,
-                                    app_guid,
-                                    executable_path,
-                                    command_line,
-                                    installer_type,
-                                    language,
-                                    result_info);
-  }
-
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[ExecuteAndWaitForInstaller failed][0x%08x][%s]"),
-                  hr, GuidToString(app_guid)));
-    return hr;
-  }
-
-  if (result_info->type != INSTALLER_RESULT_SUCCESS) {
-    CORE_LOG(LE, (_T("[Installer failed][%d]"), result_info->type));
-    return GOOPDATEINSTALL_E_INSTALLER_FAILED;
-  }
-
-  return S_OK;
-}
-
-}  // namespace omaha
diff --git a/goopdate/installer_wrapper.h b/goopdate/installer_wrapper.h
deleted file mode 100644
index 6cafe12..0000000
--- a/goopdate/installer_wrapper.h
+++ /dev/null
@@ -1,169 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// InstallerWrapper supports installing one app at a time. Installs from
-// multiple instances are serialized by a mutex.
-
-#ifndef OMAHA_GOOPDATE_INSTALLER_WRAPPER_H_
-#define OMAHA_GOOPDATE_INSTALLER_WRAPPER_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include <queue>
-#include <utility>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/goopdate/installer_result_info.h"
-
-// TODO(omaha): consider removing this dependency on the model.
-#include "omaha/goopdate/model.h"
-
-namespace omaha {
-
-class AppVersion;
-class Process;
-
-
-class InstallerWrapper {
- public:
-  explicit InstallerWrapper(bool is_machine);
-  ~InstallerWrapper();
-  HRESULT Initialize();
-
-  // Installs the specified app.
-  // This is a blocking call. All errors are reported through the return
-  // value. Depending on the return value, messages may be obtained as follows:
-  //  * SUCCEEDED(hr): result_info may contain a custom success message.
-  //  * GOOPDATEINSTALL_E_INSTALLER_FAILED: output parameters contain
-  //    information and a message for the installer error.
-  //  * Other error values: Callers may use GetMessageForError() to convert the
-  //    error value to an error message.
-  HRESULT InstallApp(HANDLE user_token,
-                     const GUID& app_guid,
-                     const CString& installer_path,
-                     const CString& arguments,
-                     const CString& installer_data,
-                     const CString& language,
-                     InstallerResultInfo* result_info);
-
-  // Validate that the installer wrote the client key and the product version.
-  HRESULT CheckApplicationRegistration(const GUID& app_guid,
-                                       const CString& registered_version,
-                                       const CString& expected_version,
-                                       const CString& previous_version,
-                                       bool is_update) const;
-
-  // Obtains the localized text for Omaha errors that may occur during install.
-  static CString GetMessageForError(HRESULT error_code,
-                                    const CString& installer_filename,
-                                    const CString& language);
-
-  void set_num_tries_when_msi_busy(int num_tries_when_msi_busy);
-
- private:
-  // Types of installers that Omaha supports.
-  enum InstallerType {
-    UNKNOWN_INSTALLER = 0,
-    CUSTOM_INSTALLER,
-    MSI_INSTALLER,
-    MAX_INSTALLER  // Last Installer Type value.
-  };
-
-  // Determines the executable, command line, and installer type for
-  // the installation based on the filename.
-  static HRESULT BuildCommandLineFromFilename(const CString& filename,
-                                              const CString& arguments,
-                                              const CString& installer_data,
-                                              CString* executable_name,
-                                              CString* command_line,
-                                              InstallerType* installer_type);
-
-  // Executes the installer and waits for it to complete. Retries if necessary.
-  HRESULT ExecuteAndWaitForInstaller(HANDLE user_token,
-                                     const GUID& app_guid,
-                                     const CString& executable_name,
-                                     const CString& command_line,
-                                     InstallerType installer_type,
-                                     const CString& language,
-                                     InstallerResultInfo* result_info);
-
-  // Executes the installer for ExecuteAndWaitForInstaller.
-  HRESULT DoExecuteAndWaitForInstaller(HANDLE user_token,
-                                       const GUID& app_guid,
-                                       const CString& executable_name,
-                                       const CString& command_line,
-                                       InstallerType installer_type,
-                                       const CString& language,
-                                       InstallerResultInfo* result_info);
-
-  // Determines whether the installer succeeded and returns completion info.
-  HRESULT GetInstallerResult(const GUID& app_guid,
-                             InstallerType installer_type,
-                             const Process& p,
-                             const CString& language,
-                             InstallerResultInfo* result_info);
-
-  // Does most of the work for GetInstallerResult.
-  void GetInstallerResultHelper(const GUID& app_guid,
-                                InstallerType installer_type,
-                                uint32 exit_code,
-                                const CString& language,
-                                InstallerResultInfo* result_info);
-
-  // Cleans up the registry from an installer that set custom result values.
-  void ClearInstallerResultApiValues(const CString& app_guid);
-
-  // Installs the specified application and reports the results.
-  HRESULT DoInstallApp(HANDLE user_token,
-                       const GUID& app_guid,
-                       const CString& installer_path,
-                       const CString& arguments,
-                       const CString& installer_data,
-                       const CString& language,
-                       InstallerResultInfo* result_info);
-
-  // Whether this object is running in a machine Goopdate instance.
-  const bool is_machine_;
-
-  // The number of times to try installing an MSI when an MSI install is
-  // already running. There is an exponential backoff starting from
-  // kMsiAlreadyRunningRetryDelayBaseMs.
-  int num_tries_when_msi_busy_;
-
-  // This is the base retry delay between retries when msiexec returns
-  // ERROR_INSTALL_ALREADY_RUNNING. We exponentially backoff from this value.
-  // Note that there is an additional delay for the MSI call, so the tries may
-  // be a few seconds further apart.
-  static const int kMsiAlreadyRunningRetryDelayBaseMs = 5000;
-
-  // Interval to wait for installer completion.
-  static const int kInstallerCompleteIntervalMs = 15 * 60 * 1000;
-
-  // Ensures that a single installer is run by us at a time.
-  // Not sure if we can run installers in different sessions without
-  // interference. In that case we can use a local lock instead of a
-  // global lock.
-  GLock installer_lock_;
-
-  friend class InstallerWrapperTest;
-
-  DISALLOW_COPY_AND_ASSIGN(InstallerWrapper);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_INSTALLER_WRAPPER_H_
-
diff --git a/goopdate/installer_wrapper_unittest.cc b/goopdate/installer_wrapper_unittest.cc
deleted file mode 100644
index 460c2a3..0000000
--- a/goopdate/installer_wrapper_unittest.cc
+++ /dev/null
@@ -1,1894 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <atlpath.h>
-#include <atlstr.h>
-#include "base/scoped_ptr.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/path.h"
-#include "omaha/base/process.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/shell.h"
-#include "omaha/base/system.h"
-#include "omaha/base/timer.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/app_registry_utils.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/install_manifest.h"
-#include "omaha/goopdate/app_manager.h"
-#include "omaha/goopdate/installer_wrapper.h"
-#include "omaha/goopdate/model.h"
-#include "omaha/goopdate/resource_manager.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-const TCHAR kAppId[] = _T("{B18BC01B-E0BD-4BF0-A33E-1133055E5FDE}");
-const GUID kAppGuid = {0xB18BC01B, 0xE0BD, 0x4BF0,
-                       {0xA3, 0x3E, 0x11, 0x33, 0x05, 0x5E, 0x5F, 0xDE}};
-
-const TCHAR kFullAppClientsKeyPath[] =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\")
-    PRODUCT_NAME _T("\\Clients\\{B18BC01B-E0BD-4BF0-A33E-1133055E5FDE}");
-const TCHAR kFullAppClientStateKeyPath[] =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\")
-    PRODUCT_NAME _T("\\ClientState\\{B18BC01B-E0BD-4BF0-A33E-1133055E5FDE}");
-const TCHAR kFullFooAppClientKeyPath[] =
-    _T("HKLM\\Software\\") SHORT_COMPANY_NAME _T("\\")
-    PRODUCT_NAME _T("\\Clients\\{D6B08267-B440-4C85-9F79-E195E80D9937}");
-const TCHAR kFullFooAppClientStateKeyPath[] =
-    _T("HKLM\\Software\\") SHORT_COMPANY_NAME _T("\\")
-    PRODUCT_NAME _T("\\ClientState\\{D6B08267-B440-4C85-9F79-E195E80D9937}");
-
-const TCHAR kSetupFooV1RelativeLocation[] =
-  _T("unittest_support\\test_foo_v1.0.101.0.msi");
-const TCHAR kFooGuid[] = _T("{D6B08267-B440-4C85-9F79-E195E80D9937}");
-const TCHAR kFooInstallerBarPropertyArg[] = _T("PROPBAR=7");
-const TCHAR kFooInstallerBarValueName[] = _T("propbar");
-
-// Values related to using cmd.exe as an "installer".
-const TCHAR kCmdExecutable[] = _T("cmd.exe");
-const TCHAR kExecuteCommandAndTerminateSwitch[] = _T("/c %s");
-const TCHAR kExecuteTwoCommandsFormat[] = _T("\"%s & %s\"");
-
-const TCHAR kMsiLogFormat[] = _T("%s.log");
-
-const TCHAR kMsiUninstallArguments[] = _T("/quiet /uninstall \"%s\"");
-const TCHAR kMsiCommand[] = _T("msiexec");
-
-const DWORD kInitialErrorValue = 5;
-const TCHAR kMeaninglessErrorString[] = _T("This is an error string.");
-
-// Some error strings are slightly different on Vista than XP because spaces
-// were removed. Therefore, the comparison must ignore that space.
-
-// The US English error string for ERROR_INSTALL_PACKAGE_OPEN_FAILED.
-const TCHAR kMsiPackageOpenFailedStringPartA[] =
-    _T("This installation package could not be opened. ");
-const TCHAR kMsiPackageOpenFailedStringPartB[] =
-    _T("Verify that the package exists and that you can access it, ")
-    _T("or contact the application vendor to verify that this is a ")
-    _T("valid Windows Installer package. ");
-
-// The US English error string for ERROR_INSTALL_ALREADY_RUNNING.
-const TCHAR kMsiBusyStringPartA[] =
-    _T("Another installation is already in progress. ");
-const TCHAR kMsiBusyStringPartB[] =
-    _T("Complete that installation before proceeding with this install. ");
-
-const TCHAR* const kError1603Text =
-    _T("The installer encountered error 1603: Fatal error during ")
-    _T("installation. ");
-
-const TCHAR kError1618MessagePrefix[] =
-    _T("The installer encountered error 1618: ");
-const int kError1618MessagePrefixLength =
-    arraysize(kError1618MessagePrefix) - 1;
-
-const TCHAR* const kError0x800B010FText =
-    _T("The installer encountered error 0x800b010f: ")
-    _T("The certificate's CN name does not match the passed value. ");
-
-const TCHAR* const kLaunchCmdLine =
-      _T("\"C:\\Local\\Google\\Chrome\\Application\\chrome.exe\" -home");
-
-const TCHAR* const kLanguageEnglish = _T("en");
-
-const int kMsiAlreadyRunningRetryDelayBaseMs = 5000;
-const int kNumMsiTriesDefault = 4;  // Up to 35 seconds.
-const int kNumMsiTriesOnBuildSystem = 7;  // Up to 6.25 minutes.
-
-int GetNumMsiTries() {
-  return IsBuildSystem() ? kNumMsiTriesOnBuildSystem : kNumMsiTriesDefault;
-}
-
-}  // namespace
-
-extern const TCHAR kRegExecutable[] = _T("reg.exe");
-extern const TCHAR kSetInstallerResultTypeMsiErrorRegCmdArgs[] =
-    _T("add HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\UnitTest\\HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\")
-    PRODUCT_NAME _T("\\ClientState\\{B18BC01B-E0BD-4BF0-A33E-1133055E5FDE} ")
-    _T("/v InstallerResult /t REG_DWORD /d 2");
-extern const TCHAR kMsiInstallerBusyExitCodeCmd[] = _T("exit 1618");
-
-extern const TCHAR kError1619MessagePrefix[] =
-    _T("The installer encountered error 1619: ");
-extern const int kError1619MessagePrefixLength =
-    arraysize(kError1619MessagePrefix) - 1;
-
-void VerifyStringIsMsiPackageOpenFailedString(const CString& str) {
-  EXPECT_STREQ(kMsiPackageOpenFailedStringPartA,
-               str.Left(arraysize(kMsiPackageOpenFailedStringPartA) - 1));
-  EXPECT_STREQ(kMsiPackageOpenFailedStringPartB,
-               str.Right(arraysize(kMsiPackageOpenFailedStringPartB) - 1));
-}
-
-void VerifyStringIsMsiBusyString(const CString& str) {
-  EXPECT_STREQ(kMsiBusyStringPartA,
-               str.Left(arraysize(kMsiBusyStringPartA) - 1));
-  EXPECT_STREQ(kMsiBusyStringPartB,
-               str.Right(arraysize(kMsiBusyStringPartB) - 1));
-}
-
-// Unit tests may run while other updaters are running on the build system.
-// Give the tests lots of time to run to avoid false negatives.
-void AdjustMsiTries(InstallerWrapper* installer_wrapper) {
-  ASSERT1(installer_wrapper);
-  installer_wrapper->set_num_tries_when_msi_busy(GetNumMsiTries());
-}
-
-// Waits for the uninstall to complete to avoid race conditions with other tests
-// that install the same MSI. It appears msiexec causes an an asynchronous
-// request that may be processed out of order.
-// Retries when ERROR_INSTALL_ALREADY_RUNNING is encountered.
-void UninstallTestMsi(const CString& installer_path) {
-  CString uninstall_arguments;
-  uninstall_arguments.Format(kMsiUninstallArguments, installer_path);
-
-  const int max_tries = GetNumMsiTries();
-  int retry_delay = kMsiAlreadyRunningRetryDelayBaseMs;
-  int num_tries(0);
-  uint32 exit_code = ERROR_INSTALL_ALREADY_RUNNING;
-  for (num_tries = 0;
-       exit_code == ERROR_INSTALL_ALREADY_RUNNING && num_tries < max_tries;
-       ++num_tries) {
-    if (0 < num_tries) {
-      // Retrying - wait between attempts.
-      ::Sleep(retry_delay);
-      retry_delay *= 2;  // Double the retry delay next time.
-    }
-
-    Process p(kMsiCommand, NULL);
-    EXPECT_HRESULT_SUCCEEDED(p.Start(uninstall_arguments, NULL));
-    EXPECT_TRUE(p.WaitUntilDead(10000));
-
-    EXPECT_TRUE(p.GetExitCode(&exit_code));
-  }
-
-  EXPECT_EQ(0, exit_code);
-}
-
-class InstallerWrapperTest : public testing::Test {
- protected:
-  explicit InstallerWrapperTest(bool is_machine)
-      : is_machine_(is_machine),
-        hive_override_key_name_(kRegistryHiveOverrideRoot) {
-  }
-
-  static void SetUpTestCase() {
-    CString system_path;
-    EXPECT_SUCCEEDED(Shell::GetSpecialFolder(CSIDL_SYSTEM,
-                                             false,
-                                             &system_path));
-    EXPECT_FALSE(system_path.IsEmpty());
-    cmd_exe_path_.Combine(system_path, kCmdExecutable);
-    EXPECT_TRUE(File::Exists(cmd_exe_path_));
-
-    CPath reg_path;
-    reg_path.Combine(system_path, kRegExecutable);
-    set_installer_result_type_msi_error_cmd_.Format(
-        _T("%s %s"),
-        reg_path, kSetInstallerResultTypeMsiErrorRegCmdArgs);
-  }
-
-  virtual void SetUp() {
-    RegKey::DeleteKey(hive_override_key_name_, true);
-    OverrideRegistryHivesWithExecutionPermissions(hive_override_key_name_);
-
-    EXPECT_SUCCEEDED(AppManager::CreateInstance(is_machine_));
-
-    im_.reset(new InstallerWrapper(is_machine_));
-    EXPECT_SUCCEEDED(im_->Initialize());
-
-    EXPECT_SUCCEEDED(ResourceManager::Create(
-          is_machine_, app_util::GetCurrentModuleDirectory(), _T("en")));
-  }
-
-  virtual void TearDown() {
-    AppManager::DeleteInstance();
-
-    RestoreRegistryHives();
-    ASSERT_SUCCEEDED(RegKey::DeleteKey(hive_override_key_name_, true));
-    ResourceManager::Delete();
-  }
-
-  void SetupInstallerResultRegistry(const CString& app_guid,
-                                    bool set_installer_result,
-                                    DWORD installer_result,
-                                    bool set_installer_error,
-                                    DWORD installer_error,
-                                    bool set_installer_extra_code1,
-                                    DWORD installer_extra_code1,
-                                    bool set_installer_result_uistring,
-                                    const CString& installer_result_uistring,
-                                    bool set_installer_launch_cmd_line,
-                                    const CString& installer_launch_cmd_line) {
-    CString app_client_state_key =
-        app_registry_utils::GetAppClientStateKey(is_machine_, app_guid);
-    RegKey::CreateKey(app_client_state_key);
-    if (set_installer_result) {
-      RegKey::SetValue(app_client_state_key,
-                       kRegValueInstallerResult,
-                       installer_result);
-    }
-
-    if (set_installer_error) {
-      RegKey::SetValue(app_client_state_key,
-                       kRegValueInstallerError,
-                       installer_error);
-    }
-
-    if (set_installer_extra_code1) {
-      RegKey::SetValue(app_client_state_key,
-                       kRegValueInstallerExtraCode1,
-                       installer_extra_code1);
-    }
-
-    if (set_installer_result_uistring) {
-      RegKey::SetValue(app_client_state_key,
-                       kRegValueInstallerResultUIString,
-                       installer_result_uistring);
-    }
-
-    if (set_installer_launch_cmd_line) {
-      RegKey::SetValue(app_client_state_key,
-                       kRegValueInstallerSuccessLaunchCmdLine,
-                       installer_launch_cmd_line);
-    }
-  }
-
-  void VerifyLastRegistryValues(const CString& app_guid,
-                                bool expect_installer_result,
-                                DWORD expected_installer_result,
-                                bool expect_installer_error,
-                                DWORD expected_installer_error,
-                                bool expect_installer_extra_code1,
-                                DWORD expected_installer_extra_code1,
-                                bool expect_installer_result_uistring,
-                                const CString& expected_result_uistring,
-                                bool expect_installer_launch_cmd_line,
-                                const CString& expected_launch_cmd_line) {
-    ASSERT_TRUE(expect_installer_result || !expected_installer_result);
-    ASSERT_TRUE(expect_installer_error || !expected_installer_error);
-    ASSERT_TRUE(expect_installer_extra_code1 ||
-                !expected_installer_extra_code1);
-    ASSERT_TRUE(expect_installer_result_uistring ||
-                expected_result_uistring.IsEmpty());
-    ASSERT_TRUE(expect_installer_launch_cmd_line ||
-                expected_launch_cmd_line.IsEmpty());
-
-    CString app_client_state_key =
-        app_registry_utils::GetAppClientStateKey(is_machine_, app_guid);
-    EXPECT_FALSE(RegKey::HasValue(app_client_state_key,
-                                  kRegValueInstallerResult));
-    EXPECT_FALSE(RegKey::HasValue(app_client_state_key,
-                                  kRegValueInstallerError));
-    EXPECT_FALSE(RegKey::HasValue(app_client_state_key,
-                                  kRegValueInstallerExtraCode1));
-    EXPECT_FALSE(RegKey::HasValue(app_client_state_key,
-                                  kRegValueInstallerResultUIString));
-
-    if (expect_installer_result) {
-      EXPECT_TRUE(RegKey::HasValue(app_client_state_key,
-                                   kRegValueLastInstallerResult));
-      DWORD last_installer_result = 0;
-      EXPECT_SUCCEEDED(RegKey::GetValue(app_client_state_key,
-                                        kRegValueLastInstallerResult,
-                                        &last_installer_result));
-      EXPECT_EQ(expected_installer_result, last_installer_result);
-    } else {
-      EXPECT_FALSE(RegKey::HasValue(app_client_state_key,
-                                    kRegValueLastInstallerResult));
-    }
-
-    if (expect_installer_error) {
-      EXPECT_TRUE(RegKey::HasValue(app_client_state_key,
-                                   kRegValueLastInstallerError));
-      DWORD last_installer_error = 0;
-      EXPECT_SUCCEEDED(RegKey::GetValue(app_client_state_key,
-                                        kRegValueLastInstallerError,
-                                        &last_installer_error));
-      EXPECT_EQ(expected_installer_error, last_installer_error);
-    } else {
-      EXPECT_FALSE(RegKey::HasValue(app_client_state_key,
-                                    kRegValueLastInstallerError));
-    }
-
-    if (expect_installer_extra_code1) {
-      EXPECT_TRUE(RegKey::HasValue(app_client_state_key,
-                                   kRegValueLastInstallerExtraCode1));
-      DWORD last_installer_extracode1 = 0;
-      EXPECT_SUCCEEDED(RegKey::GetValue(app_client_state_key,
-                                        kRegValueLastInstallerExtraCode1,
-                                        &last_installer_extracode1));
-      EXPECT_EQ(expected_installer_extra_code1, last_installer_extracode1);
-    } else {
-      EXPECT_FALSE(RegKey::HasValue(app_client_state_key,
-                                    kRegValueLastInstallerExtraCode1));
-    }
-
-    if (expect_installer_result_uistring) {
-      EXPECT_TRUE(RegKey::HasValue(app_client_state_key,
-                                   kRegValueLastInstallerResultUIString));
-      CString last_installer_result_uistring;
-      EXPECT_SUCCEEDED(RegKey::GetValue(app_client_state_key,
-                                        kRegValueLastInstallerResultUIString,
-                                        &last_installer_result_uistring));
-      EXPECT_STREQ(expected_result_uistring,
-                   last_installer_result_uistring);
-    } else {
-      EXPECT_FALSE(RegKey::HasValue(app_client_state_key,
-                                    kRegValueLastInstallerResultUIString));
-    }
-
-    if (expect_installer_launch_cmd_line) {
-      EXPECT_TRUE(RegKey::HasValue(app_client_state_key,
-                                   kRegValueLastInstallerSuccessLaunchCmdLine));
-      CString last_installer_launch_cmd_line;
-      EXPECT_SUCCEEDED(
-          RegKey::GetValue(app_client_state_key,
-                           kRegValueLastInstallerSuccessLaunchCmdLine,
-                           &last_installer_launch_cmd_line));
-      EXPECT_STREQ(expected_launch_cmd_line,
-                   last_installer_launch_cmd_line);
-    } else {
-      EXPECT_FALSE(RegKey::HasValue(
-          app_client_state_key,
-          kRegValueLastInstallerSuccessLaunchCmdLine));
-    }
-  }
-
-  void VerifyNoLastRegistryValues(const CString& app_guid) {
-    VerifyLastRegistryValues(app_guid,
-                             false, 0,
-                             false, 0,
-                             false, 0,
-                             false, _T(""),
-                             false, _T(""));
-  }
-
-  void CallGetInstallerResultHelper(const GUID& app_guid,
-                                    int installer_type,
-                                    uint32 exit_code,
-                                    InstallerResultInfo* result_info) {
-    ASSERT1(result_info);
-
-    im_->GetInstallerResultHelper(
-        app_guid,
-        static_cast<InstallerWrapper::InstallerType>(installer_type),
-        exit_code,
-        kLanguageEnglish,
-        result_info);
-  }
-
-  static const int kResultSuccess = AppManager::INSTALLER_RESULT_SUCCESS;
-  static const int kResultFailedCustomError =
-      AppManager::INSTALLER_RESULT_FAILED_CUSTOM_ERROR;
-  static const int kResultFailedMsiError =
-      AppManager::INSTALLER_RESULT_FAILED_MSI_ERROR;
-  static const int kResultFailedSystemError =
-      AppManager::INSTALLER_RESULT_FAILED_SYSTEM_ERROR;
-  static const int kResultExitCode = AppManager::INSTALLER_RESULT_EXIT_CODE;
-
-  static const int kMsiInstaller = InstallerWrapper::MSI_INSTALLER;
-  static const int kOtherInstaller = InstallerWrapper::CUSTOM_INSTALLER;
-
-  bool is_machine_;
-  CString hive_override_key_name_;
-  scoped_ptr<InstallerWrapper> im_;
-
-  // Used as an argument to various functions.
-  InstallerResultInfo result_info_;
-
-  static CPath cmd_exe_path_;
-  static CString set_installer_result_type_msi_error_cmd_;
-};
-
-CPath InstallerWrapperTest::cmd_exe_path_;
-CString InstallerWrapperTest::set_installer_result_type_msi_error_cmd_;
-
-class InstallerWrapperMachineTest : public InstallerWrapperTest {
- protected:
-  InstallerWrapperMachineTest()
-    : InstallerWrapperTest(true) {
-  }
-};
-
-class InstallerWrapperUserTest : public InstallerWrapperTest {
- protected:
-  InstallerWrapperUserTest()
-    : InstallerWrapperTest(false) {
-  }
-};
-
-class InstallerWrapperUserGetInstallerResultHelperTest
-    : public InstallerWrapperUserTest {
- protected:
-  InstallerWrapperUserGetInstallerResultHelperTest()
-      : InstallerWrapperUserTest() {
-    result_info_.text = kMeaninglessErrorString;
-  }
-
-  virtual void SetUp() {
-    InstallerWrapperUserTest::SetUp();
-    AppManager::Instance()->GetRegistryStableStateLock().Lock();
-  }
-
-  virtual void TearDown() {
-    AppManager::Instance()->GetRegistryStableStateLock().Unlock();
-    InstallerWrapperUserTest::TearDown();
-  }
-
-  // Shorter names used to make test calls fit on one line.
-  static const int kMsi = kMsiInstaller;
-  static const int kOther = kOtherInstaller;
-};
-
-//
-// Helper method tests
-//
-TEST(InstallerWrapperTest, GetMessageForSystemErrorCode) {
-  VerifyStringIsMsiPackageOpenFailedString(
-      GetMessageForSystemErrorCode(ERROR_INSTALL_PACKAGE_OPEN_FAILED));
-}
-
-// CheckApplicationRegistration does not read the registry. This is verified by
-// not setting any registry values before calling it.
-
-TEST_F(InstallerWrapperUserTest,
-       CheckApplicationRegistration_EmptyRegisteredVersion) {
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_DID_NOT_WRITE_CLIENTS_KEY,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T(""), _T(""), _T(""), false));
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_DID_NOT_WRITE_CLIENTS_KEY,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T(""), _T(""), _T(""), true));
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_DID_NOT_WRITE_CLIENTS_KEY,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T(""), _T("1.2.3.4"), _T(""), false));
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_DID_NOT_WRITE_CLIENTS_KEY,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T(""), _T("1.2.3.4"), _T(""), true));
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_DID_NOT_WRITE_CLIENTS_KEY,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T(""), _T("1.2.3.4"), _T("1.2.3.3"), false));
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_DID_NOT_WRITE_CLIENTS_KEY,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T(""), _T("1.2.3.4"), _T("1.2.3.3"), true));
-}
-
-TEST_F(InstallerWrapperUserTest,
-       CheckApplicationRegistration_NoExpectedOrPreviousVersion) {
-  EXPECT_SUCCEEDED(im_->CheckApplicationRegistration(
-                       kAppGuid, _T("0.9.6.4"), _T(""), _T(""), false));
-  EXPECT_SUCCEEDED(im_->CheckApplicationRegistration(
-                       kAppGuid, _T("0.9.6.4"), _T(""), _T(""), true));
-}
-
-TEST_F(InstallerWrapperUserTest,
-       CheckApplicationRegistration_ExpectedMatch_NoPreviousVersion) {
-  EXPECT_SUCCEEDED(im_->CheckApplicationRegistration(
-                       kAppGuid, _T("0.9.6.4"), _T("0.9.6.4"), _T(""), false));
-  EXPECT_SUCCEEDED(im_->CheckApplicationRegistration(
-                       kAppGuid, _T("0.9.6.4"), _T("0.9.6.4"), _T(""), true));
-}
-
-TEST_F(InstallerWrapperUserTest,
-       CheckApplicationRegistration_NoExpectedVersion_PreviousVersionOlder) {
-  EXPECT_SUCCEEDED(im_->CheckApplicationRegistration(
-                       kAppGuid, _T("0.9.6.4"), _T(""), _T("0.9.6.3"), false));
-  EXPECT_SUCCEEDED(im_->CheckApplicationRegistration(
-                       kAppGuid, _T("0.9.6.4"), _T(""), _T("0.9.6.3"), true));
-}
-
-TEST_F(InstallerWrapperUserTest,
-       CheckApplicationRegistration_ExpectedMatch_PreviousVersionSame_UnchangedAllowed) {  // NOLINT
-  EXPECT_SUCCEEDED(
-      im_->CheckApplicationRegistration(
-          kAppGuid, _T("0.9.6.4"), _T(""), _T("0.9.6.4"), false));
-  EXPECT_SUCCEEDED(
-      im_->CheckApplicationRegistration(
-          kAppGuid, _T("0.9.6.4"), _T("0.9.6.4"), _T("0.9.6.4"), false));
-}
-
-TEST_F(InstallerWrapperUserTest,
-       CheckApplicationRegistration_ExpectedMatch_PreviousVersionSame_UnchangedNotAllowed) {  // NOLINT
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_DID_NOT_CHANGE_VERSION,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T("0.9.6.4"), _T(""), _T("0.9.6.4"), true));
-
-  ExpectAsserts expect_asserts;  // expected_version is expected to be greater.
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_DID_NOT_CHANGE_VERSION,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T("0.9.6.4"), _T("0.9.6.4"), _T("0.9.6.4"), true));
-}
-
-TEST_F(InstallerWrapperUserTest,
-       CheckApplicationRegistration_ExpectedMatch_PreviousVersionOlder) {
-  EXPECT_SUCCEEDED(
-      im_->CheckApplicationRegistration(
-          kAppGuid, _T("0.9.6.4"), _T("0.9.6.4"), _T("0.9.6.3"), false));
-  EXPECT_SUCCEEDED(
-      im_->CheckApplicationRegistration(
-          kAppGuid, _T("0.9.6.4"), _T("0.9.6.4"), _T("0.9.6.3"), true));
-}
-
-TEST_F(InstallerWrapperUserTest,
-       CheckApplicationRegistration_ExpectedMatch_PreviousVersionNewer) {
-  EXPECT_SUCCEEDED(
-      im_->CheckApplicationRegistration(
-          kAppGuid, _T("0.9.6.4"), _T("0.9.6.4"), _T("0.9.6.5"), false));
-  EXPECT_SUCCEEDED(
-      im_->CheckApplicationRegistration(
-          kAppGuid, _T("0.9.6.4"), _T("0.9.6.4"), _T("0.9.6.5"), true));
-}
-
-// This is the over-install when a newer version is present case. This might
-// happen if a dev track version is installed and a stable track version is
-// installed. For installs, this is okay.
-TEST_F(InstallerWrapperUserTest,
-       CheckApplicationRegistration_ExpectedMatch_RegisteredNewer_NoPreviousVersion_NewInstall) {  // NOLINT
-  EXPECT_SUCCEEDED(
-      im_->CheckApplicationRegistration(
-          kAppGuid, _T("0.9.6.4"), _T("0.9.6.3"), _T(""), false));
-}
-
-TEST_F(InstallerWrapperUserTest,
-       CheckApplicationRegistration_ExpectedMismatch_RegisteredNewer_NoPreviousVersion_Update) {  // NOLINT
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_VERSION_MISMATCH,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T("0.9.6.4"), _T("0.9.6.3"), _T(""), true));
-}
-
-// This is the over-install when a newer version is present case. This might
-// happen if a dev track version is installed and a stable track version is
-// installed. For installs, this is okay.
-TEST_F(InstallerWrapperUserTest,
-       CheckApplicationRegistration_ExpectedMismatch_RegisteredNewer_PreviousVersionSame) {  // NOLINT
-  EXPECT_SUCCEEDED(
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T("0.9.6.4"), _T("0.9.6.3"), _T("0.9.6.4"), false));
-  ExpectAsserts expect_asserts;  // expected_version is expected to be greater.
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_DID_NOT_CHANGE_VERSION,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T("0.9.6.4"), _T("0.9.6.3"), _T("0.9.6.4"), true));
-}
-
-TEST_F(InstallerWrapperUserTest,
-       CheckApplicationRegistration_ExpectedMismatch_RegisteredNewer_PreviousVersionDifferent) {  // NOLINT
-  EXPECT_SUCCEEDED(
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T("0.9.6.4"), _T("0.9.6.3"), _T("0.9.6.3"), false));
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_VERSION_MISMATCH,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T("0.9.6.4"), _T("0.9.6.3"), _T("0.9.6.3"), true));
-}
-
-TEST_F(InstallerWrapperUserTest,
-       CheckApplicationRegistration_ExpectedMismatch_RegisteredOlder_NoPreviousVersion) {  // NOLINT
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_VERSION_MISMATCH,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T("0.9.6.2"), _T("0.9.6.3"), _T(""), false));
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_VERSION_MISMATCH,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T("0.9.6.2"), _T("0.9.6.3"), _T(""), true));
-}
-
-TEST_F(InstallerWrapperUserTest,
-       CheckApplicationRegistration_ExpectedMismatch_RegisteredOlder_PreviousVersionSame) {  // NOLINT
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_VERSION_MISMATCH,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T("0.9.6.2"), _T("0.9.6.3"), _T("0.9.6.2"), false));
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_VERSION_MISMATCH,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T("0.9.6.2"), _T("0.9.6.3"), _T("0.9.6.2"), true));
-}
-
-TEST_F(InstallerWrapperUserTest,
-       CheckApplicationRegistration_ExpectedMismatch_RegisteredOlder_PreviousVersionDifferent) {  // NOLINT
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_VERSION_MISMATCH,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T("0.9.6.2"), _T("0.9.6.3"), _T("0.9.6.1"), false));
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_VERSION_MISMATCH,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T("0.9.6.2"), _T("0.9.6.3"), _T("0.9.6.1"), true));
-}
-
-TEST_F(InstallerWrapperUserTest,
-       CheckApplicationRegistration_ExpectedMismatch_RegisteredNewer_PreviousVersionSame_UnrecognizedVersions) {  // NOLINT
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_VERSION_MISMATCH,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T("0.9.6.4.0"), _T("0.9.6.3"), _T("0.9.6.4.0"),
-                false));
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_VERSION_MISMATCH,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T("0.9.6.4.0"), _T("0.9.6.3"), _T("0.9.6.4.0"),
-                true));
-
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_VERSION_MISMATCH,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T("0.9.6.4"), _T("0.9.6.3.0"), _T("0.9.6.4"),
-                false));
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_VERSION_MISMATCH,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T("0.9.6.4"), _T("0.9.6.3.0"), _T("0.9.6.4"),
-                true));
-
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_VERSION_MISMATCH,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T("0.9.6.4.0"), _T("0.9.6.3.0"), _T("0.9.6.4.0"),
-                false));
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_VERSION_MISMATCH,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T("0.9.6.4.0"), _T("0.9.6.3.0"), _T("0.9.6.4.0"),
-                true));
-
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_VERSION_MISMATCH,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T("0.9.6"), _T("0.9.5"), _T("0.9.6"), false));
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_VERSION_MISMATCH,
-            im_->CheckApplicationRegistration(
-                kAppGuid, _T("0.9.6"), _T("0.9.5"), _T("0.9.6"), true));
-}
-
-//
-// Negative Tests
-//
-
-TEST_F(InstallerWrapperUserTest, InstallApp_InstallerWithoutFilenameExtension) {
-  EXPECT_EQ(GOOPDATEINSTALL_E_FILENAME_INVALID,
-            im_->InstallApp(NULL,
-                            kAppGuid,
-                            _T("c:\\temp\\foo"),
-                            _T(""),  // Arguments.
-                            _T(""),  // Installer data.
-                            kLanguageEnglish,
-                            &result_info_));
-
-  EXPECT_EQ(INSTALLER_RESULT_UNKNOWN, result_info_.type);
-  EXPECT_EQ(S_OK, result_info_.code);
-  EXPECT_TRUE(result_info_.text.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-}
-
-TEST_F(InstallerWrapperUserTest,
-       InstallApp_UnsupportedInstallerFilenameExtension) {
-  EXPECT_EQ(GOOPDATEINSTALL_E_FILENAME_INVALID,
-            im_->InstallApp(NULL,
-                            kAppGuid,
-                            _T("c:\\temp\\foo.bar"),
-                            _T(""),  // Arguments.
-                            _T(""),  // Installer data.
-                            kLanguageEnglish,
-                            &result_info_));
-
-  EXPECT_EQ(INSTALLER_RESULT_UNKNOWN, result_info_.type);
-  EXPECT_EQ(S_OK, result_info_.code);
-  EXPECT_TRUE(result_info_.text.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-}
-
-TEST_F(InstallerWrapperUserTest, InstallApp_InstallerEmtpyFilename) {
-  EXPECT_EQ(GOOPDATEINSTALL_E_FILENAME_INVALID,
-            im_->InstallApp(NULL,
-                            kAppGuid,
-                            _T(""),
-                            _T(""),  // Arguments.
-                            _T(""),  // Installer data.
-                            kLanguageEnglish,
-                            &result_info_));
-
-  EXPECT_EQ(INSTALLER_RESULT_UNKNOWN, result_info_.type);
-  EXPECT_EQ(S_OK, result_info_.code);
-  EXPECT_TRUE(result_info_.text.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-}
-
-TEST_F(InstallerWrapperUserTest, InstallApp_ExeFileDoesNotExist) {
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_FAILED_START,
-            im_->InstallApp(NULL,
-                            kAppGuid,
-                            _T("c:\\temp\\foo.exe"),
-                            _T(""),  // Arguments.
-                            _T(""),  // Installer data.
-                            kLanguageEnglish,
-                            &result_info_));
-
-  EXPECT_EQ(INSTALLER_RESULT_UNKNOWN, result_info_.type);
-  EXPECT_EQ(S_OK, result_info_.code);
-  EXPECT_TRUE(result_info_.text.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  EXPECT_FALSE(RegKey::HasKey(kFullAppClientsKeyPath));
-  EXPECT_FALSE(RegKey::HasKey(kFullAppClientStateKeyPath));
-}
-
-//
-// EXE Installer Tests
-//
-
-// This test uses cmd.exe as an installer that leaves the payload
-// kPayloadFileName.
-TEST_F(InstallerWrapperUserTest, InstallApp_ExeInstallerWithArgumentsSucceeds) {
-  const TCHAR kPayloadFileName[] = _T("exe_payload.txt");
-  const TCHAR kCommandToExecute[] = _T("echo \"hi\" > %s");
-
-  CString full_command_to_execute;
-  full_command_to_execute.Format(kCommandToExecute, kPayloadFileName);
-  CString arguments;
-  arguments.Format(kExecuteCommandAndTerminateSwitch, full_command_to_execute);
-
-  EXPECT_SUCCEEDED(File::Remove(kPayloadFileName));
-  EXPECT_FALSE(File::Exists(kPayloadFileName));
-
-  // Create the Clients key since this isn't an actual installer.
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kFullAppClientsKeyPath));
-  EXPECT_TRUE(RegKey::HasKey(kFullAppClientsKeyPath));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kFullAppClientsKeyPath,
-                                    kRegValueProductVersion,
-                                    _T("0.10.69.5")));
-
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  EXPECT_SUCCEEDED(im_->InstallApp(NULL,
-                                   kAppGuid,
-                                   cmd_exe_path_,
-                                   arguments,
-                                   _T(""),  // Installer data.
-                                   kLanguageEnglish,
-                                   &result_info_));
-
-  EXPECT_EQ(INSTALLER_RESULT_SUCCESS, result_info_.type);
-  EXPECT_EQ(S_OK, result_info_.code);
-  EXPECT_TRUE(result_info_.text.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  // EXPECT_SUCCEEDED(
-  //     im_->CheckApplicationRegistration(kAppGuid, _T("0.9.70.1"), false));
-
-  EXPECT_TRUE(File::Exists(kPayloadFileName));
-  EXPECT_SUCCEEDED(File::Remove(kPayloadFileName));
-}
-
-TEST_F(InstallerWrapperUserTest,
-       InstallApp_ExeInstallerReturnsNonZeroExitCode) {
-  const TCHAR kCommandToExecute[] = _T("exit 1");
-
-  CString arguments;
-  arguments.Format(kExecuteCommandAndTerminateSwitch, kCommandToExecute);
-
-  // Create the Clients key since this isn't an actual installer.
-  ASSERT_SUCCEEDED(RegKey::CreateKey(kFullAppClientsKeyPath));
-  ASSERT_TRUE(RegKey::HasKey(kFullAppClientsKeyPath));
-  ASSERT_SUCCEEDED(RegKey::SetValue(kFullAppClientsKeyPath,
-                                    kRegValueProductVersion,
-                                    _T("0.10.69.5")));
-
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_FAILED,
-            im_->InstallApp(NULL,
-                            kAppGuid,
-                            cmd_exe_path_,
-                            arguments,
-                            _T(""),  // Installer data.
-                            kLanguageEnglish,
-                            &result_info_));
-
-  EXPECT_EQ(INSTALLER_RESULT_ERROR_OTHER, result_info_.type);
-  EXPECT_EQ(1, result_info_.code);
-  EXPECT_STREQ(_T("The installer encountered error 1."), result_info_.text);
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-}
-
-/* TODO(omaha): Figure out a way to perform this test.
-   ClearInstallerResultApiValues clears the result values it sets.
-   TODO(omaha): Add another test that reports an error in using registry API.
-// Also tests that the launch cmd is set.
-TEST_F(InstallerWrapperUserTest,
-       InstallApp_ExeInstallerReturnsNonZeroExitCode_InstallerResultSuccess) {
-  const TCHAR kCommandToExecute[] = _T("exit 1");
-
-  CString arguments;
-  arguments.Format(kExecuteCommandAndTerminateSwitch, kCommandToExecute);
-
-  // Create the Clients key since this isn't an actual installer.
-  ASSERT_SUCCEEDED(RegKey::CreateKey(kFullAppClientsKeyPath));
-  ASSERT_TRUE(RegKey::HasKey(kFullAppClientsKeyPath));
-  ASSERT_SUCCEEDED(RegKey::SetValue(kFullAppClientsKeyPath,
-                                    kRegValueProductVersion,
-                                    _T("0.10.69.5")));
-  SetupInstallerResultRegistry(kAppId,
-                               true, kResultSuccess,
-                               false, 0,
-                               false, _T(""),
-                               true, kLaunchCmdLine);
-
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  EXPECT_SUCCEEDED(im_->InstallApp(kAppGuid,
-                                   cmd_exe_path_,
-                                   arguments,
-                                   _T(""),  // Installer data.
-                                   &result_info_));
-
-  EXPECT_EQ(INSTALLER_RESULT_SUCCESS, result_info_.type);
-  EXPECT_EQ(1, result_info_.code);
-  EXPECT_TRUE(result_info_.text.IsEmpty());
-  EXPECT_STREQ(kLaunchCmdLine, result_info_.post_install_launch_command_line);
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_LAUNCH_COMMAND,
-            result_info_.post_install_action);
-
-  EXPECT_SUCCEEDED(
-      im_->CheckApplicationRegistration(kAppGuid, _T("0.9.70.1"), false));
-
-  VerifyLastRegistryValues(kAppId,
-                           true, kResultSuccess,
-                           false, 0,
-                           false, _T(""),
-                           true, kLaunchCmdLine);
-}
-*/
-
-TEST_F(InstallerWrapperMachineTest, InstallApp_MsiInstallerSucceeds) {
-  if (!vista_util::IsUserAdmin()) {
-    std::wcout << _T("\tTest did not run because the user is not an admin.")
-               << std::endl;
-    return;
-  }
-  // We can't fake the registry keys because we are interacting with a real
-  // installer.
-  RestoreRegistryHives();
-
-  AdjustMsiTries(im_.get());
-
-  CString installer_full_path(
-      ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                      kSetupFooV1RelativeLocation));
-  ASSERT_TRUE(File::Exists(installer_full_path));
-
-  CString installer_log_full_path;
-  installer_log_full_path.Format(kMsiLogFormat, installer_full_path);
-
-  ASSERT_SUCCEEDED(File::Remove(installer_log_full_path));
-  ASSERT_FALSE(File::Exists(installer_log_full_path));
-
-  RegKey::DeleteKey(kFullFooAppClientKeyPath);
-  ASSERT_FALSE(RegKey::HasKey(kFullFooAppClientKeyPath));
-  RegKey::DeleteKey(kFullFooAppClientStateKeyPath);
-  ASSERT_FALSE(RegKey::HasKey(kFullFooAppClientStateKeyPath));
-
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  EXPECT_SUCCEEDED(im_->InstallApp(NULL,
-                                   StringToGuid(kFooGuid),
-                                   installer_full_path,
-                                   _T(""),  // Arguments.
-                                   _T(""),  // Installer data.
-                                   kLanguageEnglish,
-                                   &result_info_));
-
-  EXPECT_EQ(INSTALLER_RESULT_SUCCESS, result_info_.type);
-  EXPECT_EQ(S_OK, result_info_.code);
-  EXPECT_TRUE(result_info_.text.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  EXPECT_TRUE(File::Exists(installer_log_full_path));
-
-  EXPECT_TRUE(RegKey::HasKey(kFullFooAppClientKeyPath));
-  EXPECT_FALSE(RegKey::HasKey(kFullFooAppClientStateKeyPath));
-  // Verify the installer did not write a value that is to be written only in
-  // the presence of an MSI property that was not specified.
-  EXPECT_FALSE(RegKey::HasValue(kFullFooAppClientKeyPath,
-                                kFooInstallerBarValueName));
-  // EXPECT_SUCCEEDED(im_->CheckApplicationRegistration(
-  //                      StringToGuid(kFooGuid), _T("0.9.70.1"), false));
-
-  UninstallTestMsi(installer_full_path);
-
-  EXPECT_FALSE(RegKey::HasKey(kFullFooAppClientKeyPath));
-  EXPECT_SUCCEEDED(RegKey::DeleteKey(kFullFooAppClientKeyPath));
-}
-
-TEST_F(InstallerWrapperMachineTest,
-       InstallApp_MsiInstallerWithArgumentSucceeds) {
-  if (!vista_util::IsUserAdmin()) {
-    std::wcout << _T("\tTest did not run because the user is not an admin.")
-               << std::endl;
-    return;
-  }
-
-  // We can't fake the registry keys because we are interacting with a real
-  // installer.
-  RestoreRegistryHives();
-
-  AdjustMsiTries(im_.get());
-
-  CString installer_full_path(
-      ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                      kSetupFooV1RelativeLocation));
-  ASSERT_TRUE(File::Exists(installer_full_path));
-
-  CString installer_log_full_path;
-  installer_log_full_path.Format(kMsiLogFormat, installer_full_path);
-
-  ASSERT_SUCCEEDED(File::Remove(installer_log_full_path));
-  ASSERT_FALSE(File::Exists(installer_log_full_path));
-
-  RegKey::DeleteKey(kFullFooAppClientKeyPath);
-  ASSERT_FALSE(RegKey::HasKey(kFullFooAppClientKeyPath));
-  RegKey::DeleteKey(kFullFooAppClientStateKeyPath);
-  ASSERT_FALSE(RegKey::HasKey(kFullFooAppClientStateKeyPath));
-
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  EXPECT_SUCCEEDED(im_->InstallApp(NULL,
-                                   StringToGuid(kFooGuid),
-                                   installer_full_path,
-                                   kFooInstallerBarPropertyArg,
-                                   _T(""),  // Installer data.
-                                   kLanguageEnglish,
-                                   &result_info_));
-
-  EXPECT_EQ(INSTALLER_RESULT_SUCCESS, result_info_.type);
-  EXPECT_EQ(S_OK, result_info_.code);
-  EXPECT_TRUE(result_info_.text.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  EXPECT_TRUE(File::Exists(installer_log_full_path));
-
-  EXPECT_TRUE(RegKey::HasKey(kFullFooAppClientKeyPath));
-  EXPECT_FALSE(RegKey::HasKey(kFullFooAppClientStateKeyPath));
-  EXPECT_TRUE(RegKey::HasValue(kFullFooAppClientKeyPath,
-                               kFooInstallerBarValueName));
-  DWORD barprop_value = 0;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kFullFooAppClientKeyPath,
-                                    kFooInstallerBarValueName,
-                                    &barprop_value));
-  EXPECT_EQ(7, barprop_value);
-
-  // EXPECT_SUCCEEDED(im_->CheckApplicationRegistration(
-  //                      StringToGuid(kFooGuid), _T("0.9.70.1"), false));
-
-  UninstallTestMsi(installer_full_path);
-
-  EXPECT_FALSE(RegKey::HasKey(kFullFooAppClientKeyPath));
-  EXPECT_SUCCEEDED(RegKey::DeleteKey(kFullFooAppClientKeyPath));
-}
-
-// The use of kGoogleUpdateAppId is the key to this test.
-// Note that the version is not changed - this is the normal self-update case.
-TEST_F(InstallerWrapperUserTest, InstallApp_UpdateOmahaSucceeds) {
-  CString arguments;
-  arguments.Format(kExecuteCommandAndTerminateSwitch, _T(""));
-
-  const CString kExistingVersion(_T("0.9.69.5"));
-
-  // Because we don't actually run the Omaha installer, we need to make sure
-  // its Clients key and pv value exist to avoid an error.
-  ASSERT_SUCCEEDED(RegKey::CreateKey(USER_REG_CLIENTS_GOOPDATE));
-  ASSERT_TRUE(RegKey::HasKey(USER_REG_CLIENTS_GOOPDATE));
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    kExistingVersion));
-
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  EXPECT_SUCCEEDED(im_->InstallApp(NULL,
-                                   kGoopdateGuid,
-                                   cmd_exe_path_,
-                                   arguments,
-                                   _T(""),  // Installer data.
-                                   kLanguageEnglish,
-                                   &result_info_));
-
-  EXPECT_EQ(INSTALLER_RESULT_SUCCESS, result_info_.type);
-  EXPECT_EQ(S_OK, result_info_.code);
-  EXPECT_TRUE(result_info_.text.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  EXPECT_TRUE(RegKey::HasKey(USER_REG_CLIENTS_GOOPDATE));
-  CString version;
-  EXPECT_SUCCEEDED(RegKey::GetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    &version));
-  EXPECT_STREQ(kExistingVersion, version);
-
-  // Do not call CheckApplicationRegistration for Omaha.
-}
-
-// The main purpose of this test is to ensure that self-updates don't fail if
-// Omaha's Clients key doesn't exist for some reason.
-TEST_F(InstallerWrapperUserTest,
-       InstallApp_UpdateOmahaSucceedsWhenClientsKeyAbsent) {
-  CString arguments;
-  arguments.Format(kExecuteCommandAndTerminateSwitch, _T(""));
-
-  const CString kExistingVersion(_T("0.9.69.5"));
-
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  EXPECT_SUCCEEDED(im_->InstallApp(NULL,
-                                   kGoopdateGuid,
-                                   cmd_exe_path_,
-                                   arguments,
-                                   _T(""),  // Installer data.
-                                   kLanguageEnglish,
-                                   &result_info_));
-
-  EXPECT_EQ(INSTALLER_RESULT_SUCCESS, result_info_.type);
-  EXPECT_EQ(S_OK, result_info_.code);
-  EXPECT_TRUE(result_info_.text.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  EXPECT_FALSE(RegKey::HasKey(USER_REG_CLIENTS_GOOPDATE));
-
-  // Do not call CheckApplicationRegistration for Omaha.
-}
-
-TEST_F(InstallerWrapperUserTest, InstallApp_InstallerDoesNotWriteClientsKey) {
-  CString arguments;
-  arguments.Format(kExecuteCommandAndTerminateSwitch, _T(""));
-
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  EXPECT_SUCCEEDED(im_->InstallApp(NULL,
-                                   kAppGuid,
-                                   cmd_exe_path_,
-                                   arguments,
-                                   _T(""),  // Installer data.
-                                   kLanguageEnglish,
-                                   &result_info_));
-
-  EXPECT_FALSE(RegKey::HasKey(kFullAppClientsKeyPath));
-  EXPECT_FALSE(RegKey::HasKey(kFullAppClientStateKeyPath));
-
-  EXPECT_EQ(INSTALLER_RESULT_SUCCESS, result_info_.type);
-  EXPECT_EQ(S_OK, result_info_.code);
-  EXPECT_TRUE(result_info_.text.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  // EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_DID_NOT_WRITE_CLIENTS_KEY,
-  //           im_->CheckApplicationRegistration(kAppGuid, _T(""), true));
-}
-
-TEST_F(InstallerWrapperUserTest,
-       InstallApp_InstallerFailureMsiFileDoesNotExist) {
-  CPath msi_path(app_util::GetTempDir());
-  msi_path.Append(_T("foo.msi"));
-  const CString log_path = msi_path + _T(".log");
-
-  AdjustMsiTries(im_.get());
-
-  ASSERT_SUCCEEDED(File::Remove(log_path));
-  ASSERT_FALSE(File::Exists(log_path));
-
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  EXPECT_EQ(GOOPDATEINSTALL_E_INSTALLER_FAILED,
-            im_->InstallApp(NULL,
-                            kAppGuid,
-                            msi_path,
-                            _T(""),  // Arguments.
-                            _T(""),  // Installer data.
-                            kLanguageEnglish,
-                            &result_info_));
-
-  EXPECT_EQ(INSTALLER_RESULT_ERROR_MSI, result_info_.type);
-  EXPECT_EQ(ERROR_INSTALL_PACKAGE_OPEN_FAILED, result_info_.code);
-  EXPECT_STREQ(kError1619MessagePrefix,
-               result_info_.text.Left(kError1619MessagePrefixLength));
-  VerifyStringIsMsiPackageOpenFailedString(
-      result_info_.text.Mid(kError1619MessagePrefixLength));
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  // msiexec creates an empty log file.
-  EXPECT_TRUE(File::Exists(log_path));
-  EXPECT_SUCCEEDED(File::Remove(log_path));
-
-  EXPECT_FALSE(RegKey::HasKey(kFullAppClientsKeyPath));
-  EXPECT_FALSE(RegKey::HasKey(kFullAppClientStateKeyPath));
-}
-
-// Simulates the MSI busy error by having an exe installer return the error
-// as its exit code and specifying MSI error using Installer Result API.
-// Assumes reg.exe is in the path.
-TEST_F(InstallerWrapperUserTest, InstallApp_MsiIsBusy_NoRetries) {
-  CString commands;
-  commands.Format(kExecuteTwoCommandsFormat,
-                  set_installer_result_type_msi_error_cmd_,
-                  kMsiInstallerBusyExitCodeCmd);
-
-  CString arguments;
-  arguments.Format(kExecuteCommandAndTerminateSwitch, commands);
-
-  LowResTimer install_timer(true);
-
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  EXPECT_EQ(GOOPDATEINSTALL_E_MSI_INSTALL_ALREADY_RUNNING,
-            im_->InstallApp(NULL,
-                            kAppGuid,
-                            cmd_exe_path_,
-                            arguments,
-                            _T(""),  // Installer data.
-                            kLanguageEnglish,
-                            &result_info_));
-
-  EXPECT_GT(2, install_timer.GetSeconds());  // Check Omaha did not retry.
-
-  EXPECT_EQ(INSTALLER_RESULT_ERROR_MSI, result_info_.type);
-  EXPECT_EQ(ERROR_INSTALL_ALREADY_RUNNING, result_info_.code);
-  EXPECT_STREQ(kError1618MessagePrefix,
-               result_info_.text.Left(kError1618MessagePrefixLength));
-  VerifyStringIsMsiBusyString(
-      result_info_.text.Mid(kError1618MessagePrefixLength));
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-}
-
-// This test takes at least 5 seconds, so it is not run all the time.
-TEST_F(InstallerWrapperUserTest, InstallApp_MsiIsBusy_TwoTries) {
-  if (!ShouldRunLargeTest()) {
-    return;
-  }
-
-  CString commands;
-  commands.Format(kExecuteTwoCommandsFormat,
-                  set_installer_result_type_msi_error_cmd_,
-                  kMsiInstallerBusyExitCodeCmd);
-
-  CString arguments;
-  arguments.Format(kExecuteCommandAndTerminateSwitch, commands);
-
-  im_->set_num_tries_when_msi_busy(2);
-
-  LowResTimer install_timer(true);
-
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-  EXPECT_EQ(GOOPDATEINSTALL_E_MSI_INSTALL_ALREADY_RUNNING,
-            im_->InstallApp(NULL,
-                            kAppGuid,
-                            cmd_exe_path_,
-                            arguments,
-                            _T(""),  // Installer data.
-                            kLanguageEnglish,
-                            &result_info_));
-
-  EXPECT_LE(5, install_timer.GetSeconds());  // Check Omaha did retry.
-  EXPECT_GT(10, install_timer.GetSeconds());
-
-  EXPECT_EQ(INSTALLER_RESULT_ERROR_MSI, result_info_.type);
-  EXPECT_EQ(ERROR_INSTALL_ALREADY_RUNNING, result_info_.code);
-  EXPECT_STREQ(kError1618MessagePrefix,
-               result_info_.text.Left(kError1618MessagePrefixLength));
-  VerifyStringIsMsiBusyString(
-      result_info_.text.Mid(kError1618MessagePrefixLength));
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-}
-
-// This test uses cmd.exe as an installer that leaves the payload files.
-TEST_F(InstallerWrapperUserTest, InstallApp_InstallMultipleApps) {
-  const TCHAR kPayloadFileName1[] = _T("exe_payload1.txt");
-  const TCHAR kPayloadFileName2[] = _T("exe_payload2.txt");
-  const TCHAR kCommandToExecute[] = _T("echo \"hi\" > %s");
-
-  CString full_command_to_execute;
-  full_command_to_execute.Format(kCommandToExecute, kPayloadFileName1);
-  CString arguments1;
-  arguments1.Format(kExecuteCommandAndTerminateSwitch, full_command_to_execute);
-
-  full_command_to_execute.Format(kCommandToExecute, kPayloadFileName2);
-  CString arguments2;
-  arguments2.Format(kExecuteCommandAndTerminateSwitch, full_command_to_execute);
-
-  EXPECT_SUCCEEDED(File::Remove(kPayloadFileName1));
-  EXPECT_FALSE(File::Exists(kPayloadFileName1));
-  EXPECT_SUCCEEDED(File::Remove(kPayloadFileName2));
-  EXPECT_FALSE(File::Exists(kPayloadFileName2));
-
-  // Create the Clients key since this isn't an actual installer.
-  EXPECT_SUCCEEDED(RegKey::CreateKey(kFullAppClientsKeyPath));
-  EXPECT_TRUE(RegKey::HasKey(kFullAppClientsKeyPath));
-  EXPECT_SUCCEEDED(RegKey::SetValue(kFullAppClientsKeyPath,
-                                    kRegValueProductVersion,
-                                    _T("0.10.69.5")));
-
-  __mutexScope(AppManager::Instance()->GetRegistryStableStateLock());
-
-  EXPECT_SUCCEEDED(im_->InstallApp(NULL,
-                                   kAppGuid,
-                                   cmd_exe_path_,
-                                   arguments1,
-                                   _T(""),  // Installer data.
-                                   kLanguageEnglish,
-                                   &result_info_));
-
-  EXPECT_EQ(INSTALLER_RESULT_SUCCESS, result_info_.type);
-  EXPECT_EQ(S_OK, result_info_.code);
-  EXPECT_TRUE(result_info_.text.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  // EXPECT_SUCCEEDED(
-  //     im_->CheckApplicationRegistration(kAppGuid, _T("0.9.70.1"), false));
-
-  EXPECT_TRUE(File::Exists(kPayloadFileName1));
-  EXPECT_SUCCEEDED(File::Remove(kPayloadFileName1));
-
-  // Run the second installer.
-
-  result_info_.type = INSTALLER_RESULT_UNKNOWN;
-  result_info_.code = kInitialErrorValue;
-
-  EXPECT_SUCCEEDED(im_->InstallApp(NULL,
-                                   kAppGuid,
-                                   cmd_exe_path_,
-                                   arguments2,
-                                   _T(""),  // Installer data.
-                                   kLanguageEnglish,
-                                   &result_info_));
-
-  EXPECT_EQ(INSTALLER_RESULT_SUCCESS, result_info_.type);
-  EXPECT_EQ(S_OK, result_info_.code);
-  EXPECT_TRUE(result_info_.text.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  // EXPECT_SUCCEEDED(
-  //     im_->CheckApplicationRegistration(kAppGuid, _T("0.9.70.1"), false));
-
-  EXPECT_TRUE(File::Exists(kPayloadFileName2));
-  EXPECT_SUCCEEDED(File::Remove(kPayloadFileName2));
-}
-
-//
-// GetInstallerResultHelper tests
-//
-
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_NoRegistry_MSI_ZeroExitCode) {
-  CallGetInstallerResultHelper(kAppGuid, kMsi, 0, &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_SUCCESS, result_info_.type);
-  EXPECT_EQ(0, result_info_.code);
-  EXPECT_TRUE(result_info_.text.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  VerifyNoLastRegistryValues(kAppId);
-}
-
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_NoRegistry_MSI_NonZeroExitCode) {
-  CallGetInstallerResultHelper(kAppGuid, kMsi, 1603, &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_ERROR_MSI, result_info_.type);
-  EXPECT_EQ(1603, result_info_.code);
-  EXPECT_STREQ(kError1603Text, result_info_.text);
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  VerifyNoLastRegistryValues(kAppId);
-}
-
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_NoRegistry_EXE_ZeroExitCode) {
-  CallGetInstallerResultHelper(kAppGuid, kOther, 0, &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_SUCCESS, result_info_.type);
-  EXPECT_EQ(0, result_info_.code);
-  EXPECT_TRUE(result_info_.text.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  VerifyNoLastRegistryValues(kAppId);
-}
-
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_NoRegistry_EXE_NonZeroExitCode_SmallNumber) {
-  CallGetInstallerResultHelper(kAppGuid, kOther, 8, &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_ERROR_OTHER, result_info_.type);
-  EXPECT_EQ(8, result_info_.code);
-  EXPECT_STREQ(_T("The installer encountered error 8."), result_info_.text);
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  VerifyNoLastRegistryValues(kAppId);
-}
-
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_NoRegistry_EXE_NonZeroExitCode_HRESULTFailure) {
-  CallGetInstallerResultHelper(kAppGuid, kOther, 0x80004005, &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_ERROR_OTHER, result_info_.type);
-  EXPECT_EQ(0x80004005, result_info_.code);
-  EXPECT_STREQ(_T("The installer encountered error 0x80004005."),
-               result_info_.text);
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  VerifyNoLastRegistryValues(kAppId);
-}
-
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_ExitCode_MSI) {
-  SetupInstallerResultRegistry(kAppId,
-                               true, kResultExitCode,
-                               false, 0,
-                               false, 0,
-                               false, _T(""),
-                               false, _T(""));
-
-  CallGetInstallerResultHelper(kAppGuid, kMsi, 1603, &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_ERROR_MSI, result_info_.type);
-  EXPECT_EQ(1603, result_info_.code);
-  EXPECT_STREQ(kError1603Text, result_info_.text);
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  VerifyLastRegistryValues(kAppId,
-                           true, kResultExitCode,
-                           false, 0,
-                           false, 0,
-                           false, _T(""),
-                           false, _T(""));
-}
-
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_NoRegistry_MSI_RebootRequired) {
-  CallGetInstallerResultHelper(kAppGuid, kMsi, ERROR_SUCCESS_REBOOT_REQUIRED,
-                               &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_SUCCESS, result_info_.type);
-  EXPECT_EQ(0, result_info_.code);
-  EXPECT_TRUE(result_info_.text.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_REBOOT, result_info_.post_install_action);
-
-  VerifyNoLastRegistryValues(kAppId);
-}
-
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_SystemError_EXE_RebootRequired) {
-  SetupInstallerResultRegistry(kAppId,
-                               true, kResultFailedSystemError,
-                               true, ERROR_SUCCESS_REBOOT_REQUIRED,
-                               false, 0,
-                               false, _T(""),
-                               true, kLaunchCmdLine);
-
-  CallGetInstallerResultHelper(kAppGuid, kOther, 1, &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_SUCCESS, result_info_.type);
-  EXPECT_EQ(0, result_info_.code);
-  EXPECT_TRUE(result_info_.text.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_REBOOT, result_info_.post_install_action);
-
-  VerifyLastRegistryValues(kAppId,
-                           true, kResultFailedSystemError,
-                           true, ERROR_SUCCESS_REBOOT_REQUIRED,
-                           false, 0,
-                           false, _T(""),
-                           true, kLaunchCmdLine);
-}
-
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_CustomError_ShouldNotReboot) {
-  SetupInstallerResultRegistry(kAppId,
-                               true, kResultFailedCustomError,
-                               true, ERROR_SUCCESS_REBOOT_REQUIRED,
-                               false, 0,
-                               false, _T(""),
-                               false, _T(""));
-
-  CallGetInstallerResultHelper(kAppGuid, kMsi, 0, &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_ERROR_OTHER, result_info_.type);
-  EXPECT_EQ(ERROR_SUCCESS_REBOOT_REQUIRED, result_info_.code);
-  EXPECT_STREQ(_T("The installer encountered error 3010."), result_info_.text);
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-}
-
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_Success_NoErrorCode) {
-  SetupInstallerResultRegistry(kAppId,
-                               true, kResultSuccess,
-                               false, 0,
-                               false, 0,
-                               false, _T(""),
-                               false, _T(""));
-
-  CallGetInstallerResultHelper(kAppGuid, kOther, 99, &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_SUCCESS, result_info_.type);
-  EXPECT_EQ(99, result_info_.code);
-  EXPECT_TRUE(result_info_.text.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  VerifyLastRegistryValues(kAppId,
-                           true, kResultSuccess,
-                           false, 0,
-                           false, 0,
-                           false, _T(""),
-                           false, _T(""));
-}
-
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_Success_AllValues) {
-  SetupInstallerResultRegistry(kAppId,
-                               true, kResultSuccess,
-                               true, 555,
-                               false, 0,
-                               true, _T("an ignored error"),
-                               true, kLaunchCmdLine);
-
-  CallGetInstallerResultHelper(kAppGuid, kOther, 99, &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_SUCCESS, result_info_.type);
-  EXPECT_EQ(555, result_info_.code) <<
-      _T("InstallerError overwrites exit code.");
-  EXPECT_FALSE(result_info_.text.IsEmpty()) <<
-      _T("UIString is ignored for Success.");
-  EXPECT_STREQ(kLaunchCmdLine, result_info_.post_install_launch_command_line);
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_LAUNCH_COMMAND,
-            result_info_.post_install_action);
-
-  VerifyLastRegistryValues(kAppId,
-                           true, kResultSuccess,
-                           true, 555,
-                           false, 0,
-                           true, _T("an ignored error"),
-                           true, kLaunchCmdLine);
-}
-
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_LaunchCmdOnly_MSI_ZeroExitCode) {
-  SetupInstallerResultRegistry(kAppId,
-                               false, 0,
-                               false, 0,
-                               false, 0,
-                               false, _T(""),
-                               true, kLaunchCmdLine);
-
-  CallGetInstallerResultHelper(kAppGuid, kMsi, 0, &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_SUCCESS, result_info_.type);
-  EXPECT_EQ(0, result_info_.code);
-  EXPECT_TRUE(result_info_.text.IsEmpty());
-  EXPECT_STREQ(kLaunchCmdLine, result_info_.post_install_launch_command_line);
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_LAUNCH_COMMAND,
-            result_info_.post_install_action);
-
-  VerifyLastRegistryValues(kAppId,
-                           false, 0,
-                           false, 0,
-                           false, 0,
-                           false, _T(""),
-                           true, kLaunchCmdLine);
-}
-
-// Exit code is used when no error code is present. It's interpreted as a system
-// error even though the installer is not an MSI.
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_Failed_NoErrorCodeOrUiString) {
-  SetupInstallerResultRegistry(kAppId,
-                               true, kResultFailedCustomError,
-                               false, 0,
-                               false, 0,
-                               false, _T(""),
-                               false, _T(""));
-
-  CallGetInstallerResultHelper(kAppGuid, kOther, 8, &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_ERROR_OTHER, result_info_.type);
-  EXPECT_EQ(8, result_info_.code);
-  EXPECT_STREQ(_T("The installer encountered error 8."), result_info_.text);
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  VerifyLastRegistryValues(kAppId,
-                           true, kResultFailedCustomError,
-                           false, 0,
-                           false, 0,
-                           false, _T(""),
-                           false, _T(""));
-}
-
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_Failed_WithErrorCode) {
-  SetupInstallerResultRegistry(kAppId,
-                               true, kResultFailedCustomError,
-                               true, 8,
-                               false, 0,
-                               false, _T(""),
-                               false, _T(""));
-
-  CallGetInstallerResultHelper(kAppGuid, kOther, 1618, &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_ERROR_OTHER, result_info_.type);
-  EXPECT_EQ(8, result_info_.code);
-  EXPECT_STREQ(_T("The installer encountered error 8."), result_info_.text);
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  VerifyLastRegistryValues(kAppId,
-                           true, kResultFailedCustomError,
-                           true, 8,
-                           false, 0,
-                           false, _T(""),
-                           false, _T(""));
-}
-
-// This test shows that command line is read and
-// POST_INSTALL_ACTION_LAUNCH_COMMAND is set.
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_Failed_AllValues) {
-  const DWORD kInstallerErrorValue = 8;
-  const TCHAR* const kUiString = _T("a message from the installer");
-
-  SetupInstallerResultRegistry(kAppId,
-                               true, kResultFailedCustomError,
-                               true, kInstallerErrorValue,
-                               false, 0,
-                               true, kUiString,
-                               true, kLaunchCmdLine);
-
-  CallGetInstallerResultHelper(kAppGuid, kOther, 1618, &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_ERROR_OTHER, result_info_.type);
-  EXPECT_EQ(kInstallerErrorValue, result_info_.code);
-  EXPECT_STREQ(kUiString, result_info_.text);
-  EXPECT_STREQ(kLaunchCmdLine, result_info_.post_install_launch_command_line);
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_LAUNCH_COMMAND,
-            result_info_.post_install_action);
-
-  VerifyLastRegistryValues(kAppId,
-                           true, kResultFailedCustomError,
-                           true, kInstallerErrorValue,
-                           false, 0,
-                           true, kUiString,
-                           true, kLaunchCmdLine);
-}
-
-// Exit code is used and interpreted as MSI error when no error code present.
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_FailedMsiError_NoErrorCode) {
-  SetupInstallerResultRegistry(kAppId,
-                               true, kResultFailedMsiError,
-                               false, 0,
-                               false, 0,
-                               false, _T(""),
-                               false, _T(""));
-
-  CallGetInstallerResultHelper(kAppGuid, kOther, 1603, &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_ERROR_MSI, result_info_.type);
-  EXPECT_EQ(1603, result_info_.code);
-  EXPECT_STREQ(kError1603Text, result_info_.text);
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  VerifyLastRegistryValues(kAppId,
-                           true, kResultFailedMsiError,
-                           false, 0,
-                           false, 0,
-                           false, _T(""),
-                           false, _T(""));
-}
-
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_FailedMsiError_WithErrorCode) {
-  const DWORD kInstallerErrorValue = 1603;
-
-  SetupInstallerResultRegistry(kAppId,
-                               true, kResultFailedMsiError,
-                               true, kInstallerErrorValue,
-                               false, 0,
-                               false, _T(""),
-                               false, _T(""));
-
-  CallGetInstallerResultHelper(kAppGuid, kOther, 1618, &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_ERROR_MSI, result_info_.type);
-  EXPECT_EQ(kInstallerErrorValue, result_info_.code);
-  EXPECT_STREQ(kError1603Text, result_info_.text);
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  VerifyLastRegistryValues(kAppId,
-                           true, kResultFailedMsiError,
-                           true, kInstallerErrorValue,
-                           false, 0,
-                           false, _T(""),
-                           false, _T(""));
-}
-
-// This test shows that command line is read and
-// POST_INSTALL_ACTION_LAUNCH_COMMAND is set.
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_FailedMsiError_AllValues) {
-  const DWORD kInstallerErrorValue = 1603;
-
-  SetupInstallerResultRegistry(kAppId,
-                               true, kResultFailedMsiError,
-                               true, kInstallerErrorValue,
-                               false, 0,
-                               true, _T("an ignored error"),
-                               true, kLaunchCmdLine);
-
-  CallGetInstallerResultHelper(kAppGuid, kOther, 1618, &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_ERROR_MSI, result_info_.type);
-  EXPECT_EQ(kInstallerErrorValue, result_info_.code);
-  EXPECT_STREQ(kError1603Text, result_info_.text) << _T("UIString is ignored.");
-  EXPECT_STREQ(kLaunchCmdLine, result_info_.post_install_launch_command_line);
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_LAUNCH_COMMAND,
-            result_info_.post_install_action);
-
-  VerifyLastRegistryValues(kAppId,
-                           true, kResultFailedMsiError,
-                           true, kInstallerErrorValue,
-                           false, 0,
-                           true, _T("an ignored error"),
-                           true, kLaunchCmdLine);
-}
-
-// Exit code is used and interpreted as system error when no error code present.
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_FailedSystemError_NoErrorCode) {
-  SetupInstallerResultRegistry(kAppId,
-                               true, kResultFailedSystemError,
-                               false, 0,
-                               false, 0,
-                               false, _T(""),
-                               false, _T(""));
-
-  CallGetInstallerResultHelper(kAppGuid, kOther, 1603, &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_ERROR_SYSTEM, result_info_.type);
-  EXPECT_EQ(1603, result_info_.code);
-  EXPECT_STREQ(kError1603Text, result_info_.text);
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  VerifyLastRegistryValues(kAppId,
-                           true, kResultFailedSystemError,
-                           false, 0,
-                           false, 0,
-                           false, _T(""),
-                           false, _T(""));
-}
-
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_FailedSystemError_WithErrorCode) {
-  const DWORD kInstallerErrorValue = 1603;
-
-  SetupInstallerResultRegistry(kAppId,
-                               true, kResultFailedSystemError,
-                               true, kInstallerErrorValue,
-                               false, 0,
-                               false, _T(""),
-                               false, _T(""));
-
-  CallGetInstallerResultHelper(kAppGuid, kOther, 1618, &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_ERROR_SYSTEM, result_info_.type);
-  EXPECT_EQ(kInstallerErrorValue, result_info_.code);
-  EXPECT_STREQ(kError1603Text, result_info_.text);
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  VerifyLastRegistryValues(kAppId,
-                           true, kResultFailedSystemError,
-                           true, kInstallerErrorValue,
-                           false, 0,
-                           false, _T(""),
-                           false, _T(""));
-}
-
-// INSTALLER_RESULT_FAILED_SYSTEM_ERROR supports values beyond the basic
-// "System Error Codes" and their HRESULT equivalents.
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_FailedSystemError_WithHRESULTSystemError) {
-  const DWORD kInstallerErrorValue = 0x800B010F;
-
-  SetupInstallerResultRegistry(kAppId,
-                               true, kResultFailedSystemError,
-                               true, kInstallerErrorValue,
-                               false, 0,
-                               false, _T(""),
-                               false, _T(""));
-
-  CallGetInstallerResultHelper(kAppGuid, kOther, 1618, &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_ERROR_SYSTEM, result_info_.type);
-  EXPECT_EQ(kInstallerErrorValue, result_info_.code);
-  EXPECT_STREQ(kError0x800B010FText, result_info_.text);
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  VerifyLastRegistryValues(kAppId,
-                           true, kResultFailedSystemError,
-                           true, kInstallerErrorValue,
-                           false, 0,
-                           false, _T(""),
-                           false, _T(""));
-}
-
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_FailedSystemError_WithUnrecognizedError) {
-  const DWORD kInstallerErrorValue = 0x80040200;
-
-  SetupInstallerResultRegistry(kAppId,
-                               true, kResultFailedSystemError,
-                               true, kInstallerErrorValue,
-                               false, 0,
-                               false, _T(""),
-                               false, _T(""));
-
-  CallGetInstallerResultHelper(kAppGuid, kOther, 1618, &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_ERROR_SYSTEM, result_info_.type);
-  EXPECT_EQ(kInstallerErrorValue, result_info_.code);
-  EXPECT_STREQ(_T("The installer encountered error 0x80040200."),
-               result_info_.text);
-  EXPECT_TRUE(result_info_.post_install_launch_command_line.IsEmpty());
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_DEFAULT, result_info_.post_install_action);
-
-  VerifyLastRegistryValues(kAppId,
-                           true, kResultFailedSystemError,
-                           true, kInstallerErrorValue,
-                           false, 0,
-                           false, _T(""),
-                           false, _T(""));
-}
-
-// This test shows that command line is read and
-// POST_INSTALL_ACTION_LAUNCH_COMMAND is set.
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_FailedSystemError_AllValues) {
-  const DWORD kInstallerErrorValue = 1603;
-
-  SetupInstallerResultRegistry(kAppId,
-                               true, kResultFailedSystemError,
-                               true, kInstallerErrorValue,
-                               false, 0,
-                               true, _T("an ignored error"),
-                               true, kLaunchCmdLine);
-
-  CallGetInstallerResultHelper(kAppGuid, kOther, 1618, &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_ERROR_SYSTEM, result_info_.type);
-  EXPECT_EQ(kInstallerErrorValue, result_info_.code);
-  EXPECT_STREQ(kError1603Text, result_info_.text) << _T("UIString is ignored.");
-  EXPECT_STREQ(kLaunchCmdLine, result_info_.post_install_launch_command_line);
-  EXPECT_TRUE(result_info_.post_install_url.IsEmpty());
-  EXPECT_EQ(POST_INSTALL_ACTION_LAUNCH_COMMAND,
-            result_info_.post_install_action);
-
-  VerifyLastRegistryValues(kAppId,
-                           true, kResultFailedSystemError,
-                           true, kInstallerErrorValue,
-                           false, 0,
-                           true, _T("an ignored error"),
-                           true, kLaunchCmdLine);
-}
-
-TEST_F(InstallerWrapperUserGetInstallerResultHelperTest,
-       GetInstallerResultHelper_ExtraCode1) {
-  const DWORD kInstallerErrorValue = 10;
-  const DWORD kInstallerExtraCode1 = 0xabcd;
-
-  SetupInstallerResultRegistry(kAppId,
-                               true, kResultFailedCustomError,
-                               true, kInstallerErrorValue,
-                               true, kInstallerExtraCode1,
-                               false, _T(""),
-                               false, _T(""));
-
-  CallGetInstallerResultHelper(kAppGuid,
-                               kOther,
-                               kInstallerErrorValue,
-                               &result_info_);
-
-  EXPECT_EQ(INSTALLER_RESULT_ERROR_OTHER, result_info_.type);
-  EXPECT_EQ(kInstallerErrorValue, result_info_.code);
-  EXPECT_EQ(kInstallerExtraCode1, result_info_.extra_code1);
-
-  VerifyLastRegistryValues(kAppId,
-                           true, kResultFailedCustomError,
-                           true, kInstallerErrorValue,
-                           true, kInstallerExtraCode1,
-                           false, _T(""),
-                           false, _T(""));
-}
-
-// TODO(omaha): Add a machine test.
-
-}  // namespace omaha
diff --git a/goopdate/job_observer.cc b/goopdate/job_observer.cc
deleted file mode 100644
index b5ebd06..0000000
--- a/goopdate/job_observer.cc
+++ /dev/null
@@ -1,199 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/goopdate/job_observer.h"
-
-namespace omaha {
-
-JobObserverCOMDecorator::JobObserverCOMDecorator()
-    : job_observer_(NULL),
-      on_demand_events_(NULL),
-      worker_job_thread_id_(::GetCurrentThreadId()) {
-}
-
-JobObserverCOMDecorator::~JobObserverCOMDecorator() {
-  Uninitialize();
-}
-
-void JobObserverCOMDecorator::Initialize(IJobObserver* job_observer) {
-  ASSERT1(job_observer);
-
-  job_observer_ = job_observer;
-  job_observer->SetEventSink(this);
-}
-
-void JobObserverCOMDecorator::Uninitialize() {
-}
-
-void JobObserverCOMDecorator::OnCheckingForUpdate() {
-  ASSERT1(job_observer_);
-  ASSERT1(worker_job_thread_id_ == ::GetCurrentThreadId());
-
-  job_observer_->OnCheckingForUpdate();
-}
-
-void JobObserverCOMDecorator::OnUpdateAvailable(const CString& app_name,
-                                                const CString& version_string) {
-  UNREFERENCED_PARAMETER(app_name);
-  ASSERT1(job_observer_);
-  ASSERT1(worker_job_thread_id_ == ::GetCurrentThreadId());
-
-  job_observer_->OnUpdateAvailable(version_string);
-}
-
-void JobObserverCOMDecorator::OnWaitingToDownload(const CString& app_name) {
-  UNREFERENCED_PARAMETER(app_name);
-  ASSERT1(job_observer_);
-  ASSERT1(worker_job_thread_id_ == ::GetCurrentThreadId());
-
-  job_observer_->OnWaitingToDownload();
-}
-
-void JobObserverCOMDecorator::OnDownloading(const CString& app_name,
-                                            int time_remaining_ms,
-                                            int pos) {
-  UNREFERENCED_PARAMETER(app_name);
-  ASSERT1(job_observer_);
-  ASSERT1(worker_job_thread_id_ == ::GetCurrentThreadId());
-
-  job_observer_->OnDownloading(time_remaining_ms, pos);
-}
-
-void JobObserverCOMDecorator::OnWaitingRetryDownload(const CString& app_name,
-                                                     time64 next_retry_time) {
-  UNREFERENCED_PARAMETER(app_name);
-  UNREFERENCED_PARAMETER(next_retry_time);
-}
-
-void JobObserverCOMDecorator::OnWaitingToInstall(const CString& app_name,
-                                                 bool* can_start_install) {
-  UNREFERENCED_PARAMETER(app_name);
-  ASSERT1(job_observer_);
-  ASSERT1(worker_job_thread_id_ == ::GetCurrentThreadId());
-
-  job_observer_->OnWaitingToInstall();
-  *can_start_install = true;
-}
-
-void JobObserverCOMDecorator::OnInstalling(const CString& app_name) {
-  UNREFERENCED_PARAMETER(app_name);
-  ASSERT1(job_observer_);
-  ASSERT1(worker_job_thread_id_ == ::GetCurrentThreadId());
-
-  job_observer_->OnInstalling();
-}
-
-void JobObserverCOMDecorator::OnPause() {
-  ASSERT1(job_observer_);
-  ASSERT1(worker_job_thread_id_ == ::GetCurrentThreadId());
-
-  job_observer_->OnPause();
-}
-
-void JobObserverCOMDecorator::OnComplete(const ObserverCompletionInfo& info) {
-  if (job_observer_) {
-    ASSERT1(worker_job_thread_id_ == ::GetCurrentThreadId());
-
-    LegacyCompletionCodes completion_code =
-        static_cast<LegacyCompletionCodes>(info.completion_code);
-
-    // We do not want to send Omaha strings to the application, so pass an empty
-    // string instead.
-    job_observer_->OnComplete(completion_code, L"");
-    job_observer_ = NULL;
-  }
-
-  OnDemandEventsInterface* on_demand_events(on_demand_events());
-  if (on_demand_events) {
-    on_demand_events->DoExit();
-    SetEventSink(NULL);
-  }
-
-  // The message loop for OnDemand is on a separate thread, which needs to be
-  // signaled to exit.
-  ::PostQuitMessage(0);
-}
-
-void JobObserverCOMDecorator::SetEventSink(
-    OnDemandEventsInterface* event_sink) {
-  set_job_events(event_sink);
-}
-
-// TODO(omaha): Need to add a DoPause() to OnDemandEventsInterface. We never
-// expect these to be used since Chrome never did.
-STDMETHODIMP JobObserverCOMDecorator::DoPause() {
-  OnDemandEventsInterface* on_demand_events(on_demand_events());
-  if (!on_demand_events) {
-    return GOOPDATE_E_OBSERVER_PROGRESS_WND_EVENTS_NULL;
-  }
-
-  return E_NOTIMPL;
-}
-
-// TODO(omaha): Need to add a DoResume() to OnDemandEventsInterface.
-STDMETHODIMP JobObserverCOMDecorator::DoResume() {
-  OnDemandEventsInterface* on_demand_events(on_demand_events());
-  if (!on_demand_events) {
-    return GOOPDATE_E_OBSERVER_PROGRESS_WND_EVENTS_NULL;
-  }
-
-  return E_NOTIMPL;
-}
-
-STDMETHODIMP JobObserverCOMDecorator::DoClose() {
-  OnDemandEventsInterface* on_demand_events(on_demand_events());
-  if (!on_demand_events) {
-    return GOOPDATE_E_OBSERVER_PROGRESS_WND_EVENTS_NULL;
-  }
-
-  on_demand_events->DoClose();
-  return S_OK;
-}
-
-// TODO(omaha): Reconcile IJobObserver::DoRestartBrowsers() with
-// OnDemandEventsInterface::DoRestartBrowser().
-STDMETHODIMP JobObserverCOMDecorator::DoRestartBrowsers() {
-  OnDemandEventsInterface* on_demand_events(on_demand_events());
-  if (!on_demand_events) {
-    return GOOPDATE_E_OBSERVER_PROGRESS_WND_EVENTS_NULL;
-  }
-
-  return E_NOTIMPL;
-}
-
-STDMETHODIMP JobObserverCOMDecorator::DoReboot() {
-  OnDemandEventsInterface* on_demand_events(on_demand_events());
-  if (!on_demand_events) {
-    return GOOPDATE_E_OBSERVER_PROGRESS_WND_EVENTS_NULL;
-  }
-
-  return E_NOTIMPL;
-}
-
-STDMETHODIMP JobObserverCOMDecorator::DoLaunchBrowser(const WCHAR* url) {
-  UNREFERENCED_PARAMETER(url);
-  OnDemandEventsInterface* on_demand_events(on_demand_events());
-  if (!on_demand_events) {
-    return GOOPDATE_E_OBSERVER_PROGRESS_WND_EVENTS_NULL;
-  }
-
-  return E_NOTIMPL;
-}
-
-}  // namespace omaha
diff --git a/goopdate/job_observer.h b/goopdate/job_observer.h
deleted file mode 100644
index 269f000..0000000
--- a/goopdate/job_observer.h
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// TODO(omaha3): Rename the files and class to ondemand_com_decorator.* and
-// OnDemandCOMDecorator, respectively.
-
-#ifndef OMAHA_GOOPDATE_JOB_OBSERVER_H_
-#define OMAHA_GOOPDATE_JOB_OBSERVER_H_
-
-#include <windows.h>
-#include <atlbase.h>
-#include <atlcom.h>
-#include "base/scoped_ptr.h"
-#include "omaha/client/install_apps.h"
-#include "goopdate/omaha3_idl.h"
-
-namespace omaha {
-
-class JobObserverCOMDecorator
-  : public CComObjectRootEx<CComMultiThreadModel>,
-    public OnDemandObserver,
-    public IProgressWndEvents {
- public:
-  BEGIN_COM_MAP(JobObserverCOMDecorator)
-    COM_INTERFACE_ENTRY(IProgressWndEvents)
-  END_COM_MAP()
-
-  JobObserverCOMDecorator();
-  virtual ~JobObserverCOMDecorator();
-  void Initialize(IJobObserver* job_observer);
-
-  // OnDemandObserver implementation.
-  virtual void OnCheckingForUpdate();
-  virtual void OnUpdateAvailable(const CString& app_name,
-                                 const CString& version_string);
-  virtual void OnWaitingToDownload(const CString& app_name);
-  virtual void OnDownloading(const CString& app_name,
-                             int time_remaining_ms,
-                             int pos);
-  virtual void OnWaitingRetryDownload(const CString& app_name,
-                                      time64 next_retry_time);
-  virtual void OnWaitingToInstall(const CString& app_name,
-                                  bool* can_start_install);
-  virtual void OnInstalling(const CString& app_name);
-  virtual void OnPause();
-  virtual void OnComplete(const ObserverCompletionInfo& observer_info);
-  virtual void SetEventSink(OnDemandEventsInterface* event_sink);
-
-  void Uninitialize();
-
-  // IProgressWndEvents.
-  STDMETHOD(DoPause)();
-  STDMETHOD(DoResume)();
-  STDMETHOD(DoClose)();
-  STDMETHOD(DoRestartBrowsers)();
-  STDMETHOD(DoReboot)();
-  STDMETHOD(DoLaunchBrowser)(const WCHAR* url);
-
- private:
-  OnDemandEventsInterface* on_demand_events() {
-    return on_demand_events_;
-  }
-
-  // Since the code is running in an MTA, write access to
-  // on_demand_events_ must be atomic.
-  void set_job_events(OnDemandEventsInterface* on_demand_events) {
-    // InterlockedExchangePointer is broken due to ATL defining a function with
-    // the same name in the global namespace and hiding the Win32 API.
-    // InterlockedExchange introduces a full memory barrier.
-    ::InterlockedExchange(
-        reinterpret_cast<volatile LONG*>(&on_demand_events_),
-        reinterpret_cast<LONG>(on_demand_events));
-  }
-
-  CComPtr<IJobObserver> job_observer_;
-  OnDemandEventsInterface* volatile on_demand_events_;
-  DWORD thread_id_;
-  DWORD worker_job_thread_id_;
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_JOB_OBSERVER_H_
diff --git a/goopdate/main.cc b/goopdate/main.cc
deleted file mode 100644
index cb4d182..0000000
--- a/goopdate/main.cc
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-#include "omaha/base/logging.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/utils.h"
-#include "omaha/goopdate/goopdate.h"
-#include "omaha/goopdate/omaha3_idl_datax.h"
-
-namespace {
-
-HINSTANCE dll_instance = NULL;
-
-}  // namespace
-
-// Captures the module instance. Never call ::DisableThreadLibraryCalls in a
-// module that statically links with LIBC and it is not using
-// _beginthreadex for the thread creation. This will leak the _tiddata.
-extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void*) {
-  switch (reason) {
-    case DLL_PROCESS_ATTACH:
-      dll_instance = instance;
-      omaha::InitializeVersionFromModule(instance);
-      break;
-    case DLL_THREAD_ATTACH:
-    case DLL_THREAD_DETACH:
-    case DLL_PROCESS_DETACH:
-    default:
-      break;
-  }
-
-  return TRUE;
-}
-
-// Since this entry point is called by a tiny shell we've built without
-// CRT support, the command line parameters contain the command line that
-// the OS created the process with. By convention, the first token in the
-// command line string is the filename of the program executable. The CRT takes
-// care of that for program that link with the standard libraries. Therefore,
-// there is a difference in the command line that the OS knows and the
-// command line that is passed to WinMain by the CRT. Our command line
-// parsing code takes care of this difference.
-extern "C" int APIENTRY DllEntry(TCHAR* cmd_line, int cmd_show) {
-  OPT_LOG(L1, (_T("[DllEntry][%s]"), cmd_line));
-
-  bool is_local_system =  false;
-  HRESULT hr = omaha::IsSystemProcess(&is_local_system);
-  assert(SUCCEEDED(hr));   // Assert because we cannot display UI here.
-  if (SUCCEEDED(hr)) {
-    omaha::Goopdate goopdate(is_local_system);
-    hr = goopdate.Main(dll_instance, cmd_line, cmd_show);
-    if (FAILED(hr)) {
-      OPT_LOG(LEVEL_ERROR, (_T("[Main failed][%s][0x%08x]"), cmd_line, hr));
-    }
-  }
-
-  OPT_LOG(L1, (_T("[DllEntry exit][0x%08x]"), hr));
-  return static_cast<int>(hr);
-}
-
diff --git a/goopdate/main.h b/goopdate/main.h
deleted file mode 100644
index 73f020f..0000000
--- a/goopdate/main.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#ifndef OMAHA_GOOPDATE_MAIN_H__
-#define OMAHA_GOOPDATE_MAIN_H__
-
-#include <windows.h>
-#include <tchar.h>
-
-extern "C" typedef int (APIENTRY *DllEntry)(const TCHAR* cmd_line,
-                                            int cmd_show);
-
-#endif  // OMAHA_GOOPDATE_MAIN_H__
diff --git a/goopdate/main_unittest.cc b/goopdate/main_unittest.cc
deleted file mode 100644
index 142bbbb..0000000
--- a/goopdate/main_unittest.cc
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include <shlwapi.h>
-#include "omaha/base/constants.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/goopdate/main.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-  TEST(MainTest, EntryPoint) {
-  TCHAR path[MAX_PATH] = {0};
-  ASSERT_TRUE(::GetModuleFileName(NULL, path, MAX_PATH));
-  ::PathRemoveFileSpec(path);
-  ASSERT_TRUE(::PathAppend(path, kOmahaDllName));
-
-  HMODULE module(::LoadLibraryEx(path, NULL, 0));
-  ASSERT_TRUE(module);
-
-  DllEntry dll_entry = reinterpret_cast<DllEntry>(
-      ::GetProcAddress(module, kGoopdateDllEntryAnsi));
-  ASSERT_TRUE(dll_entry);
-
-  ::FreeLibrary(module);
-}
-
-}  // namespace omaha
diff --git a/goopdate/model.cc b/goopdate/model.cc
deleted file mode 100644
index c0fffa8..0000000
--- a/goopdate/model.cc
+++ /dev/null
@@ -1,170 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/model.h"
-#include <algorithm>
-#include <functional>
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/goopdate/worker.h"
-
-namespace omaha {
-
-Model::Model(WorkerModelInterface* worker) : worker_(NULL) {
-  CORE_LOG(L3, (_T("[Model::Model]")));
-  ASSERT1(worker);
-
-  // Initialization of the object must be thread safe.
-  __mutexScope(lock_);
-  worker_ = worker;
-}
-
-Model::~Model() {
-  CORE_LOG(L3, (_T("[Model::~Model]")));
-
-  __mutexScope(lock_);
-  ASSERT1(app_bundles_.empty());
-  worker_ = NULL;
-}
-
-shared_ptr<AppBundle> Model::CreateAppBundle(bool is_machine) {
-  __mutexScope(lock_);
-
-  shared_ptr<AppBundle> app_bundle(new AppBundle(is_machine, this));
-  app_bundles_.push_back(AppBundleWeakPtr(app_bundle));
-
-  const int lock_count(worker_->Lock());
-
-  CORE_LOG(L3, (_T("[Model::CreateAppBundle][bundle %p][module lock %i]"),
-      app_bundle.get(), lock_count));
-
-  return app_bundle;
-}
-
-// Erases the expired AppBundle weak pointers.
-void Model::CleanupExpiredAppBundles() {
-  __mutexScope(lock_);
-
-  typedef std::vector<AppBundleWeakPtr>::iterator Iterator;
-  Iterator it = remove_if(app_bundles_.begin(),
-                          app_bundles_.end(),
-                          std::mem_fun_ref(&AppBundleWeakPtr::expired));
-
-  const size_t num_bundles = distance(it, app_bundles_.end());
-
-  app_bundles_.erase(it, app_bundles_.end());
-  for (size_t i = 0; i != num_bundles; ++i) {
-    const int lock_count(worker_->Unlock());
-
-    CORE_LOG(L3, (_T("[Model::CleanupExpiredAppBundles][module unlock %i]"),
-        lock_count));
-  }
-}
-
-size_t Model::GetNumberOfAppBundles() const {
-  __mutexScope(lock_);
-  return app_bundles_.size();
-}
-
-shared_ptr<AppBundle> Model::GetAppBundle(size_t index) const {
-  __mutexScope(lock_);
-  ASSERT1(!app_bundles_[index].expired());
-  return app_bundles_[index].lock();
-}
-
-HRESULT Model::CheckForUpdate(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[Model::CheckForUpdate][0x%p]"), app_bundle));
-
-  __mutexScope(lock_);
-
-  return worker_->CheckForUpdateAsync(app_bundle);
-}
-
-HRESULT Model::Download(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[Model::Download][0x%p]"), app_bundle));
-
-  __mutexScope(lock_);
-
-  return worker_->DownloadAsync(app_bundle);
-}
-
-HRESULT Model::DownloadAndInstall(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[Model::DownloadAndInstall][0x%p]"), app_bundle));
-
-  __mutexScope(lock_);
-
-  return worker_->DownloadAndInstallAsync(app_bundle);
-}
-
-HRESULT Model::UpdateAllApps(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[Model::UpdateAllApps][0x%p]"), app_bundle));
-
-  __mutexScope(lock_);
-
-  return worker_->UpdateAllAppsAsync(app_bundle);
-}
-
-HRESULT Model::Stop(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[Model::Stop][0x%p]"), app_bundle));
-
-  __mutexScope(lock_);
-
-  return worker_->Stop(app_bundle);
-}
-
-HRESULT Model::Pause(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[Model::Pause][0x%p]"), app_bundle));
-
-  __mutexScope(lock_);
-
-  return worker_->Pause(app_bundle);
-}
-
-HRESULT Model::Resume(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[Model::Resume][0x%p]"), app_bundle));
-
-  __mutexScope(lock_);
-
-  return worker_->Resume(app_bundle);
-}
-
-HRESULT Model::DownloadPackage(Package* package) {
-  CORE_LOG(L3, (_T("[Model::DownloadPackage][0x%p]"), package));
-
-  __mutexScope(lock_);
-
-  return worker_->DownloadPackageAsync(package);
-}
-
-HRESULT Model::GetPackage(const Package* package, const CString& dir) const {
-  __mutexScope(lock_);
-
-  return worker_->GetPackage(package, dir);
-}
-
-bool Model::IsPackageAvailable(const Package* package) const {
-  __mutexScope(lock_);
-
-  return worker_->IsPackageAvailable(package);
-}
-
-HRESULT Model::PurgeAppLowerVersions(const CString& app_id,
-                                     const CString& version) const {
-  __mutexScope(lock_);
-
-  return worker_->PurgeAppLowerVersions(app_id, version);
-}
-
-}  // namespace omaha
diff --git a/goopdate/model.h b/goopdate/model.h
deleted file mode 100644
index d789a94..0000000
--- a/goopdate/model.h
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Defines the root of the object model. This is not exposed as a COM object.
-
-#ifndef OMAHA_GOOPDATE_MODEL_H_
-#define OMAHA_GOOPDATE_MODEL_H_
-
-#ifndef _ATL_FREE_THREADED
-#error Must use _ATL_FREE_THREADED to avoid differences in member offsets.
-#endif
-
-#include <windows.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/debug.h"
-#include "base/scoped_ptr.h"
-#include "base/synchronized.h"
-#include "omaha/goopdate/app.h"
-#include "omaha/goopdate/app_bundle.h"
-#include "omaha/goopdate/app_version.h"
-#include "omaha/goopdate/current_state.h"
-#include "omaha/goopdate/package.h"
-#include "third_party/bar/shared_ptr.h"
-
-namespace omaha {
-
-class WorkerModelInterface;
-
-class Model {
- public:
-  explicit Model(WorkerModelInterface* worker);
-  virtual ~Model();
-
-  const Lockable& lock() const { return lock_; }
-
-  // Returns true if the model lock is held by the calling thread.
-  bool IsLockedByCaller() const {
-    return ::GetCurrentThreadId() == lock_.GetOwner();
-  }
-
-  // Creates an AppBundle object in the model.
-  shared_ptr<AppBundle> CreateAppBundle(bool is_machine);
-
-  // Removes the AppBundle objects that have no outstanding strong references.
-  void CleanupExpiredAppBundles();
-
-  size_t GetNumberOfAppBundles() const;
-
-  shared_ptr<AppBundle> GetAppBundle(size_t index) const;
-
-  // Initiates an update check for all apps in the bundle.
-  HRESULT CheckForUpdate(AppBundle* app_bundle);
-
-  // Initiates download of files necessary to install all apps in the bundle.
-  HRESULT Download(AppBundle* app_bundle);
-
-  // Initiates Download, if necessary, and install all app in the bundle.
-  HRESULT DownloadAndInstall(AppBundle* app_bundle);
-
-  // Initiates an update of all registered apps and performs periodic tasks
-  // related to all apps. Primarily for use by Omaha's /ua client. Includes
-  // update check, download and install.
-  HRESULT UpdateAllApps(AppBundle* app_bundle);
-
-  HRESULT Stop(AppBundle* app_bundle);
-  HRESULT Pause(AppBundle* app_bundle);
-  HRESULT Resume(AppBundle* app_bundle);
-
-  HRESULT DownloadPackage(Package* package);
-  HRESULT GetPackage(const Package* package, const CString& dir) const;
-
-  bool IsPackageAvailable(const Package* package) const;
-
-  HRESULT PurgeAppLowerVersions(const CString& app_id,
-                                const CString& version) const;
-
- private:
-  typedef weak_ptr<AppBundle> AppBundleWeakPtr;
-
-  // Serializes access to the model objects. Consider replacing with SWMR lock.
-  LLock lock_;
-
-  std::vector<AppBundleWeakPtr> app_bundles_;
-  WorkerModelInterface* worker_;
-
-  DISALLOW_COPY_AND_ASSIGN(Model);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_MODEL_H_
diff --git a/goopdate/model_object.cc b/goopdate/model_object.cc
deleted file mode 100644
index e3eb5d2..0000000
--- a/goopdate/model_object.cc
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/model_object.h"
-#include "omaha/goopdate/model.h"
-
-namespace omaha {
-
-bool IsModelLockedByCaller(const Model* model) {
-  return model->IsLockedByCaller();
-}
-
-}  // namespace omaha
-
diff --git a/goopdate/model_object.h b/goopdate/model_object.h
deleted file mode 100644
index 5c79b0f..0000000
--- a/goopdate/model_object.h
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Defines the base class of classes in the model. Provides access to the root
-// of the model.
-
-#ifndef OMAHA_GOOPDATE_MODEL_OBJECT_H_
-#define OMAHA_GOOPDATE_MODEL_OBJECT_H_
-
-#include <windows.h>
-#include "base/basictypes.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-class Model;
-
-bool IsModelLockedByCaller(const Model* model);
-
-class ModelObject {
- public:
-
-  Model* model() {
-    return omaha::interlocked_exchange_pointer(&model_, model_);
-  }
-
-  const Model* model() const {
-    return omaha::interlocked_exchange_pointer(&model_, model_);
-  }
-
- protected:
-
-  explicit ModelObject(Model* model) : model_(NULL) {
-    ASSERT1(model);
-    ASSERT1(IsModelLockedByCaller(model));
-
-    omaha::interlocked_exchange_pointer(&model_, model);
-  }
-
-  ~ModelObject() {
-    omaha::interlocked_exchange_pointer(&model_, static_cast<Model*>(NULL));
-  }
-
- private:
-
-  // C++ root of the object model. Not owned by this instance.
-  mutable Model* volatile model_;
-
-  DISALLOW_COPY_AND_ASSIGN(ModelObject);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_MODEL_OBJECT_H_
-
diff --git a/goopdate/model_unittest.cc b/goopdate/model_unittest.cc
deleted file mode 100644
index ac5b4e6..0000000
--- a/goopdate/model_unittest.cc
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/model.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-class ModelTest : public testing::Test {
-  virtual void SetUp() {}
-  virtual void TearDown() {}
-};
-
-}  // namespace omaha
-
diff --git a/goopdate/non_localized_resource.h b/goopdate/non_localized_resource.h
deleted file mode 100644
index e47dfb0..0000000
--- a/goopdate/non_localized_resource.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_NON_LOCALIZED_RESOURCE_H_
-#define OMAHA_GOOPDATE_NON_LOCALIZED_RESOURCE_H_
-
-#define IDI_ELEVATION_MONIKER_ICON        1004
-#define IDR_LOCAL_SERVER_RGS              2005
-#define IDR_LOCAL_SERVER_ELEVATION_RGS    2006
-#define IDR_LOCAL_SERVER_IE_LOW_RGS       2007
-#define IDR_LOCAL_SERVICE_RGS             2008
-#define IDR_GOOGLE_UPDATE3_SERVICE_APPID  2009
-
-#endif  // OMAHA_GOOPDATE_NON_LOCALIZED_RESOURCE_H_
diff --git a/goopdate/offline_utils.cc b/goopdate/offline_utils.cc
deleted file mode 100644
index 163dcf3..0000000
--- a/goopdate/offline_utils.cc
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/offline_utils.h"
-#include <atlpath.h>
-#include "omaha/base/debug.h"
-#include "omaha/base/file.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/path.h"
-
-namespace omaha {
-
-namespace offline_utils {
-
-CString GetV2OfflineManifest(const CString& app_id,
-                             const CString& offline_dir) {
-  CPath manifest_filename(app_id);
-  VERIFY1(manifest_filename.AddExtension(_T(".gup")));
-  return ConcatenatePath(offline_dir, manifest_filename);
-}
-
-HRESULT FindV2OfflinePackagePath(const CString& offline_app_dir,
-                                 CString* package_path) {
-  ASSERT1(!offline_app_dir.IsEmpty());
-  ASSERT1(package_path);
-  package_path->Empty();
-
-  CORE_LOG(L3, (_T("[FindV2OfflinePackagePath][%s]"), offline_app_dir));
-
-  CString pattern(_T("*"));
-  std::vector<CString> files;
-  HRESULT hr = FindFiles(offline_app_dir, pattern, &files);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (files.size() != 3) {
-    CORE_LOG(LE, (_T("[Cannot guess filename with multiple files]")));
-    return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
-  }
-
-  CString local_package_path;
-  // Skip over "." and "..".
-  size_t i = 0;
-  for (; i < files.size(); ++i) {
-    local_package_path = ConcatenatePath(offline_app_dir, files[i]);
-    if (!File::IsDirectory(local_package_path)) {
-      break;
-    }
-  }
-  if (i == files.size()) {
-    return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
-  }
-
-  CORE_LOG(L3, (_T("[Non-standard/legacy package][%s]"), local_package_path));
-  *package_path = local_package_path;
-  return S_OK;
-}
-
-HRESULT ParseOfflineManifest(const CString& app_id,
-                             const CString& offline_dir,
-                             xml::UpdateResponse* update_response) {
-  CORE_LOG(L3, (_T("[ParseOfflineManifest][%s][%s]"), app_id, offline_dir));
-  ASSERT1(update_response);
-
-  CString manifest_path(ConcatenatePath(offline_dir, kOfflineManifestFileName));
-  if (!File::Exists(manifest_path)) {
-    manifest_path = GetV2OfflineManifest(app_id, offline_dir);
-  }
-
-  HRESULT hr = update_response->DeserializeFromFile(manifest_path);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[DeserializeFromFile failed][%s][0x%x]"),
-                  manifest_path, hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-}  // namespace offline_utils
-
-}  // namespace omaha
diff --git a/goopdate/offline_utils.h b/goopdate/offline_utils.h
deleted file mode 100644
index 0e9305f..0000000
--- a/goopdate/offline_utils.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_OFFLINE_UTILS_H_
-#define OMAHA_GOOPDATE_OFFLINE_UTILS_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include "omaha/common/update_response.h"
-
-namespace omaha {
-
-namespace offline_utils {
-
-CString GetV2OfflineManifest(const CString& app_id,
-                             const CString& offline_dir);
-
-HRESULT FindV2OfflinePackagePath(const CString& offline_app_dir,
-                                 CString* package_path);
-
-HRESULT ParseOfflineManifest(const CString& app_id,
-                             const CString& offline_dir,
-                             xml::UpdateResponse* update_response);
-}  // namespace offline_utils
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_OFFLINE_UTILS_H_
diff --git a/goopdate/offline_utils_unittest.cc b/goopdate/offline_utils_unittest.cc
deleted file mode 100644
index 4524ab0..0000000
--- a/goopdate/offline_utils_unittest.cc
+++ /dev/null
@@ -1,187 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/offline_utils.h"
-#include <atlpath.h>
-#include "omaha/base/app_util.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/path.h"
-#include "omaha/base/utils.h"
-#include "omaha/goopdate/update_response_utils.h"
-#include "omaha/testing/resource.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-const TCHAR* kAppId1 = _T("{CDABE316-39CD-43BA-8440-6D1E0547AEE6}");
-
-void CheckResponse(const xml::response::Response& xml_response,
-                   const TCHAR* expected_protocol_version) {
-  EXPECT_STREQ(expected_protocol_version, xml_response.protocol);
-  EXPECT_EQ(1, xml_response.apps.size());
-
-  const xml::response::App& app(xml_response.apps[0]);
-  EXPECT_STREQ(kAppId1, app.appid);
-  EXPECT_STREQ(_T("ok"), app.status);
-
-  const xml::response::UpdateCheck& update_check(app.update_check);
-  EXPECT_STREQ(_T("ok"), update_check.status);
-  EXPECT_EQ(1, update_check.urls.size());
-  EXPECT_STREQ(_T("http://dl.google.com/foo/install/1.2.3.4/"),
-               update_check.urls[0]);
-
-  const xml::InstallManifest& install_manifest(update_check.install_manifest);
-  EXPECT_STREQ(_T("1.2.3.4"), install_manifest.version);
-  EXPECT_EQ(1, install_manifest.packages.size());
-
-  const xml::InstallPackage& install_package(install_manifest.packages[0]);
-  EXPECT_STREQ(_T("foo_installer.exe"), install_package.name);
-  EXPECT_TRUE(install_package.is_required);
-  EXPECT_EQ(12345678, install_package.size);
-  EXPECT_STREQ(_T("abcdef"), install_package.hash);
-
-  EXPECT_EQ(2, install_manifest.install_actions.size());
-
-  const xml::InstallAction* install_action(
-      &install_manifest.install_actions[0]);
-  EXPECT_EQ(xml::InstallAction::kInstall, install_action->install_event);
-  EXPECT_EQ(NEEDS_ADMIN_NO, install_action->needs_admin);
-  EXPECT_STREQ(_T("foo_installer.exe"), install_action->program_to_run);
-  EXPECT_STREQ(_T("-baz"), install_action->program_arguments);
-  EXPECT_FALSE(install_action->terminate_all_browsers);
-  EXPECT_EQ(SUCCESS_ACTION_DEFAULT, install_action->success_action);
-
-  install_action = &install_manifest.install_actions[1];
-  EXPECT_EQ(xml::InstallAction::kPostInstall, install_action->install_event);
-  EXPECT_EQ(NEEDS_ADMIN_NO, install_action->needs_admin);
-  EXPECT_FALSE(install_action->terminate_all_browsers);
-  EXPECT_EQ(SUCCESS_ACTION_EXIT_SILENTLY_ON_LAUNCH_CMD,
-            install_action->success_action);
-
-  EXPECT_EQ(0, app.events.size());
-
-  CString value;
-  CString verboselogging_install_data(_T("\n      {\n        \"distribution\": {\n          \"verbose_logging\": true\n        }\n      }\n    "));  // NOLINT
-  EXPECT_SUCCEEDED(update_response_utils::GetInstallData(app.data,
-                                                         _T("verboselogging"),
-                                                         &value));
-  EXPECT_STREQ(verboselogging_install_data, value);
-
-  CString foobarapp_install_data(_T("\n      {\n        \"distribution\": {\n          \"skip_first_run_ui\": true,\n          \"show_welcome_page\": true,\n          \"import_search_engine\": true,\n          \"import_history\": false,\n          \"create_all_shortcuts\": true,\n          \"do_not_launch_foo\": true,\n          \"make_foo_default\": false,\n          \"verbose_logging\": false\n        }\n      }\n    "));  // NOLINT
-  EXPECT_SUCCEEDED(update_response_utils::GetInstallData(app.data,
-                                                         _T("foobarapp"),
-                                                         &value));
-  EXPECT_STREQ(foobarapp_install_data, value);
-
-  EXPECT_EQ(GOOPDATE_E_INVALID_INSTALL_DATA_INDEX,
-            update_response_utils::GetInstallData(app.data, _T("foo"), &value));
-}
-
-void ParseAndCheck(const TCHAR* source_manifest_extension,
-                   const TCHAR* target_manifest_filename,
-                   const TCHAR* expected_protocol_version) {
-  CString source_manifest_path = ConcatenatePath(
-      app_util::GetCurrentModuleDirectory(), _T("unittest_support"));
-  source_manifest_path = ConcatenatePath(source_manifest_path, kAppId1);
-  source_manifest_path += source_manifest_extension;
-
-  CString target_manifest_path = ConcatenatePath(
-      app_util::GetCurrentModuleDirectory(), target_manifest_filename);
-
-  EXPECT_SUCCEEDED(File::Copy(source_manifest_path, target_manifest_path,
-                              true));
-
-  scoped_ptr<xml::UpdateResponse> update_response(
-      xml::UpdateResponse::Create());
-  EXPECT_SUCCEEDED(offline_utils::ParseOfflineManifest(
-                       kAppId1,
-                       app_util::GetCurrentModuleDirectory(),
-                       update_response.get()));
-
-  CheckResponse(update_response->response(), expected_protocol_version);
-
-  EXPECT_SUCCEEDED(File::Remove(target_manifest_path));
-}
-
-}  // namespace
-
-namespace offline_utils {
-
-TEST(OfflineUtilsTest, GetV2OfflineManifest) {
-  CString manifest_path = offline_utils::GetV2OfflineManifest(
-      kAppId1, app_util::GetCurrentModuleDirectory());
-
-  EXPECT_STREQ(ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                               CString(kAppId1) + _T(".gup")),
-               manifest_path);
-}
-
-TEST(OfflineUtilsTest, FindV2OfflinePackagePath_Success) {
-  CString installer_exe = _T("foo_installer.exe");
-  CString installer_path = ConcatenatePath(
-                                app_util::GetCurrentModuleDirectory(),
-                                kAppId1);
-  EXPECT_SUCCEEDED(CreateDir(installer_path, NULL));
-  EXPECT_SUCCEEDED(File::Copy(
-      ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                      _T("unittest_support\\SaveArguments.exe")),
-      ConcatenatePath(installer_path, installer_exe),
-      true));
-
-  CString package_path;
-  EXPECT_SUCCEEDED(offline_utils::FindV2OfflinePackagePath(installer_path,
-                                                           &package_path));
-  EXPECT_STREQ(ConcatenatePath(installer_path, installer_exe), package_path);
-
-  EXPECT_SUCCEEDED(DeleteDirectory(installer_path));
-}
-
-TEST(OfflineUtilsTest, FindV2OfflinePackagePath_Failure) {
-  CString package_path;
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND),
-            offline_utils::FindV2OfflinePackagePath(
-                ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                                kAppId1),
-                &package_path));
-  EXPECT_TRUE(package_path.IsEmpty());
-}
-
-TEST(OfflineUtilsTest, ParseOfflineManifest_v3_Success) {
-  ParseAndCheck(_T(".v3.gup"), kOfflineManifestFileName, _T("3.0"));
-}
-
-TEST(OfflineUtilsTest, ParseOfflineManifest_v2_Success) {
-  CString target_manifest_filename = CString(kAppId1) + _T(".gup");
-  ParseAndCheck(_T(".v2.gup"), target_manifest_filename, _T("2.0"));
-}
-
-TEST(OfflineUtilsTest, ParseOfflineManifest_FileDoesNotExist) {
-  scoped_ptr<xml::UpdateResponse> update_response(
-      xml::UpdateResponse::Create());
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            offline_utils::ParseOfflineManifest(
-                               kAppId1,
-                               app_util::GetCurrentModuleDirectory(),
-                               update_response.get()));
-}
-
-}  // namespace offline_utils
-
-}  // namespace omaha
diff --git a/goopdate/omaha3_idl.idl b/goopdate/omaha3_idl.idl
deleted file mode 100644
index 3cf9985..0000000
--- a/goopdate/omaha3_idl.idl
+++ /dev/null
@@ -1,972 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-import "oaidl.idl";
-import "ocidl.idl";
-
-// When adding interfaces to this file:
-//  * Do not use "Google" or "GoogleUpdate" directly. Instead, use preprocessor
-//    defines.
-//  * Add a test for the Google-specific value to
-//    omaha_customization_goopdate_apis_unittest.cc.
-
-//
-// Enums.
-// These values can be passed to interface methods and/or compared to their
-// output.
-//
-
-// Must be kept in sync with the enum in base/browser_utils.h.
-typedef enum BrowserType {
-  BROWSER_UNKNOWN           = 0,
-  BROWSER_DEFAULT           = 1,
-  BROWSER_INTERNET_EXPLORER = 2,
-  BROWSER_FIREFOX           = 3,
-  BROWSER_CHROME            = 4,
-} BrowserType;
-
-// The normal install flow proceeds from STATE_INIT through
-// STATE_INSTALL_COMPLETE in order, skipping states that are not relevant.
-// All exceptions and terminal states are start with STATE_INSTALL_COMPLETE.
-typedef enum CurrentState {
-  STATE_INIT = 1,
-  STATE_WAITING_TO_CHECK_FOR_UPDATE = 2,
-  STATE_CHECKING_FOR_UPDATE = 3,
-  STATE_UPDATE_AVAILABLE = 4,
-  STATE_WAITING_TO_DOWNLOAD = 5,
-  STATE_RETRYING_DOWNLOAD = 6,
-  STATE_DOWNLOADING = 7,
-  STATE_DOWNLOAD_COMPLETE = 8,
-  STATE_EXTRACTING = 9,
-  STATE_APPLYING_DIFFERENTIAL_PATCH = 10,
-  // TODO(omaha3): Should we move STATE_DOWNLOAD_COMPLETE here and eliminate
-  // STATE_READY_TO_INSTALL?
-  STATE_READY_TO_INSTALL = 11,
-  STATE_WAITING_TO_INSTALL = 12,
-  STATE_INSTALLING = 13,
-  STATE_INSTALL_COMPLETE = 14,
-  STATE_PAUSED = 15,
-  STATE_NO_UPDATE = 16,
-  STATE_ERROR = 17,
-} CurrentState;
-
-typedef enum InstallPriority {
-  INSTALL_PRIORITY_LOW = 0,
-  INSTALL_PRIORITY_HIGH = 10,
-} InstallPriority;
-
-// Specifies what the client should do after installation.
-typedef enum PostInstallAction {
-  POST_INSTALL_ACTION_DEFAULT = 0,
-
-  // Caller should exit silently.
-  POST_INSTALL_ACTION_EXIT_SILENTLY = 1,
-
-  // Caller should launch the command.
-  POST_INSTALL_ACTION_LAUNCH_COMMAND = 2,
-
-  // Caller should launch the command and exit silently.
-  POST_INSTALL_ACTION_EXIT_SILENTLY_ON_LAUNCH_COMMAND = 3,
-
-  // The caller should ask the user to restart the browser. If the value of
-  // IApp's browser is supported and postInstallUrl is valid, the client should
-  // offer to restart the browser. If the user chooses to do so, the client
-  // should launch the ICurrentState::postInstallUrl after shutting down and
-  // restarting the browser.
-  POST_INSTALL_ACTION_RESTART_BROWSER = 4,
-
-  // Similar to POST_INSTALL_ACTION_RESTART_BROWSER, but ask the user to shut
-  // down all browsers.
-  POST_INSTALL_ACTION_RESTART_ALL_BROWSERS = 5,
-
-  // The caller should ask the user to reboot the machine.
-  POST_INSTALL_ACTION_REBOOT = 6,
-} PostInstallAction;
-
-[
-  object,
-  dual,
-  uuid(76607e7e-c0ff-4dd3-b134-7fc3724ee66a),
-  helpstring("IGoogleUpdate3 Interface"),
-  pointer_default(unique)
-]
-interface IGoogleUpdate3 : IDispatch {
-  // TODO(Omaha): Perhaps this interface exposes helpers such as
-  // RestartBrowsers, etc.
-
-  // Returns the count of the AppBundles in this IGoogleUpdate3 interface.
-  [id(1), propget] HRESULT Count([out, retval] long* count);
-
-  // Returns an IDispatch of the AppBundle in this IGoogleUpdate3 interface at
-  // the specified 0-based index. This property has the dispid of DISPID_VALUE
-  // to make it the default property of IGoogleUpdate3.
-  [id(DISPID_VALUE), propget] HRESULT Item([in] long index,
-                                           [out, retval] IDispatch** bundle);
-  // Returns an IDispatch to a newly created empty AppBundle.
-  [id(2)] HRESULT createAppBundle([out, retval] IDispatch** app_bundle);
-}
-
-[
-  object,
-  dual,
-  uuid(9a527c99-02cb-49eb-a14f-225c25cb76dc),
-  helpstring("IAppBundle Interface"),
-  pointer_default(unique)
-]
-interface IAppBundle : IDispatch {
-  // TODO(omaha3): AppBundle::display_name_ is never used. Should we remove?
-  [propget] HRESULT displayName([out, retval] BSTR*);
-  [propput] HRESULT displayName([in] BSTR);
-
-  [propget] HRESULT displayLanguage([out, retval] BSTR*);
-  [propput] HRESULT displayLanguage([in] BSTR);
-
-  [propget] HRESULT installSource([out, retval] BSTR*);
-  [propput] HRESULT installSource([in] BSTR);
-
-  [propget] HRESULT originURL([out, retval] BSTR*);
-  [propput] HRESULT originURL([in] BSTR);
-
-  [propget] HRESULT offlineDirectory([out, retval] BSTR* offline_dir);
-  [propput] HRESULT offlineDirectory([in] BSTR offline_dir);
-
-  [propget] HRESULT sessionId([out, retval] BSTR* session_id);
-  [propput] HRESULT sessionId([in] BSTR session_id);
-
-  // The priority property determines download speed/priority and the number/
-  // frequency of retries.  Use values from the InstallPriority enum.
-  [propget] HRESULT priority([out, retval] long* priority);
-  [propput] HRESULT priority([in] long priority);
-
-  // Returns the count of the Apps in the AppBundle.
-  [id(1), propget] HRESULT Count([out, retval] long* count);
-
-  // Returns an IDispatch of the App in the AppBundle at the specified 0-based
-  // index. This property has the dispid of DISPID_VALUE to make it the default
-  // property of IAppBundle.
-  [id(DISPID_VALUE), propget] HRESULT Item([in] long index,
-                                           [out, retval] IDispatch** app);
-
-  // Impersonation and primary tokens set by the client. Typically only
-  // set by the gupdatem service. The gupdatem service exposes a narrow
-  // interface to medium integrity clients. When a medium integrity client calls
-  // into the gupdatem service, the gupdatem service captures the token of the
-  // caller, and then calls put_altTokens() on the gupdate service, so that the
-  // gupdate service can use it for future download() and install() requests.
-  [propput] HRESULT altTokens([in] ULONG_PTR impersonation_token,
-                              [in] ULONG_PTR primary_token,
-                              [in] DWORD caller_proc_id);
-
-  // Sets a HWND to associate with the client, if any.  This will be used as
-  // the parent window for any dialogs that the server may need to display.
-  [propput] HRESULT parentHWND([in] ULONG_PTR hwnd);
-
-  // Initializes the bundle with the properties that have been set.
-  [id(2)] HRESULT initialize();
-
-  // Returns an IDispatch to a new App for the specified app id.
-  // The App is added to the Bundle.
-  [id(3)] HRESULT createApp([in] BSTR app_id,
-                            [out, retval] IDispatch** app);
-
-  // Returns an IDispatch to a newly created App for the specified app ID. The
-  // App is populated with information from the existing installation and added
-  // to the Bundle. Fails if the specified app is not installed.
-  [id(4)] HRESULT createInstalledApp([in] BSTR app_id,
-                                     [out, retval] IDispatch** app);
-
-  // Creates App instances for all installed apps managed by this Omaha
-  // instance. Each App is populated with information from the existing install.
-  [id(5)] HRESULT createAllInstalledApps();
-
-  // These methods are non-blocking. The operation is scheduled.
-  [id(6)] HRESULT checkForUpdate();
-  [id(7)] HRESULT download();
-  [id(8)] HRESULT install();
-
-  // All-in-one function for automatically updating all apps. Populates the
-  // bundle then schedules the update, which includes the update check and
-  // download and install, if necessary.
-  [id(9)] HRESULT updateAllApps();
-
-  // These three methods are non-blocking. The operation is requested.
-  [id(10)] HRESULT stop();
-  [id(11)] HRESULT pause();
-  [id(12)] HRESULT resume();
-
-  // Returns true if the bundle has an uncompleted non-blocking request.
-  [id(13)] HRESULT isBusy([out, retval] VARIANT_BOOL* is_busy);
-
-  // Downloads a package of an installed application.
-  [id(14)] HRESULT downloadPackage([in] BSTR app_id, [in] BSTR package_name);
-
-  // TODO(omaha): Define this aggregated bundle state. Is this really a property
-  // or should it be getCurrentState?
-  // The server and bundle are the only thing that can provide aggregated
-  // time estimates for downloads. Also, aggregate percentage is not currently
-  // available to the client because the total bytes to download is not
-  // available from App in all post-update check states.
-  // To do this, we will probably need to know the total expected download
-  // size for all packages to be installed - those that are required or in use -
-  // by the time the update check phase is complete.
-  [id(15), propget] HRESULT currentState([out, retval] VARIANT* current_state);
-};
-
-[
-  object,
-  dual,
-  uuid(2ea2902f-31b3-45fe-a27a-62bb796e74c0),
-  helpstring("IApp Interface"),
-  pointer_default(unique)
-]
-interface IApp : IDispatch {
-  // Returns a version IDispatch object.
-  [id(1), propget] HRESULT currentVersion([out, retval] IDispatch** current);
-  [id(2), propget] HRESULT nextVersion([out, retval] IDispatch** next);
-
-  [propget] HRESULT appId([out, retval] BSTR*);
-
-  [propget] HRESULT displayName([out, retval] BSTR*);
-  [propput] HRESULT displayName([in] BSTR);
-
-  [propget] HRESULT language([out, retval] BSTR*);
-  [propput] HRESULT language([in] BSTR);
-
-  [propget] HRESULT ap([out, retval] BSTR*);
-  [propput] HRESULT ap([in] BSTR);
-
-  [propget] HRESULT ttToken([out, retval] BSTR*);
-  [propput] HRESULT ttToken([in] BSTR);
-
-  [propget] HRESULT iid([out, retval] BSTR*);
-  [propput] HRESULT iid([in] BSTR);
-
-  [propget] HRESULT brandCode([out, retval] BSTR*);
-  [propput] HRESULT brandCode([in] BSTR);
-
-  [propget] HRESULT clientId([out, retval] BSTR*);
-  [propput] HRESULT clientId([in] BSTR);
-
-  [propget] HRESULT labels([out, retval] BSTR*);
-  [propput] HRESULT labels([in] BSTR);
-
-  [propget] HRESULT referralId([out, retval] BSTR*);
-  [propput] HRESULT referralId([in] BSTR);
-
-  // Use values from the BrowserType enum.
-  [propget] HRESULT browserType([out, retval] UINT*);
-  [propput] HRESULT browserType([in] UINT);
-
-  [propget] HRESULT clientInstallData([out, retval] BSTR*);
-  [propput] HRESULT clientInstallData([in] BSTR);
-
-  [propget] HRESULT serverInstallDataIndex([out, retval] BSTR*);
-  [propput] HRESULT serverInstallDataIndex([in] BSTR);
-
-  // Set as soon as possible. Error pings are disabled until set to true.
-  [propget] HRESULT isEulaAccepted([out, retval] VARIANT_BOOL*);
-  [propput] HRESULT isEulaAccepted([in] VARIANT_BOOL);
-
-  [propget] HRESULT usageStatsEnable([out, retval] UINT*);
-  [propput] HRESULT usageStatsEnable([in] UINT);
-
-  [propget] HRESULT installTimeDiffSec([out, retval] UINT*);
-
-  // Returns an ICurrentState interface. The object underlying the interface has
-  // static data that does not get updated as the server state changes. To get
-  // the most "current" state, the currentState property needs to be queried
-  // again.
-  [propget] HRESULT currentState([out, retval] IDispatch**);
-};
-
-[
-  object,
-  dual,
-  uuid(6f5a84a3-867a-47bb-848b-a4cd8ffa8fce),
-  helpstring("IAppVersion Interface"),
-  pointer_default(unique)
-]
-interface IAppVersion : IDispatch {
-  [propget] HRESULT version([out, retval] BSTR*);
-
-  // [propget] HRESULT installManifest([out, retval] BSTR*);
-
-  // Returns the count of the Packages in the AppVersion.
-  [propget] HRESULT packageCount([out, retval] long* count);
-
-  // Returns an IDispatch of the Package in the AppVersion at the specified
-  // 0-based index.
-  [propget] HRESULT package([in] long index,
-                            [out, retval] IDispatch** package);
-};
-
-[
-  object,
-  dual,
-  uuid(593e29d1-4adf-4f5d-ade8-a0836155c8a3),
-  helpstring("IPackage Interface"),
-  pointer_default(unique)
-]
-interface IPackage : IDispatch {
-  // Retrieves the package from the package cache and copies it to the
-  // directory provided. Returns an error is the package is not available
-  // locally.
-  [id(1)] HRESULT get([in] BSTR dir);
-
-  // Returns true if the package has been downloaded and is available
-  // locally.
-  [propget] HRESULT isAvailable([out, retval] VARIANT_BOOL*);
-
-  // Returns the manifest name of the package.
-  [propget] HRESULT filename([out, retval] BSTR*);
-};
-
-// TODO(omaha3): We should figure out what else we are going to want in this
-// interface before dogfood even if we do not implement it.
-[
-  object,
-  dual,
-  uuid(9df22aa7-720e-4216-9cb4-727781edac1a),
-  helpstring("ICurrentState Interface"),
-  pointer_default(unique)
-]
-interface ICurrentState : IDispatch {
-  // This interface is exposed to web clients!
-  // TODO(omaha3): Update valid comments once we settle on an implementation.
-
-  // A value from the CurrentState enum. This value determines which of the
-  // properties below are valid.
-  [propget] HRESULT stateValue([out, retval] LONG*);
-
-  // The remaining properties are only valid in the specified states. For all
-  // other states, the values are not specified.
-
-  // This property is valid only when stateValue is STATE_UPDATE_AVAILABLE.
-  [propget] HRESULT availableVersion([out, retval] BSTR*);
-
-  // The following three properties are only valid when stateValue is
-  // STATE_WAITING_TO_DOWNLOAD, STATE_RETRYING_DOWNLOAD, STATE_DOWNLOADING,
-  // STATE_DOWNLOAD_COMPLETE, STATE_EXTRACTING,
-  // STATE_APPLYING_DIFFERENTIAL_PATCH, or STATE_READY_TO_INSTALL.
-
-  // Bytes downloaded so far.
-  [propget] HRESULT bytesDownloaded([out, retval] ULONG*);
-
-  // Total bytes to download.
-  [propget] HRESULT totalBytesToDownload([out, retval] ULONG*);
-
-  // Estimated download time remaining in ms. -1 indicates unknown.
-  // Progress may not always be available, so clients should handle the -1 case.
-  [propget] HRESULT downloadTimeRemainingMs([out, retval] LONG*);
-
-  [propget] HRESULT nextRetryTime([out, retval] ULONGLONG*);
-
-  // TODO(omaha): Need some way to indicate reconnecting, retrying, etc.
-
-  // The following two properties are only valid when stateValue is
-  // STATE_INSTALLING or STATE_INSTALL_COMPLETE.
-
-  // Current install progress in percentage from 0 to 100. -1 indicates unknown.
-  // Progress may not always be available, so clients should handle the -1 case.
-  [propget] HRESULT installProgress([out, retval] LONG*);
-
-  // Estimated download time remaining in ms. -1 indicates unknown.
-  // Progress may not always be available, so clients should handle the -1 case.
-  [propget] HRESULT installTimeRemainingMs([out, retval] LONG*);
-
-  // The following four properties are only valid when stateValue is
-  // STATE_ERROR:
-
-  // Returns true if the app has been canceled.
-  [propget] HRESULT isCanceled([out, retval] VARIANT_BOOL* is_canceled);
-
-  // Error code.
-  [propget] HRESULT errorCode([out, retval] LONG*);
-
-  // Error extra code.
-  [propget] HRESULT extraCode1([out, retval] LONG*);
-
-  // The following three properties are only valid when stateValue is
-  // STATE_ERROR or STATE_INSTALL_COMPLETE.
-  // TODO(omaha3): If STATE_DOWNLOAD_COMPLETE or STATE_READY_TO_INSTALL becomes
-  // a terminal state, does it support completion messages?
-
-  // Completion message, localized in the specified language.
-  // TODO(omaha3): If we're going to have bundle error messages too, should the
-  // language be at bundle level? Should bundle have its own language setter?
-  [propget] HRESULT completionMessage([out, retval] BSTR*);
-
-  // Application installer result code. This is to be used as additional
-  // information only. Success/failure should be determined using errorCode.
-  // This is an error if errorCode is GOOPDATEINSTALL_E_INSTALLER_FAILED.
-  [propget] HRESULT installerResultCode([out, retval] LONG*);
-
-  // Application installer extra code.
-  [propget] HRESULT installerResultExtraCode1([out, retval] LONG*);
-
-  // A command that needs to be launched by the client after installation.
-  [propget] HRESULT postInstallLaunchCommandLine([out, retval] BSTR*);
-
-  // URL to be launched after restarting the browser.
-  [propget] HRESULT postInstallUrl([out, retval] BSTR*);
-
-  // Returns a PostInstallAction value indicating the action to be taken by the
-  // client after installation.
-  [propget] HRESULT postInstallAction([out, retval] LONG*);
-}
-
-[
-  object,
-  dual,
-  uuid(9f2f5f08-a28f-414f-8fe5-31d77b2af211),
-  helpstring("IRegistrationUpdateHook Interface"),
-  pointer_default(unique),
-]
-interface IRegistrationUpdateHook : IDispatch {
-  HRESULT UpdateRegistry([in] BSTR app_id, [in] VARIANT_BOOL is_machine);
-};
-
-[
-  object,
-  uuid(a3c270b9-98bd-4998-91a4-3f11adad0377),
-  helpstring("ICredentialDialog Interface"),
-  pointer_default(unique),
-]
-interface ICredentialDialog : IUnknown {
-  HRESULT QueryUserForCredentials([in] ULONG_PTR owner_hwnd,
-                                  [in] BSTR server,
-                                  [in] BSTR message,
-                                  [out] BSTR* username,
-                                  [out] BSTR* password);
-};
-
-// BEGIN gupdatem interfaces.
-
-// The following interfaces are exposed as a narrower version of the
-// IGoogleUpdate3 interface from the gupdatem service. These interfaces are
-// meant for use from medium and low integrity clients.
-
-[
-  object,
-  dual,
-  uuid(c90fc75b-9bdc-47aa-9f3c-59f416c91aef),
-  helpstring("IGoogleUpdate3Web Interface"),
-  pointer_default(unique),
-]
-interface IGoogleUpdate3Web : IDispatch {
-  HRESULT createAppBundleWeb([out, retval] IDispatch** app_bundle_web);
-};
-
-[
-  object,
-  uuid(d8f0740e-8970-44e4-ad03-46394ba7d3e7),
-  helpstring("IGoogleUpdate3WebSecurity Interface"),
-  pointer_default(unique),
-]
-interface IGoogleUpdate3WebSecurity : IUnknown {
-  HRESULT setOriginURL([in] BSTR origin_url);
-};
-
-[
-  object,
-  dual,
-  uuid(3aaa8bbc-dc93-49d9-9b87-c8ded3b2bb40),
-  helpstring("IAppBundleWeb Interface"),
-  pointer_default(unique),
-]
-interface IAppBundleWeb : IDispatch {
-  [id(2)] HRESULT createApp([in] BSTR app_guid,
-                            [in] BSTR brand_code,
-                            [in] BSTR language,
-                            [in] BSTR ap);
-  [id(3)] HRESULT createInstalledApp([in] BSTR app_id);
-  [id(4)] HRESULT createAllInstalledApps();
-
-  [propget] HRESULT displayLanguage([out, retval] BSTR*);
-  [propput] HRESULT displayLanguage([in] BSTR);
-
-  [propput] HRESULT parentHWND([in] ULONG_PTR hwnd);
-
-  [propget] HRESULT length([out, retval] int* index);
-  [id(DISPID_VALUE), propget] HRESULT appWeb(
-      [in] int index, [out, retval] IDispatch** app_web);
-
-  HRESULT initialize();
-
-  HRESULT checkForUpdate();
-  HRESULT download();
-  HRESULT install();
-
-  HRESULT pause();
-  HRESULT resume();
-  HRESULT cancel();
-
-  HRESULT downloadPackage([in] BSTR app_id, [in] BSTR package_name);
-
-  [propget] HRESULT currentState([out, retval] VARIANT* current_state);
-};
-
-[
-  object,
-  dual,
-  uuid(973d746a-1df2-404a-b66b-ea632417866f),
-  helpstring("IAppWeb Interface"),
-  pointer_default(unique),
-]
-interface IAppWeb : IDispatch {
-  [propget] HRESULT appId([out, retval] BSTR*);
-
-  // Returns an IAppVersionWeb IDispatch object.
-  [propget] HRESULT currentVersionWeb([out, retval] IDispatch** current);
-  [propget] HRESULT nextVersionWeb([out, retval] IDispatch** next);
-
-  HRESULT cancel();
-  [propget] HRESULT currentState([out, retval] IDispatch** current_state);
-  HRESULT launch();
-  HRESULT uninstall();
-};
-
-[
-  object,
-  dual,
-  uuid(afc15738-2cc4-4aac-9b19-c1831428d04f),
-  helpstring("IAppVersionWeb Interface"),
-  pointer_default(unique)
-]
-interface IAppVersionWeb : IDispatch {
-  [propget] HRESULT version([out, retval] BSTR*);
-
-  // Returns the count of the Packages in the AppVersion.
-  [propget] HRESULT packageCount([out, retval] long* count);
-
-  // TODO(omaha3): Implement this after a security review.
-  // Returns an IDispatch of the Package in the AppVersion at the specified
-  // 0-based index.
-  [propget] HRESULT packageWeb([in] long index,
-                               [out, retval] IDispatch** package);
-};
-
-[
-  object,
-  dual,
-  uuid(4dafb7ab-e8d8-4003-87b8-678e15b4c221),
-  helpstring("ICoCreateAsyncStatus Interface"),
-  pointer_default(unique)
-]
-interface ICoCreateAsyncStatus : IDispatch {
-  [propget] HRESULT isDone([out, retval] VARIANT_BOOL* is_done);
-  [propget] HRESULT completionHResult([out, retval] LONG* hr);
-  [propget] HRESULT createdInstance([out, retval] IDispatch** instance);
-};
-
-[
-  object,
-  uuid(7fbb29e7-6703-4624-ad84-c8500f57c5c4),
-  helpstring("ICoCreateAsync Interface"),
-  pointer_default(unique)
-]
-interface ICoCreateAsync : IUnknown {
-  HRESULT createOmahaMachineServerAsync(
-      [in] BSTR origin_url,
-      [in] BOOL create_elevated,
-      [out, retval] ICoCreateAsyncStatus** status);
-};
-
-// END gupdatem interfaces.
-
-// BEGIN Legacy google_update_idl interfaces.
-
-[
-  object,
-  uuid(791df12c-01ff-43a1-a3d7-5b1b98a9248a),
-  oleautomation,
-  nonextensible,
-  pointer_default(unique)
-]
-interface IBrowserHttpRequest2 : IUnknown {
-  // This method will send request/data from the browser process.
-  // @param url                     URL where request will be send.
-  // @param post_data               POST data, if any. Can be NULL.
-  // @param request_headers         HTTP request headers, if any. Can be NULL.
-  // @param response_headers_needed HTTP response headers that are needed.
-  //                                Should be one of the values listed here:
-  //                                    http://msdn.microsoft.com/aa385351.aspx
-  //                                The input is a SAFEARRAY of DWORD. Can be a
-  //                                VT_EMPTY.
-  // @param response_headers        HTTP response headers, returned as SAFEARRAY
-  //                                of BSTR. The values corresponding one-to-one
-  //                                with the response_headers_needed values. Can
-  //                                be NULL if response_headers_needed==VT_EMPTY
-  // @param response_code           HTTP response code.
-  // @param cache_filename          Cache file that contains the response data.
-  HRESULT Send([in] BSTR url,
-               [in] BSTR post_data,
-               [in] BSTR request_headers,
-               [in] VARIANT response_headers_needed,
-               [out] VARIANT* response_headers,
-               [out] DWORD* response_code,
-               [out] BSTR* cache_filename);
-};
-
-[
-  object,
-  oleautomation,
-  uuid(28839a52-cddf-4c7c-ac21-b1c4fc1be7ef),
-  helpstring("Google Update IProcessLauncher Interface"),
-  pointer_default(unique)
-]
-interface IProcessLauncher : IUnknown {
-  // @param cmd_line The full command line to execute.
-  HRESULT LaunchCmdLine([in, string] const WCHAR* cmd_line);
-
-  // @param browser_type The browser to start.
-  // @param url The url to launch the browser with.
-  HRESULT LaunchBrowser([in] DWORD browser_type,
-                        [in, string] const WCHAR* url);
-
-  // @param app_id Unique id to identify the calling client application
-  // @param event_id Unique id for the command
-  // @param caller_proc_id The process id of the calling process
-  // @param proc_handle The process handle valid in the caller's context
-  HRESULT LaunchCmdElevated([in, string] const WCHAR* app_guid,
-                            [in, string] const WCHAR* cmd_id,
-                            [in] DWORD caller_proc_id,
-                            [out] ULONG_PTR* proc_handle);
-};
-
-[
-  object,
-  oleautomation,
-  uuid(4d3a05b9-5ef2-46f9-a4fe-81b01637ed47),
-  helpstring("Google Update IOneClickProcessLauncher Interface"),
-  pointer_default(unique)
-]
-interface IOneClickProcessLauncher : IUnknown {
-  HRESULT LaunchAppCommand([in, string] const WCHAR* app_guid,
-                           [in, string] const WCHAR* cmd_id);
-};
-
-typedef enum {
-  COMPLETION_CODE_SUCCESS = 1,
-  COMPLETION_CODE_SUCCESS_CLOSE_UI,
-  COMPLETION_CODE_ERROR,
-  COMPLETION_CODE_RESTART_ALL_BROWSERS,
-  COMPLETION_CODE_REBOOT,
-  COMPLETION_CODE_RESTART_BROWSER,
-  COMPLETION_CODE_RESTART_ALL_BROWSERS_NOTICE_ONLY,
-  COMPLETION_CODE_REBOOT_NOTICE_ONLY,
-  COMPLETION_CODE_RESTART_BROWSER_NOTICE_ONLY,
-  COMPLETION_CODE_RUN_COMMAND,
-} LegacyCompletionCodes;
-
-[
-  object,
-  oleautomation,
-  uuid(cd858925-6866-4f02-b9e9-b5b08e353be7),
-  helpstring("GoogleUpdate UI-specific events Interface"),
-  pointer_default(unique)
-]
-interface IProgressWndEvents : IUnknown {
-  // The UI is closing down. The user has clicked on either the "X" or the
-  // other buttons of the UI to close the window.
-  HRESULT DoClose();
-
-  // Pause has been clicked on.
-  HRESULT DoPause();
-
-  // Resume has been clicked on.
-  HRESULT DoResume();
-
-  // RestartBrowsers button has been clicked on.
-  HRESULT DoRestartBrowsers();
-
-  // Reboot button has been clicked on.
-  HRESULT DoReboot();
-
-  // Launch Browser.
-  HRESULT DoLaunchBrowser([in, string] const WCHAR* url);
-};
-
-
-[
-  object,
-  oleautomation,
-  uuid(ff612905-d787-4f53-ab5e-5ab5971b10a7),
-  helpstring("IJobObserver Interface"),
-  pointer_default(unique)
-]
-interface IJobObserver : IUnknown {
-  HRESULT OnShow();
-  HRESULT OnCheckingForUpdate();
-  HRESULT OnUpdateAvailable([in, string] const WCHAR* version_string);
-  HRESULT OnWaitingToDownload();
-  HRESULT OnDownloading([in] int time_remaining_ms, [in] int pos);
-  HRESULT OnWaitingToInstall();
-  HRESULT OnInstalling();
-  HRESULT OnPause();
-  HRESULT OnComplete([in] LegacyCompletionCodes code,
-                     [in, string] const WCHAR* reserved);
-  HRESULT SetEventSink([in] IProgressWndEvents* ui_sink);
-};
-
-[
-  object,
-  oleautomation,
-  uuid(a62c03e7-56ef-4109-a920-d3c06665223e),
-  helpstring("IGoogleUpdate Interface"),
-  pointer_default(unique)
-]
-interface IGoogleUpdate : IUnknown {
-  // @param guid The guid for the app to be updated.
-  // @param observer The eventing interface.
-  HRESULT CheckForUpdate([in, string] const WCHAR* guid,
-                         [in] IJobObserver* observer);
-
-  // @param guid The guid for the app to be updated.
-  // @param observer The eventing interface.
-  HRESULT Update([in, string] const WCHAR* guid,
-                 [in] IJobObserver* observer);
-};
-
-// IGoogleUpdateCore is an internal Omaha interface.
-[
-  object,
-  oleautomation,
-  uuid(857a3d7a-6b13-45f3-a19b-75870d0c2823),
-  helpstring("Google Update Core Interface"),
-  pointer_default(unique)
-]
-interface IGoogleUpdateCore : IUnknown
-{
-  // Runs a command elevated.
-  //
-  // @param app_id Unique id to identify the calling client application
-  // @param event_id Unique id for the command
-  // @param caller_proc_id The process id of the calling process
-  // @param proc_handle The process handle valid in the caller's context
-  HRESULT LaunchCmdElevated([in, string] const WCHAR* app_guid,
-                            [in, string] const WCHAR* cmd_id,
-                            [in] DWORD caller_proc_id,
-                            [out] ULONG_PTR* proc_handle);
-};
-
-// END Legacy google_update_idl interfaces.
-
-[
-  uuid(5e3de9e9-0248-4fab-ac1c-01b86cf9790e),
-  version(1.0),
-  helpstring("Omaha 3.0 Type Library")
-]
-library GoogleUpdate3Lib {
-  importlib("stdole2.tlb");
-
-  // These Interfaces are forward declared to ensure that they are described in
-  // the generated TLB file. This is required for ATL to correctly implement the
-  // corresponding IDispatch interfaces.
-  interface IGoogleUpdate3;
-  interface IAppBundle;
-  interface IApp;
-  interface IAppVersion;
-  interface IPackage;
-  interface ICurrentState;
-
-  interface IGoogleUpdate3Web;
-  interface IAppBundleWeb;
-  interface IAppWeb;
-  interface IAppVersionWeb;
-  interface ICoCreateAsyncStatus;
-
-  [
-    uuid(cec92c56-68e4-4494-ba79-eb3a71ad8473),
-    helpstring("GoogleUpdate3 Class for per-user applications")
-  ]
-  coclass GoogleUpdate3UserClass {
-    [default] interface IDispatch;
-  }
-
-  [
-    uuid(edc2caa1-2001-4835-a04a-565a5cde5f7f),
-    helpstring("GoogleUpdate3 Service Class for machine applications")
-  ]
-  coclass GoogleUpdate3ServiceClass {
-    [default] interface IDispatch;
-  }
-
-  [
-    uuid(b5bae3dd-809e-4be3-a421-f5d3f17a03db),
-    helpstring("GoogleUpdate3Web for user applications")
-  ]
-  coclass GoogleUpdate3WebUserClass {
-    [default] interface IDispatch;
-  }
-
-  [
-    uuid(31e52f9c-5dba-4a20-b7d4-4ade46fbf9e9),
-    helpstring("Pass-through broker for the GoogleUpdate3WebServiceClass")
-  ]
-  coclass GoogleUpdate3WebMachineClass {
-    [default] interface IDispatch;
-  }
-
-  [
-    uuid(2e119b1c-8a13-4e21-92c2-1b34cab1f028),
-    helpstring("GoogleUpdate3Web")
-  ]
-  coclass GoogleUpdate3WebServiceClass {
-    [default] interface IDispatch;
-  }
-
-  [
-    uuid(0e2ee4d0-7ef1-45d0-aae8-2506c0ba649c),
-    helpstring("Fallback mechanism if GoogleUpdate3WebServiceClass fails")
-  ]
-  coclass GoogleUpdate3WebMachineFallbackClass {
-    [default] interface IDispatch;
-  }
-
-  [
-    uuid(733eb758-7cf0-4927-a3b9-75eb28490613),
-    helpstring("CurrentStateUserClass")
-  ]
-  coclass CurrentStateUserClass {
-    [default] interface ICurrentState;
-  }
-
-  [
-    uuid(dad290ab-07df-443d-9a5a-4434474353ed),
-    helpstring("CurrentStateMachineClass")
-  ]
-  coclass CurrentStateMachineClass {
-    [default] interface ICurrentState;
-  }
-
-  [
-    uuid(5e79da64-77df-4c1f-9184-c6b5f035e3d9),
-    helpstring("CoCreateAsyncClass")
-  ]
-  coclass CoCreateAsyncClass {
-    [default] interface IUnknown;
-  }
-
-  [
-    uuid(a663a8e3-b533-4153-8ef6-3c5823de9280),
-    helpstring("CredentialDialogUserClass")
-  ]
-  coclass CredentialDialogUserClass {
-    [default] interface IUnknown;
-  }
-
-  [
-    uuid(341390f2-6214-4981-a2ae-738205e73590),
-    helpstring("CredentialDialogMachineClass")
-  ]
-  coclass CredentialDialogMachineClass {
-    [default] interface IUnknown;
-  }
-
-  [
-    uuid(___AUTO_GENERATED_GUID___),
-    helpstring("GoogleComProxyMachineClass")
-  ]
-  coclass GoogleComProxyMachineClass {
-    [default] interface IUnknown;
-  }
-
-  [
-    uuid(___AUTO_GENERATED_GUID___),
-    helpstring("GoogleComProxyUserClass")
-  ]
-  coclass GoogleComProxyUserClass {
-    [default] interface IUnknown;
-  }
-
-  // BEGIN Legacy google_update_idl coclasses.
-
-  [
-    uuid(f235f88c-3de7-4195-a0e9-105ba38344cc),
-    helpstring("ProcessLauncherClass Class")
-  ]
-  coclass ProcessLauncherClass {
-    [default] interface IUnknown;
-  }
-
-  [
-    uuid(bb42bfd1-b0eb-449c-8882-fb810c2738d0),
-    helpstring("OneClickUserProcessLauncherClass Class")
-  ]
-  coclass OneClickUserProcessLauncherClass {
-    [default] interface IOneClickProcessLauncher;
-  }
-
-  [
-    uuid(5457eff7-c0b3-4672-a6b4-58f93951f1e0),
-    helpstring("OneClickMachineProcessLauncherClass Class")
-  ]
-  coclass OneClickMachineProcessLauncherClass {
-    [default] interface IOneClickProcessLauncher;
-  }
-
-  [
-    uuid(660baf72-a9ef-4fb1-81ae-9395ca6c39cf),
-    helpstring("OnDemand updates for per-user applications.")
-  ]
-  coclass OnDemandUserAppsClass {
-    [default] interface IUnknown;
-  }
-
-  [
-    uuid(0dd31efc-0cf5-4ec5-9799-f1a8819acea4),
-    helpstring("OnDemand pass-through broker for machine applications.")
-  ]
-  coclass OnDemandMachineAppsClass {
-    [default] interface IUnknown;
-  }
-
-  [
-    uuid(19c06b1a-7202-40b4-9903-62927d08f943),
-    helpstring("OnDemand updates for per-machine applications.")
-  ]
-  coclass OnDemandMachineAppsServiceClass {
-    [default] interface IUnknown;
-  }
-
-  [
-    uuid(107e2437-bfe7-4e17-91d9-2866e1373e00),
-    helpstring("Fallback for if OnDemandMachineAppsServiceClass fails.")
-  ]
-  coclass OnDemandMachineAppsFallbackClass {
-    [default] interface IUnknown;
-  }
-
-  [
-    uuid(b0f72540-f2a8-4027-aac8-a39deb0470ad),
-    helpstring("GoogleUpdateCore Class")
-  ]
-  coclass GoogleUpdateCoreClass
-  {
-    [default] interface IUnknown;
-  }
-
-  [
-    uuid(b15e7b58-2a81-4f3e-8381-f5db7d3a1f84),
-    helpstring("GoogleUpdateCore Machine Class")
-  ]
-  coclass GoogleUpdateCoreMachineClass
-  {
-    [default] interface IUnknown;
-  }
-
-  // END Legacy google_update_idl coclasses.
-};
diff --git a/goopdate/omaha3_idl_datax.c b/goopdate/omaha3_idl_datax.c
deleted file mode 100644
index e0829cc..0000000
--- a/goopdate/omaha3_idl_datax.c
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-//
-// Wrapper for the MIDL-generated proxy/stub.
-
-#pragma warning(push)
-// C4152: nonstandard extension, function/data pointer conversion in expression
-#pragma warning(disable : 4152)
-
-#define REGISTER_PROXY_DLL
-#define USE_STUBLESS_PROXY
-#define PROXY_DELEGATION
-#define ENTRY_PREFIX      Prx
-
-// PROXY_CLSID_IS_MACHINE/USER is defined in main.scons.
-#undef PROXY_CLSID_IS
-#if IS_MACHINE_HANDLER
-  #define PROXY_CLSID_IS  PROXY_CLSID_IS_MACHINE
-#else
-  #define PROXY_CLSID_IS  PROXY_CLSID_IS_USER
-#endif
-
-// Undefine the __purecall provided by rpcproxy.h so that it does not conflict
-// with the libc definition.
-#include <rpcproxy.h>
-#ifdef DLLDUMMYPURECALL
-#undef DLLDUMMYPURECALL
-#define DLLDUMMYPURECALL
-#endif
-
-#include "goopdate/omaha3_idl_data.c"
-#include "goopdate/omaha3_idl_p.c"
-
-#undef PROXY_CLSID_IS
-
-#pragma warning(pop)
-
diff --git a/goopdate/omaha3_idl_datax.h b/goopdate/omaha3_idl_datax.h
deleted file mode 100644
index 94b7699..0000000
--- a/goopdate/omaha3_idl_datax.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-//
-// Declarations for the MIDL-generated entry points for the proxy/stub.
-
-#ifndef OMAHA_GOOPDATE_OMAHA3_IDL_DATAX_H_
-#define OMAHA_GOOPDATE_OMAHA3_IDL_DATAX_H_
-
-extern "C" {
-  BOOL WINAPI PrxDllMain(HINSTANCE instance, DWORD reason, LPVOID res);
-  STDAPI PrxDllCanUnloadNow();
-  STDAPI PrxDllGetClassObject(REFCLSID refclsid, REFIID refiid, LPVOID* ptr);
-  STDAPI PrxDllRegisterServer();
-  STDAPI PrxDllUnregisterServer();
-}
-
-#endif  // OMAHA_GOOPDATE_OMAHA3_IDL_DATAX_H_
-
diff --git a/goopdate/omaha_customization_goopdate_apis_unittest.cc b/goopdate/omaha_customization_goopdate_apis_unittest.cc
deleted file mode 100644
index 0d856bf..0000000
--- a/goopdate/omaha_customization_goopdate_apis_unittest.cc
+++ /dev/null
@@ -1,661 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Tests the constants that vary depending on the customization of Omaha.
-// The test checks for the Google Update variations, but can be modified for
-// your purposes.
-
-#include <windows.h>
-#include <tchar.h>
-#include <atlbase.h>
-#include <oleauto.h>
-#include "omaha/base/browser_utils.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/const_goopdate.h"
-#include "goopdate/omaha3_idl.h"
-#include "omaha/testing/omaha_customization_test.h"
-
-// TODO(omaha): Add tests for to detect interface changes that would require
-// rolling _OMAHA3_IDL_PROXY_CLSID_IS. These include:
-// 1) interface changes invovlving the number or signature of methods
-// 2) or that new interfaces have been added
-// For #2, we already have the InvalidIndex test for interfaces in the TypeLib,
-// so we just need to add checks for interfaces not in the TypeLib.
-//
-// ITypeLib and ITypeInfo methods might be useful. See:
-// http://msdn.microsoft.com/en-us/library/aa912648.aspx
-// http://msdn.microsoft.com/en-us/library/aa909031.aspx
-//
-// I do not know how to get information about interfaces not in a TypeLib.
-// Fortunately, most Omaha 3 interfaces are in one.
-//
-// If we can not get all the information we need, we can always save a "golden"
-// idl.h file and diff against it.
-
-
-// Most of the tests are intentionally not using the omaha namespace. Most of
-// the values being tested are not in this namespace, and being in the global
-// namespace is required by TEST_GU_INT_F to catch conflicts with Google types
-// when building non-Google versions.
-
-class OmahaCustomizationGoopdateComInterfaceTest
-    : public OmahaCustomizationTypeLibComInterfaceTest {
- protected:
-  OmahaCustomizationGoopdateComInterfaceTest()
-      : OmahaCustomizationTypeLibComInterfaceTest(omaha::kOmahaDllName) {
-  }
-};
-
-// Fixture for testing interfaces that are not in a TypeLib.
-// We can only verify the uuid of the interfaces and classes.
-class OmahaCustomizationGoopdateComInterfaceNoTypeLibTest
-    : public testing::Test {
-};
-
-//
-// Omaha 3 COM Constants.
-//
-
-namespace omaha {
-
-// TODO(omaha): We should probably move these to a separate
-// const_com_customization.h in goopdate\.
-TEST(OmahaCustomizationTest, Constants_ComProgIds) {
-  EXPECT_GU_STREQ(_T("GoogleUpdate.OnDemandCOMClassUser"), kProgIDOnDemandUser);
-  EXPECT_GU_STREQ(_T("GoogleUpdate.OnDemandCOMClassMachine"),
-                  kProgIDOnDemandMachine);
-  EXPECT_GU_STREQ(_T("GoogleUpdate.OnDemandCOMClassSvc"), kProgIDOnDemandSvc);
-
-  EXPECT_GU_STREQ(_T("GoogleUpdate.Update3WebUser"), kProgIDUpdate3WebUser);
-  EXPECT_GU_STREQ(_T("GoogleUpdate.Update3WebMachine"),
-                  kProgIDUpdate3WebMachine);
-  EXPECT_GU_STREQ(_T("GoogleUpdate.Update3WebSvc"), kProgIDUpdate3WebSvc);
-
-  EXPECT_GU_STREQ(_T("GoogleUpdate.CoreClass"), kProgIDGoogleUpdateCoreService);
-
-  EXPECT_GU_STREQ(_T("GoogleUpdate.ProcessLauncher"), kProgIDProcessLauncher);
-}
-
-}  // namespace omaha
-
-//
-// Omaha 3 COM Interfaces Enums.
-//
-
-TEST_F(OmahaCustomizationGoopdateComInterfaceNoTypeLibTest, BrowserType) {
-  EXPECT_EQ(0, BROWSER_UNKNOWN);
-  EXPECT_EQ(1, BROWSER_DEFAULT);
-  EXPECT_EQ(2, BROWSER_INTERNET_EXPLORER);
-  EXPECT_EQ(3, BROWSER_FIREFOX);
-  EXPECT_EQ(4, BROWSER_CHROME);
-}
-
-// There are two different BrowserType definitions, one in the IDL and one
-// in browser_utils. Verify they are identical.
-TEST_F(OmahaCustomizationGoopdateComInterfaceNoTypeLibTest,
-       BrowserType_DefinitionsMatch) {
-  EXPECT_EQ(::BROWSER_UNKNOWN,            omaha::BROWSER_UNKNOWN);
-  EXPECT_EQ(::BROWSER_DEFAULT,            omaha::BROWSER_DEFAULT);
-  EXPECT_EQ(::BROWSER_INTERNET_EXPLORER,  omaha::BROWSER_IE);
-  EXPECT_EQ(::BROWSER_FIREFOX,            omaha::BROWSER_FIREFOX);
-  EXPECT_EQ(::BROWSER_CHROME,             omaha::BROWSER_CHROME);
-
-  EXPECT_EQ(::BROWSER_CHROME + 1, omaha::BROWSER_MAX)
-      << _T("A browser has been added without updating test and/or the IDL");
-}
-
-TEST_F(OmahaCustomizationGoopdateComInterfaceNoTypeLibTest, CurrentState) {
-  EXPECT_EQ(1,  STATE_INIT);
-  EXPECT_EQ(2,  STATE_WAITING_TO_CHECK_FOR_UPDATE);
-  EXPECT_EQ(3,  STATE_CHECKING_FOR_UPDATE);
-  EXPECT_EQ(4,  STATE_UPDATE_AVAILABLE);
-  EXPECT_EQ(5,  STATE_WAITING_TO_DOWNLOAD);
-  EXPECT_EQ(6,  STATE_RETRYING_DOWNLOAD);
-  EXPECT_EQ(7,  STATE_DOWNLOADING);
-  EXPECT_EQ(8,  STATE_DOWNLOAD_COMPLETE);
-  EXPECT_EQ(9,  STATE_EXTRACTING);
-  EXPECT_EQ(10, STATE_APPLYING_DIFFERENTIAL_PATCH);
-  EXPECT_EQ(11, STATE_READY_TO_INSTALL);
-  EXPECT_EQ(12, STATE_WAITING_TO_INSTALL);
-  EXPECT_EQ(13, STATE_INSTALLING);
-  EXPECT_EQ(14, STATE_INSTALL_COMPLETE);
-  EXPECT_EQ(15, STATE_PAUSED);
-  EXPECT_EQ(16, STATE_NO_UPDATE);
-  EXPECT_EQ(17, STATE_ERROR);
-}
-
-TEST_F(OmahaCustomizationGoopdateComInterfaceNoTypeLibTest, InstallPriority) {
-  EXPECT_EQ(0,  INSTALL_PRIORITY_LOW);
-  EXPECT_EQ(10, INSTALL_PRIORITY_HIGH);
-}
-
-TEST_F(OmahaCustomizationGoopdateComInterfaceNoTypeLibTest, PostInstallAction) {
-  EXPECT_EQ(0, POST_INSTALL_ACTION_DEFAULT);
-  EXPECT_EQ(1, POST_INSTALL_ACTION_EXIT_SILENTLY);
-  EXPECT_EQ(2, POST_INSTALL_ACTION_LAUNCH_COMMAND);
-  EXPECT_EQ(3, POST_INSTALL_ACTION_EXIT_SILENTLY_ON_LAUNCH_COMMAND);
-  EXPECT_EQ(4, POST_INSTALL_ACTION_RESTART_BROWSER);
-  EXPECT_EQ(5, POST_INSTALL_ACTION_RESTART_ALL_BROWSERS);
-  EXPECT_EQ(6, POST_INSTALL_ACTION_REBOOT);
-}
-
-//
-// Omaha 3 COM Interfaces.
-//
-
-TEST_F(OmahaCustomizationGoopdateComInterfaceTest, TypeLib) {
-  EXPECT_GU_ID_EQ(_T("{655DD85A-3C0D-4674-9C58-AF7168C5861E}"),
-                  LIBID_GoogleUpdate3Lib);
-
-  EXPECT_SUCCEEDED(GetDocumentation(-1));
-  EXPECT_STREQ(_T("GoogleUpdate3Lib"), item_name_);
-  EXPECT_GU_STREQ(_T("Google Update 3.0 Type Library"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest, IGoogleUpdate3) {
-  // TODO(omaha): Test uuid constants after extracting from IDLs.
-  EXPECT_GU_ID_EQ(_T("{6DB17455-4E85-46e7-9D23-E555E4B005AF}"),
-                  __uuidof(IGoogleUpdate3));
-
-  EXPECT_SUCCEEDED(GetDocumentation(0));
-  EXPECT_STREQ(_T("IGoogleUpdate3"), item_name_);
-  EXPECT_STREQ(_T("IGoogleUpdate3 Interface"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-// The IAppBundle interface name does not change for non-Google builds, but the
-// ID must. The same is true for many of the interfaces.
-TEST_F(OmahaCustomizationGoopdateComInterfaceTest, IAppBundle) {
-  EXPECT_GU_ID_EQ(_T("{313cfb25-4888-4fc6-9e19-764d8c5fc8f8}"),
-                  __uuidof(IAppBundle));
-
-  EXPECT_SUCCEEDED(GetDocumentation(1));
-  EXPECT_STREQ(_T("IAppBundle"), item_name_);
-  EXPECT_STREQ(_T("IAppBundle Interface"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-// This appears in the typelib for unknown reasons.
-TEST_F(OmahaCustomizationGoopdateComInterfaceTest, ULONG_PTR) {
-  EXPECT_SUCCEEDED(GetDocumentation(2));
-  EXPECT_STREQ(_T("ULONG_PTR"), item_name_);
-  EXPECT_TRUE(!item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_F(OmahaCustomizationGoopdateComInterfaceTest, IApp) {
-  EXPECT_GU_ID_EQ(_T("{D999CE21-98B3-4894-BACB-A49A1D50848F}"),
-                  __uuidof(IApp));
-
-  EXPECT_SUCCEEDED(GetDocumentation(3));
-  EXPECT_STREQ(_T("IApp"), item_name_);
-  EXPECT_STREQ(_T("IApp Interface"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_F(OmahaCustomizationGoopdateComInterfaceTest, IAppVersion) {
-  EXPECT_GU_ID_EQ(_T("{BCDCB538-01C0-46d1-A6A7-52F4D021C272}"),
-                  __uuidof(IAppVersion));
-
-  EXPECT_SUCCEEDED(GetDocumentation(4));
-  EXPECT_STREQ(_T("IAppVersion"), item_name_);
-  EXPECT_STREQ(_T("IAppVersion Interface"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_F(OmahaCustomizationGoopdateComInterfaceTest, IPackage) {
-  EXPECT_GU_ID_EQ(_T("{DCAB8386-4F03-4dbd-A366-D90BC9F68DE6}"),
-                  __uuidof(IPackage));
-
-  EXPECT_SUCCEEDED(GetDocumentation(5));
-  EXPECT_STREQ(_T("IPackage"), item_name_);
-  EXPECT_STREQ(_T("IPackage Interface"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_F(OmahaCustomizationGoopdateComInterfaceTest, ICurrentState) {
-  EXPECT_GU_ID_EQ(_T("{247954F9-9EDC-4E68-8CC3-150C2B89EADF}"),
-                  __uuidof(ICurrentState));
-
-  EXPECT_SUCCEEDED(GetDocumentation(6));
-  EXPECT_STREQ(_T("ICurrentState"), item_name_);
-  EXPECT_STREQ(_T("ICurrentState Interface"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-// Not in the TypeLib because it derives from IUnknown.
-TEST_F(OmahaCustomizationGoopdateComInterfaceNoTypeLibTest,
-       IRegistrationUpdateHook) {
-  EXPECT_GU_ID_EQ(_T("{4E223325-C16B-4eeb-AEDC-19AA99A237FA}"),
-                  __uuidof(IRegistrationUpdateHook));
-}
-
-// Not in the TypeLib because it derives from IUnknown.
-TEST_F(OmahaCustomizationGoopdateComInterfaceNoTypeLibTest, ICoCreateAsync) {
-  EXPECT_GU_ID_EQ(_T("{DAB1D343-1B2A-47f9-B445-93DC50704BFE}"),
-                  __uuidof(ICoCreateAsync));
-}
-
-// Not in the TypeLib because it derives from IUnknown.
-TEST_F(OmahaCustomizationGoopdateComInterfaceNoTypeLibTest, ICredentialDialog) {
-  EXPECT_GU_ID_EQ(_T("{b3a47570-0a85-4aea-8270-529d47899603}"),
-                  __uuidof(ICredentialDialog));
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest, IGoogleUpdate3Web) {
-  EXPECT_GU_ID_EQ(_T("{494B20CF-282E-4BDD-9F5D-B70CB09D351E}"),
-                  __uuidof(IGoogleUpdate3Web));
-
-  EXPECT_SUCCEEDED(GetDocumentation(7));
-  EXPECT_STREQ(_T("IGoogleUpdate3Web"), item_name_);
-  EXPECT_STREQ(_T("IGoogleUpdate3Web Interface"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-// Not in the TypeLib because it derives from IUnknown.
-TEST_F(OmahaCustomizationGoopdateComInterfaceNoTypeLibTest,
-       IGoogleUpdate3WebSecurity) {
-  EXPECT_GU_ID_EQ(_T("{2D363682-561D-4c3a-81C6-F2F82107562A}"),
-                  __uuidof(IGoogleUpdate3WebSecurity));
-}
-
-TEST_F(OmahaCustomizationGoopdateComInterfaceTest, IAppBundleWeb) {
-  EXPECT_GU_ID_EQ(_T("{DD42475D-6D46-496a-924E-BD5630B4CBBA}"),
-                  __uuidof(IAppBundleWeb));
-
-  EXPECT_SUCCEEDED(GetDocumentation(8));
-  EXPECT_STREQ(_T("IAppBundleWeb"), item_name_);
-  EXPECT_STREQ(_T("IAppBundleWeb Interface"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_F(OmahaCustomizationGoopdateComInterfaceTest, IAppWeb) {
-  EXPECT_GU_ID_EQ(_T("{C6398F88-69CE-44ac-B6A7-1D3E2AA46679}"),
-                  __uuidof(IAppWeb));
-
-  EXPECT_SUCCEEDED(GetDocumentation(9));
-  EXPECT_STREQ(_T("IAppWeb"), item_name_);
-  EXPECT_STREQ(_T("IAppWeb Interface"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_F(OmahaCustomizationGoopdateComInterfaceTest, IAppVersionWeb) {
-  EXPECT_GU_ID_EQ(_T("{0CD01D1E-4A1C-489d-93B9-9B6672877C57}"),
-                  __uuidof(IAppVersionWeb));
-
-  EXPECT_SUCCEEDED(GetDocumentation(10));
-  EXPECT_STREQ(_T("IAppVersionWeb"), item_name_);
-  EXPECT_STREQ(_T("IAppVersionWeb Interface"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_F(OmahaCustomizationGoopdateComInterfaceTest, ICoCreateAsyncStatus) {
-  EXPECT_GU_ID_EQ(_T("{2E629606-312A-482f-9B12-2C4ABF6F0B6D}"),
-                  __uuidof(ICoCreateAsyncStatus));
-
-  EXPECT_SUCCEEDED(GetDocumentation(11));
-  EXPECT_STREQ(_T("ICoCreateAsyncStatus"), item_name_);
-  EXPECT_STREQ(_T("ICoCreateAsyncStatus Interface"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              GoogleUpdate3UserClass) {
-  EXPECT_GU_ID_EQ(_T("{022105BD-948A-40c9-AB42-A3300DDF097F}"),
-                  __uuidof(GoogleUpdate3UserClass));
-
-  EXPECT_SUCCEEDED(GetDocumentation(12));
-  EXPECT_STREQ(_T("GoogleUpdate3UserClass"), item_name_);
-  EXPECT_STREQ(_T("GoogleUpdate3 Class for per-user applications"),
-               item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              GoogleUpdate3ServiceClass) {
-  EXPECT_GU_ID_EQ(_T("{4EB61BAC-A3B6-4760-9581-655041EF4D69}"),
-                  __uuidof(GoogleUpdate3ServiceClass));
-
-  EXPECT_SUCCEEDED(GetDocumentation(13));
-  EXPECT_STREQ(_T("GoogleUpdate3ServiceClass"), item_name_);
-  EXPECT_STREQ(_T("GoogleUpdate3 Service Class for machine applications"),
-               item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              GoogleUpdate3WebUserClass) {
-  EXPECT_GU_ID_EQ(_T("{22181302-A8A6-4f84-A541-E5CBFC70CC43}"),
-                  __uuidof(GoogleUpdate3WebUserClass));
-
-  EXPECT_SUCCEEDED(GetDocumentation(14));
-  EXPECT_STREQ(_T("GoogleUpdate3WebUserClass"), item_name_);
-  EXPECT_STREQ(_T("GoogleUpdate3Web for user applications"),
-                  item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              GoogleUpdate3WebMachineClass) {
-  EXPECT_GU_ID_EQ(_T("{8A1D4361-2C08-4700-A351-3EAA9CBFF5E4}"),
-                  __uuidof(GoogleUpdate3WebMachineClass));
-
-  EXPECT_SUCCEEDED(GetDocumentation(15));
-  EXPECT_STREQ(_T("GoogleUpdate3WebMachineClass"), item_name_);
-  EXPECT_STREQ(
-      _T("Pass-through broker for the GoogleUpdate3WebServiceClass"),
-      item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              GoogleUpdate3WebServiceClass) {
-  EXPECT_GU_ID_EQ(_T("{534F5323-3569-4f42-919D-1E1CF93E5BF6}"),
-                  __uuidof(GoogleUpdate3WebServiceClass));
-
-  EXPECT_SUCCEEDED(GetDocumentation(16));
-  EXPECT_STREQ(_T("GoogleUpdate3WebServiceClass"), item_name_);
-  EXPECT_STREQ(_T("GoogleUpdate3Web"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              GoogleUpdate3WebMachineFallbackClass) {
-  EXPECT_GU_ID_EQ(_T("{598FE0E5-E02D-465d-9A9D-37974A28FD42}"),
-                  __uuidof(GoogleUpdate3WebMachineFallbackClass));
-
-  EXPECT_SUCCEEDED(GetDocumentation(17));
-  EXPECT_STREQ(_T("GoogleUpdate3WebMachineFallbackClass"), item_name_);
-  EXPECT_STREQ(L"Fallback mechanism if GoogleUpdate3WebServiceClass fails",
-               item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              CurrentStateUserClass) {
-  EXPECT_GU_ID_EQ(_T("{E8CF3E55-F919-49d9-ABC0-948E6CB34B9F}"),
-                  __uuidof(CurrentStateUserClass));
-
-  EXPECT_SUCCEEDED(GetDocumentation(18));
-  EXPECT_STREQ(_T("CurrentStateUserClass"), item_name_);
-  EXPECT_STREQ(_T("CurrentStateUserClass"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              CurrentStateMachineClass) {
-  EXPECT_GU_ID_EQ(_T("{9D6AA569-9F30-41ad-885A-346685C74928}"),
-                  __uuidof(CurrentStateMachineClass));
-
-  EXPECT_SUCCEEDED(GetDocumentation(19));
-  EXPECT_STREQ(_T("CurrentStateMachineClass"), item_name_);
-  EXPECT_STREQ(_T("CurrentStateMachineClass"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              CoCreateAsyncClass) {
-  EXPECT_GU_ID_EQ(_T("{7DE94008-8AFD-4c70-9728-C6FBFFF6A73E}"),
-                  __uuidof(CoCreateAsyncClass));
-
-  EXPECT_SUCCEEDED(GetDocumentation(20));
-  EXPECT_STREQ(_T("CoCreateAsyncClass"), item_name_);
-  EXPECT_STREQ(_T("CoCreateAsyncClass"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              CredentialDialogUserClass) {
-  EXPECT_GU_ID_EQ(_T("{e67be843-bbbe-4484-95fb-05271ae86750}"),
-                  __uuidof(CredentialDialogUserClass));
-
-  EXPECT_SUCCEEDED(GetDocumentation(21));
-  EXPECT_STREQ(_T("CredentialDialogUserClass"), item_name_);
-  EXPECT_STREQ(_T("CredentialDialogUserClass"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              CredentialDialogMachineClass) {
-  EXPECT_GU_ID_EQ(_T("{25461599-633d-42b1-84fb-7cd68d026e53}"),
-                  __uuidof(CredentialDialogMachineClass));
-
-  EXPECT_SUCCEEDED(GetDocumentation(22));
-  EXPECT_STREQ(_T("CredentialDialogMachineClass"), item_name_);
-  EXPECT_STREQ(_T("CredentialDialogMachineClass"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              GoogleComProxyMachineClass) {
-  EXPECT_SUCCEEDED(GetDocumentation(23));
-  EXPECT_STREQ(_T("GoogleComProxyMachineClass"), item_name_);
-  EXPECT_STREQ(_T("GoogleComProxyMachineClass"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              GoogleComProxyUserClass) {
-  EXPECT_SUCCEEDED(GetDocumentation(24));
-  EXPECT_STREQ(_T("GoogleComProxyUserClass"), item_name_);
-  EXPECT_STREQ(_T("GoogleComProxyUserClass"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              ProcessLauncherClass) {
-  EXPECT_GU_ID_EQ(_T("{ABC01078-F197-4b0b-ADBC-CFE684B39C82}"),
-                  __uuidof(ProcessLauncherClass));
-
-  EXPECT_SUCCEEDED(GetDocumentation(25));
-  EXPECT_STREQ(_T("ProcessLauncherClass"), item_name_);
-  EXPECT_STREQ(_T("ProcessLauncherClass Class"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              OneClickUserProcessLauncherClass) {
-  EXPECT_GU_ID_EQ(_T("{51F9E8EF-59D7-475b-A106-C7EA6F30C119}"),
-                  __uuidof(OneClickUserProcessLauncherClass));
-
-  EXPECT_SUCCEEDED(GetDocumentation(26));
-  EXPECT_STREQ(_T("OneClickUserProcessLauncherClass"), item_name_);
-  EXPECT_STREQ(_T("OneClickUserProcessLauncherClass Class"),
-               item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              IOneClickProcessLauncher) {
-  EXPECT_GU_ID_EQ(_T("{5CCCB0EF-7073-4516-8028-4C628D0C8AAB}"),
-                  __uuidof(IOneClickProcessLauncher));
-
-  EXPECT_SUCCEEDED(GetDocumentation(27));
-  EXPECT_STREQ(_T("IOneClickProcessLauncher"), item_name_);
-  EXPECT_STREQ(_T("Google Update IOneClickProcessLauncher Interface"),
-               item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              OneClickMachineProcessLauncherClass) {
-  EXPECT_GU_ID_EQ(_T("{AAD4AE2E-D834-46d4-8B09-490FAC9C722B}"),
-                  __uuidof(OneClickMachineProcessLauncherClass));
-
-  EXPECT_SUCCEEDED(GetDocumentation(28));
-  EXPECT_STREQ(_T("OneClickMachineProcessLauncherClass"), item_name_);
-  EXPECT_STREQ(_T("OneClickMachineProcessLauncherClass Class"),
-               item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              OnDemandUserAppsClass) {
-  EXPECT_GU_ID_EQ(_T("{2F0E2680-9FF5-43c0-B76E-114A56E93598}"),
-                  __uuidof(OnDemandUserAppsClass));
-
-  EXPECT_SUCCEEDED(GetDocumentation(29));
-  EXPECT_STREQ(_T("OnDemandUserAppsClass"), item_name_);
-  EXPECT_STREQ(_T("OnDemand updates for per-user applications."),
-               item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              OnDemandMachineAppsClass) {
-  EXPECT_GU_ID_EQ(_T("{6F8BD55B-E83D-4a47-85BE-81FFA8057A69}"),
-                  __uuidof(OnDemandMachineAppsClass));
-
-  EXPECT_SUCCEEDED(GetDocumentation(30));
-  EXPECT_STREQ(_T("OnDemandMachineAppsClass"), item_name_);
-  EXPECT_STREQ(_T("OnDemand pass-through broker for machine applications."),
-               item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              OnDemandMachineAppsServiceClass) {
-  EXPECT_GU_ID_EQ(_T("{9465B4B4-5216-4042-9A2C-754D3BCDC410}"),
-                  __uuidof(OnDemandMachineAppsServiceClass));
-
-  EXPECT_SUCCEEDED(GetDocumentation(31));
-  EXPECT_STREQ(_T("OnDemandMachineAppsServiceClass"), item_name_);
-  EXPECT_STREQ(_T("OnDemand updates for per-machine applications."),
-               item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              OnDemandMachineAppsFallbackClass) {
-  EXPECT_GU_ID_EQ(_T("{B3D28DBD-0DFA-40e4-8071-520767BADC7E}"),
-                  __uuidof(OnDemandMachineAppsFallbackClass));
-
-  EXPECT_SUCCEEDED(GetDocumentation(32));
-  EXPECT_STREQ(_T("OnDemandMachineAppsFallbackClass"), item_name_);
-  EXPECT_STREQ(_T("Fallback for if OnDemandMachineAppsServiceClass fails."),
-               item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              GoogleUpdateCoreClass) {
-  EXPECT_GU_ID_EQ(_T("{E225E692-4B47-4777-9BED-4FD7FE257F0E}"),
-                  __uuidof(GoogleUpdateCoreClass));
-
-  EXPECT_SUCCEEDED(GetDocumentation(33));
-  EXPECT_STREQ(_T("GoogleUpdateCoreClass"), item_name_);
-  EXPECT_STREQ(_T("GoogleUpdateCore Class"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationGoopdateComInterfaceTest,
-              GoogleUpdateCoreMachineClass) {
-  EXPECT_GU_ID_EQ(_T("{9B2340A0-4068-43d6-B404-32E27217859D}"),
-                  __uuidof(GoogleUpdateCoreMachineClass));
-
-  EXPECT_SUCCEEDED(GetDocumentation(34));
-  EXPECT_STREQ(_T("GoogleUpdateCoreMachineClass"), item_name_);
-  EXPECT_STREQ(_T("GoogleUpdateCore Machine Class"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-// Verifies there are no new interfaces in the TypeLib.
-TEST_F(OmahaCustomizationGoopdateComInterfaceTest, VerifyNoNewInterfaces) {
-  EXPECT_EQ(TYPE_E_ELEMENTNOTFOUND, GetDocumentation(35))
-      << _T("A new interface may have been added. If so, roll ")
-      << _T("PROXY_CLSID_IS_MACHINE/USER and GoogleComProxyMachine/UserClass, ")
-      << _T("add the interface to kIIDsToRegister, and add test(s) for new ")
-      << _T("interface(s).");
-}
-
-//
-// Omaha 2 COM Interfaces.
-//
-// TODO(omaha): We should make it so open source versions do not need these
-// legacy interfaces.
-
-TEST_F(OmahaCustomizationGoopdateComInterfaceNoTypeLibTest,
-       IBrowserHttpRequest2) {
-  EXPECT_GU_ID_EQ(_T("{5B25A8DC-1780-4178-A629-6BE8B8DEFAA2}"),
-                  __uuidof(IBrowserHttpRequest2));
-}
-
-TEST_F(OmahaCustomizationGoopdateComInterfaceNoTypeLibTest,
-       IProcessLauncher) {
-  EXPECT_GU_ID_EQ(_T("{128C2DA6-2BC0-44c0-B3F6-4EC22E647964}"),
-                  __uuidof(IProcessLauncher));
-}
-
-TEST_F(OmahaCustomizationGoopdateComInterfaceNoTypeLibTest,
-       IProgressWndEvents) {
-  EXPECT_GU_ID_EQ(_T("{1C642CED-CA3B-4013-A9DF-CA6CE5FF6503}"),
-                  __uuidof(IProgressWndEvents));
-}
-
-TEST_F(OmahaCustomizationGoopdateComInterfaceNoTypeLibTest,
-       IJobObserver) {
-  EXPECT_GU_ID_EQ(_T("{49D7563B-2DDB-4831-88C8-768A53833837}"),
-                  __uuidof(IJobObserver));
-}
-
-TEST_F(OmahaCustomizationGoopdateComInterfaceNoTypeLibTest,
-       IGoogleUpdate) {
-  EXPECT_GU_ID_EQ(_T("{31AC3F11-E5EA-4a85-8A3D-8E095A39C27B}"),
-                  __uuidof(IGoogleUpdate));
-}
-
-TEST_F(OmahaCustomizationGoopdateComInterfaceNoTypeLibTest,
-       IGoogleUpdateCore) {
-  EXPECT_GU_ID_EQ(_T("{909489C2-85A6-4322-AA56-D25278649D67}"),
-                  __uuidof(IGoogleUpdateCore));
-}
-
diff --git a/goopdate/ondemand.cc b/goopdate/ondemand.cc
deleted file mode 100644
index 7a56231..0000000
--- a/goopdate/ondemand.cc
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/ondemand.h"
-#include "omaha/base/debug.h"
-#include "omaha/client/bundle_installer.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/lang.h"
-#include "omaha/common/update3_utils.h"
-#include "goopdate/omaha3_idl.h"
-#include "omaha/goopdate/job_observer.h"
-
-namespace omaha {
-
-namespace internal {
-
-namespace {
-
-HRESULT CreateJobObserverForOnDemand(DWORD job_observer_git_cookie,
-                                     JobObserverCOMDecorator** job_observer) {
-  ASSERT1(job_observer);
-  *job_observer = NULL;
-
-  CComGITPtr<IJobObserver> job_observer_git(job_observer_git_cookie);
-  CComPtr<IJobObserver> ijob_observer;
-  HRESULT hr = job_observer_git.CopyTo(&ijob_observer);
-  ASSERT1(ijob_observer);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[job_observer_git.CopyTo failed][0x%x]"), hr));
-    return hr;
-  }
-
-  CComObject<JobObserverCOMDecorator>* job_observer_com = NULL;
-  hr = CComObject<JobObserverCOMDecorator>::CreateInstance(&job_observer_com);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[JobObserverCOMDecorator creation failed][0x%x]"), hr));
-    return hr;
-  }
-
-  job_observer_com->Initialize(ijob_observer);
-  job_observer_com->AddRef();
-  *job_observer = job_observer_com;
-  return S_OK;
-}
-
-}  // namespace
-
-HRESULT DoOnDemand(bool is_machine, OnDemandParameters on_demand_params) {
-  CComPtr<JobObserverCOMDecorator> job_observer;
-  HRESULT hr = internal::CreateJobObserverForOnDemand(
-      on_demand_params.job_observer_git_cookie, &job_observer);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[CreateJobObserver failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return UpdateAppOnDemand(is_machine,
-                           on_demand_params.app_id,
-                           on_demand_params.is_update_check_only,
-                           on_demand_params.session_id,
-                           on_demand_params.impersonation_token,
-                           on_demand_params.primary_token,
-                           job_observer);
-}
-
-}  // namespace internal
-
-}  // namespace omaha
diff --git a/goopdate/ondemand.h b/goopdate/ondemand.h
deleted file mode 100644
index 5aaaeac..0000000
--- a/goopdate/ondemand.h
+++ /dev/null
@@ -1,294 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// TODO(omaha3): This really is a client. Where should it and similar code live?
-
-#ifndef OMAHA_GOOPDATE_ONDEMAND_H_
-#define OMAHA_GOOPDATE_ONDEMAND_H_
-
-#include <atlbase.h>
-#include <oaidl.h>
-#include <oleauto.h>
-#include "base/basictypes.h"
-#include "base/debug.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/atlregmapex.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/preprocessor_fun.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/thread_pool_callback.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/goopdate/com_proxy.h"
-#include "omaha/goopdate/elevation_moniker_resource.h"
-#include "goopdate/omaha3_idl.h"
-// TODO(omaha3): Worker is convenient, but it is very odd to include part of the
-// Omaha 3 COM server in one of its clients.
-#include "omaha/goopdate/goopdate.h"
-
-namespace omaha {
-
-namespace internal {
-
-struct OnDemandParameters {
- public:
-  OnDemandParameters(const CString& guid,
-                     DWORD job_observer_cookie,
-                     bool is_check_only,
-                     const CString& sess_id,
-                     HANDLE caller_impersonation_token,
-                     HANDLE caller_primary_token)
-      : app_id(guid),
-        job_observer_git_cookie(job_observer_cookie),
-        is_update_check_only(is_check_only),
-        session_id(sess_id),
-        impersonation_token(caller_impersonation_token),
-        primary_token(caller_primary_token) {
-    ASSERT1(guid.GetLength() > 0);
-    ASSERT1(IsGuid(session_id));
-    ASSERT1(job_observer_cookie);
-  }
-
-  CString app_id;
-  DWORD job_observer_git_cookie;
-  bool is_update_check_only;
-  CString session_id;
-  HANDLE impersonation_token;
-  HANDLE primary_token;
-};
-
-HRESULT DoOnDemand(bool is_machine,
-                   OnDemandParameters on_demand_params);
-
-}  // namespace internal
-
-#pragma warning(push)
-
-// Construction of local static object is not thread-safe
-#pragma warning(disable:4640)
-
-template <typename T>
-class ATL_NO_VTABLE OnDemand
-    : public CComObjectRootEx<CComObjectThreadModel>,
-      public CComCoClass<OnDemand<T> >,
-      public IGoogleUpdate,
-      public StdMarshalInfo {
- public:
-  // IGoogleUpdate::CheckForUpdate().
-  STDMETHOD(CheckForUpdate)(const WCHAR* guid, IJobObserver* observer) {
-    return DoOnDemandInternalAsync(guid, observer, true);
-  }
-
-  // IGoogleUpdate::Update().
-  STDMETHOD(Update)(const WCHAR* guid, IJobObserver* observer) {
-    // Verify that the caller is an administrator for the machine case.
-    if (T::is_machine() &&
-        !UserRights::TokenIsAdmin(impersonation_token_.GetHandle())) {
-      CORE_LOG(LE, (_T("[User is not an admin]")));
-      return E_ACCESSDENIED;
-    }
-
-    return DoOnDemandInternalAsync(guid, observer, false);
-  }
-
-  HRESULT FinalConstruct() {
-    CORE_LOG(L2, (_T("[OnDemand::FinalConstruct]")));
-
-    if (!T::is_machine()) {
-      return S_OK;
-    }
-
-    HRESULT hr = UserRights::GetCallerToken(&impersonation_token_);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[GetCallerToken failed][0x%x]"), hr));
-      return hr;
-    }
-
-    if (!impersonation_token_.CreatePrimaryToken(&primary_token_)) {
-      HRESULT hr = HRESULTFromLastError();
-      CORE_LOG(LE, (_T("[CreatePrimaryToken failed][%d]"), hr));
-      return hr;
-    }
-
-    return S_OK;
-  }
-
- protected:
-  OnDemand() : StdMarshalInfo(T::is_machine()) {
-    CORE_LOG(L2, (_T("[OnDemand::OnDemand]")));
-  }
-
-  virtual ~OnDemand() {
-    CORE_LOG(L2, (_T("[OnDemand::~OnDemand]")));
-  }
-
-  void FinalRelease() {
-    CORE_LOG(L2, (_T("[OnDemand::FinalRelease]")));
-  }
-
-  HRESULT DoOnDemandInternalAsync(const WCHAR* guid,
-                                  IJobObserver* observer,
-                                  bool is_update_check_only) {
-    CORE_LOG(L2, (_T("[DoOnDemandInternalAsync][%s][%d]"),
-                  guid, is_update_check_only));
-
-    CComGITPtr<IJobObserver> job_observer_git;
-    HRESULT hr = job_observer_git.Attach(observer);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[job_observer_git.Attach failed][0x%x]"), hr));
-      return hr;
-    }
-
-    CAccessToken dup_impersonation_token;
-    CAccessToken dup_primary_token;
-    if (T::is_machine()) {
-      hr = DuplicateTokenIntoCurrentProcess(::GetCurrentProcess(),
-                                            impersonation_token_.GetHandle(),
-                                            &dup_impersonation_token);
-      if (FAILED(hr)) {
-        CORE_LOG(LE, (_T("[Failed to duplicate impersonation token][0x%x]"),
-                      hr));
-        return hr;
-      }
-
-      hr = DuplicateTokenIntoCurrentProcess(::GetCurrentProcess(),
-                                            primary_token_.GetHandle(),
-                                            &dup_primary_token);
-      if (FAILED(hr)) {
-        CORE_LOG(LE, (_T("[Failed to duplicate primary token][0x%x]"), hr));
-        return hr;
-      }
-    }
-
-    if (session_id_.IsEmpty()) {
-      VERIFY1(SUCCEEDED(GetGuid(&session_id_)));
-    }
-
-    // Create a thread pool work item for deferred execution of the on demand
-    // check. The thread pool owns this call back object. The thread owns the
-    // impersonation and primary tokens.
-    typedef StaticThreadPoolCallBack1<internal::OnDemandParameters> Callback;
-    scoped_ptr<Callback> callback(
-        new Callback(&OnDemand::DoOnDemandInternal,
-                     internal::OnDemandParameters(
-                         guid,
-                         job_observer_git.Detach(),
-                         is_update_check_only,
-                         session_id_,
-                         dup_impersonation_token.GetHandle(),
-                         dup_primary_token.GetHandle())));
-
-    hr = Goopdate::Instance().QueueUserWorkItem(callback.get(),
-                                                WT_EXECUTELONGFUNCTION);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[QueueUserWorkItem failed][0x%x]"), hr));
-      return hr;
-    }
-
-    if (T::is_machine()) {
-      dup_impersonation_token.Detach();
-      dup_primary_token.Detach();
-    }
-
-    callback.release();
-
-    return S_OK;
-  }
-
-  static void DoOnDemandInternal(
-      internal::OnDemandParameters on_demand_params) {
-    CORE_LOG(L2, (_T("[DoOnDemandInternal][%d]"),
-                  on_demand_params.is_update_check_only));
-    _pAtlModule->Lock();
-    ON_SCOPE_EXIT_OBJ(*_pAtlModule, &CAtlModule::Unlock);
-
-    scoped_handle impersonation_token(on_demand_params.impersonation_token);
-    scoped_handle primary_token(on_demand_params.primary_token);
-
-    scoped_co_init init_com_apt(COINIT_APARTMENTTHREADED);
-    HRESULT hr = init_com_apt.hresult();
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[init_com_apt failed][0x%x]"), hr));
-      return;
-    }
-
-    hr = internal::DoOnDemand(T::is_machine(), on_demand_params);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[DoOnDemand failed][0x%x]"), hr));
-      return;
-    }
-  }
-
-  DECLARE_NOT_AGGREGATABLE(OnDemand)
-  DECLARE_REGISTRY_RESOURCEID_EX(T::registry_res_id())
-
-  BEGIN_REGISTRY_MAP()
-    REGMAP_ENTRY(_T("HKROOT"), T::hk_root())
-    REGMAP_ENTRY(_T("VERSION"), _T("1.0"))
-    REGMAP_ENTRY(_T("PROGID"), T::prog_id())
-    REGMAP_ENTRY(_T("DESCRIPTION"), _T("Google Update Legacy On Demand"))
-    REGMAP_ENTRY(_T("CLSID"), T::class_id())
-    REGMAP_MODULE2(_T("MODULE"), kOmahaOnDemandFileName)
-    REGMAP_ENTRY(_T("ICONRESID"), PP_STRINGIZE(IDI_ELEVATION_MONIKER_ICON))
-    REGMAP_ENTRY(_T("STRINGRESID"),
-                 PP_STRINGIZE(IDS_ELEVATION_MONIKER_DISPLAYNAME))
-  END_REGISTRY_MAP()
-
-  BEGIN_COM_MAP(OnDemand)
-    COM_INTERFACE_ENTRY(IGoogleUpdate)
-    COM_INTERFACE_ENTRY(IStdMarshalInfo)
-  END_COM_MAP()
-
- private:
-  CAccessToken impersonation_token_;
-  CAccessToken primary_token_;
-  CString session_id_;
-
-  DISALLOW_COPY_AND_ASSIGN(OnDemand);
-};
-
-struct OnDemandModeUser {
-  static bool is_machine() { return false; }
-  static const TCHAR* const prog_id() { return kProgIDOnDemandUser; }
-  static GUID class_id() { return __uuidof(OnDemandUserAppsClass); }
-  static UINT registry_res_id() { return IDR_LOCAL_SERVER_RGS; }
-  static const TCHAR* const hk_root() { return _T("HKCU"); }
-};
-
-struct OnDemandModeMachineFallback {
-  static bool is_machine() { return true; }
-  static const TCHAR* const prog_id() { return kProgIDOnDemandMachineFallback; }
-  static GUID class_id() { return __uuidof(OnDemandMachineAppsFallbackClass); }
-  static UINT registry_res_id() { return IDR_LOCAL_SERVER_ELEVATION_RGS; }
-  static const TCHAR* const hk_root() { return _T("HKLM"); }
-};
-
-struct OnDemandModeService {
-  static bool is_machine() { return true; }
-  static const TCHAR* const prog_id() { return kProgIDOnDemandSvc; }
-  static GUID class_id() { return __uuidof(OnDemandMachineAppsServiceClass); }
-  static UINT registry_res_id() { return IDR_LOCAL_SERVICE_RGS; }
-  static const TCHAR* const hk_root() { return _T("HKLM"); }
-};
-
-typedef OnDemand<OnDemandModeUser> OnDemandUser;
-typedef OnDemand<OnDemandModeMachineFallback> OnDemandMachineFallback;
-typedef OnDemand<OnDemandModeService> OnDemandService;
-
-#pragma warning(pop)
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_ONDEMAND_H_
diff --git a/goopdate/oneclick_process_launcher.cc b/goopdate/oneclick_process_launcher.cc
deleted file mode 100644
index d2d3bf4..0000000
--- a/goopdate/oneclick_process_launcher.cc
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/oneclick_process_launcher.h"
-
-#include "base/scoped_ptr.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/goopdate/app_command.h"
-
-namespace omaha {
-
-OneClickProcessLauncher::OneClickProcessLauncher() {}
-
-OneClickProcessLauncher::~OneClickProcessLauncher() {}
-
-STDMETHODIMP OneClickProcessLauncher::LaunchAppCommand(
-    const WCHAR* app_guid, const WCHAR* cmd_id) {
-  ASSERT1(app_guid);
-  ASSERT1(cmd_id);
-
-  if (!app_guid || !cmd_id) {
-    return E_INVALIDARG;
-  }
-
-  CORE_LOG(L3, (_T("[OneClickProcessLauncher::LaunchAppCommand]")
-                _T("[app %s][cmd %s]"), app_guid, cmd_id));
-
-  // Allocate a session ID for the ping that this call will generate.
-  // TODO(omaha3): Are there any situations where this control can be
-  // instantiated outside of the context of an Update3Web/OneClick
-  // webpage?  If not, we should consider adding a function to
-  // OneClickProcessLauncher() to modify the session ID it uses.
-  CString session_id;
-  GetGuid(&session_id);
-
-  scoped_ptr<AppCommand> app_command;
-  HRESULT hr = AppCommand::Load(app_guid,
-                                is_machine(),
-                                cmd_id,
-                                session_id,
-                                address(app_command));
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[failed to load command configuration][0x%x]"), hr));
-    return hr;
-  }
-
-  if (!app_command->is_web_accessible()) {
-    return E_ACCESSDENIED;
-  }
-
-  if (!is_machine()) {
-    // Execute directly at medium integrity for user-level mode
-    scoped_process process;
-    return app_command->Execute(address(process));
-  }
-
-  // Elevate to high integrity for machine-level mode
-  CComPtr<IProcessLauncher> process_launcher;
-  hr = process_launcher.CoCreateInstance(__uuidof(ProcessLauncherClass));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  ULONG_PTR phandle = NULL;
-  DWORD process_id = ::GetCurrentProcessId();
-
-  hr = process_launcher->LaunchCmdElevated(
-      app_guid, cmd_id, process_id, &phandle);
-
-  if (SUCCEEDED(hr)) {
-    ::CloseHandle(reinterpret_cast<HANDLE>(phandle));
-  }
-
-  return hr;
-}
-
-}  // namespace omaha
diff --git a/goopdate/oneclick_process_launcher.h b/goopdate/oneclick_process_launcher.h
deleted file mode 100644
index 86a6000..0000000
--- a/goopdate/oneclick_process_launcher.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_ONECLICK_PROCESS_LAUNCHER_H__
-#define OMAHA_GOOPDATE_ONECLICK_PROCESS_LAUNCHER_H__
-
-#include <atlbase.h>
-#include <atlcom.h>
-#include "base/basictypes.h"
-#include "goopdate/omaha3_idl.h"
-#include "omaha/base/atlregmapex.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/goopdate/non_localized_resource.h"
-
-namespace omaha {
-
-const TCHAR* const kOneClickProcessLauncherTlbVersion = _T("1.0");
-const TCHAR* const kOneClickProcessLauncherDescription =
-    _T(SHORT_COMPANY_NAME_ANSI) _T(".OneClickProcessLauncher");
-
-class ATL_NO_VTABLE OneClickProcessLauncher
-    : public CComObjectRootEx<CComMultiThreadModel>,
-      public CComCoClass<OneClickProcessLauncher>,
-      public IOneClickProcessLauncher {
- public:
-  OneClickProcessLauncher();
-  virtual ~OneClickProcessLauncher();
-
-  DECLARE_NOT_AGGREGATABLE(OneClickProcessLauncher)
-  DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-  DECLARE_REGISTRY_RESOURCEID_EX(IDR_LOCAL_SERVER_IE_LOW_RGS)
-
-  #pragma warning(push)
-  // C4640: construction of local static object is not thread-safe
-  #pragma warning(disable : 4640)
-  BEGIN_REGISTRY_MAP()
-    REGMAP_ENTRY(_T("HKROOT"),       goopdate_utils::GetHKRoot())
-    REGMAP_MODULE2(_T("MODULE"),
-                   is_machine() ? kOmahaBrokerFileName : kOmahaOnDemandFileName)
-    REGMAP_ENTRY(_T("VERSION"),      kOneClickProcessLauncherTlbVersion)
-    REGMAP_ENTRY(_T("PROGID"),
-                 is_machine() ?
-                     kProgIDOneClickProcessLauncherMachine :
-                     kProgIDOneClickProcessLauncherUser)
-    REGMAP_ENTRY(_T("DESCRIPTION"),  kOneClickProcessLauncherDescription)
-    REGMAP_UUID(_T("CLSID"),
-                is_machine() ?
-                    __uuidof(OneClickMachineProcessLauncherClass) :
-                    __uuidof(OneClickUserProcessLauncherClass))
-  END_REGISTRY_MAP()
-  #pragma warning(pop)
-
-  // C4505: unreferenced IUnknown local functions have been removed
-  #pragma warning(disable : 4505)
-  BEGIN_COM_MAP(OneClickProcessLauncher)
-    COM_INTERFACE_ENTRY(IOneClickProcessLauncher)
-  END_COM_MAP()
-
-  STDMETHOD(LaunchAppCommand)(const WCHAR* app_guid,
-                              const WCHAR* cmd_id);
-
- private:
-  static bool is_machine() {
-    return goopdate_utils::IsRunningFromOfficialGoopdateDir(true);
-  }
-
-  DISALLOW_COPY_AND_ASSIGN(OneClickProcessLauncher);
-};  // class OneClickProcessLauncher
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_ONECLICK_PROCESS_LAUNCHER_H__
diff --git a/goopdate/package.cc b/goopdate/package.cc
deleted file mode 100644
index 6f22796..0000000
--- a/goopdate/package.cc
+++ /dev/null
@@ -1,206 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/package.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/time.h"
-#include "omaha/base/utils.h"
-#include "omaha/goopdate/model.h"
-
-namespace omaha {
-
-Package::Package(AppVersion* app_version)
-    : ModelObject(app_version->model()),
-      app_version_(app_version),
-      expected_size_(0),
-      bytes_downloaded_(0),
-      bytes_total_(0),
-      next_download_retry_time_(0),
-      progress_sampler_(5 * kMsPerSec,    // Max sample time range.
-                        1 * kMsPerSec),   // Min range for meaningful average.
-      is_downloading_(false) {
-}
-
-Package::~Package() {
-}
-
-AppVersion* Package::app_version() {
-  __mutexScope(model()->lock());
-  return app_version_;
-}
-
-const AppVersion* Package::app_version() const {
-  __mutexScope(model()->lock());
-  return app_version_;
-}
-
-STDMETHODIMP Package::get(BSTR dir) const {
-  return model()->GetPackage(this, CString(dir));
-}
-
-STDMETHODIMP Package::get_isAvailable(VARIANT_BOOL* is_available) const {
-  ASSERT1(is_available);
-  *is_available = model()->IsPackageAvailable(this);
-  return S_OK;
-}
-
-STDMETHODIMP Package::get_filename(BSTR* filename_as_bstr) const {
-  __mutexScope(model()->lock());
-  ASSERT1(filename_as_bstr);
-  *filename_as_bstr = CComBSTR(filename()).Detach();
-  return S_OK;
-}
-
-// status_text can be NULL.
-// TODO(omaha): Change bytes and bytes_total to uint64. Any logging will
-// need to use %llu.
-void Package::OnProgress(int bytes,
-                         int bytes_total,
-                         int status,
-                         const TCHAR* status_text) {
-  __mutexScope(model()->lock());
-
-  UNREFERENCED_PARAMETER(status);
-  UNREFERENCED_PARAMETER(status_text);
-  ASSERT1(status == WINHTTP_CALLBACK_STATUS_READ_COMPLETE ||
-          status == WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER);
-
-  CORE_LOG(L5, (_T("[Package::OnProgress][bytes %d][bytes_total %d][status %d]")
-                _T("[status_text '%s']"),
-                bytes, bytes_total, status, status_text));
-
-  // TODO(omaha): What do we do if the following condition - bytes_total
-  // is not what we expect - fails? Omaha 2 just divided bytes by bytes_total
-  // to come up with the percentage, ignoring size. It didn't have to deal with
-  // multiple downloads (much) and pre-determined total download size.
-  // As an example, App::GetDownloadProgress() needs to know the expected
-  // size before we've downloaded any bytes, but it might also want to know if
-  // we are going to download less bytes. This could happen, for example, if
-  // a proxy returned an HTML page instead. (I had to disable the first assert
-  // because it fails when the actual file does not match the expected size.)
-  // Even worse, what if the bytes_total has a different non-zero number on
-  // successive calls?
-
-  // ASSERT1(bytes_total == 0 ||
-  //         bytes_total == static_cast<int>(expected_size_));
-  ASSERT1(bytes <= bytes_total);
-
-  bytes_downloaded_ = bytes;
-  bytes_total_ = bytes_total;
-
-  progress_sampler_.AddSampleWithCurrentTimeStamp(bytes_downloaded_);
-}
-
-void Package::OnRequestBegin() {
-  __mutexScope(model()->lock());
-  next_download_retry_time_ = 0;
-  bytes_downloaded_ = 0;
-  bytes_total_ = 0;
-  progress_sampler_.Reset();
-}
-
-void Package::OnRequestRetryScheduled(time64 next_download_retry_time) {
-  __mutexScope(model()->lock());
-  ASSERT1(next_download_retry_time >= GetCurrent100NSTime());
-  next_download_retry_time_ = next_download_retry_time;
-}
-
-void Package::SetFileInfo(const CString& filename,
-                          uint64 size,
-                          const CString& hash) {
-  __mutexScope(model()->lock());
-
-  ASSERT1(!filename.IsEmpty());
-  ASSERT1(0 < size);
-  ASSERT1(!hash.IsEmpty());
-
-  filename_ = filename;
-  expected_size_ = size;
-  expected_hash_ = hash;
-}
-
-CString Package::filename() const {
-  __mutexScope(model()->lock());
-  ASSERT1(!filename_.IsEmpty());
-  return filename_;
-}
-
-uint64 Package::expected_size() const {
-  __mutexScope(model()->lock());
-  return expected_size_;
-}
-
-CString Package::expected_hash() const {
-  __mutexScope(model()->lock());
-  ASSERT1(!expected_hash_.IsEmpty());
-  return expected_hash_;
-}
-
-uint64 Package::bytes_downloaded() const {
-  __mutexScope(model()->lock());
-  return bytes_downloaded_;
-}
-
-time64 Package::next_download_retry_time() const {
-  __mutexScope(model()->lock());
-  return next_download_retry_time_;
-}
-
-LONG Package::GetEstimatedRemainingDownloadTimeMs() const {
-  __mutexScope(model()->lock());
-
-  const LONG kUnknownRemainingTime = -1;
-
-  if (bytes_total_ == 0) {  // Don't know how many bytes to download.
-    return kUnknownRemainingTime;
-  }
-
-  if (bytes_total_ == bytes_downloaded_) {
-    return 0;
-  }
-
-  LONG time_remaining_ms = kUnknownRemainingTime;
-  int average_speed = progress_sampler_.GetAverageProgressPerMs();
-  if (average_speed == ProgressSampler<int>::kUnknownProgressPerMs) {
-    return kUnknownRemainingTime;
-  }
-
-  if (bytes_total_ >= bytes_downloaded_ && average_speed > 0) {
-    time_remaining_ms = static_cast<LONG>(
-        CeilingDivide(bytes_total_ - bytes_downloaded_, average_speed));
-  }
-
-  return time_remaining_ms;
-}
-
-STDMETHODIMP PackageWrapper::get(BSTR dir) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get(dir);
-}
-
-STDMETHODIMP PackageWrapper::get_isAvailable(VARIANT_BOOL* is_available) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_isAvailable(is_available);
-}
-
-STDMETHODIMP PackageWrapper::get_filename(BSTR* filename) {
-  __mutexScope(model()->lock());
-  return wrapped_obj()->get_filename(filename);
-}
-
-}  // namespace omaha
diff --git a/goopdate/package.h b/goopdate/package.h
deleted file mode 100644
index 151354f..0000000
--- a/goopdate/package.h
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Defines the Package COM object exposed by the model.
-
-// TODO(omaha3): Protect all public members with the model lock and assert in
-// all non-public members that the model has been locked by the caller.
-
-#ifndef OMAHA_GOOPDATE_PACKAGE_H_
-#define OMAHA_GOOPDATE_PACKAGE_H_
-
-#include <atlbase.h>
-#include <atlcom.h>
-#include "base/basictypes.h"
-#include "goopdate/omaha3_idl.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/time.h"
-#include "omaha/common/progress_sampler.h"
-#include "omaha/goopdate/com_wrapper_creator.h"
-#include "omaha/goopdate/model_object.h"
-// TODO(omaha): Consider implementing the NetworkRequestCallback portion in a
-// PImpl or similar pattern. As it is, every file that includes model.h also
-// becomes dependent on most of net/.
-#include "omaha/net/network_request.h"
-
-namespace omaha {
-
-class AppVersion;
-struct Lockable;
-
-class Package
-    : public ModelObject,
-      public NetworkRequestCallback {
- public:
-  explicit Package(AppVersion* parent_app_version);
-  virtual ~Package();
-
-  STDMETHOD(get)(BSTR dir) const;
-  STDMETHOD(get_isAvailable)(VARIANT_BOOL* is_available) const;
-  STDMETHOD(get_filename)(BSTR* filename) const;
-
-  // NetworkRequestCallback.
-  virtual void OnProgress(int bytes,
-                          int bytes_total,
-                          int status,
-                          const TCHAR* status_text);
-  virtual void OnRequestBegin();
-  virtual void OnRequestRetryScheduled(time64 next_download_retry_time);
-
-  void SetFileInfo(const CString& filename, uint64 size, const CString& hash);
-
-  // Returns the name of the file specified in the manifest.
-  CString filename() const;
-  // Returns the expected size of the file in bytes.
-  uint64 expected_size() const;
-  // Returns the expected SHA-1 hash of the file.
-  CString expected_hash() const;
-
-  uint64 bytes_downloaded() const;
-
-  time64 next_download_retry_time() const;
-
-  AppVersion* app_version();
-  const AppVersion* app_version() const;
-
-  LONG GetEstimatedRemainingDownloadTimeMs() const;
-
- private:
-  // Weak reference to the parent of the package.
-  AppVersion* app_version_;
-
-  // The name of the package as it appears in the manifest.
-  CString filename_;
-  uint64 expected_size_;
-  CString expected_hash_;
-
-  int bytes_downloaded_;
-  int bytes_total_;
-  time64 next_download_retry_time_;
-
-  ProgressSampler<int> progress_sampler_;
-
-  // True if the package is being downloaded.
-  // TODO(omaha): implement this.
-  bool is_downloading_;
-
-  DISALLOW_COPY_AND_ASSIGN(Package);
-};
-
-class ATL_NO_VTABLE PackageWrapper
-    : public ComWrapper<PackageWrapper, Package>,
-      public IDispatchImpl<IPackage,
-                           &__uuidof(IPackage),
-                           &CAtlModule::m_libid,
-                           kMajorTypeLibVersion,
-                           kMinorTypeLibVersion> {
- public:
-
-  // IPackage.
-  STDMETHOD(get)(BSTR dir);
-  STDMETHOD(get_isAvailable)(VARIANT_BOOL* is_available);
-  STDMETHOD(get_filename)(BSTR* filename);
-
- protected:
-  PackageWrapper() {}
-  virtual ~PackageWrapper() {}
-
-  BEGIN_COM_MAP(PackageWrapper)
-    COM_INTERFACE_ENTRY(IPackage)
-    COM_INTERFACE_ENTRY(IDispatch)
-  END_COM_MAP()
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_PACKAGE_H_
diff --git a/goopdate/package_cache.cc b/goopdate/package_cache.cc
deleted file mode 100644
index 0b178b1..0000000
--- a/goopdate/package_cache.cc
+++ /dev/null
@@ -1,494 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/package_cache.h"
-#include <shlwapi.h>
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/path.h"
-#include "omaha/base/string.h"
-#include "omaha/base/signatures.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/goopdate/package_cache_internal.h"
-#include "omaha/goopdate/worker_metrics.h"
-
-namespace omaha {
-
-namespace internal {
-
-bool PackageSortByTimePredicate(const PackageInfo& package1,
-                                const PackageInfo& package2) {
-  return ::CompareFileTime(&package1.file_time, &package2.file_time) > 0;
-}
-
-bool IsSpecialDirectoryFindData(const WIN32_FIND_DATA& find_data) {
-  return find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY &&
-         (String_StrNCmp(find_data.cFileName, _T("."), 2, false) == 0 ||
-          String_StrNCmp(find_data.cFileName, _T(".."), 3, false) == 0);
-}
-
-bool IsSubDirectoryFindData(const WIN32_FIND_DATA& find_data) {
-  return find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY &&
-         !IsSpecialDirectoryFindData(find_data);
-}
-
-bool IsFileFindData(const WIN32_FIND_DATA& find_data) {
-  return ((find_data.dwFileAttributes == FILE_ATTRIBUTE_NORMAL) ||
-          !(find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
-}
-
-HRESULT FindAllPackagesInfo(const CString& cache_root,
-                            std::vector<PackageInfo>* packages_info) {
-  ASSERT1(packages_info);
-  ASSERT1(packages_info->empty());
-  return FindDirectoryPackagesInfo(cache_root,
-                                   CACHE_DIRECTORY_ROOT,
-                                   packages_info);
-}
-
-HRESULT FindAppPackagesInfo(const CString& app_dir,
-                            std::vector<PackageInfo>* packages_info) {
-  return FindDirectoryPackagesInfo(app_dir, CACHE_DIRECTORY_APP, packages_info);
-}
-
-HRESULT FindVersionPackagesInfo(const CString& version_dir,
-                                std::vector<PackageInfo>* packages_info) {
-  return FindDirectoryPackagesInfo(version_dir,
-                                   CACHE_DIRECTORY_VERSION,
-                                   packages_info);
-}
-
-HRESULT FindFilePackagesInfo(const CString& version_dir,
-                             const WIN32_FIND_DATA& find_data,
-                             std::vector<PackageInfo>* packages_info) {
-  PackageInfo package_info;
-  package_info.file_name = ConcatenatePath(version_dir, find_data.cFileName);
-  package_info.file_time = ::CompareFileTime(&find_data.ftCreationTime,
-                                             &find_data.ftLastWriteTime) ?
-                               find_data.ftCreationTime :
-                               find_data.ftLastWriteTime;
-  package_info.file_size.LowPart = find_data.nFileSizeLow;
-  package_info.file_size.HighPart = find_data.nFileSizeHigh;
-  packages_info->push_back(package_info);
-
-  return S_OK;
-}
-
-HRESULT FindDirectoryPackagesInfo(const CString& dir_path,
-                                  CacheDirectoryType dir_type,
-                                  std::vector<PackageInfo>* packages_info) {
-  CORE_LOG(L4, (_T("[FindDirectoryPackagesInfo][%s][%d]"), dir_path, dir_type));
-
-  WIN32_FIND_DATA find_data = {0};
-  scoped_hfind hfind(::FindFirstFile(dir_path + _T("\\*"), &find_data));
-  if (!hfind) {
-    HRESULT hr = HRESULTFromLastError();
-    CORE_LOG(L4, (_T("[FindDirectoryPackagesInfo failed][0x%x]"), hr));
-    return hr;
-  }
-
-  HRESULT hr = S_OK;
-  do {
-    switch (dir_type) {
-      case CACHE_DIRECTORY_ROOT:
-        if (IsSubDirectoryFindData(find_data)) {
-          CString app_dir = ConcatenatePath(dir_path, find_data.cFileName);
-          hr = FindAppPackagesInfo(app_dir, packages_info);
-        }
-        break;
-      case CACHE_DIRECTORY_APP:
-        if (IsSubDirectoryFindData(find_data)) {
-          CString version_dir = ConcatenatePath(dir_path, find_data.cFileName);
-          hr = FindVersionPackagesInfo(version_dir, packages_info);
-        }
-        break;
-      case CACHE_DIRECTORY_VERSION:
-        if (IsFileFindData(find_data)) {
-          hr = FindFilePackagesInfo(dir_path, find_data, packages_info);
-        }
-        break;
-    }
-
-    if (FAILED(hr)) {
-      CORE_LOG(L4, (_T("[FindDirectoryPackagesInfo failed][0x%x]"), hr));
-      return hr;
-    }
-  } while (::FindNextFile(get(hfind), &find_data));
-
-  return S_OK;
-}
-
-void SortPackageInfoByTime(std::vector<PackageInfo>* packages_info) {
-  std::sort(packages_info->begin(),
-            packages_info->end(),
-            PackageSortByTimePredicate);
-}
-
-}  // namespace internal
-
-PackageCache::PackageCache() {
-  cache_time_limit_days_ =
-    ConfigManager::Instance()->GetPackageCacheExpirationTimeDays();
-
-  cache_size_limit_bytes_ = 1024 * 1024 * static_cast<uint64>(
-    ConfigManager::Instance()->GetPackageCacheSizeLimitMBytes());
-}
-
-PackageCache::~PackageCache() {
-}
-
-HRESULT PackageCache::Initialize(const CString& cache_root) {
-  CORE_LOG(L3, (_T("[PackageCache::Initialize][%s]"), cache_root));
-
-  __mutexScope(cache_lock_);
-
-  if (!IsAbsolutePath(cache_root)) {
-    return E_INVALIDARG;
-  }
-
-  HRESULT hr = CreateDir(cache_root, NULL);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[CreateDir failed][0x%x][%s]"), hr, cache_root));
-    return hr;
-  }
-
-  cache_root_ = cache_root;
-
-  return S_OK;
-}
-
-bool PackageCache::IsCached(const Key& key, const CString& hash) const {
-  CORE_LOG(L3, (_T("[PackageCache::IsCached][key '%s'][hash %s]"),
-                key.ToString(), hash));
-
-  __mutexScope(cache_lock_);
-
-  CString filename;
-  HRESULT hr = BuildCacheFileNameForKey(key, &filename);
-  if (FAILED(hr)) {
-    return false;
-  }
-
-  return File::Exists(filename) && SUCCEEDED(AuthenticateFile(filename, hash));
-}
-
-HRESULT PackageCache::Put(const Key& key,
-                          const CString& source_file,
-                          const CString& hash) {
-  ++metric_worker_package_cache_put_total;
-  CORE_LOG(L3, (_T("[PackageCache::Put][key '%s'][source_file '%s'][hash %s]"),
-                key.ToString(), source_file, hash));
-
-  __mutexScope(cache_lock_);
-
-  if (key.app_id().IsEmpty() || key.version().IsEmpty() ||
-      key.package_name().IsEmpty() ) {
-    return E_INVALIDARG;
-  }
-
-  CString destination_file;
-  HRESULT hr = BuildCacheFileNameForKey(key, &destination_file);
-  CORE_LOG(L3, (_T("[destination file '%s']"), destination_file));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = CreateDir(GetDirectoryFromPath(destination_file), NULL);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[failed to create cache directory][0x%08x][%s]"),
-                  hr, destination_file));
-    return hr;
-  }
-
-  // TODO(omaha): consider not overwriting the file if the file is
-  // in the cache and it is valid.
-
-  // When not impersonated, File::Copy resets the ownership of the destination
-  // file and it inherits ACEs from the new parent directory.
-  hr = File::Copy(source_file, destination_file, true);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[failed to copy file to cache][0x%08x][%s]"),
-                  hr, destination_file));
-    return hr;
-  }
-
-  hr = AuthenticateFile(destination_file, hash);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[failed to authenticate '%s'][%s]"),
-                  destination_file, hash));
-    VERIFY1(SUCCEEDED(::DeleteFile(destination_file)));
-    return hr;
-  }
-
-  ++metric_worker_package_cache_put_succeeded;
-  return S_OK;
-}
-
-HRESULT PackageCache::Get(const Key& key,
-                          const CString& destination_file,
-                          const CString& hash) const {
-  CORE_LOG(L3, (_T("[PackageCache::Get][key '%s'][dest file '%s'][hash '%s']"),
-                key.ToString(), destination_file, hash));
-
-  __mutexScope(cache_lock_);
-
-  if (key.app_id().IsEmpty() || key.version().IsEmpty() ||
-      key.package_name().IsEmpty() ) {
-    return E_INVALIDARG;
-  }
-
-  CString source_file;
-  HRESULT hr = BuildCacheFileNameForKey(key, &source_file);
-  CORE_LOG(L3, (_T("[source file '%s']"), source_file));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (!File::Exists(source_file)) {
-    return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
-  }
-
-  hr = AuthenticateFile(source_file, hash);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[failed to authenticate '%s']"), source_file));
-    return hr;
-  }
-
-  return File::Copy(source_file, destination_file, true);
-}
-
-HRESULT PackageCache::Purge(const Key& key) {
-  CORE_LOG(L3, (_T("[PackageCache::Purge][key '%s']"), key.ToString()));
-
-  __mutexScope(cache_lock_);
-
-  return Delete(key.app_id(), key.version(), key.package_name());
-}
-
-HRESULT PackageCache::PurgeVersion(const CString& app_id,
-                                   const CString& version) {
-  CORE_LOG(L3, (_T("[PackageCache::PurgeVersion][app_id '%s'][version '%s']"),
-                app_id, version));
-
-  __mutexScope(cache_lock_);
-
-  return Delete(app_id, version, _T(""));
-}
-
-HRESULT PackageCache::PurgeApp(const CString& app_id) {
-  CORE_LOG(L3, (_T("[PackageCache::PurgeApp][app_id '%s']"), app_id));
-
-  __mutexScope(cache_lock_);
-
-  return Delete(app_id, _T(""), _T(""));
-}
-
-HRESULT PackageCache::PurgeAppLowerVersions(const CString& app_id,
-                                            const CString& version) {
-  CORE_LOG(L3, (_T("[PackageCache::PurgeAppLowerVersions][%s][%s]"),
-                app_id, version));
-
-  __mutexScope(cache_lock_);
-
-  ULONGLONG my_version = VersionFromString(version);
-  if (!my_version) {
-    return E_INVALIDARG;
-  }
-
-  CString app_id_path;
-  HRESULT hr = BuildCacheFileName(app_id, CString(), CString(), &app_id_path);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[BuildCacheFileName fail][%s][0x%x]"), app_id_path, hr));
-    return hr;
-  }
-
-  WIN32_FIND_DATA find_data = {0};
-  scoped_hfind hfind(::FindFirstFile(app_id_path + _T("\\*"), &find_data));
-  if (!hfind) {
-    HRESULT hr = HRESULTFromLastError();
-    CORE_LOG(L4, (_T("[FindFirstFile failed][%s][0x%x]"), app_id_path, hr));
-    return hr;
-  }
-
-  do {
-    if (internal::IsSpecialDirectoryFindData(find_data)) {
-      continue;
-    }
-    ASSERT1(internal::IsSubDirectoryFindData(find_data));
-
-    ULONGLONG found_version = VersionFromString(find_data.cFileName);
-    if (!found_version || found_version >= my_version) {
-      CORE_LOG(L2, (_T("[Not purging version][%s]"), find_data.cFileName));
-      continue;
-    }
-
-    CString version_dir = ConcatenatePath(app_id_path, find_data.cFileName);
-    hr = DeleteBeforeOrAfterReboot(version_dir);
-    CORE_LOG(L3, (_T("[Purge version][%s][0x%x]"), version_dir, hr));
-  } while (::FindNextFile(get(hfind), &find_data));
-
-  return S_OK;
-}
-
-HRESULT PackageCache::PurgeAll() {
-  CORE_LOG(L3, (_T("[PackageCache::PurgeAll]")));
-
-  __mutexScope(cache_lock_);
-
-  // Deletes the cache root including all the cache entries.
-  HRESULT hr = Delete(_T(""), _T(""), _T(""));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Recreate the cache root.
-  hr = CreateDir(cache_root_, NULL);
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[CreateDir failed][0x%x][%s]"), hr, cache_root_));
-    return hr;
-  }
-
-  return hr;
-}
-
-FILETIME PackageCache::GetCacheExpirationTime() const {
-  FILETIME current_time = {0};
-  ::GetSystemTimeAsFileTime(&current_time);
-  ULARGE_INTEGER now = {0};
-  now.LowPart = current_time.dwLowDateTime;
-  now.HighPart = current_time.dwHighDateTime;
-
-  const uint64 kNum100NanoSecondsInDay = 1000LL * 1000 * 10 * kSecondsPerDay;
-  now.QuadPart -= kNum100NanoSecondsInDay * cache_time_limit_days_;
-
-  FILETIME expiration_time = {0};
-  expiration_time.dwLowDateTime = now.LowPart;
-  expiration_time.dwHighDateTime = now.HighPart;
-
-  return expiration_time;
-}
-
-HRESULT PackageCache::PurgeOldPackagesIfNecessary() const {
-  __mutexScope(cache_lock_);
-
-  std::vector<internal::PackageInfo> packages_info;
-  HRESULT hr = internal::FindAllPackagesInfo(cache_root_, &packages_info);
-
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[internal::FindAllPackagesInfo failed][0x%x]"), hr));
-    return hr;
-  }
-  internal::SortPackageInfoByTime(&packages_info);
-
-  FILETIME expiration_time = GetCacheExpirationTime();
-
-  // Delete cached package based on the package info.
-  std::vector<internal::PackageInfo>::const_iterator it;
-  uint64 total_cache_size = 0;
-  for (it = packages_info.begin(); it != packages_info.end(); ++it) {
-    total_cache_size += it->file_size.QuadPart;
-    if (total_cache_size > cache_size_limit_bytes_) {
-      break;  // Remaining packages should be deleted as size limit is reached.
-    }
-    if (::CompareFileTime(&it->file_time, &expiration_time) < 0) {
-      break;  // Remaining packages should be deleted as they are expired.
-    }
-  }
-
-  for (; it != packages_info.end(); ++it) {
-    hr = DeleteBeforeOrAfterReboot(it->file_name);
-  }
-
-  return hr;
-}
-
-HRESULT PackageCache::Delete(const CString& app_id,
-                             const CString& version,
-                             const CString& package_name) {
-  CString filename;
-  HRESULT hr = BuildCacheFileName(app_id, version, package_name, &filename);
-  CORE_LOG(L3, (_T("[PackageCache::Delete '%s']"), filename));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return DeleteBeforeOrAfterReboot(filename);
-}
-
-CString PackageCache::cache_root() const {
-  __mutexScope(cache_lock_);
-
-  ASSERT1(!cache_root_.IsEmpty());
-  ASSERT1(File::Exists(cache_root_));
-
-  return cache_root_;
-}
-
-uint64 PackageCache::Size() const {
-  uint64 result(0);
-  return SUCCEEDED(GetDirectorySize(cache_root_, &result)) ? result : 0;
-}
-
-HRESULT PackageCache::BuildCacheFileNameForKey(const Key& key,
-                                               CString* filename) const {
-  ASSERT1(filename);
-
-  return BuildCacheFileName(key.app_id(),
-                            key.version(),
-                            key.package_name(),
-                            filename);
-}
-
-HRESULT PackageCache::BuildCacheFileName(const CString& app_id,
-                                         const CString& version,
-                                         const CString& package_name,
-                                         CString* filename) const {
-  ASSERT1(filename);
-
-  // Validate the package name does not contain the "..".
-  if (package_name.Find(_T("..")) != -1) {
-    return E_INVALIDARG;
-  }
-
-  CString tmp_filename;
-  tmp_filename = ConcatenatePath(cache_root_, app_id);
-  tmp_filename = ConcatenatePath(tmp_filename, version);
-  tmp_filename = ConcatenatePath(tmp_filename, package_name);
-
-  *filename = tmp_filename;
-
-  return S_OK;
-}
-
-HRESULT PackageCache::AuthenticateFile(const CString& filename,
-                                       const CString& hash) {
-  CORE_LOG(L3, (_T("[PackageCache::AuthenticateFile][%s][%s]"),
-                filename, hash));
-  HighresTimer authentication_timer;
-
-  std::vector<CString> files;
-  files.push_back(filename);
-  HRESULT hr = AuthenticateFiles(files, hash);
-  CORE_LOG(L3, (_T("[PackageCache::AuthenticateFile completed][0x%08x][%d ms]"),
-                hr, authentication_timer.GetElapsedMs()));
-
-  return hr;
-}
-
-}  // namespace omaha
-
diff --git a/goopdate/package_cache.h b/goopdate/package_cache.h
deleted file mode 100644
index 9215e65..0000000
--- a/goopdate/package_cache.h
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_PACKAGE_CACHE_H_
-#define OMAHA_GOOPDATE_PACKAGE_CACHE_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/synchronized.h"
-
-namespace omaha {
-
-class PackageCache {
- public:
-
-  // Defines the key that uniquely identifies the packages in the cache.
-  // The key uses a default version value in the case the application does
-  // not provide a version string.
-  class Key {
-   public:
-    Key(const CString& app_id,
-        const CString& version,
-        const CString& package_name)
-        : app_id_(app_id),
-          version_(version.IsEmpty() ? _T("0.0.0.0") : version),
-          package_name_(package_name) {}
-
-    CString app_id() const { return app_id_; }
-    CString version() const { return version_; }
-    CString package_name() const { return package_name_; }
-
-    CString ToString() const {
-      CString result;
-      result.Format(_T("appid=%s; version=%s; package_name=%s"),
-                    app_id_, version_, package_name_);
-      return result;
-    }
-
-   private:
-    const CString app_id_;
-    const CString version_;
-    const CString package_name_;
-
-    DISALLOW_COPY_AND_ASSIGN(Key);
-  };
-
-  PackageCache();
-  ~PackageCache();
-
-  HRESULT Initialize(const CString& cache_root);
-
-  HRESULT Put(const Key& key,
-              const CString& source_file,
-              const CString& hash);
-
-  HRESULT Get(const Key& key,
-              const CString& destination_file,
-              const CString& hash) const;
-
-  bool IsCached(const Key& key, const CString& hash) const;
-
-  HRESULT Purge(const Key& key);
-
-  HRESULT PurgeVersion(const CString& app_id, const CString& version);
-
-  HRESULT PurgeApp(const CString& app_id);
-
-  // Purges version directories lower than a 'version' of the form 1.2.3.4. If
-  // the version format is not recognized, returns E_INVALIDARG.
-  HRESULT PurgeAppLowerVersions(const CString& app_id, const CString& version);
-
-  HRESULT PurgeAll();
-
-  // Purges expired packages and keeps total cache size below the limit by
-  // purging oldest ones.
-  HRESULT PurgeOldPackagesIfNecessary() const;
-
-  // Returns the total size of all files in the cache. Returns 0 if the size
-  // cannot be determined or the cache is empty.
-  uint64 Size() const;
-
-  CString cache_root() const;
-
-  static HRESULT AuthenticateFile(const CString& filename,
-                                  const CString& hash);
-
- private:
-  friend class PackageCacheTest;
-
-  HRESULT BuildCacheFileNameForKey(const Key& key, CString* filename) const;
-  HRESULT BuildCacheFileName(const CString& app_id,
-                             const CString& version,
-                             const CString& package_name,
-                             CString* filename) const;
-
-  // Deletes the cache entries that match the app_id, version, and package_name.
-  // If the parameters are empty, the function deletes the packages of versions
-  // of apps, respectively.
-  HRESULT Delete(const CString& app_id,
-                 const CString& version,
-                 const CString& package_name);
-
-  // Returns the cache expiration time. All files in the cache before that time
-  // are considered as expired and should be purged.
-  FILETIME GetCacheExpirationTime() const;
-
-  // The cache duration, specified as a count of days.  (This is converted to
-  // an absolute time by GetCacheExpirationTime().)
-  int cache_time_limit_days_;
-
-  // The maximum allowed cache size, in bytes. If the cache grows over this
-  // size, files will be purged using a least-recently-added metric.
-  uint64 cache_size_limit_bytes_;
-
-  CString cache_root_;
-
-  LLock cache_lock_;
-
-  DISALLOW_COPY_AND_ASSIGN(PackageCache);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_PACKAGE_CACHE_H_
-
diff --git a/goopdate/package_cache_internal.h b/goopdate/package_cache_internal.h
deleted file mode 100644
index e116e30..0000000
--- a/goopdate/package_cache_internal.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_PACKAGE_CACHE_INTERNAL_H_
-#define OMAHA_GOOPDATE_PACKAGE_CACHE_INTERNAL_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/synchronized.h"
-
-namespace omaha {
-
-namespace internal {
-
-enum CacheDirectoryType {
-  CACHE_DIRECTORY_ROOT,
-  CACHE_DIRECTORY_APP,
-  CACHE_DIRECTORY_VERSION,
-};
-
-struct PackageInfo {
-  PackageInfo() {
-    file_time.dwLowDateTime = 0;
-    file_time.dwHighDateTime = 0;
-    file_size.QuadPart = 0;
-  }
-
-  CString file_name;
-  FILETIME file_time;
-  ULARGE_INTEGER file_size;
-};
-
-// TODO(omaha): add tests for some of the functions below.
-bool PackageSortByTimePredicate(const PackageInfo& package1,
-                                const PackageInfo& package2);
-
-bool IsSpecialDirectoryFindData(const WIN32_FIND_DATA& find_data);
-
-bool IsSubDirectoryFindData(const WIN32_FIND_DATA& find_data);
-
-bool IsFileFindData(const WIN32_FIND_DATA& find_data);
-
-HRESULT FindDirectoryPackagesInfo(const CString& dir_path,
-                                  CacheDirectoryType dir_type,
-                                  std::vector<PackageInfo>* packages_info);
-
-HRESULT FindAllPackagesInfo(const CString& cache_root,
-                            std::vector<PackageInfo>* packages_info);
-
-HRESULT FindAppPackagesInfo(const CString& app_dir,
-                            std::vector<PackageInfo>* packages_info);
-
-HRESULT FindVersionPackagesInfo(const CString& version_dir,
-                                std::vector<PackageInfo>* packages_info);
-
-HRESULT FindFilePackagesInfo(const CString& version_dir,
-                             const WIN32_FIND_DATA& find_data,
-                             std::vector<PackageInfo>* packages_info);
-
-HRESULT FindDirectoryPackagesInfo(const CString& dir_path,
-                                  CacheDirectoryType dir_type,
-                                  std::vector<PackageInfo>* packages_info);
-
-void SortPackageInfoByTime(std::vector<PackageInfo>* packages_info);
-
-}  // namespace internal
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_PACKAGE_CACHE_INTERNAL_H_
-
diff --git a/goopdate/package_cache_unittest.cc b/goopdate/package_cache_unittest.cc
deleted file mode 100644
index 640c490..0000000
--- a/goopdate/package_cache_unittest.cc
+++ /dev/null
@@ -1,520 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/app_util.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/path.h"
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-#include "omaha/goopdate/package_cache.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-class PackageCacheTest : public testing::Test {
- protected:
-  typedef PackageCache::Key Key;
-
-  PackageCacheTest()
-      : cache_root_(GetUniqueTempDirectoryName()),
-      size_file1_(0),
-      size_file2_(0) {
-    EXPECT_FALSE(cache_root_.IsEmpty());
-
-    CString executable_path(app_util::GetCurrentModuleDirectory());
-
-    source_file1_ = ConcatenatePath(
-        executable_path,
-        _T("unittest_support\\download_cache_test\\")
-        _T("{89640431-FE64-4da8-9860-1A1085A60E13}\\gears-win32-opt.msi"));
-
-    hash_file1_ = _T("ImV9skETZqGFMjs32vbZTvzAYJU=");
-
-    size_file1_ = 870400;
-
-    source_file2_ = ConcatenatePath(
-        executable_path,
-        _T("unittest_support\\download_cache_test\\")
-        _T("{7101D597-3481-4971-AD23-455542964072}\\livelysetup.exe"));
-
-    hash_file2_ = _T("Igq6bYaeXFJCjH770knXyJ6V53s=");
-
-    size_file2_ = 479848;
-
-    EXPECT_TRUE(File::Exists(source_file1_));
-    EXPECT_TRUE(File::Exists(source_file2_));
-  }
-
-  virtual void SetUp() {
-    EXPECT_FALSE(String_EndsWith(cache_root_, _T("\\"), true));
-    EXPECT_HRESULT_SUCCEEDED(package_cache_.Initialize(cache_root_));
-    EXPECT_HRESULT_SUCCEEDED(package_cache_.PurgeAll());
-  }
-
-  virtual void TearDown() {
-    EXPECT_HRESULT_SUCCEEDED(DeleteDirectory(cache_root_));
-  }
-
-  HRESULT BuildCacheFileNameForKey(const Key& key, CString* filename) const {
-    return package_cache_.BuildCacheFileNameForKey(key, filename);
-  }
-
-  HRESULT ExpireCache(const Key& key) {
-    FILETIME expiration_time = package_cache_.GetCacheExpirationTime();
-
-    CString cached_file_name;
-    EXPECT_HRESULT_SUCCEEDED(BuildCacheFileNameForKey(key, &cached_file_name));
-
-    // Change file time a little big earlier than the expiration time.
-    ULARGE_INTEGER file_time = {0};
-    file_time.LowPart = expiration_time.dwLowDateTime;
-    file_time.HighPart = expiration_time.dwHighDateTime;
-    file_time.QuadPart -= 1;
-
-    expiration_time.dwLowDateTime = file_time.LowPart;
-    expiration_time.dwHighDateTime = file_time.HighPart;
-
-    return File::SetFileTime(cached_file_name,
-                             &expiration_time,
-                             &expiration_time,
-                             &expiration_time);
-  }
-
-  void SetCacheSizeLimitMB(int limit_mb) {
-    package_cache_.cache_size_limit_bytes_ = 1024 * 1024 *
-      static_cast<uint64>(limit_mb);
-  }
-
-  void SetCacheTimeLimitDays(int limit_days) {
-    package_cache_.cache_time_limit_days_ = limit_days;
-  }
-
-  const CString cache_root_;
-  CString source_file1_;
-  CString hash_file1_;
-  uint64  size_file1_;
-
-  CString source_file2_;
-  CString hash_file2_;
-  uint64  size_file2_;
-
-  PackageCache package_cache_;
-};
-
-// Tests the members of key when the constructor arguments are empty strings.
-TEST_F(PackageCacheTest, DefaultVersion) {
-  Key key(_T(""), _T(""), _T(""));
-  EXPECT_STREQ(_T(""), key.app_id());
-  EXPECT_STREQ(_T("0.0.0.0"), key.version());
-  EXPECT_STREQ(_T(""), key.package_name());
-}
-
-TEST_F(PackageCacheTest, Initialize) {
-  EXPECT_FALSE(package_cache_.cache_root().IsEmpty());
-  EXPECT_STREQ(cache_root_, package_cache_.cache_root());
-  EXPECT_EQ(0, package_cache_.Size());
-}
-
-TEST_F(PackageCacheTest, InitializeErrors) {
-  PackageCache package_cache;
-  EXPECT_EQ(E_INVALIDARG, package_cache.Initialize(NULL));
-  EXPECT_EQ(E_INVALIDARG, package_cache.Initialize(_T("")));
-  EXPECT_EQ(E_INVALIDARG, package_cache.Initialize(_T("foo")));
-}
-
-TEST_F(PackageCacheTest, BuildCacheFileName) {
-  CString actual;
-  EXPECT_HRESULT_SUCCEEDED(
-      BuildCacheFileNameForKey(Key(_T("1"), _T("2"), _T("3")), &actual));
-  CString expected = cache_root_ + _T("\\1\\2\\3");
-  EXPECT_STREQ(expected, actual);
-
-  EXPECT_HRESULT_SUCCEEDED(
-      BuildCacheFileNameForKey(Key(_T("1"), _T("2"), _T("3\\4")), &actual));
-  expected = cache_root_ + _T("\\1\\2\\3\\4");
-  EXPECT_STREQ(expected, actual);
-
-  EXPECT_EQ(E_INVALIDARG,
-            BuildCacheFileNameForKey(Key(_T("1"), _T("2"), _T("..\\3")),
-                                     &actual));
-}
-
-// Tests Put, Get, IsCached, and Purge calls.
-TEST_F(PackageCacheTest, BasicTest) {
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.PurgeAll());
-
-  Key key1(_T("app1"), _T("ver1"), _T("package1"));
-
-  // Check the file is not in the cache.
-  EXPECT_FALSE(package_cache_.IsCached(key1, hash_file1_));
-
-  // Cache one file.
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Put(key1,
-                                              source_file1_,
-                                              hash_file1_));
-  EXPECT_EQ(size_file1_, package_cache_.Size());
-
-  // Check the file is in the cache.
-  EXPECT_TRUE(package_cache_.IsCached(key1, hash_file1_));
-
-  // Check the source file is not deleted after caching it.
-  EXPECT_TRUE(File::Exists(source_file1_));
-
-  // Get the package from the cache into a temporary file.
-  CString destination_file;
-  EXPECT_TRUE(::GetTempFileName(app_util::GetTempDir(), _T(""), 0,
-                                CStrBuf(destination_file, MAX_PATH)));
-
-  // Get the file two times.
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Get(key1,
-                                              destination_file,
-                                              hash_file1_));
-  EXPECT_TRUE(File::Exists(destination_file));
-  EXPECT_HRESULT_SUCCEEDED(PackageCache::AuthenticateFile(destination_file,
-                                                          hash_file1_));
-
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Get(key1,
-                                              destination_file,
-                                              hash_file1_));
-  EXPECT_TRUE(File::Exists(destination_file));
-  EXPECT_HRESULT_SUCCEEDED(PackageCache::AuthenticateFile(destination_file,
-                                                          hash_file1_));
-
-  EXPECT_TRUE(::DeleteFile(destination_file));
-
-  // Cache another file.
-  Key key2(_T("app2"), _T("ver2"), _T("package2"));
-
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Put(key2,
-                                              source_file2_,
-                                              hash_file2_));
-  EXPECT_EQ(size_file1_ + size_file2_, package_cache_.Size());
-  EXPECT_TRUE(package_cache_.IsCached(key2, hash_file2_));
-
-  // Cache the same file again. It should be idempotent.
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Put(key2,
-                                              source_file2_,
-                                              hash_file2_));
-  EXPECT_EQ(size_file1_ + size_file2_, package_cache_.Size());
-
-  EXPECT_TRUE(package_cache_.IsCached(key2, hash_file2_));
-  EXPECT_TRUE(File::Exists(source_file2_));
-
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Purge(key1));
-  EXPECT_FALSE(package_cache_.IsCached(key1, hash_file1_));
-  EXPECT_EQ(size_file2_, package_cache_.Size());
-
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Purge(key2));
-  EXPECT_FALSE(package_cache_.IsCached(key2, hash_file2_));
-  EXPECT_EQ(0, package_cache_.Size());
-
-  // Try getting a purged files.
-  EXPECT_HRESULT_FAILED(package_cache_.Get(key1,
-                                           destination_file,
-                                           hash_file1_));
-  EXPECT_FALSE(File::Exists(destination_file));
-
-  EXPECT_HRESULT_FAILED(package_cache_.Get(key2,
-                                           destination_file,
-                                           hash_file2_));
-  EXPECT_FALSE(File::Exists(destination_file));
-}
-
-TEST_F(PackageCacheTest, PutBadHashTest) {
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.PurgeAll());
-
-  Key key1(_T("app1"), _T("ver1"), _T("package1"));
-
-  // Check the file is not in the cache.
-  EXPECT_FALSE(package_cache_.IsCached(key1, hash_file1_));
-
-  // Try caching one file when the hash is not correct.
-  const CString bad_hash = _T("JmV9skETZqGFMjs32vbZTvzAYJU=");
-  EXPECT_EQ(SIGS_E_INVALID_SIGNATURE, package_cache_.Put(key1,
-                                                         source_file1_,
-                                                         bad_hash));
-  // Check the file is not the cache.
-  EXPECT_FALSE(package_cache_.IsCached(key1, hash_file1_));
-}
-
-// The key must include the app id, version, and package name for Put and Get
-// operations. If the version is not provided, "0.0.0.0" is used internally.
-TEST_F(PackageCacheTest, BadKeyTest) {
-  Key key_empty_app(_T(""), _T("b"), _T("c"));
-  Key key_empty_name(_T("a"), _T("b"), _T(""));
-
-  EXPECT_EQ(E_INVALIDARG, package_cache_.Get(key_empty_app, _T("a"), _T("b")));
-  EXPECT_EQ(E_INVALIDARG, package_cache_.Get(key_empty_name, _T("a"), _T("b")));
-
-  EXPECT_EQ(E_INVALIDARG, package_cache_.Put(key_empty_app, _T("a"), _T("b")));
-  EXPECT_EQ(E_INVALIDARG, package_cache_.Put(key_empty_name, _T("a"), _T("b")));
-}
-
-TEST_F(PackageCacheTest, PurgeVersionTest) {
-  // Cache two files for two versions of the same app.
-  Key key11(_T("app1"), _T("ver1"), _T("package1"));
-  Key key12(_T("app1"), _T("ver1"), _T("package2"));
-  Key key21(_T("app1"), _T("ver2"), _T("package1"));
-  Key key22(_T("app1"), _T("ver2"), _T("package2"));
-
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Put(key11,
-                                              source_file1_,
-                                              hash_file1_));
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Put(key12,
-                                              source_file2_,
-                                              hash_file2_));
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Put(key21,
-                                              source_file1_,
-                                              hash_file1_));
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Put(key22,
-                                              source_file2_,
-                                              hash_file2_));
-
-  EXPECT_TRUE(package_cache_.IsCached(key11, hash_file1_));
-  EXPECT_TRUE(package_cache_.IsCached(key12, hash_file2_));
-  EXPECT_TRUE(package_cache_.IsCached(key21, hash_file1_));
-  EXPECT_TRUE(package_cache_.IsCached(key22, hash_file2_));
-
-  EXPECT_EQ(2 * (size_file1_ + size_file2_), package_cache_.Size());
-
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.PurgeVersion(_T("app1"), _T("ver1")));
-
-  EXPECT_FALSE(package_cache_.IsCached(key11, hash_file1_));
-  EXPECT_FALSE(package_cache_.IsCached(key12, hash_file2_));
-  EXPECT_TRUE(package_cache_.IsCached(key21, hash_file1_));
-  EXPECT_TRUE(package_cache_.IsCached(key22, hash_file2_));
-
-  EXPECT_EQ(size_file1_ + size_file2_, package_cache_.Size());
-
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.PurgeVersion(_T("app1"), _T("ver2")));
-
-  EXPECT_FALSE(package_cache_.IsCached(key11, hash_file1_));
-  EXPECT_FALSE(package_cache_.IsCached(key12, hash_file2_));
-  EXPECT_FALSE(package_cache_.IsCached(key21, hash_file1_));
-  EXPECT_FALSE(package_cache_.IsCached(key22, hash_file2_));
-
-  EXPECT_EQ(0, package_cache_.Size());
-}
-
-TEST_F(PackageCacheTest, PurgeAppTest) {
-  // Cache two files for two apps.
-  Key key11(_T("app1"), _T("ver1"), _T("package1"));
-  Key key12(_T("app1"), _T("ver1"), _T("package2"));
-  Key key21(_T("app2"), _T("ver2"), _T("package1"));
-  Key key22(_T("app2"), _T("ver2"), _T("package2"));
-
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Put(key11,
-                                              source_file1_,
-                                              hash_file1_));
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Put(key12,
-                                              source_file2_,
-                                              hash_file2_));
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Put(key21,
-                                              source_file1_,
-                                              hash_file1_));
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Put(key22,
-                                              source_file2_,
-                                              hash_file2_));
-
-  EXPECT_TRUE(package_cache_.IsCached(key11, hash_file1_));
-  EXPECT_TRUE(package_cache_.IsCached(key12, hash_file2_));
-  EXPECT_TRUE(package_cache_.IsCached(key21, hash_file1_));
-  EXPECT_TRUE(package_cache_.IsCached(key22, hash_file2_));
-
-  EXPECT_EQ(2 * (size_file1_ + size_file2_), package_cache_.Size());
-
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.PurgeApp(_T("app1")));
-
-  EXPECT_FALSE(package_cache_.IsCached(key11, hash_file1_));
-  EXPECT_FALSE(package_cache_.IsCached(key12, hash_file2_));
-  EXPECT_TRUE(package_cache_.IsCached(key21, hash_file1_));
-  EXPECT_TRUE(package_cache_.IsCached(key22, hash_file2_));
-
-  EXPECT_EQ(size_file1_ + size_file2_, package_cache_.Size());
-
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.PurgeApp(_T("app2")));
-
-  EXPECT_FALSE(package_cache_.IsCached(key11, hash_file1_));
-  EXPECT_FALSE(package_cache_.IsCached(key12, hash_file2_));
-  EXPECT_FALSE(package_cache_.IsCached(key21, hash_file1_));
-  EXPECT_FALSE(package_cache_.IsCached(key22, hash_file2_));
-
-  EXPECT_EQ(0, package_cache_.Size());
-}
-
-TEST_F(PackageCacheTest, PurgeAppLowerVersionsTest) {
-  EXPECT_EQ(E_INVALIDARG, package_cache_.PurgeAppLowerVersions(_T("app1"),
-                                                               _T("1")));
-
-  Key key_10_1(_T("app1"), _T("1.0.0.0"), _T("package1"));
-  Key key_10_2(_T("app1"), _T("1.0.0.0"), _T("package2"));
-  Key key_11_1(_T("app1"), _T("1.1.0.0"), _T("package1"));
-  Key key_21_2(_T("app1"), _T("2.1.0.0"), _T("package2"));
-
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Put(key_10_1,
-                                              source_file1_,
-                                              hash_file1_));
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Put(key_10_2,
-                                              source_file2_,
-                                              hash_file2_));
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Put(key_11_1,
-                                              source_file1_,
-                                              hash_file1_));
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Put(key_21_2,
-                                              source_file2_,
-                                              hash_file2_));
-
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.PurgeAppLowerVersions(_T("app1"),
-                                                                _T("1.0.0.0")));
-  EXPECT_TRUE(package_cache_.IsCached(key_10_1, hash_file1_));
-  EXPECT_TRUE(package_cache_.IsCached(key_10_2, hash_file2_));
-  EXPECT_TRUE(package_cache_.IsCached(key_11_1, hash_file1_));
-  EXPECT_TRUE(package_cache_.IsCached(key_21_2, hash_file2_));
-
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.PurgeAppLowerVersions(_T("app1"),
-                                                                _T("1.1.0.0")));
-  EXPECT_FALSE(package_cache_.IsCached(key_10_1, hash_file1_));
-  EXPECT_FALSE(package_cache_.IsCached(key_10_2, hash_file2_));
-  EXPECT_TRUE(package_cache_.IsCached(key_11_1, hash_file1_));
-  EXPECT_TRUE(package_cache_.IsCached(key_21_2, hash_file2_));
-
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.PurgeAppLowerVersions(_T("app1"),
-                                                                _T("2.1.0.0")));
-  EXPECT_FALSE(package_cache_.IsCached(key_11_1, hash_file1_));
-  EXPECT_TRUE(package_cache_.IsCached(key_21_2, hash_file2_));
-
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.PurgeAppLowerVersions(_T("app1"),
-                                                                _T("2.2.0.0")));
-  EXPECT_FALSE(package_cache_.IsCached(key_21_2, hash_file2_));
-
-  EXPECT_EQ(0, package_cache_.Size());
-}
-
-TEST_F(PackageCacheTest, PurgeAll) {
-  // Cache two files for two apps.
-  Key key11(_T("app1"), _T("ver1"), _T("package1"));
-  Key key12(_T("app1"), _T("ver1"), _T("package2"));
-  Key key21(_T("app2"), _T("ver2"), _T("package1"));
-  Key key22(_T("app2"), _T("ver2"), _T("package2"));
-
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Put(key11,
-                                              source_file1_,
-                                              hash_file1_));
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Put(key12,
-                                              source_file2_,
-                                              hash_file2_));
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Put(key21,
-                                              source_file1_,
-                                              hash_file1_));
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Put(key22,
-                                              source_file2_,
-                                              hash_file2_));
-
-  EXPECT_TRUE(package_cache_.IsCached(key11, hash_file1_));
-  EXPECT_TRUE(package_cache_.IsCached(key12, hash_file2_));
-  EXPECT_TRUE(package_cache_.IsCached(key21, hash_file1_));
-  EXPECT_TRUE(package_cache_.IsCached(key22, hash_file2_));
-
-  EXPECT_EQ(2 * (size_file1_ + size_file2_), package_cache_.Size());
-
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.PurgeAll());
-
-  EXPECT_FALSE(package_cache_.IsCached(key11, hash_file1_));
-  EXPECT_FALSE(package_cache_.IsCached(key12, hash_file2_));
-  EXPECT_FALSE(package_cache_.IsCached(key21, hash_file1_));
-  EXPECT_FALSE(package_cache_.IsCached(key22, hash_file2_));
-
-  EXPECT_EQ(0, package_cache_.Size());
-}
-
-TEST_F(PackageCacheTest, PurgeOldPackagesIfOverSizeLimit) {
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.PurgeAll());
-
-  const int kCacheSizeLimitMB = 2;
-  SetCacheSizeLimitMB(kCacheSizeLimitMB);
-
-  const uint64 kSizeLimitBytes = 1024LL * 1024 * kCacheSizeLimitMB;
-
-  Key key0(_T("app0"), _T("version0"), _T("package0"));
-
-  // Keep adding packages until we exceed cache limit.
-  uint64 current_size = 0;
-  int i = 0;
-  while (current_size <= kSizeLimitBytes) {
-    CString app;
-    CString version;
-    CString package;
-    app.Format(_T("app%d"), i);
-    version.Format(_T("version%d"), i);
-    package.Format(_T("package%d"), i);
-    EXPECT_HRESULT_SUCCEEDED(package_cache_.Put(Key(app, version, package),
-                                                source_file1_,
-                                                hash_file1_));
-    current_size += size_file1_;
-    EXPECT_EQ(current_size, package_cache_.Size());
-    ++i;
-  }
-
-  // Verify that cache size limit is exceeded.
-  EXPECT_GT(package_cache_.Size(), kSizeLimitBytes);
-  EXPECT_TRUE(package_cache_.IsCached(key0, hash_file1_));
-
-  package_cache_.PurgeOldPackagesIfNecessary();
-
-  // Verify that the oldes package is purged and the cache size is below limit.
-  EXPECT_FALSE(package_cache_.IsCached(key0, hash_file1_));
-  EXPECT_LE(package_cache_.Size(), kSizeLimitBytes);
-}
-
-TEST_F(PackageCacheTest, PurgeExpiredCacheFiles) {
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.PurgeAll());
-
-  const int kCacheLifeLimitDays = 100;
-  SetCacheTimeLimitDays(kCacheLifeLimitDays);
-
-  Key key1(_T("app1"), _T("version1"), _T("package1"));
-  Key key2(_T("app2"), _T("version2"), _T("package2"));
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Put(key1,
-                                              source_file1_,
-                                              hash_file1_));
-  EXPECT_HRESULT_SUCCEEDED(package_cache_.Put(key2,
-                                              source_file2_,
-                                              hash_file2_));
-  EXPECT_TRUE(package_cache_.IsCached(key1, hash_file1_));
-  EXPECT_TRUE(package_cache_.IsCached(key2, hash_file2_));
-
-  // Expires one package and verifies it is purged.
-  EXPECT_HRESULT_SUCCEEDED(ExpireCache(key1));
-  package_cache_.PurgeOldPackagesIfNecessary();
-  EXPECT_FALSE(package_cache_.IsCached(key1, hash_file1_));
-  EXPECT_TRUE(package_cache_.IsCached(key2, hash_file2_));
-
-  // Expires another package and verifies it is purged.
-  EXPECT_HRESULT_SUCCEEDED(ExpireCache(key2));
-  package_cache_.PurgeOldPackagesIfNecessary();
-  EXPECT_FALSE(package_cache_.IsCached(key1, hash_file1_));
-  EXPECT_FALSE(package_cache_.IsCached(key2, hash_file2_));
-}
-
-TEST_F(PackageCacheTest, AuthenticateFile) {
-  EXPECT_HRESULT_SUCCEEDED(PackageCache::AuthenticateFile(source_file1_,
-                                                          hash_file1_));
-  EXPECT_EQ(SIGS_E_INVALID_SIGNATURE,
-            PackageCache::AuthenticateFile(source_file1_, hash_file2_));
-}
-
-}  // namespace omaha
-
diff --git a/goopdate/process_launcher.cc b/goopdate/process_launcher.cc
deleted file mode 100644
index 3b77287..0000000
--- a/goopdate/process_launcher.cc
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/goopdate/process_launcher.h"
-#include "omaha/base/browser_utils.h"
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/exception_barrier.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/system.h"
-#include "omaha/base/vista_utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/core/google_update_core.h"
-
-namespace omaha {
-
-ProcessLauncher::ProcessLauncher() : StdMarshalInfo(true) {
-  CORE_LOG(L6, (_T("[ProcessLauncher::ProcessLauncher]")));
-}
-
-ProcessLauncher::~ProcessLauncher() {
-  CORE_LOG(L6, (_T("[ProcessLauncher::~ProcessLauncher]")));
-}
-
-STDMETHODIMP ProcessLauncher::LaunchCmdLine(const TCHAR* cmd_line) {
-  CORE_LOG(L1, (_T("[ProcessLauncher::LaunchCmdLine][%s]"), cmd_line));
-  // The exception barrier is needed, because any exceptions that are thrown
-  // in this method will get caught by the COM run time. We compile with
-  // exceptions off, and do not expect to throw any exceptions. This barrier
-  // will treat an exception in this method as a unhandled exception.
-  ExceptionBarrier barrier;
-  if (cmd_line == NULL) {
-    return E_INVALIDARG;
-  }
-
-  // http://b/3329538: In the impersonated case, need to create a fresh
-  // environment block and ::CreateProcess. RunAsCurrentUser does just that.
-  HRESULT hr = vista::RunAsCurrentUser(cmd_line);
-  if (FAILED(hr)) {
-    UTIL_LOG(LW, (_T("[RunAsCurrentUser failed][0x%x]"), hr));
-  }
-  return hr;
-}
-
-STDMETHODIMP ProcessLauncher::LaunchBrowser(DWORD type, const TCHAR* url) {
-  CORE_LOG(L1, (_T("[ProcessLauncher::LaunchBrowser][%d][%s]"), type, url));
-  // The exception barrier is needed, because any exceptions that are thrown
-  // in this method will get caught by the COM run time. We compile with
-  // exceptions off, and do not expect to throw any exceptions. This barrier
-  // will treat an exception in this method as a unhandled exception.
-  ExceptionBarrier barrier;
-  if (type >= BROWSER_MAX || url == NULL) {
-    return E_INVALIDARG;
-  }
-  return RunBrowser(static_cast<BrowserType>(type), url);
-}
-
-// This method delegates to the internal interface exposed by the system
-// service, and if the service cannot be instantiated, exposed by a Local COM
-// Server.
-//
-// Non elevated callers can request a command to be run elevated.
-// The command must be registered before by elevated code to prevent
-// launching untrusted commands. The security of the command is based on
-// having the correct registry ACLs for the machine Omaha registry.
-STDMETHODIMP ProcessLauncher::LaunchCmdElevated(const WCHAR* app_guid,
-                                                const WCHAR* cmd_id,
-                                                DWORD caller_proc_id,
-                                                ULONG_PTR* proc_handle) {
-  CORE_LOG(L3, (_T("[ProcessLauncher::LaunchCmdElevated]")
-                _T("[app %s][cmd %s][pid %d]"),
-                app_guid, cmd_id, caller_proc_id));
-
-  ExceptionBarrier barrier;
-
-  ASSERT1(app_guid);
-  ASSERT1(cmd_id);
-  ASSERT1(proc_handle);
-
-  CComPtr<IGoogleUpdateCore> google_update_core;
-  HRESULT hr =
-      google_update_core.CoCreateInstance(__uuidof(GoogleUpdateCoreClass));
-
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[CoCreate GoogleUpdateCoreClass failed][0x%x]"), hr));
-
-    if (!vista_util::IsVistaOrLater() && !vista_util::IsUserAdmin()) {
-      return hr;
-    }
-
-    hr = System::CoCreateInstanceAsAdmin(NULL,
-                                         __uuidof(GoogleUpdateCoreMachineClass),
-                                         IID_PPV_ARGS(&google_update_core));
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[GoogleUpdateCoreMachineClass failed][0x%x]"), hr));
-      return hr;
-    }
-  }
-
-  ASSERT1(google_update_core);
-  hr = ::CoSetProxyBlanket(google_update_core, RPC_C_AUTHN_DEFAULT,
-      RPC_C_AUTHZ_DEFAULT, COLE_DEFAULT_PRINCIPAL, RPC_C_AUTHN_LEVEL_DEFAULT,
-      RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_DEFAULT);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return google_update_core->LaunchCmdElevated(app_guid,
-                                               cmd_id,
-                                               caller_proc_id,
-                                               proc_handle);
-}
-
-}  // namespace omaha
-
diff --git a/goopdate/process_launcher.h b/goopdate/process_launcher.h
deleted file mode 100644
index 8272a17..0000000
--- a/goopdate/process_launcher.h
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Contains ProcessLauncher class to launch a process using a COM interface. The
-// COM object is typically created by the caller as a medium integrity object
-// impersonating the identity of the active user. This is to allow for launching
-// a medium-integrity process from a high-integrity process.
-
-#ifndef OMAHA_GOOPDATE_PROCESS_LAUNCHER_H__
-#define OMAHA_GOOPDATE_PROCESS_LAUNCHER_H__
-
-#include <windows.h>
-#include <atlbase.h>
-#include <atlcom.h>
-#include <atlstr.h>
-#include "omaha/base/atlregmapex.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/goopdate/com_proxy.h"
-#include "omaha/goopdate/non_localized_resource.h"
-
-// Generated by MIDL in the "BUILD_MODE.OBJ_ROOT + SETTINGS.SUBDIR".
-#include "goopdate/omaha3_idl.h"
-
-namespace omaha {
-
-const TCHAR* const kTlbVersion    = _T("1.0");
-const TCHAR* const kProcessWorkerDescription =
-    _T("Google Update Process Launcher Class");
-
-class ATL_NO_VTABLE ProcessLauncher
-    : public CComObjectRootEx<CComMultiThreadModel>,
-      public CComCoClass<ProcessLauncher, &__uuidof(ProcessLauncherClass)>,
-      public IProcessLauncher,
-      public StdMarshalInfo {
- public:
-  ProcessLauncher();
-  virtual ~ProcessLauncher();
-
-  DECLARE_NOT_AGGREGATABLE(ProcessLauncher)
-  DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-  DECLARE_REGISTRY_RESOURCEID_EX(IDR_LOCAL_SERVER_RGS)
-
-  #pragma warning(push)
-  // C4640: construction of local static object is not thread-safe
-  #pragma warning(disable : 4640)
-  BEGIN_REGISTRY_MAP()
-    REGMAP_ENTRY(_T("HKROOT"),       goopdate_utils::GetHKRoot())
-    REGMAP_MODULE2(_T("MODULE"),     kOmahaOnDemandFileName)
-    REGMAP_ENTRY(_T("VERSION"),      kTlbVersion)
-    REGMAP_ENTRY(_T("PROGID"),       kProgIDProcessLauncher)
-    REGMAP_ENTRY(_T("DESCRIPTION"),  kProcessWorkerDescription)
-    REGMAP_UUID(_T("CLSID"),         __uuidof(ProcessLauncherClass))
-  END_REGISTRY_MAP()
-  #pragma warning(pop)
-
-  // C4505: unreferenced IUnknown local functions have been removed
-  #pragma warning(disable : 4505)
-  BEGIN_COM_MAP(ProcessLauncher)
-    COM_INTERFACE_ENTRY(IProcessLauncher)
-    COM_INTERFACE_ENTRY(IStdMarshalInfo)
-  END_COM_MAP()
-
-  // Launches a command line at medium integrity.
-  STDMETHOD(LaunchCmdLine)(const TCHAR* cmd_line);
-
-  // Launches the appropriate browser.
-  STDMETHOD(LaunchBrowser)(DWORD type, const TCHAR* url);
-
-  // Launches a command line elevated.
-  STDMETHOD(LaunchCmdElevated)(const WCHAR* app_guid,
-                               const WCHAR* cmd_id,
-                               DWORD caller_proc_id,
-                               ULONG_PTR* proc_handle);
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(ProcessLauncher);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_PROCESS_LAUNCHER_H__
diff --git a/goopdate/resource_manager.cc b/goopdate/resource_manager.cc
deleted file mode 100644
index 7d731f2..0000000
--- a/goopdate/resource_manager.cc
+++ /dev/null
@@ -1,198 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/resource_manager.h"
-#include <windows.h>
-#include <map>
-#include <vector>
-#include "omaha/base/constants.h"
-#include "omaha/base/commontypes.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/file_ver.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/path.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/common/lang.h"
-
-namespace omaha {
-
-ResourceManager* ResourceManager::instance_ = NULL;
-
-HRESULT ResourceManager::CreateForDefaultLanguage(bool is_machine,
-                                                  const CString& resource_dir) {
-  return Create(is_machine,
-                resource_dir,
-                lang::GetDefaultLanguage(is_machine));
-}
-
-HRESULT ResourceManager::Create(
-    bool is_machine, const CString& resource_dir, const CString& lang) {
-  CString language = lang;
-  if (language.IsEmpty() || !lang::IsLanguageSupported(language)) {
-    language = lang::GetDefaultLanguage(is_machine);
-  }
-
-  if (!instance_) {
-    instance_ = new ResourceManager(is_machine, resource_dir);
-    return instance_->SetDefaultResourceByLanguage(language);
-  }
-  return S_OK;
-}
-
-void ResourceManager::Delete() {
-  ResourceManager* instance = NULL;
-  instance = omaha::interlocked_exchange_pointer(&instance_, instance);
-
-  delete instance;
-}
-
-ResourceManager& ResourceManager::Instance() {
-  ASSERT1(instance_);
-  return *instance_;
-}
-
-ResourceManager::ResourceManager(bool is_machine, const CString& resource_dir)
-    : is_machine_(is_machine),
-      resource_dir_(resource_dir),
-      saved_atl_resource_(NULL) {
-}
-
-ResourceManager::~ResourceManager() {
-  if (saved_atl_resource_) {
-    _AtlBaseModule.SetResourceInstance(saved_atl_resource_);
-  }
-}
-
-HRESULT ResourceManager::SetDefaultResourceByLanguage(const CString& language) {
-  ResourceDllInfo dll_info;
-  HRESULT hr = GetResourceDllInfo(language, &dll_info);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // All CString.LoadString and CreateDialog calls should use the resource of
-  // the default language.
-  saved_atl_resource_ = _AtlBaseModule.SetResourceInstance(dll_info.dll_handle);
-
-  return hr;
-}
-
-HRESULT ResourceManager::GetResourceDll(const CString& language,
-                                        HINSTANCE* dll_handle) {
-  ASSERT1(dll_handle);
-
-  ResourceDllInfo dll_info;
-  HRESULT hr = GetResourceDllInfo(language, &dll_info);
-  if (FAILED(hr)) {
-    return  hr;
-  }
-  *dll_handle = dll_info.dll_handle;
-  return S_OK;
-}
-
-HRESULT ResourceManager::GetResourceDllInfo(const CString& language,
-                                            ResourceDllInfo* dll_info) {
-  ASSERT1(dll_info);
-  __mutexScope(lock_);
-
-  ASSERT1(lang::IsLanguageSupported(language));
-
-  LanguageToResourceMap::const_iterator it = resource_map_.find(language);
-  if (it != resource_map_.end()) {
-    *dll_info = it->second;
-    return S_OK;
-  }
-  return LoadResourceDll(language, dll_info);
-}
-
-// Assumes that the language has not been loaded previously.
-HRESULT ResourceManager::LoadResourceDll(const CString& language,
-                                         ResourceDllInfo* dll_info) {
-  ASSERT1(dll_info);
-  ASSERT1(lang::IsLanguageSupported(language));
-  dll_info->dll_handle = NULL;
-
-  __mutexScope(lock_);
-
-  ASSERT1(resource_map_.find(language) == resource_map_.end());
-
-  // First try to load the resource dll for the language parameter.
-  HRESULT hr = LoadLibraryAsDataFile(GetResourceDllName(language), dll_info);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Resource dll load failed.][0x%08x]"), hr));
-    return hr;
-  }
-
-  FileVer file_ver;
-  VERIFY1(file_ver.Open(dll_info->file_path));
-  dll_info->language = file_ver.QueryValue(kLanguageVersionName);
-  CORE_LOG(L1, (_T("[Loaded resource dll %s]"), dll_info->file_path));
-
-  resource_map_.insert(std::make_pair(language, *dll_info));
-  return S_OK;
-}
-
-HRESULT ResourceManager::LoadLibraryAsDataFile(
-    const CString& filename,
-    ResourceDllInfo* dll_info) const {
-  ASSERT1(!filename.IsEmpty());
-  ASSERT1(dll_info);
-  ASSERT1(!resource_dir_.IsEmpty());
-
-  dll_info->file_path = ConcatenatePath(resource_dir_, filename);
-  if (dll_info->file_path.IsEmpty()) {
-    ASSERT1(false);
-    return GOOPDATE_E_RESOURCE_DLL_PATH_EMPTY;
-  }
-  dll_info->dll_handle = ::LoadLibraryEx(dll_info->file_path,
-                                         NULL,
-                                         LOAD_LIBRARY_AS_DATAFILE);
-  if (!dll_info->dll_handle) {
-    HRESULT hr = HRESULTFromLastError();
-    CORE_LOG(L2, (_T("[Could not load resource dll %s.]"),
-                 dll_info->file_path));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-CString ResourceManager::GetResourceDllName(const CString& language) {
-  ASSERT1(!language.IsEmpty());
-
-  CString filename;
-  filename.Format(kOmahaResourceDllNameFormat,
-                  lang::GetWrittenLanguage(language));
-  return filename;
-}
-
-void ResourceManager::GetSupportedLanguageDllNames(
-    std::vector<CString>* filenames) {
-  std::vector<CString> codes;
-  lang::GetSupportedLanguages(&codes);
-
-  for (size_t i = 0; i < codes.size(); ++i) {
-    if (lang::DoesSupportedLanguageUseDifferentId(codes[i])) {
-      // There is not a separate DLL for this language.
-      continue;
-    }
-    filenames->push_back(GetResourceDllName(codes[i]));
-  }
-}
-
-}  // namespace omaha
diff --git a/goopdate/resource_manager.h b/goopdate/resource_manager.h
deleted file mode 100644
index 66348ba..0000000
--- a/goopdate/resource_manager.h
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Omaha resource manager.
-
-#ifndef OMAHA_GOOPDATE_RESOURCE_MANAGER_H__
-#define OMAHA_GOOPDATE_RESOURCE_MANAGER_H__
-
-#include <atlstr.h>
-#include <map>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/synchronized.h"
-
-namespace omaha {
-
-class ResourceManager {
- public:
-  // Create must be called before going multithreaded.
-  static HRESULT CreateForDefaultLanguage(bool is_machine,
-                                          const CString& resource_dir);
-  static HRESULT Create(bool is_machine,
-                        const CString& resource_dir,
-                        const CString& lang);
-  static void Delete();
-
-  static ResourceManager& Instance();
-
-  static void GetSupportedLanguageDllNames(std::vector<CString>* filenames);
-
-  // Gets resource DLL handle for the given language. DLL will be loaded if
-  // necessary.
-  HRESULT GetResourceDll(const CString& language, HINSTANCE* dll_handle);
-
- private:
-  struct ResourceDllInfo {
-    ResourceDllInfo() : dll_handle(NULL) {}
-
-    HMODULE dll_handle;
-    CString file_path;
-    CString language;
-  };
-
-  ResourceManager(bool is_machine, const CString& resource_dir);
-  ~ResourceManager();
-
-  // The resource manager tries to load the resource dll corresponding to
-  // the language in the following order:
-  // 1. Language parameter.
-  // 2. Language in the registry.
-  // 3. First file returned by NTFS in the module directory.
-  HRESULT LoadResourceDll(const CString& language, ResourceDllInfo* dll_info);
-  HRESULT SetDefaultResourceByLanguage(const CString& language);
-  HRESULT LoadLibraryAsDataFile(const CString& filename,
-                                ResourceDllInfo* dll_info) const;
-
-  // Gets resource DLL info for the given language. DLL will be loaded if
-  // necessary.
-  HRESULT GetResourceDllInfo(const CString& language,
-                             ResourceDllInfo* dll_info);
-
-  static CString GetResourceDllName(const CString& language);
-
-  LLock lock_;
-  typedef std::map<CString, ResourceDllInfo> LanguageToResourceMap;
-
-  bool is_machine_;
-  CString resource_dir_;
-  LanguageToResourceMap resource_map_;
-  HINSTANCE saved_atl_resource_;
-
-  static ResourceManager* instance_;
-
-  friend class ResourceManagerTest;
-
-  DISALLOW_EVIL_CONSTRUCTORS(ResourceManager);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_RESOURCE_MANAGER_H__
diff --git a/goopdate/resource_manager_unittest.cc b/goopdate/resource_manager_unittest.cc
deleted file mode 100644
index 235856b..0000000
--- a/goopdate/resource_manager_unittest.cc
+++ /dev/null
@@ -1,257 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// ResourceManager unit tests.
-
-#include <map>
-#include <vector>
-#include "omaha/base/app_util.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/file.h"
-#include "omaha/base/path.h"
-#include "omaha/base/string.h"
-#include "omaha/common/lang.h"
-#include "omaha/goopdate/resource_manager.h"
-#include "omaha/goopdate/resources/goopdateres/goopdate.grh"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-const int kNumberOfLanguageDlls = 55;
-
-}  // namespace
-
-class ResourceManagerTest : public testing::Test {
- protected:
-  virtual void SetUp() {
-    path_ = app_util::GetModuleDirectory(NULL);
-    EXPECT_HRESULT_SUCCEEDED(
-        ResourceManager::CreateForDefaultLanguage(false, path_));
-  }
-
-  virtual void TearDown() {
-    ResourceManager::Delete();
-  }
-
-  void SetMachine(bool is_machine) {
-    ResourceManager::instance_->is_machine_ = is_machine;
-  }
-
-  void SetResourceDir(const CString& resource_dir) {
-    ResourceManager::instance_->resource_dir_ = resource_dir;
-  }
-
-  CString GetResourceDir() const {
-    return ResourceManager::instance_->resource_dir_;
-  }
-
-  CString GetLang(LANGID langid) {
-    return lang::GetLanguageForLangID(langid);
-  }
-
-  void VerifyLoadingResourceDll(const CString& lang, bool is_success) {
-    ResourceManager::ResourceDllInfo dll_info;
-
-    HRESULT hr = ResourceManager::Instance().GetResourceDllInfo(lang,
-                                                                &dll_info);
-    if (is_success) {
-      EXPECT_HRESULT_SUCCEEDED(hr);
-      EXPECT_TRUE(dll_info.dll_handle != NULL);
-      EXPECT_STREQ(lang, dll_info.language);
-
-      CString expected_file_name;
-      expected_file_name.Format(kOmahaResourceDllNameFormat, lang);
-      CString expected_path = ConcatenatePath(path_, expected_file_name);
-      EXPECT_STREQ(expected_path, dll_info.file_path);
-    } else {
-      EXPECT_HRESULT_FAILED(hr);
-      EXPECT_EQ(NULL, dll_info.dll_handle);
-      EXPECT_STREQ(_T(""), dll_info.language);
-    }
-  }
-
-  static CString GetResourceDllName(const CString& language) {
-    return ResourceManager::GetResourceDllName(language);
-  }
-
-  CString path_;
-};
-
-// Disables the default resources used for unit testing and restores them after
-// the test.
-// For some reason, the _AtlBaseModule.SetResourceInstance() call in
-// ResourceManager does not replace the existing resources, so they must be
-// unloaded first.
-class ResourceManagerResourcesProtectedTest : public ResourceManagerTest {
- protected:
-  // Assumes that the default resources are the first loaded at index 0.
-  virtual void SetUp() {
-    ResourceManagerTest::SetUp();
-
-     default_resources_ = _AtlBaseModule.GetHInstanceAt(0);
-    _AtlBaseModule.RemoveResourceInstance(default_resources_);
-  }
-
-  virtual void TearDown() {
-    _AtlBaseModule.AddResourceInstance(default_resources_);
-
-    ResourceManagerTest::TearDown();
-  }
-
- private:
-  HINSTANCE default_resources_;
-};
-
-TEST_F(ResourceManagerTest, GetResourceDllName) {
-  const CString kLang(_T("en"));
-  CString ret = GetResourceDllName(kLang);
-
-  CString expected_filename;
-  expected_filename.Format(kOmahaResourceDllNameFormat, kLang);
-  EXPECT_STREQ(expected_filename, ret);
-}
-
-TEST_F(ResourceManagerTest, GetResourceDllName_SpecialCases) {
-  // zh-HK -> zh-TW
-  EXPECT_STREQ(_T("goopdateres_zh-TW.dll"), GetResourceDllName(_T("zh-TW")));
-  EXPECT_STREQ(_T("goopdateres_zh-TW.dll"), GetResourceDllName(_T("zh-HK")));
-
-  // he -> iw
-  EXPECT_STREQ(_T("goopdateres_iw.dll"), GetResourceDllName(_T("iw")));
-  EXPECT_STREQ(_T("goopdateres_iw.dll"), GetResourceDllName(_T("he")));
-}
-
-TEST_F(ResourceManagerTest, LoadResourceFail) {
-  SetMachine(false);
-
-  CString original_resoruce_dir = GetResourceDir();
-  SetResourceDir(_T("non_existing\\abcddir"));
-
-  // Loading resource from a non-existing directory should fail. The language
-  // being loaded here should not be loaded previously. Otherwise the resource
-  // manager will return the cached value instead of doing actual load.
-  VerifyLoadingResourceDll(_T("ca"), false);
-
-  SetResourceDir(original_resoruce_dir);
-}
-
-TEST_F(ResourceManagerTest, LoadResourceDllCmdLine) {
-  SetMachine(false);
-
-  CString lang = _T("ca");
-  VerifyLoadingResourceDll(lang, true);
-}
-
-TEST_F(ResourceManagerTest, LoadResourceDllCmdLineMachine) {
-  SetMachine(true);
-
-  CString lang = _T("ca");
-  VerifyLoadingResourceDll(lang, true);
-}
-
-TEST_F(ResourceManagerTest, TestCountLanguageDlls) {
-  std::vector<CString> filenames;
-  ResourceManager::GetSupportedLanguageDllNames(&filenames);
-  EXPECT_EQ(kNumberOfLanguageDlls, filenames.size());
-}
-
-TEST_F(ResourceManagerTest, TestAppropriateLanguageDlls) {
-  std::vector<CString> filenames;
-  ResourceManager::GetSupportedLanguageDllNames(&filenames);
-
-  std::vector<CString>::iterator iter = filenames.begin();
-
-  EXPECT_STREQ(_T("goopdateres_am.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_ar.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_bg.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_bn.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_ca.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_cs.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_da.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_de.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_el.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_en.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_en-GB.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_es.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_es-419.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_et.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_fa.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_fi.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_fil.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_fr.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_gu.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_hi.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_hr.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_hu.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_id.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_is.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_it.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_iw.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_ja.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_kn.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_ko.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_lt.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_lv.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_ml.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_mr.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_ms.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_nl.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_no.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_pl.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_pt-BR.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_pt-PT.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_ro.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_ru.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_sk.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_sl.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_sr.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_sv.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_sw.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_ta.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_te.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_th.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_tr.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_uk.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_ur.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_vi.dll"), *iter++);
-  EXPECT_STREQ(_T("goopdateres_zh-CN.dll"), *iter++);
-  // goopdateres_zh-HK.dll not present
-  EXPECT_STREQ(_T("goopdateres_zh-TW.dll"), *iter++);
-}
-
-TEST_F(ResourceManagerResourcesProtectedTest, RussianResourcesValid) {
-  ResourceManager::Delete();
-
-  CString lang(_T("ru"));
-  EXPECT_HRESULT_SUCCEEDED(ResourceManager::Create(false, path_, lang));
-
-  CString install_success(FormatResourceMessage(
-      IDS_BUNDLE_INSTALLED_SUCCESSFULLY, _T("Google Gears")));
-
-  EXPECT_STREQ("Благодарим за установку Google Gears.",
-               WideToUtf8(install_success));
-
-  CString install_fail(FormatResourceMessage(IDS_INSTALLER_FAILED_WITH_MESSAGE,
-                                             _T("12345"),
-                                             _T("Action failed.")));
-
-  EXPECT_STREQ("Ошибка установщика 12345: Action failed.",
-               WideToUtf8(install_fail));
-}
-
-}  // namespace omaha
diff --git a/goopdate/resources/build.scons b/goopdate/resources/build.scons
deleted file mode 100644
index 378de18..0000000
--- a/goopdate/resources/build.scons
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/python2.4
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-
-local_env = env.Clone(
-    PRECOMPILE_STOPFILE = '',
-    PRECOMPILE_BUILDER  = '',
-    COMPONENT_STATIC = False,
-)
-
-# We disable runtime stack check to avoid increasing the code size.
-# There is a compiler pragma to programmatically disable the stack checks
-# but for some reason it did not work.
-local_env.FilterOut(CPPFLAGS = ['/GS'])
-
-# Disable stack checks for VC80. Stack checks are on by default.
-if local_env['msc_ver'] >= 1400:
-  local_env['CCFLAGS'] += ['/GS-']
-
-
-for omaha_version_info in local_env['omaha_versions_info']:
-  prefix = omaha_version_info.filename_prefix
-
-  for lang in omaha_version_info.GetSupportedLanguages():
-    lang_env = local_env.Clone()
-    lang_env.Append(
-        RCFLAGS = [
-            '/DVERSION_MAJOR=%d' % omaha_version_info.version_major,
-            '/DVERSION_MINOR=%d' % omaha_version_info.version_minor,
-            '/DVERSION_BUILD=%d' % omaha_version_info.version_build,
-            '/DVERSION_PATCH=%d' % omaha_version_info.version_patch,
-            '/DVERSION_NUMBER_STRING=\\"%s\\"' % (
-                omaha_version_info.GetVersionString()),
-            '/DLANGUAGE_STRING=\\"%s\\"' % lang
-            ],
-        CPPPATH = [
-            '$OBJ_ROOT/goopdate',  # Needed for the tlb
-            ],
-        LINKFLAGS = [
-            '/NODEFAULTLIB',
-            '/ENTRY:DllEntry',
-            '/MERGE:.rdata=.text',
-            '/BASE:0x19000000',
-            ],
-    )
-
-    # Avoid conflicts in obj targets
-    lang_env['OBJSUFFIX'] = '_' + lang + lang_env['OBJSUFFIX']
-    lang_env['OBJPREFIX'] = '%s/%s' % (lang, prefix) + lang_env['OBJPREFIX']
-
-    lang_base_name = 'generated_resources_' + lang
-    lang_res = lang_env.RES(
-        target='%s%s.res' % (prefix, lang_base_name),
-        source='goopdateres/%s.rc' % (lang_base_name),
-    )
-
-    # Force a rebuild when the version changes.
-    lang_env.Depends(lang_res, '$MAIN_DIR/VERSION')
-
-    lang_inputs = [
-        'resdll_main.cc',
-        lang_res,
-        # Needed to prevent rebuilding of the lib.
-        'resource_only_dll.def'
-        ]
-
-    # Build the (unsigned) DLL
-    unsigned_dll = lang_env.ComponentLibrary(
-        lib_name='%s/%sgoopdateres_unsigned_%s' % (lang, prefix, lang),
-        source=lang_inputs
-    )
-
-    signed_dll = lang_env.SignedBinary(
-        target='%s/%sgoopdateres_%s.dll' % (lang, prefix, lang),
-        source=unsigned_dll,
-    )
-
-    env.Replicate('$STAGING_DIR', signed_dll)
diff --git a/goopdate/resources/goopdate_dll/generated_resources_am.rc b/goopdate/resources/goopdate_dll/generated_resources_am.rc
deleted file mode 100644
index 536d555..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_am.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_ar.rc b/goopdate/resources/goopdate_dll/generated_resources_ar.rc
deleted file mode 100644
index be5b72f..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_ar.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_bg.rc b/goopdate/resources/goopdate_dll/generated_resources_bg.rc
deleted file mode 100644
index 70247f9..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_bg.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_bn.rc b/goopdate/resources/goopdate_dll/generated_resources_bn.rc
deleted file mode 100644
index d51b155..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_bn.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_ca.rc b/goopdate/resources/goopdate_dll/generated_resources_ca.rc
deleted file mode 100644
index 15dcf7a..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_ca.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_cs.rc b/goopdate/resources/goopdate_dll/generated_resources_cs.rc
deleted file mode 100644
index 2c3833e..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_cs.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_da.rc b/goopdate/resources/goopdate_dll/generated_resources_da.rc
deleted file mode 100644
index a6ee391..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_da.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_de.rc b/goopdate/resources/goopdate_dll/generated_resources_de.rc
deleted file mode 100644
index b624965..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_de.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_el.rc b/goopdate/resources/goopdate_dll/generated_resources_el.rc
deleted file mode 100644
index 50913e8..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_el.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_en-GB.rc b/goopdate/resources/goopdate_dll/generated_resources_en-GB.rc
deleted file mode 100644
index 5e31fd2..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_en-GB.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_en.rc b/goopdate/resources/goopdate_dll/generated_resources_en.rc
deleted file mode 100644
index 4133c1c..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_en.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_es-419.rc b/goopdate/resources/goopdate_dll/generated_resources_es-419.rc
deleted file mode 100644
index b595e14..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_es-419.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_es.rc b/goopdate/resources/goopdate_dll/generated_resources_es.rc
deleted file mode 100644
index 8880958..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_es.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_et.rc b/goopdate/resources/goopdate_dll/generated_resources_et.rc
deleted file mode 100644
index 1614f41..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_et.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_fa.rc b/goopdate/resources/goopdate_dll/generated_resources_fa.rc
deleted file mode 100644
index 0061da9..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_fa.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_fi.rc b/goopdate/resources/goopdate_dll/generated_resources_fi.rc
deleted file mode 100644
index dfd56ba..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_fi.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_fil.rc b/goopdate/resources/goopdate_dll/generated_resources_fil.rc
deleted file mode 100644
index a82b588..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_fil.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_fr.rc b/goopdate/resources/goopdate_dll/generated_resources_fr.rc
deleted file mode 100644
index 18f5493..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_fr.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_gu.rc b/goopdate/resources/goopdate_dll/generated_resources_gu.rc
deleted file mode 100644
index df36d49..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_gu.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_hi.rc b/goopdate/resources/goopdate_dll/generated_resources_hi.rc
deleted file mode 100644
index 8be4fee..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_hi.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_hr.rc b/goopdate/resources/goopdate_dll/generated_resources_hr.rc
deleted file mode 100644
index d742c46..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_hr.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_hu.rc b/goopdate/resources/goopdate_dll/generated_resources_hu.rc
deleted file mode 100644
index 827891d..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_hu.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_id.rc b/goopdate/resources/goopdate_dll/generated_resources_id.rc
deleted file mode 100644
index 684a379..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_id.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_is.rc b/goopdate/resources/goopdate_dll/generated_resources_is.rc
deleted file mode 100644
index 757fc50..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_is.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_it.rc b/goopdate/resources/goopdate_dll/generated_resources_it.rc
deleted file mode 100644
index f68283e..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_it.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_iw.rc b/goopdate/resources/goopdate_dll/generated_resources_iw.rc
deleted file mode 100644
index 38806f3..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_iw.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_ja.rc b/goopdate/resources/goopdate_dll/generated_resources_ja.rc
deleted file mode 100644
index 0646256..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_ja.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_kn.rc b/goopdate/resources/goopdate_dll/generated_resources_kn.rc
deleted file mode 100644
index a3b160d..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_kn.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_ko.rc b/goopdate/resources/goopdate_dll/generated_resources_ko.rc
deleted file mode 100644
index ae8a9dc..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_ko.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_lt.rc b/goopdate/resources/goopdate_dll/generated_resources_lt.rc
deleted file mode 100644
index 804782a..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_lt.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_lv.rc b/goopdate/resources/goopdate_dll/generated_resources_lv.rc
deleted file mode 100644
index f50b1f9..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_lv.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_ml.rc b/goopdate/resources/goopdate_dll/generated_resources_ml.rc
deleted file mode 100644
index 1e54285..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_ml.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_mr.rc b/goopdate/resources/goopdate_dll/generated_resources_mr.rc
deleted file mode 100644
index b17588c..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_mr.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_ms.rc b/goopdate/resources/goopdate_dll/generated_resources_ms.rc
deleted file mode 100644
index cd2ecb4..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_ms.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_nl.rc b/goopdate/resources/goopdate_dll/generated_resources_nl.rc
deleted file mode 100644
index e4d2626..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_nl.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_no.rc b/goopdate/resources/goopdate_dll/generated_resources_no.rc
deleted file mode 100644
index b3b64d5..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_no.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_or.rc b/goopdate/resources/goopdate_dll/generated_resources_or.rc
deleted file mode 100644
index 91473b3..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_or.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_pl.rc b/goopdate/resources/goopdate_dll/generated_resources_pl.rc
deleted file mode 100644
index 24dca43..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_pl.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_pt-BR.rc b/goopdate/resources/goopdate_dll/generated_resources_pt-BR.rc
deleted file mode 100644
index 1ed0a43..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_pt-BR.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_pt-PT.rc b/goopdate/resources/goopdate_dll/generated_resources_pt-PT.rc
deleted file mode 100644
index 7039162..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_pt-PT.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_ro.rc b/goopdate/resources/goopdate_dll/generated_resources_ro.rc
deleted file mode 100644
index 11194ca..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_ro.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_ru.rc b/goopdate/resources/goopdate_dll/generated_resources_ru.rc
deleted file mode 100644
index 1315ac5..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_ru.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_sk.rc b/goopdate/resources/goopdate_dll/generated_resources_sk.rc
deleted file mode 100644
index 9942cc9..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_sk.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_sl.rc b/goopdate/resources/goopdate_dll/generated_resources_sl.rc
deleted file mode 100644
index 22c6fbe..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_sl.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_sr.rc b/goopdate/resources/goopdate_dll/generated_resources_sr.rc
deleted file mode 100644
index 8f60172..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_sr.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_sv.rc b/goopdate/resources/goopdate_dll/generated_resources_sv.rc
deleted file mode 100644
index a3b6e6a..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_sv.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_sw.rc b/goopdate/resources/goopdate_dll/generated_resources_sw.rc
deleted file mode 100644
index 27d8dcf..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_sw.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_ta.rc b/goopdate/resources/goopdate_dll/generated_resources_ta.rc
deleted file mode 100644
index 8fc1bdb..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_ta.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_te.rc b/goopdate/resources/goopdate_dll/generated_resources_te.rc
deleted file mode 100644
index 1a3483c..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_te.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_th.rc b/goopdate/resources/goopdate_dll/generated_resources_th.rc
deleted file mode 100644
index 236d565..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_th.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_tr.rc b/goopdate/resources/goopdate_dll/generated_resources_tr.rc
deleted file mode 100644
index e672ee9..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_tr.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_uk.rc b/goopdate/resources/goopdate_dll/generated_resources_uk.rc
deleted file mode 100644
index f017ff6..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_uk.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_ur.rc b/goopdate/resources/goopdate_dll/generated_resources_ur.rc
deleted file mode 100644
index f99f5c7..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_ur.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_userdefault.rc b/goopdate/resources/goopdate_dll/generated_resources_userdefault.rc
deleted file mode 100644
index 2d90d74..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_userdefault.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_vi.rc b/goopdate/resources/goopdate_dll/generated_resources_vi.rc
deleted file mode 100644
index e334ce6..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_vi.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_zh-CN.rc b/goopdate/resources/goopdate_dll/generated_resources_zh-CN.rc
deleted file mode 100644
index 8142a97..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_zh-CN.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_zh-HK.rc b/goopdate/resources/goopdate_dll/generated_resources_zh-HK.rc
deleted file mode 100644
index d1b87a2..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_zh-HK.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/generated_resources_zh-TW.rc b/goopdate/resources/goopdate_dll/generated_resources_zh-TW.rc
deleted file mode 100644
index d3e30d6..0000000
--- a/goopdate/resources/goopdate_dll/generated_resources_zh-TW.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdate_dll/goopdate_dll.grh b/goopdate/resources/goopdate_dll/goopdate_dll.grh
deleted file mode 100644
index e1b0c40..0000000
--- a/goopdate/resources/goopdate_dll/goopdate_dll.grh
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-// This file is automatically generated by GRIT.  Do not edit.
-// Built on Thu Nov 18 11:01:39 2010
-
-#ifndef RESOURCE_751581924418__
-#define RESOURCE_751581924418__
-
-
-#define IDS_ELEVATION_MONIKER_DISPLAYNAME 3000
-
-#endif // RESOURCE_751581924418__
diff --git a/goopdate/resources/goopdateres/generated_resources_am.rc b/goopdate/resources/goopdateres/generated_resources_am.rc
deleted file mode 100644
index aa23522..0000000
--- a/goopdate/resources/goopdateres/generated_resources_am.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_ar.rc b/goopdate/resources/goopdateres/generated_resources_ar.rc
deleted file mode 100644
index 6a3bfe4..0000000
--- a/goopdate/resources/goopdateres/generated_resources_ar.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_bg.rc b/goopdate/resources/goopdateres/generated_resources_bg.rc
deleted file mode 100644
index 0acbabb..0000000
--- a/goopdate/resources/goopdateres/generated_resources_bg.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_bn.rc b/goopdate/resources/goopdateres/generated_resources_bn.rc
deleted file mode 100644
index 243e42d..0000000
--- a/goopdate/resources/goopdateres/generated_resources_bn.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_ca.rc b/goopdate/resources/goopdateres/generated_resources_ca.rc
deleted file mode 100644
index 8a66f24..0000000
--- a/goopdate/resources/goopdateres/generated_resources_ca.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_cs.rc b/goopdate/resources/goopdateres/generated_resources_cs.rc
deleted file mode 100644
index f292a70..0000000
--- a/goopdate/resources/goopdateres/generated_resources_cs.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_da.rc b/goopdate/resources/goopdateres/generated_resources_da.rc
deleted file mode 100644
index 3fcf9c2..0000000
--- a/goopdate/resources/goopdateres/generated_resources_da.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_de.rc b/goopdate/resources/goopdateres/generated_resources_de.rc
deleted file mode 100644
index 3c3084d..0000000
--- a/goopdate/resources/goopdateres/generated_resources_de.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_el.rc b/goopdate/resources/goopdateres/generated_resources_el.rc
deleted file mode 100644
index 7e1b726..0000000
--- a/goopdate/resources/goopdateres/generated_resources_el.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_en-GB.rc b/goopdate/resources/goopdateres/generated_resources_en-GB.rc
deleted file mode 100644
index b79b7e7..0000000
--- a/goopdate/resources/goopdateres/generated_resources_en-GB.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_en.rc b/goopdate/resources/goopdateres/generated_resources_en.rc
deleted file mode 100644
index f08b98a..0000000
--- a/goopdate/resources/goopdateres/generated_resources_en.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_es-419.rc b/goopdate/resources/goopdateres/generated_resources_es-419.rc
deleted file mode 100644
index 63081db..0000000
--- a/goopdate/resources/goopdateres/generated_resources_es-419.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_es.rc b/goopdate/resources/goopdateres/generated_resources_es.rc
deleted file mode 100644
index e166df9..0000000
--- a/goopdate/resources/goopdateres/generated_resources_es.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_et.rc b/goopdate/resources/goopdateres/generated_resources_et.rc
deleted file mode 100644
index 05e7a1b..0000000
--- a/goopdate/resources/goopdateres/generated_resources_et.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_fa.rc b/goopdate/resources/goopdateres/generated_resources_fa.rc
deleted file mode 100644
index 21d9d15..0000000
--- a/goopdate/resources/goopdateres/generated_resources_fa.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_fi.rc b/goopdate/resources/goopdateres/generated_resources_fi.rc
deleted file mode 100644
index 48e3665..0000000
--- a/goopdate/resources/goopdateres/generated_resources_fi.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_fil.rc b/goopdate/resources/goopdateres/generated_resources_fil.rc
deleted file mode 100644
index 32115fb..0000000
--- a/goopdate/resources/goopdateres/generated_resources_fil.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_fr.rc b/goopdate/resources/goopdateres/generated_resources_fr.rc
deleted file mode 100644
index 3cbfba1..0000000
--- a/goopdate/resources/goopdateres/generated_resources_fr.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_gu.rc b/goopdate/resources/goopdateres/generated_resources_gu.rc
deleted file mode 100644
index 5616e4e..0000000
--- a/goopdate/resources/goopdateres/generated_resources_gu.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_hi.rc b/goopdate/resources/goopdateres/generated_resources_hi.rc
deleted file mode 100644
index d0d8b69..0000000
--- a/goopdate/resources/goopdateres/generated_resources_hi.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_hr.rc b/goopdate/resources/goopdateres/generated_resources_hr.rc
deleted file mode 100644
index 0ec88c1..0000000
--- a/goopdate/resources/goopdateres/generated_resources_hr.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_hu.rc b/goopdate/resources/goopdateres/generated_resources_hu.rc
deleted file mode 100644
index 31eaa2f..0000000
--- a/goopdate/resources/goopdateres/generated_resources_hu.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_id.rc b/goopdate/resources/goopdateres/generated_resources_id.rc
deleted file mode 100644
index de06268..0000000
--- a/goopdate/resources/goopdateres/generated_resources_id.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_is.rc b/goopdate/resources/goopdateres/generated_resources_is.rc
deleted file mode 100644
index 9c37c37..0000000
--- a/goopdate/resources/goopdateres/generated_resources_is.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_it.rc b/goopdate/resources/goopdateres/generated_resources_it.rc
deleted file mode 100644
index f90a62c..0000000
--- a/goopdate/resources/goopdateres/generated_resources_it.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_iw.rc b/goopdate/resources/goopdateres/generated_resources_iw.rc
deleted file mode 100644
index 84fcf0d..0000000
--- a/goopdate/resources/goopdateres/generated_resources_iw.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_ja.rc b/goopdate/resources/goopdateres/generated_resources_ja.rc
deleted file mode 100644
index 4a66de7..0000000
--- a/goopdate/resources/goopdateres/generated_resources_ja.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_kn.rc b/goopdate/resources/goopdateres/generated_resources_kn.rc
deleted file mode 100644
index ebfbc38..0000000
--- a/goopdate/resources/goopdateres/generated_resources_kn.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_ko.rc b/goopdate/resources/goopdateres/generated_resources_ko.rc
deleted file mode 100644
index d3ca110..0000000
--- a/goopdate/resources/goopdateres/generated_resources_ko.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_lt.rc b/goopdate/resources/goopdateres/generated_resources_lt.rc
deleted file mode 100644
index ab5faff..0000000
--- a/goopdate/resources/goopdateres/generated_resources_lt.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_lv.rc b/goopdate/resources/goopdateres/generated_resources_lv.rc
deleted file mode 100644
index 2fbc828..0000000
--- a/goopdate/resources/goopdateres/generated_resources_lv.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_ml.rc b/goopdate/resources/goopdateres/generated_resources_ml.rc
deleted file mode 100644
index 6d3436c..0000000
--- a/goopdate/resources/goopdateres/generated_resources_ml.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_mr.rc b/goopdate/resources/goopdateres/generated_resources_mr.rc
deleted file mode 100644
index 8e719cc..0000000
--- a/goopdate/resources/goopdateres/generated_resources_mr.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_ms.rc b/goopdate/resources/goopdateres/generated_resources_ms.rc
deleted file mode 100644
index 1518d2e..0000000
--- a/goopdate/resources/goopdateres/generated_resources_ms.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_nl.rc b/goopdate/resources/goopdateres/generated_resources_nl.rc
deleted file mode 100644
index ca52bdd..0000000
--- a/goopdate/resources/goopdateres/generated_resources_nl.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_no.rc b/goopdate/resources/goopdateres/generated_resources_no.rc
deleted file mode 100644
index aabfa4b..0000000
--- a/goopdate/resources/goopdateres/generated_resources_no.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_pl.rc b/goopdate/resources/goopdateres/generated_resources_pl.rc
deleted file mode 100644
index ab52f68..0000000
--- a/goopdate/resources/goopdateres/generated_resources_pl.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_pt-BR.rc b/goopdate/resources/goopdateres/generated_resources_pt-BR.rc
deleted file mode 100644
index 3334504..0000000
--- a/goopdate/resources/goopdateres/generated_resources_pt-BR.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_pt-PT.rc b/goopdate/resources/goopdateres/generated_resources_pt-PT.rc
deleted file mode 100644
index 0f60bb7..0000000
--- a/goopdate/resources/goopdateres/generated_resources_pt-PT.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_ro.rc b/goopdate/resources/goopdateres/generated_resources_ro.rc
deleted file mode 100644
index df48882..0000000
--- a/goopdate/resources/goopdateres/generated_resources_ro.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_ru.rc b/goopdate/resources/goopdateres/generated_resources_ru.rc
deleted file mode 100644
index 7c2c5b8..0000000
--- a/goopdate/resources/goopdateres/generated_resources_ru.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_sk.rc b/goopdate/resources/goopdateres/generated_resources_sk.rc
deleted file mode 100644
index 01f80d4..0000000
--- a/goopdate/resources/goopdateres/generated_resources_sk.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_sl.rc b/goopdate/resources/goopdateres/generated_resources_sl.rc
deleted file mode 100644
index a43e1ff..0000000
--- a/goopdate/resources/goopdateres/generated_resources_sl.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_sr.rc b/goopdate/resources/goopdateres/generated_resources_sr.rc
deleted file mode 100644
index 50e9a6d..0000000
--- a/goopdate/resources/goopdateres/generated_resources_sr.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_sv.rc b/goopdate/resources/goopdateres/generated_resources_sv.rc
deleted file mode 100644
index 7a453f2..0000000
--- a/goopdate/resources/goopdateres/generated_resources_sv.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_sw.rc b/goopdate/resources/goopdateres/generated_resources_sw.rc
deleted file mode 100644
index 4e5f16a..0000000
--- a/goopdate/resources/goopdateres/generated_resources_sw.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_ta.rc b/goopdate/resources/goopdateres/generated_resources_ta.rc
deleted file mode 100644
index fe5b333..0000000
--- a/goopdate/resources/goopdateres/generated_resources_ta.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_te.rc b/goopdate/resources/goopdateres/generated_resources_te.rc
deleted file mode 100644
index fa241f0..0000000
--- a/goopdate/resources/goopdateres/generated_resources_te.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_th.rc b/goopdate/resources/goopdateres/generated_resources_th.rc
deleted file mode 100644
index a643c63..0000000
--- a/goopdate/resources/goopdateres/generated_resources_th.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_tr.rc b/goopdate/resources/goopdateres/generated_resources_tr.rc
deleted file mode 100644
index b80db8d..0000000
--- a/goopdate/resources/goopdateres/generated_resources_tr.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_uk.rc b/goopdate/resources/goopdateres/generated_resources_uk.rc
deleted file mode 100644
index 804e209..0000000
--- a/goopdate/resources/goopdateres/generated_resources_uk.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_ur.rc b/goopdate/resources/goopdateres/generated_resources_ur.rc
deleted file mode 100644
index 4ee8417..0000000
--- a/goopdate/resources/goopdateres/generated_resources_ur.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_vi.rc b/goopdate/resources/goopdateres/generated_resources_vi.rc
deleted file mode 100644
index f7f8b76..0000000
--- a/goopdate/resources/goopdateres/generated_resources_vi.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_zh-CN.rc b/goopdate/resources/goopdateres/generated_resources_zh-CN.rc
deleted file mode 100644
index c48d116..0000000
--- a/goopdate/resources/goopdateres/generated_resources_zh-CN.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/generated_resources_zh-TW.rc b/goopdate/resources/goopdateres/generated_resources_zh-TW.rc
deleted file mode 100644
index c883b15..0000000
--- a/goopdate/resources/goopdateres/generated_resources_zh-TW.rc
+++ /dev/null
Binary files differ
diff --git a/goopdate/resources/goopdateres/goopdate.grh b/goopdate/resources/goopdateres/goopdate.grh
deleted file mode 100644
index 063858e..0000000
--- a/goopdate/resources/goopdateres/goopdate.grh
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright 2007-2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-// This file is automatically generated by GRIT.  Do not edit.
-// Built on Fri Aug 12 10:57:04 2011
-
-#ifndef RESOURCE_48542623907__
-#define RESOURCE_48542623907__
-
-
-#define IDS_FRIENDLY_COMPANY_NAME 3000
-#define IDS_PRODUCT_DISPLAY_NAME 3001
-#define IDS_DEFAULT_APP_DISPLAY_NAME 3002
-#define IDS_APPLICATION_INSTALLED_SUCCESSFULLY 3003
-#define IDS_NO_UPDATE_RESPONSE 3004
-#define IDS_INSTALLER_OLD 3005
-#define IDS_SERVICE_NAME 3006
-#define IDS_SERVICE_DISPLAY_NAME 3007
-#define IDS_SERVICE_DESCRIPTION 3008
-#define IDS_SCHEDULED_TASK_DESCRIPTION 3009
-#define IDS_NO_NETWORK_PRESENT_ERROR 3010
-#define IDS_ERROR_HTTPSTATUS_UNAUTHORIZED 3011
-#define IDS_ERROR_HTTPSTATUS_FORBIDDEN 3012
-#define IDS_ERROR_HTTPSTATUS_PROXY_AUTH_REQUIRED 3013
-#define IDS_UNKNOWN_APPLICATION 3014
-#define IDS_RESTRICTED_RESPONSE_FROM_SERVER 3015
-#define IDS_NON_OK_RESPONSE_FROM_SERVER 3016
-#define IDS_OS_NOT_SUPPORTED 3017
-#define IDS_DOWNLOAD_HASH_MISMATCH 3018
-#define IDS_DOWNLOAD_ERROR 3019
-#define IDS_CACHING_ERROR 3020
-#define IDS_INVALID_INSTALLER_FILENAME 3021
-#define IDS_INSTALLER_FAILED_TO_START 3022
-#define IDS_INSTALLER_TIMED_OUT 3023
-#define IDS_INSTALLER_FAILED_WITH_MESSAGE 3024
-#define IDS_INSTALLER_FAILED_NO_MESSAGE 3025
-#define IDS_MSI_INSTALL_ALREADY_RUNNING 3026
-#define IDS_INSTALL_FAILED 3027
-#define IDS_CANCELED 3028
-#define IDS_APP_INSTALL_DISABLED_BY_GROUP_POLICY 3029
-#define IDS_INSTALLER_DISPLAY_NAME 3030
-#define IDS_INITIALIZING 3031
-#define IDS_WAITING_TO_CONNECT 3032
-#define IDS_DOWNLOAD_RETRY 3033
-#define IDS_WAITING_TO_DOWNLOAD 3034
-#define IDS_DOWNLOADING_SHORT 3035
-#define IDS_DOWNLOADING_LONG 3036
-#define IDS_DOWNLOADING_VERY_LONG 3037
-#define IDS_DOWNLOADING_COMPLETED 3038
-#define IDS_DOWNLOADING 3039
-#define IDS_WAITING_TO_INSTALL 3040
-#define IDS_INSTALLING 3041
-#define IDS_CANCELING 3043
-#define IDS_TEXT_RESTART_BROWSER 3044
-#define IDS_TEXT_RESTART_ALL_BROWSERS 3045
-#define IDS_TEXT_RESTART_COMPUTER 3046
-#define IDS_CLOSE 3047
-#define IDS_RESTART_NOW 3050
-#define IDS_RESTART_LATER 3051
-#define IDS_GET_HELP_TEXT 3052
-#define IDS_INSTALLATION_STOPPED_WINDOW_TITLE 3053
-#define IDS_INSTALL_STOPPED 3054
-#define IDS_RESUME_INSTALLATION 3055
-#define IDS_CANCEL_INSTALLATION 3056
-#define IDS_SPLASH_SCREEN_MESSAGE 3057
-#define IDS_CONTINUE_AS_NONADMIN 3058
-#define IDS_YES 3059
-#define IDS_NO 3060
-#define IDS_WINDOWS_IS_NOT_UP_TO_DATE 3061
-#define IDS_NEED_ADMIN_TO_INSTALL 3062
-#define IDS_SETUP_FAILED 3063
-#define IDS_ELEVATION_FAILED 3064
-#define IDS_APPLICATION_INSTALLING_GOOGLE_UPDATE 3065
-#define IDS_INSTANCES_RUNNING_AFTER_SHUTDOWN 3066
-#define IDS_APPLICATION_ALREADY_INSTALLING 3067
-#define IDS_HANDOFF_FAILED 3068
-#define IDS_USER_SHOULD_NOT_RUN_ELEVATED_WITH_UAC_ON 3069
-#define IDS_INSTALL_FAILED_WITH_ERROR_CODE 3070
-#define IDS_BUNDLE_INSTALLED_SUCCESSFULLY 3071
-#define IDS_BUNDLE_INSTALLED_SUCCESSFULLY_AFTER_CANCEL 3072
-#define IDS_BUNDLE_MIXED_RESULTS_MESSAGE_ONE_FAILURE 3073
-#define IDS_BUNDLE_MIXED_RESULTS_MESSAGE_MULTIPLE_FAILURES 3074
-#define IDS_BUNDLE_MIXED_RESULTS_SUCCEEDED_APPS 3075
-#define IDS_BUNDLE_MIXED_RESULTS_FAILED_APPS 3076
-#define IDS_BUNDLE_MIXED_RESULTS_CANCELED_APPS 3077
-#define IDS_APPLICATION_NAME_CONCATENATION 3078
-#define IDS_PROXY_PROMPT_MESSAGE 3079
-#define IDI_SUCCEESS 1000
-#define IDD_PROGRESS 2000
-#define IDC_CLOSE 2001
-#define IDC_BUTTON1 2002
-#define IDC_BUTTON2 2003
-#define IDC_PROGRESS 2004
-#define IDC_INSTALLER_STATE_TEXT 2005
-#define IDC_INFO_TEXT 2006
-#define IDC_PAUSE_RESUME_TEXT 2007
-#define IDC_COMPLETE_TEXT 2008
-#define IDC_ERROR_TEXT 2009
-#define IDC_GET_HELP_TEXT 2010
-#define IDC_IMAGE 2011
-#define IDD_INSTALL_STOPPED 2012
-#define IDC_INSTALL_STOPPED_TEXT 2013
-#define IDD_YES_NO 2014
-#define IDC_YES_NO_TEXT 2015
-
-#endif // RESOURCE_48542623907__
diff --git a/goopdate/resources/resdll_main.cc b/goopdate/resources/resdll_main.cc
deleted file mode 100644
index a1acecb..0000000
--- a/goopdate/resources/resdll_main.cc
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-
-// Disable the runtime checks.
-#pragma runtime_checks("", off)
-
-BOOL WINAPI DllEntry(HINSTANCE module, DWORD reason_for_call, void*) {
-  if (reason_for_call == DLL_PROCESS_ATTACH) {
-    ::DisableThreadLibraryCalls(module);
-  }
-  return TRUE;
-}
diff --git a/goopdate/resources/resource_only_dll.def b/goopdate/resources/resource_only_dll.def
deleted file mode 100644
index 078c46b..0000000
--- a/goopdate/resources/resource_only_dll.def
+++ /dev/null
@@ -1,16 +0,0 @@
-; Copyright 2007-2009 Google Inc.
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-;      http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-; ========================================================================
-;
-; dummy def file to create implib
diff --git a/goopdate/resources/success.ico b/goopdate/resources/success.ico
deleted file mode 100644
index 178e2b6..0000000
--- a/goopdate/resources/success.ico
+++ /dev/null
Binary files differ
diff --git a/goopdate/server_resource.h b/goopdate/server_resource.h
deleted file mode 100644
index 8f88763..0000000
--- a/goopdate/server_resource.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_SERVER_RESOURCE_H_
-#define OMAHA_GOOPDATE_SERVER_RESOURCE_H_
-
-#include "omaha/goopdate/resources/goopdateres/goopdate.grh"
-
-#endif  // OMAHA_GOOPDATE_SERVER_RESOURCE_H_
diff --git a/goopdate/string_formatter.cc b/goopdate/string_formatter.cc
deleted file mode 100644
index 19e3aba..0000000
--- a/goopdate/string_formatter.cc
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/string_formatter.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/utils.h"
-#include "omaha/goopdate/resource_manager.h"
-
-namespace omaha {
-
-StringFormatter::StringFormatter(const CString& language)
-    : language_(language) {
-  ASSERT1(!language.IsEmpty());
-}
-
-HRESULT StringFormatter::LoadString(int32 resource_id, CString* result) {
-  ASSERT1(result);
-
-  HINSTANCE resource_handle = NULL;
-  HRESULT hr = ResourceManager::Instance().GetResourceDll(language_,
-                                                          &resource_handle);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  const TCHAR* resource_string = NULL;
-  int string_length = ::LoadString(
-      resource_handle,
-      resource_id,
-      reinterpret_cast<TCHAR*>(&resource_string),
-      0);
-  if (string_length <= 0) {
-    return HRESULTFromLastError();
-  }
-  ASSERT1(resource_string && *resource_string);
-
-  // resource_string is the string starting point but not null-terminated, so
-  // explicitly copy from it for string_length characters.
-  result->SetString(resource_string, string_length);
-
-  return S_OK;
-}
-
-HRESULT StringFormatter::FormatMessage(CString* result, int32 format_id, ...) {
-  ASSERT1(result);
-  ASSERT1(format_id != 0);
-
-  CString format_string;
-  HRESULT hr = LoadString(format_id, &format_string);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  va_list arguments;
-  va_start(arguments, format_id);
-  result->FormatMessageV(format_string, &arguments);
-  va_end(arguments);
-
-  return S_OK;
-}
-
-}  // namespace omaha
diff --git a/goopdate/string_formatter.h b/goopdate/string_formatter.h
deleted file mode 100644
index 374d516..0000000
--- a/goopdate/string_formatter.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_STRING_FORMATTER_H_
-#define OMAHA_GOOPDATE_STRING_FORMATTER_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-class StringFormatter {
- public:
-  explicit StringFormatter(const CString& language);
-  ~StringFormatter() {}
-
-  // Loads string from the language resource DLL.
-  HRESULT LoadString(int32 resource_id, CString* result);
-
-  // Loads string for format_id from the language resource DLL and then use
-  // that as the format string to create the result string.
-  HRESULT FormatMessage(CString* result, int32 format_id, ...);
-
- private:
-  CString language_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(StringFormatter);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_STRING_FORMATTER_H_
diff --git a/goopdate/string_formatter_unittest.cc b/goopdate/string_formatter_unittest.cc
deleted file mode 100644
index 95d3c3e..0000000
--- a/goopdate/string_formatter_unittest.cc
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "base/scoped_ptr.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/string.h"
-#include "omaha/common/lang.h"
-#include "omaha/goopdate/resource_manager.h"
-#include "omaha/goopdate/server_resource.h"
-#include "omaha/goopdate/string_formatter.h"
-#include "omaha/testing/unit_test.h"
-
-using ::testing::_;
-
-namespace omaha {
-
-class StringFormatterTest : public testing::Test {
- protected:
-  StringFormatterTest() {}
-
-  static void SetUpTestCase() {
-    CString resource_dir = app_util::GetModuleDirectory(NULL);
-    EXPECT_HRESULT_SUCCEEDED(
-        ResourceManager::CreateForDefaultLanguage(false, resource_dir));
-  }
-  static void TearDownTestCase() {
-    ResourceManager::Delete();
-  }
-
-  virtual void SetUp() {}
-
-  virtual void TearDown() {}
-};
-
-TEST_F(StringFormatterTest, LoadStringTest) {
-  CString loaded_string;
-  StringFormatter formatter_en(_T("en"));
-  EXPECT_HRESULT_SUCCEEDED(formatter_en.LoadString(IDS_CLOSE, &loaded_string));
-  EXPECT_STREQ(_T("Close"), loaded_string);
-
-  StringFormatter formatter_de(_T("de"));
-  EXPECT_HRESULT_SUCCEEDED(
-      formatter_de.LoadString(IDS_DOWNLOADING, &loaded_string));
-  // The loaded string should keep the raw format ('%1!s!') untouched.
-  EXPECT_STREQ(_T("%1!s! wird heruntergeladen..."), loaded_string);
-
-  // Test that loading non-existing language resource returns error.
-  {
-    StringFormatter formatter_unknown(_T("non-existing"));
-    ExpectAsserts expect_asserts;
-    EXPECT_HRESULT_FAILED(
-        formatter_unknown.LoadString(IDS_CLOSE, &loaded_string));
-  }
-}
-
-TEST_F(StringFormatterTest, FormatMessageTest) {
-  CString format_result;
-
-  // Test FormatMessage loads string from correct language resource file.
-  StringFormatter formatter_en(_T("en"));
-  EXPECT_HRESULT_SUCCEEDED(
-      formatter_en.FormatMessage(&format_result, IDS_CLOSE));
-  EXPECT_STREQ(_T("Close"), format_result);
-
-  StringFormatter formatter_de(_T("de"));
-  EXPECT_HRESULT_SUCCEEDED(
-      formatter_de.FormatMessage(&format_result, IDS_CLOSE));
-  EXPECT_STREQ(_T("Schließen"), format_result);   // NOLINT
-
-  StringFormatter formatter_fr(_T("fr"));
-  EXPECT_HRESULT_SUCCEEDED(
-      formatter_fr.FormatMessage(&format_result, IDS_CLOSE));
-  EXPECT_STREQ(_T("Fermer"), format_result);
-
-  // Test FormatMessage with additional argument(s).
-  EXPECT_HRESULT_SUCCEEDED(formatter_en.FormatMessage(&format_result,
-                                                      IDS_DOWNLOADING,
-                                                      _T("English")));
-  EXPECT_STREQ(_T("Downloading English..."), format_result);
-
-  EXPECT_HRESULT_SUCCEEDED(formatter_de.FormatMessage(&format_result,
-                                                      IDS_DOWNLOADING,
-                                                      _T("German")));
-  EXPECT_STREQ(_T("German wird heruntergeladen..."), format_result);
-
-  EXPECT_HRESULT_SUCCEEDED(formatter_fr.FormatMessage(&format_result,
-                                                      IDS_DOWNLOADING,
-                                                      _T("French")));
-  EXPECT_STREQ(_T("Téléchargement de French..."), format_result);   // NOLINT
-}
-
-}  // namespace omaha
-
diff --git a/goopdate/update3web.cc b/goopdate/update3web.cc
deleted file mode 100644
index 7aefe69..0000000
--- a/goopdate/update3web.cc
+++ /dev/null
@@ -1,528 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/update3web.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/error.h"
-#include "omaha/base/user_rights.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/update3_utils.h"
-#include "omaha/common/lang.h"
-
-namespace omaha {
-
-namespace {
-
-template <typename Base, typename T, typename Z>
-HRESULT ComInitHelper(T data, Z** p) {
-  *p = NULL;
-  CComObject<Base>* object;
-  HRESULT hr = CComObject<Base>::CreateInstance(&object);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  CComPtr<IUnknown> object_releaser = object;
-  hr = object->Init(data);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  return object->QueryInterface(IID_PPV_ARGS(p));
-}
-
-class ATL_NO_VTABLE AppBundleWeb
-    : public CComObjectRootEx<CComObjectThreadModel>,
-      public IDispatchImpl<IAppBundleWeb,
-                           &__uuidof(IAppBundleWeb),
-                           &CAtlModule::m_libid,
-                           kMajorTypeLibVersion,
-                           kMinorTypeLibVersion> {
- public:
-  AppBundleWeb();
-  HRESULT Init(Update3WebBase* update3web);
-
-  DECLARE_NOT_AGGREGATABLE(AppBundleWeb);
-  DECLARE_NO_REGISTRY();
-
-  BEGIN_COM_MAP(AppBundleWeb)
-    COM_INTERFACE_ENTRY(IDispatch)
-    COM_INTERFACE_ENTRY(IAppBundleWeb)
-  END_COM_MAP()
-
-  STDMETHOD(createApp)(BSTR app_id, BSTR brand_code, BSTR language, BSTR ap);
-  STDMETHOD(createInstalledApp)(BSTR app_id);
-  STDMETHOD(createAllInstalledApps)();
-  STDMETHOD(get_displayLanguage)(BSTR* language);
-  STDMETHOD(put_displayLanguage)(BSTR language);
-  STDMETHOD(put_parentHWND)(ULONG_PTR hwnd);
-  STDMETHOD(get_length)(int* number);
-  STDMETHOD(get_appWeb)(int index, IDispatch** app_web);
-  STDMETHOD(initialize)();
-  STDMETHOD(checkForUpdate)();
-  STDMETHOD(download)();
-  STDMETHOD(install)();
-  STDMETHOD(pause)();
-  STDMETHOD(resume)();
-  STDMETHOD(cancel)();
-  STDMETHOD(downloadPackage)(BSTR app_id, BSTR package_name);
-  STDMETHOD(get_currentState)(VARIANT* current_state);
-
- protected:
-  virtual ~AppBundleWeb();
-
- private:
-  Update3WebBase* update3web_;
-  CComPtr<IAppBundle> app_bundle_;
-
-  DISALLOW_COPY_AND_ASSIGN(AppBundleWeb);
-};
-
-class ATL_NO_VTABLE AppWeb
-    : public CComObjectRootEx<CComObjectThreadModel>,
-      public IDispatchImpl<IAppWeb,
-                           &__uuidof(IAppWeb),
-                           &CAtlModule::m_libid,
-                           kMajorTypeLibVersion,
-                           kMinorTypeLibVersion> {
- public:
-  AppWeb();
-  HRESULT Init(IApp* app);
-
-  DECLARE_NOT_AGGREGATABLE(AppWeb);
-  DECLARE_NO_REGISTRY();
-
-  BEGIN_COM_MAP(AppWeb)
-    COM_INTERFACE_ENTRY(IDispatch)
-    COM_INTERFACE_ENTRY(IAppWeb)
-  END_COM_MAP()
-
-  STDMETHOD(get_appId)(BSTR* app_id);
-  STDMETHOD(get_currentVersionWeb)(IDispatch** current);
-  STDMETHOD(get_nextVersionWeb)(IDispatch** next);
-  STDMETHOD(cancel)();
-  STDMETHOD(get_currentState)(IDispatch** current_state);
-  STDMETHOD(launch)();
-  STDMETHOD(uninstall)();
-
- protected:
-  virtual ~AppWeb();
-
- private:
-  CComPtr<IApp> app_;
-
-  DISALLOW_COPY_AND_ASSIGN(AppWeb);
-};
-
-class ATL_NO_VTABLE AppVersionWeb
-    : public CComObjectRootEx<CComObjectThreadModel>,
-      public IDispatchImpl<IAppVersionWeb,
-                           &__uuidof(IAppVersionWeb),
-                           &CAtlModule::m_libid,
-                           kMajorTypeLibVersion,
-                           kMinorTypeLibVersion> {
- public:
-  AppVersionWeb();
-  HRESULT Init(IAppVersion* app_version);
-
-  DECLARE_NOT_AGGREGATABLE(AppVersionWeb);
-  DECLARE_NO_REGISTRY();
-
-  BEGIN_COM_MAP(AppVersionWeb)
-    COM_INTERFACE_ENTRY(IDispatch)
-    COM_INTERFACE_ENTRY(IAppVersionWeb)
-  END_COM_MAP()
-
-  STDMETHOD(get_version)(BSTR* version);
-  STDMETHOD(get_packageCount)(long* count);  // NOLINT
-  STDMETHOD(get_packageWeb)(long index, IDispatch** package);  // NOLINT
-
- protected:
-  virtual ~AppVersionWeb();
-
- private:
-  CComPtr<IAppVersion> app_version_;
-
-  DISALLOW_COPY_AND_ASSIGN(AppVersionWeb);
-};
-
-HRESULT AppBundleWeb::Init(Update3WebBase* update3web) {
-  ASSERT1(update3web);
-
-  update3web_ = update3web;
-  update3web_->AddRef();
-
-  HRESULT hr = update3_utils::CreateAppBundle(update3web_->omaha_server(),
-                                              &app_bundle_);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[CreateAppBundle failed][0x%x]"), hr));
-    return hr;
-  }
-
-  // ::CoSetProxyBlanket() settings are per proxy. For Update3Web, after
-  // unmarshaling the interface, we need to set the blanket on this new proxy.
-  // The proxy blanket on the IAppBundle interface are set explicitly for
-  // Update3Web, because Update3Web is a unique case of being a COM server as
-  // well as a COM client. The default security settings set for the Update3Web
-  // COM server are more restrictive and rightly so, as compared to the settings
-  // that we set for a COM client such as the Omaha3 UI. Hence the need to
-  // explicitly set the proxy blanket settings and lower the security
-  // requirements only when calling out on this interface.
-  hr = update3_utils::SetProxyBlanketAllowImpersonate(app_bundle_);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = app_bundle_->put_originURL(CComBSTR(update3web_->origin_url()));
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[put_originURL failed][0x%x]"), hr));
-    return hr;
-  }
-
-  hr = app_bundle_->put_displayLanguage(
-      CComBSTR(lang::GetLanguageForProcess(CString())));
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[put_displayLanguage failed][0x%x]"), hr));
-    return hr;
-  }
-
-  // TODO(omaha3): Expose setting the display name to the plugin client.
-  hr = app_bundle_->put_displayName(CComBSTR(_T("App")));
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[put_displayName failed][0x%x]"), hr));
-    return hr;
-  }
-
-  hr = app_bundle_->put_installSource(
-      CComBSTR(kCmdLineInstallSource_Update3Web));
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[put_installSource failed][0x%x]"), hr));
-    return hr;
-  }
-
-  if (update3web_->is_machine_install()) {
-    hr = app_bundle_->put_altTokens(
-        reinterpret_cast<ULONG_PTR>(update3web_->impersonation_token()),
-        reinterpret_cast<ULONG_PTR>(update3web_->primary_token()),
-        ::GetCurrentProcessId());
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[put_altTokens failed][0x%x]"), hr));
-      return hr;
-    }
-  }
-
-  return S_OK;
-}
-
-STDMETHODIMP AppBundleWeb::get_displayLanguage(BSTR* language) {
-  return app_bundle_->get_displayLanguage(language);
-}
-
-STDMETHODIMP AppBundleWeb::put_displayLanguage(BSTR language) {
-  return app_bundle_->put_displayLanguage(language);
-}
-
-STDMETHODIMP AppBundleWeb::put_parentHWND(ULONG_PTR hwnd) {
-  return app_bundle_->put_parentHWND(hwnd);
-}
-
-STDMETHODIMP AppBundleWeb::get_length(int* number) {
-  long long_number = 0;  // NOLINT(runtime/int)
-  HRESULT hr = app_bundle_->get_Count(&long_number);
-  *number = long_number;
-  return hr;
-}
-
-STDMETHODIMP AppBundleWeb::get_appWeb(int index, IDispatch** app_web) {
-  *app_web = NULL;
-
-  CComPtr<IApp> app;
-  HRESULT hr = update3_utils::GetApp(app_bundle_, index, &app);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[GetApp failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return ComInitHelper<AppWeb>(app.p, app_web);
-}
-
-AppBundleWeb::AppBundleWeb() : update3web_(NULL) {
-}
-
-STDMETHODIMP AppBundleWeb::createApp(BSTR app_id,
-                                     BSTR brand_code,
-                                     BSTR language,
-                                     BSTR ap) {
-  CComPtr<IApp> app;
-  HRESULT hr = update3_utils::CreateApp(app_id, app_bundle_, &app);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[CreateApp failed][0x%x]"), hr));
-    return hr;
-  }
-
-  hr = app->put_brandCode(brand_code);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = app->put_language(language);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = app->put_ap(ap);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = app->put_isEulaAccepted(VARIANT_TRUE);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = app_bundle_->put_installSource(
-      CComBSTR(kCmdLineInstallSource_Update3Web_NewApps));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return S_OK;
-}
-
-STDMETHODIMP AppBundleWeb::createInstalledApp(BSTR app_id) {
-  CComPtr<IApp> app;
-  HRESULT hr = update3_utils::CreateInstalledApp(app_id, app_bundle_, &app);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[CreateInstalledApp failed][0x%x]"), hr));
-    return hr;
-  }
-
-  hr = app_bundle_->put_installSource(
-      CComBSTR(kCmdLineInstallSource_Update3Web_OnDemand));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT AppBundleWeb::createAllInstalledApps() {
-  HRESULT hr = update3_utils::CreateAllInstalledApps(app_bundle_);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[CreateAllInstalledApps failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-AppBundleWeb::~AppBundleWeb() {
-  update3web_->Release();
-}
-
-STDMETHODIMP AppBundleWeb::initialize() {
-  return app_bundle_->initialize();
-}
-
-STDMETHODIMP AppBundleWeb::checkForUpdate() {
-  return app_bundle_->checkForUpdate();
-}
-
-STDMETHODIMP AppBundleWeb::download() {
-  return app_bundle_->download();
-}
-
-STDMETHODIMP AppBundleWeb::install() {
-  if (update3web_->is_machine_install() &&
-      !UserRights::TokenIsAdmin(update3web_->impersonation_token())) {
-    CORE_LOG(LE, (_T("[Need to be an admin to call this method]")));
-    return E_ACCESSDENIED;
-  }
-
-  return app_bundle_->install();
-}
-
-STDMETHODIMP AppBundleWeb::pause() {
-  return app_bundle_->pause();
-}
-
-STDMETHODIMP AppBundleWeb::resume() {
-  return app_bundle_->resume();
-}
-
-STDMETHODIMP AppBundleWeb::cancel() {
-  if (update3web_->is_machine_install() &&
-      !UserRights::TokenIsAdmin(update3web_->impersonation_token())) {
-    CORE_LOG(LE, (_T("[Need to be an admin to cancel]")));
-    return E_ACCESSDENIED;
-  }
-
-  return app_bundle_->stop();
-}
-
-STDMETHODIMP AppBundleWeb::downloadPackage(BSTR app_id, BSTR package_name) {
-  CORE_LOG(L1, (_T("[AppBundleWeb::downloadPackage][%s][%s]"),
-                app_id, package_name));
-
-  HRESULT hr = app_bundle_->put_installSource(
-      CComBSTR(kCmdLineInstallSource_Update3Web_Components));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return app_bundle_->downloadPackage(app_id, package_name);
-}
-
-STDMETHODIMP AppBundleWeb::get_currentState(VARIANT* current_state) {
-  return app_bundle_->get_currentState(current_state);
-}
-
-AppWeb::AppWeb() {
-}
-
-HRESULT AppWeb::Init(IApp* app) {
-  app_ = app;
-  return S_OK;
-}
-
-STDMETHODIMP AppWeb::get_appId(BSTR* app_id) {
-  ASSERT1(app_id);
-  return app_->get_appId(app_id);
-}
-
-STDMETHODIMP AppWeb::get_currentVersionWeb(IDispatch** current) {
-  ASSERT1(current);
-  *current = NULL;
-
-  CComPtr<IAppVersion> app_version;
-  HRESULT hr = update3_utils::GetCurrentAppVersion(app_, &app_version);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return ComInitHelper<AppVersionWeb>(app_version.p, current);
-}
-
-STDMETHODIMP AppWeb::get_nextVersionWeb(IDispatch** next) {
-  ASSERT1(next);
-  *next = NULL;
-
-  CComPtr<IAppVersion> app_version;
-  HRESULT hr = update3_utils::GetNextAppVersion(app_, &app_version);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return ComInitHelper<AppVersionWeb>(app_version.p, next);
-}
-
-STDMETHODIMP AppWeb::cancel() {
-  return E_NOTIMPL;
-}
-
-STDMETHODIMP AppWeb::get_currentState(IDispatch** current_state) {
-  *current_state = NULL;
-  return app_->get_currentState(current_state);
-}
-
-STDMETHODIMP AppWeb::launch() {
-  return E_NOTIMPL;
-}
-
-STDMETHODIMP AppWeb::uninstall() {
-  // This method should check for adminness when implemented.
-  return E_NOTIMPL;
-}
-
-AppWeb::~AppWeb() {
-}
-
-AppVersionWeb::AppVersionWeb() {
-}
-
-HRESULT AppVersionWeb::Init(IAppVersion* app_version) {
-  app_version_ = app_version;
-  return S_OK;
-}
-
-STDMETHODIMP AppVersionWeb::get_version(BSTR* version) {
-  return app_version_->get_version(version);
-}
-
-STDMETHODIMP AppVersionWeb::get_packageCount(long* count) {  // NOLINT
-  return app_version_->get_packageCount(count);
-}
-
-STDMETHODIMP AppVersionWeb::get_packageWeb(long index,  // NOLINT
-                                           IDispatch** package) {
-  UNREFERENCED_PARAMETER(index);
-  ASSERT1(package);
-  *package = NULL;
-
-  // TODO(omaha3): Implement this after a security review.
-  return E_NOTIMPL;
-}
-
-AppVersionWeb::~AppVersionWeb() {
-}
-
-}  // namespace
-
-HRESULT Update3WebBase::FinalConstruct() {
-  HRESULT hr =
-      update3_utils::CreateGoogleUpdate3Class(is_machine_, &omaha_server_);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Update3WebBase::FinalConstruct failed][0x%x]"), hr));
-    return hr;
-  }
-
-  if (!is_machine_) {
-    return S_OK;
-  }
-
-  hr = UserRights::GetCallerToken(&impersonation_token_);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[GetCallerToken failed][0x%x]"), hr));
-    return hr;
-  }
-
-  if (!impersonation_token_.CreatePrimaryToken(&primary_token_)) {
-    HRESULT hr = HRESULTFromLastError();
-    CORE_LOG(LE, (_T("[CreatePrimaryToken failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-STDMETHODIMP Update3WebBase::createAppBundleWeb(IDispatch** app_bundle_web) {
-  ASSERT1(app_bundle_web);
-
-  *app_bundle_web = NULL;
-
-  return ComInitHelper<AppBundleWeb>(this, app_bundle_web);
-}
-
-STDMETHODIMP Update3WebBase::setOriginURL(BSTR origin_url) {
-  CORE_LOG(L3, (_T("[Update3WebBase::setOriginURL][%s]"), origin_url));
-
-  if (!origin_url || !wcslen(origin_url)) {
-    return E_INVALIDARG;
-  }
-
-  origin_url_ = origin_url;
-  return S_OK;
-}
-
-}  // namespace omaha
-
diff --git a/goopdate/update3web.h b/goopdate/update3web.h
deleted file mode 100644
index d3e1d3f..0000000
--- a/goopdate/update3web.h
+++ /dev/null
@@ -1,158 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Defines the Google Update 3 web broker. It defines a narrow set of interfaces
-// to reduce the attack surface from low and medium integrity processes.
-// The web broker used to be a COM elevation point as well, but that
-// functionality has moved into the broker class factory. Note that since
-// Update3Web is a COM service now, ::CoSetProxyBlanket must be called on any
-// interfaces that need to impersonate.
-
-#ifndef OMAHA_GOOPDATE_UPDATE3WEB_H_
-#define OMAHA_GOOPDATE_UPDATE3WEB_H_
-
-#include <windows.h>
-#include <atlbase.h>
-#include <atlcom.h>
-#include "base/basictypes.h"
-#include "goopdate/omaha3_idl.h"
-#include "omaha/base/atlregmapex.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/preprocessor_fun.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/goopdate/com_proxy.h"
-#include "omaha/goopdate/non_localized_resource.h"
-
-namespace omaha {
-
-#pragma warning(push)
-// Construction of local static object is not thread-safe
-#pragma warning(disable:4640)
-
-class ATL_NO_VTABLE Update3WebBase
-    : public CComObjectRootEx<CComObjectThreadModel>,
-      public IDispatchImpl<IGoogleUpdate3Web,
-                           &__uuidof(IGoogleUpdate3Web),
-                           &CAtlModule::m_libid,
-                           kMajorTypeLibVersion,
-                           kMinorTypeLibVersion>,
-      public IGoogleUpdate3WebSecurity,
-      public StdMarshalInfo {
- public:
-  explicit Update3WebBase(bool is_machine) : StdMarshalInfo(is_machine),
-                                             is_machine_(is_machine) {}
-
-  BEGIN_COM_MAP(Update3WebBase)
-    COM_INTERFACE_ENTRY(IDispatch)
-    COM_INTERFACE_ENTRY(IGoogleUpdate3Web)
-    COM_INTERFACE_ENTRY(IGoogleUpdate3WebSecurity)
-    COM_INTERFACE_ENTRY(IStdMarshalInfo)
-  END_COM_MAP()
-
-  HRESULT FinalConstruct();
-
-  // IGoogleUpdate3Web
-  STDMETHOD(createAppBundleWeb)(IDispatch** app_bundle_web);
-
-  // IGoogleUpdate3WebSecurity
-  STDMETHOD(setOriginURL)(BSTR origin_url);
-
-  IGoogleUpdate3* omaha_server() const { return omaha_server_.p; }
-  HANDLE impersonation_token() const {
-    return impersonation_token_.GetHandle();
-  }
-  HANDLE primary_token() const { return primary_token_.GetHandle(); }
-  bool is_machine_install() const { return is_machine_; }
-  CString origin_url() const { return origin_url_; }
-
- protected:
-  virtual ~Update3WebBase() {}
-
- private:
-  CComPtr<IGoogleUpdate3> omaha_server_;
-  CAccessToken impersonation_token_;
-  CAccessToken primary_token_;
-  bool is_machine_;
-  CString origin_url_;
-
-  DISALLOW_COPY_AND_ASSIGN(Update3WebBase);
-};
-
-template <typename T>
-class ATL_NO_VTABLE Update3Web
-    : public Update3WebBase,
-      public CComCoClass<Update3Web<T> > {
- public:
-  Update3Web() : Update3WebBase(T::is_machine()) {}
-
-  DECLARE_NOT_AGGREGATABLE(Update3Web);
-  DECLARE_REGISTRY_RESOURCEID_EX(T::registry_res_id())
-
-  BEGIN_REGISTRY_MAP()
-    REGMAP_ENTRY(_T("HKROOT"), T::hk_root())
-    REGMAP_ENTRY(_T("VERSION"), _T("1.0"))
-    REGMAP_ENTRY(_T("PROGID"), T::prog_id())
-    REGMAP_ENTRY(_T("DESCRIPTION"), _T("GoogleUpdate Update3Web"))
-    REGMAP_ENTRY(_T("CLSID"), T::class_id())
-    REGMAP_MODULE2(_T("MODULE"), kOmahaOnDemandFileName)
-    REGMAP_ENTRY(_T("ICONRESID"), PP_STRINGIZE(IDI_ELEVATION_MONIKER_ICON))
-    REGMAP_ENTRY(_T("STRINGRESID"),
-                 PP_STRINGIZE(IDS_ELEVATION_MONIKER_DISPLAYNAME))
-  END_REGISTRY_MAP()
-
- protected:
-  virtual ~Update3Web() {}
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(Update3Web);
-};
-
-struct Update3WebModeUser {
-  static bool is_machine() { return false; }
-  static const TCHAR* const prog_id() { return kProgIDUpdate3WebUser; }
-  static GUID class_id() { return __uuidof(GoogleUpdate3WebUserClass); }
-  static UINT registry_res_id() { return IDR_LOCAL_SERVER_RGS; }
-  static const TCHAR* const hk_root() { return _T("HKCU"); }
-};
-
-struct Update3WebModeMachineFallback {
-  static bool is_machine() { return true; }
-  static const TCHAR* const prog_id() {
-    return kProgIDUpdate3WebMachineFallback;
-  }
-  static GUID class_id() {
-    return __uuidof(GoogleUpdate3WebMachineFallbackClass);
-  }
-  static UINT registry_res_id() { return IDR_LOCAL_SERVER_ELEVATION_RGS; }
-  static const TCHAR* const hk_root() { return _T("HKLM"); }
-};
-
-struct Update3WebModeService {
-  static bool is_machine() { return true; }
-  static const TCHAR* const prog_id() { return kProgIDUpdate3WebSvc; }
-  static GUID class_id() { return __uuidof(GoogleUpdate3WebServiceClass); }
-  static UINT registry_res_id() { return IDR_LOCAL_SERVICE_RGS; }
-  static const TCHAR* const hk_root() { return _T("HKLM"); }
-};
-
-typedef Update3Web<Update3WebModeUser> Update3WebUser;
-typedef Update3Web<Update3WebModeMachineFallback> Update3WebMachineFallback;
-typedef Update3Web<Update3WebModeService> Update3WebService;
-
-#pragma warning(pop)
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_UPDATE3WEB_H_
diff --git a/goopdate/update_request_utils.cc b/goopdate/update_request_utils.cc
deleted file mode 100644
index ebfb565..0000000
--- a/goopdate/update_request_utils.cc
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/update_request_utils.h"
-#include "omaha/base/logging.h"
-#include "omaha/goopdate/model.h"
-
-namespace omaha {
-
-namespace update_request_utils {
-
-void BuildRequest(const App* app,
-                  bool is_update_check,
-                  xml::UpdateRequest* update_request) {
-  ASSERT1(app);
-  ASSERT1(update_request);
-
-  if (!is_update_check && app->ping_events().empty()) {
-    return;
-  }
-
-  if (!app->is_eula_accepted()) {
-    CORE_LOG(L3, (_T("[App EULA not accepted - not including app in ping][%s]"),
-                  app->app_guid_string()));
-    return;
-  }
-
-  xml::request::App request_app;
-
-  // Pick up the current and next versions.
-  request_app.version       = app->current_version()->version();
-  request_app.next_version  = app->next_version()->version();
-
-  request_app.app_id        = app->app_guid_string();
-  request_app.lang          = app->language();
-  request_app.iid           = GuidToString(app->iid());
-  request_app.brand_code    = app->brand_code();
-  request_app.client_id     = app->client_id();
-  request_app.experiments   = app->GetExperimentLabels();
-  request_app.ap            = app->ap();
-
-  // referral_id is not sent.
-
-  request_app.install_time_diff_sec   = app->install_time_diff_sec();
-  request_app.data.install_data_index = app->server_install_data_index();
-
-  if (is_update_check) {
-    request_app.ping.active = app->did_run();
-    request_app.ping.days_since_last_active_ping  =
-        app->days_since_last_active_ping();
-    request_app.ping.days_since_last_roll_call    =
-        app->days_since_last_roll_call();
-
-    request_app.update_check.is_valid             = true;
-    request_app.update_check.is_update_disabled   =
-        FAILED(app->CheckGroupPolicy());
-    request_app.update_check.tt_token             = app->tt_token();
-  }
-
-  request_app.ping_events = app->ping_events();
-
-  update_request->AddApp(request_app);
-}
-
-}  // namespace update_request_utils
-
-}  // namespace omaha
diff --git a/goopdate/update_request_utils.h b/goopdate/update_request_utils.h
deleted file mode 100644
index 67ef6e0..0000000
--- a/goopdate/update_request_utils.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_UPDATE_REQUEST_UTILS_H_
-#define OMAHA_GOOPDATE_UPDATE_REQUEST_UTILS_H_
-
-#include <windows.h>
-#include "omaha/common/update_request.h"
-
-namespace omaha {
-
-class App;
-
-namespace update_request_utils {
-
-// TODO(omaha): missing unit test.
-//
-// Builds an UpdateRequest object by adding an xml request corresponding to
-// the App object passed as a parameter. This function avoids creating an empty
-// element in the cases where an update checks is not requested and no ping
-// events exist.
-void BuildRequest(const App* app,
-                  bool is_update_check,
-                  xml::UpdateRequest* update_request);
-
-}  // namespace update_request_utils
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_UPDATE_REQUEST_UTILS_H_
-
diff --git a/goopdate/update_request_utils_unittest.cc b/goopdate/update_request_utils_unittest.cc
deleted file mode 100644
index a2c59d4..0000000
--- a/goopdate/update_request_utils_unittest.cc
+++ /dev/null
@@ -1,204 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/reg_key.h"
-#include "omaha/common/const_group_policy.h"
-#include "omaha/common/update_response.h"
-#include "omaha/goopdate/app_manager.h"
-#include "omaha/goopdate/app_unittest_base.h"
-#include "omaha/goopdate/update_request_utils.h"
-#include "omaha/testing/unit_test.h"
-
-using ::testing::Return;
-
-namespace omaha {
-
-namespace update_request_utils {
-
-namespace {
-
-#define USER_UPDATE_KEY _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME _T("\\")
-#define APP_ID1 _T("{DDE97E2B-A82C-4790-A630-FCA02F64E8BE}");
-const TCHAR* const kAppId1 = APP_ID1
-const TCHAR* const kAppId1ClientsKeyPathUser =
-    USER_UPDATE_KEY _T("Clients\\") APP_ID1;
-const TCHAR* const kAppId1ClientStateKeyPathUser =
-    USER_UPDATE_KEY _T("ClientState\\") APP_ID1;
-const TCHAR* const kInstallPolicyApp1 = _T("Install") APP_ID1;
-const TCHAR* const kUpdatePolicyApp1 = _T("Update") APP_ID1;
-const TCHAR* const kAppDidRunValueName = _T("dr");
-
-void SetPolicy(const CString& policy, DWORD value) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kRegKeyGoopdateGroupPolicy,
-                                    policy,
-                                    value));
-}
-
-}  // namespace
-
-class UpdateRequestUtilsTest : public AppTestBaseWithRegistryOverride {
- protected:
-  UpdateRequestUtilsTest()
-      : AppTestBaseWithRegistryOverride(false,  // is_machine
-                                        true),  // use_strict_mock
-        app_(NULL) {}
-
-  virtual void SetUp() {
-    AppTestBaseWithRegistryOverride::SetUp();
-
-    update_request_.reset(xml::UpdateRequest::Create(is_machine_,
-                                                     _T("unittest"),
-                                                     _T("unittest"),
-                                                     CString()));
-
-    EXPECT_SUCCEEDED(
-        app_bundle_->createApp(CComBSTR(kAppId1), &app_));
-    ASSERT_TRUE(app_);
-  }
-
-  App* app_;
-  scoped_ptr<xml::UpdateRequest> update_request_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(UpdateRequestUtilsTest);
-};
-
-// TODO(omaha): write tests.
-
-// For now, this test is just checking !update_check.is_valid. Add more checks.
-TEST_F(UpdateRequestUtilsTest, BuildRequest_Ping) {
-  EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_TRUE));
-
-  PingEventPtr ping_event(
-      new PingEvent(PingEvent::EVENT_INSTALL_COMPLETE,
-                    PingEvent::EVENT_RESULT_ERROR, E_FAIL, 0));
-  app_->AddPingEvent(ping_event);
-
-  BuildRequest(app_, false, update_request_.get());
-
-  const xml::request::Request& request = update_request_->request();
-  ASSERT_EQ(1, request.apps.size());
-
-  const xml::request::App& app = request.apps[0];
-  const xml::request::UpdateCheck& update_check = app.update_check;
-  EXPECT_FALSE(update_check.is_valid);
-}
-
-TEST_F(UpdateRequestUtilsTest, BuildRequest_Ping_NoEvents) {
-  BuildRequest(app_, false, update_request_.get());
-
-  const xml::request::Request& request = update_request_->request();
-  ASSERT_EQ(0, request.apps.size());
-}
-
-TEST_F(UpdateRequestUtilsTest, BuildRequest_Ping_EulaNotAccepted) {
-  EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_FALSE));
-
-  PingEventPtr ping_event(
-      new PingEvent(PingEvent::EVENT_INSTALL_COMPLETE,
-                    PingEvent::EVENT_RESULT_ERROR, E_FAIL, 0));
-  app_->AddPingEvent(ping_event);
-
-  BuildRequest(app_, false, update_request_.get());
-
-  const xml::request::Request& request = update_request_->request();
-  ASSERT_EQ(0, request.apps.size());
-}
-
-// For now, this test is just checking is_update_disabled. Add more checks.
-TEST_F(UpdateRequestUtilsTest, BuildRequest_UpdateCheck) {
-  EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_TRUE));
-
-  BuildRequest(app_, true, update_request_.get());
-
-  const xml::request::Request& request = update_request_->request();
-  ASSERT_EQ(1, request.apps.size());
-
-  const xml::request::App& app = request.apps[0];
-  const xml::request::UpdateCheck& update_check = app.update_check;
-  EXPECT_TRUE(update_check.is_valid);
-  EXPECT_FALSE(update_check.is_update_disabled);
-}
-
-TEST_F(UpdateRequestUtilsTest,
-       BuildRequest_UpdateCheck_GroupPolicy_InstallDisabled) {
-  EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_TRUE));
-
-  SetPolicy(kInstallPolicyApp1, kPolicyDisabled);
-
-  BuildRequest(app_, true, update_request_.get());
-
-  const xml::request::Request& request = update_request_->request();
-  ASSERT_EQ(1, request.apps.size());
-
-  const xml::request::App& app = request.apps[0];
-  const xml::request::UpdateCheck& update_check = app.update_check;
-  EXPECT_TRUE(update_check.is_valid);
-  EXPECT_TRUE(update_check.is_update_disabled);
-}
-
-TEST_F(UpdateRequestUtilsTest,
-       BuildRequest_DoNotPickUpDidRunValueWhenNotDoingUpdateCheck) {
-  EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_TRUE));
-  PingEventPtr ping_event(
-      new PingEvent(PingEvent::EVENT_INSTALL_COMPLETE,
-                    PingEvent::EVENT_RESULT_ERROR, E_FAIL, 0));
-  app_->AddPingEvent(ping_event);
-
-  RegKey key;
-  ASSERT_SUCCEEDED(key.Create(kAppId1ClientStateKeyPathUser));
-  ASSERT_SUCCEEDED(key.SetValue(kAppDidRunValueName, _T("1")));
-  __mutexScope(app_->model()->lock());
-  AppManager::Instance()->ReadAppPersistentData(app_);
-
-  BuildRequest(app_, false, update_request_.get());
-
-  const xml::request::Request& request = update_request_->request();
-  ASSERT_EQ(1, request.apps.size());
-
-  const xml::request::Ping& ping = request.apps[0].ping;
-  EXPECT_EQ(ACTIVE_UNKNOWN, ping.active);
-  EXPECT_EQ(0, ping.days_since_last_active_ping);
-  EXPECT_EQ(0, ping.days_since_last_roll_call);
-}
-
-TEST_F(UpdateRequestUtilsTest,
-       BuildRequest_UpdateCheckShouldSendDidRunValue) {
-  EXPECT_SUCCEEDED(app_->put_isEulaAccepted(VARIANT_TRUE));
-  PingEventPtr ping_event(
-      new PingEvent(PingEvent::EVENT_INSTALL_COMPLETE,
-                    PingEvent::EVENT_RESULT_ERROR, E_FAIL, 0));
-  app_->AddPingEvent(ping_event);
-
-  RegKey key;
-  ASSERT_SUCCEEDED(key.Create(kAppId1ClientStateKeyPathUser));
-  ASSERT_SUCCEEDED(key.SetValue(kAppDidRunValueName, _T("1")));
-  __mutexScope(app_->model()->lock());
-  AppManager::Instance()->ReadAppPersistentData(app_);
-
-  BuildRequest(app_, true, update_request_.get());
-
-  const xml::request::Request& request = update_request_->request();
-  ASSERT_EQ(1, request.apps.size());
-
-  const xml::request::Ping& ping = request.apps[0].ping;
-  EXPECT_EQ(ACTIVE_RUN, ping.active);
-  EXPECT_EQ(-1, ping.days_since_last_active_ping);
-  EXPECT_EQ(-1, ping.days_since_last_roll_call);
-}
-
-}  // namespace update_request_utils
-
-}  // namespace omaha
diff --git a/goopdate/update_response_utils.cc b/goopdate/update_response_utils.cc
deleted file mode 100644
index 04a7a29..0000000
--- a/goopdate/update_response_utils.cc
+++ /dev/null
@@ -1,316 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/update_response_utils.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/common/lang.h"
-#include "omaha/common/experiment_labels.h"
-#include "omaha/goopdate/model.h"
-#include "omaha/goopdate/server_resource.h"
-#include "omaha/goopdate/string_formatter.h"
-
-namespace omaha {
-
-namespace update_response_utils {
-
-// TODO(omaha): unit test the functions below.
-
-// Returns a pointer to the app object corresponding to the appid in the
-// response object. Returns NULL if the app is not found.
-const xml::response::App* GetApp(const xml::response::Response& response,
-                                 const CString& appid) {
-  size_t app_index = 0;
-  for (; app_index < response.apps.size(); ++app_index) {
-    if (!appid.CompareNoCase(response.apps[app_index].appid)) {
-      return &response.apps[app_index];
-    }
-  }
-  return NULL;
-}
-
-HRESULT GetInstallData(const std::vector<xml::response::Data>& data,
-                       const CString& install_data_index,
-                       CString* install_data) {
-  ASSERT1(install_data);
-  if (install_data_index.IsEmpty()) {
-    return S_OK;
-  }
-
-  std::vector<xml::response::Data>::const_iterator it;
-  for (it = data.begin(); it != data.end(); ++it) {
-    if (install_data_index != it->install_data_index) {
-      continue;
-    }
-
-    if (it->status != kResponseStatusOkValue) {
-      ASSERT1(it->status == kResponseDataStatusNoData);
-      return GOOPDATE_E_INVALID_INSTALL_DATA_INDEX;
-    }
-
-    ASSERT1(!it->install_data.IsEmpty());
-    *install_data = it->install_data;
-    return S_OK;
-  }
-
-  return GOOPDATE_E_INVALID_INSTALL_DATA_INDEX;
-}
-
-// Check the outer elements first, then check any child elements only if the
-// outer element was successful.
-CString GetAppResponseStatus(const xml::response::App& app) {
-  if (_tcsicmp(kResponseStatusOkValue, app.status) != 0) {
-    ASSERT1(!app.status.IsEmpty());
-    return app.status;
-  }
-
-  if (!app.update_check.status.IsEmpty() &&
-      _tcsicmp(kResponseStatusOkValue, app.update_check.status) != 0) {
-    return app.update_check.status;
-  }
-
-  std::vector<xml::response::Data>::const_iterator data;
-  for (data = app.data.begin(); data != app.data.end(); ++data) {
-    if (!data->status.IsEmpty() &&
-        _tcsicmp(kResponseStatusOkValue, data->status) != 0) {
-      return data->status;
-    }
-  }
-
-  if (!app.ping.status.IsEmpty() &&
-      _tcsicmp(kResponseStatusOkValue, app.ping.status) != 0) {
-    return app.ping.status;
-  }
-
-  std::vector<xml::response::Event>::const_iterator it;
-  for (it = app.events.begin(); it != app.events.end(); ++it) {
-    if (!it->status.IsEmpty() &&
-        _tcsicmp(kResponseStatusOkValue, it->status) != 0) {
-      return it->status;
-    }
-  }
-
-  // TODO(omaha): verify that no other elements can report errors
-  // once we've finalized the protocol.
-
-  return app.status;
-}
-
-HRESULT BuildApp(const xml::UpdateResponse* update_response,
-                 HRESULT code,
-                 App* app) {
-  ASSERT1(update_response);
-  ASSERT1(SUCCEEDED(code) || code == GOOPDATE_E_NO_UPDATE_RESPONSE);
-  ASSERT1(app);
-
-  AppVersion* next_version = app->next_version();
-
-  const CString& app_id = app->app_guid_string();
-
-  const xml::response::App* response_app(GetApp(update_response->response(),
-                                                app_id));
-  ASSERT1(response_app);
-  const xml::response::UpdateCheck& update_check = response_app->update_check;
-
-  VERIFY1(SUCCEEDED(app->put_ttToken(CComBSTR(update_check.tt_token))));
-
-  if (code == GOOPDATE_E_NO_UPDATE_RESPONSE) {
-    return S_OK;
-  }
-
-  for (size_t i = 0; i < update_check.urls.size(); ++i) {
-    HRESULT hr = next_version->AddDownloadBaseUrl(update_check.urls[i]);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  for (size_t i = 0; i < update_check.install_manifest.packages.size(); ++i) {
-    const xml::InstallPackage& package(
-        update_check.install_manifest.packages[i]);
-    HRESULT hr = next_version->AddPackage(package.name,
-                                          package.size,
-                                          package.hash);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  CString server_install_data;
-  HRESULT hr = GetInstallData(response_app->data,
-                              app->server_install_data_index(),
-                              &server_install_data);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  app->set_server_install_data(server_install_data);
-
-  ASSERT1(!next_version->install_manifest());
-  next_version->set_install_manifest(
-      new xml::InstallManifest(update_check.install_manifest));
-
-  // TODO(omaha): it appears the version_ below holds either the manifest
-  // version or the "pv" version, written by the installer. If this is the case,
-  // then it is confusing and perhaps we need to have two different members to
-  // hold these values.
-  ASSERT1(next_version->version().IsEmpty());
-  next_version->set_version(next_version->install_manifest()->version);
-
-  return S_OK;
-}
-
-// "noupdate" is an error for fresh installs, but a successful completion in
-// the cases of silent and on demand updates. The caller is responsible for
-// interpreting "noupdate" as it sees fit.
-xml::UpdateResponseResult GetResult(const xml::UpdateResponse* update_response,
-                                    const CString& appid,
-                                    const CString& language) {
-  ASSERT1(update_response);
-  const xml::response::App* response_app(GetApp(update_response->response(),
-                                                appid));
-
-  StringFormatter formatter(language);
-  CString text;
-
-  if (!response_app) {
-    CORE_LOG(L1, (_T("[UpdateResponse::GetResult][app not found][%s]"), appid));
-    VERIFY1(SUCCEEDED(formatter.LoadString(IDS_UNKNOWN_APPLICATION, &text)));
-    return std::make_pair(GOOPDATE_E_NO_SERVER_RESPONSE, text);
-  }
-
-  const xml::response::UpdateCheck& update_check = response_app->update_check;
-  const CString& status = GetAppResponseStatus(*response_app);
-  const CString& display_name = update_check.install_manifest.name;
-
-  ASSERT1(!status.IsEmpty());
-  CORE_LOG(L1, (_T("[UpdateResponse::GetResult][%s][%s][%s]"),
-                appid, status, display_name));
-
-  // ok
-  if (_tcsicmp(kResponseStatusOkValue, status) == 0) {
-    return std::make_pair(S_OK, CString());
-  }
-
-  // noupdate
-  if (_tcsicmp(kResponseStatusNoUpdate, status) == 0) {
-    VERIFY1(SUCCEEDED(formatter.LoadString(IDS_NO_UPDATE_RESPONSE, &text)));
-    return std::make_pair(GOOPDATE_E_NO_UPDATE_RESPONSE, text);
-  }
-
-  // "restricted"
-  if (_tcsicmp(kResponseStatusRestrictedExportCountry, status) == 0) {
-    VERIFY1(SUCCEEDED(formatter.LoadString(IDS_RESTRICTED_RESPONSE_FROM_SERVER,
-                                           &text)));
-    return std::make_pair(GOOPDATE_E_RESTRICTED_SERVER_RESPONSE, text);
-  }
-
-  // "error-UnKnownApplication"
-  if (_tcsicmp(kResponseStatusUnKnownApplication, status) == 0) {
-    VERIFY1(SUCCEEDED(formatter.LoadString(IDS_UNKNOWN_APPLICATION, &text)));
-    return std::make_pair(GOOPDATE_E_UNKNOWN_APP_SERVER_RESPONSE, text);
-  }
-
-  // "error-OsNotSupported"
-  if (_tcsicmp(kResponseStatusOsNotSupported, status) == 0) {
-    const CString& error_url(update_check.error_url);
-    VERIFY1(SUCCEEDED(formatter.LoadString(IDS_OS_NOT_SUPPORTED, &text)));
-    if (!error_url.IsEmpty()) {
-      // TODO(omaha3): The error URL is no longer in the error string. Either
-      // we need to provide this URL to the client or we need to deprecate
-      // error_url and put this information in the Get Help redirect.
-      // Alternatively, we could have the COM server build error URLs in all
-      // cases. The current UI would still need to build an URL for the entire
-      // bundle, though, because it does not have per-app links.
-    }
-    return std::make_pair(GOOPDATE_E_OS_NOT_SUPPORTED, text);
-  }
-
-  // "error-internal"
-  if (_tcsicmp(kResponseStatusInternalError, status) == 0) {
-    VERIFY1(SUCCEEDED(formatter.FormatMessage(&text,
-                                              IDS_NON_OK_RESPONSE_FROM_SERVER,
-                                              status)));
-    return std::make_pair(GOOPDATE_E_INTERNAL_ERROR_SERVER_RESPONSE, text);
-  }
-
-  // "error-hash"
-  if (_tcsicmp(kResponseStatusHashError, status) == 0) {
-    VERIFY1(SUCCEEDED(formatter.FormatMessage(&text,
-                                              IDS_NON_OK_RESPONSE_FROM_SERVER,
-                                              status)));
-    return std::make_pair(GOOPDATE_E_SERVER_RESPONSE_NO_HASH, text);
-  }
-
-  // "error-unsupportedprotocol"
-  if (_tcsicmp(kResponseStatusUnsupportedProtocol, status) == 0) {
-    // TODO(omaha): Ideally, we would provide an app-specific URL instead of
-    // just the publisher name. If it was a link, we could use point to a
-    // redirect URL and provide the app GUID rather than somehow obtaining the
-    // app-specific URL.
-    VERIFY1(SUCCEEDED(formatter.FormatMessage(&text,
-                                              IDS_INSTALLER_OLD,
-                                              kShortCompanyName)));
-    return std::make_pair(GOOPDATE_E_SERVER_RESPONSE_UNSUPPORTED_PROTOCOL,
-                          text);
-  }
-
-  VERIFY1(SUCCEEDED(formatter.FormatMessage(&text,
-                                            IDS_NON_OK_RESPONSE_FROM_SERVER,
-                                            status)));
-  return std::make_pair(GOOPDATE_E_UNKNOWN_SERVER_RESPONSE, text);
-}
-
-bool IsOmahaUpdateAvailable(const xml::UpdateResponse* update_response) {
-  ASSERT1(update_response);
-  xml::UpdateResponseResult update_response_result(
-      update_response_utils::GetResult(update_response,
-                                       kGoogleUpdateAppId,
-                                       lang::GetDefaultLanguage(true)));
-  return update_response_result.first == S_OK;
-}
-
-HRESULT ApplyExperimentLabelDeltas(bool is_machine,
-                                   const xml::UpdateResponse* update_response) {
-  ASSERT1(update_response);
-
-  for (size_t app_index = 0;
-       app_index < update_response->response().apps.size();
-       ++app_index) {
-    const xml::response::App& app = update_response->response().apps[app_index];
-    if (!app.experiments.IsEmpty()) {
-      VERIFY1(IsGuid(app.appid));
-
-      ExperimentLabels labels;
-      VERIFY1(SUCCEEDED(labels.ReadFromRegistry(is_machine, app.appid)));
-
-      if (!labels.DeserializeAndApplyDelta(app.experiments)) {
-        return E_FAIL;
-      }
-
-      HRESULT hr = labels.WriteToRegistry(is_machine, app.appid);
-      if (FAILED(hr)) {
-        return hr;
-      }
-    }
-  }
-
-  return S_OK;
-}
-
-}  // namespace update_response_utils
-
-}  // namespace omaha
-
diff --git a/goopdate/update_response_utils.h b/goopdate/update_response_utils.h
deleted file mode 100644
index 18002ec..0000000
--- a/goopdate/update_response_utils.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_UPDATE_RESPONSE_UTILS_H_
-#define OMAHA_GOOPDATE_UPDATE_RESPONSE_UTILS_H_
-
-#include <windows.h>
-#include <vector>
-#include "omaha/common/update_response.h"
-
-namespace omaha {
-
-class App;
-
-namespace update_response_utils {
-
-const xml::response::App* GetApp(const xml::response::Response& response,
-                                 const CString& appid);
-
-// Retrieves the install_data string corresponding to the install_data_index
-// in the response data object. Returns an error if the status of the data
-// object is not ok or the index is not found.
-HRESULT GetInstallData(const std::vector<xml::response::Data>& data,
-                       const CString& index,
-                       CString* value);
-
-// Builds an App object from its corresponding representation in the
-// update response.
-HRESULT BuildApp(const xml::UpdateResponse* update_response,
-                 HRESULT code,
-                 App* app);
-
-// Returns the result of the update response for an app. The string member of
-// the result is formatted in the specified language.
-xml::UpdateResponseResult GetResult(const xml::UpdateResponse* update_response,
-                                    const CString& appid,
-                                    const CString& language);
-
-// Returns true if the update response contains an update for Omaha.
-bool IsOmahaUpdateAvailable(const xml::UpdateResponse* update_response);
-
-// Extracts a set of experiment label deltas from a response, merges them with
-// existing labels in the Registry, and writes the resulting set back.
-HRESULT ApplyExperimentLabelDeltas(bool is_machine,
-                                   const xml::UpdateResponse* update_response);
-
-}  // namespace update_response_utils
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_UPDATE_RESPONSE_UTILS_H_
-
diff --git a/goopdate/update_response_utils_unittest.cc b/goopdate/update_response_utils_unittest.cc
deleted file mode 100644
index 7d30005..0000000
--- a/goopdate/update_response_utils_unittest.cc
+++ /dev/null
@@ -1,211 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "base/scoped_ptr.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/error.h"
-#include "omaha/goopdate/resource_manager.h"
-#include "omaha/goopdate/update_response_utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace update_response_utils {
-
-using xml::UpdateResponseResult;
-
-namespace {
-
-const TCHAR* const kAppId1 = _T("{CE9C207B-232D-492b-AF03-E590A8FBE8FB}");
-const TCHAR* const kAppId2 = _T("{5881940A-72E4-4194-9DA5-4EA4089F867C}");
-const TCHAR* const kAppId3 = _T("{2DE92FA0-C8A1-4368-8654-16FDBA91817D}");
-
-const TCHAR* const kAppIdWithLowerCase =
-    _T("{C38D11BA-6244-45e3-AC2A-21F2077F2C10}");
-const TCHAR* const kAppIdWithLowerCaseAllUpperCase =
-    _T("{C38D11BA-6244-45E3-AC2A-21F2077F2C10}");
-
-
-const TCHAR* const kGOOPDATE_E_NO_SERVER_RESPONSEString =
-    _T("Installation failed due to a server side error. Please try again ")
-    _T("later. We apologize for the inconvenience.");
-
-const UpdateResponseResult kUpdateAvailableResult =
-    std::make_pair(S_OK, _T(""));
-
-const UpdateResponseResult kAppNotFoundResult = std::make_pair(
-      GOOPDATE_E_NO_SERVER_RESPONSE,
-      kGOOPDATE_E_NO_SERVER_RESPONSEString);
-
-}  // namespace
-
-
-class UpdateResponseUtilsGetResultTest : public testing::Test {
- protected:
-  virtual void SetUp() {
-    // Needed for error strings.
-    EXPECT_SUCCEEDED(ResourceManager::Create(
-      false, app_util::GetCurrentModuleDirectory(), _T("en")));
-
-    update_response_.reset(xml::UpdateResponse::Create());
-  }
-
-  virtual void TearDown() {
-    ResourceManager::Delete();
-  }
-
-  scoped_ptr<xml::UpdateResponse> update_response_;
-};
-
-
-// TODO(omaha): write tests.
-
-TEST(UpdateResponseUtilsGetAppTest, AppNotFound) {
-  xml::response::Response response;
-  xml::response::App app;
-  app.status = kResponseStatusOkValue;
-  app.appid = kAppId1;
-  response.apps.push_back(app);
-
-  EXPECT_TRUE(NULL != GetApp(response, kAppId1));
-  EXPECT_EQ(NULL, GetApp(response, kAppId2));
-}
-
-TEST(UpdateResponseUtilsGetAppTest, MultipleApps) {
-  xml::response::Response response;
-  xml::response::App app;
-  app.status = kResponseStatusOkValue;
-  app.appid = kAppId1;
-  response.apps.push_back(app);
-  app.appid = kAppId2;
-  response.apps.push_back(app);
-
-  EXPECT_EQ(&response.apps[0], GetApp(response, kAppId1));
-  EXPECT_EQ(&response.apps[1], GetApp(response, kAppId2));
-  EXPECT_EQ(&response.apps[1], GetApp(response, kAppId2));
-  EXPECT_EQ(&response.apps[0], GetApp(response, kAppId1));
-  EXPECT_NE(GetApp(response, kAppId1), GetApp(response, kAppId2));
-}
-
-TEST(UpdateResponseUtilsGetAppTest, ResponseAppIdHasLowerCase) {
-  xml::response::Response response;
-  xml::response::App app;
-  app.status = kResponseStatusOkValue;
-  app.appid = kAppIdWithLowerCase;
-  response.apps.push_back(app);
-
-  EXPECT_EQ(&response.apps[0], GetApp(response, kAppIdWithLowerCase));
-  EXPECT_EQ(&response.apps[0],
-            GetApp(response, kAppIdWithLowerCaseAllUpperCase));
-}
-
-TEST(UpdateResponseUtilsGetAppTest, ResponseAppIdAllUpperCase) {
-  xml::response::Response response;
-  xml::response::App app;
-  app.status = kResponseStatusOkValue;
-  app.appid = kAppIdWithLowerCaseAllUpperCase;
-  response.apps.push_back(app);
-
-  EXPECT_EQ(&response.apps[0],
-            GetApp(response, kAppIdWithLowerCaseAllUpperCase));
-  EXPECT_EQ(&response.apps[0], GetApp(response, kAppIdWithLowerCase));
-}
-
-TEST_F(UpdateResponseUtilsGetResultTest, EmptyResponse) {
-  EXPECT_TRUE(kAppNotFoundResult ==
-              GetResult(update_response_.get(), kAppId1, _T("en")));
-}
-
-TEST_F(UpdateResponseUtilsGetResultTest, AppFound) {
-  xml::response::Response response;
-  xml::response::App app;
-  app.status = kResponseStatusOkValue;
-  app.update_check.status = kResponseStatusOkValue;
-  app.appid = kAppId1;
-  response.apps.push_back(app);
-  SetResponseForUnitTest(update_response_.get(), response);
-
-  EXPECT_TRUE(kUpdateAvailableResult ==
-              GetResult(update_response_.get(), kAppId1, _T("en")));
-}
-
-TEST_F(UpdateResponseUtilsGetResultTest, AppNotFound) {
-  xml::response::Response response;
-  xml::response::App app;
-  app.status = kResponseStatusOkValue;
-  app.update_check.status = kResponseStatusOkValue;
-  app.appid = kAppId1;
-  response.apps.push_back(app);
-  SetResponseForUnitTest(update_response_.get(), response);
-
-  EXPECT_TRUE(kAppNotFoundResult ==
-              GetResult(update_response_.get(), kAppId2, _T("en")));
-}
-
-TEST_F(UpdateResponseUtilsGetResultTest, MultipleApps) {
-  xml::response::Response response;
-  xml::response::App app;
-  app.status = kResponseStatusOkValue;
-  app.update_check.status = kResponseStatusOkValue;
-  app.appid = kAppId1;
-  response.apps.push_back(app);
-  app.appid = kAppId2;
-  response.apps.push_back(app);
-  SetResponseForUnitTest(update_response_.get(), response);
-
-  EXPECT_TRUE(kUpdateAvailableResult ==
-              GetResult(update_response_.get(), kAppId1, _T("en")));
-  EXPECT_TRUE(kUpdateAvailableResult ==
-              GetResult(update_response_.get(), kAppId2, _T("en")));
-  EXPECT_TRUE(kAppNotFoundResult ==
-              GetResult(update_response_.get(), kAppId3, _T("en")));
-}
-
-TEST_F(UpdateResponseUtilsGetResultTest, ResponseAppIdHasLowerCase) {
-  xml::response::Response response;
-  xml::response::App app;
-  app.status = kResponseStatusOkValue;
-  app.appid = kAppIdWithLowerCase;
-  response.apps.push_back(app);
-  SetResponseForUnitTest(update_response_.get(), response);
-
-  EXPECT_TRUE(kUpdateAvailableResult ==
-              GetResult(update_response_.get(), kAppIdWithLowerCase, _T("en")));
-  EXPECT_TRUE(kUpdateAvailableResult ==
-              GetResult(update_response_.get(), kAppIdWithLowerCaseAllUpperCase,
-                        _T("en")));
-}
-
-TEST_F(UpdateResponseUtilsGetResultTest, ResponseAppIdAllUpperCase) {
-  xml::response::Response response;
-  xml::response::App app;
-  app.status = kResponseStatusOkValue;
-  app.appid = kAppIdWithLowerCaseAllUpperCase;
-  response.apps.push_back(app);
-  SetResponseForUnitTest(update_response_.get(), response);
-
-  EXPECT_TRUE(kUpdateAvailableResult ==
-              GetResult(update_response_.get(), kAppIdWithLowerCaseAllUpperCase,
-                        _T("en")));
-  EXPECT_TRUE(kUpdateAvailableResult ==
-              GetResult(update_response_.get(), kAppIdWithLowerCase, _T("en")));
-}
-
-// TODO(omaha3): Add tests for GetResult from Omaha2's job_creator_unittest.cc.
-
-}  // namespace update_response_utils
-
-}  // namespace omaha
diff --git a/goopdate/worker.cc b/goopdate/worker.cc
deleted file mode 100644
index 69821a6..0000000
--- a/goopdate/worker.cc
+++ /dev/null
@@ -1,977 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/worker.h"
-#include "omaha/goopdate/worker_internal.h"
-#include <atlbase.h>
-#include <atlstr.h>
-#include "omaha/base/app_util.h"
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/firewall_product_detection.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/path.h"
-#include "omaha/base/reactor.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/scoped_impersonation.h"
-#include "omaha/base/system.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/thread_pool_callback.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/app_registry_utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/event_logger.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/common/ping.h"
-#include "omaha/common/update_request.h"
-#include "omaha/common/update_response.h"
-#include "omaha/common/web_services_client.h"
-#include "omaha/goopdate/app_manager.h"
-#include "omaha/goopdate/download_manager.h"
-#include "omaha/goopdate/goopdate.h"
-#include "omaha/goopdate/install_manager.h"
-#include "omaha/goopdate/model.h"
-#include "omaha/goopdate/offline_utils.h"
-#include "omaha/goopdate/server_resource.h"
-#include "omaha/goopdate/string_formatter.h"
-#include "omaha/goopdate/update_request_utils.h"
-#include "omaha/goopdate/update_response_utils.h"
-#include "omaha/goopdate/worker_metrics.h"
-#include "omaha/goopdate/worker_utils.h"
-
-namespace omaha {
-
-namespace internal {
-
-void RecordUpdateAvailableUsageStats() {
-  AppManager& app_manager = *AppManager::Instance();
-
-  DWORD update_responses(0);
-  DWORD64 time_since_first_response_ms(0);
-  app_manager.ReadUpdateAvailableStats(kGoopdateGuid,
-                                       &update_responses,
-                                       &time_since_first_response_ms);
-  if (update_responses) {
-    metric_worker_self_update_responses = update_responses;
-  }
-  if (time_since_first_response_ms) {
-    metric_worker_self_update_response_time_since_first_ms =
-        time_since_first_response_ms;
-  }
-
-  AppIdVector registered_app_ids;
-  HRESULT hr = app_manager.GetRegisteredApps(&registered_app_ids);
-  if (FAILED(hr)) {
-    ASSERT1(false);
-    return;
-  }
-
-  // These store information about the app with the most update responses.
-  GUID max_responses_app(GUID_NULL);
-  DWORD max_responses(0);
-  DWORD64 max_responses_time_since_first_response_ms(0);
-
-  for (size_t i = 0; i < registered_app_ids.size(); ++i) {
-    const CString& app_id = registered_app_ids[i];
-    GUID app_guid = GUID_NULL;
-
-    if (FAILED(StringToGuidSafe(app_id, &app_guid))) {
-      ASSERT(false, (_T("Invalid App ID: %s"), app_id));
-      continue;
-    }
-
-    if (::IsEqualGUID(kGoopdateGuid, app_guid)) {
-      continue;
-    }
-
-    DWORD update_responses(0);
-    DWORD64 time_since_first_response_ms(0);
-    app_manager.ReadUpdateAvailableStats(app_guid,
-                                         &update_responses,
-                                         &time_since_first_response_ms);
-
-    if (max_responses < update_responses) {
-      max_responses_app = app_guid;
-      max_responses = update_responses;
-      max_responses_time_since_first_response_ms = time_since_first_response_ms;
-    }
-  }
-
-  if (max_responses) {
-    metric_worker_app_max_update_responses_app_high =
-        GetGuidMostSignificantUint64(max_responses_app);
-    metric_worker_app_max_update_responses = max_responses;
-    metric_worker_app_max_update_responses_ms_since_first =
-        max_responses_time_since_first_response_ms;
-  }
-}
-
-// Will block if any apps are being installed.
-HRESULT AddUninstalledAppsPings(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[AddUninstalledAppsPings]")));
-  ASSERT1(app_bundle);
-
-  AppManager& app_manager = *AppManager::Instance();
-
-  // Ensure that no installers are running while determining uninstalled apps
-  // and information about them.
-  __mutexScope(app_manager.GetRegistryStableStateLock());
-
-  AppIdVector uninstalled_app_ids;
-  HRESULT hr = app_manager.GetUninstalledApps(&uninstalled_app_ids);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[GetUninstalledApps failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  if (!uninstalled_app_ids.size()) {
-    return S_OK;
-  }
-
-  for (size_t i = 0; i < uninstalled_app_ids.size(); ++i) {
-    CString app_id = uninstalled_app_ids[i];
-    CORE_LOG(L3, (_T("[found uninstalled product][%s]"), app_id));
-
-    // Omaha uninstall ping is sent by the Uninstall function in setup.
-    if (app_id == kGoogleUpdateAppId) {
-      CORE_LOG(L3, (_T("[skipping Omaha]")));
-      continue;
-    }
-
-    App* app = NULL;
-    hr = app_bundle->CreateUninstalledApp(app_id, &app);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    PingEventPtr ping_event(
-        new PingEvent(PingEvent::EVENT_UNINSTALL,
-                      PingEvent::EVENT_RESULT_SUCCESS,
-                      0,    // error code
-                      0));  // extra code 1
-    app->AddPingEvent(ping_event);
-
-    // TODO(omaha3) It would be nice to call RemoveClientState() only after the
-    // uninstall ping is sent so that the values are not deleted if the ping
-    // fails. However, this would allow race conditions between installers
-    // and the uninstall ping unless app_manager.GetRegistryStableStateLock() is
-    // held from the ping building through the send, which is not currently
-    // feasible since the ping is sent in the AppBundle destructor, and the
-    // AppBundle's lifetime is controlled by the client. Improving the ping
-    // architecture, such as having a ping queue managed by the Worker, may
-    // enable this.
-    VERIFY1(SUCCEEDED(app_manager.RemoveClientState(app->app_guid())));
-  }
-
-  return S_OK;
-}
-
-HRESULT SendOemInstalledPing(bool is_machine, const CString& session_id) {
-  CORE_LOG(L3, (_T("[SendOemInstalledPing]")));
-
-  std::vector<CString> oem_installed_apps;
-  HRESULT hr = AppManager::Instance()->GetOemInstalledAndEulaAcceptedApps(
-      &oem_installed_apps);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  PingEventPtr oem_ping_event(
-      new PingEvent(PingEvent::EVENT_INSTALL_OEM_FIRST_CHECK,
-                    PingEvent::EVENT_RESULT_SUCCESS,
-                    0,
-                    0));
-  Ping ping(is_machine, session_id, CString());
-  ping.LoadAppDataFromRegistry(oem_installed_apps);
-  ping.BuildAppsPing(oem_ping_event);
-  hr = ping.Send(false);
-  if (FAILED(hr)) {
-    CORE_LOG(L3, (_T("[SendOemInstalledPing failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  AppManager::Instance()->ClearOemInstalled(oem_installed_apps);
-
-  return S_OK;
-}
-
-}  // namespace internal
-
-Worker::Worker()
-    : is_machine_(false) {
-  CORE_LOG(L1, (_T("[Worker::Worker]")));
-}
-
-Worker::~Worker() {
-  CORE_LOG(L1, (_T("[Worker::~Worker]")));
-
-  // TODO(omaha3): Remove when Run() is used. See TODO in GoogleUpdate::Main().
-  Stop();
-
-  AppManager::DeleteInstance();
-}
-
-Worker* const Worker::kInvalidInstance = reinterpret_cast<Worker* const>(-1);
-Worker* Worker::instance_              = NULL;
-
-Worker& Worker::Instance() {
-  // Getting the instance after the instance has been deleted is a bug in
-  // the logic of the program.
-  ASSERT1(instance_ != kInvalidInstance);
-  if (!instance_) {
-    instance_ = new Worker();
-  }
-  return *instance_;
-}
-
-int Worker::Lock() {
-  return _pAtlModule->Lock();
-}
-
-int Worker::Unlock() {
-  return _pAtlModule->Unlock();
-}
-
-HRESULT Worker::Initialize(bool is_machine) {
-  CORE_LOG(L1, (_T("[Worker::Initialize][%d]"), is_machine));
-
-  is_machine_ = is_machine;
-
-  reactor_.reset(new Reactor);
-  shutdown_handler_.reset(new ShutdownHandler);
-  model_.reset(new Model(this));
-
-  ASSERT1(!single_instance_.get());
-  NamedObjectAttributes attr;
-  GetNamedObjectAttributes(kGoogleUpdate3SingleInstance, is_machine, &attr);
-  single_instance_.reset(new ProgramInstance(attr.name));
-  if (!single_instance_.get()) {
-    CORE_LOG(LE, (_T("[Failed to create Worker Single Instance]")));
-    return E_OUTOFMEMORY;
-  }
-
-  if (!single_instance_->EnsureSingleInstance()) {
-    CORE_LOG(LW, (_T("[Another Worker instance already running]")));
-    return GOOPDATE_E_INSTANCES_RUNNING;
-  }
-
-  HRESULT hr = AppManager::CreateInstance(is_machine_);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  download_manager_.reset(new DownloadManager(is_machine_));
-
-  hr = download_manager_->Initialize();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  install_manager_.reset(new InstallManager(&model_->lock(), is_machine_));
-  hr = install_manager_->Initialize();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return S_OK;
-}
-
-void Worker::Stop() {
-  // Stop the concurrent objects to avoid spurious events.
-  shutdown_handler_.reset();
-  reactor_.reset();
-
-  // TODO(omaha3): Remove when Run() is used. See TODO in GoogleUpdate::Main().
-  // Until then this call is necessary to wait for threads to complete on
-  // destruction.
-  // TODO(omaha3): Is it correct that the thread pool does not wait for the
-  // threads if !shutdown_event_?
-  Goopdate::Instance().Stop();
-}
-
-HRESULT Worker::Run() {
-  HRESULT hr = DoRun();
-  Stop();
-
-  return hr;
-}
-
-HRESULT Worker::DoRun() {
-  CORE_LOG(L1, (_T("[Worker::DoRun]")));
-
-  HRESULT hr = InitializeShutDownHandler();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return hr;
-}
-
-HRESULT Worker::InitializeShutDownHandler() {
-  CORE_LOG(L3, (_T("[InitializeShutDownHandler]")));
-  return shutdown_handler_->Initialize(reactor_.get(), this, is_machine_);
-}
-
-HRESULT Worker::Shutdown() {
-  CORE_LOG(L2, (_T("[Worker::Shutdown]")));
-  return S_OK;
-}
-
-void Worker::CollectAmbientUsageStats() {
-#if 0
-  // The firewall detection code has been proved to block on some
-  // computers in the IWbemLocator::ConnectServer call even though a
-  // timeout was specified in the call.
-  CString name, version;
-  HRESULT hr = firewall_detection::Detect(&name, &version);
-  bool has_software_firewall = SUCCEEDED(hr) && !name.IsEmpty();
-  metric_worker_has_software_firewall.Set(has_software_firewall);
-#endif
-
-  if (System::IsRunningOnBatteries()) {
-    ++metric_worker_silent_update_running_on_batteries;
-  }
-
-  metric_worker_shell_version = app_util::GetVersionFromModule(NULL);
-
-  metric_worker_is_windows_installing.Set(IsWindowsInstalling());
-  metric_worker_is_uac_disabled.Set(vista_util::IsVistaOrLater() &&
-                                    !vista_util::IsUACMaybeOn());
-  metric_worker_is_clickonce_disabled.Set(IsClickOnceDisabled());
-}
-
-HRESULT Worker::CheckForUpdateAsync(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[Worker::CheckForUpdateAsync][0x%p]"), app_bundle));
-
-  ASSERT1(app_bundle);
-  ASSERT1(model_->IsLockedByCaller());
-
-  HRESULT hr = QueueDeferredFunctionCall0(app_bundle, &Worker::CheckForUpdate);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  for (size_t i = 0; i != app_bundle->GetNumberOfApps(); ++i) {
-    App* app = app_bundle->GetApp(i);
-    app->QueueUpdateCheck();
-  }
-
-  return S_OK;
-}
-
-void Worker::CheckForUpdate(shared_ptr<AppBundle> app_bundle) {
-  CORE_LOG(L3, (_T("[Worker::CheckForUpdate][0x%p]"), app_bundle.get()));
-  ASSERT1(app_bundle.get());
-
-  bool is_check_successful = false;
-  CheckForUpdateHelper(app_bundle.get(), &is_check_successful);
-
-  app_bundle->CompleteAsyncCall();
-}
-
-// *is_check_successful is true if the network request was successful and the
-// response was successfully parsed. The elements' status need not be success,
-// but an invalid response, such as HTML from a proxy, should result in false.
-// TODO(omaha): Unit test this by mocking update_check_client.
-void Worker::CheckForUpdateHelper(AppBundle* app_bundle,
-                                  bool* is_check_successful) {
-  ASSERT1(app_bundle);
-  ASSERT1(is_check_successful);
-  *is_check_successful = false;
-
-  if (ConfigManager::Instance()->CanUseNetwork(is_machine_)) {
-    VERIFY1(SUCCEEDED(internal::SendOemInstalledPing(
-        is_machine_, app_bundle->session_id())));
-  }
-
-  scoped_impersonation impersonate_user(app_bundle->impersonation_token());
-  HRESULT hr = impersonate_user.result();
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Impersonation failed][0x%08x]"), hr));
-    return;
-  }
-
-  scoped_ptr<xml::UpdateRequest> update_request(
-      xml::UpdateRequest::Create(is_machine_,
-                                 app_bundle->session_id(),
-                                 app_bundle->install_source(),
-                                 app_bundle->origin_url()));
-
-  scoped_ptr<xml::UpdateResponse> update_response(
-      xml::UpdateResponse::Create());
-
-  CallAsSelfAndImpersonate2(this,
-                            &Worker::DoPreUpdateCheck,
-                            app_bundle,
-                            update_request.get());
-
-  // This is a blocking call on the network.
-  hr = DoUpdateCheck(app_bundle,
-                     update_request.get(),
-                     update_response.get());
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[DoUpdateCheck failed][0x%08x]"), hr));
-  }
-  *is_check_successful = SUCCEEDED(hr);
-
-  CallAsSelfAndImpersonate3(this,
-                            &Worker::DoPostUpdateCheck,
-                            app_bundle,
-                            hr,
-                            update_response.get());
-
-  CString event_description;
-  event_description.Format(_T("Update check. Status = 0x%08x"), hr);
-  CString event_text;
-  CString url;
-  VERIFY1(SUCCEEDED(ConfigManager::Instance()->GetUpdateCheckUrl(&url)));
-  SafeCStringFormat(&event_text, _T("url=%s\n%s"),
-                    url,
-                    app_bundle->FetchAndResetLogText());
-
-  WriteEventLog(EVENTLOG_INFORMATION_TYPE,
-                kUpdateEventId,
-                event_description,
-                event_text);
-}
-
-HRESULT Worker::DownloadAsync(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[Worker::DownloadAsync][0x%p]"), app_bundle));
-
-  ASSERT1(app_bundle);
-  ASSERT1(model_->IsLockedByCaller());
-
-  HRESULT hr = QueueDeferredFunctionCall0(app_bundle, &Worker::Download);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  for (size_t i = 0; i != app_bundle->GetNumberOfApps(); ++i) {
-    App* app = app_bundle->GetApp(i);
-    app->QueueDownload();
-  }
-
-  return S_OK;
-}
-
-void Worker::Download(shared_ptr<AppBundle> app_bundle) {
-  CORE_LOG(L3, (_T("[Worker::Download][0x%p]"), app_bundle.get()));
-  ASSERT1(app_bundle.get());
-
-  scoped_impersonation impersonate_user(app_bundle->impersonation_token());
-  HRESULT hr = impersonate_user.result();
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Impersonation failed][0x%08x]"), hr));
-    return;
-  }
-
-  const size_t num_apps = app_bundle->GetNumberOfApps();
-
-  for (size_t i = 0; i != num_apps; ++i) {
-    App* app = app_bundle->GetApp(i);
-
-    ASSERT1(app->state() == STATE_WAITING_TO_DOWNLOAD ||
-            app->state() == STATE_NO_UPDATE ||
-            app->state() == STATE_ERROR);
-
-    // This is a blocking call on the network.
-    app->Download(download_manager_.get());
-
-    ASSERT1(app->state() == STATE_READY_TO_INSTALL ||
-            app->state() == STATE_NO_UPDATE ||
-            app->state() == STATE_ERROR);
-  }
-
-  WriteEventLog(EVENTLOG_INFORMATION_TYPE,
-                kDownloadEventId,
-                _T("Bundle download"),
-                app_bundle->FetchAndResetLogText());
-  app_bundle->CompleteAsyncCall();
-}
-
-HRESULT Worker::DownloadAndInstallAsync(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[Worker::DownloadAndInstallAsync][0x%p]"), app_bundle));
-
-  ASSERT1(app_bundle);
-  ASSERT1(model_->IsLockedByCaller());
-
-  HRESULT hr = QueueDeferredFunctionCall0(app_bundle,
-                                          &Worker::DownloadAndInstall);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  for (size_t i = 0; i != app_bundle->GetNumberOfApps(); ++i) {
-    App* app = app_bundle->GetApp(i);
-    // Queue the download or install depending on the current state. The correct
-    // one must be queued so that all apps are moved into waiting now and remain
-    // there until the download or install starts for that app.
-    app->QueueDownloadOrInstall();
-  }
-
-  return S_OK;
-}
-
-void Worker::DownloadAndInstall(shared_ptr<AppBundle> app_bundle) {
-  CORE_LOG(L3, (_T("[Worker::DownloadAndInstall][0x%p]"), app_bundle.get()));
-  ASSERT1(app_bundle.get());
-
-  DownloadAndInstallHelper(app_bundle.get());
-
-  app_bundle->CompleteAsyncCall();
-}
-
-void Worker::DownloadAndInstallHelper(AppBundle* app_bundle) {
-  ASSERT1(app_bundle);
-
-  scoped_impersonation impersonate_user(app_bundle->impersonation_token());
-  HRESULT hr = impersonate_user.result();
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Impersonation failed][0x%08x]"), hr));
-    return;
-  }
-
-  const size_t num_apps = app_bundle->GetNumberOfApps();
-
-  for (size_t i = 0; i != num_apps; ++i) {
-    App* app = app_bundle->GetApp(i);
-
-    ASSERT1(app->state() == STATE_WAITING_TO_DOWNLOAD ||
-            app->state() == STATE_WAITING_TO_INSTALL ||
-            app->state() == STATE_NO_UPDATE ||
-            app->state() == STATE_ERROR);
-
-    // Download the app if it has not already been downloaded.
-    // This is a blocking call on the network.
-    app->Download(download_manager_.get());
-
-    ASSERT1(app->state() == STATE_READY_TO_INSTALL ||    // Downloaded above.
-            app->state() == STATE_WAITING_TO_INSTALL ||  // Downloaded earlier.
-            app->state() == STATE_NO_UPDATE ||
-            app->state() == STATE_ERROR);
-
-    app->QueueInstall();
-
-    // This is a blocking call on the app installer.
-    CallAsSelfAndImpersonate1(
-        app,
-        &App::Install,
-        install_manager_.get());
-
-    ASSERT1(app->state() == STATE_INSTALL_COMPLETE ||
-            app->state() == STATE_NO_UPDATE ||
-            app->state() == STATE_ERROR);
-  }
-
-  WriteEventLog(EVENTLOG_INFORMATION_TYPE,
-                kUpdateEventId,
-                _T("Application update/install"),
-                app_bundle->FetchAndResetLogText());
-}
-
-
-HRESULT Worker::UpdateAllAppsAsync(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[Worker::UpdateAllAppsAsync][0x%p]"), app_bundle));
-
-  ASSERT1(app_bundle);
-  ASSERT1(model_->IsLockedByCaller());
-
-  HRESULT hr = QueueDeferredFunctionCall0(app_bundle, &Worker::UpdateAllApps);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  for (size_t i = 0; i != app_bundle->GetNumberOfApps(); ++i) {
-    App* app = app_bundle->GetApp(i);
-    app->QueueUpdateCheck();
-  }
-
-  return S_OK;
-}
-
-// Runs through all steps regardless of error. App state machine handles errors.
-void Worker::UpdateAllApps(shared_ptr<AppBundle> app_bundle) {
-  CORE_LOG(L3, (_T("[Worker::UpdateAllApps][0x%p]"), app_bundle.get()));
-  ASSERT1(app_bundle.get());
-
-  bool is_check_successful = false;
-  CheckForUpdateHelper(app_bundle.get(), &is_check_successful);
-
-  if (is_check_successful) {
-    HRESULT hr = goopdate_utils::UpdateLastChecked(is_machine_);
-    ASSERT(SUCCEEDED(hr), (_T("UpdateLastChecked failed with 0x%08x"), hr));
-  }
-
-  for (size_t i = 0; i != app_bundle->GetNumberOfApps(); ++i) {
-    App* app = app_bundle->GetApp(i);
-    app->QueueDownloadOrInstall();
-  }
-
-  DownloadAndInstallHelper(app_bundle.get());
-
-  internal::RecordUpdateAvailableUsageStats();
-  CollectAmbientUsageStats();
-
-  HRESULT hr = internal::AddUninstalledAppsPings(app_bundle.get());
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[AddUninstalledAppsPings failed][0x%08x]"), hr));
-  }
-
-  app_bundle->CompleteAsyncCall();
-}
-
-HRESULT Worker::DownloadPackageAsync(Package* package) {
-  ASSERT1(package);
-  AppBundle* app_bundle = package->app_version()->app()->app_bundle();
-  ASSERT1(app_bundle);
-
-  ASSERT1(model_->IsLockedByCaller());
-
-  CORE_LOG(L3, (_T("[Worker::DownloadPackageAsync][0x%p][0x%p]"),
-      app_bundle, package));
-
-  HRESULT hr = QueueDeferredFunctionCall1<Package*>(app_bundle,
-                                                    package,
-                                                    &Worker::DownloadPackage);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  App* app = package->app_version()->app();
-  app->QueueDownload();
-
-  return S_OK;
-}
-
-void Worker::DownloadPackage(shared_ptr<AppBundle> app_bundle,
-                             Package* package) {
-  CORE_LOG(L3, (_T("[Worker::DownloadPackage][0x%p][0x%p]"),
-      app_bundle.get(), package));
-  ASSERT1(app_bundle.get());
-  ASSERT1(package);
-
-  scoped_impersonation impersonate_user(app_bundle->impersonation_token());
-  HRESULT hr = impersonate_user.result();
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Impersonation failed][0x%08x]"), hr));
-    return;
-  }
-
-  UNREFERENCED_PARAMETER(package);
-
-  // TODO(omaha): implement downloading a package.
-
-  // TODO(omaha): The event log function should be modified depends on
-  // how the download is implemented.
-  //   * whether HRESULT is needed.
-  //   * whether the app_bundle has the log text.
-  //   * additional information needed?
-  CString event_text;
-  SafeCStringFormat(&event_text, _T("Package: %s\n%s"),
-                    package->filename(),
-                    app_bundle->FetchAndResetLogText());
-
-  WriteEventLog(EVENTLOG_INFORMATION_TYPE,
-                kDownloadEventId,
-                _T("Package download"),
-                event_text);
-  app_bundle->CompleteAsyncCall();
-}
-
-// TODO(omaha3): Implement this and enforce the postcondition that the
-// bundle object is not busy before the function returns.
-HRESULT Worker::Stop(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[Worker::Stop][0x%p]"), app_bundle));
-
-  ASSERT1(app_bundle);
-  ASSERT1(model_->IsLockedByCaller());
-
-  // Cancels update check client but not the ping client since we need to send
-  // cancellation ping.
-  WebServicesClientInterface* update_check_client(
-      app_bundle->update_check_client());
-  if (update_check_client) {
-    update_check_client->Cancel();
-  }
-
-  // TODO(omaha3): What do we do with active installs? We can at least cancel
-  // the InstallManager/InstallerWrapper if it has not started.
-
-  // Cancel any apps that might have pending operations.
-  for (size_t i = 0; i != app_bundle->GetNumberOfApps(); ++i) {
-    App* app = app_bundle->GetApp(i);
-    download_manager_->Cancel(app);
-    app->Cancel();
-  }
-
-  return S_OK;
-}
-
-HRESULT Worker::Pause(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[Worker::Pause][0x%p]"), app_bundle));
-  ASSERT1(app_bundle);
-  ASSERT1(model_->IsLockedByCaller());
-  UNREFERENCED_PARAMETER(app_bundle);
-
-  return E_NOTIMPL;
-}
-
-HRESULT Worker::Resume(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[Worker::Resume][0x%p]"), app_bundle));
-  ASSERT1(app_bundle);
-  ASSERT1(model_->IsLockedByCaller());
-  UNREFERENCED_PARAMETER(app_bundle);
-
-  return E_NOTIMPL;
-}
-
-HRESULT Worker::GetPackage(const Package* package, const CString& dir) {
-  CORE_LOG(L3, (_T("[Worker::GetPackage]")));
-  ASSERT1(model_->IsLockedByCaller());
-  return download_manager_->GetPackage(package, dir);
-}
-
-bool Worker::IsPackageAvailable(const Package* package) const {
-  CORE_LOG(L3, (_T("[Worker::IsPackageAvailable]")));
-  ASSERT1(model_->IsLockedByCaller());
-  return download_manager_->IsPackageAvailable(package);
-}
-
-HRESULT Worker::CacheOfflinePackages(AppBundle* app_bundle) {
-  CORE_LOG(L3, (_T("[Worker::CacheOfflinePackages]")));
-  ASSERT1(app_bundle);
-
-  for (size_t i = 0; i != app_bundle->GetNumberOfApps(); ++i) {
-    App* app = app_bundle->GetApp(i);
-    AppVersion* app_version = app->working_version();
-    const size_t num_packages = app_version->GetNumberOfPackages();
-
-    for (size_t i = 0; i < num_packages; ++i) {
-      Package* package(app_version->GetPackage(i));
-      if (download_manager_->IsPackageAvailable(package)) {
-        continue;
-      }
-
-      CString offline_app_dir = ConcatenatePath(app_bundle->offline_dir(),
-                                                app->app_guid_string());
-      CString offline_package_path = ConcatenatePath(offline_app_dir,
-                                                     package->filename());
-      if (!File::Exists(offline_package_path)) {
-        HRESULT hr = offline_utils::FindV2OfflinePackagePath(
-            offline_app_dir, &offline_package_path);
-        if (FAILED(hr)) {
-          CORE_LOG(LE, (_T("[FindOfflinePackagePath failed][0x%x]"), hr));
-          return hr;
-        }
-      }
-
-      HRESULT hr = download_manager_->CachePackage(package,
-                                                   &offline_package_path);
-      if (FAILED(hr)) {
-        CORE_LOG(LE, (_T("[CachePackage failed][%s][%s][0x%x][%Iu]"),
-                      app->app_guid_string(), offline_package_path, hr, i));
-        return hr;
-      }
-    }
-  }
-
-  return S_OK;
-}
-
-HRESULT Worker::PurgeAppLowerVersions(const CString& app_id,
-                                      const CString& version) {
-  return download_manager_->PurgeAppLowerVersions(app_id, version);
-}
-
-// metric_worker_apps_not_*ed_group_policy are integers, not a counter, so they
-// should be set to a value, not incremented. Otherwise the same app could be
-// counted twice if the same COM server instance was used for multiple bundles
-// of the same app(s). For this reason and to avoid overwriting valid counts
-// with 0, the number of disabled apps is accumulated then the appropriate
-// metric is set only if the count is non-zero.
-void Worker::DoPreUpdateCheck(AppBundle* app_bundle,
-                              xml::UpdateRequest* update_request) {
-  ASSERT1(app_bundle);
-  ASSERT1(update_request);
-
-  for (size_t i = 0; i != app_bundle->GetNumberOfApps(); ++i) {
-    App* app = app_bundle->GetApp(i);
-    app->PreUpdateCheck(update_request);
-  }
-
-  size_t num_disabled_apps = 0;
-  const std::vector<xml::request::App>& apps = update_request->request().apps;
-
-  // apps.size is 0 if update check was cancelled. Its size can also be less
-  // than the number of apps in app_bundle if EULA is not accepted for some
-  // apps.
-  ASSERT1(apps.size() <= app_bundle->GetNumberOfApps());
-
-  for (size_t i = 0; i != apps.size(); ++i) {
-    ASSERT1(apps[i].update_check.is_valid);
-    if (apps[i].update_check.is_update_disabled) {
-      ++num_disabled_apps;
-    }
-  }
-
-  if (num_disabled_apps) {
-    // Assumes that all apps are either updates or installs.
-    if (app_bundle->GetNumberOfApps() && app_bundle->GetApp(0)->is_update()) {
-      metric_worker_apps_not_updated_group_policy = num_disabled_apps;
-    } else {
-      metric_worker_apps_not_installed_group_policy = num_disabled_apps;
-    }
-  }
-}
-
-HRESULT Worker::DoUpdateCheck(AppBundle* app_bundle,
-                              const xml::UpdateRequest* update_request,
-                              xml::UpdateResponse* update_response) {
-  ASSERT1(app_bundle);
-  ASSERT1(update_request);
-  ASSERT1(update_response);
-
-  ASSERT1(app_bundle->GetNumberOfApps() > 0);
-
-  if (app_bundle->is_offline_install()) {
-    return offline_utils::ParseOfflineManifest(
-        app_bundle->GetApp(0)->app_guid_string(), app_bundle->offline_dir(),
-        update_response);
-  }
-
-  if (!ConfigManager::Instance()->CanUseNetwork(is_machine_)) {
-    CORE_LOG(L1, (_T("[Update check failed because network use prohibited]")));
-    return GOOPDATE_E_CANNOT_USE_NETWORK;
-  }
-
-  const bool is_update = app_bundle->is_auto_update();
-
-  if (is_update) {
-    ++metric_worker_update_check_total;
-  }
-
-  // This is a blocking call on the network.
-  HRESULT hr = app_bundle->update_check_client()->Send(update_request,
-                                                       update_response);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Send failed][0x%08x]"), hr));
-    worker_utils::AddHttpRequestDataToEventLog(
-        hr,
-        app_bundle->update_check_client()->http_status_code(),
-        app_bundle->update_check_client()->http_trace(),
-        is_machine_);
-
-    // TODO(omaha3): Omaha 2 would launch a web browser here for installs by
-    // calling goopdate_utils::LaunchBrowser(). Browser launch needs to be in
-    // the client but it currently has no way of knowing that it was a network
-    // error. Even here, we don't know that the it wasn't a parsing, etc. error.
-    return hr;
-  }
-
-  if (is_update) {
-    ++metric_worker_update_check_succeeded;
-  }
-
-  return S_OK;
-}
-
-void Worker::DoPostUpdateCheck(AppBundle* app_bundle,
-                               HRESULT update_check_result,
-                               xml::UpdateResponse* update_response) {
-  ASSERT1(app_bundle);
-  ASSERT1(update_response);
-
-  VERIFY1(SUCCEEDED(update_response_utils::ApplyExperimentLabelDeltas(
-      is_machine_,
-      update_response)));
-
-  for (size_t i = 0; i != app_bundle->GetNumberOfApps(); ++i) {
-    App* app = app_bundle->GetApp(i);
-    app->PostUpdateCheck(update_check_result, update_response);
-
-    ASSERT(app->state() == STATE_UPDATE_AVAILABLE ||
-           app->state() == STATE_NO_UPDATE ||
-           app->state() == STATE_ERROR,
-           (_T("App %Iu state is %u"), i, app->state()));
-  }
-
-  if (app_bundle->is_offline_install()) {
-    VERIFY1(SUCCEEDED(CacheOfflinePackages(app_bundle)));
-    VERIFY1(SUCCEEDED(DeleteDirectory(app_bundle->offline_dir())));
-  }
-}
-
-// Creates a thread pool work item for deferred execution of deferred_function.
-// The thread pool owns this callback object.
-HRESULT Worker::QueueDeferredFunctionCall0(
-    AppBundle* app_bundle,
-    void (Worker::*deferred_function)(shared_ptr<AppBundle>)) {
-  ASSERT1(app_bundle);
-  ASSERT1(deferred_function);
-
-  typedef ThreadPoolCallBack1<Worker, shared_ptr<AppBundle> > Callback;
-  scoped_ptr<Callback> callback(new Callback(this,
-                                             deferred_function,
-                                             app_bundle->controlling_ptr()));
-  HRESULT hr = Goopdate::Instance().QueueUserWorkItem(callback.get(),
-                                                      WT_EXECUTELONGFUNCTION);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Transfers the ownership of the callback from Worker to ThreadPool.
-  app_bundle->set_user_work_item(callback.release());
-  return S_OK;
-}
-
-// Creates a thread pool work item for deferred execution of deferred_function.
-// The thread pool owns this callback object.
-template <typename P1>
-HRESULT Worker::QueueDeferredFunctionCall1(
-    AppBundle* app_bundle,
-    P1 p1,
-    void (Worker::*deferred_function)(shared_ptr<AppBundle>, P1)) {
-  ASSERT1(app_bundle);
-  ASSERT1(deferred_function);
-
-  typedef ThreadPoolCallBack2<Worker, shared_ptr<AppBundle>, P1> Callback;
-  scoped_ptr<Callback> callback(new Callback(this,
-                                             deferred_function,
-                                             app_bundle->controlling_ptr(),
-                                             p1));
-  HRESULT hr = Goopdate::Instance().QueueUserWorkItem(callback.get(),
-                                                      WT_EXECUTELONGFUNCTION);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Transfers the ownership of the callback from Worker to ThreadPool.
-  app_bundle->set_user_work_item(callback.release());
-  return S_OK;
-}
-
-void Worker::WriteEventLog(int event_type,
-                           int event_id,
-                           const CString& event_description,
-                           const CString& event_text) {
-  GoogleUpdateLogEvent log_event(event_type, event_id, is_machine_);
-  log_event.set_event_desc(event_description);
-  log_event.set_event_text(event_text);
-  log_event.WriteEvent();
-}
-
-}  // namespace omaha
diff --git a/goopdate/worker.h b/goopdate/worker.h
deleted file mode 100644
index 2bd364f..0000000
--- a/goopdate/worker.h
+++ /dev/null
@@ -1,219 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_WORKER_H_
-#define OMAHA_GOOPDATE_WORKER_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-#include "omaha/base/program_instance.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/shutdown_callback.h"
-#include "omaha/base/shutdown_handler.h"
-#include "omaha/base/wtl_atlapp_wrapper.h"
-#include "third_party/bar/shared_ptr.h"
-
-namespace omaha {
-
-namespace xml {
-
-class UpdateRequest;
-class UpdateResponse;
-
-}  // namespace xml
-
-class AppBundle;
-class DownloadManagerInterface;
-class InstallManagerInterface;
-class Model;
-class Package;
-class Reactor;
-
-// Limited subset of Worker interface that the Model needs.
-class WorkerModelInterface {
- public:
-  virtual ~WorkerModelInterface() {}
-  virtual HRESULT CheckForUpdateAsync(AppBundle* app_bundle) = 0;
-  virtual HRESULT DownloadAsync(AppBundle* app_bundle) = 0;
-  virtual HRESULT DownloadAndInstallAsync(AppBundle* app_bundle) = 0;
-  virtual HRESULT UpdateAllAppsAsync(AppBundle* app_bundle) = 0;
-  virtual HRESULT DownloadPackageAsync(Package* package) = 0;
-  virtual HRESULT Stop(AppBundle* app_bundle) = 0;
-  virtual HRESULT Pause(AppBundle* app_bundle) = 0;
-  virtual HRESULT Resume(AppBundle* app_bundle) = 0;
-  virtual HRESULT GetPackage(const Package* package, const CString& dir) = 0;
-  virtual bool IsPackageAvailable(const Package* package) const = 0;
-  virtual HRESULT PurgeAppLowerVersions(const CString& app_id,
-                                        const CString& version) = 0;
-  virtual int Lock() = 0;
-  virtual int Unlock() = 0;
-};
-
-// Worker is a singleton.
-class Worker : public WorkerModelInterface, public ShutdownCallback {
- public:
-  // Instance, Initialize, and DeleteInstance methods below are not thread safe.
-  // The caller must initialize and cleanup the instance before going
-  // multithreaded.
-
-  // Gets the singleton instance of the class.
-  static Worker& Instance();
-
-  // Initializes the instance.
-  HRESULT Initialize(bool is_machine);
-
-  // Cleans up the class instance.
-  static void DeleteInstance();
-
-  HRESULT Run();
-
-  HRESULT Shutdown();
-  HRESULT InitializeShutDownHandler();
-
-  // TODO(omaha): not clear how to make this an atomic operation. Consider
-  // making the model instance a bare pointer instead of smart pointer.
-  Model* model() { return model_.get(); }
-  const Model* model() const { return model_.get(); }
-
-  // Initiates an update check for all apps in the bundle.
-  virtual HRESULT CheckForUpdateAsync(AppBundle* app_bundle);
-
-  // Initiates download of files necessary to install all apps in the bundle.
-  virtual HRESULT DownloadAsync(AppBundle* app_bundle);
-
-  // Initiates Download, if necessary, and install all app in the bundle.
-  virtual HRESULT DownloadAndInstallAsync(AppBundle* app_bundle);
-
-  // Initiates an update of all registered apps and performs periodic tasks
-  // related to all apps. Primarily for use by Omaha's /ua client. Includes
-  // update check, download and install.
-  virtual HRESULT UpdateAllAppsAsync(AppBundle* app_bundle);
-
-  // Initiates download of a package.
-  virtual HRESULT DownloadPackageAsync(Package* package);
-
-  virtual HRESULT Stop(AppBundle* app_bundle);
-  virtual HRESULT Pause(AppBundle* app_bundle);
-  virtual HRESULT Resume(AppBundle* app_bundle);
-
-  virtual HRESULT GetPackage(const Package*, const CString& dir);
-
-  virtual bool IsPackageAvailable(const Package* package) const;
-
-  virtual HRESULT PurgeAppLowerVersions(const CString& app_id,
-                                        const CString& version);
-
-  // Locks and unlocks the server module by incrementing or decrementing
-  // the lock count of the module.
-  virtual int Lock();
-  virtual int Unlock();
-
- private:
-  Worker();
-  ~Worker();
-
-  HRESULT DoRun();
-
-  // These functions execute code in the thread pool. They hold an outstanding
-  // reference to the application bundle to prevent the application bundle
-  // object from being deleted before the functions complete.
-  void CheckForUpdate(shared_ptr<AppBundle> app_bundle);
-  void Download(shared_ptr<AppBundle> app_bundle);
-  void DownloadAndInstall(shared_ptr<AppBundle> app_bundle);
-  void DownloadPackage(shared_ptr<AppBundle> app_bundle, Package* package);
-  void UpdateAllApps(shared_ptr<AppBundle> app_bundle);
-
-  // These functions do the work for the corresponding functions but do not call
-  // CompleteAsyncCall().
-  void CheckForUpdateHelper(AppBundle* app_bundle, bool* is_check_successful);
-  void DownloadAndInstallHelper(AppBundle* app_bundle);
-
-  // Stops and destroys the Worker and its members.
-  // TODO(omaha): rename this as it overloads WorkerModelInterface::Stop.
-  void Stop();
-
-  bool EnsureSingleInstance();
-
-  void CollectAmbientUsageStats();
-
-  void DoPreUpdateCheck(AppBundle* app_bundle,
-                        xml::UpdateRequest* update_request);
-
-  HRESULT CacheOfflinePackages(AppBundle* app_bundle);
-
-  HRESULT DoUpdateCheck(AppBundle* app_bundle,
-                        const xml::UpdateRequest* update_request,
-                        xml::UpdateResponse* update_response);
-  void DoPostUpdateCheck(AppBundle* app_bundle,
-                         HRESULT update_check_result,
-                         xml::UpdateResponse* update_response);
-
-  HRESULT QueueDeferredFunctionCall0(
-      AppBundle* app_bundle,
-      void (Worker::*deferred_function)(shared_ptr<AppBundle>));
-
-  template <typename P1>
-  HRESULT QueueDeferredFunctionCall1(
-      AppBundle* app_bundle,
-      P1 p1,
-      void (Worker::*deferred_function)(shared_ptr<AppBundle>, P1));
-
-  void WriteEventLog(int event_type,
-                     int event_id,
-                     const CString& event_description,
-                     const CString& event_text);
-
-  bool is_machine_;
-  scoped_ptr<ProgramInstance> single_instance_;
-  scoped_ptr<Reactor>         reactor_;
-  scoped_ptr<ShutdownHandler> shutdown_handler_;
-  scoped_ptr<Model>           model_;
-  scoped_ptr<DownloadManagerInterface> download_manager_;
-  scoped_ptr<InstallManagerInterface> install_manager_;
-
-  CMessageLoop message_loop_;
-
-  static Worker* const kInvalidInstance;
-  static Worker* instance_;
-
-  friend class WorkerTest;
-
-  DISALLOW_COPY_AND_ASSIGN(Worker);
-};
-
-// For unittests, where creation and termination of Worker instances may be
-// required, the implementation disables the dead reference detection. This
-// forces an inline of the code below for unit tests, so different behavior
-// can be achieved, even though the rest of the implementation compiles in
-// a library. It is somehow brittle but good enough for now.
-
-#ifdef UNITTEST
-__forceinline
-#else
-  inline
-#endif
-void Worker::DeleteInstance() {
-  delete instance_;
-#ifdef UNITTEST
-  instance_ = NULL;
-#else
-  instance_ = kInvalidInstance;
-#endif
-}
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_WORKER_H_
diff --git a/goopdate/worker_internal.h b/goopdate/worker_internal.h
deleted file mode 100644
index fe48e4b..0000000
--- a/goopdate/worker_internal.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_WORKER_INTERNAL_H_
-#define OMAHA_GOOPDATE_WORKER_INTERNAL_H_
-
-#include <windows.h>
-
-namespace omaha {
-
-namespace xml {
-
-class UpdateRequest;
-
-}  // namespace xml
-
-namespace internal {
-
-void RecordUpdateAvailableUsageStats();
-
-// Looks for uninstalled apps, adds them to app_bundle and adds an uninstall
-// event to each. The pings will be sent along with other pings when app_bundle
-// is destroyed.
-HRESULT AddUninstalledAppsPings(AppBundle* app_bundle);
-
-}  // namespace internal
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_WORKER_INTERNAL_H_
diff --git a/goopdate/worker_metrics.cc b/goopdate/worker_metrics.cc
deleted file mode 100644
index 330925d..0000000
--- a/goopdate/worker_metrics.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/goopdate/worker_metrics.h"
-
-namespace omaha {
-
-DEFINE_METRIC_count(worker_download_total);
-DEFINE_METRIC_count(worker_download_succeeded);
-
-DEFINE_METRIC_count(worker_package_cache_put_total);
-DEFINE_METRIC_count(worker_package_cache_put_succeeded);
-
-DEFINE_METRIC_count(worker_install_execute_total);
-DEFINE_METRIC_count(worker_install_execute_msi_total);
-
-DEFINE_METRIC_count(worker_install_msi_in_progress_detected_update);
-DEFINE_METRIC_count(worker_install_msi_in_progress_retry_succeeded_update);
-DEFINE_METRIC_integer(
-    worker_install_msi_in_progress_retry_succeeded_tries_update);
-
-DEFINE_METRIC_count(worker_install_msi_in_progress_detected_install);
-DEFINE_METRIC_count(worker_install_msi_in_progress_retry_succeeded_install);
-DEFINE_METRIC_integer(
-    worker_install_msi_in_progress_retry_succeeded_tries_install);
-
-DEFINE_METRIC_integer(worker_shell_version);
-
-DEFINE_METRIC_bool(worker_is_windows_installing);
-
-DEFINE_METRIC_bool(worker_is_uac_disabled);
-
-DEFINE_METRIC_bool(worker_is_clickonce_disabled);
-
-DEFINE_METRIC_bool(worker_has_software_firewall);
-
-DEFINE_METRIC_count(worker_silent_update_running_on_batteries);
-
-DEFINE_METRIC_count(worker_update_check_total);
-DEFINE_METRIC_count(worker_update_check_succeeded);
-
-DEFINE_METRIC_integer(worker_apps_not_updated_eula);
-DEFINE_METRIC_integer(worker_apps_not_updated_group_policy);
-DEFINE_METRIC_integer(worker_apps_not_installed_group_policy);
-
-DEFINE_METRIC_count(worker_skipped_app_update_for_self_update);
-
-DEFINE_METRIC_count(worker_self_updates_available);
-DEFINE_METRIC_count(worker_self_updates_succeeded);
-
-DEFINE_METRIC_count(worker_app_updates_available);
-DEFINE_METRIC_count(worker_app_updates_succeeded);
-
-DEFINE_METRIC_integer(worker_self_update_responses);
-DEFINE_METRIC_integer(worker_self_update_response_time_since_first_ms);
-
-DEFINE_METRIC_integer(worker_app_max_update_responses_app_high);
-DEFINE_METRIC_integer(worker_app_max_update_responses);
-DEFINE_METRIC_integer(worker_app_max_update_responses_ms_since_first);
-
-DEFINE_METRIC_timing(ping_failed_ms);
-DEFINE_METRIC_timing(ping_succeeded_ms);
-
-}  // namespace omaha
diff --git a/goopdate/worker_metrics.h b/goopdate/worker_metrics.h
deleted file mode 100644
index 479665b..0000000
--- a/goopdate/worker_metrics.h
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Declares the usage metrics used by the worker module.
-
-#ifndef OMAHA_GOOPDATE_WORKER_METRICS_H__
-#define OMAHA_GOOPDATE_WORKER_METRICS_H__
-
-#include "omaha/statsreport/metrics.h"
-
-namespace omaha {
-
-// How many times the download manager attempted to download a file.
-DECLARE_METRIC_count(worker_download_total);
-// How many times the download manager successfully downloaded a file.
-DECLARE_METRIC_count(worker_download_succeeded);
-
-// How many times the package cache attempted to put the temporary file
-// to the cache directory.
-DECLARE_METRIC_count(worker_package_cache_put_total);
-// How many times the package cache successfully copied the temporary file
-// to the cache directory.
-DECLARE_METRIC_count(worker_package_cache_put_succeeded);
-
-// How many times ExecuteAndWaitForInstaller was called.
-DECLARE_METRIC_count(worker_install_execute_total);
-// How many times ExecuteAndWaitForInstaller was called for an MSI.
-DECLARE_METRIC_count(worker_install_execute_msi_total);
-
-// How many MSI install attempts encountered ERROR_INSTALL_ALREADY_RUNNING
-// during an update.
-DECLARE_METRIC_count(worker_install_msi_in_progress_detected_update);
-// How many times successfully installed MSI in a retry after
-// encountering ERROR_INSTALL_ALREADY_RUNNING during an update.
-DECLARE_METRIC_count(worker_install_msi_in_progress_retry_succeeded_update);
-// Number of retries attempted because of ERROR_INSTALL_ALREADY_RUNNING before
-// succeeded during an update.
-DECLARE_METRIC_integer(
-    worker_install_msi_in_progress_retry_succeeded_tries_update);
-
-// How many MSI install attempts encountered ERROR_INSTALL_ALREADY_RUNNING
-// during an install.
-DECLARE_METRIC_count(worker_install_msi_in_progress_detected_install);
-// How many times successfully installed MSI in a retry after
-// encountering ERROR_INSTALL_ALREADY_RUNNING during an install.
-DECLARE_METRIC_count(worker_install_msi_in_progress_retry_succeeded_install);
-// Number of retries attempted because of ERROR_INSTALL_ALREADY_RUNNING before
-// succeeded during an install.
-DECLARE_METRIC_integer(
-    worker_install_msi_in_progress_retry_succeeded_tries_install);
-
-// Version of the GoogleUpdate.exe shell in use.
-DECLARE_METRIC_integer(worker_shell_version);
-
-// True if Windows is installing (is in audit mode). This should never be true.
-DECLARE_METRIC_bool(worker_is_windows_installing);
-
-// True if UAC is disabled.
-DECLARE_METRIC_bool(worker_is_uac_disabled);
-
-// True if ClickOnce is disabled for the Internet zone for the current user.
-DECLARE_METRIC_bool(worker_is_clickonce_disabled);
-
-// True if a software firewall is detected.
-DECLARE_METRIC_bool(worker_has_software_firewall);
-
-// How many times the computer was on batteries when doing an update check
-// for apps.
-DECLARE_METRIC_count(worker_silent_update_running_on_batteries);
-
-// How many times an update check was attempted. Does not include installs.
-DECLARE_METRIC_count(worker_update_check_total);
-// How many times an update check succeeded. Does not include installs.
-DECLARE_METRIC_count(worker_update_check_succeeded);
-
-// Number of apps for which update checks skipped because EULA is not accepted.
-DECLARE_METRIC_integer(worker_apps_not_updated_eula);
-// Number of apps for which update checks included updatedisabled because of
-// update Group Policy.
-DECLARE_METRIC_integer(worker_apps_not_updated_group_policy);
-// Number of apps for which update checks included updatedisabled because of
-// install Group Policy.
-DECLARE_METRIC_integer(worker_apps_not_installed_group_policy);
-
-// How many times Omaha did not update an app because an Omaha update was
-// available at the same time. Only incremented if both an Omaha and app update
-// are available in the same update check. Max one increment per update check.
-DECLARE_METRIC_count(worker_skipped_app_update_for_self_update);
-
-// How many times a self update was available.
-// Note: These are updated for all update checks whereas Omaha 2 only updated
-// them for auto-updates.
-DECLARE_METRIC_count(worker_self_updates_available);
-// How many times a self update succeeded.
-DECLARE_METRIC_count(worker_self_updates_succeeded);
-
-// How many updates have been available. Each app in an update check is counted.
-// If a self-update was available, no apps are counted.
-// Updates will be counted even if updates are disabled by Group Policy. This is
-// a change from Omaha 2.
-DECLARE_METRIC_count(worker_app_updates_available);
-// How many app updates succeeded.
-DECLARE_METRIC_count(worker_app_updates_succeeded);
-
-// Number of times Omaha has received a self-update response without
-// successfully updating.
-DECLARE_METRIC_integer(worker_self_update_responses);
-// The time (ms) since the first time Omaha received a self-update response.
-// Only reported if Omaha fails to update after first such response.
-DECLARE_METRIC_integer(worker_self_update_response_time_since_first_ms);
-
-// The most significant/left half of the GUID for the app for which Omaha has
-// received the most update responses without successfully updating.
-DECLARE_METRIC_integer(worker_app_max_update_responses_app_high);
-// Maximum number of times for any app that Omaha has received an update
-// response without successfully updating.
-DECLARE_METRIC_integer(worker_app_max_update_responses);
-// The time (ms) since the first time Omaha received an update response for the
-// app with the most update failures.
-DECLARE_METRIC_integer(worker_app_max_update_responses_ms_since_first);
-
-// Time (ms) spent in SendPing() when DoSendPing() fails.
-DECLARE_METRIC_timing(ping_failed_ms);
-// Time (ms) spent in SendPing() when the ping succeeds.
-DECLARE_METRIC_timing(ping_succeeded_ms);
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_WORKER_METRICS_H__
diff --git a/goopdate/worker_mock.h b/goopdate/worker_mock.h
deleted file mode 100644
index e89b8c4..0000000
--- a/goopdate/worker_mock.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_WORKER_MOCK_H_
-#define OMAHA_GOOPDATE_WORKER_MOCK_H_
-
-#include "omaha/goopdate/worker.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-class MockWorker : public WorkerModelInterface {
- public:
-  MOCK_METHOD1(CheckForUpdateAsync,
-      HRESULT(AppBundle* app_bundle));
-  MOCK_METHOD1(DownloadAsync,
-      HRESULT(AppBundle* app_bundle));
-  MOCK_METHOD1(DownloadAndInstallAsync,
-      HRESULT(AppBundle* app_bundle));
-  MOCK_METHOD1(UpdateAllAppsAsync,
-      HRESULT(AppBundle* app_bundle));
-  MOCK_METHOD1(DownloadPackageAsync,
-      HRESULT(Package* package));
-  MOCK_METHOD1(Stop,
-      HRESULT(AppBundle* app_bundle));
-  MOCK_METHOD1(Pause,
-      HRESULT(AppBundle* app_bundle));
-  MOCK_METHOD1(Resume,
-      HRESULT(AppBundle* app_bundle));
-  MOCK_METHOD2(GetPackage,
-      HRESULT(const Package* package, const CString& dir));
-  MOCK_CONST_METHOD1(IsPackageAvailable,
-      bool(const Package* package));      // NOLINT
-  MOCK_METHOD2(PurgeAppLowerVersions,
-      HRESULT(const CString&, const CString&));
-  MOCK_METHOD0(Lock,
-      int());
-  MOCK_METHOD0(Unlock,
-      int());
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_WORKER_MOCK_H_
-
diff --git a/goopdate/worker_unittest.cc b/goopdate/worker_unittest.cc
deleted file mode 100644
index 1e5784a..0000000
--- a/goopdate/worker_unittest.cc
+++ /dev/null
@@ -1,874 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "base/scoped_ptr.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/const_addresses.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/web_services_client.h"
-#include "omaha/goopdate/app_bundle_state_busy.h"
-#include "omaha/goopdate/app_manager.h"
-#include "omaha/goopdate/app_state_ready_to_install.h"
-#include "omaha/goopdate/app_state_update_available.h"
-#include "omaha/goopdate/download_manager.h"
-#include "omaha/goopdate/goopdate.h"
-#include "omaha/goopdate/install_manager.h"
-#include "omaha/goopdate/installer_result_info.h"
-#include "omaha/goopdate/model.h"
-#include "omaha/goopdate/resource_manager.h"
-#include "omaha/goopdate/worker.h"
-#include "omaha/goopdate/worker_internal.h"
-#include "omaha/goopdate/worker_metrics.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-using ::testing::_;
-using ::testing::Return;
-
-namespace {
-
-// TODO(omaha): Change these to invalid IDs once the TODO above
-// UpdateResponse::GetResult is fixed. Until then, invalid IDs cause asserts.
-// Also, the large tests need valid files to download.
-#if 0
-const TCHAR* const kGuid1 = _T("{8A001254-1003-465e-A970-0748961C5293}");
-const TCHAR* const kGuid2 = _T("{058ADDBE-BF10-4ba1-93C0-6F4A52C03C7E}");
-#else
-const TCHAR* const kGuid1 = _T("{ADDE8406-A0F3-4AC2-8878-ADC0BD37BD86}");
-const TCHAR* const kGuid2 = _T("{D0AB2EBC-931B-4013-9FEB-C9C4C2225C8C}");
-#endif
-
-// The alphabetical order of these is important for
-// RecordUpdateAvailableUsageStatsTest.
-const TCHAR* const kApp1 = _T("{0C480772-AC73-418f-9603-66303DA4C7AA}");
-const TCHAR* const kApp2 = _T("{89906BCD-4D12-4c9b-B5BA-8286051CB8D9}");
-const TCHAR* const kApp3 = _T("{F5A1FE97-CF5A-47b8-8B28-2A72F9A57A45}");
-
-const uint64 kApp1GuidUpper = 0x0C480772AC73418f;
-const uint64 kApp2GuidUpper = 0x89906BCD4D124c9b;
-
-const TCHAR* const kApp1ClientsKeyPathUser =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\Clients\\{0C480772-AC73-418f-9603-66303DA4C7AA}");
-const TCHAR* const kApp2ClientsKeyPathUser =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\Clients\\{89906BCD-4D12-4c9b-B5BA-8286051CB8D9}");
-const TCHAR* const kApp3ClientsKeyPathUser =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\Clients\\{F5A1FE97-CF5A-47b8-8B28-2A72F9A57A45}");
-
-const TCHAR* const kApp1ClientStateKeyPathUser =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientState\\{0C480772-AC73-418f-9603-66303DA4C7AA}");
-const TCHAR* const kApp2ClientStateKeyPathUser =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientState\\{89906BCD-4D12-4c9b-B5BA-8286051CB8D9}");
-const TCHAR* const kApp3ClientStateKeyPathUser =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientState\\{F5A1FE97-CF5A-47b8-8B28-2A72F9A57A45}");
-
-void SetAppStateUpdateAvailable(App* app) {
-  SetAppStateForUnitTest(app, new fsm::AppStateUpdateAvailable);
-}
-
-void SetAppStateReadyToInstall(App* app) {
-  SetAppStateForUnitTest(app, new fsm::AppStateReadyToInstall);
-}
-
-class MockWebServicesClient : public WebServicesClientInterface {
- public:
-  MOCK_METHOD2(Send,
-      HRESULT(const xml::UpdateRequest* update_request,
-              xml::UpdateResponse* update_response));
-  MOCK_METHOD2(SendString,
-      HRESULT(const CString* request_string,
-              xml::UpdateResponse* update_response));
-  MOCK_METHOD0(Cancel,
-      void());
-  MOCK_METHOD1(set_proxy_auth_config,
-      void(const ProxyAuthConfig& config));
-  MOCK_CONST_METHOD0(is_http_success,
-      bool());
-  MOCK_CONST_METHOD0(http_status_code,
-      int());
-  MOCK_CONST_METHOD0(http_trace,
-      CString());
-};
-
-class MockDownloadManager : public DownloadManagerInterface {
- public:
-  MOCK_METHOD0(Initialize,
-      HRESULT());
-  MOCK_METHOD2(PurgeAppLowerVersions,
-      HRESULT(const CString&, const CString&));
-  MOCK_METHOD2(CachePackage,
-      HRESULT(const Package*, const CString*));
-  MOCK_METHOD1(DownloadApp,
-      HRESULT(App* app));
-  MOCK_METHOD1(DownloadPackage,
-      HRESULT(Package* package));
-  MOCK_CONST_METHOD2(GetPackage,
-      HRESULT(const Package*, const CString&));
-  MOCK_METHOD1(Cancel,
-      void(App* app));
-  MOCK_METHOD0(CancelAll,
-      void());
-  MOCK_CONST_METHOD0(IsBusy,
-      bool());
-  MOCK_CONST_METHOD1(IsPackageAvailable,
-      bool(const Package* package));      // NOLINT
-};
-
-class MockInstallManager : public InstallManagerInterface {
- public:
-  MOCK_METHOD0(Initialize,
-      HRESULT());
-  MOCK_CONST_METHOD0(install_working_dir,
-      CString());
-  MOCK_METHOD2(InstallApp,
-      void(App* app, const CString& dir));
-};
-
-ACTION(SimulateDownloadAppStateTransition) {
-  UNREFERENCED_ACTION_PARAMETERS;
-  arg0->Downloading();
-  arg0->DownloadComplete();
-  // TODO(omaha3): Simulate extract and differential update once implemented.
-  arg0->MarkReadyToInstall();
-  return 0;
-}
-
-ACTION(SimulateInstallAppStateTransition) {
-  UNREFERENCED_ACTION_PARAMETERS;
-  arg0->Installing();
-
-  AppManager& app_manager = *AppManager::Instance();
-  __mutexScope(app_manager.GetRegistryStableStateLock());
-
-  InstallerResultInfo result_info;
-  result_info.type = INSTALLER_RESULT_SUCCESS;
-  result_info.text = _T("success");
-  arg0->ReportInstallerComplete(result_info);
-}
-
-void WaitForAppToEnterState(const App& app,
-                            CurrentState expected_state,
-                            int timeout_sec) {
-  const int kPeriodMs = 50;
-  const int max_tries = timeout_sec * 1000 / kPeriodMs;
-  for (int tries = 0; tries < max_tries; ++tries) {
-    if (expected_state == app.state()) {
-        break;
-    }
-    ::Sleep(kPeriodMs);
-  }
-  EXPECT_EQ(expected_state, app.state());
-}
-
-// Assumes the caller has verified the bundle is busy. Otherwise, this could
-// return before the bundle enters the busy state.
-void WaitForBundleToBeReady(const AppBundle& app_bundle, int timeout_sec) {
-  const int kPeriodMs = 50;
-  const int max_tries = timeout_sec * 1000 / kPeriodMs;
-  for (int tries = 0; tries < max_tries; ++tries) {
-    if (!app_bundle.IsBusy()) {
-      return;
-    }
-    ::Sleep(kPeriodMs);
-  }
-  ADD_FAILURE() << _T("Timed out waiting for AppBundle to be ready.");
-}
-
-}  // namespace
-
-// All tests use a user instance of the Worker.
-
-class WorkerTest : public testing::Test {
- protected:
-  WorkerTest() : is_machine_(false), goopdate_(is_machine_), worker_(NULL) {}
-
-  virtual void SetUp() {
-    worker_ = &Worker::Instance();
-
-    worker_->Initialize(is_machine_);
-
-    EXPECT_SUCCEEDED(ResourceManager::Create(
-      is_machine_, app_util::GetCurrentModuleDirectory(), _T("en")));
-  }
-
-  virtual void TearDown() {
-    worker_ = NULL;
-    Worker::DeleteInstance();
-    ResourceManager::Delete();
-  }
-
-  // Overrides the update check client of the bundle.
-  void SetUpdateCheckClient(AppBundle* app_bundle,
-                            WebServicesClientInterface* web_services_client) {
-    app_bundle->update_check_client_.reset(web_services_client);
-  }
-
-  void SetWorkerDownloadManager(DownloadManagerInterface* download_manager) {
-    ASSERT_TRUE(download_manager);
-    worker_->download_manager_.reset(download_manager);
-  }
-
-  void SetWorkerInstallManager(InstallManagerInterface* install_manager) {
-    ASSERT_TRUE(install_manager);
-    worker_->install_manager_.reset(install_manager);
-  }
-
-  const bool is_machine_;
-  Goopdate goopdate_;
-  Worker* worker_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(WorkerTest);
-};
-
-class WorkerWithBundleTest : public WorkerTest {
- protected:
-  WorkerWithBundleTest() : WorkerTest() {}
-
-  virtual void SetUp() {
-    WorkerTest::SetUp();
-
-    app_bundle_ = worker_->model()->CreateAppBundle(is_machine_);
-    ASSERT_TRUE(app_bundle_.get());
-
-    EXPECT_SUCCEEDED(app_bundle_->put_displayName(CComBSTR(_T("My Bundle"))));
-    EXPECT_SUCCEEDED(app_bundle_->put_displayLanguage(CComBSTR(_T("en"))));
-    EXPECT_SUCCEEDED(app_bundle_->initialize());
-
-    CString update_check_url;
-    ConfigManager::Instance()->GetUpdateCheckUrl(&update_check_url);
-    WebServicesClient* web_service_client = new WebServicesClient(is_machine_);
-    EXPECT_HRESULT_SUCCEEDED(web_service_client->Initialize(update_check_url,
-                                                            HeadersVector(),
-                                                            true));
-    SetUpdateCheckClient(app_bundle_.get(), web_service_client);
-  }
-
-  virtual void TearDown() {
-    app_bundle_.reset();
-
-    WorkerTest::TearDown();
-  }
-
-  shared_ptr<AppBundle> app_bundle_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(WorkerWithBundleTest);
-};
-
-// The EULA is accepted for both apps.
-class WorkerWithTwoAppsTest : public WorkerWithBundleTest {
- protected:
-  WorkerWithTwoAppsTest() : WorkerWithBundleTest(), app1_(NULL), app2_(NULL) {}
-
-  virtual void SetUp() {
-    WorkerWithBundleTest::SetUp();
-
-    EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid1), &app1_));
-    EXPECT_SUCCEEDED(app_bundle_->createApp(CComBSTR(kGuid2), &app2_));
-
-    EXPECT_SUCCEEDED(app1_->put_isEulaAccepted(VARIANT_TRUE));
-    EXPECT_SUCCEEDED(app2_->put_isEulaAccepted(VARIANT_TRUE));
-  }
-
-  virtual void TearDown() {
-    WorkerWithBundleTest::TearDown();
-  }
-
-  App* app1_;
-  App* app2_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(WorkerWithTwoAppsTest);
-};
-
-// Mocks the DownloadManager and InstallManager.
-class WorkerMockedManagersTest : public WorkerWithTwoAppsTest {
- protected:
-  WorkerMockedManagersTest()
-      : WorkerWithTwoAppsTest(),
-        mock_web_services_client_(),
-        mock_download_manager_(NULL),
-        mock_install_manager_(NULL) {
-  }
-
-  virtual void SetUp() {
-    WorkerWithTwoAppsTest::SetUp();
-
-    // By default, no methods should be called on web service client and install
-    // manager, so make them StrictMock. Override this behavior for specific
-    // methods in the individual test cases.
-    mock_web_services_client_ = new testing::StrictMock<MockWebServicesClient>;
-    mock_install_manager_ = new testing::StrictMock<MockInstallManager>;
-
-    // Some functions will be called on the mock download manager, so make it
-    // NiceMock.
-    mock_download_manager_ = new testing::NiceMock<MockDownloadManager>;
-
-    // The App Bundle takes ownership.
-    SetUpdateCheckClient(app_bundle_.get(), mock_web_services_client_);
-
-    // The Worker takes ownership of the Manager mocks.
-    SetWorkerDownloadManager(mock_download_manager_);
-    SetWorkerInstallManager(mock_install_manager_);
-  }
-
-  virtual void TearDown() {
-    WorkerWithTwoAppsTest::TearDown();
-  }
-
-  // Pointers used by tests to set behavior. Not owned by this instance.
-  MockWebServicesClient* mock_web_services_client_;
-  MockDownloadManager* mock_download_manager_;
-  MockInstallManager* mock_install_manager_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(WorkerMockedManagersTest);
-};
-
-TEST_F(WorkerMockedManagersTest, CheckForUpdateAsync) {
-  EXPECT_CALL(*mock_web_services_client_, Send(_, _))
-      .Times(1);
-
-  __mutexBlock(worker_->model()->lock()) {
-    EXPECT_SUCCEEDED(worker_->CheckForUpdateAsync(app_bundle_.get()));
-
-    EXPECT_EQ(STATE_WAITING_TO_CHECK_FOR_UPDATE, app1_->state());
-    EXPECT_EQ(STATE_WAITING_TO_CHECK_FOR_UPDATE, app2_->state());
-
-    SetAppBundleStateForUnitTest(app_bundle_.get(),
-                                 new fsm::AppBundleStateBusy);
-    EXPECT_TRUE(app_bundle_->IsBusy());
-  }
-
-  // TODO(omaha3): The update check fails because there is not a real response.
-  // Fix this.
-  WaitForBundleToBeReady(*app_bundle_, 5);
-  EXPECT_FALSE(app_bundle_->IsBusy());
-  EXPECT_EQ(STATE_ERROR, app1_->state());
-  EXPECT_EQ(STATE_ERROR, app2_->state());
-}
-
-TEST_F(WorkerMockedManagersTest, DownloadAsync) {
-  SetAppStateUpdateAvailable(app1_);
-  SetAppStateUpdateAvailable(app2_);
-
-  {
-    ::testing::InSequence dummy;
-    EXPECT_CALL(*mock_download_manager_, DownloadApp(app1_))
-        .WillOnce(SimulateDownloadAppStateTransition());
-    EXPECT_CALL(*mock_download_manager_, DownloadApp(app2_))
-        .WillOnce(SimulateDownloadAppStateTransition());
-  }
-
-  // Holding the lock prevents the state from changing in the other thread,
-  // ensuring consistent results.
-  __mutexBlock(worker_->model()->lock()) {
-    EXPECT_SUCCEEDED(worker_->DownloadAsync(app_bundle_.get()));
-
-    EXPECT_EQ(STATE_WAITING_TO_DOWNLOAD, app1_->state());
-    EXPECT_EQ(STATE_WAITING_TO_DOWNLOAD, app2_->state());
-
-    SetAppBundleStateForUnitTest(app_bundle_.get(),
-                                 new fsm::AppBundleStateBusy);
-    EXPECT_TRUE(app_bundle_->IsBusy());
-  }
-
-  WaitForBundleToBeReady(*app_bundle_, 5);
-  EXPECT_EQ(STATE_READY_TO_INSTALL, app1_->state());
-  EXPECT_EQ(STATE_READY_TO_INSTALL, app2_->state());
-}
-
-TEST_F(WorkerMockedManagersTest, DownloadAndInstallAsync_AlreadyDownloaded) {
-  SetAppStateReadyToInstall(app1_);
-  SetAppStateReadyToInstall(app2_);
-
-  EXPECT_CALL(*mock_install_manager_, install_working_dir())
-      .WillRepeatedly(Return(app_util::GetTempDir()));
-
-  {
-    ::testing::InSequence dummy;
-    EXPECT_CALL(*mock_install_manager_, InstallApp(app1_, _))
-        .WillOnce(SimulateInstallAppStateTransition());
-    EXPECT_CALL(*mock_install_manager_, InstallApp(app2_, _))
-        .WillOnce(SimulateInstallAppStateTransition());
-  }
-
-  __mutexBlock(worker_->model()->lock()) {
-    EXPECT_SUCCEEDED(worker_->DownloadAndInstallAsync(app_bundle_.get()));
-
-    EXPECT_EQ(STATE_WAITING_TO_INSTALL, app1_->state());
-    EXPECT_EQ(STATE_WAITING_TO_INSTALL, app2_->state());
-
-    SetAppBundleStateForUnitTest(app_bundle_.get(),
-                                 new fsm::AppBundleStateBusy);
-    EXPECT_TRUE(app_bundle_->IsBusy());
-  }
-
-  WaitForBundleToBeReady(*app_bundle_, 5);
-  EXPECT_EQ(STATE_INSTALL_COMPLETE, app1_->state());
-  EXPECT_EQ(STATE_INSTALL_COMPLETE, app2_->state());
-}
-
-TEST_F(WorkerMockedManagersTest, DownloadAndInstallAsync_NotAlreadyDownloaded) {
-  SetAppStateUpdateAvailable(app1_);
-  SetAppStateUpdateAvailable(app2_);
-
-  EXPECT_CALL(*mock_install_manager_, install_working_dir())
-      .WillRepeatedly(Return(app_util::GetTempDir()));
-
-  {
-    ::testing::InSequence dummy;
-    EXPECT_CALL(*mock_download_manager_, DownloadApp(app1_))
-        .WillOnce(SimulateDownloadAppStateTransition());
-    EXPECT_CALL(*mock_install_manager_, InstallApp(app1_, _))
-        .WillOnce(SimulateInstallAppStateTransition());
-    EXPECT_CALL(*mock_download_manager_, DownloadApp(app2_))
-        .WillOnce(SimulateDownloadAppStateTransition());
-    EXPECT_CALL(*mock_install_manager_, InstallApp(app2_, _))
-        .WillOnce(SimulateInstallAppStateTransition());
-  }
-
-  __mutexBlock(worker_->model()->lock()) {
-    EXPECT_SUCCEEDED(worker_->DownloadAndInstallAsync(app_bundle_.get()));
-
-    EXPECT_EQ(STATE_WAITING_TO_DOWNLOAD, app1_->state());
-    EXPECT_EQ(STATE_WAITING_TO_DOWNLOAD, app2_->state());
-
-    SetAppBundleStateForUnitTest(app_bundle_.get(),
-                                 new fsm::AppBundleStateBusy);
-    EXPECT_TRUE(app_bundle_->IsBusy());
-  }
-
-  WaitForBundleToBeReady(*app_bundle_, 5);
-  EXPECT_EQ(STATE_INSTALL_COMPLETE, app1_->state());
-  EXPECT_EQ(STATE_INSTALL_COMPLETE, app2_->state());
-}
-
-TEST_F(WorkerMockedManagersTest, DownloadAsync_Then_DownloadAndInstallAsync) {
-  SetAppStateUpdateAvailable(app1_);
-  SetAppStateUpdateAvailable(app2_);
-
-  {
-    ::testing::InSequence dummy;
-    EXPECT_CALL(*mock_download_manager_, DownloadApp(app1_))
-        .WillOnce(SimulateDownloadAppStateTransition());
-    EXPECT_CALL(*mock_download_manager_, DownloadApp(app2_))
-        .WillOnce(SimulateDownloadAppStateTransition());
-  }
-
-  __mutexBlock(worker_->model()->lock()) {
-    EXPECT_SUCCEEDED(worker_->DownloadAsync(app_bundle_.get()));
-
-    EXPECT_EQ(STATE_WAITING_TO_DOWNLOAD, app1_->state());
-    EXPECT_EQ(STATE_WAITING_TO_DOWNLOAD, app2_->state());
-
-    SetAppBundleStateForUnitTest(app_bundle_.get(),
-                                 new fsm::AppBundleStateBusy);
-    EXPECT_TRUE(app_bundle_->IsBusy());
-  }
-
-  WaitForBundleToBeReady(*app_bundle_, 5);
-  EXPECT_EQ(STATE_READY_TO_INSTALL, app1_->state());
-  EXPECT_EQ(STATE_READY_TO_INSTALL, app2_->state());
-
-  EXPECT_CALL(*mock_install_manager_, install_working_dir())
-      .WillRepeatedly(Return(app_util::GetTempDir()));
-
-  {
-    ::testing::InSequence dummy;
-    EXPECT_CALL(*mock_install_manager_, InstallApp(app1_, _))
-        .WillOnce(SimulateInstallAppStateTransition());
-    EXPECT_CALL(*mock_install_manager_, InstallApp(app2_, _))
-        .WillOnce(SimulateInstallAppStateTransition());
-  }
-  __mutexBlock(worker_->model()->lock()) {
-    EXPECT_SUCCEEDED(worker_->DownloadAndInstallAsync(app_bundle_.get()));
-
-    EXPECT_EQ(STATE_WAITING_TO_INSTALL, app1_->state());
-    EXPECT_EQ(STATE_WAITING_TO_INSTALL, app2_->state());
-
-    SetAppBundleStateForUnitTest(app_bundle_.get(),
-                                 new fsm::AppBundleStateBusy);
-    EXPECT_TRUE(app_bundle_->IsBusy());
-  }
-
-  WaitForBundleToBeReady(*app_bundle_, 5);
-  EXPECT_EQ(STATE_INSTALL_COMPLETE, app1_->state());
-  EXPECT_EQ(STATE_INSTALL_COMPLETE, app2_->state());
-}
-
-TEST_F(WorkerMockedManagersTest, UpdateAllAppsAsync) {
-  EXPECT_CALL(*mock_web_services_client_, Send(_, _))
-      .Times(1);
-
-  __mutexBlock(worker_->model()->lock()) {
-    EXPECT_SUCCEEDED(worker_->UpdateAllAppsAsync(app_bundle_.get()));
-
-    EXPECT_EQ(STATE_WAITING_TO_CHECK_FOR_UPDATE, app1_->state());
-    EXPECT_EQ(STATE_WAITING_TO_CHECK_FOR_UPDATE, app2_->state());
-
-    SetAppBundleStateForUnitTest(app_bundle_.get(),
-                                 new fsm::AppBundleStateBusy);
-    EXPECT_TRUE(app_bundle_->IsBusy());
-  }
-
-  // TODO(omaha3): The update check fails because there is not a real response.
-  // Fix this and continue the test, ensuring it gets to install complete.
-  WaitForBundleToBeReady(*app_bundle_, 5);
-  EXPECT_FALSE(app_bundle_->IsBusy());
-  EXPECT_EQ(STATE_ERROR, app1_->state());
-  EXPECT_EQ(STATE_ERROR, app2_->state());
-}
-
-// TODO(omaha): Add tests for app already in error state, app failing download
-// or install, all apps failed or failing, etc.
-
-//
-// Large Tests
-// These are large tests because they use threads and access the network.
-// TODO(omaha): Move these to a separate test executable when using Hammer to
-// run tests.
-//
-
-TEST_F(WorkerWithTwoAppsTest, CheckForUpdateAsync_Large) {
-  __mutexBlock(worker_->model()->lock()) {
-    EXPECT_SUCCEEDED(worker_->CheckForUpdateAsync(app_bundle_.get()));
-
-    EXPECT_EQ(STATE_WAITING_TO_CHECK_FOR_UPDATE, app1_->state());
-    EXPECT_EQ(STATE_WAITING_TO_CHECK_FOR_UPDATE, app2_->state());
-
-    SetAppBundleStateForUnitTest(app_bundle_.get(),
-                                 new fsm::AppBundleStateBusy);
-    EXPECT_TRUE(app_bundle_->IsBusy());
-  }
-
-  WaitForBundleToBeReady(*app_bundle_, 10);
-  EXPECT_EQ(STATE_UPDATE_AVAILABLE, app1_->state());
-  EXPECT_EQ(STATE_UPDATE_AVAILABLE, app2_->state());
-}
-
-TEST_F(WorkerWithTwoAppsTest,
-       DownloadAsyncThenDownloadAndInstallAsync_Large) {
-  // Update Check: Request then wait for it to complete in the thread pool.
-
-  __mutexBlock(worker_->model()->lock()) {
-    EXPECT_SUCCEEDED(worker_->CheckForUpdateAsync(app_bundle_.get()));
-
-    EXPECT_EQ(STATE_WAITING_TO_CHECK_FOR_UPDATE, app1_->state());
-    EXPECT_EQ(STATE_WAITING_TO_CHECK_FOR_UPDATE, app2_->state());
-
-    SetAppBundleStateForUnitTest(app_bundle_.get(),
-                                 new fsm::AppBundleStateBusy);
-    EXPECT_TRUE(app_bundle_->IsBusy());
-  }
-
-  WaitForBundleToBeReady(*app_bundle_, 10);
-  EXPECT_EQ(STATE_UPDATE_AVAILABLE, app1_->state());
-  EXPECT_EQ(STATE_UPDATE_AVAILABLE, app2_->state());
-
-  // Download: Request then wait for it to complete in the thread pool.
-
-  __mutexBlock(worker_->model()->lock()) {
-    EXPECT_SUCCEEDED(worker_->DownloadAsync(app_bundle_.get()));
-
-    EXPECT_EQ(STATE_WAITING_TO_DOWNLOAD, app1_->state());
-    EXPECT_EQ(STATE_WAITING_TO_DOWNLOAD, app2_->state());
-
-    SetAppBundleStateForUnitTest(app_bundle_.get(),
-                                 new fsm::AppBundleStateBusy);
-    EXPECT_TRUE(app_bundle_->IsBusy());
-  }
-
-  WaitForBundleToBeReady(*app_bundle_, 25);
-  EXPECT_EQ(STATE_READY_TO_INSTALL, app1_->state());
-  EXPECT_EQ(STATE_READY_TO_INSTALL, app2_->state());
-
-  // Install: Request then wait for it to complete in the thread pool.
-
-  // TODO(omaha): Make User Foo installer available from production, change
-  // GUID(s), and enable the code below. Be sure to uninstall the app when done.
-#if 0
-
-  __mutexBlock(worker_->model()->lock()) {
-    EXPECT_SUCCEEDED(worker_->DownloadAndInstallAsync(app_bundle_.get()));
-
-    EXPECT_EQ(STATE_WAITING_TO_INSTALL, app1_->state());
-    EXPECT_EQ(STATE_WAITING_TO_INSTALL, app2_->state());
-
-    SetAppBundleStateForUnitTest(app_bundle_.get(),
-                                 new fsm::AppBundleStateBusy);
-    EXPECT_TRUE(app_bundle_->IsBusy());
-  }
-
-  WaitForBundleToBeReady(*app_bundle_, 10);
-  EXPECT_EQ(STATE_INSTALL_COMPLETE, app1_->state());
-  EXPECT_EQ(STATE_INSTALL_COMPLETE, app2_->state());
-#endif
-}
-
-TEST_F(WorkerWithTwoAppsTest, DownloadAndInstallAsyncWithoutDownload_Large) {
-  // Update Check: Request then wait for it to complete in the thread pool.
-
-  __mutexBlock(worker_->model()->lock()) {
-    EXPECT_SUCCEEDED(worker_->CheckForUpdateAsync(app_bundle_.get()));
-
-    EXPECT_EQ(STATE_WAITING_TO_CHECK_FOR_UPDATE, app1_->state());
-    EXPECT_EQ(STATE_WAITING_TO_CHECK_FOR_UPDATE, app2_->state());
-
-    SetAppBundleStateForUnitTest(app_bundle_.get(),
-                                 new fsm::AppBundleStateBusy);
-    EXPECT_TRUE(app_bundle_->IsBusy());
-  }
-
-  WaitForBundleToBeReady(*app_bundle_, 10);
-  EXPECT_EQ(STATE_UPDATE_AVAILABLE, app1_->state());
-  EXPECT_EQ(STATE_UPDATE_AVAILABLE, app2_->state());
-
-  // Download and install: Request then wait for it to complete in thread pool.
-
-  // TODO(omaha): Make User Foo installer available from production, change
-  // GUID(s), and enable the code below. Be sure to uninstall the app when done.
-#if 0
-  __mutexBlock(worker_->model()->lock()) {
-    EXPECT_SUCCEEDED(worker_->DownloadAndInstallAsync(app_bundle_.get()));
-
-    EXPECT_EQ(STATE_WAITING_TO_DOWNLOAD, app1_->state());
-    EXPECT_EQ(STATE_WAITING_TO_DOWNLOAD, app2_->state());
-
-    SetAppBundleStateForUnitTest(app_bundle_.get(),
-                                 new fsm::AppBundleStateBusy);
-    EXPECT_TRUE(app_bundle_->IsBusy());
-  }
-
-  WaitForBundleToBeReady(*app_bundle_, 10);
-  EXPECT_EQ(STATE_INSTALL_COMPLETE, app1_->state());
-  EXPECT_EQ(STATE_INSTALL_COMPLETE, app2_->state());
-#endif
-}
-
-// Also tests cancellation of a bundle during the update check phase.
-TEST_F(WorkerWithTwoAppsTest, UpdateAllAppsAsync_Large) {
-  __mutexBlock(worker_->model()->lock()) {
-    EXPECT_SUCCEEDED(worker_->UpdateAllAppsAsync(app_bundle_.get()));
-
-    EXPECT_EQ(STATE_WAITING_TO_CHECK_FOR_UPDATE, app1_->state());
-    EXPECT_EQ(STATE_WAITING_TO_CHECK_FOR_UPDATE, app2_->state());
-
-    SetAppBundleStateForUnitTest(app_bundle_.get(),
-                                 new fsm::AppBundleStateBusy);
-    EXPECT_TRUE(app_bundle_->IsBusy());
-
-    // Stop the bundle to prevent it from actually trying to update app.
-    EXPECT_SUCCEEDED(app_bundle_->stop());
-  }
-}
-
-class RecordUpdateAvailableUsageStatsTest : public testing::Test {
- protected:
-  RecordUpdateAvailableUsageStatsTest() : is_machine_(false) {}
-
-  static void SetUpTestCase() {
-    stats_report::g_global_metrics.Initialize();
-  }
-
-  static void TearDownTestCase() {
-    // The global metrics collection must be uninitialized before the metrics
-    // destructors are called.
-    stats_report::g_global_metrics.Uninitialize();
-  }
-
-  virtual void SetUp() {
-    RegKey::DeleteKey(kRegistryHiveOverrideRoot);
-    OverrideRegistryHives(kRegistryHiveOverrideRoot);
-
-    EXPECT_SUCCEEDED(AppManager::CreateInstance(is_machine_));
-
-    metric_worker_self_update_responses.Set(0);
-    metric_worker_self_update_response_time_since_first_ms.Set(0);
-    metric_worker_app_max_update_responses_app_high.Set(0);
-    metric_worker_app_max_update_responses.Set(0);
-    metric_worker_app_max_update_responses_ms_since_first.Set(0);
-
-    ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                      kRegValueProductVersion,
-                                      _T("0.1.0.0")));
-    ASSERT_SUCCEEDED(RegKey::SetValue(kApp1ClientsKeyPathUser,
-                                      kRegValueProductVersion,
-                                      _T("0.1")));
-
-    ASSERT_SUCCEEDED(RegKey::CreateKey(USER_REG_CLIENT_STATE_GOOPDATE));
-    ASSERT_SUCCEEDED(RegKey::CreateKey(kApp1ClientStateKeyPathUser));
-  }
-
-  int GetNumProducts() {
-    AppManager& app_manager = *AppManager::Instance();
-    AppIdVector registered_app_ids;
-    VERIFY1(SUCCEEDED(app_manager.GetRegisteredApps(&registered_app_ids)));
-    return registered_app_ids.size();
-  }
-
-  virtual void TearDown() {
-    AppManager::DeleteInstance();
-
-    RestoreRegistryHives();
-    RegKey::DeleteKey(kRegistryHiveOverrideRoot);
-  }
-
-  bool is_machine_;
-};
-
-TEST_F(RecordUpdateAvailableUsageStatsTest, NoData) {
-  ASSERT_EQ(2, GetNumProducts());
-
-  internal::RecordUpdateAvailableUsageStats();
-
-  EXPECT_EQ(0, metric_worker_self_update_responses.value());
-  EXPECT_EQ(0, metric_worker_self_update_response_time_since_first_ms.value());
-  EXPECT_EQ(0, metric_worker_app_max_update_responses_app_high.value());
-  EXPECT_EQ(0, metric_worker_app_max_update_responses.value());
-  EXPECT_EQ(0, metric_worker_app_max_update_responses_ms_since_first.value());
-}
-
-TEST_F(RecordUpdateAvailableUsageStatsTest, OmahaDataOnly) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                    _T("UpdateAvailableCount"),
-                                    static_cast<DWORD>(123456)));
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                    _T("UpdateAvailableSince"),
-                                    static_cast<DWORD64>(10)));
-
-  ASSERT_EQ(2, GetNumProducts());
-
-  const time64 current_time_100ns(GetCurrent100NSTime());
-  const int64 expected_ms_since_first_update =
-      (current_time_100ns - 10) / kMillisecsTo100ns;
-
-  internal::RecordUpdateAvailableUsageStats();
-
-  EXPECT_EQ(123456, metric_worker_self_update_responses.value());
-
-  EXPECT_LE(expected_ms_since_first_update,
-            metric_worker_self_update_response_time_since_first_ms.value());
-  EXPECT_GT(expected_ms_since_first_update + 10 * kMsPerSec,
-            metric_worker_self_update_response_time_since_first_ms.value());
-
-  EXPECT_EQ(0, metric_worker_app_max_update_responses_app_high.value());
-  EXPECT_EQ(0, metric_worker_app_max_update_responses.value());
-  EXPECT_EQ(0, metric_worker_app_max_update_responses_ms_since_first.value());
-}
-
-TEST_F(RecordUpdateAvailableUsageStatsTest, OneAppOnly) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(kApp1ClientStateKeyPathUser,
-                                    _T("UpdateAvailableCount"),
-                                    static_cast<DWORD>(123456)));
-  ASSERT_SUCCEEDED(RegKey::SetValue(kApp1ClientStateKeyPathUser,
-                                    _T("UpdateAvailableSince"),
-                                    static_cast<DWORD64>(10)));
-
-  ASSERT_EQ(2, GetNumProducts());
-
-  const time64 current_time_100ns(GetCurrent100NSTime());
-  const int64 expected_ms_since_first_update =
-      (current_time_100ns - 10) / kMillisecsTo100ns;
-
-  internal::RecordUpdateAvailableUsageStats();
-
-  EXPECT_EQ(0, metric_worker_self_update_responses.value());
-  EXPECT_EQ(0, metric_worker_self_update_response_time_since_first_ms.value());
-
-  EXPECT_EQ(kApp1GuidUpper,
-            metric_worker_app_max_update_responses_app_high.value());
-  EXPECT_EQ(123456, metric_worker_app_max_update_responses.value());
-  EXPECT_LE(expected_ms_since_first_update,
-            metric_worker_app_max_update_responses_ms_since_first.value());
-  EXPECT_GT(expected_ms_since_first_update + 10 * kMsPerSec,
-            metric_worker_app_max_update_responses_ms_since_first.value());
-}
-
-// It is important that Omaha's count is the largest.
-// All app data should be from app 2, which has the greatest count, a middle
-// time, and an alphabetically middle GUID
-TEST_F(RecordUpdateAvailableUsageStatsTest, OmahaAndSeveralApps) {
-  const DWORD64 kApp2SinceTime = 1000 * kSecsTo100ns;
-
-  ASSERT_SUCCEEDED(RegKey::SetValue(kApp2ClientsKeyPathUser,
-                                    kRegValueProductVersion,
-                                    _T("1.2")));
-  ASSERT_SUCCEEDED(RegKey::SetValue(kApp3ClientsKeyPathUser,
-                                    kRegValueProductVersion,
-                                    _T("2.3")));
-
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                    _T("UpdateAvailableCount"),
-                                    static_cast<DWORD>(0x99887766)));
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                    _T("UpdateAvailableSince"),
-                                    static_cast<DWORD64>(1)));
-
-  ASSERT_SUCCEEDED(RegKey::SetValue(kApp1ClientStateKeyPathUser,
-                                    _T("UpdateAvailableCount"),
-                                    static_cast<DWORD>(1)));
-  ASSERT_SUCCEEDED(RegKey::SetValue(kApp1ClientStateKeyPathUser,
-                                    _T("UpdateAvailableSince"),
-                                    static_cast<DWORD64>(1)));
-
-  ASSERT_SUCCEEDED(RegKey::SetValue(kApp2ClientStateKeyPathUser,
-                                    _T("UpdateAvailableCount"),
-                                    static_cast<DWORD>(9876543)));
-  ASSERT_SUCCEEDED(RegKey::SetValue(kApp2ClientStateKeyPathUser,
-                                    _T("UpdateAvailableSince"),
-                                    kApp2SinceTime));
-
-  ASSERT_SUCCEEDED(RegKey::SetValue(kApp3ClientStateKeyPathUser,
-                                    _T("UpdateAvailableCount"),
-                                    static_cast<DWORD>(234)));
-  ASSERT_SUCCEEDED(RegKey::SetValue(kApp3ClientStateKeyPathUser,
-                                    _T("UpdateAvailableSince"),
-                                    static_cast<DWORD64>(128580000000000000)));
-
-  ASSERT_EQ(4, GetNumProducts());
-
-  const time64 current_time_100ns(GetCurrent100NSTime());
-  const int64 goopdate_expected_ms_since_first_update =
-      (current_time_100ns - 1) / kMillisecsTo100ns;
-
-  const int64 app_expected_ms_since_first_update =
-      (current_time_100ns - kApp2SinceTime) / kMillisecsTo100ns;
-
-  internal::RecordUpdateAvailableUsageStats();
-
-  EXPECT_EQ(0x99887766, metric_worker_self_update_responses.value());
-  EXPECT_LE(goopdate_expected_ms_since_first_update,
-            metric_worker_self_update_response_time_since_first_ms.value());
-  EXPECT_GT(goopdate_expected_ms_since_first_update + 10 * kMsPerSec,
-            metric_worker_self_update_response_time_since_first_ms.value());
-
-  EXPECT_EQ(kApp2GuidUpper,
-            metric_worker_app_max_update_responses_app_high.value());
-  EXPECT_EQ(9876543, metric_worker_app_max_update_responses.value());
-  EXPECT_LE(app_expected_ms_since_first_update,
-            metric_worker_app_max_update_responses_ms_since_first.value());
-  EXPECT_GT(app_expected_ms_since_first_update + 10 * kMsPerSec,
-            metric_worker_app_max_update_responses_ms_since_first.value());
-}
-
-}  // namespace omaha
diff --git a/goopdate/worker_utils.cc b/goopdate/worker_utils.cc
deleted file mode 100644
index 8ba153f..0000000
--- a/goopdate/worker_utils.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/worker_utils.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/signatures.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/event_logger.h"
-#include "omaha/goopdate/server_resource.h"
-#include "omaha/goopdate/string_formatter.h"
-#include "omaha/net/network_request.h"
-
-namespace omaha {
-
-namespace worker_utils {
-
-bool FormatMessageForNetworkError(HRESULT error,
-                                  const CString& language,
-                                  CString* msg) {
-  ASSERT1(msg);
-  StringFormatter formatter(language);
-
-  switch (error) {
-    case GOOPDATE_E_NO_NETWORK:
-      VERIFY1(SUCCEEDED(formatter.FormatMessage(msg,
-                                                IDS_NO_NETWORK_PRESENT_ERROR,
-                                                kOmahaShellFileName)));
-      break;
-    case GOOPDATE_E_NETWORK_UNAUTHORIZED:
-      VERIFY1(SUCCEEDED(
-          formatter.LoadString(IDS_ERROR_HTTPSTATUS_UNAUTHORIZED, msg)));
-      break;
-    case GOOPDATE_E_NETWORK_FORBIDDEN:
-      VERIFY1(SUCCEEDED(
-          formatter.LoadString(IDS_ERROR_HTTPSTATUS_FORBIDDEN, msg)));
-      break;
-    case GOOPDATE_E_NETWORK_PROXYAUTHREQUIRED:
-      VERIFY1(SUCCEEDED(
-          formatter.LoadString(IDS_ERROR_HTTPSTATUS_PROXY_AUTH_REQUIRED, msg)));
-      break;
-    default:
-      VERIFY1(SUCCEEDED(formatter.FormatMessage(msg,
-                                                IDS_NO_NETWORK_PRESENT_ERROR,
-                                                kOmahaShellFileName)));
-      return false;
-  }
-
-  return true;
-}
-
-void AddHttpRequestDataToEventLog(HRESULT hr,
-                                  int http_status_code,
-                                  const CString& http_trace,
-                                  bool is_machine) {
-  CString msg;
-  SafeCStringFormat(&msg,
-                    _T("Http Request Error.\r\n")
-                    _T("Error: 0x%08x. Http status code: %d.\r\n%s"),
-                    hr,
-                    http_status_code,
-                    http_trace);
-
-  GoogleUpdateLogEvent http_request_event(EVENTLOG_INFORMATION_TYPE,
-                                          kNetworkRequestEventId,
-                                          is_machine);
-  http_request_event.set_event_desc(msg);
-  http_request_event.WriteEvent();
-}
-
-// TODO(omaha): there can be more install actions for each install event.
-// Minor thing: the return value and the out params are redundant, meaning
-// there is no need to have them both. This eliminates an assert at the call
-// site.
-bool GetInstallActionForEvent(
-    const std::vector<xml::InstallAction>& install_actions,
-    xml::InstallAction::InstallEvent install_event,
-    const xml::InstallAction** action) {
-  ASSERT1(action);
-
-  for (size_t i = 0; i < install_actions.size(); ++i) {
-    if (install_actions[i].install_event == install_event) {
-      *action = &install_actions[i];
-      return true;
-    }
-  }
-
-  return false;
-}
-
-}  // namespace worker_utils
-
-}  // namespace omaha
-
diff --git a/goopdate/worker_utils.h b/goopdate/worker_utils.h
deleted file mode 100644
index 7c61693..0000000
--- a/goopdate/worker_utils.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_GOOPDATE_WORKER_UTILS_H_
-#define OMAHA_GOOPDATE_WORKER_UTILS_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include <vector>
-#include "omaha/common/install_manifest.h"
-
-namespace omaha {
-
-class NetworkRequest;
-
-namespace worker_utils {
-
-// Formats an error message for network errors. Returns true if the error has
-// a specific message. Otherwise, formats a generic network connection message
-// and returns false.
-bool FormatMessageForNetworkError(HRESULT error,
-                                  const CString& language,
-                                  CString* msg);
-
-// Adds http request details to the event log.
-void AddHttpRequestDataToEventLog(HRESULT hr,
-                                  int http_status_code,
-                                  const CString& http_trace,
-                                  bool is_machine);
-
-bool GetInstallActionForEvent(
-    const std::vector<xml::InstallAction>& install_actions,
-    xml::InstallAction::InstallEvent install_event,
-    const xml::InstallAction** action);
-
-}  // namespace worker_utils
-
-}  // namespace omaha
-
-#endif  // OMAHA_GOOPDATE_WORKER_UTILS_H_
diff --git a/goopdate/worker_utils_unittest.cc b/goopdate/worker_utils_unittest.cc
deleted file mode 100644
index ccaaf4c..0000000
--- a/goopdate/worker_utils_unittest.cc
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-#include <atlstr.h>
-#include "omaha/base/app_util.h"
-#include "omaha/base/error.h"
-#include "omaha/goopdate/worker_utils.h"
-#include "omaha/goopdate/resource_manager.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace worker_utils {
-
-TEST(WorkerUtilsTest, FormatMessageForNetworkError) {
-  const TCHAR* const kEnglish = _T("en");
-  EXPECT_SUCCEEDED(ResourceManager::Create(
-      false, app_util::GetCurrentModuleDirectory(), kEnglish));
-
-  const TCHAR* const kTestAppName = _T("Test App");
-  CString message;
-  EXPECT_EQ(true, FormatMessageForNetworkError(GOOPDATE_E_NO_NETWORK,
-                                               kEnglish,
-                                               &message));
-  EXPECT_STREQ(
-      _T("The installer could not connect to the Internet. Ensure that your ")
-      _T("computer is connected to the Internet and your firewall allows ")
-      _T("GoogleUpdate.exe to connect then try again."),
-      message);
-
-  EXPECT_EQ(true, FormatMessageForNetworkError(GOOPDATE_E_NETWORK_UNAUTHORIZED,
-                                               kEnglish,
-                                               &message));
-  EXPECT_STREQ(
-      _T("The installer could not connect to the Internet because of ")
-      _T("an HTTP 401 Unauthorized response. This is likely a proxy ")
-      _T("configuration issue. Please configure the proxy server to allow ")
-      _T("network access and try again or contact your network administrator."),
-      message);
-
-  EXPECT_EQ(true, FormatMessageForNetworkError(GOOPDATE_E_NETWORK_FORBIDDEN,
-                                               kEnglish,
-                                               &message));
-  EXPECT_STREQ(
-      _T("The installer could not connect to the Internet because of ")
-      _T("an HTTP 403 Forbidden response. This is likely a proxy ")
-      _T("configuration issue. Please configure the proxy server to allow ")
-      _T("network access and try again or contact your network administrator."),
-      message);
-
-  EXPECT_EQ(true,
-            FormatMessageForNetworkError(GOOPDATE_E_NETWORK_PROXYAUTHREQUIRED,
-                                         kEnglish,
-                                         &message));
-  EXPECT_STREQ(
-      _T("The installer could not connect to the Internet because a ")
-      _T("proxy server required user authentication. Please configure the ")
-      _T("proxy server to allow network access and try again or contact your ")
-      _T("network administrator."),
-      message);
-
-  EXPECT_EQ(false, FormatMessageForNetworkError(E_FAIL, kEnglish, &message));
-  EXPECT_STREQ(
-      _T("The installer could not connect to the Internet. Ensure that your ")
-      _T("computer is connected to the Internet and your firewall allows ")
-      _T("GoogleUpdate.exe to connect then try again."),
-      message);
-
-  ResourceManager::Delete();
-}
-
-}  // namespace job_controller_utils
-
-}  // namespace omaha
diff --git a/hammer.bat b/hammer.bat
deleted file mode 100644
index 7dd816f..0000000
--- a/hammer.bat
+++ /dev/null
@@ -1,14 +0,0 @@
-@echo off
-
-setlocal
-
-set PROXY_CLSID_TARGET=%~dp0proxy_clsids.txt
-set CUSTOMIZATION_UT_TARGET=%~dp0common\omaha_customization_proxy_clsid.h
-
-call %SCT_DIR%\hammer.bat %*
-
-if /i {%1} == {-c} (
-  del /q /f "%PROXY_CLSID_TARGET%" 2> NUL
-  del /q /f "%CUSTOMIZATION_UT_TARGET%" 2> NUL
-)
-
diff --git a/installers/SampleApp_installers.txt b/installers/SampleApp_installers.txt
deleted file mode 100644
index 10b7c39..0000000
--- a/installers/SampleApp_installers.txt
+++ /dev/null
Binary files differ
diff --git a/installers/UserTestFoo_installers.txt b/installers/UserTestFoo_installers.txt
deleted file mode 100644
index e9d298d..0000000
--- a/installers/UserTestFoo_installers.txt
+++ /dev/null
Binary files differ
diff --git a/installers/__init__.py b/installers/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/installers/__init__.py
+++ /dev/null
diff --git a/installers/build.scons b/installers/build.scons
deleted file mode 100644
index 8300f92..0000000
--- a/installers/build.scons
+++ /dev/null
@@ -1,230 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-
-Import('env')
-
-import codecs
-import os
-import re
-import string
-
-from installers import build_metainstaller
-
-_RECOVERY_MARKUP_DLL_BASE_NAME = 'recovery_markup'
-_RECOVERY_MARKUP_DLL = _RECOVERY_MARKUP_DLL_BASE_NAME + '.dll'
-
-_CLICKONCE_DEPLOY_DIR = '$TARGET_ROOT/clickonce_deployment'
-
-# This will be of the form 'GoogleInstaller_en.application'.
-def _GetClickOnceDeploymentName(language):
-  return 'GoogleInstaller_%s.application' % (language)
-
-# Generate a ClickOnce deployment manifest personalized with the localized
-# display name of 'Google Installer'.
-def _GenerateDeploymentForOneLanguage(omaha_version_info, language):
-  clickonce_deployment_name = _GetClickOnceDeploymentName(language)
-
-  clickonce_manifest_name = 'clickonce_bootstrap.exe.manifest'
-  clickonce_manifest = '%s/%s' % (_CLICKONCE_DEPLOY_DIR,
-                                  clickonce_manifest_name)
-
-  # Generate the deployment manifest with a dummy name of 'xxxXXXxxx'. The
-  # Python commands module does not work with Unicode strings, so we will
-  # substitute the name in the add_trusturlparams_and_name_command below.
-  generate_deploy_manifest_command = (
-      '@mage -New Deployment -Install false -ToFile $TARGET -Name xxxXXXxxx'
-      ' -Version %s -Processor x86 -AppManifest $SOURCE -AppCodeBase %s' %
-      (omaha_version_info.GetVersionString(), clickonce_manifest_name))
-
-  # Have to set up a clear chain of source->target1->target2->target3->etc so
-  # that declarative Hammer will know the order in which to run each command.
-  clickonce_target_1 = env.Command(
-      target=clickonce_deployment_name + '.base',
-      source=clickonce_manifest,
-      action=generate_deploy_manifest_command,
-  )
-
-  # Get the localized 'Google Installer' string.
-  mi_generated_resource = (
-      '$MAIN_DIR/mi_exe_stub/mi_generated_resources_%s.rc' % language)
-  f_in = codecs.open(env.File(mi_generated_resource).abspath, 'r', 'utf16')
-  mi_resource_contents = f_in.read()
-  f_in.close()
-
-  # Get and format strings necessary to generate the display name.
-  # index() will throw and abort the build if there is no match.
-
-  # First, get the company name.
-  company_name_start = (mi_resource_contents.index('IDS_FRIENDLY_COMPANY_NAME'))
-  company_name_start = mi_resource_contents.index('"', company_name_start)
-  company_name_end = mi_resource_contents.index('"', company_name_start + 1)
-  # Since it is inserted into the display name, the quotes must be dropped.
-  company_name = mi_resource_contents[company_name_start + 1:company_name_end]
-  if -1 != company_name.find('"'):
-    raise Exception('Slice indexes are incorrect!')
-
-  # Now get the installer display name and replace the placeholder with the
-  # company name.
-  display_name_start = (
-      mi_resource_contents.index('IDS_INSTALLER_DISPLAY_NAME'))
-  display_name_start = mi_resource_contents.index('"', display_name_start)
-  display_name_end = mi_resource_contents.index('"', display_name_start + 1)
-  display_name = mi_resource_contents[display_name_start:display_name_end + 1]
-  display_name = display_name.replace('%1!s!', company_name)
-
-  # display_name is utf8 encoded to allow the commands and the default codec to
-  # pass it through.
-  display_name = display_name.encode('utf8')
-
-  # mage.exe does not provide a way to add the trustURLParameters attribute to
-  # an application manifest. This script fills that gap. It also adds in the
-  # localized display name, to get around issues with the Python commands
-  # module.
-  add_trusturlparams_and_name_command = (
-      '@python %s --manifest_file=$SOURCE --output_file=$TARGET --display_name='
-      '%s' % (env.File('$MAIN_DIR/clickonce/add_trusturlparams.py').abspath,
-      display_name))
-
-  # This is the next step in the target chain
-  clickonce_target_2 = env.Command(
-      target=clickonce_deployment_name + '.unsigned',
-      source=clickonce_target_1,
-      action=add_trusturlparams_and_name_command,
-  )
-
-  # Sign the deployment manifest.
-  # This will be of the form
-  # 'scons-out\dbg-win\clickonce_deployment\GoogleInstaller_en.application'.
-  manifest_target = '%s/%s' % (_CLICKONCE_DEPLOY_DIR, clickonce_deployment_name)
-  env.SignDotNetManifest(manifest_target, clickonce_target_2)
-
-
-
-def _BuildSetup(omaha_versions_info, is_repair = False):
-  # Build the meta-installer for each version.
-  _PRODUCT_NAME = 'GoogleUpdate'
-
-  for omaha_version_info in omaha_versions_info:
-    prefix = omaha_version_info.filename_prefix
-
-    source_binary = '$OBJ_ROOT/mi_exe_stub/%smi_exe_stub.exe' % prefix
-
-    if is_repair:
-      _BuildSetupRepairVersion(omaha_version_info,
-                               source_binary,
-                               _PRODUCT_NAME,
-                               prefix)
-    else:
-      _BuildSetupVersion(omaha_version_info,
-                         source_binary,
-                         _PRODUCT_NAME,
-                         prefix)
-
-
-
-def _BuildSetupRepairVersion(omaha_version_info,
-                             source_binary,
-                             product_name,
-                             prefix = ''):
-  # Build the target setup executable by merging the empty metafile
-  # with the resource dll built earlier
-  merged_output = env.Command(
-      target='%smi_exe_stub_repair.exe' % (prefix),
-      source=[source_binary, '$OBJ_ROOT/installers/' + _RECOVERY_MARKUP_DLL],
-      action='@$MAIN_DIR/tools/resmerge --copyappend $SOURCES $TARGET',
-  )
-
-  build_metainstaller.BuildMetaInstaller(
-      env=env,
-      target_name='%s%sSetup_repair.exe' % (prefix, product_name),
-      omaha_version_info=omaha_version_info,
-      empty_metainstaller_path=merged_output,
-      omaha_files_path='$STAGING_DIR',
-      prefix = prefix,
-      suffix = '_repair',
-      additional_payload_contents = [
-          '$STAGING_DIR/GoogleUpdateHelperPatch.msp',
-          ],
-  )
-
-
-
-def _BuildSetupVersion(omaha_version_info,
-                       source_binary,
-                       product_name,
-                       prefix = ''):
-  target_name = '%s%sSetup.exe' % (prefix, product_name)
-
-  build_metainstaller.BuildMetaInstaller(
-      env=env,
-      omaha_version_info=omaha_version_info,
-      target_name=target_name,
-      empty_metainstaller_path=source_binary,
-      omaha_files_path='$STAGING_DIR',
-      prefix=prefix
-  )
-
-  # Generate the i18n ClickOnce deployment manifest for languages that we
-  # support.
-  if env.Bit('all') or 'OMAHA_BUILD_CLICKONCE' in os.environ.keys():
-    for language in omaha_version_info.GetSupportedLanguages():
-      _GenerateDeploymentForOneLanguage(omaha_version_info, language)
-
-    # zh-HK needs a deployment file, but it is not in
-    # omaha_version_info.GetSupportedLanguages() and there is no
-    # mi_generated_resources_zh-HK.rc file. The few translations are inherited
-    # from zh-TW, and there are no language code-specific values in the
-    # deployment file, so just copy the zh-TW file to zh-HK.
-    env.Command(
-        target='%s/%s' % (_CLICKONCE_DEPLOY_DIR,
-                          _GetClickOnceDeploymentName('zh-HK')),
-        source='%s/%s' % (_CLICKONCE_DEPLOY_DIR,
-                          _GetClickOnceDeploymentName('zh-TW')),
-        action='@copy /y $SOURCES $TARGET'
-    )
-
-if not env.Bit('official_installers'):
-  omaha_versions_info = env['omaha_versions_info']
-
-  # Build the normal tagged installers.
-  _BuildSetup(omaha_versions_info)
-
-  env.Replicate(
-      target=[
-          '$TARGET_ROOT/clickonce_deployment/bin/',
-          '$STAGING_DIR',
-          ],
-      source='$OBJ_ROOT/installers/GoogleUpdateSetup.exe',
-  )
-
-  # Build the repair installer.
-  _BuildSetup(omaha_versions_info, is_repair = True)
-
-  # Build a resource DLL containing the recovery markup resource.
-  dll_env = env.Clone(COMPONENT_STATIC=False)
-  dll_env['LINKFLAGS'] += ['/noentry']
-
-  dll_inputs = [
-      '../installers/resource_only_dll.def',
-      dll_env.RES('recovery_markup.res',
-                  '$MAIN_DIR/recovery/recovery_markup.rc')
-      ]
-
-  dll_env.ComponentLibrary(_RECOVERY_MARKUP_DLL_BASE_NAME, dll_inputs)
-
-
diff --git a/installers/build_metainstaller.py b/installers/build_metainstaller.py
deleted file mode 100644
index fbd14f2..0000000
--- a/installers/build_metainstaller.py
+++ /dev/null
@@ -1,177 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-"""Build a meta-installer for Omaha's client installations.
-
-  The only function in this module creates an Omaha meta-installer, which is
-  an executable whose only job is to extract its payload (the actual installer
-  executable and a number of resource dlls), then launch the dropped installer
-  to finish the installation.
-
-  BuildMetaInstaller(): Build a meta-installer.
-"""
-
-
-def BuildMetaInstaller(
-    env,
-    target_name,
-    omaha_version_info,
-    empty_metainstaller_path,
-    omaha_files_path,
-    prefix='',
-    suffix='',
-    additional_payload_contents=None,
-    additional_payload_contents_dependencies=None,
-    output_dir='$STAGING_DIR',
-    installers_sources_path='$MAIN_DIR/installers',
-    lzma_path='$MAIN_DIR/third_party/lzma/v4_65/files/lzma.exe',
-    resmerge_path='$MAIN_DIR/tools/resmerge.exe',
-    bcj2_path='$OBJ_ROOT/mi_exe_stub/x86_encoder/bcj2.exe'):
-  """Build a meta-installer.
-
-    Builds a full meta-installer, which is a meta-installer containing a full
-    list of required files (the payload), ie. language resourse dlls, installer
-    executables, etc.
-
-  Args:
-    env: environment to build with
-    target_name: name to use for the target executable
-    omaha_version_info: info about the version of the Omaha files
-    empty_metainstaller_path: path to the base (empty) meta-installer executable
-    omaha_files_path: path to the resource dlls to build into the
-        target executable
-    prefix: target file name prefix, used to distinguish different targets
-    suffix: target file name suffix, used to distinguish different targets
-    additional_payload_contents: any additional resources to build into the
-        executable, beyond the normal payload files
-    additional_payload_contents_dependencies: extra dependencies to be used to
-        ensure the executable is rebuilt when required
-    output_dir: path to the directory that will contain the metainstaller
-    installers_sources_path: path to the directory containing the source files
-        for building the metainstaller
-    lzma_path: path to lzma.exe
-    resmerge_path: path to resmerge.exe
-    bcj2_path: path to bcj2.exe
-
-  Returns:
-    Target nodes.
-
-  Raises:
-    Nothing.
-  """
-
-  # Payload .tar.lzma
-  tarball_filename = '%spayload%s.tar' % (prefix, suffix)
-  payload_filename = tarball_filename + '.lzma'
-
-  # Collect a list of all the files to include in the payload
-  payload_file_names = omaha_version_info.GetMetainstallerPayloadFilenames()
-
-  payload_contents = [omaha_files_path + '/' + file_name
-                      for file_name in payload_file_names]
-  if additional_payload_contents:
-    payload_contents += additional_payload_contents
-
-  # Create the tarball
-  tarball_output = env.Command(
-      target=tarball_filename,    # Archive filename
-      source=payload_contents,    # List of files to include in tarball
-      action='python.exe %s -o $TARGET $SOURCES' % (
-          env.File(installers_sources_path + '/generate_tarball.py').abspath),
-  )
-
-  # Add potentially hidden dependencies
-  if additional_payload_contents_dependencies:
-    env.Depends(tarball_output, additional_payload_contents_dependencies)
-
-  # Preprocess the tarball to increase compressibility
-  bcj_filename = '%spayload%s.tar.bcj' % (prefix, suffix)
-  # TODO(omaha): Add the bcj2 path as an optional parameter.
-  bcj_output = env.Command(
-      target=bcj_filename,
-      source=tarball_output,
-      action='%s "$SOURCES" "$TARGET"' % bcj2_path,
-  )
-  env.Depends(bcj_output, bcj2_path)
-
-  # Compress the tarball
-  lzma_env = env.Clone()
-  lzma_env.Append(
-      LZMAFLAGS=[],
-  )
-  lzma_output = lzma_env.Command(
-      target=payload_filename,
-      source=bcj_output,
-      action='%s e $SOURCES $TARGET $LZMAFLAGS' % lzma_path,
-  )
-
-  # Construct the resource generation script
-  manifest_path = installers_sources_path + '/installers.manifest'
-  res_command = 'python.exe %s -i %s -o $TARGET -p $SOURCES -m %s -r %s' % (
-      env.File(installers_sources_path + '/generate_resource_script.py'
-              ).abspath,
-      env.File(installers_sources_path + '/resource.rc.in').abspath,
-      env.File(manifest_path).abspath,
-      env.File(installers_sources_path + '/resource.h').abspath
-      )
-
-  # Generate the .rc file
-  rc_output = env.Command(
-      target='%sresource%s.rc' % (prefix, suffix),
-      source=lzma_output,
-      action=res_command,
-  )
-
-  # .res intermediate file
-  res_file = env.RES(rc_output)
-
-  # For some reason, RES() does not cause the .res file to depend on .rc input.
-  # It also does not detect the dependencies in the .rc file.
-  # This does not cause a rebuild for rarely changing files in res_command.
-  env.Depends(res_file, [rc_output, manifest_path, lzma_output])
-
-  # Resource DLL
-  dll_env = env.Clone(COMPONENT_STATIC=False)
-  dll_env['LINKFLAGS'] += ['/noentry']
-
-  dll_inputs = [
-      installers_sources_path + '/resource_only_dll.def',
-      res_file
-      ]
-
-  dll_output = dll_env.ComponentLibrary(
-      lib_name='%spayload%s' % (prefix, suffix),
-      source=dll_inputs,
-  )
-
-  # Get only the dll itself from the output (ie. ignore .pdb, etc.)
-  dll_output_name = [f for f in dll_output if f.suffix == '.dll']
-
-  # Build the target setup executable by merging the empty metafile
-  # with the resource DLL built above.
-  merged_output = env.Command(
-      target='unsigned_' + target_name,
-      source=[empty_metainstaller_path, dll_output_name],
-      action= '%s --copyappend $SOURCES $TARGET' % resmerge_path
-  )
-
-  signed_exe = env.SignedBinary(
-      target=target_name,
-      source=merged_output,
-  )
-
-  return env.Replicate(output_dir, signed_exe)
diff --git a/installers/generate_resource_script.py b/installers/generate_resource_script.py
deleted file mode 100644
index d755fc1..0000000
--- a/installers/generate_resource_script.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-import getopt
-import os.path
-import re
-import sys
-
-def GenerateResourceScript(input_filename, output_filename, payload_filename,
-                           manifest_filename, resource_filename):
-  """
-  Given a template name, output filename, payload filename, manifest filename,
-  and resource_filename, and creates a resource script.
-  """
-  f_int = open(input_filename, 'r')
-  f_out = open(output_filename, 'w')
-
-  for line in f_int.readlines():
-    f_out.write(re.sub(r'__RESOURCE_FILENAME__', resource_filename,
-                re.sub(r'__MANIFEST_FILENAME__', manifest_filename,
-                re.sub(r'__PAYLOAD_FILENAME__', payload_filename, line))))
-
-(opts, args) = getopt.getopt(sys.argv[1:], 'i:o:p:m:r:')
-
-input_filename = ''
-output_filename = ''
-payload_filename = ''
-manifest_filename = ''
-resource_filename = ''
-
-for (o, v) in opts:
-  if o == '-i':
-    input_filename = v
-  if o == '-o':
-    output_filename = v
-  if o == '-p':
-    payload_filename = v
-  if o == '-m':
-    manifest_filename = v
-  if o == '-r':
-    resource_filename = v
-
-# The forward slashes prevent the RC compiler from trying to interpret
-# backslashes in the quoted path.
-GenerateResourceScript(input_filename, output_filename,
-  re.sub(r'\\', r'/', payload_filename),
-  re.sub(r'\\', r'/', manifest_filename),
-  re.sub(r'\\', r'/', resource_filename))
diff --git a/installers/generate_tarball.py b/installers/generate_tarball.py
deleted file mode 100644
index f12af59..0000000
--- a/installers/generate_tarball.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-import getopt
-import os.path
-import sys
-import tarfile
-import urllib
-
-TEST_PREFIX = 'TEST_'
-
-def GenerateTarball(output_filename, members):
-  """
-  Given a tarball name and a sequence of filenames, creates a tarball
-  containing the named files.
-  """
-  tarball = tarfile.open(output_filename, 'w')
-  for filename in members:
-    # A hacky convention to get around the spaces in filenames is to
-    # urlencode them. So at this point we unescape those characters.
-    scrubbed_filename = urllib.unquote(os.path.basename(filename))
-    if scrubbed_filename.startswith(TEST_PREFIX):
-      scrubbed_filename = scrubbed_filename[len(TEST_PREFIX):]
-    tarball.add(filename, scrubbed_filename)
-  tarball.close()
-
-(opts, args) = getopt.getopt(sys.argv[1:], 'i:o:p:')
-
-output_filename = ''
-
-for (o, v) in opts:
-  if o == '-o':
-    output_filename = v
-
-GenerateTarball(output_filename, args)
diff --git a/installers/installers.manifest b/installers/installers.manifest
deleted file mode 100644
index 005db1b..0000000
--- a/installers/installers.manifest
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
-  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
-    <security>
-      <requestedPrivileges>
-        <requestedExecutionLevel level="asInvoker" />
-      </requestedPrivileges>
-    </security>
-  </trustInfo>
-  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
-    <application>
-      <!--The ID below indicates application support for Windows Vista -->
-      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
-      <!--The ID below indicates application support for Windows 7 -->
-      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
-    </application>
-  </compatibility>
-</assembly>
diff --git a/installers/resource.h b/installers/resource.h
deleted file mode 100644
index e76ebbb..0000000
--- a/installers/resource.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-// Used by mi.rc
-
-#ifndef OMAHA_INSTALLERS_RESOURCE_H__
-#define OMAHA_INSTALLERS_RESOURCE_H__
-
-#define IDI_APP                         101
-#define IDR_PAYLOAD                     102
-
-// Next default values for new objects
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        103
-#define _APS_NEXT_COMMAND_VALUE         40001
-#define _APS_NEXT_CONTROL_VALUE         1001
-#define _APS_NEXT_SYMED_VALUE           101
-#endif
-#endif
-
-#endif  // OMAHA_INSTALLERS_RESOURCE_H__
diff --git a/installers/resource.rc.in b/installers/resource.rc.in
deleted file mode 100644
index 08b7b39..0000000
--- a/installers/resource.rc.in
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// The __ symbols are replaced by a script that creates the rc file.
-#include "__RESOURCE_FILENAME__"
-
-#include <afxres.h>
-
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-IDR_PAYLOAD B "__PAYLOAD_FILENAME__"
-1 RT_MANIFEST "__MANIFEST_FILENAME__"
diff --git a/installers/resource_only_dll.def b/installers/resource_only_dll.def
deleted file mode 100644
index 078c46b..0000000
--- a/installers/resource_only_dll.def
+++ /dev/null
@@ -1,16 +0,0 @@
-; Copyright 2007-2009 Google Inc.
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-;      http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-; ========================================================================
-;
-; dummy def file to create implib
diff --git a/installers/tag_meta_installers.py b/installers/tag_meta_installers.py
deleted file mode 100644
index d85d5b0..0000000
--- a/installers/tag_meta_installers.py
+++ /dev/null
@@ -1,285 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2005-2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-"""Creates application specific meta-installers.
-
-Run this script with the directory that contains the build files,
-GoogleupdateSetup_<lang>.exe and pass it the file that contains the application
-information to be stamped inside the binary.
-
-"""
-
-import codecs
-import os
-import sys
-import re
-import urllib
-
-class Bundle:
-  """Represents the information for a bundle"""
-  def __init__(self, exe_name, admin, language,
-               browser_type, stats, installers_txt_filename, applications):
-    self.applications = applications
-    self.name = exe_name
-    self.needs_admin = admin
-    self.lang = language
-    self.browser = browser_type
-    self.usage_stats = stats
-    self.installers_txt_filename = installers_txt_filename
-    self.output_file_name = ""
-
-def UrlEncodeString(name):
-  """Converts the name into utf8 encoded and then urlencodes it.
-
-  Args:
-    name: The string to utf8 convert.
-
-  Returns:
-    The utf8 converted urlencoded string.
-  """
-  utf8_str = name.encode('utf8')
-  return urllib.quote(utf8_str)
-
-def ReadBundleInstallerFile(installers_txt_filename):
-  """Read the installation file and return a list of the values.
-     Only reads information from bundle installer files. The filename
-     should contain the "bundle" word.
-  Args:
-    installers_txt_filename: The file which contains application specific
-                             values, of guid, name, exe_name, needs_admin and
-                             language.
-
-  Returns:
-    A dictionary of Bundles key=language, value=[Bundle]
-  """
-  bundles = {}
-  installers_txt_file = codecs.open(installers_txt_filename, 'r', 'utf16')
-  for line in installers_txt_file.readlines():
-    line = line.strip()
-    if len(line) and not line.startswith('#'):
-      (exe_name, needs_admin, language, browser, usage, bundle_apps) =\
-        eval(line)
-      bundle = Bundle(exe_name, needs_admin, language,
-                      browser, usage,
-                      installers_txt_filename, bundle_apps)
-      if (not bundles.has_key(language)):
-        bundles[language] = [bundle]
-      else:
-        bundles[language] .append(bundle)
-  return bundles
-
-def BuildOutputDirectory(output_dir, lang, app):
-  """Returns the output directory for the app.
-
-  Args:
-    app: The application for which to generate the path.
-    lang: The language of the applicaiton.
-    output_dir: The output directory.
-
-  Returns:
-    The path of the output file.
-  """
-  installers_txt_filename = app.installers_txt_filename
-
-  end_idx = installers_txt_filename.find('_installers.txt')
-  app_dirname = installers_txt_filename[:end_idx]
-
-  app_path = os.path.join(output_dir, app_dirname)
-  lang_path = os.path.join(app_path, lang)
-  return lang_path
-
-
-def SetOutputFileNames(file_name, apps, output_dir):
-  """Sets the output file names inside the Application.
-
-  Args:
-    file_name: The input file name that needs to be stamped. This
-               is used for deciding whether to use TEST in the name,
-               and the directory. The names of this file is expected
-               to be either TEST_GoogleUpdateSetup.exe or
-               GoogleUpdateSetup.exe
-    apps: Dictionary of applications keyed by language.
-    output_dir: The output directory.
-
-  Returns:
-    All the applications for a particular language.
-  """
-
-  # Determine the language.
-  file = os.path.basename(file_name)
-  if file.startswith('TEST_'):
-    test = True
-  else:
-    test = False
-
-  for (lang, apps_lang) in apps.iteritems():
-    # Get the output filename and set it on the application.
-    for app in apps_lang:
-      output_path = BuildOutputDirectory(output_dir, lang, app)
-      path = os.path.join(output_path, GetOutputFileName(test, app.name, lang))
-      app.output_file_name = path
-
-def GetOutputFileName(test, name, lang):
-  """Creates the output file name based on the language and the name of the app.
-  Args:
-    test: Whether the input file name starts with TEST.
-    name: The name of the application. I.e. Chrome, GoogleGears.
-    lang: The language of the installer.
-  Returns:
-    The output filename
-  """
-  if test:
-    file_name = 'Tagged_TEST_%sSetup_%s.exe' % (name, lang)
-  else:
-    file_name = 'Tagged_%sSetup_%s.exe' % (name, lang)
-  return file_name
-
-def BuildTagStringForBundle(bundle):
-  """Builds the string to be tagged into the binary for a bundle.
-  Args:
-    bundle: Contains all information about a bundle.
-  Returns:
-    The string to be tagged into the installer.
-  """
-  args = '\"'
-  first_app = True
-  for app in bundle.applications:
-    if not first_app:
-      args += '&'
-    first_app = False
-    (guid, name, ap) = app
-    display_name = UrlEncodeString(name)
-    args += 'appguid=%s&appname=%s&needsadmin=%s' % \
-            (guid, display_name, bundle.needs_admin)
-    if ap:
-      args += '&ap=%s' % ap
-
-  if bundle.usage_stats:
-    args += '&usagestats=%s' % bundle.usage_stats
-  if bundle.browser:
-    args += '&browser=%s' % bundle.browser
-  if bundle.lang:
-    args += '&lang=%s' % bundle.lang
-  args += '\"'
-  return args
-
-def TagOneFile(file, app, applytag_exe_name):
-  """Tags one file with the information contained inside the application.
-  Args:
-    file: The input file to be stamped.
-    app: Contains all the application data.
-    applytag_exe_name: The full path of applytag.exe.
-  """
-  tag_string = BuildTagStringForBundle(app)
-
-  output_path = app.output_file_name
-  if not os.path.exists(file):
-    print 'Could not find file %s required for creating %s' % \
-          (file, output_path)
-    return False
-
-  arguments = [applytag_exe_name,
-               file,
-               output_path,
-               tag_string
-              ]
-  print 'Building %s with tag %s' % (output_path, tag_string)
-  os.spawnv(os.P_WAIT, applytag_exe_name, arguments)
-  return True
-
-def GetAllSetupExeInDirectory(dir):
-  """Creates a number of application specific binaries for the
-     passed in binary.
-  Args:
-    dir: The input directory.
-  Returns:
-    A list of files that are match the regex:
-    TEST_GoogleUpdateSetup_.*.exe$|^GoogleUpdateSetup_.*.exe$
-  """
-  ret_files = []
-  files = os.listdir(dir)
-  for file in files:
-    regex = re.compile('^TEST_GoogleUpdateSetup_.*.exe$|'
-                       '^GoogleUpdateSetup_.*.exe$')
-    if not regex.match(file):
-      continue
-    ret_files.append(file)
-  return ret_files
-
-def TagBinary(apps, file, applytag_exe_name):
-  """Creates a number of application specific binaries for the
-     passed in binary.
-  Args:
-    apps: Dictionary of key=lang, value=[Application].
-    file: The input file to be stamped.
-    applytag_exe_name: The full path to applytag_exe_name.
-  """
-  if not apps:
-    return
-  for apps_lang in apps:
-    for app in apps[apps_lang]:
-      TagOneFile(file, app, applytag_exe_name)
-
-def PrintUsage():
-  print ''
-  print 'Tool to stamp the Guid, Application name, needs admin into the'
-  print 'meta-installer.'
-  print 'Reads <installer file> which contains the application name,'
-  print 'guid, needs_admin and stamps the meta-installer <file> with'
-  print 'these values.'
-  print 'For an example of the <installer file> take a look at'
-  print '#/installers/googlegears_installer.txt'
-  print ''
-  print 'tag_meta_installers.py <applytag> <input file> <installer file>\
-  <output file>'
-
-def main():
-  if len(sys.argv) != 5:
-    PrintUsage()
-    return
-
-  apply_tag_exe = sys.argv[1]
-  input_file = sys.argv[2]
-  file_name = sys.argv[3]
-  output_dir = sys.argv[4]
-
-  if not os.path.exists(apply_tag_exe):
-    print "Could not find applytag.exe"
-    PrintUsage()
-    return
-
-  if not os.path.exists(file_name):
-    print "Invalid filename %s" % file_name
-    PrintUsage()
-    return
-
-  if not os.path.exists(input_file):
-    print "Invalid directory %s" % input_file
-    PrintUsage()
-    return
-
-  if not os.path.exists(output_dir):
-    os.mkdir(output_dir)
-
-  # Read in the installers.txt file.
-  apps = ReadBundleInstallerFile(file_name)
-
-  SetOutputFileNames(input_file, apps, output_dir)
-  TagBinary(apps, input_file, apply_tag_exe)
-
-if __name__ == '__main__':
-  main()
diff --git a/installers/tagged_installer.py b/installers/tagged_installer.py
deleted file mode 100644
index da4b425..0000000
--- a/installers/tagged_installer.py
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/usr/bin/python2.4
-# Copyright 2009-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-import os
-import re
-
-from installers import tag_meta_installers
-
-
-def TagOneBundle(env, bundle, untagged_binary_path, output_dir):
-  tag_str = tag_meta_installers.BuildTagStringForBundle(bundle)
-
-  # Need to find relative path to output file under source dir, to allow
-  # it to be redirected under the output directory.
-  indx = bundle.output_file_name.find('installers')
-  relative_filepath = bundle.output_file_name[indx+len('installers')+1:]
-
-  tag_exe = '$TESTS_DIR/ApplyTag.exe'
-
-  tag_output = env.Command(
-      target='%s/%s' % (output_dir, relative_filepath),
-      source=untagged_binary_path,
-      action='%s $SOURCES $TARGET %s' % (
-          env.File(tag_exe).abspath, tag_str)
-  )
-
-  # Add extra (hidden) dependency plus a dependency on the tag executable.
-  env.Depends(tag_output, [bundle.installers_txt_filename, tag_exe])
-
-  return tag_output
-
-
-def _ReadAllBundleInstallerFiles(installers_txt_files_path):
-  """Enumerates all the .*_installers.txt files in the installers_txt_files_path
-     directory, and creates bundles corresponding to the info in each line in
-     the *_installers.txt file.
-  Returns:
-    Returns a dictionary of Bundles with key=lang.
-  """
-  bundles = {}
-  files = os.listdir(installers_txt_files_path)
-  for file in files:
-    regex = re.compile('^(.*)_installers.txt$')
-    if not regex.match(file):
-      continue
-
-    installer_file = os.path.join(installers_txt_files_path, file)
-
-    # Read in the installer file.
-    read_bundles = tag_meta_installers.ReadBundleInstallerFile(installer_file)
-
-    for (key, bundle_list) in read_bundles.items():
-      if not bundle_list or not key:
-        continue
-      if not bundles.has_key(key):
-        bundles[key] = bundle_list
-      else:
-        new_bundles_list = bundles[key] + bundle_list
-        bundles[key] = new_bundles_list
-  return bundles
-
-
-def CreateTaggedInstallers(env, installers_txt_files_path, product_name,
-                           prefix = ''):
-  """For each application with an installers.txt file in installer_files_path,
-     create tagged metainstaller(s).
-  """
-  bundles = _ReadAllBundleInstallerFiles(installers_txt_files_path)
-
-  untagged_binary = '%s%sSetup.exe' % (prefix, product_name)
-
-  tag_meta_installers.SetOutputFileNames(untagged_binary, bundles, '')
-  for bundles_lang in bundles.itervalues():
-    for bundle in bundles_lang:
-      TagOneBundle(
-          env=env,
-          bundle=bundle,
-          untagged_binary_path='$STAGING_DIR/%s' % (untagged_binary),
-          output_dir='$TARGET_ROOT/Tagged_Installers',
-      )
-
diff --git a/main.scons b/main.scons
deleted file mode 100644
index 1b2a612..0000000
--- a/main.scons
+++ /dev/null
@@ -1,819 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-
-# This main.scons file is the root description of the build specified in this
-# directory and those under it. Individual components and the source files
-# used to build them are described in subsidiary files called 'build.scons'.
-#
-# To build this project change the current directory to googleclient/Omaha.
-# Then run hammer.bat
-#
-# A number of command line options can be specified. For a full list, use the
-# -h and -H command options.
-#
-# Some useful options include:
-#   -h   :   Prints a list of which modules and build variants are available
-#            in this project.
-#   -H   :   Print SCons specific help. SCons is a build tool which this
-#            project uses in tandem with the Software Construction Toolkit
-#            to build.
-#   -c   :   Clean the project. I.e. delete all build output.
-#   -j3  :   Run up to 3 build steps at once.
-#
-# Some useful build targets include:
-#    all_programs    :   Build all programs generated by this project.
-#    all_libraries   :   Build all libraries generated by this project.
-#    all_tests       :   Build all tests generated by this project.
-#    run_all_tests   :   Build and run all tests generated by this project.
-#
-# Some examples:
-#   Build all programs and libraries in debug mode:
-#     hammer
-#   Build and run all tests in debug mode on windows:
-#     hammer MODE=dbg-win run_all_tests
-#   Build arbitrary library in the default mode:
-#     hammer <library name>
-
-import copy
-import os
-import sys
-
-import omaha_version_utils
-
-# To switch the build, simply change the value of the msc_ver variable below.
-# VC2003/VC71 is 1310 but not supported by the current build.
-# VC2005/VC80 is 1400.
-# VC2008/VC90 is 1500.
-_msc_ver = 1400
-
-_sdk_path = os.environ['OMAHA_VISTASDK_DIR']
-
-_signtool_path = os.path.join(_sdk_path, 'bin/signtool.exe')
-
-# Build the "Google Update", the Google-specific version of Omaha.
-# TODO(omaha): Set based on an environment variable and/or Hammer arg.
-is_google_update_build = False
-
-#
-# Begin vendor-specific constants.
-#
-# These values must be changed when customizing open source Omaha.
-# You may also wish to replace the language-neutral constants in the individual
-# *generated_resources_*.rc files with localized strings.
-_FULL_COMPANY_NAME = 'OmahaCompanyName Inc.'
-_SHORT_COMPANY_NAME = 'OmahaCompanyName'
-_PRODUCT_NAME = 'Update'
-_COMPANY_DOMAIN_BASE = 'google'
-_COMPANY_DOMAIN = _COMPANY_DOMAIN_BASE + '.com'
-_MAIN_EXE_BASE_NAME = 'GoogleUpdate'
-# TODO(omaha): Use this throughout the build files where goopdate and
-# goopdateres are referenced.
-_MAIN_DLL_BASE_NAME = 'goopdate'
-# "Google Inc." must not be removed from the copyright string. This literal also
-# appears as LegalCopyright in the VERSIONINFO section of .rc files.
-# TODO(omaha): Use this variable in .wxs files, etc.
-_OMAHA_COPYRIGHT_STRING_ENGLISH = 'Copyright 2007-2010 Google Inc.'
-
-
-# TODO(omaha): Allow open source Omaha to be built without the Recovery MSI,
-# which requires an extra certificate file and is unlikely to be used, or
-# ClickOnce, which requires specifying a certificate hash. Disabling Recovery
-# by default also means the open source build will work by default without
-# having to check in SaveArguments.exe to SVN every 100 days.
-# TODO(omaha3): Allow open source Omaha to be built without support for
-# Omaha 2's COM APIs.
-
-# The hash comes from the Thumbprint item in the Details tab of the file
-# properties for the public key .cer file.
-# TODO(omaha): Can we automate reading this and/or pass it on the command line?
-_BUILD_SERVER_CERTIFICATE_HASH = 'cafd39335d6e76f0e26d81296e7cbbfbdf16a720'
-
-#
-# End vendor-specific constants.
-#
-
-
-# Windows is the only environment we bulid for, so create a specialized base
-# environment for Windows.
-win_env = Environment(
-    # For internal builds only, it is a good idea to have set before the
-    # 'component_setup' tool is used even though we add the SDK directories to
-    # the appropriate environment variables manually below.
-    PLATFORM_SDK_DIR = _sdk_path,
-    tools=[
-        'component_setup',
-        'target_platform_windows',
-        # Need to use 'masm' to override the 'as' tool currently used
-        # by default in 'target_platform_windows'
-        'masm',
-        'atlmfc_vc80',
-        'code_signing',
-        'component_targets_msvs',
-        'omaha_builders',
-    ],
-    msc_ver = _msc_ver,
-    build_server_certificate_hash = _BUILD_SERVER_CERTIFICATE_HASH,
-    # Visual Studio 2008 does not ship the sign tool. Use the sign tool from
-    # the Platform SDK. This must come after the 'code_signing' tool is used.
-    # Remove this if http://code.google.com/p/swtoolkit/issues/detail?id=16 is
-    # fixed.
-    SIGNTOOL = '"' + _signtool_path + '"',
-)
-
-# Remove this value because it conflicts with a #define
-# in shlwapi.h in the Vista SDK
-win_env.FilterOut(CPPDEFINES = ['OS_WINDOWS=OS_WINDOWS'])
-
-# We pre-generate our own manifests, so make sure hammer does not generate
-# default ones for us
-del win_env['MANIFEST_FILE']
-
-# Hack to work around bug in Hammer (http://b/1585388).
-# TODO(Omaha): Remove when bug is fixed.
-if win_env['ENV'].has_key('SYSTEMROOT'):
-  if win_env['ENV'].has_key('SystemRoot'):
-    del win_env['ENV']['SYSTEMROOT']
-    del os.environ['SYSTEMROOT']
-
-# Work around http://code.google.com/p/swtoolkit/issues/detail?id=10.
-win_env['COMPONENT_TEST_SUBSYSTEM_WINDOWS'] = 1
-
-# Declare command line options relating to code signing
-# authenticode_file and authenticode_password are used by the normal signing
-# tool and to sign manifests for ClickOnce.
-# patching_certificate is used to create patchable MSI installers and MSPs.
-# authenticode_file and authenticode_password are only used if !build_server.
-# patching_certificate is used in all cases.
-AddOption(
-    '--authenticode_file',
-    action='store',
-    nargs=1,
-    type='string',
-    default='$MAIN_DIR/data/OmahaTestCert.pfx'
-)
-
-default_cert_password = 'test'
-AddOption(
-    '--authenticode_password',
-    action='store',
-    nargs=1,
-    type='string',
-    default=default_cert_password
-)
-
-AddOption(
-    '--patching_certificate',
-    action='store',
-    nargs=1,
-    type='string',
-    default='$MAIN_DIR/data/OmahaTestCert.cer'
-)
-
-# Declare option for specifying path to new official build files
-AddOption(
-    '--official_build_path',
-    action='store',
-    nargs=1,
-    type='string',
-    default=None
-)
-
-# Declare option for specifying the set of official app installers to build.
-# The value describes the name of the directory containing the official
-# installer manifests and definitions.
-AddOption(
-    '--official_installer_app',
-    action='store',
-    nargs=1,
-    type='string',
-    default=None
-)
-
-AddOption(
-    '--official_installer_file',
-    action='store',
-    nargs=1,
-    type='string',
-    default=None
-)
-
-AddOption(
-    '--build_number',
-    action='store',
-    nargs=1,
-    type='string',
-    default=''
-)
-
-# Declare various boolean states.
-DeclareBit('use_precompiled_headers', 'Use precompiled headers in build')
-DeclareBit('official_installers', 'Building using checked-in binaries')
-DeclareBit('build_server', 'Running on the build server')
-DeclareBit('build_two_versions', 'Build second version for self-update testing')
-DeclareBit('test_certificate', 'Files will be signed with the test certificate')
-DeclareBit('bin', 'Building from pre-built binaries')
-DeclareBit('min', 'Building minimal set of projects')
-DeclareBit('all', 'Building all Projects')
-DeclareBit('msvs', 'Building Visual Studio solution files')
-DeclareBit('no-tests', 'Do not build the unit tests')
-
-# Build official installers if --official_installers is on the command line.
-win_env.SetBitFromOption('official_installers', False)
-
-# Build as a build server if --build_server is on the command line.
-win_env.SetBitFromOption('build_server', False)
-
-# Build two versions if --build_two_versions is on the command line.
-win_env.SetBitFromOption('build_two_versions', False)
-
-# Store new versions of pre-built binaries if --bin is on the command line.
-win_env.SetBitFromOption('bin', False)
-
-# Build minimal set of libs if --min is on the command line.
-win_env.SetBitFromOption('min', False)
-
-# Build all libs if --all is on the command line.
-win_env.SetBitFromOption('all', False)
-
-# Build Visual Studio solution files if --msvs is on the command line.
-win_env.SetBitFromOption('msvs', False)
-
-# Do not build the unit tests if the bit is set.
-win_env.SetBitFromOption('no-tests', False)
-
-# Build all directories and two versions if this is the build server.
-if win_env.Bit('build_server'):
-  win_env.SetBits('all')
-  win_env.SetBits('build_two_versions')
-
-# Make sure 'all' overrides 'min'.
-if win_env.Bit('all'):
-  win_env.ClearBits('min')
-
-# Allow use of command-line-specified certificates to sign with, but
-# only if we're not on the build server.
-if not win_env.Bit('build_server'):
-  win_env.Replace(
-    CERTIFICATE_PATH=GetOption('authenticode_file'),
-    CERTIFICATE_PASSWORD=GetOption('authenticode_password'),
-  )
-
-  # Store whether we're using the default test cert separately, because
-  # we won't always know what the default password was.
-  if GetOption('authenticode_password') is default_cert_password:
-    win_env.SetBits('test_certificate')
-
-
-# The precompiled headers are to be used as an optional build speed up
-# build facility. Individual compilation units in the project must build with
-# or without precompiled headers. Building without precompiled headers is sort
-# of meaningless, since all the time we should build with it. However,
-# eliminating the dependency is desirable from a few reasons:
-# 1. making sure the files in the project include all the definitions they need
-# 2. creating different precompile headers if needed.
-# 3. making sure the precompile headers do not add to the size bloat.
-# There are two current limitations with the current setup.
-# First, due to pushing the warning level to W4 and WAll, we rely on the
-# common precompile.h to properly turn off the warnings inside system and
-# library code.
-# Second, to override the ATLASSERT, a file must be included before any of
-# the atl headers. To do this on a case by case basis is impractical and
-# error prone.
-# Therefore, when building with precompile headers off, the code is
-# building on W3 and it is not taking over the ATL asserts.
-win_env.SetBitFromOption('use_precompiled_headers', True)
-
-if win_env.Bit('use_precompiled_headers'):
-  print 'Using precompiled headers.'
-
-
-#
-# Set up version info.
-#
-omaha_version_info = omaha_version_utils.OmahaVersionInfo('VERSION')
-omaha_versions_info = [omaha_version_info]
-
-if win_env.Bit('build_two_versions'):
-  omaha_test_version_info = copy.deepcopy(omaha_version_info)
-  omaha_test_version_info.MakeTestVersion()
-  omaha_versions_info.append(omaha_test_version_info)
-
-# Print the version(s) being built.
-print 'Building versions: %s' % ', '.join(
-    [version_info.GetVersionString() for version_info in omaha_versions_info])
-
-build_number = GetOption('build_number')
-if build_number:
-  print 'Build number: %s' % build_number
-
-win_env['omaha_versions_info'] = omaha_versions_info
-
-if is_google_update_build:
-    win_env.Append(
-        CPPDEFINES = ['GOOGLE_UPDATE_BUILD'],
-        RCFLAGS = ['/DGOOGLE_UPDATE_BUILD=1'],
-    )
-
-# Make sure python.exe can be located.
-win_env.AppendENVPath('PATH', os.environ['OMAHA_PYTHON_DIR'])
-
-win_env.Append(
-    # Add windows specific compiler flags.
-    CCFLAGS = [
-        '/nologo',
-        '/c',
-        '/Zc:forScope',
-        '/D_HAS_EXCEPTIONS=0',
-        '/DCOMPILER_MSVC',
-        '/J',
-        '/DSTL_MSVC',
-        '/GR-',
-        '/D_CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES=1',
-        '/D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1',
-        '/D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT=1',
-        '/WX',      # warnings as errors
-
-        #
-        # Disable the following level 4 warnings below.
-        #
-        '/wd4127',  # conditional expression is constant
-        '/wd4189',  # local variable is initialized but not referenced
-        '/wd4505',  # unreferenced local function has been removed
-
-        #
-        # Disable the pedantic warnings below.
-        #
-        '/wd4191',  # unsafe conversion from 'type of expression' to
-                    #     'type required'
-        '/wd4217',  # member template functions cannot be used for
-                    #     copy-assignment...
-        '/wd4365',  # conversion from 'type_1' to 'type_2',
-                    #     signed/unsigned mismatch
-        '/wd4512',  # assignment operator could not be generated
-        '/wd4514',  # unreferenced inline function has been removed
-        '/wd4555',  # expression has no effect
-        '/wd4619',  # #pragma warning : there is no warning number 'number'
-        '/wd4623',  # default constructor could not be generated...
-        '/wd4625',  # copy constructor could not be generated...
-        '/wd4626',  # assignment operator could not be generated...
-        '/wd4668',  # not defined as a preprocessor macro, replacing with '0'.
-        '/wd4710',  # function not inlined
-        '/wd4711',  # function 'function' selected for inline expansion
-        '/wd4738',  # storing 32-bit float result in memory...
-        '/wd4820',  # bytes padding added after construct 'member_name'
-        ],
-
-    # Where to look for include files.
-    CPPPATH = [
-        '$MAIN_DIR',
-        '$MAIN_DIR/..',
-        '$MAIN_DIR/third_party/chrome',
-        '$MAIN_DIR/third_party/gtest/include',
-        ],
-
-    # Defines for windows environment.
-    CPPDEFINES = [
-        'WIN32', '_WINDOWS',
-        'UNICODE', '_UNICODE',
-        'WIN32_LEAN_AND_MEAN',
-        'STRICT',
-        'SECURITY_WIN32',
-        '_ATL_ALL_WARNINGS',
-        '_ATL_CSTRING_EXPLICIT_CONSTRUCTORS',
-        '_ATL_CSTRING_NO_CRT',
-        '_ATL_NO_ACLAPI',
-        '_ATL_NO_DEFAULT_LIBS',
-        '_ATL_NO_EXCEPTIONS',
-        '_ATL_NO_GLOBAL_SOCKET_STARTUP',
-        '_ATL_NO_PERF_SUPPORT',
-        '_ATL_NO_TRACK_HEAP',
-        '_ATL_NO_UUIDOF',
-        '_ATL_STATIC_REGISTRY',
-        '_CRT_RAND_S',      # rand_s support available in Windows XP only.
-        '_WTL_NO_CSTRING',  # WTL uses ATL CString instead.
-
-        # '_ATL_NO_CONNECTION_POINTS',
-        # '_ATL_NO_DOCHOSTUIHANDLER',
-        # '_ATL_NO_HOSTING',
-
-        # Set these C_DEFINES when APPVER=5.0
-        # (see win32.mak in Platform SDK)
-        # Target Windows XP and IE 6.0 and above.
-        'WINVER=0x0501',
-        '_WIN32_WINNT=0x0501',
-        '_WIN32_IE=0x0600',
-        '_RICHEDIT_VER=0x0010',
-
-        # don't define min and max in windef.h
-        'NOMINMAX',
-
-        # Logging is enabled in all modes for diagnostics purposes.
-        'LOGGING',
-
-        'FULL_COMPANY_NAME_ANSI=\\"%s\\"' % _FULL_COMPANY_NAME,
-        'SHORT_COMPANY_NAME_ANSI=\\"%s\\"' % _SHORT_COMPANY_NAME,
-        'PRODUCT_NAME_ANSI=\\"%s\\"' % _PRODUCT_NAME,
-        'COMPANY_DOMAIN_BASE_ANSI=\\"%s\\"' % _COMPANY_DOMAIN_BASE,
-        'COMPANY_DOMAIN_ANSI=\\"%s\\"' % _COMPANY_DOMAIN,
-        'OMAHA_APP_NAME_ANSI=\\"%s %s\\"' % (
-            _SHORT_COMPANY_NAME, _PRODUCT_NAME),
-        'MAIN_EXE_BASE_NAME_ANSI=\\"%s\\"' % _MAIN_EXE_BASE_NAME,
-        'MAIN_DLL_BASE_NAME_ANSI=\\"%s\\"' % _MAIN_DLL_BASE_NAME,
-        'OFFICIAL_BUILD=%d' % win_env.Bit('build_server'),
-        'TEST_CERTIFICATE=%d' % win_env.Bit('test_certificate'),
-        'ONECLICK_PLUGIN_NAME=_T(\\"%s\\")' % (
-            omaha_version_utils.GetONECLICK_PLUGIN_NAME()),
-        'ONECLICK_PLUGIN_VERSION_ANSI=\\"%d\\"' % (
-            omaha_version_info.oneclick_plugin_version),
-        'ONECLICK_PLUGIN_FILENAME=_T(\\"%s\\")' % (
-            omaha_version_info.oneclick_plugin_filename),
-        'UPDATE_PLUGIN_NAME=_T(\\"%s\\")' % (
-            omaha_version_utils.GetUPDATE_PLUGIN_NAME()),
-        'UPDATE_PLUGIN_VERSION_ANSI=\\"%d\\"' % (
-            omaha_version_info.update_plugin_version),
-        'UPDATE_PLUGIN_FILENAME=_T(\\"%s\\")' % (
-            omaha_version_info.update_plugin_filename),
-        'BHO_NAME=_T(\\"%s\\")' % omaha_version_utils.GetBHO_NAME(),
-        'BHO_FILENAME=_T(\\"%s\\")' % omaha_version_info.bho_filename,
-        'CRASH_HANDLER_NAME=_T(\\"%s\\")' % omaha_version_utils.GetCRASH_HANDLER_NAME(),
-        ],
-
-    # Link in some windows libraries.
-    LIBS = [
-        'advapi32',
-        'comdlg32',
-        'gdi32',
-        'kernel32',
-        'odbc32',
-        'odbccp32',
-        'ole32',
-        'oleaut32',
-        'shell32',
-        'user32',
-        'uuid',
-        'winspool',
-        ],
-
-    # Common linker flags.
-    LINKFLAGS = [
-        '/nologo',
-        '/SUBSYSTEM:WINDOWS',
-        '/MACHINE:X86',
-        '/RELEASE',
-        '/MAP',
-        '/NODEFAULTLIB',
-        '/DYNAMICBASE',   # Enable ASLR. See http://goo.gl/k2IE.
-        '/NXCOMPAT',      # Enable NX support. See http://goo.gl/k2IE.
-        '/SAFESEH',
-        ],
-
-    # Shared library specific linker flags.
-    SHLINKFLAGS = [
-        '/nologo',
-        '/SUBSYSTEM:WINDOWS',
-        '/MACHINE:x86',
-        ],
-
-    # Resource compiler flags.
-    # Defines in CCFLAGS are automatically included.
-    RCFLAGS = [
-        '/l 1033',  # /l == default language ID
-        '/DBUILD_NUMBER=\\"%s\\"' % build_number,
-        '/DOMAHA_COPYRIGHT_STRING_ENGLISH=\\"%s\\"' % (
-            _OMAHA_COPYRIGHT_STRING_ENGLISH),
-        ],
-)
-
-# Allow verification of these settings in the build log.
-if win_env.Bit('build_server'):
-  print 'OFFICIAL_BUILD=1'
-  print 'TEST_CERTIFICATE=%d' % win_env.Bit('test_certificate')
-
-
-# Add the parent directory of the main omaha directory to the Python path so
-# that we can import using the format "omaha.subdir.module".
-sys.path.append(os.path.split(win_env.Dir('$MAIN_DIR').abspath)[0])
-
-# Make sure Vista SDK in all the important paths earlier in path than VC80.
-for mid_dir in ['', 'vc']:
-  for env_var, sub_dir in [('PATH', 'bin'),
-                           ('INCLUDE', 'include'),
-                           ('LIB', 'lib')]:
-    var_path = os.path.join(_sdk_path, mid_dir, sub_dir)
-    if os.path.exists(var_path):
-      win_env.PrependENVPath(env_var, var_path)
-
-if not win_env.Bit('official_installers'):
-  win_env.Append(CPPPATH = os.environ['OMAHA_WTL_DIR'])
-
-  # Make sure csc.exe can be located.
-  win_env.AppendENVPath('PATH', os.environ['OMAHA_NET_DIR'])
-
-  sys.path.append('tools')  # for import proxy_clsid_utils.py
-  import proxy_clsid_utils
-
-  # Generate uniqe proxy CLSIDs for each build.
-  win_env.Execute('python $MAIN_DIR\\tools\\proxy_clsid_utils.py')
-  win_env.Append(
-      CPPDEFINES = [
-        'PROXY_CLSID_IS_MACHINE=%s' % proxy_clsid_utils.GetMachineProxyClsid(),
-        'PROXY_CLSID_IS_USER=%s' % proxy_clsid_utils.GetUserProxyClsid(),
-      ],
-  )
-
-# WiX path has to be added before the WiX tool can be called.
-win_env.AppendENVPath('PATH', os.environ['OMAHA_WIX_DIR'])
-
-win_env.Tool('wix')
-
-
-_base_dirs = [
-    '.',
-    'base',
-    'clickonce',
-    'client',
-    'common',
-    'core',
-    'google_update',
-    'goopdate',
-    'net',
-    'service',
-    'setup',
-    'statsreport',
-    'third_party',
-    'tools',
-    'ui',
-    ]
-
-_normal_dirs = [
-    'installers',
-    'mi_exe_stub',
-    'plugins',
-    'recovery',
-    ]
-
-_official_installers_dirs = [
-    'installers',
-    ]
-
-_extra_dirs = [
-    'enterprise',
-    'standalone',
-    ]
-
-#
-# Need to decide which subdirs need to be built.
-#
-_dirs_to_build_set = set()
-
-if win_env.Bit('official_installers'):
-  # Only want to build very specific subdirs.
-  win_env.SetBits('no-tests')
-  _dirs_to_build_set.update(_official_installers_dirs)
-elif not win_env.Bit('bin'):
-  # All other configs get the base dirs.
-  _dirs_to_build_set.update(_base_dirs)
-
-  if win_env.Bit('min'):
-    print '*** Building Minimal Set of Projects ***'
-  else:
-    _dirs_to_build_set.update(_normal_dirs)
-
-  if win_env.Bit('all'):
-    _dirs_to_build_set.update(_extra_dirs)
-
-# Build Google application-specific metainstallers.
-if os.path.exists(win_env.Dir('$MAIN_DIR/internal').abspath):
-  _dirs_to_build_set.update(['internal'])
-
-_dirs_to_build = list(_dirs_to_build_set)
-
-# This must be the last directory.
-if not win_env.Bit('no-tests'):
-  _dirs_to_build.append('testing')
-
-# Instruct Hammer which dirs to build.
-win_env['BUILD_SCONSCRIPTS'] = _dirs_to_build
-
-# These are used by the Omaha Builder OmahaUnittest(). They must be added to the
-# environment because there must be one per-mode.
-win_env['all_in_one_unittest_sources'] = []
-win_env['all_in_one_unittest_libs'] = set()
-
-
-# Create the leaf debug Windows environment.
-windows_debug_env = win_env.Clone(
-    # Give this build a name and a description.
-    BUILD_TYPE = 'dbg-win',
-    BUILD_TYPE_DESCRIPTION = 'Windows debug build',
-)
-
-# Use common debug settings.
-windows_debug_env.Tool('target_debug')
-
-windows_debug_env.Append(
-    CCFLAGS = [
-        '/RTC1',
-        '/Od',
-        '/MTd',
-        ],
-    CPPDEFINES = [
-        '_DEBUG',
-        'DEBUG',
-        ],
-)
-
-
-# Create the leaf optimized Windows environment.
-windows_optimized_env = win_env.Clone(
-    # Give this build a name and a description.
-    BUILD_TYPE = 'opt-win',
-    BUILD_TYPE_DESCRIPTION = 'Windows optimized build',
-)
-
-# Use common optimized settings.
-windows_optimized_env.Tool('target_optimized')
-
-windows_optimized_env.Append(
-    CCFLAGS = [
-        '/O1',        # Optimize for small size.
-        '/GS',
-        '/FD',
-        '/GL',        # Global optimization goes with link flag '/LTCG'
-        '/MT',
-        ],
-    CPPDEFINES = [
-        'NDEBUG',
-        'SHIPPING'    # code in 'common' needs this
-        ],
-    ARFLAGS = [
-        '/LTCG',      # Set LTCG for creation of .lib files too.
-        ],
-    LINKFLAGS = [
-        '/incremental:no',
-        '/opt:ref',
-        '/opt:icf=32',
-        '/opt:nowin98',
-        '/LTCG',      # Link-time code generation goes with cl flag '/GL'
-        ],
-)
-
-
-# Create an environment for coverage test builds, based on the dbg build.
-windows_coverage_env = windows_debug_env.Clone(
-    BUILD_TYPE = 'coverage-win',
-    BUILD_TYPE_DESCRIPTION = 'Windows coverage build',
-)
-# The Coverage build require additional tools that not everyone has. Therefore,
-# it should build as part of the all group.
-windows_coverage_env.FilterOut(BUILD_GROUPS=['all'])
-
-windows_coverage_env.Tool('code_coverage')
-
-# Coverage will run omaha_unittest.exe, which requires some extra environment.
-for env_var in os.environ:
-  if not env_var in windows_coverage_env['ENV']:
-    windows_coverage_env['ENV'][env_var] = os.environ[env_var]
-
-# Create a target that covers everything in the staging dir, as many of those
-# files will be required for the unittests to run successfully.
-# TODO(omaha3): This may not be necessary when using ComponentTestProgram. If it
-# is, it needs to be changed to use test/ instead of $STAGING_DIR/.
-windows_coverage_env.Alias(
-    'run_omaha_unittest_for_coverage',
-    '$STAGING_DIR',
-    '$STAGING_DIR/omaha_unittest.exe'
-)
-windows_coverage_env.Append(
-    # TODO(omaha): We cannot run our unit tests on the new build system. Ensure
-    # coverage works with the new test execution system.
-    # COVERAGE_TARGETS=['run_omaha_unittest_for_coverage'],
-    COVERAGE_INSTRUMENTATION_PATHS=['$STAGING_DIR'],
-    # This value should only be used in code if absolutely necessary.
-    CPPDEFINES=['COVERAGE_ENABLED'],
-)
-
-# TODO(omaha): Prevent the analyzer, which will fail, from running until we can
-# run unit tests on the build system. See the TODO above.
-windows_coverage_env['COVERAGE_START_CMD'] = '@echo Not starting coverage'
-windows_coverage_env['COVERAGE_STOP_CMD'] = '@echo Not ending coverage'
-
-# Skip signing in coverage build until the last step.
-windows_coverage_env['SIGNTOOL_ORIG'] = windows_coverage_env['SIGNTOOL']
-windows_coverage_env['SIGNTOOL'] = '@echo Signing deferred: '
-
-def SigningCommand(env, filename):
-  # Only do signing if there is a certificate file or certificate name.
-  if env.subst('$CERTIFICATE_PATH') or env.subst('$CERTIFICATE_NAME'):
-    # The command used to do signing (target added on below).
-    signing_cmd = '$SIGNTOOL_ORIG sign '
-    # Add in certificate file if any.
-    if env.subst('$CERTIFICATE_PATH'):
-      signing_cmd += ' /f "$CERTIFICATE_PATH"'
-      # Add certificate password if any.
-      if env.subst('$CERTIFICATE_PASSWORD'):
-        signing_cmd += ' /p "$CERTIFICATE_PASSWORD"'
-    # Add certificate store if any.
-    if env.subst('$CERTIFICATE_NAME'):
-      # The command used to do signing (target added on below).
-      signing_cmd += ' /s "$CERTIFICATE_STORE" /n "$CERTIFICATE_NAME"'
-    # Add timestamp server if any.
-    if env.subst('$TIMESTAMP_SERVER'):
-      signing_cmd += ' /t "$TIMESTAMP_SERVER"'
-    # Add in target name
-    signing_cmd += ' "%s"' % filename
-    return signing_cmd
-  else:
-    return 'echo no signing needed'
-
-def _IsInstrumentableFileType(file):
-  if (file.endswith('.exe') or
-      file.endswith('.dll')):
-    return True
-  return False
-
-def _IsSignableFileType(file):
-  if (file.endswith('.exe') or
-      file.endswith('.dll') or
-      file.endswith('.msi') or
-      file.endswith('.msp')):
-    return True
-  return False
-
-# Sign files during the install stage, since instrumentation invalidates the
-# signature. Signing within the individual build files was disabled above.
-# Do not sign intermediate "_unsigned" or "_unittest" files.
-# Instrumented files must be signed after installing becuase install is what
-# does the instrumentation. This also seems to be required to avoid
-# unnecessarily rebuilding non-instrumentable files.
-def _PostCoverageSigningInstall(dest, source, env):
-  if _IsInstrumentableFileType(dest) or not _IsSignableFileType(dest):
-    # Install the file to staging. Includes instrumentation if appropriate.
-    env['PRECOVERAGE_SIGN_INSTALL'](dest, source, env)
-  else:
-    # For signable but not instrumentable files, copy the files rather than
-    # using PRECOVERAGE_SIGN_INSTALL as this works around unnecessary rebuilds
-    # caused by http://code.google.com/p/swtoolkit/issues/detail?id=13.
-    env.Execute('copy "%s" "%s"' % (source, dest))
-
-  if (_IsSignableFileType(dest) and
-      (-1 == dest.find('_unsigned')) and
-      (-1 == dest.find('_unittest')) and
-      os.path.split(os.path.split(dest)[0])[1] == 'staging'):
-    env.Execute(SigningCommand(env, dest))
-
-windows_coverage_env['PRECOVERAGE_SIGN_INSTALL'] = (
-    windows_coverage_env['INSTALL'])
-windows_coverage_env['INSTALL'] = _PostCoverageSigningInstall
-
-
-# Make debug the default build after any copies of it have been made.
-windows_debug_env.Append(BUILD_GROUPS = ['default'])
-
-# ----------------------------------------------------------
-
-# Build the variants listed above.
-# This step will call each of the SConscripts (build.scons) listed,
-# once for each variant currently being built.
-BuildEnvironments(
-    [ windows_debug_env,
-      windows_optimized_env,
-      windows_coverage_env,
-    ]
-)
-
-if 'HAMMER_RUNS_TESTS' in os.environ.keys():
-  # Hammer sets the default target to 'scons-out'. This causes run_* aliases
-  # to also be built, which means the tests run by default. To avoid this, clear
-  # Default and set the default to just build the programs.
-  Default(None)
-  # TODO(omaha): Not all of our core binaries are included in these three
-  # aliases. This is because SignedBinary() and Command() do not add the outputs
-  # to a group. Fix this.
-  Default(['all_programs', 'all_libraries', 'all_test_programs'])
-
-if win_env.Bit('msvs'):
-  source_project = win_env.ComponentVSDirProject('all_source', ['$MAIN_DIR'])
-
-  # 'all_*' values do not appear to be populated until after BuildEnvironments
-  # is called. Thus, the solution will be specific to either debug or optimized.
-  # ComponentVSSourceProject() might be more desirable, but it does not appear
-  # to work.
-  windows_debug_env.ComponentVSSolution('omaha_dbg',
-                                        ['all_programs', 'all_libraries'],
-                                        projects=[source_project])
diff --git a/mi_exe_stub/README.txt b/mi_exe_stub/README.txt
deleted file mode 100644
index 534f0c6..0000000
--- a/mi_exe_stub/README.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This directory contains the source needed to build the Omaha meta-installer EXE, which is the installer that installs Omaha. We call it a meta-installer to distinguish it from the Omaha update client, which itself is an installer.
-
-This project differs from the mi_msi project solely in that it's an EXE rather than an MSI. Some customers need one, and some need the other.
\ No newline at end of file
diff --git a/mi_exe_stub/build.scons b/mi_exe_stub/build.scons
deleted file mode 100644
index 3f99023..0000000
--- a/mi_exe_stub/build.scons
+++ /dev/null
@@ -1,154 +0,0 @@
-# Copyright 2008-2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-# Build subdirectories before switching to use WDK
-env.BuildSConscript('x86_encoder')
-
-# Build at warning level 4.
-env.FilterOut(CCFLAGS=['/W3'])
-env.Append(
-    CCFLAGS = [
-        '/W4',
-        '/Wall',
-    ],
-)
-
-def _UseWdkCrt(env):
-  env.Prepend(
-      WDK_PATH = '$GOOGLECLIENT/third_party/windows_driver_kit_vc80/files',
-      CPPPATH = [
-          '$WDK_PATH/inc/api/crt/stl70',
-          '$WDK_PATH/inc/crt',
-          '$WDK_PATH/inc/crt/atl71',
-      ],
-      LIBPATH = [
-          '$WDK_PATH/lib/atl/i386',
-          '$WDK_PATH/lib/crt/i386',
-      ],
-  )
-  # Magic for STL to work. Note that even though we're using ATL, a few things
-  # from STL are still required to correctly build, e.g. the iosfwd header.
-  env.Append(
-      CPPDEFINES = [
-          '_CRT_SECURE_NO_WARNINGS',
-          '_STATIC_CPPLIB',   # Taken from WDK makefile.
-          '_STL70_',          # Taken from WDK makefile.
-          # Prefer ATL CRT replacements to system CRT. This makes a big
-          # difference on calls to CStringT::Format style functions--in testing,
-          # I measured a 5 KiB difference.
-          '_ATL_MIN_CRT',
-          '_ATL_CSTRING_NO_CRT',
-      ],
-      CCFLAGS = [
-          '/D_SECURE_SCL=0',
-          '/EHsc',
-          '/FI$MAIN_DIR/mi_exe_stub/ptrdiff_t.h',
-          '/wd4068',  # unknown pragma (ATL uses PreFAST pragmas)
-      ],
-  )
-  env.FilterOut(
-      CPPDEFINES = [
-          'NOMINMAX',
-      ],
-      CCFLAGS = [
-          '/D_HAS_EXCEPTIONS=0',
-          '/RTC1',
-      ],
-  )
-
-for omaha_version_info in env['omaha_versions_info']:
-  prefix = omaha_version_info.filename_prefix
-  temp_env = env.Clone()
-
-  if prefix == 'TEST_':
-    temp_env['OBJPREFIX'] = temp_env.subst('test/$OBJPREFIX')
-  elif prefix:
-    raise Exception('ERROR: Unrecognized prefix "%s"' % prefix)
-
-  temp_env.Append(
-      LIBS = [
-          'lzma',
-          'mi_exe_stub_lib',
-          ('atls', 'atlsd')[temp_env.Bit('debug')],
-          ('msvcrt', 'libcmtd')[temp_env.Bit('debug')],
-          ('msvcprt', 'libcpmtd')[temp_env.Bit('debug')],
-          # 'msvcprt_btowc.lib',
-          # 'ntstc_msvcrt',  # Only required if STL classes are used.
-          'shlwapi',
-          'version',
-          ],
-      RCFLAGS = [
-          '/DVERSION_MAJOR=%d' % omaha_version_info.version_major,
-          '/DVERSION_MINOR=%d' % omaha_version_info.version_minor,
-          '/DVERSION_BUILD=%d' % omaha_version_info.version_build,
-          '/DVERSION_PATCH=%d' % omaha_version_info.version_patch,
-          '/DVERSION_NUMBER_STRING=\\"%s\\"' % (
-              omaha_version_info.GetVersionString()),
-          '/DLANGUAGE_STRING=\\"%s\\"' % 'en'
-          ],
-
-      # This avoids missing __load_config_used
-      LINKFLAGS = [
-          '/SAFESEH:NO'
-          ],
-  )
-
-
-  exe_inputs = temp_env.RES(
-      target=prefix + 'mi.res',
-      source=[
-          'mi.rc',
-      ],
-  )
-
-  # Force a rebuild when the version changes.
-  temp_env.Depends(exe_inputs, '$MAIN_DIR/VERSION')
-
-  for language in omaha_version_info.GetSupportedLanguages():
-    base_name = 'mi_generated_resources_' + language
-    exe_inputs += temp_env.RES(
-        target=prefix + base_name + '.res',
-        source=base_name + '.rc',
-    )
-
-  if not temp_env.Bit('debug'):
-    # Stubs for W2k compatibility.
-    exe_inputs += '$WDK_PATH/lib/w2k/i386/msvcrt_win2000.obj',
-
-  temp_env.ComponentProgram(
-      prog_name = prefix + 'mi_exe_stub',
-      source = exe_inputs,
-  )
-
-
-local_env = env.Clone()
-
-# Avoid target conflicts over extractor.obj
-local_env['OBJSUFFIX'] = '_mi' + local_env['OBJSUFFIX']
-
-local_inputs = [
-    'mi.cc',
-    'process.cc',
-    'tar.cc',
-    '../base/extractor.cc',
-]
-
-# Precompiled headers cannot be used because debug builds must link against
-# base.lib due to base/ inclusions in precompile.h.
-local_env.ComponentStaticLibrary('mi_exe_stub_lib',
-                                 local_inputs,
-                                 use_pch_default=False)
diff --git a/mi_exe_stub/mi.cc b/mi_exe_stub/mi.cc
deleted file mode 100644
index 474cb99..0000000
--- a/mi_exe_stub/mi.cc
+++ /dev/null
@@ -1,501 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Implementation of the metainstaller logic.
-// Untars a tarball and executes the extracted executable.
-// If no command line is specified, "/install" is passed to the executable
-// along with a .gup file if one is extracted.
-// If found, the contents of the signature tag are also passed to the
-// executable unmodified.
-
-#include <tchar.h>
-#include <atlsimpcoll.h>
-#include <atlstr.h>
-#include <shellapi.h>
-#include <shlwapi.h>
-#include <windows.h>
-
-#pragma warning(push)
-// C4310: cast truncates constant value
-#pragma warning(disable : 4310)
-#include "base/basictypes.h"
-#pragma warning(pop)
-#include "base/scoped_ptr.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/error.h"
-#include "omaha/base/extractor.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/system_info.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/mi_exe_stub/process.h"
-#include "omaha/mi_exe_stub/mi.grh"
-#include "omaha/mi_exe_stub/tar.h"
-extern "C" {
-#include "third_party/lzma/v4_65/files/C/Bcj2.h"
-#include "third_party/lzma/v4_65/files/C/LzmaDec.h"
-}
-
-namespace omaha  {
-
-// Resource ID of the goopdate payload inside the meta-installer.
-#define IDR_PAYLOAD 102
-
-namespace {
-
-HRESULT HandleError(HRESULT hr);
-
-// The function assumes that the extractor has already been opened.
-// The buffer must be deleted by the caller.
-char* ReadTag(TagExtractor* extractor) {
-  const int kMaxTagLength = 0x10000;  // 64KB
-
-  int tag_buffer_size = 0;
-  if (!extractor->ExtractTag(NULL, &tag_buffer_size)) {
-    return NULL;
-  }
-  if (!tag_buffer_size || (tag_buffer_size >= kMaxTagLength)) {
-    return NULL;
-  }
-
-  scoped_array<char> tag_buffer(new char[tag_buffer_size]);
-  if (!tag_buffer.get()) {
-    return NULL;
-  }
-
-  if (!extractor->ExtractTag(tag_buffer.get(), &tag_buffer_size)) {
-    _ASSERTE(false);
-    return NULL;
-  }
-
-  // Do a sanity check of the tag string. The double quote '"'
-  // is a special character that should not be included in the tag string.
-  for (const char* tag_char = tag_buffer.get(); *tag_char; ++tag_char) {
-    if (*tag_char == '"') {
-      _ASSERTE(false);
-      return NULL;
-    }
-  }
-
-  return tag_buffer.release();
-}
-
-// Extract the tag containing the extra information written by the server.
-// The memory returned by the function will have to be freed using delete[]
-// operator.
-char* ExtractTag(const TCHAR* module_file_name) {
-  if (!module_file_name) {
-    return NULL;
-  }
-
-  TagExtractor extractor;
-  if (!extractor.OpenFile(module_file_name)) {
-    return NULL;
-  }
-  char* ret = ReadTag(&extractor);
-  extractor.CloseFile();
-
-  return ret;
-}
-
-class MetaInstaller {
- public:
-  MetaInstaller(HINSTANCE instance, LPCSTR cmd_line)
-      : instance_(instance),
-        cmd_line_(cmd_line),
-        exit_code_(0) {
-  }
-
-  ~MetaInstaller() {
-    // When a crash happens while running GoogleUpdate and breakpad gets it
-    // GooogleUpdate.exe is started with the /report to report the crash.
-    // In a crash, the temp directory and the contained files can't be deleted.
-    if (exit_code_ != GOOPDATE_E_CRASH) {
-      CleanUpTempDirectory();
-    }
-  }
-
-  int ExtractAndRun() {
-    if (CreateUniqueTempDirectory() != 0) {
-      return -1;
-    }
-    scoped_hfile tarball_file(ExtractTarballToTempLocation());
-    if (!valid(tarball_file)) {
-      return -1;
-    }
-
-    // Extract files from the archive and run the first EXE we find in it.
-    Tar tar(temp_dir_, get(tarball_file), true);
-    tar.SetCallback(TarFileCallback, this);
-    if (!tar.ExtractToDir()) {
-      return -1;
-    }
-
-    exit_code_ = ULONG_MAX;
-    if (!exe_path_.IsEmpty()) {
-      // Build the command line. There are three scenarios we consider:
-      // 1. Run by the user, in which case the MI does not receive any
-      //    argument on its command line. In this case the command line
-      //    to run is: "exe_path" /install [["]manifest["]]
-      // 2. Run with command line arguments. The tag, if present, will be
-      //    appended to the command line.
-      //    The command line is: "exe_path" args <tag>
-      //    For example, pass "/silent /install" to the metainstaller to
-      //    initiate a silent install using the extra args in the tag.
-      //    If a command line does not take a tag or a custom tag is needed,
-      //    use an untagged file.
-      CString command_line(exe_path_);
-      ::PathQuoteSpaces(CStrBuf(command_line, MAX_PATH));
-
-      scoped_array<char> tag(GetTag());
-      if (cmd_line_.IsEmpty()) {
-        // Run-by-user case.
-        if (!tag.get()) {
-          _ASSERTE(!_T("Must provide arguments with untagged metainstaller."));
-          HRESULT hr = GOOPDATE_E_UNTAGGED_METAINSTALLER;
-          HandleError(hr);
-          return hr;
-        }
-        command_line.AppendFormat(_T(" /%s %s /%s"),
-                                  kCmdLineInstallSource,
-                                  kCmdLineInstallSource_TaggedMetainstaller,
-                                  kCmdLineInstall);
-      } else {
-        command_line.AppendFormat(_T(" %s"), cmd_line_);
-
-        CheckAndHandleRecoveryCase(&command_line);
-      }
-
-      if (tag.get()) {
-        command_line.AppendFormat(_T(" \"%s\""), CString(tag.get()));
-      }
-
-      RunAndWait(command_line, &exit_code_);
-    }
-    // Propagate up the exit code of the program we have run.
-    return exit_code_;
-  }
-
- private:
-  void CleanUpTempDirectory() {
-    // Delete our temp directory and its contents.
-    for (int i = 0; i != files_to_delete_.GetSize(); ++i) {
-      DeleteFile(files_to_delete_[i]);
-    }
-    files_to_delete_.RemoveAll();
-
-    ::RemoveDirectory(temp_dir_);
-    temp_dir_.Empty();
-  }
-
-  // Determines whether this is a silent install.
-  bool IsSilentInstall() {
-    CString silent_argument;
-    silent_argument.Format(_T("/%s"), kCmdLineSilent);
-
-    return silent_argument == cmd_line_;
-  }
-
-  // Determines whether the MI is being invoked for recovery purposes, and,
-  // if so, appends the MI's full path to the command line.
-  // cmd_line_ must begin with "/recover" in order for the recovery case to be
-  // detected.
-  void CheckAndHandleRecoveryCase(CString* command_line) {
-    _ASSERTE(command_line);
-
-    CString recover_argument;
-    recover_argument.Format(_T("/%s"), kCmdLineRecover);
-
-    if (cmd_line_.Left(recover_argument.GetLength()) == recover_argument) {
-      TCHAR current_path[MAX_PATH] = {};
-      if (::GetModuleFileName(NULL, current_path, arraysize(current_path))) {
-        command_line->AppendFormat(_T(" \"%s\""), current_path);
-      }
-    }
-  }
-
-  // Create a temp directory to hold the embedded setup files.
-  // This is a bit of a hack: we ask the system to create a temporary
-  // filename for us, and instead we use that name for a subdirectory name.
-  int CreateUniqueTempDirectory() {
-    ::GetTempPath(MAX_PATH, CStrBuf(temp_root_dir_, MAX_PATH));
-    if (::CreateDirectory(temp_root_dir_, NULL) != 0 ||
-        ::GetLastError() == ERROR_ALREADY_EXISTS) {
-      if (!::GetTempFileName(temp_root_dir_,
-                             _T("GUM"),
-                             0,  // form a unique filename
-                             CStrBuf(temp_dir_, MAX_PATH))) {
-        return -1;
-      }
-      // GetTempFileName() actually creates the temp file, so delete it.
-      ::DeleteFile(temp_dir_);
-      ::CreateDirectory(temp_dir_, NULL);
-    } else {
-      return -1;
-    }
-    return 0;
-  }
-
-  HANDLE ExtractTarballToTempLocation() {
-    HANDLE tarball_file = INVALID_HANDLE_VALUE;
-    TCHAR tarball_filename[MAX_PATH] = {0};
-    if (::GetTempFileName(temp_root_dir_,
-                          _T("GUT"),
-                          0,  // form a unique filename
-                          tarball_filename)) {
-      files_to_delete_.Add(tarball_filename);
-      HRSRC res_info = ::FindResource(NULL,
-                                      MAKEINTRESOURCE(IDR_PAYLOAD),
-                                      _T("B"));
-      if (NULL != res_info) {
-        HGLOBAL resource = ::LoadResource(NULL, res_info);
-        if (NULL != resource) {
-          LPVOID resource_pointer = ::LockResource(resource);
-          if (NULL != resource_pointer) {
-            tarball_file = ::CreateFile(tarball_filename,
-                                        GENERIC_READ | GENERIC_WRITE,
-                                        0,
-                                        NULL,
-                                        OPEN_ALWAYS,
-                                        0,
-                                        NULL);
-            if (INVALID_HANDLE_VALUE != tarball_file) {
-              LARGE_INTEGER file_position = {};
-              if (0 != DecompressBufferToFile(
-                      static_cast<const uint8*>(resource_pointer),
-                      ::SizeofResource(NULL, res_info),
-                      tarball_file) ||
-                  !::SetFilePointerEx(tarball_file, file_position, NULL,
-                                      FILE_BEGIN)) {
-                ::CloseHandle(tarball_file);
-                tarball_file = INVALID_HANDLE_VALUE;
-              }
-            }
-          }
-        }
-      }
-    }
-    return tarball_file;
-  }
-
-  char* GetTag() const {
-    // Get this module file name.
-    TCHAR module_file_name[MAX_PATH] = {};
-    if (!::GetModuleFileName(instance_, module_file_name,
-                             arraysize(module_file_name))) {
-      _ASSERTE(false);
-      return NULL;
-    }
-
-    return ExtractTag(module_file_name);
-  }
-
-  static CString GetFilespec(const CString& path) {
-    int pos = path.ReverseFind('\\');
-    if (pos >= 0) {
-      return path.Mid(pos + 1);
-    }
-    return path;
-  }
-
-  void HandleTarFile(const TCHAR* filename) {
-    CString new_filename(filename);
-    files_to_delete_.Add(new_filename);
-    CString filespec(GetFilespec(new_filename));
-    filespec.MakeLower();
-
-    if (filespec.GetLength() > 4) {
-      CString extension(filespec.Mid(filespec.GetLength() - 4));
-
-      if (extension == _T(".exe")) {
-        // We're interested in remembering only the first exe in the tarball.
-        if (exe_path_.IsEmpty()) {
-          exe_path_ = new_filename;
-        }
-      }
-    }
-  }
-
-  static void TarFileCallback(void* context, const TCHAR* filename) {
-    MetaInstaller* mi = reinterpret_cast<MetaInstaller*>(context);
-    mi->HandleTarFile(filename);
-  }
-
-  // TODO(omaha): reimplement the relevant files in the LZMA SDK to optimize
-  // for size. We'll have to release the modifications (LZMA SDK is CDDL/CDL),
-  // which shouldn't be a problem.
-  static void* MyAlloc(void* p, size_t size) {
-    UNREFERENCED_PARAMETER(p);
-    return new uint8[size];
-  }
-
-  static void MyFree(void* p, void* address) {
-    UNREFERENCED_PARAMETER(p);
-    delete[] address;
-  }
-
-  // Decompress the content of the memory buffer into the file
-  static int DecompressBufferToFile(const uint8* packed_buffer,
-                                    size_t packed_size,
-                                    HANDLE file) {
-    // need header and len minimally
-    if (packed_size < LZMA_PROPS_SIZE + 8) {
-      return -1;
-    }
-
-    // Note this code won't properly handle decoding large files, since uint32
-    // is used in several places to count size.
-    ISzAlloc allocators = { &MyAlloc, &MyFree };
-    CLzmaDec lzma_state;
-    LzmaDec_Construct(&lzma_state);
-    LzmaDec_Allocate(&lzma_state, packed_buffer, LZMA_PROPS_SIZE, &allocators);
-    LzmaDec_Init(&lzma_state);
-    packed_buffer += LZMA_PROPS_SIZE;
-    packed_size -= LZMA_PROPS_SIZE;
-
-    // TODO(omaha): make this independent of endianness.
-    uint64 unpacked_size_64 = *reinterpret_cast<const uint64*>(packed_buffer);
-    size_t unpacked_size = static_cast<size_t>(unpacked_size_64);
-    packed_buffer += sizeof(unpacked_size_64);
-    packed_size -= sizeof(unpacked_size_64);
-
-    scoped_array<uint8> unpacked_buffer(new uint8[unpacked_size]);
-
-    ELzmaStatus status = static_cast<ELzmaStatus>(0);
-    SRes result = LzmaDec_DecodeToBuf(
-        &lzma_state,
-        unpacked_buffer.get(),
-        &unpacked_size,
-        packed_buffer,
-        &packed_size,
-        LZMA_FINISH_END,
-        &status);
-    LzmaDec_Free(&lzma_state, &allocators);
-    if (SZ_OK != result) {
-      return -1;
-    }
-
-#if 0
-    // Reverse BCJ coding.
-    uint32 x86_conversion_state;
-    x86_Convert_Init(x86_conversion_state);
-    x86_Convert(unpacked_buffer.get(), unpacked_size, 0, &x86_conversion_state,
-                0 /* decoding */);
-#else
-    // Reverse BCJ2 coding.
-    const uint8* p = unpacked_buffer.get();
-    uint32 original_size = *reinterpret_cast<const uint32*>(p);
-    p += sizeof(uint32);  // NOLINT
-    uint32 stream0_size = *reinterpret_cast<const uint32*>(p);
-    p += sizeof(uint32);  // NOLINT
-    uint32 stream1_size = *reinterpret_cast<const uint32*>(p);
-    p += sizeof(uint32);  // NOLINT
-    uint32 stream2_size = *reinterpret_cast<const uint32*>(p);
-    p += sizeof(uint32);  // NOLINT
-    uint32 stream3_size = *reinterpret_cast<const uint32*>(p);
-    p += sizeof(uint32);  // NOLINT
-
-    scoped_array<uint8> output_buffer(new uint8[original_size]);
-    if (SZ_OK != Bcj2_Decode(p,
-                             stream0_size,
-                             p + stream0_size,
-                             stream1_size,
-                             p + stream0_size + stream1_size,
-                             stream2_size,
-                             p + stream0_size + stream1_size + stream2_size,
-                             stream3_size,
-                             output_buffer.get(), original_size)) {
-      return 1;
-    }
-#endif
-
-    DWORD written;
-    if (!::WriteFile(file, output_buffer.get(), original_size, &written,
-                     NULL) ||
-        written != original_size) {
-        return -1;
-    }
-
-    return 0;
-  }
-
-  HINSTANCE instance_;
-  CString cmd_line_;
-  CString exe_path_;
-  DWORD exit_code_;
-  CSimpleArray<CString> files_to_delete_;
-  CString temp_dir_;
-  CString temp_root_dir_;
-};
-
-HRESULT CheckOSRequirements() {
-  return SystemInfo::OSWin2KSP4OrLater() ? S_OK :
-                                           GOOPDATE_E_RUNNING_INFERIOR_WINDOWS;
-}
-
-CString GetCompanyDisplayName() {
-  CString company_name;
-  company_name.LoadString(IDS_FRIENDLY_COMPANY_NAME);
-  _ASSERTE(!company_name.IsEmpty());
-  return company_name;
-}
-
-CString GetUiTitle() {
-  CString title;
-  title.FormatMessage(IDS_INSTALLER_DISPLAY_NAME, GetCompanyDisplayName());
-  return title;
-}
-
-HRESULT HandleError(HRESULT result) {
-  _ASSERTE(FAILED(result));
-  CString msg_box_text;
-
-  switch (result) {
-    case GOOPDATE_E_RUNNING_INFERIOR_WINDOWS:
-      msg_box_text.FormatMessage(IDS_RUNNING_INFERIOR_WINDOWS,
-                                 GetCompanyDisplayName());
-      break;
-
-    case GOOPDATE_E_UNTAGGED_METAINSTALLER:
-    default:
-      msg_box_text.LoadString(IDS_GENERIC_ERROR);
-      _ASSERTE(!msg_box_text.IsEmpty());
-      break;
-  }
-
-  ::MessageBox(NULL, msg_box_text, GetUiTitle(), MB_OK);
-  return result;
-}
-
-}  // namespace
-
-}  // namespace omaha
-
-int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int) {
-  scoped_co_init init_com_apt;
-  HRESULT hr(init_com_apt.hresult());
-  if (FAILED(hr)) {
-    return omaha::HandleError(hr);
-  }
-
-  hr = omaha::CheckOSRequirements();
-  if (FAILED(hr)) {
-    return omaha::HandleError(hr);
-  }
-
-  omaha::MetaInstaller mi(hInstance, lpCmdLine);
-  int result = mi.ExtractAndRun();
-  return result;
-}
-
diff --git a/mi_exe_stub/mi.grh b/mi_exe_stub/mi.grh
deleted file mode 100644
index 3c40a84..0000000
--- a/mi_exe_stub/mi.grh
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-// This file is automatically generated by GRIT.  Do not edit.
-// Built on Thu Nov 18 11:20:39 2010
-
-#ifndef RESOURCE_91994245977__
-#define RESOURCE_91994245977__
-
-
-#define IDS_FRIENDLY_COMPANY_NAME 21128
-#define IDS_INSTALLER_DISPLAY_NAME 21129
-#define IDS_GENERIC_ERROR 21130
-#define IDS_RUNNING_INFERIOR_WINDOWS 21131
-
-#endif // RESOURCE_91994245977__
diff --git a/mi_exe_stub/mi.ico b/mi_exe_stub/mi.ico
deleted file mode 100644
index 8420f53..0000000
--- a/mi_exe_stub/mi.ico
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi.rc b/mi_exe_stub/mi.rc
deleted file mode 100644
index eacfb8f..0000000
--- a/mi_exe_stub/mi.rc
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// This file contains the unlocalized metainstaller resources.
-
-#include <winres.h>
-#include <winresrc.h>
-#include <afxres.h>
-#include "resource.h"
-
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
-IDI_APP            ICON               "mi.ico"
-
-VS_VERSION_INFO VERSIONINFO
-// Resource Editor does not handle constants from main.scons.
-#ifndef APSTUDIO_INVOKED
- FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_BUILD,VERSION_PATCH
- PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_BUILD,VERSION_PATCH
-#endif  // APSTUDIO_INVOKED
- FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
-#if defined _DEBUG && OFFICIAL_BUILD
- FILEFLAGS VS_FF_DEBUG
-#elif defined _DEBUG
- FILEFLAGS VS_FF_DEBUG | VS_FF_PRIVATEBUILD
-#elif !OFFICIAL_BUILD
- FILEFLAGS VS_FF_PRIVATEBUILD
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS VOS_NT_WINDOWS32
- FILETYPE VFT_APP
- FILESUBTYPE VFT2_UNKNOWN
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "040904b0"
-        BEGIN
-// Requires constants from mains.scons that cannot be loaded in Resource Editor.
-#ifndef APSTUDIO_INVOKED
-            VALUE "CompanyName", FULL_COMPANY_NAME_ANSI
-            VALUE "FileDescription", OMAHA_APP_NAME_ANSI " Setup"
-            VALUE "FileVersion", VERSION_NUMBER_STRING
-            VALUE "InternalName", OMAHA_APP_NAME_ANSI " Setup"
-            VALUE "LegalCopyright", OMAHA_COPYRIGHT_STRING_ENGLISH
-            VALUE "OriginalFilename", MAIN_EXE_BASE_NAME_ANSI "Setup.exe"
-            VALUE "ProductName", OMAHA_APP_NAME_ANSI
-            VALUE "ProductVersion", VERSION_NUMBER_STRING
-            VALUE "LanguageId", LANGUAGE_STRING
-  #ifdef _DEBUG
-            VALUE "Debug", ""
-  #endif
-  #if !OFFICIAL_BUILD
-            VALUE "PrivateBuild", BUILD_NUMBER
-  #endif
-#else
-            VALUE "_SpecialView",
-                  "Most values are not shown in Resource Editor because they "
-                  "require build file constants."
-#endif  // APSTUDIO_INVOKED
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x0409, 1200
-    END
-END
-
-// Special external requirement.
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#define IDR_GOOGLEUPDATE 1
-IDR_GOOGLEUPDATE GOOGLEUPDATE { 1L }
diff --git a/mi_exe_stub/mi_generated_resources_am.rc b/mi_exe_stub/mi_generated_resources_am.rc
deleted file mode 100644
index 1a50d6d..0000000
--- a/mi_exe_stub/mi_generated_resources_am.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_ar.rc b/mi_exe_stub/mi_generated_resources_ar.rc
deleted file mode 100644
index b6e5977..0000000
--- a/mi_exe_stub/mi_generated_resources_ar.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_bg.rc b/mi_exe_stub/mi_generated_resources_bg.rc
deleted file mode 100644
index 7efaa0b..0000000
--- a/mi_exe_stub/mi_generated_resources_bg.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_bn.rc b/mi_exe_stub/mi_generated_resources_bn.rc
deleted file mode 100644
index a17746b..0000000
--- a/mi_exe_stub/mi_generated_resources_bn.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_ca.rc b/mi_exe_stub/mi_generated_resources_ca.rc
deleted file mode 100644
index 55cac09..0000000
--- a/mi_exe_stub/mi_generated_resources_ca.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_cs.rc b/mi_exe_stub/mi_generated_resources_cs.rc
deleted file mode 100644
index 1b55104..0000000
--- a/mi_exe_stub/mi_generated_resources_cs.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_da.rc b/mi_exe_stub/mi_generated_resources_da.rc
deleted file mode 100644
index 2cce49e..0000000
--- a/mi_exe_stub/mi_generated_resources_da.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_de.rc b/mi_exe_stub/mi_generated_resources_de.rc
deleted file mode 100644
index c4afbe7..0000000
--- a/mi_exe_stub/mi_generated_resources_de.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_el.rc b/mi_exe_stub/mi_generated_resources_el.rc
deleted file mode 100644
index 64db785..0000000
--- a/mi_exe_stub/mi_generated_resources_el.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_en-GB.rc b/mi_exe_stub/mi_generated_resources_en-GB.rc
deleted file mode 100644
index aff9e7f..0000000
--- a/mi_exe_stub/mi_generated_resources_en-GB.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_en.rc b/mi_exe_stub/mi_generated_resources_en.rc
deleted file mode 100644
index f83d287..0000000
--- a/mi_exe_stub/mi_generated_resources_en.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_es-419.rc b/mi_exe_stub/mi_generated_resources_es-419.rc
deleted file mode 100644
index 6cd9839..0000000
--- a/mi_exe_stub/mi_generated_resources_es-419.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_es.rc b/mi_exe_stub/mi_generated_resources_es.rc
deleted file mode 100644
index 594996c..0000000
--- a/mi_exe_stub/mi_generated_resources_es.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_et.rc b/mi_exe_stub/mi_generated_resources_et.rc
deleted file mode 100644
index a44f9e1..0000000
--- a/mi_exe_stub/mi_generated_resources_et.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_fa.rc b/mi_exe_stub/mi_generated_resources_fa.rc
deleted file mode 100644
index 7728210..0000000
--- a/mi_exe_stub/mi_generated_resources_fa.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_fi.rc b/mi_exe_stub/mi_generated_resources_fi.rc
deleted file mode 100644
index 094380f..0000000
--- a/mi_exe_stub/mi_generated_resources_fi.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_fil.rc b/mi_exe_stub/mi_generated_resources_fil.rc
deleted file mode 100644
index 9e66413..0000000
--- a/mi_exe_stub/mi_generated_resources_fil.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_fr.rc b/mi_exe_stub/mi_generated_resources_fr.rc
deleted file mode 100644
index c9b972d..0000000
--- a/mi_exe_stub/mi_generated_resources_fr.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_gu.rc b/mi_exe_stub/mi_generated_resources_gu.rc
deleted file mode 100644
index 23020a7..0000000
--- a/mi_exe_stub/mi_generated_resources_gu.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_hi.rc b/mi_exe_stub/mi_generated_resources_hi.rc
deleted file mode 100644
index c77e0a9..0000000
--- a/mi_exe_stub/mi_generated_resources_hi.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_hr.rc b/mi_exe_stub/mi_generated_resources_hr.rc
deleted file mode 100644
index 17959ea..0000000
--- a/mi_exe_stub/mi_generated_resources_hr.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_hu.rc b/mi_exe_stub/mi_generated_resources_hu.rc
deleted file mode 100644
index 276f203..0000000
--- a/mi_exe_stub/mi_generated_resources_hu.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_id.rc b/mi_exe_stub/mi_generated_resources_id.rc
deleted file mode 100644
index e94cd17..0000000
--- a/mi_exe_stub/mi_generated_resources_id.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_is.rc b/mi_exe_stub/mi_generated_resources_is.rc
deleted file mode 100644
index 372bc6f..0000000
--- a/mi_exe_stub/mi_generated_resources_is.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_it.rc b/mi_exe_stub/mi_generated_resources_it.rc
deleted file mode 100644
index 3b95288..0000000
--- a/mi_exe_stub/mi_generated_resources_it.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_iw.rc b/mi_exe_stub/mi_generated_resources_iw.rc
deleted file mode 100644
index 6bf8623..0000000
--- a/mi_exe_stub/mi_generated_resources_iw.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_ja.rc b/mi_exe_stub/mi_generated_resources_ja.rc
deleted file mode 100644
index 7141b90..0000000
--- a/mi_exe_stub/mi_generated_resources_ja.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_kn.rc b/mi_exe_stub/mi_generated_resources_kn.rc
deleted file mode 100644
index 221b807..0000000
--- a/mi_exe_stub/mi_generated_resources_kn.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_ko.rc b/mi_exe_stub/mi_generated_resources_ko.rc
deleted file mode 100644
index bfdcc5c..0000000
--- a/mi_exe_stub/mi_generated_resources_ko.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_lt.rc b/mi_exe_stub/mi_generated_resources_lt.rc
deleted file mode 100644
index 640edf3..0000000
--- a/mi_exe_stub/mi_generated_resources_lt.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_lv.rc b/mi_exe_stub/mi_generated_resources_lv.rc
deleted file mode 100644
index 14f06b0..0000000
--- a/mi_exe_stub/mi_generated_resources_lv.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_ml.rc b/mi_exe_stub/mi_generated_resources_ml.rc
deleted file mode 100644
index 7c63044..0000000
--- a/mi_exe_stub/mi_generated_resources_ml.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_mr.rc b/mi_exe_stub/mi_generated_resources_mr.rc
deleted file mode 100644
index 2c65cba..0000000
--- a/mi_exe_stub/mi_generated_resources_mr.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_ms.rc b/mi_exe_stub/mi_generated_resources_ms.rc
deleted file mode 100644
index 1a6ad34..0000000
--- a/mi_exe_stub/mi_generated_resources_ms.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_nl.rc b/mi_exe_stub/mi_generated_resources_nl.rc
deleted file mode 100644
index 5da788c..0000000
--- a/mi_exe_stub/mi_generated_resources_nl.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_no.rc b/mi_exe_stub/mi_generated_resources_no.rc
deleted file mode 100644
index 1e209f1..0000000
--- a/mi_exe_stub/mi_generated_resources_no.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_pl.rc b/mi_exe_stub/mi_generated_resources_pl.rc
deleted file mode 100644
index 6029355..0000000
--- a/mi_exe_stub/mi_generated_resources_pl.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_pt-BR.rc b/mi_exe_stub/mi_generated_resources_pt-BR.rc
deleted file mode 100644
index f58afb3..0000000
--- a/mi_exe_stub/mi_generated_resources_pt-BR.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_pt-PT.rc b/mi_exe_stub/mi_generated_resources_pt-PT.rc
deleted file mode 100644
index 370e15f..0000000
--- a/mi_exe_stub/mi_generated_resources_pt-PT.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_ro.rc b/mi_exe_stub/mi_generated_resources_ro.rc
deleted file mode 100644
index 84cf228..0000000
--- a/mi_exe_stub/mi_generated_resources_ro.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_ru.rc b/mi_exe_stub/mi_generated_resources_ru.rc
deleted file mode 100644
index 93df4b0..0000000
--- a/mi_exe_stub/mi_generated_resources_ru.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_sk.rc b/mi_exe_stub/mi_generated_resources_sk.rc
deleted file mode 100644
index 6e21580..0000000
--- a/mi_exe_stub/mi_generated_resources_sk.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_sl.rc b/mi_exe_stub/mi_generated_resources_sl.rc
deleted file mode 100644
index 1192c9d..0000000
--- a/mi_exe_stub/mi_generated_resources_sl.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_sr.rc b/mi_exe_stub/mi_generated_resources_sr.rc
deleted file mode 100644
index 902fa3a..0000000
--- a/mi_exe_stub/mi_generated_resources_sr.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_sv.rc b/mi_exe_stub/mi_generated_resources_sv.rc
deleted file mode 100644
index fb1dc03..0000000
--- a/mi_exe_stub/mi_generated_resources_sv.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_sw.rc b/mi_exe_stub/mi_generated_resources_sw.rc
deleted file mode 100644
index 33a28e8..0000000
--- a/mi_exe_stub/mi_generated_resources_sw.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_ta.rc b/mi_exe_stub/mi_generated_resources_ta.rc
deleted file mode 100644
index 0b5004b..0000000
--- a/mi_exe_stub/mi_generated_resources_ta.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_te.rc b/mi_exe_stub/mi_generated_resources_te.rc
deleted file mode 100644
index ad6f992..0000000
--- a/mi_exe_stub/mi_generated_resources_te.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_th.rc b/mi_exe_stub/mi_generated_resources_th.rc
deleted file mode 100644
index b853fe5..0000000
--- a/mi_exe_stub/mi_generated_resources_th.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_tr.rc b/mi_exe_stub/mi_generated_resources_tr.rc
deleted file mode 100644
index 8252c7b..0000000
--- a/mi_exe_stub/mi_generated_resources_tr.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_uk.rc b/mi_exe_stub/mi_generated_resources_uk.rc
deleted file mode 100644
index b3db549..0000000
--- a/mi_exe_stub/mi_generated_resources_uk.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_ur.rc b/mi_exe_stub/mi_generated_resources_ur.rc
deleted file mode 100644
index e757e2f..0000000
--- a/mi_exe_stub/mi_generated_resources_ur.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_vi.rc b/mi_exe_stub/mi_generated_resources_vi.rc
deleted file mode 100644
index 53b5ebd..0000000
--- a/mi_exe_stub/mi_generated_resources_vi.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_zh-CN.rc b/mi_exe_stub/mi_generated_resources_zh-CN.rc
deleted file mode 100644
index 61a7008..0000000
--- a/mi_exe_stub/mi_generated_resources_zh-CN.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/mi_generated_resources_zh-TW.rc b/mi_exe_stub/mi_generated_resources_zh-TW.rc
deleted file mode 100644
index fd75477..0000000
--- a/mi_exe_stub/mi_generated_resources_zh-TW.rc
+++ /dev/null
Binary files differ
diff --git a/mi_exe_stub/process.cc b/mi_exe_stub/process.cc
deleted file mode 100644
index 46c852f..0000000
--- a/mi_exe_stub/process.cc
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/mi_exe_stub/process.h"
-
-namespace omaha {
-
-namespace {
-
-bool run_and_wait(const CString& command_line,
-                  DWORD* exit_code,
-                  bool wait,
-                  int cmd_show) {
-  CString cmd_line(command_line);
-  STARTUPINFO si = {};
-  PROCESS_INFORMATION pi = {};
-
-  GetStartupInfo(&si);
-  si.dwFlags |= STARTF_FORCEOFFFEEDBACK | STARTF_USESHOWWINDOW;
-  si.wShowWindow = static_cast<WORD>(cmd_show);
-
-  BOOL create_process_result = CreateProcess(NULL,
-                                             cmd_line.GetBuffer(),
-                                             NULL,
-                                             NULL,
-                                             FALSE,
-                                             CREATE_UNICODE_ENVIRONMENT,
-                                             NULL,
-                                             NULL,
-                                             &si,
-                                             &pi);
-  if (!create_process_result) {
-    *exit_code = GetLastError();
-    return false;
-  }
-
-  if (wait) {
-    WaitForSingleObject(pi.hProcess, INFINITE);
-  }
-
-  bool result = true;
-  if (exit_code) {
-    result = !!GetExitCodeProcess(pi.hProcess, exit_code);
-  }
-
-  CloseHandle(pi.hProcess);
-  CloseHandle(pi.hThread);
-
-  return result;
-}
-
-}  // namespace
-
-bool RunAndWaitHidden(const CString& command_line, DWORD *exit_code) {
-  return run_and_wait(command_line, exit_code, true, SW_HIDE);
-}
-
-bool RunAndWait(const CString& command_line, DWORD *exit_code) {
-  return run_and_wait(command_line, exit_code, true, SW_SHOWNORMAL);
-}
-
-bool Run(const CString& command_line) {
-  return run_and_wait(command_line, NULL, false, SW_SHOWNORMAL);
-}
-
-}  // namespace omaha
diff --git a/mi_exe_stub/process.h b/mi_exe_stub/process.h
deleted file mode 100644
index fe6a1e1..0000000
--- a/mi_exe_stub/process.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_MI_EXE_STUB_PROCESS_H_
-#define OMAHA_MI_EXE_STUB_PROCESS_H_
-
-#include <atlstr.h>
-#include <windows.h>
-
-namespace omaha {
-
-// Convenience function to launch a process. Returns true if we successfully
-// launched it.
-bool Run(const CString& command_line);
-
-// Convenience function to launch a process, wait for it to finish,
-// and return the result.
-bool RunAndWait(const CString& command_line, DWORD *exit_code);
-
-// Convenience function to launch a process with the initial window hidden,
-// wait for it to finish and return the result.
-bool RunAndWaitHidden(const CString& command_line, DWORD *exit_code);
-
-}  // namespace omaha
-
-#endif  // OMAHA_MI_EXE_STUB_PROCESS_H_
diff --git a/mi_exe_stub/ptrdiff_t.h b/mi_exe_stub/ptrdiff_t.h
deleted file mode 100644
index 0f94fd4..0000000
--- a/mi_exe_stub/ptrdiff_t.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2006-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// The WDK CRT headers do not define ptrdiff_t, which is used by
-// scoped_array.
-
-#ifndef OMAHA_MI_EXE_STUB_PTRDIFF_H_
-#define OMAHA_MI_EXE_STUB_PTRDIFF_H_
-
-namespace std {
-
-#ifdef _WIN64
-typedef __intr64 ptrdiff_t;
-#else
-typedef int ptrdiff_t;
-#endif
-
-}  // namespace std
-
-#endif  // OMAHA_MI_EXE_STUB_PTRDIFF_H_
diff --git a/mi_exe_stub/resource.h b/mi_exe_stub/resource.h
deleted file mode 100644
index fc12206..0000000
--- a/mi_exe_stub/resource.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#ifndef OMAHA_MI_EXE_STUB_RESOURCE_H__
-#define OMAHA_MI_EXE_STUB_RESOURCE_H__
-
-#define IDI_APP 101
-
-#endif  // OMAHA_MI_EXE_STUB_RESOURCE_H__
-
diff --git a/mi_exe_stub/tar.cc b/mi_exe_stub/tar.cc
deleted file mode 100644
index 1f3249d..0000000
--- a/mi_exe_stub/tar.cc
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/mi_exe_stub/tar.h"
-#include <windows.h>
-#pragma warning(push)
-// C4310: cast truncates constant value
-#pragma warning(disable : 4310)
-#include "base/basictypes.h"
-#pragma warning(pop)
-
-namespace omaha {
-
-namespace {
-
-const char kUstarMagic[] = "ustar";
-const char kUstarDone[5] = { '\0', '\0', '\0', '\0', '\0' };
-
-}  // namespace
-
-Tar::Tar(const CString& target_dir, HANDLE file_handle, bool delete_when_done)
-    : target_directory_name_(target_dir),
-      file_handle_(file_handle),
-      delete_when_done_(delete_when_done),
-      callback_(NULL),
-      callback_context_(NULL) {}
-
-Tar::~Tar() {
-  for (int i = 0; i != files_to_delete_.GetSize(); ++i) {
-    DeleteFile(files_to_delete_[i]);
-  }
-}
-
-bool Tar::ExtractToDir() {
-  bool done = false;
-  do {
-    if (!ExtractOneFile(&done)) {
-      return false;
-    }
-  } while (!done);
-  return true;
-}
-
-bool Tar::ExtractOneFile(bool *done) {
-  USTARHeader header;
-  DWORD bytes_handled;
-  bool result = true;
-  BOOL file_result;
-
-  file_result = ::ReadFile(file_handle_, &header, sizeof(USTARHeader),
-      &bytes_handled, NULL);
-  if (!file_result || bytes_handled != sizeof(USTARHeader)) {
-    return false;
-  }
-  if (0 == memcmp(header.magic, kUstarDone, arraysize(kUstarDone) - 1)) {
-    // We're probably done, since we read the final block of all zeroes.
-    *done = true;
-    return true;
-  }
-  if (0 != memcmp(header.magic, kUstarMagic, arraysize(kUstarMagic) - 1)) {
-    return false;
-  }
-  CString new_filename(target_directory_name_);
-  new_filename += "\\";
-  new_filename += header.name;
-  HANDLE new_file = ::CreateFile(new_filename, GENERIC_WRITE, 0, NULL,
-      CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, NULL);
-  if (new_file == INVALID_HANDLE_VALUE) {
-    return false;
-  }
-  // We don't check for conversion errors because the input data is fixed at
-  // build time, so it'll either always work or never work, and we won't ship
-  // one that never works.
-  DWORD tar_file_size = strtol(header.size, NULL, 8);  // NOLINT
-  DWORD next_offset = ::SetFilePointer(file_handle_, 0, NULL, FILE_CURRENT) +
-      tar_file_size + (512 - tar_file_size & 0x1ff);
-  while (tar_file_size > 0) {
-    const int kCopyBufferSize = 256 * 1024;
-    char copy_buffer[kCopyBufferSize];
-    DWORD bytes_to_handle = kCopyBufferSize;
-    if (bytes_to_handle > tar_file_size) {
-      bytes_to_handle = tar_file_size;
-    }
-    file_result = ::ReadFile(file_handle_, copy_buffer, bytes_to_handle,
-        &bytes_handled, NULL);
-    if (!file_result) {
-      result = false;
-      break;
-    } else {
-      file_result = ::WriteFile(new_file, copy_buffer, bytes_to_handle,
-          &bytes_handled, NULL);
-      if (!file_result) {
-        result = false;
-        break;
-      } else {
-        tar_file_size -= bytes_to_handle;
-      }
-    }
-  }
-  CloseHandle(new_file);
-  if (result) {
-    if (delete_when_done_) {
-      files_to_delete_.Add(new_filename);
-    }
-    if (callback_ != NULL) {
-      callback_(callback_context_, new_filename);
-    }
-  }
-
-  if (INVALID_SET_FILE_POINTER != next_offset) {
-    SetFilePointer(file_handle_, next_offset, NULL, FILE_BEGIN);
-  }
-
-  return result;
-}
-
-}  // namespace omaha
diff --git a/mi_exe_stub/tar.h b/mi_exe_stub/tar.h
deleted file mode 100644
index 709156a..0000000
--- a/mi_exe_stub/tar.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#ifndef OMAHA_MI_EXE_STUB_TAR_H_
-#define OMAHA_MI_EXE_STUB_TAR_H_
-
-#include <tchar.h>
-#include <atlsimpcoll.h>
-#include <atlstr.h>
-#include <windows.h>
-
-namespace omaha {
-
-static const int kNameSize = 100;
-
-typedef struct {
-  char name[kNameSize];
-  char mode[8];
-  char uid[8];
-  char gid[8];
-  char size[12];
-  char mtime[12];
-  char chksum[8];
-  char typeflag;
-  char linkname[kNameSize];
-  char magic[6];
-  char version[2];
-  char uname[32];
-  char gname[32];
-  char devmajor[8];
-  char devminor[8];
-  char prefix[155];
-  char dummy[12];  // make it exactly 512 bytes
-} USTARHeader;
-
-// Supports untarring of files from a tar-format archive. Pretty minimal;
-// doesn't work with everything in the USTAR format.
-class Tar {
- public:
-  Tar(const CString& target_dir, HANDLE file_handle, bool delete_when_done);
-  ~Tar();
-
-  typedef void (*TarFileCallback)(void* context, const TCHAR* filename);
-
-  void SetCallback(TarFileCallback callback, void* callback_context) {
-    callback_ = callback;
-    callback_context_ = callback_context;
-  }
-
-  // Extracts all files in archive to directory specified in constructor.
-  // Directory must exist. Returns true if successful.
-  bool ExtractToDir();
-
- private:
-  HANDLE file_handle_;
-  CString target_directory_name_;
-  bool delete_when_done_;
-  CSimpleArray<CString> files_to_delete_;
-  TarFileCallback callback_;
-  void* callback_context_;
-
-  bool ExtractOneFile(bool* done);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_MI_EXE_STUB_TAR_H_
diff --git a/mi_exe_stub/x86_encoder/bcj.cc b/mi_exe_stub/x86_encoder/bcj.cc
deleted file mode 100644
index 9d0d19a..0000000
--- a/mi_exe_stub/x86_encoder/bcj.cc
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// BCJ encodes a file to increase its compressibility.
-
-#include <windows.h>
-#include <shellapi.h>
-
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "third_party/smartany/scoped_any.h"
-
-extern "C" {
-#include "third_party/lzma/v4_65/files/C/Bra.h"
-}
-
-int wmain(int argc, WCHAR* argv[], WCHAR* env[]) {
-  UNREFERENCED_PARAMETER(env);
-
-  if (argc < 3) {
-    return 1;
-  }
-
-  // argv[1] is the input file, argv[2] is the output file.
-  scoped_hfile file(::CreateFile(argv[1], GENERIC_READ, 0,
-                                 NULL, OPEN_EXISTING, 0, NULL));
-  if (!valid(file)) {
-    return 2;
-  }
-
-  LARGE_INTEGER file_size_data;
-  if (!::GetFileSizeEx(get(file), &file_size_data)) {
-    return 3;
-  }
-
-  DWORD file_size = static_cast<DWORD>(file_size_data.QuadPart);
-  scoped_array<uint8> buffer(new uint8[file_size]);
-  DWORD bytes_read = 0;
-  if (!::ReadFile(get(file), buffer.get(), file_size, &bytes_read, NULL) ||
-      bytes_read != file_size) {
-    return 4;
-  }
-
-  uint32 conversion_state;
-  x86_Convert_Init(conversion_state);
-  // processed might be less than bytes read. This is apparently OK, although
-  // I don't understand why!
-  uint32 processed = x86_Convert(buffer.get(),
-                                 bytes_read,
-                                 0,
-                                 &conversion_state,
-                                 1 /* encoding */);
-
-  reset(file, ::CreateFile(argv[2], GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0,
-                           NULL));
-  if (!valid(file)) {
-    return 6;
-  }
-
-  DWORD bytes_written = 0;
-  if (!::WriteFile(get(file), buffer.get(), bytes_read, &bytes_written, NULL)) {
-    return 7;
-  }
-
-  return 0;
-}
diff --git a/mi_exe_stub/x86_encoder/bcj2.cc b/mi_exe_stub/x86_encoder/bcj2.cc
deleted file mode 100644
index 10d6349..0000000
--- a/mi_exe_stub/x86_encoder/bcj2.cc
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// BCJ encodes a file to increase its compressibility.
-
-#include <windows.h>
-#include <shellapi.h>
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/mi_exe_stub/x86_encoder/bcj2_encoder.h"
-#include "third_party/smartany/scoped_any.h"
-
-int wmain(int argc, WCHAR* argv[], WCHAR* env[]) {
-  UNREFERENCED_PARAMETER(env);
-
-  if (argc < 3) {
-    return 1;
-  }
-
-  // argv[1] is the input file, argv[2] is the output file.
-  scoped_hfile file(::CreateFile(argv[1], GENERIC_READ, 0,
-                                 NULL, OPEN_EXISTING, 0, NULL));
-  if (!valid(file)) {
-    return 2;
-  }
-
-  LARGE_INTEGER file_size_data;
-  if (!::GetFileSizeEx(get(file), &file_size_data)) {
-    return 3;
-  }
-
-  DWORD file_size = static_cast<DWORD>(file_size_data.QuadPart);
-  scoped_array<uint8> buffer(new uint8[file_size]);
-  DWORD bytes_read = 0;
-  if (!::ReadFile(get(file), buffer.get(), file_size, &bytes_read, NULL) ||
-      bytes_read != file_size) {
-    return 4;
-  }
-
-  std::string out1;
-  std::string out2;
-  std::string out3;
-  std::string out4;
-  if (!omaha::Bcj2Encode(std::string(reinterpret_cast<char*>(buffer.get()),
-                                     file_size),
-                         &out1, &out2, &out3, &out4)) {
-    return 5;
-  }
-
-  // The format of BCJ2 file is very primitive.
-  // Header is 5 32-bit ints, with the following information:
-  //   unpacked size
-  //   size of stream 1
-  //   size of stream 2
-  //   size of stream 3
-  //   size of stream 4
-  const DWORD output_buffer_length = 5 * sizeof(uint32) +  // NOLINT
-                                     out1.size() + out2.size() + out3.size() +
-                                     out4.size();
-  DWORD buffer_remaining = output_buffer_length;
-  scoped_array<uint8> output_buffer(new uint8[output_buffer_length]);
-  uint8* p = output_buffer.get();
-  *reinterpret_cast<uint32*>(p) = bytes_read;
-  p += sizeof(uint32);  // NOLINT
-  buffer_remaining -= sizeof(uint32);  // NOLINT
-  *reinterpret_cast<uint32*>(p) = out1.size();
-  p += sizeof(uint32);  // NOLINT
-  buffer_remaining -= sizeof(uint32);  // NOLINT
-  *reinterpret_cast<uint32*>(p) = out2.size();
-  p += sizeof(uint32);  // NOLINT
-  buffer_remaining -= sizeof(uint32);  // NOLINT
-  *reinterpret_cast<uint32*>(p) = out3.size();
-  p += sizeof(uint32);  // NOLINT
-  buffer_remaining -= sizeof(uint32);  // NOLINT
-  *reinterpret_cast<uint32*>(p) = out4.size();
-  p += sizeof(uint32);  // NOLINT
-  buffer_remaining -= sizeof(uint32);  // NOLINT
-  if (!out1.empty()) {
-    if (0 != memcpy_s(p, buffer_remaining, &out1[0], out1.size())) {
-      return 9;
-    }
-    p += out1.size();
-    buffer_remaining -= out1.size();
-  }
-  if (!out2.empty()) {
-    if (0 != memcpy_s(p, buffer_remaining, &out2[0], out2.size())) {
-      return 10;
-    }
-    p += out2.size();
-    buffer_remaining -= out2.size();
-  }
-  if (!out3.empty()) {
-    if (0 != memcpy_s(p, buffer_remaining, &out3[0], out3.size())) {
-      return 11;
-    }
-    p += out3.size();
-    buffer_remaining -= out3.size();
-  }
-  if (!out4.empty()) {
-    if (0 != memcpy_s(p, buffer_remaining, &out4[0], out4.size())) {
-      return 12;
-    }
-    p += out4.size();
-    buffer_remaining -= out4.size();
-  }
-  if (p != output_buffer.get() + output_buffer_length ||
-      0 != buffer_remaining) {
-    return 8;
-  }
-
-  reset(file, ::CreateFile(argv[2], GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0,
-                           NULL));
-  if (!valid(file)) {
-    return 6;
-  }
-
-  DWORD bytes_written = 0;
-  if (!::WriteFile(get(file), output_buffer.get(), output_buffer_length,
-                   &bytes_written, NULL)) {
-    return 7;
-  }
-
-  return 0;
-}
diff --git a/mi_exe_stub/x86_encoder/bcj2_encoder.cc b/mi_exe_stub/x86_encoder/bcj2_encoder.cc
deleted file mode 100644
index bce69db..0000000
--- a/mi_exe_stub/x86_encoder/bcj2_encoder.cc
+++ /dev/null
@@ -1,168 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// The BCJ2 algorithm takes advantage of the fact that a lot of relative jumps
-// in x86 code are to the same address. It essentially performs the moral
-// equivalent of the following conversion:
-// ...
-// JMP 8 bytes back
-// ...
-// JMP 28 bytes back
-// ...
-// JMP 40 bytes back
-// ...
-// to:
-// ...
-// JMP 0x1000
-// ...
-// JMP 0x1000
-// ...
-// JMP 0x1000
-// ...
-//
-// The second form has a lot more repetition, and standard entropy coding can
-// compress it further.
-//
-// Details:
-// TODO(omaha): figure out what the byte before a CALL (0xE8) instruction means.
-// TODO(omaha): document exactly how the range encoding is used. There are 258
-// range encoding bits. The first 256 are used for CALL instructions based on
-// the value of the previous byte; byte 256 is used for JMP, and byte 257 is
-// used for JCC.
-//
-// BCJ2 converts the targets for the CALL (0xE8), JMP (0xE9), and certain JCC
-// (0xF80-0xF8F) instructions into absolute jumps.  This is not a full x86 op
-// code interpreter, and it is almost certain that bytes that are data rather
-// than instructions will be encoded.
-// The algorithm uses the following steps to perform the conversion:
-// 1. Iterate through each byte while the current position is at least 5 bytes
-//    away from the end.
-// 1. If the byte is not a CALL , JMP, or JCC instruction, copy the byte to the
-//    output and go back to step 1.
-// 2. Otherwise, calculate the target of the jump. If the target of this jump is
-//    not within this file (e.g. past the end of the input), we do not rewrite
-//    this jump: write 0 to the range encoder to indicate the target was not
-//    processed and go back to step 1.
-// 3. If the instruction is CALL, write the absolute target to the call output
-//    stream. Otherwise, write the absolute target to the jump output stream.
-//    Write a 1 to the range encoder to indicate the target was processed and go
-//    back to step 1.
-// 4. Once within 5 bytes of the end of the input, flush out the remaining
-//    bytes. If one of the bytes happens to be one of the op codes that should
-//    be handled, write a 0 to the range encoder to indicate that it was not
-//    processed.
-
-#include "omaha/mi_exe_stub/x86_encoder/bcj2_encoder.h"
-
-#include "base/basictypes.h"
-#include "omaha/mi_exe_stub/x86_encoder/range_encoder.h"
-
-namespace omaha {
-
-namespace {
-
-bool IsJcc(uint8 byte0, uint8 byte1) {
-  return (byte0 == 0x0F && (byte1 & 0xF0) == 0x80);
-}
-
-bool IsJ(uint8 byte0, uint8 byte1) {
-  return ((byte1 & 0xFE) == 0xE8 || IsJcc(byte0, byte1));
-}
-
-int GetIndex(uint8 byte0, uint8 byte1) {
-  return ((byte1 == 0xE8) ? byte0 : ((byte1 == 0xE9) ? 256 : 257));
-}
-
-}  // namespace
-
-bool Bcj2Encode(const std::string& input,
-                std::string* main_output,
-                std::string* call_output,
-                std::string* jump_output,
-                std::string* misc_output) {
-  if (!main_output || !call_output || !jump_output || !misc_output) {
-    return false;
-  }
-
-  size_t input_position = 0;
-
-  static const int kNumberOfMoveBits = 5;
-  RangeEncoder range_encoder(misc_output);
-  RangeEncoderBit<kNumberOfMoveBits> status_encoder[256 + 2];
-
-  uint8 previous_byte = 0;
-
-  while (true) {
-    if (input.size() - input_position < 5) {
-      for (; input_position < input.size(); ++input_position) {
-        uint8 byte = input[input_position];
-        *main_output += byte;
-
-        size_t index;
-        if (0xE8 == byte) {
-          index = previous_byte;
-        } else if (0xE9 == byte) {
-          index = 256;
-        } else if (IsJcc(previous_byte, byte)) {
-          index = 257;
-        } else {
-          previous_byte = byte;
-          continue;
-        }
-        status_encoder[index].Encode(0, &range_encoder);
-        previous_byte = byte;
-      }
-
-      range_encoder.Flush();
-      return true;
-    }
-
-    while (input_position <= input.size() - 5) {
-      uint8 byte = input[input_position];
-      *main_output += byte;
-
-      if (!IsJ(previous_byte, byte)) {
-        input_position++;
-        previous_byte = byte;
-        continue;
-      }
-
-      uint8 next_byte = input[input_position + 4];
-      uint32 src =
-        static_cast<uint32>(next_byte) << 24 |
-        static_cast<uint32>(input[input_position + 3]) << 16 |
-        static_cast<uint32>(input[input_position + 2]) << 8 |
-        input[input_position + 1];
-      uint32 dst = input_position + src + 5;
-
-      uint32 index = GetIndex(previous_byte, byte);
-      if (dst < input.size()) {
-        status_encoder[index].Encode(1, &range_encoder);
-        input_position += 5;
-        std::string* s = (byte == 0xE8) ? call_output : jump_output;
-        for (int i = 24; i >= 0; i -= 8) {
-          *s += static_cast<uint8>(dst >> i);
-        }
-        previous_byte = next_byte;
-      } else {
-        status_encoder[index].Encode(0, &range_encoder);
-        input_position++;
-        previous_byte = byte;
-      }
-    }
-  }
-}
-
-}  // namespace omaha
diff --git a/mi_exe_stub/x86_encoder/bcj2_encoder.h b/mi_exe_stub/x86_encoder/bcj2_encoder.h
deleted file mode 100644
index f70516f..0000000
--- a/mi_exe_stub/x86_encoder/bcj2_encoder.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Implementation taken from Bcj2Coder implementation in LZMA SDK and converted
-// to use std::string as the interface.
-
-#ifndef OMAHA_MI_EXE_STUB_X86_ENCODER_BCJ2_ENCODER_H_
-#define OMAHA_MI_EXE_STUB_X86_ENCODER_BCJ2_ENCODER_H_
-
-#include <string>
-
-namespace omaha {
-
-// TODO(omaha): this is currently a single-shot interface. The entire buffer
-// to be encoded must be loaded in memory. It'd be nice to make work in chunks.
-// TODO(omaha): consider converting this interface to use std::vector. The
-// reason std::string is used is for the auto-resize convenience.
-// All input/output parameters from this function are *binary* strings.
-// Use std::string::size() to get the length of the buffer. Do not use
-// std::string::c_str() on these strings.
-bool Bcj2Encode(const std::string& input,
-                std::string* main_output,
-                std::string* call_output,
-                std::string* jump_output,
-                std::string* misc_output);
-
-}  // namespace omaha
-
-#endif  // OMAHA_MI_EXE_STUB_X86_ENCODER_BCJ2_ENCODER_H_
diff --git a/mi_exe_stub/x86_encoder/bcj2_encoder_unittest.cc b/mi_exe_stub/x86_encoder/bcj2_encoder_unittest.cc
deleted file mode 100644
index 164d94b..0000000
--- a/mi_exe_stub/x86_encoder/bcj2_encoder_unittest.cc
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/mi_exe_stub/x86_encoder/bcj2_encoder.h"
-#include <string>
-#include <vector>
-#include "omaha/base/utils.h"
-#include "omaha/testing/unit_test.h"
-extern "C" {
-#include "omaha/third_party/lzma/v4_65/files/C/Bcj2.h"
-}
-
-namespace omaha {
-
-TEST(Bcj2EncoderTest, EmptyBuffer) {
-  std::string input;
-  std::string output1;
-  std::string output2;
-  std::string output3;
-  std::string output4;
-  ASSERT_TRUE(Bcj2Encode(input, &output1, &output2, &output3, &output4));
-  EXPECT_EQ("", output1);
-  EXPECT_EQ("", output2);
-  EXPECT_EQ("", output3);
-  EXPECT_EQ(std::string(5, '\0'), output4);
-}
-
-// Test that the transform is reversible.
-TEST(Bcj2EncoderTest, Reversible) {
-  // The victim program is the unit test itself.
-  WCHAR module_path[MAX_PATH];
-  ASSERT_LT(static_cast<DWORD>(0), ::GetModuleFileName(NULL,
-                                                       module_path,
-                                                       arraysize(module_path)));
-  std::vector<byte> raw_file;
-  ASSERT_HRESULT_SUCCEEDED(
-      ReadEntireFileShareMode(module_path, 0, FILE_SHARE_READ, &raw_file));
-  const std::string input(reinterpret_cast<char*>(&raw_file[0]),
-                          raw_file.size());
-  std::string output1;
-  std::string output2;
-  std::string output3;
-  std::string output4;
-  ASSERT_TRUE(Bcj2Encode(input, &output1, &output2, &output3, &output4));
-
-  std::string decoded_output;
-  decoded_output.resize(raw_file.size());
-  ASSERT_EQ(SZ_OK, Bcj2_Decode(reinterpret_cast<const uint8*>(output1.data()),
-                               output1.size(),
-                               reinterpret_cast<const uint8*>(output2.data()),
-                               output2.size(),
-                               reinterpret_cast<const uint8*>(output3.data()),
-                               output2.size(),
-                               reinterpret_cast<const uint8*>(output4.data()),
-                               output4.size(),
-                               reinterpret_cast<uint8*>(&decoded_output[0]),
-                               decoded_output.size()));
-  EXPECT_EQ(input, decoded_output);
-}
-
-}  // namespace omaha
diff --git a/mi_exe_stub/x86_encoder/build.scons b/mi_exe_stub/x86_encoder/build.scons
deleted file mode 100644
index 05f9e2c..0000000
--- a/mi_exe_stub/x86_encoder/build.scons
+++ /dev/null
@@ -1,69 +0,0 @@
-# Copyright 2008-2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-local_env = env.Clone()
-local_env.FilterOut(CPPDEFINES=['_ATL_DEBUG_INTERFACES'])
-
-bcj2_lib = local_env.ComponentStaticLibrary(
-    lib_name='bcj2_lib',
-    source=[
-        'bcj2_encoder.cc',
-        'range_encoder.cc',
-    ],
-)
-
-bin_env = local_env.Clone()
-bin_env.FilterOut(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
-bin_env.Append(
-    LINKFLAGS=['/SUBSYSTEM:CONSOLE'],
-    LIBS=[
-        ('libcmt.lib', 'libcmtd.lib')[local_env.Bit('debug')],
-        ('libcpmt.lib', 'libcpmtd.lib')[local_env.Bit('debug')],
-        'kernel32.lib',
-        '$LIB_DIR/lzma.lib',
-    ],
-)
-
-bin_env.ComponentTool(
-    prog_name='bcj',
-    source=[
-        'bcj.cc',
-    ],
-)
-
-bjc2_env = bin_env.Clone()
-bjc2_env.Append(
-    LIBS=[ bcj2_lib ],
-)
-bjc2_env.ComponentTool(
-    prog_name='bcj2',
-    source=[
-        'bcj2.cc',
-    ],
-)
-
-local_env.OmahaUnittest(
-    name='bcj2_encoder_unittest',
-    source='bcj2_encoder_unittest.cc',
-    LIBS=[
-        bcj2_lib,
-        '$LIB_DIR/common.lib',
-        '$LIB_DIR/lzma.lib',
-    ],
-    all_in_one=False,
-    COMPONENT_TEST_SIZE='small',
-)
diff --git a/mi_exe_stub/x86_encoder/range_encoder.cc b/mi_exe_stub/x86_encoder/range_encoder.cc
deleted file mode 100644
index 31bfd51..0000000
--- a/mi_exe_stub/x86_encoder/range_encoder.cc
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Derived from RangeCoder.h and RangeCoderBit.h in the LZMA SDK
-
-#include "omaha/mi_exe_stub/x86_encoder/range_encoder.h"
-
-#include "base/basictypes.h"
-
-namespace omaha {
-
-RangeEncoder::RangeEncoder(std::string* output)
-    : output_(output),
-      cache_(0),
-      cache_size_(1),
-      low_(0),
-      range_(0xFFFFFFFF) {
-}
-
-void RangeEncoder::Encode(uint32 start, uint32 size, uint32 total) {
-  low_ += start * (range_ /= total);
-  range_ *= size;
-  while (range_ < kTopValue) {
-    range_ <<= 8;
-    ShiftLow();
-  }
-}
-
-void RangeEncoder::ShiftLow() {
-  if (static_cast<uint32>(low_) < static_cast<uint32>(0xFF000000) ||
-      static_cast<int>(low_ >> 32) != 0) {
-    uint8 temp = cache_;
-    do {
-      *output_ += static_cast<uint8>(temp + static_cast<uint8>(low_ >> 32));
-      temp = 0xFF;
-    } while (--cache_size_ != 0);
-    cache_ = static_cast<uint8>(static_cast<uint32>(low_) >> 24);
-  }
-  cache_size_++;
-  low_ = static_cast<uint32>(low_) << 8;
-}
-
-void RangeEncoder::Flush() {
-  for (int i = 0; i < 5; ++i) {
-    ShiftLow();
-  }
-}
-
-}  // namespace
diff --git a/mi_exe_stub/x86_encoder/range_encoder.h b/mi_exe_stub/x86_encoder/range_encoder.h
deleted file mode 100644
index a4485b1..0000000
--- a/mi_exe_stub/x86_encoder/range_encoder.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Derived from RangeCoder.h and RangeCoderBit.h in the LZMA SDK
-//
-// A description of how range encoding works can be found at
-// http://en.wikipedia.org/wiki/Range_encoding
-
-#ifndef OMAHA_MI_EXE_STUB_X86_ENCODER_RANGE_ENCODER_H_
-#define OMAHA_MI_EXE_STUB_X86_ENCODER_RANGE_ENCODER_H_
-
-#include <string>
-
-#include "base/basictypes.h"
-
-namespace omaha {
-
-const int kNumberOfBitsModelTotalBits = 11;
-const uint32 kBitModelTotal = 1 << kNumberOfBitsModelTotalBits;
-
-const int kNumTopBits = 24;
-const uint32 kTopValue = 1 << kNumTopBits;
-
-class RangeEncoder {
- public:
-  // RangeEncoder does not take ownership. Lifetime must be managed by caller.
-  explicit RangeEncoder(std::string* output);
-  void Encode(uint32 start, uint32 size, uint32 total);
-  void ShiftLow();
-  void Flush();
-
-  uint64 low() const { return low_; }
-  void set_low(uint64 low) { low_ = low; }
-  uint32 range() const { return range_; }
-  void set_range(uint32 range) { range_ = range; }
-
- private:
-  uint8 cache_;
-  uint32 cache_size_;
-
-  uint64 low_;
-  uint32 range_;
-
-  std::string* output_;
-
-  DISALLOW_COPY_AND_ASSIGN(RangeEncoder);
-};
-
-template<int kNumberOfMoveBits>
-class RangeEncoderBit {
- public:
-  RangeEncoderBit() : probability_(kBitModelTotal / 2) {
-  }
-
-  void Encode(uint32 symbol, RangeEncoder* encoder) {
-    uint32 new_bound = (encoder->range() >> kNumberOfBitsModelTotalBits) *
-                       probability_;
-    if (0 == symbol) {
-      encoder->set_range(new_bound);
-      probability_ += (kBitModelTotal - probability_) >> kNumberOfMoveBits;
-    } else {
-      encoder->set_low(encoder->low() + new_bound);
-      encoder->set_range(encoder->range() - new_bound);
-      probability_ -= probability_ >> kNumberOfMoveBits;
-    }
-    if (encoder->range() < kTopValue) {
-      encoder->set_range(encoder->range() << 8);
-      encoder->ShiftLow();
-    }
-  }
-
- private:
-  uint32 probability_;
-
-  DISALLOW_COPY_AND_ASSIGN(RangeEncoderBit);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_MI_EXE_STUB_X86_ENCODER_RANGE_ENCODER_H_
diff --git a/net/bind_status_callback.cc b/net/bind_status_callback.cc
deleted file mode 100644
index 43a5ab8..0000000
--- a/net/bind_status_callback.cc
+++ /dev/null
@@ -1,321 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// IBindStatusCallback interface.
-
-#include "omaha/net/bind_status_callback.h"
-#include <wininet.h>
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-HRESULT QueryHttpInfo(IWinInetHttpInfo* http_info, DWORD query, CString* info) {
-  CORE_LOG(L3, (_T("[QueryHttpInfo][%d]"), query));
-  ASSERT1(http_info);
-  ASSERT1(query);
-  ASSERT1(info);
-
-  info->Empty();
-  DWORD size = 0;
-  DWORD flags = 0;
-  HRESULT hr = http_info->QueryInfo(query, 0, &size, &flags, 0);
-  CORE_LOG(L3, (_T("[http_info->QueryInfo][0x%x][%d]"), hr, size));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CStringA buf;
-  hr = http_info->QueryInfo(query, CStrBufA(buf, size), &size, &flags, 0);
-  CORE_LOG(L3, (_T("[http_info->QueryInfo][0x%x][%d]"), hr, size));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CORE_LOG(L3, (_T("[QueryHttpInfo success][%d][%s]"), query, CA2T(buf)));
-  *info = buf;
-  return S_OK;
-}
-
-BindStatusCallback::BindStatusCallback()
-    : http_verb_(BINDVERB_GET),
-      post_data_byte_count_(0),
-      response_code_(0) {
-}
-
-HRESULT BindStatusCallback::Send(BSTR url,
-                                 BSTR post_data,
-                                 BSTR request_headers,
-                                 VARIANT response_headers_needed,
-                                 VARIANT* response_headers,
-                                 DWORD* response_code,
-                                 BSTR* cache_filename) {
-  if (!url || !*url || !response_code || !cache_filename) {
-    return E_INVALIDARG;
-  }
-
-  *response_code = 0;
-  *cache_filename = NULL;
-
-  if (V_VT(&response_headers_needed) != VT_EMPTY) {
-    if ((V_VT(&response_headers_needed) != (VT_ARRAY | VT_UI4)) ||
-        !response_headers) {
-      return E_INVALIDARG;
-    }
-    V_VT(response_headers) = VT_NULL;
-    response_headers_needed_ = response_headers_needed.parray;
-    if (!response_headers_needed_.GetCount()) {
-      return E_INVALIDARG;
-    }
-  }
-
-  request_headers_ = request_headers;
-  if (!post_data) {
-    http_verb_ = BINDVERB_GET;
-  } else {
-    http_verb_ = BINDVERB_POST;
-    post_data_byte_count_ = ::SysStringByteLen(post_data);
-    reset(post_data_, ::GlobalAlloc(GPTR, post_data_byte_count_));
-    if (!post_data_) {
-      HRESULT hr = HRESULTFromLastError();
-      CORE_LOG(LE, (_T("[::GlobalAlloc failed][0x%x]"), hr));
-      return hr;
-    }
-
-    memcpy(get(post_data_), post_data, post_data_byte_count_);
-  }
-
-  CComPtr<IBindStatusCallback> bsc(this);
-  CString filename;
-  HRESULT hr = ::URLDownloadToCacheFile(NULL,
-                                        url,
-                                        CStrBuf(filename, MAX_PATH),
-                                        MAX_PATH,
-                                        0,
-                                        bsc);
-
-  if (response_headers) {
-    response_headers_.Detach(response_headers);
-  }
-  *response_code = response_code_;
-
-  CORE_LOG(L2, (_T("[URLDownloadToCacheFile][0x%x][%s]"), hr, url));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  ASSERT1(!filename.IsEmpty());
-  CORE_LOG(L2, (_T("[BindStatusCallback::Send][cache file][%s]"), filename));
-  *cache_filename = filename.AllocSysString();
-  return hr;
-}
-
-// IBindStatusCallback methods.
-
-STDMETHODIMP BindStatusCallback::OnStartBinding(DWORD, IBinding* binding) {
-  __mutexScope(lock_);
-  binding_git_.Attach(binding);
-  return S_OK;
-}
-
-STDMETHODIMP BindStatusCallback::GetPriority(LONG* priority) {
-  UNREFERENCED_PARAMETER(priority);
-  return E_NOTIMPL;
-}
-
-STDMETHODIMP BindStatusCallback::OnLowResource(DWORD) {
-  return E_NOTIMPL;
-}
-
-STDMETHODIMP BindStatusCallback::OnProgress(ULONG, ULONG, ULONG, LPCWSTR) {
-  return E_NOTIMPL;
-}
-
-STDMETHODIMP BindStatusCallback::OnStopBinding(HRESULT, LPCWSTR) {
-  CComPtr<IBinding> binding;
-
-  __mutexBlock(lock_) {
-    if (!binding_git_) {
-      return S_OK;
-    }
-
-    HRESULT hr = binding_git_.CopyTo(&binding);
-    VERIFY1(SUCCEEDED(binding_git_.Revoke()));
-    if (FAILED(hr)) {
-      CORE_LOG(LW, (_T("[binding_git_.CopyTo failed][0x%x]"), hr));
-      return S_OK;
-    }
-  }
-
-  CComQIPtr<IWinInetHttpInfo> http_info(binding);
-  if (!http_info) {
-    return S_OK;
-  }
-
-  CString response_code_buf;
-  if (SUCCEEDED(QueryHttpInfo(http_info,
-                              HTTP_QUERY_STATUS_CODE,
-                              &response_code_buf)) &&
-      !response_code_buf.IsEmpty()) {
-    response_code_ = _ttoi(response_code_buf);
-  }
-
-  if (!response_headers_needed_) {
-    return S_OK;
-  }
-  int count = response_headers_needed_.GetCount();
-  ASSERT1(count > 0);
-  int lower_bound = response_headers_needed_.GetLowerBound();
-  int upper_bound = response_headers_needed_.GetUpperBound();
-
-  CComSafeArray<BSTR> response_array(count, lower_bound);
-  for (int i = lower_bound; i <= upper_bound; ++i) {
-    CString response_header_buf;
-    QueryHttpInfo(http_info, response_headers_needed_[i], &response_header_buf);
-    response_array[i] = response_header_buf.AllocSysString();
-  }
-
-  V_VT(&response_headers_) = VT_ARRAY | VT_BSTR;
-  V_ARRAY(&response_headers_) = response_array.Detach();
-  return S_OK;
-}
-
-STDMETHODIMP BindStatusCallback::GetBindInfo(DWORD* flags, BINDINFO* info) {
-  ASSERT1(flags);
-  ASSERT1(info);
-  *flags = 0;
-
-  // Set up the BINDINFO data structure.
-  info->cbSize = sizeof(*info);
-  info->dwBindVerb = http_verb_;
-  info->szExtraInfo = NULL;
-
-  // Initialize the STGMEDIUM.
-  SetZero(info->stgmedData);
-  info->grfBindInfoF = 0;
-  info->szCustomVerb = NULL;
-
-  switch (http_verb_) {
-    case BINDVERB_POST:
-      if (post_data_) {
-        // Fill the STGMEDIUM with the data to post. Certain versions of Urlmon
-        // require TYMED_GLOBAL with GMEM_FIXED.
-        info->stgmedData.tymed = TYMED_HGLOBAL;
-        info->stgmedData.hGlobal = get(post_data_);
-
-        // The documentation for GetBindInfo() indicates that the method could
-        // be called multiple times for the same request. We do not want to
-        // allocate global memory for each of those times. So we maintain
-        // ownership of the global memory, and pass a reference to it each time.
-        // The HGLOBAL is released on BindStatusCallback destruction. Hence we
-        // set pUnkForRelease to our IUnknown ptr.
-        info->stgmedData.pUnkForRelease =
-            static_cast<IBindStatusCallback*>(this);
-        AddRef();
-
-        info->cbstgmedData = post_data_byte_count_;
-      }
-      return S_OK;
-
-    case BINDVERB_GET:
-      return S_OK;
-
-    case BINDVERB_PUT:
-    case BINDVERB_CUSTOM:
-    default:
-      ASSERT1(false);
-      return E_FAIL;
-  }
-}
-
-STDMETHODIMP BindStatusCallback::OnDataAvailable(DWORD,
-                                                 DWORD,
-                                                 FORMATETC*,
-                                                 STGMEDIUM*) {
-  // The documentation does not explicitly say that E_NOTIMPL can be returned
-  // for this method. So we return S_OK.
-  return S_OK;
-}
-
-STDMETHODIMP BindStatusCallback::OnObjectAvailable(REFIID, IUnknown*) {
-  // The documentation does not explicitly say that E_NOTIMPL can be returned
-  // for this method. So we return S_OK.
-  return S_OK;
-}
-
-STDMETHODIMP BindStatusCallback::BeginningTransaction(LPCWSTR,
-                                                      LPCWSTR,
-                                                      DWORD,
-                                                      LPWSTR* request_headers) {
-  if (!request_headers) {
-    return E_INVALIDARG;
-  }
-  *request_headers = NULL;
-
-  if (request_headers_.IsEmpty()) {
-    return S_OK;
-  }
-
-  int request_headers_size = request_headers_.GetLength() + 1;
-  TCHAR* additional_headers = static_cast<TCHAR*>(
-      ::CoTaskMemAlloc(request_headers_size * sizeof(TCHAR)));
-  if (!additional_headers) {
-    return E_OUTOFMEMORY;
-  }
-
-  _tcscpy_s(additional_headers, request_headers_size, request_headers_);
-  *request_headers = additional_headers;
-
-  return S_OK;
-}
-
-STDMETHODIMP BindStatusCallback::OnResponse(DWORD response_code,
-                                            LPCWSTR response_headers,
-                                            LPCWSTR request_headers,
-                                            LPWSTR* additional_headers) {
-  CORE_LOG(L1, (_T("[OnResponse [%d][%s]"), response_code, response_headers));
-  UNREFERENCED_PARAMETER(response_code);
-  UNREFERENCED_PARAMETER(response_headers);
-  UNREFERENCED_PARAMETER(request_headers);
-  if (!additional_headers) {
-    return E_INVALIDARG;
-  }
-
-  *additional_headers = NULL;
-  return S_OK;
-}
-
-HRESULT BindStatusCallback::Cancel() {
-  CComPtr<IBinding> binding;
-
-  __mutexBlock(lock_) {
-    if (!binding_git_) {
-      return S_OK;
-    }
-
-    HRESULT hr = binding_git_.CopyTo(&binding);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[binding_git_.CopyTo failed][0x%x]"), hr));
-      return hr;
-    }
-  }
-
-  return binding->Abort();
-}
-
-}  // namespace omaha
-
diff --git a/net/bind_status_callback.h b/net/bind_status_callback.h
deleted file mode 100644
index 3afb72c..0000000
--- a/net/bind_status_callback.h
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// IBindStatusCallback interface. Support for HTTP POST.
-
-#ifndef OMAHA_NET_BIND_STATUS_CALLBACK_H__
-#define OMAHA_NET_BIND_STATUS_CALLBACK_H__
-
-#include <windows.h>
-#include <urlmon.h>
-#include <atlbase.h>
-#include <atlcom.h>
-#include <atlsafe.h>
-#include <atlstr.h>
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/synchronized.h"
-
-namespace omaha {
-
-class ATL_NO_VTABLE BindStatusCallback
-    : public CComObjectRootEx<CComObjectThreadModel>,
-      public IBindStatusCallback,
-      public IHttpNegotiate {
- public:
-  HRESULT Send(BSTR url,
-               BSTR post_data,
-               BSTR request_headers,
-               VARIANT response_headers_needed,
-               VARIANT* response_headers,
-               DWORD* response_code,
-               BSTR* cache_filename);
-
-  HRESULT Cancel();
-
-  // C4505: unreferenced IUnknown local functions have been removed
-  #pragma warning(disable : 4505)
-  BEGIN_COM_MAP(BindStatusCallback)
-    COM_INTERFACE_ENTRY(IBindStatusCallback)
-    COM_INTERFACE_ENTRY(IHttpNegotiate)
-  END_COM_MAP()
-
-  // IBindStatusCallback methods.
-  STDMETHODIMP OnStartBinding(DWORD reserved, IBinding* binding);
-  STDMETHODIMP GetPriority(LONG* priority);
-  STDMETHODIMP OnLowResource(DWORD reserved);
-  STDMETHODIMP OnProgress(ULONG, ULONG, ULONG, LPCWSTR);
-  STDMETHODIMP OnStopBinding(HRESULT, LPCWSTR);
-  STDMETHODIMP GetBindInfo(DWORD* bindf_flags, BINDINFO* bind_info);
-  STDMETHODIMP OnDataAvailable(DWORD, DWORD, FORMATETC*, STGMEDIUM*);
-  STDMETHODIMP OnObjectAvailable(REFIID, IUnknown*);
-
-  // IHttpNegotiate methods
-  STDMETHODIMP BeginningTransaction(LPCWSTR url,
-                                    LPCWSTR request_headers,
-                                    DWORD reserved,
-                                    LPWSTR* additional_headers);
-  STDMETHODIMP OnResponse(DWORD response_code,
-                          LPCWSTR response_headers,
-                          LPCWSTR request_headers,
-                          LPWSTR* additional_request_headers);
-
- protected:
-  BindStatusCallback();
-  virtual ~BindStatusCallback() {}
-
- private:
-  LLock lock_;
-  BINDVERB              http_verb_;
-  scoped_hglobal        post_data_;
-  DWORD                 post_data_byte_count_;
-  CString               request_headers_;
-  CComSafeArray<DWORD>  response_headers_needed_;
-  CComVariant           response_headers_;
-  DWORD                 response_code_;
-  CComGITPtr<IBinding>  binding_git_;
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_NET_BIND_STATUS_CALLBACK_H__
-
diff --git a/net/bits_job_callback.cc b/net/bits_job_callback.cc
deleted file mode 100644
index 02943cb..0000000
--- a/net/bits_job_callback.cc
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/net/bits_job_callback.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/utils.h"
-#include "omaha/net/bits_request.h"
-#include "omaha/net/bits_utils.h"
-
-namespace omaha {
-
-HRESULT BitsJobCallback::Create(BitsRequest* bits_request,
-                                BitsJobCallback** bits_job_callback) {
-  ASSERT1(bits_request);
-  ASSERT1(bits_job_callback);
-
-  *bits_job_callback = NULL;
-  scoped_ptr<CComObjectNoLock<BitsJobCallback> > callback_obj(
-      new CComObjectNoLock<BitsJobCallback>);
-  if (callback_obj == NULL) {
-    return E_OUTOFMEMORY;
-  }
-
-  callback_obj->AddRef();
-  callback_obj->bits_request_ = bits_request;
-  *bits_job_callback = callback_obj.release();
-
-  return S_OK;
-}
-
-void BitsJobCallback::RemoveReferenceToBitsRequest() {
-  __mutexScope(lock_);
-  bits_request_ = NULL;
-}
-
-HRESULT BitsJobCallback::JobTransferred(IBackgroundCopyJob* bits_job) {
-  UNREFERENCED_PARAMETER(bits_job);
-
-  __mutexScope(lock_);
-  if (bits_request_) {
-    bits_request_->OnBitsJobStateChanged();
-  }
-
-  // Returns S_OK to avoid BITS continuing to call this callback.
-  return S_OK;
-}
-
-HRESULT BitsJobCallback::JobError(IBackgroundCopyJob* bits_job,
-                                  IBackgroundCopyError* error) {
-  UNREFERENCED_PARAMETER(bits_job);
-  UNREFERENCED_PARAMETER(error);
-
-  __mutexScope(lock_);
-  if (bits_request_) {
-    bits_request_->OnBitsJobStateChanged();
-  }
-
-  // Returns S_OK to avoid BITS continuing to call this callback.
-  return S_OK;
-}
-
-HRESULT BitsJobCallback::JobModification(IBackgroundCopyJob* bits_job,
-                                         DWORD reserved) {
-  ASSERT1(bits_job);
-  UNREFERENCED_PARAMETER(bits_job);
-  UNREFERENCED_PARAMETER(reserved);
-
-  __mutexScope(lock_);
-  if (bits_request_) {
-    bits_request_->OnBitsJobStateChanged();
-  }
-  return S_OK;
-}
-
-}  // namespace omaha
-
diff --git a/net/bits_job_callback.h b/net/bits_job_callback.h
deleted file mode 100644
index eb3a9cb..0000000
--- a/net/bits_job_callback.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-
-#ifndef OMAHA_NET_BITS_JOB_CALLBACK_H_
-#define OMAHA_NET_BITS_JOB_CALLBACK_H_
-
-#include <windows.h>
-#include <bits.h>
-#include <atlbase.h>
-#include <atlcom.h>
-#include "base/basictypes.h"
-#include "omaha/base/synchronized.h"
-
-namespace omaha {
-
-class BitsRequest;
-
-// BitsJobCallback receives notifications that a BITS job is complete, has been
-// modified, or is in error.
-class ATL_NO_VTABLE BitsJobCallback
-    : public CComObjectRootEx<CComObjectThreadModel>,
-      public IBackgroundCopyCallback {
- public:
-  BitsJobCallback() {}
-  virtual ~BitsJobCallback() {
-    bits_request_ = NULL;
-  }
-
-  static HRESULT Create(BitsRequest* bits_request,
-                        BitsJobCallback** bits_job_callback);
-
-  void RemoveReferenceToBitsRequest();
-
-  BEGIN_COM_MAP(BitsJobCallback)
-    COM_INTERFACE_ENTRY(IBackgroundCopyCallback)
-  END_COM_MAP()
-
-  // IBackgroundCopyCallback methods.
-  STDMETHODIMP JobTransferred(IBackgroundCopyJob* job);
-  STDMETHODIMP JobError(IBackgroundCopyJob* job, IBackgroundCopyError* error);
-  STDMETHODIMP JobModification(IBackgroundCopyJob* job, DWORD reserved);
-
- private:
-  BitsRequest* bits_request_;
-  LLock lock_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(BitsJobCallback);
-};
-
-}   // namespace omaha
-
-#endif  // OMAHA_NET_BITS_JOB_CALLBACK_H_
-
diff --git a/net/bits_request.cc b/net/bits_request.cc
deleted file mode 100644
index 10c29f2..0000000
--- a/net/bits_request.cc
+++ /dev/null
@@ -1,766 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-//
-// There is an implicit assumption that one bits job contains only one file.
-//
-// TODO(omaha): assert somewhere on all the job invariants.
-//
-// TODO(omaha): no caching at all is implemented, as far as sharing downloads
-// between different bits users downloading the same file.
-// TODO(omaha): same user downloading same file in different logon session is
-// not handled.
-// TODO(omaha): generally speaking, impersonation scenarios are not
-// yet handled by the code. This is important when creating or opening an
-// existing job.
-
-#include "omaha/net/bits_request.h"
-
-#include <winhttp.h>
-#include <atlbase.h>
-#include <atlstr.h>
-#include <functional>
-#include "omaha/base/const_addresses.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/scoped_impersonation.h"
-#include "omaha/base/utils.h"
-#include "omaha/net/bits_job_callback.h"
-#include "omaha/net/bits_utils.h"
-#include "omaha/net/http_client.h"
-#include "omaha/net/network_request.h"
-#include "omaha/net/proxy_auth.h"
-
-namespace omaha {
-
-namespace {
-
-const TCHAR* const kJobDescription = kAppName;
-
-// During BITS job downloading, we setup the notification callback so that
-// BITS can notify BitsRequest whenever BITS job state changes. To avoid
-// potential notification loss we also use a max polling interval (1s) and
-// when that amount of time passes, we'll do a poll anyway even if no BITS
-// notification is received at that time.
-const LONG kPollingIntervalMs = 1000;
-
-// Returns the job priority or -1 in case of errors.
-int GetJobPriority(IBackgroundCopyJob* job) {
-  ASSERT1(job);
-  BG_JOB_PRIORITY priority = BG_JOB_PRIORITY_FOREGROUND;
-  return SUCCEEDED(job->GetPriority(&priority)) ? priority : -1;
-}
-
-}   // namespace
-
-BitsRequest::BitsRequest()
-    : request_buffer_(NULL),
-      request_buffer_length_(0),
-      proxy_auth_config_(NULL, CString()),
-      low_priority_(false),
-      is_canceled_(false),
-      callback_(NULL),
-      minimum_retry_delay_(-1),
-      no_progress_timeout_(-1),
-      current_auth_scheme_(0),
-      bits_request_callback_(NULL),
-      last_progress_report_tick_(0),
-      creds_set_scheme_unknown_(false) {
-  GetBitsManager(&bits_manager_);
-
-  // Creates a auto-reset event for BITS job change notifications.
-  reset(bits_job_status_changed_event_,
-        ::CreateEvent(NULL, false, false, NULL));
-  ASSERT1(valid(bits_job_status_changed_event_));
-}
-
-// Once this instance connects to a BITS job, it either completes the job
-// or it cleans it up to avoid leaving junk in the BITS queue.
-BitsRequest::~BitsRequest() {
-  Close();
-  callback_ = NULL;
-
-  // TODO(omaha): for unknown reasons, qmgrprxy.dll gets unloaded at some point
-  // during program execution and subsequent calls to BITS crash. This
-  // indicates a ref count problem somewhere. The work around is to not
-  // call the IUnknown::Release if the module is not in memory.
-  if (::GetModuleHandle(_T("qmgrprxy.dll")) == NULL) {
-    bits_manager_.Detach();
-  }
-}
-
-HRESULT BitsRequest::SetupBitsCallback() {
-  ASSERT1(request_state_.get());
-  ASSERT1(request_state_->bits_job);
-
-  __mutexScope(lock_);
-
-  VERIFY1(::ResetEvent(get(bits_job_status_changed_event_)));
-
-  RemoveBitsCallback();
-
-  HRESULT hr = BitsJobCallback::Create(this, &bits_request_callback_);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // In the /ua case, the high-integrity COM server is running as SYSTEM, and
-  // impersonating a medium-integrity token. Calling SetNotifyInterface() with
-  // impersonation will give E_ACCESSDENIED. This is because the COM server only
-  // accepts high integrity incoming calls, as per the DACL set in
-  // InitializeServerSecurity(). Calling AsSelf with EOAC_DYNAMIC_CLOAKING
-  // sets high-integrity SYSTEM as the identity for the callback COM proxy on
-  // the BITS side.
-  hr = StdCallAsSelfAndImpersonate1(
-      request_state_->bits_job.p,
-      &IBackgroundCopyJob::SetNotifyInterface,
-      static_cast<IUnknown*>(bits_request_callback_));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = request_state_->bits_job->SetNotifyFlags(BG_NOTIFY_JOB_TRANSFERRED |
-                                                BG_NOTIFY_JOB_ERROR |
-                                                BG_NOTIFY_JOB_MODIFICATION);
-  return hr;
-}
-
-void BitsRequest::RemoveBitsCallback() {
-  if (bits_request_callback_ != NULL) {
-    bits_request_callback_->RemoveReferenceToBitsRequest();
-
-    bits_request_callback_->Release();
-    bits_request_callback_ = NULL;
-  }
-
-  if (request_state_.get() && request_state_->bits_job) {
-    request_state_->bits_job->SetNotifyInterface(NULL);
-  }
-}
-
-void BitsRequest::OnBitsJobStateChanged() {
-  VERIFY1(::SetEvent(get(bits_job_status_changed_event_)));
-}
-
-HRESULT BitsRequest::Close() {
-  NET_LOG(L3, (_T("[BitsRequest::Close]")));
-  __mutexBlock(lock_) {
-    RemoveBitsCallback();
-
-    if (request_state_.get()) {
-      VERIFY1(SUCCEEDED(CancelBitsJob(request_state_->bits_job)));
-    }
-    request_state_.reset();
-  }
-  return S_OK;
-}
-
-HRESULT BitsRequest::Cancel() {
-  NET_LOG(L3, (_T("[BitsRequest::Cancel]")));
-  __mutexBlock(lock_) {
-    RemoveBitsCallback();
-
-    is_canceled_ = true;
-    if (request_state_.get()) {
-      VERIFY1(SUCCEEDED(CancelBitsJob(request_state_->bits_job)));
-    }
-  }
-
-  OnBitsJobStateChanged();
-  return S_OK;
-}
-
-HRESULT BitsRequest::Pause() {
-  NET_LOG(L3, (_T("[BitsRequest::Pause]")));
-  __mutexBlock(lock_) {
-    if (request_state_.get()) {
-      VERIFY1(SUCCEEDED(PauseBitsJob(request_state_->bits_job)));
-    }
-  }
-  return S_OK;
-}
-
-HRESULT BitsRequest::Resume() {
-  NET_LOG(L3, (_T("[BitsRequest::Resume]")));
-  __mutexBlock(lock_) {
-    if (request_state_.get()) {
-      VERIFY1(SUCCEEDED(ResumeBitsJob(request_state_->bits_job)));
-    }
-  }
-  return S_OK;
-}
-
-HRESULT BitsRequest::Send() {
-  NET_LOG(L3, (_T("[BitsRequest::Send][%s]"), url_));
-
-  ASSERT1(!url_.IsEmpty());
-
-  __mutexBlock(lock_) {
-    if (request_state_.get()) {
-      VERIFY1(SUCCEEDED(CancelBitsJob(request_state_->bits_job)));
-    }
-    request_state_.reset(new TransientRequestState);
-  }
-
-  bool is_created = false;
-  HRESULT hr = BitsRequest::CreateOrOpenJob(filename_,
-                                            &request_state_->bits_job,
-                                            &is_created);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // The job id is used for logging purposes only.
-  request_state_->bits_job->GetId(&request_state_->bits_job_id);
-
-  NET_LOG(L3, (_T("[BITS job %s]"), GuidToString(request_state_->bits_job_id)));
-
-  if (is_created) {
-    hr = SetInvariantJobProperties();
-    if (FAILED(hr)) {
-      HRESULT hr_cancel_bits_job(CancelBitsJob(request_state_->bits_job));
-      if (FAILED(hr_cancel_bits_job)) {
-        NET_LOG(LW, (_T("[CancelBitsJob failed][0x%08x]"), hr_cancel_bits_job));
-      }
-      request_state_->bits_job = NULL;
-      return hr;
-    }
-  }
-
-  return DoSend();
-}
-
-HRESULT BitsRequest::QueryHeadersString(uint32, const TCHAR*, CString*) const {
-  return E_NOTIMPL;
-}
-
-CString BitsRequest::GetResponseHeaders() const {
-  return CString();
-}
-
-
-HRESULT BitsRequest::CreateOrOpenJob(const TCHAR* display_name,
-                                     IBackgroundCopyJob** bits_job,
-                                     bool* is_created) {
-  ASSERT1(display_name);
-  ASSERT1(bits_job);
-  ASSERT1(*bits_job == NULL);
-  ASSERT1(is_created);
-
-  CComPtr<IBackgroundCopyManager> bits_manager;
-  HRESULT hr = GetBitsManager(&bits_manager);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Try to find if we already have the job in the BITS queue.
-  // By convention, the display name of the job is the same as the file name.
-  CComPtr<IBackgroundCopyJob> job;
-  hr = FindBitsJobIf(std::bind2nd(JobDisplayNameEqual(), display_name),
-                     bits_manager,
-                     &job);
-  if (SUCCEEDED(hr)) {
-    NET_LOG(L3, (_T("[found BITS job][%s]"), display_name));
-    *bits_job = job.Detach();
-    *is_created = false;
-    return S_OK;
-  }
-
-  GUID guid = {0};
-  hr = bits_manager->CreateJob(display_name, BG_JOB_TYPE_DOWNLOAD, &guid, &job);
-  if (SUCCEEDED(hr)) {
-    *bits_job = job.Detach();
-    *is_created = true;
-    return S_OK;
-  }
-
-  *bits_job = NULL;
-  return hr;
-}
-
-HRESULT BitsRequest::SetInvariantJobProperties() {
-  ASSERT1(request_state_.get());
-  ASSERT1(request_state_->bits_job);
-  HRESULT hr = request_state_->bits_job->AddFile(url_, filename_);
-  if (FAILED(hr)) {
-    NET_LOG(LE, (_T("[IBackgroundCopyJob::AddFile failed][0x%08x]"), hr));
-    return hr;
-  }
-  hr = request_state_->bits_job->SetDescription(kJobDescription);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT BitsRequest::SetJobProperties() {
-  ASSERT1(request_state_.get());
-  ASSERT1(request_state_->bits_job);
-  BG_JOB_PRIORITY priority = low_priority_ ? BG_JOB_PRIORITY_NORMAL :
-                                             BG_JOB_PRIORITY_FOREGROUND;
-  HRESULT hr = request_state_->bits_job->SetPriority(priority);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  if (minimum_retry_delay_ != -1) {
-    ASSERT1(minimum_retry_delay_ >= 0);
-    hr = request_state_->bits_job->SetMinimumRetryDelay(minimum_retry_delay_);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  // Always set no_progress_timeout to 0 for foreground jobs which means the
-  // jobs in transient error state will be immediately moved to error state.
-  int no_progress_timeout = low_priority_ ? no_progress_timeout_ : 0;
-
-  if (no_progress_timeout != -1) {
-    ASSERT1(no_progress_timeout >= 0);
-    hr = request_state_->bits_job->SetNoProgressTimeout(no_progress_timeout);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  SetJobCustomHeaders();
-  return S_OK;
-}
-
-HRESULT BitsRequest::SetJobCustomHeaders() {
-  NET_LOG(L3, (_T("[BitsRequest::SetJobCustomHeaders][%s]"),
-               additional_headers_));
-  ASSERT1(request_state_.get());
-  ASSERT1(request_state_->bits_job);
-
-  if (additional_headers_.IsEmpty()) {
-    return S_OK;
-  }
-
-  CComPtr<IBackgroundCopyJobHttpOptions> http_options;
-  HRESULT hr = request_state_->bits_job->QueryInterface(&http_options);
-  if (FAILED(hr)) {
-    NET_LOG(LW, (_T("[QI IBackgroundCopyJobHttpOptions failed][0x%x]"), hr));
-    return hr;
-  }
-
-  hr = http_options->SetCustomHeaders(additional_headers_);
-  if (FAILED(hr)) {
-    NET_LOG(LE, (_T("[SetCustomHeaders failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT BitsRequest::DetectManualProxy() {
-  if (NetworkConfig::GetAccessType(proxy_config_) !=
-      WINHTTP_ACCESS_TYPE_AUTO_DETECT) {
-    return S_OK;
-  }
-
-  NetworkConfig* network_config = NULL;
-  NetworkConfigManager& network_manager = NetworkConfigManager::Instance();
-  HRESULT hr = network_manager.GetUserNetworkConfig(&network_config);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  HttpClient::ProxyInfo proxy_info = {0};
-  hr = network_config->GetProxyForUrl(url_,
-                                      proxy_config_.auto_config_url,
-                                      &proxy_info);
-  if (SUCCEEDED(hr) &&
-      proxy_info.access_type == WINHTTP_ACCESS_TYPE_NAMED_PROXY) {
-    proxy_config_.auto_detect = false;
-    proxy_config_.auto_config_url.Empty();
-    proxy_config_.proxy = proxy_info.proxy;
-    proxy_config_.proxy_bypass = proxy_info.proxy_bypass;
-  }
-
-  ::GlobalFree(const_cast<wchar_t*>(proxy_info.proxy));
-  ::GlobalFree(const_cast<wchar_t*>(proxy_info.proxy_bypass));
-
-  NET_LOG(L3, (_T("[GetProxyForUrl returned][0x%08x]"), hr));
-  return hr;
-}
-
-HRESULT BitsRequest::SetJobProxyUsage() {
-  ASSERT1(request_state_.get());
-  ASSERT1(request_state_->bits_job);
-  BG_JOB_PROXY_USAGE proxy_usage = BG_JOB_PROXY_USAGE_NO_PROXY;
-  const TCHAR* proxy = NULL;
-  const TCHAR* proxy_bypass = NULL;
-
-  DetectManualProxy();
-
-  int access_type = NetworkConfig::GetAccessType(proxy_config_);
-  if (access_type == WINHTTP_ACCESS_TYPE_AUTO_DETECT) {
-    proxy_usage = BG_JOB_PROXY_USAGE_AUTODETECT;
-  } else if (access_type == WINHTTP_ACCESS_TYPE_NAMED_PROXY) {
-    proxy_usage = BG_JOB_PROXY_USAGE_OVERRIDE;
-    proxy = proxy_config_.proxy;
-    proxy_bypass = proxy_config_.proxy_bypass;
-  }
-  HRESULT hr = request_state_->bits_job->SetProxySettings(proxy_usage,
-                                                          proxy,
-                                                          proxy_bypass);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  if (proxy_usage == BG_JOB_PROXY_USAGE_AUTODETECT ||
-      proxy_usage == BG_JOB_PROXY_USAGE_OVERRIDE) {
-    // Set implicit credentials if we are going through a proxy, just in case
-    // the proxy is requiring authentication. Continue on errors, maybe
-    // the credentials won't be needed anyway. There will be one more chance
-    // to set credentials when the proxy challenges and the job errors out.
-    creds_set_scheme_unknown_ = false;
-    hr = SetProxyAuthImplicitCredentials(request_state_->bits_job,
-                                         BG_AUTH_SCHEME_NEGOTIATE);
-    if (SUCCEEDED(hr)) {
-      current_auth_scheme_ = BG_AUTH_SCHEME_NEGOTIATE;
-    } else {
-      OPT_LOG(LW, (_T("[failed to set BITS proxy credentials][0x%08x]"), hr));
-    }
-  }
-  return S_OK;
-}
-
-HRESULT BitsRequest::DoSend() {
-  ASSERT1(request_state_.get());
-  ASSERT1(request_state_->bits_job);
-
-  NET_LOG(L3, (_T("[BitsRequest::DoSend]")));
-
-  if (is_canceled_) {
-    return GOOPDATE_E_CANCELLED;
-  }
-
-  HRESULT hr = SetJobProperties();
-  if (FAILED(hr)) {
-    return hr;
-  }
-  hr = SetJobProxyUsage();
-  if (FAILED(hr)) {
-    return hr;
-  }
-  hr = SetupBitsCallback();
-  if (FAILED(hr)) {
-    return hr;
-  }
-  hr = request_state_->bits_job->Resume();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  NET_LOG(L3, (_T("[job priority %d]"),
-               GetJobPriority(request_state_->bits_job)));
-
-  // Poll for state changes. The code executing on the state changes must be
-  // idempotent, as the same state can be seen multiple times when looping.
-  // There is only one important case, which is retrying the job when the
-  // job is in the ERROR state. We attempt to handle the error, for
-  // example retrying one more time or changing proxy credentials, and then
-  // we resume the job. There is an assumption, so far true, that calling
-  // Resume on a job, the state changes right away from SUSPENDED to QUEUED.
-
-  for (;;) {
-    if (is_canceled_) {
-      return GOOPDATE_E_CANCELLED;
-    }
-
-    BG_JOB_STATE job_state = BG_JOB_STATE_ERROR;
-    hr = request_state_->bits_job->GetState(&job_state);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    NET_LOG(L3, (_T("[job %s][state %s]"),
-                 GuidToString(request_state_->bits_job_id),
-                 JobStateToString(job_state)));
-
-    switch (job_state) {
-      case BG_JOB_STATE_QUEUED:
-        break;
-
-      case BG_JOB_STATE_CONNECTING:
-        if (callback_) {
-          callback_->OnProgress(0,
-                                0,
-                                WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER,
-                                NULL);
-        }
-        break;
-
-      case BG_JOB_STATE_TRANSFERRING:
-        OnStateTransferring();
-        break;
-
-      case BG_JOB_STATE_TRANSIENT_ERROR:
-        break;
-
-      case BG_JOB_STATE_ERROR:
-        hr = OnStateError();
-        if (SUCCEEDED(hr)) {
-          // The error handler dealt with the error. Countinue the loop.
-          break;
-        }
-
-        // Give up.
-        return request_state_->http_status_code ? S_OK : hr;
-
-      case BG_JOB_STATE_TRANSFERRED:
-        NotifyProgress();
-        hr = request_state_->bits_job->Complete();
-        if (SUCCEEDED(hr) || BG_S_UNABLE_TO_DELETE_FILES == hr) {
-          // Assume the status code is 200 if the transfer completed. BITS does
-          // not provide access to the status code.
-          request_state_->http_status_code = HTTP_STATUS_OK;
-
-          if (creds_set_scheme_unknown_) {
-            // Bits job completed successfully. If we have a valid username, we
-            // record the auth scheme with the NetworkConfig, so it can be used
-            // in the future within this process.
-            uint32 win_http_scheme =
-                BitsToWinhttpProxyAuthScheme(current_auth_scheme_);
-            ASSERT1(win_http_scheme != UNKNOWN_AUTH_SCHEME);
-            bool is_https = String_StartsWith(url_, kHttpsProtoScheme, true);
-
-            NetworkConfig* network_config = NULL;
-            NetworkConfigManager& nm = NetworkConfigManager::Instance();
-            HRESULT hr = nm.GetUserNetworkConfig(&network_config);
-            if (FAILED(hr)) {
-              return hr;
-            }
-
-            VERIFY1(SUCCEEDED(network_config->SetProxyAuthScheme(
-                proxy_config_.proxy, is_https, win_http_scheme)));
-          }
-
-          return S_OK;
-        } else {
-          return hr;
-        }
-
-      case BG_JOB_STATE_SUSPENDED:
-        break;
-
-      case BG_JOB_STATE_ACKNOWLEDGED:
-        ASSERT1(false);
-        return S_OK;
-
-      case BG_JOB_STATE_CANCELLED:
-        return GOOPDATE_E_CANCELLED;
-    };
-
-    DWORD wait_result = ::WaitForSingleObject(
-        get(bits_job_status_changed_event_), kPollingIntervalMs);
-    if (wait_result == WAIT_FAILED) {
-      ::Sleep(kPollingIntervalMs);
-    }
-  }
-}
-
-HRESULT BitsRequest::OnStateTransferring() {
-  // BITS could call JobModification very often during transfer so we
-  // do report meter here to avoid too many progress notifications.
-  uint32 now = GetTickCount();
-
-  if (now >= last_progress_report_tick_ &&
-      now - last_progress_report_tick_ < kJobProgressReportMinimumIntervalMs) {
-    return S_OK;
-  }
-
-  last_progress_report_tick_ = now;
-  return NotifyProgress();
-}
-
-HRESULT BitsRequest::OnStateError() {
-  CComPtr<IBackgroundCopyError> error;
-  HRESULT hr = request_state_->bits_job->GetError(&error);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  BG_ERROR_CONTEXT error_context = BG_ERROR_CONTEXT_NONE;
-  HRESULT error_code = E_FAIL;
-  hr = error->GetError(&error_context, &error_code);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  ASSERT1(FAILED(error_code));
-
-  NET_LOG(L3, (_T("[handle bits error][0x%08x]"), error_code));
-
-  request_state_->http_status_code = GetHttpStatusFromBitsError(error_code);
-
-  if (error_code == BG_E_HTTP_ERROR_407) {
-    hr = creds_set_scheme_unknown_ ? HandleProxyAuthenticationErrorCredsSet() :
-                                     HandleProxyAuthenticationError();
-    if (SUCCEEDED(hr)) {
-      return S_OK;
-    }
-  }
-
-  // We could not handle this error. The control will return to the caller.
-  return error_code;
-}
-
-HRESULT BitsRequest::NotifyProgress() {
-  if (!callback_) {
-    return S_OK;
-  }
-  BG_JOB_PROGRESS progress = {0};
-  HRESULT hr = request_state_->bits_job->GetProgress(&progress);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  ASSERT1(progress.FilesTotal == 1);
-  ASSERT1(progress.BytesTransferred <= INT_MAX);
-  ASSERT1(progress.BytesTotal <= INT_MAX);
-  callback_->OnProgress(static_cast<int>(progress.BytesTransferred),
-                        static_cast<int>(progress.BytesTotal),
-                        WINHTTP_CALLBACK_STATUS_READ_COMPLETE,
-                        NULL);
-  return S_OK;
-}
-
-HRESULT BitsRequest::GetProxyCredentials() {
-  CString username;
-  CString password;
-  uint32 auth_scheme = UNKNOWN_AUTH_SCHEME;
-  bool is_https = String_StartsWith(url_, kHttpsProtoScheme, true);
-
-  NetworkConfig* network_config = NULL;
-  NetworkConfigManager& network_manager = NetworkConfigManager::Instance();
-  HRESULT hr = network_manager.GetUserNetworkConfig(&network_config);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (!network_config->GetProxyCredentials(true, false,
-          proxy_config_.proxy, proxy_auth_config_, is_https, &username,
-          &password, &auth_scheme)) {
-    OPT_LOG(LE, (_T("[BitsRequest::GetProxyCredentials failed]")));
-    return E_ACCESSDENIED;
-  }
-
-  if (auth_scheme != UNKNOWN_AUTH_SCHEME) {
-    current_auth_scheme_ = WinHttpToBitsProxyAuthScheme(auth_scheme);
-    OPT_LOG(L3, (_T("[BitsRequest::GetProxyCredentials][%s]"),
-                 BitsAuthSchemeToString(current_auth_scheme_)));
-    return SetProxyAuthCredentials(request_state_->bits_job,
-               CStrBuf(username), CStrBuf(password),
-               static_cast<BG_AUTH_SCHEME>(current_auth_scheme_));
-  }
-
-  OPT_LOG(L3, (_T("[BitsRequest::GetProxyCredentials][Auth scheme unknown]")));
-  // We do not know the scheme beforehand. So we set credentials on all the
-  // schemes except BASIC and try them out in seqence. We could have used BASIC
-  // as well, however, we do not want to leak passwords by mistake.
-  for (int scheme = BG_AUTH_SCHEME_DIGEST; scheme <= BG_AUTH_SCHEME_NEGOTIATE;
-       ++scheme) {
-    hr = SetProxyAuthCredentials(request_state_->bits_job,
-                                 CStrBuf(username), CStrBuf(password),
-                                 static_cast<BG_AUTH_SCHEME>(scheme));
-    if (FAILED(hr)) {
-      OPT_LOG(LE, (_T("[BitsRequest::GetProxyCredentials][0x%08x][%s]"),
-                   hr, BitsAuthSchemeToString(scheme)));
-      return hr;
-    }
-  }
-
-  current_auth_scheme_ = BG_AUTH_SCHEME_NEGOTIATE;
-  creds_set_scheme_unknown_ = true;
-  return S_OK;
-}
-
-HRESULT BitsRequest::HandleProxyAuthenticationError() {
-  ASSERT1(!creds_set_scheme_unknown_);
-  HRESULT hr = E_ACCESSDENIED;
-
-  if (current_auth_scheme_ == 0) {
-    current_auth_scheme_ = BG_AUTH_SCHEME_NEGOTIATE;
-    hr = SetProxyAuthImplicitCredentials(request_state_->bits_job,
-                                         BG_AUTH_SCHEME_NEGOTIATE);
-  } else if (current_auth_scheme_ == BG_AUTH_SCHEME_NEGOTIATE) {
-    current_auth_scheme_ = BG_AUTH_SCHEME_NTLM;
-    hr = SetProxyAuthImplicitCredentials(request_state_->bits_job,
-                                         BG_AUTH_SCHEME_NTLM);
-  } else {
-    hr = GetProxyCredentials();
-  }
-
-  OPT_LOG(L3, (_T("[BitsRequest::HandleProxyAuthenticationError][0x%08x][%s]"),
-               hr, BitsAuthSchemeToString(current_auth_scheme_)));
-  return SUCCEEDED(hr) ? request_state_->bits_job->Resume() : hr;
-}
-
-HRESULT BitsRequest::HandleProxyAuthenticationErrorCredsSet() {
-  ASSERT1(creds_set_scheme_unknown_);
-
-  if (current_auth_scheme_ == BG_AUTH_SCHEME_NEGOTIATE) {
-    current_auth_scheme_ = BG_AUTH_SCHEME_NTLM;
-  } else if (current_auth_scheme_ == BG_AUTH_SCHEME_NTLM) {
-    current_auth_scheme_ = BG_AUTH_SCHEME_DIGEST;
-  } else {
-    OPT_LOG(LE, (_T("[HandleProxyAuthenticationErrorCredsSet][Failure]")));
-    return E_ACCESSDENIED;
-  }
-
-  OPT_LOG(L3, (_T("[BitsRequest::HandleProxyAuthenticationErrorCredsSet][%s]"),
-               BitsAuthSchemeToString(current_auth_scheme_)));
-  return request_state_->bits_job->Resume();
-}
-
-int BitsRequest::WinHttpToBitsProxyAuthScheme(uint32 winhttp_scheme) {
-  if (winhttp_scheme == WINHTTP_AUTH_SCHEME_NEGOTIATE) {
-    return BG_AUTH_SCHEME_NEGOTIATE;
-  }
-  if (winhttp_scheme == WINHTTP_AUTH_SCHEME_NTLM) {
-    return BG_AUTH_SCHEME_NTLM;
-  }
-  if (winhttp_scheme == WINHTTP_AUTH_SCHEME_DIGEST) {
-    return BG_AUTH_SCHEME_DIGEST;
-  }
-  if (winhttp_scheme == WINHTTP_AUTH_SCHEME_BASIC) {
-    return BG_AUTH_SCHEME_BASIC;
-  }
-
-  ASSERT1(false);
-  return UNKNOWN_AUTH_SCHEME;
-}
-
-uint32 BitsRequest::BitsToWinhttpProxyAuthScheme(int bits_scheme) {
-  if (bits_scheme == BG_AUTH_SCHEME_NEGOTIATE) {
-    return WINHTTP_AUTH_SCHEME_NEGOTIATE;
-  }
-  if (bits_scheme == BG_AUTH_SCHEME_NTLM) {
-    return WINHTTP_AUTH_SCHEME_NTLM;
-  }
-  if (bits_scheme == BG_AUTH_SCHEME_DIGEST) {
-    return WINHTTP_AUTH_SCHEME_DIGEST;
-  }
-  if (bits_scheme == BG_AUTH_SCHEME_BASIC) {
-    return WINHTTP_AUTH_SCHEME_BASIC;
-  }
-
-  ASSERT1(false);
-  return UNKNOWN_AUTH_SCHEME;
-}
-
-}   // namespace omaha
-
diff --git a/net/bits_request.h b/net/bits_request.h
deleted file mode 100644
index aa1aa91..0000000
--- a/net/bits_request.h
+++ /dev/null
@@ -1,262 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// BitsRequest provides http transactions using BITS, with an optional
-// number of retries using a specified network configuration.
-//
-// BITS is sending the following string as user agent:
-//    User-Agent: Microsoft BITS/6.6
-// where the version seems to be the version of %windir%\System32\QMgr.dll.
-//
-// TODO(omaha): the class interface is not stable yet, as a few more
-// getters and setters are still needed.
-
-#ifndef OMAHA_NET_BITS_REQUEST_H__
-#define OMAHA_NET_BITS_REQUEST_H__
-
-#include <windows.h>
-#include <bits.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/utils.h"
-#include "omaha/net/http_request.h"
-
-namespace omaha {
-
-class BitsJobCallback;
-
-class BitsRequest : public HttpRequestInterface {
- public:
-  BitsRequest();
-  virtual ~BitsRequest();
-
-  virtual HRESULT Close();
-
-  virtual HRESULT Send();
-
-  virtual HRESULT Cancel();
-
-  virtual HRESULT Pause();
-
-  virtual HRESULT Resume();
-
-  virtual std::vector<uint8> GetResponse() const {
-    return std::vector<uint8>();
-  }
-
-  // TODO(omaha): BITS provides access to headers on Windows Vista.
-  virtual HRESULT QueryHeadersString(uint32 info_level,
-                                     const TCHAR* name,
-                                     CString* value) const;
-  virtual CString GetResponseHeaders() const;
-
-  // Returns the http status code in case of errors or 200 when the file is
-  // successfully transferred. BITS does not provide access to the status code
-  // directly; in some conditions the status code can be deduced from the error.
-  virtual int GetHttpStatusCode() const {
-    return request_state_.get() ? request_state_->http_status_code : 0;
-  }
-
-  virtual CString ToString() const { return _T("BITS"); }
-
-  virtual void set_session_handle(HINTERNET session_handle) {
-    session_handle_ = session_handle;
-  }
-
-  virtual void set_url(const CString& url) { url_ = url; }
-
-  virtual void set_request_buffer(const void* buffer, size_t buffer_length) {
-    request_buffer_ = buffer;
-    request_buffer_length_ = buffer_length;
-  }
-
-  virtual void set_proxy_configuration(const ProxyConfig& proxy_config) {
-    proxy_config_ = proxy_config;
-  }
-
-  // Sets the filename to receive the response instead of the memory buffer.
-  virtual void set_filename(const CString& filename) { filename_ = filename; }
-
-  virtual void set_low_priority(bool low_priority) {
-    low_priority_ = low_priority;
-  }
-
-  virtual void set_callback(NetworkRequestCallback* callback) {
-    callback_ = callback;
-  }
-
-  virtual void set_additional_headers(const CString& additional_headers) {
-    additional_headers_ = additional_headers;
-  }
-
-  // This request always uses the specified protocol so it is fine to ignore
-  // this attribute.
-  virtual void set_preserve_protocol(bool preserve_protocol) {
-    UNREFERENCED_PARAMETER(preserve_protocol);
-  }
-
-  virtual CString user_agent() const { return user_agent_; }
-
-  virtual void set_user_agent(const CString& user_agent) {
-    user_agent_ = user_agent;
-  }
-
-  virtual void set_proxy_auth_config(const ProxyAuthConfig& proxy_auth_config) {
-    proxy_auth_config_ = proxy_auth_config;
-  }
-
-  // Sets the minimum length of time that BITS waits after encountering a
-  // transient error condition before trying to transfer the file.
-  // The default value is 600 seconds.
-  void set_minimum_retry_delay(int minimum_retry_delay) {
-    minimum_retry_delay_ = minimum_retry_delay;
-  }
-
-  // Sets the length of time that BITS tries to transfer the file after a
-  // transient error condition occurs. If BITS does not make progress during
-  // the retry period, it moves the state of the job from transient error
-  // to the error state. The default value is 14 days.
-  void set_no_progress_timeout(int no_progress_timeout) {
-    no_progress_timeout_ = no_progress_timeout;
-  }
-
-  // Handles that BITS job state has changed.
-  void OnBitsJobStateChanged();
-
- private:
-  // Sets invariant job properties, such as the filename and the description.
-  // These parameters can't change over the job life time.
-  HRESULT SetInvariantJobProperties();
-
-  // Sets non-invariant job properties.
-  HRESULT SetJobProperties();
-
-  // Sets additional_headers_ on the Job if IBackgroundCopyJobHttpOptions is
-  // supported.
-  HRESULT SetJobCustomHeaders();
-
-  // Uses the SimpleRequest HttpClient to detect the proxy for the current
-  // request.
-  HRESULT DetectManualProxy();
-
-  // Specifies how a job connects to the Internet.
-  HRESULT SetJobProxyUsage();
-
-  // Runs a polling loop waiting for the job to transition in one of its
-  // final states.
-  HRESULT DoSend();
-
-  // Handles the BG_JOB_STATE_ERROR. It returns S_OK when the error has
-  // been handled, otherwise, it returns the job error code and it makes the
-  // control return to the caller of Send.
-  HRESULT OnStateError();
-
-  // Handles the BG_JOB_STATE_TRANSFERRING.
-  HRESULT OnStateTransferring();
-
-  // Gets username and password through NetworkConfig. If successful, sets the
-  // credentials on the BITS job.
-  HRESULT GetProxyCredentials();
-
-  // Handles 407 errors. Tries autologon schemes.
-  HRESULT HandleProxyAuthenticationError();
-
-  // Handles 407 errors by cycling through the auth schemes, when credentials
-  // are already set on the BITS job.
-  HRESULT HandleProxyAuthenticationErrorCredsSet();
-
-  // Calls back with progress information if available.
-  HRESULT NotifyProgress();
-
-  int WinHttpToBitsProxyAuthScheme(uint32 winhttp_scheme);
-  uint32 BitsToWinhttpProxyAuthScheme(int bits_scheme);
-
-  // Sets up BITS callback so BITS can send job status changes to this class.
-  HRESULT SetupBitsCallback();
-
-  // Stops BITS callback to send further job change notifications to this class.
-  // It is important to do this before the object goes out of scope since BITS
-  // callback needs to reference this object.
-  void RemoveBitsCallback();
-
-  // Creates or opens an existing job.
-  // 'is_created' is true if the job has been created or false if the job
-  // has been opened.
-  static HRESULT CreateOrOpenJob(const TCHAR* display_name,
-                                 IBackgroundCopyJob** bits_job,
-                                 bool* is_created);
-
-  // Returns major.minor.0.0 BITS version.
-  static ULONGLONG GetBitsVersion();
-
-  // Holds the transient state corresponding to a BITS request.
-  struct TransientRequestState {
-    TransientRequestState() : http_status_code(0) {
-      SetZero(bits_job_id);
-    }
-
-    int http_status_code;
-    CComPtr<IBackgroundCopyJob> bits_job;
-    GUID bits_job_id;
-  };
-
-  LLock lock_;
-  CString url_;
-  CString filename_;
-  const void* request_buffer_;          // Contains the request body for POST.
-  size_t      request_buffer_length_;   // Length of the request body.
-  CString additional_headers_;
-  CString user_agent_;
-  ProxyAuthConfig proxy_auth_config_;
-  ProxyConfig proxy_config_;
-  bool low_priority_;
-  bool is_canceled_;
-  HINTERNET session_handle_;  // Not owned by this class.
-  NetworkRequestCallback* callback_;
-  int minimum_retry_delay_;
-  int no_progress_timeout_;
-  int current_auth_scheme_;
-
-  // For manual proxy authentication, if we do not know the auth scheme that the
-  // proxy is using, we set the username/password on all the schemes and try
-  // them out in sequence.
-  bool creds_set_scheme_unknown_;
-
-  // Event that is set when the BITS job state is changed.
-  scoped_event bits_job_status_changed_event_;
-
-  BitsJobCallback*  bits_request_callback_;
-  uint32 last_progress_report_tick_;
-
-  scoped_ptr<TransientRequestState> request_state_;
-
-  // See http://b/1189928
-  CComPtr<IBackgroundCopyManager> bits_manager_;
-
-  // BITS could call JobModification() callback very often during job transfer.
-  // This minumum interval is to prevent reporting job progress too often to
-  // BitsRequest.
-  static const int kJobProgressReportMinimumIntervalMs = 200;
-
-  DISALLOW_EVIL_CONSTRUCTORS(BitsRequest);
-};
-
-}   // namespace omaha
-
-#endif  // OMAHA_NET_BITS_REQUEST_H__
-
-
diff --git a/net/bits_request_unittest.cc b/net/bits_request_unittest.cc
deleted file mode 100644
index 764809c..0000000
--- a/net/bits_request_unittest.cc
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-#include <winhttp.h>
-#include "omaha/base/app_util.h"
-#include "omaha/net/bits_request.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-// Moves the job to error state if no progress at all is made for 10 seconds.
-TEST(BitsRequestTest, Send) {
-  if (IsTestRunByLocalSystem()) {
-    return;
-  }
-
-  BitsRequest bits_request;
-  bits_request.set_no_progress_timeout(10);   // 10 seconds.
-  CString temp_dir = app_util::GetTempDir();
-  CString temp_file;
-  EXPECT_TRUE(::GetTempFileName(temp_dir, _T("tmp"), 0,
-                                CStrBuf(temp_file, MAX_PATH)));
-  bits_request.set_filename(temp_file);
-  bits_request.set_url(_T("http://dl.google.com/update2/UpdateData.bin"));
-  EXPECT_HRESULT_SUCCEEDED(bits_request.Send());
-  EXPECT_EQ(HTTP_STATUS_OK, bits_request.GetHttpStatusCode());
-
-  bits_request.set_low_priority(true);
-  EXPECT_HRESULT_SUCCEEDED(bits_request.Send());
-  EXPECT_EQ(HTTP_STATUS_OK, bits_request.GetHttpStatusCode());
-}
-
-}   // namespace omaha
-
diff --git a/net/bits_utils.cc b/net/bits_utils.cc
deleted file mode 100644
index 37a4ed9..0000000
--- a/net/bits_utils.cc
+++ /dev/null
@@ -1,197 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/net/bits_utils.h"
-
-#include <windows.h>
-#include <winhttp.h>
-#include <cstring>
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/scoped_ptr_cotask.h"
-
-namespace omaha {
-
-// Gets the instance of BITS manager.
-HRESULT GetBitsManager(IBackgroundCopyManager** bits_manager) {
-  ASSERT1(bits_manager);
-  if (*bits_manager) {
-    (*bits_manager)->Release();
-  }
-  *bits_manager = NULL;
-
-  CComPtr<IBackgroundCopyManager> object;
-  HRESULT hr = object.CoCreateInstance(__uuidof(BackgroundCopyManager));
-  if (FAILED(hr)) {
-    OPT_LOG(LE, (_T("[failed to get BITS interface][0x%08x]"), hr));
-    const HRESULT kServiceDisabled(HRESULT_FROM_WIN32(ERROR_SERVICE_DISABLED));
-    return (hr == kServiceDisabled) ? CI_E_BITS_DISABLED : hr;
-  }
-  *bits_manager = object.Detach();
-  return S_OK;
-}
-
-bool JobLocalNameEqual::operator()(IBackgroundCopyJob* job,
-                                   const TCHAR* name) const {
-  ASSERT1(job);
-  ASSERT1(name);
-  CComPtr<IEnumBackgroundCopyFiles> files;
-  if (FAILED(job->EnumFiles(&files))) {
-    return false;
-  }
-  ULONG file_count = 0;
-  if (FAILED(files->GetCount(&file_count))) {
-    return false;
-  }
-  for (size_t i = 0; i != file_count; ++i) {
-    CComPtr<IBackgroundCopyFile> file;
-    if (files->Next(1, &file, NULL) == S_OK) {
-      scoped_ptr_cotask<TCHAR> local_name;
-      if (SUCCEEDED(file->GetLocalName(address(local_name)))) {
-        if (_tcscmp(local_name.get(), name) == 0) {
-          return true;
-        }
-      }
-    }
-  }
-  return false;
-}
-
-bool JobDisplayNameEqual::operator()(IBackgroundCopyJob* job,
-                                     const TCHAR* name) const {
-  ASSERT1(job);
-  ASSERT1(name);
-  scoped_ptr_cotask<TCHAR> display_name;
-  HRESULT hr = job->GetDisplayName(address(display_name));
-  if (SUCCEEDED(hr)) {
-    return _tcscmp(display_name.get(), name) == 0;
-  }
-  return false;
-}
-
-HRESULT SetProxyAuthImplicitCredentials(IBackgroundCopyJob* job,
-                                        BG_AUTH_SCHEME auth_scheme) {
-  return SetProxyAuthCredentials(job, NULL, NULL, auth_scheme);
-}
-
-HRESULT SetProxyAuthCredentials(IBackgroundCopyJob* job,
-                                TCHAR* username,
-                                TCHAR* password,
-                                BG_AUTH_SCHEME auth_scheme) {
-  ASSERT1(job);
-  CComQIPtr<IBackgroundCopyJob2> job2(job);
-  if (!job2) {
-    return E_NOINTERFACE;
-  }
-  BG_AUTH_CREDENTIALS auth_cred;
-  SetZero(auth_cred);
-  auth_cred.Target = BG_AUTH_TARGET_PROXY;
-  auth_cred.Scheme = auth_scheme;
-  auth_cred.Credentials.Basic.UserName = username;
-  auth_cred.Credentials.Basic.Password = password;
-  return job2->SetCredentials(&auth_cred);
-}
-
-int GetHttpStatusFromBitsError(HRESULT error) {
-  // Bits errors are defined in bitsmsg.h. Although not documented, it is
-  // clear that all errors corresponding to http status code have the high
-  // word equal to 0x8019.
-  bool is_valid = HIWORD(error) == 0x8019 &&
-                  LOWORD(error) >= HTTP_STATUS_FIRST &&
-                  LOWORD(error) <= HTTP_STATUS_LAST;
-  return is_valid ? LOWORD(error) : 0;
-}
-
-HRESULT CancelBitsJob(IBackgroundCopyJob* job) {
-  if (job) {
-    BG_JOB_STATE job_state = BG_JOB_STATE_ERROR;
-    HRESULT hr = job->GetState(&job_state);
-    if (SUCCEEDED(hr) &&
-        job_state != BG_JOB_STATE_CANCELLED &&
-        job_state != BG_JOB_STATE_ACKNOWLEDGED) {
-      HRESULT hr = job->Cancel();
-      if (FAILED(hr)) {
-        NET_LOG(LW, (_T("[CancelBitsJob failed][0x%08x]"), hr));
-      }
-      return hr;
-    }
-  }
-  return S_OK;
-}
-
-HRESULT PauseBitsJob(IBackgroundCopyJob* job) {
-  if (job) {
-    BG_JOB_STATE job_state = BG_JOB_STATE_ERROR;
-    HRESULT hr = job->GetState(&job_state);
-    if (SUCCEEDED(hr) &&
-        job_state != BG_JOB_STATE_TRANSFERRED &&
-        job_state != BG_JOB_STATE_ACKNOWLEDGED &&
-        job_state != BG_JOB_STATE_CANCELLED) {
-      HRESULT hr = job->Suspend();
-      if (FAILED(hr)) {
-        NET_LOG(LW, (_T("[PauseBitsJob failed][0x%08x]"), hr));
-      }
-      return hr;
-    }
-  }
-  return S_OK;
-}
-
-HRESULT ResumeBitsJob(IBackgroundCopyJob* job) {
-  if (job) {
-    BG_JOB_STATE job_state = BG_JOB_STATE_ERROR;
-    HRESULT hr = job->GetState(&job_state);
-    if (SUCCEEDED(hr) && job_state == BG_JOB_STATE_SUSPENDED) {
-      HRESULT hr = job->Suspend();
-      if (FAILED(hr)) {
-        NET_LOG(LW, (_T("[ResumeBitsJob failed][0x%08x]"), hr));
-      }
-      return hr;
-    }
-  }
-  return S_OK;
-}
-
-#define RETURN_TSTR(x) case (x): return _T(#x)
-CString JobStateToString(BG_JOB_STATE job_state) {
-  switch (job_state) {
-    RETURN_TSTR(BG_JOB_STATE_QUEUED);
-    RETURN_TSTR(BG_JOB_STATE_CONNECTING);
-    RETURN_TSTR(BG_JOB_STATE_TRANSFERRING);
-    RETURN_TSTR(BG_JOB_STATE_TRANSIENT_ERROR);
-    RETURN_TSTR(BG_JOB_STATE_ERROR);
-    RETURN_TSTR(BG_JOB_STATE_TRANSFERRED);
-    RETURN_TSTR(BG_JOB_STATE_SUSPENDED);
-    RETURN_TSTR(BG_JOB_STATE_ACKNOWLEDGED);
-    RETURN_TSTR(BG_JOB_STATE_CANCELLED);
-  }
-  return _T("");
-}
-
-CString BitsAuthSchemeToString(int auth_scheme) {
-  switch (auth_scheme) {
-    RETURN_TSTR(BG_AUTH_SCHEME_NEGOTIATE);
-    RETURN_TSTR(BG_AUTH_SCHEME_NTLM);
-    RETURN_TSTR(BG_AUTH_SCHEME_DIGEST);
-    RETURN_TSTR(BG_AUTH_SCHEME_BASIC);
-    RETURN_TSTR(0);
-  }
-  return _T("");
-}
-
-}   // namespace omaha
-
diff --git a/net/bits_utils.h b/net/bits_utils.h
deleted file mode 100644
index 9a9318c..0000000
--- a/net/bits_utils.h
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_NET_BITS_UTILS_H__
-#define OMAHA_NET_BITS_UTILS_H__
-
-#include <windows.h>
-#include <bits.h>
-#include <atlbase.h>
-#include <atlstr.h>
-#include <functional>
-
-namespace omaha {
-
-// Gets the instance of BITS manager.
-HRESULT GetBitsManager(IBackgroundCopyManager** bits_manager);
-
-// Compares the local name of a job.
-struct JobLocalNameEqual
-    : public std::binary_function<IBackgroundCopyJob*, const TCHAR*, bool> {
-
-  bool operator()(IBackgroundCopyJob* job, const TCHAR* local_name) const;
-};
-
-// Compares the display name of a job.
-struct JobDisplayNameEqual
-    : public std::binary_function<IBackgroundCopyJob*, const TCHAR*, bool> {
-
-  bool operator()(IBackgroundCopyJob* job, const TCHAR* local_name) const;
-};
-
-// Finds a job that matches the given predicate.
-// TODO(omaha): do we need to search across all users?
-template<class Predicate>
-HRESULT FindBitsJobIf(Predicate pred,
-                      IBackgroundCopyManager* bits_manager,
-                      IBackgroundCopyJob** job) {
-  if (!bits_manager || !job || *job) {
-    return E_INVALIDARG;
-  }
-
-  // Enumerate the jobs that belong to the calling user.
-  CComPtr<IEnumBackgroundCopyJobs> jobs;
-  HRESULT hr = bits_manager->EnumJobs(0, &jobs);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  ULONG job_count = 0;
-  hr = jobs->GetCount(&job_count);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  for (size_t i = 0; i != job_count; ++i) {
-    CComPtr<IBackgroundCopyJob> current_job;
-    if (jobs->Next(1, &current_job, NULL) != S_OK) {
-      break;
-    }
-    if (pred(current_job)) {
-      *job = current_job.Detach();
-      return S_OK;
-    }
-  }
-  return E_FAIL;
-}
-
-// Sets using the implicit credentials to authenticate to proxy servers.
-HRESULT SetProxyAuthImplicitCredentials(IBackgroundCopyJob* job,
-                                        BG_AUTH_SCHEME auth_scheme);
-
-// Sets credentials to authenticate to proxy servers. username and password can
-// be NULL, in which case BITS will try connecting with implicit/autologon
-// credentials.
-HRESULT SetProxyAuthCredentials(IBackgroundCopyJob* job,
-                                TCHAR* username,
-                                TCHAR* password,
-                                BG_AUTH_SCHEME auth_scheme);
-
-// Returns an HTTP status code from the BITS error code.
-int GetHttpStatusFromBitsError(HRESULT error);
-
-// Cancels a job.
-HRESULT CancelBitsJob(IBackgroundCopyJob* job);
-
-HRESULT PauseBitsJob(IBackgroundCopyJob* job);
-
-HRESULT ResumeBitsJob(IBackgroundCopyJob* job);
-
-// Converts a job state to a string.
-CString JobStateToString(BG_JOB_STATE job_state);
-
-// Converts a BITS auth scheme to a string.
-CString BitsAuthSchemeToString(int auth_scheme);
-
-}   // namespace omaha
-
-#endif  // OMAHA_NET_BITS_UTILS_H__
-
diff --git a/net/bits_utils_unittest.cc b/net/bits_utils_unittest.cc
deleted file mode 100644
index 0cdc044..0000000
--- a/net/bits_utils_unittest.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-#include <winhttp.h>
-#include <atlbase.h>
-#include "omaha/net/bits_utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(BitsUtilsTest, GetBitsManager) {
-  CComPtr<IBackgroundCopyManager> bits_manager;
-  ASSERT_HRESULT_SUCCEEDED(GetBitsManager(&bits_manager));
-}
-
-TEST(BitsUtilsTest, GetHttpStatusFromBitsError) {
-  EXPECT_EQ(GetHttpStatusFromBitsError(BG_E_HTTP_ERROR_400),
-            HTTP_STATUS_BAD_REQUEST);
-  EXPECT_EQ(GetHttpStatusFromBitsError(BG_E_HTTP_ERROR_407),
-            HTTP_STATUS_PROXY_AUTH_REQ);
-  EXPECT_EQ(GetHttpStatusFromBitsError(BG_E_HTTP_ERROR_100),
-            HTTP_STATUS_CONTINUE);
-  EXPECT_EQ(GetHttpStatusFromBitsError(BG_E_HTTP_ERROR_505),
-            HTTP_STATUS_VERSION_NOT_SUP);
-
-  EXPECT_EQ(GetHttpStatusFromBitsError(-1), 0);
-  EXPECT_EQ(GetHttpStatusFromBitsError(0), 0);
-  EXPECT_EQ(GetHttpStatusFromBitsError(99), 0);
-  EXPECT_EQ(GetHttpStatusFromBitsError(506), 0);
-}
-
-}   // namespace omaha
-
diff --git a/net/browser_request.cc b/net/browser_request.cc
deleted file mode 100644
index d55eae6..0000000
--- a/net/browser_request.cc
+++ /dev/null
@@ -1,150 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Not used at the moment. The idea is to use an external process, such as
-// the web browser in cases where GoogleUpdate.exe is not able to connect
-// directly for some reason.
-//
-// TODO(Omaha) - Better algorithm for finding IBrowserHttpRequest2 objects:
-// We currently use shared memory. We have the high integrity process
-// read from shared memory that the low integrity process writes to. We assume
-// a common executable, IEXPLORE.exe, which is limiting, because in the future
-// we could be embedded in multiple processes.
-
-// Another choice for detection will be more efficient overall. But it will
-// entail some work: each IBrowserRequest will register itself with the ROT.
-// It does this through a medium-integrity GoogleUpdate.exe. The high integrity
-// process will then impersonate the explorer token, and then CoCreate
-// GoogleUpdate.exe at medium integrity. Then the medium integrity GoogleUpdate
-// can return an appropriate IBrowserRequest interface from the local ROT.
-//
-// This scheme is flexible enough that it can work regardless of which
-// process the IBrowserRequest object(s) reside in. We could have a Firefox
-// plugin, a Chrome-resident object, an object residing inside Google Talk, etc.
-
-#include "omaha/net/browser_request.h"
-#include <atlbase.h>
-#include <atlcom.h>
-#include "omaha/base/logging.h"
-#include "omaha/base/system.h"
-#include "omaha/base/vista_utils.h"
-#include "omaha/goopdate/google_update_proxy.h"
-
-namespace omaha {
-
-BrowserRequest::BrowserRequest() {
-  NET_LOG(L3, (_T("[BrowserRequest::BrowserRequest]")));
-  user_agent_.Format(_T("%s;iexplore"), NetworkConfig::GetUserAgent());
-
-#if 0
-  if (!GetAvailableBrowserObjects()) {
-    NET_LOG(LW, (_T("[BrowserRequest: No Browser Objects Found.]")));
-  }
-#endif
-}
-
-bool BrowserRequest::GetAvailableBrowserObjects() {
-  std::vector<uint32> pids;
-  HRESULT hr = vista::GetProcessPidsForActiveUserOrSession(kIExplore, &pids);
-  if (FAILED(hr)) {
-    NET_LOG(LE, (_T("[GetProcessPidsForActiveUserOrSession fail][0x%x]"), hr));
-    return false;
-  }
-
-  bool is_system = false;
-  hr = IsSystemProcess(&is_system);
-  if (FAILED(hr)) {
-    NET_LOG(LE, (_T("[IsSystemProcess failed][0x%x]"), hr));
-    return false;
-  }
-
-  CString shared_memory_prefix;
-  DWORD active_session = System::GetActiveSessionId();
-  if (is_system && active_session != System::GetCurrentSessionId()) {
-    // The Session\\ syntax references a local object in a different session.
-    shared_memory_prefix.Format(_T("Session\\%d\\"), active_session);
-  }
-  shared_memory_prefix += kBrowserHttpRequestShareName;
-
-  std::vector<uint32>::const_iterator iter = pids.begin();
-  for (; iter != pids.end(); ++iter) {
-    uint32 pid = *iter;
-    CString shared_memory_name;
-    shared_memory_name = shared_memory_prefix;
-    shared_memory_name.AppendFormat(_T("%d"), pid);
-    SharedMemoryAttributes default_attributes(shared_memory_name,
-                                              CSecurityDesc());
-    SharedMemoryProxy<IBrowserHttpRequest2, FakeGLock> proxy_read(
-                                                           true,
-                                                           &default_attributes);
-    CComPtr<IBrowserHttpRequest2> browser_http_request;
-    HRESULT hr = proxy_read.GetObject(&browser_http_request);
-    if (FAILED(hr) || !browser_http_request) {
-      NET_LOG(LW, (_T("[GetObject failed][%d][%d][0x%x]"),
-                   pid, browser_http_request, hr));
-      // Keep looking for more IBrowserHttpRequest2 objects.
-      continue;
-    }
-
-    objects_.push_back(browser_http_request);
-  }
-
-  return !objects_.empty();
-}
-
-HRESULT BrowserRequest::SendRequest(BSTR url,
-                                    BSTR post_data,
-                                    BSTR request_headers,
-                                    VARIANT response_headers_needed,
-                                    CComVariant* response_headers,
-                                    DWORD* response_code,
-                                    BSTR* cache_filename_bstr) {
-  NET_LOG(L3, (_T("[BrowserRequest::SendRequest]")));
-  if (objects_.empty()) {
-    NET_LOG(LE, (_T("[SendRequest: No Browser Objects available.]")));
-    return E_FAIL;
-  }
-
-  BrowserObjects::const_iterator i = objects_.begin();
-  HRESULT hr = E_UNEXPECTED;
-  CComBSTR cache_filename;
-  for (; i != objects_.end(); ++i) {
-    CComPtr<IBrowserHttpRequest2> browser_object(*i);
-    response_headers->Clear();
-    *response_code = 0;
-    cache_filename.Empty();
-    hr = browser_object->Send(url,
-                              post_data,
-                              request_headers,
-                              response_headers_needed,
-                              response_headers,
-                              response_code,
-                              &cache_filename);
-    NET_LOG(L3, (_T("[BrowserRequest::SendRequest][0x%x][%d][%s]"),
-                 hr, *response_code, cache_filename));
-
-    if (!*response_code) {
-      continue;
-    }
-
-    *cache_filename_bstr = cache_filename.Detach();
-    return S_OK;
-  }
-
-  return FAILED(hr) ? hr : E_UNEXPECTED;
-}
-
-}   // namespace omaha
-
diff --git a/net/browser_request.h b/net/browser_request.h
deleted file mode 100644
index 831f9e7..0000000
--- a/net/browser_request.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-//
-// BrowserRequest provides http transactions proxied through a user's browser.
-
-#ifndef OMAHA_NET_BROWSER_REQUEST_H__
-#define OMAHA_NET_BROWSER_REQUEST_H__
-
-#include <list>
-#include "goopdate/omaha3_idl.h"
-#include "omaha/net/urlmon_request.h"
-
-namespace omaha {
-
-typedef std::list<CAdapt<CComPtr<IBrowserHttpRequest2> > > BrowserObjects;
-
-class BrowserRequest : public UrlmonRequest {
- public:
-  BrowserRequest();
-  virtual ~BrowserRequest() {}
-
-  virtual CString ToString() const { return _T("iexplore"); }
-
-  virtual HRESULT SendRequest(BSTR url,
-                              BSTR post_data,
-                              BSTR request_headers,
-                              VARIANT response_headers_needed,
-                              CComVariant* response_headers,
-                              DWORD* response_code,
-                              BSTR* cache_filename);
-
- private:
-  bool GetAvailableBrowserObjects();
-  BrowserObjects objects_;
-
-  friend class BrowserRequestTest;
-  friend class CupRequestTest;
-
-  DISALLOW_EVIL_CONSTRUCTORS(BrowserRequest);
-};
-
-}   // namespace omaha
-
-#endif  // OMAHA_NET_BROWSER_REQUEST_H__
-
diff --git a/net/browser_request_unittest.cc b/net/browser_request_unittest.cc
deleted file mode 100644
index 494bbae..0000000
--- a/net/browser_request_unittest.cc
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include <windows.h>
-#include <winhttp.h>
-#include "omaha/base/app_util.h"
-#include "omaha/base/string.h"
-#include "omaha/net/browser_request.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-class BrowserRequestTest : public testing::Test {
- protected:
-  BrowserRequestTest() : are_browser_objects_available(false) {
-    BrowserRequest request;
-    are_browser_objects_available = !request.objects_.empty();
-  }
-
-  void BrowserGet(const CString& url);
-  void BrowserGet204(const CString& url);
-  void BrowserDownload(const CString& url);
-
-  bool are_browser_objects_available;
-};
-
-void BrowserRequestTest::BrowserGet(const CString& url) {
-  if (!are_browser_objects_available) {
-    return;
-  }
-
-  BrowserRequest browser_request;
-  browser_request.set_url(url);
-  EXPECT_HRESULT_SUCCEEDED(browser_request.Send());
-  EXPECT_EQ(HTTP_STATUS_OK, browser_request.GetHttpStatusCode());
-
-  CString response(Utf8BufferToWideChar(browser_request.GetResponse()));
-  EXPECT_NE(-1, response.Find(_T("User-agent: *")));
-  CString content_type;
-  browser_request.QueryHeadersString(WINHTTP_QUERY_CONTENT_TYPE,
-                                     NULL, &content_type);
-  EXPECT_STREQ(_T("text/plain"), content_type);
-  EXPECT_FALSE(browser_request.GetResponseHeaders().IsEmpty());
-}
-
-void BrowserRequestTest::BrowserGet204(const CString& url) {
-  if (!are_browser_objects_available) {
-    return;
-  }
-
-  BrowserRequest browser_request;
-  browser_request.set_url(url);
-  EXPECT_HRESULT_SUCCEEDED(browser_request.Send());
-  EXPECT_EQ(HTTP_STATUS_NO_CONTENT, browser_request.GetHttpStatusCode());
-  CString response(Utf8BufferToWideChar(browser_request.GetResponse()));
-  EXPECT_EQ(-1, response.Find(_T("User-agent: *")));
-  CString content_type;
-  browser_request.QueryHeadersString(WINHTTP_QUERY_CONTENT_TYPE,
-                                     NULL, &content_type);
-  EXPECT_STREQ(_T("text/html"), content_type);
-  EXPECT_FALSE(browser_request.GetResponseHeaders().IsEmpty());
-}
-
-void BrowserRequestTest::BrowserDownload(const CString& url) {
-  if (!are_browser_objects_available) {
-    return;
-  }
-
-  BrowserRequest browser_request;
-  CString temp_dir = app_util::GetTempDir();
-  CString temp_file;
-  EXPECT_TRUE(::GetTempFileName(temp_dir, _T("tmp"), 0,
-                                CStrBuf(temp_file, MAX_PATH)));
-  browser_request.set_filename(temp_file);
-  browser_request.set_url(url);
-
-  // First request.
-  ASSERT_HRESULT_SUCCEEDED(browser_request.Send());
-  EXPECT_EQ(HTTP_STATUS_OK, browser_request.GetHttpStatusCode());
-  browser_request.Close();
-
-  // Second request.
-  ASSERT_HRESULT_SUCCEEDED(browser_request.Send());
-  EXPECT_EQ(HTTP_STATUS_OK, browser_request.GetHttpStatusCode());
-
-  EXPECT_TRUE(::DeleteFile(temp_file));
-}
-
-// http get.
-TEST_F(BrowserRequestTest, HttpGet) {
-  BrowserGet(_T("http://www.google.com/robots.txt"));
-}
-
-// https get.
-TEST_F(BrowserRequestTest, HttpsGet) {
-  BrowserGet(_T("https://www.google.com/robots.txt"));
-}
-
-TEST_F(BrowserRequestTest, Download) {
-  BrowserDownload(_T("http://dl.google.com/update2/UpdateData.bin"));
-}
-
-// http get 204.
-TEST_F(BrowserRequestTest, HttpGet204) {
-  BrowserGet204(_T("http://tools.google.com/service/check2"));
-}
-
-}   // namespace omaha
-
diff --git a/net/build.scons b/net/build.scons
deleted file mode 100644
index 52d959b..0000000
--- a/net/build.scons
+++ /dev/null
@@ -1,62 +0,0 @@
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-# Create a local clone, so the parent environment is
-# unaffected by changes made here.
-local_env = env.Clone()
-
-local_env.Append(
-    CCFLAGS = [
-        '/wd4510',  # default constructor could not be generated
-        '/wd4610',  # object 'class' can never be instantiated
-        ],
-    CPPPATH = [
-        '$MAIN_DIR/third_party/c99/include',   # C99 inttypes.h for security
-
-        # Need to look in output dir to find .h files generated by midl compiler.
-        # This also allows Hammer to understand dependencies between this subdir
-        # and the .idl files in the goopdate folder.
-        '$OBJ_ROOT',
-        ],
-)
-
-inputs = [
-    'bind_status_callback.cc',
-    'bits_request.cc',
-    'bits_job_callback.cc',
-    'bits_utils.cc',
-    # 'browser_request.cc',   # it has a dependency on goopdate's idl
-    'cup_request.cc',
-    'cup_utils.cc',
-    'detector.cc',
-    'http_client.cc',
-    'simple_request.cc',
-    'urlmon_request.cc',
-    'net_diags.cc',
-    'net_utils.cc',
-    'network_config.cc',
-    'network_request.cc',
-    'network_request_impl.cc',
-    'proxy_auth.cc',
-    #'wininet.cc',      # we don't have support for wininet yet
-    'winhttp.cc',
-    'winhttp_adapter.cc',
-    'winhttp_vtable.cc',
-]
-
-# Build these into a library.
-local_env.ComponentStaticLibrary('net', inputs)
diff --git a/net/cup_pubkey.1.h b/net/cup_pubkey.1.h
deleted file mode 100644
index 86434c8..0000000
--- a/net/cup_pubkey.1.h
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-{1,32,0xb7e418f5,0x24168e4a,0x573b9e59,0xc8467437,0x86855da2,0x219222a2,0x1d0d377f,0x4a8c6193,0x49d12e87,0xa3babd81,0x4a2bb798,0xb73612a5,0x2c3da8a9,0xcc81079e,0xb8421488,0x2c8b88a2,0x70bf4b04,0x4560d954,0xdddcab57,0x7ba7ea81,0xc376b2e3,0xedc0b845,0xf6fb118a,0x48e62940,0x1dfdc5e,0x2ef66eb3,0x812fcf0b,0x2d8e5a9,0x58cffdc9,0x934ec9f,0x86f866a9,0xb7abbedc,0xc6aa01c0,0xd7802d7c,0x20d5045b,0xf54eaac3,0xb0464829,0x91a6fa43,0x24ccf604,0xf7230e2b,0xbbc91fee,0x45dd54c3,0x4ee47f6d,0x46f30e32,0xf9229e70,0xc89e98ed,0x614c1bce,0x86427571,0xa141ecf2,0x9caf8721,0xf8d32d46,0x1d7d3021,0xfa7f4f82,0x887d82c3,0xd802562b,0xc1e4f75d,0x48896303,0xbffb080,0x42d60913,0xdf7b2b64,0x673a8774,0x7e3a4082,0xbc5f74c6,0x8fb64535,0xd9a3cda}
diff --git a/net/cup_pubkey.2.h b/net/cup_pubkey.2.h
deleted file mode 100644
index 745307d..0000000
--- a/net/cup_pubkey.2.h
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-{2,32,0xfcd21d33,0x755a2de3,0xb7eac22,0x66b2aab6,0x6e6a1202,0x25a4dda,0x688b1eeb,0x6c75b003,0xbf3f9c25,0x89d0ffb9,0x23a83c49,0x31c441e5,0xa2b0e2fc,0x3c42ba60,0xcc79562c,0x29596164,0xfd5fffed,0x5ca40b27,0x89ed0af9,0x7e1ca88c,0xd016c69d,0x2f4e0d47,0x60c7bc5b,0x6a6db0c8,0xd7f6d5ff,0x1cb8dd55,0xa8fa737,0x3214960,0x3c300808,0xbbc7d2d9,0xf16b147e,0x9051df10,0xfc2292d9,0xa49712f2,0x53d70c7a,0x1287e191,0x8861d9a4,0x4bdc0671,0xf80caeaf,0xd5a83088,0x54e61a01,0x33e9b7af,0x5bc1383a,0x5f588f2e,0x24b3c6b,0xcc46fd12,0xcccc71e6,0x81f29a2e,0xdf12115d,0x260df134,0x723c0a2e,0x38a59429,0xf013fc9e,0x447a495,0xc92ab3f8,0x73128650,0x873e4994,0x17bded64,0x4d38c74a,0x9e8061d2,0xcff7210d,0xd9d7ed35,0x9182aa4,0x1f579b9c,0x966a57da}
\ No newline at end of file
diff --git a/net/cup_pubkey.3.h b/net/cup_pubkey.3.h
deleted file mode 100644
index b4af8cd..0000000
--- a/net/cup_pubkey.3.h
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-{3,32,0xb65e606b,0x905b9ba8,0x265d1815,0x923d5656,0x90640cd2,0x6365205,0x95b5f1dd,0x400c19b6,0xb4d77fae,0xdbd62a10,0xc4ba5466,0x2ed2a86e,0xe3345196,0xcfae25e,0x77e82f37,0xa3c1fa89,0x9fd3b9bd,0x68f95095,0xe6f5041,0x29a39dd5,0xcd60a78b,0x57e2017e,0x1921ebe8,0xca64543a,0x3d809822,0x7b24bddb,0xf4f7258,0xe812abee,0x51cbb2c5,0x6fee0df4,0x2bf64151,0x2a556212,0xfad45ee0,0x3f9fb0dc,0xf2945a,0xae5a629a,0x51f513d6,0xf0e04255,0x55ffd41,0x161af605,0x80811b22,0x52614662,0xc2e1bafe,0xa9e4617c,0xc7c7e9a2,0xa7643c24,0x9caecd4a,0xc04c3fa7,0x58bdb1bc,0xb06ed81b,0xfa8d9a2c,0xda1649ab,0x65c66680,0x9e58710c,0x15c06bc2,0xfef323f0,0x733ecc43,0x5d827fd0,0xfba47d79,0xb0cebc02,0xff590f6a,0x44a808b2,0x84b8a4ba,0x22762070,0x9ffc9d9f}
\ No newline at end of file
diff --git a/net/cup_reference_pubkey.1.h b/net/cup_reference_pubkey.1.h
deleted file mode 100644
index 12d4d94..0000000
--- a/net/cup_reference_pubkey.1.h
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-{1,32,0x53237ebd,0x7e012da6,0x2be8e5c5,0x631f548f,0x254a6cb1,0x4ed1812a,0x1fbd0d6b,0xc2690f5c,0xdb26f107,0x910072f2,0xe8d2451a,0x4ab13f07,0x6502be4e,0xfae1059f,0x2596195d,0x6998cc6c,0x122d5aa2,0x93fa179a,0x9fec32a5,0xa01a0535,0xb9c4a41f,0xead27de3,0x1c52c595,0x6b2d934f,0x3ffa6eaa,0x810e39bd,0x867db50e,0xcf2af656,0xac8e3aab,0x73698f94,0x378f8426,0x4622f3fb,0x18b64f90,0x3ee404fc,0xf335a03,0xd30cc6b,0x8217e5e0,0xff6d53d8,0x2870f8c4,0xd595e7a4,0x2952f894,0x6649f64a,0x24d90d64,0xa1d5a97b,0xebbdb966,0x7027bb9a,0x7dc9c5cd,0x1179c475,0xff570e96,0x9f65a38,0xbd340fa1,0x74634eb6,0x5ff46343,0x55045098,0x26974be4,0x475bedc4,0x9bce9883,0xf6e9ff20,0x5bde2bf2,0x3d56a643,0x82d2c723,0xd4da78dd,0x660e8ccd,0x32b6e38e,0x87461df9}
\ No newline at end of file
diff --git a/net/cup_request.cc b/net/cup_request.cc
deleted file mode 100644
index 87db7f6..0000000
--- a/net/cup_request.cc
+++ /dev/null
@@ -1,742 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// TODO(omaha): to minimize conversions from UNICODE to UTF-8 consider an
-// API that takes the request body as UTF-8 and it stores it as UTF-8.
-
-#include "omaha/net/cup_request.h"
-
-#include <atlconv.h>
-#include <atlstr.h>
-#include <vector>
-#include "omaha/base/const_addresses.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/encrypt.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/path.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/security/b64.h"
-#include "omaha/base/security/hmac.h"
-#include "omaha/base/security/rsa.h"
-#include "omaha/base/security/sha.h"
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-#include "omaha/net/cup_utils.h"
-#include "omaha/net/http_client.h"
-#include "omaha/net/net_utils.h"
-#include "omaha/net/network_config.h"
-
-using omaha::encrypt::EncryptData;
-using omaha::encrypt::DecryptData;
-
-namespace omaha {
-
-namespace detail {
-
-class CupRequestImpl {
- public:
-  explicit CupRequestImpl(HttpRequestInterface* http_request);
-  ~CupRequestImpl();
-
-  HRESULT Close();
-  HRESULT Send();
-  HRESULT Cancel();
-  HRESULT Pause();
-  HRESULT Resume();
-  std::vector<uint8> GetResponse() const;
-  HRESULT QueryHeadersString(uint32 info_level,
-                                    const TCHAR* name,
-                                    CString* value) const;
-  CString GetResponseHeaders() const;
-  int GetHttpStatusCode() const;
-  CString ToString() const;
-  void SetEntropy(const void* data, size_t data_length);
-
-  void set_session_handle(HINTERNET session_handle);
-  void set_url(const CString& url);
-  void set_request_buffer(const void* buffer, size_t buffer_length);
-  void set_proxy_configuration(const ProxyConfig& proxy_config);
-  void set_filename(const CString& filename);
-  void set_low_priority(bool low_priority);
-  void set_callback(NetworkRequestCallback* callback);
-  void set_additional_headers(const CString& additional_headers);
-  void set_preserve_protocol(bool preserve_protocol);
-  CString user_agent() const;
-  void set_user_agent(const CString& user_agent);
-  void set_proxy_auth_config(const ProxyAuthConfig& proxy_auth_config);
-
- private:
-  HRESULT DoSend();
-  HRESULT BuildRequest();
-  HRESULT BuildChallengeHash();
-  HRESULT BuildClientProof();
-  HRESULT InitializeEntropy();
-  HRESULT AuthenticateResponse();
-
-  // Loads the {sk, c} credentials from persistent storage.
-  HRESULT LoadCredentials(std::vector<uint8>* sk, CStringA* c);
-
-  // Saves the {sk, c} credentials. The key is encrypted before saving it.
-  HRESULT SaveCredentials(const std::vector<uint8>& sk, const CStringA& c);
-
-  // Replaces the https protocol scheme with http if changing protocol is
-  // allowed.
-  HRESULT BuildInnerRequestUrl(const CString& url, CString* inner_url);
-
-  // The transient state of the request, so that we can start always with a
-  // clean slate even though the same instance is being reuse across requests.
-  struct TransientCupState {
-    std::vector<uint8> entropy;
-    std::vector<uint8> r;         // Random bytes (r).
-    std::vector<uint8> sk;        // Cached shared key (sk)
-    std::vector<uint8> new_sk;    // Current shared_key (sk').
-    std::vector<uint8> hw;        // Challenge hash (hw).
-    std::vector<uint8> hm;        // Response hash (hm).
-
-    CStringA cp;                  // Client proof (cp).
-    CStringA sp;                  // Server proof (sp).
-    CStringA vw;                  // Versioned challenge (v|w).
-    std::vector<uint8> response;  // The received response.
-    CStringA c;                   // Cached client cookie (c)
-    CStringA new_cookie;          // The cookie returned by the server (c').
-
-    // The url of the request. It includes the original url plus the versioned
-    // challenge (v|w).
-    CStringA request_url;
-  };
-  scoped_ptr<TransientCupState> cup_;
-
-  CStringA url_;                        // The original url.
-  CString additional_headers_;
-  bool preserve_protocol_;              // Should not change request scheme if
-                                        // true.
-  const void* request_buffer_;          // Contains the request body for POST.
-  size_t      request_buffer_length_;   // Length of the request body.
-  std::vector<uint8> entropy_;          // Optional entropy pass by the caller,
-                                        // mostly for testing purpose.
-
-  // {sk, c} credentials. They are persisted in the registry when the object is
-  // destroyed. The vast majority of network code runs impersonated. Writing
-  // through the credentials is likely to fail. However, due to how the
-  // CUP object is being used by the upper layers of the network code, a
-  // write back policy is possible.
-  std::vector<uint8> persisted_sk_;
-  CStringA           persisted_c_;
-
-  scoped_ptr<RSA> rsa_;
-  RSA::PublicKey public_key_;                      // Server public key (pk[v]).
-  scoped_ptr<HttpRequestInterface> http_request_;  // Inner http request.
-
-  static const RSA::PublicKeyInstance kCupProductionPublicKey;
-  static const RSA::PublicKeyInstance kCupTestPublicKey;
-
-  DISALLOW_EVIL_CONSTRUCTORS(CupRequestImpl);
-};
-
-const RSA::PublicKeyInstance CupRequestImpl::kCupProductionPublicKey =
-#include "omaha/net/cup_pubkey.3.h"
-;   // NOLINT
-
-const RSA::PublicKeyInstance CupRequestImpl::kCupTestPublicKey =
-#include "omaha/net/cup_pubkey.2.h"
-;   // NOLINT
-
-CupRequestImpl::CupRequestImpl(HttpRequestInterface* http_request)
-    : preserve_protocol_(false),
-      request_buffer_(NULL),
-      request_buffer_length_(0),
-      public_key_(NULL) {
-  ASSERT1(http_request);
-  bool is_using_cup_test_keys = NetworkConfig::IsUsingCupTestKeys();
-  public_key_ = is_using_cup_test_keys ? kCupTestPublicKey :
-                                         kCupProductionPublicKey;
-
-  // Try to retrieve the credentials if we have any. If we have succeeded, then
-  // we must have a {sk, c} pair. If we have failed, then we will generate
-  // a fresh set of credentials later on.
-  HRESULT hr = LoadCredentials(&persisted_sk_, &persisted_c_);
-  if (FAILED(hr)) {
-    ASSERT1(persisted_sk_.empty());
-    ASSERT1(persisted_c_.IsEmpty());
-  }
-
-  rsa_.reset(new RSA(public_key_));
-  http_request_.reset(http_request);
-
-  // Decorate the user agent by appending the "CUP" suffix. This overrides
-  // the user agent of the inner http request.
-  CString user_agent(http_request_->user_agent());
-  user_agent += _T(";cup");
-  http_request_->set_user_agent(user_agent);
-}
-
-CupRequestImpl::~CupRequestImpl() {
-  Close();
-}
-
-HRESULT CupRequestImpl::Close() {
-  cup_.reset();
-
-  // TODO(omaha): optimize so that if the credentials did not change then
-  // there would be not need to write back.
-  if (!persisted_sk_.empty() && !persisted_c_.IsEmpty()) {
-    VERIFY1(SUCCEEDED(SaveCredentials(persisted_sk_, persisted_c_)));
-  }
-  return http_request_->Close();
-}
-
-HRESULT CupRequestImpl::Send() {
-  // Start with a fresh CUP state. This is important as the client may
-  // reuse the same CUP request for subsequent requests.
-  cup_.reset(new TransientCupState);
-
-  // First, build a request, send it, and then authenticate the response.
-  HRESULT hr = BuildRequest();
-  if (FAILED(hr)) {
-    return hr;
-  }
-  hr = DoSend();
-  if (FAILED(hr)) {
-    return hr;
-  }
-  hr = AuthenticateResponse();
-  if (FAILED(hr)) {
-    return hr;
-  }
-  return S_OK;
-}
-
-HRESULT CupRequestImpl::BuildRequest() {
-  HRESULT hr(InitializeEntropy());
-  if (FAILED(hr)) {
-    return hr;
-  }
-  // Start with some random bytes.
-  cup_->r = cup_utils::RsaPad(rsa_->size(),
-                              &cup_->entropy.front(), cup_->entropy.size());
-
-  // Derive a new shared key (sk') as the hash of the random bytes.
-  // TODO(omaha): consider protecting the key using ::CryptProtectmemory when
-  // not being used.
-  cup_->new_sk = cup_utils::Hash(cup_->r);
-
-  // Compute the challenge (w) by encrypting in place (r) with the server
-  // public key pk[v].
-  size_t encrypted_size = rsa_->raw(&cup_->r.front(), cup_->r.size());
-  ASSERT1(encrypted_size == cup_->r.size());
-
-  // Compute the versioned challenge (v|w) as
-  // decimal-v:base64-encoded-rsa-wrapper.
-  SafeCStringAFormat(&cup_->vw, "%d:%s",
-                     rsa_->version(),
-                     cup_utils::B64Encode(&cup_->r.front(), cup_->r.size()));
-
-  // Compute the url of the CUP request.
-  // Append a query string or append to the existing query string if any.
-  const char* format_string = url_.Find('?') != -1 ? "%1&w=%2" : "%1?w=%2";
-  cup_->request_url.FormatMessage(format_string, url_, cup_->vw);
-
-  // Compute the challenge hash (hw) as HASH(HASH(v|w)|HASH(req))
-  hr = BuildChallengeHash();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Compute the client proof as SYMsign[sk](0|hw|HASH(c)) if we have a
-  // {sk, c} pair or as SYMsign[sk'](3|hw) if we do not.
-  hr = BuildClientProof();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  NET_LOG(L4, (_T("[hw: %s]"), BytesToHex(cup_->hw)));
-
-  // This is what the client sends up along with the request: a versioned
-  // challenge, a client proof, and a client cookie if it has one.
-
-  NET_LOG(L4, (_T("[request:     %s]"), CA2T(cup_->request_url)));
-  NET_LOG(L4, (_T("[ifmatch:     %s]"), CA2T(cup_->cp)));
-  NET_LOG(L4, (_T("[cookie:      %s]"), CA2T(cup_->c)));
-
-  return S_OK;
-}
-
-HRESULT CupRequestImpl::BuildChallengeHash() {
-  // The hash of the request if carried through all the cryptographic proofs.
-  // The challenge hash hw is computed as:
-  // HASH(HASH(v|w)|HASH(request_url)|HASH(body)).
-  // For simplicity, the protocol scheme and the port are dropped before
-  // hashing. The hash is computed over the CUP request url, which includes
-  // the versioned hash.
-  scoped_ptr<HttpClient> http_client(CreateHttpClient());
-  if (!http_client.get()) {
-    return OMAHA_NET_E_CUP_NO_HTTP_CLIENT;
-  }
-  HRESULT hr = http_client->Initialize();
-  if (FAILED(hr)) {
-    return hr;
-  }
-  ASSERT1(!cup_->request_url.IsEmpty());
-  CString url(cup_->request_url);
-  CString scheme, server, url_path, query_string;
-  hr = http_client->CrackUrl(url,
-                             0,
-                             &scheme,
-                             &server,
-                             NULL,
-                             &url_path,
-                             &query_string);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  ASSERT1(!scheme.IsEmpty());
-  ASSERT1(!server.IsEmpty());
-  ASSERT1(!url_path.IsEmpty());
-  url.FormatMessage(_T("//%1%2%3"), server, url_path, query_string);
-
-  CStringA req(url);
-
-  // Compute hw as HASH(HASH(v|w)|HASH(request_url)|HASH(body)).
-  ASSERT1(!cup_->vw.IsEmpty());
-  ASSERT1(!url.IsEmpty());
-  cup_->hw = cup_utils::HashBuffers(cup_->vw.GetString(), cup_->vw.GetLength(),
-                                    req.GetString(), req.GetLength(),
-                                    request_buffer_, request_buffer_length_);
-  return S_OK;
-}
-
-HRESULT CupRequestImpl::BuildClientProof() {
-  // Use persisted {sk, c} or start with empty credentials otherwise.
-  ASSERT1(cup_->sk.empty());
-  ASSERT1(cup_->c.IsEmpty());
-  if (!persisted_sk_.empty() && !persisted_c_.IsEmpty()) {
-    cup_->sk = persisted_sk_;
-    cup_->c  = persisted_c_;
-  }
-
-  std::vector<uint8> hcp;   // hmac of the client proof.
-  if (!cup_->sk.empty() && !cup_->c.IsEmpty()) {
-    // Use the cached shared key (sk) and the cookie (c) if we have them.
-    ASSERT1(cup_->sk.size() == SHA_DIGEST_SIZE);
-    NET_LOG(L4, (_T("[using sk: %s]"), BytesToHex(cup_->sk)));
-
-    // Compute 'cp' as SYMsign[sk](0|HASH(w)|HASH(c))
-    std::vector<uint8> hc = cup_utils::Hash(cup_->c);
-    hcp = cup_utils::SymSign(cup_->sk, 0, &cup_->hw, &hc, NULL);
-  } else {
-    // There is no saved shared key. Use current shared key (new_sk).
-    ASSERT1(cup_->new_sk.size() == SHA_DIGEST_SIZE);
-    NET_LOG(L4, (_T("[using sk': %s]"), BytesToHex(cup_->new_sk)));
-
-    // Compute 'cp' as SYMsign[sk'](3|HASH(w))
-    hcp = cup_utils::SymSign(cup_->new_sk, 3, &cup_->hw, NULL, NULL);
-  }
-
-  NET_LOG(L4, (_T("[client proof hmac: %s]"), BytesToHex(hcp)));
-  cup_->cp = cup_utils::B64Encode(hcp);
-  return S_OK;
-}
-
-HRESULT CupRequestImpl::AuthenticateResponse() {
-  // This is what the server has sent down along with the response:
-  // a server proof, and optionally a new cookie for the client.
-  NET_LOG(L4, (_T("[etag:        %s]"), CA2T(cup_->sp)));
-  NET_LOG(L4, (_T("[svr cookie:  %s]"), CA2T(cup_->new_cookie)));
-
-  if (cup_->sp.IsEmpty()) {
-    // We can't authenticate anything without the server proof.
-    return OMAHA_NET_E_CUP_NO_SERVER_PROOF;
-  }
-
-  // Compute the hash of the response (hm).
-  cup_->hm = cup_utils::Hash(cup_->response);
-  NET_LOG(L4, (_T("[hm: %s]"), BytesToHex(cup_->hm)));
-
-  // Verify the response and the challenge w are authenticated by the
-  // client shared key. The validation has at least one subtle aspect: the
-  // client must try two signatures. First, it tries to authenticate using
-  // the new sk and the new cookie. If the response does not authenticate but
-  // the client has an old key, it should try authenticating with the old key.
-  // This second step is important in the case of an attacker or server
-  // misconfiguration where the server is signing with the old key but still
-  // sending a cookie.
-  std::vector<uint8> hmac;
-  if (!cup_->new_cookie.IsEmpty() && !cup_->new_sk.empty()) {
-    // The server has sent down a new cookie because the client proof or the
-    // client cookie were not good or missing. Try to authenticate using the
-    // new shared key and the new cookie {sk', c'}.
-    std::vector<uint8> hnew_c = cup_utils::Hash(cup_->new_cookie);  // HASH(c')
-
-    // Compute the server proof (sp) as SYMsign[sk'](1|hw|hm|hc').
-    hmac = cup_utils::SymSign(cup_->new_sk, 1, &cup_->hw, &cup_->hm, &hnew_c);
-    CStringA expected_sp = cup_utils::B64Encode(hmac);
-
-    if (expected_sp == cup_->sp) {
-      // Copy the credentials to write them back when this object is destroyed.
-      persisted_sk_ = cup_->new_sk;
-      persisted_c_  = cup_->new_cookie;
-      return S_OK;
-    }
-  }
-
-  if (!cup_->sk.empty()) {
-    // The server has accepted our client proof (cp) and consequently the sk.
-
-    // Compute the server proof as SYMsign[sk](2|hw|hm).
-    hmac = cup_utils::SymSign(cup_->sk, 2, &cup_->hw, &cup_->hm, NULL);
-    CStringA expected_sp = cup_utils::B64Encode(hmac);
-
-    if (expected_sp == cup_->sp) {
-      return S_OK;
-    }
-  }
-
-  NET_LOG(L4, (_T("[expected server proof: %s]"), BytesToHex(hmac)));
-
-  // The server proof does not authenticate. We reject this response.
-  return OMAHA_NET_E_CUP_NOT_TRUSTED;
-}
-
-HRESULT CupRequestImpl::LoadCredentials(std::vector<uint8>* sk, CStringA* c) {
-  ASSERT1(sk);
-  ASSERT1(c);
-  NetworkConfig* network_config = NULL;
-  NetworkConfigManager& network_manager = NetworkConfigManager::Instance();
-  HRESULT hr = network_manager.GetUserNetworkConfig(&network_config);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  CupCredentials cup_credentials;
-  hr = network_config->GetCupCredentials(&cup_credentials);
-  if (SUCCEEDED(hr)) {
-    sk->swap(cup_credentials.sk);
-    *c = cup_credentials.c;
-  }
-  return hr;
-}
-
-HRESULT CupRequestImpl::SaveCredentials(const std::vector<uint8>& sk,
-                                        const CStringA& c) {
-  NetworkConfig* network_config = NULL;
-  NetworkConfigManager& network_manager = NetworkConfigManager::Instance();
-  HRESULT hr = network_manager.GetUserNetworkConfig(&network_config);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CupCredentials  cup_credentials;
-  cup_credentials.sk = sk;
-  cup_credentials.c = c;
-  return network_config->SetCupCredentials(&cup_credentials);
-}
-
-HRESULT CupRequestImpl::DoSend() {
-  // The url of the inner request includes the versioned challenge.
-  // It replaces the protocol from https to http since CUP over https is
-  // not supported.
-  CString inner_request_url;
-  HRESULT hr = BuildInnerRequestUrl(CString(cup_->request_url),
-                                    &inner_request_url);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  http_request_->set_url(inner_request_url);
-
-  // Prepare additional headers to send.
-  CString additional_headers(additional_headers_);
-
-  // The client proof (cp) is sent as the "If-Match" header.
-  ASSERT1(!cup_->cp.IsEmpty());
-  CStringA if_match_header;
-  SafeCStringAFormat(&if_match_header, "\"%s\"", cup_->cp);
-  additional_headers += HttpClient::BuildRequestHeader(_T("If-Match"),
-                                                       CA2T(if_match_header));
-
-  // Send the client cookie (c) if we have one.
-  if (!cup_->c.IsEmpty()) {
-    additional_headers += HttpClient::BuildRequestHeader(_T("Cookie"),
-                                                         CA2T(cup_->c));
-  }
-  http_request_->set_additional_headers(additional_headers);
-
-  NET_LOG(L5, (_T("[CUP request][%s]"),
-               BufferToPrintableString(request_buffer_,
-                                       request_buffer_length_)));
-  hr = http_request_->Send();
-  if (FAILED(hr)) {
-    return hr;
-  }
-  http_request_->GetResponse().swap(cup_->response);
-  int status_code(http_request_->GetHttpStatusCode());
-  if (status_code != HTTP_STATUS_OK &&
-      status_code != HTTP_STATUS_PARTIAL_CONTENT) {
-    return HRESULTFromHttpStatusCode(status_code);
-  }
-  NET_LOG(L5, (_T("[CUP response][%s]"),
-               VectorToPrintableString(cup_->response)));
-
-  // Get the server proof (sp).
-  CString etag_header;
-  http_request_->QueryHeadersString(WINHTTP_QUERY_ETAG, NULL, &etag_header);
-  UnenclosePath(&etag_header);   // Remove the quotes.
-  cup_->sp = CT2A(etag_header);
-
-  // Get the client cookie c'. The cookie may or may not be there. If the
-  // server has accepted both client proof (sp) then no
-  // new cookie is sent down. This is an indication for the client to
-  // use its {sk, c} pair.
-  CString set_cookie_header;
-  http_request_->QueryHeadersString(WINHTTP_QUERY_SET_COOKIE,
-                                    NULL, &set_cookie_header);
-
-  // Parse the cookie header to extract c=xxx cookie.
-  cup_->new_cookie = CT2A(cup_utils::ParseCupCookie(set_cookie_header));
-  return S_OK;
-}
-
-HRESULT CupRequestImpl::Cancel() {
-  return http_request_->Cancel();
-}
-
-HRESULT CupRequestImpl::Pause() {
-  return http_request_->Pause();
-}
-
-HRESULT CupRequestImpl::Resume() {
-  return http_request_->Resume();
-}
-
-std::vector<uint8> CupRequestImpl::GetResponse() const {
-  return http_request_->GetResponse();
-}
-
-HRESULT CupRequestImpl::QueryHeadersString(uint32 info_level,
-                                           const TCHAR* name,
-                                           CString* value) const {
-  return http_request_->QueryHeadersString(info_level, name, value);
-}
-
-CString CupRequestImpl::GetResponseHeaders() const {
-  return http_request_->GetResponseHeaders();
-}
-
-int CupRequestImpl::GetHttpStatusCode() const {
-  return http_request_->GetHttpStatusCode();
-}
-
-CString CupRequestImpl::ToString() const {
-  return CString("CUP:") + http_request_->ToString();
-}
-
-void CupRequestImpl::set_session_handle(HINTERNET session_handle) {
-  http_request_->set_session_handle(session_handle);
-}
-
-void CupRequestImpl::set_url(const CString& url) {
-  url_ = CT2A(url, CP_UTF8);
-}
-
-void CupRequestImpl::set_request_buffer(const void* buffer,
-                                        size_t buffer_length) {
-  request_buffer_ = buffer;
-  request_buffer_length_ = buffer_length;
-  http_request_->set_request_buffer(request_buffer_, request_buffer_length_);
-}
-
-void CupRequestImpl::set_proxy_configuration(const ProxyConfig& proxy_config) {
-  http_request_->set_proxy_configuration(proxy_config);
-}
-
-void CupRequestImpl::set_filename(const CString& filename) {
-  http_request_->set_filename(filename);
-}
-
-void CupRequestImpl::set_low_priority(bool low_priority) {
-  http_request_->set_low_priority(low_priority);
-}
-
-void CupRequestImpl::set_callback(NetworkRequestCallback* callback) {
-  http_request_->set_callback(callback);
-}
-
-void CupRequestImpl::set_additional_headers(const CString& additional_headers) {
-  additional_headers_ = additional_headers;
-}
-
-void CupRequestImpl::set_preserve_protocol(bool preserve_protocol) {
-  preserve_protocol_ = preserve_protocol;
-}
-
-CString CupRequestImpl::user_agent() const {
-  return http_request_->user_agent();
-}
-
-void CupRequestImpl::set_user_agent(const CString& user_agent) {
-  http_request_->set_user_agent(user_agent);
-}
-
-void CupRequestImpl::set_proxy_auth_config(const ProxyAuthConfig& config) {
-  http_request_->set_proxy_auth_config(config);
-}
-
-void CupRequestImpl::SetEntropy(const void* data, size_t data_length) {
-  ASSERT(false, (_T("Do not call from production code")));
-  ASSERT1(data);
-  const uint8* first(static_cast<const uint8*>(data));
-  const uint8* last(first + data_length);
-  std::vector<uint8> new_entropy(first, last);
-  entropy_.swap(new_entropy);
-}
-
-HRESULT CupRequestImpl::InitializeEntropy() {
-  if (entropy_.empty()) {
-    cup_->entropy.resize(rsa_->size() - SHA_DIGEST_SIZE);
-    if (!GenRandom(&cup_->entropy.front(), cup_->entropy.size())) {
-      return OMAHA_NET_E_CUP_NO_ENTROPY;
-    }
-  } else {
-    cup_->entropy = entropy_;
-  }
-  return S_OK;
-}
-
-HRESULT CupRequestImpl::BuildInnerRequestUrl(const CString& url,
-                                             CString* inner_url) {
-  ASSERT1(inner_url);
-  if (!String_StartsWith(url, kHttpsProtoScheme, true)) {
-    *inner_url = url;
-    return S_OK;
-  }
-
-  if (preserve_protocol_) {
-    // Request must be sent through https. So return error here so we can
-    // fall back to the next request type in the chain without CUP.
-    return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
-  }
-
-  *inner_url = url.Mid(_tcslen(kHttpsProtoScheme));
-  inner_url->Insert(0, kHttpProtoScheme);
-  return S_OK;
-}
-
-}   // namespace detail
-
-
-CupRequest::CupRequest(HttpRequestInterface* http_request) {
-  ASSERT1(http_request);
-  impl_.reset(new detail::CupRequestImpl(http_request));
-}
-
-CupRequest::~CupRequest() {
-}
-
-HRESULT CupRequest::Close() {
-  return impl_->Close();
-}
-
-HRESULT CupRequest::Send() {
-  return impl_->Send();
-}
-
-HRESULT CupRequest::Cancel() {
-  return impl_->Cancel();
-}
-
-HRESULT CupRequest::Pause() {
-  return impl_->Pause();
-}
-
-HRESULT CupRequest::Resume() {
-  return impl_->Resume();
-}
-
-std::vector<uint8> CupRequest::GetResponse() const {
-  return impl_->GetResponse();
-}
-
-int CupRequest::GetHttpStatusCode() const {
-  return impl_->GetHttpStatusCode();
-}
-
-HRESULT CupRequest::QueryHeadersString(uint32 info_level,
-                                       const TCHAR* name,
-                                       CString* value) const {
-  return impl_->QueryHeadersString(info_level, name, value);
-}
-
-CString CupRequest::GetResponseHeaders() const {
-  return impl_->GetResponseHeaders();
-}
-
-CString CupRequest::ToString() const {
-  return impl_->ToString();
-}
-
-void CupRequest::set_session_handle(HINTERNET session_handle) {
-  return impl_->set_session_handle(session_handle);
-}
-
-void CupRequest::set_url(const CString& url) {
-  impl_->set_url(url);
-}
-
-void CupRequest::set_request_buffer(const void* buffer, size_t buffer_length) {
-  impl_->set_request_buffer(buffer, buffer_length);
-}
-
-void CupRequest::set_proxy_configuration(const ProxyConfig& proxy_config) {
-  impl_->set_proxy_configuration(proxy_config);
-}
-
-void CupRequest::set_filename(const CString& filename) {
-  impl_->set_filename(filename);
-}
-
-void CupRequest::set_low_priority(bool low_priority) {
-  impl_->set_low_priority(low_priority);
-}
-
-void CupRequest::set_callback(NetworkRequestCallback* callback) {
-  impl_->set_callback(callback);
-}
-
-void CupRequest::set_additional_headers(const CString& additional_headers) {
-  impl_->set_additional_headers(additional_headers);
-}
-
-void CupRequest::set_preserve_protocol(bool preserve_protocol) {
-  impl_->set_preserve_protocol(preserve_protocol);
-}
-
-CString CupRequest::user_agent() const {
-  return impl_->user_agent();
-}
-
-void CupRequest::set_user_agent(const CString& user_agent) {
-  impl_->set_user_agent(user_agent);
-}
-
-void CupRequest::set_proxy_auth_config(const ProxyAuthConfig& config) {
-  impl_->set_proxy_auth_config(config);
-}
-
-void CupRequest::SetEntropy(const void* data, size_t data_length) {
-  return impl_->SetEntropy(data, data_length);
-}
-
-}   // namespace omaha
-
diff --git a/net/cup_request.h b/net/cup_request.h
deleted file mode 100644
index a26f92c..0000000
--- a/net/cup_request.h
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// CupRequest provides CUP capabilities for a generic HttpRequestInterface.
-
-#ifndef OMAHA_NET_CUP_REQUEST_H__
-#define OMAHA_NET_CUP_REQUEST_H__
-
-#include <windows.h>
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "omaha/net/http_request.h"
-#include "base/scoped_ptr.h"
-
-namespace omaha {
-
-namespace detail {
-
-// The implementation uses the pimpl idiom or bridge design pattern to
-// encapsulate the cup protocol implementation details from the calling code.
-class CupRequestImpl;
-
-}   // namespace detail
-
-class CupRequest : public HttpRequestInterface {
- public:
-  // Decorates an HttpRequestInterface to provide CUP functionality.
-  // It takes ownership of the object provided as parameter.
-  explicit CupRequest(HttpRequestInterface* http_request);
-
-  virtual ~CupRequest();
-
-  virtual HRESULT Close();
-
-  virtual HRESULT Send();
-
-  virtual HRESULT Cancel();
-
-  virtual HRESULT Pause();
-
-  virtual HRESULT Resume();
-
-  virtual std::vector<uint8> GetResponse() const;
-
-  virtual HRESULT QueryHeadersString(uint32 info_level,
-                                     const TCHAR* name,
-                                     CString* value) const;
-  virtual CString GetResponseHeaders() const;
-
-  virtual int GetHttpStatusCode() const;
-
-  virtual CString ToString() const;
-
-  virtual void set_session_handle(HINTERNET session_handle);
-
-  virtual void set_url(const CString& url);
-
-  virtual void set_request_buffer(const void* buffer, size_t buffer_length);
-
-  virtual void set_proxy_configuration(const ProxyConfig& proxy_config);
-
-  // Sets the filename to receive the response instead of the memory buffer.
-  virtual void set_filename(const CString& filename);
-
-  virtual void set_low_priority(bool low_priority);
-
-  virtual void set_callback(NetworkRequestCallback* callback);
-
-  virtual void set_additional_headers(const CString& additional_headers);
-
-  virtual void set_preserve_protocol(bool preserve_protocol);
-
-  virtual CString user_agent() const;
-
-  virtual void set_user_agent(const CString& user_agent);
-
-  virtual void set_proxy_auth_config(const ProxyAuthConfig& proxy_auth_config);
-
-  // Sets random bytes provided by the caller. This is useful for testing
-  // purposes and it is not be called by production code.
-  // Otherwise, when entropy is not provided, the implementation
-  // fills in the internal entropy buffer with cryptographically random bytes.
-  // Calling this method can result in compromising the security of the
-  // protocol, depending on the quality of entropy provided.
-  void SetEntropy(const void* data, size_t data_length);
-
- private:
-
-  scoped_ptr<detail::CupRequestImpl> impl_;
-  DISALLOW_EVIL_CONSTRUCTORS(CupRequest);
-};
-
-}   // namespace omaha
-
-#endif  // OMAHA_NET_CUP_REQUEST_H__
-
diff --git a/net/cup_request_unittest.cc b/net/cup_request_unittest.cc
deleted file mode 100644
index 9698393..0000000
--- a/net/cup_request_unittest.cc
+++ /dev/null
@@ -1,152 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// This unit test is hardcoded to run against production servers only.
-
-#include <iostream>
-#include <vector>
-#include "base/scoped_ptr.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/net/cup_request.h"
-#include "omaha/net/network_config.h"
-#include "omaha/net/simple_request.h"
-#include "omaha/net/urlmon_request.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-const TCHAR* const kGetUrl =
-    _T("http://tools.google.com/service/update2/id");
-const TCHAR* const kGetUrlNoResponseBody =
-    _T("http://tools.google.com/service/update2/nil");
-const TCHAR* const kPostUrl =
-    _T("http://tools.google.com/service/update2");
-const uint8 kRequestBuffer[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><o:gupdate xmlns:o=\"http://www.google.com/update2/request\" protocol=\"2.0\" version=\"1.2.1.0\" ismachine=\"1\" testsource=\"dev\"><o:os platform=\"win\" version=\"5.1\" sp=\"Service Pack 2\"/><o:app appid=\"{52820187-5605-4C18-AA51-8BD0A1209C8C}\" version=\"1.1.1.3\" lang=\"abc\" client=\"{0AF52D61-9958-4fea-9B29-CDD9DCDBB145}\" iid=\"{F723495F-8ACF-4746-8240-643741C797B5}\"><o:event eventtype=\"1\" eventresult=\"1\" errorcode=\"0\" previousversion=\"1.0.0.0\"/></o:app></o:gupdate>";  // NOLINT
-
-class CupRequestTest : public testing::Test {
- protected:
-  CupRequestTest() {}
-
-  static void SetUpTestCase() {
-    NetworkConfig* network_config = NULL;
-    EXPECT_HRESULT_SUCCEEDED(
-        NetworkConfigManager::Instance().GetUserNetworkConfig(&network_config));
-    network_config->SetCupCredentials(NULL);
-
-    // For debugging purposes, try FF configuration first.
-    network_config->Clear();
-    network_config->Add(new FirefoxProxyDetector());
-    EXPECT_HRESULT_SUCCEEDED(network_config->Detect());
-  }
-
-  static void TearDownTestCase() {
-    NetworkConfig* network_config = NULL;
-    EXPECT_HRESULT_SUCCEEDED(
-        NetworkConfigManager::Instance().GetUserNetworkConfig(&network_config));
-    network_config->SetCupCredentials(NULL);
-    network_config->Clear();
-  }
-
-  void DoRequest(HttpRequestInterface* contained_request,
-                 const CString& url,
-                 const uint8* request_buffer,
-                 size_t request_buffer_lenght) {
-    scoped_ptr<CupRequest> http_request(new CupRequest(contained_request));
-
-    NetworkConfig* network_config = NULL;
-    EXPECT_HRESULT_SUCCEEDED(
-        NetworkConfigManager::Instance().GetUserNetworkConfig(&network_config));
-    network_config->SetCupCredentials(NULL);
-
-    // For debugging purposes, try FF configuration first.
-    network_config->Clear();
-    network_config->Add(new FirefoxProxyDetector());
-    EXPECT_HRESULT_SUCCEEDED(network_config->Detect());
-
-    // This will use Firefox or direct connection if FF is not installed.
-    std::vector<ProxyConfig> proxy_configurations(
-        network_config->GetConfigurations());
-    proxy_configurations.push_back(ProxyConfig());
-
-    // Clear CUP credentials.
-    network_config->SetCupCredentials(NULL);
-
-    HINTERNET handle = network_config->session().session_handle;
-    http_request->set_session_handle(handle);
-    http_request->set_proxy_configuration(proxy_configurations[0]);
-    http_request->set_url(url);
-    if (request_buffer) {
-      http_request->set_request_buffer(request_buffer, request_buffer_lenght);
-    }
-
-    // First request goes with a fresh set of client credentials.
-    EXPECT_HRESULT_SUCCEEDED(http_request->Send());
-    int http_status = http_request->GetHttpStatusCode();
-    EXPECT_TRUE(http_status == HTTP_STATUS_OK ||
-                http_status == HTTP_STATUS_PARTIAL_CONTENT);
-    std::vector<uint8> response(http_request->GetResponse());
-
-    // Second request goes with cached client credentials.
-    EXPECT_HRESULT_SUCCEEDED(http_request->Send());
-    http_status = http_request->GetHttpStatusCode();
-    EXPECT_TRUE(http_status == HTTP_STATUS_OK ||
-                http_status == HTTP_STATUS_PARTIAL_CONTENT);
-    response = http_request->GetResponse();
-
-    // After each test run we should have some {sk, c} persisted in the
-    // registry. The CUP credentials are written back when the CUP request
-    // that has created them is destroyed.
-    http_request.reset();
-    CupCredentials cup_creds;
-    EXPECT_HRESULT_SUCCEEDED(network_config->GetCupCredentials(&cup_creds));
-    EXPECT_FALSE(cup_creds.sk.empty());
-    EXPECT_FALSE(cup_creds.c.IsEmpty());
-
-    network_config->SetCupCredentials(NULL);
-    EXPECT_HRESULT_FAILED(network_config->GetCupCredentials(&cup_creds));
-  }
-};
-
-TEST_F(CupRequestTest, GetSimpleRequest) {
-  if (IsTestRunByLocalSystem()) {
-    return;
-  }
-
-  DoRequest(new SimpleRequest, kGetUrl, NULL, 0);
-  DoRequest(new SimpleRequest, kGetUrlNoResponseBody, NULL, 0);
-}
-
-TEST_F(CupRequestTest, GetUrlmonRequest) {
-  DoRequest(new UrlmonRequest, kGetUrl, NULL, 0);
-  DoRequest(new UrlmonRequest, kGetUrlNoResponseBody, NULL, 0);
-}
-
-TEST_F(CupRequestTest, PostSimpleRequest) {
-  if (IsTestRunByLocalSystem()) {
-    return;
-  }
-
-  DoRequest(new SimpleRequest, kPostUrl,
-            kRequestBuffer, arraysize(kRequestBuffer) - 1);
-}
-
-TEST_F(CupRequestTest, PostUrlmonRequest) {
-  DoRequest(new UrlmonRequest, kPostUrl,
-            kRequestBuffer, arraysize(kRequestBuffer) - 1);
-}
-
-}   // namespace omaha
-
diff --git a/net/cup_utils.cc b/net/cup_utils.cc
deleted file mode 100644
index 2486ed5..0000000
--- a/net/cup_utils.cc
+++ /dev/null
@@ -1,145 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/net/cup_utils.h"
-
-#include <algorithm>
-#include <vector>
-#include "omaha/base/debug.h"
-#include "omaha/base/security/b64.h"
-#include "omaha/base/security/hmac.h"
-#include "omaha/base/security/sha.h"
-
-namespace omaha {
-
-namespace cup_utils {
-
-std::vector<uint8> RsaPad(size_t rsa_key_size,
-                          const void* data, size_t data_length) {
-  ASSERT1(rsa_key_size >= SHA_DIGEST_SIZE);
-  ASSERT1(data);
-
-  // The result gets padded with zeros if the result size is greater than
-  // the size of the buffer provided by the caller.
-  const uint8* start = static_cast<const uint8*>(data);
-  std::vector<uint8> result(start, start + data_length);
-  result.resize(rsa_key_size - SHA_DIGEST_SIZE);
-
-  // The input needs to be smaller than the RSA modulus, which has always the
-  // msb set.
-  result[0] &= 127;  // Reset msb
-  result[0] |= 64;   // Set second highest bit.
-
-  uint8 digest[SHA_DIGEST_SIZE] = {0};
-  SHA(&result.front(), result.size(), digest);
-
-  result.insert(result.end(), digest, digest + SHA_DIGEST_SIZE);
-  ASSERT1(result.size() == rsa_key_size);
-  return result;
-}
-
-CStringA B64Encode(const void* data, size_t data_length) {
-  ASSERT1(data);
-
-  // After encoding the size grows a little bit, about 133%. We assume 150%
-  // bigger size for simplicity. Also, the output length is a multiple of
-  // 4 bytes, so the minimum buffer should be at least 5 chars to include
-  // space for the string terminator.
-  CStringA result;
-  const size_t kMinBuffer = 5;
-  int result_max_size = std::max(data_length * 3 / 2, kMinBuffer);
-  int result_size = B64_encode(static_cast<const uint8*>(data),
-                               data_length,
-                               CStrBufA(result, result_max_size),
-                               result_max_size);
-  ASSERT1(result_size == result.GetLength());
-  return result;
-}
-
-CStringA B64Encode(const std::vector<uint8>& data) {
-  return B64Encode(&data.front(), data.size());
-}
-
-std::vector<uint8> Hash(const std::vector<uint8>& data) {
-  std::vector<uint8>result(SHA_DIGEST_SIZE);
-  SHA(data.empty() ? NULL : &data.front(), data.size(), &result.front());
-  return result;
-}
-
-std::vector<uint8> Hash(const CStringA& data) {
-  std::vector<uint8>result(SHA_DIGEST_SIZE);
-  SHA(data.GetString(), data.GetLength(), &result.front());
-  return result;
-}
-
-std::vector<uint8> HashBuffers(const void* buf1, size_t len1,
-                               const void* buf2, size_t len2,
-                               const void* buf3, size_t len3) {
-  SHA_CTX sha_ctx = {0};
-  SHA_init(&sha_ctx);
-  const void* buffers[] = {buf1, buf2, buf3};
-  const size_t lengths[] = {len1, len2, len3};
-  for (size_t i = 0; i != arraysize(buffers); ++i) {
-    uint8 hash[SHA_DIGEST_SIZE] = {0};
-    SHA(buffers[i], lengths[i], hash);
-    SHA_update(&sha_ctx, hash, sizeof(hash));
-  }
-  std::vector<uint8> result(SHA_DIGEST_SIZE);
-  memcpy(&result.front(), SHA_final(&sha_ctx), result.size());
-  return result;
-}
-
-std::vector<uint8> SymSign(const std::vector<uint8>& key,
-                           uint8 id,
-                           const std::vector<uint8>* h1,
-                           const std::vector<uint8>* h2,
-                           const std::vector<uint8>* h3) {
-  HMAC_CTX hmac_ctx = {0};
-  HMAC_SHA_init(&hmac_ctx, &key.front(), key.size());
-  HMAC_update(&hmac_ctx, &id, sizeof(id));
-  const std::vector<uint8>* args[] = {h1, h2, h3};
-  for (size_t i = 0; i != arraysize(args); ++i) {
-    if (args[i]) {
-      ASSERT1(args[i]->size() == SHA_DIGEST_SIZE);
-      HMAC_update(&hmac_ctx, &args[i]->front(), args[i]->size());
-    }
-  }
-  std::vector<uint8> result(SHA_DIGEST_SIZE);
-  memcpy(&result.front(), HMAC_final(&hmac_ctx), result.size());
-  return result;
-}
-
-// Looks for "c=", extracts a substring up to ';', which is the attribute
-// delimiter, and trims the white spaces at the end. If found, it returns
-// the string corresponding to "c=xxx", otherwise it returns an empty string.
-CString ParseCupCookie(const CString& cookie_header) {
-  CString cookie;
-  int start = cookie_header.Find(_T("c="));
-  if (start != -1) {
-    int end = cookie_header.Find(_T(';'), start);
-    if (end != -1) {
-      cookie = cookie_header.Mid(start, end - start);
-    } else {
-      cookie = cookie_header.Mid(start);
-    }
-    cookie.TrimRight(_T(' '));
-  }
-  return cookie;
-}
-
-}  // namespace cup_utils
-
-}  // namespace omaha
-
diff --git a/net/cup_utils.h b/net/cup_utils.h
deleted file mode 100644
index 8ea9e2f..0000000
--- a/net/cup_utils.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#ifndef OMAHA_NET_CUP_UTILS_H__
-#define OMAHA_NET_CUP_UTILS_H__
-
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-namespace cup_utils {
-
-// Takes up to (rsa_key_size - SHA_DIGEST_SIZE) from the caller provided
-// input, and creates a padded result (data | SHA1(data)), where the msb
-// is keybits-160 and the lsb is 160 SHA1 bits. If less input is provided
-// the function pads the input with zeros.
-std::vector<uint8> RsaPad(size_t rsa_key_size,
-                          const void* data, size_t data_length);
-
-// Encodes a buffer of bytes as B64. This encoder has a few differences from
-// the standard: it uses a different char set that is http friendly and it does
-// not pad the output with '='.
-CStringA B64Encode(const void* data, size_t data_length);
-
-// Encodes a vector of bytes as web safe B64.
-CStringA B64Encode(const std::vector<uint8>& data);
-
-// Computes the SHA hash of a vector of bytes: HASH(data).
-std::vector<uint8> Hash(const std::vector<uint8>& data);
-
-// Computes the SHA hash of a CStringA: HASH(data).
-std::vector<uint8> Hash(const CStringA& data);
-
-// Computes the SHA hash of buffers: HASH(HASH(buf1)|HASH(buf2)|HASH(buf3)).
-std::vector<uint8> HashBuffers(const void* buf1, size_t len1,
-                               const void* buf2, size_t len2,
-                               const void* buf3, size_t len3);
-
-// Computes the HMAC of hashes: SYMSign[key](id|h1|h2|h3)
-// NULL arguments are not included in the signature computation.
-std::vector<uint8> SymSign(const std::vector<uint8>& key,
-                           uint8 id,
-                           const std::vector<uint8>* h1,
-                           const std::vector<uint8>* h2,
-                           const std::vector<uint8>* h3);
-
-// Parses out the c=xxx; from the cookie header.
-CString ParseCupCookie(const CString& cookie_header);
-
-}  // namespace cup_utils
-
-}  // namespace omaha
-
-#endif  // OMAHA_NET_CUP_UTILS_H__
diff --git a/net/cup_utils_unittest.cc b/net/cup_utils_unittest.cc
deleted file mode 100644
index 7ec09af..0000000
--- a/net/cup_utils_unittest.cc
+++ /dev/null
@@ -1,161 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-#include <cstring>
-#include <vector>
-#include "omaha/base/security/sha.h"
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-#include "omaha/net/cup_utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace cup_utils {
-
-namespace {
-
-const char kPlainText[] = "The quick brown fox jumps over the lazy dog";
-const int kRsaKeySize = 128;         // 128 bytes.
-
-// Test padding for a random message of num_bytes length.
-void TestPadding(size_t num_bytes) {
-  std::vector<uint8> data(num_bytes);
-  EXPECT_TRUE(GenRandom(&data.front(), data.size()));
-  std::vector<uint8> m = RsaPad(kRsaKeySize, &data.front(), data.size());
-  EXPECT_EQ(m.size(), kRsaKeySize);
-
-  uint8 hash[SHA_DIGEST_SIZE] = {0};
-  SHA(&m.front(), m.size() - SHA_DIGEST_SIZE, hash);
-  EXPECT_EQ(memcmp(hash, &m[kRsaKeySize - SHA_DIGEST_SIZE], sizeof(hash)), 0);
-
-  EXPECT_FALSE(m[0] & 0x80);    // msb is always reset.
-  EXPECT_TRUE(m[0] & 0x60);     // bit next to msb is always set.
-}
-
-}  // namespace
-
-
-TEST(CupUtilsTest, RsaPad) {
-  EXPECT_GE(kRsaKeySize, SHA_DIGEST_SIZE);
-
-  TestPadding(1);                 // 1 byte.
-  TestPadding(SHA_DIGEST_SIZE);   // 20 bytes.
-  TestPadding(kRsaKeySize);       // 128 bytes.
-  TestPadding(1000);              // 1000 bytes.
-}
-
-// The underlying B64_encode function in common/security does not pad
-// with '='.
-TEST(CupUtilsTest, B64Encode) {
-  const char* bytes = "1";
-  EXPECT_STREQ(B64Encode(bytes, strlen(bytes)), "MQ");
-  bytes = "12";
-  EXPECT_STREQ(B64Encode(bytes, strlen(bytes)), "MTI");
-  bytes = "123";
-  EXPECT_STREQ(B64Encode(bytes, strlen(bytes)), "MTIz");
-  bytes = "Google Inc";
-  EXPECT_STREQ(B64Encode(bytes, strlen(bytes)), "R29vZ2xlIEluYw");
-
-  const uint8* first = reinterpret_cast<const uint8*>(bytes);
-  const uint8* last = first + strlen(bytes);
-  EXPECT_STREQ(B64Encode(std::vector<uint8>(first, last)), "R29vZ2xlIEluYw");
-}
-
-TEST(CupUtilsTest, Hash) {
-  // Empty vector.
-  std::vector<uint8> data;
-  std::vector<uint8> hash = Hash(data);
-  EXPECT_STREQ(BytesToHex(hash),
-               _T("da39a3ee5e6b4b0d3255bfef95601890afd80709"));
-
-  // Non-empty vector.
-  const uint8* first = reinterpret_cast<const uint8*>(kPlainText);
-  const uint8* last  = first + strlen(kPlainText);
-  data.clear();
-  data.insert(data.begin(), first, last);
-  hash = Hash(data);
-  EXPECT_STREQ(BytesToHex(hash),
-               _T("2fd4e1c67a2d28fced849ee1bb76e7391b93eb12"));
-
-  // Empty CString.
-  hash = Hash(CStringA());
-  EXPECT_STREQ(BytesToHex(hash),
-               _T("da39a3ee5e6b4b0d3255bfef95601890afd80709"));
-
-  // Non-empty CString.
-  hash = Hash(CStringA(kPlainText));
-  EXPECT_STREQ(BytesToHex(hash),
-               _T("2fd4e1c67a2d28fced849ee1bb76e7391b93eb12"));
-
-  // Hash of strings
-  CStringA arg(kPlainText);
-  hash = HashBuffers(arg.GetString(), arg.GetLength(), NULL, 0, NULL, 0);
-  EXPECT_STREQ(BytesToHex(hash),
-               _T("64eb91d899d68d2af394fbfe8f7c3b2884055ddb"));
-
-  hash = HashBuffers(NULL, 0, arg.GetString(), arg.GetLength(), NULL, 0);
-  EXPECT_STREQ(BytesToHex(hash),
-               _T("6c9f398d556ffe64fe441ca5491e25fd67d2ab65"));
-
-  hash = HashBuffers(NULL, 0, NULL, 0, arg.GetString(), arg.GetLength());
-  EXPECT_STREQ(BytesToHex(hash),
-               _T("9a7e591318dc169fc023414d8d25321bcb11121e"));
-
-  hash = HashBuffers(NULL, 0, NULL, 0, NULL, 0);
-  EXPECT_STREQ(BytesToHex(hash),
-               _T("d0dc1cf9bf61884f8e7982e0b1b87954bd9ee9c7"));
-}
-
-TEST(CupUtilsTest, SymSign) {
-  // Sign of vectors: ignore NULL vectors.
-  std::vector<uint8> key;  // This is the signing key.
-  key.push_back(7);
-
-  CStringA arg(kPlainText);
-  std::vector<uint8> hash = Hash(arg);
-  std::vector<uint8> sym_sign = SymSign(key, 1, &hash, NULL, NULL);
-  EXPECT_STREQ(BytesToHex(sym_sign),
-               _T("1c6fa359c0a7b11421ae4d31a92f9de8a4ef8d2d"));
-
-  sym_sign = SymSign(key, 1, NULL, &hash, NULL);
-  EXPECT_STREQ(BytesToHex(sym_sign),
-               _T("1c6fa359c0a7b11421ae4d31a92f9de8a4ef8d2d"));
-
-  sym_sign = SymSign(key, 1, NULL, NULL, &hash);
-  EXPECT_STREQ(BytesToHex(sym_sign),
-               _T("1c6fa359c0a7b11421ae4d31a92f9de8a4ef8d2d"));
-
-  sym_sign = SymSign(key, 1, &hash, &hash, &hash);
-    EXPECT_STREQ(BytesToHex(sym_sign),
-                 _T("fef3e343795946cd47ff4e07eca5f3f09b051d86"));
-}
-
-TEST(CupUtilsTest, ParseCupCookie) {
-  EXPECT_STREQ(_T(""), ParseCupCookie(_T("")));
-  EXPECT_STREQ(_T(""), ParseCupCookie(_T("foo; bar;")));
-  EXPECT_STREQ(_T("c="), ParseCupCookie(_T("c=")));
-  EXPECT_STREQ(_T("c="), ParseCupCookie(_T("c= ;")));
-  EXPECT_STREQ(_T("c=foo"), ParseCupCookie(_T("c=foo")));
-  EXPECT_STREQ(_T("c=foo"), ParseCupCookie(_T(";c=foo")));
-  EXPECT_STREQ(_T("c=foo"), ParseCupCookie(_T("c=foo ; bar;")));
-  EXPECT_STREQ(_T("c=foo"), ParseCupCookie(_T("b=bar; c=foo;")));
-  EXPECT_STREQ(_T("c=foo"), ParseCupCookie(_T("b=bar; c=foo ; foobar")));
-}
-
-}  // namespace cup_utils
-
-}  // namespace omaha
diff --git a/net/detector.cc b/net/detector.cc
deleted file mode 100644
index 47d2858..0000000
--- a/net/detector.cc
+++ /dev/null
@@ -1,406 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// TODO(omaha): move EnclosePath and UnenclosePath functions from path.h to
-//               string.h
-// TODO(omaha): Firefox detector does not handle proxy bypass.
-
-#include "omaha/net/detector.h"
-
-#include "base/scoped_ptr.h"
-#include "omaha/base/atl_regexp.h"
-#include "omaha/base/browser_utils.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/file_reader.h"
-#include "omaha/base/path.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/string.h"
-#include "omaha/base/user_info.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/time.h"
-#include "omaha/net/http_client.h"
-#include "omaha/net/network_config.h"
-
-namespace omaha {
-
-HRESULT RegistryOverrideProxyDetector::Detect(ProxyConfig* config) {
-  ASSERT1(config);
-  RegKey reg_key;
-  HRESULT hr = reg_key.Open(reg_path_, KEY_READ);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  CString proxy_host;
-  hr = reg_key.GetValue(kRegValueProxyHost, &proxy_host);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  DWORD proxy_port(0);
-  hr = reg_key.GetValue(kRegValueProxyPort, &proxy_port);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  *config = ProxyConfig();
-  SafeCStringFormat(&config->proxy, _T("%s:%d"), proxy_host, proxy_port);
-  config->source = source();
-  config->priority = ProxyConfig::PROXY_PRIORITY_OVERRIDE;
-  return S_OK;
-}
-
-UpdateDevProxyDetector::UpdateDevProxyDetector()
-    : registry_detector_(MACHINE_REG_UPDATE_DEV) {
-}
-
-FirefoxProxyDetector::FirefoxProxyDetector()
-    : cached_prefs_last_modified_(0),
-      cached_config_(new ProxyConfig) {
-}
-
-HRESULT FirefoxProxyDetector::Detect(ProxyConfig* config) {
-  ASSERT1(config);
-
-  // The Firefox profile is not available when running as a local system.
-  if (user_info::IsRunningAsSystem()) {
-    return E_FAIL;
-  }
-
-  const TCHAR* const kFirefoxPrefsJsFile = _T("\\prefs.js");
-
-  CString name, path;
-  HRESULT hr = GetFirefoxDefaultProfile(&name, &path);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  path.Append(kFirefoxPrefsJsFile);
-
-  // Has the current profile been modified? Check the name, path, and
-  // last modified time of the profile are the same as their cached values.
-  FILETIME filetime_last_modified = {0};
-  int64 last_modified = 0;
-  if (SUCCEEDED(File::GetFileTime(path,
-                                  NULL,
-                                  NULL,
-                                  &filetime_last_modified))) {
-    last_modified = FileTimeToInt64(filetime_last_modified);
-  }
-  if (name.CompareNoCase(cached_prefs_name_)      == 0 &&
-      path.CompareNoCase(cached_prefs_file_path_) == 0 &&
-      last_modified == cached_prefs_last_modified_     &&
-      last_modified) {
-    NET_LOG(L4, (_T("[using FF cached profile][%s]"), path));
-    *config = *cached_config_;
-    return S_OK;
-  }
-
-  hr = ParsePrefsFile(name, path, config);
-  if (SUCCEEDED(hr) && last_modified) {
-    // If FireFox is the default brower, promotes its proxy priority.
-    BrowserType browser_type(BROWSER_UNKNOWN);
-    if (SUCCEEDED(GetDefaultBrowserType(&browser_type)) &&
-        browser_type == BROWSER_FIREFOX) {
-      config->priority = ProxyConfig::PROXY_PRIORITY_DEFAULT_BROWSER;
-    }
-    NET_LOG(L4, (_T("[cache FF profile][%s]"), path));
-    cached_prefs_name_          = name;
-    cached_prefs_file_path_     = path;
-    cached_prefs_last_modified_ = last_modified;
-    *cached_config_             = *config;
-  }
-  return hr;
-}
-
-// This is what the proxy configuration in Firefox looks like:
-// user_pref("network.proxy.autoconfig_url", "http://wpad/wpad.dat");
-// user_pref("network.proxy.ftp", "127.0.0.1");
-// user_pref("network.proxy.ftp_port", 8888);
-// user_pref("network.proxy.gopher", "127.0.0.1");
-// user_pref("network.proxy.gopher_port", 8888);
-// user_pref("network.proxy.http", "127.0.0.1");
-// user_pref("network.proxy.http_port", 8888);
-// user_pref("network.proxy.share_proxy_settings", true);
-// user_pref("network.proxy.socks", "127.0.0.1");
-// user_pref("network.proxy.socks_port", 8888);
-// user_pref("network.proxy.ssl", "127.0.0.1");
-// user_pref("network.proxy.ssl_port", 8888);
-// user_pref("network.proxy.type", 4);
-HRESULT FirefoxProxyDetector::ParsePrefsFile(const TCHAR* name,
-                                             const TCHAR* file_path,
-                                             ProxyConfig* config) {
-  ASSERT1(name);
-  ASSERT1(file_path);
-  ASSERT1(config);
-
-  *config = ProxyConfig();
-  config->source = source();
-
-  // TODO(omaha): implement optimization not to parse the file again if it
-  // did not change.
-  UNREFERENCED_PARAMETER(name);
-
-  // There were issues in production where the code fails to allocate
-  // the 1MB memory buffer as it had been initially requested by a previous
-  // version of the code.
-  //
-  // The assert below is somehow flaky but useful to detect the unlikely cases
-  // when the prefs file can't be opened.
-  FileReader prefs_file;
-  const size_t kBufferSize = 0x10000;      // 64KB buffer.
-  HRESULT hr = prefs_file.Init(file_path, kBufferSize);
-  ASSERT1(SUCCEEDED(hr));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CString proxy_type;
-  CString proxy_config_url;
-  CString proxy_http_host;
-  CString proxy_http_port;
-  CString proxy_ssl_host;
-  CString proxy_ssl_port;
-
-  // For each line in the prefs.js, try to parse the proxy information out.
-  char line[1024] = {0};
-  while (SUCCEEDED(prefs_file.ReadLineAnsi(arraysize(line), line))) {
-    ParsePrefsLine(line,
-                   &proxy_type,
-                   &proxy_config_url,
-                   &proxy_http_host,
-                   &proxy_http_port,
-                   &proxy_ssl_host,
-                   &proxy_ssl_port);
-  }
-
-  // The default in FireFox is direct connection so it may be that the
-  // network.proxy.type is missing.
-  int type = PROXY_TYPE_NO_PROXY;
-  if (!proxy_type.IsEmpty() &&
-      !String_StringToDecimalIntChecked(proxy_type, &type)) {
-    return E_UNEXPECTED;
-  }
-
-  // Direct connection.
-  if (type == PROXY_TYPE_NO_PROXY) {
-    return S_OK;
-  }
-
-  // We look for both proxy auto-detect and proxy config url, to emulate
-  // the IE behavior, where when the auto-detect fails it defaults to the
-  // auto config url. Firefox remembers the auto config url even if not used,
-  // so it might not hurt to try it out.
-  if (type & PROXY_TYPE_AUTO_DETECT) {
-    config->auto_detect = true;
-  }
-  if ((type & PROXY_TYPE_AUTO_CONFIG_URL) && !proxy_config_url.IsEmpty()) {
-    UnenclosePath(&proxy_config_url);
-    config->auto_config_url = proxy_config_url;
-  }
-
-  // Named proxy.
-  if (!(type & PROXY_TYPE_NAMED_PROXY)) {
-    return S_OK;
-  }
-
-  CString proxy;
-  hr = BuildProxyString(proxy_http_host,
-                        proxy_http_port,
-                        proxy_ssl_host,
-                        proxy_ssl_port,
-                        &proxy);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  config->proxy = proxy;
-  return S_OK;
-}
-
-HRESULT FirefoxProxyDetector::BuildProxyString(const CString& proxy_http_host,
-                                               const CString& http_port,
-                                               const CString& proxy_ssl_host,
-                                               const CString& ssl_port,
-                                               CString* proxy) {
-  ASSERT1(proxy);
-
-  CString http_host = proxy_http_host;
-  CString ssl_host  = proxy_ssl_host;
-
-  // The host names in the prefs file are strings literals.
-  UnenclosePath(&http_host);
-  UnenclosePath(&ssl_host);
-
-  // Validate the port values.
-  if (!http_port.IsEmpty()) {
-    int http_port_num = 0;
-    if (!String_StringToDecimalIntChecked(http_port, &http_port_num) ||
-        http_port_num <= 0 &&
-        http_port_num > INTERNET_MAX_PORT_NUMBER_VALUE) {
-      return E_INVALIDARG;
-    }
-  }
-  if (!ssl_port.IsEmpty()) {
-    int ssl_port_num = 0;
-    if (!String_StringToDecimalIntChecked(ssl_port, &ssl_port_num) ||
-        ssl_port_num <= 0 ||
-        ssl_port_num > INTERNET_MAX_PORT_NUMBER_VALUE) {
-      return E_INVALIDARG;
-    }
-  }
-
-  // Format the proxy string.
-  CString str;
-  if (!http_host.IsEmpty()) {
-    SafeCStringAppendFormat(&str, _T("http=%s"), http_host);
-    if (!http_port.IsEmpty()) {
-      SafeCStringAppendFormat(&str, _T(":%s"), http_port);
-    }
-  }
-  if (!ssl_host.IsEmpty()) {
-    // Append a separator if needed.
-    if (!str.IsEmpty()) {
-      str += _T(';');
-    }
-    SafeCStringAppendFormat(&str, _T("https=%s"), ssl_host);
-    if (!ssl_port.IsEmpty()) {
-      SafeCStringAppendFormat(&str, _T(":%s"), ssl_port);
-    }
-  }
-
-  *proxy = str;
-  return S_OK;
-}
-
-// Parses a line from the prefs.js. An example of line to parse is:
-// user_pref("network.proxy.http", "foo");
-void FirefoxProxyDetector::ParsePrefsLine(const char* ansi_line,
-                                          CString* proxy_type,
-                                          CString* proxy_config_url,
-                                          CString* proxy_http_host,
-                                          CString* proxy_http_port,
-                                          CString* proxy_ssl_host,
-                                          CString* proxy_ssl_port) {
-  // Skip the lines that do not contain "network.proxy" to speed up the
-  // parsing. This is important for large prefs files.
-  if (strstr(ansi_line, "network.proxy.") == NULL) {
-    return;
-  }
-
-  AtlRE proxy_type_regex(_T("^\\b*user_pref\\b*\\(\\b*\\\"network\\.proxy\\.type\\\"\\b*,\\b*{\\d+}\\)"), false);                    // NOLINT
-  AtlRE proxy_config_url_regex(_T("^\\b*user_pref\\b*\\(\\b*\\\"network\\.proxy\\.autoconfig_url\\\"\\b*,\\b*{\\q}\\)"), false);     // NOLINT
-  AtlRE proxy_http_host_regex(_T("^\\b*user_pref\\b*\\(\\b*\\\"network\\.proxy\\.http\\\"\\b*,\\b*{\\q}\\)"), false);                // NOLINT
-  AtlRE proxy_http_port_regex(_T("^\\b*user_pref\\b*\\(\\b*\\\"network\\.proxy\\.http_port\\\"\\b*,\\b*{\\d+}\\)"), false);          // NOLINT
-  AtlRE proxy_ssl_host_regex(_T("^\\b*user_pref\\b*\\(\\b*\\\"network\\.proxy\\.ssl\\\"\\b*,\\b*{\\q}\\)"), false);                  // NOLINT
-  AtlRE proxy_ssl_port_regex(_T("^\\b*user_pref\\b*\\(\\b*\\\"network\\.proxy\\.ssl_port\\\"\\b*,\\b*{\\d+}\\)"), false);            // NOLINT
-
-  CString line(ansi_line);
-  if (AtlRE::PartialMatch(line, proxy_type_regex, proxy_type)) {
-    return;
-  }
-  if (AtlRE::PartialMatch(line, proxy_config_url_regex, proxy_config_url)) {
-    return;
-  }
-  if (AtlRE::PartialMatch(line, proxy_http_host_regex, proxy_http_host)) {
-    return;
-  }
-  if (AtlRE::PartialMatch(line, proxy_http_port_regex, proxy_http_port)) {
-    return;
-  }
-  if (AtlRE::PartialMatch(line, proxy_ssl_host_regex, proxy_ssl_host)) {
-    return;
-  }
-  if (AtlRE::PartialMatch(line, proxy_ssl_port_regex, proxy_ssl_port)) {
-    return;
-  }
-}
-
-HRESULT DefaultProxyDetector::Detect(ProxyConfig* config) {
-  ASSERT1(config);
-
-  scoped_ptr<HttpClient> http_client(CreateHttpClient());
-
-  // We expect to be able to instantiate either of the http clients.
-  ASSERT1(http_client.get());
-  if (!http_client.get()) {
-    return E_UNEXPECTED;
-  }
-  HRESULT hr = http_client->Initialize();
-  if (FAILED(hr)) {
-    return hr;
-  }
-  HttpClient::ProxyInfo proxy_info = {0};
-  hr = http_client->GetDefaultProxyConfiguration(&proxy_info);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  if (proxy_info.access_type == WINHTTP_ACCESS_TYPE_NAMED_PROXY) {
-    ProxyConfig proxy_config;
-    proxy_config.source = source();
-    proxy_config.proxy = proxy_info.proxy;
-    proxy_config.proxy_bypass = proxy_info.proxy_bypass;
-    *config = proxy_config;
-    return S_OK;
-  } else {
-    return E_FAIL;
-  }
-}
-
-HRESULT IEProxyDetector::Detect(ProxyConfig* config) {
-  ASSERT1(config);
-
-  // Internet Explorer proxy configuration is not available when running as
-  // local system.
-  if (user_info::IsRunningAsSystem()) {
-    return E_FAIL;
-  }
-
-  scoped_ptr<HttpClient> http_client(CreateHttpClient());
-
-  // We expect to be able to instantiate either of the http clients.
-  ASSERT1(http_client.get());
-  if (!http_client.get()) {
-    return E_UNEXPECTED;
-  }
-  HRESULT hr = http_client->Initialize();
-  if (FAILED(hr)) {
-    return hr;
-  }
-  HttpClient::CurrentUserIEProxyConfig ie_proxy_config = {0};
-  hr = http_client->GetIEProxyConfiguration(&ie_proxy_config);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  config->source = source();
-  config->auto_detect = ie_proxy_config.auto_detect;
-  config->auto_config_url = ie_proxy_config.auto_config_url;
-  config->proxy = ie_proxy_config.proxy;
-  config->proxy_bypass = ie_proxy_config.proxy_bypass;
-
-  // If IE is the default brower, promotes its proxy priority.
-  BrowserType browser_type(BROWSER_UNKNOWN);
-  if (SUCCEEDED(GetDefaultBrowserType(&browser_type)) &&
-      browser_type == BROWSER_IE) {
-    config->priority = ProxyConfig::PROXY_PRIORITY_DEFAULT_BROWSER;
-  }
-
-  ::GlobalFree(const_cast<TCHAR*>(ie_proxy_config.auto_config_url));
-  ::GlobalFree(const_cast<TCHAR*>(ie_proxy_config.proxy));
-  ::GlobalFree(const_cast<TCHAR*>(ie_proxy_config.proxy_bypass));
-
-  return S_OK;
-};
-
-}  // namespace omaha
-
diff --git a/net/detector.h b/net/detector.h
deleted file mode 100644
index fdbbef4..0000000
--- a/net/detector.h
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_NET_DETECTOR_H__
-#define OMAHA_NET_DETECTOR_H__
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-
-namespace omaha {
-
-struct ProxyConfig;
-
-class ProxyDetectorInterface {
- public:
-  // Detects proxy information.
-  virtual HRESULT Detect(ProxyConfig* config) = 0;
-  virtual const TCHAR* source() = 0;
-  virtual ~ProxyDetectorInterface() {}
-};
-
-// Detects proxy override information in the specified registry key.
-class RegistryOverrideProxyDetector : public ProxyDetectorInterface {
- public:
-  explicit RegistryOverrideProxyDetector(const CString& reg_path)
-      : reg_path_(reg_path) {}
-
-  virtual HRESULT Detect(ProxyConfig* config);
-  virtual const TCHAR* source() { return _T("RegistryOverride"); }
- private:
-  CString reg_path_;
-  DISALLOW_EVIL_CONSTRUCTORS(RegistryOverrideProxyDetector);
-};
-
-class UpdateDevProxyDetector : public ProxyDetectorInterface {
- public:
-   UpdateDevProxyDetector();
-  virtual HRESULT Detect(ProxyConfig* config) {
-    return registry_detector_.Detect(config);
-  }
-  virtual const TCHAR* source() { return _T("UpdateDev"); }
- private:
-  RegistryOverrideProxyDetector registry_detector_;
-  DISALLOW_EVIL_CONSTRUCTORS(UpdateDevProxyDetector);
-};
-
-// Detects winhttp proxy information. This is what the winhttp proxy
-// configuration utility (proxycfg.exe) has set.
-// The winhttp proxy settings are under:
-// HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections
-class DefaultProxyDetector : public ProxyDetectorInterface {
- public:
-  DefaultProxyDetector() {}
-  virtual HRESULT Detect(ProxyConfig* config);
-  virtual const TCHAR* source() { return _T("winhttp"); }
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(DefaultProxyDetector);
-};
-
-// Detects proxy information for Firefox.
-// http://www.mozilla.org/quality/networking/docs/netprefs.html
-// It works only when the calling code runs as or it impersonates a user.
-class FirefoxProxyDetector : public ProxyDetectorInterface {
- public:
-  enum ProxyType {
-    PROXY_TYPE_NO_PROXY         = 0,
-    PROXY_TYPE_NAMED_PROXY      = 1,
-    PROXY_TYPE_AUTO_CONFIG_URL  = 2,
-    PROXY_TYPE_AUTO_DETECT      = 4
-  };
-
-  FirefoxProxyDetector();
-
-  virtual HRESULT Detect(ProxyConfig* config);
-  virtual const TCHAR* source() { return _T("Firefox"); }
- private:
-  // Parses the prefs.js file.
-  HRESULT ParsePrefsFile(const TCHAR* name,
-                         const TCHAR* file_path,
-                         ProxyConfig* config);
-
-  // Parse one line of the prefs file.
-  void ParsePrefsLine(const char* ansi_line,
-                      CString* proxy_type,
-                      CString* proxy_config_url,
-                      CString* proxy_http_host,
-                      CString* proxy_http_port,
-                      CString* proxy_ssl_host,
-                      CString* proxy_ssl_port);
-
-  // Builds a proxy string out of individual components.
-  HRESULT BuildProxyString(const CString& http_host,
-                           const CString& http_port,
-                           const CString& ssl_host,
-                           const CString& ssl_port,
-                           CString* proxy);
-
-  // Cached configuration values for the current FF profile.
-  CString            cached_prefs_name_;
-  CString            cached_prefs_file_path_;
-  int64              cached_prefs_last_modified_;
-  scoped_ptr<ProxyConfig> cached_config_;
-
-  friend class FirefoxProxyDetectorTest;
-  DISALLOW_EVIL_CONSTRUCTORS(FirefoxProxyDetector);
-};
-
-// Detects wininet proxy information for the current user. The caller must
-// run as user to retrieve the correct information.
-// It works only when the calling code runs as or it impersonates a user.
-class IEProxyDetector : public ProxyDetectorInterface {
- public:
-  IEProxyDetector() {}
-  virtual HRESULT Detect(ProxyConfig* config);
-  virtual const TCHAR* source() { return _T("IE"); }
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(IEProxyDetector);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_NET_DETECTOR_H__
-
diff --git a/net/detector_unittest.cc b/net/detector_unittest.cc
deleted file mode 100644
index ba14875..0000000
--- a/net/detector_unittest.cc
+++ /dev/null
@@ -1,326 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <cstdio>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/browser_utils.h"
-#include "omaha/net/detector.h"
-#include "omaha/net/network_config.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-class FirefoxProxyDetectorTest : public testing::Test {
- public:
-  FirefoxProxyDetectorTest() {}
-
-  virtual void SetUp() {
-    detector_.reset(new FirefoxProxyDetector);
-  }
-
-  virtual void TearDown() {
-  }
-
-  HRESULT BuildProxyString(const CString& http_host,
-                           const CString& http_port,
-                           const CString& ssl_host,
-                           const CString& ssl_port,
-                           CString* proxy) {
-    return detector_->BuildProxyString(http_host,
-                                       http_port,
-                                       ssl_host,
-                                       ssl_port,
-                                       proxy);
-  }
-
-  void ParsePrefsLine(const char* ansi_line,
-                      CString* proxy_type,
-                      CString* proxy_config_url,
-                      CString* proxy_http_host,
-                      CString* proxy_http_port,
-                      CString* proxy_ssl_host,
-                      CString* proxy_ssl_port) {
-    detector_->ParsePrefsLine(ansi_line,
-                              proxy_type,
-                              proxy_config_url,
-                              proxy_http_host,
-                              proxy_http_port,
-                              proxy_ssl_host,
-                              proxy_ssl_port);
-  }
-
-
-  HRESULT ParsePrefsFile(const TCHAR* name,
-                         const TCHAR* file_path,
-                         ProxyConfig* config) {
-    return detector_->ParsePrefsFile(name, file_path, config);
-  }
-
-  // Builds a mock prefs file to test the parsing code.
-  bool BuildPrefsFile(const CString& type,
-                      const CString& config_url,
-                      const CString& http_host,
-                      const CString& http_port,
-                      const CString& ssl_host,
-                      const CString& ssl_port,
-                      CString* file_path);
-
-  scoped_ptr<FirefoxProxyDetector> detector_;
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(FirefoxProxyDetectorTest);
-};
-
-bool FirefoxProxyDetectorTest::BuildPrefsFile(const CString& type,
-                                              const CString& config_url,
-                                              const CString& http_host,
-                                              const CString& http_port,
-                                              const CString& ssl_host,
-                                              const CString& ssl_port,
-                                              CString* file_path) {
-  CString temp_dir(app_util::GetTempDir());
-  file_path->Format(_T("%somaha_test_%x.js"), temp_dir, ::GetTickCount());
-
-  FILE* prefs_file = NULL;
-  fopen_s(&prefs_file, CStringA(*file_path), "w");
-  if (!prefs_file) {
-    return false;
-  }
-
-  fprintf(prefs_file,
-          "user_pref(\"network.proxy.type\", %s);\n",
-          CStringA(type));
-  fprintf(prefs_file,
-          "user_pref(\"network.proxy.autoconfig_url\", \"%s\");\n",
-          CStringA(config_url));
-  fprintf(prefs_file,
-          "user_pref(\"network.proxy.http\", \"%s\");\n",
-          CStringA(http_host));
-  fprintf(prefs_file,
-          "user_pref(\"network.proxy.http_port\", %s);\n",
-          CStringA(http_port));
-  fprintf(prefs_file,
-          "user_pref(\"network.proxy.ssl\", \"%s\");\n",
-          CStringA(ssl_host));
-  fprintf(prefs_file,
-          "user_pref(\"network.proxy.ssl_port\", %s);\n",
-          CStringA(ssl_port));
-
-  fclose(prefs_file);
-
-  return true;
-}
-
-TEST_F(FirefoxProxyDetectorTest, BuildProxyString) {
-  CString http_host = _T("foo");
-  CString http_port = _T("80");
-  CString ssl_host;
-  CString ssl_port;
-  CString proxy;
-
-  EXPECT_SUCCEEDED(BuildProxyString(http_host,
-                                    http_port,
-                                    ssl_host,
-                                    ssl_port,
-                                    &proxy));
-  EXPECT_STREQ(proxy, _T("http=foo:80"));
-
-  http_host = _T("foo");
-  http_port = _T("80");
-  ssl_host  = _T("bar");
-  ssl_port  = _T("8080");
-
-  EXPECT_SUCCEEDED(BuildProxyString(http_host,
-                                    http_port,
-                                    ssl_host,
-                                    ssl_port,
-                                    &proxy));
-  EXPECT_STREQ(proxy, _T("http=foo:80;https=bar:8080"));
-
-  http_host.Empty();
-  http_port.Empty();
-  ssl_host  = _T("bar");
-  ssl_port  = _T("8080");
-
-  EXPECT_SUCCEEDED(BuildProxyString(http_host,
-                                    http_port,
-                                    ssl_host,
-                                    ssl_port,
-                                    &proxy));
-  EXPECT_STREQ(proxy, _T("https=bar:8080"));
-}
-
-TEST_F(FirefoxProxyDetectorTest, ParsePrefsLine) {
-  CString type;
-  CString config_url;
-  CString http_host;
-  CString http_port;
-  CString ssl_host;
-  CString ssl_port;
-
-  // Parse "type".
-  const char* ansi_line = "user_pref(\"network.proxy.type\", 4);";
-  ParsePrefsLine(ansi_line,
-                 &type,
-                 &config_url,
-                 &http_host,
-                 &http_port,
-                 &ssl_host,
-                 &ssl_port);
-  EXPECT_STREQ(type, _T("4"));
-
-  // Parse "config_url".
-  ansi_line =
-      "user_pref(\"network.proxy.autoconfig_url\", \"http://wpad/wpad.dat\");";
-  ParsePrefsLine(ansi_line,
-                 &type,
-                 &config_url,
-                 &http_host,
-                 &http_port,
-                 &ssl_host,
-                 &ssl_port);
-  EXPECT_STREQ(config_url, _T("\"http://wpad/wpad.dat\""));
-
-  // Parse "http_host".
-  ansi_line = "user_pref(\"network.proxy.http\", \"127.0.0.1\");";
-  ParsePrefsLine(ansi_line,
-                 &type,
-                 &config_url,
-                 &http_host,
-                 &http_port,
-                 &ssl_host,
-                 &ssl_port);
-  EXPECT_STREQ(http_host, _T("\"127.0.0.1\""));
-
-  // Parse "http_port".
-  ansi_line = "user_pref(\"network.proxy.http_port\", 8888);";
-  ParsePrefsLine(ansi_line,
-                 &type,
-                 &config_url,
-                 &http_host,
-                 &http_port,
-                 &ssl_host,
-                 &ssl_port);
-  EXPECT_STREQ(http_port, _T("8888"));
-
-  // Parse "ssl_host".
-  ansi_line = "user_pref(\"network.proxy.ssl\", \"10.0.0.1\");";
-  ParsePrefsLine(ansi_line,
-                 &type,
-                 &config_url,
-                 &http_host,
-                 &http_port,
-                 &ssl_host,
-                 &ssl_port);
-  EXPECT_STREQ(ssl_host, _T("\"10.0.0.1\""));
-
-  // Parse "ssl_port".
-  ansi_line = "user_pref(\"network.proxy.ssl_port\", 8080);";
-  ParsePrefsLine(ansi_line,
-                 &type,
-                 &config_url,
-                 &http_host,
-                 &http_port,
-                 &ssl_host,
-                 &ssl_port);
-  EXPECT_STREQ(ssl_port, _T("8080"));
-}
-
-TEST_F(FirefoxProxyDetectorTest, ParsePrefsFile) {
-  // Direct connection
-  CString prefs_file;
-  bool res = BuildPrefsFile(_T("0"),
-                            _T("http://foobar"),
-                            _T("foo"),
-                            _T("80"),
-                            _T("bar"),
-                            _T("8080"),
-                            &prefs_file);
-  ASSERT_TRUE(res);
-  ProxyConfig config;
-  EXPECT_SUCCEEDED(ParsePrefsFile(_T(""), prefs_file, &config));
-  EXPECT_FALSE(config.auto_detect);
-  EXPECT_TRUE(config.auto_config_url.IsEmpty());
-  EXPECT_TRUE(config.proxy.IsEmpty());
-  EXPECT_TRUE(config.proxy_bypass.IsEmpty());
-  EXPECT_TRUE(::DeleteFile(prefs_file));
-
-  // Named proxy.
-  res = BuildPrefsFile(_T("1"),
-                       _T("http://foobar"),
-                       _T("foo"),
-                       _T("80"),
-                       _T("bar"),
-                       _T("8080"),
-                       &prefs_file);
-  ASSERT_TRUE(res);
-  config = ProxyConfig();
-  EXPECT_SUCCEEDED(ParsePrefsFile(_T(""), prefs_file, &config));
-  EXPECT_FALSE(config.auto_detect);
-  EXPECT_TRUE(config.auto_config_url.IsEmpty());
-  EXPECT_STREQ(config.proxy, _T("http=foo:80;https=bar:8080"));
-  EXPECT_TRUE(config.proxy_bypass.IsEmpty());
-  EXPECT_TRUE(::DeleteFile(prefs_file));
-
-  // Auto config url.
-  res = BuildPrefsFile(_T("2"),
-                       _T("http://foobar"),
-                       _T("foo"),
-                       _T("80"),
-                       _T("bar"),
-                       _T("8080"),
-                       &prefs_file);
-  ASSERT_TRUE(res);
-  config = ProxyConfig();
-  EXPECT_SUCCEEDED(ParsePrefsFile(_T(""), prefs_file, &config));
-  EXPECT_FALSE(config.auto_detect);
-  EXPECT_STREQ(config.auto_config_url, _T("http://foobar"));
-  EXPECT_TRUE(config.proxy.IsEmpty());
-  EXPECT_TRUE(config.proxy_bypass.IsEmpty());
-  EXPECT_TRUE(::DeleteFile(prefs_file));
-
-  // Auto detect.
-  res = BuildPrefsFile(_T("4"),
-                       _T("http://foobar"),
-                       _T("foo"),
-                       _T("80"),
-                       _T("bar"),
-                       _T("8080"),
-                       &prefs_file);
-  ASSERT_TRUE(res);
-  config = ProxyConfig();
-  EXPECT_SUCCEEDED(ParsePrefsFile(_T(""), prefs_file, &config));
-  EXPECT_TRUE(config.auto_detect);
-  EXPECT_TRUE(config.auto_config_url.IsEmpty());
-  EXPECT_TRUE(config.proxy.IsEmpty());
-  EXPECT_TRUE(config.proxy_bypass.IsEmpty());
-  EXPECT_TRUE(::DeleteFile(prefs_file));
-}
-
-// Tries to detect the configuration if a profile is available.
-TEST_F(FirefoxProxyDetectorTest, Detect) {
-  CString name, path;
-  if (FAILED(GetFirefoxDefaultProfile(&name, &path))) {
-    return;
-  }
-  ProxyConfig config;
-  EXPECT_SUCCEEDED(detector_->Detect(&config));
-}
-
-}  // namespace omaha
-
diff --git a/net/http_client.cc b/net/http_client.cc
deleted file mode 100644
index 3fec183..0000000
--- a/net/http_client.cc
+++ /dev/null
@@ -1,169 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-//
-// The code below is not thread safe.
-
-#include "omaha/net/http_client.h"
-
-#include "omaha/base/debug.h"
-#include "omaha/base/safe_format.h"
-
-namespace omaha {
-
-HttpClient::Factory* HttpClient::factory_ = NULL;
-
-HttpClient::Factory& HttpClient::GetFactory() {
-  if (!factory_) {
-    factory_ = new Factory();
-  }
-  return *factory_;
-}
-
-void HttpClient::DeleteFactory() {
-  delete factory_;
-  factory_ = NULL;
-}
-
-HttpClient* CreateHttpClient() {
-  HttpClient* http_client =
-    HttpClient::GetFactory().CreateObject(HttpClient::WINHTTP);
-  if (!http_client) {
-    http_client = HttpClient::GetFactory().CreateObject(HttpClient::WININET);
-  }
-  return http_client;
-}
-
-CString HttpClient::BuildRequestHeader(const TCHAR* name, const TCHAR* value) {
-  ASSERT1(name && *name);
-  ASSERT1(value && *value);
-  CString header;
-  SafeCStringFormat(&header, _T("%s: %s\r\n"), name, value);
-  return header;
-}
-
-HttpClient::StatusCodeClass HttpClient::GetStatusCodeClass(int status_code) {
-  ASSERT1(!status_code ||
-      (HTTP_STATUS_FIRST <= status_code && status_code <= HTTP_STATUS_LAST));
-  return static_cast<StatusCodeClass>(status_code / 100 * 100);
-}
-
-HRESULT HttpClient::QueryHeadersString(HINTERNET request_handle,
-                                       uint32 info_level,
-                                       const TCHAR* name,
-                                       CString* value,
-                                       DWORD* index) {
-  ASSERT1(value);
-
-  DWORD num_bytes = 0;
-  HRESULT hr = QueryHeaders(request_handle,
-                            info_level,
-                            name,
-                            NULL,
-                            &num_bytes,
-                            index);
-  if (hr != HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) {
-    return hr;
-  }
-  CString val;
-  hr = QueryHeaders(request_handle,
-                    info_level,
-                    name,
-                    val.GetBuffer(num_bytes/sizeof(TCHAR)),
-                    &num_bytes,
-                    index);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  ASSERT1(num_bytes);
-  val.ReleaseBufferSetLength(num_bytes/sizeof(TCHAR));
-  *value = val;
-  return S_OK;
-}
-
-HRESULT HttpClient::QueryHeadersInt(HINTERNET request_handle,
-                                    uint32 info_level,
-                                    const TCHAR* name,
-                                    int* value,
-                                    DWORD* index) {
-  ASSERT1(value);
-  info_level |= WINHTTP_QUERY_FLAG_NUMBER;
-  DWORD value_size = sizeof(*value);
-  HRESULT hr = QueryHeaders(request_handle,
-                            info_level,
-                            name,
-                            value,
-                            &value_size,
-                            index);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  ASSERT1(value_size == sizeof(*value));
-  return S_OK;
-}
-
-HRESULT HttpClient::QueryOptionString(HINTERNET handle,
-                                      uint32 option,
-                                      CString* value) {
-  ASSERT1(value);
-  DWORD num_bytes = 0;
-  HRESULT hr = QueryOption(handle, option, NULL, &num_bytes);
-  DWORD last_error = ::GetLastError();
-  if (hr != HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) {
-    return hr;
-  }
-  ASSERT1(num_bytes);
-  CString val;
-  hr = QueryOption(handle, option, val.GetBuffer(num_bytes), &num_bytes);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  ASSERT1(num_bytes);
-  val.ReleaseBufferSetLength(num_bytes/sizeof(TCHAR));
-  *value = val;
-  return S_OK;
-}
-
-HRESULT HttpClient::QueryOptionInt(HINTERNET handle,
-                                   uint32 option,
-                                   int* value) {
-  ASSERT1(value);
-  DWORD val = 0;
-  DWORD num_bytes = sizeof(val);
-  HRESULT hr = QueryOption(handle, option, &val, &num_bytes);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  ASSERT1(num_bytes == sizeof(val));
-  *value = val;
-  return S_OK;
-}
-
-HRESULT HttpClient::SetOptionString(HINTERNET handle,
-                                    uint32 option,
-                                    const TCHAR* value) {
-  ASSERT1(value);
-  const void* buffer = value;
-  DWORD buffer_length = _tcslen(value) * sizeof(TCHAR);
-  return SetOption(handle, option, buffer, buffer_length);
-}
-
-HRESULT HttpClient::SetOptionInt(HINTERNET handle, uint32 option, int value) {
-  DWORD val = value;
-  return SetOption(handle, option, &val, sizeof(val));
-}
-
-}  // namespace omaha
-
diff --git a/net/http_client.h b/net/http_client.h
deleted file mode 100644
index 833f154..0000000
--- a/net/http_client.h
+++ /dev/null
@@ -1,349 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-//
-// HttpClient provides a wrapper for WinHTTP and some helpers to make it
-// easy to call it from c++.
-
-// Runtime requirements: WinHTTP 5.1 is now an operating-system component of
-// the following systems:
-// - Windows Vista
-// - Windows Server 2003 family
-// - Windows XP SP1
-// - Windows 2000 SP3 (except Datacenter Server)
-//
-// TODO(omaha): fix prototype of several methods to take size_t instead of int
-// TODO(omaha): there are many overloads that do not have to be virtual.
-// TODO(omaha): in the end HttpClient is just a c++ wrapper for WinHttp. Some
-//              refactoring may be needed, for example to provide access to
-//              the internal session and connection handles. It may make sense
-//              to reuse these handles, most likely the session handle.
-// TODO(omaha): the idea of implementing the winhttp interface on top of
-//              wininet seems impractical now, as they may be subtle
-//              differences in behavior. The fallback on wininet when winhttp
-//              is not available could be better done by using the higher
-//              level urlmon functions, which perhaps we should do anyway,
-//              just in case winhttp is not working for some reason or bug.
-//              Since now we are not doing downloads in any of our long lived
-//              processes, the handle and memory leaks do not affect us much.
-
-#ifndef OMAHA_NET_HTTP_CLIENT_H__
-#define OMAHA_NET_HTTP_CLIENT_H__
-
-#include <windows.h>
-#include <atlstr.h>
-
-#if !defined(_WININET_)
-#include <winhttp.h>    // NOLINT
-
-  // The following definitions are missing in winhttp.h
-#define INTERNET_MAX_HOST_NAME_LENGTH   256
-#define INTERNET_MAX_USER_NAME_LENGTH   128
-#define INTERNET_MAX_PASSWORD_LENGTH    128
-#define INTERNET_MAX_PORT_NUMBER_LENGTH 5
-#define INTERNET_MAX_PORT_NUMBER_VALUE  65535
-#define INTERNET_MAX_PATH_LENGTH        2048
-#define INTERNET_MAX_SCHEME_LENGTH      32
-#define INTERNET_MAX_URL_LENGTH         (INTERNET_MAX_SCHEME_LENGTH \
-                                        + sizeof("://") \
-                                        + INTERNET_MAX_PATH_LENGTH)
-#endif
-
-// This is a definition we made up for convenience, just to be consistent with
-// the other types of network access.
-#define WINHTTP_ACCESS_TYPE_AUTO_DETECT 2
-
-#include "base/basictypes.h"
-#include "omaha/base/object_factory.h"
-
-namespace omaha {
-
-const TCHAR* const kHttpGetMethod = _T("GET");
-const TCHAR* const kHttpPostMethod = _T("POST");
-const TCHAR* const kHttpContentLengthHeader = _T("Content-Length");
-const TCHAR* const kHttpContentTypeHeader = _T("Content-Type");
-const TCHAR* const kHttpLastModifiedHeader = _T("Last-Modified");
-const TCHAR* const kHttpIfModifiedSinceHeader = _T("If-Modified-Since");
-const TCHAR* const kHttpPostTextContentType =
-                _T("application/x-www-form-urlencoded");
-const TCHAR* const kHttpPostRawContentType = _T("application/octet-stream");
-const TCHAR* const kHttpBinaryContentType =_T("binary");
-const TCHAR* const kHttpXmlContentType =_T("application/xml");
-
-class HttpClient {
- public:
-  enum HttpStack {WINHTTP, WININET};
-
-  // Use registry for network configuration info.
-  static const int kAccessTypeDefaultProxy  = 0;
-  // Unconditional direct connection.
-  static const int kAccessTypeNoProxy       = 1;
-  // Use the specified proxy server.
-  static const int kAccessTypeNamedProxy    = 3;
-
-  // GetFactory and DeleteFactory methods below are not thread safe.
-  // The caller must initialize and cleanup the factory before going
-  // multithreaded.
-  //
-  // Gets the singleton instance of the object factory.
-  typedef Factory<HttpClient, HttpStack> Factory;
-  static Factory& GetFactory();
-
-  // Cleans up the object factory.
-  static void DeleteFactory();
-
-  struct ProxyInfo {
-    uint32 access_type;
-    const TCHAR* proxy;
-    const TCHAR* proxy_bypass;
-  };
-
-  struct CurrentUserIEProxyConfig {
-    bool auto_detect;
-    const TCHAR* auto_config_url;
-    const TCHAR* proxy;
-    const TCHAR* proxy_bypass;
-  };
-
-  struct AutoProxyOptions {
-    uint32 flags;
-    uint32 auto_detect_flags;
-    const TCHAR* auto_config_url;
-    bool auto_logon_if_challenged;
-  };
-
-  virtual ~HttpClient() {}
-
-  // Initializes the use of http functions by loading the corresponding http
-  // stack.
-  virtual HRESULT Initialize() = 0;
-
-  // Adds one or more http request headers to the http request.
-  virtual HRESULT AddRequestHeaders(HINTERNET request,
-                                    const TCHAR* headers,
-                                    int length,
-                                    uint32 modifiers) = 0;
-
-  // Determines whether WinHTTP is available.
-  virtual HRESULT CheckPlatform() = 0;
-
-  // Closes an http handle.
-  virtual HRESULT Close(HINTERNET handle) = 0;
-
-  // Specifies the initial server and port of an http request.
-  virtual HRESULT Connect(HINTERNET session_handle,
-                          const TCHAR* server,
-                          int port,
-                          HINTERNET* connection_handle) = 0;
-
-  // Breaks urls into component parts.
-  virtual HRESULT CrackUrl(const TCHAR* url,
-                           uint32 flags,
-                           CString* scheme,
-                           CString* server,
-                           int* port,
-                           CString* url_path,
-                           CString* extra_info) = 0;
-
-  // Builds a url from component parts.
-  virtual HRESULT CreateUrl(const TCHAR* scheme,
-                            const TCHAR* server,
-                            int port,
-                            const TCHAR* url_path,
-                            const TCHAR* extra_info,
-                            uint32 flags,
-                            CString* url) = 0;
-
-
-  // Finds the url for the proxy auto-configuration (PAC) file.
-  // It reports the url of the PAC file but it does not download the file.
-  virtual HRESULT DetectAutoProxyConfigUrl(uint32 flags,
-                                           CString* auto_config_url) = 0;
-
-  // Gets the proxy configuration from the registry.
-  virtual HRESULT GetDefaultProxyConfiguration(ProxyInfo* proxy_info) = 0;
-
-  // Gets the Internet Explorer configuration for the current user.
-  virtual HRESULT GetIEProxyConfiguration(
-                      CurrentUserIEProxyConfig* proxy_info) = 0;
-
-  // Gets the proxy information for an url. This function implements the
-  // web proxy auto-discovery (WPAD) protocol for automatically configuring
-  // the proxy settings for an http request. The WPAD protocol downloads a
-  // proxy auto-configuration (PAC) file, which is a script that identifies
-  // the proxy server to use for a given target url.
-  virtual HRESULT GetProxyForUrl(HINTERNET session_handle,
-                                 const TCHAR* url,
-                                 const AutoProxyOptions* auto_proxy_options,
-                                 ProxyInfo* proxy_info) = 0;
-
-  // Opens a new http session. The http session contains user specific state
-  // such as cookies, proxy, and authentication credentials.
-  virtual HRESULT Open(const TCHAR* user_agent,
-                       uint32 access_type,
-                       const TCHAR* proxy_name,
-                       const TCHAR* proxy_bypass,
-                       DWORD flags,
-                       HINTERNET* session_handle) = 0;
-
-  // Specifies the http request.
-  virtual HRESULT OpenRequest(HINTERNET connection_handle,
-                              const TCHAR* verb,
-                              const TCHAR* uri,
-                              const TCHAR* version,
-                              const TCHAR* referrer,
-                              const TCHAR** accept_types,
-                              uint32 flags,
-                              HINTERNET* request_handle) = 0;
-
-  // Returns the authorization schemes that are supported by the server or
-  // the proxy server.
-  virtual HRESULT QueryAuthSchemes(HINTERNET request_handle,
-                                   uint32* supported_schemes,
-                                   uint32* first_scheme,
-                                   uint32* auth_target) = 0;
-
-  // Returns the amount of data, in bytes, available to be read.
-  virtual HRESULT QueryDataAvailable(HINTERNET request_handle,
-                                     DWORD* num_bytes) = 0;
-
-  // Retrieves header information associated with the request.
-  virtual HRESULT QueryHeaders(HINTERNET request_handle,
-                               uint32 info_level,
-                               const TCHAR* name,
-                               void* buffer,
-                               DWORD* buffer_length,
-                               DWORD* index) = 0;
-
-  // Queries an internet option.
-  virtual HRESULT QueryOption(HINTERNET handle,
-                              uint32 option,
-                              void* buffer,
-                              DWORD* buffer_length) = 0;
-
-  // Reads response data.
-  virtual HRESULT ReadData(HINTERNET request_handle,
-                           void* buffer,
-                           DWORD buffer_length,
-                           DWORD* bytes_read) = 0;
-
-  // Waits to receive the response to an HTTP request. When ReceiveResponse
-  // completes successfully, the status code and response headers have been
-  // received.
-  virtual HRESULT ReceiveResponse(HINTERNET request_handle) = 0;
-
-  // Sends the request to the server. It also allows to send optional data
-  // for POST requests.
-  virtual HRESULT SendRequest(HINTERNET request_handle,
-                              const TCHAR* headers,
-                              DWORD headers_length,
-                              const void* optional_data,
-                              DWORD optional_data_length,
-                              DWORD content_length,
-                              DWORD_PTR context) = 0;
-
-  // Sets the authentication credentials.
-  virtual HRESULT SetCredentials(HINTERNET request_handle,
-                                 uint32 auth_targets,
-                                 uint32 auth_scheme,
-                                 const TCHAR* user_name,
-                                 const TCHAR* password) = 0;
-
-  // Sets the proxy configuration in registry.
-  virtual HRESULT SetDefaultProxyConfiguration(const ProxyInfo& proxy_info) = 0;
-
-  // Sets an internet option, either for the session or the request handle.
-  virtual HRESULT SetOption(HINTERNET handle,
-                            uint32 option,
-                            const void* buffer,
-                            DWORD buffer_length) = 0;
-
-  typedef void (__stdcall *StatusCallback)(HINTERNET handle,
-                                           uint32 context,
-                                           uint32 status,
-                                           void* status_information,
-                                           size_t status_info_length);
-  virtual StatusCallback SetStatusCallback(HINTERNET handle,
-                                           StatusCallback callback,
-                                           uint32 flags) = 0;
-
-  // Sets timeout values for this http request.
-  virtual HRESULT SetTimeouts(HINTERNET handle,
-                              int resolve_timeout_ms,
-                              int connect_timeout_ms,
-                              int send_timeout_ms,
-                              int receive_timeout_ms) = 0;
-
-  // Writes data to the server.
-  virtual HRESULT WriteData(HINTERNET request_handle,
-                            const void* buffer,
-                            DWORD bytes_to_write,
-                            DWORD* bytes_written) = 0;
-
-  //
-  // Http helpers.
-  //
-  // Builds one http header entry, with the following format:
-  //    name: value\r\n
-  static CString BuildRequestHeader(const TCHAR* name, const TCHAR* value);
-
-  enum StatusCodeClass {
-    STATUS_CODE_NOCODE        = 0,
-    STATUS_CODE_INFORMATIONAL = 100,
-    STATUS_CODE_SUCCESSFUL    = 200,
-    STATUS_CODE_REDIRECTION   = 300,
-    STATUS_CODE_CLIENT_ERROR  = 400,
-    STATUS_CODE_SERVER_ERROR  = 500
-  };
-  // Returns the class of a status code, such as 100, 200...
-  static StatusCodeClass GetStatusCodeClass(int status_code);
-
-  HRESULT QueryHeadersString(HINTERNET request_handle,
-                             uint32 info_level,
-                             const TCHAR* name,
-                             CString* value,
-                             DWORD* index);
-  HRESULT QueryHeadersInt(HINTERNET request_handle,
-                          uint32 info_level,
-                          const TCHAR* name,
-                          int* value,
-                          DWORD* index);
-
-  HRESULT QueryOptionString(HINTERNET handle, uint32 option, CString* value);
-  HRESULT QueryOptionInt(HINTERNET handle, uint32 option, int* value);
-
-  HRESULT SetOptionString(HINTERNET handle, uint32 option, const TCHAR* value);
-  HRESULT SetOptionInt(HINTERNET handle, uint32 option, int value);
-
- protected:
-  HttpClient() {}
-
- private:
-  static Factory* factory_;
-  DISALLOW_EVIL_CONSTRUCTORS(HttpClient);
-};
-
-// Creates an http client, depending on what is available on the platform.
-// WinHttp is preferred over WinInet.
-HttpClient* CreateHttpClient();
-
-const HttpClient::StatusCallback kInvalidStatusCallback =
-    reinterpret_cast<HttpClient::StatusCallback>(
-        WINHTTP_INVALID_STATUS_CALLBACK);
-
-}  // namespace omaha
-
-#endif  // OMAHA_NET_HTTP_CLIENT_H__
-
diff --git a/net/http_client_unittest.cc b/net/http_client_unittest.cc
deleted file mode 100644
index 038a464..0000000
--- a/net/http_client_unittest.cc
+++ /dev/null
@@ -1,245 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Since the net code is linked in as a lib, force the registration code to
-// be a dependency, otherwise the linker is optimizing in out.
-#pragma comment(linker, "/INCLUDE:_kRegisterWinHttp")
-
-#include <vector>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/net/http_client.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-// Test fixture, perhaps we need it later.
-class HttpClientTest : public testing::Test {
- protected:
-  HttpClientTest() {}
-
-  static void SetUpTestCase() {}
-
-  virtual void SetUp() {
-    http_client_.reset(
-        HttpClient::GetFactory().CreateObject(HttpClient::WINHTTP));
-    ASSERT_TRUE(http_client_.get());
-    ASSERT_SUCCEEDED(http_client_->Initialize());
-  }
-
-  virtual void TearDown() {
-    http_client_.reset();
-  }
-
-  void GetUrl(const TCHAR* url, bool use_proxy);
-
-  scoped_ptr<HttpClient> http_client_;
-};
-
-CString BuildUserAgent() {
-  CString user_agent;
-  user_agent.Format(_T("HttpClientTest version %s"), omaha::GetVersionString());
-  return user_agent;
-}
-
-const TCHAR kTestUrlGet[]       = _T("http://www.google.com/robots.txt");
-const TCHAR kTestSecureUrlGet[] = _T("https://www.google.com/robots.txt");
-
-// If using a proxy is specified, the function does WPAD detection to get the
-// name of the proxy to be used. The request goes direct if the WPAD fails.
-void HttpClientTest::GetUrl(const TCHAR* url, bool use_proxy) {
-  ASSERT_TRUE(url);
-
-  CString server, path;
-  int port = 0;
-  ASSERT_SUCCEEDED(http_client_->CrackUrl(url,
-                                          ICU_DECODE,
-                                          NULL,
-                                          &server,
-                                          &port,
-                                          &path,
-                                          NULL));
-  ASSERT_STREQ(server, _T("www.google.com"));
-  ASSERT_STREQ(path, _T("/robots.txt"));
-
-  HINTERNET session_handle = NULL;
-  ASSERT_SUCCEEDED(http_client_->Open(BuildUserAgent(),
-                                      HttpClient::kAccessTypeNoProxy,
-                                      NULL,
-                                      NULL,
-                                      0,    // Synchronous mode.
-                                      &session_handle));
-  if (use_proxy) {
-    HttpClient::AutoProxyOptions autoproxy_options = {0};
-    autoproxy_options.flags = WINHTTP_AUTOPROXY_AUTO_DETECT;
-    autoproxy_options.auto_detect_flags = WINHTTP_AUTO_DETECT_TYPE_DHCP |
-                                          WINHTTP_AUTO_DETECT_TYPE_DNS_A;
-    autoproxy_options.auto_logon_if_challenged = true;
-    HttpClient::ProxyInfo proxy_info = {0};
-    http_client_->GetProxyForUrl(session_handle,
-                                 url,
-                                 &autoproxy_options,
-                                 &proxy_info);
-    if (proxy_info.proxy && wcslen(proxy_info.proxy)) {
-      proxy_info.access_type = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
-      EXPECT_SUCCEEDED(http_client_->SetOption(session_handle,
-                                               WINHTTP_OPTION_PROXY,
-                                               &proxy_info,
-                                               sizeof(proxy_info)));
-    }
-    ::GlobalFree(const_cast<wchar_t*>(proxy_info.proxy));
-    ::GlobalFree(const_cast<wchar_t*>(proxy_info.proxy_bypass));
-  }
-
-  HINTERNET connection_handle = NULL;
-  ASSERT_SUCCEEDED(http_client_->Connect(session_handle,
-                                         server,
-                                         port,
-                                         &connection_handle));
-  uint32 flags = port == 443 ? WINHTTP_FLAG_SECURE : 0;
-  HINTERNET request_handle = NULL;
-  ASSERT_SUCCEEDED(http_client_->OpenRequest(connection_handle,
-                                             _T("GET"),
-                                             path,
-                                             NULL,     // HTTP 1.1
-                                             NULL,     // Referrer.
-                                             NULL,     // Default accept types.
-                                             flags,
-                                             &request_handle));
-  ASSERT_SUCCEEDED(http_client_->SendRequest(request_handle,
-                                             NULL, 0, NULL, 0, 0, 0));
-  ASSERT_SUCCEEDED(http_client_->ReceiveResponse(request_handle));
-  CString content_type;
-  EXPECT_SUCCEEDED(http_client_->QueryHeadersString(request_handle,
-                                                    WINHTTP_QUERY_CONTENT_TYPE,
-                                                    NULL,
-                                                    &content_type,
-                                                    NULL));
-  EXPECT_STREQ(content_type, _T("text/plain"));
-  CString server_header;
-  EXPECT_SUCCEEDED(http_client_->QueryHeadersString(request_handle,
-                                                    WINHTTP_QUERY_SERVER,
-                                                    NULL,
-                                                    &server_header,
-                                                    NULL));
-  CString response;
-  DWORD size = 0;
-  do {
-    // Use ReadData to determine when a response has been completely read.
-    // Always allocate a buffer for ReadData even though QueryDataAvailable
-    // might return 0 bytes available.
-    ASSERT_SUCCEEDED(http_client_->QueryDataAvailable(request_handle, &size));
-    std::vector<uint8> buf(size + 1);
-    ASSERT_SUCCEEDED(http_client_->ReadData(request_handle,
-                                            &buf.front(),
-                                            buf.size(),
-                                            &size));
-    buf.resize(size);
-    if (size) {
-      response += CString(reinterpret_cast<char*>(&buf.front()), buf.size());
-    }
-  } while (size > 0);
-
-  // Compare a little bit of the body.
-  response.Truncate(10);
-  ASSERT_STREQ(response, _T("User-agent"));
-
-  ASSERT_SUCCEEDED(http_client_->Close(request_handle));
-  ASSERT_SUCCEEDED(http_client_->Close(connection_handle));
-  ASSERT_SUCCEEDED(http_client_->Close(session_handle));
-}
-
-TEST_F(HttpClientTest, Get) {
-  if (IsTestRunByLocalSystem()) {
-    return;
-  }
-
-  GetUrl(kTestUrlGet, false);
-}
-
-TEST_F(HttpClientTest, SecureGet) {
-  if (IsTestRunByLocalSystem()) {
-    return;
-  }
-
-  GetUrl(kTestSecureUrlGet, false);
-}
-
-TEST_F(HttpClientTest, ProxyGet) {
-  GetUrl(kTestUrlGet, true);
-}
-
-TEST_F(HttpClientTest, ProxySecureGet) {
-  GetUrl(kTestSecureUrlGet, true);
-}
-
-TEST_F(HttpClientTest, BuildRequestHeader) {
-  ASSERT_STREQ(HttpClient::BuildRequestHeader(_T("foo"), _T("bar")),
-               _T("foo: bar\r\n"));
-}
-
-TEST_F(HttpClientTest, GetStatusCodeClass) {
-  EXPECT_EQ(HttpClient::GetStatusCodeClass(HTTP_STATUS_CONTINUE),
-            HttpClient::STATUS_CODE_INFORMATIONAL);
-
-  EXPECT_EQ(HttpClient::GetStatusCodeClass(HTTP_STATUS_OK),
-            HttpClient::STATUS_CODE_SUCCESSFUL);
-
-  EXPECT_EQ(HttpClient::GetStatusCodeClass(HTTP_STATUS_PARTIAL_CONTENT),
-            HttpClient::STATUS_CODE_SUCCESSFUL);
-
-  EXPECT_EQ(HttpClient::GetStatusCodeClass(HTTP_STATUS_AMBIGUOUS),
-            HttpClient::STATUS_CODE_REDIRECTION);
-
-  EXPECT_EQ(HttpClient::GetStatusCodeClass(HTTP_STATUS_REDIRECT),
-            HttpClient::STATUS_CODE_REDIRECTION);
-
-  EXPECT_EQ(HttpClient::GetStatusCodeClass(HTTP_STATUS_BAD_REQUEST),
-            HttpClient::STATUS_CODE_CLIENT_ERROR);
-
-  EXPECT_EQ(HttpClient::GetStatusCodeClass(HTTP_STATUS_SERVICE_UNAVAIL),
-            HttpClient::STATUS_CODE_SERVER_ERROR);
-}
-
-TEST_F(HttpClientTest, CrackUrl) {
-  CString scheme, server, path, query;
-  int port = 0;
-  ASSERT_SUCCEEDED(http_client_->CrackUrl(_T("http://host/path?query"),
-                                          0,
-                                          &scheme,
-                                          &server,
-                                          &port,
-                                          &path,
-                                          &query));
-  ASSERT_STREQ(scheme, _T("http"));
-  ASSERT_STREQ(server, _T("host"));
-  ASSERT_EQ(port, INTERNET_DEFAULT_HTTP_PORT);
-  ASSERT_STREQ(path, _T("/path"));
-  ASSERT_STREQ(query, _T("?query"));
-
-  ASSERT_SUCCEEDED(http_client_->CrackUrl(_T("http://host"),
-                                          0,
-                                          NULL,
-                                          NULL,
-                                          NULL,
-                                          &path,
-                                          &query));
-  ASSERT_STREQ(path, _T(""));
-  ASSERT_STREQ(query, _T(""));
-}
-
-}  // namespace omaha
-
diff --git a/net/http_request.h b/net/http_request.h
deleted file mode 100644
index a9b3ca3..0000000
--- a/net/http_request.h
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// HttpRequestInterface defines an interface for http transactions, with an
-// optional number of retries, going over a specified network configuration.
-//
-// TODO(omaha): the class interface is not stable yet, as a few more
-// getters and setters are still needed.
-//
-// TODO(omaha): provide a way to query how many bytes have been downloaded
-// when the Send() returns so that the code doesn't have to rely on a final
-// callback to update the progress information.
-
-#ifndef OMAHA_NET_HTTP_REQUEST_H__
-#define OMAHA_NET_HTTP_REQUEST_H__
-
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "omaha/net/network_config.h"
-
-namespace omaha {
-
-class NetworkRequestCallback;
-
-class HttpRequestInterface {
- public:
-  virtual ~HttpRequestInterface() {}
-
-  virtual HRESULT Close() = 0;
-
-  // Sends a fault-tolerant http request. Returns S_OK if the http transaction
-  // went through and the correct response is available.
-  virtual HRESULT Send() = 0;
-
-  virtual HRESULT Cancel() = 0;
-
-  virtual HRESULT Pause() = 0;
-
-  virtual HRESULT Resume() = 0;
-
-  virtual std::vector<uint8> GetResponse() const = 0;
-
-  virtual int GetHttpStatusCode() const = 0;
-
-  virtual HRESULT QueryHeadersString(uint32 info_level,
-                                     const TCHAR* name,
-                                     CString* value) const = 0;
-
-  virtual CString GetResponseHeaders() const = 0;
-
-  virtual CString ToString() const = 0;
-
-  virtual void set_session_handle(HINTERNET session_handle) = 0;
-
-  virtual void set_url(const CString& url) = 0;
-
-  virtual void set_request_buffer(const void* buffer,
-                                  size_t buffer_length) = 0;
-
-  virtual void set_proxy_configuration(const ProxyConfig& proxy_config) = 0;
-
-  // Sets the filename to receive the response instead of the memory buffer.
-  virtual void set_filename(const CString& filename) = 0;
-
-  virtual void set_low_priority(bool low_priority) = 0;
-
-  virtual void set_callback(NetworkRequestCallback* callback) = 0;
-
-  virtual void set_additional_headers(const CString& additional_headers) = 0;
-
-  virtual void set_preserve_protocol(bool preserve_protocol) = 0;
-
-  // Gets the user agent for this http request. The default user agent has
-  // the following format: Google Update/a.b.c.d;req1;req2 where a.b.c.d is
-  // the version of the client code and req1, req2,... are appended by
-  // different http requests. For example:
-  //    User-Agent: Google Update/1.2.15.0;winhttp;cup
-  // indicates a WinHTTP+CUP request.
-  virtual CString user_agent() const = 0;
-
-  virtual void set_user_agent(const CString& user_agent) = 0;
-
-  virtual void set_proxy_auth_config(const ProxyAuthConfig& config) = 0;
-};
-
-}   // namespace omaha
-
-#endif  // OMAHA_NET_HTTP_REQUEST_H__
-
diff --git a/net/net_diags.cc b/net/net_diags.cc
deleted file mode 100644
index fd2b256..0000000
--- a/net/net_diags.cc
+++ /dev/null
@@ -1,210 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Some simple network diags.
-
-#include "omaha/net/net_diags.h"
-#include <windows.h>
-#include <stdarg.h>
-#include <vector>
-#include "omaha/base/app_util.h"
-#include "omaha/base/browser_utils.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/system_info.h"
-#include "omaha/base/time.h"
-#include "omaha/base/utils.h"
-#include "omaha/net/network_config.h"
-#include "omaha/net/network_request.h"
-
-namespace omaha {
-
-NetDiags::NetDiags() {
-  Initialize();
-}
-
-NetDiags::~NetDiags() {
-  ::CoUninitialize();
-}
-
-bool PrintToConsole(const TCHAR* format, ...) {
-  ASSERT1(format);
-  va_list arg_list;
-  va_start(arg_list, format);
-  CString msg;
-  msg.FormatV(format, arg_list);
-  ASSERT1(msg.GetLength() > 0);
-  va_end(arg_list);
-
-  DWORD count = 0;
-  bool result = !!::WriteConsole(::GetStdHandle(STD_OUTPUT_HANDLE),
-                                 msg,
-                                 msg.GetLength(),
-                                 &count,
-                                 NULL);
-  ASSERT1(result);
-  ASSERT1(msg.GetLength() == static_cast<int>(count));
-  return result;
-}
-
-void NetDiags::Initialize() {
-  if (!SystemInfo::IsRunningOnXPOrLater()) {
-    ::MessageBox(NULL,
-        _T("GoogleUpdate.exe"),
-        _T("\"GoogleUpdate.exe /NetDiags\" only runs on Windows XP or later."),
-        MB_OK);
-    ::ExitProcess(1);
-  }
-
-  if (!AttachConsoleWrap(ATTACH_PARENT_PROCESS)) {
-    ::MessageBox(NULL,
-        _T("GoogleUpdate.exe"),
-        _T("Please run \"GoogleUpdate.exe /NetDiags\" from a cmd.exe window."),
-        MB_OK);
-    ::ExitProcess(1);
-  }
-
-  PrintToConsole(_T("\n"));
-  HRESULT hr = ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
-  if (FAILED(hr)) {
-    PrintToConsole(_T("Failed to ::CoInitialize() [0x%x]\n"), hr);
-    ::ExitProcess(1);
-  }
-
-  NetworkConfig* network_config = NULL;
-  hr = NetworkConfigManager::Instance().GetUserNetworkConfig(&network_config);
-  if (FAILED(hr)) {
-    PrintToConsole(_T("Failed to GetUserNetworkConfig() [0x%x]\n"), hr);
-    ::ExitProcess(1);
-  }
-
-  // Initialize the detection chain: GoogleProxy, FireFox if it is the
-  // default browser, and IE.
-  network_config->Clear();
-  BrowserType browser_type(BROWSER_UNKNOWN);
-  GetDefaultBrowserType(&browser_type);
-  if (browser_type == BROWSER_FIREFOX) {
-    PrintToConsole(_T("Default browser is Firefox\n"));
-    network_config->Add(new FirefoxProxyDetector());
-  }
-  network_config->Add(new IEProxyDetector());
-
-  std::vector<ProxyConfig> configs = network_config->GetConfigurations();
-  if (configs.empty()) {
-    PrintToConsole(_T("No Network Configurations to display\n"));
-  } else {
-    PrintToConsole(_T("[Detected Network Configurations][\n%s]\n"),
-                   NetworkConfig::ToString(configs));
-  }
-}
-
-void NetDiags::OnProgress(int bytes, int bytes_total, int, const TCHAR*) {
-  PrintToConsole(_T("\n[Downloading %d of %d]\n"), bytes, bytes_total);
-}
-
-void NetDiags::OnRequestBegin() {
-  PrintToConsole(_T("\n[Download begins]\n"));
-}
-
-void NetDiags::OnRequestRetryScheduled(time64 next_retry_time) {
-  time64 now = GetCurrent100NSTime();
-  ASSERT1(next_retry_time > now);
-
-  if (next_retry_time > now) {
-    PrintToConsole(_T("\n[Download will retry in %d seconds]\n"),
-                      CeilingDivide(next_retry_time - now, kSecsTo100ns));
-  }
-}
-
-// http get.
-void NetDiags::DoGet(const CString& url) {
-  PrintToConsole(_T("\nGET request for [%s]\n"), url);
-  NetworkConfig* network_config = NULL;
-  NetworkConfigManager& network_manager = NetworkConfigManager::Instance();
-  HRESULT hr = network_manager.GetUserNetworkConfig(&network_config);
-  if (FAILED(hr)) {
-    PrintToConsole(_T("Failed to GetUserNetworkConfig() [0x%x]\n"), hr);
-    return;
-  }
-  NetworkRequest network_request(network_config->session());
-
-  network_request.set_callback(this);
-  network_request.set_num_retries(2);
-  std::vector<uint8> response;
-  hr = GetRequest(&network_request, url, &response);
-  int status = network_request.http_status_code();
-  if (FAILED(hr)) {
-    PrintToConsole(_T("GET request failed. HRESULT=[0x%x], HTTP Status=[%d]\n"),
-                   hr, status);
-    return;
-  }
-
-  PrintToConsole(_T("HTTP Status=[%d]\n"), status);
-  PrintToConsole(_T("HTTP Response=\n[%s]\n"), Utf8BufferToWideChar(response));
-}
-
-// http download.
-void NetDiags::DoDownload(const CString& url) {
-  PrintToConsole(_T("\nDownload request for [%s]\n"), url);
-  NetworkConfig* network_config = NULL;
-  NetworkConfigManager& network_manager = NetworkConfigManager::Instance();
-  HRESULT hr = network_manager.GetUserNetworkConfig(&network_config);
-  if (FAILED(hr)) {
-    PrintToConsole(_T("Failed to GetUserNetworkConfig() [0x%x]\n"), hr);
-    return;
-  }
-  NetworkRequest network_request(network_config->session());
-
-  network_request.set_callback(this);
-  network_request.set_num_retries(2);
-
-  CString temp_dir = app_util::GetTempDir();
-  CString temp_file;
-  if (!::GetTempFileName(temp_dir,
-                         _T("tmp"),
-                         0,
-                         CStrBuf(temp_file, MAX_PATH))) {
-    PrintToConsole(_T("::GetTempFileName Failed [%d]\n"), ::GetLastError());
-    return;
-  }
-
-  hr = network_request.DownloadFile(url, temp_file);
-  int status = network_request.http_status_code();
-  if (FAILED(hr)) {
-    PrintToConsole(_T("Download failed. HRESULT=[0x%x], HTTP Status=[%d]\n"),
-                   hr, status);
-    return;
-  }
-
-  PrintToConsole(_T("HTTP Status=[%d]\n"), status);
-  PrintToConsole(_T("Downloaded File=[%s]\n"), temp_file);
-  if (!::DeleteFile(temp_file)) {
-    PrintToConsole(_T("::DeleteFile Failed [%s][%d]\n"),
-                   temp_file, ::GetLastError());
-    return;
-  } else {
-    PrintToConsole(_T("Deleted file [%s]\n"), temp_file);
-  }
-}
-
-// Run the tests.
-int NetDiags::Main() {
-  DoGet(_T("http://www.google.com/robots.txt"));
-  DoGet(_T("https://www.google.com/robots.txt"));
-  DoDownload(_T("http://www.google.com/intl/en_ALL/images/logo.gif"));
-  return 0;
-}
-
-}  // namespace omaha
-
diff --git a/net/net_diags.h b/net/net_diags.h
deleted file mode 100644
index c145af8..0000000
--- a/net/net_diags.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#ifndef OMAHA_NET_NET_DIAGS_H__
-#define OMAHA_NET_NET_DIAGS_H__
-
-#include <tchar.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-#include "base/time.h"
-#include "omaha/net/network_request.h"
-
-namespace omaha {
-
-class NetDiags : public NetworkRequestCallback {
- public:
-  NetDiags();
-  ~NetDiags();
-
-  // Run the tests.
-  int Main();
-
- private:
-  void Initialize();
-  virtual void OnProgress(int bytes, int bytes_total, int, const TCHAR*);
-  virtual void OnRequestBegin();
-  virtual void OnRequestRetryScheduled(time64 next_retry_time);
-
-  // http get.
-  void DoGet(const CString& url);
-  void DoDownload(const CString& url);
-};
-
-}   // namespace omaha
-
-#endif  // OMAHA_NET_NET_DIAGS_H__
-
diff --git a/net/net_utils.cc b/net/net_utils.cc
deleted file mode 100644
index 8d76116..0000000
--- a/net/net_utils.cc
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/net/net_utils.h"
-#include <iphlpapi.h>
-#include "base/scoped_ptr.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-bool IsMachineConnectedToNetwork() {
-  // Get the table of information on all interfaces.
-  DWORD table_size = 0;
-  DWORD result = ::GetIfTable(NULL, &table_size, false);
-  if (result != ERROR_INSUFFICIENT_BUFFER) {
-    NET_LOG(LW, (_T("[GetIfTable failed to get the table size][%d]"), result));
-    return true;
-  }
-
-  scoped_array<char> buffer(new char[table_size]);
-  MIB_IFTABLE* mib_table = reinterpret_cast<MIB_IFTABLE*>(buffer.get());
-  result = ::GetIfTable(mib_table, &table_size, false);
-  if (result != NO_ERROR) {
-    NET_LOG(LW, (_T("[GetIfTable failed][%d]"), result));
-    return true;
-  }
-
-  // Scan the table looking for active connections.
-  bool active_LAN = false;
-  bool active_WAN = false;
-  for (size_t i = 0; i < mib_table->dwNumEntries; ++i) {
-    if (mib_table->table[i].dwType != MIB_IF_TYPE_LOOPBACK) {
-      active_WAN = active_WAN ||
-          mib_table->table[i].dwOperStatus == MIB_IF_OPER_STATUS_CONNECTED;
-      active_LAN = active_LAN ||
-          mib_table->table[i].dwOperStatus == MIB_IF_OPER_STATUS_OPERATIONAL;
-    }
-  }
-
-  return active_LAN || active_WAN;
-}
-
-CString BufferToPrintableString(const void* buffer, size_t length) {
-  CString result;
-  result.Preallocate(length);
-  if (buffer) {
-    for (size_t i = 0; i != length; ++i) {
-      char ch = (static_cast<const char*>(buffer))[i];
-      result.AppendChar((isprint(ch) || ch =='\r' || ch == '\n') ? ch : '.');
-    }
-  }
-  return result;
-}
-
-CString VectorToPrintableString(const std::vector<uint8>& response) {
-  CString str;
-  if (!response.empty()) {
-    str = BufferToPrintableString(&response.front(), response.size());
-  }
-  return str;
-}
-
-}  // namespace omaha
-
diff --git a/net/net_utils.h b/net/net_utils.h
deleted file mode 100644
index ef8d394..0000000
--- a/net/net_utils.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_NET_NET_UTILS_H__
-#define OMAHA_NET_NET_UTILS_H__
-
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-// Returns true if the machine is connected to the LAN/WAN network. This
-// does not mean the machine is able to access the Internet. When the function
-// can't determine the connection state, it assumes the machine is connected
-// and it returns true as well.
-bool IsMachineConnectedToNetwork();
-
-// Converts a buffer or a vector to a string for logging purposes.
-// Non-printable characters are converted to '.'.
-CString BufferToPrintableString(const void* buffer, size_t length);
-CString VectorToPrintableString(const std::vector<uint8>& response);
-
-}  // namespace omaha
-
-#endif  // OMAHA_NET_NET_UTILS_H__
-
diff --git a/net/net_utils_unittest.cc b/net/net_utils_unittest.cc
deleted file mode 100644
index e2bdbd9..0000000
--- a/net/net_utils_unittest.cc
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/net/net_utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-// It only tests for the happy scenario.
-TEST(NetUtilsTest, IsMachineConnectedToNetwork) {
-  EXPECT_TRUE(IsMachineConnectedToNetwork());
-}
-
-TEST(NetUtilsTest, BufferToPrintableString) {
-  EXPECT_STREQ(_T(""), BufferToPrintableString(NULL, 0));
-
-  const char* buffer = "a\n\r\xff";
-  EXPECT_STREQ(_T("a\n\r."),
-               BufferToPrintableString(buffer, strlen(buffer)));
-}
-
-TEST(NetUtilsTest, VectorToPrintableString) {
-  EXPECT_STREQ(_T(""), VectorToPrintableString(std::vector<uint8>()));
-
-  const char* buffer = "a\n\r\xff";
-  std::vector<uint8> vec(buffer, buffer + strlen(buffer));
-  EXPECT_STREQ(_T("a\n\r."), VectorToPrintableString(vec));
-}
-
-}  // namespace omaha
-
diff --git a/net/network_config.cc b/net/network_config.cc
deleted file mode 100644
index 3b10c33..0000000
--- a/net/network_config.cc
+++ /dev/null
@@ -1,991 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/net/network_config.h"
-
-#include <winhttp.h>
-#include <atlconv.h>
-#include <atlsecurity.h>
-#include <algorithm>
-#include <hash_set>
-#include <vector>
-#include "base/error.h"
-#include "base/scoped_ptr.h"
-#include "base/scope_guard.h"
-#include "omaha/base/browser_utils.h"
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/encrypt.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/path.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/string.h"
-#include "omaha/base/system.h"
-#include "omaha/base/user_info.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/net/cup_request.h"
-#include "omaha/net/http_client.h"
-
-using omaha::encrypt::EncryptData;
-using omaha::encrypt::DecryptData;
-
-namespace omaha {
-
-// Computes the hash value of a ProxyConfig object. Names in the stdext
-// namespace are not currently part of the ISO C++ standard.
-uint32 hash_value(const ProxyConfig& config) {
-  uint32 hash = stdext::hash_value(config.auto_detect)                 ^
-                stdext::hash_value(config.auto_config_url.GetString()) ^
-                stdext::hash_value(config.proxy.GetString())           ^
-                stdext::hash_value(config.proxy_bypass.GetString());
-  return hash;
-}
-
-const TCHAR* const NetworkConfigManager::kNetworkSubkey      = _T("network");
-const TCHAR* const NetworkConfigManager::kNetworkCupSubkey   = _T("secure");
-const TCHAR* const NetworkConfigManager::kCupClientSecretKey = _T("sk");
-const TCHAR* const NetworkConfigManager::kCupClientCookie    = _T("c");
-
-const TCHAR* const NetworkConfig::kUserAgent = _T("Google Update/%s");
-
-const TCHAR* const NetworkConfig::kRegKeyProxy = GOOPDATE_MAIN_KEY _T("proxy");
-const TCHAR* const NetworkConfig::kRegValueSource = _T("source");
-
-const TCHAR* const NetworkConfig::kWPADIdentifier = _T("auto");
-const TCHAR* const NetworkConfig::kDirectConnectionIdentifier = _T("direct");
-
-NetworkConfig::NetworkConfig(bool is_machine)
-    : is_machine_(is_machine),
-      is_initialized_(false) {}
-
-NetworkConfig::~NetworkConfig() {
-  if (session_.session_handle && http_client_.get()) {
-    http_client_->Close(session_.session_handle);
-    session_.session_handle = NULL;
-  }
-  Clear();
-}
-
-// Initialize creates or opens a global lock to synchronize access to
-// registry where CUP credentials are stored. Each user including non-elevated
-// admins stores network configuration data, such as the CUP password in
-// its HKCU. The admin users, including the LOCAL_SYSTEM, store data in HKLM.
-// Therefore, the naming of the global lock is different: users have their
-// lock postfixed with their sid, so the serialization only occurs within the
-// same user's programs. Admin users use the same named lock since they store
-// data in a shared HKLM. The data of the admin users is disambiguated by
-// postfixing their registry sub key with sids.
-// In conclusion, users have sid-postfixed locks and their data goes in
-// their respective HKCU. Admin users have the same lock and their data goes
-// under HKLM in sid-postfixed stores.
-//
-// The named lock is created in the global namespace to account for users
-// logging in from different TS sessions.
-//
-// The CUP credentials must be protected with ACLs so non-elevated admins can't
-// read elevated-admins' keys and attack the protocol.
-//
-// Also, an Internet session is created.
-HRESULT NetworkConfig::Initialize() {
-  ASSERT1(!is_initialized_);
-
-  http_client_.reset(CreateHttpClient());
-  ASSERT1(http_client_.get());
-  if (!http_client_.get()) {
-    NET_LOG(LE, (_T("[CreateHttpClient failed]")));
-    return E_UNEXPECTED;
-  }
-  HRESULT hr = http_client_->Initialize();
-  if (FAILED(hr)) {
-    // TODO(omaha): This makes an assumption that only WinHttp is
-    // supported by the network code.
-    NET_LOG(LE, (_T("[http_client_->Initialize() failed][0x%x]"), hr));
-    return OMAHA_NET_E_WINHTTP_NOT_AVAILABLE;
-  }
-
-  // Initializes the WinHttp session and configures WinHttp to work in
-  // asynchronous mode. In this mode, the network requests are non-blocking
-  // and asynchronous events are generated when a request is complete.
-  hr = http_client_->Open(NULL,
-                          WINHTTP_ACCESS_TYPE_NO_PROXY,
-                          WINHTTP_NO_PROXY_NAME,
-                          WINHTTP_NO_PROXY_BYPASS,
-                          WINHTTP_FLAG_ASYNC,
-                          &session_.session_handle);
-  if (FAILED(hr)) {
-    NET_LOG(LE, (_T("[http_client_->Open() failed][0x%x]"), hr));
-    return hr;
-  }
-
-  Add(new UpdateDevProxyDetector);
-  BrowserType browser_type(BROWSER_UNKNOWN);
-  GetDefaultBrowserType(&browser_type);
-  if (browser_type == BROWSER_FIREFOX) {
-    Add(new FirefoxProxyDetector);
-  }
-  // There is no Chrome detector because it uses the same proxy settings as IE.
-  Add(new IEProxyDetector);
-  Add(new DefaultProxyDetector);
-
-  // Use a global network configuration override if available.
-  ConfigManager* config_manager = ConfigManager::Instance();
-  CString net_config;
-  if (SUCCEEDED(config_manager->GetNetConfig(&net_config))) {
-    ProxyConfig config_override = NetworkConfig::ParseNetConfig(net_config);
-    SetConfigurationOverride(&config_override);
-  }
-
-  ConfigureProxyAuth();
-
-  is_initialized_ = true;
-  return S_OK;
-}
-
-void NetworkConfig::Add(ProxyDetectorInterface* detector) {
-  ASSERT1(detector);
-  __mutexBlock(lock_) {
-    detectors_.push_back(detector);
-  }
-}
-
-void NetworkConfig::Clear() {
-  __mutexBlock(lock_) {
-    for (size_t i = 0; i != detectors_.size(); ++i) {
-      delete detectors_[i];
-    }
-    detectors_.clear();
-    configurations_.clear();
-  }
-}
-
-HRESULT NetworkConfig::Detect() {
-  __mutexBlock(lock_) {
-    std::vector<ProxyConfig> configurations;
-
-    for (size_t i = 0; i != detectors_.size(); ++i) {
-      ProxyConfig config;
-      if (SUCCEEDED(detectors_[i]->Detect(&config))) {
-        configurations.push_back(config);
-      }
-    }
-    configurations_.swap(configurations);
-  }
-
-  return S_OK;
-}
-
-void NetworkConfig::SortProxies(std::vector<ProxyConfig>* configurations) {
-  ASSERT1(configurations);
-
-  std::stable_sort(configurations->begin(), configurations->end(),
-                   ProxySortPredicate);
-}
-
-HRESULT NetworkConfig::ConfigFromIdentifier(const CString& id,
-                                            ProxyConfig* config) {
-  ASSERT1(config);
-
-  *config = ProxyConfig();
-  if (id == kWPADIdentifier) {
-    config->source = kWPADIdentifier;
-    config->auto_detect = true;
-  } else if (id == kDirectConnectionIdentifier) {
-    config->source = kDirectConnectionIdentifier;
-  } else {
-    return HRESULT_FROM_WIN32(ERROR_NOT_FOUND);
-  }
-
-  return S_OK;
-}
-
-void NetworkConfig::AppendLastKnownGoodProxyConfig(
-    std::vector<ProxyConfig>* configurations) const {
-  ASSERT1(configurations);
-  ProxyConfig last_known_good_config;
-  if (SUCCEEDED(LoadProxyConfig(&last_known_good_config))) {
-    configurations->push_back(last_known_good_config);
-  }
-}
-
-void NetworkConfig::AppendStaticProxyConfigs(
-    std::vector<ProxyConfig>* configurations) {
-  ASSERT1(configurations);
-  ProxyConfig config;
-
-  HRESULT hr = ConfigFromIdentifier(kWPADIdentifier, &config);
-  if (SUCCEEDED(hr)) {
-    configurations->push_back(config);
-  }
-
-  hr = ConfigFromIdentifier(kDirectConnectionIdentifier, &config);
-  if (SUCCEEDED(hr)) {
-    configurations->push_back(config);
-  }
-}
-
-HRESULT NetworkConfig::Detect(const CString& proxy_source,
-                              ProxyConfig* config) const {
-  ASSERT1(config);
-  __mutexBlock(lock_) {
-    std::vector<ProxyConfig> configurations;
-    for (size_t i = 0; i != detectors_.size(); ++i) {
-      if (proxy_source == detectors_[i]->source()) {
-        return detectors_[i]->Detect(config);
-      }
-    }
-  }
-
-  return HRESULT_FROM_WIN32(ERROR_NOT_FOUND);
-}
-
-std::vector<ProxyConfig> NetworkConfig::GetConfigurations() const {
-  std::vector<ProxyConfig> configurations;
-  __mutexBlock(lock_) {
-    configurations = configurations_;
-  }
-  return configurations;
-}
-
-HRESULT NetworkConfig::GetConfigurationOverride(ProxyConfig* config) {
-  ASSERT1(config);
-  __mutexBlock(lock_) {
-    if (configuration_override_.get()) {
-      *config = *configuration_override_;
-      return S_OK;
-    }
-  }
-  return E_FAIL;
-}
-
-void NetworkConfig::SetConfigurationOverride(
-    const ProxyConfig* configuration_override) {
-  __mutexBlock(lock_) {
-    if (configuration_override) {
-      configuration_override_.reset(new ProxyConfig);
-      *configuration_override_ = *configuration_override;
-      configuration_override_->source = _T("updatedev/netconfig");
-    } else {
-      configuration_override_.reset();
-    }
-  }
-}
-
-HRESULT NetworkConfig::GetCupCredentials(
-    CupCredentials* cup_credentials) const {
-  return NetworkConfigManager::Instance().GetCupCredentials(cup_credentials);
-}
-
-HRESULT NetworkConfig::SetCupCredentials(
-    const CupCredentials* cup_credentials) const {
-  NetworkConfigManager& network_manager = NetworkConfigManager::Instance();
-  if (cup_credentials == NULL) {
-    network_manager.ClearCupCredentials();
-    return S_OK;
-  }
-
-  return network_manager.SetCupCredentials(*cup_credentials);
-}
-
-// Serializes configurations for debugging purposes.
-CString NetworkConfig::ToString(const ProxyConfig& config) {
-  CString result;
-  result.AppendFormat(_T("priority=%u, source=%s, "),
-                      config.priority, config.source);
-
-  switch (GetAccessType(config)) {
-    case WINHTTP_ACCESS_TYPE_NO_PROXY:
-      result.AppendFormat(_T("direct connection"));
-      break;
-    case WINHTTP_ACCESS_TYPE_NAMED_PROXY:
-      result.AppendFormat(_T("named proxy=%s, bypass=%s"),
-                          config.proxy, config.proxy_bypass);
-      break;
-    case WINHTTP_ACCESS_TYPE_AUTO_DETECT:
-      result.AppendFormat(_T("wpad=%d, script=%s"),
-                          config.auto_detect, config.auto_config_url);
-      break;
-    default:
-      ASSERT1(false);
-      break;
-  }
-  return result;
-}
-
-CString NetworkConfig::ToString(const std::vector<ProxyConfig>& config) {
-  CString result;
-  for (size_t i = 0; i != config.size(); ++i) {
-    result.Append(NetworkConfig::ToString(config[i]));
-    result.Append(_T("\r\n"));
-  }
-  return result;
-}
-
-int NetworkConfig::GetAccessType(const ProxyConfig& config) {
-  if (config.auto_detect || !config.auto_config_url.IsEmpty()) {
-    return WINHTTP_ACCESS_TYPE_AUTO_DETECT;
-  } else if (!config.proxy.IsEmpty()) {
-    return WINHTTP_ACCESS_TYPE_NAMED_PROXY;
-  } else {
-    return WINHTTP_ACCESS_TYPE_NO_PROXY;
-  }
-}
-
-bool NetworkConfig::IsUsingCupTestKeys() {
-  DWORD value = 0;
-  if (SUCCEEDED(RegKey::GetValue(MACHINE_REG_UPDATE_DEV,
-                                 kRegValueCupKeys,
-                                 &value))) {
-    return value != 0;
-  } else {
-    return false;
-  }
-}
-
-void NetworkConfig::ConfigureProxyAuth() {
-  const uint32 kProxyMaxPrompts = 1;
-  return proxy_auth_.ConfigureProxyAuth(is_machine_, kProxyMaxPrompts);
-}
-
-bool NetworkConfig::GetProxyCredentials(bool allow_ui,
-                                        bool force_ui,
-                                        const CString& proxy_settings,
-                                        const ProxyAuthConfig& config,
-                                        bool is_https,
-                                        CString* username,
-                                        CString* password,
-                                        uint32* auth_scheme) {
-  ASSERT1(username);
-  ASSERT1(password);
-  ASSERT1(auth_scheme);
-
-  const CString& proxy = ProxyAuth::ExtractProxy(proxy_settings, is_https);
-  return proxy_auth_.GetProxyCredentials(allow_ui, force_ui, proxy,
-                                         config, username,
-                                         password, auth_scheme);
-}
-
-HRESULT NetworkConfig::SetProxyAuthScheme(const CString& proxy_settings,
-                                          bool is_https,
-                                          uint32 auth_scheme) {
-  ASSERT1(auth_scheme != UNKNOWN_AUTH_SCHEME);
-  const CString& proxy = ProxyAuth::ExtractProxy(proxy_settings, is_https);
-  return proxy_auth_.SetProxyAuthScheme(proxy, auth_scheme);
-}
-
-// TODO(omaha): the code does WPAD auto detect in all cases. It is possible for
-// a configuration to specify no auto detection but provide the proxy script
-// url. The current code does not account for this yet.
-HRESULT NetworkConfig::GetProxyForUrl(const CString& url,
-                                      const CString& auto_config_url,
-                                      HttpClient::ProxyInfo* proxy_info) {
-  ASSERT1(proxy_info);
-
-  NET_LOG(L3, (_T("[NetworkConfig::GetProxyForUrl][%s]"), url));
-
-  HttpClient::AutoProxyOptions auto_proxy_options = {0};
-  auto_proxy_options.flags = WINHTTP_AUTOPROXY_AUTO_DETECT;
-  auto_proxy_options.auto_detect_flags = WINHTTP_AUTO_DETECT_TYPE_DHCP |
-                                         WINHTTP_AUTO_DETECT_TYPE_DNS_A;
-  if (!auto_config_url.IsEmpty()) {
-    auto_proxy_options.auto_config_url = auto_config_url;
-    auto_proxy_options.flags |= WINHTTP_AUTOPROXY_CONFIG_URL;
-  }
-  auto_proxy_options.auto_logon_if_challenged = true;
-
-  HRESULT hr = http_client_->GetProxyForUrl(session_.session_handle,
-                                            url,
-                                            &auto_proxy_options,
-                                            proxy_info);
-
-  if (FAILED(hr) && ::UrlIsFileUrl(auto_config_url)) {
-    // Some HttpClient implementations, namely WinHTTP, only support PAC files
-    // with http or https schemes.  Attempt an alternate resolution scheme using
-    // jsproxy.dll if the initial attempt fails.
-    ASSERT1(user_info::IsThreadImpersonating());
-
-    CString local_file;
-    hr = ConvertFileUriToLocalPath(auto_config_url, &local_file);
-    if (FAILED(hr)) {
-      NET_LOG(LE, (_T("[ConvertFileUriToLocalPath failed][0x%08x]"), hr));
-      return hr;
-    }
-
-    hr = GetProxyForUrlLocal(url, local_file, proxy_info);
-  }
-
-  return hr;
-}
-
-CString NetworkConfig::GetUserAgent() {
-  CString user_agent;
-  user_agent.Format(kUserAgent, GetVersionString());
-  return user_agent;
-}
-
-CString NetworkConfig::GetMID() {
-  CString mid;
-  RegKey::GetValue(MACHINE_REG_UPDATE_DEV, kRegValueMID, &mid);
-  return mid;
-}
-
-CString NetworkConfig::JoinStrings(const TCHAR* s1,
-                                   const TCHAR* s2,
-                                   const TCHAR* delim) {
-  CString result;
-  const TCHAR* components[] = {s1, s2};
-  JoinStringsInArray(components, arraysize(components), delim, &result);
-  return result;
-}
-
-// Using std::hash_set adds about 2K uncompressed code size. Using a CAtlMap
-// adds about 1.5K. Usually, there are only five detected configurations so
-// an O(n^2) algorithm would work well. The advantage of the current
-// implementation is simplicity. It also does not handle conflicts. Conflicts
-// are not expected, due to how the ProxyConfig structure is being used.
-// TODO(omaha): consider not using the hash_set and save about 1K of code.
-void NetworkConfig::RemoveDuplicates(std::vector<ProxyConfig>* config) {
-  ASSERT1(config);
-
-  // Iterate over the input configurations, remember the hash of each
-  // distinct configuration, and remove the duplicates by skipping the
-  // configurations seen before.
-  std::vector<ProxyConfig> input(*config);
-  config->clear();
-
-  typedef stdext::hash_set<uint32> Keys;
-  Keys keys;
-  for (size_t i = 0; i != input.size(); ++i) {
-    std::pair<Keys::iterator, bool> result(keys.insert(hash_value(input[i])));
-    if (result.second) {
-      config->push_back(input[i]);
-    }
-  }
-}
-
-HRESULT NetworkConfig::CreateProxyConfigRegKey(RegKey* key) {
-  ASSERT1(key);
-  CString config_root;
-
-  if (!user_info::IsRunningAsSystem()) {
-    scoped_hkey user_root_key;
-    HRESULT hr = ::RegOpenCurrentUser(KEY_READ | KEY_WRITE,
-                                      address(user_root_key));
-    if (FAILED(hr)) {
-        return hr;
-    }
-    return key->Create(get(user_root_key), kRegKeyProxy);
-  } else {
-    return key->Create(HKEY_LOCAL_MACHINE, kRegKeyProxy);
-  }
-}
-
-HRESULT NetworkConfig::SaveProxyConfig(const ProxyConfig& config) {
-  const CString& new_configuration = config.source;
-  NET_LOG(L3, (_T("[NetworkConfig::SaveProxyConfig][%s]"), new_configuration));
-
-  RegKey key;
-  HRESULT hr = CreateProxyConfigRegKey(&key);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CString current_configuration;
-  if (SUCCEEDED(key.GetValue(kRegValueSource, &current_configuration)) &&
-      current_configuration != new_configuration) {
-    NET_LOG(L3, (_T("[Network configuration changed from %s to %s"),
-        current_configuration, new_configuration));
-  }
-
-  return key.SetValue(kRegValueSource, new_configuration);
-}
-
-HRESULT NetworkConfig::LoadProxyConfig(ProxyConfig* config) const {
-  ASSERT1(config);
-
-  *config = ProxyConfig();
-
-  RegKey key;
-  HRESULT hr = CreateProxyConfigRegKey(&key);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CString source;
-  hr = key.GetValue(kRegValueSource, &source);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = NetworkConfig::ConfigFromIdentifier(source, config);
-  if (FAILED(hr)) {
-    hr = Detect(source, config);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  config->priority = ProxyConfig::PROXY_PRIORITY_LAST_KNOWN_GOOD;
-
-  return S_OK;
-}
-
-ProxyConfig NetworkConfig::ParseNetConfig(const CString& net_config) {
-  ProxyConfig config;
-  int pos(0);
-  CString token = net_config.Tokenize(_T(";"), pos);
-  while (pos != -1) {
-    CString name, value;
-    if (ParseNameValuePair(token, _T('='), &name, &value)) {
-      bool auto_detect(false);
-      if (name == _T("wpad") &&
-          SUCCEEDED(String_StringToBool(value, &auto_detect))) {
-        config.auto_detect = auto_detect;
-      } else if (name == _T("script")) {
-        config.auto_config_url = value;
-      } else if (name == _T("proxy")) {
-        config.proxy = value;
-      }
-    }
-    token = net_config.Tokenize(_T(";"), pos);
-  }
-  return config;
-}
-
-// Note: The jsproxy functions are exposed to public users as part of the
-// DOJ consent decree and are not formally supported by Microsoft.
-
-GPA_WRAP(jsproxy.dll,
-         InternetInitializeAutoProxyDll,
-         (DWORD dwVersion, LPSTR lpszDownloadedTempFile, LPSTR lpszMime, LPCVOID lpAutoProxyCallbacks, LPCVOID lpAutoProxyScriptBuffer),  // NOLINT
-         (dwVersion, lpszDownloadedTempFile, lpszMime, lpAutoProxyCallbacks, lpAutoProxyScriptBuffer),  // NOLINT
-         WINAPI,
-         BOOL,
-         FALSE);
-
-GPA_WRAP(jsproxy.dll,
-         InternetGetProxyInfo,
-         (LPCSTR lpszUrl, DWORD dwUrlLength, LPSTR lpszUrlHostName, DWORD dwUrlHostNameLength, LPSTR *lplpszProxyHostName, LPDWORD lpdwProxyHostNameLength),  // NOLINT
-         (lpszUrl, dwUrlLength, lpszUrlHostName, dwUrlHostNameLength, lplpszProxyHostName, lpdwProxyHostNameLength),  // NOLINT
-         WINAPI,
-         BOOL,
-         FALSE);
-
-GPA_WRAP(jsproxy.dll,
-         InternetDeInitializeAutoProxyDll,
-         (LPSTR lpszMime, DWORD dwReserved),
-         (lpszMime, dwReserved),
-         WINAPI,
-         BOOL,
-         FALSE);
-
-HRESULT NetworkConfig::GetProxyForUrlLocal(const CString& url,
-                                           const CString& path_to_pac_file,
-                                           HttpClient::ProxyInfo* proxy_info) {
-  scoped_library jsproxy_lib(::LoadLibrary(_T("jsproxy.dll")));
-  ASSERT1(jsproxy_lib);
-  if (!jsproxy_lib) {
-    HRESULT hr = HRESULTFromLastError();
-    NET_LOG(LE, (_T("[GetProxyForUrlLocal][jsproxy not loaded][0x%08x]"), hr));
-    return hr;
-  }
-
-  // Convert the inputs to ANSI, and call into JSProxy to execute the PAC
-  // script; we should get back out a PAC-format list of proxies to use.
-  //
-  // TODO(omaha3): The MSDN prototypes specify LPSTR, and I've assumed this
-  // implies CP_ACP.  However, depending on how this was implemented internally,
-  // conversion to UTF8 might work better.  Investigate this later and confirm.
-  CStringA path_a(path_to_pac_file);
-
-  if (FALSE == InternetInitializeAutoProxyDllWrap(0, CStrBufA(path_a, MAX_PATH),
-                                                  NULL, NULL, NULL)) {
-    HRESULT hr = HRESULTFromLastError();
-    NET_LOG(LE, (_T("[GetProxyForUrlLocal][jsproxy init failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  ON_SCOPE_EXIT(InternetDeInitializeAutoProxyDllWrap, (LPSTR)NULL, 0);
-
-  CStringA url_a(url);
-  CStringA url_hostname_a(GetUriHostNameHostOnly(url, false));
-
-  scoped_hglobal proxy_ptr;
-  DWORD proxy_len = 0;
-  if (FALSE == InternetGetProxyInfoWrap(
-      url_a,
-      url_a.GetLength(),
-      CStrBufA(url_hostname_a, url_hostname_a.GetLength()),
-      url_hostname_a.GetLength(),
-      reinterpret_cast<LPSTR*>(address(proxy_ptr)),
-      &proxy_len)) {
-    HRESULT hr = HRESULTFromLastError();
-    NET_LOG(LE, (_T("[GetProxyForUrlLocal][jsproxy failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  ASSERT1(proxy_ptr && proxy_len > 0);
-  CStringA proxy(reinterpret_cast<LPSTR>(get(proxy_ptr)), proxy_len);
-  ConvertPacResponseToProxyInfo(proxy, proxy_info);
-  return S_OK;
-}
-
-void NetworkConfig::ConvertPacResponseToProxyInfo(
-    const CStringA& response,
-    HttpClient::ProxyInfo* proxy_info) {
-  ASSERT1(proxy_info);
-
-  NET_LOG(L4, (_T("[ConvertPacResponseToProxyInfo][%s]"), CString(response)));
-
-  // The proxy list response from a PAC file for a file is a string of proxies
-  // to attempt in order, delimited by semicolons, with a keyword denoting how
-  // to use the proxy.  For example:
-  //
-  // PROXY prx1.samp.com; PROXY prx2.test.com:8080; SOCKS prx3.test.com; DIRECT
-  //
-  // We convert this to a direct semicolon-separated list of host/ports.  We
-  // stop parsing if we see DIRECT; we omit any non-PROXY entries.
-  CString proxy_list;
-  for (int start = 0; start >= 0 && start < response.GetLength();) {
-    int semi_pos = response.Find(';', start);
-    if (semi_pos < 0) {
-      semi_pos = response.GetLength();
-    }
-
-    CStringA entry = response.Mid(start, semi_pos - start).Trim().MakeLower();
-    if (entry == "direct") {
-      break;
-    }
-    if (0 == entry.Find("proxy ")) {
-      // This is a valid proxy entry.  Strip the leading "PROXY " and add it
-      // to our parsed list.
-      if (!proxy_list.IsEmpty()) {
-        proxy_list.AppendChar(_T(';'));
-      }
-      proxy_list.Append(CString(entry.Mid(6)));
-    }
-
-    start = semi_pos + 1;
-  }
-
-  if (proxy_list.IsEmpty()) {
-    proxy_info->access_type = WINHTTP_ACCESS_TYPE_NO_PROXY;
-    proxy_info->proxy = NULL;
-    proxy_info->proxy_bypass = NULL;
-  } else {
-    // The convention is that any strings in a WINHTTP_PROXY_INFO are expected
-    // to be freed by the caller using GlobalFree().  Convert our intermediary
-    // CString to a GlobalAlloc() buffer and write that out.
-    size_t list_len = (proxy_list.GetLength() + 1) * sizeof(TCHAR);
-    TCHAR* list_hglob = reinterpret_cast<TCHAR*>(::GlobalAlloc(GPTR, list_len));
-    memcpy(list_hglob, proxy_list.GetString(), list_len);
-    proxy_info->access_type = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
-    proxy_info->proxy = list_hglob;
-    proxy_info->proxy_bypass = NULL;
-  }
-}
-
-const NetworkConfigManager* const NetworkConfigManager::kInvalidInstance  =
-    reinterpret_cast<const NetworkConfigManager* const>(-1);
-NetworkConfigManager* NetworkConfigManager::instance_ = NULL;
-LLock NetworkConfigManager::instance_lock_;
-bool NetworkConfigManager::is_machine_ = false;
-
-NetworkConfigManager::NetworkConfigManager() {
-}
-
-NetworkConfigManager::~NetworkConfigManager() {
-  SaveCupCredentialsToRegistry();
-}
-
-HRESULT NetworkConfigManager::CreateInstance() {
-  __mutexScope(instance_lock_);
-  ASSERT1(instance_ != kInvalidInstance);
-  if (!instance_) {
-    NET_LOG(L1, (_T("[NetworkConfigManager::CreateInstance][is_machine: %d]"),
-         is_machine_));
-    instance_ = new NetworkConfigManager();
-    VERIFY1(SUCCEEDED(instance_->InitializeLock()));
-    VERIFY1(SUCCEEDED(instance_->InitializeRegistryKey()));
-    instance_->LoadCupCredentialsFromRegistry();
-  }
-
-  return S_OK;
-}
-
-void NetworkConfigManager::DeleteInstance() {
-  ASSERT1(instance_ != kInvalidInstance);
-
-  NetworkConfigManager* instance =
-      omaha::interlocked_exchange_pointer(&instance_, kInvalidInstance);
-
-  if (kInvalidInstance != instance && NULL != instance) {
-    instance->DeleteInstanceInternal();
-    delete instance;
-  }
-}
-
-NetworkConfigManager& NetworkConfigManager::Instance() {
-  __mutexScope(instance_lock_);
-  if (!instance_) {
-    VERIFY1(SUCCEEDED(NetworkConfigManager::CreateInstance()));
-  }
-  return *instance_;
-}
-
-void NetworkConfigManager::set_is_machine(bool is_machine) {
-  __mutexScope(instance_lock_);
-  if (instance_) {
-    NET_LOG(LE, (_T("set_is_machine called after instance created.")));
-  }
-
-  is_machine_ = is_machine;
-}
-
-void NetworkConfigManager::DeleteInstanceInternal() {
-  __mutexBlock(lock_) {
-    std::map<CString, NetworkConfig*>::iterator it;
-
-    for (it = user_network_config_map_.begin();
-         it != user_network_config_map_.end();
-         ++it) {
-      if (NULL != it->second) {
-        delete it->second;
-      }
-    }
-    user_network_config_map_.clear();
-  }
-}
-
-HRESULT NetworkConfigManager::GetUserNetworkConfig(
-    NetworkConfig** network_config) {
-  CString sid;
-  HRESULT hr = user_info::GetEffectiveUserSid(&sid);
-  if (FAILED(hr)) {
-    NET_LOG(LE, (_T("[GetEffectiveUserSid failed][0x%x]"), hr));
-    return hr;
-  }
-
-  __mutexBlock(lock_) {
-    std::map<CString, NetworkConfig*>::iterator it;
-    it = user_network_config_map_.find(sid);
-
-    if (user_network_config_map_.end() != it) {
-      *network_config = it->second;
-      return S_OK;
-    }
-
-    hr = CreateNetworkConfigInstance(network_config, is_machine_);
-    if (SUCCEEDED(hr)) {
-      user_network_config_map_.insert(std::make_pair(sid, *network_config));
-    }
-
-    return hr;
-  }
-
-  return E_FAIL;
-}
-
-HRESULT NetworkConfigManager::CreateNetworkConfigInstance(
-    NetworkConfig** network_config_ptr,
-    bool is_machine) {
-  ASSERT1(network_config_ptr);
-
-  NetworkConfig* network_config(new NetworkConfig(is_machine));
-  HRESULT hr = network_config->Initialize();
-  if (FAILED(hr)) {
-    NET_LOG(LE, (_T("[NetworkConfig::Initialize() failed][0x%x]"), hr));
-    delete network_config;
-    return hr;
-  }
-
-  *network_config_ptr = network_config;
-  return S_OK;
-}
-
-HRESULT NetworkConfigManager::InitializeLock() {
-  NamedObjectAttributes lock_attr;
-  GetNamedObjectAttributes(kNetworkConfigLock, is_machine_, &lock_attr);
-  return global_lock_.InitializeWithSecAttr(lock_attr.name, &lock_attr.sa) ?
-         S_OK : E_FAIL;
-}
-
-HRESULT NetworkConfigManager::InitializeRegistryKey() {
-  // The registry path under which to store persistent network configuration.
-  // The "network" subkey is created with default security. Below "network",
-  // the "secure" key is created so that only system and administrators have
-  // access to it.
-  CString reg_path = is_machine_ ? MACHINE_REG_UPDATE : USER_REG_UPDATE;
-  reg_path = AppendRegKeyPath(reg_path, kNetworkSubkey);
-  RegKey reg_key_network;
-  DWORD disposition = 0;
-  HRESULT hr = reg_key_network.Create(reg_path,
-                                      NULL,                 // Class.
-                                      0,                    // Options.
-                                      KEY_CREATE_SUB_KEY,   // SAM desired.
-                                      NULL,                 // Security attrs.
-                                      &disposition);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // When initializing for machine, grant access to administrators and system.
-  scoped_ptr<CSecurityAttributes> sa;
-  if (is_machine_) {
-    sa.reset(new CSecurityAttributes);
-    GetAdminDaclSecurityAttributes(sa.get(), GENERIC_ALL);
-  }
-
-  disposition = 0;
-  RegKey reg_key_network_secure;
-  hr = reg_key_network_secure.Create(reg_key_network.Key(),  // Parent.
-                                     kNetworkCupSubkey,      // Subkey name.
-                                     NULL,                   // Class.
-                                     0,                      // Options.
-                                     KEY_READ,               // SAM desired.
-                                     sa.get(),               // Security attrs.
-                                     &disposition);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  return S_OK;
-}
-
-HRESULT NetworkConfigManager::SetCupCredentials(
-    const CupCredentials& cup_credentials) {
-  __mutexScope(lock_);
-
-  const std::vector<uint8>& sk_in(cup_credentials.sk);
-
-  if (sk_in.empty()) {
-    return E_INVALIDARG;
-  }
-
-  std::vector<uint8> sk_out;
-  HRESULT hr = EncryptData(NULL, 0, &sk_in.front(), sk_in.size(), &sk_out);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  cup_credentials_.reset(new CupCredentials);
-
-  cup_credentials_->sk.swap(sk_out);
-  cup_credentials_->c.SetString(cup_credentials.c);
-
-  return S_OK;
-}
-
-HRESULT NetworkConfigManager::GetCupCredentials(
-    CupCredentials* cup_credentials) {
-  ASSERT1(cup_credentials);
-  __mutexScope(lock_);
-  if (cup_credentials_ == NULL || cup_credentials_->sk.empty()) {
-    return HRESULT_FROM_WIN32(ERROR_NOT_FOUND);
-  }
-
-  std::vector<uint8> decrypted_sk;
-  HRESULT hr = DecryptData(NULL,
-                           0,
-                           &cup_credentials_->sk.front(),
-                           cup_credentials_->sk.size(),
-                           &decrypted_sk);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  cup_credentials->sk.swap(decrypted_sk);
-  cup_credentials->c.SetString(cup_credentials_->c);
-
-  return S_OK;
-}
-
-// This function should be called in singleton creation stage,
-// thus no lock is needed.
-HRESULT NetworkConfigManager::LoadCupCredentialsFromRegistry() {
-  __mutexScope(global_lock_);
-
-  CString reg_path = is_machine_ ? MACHINE_REG_UPDATE : USER_REG_UPDATE;
-  reg_path = AppendRegKeyPath(reg_path, kNetworkSubkey);
-  CString key_name = AppendRegKeyPath(reg_path, kNetworkCupSubkey);
-  RegKey reg_key;
-  HRESULT hr = reg_key.Open(key_name, KEY_READ);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  scoped_array<byte> buf;
-  DWORD buf_length = 0;
-  hr = reg_key.GetValue(kCupClientSecretKey, address(buf), &buf_length);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  CString cookie;
-  hr = reg_key.GetValue(kCupClientCookie, &cookie);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  if (buf_length == 0) {
-    return E_FAIL;
-  }
-  cup_credentials_.reset(new CupCredentials);
-  cup_credentials_->sk.resize(buf_length);
-  memcpy(&cup_credentials_->sk.front(), buf.get(), buf_length);
-  cup_credentials_->c = CT2A(cookie);
-
-  return S_OK;
-}
-
-// This function is called in the destructor only thus no lock is needed.
-HRESULT NetworkConfigManager::SaveCupCredentialsToRegistry() {
-  __mutexScope(global_lock_);
-
-  CString reg_path = is_machine_ ? MACHINE_REG_UPDATE : USER_REG_UPDATE;
-  reg_path = AppendRegKeyPath(reg_path, kNetworkSubkey);
-  CString key_name = AppendRegKeyPath(reg_path, kNetworkCupSubkey);
-  RegKey reg_key;
-  HRESULT hr = reg_key.Open(key_name, KEY_WRITE);
-  if (FAILED(hr)) {
-    NET_LOG(L2, (_T("[Registry key open failed][%s][0x%08x]"), key_name, hr));
-    return hr;
-  }
-
-  if (cup_credentials_ == NULL || cup_credentials_->sk.empty()) {
-    HRESULT hr1 = reg_key.DeleteValue(kCupClientSecretKey);
-    HRESULT hr2 = reg_key.DeleteValue(kCupClientCookie);
-    return (SUCCEEDED(hr1) && SUCCEEDED(hr2)) ? S_OK : HRESULTFromLastError();
-  }
-
-  hr = reg_key.SetValue(kCupClientSecretKey,
-           static_cast<const byte*>(&cup_credentials_->sk.front()),
-           cup_credentials_->sk.size());
-  if (FAILED(hr)) {
-    return hr;
-  }
-  hr = reg_key.SetValue(kCupClientCookie, CA2T(cup_credentials_->c));
-  if (FAILED(hr)) {
-    return hr;
-  }
-  return S_OK;
-}
-
-void NetworkConfigManager::ClearCupCredentials() {
-  __mutexScope(lock_);
-  cup_credentials_.reset(NULL);
-}
-
-}  // namespace omaha
-
diff --git a/net/network_config.h b/net/network_config.h
deleted file mode 100644
index abb3be6..0000000
--- a/net/network_config.h
+++ /dev/null
@@ -1,354 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// TODO(omaha): might need to remove dependency on winhttp.h when implementing
-// support for wininet; see http://b/1119232
-
-#ifndef OMAHA_NET_NETWORK_CONFIG_H__
-#define OMAHA_NET_NETWORK_CONFIG_H__
-
-#include <windows.h>
-#include <winhttp.h>
-#include <atlstr.h>
-#include <map>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/net/detector.h"
-#include "omaha/net/http_client.h"
-#include "omaha/net/proxy_auth.h"
-
-namespace ATL {
-
-class CSecurityDesc;
-
-}  // namespace ATL
-
-namespace omaha {
-
-class RegKey;
-
-// The cup credentials are persisted across sessions. The sk is encrypted
-// while on the disk so only a user with the same login credentials as
-// the encryptor can decrypt it. The credentials are protected
-// using the system default security, so users can't modify each other's
-// credentials. In case of elevated administrators, the credentials are
-// protected from the non-elevated administrators, so the latter can't
-// read the keys and attack the elevated administrator.
-//
-// Cup credentials can be negotiated using either production keys or
-// test keys. There is a registry value override to specify that test keys
-// be used. For the change to be effective, the old credentials must be cleared.
-struct CupCredentials {
-  std::vector<uint8> sk;             // shared key (sk)
-  CStringA c;                        // client cookie (c)
-};
-
-// There are three ways by which an application could connect to the Internet:
-// 1. Direct connection.
-//    The config for the direction connection must not specify WPAD information
-//    nor named proxy information.
-// 2. Named proxy.
-//    The config for named proxy only includes proxy and proxy_bypass.
-// 3. Proxy auto detection.
-//    The config for proxy auto detection should include either the auto-detect
-//    flag or the auto configuration url. Named proxy information is discarded
-//    if present.
-struct ProxyConfig {
-  ProxyConfig() : auto_detect(false), priority(PROXY_PRIORITY_DEFAULT_NORMAL) {}
-
-  // Used to uniquely identify a proxy.
-  CString source;
-
-  // Specifies the configuration is WPAD.
-  bool auto_detect;
-
-  // The url of the proxy configuration script, if known.
-  CString auto_config_url;
-
-  // Named proxy information.
-  // The proxy string is usually something as "http=foo:80;https=bar:8080".
-  // According to the documentation for WINHTTP_PROXY_INFO, multiple proxies
-  // are separated by semicolons or whitespace. The documentation for
-  // IBackgroundCopyJob::SetProxySettings says that the list is
-  // space-delimited.
-  // TODO(omaha): our proxy information is semicolon-separated. This may
-  // result in compatibility problems with BITS. Fix this.
-  CString proxy;
-  CString proxy_bypass;
-
-  // Suggested priority of the proxy config. When establishing network
-  // connections, it is a good idea to try higher priority proxy first.
-  enum Priority {
-    PROXY_PRIORITY_DEFAULT_NORMAL = 0,
-    PROXY_PRIORITY_DEFAULT_BROWSER = 1,
-    PROXY_PRIORITY_LAST_KNOWN_GOOD = 2,
-    PROXY_PRIORITY_OVERRIDE = 3,
-  } priority;
-};
-
-// Manages the network configurations.
-class NetworkConfig {
- public:
-  // Abstracts the Internet session, as provided by winhttp or wininet.
-  // A winhttp session should map to one and only one identity. in other words,
-  // a winhttp session is used to manage the network traffic of a single
-  // authenticated user, or a group of anonymous users.
-  struct Session {
-    Session() : session_handle(NULL) {}
-
-    HINTERNET session_handle;
-  };
-
-  // Hooks up a proxy detector. The class takes ownership of the detector.
-  void Add(ProxyDetectorInterface* detector);
-
-  // Clears all detectors and configurations. It does not clear the session.
-  // TODO(omaha): rename to avoid the confusion that Clear clears the sessions
-  // as well.
-  void Clear();
-
-  // Detects the network configuration for each of the registered detectors.
-  HRESULT Detect();
-
-  // Detects the network configuration for the given source.
-  HRESULT Detect(const CString& proxy_source, ProxyConfig* config) const;
-
-  static HRESULT ConfigFromIdentifier(const CString& id, ProxyConfig* config);
-
-  static bool ProxySortPredicate(const ProxyConfig& config1,
-                                 const ProxyConfig& config2) {
-    return config1.priority > config2.priority;
-  }
-
-  // Sort the proxy configs based on their priorities. Proxy with higher
-  // priority precedes that with lower priority.
-  static void SortProxies(std::vector<ProxyConfig>* configurations);
-
-  void AppendLastKnownGoodProxyConfig(
-      std::vector<ProxyConfig>* configurations) const;
-
-  // Adds static configurations (WPAD & direct) to current detected network
-  // configuration list.
-  static void AppendStaticProxyConfigs(
-      std::vector<ProxyConfig>* configurations);
-
-  // Returns the detected configurations.
-  std::vector<ProxyConfig> GetConfigurations() const;
-
-  // Gets the persisted CUP credentials.
-  HRESULT GetCupCredentials(CupCredentials* cup_credentials) const;
-
-  // Saves the CUP credentials in persistent storage. If the parameter is null,
-  // it clears the credentials.
-  HRESULT SetCupCredentials(const CupCredentials* cup_credentials) const;
-
-  // Prompts for credentials, or gets cached credentials if they exist.
-  bool GetProxyCredentials(bool allow_ui,
-                           bool force_ui,
-                           const CString& proxy_settings,
-                           const ProxyAuthConfig& proxy_auth_config,
-                           bool is_https,
-                           CString* username,
-                           CString* password,
-                           uint32* auth_scheme);
-
-  // Once a auth scheme has been verified against a proxy, this allows a client
-  // to record the auth scheme that was used and was successful, so it can be
-  // cached for future use within this process.
-  HRESULT SetProxyAuthScheme(const CString& proxy_settings,
-                             bool is_https,
-                             uint32 auth_scheme);
-
-  // Runs the WPAD protocol to compute the proxy information to be used
-  // for the given url. The ProxyInfo pointer members must be freed using
-  // GlobalFree.
-  HRESULT GetProxyForUrl(const CString& url,
-                         const CString& auto_config_url,
-                         HttpClient::ProxyInfo* proxy_info);
-
-  Session session() const { return session_; }
-
-  // Returns the global configuration override if available.
-  HRESULT GetConfigurationOverride(ProxyConfig* configuration_override);
-
-  // Sets the global configuration override. The function clears the existing
-  // configuration if the parameter is NULL.
-  void SetConfigurationOverride(const ProxyConfig* configuration_override);
-
-  // True if the CUP test keys are being used to negotiate the CUP
-  // credentials.
-  bool static IsUsingCupTestKeys();
-
-  // Returns the prefix of the user agent string.
-  static CString GetUserAgent();
-
-  // Returns the MID value under UpdateDev.
-  static CString GetMID();
-
-  // Eliminates the redundant configurations, for example, if multiple
-  // direct connection or proxy auto-detect occur.
-  static void RemoveDuplicates(std::vector<ProxyConfig>*);
-
-  // Saves/loads a proxy source and auto_detect information to the registry
-  // so that that proxy can be tried with high priority when establishing
-  // network connections later on.
-  static HRESULT SaveProxyConfig(const ProxyConfig& config);
-  HRESULT LoadProxyConfig(ProxyConfig* config) const;
-
-  // Parses a network configuration string. The format of the string is:
-  // wpad=[false|true];script=script_url;proxy=host:port
-  // Ignores the names and the values it does not understand.
-  static ProxyConfig ParseNetConfig(const CString& net_config);
-
-  // Serializes configurations for debugging purposes.
-  static CString ToString(const std::vector<ProxyConfig>& configurations);
-  static CString ToString(const ProxyConfig& configuration);
-
-  static int GetAccessType(const ProxyConfig& config);
-
-  // Returns s1 + delim + s2. Consider making it an utility function if
-  // more usage patterns are found.
-  static CString JoinStrings(const TCHAR* s1,
-                             const TCHAR* s2,
-                             const TCHAR* delim);
-
-  // Uses jsproxy to use a PAC proxy configuration file stored on the local
-  // drive, instead of one sourced from WPAD.
-  static HRESULT GetProxyForUrlLocal(const CString& url,
-                                     const CString& path_to_pac_file,
-                                     HttpClient::ProxyInfo* proxy_info);
-
- private:
-  explicit NetworkConfig(bool is_machine);
-  ~NetworkConfig();
-
-  HRESULT Initialize();
-
-  // Configures the proxy auth credentials options. Called by Initialize().
-  void ConfigureProxyAuth();
-
-  // Creates the proxy configuration registry key for the calling user
-  // identified by the token.
-  static HRESULT CreateProxyConfigRegKey(RegKey* key);
-
-  // Converts a response string from a PAC script into an WinHTTP proxy
-  // descriptor struct.
-  static void ConvertPacResponseToProxyInfo(const CStringA& response,
-                                            HttpClient::ProxyInfo* proxy_info);
-
-  static const TCHAR* const kUserAgent;
-
-  static const TCHAR* const kRegKeyProxy;
-  static const TCHAR* const kRegValueSource;
-
-  static const TCHAR* const kWPADIdentifier;
-  static const TCHAR* const kDirectConnectionIdentifier;
-
-  bool is_machine_;     // True if the instance is initialized for machine.
-
-  std::vector<ProxyConfig> configurations_;
-  std::vector<ProxyDetectorInterface*> detectors_;
-
-  // Synchronizes access to per-process instance data, which includes
-  // the detectors and configurations.
-  LLock lock_;
-
-  bool is_initialized_;
-
-  scoped_ptr<ProxyConfig> configuration_override_;
-
-  Session session_;
-  scoped_ptr<HttpClient> http_client_;
-
-  // Manages the proxy auth credentials. Typically a http client tries to
-  // use autologon via Negotiate/NTLM with a proxy server. If that fails, the
-  // Http client then calls GetProxyCredentials() on NetworkConfig.
-  // GetProxyCredentials() gets credentials by either prompting the user, or
-  // cached credentials. Then the http client tries again. Options are set via
-  // ConfigureProxyAuth().
-  ProxyAuth proxy_auth_;
-
-  friend class NetworkConfigManager;
-  DISALLOW_EVIL_CONSTRUCTORS(NetworkConfig);
-};
-
-class NetworkConfigManager {
- public:
-  static NetworkConfigManager& Instance();
-  static void DeleteInstance();
-
-  // Directs this singleton class to create machine or user instance.
-  static void set_is_machine(bool is_machine);
-
-  HRESULT GetUserNetworkConfig(NetworkConfig** network_config);
-
-  // Gets the persisted CUP credentials.
-  HRESULT GetCupCredentials(CupCredentials* cup_credentials);
-
-  // Saves the CUP credentials in persistent storage.
-  HRESULT SetCupCredentials(const CupCredentials& cup_credentials);
-
-  void ClearCupCredentials();
-
- private:
-  explicit NetworkConfigManager();
-  ~NetworkConfigManager();
-
-  static HRESULT CreateInstance();
-
-  void DeleteInstanceInternal();
-
-  HRESULT InitializeLock();
-  HRESULT InitializeRegistryKey();
-
-  HRESULT CreateNetworkConfigInstance(NetworkConfig** network_config_ptr,
-                                      bool is_machine);
-  HRESULT LoadCupCredentialsFromRegistry();
-  HRESULT SaveCupCredentialsToRegistry();
-
-  std::map<CString, NetworkConfig*> user_network_config_map_;
-  scoped_ptr<CupCredentials> cup_credentials_;
-
-  LLock lock_;
-
-  // Synchronizes access to CUP registry.
-  GLock global_lock_;
-
-  // Registry sub key where network configuration is persisted.
-  static const TCHAR* const kNetworkSubkey;
-
-  // Registry sub key where CUP configuration is persisted.
-  static const TCHAR* const kNetworkCupSubkey;
-
-  // The secret key must be encrypted by the caller. This class does not do any
-  // encryption.
-  static const TCHAR* const kCupClientSecretKey;      // CUP sk.
-  static const TCHAR* const kCupClientCookie;         // CUP c.
-
-  static const NetworkConfigManager* const kInvalidInstance;
-  static NetworkConfigManager* instance_;
-  static LLock instance_lock_;
-  static bool is_machine_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(NetworkConfigManager);
-};
-
-}   // namespace omaha
-
-#endif  // OMAHA_NET_NETWORK_CONFIG_H__
-
diff --git a/net/network_config_unittest.cc b/net/network_config_unittest.cc
deleted file mode 100644
index 68b958b..0000000
--- a/net/network_config_unittest.cc
+++ /dev/null
@@ -1,311 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-#include <atlconv.h>
-#include <algorithm>
-#include <cstring>
-#include "base/basictypes.h"
-#include "omaha/base/module_utils.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/net/cup_request.h"
-#include "omaha/net/cup_utils.h"
-#include "omaha/net/http_client.h"
-#include "omaha/net/network_config.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-class NetworkConfigTest : public testing::Test {
- protected:
-  NetworkConfigTest() {}
-
-  static void SetUpTestCase() {}
-
-  static void TearDownTestCase() {}
-
-  virtual void SetUp() {}
-
-  virtual void TearDown() {}
-};
-
-TEST_F(NetworkConfigTest, GetAccessType) {
-  EXPECT_EQ(NetworkConfig::GetAccessType(ProxyConfig()),
-            WINHTTP_ACCESS_TYPE_NO_PROXY);
-
-  ProxyConfig config;
-  config.auto_detect = true;
-  EXPECT_EQ(NetworkConfig::GetAccessType(config),
-            WINHTTP_ACCESS_TYPE_AUTO_DETECT);
-
-  config = ProxyConfig();
-  config.auto_config_url = _T("http://foo");
-  EXPECT_EQ(NetworkConfig::GetAccessType(config),
-            WINHTTP_ACCESS_TYPE_AUTO_DETECT);
-
-  config = ProxyConfig();
-  config.auto_detect = true;
-  config.proxy = _T("foo");
-  EXPECT_EQ(NetworkConfig::GetAccessType(config),
-            WINHTTP_ACCESS_TYPE_AUTO_DETECT);
-
-  config = ProxyConfig();
-  config.proxy = _T("foo");
-  EXPECT_EQ(NetworkConfig::GetAccessType(config),
-            WINHTTP_ACCESS_TYPE_NAMED_PROXY);
-}
-
-TEST_F(NetworkConfigTest, CupCredentials) {
-  NetworkConfig* network_config = NULL;
-  EXPECT_HRESULT_SUCCEEDED(
-      NetworkConfigManager::Instance().GetUserNetworkConfig(&network_config));
-  EXPECT_HRESULT_SUCCEEDED(network_config->SetCupCredentials(NULL));
-
-  CupCredentials cup_credentials1;
-  EXPECT_HRESULT_FAILED(network_config->GetCupCredentials(&cup_credentials1));
-
-  // Start with some random bytes. Persist them as sk and as B64-encoded c.
-  // Read back and verify they match.
-  uint8 data[20] = {0};
-  EXPECT_TRUE(GenRandom(data, arraysize(data)));
-
-  const uint8* first = data;
-  const uint8* last  = data + arraysize(data);
-  cup_credentials1.sk.insert(cup_credentials1.sk.begin(), first, last);
-  cup_credentials1.c = cup_utils::B64Encode(data, arraysize(data));
-
-  EXPECT_HRESULT_SUCCEEDED(
-      network_config->SetCupCredentials(&cup_credentials1));
-
-  CupCredentials cup_credentials2;
-  EXPECT_HRESULT_SUCCEEDED(
-      network_config->GetCupCredentials(&cup_credentials2));
-  EXPECT_EQ(cup_credentials1.sk.size(), cup_credentials2.sk.size());
-  EXPECT_TRUE(memcmp(&cup_credentials1.sk.front(),
-                     &cup_credentials2.sk.front(),
-                     cup_credentials1.sk.size()) == 0);
-  EXPECT_STREQ(cup_credentials1.c, cup_credentials2.c);
-
-  EXPECT_HRESULT_SUCCEEDED(network_config->SetCupCredentials(NULL));
-  EXPECT_HRESULT_FAILED(network_config->GetCupCredentials(&cup_credentials1));
-}
-
-TEST_F(NetworkConfigTest, JoinStrings) {
-  EXPECT_STREQ(NetworkConfig::JoinStrings(NULL, NULL, NULL), _T(""));
-
-  CString result;
-  EXPECT_STREQ(NetworkConfig::JoinStrings(NULL, NULL, _T("-")), _T("-"));
-  EXPECT_STREQ(NetworkConfig::JoinStrings(_T("foo"), _T("bar"), _T("-")),
-                                          _T("foo-bar"));
-}
-
-TEST_F(NetworkConfigTest, GetUserAgentTest) {
-  CString version(GetVersionString());
-  EXPECT_FALSE(version.IsEmpty());
-  CString actual_user_agent(NetworkConfig::GetUserAgent());
-  CString expected_user_agent;
-  expected_user_agent.Format(_T("Google Update/%s"), version);
-  EXPECT_STREQ(actual_user_agent, expected_user_agent);
-}
-
-// Hosts names used in the test are only used as string literals.
-TEST_F(NetworkConfigTest, RemoveDuplicates) {
-  // 'source' is not considered in the hash computation.
-  std::vector<ProxyConfig> configurations;
-  ProxyConfig cfg1;
-  cfg1.source = "foo";
-  ProxyConfig cfg2;
-  cfg2.source = "bar";
-  configurations.push_back(cfg1);
-  configurations.push_back(cfg2);
-  NetworkConfig::RemoveDuplicates(&configurations);
-  EXPECT_EQ(1, configurations.size());
-  configurations.clear();
-
-  // Remove redundant direct connection configurations.
-  ProxyConfig direct_config;
-  configurations.push_back(direct_config);
-  configurations.push_back(direct_config);
-  NetworkConfig::RemoveDuplicates(&configurations);
-  EXPECT_EQ(1, configurations.size());
-  configurations.clear();
-
-  // Remove redundant WPAD configurations.
-  ProxyConfig wpad_config;
-  wpad_config.auto_detect = true;
-  configurations.push_back(wpad_config);
-  configurations.push_back(wpad_config);
-  NetworkConfig::RemoveDuplicates(&configurations);
-  EXPECT_EQ(1, configurations.size());
-  configurations.clear();
-
-  // Remove redundant WPAD with auto config url configurations.
-  ProxyConfig wpad_url_config;
-  wpad_url_config.auto_detect = true;
-  wpad_url_config.auto_config_url = _T("http://www.google.com/wpad.dat");
-  configurations.push_back(wpad_url_config);
-  configurations.push_back(wpad_url_config);
-  NetworkConfig::RemoveDuplicates(&configurations);
-  EXPECT_EQ(1, configurations.size());
-  configurations.clear();
-
-  // Remove redundant named proxy configurations.
-  ProxyConfig named_proxy_config;
-  named_proxy_config.proxy = _T("www1.google.com:3128");
-  configurations.push_back(named_proxy_config);
-  configurations.push_back(named_proxy_config);
-  NetworkConfig::RemoveDuplicates(&configurations);
-  EXPECT_EQ(1, configurations.size());
-  configurations.clear();
-
-  // Does not remove distinct configurations.
-  ProxyConfig named_proxy_config_alt;
-  named_proxy_config_alt.proxy = _T("www2.google.com:3128");
-  configurations.push_back(named_proxy_config);
-  configurations.push_back(named_proxy_config_alt);
-  configurations.push_back(direct_config);
-  configurations.push_back(wpad_config);
-  configurations.push_back(wpad_url_config);
-  NetworkConfig::RemoveDuplicates(&configurations);
-  EXPECT_EQ(5, configurations.size());
-}
-
-TEST_F(NetworkConfigTest, ParseNetConfig) {
-  ProxyConfig config = NetworkConfig::ParseNetConfig(_T(""));
-  EXPECT_EQ(false, config.auto_detect);
-  EXPECT_EQ(true,  config.auto_config_url.IsEmpty());
-  EXPECT_EQ(true,  config.proxy.IsEmpty());
-
-  config = NetworkConfig::ParseNetConfig(_T("wpad=false"));
-  EXPECT_EQ(false, config.auto_detect);
-  EXPECT_EQ(true,  config.auto_config_url.IsEmpty());
-  EXPECT_EQ(true,  config.proxy.IsEmpty());
-
-  config = NetworkConfig::ParseNetConfig(_T("wpad=true"));
-  EXPECT_EQ(true,  config.auto_detect);
-  EXPECT_EQ(true,  config.auto_config_url.IsEmpty());
-  EXPECT_EQ(true,  config.proxy.IsEmpty());
-
-  config = NetworkConfig::ParseNetConfig(_T("script=foo;proxy=bar"));
-  EXPECT_EQ(false, config.auto_detect);
-  EXPECT_STREQ(_T("foo"), config.auto_config_url);
-  EXPECT_EQ(_T("bar"), config.proxy);
-
-  config = NetworkConfig::ParseNetConfig(_T("proxy=foobar"));
-  EXPECT_EQ(false, config.auto_detect);
-  EXPECT_EQ(true, config.auto_config_url.IsEmpty());
-  EXPECT_EQ(_T("foobar"), config.proxy);
-}
-
-TEST_F(NetworkConfigTest, ConfigurationOverride) {
-  NetworkConfig* network_config = NULL;
-  EXPECT_HRESULT_SUCCEEDED(
-      NetworkConfigManager::Instance().GetUserNetworkConfig(&network_config));
-
-  ProxyConfig actual, expected;
-  expected.auto_detect = true;
-  network_config->SetConfigurationOverride(&expected);
-  EXPECT_HRESULT_SUCCEEDED(network_config->GetConfigurationOverride(&actual));
-  EXPECT_EQ(expected.auto_detect, actual.auto_detect);
-
-  network_config->SetConfigurationOverride(NULL);
-  EXPECT_EQ(E_FAIL, network_config->GetConfigurationOverride(&actual));
-}
-
-TEST_F(NetworkConfigTest, GetProxyForUrlLocal) {
-  TCHAR module_directory[MAX_PATH] = {0};
-  ASSERT_TRUE(GetModuleDirectory(NULL, module_directory));
-  CString pac_file_path;
-  pac_file_path.Format(_T("%s\\unittest_support\\localproxytest.pac"),
-                       module_directory);
-
-  HttpClient::ProxyInfo proxy_info = {};
-
-  // The PAC file should emit a preset response for any URL with a hostname
-  // matching *.omahaproxytest.com and DIRECT otherwise.
-
-  EXPECT_HRESULT_SUCCEEDED(NetworkConfig::GetProxyForUrlLocal(
-    _T("http://regex.matches.domain.omahaproxytest.com/test_url/index.html"),
-    pac_file_path, &proxy_info));
-  EXPECT_EQ(WINHTTP_ACCESS_TYPE_NAMED_PROXY, proxy_info.access_type);
-  EXPECT_STREQ(_T("omaha_unittest1;omaha_unittest2:8080"),
-               CString(proxy_info.proxy));
-  EXPECT_EQ(NULL, proxy_info.proxy_bypass);
-
-  if (proxy_info.proxy) {
-    ::GlobalFree(const_cast<TCHAR*>(proxy_info.proxy));
-  }
-  if (proxy_info.proxy_bypass) {
-    ::GlobalFree(const_cast<TCHAR*>(proxy_info.proxy_bypass));
-  }
-
-  EXPECT_HRESULT_SUCCEEDED(NetworkConfig::GetProxyForUrlLocal(
-    _T("http://should.not.match.domain.example.com/test_url/index.html"),
-    pac_file_path, &proxy_info));
-  EXPECT_EQ(WINHTTP_ACCESS_TYPE_NO_PROXY, proxy_info.access_type);
-  EXPECT_EQ(NULL, proxy_info.proxy);
-  EXPECT_EQ(NULL, proxy_info.proxy_bypass);
-}
-
-class NetworkConfigManagerTest : public testing::Test {
- protected:
-  NetworkConfigManagerTest() {}
-
-  static void SetUpTestCase() {}
-
-  static void TearDownTestCase() {}
-
-  virtual void SetUp() {
-    NetworkConfigManager::Instance().ClearCupCredentials();
-  }
-
-  virtual void TearDown() {
-    NetworkConfigManager::Instance().ClearCupCredentials();
-  }
-};
-
-TEST_F(NetworkConfigManagerTest, CupCredentials) {
-  NetworkConfigManager& ncm(NetworkConfigManager::Instance());
-
-  CupCredentials cup_credentials;
-  EXPECT_EQ(E_INVALIDARG, ncm.SetCupCredentials(cup_credentials));
-
-  ncm.ClearCupCredentials();
-
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_NOT_FOUND),
-            ncm.GetCupCredentials(&cup_credentials));
-
-  const int kKeySizeBytes = 16;
-  cup_credentials.sk.resize(kKeySizeBytes);
-  EXPECT_TRUE(GenRandom(&cup_credentials.sk.front(),
-                         cup_credentials.sk.size()));
-  cup_credentials.c = "a cookie";
-
-  EXPECT_HRESULT_SUCCEEDED(ncm.SetCupCredentials(cup_credentials));
-
-  CupCredentials actual_cup_credentials;
-  EXPECT_HRESULT_SUCCEEDED(ncm.GetCupCredentials(&actual_cup_credentials));
-
-  EXPECT_TRUE(std::equal(actual_cup_credentials.sk.begin(),
-                         actual_cup_credentials.sk.end(),
-                         cup_credentials.sk.begin()));
-  EXPECT_STREQ(actual_cup_credentials.c, cup_credentials.c);
-}
-
-}  // namespace omaha
-
diff --git a/net/network_request.cc b/net/network_request.cc
deleted file mode 100644
index 7893c38..0000000
--- a/net/network_request.cc
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/net/network_request.h"
-#include "omaha/net/network_request_impl.h"
-
-namespace omaha {
-
-NetworkRequest::NetworkRequest(const NetworkConfig::Session& network_session) {
-  impl_.reset(new detail::NetworkRequestImpl(network_session));
-}
-
-NetworkRequest::~NetworkRequest() {
-}
-
-HRESULT NetworkRequest::Close() {
-  return impl_->Close();
-}
-
-void NetworkRequest::AddHttpRequest(HttpRequestInterface* http_request) {
-  return impl_->AddHttpRequest(http_request);
-}
-
-HRESULT NetworkRequest::Post(const CString& url,
-                             const void* buffer,
-                             size_t length,
-                             std::vector<uint8>* response) {
-  return impl_->Post(url, buffer, length, response);
-}
-
-HRESULT NetworkRequest::Get(const CString& url, std::vector<uint8>* response) {
-  return impl_->Get(url, response);
-}
-
-HRESULT NetworkRequest::DownloadFile(const CString& url,
-                                     const CString& filename) {
-  return impl_->DownloadFile(url, filename);
-}
-
-HRESULT NetworkRequest::Pause() {
-  return impl_->Pause();
-}
-
-HRESULT NetworkRequest::Resume() {
-  return impl_->Resume();
-}
-
-HRESULT NetworkRequest::Cancel() {
-  return impl_->Cancel();
-}
-
-void NetworkRequest::AddHeader(const TCHAR* name, const TCHAR* value) {
-  return impl_->AddHeader(name, value);
-}
-
-int NetworkRequest::http_status_code() const {
-  return impl_->http_status_code();
-}
-
-void NetworkRequest::set_proxy_auth_config(const ProxyAuthConfig& config) {
-  return impl_->set_proxy_auth_config(config);
-}
-
-void NetworkRequest::set_num_retries(int num_retries) {
-  return impl_->set_num_retries(num_retries);
-}
-
-void NetworkRequest::set_time_between_retries(int time_between_retries_ms) {
-  return impl_->set_time_between_retries(time_between_retries_ms);
-}
-
-void NetworkRequest::set_callback(NetworkRequestCallback* callback) {
-  return impl_->set_callback(callback);
-}
-
-void NetworkRequest::set_preserve_protocol(bool preserve_protocol) {
-  return impl_->set_preserve_protocol(preserve_protocol);
-}
-
-CString NetworkRequest::response_headers() const {
-  return impl_->response_headers();
-}
-
-CString NetworkRequest::trace() const {
-  return impl_->trace();
-}
-
-HRESULT NetworkRequest::QueryHeadersString(uint32 info_level,
-                                           const TCHAR* name,
-                                           CString* value) {
-  return impl_->QueryHeadersString(info_level, name, value);
-}
-
-void NetworkRequest::set_low_priority(bool low_priority) {
-  return impl_->set_low_priority(low_priority);
-}
-
-void NetworkRequest::set_proxy_configuration(
-    const ProxyConfig* proxy_configuration) {
-  return impl_->set_proxy_configuration(proxy_configuration);
-}
-
-HRESULT PostRequest(NetworkRequest* network_request,
-                    bool fallback_to_https,
-                    const CString& url,
-                    const CString& request_string,
-                    std::vector<uint8>* response) {
-  return detail::PostRequest(network_request,
-                             fallback_to_https,
-                             url,
-                             request_string,
-                             response);
-}
-
-HRESULT GetRequest(NetworkRequest* network_request,
-                   const CString& url,
-                   std::vector<uint8>* response) {
-  return detail::GetRequest(network_request, url, response);
-}
-
-}  // namespace omaha
-
diff --git a/net/network_request.h b/net/network_request.h
deleted file mode 100644
index 678bcf0..0000000
--- a/net/network_request.h
+++ /dev/null
@@ -1,209 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-//
-// TODO(omaha): implement a way to get the last network error.
-//
-// TODO(omaha): might have to do some working regarding the cookie handling.
-// WinHttp keeps a per session cookie cache. We are currently tearing down
-// the session after each request, so cookies are lost. Normally we don't
-// need cookies at Omaha except for CUP.
-
-#ifndef OMAHA_NET_NETWORK_REQUEST_H__
-#define OMAHA_NET_NETWORK_REQUEST_H__
-
-#include <windows.h>
-#include <winhttp.h>
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/string.h"
-#include "omaha/base/time.h"
-#include "omaha/net/network_config.h"
-
-namespace omaha {
-
-namespace detail {
-
-class NetworkRequestImpl;
-
-}   // namespace detail
-
-class NetworkRequestCallback {
- public:
-  virtual ~NetworkRequestCallback() {}
-
-  // Notifies download begins. This gives the callee a chance to initialize its
-  // download state, such as resetting the download progress.
-  virtual void OnRequestBegin() = 0;
-
-  // Indicates the progress of the NetworkRequest.
-  //
-  // bytes - Current number of bytes transferred, relative to the expected
-  //         maximum indicated by the bytes_total.
-  // bytes_total - The expected total number of bytes to transfer. This is
-  //               usually the content length value or 0 if the content length
-  //               is not available.
-  // status - WinHttp status codes regarding the progress of the request.
-  // status_text - Additional information, when available.
-  virtual void OnProgress(int bytes, int bytes_total,
-                          int status, const TCHAR* status_text) = 0;
-
-  virtual void OnRequestRetryScheduled(time64 next_retry_time) = 0;
-};
-
-class  HttpRequestInterface;
-
-// NetworkRequest is the main interface to the net module. The semantics of
-// the interface is defined as transferring bytes from a url, with an optional
-// request body, to a destination specified as a memory buffer or a file.
-// NetworkRequest encapsulates the retry logic for a request, the fall back to
-// different network configurations, and ultimately the fallback to different
-// network mechanisms. The calls are blocking calls. One instance of the class
-// is responsible for one request only.
-// The client of NetworkRequest is responsible for configuring the network
-// fallbacks. This gives the caller a lot of flexibility over the fallbacks but
-// it requires more work to properly set the fallback chain.
-class NetworkRequest {
- public:
-  explicit NetworkRequest(const NetworkConfig::Session& network_session);
-  ~NetworkRequest();
-
-  // Cancels the request. Cancel can be called from a different thread.
-  // Calling Cancel makes the control return to the caller of Post or Get
-  // methods. The object can't be reused once it is canceled.
-  HRESULT Cancel();
-
-  // Closes the request and releases the request resources, such as handles or
-  // interface pointers. Unlike Cancel, the request object can be reused
-  // after closing.
-  HRESULT Close();
-
-  // Adds an instance of HttpRequestInterface at the end of the fallback
-  // chain of http requests. This class takes ownership of the http_request
-  // object.
-  void AddHttpRequest(HttpRequestInterface* http_request);
-
-  // Post, Get, and DownloadFile return S_OK if the request completed
-  // successfully and the response is available to the caller. For errors,
-  // the status code can be checked.
-  //
-  // Posts a buffer to a url.
-  HRESULT Post(const CString& url,
-               const void* buffer,
-               size_t length,
-               std::vector<uint8>* response);
-
-  // Posts an UTF-8 string to a url.
-  HRESULT PostUtf8String(const CString& url,
-               const CStringA& request,
-               std::vector<uint8>* response) {
-    const uint8* buffer = reinterpret_cast<const uint8*>(request.GetString());
-    size_t length = request.GetLength();
-    return Post(url, buffer, length, response);
-  }
-
-  // Posts a Unicode string to a url.
-  HRESULT PostString(const CString& url,
-                     const CString& request,
-                     std::vector<uint8>* response) {
-    return PostUtf8String(url, WideToUtf8(request), response);
-  }
-
-  // Gets a url.
-  HRESULT Get(const CString& url, std::vector<uint8>* response);
-
-  // Downloads a url to a file.
-  HRESULT DownloadFile(const CString& url, const CString& filename);
-
-  // Enables a separate thread to temporarily stops the network downloading.
-  // The downloading thread will be blocked inside NetworkRequest::Post/Get
-  // infinitely by an event until Resume/Cancel/Close is called.
-  HRESULT Pause();
-
-  // Enables a separate thread to resume current network request if it is in
-  // pause state.
-  HRESULT Resume();
-
-  // Adds a request header. The header with the same name is only added once.
-  // The method is only good enough for what Omaha needs and it is not good
-  // for general purpose header manipulation, which is quite sophisticated.
-  void AddHeader(const TCHAR* name, const TCHAR* value);
-
-  // Queries a response header. This is the companion for the AddHeader
-  // method above.
-  HRESULT QueryHeadersString(uint32 info_level,
-                             const TCHAR* name,
-                             CString* value);
-
-  // Returns the http status code if available.
-  int http_status_code() const;
-
-  // Returns the response headers, separated by \r\n.
-  CString response_headers() const;
-
-  // Returns a trace of the request for logging purposes.
-  CString trace() const;
-
-  void set_proxy_auth_config(const ProxyAuthConfig& proxy_auth_config);
-
-  // Sets the number of retries for the request. The retry mechanism uses
-  // exponential backoff to decrease the rate of the retries.
-  void set_num_retries(int num_retries);
-
-  void set_time_between_retries(int time_between_retries_ms);
-
-  // Sets an external observer for the request. The ownership of the callback
-  // remains with the caller. The current implementation provides callback
-  // notification for DownloadFile only.
-  void set_callback(NetworkRequestCallback* callback);
-
-  // Sets the priority of the request. Currently, only BITS requests support
-  // prioritization of requests.
-  void set_low_priority(bool low_priority);
-
-  // Overrides detecting the network configuration and uses the configuration
-  // specified. If parameter is NULL, it defaults to detecting the configuration
-  // automatically.
-  void set_proxy_configuration(const ProxyConfig* proxy_configuration);
-
-  void set_preserve_protocol(bool preserve_protocol);
-
- private:
-  // Uses pimpl idiom to minimize dependencies on implementation details.
-  scoped_ptr<detail::NetworkRequestImpl> impl_;
-  DISALLOW_EVIL_CONSTRUCTORS(NetworkRequest);
-};
-
-
-// Posts a request, falling back from http to https if the http request failed.
-// Returns S_OK if the request is successfully sent. Returns the error
-// corresponding to the http request in case of errors.
-HRESULT PostRequest(NetworkRequest* network_request,
-                    bool fallback_to_https,
-                    const CString& url,
-                    const CString& request_string,
-                    std::vector<uint8>* response);
-
-// Gets a request.
-HRESULT GetRequest(NetworkRequest* network_request,
-                   const CString& url,
-                   std::vector<uint8>* response);
-
-}   // namespace omaha
-
-#endif  // OMAHA_NET_NETWORK_REQUEST_H__
-
diff --git a/net/network_request_impl.cc b/net/network_request_impl.cc
deleted file mode 100644
index 5437c77..0000000
--- a/net/network_request_impl.cc
+++ /dev/null
@@ -1,662 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/net/network_request_impl.h"
-#include <limits.h>
-#include <atlsecurity.h>
-#include <algorithm>
-#include <cctype>
-#include <functional>
-#include <vector>
-#include "base/basictypes.h"
-#include "omaha/base/const_addresses.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/string.h"
-#include "omaha/base/time.h"
-#include "omaha/net/http_client.h"
-#include "omaha/net/net_utils.h"
-#include "omaha/net/network_config.h"
-
-namespace omaha {
-
-namespace detail {
-
-// Returns the user sid corresponding to the token. This function is only used
-// for logging purposes.
-CString GetTokenUser(HANDLE token) {
-  CAccessToken access_token;
-  access_token.Attach(token);
-  CSid sid;
-  access_token.GetUser(&sid);
-  access_token.Detach();
-  return sid.Sid();
-}
-
-// Logs bytes from the beginning of the file. Non-printable bytes are
-// replaced with '.'.
-void LogFileBytes(const CString& filename, size_t num_bytes) {
-  scoped_hfile file(::CreateFile(filename,
-                                 GENERIC_READ,
-                                 FILE_SHARE_READ,
-                                 NULL,
-                                 OPEN_EXISTING,
-                                 FILE_ATTRIBUTE_NORMAL,
-                                 NULL));
-  std::vector<char> bytes(num_bytes);
-  DWORD bytes_read(0);
-  if (file) {
-    ::ReadFile(get(file), &bytes.front(), bytes.size(), &bytes_read, NULL);
-  }
-  bytes.resize(bytes_read);
-  replace_if(bytes.begin(), bytes.end(), std::not1(std::ptr_fun(isprint)), '.');
-  bytes.push_back('\0');
-  NET_LOG(L3, (_T("[file bytes: %hs]"), &bytes.front()));
-}
-
-NetworkRequestImpl::NetworkRequestImpl(
-    const NetworkConfig::Session& network_session)
-      : cur_http_request_(NULL),
-        cur_proxy_config_(NULL),
-        cur_retry_count_(0),
-        last_hr_(S_OK),
-        last_http_status_code_(0),
-        http_status_code_(0),
-        proxy_auth_config_(NULL, CString()),
-        num_retries_(0),
-        low_priority_(false),
-        time_between_retries_ms_(kDefaultTimeBetweenRetriesMs),
-        callback_(NULL),
-        request_buffer_(NULL),
-        request_buffer_length_(0),
-        response_(NULL),
-        network_session_(network_session),
-        is_canceled_(false),
-        preserve_protocol_(false) {
-  // NetworkConfig::Initialize must be called before using NetworkRequest.
-  // If Winhttp cannot be loaded, this handle will be NULL.
-  if (!network_session.session_handle) {
-    NET_LOG(LW, (_T("[NetworkRequestImpl: session_handle is NULL.]")));
-  }
-
-  // Create a manual reset event to wait on during retry periods.
-  // The event is signaled by NetworkRequestImpl::Cancel, to break out of
-  // the retry loop and return control to the caller.
-  reset(event_cancel_, ::CreateEvent(NULL, true, false, NULL));
-  ASSERT1(event_cancel_);
-
-  const CString mid(NetworkConfig::GetMID());
-  if (!mid.IsEmpty()) {
-    AddHeader(kHeaderXMID, mid);
-  }
-}
-
-NetworkRequestImpl::~NetworkRequestImpl() {
-  for (size_t i = 0; i != http_request_chain_.size(); ++i) {
-    delete http_request_chain_[i];
-  }
-}
-
-void NetworkRequestImpl::Reset() {
-  if (response_) {
-    response_->clear();
-  }
-  response_headers_.Empty();
-  http_status_code_      = 0;
-  cur_http_request_      = NULL;
-  cur_proxy_config_      = NULL;
-  cur_retry_count_       = 0;
-  last_hr_               = S_OK;
-  last_http_status_code_ = 0;
-}
-
-HRESULT NetworkRequestImpl::Close() {
-  HRESULT hr = S_OK;
-  for (size_t i = 0; i != http_request_chain_.size(); ++i) {
-    hr = http_request_chain_[i]->Close();
-  }
-  return hr;
-}
-
-HRESULT NetworkRequestImpl::Cancel() {
-  NET_LOG(L3, (_T("[NetworkRequestImpl::Cancel]")));
-  HRESULT hr = S_OK;
-  ::InterlockedExchange(&is_canceled_, true);
-  if (event_cancel_) {
-    hr = ::SetEvent(get(event_cancel_)) ? S_OK : HRESULTFromLastError();
-  }
-  for (size_t i = 0; i != http_request_chain_.size(); ++i) {
-    hr = http_request_chain_[i]->Cancel();
-  }
-  return hr;
-}
-
-void NetworkRequestImpl::AddHttpRequest(HttpRequestInterface* http_request) {
-  ASSERT1(http_request);
-  http_request_chain_.push_back(http_request);
-}
-
-HRESULT NetworkRequestImpl::Post(const CString& url,
-                                 const void* buffer,
-                                 size_t length,
-                                 std::vector<uint8>* response) {
-  ASSERT1(response);
-  url_ = url;
-  request_buffer_ = buffer;
-  request_buffer_length_ = length;
-  response_ = response;
-  return DoSendWithRetries();
-}
-
-HRESULT NetworkRequestImpl::Get(const CString& url,
-                                std::vector<uint8>* response) {
-  ASSERT1(response);
-  url_ = url;
-  request_buffer_ = NULL;
-  request_buffer_length_ = 0;
-  response_ = response;
-  return DoSendWithRetries();
-}
-
-HRESULT NetworkRequestImpl::DownloadFile(const CString& url,
-                                         const CString& filename) {
-  url_ = url;
-  filename_ = filename;
-  request_buffer_ = NULL;
-  request_buffer_length_ = 0;
-  response_ = NULL;
-  return DoSendWithRetries();
-}
-
-HRESULT NetworkRequestImpl::Pause() {
-  NET_LOG(L3, (_T("[NetworkRequestImpl::Pause]")));
-  HRESULT hr = S_OK;
-
-  for (size_t i = 0; i != http_request_chain_.size(); ++i) {
-    HRESULT hr2 = http_request_chain_[i]->Pause();
-
-    // Only overwrite hr if it doesn't have useful error information.
-    if (SUCCEEDED(hr)) {
-      hr = hr2;
-    }
-  }
-  return hr;
-}
-
-HRESULT NetworkRequestImpl::Resume() {
-  NET_LOG(L3, (_T("[NetworkRequestImpl::Pause]")));
-  HRESULT hr = S_OK;
-
-  for (size_t i = 0; i != http_request_chain_.size(); ++i) {
-    HRESULT hr2 = http_request_chain_[i]->Resume();
-
-    // Only overwrite hr if it doesn't have useful error information.
-    if (SUCCEEDED(hr)) {
-      hr = hr2;
-    }
-  }
-  return hr;
-}
-
-HRESULT NetworkRequestImpl::DoSendWithRetries() {
-  ASSERT1(num_retries_ >= 0);
-  ASSERT1(response_ || !filename_.IsEmpty());
-
-  Reset();
-
-  int http_status_code(0);
-  CString response_headers;
-  std::vector<uint8> response;
-
-  SafeCStringAppendFormat(&trace_, _T("Url=%s\r\n"), url_);
-
-  HRESULT hr = S_OK;
-  int wait_interval_ms = time_between_retries_ms_;
-  for (cur_retry_count_ = 0;
-       cur_retry_count_ < 1 + num_retries_;
-       ++cur_retry_count_) {
-    if (IsHandleSignaled(get(event_cancel_))) {
-      ASSERT1(is_canceled_);
-
-      // There is no state to be set when the request is canceled.
-      return GOOPDATE_E_CANCELLED;
-    }
-
-    // Wait before retrying if there are retries to be done.
-    if (cur_retry_count_ > 0) {
-      if (callback_) {
-        const time64 next_retry_time = GetCurrent100NSTime() +
-                                       wait_interval_ms * kMillisecsTo100ns;
-        callback_->OnRequestRetryScheduled(next_retry_time);
-      }
-
-      NET_LOG(L3, (_T("[wait %d ms]"), wait_interval_ms));
-      VERIFY1(::WaitForSingleObject(get(event_cancel_),
-                                    wait_interval_ms) != WAIT_FAILED);
-
-      if (callback_) {
-        callback_->OnRequestBegin();
-      }
-
-      // Compute the next wait interval and check for multiplication overflow.
-      if (wait_interval_ms > INT_MAX / kTimeBetweenRetriesMultiplier) {
-        ASSERT1(false);
-        hr = HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW);
-        break;
-      }
-      wait_interval_ms *= kTimeBetweenRetriesMultiplier;
-    }
-
-    DetectProxyConfiguration(&proxy_configurations_);
-    ASSERT1(!proxy_configurations_.empty());
-    OPT_LOG(L2, (_T("[detected configurations][\r\n%s]"),
-                 NetworkConfig::ToString(proxy_configurations_)));
-
-    hr = DoSend(&http_status_code, &response_headers, &response);
-    HttpClient::StatusCodeClass status_code_class =
-        HttpClient::GetStatusCodeClass(http_status_code);
-    if (SUCCEEDED(hr) ||
-        hr == GOOPDATE_E_CANCELLED ||
-        status_code_class == HttpClient::STATUS_CODE_CLIENT_ERROR) {
-      break;
-    }
-  }
-
-  // Update the object state with the local values.
-  http_status_code_ = http_status_code;
-  response_headers_ = response_headers;
-  if (response_) {
-    response_->swap(response);
-  }
-
-  // Avoid returning generic errors from the network stack.
-  ASSERT1(hr != E_FAIL);
-  return hr;
-}
-
-HRESULT NetworkRequestImpl::DoSend(int* http_status_code,
-                                   CString* response_headers,
-                                   std::vector<uint8>* response) const {
-  ASSERT1(http_status_code);
-  ASSERT1(response_headers);
-  ASSERT1(response);
-
-  OPT_LOG(L3, (_T("[Send][url=%s][request=%s][filename=%s]"),
-          url_,
-          BufferToPrintableString(request_buffer_, request_buffer_length_),
-          filename_));
-
-  // Cache the values corresponding to the error encountered by the first
-  // configuration, which is the preferred configuration.
-  HRESULT error_hr = S_OK;
-  int     error_http_status_code = 0;
-  CString error_response_headers;
-  std::vector<uint8> error_response;
-
-  // Tries out all the available configurations until one of them succeeds.
-  // TODO(omaha): remember the last good configuration and prefer that for
-  // future requests.
-  HRESULT hr = S_OK;
-  ASSERT1(!proxy_configurations_.empty());
-  for (size_t i = 0; i != proxy_configurations_.size(); ++i) {
-    cur_proxy_config_ = &proxy_configurations_[i];
-    hr = DoSendWithConfig(http_status_code, response_headers, response);
-    if (i == 0 && FAILED(hr)) {
-      error_hr = hr;
-      error_http_status_code = *http_status_code;
-      error_response_headers = *response_headers;
-      error_response.swap(*response);
-    }
-
-    if (SUCCEEDED(hr) ||
-        hr == GOOPDATE_E_CANCELLED ||
-        hr == CI_E_BITS_DISABLED ||
-        *http_status_code == HTTP_STATUS_NOT_FOUND) {
-      break;
-    }
-  }
-
-  // There are only four possible outcomes: success, cancel, BITS disabled
-  // and an error other than these.
-  HRESULT result = S_OK;
-  if (SUCCEEDED(hr) ||
-      hr == GOOPDATE_E_CANCELLED ||
-      hr == CI_E_BITS_DISABLED) {
-    result = hr;
-  } else {
-    // In case of errors, log the error and the response returned by the first
-    // network configuration.
-    result = error_hr;
-    *http_status_code = error_http_status_code;
-    *response_headers = error_response_headers;
-    response->swap(error_response);
-  }
-
-  OPT_LOG(L3, (_T("[Send response received][result 0x%x][status code %d][%s]"),
-      result, *http_status_code, VectorToPrintableString(*response)));
-
-#ifdef DEBUG
-  if (!filename_.IsEmpty()) {
-    const size_t kNumBytes = 8196;    // 8 kb.
-    LogFileBytes(filename_, kNumBytes);
-  }
-#endif
-
-  return result;
-}
-
-HRESULT NetworkRequestImpl::DoSendWithConfig(
-    int* http_status_code,
-    CString* response_headers,
-    std::vector<uint8>* response) const {
-  ASSERT1(response_headers);
-  ASSERT1(response);
-  ASSERT1(http_status_code);
-
-  bool    first_error_from_http_request_saved = false;
-  HRESULT error_hr = S_OK;
-  int     error_http_status_code = 0;
-  CString error_response_headers;
-  std::vector<uint8> error_response;
-
-  ASSERT1(cur_proxy_config_);
-
-  CString msg;
-  SafeCStringFormat(&msg, _T("Trying config: %s"),
-                    NetworkConfig::ToString(*cur_proxy_config_));
-  NET_LOG(L3, (_T("[%s]"), msg));
-  SafeCStringAppendFormat(&trace_, _T("%s.\r\n"), msg);
-
-  HRESULT hr = S_OK;
-  ASSERT1(!http_request_chain_.empty());
-  for (size_t i = 0; i != http_request_chain_.size(); ++i) {
-    cur_http_request_ = http_request_chain_[i];
-
-    CString msg;
-    SafeCStringFormat(&msg, _T("trying %s"), cur_http_request_->ToString());
-    NET_LOG(L3, (_T("[%s]"), msg));
-    SafeCStringAppendFormat(&trace_, _T("%s.\r\n"), msg);
-
-    hr = DoSendHttpRequest(http_status_code, response_headers, response);
-
-    SafeCStringFormat(&msg,
-                      _T("Send request returned 0x%08x. Http status code %d"),
-                      hr, *http_status_code);
-    NET_LOG(L3, (_T("[%s]"), msg));
-    SafeCStringAppendFormat(&trace_, _T("%s.\r\n"), msg);
-
-    if (!first_error_from_http_request_saved && FAILED(hr) &&
-        hr != CI_E_BITS_DISABLED) {
-      error_hr = hr;
-      error_http_status_code = cur_http_request_->GetHttpStatusCode();
-      error_response_headers = cur_http_request_->GetResponseHeaders();
-      cur_http_request_->GetResponse().swap(error_response);
-      first_error_from_http_request_saved = true;
-    }
-
-    // The chain traversal stops when the request is successful or
-    // it is canceled, or the status code is 404.
-    // In the case of 404 response, all HttpRequests are likely to return
-    // the same 404 response.
-    if (SUCCEEDED(hr) ||
-        hr == GOOPDATE_E_CANCELLED ||
-        *http_status_code == HTTP_STATUS_NOT_FOUND) {
-      break;
-    }
-  }
-
-  // There are only three possible outcomes: success, cancel, and an error
-  // other than cancel.
-  HRESULT result = S_OK;
-  if (SUCCEEDED(hr) || hr == GOOPDATE_E_CANCELLED) {
-    result = hr;
-  } else {
-    ASSERT1(first_error_from_http_request_saved);
-    if (first_error_from_http_request_saved) {
-      // In case of errors, log the error and the response returned by the first
-      // active http request object.
-      result = error_hr;
-      *http_status_code = error_http_status_code;
-      *response_headers = error_response_headers;
-      response->swap(error_response);
-    } else {
-      ASSERT1(false);   // BITS is the onlay channel and is disabled.
-      NET_LOG(LE, (_T("Possiblly no viable network channel is available.")));
-      result = E_UNEXPECTED;
-    }
-  }
-
-  if (SUCCEEDED(hr)) {
-    NetworkConfig::SaveProxyConfig(*cur_proxy_config_);
-  }
-  return result;
-}
-
-HRESULT NetworkRequestImpl::DoSendHttpRequest(
-    int* http_status_code,
-    CString* response_headers,
-    std::vector<uint8>* response) const {
-  ASSERT1(response_headers);
-  ASSERT1(response);
-  ASSERT1(http_status_code);
-
-  ASSERT1(cur_http_request_);
-
-  // Set common HttpRequestInterface properties.
-  cur_http_request_->set_session_handle(network_session_.session_handle);
-  cur_http_request_->set_request_buffer(request_buffer_,
-                                        request_buffer_length_);
-  cur_http_request_->set_url(url_);
-  cur_http_request_->set_filename(filename_);
-  cur_http_request_->set_low_priority(low_priority_);
-  cur_http_request_->set_callback(callback_);
-  cur_http_request_->set_additional_headers(BuildPerRequestHeaders());
-  cur_http_request_->set_proxy_configuration(*cur_proxy_config_);
-  cur_http_request_->set_preserve_protocol(preserve_protocol_);
-  cur_http_request_->set_proxy_auth_config(proxy_auth_config_);
-
-  if (IsHandleSignaled(get(event_cancel_))) {
-    return GOOPDATE_E_CANCELLED;
-  }
-
-  if (callback_) {
-    callback_->OnRequestBegin();
-  }
-
-  // The algorithm is very rough meaning it does not look at the error
-  // returned by the Send and it blindly retries the call. For some errors
-  // it may not make sense to retry at all, for example, let's say the
-  // error is ERROR_DISK_FULL.
-  NET_LOG(L3, (_T("[%s]"), url_));
-  last_hr_ = cur_http_request_->Send();
-  NET_LOG(L3, (_T("[HttpRequestInterface::Send returned 0x%08x]"), last_hr_));
-
-  if (last_hr_ == GOOPDATE_E_CANCELLED) {
-    return last_hr_;
-  }
-
-  last_http_status_code_ = cur_http_request_->GetHttpStatusCode();
-
-  *http_status_code = cur_http_request_->GetHttpStatusCode();
-  *response_headers = cur_http_request_->GetResponseHeaders();
-  cur_http_request_->GetResponse().swap(*response);
-
-  // Check if the computer is connected to the network.
-  if (FAILED(last_hr_)) {
-    last_hr_ = IsMachineConnectedToNetwork() ? last_hr_ : GOOPDATE_E_NO_NETWORK;
-    return last_hr_;
-  }
-
-  // Status code must be available if the http request is successful. This
-  // is the contract that http requests objects in the fallback chain must
-  // implement.
-  ASSERT1(SUCCEEDED(last_hr_) && *http_status_code);
-  ASSERT1(HTTP_STATUS_FIRST <= *http_status_code &&
-          *http_status_code <= HTTP_STATUS_LAST);
-
-  switch (*http_status_code) {
-    case HTTP_STATUS_OK:                // 200
-    case HTTP_STATUS_NO_CONTENT:        // 204
-    case HTTP_STATUS_PARTIAL_CONTENT:   // 206
-    case HTTP_STATUS_NOT_MODIFIED:      // 304
-      last_hr_ = S_OK;
-      break;
-
-    default:
-      last_hr_ = HRESULTFromHttpStatusCode(*http_status_code);
-      break;
-  }
-  return last_hr_;
-}
-
-CString NetworkRequestImpl::BuildPerRequestHeaders() const {
-  CString headers(additional_headers_);
-
-  const CString& user_agent(cur_http_request_->user_agent());
-  if (!user_agent.IsEmpty()) {
-    SafeCStringAppendFormat(&headers, _T("%s: %s\r\n"),
-                                      kHeaderUserAgent, user_agent);
-  }
-
-  SafeCStringAppendFormat(&headers, _T("%s: 0x%x\r\n"),
-                                    kHeaderXLastHR, last_hr_);
-  SafeCStringAppendFormat(&headers,
-                          _T("%s: %d\r\n"),
-                          kHeaderXLastHTTPStatusCode, last_http_status_code_);
-
-  SafeCStringAppendFormat(&headers, _T("%s: %d\r\n"),
-                                    kHeaderXRetryCount, cur_retry_count_);
-
-  return headers;
-}
-
-void NetworkRequestImpl::AddHeader(const TCHAR* name, const TCHAR* value) {
-  ASSERT1(name && *name);
-  ASSERT1(value && *value);
-  if (_tcsicmp(additional_headers_, name) == 0) {
-    return;
-  }
-  // Documentation specifies each header must be terminated by \r\n.
-  SafeCStringAppendFormat(&additional_headers_, _T("%s: %s\r\n"), name, value);
-}
-
-HRESULT NetworkRequestImpl::QueryHeadersString(uint32 info_level,
-                                               const TCHAR* name,
-                                               CString* value) {
-  // Name can be null when the info_level specifies the header to query.
-  ASSERT1(value);
-  if (!cur_http_request_) {
-    return E_UNEXPECTED;
-  }
-  return cur_http_request_->QueryHeadersString(info_level, name, value);
-}
-
-void NetworkRequestImpl::DetectProxyConfiguration(
-    std::vector<ProxyConfig>* proxy_configurations) const {
-  ASSERT1(proxy_configurations);
-
-  proxy_configurations->clear();
-
-  // Use this object's configuration override if one is set.
-  if (proxy_configuration_.get()) {
-    proxy_configurations->push_back(*proxy_configuration_);
-    return;
-  }
-
-  // Use the global configuration override if the network config has one.
-  NetworkConfig* network_config = NULL;
-  NetworkConfigManager& network_manager = NetworkConfigManager::Instance();
-  HRESULT hr = network_manager.GetUserNetworkConfig(&network_config);
-  if (SUCCEEDED(hr)) {
-    ProxyConfig config;
-    if (SUCCEEDED(network_config->GetConfigurationOverride(&config))) {
-      proxy_configurations->push_back(config);
-      return;
-    }
-
-    // Detect the configurations if no configuration override is specified.
-    hr = network_config->Detect();
-    if (SUCCEEDED(hr)) {
-      network_config->GetConfigurations().swap(*proxy_configurations);
-    } else {
-      NET_LOG(LW, (_T("[failed to detect net config][0x%08x]"), hr));
-    }
-
-    network_config->AppendLastKnownGoodProxyConfig(proxy_configurations);
-  } else {
-    NET_LOG(LW, (_T("[failed to get network config instance][0x%08x]"), hr));
-  }
-
-  NetworkConfig::AppendStaticProxyConfigs(proxy_configurations);
-  NetworkConfig::SortProxies(proxy_configurations);
-
-  // Some of the configurations might occur multiple times. To avoid retrying
-  // the same configuration over, try to remove duplicates while preserving
-  // the order of existing configurations.
-  NetworkConfig::RemoveDuplicates(proxy_configurations);
-  ASSERT1(!proxy_configurations->empty());
-}
-
-HRESULT PostRequest(NetworkRequest* network_request,
-                    bool fallback_to_https,
-                    const CString& url,
-                    const CString& request_string,
-                    std::vector<uint8>* response) {
-  ASSERT1(network_request);
-  ASSERT1(response);
-
-  const CStringA utf8_request_string(WideToUtf8(request_string));
-  HRESULT hr = network_request->PostUtf8String(url,
-                                               utf8_request_string,
-                                               response);
-  bool is_canceled(hr == GOOPDATE_E_CANCELLED);
-  if (FAILED(hr) && !is_canceled && fallback_to_https) {
-    // Replace http with https and resend the request.
-    if (String_StartsWith(url, kHttpProto, true)) {
-      CString https_url = url.Mid(_tcslen(kHttpProto));
-      https_url.Insert(0, kHttpsProto);
-
-      NET_LOG(L3, (_T("[network request fallback to %s]"), https_url));
-      response->clear();
-      if (SUCCEEDED(network_request->PostUtf8String(https_url,
-                                                    utf8_request_string,
-                                                    response))) {
-        hr = S_OK;
-      }
-    }
-  }
-  return hr;
-}
-
-// TODO(omaha): Eliminate this function if no longer a need for it.  It's only
-// used in NetDiags, and its value has been eliminated since we switched to all
-// network functions returning uint8 buffers.
-HRESULT GetRequest(NetworkRequest* network_request,
-                   const CString& url,
-                   std::vector<uint8>* response) {
-  ASSERT1(network_request);
-  ASSERT1(response);
-
-  return network_request->Get(url, response);
-}
-
-}   // namespace detail
-
-}   // namespace omaha
-
diff --git a/net/network_request_impl.h b/net/network_request_impl.h
deleted file mode 100644
index b12845f..0000000
--- a/net/network_request_impl.h
+++ /dev/null
@@ -1,216 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// The class structure is as following:
-//    - NetworkRequest and the underlying NetworkRequestImpl provide fault
-//      tolerant client server http transactions.
-//    - HttpRequestInterface defines an interface for different mechanisms that
-//      can move bytes between the client and the server. These mechanisms are
-//      chained up so that the control passes from one mechanism to the next
-//      until one of them is able to fulfill the request or an error is
-//      generated. Currently, SimpleRequest and BitsRequest are provided.
-//    - HttpClient is the c++ wrapper over winhttp-wininet.
-
-#ifndef OMAHA_NET_NETWORK_REQUEST_IMPL_H__
-#define OMAHA_NET_NETWORK_REQUEST_IMPL_H__
-
-#include <windows.h>
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/net/network_config.h"
-#include "omaha/net/network_request.h"
-#include "omaha/net/http_request.h"
-
-namespace omaha {
-
-namespace detail {
-
-class NetworkRequestImpl {
- public:
-  explicit NetworkRequestImpl(const NetworkConfig::Session& network_session);
-  ~NetworkRequestImpl();
-
-  HRESULT Close();
-
-  void AddHttpRequest(HttpRequestInterface* http_request);
-
-  HRESULT Post(const CString& url,
-               const void* buffer,
-               size_t length,
-               std::vector<uint8>* response);
-  HRESULT Get(const CString& url, std::vector<uint8>* response);
-  HRESULT DownloadFile(const CString& url, const CString& filename);
-
-  HRESULT Pause();
-  HRESULT Resume();
-  HRESULT Cancel();
-
-  void AddHeader(const TCHAR* name, const TCHAR* value);
-
-  HRESULT QueryHeadersString(uint32 info_level,
-                             const TCHAR* name,
-                             CString* value);
-
-  int http_status_code() const { return http_status_code_; }
-
-  CString response_headers() const { return response_headers_; }
-
-  void set_proxy_auth_config(const ProxyAuthConfig& proxy_auth_config) {
-    proxy_auth_config_ = proxy_auth_config;
-  }
-
-  void set_num_retries(int num_retries) { num_retries_ = num_retries; }
-
-  void set_time_between_retries(int time_between_retries_ms) {
-    time_between_retries_ms_ = time_between_retries_ms;
-  }
-
-  void set_callback(NetworkRequestCallback* callback) {
-    callback_ = callback;
-  }
-
-  void set_low_priority(bool low_priority) { low_priority_ = low_priority; }
-
-  void set_proxy_configuration(const ProxyConfig* proxy_configuration) {
-    if (proxy_configuration) {
-      proxy_configuration_.reset(new ProxyConfig);
-      *proxy_configuration_ = *proxy_configuration;
-    } else {
-      proxy_configuration_.reset();
-    }
-  }
-
-  void set_preserve_protocol(bool preserve_protocol) {
-    preserve_protocol_ = preserve_protocol;
-  }
-
-  CString trace() const { return trace_; }
-
-  // Detects the available proxy configurations and returns the chain of
-  // configurations to be used.
-  void DetectProxyConfiguration(
-      std::vector<ProxyConfig>* proxy_configurations) const;
-
- private:
-  // Resets the state of the output data members.
-  void Reset();
-
-  // Sends the request with a retry policy. This is the only function that
-  // modifies the state of the output data members: the status code, the
-  // response headers, and the response. When errors are encountered, the
-  // output data members contain the values corresponding to first network
-  // configuration and first HttpRequest instance in the fallback chain.
-  HRESULT DoSendWithRetries();
-
-  // Sends a single request and receives the response.
-  HRESULT DoSend(int* http_status_code,
-                 CString* response_headers,
-                 std::vector<uint8>* response) const;
-
-  // Sends the request using the current configuration. The request is tried for
-  // each HttpRequestInterface in the fallback chain until one of them succeeds
-  // or the end of the chain is reached.
-  HRESULT DoSendWithConfig(int* http_status_code,
-                           CString* response_headers,
-                           std::vector<uint8>* response) const;
-
-  // Sends an http request using the current HttpRequest interface over the
-  // current network configuration.
-  HRESULT DoSendHttpRequest(int* http_status_code,
-                            CString* response_headers,
-                            std::vector<uint8>* response) const;
-
-  // Builds headers for the current HttpRequest and network configuration.
-  CString BuildPerRequestHeaders() const;
-
-  // Specifies the chain of HttpRequestInterface to handle the request.
-  std::vector<HttpRequestInterface*> http_request_chain_;
-
-  // Specifies the detected proxy configurations.
-  std::vector<ProxyConfig> proxy_configurations_;
-
-  // Specifies the proxy configuration override. When set, the proxy
-  // configurations are not auto detected.
-  scoped_ptr<ProxyConfig> proxy_configuration_;
-
-  // Input data members.
-  // The request and response buffers are owner by the caller.
-  CString  url_;
-  const void* request_buffer_;     // Contains the request body for POST.
-  size_t   request_buffer_length_;  // Length of the request body.
-  CString  filename_;              // Contains the response for downloads.
-  CString  additional_headers_;    // Headers common to all requests.
-                                   // Each header is separated by \r\n.
-  ProxyAuthConfig proxy_auth_config_;
-  int      num_retries_;
-  bool     low_priority_;
-  int time_between_retries_ms_;
-
-  // Output data members.
-  int      http_status_code_;
-  CString  response_headers_;      // Each header is separated by \r\n.
-  std::vector<uint8>* response_;   // Contains the response for Post and Get.
-
-  const NetworkConfig::Session  network_session_;
-  NetworkRequestCallback*       callback_;
-
-  // The http request and the network configuration currently in use.
-  mutable HttpRequestInterface* cur_http_request_;
-  mutable const ProxyConfig*    cur_proxy_config_;
-
-  // The HRESULT and HTTP status code updated by the prior
-  // DoSendHttpRequest() call.
-  mutable HRESULT  last_hr_;
-  mutable int      last_http_status_code_;
-
-  // The current retry count defined by the outermost DoSendWithRetries() call.
-  int cur_retry_count_;
-
-  volatile LONG is_canceled_;
-  scoped_event event_cancel_;
-
-  LLock lock_;
-
-  bool preserve_protocol_;
-
-  // Contains the trace of the request as handled by the fallback chain.
-  mutable CString trace_;
-
-  static const int kDefaultTimeBetweenRetriesMs   = 5000;     // 5 seconds.
-  static const int kTimeBetweenRetriesMultiplier  = 2;
-
-  DISALLOW_EVIL_CONSTRUCTORS(NetworkRequestImpl);
-};
-
-HRESULT PostRequest(NetworkRequest* network_request,
-                    bool fallback_to_https,
-                    const CString& url,
-                    const CString& request_string,
-                    std::vector<uint8>* response);
-
-HRESULT GetRequest(NetworkRequest* network_request,
-                   const CString& url,
-                   std::vector<uint8>* response);
-
-}   // namespace detail
-
-}   // namespace omaha
-
-#endif  // OMAHA_NET_NETWORK_REQUEST_IMPL_H__
-
diff --git a/net/network_request_unittest.cc b/net/network_request_unittest.cc
deleted file mode 100644
index e27bbb3..0000000
--- a/net/network_request_unittest.cc
+++ /dev/null
@@ -1,445 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-#include <winhttp.h>
-#include <vector>
-#include "base/scoped_ptr.h"
-#include "base/basictypes.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/browser_utils.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/queue_timer.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/time.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vista_utils.h"
-#include "omaha/net/bits_request.h"
-#include "omaha/net/cup_request.h"
-#include "omaha/net/network_config.h"
-#include "omaha/net/network_request.h"
-#include "omaha/net/simple_request.h"
-#include "omaha/net/urlmon_request.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-class NetworkRequestTest
-    : public testing::Test,
-      public NetworkRequestCallback {
- protected:
-  NetworkRequestTest() {}
-
-  static void SetUpTestCase() {
-    // Initialize the detection chain: GoogleProxy, FireFox if it is the
-    // default browser, and IE.
-    NetworkConfig* network_config = NULL;
-    EXPECT_HRESULT_SUCCEEDED(
-      NetworkConfigManager::Instance().GetUserNetworkConfig(&network_config));
-
-    network_config->Clear();
-    network_config->Add(new UpdateDevProxyDetector);
-    BrowserType browser_type(BROWSER_UNKNOWN);
-    GetDefaultBrowserType(&browser_type);
-    if (browser_type == BROWSER_FIREFOX) {
-      network_config->Add(new FirefoxProxyDetector);
-    }
-    network_config->Add(new IEProxyDetector);
-    network_config->Add(new DefaultProxyDetector);
-
-    vista::GetLoggedOnUserToken(&token_);
-  }
-
-  static void TearDownTestCase() {
-    if (token_) {
-      ::CloseHandle(token_);
-    }
-
-    NetworkConfig* network_config = NULL;
-    EXPECT_HRESULT_SUCCEEDED(
-      NetworkConfigManager::Instance().GetUserNetworkConfig(&network_config));
-
-    network_config->Clear();
-  }
-
-  virtual void SetUp() {
-    NetworkConfig* network_config = NULL;
-    EXPECT_HRESULT_SUCCEEDED(
-      NetworkConfigManager::Instance().GetUserNetworkConfig(&network_config));
-
-    network_request_.reset(new NetworkRequest(network_config->session()));
-  }
-
-  virtual void TearDown() {}
-
-  virtual void OnProgress(int bytes, int bytes_total, int, const TCHAR*) {
-    UNREFERENCED_PARAMETER(bytes);
-    UNREFERENCED_PARAMETER(bytes_total);
-    NET_LOG(L3, (_T("[downloading %d of %d]"), bytes, bytes_total));
-  }
-
-  virtual void OnRequestBegin() {
-    NET_LOG(L3, (_T("[download starts]")));
-  }
-
-  virtual void OnRequestRetryScheduled(time64 next_retry_time) {
-    UNREFERENCED_PARAMETER(next_retry_time);
-
-    time64 now = GetCurrent100NSTime();
-    ASSERT1(next_retry_time > now);
-
-    NET_LOG(L3, (_T("\n[Download will retry in %d seconds]\n"),
-                 CeilingDivide(next_retry_time - now, kSecsTo100ns)));
-  }
-
-  static void CancelCallback(QueueTimer* queue_timer) {
-    ASSERT_TRUE(queue_timer);
-    ASSERT_TRUE(queue_timer->ctx());
-    void* ctx = queue_timer->ctx();
-    NetworkRequestTest* test = static_cast<NetworkRequestTest*>(ctx);
-
-    const TCHAR* msg = _T("CancelCallback");
-    ASSERT_HRESULT_SUCCEEDED(test->network_request_->Cancel());
-  }
-
-  // http get.
-  void HttpGetHelper() {
-    std::vector<uint8> response;
-    CString url = _T("http://www.google.com/robots.txt");
-    network_request_->set_num_retries(2);
-    EXPECT_HRESULT_SUCCEEDED(network_request_->Get(url, &response));
-
-    int http_status = network_request_->http_status_code();
-    EXPECT_TRUE(http_status == HTTP_STATUS_OK ||
-                http_status == HTTP_STATUS_PARTIAL_CONTENT);
-  }
-
-  // https get.
-  void HttpsGetHelper() {
-    std::vector<uint8> response;
-    CString url = _T("https://www.google.com/robots.txt");
-    network_request_->set_num_retries(2);
-    EXPECT_HRESULT_SUCCEEDED(network_request_->Get(url, &response));
-
-    int http_status = network_request_->http_status_code();
-    EXPECT_TRUE(http_status == HTTP_STATUS_OK ||
-                http_status == HTTP_STATUS_PARTIAL_CONTENT);
-  }
-
-  // http post.
-  void HttpPostHelper() {
-    std::vector<uint8> response;
-
-    CString url = _T("http://tools.google.com/service/update2");
-    // Post a buffer.
-    const uint8 request[] = "<o:gupdate xmlns:o=\"http://www.google.com/update2/request\" testsource=\"dev\"/>";  // NOLINT
-    network_request_->set_num_retries(2);
-    EXPECT_HRESULT_SUCCEEDED(network_request_->Post(url,
-                                                    request,
-                                                    arraysize(request) - 1,
-                                                    &response));
-
-    int http_status = network_request_->http_status_code();
-    EXPECT_TRUE(http_status == HTTP_STATUS_OK ||
-                http_status == HTTP_STATUS_PARTIAL_CONTENT);
-
-    // Post an UTF8 string.
-    CStringA utf8_request(reinterpret_cast<const char*>(request));
-    EXPECT_HRESULT_SUCCEEDED(network_request_->PostUtf8String(url,
-                                                              utf8_request,
-                                                              &response));
-    http_status = network_request_->http_status_code();
-    EXPECT_TRUE(http_status == HTTP_STATUS_OK ||
-                http_status == HTTP_STATUS_PARTIAL_CONTENT);
-
-    // Post a Unicode string.
-    CString unicode_request(reinterpret_cast<const char*>(request));
-    EXPECT_HRESULT_SUCCEEDED(network_request_->PostString(url,
-                                                          unicode_request,
-                                                          &response));
-    http_status = network_request_->http_status_code();
-    EXPECT_TRUE(http_status == HTTP_STATUS_OK ||
-                http_status == HTTP_STATUS_PARTIAL_CONTENT);
-  }
-
-  // Download http file.
-  void DownloadHelper() {
-    CString url = _T("http://dl.google.com/update2/UpdateData.bin");
-
-    CString temp_dir = app_util::GetTempDir();
-    CString temp_file;
-    EXPECT_TRUE(::GetTempFileName(temp_dir, _T("tmp"), 0,
-                                  CStrBuf(temp_file, MAX_PATH)));
-    network_request_->set_num_retries(2);
-    network_request_->set_low_priority(true);
-    network_request_->set_callback(this);
-    EXPECT_HRESULT_SUCCEEDED(network_request_->DownloadFile(url, temp_file));
-    EXPECT_TRUE(::DeleteFile(temp_file));
-
-    int http_status = network_request_->http_status_code();
-    EXPECT_TRUE(http_status == HTTP_STATUS_OK ||
-                http_status == HTTP_STATUS_PARTIAL_CONTENT);
-  }
-
-  void MultipleRequestsHelper() {
-    std::vector<uint8> response;
-
-    CString url = _T("http://tools.google.com/service/update2");
-    const uint8 request[] = "<o:gupdate xmlns:o=\"http://www.google.com/update2/request\" testsource=\"dev\"/>";  // NOLINT
-    for (size_t i = 0; i != 3; ++i) {
-      EXPECT_HRESULT_SUCCEEDED(network_request_->Post(url,
-                                                      request,
-                                                      arraysize(request) - 1,
-                                                      &response));
-
-      int http_status = network_request_->http_status_code();
-      EXPECT_TRUE(http_status == HTTP_STATUS_OK ||
-                  http_status == HTTP_STATUS_PARTIAL_CONTENT);
-    }
-  }
-
-  void PostRequestHelper() {
-    std::vector<uint8> response;
-    CString url = _T("http://tools.google.com/service/update2");
-    CString request = _T("<o:gupdate xmlns:o=\"http://www.google.com/update2/request\" testsource=\"dev\"/>");  // NOLINT
-    EXPECT_HRESULT_SUCCEEDED(PostRequest(network_request_.get(),
-                                         true,
-                                         url,
-                                         request,
-                                         &response));
-  }
-
-  void PostRequestNegativeTestHelper() {
-    std::vector<uint8> response;
-    CString url = _T("http://no_such_host.google.com/service/update2");
-    CString request = _T("<o:gupdate xmlns:o=\"http://www.google.com/update2/request\" testsource=\"dev\"/>");  // NOLINT
-    EXPECT_HRESULT_FAILED(PostRequest(network_request_.get(),
-                                      true,
-                                      url,
-                                      request,
-                                      &response));
-  }
-
-  void RetriesNegativeTestHelper() {
-    // Try a direct connection to a non-existent host and keep retrying until
-    // the retries are used up. Urlmon request is using IE's settings.
-    // Therefore, it is possible a proxy is used. In this case, the http
-    // response is '503 Service Unavailable'.
-    ProxyConfig config;
-    network_request_->set_proxy_configuration(&config);
-    network_request_->set_num_retries(2);
-    network_request_->set_time_between_retries(10);   // 10 miliseconds.
-    std::vector<uint8> response;
-
-    CString url = _T("http://nohost/nofile");
-
-    // One request plus 2 retries after 10 and 20 miliseconds respectively.
-    HRESULT hr = network_request_->Get(url, &response);
-    EXPECT_TRUE(hr == HRESULT_FROM_WIN32(ERROR_WINHTTP_NAME_NOT_RESOLVED) ||
-                hr == INET_E_RESOURCE_NOT_FOUND ||
-                hr == HRESULTFromHttpStatusCode(503));
-  }
-
-  void CancelTest_GetHelper() {
-    HANDLE timer_queue = ::CreateTimerQueue();
-    ASSERT_TRUE(timer_queue);
-    ON_SCOPE_EXIT(::DeleteTimerQueueEx, timer_queue, INVALID_HANDLE_VALUE);
-
-    QueueTimer queue_timer(timer_queue,
-                           &NetworkRequestTest::CancelCallback,
-                           this);
-    ASSERT_HRESULT_SUCCEEDED(queue_timer.Start(200, 0, WT_EXECUTEONLYONCE));
-
-    // Try a direct connection to a non-existent host and keep retrying until
-    // canceled by the timer.
-    ProxyConfig config;
-    network_request_->set_proxy_configuration(&config);
-    network_request_->set_num_retries(10);
-    network_request_->set_time_between_retries(10);  // 10 miliseconds.
-    std::vector<uint8> response;
-
-    CString url = _T("http://nohost/nofile");
-
-    EXPECT_EQ(GOOPDATE_E_CANCELLED,
-              network_request_->Get(url, &response));
-
-    EXPECT_EQ(GOOPDATE_E_CANCELLED,
-              network_request_->Get(url, &response));
-  }
-
-  scoped_ptr<NetworkRequest> network_request_;
-  static HANDLE token_;
-};
-
-HANDLE NetworkRequestTest::token_ = NULL;
-
-// http get.
-TEST_F(NetworkRequestTest, HttpGet) {
-  network_request_->AddHttpRequest(new SimpleRequest);
-  HttpGetHelper();
-}
-
-// http get.
-TEST_F(NetworkRequestTest, HttpGetUrlmon) {
-  network_request_->AddHttpRequest(new UrlmonRequest);
-  HttpGetHelper();
-}
-
-// https get.
-TEST_F(NetworkRequestTest, HttpsGet) {
-  network_request_->AddHttpRequest(new SimpleRequest);
-  HttpsGetHelper();
-}
-
-// https get.
-TEST_F(NetworkRequestTest, HttpsGetUrlmon) {
-  network_request_->AddHttpRequest(new UrlmonRequest);
-  HttpsGetHelper();
-}
-
-// http post.
-TEST_F(NetworkRequestTest, HttpPost) {
-  network_request_->AddHttpRequest(new CupRequest(new SimpleRequest));
-  network_request_->AddHttpRequest(new SimpleRequest);
-  HttpPostHelper();
-}
-
-// http post.
-TEST_F(NetworkRequestTest, HttpPostUrlmon) {
-  network_request_->AddHttpRequest(new CupRequest(new UrlmonRequest));
-  network_request_->AddHttpRequest(new UrlmonRequest);
-  HttpPostHelper();
-}
-
-// Download http file.
-TEST_F(NetworkRequestTest, Download) {
-  BitsRequest* bits_request(new BitsRequest);
-  // Bits specific settings.
-  //
-  // Hardcode for now the min value, just to see how it works.
-  // TODO(omaha): expose properties to NetworkRequest.
-  bits_request->set_minimum_retry_delay(60);
-  bits_request->set_no_progress_timeout(5);
-
-  network_request_->AddHttpRequest(bits_request);
-  network_request_->AddHttpRequest(new SimpleRequest);
-  DownloadHelper();
-}
-
-// Download http file.
-TEST_F(NetworkRequestTest, DownloadUrlmon) {
-  BitsRequest* bits_request(new BitsRequest);
-  // Bits specific settings.
-  bits_request->set_minimum_retry_delay(60);
-  bits_request->set_no_progress_timeout(5);
-
-  network_request_->AddHttpRequest(bits_request);
-  network_request_->AddHttpRequest(new UrlmonRequest);
-  DownloadHelper();
-}
-
-TEST_F(NetworkRequestTest, MultipleRequests) {
-  network_request_->AddHttpRequest(new CupRequest(new SimpleRequest));
-  MultipleRequestsHelper();
-}
-
-TEST_F(NetworkRequestTest, MultipleRequestsUrlmon) {
-  network_request_->AddHttpRequest(new CupRequest(new UrlmonRequest));
-  MultipleRequestsHelper();
-}
-
-TEST_F(NetworkRequestTest, PostRequest) {
-  network_request_->AddHttpRequest(new SimpleRequest);
-  PostRequestHelper();
-}
-
-TEST_F(NetworkRequestTest, PostRequestUrlmon) {
-  network_request_->AddHttpRequest(new UrlmonRequest);
-  PostRequestHelper();
-}
-
-TEST_F(NetworkRequestTest, PostRequestNegativeTest) {
-  network_request_->AddHttpRequest(new SimpleRequest);
-  PostRequestNegativeTestHelper();
-}
-
-TEST_F(NetworkRequestTest, PostRequestNegativeTestUrlmon) {
-  network_request_->AddHttpRequest(new UrlmonRequest);
-  PostRequestNegativeTestHelper();
-}
-
-TEST_F(NetworkRequestTest, RetriesNegativeTest) {
-  network_request_->AddHttpRequest(new SimpleRequest);
-  RetriesNegativeTestHelper();
-}
-
-TEST_F(NetworkRequestTest, RetriesNegativeTestUrlmon) {
-  network_request_->AddHttpRequest(new UrlmonRequest);
-  RetriesNegativeTestHelper();
-}
-
-// Network request can't be reused once canceled.
-TEST_F(NetworkRequestTest, CancelTest_CannotReuse) {
-  network_request_->Cancel();
-  std::vector<uint8> response;
-
-  CString url = _T("https://www.google.com/robots.txt");
-  EXPECT_EQ(GOOPDATE_E_CANCELLED,
-            network_request_->Get(url, &response));
-}
-
-TEST_F(NetworkRequestTest, CancelTest_DownloadFile) {
-  HANDLE timer_queue = ::CreateTimerQueue();
-  ASSERT_TRUE(timer_queue);
-  ON_SCOPE_EXIT(::DeleteTimerQueueEx, timer_queue, INVALID_HANDLE_VALUE);
-
-  QueueTimer queue_timer(timer_queue,
-                         &NetworkRequestTest::CancelCallback,
-                         this);
-  ASSERT_HRESULT_SUCCEEDED(queue_timer.Start(200, 0, WT_EXECUTEONLYONCE));
-
-  // Try a direct connection to a non-existent host and keep retrying until
-  // canceled by the timer.
-  ProxyConfig config;
-  network_request_->set_proxy_configuration(&config);
-
-  BitsRequest* bits_request(new BitsRequest);
-  bits_request->set_minimum_retry_delay(60);
-  bits_request->set_no_progress_timeout(5);
-  network_request_->AddHttpRequest(bits_request);
-  network_request_->set_num_retries(10);
-  network_request_->set_time_between_retries(10);  // 10 miliseconds.
-  std::vector<uint8> response;
-
-  CString url = _T("http://nohost/nofile");
-
-  EXPECT_EQ(GOOPDATE_E_CANCELLED,
-            network_request_->DownloadFile(url, _T("c:\\foo")));
-
-  EXPECT_EQ(GOOPDATE_E_CANCELLED,
-            network_request_->DownloadFile(url, _T("c:\\foo")));
-}
-
-TEST_F(NetworkRequestTest, CancelTest_Get) {
-  network_request_->AddHttpRequest(new SimpleRequest);
-  CancelTest_GetHelper();
-}
-
-}  // namespace omaha
-
diff --git a/net/proxy_auth.cc b/net/proxy_auth.cc
deleted file mode 100644
index 96f40a5..0000000
--- a/net/proxy_auth.cc
+++ /dev/null
@@ -1,419 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-#include "omaha/net/proxy_auth.h"
-#include <atlcom.h>
-#include <pstore.h>
-#include <wincred.h>
-#include <wincrypt.h>
-#include "omaha/base/commontypes.h"
-#include "omaha/base/encrypt.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/smart_handle.h"
-#include "omaha/base/string.h"
-#include "omaha/base/system_info.h"
-#include "omaha/goopdate/cred_dialog.h"
-#include "omaha/third_party/smartany/scoped_any.h"
-
-using omaha::encrypt::EncryptData;
-using omaha::encrypt::DecryptData;
-
-namespace omaha {
-
-static const GUID kPreIE7CredTypeGuid = { 0x5e7e8100, 0x9138, 0x11d1,
-  { 0x94, 0x5a, 0x00, 0xc0, 0x4f, 0xc3, 0x08, 0xff } };
-static const GUID kPreIE7CredSubtypeGuid = { 0 };
-
-#define kIE7CredKey "abe2869f-9b47-4cd9-a358-c22904dba7f7"
-
-bool ProxyAuth::IsPromptAllowed() {
-  __mutexScope(lock_);
-  return prompt_cancelled_ < cancel_prompt_threshold_;
-}
-
-void ProxyAuth::PromptCancelled() {
-  __mutexScope(lock_);
-  prompt_cancelled_++;
-}
-
-CString ProxyAuth::ExtractProxy(const CString& proxy_settings,
-                                bool isHttps) {
-  if (proxy_settings.IsEmpty()) {
-    NET_LOG(L3, (_T("[ProxyAuth::ExtractProxy][Empty settings")));
-    return proxy_settings;
-  }
-
-  int equals_index = String_FindChar(proxy_settings, L'=');
-  if (equals_index >= 0) {
-    const wchar_t* prefix = L"http=";
-    if (isHttps)
-      prefix = L"https=";
-
-    int prefix_index = String_FindString(proxy_settings, prefix);
-    if (prefix_index == -1) {
-      // fallback to whatever we've got after an equals sign
-      prefix = L"=";
-      prefix_index = equals_index;
-    }
-
-    int first = prefix_index + lstrlen(prefix);
-    int length = String_FindChar(proxy_settings, L' ');
-    if (length == -1) {
-      return proxy_settings.Mid(first);
-    } else {
-      return proxy_settings.Mid(first, length);
-    }
-  }
-
-  return proxy_settings;
-}
-
-void ProxyAuth::ConfigureProxyAuth(bool is_machine,
-                                   uint32 cancel_prompt_threshold) {
-  ASSERT1(cancel_prompt_threshold);
-
-  proxy_prompt_is_machine_ = is_machine;
-  cancel_prompt_threshold_ = cancel_prompt_threshold;
-}
-
-bool ProxyAuth::PromptUser(const CString& server,
-                           const ProxyAuthConfig& proxy_auth_config) {
-  NET_LOG(L3, (_T("[ProxyAuth::PromptUser][%s][%s]"),
-               server, proxy_auth_config.ToString()));
-
-  CString user;
-  CString pass;
-
-  HRESULT hr = LaunchCredentialDialog(
-      proxy_prompt_is_machine_,
-      proxy_auth_config.parent_hwnd,
-      server,
-      proxy_auth_config.prompt_caption,
-      &user,
-      &pass);
-
-  if (SUCCEEDED(hr)) {
-    AddCred(server, user, pass);
-  } else if (hr == HRESULT_FROM_WIN32(ERROR_CANCELLED)) {
-    PromptCancelled();
-  }
-
-  SecureZeroMemory(user.GetBuffer(), user.GetAllocLength() * sizeof(TCHAR));
-  SecureZeroMemory(pass.GetBuffer(), pass.GetAllocLength() * sizeof(TCHAR));
-
-  return SUCCEEDED(hr);
-}
-
-bool ProxyAuth::GetProxyCredentials(bool allow_ui, bool force_ui,
-                                    const CString& proxy_server,
-                                    const ProxyAuthConfig& proxy_auth_config,
-                                    CString* username, CString* password,
-                                    uint32* auth_scheme) {
-  NET_LOG(L3, (_T("[ProxyAuth::GetProxyCredentials][%d][%s]"),
-               allow_ui, proxy_auth_config.ToString()));
-
-  CString server(proxy_server);
-  if (server.IsEmpty()) {
-    server = kDefaultProxyServer;
-  }
-
-  __mutexScope(lock_);
-  int i = -1;
-  if (!force_ui)
-    i = servers_.Find(server);
-
-  if (i == -1) {
-    if (ReadFromIE7(server) || ReadFromPreIE7(server) ||
-        (allow_ui && proxy_auth_config.parent_hwnd && IsPromptAllowed() &&
-         PromptUser(server, proxy_auth_config))) {
-      i = servers_.GetSize() - 1;
-    }
-  }
-
-  if (i >= 0) {
-    ASSERT1(!usernames_[i].IsEmpty() && !passwords_[i].empty());
-    std::vector<uint8> decrypted_password;
-    HRESULT hr = DecryptData(NULL,
-                             0,
-                             &passwords_[i].front(),
-                             passwords_[i].size(),
-                             &decrypted_password);
-    if (FAILED(hr)) {
-      NET_LOG(LE, (_T("[DecryptData failed][0x%x]"), hr));
-      return false;
-    }
-
-    *username = usernames_[i];
-    *password = reinterpret_cast<TCHAR*>(&decrypted_password.front());
-    *auth_scheme = auth_schemes_[i];
-  }
-
-  NET_LOG(L3, (_T("[ProxyAuth::GetProxyCredentials][%d][%s][%s][%d]"),
-               i, proxy_server, *username, *auth_scheme));
-  return i >= 0;
-}
-
-static bool ParseCredsFromRawBuffer(const BYTE* buffer, const DWORD bytes,
-                                    CString* username, CString* password) {
-  ASSERT1(bytes > 0);
-  if (bytes <= 0)
-    return false;
-
-  const char* ascii_buffer = reinterpret_cast<const char*>(buffer);
-  const unsigned ascii_length =
-    static_cast<const unsigned>(strlen(ascii_buffer));
-
-  // The buffer could be ascii or wide characters, so we detect which one it
-  // is and copy the ascii characters to a wide string if necessary
-  const wchar_t* user_pass = NULL;
-  CString temp;
-  if (ascii_length == bytes - 1) {
-    temp = AnsiToWideString(ascii_buffer, ascii_length);
-    user_pass = temp.GetString();
-  } else {
-    user_pass = reinterpret_cast<const wchar_t*>(buffer);
-  }
-
-  int colon_pos = String_FindChar(user_pass, L':');
-  if (colon_pos >= 0) {
-    username->SetString(user_pass, colon_pos);
-    password->SetString(user_pass + colon_pos + 1);
-  }
-
-  return colon_pos >= 0;
-}
-
-void ProxyAuth::AddCred(const CString& server, const CString& username,
-                        const CString& password) {
-  std::vector<uint8> encrypted_password;
-  HRESULT hr = EncryptData(NULL,
-                           0,
-                           password,
-                           (password.GetLength() + 1) * sizeof(TCHAR),
-                           &encrypted_password);
-  if (FAILED(hr)) {
-    NET_LOG(LE, (_T("[EncryptData failed][0x%x]"), hr));
-    return;
-  }
-
-  __mutexScope(lock_);
-  int i = servers_.Find(server);
-  if (i == -1) {
-    servers_.Add(server);
-    usernames_.Add(username);
-    passwords_.Add(encrypted_password);
-    auth_schemes_.Add(UNKNOWN_AUTH_SCHEME);
-  } else {
-    usernames_[i] = username;
-    passwords_[i] = encrypted_password;
-    auth_schemes_[i] = UNKNOWN_AUTH_SCHEME;
-  }
-
-  NET_LOG(L3, (_T("[ProxyAuth::AddCred][%s][%s]"), server, username));
-}
-
-HRESULT ProxyAuth::SetProxyAuthScheme(const CString& proxy_server,
-                                      uint32 scheme) {
-  CString server(proxy_server);
-  if (server.IsEmpty()) {
-    server = kDefaultProxyServer;
-  }
-
-  __mutexScope(lock_);
-  int i = servers_.Find(server);
-  if (i == -1) {
-    NET_LOG(LE, (_T("[ProxyAuth::SetProxyAuthScheme][%s not found]"), server));
-    return E_INVALIDARG;
-  }
-
-  auth_schemes_[i] = scheme;
-  NET_LOG(L3, (_T("[ProxyAuth::SetProxyAuthScheme][%s][%s][%d]"),
-               server, usernames_[i], scheme));
-  return S_OK;
-}
-
-// This approach (the key in particular) comes from a securityfocus posting:
-// http://www.securityfocus.com/archive/1/458115/30/0/threaded
-bool ProxyAuth::ReadFromIE7(const CString& server) {
-  scoped_library crypt_lib(::LoadLibrary(L"crypt32.dll"));
-  ASSERT1(crypt_lib);
-  if (!crypt_lib)
-    return false;
-
-  typedef BOOL (__stdcall *CryptUnprotectData_type)(DATA_BLOB*, LPWSTR*,
-    DATA_BLOB*, PVOID, CRYPTPROTECT_PROMPTSTRUCT*, DWORD, DATA_BLOB*);
-  CryptUnprotectData_type CryptUnprotectData_fn =
-      reinterpret_cast<CryptUnprotectData_type>(
-          GetProcAddress(get(crypt_lib), "CryptUnprotectData"));
-  ASSERT1(CryptUnprotectData_fn);
-  if (!CryptUnprotectData_fn)
-    return false;
-
-  // Load CredEnumerate and CredFree dynamically because they don't exist on
-  // Win2K and so loading the GoogleDesktopCommon.dll otherwise.
-  scoped_library advapi_lib(::LoadLibrary(L"advapi32.dll"));
-  ASSERT1(advapi_lib);
-  if (!advapi_lib)
-    return false;
-
-  typedef BOOL (__stdcall *CredEnumerateW_type)(LPCWSTR, DWORD, DWORD*,
-                                                PCREDENTIAL**);
-  CredEnumerateW_type CredEnumerateW_fn =
-      reinterpret_cast<CredEnumerateW_type>(
-          GetProcAddress(get(advapi_lib), "CredEnumerateW"));
-  ASSERT1(CredEnumerateW_fn || SystemInfo::IsRunningOnW2K());
-  if (!CredEnumerateW_fn)
-    return false;
-
-  typedef VOID (__stdcall *CredFree_type)(PVOID);
-  CredFree_type CredFree_fn = reinterpret_cast<CredFree_type>(
-      GetProcAddress(get(advapi_lib), "CredFree"));
-  ASSERT1(CredFree_fn || SystemInfo::IsRunningOnW2K());
-  if (!CredFree_fn)
-    return false;
-
-  // Done with dynamically loading methods.  CredEnumerate (and CredFree if
-  // we didn't return) will have failed to load on Win2K
-
-  DATA_BLOB optional_entropy;
-
-  char key[ARRAYSIZE(kIE7CredKey)] = kIE7CredKey;
-  int16 temp[ARRAYSIZE(key)];
-  for (int i = 0; i < ARRAYSIZE(key); ++i)
-    temp[i] = static_cast<int16>(key[i] * 4);
-
-  optional_entropy.pbData = reinterpret_cast<BYTE*>(&temp);
-  optional_entropy.cbData = sizeof(temp);
-
-  CString target(NOTRANSL(L"Microsoft_WinInet_"));
-  target += server;
-  target += L"*";
-
-  DWORD count = 0;
-  CREDENTIAL** credentials = NULL;
-  CString username;
-  CString password;
-
-  bool found = false;
-  if (CredEnumerateW_fn(target, 0, &count, &credentials)) {
-    for (unsigned i = 0; i < count; ++i) {
-      if (credentials[i]->Type == CRED_TYPE_GENERIC) {
-        DATA_BLOB data_in;
-        DATA_BLOB data_out = { 0 };
-        data_in.pbData = static_cast<BYTE*>(credentials[i]->CredentialBlob);
-        data_in.cbData = credentials[i]->CredentialBlobSize;
-
-        if (CryptUnprotectData_fn(&data_in, NULL, &optional_entropy, NULL, NULL,
-                                  0, &data_out)) {
-          found = ParseCredsFromRawBuffer(data_out.pbData, data_out.cbData,
-                                          &username, &password);
-          LocalFree(data_out.pbData);
-          if (found) {
-            AddCred(server, username, password);
-            break;
-          }
-        }
-      }
-    }
-    CredFree_fn(credentials);
-  }
-
-  return found;
-}
-
-bool ProxyAuth::ReadFromPreIE7(const CString& server) {
-  scoped_library pstore_lib(::LoadLibrary(L"pstorec.dll"));
-  ASSERT1(pstore_lib);
-  if (!pstore_lib)
-    return false;
-
-  typedef HRESULT (__stdcall *PStoreCreateInstance_type)(IPStore**,
-    PST_PROVIDERID*, void*, DWORD);
-  PStoreCreateInstance_type PStoreCreateInstance_fn =
-      reinterpret_cast<PStoreCreateInstance_type>(
-          GetProcAddress(get(pstore_lib), "PStoreCreateInstance"));
-  ASSERT1(PStoreCreateInstance_fn);
-  if (!PStoreCreateInstance_fn)
-    return false;
-
-  CString username;
-  CString password;
-  bool found = false;
-
-  scoped_co_init initializer(COINIT_APARTMENTTHREADED);
-  HRESULT hr = E_FAIL;
-
-  // The best reference I found about these iterators, especially how to free
-  // the item_name returned by this iterator was a microsoft patent application:
-  // http://www.patentstorm.us/patents/6272631-description.html
-  CComPtr<IPStore> pstore;
-  VERIFY1(SUCCEEDED(hr = PStoreCreateInstance_fn(&pstore, NULL, NULL, 0)));
-  if (SUCCEEDED(hr)) {
-    CComPtr<IEnumPStoreTypes> enum_types;
-    VERIFY1(SUCCEEDED(hr = pstore->EnumTypes(PST_KEY_CURRENT_USER, 0,
-                                             &enum_types)));
-    if (SUCCEEDED(hr)) {
-      GUID type_guid = { 0 };
-      // Get the types one at a time
-      while (enum_types->Next(1, &type_guid, NULL) == S_OK) {
-        if (type_guid != kPreIE7CredTypeGuid)
-          continue;
-
-        CComPtr<IEnumPStoreTypes> enum_subtypes;
-        VERIFY1(SUCCEEDED(hr = pstore->EnumSubtypes(PST_KEY_CURRENT_USER,
-          &type_guid, 0, &enum_subtypes)));
-        if (SUCCEEDED(hr)) {
-          GUID subtype_guid = { 0 };
-          // Get the subtypes one at a time
-          while (enum_subtypes->Next(1, &subtype_guid, NULL) == S_OK) {
-            if (subtype_guid != kPreIE7CredSubtypeGuid)
-              continue;
-
-            CComPtr<IEnumPStoreItems> enum_items;
-            VERIFY1(SUCCEEDED(hr = pstore->EnumItems(PST_KEY_CURRENT_USER,
-              &type_guid, &subtype_guid, 0, &enum_items)));
-            if (SUCCEEDED(hr)) {
-              wchar_t* item_name = NULL;
-              // Get the items one at a time
-              while (enum_items->Next(1, &item_name, NULL) == S_OK) {
-                DWORD data_length = 0;
-                byte* data = NULL;
-
-                VERIFY1(SUCCEEDED(hr = pstore->ReadItem(PST_KEY_CURRENT_USER,
-                  &type_guid, &subtype_guid, item_name, &data_length, &data,
-                  NULL, 0)));
-                if (SUCCEEDED(hr)) {
-                  found = ParseCredsFromRawBuffer(data, data_length,
-                                                  &username, &password);
-                  CoTaskMemFree(data);
-                }
-
-                CoTaskMemFree(item_name);
-                if (found) {
-                  AddCred(server, username, password);
-                  break;
-                }
-              }  // end enum_items loop
-            }
-          }  // end enum_subtypes loop
-        }
-      }  // end enum_types loop
-    }
-  }
-
-  return found;
-}
-
-}  // namespace omaha
-
diff --git a/net/proxy_auth.h b/net/proxy_auth.h
deleted file mode 100644
index 4f077d7..0000000
--- a/net/proxy_auth.h
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#ifndef OMAHA_NET_PROXY_AUTH_H__
-#define OMAHA_NET_PROXY_AUTH_H__
-
-#include <windows.h>
-#include <tchar.h>
-#include <atlsimpcoll.h>
-#include <atlstr.h>
-#include <vector>
-#include "omaha/base/synchronized.h"
-#include "omaha/common/goopdate_utils.h"
-
-#define UNKNOWN_AUTH_SCHEME  0x0000FFFF
-const TCHAR* const kDefaultProxyServer = _T("<Default Proxy>");
-const uint32 kDefaultCancelPromptThreshold = 1;
-
-namespace omaha {
-
-struct ProxyAuthConfig {
-  ProxyAuthConfig(HWND hwnd, const CString& caption)
-      : parent_hwnd(hwnd), prompt_caption(caption) {}
-
-  CString ToString() const {
-    CString result;
-    result.Format(_T("[ProxyAuthConfig][0x%x][%s]"),
-                  parent_hwnd, prompt_caption);
-    return result;
-  }
-
-  HWND parent_hwnd;
-  CString prompt_caption;
-};
-
-// A class that reads and stores the Internet Explorer saved proxy
-// authentication info.  Works with versions of IE up to and including 7.
-class ProxyAuth {
- public:
-  ProxyAuth() : prompt_cancelled_(0),
-                proxy_prompt_is_machine_(
-                    goopdate_utils::IsRunningFromOfficialGoopdateDir(true)),
-                cancel_prompt_threshold_(kDefaultCancelPromptThreshold) {}
-  ~ProxyAuth() {}
-
-  void ConfigureProxyAuth(bool is_machine, uint32 cancel_prompt_threshold);
-
-  // Retrieves the saved proxy credentials for Internet Explorer currently.
-  // In the future, there may be other sources of credentials.
-  //
-  // @param allow_ui Whether to allow a ui prompt
-  // @param server The proxy server in domain:port format (e.g., foo.com:8080)
-  // @param username The stored username for this proxy server
-  // @param password The stored password for this proxy server
-  // @returns true if credentials were found, otherwise false
-  bool GetProxyCredentials(bool allow_ui, bool force_ui, const CString& server,
-                           const ProxyAuthConfig& config, CString* username,
-                           CString* password, uint32* auth_scheme);
-
-  static CString ExtractProxy(const CString& proxy_settings, bool isHttps);
-
-  // This function adds a credential entry, or updates an existing server's
-  // credential entry if it already exists
-  void AddCred(const CString& server, const CString& username,
-               const CString& password);
-  HRESULT SetProxyAuthScheme(const CString& server, uint32 scheme);
-
-  bool IsPromptAllowed();
-  void PromptCancelled();
-
- private:
-  // The servers_, usernames_, and passwords_ lists form a map from server to
-  // (username, password) tuple.  They're implemented here using SimplyArrays
-  // because the otherhead of a map is thought to be too much, since most
-  // users will have one proxy server at most, not dozens.  Accesses are
-  // protected with the lock_.
-  omaha::LLock lock_;
-  CSimpleArray<CString> servers_;
-  CSimpleArray<CString> usernames_;
-  CSimpleArray<std::vector<uint8> > passwords_;
-  CSimpleArray<uint32> auth_schemes_;
-
-  // counts how many times the user has cancelled the authentication prompt.
-  uint32 prompt_cancelled_;
-
-  // after this many authentication prompt cancellations, stop prompting.
-  uint32 cancel_prompt_threshold_;
-
-  bool proxy_prompt_is_machine_;
-
-  bool ReadFromIE7(const CString& server);
-  bool ReadFromPreIE7(const CString& server);
-  bool PromptUser(const CString& server, const ProxyAuthConfig& config);
-
-  DISALLOW_EVIL_CONSTRUCTORS(ProxyAuth);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_NET_PROXY_AUTH_H__
-
diff --git a/net/simple_request.cc b/net/simple_request.cc
deleted file mode 100644
index 9ae69b6..0000000
--- a/net/simple_request.cc
+++ /dev/null
@@ -1,798 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// The implementation does not allow concurrent calls on the same object but
-// it allows calling SimpleRequest::Cancel in order to stop an ongoing request.
-// The transient state of the request is maintained by request_state_.
-// The state is created by SimpleRequest::Send and it is destroyed by
-// SimpleRequest::Close. The only concurrent access to the object state can
-// happen during calling SimpleRequest::Cancel(), Pause() and Resume(). Cancel
-// closes the connection and the request handles. This makes any of the WinHttp
-// calls on these handles fail and SimpleRequest::Send return to the caller.
-// Pause() also closes the handles but SimpleRequest automatically reopens
-// them when Resume() is called. During resume stage, SimpleRequest sends a
-// range request to continue download. During these actions, the caller is still
-// blocked.
-
-#include "omaha/net/simple_request.h"
-#include <atlconv.h>
-#include <climits>
-#include <memory>
-#include <vector>
-#include "omaha/base/const_addresses.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/string.h"
-#include "omaha/net/network_config.h"
-#include "omaha/net/network_request.h"
-#include "omaha/net/proxy_auth.h"
-#include "omaha/net/winhttp_adapter.h"
-
-namespace omaha {
-
-SimpleRequest::SimpleRequest()
-    : request_buffer_(NULL),
-      request_buffer_length_(0),
-      proxy_auth_config_(NULL, CString()),
-      is_canceled_(false),
-      is_closed_(false),
-      session_handle_(NULL),
-      low_priority_(false),
-      callback_(NULL),
-      download_completed_(false),
-      pause_happened_(false) {
-  user_agent_.Format(_T("%s;winhttp"), NetworkConfig::GetUserAgent());
-
-  // Create a manual reset event to wait on during network transfer.
-  // The event is signaled by default meaning the network transferring is
-  // enabled. Pause() resets this event to stop network activity. Resume()
-  // does the opposite as Pause(). Close() and Cancel() also set the event.
-  // This unlocks the thread if it is in paused state and returns control
-  // to the caller.
-  reset(event_resume_, ::CreateEvent(NULL, true, true, NULL));
-  ASSERT1(valid(event_resume_));
-}
-
-// TODO(omaha): we should attempt to cleanup the file only if we
-// created it in the first place.
-SimpleRequest::~SimpleRequest() {
-  Close();
-  callback_ = NULL;
-
-  // If download failed, try to clean up the target file.
-  if (!download_completed_ && !filename_.IsEmpty()) {
-    if (!::DeleteFile(filename_) && ::GetLastError() != ERROR_FILE_NOT_FOUND) {
-      NET_LOG(LW, (_T("[SimpleRequest][Failed to delete file: %s][0x%08x]."),
-                   filename_.GetString(), HRESULTFromLastError()));
-    }
-  }
-}
-
-void SimpleRequest::set_url(const CString& url) {
-  __mutexScope(lock_);
-  if (url_ != url) {
-    url_ = url;
-    CloseHandles();
-    request_state_.reset();
-  }
-}
-
-void SimpleRequest::set_filename(const CString& filename) {
-  __mutexScope(lock_);
-  if (filename_ != filename) {
-    filename_ = filename;
-    CloseHandles();
-    request_state_.reset();
-  }
-}
-
-HRESULT SimpleRequest::Close() {
-  NET_LOG(L3, (_T("[SimpleRequest::Close]")));
-
-  __mutexScope(lock_);
-  is_closed_ = true;
-  CloseHandles();
-  request_state_.reset();
-  winhttp_adapter_.reset();
-
-  // Resume the downloading thread if it is blocked. It is still fine if the
-  // event is set since the operation is like no-op in that case.
-  return Resume();
-}
-
-HRESULT SimpleRequest::Cancel() {
-  NET_LOG(L3, (_T("[SimpleRequest::Cancel]")));
-
-  __mutexScope(lock_);
-  is_canceled_ = true;
-  CloseHandles();
-
-  // Resume the downloading thread if it is blocked. It is still fine if the
-  // event is set since the operation is like no-op in that case.
-  return Resume();
-}
-
-void SimpleRequest::CloseHandles() {
-  if (winhttp_adapter_.get()) {
-    winhttp_adapter_->CloseHandles();
-  }
-}
-
-bool SimpleRequest::IsResumeNeeded() const {
-  __mutexScope(lock_);
-  if (!IsPauseSupported() || is_canceled_ || is_closed_) {
-    return false;
-  }
-
-  return pause_happened_;
-}
-
-bool SimpleRequest::IsPauseSupported() const {
-  __mutexScope(lock_);
-  return valid(event_resume_) && !IsPostRequest() && !filename_.IsEmpty();
-}
-
-HRESULT SimpleRequest::Pause() {
-  NET_LOG(L3, (_T("[SimpleRequest::Pause]")));
-
-  if (!IsPauseSupported()) {
-    return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
-  }
-
-  __mutexScope(ready_to_pause_lock_);
-  __mutexScope(lock_);
-
-  pause_happened_ = true;
-  CloseHandles();
-  return ::ResetEvent(get(event_resume_)) ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT SimpleRequest::Resume() {
-  NET_LOG(L3, (_T("[SimpleRequest::Resume]")));
-
-  __mutexScope(lock_);
-  HRESULT hr = S_OK;
-  if (IsPauseSupported()) {
-    hr = ::SetEvent(get(event_resume_)) ? S_OK : HRESULTFromLastError();
-  }
-  return hr;
-}
-
-void SimpleRequest::WaitForResumeEvent() {
-  if (!event_resume_) {
-    return;
-  }
-
-  // Reset pause_happened_ state to indicate that pause has not yet happened
-  // during new resume stage.
-  __mutexBlock(lock_) {
-    pause_happened_ = false;
-  }
-
-  VERIFY1(::WaitForSingleObject(get(event_resume_), INFINITE) != WAIT_FAILED);
-}
-
-HRESULT SimpleRequest::Send() {
-  NET_LOG(L3, (_T("[SimpleRequest::Send][%s]"), url_));
-
-  ASSERT1(!url_.IsEmpty());
-  if (!session_handle_) {
-    NET_LOG(LE, (_T("[SimpleRequest: session_handle_ is NULL]")));
-    return OMAHA_NET_E_WINHTTP_NOT_AVAILABLE;
-  }
-
-  HRESULT hr = S_OK;
-
-  __mutexBlock(ready_to_pause_lock_) {
-    __mutexBlock(lock_) {
-      winhttp_adapter_.reset(new WinHttpAdapter());
-      hr = winhttp_adapter_->Initialize();
-      if (FAILED(hr)) {
-        return hr;
-      }
-
-      if (!IsPauseSupported() || request_state_ == NULL) {
-        request_state_.reset(new TransientRequestState);
-      } else {
-        // Discard all previous download states except content_length and
-        // current_bytes for resume purpose. These two states will be validated
-        // against the previously (partially) downloaded file when reopens the
-        // target file.
-        scoped_ptr<TransientRequestState> request_state(
-            new TransientRequestState);
-        request_state->content_length = request_state_->content_length;
-        request_state->current_bytes = request_state_->current_bytes;
-
-        request_state_.swap(request_state);
-      }
-    }
-  }
-
-  for (bool first_time = true, cancelled = false;
-       !cancelled;
-       first_time = false) {
-    scoped_hfile file_handle;
-
-    __mutexBlock(ready_to_pause_lock_) {
-      if (!first_time) {
-        if (IsResumeNeeded()) {
-          NET_LOG(L3, (_T("[SimpleRequest::Send paused.]")));
-          WaitForResumeEvent();
-          NET_LOG(L3, (_T("[SimpleRequest::Send resumed.]")));
-        } else {
-          if (is_canceled_) {
-            hr = GOOPDATE_E_CANCELLED;
-
-            // Once cancelled, we should set downloaded bytes to 0
-            request_state_->current_bytes = 0;
-          }
-
-          // Macro __mutexBlock has a hidden loop built-in and thus one break
-          // is not enough to exit the loop. Uses a flag instead.
-          cancelled = true;
-        }
-      }
-
-      if (!cancelled) {
-        hr = PrepareRequest(address(file_handle));
-      }
-    }
-
-    if (SUCCEEDED(hr) && !cancelled) {
-      ASSERT1(request_state_->current_bytes <= request_state_->content_length);
-
-      // Only requests data if there is more data to download.
-      if (request_state_->content_length == 0 ||
-          request_state_->current_bytes < request_state_->content_length) {
-        hr = RequestData(get(file_handle));
-      }
-    }
-  }
-
-  NET_LOG(L3,
-          (_T("[SimpleRequest::Send][0x%08x][%d]"), hr, GetHttpStatusCode()));
-  return hr;
-}
-
-HRESULT SimpleRequest::Connect() {
-  HRESULT hr = winhttp_adapter_->CrackUrl(url_,
-                                          ICU_DECODE,
-                                          &request_state_->scheme,
-                                          &request_state_->server,
-                                          &request_state_->port,
-                                          &request_state_->url_path,
-                                          NULL);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  ASSERT1(!request_state_->scheme.CompareNoCase(kHttpProtoScheme) ||
-          !request_state_->scheme.CompareNoCase(kHttpsProtoScheme));
-
-  hr = winhttp_adapter_->Connect(session_handle_,
-                                 request_state_->server,
-                                 request_state_->port);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // TODO(omaha): figure out the accept types.
-  //              figure out more flags.
-  request_state_->is_https = false;
-  DWORD flags = WINHTTP_FLAG_REFRESH;
-  if (request_state_->scheme == kHttpsProtoScheme) {
-    request_state_->is_https = true;
-    flags |= WINHTTP_FLAG_SECURE;
-  }
-  const TCHAR* verb = IsPostRequest() ? _T("POST") : _T("GET");
-  hr = winhttp_adapter_->OpenRequest(verb, request_state_->url_path,
-                                     NULL, WINHTTP_NO_REFERER,
-                                     WINHTTP_DEFAULT_ACCEPT_TYPES, flags);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Disable redirects for POST requests.
-  if (IsPostRequest()) {
-    VERIFY1(SUCCEEDED(
-        winhttp_adapter_->SetRequestOptionInt(WINHTTP_OPTION_DISABLE_FEATURE,
-                                              WINHTTP_DISABLE_REDIRECTS)));
-  }
-
-  CString additional_headers = additional_headers_;
-
-  // If the target has been partially downloaded, send a range request to resume
-  // download, instead of starting from scratch again.
-  if (request_state_->current_bytes != 0 &&
-      request_state_->current_bytes != request_state_->content_length) {
-    ASSERT1(request_state_->current_bytes < request_state_->content_length);
-    additional_headers.AppendFormat(_T("Range: bytes=%d-\r\n"),
-                                    request_state_->current_bytes);
-  }
-  if (!additional_headers.IsEmpty()) {
-    uint32 header_flags = WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE;
-    hr = winhttp_adapter_->AddRequestHeaders(additional_headers,
-                                             -1,
-                                             header_flags);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  // If the WPAD detection fails, allow the request to go direct connection.
-  SetProxyInformation();
-
-  return S_OK;
-}
-
-HRESULT SimpleRequest::OpenDestinationFile(HANDLE* file_handle) {
-  ASSERT1(!filename_.IsEmpty());
-  ASSERT1(file_handle);
-
-  DWORD create_disposition = request_state_->content_length == 0 ?
-                             CREATE_ALWAYS : OPEN_ALWAYS;
-
-  scoped_hfile file(::CreateFile(filename_, GENERIC_WRITE, 0, NULL,
-                                 create_disposition, FILE_ATTRIBUTE_NORMAL,
-                                 NULL));
-
-  if (!file) {
-    return HRESULTFromLastError();
-  }
-
-  if (request_state_->content_length != 0) {
-    DWORD raw_file_size = ::GetFileSize(get(file), NULL);
-    if (INVALID_FILE_SIZE == raw_file_size || raw_file_size > INT_MAX) {
-      return E_FAIL;
-    }
-    int file_size = static_cast<int>(raw_file_size);
-
-    // Local file size should not be greater than remote file size and file
-    // size must match the number of bytes we previously downloaded. If not,
-    // reset the local file.
-    bool need_reset_file = file_size > request_state_->content_length;
-    need_reset_file |= file_size != request_state_->current_bytes;
-
-    if (need_reset_file) {
-      // Need to download from byte 0. Reopen the file with truncation.
-      request_state_->current_bytes = 0;
-      reset(file, ::CreateFile(filename_, GENERIC_WRITE, 0, NULL,
-                               CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL));
-
-      if (!file) {
-        return HRESULTFromLastError();
-      }
-    } else {
-      LARGE_INTEGER start_pos;
-      start_pos.LowPart = static_cast<DWORD>(request_state_->current_bytes);
-      start_pos.HighPart = 0;
-      if (!::SetFilePointerEx(get(file), start_pos, NULL, FILE_BEGIN)) {
-        return HRESULTFromLastError();
-      }
-    }
-  } else {
-    // Always start from byte 0 if we don't know remote file size.
-    request_state_->current_bytes = 0;
-  }
-
-  *file_handle = release(file);
-  return S_OK;
-}
-
-HRESULT SimpleRequest::SendRequest() {
-  int proxy_retry_count = 0;
-  int max_proxy_retries = 1;
-  CString username;
-  CString password;
-  HRESULT hr = S_OK;
-
-  bool done = false;
-  while (!done) {
-    uint32& request_scheme = request_state_->proxy_authentication_scheme;
-    if (request_scheme) {
-      NET_LOG(L3, (_T("[SimpleRequest::SendRequest][auth_scheme][%d]"),
-          request_scheme));
-      winhttp_adapter_->SetCredentials(WINHTTP_AUTH_TARGET_PROXY,
-                                       request_scheme,
-                                       username, password);
-
-      CString headers;
-      headers.Format(_T("%s: %d\r\n"),
-                     kHeaderXProxyRetryCount, proxy_retry_count);
-      if (!username.IsEmpty()) {
-        headers.AppendFormat(_T("%s: 1\r\n"), kHeaderXProxyManualAuth);
-      }
-      uint32 flags = WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE;
-      VERIFY1(SUCCEEDED(winhttp_adapter_->AddRequestHeaders(headers,
-                                                            -1,
-                                                            flags)));
-    }
-
-    size_t bytes_to_send = request_buffer_length_;
-    hr = winhttp_adapter_->SendRequest(NULL,
-                                       0,
-                                       request_buffer_,
-                                       bytes_to_send,
-                                       bytes_to_send);
-    if (FAILED(hr)) {
-      return hr;
-    }
-    NET_LOG(L3,
-        (_T("[SimpleRequest::SendRequest][request sent][server: %s][IP: %s]"),
-         winhttp_adapter_->server_name(),
-         winhttp_adapter_->server_ip()));
-
-    hr = winhttp_adapter_->ReceiveResponse();
-#if DEBUG
-    LogResponseHeaders();
-#endif
-    if (hr == ERROR_WINHTTP_RESEND_REQUEST) {
-      // Resend the request if needed, likely because the authentication
-      // scheme requires many transactions on the same handle.
-      continue;
-    } else if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = winhttp_adapter_->QueryRequestHeadersInt(
-        WINHTTP_QUERY_STATUS_CODE,
-        NULL,
-        &request_state_->http_status_code,
-        NULL);
-    if (FAILED(hr)) {
-      return hr;
-    }
-    if (request_state_->http_status_code < HTTP_STATUS_FIRST ||
-        request_state_->http_status_code > HTTP_STATUS_LAST) {
-      return E_FAIL;
-    }
-
-    NetworkConfigManager& network_manager = NetworkConfigManager::Instance();
-    switch (request_state_->http_status_code) {
-      case HTTP_STATUS_DENIED:
-        // 401 responses are not supported. Omaha does not have to authenticate
-        // to our backend.
-        done = true;
-        break;
-
-      case HTTP_STATUS_PROXY_AUTH_REQ: {
-        NET_LOG(L2, (_T("[http proxy requires authentication]")));
-        ++proxy_retry_count;
-        if (proxy_retry_count > max_proxy_retries) {
-          // If we get multiple 407s in a row then we are done. It does not make
-          // sense to retry further.
-          done = true;
-          break;
-        }
-        if (!request_scheme) {
-          uint32 supported_schemes(0), first_scheme(0), auth_target(0);
-          hr = winhttp_adapter_->QueryAuthSchemes(&supported_schemes,
-                                                  &first_scheme,
-                                                  &auth_target);
-          if (FAILED(hr)) {
-            return hr;
-          }
-          ASSERT1(auth_target == WINHTTP_AUTH_TARGET_PROXY);
-          request_scheme = ChooseProxyAuthScheme(supported_schemes);
-          ASSERT1(request_scheme);
-          NET_LOG(L3, (_T("[SimpleRequest::SendRequest][Auth scheme][%d]"),
-              request_scheme));
-          if (request_scheme == WINHTTP_AUTH_SCHEME_NEGOTIATE ||
-              request_scheme == WINHTTP_AUTH_SCHEME_NTLM) {
-            // Increases the retry count. Tries to do an autologon at first, and
-            // if that fails, will call GetProxyCredentials below.
-            ++max_proxy_retries;
-            break;
-          }
-        }
-
-        uint32 auth_scheme = UNKNOWN_AUTH_SCHEME;
-        // May prompt the user for credentials, or get cached credentials.
-        NetworkConfig* network_config = NULL;
-        hr = network_manager.GetUserNetworkConfig(&network_config);
-        if (FAILED(hr)) {
-          return hr;
-        }
-        if (!network_config->GetProxyCredentials(true,
-                                                 false,
-                                                 request_state_->proxy,
-                                                 proxy_auth_config_,
-                                                 request_state_->is_https,
-                                                 &username,
-                                                 &password,
-                                                 &auth_scheme)) {
-          NET_LOG(LE,
-                  (_T("[SimpleRequest::SendRequest][GetProxyCreds failed]")));
-          done = true;
-          break;
-        }
-        if (auth_scheme != UNKNOWN_AUTH_SCHEME) {
-          // Uses the known scheme that was successful previously.
-          request_scheme = auth_scheme;
-        }
-        break;
-      }
-
-      default:
-        // We got some kind of response. If we have a valid username, we
-        // record the auth scheme with the NetworkConfig, so it can be cached
-        // for future use within this process for current user..
-        if (!username.IsEmpty()) {
-          NetworkConfig* network_config = NULL;
-          hr = network_manager.GetUserNetworkConfig(&network_config);
-          if (SUCCEEDED(hr)) {
-            VERIFY1(SUCCEEDED(network_config->SetProxyAuthScheme(
-                request_state_->proxy, request_state_->is_https,
-                request_scheme)));
-          }
-        }
-        done = true;
-        break;
-    }
-  }
-
-  return hr;
-}
-
-HRESULT SimpleRequest::ReceiveData(HANDLE file_handle) {
-  ASSERT1(file_handle != INVALID_HANDLE_VALUE || filename_.IsEmpty());
-
-  HRESULT hr = S_OK;
-
-  // In the case of a "204 No Content" response, WinHttp blocks when
-  // querying or reading the available data. According to the RFC,
-  // the 204 response must not include a message-body, and thus is always
-  // terminated by the first empty line after the header fields.
-  // It appears WinHttp does not internally handles the 204 response. If this,
-  // condition is not handled here explicitly, WinHttp will timeout when
-  // waiting for the data instead of returning right away.
-  if (request_state_->http_status_code == HTTP_STATUS_NO_CONTENT) {
-    return S_OK;
-  }
-
-  int content_length = 0;
-  winhttp_adapter_->QueryRequestHeadersInt(WINHTTP_QUERY_CONTENT_LENGTH,
-                                           WINHTTP_HEADER_NAME_BY_INDEX,
-                                           &content_length,
-                                           WINHTTP_NO_HEADER_INDEX);
-  if (request_state_->content_length == 0) {
-    request_state_->content_length = content_length;
-    request_state_->current_bytes = 0;
-  }
-
-  const bool is_http_success =
-      request_state_->http_status_code == HTTP_STATUS_OK ||
-      request_state_->http_status_code == HTTP_STATUS_PARTIAL_CONTENT;
-
-  std::vector<uint8> buffer;
-  do  {
-    DWORD bytes_available(0);
-    winhttp_adapter_->QueryDataAvailable(&bytes_available);
-    buffer.resize(1 + bytes_available);
-    hr = winhttp_adapter_->ReadData(&buffer.front(),
-                                    buffer.size(),
-                                    &bytes_available);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    buffer.resize(bytes_available);
-    if (!buffer.empty()) {
-      if (!filename_.IsEmpty()) {
-        DWORD num_bytes(0);
-        if (!::WriteFile(file_handle,
-                         reinterpret_cast<const char*>(&buffer.front()),
-                         buffer.size(), &num_bytes, NULL)) {
-          return HRESULTFromLastError();
-        }
-        ASSERT1(num_bytes == buffer.size());
-      } else {
-        request_state_->response.insert(request_state_->response.end(),
-                                        buffer.begin(),
-                                        buffer.end());
-      }
-    }
-
-    // Update current_bytes after those bytes are serialized in case we
-    // pause before current_bytes is updated, we can throw away the last
-    // batch of bytes received and resume.
-    request_state_->current_bytes += bytes_available;
-    if (request_state_->content_length) {
-      ASSERT1(request_state_->current_bytes <= request_state_->content_length);
-    }
-
-    // The callback is called only for 200 or 206 http codes.
-    if (callback_ && request_state_->content_length && is_http_success) {
-      callback_->OnProgress(request_state_->current_bytes,
-                            request_state_->content_length,
-                            WINHTTP_CALLBACK_STATUS_READ_COMPLETE,
-                            NULL);
-    }
-  } while (!buffer.empty());
-
-  NET_LOG(L3, (_T("[bytes downloaded %d]"), request_state_->current_bytes));
-  if (file_handle != INVALID_HANDLE_VALUE) {
-    // All bytes must be written to the file in the file download case.
-    ASSERT1(::SetFilePointer(file_handle, 0, NULL, FILE_CURRENT) ==
-            static_cast<DWORD>(request_state_->current_bytes));
-  }
-
-  download_completed_ = true;
-  return hr;
-}
-
-HRESULT SimpleRequest::PrepareRequest(HANDLE* file_handle) {
-  // Read the remaining bytes of the body. If we have a file to save the
-  // response into, create the file.
-  HRESULT hr = S_OK;
-  if (!filename_.IsEmpty()) {
-    hr = OpenDestinationFile(file_handle);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  } else {
-    // Always restarts if downloading to memory.
-    request_state_->current_bytes = 0;
-    request_state_->response.clear();
-  }
-
-  return Connect();
-}
-
-HRESULT SimpleRequest::RequestData(HANDLE file_handle) {
-  HRESULT hr = SendRequest();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return ReceiveData(file_handle);
-}
-
-std::vector<uint8> SimpleRequest::GetResponse() const {
-  return request_state_.get() ? request_state_->response :
-                                std::vector<uint8>();
-}
-
-HRESULT SimpleRequest::QueryHeadersString(uint32 info_level,
-                                          const TCHAR* name,
-                                          CString* value) const {
-  // Name can be null when the info_level specifies the header to query.
-  if (winhttp_adapter_.get()) {
-    return winhttp_adapter_->QueryRequestHeadersString(info_level,
-                                                       name,
-                                                       value,
-                                                       WINHTTP_NO_HEADER_INDEX);
-  } else {
-    return E_UNEXPECTED;
-  }
-}
-
-CString SimpleRequest::GetResponseHeaders() const {
-  CString response_headers;
-  if (winhttp_adapter_.get()) {
-    CString response_headers;
-    if (SUCCEEDED(winhttp_adapter_->QueryRequestHeadersString(
-        WINHTTP_QUERY_RAW_HEADERS_CRLF,
-        WINHTTP_HEADER_NAME_BY_INDEX,
-        &response_headers,
-        WINHTTP_NO_HEADER_INDEX))) {
-      return response_headers;
-    }
-  }
-  return CString();
-}
-
-uint32 SimpleRequest::ChooseProxyAuthScheme(uint32 supported_schemes) {
-  // It is the server's responsibility only to accept
-  // authentication schemes that provide a sufficient level
-  // of security to protect the server's resources.
-  //
-  // The client is also obligated only to use an authentication
-  // scheme that adequately protects its username and password.
-  //
-  // TODO(omaha): remove Basic authentication because Basic authentication
-  // exposes the client's username and password to anyone monitoring
-  // the connection. This option is here for Fiddler testing purposes.
-
-  uint32 auth_schemes[] = {
-    WINHTTP_AUTH_SCHEME_NEGOTIATE,
-    WINHTTP_AUTH_SCHEME_NTLM,
-    WINHTTP_AUTH_SCHEME_DIGEST,
-    WINHTTP_AUTH_SCHEME_BASIC,
-  };
-  for (int i = 0; i < arraysize(auth_schemes); ++i) {
-    if (supported_schemes & auth_schemes[i]) {
-      return auth_schemes[i];
-    }
-  }
-
-  return 0;
-}
-
-void SimpleRequest::SetProxyInformation() {
-  bool uses_proxy = false;
-  CString proxy, proxy_bypass;
-  int access_type = NetworkConfig::GetAccessType(proxy_config_);
-  if (access_type == WINHTTP_ACCESS_TYPE_AUTO_DETECT) {
-    HttpClient::ProxyInfo proxy_info = {0};
-    NetworkConfig* network_config = NULL;
-    NetworkConfigManager& network_manager = NetworkConfigManager::Instance();
-    HRESULT hr = network_manager.GetUserNetworkConfig(&network_config);
-    if (SUCCEEDED(hr)) {
-      hr = network_config->GetProxyForUrl(
-          url_,
-          proxy_config_.auto_config_url,
-          &proxy_info);
-      if (SUCCEEDED(hr)) {
-        // The result of proxy auto-detection could be that either a proxy is
-        // found, or direct connection is allowed for the specified url.
-        ASSERT(proxy_info.access_type == WINHTTP_ACCESS_TYPE_NAMED_PROXY ||
-               proxy_info.access_type == WINHTTP_ACCESS_TYPE_NO_PROXY,
-               (_T("[Unexpected access_type][%d]"), proxy_info.access_type));
-
-        uses_proxy = proxy_info.access_type == WINHTTP_ACCESS_TYPE_NAMED_PROXY;
-
-        proxy = proxy_info.proxy;
-        proxy_bypass = proxy_info.proxy_bypass;
-
-        ::GlobalFree(const_cast<wchar_t*>(proxy_info.proxy));
-        ::GlobalFree(const_cast<wchar_t*>(proxy_info.proxy_bypass));
-        } else {
-        ASSERT1(!uses_proxy);
-        NET_LOG(LW, (_T("[GetProxyForUrl failed][0x%08x]"), hr));
-      }
-    } else {
-      NET_LOG(LW, (_T("[GetUserNetworkConfig failed][0x%08x]"), hr));
-    }
-  } else if (access_type == WINHTTP_ACCESS_TYPE_NAMED_PROXY) {
-    uses_proxy = true;
-    proxy = proxy_config_.proxy;
-    proxy_bypass = proxy_config_.proxy_bypass;
-  }
-
-  // If a proxy is going to be used, modify the state of the object and
-  // set the proxy information on the request handle.
-  if (uses_proxy) {
-    ASSERT1(!proxy.IsEmpty());
-
-    request_state_->proxy        = proxy;
-    request_state_->proxy_bypass = proxy_bypass;
-
-    HttpClient::ProxyInfo proxy_info = {0};
-    proxy_info.access_type = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
-    proxy_info.proxy = request_state_->proxy;
-    proxy_info.proxy_bypass = request_state_->proxy_bypass;
-
-    NET_LOG(L3, (_T("[using proxy %s]"), proxy_info.proxy));
-    VERIFY1(SUCCEEDED(winhttp_adapter_->SetRequestOption(WINHTTP_OPTION_PROXY,
-                                                         &proxy_info,
-                                                         sizeof(proxy_info))));
-  }
-}
-
-void SimpleRequest::LogResponseHeaders() {
-  CString response_headers;
-  winhttp_adapter_->QueryRequestHeadersString(WINHTTP_QUERY_RAW_HEADERS_CRLF,
-                                              WINHTTP_HEADER_NAME_BY_INDEX,
-                                              &response_headers,
-                                              WINHTTP_NO_HEADER_INDEX);
-  NET_LOG(L3, (_T("[response headers...]\r\n%s"), response_headers));
-}
-
-}  // namespace omaha
-
diff --git a/net/simple_request.h b/net/simple_request.h
deleted file mode 100644
index bed0ced..0000000
--- a/net/simple_request.h
+++ /dev/null
@@ -1,196 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// SimpleRequest provides for http transactions using WinHttp/WinInet.
-//
-// TODO(omaha): the class interface is not stable yet, as a few more
-// getters and setters are still needed.
-//
-// TODO(omaha): receiving a response into a file is not implemented yet.
-
-#ifndef OMAHA_NET_SIMPLE_REQUEST_H_
-#define OMAHA_NET_SIMPLE_REQUEST_H_
-
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/net/http_request.h"
-#include "omaha/net/network_config.h"
-
-namespace omaha {
-
-class WinHttpAdapter;
-
-class SimpleRequest : public HttpRequestInterface {
- public:
-  SimpleRequest();
-  virtual ~SimpleRequest();
-
-  virtual HRESULT Close();
-
-  virtual HRESULT Send();
-
-  virtual HRESULT Cancel();
-
-  virtual HRESULT Pause();
-
-  virtual HRESULT Resume();
-
-  virtual std::vector<uint8> GetResponse() const;
-
-  virtual int GetHttpStatusCode() const {
-    return request_state_.get() ? request_state_->http_status_code : 0;
-  }
-
-  virtual HRESULT QueryHeadersString(uint32 info_level,
-                                     const TCHAR* name,
-                                     CString* value) const;
-
-  virtual CString GetResponseHeaders() const;
-
-  virtual CString ToString() const { return _T("winhttp"); }
-
-  virtual void set_session_handle(HINTERNET session_handle) {
-    session_handle_ = session_handle;
-  }
-
-  virtual void set_url(const CString& url);
-
-  virtual void set_request_buffer(const void* buffer, size_t buffer_length) {
-    request_buffer_ = buffer;
-    request_buffer_length_ = buffer_length;
-  }
-
-  virtual void set_proxy_configuration(const ProxyConfig& proxy_config) {
-    proxy_config_ = proxy_config;
-  }
-
-  // Sets the filename to receive the response instead of the memory buffer.
-  virtual void set_filename(const CString& filename);
-
-  virtual void set_low_priority(bool low_priority) {
-    low_priority_ = low_priority;
-  }
-
-  virtual void set_callback(NetworkRequestCallback* callback) {
-    callback_ = callback;
-  }
-
-  virtual void set_additional_headers(const CString& additional_headers) {
-    additional_headers_ = additional_headers;
-  }
-
-  // This request always uses the specified protocol so it is fine to ignore
-  // this attribute.
-  virtual void set_preserve_protocol(bool preserve_protocol) {
-    UNREFERENCED_PARAMETER(preserve_protocol);
-  }
-
-  virtual CString user_agent() const { return user_agent_; }
-
-  virtual void set_user_agent(const CString& user_agent) {
-    user_agent_ = user_agent;
-  }
-
-  virtual void set_proxy_auth_config(const ProxyAuthConfig& proxy_auth_config) {
-    proxy_auth_config_ = proxy_auth_config;
-  }
-
- private:
-  HRESULT OpenDestinationFile(HANDLE* file_handle);
-  HRESULT PrepareRequest(HANDLE* file_handle);
-  HRESULT Connect();
-  HRESULT SendRequest();
-  HRESULT ReceiveData(HANDLE file_handle);
-  HRESULT RequestData(HANDLE file_handle);
-  bool IsResumeNeeded() const;
-  bool IsPauseSupported() const;
-
-  void LogResponseHeaders();
-
-  // Sets proxy information for the request.
-  void SetProxyInformation();
-
-  struct TransientRequestState;
-  void CloseHandles();
-
-  static uint32 ChooseProxyAuthScheme(uint32 supported_schemes);
-
-  // Returns true if the request is a POST request, in other words, if there
-  // is a request buffer to be sent to the server.
-  bool IsPostRequest() const { return request_buffer_ != NULL; }
-
-  // When in pause state, caller will be blocked until Resume() is called.
-  // Returns immediately otherwise.
-  void WaitForResumeEvent();
-
-  // Holds the transient state corresponding to a single http request. We
-  // prefer to isolate the state of a request to avoid dirty state.
-  struct TransientRequestState {
-    TransientRequestState()
-        : port(0),
-          http_status_code(0),
-          proxy_authentication_scheme(0),
-          is_https(false),
-          content_length(0),
-          current_bytes(0) {}
-
-    CString scheme;
-    CString server;
-    int     port;
-    CString url_path;
-    bool    is_https;
-
-    std::vector<uint8> response;
-    int http_status_code;
-    uint32 proxy_authentication_scheme;
-    CString proxy;
-    CString proxy_bypass;
-    int content_length;
-    int current_bytes;
-  };
-
-  LLock lock_;
-  volatile bool is_canceled_;
-  volatile bool is_closed_;
-  volatile bool pause_happened_;
-  LLock ready_to_pause_lock_;
-  HINTERNET session_handle_;  // Not owned by this class.
-  CString url_;
-  CString filename_;
-  const void* request_buffer_;          // Contains the request body for POST.
-  size_t      request_buffer_length_;   // Length of the request body.
-  CString additional_headers_;
-  CString user_agent_;
-  ProxyAuthConfig proxy_auth_config_;
-  ProxyConfig proxy_config_;
-  bool low_priority_;
-  NetworkRequestCallback* callback_;
-  scoped_ptr<WinHttpAdapter> winhttp_adapter_;
-  scoped_ptr<TransientRequestState> request_state_;
-  scoped_event event_resume_;
-  bool download_completed_;
-
-  DISALLOW_COPY_AND_ASSIGN(SimpleRequest);
-};
-
-}   // namespace omaha
-
-#endif  // OMAHA_NET_SIMPLE_REQUEST_H_
-
diff --git a/net/simple_request_unittest.cc b/net/simple_request_unittest.cc
deleted file mode 100644
index c72dce3..0000000
--- a/net/simple_request_unittest.cc
+++ /dev/null
@@ -1,510 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-//
-// Tests Get over http and https, using direct connection and wpad proxy.
-//
-// TODO(omaha): missing Post unit tests
-
-#include <windows.h>
-#include <winhttp.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/const_addresses.h"
-#include "omaha/base/error.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/string.h"
-#include "omaha/net/network_config.h"
-#include "omaha/net/simple_request.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-const TCHAR* kBigFileUrl =
-    _T("http://dl.google.com/dl/edgedl/update2/UpdateData_10M.bin");
-
-DWORD WINAPI PauseAndResumeThreadProc(void* parameter) {
-  SimpleRequest* simple_request = reinterpret_cast<SimpleRequest*>(parameter);
-  ASSERT1(simple_request);
-
-  bool request_paused = false;
-
-  // Loop even times so the download thread won't be blocked by Pause() after
-  // loop exit.
-  for (int i = 0; i < 10; ++i) {
-    ::Sleep(100);
-
-    if (request_paused) {
-      simple_request->Resume();
-    } else {
-      simple_request->Pause();
-    }
-
-    request_paused = !request_paused;
-  }
-
-  return 0;
-}
-
-DWORD WINAPI CancelRequestThreadProc(void* parameter) {
-  SimpleRequest* simple_request = reinterpret_cast<SimpleRequest*>(parameter);
-  ASSERT1(simple_request);
-
-  // Wait a short period of time so the download can start. Assumes the file
-  // is large enough so that download will not complete within the sleep time.
-  ::Sleep(500);
-
-  simple_request->Cancel();
-  return 0;
-}
-
-class SimpleRequestTest : public testing::Test {
- protected:
-  SimpleRequestTest() {}
-
-  void SimpleGet(const CString& url, const ProxyConfig& config);
-  void SimpleDownloadFile(const CString& url,
-                          const CString& filename,
-                          const ProxyConfig& config);
-  void SimpleDownloadFilePauseAndResume(const CString& url,
-                                        const CString& filename,
-                                        const ProxyConfig& config);
-  void SimpleDownloadFileCancellation(const CString& filename, bool do_cancel);
-  void SimpleGetHostNotFound(const CString& url, const ProxyConfig& config);
-
-  void SimpleGetFileNotFound(const CString& url, const ProxyConfig& config);
-
-  void SimpleGetRedirect(const CString& url, const ProxyConfig& config);
-
-  void PrepareRequest(const CString& url,
-                      const ProxyConfig& config,
-                      SimpleRequest* simple_request);
-};
-
-void SimpleRequestTest::PrepareRequest(const CString& url,
-                                       const ProxyConfig& config,
-                                       SimpleRequest* simple_request) {
-  ASSERT_TRUE(simple_request);
-  NetworkConfig* network_config = NULL;
-  EXPECT_HRESULT_SUCCEEDED(
-      NetworkConfigManager::Instance().GetUserNetworkConfig(&network_config));
-
-  HINTERNET handle = network_config->session().session_handle;
-  simple_request->set_session_handle(handle);
-  simple_request->set_url(url);
-  simple_request->set_proxy_configuration(config);
-
-  CString user_agent_header;
-  user_agent_header.Format(_T("User-Agent: %s\r\n"),
-                           simple_request->user_agent());
-  simple_request->set_additional_headers(user_agent_header);
-}
-
-void SimpleRequestTest::SimpleGet(const CString& url,
-                                  const ProxyConfig& config) {
-  SimpleRequest simple_request;
-  PrepareRequest(url, config, &simple_request);
-  EXPECT_HRESULT_SUCCEEDED(simple_request.Send());
-  EXPECT_EQ(HTTP_STATUS_OK, simple_request.GetHttpStatusCode());
-  CString response = Utf8BufferToWideChar(simple_request.GetResponse());
-
-  // robots.txt response contains "User-agent: *". This is not the "User-Agent"
-  // http header.
-  EXPECT_NE(-1, response.Find(_T("User-agent: *")));
-  CString content_type;
-  simple_request.QueryHeadersString(WINHTTP_QUERY_CONTENT_TYPE,
-                                    NULL, &content_type);
-  EXPECT_STREQ(_T("text/plain"), content_type);
-
-  // Uses custom query for content type and it should match what we just got.
-  CString content_type_from_custom_query;
-  simple_request.QueryHeadersString(WINHTTP_QUERY_CUSTOM,
-                                    _T("Content-Type"),
-                                    &content_type_from_custom_query);
-  EXPECT_STREQ(content_type, content_type_from_custom_query);
-
-  EXPECT_FALSE(simple_request.GetResponseHeaders().IsEmpty());
-
-  // Check the user agent went out with the request.
-  CString user_agent;
-  simple_request.QueryHeadersString(
-      WINHTTP_QUERY_FLAG_REQUEST_HEADERS | WINHTTP_QUERY_USER_AGENT,
-      WINHTTP_HEADER_NAME_BY_INDEX,
-      &user_agent);
-  EXPECT_STREQ(simple_request.user_agent(), user_agent);
-}
-
-void SimpleRequestTest::SimpleDownloadFile(const CString& url,
-                                           const CString& filename,
-                                           const ProxyConfig& config) {
-  SimpleRequest simple_request;
-  PrepareRequest(url, config, &simple_request);
-  simple_request.set_filename(filename);
-
-  EXPECT_HRESULT_SUCCEEDED(simple_request.Send());
-
-  int http_status = simple_request.GetHttpStatusCode();
-  EXPECT_TRUE(http_status == HTTP_STATUS_OK ||
-              http_status == HTTP_STATUS_PARTIAL_CONTENT);
-}
-
-void SimpleRequestTest::SimpleDownloadFilePauseAndResume(
-    const CString& url,
-    const CString& filename,
-    const ProxyConfig& config) {
-  const int kNumThreads = 3;
-  const int kMaxWaitTimeMs = 10000;
-  SimpleRequest simple_request;
-  PrepareRequest(url, config, &simple_request);
-  simple_request.set_filename(filename);
-
-  // Testing call Pause before Send.
-  simple_request.Pause();
-  simple_request.Resume();
-  HANDLE pause_and_resume_threads[kNumThreads] = { NULL };
-
-  // Now create some threads to run Pause/Resume in the middle of sending.
-  for (int i = 0; i < kNumThreads; ++i) {
-    pause_and_resume_threads[i] = ::CreateThread(NULL,
-                                                 0,
-                                                 PauseAndResumeThreadProc,
-                                                 &simple_request,
-                                                 0,
-                                                 NULL);
-    EXPECT_TRUE(pause_and_resume_threads[i] != NULL);
-  }
-
-  EXPECT_HRESULT_SUCCEEDED(simple_request.Send());
-
-  int http_status = simple_request.GetHttpStatusCode();
-  EXPECT_TRUE(http_status == HTTP_STATUS_OK ||
-              http_status == HTTP_STATUS_PARTIAL_CONTENT);
-
-  DWORD result = ::WaitForMultipleObjects(arraysize(pause_and_resume_threads),
-                                          pause_and_resume_threads,
-                                          true,   // Wait all threads to exit.
-                                          kMaxWaitTimeMs);
-  EXPECT_NE(result, WAIT_FAILED);
-  EXPECT_NE(result, WAIT_TIMEOUT);
-
-  for (int i = 0; i < kNumThreads; ++i) {
-    ::CloseHandle(pause_and_resume_threads[i]);
-  }
-}
-
-void SimpleRequestTest::SimpleDownloadFileCancellation(
-    const CString& filename, bool do_cancel) {
-  SimpleRequest simple_request;
-  PrepareRequest(kBigFileUrl, ProxyConfig(), &simple_request);
-  simple_request.set_filename(filename);
-
-  scoped_handle cancel_thread_handle;
-  if (do_cancel) {
-    reset(cancel_thread_handle, ::CreateThread(NULL,
-                                               0,
-                                               CancelRequestThreadProc,
-                                               &simple_request,
-                                               0, NULL));
-  }
-
-  HRESULT hr = simple_request.Send();
-  if (do_cancel) {
-    EXPECT_TRUE(hr == GOOPDATE_E_CANCELLED || SUCCEEDED(hr));
-    ::WaitForSingleObject(get(cancel_thread_handle), INFINITE);
-  } else {
-    EXPECT_HRESULT_SUCCEEDED(hr);
-  }
-}
-
-void SimpleRequestTest::SimpleGetHostNotFound(const CString& url,
-                                              const ProxyConfig& config) {
-  SimpleRequest simple_request;
-  PrepareRequest(url, config, &simple_request);
-
-  HRESULT hr = simple_request.Send();
-  int status_code = simple_request.GetHttpStatusCode();
-
-  if (config.auto_detect) {
-    // Either a direct connection or a proxy will be used in the case of
-    // proxy auto detect.
-    //
-    // When a proxy is detected, the proxy server can return some html content
-    // indicating an error has occured. The status codes will be different,
-    // depending on how each proxy is configured. This may be a flaky unit test.
-    if (FAILED(hr)) {
-      EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_WINHTTP_NAME_NOT_RESOLVED), hr);
-    } else {
-      if (String_StartsWith(url, kHttpsProtoScheme, true)) {
-        EXPECT_EQ(HTTP_STATUS_NOT_FOUND, status_code);
-      } else {
-        EXPECT_EQ(HTTP_STATUS_SERVICE_UNAVAIL, status_code);
-      }
-    }
-  } else {
-    EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_WINHTTP_NAME_NOT_RESOLVED), hr);
-    EXPECT_EQ(0, status_code);
-  }
-}
-
-void SimpleRequestTest::SimpleGetFileNotFound(const CString& url,
-                                              const ProxyConfig& config) {
-  SimpleRequest simple_request;
-  PrepareRequest(url, config, &simple_request);
-  EXPECT_HRESULT_SUCCEEDED(simple_request.Send());
-  EXPECT_EQ(HTTP_STATUS_NOT_FOUND, simple_request.GetHttpStatusCode());
-}
-
-void SimpleRequestTest::SimpleGetRedirect(const CString& url,
-                                          const ProxyConfig& config) {
-  SimpleRequest simple_request;
-  PrepareRequest(url, config, &simple_request);
-  EXPECT_HRESULT_SUCCEEDED(simple_request.Send());
-
-  int http_status = simple_request.GetHttpStatusCode();
-  EXPECT_TRUE(http_status == HTTP_STATUS_OK ||
-              http_status == HTTP_STATUS_PARTIAL_CONTENT);
-}
-
-//
-// http tests.
-//
-// http get, direct connection.
-TEST_F(SimpleRequestTest, HttpGetDirect) {
-  if (IsTestRunByLocalSystem()) {
-    return;
-  }
-
-  SimpleGet(_T("http://www.google.com/robots.txt"), ProxyConfig());
-}
-
-// http get, direct connection, download to file
-TEST_F(SimpleRequestTest, HttpDownloadDirect) {
-  if (IsTestRunByLocalSystem()) {
-    return;
-  }
-
-  CString temp_file;
-  EXPECT_TRUE(::GetTempFileName(app_util::GetModuleDirectory(NULL),
-                                _T("SRT"),
-                                0,
-                                CStrBuf(temp_file, MAX_PATH)));
-  ScopeGuard guard = MakeGuard(::DeleteFile, temp_file);
-
-  SimpleDownloadFile(
-      _T("http://dl.google.com/update2/UpdateData.bin"),
-      temp_file, ProxyConfig());
-}
-
-// http get, direct connection, download to file, pause/resume
-// Download same file twice with and without pause/resume. The downloaded
-// files should be same.
-TEST_F(SimpleRequestTest, HttpDownloadDirectPauseAndResume) {
-  if (!ShouldRunLargeTest()) {
-    return;
-  }
-
-  // Download the same URL with and without pause/resume.
-  CString temp_file1;
-  EXPECT_TRUE(::GetTempFileName(app_util::GetModuleDirectory(NULL),
-                                _T("SRT"),
-                                0,
-                                CStrBuf(temp_file1, MAX_PATH)));
-  ScopeGuard guard = MakeGuard(::DeleteFile, temp_file1);
-
-  SimpleDownloadFilePauseAndResume(kBigFileUrl, temp_file1, ProxyConfig());
-
-  CString temp_file2;
-  EXPECT_TRUE(::GetTempFileName(app_util::GetModuleDirectory(NULL),
-                                _T("SRT"),
-                                0,
-                                CStrBuf(temp_file2, MAX_PATH)));
-  ScopeGuard guard2 = MakeGuard(::DeleteFile, temp_file2);
-
-  SimpleDownloadFile(kBigFileUrl, temp_file2, ProxyConfig());
-
-  // Compares that the downloaded files are equal
-  scoped_hfile file_handle1(::CreateFile(temp_file1, GENERIC_READ,
-      FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL));
-  EXPECT_NE(get(file_handle1), INVALID_HANDLE_VALUE);
-
-  scoped_hfile file_handle2(::CreateFile(temp_file2, GENERIC_READ,
-      FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL));
-
-  // Compare file size
-  DWORD file_size = GetFileSize(get(file_handle1), NULL);
-  EXPECT_EQ(file_size, GetFileSize(get(file_handle2), NULL));
-
-  // Compare file contents
-  const int kBufferLength = 1024;
-  BYTE buffer1[kBufferLength] = {0};
-  BYTE buffer2[kBufferLength] = {0};
-
-  for (int i = static_cast<int>(file_size); i > 0; i -= kBufferLength) {
-    int bytes_to_read = std::min(kBufferLength, i);
-    DWORD num_bytes_got = 0;
-
-    EXPECT_TRUE(ReadFile(get(file_handle1), buffer1,
-                         bytes_to_read, &num_bytes_got, NULL));
-    EXPECT_EQ(num_bytes_got, static_cast<DWORD>(bytes_to_read));
-    EXPECT_TRUE(ReadFile(get(file_handle2), buffer2,
-                         bytes_to_read, &num_bytes_got, NULL));
-    EXPECT_EQ(num_bytes_got, static_cast<DWORD>(bytes_to_read));
-    EXPECT_EQ(memcmp(buffer1, buffer2, bytes_to_read), 0);
-  }
-
-  // Make sure that file handles are closed first so that the delete guards
-  // can delete the temp files.
-  reset(file_handle1);
-  reset(file_handle2);
-}
-
-// http get, direct connection, negative test.
-TEST_F(SimpleRequestTest, HttpGetDirectHostNotFound) {
-  if (IsTestRunByLocalSystem()) {
-    return;
-  }
-
-  SimpleGetHostNotFound(_T("http://no_such_host.google.com/"), ProxyConfig());
-}
-
-// http get, direct connection, negative test.
-TEST_F(SimpleRequestTest, HttpGetDirectFileNotFound) {
-  if (IsTestRunByLocalSystem()) {
-    return;
-  }
-
-  SimpleGetFileNotFound(_T("http://tools.google.com/no_such_file"),
-                        ProxyConfig());
-}
-
-// http get, proxy wpad.
-TEST_F(SimpleRequestTest, HttpGetProxy) {
-  ProxyConfig config;
-  config.auto_detect = true;
-  SimpleGet(_T("http://www.google.com/robots.txt"), config);
-}
-
-// http get, proxy wpad, negative test.
-TEST_F(SimpleRequestTest, HttpGetProxyHostNotFound) {
-  ProxyConfig config;
-  config.auto_detect = true;
-  SimpleGetHostNotFound(_T("http://no_such_host.google.com/"), config);
-}
-
-// http get, proxy wpad.
-TEST_F(SimpleRequestTest, HttpGetProxyFileNotFound) {
-  ProxyConfig config;
-  config.auto_detect = true;
-  SimpleGetFileNotFound(_T("http://tools.google.com/no_such_file"), config);
-}
-
-
-//
-// https tests.
-//
-// https get, direct.
-TEST_F(SimpleRequestTest, HttpsGetDirect) {
-  if (IsTestRunByLocalSystem()) {
-    return;
-  }
-
-  SimpleGet(_T("https://www.google.com/robots.txt"), ProxyConfig());
-}
-
-// https get, direct, negative test.
-TEST_F(SimpleRequestTest, HttpsGetDirectHostNotFound) {
-  SimpleGetHostNotFound(_T("https://no_such_host.google.com/"), ProxyConfig());
-}
-
-// https get, direct connection, negative test.
-TEST_F(SimpleRequestTest, HttpsGetDirectFileNotFound) {
-  if (IsTestRunByLocalSystem()) {
-    return;
-  }
-
-  SimpleGetFileNotFound(_T("https://tools.google.com/no_such_file"),
-                        ProxyConfig());
-}
-
-// https get, proxy wpad.
-TEST_F(SimpleRequestTest, HttpsGetProxy) {
-  ProxyConfig config;
-  config.auto_detect = true;
-  SimpleGet(_T("https://www.google.com/robots.txt"), config);
-}
-
-// https get, proxy wpad, negative test.
-TEST_F(SimpleRequestTest, HttpsGetProxyHostNotFound) {
-  ProxyConfig config;
-  config.auto_detect = true;
-  SimpleGetHostNotFound(_T("https://no_such_host.google.com/"), config);
-}
-
-// https get, proxy wpad, negative test.
-TEST_F(SimpleRequestTest, HttpsGetProxyFileNotFound) {
-  ProxyConfig config;
-  config.auto_detect = true;
-  SimpleGetFileNotFound(_T("https://tools.google.com/no_such_file"), config);
-}
-
-// Should not be able to reuse the object once canceled, even if closed.
-TEST_F(SimpleRequestTest, Cancel_CannotReuse) {
-  SimpleRequest simple_request;
-  PrepareRequest(_T("http:\\foo\\"), ProxyConfig(), &simple_request);
-  EXPECT_HRESULT_SUCCEEDED(simple_request.Cancel());
-  EXPECT_EQ(GOOPDATE_E_CANCELLED, simple_request.Send());
-  EXPECT_HRESULT_SUCCEEDED(simple_request.Close());
-  EXPECT_EQ(GOOPDATE_E_CANCELLED, simple_request.Send());
-}
-
-TEST_F(SimpleRequestTest, Cancel_ShouldDeleteTempFile) {
-  CString temp_file;
-  EXPECT_TRUE(::GetTempFileName(app_util::GetModuleDirectory(NULL),
-                                _T("SRT"),
-                                0,
-                                CStrBuf(temp_file, MAX_PATH)));
-  ScopeGuard guard = MakeGuard(::DeleteFile, temp_file);
-
-  // Verify that cancellation should remove partially downloaded file.
-  bool do_cancel = true;
-  SimpleDownloadFileCancellation(temp_file, do_cancel);
-  EXPECT_EQ(INVALID_FILE_ATTRIBUTES, ::GetFileAttributes(temp_file));
-  EXPECT_EQ(ERROR_FILE_NOT_FOUND, ::GetLastError());
-
-  if (ShouldRunLargeTest()) {
-    // Verify that target file is preserved if download is not cancelled.
-    do_cancel = false;
-    SimpleDownloadFileCancellation(temp_file, do_cancel);
-    EXPECT_NE(INVALID_FILE_ATTRIBUTES, ::GetFileAttributes(temp_file));
-  }
-}
-
-// Http get request should follow redirects. The url below redirects to
-// https://tools.google.com/service/update2/oneclick and then it returns
-// 200 OK and some xml body.
-// TODO(omaha): Pick a new URL since this service is now obsolete and could
-// be removed at some point.
-TEST_F(SimpleRequestTest, HttpGet_Redirect) {
-  if (IsTestRunByLocalSystem()) {
-    return;
-  }
-
-  SimpleGetRedirect(_T("http://tools.google.com/service/update2/oneclick"),
-                    ProxyConfig());
-}
-
-}  // namespace omaha
-
diff --git a/net/urlmon_request.cc b/net/urlmon_request.cc
deleted file mode 100644
index 333f02f..0000000
--- a/net/urlmon_request.cc
+++ /dev/null
@@ -1,187 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/net/urlmon_request.h"
-#include <winhttp.h>
-#include <atlbase.h>
-#include <atlcom.h>
-#include <atlcomcli.h>
-#include <vector>
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/string.h"
-#include "omaha/base/utils.h"
-#include "omaha/net/http_client.h"
-#include "omaha/net/network_request.h"
-#include "omaha/net/network_config.h"
-
-namespace omaha {
-
-const DWORD response_headers_needed[] = {
-  WINHTTP_QUERY_CONTENT_TYPE,
-  WINHTTP_QUERY_ETAG,
-  WINHTTP_QUERY_SET_COOKIE,
-  WINHTTP_QUERY_FLAG_REQUEST_HEADERS | WINHTTP_QUERY_USER_AGENT,
-  WINHTTP_QUERY_RAW_HEADERS_CRLF,
-};
-
-UrlmonRequest::UrlmonRequest()
-    : request_buffer_(NULL),
-      request_buffer_length_(0),
-      proxy_auth_config_(NULL, CString()),
-      http_status_code_(0),
-      is_cancelled_(false) {
-  NET_LOG(L3, (_T("[UrlmonRequest::UrlmonRequest]")));
-  user_agent_.Format(_T("%s;urlmon"), NetworkConfig::GetUserAgent());
-}
-
-UrlmonRequest::~UrlmonRequest() {
-  Close();
-}
-
-HRESULT UrlmonRequest::Close() {
-  http_status_code_ = 0;
-  response_body_.clear();
-  raw_response_headers_.Empty();
-  response_headers_map_.clear();
-  return S_OK;
-}
-
-HRESULT UrlmonRequest::ProcessResponseHeaders(
-                            const CComVariant& headers,
-                            const CComSafeArray<DWORD>& headers_needed) {
-  if (headers.vt != (VT_ARRAY | VT_BSTR)) {
-    return E_FAIL;
-  }
-
-  CComSafeArray<BSTR> response_headers(headers.parray);
-  DWORD count = response_headers.GetCount();
-  if (count != headers_needed.GetCount()) {
-    return E_FAIL;
-  }
-
-  response_headers_map_.clear();
-  LONG lower_bound = response_headers.GetLowerBound();
-  LONG upper_bound = response_headers.GetUpperBound();
-  for (int i = lower_bound; i <= upper_bound; ++i) {
-    response_headers_map_.insert(std::make_pair(headers_needed[i],
-                                                response_headers[i]));
-    NET_LOG(L3, (_T("[ProcessResponseHeaders][%d][%s]"),
-                 i, response_headers[i]));
-  }
-  raw_response_headers_ = response_headers_map_[WINHTTP_QUERY_RAW_HEADERS_CRLF];
-  return S_OK;
-}
-
-HRESULT UrlmonRequest::ProcessResponseFile(const CComBSTR& cache_filename) {
-  if (!cache_filename.Length()) {
-    // Response with no body.
-    return S_OK;
-  }
-
-  if (!filename_.IsEmpty()) {
-    // The caller expects the response to be stored in the target file.
-    return File::Copy(cache_filename, filename_, true);
-  }
-
-  response_body_.clear();
-  HRESULT hr = ReadEntireFileShareMode(cache_filename,
-                                       0,
-                                       FILE_SHARE_READ,
-                                       &response_body_);
-  if (FAILED(hr) || response_body_.empty()) {
-    return hr;
-  }
-  return S_OK;
-}
-
-HRESULT UrlmonRequest::SendRequest(BSTR url,
-                                   BSTR post_data,
-                                   BSTR request_headers,
-                                   VARIANT response_headers_needed,
-                                   CComVariant* response_headers,
-                                   DWORD* response_code,
-                                   BSTR* cache_filename) {
-  HRESULT hr = bsc_.Send(url,
-                         post_data,
-                         request_headers,
-                         response_headers_needed,
-                         response_headers,
-                         response_code,
-                         cache_filename);
-
-  NET_LOG(L3, (_T("[UrlmonRequest::SendRequest][0x%x][%d][%s]"),
-               hr, *response_code, *cache_filename));
-  if (!*response_code) {
-    return FAILED(hr) ? hr : E_UNEXPECTED;
-  }
-
-  return S_OK;
-}
-
-HRESULT UrlmonRequest::Send() {
-  NET_LOG(L3, (_T("[UrlmonRequest::Send]")));
-  if (is_cancelled_) {
-    return GOOPDATE_E_CANCELLED;
-  }
-
-  ASSERT1(url_.Length() > 0);
-  CComBSTR headers_to_send(additional_headers_);
-  CComBSTR post_data;
-  if (request_buffer_) {
-    post_data.AppendBytes(static_cast<const char*>(request_buffer_),
-                          request_buffer_length_);
-  }
-  CComSafeArray<DWORD> headers_needed(arraysize(response_headers_needed));
-  for (size_t i = 0; i < arraysize(response_headers_needed); ++i) {
-    headers_needed.SetAt(i, response_headers_needed[i]);
-  }
-  CComVariant response_headers;
-  CComBSTR cache_filename;
-
-  HRESULT hr = SendRequest(url_,
-                           post_data,
-                           headers_to_send,
-                           CComVariant(headers_needed),
-                           &response_headers,
-                           &http_status_code_,
-                           &cache_filename);
-  if (FAILED(hr)) {
-    NET_LOG(LW, (_T("[UrlmonRequest::Send][0x%08x]"), hr));
-    return hr;
-  }
-
-  VERIFY1(SUCCEEDED(ProcessResponseHeaders(response_headers, headers_needed)));
-  VERIFY1(SUCCEEDED(ProcessResponseFile(cache_filename)));
-  return S_OK;
-}
-
-HRESULT UrlmonRequest::Cancel() {
-  NET_LOG(L2, (_T("[UrlmonRequest::Cancel]")));
-  ::InterlockedExchange(&is_cancelled_, true);
-  return bsc_.Cancel();
-}
-
-HRESULT UrlmonRequest::Pause() {
-  return E_NOTIMPL;
-}
-
-HRESULT UrlmonRequest::Resume() {
-  return E_NOTIMPL;
-}
-
-}  // namespace omaha
-
diff --git a/net/urlmon_request.h b/net/urlmon_request.h
deleted file mode 100644
index 2f84ac8..0000000
--- a/net/urlmon_request.h
+++ /dev/null
@@ -1,167 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// UrlmonRequest sends http transactions through urlmon.dll
-
-#ifndef OMAHA_NET_URLMON_REQUEST_H__
-#define OMAHA_NET_URLMON_REQUEST_H__
-
-#include <windows.h>
-#include <atlstr.h>
-#include <atlsafe.h>
-#include <map>
-#include <vector>
-#include "base/basictypes.h"
-#include "omaha/base/debug.h"
-#include "omaha/net/bind_status_callback.h"
-#include "omaha/net/http_request.h"
-
-namespace omaha {
-
-class UrlmonRequest : public HttpRequestInterface {
- public:
-  UrlmonRequest();
-  virtual ~UrlmonRequest();
-
-  // HttpRequestInterface methods.
-  virtual HRESULT Close();
-
-  virtual HRESULT Send();
-
-  virtual HRESULT Cancel();
-
-  virtual HRESULT Pause();
-
-  virtual HRESULT Resume();
-
-  virtual std::vector<uint8> GetResponse() const {
-    return response_body_;
-  }
-
-  virtual int GetHttpStatusCode() const {
-    return http_status_code_;
-  }
-
-  virtual HRESULT QueryHeadersString(uint32 info_level,
-                                     const TCHAR* name,
-                                     CString* value) const {
-    // TODO(Omaha) - support for a custom name string.
-    name;
-
-    ASSERT1(value);
-    value->Empty();
-    std::map<DWORD, CString>::const_iterator cur =
-        response_headers_map_.find(info_level);
-    if (cur != response_headers_map_.end()) {
-      *value = cur->second;
-    }
-    return !value->IsEmpty() ? S_OK : E_FAIL;
-  }
-
-  virtual CString GetResponseHeaders() const {
-    return raw_response_headers_;
-  }
-
-  virtual CString ToString() const { return _T("urlmon"); }
-
-  // No effect for this class.
-  virtual void set_session_handle(HINTERNET) {}
-
-  virtual void set_url(const CString& url) { url_ = url; }
-
-  virtual void set_request_buffer(const void* buffer, size_t buffer_length) {
-    request_buffer_ = buffer;
-    request_buffer_length_ = buffer_length;
-  }
-
-  virtual void set_proxy_configuration(const ProxyConfig& proxy_config) {
-    proxy_config_ = proxy_config;
-  }
-
-  virtual void set_network_configuration(const ProxyConfig& network_config) {
-    UNREFERENCED_PARAMETER(network_config);
-  }
-
-  // Sets the filename to receive the response instead of the memory buffer.
-  virtual void set_filename(const CString& filename) { filename_ = filename; }
-
-  virtual void set_low_priority(bool low_priority) {
-    UNREFERENCED_PARAMETER(low_priority);
-  }
-
-  virtual void set_callback(NetworkRequestCallback* callback) {
-    // TODO(Omaha) - Provide events.
-    UNREFERENCED_PARAMETER(callback);
-  }
-
-  virtual void set_additional_headers(const CString& additional_headers) {
-    additional_headers_ = additional_headers;
-  }
-
-  // This request always uses the specified protocol so it is fine to ignore
-  // this attribute.
-  virtual void set_preserve_protocol(bool preserve_protocol) {
-    UNREFERENCED_PARAMETER(preserve_protocol);
-  }
-
-  virtual CString user_agent() const { return user_agent_; }
-
-  virtual void set_user_agent(const CString& user_agent) {
-    user_agent_ = user_agent;
-  }
-
-  virtual void set_proxy_auth_config(const ProxyAuthConfig& proxy_auth_config) {
-    proxy_auth_config_ = proxy_auth_config;
-  }
-
-  virtual HRESULT SendRequest(BSTR url,
-                              BSTR post_data,
-                              BSTR request_headers,
-                              VARIANT response_headers_needed,
-                              CComVariant* response_headers,
-                              DWORD* response_code,
-                              BSTR* cache_filename);
-
- protected:
-  CString user_agent_;
-  ProxyAuthConfig proxy_auth_config_;
-  ProxyConfig proxy_config_;
-
- private:
-  HRESULT ProcessResponseHeaders(const CComVariant& headers,
-                                 const CComSafeArray<DWORD>& headers_needed);
-  HRESULT ProcessResponseFile(const CComBSTR& cache_filename);
-  bool CreateBrowserHttpRequest();
-
-  CComObjectStackEx<BindStatusCallback> bsc_;
-  CComBSTR url_;
-  CString filename_;
-  const void* request_buffer_;          // Contains the request body for POST.
-  size_t      request_buffer_length_;   // Length of the request body.
-  CString additional_headers_;
-
-  volatile LONG is_cancelled_;
-  DWORD http_status_code_;
-  std::vector<uint8> response_body_;
-  std::map<DWORD, CString> response_headers_map_;
-  CString raw_response_headers_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(UrlmonRequest);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_NET_URLMON_REQUEST_H__
-
diff --git a/net/winhttp.cc b/net/winhttp.cc
deleted file mode 100644
index cc361d5..0000000
--- a/net/winhttp.cc
+++ /dev/null
@@ -1,566 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Internet-access utility functions via winhttp
-
-#include "omaha/net/winhttp.h"
-#include <vector>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/string.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/utils.h"
-#include "omaha/net/winhttp_vtable.h"
-
-namespace omaha {
-
-class WinHttp : public HttpClient {
- public:
-  static HttpClient* Create() { return new WinHttp; }
-
-  virtual HRESULT Initialize();
-  virtual HRESULT AddRequestHeaders(HINTERNET request,
-                                    const TCHAR* headers,
-                                    int length,
-                                    uint32 modifiers);
-  virtual HRESULT CheckPlatform();
-  virtual HRESULT Close(HINTERNET handle);
-  virtual HRESULT Connect(HINTERNET session_handle,
-                          const TCHAR* server,
-                          int port,
-                          HINTERNET* connection_handle);
-  virtual HRESULT CrackUrl(const TCHAR* url,
-                           uint32 flags,
-                           CString* scheme,
-                           CString* server,
-                           int* port,
-                           CString* url_path,
-                           CString* extra_info);
-  virtual HRESULT CreateUrl(const TCHAR* scheme,
-                            const TCHAR* server,
-                            int port,
-                            const TCHAR* url_path,
-                            const TCHAR* extra_info,
-                            uint32 flags,
-                            CString* url);
-  virtual HRESULT DetectAutoProxyConfigUrl(uint32 flags,
-                                           CString* auto_config_url);
-  virtual HRESULT GetDefaultProxyConfiguration(ProxyInfo* proxy_info);
-  virtual HRESULT GetIEProxyConfiguration(
-                      CurrentUserIEProxyConfig* proxy_info);
-  virtual HRESULT GetProxyForUrl(HINTERNET session_handle,
-                                 const TCHAR* url,
-                                 const AutoProxyOptions* auto_proxy_options,
-                                 ProxyInfo* proxy_info);
-  virtual HRESULT Open(const TCHAR* user_agent,
-                       uint32 access_type,
-                       const TCHAR* proxy_name,
-                       const TCHAR* proxy_bypass,
-                       DWORD flags,
-                       HINTERNET* session_handle);
-  virtual HRESULT OpenRequest(HINTERNET connection_handle,
-                              const TCHAR* verb,
-                              const TCHAR* uri,
-                              const TCHAR* version,
-                              const TCHAR* referrer,
-                              const TCHAR** accept_types,
-                              uint32 flags,
-                              HINTERNET* request_handle);
-  virtual HRESULT QueryAuthSchemes(HINTERNET request_handle,
-                                   uint32* supported_schemes,
-                                   uint32* first_scheme,
-                                   uint32* auth_target);
-  virtual HRESULT QueryDataAvailable(HINTERNET request_handle,
-                                     DWORD* num_bytes);
-  virtual HRESULT QueryHeaders(HINTERNET request_handle,
-                               uint32 info_level,
-                               const TCHAR* name,
-                               void* buffer,
-                               DWORD* buffer_length,
-                               DWORD* index);
-  virtual HRESULT QueryOption(HINTERNET handle,
-                              uint32 option,
-                              void* buffer,
-                              DWORD* buffer_length);
-  virtual HRESULT ReadData(HINTERNET request_handle,
-                           void* buffer,
-                           DWORD buffer_length,
-                           DWORD* bytes_read);
-  virtual HRESULT ReceiveResponse(HINTERNET request_handle);
-  virtual HRESULT SendRequest(HINTERNET request_handle,
-                              const TCHAR* headers,
-                              DWORD headers_length,
-                              const void* optional_data,
-                              DWORD optional_data_length,
-                              DWORD content_length,
-                              DWORD_PTR context);
-  virtual HRESULT SetCredentials(HINTERNET request_handle,
-                                 uint32 auth_targets,
-                                 uint32 auth_scheme,
-                                 const TCHAR* user_name,
-                                 const TCHAR* password);
-  virtual HRESULT SetDefaultProxyConfiguration(const ProxyInfo& proxy_info);
-  virtual HRESULT SetOption(HINTERNET handle,
-                            uint32 option,
-                            const void* buffer,
-                            DWORD buffer_length);
-  virtual StatusCallback SetStatusCallback(HINTERNET handle,
-                                           StatusCallback callback,
-                                           uint32 flags);
-  virtual HRESULT SetTimeouts(HINTERNET handle,
-                              int resolve_timeout_ms,
-                              int connect_timeout_ms,
-                              int send_timeout_ms,
-                              int receive_timeout_ms);
-  virtual HRESULT WriteData(HINTERNET request_handle,
-                            const void* buffer,
-                            DWORD bytes_to_write,
-                            DWORD* bytes_written);
-
- private:
-  WinHttp();
-
-  bool is_initialized_;
-
-  static WinHttpVTable winhttp_;
-  static LLock lock_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(WinHttp);
-};
-
-WinHttpVTable WinHttp::winhttp_;
-LLock         WinHttp::lock_;
-
-// TODO(omaha): remove after the implementation is complete.
-// 4100: unreferenced formal parameter
-#pragma warning(disable : 4100)
-
-WinHttp::WinHttp() : is_initialized_(false) {
-}
-
-HRESULT WinHttp::Initialize() {
-  __mutexScope(WinHttp::lock_);
-  if (is_initialized_) {
-    return S_OK;
-  }
-  if (!winhttp_.Load()) {
-    HRESULT hr = HRESULTFromLastError();
-    NET_LOG(LEVEL_ERROR, (_T("[failed to load winhttp][0x%08x]"), hr));
-    return hr;
-  }
-  is_initialized_ = true;
-  return S_OK;
-}
-
-HRESULT WinHttp::Open(const TCHAR* user_agent,
-                      uint32 access_type,
-                      const TCHAR* proxy_name,
-                      const TCHAR* proxy_bypass,
-                      DWORD flags,
-                      HINTERNET* session_handle) {
-  *session_handle = winhttp_.WinHttpOpen(user_agent,
-                                         access_type,
-                                         proxy_name,
-                                         proxy_bypass,
-                                         flags);
-  return *session_handle ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT WinHttp::Close(HINTERNET handle) {
-  ASSERT1(handle);
-  return winhttp_.WinHttpCloseHandle(handle) ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT WinHttp::Connect(HINTERNET session_handle,
-                         const TCHAR* server,
-                         int port,
-                         HINTERNET* connection_handle) {
-  ASSERT1(server);
-  ASSERT1(port <= INTERNET_MAX_PORT_NUMBER_VALUE);
-
-  *connection_handle = winhttp_.WinHttpConnect(session_handle,
-                                               server,
-                                               static_cast<INTERNET_PORT>(port),
-                                               0);
-  return *connection_handle ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT WinHttp::OpenRequest(HINTERNET connection_handle,
-                             const TCHAR* verb,
-                             const TCHAR* uri,
-                             const TCHAR* version,
-                             const TCHAR* referrer,
-                             const TCHAR** accept_types,
-                             uint32 flags,
-                             HINTERNET* request_handle) {
-  *request_handle = winhttp_.WinHttpOpenRequest(connection_handle,
-                                                verb,
-                                                uri,
-                                                version,
-                                                referrer,
-                                                accept_types,
-                                                flags);
-  return *request_handle ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT WinHttp::SendRequest(HINTERNET request_handle,
-                             const TCHAR* headers,
-                             DWORD headers_length,
-                             const void* optional_data,
-                             DWORD optional_data_length,
-                             DWORD content_length,
-                             DWORD_PTR context) {
-  bool res = !!winhttp_.WinHttpSendRequest(
-                            request_handle,
-                            headers,
-                            headers_length,
-                            const_cast<void*>(optional_data),
-                            optional_data_length,
-                            content_length,
-                            context);
-  return res ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT WinHttp::ReceiveResponse(HINTERNET request_handle) {
-  bool res = !!winhttp_.WinHttpReceiveResponse(request_handle, NULL);
-  return res ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT WinHttp::QueryDataAvailable(HINTERNET request_handle,
-                                    DWORD* num_bytes) {
-  bool res = !!winhttp_.WinHttpQueryDataAvailable(request_handle, num_bytes);
-  return res ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT WinHttp::SetTimeouts(HINTERNET handle,
-                             int resolve_timeout_ms,
-                             int connect_timeout_ms,
-                             int send_timeout_ms,
-                             int receive_timeout_ms) {
-  bool res = !!winhttp_.WinHttpSetTimeouts(handle,
-                                           resolve_timeout_ms,
-                                           connect_timeout_ms,
-                                           send_timeout_ms,
-                                           receive_timeout_ms);
-  return res ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT WinHttp::ReadData(HINTERNET request_handle,
-                          void* buffer,
-                          DWORD buffer_length,
-                          DWORD* bytes_read) {
-  ASSERT1(buffer);
-
-  bool res = !!winhttp_.WinHttpReadData(request_handle,
-                                        buffer,
-                                        buffer_length,
-                                        bytes_read);
-  return res ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT WinHttp::WriteData(HINTERNET request_handle,
-                           const void* buffer,
-                           DWORD bytes_to_write,
-                           DWORD* bytes_written) {
-  ASSERT1(buffer);
-
-  bool res = !!winhttp_.WinHttpWriteData(request_handle,
-                                         buffer,
-                                         bytes_to_write,
-                                         bytes_written);
-  return res ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT WinHttp::SetCredentials(HINTERNET request_handle,
-                                uint32 auth_targets,
-                                uint32 auth_scheme,
-                                const TCHAR* user_name,
-                                const TCHAR* password) {
-  bool res = !!winhttp_.WinHttpSetCredentials(request_handle,
-                                              auth_targets,
-                                              auth_scheme,
-                                              user_name,
-                                              password,
-                                              NULL);
-  return res ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT WinHttp::DetectAutoProxyConfigUrl(uint32 flags,
-                                          CString* auto_config_url) {
-  ASSERT1(auto_config_url);
-  TCHAR* url = NULL;
-  bool res = !!winhttp_.WinHttpDetectAutoProxyConfigUrl(flags, &url);
-  *auto_config_url = url;
-  HRESULT hr = res ? S_OK : HRESULTFromLastError();
-  if (url) {
-    VERIFY1(!::GlobalFree(url));
-  }
-  return hr;
-}
-
-HRESULT WinHttp::GetDefaultProxyConfiguration(ProxyInfo* proxy_info) {
-  ASSERT1(proxy_info);
-
-  WINHTTP_PROXY_INFO pi = {0};
-  bool res = !!winhttp_.WinHttpGetDefaultProxyConfiguration(&pi);
-
-  proxy_info->access_type  = pi.dwAccessType;
-  proxy_info->proxy        = pi.lpszProxy;
-  proxy_info->proxy_bypass = pi.lpszProxyBypass;
-
-  return res ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT WinHttp::SetDefaultProxyConfiguration(const ProxyInfo& proxy_info) {
-  WINHTTP_PROXY_INFO pi = {0};
-  pi.dwAccessType    = proxy_info.access_type;
-  pi.lpszProxy       = const_cast<TCHAR*>(proxy_info.proxy);
-  pi.lpszProxyBypass = const_cast<TCHAR*>(proxy_info.proxy_bypass);
-
-  bool res = !!winhttp_.WinHttpSetDefaultProxyConfiguration(&pi);
-  return res ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT WinHttp::GetIEProxyConfiguration(CurrentUserIEProxyConfig* proxy_info) {
-  ASSERT1(proxy_info);
-
-  WINHTTP_CURRENT_USER_IE_PROXY_CONFIG pi = {0};
-  bool res = !!winhttp_.WinHttpGetIEProxyConfigForCurrentUser(&pi);
-
-  proxy_info->auto_detect     = !!pi.fAutoDetect;
-  proxy_info->auto_config_url = pi.lpszAutoConfigUrl;
-  proxy_info->proxy           = pi.lpszProxy;
-  proxy_info->proxy_bypass    = pi.lpszProxyBypass;
-
-  return res ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT WinHttp::GetProxyForUrl(HINTERNET session_handle,
-                                const TCHAR* url,
-                                const AutoProxyOptions* auto_proxy_options,
-                                ProxyInfo* proxy_info) {
-  ASSERT1(auto_proxy_options);
-  ASSERT1(proxy_info);
-
-  WINHTTP_AUTOPROXY_OPTIONS apo = {0};
-  apo.dwFlags                = auto_proxy_options->flags;
-  apo.dwAutoDetectFlags      = auto_proxy_options->auto_detect_flags;
-  apo.lpszAutoConfigUrl      = auto_proxy_options->auto_config_url;
-  apo.lpvReserved            = NULL;
-  apo.dwReserved             = 0;
-  apo.fAutoLogonIfChallenged = auto_proxy_options->auto_logon_if_challenged;
-
-  WINHTTP_PROXY_INFO pi = {0};
-
-  ASSERT1(session_handle);
-  bool res = !!winhttp_.WinHttpGetProxyForUrl(session_handle, url, &apo, &pi);
-
-  proxy_info->access_type  = pi.dwAccessType;
-  proxy_info->proxy        = pi.lpszProxy;
-  proxy_info->proxy_bypass = pi.lpszProxyBypass;
-
-  return res ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT WinHttp::QueryAuthSchemes(HINTERNET request_handle,
-                                  uint32* supported_schemes,
-                                  uint32* first_scheme,
-                                  uint32* auth_target) {
-  ASSERT1(supported_schemes);
-  ASSERT1(first_scheme);
-  ASSERT1(auth_target);
-
-  DWORD ss = 0;
-  DWORD fs = 0;
-  DWORD at = 0;
-
-  ASSERT1(request_handle);
-  bool res = !!winhttp_.WinHttpQueryAuthSchemes(request_handle, &ss, &fs, &at);
-
-  *supported_schemes = ss;
-  *first_scheme      = fs;
-  *auth_target       = at;
-
-  return res ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT WinHttp::AddRequestHeaders(HINTERNET request_handle,
-                                   const TCHAR* headers,
-                                   int length,
-                                   uint32 modifiers) {
-  ASSERT1(headers);
-  bool res = !!winhttp_.WinHttpAddRequestHeaders(request_handle,
-                                                 headers,
-                                                 length,
-                                                 modifiers);
-  return res ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT WinHttp::CrackUrl(const TCHAR* url,
-                          uint32 flags,
-                          CString* scheme,
-                          CString* server,
-                          int* port,
-                          CString* url_path,
-                          CString* extra_info) {
-  ASSERT1(url);
-  size_t url_length = _tcslen(url);
-  URL_COMPONENTS url_comp = {0};
-  url_comp.dwStructSize   = sizeof(url_comp);
-  if (scheme) {
-    url_comp.lpszScheme     = scheme->GetBuffer(INTERNET_MAX_SCHEME_LENGTH);
-    url_comp.dwSchemeLength = INTERNET_MAX_SCHEME_LENGTH;
-  }
-  if (server) {
-    url_comp.lpszHostName    = server->GetBuffer(INTERNET_MAX_HOST_NAME_LENGTH);
-    url_comp.dwHostNameLength = INTERNET_MAX_HOST_NAME_LENGTH;
-  }
-  if (url_path) {
-    url_comp.lpszUrlPath     = url_path->GetBuffer(INTERNET_MAX_PATH_LENGTH);
-    url_comp.dwUrlPathLength = INTERNET_MAX_PATH_LENGTH;
-  }
-  if (extra_info) {
-    // There is no constant for the extra info max length.
-    url_comp.lpszExtraInfo    = extra_info->GetBuffer(INTERNET_MAX_PATH_LENGTH);
-    url_comp.dwExtraInfoLength = INTERNET_MAX_PATH_LENGTH;
-  }
-  bool res = !!winhttp_.WinHttpCrackUrl(url, url_length, flags, &url_comp);
-  if (scheme) {
-    scheme->ReleaseBuffer(url_comp.dwSchemeLength);
-  }
-  if (server) {
-    server->ReleaseBuffer(url_comp.dwHostNameLength);
-  }
-  if (port) {
-    *port = url_comp.nPort;
-  }
-  if (url_path) {
-    url_path->ReleaseBuffer(url_comp.dwUrlPathLength);
-  }
-  if (extra_info) {
-    extra_info->ReleaseBuffer(url_comp.dwExtraInfoLength);
-  }
-  return res ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT WinHttp::CreateUrl(const TCHAR* scheme,
-                           const TCHAR* server,
-                           int port,
-                           const TCHAR* url_path,
-                           const TCHAR* extra_info,
-                           uint32 flags,
-                           CString* url) {
-  ASSERT1(url);
-  ASSERT1(port <= INTERNET_MAX_PORT_NUMBER_VALUE);
-
-  URL_COMPONENTS url_comp = {0};
-  url_comp.dwStructSize   = sizeof(url_comp);
-  if (scheme) {
-    url_comp.lpszScheme        = const_cast<TCHAR*>(scheme);
-    url_comp.dwSchemeLength    = _tcslen(scheme);
-  }
-  if (server) {
-    url_comp.lpszHostName      = const_cast<TCHAR*>(server);
-    url_comp.dwHostNameLength  = _tcslen(server);
-  }
-  if (port) {
-    url_comp.nPort             = static_cast<INTERNET_PORT>(port);
-  }
-  if (url_path) {
-    url_comp.lpszUrlPath       = const_cast<TCHAR*>(url_path);
-    url_comp.dwUrlPathLength   = _tcslen(url_path);
-  }
-  if (extra_info) {
-    url_comp.lpszExtraInfo     = const_cast<TCHAR*>(extra_info);
-    url_comp.dwExtraInfoLength = _tcslen(extra_info);
-  }
-
-  DWORD url_length = 0;
-  bool res = !!winhttp_.WinHttpCreateUrl(
-                            &url_comp,
-                            flags,
-                            url->GetBuffer(INTERNET_MAX_URL_LENGTH),
-                            &url_length);
-  if (!res) {
-    return HRESULTFromLastError();
-  }
-  ASSERT1(url_length);
-  url->ReleaseBuffer(url_length);
-  return S_OK;
-}
-
-HttpClient::StatusCallback WinHttp::SetStatusCallback(HINTERNET handle,
-                                                      StatusCallback callback,
-                                                      uint32 flags) {
-  WINHTTP_STATUS_CALLBACK winhttp_status_callback =
-      winhttp_.WinHttpSetStatusCallback(
-          handle,
-          reinterpret_cast<WINHTTP_STATUS_CALLBACK>(callback),
-          flags,
-          NULL);
-  return reinterpret_cast<HttpClient::StatusCallback>(winhttp_status_callback);
-}
-
-HRESULT WinHttp::CheckPlatform() {
-  return !!winhttp_.WinHttpCheckPlatform() ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT WinHttp::QueryHeaders(HINTERNET request_handle,
-                              uint32 info_level,
-                              const TCHAR* name,
-                              void* buffer,
-                              DWORD* buffer_length,
-                              DWORD* index) {
-  ASSERT1(buffer_length);
-  bool res = !!winhttp_.WinHttpQueryHeaders(request_handle,
-                                            info_level,
-                                            name,
-                                            buffer,
-                                            buffer_length,
-                                            index);
-  return res ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT WinHttp::QueryOption(HINTERNET handle,
-                             uint32 option,
-                             void* buffer,
-                             DWORD* buffer_length) {
-  ASSERT1(buffer_length);
-  bool res = !!winhttp_.WinHttpQueryOption(handle, option,
-                                           buffer, buffer_length);
-  return res ? S_OK : HRESULTFromLastError();
-}
-
-HRESULT WinHttp::SetOption(HINTERNET handle,
-                           uint32 option,
-                           const void* buffer,
-                           DWORD buffer_length) {
-  ASSERT1(buffer);
-  ASSERT1(buffer_length);
-  bool res = !!winhttp_.WinHttpSetOption(handle,
-                                         option,
-                                         const_cast<void*>(buffer),
-                                         buffer_length);
-  return res ? S_OK : HRESULTFromLastError();
-}
-
-extern "C" const bool kRegisterWinHttp =
-    HttpClient::GetFactory().Register(HttpClient::WINHTTP, &WinHttp::Create);
-
-}  // namespace omaha
-
diff --git a/net/winhttp.h b/net/winhttp.h
deleted file mode 100644
index f961ed4..0000000
--- a/net/winhttp.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_NET_WINHTTP_H_
-#define OMAHA_NET_WINHTTP_H_
-
-#include "omaha/net/http_client.h"
-
-#endif  // OMAHA_NET_WINHTTP_H_
diff --git a/net/winhttp_adapter.cc b/net/winhttp_adapter.cc
deleted file mode 100644
index 512382e..0000000
--- a/net/winhttp_adapter.cc
+++ /dev/null
@@ -1,492 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/net/winhttp_adapter.h"
-#include <memory>
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-
-namespace omaha {
-
-WinHttpAdapter::WinHttpAdapter()
-    : connection_handle_(NULL),
-      request_handle_(NULL),
-      async_call_type_(0),
-      async_call_is_error_(0),
-      async_bytes_available_(0),
-      async_bytes_read_(0) {
-  memset(&async_call_result_, 0, sizeof(async_call_result_));
-}
-
-HRESULT WinHttpAdapter::Initialize() {
-  __mutexScope(lock_);
-
-  http_client_.reset(CreateHttpClient());
-
-  HRESULT hr = http_client_->Initialize();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  reset(async_completion_event_, ::CreateEvent(NULL, true, false, NULL));
-
-  return async_completion_event_ ? S_OK : HRESULTFromLastError();
-}
-
-void WinHttpAdapter::CloseHandles() {
-  __mutexScope(lock_);
-
-  if (request_handle_) {
-    VERIFY1(SUCCEEDED(http_client_->Close(request_handle_)));
-    request_handle_ = NULL;
-  }
-  if (connection_handle_) {
-    VERIFY1(SUCCEEDED(http_client_->Close(connection_handle_)));
-    connection_handle_ = NULL;
-  }
-}
-
-HRESULT WinHttpAdapter::Connect(HINTERNET session_handle,
-                                const TCHAR* server,
-                                int port) {
-  __mutexScope(lock_);
-
-  HRESULT hr = http_client_->Connect(session_handle,
-                                     server,
-                                     port,
-                                     &connection_handle_);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  HttpClient::StatusCallback old_callback =
-      http_client_->SetStatusCallback(connection_handle_,
-                                      &WinHttpAdapter::WinHttpStatusCallback,
-                                      WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS);
-  ASSERT1(old_callback == NULL || old_callback == kInvalidStatusCallback);
-
-  return http_client_->SetOptionInt(connection_handle_,
-                                    WINHTTP_OPTION_CONTEXT_VALUE,
-                                    reinterpret_cast<int>(this));
-}
-
-HRESULT WinHttpAdapter::OpenRequest(const TCHAR* verb,
-                                    const TCHAR* uri,
-                                    const TCHAR* version,
-                                    const TCHAR* referrer,
-                                    const TCHAR** accept_types,
-                                    uint32 flags) {
-  __mutexScope(lock_);
-
-  return http_client_->OpenRequest(connection_handle_,
-                                   verb,
-                                   uri,
-                                   version,
-                                   referrer,
-                                   accept_types,
-                                   flags,
-                                   &request_handle_);
-}
-
-HRESULT WinHttpAdapter::AddRequestHeaders(const TCHAR* headers,
-                                          int length,
-                                          uint32 modifiers) {
-  __mutexScope(lock_);
-
-  return http_client_->AddRequestHeaders(request_handle_,
-                                         headers,
-                                         length,
-                                         modifiers);
-}
-
-HRESULT WinHttpAdapter::QueryAuthSchemes(uint32* supported_schemes,
-                                         uint32* first_scheme,
-                                         uint32* auth_target) {
-  __mutexScope(lock_);
-
-  return http_client_->QueryAuthSchemes(request_handle_,
-                                        supported_schemes,
-                                        first_scheme,
-                                        auth_target);
-}
-
-HRESULT WinHttpAdapter::QueryRequestHeadersInt(uint32 info_level,
-                                               const TCHAR* name,
-                                               int* value,
-                                               DWORD* index) {
-  __mutexScope(lock_);
-
-  return http_client_->QueryHeadersInt(request_handle_,
-                                       info_level,
-                                       name,
-                                       value,
-                                       index);
-}
-
-HRESULT WinHttpAdapter::QueryRequestHeadersString(uint32 info_level,
-                                                  const TCHAR* name,
-                                                  CString* value,
-                                                  DWORD* index) {
-  __mutexScope(lock_);
-
-  return http_client_->QueryHeadersString(request_handle_,
-                                          info_level,
-                                          name,
-                                          value,
-                                          index);
-}
-
-HRESULT WinHttpAdapter::SetCredentials(uint32 auth_targets,
-                                       uint32 auth_scheme,
-                                       const TCHAR* user_name,
-                                       const TCHAR* password) {
-  __mutexScope(lock_);
-
-  return http_client_->SetCredentials(request_handle_,
-                                      auth_targets,
-                                      auth_scheme,
-                                      user_name,
-                                      password);
-}
-
-HRESULT WinHttpAdapter::SendRequest(const TCHAR* headers,
-                                    DWORD headers_length,
-                                    const void* optional_data,
-                                    DWORD optional_data_length,
-                                    DWORD content_length) {
-  __mutexScope(lock_);
-
-  HRESULT hr = AsyncCallBegin(API_SEND_REQUEST);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  const DWORD_PTR context = reinterpret_cast<DWORD_PTR>(this);
-  hr = http_client_->SendRequest(request_handle_,
-                                 headers,
-                                 headers_length,
-                                 optional_data,
-                                 optional_data_length,
-                                 content_length,
-                                 context);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return AsyncCallEnd(API_SEND_REQUEST);
-}
-
-HRESULT WinHttpAdapter::ReceiveResponse() {
-  __mutexScope(lock_);
-
-  HRESULT hr = AsyncCallBegin(API_RECEIVE_RESPONSE);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = http_client_->ReceiveResponse(request_handle_);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return AsyncCallEnd(API_RECEIVE_RESPONSE);
-}
-
-HRESULT WinHttpAdapter::QueryDataAvailable(DWORD* num_bytes) {
-  __mutexScope(lock_);
-
-  HRESULT hr = AsyncCallBegin(API_QUERY_DATA_AVAILABLE);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  async_bytes_available_ = 0;
-
-  hr = http_client_->QueryDataAvailable(request_handle_, NULL);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr =  AsyncCallEnd(API_QUERY_DATA_AVAILABLE);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  *num_bytes = async_bytes_available_;
-
-  return S_OK;
-}
-
-HRESULT WinHttpAdapter::ReadData(void* buffer,
-                                 DWORD buffer_length,
-                                 DWORD* bytes_read) {
-  __mutexScope(lock_);
-
-  HRESULT hr = AsyncCallBegin(API_READ_DATA);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  async_bytes_read_ = 0;
-
-  hr = http_client_->ReadData(request_handle_,
-                              buffer,
-                              buffer_length,
-                              NULL);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = AsyncCallEnd(API_READ_DATA);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  *bytes_read = async_bytes_read_;
-
-  return S_OK;
-}
-
-HRESULT WinHttpAdapter::SetRequestOptionInt(uint32 option, int value) {
-  __mutexScope(lock_);
-
-  return http_client_->SetOptionInt(request_handle_, option, value);
-}
-
-HRESULT WinHttpAdapter::SetRequestOption(uint32 option,
-                                         const void* buffer,
-                                         DWORD buffer_length) {
-  __mutexScope(lock_);
-
-  ASSERT1(buffer && buffer_length);
-
-  return http_client_->SetOption(request_handle_,
-                                 option,
-                                 buffer,
-                                 buffer_length);
-}
-
-HRESULT WinHttpAdapter::AsyncCallBegin(DWORD async_call_type) {
-  async_call_type_  = async_call_type;
-  async_call_is_error_ = false;
-
-  memset(&async_call_result_, 0, sizeof(async_call_result_));
-
-  return ::ResetEvent(get(async_completion_event_)) ? S_OK :
-                                                      HRESULTFromLastError();
-}
-
-// Waits for the WinHttp notification to arrive and handles the result of
-// the asynchronous call.
-HRESULT WinHttpAdapter::AsyncCallEnd(DWORD async_call_type) {
-  UNREFERENCED_PARAMETER(async_call_type);
-
-  const DWORD result = ::WaitForSingleObject(get(async_completion_event_),
-                                             INFINITE);
-  ASSERT1(result == WAIT_OBJECT_0);
-  switch (result) {
-    case WAIT_OBJECT_0:
-      break;
-    case WAIT_TIMEOUT:
-      return HRESULT_FROM_WIN32(ERROR_TIMEOUT);
-    case WAIT_FAILED:
-      return HRESULTFromLastError();
-  }
-
-  if (async_call_is_error_) {
-    ASSERT1(async_call_result_.dwResult == async_call_type);
-    ASSERT1(async_call_result_.dwError != ERROR_SUCCESS);
-    return HRESULT_FROM_WIN32(async_call_result_.dwError);
-  }
-
-  return S_OK;
-}
-
-void WinHttpAdapter::StatusCallback(HINTERNET handle,
-                                    uint32 status,
-                                    void* info,
-                                    uint32 info_len) {
-  UNREFERENCED_PARAMETER(handle);
-
-  switch (status) {
-    case WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE:
-      ASSERT1(async_call_type_ == API_QUERY_DATA_AVAILABLE);
-
-      ASSERT1(info_len == sizeof(async_bytes_available_));
-      ASSERT1(info);
-      async_bytes_available_ = *reinterpret_cast<DWORD*>(info);
-      break;
-
-    case WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE:
-      ASSERT1(async_call_type_ == API_RECEIVE_RESPONSE);
-      break;
-
-    case WINHTTP_CALLBACK_STATUS_READ_COMPLETE:
-      ASSERT1(async_call_type_ == API_READ_DATA);
-
-      ASSERT1(info);
-      async_bytes_read_ = info_len;
-      break;
-
-    case WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE:
-      ASSERT1(async_call_type_ == API_SEND_REQUEST);
-      break;
-
-    case WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE:
-      ASSERT1(async_call_type_ == API_WRITE_DATA);
-      break;
-
-    case WINHTTP_CALLBACK_STATUS_REQUEST_ERROR:
-      ASSERT1(async_call_type_ == API_QUERY_DATA_AVAILABLE  ||
-              async_call_type_ == API_RECEIVE_RESPONSE      ||
-              async_call_type_ == API_READ_DATA             ||
-              async_call_type_ == API_SEND_REQUEST          ||
-              async_call_type_ == API_WRITE_DATA);
-
-      ASSERT1(info_len == sizeof(async_call_result_));
-      ASSERT1(info);
-      async_call_result_ = *reinterpret_cast<WINHTTP_ASYNC_RESULT*>(info);
-      async_call_is_error_ = true;
-      break;
-
-    default:
-      break;
-  }
-
-  if (status == WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE        ||
-      status == WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE     ||
-      status == WINHTTP_CALLBACK_STATUS_READ_COMPLETE         ||
-      status == WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE  ||
-      status == WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE        ||
-      status == WINHTTP_CALLBACK_STATUS_REQUEST_ERROR) {
-    ASSERT1(!IsHandleSignaled(get(async_completion_event_)));
-    VERIFY1(::SetEvent(get(async_completion_event_)));
-  }
-}
-
-void __stdcall WinHttpAdapter::WinHttpStatusCallback(HINTERNET handle,
-                                                     uint32 context,
-                                                     uint32 status,
-                                                     void* info,
-                                                     uint32 info_len) {
-  ASSERT1(handle);
-  ASSERT1(context);
-  WinHttpAdapter* http_adapter = reinterpret_cast<WinHttpAdapter*>(context);
-
-  CString status_string;
-  CString info_string;
-  switch (status) {
-    case WINHTTP_CALLBACK_STATUS_HANDLE_CREATED:
-      status_string = _T("handle created");
-      break;
-      case WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING:
-      status_string = _T("handle closing");
-      break;
-    case WINHTTP_CALLBACK_STATUS_RESOLVING_NAME:
-      status_string = _T("resolving");
-      info_string.SetString(static_cast<TCHAR*>(info), info_len);  // host name
-      http_adapter->server_name_ = info_string;
-      break;
-    case WINHTTP_CALLBACK_STATUS_NAME_RESOLVED:
-      status_string = _T("resolved");
-      info_string.SetString(static_cast<TCHAR*>(info), info_len);  // host ip
-      http_adapter->server_ip_ = info_string;
-      break;
-    case WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER:
-      status_string = _T("connecting");
-      info_string.SetString(static_cast<TCHAR*>(info), info_len);  // host ip
-
-      // Server name resolving may be skipped in some cases. So populate server
-      // name and IP if not yet done.
-      if (http_adapter->server_name_.IsEmpty()) {
-        http_adapter->server_name_= info_string;
-      }
-      if (http_adapter->server_ip_.IsEmpty()) {
-        http_adapter->server_ip_ = info_string;
-      }
-      break;
-    case WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER:
-      status_string = _T("connected");
-      info_string.SetString(static_cast<TCHAR*>(info), info_len);  // host ip
-      break;
-    case WINHTTP_CALLBACK_STATUS_SENDING_REQUEST:
-      status_string = _T("sending");
-      break;
-    case WINHTTP_CALLBACK_STATUS_REQUEST_SENT:
-      status_string = _T("sent");
-      break;
-    case WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE:
-      status_string = _T("receiving");
-      break;
-    case WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED:
-      status_string = _T("received");
-      break;
-    case WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION:
-      status_string = _T("connection closing");
-      break;
-    case WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED:
-      status_string = _T("connection closed");
-      break;
-    case WINHTTP_CALLBACK_STATUS_REDIRECT:
-      status_string = _T("redirect");
-      info_string.SetString(static_cast<TCHAR*>(info), info_len);  // url
-      break;
-    case WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE:
-      status_string = _T("data available");
-      break;
-    case WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE:
-      status_string = _T("headers available");
-      break;
-    case WINHTTP_CALLBACK_STATUS_READ_COMPLETE:
-      status_string = _T("read complete");
-      break;
-    case WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE:
-      status_string = _T("send request complete");
-      break;
-    case WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE:
-      status_string = _T("write complete");
-      break;
-    case WINHTTP_CALLBACK_STATUS_REQUEST_ERROR:
-      status_string = _T("request error");
-      break;
-    case WINHTTP_CALLBACK_STATUS_SECURE_FAILURE:
-      status_string = _T("https failure");
-      ASSERT1(info);
-      ASSERT1(info_len == sizeof(DWORD));
-      info_string.Format(_T("0x%x"), *static_cast<DWORD*>(info));
-      break;
-    default:
-      break;
-  }
-
-  CString log_line;
-  log_line.AppendFormat(_T("[WinHttp status callback][handle=0x%08x]"), handle);
-  if (!status_string.IsEmpty()) {
-    log_line.AppendFormat(_T("[%s]"), status_string);
-  } else {
-    log_line.AppendFormat(_T("[0x%08x]"), status);
-  }
-  if (!info_string.IsEmpty()) {
-    log_line.AppendFormat(_T("[%s]"), info_string);
-  }
-  NET_LOG(L3, (_T("%s"), log_line));
-
-  http_adapter->StatusCallback(handle, status, info, info_len);
-}
-
-
-}  // namespace omaha
-
diff --git a/net/winhttp_adapter.h b/net/winhttp_adapter.h
deleted file mode 100644
index 4f74f00..0000000
--- a/net/winhttp_adapter.h
+++ /dev/null
@@ -1,152 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_NET_WINHTTP_ADAPTER_H_
-#define OMAHA_NET_WINHTTP_ADAPTER_H_
-
-#include <windows.h>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/net/winhttp.h"
-
-namespace omaha {
-
-// Provides a sync-async adapter between the caller and the asynchronous
-// WinHttp client. Solves the issue of reliably canceling of WinHttp calls by
-// closing the handles and avoding the race condition between handle closing
-// and the incoming WinHttp call.
-// The class manages the connection and the request handles. It registers a
-// callback for all WinHttp status notifications. Once an asynchrous WinHttp
-// call is made, the code blocks waiting for the corresponding notification
-// to arrive, handle the completion result, and then return to the caller.
-// WinHttp is guaranteed to send a notification callback for all asynchronous
-// request calls that have succeeded.
-// TODO(omaha): consider eliminating this class and implementing the same
-// functionality in the WinHttp class. Most likely, another class is needed
-// to manage the WinHttp session handle.
-class WinHttpAdapter {
- public:
-  WinHttpAdapter();
-
-  HRESULT Initialize();
-
-  HRESULT Connect(HINTERNET session_handle, const TCHAR* server, int port);
-
-  HRESULT OpenRequest(const TCHAR* verb,
-                      const TCHAR* uri,
-                      const TCHAR* version,
-                      const TCHAR* referrer,
-                      const TCHAR** accept_types,
-                      uint32 flags);
-
-  HRESULT AddRequestHeaders(const TCHAR* headers,
-                            int length,
-                            uint32 modifiers);
-
-  HRESULT SendRequest(const TCHAR* headers,
-                      DWORD headers_length,
-                      const void* optional_data,
-                      DWORD optional_data_length,
-                      DWORD content_length);
-
-  HRESULT SetCredentials(uint32 auth_targets,
-                         uint32 auth_scheme,
-                         const TCHAR* user_name,
-                         const TCHAR* password);
-
-  HRESULT ReceiveResponse();
-
-  HRESULT QueryAuthSchemes(uint32* supported_schemes,
-                           uint32* first_scheme,
-                           uint32* auth_target);
-
-  HRESULT QueryRequestHeadersInt(uint32 info_level,
-                                 const TCHAR* name,
-                                 int* value,
-                                 DWORD* index);
-
-  HRESULT QueryRequestHeadersString(uint32 info_level,
-                                    const TCHAR* name,
-                                    CString* value,
-                                    DWORD* index);
-
-  HRESULT QueryDataAvailable(DWORD* num_bytes);
-
-  HRESULT ReadData(void* buffer, DWORD buffer_length, DWORD* bytes_read);
-
-  HRESULT SetRequestOptionInt(uint32 option, int value);
-
-  HRESULT SetRequestOption(uint32 option,
-                           const void* buffer,
-                           DWORD buffer_length);
-
-  void CloseHandles();
-
-  HRESULT CrackUrl(const TCHAR* url,
-                   uint32 flags,
-                   CString* scheme,
-                   CString* server,
-                   int* port,
-                   CString* url_path,
-                   CString* extra_info) {
-    return http_client_->CrackUrl(
-        url, flags, scheme, server, port, url_path, extra_info);
-  }
-
-  CString server_name() const { return server_name_; }
-  CString server_ip() const { return server_ip_; }
-
- private:
-
-  HRESULT AsyncCallBegin(DWORD async_call_type);
-  HRESULT AsyncCallEnd(DWORD async_call_type);
-
-  void StatusCallback(HINTERNET handle,
-                      uint32 status,
-                      void* info,
-                      uint32 info_len);
-
-  static void __stdcall WinHttpStatusCallback(HINTERNET handle,
-                                              uint32 context,
-                                              uint32 status,
-                                              void* info,
-                                              uint32 info_len);
-
-  scoped_ptr<HttpClient> http_client_;
-
-  HINTERNET              connection_handle_;
-  HINTERNET              request_handle_;
-
-  CString                server_name_;
-  CString                server_ip_;
-
-  DWORD                  async_call_type_;
-  bool                   async_call_is_error_;
-  WINHTTP_ASYNC_RESULT   async_call_result_;
-  DWORD                  async_bytes_available_;
-  DWORD                  async_bytes_read_;
-  scoped_event           async_completion_event_;
-
-  LLock                  lock_;
-
-  DISALLOW_COPY_AND_ASSIGN(WinHttpAdapter);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_NET_WINHTTP_ADAPTER_H_
-
diff --git a/net/winhttp_adapter_unittest.cc b/net/winhttp_adapter_unittest.cc
deleted file mode 100644
index 7bd6870..0000000
--- a/net/winhttp_adapter_unittest.cc
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-#include "base/scoped_ptr.h"
-#include "omaha/net/winhttp_adapter.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-// Tests null WinHttp handles are allowed for WinHttp calls. WinHttp may or
-// may have not been initialized up to this point. This affects the return
-// value of some of the calls below.
-TEST(WinHttpAdapter, NullHandles) {
-  WinHttpAdapter winhttp_adapter;
-  EXPECT_HRESULT_SUCCEEDED(winhttp_adapter.Initialize());
-
-  // Null session handle.
-  HRESULT hr = winhttp_adapter.Connect(NULL, _T("127.0.0.1"), 80);
-  EXPECT_TRUE(hr == HRESULT_FROM_WIN32(ERROR_WINHTTP_NOT_INITIALIZED) ||
-              hr == HRESULT_FROM_WIN32(ERROR_INVALID_HANDLE));
-
-  // Opens a session, connects, closes the connection handle, and then
-  // tries to open a request for the null connection.
-  scoped_ptr<HttpClient> http_client(CreateHttpClient());
-  EXPECT_HRESULT_SUCCEEDED(http_client->Initialize());
-
-  HINTERNET session_handle = NULL;
-  EXPECT_HRESULT_SUCCEEDED(http_client->Open(NULL,
-                                             WINHTTP_ACCESS_TYPE_NO_PROXY,
-                                             WINHTTP_NO_PROXY_NAME,
-                                             WINHTTP_NO_PROXY_BYPASS,
-                                             0,  // Synchronous mode.
-                                             &session_handle));
-  EXPECT_NE(static_cast<HINTERNET>(NULL), session_handle);
-  EXPECT_HRESULT_SUCCEEDED(winhttp_adapter.Connect(session_handle,
-                                                   _T("127.0.0.1"),
-                                                   80));
-  winhttp_adapter.CloseHandles();
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_INVALID_HANDLE),
-            winhttp_adapter.OpenRequest(NULL,  // verb
-                                        NULL,  // uri,
-                                        NULL,  // version
-                                        NULL,  // referrer
-                                        NULL,  // accept_types
-                                        0));   // flags
-
-  // Null request handle.
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_INVALID_HANDLE),
-            winhttp_adapter.QueryDataAvailable(NULL));
-}
-
-}  // namespace omaha
diff --git a/net/winhttp_vtable.cc b/net/winhttp_vtable.cc
deleted file mode 100644
index 4b1b835..0000000
--- a/net/winhttp_vtable.cc
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/net/winhttp_vtable.h"
-
-namespace omaha {
-
-bool WinHttpVTable::Load() {
-  if (IsLoaded()) {
-    return true;
-  }
-  Clear();
-  library_ = ::LoadLibrary(_T("winhttp"));
-  if (!library_) {
-    library_ = ::LoadLibrary(_T("winhttp5"));
-    if (!library_) {
-      return false;
-    }
-  }
-  bool is_valid =
-     GPA("WinHttpAddRequestHeaders",       &WinHttpAddRequestHeaders_pointer) &&
-     GPA("WinHttpCheckPlatform",           &WinHttpCheckPlatform_pointer) &&
-     GPA("WinHttpCloseHandle",             &WinHttpCloseHandle_pointer) &&
-     GPA("WinHttpConnect",                 &WinHttpConnect_pointer) &&
-     GPA("WinHttpCrackUrl",                &WinHttpCrackUrl_pointer) &&
-     GPA("WinHttpCreateUrl",               &WinHttpCreateUrl_pointer) &&
-     GPA("WinHttpDetectAutoProxyConfigUrl", &WinHttpDetectAutoProxyConfigUrl_pointer) &&    // NOLINT
-     GPA("WinHttpGetIEProxyConfigForCurrentUser", &WinHttpGetIEProxyConfigForCurrentUser_pointer) &&    // NOLINT
-     GPA("WinHttpGetDefaultProxyConfiguration", &WinHttpGetDefaultProxyConfiguration_pointer) &&    // NOLINT
-     GPA("WinHttpGetProxyForUrl",          &WinHttpGetProxyForUrl_pointer) &&
-     GPA("WinHttpOpen",                    &WinHttpOpen_pointer) &&
-     GPA("WinHttpOpenRequest",             &WinHttpOpenRequest_pointer) &&
-     GPA("WinHttpQueryAuthSchemes",        &WinHttpQueryAuthSchemes_pointer) &&
-     GPA("WinHttpQueryDataAvailable",      &WinHttpQueryDataAvailable_pointer) &&   // NOLINT
-     GPA("WinHttpQueryHeaders",            &WinHttpQueryHeaders_pointer) &&
-     GPA("WinHttpQueryOption",             &WinHttpQueryOption_pointer) &&
-     GPA("WinHttpReadData",                &WinHttpReadData_pointer) &&
-     GPA("WinHttpReceiveResponse",         &WinHttpReceiveResponse_pointer) &&
-     GPA("WinHttpSendRequest",             &WinHttpSendRequest_pointer) &&
-     GPA("WinHttpSetDefaultProxyConfiguration", &WinHttpSetDefaultProxyConfiguration_pointer) &&    // NOLINT
-     GPA("WinHttpSetCredentials",          &WinHttpSetCredentials_pointer) &&
-     GPA("WinHttpSetOption",               &WinHttpSetOption_pointer) &&
-     GPA("WinHttpSetStatusCallback",       &WinHttpSetStatusCallback_pointer) &&
-     GPA("WinHttpSetTimeouts",             &WinHttpSetTimeouts_pointer) &&
-     GPA("WinHttpWriteData",               &WinHttpWriteData_pointer);
-
-  if (!is_valid) {
-    Unload();
-  }
-  return is_valid;
-}
-
-void WinHttpVTable::Unload() {
-  if (library_) {
-    ::FreeLibrary(library_);
-    library_ = NULL;
-  }
-  Clear();
-}
-
-}   // namespace omaha
-
diff --git a/net/winhttp_vtable.h b/net/winhttp_vtable.h
deleted file mode 100644
index 2249e8c..0000000
--- a/net/winhttp_vtable.h
+++ /dev/null
@@ -1,181 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-//
-// WinHttpVTable provides dynamic loading of winhttp.dll.
-
-// Runtime requirements: WinHTTP 5.1 is now an operating-system component of
-// the following systems:
-// - Windows Vista
-// - Windows Server 2003 family
-// - Windows XP SP1
-// - Windows 2000 SP3 (except Datacenter Server)
-
-#ifndef OMAHA_NET_WINHTTP_VTABLE_H__
-#define OMAHA_NET_WINHTTP_VTABLE_H__
-
-#include <windows.h>
-#include <winhttp.h>
-#include "omaha/base/debug.h"
-
-namespace omaha {
-
-class WinHttpVTable {
- public:
-  BOOL WinHttpAddRequestHeaders(HINTERNET, const TCHAR*, DWORD, DWORD);
-  BOOL WinHttpCheckPlatform();
-  BOOL WinHttpCloseHandle(HINTERNET);
-  HINTERNET WinHttpConnect(HINTERNET, const TCHAR*, INTERNET_PORT, DWORD);
-  BOOL WinHttpCrackUrl(const TCHAR*, DWORD, DWORD, URL_COMPONENTS*);
-  BOOL WinHttpCreateUrl(URL_COMPONENTS*, DWORD, TCHAR*, DWORD*);
-  BOOL WinHttpGetDefaultProxyConfiguration(WINHTTP_PROXY_INFO*);
-  BOOL WinHttpGetIEProxyConfigForCurrentUser(
-           WINHTTP_CURRENT_USER_IE_PROXY_CONFIG*);
-  HINTERNET WinHttpOpen(const TCHAR*, DWORD, const TCHAR*, const TCHAR*, DWORD);
-  HINTERNET WinHttpOpenRequest(HINTERNET,
-                               const TCHAR*,
-                               const TCHAR*,
-                               const TCHAR*,
-                               const TCHAR*,
-                               const TCHAR**,
-                               DWORD);
-  BOOL WinHttpQueryAuthSchemes(HINTERNET, DWORD*, DWORD*, DWORD*);
-  BOOL WinHttpQueryDataAvailable(HINTERNET, DWORD*);
-  BOOL WinHttpQueryHeaders(HINTERNET,
-                           DWORD,
-                           const TCHAR*,
-                           void*,
-                           DWORD*,
-                           DWORD*);
-  BOOL WinHttpQueryOption(HINTERNET, DWORD, void*, DWORD*);
-  BOOL WinHttpReadData(HINTERNET, void*, DWORD, DWORD*);
-  BOOL WinHttpWriteData(HINTERNET, const void*, DWORD, DWORD*);
-  BOOL WinHttpReceiveResponse(HINTERNET, void*);
-  BOOL WinHttpSendRequest(HINTERNET,
-                          const TCHAR*,
-                          DWORD,
-                          void*,
-                          DWORD,
-                          DWORD,
-                          DWORD_PTR);
-  BOOL WinHttpSetCredentials(HINTERNET,
-                             DWORD,
-                             DWORD,
-                             const TCHAR*,
-                             const TCHAR*,
-                             void*);
-  BOOL WinHttpSetOption(HINTERNET, DWORD, void*, DWORD);
-  WINHTTP_STATUS_CALLBACK WinHttpSetStatusCallback(HINTERNET,
-                                                   WINHTTP_STATUS_CALLBACK,
-                                                   DWORD,
-                                                   DWORD_PTR);
-  BOOL WinHttpSetTimeouts(HINTERNET, int, int, int, int);
-  BOOL WinHttpGetProxyForUrl(HINTERNET,
-                             const TCHAR*,
-                             WINHTTP_AUTOPROXY_OPTIONS*,
-                             WINHTTP_PROXY_INFO*);
-  BOOL WinHttpDetectAutoProxyConfigUrl(DWORD, TCHAR**);
-  BOOL WinHttpSetDefaultProxyConfiguration(WINHTTP_PROXY_INFO*);
-
-  WinHttpVTable() { Clear(); }
-  ~WinHttpVTable() { Unload(); }
-
-  // Loads library, snap links.
-  bool Load();
-
-  // Unloads library, clear links.
-  void Unload();
-
-  bool IsLoaded() { return NULL != library_; }
-
- private:
-  void Clear() { memset(this, 0, sizeof(*this)); }
-
-  template <typename T>
-  bool GPA(const char* function_name, T* function_pointer) {
-    ASSERT1(function_name);
-    *function_pointer = reinterpret_cast<T>(::GetProcAddress(library_,
-                                                             function_name));
-    return NULL != *function_pointer;
-  }
-
-  // No good way to keep lines below 80 chars.
-  BOOL      (CALLBACK *WinHttpAddRequestHeaders_pointer)(HINTERNET, const TCHAR*, DWORD, DWORD);    // NOLINT
-  BOOL      (CALLBACK *WinHttpCheckPlatform_pointer)();
-  BOOL      (CALLBACK *WinHttpCloseHandle_pointer)(HINTERNET);    // NOLINT
-  HINTERNET (CALLBACK *WinHttpConnect_pointer)(HINTERNET, const TCHAR*, INTERNET_PORT, DWORD);    // NOLINT
-  BOOL      (CALLBACK *WinHttpCrackUrl_pointer)(const TCHAR*, DWORD, DWORD, URL_COMPONENTS*);    // NOLINT
-  BOOL      (CALLBACK *WinHttpCreateUrl_pointer)(URL_COMPONENTS*, DWORD, TCHAR*, DWORD*);        // NOLINT
-  BOOL      (CALLBACK *WinHttpDetectAutoProxyConfigUrl_pointer)(DWORD, TCHAR**);    // NOLINT
-  BOOL      (CALLBACK *WinHttpGetDefaultProxyConfiguration_pointer)(WINHTTP_PROXY_INFO*);    // NOLINT
-  BOOL      (CALLBACK *WinHttpGetIEProxyConfigForCurrentUser_pointer)(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG* pProxyConfig);    // NOLINT
-  BOOL      (CALLBACK *WinHttpGetProxyForUrl_pointer)(HINTERNET, const TCHAR*, WINHTTP_AUTOPROXY_OPTIONS*, WINHTTP_PROXY_INFO*);    // NOLINT
-  HINTERNET (CALLBACK *WinHttpOpen_pointer)(const TCHAR*, DWORD, const TCHAR*, const TCHAR*, DWORD);    // NOLINT
-  HINTERNET (CALLBACK *WinHttpOpenRequest_pointer)(HINTERNET, const TCHAR*, const TCHAR*, const TCHAR*, const TCHAR*, const TCHAR**, DWORD);    // NOLINT
-  BOOL      (CALLBACK *WinHttpQueryAuthSchemes_pointer)(HINTERNET, DWORD*, DWORD*, DWORD*);    // NOLINT
-  BOOL      (CALLBACK *WinHttpQueryDataAvailable_pointer)(HINTERNET, DWORD*);    // NOLINT
-  BOOL      (CALLBACK *WinHttpQueryHeaders_pointer)(HINTERNET, DWORD, const TCHAR*, void*, DWORD*, DWORD*);    // NOLINT
-  BOOL      (CALLBACK *WinHttpQueryOption_pointer)(HINTERNET, DWORD, void*, DWORD*);    // NOLINT
-  BOOL      (CALLBACK *WinHttpReadData_pointer)(HINTERNET, void*, DWORD, DWORD*);    // NOLINT
-  BOOL      (CALLBACK *WinHttpReceiveResponse_pointer)(HINTERNET, void*);    // NOLINT
-  BOOL      (CALLBACK *WinHttpSendRequest_pointer)(HINTERNET, const TCHAR*, DWORD, void*, DWORD, DWORD, DWORD_PTR);    // NOLINT
-  BOOL      (CALLBACK *WinHttpSetCredentials_pointer)(HINTERNET, DWORD, DWORD, const TCHAR*, const TCHAR*, void*);    // NOLINT
-  BOOL      (CALLBACK *WinHttpSetDefaultProxyConfiguration_pointer)(WINHTTP_PROXY_INFO*);   // NOLINT
-  BOOL      (CALLBACK *WinHttpSetOption_pointer)(HINTERNET, DWORD, void*, DWORD);    // NOLINT
-  BOOL      (CALLBACK *WinHttpSetTimeouts_pointer)(HINTERNET, int, int, int, int);    // NOLINT
-  BOOL      (CALLBACK *WinHttpWriteData_pointer)(HINTERNET, LPCVOID, DWORD, DWORD*);   // NOLINT
-  WINHTTP_STATUS_CALLBACK (CALLBACK *WinHttpSetStatusCallback_pointer)(HINTERNET, WINHTTP_STATUS_CALLBACK, DWORD, DWORD_PTR);    // NOLINT
-
-  HINSTANCE library_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(WinHttpVTable);
-};
-
-#define PROTECT_WRAP(function, proto, call, result_type, result_error_value)  \
-inline result_type WinHttpVTable::function proto {         \
-  return function##_pointer call;                          \
-}
-
-// No good way to keep lines below 80 chars.
-PROTECT_WRAP(WinHttpAddRequestHeaders, (HINTERNET a, const TCHAR* b, DWORD c, DWORD d), (a, b, c, d), BOOL, FALSE);    // NOLINT
-PROTECT_WRAP(WinHttpCheckPlatform, (), (), BOOL, FALSE);
-PROTECT_WRAP(WinHttpCloseHandle, (HINTERNET a), (a), BOOL, FALSE);    // NOLINT
-PROTECT_WRAP(WinHttpConnect, (HINTERNET a, const TCHAR* b, INTERNET_PORT c, DWORD d), (a, b, c, d), HINTERNET, NULL);    // NOLINT
-PROTECT_WRAP(WinHttpCrackUrl, (const TCHAR* a, DWORD b, DWORD c, LPURL_COMPONENTS d), (a, b, c, d), BOOL, FALSE);    // NOLINT
-PROTECT_WRAP(WinHttpCreateUrl, (URL_COMPONENTS* a, DWORD b, TCHAR* c, DWORD* d), (a, b, c, d), BOOL, FALSE);    // NOLINT
-PROTECT_WRAP(WinHttpDetectAutoProxyConfigUrl, (DWORD a, TCHAR** b), (a, b), BOOL, FALSE);   // NOLINT
-PROTECT_WRAP(WinHttpGetDefaultProxyConfiguration, (WINHTTP_PROXY_INFO* a), (a), BOOL, FALSE);    // NOLINT
-PROTECT_WRAP(WinHttpGetIEProxyConfigForCurrentUser, (WINHTTP_CURRENT_USER_IE_PROXY_CONFIG* a), (a),  BOOL, FALSE);    // NOLINT
-PROTECT_WRAP(WinHttpGetProxyForUrl, (HINTERNET a, const TCHAR* b, WINHTTP_AUTOPROXY_OPTIONS* c, WINHTTP_PROXY_INFO* d), (a, b, c, d), BOOL, FALSE);    // NOLINT
-PROTECT_WRAP(WinHttpOpen, (const TCHAR* a, DWORD b, const TCHAR* c, const TCHAR* d, DWORD e), (a, b, c, d, e), HINTERNET, NULL);    // NOLINT
-PROTECT_WRAP(WinHttpOpenRequest, (HINTERNET a, const TCHAR* b, const TCHAR* c, const TCHAR* d, const TCHAR* e, const TCHAR** f, DWORD g), (a, b, c, d, e, f, g), HINTERNET, NULL);    // NOLINT
-PROTECT_WRAP(WinHttpQueryAuthSchemes, (HINTERNET a, DWORD* b, DWORD* c, DWORD* d), (a, b, c, d), BOOL, FALSE);    // NOLINT
-PROTECT_WRAP(WinHttpQueryDataAvailable, (HINTERNET a, DWORD* b), (a, b), BOOL, FALSE);    // NOLINT
-PROTECT_WRAP(WinHttpQueryHeaders, (HINTERNET a, DWORD b, const TCHAR* c, void* d, DWORD* e, DWORD* f), (a, b, c, d, e, f), BOOL, FALSE);    // NOLINT
-PROTECT_WRAP(WinHttpQueryOption, (HINTERNET a, DWORD b, void* c, DWORD* d), (a, b, c, d), BOOL, FALSE);    // NOLINT
-PROTECT_WRAP(WinHttpReadData, (HINTERNET a, void* b, DWORD c, DWORD* d), (a, b, c, d), BOOL, FALSE);    // NOLINT
-PROTECT_WRAP(WinHttpReceiveResponse, (HINTERNET a, void* b), (a, b), BOOL, FALSE);    // NOLINT
-PROTECT_WRAP(WinHttpSendRequest, (HINTERNET a, const TCHAR* b, DWORD c, void* d, DWORD e, DWORD f, DWORD_PTR g), (a, b, c, d, e, f, g), BOOL, FALSE);    // NOLINT
-PROTECT_WRAP(WinHttpSetCredentials, (HINTERNET a, DWORD b, DWORD c, const TCHAR* d, const TCHAR* e, void* f), (a, b, c, d, e, f), BOOL, FALSE);    // NOLINT
-PROTECT_WRAP(WinHttpSetDefaultProxyConfiguration, (WINHTTP_PROXY_INFO* a), (a), BOOL, FALSE);    // NOLINT
-PROTECT_WRAP(WinHttpSetOption, (HINTERNET a, DWORD b, void* c, DWORD d), (a, b, c, d), BOOL, FALSE);    // NOLINT
-PROTECT_WRAP(WinHttpSetStatusCallback, (HINTERNET a, WINHTTP_STATUS_CALLBACK b, DWORD c, DWORD_PTR d), (a, b, c, d), WINHTTP_STATUS_CALLBACK, WINHTTP_INVALID_STATUS_CALLBACK);    // NOLINT
-PROTECT_WRAP(WinHttpSetTimeouts, (HINTERNET a, int b, int c, int d, int e), (a, b, c, d, e), BOOL, FALSE);    // NOLINT
-PROTECT_WRAP(WinHttpWriteData, (HINTERNET a, LPCVOID b, DWORD c, DWORD* d), (a, b, c, d), BOOL, FALSE);    // NOLINT
-
-}   // namespace omaha
-
-#endif  // OMAHA_NET_WINHTTP_VTABLE_H__
-
diff --git a/net/winhttp_vtable_unittest.cc b/net/winhttp_vtable_unittest.cc
deleted file mode 100644
index c1311c8..0000000
--- a/net/winhttp_vtable_unittest.cc
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/net/winhttp_vtable.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(WinHttpVTableTest, WinHttpVTable) {
-  WinHttpVTable winhttp;
-  if (winhttp.Load()) {
-    // Check to see if the winhttp module has already been loaded.
-    bool was_loaded = ::GetModuleHandle(_T("winhttp")) ||
-                      ::GetModuleHandle(_T("winhttp5"));
-    EXPECT_TRUE(winhttp.IsLoaded());
-    EXPECT_TRUE(winhttp.Load());
-    EXPECT_TRUE(::GetModuleHandle(_T("winhttp")) ||
-                ::GetModuleHandle(_T("winhttp5")));
-    EXPECT_TRUE(winhttp.WinHttpCheckPlatform());
-    winhttp.Unload();
-    EXPECT_FALSE(winhttp.IsLoaded());
-    if (!was_loaded) {
-      // If the module was not loaded at the beginning of the test then it
-      // should not be loaded now either.
-      EXPECT_FALSE(::GetModuleHandle(_T("winhttp")) ||
-                   ::GetModuleHandle(_T("winhttp5")));
-    }
-  }
-}
-
-}   // namespace omaha
-
diff --git a/net/wininet.cc b/net/wininet.cc
deleted file mode 100644
index 7182ab3..0000000
--- a/net/wininet.cc
+++ /dev/null
@@ -1,1541 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-#include <wininet.h>
-#include <atlstr.h>
-#include <vector>                     // NOLINT
-
-#include "omaha/net/http_client.h"
-
-#include "base/scoped_ptr.h"
-#include "omaha/base/atl_regexp.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/string.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-class WinInet : public HttpClient {
- public:
-  static HttpClient* Create() { return new WinInet; }
-
-  virtual HRESULT Initialize();
-
-  virtual HRESULT Open(const TCHAR* user_agent,
-                         uint32 access_type,
-                         const TCHAR* proxy_name,
-                         const TCHAR* proxy_bypass);
-
-  virtual HRESULT Close();
-
-  virtual HRESULT Connect(const TCHAR* server, int port);
-
-  virtual HRESULT OpenRequest(const TCHAR* verb,
-                              const TCHAR* uri,
-                              const TCHAR* version,
-                              const TCHAR* referrer,
-                              const TCHAR** accept_types,
-                              uint32 flags);
-
-  virtual HRESULT SendRequest(const TCHAR* headers,
-                              int headers_length,
-                              const void* optional_data,
-                              size_t optional_data_length,
-                              size_t content_length);
-
-  virtual HRESULT SetTimeouts(int resolve_timeout_ms,
-                              int connect_timeout_ms,
-                              int send_timeout_ms,
-                              int receive_timeout_ms);
-
-  virtual HRESULT ReceiveResponse();
-
-  virtual HRESULT QueryDataAvailable(int* num_bytes);
-
-  virtual HRESULT ReadData(std::vector<uint8>* data);
-
-  virtual HRESULT WriteData(const std::vector<uint8>& data, int* bytes_written);
-
-  virtual HRESULT SetCredentials(uint32 auth_targets,
-                                 uint32 auth_scheme,
-                                 const TCHAR* user_name,
-                                 const TCHAR* password);
-
-  virtual HRESULT DetectAutoProxyConfigUrl(uint32 flags,
-                                           CString* auto_config_url);
-
-  virtual HRESULT GetDefaultProxyConfiguration(ProxyInfo* proxy_info);
-
-  virtual HRESULT SetDefaultProxyConfiguration(const ProxyInfo& proxy_info);
-
-  virtual HRESULT GetIEProxyConfiguration(CurrentUserIEProxyConfig* proxy_info);
-
-  virtual HRESULT GetProxyForUrl(const TCHAR* url,
-                                 const AutoProxyOptions* auto_proxy_options,
-                                 ProxyInfo* pProxyInfo);
-
-  virtual HRESULT QueryAuthSchemes(uint32* supported_schemes,
-                                          uint32* first_scheme,
-                                          uint32* auth_target);
-
-  virtual HRESULT AddRequestHeaders(const TCHAR* headers,
-                                    int length,
-                                    uint32 modifiers);
-
-  virtual HRESULT QueryHeaders(uint32 info_level,
-                               const TCHAR* name,
-                               CString* value,
-                               int* index);
-  virtual HRESULT QueryHeaders(uint32 info_level,
-                               const TCHAR* name,
-                               int* value,
-                               int* index);
-
-  virtual HRESULT QueryOption(bool is_session_option,
-                              uint32 option,
-                              std::vector<uint8>* val);
-
-  virtual HRESULT QueryOptionString(bool is_session_option,
-                                    uint32 option,
-                                    CString* value);
-
-  virtual HRESULT QueryOptionInt(bool is_session_option,
-                                 uint32 option,
-                                 int* value);
-
-  virtual HRESULT SetOption(bool is_session_option,
-                            uint32 option,
-                            const void* buffer,
-                            size_t buffer_length);
-
-  virtual HRESULT SetOption(bool is_session_option,
-                            uint32 option,
-                            const std::vector<uint8>* val);
-
-  virtual HRESULT SetOptionString(bool is_session_option,
-                                  uint32 option,
-                                  const TCHAR* value);
-
-  virtual HRESULT SetOptionInt(bool is_session_option,
-                               uint32 option,
-                               int value);
-
-  virtual HRESULT CrackUrl(const TCHAR* url,
-                           uint32 flags,
-                           CString* scheme,
-                           CString* server,
-                           int* port,
-                           CString* url_path,
-                           CString* extra_info);
-
-  virtual HRESULT CreateUrl(const TCHAR* scheme,
-                            const TCHAR* server,
-                            int port,
-                            const TCHAR* url_path,
-                            const TCHAR* extra_info,
-                            uint32 flags,
-                            CString* url);
-
-
-  typedef void (*StatusCallback)(uint32 context,
-                                 int status,
-                                 void* status_information,
-                                 size_t status_info_length);
-  virtual StatusCallback SetStatusCallback(StatusCallback callback,
-                                           uint32 flags);
- private:
-  WinInet();
-  DISALLOW_EVIL_CONSTRUCTORS(WinInet);
-};
-
-
-// TODO(omaha): remove after the implementation is complete.
-// 4100: unreferenced formal parameter
-#pragma warning(disable : 4100)
-
-WinInet::WinInet() {
-}
-
-HRESULT WinInet::Initialize() {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::Open(const TCHAR* user_agent,
-                      uint32 access_type,
-                      const TCHAR* proxy_name,
-                      const TCHAR* proxy_bypass) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::Close() {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::Connect(const TCHAR* server, int port) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::OpenRequest(const TCHAR* verb,
-                             const TCHAR* uri,
-                             const TCHAR* version,
-                             const TCHAR* referrer,
-                             const TCHAR** accept_types,
-                             uint32 flags) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::SendRequest(const TCHAR* headers,
-                             int headers_length,
-                             const void* optional_data,
-                             size_t optional_data_length,
-                             size_t content_length) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::SetTimeouts(int resolve_timeout_ms,
-                             int connect_timeout_ms,
-                             int send_timeout_ms,
-                             int receive_timeout_ms) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::ReceiveResponse() {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::QueryDataAvailable(int* num_bytes) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::ReadData(std::vector<uint8>* data) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::WriteData(const std::vector<uint8>& data, int* bytes_written) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::SetCredentials(uint32 auth_targets,
-                                uint32 auth_scheme,
-                                const TCHAR* user_name,
-                                const TCHAR* password) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::DetectAutoProxyConfigUrl(uint32 flags,
-                                          CString* auto_config_url) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::GetDefaultProxyConfiguration(ProxyInfo* proxy_info) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::SetDefaultProxyConfiguration(const ProxyInfo& proxy_info) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::GetIEProxyConfiguration(CurrentUserIEProxyConfig* proxy_info) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::GetProxyForUrl(const TCHAR* url,
-                                const AutoProxyOptions* auto_proxy_options,
-                                ProxyInfo* pProxyInfo) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::QueryAuthSchemes(uint32* supported_schemes,
-                                  uint32* first_scheme,
-                                  uint32* auth_target) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::AddRequestHeaders(const TCHAR* headers,
-                                   int length,
-                                   uint32 modifiers) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::QueryHeaders(uint32 info_level,
-                              const TCHAR* name,
-                              CString* value,
-                              int* index) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::QueryHeaders(uint32 info_level,
-                              const TCHAR* name,
-                              int* value,
-                              int* index) {
-  return E_NOTIMPL;
-}
-
-
-HRESULT WinInet::QueryOption(bool is_session_option,
-                             uint32 option,
-                             std::vector<uint8>* val) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::QueryOptionString(bool is_session_option,
-                                   uint32 option,
-                                   CString* value) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::QueryOptionInt(bool is_session_option,
-                                uint32 option,
-                                int* value) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::SetOption(bool is_session_option,
-                           uint32 option,
-                           const void* buffer,
-                           size_t buffer_length) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::SetOption(bool is_session_option,
-                           uint32 option,
-                           const std::vector<uint8>* val) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::SetOptionString(bool is_session_option,
-                                 uint32 option,
-                                 const TCHAR* value) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::SetOptionInt(bool is_session_option,
-                              uint32 option,
-                              int value) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::CrackUrl(const TCHAR* url,
-                          uint32 flags,
-                          CString* scheme,
-                          CString* server,
-                          int* port,
-                          CString* url_path,
-                          CString* extra_info) {
-  return E_NOTIMPL;
-}
-
-HRESULT WinInet::CreateUrl(const TCHAR* scheme,
-                           const TCHAR* server,
-                           int port,
-                           const TCHAR* url_path,
-                           const TCHAR* extra_info,
-                           uint32 flags,
-                           CString* url) {
-  return E_NOTIMPL;
-}
-
-HttpClient::StatusCallback WinInet::SetStatusCallback(
-                               HttpClient::StatusCallback callback,
-                               uint32 flags) {
-  return NULL;
-}
-
-extern "C" const bool kRegisterWinInet =
-    HttpClient::GetFactory().Register(HttpClient::WININET, &WinInet::Create);
-
-
-}  // namespace omaha
-
-#if 0
-// Constants
-const uint32 kInternetRequestCachingDefaultFlags = INTERNET_FLAG_NO_UI |
-                                                   INTERNET_FLAG_NO_COOKIES;
-const uint32 kInternetRequestNoCacheDefaultFlags =
-                 INTERNET_FLAG_NO_UI |
-                 INTERNET_FLAG_NO_COOKIES |
-                 INTERNET_FLAG_NO_CACHE_WRITE |
-                 INTERNET_FLAG_PRAGMA_NOCACHE |
-                 INTERNET_FLAG_RELOAD;
-const TCHAR kProxyAuthenticateHeader[] = _T("Proxy-Authenticate:");
-const TCHAR kNegotiateAuthScheme[] = _T("Negotiate");
-const TCHAR kNTLMAuthScheme[] = _T("NTLM");
-const TCHAR kDigestAuthScheme[] = _T("Digest");
-const TCHAR kBasicAuthScheme[] = _T("Basic");
-
-// Provides dynamic loading of WinInet.dll
-//
-// Delay loading wininet.dll would be nice but would (tediously) involve
-// modifying the mk_file for all DLLs/EXEs that use any of the functions that
-// use InetGet.  Which is all of them (since it is used in debug.cpp).  So
-// instead, we do it the old-fashioned way.
-//
-// N.B.: When WinInetVTable has been Load()ed, the wininet.dll is loaded -
-// which adds significantly to the working set of your process.  So beware of
-// loading the WinInetVTable and leaving it loaded, esp. if you have a static
-// instance of WinInetVTable.  And on the other hand, the load/unload operation
-// is expensive (slow) so you want to reuse your Load()ed WinInetVTable if
-// you're going to be needing it frequently.  Note that that cost is in the
-// loading/unloading of the DLL, thus 'nested' uses (which only need to 'snap'
-// the links) are cheap.
-class WinInetVTable {
- public:
-  // Functions are simply reflected through data members holding function
-  // pointers, taking advantage of C-syntax (you can call indirectly through a
-  // function pointer without a '*').  No error checking is done: call through
-  // only when Loaded() == true.
-  BOOL      HttpAddRequestHeaders(HINTERNET, const TCHAR*, DWORD, DWORD);
-  BOOL      HttpEndRequest(HINTERNET, LPINTERNET_BUFFERS, DWORD, DWORD_PTR);
-  HINTERNET HttpOpenRequest(HINTERNET,
-                            const TCHAR*,
-                            const TCHAR*,
-                            const TCHAR*,
-                            const TCHAR*,
-                            const TCHAR**,
-                            DWORD,
-                            DWORD_PTR);
-  BOOL      HttpQueryInfo(HINTERNET, DWORD, LPVOID, LPDWORD, LPDWORD);
-  BOOL      HttpSendRequestEx(HINTERNET,
-                              LPINTERNET_BUFFERS,
-                              LPINTERNET_BUFFERS,
-                              DWORD,
-                              DWORD_PTR);
-  BOOL      HttpSendRequest(HINTERNET, const TCHAR*, DWORD, LPVOID, DWORD);
-  BOOL      InternetCloseHandle(HINTERNET);
-  HINTERNET InternetConnect(HINTERNET,
-                            const TCHAR*,
-                            INTERNET_PORT,
-                            const TCHAR*,
-                            const TCHAR*,
-                            DWORD,
-                            DWORD,
-                            DWORD);
-  BOOL      InternetGetConnectedStateEx(LPDWORD, char*, DWORD, DWORD);
-  HINTERNET InternetOpen(const TCHAR*,
-                         DWORD,
-                         const TCHAR*,
-                         const TCHAR*,
-                         DWORD);
-  HINTERNET InternetOpenUrl(HINTERNET,
-                            const TCHAR*,
-                            const TCHAR*,
-                            DWORD,
-                            DWORD,
-                            DWORD_PTR);
-  BOOL      InternetQueryDataAvailable(HINTERNET, LPDWORD, DWORD, DWORD);
-  BOOL      InternetReadFile(HINTERNET, LPVOID, DWORD, LPDWORD);
-  HINTERNET InternetReadFileEx(HINTERNET, LPINTERNET_BUFFERS, DWORD, DWORD_PTR);
-  BOOL      InternetGetCookie(const TCHAR*, const TCHAR*, TCHAR*, LPDWORD);
-  BOOL      InternetSetCookie(const TCHAR*, const TCHAR*, const TCHAR*);
-  BOOL      InternetAutodial(DWORD, HWND);
-  BOOL      InternetAutodialHangup(DWORD);
-  BOOL      InternetQueryOption(HINTERNET hInternet,
-                                DWORD dwOption,
-                                LPVOID lpBuffer,
-                                LPDWORD lpdwBufferLength);
-  BOOL      InternetSetOption(HINTERNET hInternet,
-                              DWORD dwOption,
-                              LPVOID lpBuffer,
-                              DWORD dwBufferLength);
-  BOOL      InternetCheckConnection(const TCHAR*,
-                                    DWORD, DWORD);
-  BOOL      InternetCrackUrl(const TCHAR*,
-                             DWORD,
-                             DWORD,
-                             LPURL_COMPONENTS);
-  INTERNET_STATUS_CALLBACK InternetSetStatusCallback(HINTERNET, INTERNET_STATUS_CALLBACK);
-
-  WinInetVTable();
-  ~WinInetVTable();
-
-  bool Load();    // Load library, snap links
-  void Unload();  // Unload library, clear links
-
-  bool Loaded() { return NULL != library_; }
-
- protected:
-  BOOL      (CALLBACK *HttpAddRequestHeaders_pointer)(HINTERNET, const TCHAR*, DWORD, DWORD);
-  BOOL      (CALLBACK *HttpEndRequest_pointer)(HINTERNET, LPINTERNET_BUFFERS, DWORD, DWORD_PTR);
-  HINTERNET (CALLBACK *HttpOpenRequest_pointer)(HINTERNET, const TCHAR*, const TCHAR*, const TCHAR*, const TCHAR*, const TCHAR**, DWORD, DWORD_PTR);
-  BOOL      (CALLBACK *HttpQueryInfo_pointer)(HINTERNET, DWORD, LPVOID, LPDWORD, LPDWORD);
-  BOOL      (CALLBACK *HttpSendRequestEx_pointer)(HINTERNET, LPINTERNET_BUFFERS, LPINTERNET_BUFFERS, DWORD, DWORD_PTR);
-  BOOL      (CALLBACK *HttpSendRequest_pointer)(HINTERNET, const TCHAR*, DWORD, LPVOID, DWORD);
-  BOOL      (CALLBACK *InternetCloseHandle_pointer)(HINTERNET);
-  HINTERNET (CALLBACK *InternetConnect_pointer)(HINTERNET, const TCHAR*, INTERNET_PORT, const TCHAR*, const TCHAR*, DWORD, DWORD, DWORD);
-  BOOL      (CALLBACK *InternetGetConnectedStateEx_pointer)(LPDWORD, char*, DWORD, DWORD);
-  HINTERNET (CALLBACK *InternetOpen_pointer)(const TCHAR*, DWORD, const TCHAR*, const TCHAR*, DWORD);
-  HINTERNET (CALLBACK *InternetOpenUrl_pointer)(HINTERNET, const TCHAR*, const TCHAR*, DWORD, DWORD, DWORD_PTR);
-  BOOL      (CALLBACK *InternetQueryDataAvailable_pointer)(HINTERNET, LPDWORD, DWORD, DWORD);
-  BOOL      (CALLBACK *InternetReadFile_pointer)(HINTERNET, LPVOID, DWORD, LPDWORD);
-  HINTERNET (CALLBACK *InternetReadFileEx_pointer)(HINTERNET, LPINTERNET_BUFFERS, DWORD, DWORD_PTR);
-  BOOL      (CALLBACK *InternetGetCookie_pointer)(const TCHAR*, const TCHAR*, TCHAR*, LPDWORD);
-  BOOL      (CALLBACK *InternetSetCookie_pointer)(const TCHAR*, const TCHAR*, const TCHAR*);
-  BOOL      (CALLBACK *InternetAutodial_pointer)(DWORD, HWND);
-  BOOL      (CALLBACK *InternetAutodialHangup_pointer)(DWORD);
-  BOOL      (CALLBACK *InternetQueryOption_pointer)(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength);
-  BOOL      (CALLBACK *InternetSetOption_pointer)(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength);
-  BOOL      (CALLBACK *InternetCheckConnection_pointer)(const TCHAR*, DWORD, DWORD);
-  BOOL      (CALLBACK *InternetCrackUrl_pointer)(const TCHAR*, DWORD, DWORD, LPURL_COMPONENTS);
-  INTERNET_STATUS_CALLBACK (CALLBACK *InternetSetStatusCallback_pointer)(HINTERNET, INTERNET_STATUS_CALLBACK);
-
-  HINSTANCE library_;
-
-  void Clear();
-
-  // Simple wrapper around GetProcAddress()
-  template <typename T>
-  bool GPA(const char* function_name, T& function_pointer);   // NO LINT
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(WinInetVTable);
-};
-
-
-class InetHttpClient : public HttpClient {
- public:
-  static InetHttpClient* Create();
-  virtual ~InetHttpClient();
-  virtual HRESULT Abort();
-  virtual uint32 GetStatus();
-  virtual HRESULT GetResponseHeader(const TCHAR* name, CString* value);
-  virtual HRESULT GetAllResponseHeaders(CString* response_headers);
-  virtual HRESULT GetResponseText(CString* response_text, uint32 max_size);
-  virtual HRESULT GetRawResponseBody(std::vector<byte>* response_body,
-                                     uint32 max_size);
-  virtual HRESULT SaveRawResponseBody(const TCHAR* response_filename,
-                                      uint32 max_size);
-  virtual HRESULT QueryProxyAuthScheme(AuthScheme* auth_scheme);
-  virtual HRESULT GetAutoProxyForUrl(const TCHAR* url, CString* proxy);
-  virtual HRESULT GetDefaultProxyConfiguration(AccessType* access_type,
-                                               CString* proxy,
-                                               CString* proxy_bypass);
- protected:
-  virtual HRESULT InternalCrackUrl(const CString& url,
-                                   bool to_escape,
-                                   URL_COMPONENTS* url_components);
-  virtual HRESULT SendRequest(const TCHAR* server,
-                              uint32 port,
-                              const TCHAR* path);
-  virtual bool CheckConnection();
- private:
-  InetHttpClient();
-  HRESULT Init();
-  void Close();
-  HRESULT SetTimeouts();
-  HRESULT SetHttpProxyCredentials(const TCHAR* username, const TCHAR* password);
-  HRESULT SkipSSLCertErrorIfNeeded();
-  HRESULT InternalSend(const TCHAR* server,
-                       uint32 port,
-                       const TCHAR* path,
-                       bool use_proxy);
-  HRESULT InternalGetRawResponseBody(std::vector<byte>* response_body,
-                                     const TCHAR* response_filename,
-                                     uint32 max_size);
-  static void CALLBACK StatusCallback(HINTERNET handle,
-                                      DWORD_PTR context,
-                                      DWORD status,
-                                      void* info,
-                                      DWORD info_len);
-
-  WinInetVTable wininet_;
-  HINTERNET session_handle_;
-  HINTERNET connection_handle_;
-  HINTERNET request_handle_;
-  uint32 status_;
-  bool is_initialized_;
-  bool is_aborted_;
-  LLock lock_;
-
-  // Parses the header "Proxy-Authenticate:"
-  static AtlRE proxy_auth_header_regex_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(InetHttpClient);
-};
-
-AtlRE InetHttpClient::proxy_auth_header_regex_(
-    _T("\\n*Proxy\\-Authenticate\\:\\b*{\\w}\\n*"), false);
-
-HttpClient* CreateInetHttpClient() {
-  return InetHttpClient::Create();
-}
-
-InetHttpClient* InetHttpClient::Create() {
-  scoped_ptr<InetHttpClient> http_client(new InetHttpClient());
-  if (http_client.get()) {
-    if (SUCCEEDED(http_client->Init())) {
-      return http_client.release();
-    }
-  }
-  return NULL;
-}
-
-InetHttpClient::InetHttpClient()
-    : session_handle_(NULL),
-      connection_handle_(NULL),
-      request_handle_(NULL),
-      status_(0),
-      is_initialized_(false),
-      is_aborted_(false) {
-}
-
-InetHttpClient::~InetHttpClient() {
-  Close();
-  wininet_.Unload();
-}
-
-HRESULT InetHttpClient::Abort() {
-  UTIL_LOG(L6, (_T("[InetHttpClient::Abort]")));
-
-  is_aborted_ = true;
-  Close();
-  return S_OK;
-}
-
-void InetHttpClient::Close() {
-  // Closing the handles will unblock all WinInet calls unless a call is
-  // waiting for DNS lookup, or in other words, when the state is where
-  // between INTERNET_STATUS_RESOLVING_NAME and INTERNET_STATUS_NAME_RESOLVED.
-  // In that case, closing the handles does not have any effect.
-  // This is also the case even we use async WinInet calls.
-
-  __mutexScope(lock_);
-
-  if (request_handle_) {
-    wininet_.InternetCloseHandle(request_handle_);
-    request_handle_ = NULL;
-  }
-
-  if (connection_handle_) {
-    wininet_.InternetCloseHandle(connection_handle_);
-    connection_handle_ = NULL;
-  }
-
-  if (session_handle_) {
-    wininet_.InternetCloseHandle(session_handle_);
-    session_handle_ = NULL;
-  }
-}
-
-HRESULT InetHttpClient::Init() {
-  if (is_initialized_) {
-    return E_UNEXPECTED;
-  }
-
-  is_initialized_ = true;
-
-  if (!wininet_.Load()) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[Failed to load wininet][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT InetHttpClient::SetTimeouts() {
-  ASSERT1(session_handle_);
-
-  uint32 connect_timeout_ms = connect_timeout_ms_;
-  uint32 send_timeout_ms = send_timeout_ms_;
-  uint32 receive_timeout_ms = receive_timeout_ms_;
-#if DEBUG
-  ConfigProfile::GetValue(kServerSettings,
-                          kConfigConnectTimeoutMs,
-                          &connect_timeout_ms);
-  ConfigProfile::GetValue(kServerSettings,
-                          kConfigSendTimeoutMs,
-                          &send_timeout_ms);
-  ConfigProfile::GetValue(kServerSettings,
-                          kConfigReceiveTimeoutMs,
-                          &receive_timeout_ms);
-#endif
-  if (connect_timeout_ms || send_timeout_ms || receive_timeout_ms) {
-    if (!wininet_.InternetSetOption(session_handle_,
-                                    INTERNET_OPTION_CONNECT_TIMEOUT,
-                                    &connect_timeout_ms,
-                                    sizeof(connect_timeout_ms))) {
-      UTIL_LOG(LEVEL_ERROR, (_T("[Failed to set connection timeout]")
-                             _T("[0x%08x]"), HRESULTFromLastError()));
-    }
-    if (!wininet_.InternetSetOption(session_handle_,
-                                    INTERNET_OPTION_SEND_TIMEOUT,
-                                    &send_timeout_ms,
-                                    sizeof(send_timeout_ms))) {
-      UTIL_LOG(LEVEL_ERROR, (_T("[Failed to set send timeout]")
-                             _T("[0x%08x]"), HRESULTFromLastError()));
-    }
-    if (!wininet_.InternetSetOption(session_handle_,
-                                    INTERNET_OPTION_RECEIVE_TIMEOUT,
-                                    &receive_timeout_ms,
-                                    sizeof(receive_timeout_ms))) {
-      UTIL_LOG(LEVEL_ERROR, (_T("[Failed to set receive timeout]")
-                             _T("[0x%08x]"), HRESULTFromLastError()));
-    }
-  }
-  return S_OK;
-}
-
-HRESULT InetHttpClient::SetHttpProxyCredentials(const TCHAR* username,
-                                                const TCHAR* password) {
-  ASSERT1(connection_handle_);
-
-  if (username && *username && password && *password) {
-    if (!wininet_.InternetSetOption(connection_handle_,
-                                    INTERNET_OPTION_PROXY_USERNAME,
-                                    const_cast<TCHAR*>(username),
-                                    _tcslen(username))) {
-      UTIL_LOG(LEVEL_ERROR, (_T("[Failed to set proxy authentication username]")
-                             _T("[0x%08x]"), HRESULTFromLastError()));
-    }
-    if (!wininet_.InternetSetOption(connection_handle_,
-                                    INTERNET_OPTION_PROXY_PASSWORD,
-                                    const_cast<TCHAR*>(password),
-                                    _tcslen(password))) {
-      UTIL_LOG(LEVEL_ERROR, (_T("[Failed to set proxy authentication password]")
-                             _T("[0x%08x]"), HRESULTFromLastError()));
-    }
-  }
-  return S_OK;
-}
-
-HRESULT InetHttpClient::SkipSSLCertErrorIfNeeded() {
-#if DEBUG
-  ASSERT1(request_handle_);
-
-  bool ignore_certificate_errors = false;
-  ConfigProfile::GetValue(kServerSettings,
-                          kConfigSecurityIgnoreCertificateErrors,
-                          &ignore_certificate_errors);
-  if (ignore_certificate_errors) {
-    UTIL_LOG(L6, (_T("[InetHttpClient::SkipSSLCertErrorIfNeeded]")
-                  _T("[ignore certificate error]")));
-    DWORD flags = 0;
-    DWORD flags_len = sizeof(flags);
-    if (wininet_.InternetQueryOption(request_handle_,
-                                     INTERNET_OPTION_SECURITY_FLAGS,
-                                     &flags,
-                                     &flags_len)) {
-      flags |= SECURITY_FLAG_IGNORE_UNKNOWN_CA |
-               SECURITY_FLAG_IGNORE_CERT_CN_INVALID;
-      if (!wininet_.InternetSetOption(request_handle_,
-                                      INTERNET_OPTION_SECURITY_FLAGS,
-                                      &flags,
-                                      sizeof(flags))) {
-        UTIL_LOG(LEVEL_ERROR, (_T("[Failed to set ignore SSL cert error]")
-                               _T("[0x%08x]"), HRESULTFromLastError()));
-      }
-    } else {
-      UTIL_LOG(LEVEL_ERROR, (_T("[InternetQueryOption failed]")
-                             _T("[0x%08x]"), HRESULTFromLastError()));
-    }
-  }
-#endif
-
-  return S_OK;
-}
-
-HRESULT InetHttpClient::SendRequest(const TCHAR* server,
-                                    uint32 port,
-                                    const TCHAR* path) {
-  ASSERT1(server && *server);
-  ASSERT1(path && *path);
-
-  UTIL_LOG(L6, (_T("[InetHttpClient::SendRequest]")
-                _T("[%s:%u%s]"), server, port, path));
-
-  // When we are using WinInet http client, we will encouter auto-dial if the
-  // user sets "Always dial my default connection" in Internet Explorer.
-  // To fix this problem, we will check whether there is an active Internet
-  // connection first.
-  if (!IsMachineConnected()) {
-    return HRESULT_FROM_WIN32(ERROR_INTERNET_CANNOT_CONNECT);
-  }
-
-  HRESULT hr = S_OK;
-
-  for (uint32 i = 0; i < 1 + retries_; ++i) {
-    if (i > 0) {
-      ::Sleep(retry_delay_ms_);
-      UTIL_LOG(L6, (_T("[InetHttpClient::SendRequest - retry %u]"), i));
-    }
-
-    hr = InternalSend(server, port, path, true);
-    if (retry_without_proxy_ && !proxy_server_.IsEmpty() &&
-        (FAILED(hr) || (status_ != HTTP_STATUS_OK &&
-                        status_ != HTTP_STATUS_NOT_MODIFIED))) {
-      UTIL_LOG(L6, (_T("[failed with proxy]")
-                    _T("[%s][%u][0x%08x]"), proxy_server_, hr));
-      hr = InternalSend(server, port, path, false);
-      if (SUCCEEDED(hr)) {
-        UTIL_LOG(L6, (_T("[switch to direct connection]")));
-        GetProxyConfig()->SwitchAutoProxyToDirectConnection();
-      }
-    }
-    if (SUCCEEDED(hr)) {
-      break;
-    }
-  }
-
-  if (FAILED(hr)) {
-    // Convert hresults to be of the CI_E format.
-    // If you need to be aware of another error code, then
-    // add another CI_E_ error to this type of switch statment
-    // in every HttpClient::Send method.
-    //
-    // __HRESULT_FROM_WIN32 will always be a macro where as
-    // HRESULT_FROM_WIN32 can be an inline function. Using HRESULT_FROM_WIN32
-    // can break the switch statement.
-    //
-    // TODO(omaha):  refactor weird switch.
-    switch (hr) {
-      case __HRESULT_FROM_WIN32(ERROR_INTERNET_SEC_CERT_DATE_INVALID):
-        hr = CI_E_HTTPS_CERT_FAILURE;
-        break;
-    }
-  }
-
-  return hr;
-}
-
-HRESULT InetHttpClient::InternalSend(const TCHAR* server,
-                                     uint32 port,
-                                     const TCHAR* path,
-                                     bool use_proxy) {
-  ASSERT1(server && *server);
-  ASSERT1(path && *path);
-
-  UTIL_LOG(L6, (_T("[InetHttpClient::InternalSend]")
-                _T("[%s:%u%s][%u]"), server, port, path, use_proxy));
-
-  HRESULT hr = S_OK;
-
-  // Close all handles from previous request.
-  Close();
-
-  // Open the Internet session.
-  if (!use_proxy ||  proxy_server_.IsEmpty()) {
-    session_handle_ = wininet_.InternetOpen(NULL,
-                                            INTERNET_OPEN_TYPE_DIRECT,
-                                            NULL,
-                                            NULL,
-                                            0);
-  } else {
-    session_handle_ = wininet_.InternetOpen(NULL,
-                                            INTERNET_OPEN_TYPE_PROXY,
-                                            proxy_server_,
-                                            NULL,
-                                            0);
-  }
-  if (!session_handle_) {
-    hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[InternetOpen failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  if (is_aborted_) {
-    return E_ABORT;
-  }
-
-  // Set timeouts.
-  SetTimeouts();
-
-  if (is_aborted_) {
-    return E_ABORT;
-  }
-
-  // Connect to the server
-  connection_handle_ = wininet_.InternetConnect(
-                                    session_handle_,
-                                    server,
-                                    static_cast<INTERNET_PORT>(port),
-                                    NULL,
-                                    NULL,
-                                    INTERNET_SERVICE_HTTP,
-                                    0,
-                                    NULL);
-  if (!connection_handle_) {
-    hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[InternetConnect failed]")
-                           _T("[%s:%u%s][0x%08x]"), server, port, path, hr));
-    return hr;
-  }
-
-  if (is_aborted_) {
-    return E_ABORT;
-  }
-
-  // Set proxy credentials.
-  if (use_proxy) {
-    SetHttpProxyCredentials(proxy_auth_username_, proxy_auth_password_);
-  }
-
-  if (is_aborted_) {
-    return E_ABORT;
-  }
-
-  // Prepare the flags.
-  DWORD flags = no_cache_ ? kInternetRequestNoCacheDefaultFlags :
-                            kInternetRequestCachingDefaultFlags;
-  if (port == kDefaultSslProxyPort) {
-    flags |= INTERNET_FLAG_SECURE;
-  }
-
-  // Send the request. A context is required otherwise the callback won't happen
-  // even if the WinInet is used in synchronous mode.
-  DWORD_PTR context = reinterpret_cast<DWORD_PTR>(this);
-  if (post_data_.empty()) {
-    // For GET.
-    request_handle_ = wininet_.HttpOpenRequest(connection_handle_,
-                                               kHttpGetMethod,
-                                               path,
-                                               NULL,
-                                               NULL,
-                                               NULL,
-                                               flags,
-                                               context);
-    if (!request_handle_) {
-      hr = HRESULTFromLastError();
-      UTIL_LOG(LEVEL_ERROR, (_T("[HttpOpenRequest failed to open GET request]")
-                             _T("[%s:%u%s][0x%08x]"), server, port, path, hr));
-      return hr;
-    }
-
-    INTERNET_STATUS_CALLBACK old_callback =
-        wininet_.InternetSetStatusCallback(request_handle_, &StatusCallback);
-    ASSERT1(old_callback == NULL);
-    if (old_callback != INTERNET_INVALID_STATUS_CALLBACK) {
-      UTIL_LOG(L6, (_T("[InternetSetStatusCallback succeeded]")
-                    _T("[0x%08x]"), request_handle_));
-    } else {
-      hr = HRESULTFromLastError();
-      UTIL_LOG(LEVEL_WARNING, (_T("[InternetSetStatusCallback failed]")
-                               _T("[%s:%u%s][0x%08x]"),
-                               server, port, path, hr));
-    }
-
-    if (is_aborted_) {
-      return E_ABORT;
-    }
-
-    if (port == kDefaultSslProxyPort) {
-      SkipSSLCertErrorIfNeeded();
-    }
-
-    if (is_aborted_) {
-      return E_ABORT;
-    }
-
-    if (!wininet_.HttpSendRequest(request_handle_,
-                                  additional_headers_.GetString(),
-                                  additional_headers_.GetLength(),
-                                  NULL,
-                                  0)) {
-      hr = HRESULTFromLastError();
-      UTIL_LOG(LEVEL_ERROR, (_T("[HttpSendRequest failed to send GET request]")
-                             _T("[%s:%u%s][0x%08x]"), server, port, path, hr));
-
-      // Occasionally setting the option to skip SSL certificate error before
-      // sending the request does not work. We have to set it again after
-      // failed to send the request.
-      if (port == kDefaultSslProxyPort) {
-        SkipSSLCertErrorIfNeeded();
-        if (!wininet_.HttpSendRequest(request_handle_,
-                                      additional_headers_.GetString(),
-                                      additional_headers_.GetLength(),
-                                      NULL,
-                                      0)) {
-          hr = HRESULTFromLastError();
-          UTIL_LOG(LEVEL_ERROR, (_T("[HttpSendRequest failed to resend GET]")
-                                 _T("[%s:%u%s][0x%08x]"),
-                                 server, port, path, hr));
-        } else {
-          hr = S_OK;
-        }
-      }
-
-      if (FAILED(hr)) {
-        return hr;
-      }
-    }
-  } else {
-    // For post
-    request_handle_ = wininet_.HttpOpenRequest(connection_handle_,
-                                               kHttpPostMethod,
-                                               path,
-                                               NULL,
-                                               NULL,
-                                               NULL,
-                                               flags,
-                                               context);
-    if (!request_handle_) {
-      hr = HRESULTFromLastError();
-      UTIL_LOG(LEVEL_ERROR, (_T("[HttpOpenRequest failed to open POST request]")
-                             _T("[%s:%u%s][0x%08x]"), server, port, path, hr));
-      return hr;
-    }
-
-    INTERNET_STATUS_CALLBACK old_callback =
-        wininet_.InternetSetStatusCallback(request_handle_, StatusCallback);
-    ASSERT1(old_callback == NULL);
-    if (old_callback != INTERNET_INVALID_STATUS_CALLBACK) {
-      UTIL_LOG(L6, (_T("[InternetSetStatusCallback succeeded]")
-                    _T("[0x%08x]"), request_handle_));
-    } else {
-      hr = HRESULTFromLastError();
-      UTIL_LOG(LEVEL_WARNING, (_T("[InternetSetStatusCallback failed]")
-                               _T("[%s:%u%s][0x%08x]"),
-                               server, port, path, hr));
-    }
-
-    if (is_aborted_) {
-      return E_ABORT;
-    }
-
-    SkipSSLCertErrorIfNeeded();
-
-    if (is_aborted_) {
-      return E_ABORT;
-    }
-
-    if (!wininet_.HttpSendRequest(request_handle_,
-                                  additional_headers_.GetString(),
-                                  additional_headers_.GetLength(),
-                                  &post_data_.front(),
-                                  post_data_.size())) {
-      hr = HRESULTFromLastError();
-      UTIL_LOG(LEVEL_ERROR, (_T("[HttpSendRequest failed to send POST request]")
-                             _T("[%s:%u%s][0x%08x]"), server, port, path, hr));
-      return hr;
-    }
-  }
-
-  if (is_aborted_) {
-    return E_ABORT;
-  }
-
-  // Get the response status.
-  DWORD value = 0;
-  DWORD value_size = sizeof(value);
-  if (!wininet_.HttpQueryInfo(request_handle_,
-                              HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER,
-                              &value,
-                              &value_size,
-                              0)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[HttpQueryInfo failed to get status]")
-                           _T("[%s:%u%s][0x%08x]"), server, port, path, hr));
-    return hr;
-  }
-
-  status_ = static_cast<uint32>(value);
-  return S_OK;
-}
-
-uint32 InetHttpClient::GetStatus() {
-  return status_;
-}
-
-HRESULT InetHttpClient::GetResponseHeader(const TCHAR* name, CString* value) {
-  ASSERT1(name && *name);
-  ASSERT1(value);
-
-  if (!status_) {
-    return E_FAIL;
-  }
-
-  HRESULT hr = S_OK;
-
-  value->SetString(name);
-  TCHAR* buf = value->GetBuffer();
-  DWORD size = value->GetLength() * sizeof(TCHAR);
-  if (wininet_.HttpQueryInfo(request_handle_,
-                             HTTP_QUERY_CUSTOM,
-                             buf,
-                             &size,
-                             0)) {
-    value->ReleaseBuffer(size / sizeof(TCHAR));
-  } else {
-    DWORD error = ::GetLastError();
-    if (error == ERROR_INSUFFICIENT_BUFFER) {
-      buf = value->GetBufferSetLength(size / sizeof(TCHAR));
-      if (!wininet_.HttpQueryInfo(request_handle_,
-                                  HTTP_QUERY_CUSTOM,
-                                  buf,
-                                  &size,
-                                  0)) {
-        hr = HRESULTFromLastError();
-        UTIL_LOG(LEVEL_ERROR, (_T("[HttpQueryInfo failed][0x%08x]"), hr));
-      }
-      value->ReleaseBuffer(size / sizeof(TCHAR));
-    } else {
-      hr = HRESULT_FROM_WIN32(error);
-      UTIL_LOG(LEVEL_ERROR, (_T("[HttpQueryInfo failed][0x%08x]"), hr));
-    }
-  }
-
-  return hr;
-}
-
-HRESULT InetHttpClient::GetAllResponseHeaders(CString* response_headers) {
-  ASSERT1(response_headers);
-  ASSERT1(request_handle_);
-
-  if (!status_) {
-    return E_FAIL;
-  }
-
-  HRESULT hr = S_OK;
-
-  DWORD size = 0;
-  if (!wininet_.HttpQueryInfo(request_handle_,
-                              HTTP_QUERY_RAW_HEADERS_CRLF,
-                              NULL,
-                              &size,
-                              0)) {
-    DWORD error = ::GetLastError();
-    if (error == ERROR_INSUFFICIENT_BUFFER) {
-      TCHAR* buf = response_headers->GetBufferSetLength(size / sizeof(TCHAR));
-      if (!wininet_.HttpQueryInfo(request_handle_,
-                                  HTTP_QUERY_RAW_HEADERS_CRLF,
-                                  buf,
-                                  &size,
-                                  0)) {
-        hr = HRESULTFromLastError();
-        UTIL_LOG(LEVEL_ERROR, (_T("[HttpQueryInfo failed][0x%08x]"), hr));
-      }
-      response_headers->ReleaseBuffer(size / sizeof(TCHAR));
-    } else {
-      hr = HRESULT_FROM_WIN32(error);
-      UTIL_LOG(LEVEL_ERROR, (_T("[HttpQueryInfo failed][0x%08x]"), hr));
-    }
-  }
-
-  return hr;
-}
-
-HRESULT InetHttpClient::GetResponseText(CString* response_text,
-                                        uint32 max_size) {
-  ASSERT1(response_text);
-  ASSERT1(request_handle_);
-
-  if (!status_) {
-    return E_FAIL;
-  }
-
-  const int kBufferSize = 1024;
-  char buffer[kBufferSize] = {0};
-
-  CStringA ansi_response_text;
-  uint32 size = 0;
-  while (true) {
-    if (is_aborted_) {
-      return E_ABORT;
-    }
-
-    DWORD bytes_read = 0;
-    if (wininet_.InternetReadFile(request_handle_,
-                                  buffer,
-                                  kBufferSize,
-                                  &bytes_read) && bytes_read) {
-      size += bytes_read;
-      if (max_size && size > max_size) {
-        return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
-      }
-      ansi_response_text.Append(buffer, bytes_read);
-    } else {
-      break;
-    }
-  }
-
-  response_text->SetString(Utf8ToWideChar(ansi_response_text.GetString(),
-                                          ansi_response_text.GetLength()));
-
-  return S_OK;
-}
-
-HRESULT InetHttpClient::GetRawResponseBody(std::vector<byte>* response_body,
-                                           uint32 max_size) {
-  return InternalGetRawResponseBody(response_body, NULL, max_size);
-}
-
-HRESULT InetHttpClient::SaveRawResponseBody(const TCHAR* response_filename,
-                                            uint32 max_size) {
-  return InternalGetRawResponseBody(NULL, response_filename, max_size);
-}
-
-HRESULT InetHttpClient::InternalGetRawResponseBody(
-                            std::vector<byte>* response_body,
-                            const TCHAR* response_filename,
-                            uint32 max_size) {
-  ASSERT((response_body != NULL) ^ (response_filename != NULL), (_T("")));
-  ASSERT1(request_handle_);
-
-  if (!status_) {
-    return E_FAIL;
-  }
-
-  HRESULT hr = S_OK;
-  scoped_hfile file;
-
-  if (response_body) {
-    response_body->clear();
-  } else {
-    reset(file, ::CreateFile(response_filename,
-                             FILE_WRITE_DATA,
-                             0,
-                             NULL,
-                             CREATE_ALWAYS,
-                             0,
-                             NULL));
-    if (!file) {
-      return HRESULTFromLastError();
-    }
-  }
-
-  const int kBufferSize = 1024;
-  char buffer[kBufferSize];
-  uint32 size = 0;
-  while (true) {
-    if (is_aborted_) {
-      return E_ABORT;
-    }
-
-    DWORD bytes_read = 0;
-    if (wininet_.InternetReadFile(request_handle_,
-                                  buffer,
-                                  kBufferSize,
-                                  &bytes_read) && bytes_read) {
-      size += bytes_read;
-      if (max_size && size > max_size) {
-        return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
-      }
-      if (response_body) {
-        response_body->insert(response_body->end(),
-                              buffer,
-                              buffer + bytes_read);
-      } else {
-        DWORD bytes_written = 0;
-        if (!::WriteFile(get(file), buffer, bytes_read, &bytes_written, NULL)) {
-          hr = HRESULTFromLastError();
-          break;
-        }
-      }
-    } else {
-      break;
-    }
-  }
-
-  return hr;
-}
-
-HRESULT InetHttpClient::QueryProxyAuthScheme(AuthScheme* auth_scheme) {
-  ASSERT1(auth_scheme);
-
-  *auth_scheme = NO_AUTH_SCHEME;
-
-  // Find out authentication scheme by communicating with google server via
-  // proxy server and checking the response header to find out the
-  // authentication scheme the proxy server requires.
-
-  // Send the request to query google server only if we have not got 407 error.
-  HRESULT hr = S_OK;
-  if (status_ != HTTP_STATUS_PROXY_AUTH_REQ) {
-    hr = SendRequest(kGoogleHttpServer, kDefaultHttpProxyPort, _T("/"));
-  }
-  if (SUCCEEDED(hr) && status_ == HTTP_STATUS_PROXY_AUTH_REQ) {
-    CString response_headers;
-    hr = GetAllResponseHeaders(&response_headers);
-    if (SUCCEEDED(hr)) {
-      const TCHAR* response_headers_str = response_headers.GetString();
-      CString auth_scheme_str;
-      AuthScheme curr_auth_scheme = NO_AUTH_SCHEME;
-      while (AtlRE::FindAndConsume(&response_headers_str,
-                                   proxy_auth_header_regex_,
-                                   &auth_scheme_str)) {
-        AuthScheme other_auth_scheme = NO_AUTH_SCHEME;
-        if (auth_scheme_str.CompareNoCase(kNegotiateAuthScheme) == 0) {
-          other_auth_scheme = AUTH_SCHEME_NEGOTIATE;
-        } else if (auth_scheme_str.CompareNoCase(kNTLMAuthScheme) == 0) {
-          other_auth_scheme = AUTH_SCHEME_NTLM;
-        } else if (auth_scheme_str.CompareNoCase(kDigestAuthScheme) == 0) {
-          other_auth_scheme = AUTH_SCHEME_DIGEST;
-        } else if (auth_scheme_str.CompareNoCase(kBasicAuthScheme) == 0) {
-          other_auth_scheme = AUTH_SCHEME_BASIC;
-        } else {
-          other_auth_scheme = UNKNOWN_AUTH_SCHEME;
-        }
-        if (static_cast<int>(other_auth_scheme) >
-            static_cast<int>(curr_auth_scheme)) {
-          curr_auth_scheme = other_auth_scheme;
-        }
-      }
-      *auth_scheme = curr_auth_scheme;
-      return S_OK;
-    }
-  }
-
-  return E_FAIL;
-}
-
-// We do not support Auto-proxy for WinInet because jsproxy.dll seems to be
-// very instable and cause crashes from time to time.
-HRESULT InetHttpClient::GetAutoProxyForUrl(const TCHAR*, CString*) {
-  return E_NOTIMPL;
-}
-
-HRESULT InetHttpClient::GetDefaultProxyConfiguration(AccessType* access_type,
-                                                     CString* proxy,
-                                                     CString* proxy_bypass) {
-  DWORD size_needed = 0;
-  if (wininet_.InternetQueryOption(NULL,
-                                   INTERNET_OPTION_PROXY,
-                                   NULL,
-                                   &size_needed) ||
-      ::GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
-    UTIL_LOG(LEVEL_ERROR, (_T("[InternetQueryOption failed]")));
-    return E_FAIL;
-  }
-
-  scoped_array<byte> proxy_info_buffer(new byte[size_needed]);
-  if (!wininet_.InternetQueryOption(NULL,
-                                    INTERNET_OPTION_PROXY,
-                                    proxy_info_buffer.get(),
-                                    &size_needed)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[InternetQueryOption failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  INTERNET_PROXY_INFO* proxy_info = reinterpret_cast<INTERNET_PROXY_INFO*>(
-                                        proxy_info_buffer.get());
-
-  if (access_type) {
-    if (proxy_info->dwAccessType == INTERNET_OPEN_TYPE_DIRECT) {
-      *access_type = NO_PROXY;
-    } else if (proxy_info->dwAccessType == INTERNET_OPEN_TYPE_PROXY) {
-      *access_type = NAMED_PROXY;
-    } else {
-      *access_type = AUTO_PROXY_AUTO_DETECT;
-    }
-  }
-
-  if (proxy) {
-    // proxy_info->lpszProxy points to an ASCII string.
-    *proxy = reinterpret_cast<const char*>(proxy_info->lpszProxy);
-  }
-
-  if (proxy_bypass) {
-    // proxy_info->lpszProxyBypass points to an ASCII string.
-    *proxy_bypass = reinterpret_cast<const char*>(proxy_info->lpszProxyBypass);
-  }
-
-  return S_OK;
-}
-
-// TODO(omaha): check connection by requesting a well known url instead of
-// using WinInet. The WinInet code does an ICMP ping apparently, which is
-// usually blocked by firewalls.
-bool InetHttpClient::CheckConnection() {
-  return wininet_.InternetCheckConnection(
-      kHttpProtoScheme kProtoSuffix kGoogleHttpServer _T("/"),
-      FLAG_ICC_FORCE_CONNECTION, 0) == TRUE;
-}
-
-HRESULT InetHttpClient::InternalCrackUrl(const CString& url, bool to_escape,
-                                         URL_COMPONENTS* url_components) {
-  ASSERT(!url.IsEmpty(), (_T("")));
-  ASSERT1(url_components);
-
-  if (!wininet_.InternetCrackUrl(url.GetString(),
-                                 url.GetLength(),
-                                 to_escape ? ICU_ESCAPE : 0,
-                                 url_components)) {
-    HRESULT hr = HRESULTFromLastError();
-    UTIL_LOG(LEVEL_ERROR, (_T("[InternetCrackUrl failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-void CALLBACK InetHttpClient::StatusCallback(HINTERNET handle,
-                                             DWORD_PTR context,
-                                             DWORD status,
-                                             void* info,
-                                             DWORD info_len) {
-  // Unlike WinHttp, the ip addresses are not unicode strings.
-  CString info_string;
-  switch (status) {
-    case INTERNET_STATUS_RESOLVING_NAME:
-      status = CALLBACK_STATUS_RESOLVING_NAME;
-      break;
-    case INTERNET_STATUS_NAME_RESOLVED:
-      info_string = static_cast<char*>(info);
-      info = info_string.GetBuffer();
-      status = CALLBACK_STATUS_NAME_RESOLVED;
-      break;
-    case INTERNET_STATUS_CONNECTING_TO_SERVER:
-      info_string = static_cast<char*>(info);
-      info = info_string.GetBuffer();
-      status = CALLBACK_STATUS_CONNECTING_TO_SERVER;
-      break;
-    case INTERNET_STATUS_CONNECTED_TO_SERVER:
-      info_string = static_cast<char*>(info);
-      info = info_string.GetBuffer();
-      status = CALLBACK_STATUS_CONNECTED_TO_SERVER;
-      break;
-    case INTERNET_STATUS_SENDING_REQUEST:
-      status = CALLBACK_STATUS_SENDING_REQUEST;
-      break;
-    case INTERNET_STATUS_REQUEST_SENT:
-      status = CALLBACK_STATUS_REQUEST_SENT;
-      break;
-    case INTERNET_STATUS_RECEIVING_RESPONSE:
-      status = CALLBACK_STATUS_RECEIVING_RESPONSE;
-      break;
-    case INTERNET_STATUS_RESPONSE_RECEIVED:
-      status = CALLBACK_STATUS_RESPONSE_RECEIVED;
-      break;
-    case INTERNET_STATUS_CLOSING_CONNECTION:
-      status = CALLBACK_STATUS_CLOSING_CONNECTION;
-      break;
-    case INTERNET_STATUS_CONNECTION_CLOSED:
-      status = CALLBACK_STATUS_CONNECTION_CLOSED;
-      break;
-    case INTERNET_STATUS_REDIRECT:
-      status = CALLBACK_STATUS_REDIRECT;
-      break;
-    default:
-      return;
-  };
-  HttpClient::StatusCallback(handle, context, status, info, info_len);
-}
-
-// WinInetVTable: delay-loading of WININET.DLL.
-// Handling of and protection of Wininet APIs.
-//   Dynamically load to wininet.dll.
-//   Wrap all calls in an Structured Exception handler - wininet is buggy and
-//   throws access violations
-WinInetVTable::WinInetVTable() { Clear(); }
-WinInetVTable::~WinInetVTable() { Unload(); }
-
-template <typename T>
-bool WinInetVTable::GPA(const char* function_name,
-                        T& function_pointer) {      // NO LINT
-  ASSERT(function_name, (L""));
-  function_pointer = reinterpret_cast<T>(::GetProcAddress(library_,
-                                                          function_name));
-  return NULL != function_pointer;
-}
-
-bool WinInetVTable::Load() {
-  if (Loaded()) {
-    return true;
-  }
-
-  Clear();
-
-  {
-    library_ = ::LoadLibrary(_T("wininet"));
-  }
-  if (!library_) {
-    return false;
-  }
-
-  bool all_valid = (
-         GPA("HttpAddRequestHeadersW",       HttpAddRequestHeaders_pointer))
-      & (GPA("HttpEndRequestW",              HttpEndRequest_pointer))
-      & (GPA("HttpOpenRequestW",             HttpOpenRequest_pointer))
-      & (GPA("HttpQueryInfoW",               HttpQueryInfo_pointer))
-      & (GPA("HttpSendRequestExW",           HttpSendRequestEx_pointer))
-      & (GPA("HttpSendRequestW",             HttpSendRequest_pointer))
-      & (GPA("InternetCloseHandle",          InternetCloseHandle_pointer))
-      & (GPA("InternetConnectW",             InternetConnect_pointer))
-      & (GPA("InternetGetConnectedStateExW", InternetGetConnectedStateEx_pointer))
-      & (GPA("InternetOpenW",                InternetOpen_pointer))
-      & (GPA("InternetOpenUrlW",             InternetOpenUrl_pointer))
-      & (GPA("InternetQueryDataAvailable",   InternetQueryDataAvailable_pointer))
-      & (GPA("InternetReadFile",             InternetReadFile_pointer))
-      & (GPA("InternetReadFileExW",          InternetReadFileEx_pointer))
-      & (GPA("InternetSetStatusCallbackW",   InternetSetStatusCallback_pointer))
-      & (GPA("InternetGetCookieW",           InternetGetCookie_pointer))
-      & (GPA("InternetSetCookieW",           InternetSetCookie_pointer))
-      & (GPA("InternetAutodial",             InternetAutodial_pointer))
-      & (GPA("InternetAutodialHangup",       InternetAutodialHangup_pointer))
-      & (GPA("InternetQueryOptionW",         InternetQueryOption_pointer))
-      & (GPA("InternetSetOptionW",           InternetSetOption_pointer))
-      & (GPA("InternetCheckConnectionW",     InternetCheckConnection_pointer))
-      & (GPA("InternetCrackUrlW",            InternetCrackUrl_pointer));
-
-  if (!all_valid) {
-    Unload();
-  }
-
-  return all_valid;
-}
-
-void WinInetVTable::Unload() {
-  if (library_) {
-    ::FreeLibrary(library_);
-    library_ = NULL;
-  }
-  Clear();
-}
-
-void WinInetVTable::Clear() {
-  ::memset(this, 0, sizeof(*this));
-}
-
-#define PROTECT_WRAP(function, proto, call, result_type, result_error_value)  \
-result_type WinInetVTable::function proto {                  \
-    result_type result;                                      \
-    __try {                                                  \
-      result = function##_pointer call;                      \
-    }                                                        \
-    __except(EXCEPTION_EXECUTE_HANDLER) {                    \
-      result = result_error_value;                           \
-    }                                                        \
-    return result;                                           \
-}
-
-PROTECT_WRAP(HttpAddRequestHeaders, (HINTERNET a, const TCHAR* b, DWORD c, DWORD d), (a, b, c, d), BOOL, FALSE);
-PROTECT_WRAP(HttpEndRequest, (HINTERNET a, LPINTERNET_BUFFERS b, DWORD c, DWORD_PTR d), (a, b, c, d), BOOL, FALSE);
-PROTECT_WRAP(HttpOpenRequest, (HINTERNET a, const TCHAR* b, const TCHAR* c, const TCHAR* d, const TCHAR* e, const TCHAR** f, DWORD g, DWORD_PTR h), (a, b, c, d, e, f, g, h), HINTERNET, NULL);
-PROTECT_WRAP(HttpQueryInfo, (HINTERNET a, DWORD b, LPVOID c, LPDWORD d, LPDWORD e), (a, b, c, d, e), BOOL, FALSE);
-PROTECT_WRAP(HttpSendRequestEx, (HINTERNET a, LPINTERNET_BUFFERS b, LPINTERNET_BUFFERS c, DWORD d, DWORD_PTR e), (a, b, c, d, e), BOOL, FALSE);
-PROTECT_WRAP(HttpSendRequest, (HINTERNET a, const TCHAR* b, DWORD c, LPVOID d, DWORD e), (a, b, c, d, e), BOOL, FALSE);
-PROTECT_WRAP(InternetCloseHandle, (HINTERNET a), (a), BOOL, FALSE);
-PROTECT_WRAP(InternetConnect, (HINTERNET a, const TCHAR* b, INTERNET_PORT c, const TCHAR* d, const TCHAR* e, DWORD f, DWORD g, DWORD h), (a, b, c, d, e, f, g, h), HINTERNET, NULL);
-PROTECT_WRAP(InternetGetConnectedStateEx, (LPDWORD a, char* b, DWORD c, DWORD d), (a, b, c, d), BOOL, FALSE);
-PROTECT_WRAP(InternetOpen, (const TCHAR* a, DWORD b, const TCHAR* c, const TCHAR* d, DWORD e), (a, b, c, d, e), HINTERNET, NULL);
-PROTECT_WRAP(InternetOpenUrl, (HINTERNET a, const TCHAR* b, const TCHAR* c, DWORD d, DWORD e, DWORD_PTR f), (a, b, c, d, e, f), HINTERNET, NULL);
-PROTECT_WRAP(InternetQueryDataAvailable, (HINTERNET a, LPDWORD b, DWORD c, DWORD d), (a, b, c, d), BOOL, FALSE);
-PROTECT_WRAP(InternetReadFile, (HINTERNET a, LPVOID b, DWORD c, LPDWORD d), (a, b, c, d), BOOL, FALSE);
-PROTECT_WRAP(InternetReadFileEx, (HINTERNET a, LPINTERNET_BUFFERS b, DWORD c, DWORD_PTR d), (a, b, c, d), HINTERNET, NULL);
-PROTECT_WRAP(InternetSetStatusCallback, (HINTERNET a, INTERNET_STATUS_CALLBACK b), (a, b), INTERNET_STATUS_CALLBACK, INTERNET_INVALID_STATUS_CALLBACK);
-PROTECT_WRAP(InternetGetCookie, (const TCHAR* a, const TCHAR* b, TCHAR* c, LPDWORD d), (a, b, c, d), BOOL, FALSE);
-PROTECT_WRAP(InternetSetCookie, (const TCHAR* a, const TCHAR* b, const TCHAR* c), (a, b, c), BOOL, FALSE);
-PROTECT_WRAP(InternetAutodial, (DWORD a, HWND b), (a, b), BOOL, FALSE);
-PROTECT_WRAP(InternetAutodialHangup, (DWORD a), (a), BOOL, FALSE);
-PROTECT_WRAP(InternetQueryOption, (HINTERNET a, DWORD b, LPVOID c, LPDWORD d), (a, b, c, d), BOOL, FALSE);
-PROTECT_WRAP(InternetSetOption, (HINTERNET a, DWORD b, LPVOID c, DWORD d), (a, b, c, d), BOOL, FALSE);
-PROTECT_WRAP(InternetCheckConnection, (const TCHAR* a, DWORD b, DWORD c), (a, b, c), BOOL, FALSE);
-PROTECT_WRAP(InternetCrackUrl, (const TCHAR* a, DWORD b, DWORD c, LPURL_COMPONENTS d), (a, b, c, d), BOOL, FALSE);
-#endif
-
diff --git a/official/README.txt b/official/README.txt
deleted file mode 100644
index 125f0e8..0000000
--- a/official/README.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-The set of files under omaha\official contains the differences between the
-public Omaha release and the official Google Update.  If you are interested in
-building your own Google Update executable, simply copy the contents of this
-directory tree over the one below it.
diff --git a/official/base/const_object_names.h b/official/base/const_object_names.h
deleted file mode 100644
index 5afde3c..0000000
--- a/official/base/const_object_names.h
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Kernel object names.
-
-#ifndef OMAHA_BASE_CONST_OBJECT_NAMES_H_
-#define OMAHA_BASE_CONST_OBJECT_NAMES_H_
-
-#include <tchar.h>
-#include "omaha/base/constants.h"
-
-namespace omaha {
-
-// The prefix to use for global names in the win32 API's.
-const TCHAR* const kGlobalPrefix = _T("Global\\G");
-
-const TCHAR kCrashPipeNamePrefix[] =
-    _T("\\\\.\\pipe\\") SHORT_COMPANY_NAME _T("CrashServices");
-
-// Ensures that only one instance of machine or user Omaha is trying to setup at
-// a time.
-const TCHAR* const kSetupMutex = _T("{A9A86B93-B54E-4570-BE89-42418507707B}");
-
-// TODO(omaha3): Update this comment.
-// Signals the process to exit. Currently the core and the worker listen to
-// this event.
-// TODO(omaha): Consider making all our processes listen to it. Maybe not the
-// service, since the SCM controls the life time of the service.
-const TCHAR* const kShutdownEvent =
-    _T("{A0C1F415-D2CE-4ddc-9B48-14E56FD55162}");
-
-// This is for Omaha2 backwards compatibility.
-// The installed Omaha3 handoff process sets an event to tell an Omaha2 setup
-// worker running from the temp directory that a UI has been displayed so that
-// the Omaha2 worker will not display a second UI on error. The event's name is
-// passed in this environment variable name by the Omaha2 worker.
-const TCHAR* const kLegacyUiDisplayedEventEnvironmentVariableName =
-    _T("GOOGLE_UPDATE_UI_DISPLAYED_EVENT_NAME");
-
-// Ensures the Core only runs one instance per machine and one instance per
-// each user session.
-const TCHAR* const kCoreSingleInstance =
-    _T("{B5665124-2B19-40e2-A7BC-B44321E72C4B}");
-
-// Ensures the Crash Handler only runs one instance per machine and one
-// instance per each user session.
-const TCHAR* const kCrashHandlerSingleInstance =
-    _T("{C4F406E5-F024-4e3f-89A7-D5AB7663C3CD}");
-
-// Ensures the /ua process only runs one instance per machine and one
-// instance per each user session.
-const TCHAR* const kUpdateAppsSingleInstance =
-    _T("{D0BB2EF1-C183-4cdb-B218-040922092869}");
-
-// Ensures only one installer for an app is running in a session.
-// The %s is replaced with the application ID.
-const TCHAR* const kInstallAppSingleInstance =
-    _T("%s-{F707E94F-D66B-4525-AD84-B1DA87D6A971}");
-
-// Ensures the GoogleUpdate3 server only runs one instance per machine and one
-// instance per each user session.
-const TCHAR* const kGoogleUpdate3SingleInstance =
-    _T("{6885AE8E-C070-458d-9711-37B9BEAB65F6}");
-
-// TODO(omaha): Delete Job Object code.
-
-// Base name of job object for Setup phase 1 processes except self updates.
-// These may not be running as Local System for machine installs like
-// self-updates do.
-const TCHAR* const kSetupPhase1NonSelfUpdateJobObject =
-    _T("{5A913EF1-4160-48bc-B688-4D67EAEB698A}");
-
-// Base name of job object for interactive install processes except /install.
-const TCHAR* const kAppInstallJobObject =
-    _T("{8AD051DB-4FE6-458b-B103-7DCC78D56013}");
-
-// Base name of job object for silent processes that are okay to kill.
-const TCHAR* const kSilentJobObject =
-    _T("{A2300FD6-CBED-48a6-A3CB-B35C38A42F8E}");
-
-// Base name of job object for silent processes that should not be killed.
-const TCHAR* const kSilentDoNotKillJobObject =
-    _T("{D33A8A53-F57D-4fd9-A32D-238FD69B4BC4}");
-
-// The global lock to ensure that a single app is being installed for this
-// user/machine at a given time.
-const TCHAR* const kInstallManagerSerializer =
-    _T("{0A175FBE-AEEC-4fea-855A-2AA549A88846}");
-
-// Serializes access to metrics stores, machine and user, respectively.
-const TCHAR* const kMetricsSerializer =
-    _T("{C68009EA-1163-4498-8E93-D5C4E317D8CE}");
-
-// Serializes access to the global network configuration, such as the CUP keys.
-const TCHAR* const kNetworkConfigLock =
-    _T("{0E900C7B-04B0-47f9-81B0-F8D94F2DF01B}");
-
-// Serializes access to the registry for application state.
-const TCHAR* const kRegistryAccessMutex =
-    _T("{66CC0160-ABB3-4066-AE47-1CA6AD5065C8}");
-
-// Serializes opt user id generation.
-const TCHAR* const kOptUserIdLock =
-    _T("{D19BAF17-7C87-467E-8D63-6C4B1C836373}");
-
-// The name of the shared memory objects containing the serialized COM
-// interface pointers exposed by the machine core.
-// TODO(omaha): Rename these constants to remove "GoogleUpdate".
-// TODO(omaha): Consider following the kGlobalPrefix convention with the 'G'
-// for the new shared Omaha 3 name  and building this from the same #define as
-// kGlobalPrefix.
-const TCHAR* const kGoogleUpdate3SharedMemoryName =
-    _T("Global\\") APP_NAME_IDENTIFIER _T("3");
-const TCHAR* const kGoogleUpdateCoreSharedMemoryName =
-    _T("Global\\") APP_NAME_IDENTIFIER _T("Core");
-
-}  // namespace omaha
-
-#endif  // OMAHA_BASE_CONST_OBJECT_NAMES_H_
diff --git a/official/common/const_goopdate.h b/official/common/const_goopdate.h
deleted file mode 100644
index d29c90b..0000000
--- a/official/common/const_goopdate.h
+++ /dev/null
@@ -1,294 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Goopdate constants - Reduces dependencies on goopdate.h for names that
-// are needed outside Goopdate.
-//
-// TODO(omaha): it appears that the string constants below are not
-// optimized out the program image even if not used. Figure out why they still
-// show up in the tiny shell in optimized builds.
-
-#ifndef OMAHA_COMMON_CONST_GOOPDATE_H_
-#define OMAHA_COMMON_CONST_GOOPDATE_H_
-
-#include <tchar.h>
-#include "omaha/base/constants.h"
-
-// TODO(omaha3): Many of these values are specific to the COM server and a few
-// may apply to the client. Move most of them to the goopdate directory.
-
-namespace omaha {
-
-enum ActiveStates {
-  ACTIVE_NOTRUN = 0,
-  ACTIVE_RUN,
-  ACTIVE_UNKNOWN
-};
-
-// Specifies what Omaha should do on successful installation.
-enum SuccessfulInstallAction {
-  SUCCESS_ACTION_DEFAULT = 0,
-  SUCCESS_ACTION_EXIT_SILENTLY,
-  SUCCESS_ACTION_EXIT_SILENTLY_ON_LAUNCH_CMD,
-};
-
-// Specifies the type of result the app installer returned.
-enum InstallerResultType {
-  INSTALLER_RESULT_UNKNOWN,
-  INSTALLER_RESULT_SUCCESS,
-  INSTALLER_RESULT_ERROR_MSI,
-  INSTALLER_RESULT_ERROR_SYSTEM,
-  INSTALLER_RESULT_ERROR_OTHER,
-};
-
-// The enumeration of the events. Some of the events are used in IPC,
-// these are named events, the rest are not named. Of the named events there
-// are two types the global and the local events.
-// Global Events:
-// The events which are global are indicated with the Global suffix in the
-// enum. These events have the Global prefix attached to the event name and
-// are used for IPC across terminal server sessions, these events are used
-// as barriers, i.e. all waiting threads are release on these events.
-// Local Events:
-// The local counter parts of these events have the Local prefix attached
-// to their names, and dont have any suffix in the enum names. The local events
-// are used to release only one thread, this works as we know that there is
-// only one user goopdate process in a user session and one machine goopdate.
-// The local events also have the user sid added to the event name. This is to
-// work around a bug in win2K and on XP where in case of TS, the event names
-// will collide, inspite of the name changes.
-enum GoopdateEvents {
-  EVENT_INVALID = -1,
-  EVENT_KILL_MESSAGE_LOOP = 0,
-  EVENT_UPDATE_TIMER,
-  EVENT_NEW_MANIFEST,          // Used in IPC.
-  EVENT_QUIET_MODE,            // Used in IPC.
-  EVENT_LEGACY_QUIET_MODE,     // Only used to shut down pre-i18n goopdates.
-  EVENT_CODE_RED_TIMER,
-};
-
-// Represents the values that are used by the application to indicate its
-// requirement for admin.
-enum NeedsAdmin {
-  NEEDS_ADMIN_NO = 0,   // The application will install per user.
-  NEEDS_ADMIN_YES,      // The application will install machine-wide.
-  NEEDS_ADMIN_PREFERS,  // The application will install machine-wide if
-                        // permissions allow, else will install per-user.
-};
-
-// Using extern or intern linkage for these strings yields the same code size
-// for the executable DLL.
-
-// The string representation of the NeedsAdmin enum as specified in the tag or
-// command line. This is eventually parsed into the needs_admin member of
-// CommandLineAppArgs.
-const TCHAR* const kNeedsAdminNo = _T("&needsadmin=false");
-const TCHAR* const kNeedsAdminYes = _T("&needsadmin=true");
-const TCHAR* const kNeedsAdminPrefers = _T("&needsadmin=prefers");
-
-// Environment variable inherited by an installer child process that indicates
-// whether GoogleUpdate is running as user or machine.
-const TCHAR* const kEnvVariableIsMachine = APP_NAME_IDENTIFIER _T("IsMachine");
-
-// Registry values read from the Clients key for transmitting custom install
-// errors, messages, etc. On an update, the InstallerXXX values are renamed to
-// LastInstallerXXX values. The LastInstallerXXX values remain around until the
-// next update.
-const TCHAR* const kRegValueInstallerResult      = _T("InstallerResult");
-const TCHAR* const kRegValueInstallerError       = _T("InstallerError");
-const TCHAR* const kRegValueInstallerExtraCode1  = _T("InstallerExtraCode1");
-const TCHAR* const kRegValueInstallerResultUIString =
-    _T("InstallerResultUIString");
-const TCHAR* const kRegValueInstallerSuccessLaunchCmdLine =
-    _T("InstallerSuccessLaunchCmdLine");
-
-const TCHAR* const kRegValueLastInstallerResult =
-    _T("LastInstallerResult");
-const TCHAR* const kRegValueLastInstallerError =
-    _T("LastInstallerError");
-const TCHAR* const kRegValueLastInstallerExtraCode1 =
-    _T("LastInstallerExtraCode1");
-const TCHAR* const kRegValueLastInstallerResultUIString =
-    _T("LastInstallerResultUIString");
-const TCHAR* const kRegValueLastInstallerSuccessLaunchCmdLine =
-    _T("LastInstallerSuccessLaunchCmdLine");
-
-
-// Registry subkey in an app's Clients key that contains its commands.
-const TCHAR* const kCommandsRegKeyName       = _T("Commands");
-
-// Registry values read from the Clients commands key.
-const TCHAR* const kRegValueCommandLine      = _T("CommandLine");
-const TCHAR* const kRegValueSendsPings       = _T("SendsPings");
-const TCHAR* const kRegValueWebAccessible    = _T("WebAccessible");
-const TCHAR* const kRegValueReportingId      = _T("ReportingId");
-
-// Registry value in an app's Clients key that contains a registration update
-// hook CLSID.
-const TCHAR* const kRegValueUpdateHookClsid  = _T("RegistrationUpdateHook");
-
-// Registry values read from the Clients key and stored in the ClientState key.
-const TCHAR* const kRegValueLanguage         = _T("lang");
-const TCHAR* const kRegValueAppName          = _T("name");
-const TCHAR* const kRegValueProductVersion   = _T("pv");
-
-// Registry values stored in the ClientState key.
-const TCHAR* const kRegValueAdditionalParams = _T("ap");
-const TCHAR* const kRegValueBrandCode        = _T("brand");
-const TCHAR* const kRegValueBrowser          = _T("browser");
-const TCHAR* const kRegValueClientId         = _T("client");
-const TCHAR* const kRegValueDidRun           = _T("dr");
-const TCHAR* const kRegValueExperimentLabels = _T("experiment_labels");
-const TCHAR* const kRegValueInstallationId   = _T("iid");
-const TCHAR* const kRegValueOemInstall       = _T("oeminstall");
-const TCHAR* const kRegValueReferralId       = _T("referral");
-
-// This two registries hold client UTC timestamp of server's midnight of the day
-// that last active ping/roll call happened.
-const TCHAR* const kRegValueActivePingDayStartSec = _T("ActivePingDayStartSec");
-const TCHAR* const kRegValueRollCallDayStartSec   = _T("RollCallDayStartSec");
-
-// Registry values stored in the ClientState key related to Omaha's actions.
-// A "successful check" means "noupdate" received from the server or an update
-// was successfully applied.
-const TCHAR* const kRegValueInstallTimeSec          = _T("InstallTime");
-const TCHAR* const kRegValueLastSuccessfulCheckSec  = _T("LastCheckSuccess");
-const TCHAR* const kRegValueLastUpdateTimeSec       = _T("UpdateTime");
-
-// Registry values stored in the ClientState or ClientStateMedium keys.
-// Use accessor methods rather than reading them directly.
-const TCHAR* const kRegValueEulaAccepted     = _T("eulaaccepted");
-const TCHAR* const kRegValueUsageStats       = _T("usagestats");
-
-// Registry values stored in the ClientState key for Omaha's internal use.
-const TCHAR* const kRegValueTTToken               = _T("tttoken");
-const TCHAR* const kRegValueUpdateAvailableCount  = _T("UpdateAvailableCount");
-const TCHAR* const kRegValueUpdateAvailableSince  = _T("UpdateAvailableSince");
-
-// Registry values stored in the Update key.
-const TCHAR* const kRegValueDelayOmahaUninstall   = _T("DelayUninstall");
-const TCHAR* const kRegValueOmahaEulaAccepted     = _T("eulaaccepted");
-// TODO(omaha3): Consider renaming these if there is not a upgrade problem.
-// If we can't consider moving all "gupdate" values to the customization file.
-const TCHAR* const kRegValueServiceName           = _T("gupdate_service_name");
-const TCHAR* const kRegValueMediumServiceName     = _T("gupdatem_service_name");
-const TCHAR* const kRegValueTaskNameC             = _T("gupdate_task_name_c");
-const TCHAR* const kRegValueTaskNameUA            = _T("gupdate_task_name_ua");
-const TCHAR* const kRegValueLastChecked           = _T("LastChecked");
-const TCHAR* const kRegValueOemInstallTimeSec     = _T("OemInstallTime");
-const TCHAR* const kRegValueCacheSizeLimitMBytes  = _T("PackageCacheSizeLimit");
-const TCHAR* const kRegValueCacheLifeLimitDays    = _T("PackageCacheLifeLimit");
-const TCHAR* const kRegValueInstalledPath         = _T("path");
-const TCHAR* const kRegValueUserId                = _T("uid");
-const TCHAR* const kRegValueSelfUpdateExtraCode1  = _T("UpdateCode1");
-const TCHAR* const kRegValueSelfUpdateErrorCode   = _T("UpdateError");
-const TCHAR* const kRegValueSelfUpdateVersion     = _T("UpdateVersion");
-const TCHAR* const kRegValueInstalledVersion      = _T("version");
-
-// TODO(omaha3): Consider moving all "gupdate" values to the customization file.
-// Use a non-gupdate name for the new medium service.
-const TCHAR* const kServicePrefix               = _T("gupdate");
-const TCHAR* const kMediumServicePrefix         = _T("gupdatem");
-
-const TCHAR* const kScheduledTaskNameUserPrefix =
-    APP_NAME_IDENTIFIER _T("TaskUser");
-const TCHAR* const kScheduledTaskNameMachinePrefix =
-    APP_NAME_IDENTIFIER _T("TaskMachine");
-const TCHAR* const kScheduledTaskNameCoreSuffix = _T("Core");
-const TCHAR* const kScheduledTaskNameUASuffix   = _T("UA");
-
-const TCHAR* const kServiceFileName              = kOmahaShellFileName;
-const char*  const kGoopdateDllEntryAnsi         = "DllEntry";
-
-
-// Event Id's used for reporting in the event log.
-// Crash Report events.
-const int kCrashReportEventId        = 1;
-const int kCrashUploadEventId        = 2;
-
-// Update Check events.
-const int kUpdateCheckEventId        = 11;
-const int kUpdateEventId             = 12;
-const int kUninstallEventId          = 13;
-const int kWorkerStartEventId        = 14;
-const int kDownloadEventId           = 15;
-
-// Network Request events.
-const int kNetworkRequestEventId     = 20;
-
-// Maximum value the server can respond for elapsed_seconds attribute in
-// <daystart ...> element. The value is one day plus an hour ("fall back"
-// daylight savings).
-const int kMaxTimeSinceMidnightSec   = ((24 + 1) * 60 * 60);
-
-// Maximum time to keep the Installation ID. If the app was installed longer
-// than this time ago, the Installation ID will be deleted regardless of
-// whether the application has been run or not.
-const int kMaxLifeOfInstallationIDSec = (7 * 24 * 60 * 60);  // 7 days
-
-// Documented in the IDL for certain properties of ICurrentState.
-const int kCurrentStateProgressUnknown = -1;
-
-// COM ProgIDs.
-#define kProgIDUpdate3COMClassUser \
-    APP_NAME_IDENTIFIER _T(".Update3COMClassUser")
-#define kProgIDUpdate3COMClassService \
-    APP_NAME_IDENTIFIER _T(".Update3COMClassService")
-
-const TCHAR* const kProgIDOnDemandUser =
-    APP_NAME_IDENTIFIER _T(".OnDemandCOMClassUser");
-#define kProgIDOnDemandMachine \
-    APP_NAME_IDENTIFIER _T(".OnDemandCOMClassMachine")
-const TCHAR* const kProgIDOnDemandMachineFallback =
-    APP_NAME_IDENTIFIER _T(".OnDemandCOMClassMachineFallback");
-const TCHAR* const kProgIDOnDemandSvc =
-    APP_NAME_IDENTIFIER _T(".OnDemandCOMClassSvc");
-
-const TCHAR* const kProgIDUpdate3WebUser =
-    APP_NAME_IDENTIFIER _T(".Update3WebUser");
-#define kProgIDUpdate3WebMachine \
-    APP_NAME_IDENTIFIER _T(".Update3WebMachine")
-const TCHAR* const kProgIDUpdate3WebMachineFallback =
-    APP_NAME_IDENTIFIER _T(".Update3WebMachineFallback");
-const TCHAR* const kProgIDUpdate3WebSvc =
-    APP_NAME_IDENTIFIER _T(".Update3WebSvc");
-
-const TCHAR* const kProgIDGoogleUpdateCoreService =
-    APP_NAME_IDENTIFIER _T(".CoreClass");
-const TCHAR* const kProgIDGoogleUpdateCoreMachine =
-    APP_NAME_IDENTIFIER _T(".CoreMachineClass");
-
-const TCHAR* const kProgIDProcessLauncher =
-    APP_NAME_IDENTIFIER _T(".ProcessLauncher");
-
-const TCHAR* const kProgIDOneClickProcessLauncherUser =
-    _T(SHORT_COMPANY_NAME_ANSI) _T(".OneClickProcessLauncherUser");
-const TCHAR* const kProgIDOneClickProcessLauncherMachine =
-    _T(SHORT_COMPANY_NAME_ANSI) _T(".OneClickProcessLauncherMachine");
-
-const TCHAR* const kProgIDCoCreateAsync =
-    APP_NAME_IDENTIFIER _T(".CoCreateAsync");
-
-const TCHAR* const kProgIDCredentialDialogUser =
-    APP_NAME_IDENTIFIER _T(".CredentialDialogUser");
-const TCHAR* const kProgIDCredentialDialogMachine =
-    APP_NAME_IDENTIFIER _T(".CredentialDialogMachine");
-
-// Offline v3 manifest name.
-const TCHAR* const kOfflineManifestFileName = _T("OfflineManifest.gup");
-
-}  // namespace omaha
-
-#endif  // OMAHA_COMMON_CONST_GOOPDATE_H_
diff --git a/official/goopdate/omaha3_idl.idl b/official/goopdate/omaha3_idl.idl
deleted file mode 100644
index 87d8e14..0000000
--- a/official/goopdate/omaha3_idl.idl
+++ /dev/null
@@ -1,972 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-import "oaidl.idl";
-import "ocidl.idl";
-
-// When adding interfaces to this file:
-//  * Do not use "Google" or "GoogleUpdate" directly. Instead, use preprocessor
-//    defines.
-//  * Add a test for the Google-specific value to
-//    omaha_customization_goopdate_apis_unittest.cc.
-
-//
-// Enums.
-// These values can be passed to interface methods and/or compared to their
-// output.
-//
-
-// Must be kept in sync with the enum in base/browser_utils.h.
-typedef enum BrowserType {
-  BROWSER_UNKNOWN           = 0,
-  BROWSER_DEFAULT           = 1,
-  BROWSER_INTERNET_EXPLORER = 2,
-  BROWSER_FIREFOX           = 3,
-  BROWSER_CHROME            = 4,
-} BrowserType;
-
-// The normal install flow proceeds from STATE_INIT through
-// STATE_INSTALL_COMPLETE in order, skipping states that are not relevant.
-// All exceptions and terminal states are start with STATE_INSTALL_COMPLETE.
-typedef enum CurrentState {
-  STATE_INIT = 1,
-  STATE_WAITING_TO_CHECK_FOR_UPDATE = 2,
-  STATE_CHECKING_FOR_UPDATE = 3,
-  STATE_UPDATE_AVAILABLE = 4,
-  STATE_WAITING_TO_DOWNLOAD = 5,
-  STATE_RETRYING_DOWNLOAD = 6,
-  STATE_DOWNLOADING = 7,
-  STATE_DOWNLOAD_COMPLETE = 8,
-  STATE_EXTRACTING = 9,
-  STATE_APPLYING_DIFFERENTIAL_PATCH = 10,
-  // TODO(omaha3): Should we move STATE_DOWNLOAD_COMPLETE here and eliminate
-  // STATE_READY_TO_INSTALL?
-  STATE_READY_TO_INSTALL = 11,
-  STATE_WAITING_TO_INSTALL = 12,
-  STATE_INSTALLING = 13,
-  STATE_INSTALL_COMPLETE = 14,
-  STATE_PAUSED = 15,
-  STATE_NO_UPDATE = 16,
-  STATE_ERROR = 17,
-} CurrentState;
-
-typedef enum InstallPriority {
-  INSTALL_PRIORITY_LOW = 0,
-  INSTALL_PRIORITY_HIGH = 10,
-} InstallPriority;
-
-// Specifies what the client should do after installation.
-typedef enum PostInstallAction {
-  POST_INSTALL_ACTION_DEFAULT = 0,
-
-  // Caller should exit silently.
-  POST_INSTALL_ACTION_EXIT_SILENTLY = 1,
-
-  // Caller should launch the command.
-  POST_INSTALL_ACTION_LAUNCH_COMMAND = 2,
-
-  // Caller should launch the command and exit silently.
-  POST_INSTALL_ACTION_EXIT_SILENTLY_ON_LAUNCH_COMMAND = 3,
-
-  // The caller should ask the user to restart the browser. If the value of
-  // IApp's browser is supported and postInstallUrl is valid, the client should
-  // offer to restart the browser. If the user chooses to do so, the client
-  // should launch the ICurrentState::postInstallUrl after shutting down and
-  // restarting the browser.
-  POST_INSTALL_ACTION_RESTART_BROWSER = 4,
-
-  // Similar to POST_INSTALL_ACTION_RESTART_BROWSER, but ask the user to shut
-  // down all browsers.
-  POST_INSTALL_ACTION_RESTART_ALL_BROWSERS = 5,
-
-  // The caller should ask the user to reboot the machine.
-  POST_INSTALL_ACTION_REBOOT = 6,
-} PostInstallAction;
-
-[
-  object,
-  dual,
-  uuid(6DB17455-4E85-46e7-9D23-E555E4B005AF),
-  helpstring("IGoogleUpdate3 Interface"),
-  pointer_default(unique)
-]
-interface IGoogleUpdate3 : IDispatch {
-  // TODO(Omaha): Perhaps this interface exposes helpers such as
-  // RestartBrowsers, etc.
-
-  // Returns the count of the AppBundles in this IGoogleUpdate3 interface.
-  [id(1), propget] HRESULT Count([out, retval] long* count);
-
-  // Returns an IDispatch of the AppBundle in this IGoogleUpdate3 interface at
-  // the specified 0-based index. This property has the dispid of DISPID_VALUE
-  // to make it the default property of IGoogleUpdate3.
-  [id(DISPID_VALUE), propget] HRESULT Item([in] long index,
-                                           [out, retval] IDispatch** bundle);
-  // Returns an IDispatch to a newly created empty AppBundle.
-  [id(2)] HRESULT createAppBundle([out, retval] IDispatch** app_bundle);
-}
-
-[
-  object,
-  dual,
-  uuid(313cfb25-4888-4fc6-9e19-764d8c5fc8f8),
-  helpstring("IAppBundle Interface"),
-  pointer_default(unique)
-]
-interface IAppBundle : IDispatch {
-  // TODO(omaha3): AppBundle::display_name_ is never used. Should we remove?
-  [propget] HRESULT displayName([out, retval] BSTR*);
-  [propput] HRESULT displayName([in] BSTR);
-
-  [propget] HRESULT displayLanguage([out, retval] BSTR*);
-  [propput] HRESULT displayLanguage([in] BSTR);
-
-  [propget] HRESULT installSource([out, retval] BSTR*);
-  [propput] HRESULT installSource([in] BSTR);
-
-  [propget] HRESULT originURL([out, retval] BSTR*);
-  [propput] HRESULT originURL([in] BSTR);
-
-  [propget] HRESULT offlineDirectory([out, retval] BSTR* offline_dir);
-  [propput] HRESULT offlineDirectory([in] BSTR offline_dir);
-
-  [propget] HRESULT sessionId([out, retval] BSTR* session_id);
-  [propput] HRESULT sessionId([in] BSTR session_id);
-
-  // The priority property determines download speed/priority and the number/
-  // frequency of retries.  Use values from the InstallPriority enum.
-  [propget] HRESULT priority([out, retval] long* priority);
-  [propput] HRESULT priority([in] long priority);
-
-  // Returns the count of the Apps in the AppBundle.
-  [id(1), propget] HRESULT Count([out, retval] long* count);
-
-  // Returns an IDispatch of the App in the AppBundle at the specified 0-based
-  // index. This property has the dispid of DISPID_VALUE to make it the default
-  // property of IAppBundle.
-  [id(DISPID_VALUE), propget] HRESULT Item([in] long index,
-                                           [out, retval] IDispatch** app);
-
-  // Impersonation and primary tokens set by the client. Typically only
-  // set by the gupdatem service. The gupdatem service exposes a narrow
-  // interface to medium integrity clients. When a medium integrity client calls
-  // into the gupdatem service, the gupdatem service captures the token of the
-  // caller, and then calls put_altTokens() on the gupdate service, so that the
-  // gupdate service can use it for future download() and install() requests.
-  [propput] HRESULT altTokens([in] ULONG_PTR impersonation_token,
-                              [in] ULONG_PTR primary_token,
-                              [in] DWORD caller_proc_id);
-
-  // Sets a HWND to associate with the client, if any.  This will be used as
-  // the parent window for any dialogs that the server may need to display.
-  [propput] HRESULT parentHWND([in] ULONG_PTR hwnd);
-
-  // Initializes the bundle with the properties that have been set.
-  [id(2)] HRESULT initialize();
-
-  // Returns an IDispatch to a new App for the specified app id.
-  // The App is added to the Bundle.
-  [id(3)] HRESULT createApp([in] BSTR app_id,
-                            [out, retval] IDispatch** app);
-
-  // Returns an IDispatch to a newly created App for the specified app ID. The
-  // App is populated with information from the existing installation and added
-  // to the Bundle. Fails if the specified app is not installed.
-  [id(4)] HRESULT createInstalledApp([in] BSTR app_id,
-                                     [out, retval] IDispatch** app);
-
-  // Creates App instances for all installed apps managed by this Omaha
-  // instance. Each App is populated with information from the existing install.
-  [id(5)] HRESULT createAllInstalledApps();
-
-  // These methods are non-blocking. The operation is scheduled.
-  [id(6)] HRESULT checkForUpdate();
-  [id(7)] HRESULT download();
-  [id(8)] HRESULT install();
-
-  // All-in-one function for automatically updating all apps. Populates the
-  // bundle then schedules the update, which includes the update check and
-  // download and install, if necessary.
-  [id(9)] HRESULT updateAllApps();
-
-  // These three methods are non-blocking. The operation is requested.
-  [id(10)] HRESULT stop();
-  [id(11)] HRESULT pause();
-  [id(12)] HRESULT resume();
-
-  // Returns true if the bundle has an uncompleted non-blocking request.
-  [id(13)] HRESULT isBusy([out, retval] VARIANT_BOOL* is_busy);
-
-  // Downloads a package of an installed application.
-  [id(14)] HRESULT downloadPackage([in] BSTR app_id, [in] BSTR package_name);
-
-  // TODO(omaha): Define this aggregated bundle state. Is this really a property
-  // or should it be getCurrentState?
-  // The server and bundle are the only thing that can provide aggregated
-  // time estimates for downloads. Also, aggregate percentage is not currently
-  // available to the client because the total bytes to download is not
-  // available from App in all post-update check states.
-  // To do this, we will probably need to know the total expected download
-  // size for all packages to be installed - those that are required or in use -
-  // by the time the update check phase is complete.
-  [id(15), propget] HRESULT currentState([out, retval] VARIANT* current_state);
-};
-
-[
-  object,
-  dual,
-  uuid(D999CE21-98B3-4894-BACB-A49A1D50848F),
-  helpstring("IApp Interface"),
-  pointer_default(unique)
-]
-interface IApp : IDispatch {
-  // Returns a version IDispatch object.
-  [id(1), propget] HRESULT currentVersion([out, retval] IDispatch** current);
-  [id(2), propget] HRESULT nextVersion([out, retval] IDispatch** next);
-
-  [propget] HRESULT appId([out, retval] BSTR*);
-
-  [propget] HRESULT displayName([out, retval] BSTR*);
-  [propput] HRESULT displayName([in] BSTR);
-
-  [propget] HRESULT language([out, retval] BSTR*);
-  [propput] HRESULT language([in] BSTR);
-
-  [propget] HRESULT ap([out, retval] BSTR*);
-  [propput] HRESULT ap([in] BSTR);
-
-  [propget] HRESULT ttToken([out, retval] BSTR*);
-  [propput] HRESULT ttToken([in] BSTR);
-
-  [propget] HRESULT iid([out, retval] BSTR*);
-  [propput] HRESULT iid([in] BSTR);
-
-  [propget] HRESULT brandCode([out, retval] BSTR*);
-  [propput] HRESULT brandCode([in] BSTR);
-
-  [propget] HRESULT clientId([out, retval] BSTR*);
-  [propput] HRESULT clientId([in] BSTR);
-
-  [propget] HRESULT labels([out, retval] BSTR*);
-  [propput] HRESULT labels([in] BSTR);
-
-  [propget] HRESULT referralId([out, retval] BSTR*);
-  [propput] HRESULT referralId([in] BSTR);
-
-  // Use values from the BrowserType enum.
-  [propget] HRESULT browserType([out, retval] UINT*);
-  [propput] HRESULT browserType([in] UINT);
-
-  [propget] HRESULT clientInstallData([out, retval] BSTR*);
-  [propput] HRESULT clientInstallData([in] BSTR);
-
-  [propget] HRESULT serverInstallDataIndex([out, retval] BSTR*);
-  [propput] HRESULT serverInstallDataIndex([in] BSTR);
-
-  // Set as soon as possible. Error pings are disabled until set to true.
-  [propget] HRESULT isEulaAccepted([out, retval] VARIANT_BOOL*);
-  [propput] HRESULT isEulaAccepted([in] VARIANT_BOOL);
-
-  [propget] HRESULT usageStatsEnable([out, retval] UINT*);
-  [propput] HRESULT usageStatsEnable([in] UINT);
-
-  [propget] HRESULT installTimeDiffSec([out, retval] UINT*);
-
-  // Returns an ICurrentState interface. The object underlying the interface has
-  // static data that does not get updated as the server state changes. To get
-  // the most "current" state, the currentState property needs to be queried
-  // again.
-  [propget] HRESULT currentState([out, retval] IDispatch**);
-};
-
-[
-  object,
-  dual,
-  uuid(BCDCB538-01C0-46d1-A6A7-52F4D021C272),
-  helpstring("IAppVersion Interface"),
-  pointer_default(unique)
-]
-interface IAppVersion : IDispatch {
-  [propget] HRESULT version([out, retval] BSTR*);
-
-  // [propget] HRESULT installManifest([out, retval] BSTR*);
-
-  // Returns the count of the Packages in the AppVersion.
-  [propget] HRESULT packageCount([out, retval] long* count);
-
-  // Returns an IDispatch of the Package in the AppVersion at the specified
-  // 0-based index.
-  [propget] HRESULT package([in] long index,
-                            [out, retval] IDispatch** package);
-};
-
-[
-  object,
-  dual,
-  uuid(DCAB8386-4F03-4dbd-A366-D90BC9F68DE6),
-  helpstring("IPackage Interface"),
-  pointer_default(unique)
-]
-interface IPackage : IDispatch {
-  // Retrieves the package from the package cache and copies it to the
-  // directory provided. Returns an error is the package is not available
-  // locally.
-  [id(1)] HRESULT get([in] BSTR dir);
-
-  // Returns true if the package has been downloaded and is available
-  // locally.
-  [propget] HRESULT isAvailable([out, retval] VARIANT_BOOL*);
-
-  // Returns the manifest name of the package.
-  [propget] HRESULT filename([out, retval] BSTR*);
-};
-
-// TODO(omaha3): We should figure out what else we are going to want in this
-// interface before dogfood even if we do not implement it.
-[
-  object,
-  dual,
-  uuid(247954F9-9EDC-4E68-8CC3-150C2B89EADF),
-  helpstring("ICurrentState Interface"),
-  pointer_default(unique)
-]
-interface ICurrentState : IDispatch {
-  // This interface is exposed to web clients!
-  // TODO(omaha3): Update valid comments once we settle on an implementation.
-
-  // A value from the CurrentState enum. This value determines which of the
-  // properties below are valid.
-  [propget] HRESULT stateValue([out, retval] LONG*);
-
-  // The remaining properties are only valid in the specified states. For all
-  // other states, the values are not specified.
-
-  // This property is valid only when stateValue is STATE_UPDATE_AVAILABLE.
-  [propget] HRESULT availableVersion([out, retval] BSTR*);
-
-  // The following three properties are only valid when stateValue is
-  // STATE_WAITING_TO_DOWNLOAD, STATE_RETRYING_DOWNLOAD, STATE_DOWNLOADING,
-  // STATE_DOWNLOAD_COMPLETE, STATE_EXTRACTING,
-  // STATE_APPLYING_DIFFERENTIAL_PATCH, or STATE_READY_TO_INSTALL.
-
-  // Bytes downloaded so far.
-  [propget] HRESULT bytesDownloaded([out, retval] ULONG*);
-
-  // Total bytes to download.
-  [propget] HRESULT totalBytesToDownload([out, retval] ULONG*);
-
-  // Estimated download time remaining in ms. -1 indicates unknown.
-  // Progress may not always be available, so clients should handle the -1 case.
-  [propget] HRESULT downloadTimeRemainingMs([out, retval] LONG*);
-
-  [propget] HRESULT nextRetryTime([out, retval] ULONGLONG*);
-
-  // TODO(omaha 3): Need some way to indicate reconnecting, retrying, etc.
-
-  // The following two properties are only valid when stateValue is
-  // STATE_INSTALLING or STATE_INSTALL_COMPLETE.
-
-  // Current install progress in percentage from 0 to 100. -1 indicates unknown.
-  // Progress may not always be available, so clients should handle the -1 case.
-  [propget] HRESULT installProgress([out, retval] LONG*);
-
-  // Estimated download time remaining in ms. -1 indicates unknown.
-  // Progress may not always be available, so clients should handle the -1 case.
-  [propget] HRESULT installTimeRemainingMs([out, retval] LONG*);
-
-  // The following four properties are only valid when stateValue is
-  // STATE_ERROR:
-
-  // Returns true if the app has been canceled.
-  [propget] HRESULT isCanceled([out, retval] VARIANT_BOOL* is_canceled);
-
-  // Error code.
-  [propget] HRESULT errorCode([out, retval] LONG*);
-
-  // Error extra code.
-  [propget] HRESULT extraCode1([out, retval] LONG*);
-
-  // The following three properties are only valid when stateValue is
-  // STATE_ERROR or STATE_INSTALL_COMPLETE.
-  // TODO(omaha3): If STATE_DOWNLOAD_COMPLETE or STATE_READY_TO_INSTALL becomes
-  // a terminal state, does it support completion messages?
-
-  // Completion message, localized in the specified language.
-  // TODO(omaha3): If we're going to have bundle error messages too, should the
-  // language be at bundle level? Should bundle have its own language setter?
-  [propget] HRESULT completionMessage([out, retval] BSTR*);
-
-  // Application installer result code. This is to be used as additional
-  // information only. Success/failure should be determined using errorCode.
-  // This is an error if errorCode is GOOPDATEINSTALL_E_INSTALLER_FAILED.
-  [propget] HRESULT installerResultCode([out, retval] LONG*);
-
-  // Application installer extra code.
-  [propget] HRESULT installerResultExtraCode1([out, retval] LONG*);
-
-  // A command that needs to be launched by the client after installation.
-  [propget] HRESULT postInstallLaunchCommandLine([out, retval] BSTR*);
-
-  // URL to be launched after restarting the browser.
-  [propget] HRESULT postInstallUrl([out, retval] BSTR*);
-
-  // Returns a PostInstallAction value indicating the action to be taken by the
-  // client after installation.
-  [propget] HRESULT postInstallAction([out, retval] LONG*);
-}
-
-[
-  object,
-  dual,
-  uuid(4E223325-C16B-4eeb-AEDC-19AA99A237FA),
-  helpstring("IRegistrationUpdateHook Interface"),
-  pointer_default(unique),
-]
-interface IRegistrationUpdateHook : IDispatch {
-  HRESULT UpdateRegistry([in] BSTR app_id, [in] VARIANT_BOOL is_machine);
-};
-
-[
-  object,
-  uuid(b3a47570-0a85-4aea-8270-529d47899603),
-  helpstring("ICredentialDialog Interface"),
-  pointer_default(unique),
-]
-interface ICredentialDialog : IUnknown {
-  HRESULT QueryUserForCredentials([in] ULONG_PTR owner_hwnd,
-                                  [in] BSTR server,
-                                  [in] BSTR message,
-                                  [out] BSTR* username,
-                                  [out] BSTR* password);
-};
-
-// BEGIN gupdatem interfaces.
-
-// The following interfaces are exposed as a narrower version of the
-// IGoogleUpdate3 interface from the gupdatem service. These interfaces are
-// meant for use from medium and low integrity clients.
-
-[
-  object,
-  dual,
-  uuid(494B20CF-282E-4BDD-9F5D-B70CB09D351E),
-  helpstring("IGoogleUpdate3Web Interface"),
-  pointer_default(unique),
-]
-interface IGoogleUpdate3Web : IDispatch {
-  HRESULT createAppBundleWeb([out, retval] IDispatch** app_bundle_web);
-};
-
-[
-  object,
-  uuid(2D363682-561D-4c3a-81C6-F2F82107562A),
-  helpstring("IGoogleUpdate3WebSecurity Interface"),
-  pointer_default(unique),
-]
-interface IGoogleUpdate3WebSecurity : IUnknown {
-  HRESULT setOriginURL([in] BSTR origin_url);
-};
-
-[
-  object,
-  dual,
-  uuid(DD42475D-6D46-496a-924E-BD5630B4CBBA),
-  helpstring("IAppBundleWeb Interface"),
-  pointer_default(unique),
-]
-interface IAppBundleWeb : IDispatch {
-  [id(2)] HRESULT createApp([in] BSTR app_guid,
-                            [in] BSTR brand_code,
-                            [in] BSTR language,
-                            [in] BSTR ap);
-  [id(3)] HRESULT createInstalledApp([in] BSTR app_id);
-  [id(4)] HRESULT createAllInstalledApps();
-
-  [propget] HRESULT displayLanguage([out, retval] BSTR*);
-  [propput] HRESULT displayLanguage([in] BSTR);
-
-  [propput] HRESULT parentHWND([in] ULONG_PTR hwnd);
-
-  [propget] HRESULT length([out, retval] int* index);
-  [id(DISPID_VALUE), propget] HRESULT appWeb(
-      [in] int index, [out, retval] IDispatch** app_web);
-
-  HRESULT initialize();
-
-  HRESULT checkForUpdate();
-  HRESULT download();
-  HRESULT install();
-
-  HRESULT pause();
-  HRESULT resume();
-  HRESULT cancel();
-
-  HRESULT downloadPackage([in] BSTR app_id, [in] BSTR package_name);
-
-  [propget] HRESULT currentState([out, retval] VARIANT* current_state);
-};
-
-[
-  object,
-  dual,
-  uuid(C6398F88-69CE-44ac-B6A7-1D3E2AA46679),
-  helpstring("IAppWeb Interface"),
-  pointer_default(unique),
-]
-interface IAppWeb : IDispatch {
-  [propget] HRESULT appId([out, retval] BSTR*);
-
-  // Returns an IAppVersionWeb IDispatch object.
-  [propget] HRESULT currentVersionWeb([out, retval] IDispatch** current);
-  [propget] HRESULT nextVersionWeb([out, retval] IDispatch** next);
-
-  HRESULT cancel();
-  [propget] HRESULT currentState([out, retval] IDispatch** current_state);
-  HRESULT launch();
-  HRESULT uninstall();
-};
-
-[
-  object,
-  dual,
-  uuid(0CD01D1E-4A1C-489d-93B9-9B6672877C57),
-  helpstring("IAppVersionWeb Interface"),
-  pointer_default(unique)
-]
-interface IAppVersionWeb : IDispatch {
-  [propget] HRESULT version([out, retval] BSTR*);
-
-  // Returns the count of the Packages in the AppVersion.
-  [propget] HRESULT packageCount([out, retval] long* count);
-
-  // TODO(omaha3): Implement this after a security review.
-  // Returns an IDispatch of the Package in the AppVersion at the specified
-  // 0-based index.
-  [propget] HRESULT packageWeb([in] long index,
-                               [out, retval] IDispatch** package);
-};
-
-[
-  object,
-  dual,
-  uuid(2E629606-312A-482f-9B12-2C4ABF6F0B6D),
-  helpstring("ICoCreateAsyncStatus Interface"),
-  pointer_default(unique)
-]
-interface ICoCreateAsyncStatus : IDispatch {
-  [propget] HRESULT isDone([out, retval] VARIANT_BOOL* is_done);
-  [propget] HRESULT completionHResult([out, retval] LONG* hr);
-  [propget] HRESULT createdInstance([out, retval] IDispatch** instance);
-};
-
-[
-  object,
-  uuid(DAB1D343-1B2A-47f9-B445-93DC50704BFE),
-  helpstring("ICoCreateAsync Interface"),
-  pointer_default(unique)
-]
-interface ICoCreateAsync : IUnknown {
-  HRESULT createOmahaMachineServerAsync(
-      [in] BSTR origin_url,
-      [in] BOOL create_elevated,
-      [out, retval] ICoCreateAsyncStatus** status);
-};
-
-// END gupdatem interfaces.
-
-// BEGIN Legacy google_update_idl interfaces.
-
-[
-  object,
-  uuid(5B25A8DC-1780-4178-A629-6BE8B8DEFAA2),
-  oleautomation,
-  nonextensible,
-  pointer_default(unique)
-]
-interface IBrowserHttpRequest2 : IUnknown {
-  // This method will send request/data from the browser process.
-  // @param url                     URL where request will be send.
-  // @param post_data               POST data, if any. Can be NULL.
-  // @param request_headers         HTTP request headers, if any. Can be NULL.
-  // @param response_headers_needed HTTP response headers that are needed.
-  //                                Should be one of the values listed here:
-  //                                    http://msdn.microsoft.com/aa385351.aspx
-  //                                The input is a SAFEARRAY of DWORD. Can be a
-  //                                VT_EMPTY.
-  // @param response_headers        HTTP response headers, returned as SAFEARRAY
-  //                                of BSTR. The values corresponding one-to-one
-  //                                with the response_headers_needed values. Can
-  //                                be NULL if response_headers_needed==VT_EMPTY
-  // @param response_code           HTTP response code.
-  // @param cache_filename          Cache file that contains the response data.
-  HRESULT Send([in] BSTR url,
-               [in] BSTR post_data,
-               [in] BSTR request_headers,
-               [in] VARIANT response_headers_needed,
-               [out] VARIANT* response_headers,
-               [out] DWORD* response_code,
-               [out] BSTR* cache_filename);
-};
-
-[
-  object,
-  oleautomation,
-  uuid(128C2DA6-2BC0-44c0-B3F6-4EC22E647964),
-  helpstring("Google Update IProcessLauncher Interface"),
-  pointer_default(unique)
-]
-interface IProcessLauncher : IUnknown {
-  // @param cmd_line The full command line to execute.
-  HRESULT LaunchCmdLine([in, string] const WCHAR* cmd_line);
-
-  // @param browser_type The browser to start.
-  // @param url The url to launch the browser with.
-  HRESULT LaunchBrowser([in] DWORD browser_type,
-                        [in, string] const WCHAR* url);
-
-  // @param app_id Unique id to identify the calling client application
-  // @param event_id Unique id for the command
-  // @param caller_proc_id The process id of the calling process
-  // @param proc_handle The process handle valid in the caller's context
-  HRESULT LaunchCmdElevated([in, string] const WCHAR* app_guid,
-                            [in, string] const WCHAR* cmd_id,
-                            [in] DWORD caller_proc_id,
-                            [out] ULONG_PTR* proc_handle);
-};
-
-[
-  object,
-  oleautomation,
-  uuid(5CCCB0EF-7073-4516-8028-4C628D0C8AAB),
-  helpstring("Google Update IOneClickProcessLauncher Interface"),
-  pointer_default(unique)
-]
-interface IOneClickProcessLauncher : IUnknown {
-  HRESULT LaunchAppCommand([in, string] const WCHAR* app_guid,
-                           [in, string] const WCHAR* cmd_id);
-};
-
-typedef enum {
-  COMPLETION_CODE_SUCCESS = 1,
-  COMPLETION_CODE_SUCCESS_CLOSE_UI,
-  COMPLETION_CODE_ERROR,
-  COMPLETION_CODE_RESTART_ALL_BROWSERS,
-  COMPLETION_CODE_REBOOT,
-  COMPLETION_CODE_RESTART_BROWSER,
-  COMPLETION_CODE_RESTART_ALL_BROWSERS_NOTICE_ONLY,
-  COMPLETION_CODE_REBOOT_NOTICE_ONLY,
-  COMPLETION_CODE_RESTART_BROWSER_NOTICE_ONLY,
-  COMPLETION_CODE_RUN_COMMAND,
-} LegacyCompletionCodes;
-
-[
-  object,
-  oleautomation,
-  uuid(1C642CED-CA3B-4013-A9DF-CA6CE5FF6503),
-  helpstring("GoogleUpdate UI-specific events Interface"),
-  pointer_default(unique)
-]
-interface IProgressWndEvents : IUnknown {
-  // The UI is closing down. The user has clicked on either the "X" or the
-  // other buttons of the UI to close the window.
-  HRESULT DoClose();
-
-  // Pause has been clicked on.
-  HRESULT DoPause();
-
-  // Resume has been clicked on.
-  HRESULT DoResume();
-
-  // RestartBrowsers button has been clicked on.
-  HRESULT DoRestartBrowsers();
-
-  // Reboot button has been clicked on.
-  HRESULT DoReboot();
-
-  // Launch Browser.
-  HRESULT DoLaunchBrowser([in, string] const WCHAR* url);
-};
-
-
-[
-  object,
-  oleautomation,
-  uuid(49D7563B-2DDB-4831-88C8-768A53833837),
-  helpstring("IJobObserver Interface"),
-  pointer_default(unique)
-]
-interface IJobObserver : IUnknown {
-  HRESULT OnShow();
-  HRESULT OnCheckingForUpdate();
-  HRESULT OnUpdateAvailable([in, string] const WCHAR* version_string);
-  HRESULT OnWaitingToDownload();
-  HRESULT OnDownloading([in] int time_remaining_ms, [in] int pos);
-  HRESULT OnWaitingToInstall();
-  HRESULT OnInstalling();
-  HRESULT OnPause();
-  HRESULT OnComplete([in] LegacyCompletionCodes code,
-                     [in, string] const WCHAR* reserved);
-  HRESULT SetEventSink([in] IProgressWndEvents* ui_sink);
-};
-
-[
-  object,
-  oleautomation,
-  uuid(31AC3F11-E5EA-4a85-8A3D-8E095A39C27B),
-  helpstring("IGoogleUpdate Interface"),
-  pointer_default(unique)
-]
-interface IGoogleUpdate : IUnknown {
-  // @param guid The guid for the app to be updated.
-  // @param observer The eventing interface.
-  HRESULT CheckForUpdate([in, string] const WCHAR* guid,
-                         [in] IJobObserver* observer);
-
-  // @param guid The guid for the app to be updated.
-  // @param observer The eventing interface.
-  HRESULT Update([in, string] const WCHAR* guid,
-                 [in] IJobObserver* observer);
-};
-
-// IGoogleUpdateCore is an internal Omaha interface.
-[
-  object,
-  oleautomation,
-  uuid(909489C2-85A6-4322-AA56-D25278649D67),
-  helpstring("Google Update Core Interface"),
-  pointer_default(unique)
-]
-interface IGoogleUpdateCore : IUnknown
-{
-  // Runs a command elevated.
-  //
-  // @param app_id Unique id to identify the calling client application
-  // @param event_id Unique id for the command
-  // @param caller_proc_id The process id of the calling process
-  // @param proc_handle The process handle valid in the caller's context
-  HRESULT LaunchCmdElevated([in, string] const WCHAR* app_guid,
-                            [in, string] const WCHAR* cmd_id,
-                            [in] DWORD caller_proc_id,
-                            [out] ULONG_PTR* proc_handle);
-};
-
-// END Legacy google_update_idl interfaces.
-
-[
-  uuid(655DD85A-3C0D-4674-9C58-AF7168C5861E),
-  version(1.0),
-  helpstring("Google Update 3.0 Type Library")
-]
-library GoogleUpdate3Lib {
-  importlib("stdole2.tlb");
-
-  // These Interfaces are forward declared to ensure that they are described in
-  // the generated TLB file. This is required for ATL to correctly implement the
-  // corresponding IDispatch interfaces.
-  interface IGoogleUpdate3;
-  interface IAppBundle;
-  interface IApp;
-  interface IAppVersion;
-  interface IPackage;
-  interface ICurrentState;
-
-  interface IGoogleUpdate3Web;
-  interface IAppBundleWeb;
-  interface IAppWeb;
-  interface IAppVersionWeb;
-  interface ICoCreateAsyncStatus;
-
-  [
-    uuid(022105BD-948A-40c9-AB42-A3300DDF097F),
-    helpstring("GoogleUpdate3 Class for per-user applications")
-  ]
-  coclass GoogleUpdate3UserClass {
-    [default] interface IDispatch;
-  }
-
-  [
-    uuid(4EB61BAC-A3B6-4760-9581-655041EF4D69),
-    helpstring("GoogleUpdate3 Service Class for machine applications")
-  ]
-  coclass GoogleUpdate3ServiceClass {
-    [default] interface IDispatch;
-  }
-
-  [
-    uuid(22181302-A8A6-4f84-A541-E5CBFC70CC43),
-    helpstring("GoogleUpdate3Web for user applications")
-  ]
-  coclass GoogleUpdate3WebUserClass {
-    [default] interface IDispatch;
-  }
-
-  [
-    uuid(8A1D4361-2C08-4700-A351-3EAA9CBFF5E4),
-    helpstring("Pass-through broker for the GoogleUpdate3WebServiceClass")
-  ]
-  coclass GoogleUpdate3WebMachineClass {
-    [default] interface IDispatch;
-  }
-
-  [
-    uuid(534F5323-3569-4f42-919D-1E1CF93E5BF6),
-    helpstring("GoogleUpdate3Web")
-  ]
-  coclass GoogleUpdate3WebServiceClass {
-    [default] interface IDispatch;
-  }
-
-  [
-    uuid(598FE0E5-E02D-465d-9A9D-37974A28FD42),
-    helpstring("Fallback mechanism if GoogleUpdate3WebServiceClass fails")
-  ]
-  coclass GoogleUpdate3WebMachineFallbackClass {
-    [default] interface IDispatch;
-  }
-
-  [
-    uuid(E8CF3E55-F919-49d9-ABC0-948E6CB34B9F),
-    helpstring("CurrentStateUserClass")
-  ]
-  coclass CurrentStateUserClass {
-    [default] interface ICurrentState;
-  }
-
-  [
-    uuid(9D6AA569-9F30-41ad-885A-346685C74928),
-    helpstring("CurrentStateMachineClass")
-  ]
-  coclass CurrentStateMachineClass {
-    [default] interface ICurrentState;
-  }
-
-  [
-    uuid(7DE94008-8AFD-4c70-9728-C6FBFFF6A73E),
-    helpstring("CoCreateAsyncClass")
-  ]
-  coclass CoCreateAsyncClass {
-    [default] interface IUnknown;
-  }
-
-  [
-    uuid(e67be843-bbbe-4484-95fb-05271ae86750),
-    helpstring("CredentialDialogUserClass")
-  ]
-  coclass CredentialDialogUserClass {
-    [default] interface IUnknown;
-  }
-
-  [
-    uuid(25461599-633d-42b1-84fb-7cd68d026e53),
-    helpstring("CredentialDialogMachineClass")
-  ]
-  coclass CredentialDialogMachineClass {
-    [default] interface IUnknown;
-  }
-
-  [
-    uuid(___AUTO_GENERATED_GUID___),
-    helpstring("GoogleComProxyMachineClass")
-  ]
-  coclass GoogleComProxyMachineClass {
-    [default] interface IUnknown;
-  }
-
-  [
-    uuid(___AUTO_GENERATED_GUID___),
-    helpstring("GoogleComProxyUserClass")
-  ]
-  coclass GoogleComProxyUserClass {
-    [default] interface IUnknown;
-  }
-
-  // BEGIN Legacy google_update_idl coclasses.
-
-  [
-    uuid(ABC01078-F197-4b0b-ADBC-CFE684B39C82),
-    helpstring("ProcessLauncherClass Class")
-  ]
-  coclass ProcessLauncherClass {
-    [default] interface IUnknown;
-  }
-
-  [
-    uuid(51F9E8EF-59D7-475b-A106-C7EA6F30C119),
-    helpstring("OneClickUserProcessLauncherClass Class")
-  ]
-  coclass OneClickUserProcessLauncherClass {
-    [default] interface IOneClickProcessLauncher;
-  }
-
-  [
-    uuid(AAD4AE2E-D834-46d4-8B09-490FAC9C722B),
-    helpstring("OneClickMachineProcessLauncherClass Class")
-  ]
-  coclass OneClickMachineProcessLauncherClass {
-    [default] interface IOneClickProcessLauncher;
-  }
-
-  [
-    uuid(2F0E2680-9FF5-43c0-B76E-114A56E93598),
-    helpstring("OnDemand updates for per-user applications.")
-  ]
-  coclass OnDemandUserAppsClass {
-    [default] interface IUnknown;
-  }
-
-  [
-    uuid(6F8BD55B-E83D-4a47-85BE-81FFA8057A69),
-    helpstring("OnDemand pass-through broker for machine applications.")
-  ]
-  coclass OnDemandMachineAppsClass {
-    [default] interface IUnknown;
-  }
-
-  [
-    uuid(9465B4B4-5216-4042-9A2C-754D3BCDC410),
-    helpstring("OnDemand updates for per-machine applications.")
-  ]
-  coclass OnDemandMachineAppsServiceClass {
-    [default] interface IUnknown;
-  }
-
-  [
-    uuid(B3D28DBD-0DFA-40e4-8071-520767BADC7E),
-    helpstring("Fallback for if OnDemandMachineAppsServiceClass fails.")
-  ]
-  coclass OnDemandMachineAppsFallbackClass {
-    [default] interface IUnknown;
-  }
-
-  [
-    uuid(E225E692-4B47-4777-9BED-4FD7FE257F0E),
-    helpstring("GoogleUpdateCore Class")
-  ]
-  coclass GoogleUpdateCoreClass
-  {
-    [default] interface IUnknown;
-  }
-
-  [
-    uuid(9B2340A0-4068-43d6-B404-32E27217859D),
-    helpstring("GoogleUpdateCore Machine Class")
-  ]
-  coclass GoogleUpdateCoreMachineClass
-  {
-    [default] interface IUnknown;
-  }
-
-  // END Legacy google_update_idl coclasses.
-};
diff --git a/official/main.scons b/official/main.scons
deleted file mode 100644
index 2cb0155..0000000
--- a/official/main.scons
+++ /dev/null
@@ -1,820 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-
-# This main.scons file is the root description of the build specified in this
-# directory and those under it. Individual components and the source files
-# used to build them are described in subsidiary files called 'build.scons'.
-#
-# To build this project change the current directory to googleclient/Omaha.
-# Then run hammer.bat
-#
-# A number of command line options can be specified. For a full list, use the
-# -h and -H command options.
-#
-# Some useful options include:
-#   -h   :   Prints a list of which modules and build variants are available
-#            in this project.
-#   -H   :   Print SCons specific help. SCons is a build tool which this
-#            project uses in tandem with the Software Construction Toolkit
-#            to build.
-#   -c   :   Clean the project. I.e. delete all build output.
-#   -j3  :   Run up to 3 build steps at once.
-#
-# Some useful build targets include:
-#    all_programs    :   Build all programs generated by this project.
-#    all_libraries   :   Build all libraries generated by this project.
-#    all_tests       :   Build all tests generated by this project.
-#    run_all_tests   :   Build and run all tests generated by this project.
-#
-# Some examples:
-#   Build all programs and libraries in debug mode:
-#     hammer
-#   Build and run all tests in debug mode on windows:
-#     hammer MODE=dbg-win run_all_tests
-#   Build arbitrary library in the default mode:
-#     hammer <library name>
-
-import copy
-import os
-import sys
-
-import omaha_version_utils
-
-# To switch the build, simply change the value of the msc_ver variable below.
-# VC2003/VC71 is 1310 but not supported by the current build.
-# VC2005/VC80 is 1400.
-# VC2008/VC90 is 1500.
-_msc_ver = 1400
-
-_sdk_path = os.environ['OMAHA_VISTASDK_DIR']
-
-_signtool_path = os.path.join(_sdk_path, 'bin/signtool.exe')
-
-# Build the "Google Update", the Google-specific version of Omaha.
-# TODO(omaha): Set based on an environment variable and/or Hammer arg.
-is_google_update_build = True
-
-#
-# Begin vendor-specific constants.
-#
-# These values must be changed when customizing open source Omaha.
-# You may also wish to replace the language-neutral constants in the individual
-# *generated_resources_*.rc files with localized strings.
-_FULL_COMPANY_NAME = 'Google Inc.'
-_SHORT_COMPANY_NAME = 'Google'
-_PRODUCT_NAME = 'Update'
-_COMPANY_DOMAIN_BASE = 'google'
-_COMPANY_DOMAIN = _COMPANY_DOMAIN_BASE + '.com'
-_MAIN_EXE_BASE_NAME = 'GoogleUpdate'
-# TODO(omaha): Use this throughout the build files where goopdate and
-# goopdateres are referenced.
-_MAIN_DLL_BASE_NAME = 'goopdate'
-# "Google Inc." must not be removed from the copyright string. This literal also
-# appears as LegalCopyright in the VERSIONINFO section of .rc files.
-# TODO(omaha): Use this variable in .wxs files, etc.
-_OMAHA_COPYRIGHT_STRING_ENGLISH = 'Copyright 2007-2010 Google Inc.'
-
-
-# TODO(omaha): Allow open source Omaha to be built without the Recovery MSI,
-# which requires an extra certificate file and is unlikely to be used, or
-# ClickOnce, which requires specifying a certificate hash. Disabling Recovery
-# by default also means the open source build will work by default without
-# having to check in SaveArguments.exe to SVN every 100 days.
-# TODO(omaha3): Allow open source Omaha to be built without support for
-# Omaha 2's COM APIs.
-
-# The hash comes from the Thumbprint item in the Details tab of the file
-# properties for the public key .cer file.
-# TODO(omaha): Can we automate reading this and/or pass it on the command line?
-_BUILD_SERVER_CERTIFICATE_HASH = 'cafd39335d6e76f0e26d81296e7cbbfbdf16a720'
-
-#
-# End vendor-specific constants.
-#
-
-
-# Windows is the only environment we bulid for, so create a specialized base
-# environment for Windows.
-win_env = Environment(
-    # For internal builds only, it is a good idea to have set before the
-    # 'component_setup' tool is used even though we add the SDK directories to
-    # the appropriate environment variables manually below.
-    PLATFORM_SDK_DIR = _sdk_path,
-    tools=[
-        'component_setup',
-        'target_platform_windows',
-        # Need to use 'masm' to override the 'as' tool currently used
-        # by default in 'target_platform_windows'
-        'masm',
-        'atlmfc_vc80',
-        'code_signing',
-        'component_targets_msvs',
-        'omaha_builders',
-    ],
-    msc_ver = _msc_ver,
-    build_server_certificate_hash = _BUILD_SERVER_CERTIFICATE_HASH,
-    # Visual Studio 2008 does not ship the sign tool. Use the sign tool from
-    # the Platform SDK. This must come after the 'code_signing' tool is used.
-    # Remove this if http://code.google.com/p/swtoolkit/issues/detail?id=16 is
-    # fixed.
-    SIGNTOOL = '"' + _signtool_path + '"',
-)
-
-# Remove this value because it conflicts with a #define
-# in shlwapi.h in the Vista SDK
-win_env.FilterOut(CPPDEFINES = ['OS_WINDOWS=OS_WINDOWS'])
-
-# We pre-generate our own manifests, so make sure hammer does not generate
-# default ones for us
-del win_env['MANIFEST_FILE']
-
-# Hack to work around bug in Hammer (http://b/1585388).
-# TODO(Omaha): Remove when bug is fixed.
-if win_env['ENV'].has_key('SYSTEMROOT'):
-  if win_env['ENV'].has_key('SystemRoot'):
-    del win_env['ENV']['SYSTEMROOT']
-    del os.environ['SYSTEMROOT']
-
-# Work around http://code.google.com/p/swtoolkit/issues/detail?id=10.
-win_env['COMPONENT_TEST_SUBSYSTEM_WINDOWS'] = 1
-
-# Declare command line options relating to code signing
-# authenticode_file and authenticode_password are used by the normal signing
-# tool and to sign manifests for ClickOnce.
-# patching_certificate is used to create patchable MSI installers and MSPs.
-# authenticode_file and authenticode_password are only used if !build_server.
-# patching_certificate is used in all cases.
-AddOption(
-    '--authenticode_file',
-    action='store',
-    nargs=1,
-    type='string',
-    default='$MAIN_DIR/data/OmahaTestCert.pfx'
-)
-
-default_cert_password = 'test'
-AddOption(
-    '--authenticode_password',
-    action='store',
-    nargs=1,
-    type='string',
-    default=default_cert_password
-)
-
-AddOption(
-    '--patching_certificate',
-    action='store',
-    nargs=1,
-    type='string',
-    default='$MAIN_DIR/data/OmahaTestCert.cer'
-)
-
-# Declare option for specifying path to new official build files
-AddOption(
-    '--official_build_path',
-    action='store',
-    nargs=1,
-    type='string',
-    default=None
-)
-
-# Declare option for specifying the set of official app installers to build.
-# The value describes the name of the directory containing the official
-# installer manifests and definitions.
-AddOption(
-    '--official_installer_app',
-    action='store',
-    nargs=1,
-    type='string',
-    default=None
-)
-
-AddOption(
-    '--official_installer_file',
-    action='store',
-    nargs=1,
-    type='string',
-    default=None
-)
-
-AddOption(
-    '--build_number',
-    action='store',
-    nargs=1,
-    type='string',
-    default=''
-)
-
-# Declare various boolean states.
-DeclareBit('use_precompiled_headers', 'Use precompiled headers in build')
-DeclareBit('official_installers', 'Building using checked-in binaries')
-DeclareBit('build_server', 'Running on the build server')
-DeclareBit('build_two_versions', 'Build second version for self-update testing')
-DeclareBit('test_certificate', 'Files will be signed with the test certificate')
-DeclareBit('bin', 'Building from pre-built binaries')
-DeclareBit('min', 'Building minimal set of projects')
-DeclareBit('all', 'Building all Projects')
-DeclareBit('msvs', 'Building Visual Studio solution files')
-DeclareBit('no-tests', 'Do not build the unit tests')
-
-# Build official installers if --official_installers is on the command line.
-win_env.SetBitFromOption('official_installers', False)
-
-# Build as a build server if --build_server is on the command line.
-win_env.SetBitFromOption('build_server', False)
-
-# Build two versions if --build_two_versions is on the command line.
-win_env.SetBitFromOption('build_two_versions', False)
-
-# Store new versions of pre-built binaries if --bin is on the command line.
-win_env.SetBitFromOption('bin', False)
-
-# Build minimal set of libs if --min is on the command line.
-win_env.SetBitFromOption('min', False)
-
-# Build all libs if --all is on the command line.
-win_env.SetBitFromOption('all', False)
-
-# Build Visual Studio solution files if --msvs is on the command line.
-win_env.SetBitFromOption('msvs', False)
-
-# Do not build the unit tests if the bit is set.
-win_env.SetBitFromOption('no-tests', False)
-
-# Build all directories and two versions if this is the build server.
-if win_env.Bit('build_server'):
-  win_env.SetBits('all')
-  win_env.SetBits('build_two_versions')
-
-# Make sure 'all' overrides 'min'.
-if win_env.Bit('all'):
-  win_env.ClearBits('min')
-
-# Allow use of command-line-specified certificates to sign with, but
-# only if we're not on the build server.
-if not win_env.Bit('build_server'):
-  win_env.Replace(
-    CERTIFICATE_PATH=GetOption('authenticode_file'),
-    CERTIFICATE_PASSWORD=GetOption('authenticode_password'),
-  )
-
-  # Store whether we're using the default test cert separately, because
-  # we won't always know what the default password was.
-  if GetOption('authenticode_password') is default_cert_password:
-    win_env.SetBits('test_certificate')
-
-
-# The precompiled headers are to be used as an optional build speed up
-# build facility. Individual compilation units in the project must build with
-# or without precompiled headers. Building without precompiled headers is sort
-# of meaningless, since all the time we should build with it. However,
-# eliminating the dependency is desirable from a few reasons:
-# 1. making sure the files in the project include all the definitions they need
-# 2. creating different precompile headers if needed.
-# 3. making sure the precompile headers do not add to the size bloat.
-# There are two current limitations with the current setup.
-# First, due to pushing the warning level to W4 and WAll, we rely on the
-# common precompile.h to properly turn off the warnings inside system and
-# library code.
-# Second, to override the ATLASSERT, a file must be included before any of
-# the atl headers. To do this on a case by case basis is impractical and
-# error prone.
-# Therefore, when building with precompile headers off, the code is
-# building on W3 and it is not taking over the ATL asserts.
-win_env.SetBitFromOption('use_precompiled_headers', True)
-
-if win_env.Bit('use_precompiled_headers'):
-  print 'Using precompiled headers.'
-
-
-#
-# Set up version info.
-#
-omaha_version_info = omaha_version_utils.OmahaVersionInfo('VERSION')
-omaha_versions_info = [omaha_version_info]
-
-if win_env.Bit('build_two_versions'):
-  omaha_test_version_info = copy.deepcopy(omaha_version_info)
-  omaha_test_version_info.MakeTestVersion()
-  omaha_versions_info.append(omaha_test_version_info)
-
-# Print the version(s) being built.
-print 'Building versions: %s' % ', '.join(
-    [version_info.GetVersionString() for version_info in omaha_versions_info])
-
-build_number = GetOption('build_number')
-if build_number:
-  print 'Build number: %s' % build_number
-
-win_env['omaha_versions_info'] = omaha_versions_info
-
-if is_google_update_build:
-    win_env.Append(
-        CPPDEFINES = ['GOOGLE_UPDATE_BUILD'],
-        RCFLAGS = ['/DGOOGLE_UPDATE_BUILD=1'],
-    )
-
-# Make sure python.exe can be located.
-win_env.AppendENVPath('PATH', os.environ['OMAHA_PYTHON_DIR'])
-
-win_env.Append(
-    # Add windows specific compiler flags.
-    CCFLAGS = [
-        '/nologo',
-        '/c',
-        '/Zc:forScope',
-        '/D_HAS_EXCEPTIONS=0',
-        '/DCOMPILER_MSVC',
-        '/J',
-        '/DSTL_MSVC',
-        '/GR-',
-        '/D_CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES=1',
-        '/D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1',
-        '/D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT=1',
-        '/WX',      # warnings as errors
-
-        #
-        # Disable the following level 4 warnings below.
-        #
-        '/wd4127',  # conditional expression is constant
-        '/wd4189',  # local variable is initialized but not referenced
-        '/wd4505',  # unreferenced local function has been removed
-
-        #
-        # Disable the pedantic warnings below.
-        #
-        '/wd4191',  # unsafe conversion from 'type of expression' to
-                    #     'type required'
-        '/wd4217',  # member template functions cannot be used for
-                    #     copy-assignment...
-        '/wd4365',  # conversion from 'type_1' to 'type_2',
-                    #     signed/unsigned mismatch
-        '/wd4512',  # assignment operator could not be generated
-        '/wd4514',  # unreferenced inline function has been removed
-        '/wd4555',  # expression has no effect
-        '/wd4619',  # #pragma warning : there is no warning number 'number'
-        '/wd4623',  # default constructor could not be generated...
-        '/wd4625',  # copy constructor could not be generated...
-        '/wd4626',  # assignment operator could not be generated...
-        '/wd4668',  # not defined as a preprocessor macro, replacing with '0'.
-        '/wd4710',  # function not inlined
-        '/wd4711',  # function 'function' selected for inline expansion
-        '/wd4738',  # storing 32-bit float result in memory...
-        '/wd4820',  # bytes padding added after construct 'member_name'
-        ],
-
-    # Where to look for include files.
-    CPPPATH = [
-        '$MAIN_DIR',
-        '$MAIN_DIR/..',
-        '$MAIN_DIR/third_party/chrome',
-        '$MAIN_DIR/third_party/gtest/include',
-        ],
-
-    # Defines for windows environment.
-    CPPDEFINES = [
-        'WIN32', '_WINDOWS',
-        'UNICODE', '_UNICODE',
-        'WIN32_LEAN_AND_MEAN',
-        'STRICT',
-        'SECURITY_WIN32',
-        '_ATL_ALL_WARNINGS',
-        '_ATL_CSTRING_EXPLICIT_CONSTRUCTORS',
-        '_ATL_CSTRING_NO_CRT',
-        '_ATL_NO_ACLAPI',
-        '_ATL_NO_DEFAULT_LIBS',
-        '_ATL_NO_EXCEPTIONS',
-        '_ATL_NO_GLOBAL_SOCKET_STARTUP',
-        '_ATL_NO_PERF_SUPPORT',
-        '_ATL_NO_TRACK_HEAP',
-        '_ATL_NO_UUIDOF',
-        '_ATL_STATIC_REGISTRY',
-        '_CRT_RAND_S',      # rand_s support available in Windows XP only.
-        '_WTL_NO_CSTRING',  # WTL uses ATL CString instead.
-
-        # '_ATL_NO_CONNECTION_POINTS',
-        # '_ATL_NO_DOCHOSTUIHANDLER',
-        # '_ATL_NO_HOSTING',
-
-        # Set these C_DEFINES when APPVER=5.0
-        # (see win32.mak in Platform SDK)
-        # Target Windows XP and IE 6.0 and above.
-        'WINVER=0x0501',
-        '_WIN32_WINNT=0x0501',
-        '_WIN32_IE=0x0600',
-        '_RICHEDIT_VER=0x0010',
-
-        # don't define min and max in windef.h
-        'NOMINMAX',
-
-        # Logging is enabled in all modes for diagnostics purposes.
-        'LOGGING',
-
-        'FULL_COMPANY_NAME_ANSI=\\"%s\\"' % _FULL_COMPANY_NAME,
-        'SHORT_COMPANY_NAME_ANSI=\\"%s\\"' % _SHORT_COMPANY_NAME,
-        'PRODUCT_NAME_ANSI=\\"%s\\"' % _PRODUCT_NAME,
-        'COMPANY_DOMAIN_BASE_ANSI=\\"%s\\"' % _COMPANY_DOMAIN_BASE,
-        'COMPANY_DOMAIN_ANSI=\\"%s\\"' % _COMPANY_DOMAIN,
-        'OMAHA_APP_NAME_ANSI=\\"%s %s\\"' % (
-            _SHORT_COMPANY_NAME, _PRODUCT_NAME),
-        'MAIN_EXE_BASE_NAME_ANSI=\\"%s\\"' % _MAIN_EXE_BASE_NAME,
-        'MAIN_DLL_BASE_NAME_ANSI=\\"%s\\"' % _MAIN_DLL_BASE_NAME,
-        'OFFICIAL_BUILD=%d' % win_env.Bit('build_server'),
-        'TEST_CERTIFICATE=%d' % win_env.Bit('test_certificate'),
-        'ONECLICK_PLUGIN_NAME=_T(\\"%s\\")' % (
-            omaha_version_utils.GetONECLICK_PLUGIN_NAME()),
-        'ONECLICK_PLUGIN_VERSION_ANSI=\\"%d\\"' % (
-            omaha_version_info.oneclick_plugin_version),
-        'ONECLICK_PLUGIN_FILENAME=_T(\\"%s\\")' % (
-            omaha_version_info.oneclick_plugin_filename),
-        'UPDATE_PLUGIN_NAME=_T(\\"%s\\")' % (
-            omaha_version_utils.GetUPDATE_PLUGIN_NAME()),
-        'UPDATE_PLUGIN_VERSION_ANSI=\\"%d\\"' % (
-            omaha_version_info.update_plugin_version),
-        'UPDATE_PLUGIN_FILENAME=_T(\\"%s\\")' % (
-            omaha_version_info.update_plugin_filename),
-        'BHO_NAME=_T(\\"%s\\")' % omaha_version_utils.GetBHO_NAME(),
-        'BHO_FILENAME=_T(\\"%s\\")' % omaha_version_info.bho_filename,
-        'CRASH_HANDLER_NAME=_T(\\"%s\\")' % omaha_version_utils.GetCRASH_HANDLER_NAME(),
-        ],
-
-    # Link in some windows libraries.
-    LIBS = [
-        'advapi32',
-        'comdlg32',
-        'gdi32',
-        'kernel32',
-        'odbc32',
-        'odbccp32',
-        'ole32',
-        'oleaut32',
-        'shell32',
-        'user32',
-        'uuid',
-        'winspool',
-        ],
-
-    # Common linker flags.
-    LINKFLAGS = [
-        '/nologo',
-        '/SUBSYSTEM:WINDOWS',
-        '/MACHINE:X86',
-        '/RELEASE',
-        '/MAP',
-        '/NODEFAULTLIB',
-        '/DYNAMICBASE',   # Enable ASLR. See http://goo.gl/k2IE.
-        '/NXCOMPAT',      # Enable NX support. See http://goo.gl/k2IE.
-        '/SAFESEH',
-        ],
-
-    # Shared library specific linker flags.
-    SHLINKFLAGS = [
-        '/nologo',
-        '/SUBSYSTEM:WINDOWS',
-        '/MACHINE:x86',
-        ],
-
-    # Resource compiler flags.
-    # Defines in CCFLAGS are automatically included.
-    RCFLAGS = [
-        '/l 1033',  # /l == default language ID
-        '/DBUILD_NUMBER=\\"%s\\"' % build_number,
-        '/DOMAHA_COPYRIGHT_STRING_ENGLISH=\\"%s\\"' % (
-            _OMAHA_COPYRIGHT_STRING_ENGLISH),
-        ],
-)
-
-# Allow verification of these settings in the build log.
-if win_env.Bit('build_server'):
-  print 'OFFICIAL_BUILD=1'
-  print 'TEST_CERTIFICATE=%d' % win_env.Bit('test_certificate')
-
-
-# Add the parent directory of the main omaha directory to the Python path so
-# that we can import using the format "omaha.subdir.module".
-sys.path.append(os.path.split(win_env.Dir('$MAIN_DIR').abspath)[0])
-
-# Make sure Vista SDK in all the important paths earlier in path than VC80.
-for mid_dir in ['', 'vc']:
-  for env_var, sub_dir in [('PATH', 'bin'),
-                           ('INCLUDE', 'include'),
-                           ('LIB', 'lib')]:
-    var_path = os.path.join(_sdk_path, mid_dir, sub_dir)
-    if os.path.exists(var_path):
-      win_env.PrependENVPath(env_var, var_path)
-
-if not win_env.Bit('official_installers'):
-  win_env.Append(CPPPATH = os.environ['OMAHA_WTL_DIR'])
-
-  # Make sure csc.exe can be located.
-  win_env.AppendENVPath('PATH', os.environ['OMAHA_NET_DIR'])
-
-  sys.path.append('tools')  # for import proxy_clsid_utils.py
-  import proxy_clsid_utils
-
-  # Generate uniqe proxy CLSIDs for each build.
-  win_env.Execute('python $MAIN_DIR\\tools\\proxy_clsid_utils.py')
-  win_env.Append(
-      CPPDEFINES = [
-        'PROXY_CLSID_IS_MACHINE=%s' % proxy_clsid_utils.GetMachineProxyClsid(),
-        'PROXY_CLSID_IS_USER=%s' % proxy_clsid_utils.GetUserProxyClsid(),
-      ],
-  )
-
-# WiX path has to be added before the WiX tool can be called.
-win_env.AppendENVPath('PATH', os.environ['OMAHA_WIX_DIR'])
-
-win_env.Tool('wix')
-
-
-_base_dirs = [
-    '.',
-    'base',
-    'clickonce',
-    'client',
-    'common',
-    'core',
-    'google_update',
-    'goopdate',
-    'net',
-    'service',
-    'setup',
-    'statsreport',
-    'third_party',
-    'tools',
-    'ui',
-    ]
-
-_normal_dirs = [
-    'google_update_b4451148',
-    'installers',
-    'mi_exe_stub',
-    'plugins',
-    'recovery',
-    ]
-
-_official_installers_dirs = [
-    'installers',
-    ]
-
-_extra_dirs = [
-    'enterprise',
-    'standalone',
-    ]
-
-#
-# Need to decide which subdirs need to be built.
-#
-_dirs_to_build_set = set()
-
-if win_env.Bit('official_installers'):
-  # Only want to build very specific subdirs.
-  win_env.SetBits('no-tests')
-  _dirs_to_build_set.update(_official_installers_dirs)
-elif not win_env.Bit('bin'):
-  # All other configs get the base dirs.
-  _dirs_to_build_set.update(_base_dirs)
-
-  if win_env.Bit('min'):
-    print '*** Building Minimal Set of Projects ***'
-  else:
-    _dirs_to_build_set.update(_normal_dirs)
-
-  if win_env.Bit('all'):
-    _dirs_to_build_set.update(_extra_dirs)
-
-# Build Google application-specific metainstallers.
-if os.path.exists(win_env.Dir('$MAIN_DIR/internal').abspath):
-  _dirs_to_build_set.update(['internal'])
-
-_dirs_to_build = list(_dirs_to_build_set)
-
-# This must be the last directory.
-if not win_env.Bit('no-tests'):
-  _dirs_to_build.append('testing')
-
-# Instruct Hammer which dirs to build.
-win_env['BUILD_SCONSCRIPTS'] = _dirs_to_build
-
-# These are used by the Omaha Builder OmahaUnittest(). They must be added to the
-# environment because there must be one per-mode.
-win_env['all_in_one_unittest_sources'] = []
-win_env['all_in_one_unittest_libs'] = set()
-
-
-# Create the leaf debug Windows environment.
-windows_debug_env = win_env.Clone(
-    # Give this build a name and a description.
-    BUILD_TYPE = 'dbg-win',
-    BUILD_TYPE_DESCRIPTION = 'Windows debug build',
-)
-
-# Use common debug settings.
-windows_debug_env.Tool('target_debug')
-
-windows_debug_env.Append(
-    CCFLAGS = [
-        '/RTC1',
-        '/Od',
-        '/MTd',
-        ],
-    CPPDEFINES = [
-        '_DEBUG',
-        'DEBUG',
-        ],
-)
-
-
-# Create the leaf optimized Windows environment.
-windows_optimized_env = win_env.Clone(
-    # Give this build a name and a description.
-    BUILD_TYPE = 'opt-win',
-    BUILD_TYPE_DESCRIPTION = 'Windows optimized build',
-)
-
-# Use common optimized settings.
-windows_optimized_env.Tool('target_optimized')
-
-windows_optimized_env.Append(
-    CCFLAGS = [
-        '/O1',        # Optimize for small size.
-        '/GS',
-        '/FD',
-        '/GL',        # Global optimization goes with link flag '/LTCG'
-        '/MT',
-        ],
-    CPPDEFINES = [
-        'NDEBUG',
-        'SHIPPING'    # code in 'common' needs this
-        ],
-    ARFLAGS = [
-        '/LTCG',      # Set LTCG for creation of .lib files too.
-        ],
-    LINKFLAGS = [
-        '/incremental:no',
-        '/opt:ref',
-        '/opt:icf=32',
-        '/opt:nowin98',
-        '/LTCG',      # Link-time code generation goes with cl flag '/GL'
-        ],
-)
-
-
-# Create an environment for coverage test builds, based on the dbg build.
-windows_coverage_env = windows_debug_env.Clone(
-    BUILD_TYPE = 'coverage-win',
-    BUILD_TYPE_DESCRIPTION = 'Windows coverage build',
-)
-# The Coverage build require additional tools that not everyone has. Therefore,
-# it should build as part of the all group.
-windows_coverage_env.FilterOut(BUILD_GROUPS=['all'])
-
-windows_coverage_env.Tool('code_coverage')
-
-# Coverage will run omaha_unittest.exe, which requires some extra environment.
-for env_var in os.environ:
-  if not env_var in windows_coverage_env['ENV']:
-    windows_coverage_env['ENV'][env_var] = os.environ[env_var]
-
-# Create a target that covers everything in the staging dir, as many of those
-# files will be required for the unittests to run successfully.
-# TODO(omaha3): This may not be necessary when using ComponentTestProgram. If it
-# is, it needs to be changed to use test/ instead of $STAGING_DIR/.
-windows_coverage_env.Alias(
-    'run_omaha_unittest_for_coverage',
-    '$STAGING_DIR',
-    '$STAGING_DIR/omaha_unittest.exe'
-)
-windows_coverage_env.Append(
-    # TODO(omaha): We cannot run our unit tests on the new build system. Ensure
-    # coverage works with the new test execution system.
-    # COVERAGE_TARGETS=['run_omaha_unittest_for_coverage'],
-    COVERAGE_INSTRUMENTATION_PATHS=['$STAGING_DIR'],
-    # This value should only be used in code if absolutely necessary.
-    CPPDEFINES=['COVERAGE_ENABLED'],
-)
-
-# TODO(omaha): Prevent the analyzer, which will fail, from running until we can
-# run unit tests on the build system. See the TODO above.
-windows_coverage_env['COVERAGE_START_CMD'] = '@echo Not starting coverage'
-windows_coverage_env['COVERAGE_STOP_CMD'] = '@echo Not ending coverage'
-
-# Skip signing in coverage build until the last step.
-windows_coverage_env['SIGNTOOL_ORIG'] = windows_coverage_env['SIGNTOOL']
-windows_coverage_env['SIGNTOOL'] = '@echo Signing deferred: '
-
-def SigningCommand(env, filename):
-  # Only do signing if there is a certificate file or certificate name.
-  if env.subst('$CERTIFICATE_PATH') or env.subst('$CERTIFICATE_NAME'):
-    # The command used to do signing (target added on below).
-    signing_cmd = '$SIGNTOOL_ORIG sign '
-    # Add in certificate file if any.
-    if env.subst('$CERTIFICATE_PATH'):
-      signing_cmd += ' /f "$CERTIFICATE_PATH"'
-      # Add certificate password if any.
-      if env.subst('$CERTIFICATE_PASSWORD'):
-        signing_cmd += ' /p "$CERTIFICATE_PASSWORD"'
-    # Add certificate store if any.
-    if env.subst('$CERTIFICATE_NAME'):
-      # The command used to do signing (target added on below).
-      signing_cmd += ' /s "$CERTIFICATE_STORE" /n "$CERTIFICATE_NAME"'
-    # Add timestamp server if any.
-    if env.subst('$TIMESTAMP_SERVER'):
-      signing_cmd += ' /t "$TIMESTAMP_SERVER"'
-    # Add in target name
-    signing_cmd += ' "%s"' % filename
-    return signing_cmd
-  else:
-    return 'echo no signing needed'
-
-def _IsInstrumentableFileType(file):
-  if (file.endswith('.exe') or
-      file.endswith('.dll')):
-    return True
-  return False
-
-def _IsSignableFileType(file):
-  if (file.endswith('.exe') or
-      file.endswith('.dll') or
-      file.endswith('.msi') or
-      file.endswith('.msp')):
-    return True
-  return False
-
-# Sign files during the install stage, since instrumentation invalidates the
-# signature. Signing within the individual build files was disabled above.
-# Do not sign intermediate "_unsigned" or "_unittest" files.
-# Instrumented files must be signed after installing becuase install is what
-# does the instrumentation. This also seems to be required to avoid
-# unnecessarily rebuilding non-instrumentable files.
-def _PostCoverageSigningInstall(dest, source, env):
-  if _IsInstrumentableFileType(dest) or not _IsSignableFileType(dest):
-    # Install the file to staging. Includes instrumentation if appropriate.
-    env['PRECOVERAGE_SIGN_INSTALL'](dest, source, env)
-  else:
-    # For signable but not instrumentable files, copy the files rather than
-    # using PRECOVERAGE_SIGN_INSTALL as this works around unnecessary rebuilds
-    # caused by http://code.google.com/p/swtoolkit/issues/detail?id=13.
-    env.Execute('copy "%s" "%s"' % (source, dest))
-
-  if (_IsSignableFileType(dest) and
-      (-1 == dest.find('_unsigned')) and
-      (-1 == dest.find('_unittest')) and
-      os.path.split(os.path.split(dest)[0])[1] == 'staging'):
-    env.Execute(SigningCommand(env, dest))
-
-windows_coverage_env['PRECOVERAGE_SIGN_INSTALL'] = (
-    windows_coverage_env['INSTALL'])
-windows_coverage_env['INSTALL'] = _PostCoverageSigningInstall
-
-
-# Make debug the default build after any copies of it have been made.
-windows_debug_env.Append(BUILD_GROUPS = ['default'])
-
-# ----------------------------------------------------------
-
-# Build the variants listed above.
-# This step will call each of the SConscripts (build.scons) listed,
-# once for each variant currently being built.
-BuildEnvironments(
-    [ windows_debug_env,
-      windows_optimized_env,
-      windows_coverage_env,
-    ]
-)
-
-if 'HAMMER_RUNS_TESTS' in os.environ.keys():
-  # Hammer sets the default target to 'scons-out'. This causes run_* aliases
-  # to also be built, which means the tests run by default. To avoid this, clear
-  # Default and set the default to just build the programs.
-  Default(None)
-  # TODO(omaha): Not all of our core binaries are included in these three
-  # aliases. This is because SignedBinary() and Command() do not add the outputs
-  # to a group. Fix this.
-  Default(['all_programs', 'all_libraries', 'all_test_programs'])
-
-if win_env.Bit('msvs'):
-  source_project = win_env.ComponentVSDirProject('all_source', ['$MAIN_DIR'])
-
-  # 'all_*' values do not appear to be populated until after BuildEnvironments
-  # is called. Thus, the solution will be specific to either debug or optimized.
-  # ComponentVSSourceProject() might be more desirable, but it does not appear
-  # to work.
-  windows_debug_env.ComponentVSSolution('omaha_dbg',
-                                        ['all_programs', 'all_libraries'],
-                                        projects=[source_project])
diff --git a/official/plugins/update/activex/update_control_idl.idl b/official/plugins/update/activex/update_control_idl.idl
deleted file mode 100644
index a84cc1c..0000000
--- a/official/plugins/update/activex/update_control_idl.idl
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-import "oaidl.idl";
-
-[
-  object,
-  uuid(57E37502-65A5-484a-A035-C1608B2626EA),
-  dual,
-  helpstring("GoogleUpdate3Web Control"),
-  pointer_default(unique)
-]
-interface IGoogleUpdate3WebControl : IDispatch {
-  [id(1)] HRESULT createOmahaMachineServerAsync(
-      [in] VARIANT_BOOL create_elevated,
-      [out, retval] IDispatch** async_status);
-
-  [id(2)] HRESULT createOmahaUserServer([out, retval] IDispatch** server);
-
-  [id(3)] HRESULT getInstalledVersion([in] BSTR guid_string,
-                                      [in] VARIANT_BOOL is_machine,
-                                      [out, retval] BSTR* version_string);
-
-  [id(4)] HRESULT crossInstall([in] BSTR extra_args);
-
-  [id(5)] HRESULT launchAppCommand([in] BSTR guid_string,
-                                   [in] VARIANT_BOOL is_machine,
-                                   [in] BSTR cmd_id);
-};
-
-[
-  object,
-  uuid(6F65D62B-2F32-4483-9028-176C30B2389D),
-  dual,
-  helpstring("Google Update OneClick Control"),
-  pointer_default(unique)
-]
-interface IGoogleUpdateOneClick : IDispatch
-{
-  // Deprecated. Will be removed in the next release of OneClick.
-  [id(1), helpstring("Install")] HRESULT Install(
-      [in] BSTR cmd_line_args,
-      [in] VARIANT* success_callback,
-      [in] VARIANT* failure_callback);
-
-  // New, easier way of calling Install. Use this for newer web pages.
-  [id(2), helpstring("Install2")] HRESULT Install2([in] BSTR extra_args);
-
-  [id(3), helpstring("GetInstalledVersion")] HRESULT GetInstalledVersion(
-      [in] BSTR guid_string,
-      [in] VARIANT_BOOL is_machine,
-      [out, retval] BSTR* version_string);
-
-  [id(4), helpstring("GetOneClickVersion")] HRESULT GetOneClickVersion(
-      [out, retval] long* version);
-
-  // TODO(omaha): Remove this if LaunchAppCommand only ships in Omaha3
-  [id(5), helpstring("LaunchAppCommand")] HRESULT LaunchAppCommand(
-      [in] BSTR app_guid,
-      [in] VARIANT_BOOL is_machine,
-      [in] BSTR cmd_id);
-};
-
-[
-  uuid(b627c883-e979-4873-80b3-ddd0b658b56a),
-  version(1.0),
-  helpstring("Google Update Browser Plugins 3.0 Type Library")
-]
-library GoogleUpdateControlLib {
-  importlib("stdole2.tlb");
-
-  interface IGoogleUpdateOneClick;
-  interface IGoogleUpdate3WebControl;
-
-  [
-    uuid(c442ac41-9200-4770-8cc0-7cdb4f245c55),
-    helpstring("Google Update OneClick Control Class")
-  ]
-  coclass GoogleUpdateOneClickControlCoClass
-  {
-    [default] interface IGoogleUpdateOneClick;
-  };
-
-  [
-    uuid(c3101a8b-0ee1-4612-bfe9-41ffc1a3c19d),
-    helpstring("GoogleUpdate3Web Control Class")
-  ]
-  coclass GoogleUpdate3WebControlCoClass {
-    [default] interface IDispatch;
-  };
-};
diff --git a/omaha_version_utils.py b/omaha_version_utils.py
deleted file mode 100644
index 2b8f565..0000000
--- a/omaha_version_utils.py
+++ /dev/null
@@ -1,349 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-"""Constants and utilities related to Omaha versions."""
-
-_ONECLICK_PLUGIN_NAME = 'npGoogleOneClick'
-_UPDATE_PLUGIN_NAME = 'npGoogleUpdate'
-_BHO_NAME = 'GoopdateBho'
-_CRASH_HANDLER_NAME = 'GoogleCrashHandler'
-
-# List of languages that are fully supported in the current build.
-_OMAHA_LANGUAGES = [
-    'am',
-    'ar',
-    'bg',
-    'bn',
-    'ca',
-    'cs',
-    'da',
-    'de',
-    'el',
-    'en',
-    'en-GB',
-    'es',
-    'es-419',
-    'et',
-    'fa',
-    'fi',
-    'fil',
-    'fr',
-    'gu',
-    'hi',
-    'hr',
-    'hu',
-    'id',
-    'is',
-    'it',
-    'iw',
-    'ja',
-    'kn',
-    'ko',
-    'lt',
-    'lv',
-    'ml',
-    'mr',
-    'ms',
-    'nl',
-    'no',
-    'pl',
-    'pt-BR',
-    'pt-PT',
-    'ro',
-    'ru',
-    'sk',
-    'sl',
-    'sr',
-    'sv',
-    'sw',
-    'ta',
-    'te',
-    'th',
-    'tr',
-    'uk',
-    'ur',
-    'vi',
-    'zh-CN',
-    'zh-TW',
-    ]
-
-# The shell and goopdate.dll contain additional languages.
-# 'userdefault' addresses apps that don't look up the resource for the OS
-# language. See http://b/1328652.
-_ADDITIONAL_SHELL_LANGUAGES = [
-    'or',
-    'userdefault',
-    'zh-HK',
-    ]
-
-
-def _IsSupportedOmaha2Version(omaha_version):
-  """Returns true if omaha_version is an Omaha 2 version and is supported."""
-  return (omaha_version[0] == 1 and
-          omaha_version[1] == 2 and
-          omaha_version[2] >= 183)
-
-
-# All languages supported by this script currently have the same set of
-# languages, so the omaha_version_info parameter is unused.
-def _GetMetainstallerPayloadFilenames(prefix,
-                                      update_plugin_filename,
-                                      bho_filename,
-                                      languages,
-                                      omaha_version):
-  """Returns list of metainstaller payload files for specified Omaha version."""
-  plugin_dll_name = '%s%s' % (prefix, update_plugin_filename)
-  bho_dll_name = '%s%s' % (prefix, bho_filename)
-
-  # The list of files below needs to be kept in sync with the list in
-  # SetupFiles::BuildFileLists().
-  # TODO(omaha): Move the other filename defines in main.scons into this file
-  # and allow all filenames to be customized.  At the moment, while the plugin
-  # names are generated in one place due to version numbers, most of the other
-  # files (googleupdate.exe, goopdateres_*.dll, etc.) are hardcoded all over
-  # the place, and require a ton of point fixes to customize.
-  payload_files = [
-      'GoogleUpdate.exe',
-      '%s.exe' % _CRASH_HANDLER_NAME,
-      '%sgoopdate.dll' % (prefix),
-      plugin_dll_name,
-      bho_dll_name,
-      'GoogleUpdateHelper.msi',
-      'GoogleUpdateBroker.exe',
-      'GoogleUpdateOnDemand.exe',
-      '%spsmachine.dll' % (prefix),
-      '%spsuser.dll' % (prefix),
-      ]
-
-  if (omaha_version[0] == 1 and
-      omaha_version[1] == 3 and
-      omaha_version[2] >= 13):
-    # The BHO is not built yet.
-    payload_files.remove(bho_dll_name)
-  elif _IsSupportedOmaha2Version(omaha_version):
-    payload_files.remove(plugin_dll_name)
-    payload_files.remove('GoogleUpdateBroker.exe')
-    payload_files.remove('GoogleUpdateOnDemand.exe')
-    payload_files.remove('psmachine.dll')
-    payload_files.remove('psuser.dll')
-  else:
-    raise Exception('Unsupported version: ' +
-                    ConvertVersionToString(omaha_version))
-
-  for language in languages:
-    payload_files += ['%sgoopdateres_%s.dll' % (prefix, language)]
-
-  return payload_files
-
-
-def ConvertVersionToString(version):
-  """Converts a four-element version list to a version string."""
-  return '%d.%d.%d.%d' % (version[0], version[1], version[2], version[3])
-
-
-def GetONECLICK_PLUGIN_NAME():  # pylint: disable-msg=C6409
-  """Returns the value of the ONECLICK_PLUGIN_NAME define for the C++ code."""
-  return _ONECLICK_PLUGIN_NAME
-
-
-def GetUPDATE_PLUGIN_NAME():  # pylint: disable-msg=C6409
-  """Returns the value of the UPDATE_PLUGIN_NAME define for the C++ code."""
-  return _UPDATE_PLUGIN_NAME
-
-
-def GetBHO_NAME():  # pylint: disable-msg=C6409
-  """Returns the value of the BHO_NAME define for the C++ code."""
-  return _BHO_NAME
-
-
-def GetCRASH_HANDLER_NAME():  # pylint: disable-msg=C6409
-  """Returns the value of the CRASH_HANDLER_NAME define for the C++ code."""
-  return _CRASH_HANDLER_NAME
-
-
-def GetLanguagesForVersion(omaha_version):
-  """Returns a list of languages supported by omaha_version."""
-  # Make a copy in case the list is modified below.
-  supported_languages = list(_OMAHA_LANGUAGES)
-
-  # When languages are added, add a version check for older versions without the
-  # new languages and remove the new languages from supported_languages.
-
-  if (omaha_version[0] == 1 and
-      omaha_version[1] == 3 and
-      omaha_version[2] >= 21):
-    # All languages are supported.
-    pass
-  elif _IsSupportedOmaha2Version(omaha_version):
-    # All current languages are supported. 'or' was also supported.
-    supported_languages += ['or']
-    supported_languages.remove('am')
-    supported_languages.remove('sw')
-  else:
-    raise Exception('Unsupported version: ' +
-                    ConvertVersionToString(omaha_version))
-
-  return supported_languages
-
-
-def GetShellLanguagesForVersion(omaha_version):
-  """Returns a list of languages supported by the omaha_version shell."""
-
-  # Silence PyLint. All languages supported by this script currently have the
-  # same set of languages, so this variable is unused.
-  omaha_version = omaha_version
-
-  return _OMAHA_LANGUAGES + _ADDITIONAL_SHELL_LANGUAGES
-
-
-class OmahaVersionInfo(object):
-  """Contains information about a specific version of Omaha.
-
-  Attributes:
-    filename_prefix: Prefix to use for all output files.
-    version_major: Major version.
-    version_minor: Minor version.
-    version_build: Build version.
-    version_patch: Patch version.
-    oneclick_plugin_version: Version of the OneClick plug-in.
-    oneclick_plugin_filename: Name of the signed OneClick DLL.
-    update_plugin_version: Version of the Omaha 3 plug-in.
-    update_plugin_filename: Name of the signed Omaha 3 plug-in DLL.
-    bho_filename:  Name of the signed BHO DLL.
-    crash_handler_filename: Name of the Crash Handler EXE.
-    oneclick_signed_file_info: SignedFileInfo object for the OneClick DLL.
-    bho_signed_file_info: SignedFileInfo object for the BHO DLL.
-
-  """
-
-  def __init__(self, version_file):
-    """Initializes the class based on data from a VERSION file."""
-    self._ReadFile(version_file)
-
-    self.filename_prefix = ''
-
-    # Objects containing more properties used to build the file.
-    self.oneclick_signed_file_info = SignedFileInfo(
-        _ONECLICK_PLUGIN_NAME,
-        'dll',
-        self.oneclick_plugin_version)
-    self.plugin_signed_file_info = SignedFileInfo(
-        _UPDATE_PLUGIN_NAME,
-        'dll',
-        self.update_plugin_version)
-    self.bho_signed_file_info = SignedFileInfo(_BHO_NAME, 'dll')
-
-    # Simple properties for callers that only need the final filename. Not
-    # affected by internal build changes.
-    self.oneclick_plugin_filename = self.oneclick_signed_file_info.filename
-    self.update_plugin_filename = self.plugin_signed_file_info.filename
-    self.bho_filename = self.bho_signed_file_info.filename
-    self.crash_handler_filename = _CRASH_HANDLER_NAME
-
-  def _ReadFile(self, version_file):
-    """Reads and stores data from a VERSION file."""
-
-    execfile(version_file, globals())
-
-    # Silence Pylint. Values from version_file are not defined in this file.
-    # E0602: Undefined variable.
-    # pylint: disable-msg=E0602
-
-    if version_patch > 0:
-      incrementing_value = version_patch
-      incrementing_value_name = 'patch'
-    else:
-      incrementing_value = version_build
-      incrementing_value_name = 'build'
-    if 0 == incrementing_value % 2:
-      raise Exception('ERROR: By convention, the %s number in VERSION '
-                      '(currently %d) should be odd.' %
-                      (incrementing_value_name, incrementing_value))
-
-    self.version_major = version_major
-    self.version_minor = version_minor
-    self.version_build = version_build
-    self.version_patch = version_patch
-
-    self.oneclick_plugin_version = oneclick_plugin_version
-
-    # update_plugin_version does not exist in Omaha 2 VERSION file. Handle this.
-    try:
-      self.update_plugin_version = update_plugin_version
-    except NameError:
-      if _IsSupportedOmaha2Version(self.GetVersion()):
-        self.update_plugin_version = -1
-      else:
-        raise
-
-    # pylint: enable-msg=E0602
-
-  def MakeTestVersion(self, delta=1):
-    """Changes this object to be for a TEST version of Omaha."""
-
-    if delta <= 0:
-      raise Exception('Delta must be greater than 0.')
-
-    # If we're doing a patch, increment patch; else, increment build.
-    if self.version_patch > 0:
-      self.version_patch += delta
-    else:
-      self.version_build += delta
-
-    self.filename_prefix = 'TEST_'
-
-  def GetVersion(self):
-    """Returns the version elements as a list."""
-    return [self.version_major,
-            self.version_minor,
-            self.version_build,
-            self.version_patch
-           ]
-
-  def GetVersionString(self):
-    """Returns the version as a string."""
-    return ConvertVersionToString(self.GetVersion())
-
-  def GetSupportedLanguages(self):
-    """Returns a list of languages supported by this version."""
-    return GetLanguagesForVersion(self.GetVersion())
-
-  def GetMetainstallerPayloadFilenames(self):
-    """Returns list of metainstaller payload files for this version of Omaha."""
-    return _GetMetainstallerPayloadFilenames(self.filename_prefix,
-                                             self.update_plugin_filename,
-                                             self.bho_filename,
-                                             self.GetSupportedLanguages(),
-                                             self.GetVersion())
-
-
-class SignedFileInfo(object):
-  """Contains information, including intermediate names, for signed file."""
-
-  def __init__(self, unversioned_name, extension, file_version=None):
-    """Initializes the class members based on the parameters."""
-
-    if file_version:
-      base_name = '%s%d' % (unversioned_name, file_version)
-    else:
-      base_name = unversioned_name
-
-    self.filename_base = base_name
-    self.filename = '%s.%s' % (self.filename_base, extension)
-
-    self.unsigned_filename_base = '%s_unsigned' % base_name
-    self.unsigned_filename = '%s.%s' % (self.unsigned_filename_base, extension)
diff --git a/plugins/base/build.scons b/plugins/base/build.scons
deleted file mode 100644
index a2afbeb..0000000
--- a/plugins/base/build.scons
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-# Build plugin base.
-plugin_base_env = env.Clone()
-# TODO(omaha3): make this configurable for 64-bit support
-plugin_base_env['CCFLAGS'] += ['/D_X86_',]
-plugin_base_env.ComponentLibrary(
-    lib_name='plugin_base',
-    source=[
-      'np_entry.cc',
-      'npn_gate.cc',
-      'npp_gate.cc',
-    ],
-)
diff --git a/plugins/base/np_entry.cc b/plugins/base/np_entry.cc
deleted file mode 100644
index c3ad7b3..0000000
--- a/plugins/base/np_entry.cc
+++ /dev/null
@@ -1,321 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: NPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Netscape Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/NPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the NPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the NPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-//////////////////////////////////////////////////////////////
-//
-// Main plugin entry point implementation -- exports from the
-// plugin library
-//
-
-#include <algorithm>
-#include "omaha/plugins/base/npplat.h"
-#include "omaha/plugins/base/pluginbase.h"
-
-#ifdef _WINDOWS
-#define OSCALL WINAPI
-#else
-#define OSCALL
-#endif
-
-NPNetscapeFuncs NPNFuncs = {sizeof(NPNFuncs)};
-
-NPError OSCALL NP_Shutdown()
-{
-  NS_PluginShutdown();
-  return NPERR_NO_ERROR;
-}
-
-static NPError fillPluginFunctionTable(NPPluginFuncs* aNPPFuncs)
-{
-  if (aNPPFuncs == NULL || aNPPFuncs->size < sizeof(NPPluginFuncs)) {
-    return NPERR_INVALID_FUNCTABLE_ERROR;
-  }
-
-  // Set up the plugin function table that Netscape will use to
-  // call us. Netscape needs to know about our version and size
-  // and have a UniversalProcPointer for every function we implement.
-
-  aNPPFuncs->version       = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
-#ifdef XP_MAC
-  aNPPFuncs->newp          = NewNPP_NewProc(Private_New);
-  aNPPFuncs->destroy       = NewNPP_DestroyProc(Private_Destroy);
-  aNPPFuncs->setwindow     = NewNPP_SetWindowProc(Private_SetWindow);
-  aNPPFuncs->newstream     = NewNPP_NewStreamProc(Private_NewStream);
-  aNPPFuncs->destroystream = NewNPP_DestroyStreamProc(Private_DestroyStream);
-  aNPPFuncs->asfile        = NewNPP_StreamAsFileProc(Private_StreamAsFile);
-  aNPPFuncs->writeready    = NewNPP_WriteReadyProc(Private_WriteReady);
-  aNPPFuncs->write         = NewNPP_WriteProc(Private_Write);
-  aNPPFuncs->print         = NewNPP_PrintProc(Private_Print);
-  aNPPFuncs->event         = NewNPP_HandleEventProc(Private_HandleEvent);
-  aNPPFuncs->urlnotify     = NewNPP_URLNotifyProc(Private_URLNotify);
-  aNPPFuncs->getvalue      = NewNPP_GetValueProc(Private_GetValue);
-  aNPPFuncs->setvalue      = NewNPP_SetValueProc(Private_SetValue);
-#else
-  aNPPFuncs->newp          = NPP_New;
-  aNPPFuncs->destroy       = NPP_Destroy;
-  aNPPFuncs->setwindow     = NPP_SetWindow;
-  aNPPFuncs->newstream     = NPP_NewStream;
-  aNPPFuncs->destroystream = NPP_DestroyStream;
-  aNPPFuncs->asfile        = NPP_StreamAsFile;
-  aNPPFuncs->writeready    = NPP_WriteReady;
-  aNPPFuncs->write         = NPP_Write;
-  aNPPFuncs->print         = NPP_Print;
-  aNPPFuncs->event         = NPP_HandleEvent;
-  aNPPFuncs->urlnotify     = NPP_URLNotify;
-  aNPPFuncs->getvalue      = NPP_GetValue;
-  aNPPFuncs->setvalue      = NPP_SetValue;
-#endif
-#ifdef OJI
-  aNPPFuncs->javaClass     = NULL;
-#endif
-
-  return NPERR_NO_ERROR;
-}
-
-static NPError fillNetscapeFunctionTable(NPNetscapeFuncs* aNPNFuncs)
-{
-  if (aNPNFuncs == NULL) {
-    return NPERR_INVALID_FUNCTABLE_ERROR;
-  }
-
-  if (HIBYTE(aNPNFuncs->version) > NP_VERSION_MAJOR) {
-    return NPERR_INCOMPATIBLE_VERSION_ERROR;
-  }
-
-  memcpy(&NPNFuncs, aNPNFuncs, std::min(static_cast<size_t>(aNPNFuncs->size),
-                                                            sizeof(NPNFuncs)));
-  
-  if (!NPNFuncs.memalloc ||
-      !NPNFuncs.memfree ||
-      !NPNFuncs.createobject ||
-      !NPNFuncs.retainobject ||
-      !NPNFuncs.releaseobject ||
-      !NPNFuncs.utf8fromidentifier ||
-      !NPNFuncs.releasevariantvalue ||
-      !NPNFuncs.getstringidentifier ||
-      !NPNFuncs.getvalue ||
-      !NPNFuncs.setexception ||
-      !NPNFuncs.getproperty ||
-      // Used only by oneclick plugin.
-      !NPNFuncs.invokeDefault) {
-    return NPERR_INVALID_FUNCTABLE_ERROR;
-  }
-
-  return NPERR_NO_ERROR;
-}
-
-//
-// Some exports are different on different platforms
-//
-
-/**************************************************/
-/*                                                */
-/*                   Windows                      */
-/*                                                */
-/**************************************************/
-#ifdef XP_WIN
-
-NPError OSCALL NP_Initialize(NPNetscapeFuncs* aNPNFuncs)
-{
-  NPError rv = fillNetscapeFunctionTable(aNPNFuncs);
-  if(rv != NPERR_NO_ERROR)
-    return rv;
-
-  return NS_PluginInitialize();
-}
-
-NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* aNPPFuncs)
-{
-  return fillPluginFunctionTable(aNPPFuncs);
-}
-
-#endif //XP_WIN
-
-/**************************************************/
-/*                                                */
-/*                    Unix                        */
-/*                                                */
-/**************************************************/
-#ifdef XP_UNIX
-
-NPError NP_Initialize(NPNetscapeFuncs* aNPNFuncs, NPPluginFuncs* aNPPFuncs)
-{
-  NPError rv = fillNetscapeFunctionTable(aNPNFuncs);
-  if(rv != NPERR_NO_ERROR)
-    return rv;
-
-  rv = fillPluginFunctionTable(aNPPFuncs);
-  if(rv != NPERR_NO_ERROR)
-    return rv;
-
-  return NS_PluginInitialize();
-}
-
-char * NP_GetMIMEDescription(void)
-{
-  return NPP_GetMIMEDescription();
-}
-
-NPError NP_GetValue(void *future, NPPVariable aVariable, void *aValue)
-{
-  return NS_PluginGetValue(aVariable, aValue);
-}
-
-#endif //XP_UNIX
-
-/**************************************************/
-/*                                                */
-/*                     Mac                        */
-/*                                                */
-/**************************************************/
-#ifdef XP_MAC
-
-#if !TARGET_API_MAC_CARBON
-QDGlobals* gQDPtr; // Pointer to Netscape's QuickDraw globals
-#endif
-
-short gResFile; // Refnum of the plugin's resource file
-
-NPError Private_Initialize(void)
-{
-  NPError rv = NS_PluginInitialize();
-  return rv;
-}
-
-void Private_Shutdown(void)
-{
-  NS_PluginShutdown();
-  __destroy_global_chain();
-}
-
-void SetUpQD(void);
-
-void SetUpQD(void)
-{
-  ProcessSerialNumber PSN;
-  FSSpec              myFSSpec;
-  Str63               name;
-  ProcessInfoRec      infoRec;
-  OSErr               result = noErr;
-  CFragConnectionID   connID;
-  Str255              errName;
-
-  // Memorize the plugin¹s resource file refnum for later use.
-  gResFile = CurResFile();
-
-#if !TARGET_API_MAC_CARBON
-  // Ask the system if CFM is available.
-  long response;
-  OSErr err = Gestalt(gestaltCFMAttr, &response);
-  Boolean hasCFM = BitTst(&response, 31-gestaltCFMPresent);
-
-  if (hasCFM) {
-    // GetProcessInformation takes a process serial number and
-    // will give us back the name and FSSpec of the application.
-    // See the Process Manager in IM.
-    infoRec.processInfoLength = sizeof(ProcessInfoRec);
-    infoRec.processName = name;
-    infoRec.processAppSpec = &myFSSpec;
-
-    PSN.highLongOfPSN = 0;
-    PSN.lowLongOfPSN = kCurrentProcess;
-
-    result = GetProcessInformation(&PSN, &infoRec);
-  }
-  else
-    // If no CFM installed, assume it must be a 68K app.
-    result = -1;
-
-  if (result == noErr) {
-    // Now that we know the app name and FSSpec, we can call GetDiskFragment
-    // to get a connID to use in a subsequent call to FindSymbol (it will also
-    // return the address of ³main² in app, which we ignore).  If GetDiskFragment
-    // returns an error, we assume the app must be 68K.
-    Ptr mainAddr;
-    result =  GetDiskFragment(infoRec.processAppSpec, 0L, 0L, infoRec.processName,
-                              kReferenceCFrag, &connID, (Ptr*)&mainAddr, errName);
-  }
-
-  if (result == noErr) {
-    // The app is a PPC code fragment, so call FindSymbol
-    // to get the exported ³qd² symbol so we can access its
-    // QuickDraw globals.
-    CFragSymbolClass symClass;
-    result = FindSymbol(connID, "\pqd", (Ptr*)&gQDPtr, &symClass);
-  }
-  else {
-    // The app is 68K, so use its A5 to compute the address
-    // of its QuickDraw globals.
-    gQDPtr = (QDGlobals*)(*((long*)SetCurrentA5()) - (sizeof(QDGlobals) - sizeof(GrafPtr)));
-  }
-#endif /* !TARGET_API_MAC_CARBON */
-}
-
-NPError main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp);
-
-#if !TARGET_API_MAC_CARBON
-#pragma export on
-#if GENERATINGCFM
-RoutineDescriptor mainRD = BUILD_ROUTINE_DESCRIPTOR(uppNPP_MainEntryProcInfo, main);
-#endif
-#pragma export off
-#endif /* !TARGET_API_MAC_CARBON */
-
-
-NPError main(NPNetscapeFuncs* aNPNFuncs, NPPluginFuncs* aNPPFuncs, NPP_ShutdownUPP* aUnloadUpp)
-{
-  NPError rv = NPERR_NO_ERROR;
-
-  if (aUnloadUpp == NULL)
-    rv = NPERR_INVALID_FUNCTABLE_ERROR;
-
-  if (rv == NPERR_NO_ERROR)
-    rv = fillNetscapeFunctionTable(aNPNFuncs);
-
-  if (rv == NPERR_NO_ERROR) {
-    // defer static constructors until the global functions are initialized.
-    __InitCode__();
-    rv = fillPluginFunctionTable(aNPPFuncs);
-  }
-
-  *aUnloadUpp = NewNPP_ShutdownProc(Private_Shutdown);
-  SetUpQD();
-  rv = Private_Initialize();
-
-  return rv;
-}
-#endif //XP_MAC
diff --git a/plugins/base/npn_gate.cc b/plugins/base/npn_gate.cc
deleted file mode 100644
index 5aee8f3..0000000
--- a/plugins/base/npn_gate.cc
+++ /dev/null
@@ -1,259 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: NPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Netscape Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/NPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the NPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the NPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-
-////////////////////////////////////////////////////////////
-//
-// Implementation of Netscape entry points (NPN_*)
-//
-#include "omaha/plugins/base/npplat.h"
-
-extern NPNetscapeFuncs NPNFuncs;
-
-/*
-void NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor)
-{
-  *plugin_major   = NP_VERSION_MAJOR;
-  *plugin_minor   = NP_VERSION_MINOR;
-  *netscape_major = HIBYTE(NPNFuncs.version);
-  *netscape_minor = LOBYTE(NPNFuncs.version);
-}
-
-NPError NPN_GetURLNotify(NPP instance, const char *url, const char *target, void* notifyData)
-{
-  int navMinorVers = NPNFuncs.version & 0xFF;
-  NPError rv = NPERR_NO_ERROR;
-
-  if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
-    rv = CallNPN_GetURLNotifyProc(NPNFuncs.geturlnotify, instance, url, target, notifyData);
-  else
-    rv = NPERR_INCOMPATIBLE_VERSION_ERROR;
-
-  return rv;
-}
-
-NPError NPN_GetURL(NPP instance, const char *url, const char *target)
-{
-  NPError rv = CallNPN_GetURLProc(NPNFuncs.geturl, instance, url, target);
-  return rv;
-}
-
-NPError NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file, void* notifyData)
-{
-  int navMinorVers = NPNFuncs.version & 0xFF;
-  NPError rv = NPERR_NO_ERROR;
-
-  if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
-    rv = CallNPN_PostURLNotifyProc(NPNFuncs.posturlnotify, instance, url, window, len, buf, file, notifyData);
-  else
-    rv = NPERR_INCOMPATIBLE_VERSION_ERROR;
-
-  return rv;
-}
-
-NPError NPN_PostURL(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file)
-{
-  NPError rv = CallNPN_PostURLProc(NPNFuncs.posturl, instance, url, window, len, buf, file);
-  return rv;
-}
-
-NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
-{
-  NPError rv = CallNPN_RequestReadProc(NPNFuncs.requestread, stream, rangeList);
-  return rv;
-}
-
-NPError NPN_NewStream(NPP instance, NPMIMEType type, const char* target, NPStream** stream)
-{
-  int navMinorVersion = NPNFuncs.version & 0xFF;
-
-  NPError rv = NPERR_NO_ERROR;
-
-  if( navMinorVersion >= NPVERS_HAS_STREAMOUTPUT )
-    rv = CallNPN_NewStreamProc(NPNFuncs.newstream, instance, type, target, stream);
-  else
-    rv = NPERR_INCOMPATIBLE_VERSION_ERROR;
-
-  return rv;
-}
-
-int32 NPN_Write(NPP instance, NPStream *stream, int32 len, void *buffer)
-{
-  int navMinorVersion = NPNFuncs.version & 0xFF;
-  int32 rv = 0;
-
-  if( navMinorVersion >= NPVERS_HAS_STREAMOUTPUT )
-    rv = CallNPN_WriteProc(NPNFuncs.write, instance, stream, len, buffer);
-  else
-    rv = -1;
-
-  return rv;
-}
-
-NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
-{
-  int navMinorVersion = NPNFuncs.version & 0xFF;
-  NPError rv = NPERR_NO_ERROR;
-
-  if( navMinorVersion >= NPVERS_HAS_STREAMOUTPUT )
-    rv = CallNPN_DestroyStreamProc(NPNFuncs.destroystream, instance, stream, reason);
-  else
-    rv = NPERR_INCOMPATIBLE_VERSION_ERROR;
-
-  return rv;
-}
-
-void NPN_Status(NPP instance, const char *message)
-{
-  CallNPN_StatusProc(NPNFuncs.status, instance, message);
-}
-
-const char* NPN_UserAgent(NPP instance)
-{
-  const char * rv = NULL;
-  rv = CallNPN_UserAgentProc(NPNFuncs.uagent, instance);
-  return rv;
-}
-*/
-
-void* NPN_MemAlloc(uint32 size)
-{
-  void* rv = NULL;
-  return NPNFuncs.memalloc(size);
-}
-
-void NPN_MemFree(void* ptr)
-{
-  NPNFuncs.memfree(ptr);
-}
-
-/*
-uint32 NPN_MemFlush(uint32 size)
-{
-  uint32 rv = CallNPN_MemFlushProc(NPNFuncs.memflush, size);
-  return rv;
-}
-
-void NPN_ReloadPlugins(NPBool reloadPages)
-{
-  CallNPN_ReloadPluginsProc(NPNFuncs.reloadplugins, reloadPages);
-}
-
-#ifdef OJI
-JRIEnv* NPN_GetJavaEnv(void)
-{
-  JRIEnv * rv = NULL;
-  rv = CallNPN_GetJavaEnvProc(NPNFuncs.getJavaEnv);
-  return rv;
-}
-
-jref NPN_GetJavaPeer(NPP instance)
-{
-  jref rv;
-  rv = CallNPN_GetJavaPeerProc(NPNFuncs.getJavaPeer, instance);
-  return rv;
-}
-#endif
-*/
-
-NPError NPN_GetValue(NPP instance, NPNVariable variable, void *value)
-{
-  return NPNFuncs.getvalue(instance, variable, value);
-}
-
-/*
-NPError NPN_SetValue(NPP instance, NPPVariable variable, void *value)
-{
-  NPError rv = CallNPN_SetValueProc(NPNFuncs.setvalue, instance, variable, value);
-  return rv;
-}
-
-void NPN_InvalidateRect(NPP instance, NPRect *invalidRect)
-{
-  CallNPN_InvalidateRectProc(NPNFuncs.invalidaterect, instance, invalidRect);
-}
-
-void NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion)
-{
-  CallNPN_InvalidateRegionProc(NPNFuncs.invalidateregion, instance, invalidRegion);
-}
-
-void NPN_ForceRedraw(NPP instance)
-{
-  CallNPN_ForceRedrawProc(NPNFuncs.forceredraw, instance);
-}
-*/
-
-// Used by the Omaha 3 plugin.
-NPUTF8* NPN_UTF8FromIdentifier(NPIdentifier identifier) {
-  return NPNFuncs.utf8fromidentifier(identifier);
-}
-
-NPObject* NPN_RetainObject(NPObject* obj) {
-  return NPNFuncs.retainobject(obj);
-}
-
-void NPN_ReleaseObject(NPObject* obj) {
-  NPNFuncs.releaseobject(obj);
-}
-
-NPIdentifier NPN_GetStringIdentifier(const NPUTF8* name) {
-  return NPNFuncs.getstringidentifier(name);
-}
-
-NPObject* NPN_CreateObject(NPP npp, NPClass* aClass) {
-  return NPNFuncs.createobject(npp, aClass);
-}
-
-void NPN_SetException(NPObject* obj, const NPUTF8* message) {
-  NPNFuncs.setexception(obj, message);
-}
-
-void NPN_ReleaseVariantValue(NPVariant* variant) {
-  NPNFuncs.releasevariantvalue(variant);
-}
-
-bool NPN_GetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName,
-                     NPVariant* result) {
-  return NPNFuncs.getproperty(npp, obj, propertyName, result);
-}
-
-// Some additional stuff that's used by the oneclick plugin
-bool NPN_InvokeDefault(NPP npp, NPObject* obj, const NPVariant* args,
-                       uint32_t argCount, NPVariant* result) {
-  return NPNFuncs.invokeDefault(npp, obj, args, argCount, result);
-}
diff --git a/plugins/base/npp_gate.cc b/plugins/base/npp_gate.cc
deleted file mode 100644
index ee9da88..0000000
--- a/plugins/base/npp_gate.cc
+++ /dev/null
@@ -1,358 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: NPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Netscape Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/NPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the NPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the NPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-
-////////////////////////////////////////////////////////////
-//
-// Implementation of plugin entry points (NPP_*)
-//
-#include "omaha/plugins/base/pluginbase.h"
-
-// here the plugin creates a plugin instance object which
-// will be associated with this newly created NPP instance and
-// will do all the neccessary job
-NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved)
-{
-  if(instance == NULL)
-    return NPERR_INVALID_INSTANCE_ERROR;
-
-  NPError rv = NPERR_NO_ERROR;
-
-  // create a new plugin instance object
-  // initialization will be done when the associated window is ready
-  nsPluginCreateData ds;
-
-  ds.instance = instance;
-  ds.type     = pluginType;
-  ds.mode     = mode;
-  ds.argc     = argc;
-  ds.argn     = argn;
-  ds.argv     = argv;
-  ds.saved    = saved;
-
-  nsPluginInstanceBase * plugin = NS_NewPluginInstance(&ds);
-  if(plugin == NULL)
-    return NPERR_OUT_OF_MEMORY_ERROR;
-
-  // associate the plugin instance object with NPP instance
-  instance->pdata = (void *)plugin;
-  return rv;
-}
-
-// here is the place to clean up and destroy the nsPluginInstance object
-NPError NPP_Destroy (NPP instance, NPSavedData** save)
-{
-  if(instance == NULL)
-    return NPERR_INVALID_INSTANCE_ERROR;
-
-  NPError rv = NPERR_NO_ERROR;
-
-  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
-  if(plugin != NULL) {
-    plugin->shut();
-    NS_DestroyPluginInstance(plugin);
-  }
-  return rv;
-}
-
-// during this call we know when the plugin window is ready or
-// is about to be destroyed so we can do some gui specific
-// initialization and shutdown
-NPError NPP_SetWindow (NPP instance, NPWindow* pNPWindow)
-{
-  if(instance == NULL)
-    return NPERR_INVALID_INSTANCE_ERROR;
-
-  NPError rv = NPERR_NO_ERROR;
-
-  if(pNPWindow == NULL)
-    return NPERR_GENERIC_ERROR;
-
-  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
-
-  if(plugin == NULL)
-    return NPERR_GENERIC_ERROR;
-
-  // window just created
-  if(!plugin->isInitialized() && (pNPWindow->window != NULL)) {
-    if(!plugin->init(pNPWindow)) {
-      NS_DestroyPluginInstance(plugin);
-      return NPERR_MODULE_LOAD_FAILED_ERROR;
-    }
-  }
-
-  // window goes away
-  if((pNPWindow->window == NULL) && plugin->isInitialized())
-    return plugin->SetWindow(pNPWindow);
-
-  // window resized?
-  if(plugin->isInitialized() && (pNPWindow->window != NULL))
-    return plugin->SetWindow(pNPWindow);
-
-  // this should not happen, nothing to do
-  if((pNPWindow->window == NULL) && !plugin->isInitialized())
-    return plugin->SetWindow(pNPWindow);
-
-  return rv;
-}
-
-NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype)
-{
-  if(instance == NULL)
-    return NPERR_INVALID_INSTANCE_ERROR;
-
-  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
-  if(plugin == NULL)
-    return NPERR_GENERIC_ERROR;
-
-  NPError rv = plugin->NewStream(type, stream, seekable, stype);
-  return rv;
-}
-
-int32 NPP_WriteReady (NPP instance, NPStream *stream)
-{
-  if(instance == NULL)
-    return 0x0fffffff;
-
-  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
-  if(plugin == NULL)
-    return 0x0fffffff;
-
-  int32 rv = plugin->WriteReady(stream);
-  return rv;
-}
-
-int32 NPP_Write (NPP instance, NPStream *stream, int32 offset, int32 len, void *buffer)
-{
-  if(instance == NULL)
-    return len;
-
-  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
-  if(plugin == NULL)
-    return len;
-
-  int32 rv = plugin->Write(stream, offset, len, buffer);
-  return rv;
-}
-
-NPError NPP_DestroyStream (NPP instance, NPStream *stream, NPError reason)
-{
-  if(instance == NULL)
-    return NPERR_INVALID_INSTANCE_ERROR;
-
-  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
-  if(plugin == NULL)
-    return NPERR_GENERIC_ERROR;
-
-  NPError rv = plugin->DestroyStream(stream, reason);
-  return rv;
-}
-
-void NPP_StreamAsFile (NPP instance, NPStream* stream, const char* fname)
-{
-  if(instance == NULL)
-    return;
-
-  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
-  if(plugin == NULL)
-    return;
-
-  plugin->StreamAsFile(stream, fname);
-}
-
-void NPP_Print (NPP instance, NPPrint* printInfo)
-{
-  if(instance == NULL)
-    return;
-
-  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
-  if(plugin == NULL)
-    return;
-
-  plugin->Print(printInfo);
-}
-
-void NPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData)
-{
-  if(instance == NULL)
-    return;
-
-  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
-  if(plugin == NULL)
-    return;
-
-  plugin->URLNotify(url, reason, notifyData);
-}
-
-NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
-{
-  if(instance == NULL)
-    return NPERR_INVALID_INSTANCE_ERROR;
-
-  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
-  if(plugin == NULL)
-    return NPERR_GENERIC_ERROR;
-
-  NPError rv = plugin->GetValue(variable, value);
-  return rv;
-}
-
-NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value)
-{
-  if(instance == NULL)
-    return NPERR_INVALID_INSTANCE_ERROR;
-
-  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
-  if(plugin == NULL)
-    return NPERR_GENERIC_ERROR;
-
-  NPError rv = plugin->SetValue(variable, value);
-  return rv;
-}
-
-int16 NPP_HandleEvent(NPP instance, void* event)
-{
-  if(instance == NULL)
-    return 0;
-
-  nsPluginInstanceBase * plugin = (nsPluginInstanceBase *)instance->pdata;
-  if(plugin == NULL)
-    return 0;
-
-  uint16 rv = plugin->HandleEvent(event);
-  return rv;
-}
-
-#ifdef OJI
-jref NPP_GetJavaClass (void)
-{
-  return NULL;
-}
-#endif
-
-/**************************************************/
-/*                                                */
-/*                     Mac                        */
-/*                                                */
-/**************************************************/
-
-// Mac needs these wrappers, see npplat.h for more info
-
-#ifdef XP_MAC
-
-NPError Private_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved)
-{
-  NPError rv = NPP_New(pluginType, instance, mode, argc, argn, argv, saved);
-  return rv;
-}
-
-NPError Private_Destroy(NPP instance, NPSavedData** save)
-{
-  NPError rv = NPP_Destroy(instance, save);
-  return rv;
-}
-
-NPError Private_SetWindow(NPP instance, NPWindow* window)
-{
-  NPError rv = NPP_SetWindow(instance, window);
-  return rv;
-}
-
-NPError Private_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype)
-{
-  NPError rv = NPP_NewStream(instance, type, stream, seekable, stype);
-  return rv;
-}
-
-int32 Private_WriteReady(NPP instance, NPStream* stream)
-{
-  int32 rv = NPP_WriteReady(instance, stream);
-  return rv;
-}
-
-int32 Private_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer)
-{
-  int32 rv = NPP_Write(instance, stream, offset, len, buffer);
-  return rv;
-}
-
-void Private_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
-{
-  NPP_StreamAsFile(instance, stream, fname);
-}
-
-
-NPError Private_DestroyStream(NPP instance, NPStream* stream, NPError reason)
-{
-  NPError rv = NPP_DestroyStream(instance, stream, reason);
-  return rv;
-}
-
-int16 Private_HandleEvent(NPP instance, void* event)
-{
-  int16 rv = NPP_HandleEvent(instance, event);
-  return rv;
-}
-
-void Private_Print(NPP instance, NPPrint* platformPrint)
-{
-  NPP_Print(instance, platformPrint);
-}
-
-void Private_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData)
-{
-  NPP_URLNotify(instance, url, reason, notifyData);
-}
-
-jref Private_GetJavaClass(void)
-{
-  return NULL;
-}
-
-NPError Private_GetValue(NPP instance, NPPVariable variable, void *result)
-{
-  NPError rv = NPP_GetValue(instance, variable, result);
-  return rv;
-}
-
-NPError Private_SetValue(NPP instance, NPNVariable variable, void *value)
-{
-  NPError rv = NPP_SetValue(instance, variable, value);
-  return rv;
-}
-
-#endif //XP_MAC
diff --git a/plugins/base/npplat.h b/plugins/base/npplat.h
deleted file mode 100644
index e9700c7..0000000
--- a/plugins/base/npplat.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: NPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Netscape Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/NPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the NPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the NPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef OMAHA_PLUGINS_COMMON_NPPLAT_H_
-#define OMAHA_PLUGINS_COMMON_NPPLAT_H_
-
-/**************************************************/
-/*                                                */
-/*                   Windows                      */
-/*                                                */
-/**************************************************/
-#ifdef XP_WIN
-#include "windows.h"
-#endif //XP_WIN
-
-/**************************************************/
-/*                                                */
-/*                    Unix                        */
-/*                                                */
-/**************************************************/
-#ifdef XP_UNIX
-#include <stdio.h>
-#endif //XP_UNIX
-
-/**************************************************/
-/*                                                */
-/*                     Mac                        */
-/*                                                */
-/**************************************************/
-#ifdef XP_MAC
-
-#include <Processes.h>
-#include <Gestalt.h>
-#include <CodeFragments.h>
-#include <Timer.h>
-#include <Resources.h>
-#include <ToolUtils.h>
-
-#include "jri.h"
-
-// The Mixed Mode procInfos defined in npupp.h assume Think C-
-// style calling conventions.  These conventions are used by
-// Metrowerks with the exception of pointer return types, which
-// in Metrowerks 68K are returned in A0, instead of the standard
-// D0. Thus, since NPN_MemAlloc and NPN_UserAgent return pointers,
-// Mixed Mode will return the values to a 68K plugin in D0, but
-// a 68K plugin compiled by Metrowerks will expect the result in
-// A0.  The following pragma forces Metrowerks to use D0 instead.
-//
-#ifdef __MWERKS__
-#ifndef powerc
-#pragma pointers_in_D0
-#endif
-#endif
-
-#ifdef __MWERKS__
-#ifndef powerc
-#pragma pointers_in_A0
-#endif
-#endif
-
-// The following fix for static initializers (which fixes a preious
-// incompatibility with some parts of PowerPlant, was submitted by
-// Jan Ulbrich.
-#ifdef __MWERKS__
-  #ifdef __cplusplus
-  extern "C" {
-  #endif
-    #ifndef powerc
-      extern void __InitCode__(void);
-    #else
-      extern void __sinit(void);
-      #define __InitCode__ __sinit
-    #endif
-    extern void __destroy_global_chain(void);
-  #ifdef __cplusplus
-  }
-  #endif // __cplusplus
-#endif // __MWERKS__
-
-// Wrapper functions for all calls from Netscape to the plugin.
-// These functions let the plugin developer just create the APIs
-// as documented and defined in npapi.h, without needing to
-// install those functions in the function table or worry about
-// setting up globals for 68K plugins.
-NPError Private_Initialize(void);
-void    Private_Shutdown(void);
-NPError Private_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
-NPError Private_Destroy(NPP instance, NPSavedData** save);
-NPError Private_SetWindow(NPP instance, NPWindow* window);
-NPError Private_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype);
-NPError Private_DestroyStream(NPP instance, NPStream* stream, NPError reason);
-int32   Private_WriteReady(NPP instance, NPStream* stream);
-int32   Private_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer);
-void    Private_StreamAsFile(NPP instance, NPStream* stream, const char* fname);
-void    Private_Print(NPP instance, NPPrint* platformPrint);
-int16   Private_HandleEvent(NPP instance, void* event);
-void    Private_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData);
-jref    Private_GetJavaClass(void);
-NPError Private_GetValue(NPP instance, NPPVariable variable, void *result);
-NPError Private_SetValue(NPP instance, NPNVariable variable, void *value);
-
-#endif //XP_MAC
-
-#include "third_party/npapi/bindings/nphostapi.h"
-
-#ifndef HIBYTE
-#define HIBYTE(i) (i >> 8)
-#endif
-
-#ifndef LOBYTE
-#define LOBYTE(i) (i & 0xff)
-#endif
-
-#endif  // OMAHA_PLUGINS_COMMON_NPPLAT_H_
diff --git a/plugins/base/pluginbase.h b/plugins/base/pluginbase.h
deleted file mode 100644
index 259bc78..0000000
--- a/plugins/base/pluginbase.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: NPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Netscape Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/NPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the NPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the NPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef OMAHA_PLUGINS_COMMON_PLUGINBASE_H_
-#define OMAHA_PLUGINS_COMMON_PLUGINBASE_H_
-
-#include "omaha/plugins/base/npplat.h"
-
-struct nsPluginCreateData
-{
-  NPP instance;
-  NPMIMEType type;
-  uint16 mode;
-  int16 argc;
-  char** argn;
-  char** argv;
-  NPSavedData* saved;
-};
-
-#pragma warning(push)
-#pragma warning(disable:4100)  // unreferenced formal parameter
-class nsPluginInstanceBase
-{
-public:
-  // these three methods must be implemented in the derived
-  // class platform specific way
-  virtual NPBool init(NPWindow* aWindow) = 0;
-  virtual void shut() = 0;
-  virtual NPBool isInitialized() = 0;
-
-  // implement all or part of those methods in the derived
-  // class as needed
-  virtual NPError SetWindow(NPWindow* pNPWindow)                    { return NPERR_NO_ERROR; }
-  virtual NPError NewStream(NPMIMEType type, NPStream* stream,
-                            NPBool seekable, uint16* stype)         { return NPERR_NO_ERROR; }
-  virtual NPError DestroyStream(NPStream *stream, NPError reason)   { return NPERR_NO_ERROR; }
-  virtual void    StreamAsFile(NPStream* stream, const char* fname) { return; }
-  virtual int32   WriteReady(NPStream *stream)                      { return 0x0fffffff; }
-  virtual int32   Write(NPStream *stream, int32 offset, 
-                        int32 len, void *buffer)                    { return len; }
-  virtual void    Print(NPPrint* printInfo)                         { return; }
-  virtual uint16  HandleEvent(void* event)                          { return 0; }
-  virtual void    URLNotify(const char* url, NPReason reason,
-                            void* notifyData)                       { return; }
-  virtual NPError GetValue(NPPVariable variable, void *value)       { return NPERR_NO_ERROR; }
-  virtual NPError SetValue(NPNVariable variable, void *value)       { return NPERR_NO_ERROR; }
-};
-#pragma warning(pop)
-
-// functions that should be implemented for each specific plugin
-
-// creation and destruction of the object of the derived class
-nsPluginInstanceBase * NS_NewPluginInstance(nsPluginCreateData * aCreateDataStruct);
-void NS_DestroyPluginInstance(nsPluginInstanceBase * aPlugin);
-
-// global plugin initialization and shutdown
-NPError NS_PluginInitialize();
-void NS_PluginShutdown();
-
-#ifdef XP_UNIX
-// global to get plugins name & description
-NPError NS_PluginGetValue(NPPVariable aVariable, void *aValue);
-#endif
-
-#endif  // OMAHA_PLUGINS_COMMON_PLUGINBASE_H_
diff --git a/plugins/build.scons b/plugins/build.scons
deleted file mode 100644
index 15a2345..0000000
--- a/plugins/build.scons
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-env.BuildSConscript('base')
-env.BuildSConscript('update')
diff --git a/plugins/plugin_version.rc b/plugins/plugin_version.rc
deleted file mode 100644
index 4970160..0000000
--- a/plugins/plugin_version.rc
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2007 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// This file contains the unlocalized plugin version resources.
-
-#include <afxres.h>
-
-// The "040904e4" block (for codepage 1252 Ansi Latin) is required for
-// the Netscape Plugin stuff to see the MIMETYPE value in the resource block.
-
-// TODO(omaha): FileDescription is what shows up in "about:plugins" for
-// Mozilla. Format the description to include the url of the project.
-// Update: July 2010. I'm not sure why this comment requests the URL. We should
-// include the version, though, since that is used by version-checking websites.
-
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
-VS_VERSION_INFO VERSIONINFO
-// Resource Editor does not handle constants from main.scons.
-#ifndef APSTUDIO_INVOKED
- FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_BUILD,VERSION_PATCH
- PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_BUILD,VERSION_PATCH
-#endif  // APSTUDIO_INVOKED
- FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
-#if defined _DEBUG && OFFICIAL_BUILD
- FILEFLAGS VS_FF_DEBUG
-#elif defined _DEBUG
- FILEFLAGS VS_FF_DEBUG | VS_FF_PRIVATEBUILD
-#elif !OFFICIAL_BUILD
- FILEFLAGS VS_FF_PRIVATEBUILD
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS VOS_NT_WINDOWS32
- FILETYPE VFT_DLL
- FILESUBTYPE VFT2_UNKNOWN
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "040904e4"
-        BEGIN
-// Requires constants from mains.scons that cannot be loaded in Resource Editor.
-#ifndef APSTUDIO_INVOKED
-            VALUE "CompanyName", FULL_COMPANY_NAME_ANSI
-            VALUE "FileDescription", OMAHA_APP_NAME_ANSI
-            VALUE "FileVersion", VERSION_NUMBER_STRING
-            VALUE "InternalName", OMAHA_APP_NAME_ANSI
-            VALUE "LegalCopyright", OMAHA_COPYRIGHT_STRING_ENGLISH
-            VALUE "OriginalFilename", PLUGIN_FILENAME
-            VALUE "ProductName", OMAHA_APP_NAME_ANSI
-            VALUE "ProductVersion", VERSION_NUMBER_STRING
-  #ifdef _DEBUG
-            VALUE "Debug", ""
-  #endif
-  #if !OFFICIAL_BUILD
-            VALUE "PrivateBuild", BUILD_NUMBER
-  #endif
-
-  #ifdef MERGED_MIME_TYPE
-            VALUE "MIMEType", MERGED_MIME_TYPE
-  #endif
-#else
-            VALUE "_SpecialView",
-                  "Most values are not shown in Resource Editor because they "
-                  "require build file constants."
-#endif  // APSTUDIO_INVOKED
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x409, 1252
-    END
-END
diff --git a/plugins/update/activex/oneclick_control.cc b/plugins/update/activex/oneclick_control.cc
deleted file mode 100644
index 6729e86..0000000
--- a/plugins/update/activex/oneclick_control.cc
+++ /dev/null
@@ -1,335 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Implementation of the OneClick Plugin.
-
-#include "omaha/plugins/update/activex/oneclick_control.h"
-
-#include <dispex.h>
-#include <atlsafe.h>
-#include <atlbase.h>
-#include <atlcom.h>
-
-#include "omaha/base/error.h"
-#include "omaha/base/exception_barrier.h"
-#include "omaha/base/file.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/scoped_ptr_address.h"
-#include "omaha/base/string.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/command_line.h"
-#include "omaha/common/command_line_builder.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/common/webplugin_utils.h"
-#include "omaha/goopdate/app_command.h"
-#include "omaha/goopdate/app_manager.h"
-#include "goopdate/omaha3_idl.h"
-
-namespace omaha {
-
-OneClickControl::OneClickControl() {
-  CORE_LOG(L2, (_T("[OneClickControl::OneClickControl]")));
-}
-
-OneClickControl::~OneClickControl() {
-  CORE_LOG(L2, (_T("[OneClickControl::~OneClickControl]")));
-}
-
-STDMETHODIMP OneClickControl::Install(BSTR cmd_line_args,
-                                      VARIANT* success_callback,
-                                      VARIANT* failure_callback) {
-  ASSERT1(cmd_line_args && cmd_line_args[0]);
-  ASSERT1(VariantIsValidCallback(success_callback));
-  ASSERT1(VariantIsValidCallback(failure_callback));
-
-  if (!site_lock_.InApprovedDomain(this)) {
-    return GOOPDATE_E_ONECLICK_HOSTCHECK_FAILED;
-  }
-
-  if (!cmd_line_args ||
-      !cmd_line_args[0] ||
-      !VariantIsValidCallback(success_callback) ||
-      !VariantIsValidCallback(failure_callback) ) {
-    return E_INVALIDARG;
-  }
-
-  CORE_LOG(L2, (_T("[OneClickControl::Install][cmd_line \"%s\"]"),
-                CW2CT(cmd_line_args)));
-
-  HRESULT hr = DoInstall(CString(cmd_line_args));
-  if (SUCCEEDED(hr)) {
-    InvokeJavascriptCallback(success_callback, NULL);
-  } else {
-    CORE_LOG(LE, (_T("[DoOneClickInstallInternal failed][0x%08x]"), hr));
-    InvokeJavascriptCallback(failure_callback, &hr);
-  }
-
-  // Return success in all cases. The failure callback has already been called
-  // above, and we don't want to cause a failure path to be called again when
-  // the JavaScript catches the exception.
-
-  return S_OK;
-}
-
-STDMETHODIMP OneClickControl::Install2(BSTR extra_args) {
-  ASSERT1(extra_args && extra_args[0]);
-
-  if (!site_lock_.InApprovedDomain(this)) {
-    return GOOPDATE_E_ONECLICK_HOSTCHECK_FAILED;
-  }
-
-  if (!extra_args || !extra_args[0]) {
-    return E_INVALIDARG;
-  }
-
-  CORE_LOG(L2, (_T("[OneClickControl::Install2][extra_args \"%s\"]"),
-                CW2CT(extra_args)));
-
-  CommandLineBuilder builder(COMMANDLINE_MODE_INSTALL);
-  builder.set_extra_args(CString(extra_args));
-  return DoInstall(builder.GetCommandLineArgs());
-}
-
-STDMETHODIMP OneClickControl::GetInstalledVersion(BSTR guid_string,
-                                                  VARIANT_BOOL is_machine,
-                                                  BSTR* version_string) {
-  if (!site_lock_.InApprovedDomain(this)) {
-    return GOOPDATE_E_ONECLICK_HOSTCHECK_FAILED;
-  }
-
-  if (!guid_string || !version_string) {
-    return E_POINTER;
-  }
-  *version_string = NULL;
-
-  CORE_LOG(L2, (_T("[OneClickControl::GetInstalledVersion][%s][%d]"),
-                guid_string, is_machine));
-
-  CString version;
-  HRESULT hr = DoGetInstalledVersion(guid_string,
-                                     is_machine == VARIANT_TRUE,
-                                     &version);
-  if (SUCCEEDED(hr)) {
-    *version_string = version.AllocSysString();
-  }
-
-  return S_OK;
-}
-
-STDMETHODIMP OneClickControl::GetOneClickVersion(long* version) {  // NOLINT
-  ASSERT1(version);
-
-  if (!site_lock_.InApprovedDomain(this)) {
-    return GOOPDATE_E_ONECLICK_HOSTCHECK_FAILED;
-  }
-
-  CORE_LOG(L2, (_T("[OneClickControl::GetOneClickVersion]")));
-
-  if (!version) {
-    return E_POINTER;
-  }
-
-  *version = atoi(ONECLICK_PLUGIN_VERSION_ANSI);  // NOLINT
-  return S_OK;
-}
-
-STDMETHODIMP OneClickControl::LaunchAppCommand(BSTR app_guid,
-                                               VARIANT_BOOL is_machine,
-                                               BSTR cmd_id) {
-  if (!site_lock_.InApprovedDomain(this)) {
-    return GOOPDATE_E_ONECLICK_HOSTCHECK_FAILED;
-  }
-
-  CORE_LOG(L2, (_T("[OneClickControl::LaunchAppCommand]")));
-
-  ExceptionBarrier barrier;
-
-  CComPtr<IOneClickProcessLauncher> process_launcher;
-  HRESULT hr = E_UNEXPECTED;
-
-  hr = process_launcher.CoCreateInstance(
-      is_machine ?
-          CLSID_OneClickMachineProcessLauncherClass :
-          CLSID_OneClickUserProcessLauncherClass);
-
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[OneClickControl::LaunchAppCommand]")
-                  _T("[Failed to CoCreate OneClickMachine/User ")
-                  _T("ProcessLauncher implementation: 0x%x"),
-                  hr));
-    return hr;
-  }
-
-  return process_launcher->LaunchAppCommand(app_guid, cmd_id);
-}
-
-HRESULT OneClickControl::DoGetInstalledVersion(const TCHAR* guid_string,
-                                               bool is_machine,
-                                               CString* version_string) {
-  ASSERT1(guid_string);
-  ASSERT1(version_string);
-
-  GUID app_guid = GUID_NULL;
-  HRESULT hr = StringToGuidSafe(guid_string, &app_guid);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return AppManager::ReadAppVersionNoLock(is_machine, app_guid, version_string);
-}
-
-HRESULT OneClickControl::DoInstall(const TCHAR* cmd_line_args) {
-  ASSERT1(cmd_line_args);
-
-  CORE_LOG(L2, (_T("[OneClickControl::DoInstall][%s]"), cmd_line_args));
-
-#ifdef _DEBUG
-  // If the args are exactly __DIRECTNOTIFY__ then just fire the event
-  // out of this thread.  This allows for easy testing of the
-  // browser interface without requiring launch of
-  // google_update.exe.
-  if (0 == _wcsicmp(L"__DIRECTNOTIFY__", cmd_line_args)) {
-    return S_OK;
-  }
-#endif
-
-  CString browser_url;
-  HRESULT hr = site_lock_.GetCurrentBrowserUrl(this, &browser_url);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CString url_domain;
-  hr = SiteLock::GetUrlDomain(browser_url, &url_domain);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CString url_domain_encoded;
-  CString cmd_line_args_encoded;
-  hr = StringEscape(url_domain, false, &url_domain_encoded);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = StringEscape(cmd_line_args, false, &cmd_line_args_encoded);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CommandLineBuilder builder(COMMANDLINE_MODE_WEBPLUGIN);
-  builder.set_webplugin_url_domain(url_domain_encoded);
-  builder.set_webplugin_args(cmd_line_args_encoded);
-  builder.set_install_source(kCmdLineInstallSource_OneClick);
-  CString final_cmd_line_args = builder.GetCommandLineArgs();
-
-  CORE_LOG(L2, (_T("[OneClickControl::DoInstall]")
-                _T("[Final command line params: %s]"),
-                final_cmd_line_args));
-
-  scoped_process process_goopdate;
-
-  hr = goopdate_utils::StartGoogleUpdateWithArgs(
-          goopdate_utils::IsRunningFromOfficialGoopdateDir(true),
-          final_cmd_line_args,
-          address(process_goopdate));
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[OneClickControl::DoInstall]")
-                  _T("[Failed StartGoogleUpdateWithArgs][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-bool OneClickControl::VariantIsValidCallback(const VARIANT* callback) {
-  return callback &&
-         (callback->vt == VT_NULL ||
-          callback->vt == VT_EMPTY ||
-          (callback->vt == VT_DISPATCH && callback->pdispVal));
-}
-
-HRESULT OneClickControl::InvokeJavascriptCallback(VARIANT* callback,
-                                                  const HRESULT* opt_param) {
-  if (!callback || callback->vt == VT_NULL || callback->vt == VT_EMPTY) {
-    return S_FALSE;
-  }
-
-  if (callback->vt != VT_DISPATCH || !callback->pdispVal) {
-    return E_FAIL;
-  }
-
-  const DISPID kDispId0 = 0;
-  DISPPARAMS dispparams = {0};
-
-  CComQIPtr<IDispatchEx> dispatchex = callback->pdispVal;
-  if (dispatchex) {
-    DISPID disp_this = DISPID_THIS;
-    VARIANT var[2];
-    var[0].vt = VT_DISPATCH;
-    var[0].pdispVal = dispatchex;
-    if (opt_param) {
-      var[1].vt = VT_I4;
-      var[1].intVal = *opt_param;
-    }
-
-    dispparams.rgvarg = var;
-    dispparams.rgdispidNamedArgs = &disp_this;
-    dispparams.cNamedArgs = 1;
-    dispparams.cArgs = opt_param ? 2 : 1;
-
-    return dispatchex->InvokeEx(kDispId0, LOCALE_USER_DEFAULT,
-                                DISPATCH_METHOD, &dispparams,
-                                NULL, NULL, NULL);
-  } else {
-    // Fallback on IDispatch if needed.  (This route will be used for NPAPI
-    // functions wrapped via NPFunctionHost.)
-
-    UINT arg_err = 0;
-    VARIANT var[1];
-
-    if (opt_param) {
-      var[0].vt = VT_I4;
-      var[0].intVal = *opt_param;
-      dispparams.rgvarg = var;
-      dispparams.cArgs = 1;
-    }
-
-    return callback->pdispVal->Invoke(kDispId0,
-                                      IID_NULL,
-                                      LOCALE_SYSTEM_DEFAULT,
-                                      DISPATCH_METHOD,
-                                      &dispparams,
-                                      NULL,
-                                      NULL,
-                                      &arg_err);
-  }
-}
-
-// This works during Setup because IsRunningFromOfficialGoopdateDir checks the
-// location of the DLL not the exe, which is running from a temp location.
-CString OneClickControl::GetGoopdateShellPathForRegMap() {
-  ASSERT1(goopdate_utils::IsRunningFromOfficialGoopdateDir(false) ||
-          goopdate_utils::IsRunningFromOfficialGoopdateDir(true));
-  return goopdate_utils::BuildGoogleUpdateExeDir(
-      goopdate_utils::IsRunningFromOfficialGoopdateDir(true));
-}
-
-}  // namespace omaha
-
-// 4505: unreferenced local function has been removed
-#pragma warning(disable : 4505)
-
diff --git a/plugins/update/activex/oneclick_control.h b/plugins/update/activex/oneclick_control.h
deleted file mode 100644
index dc7fbf7..0000000
--- a/plugins/update/activex/oneclick_control.h
+++ /dev/null
@@ -1,148 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// One-click support for Omaha returning users.
-
-#ifndef OMAHA_PLUGINS_UPDATE_ACTIVEX_ONECLICK_CONTROL_H_
-#define OMAHA_PLUGINS_UPDATE_ACTIVEX_ONECLICK_CONTROL_H_
-
-// TODO(omaha): We may want to move sitelock.h to be the "standard" sitelock.h
-// file from Microsoft (and move that file to omaha/external) and then have our
-// modifications to sitelock be in a derived class within the plugins
-// directory.
-
-#include <objsafe.h>
-#include <shellapi.h>
-#include <winhttp.h>
-#include <atlbase.h>
-#include <atlcom.h>
-#include <atlctl.h>
-#include "base/scoped_ptr.h"
-#include "omaha/base/ATLRegMapEx.h"
-#include "omaha/base/const_addresses.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/debug.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/plugins/update/config.h"
-#include "omaha/plugins/update/resource.h"
-#include "omaha/plugins/update/site_lock.h"
-#include "plugins/update/activex/update_control_idl.h"
-
-namespace omaha {
-
-class OneClickControl;
-
-typedef IObjectSafetyImpl<OneClickControl, INTERFACESAFE_FOR_UNTRUSTED_CALLER>
-            OneClickControlSafety;
-
-// Using 0xffff for the major/minor versions in the IDispatchImpl template will
-// make ATL load the typelib directly from the DLL instead of looking up typelib
-// registration in registry. The big benefit is that we do not need to register
-// the typelib. Also, this is needed for Vista SP1 with UAC off, in which
-// oleaut32 does not read typelib information from HKCU, because of a bug.
-class ATL_NO_VTABLE OneClickControl
-    : public CComObjectRootEx<CComObjectThreadModel>,
-      public CComCoClass<OneClickControl,
-                         &__uuidof(GoogleUpdateOneClickControlCoClass)>,
-      public IDispatchImpl<IGoogleUpdateOneClick,
-                           &__uuidof(IGoogleUpdateOneClick),
-                           &LIBID_GoogleUpdateControlLib, 0xffff, 0xffff>,
-      public OneClickControlSafety,
-      public IObjectWithSiteImpl<OneClickControl> {
- public:
-  OneClickControl();
-  virtual ~OneClickControl();
-
-  DECLARE_REGISTRY_RESOURCEID_EX(IDR_ONECLICK_RGS)
-
-#pragma warning(push)
-// C4640: construction of local static object is not thread-safe
-#pragma warning(disable : 4640)
-  BEGIN_REGISTRY_MAP()
-    REGMAP_ENTRY(_T("CLSID"),             GetObjectCLSID())
-    REGMAP_ENTRY(_T("PROGID"),            kOneclickControlProgId)
-    REGMAP_ENTRY(_T("HKROOT"),            goopdate_utils::GetHKRoot())
-    REGMAP_ENTRY(_T("SHELLNAME"),         kOmahaShellFileName)
-    // Not fatal if "SHELLPATH" is empty because the side-effect would be that
-    // on Vista, the user will get prompted on invoking one-click.
-    REGMAP_ENTRY(_T("SHELLPATH"),         GetGoopdateShellPathForRegMap())
-
-    // The following entries are actually for the NPAPI plugin
-    REGMAP_ENTRY(_T("PLUGINDESCRIPTION"), kAppName)
-    REGMAP_ENTRY(_T("PLUGINDOMAIN"),      kGoopdateServer)
-    REGMAP_ENTRY(_T("PLUGINVENDOR"),      kFullCompanyName)
-    REGMAP_ENTRY(_T("PLUGINVERSION"),     kOneclickPluginVersion)
-    REGMAP_ENTRY(_T("PLUGINPRODUCT"),     kAppName)
-    REGMAP_ENTRY(_T("PLUGINMIMETYPE"),    ONECLICK_MIME_TYPE)
-  END_REGISTRY_MAP()
-#pragma warning(pop)
-
-  BEGIN_COM_MAP(OneClickControl)
-    COM_INTERFACE_ENTRY(IDispatch)
-    COM_INTERFACE_ENTRY(IObjectWithSite)
-    COM_INTERFACE_ENTRY(IObjectSafety)
-  END_COM_MAP()
-
-  DECLARE_NOT_AGGREGATABLE(OneClickControl)
-  DECLARE_PROTECT_FINAL_CONSTRUCT();
-
-  // Installs the application that the passed-in manifest corresponds to.
-  STDMETHOD(Install)(BSTR cmd_line_args,
-                     VARIANT* success_callback,
-                     VARIANT* failure_callback);
-
-  STDMETHOD(Install2)(BSTR extra_args);
-
-  // Gets the version of the passed in application guid. If the application is
-  // not installed, returns an empty string.
-  STDMETHOD(GetInstalledVersion)(BSTR guid_string,
-                                 VARIANT_BOOL is_machine,
-                                 BSTR* version_string);
-
-  // Gets the version of the plugin. The value is ONECLICK_PLUGIN_VERSION_ANSI.
-  // TODO(omaha3): If possible without causing incompatibilities, change version
-  // to a preferred type here and in OneClickWorker.
-  STDMETHOD(GetOneClickVersion)(long* version);  // NOLINT
-
-  // Launches a command defined by an installed application. Fails if the
-  // command is not successfully started, succeeds otherwise. Returns without
-  // waiting for the command to complete.
-  STDMETHOD(LaunchAppCommand)(BSTR app_guid,
-                              VARIANT_BOOL is_machine,
-                              BSTR cmd_id);
-
- private:
-  HRESULT DoGetInstalledVersion(const TCHAR* guid_string,
-                                bool is_machine,
-                                CString* version_string);
-
-  HRESULT DoInstall(const TCHAR* cmd_line_args);
-
-  static bool VariantIsValidCallback(const VARIANT* callback);
-  static HRESULT InvokeJavascriptCallback(VARIANT* callback,
-                                          const HRESULT* opt_param);
-
-  SiteLock site_lock_;
-
-  // If Admin, returns the path for Machine Goopdate. Else returns path for User
-  // Goopdate.
-  static CString GetGoopdateShellPathForRegMap();
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_PLUGINS_UPDATE_ACTIVEX_ONECLICK_CONTROL_H_
-
diff --git a/plugins/update/activex/update3web_control.cc b/plugins/update/activex/update3web_control.cc
deleted file mode 100644
index 6d49ff3..0000000
--- a/plugins/update/activex/update3web_control.cc
+++ /dev/null
@@ -1,366 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/plugins/update/activex/update3web_control.h"
-#include <objbase.h>
-#include <objidl.h>
-#include "omaha/base/error.h"
-#include "omaha/base/system.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/command_line.h"
-#include "omaha/common/command_line_builder.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/common/webplugin_utils.h"
-#include "omaha/goopdate/app_manager.h"
-#include "goopdate/omaha3_idl.h"
-
-namespace omaha {
-
-Update3WebControl::Update3WebControl() {
-}
-
-// There is a code generation bug in VC8. If a base class with template
-// arguments and virtual members is not the first base class with virtual
-// methods, the generated code for calling a virtual method on that base class
-// will adjust the this pointer one extra time. This results in all sorts of
-// strange things happening; typically, the program will crash at a later point.
-// To avoid this, all calls to base class methods that have template arguments
-// should have all the template arguments specified, since this seems to prevent
-// the code generation bug from occuring.
-
-STDMETHODIMP Update3WebControl::createOmahaMachineServerAsync(
-    VARIANT_BOOL create_elevated, IDispatch** async_status) {
-  ASSERT1(async_status);
-
-  CString url;
-  HRESULT hr = SiteLock::GetCurrentBrowserUrl(this, &url);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (L"[GetCurrentBrowserUrl failed][0x%08x]", hr));
-    return hr;
-  }
-
-  if (!site_lock_.InApprovedDomain(url)) {
-    return GOOPDATE_E_ONECLICK_HOSTCHECK_FAILED;
-  }
-
-  if (!async_status) {
-    return E_POINTER;
-  }
-
-  CComPtr<ICoCreateAsync> cocreate_async;
-  hr = cocreate_async.CoCreateInstance(__uuidof(CoCreateAsyncClass));
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (L"[CoCreate CoCreateAsyncClass failed][0x%08x]", hr));
-    return hr;
-  }
-
-  CComPtr<ICoCreateAsyncStatus> status;
-  hr = cocreate_async->createOmahaMachineServerAsync(CComBSTR(url),
-                                                     create_elevated,
-                                                     &status);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (L"[CreateInstanceAsync failed][0x%08x]", hr));
-    return hr;
-  }
-
-  hr = status->QueryInterface(async_status);
-  CORE_LOG(L3, (L"[createOmahaMachineServerAsync][0x%p][0x%08x]", this, hr));
-  return hr;
-}
-
-STDMETHODIMP Update3WebControl::createOmahaUserServer(IDispatch** server) {
-  ASSERT1(server);
-
-  CString url;
-  HRESULT hr = SiteLock::GetCurrentBrowserUrl(this, &url);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (L"[GetCurrentBrowserUrl failed][0x%08x]", hr));
-    return hr;
-  }
-
-  if (!site_lock_.InApprovedDomain(url)) {
-    return GOOPDATE_E_ONECLICK_HOSTCHECK_FAILED;
-  }
-
-  if (!server) {
-    return E_POINTER;
-  }
-
-  CComPtr<IGoogleUpdate3WebSecurity> security;
-  hr = security.CoCreateInstance(__uuidof(GoogleUpdate3WebUserClass));
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[CoCreate failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  hr = security->setOriginURL(CComBSTR(url));
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[setOriginURL failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  hr = security->QueryInterface(server);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[QueryInterface failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  CORE_LOG(L3, (L"[createOmahaUserServer][0x%p][0x%p]", this, *server));
-  return hr;
-}
-
-STDMETHODIMP Update3WebControl::getInstalledVersion(BSTR guid_string,
-                                                    VARIANT_BOOL is_machine,
-                                                    BSTR* version_string) {
-  if (!site_lock_.InApprovedDomain(this)) {
-    return GOOPDATE_E_ONECLICK_HOSTCHECK_FAILED;
-  }
-
-  if (!guid_string || !version_string) {
-    return E_POINTER;
-  }
-  *version_string = NULL;
-
-  CORE_LOG(L2, (_T("[Update3WebControl::getInstalledVersion][%s][%d]"),
-                guid_string, is_machine));
-
-  CString version;
-  HRESULT hr = GetVersionUsingCOMServer(guid_string, is_machine == VARIANT_TRUE,
-                                        &version);
-  if (FAILED(hr)) {
-    hr = GetVersionUsingRegistry(guid_string, is_machine == VARIANT_TRUE,
-                                 &version);
-  }
-
-  if (SUCCEEDED(hr)) {
-    *version_string = version.AllocSysString();
-  }
-
-  return S_OK;
-}
-
-HRESULT Update3WebControl::GetVersionUsingCOMServer(const TCHAR* guid_string,
-                                                    bool is_machine,
-                                                    CString* version_string) {
-  CORE_LOG(L2, (_T("[GoopdateCtrl::GetVersionUsingCOMServer][%s][%d]"),
-                guid_string, is_machine));
-  ASSERT1(guid_string);
-  ASSERT1(version_string);
-
-  CComPtr<IGoogleUpdate3Web> update3web;
-  HRESULT hr = update3web.CoCreateInstance(
-      is_machine ? __uuidof(GoogleUpdate3WebMachineClass) :
-                   __uuidof(GoogleUpdate3WebUserClass));
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[update3web.CoCreateInstance failed][0x%x]"), hr));
-    return hr;
-  }
-
-  CComPtr<IDispatch> app_bundle_dispatch;
-  hr = update3web->createAppBundleWeb(&app_bundle_dispatch);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[update3web.createAppBundleWeb failed][0x%x]"), hr));
-    return hr;
-  }
-
-  CComPtr<IAppBundleWeb> app_bundle_web;
-  hr = app_bundle_dispatch->QueryInterface(&app_bundle_web);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[QueryInterface for IAppBundleWeb failed][0x%x]"), hr));
-    return hr;
-  }
-
-  hr = app_bundle_web->initialize();
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[initialize fail][0x%x]"), hr));
-    return hr;
-  }
-
-  hr = app_bundle_web->createInstalledApp(CComBSTR(guid_string));
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[createInstalledApp fail][%s][0x%x]"), guid_string, hr));
-    return hr;
-  }
-
-  CComPtr<IDispatch> app_dispatch;
-  hr = app_bundle_web->get_appWeb(0, &app_dispatch);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[get_appWeb failed][0x%x]"), hr));
-    return hr;
-  }
-
-  CComPtr<IAppWeb> app_web;
-  hr = app_dispatch->QueryInterface(&app_web);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[QueryInterface for IAppWeb failed][0x%x]"), hr));
-    return hr;
-  }
-
-  CComPtr<IDispatch> app_version_dispatch;
-  hr = app_web->get_currentVersionWeb(&app_version_dispatch);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[get_currentVersionWeb failed][0x%x]"), hr));
-    return hr;
-  }
-
-  CComPtr<IAppVersionWeb> app_version_web;
-  hr = app_version_dispatch->QueryInterface(&app_version_web);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[QueryInterface for IAppVersionWeb failed][0x%x]"), hr));
-    return hr;
-  }
-
-  CComBSTR version;
-  hr = app_version_web->get_version(&version);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[get_version failed][0x%x]"), hr));
-    return hr;
-  }
-
-  *version_string = version;
-  CORE_LOG(L2, (_T("[Update3WebControl::GetVersionUsingCOMServer][%s][%d][%s]"),
-                guid_string, is_machine, *version_string));
-  return S_OK;
-}
-
-HRESULT Update3WebControl::GetVersionUsingRegistry(const TCHAR* guid_string,
-                                                   bool is_machine,
-                                                   CString* version_string) {
-  CORE_LOG(L2, (_T("[GoopdateCtrl::GetVersionUsingRegistry][%s][%d]"),
-                guid_string, is_machine));
-  ASSERT1(guid_string);
-  ASSERT1(version_string);
-
-  GUID app_guid = GUID_NULL;
-  HRESULT hr = StringToGuidSafe(guid_string, &app_guid);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return AppManager::ReadAppVersionNoLock(is_machine, app_guid, version_string);
-}
-
-HRESULT Update3WebControl::crossInstall(BSTR extra_args) {
-  ASSERT1(extra_args);
-
-  if (!site_lock_.InApprovedDomain(this)) {
-    return GOOPDATE_E_ONECLICK_HOSTCHECK_FAILED;
-  }
-
-  if (!extra_args || !extra_args[0]) {
-    return E_INVALIDARG;
-  }
-
-  CORE_LOG(L2, (_T("[Update3WebControl::crossInstall][%s]"), extra_args));
-
-  // Build the full command line as it should eventually be run.  (This command
-  // line will be escaped, including the /install, and stowed in a /pi later.)
-
-  CommandLineBuilder inner_builder(COMMANDLINE_MODE_INSTALL);
-  inner_builder.set_extra_args(CString(extra_args));
-  CString inner_cmd_line_args = inner_builder.GetCommandLineArgs();
-
-  HRESULT hr = webplugin_utils::IsLanguageSupported(inner_cmd_line_args);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[IsLanguageSupported failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  CString browser_url;
-  hr = site_lock_.GetCurrentBrowserUrl(this, &browser_url);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CString url_domain;
-  hr = SiteLock::GetUrlDomain(browser_url, &url_domain);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Build the outer command line using /pi.
-
-  CString url_domain_encoded;
-  CString cmd_line_encoded;
-  hr = StringEscape(url_domain, false, &url_domain_encoded);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = StringEscape(inner_cmd_line_args, false, &cmd_line_encoded);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CommandLineBuilder outer_builder(COMMANDLINE_MODE_WEBPLUGIN);
-  outer_builder.set_webplugin_url_domain(url_domain_encoded);
-  outer_builder.set_webplugin_args(cmd_line_encoded);
-  outer_builder.set_install_source(kCmdLineInstallSource_Update3Web);
-  CString final_cmd_line_args = outer_builder.GetCommandLineArgs();
-
-  CORE_LOG(L2, (_T("[Update3WebControl::crossInstall]")
-                _T("[Final command line params: %s]"),
-                final_cmd_line_args));
-
-  // Spawn a gu process.
-
-  scoped_process process_goopdate;
-
-  hr = goopdate_utils::StartGoogleUpdateWithArgs(is_machine(),
-                                                 final_cmd_line_args,
-                                                 address(process_goopdate));
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Update3WebControl::crossInstall]")
-                  _T("[Failed StartGoogleUpdateWithArgs][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT Update3WebControl::launchAppCommand(BSTR guid_string,
-                                            VARIANT_BOOL is_machine,
-                                            BSTR cmd_id) {
-  if (!site_lock_.InApprovedDomain(this)) {
-    return GOOPDATE_E_ONECLICK_HOSTCHECK_FAILED;
-  }
-
-  CORE_LOG(L2, (_T("[Update3WebControl::launchAppCommand]")));
-
-  CComPtr<IOneClickProcessLauncher> process_launcher;
-  HRESULT hr = E_UNEXPECTED;
-
-  hr = process_launcher.CoCreateInstance(
-      is_machine ?
-          CLSID_OneClickMachineProcessLauncherClass :
-          CLSID_OneClickUserProcessLauncherClass);
-
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[Update3WebControl::launchAppCommand]")
-                  _T("[Failed to CoCreate OneClickMachine/User ")
-                  _T("ProcessLauncher implementation: 0x%x"),
-                  hr));
-    return hr;
-  }
-
-  return process_launcher->LaunchAppCommand(guid_string, cmd_id);
-}
-
-Update3WebControl::~Update3WebControl() {
-}
-
-}  // namespace omaha
diff --git a/plugins/update/activex/update3web_control.h b/plugins/update/activex/update3web_control.h
deleted file mode 100644
index 0300d33..0000000
--- a/plugins/update/activex/update3web_control.h
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_PLUGINS_UPDATE_ACTIVEX_UPDATE3WEB_CONTROL_H_
-#define OMAHA_PLUGINS_UPDATE_ACTIVEX_UPDATE3WEB_CONTROL_H_
-
-#include <atlbase.h>
-#include <atlcom.h>
-#include <atlctl.h>
-
-#include "base/basictypes.h"
-#include "goopdate/omaha3_idl.h"
-#include "omaha/base/atlregmapex.h"
-#include "omaha/base/const_addresses.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/omaha_version.h"
-#include "common/goopdate_utils.h"
-#include "omaha/plugins/update/config.h"
-#include "omaha/plugins/update/resource.h"
-#include "omaha/plugins/update/site_lock.h"
-#include "plugins/update/activex/update_control_idl.h"
-
-namespace omaha {
-
-class Update3WebControl;
-
-typedef IObjectSafetyImpl<Update3WebControl, INTERFACESAFE_FOR_UNTRUSTED_CALLER>
-    Update3WebControlSafety;
-
-class ATL_NO_VTABLE Update3WebControl
-    : public CComObjectRootEx<CComObjectThreadModel>,
-      public CComCoClass<Update3WebControl,
-                         &__uuidof(GoogleUpdate3WebControlCoClass)>,
-      public IDispatchImpl<IGoogleUpdate3WebControl,
-                           &__uuidof(IGoogleUpdate3WebControl),
-                           &LIBID_GoogleUpdateControlLib, 0xffff, 0xffff>,
-      public Update3WebControlSafety,
-      public IObjectWithSiteImpl<Update3WebControl> {
- public:
-  Update3WebControl();
-
-  DECLARE_NOT_AGGREGATABLE(Update3WebControl)
-  DECLARE_REGISTRY_RESOURCEID_EX(IDR_ONECLICK_RGS)
-
-#pragma warning(push)
-// Construction of local static object is not thread-safe
-#pragma warning(disable:4640)
-  BEGIN_REGISTRY_MAP()
-    REGMAP_ENTRY(L"CLSID",              GetObjectCLSID())
-    REGMAP_ENTRY(L"PROGID",             kUpdate3WebControlProgId)
-    REGMAP_ENTRY(L"HKROOT",             goopdate_utils::GetHKRoot())
-    REGMAP_ENTRY(L"SHELLNAME",          is_machine() ? kOmahaBrokerFileName :
-                                                       kOmahaOnDemandFileName)
-    REGMAP_ENTRY(L"SHELLPATH",          GetShellPathForRegMap())
-    // The following entries are actually for the NPAPI plugin
-    REGMAP_ENTRY(L"PLUGINDESCRIPTION",  kAppName)
-    REGMAP_ENTRY(L"PLUGINDOMAIN",       kGoopdateServer)
-    REGMAP_ENTRY(L"PLUGINVENDOR",       kFullCompanyName)
-    REGMAP_ENTRY(L"PLUGINVERSION",      kUpdate3WebPluginVersion)
-    REGMAP_ENTRY(L"PLUGINPRODUCT",      kAppName)
-    REGMAP_ENTRY(L"PLUGINMIMETYPE",     UPDATE3WEB_MIME_TYPE)
-  END_REGISTRY_MAP()
-#pragma warning(pop)
-
-  BEGIN_COM_MAP(Update3WebControl)
-    COM_INTERFACE_ENTRY(IDispatch)
-    COM_INTERFACE_ENTRY(IObjectSafety)
-    COM_INTERFACE_ENTRY(IObjectWithSite)
-  END_COM_MAP()
-
-  // IGoogleUpdate3WebControl methods.
-  STDMETHOD(createOmahaMachineServerAsync)(VARIANT_BOOL create_elevated,
-                                           IDispatch** async_status);
-  STDMETHOD(createOmahaUserServer)(IDispatch** server);
-
-  // Gets the version of the passed in application guid. If the application is
-  // not installed, returns an empty string.
-  STDMETHOD(getInstalledVersion)(BSTR guid_string,
-                                 VARIANT_BOOL is_machine,
-                                 BSTR* version_string);
-
-  // OneClick-equivalent API, used for cross-installs.
-  STDMETHOD(crossInstall)(BSTR extra_args);
-
-  // Launches a command defined by an installed application. Fails if the
-  // command is not successfully started, succeeds otherwise. Returns without
-  // waiting for the command to complete.
-  STDMETHOD(launchAppCommand)(BSTR guid_string,
-                              VARIANT_BOOL is_machine,
-                              BSTR cmd_id);
-
- protected:
-  virtual ~Update3WebControl();
-
- private:
-  static bool is_machine() {
-    return goopdate_utils::IsRunningFromOfficialGoopdateDir(true);
-  }
-
-  static CString GetShellPathForRegMap() {
-    return goopdate_utils::BuildInstallDirectory(is_machine(),
-                                                 GetVersionString());
-  }
-
-  HRESULT GetVersionUsingCOMServer(const TCHAR* guid_string,
-                                   bool is_machine,
-                                   CString* version_string);
-  HRESULT GetVersionUsingRegistry(const TCHAR* guid_string,
-                                  bool is_machine,
-                                  CString* version_string);
-
-  SiteLock site_lock_;
-
-  friend class Update3WebControlTest;
-
-  DISALLOW_COPY_AND_ASSIGN(Update3WebControl);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_PLUGINS_UPDATE_ACTIVEX_UPDATE3WEB_CONTROL_H_
diff --git a/plugins/update/activex/update3web_control_unittest.cc b/plugins/update/activex/update3web_control_unittest.cc
deleted file mode 100644
index 804f23c..0000000
--- a/plugins/update/activex/update3web_control_unittest.cc
+++ /dev/null
@@ -1,341 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/plugins/update/activex/update3web_control.h"
-#include <atlbase.h>
-#include <atlcom.h>
-#include <windows.h>
-#include "base/basictypes.h"
-#include "base/error.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-#define STUBMETHOD(identifier, ...) \
-  STDMETHOD(identifier)(__VA_ARGS__) {\
-    return E_NOTIMPL;\
-  }
-
-#define STUBGETPROP(identifier, type) \
-  STUBMETHOD(get_ ## identifier, type*)
-
-#define STUBPUTPROP(identifier, type) \
-  STUBMETHOD(put_ ## identifier, type)
-
-#define STUBPROP(identifier, type) \
-  STUBGETPROP(identifier, type)\
-  STUBPUTPROP(identifier, type)
-
-class ATL_NO_VTABLE MockWebBrowser2
-    : public CComObjectRootEx<CComObjectThreadModel>,
-      public IServiceProviderImpl<MockWebBrowser2>,
-      public IWebBrowser2 {
- public:
-  MockWebBrowser2() : url_("something-like-a-url") {}
-  virtual ~MockWebBrowser2() {}
-
-  DECLARE_NOT_AGGREGATABLE(MockWebBrowser2);
-
-  BEGIN_COM_MAP(MockWebBrowser2)
-    COM_INTERFACE_ENTRY(IServiceProvider)
-    COM_INTERFACE_ENTRY(IWebBrowser2)
-  END_COM_MAP()
-
-  BEGIN_SERVICE_MAP(MockWebBrowser2)
-    SERVICE_ENTRY(SID_SWebBrowserApp)
-  END_SERVICE_MAP()
-
-  // IDispatch
-  STUBMETHOD(GetIDsOfNames, REFIID, OLECHAR**, unsigned int, LCID, DISPID*);
-  STUBMETHOD(GetTypeInfo, unsigned int, LCID, ITypeInfo**);
-  STUBMETHOD(GetTypeInfoCount, UINT*);
-  STUBMETHOD(Invoke, DISPID, REFIID, LCID, WORD, DISPPARAMS*, VARIANT*,
-                     EXCEPINFO*, unsigned int*);
-
-  // IWebBrowser2
-  STUBPROP(AddressBar, VARIANT_BOOL);
-  STUBGETPROP(Application, IDispatch*);
-  STUBGETPROP(Busy, VARIANT_BOOL);
-  STUBMETHOD(ClientToWindow, int*, int*);
-  STUBGETPROP(Container, IDispatch*);
-  STUBGETPROP(Document, IDispatch*);
-  STUBMETHOD(ExecWB, OLECMDID, OLECMDEXECOPT, VARIANT*, VARIANT*);
-  STUBGETPROP(FullName, BSTR);
-  STUBPROP(FullScreen, VARIANT_BOOL);
-  STUBMETHOD(GetProperty, BSTR, VARIANT*);
-  STUBMETHOD(GoBack, VOID);
-  STUBMETHOD(GoForward, VOID);
-  STUBMETHOD(GoHome, VOID);
-  STUBMETHOD(GoSearch, VOID);
-  STUBPROP(Height, LONG);
-  STUBGETPROP(HWND, LONG);
-  STUBPROP(Left, LONG);
-  STUBGETPROP(LocationName, BSTR);
-  STDMETHOD(get_LocationURL)(BSTR* url) {
-    *url = CComBSTR(url_).Detach();
-    return S_OK;
-  }
-  STUBPROP(MenuBar, VARIANT_BOOL);
-  STUBGETPROP(Name, BSTR);
-  STUBMETHOD(Navigate, BSTR, VARIANT*, VARIANT*, VARIANT*, VARIANT*);
-  STUBMETHOD(Navigate2, VARIANT*, VARIANT*, VARIANT*, VARIANT*, VARIANT*);
-  STUBPROP(Offline, VARIANT_BOOL);
-  STUBGETPROP(Path, BSTR);
-  STUBGETPROP(Parent, IDispatch*);
-  STUBMETHOD(PutProperty, BSTR, VARIANT);
-  STUBMETHOD(QueryStatusWB, OLECMDID, OLECMDF*);
-  STUBMETHOD(Quit, VOID);
-  STUBGETPROP(ReadyState, READYSTATE);
-  STUBMETHOD(Refresh, VOID);
-  STUBMETHOD(Refresh2, VARIANT*);
-  STUBPROP(RegisterAsBrowser, VARIANT_BOOL);
-  STUBPROP(RegisterAsDropTarget, VARIANT_BOOL);
-  STUBPROP(Resizable, VARIANT_BOOL);
-  STUBMETHOD(ShowBrowserBar, VARIANT*, VARIANT*, VARIANT*);
-  STUBPROP(Silent, VARIANT_BOOL);
-  STUBPROP(StatusBar, VARIANT_BOOL);
-  STUBPROP(StatusText, BSTR);
-  STUBMETHOD(Stop, VOID);
-  STUBPROP(TheaterMode, VARIANT_BOOL);
-  STUBPROP(ToolBar, int);
-  STUBPROP(Top, LONG);
-  STUBGETPROP(TopLevelContainer, VARIANT_BOOL);
-  STUBPROP(Type, BSTR);
-  STUBPROP(Visible, VARIANT_BOOL);
-  STUBPROP(Width, LONG);
-
-  void set_url(const char* url) { url_ = url; }
-
- private:
-  CString url_;
-
-  DISALLOW_COPY_AND_ASSIGN(MockWebBrowser2);
-};
-
-class ATL_NO_VTABLE MockHTMLDocument2
-    : public CComObjectRootEx<CComObjectThreadModel>,
-      public IServiceProvider,
-      public IOleClientSite,
-      public IOleContainer,
-      public IHTMLDocument2 {
- public:
-  MockHTMLDocument2() {}
-  virtual ~MockHTMLDocument2() {}
-
-  DECLARE_NOT_AGGREGATABLE(MockHTMLDocument2);
-
-  BEGIN_COM_MAP(MockHTMLDocument2)
-    COM_INTERFACE_ENTRY(IServiceProvider)
-    COM_INTERFACE_ENTRY(IOleClientSite)
-    COM_INTERFACE_ENTRY(IOleContainer)
-    COM_INTERFACE_ENTRY(IHTMLDocument2)
-  END_COM_MAP()
-
-  // IServiceProvider
-  STUBMETHOD(QueryService, REFGUID, REFIID, void**);
-
-  // IOleContainer
-  STDMETHOD(GetContainer)(IOleContainer** container) {
-    return QueryInterface(IID_PPV_ARGS(container));
-  }
-  STUBMETHOD(GetMoniker, DWORD, DWORD, IMoniker**);
-  STUBMETHOD(OnShowWindow, BOOL);
-  STUBMETHOD(RequestNewObjectLayout);
-  STUBMETHOD(SaveObject);
-  STUBMETHOD(ShowObject);
-
-  // IOleContainer
-  STUBMETHOD(EnumObjects, DWORD, IEnumUnknown**);
-  STUBMETHOD(LockContainer, BOOL);
-
-  // IDispatch
-  STUBMETHOD(GetIDsOfNames, REFIID, OLECHAR**, unsigned int, LCID, DISPID*);
-  STUBMETHOD(GetTypeInfo, unsigned int, LCID, ITypeInfo**);
-  STUBMETHOD(GetTypeInfoCount, UINT*);
-  STUBMETHOD(Invoke, DISPID, REFIID, LCID, WORD, DISPPARAMS*, VARIANT*,
-                     EXCEPINFO*, unsigned int*);
-
-  // IParseDisplayName
-  STUBMETHOD(ParseDisplayName, IBindCtx*, LPOLESTR, ULONG*, IMoniker**);
-
-  // IHTMLDocument2
-  STUBGETPROP(activeElement, IHTMLElement*);
-  STUBPROP(alinkColor, VARIANT);
-  STUBGETPROP(all, IHTMLElementCollection*);
-  STUBGETPROP(anchors, IHTMLElementCollection*);
-  STUBGETPROP(applets, IHTMLElementCollection*);
-  STUBPROP(bgColor, VARIANT);
-  STUBGETPROP(body, IHTMLElement*);
-  STUBPROP(charset, BSTR);
-  STUBMETHOD(clear, VOID);
-  STUBMETHOD(close, VOID);
-  STUBPROP(cookie, BSTR);
-  STUBMETHOD(createElement, BSTR, IHTMLElement**);
-  STUBMETHOD(createStyleSheet, BSTR, LONG, IHTMLStyleSheet**);
-  STUBPROP(defaultCharset, BSTR);
-  STUBPROP(designMode, BSTR);
-  STUBPROP(domain, BSTR);
-  STUBPROP(elementFromPoint, BSTR);
-  STUBMETHOD(elementFromPoint, LONG, LONG, IHTMLElement**);
-  STUBGETPROP(embeds, IHTMLElementCollection*);
-  STUBMETHOD(execCommand, BSTR, VARIANT_BOOL, VARIANT, VARIANT_BOOL*);
-  STUBMETHOD(execCommandShowHelp, BSTR, VARIANT_BOOL*);
-  STUBPROP(expando, VARIANT_BOOL);
-  STUBPROP(fgColor, VARIANT);
-  STUBGETPROP(fileCreatedDate, BSTR);
-  STUBGETPROP(fileModifiedDate, BSTR);
-  STUBGETPROP(fileSize, BSTR);
-  STUBGETPROP(fileUpdatedDate, BSTR);
-  STUBGETPROP(forms, IHTMLElementCollection*);
-  STUBGETPROP(frames, IHTMLFramesCollection2*);
-  STUBGETPROP(images, IHTMLElementCollection*);
-  STUBGETPROP(lastModified, BSTR);
-  STUBPROP(linkColor, VARIANT);
-  STUBGETPROP(links, IHTMLElementCollection*);
-  STUBGETPROP(location, IHTMLLocation*);
-  STUBGETPROP(mimeType, BSTR);
-  STUBGETPROP(nameProp, BSTR);
-  STUBPROP(onafterupdate, VARIANT);
-  STUBPROP(onbeforeupdate, VARIANT);
-  STUBPROP(onclick, VARIANT);
-  STUBPROP(ondblclick, VARIANT);
-  STUBPROP(ondragstart, VARIANT);
-  STUBPROP(onerrorupdate, VARIANT);
-  STUBPROP(onhelp, VARIANT);
-  STUBPROP(onkeydown, VARIANT);
-  STUBPROP(onkeypress, VARIANT);
-  STUBPROP(onkeyup, VARIANT);
-  STUBPROP(onmousedown, VARIANT);
-  STUBPROP(onmousemove, VARIANT);
-  STUBPROP(onmouseout, VARIANT);
-  STUBPROP(onmouseover, VARIANT);
-  STUBPROP(onmouseup, VARIANT);
-  STUBPROP(onreadystatechange, VARIANT);
-  STUBPROP(onrowenter, VARIANT);
-  STUBPROP(onrowexit, VARIANT);
-  STUBPROP(onselectstart, VARIANT);
-  STUBMETHOD(open, BSTR, VARIANT, VARIANT, VARIANT, IDispatch**);
-  STUBGETPROP(parentWindow, IHTMLWindow2*);
-  STUBGETPROP(plugins, IHTMLElementCollection*);
-  STUBPROP(protocol, BSTR);
-  STUBMETHOD(queryCommandEnabled, BSTR, VARIANT_BOOL*);
-  STUBMETHOD(queryCommandIndeterm, BSTR, VARIANT_BOOL*);
-  STUBMETHOD(queryCommandState, BSTR, VARIANT_BOOL*);
-  STUBMETHOD(queryCommandSupported, BSTR, VARIANT_BOOL*);
-  STUBMETHOD(queryCommandText, BSTR, BSTR*);
-  STUBMETHOD(queryCommandValue, BSTR, VARIANT*);
-  STUBGETPROP(readyState, BSTR);
-  STUBGETPROP(referrer, BSTR);
-  STUBGETPROP(Script, IDispatch*);
-  STUBGETPROP(security, BSTR);
-  STUBGETPROP(selection, IHTMLSelectionObject*);
-  STUBGETPROP(scripts, IHTMLElementCollection*);
-  STUBGETPROP(styleSheets, IHTMLStyleSheetsCollection*);
-  STUBPROP(title, BSTR);
-  STUBMETHOD(toString, BSTR*);
-  STDMETHOD(get_URL)(BSTR* url) {
-    *url = CComBSTR("something-else-like-a-url").Detach();
-    return S_OK;
-  }
-  STUBPUTPROP(URL, BSTR);
-  STUBPROP(vlinkColor, VARIANT);
-  STUBMETHOD(write, SAFEARRAY*);
-  STUBMETHOD(writeln, SAFEARRAY*);
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(MockHTMLDocument2);
-};
-
-#undef STUBMETHOD
-#undef STUBGETPROP
-#undef STUBPUTPROP
-#undef STUBPROP
-
-template <typename T>
-HRESULT CComObjectCreatorHelper(CComObject<T>** ptr) {
-  if (!ptr) {
-    return E_POINTER;
-  }
-  CComObject<T>* raw_ptr = NULL;
-  RET_IF_FAILED(CComObject<T>::CreateInstance(&raw_ptr));
-  raw_ptr->AddRef();
-  *ptr = raw_ptr;
-  return S_OK;
-}
-
-
-}  // namespace
-
-class Update3WebControlTest : public testing::Test {
- protected:
-  virtual void SetUp() {
-    ASSERT_SUCCEEDED(CComObjectCreatorHelper(&control_));
-  }
-
-  virtual void TearDown() {
-  }
-
-  HRESULT GetCurrentBrowserUrl(CString* url) {
-    return control_->site_lock_.GetCurrentBrowserUrl(control_, url);
-  }
-
-  CComPtr<CComObject<Update3WebControl> > control_;
-};
-
-TEST_F(Update3WebControlTest, SiteLock) {
-  CComPtr<CComObject<MockWebBrowser2> > browser;
-  ASSERT_SUCCEEDED(CComObjectCreatorHelper(&browser));
-  CComPtr<IUnknown> unknown;
-  ASSERT_SUCCEEDED(browser.QueryInterface(&unknown));
-  ASSERT_SUCCEEDED(control_->SetSite(unknown));
-  browser->set_url("http://www.google.com/pack/page.html");
-  EXPECT_EQ(E_POINTER,
-      control_->getInstalledVersion(CComBSTR(), VARIANT_FALSE, NULL));
-}
-
-TEST_F(Update3WebControlTest, SiteLock_Negative) {
-  CComPtr<IWebBrowser2> browser;
-  ASSERT_SUCCEEDED(CComCoClass<MockWebBrowser2>::CreateInstance(&browser));
-  ASSERT_SUCCEEDED(control_->SetSite(browser));
-  EXPECT_EQ(GOOPDATE_E_ONECLICK_HOSTCHECK_FAILED,
-      control_->getInstalledVersion(CComBSTR(), VARIANT_FALSE, NULL));
-}
-
-TEST_F(Update3WebControlTest, GetCurrentBrowserUrl_FailIfNoSite) {
-  CString url;
-  EXPECT_FALSE(SUCCEEDED(GetCurrentBrowserUrl(&url)));
-}
-
-TEST_F(Update3WebControlTest, GetCurrentBrowserUrl_WithIWebBrowser2) {
-  CComPtr<IUnknown> browser;
-  ASSERT_SUCCEEDED(CComCoClass<MockWebBrowser2>::CreateInstance(&browser));
-  ASSERT_SUCCEEDED(control_->SetSite(browser));
-  CString url;
-  EXPECT_EQ(S_OK, GetCurrentBrowserUrl(&url));
-  EXPECT_STREQ(L"something-like-a-url", url);
-}
-
-TEST_F(Update3WebControlTest, GetCurrentBrowserUrl_WithIHTMLDocument2) {
-  CComPtr<IUnknown> document;
-  ASSERT_SUCCEEDED(CComCoClass<MockHTMLDocument2>::CreateInstance(&document));
-  ASSERT_SUCCEEDED(control_->SetSite(document));
-  CString url;
-  EXPECT_EQ(S_OK, GetCurrentBrowserUrl(&url));
-  EXPECT_STREQ(L"something-else-like-a-url", url);
-}
-
-}  // namespace omaha
diff --git a/plugins/update/activex/update_control_idl.idl b/plugins/update/activex/update_control_idl.idl
deleted file mode 100644
index 8db79b0..0000000
--- a/plugins/update/activex/update_control_idl.idl
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-import "oaidl.idl";
-
-[
-  object,
-  uuid(c40a1df0-d2d8-4f01-9b1d-3c0d4f226dd9),
-  dual,
-  helpstring("GoogleUpdate3Web Control"),
-  pointer_default(unique)
-]
-interface IGoogleUpdate3WebControl : IDispatch {
-  [id(1)] HRESULT createOmahaMachineServerAsync(
-      [in] VARIANT_BOOL create_elevated,
-      [out, retval] IDispatch** async_status);
-
-  [id(2)] HRESULT createOmahaUserServer([out, retval] IDispatch** server);
-
-  [id(3)] HRESULT getInstalledVersion([in] BSTR guid_string,
-                                      [in] VARIANT_BOOL is_machine,
-                                      [out, retval] BSTR* version_string);
-
-  [id(4)] HRESULT crossInstall([in] BSTR extra_args);
-
-  [id(5)] HRESULT launchAppCommand([in] BSTR guid_string,
-                                   [in] VARIANT_BOOL is_machine,
-                                   [in] BSTR cmd_id);
-};
-
-[
-  object,
-  uuid(b8b0a927-6c2a-4de2-b6d7-a98fe4e42465),
-  dual,
-  helpstring("Google Update OneClick Control"),
-  pointer_default(unique)
-]
-interface IGoogleUpdateOneClick : IDispatch
-{
-  // Deprecated. Will be removed in the next release of OneClick.
-  [id(1), helpstring("Install")] HRESULT Install(
-      [in] BSTR cmd_line_args,
-      [in] VARIANT* success_callback,
-      [in] VARIANT* failure_callback);
-
-  // New, easier way of calling Install. Use this for newer web pages.
-  [id(2), helpstring("Install2")] HRESULT Install2([in] BSTR extra_args);
-
-  [id(3), helpstring("GetInstalledVersion")] HRESULT GetInstalledVersion(
-      [in] BSTR guid_string,
-      [in] VARIANT_BOOL is_machine,
-      [out, retval] BSTR* version_string);
-
-  [id(4), helpstring("GetOneClickVersion")] HRESULT GetOneClickVersion(
-      [out, retval] long* version);
-
-  // TODO(omaha): Remove this if LaunchAppCommand only ships in Omaha3
-  [id(5), helpstring("LaunchAppCommand")] HRESULT LaunchAppCommand(
-      [in] BSTR app_guid,
-      [in] VARIANT_BOOL is_machine,
-      [in] BSTR cmd_id);
-};
-
-[
-  uuid(8c1a5505-5837-47e1-963e-dbc5c3f0f52a),
-  version(1.0),
-  helpstring("Omaha Browser Plugins 3.0 Type Library")
-]
-library GoogleUpdateControlLib {
-  importlib("stdole2.tlb");
-
-  interface IGoogleUpdateOneClick;
-  interface IGoogleUpdate3WebControl;
-
-  [
-    uuid(77e6be0b-059d-4ff6-a534-4aa0970a746c),
-    helpstring("Google Update OneClick Control Class")
-  ]
-  coclass GoogleUpdateOneClickControlCoClass
-  {
-    [default] interface IGoogleUpdateOneClick;
-  };
-
-  [
-    uuid(2f7cf8e2-27d9-4641-845d-3bfedece0326),
-    helpstring("GoogleUpdate3Web Control Class")
-  ]
-  coclass GoogleUpdate3WebControlCoClass {
-    [default] interface IDispatch;
-  };
-};
diff --git a/plugins/update/build.scons b/plugins/update/build.scons
deleted file mode 100644
index a48e914..0000000
--- a/plugins/update/build.scons
+++ /dev/null
@@ -1,286 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-
-Import('env')
-
-# Need to do all these modifications to the non-default env because calling
-# EnablePrecompile on the main environment, which customization_test_env clones.
-# causes the opt build to fail.
-# TODO(omaha): How much of this needs to be used by all libraries that get built
-# and how much can be moved to BuildNpGoogleUpdateDll?
-update_env = env.Clone()
-update_env.Append(
-    CPPDEFINES = [
-        # TODO(omaha): ActiveX plugins are usually apartment-threaded. There's
-        # no problem with compiling at a higher threading level than required,
-        # but there is a slight performance penalty for AddRef()/Release(). At
-        # some point, it may be desirable to switch back to apartment threaded,
-        # once the unit tests are fixed.
-        # We also take a 1KiB penalty for using _ATL_FREE_THREADED =)
-        '_ATL_FREE_THREADED',
-    ],
-    CPPFLAGS = [
-        # TODO(omaha): use PCH so we get /Wall. Need to figure out why half of
-        # the old plugin builds with PCH, and the other half of it builds
-        # without...
-        '/Wall',
-        # omaha/third_party/base/basictypes.h
-        '/wd4310',  # cast truncates constant value
-        # ATL
-        '/wd4263',  # member function does not override any base class virtual
-                    # member function
-        '/wd4264',  # no override available for virtual member function;
-                    # function is hidden
-        '/wd4265',  # class has virtual functions, but destructor is not virtual
-        # vector
-        '/wd4548',  # expression before comma has no effect; expected expression
-                    # with side-effect
-    ],
-    CPPPATH = [
-        '$OBJ_ROOT',  # Needed for generated files.
-    ],
-    LIBS = [
-        '$LIB_DIR/base.lib',
-        '$LIB_DIR/breakpad.lib',
-        '$LIB_DIR/client.lib',
-        '$LIB_DIR/core.lib',
-        '$LIB_DIR/google_update_recovery.lib',
-        '$LIB_DIR/goopdate_lib.lib',
-        '$LIB_DIR/logging.lib',
-        '$LIB_DIR/net.lib',
-        '$LIB_DIR/omaha3_idl.lib',
-        '$LIB_DIR/security.lib',
-        '$LIB_DIR/service.lib',
-        '$LIB_DIR/setup.lib',
-        '$LIB_DIR/statsreport.lib',
-        '$LIB_DIR/ui.lib',
-        ('atls.lib', 'atlsd.lib')[env.Bit('debug')],
-        ('libcmt.lib', 'libcmtd.lib')[env.Bit('debug')],
-        ('libcpmt.lib', 'libcpmtd.lib')[env.Bit('debug')],
-        'bits.lib',
-        'comctl32.lib',
-        'crypt32.lib',
-        'iphlpapi.lib',
-        'msi.lib',
-        'msimg32.lib',
-        'mstask.lib',
-        'psapi.lib',
-        'netapi32.lib',
-        'rasapi32.lib',
-        'shlwapi.lib',
-        'taskschd.lib',
-        'userenv.lib',
-        'version.lib',
-        'wintrust.lib',
-        'wtsapi32.lib',
-    ],
-    LINKFLAGS = [
-        '/DYNAMICBASE',   # Enable ASLR.
-        '/NXCOMPAT',      # Enable NX support.
-    ],
-)
-
-
-# COM stuff.
-midl_env = env.Clone()
-midl_env.Tool('midl')
-# Generate optimized, stubless proxy/stub code.
-midl_env['MIDLFLAGS'] += [ '/Oicf', ]
-
-# For some reason, calling TypeLibrary() twice on the same environment causes a
-# re-link of the test executable when alternating between "hammer" and
-# "hammer run_all_tests".
-# To work around this, clone the original environment and call TypeLibrary once
-# on each. Note that:
-#  1) Cloning midl_env BEFORE TypeLibrary() is called does not solve this
-#     problem. The environment must be cloned from the original env.
-#  2) Moving the following code down near npapi_testing_midl_env.TypeLibrary
-#     does not solve the problem either.
-#  3) This problem does not occur if 'update_npapi_testing.lib' is passed as
-#     a source to other builders instead of as a LIB.
-npapi_testing_midl_env = env.Clone()
-npapi_testing_midl_env.Tool('midl')
-# Generate optimized, stubless proxy/stub code.
-npapi_testing_midl_env['MIDLFLAGS'] += [ '/Oicf', ]
-
-midl_env.TypeLibrary('activex/update_control_idl.idl')
-
-# Generate the GUIDs with no precompile option set, otherwise we get an error.
-update_control_idl_guids_lib = env.ComponentStaticLibrary(
-    lib_name='update_control_idl_guids_lib',
-    source='$OBJ_ROOT/plugins/update/activex/update_control_idl_i.c',
-    use_pch_default=False,
-)
-
-# Built as library to enable unit testing.
-inputs = [
-    'activex/update3web_control.cc',
-    'activex/oneclick_control.cc',
-    'npapi/dispatch_host.cc',
-    'npapi/npfunction_host.cc',
-    'npapi/urlpropbag.cc',
-    'npapi/np_update.cc',
-    'npapi/variant_utils.cc',
-    'config.cc',
-    'site_lock.cc',
-    ]
-update_lib = update_env.ComponentStaticLibrary(
-    lib_name='update',
-    source=inputs,
-)
-
-
-def BuildNpGoogleUpdateDll(omaha_version_info):
-  version_string = omaha_version_info.GetVersionString()
-  prefix = omaha_version_info.filename_prefix
-
-  plugin_env = update_env.Clone(COMPONENT_STATIC = False)
-
-  if prefix == 'TEST_':
-    plugin_env['OBJPREFIX'] = plugin_env.subst('test/$OBJPREFIX')
-  elif prefix:
-    raise Exception('ERROR: Unrecognized prefix "%s"' % prefix)
-
-  plugin_env.Append(
-      LIBS = [
-          '$LIB_DIR/common.lib',
-          '$LIB_DIR/plugin_base.lib',
-          'wininet.lib',
-          update_control_idl_guids_lib,
-          update_lib,
-      ],
-      RCFLAGS = [
-          '/DVERSION_MAJOR=%d' % omaha_version_info.version_major,
-          '/DVERSION_MINOR=%d' % omaha_version_info.version_minor,
-          '/DVERSION_BUILD=%d' % omaha_version_info.version_build,
-          '/DVERSION_PATCH=%d' % omaha_version_info.version_patch,
-          '/DVERSION_NUMBER_STRING=\\"%s\\"' % version_string,
-      ],
-  )
-
-
-  resource = plugin_env.RES(target='%sresource.res' % prefix,
-                            source='resource.rc')
-  plugin_env.Depends(
-      resource,
-      ['$MAIN_DIR/VERSION',
-       '$OBJ_ROOT/plugins/update/activex/update_control_idl.tlb',
-       'oneclick.rgs'])
-
-  target_name = '%s%s' % (
-      prefix,
-      omaha_version_info.plugin_signed_file_info.unsigned_filename_base)
-
-  inputs = [
-      'module.def',
-      'module.cc',
-      resource,
-      ]
-
-  unsigned_dll = plugin_env.ComponentDll(
-      lib_name=target_name,
-      source=inputs,
-  )
-
-  signed_dll = plugin_env.SignedBinary(
-      target='%s%s' % (prefix,
-                       omaha_version_info.plugin_signed_file_info.filename),
-      source=unsigned_dll,
-  )
-
-  env.Replicate('$STAGING_DIR', signed_dll)
-  env.Replicate('$STAGING_DIR', [f for f in unsigned_dll if f.suffix == '.pdb'])
-
-
-for omaha_version_info in env['omaha_versions_info']:
-  BuildNpGoogleUpdateDll(omaha_version_info)
-
-
-#
-# Tests
-#
-
-# NPAPI unit test helper library
-npapi_testing_midl_env.TypeLibrary('npapi/testing/dispatch_host_test_idl.idl')
-inputs = [
-    'npapi/testing/dispatch_host_test_interface.cc',
-    'npapi/testing/stubs.cc',
-    ]
-update_test_helpers_lib = update_env.ComponentStaticLibrary(
-    lib_name='update_test_helpers',
-    source=inputs,
-)
-
-npapi_test_lib_resources = update_env.RES(
-    target='npapi/testing/dispatch_host_test.res',
-    source='npapi/testing/dispatch_host_test.rc'),
-# TODO(omaha): we should really just make a proper .rc file scanner.
-update_env.Depends(
-    npapi_test_lib_resources,
-    '$OBJ_ROOT/plugins/update/npapi/testing/dispatch_host_test_idl.tlb')
-
-# TODO(omaha): Fix OmahaUnittest() so that MODE=all does not break.
-update_env.OmahaUnittest(
-    name='update_plugin_unittest',
-    source=[
-        'activex/update3web_control_unittest.cc',
-        'npapi/dispatch_host_unittest.cc',
-        'npapi/npfunction_host_unittest.cc',
-        'npapi/variant_utils_unittest.cc',
-        'site_lock_unittest.cc',
-        npapi_test_lib_resources,
-    ],
-    LIBS=[
-        '$LIB_DIR/common.lib',
-        'wininet',
-        update_control_idl_guids_lib,
-        update_lib,
-        update_test_helpers_lib,
-    ],
-    all_in_one=False,
-    COMPONENT_TEST_SIZE='small',
-)
-
-
-customization_test_env = env.Clone()
-customization_test_env.Append(
-    LIBS = [
-        '$LIB_DIR/common.lib',
-    ]
-)
-customization_test_env['CPPPATH'] += [
-    '$OBJ_ROOT',  # Needed for generated files.
-    ]
-customization_test = customization_test_env.OmahaUnittest(
-    name='omaha_customization_update_apis_unittest',
-    source=[
-        'omaha_customization_update_apis_unittest.cc',
-        'omaha_customization_update_unittest.cc',
-    ],
-    LIBS=[
-        update_control_idl_guids_lib,  # Needed for LIBID_*.
-        update_lib,
-    ],
-    all_in_one=False,
-    COMPONENT_TEST_SIZE='small',
-)
-
-# The test uses the DLL for its TypeLib.
-customization_test_env.Depends(
-    customization_test,
-    '$STAGING_DIR/%s' % env['omaha_versions_info'][0].update_plugin_filename)
diff --git a/plugins/update/config.cc b/plugins/update/config.cc
deleted file mode 100644
index 6a4a2af..0000000
--- a/plugins/update/config.cc
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/plugins/update/config.h"
-#include <tchar.h>
-#include "omaha/base/constants.h"
-
-namespace omaha {
-
-const TCHAR kUpdate3WebPluginVersion[] = _T(UPDATE_PLUGIN_VERSION_ANSI);
-const TCHAR kUpdate3WebControlProgId[] = COMPANY_NAME_IDENTIFIER _T(".") \
-                                         _T("Update3WebControl.") \
-                                         _T(UPDATE_PLUGIN_VERSION_ANSI);
-
-const TCHAR kOneclickPluginVersion[] = _T(ONECLICK_PLUGIN_VERSION_ANSI);
-const TCHAR kOneclickControlProgId[] = COMPANY_NAME_IDENTIFIER _T(".") \
-                                         _T("OneClickCtrl.") \
-                                         _T(ONECLICK_PLUGIN_VERSION_ANSI);
-
-}  // namespace omaha
diff --git a/plugins/update/config.h b/plugins/update/config.h
deleted file mode 100644
index b761984..0000000
--- a/plugins/update/config.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_PLUGINS_UPDATE_CONFIG_H_
-#define OMAHA_PLUGINS_UPDATE_CONFIG_H_
-
-#include <windows.h>
-
-namespace omaha {
-
-// TODO(omaha3): The OneClick MIME type is currently defined one other place in
-// the codebase, in base\const_config.h.  I'm putting our own definition here;
-// we should probably delete the copy in base, and potentially moving this file
-// to base as plugin_constants.h.
-//
-// Note that COMPANY_DOMAIN_BASE_ANSI and *_PLUGIN_VERSION_ANSI are defined
-// in omaha\main.scons.
-
-#define UPDATE3WEB_MIME_TYPE   "application/x-vnd." COMPANY_DOMAIN_BASE_ANSI \
-                               ".update3webcontrol." UPDATE_PLUGIN_VERSION_ANSI
-
-#define ONECLICK_MIME_TYPE     "application/x-vnd." COMPANY_DOMAIN_BASE_ANSI \
-                               ".oneclickctrl." ONECLICK_PLUGIN_VERSION_ANSI
-
-#define MERGED_MIME_TYPE UPDATE3WEB_MIME_TYPE "|" ONECLICK_MIME_TYPE
-
-extern const TCHAR kUpdate3WebPluginVersion[];
-extern const TCHAR kUpdate3WebControlProgId[];
-
-extern const TCHAR kOneclickPluginVersion[];
-extern const TCHAR kOneclickControlProgId[];
-
-}  // namespace omaha
-
-#endif  // OMAHA_PLUGINS_UPDATE_CONFIG_H_
diff --git a/plugins/update/generate_plugin_idls.py b/plugins/update/generate_plugin_idls.py
deleted file mode 100644
index 069a7aa..0000000
--- a/plugins/update/generate_plugin_idls.py
+++ /dev/null
@@ -1,116 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2007-2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-"""
-Generates IDL file for the OneClick ActiveX control from the passed-in IDL
-template. The input template is a complete IDL file in all but one respect;
-It has one replaceable entry for the CLSID for GoopdateOneClickControl.
-We generate a GUID using UUIDGEN.EXE, and write out an IDL with a new CLSID.
-
-"""
-
-import sys
-import os
-import getopt
-import commands
-
-
-def _GetStatusOutput(cmd):
-  """Return (status, output) of executing cmd in a shell."""
-  if os.name == "nt":
-    pipe = os.popen(cmd + " 2>&1", 'r')
-    text = pipe.read()
-    sts = pipe.close()
-    if sts is None: sts = 0
-    if text[-1:] == '\n': text = text[:-1]
-    return sts, text
-  else:
-    return commands.getstatusoutput(cmd)
-
-
-def _GenerateIDLText(idl_template):
-  (status, guid) = _GetStatusOutput("uuidgen.exe")
-  if status != 0:
-    raise SystemExit("Failed to get GUID: %s" % guid)
-
-  return idl_template % guid
-
-
-def _GenerateIDLFile(idl_template_filename, idl_output_filename):
-  f_in = open(idl_template_filename, 'r')
-  idl_template = f_in.read()
-  f_in.close()
-
-  idl_output = _GenerateIDLText(idl_template)
-
-  f_out = open(idl_output_filename, 'w')
-  f_out.write("""
-                 // ** AUTOGENERATED FILE. DO NOT HAND-EDIT **
-              """)
-  f_out.write(idl_output)
-  f_out.close()
-
-
-def _Usage():
-  """Prints out script usage information."""
-  print """
-generate_oneclick_idl.py: Write out the given IDL file.
-
-Usage:
-  generate_oneclick_idl.py [--help
-                            | --idl_template_file filename
-                              --idl_output_file filename]
-
-Options:
-  --help                    Show this information.
-  --idl_output_file filename     Path/name of output IDL filename.
-  --idl_template_file filename      Path/name of input IDL template.
-"""
-
-
-def _Main():
-  """Generates IDL file."""
-  # use getopt to parse the option and argument list; this may raise, but
-  # don't catch it
-  _ARGUMENT_LIST = ["help", "idl_template_file=", "idl_output_file="]
-  (opts, args) = getopt.getopt(sys.argv[1:], "", _ARGUMENT_LIST)
-  if not opts or ("--help", "") in opts:
-    _Usage()
-    sys.exit()
-
-  idl_template_filename = ""
-  idl_output_filename = ""
-
-  for (o, v) in opts:
-    if o == "--idl_template_file":
-      idl_template_filename = v
-    if o == "--idl_output_file":
-      idl_output_filename = v
-
-  # make sure we have work to do
-  if not idl_template_filename:
-    raise SystemExit("no idl_template_filename specified")
-  if not idl_output_filename:
-    raise SystemExit("no idl_output_filename specified")
-
-  _GenerateIDLFile(idl_template_filename, idl_output_filename)
-  sys.exit()
-
-
-if __name__ == "__main__":
-  _Main()
-
diff --git a/plugins/update/module.cc b/plugins/update/module.cc
deleted file mode 100644
index f52e0a6..0000000
--- a/plugins/update/module.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <atlbase.h>
-#include "base/basictypes.h"
-#include "omaha/base/omaha_version.h"
-#include "goopdate/omaha3_idl.h"
-#include "omaha/plugins/update/activex/update3web_control.h"
-#include "omaha/plugins/update/activex/oneclick_control.h"
-#include "plugins/update/activex/update_control_idl.h"
-
-namespace omaha {
-
-OBJECT_ENTRY_AUTO(__uuidof(GoogleUpdateOneClickControlCoClass), OneClickControl)
-OBJECT_ENTRY_AUTO(__uuidof(GoogleUpdate3WebControlCoClass), Update3WebControl)
-
-namespace {
-
-class GoogleUpdateControlModule
-    : public CAtlDllModuleT<GoogleUpdateControlModule> {
- public:
-  GoogleUpdateControlModule() {}
-
-  DECLARE_LIBID(LIBID_GoogleUpdateControlLib);
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(GoogleUpdateControlModule);  // NOLINT
-} _AtlModule;
-
-}  // namespace
-
-}  // namespace omaha
-
-BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) {
-  switch (reason) {
-    case DLL_PROCESS_ATTACH:
-      omaha::InitializeVersionFromModule(instance);
-      break;
-    default:
-      break;
-  }
-
-  return omaha::_AtlModule.DllMain(reason, reserved);
-}
-
-STDAPI DllCanUnloadNow() {
-  return omaha::_AtlModule.DllCanUnloadNow();
-}
-
-STDAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void** ppv) {
-  return omaha::_AtlModule.DllGetClassObject(clsid, iid, ppv);
-}
-
-STDAPI DllRegisterServer() {
-  return omaha::_AtlModule.DllRegisterServer(false);
-}
-
-STDAPI DllUnregisterServer() {
-  return omaha::_AtlModule.DllUnregisterServer(false);
-}
diff --git a/plugins/update/module.def b/plugins/update/module.def
deleted file mode 100644
index e98111e..0000000
--- a/plugins/update/module.def
+++ /dev/null
@@ -1,23 +0,0 @@
-; Copyright 2009 Google Inc.
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-;      http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-; ========================================================================
-
-EXPORTS
-  NP_GetEntryPoints   @1
-  NP_Initialize       @2
-  NP_Shutdown         @3
-  DllCanUnloadNow     PRIVATE
-  DllGetClassObject   PRIVATE
-  DllRegisterServer   PRIVATE
-  DllUnregisterServer PRIVATE
diff --git a/plugins/update/npapi/dispatch_host.cc b/plugins/update/npapi/dispatch_host.cc
deleted file mode 100644
index 8d7604f..0000000
--- a/plugins/update/npapi/dispatch_host.cc
+++ /dev/null
@@ -1,266 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// TODO(omaha): use NPN_SetException to return useful error information.
-
-#include "omaha/plugins/update/npapi/dispatch_host.h"
-
-#include "base/logging.h"
-#include "base/scope_guard.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/string.h"
-#include "omaha/plugins/update/npapi/variant_utils.h"
-
-namespace omaha {
-
-namespace {
-
-void SetExceptionIfFailed(NPObject* object, HRESULT result) {
-  if (FAILED(result)) {
-    CStringA message;
-    message.Format("0x%08x", result);
-    NPN_SetException(object, message);
-  }
-}
-
-}  // namespace
-
-DispatchHost* DispatchHost::CreateInstance(NPP npp, IDispatch* dispatch) {
-  ASSERT1(dispatch);
-  DispatchHost* host = static_cast<DispatchHost*>(
-      NPN_CreateObject(npp, &kNPClass_));
-  host->dispatch_ = dispatch;
-  CORE_LOG(L3, (L"[DispatchHost::DispatchHost][this=0x%p][dispatch=0x%p]",
-                host, dispatch));
-  return host;
-}
-
-DispatchHost::DispatchHost(NPP npp) : npp_(npp) {
-}
-
-DispatchHost::~DispatchHost() {
-  CORE_LOG(L3, (L"[DispatchHost::~DispatchHost][this=0x%p][dispatch=0x%p]",
-                this, dispatch_));
-}
-
-DISPID DispatchHost::GetDispatchId(NPIdentifier name) {
-  NPUTF8* utf8_name = NPN_UTF8FromIdentifier(name);
-  CString wide_name = Utf8ToWideChar(utf8_name, lstrlenA(utf8_name));
-  NPN_MemFree(utf8_name);
-  DISPID dispatch_id = DISPID_UNKNOWN;
-  HRESULT hr = dispatch_.GetIDOfName(wide_name, &dispatch_id);
-  if (FAILED(hr)) {
-    return DISPID_UNKNOWN;
-  }
-  return dispatch_id;
-}
-
-// Whether or not a member should be treated as a property by NPAPI. A member is
-// considered a property for NPAPI if either of the following are true:
-// - The property is a getter with exactly one [out, retval] argument.
-// - The property is a putter with exactly one [in] argument.
-// The reason for this limitation is NPAPI does not support passing additional
-// arguments when getting/setting properties. Properties that take additional
-// arguments are handled as methods by NPAPI instead.
-bool DispatchHost::IsProperty(DISPID dispatch_id) {
-  CComPtr<ITypeInfo> type_info;
-  HRESULT hr = dispatch_->GetTypeInfo(0, LOCALE_SYSTEM_DEFAULT, &type_info);
-  if (FAILED(hr)) {
-    ASSERT(false, (L"[IsProperty][failed=0x%08x]", hr));
-    return false;
-  }
-  TYPEATTR* type_attr;
-  hr = type_info->GetTypeAttr(&type_attr);
-  if (FAILED(hr)) {
-    ASSERT(false, (L"[IsProperty][failed=0x%08x]", hr));
-    return false;
-  }
-  ON_SCOPE_EXIT_OBJ(*type_info.p, &ITypeInfo::ReleaseTypeAttr, type_attr);
-
-  for (int i = 0; i < type_attr->cFuncs; ++i) {
-    FUNCDESC* func_desc = NULL;
-    hr = type_info->GetFuncDesc(i, &func_desc);
-    if (FAILED(hr)) {
-      ASSERT(false, (L"[IsProperty][failed=0x%08x]", hr));
-      return false;
-    }
-    ON_SCOPE_EXIT_OBJ(*type_info.p, &ITypeInfo::ReleaseFuncDesc, func_desc);
-    if (dispatch_id == func_desc->memid) {
-      if (((func_desc->invkind & DISPATCH_PROPERTYGET) &&
-            func_desc->cParams == 0) ||
-          ((func_desc->invkind & DISPATCH_PROPERTYPUT) &&
-           func_desc->cParams == 1 &&
-           (func_desc->lprgelemdescParam[0].paramdesc.wParamFlags &
-            PARAMFLAG_FIN))) {
-        return true;
-      }
-    }
-  }
-  return false;
-}
-
-// Simple helper to adapt NPAPI method/property invocations to IDispatch::Invoke
-// by wrapping/unwrapping NPVariants into VARIANTs.
-HRESULT DispatchHost::InvokeHelper(DISPID dispatch_id, WORD flags,
-                                   const NPVariant* args, uint32_t arg_count,
-                                   NPP npp, NPVariant* result) {
-  ASSERT1(args || arg_count == 0);
-  ASSERT1(result);
-  CORE_LOG(L3, (L"[InvokeHelper][this=0x%p][dispatch=0x%p][flags=0x%x]"
-                L"[arg_count=%d]", this, dispatch_, flags, arg_count));
-
-  // Just in case a rogue browser decides to use the return value on failure.
-  VOID_TO_NPVARIANT(*result);
-  scoped_array<CComVariant> dispatch_args(new CComVariant[arg_count]);
-
-  // IDispatch::Invoke expects arguments in "reverse" order
-  for (uint32_t i = 0 ; i < arg_count; ++i) {
-    NPVariantToVariant(npp, args[i], &dispatch_args[arg_count - i - 1]);
-  }
-  DISPPARAMS dispatch_params = {};
-  dispatch_params.rgvarg = dispatch_args.get();
-  dispatch_params.cArgs = arg_count;
-  CComVariant dispatch_result;
-  HRESULT hr = dispatch_->Invoke(dispatch_id, IID_NULL, LOCALE_USER_DEFAULT,
-                                 flags, &dispatch_params, &dispatch_result,
-                                 NULL, NULL);
-  if (FAILED(hr)) {
-    CORE_LOG(L3, (L"[InvokeHelper][failed_hr=0x%p]", hr));
-    return hr;
-  }
-  VariantToNPVariant(npp, dispatch_result, result);
-  return hr;
-}
-
-NPObject* DispatchHost::Allocate(NPP npp, NPClass* class_functions) {
-  UNREFERENCED_PARAMETER(class_functions);
-  return new DispatchHost(npp);
-}
-
-void DispatchHost::Deallocate(NPObject* object) {
-  delete static_cast<DispatchHost*>(object);
-}
-
-bool DispatchHost::HasMethod(NPObject* object, NPIdentifier name) {
-  DispatchHost* host = static_cast<DispatchHost*>(object);
-  DISPID dispatch_id = host->GetDispatchId(name);
-  return dispatch_id != DISPID_UNKNOWN && !host->IsProperty(dispatch_id);
-}
-
-bool DispatchHost::Invoke(NPObject* object, NPIdentifier name,
-                          const NPVariant* args, uint32_t arg_count,
-                          NPVariant* result) {
-  DispatchHost* host = static_cast<DispatchHost*>(object);
-  CORE_LOG(L3, (L"[DispatchHost::Invoke][this=0x%p][dispatch=0x%p]",
-                host, host->dispatch_));
-  HRESULT hr = host->InvokeHelper(host->GetDispatchId(name),
-                                  DISPATCH_METHOD | DISPATCH_PROPERTYGET,
-                                  args,
-                                  arg_count,
-                                  host->npp_,
-                                  result);
-  SetExceptionIfFailed(object, hr);
-  return SUCCEEDED(hr);
-}
-
-bool DispatchHost::InvokeDefault(NPObject* object, const NPVariant* args,
-                                 uint32_t arg_count, NPVariant* result) {
-  DispatchHost* host = static_cast<DispatchHost*>(object);
-  CORE_LOG(L3, (L"[DispatchHost::InvokeDefault][this=0x%p][dispatch=0x%p]",
-                host, host->dispatch_));
-  HRESULT hr = host->InvokeHelper(DISPID_VALUE,
-                                  DISPATCH_METHOD | DISPATCH_PROPERTYGET,
-                                  args,
-                                  arg_count,
-                                  host->npp_,
-                                  result);
-  SetExceptionIfFailed(object, hr);
-  return SUCCEEDED(hr);
-}
-
-bool DispatchHost::HasProperty(NPObject* object, NPIdentifier name) {
-  DispatchHost* host = static_cast<DispatchHost*>(object);
-  DISPID dispatch_id = host->GetDispatchId(name);
-  return dispatch_id != DISPID_UNKNOWN && host->IsProperty(dispatch_id);
-}
-
-bool DispatchHost::GetProperty(NPObject* object, NPIdentifier name,
-                               NPVariant* result) {
-  DispatchHost* host = static_cast<DispatchHost*>(object);
-  CORE_LOG(L3, (L"[DispatchHost::GetProperty][this=0x%p][dispatch=0x%p]",
-                host, host->dispatch_));
-  HRESULT hr = host->InvokeHelper(host->GetDispatchId(name),
-                                  DISPATCH_PROPERTYGET,
-                                  NULL,
-                                  0,
-                                  host->npp_,
-                                  result);
-  SetExceptionIfFailed(object, hr);
-  return SUCCEEDED(hr);
-}
-
-bool DispatchHost::SetProperty(NPObject* object, NPIdentifier name,
-                               const NPVariant* value) {
-  DispatchHost* host = static_cast<DispatchHost*>(object);
-  CORE_LOG(L3, (L"[DispatchHost::SetProperty][this=0x%p][dispatch=0x%p]",
-                host, host->dispatch_));
-  DISPID dispatch_id = host->GetDispatchId(name);
-  CComVariant dispatch_arg;
-  NPVariantToVariant(host->npp_, *value, &dispatch_arg);
-  HRESULT hr = host->dispatch_.PutProperty(dispatch_id, &dispatch_arg);
-  SetExceptionIfFailed(object, hr);
-  return SUCCEEDED(hr);
-}
-
-bool DispatchHost::RemoveProperty(NPObject* object, NPIdentifier name) {
-  UNREFERENCED_PARAMETER(object);
-  UNREFERENCED_PARAMETER(name);
-  return false;
-}
-
-bool DispatchHost::Enumerate(NPObject* object, NPIdentifier** names,
-                             uint32_t* count) {
-  UNREFERENCED_PARAMETER(object);
-  UNREFERENCED_PARAMETER(names);
-  UNREFERENCED_PARAMETER(count);
-  return false;
-}
-
-bool DispatchHost::Construct(NPObject* object, const NPVariant* args,
-                             uint32_t arg_count, NPVariant* result) {
-  UNREFERENCED_PARAMETER(object);
-  UNREFERENCED_PARAMETER(args);
-  UNREFERENCED_PARAMETER(arg_count);
-  UNREFERENCED_PARAMETER(result);
-  return false;
-}
-
-NPClass DispatchHost::kNPClass_ = {
-  NP_CLASS_STRUCT_VERSION,
-  Allocate,
-  Deallocate,
-  NULL,
-  HasMethod,
-  Invoke,
-  InvokeDefault,
-  HasProperty,
-  GetProperty,
-  SetProperty,
-  RemoveProperty,
-  Enumerate,
-  Construct,
-};
-
-}  // namespace omaha
diff --git a/plugins/update/npapi/dispatch_host.h b/plugins/update/npapi/dispatch_host.h
deleted file mode 100644
index 7bdcb02..0000000
--- a/plugins/update/npapi/dispatch_host.h
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// DispatchHost hosts an IDispatch object inside a NPObject to allow scripting
-// of COM objects from a NPAPI environment. Types are automatically marshalled
-// between NPVariant and VARIANT using the functions in variant_utils.h.
-// Limitations:
-// - IDispatch methods/properties may only take arguments of type VT_VOID,
-//   VT_NULL, VT_BOOL, VT_I4, VT_R8, and VT_BSTR
-// - Multiple out parameters are not supported.
-// - IDispatch methods/properties may only return a value of type VT_EMPTY,
-//   VT_VOID, VT_NULL, VT_BOOL, VT_I4, VT_UI4, VT_R8, VT_BSTR, and VT_DISPATCH
-// - A method and property a property that takes additional arguments may not
-//   have the same identifier--the method will not be callable through
-//   DispatchHost.
-
-#ifndef OMAHA_PLUGINS_UPDATE_NPAPI_DISPATCH_HOST_H_
-#define OMAHA_PLUGINS_UPDATE_NPAPI_DISPATCH_HOST_H_
-
-#include <atlbase.h>
-#include <atlcom.h>
-
-#include "base/basictypes.h"
-#include "third_party/npapi/bindings/nphostapi.h"
-
-namespace omaha {
-
-class DispatchHostTest;
-
-class DispatchHost : public NPObject {
- public:
-  static DispatchHost* CreateInstance(NPP npp, IDispatch* dispatch);
-
- private:
-  explicit DispatchHost(NPP npp);
-  ~DispatchHost();
-
-  DISPID GetDispatchId(NPIdentifier name);
-  bool IsProperty(DISPID dispatch_id);
-  HRESULT InvokeHelper(DISPID dispatch_id, WORD flags, const NPVariant* args,
-                       uint32_t arg_count, NPP npp, NPVariant* result);
-
-  static NPObject* Allocate(NPP npp, NPClass *class_functions);
-  static void Deallocate(NPObject* object);
-  static bool HasMethod(NPObject* object, NPIdentifier name);
-  static bool Invoke(NPObject* object, NPIdentifier name, const NPVariant* args,
-                     uint32_t arg_count, NPVariant* result);
-  static bool InvokeDefault(NPObject* object, const NPVariant* args,
-                            uint32_t arg_count, NPVariant* result);
-  static bool HasProperty(NPObject* object, NPIdentifier name);
-  static bool GetProperty(NPObject* object, NPIdentifier name,
-                          NPVariant* result);
-  static bool SetProperty(NPObject* object, NPIdentifier name,
-                          const NPVariant* value);
-  static bool RemoveProperty(NPObject* object, NPIdentifier name);
-  static bool Enumerate(NPObject* object, NPIdentifier** names,
-                        uint32_t* count);
-  static bool Construct(NPObject* object, const NPVariant* args,
-                        uint32_t arg_count, NPVariant* result);
-
-  NPP npp_;
-  // The hosted dispatch object.
-  CComPtr<IDispatch> dispatch_;
-
-  // The NPObject vtable.
-  static NPClass kNPClass_;
-
-  friend class DispatchHostTest;
-
-  DISALLOW_COPY_AND_ASSIGN(DispatchHost);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_PLUGINS_UPDATE_NPAPI_DISPATCH_HOST_H_
diff --git a/plugins/update/npapi/dispatch_host_unittest.cc b/plugins/update/npapi/dispatch_host_unittest.cc
deleted file mode 100644
index 14f310c..0000000
--- a/plugins/update/npapi/dispatch_host_unittest.cc
+++ /dev/null
@@ -1,229 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/plugins/update/npapi/dispatch_host.h"
-#include <atlbase.h>
-#include <atlcom.h>
-#include <string.h>
-#include <vector>
-#include "omaha/plugins/update/npapi/testing/dispatch_host_test_interface.h"
-#include "omaha/plugins/update/npapi/testing/stubs.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-class DispatchHostTest : public testing::Test {
- protected:
-  virtual void SetUp() {
-    CComPtr<IDispatch> dispatch;
-    ASSERT_SUCCEEDED(
-        CComCoClass<DispatchHostTestInterface>::CreateInstance(&dispatch));
-    dispatch_host_ = NPN_CreateObject(NULL, &DispatchHost::kNPClass_);
-    static_cast<DispatchHost*>(dispatch_host_)->dispatch_ = dispatch.Detach();
-    VOID_TO_NPVARIANT(result_);
-  }
-
-  virtual void TearDown() {
-    NPN_ReleaseObject(dispatch_host_);
-    for (std::vector<NPVariant>::iterator it = args_.begin();
-         it != args_.end(); ++it) {
-      NPN_ReleaseVariantValue(&*it);
-    }
-    NPN_ReleaseVariantValue(&result_);
-  }
-
-  void UseTestInterface2() {
-    NPN_ReleaseObject(dispatch_host_);
-    CComPtr<IDispatch> dispatch;
-    ASSERT_SUCCEEDED(
-        CComCoClass<DispatchHostTestInterface2>::CreateInstance(&dispatch));
-    dispatch_host_ = NPN_CreateObject(NULL, &DispatchHost::kNPClass_);
-    static_cast<DispatchHost*>(dispatch_host_)->dispatch_ = dispatch.Detach();
-  }
-
-  void PushArg(bool value) {
-    args_.push_back(NPVariant());
-    BOOLEAN_TO_NPVARIANT(value, args_.back());
-  }
-
-  void PushArg(int32 value) {
-    args_.push_back(NPVariant());
-    INT32_TO_NPVARIANT(value, args_.back());
-  }
-
-  void PushArg(double value) {
-    args_.push_back(NPVariant());
-    DOUBLE_TO_NPVARIANT(value, args_.back());
-  }
-
-  void PushArg(const char* value) {
-    args_.push_back(NPVariant());
-    // TODO(omaha): _strdup is an implementation detail of the stubs.
-    STRINGZ_TO_NPVARIANT(_strdup(value), args_.back());
-  }
-
-  NPObject* dispatch_host_;
-  NPIdentifierFactory id_factory_;
-
-  std::vector<NPVariant> args_;
-  NPVariant result_;
-};
-
-TEST_F(DispatchHostTest, HasMethod) {
-  EXPECT_TRUE(NPN_HasMethod(NULL, dispatch_host_,
-                            id_factory_.Create("Random")));
-  EXPECT_TRUE(NPN_HasMethod(NULL, dispatch_host_,
-                            id_factory_.Create("AddAsMethod")));
-
-  // Property getters with input arguments should be treated as methods.
-  EXPECT_TRUE(NPN_HasMethod(NULL, dispatch_host_,
-                            id_factory_.Create("AddAsProperty")));
-
-  // Properties and non-existent members are not methods.
-  EXPECT_FALSE(NPN_HasMethod(NULL, dispatch_host_,
-                             id_factory_.Create("Property")));
-  EXPECT_FALSE(NPN_HasMethod(NULL, dispatch_host_,
-                             id_factory_.Create("ReadOnlyProperty")));
-  EXPECT_FALSE(NPN_HasMethod(NULL, dispatch_host_,
-                             id_factory_.Create("WriteOnlyProperty")));
-  EXPECT_FALSE(NPN_HasMethod(NULL, dispatch_host_,
-                             id_factory_.Create("DoesNotExist")));
-}
-
-TEST_F(DispatchHostTest, InvokeNoArgs) {
-  EXPECT_TRUE(NPN_Invoke(NULL, dispatch_host_, id_factory_.Create("Random"),
-                         NULL, 0, &result_));
-  EXPECT_TRUE(NPVARIANT_IS_INT32(result_));
-  EXPECT_EQ(42, result_.value.intValue);
-}
-
-TEST_F(DispatchHostTest, InvokeWithArgs) {
-  PushArg(7);
-  PushArg(27);
-  EXPECT_TRUE(NPN_Invoke(NULL, dispatch_host_,
-                         id_factory_.Create("AddAsMethod"), &args_.front(),
-                         args_.size(), &result_));
-  EXPECT_TRUE(NPVARIANT_IS_INT32(result_));
-  EXPECT_EQ(34, result_.value.intValue);
-}
-
-TEST_F(DispatchHostTest, InvokePropertyWithArgs) {
-  // Property getters that have input args should be handle by Invoke
-  PushArg(8);
-  PushArg(15);
-  EXPECT_TRUE(NPN_Invoke(NULL, dispatch_host_,
-                         id_factory_.Create("AddAsProperty"), &args_.front(),
-                         args_.size(), &result_));
-  EXPECT_TRUE(NPVARIANT_IS_INT32(result_));
-  EXPECT_EQ(23, result_.value.intValue);
-}
-
-TEST_F(DispatchHostTest, InvokeNonexistentMethod) {
-  // Non-existent method, should fail.
-  INT32_TO_NPVARIANT(0x19821982, result_);
-  EXPECT_FALSE(NPN_Invoke(NULL, dispatch_host_,
-                          id_factory_.Create("NonExistent"), NULL, 0,
-                          &result_));
-  EXPECT_TRUE(NPVARIANT_IS_VOID(result_));
-}
-
-TEST_F(DispatchHostTest, InvokeWithIncompatibleArgs) {
-  PushArg("Hello World!");
-  PushArg(0x19851985);
-  INT32_TO_NPVARIANT(0x19881988, result_);
-  EXPECT_FALSE(NPN_Invoke(NULL, dispatch_host_,
-                          id_factory_.Create("AddAsMethod"), &args_.front(),
-                          args_.size(), &result_));
-  EXPECT_TRUE(NPVARIANT_IS_VOID(result_));
-}
-
-TEST_F(DispatchHostTest, InvokeWithIncorrectNumberOfArgs) {
-  PushArg("Don't panic.");
-  INT32_TO_NPVARIANT(0x77777777, result_);
-  EXPECT_FALSE(NPN_Invoke(NULL, dispatch_host_, id_factory_.Create("Random"),
-                          &args_.front(), args_.size(), &result_));
-  EXPECT_TRUE(NPVARIANT_IS_VOID(result_));
-}
-
-TEST_F(DispatchHostTest, InvokeDefault) {
-  EXPECT_TRUE(NPN_InvokeDefault(NULL, dispatch_host_, NULL, 0, &result_));
-  EXPECT_TRUE(NPVARIANT_IS_OBJECT(result_));
-}
-
-TEST_F(DispatchHostTest, InvokeDefaultPropertyWithArgs) {
-  UseTestInterface2();
-  PushArg(1048576);
-  EXPECT_TRUE(NPN_InvokeDefault(NULL, dispatch_host_, &args_.front(),
-                                args_.size(), &result_));
-  EXPECT_TRUE(NPVARIANT_IS_INT32(result_));
-  EXPECT_EQ(1048576 * 2, result_.value.intValue);
-}
-
-// TODO(omaha): implement negative test
-
-TEST_F(DispatchHostTest, HasProperty) {
-  EXPECT_TRUE(NPN_HasProperty(NULL, dispatch_host_,
-                              id_factory_.Create("Property")));
-  EXPECT_TRUE(NPN_HasProperty(NULL, dispatch_host_,
-                              id_factory_.Create("ReadOnlyProperty")));
-  EXPECT_TRUE(NPN_HasProperty(NULL, dispatch_host_,
-                              id_factory_.Create("WriteOnlyProperty")));
-
-  // Property getters with input arguments should not be treated as properties.
-  EXPECT_FALSE(NPN_HasProperty(NULL, dispatch_host_,
-                               id_factory_.Create("AddAsProperty")));
-
-  // Methods and non-existent members are not properties.
-  EXPECT_FALSE(NPN_HasProperty(NULL, dispatch_host_,
-                               id_factory_.Create("Random")));
-  EXPECT_FALSE(NPN_HasProperty(NULL, dispatch_host_,
-                               id_factory_.Create("DoesNotExist")));
-}
-
-TEST_F(DispatchHostTest, GetProperty) {
-  EXPECT_TRUE(NPN_GetProperty(NULL, dispatch_host_,
-                              id_factory_.Create("Property"), &result_));
-  EXPECT_TRUE(NPVARIANT_IS_INT32(result_));
-  EXPECT_EQ(0xdeadbeef, result_.value.intValue);
-}
-
-TEST_F(DispatchHostTest, GetPropertyReadOnly) {
-  EXPECT_TRUE(NPN_GetProperty(NULL, dispatch_host_,
-                              id_factory_.Create("ReadOnlyProperty"),
-                              &result_));
-  EXPECT_TRUE(NPVARIANT_IS_INT32(result_));
-  EXPECT_EQ(19700101, result_.value.intValue);
-}
-
-TEST_F(DispatchHostTest, SetProperty) {
-  PushArg(20002000);
-  EXPECT_TRUE(NPN_SetProperty(NULL, dispatch_host_,
-                              id_factory_.Create("Property"), &args_.front()));
-}
-
-TEST_F(DispatchHostTest, SetPropertyWriteOnly) {
-  PushArg(20612061);
-  EXPECT_TRUE(NPN_SetProperty(NULL, dispatch_host_,
-                              id_factory_.Create("WriteOnlyProperty"),
-                              &args_.front()));
-}
-
-TEST_F(DispatchHostTest, Unsupported) {
-  EXPECT_FALSE(NPN_RemoveProperty(NULL, dispatch_host_, NULL));
-  EXPECT_FALSE(NPN_Enumerate(NULL, dispatch_host_, NULL, NULL));
-  EXPECT_FALSE(NPN_Construct(NULL, dispatch_host_, NULL, 0, NULL));
-}
-
-}  // namespace omaha
diff --git a/plugins/update/npapi/np_update.cc b/plugins/update/npapi/np_update.cc
deleted file mode 100644
index 948c0fa..0000000
--- a/plugins/update/npapi/np_update.cc
+++ /dev/null
@@ -1,188 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/plugins/update/npapi/np_update.h"
-
-#include <atlbase.h>
-#include <atlcom.h>
-
-#include "omaha/base/debug.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/string.h"
-#include "omaha/plugins/update/config.h"
-#include "omaha/plugins/update/npapi/dispatch_host.h"
-#include "omaha/plugins/update/npapi/urlpropbag.h"
-#include "plugins/update/activex/update_control_idl.h"
-
-NPError NS_PluginInitialize() {
-  return NPERR_NO_ERROR;
-}
-
-void NS_PluginShutdown() {
-}
-
-nsPluginInstanceBase* NS_NewPluginInstance(nsPluginCreateData* data) {
-  return new omaha::NPUpdate(data->instance, data->type);
-}
-
-void NS_DestroyPluginInstance(nsPluginInstanceBase* plugin) {
-  delete plugin;
-}
-
-namespace omaha {
-
-NPUpdate::NPUpdate(NPP instance, const char* mime_type)
-    : instance_(instance),
-      is_initialized_(false),
-      mime_type_(mime_type),
-      scriptable_object_(NULL) {
-  ASSERT1(instance);
-  // TODO(omaha): initialize COM
-}
-
-NPUpdate::~NPUpdate() {
-  if (scriptable_object_) {
-    NPN_ReleaseObject(scriptable_object_);
-  }
-}
-
-NPBool NPUpdate::init(NPWindow* np_window) {
-  UNREFERENCED_PARAMETER(np_window);
-  is_initialized_ = true;
-  return TRUE;
-}
-
-void NPUpdate::shut() {
-  is_initialized_ = false;
-}
-
-NPBool NPUpdate::isInitialized() {
-  // TODO(omaha): figure the right boolean type to return here...
-  return is_initialized_ ? TRUE : FALSE;
-}
-
-NPError NPUpdate::GetValue(NPPVariable variable, void* value) {
-  if (!instance_) {
-    return NPERR_INVALID_INSTANCE_ERROR;
-  }
-
-  if (NPPVpluginScriptableNPObject != variable || !value) {
-    return NPERR_INVALID_PARAM;
-  }
-
-  CString url;
-  if (!GetCurrentBrowserUrl(&url) || !site_lock_.InApprovedDomain(url)) {
-    return NPERR_INVALID_URL;
-  }
-
-  if (!scriptable_object_) {
-    CComPtr<IDispatch> p;
-
-    CLSID clsid;
-    if (!MapMimeTypeToClsid(&clsid)) {
-      return NPERR_INVALID_PLUGIN_ERROR;
-    }
-    if (FAILED(p.CoCreateInstance(clsid))) {
-      return NPERR_OUT_OF_MEMORY_ERROR;
-    }
-
-    // Store the current URL in a property bag and set it as the site of
-    // the object.
-    CComPtr<IPropertyBag> pb;
-    if (FAILED(UrlPropertyBag::Create(url, &pb))) {
-      return NPERR_GENERIC_ERROR;
-    }
-    CComPtr<IObjectWithSite> sited_obj;
-    if (FAILED(p.QueryInterface(&sited_obj))) {
-      return NPERR_GENERIC_ERROR;
-    }
-    if (FAILED(sited_obj->SetSite(pb))) {
-      return NPERR_GENERIC_ERROR;
-    }
-
-    scriptable_object_ = DispatchHost::CreateInstance(instance_, p);
-  }
-
-  if (scriptable_object_) {
-    NPN_RetainObject(scriptable_object_);
-  } else {
-    return NPERR_OUT_OF_MEMORY_ERROR;
-  }
-
-  *(reinterpret_cast<NPObject**>(value)) = scriptable_object_;
-  return NPERR_NO_ERROR;
-}
-
-bool NPUpdate::MapMimeTypeToClsid(CLSID* clsid) {
-  ASSERT1(clsid);
-  // TODO(omaha): We could probably abstract this out to a map that can
-  // have entries added to it at runtime, making this module fully generic.
-  // We could also consider extracting the MIME_TYPE resource from the current
-  // DLL and populating it from that.
-  if (0 == mime_type_.CompareNoCase(CString(UPDATE3WEB_MIME_TYPE))) {
-    *clsid = __uuidof(GoogleUpdate3WebControlCoClass);
-    return true;
-  }
-  if (0 == mime_type_.CompareNoCase(CString(ONECLICK_MIME_TYPE))) {
-    *clsid = __uuidof(GoogleUpdateOneClickControlCoClass);
-    return true;
-  }
-  return false;
-}
-
-bool NPUpdate::GetCurrentBrowserUrl(CString* url) {
-  ASSERT1(url);
-
-  NPObject* window = NULL;
-  NPError error = NPN_GetValue(instance_, NPNVWindowNPObject, &window);
-  if (NPERR_NO_ERROR != error || !window) {
-    ASSERT(false, (L"NPN_GetValue returned error %d", error));
-    return false;
-  }
-  ON_SCOPE_EXIT(NPN_ReleaseObject, window);
-
-  NPIdentifier location_id = NPN_GetStringIdentifier("location");
-  NPVariant location;
-  NULL_TO_NPVARIANT(location);
-  if (!NPN_GetProperty(instance_, window, location_id, &location)) {
-    ASSERT1(false);
-    return false;
-  }
-  ON_SCOPE_EXIT(NPN_ReleaseVariantValue, &location);
-  if (!NPVARIANT_IS_OBJECT(location)) {
-    ASSERT(false, (L"Variant type: %d", location.type));
-    return false;
-  }
-
-  NPIdentifier href_id = NPN_GetStringIdentifier("href");
-  NPVariant href;
-  NULL_TO_NPVARIANT(href);
-  if (!NPN_GetProperty(instance_, NPVARIANT_TO_OBJECT(location), href_id,
-                       &href)) {
-    ASSERT1(false);
-    return false;
-  }
-  ON_SCOPE_EXIT(NPN_ReleaseVariantValue, &href);
-  if (!NPVARIANT_IS_STRING(href)) {
-    ASSERT(false, (L"Variant type: %d", href.type));
-    return false;
-  }
-
-  *url = Utf8ToWideChar(NPVARIANT_TO_STRING(href).UTF8Characters,
-                        NPVARIANT_TO_STRING(href).UTF8Length);
-  return true;
-}
-
-}  // namespace omaha
diff --git a/plugins/update/npapi/np_update.h b/plugins/update/npapi/np_update.h
deleted file mode 100644
index c8668e7..0000000
--- a/plugins/update/npapi/np_update.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_PLUGINS_UPDATE_NPAPI_NP_UPDATE_H_
-#define OMAHA_PLUGINS_UPDATE_NPAPI_NP_UPDATE_H_
-
-#include <atlstr.h>
-#include "base/basictypes.h"
-#include "omaha/plugins/base/pluginbase.h"
-#include "omaha/plugins/update/site_lock.h"
-#include "third_party/npapi/bindings/nphostapi.h"
-
-namespace omaha {
-
-class DispatchHost;
-
-class NPUpdate : public nsPluginInstanceBase {
- public:
-  explicit NPUpdate(NPP instance, const char* mime_type);
-  virtual ~NPUpdate();
-
-  // nsPluginInstanceBase overrides.
-  virtual NPBool init(NPWindow* np_window);
-  virtual void shut();
-  virtual NPBool isInitialized();
-  virtual NPError GetValue(NPPVariable variable, void* value);
-
- private:
-  bool GetCurrentBrowserUrl(CString* url);
-  bool MapMimeTypeToClsid(CLSID* clsid);
-
-  NPP instance_;
-  bool is_initialized_;
-  CString mime_type_;
-  SiteLock site_lock_;
-  DispatchHost* scriptable_object_;
-
-  friend class NPUpdateTest;
-
-  DISALLOW_COPY_AND_ASSIGN(NPUpdate);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_PLUGINS_UPDATE_NPAPI_NP_UPDATE_H_
diff --git a/plugins/update/npapi/npfunction_host.cc b/plugins/update/npapi/npfunction_host.cc
deleted file mode 100644
index 19426cb..0000000
--- a/plugins/update/npapi/npfunction_host.cc
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/plugins/update/npapi/npfunction_host.h"
-
-#include "omaha/base/debug.h"
-#include "omaha/base/utils.h"
-#include "omaha/plugins/update/npapi/variant_utils.h"
-
-namespace omaha {
-
-typedef CComObject<NpFunctionHost> CComNpFuncHost;
-typedef scoped_any<CComNpFuncHost*, close_release_com, null_t> scoped_host;
-
-HRESULT NpFunctionHost::Create(NPP npp, NPObject* npobj, IDispatch** host) {
-  ASSERT1(npobj);
-  ASSERT1(host);
-
-  if (!npobj || !host) {
-    return E_INVALIDARG;
-  }
-
-  // Create the host and hand off the NPObject to it.
-  scoped_host comobj;
-  HRESULT hr = CComNpFuncHost::CreateInstance(address(comobj));
-  if (FAILED(hr)) {
-    return hr;
-  }
-  get(comobj)->AddRef();
-
-  comobj->npp_ = npp;
-  comobj->obj_ = npobj;
-  NPN_RetainObject(npobj);
-
-  return comobj->QueryInterface(host);
-}
-
-STDMETHODIMP NpFunctionHost::GetTypeInfoCount(UINT* pctinfo) {
-  if (pctinfo == NULL) {
-    return E_INVALIDARG;
-  }
-  *pctinfo = 0;
-  return S_OK;
-}
-
-STDMETHODIMP NpFunctionHost::GetTypeInfo(UINT iTInfo,
-                                         LCID lcid,
-                                         ITypeInfo** ppTInfo) {
-  UNREFERENCED_PARAMETER(iTInfo);
-  UNREFERENCED_PARAMETER(lcid);
-  UNREFERENCED_PARAMETER(ppTInfo);
-
-  return E_NOTIMPL;
-}
-
-STDMETHODIMP NpFunctionHost::GetIDsOfNames(REFIID riid,
-                                           LPOLESTR* rgszNames,
-                                           UINT cNames,
-                                           LCID lcid,
-                                           DISPID* rgDispId) {
-  UNREFERENCED_PARAMETER(riid);
-  UNREFERENCED_PARAMETER(rgszNames);
-  UNREFERENCED_PARAMETER(cNames);
-  UNREFERENCED_PARAMETER(lcid);
-  UNREFERENCED_PARAMETER(rgDispId);
-
-  return E_NOTIMPL;
-}
-
-STDMETHODIMP NpFunctionHost::Invoke(DISPID dispIdMember,
-                                    REFIID riid,
-                                    LCID lcid,
-                                    WORD wFlags,
-                                    DISPPARAMS* pDispParams,
-                                    VARIANT* pVarResult,
-                                    EXCEPINFO* pExcepInfo,
-                                    UINT* puArgErr) {
-  UNREFERENCED_PARAMETER(dispIdMember);
-  UNREFERENCED_PARAMETER(riid);
-  UNREFERENCED_PARAMETER(lcid);
-  UNREFERENCED_PARAMETER(pExcepInfo);
-  UNREFERENCED_PARAMETER(puArgErr);
-
-  if (wFlags != DISPATCH_METHOD) {
-    return DISP_E_MEMBERNOTFOUND;
-  }
-
-  uint32_t num_args = 0;
-  scoped_array<NPVariant> arguments;
-  if (pDispParams) {
-    // Javascript doesn't officially support named args, so the current
-    // implementation ignores any named args that are supplied.  However,
-    // you can cast a function object to a string and it will hold the
-    // argument names as used in the function definition.  Thus, if we
-    // need to support named arguments in the future, we may be able to
-    // get the argument names indirectly using NPN_Evaluate() and emulate.
-    if (pDispParams->cNamedArgs != 0) {
-      return DISP_E_NONAMEDARGS;
-    }
-    if (pDispParams->cArgs != 0) {
-      num_args = pDispParams->cArgs;
-      arguments.reset(new NPVariant[num_args]);
-      for (uint32_t i = 0; i < num_args; ++i) {
-        // Arguments are stored in rgvarg in reverse order.
-        VariantToNPVariant(npp_,
-                           pDispParams->rgvarg[num_args - 1 - i],
-                           &arguments[i]);
-      }
-    }
-  }
-
-  NPVariant retval;
-  VOID_TO_NPVARIANT(retval);
-
-  bool result = NPN_InvokeDefault(npp_,
-                                  obj_,
-                                  arguments.get(),
-                                  num_args,
-                                  &retval);
-  if (result && pVarResult) {
-    NPVariantToVariant(npp_, retval, pVarResult);
-  }
-  NPN_ReleaseVariantValue(&retval);
-
-  return result ? S_OK : E_FAIL;
-}
-
-void NpFunctionHost::FinalRelease() {
-  ASSERT1(obj_);
-  if (obj_) {
-    NPN_ReleaseObject(obj_);
-    obj_ = NULL;
-  }
-}
-
-NpFunctionHost::NpFunctionHost() : npp_(NULL), obj_(NULL) {}
-
-}  // namespace omaha
-
diff --git a/plugins/update/npapi/npfunction_host.h b/plugins/update/npapi/npfunction_host.h
deleted file mode 100644
index 11587d4..0000000
--- a/plugins/update/npapi/npfunction_host.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// NpFunctionHost hosts an NPObject inside an IDispatch interface to allow
-// invoking NPAPI functions from a COM environment.  Types are automatically
-// marshalled between NPVariant and VARIANT using the functions in
-// variant_utils.h.  (For the reverse -- providing an NPObject interface to
-// a COM object implementing IDispatch -- see DispatchHost.)
-//
-// Note that this currently only supports functions; this does not currently
-// support objects.  NPN_Enumerate() only provides method/property names,
-// not return types or argument counts/types, which makes it impossible to
-// properly implement IDispatch::GetTypeInfo().  (However, we can implement
-// GetIDsOfNames() if we need it in the future.)
-
-#ifndef OMAHA_PLUGINS_UPDATE_NPAPI_NPFUNCTION_HOST_H_
-#define OMAHA_PLUGINS_UPDATE_NPAPI_NPFUNCTION_HOST_H_
-
-#include <atlbase.h>
-#include <atlcom.h>
-
-#include "base/basictypes.h"
-#include "third_party/npapi/bindings/nphostapi.h"
-
-namespace omaha {
-
-class NpFunctionHostTest;
-
-class ATL_NO_VTABLE NpFunctionHost
-    : public CComObjectRootEx<CComObjectThreadModel>,
-      public IDispatch {
- public:
-  static HRESULT Create(NPP npp, NPObject* npobj, IDispatch** host);
-
-  BEGIN_COM_MAP(NpFunctionHost)
-    COM_INTERFACE_ENTRY(IDispatch)
-  END_COM_MAP()
-
-  // IDispatch methods.
-  STDMETHOD(GetTypeInfoCount)(UINT* pctinfo);
-  STDMETHOD(GetTypeInfo)(UINT iTInfo,
-                         LCID lcid,
-                         ITypeInfo** ppTInfo);
-  STDMETHOD(GetIDsOfNames)(REFIID riid,
-                           LPOLESTR* rgszNames,
-                           UINT cNames,
-                           LCID lcid,
-                           DISPID* rgDispId);
-  STDMETHOD(Invoke)(DISPID dispIdMember,
-                    REFIID riid,
-                    LCID lcid,
-                    WORD wFlags,
-                    DISPPARAMS* pDispParams,
-                    VARIANT* pVarResult,
-                    EXCEPINFO* pExcepInfo,
-                    UINT* puArgErr);
-
-  // CComObjectRootEx overrides.
-  void FinalRelease();
-
- protected:
-  NpFunctionHost();
-  virtual ~NpFunctionHost() {}
-
- private:
-  NPP npp_;
-  NPObject* obj_;
-
-  DISALLOW_COPY_AND_ASSIGN(NpFunctionHost);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_PLUGINS_UPDATE_NPAPI_NPFUNCTION_HOST_H_
diff --git a/plugins/update/npapi/npfunction_host_unittest.cc b/plugins/update/npapi/npfunction_host_unittest.cc
deleted file mode 100644
index 81d3b9b..0000000
--- a/plugins/update/npapi/npfunction_host_unittest.cc
+++ /dev/null
@@ -1,317 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/plugins/update/npapi/npfunction_host.h"
-#include <atlbase.h>
-#include <atlcom.h>
-#include <string.h>
-#include <vector>
-#include "omaha/plugins/update/npapi/testing/dispatch_host_test_interface.h"
-#include "omaha/plugins/update/npapi/testing/stubs.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-class NpFunctionHostTest;
-
-class MockFunctionNPObject : public NPObject {
- public:
-  static MockFunctionNPObject* CreateInstance(NpFunctionHostTest* creator) {
-    NPObject* obj = NPN_CreateObject(NULL, &MockFunctionNPObject::kNPClass_);
-    MockFunctionNPObject* realobj = static_cast<MockFunctionNPObject*>(obj);
-    realobj->creator_ = creator;
-    return realobj;
-  }
-
-  static NPObject* Allocate(NPP npp, NPClass* class_functions) {
-    UNREFERENCED_PARAMETER(class_functions);
-    return new MockFunctionNPObject(npp);
-  }
-
-  static void Deallocate(NPObject* object) {
-    delete static_cast<MockFunctionNPObject*>(object);
-  }
-
-  static bool InvokeDefault(NPObject* object,
-                            const NPVariant* args,
-                            uint32_t arg_count,
-                            NPVariant* result) {
-    MockFunctionNPObject* realobj = static_cast<MockFunctionNPObject*>(object);
-    return realobj->InvokeDefaultLocal(args, arg_count, result);
-  }
-
-  bool InvokeDefaultLocal(const NPVariant* args,
-                          uint32_t arg_count,
-                          NPVariant* result);
-
- protected:
-  explicit MockFunctionNPObject(NPP npp) : npp_(npp), creator_(NULL) {}
-
-  static NPUTF8* NPN_ReallocateStringZ(const char* string) {
-    uint32 buflen = strlen(string) + 1;
-    NPUTF8* npnstr = reinterpret_cast<NPUTF8*>(NPN_MemAlloc(buflen));
-    memmove(npnstr, string, buflen);
-    return npnstr;
-  }
-
- private:
-  NPP npp_;
-  NpFunctionHostTest* creator_;
-
-  // The NPObject vtable.
-  static NPClass kNPClass_;
-};
-
-class NpFunctionHostTest : public testing::Test {
- protected:
-  friend class MockFunctionNPObject;
-
-  virtual void SetUp() {
-    function_ = MockFunctionNPObject::CreateInstance(this);
-    EXPECT_SUCCEEDED(NpFunctionHost::Create(NULL, function_, &host_));
-  }
-
-  virtual void TearDown() {
-  }
-
-  NPObject* function_;
-  CComPtr<IDispatch> host_;
-
-  std::vector<NPVariant> mock_args_;
-  NPVariant mock_result_;
-};
-
-NPClass MockFunctionNPObject::kNPClass_ = {
-  NP_CLASS_STRUCT_VERSION,
-  Allocate,
-  Deallocate,
-  NULL,
-  NULL,
-  NULL,
-  InvokeDefault,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-};
-
-bool MockFunctionNPObject::InvokeDefaultLocal(const NPVariant* args,
-                                              uint32_t arg_count,
-                                              NPVariant* result) {
-  const char* kMultiStringReturn = "multi";
-
-  // The mock NPObject exhibits the following external behavior:
-  // * If no arguments, return nothing
-  // * If one argument, return a boolean (true)
-  // * If two arguments, return a string ("multi")
-  // * Otherwise, treat it as an invoke failure.
-  // It also copies the arguments as supplied, and the intended NPVariant
-  // return value, to the test closure that created it.
-
-  creator_->mock_args_.resize(arg_count);
-  for (uint32_t i = 0; i < arg_count; ++i) {
-    creator_->mock_args_[i] = args[i];
-  }
-
-  switch (arg_count) {
-    case 0:
-      VOID_TO_NPVARIANT(*result);
-      break;
-    case 1:
-      BOOLEAN_TO_NPVARIANT(true, *result);
-      break;
-    case 2:
-      {
-        NPUTF8* utf8string = NPN_ReallocateStringZ(kMultiStringReturn);
-        STRINGZ_TO_NPVARIANT(utf8string, *result);
-      }
-      break;
-    default:
-      return false;
-  }
-
-  creator_->mock_result_ = *result;
-  return true;
-}
-
-TEST_F(NpFunctionHostTest, GetTypeInfoCount) {
-  UINT typeinfos_available = 1;
-  EXPECT_SUCCEEDED(host_->GetTypeInfoCount(&typeinfos_available));
-  EXPECT_EQ(0, typeinfos_available);
-}
-
-TEST_F(NpFunctionHostTest, GetTypeInfo_NotImplemented) {
-  ITypeInfo* typeinfo = NULL;
-
-  EXPECT_EQ(E_NOTIMPL, host_->GetTypeInfo(0, LOCALE_SYSTEM_DEFAULT, &typeinfo));
-}
-
-TEST_F(NpFunctionHostTest, GetIDsOfNames_NotImplemented) {
-  LPOLESTR member_name = L"NonexistentMember";
-  DISPID member_dispid = 0;
-  EXPECT_EQ(E_NOTIMPL, host_->GetIDsOfNames(IID_NULL, &member_name, 1,
-                                            LOCALE_SYSTEM_DEFAULT,
-                                            &member_dispid));
-}
-
-TEST_F(NpFunctionHostTest, Invoke_NonMethod_NotSupported) {
-  EXPECT_EQ(DISP_E_MEMBERNOTFOUND, host_->Invoke(0, IID_NULL,
-                                                 LOCALE_SYSTEM_DEFAULT,
-                                                 DISPATCH_PROPERTYGET,
-                                                 NULL,
-                                                 NULL,
-                                                 NULL,
-                                                 NULL));
-}
-
-TEST_F(NpFunctionHostTest, Invoke_NamedArgs_NotSupported) {
-  DISPID param_name = 12;
-  DISPPARAMS params = {};
-  params.cNamedArgs = 1;
-  params.rgdispidNamedArgs = &param_name;
-  EXPECT_EQ(DISP_E_NONAMEDARGS, host_->Invoke(0, IID_NULL,
-                                              LOCALE_SYSTEM_DEFAULT,
-                                              DISPATCH_METHOD,
-                                              &params,
-                                              NULL,
-                                              NULL,
-                                              NULL));
-}
-
-TEST_F(NpFunctionHostTest, Invoke_NoArgs_NullDispParams) {
-  VARIANT retval = {};
-  EXPECT_SUCCEEDED(host_->Invoke(0, IID_NULL,
-                                 LOCALE_SYSTEM_DEFAULT,
-                                 DISPATCH_METHOD,
-                                 NULL,
-                                 &retval,
-                                 NULL,
-                                 NULL));
-
-  EXPECT_EQ(0, mock_args_.size());
-
-  EXPECT_TRUE(NPVARIANT_IS_VOID(mock_result_));
-  EXPECT_EQ(VT_EMPTY, retval.vt);
-  VariantClear(&retval);
-}
-
-TEST_F(NpFunctionHostTest, Invoke_NoArgs_ValidDispParams) {
-  VARIANT retval = {};
-  DISPPARAMS params = {};
-  EXPECT_SUCCEEDED(host_->Invoke(0, IID_NULL,
-                                 LOCALE_SYSTEM_DEFAULT,
-                                 DISPATCH_METHOD,
-                                 &params,
-                                 &retval,
-                                 NULL,
-                                 NULL));
-
-  EXPECT_EQ(0, mock_args_.size());
-
-  EXPECT_TRUE(NPVARIANT_IS_VOID(mock_result_));
-  EXPECT_EQ(VT_EMPTY, retval.vt);
-  VariantClear(&retval);
-}
-
-TEST_F(NpFunctionHostTest, Invoke_NoArgs_OneParam) {
-  const int kTestIntVal = 0xDEADBEEF;
-
-  VARIANT retval = {};
-  VARIANT firstparam = {};
-  firstparam.vt = VT_I4;
-  firstparam.intVal = kTestIntVal;
-
-  DISPPARAMS dispparams = {};
-  dispparams.cArgs = 1;
-  dispparams.rgvarg = &firstparam;
-
-  EXPECT_SUCCEEDED(host_->Invoke(0, IID_NULL,
-                                 LOCALE_SYSTEM_DEFAULT,
-                                 DISPATCH_METHOD,
-                                 &dispparams,
-                                 &retval,
-                                 NULL,
-                                 NULL));
-
-  EXPECT_EQ(1, mock_args_.size());
-  EXPECT_TRUE(NPVARIANT_IS_INT32(mock_args_[0]));
-  EXPECT_EQ(kTestIntVal, NPVARIANT_TO_INT32(mock_args_[0]));
-
-  EXPECT_TRUE(NPVARIANT_IS_BOOLEAN(mock_result_));
-  EXPECT_EQ(true, NPVARIANT_TO_BOOLEAN(mock_result_));
-  EXPECT_EQ(VT_BOOL, retval.vt);
-  EXPECT_EQ(VARIANT_TRUE, retval.boolVal);
-  VariantClear(&retval);
-}
-
-TEST_F(NpFunctionHostTest, Invoke_NoArgs_TwoParams) {
-  const double kTestFloatVal = 3.1415927;
-
-  VARIANT retval = {};
-  VARIANT params[2] = {};
-  params[0].vt = VT_BOOL;           // Invoke expects args in reverse order
-  params[0].intVal = VARIANT_TRUE;
-  params[1].vt = VT_R8;
-  params[1].dblVal = kTestFloatVal;
-
-  DISPPARAMS dispparams = {};
-  dispparams.cArgs = 2;
-  dispparams.rgvarg = params;
-  EXPECT_SUCCEEDED(host_->Invoke(0, IID_NULL,
-                                 LOCALE_SYSTEM_DEFAULT,
-                                 DISPATCH_METHOD,
-                                 &dispparams,
-                                 &retval,
-                                 NULL,
-                                 NULL));
-
-  EXPECT_EQ(2, mock_args_.size());
-  EXPECT_TRUE(NPVARIANT_IS_DOUBLE(mock_args_[0]));
-  EXPECT_EQ(kTestFloatVal, NPVARIANT_TO_DOUBLE(mock_args_[0]));
-  EXPECT_TRUE(NPVARIANT_IS_BOOLEAN(mock_args_[1]));
-  EXPECT_EQ(true, NPVARIANT_TO_BOOLEAN(mock_args_[1]));
-
-  EXPECT_TRUE(NPVARIANT_IS_STRING(mock_result_));
-  // Don't check mock_result's contents; it will have been released by Invoke()
-  EXPECT_EQ(VT_BSTR, retval.vt);
-  EXPECT_STREQ(CString("multi"), CString(retval.bstrVal));
-  VariantClear(&retval);
-}
-
-TEST_F(NpFunctionHostTest, Invoke_NoArgs_ThreeParams) {
-  VARIANT retval = {};
-  VARIANT params[3] = {};
-  for (int i = 0; i < 3; ++i) {
-    params[i].vt = VT_BOOL;
-    params[i].intVal = VARIANT_TRUE;
-  }
-
-  DISPPARAMS dispparams = {};
-  dispparams.cArgs = 3;
-  dispparams.rgvarg = params;
-  EXPECT_EQ(E_FAIL, host_->Invoke(0, IID_NULL,
-                                  LOCALE_SYSTEM_DEFAULT,
-                                  DISPATCH_METHOD,
-                                  &dispparams,
-                                  &retval,
-                                  NULL,
-                                  NULL));
-  EXPECT_EQ(3, mock_args_.size());
-}
-
-
-}  // namespace omaha
diff --git a/plugins/update/npapi/testing/dispatch_host_test.rc b/plugins/update/npapi/testing/dispatch_host_test.rc
deleted file mode 100644
index fb0991e..0000000
--- a/plugins/update/npapi/testing/dispatch_host_test.rc
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <afxres.h>
-#include "omaha/plugins/update/npapi/testing/resource.h"
-
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
-IDR_DISPATCH_HOST_TEST_TLB  TYPELIB "plugins/update/npapi/testing/dispatch_host_test_idl.tlb"
diff --git a/plugins/update/npapi/testing/dispatch_host_test_idl.idl b/plugins/update/npapi/testing/dispatch_host_test_idl.idl
deleted file mode 100644
index dcb1007..0000000
--- a/plugins/update/npapi/testing/dispatch_host_test_idl.idl
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-import "oaidl.idl";
-import "ocidl.idl";
-
-[
-  object,
-  uuid(d5c74868-1734-44e1-bab2-187a0ad2bd37),
-  dual,
-  pointer_default(unique)
-]
-interface IDispatchHostTestInterface : IDispatch {
-  [id(1)] HRESULT Random([out, retval] INT* x);
-
-  [propget] HRESULT Property([out, retval] INT* x);
-  [propput] HRESULT Property([in] INT x);
-
-  [propget] HRESULT ReadOnlyProperty([out, retval] INT* x);
-  [propput] HRESULT WriteOnlyProperty([in] INT x);
-
-  [id(2)] HRESULT AddAsMethod([in] INT a, [in] INT b, [out, retval] INT* c);
-  [id(3), propget] HRESULT AddAsProperty([in] INT a, [in] INT b,
-                                         [out, retval] INT* c);
-
-  // TODO(omaha): do we need to test multi-argument property putters?
-
-  [id(DISPID_VALUE)] HRESULT DidYouMeanRecursion([out, retval] IDispatch** me);
-};
-
-[
-  object,
-  uuid(0abeb84d-6a9c-4c5c-9394-6123c933baec),
-  dual,
-  pointer_default(unique)
-]
-interface IDispatchHostTestInterface2 : IDispatch {
-  [id(DISPID_VALUE), propget] HRESULT Get([in] INT index, [out, retval] INT* x);
-};
-
-[
-  uuid(65530e7f-4922-49e2-a5ee-c3e172da974a),
-]
-library DispatchHostTestingLib {
-  importlib("stdole2.tlb");
-
-  interface IDispatchHostTestInterface;
-  interface IDispatchHostTestInterface2;
-};
diff --git a/plugins/update/npapi/testing/dispatch_host_test_interface.cc b/plugins/update/npapi/testing/dispatch_host_test_interface.cc
deleted file mode 100644
index 0760809..0000000
--- a/plugins/update/npapi/testing/dispatch_host_test_interface.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/plugins/update/npapi/testing/dispatch_host_test_interface.h"
-
-namespace omaha {
-
-STDMETHODIMP DispatchHostTestInterface::Random(INT* x) {
-  *x = 42;
-  return S_OK;
-}
-
-STDMETHODIMP DispatchHostTestInterface::get_Property(INT* x) {
-  *x = 0xdeadbeef;
-  return S_OK;
-}
-
-STDMETHODIMP DispatchHostTestInterface::put_Property(INT x) {
-  UNREFERENCED_PARAMETER(x);
-  return S_OK;
-}
-
-STDMETHODIMP DispatchHostTestInterface::get_ReadOnlyProperty(INT* x) {
-  *x = 19700101;
-  return S_OK;
-}
-
-STDMETHODIMP DispatchHostTestInterface::put_WriteOnlyProperty(INT x) {
-  UNREFERENCED_PARAMETER(x);
-  return S_OK;
-}
-
-STDMETHODIMP DispatchHostTestInterface::AddAsMethod(INT a, INT b, INT* c) {
-  *c = a + b;
-  return S_OK;
-}
-
-STDMETHODIMP DispatchHostTestInterface::get_AddAsProperty(
-    INT a, INT b, INT* c) {
-  *c = a + b;
-  return S_OK;
-}
-
-STDMETHODIMP DispatchHostTestInterface::DidYouMeanRecursion(IDispatch** me) {
-  *me = this;
-  return S_OK;
-}
-
-STDMETHODIMP DispatchHostTestInterface2::get_Get(INT index, INT* x) {
-  *x = index << 1;
-  return S_OK;
-}
-
-}  // namespace omaha
diff --git a/plugins/update/npapi/testing/dispatch_host_test_interface.h b/plugins/update/npapi/testing/dispatch_host_test_interface.h
deleted file mode 100644
index 3bbef69..0000000
--- a/plugins/update/npapi/testing/dispatch_host_test_interface.h
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_PLUGINS_UPDATE_NPAPI_TESTING_DISPATCH_HOST_TEST_INTERFACE_H_
-#define OMAHA_PLUGINS_UPDATE_NPAPI_TESTING_DISPATCH_HOST_TEST_INTERFACE_H_
-
-#include <atlbase.h>
-#include <atlcom.h>
-#include <atlstr.h>
-
-#include "base/basictypes.h"
-#include "omaha/base/app_util.h"
-#include "omaha/plugins/update/npapi/testing/resource.h"
-#include "plugins/update/npapi/testing/dispatch_host_test_idl.h"
-
-namespace omaha {
-
-// This class allows for using IDispatchImpl with a specific TypeLib, in a
-// module that has multiple TYPELIB resources. Ordinarily, IDispatchImpl will
-// only load the first TYPELIB resource in the module, which does not work for
-// omaha_unittest.exe. Hence the need for this class. This class loads the TLB
-// with the specified resource id, and uses that for subsequent IDispatch
-// requests.
-// TODO(omaha3): Perhaps move this class into a generic utility header.
-
-template <class T, const IID* piid = &__uuidof(T), const int tlb_res_id = 1>
-class ATL_NO_VTABLE IDispatchImplResId : public IDispatchImpl<T, piid> {
- public:
-  IDispatchImplResId() {
-    CComPtr<ITypeLib> type_lib;
-    CString tlb_path;
-
-    // Format the path as "ModulePath\\ResourceId". Specifying a ResourceId
-    // allows overriding the default behavior of LoadTypeLib to load the first
-    // TYPELIB resource from the module.
-    tlb_path.Format(_T("%s\\%d"), app_util::GetCurrentModuleName(), tlb_res_id);
-
-    HRESULT hr = LoadTypeLib(tlb_path, &type_lib);
-    if (FAILED(hr)) {
-      return;
-    }
-
-    CComPtr<ITypeInfo> type_info;
-    hr = type_lib->GetTypeInfoOfGuid(*piid, &type_info);
-    if (FAILED(hr)) {
-      return;
-    }
-
-    CComPtr<ITypeInfo2> type_info2;
-    if (SUCCEEDED(type_info->QueryInterface(&type_info2))) {
-      type_info = type_info2;
-    }
-
-    // Override the ITypeInfo in the CComTypeInfoHolder, which will be used in
-    // subsequent calls to the IDispatch methods.
-    _tih.m_pInfo = type_info.Detach();
-  }
-
-  virtual ~IDispatchImplResId() {}
-};
-
-class ATL_NO_VTABLE DispatchHostTestInterface
-    : public CComObjectRootEx<CComObjectThreadModel>,
-      public IDispatchImplResId<IDispatchHostTestInterface,
-                                &__uuidof(IDispatchHostTestInterface),
-                                IDR_DISPATCH_HOST_TEST_TLB> {
- public:
-  DispatchHostTestInterface() {}
-  virtual ~DispatchHostTestInterface() {}
-
-  DECLARE_NOT_AGGREGATABLE(DispatchHostTestInterface);
-
-  BEGIN_COM_MAP(DispatchHostTestInterface)
-    COM_INTERFACE_ENTRY(IDispatch)
-  END_COM_MAP()
-
-  // IDispatchHostTestInterface methods.
-  STDMETHOD(Random)(INT* x);
-
-  STDMETHOD(get_Property)(INT* x);
-  STDMETHOD(put_Property)(INT x);
-
-  STDMETHOD(get_ReadOnlyProperty)(INT* x);
-  STDMETHOD(put_WriteOnlyProperty)(INT x);
-
-  STDMETHOD(AddAsMethod)(INT a, INT b, INT* c);
-  STDMETHOD(get_AddAsProperty)(INT a, INT b, INT* c);
-
-  STDMETHOD(DidYouMeanRecursion)(IDispatch** me);
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(DispatchHostTestInterface);
-};
-
-class ATL_NO_VTABLE DispatchHostTestInterface2
-    : public CComObjectRootEx<CComObjectThreadModel>,
-      public IDispatchImplResId<IDispatchHostTestInterface2,
-                                &__uuidof(IDispatchHostTestInterface2),
-                                IDR_DISPATCH_HOST_TEST_TLB> {
- public:
-  DispatchHostTestInterface2() {}
-  virtual ~DispatchHostTestInterface2() {}
-
-  DECLARE_NOT_AGGREGATABLE(DispatchHostTestInterface2);
-
-  BEGIN_COM_MAP(DispatchHostTestInterface)
-    COM_INTERFACE_ENTRY(IDispatch)
-  END_COM_MAP()
-
-  // IDispatchHostTestInterface2 methods.
-  STDMETHOD(get_Get)(INT index, INT* x);
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(DispatchHostTestInterface2);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_PLUGINS_UPDATE_NPAPI_TESTING_DISPATCH_HOST_TEST_INTERFACE_H_
diff --git a/plugins/update/npapi/testing/resource.h b/plugins/update/npapi/testing/resource.h
deleted file mode 100644
index 6bfedb3..0000000
--- a/plugins/update/npapi/testing/resource.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_PLUGINS_UPDATE_NPAPI_TESTING_RESOURCE_H__
-#define OMAHA_PLUGINS_UPDATE_NPAPI_TESTING_RESOURCE_H__
-
-#define IDR_DISPATCH_HOST_TEST_TLB                  3
-
-#endif  // OMAHA_PLUGINS_UPDATE_NPAPI_TESTING_RESOURCE_H__
diff --git a/plugins/update/npapi/testing/stubs.cc b/plugins/update/npapi/testing/stubs.cc
deleted file mode 100644
index 30921cc..0000000
--- a/plugins/update/npapi/testing/stubs.cc
+++ /dev/null
@@ -1,142 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/plugins/update/npapi/testing/stubs.h"
-#include <malloc.h>
-#include <string.h>
-#include "base/debug.h"
-
-namespace omaha {
-
-NPIdentifierFactory::NPIdentifierFactory() {
-}
-
-NPIdentifierFactory::~NPIdentifierFactory() {
-  for (std::vector<NPIdentifier>::const_iterator it = identifiers_.begin();
-       it != identifiers_.end(); ++it) {
-    free(*it);
-  }
-}
-
-NPIdentifier NPIdentifierFactory::Create(const char* name) {
-  NPIdentifier identifier = _strdup(name);
-  identifiers_.push_back(identifier);
-  return identifier;
-}
-
-}  // namespace omaha
-
-extern "C" {
-void* NPN_MemAlloc(uint32 size) {
-  return malloc(size);
-}
-
-void NPN_MemFree(void* ptr) {
-  free(ptr);
-}
-
-NPUTF8* NPN_UTF8FromIdentifier(NPIdentifier identifier) {
-  return _strdup(static_cast<char*>(identifier));
-}
-
-NPObject* NPN_CreateObject(NPP npp, NPClass* class_vtable) {
-  UNREFERENCED_PARAMETER(npp);
-  ASSERT1(class_vtable);
-  NPObject* object = class_vtable->allocate(npp, class_vtable);
-  object->_class = class_vtable;
-  object->referenceCount = 1;
-  return object;
-}
-
-NPObject* NPN_RetainObject(NPObject* object) {
-  ASSERT1(object);
-  ++object->referenceCount;
-  return object;
-}
-
-void NPN_ReleaseObject(NPObject* object) {
-  ASSERT1(object);
-  ASSERT1(object->referenceCount > 0);
-  if (--object->referenceCount == 0) {
-    object->_class->deallocate(object);
-  }
-}
-
-void NPN_ReleaseVariantValue(NPVariant* variant) {
-  if (NPVARIANT_IS_STRING(*variant)) {
-    NPN_MemFree(const_cast<NPUTF8*>(variant->value.stringValue.UTF8Characters));
-  } else if (NPVARIANT_IS_OBJECT(*variant)) {
-    NPN_ReleaseObject(variant->value.objectValue);
-  }
-  VOID_TO_NPVARIANT(*variant);
-  return;
-}
-
-bool NPN_HasMethod(NPP npp, NPObject* object, NPIdentifier name) {
-  UNREFERENCED_PARAMETER(npp);
-  return object->_class->hasMethod(object, name);
-}
-
-bool NPN_Invoke(NPP npp, NPObject* object, NPIdentifier name,
-                const NPVariant* args, uint32_t arg_count, NPVariant* result) {
-  UNREFERENCED_PARAMETER(npp);
-  return object->_class->invoke(object, name, args, arg_count, result);
-}
-
-bool NPN_InvokeDefault(NPP npp, NPObject* object, const NPVariant* args,
-                       uint32_t arg_count, NPVariant* result) {
-  UNREFERENCED_PARAMETER(npp);
-  return object->_class->invokeDefault(object, args, arg_count, result);
-}
-
-bool NPN_HasProperty(NPP npp, NPObject* object, NPIdentifier name) {
-  UNREFERENCED_PARAMETER(npp);
-  return object->_class->hasProperty(object, name);
-}
-
-bool NPN_GetProperty(NPP npp, NPObject* object, NPIdentifier name,
-                     NPVariant* result) {
-  UNREFERENCED_PARAMETER(npp);
-  return object->_class->getProperty(object, name, result);
-}
-
-bool NPN_SetProperty(NPP npp, NPObject* object, NPIdentifier name,
-                     const NPVariant* value) {
-  UNREFERENCED_PARAMETER(npp);
-  return object->_class->setProperty(object, name, value);
-}
-
-bool NPN_RemoveProperty(NPP npp, NPObject* object, NPIdentifier name) {
-  UNREFERENCED_PARAMETER(npp);
-  return object->_class->removeProperty(object, name);
-}
-
-bool NPN_Enumerate(NPP npp, NPObject* object, NPIdentifier** names,
-                   uint32_t* count) {
-  UNREFERENCED_PARAMETER(npp);
-  return object->_class->enumerate(object, names, count);
-}
-
-bool NPN_Construct(NPP npp, NPObject* object, const NPVariant* args,
-                   uint32_t arg_count, NPVariant* result) {
-  UNREFERENCED_PARAMETER(npp);
-  return object->_class->construct(object, args, arg_count, result);
-}
-
-void NPN_SetException(NPObject* object, const NPUTF8* message) {
-  UNREFERENCED_PARAMETER(object);
-  UNREFERENCED_PARAMETER(message);
-}
-}  // extern "C"
diff --git a/plugins/update/npapi/testing/stubs.h b/plugins/update/npapi/testing/stubs.h
deleted file mode 100644
index 76ba6b3..0000000
--- a/plugins/update/npapi/testing/stubs.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Normally, implementations of these functions are provided by the NPAPI
-// runtime. These stub implementations are intended only for use in unit tests.
-
-#ifndef OMAHA_PLUGINS_UPDATE_NPAPI_TESTING_STUBS_H_
-#define OMAHA_PLUGINS_UPDATE_NPAPI_TESTING_STUBS_H_
-
-#include <vector>
-#include "third_party/npapi/bindings/nphostapi.h"
-
-namespace omaha {
-
-// Not part of NPAPI proper, but useful nonetheless. Note that the stub
-// implementation of NPIdentifier does not conform to NPAPI's idea of what an
-// NPIdentifier ought to be: specifically, uniqueness is not guaranteed.
-class NPIdentifierFactory {
- public:
-  NPIdentifierFactory();
-  ~NPIdentifierFactory();
-  NPIdentifier Create(const char* name);
-
- private:
-  std::vector<NPIdentifier> identifiers_;
-
-  DISALLOW_COPY_AND_ASSIGN(NPIdentifierFactory);
-};
-
-}  // namespace omaha
-
-extern "C" {
-void* NPN_MemAlloc(uint32 size);
-void NPN_MemFree(void* ptr);
-NPUTF8* NPN_UTF8FromIdentifier(NPIdentifier identifier);
-NPObject* NPN_CreateObject(NPP npp, NPClass* class_vtable);
-NPObject* NPN_RetainObject(NPObject* object);
-void NPN_ReleaseObject(NPObject* object);
-void NPN_ReleaseVariantValue(NPVariant* variant);
-
-bool NPN_HasMethod(NPP npp, NPObject* object, NPIdentifier name);
-bool NPN_Invoke(NPP npp, NPObject* object, NPIdentifier name,
-                const NPVariant* args, uint32_t arg_count, NPVariant* result);
-bool NPN_InvokeDefault(NPP npp, NPObject* object, const NPVariant* args,
-                       uint32_t arg_count, NPVariant* result);
-bool NPN_HasProperty(NPP npp, NPObject* object, NPIdentifier name);
-bool NPN_GetProperty(NPP npp, NPObject* object, NPIdentifier name,
-                     NPVariant* result);
-bool NPN_SetProperty(NPP npp, NPObject* object, NPIdentifier name,
-                     const NPVariant* value);
-bool NPN_RemoveProperty(NPP npp, NPObject* object, NPIdentifier name);
-bool NPN_Enumerate(NPP npp, NPObject* object, NPIdentifier** names,
-                   uint32_t* count);
-bool NPN_Construct(NPP npp, NPObject* object, const NPVariant* args,
-                   uint32_t arg_count, NPVariant* result);
-void NPN_SetException(NPObject* object, const NPUTF8* message);
-}  // extern "C"
-
-#endif  // OMAHA_PLUGINS_UPDATE_NPAPI_TESTING_STUBS_H_
-
diff --git a/plugins/update/npapi/urlpropbag.cc b/plugins/update/npapi/urlpropbag.cc
deleted file mode 100644
index 940a9b4..0000000
--- a/plugins/update/npapi/urlpropbag.cc
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/plugins/update/npapi/urlpropbag.h"
-
-#include "omaha/base/debug.h"
-#include "omaha/base/utils.h"
-#include "omaha/plugins/update/npapi/variant_utils.h"
-
-namespace omaha {
-
-typedef CComObject<UrlPropertyBag> CComUrlBag;
-typedef scoped_any<CComUrlBag*, close_release_com, null_t> scoped_bag;
-
-HRESULT UrlPropertyBag::Create(const TCHAR* url, IPropertyBag** pb) {
-  ASSERT1(url);
-  ASSERT1(pb);
-
-  if (!url || !pb) {
-    return E_INVALIDARG;
-  }
-
-  // Create the host and hand off the string to it.
-  scoped_bag comobj;
-  HRESULT hr = CComUrlBag::CreateInstance(address(comobj));
-  if (FAILED(hr)) {
-    return hr;
-  }
-  get(comobj)->AddRef();
-
-  comobj->url_ = url;
-
-  return comobj->QueryInterface(pb);
-}
-
-STDMETHODIMP UrlPropertyBag::Read(LPCOLESTR pszPropName, VARIANT* pVar,
-                                  IErrorLog* pErrorLog) {
-  UNREFERENCED_PARAMETER(pErrorLog);
-
-  ASSERT1(pszPropName);
-  ASSERT1(pVar);
-  if (!pszPropName || !pVar) {
-    return E_POINTER;
-  }
-
-  if (0 == _tcscmp(pszPropName, kUrlPropertyBag_Url)) {
-    V_VT(pVar) = VT_BSTR;
-    V_BSTR(pVar) = url_.AllocSysString();
-    return S_OK;
-  }
-
-  return E_INVALIDARG;
-}
-
-STDMETHODIMP UrlPropertyBag::Write(LPCOLESTR pszPropName, VARIANT* pVar) {
-  UNREFERENCED_PARAMETER(pszPropName);
-  UNREFERENCED_PARAMETER(pVar);
-  return E_FAIL;
-}
-
-UrlPropertyBag::UrlPropertyBag() {}
-
-}  // namespace omaha
-
diff --git a/plugins/update/npapi/urlpropbag.h b/plugins/update/npapi/urlpropbag.h
deleted file mode 100644
index 0090bb2..0000000
--- a/plugins/update/npapi/urlpropbag.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_PLUGINS_UPDATE_NPAPI_URLPROPBAG_H_
-#define OMAHA_PLUGINS_UPDATE_NPAPI_URLPROPBAG_H_
-
-#include <atlbase.h>
-#include <atlcom.h>
-
-namespace omaha {
-
-const TCHAR* const kUrlPropertyBag_Url = _T("omaha-urlpropertybag-url");
-
-class ATL_NO_VTABLE UrlPropertyBag
-    : public CComObjectRootEx<CComObjectThreadModel>,
-      public IPropertyBag {
- public:
-  static HRESULT Create(const TCHAR* url, IPropertyBag** pb);
-
-  BEGIN_COM_MAP(UrlPropertyBag)
-    COM_INTERFACE_ENTRY(IPropertyBag)
-  END_COM_MAP()
-
-  // IPropertyBag methods.
-  STDMETHOD(Read)(LPCOLESTR pszPropName, VARIANT* pVar, IErrorLog* pErrorLog);
-  STDMETHOD(Write)(LPCOLESTR pszPropName, VARIANT* pVar);
-
- protected:
-  UrlPropertyBag();
-  virtual ~UrlPropertyBag() {}
-
- private:
-  CString url_;
-
-  DISALLOW_COPY_AND_ASSIGN(UrlPropertyBag);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_PLUGINS_UPDATE_NPAPI_URLPROPBAG_H_
diff --git a/plugins/update/npapi/variant_utils.cc b/plugins/update/npapi/variant_utils.cc
deleted file mode 100644
index 125d18b..0000000
--- a/plugins/update/npapi/variant_utils.cc
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// TODO(omaha): verify that the new operator throws on failure to prevent NULL
-// pointer exploits.
-
-#include "omaha/plugins/update/npapi/variant_utils.h"
-#include <atlstr.h>
-#include "base/debug.h"
-#include "base/string.h"
-#include "omaha/plugins/update/npapi/dispatch_host.h"
-#include "omaha/plugins/update/npapi/npfunction_host.h"
-
-namespace omaha {
-
-void NPVariantToVariant(NPP npp,
-                        const NPVariant& source,
-                        VARIANT* destination) {
-  ASSERT1(destination);
-  V_VT(destination) = VT_EMPTY;
-
-  switch (source.type) {
-    case NPVariantType_Void:
-      V_VT(destination) = VT_EMPTY;
-      break;
-    case NPVariantType_Null:
-      V_VT(destination) = VT_NULL;
-      break;
-    case NPVariantType_Bool:
-      V_VT(destination) = VT_BOOL;
-      V_BOOL(destination) = source.value.boolValue ? VARIANT_TRUE
-                                                   : VARIANT_FALSE;
-      break;
-    case NPVariantType_Int32:
-      V_VT(destination) = VT_I4;
-      V_I4(destination) = source.value.intValue;
-      break;
-    case NPVariantType_Double:
-      V_VT(destination) = VT_R8;
-      V_R8(destination) = source.value.doubleValue;
-      break;
-    case NPVariantType_String:
-      V_VT(destination) = VT_BSTR;
-      if (source.value.stringValue.UTF8Length) {
-        CString string = Utf8ToWideChar(source.value.stringValue.UTF8Characters,
-                                        source.value.stringValue.UTF8Length);
-        V_BSTR(destination) = string.AllocSysString();
-      } else {
-        V_BSTR(destination) = CString().AllocSysString();
-      }
-      break;
-    case NPVariantType_Object:
-      V_VT(destination) = VT_DISPATCH;
-      if (source.value.objectValue) {
-        NpFunctionHost::Create(npp, source.value.objectValue,
-                               &V_DISPATCH(destination));
-      } else {
-        V_DISPATCH(destination) = NULL;
-      }
-      break;
-    default:
-      ASSERT1(false);
-      break;
-  }
-}
-
-void VariantToNPVariant(NPP npp,
-                        const VARIANT& source,
-                        NPVariant* destination) {
-  ASSERT1(destination);
-  VOID_TO_NPVARIANT(*destination);
-
-  switch (V_VT(&source)) {
-    case VT_EMPTY:
-      VOID_TO_NPVARIANT(*destination);
-      break;
-    case VT_NULL:
-      NULL_TO_NPVARIANT(*destination);
-      break;
-    case VT_BOOL:
-      BOOLEAN_TO_NPVARIANT(V_BOOL(&source), *destination);
-      break;
-    case VT_I4:
-      INT32_TO_NPVARIANT(V_I4(&source), *destination);
-      break;
-    case VT_UI4:
-      INT32_TO_NPVARIANT(V_UI4(&source), *destination);
-      break;
-    case VT_R8:
-      DOUBLE_TO_NPVARIANT(V_R8(&source), *destination);
-      break;
-    case VT_BSTR:
-      if (V_BSTR(&source)) {
-        int source_length = ::SysStringLen(V_BSTR(&source)) + 1;
-        int buffer_length = ::WideCharToMultiByte(CP_UTF8, 0, V_BSTR(&source),
-                                                  source_length, NULL, 0, NULL,
-                                                  NULL);
-        char* buffer = static_cast<char*>(NPN_MemAlloc(buffer_length));
-        VERIFY1(::WideCharToMultiByte(CP_UTF8, 0, V_BSTR(&source),
-                                      source_length, buffer, buffer_length,
-                                      NULL, NULL) > 0);
-        STRINGN_TO_NPVARIANT(buffer, buffer_length - 1, *destination);
-      } else {
-        char* buffer = static_cast<char*>(NPN_MemAlloc(1));
-        buffer[0] = '\0';
-        STRINGN_TO_NPVARIANT(buffer, 0, *destination);
-      }
-      break;
-    case VT_DISPATCH:
-      if (V_DISPATCH(&source)) {
-        OBJECT_TO_NPVARIANT(
-            DispatchHost::CreateInstance(npp, V_DISPATCH(&source)),
-            *destination);
-      }
-      break;
-    default:
-      ASSERT(false, (L"Unhandled variant type %d", V_VT(&source)));
-      break;
-  }
-}
-
-}  // namespace omaha
diff --git a/plugins/update/npapi/variant_utils.h b/plugins/update/npapi/variant_utils.h
deleted file mode 100644
index d283926..0000000
--- a/plugins/update/npapi/variant_utils.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Converts between NPVariant and VARIANT types.
-// The following two-way conversions are supported:
-// NPVariantType_Void <-> VT_EMPTY
-// NPVariantType_Null <-> VT_NULL
-// NPVariantType_Bool <-> VT_BOOL
-// NPVariantType_Int32 <-> VT_I4
-// NPVariantType_Double <-> VT_R8
-// NPVariantType_String <-> VT_BSTR
-//
-// Furthermore, the following one-way conversions are supported:
-// VT_UI4 -> NPVariantType_Int32
-// VT_DISPATCH -> NPVariantType_Object (DispatchHost)
-// NPVariantType_Object -> VT_DISPATCH (NpFunctionHost)
-
-#ifndef OMAHA_PLUGINS_UPDATE_NPAPI_VARIANT_UTILS_H_
-#define OMAHA_PLUGINS_UPDATE_NPAPI_VARIANT_UTILS_H_
-
-#include <oaidl.h>
-#include "third_party/npapi/bindings/nphostapi.h"
-
-namespace omaha {
-
-void NPVariantToVariant(NPP npp,
-                        const NPVariant& source,
-                        VARIANT* destination);
-
-void VariantToNPVariant(NPP npp,
-                        const VARIANT& source,
-                        NPVariant* destination);
-
-}  // namespace omaha
-
-#endif  // OMAHA_PLUGINS_UPDATE_NPAPI_VARIANT_UTILS_H_
diff --git a/plugins/update/npapi/variant_utils_unittest.cc b/plugins/update/npapi/variant_utils_unittest.cc
deleted file mode 100644
index eacc04d..0000000
--- a/plugins/update/npapi/variant_utils_unittest.cc
+++ /dev/null
@@ -1,320 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/plugins/update/npapi/variant_utils.h"
-#include <atlbase.h>
-#include <string.h>
-#include <stdlib.h>
-#include "omaha/plugins/update/npapi/testing/dispatch_host_test_interface.h"
-#include "omaha/plugins/update/npapi/testing/stubs.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-class VariantUtilsTest : public testing::Test {
- protected:
-  virtual void SetUp() {
-    VOID_TO_NPVARIANT(np_variant_);
-  }
-
-  virtual void TearDown() {
-    NPN_ReleaseVariantValue(&np_variant_);
-  }
-
-  void TestNPV2V() {
-    NPVariantToVariant(NULL, np_variant_, &variant_);
-    ExpectTypesEquivalent();
-  }
-
-  void TestV2NPV() {
-    NPN_ReleaseVariantValue(&np_variant_);
-    VariantToNPVariant(NULL, variant_, &np_variant_);
-    ExpectTypesEquivalent();
-  }
-
-  void ExpectTypesEquivalent() {
-    switch (V_VT(&variant_)) {
-      case VT_EMPTY:
-        EXPECT_TRUE(NPVARIANT_IS_VOID(np_variant_));
-        return;
-        break;
-      case VT_NULL:
-        EXPECT_TRUE(NPVARIANT_IS_NULL(np_variant_));
-        return;
-        break;
-      case VT_BOOL:
-        EXPECT_TRUE(NPVARIANT_IS_BOOLEAN(np_variant_));
-        return;
-        break;
-      case VT_I4:
-      case VT_UI4:
-        EXPECT_TRUE(NPVARIANT_IS_INT32(np_variant_));
-        return;
-        break;
-      case VT_R8:
-        EXPECT_TRUE(NPVARIANT_IS_DOUBLE(np_variant_));
-        return;
-        break;
-      case VT_BSTR:
-        EXPECT_TRUE(NPVARIANT_IS_STRING(np_variant_));
-        return;
-        break;
-      case VT_DISPATCH:
-        EXPECT_TRUE(NPVARIANT_IS_OBJECT(np_variant_));
-        return;
-        break;
-      default:
-        break;
-    }
-    ASSERT(false, (L"Expected equivalent types but got the following instead:\n"
-                   L"  np_variant_.type -> %d\n  V_VT(&variant_) -> %d\n",
-                   np_variant_.type, V_VT(&variant_)));
-  }
-
-  NPVariant np_variant_;
-  CComVariant variant_;
-};
-
-TEST_F(VariantUtilsTest, NPVariantToVariant_Void) {
-  VOID_TO_NPVARIANT(np_variant_);
-  TestNPV2V();
-}
-
-TEST_F(VariantUtilsTest, NPVariantToVariant_Null) {
-  NULL_TO_NPVARIANT(np_variant_);
-  TestNPV2V();
-}
-
-TEST_F(VariantUtilsTest, NPVariantToVariant_Bool) {
-  BOOLEAN_TO_NPVARIANT(true, np_variant_);
-  TestNPV2V();
-  EXPECT_EQ(VARIANT_TRUE, V_BOOL(&variant_));
-
-  BOOLEAN_TO_NPVARIANT(false, np_variant_);
-  TestNPV2V();
-  EXPECT_EQ(VARIANT_FALSE, V_BOOL(&variant_));
-}
-
-TEST_F(VariantUtilsTest, NPVariantToVariant_Int32) {
-  INT32_TO_NPVARIANT(kint32min, np_variant_);
-  TestNPV2V();
-  EXPECT_EQ(kint32min, V_I4(&variant_));
-
-  INT32_TO_NPVARIANT(0, np_variant_);
-  TestNPV2V();
-  EXPECT_EQ(0, V_I4(&variant_));
-
-  INT32_TO_NPVARIANT(kint32max, np_variant_);
-  TestNPV2V();
-  EXPECT_EQ(kint32max, V_I4(&variant_));
-}
-
-TEST_F(VariantUtilsTest, NPVariantToVariant_Double) {
-  DOUBLE_TO_NPVARIANT(-1, np_variant_);
-  TestNPV2V();
-  EXPECT_DOUBLE_EQ(-1, V_R8(&variant_));
-
-  DOUBLE_TO_NPVARIANT(0, np_variant_);
-  TestNPV2V();
-  EXPECT_DOUBLE_EQ(0, V_R8(&variant_));
-
-  DOUBLE_TO_NPVARIANT(static_cast<double>(kuint64max),
-                      np_variant_);
-  TestNPV2V();
-  EXPECT_DOUBLE_EQ(static_cast<double>(kuint64max), V_R8(&variant_));
-}
-
-TEST_F(VariantUtilsTest, NPVariantToVariant_String) {
-  // TODO(omaha): _strdup depends on an implementation detail of the stubs.
-  STRINGZ_TO_NPVARIANT(_strdup(""), np_variant_);
-  TestNPV2V();
-  EXPECT_STREQ(L"", V_BSTR(&variant_));
-
-  // Force the length to be zero.
-  STRINGZ_TO_NPVARIANT(_strdup("junk"), np_variant_);
-  np_variant_.value.stringValue.UTF8Length = 0;
-  TestNPV2V();
-  EXPECT_STREQ(L"", V_BSTR(&variant_));
-
-  STRINGZ_TO_NPVARIANT(_strdup("ROBERT'); DROP TABLE Students; --"),
-                       np_variant_);
-  TestNPV2V();
-  EXPECT_STREQ(L"ROBERT'); DROP TABLE Students; --", V_BSTR(&variant_));
-
-  // Check that NPVariantToVariant properly converts UTF-8 to UTF-16.
-  STRINGZ_TO_NPVARIANT(_strdup("one: \xe4\xb8\x80"), np_variant_);
-  TestNPV2V();
-  EXPECT_STREQ(L"one: \x4e00", V_BSTR(&variant_));
-}
-/*
-TEST_F(VariantUtilsTest, NPVariantToVariant_Unsupported) {
-  // NPVariantType_Object -> VT_DISPATCH conversion is not supported.
-  ExpectAsserts expect_asserts;
-  OBJECT_TO_NPVARIANT(NULL, np_variant_);
-  variant_ = 24;
-  NPVariantToVariant(NULL, np_variant_, &variant_);
-  EXPECT_EQ(VT_EMPTY, V_VT(&variant_));
-  // Manual cleanup, since OBJECT_TO_NPVARIANT macro was used with a NULL
-  // NPObject, which is normally illegal.
-  VOID_TO_NPVARIANT(np_variant_);
-}
-*/
-TEST_F(VariantUtilsTest, VariantToNPVariant_VT_EMPTY) {
-  variant_.ChangeType(VT_EMPTY);
-  TestV2NPV();
-}
-
-TEST_F(VariantUtilsTest, VariantToNPVariant_VT_NULL) {
-  variant_.ChangeType(VT_NULL);
-  TestV2NPV();
-}
-
-TEST_F(VariantUtilsTest, VariantToNPVariant_VT_BOOL) {
-  variant_ = true;
-  TestV2NPV();
-  EXPECT_TRUE(np_variant_.value.boolValue);
-
-  variant_ = false;
-  TestV2NPV();
-  EXPECT_FALSE(np_variant_.value.boolValue);
-}
-
-TEST_F(VariantUtilsTest, VariantToNPVariant_VT_I4) {
-  variant_ = kint32max;
-  TestV2NPV();
-  EXPECT_EQ(kint32max, np_variant_.value.intValue);
-
-  variant_ = 0;
-  TestV2NPV();
-  EXPECT_EQ(0, np_variant_.value.intValue);
-
-  variant_ = kint32min;
-  TestV2NPV();
-  EXPECT_EQ(kint32min, np_variant_.value.intValue);
-}
-
-TEST_F(VariantUtilsTest, VariantToNPVariant_VT_UI4) {
-  variant_ = 0U;
-  TestV2NPV();
-  EXPECT_EQ(0, np_variant_.value.intValue);
-
-  variant_ = static_cast<uint32>(kint32max);
-  TestV2NPV();
-  EXPECT_EQ(kint32max, np_variant_.value.intValue);
-
-  // MSIE can natively support VT_UI4. Unfortunately, Firefox cannot.
-  // Check that kuint32max wraps around to -1.
-  variant_ = kuint32max;
-  TestV2NPV();
-  EXPECT_EQ(-1, np_variant_.value.intValue);
-}
-
-TEST_F(VariantUtilsTest, VariantToNPVariant_VT_R8) {
-  variant_ = 0.0;
-  TestV2NPV();
-  EXPECT_DOUBLE_EQ(0.0, np_variant_.value.doubleValue);
-
-  variant_ = -1.0;
-  TestV2NPV();
-  EXPECT_DOUBLE_EQ(-1.0, np_variant_.value.doubleValue);
-
-  variant_ = static_cast<double>(kuint64max);
-  TestV2NPV();
-  EXPECT_DOUBLE_EQ(static_cast<double>(kuint64max),
-                   np_variant_.value.doubleValue);
-}
-
-TEST_F(VariantUtilsTest, VariantToNPVariant_VT_BSTR) {
-  variant_ = "";
-  TestV2NPV();
-  EXPECT_STREQ("", np_variant_.value.stringValue.UTF8Characters);
-
-  variant_ = L"sudo make me a sandwich";
-  TestV2NPV();
-  EXPECT_STREQ("sudo make me a sandwich",
-               np_variant_.value.stringValue.UTF8Characters);
-
-  // A NULL BSTR should be treated as an empty string.
-  V_VT(&variant_) = VT_BSTR;
-  V_BSTR(&variant_) = NULL;
-  TestV2NPV();
-  EXPECT_STREQ("", np_variant_.value.stringValue.UTF8Characters);
-
-  // Check that VariantToNPVariant properly converts UTF-16 to UTF-8.
-  variant_ = L"one: \x4e00";
-  TestV2NPV();
-  EXPECT_STREQ("one: \xe4\xb8\x80",
-               np_variant_.value.stringValue.UTF8Characters);
-}
-
-TEST_F(VariantUtilsTest, VariantToNPVariant_VT_DISPATCH) {
-  CComPtr<IDispatch> dispatch;
-  ASSERT_SUCCEEDED(
-      CComCoClass<DispatchHostTestInterface>::CreateInstance(&dispatch));
-  variant_ = dispatch;
-  TestV2NPV();
-
-  // Check that the wrapped object's methods can be called.
-  NPIdentifierFactory identifier;
-  NPVariant result;
-  VOID_TO_NPVARIANT(result);
-  EXPECT_TRUE(NPN_Invoke(NULL, np_variant_.value.objectValue,
-                         identifier.Create("Random"), NULL, 0, &result));
-  EXPECT_TRUE(NPVARIANT_IS_INT32(result));
-  EXPECT_EQ(42, result.value.intValue);
-}
-
-TEST_F(VariantUtilsTest, VariantToNPVariant_Unsupported) {
-  // Legal variant types inferred from oaidl.idl and wtypes.h. Note that some
-  // types that aren't marked as appearing in VARIANTs still have a VARIANT
-  // field for that type, so they are included anyway...
-
-  // Note that VT_UNKNOWN must not be the last element in the array; otherwise
-  // CComVariant will attempt to call Release() on a NULL pointer.
-  const VARTYPE kUnsupportedSimpleTypes[] = {
-    VT_I2, VT_R4, VT_CY, VT_DATE, VT_ERROR, VT_VARIANT, VT_UNKNOWN, VT_DECIMAL,
-    VT_RECORD, VT_I1, VT_UI1, VT_UI2, VT_I8, VT_UI8, VT_INT, VT_UINT, VT_BYREF
-  };
-  for (int i = 0; i < arraysize(kUnsupportedSimpleTypes); ++i) {
-    ExpectAsserts expect_asserts;
-    V_VT(&variant_) = kUnsupportedSimpleTypes[i];
-    INT32_TO_NPVARIANT(42, np_variant_);
-    TestV2NPV();
-    EXPECT_TRUE(NPVARIANT_IS_VOID(np_variant_));
-  }
-
-  // Compound modifiers.
-  const VARTYPE kCompoundModifiers[] = {
-    VT_ARRAY, VT_BYREF, VT_ARRAY | VT_BYREF
-  };
-  // Compound types.
-  const VARTYPE kCompoundableTypes[] = {
-    VT_I2, VT_I4, VT_R4, VT_R8, VT_CY, VT_DATE, VT_BSTR, VT_DISPATCH, VT_ERROR,
-    VT_BOOL, VT_VARIANT, VT_UNKNOWN, VT_DECIMAL, VT_RECORD, VT_I1, VT_UI1,
-    VT_UI2, VT_UI4, VT_I8, VT_UI8, VT_INT, VT_UINT
-  };
-
-  for (int i = 0; i < arraysize(kCompoundModifiers); ++i) {
-    for (int j = 0; j < arraysize(kCompoundableTypes); ++j) {
-      ExpectAsserts expect_asserts;
-      V_VT(&variant_) = kCompoundModifiers[i] | kCompoundableTypes[j];
-      INT32_TO_NPVARIANT(42, np_variant_);
-      TestV2NPV();
-      EXPECT_TRUE(NPVARIANT_IS_VOID(np_variant_));
-    }
-  }
-}
-
-}  // namespace omaha
diff --git a/plugins/update/omaha_customization_update_apis_unittest.cc b/plugins/update/omaha_customization_update_apis_unittest.cc
deleted file mode 100644
index 11e7749..0000000
--- a/plugins/update/omaha_customization_update_apis_unittest.cc
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Tests the constants that vary depending on the customization of Omaha.
-// The test checks for the Google Update variations, but can be modified for
-// your purposes.
-
-#include <windows.h>
-#include <tchar.h>
-#include <atlbase.h>
-#include <oleauto.h>
-#include "omaha/base/utils.h"
-#include "plugins/update/activex/update_control_idl.h"
-#include "omaha/testing/omaha_customization_test.h"
-
-// Most of the tests are intentionally not using the omaha namespace. Most of
-// the values being tested are not in this namespace, and being in the global
-// namespace is required by TEST_GU_INT_F to catch conflicts with Google types
-// when building non-Google versions.
-
-class OmahaCustomizationUpdateComInterfaceTest
-    : public OmahaCustomizationTypeLibComInterfaceTest {
- protected:
-  OmahaCustomizationUpdateComInterfaceTest()
-      : OmahaCustomizationTypeLibComInterfaceTest(UPDATE_PLUGIN_FILENAME) {
-  }
-};
-
-TEST_F(OmahaCustomizationUpdateComInterfaceTest, TypeLib) {
-  EXPECT_GU_ID_EQ(_T("{b627c883-e979-4873-80b3-ddd0b658b56a}"),
-                  LIBID_GoogleUpdateControlLib);
-
-  EXPECT_SUCCEEDED(GetDocumentation(-1));
-  EXPECT_STREQ(_T("GoogleUpdateControlLib"), item_name_);
-  EXPECT_GU_STREQ(_T("Google Update Browser Plugins 3.0 Type Library"),
-                  item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationUpdateComInterfaceTest,
-              IGoogleUpdateOneClick) {
-  // TODO(omaha): Test uuid constants after extracting from IDLs.
-  EXPECT_GU_ID_EQ(_T("{6F65D62B-2F32-4483-9028-176C30B2389D}"),
-                  __uuidof(IGoogleUpdateOneClick));
-
-  EXPECT_SUCCEEDED(GetDocumentation(0));
-  EXPECT_STREQ(_T("IGoogleUpdateOneClick"), item_name_);
-  EXPECT_STREQ(_T("Google Update OneClick Control"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationUpdateComInterfaceTest,
-              IGoogleUpdate3WebControl) {
-  // TODO(omaha): Test uuid constants after extracting from IDLs.
-  EXPECT_GU_ID_EQ(_T("{57E37502-65A5-484a-A035-C1608B2626EA}"),
-                  __uuidof(IGoogleUpdate3WebControl));
-
-  EXPECT_SUCCEEDED(GetDocumentation(1));
-  EXPECT_STREQ(_T("IGoogleUpdate3WebControl"), item_name_);
-  EXPECT_STREQ(_T("GoogleUpdate3Web Control"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationUpdateComInterfaceTest,
-              GoogleUpdateOneClickControlCoClass) {
-  EXPECT_GU_ID_EQ(_T("{c442ac41-9200-4770-8cc0-7cdb4f245c55}"),
-                  __uuidof(GoogleUpdateOneClickControlCoClass));
-
-  EXPECT_SUCCEEDED(GetDocumentation(2));
-  EXPECT_STREQ(_T("GoogleUpdateOneClickControlCoClass"), item_name_);
-  EXPECT_STREQ(_T("Google Update OneClick Control Class"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-TEST_GU_INT_F(OmahaCustomizationUpdateComInterfaceTest,
-              GoogleUpdate3WebControlCoClass) {
-  EXPECT_GU_ID_EQ(_T("{c3101a8b-0ee1-4612-bfe9-41ffc1a3c19d}"),
-                  __uuidof(GoogleUpdate3WebControlCoClass));
-
-  EXPECT_SUCCEEDED(GetDocumentation(3));
-  EXPECT_STREQ(_T("GoogleUpdate3WebControlCoClass"), item_name_);
-  EXPECT_STREQ(_T("GoogleUpdate3Web Control Class"), item_doc_string_);
-  EXPECT_EQ(0, help_context_);
-  EXPECT_TRUE(!help_file_);
-}
-
-// Verifies there are no new interfaces in the TypeLib.
-TEST_F(OmahaCustomizationUpdateComInterfaceTest, VerifyNoNewInterfaces) {
-  EXPECT_EQ(TYPE_E_ELEMENTNOTFOUND, GetDocumentation(4))
-      << _T("A new interface may have been added. If so, roll ")
-      << _T("the plugin version and add test(s) for new interface(s).");
-}
diff --git a/plugins/update/omaha_customization_update_unittest.cc b/plugins/update/omaha_customization_update_unittest.cc
deleted file mode 100644
index fe7fd01..0000000
--- a/plugins/update/omaha_customization_update_unittest.cc
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Tests the constants that vary depending on the customization of Omaha.
-// The test checks for the Google Update variations, but can be modified for
-// your purposes.
-
-#include "omaha/plugins/update/config.h"
-#include "omaha/testing/omaha_customization_test.h"
-
-namespace omaha {
-
-TEST(OmahaCustomizationUpdateTest, Constants_BuildFiles) {
-// The plugin version may or may not match in non-Google Update builds.
-#ifdef GOOGLE_UPDATE_BUILD
-  EXPECT_STREQ(_T("3"), kUpdate3WebPluginVersion);
-  EXPECT_STREQ(_T("9"), kOneclickPluginVersion);
-#else
-  std::wcout << _T("Did not test kPluginVersions.") << std::endl;
-#endif
-
-  EXPECT_GU_STREQ(
-      _T("Google.Update3WebControl.") _T(UPDATE_PLUGIN_VERSION_ANSI),
-      kUpdate3WebControlProgId);
-  EXPECT_GU_STREQ(
-      _T("Google.OneClickCtrl.") _T(ONECLICK_PLUGIN_VERSION_ANSI),
-      kOneclickControlProgId);
-}
-
-}  // namespace omaha
diff --git a/plugins/update/oneclick.rgs b/plugins/update/oneclick.rgs
deleted file mode 100644
index 5958f43..0000000
--- a/plugins/update/oneclick.rgs
+++ /dev/null
@@ -1,97 +0,0 @@
-'%HKROOT%'
-{
-  NoRemove SOFTWARE
-  {
-    NoRemove MozillaPlugins
-    {
-      ForceRemove '@%PLUGINDOMAIN%/%PLUGINPRODUCT%;version=%PLUGINVERSION%'
-      {
-        val Path = s '%MODULE%'
-        val Description = s '%PLUGINDESCRIPTION%'
-        val ProductName = s '%PLUGINPRODUCT%'
-        val Vendor = s '%PLUGINVENDOR%'
-        val Version = s '%PLUGINVERSION%'
-        MimeTypes
-        {
-          '%PLUGINMIMETYPE%'
-        }
-      }
-    }
-    NoRemove Microsoft
-    {
-      NoRemove Windows
-      {
-        NoRemove CurrentVersion
-        {
-          NoRemove Ext
-          {
-            NoRemove PreApproved
-            {
-              ForceRemove '%CLSID%'
-            }
-            NoRemove Stats
-            {
-              ForceRemove '%CLSID%'
-              {
-                iexplore
-                {
-                  AllowedDomains
-                  {
-                    '*'
-                  }
-                }
-              }
-            }
-          }
-        }
-      }
-      NoRemove 'Internet Explorer'
-      {
-        NoRemove 'Low Rights'
-        {
-          NoRemove 'ElevationPolicy'
-          {
-            ForceRemove '%CLSID%'
-            {
-              val AppName = s '%SHELLNAME%'
-              val AppPath = s '%SHELLPATH%'
-              val Policy = d '3'
-            }
-          }
-        }
-      }
-    }
-    NoRemove Classes
-    {
-      ForceRemove '%PROGID%' = s '%PLUGINPRODUCT% Plugin'
-      {
-        CLSID = s '%CLSID%'
-      }
-      NoRemove CLSID
-      {
-        ForceRemove '%CLSID%' = s '%PLUGINPRODUCT% Plugin'
-        {
-          ProgID = s '%PROGID%'
-          InprocServer32 = s '%MODULE%'
-          {
-            val ThreadingModel = s 'Apartment'
-          }
-        }
-      }
-      NoRemove MIME
-      {
-        NoRemove Database
-        {
-          NoRemove 'Content Type'
-          {
-            ForceRemove '%PLUGINMIMETYPE%'
-            {
-              val CLSID = s '%CLSID%'
-            }
-          }
-        }
-      }
-    }
-  }
-}
-
diff --git a/plugins/update/resource.h b/plugins/update/resource.h
deleted file mode 100644
index 583ea9d..0000000
--- a/plugins/update/resource.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_PLUGINS_UPDATE_RESOURCE_H_
-#define OMAHA_PLUGINS_UPDATE_RESOURCE_H_
-
-#define IDR_ONECLICK_RGS                        102
-
-#endif  // OMAHA_PLUGINS_UPDATE_RESOURCE_H_
diff --git a/plugins/update/resource.rc b/plugins/update/resource.rc
deleted file mode 100644
index 6c4f72f..0000000
--- a/plugins/update/resource.rc
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// These include headers with absolute paths, which Resource Editor cannot load.
-#ifndef APSTUDIO_INVOKED
-#include "omaha/base/const_config.h"
-#include "omaha/plugins/update/config.h"
-#include "omaha/plugins/update/resource.h"
-#endif  // APSTUDIO_INVOKED
-
-#define PLUGIN_FILENAME UPDATE_PLUGIN_FILENAME
-#include "../plugin_version.rc"
-
-// Path is in the obj directory, which Resource Editor does not look in.
-#ifndef APSTUDIO_INVOKED
-1 TYPELIB "plugins/update/activex/update_control_idl.tlb"
-#endif  // APSTUDIO_INVOKED
-
-IDR_ONECLICK_RGS               REGISTRY "oneclick.rgs"
-
diff --git a/plugins/update/site_lock.cc b/plugins/update/site_lock.cc
deleted file mode 100644
index 973aa3c..0000000
--- a/plugins/update/site_lock.cc
+++ /dev/null
@@ -1,206 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/plugins/update/site_lock.h"
-#include <wininet.h>
-#include <shlobj.h>
-#include "base/scoped_ptr.h"
-#include "omaha/base/atl_regexp.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/error.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/plugins/update/npapi/urlpropbag.h"
-
-namespace omaha {
-
-SiteLock::SiteLock() {
-  for (int i = 0; i < arraysize(kSiteLockPatternStrings); ++i) {
-    VERIFY1(AddPattern(kSiteLockPatternStrings[i]));
-  }
-
-  // TODO(omaha): should this be wrapped in a #ifdef DEBUG?
-  CString dev_pattern_string;
-  if (SUCCEEDED(RegKey::GetValue(MACHINE_REG_UPDATE_DEV,
-                                 kRegValueOneClickHostPattern,
-                                 &dev_pattern_string)) &&
-      !dev_pattern_string.IsEmpty()) {
-    VERIFY1(AddPattern(dev_pattern_string));
-  }
-}
-
-SiteLock::~SiteLock() {
-  for (size_t i = 0; i < patterns_.size(); ++i) {
-    delete patterns_[i];
-  }
-}
-
-bool SiteLock::InApprovedDomain(IObjectWithSite* plugin) {
-  CString url;
-  if (FAILED(GetCurrentBrowserUrl(plugin, &url))) {
-    return false;
-  }
-  return InApprovedDomain(url);
-}
-
-bool SiteLock::InApprovedDomain(const WCHAR* url) {
-  // TODO(omaha): investigate using CUrl to remove dependency on wininet
-  URL_COMPONENTS components = {sizeof(components)};
-  components.dwHostNameLength = 1;
-  if (!::InternetCrackUrl(url, 0, 0, &components)) {
-    return false;
-  }
-  CString hostname(components.lpszHostName, components.dwHostNameLength);
-  for (std::vector<AtlRegExp*>::const_iterator it = patterns_.begin();
-       it != patterns_.end();
-       ++it) {
-    AtlMatchContext context;
-    if ((*it)->Match(hostname, &context)) {
-      return true;
-    }
-  }
-
-  return false;
-}
-
-HRESULT SiteLock::GetCurrentBrowserUrl(IObjectWithSite* plugin, CString* url) {
-  if (SUCCEEDED(ExtractUrlFromBrowser(plugin, url))) {
-    return S_OK;
-  }
-  if (SUCCEEDED(ExtractUrlFromPropBag(plugin, url))) {
-    return S_OK;
-  }
-  return E_FAIL;
-}
-
-// TODO(omaha): Move this to common\webplugin_utils.
-HRESULT SiteLock::GetUrlDomain(const CString& url, CString* url_domain) {
-  ASSERT1(url_domain);
-  url_domain->Empty();
-
-  URL_COMPONENTS urlComponents = {0};
-  urlComponents.dwStructSize = sizeof(urlComponents);
-  urlComponents.dwSchemeLength = 1;
-  urlComponents.dwHostNameLength = 1;
-  if (!::InternetCrackUrl(url, 0, 0, &urlComponents)) {
-    HRESULT hr = HRESULTFromLastError();
-    CORE_LOG(L2, (_T("[InternetCrackUrl failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  CString scheme(urlComponents.lpszScheme, urlComponents.dwSchemeLength);
-  CString host_name(urlComponents.lpszHostName, urlComponents.dwHostNameLength);
-  ASSERT1(!scheme.IsEmpty());
-  ASSERT1(!host_name.IsEmpty());
-
-  SafeCStringFormat(url_domain, _T("%s://%s/"), scheme, host_name);
-  return S_OK;
-}
-
-bool SiteLock::AddPattern(const WCHAR* pattern) {
-  ASSERT1(pattern);
-
-  // An empty pattern will match everything...
-  if (!*pattern) {
-    ASSERT1(false);
-    return false;
-  }
-
-  scoped_ptr<AtlRegExp> re(new AtlRegExp);
-  REParseError error = re->Parse(pattern);
-  if (REPARSE_ERROR_OK != error) {
-    ASSERT(false, (L"Failed to parse site lock pattern: %s",
-                   pattern));
-    return false;
-  }
-  patterns_.push_back(re.release());
-  return true;
-}
-
-// If the plugin is being hosted inside an NPAPI environment, NPUpdate will set
-// a UrlPropertyBag object as our object site.  Fetch the URL used to create
-// our object from it.
-HRESULT SiteLock::ExtractUrlFromPropBag(IObjectWithSite* plugin, CString* url) {
-  ASSERT1(plugin);
-  ASSERT1(url);
-
-  CComPtr<IPropertyBag> property_bag;
-  HRESULT hr = plugin->GetSite(IID_PPV_ARGS(&property_bag));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CComVariant var;
-  hr = property_bag->Read(kUrlPropertyBag_Url, &var, NULL);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  if (var.vt != VT_BSTR || !var.bstrVal) {
-    return E_UNEXPECTED;
-  }
-  *url = var.bstrVal;
-  return S_OK;
-}
-
-// If the plugin is hosted in an ActiveX environment, IE will set itself as the
-// object site.  Fetch the current URL from it.
-HRESULT SiteLock::ExtractUrlFromBrowser(IObjectWithSite* plugin, CString* url) {
-  ASSERT1(plugin);
-  ASSERT1(url);
-
-  CComPtr<IServiceProvider> service_provider;
-  HRESULT hr = plugin->GetSite(IID_PPV_ARGS(&service_provider));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CComPtr<IWebBrowser2> web_browser;
-  hr = service_provider->QueryService(SID_SWebBrowserApp,
-                                      IID_PPV_ARGS(&web_browser));
-
-  CComBSTR bstr_url;
-  if (SUCCEEDED(hr)) {
-    hr = web_browser->get_LocationURL(&bstr_url);
-  } else {
-    // Do things the hard way...
-    CComPtr<IOleClientSite> client_site;
-    hr = plugin->GetSite(IID_PPV_ARGS(&client_site));
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    CComPtr<IOleContainer> container;
-    hr = client_site->GetContainer(&container);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    CComPtr<IHTMLDocument2> html_document;
-    hr = container.QueryInterface(&html_document);
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    hr = html_document->get_URL(&bstr_url);
-  }
-
-  if (SUCCEEDED(hr)) {
-    *url = bstr_url;
-  }
-
-  return hr;
-}
-
-}  // namespace omaha
diff --git a/plugins/update/site_lock.h b/plugins/update/site_lock.h
deleted file mode 100644
index e92a8d0..0000000
--- a/plugins/update/site_lock.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_PLUGINS_UPDATE_SITE_LOCK_H_
-#define OMAHA_PLUGINS_UPDATE_SITE_LOCK_H_
-
-#include <tchar.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "omaha/base/atl_regexp.h"
-
-namespace omaha {
-
-class SiteLock {
- public:
-  SiteLock();
-  ~SiteLock();
-
-  bool InApprovedDomain(IObjectWithSite* url_provider);
-  bool InApprovedDomain(const WCHAR* url);
-
-  static HRESULT GetCurrentBrowserUrl(IObjectWithSite* plugin, CString* url);
-  static HRESULT GetUrlDomain(const CString& url, CString* url_domain);
-
- private:
-  bool AddPattern(const WCHAR* pattern);
-
-  static HRESULT ExtractUrlFromBrowser(IObjectWithSite* plugin, CString* url);
-  static HRESULT ExtractUrlFromPropBag(IObjectWithSite* plugin, CString* url);
-
-  std::vector<AtlRegExp*> patterns_;
-
-  DISALLOW_COPY_AND_ASSIGN(SiteLock);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_PLUGINS_UPDATE_SITE_LOCK_H_
diff --git a/plugins/update/site_lock_unittest.cc b/plugins/update/site_lock_unittest.cc
deleted file mode 100644
index 6872999..0000000
--- a/plugins/update/site_lock_unittest.cc
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/plugins/update/site_lock.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-class SiteLockTest : public testing::Test {
- protected:
-  SiteLock site_lock_;
-};
-
-TEST_F(SiteLockTest, InApprovedDomain_GoogleDotCom) {
-  EXPECT_TRUE(site_lock_.InApprovedDomain(L"http://www.google.com/"));
-  EXPECT_TRUE(site_lock_.InApprovedDomain(L"http://www.google.com/pack/"));
-  EXPECT_TRUE(site_lock_.InApprovedDomain(L"http://www.google.co.uk"));
-}
-TEST_F(SiteLockTest, InApprovedDomain_EvilHackerDotCom) {
-  EXPECT_FALSE(site_lock_.InApprovedDomain(L"http://www.evilhacker.com/"));
-}
-
-}  // namespace omaha
diff --git a/precompile/precompile.cc b/precompile/precompile.cc
deleted file mode 100644
index a108af7..0000000
--- a/precompile/precompile.cc
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// 4505: unreferenced local function has been removed
-#pragma warning(disable : 4505)
-
diff --git a/precompile/precompile.h b/precompile/precompile.h
deleted file mode 100644
index 208242c..0000000
--- a/precompile/precompile.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_PRECOMPILE_PRECOMPILE_H__
-#define OMAHA_PRECOMPILE_PRECOMPILE_H__
-
-// 'function': name was marked as #pragma deprecated
-#pragma warning(disable : 4995)
-
-#pragma warning(push)
-// C4201: nonstandard extension used : nameless struct/union
-#pragma warning(disable : 4201)
-#include <windows.h>
-#include <winioctl.h>
-#include <wtypes.h>
-#include <tchar.h>
-#include <strsafe.h>
-
-#include "omaha/base/atlassert.h"   // Redefines ATLASSERT.
-
-// C4061: enumerate is not explicitly handled by a case label
-// C4265: class has virtual functions, but destructor is not virtual
-// C4510: default constructor could not be generated
-// C4548: expression before comma has no effect
-// C4610: struct can never be instantiated - user defined constructor required
-// C4826: conversion from 'type1 ' to 'type_2' is sign-extended
-#pragma warning(disable : 4061 4265 4510 4610 4548 4826)
-#include <atlbase.h>
-#include <atlstr.h>
-#include <atlcoll.h>
-#include <atlcom.h>
-#include <atlhost.h>
-#include <atlrx.h>
-#include <atlsecurity.h>
-#include <atltypes.h>
-#include <atlwin.h>
-#include <algorithm>
-#include <cstdlib>
-#include <list>
-#include <map>
-#include <queue>
-#include <string>
-#include <vector>
-#pragma warning(pop)
-
-#if (_MSC_VER < 1400)
-// TODO(omaha): fix the atlconv for VC8.
-#include "omaha/base/atlconvfix.h"
-#endif
-
-#pragma warning(push)
-// C4310: cast truncates constant value
-#pragma warning(disable : 4310)
-#include "base/basictypes.h"
-#pragma warning(pop)
-
-#include "omaha/third_party/gtest/include/gtest/gtest.h"
-
-#endif  // OMAHA_PRECOMPILE_PRECOMPILE_H__
diff --git a/recovery/build.scons b/recovery/build.scons
deleted file mode 100644
index e303456..0000000
--- a/recovery/build.scons
+++ /dev/null
@@ -1,99 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-
-Import('env')
-
-#
-# Build google_update_recovery library for Google app consumption.
-#
-rec_env = env.Clone(COMPONENT_LIBRARY_PUBLISH=True)
-recovery_inputs = [
-    'client/google_update_recovery.cc',
-    '../base/signaturevalidator.cc',
-    ]
-
-# Need to add custom suffix to avoid target conflict with
-# common/signaturevalidator.obj
-rec_env['OBJSUFFIX'] = '_rec' + rec_env['OBJSUFFIX']
-
-rec_env.ComponentLibrary('google_update_recovery', recovery_inputs)
-
-# Save the header to the main build directory, so we have it saved with each
-# official build. The lib is already published to this directory.
-rec_env.Replicate('$STAGING_DIR',
-                  '$MAIN_DIR/recovery/client/google_update_recovery.h')
-
-
-#
-# Build the test
-#
-# TODO(omaha3): Switch entirely to hammer running tests. For now, we must make
-# the test not runnable because it will be run during the build. See main.scons.
-import os
-if 'HAMMER_RUNS_TESTS' in os.environ.keys():
-  test_env = env.Clone()
-else:
-  test_env = env.Clone(COMPONENT_TEST_RUNNABLE=False)
-
-# This is a console application.
-test_env.FilterOut(LINKFLAGS = ['/SUBSYSTEM:WINDOWS'])
-test_env['LINKFLAGS'] += ['/SUBSYSTEM:CONSOLE']
-
-test_env.Append(
-    LIBS = [
-        '$LIB_DIR/base.lib',
-        '$LIB_DIR/net.lib',
-        '$LIB_DIR/common.lib',
-        '$LIB_DIR/google_update_recovery.lib',
-        '$LIB_DIR/security.lib',
-        ('atls.lib', 'atlsd.lib')[test_env.Bit('debug')],
-        ('libcmt.lib', 'libcmtd.lib')[test_env.Bit('debug')],
-        ('libcpmt.lib', 'libcpmtd.lib')[test_env.Bit('debug')],
-        'crypt32.lib',
-        'wintrust.lib',
-
-        # These are required by base.lib
-        'netapi32.lib',
-        'psapi.lib',
-        'rasapi32.lib',
-        'shlwapi.lib',
-        'userenv.lib',
-        'version.lib',
-        'wtsapi32.lib',
-
-        # net
-        'iphlpapi.lib',
-        ],
-)
-
-target_name = 'RecoveryTest'
-
-test_inputs = [
-    'recovery_test.cc',
-    ]
-if env.Bit('use_precompiled_headers'):
-  test_inputs += test_env.EnablePrecompile(target_name)
-
-# TODO(omaha): This test asserts when run so we cannot include it in
-# run_all_tests. Fix it and consider adding to run_all_tests.
-test_env.ComponentTestProgram(target_name,
-                              test_inputs,
-                              COMPONENT_TEST_DISABLED=True)
-
-
-env.BuildSConscript('repair_exe')
diff --git a/recovery/client/google_update_recovery.cc b/recovery/client/google_update_recovery.cc
deleted file mode 100644
index 93a7fa8..0000000
--- a/recovery/client/google_update_recovery.cc
+++ /dev/null
@@ -1,626 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-//
-// Implementation of the Google Update recovery mechanism to be included in
-// Google apps.
-
-#include "omaha/recovery/client/google_update_recovery.h"
-#include <shellapi.h>
-#include <wininet.h>
-#include <atlstr.h>
-#include "omaha/base/const_addresses.h"
-#include "omaha/base/signaturevalidator.h"
-#include "omaha/common/const_group_policy.h"
-#include "omaha/third_party/smartany/scoped_any.h"
-
-namespace omaha {
-
-namespace {
-
-const int kRollbackWindowDays = 100;
-
-const TCHAR* const kMachineRepairArgs = _T("/recover /machine");
-const TCHAR* const kUserRepairArgs = _T("/recover");
-
-// TODO(omaha): Add a Code Red lib version that is manually updated when
-// we check in the lib.
-const TCHAR* const kQueryStringFormat =
-    _T("?appid=%s&appversion=%s&applang=%s&machine=%u")
-    _T("&version=%s&osversion=%s&servicepack=%s");
-
-// Information about where to obtain Omaha info.
-// This must never change in Omaha.
-const TCHAR* const kRegValueProductVersion  = _T("pv");
-const TCHAR* const kRelativeGoopdateRegPath = _T("Software\\Google\\Update\\");
-const TCHAR* const kRelativeClientsGoopdateRegPath =
-    _T("Software\\Google\\Update\\Clients\\")
-    _T("{430FD4D0-B729-4F61-AA34-91526481799D}");
-
-// The UpdateDev registry value to override the Code Red url.
-const TCHAR* const kRegValueNameCodeRedUrl = _T("CodeRedUrl");
-
-// Starts another process via ::CreateProcess.
-HRESULT StartProcess(const TCHAR* process_name, TCHAR* command_line) {
-  if (!process_name && !command_line) {
-    return E_INVALIDARG;
-  }
-
-  PROCESS_INFORMATION pi = {0};
-  STARTUPINFO si = {sizeof(si), 0};
-
-  // Feedback cursor is off while the process is starting.
-  si.dwFlags = STARTF_FORCEOFFFEEDBACK;
-
-  BOOL success = ::CreateProcess(
-      process_name,     // Module name
-      command_line,     // Command line
-      NULL,             // Process handle not inheritable
-      NULL,             // Thread handle not inheritable
-      FALSE,            // Set handle inheritance to FALSE
-      0,                // No creation flags
-      NULL,             // Use parent's environment block
-      NULL,             // Use parent's starting directory
-      &si,              // Pointer to STARTUPINFO structure
-      &pi);             // Pointer to PROCESS_INFORMATION structure
-
-  if (!success) {
-    return HRESULT_FROM_WIN32(::GetLastError());
-  }
-
-  ::CloseHandle(pi.hProcess);
-  ::CloseHandle(pi.hThread);
-
-  return S_OK;
-}
-
-// Check if a string starts with another string. Case-sensitive.
-bool StringStartsWith(const TCHAR *str, const TCHAR *start_str) {
-  if (!start_str || !str) {
-    return false;
-  }
-
-  while (0 != *str) {
-    // Check for matching characters
-    TCHAR c1 = *str;
-    TCHAR c2 = *start_str;
-
-    // Reached the end of start_str?
-    if (0 == c2)
-      return true;
-
-    if (c1 != c2)
-      return false;
-
-    ++str;
-    ++start_str;
-  }
-
-  // If str is shorter than start_str, no match.  If equal size, match.
-  return 0 == *start_str;
-}
-
-// Escape and unescape strings (shlwapi-based implementation).
-// The intended usage for these APIs is escaping strings to make up
-// URLs, for example building query strings.
-//
-// Pass false to the flag segment_only to escape the url. This will not
-// cause the conversion of the # (%23), ? (%3F), and / (%2F) characters.
-
-// Characters that must be encoded include any characters that have no
-// corresponding graphic character in the US-ASCII coded character
-// set (hexadecimal 80-FF, which are not used in the US-ASCII coded character
-// set, and hexadecimal 00-1F and 7F, which are control characters),
-// blank spaces, "%" (which is used to encode other characters),
-// and unsafe characters (<, >, ", #, {, }, |, \, ^, ~, [, ], and ').
-//
-// The input and output strings can't be longer than INTERNET_MAX_URL_LENGTH
-
-HRESULT StringEscape(const CString& str_in,
-                     bool segment_only,
-                     CString* escaped_string) {
-  if (!escaped_string) {
-    return E_INVALIDARG;
-  }
-
-  DWORD buf_len = INTERNET_MAX_URL_LENGTH + 1;
-  HRESULT hr = ::UrlEscape(str_in,
-                           escaped_string->GetBufferSetLength(buf_len),
-                           &buf_len,
-                           segment_only ?
-                           URL_ESCAPE_PERCENT | URL_ESCAPE_SEGMENT_ONLY :
-                           URL_ESCAPE_PERCENT);
-  if (SUCCEEDED(hr)) {
-    escaped_string->ReleaseBuffer();
-  }
-  return hr;
-}
-
-// Gets the temporary files directory for the current user.
-// The directory returned may not exist.
-// The returned path ends with a '\'.
-// Fails if the path is longer than MAX_PATH.
-HRESULT GetTempDir(CString* temp_path) {
-  if (!temp_path) {
-    return E_INVALIDARG;
-  }
-
-  temp_path->Empty();
-
-  TCHAR buffer[MAX_PATH] = {0};
-  DWORD num_chars = ::GetTempPath(MAX_PATH, buffer);
-  if (!num_chars) {
-    return HRESULT_FROM_WIN32(::GetLastError());
-  } else if (num_chars >= MAX_PATH) {
-    return E_FAIL;
-  }
-
-  *temp_path = buffer;
-  return S_OK;
-}
-
-// Creates the specified directory.
-HRESULT CreateDir(const CString& dir) {
-  if (!::CreateDirectory(dir, NULL)) {
-    DWORD error = ::GetLastError();
-    if (ERROR_FILE_EXISTS != error && ERROR_ALREADY_EXISTS != error) {
-      return HRESULT_FROM_WIN32(error);
-    }
-  }
-  return S_OK;
-}
-
-HRESULT GetAndCreateTempDir(CString* temp_path) {
-  if (!temp_path) {
-    return E_INVALIDARG;
-  }
-
-  HRESULT hr = GetTempDir(temp_path);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  if (temp_path->IsEmpty()) {
-    return E_FAIL;
-  }
-
-  // Create this dir if it doesn't already exist.
-  return CreateDir(*temp_path);
-}
-
-
-// Create a unique temporary file and returns the full path.
-HRESULT CreateUniqueTempFile(const CString& user_temp_dir,
-                             CString* unique_temp_file_path) {
-  if (user_temp_dir.IsEmpty() || !unique_temp_file_path) {
-    return E_INVALIDARG;
-  }
-
-  TCHAR unique_temp_filename[MAX_PATH] = {0};
-  if (!::GetTempFileName(user_temp_dir,
-                         _T("GUR"),  // prefix
-                         0,          // form a unique filename
-                         unique_temp_filename)) {
-    return HRESULT_FROM_WIN32(::GetLastError());
-  }
-
-  *unique_temp_file_path = unique_temp_filename;
-  if (unique_temp_file_path->IsEmpty()) {
-    return E_FAIL;
-  }
-
-  return S_OK;
-}
-
-// Obtains the OS version and service pack.
-HRESULT GetOSInfo(CString* os_version, CString* service_pack) {
-  if (!os_version || !service_pack) {
-    return E_INVALIDARG;
-  }
-
-  OSVERSIONINFO os_version_info = { 0 };
-  os_version_info.dwOSVersionInfoSize = sizeof(os_version_info);
-  if (!::GetVersionEx(&os_version_info)) {
-    HRESULT hr = HRESULT_FROM_WIN32(::GetLastError());
-    return hr;
-  } else {
-    os_version->Format(_T("%d.%d"),
-                       os_version_info.dwMajorVersion,
-                       os_version_info.dwMinorVersion);
-    *service_pack = os_version_info.szCSDVersion;
-  }
-  return S_OK;
-}
-
-// Reads the specified string value from the specified registry key.
-// Only supports value types REG_SZ and REG_EXPAND_SZ.
-// REG_EXPAND_SZ strings are not expanded.
-HRESULT GetRegStringValue(bool is_machine_key,
-                          const CString& relative_key_path,
-                          const CString& value_name,
-                          CString* value) {
-  if (!value) {
-    return E_INVALIDARG;
-  }
-
-  value->Empty();
-  HKEY root_key = is_machine_key ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
-  HKEY key = NULL;
-  LONG res = ::RegOpenKeyEx(root_key, relative_key_path, 0, KEY_READ, &key);
-  if (res != ERROR_SUCCESS) {
-    return HRESULT_FROM_WIN32(res);
-  }
-
-  // First get the size of the string buffer.
-  DWORD type = 0;
-  DWORD byte_count = 0;
-  res = ::RegQueryValueEx(key, value_name, NULL, &type, NULL, &byte_count);
-  if (ERROR_SUCCESS != res) {
-    ::RegCloseKey(key);
-    return HRESULT_FROM_WIN32(res);
-  }
-  if ((type != REG_SZ && type != REG_EXPAND_SZ) || (0 == byte_count)) {
-    ::RegCloseKey(key);
-    return HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
-  }
-
-  CString local_value;
-  // GetBuffer throws when not able to allocate the requested buffer.
-  TCHAR* buffer = local_value.GetBuffer(byte_count / sizeof(TCHAR));
-  res = ::RegQueryValueEx(key,
-                          value_name,
-                          NULL,
-                          NULL,
-                          reinterpret_cast<BYTE*>(buffer),
-                          &byte_count);
-  ::RegCloseKey(key);
-  if (ERROR_SUCCESS == res) {
-    local_value.ReleaseBufferSetLength(byte_count / sizeof(TCHAR));
-    *value = local_value;
-  }
-
-  return HRESULT_FROM_WIN32(res);
-}
-
-// Reads the specified DWORD value from the specified registry key.
-// Only supports value types REG_DWORD.
-// Assumes DWORD is sufficient buffer, which must be true for valid value type.
-HRESULT GetRegDwordValue(bool is_machine_key,
-                         const CString& relative_key_path,
-                         const CString& value_name,
-                         DWORD* value) {
-  if (!value) {
-    return E_INVALIDARG;
-  }
-
-  HKEY root_key = is_machine_key ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
-  HKEY key = NULL;
-  LONG res = ::RegOpenKeyEx(root_key, relative_key_path, 0, KEY_READ, &key);
-  if (res != ERROR_SUCCESS) {
-    return HRESULT_FROM_WIN32(res);
-  }
-
-  DWORD type = 0;
-  DWORD byte_count = sizeof(*value);
-  res = ::RegQueryValueEx(key,
-                          value_name,
-                          NULL,
-                          &type,
-                          reinterpret_cast<BYTE*>(value),
-                          &byte_count);
-  ::RegCloseKey(key);
-  if (ERROR_SUCCESS != res) {
-    return HRESULT_FROM_WIN32(res);
-  }
-  if ((type != REG_DWORD) || (0 == byte_count)) {
-    return HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
-  }
-
-  return S_OK;
-}
-
-// Obtains information about the current Omaha installation.
-// Attempts to obtain as much information as possible even if errors occur.
-// Therefore, return values of GetRegStringValue are ignored.
-HRESULT GetOmahaInformation(bool is_machine_app,
-                            CString* omaha_version) {
-  if (!omaha_version) {
-    return E_INVALIDARG;
-  }
-
-  if (FAILED(GetRegStringValue(is_machine_app,
-                               kRelativeClientsGoopdateRegPath,
-                               kRegValueProductVersion,
-                               omaha_version))) {
-    *omaha_version = _T("0.0.0.0");
-  }
-
-  return S_OK;
-}
-
-// Builds the query portion of the recovery url.
-// This method obtains values necessary to build the query that are not provided
-// as parameters.
-// Attempts to build with as much information as possible even if errors occur.
-HRESULT BuildUrlQueryPortion(const CString& app_guid,
-                             const CString& app_version,
-                             const CString& app_language,
-                             bool is_machine_app,
-                             CString* query) {
-  if (!query) {
-    return E_INVALIDARG;
-  }
-
-  CString omaha_version;
-  GetOmahaInformation(is_machine_app, &omaha_version);
-
-  CString os_version;
-  CString os_service_pack;
-  GetOSInfo(&os_version, &os_service_pack);
-
-  // All parameters must be escaped individually before building the query.
-  CString app_guid_escaped;
-  CString app_version_escaped;
-  CString app_language_escaped;
-  CString omaha_version_escaped;
-  CString os_version_escaped;
-  CString os_service_pack_escaped;
-  StringEscape(app_guid, true, &app_guid_escaped);
-  StringEscape(app_version, true, &app_version_escaped);
-  StringEscape(app_language, true, &app_language_escaped);
-  StringEscape(omaha_version, true, &omaha_version_escaped);
-  StringEscape(os_version, true, &os_version_escaped);
-  StringEscape(os_service_pack, true, &os_service_pack_escaped);
-
-  query->Format(kQueryStringFormat,
-                app_guid_escaped,
-                app_version_escaped,
-                app_language_escaped,
-                is_machine_app ? 1 : 0,
-                omaha_version_escaped,
-                os_version_escaped,
-                os_service_pack_escaped);
-
-  return S_OK;
-}
-
-// Returns the full path to save the downloaded file to.
-// The path is based on a unique temporary filename to avoid a conflict
-// between multiple apps downloading to the same location.
-// The path to this file is also returned. The caller is responsible for
-// deleting the temporary file after using the download target path.
-// If it cannot create the unique directory, it attempts to use the user's
-// temporary directory and a constant filename.
-HRESULT GetDownloadTargetPath(CString* download_target_path,
-                              CString* temp_file_path) {
-  if (!download_target_path || !temp_file_path) {
-    return E_INVALIDARG;
-  }
-
-  CString user_temp_dir;
-  HRESULT hr = GetAndCreateTempDir(&user_temp_dir);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = CreateUniqueTempFile(user_temp_dir, temp_file_path);
-  if (SUCCEEDED(hr) && !temp_file_path->IsEmpty()) {
-    *download_target_path = *temp_file_path;
-    // Ignore the return value. A .tmp filename is better than none.
-    download_target_path->Replace(_T(".tmp"), _T(".exe"));
-  } else {
-    // Try a static filename in the temp directory as a fallback.
-    *download_target_path = user_temp_dir + _T("GoogleUpdateSetup.exe");
-    *temp_file_path = _T("");
-  }
-
-  return S_OK;
-}
-
-HRESULT DownloadRepairFile(const CString& download_target_path,
-                           const CString& app_guid,
-                           const CString& app_version,
-                           const CString& app_language,
-                           bool is_machine_app,
-                           DownloadCallback download_callback,
-                           void* context) {
-  CString query;
-  BuildUrlQueryPortion(app_guid,
-                       app_version,
-                       app_language,
-                       is_machine_app,
-                       &query);
-
-  CString url;
-  HRESULT hr = GetRegStringValue(true,
-                                 _T("SOFTWARE\\Google\\UpdateDev"),
-                                 kRegValueNameCodeRedUrl,
-                                 &url);
-  if (FAILED(hr)) {
-    url = omaha::kUrlCodeRedCheck;
-  }
-
-  url += query;
-
-  return download_callback(url, download_target_path, context);
-}
-
-// Makes sure the path is enclosed with double quotation marks.
-void EnclosePath(CString* path) {
-  if (path) {
-    return;
-  }
-
-  if (!path->IsEmpty() && path->GetAt(0) != _T('"')) {
-    path->Insert(0, _T('"'));
-    path->AppendChar(_T('"'));
-  }
-}
-
-HRESULT RunRepairFile(const CString& file_path, bool is_machine_app) {
-  const TCHAR* repair_file_args = is_machine_app ? kMachineRepairArgs :
-                                                   kUserRepairArgs;
-
-  CString command_line(file_path);
-  EnclosePath(&command_line);
-  command_line.AppendChar(_T(' '));
-  command_line.Append(repair_file_args);
-
-  return StartProcess(NULL, command_line.GetBuffer());
-}
-
-}  // namespace
-
-// Verifies the file's integrity and that it is signed by Google.
-// We cannot prevent rollback attacks by using a version because the client
-// may not be able to determine the current version if the files and/or
-// registry entries have been deleted/corrupted.
-// Therefore, we check that the file was signed recently.
-HRESULT VerifyFileSignature(const CString& filename) {
-  // Use Authenticode/WinVerifyTrust to verify the file.
-  // Allow the revocation check to use the network.
-  HRESULT hr = VerifySignature(filename, true);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Verify that there is a Google certificate.
-  if (!VerifySigneeIsGoogle(filename)) {
-    return CERT_E_CN_NO_MATCH;
-  }
-
-  // Check that the file was signed recently to limit the window for
-  // rollback attacks.
-  return VerifyFileSignedWithinDays(filename, kRollbackWindowDays);
-}
-
-// Verifies the file contains the special markup resource for repair files.
-HRESULT VerifyRepairFileMarkup(const CString& filename) {
-  const TCHAR* kMarkupResourceName = MAKEINTRESOURCE(1);
-  const TCHAR* kMarkupResourceType = _T("GOOGLEUPDATEREPAIR");
-  const DWORD kMarkupResourceExpectedValue = 1;
-
-  scoped_library module(::LoadLibraryEx(filename, 0, LOAD_LIBRARY_AS_DATAFILE));
-  if (!module) {
-    return HRESULT_FROM_WIN32(::GetLastError());
-  }
-
-  HRSRC resource(::FindResource(get(module),
-                                kMarkupResourceName,
-                                kMarkupResourceType));
-  if (!resource) {
-    return HRESULT_FROM_WIN32(::GetLastError());
-  }
-
-  if (sizeof(kMarkupResourceExpectedValue) !=
-      ::SizeofResource(get(module), resource)) {
-    return E_UNEXPECTED;
-  }
-
-  HGLOBAL loaded_resource(::LoadResource(get(module), resource));
-  if (!loaded_resource) {
-    return HRESULT_FROM_WIN32(::GetLastError());
-  }
-
-  const DWORD* value = static_cast<DWORD*>(::LockResource(loaded_resource));
-  if (!value) {
-    return E_HANDLE;
-  }
-
-  if (kMarkupResourceExpectedValue != *value) {
-    return E_UNEXPECTED;
-  }
-
-  return S_OK;
-}
-
-// Verifies the filename is not UNC name, the file exists, has a valid signature
-// chain, is signed by Google, and contains the special markup resource for
-// repair files.
-HRESULT VerifyIsValidRepairFile(const CString& filename) {
-  // Make sure file exists.
-  if (!::PathFileExists(filename)) {
-    return HRESULT_FROM_WIN32(::GetLastError());
-  }
-
-  HRESULT hr = VerifyFileSignature(filename);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return VerifyRepairFileMarkup(filename);
-}
-
-}  // namespace omaha
-
-// If a repair file is run, the file will not be deleted until reboot. Delete
-// after reboot will only succeed when executed by an admin or LocalSystem.
-// Returns HRESULT_FROM_WIN32(ERROR_ACCESS_DISABLED_BY_POLICY) if automatic
-// update checks are disabled.
-HRESULT FixGoogleUpdate(const TCHAR* app_guid,
-                        const TCHAR* app_version,
-                        const TCHAR* app_language,
-                        bool is_machine_app,
-                        DownloadCallback download_callback,
-                        void* context) {
-  if (!app_guid || !app_version || !app_language || !download_callback) {
-    return E_INVALIDARG;
-  }
-
-  DWORD update_check_period_override_minutes(UINT_MAX);
-  HRESULT hr = omaha::GetRegDwordValue(
-                   true,
-                   GOOPDATE_POLICIES_RELATIVE,
-                   omaha::kRegValueAutoUpdateCheckPeriodOverrideMinutes,
-                   &update_check_period_override_minutes);
-  if (SUCCEEDED(hr) && (0 == update_check_period_override_minutes)) {
-    return HRESULT_FROM_WIN32(ERROR_ACCESS_DISABLED_BY_POLICY);
-  }
-
-  CString download_target_path;
-  CString temp_file_path;
-  hr = omaha::GetDownloadTargetPath(&download_target_path, &temp_file_path);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  if (download_target_path.IsEmpty()) {
-      return E_FAIL;
-  }
-
-  // After calling DownloadRepairFile, don't return until the repair file and
-  // temp file have been deleted.
-  hr = omaha::DownloadRepairFile(download_target_path,
-                                 app_guid,
-                                 app_version,
-                                 app_language,
-                                 is_machine_app,
-                                 download_callback,
-                                 context);
-
-  if (SUCCEEDED(hr)) {
-    hr = omaha::VerifyIsValidRepairFile(download_target_path);
-  }
-
-  if (FAILED(hr)) {
-    ::DeleteFile(download_target_path);
-    ::DeleteFile(temp_file_path);
-    return hr;
-  }
-
-  hr = omaha::RunRepairFile(download_target_path, is_machine_app);
-  ::MoveFileEx(download_target_path, NULL, MOVEFILE_DELAY_UNTIL_REBOOT);
-  ::DeleteFile(temp_file_path);
-
-  return hr;
-}
diff --git a/recovery/client/google_update_recovery.h b/recovery/client/google_update_recovery.h
deleted file mode 100644
index 4bd5b2a..0000000
--- a/recovery/client/google_update_recovery.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-//
-// Defines the interface to the Google Update recovery mechanism to be included
-// in Google apps.
-
-#ifndef OMAHA_RECOVERY_CLIENT_GOOGLE_UPDATE_RECOVERY_H__
-#define OMAHA_RECOVERY_CLIENT_GOOGLE_UPDATE_RECOVERY_H__
-
-#include <tchar.h>
-#include <windows.h>
-
-#ifndef UNICODE
-#error The distributed library only supports UNICODE.
-#endif
-
-extern "C" {
-typedef HRESULT (*DownloadCallback)(const TCHAR* url,
-                                    const TCHAR* file_path,
-                                    void* context);
-
-// Determines whether there is a Code Red event for the current installation
-// and repairs it if necessary.
-// app_language should follow the external Internet standard
-// Best Common Practice (BCP) 47: http://www.rfc-editor.org/rfc/bcp/bcp47.txt
-// context can be NULL if download_callback does not use it.
-HRESULT FixGoogleUpdate(const TCHAR* app_guid,
-                        const TCHAR* app_version,
-                        const TCHAR* app_language,
-                        bool is_machine_app,
-                        DownloadCallback download_callback,
-                        void* context);
-}  // extern "C"
-
-#endif  // OMAHA_RECOVERY_CLIENT_GOOGLE_UPDATE_RECOVERY_H__
diff --git a/recovery/client/google_update_recovery_unittest.cc b/recovery/client/google_update_recovery_unittest.cc
deleted file mode 100644
index 1160bee..0000000
--- a/recovery/client/google_update_recovery_unittest.cc
+++ /dev/null
@@ -1,942 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-//
-// Unit tests for the Google Update recovery mechanism.
-// All apps that are using the mechanism must also run this test.
-//
-// Unlike the mechanism code, this code relies on code from common because it
-// makes writing the tests much simpler and size is not a concern.
-
-#include <windows.h>
-#include <atlstr.h>
-#include "omaha/base/app_util.h"
-#include "omaha/base/const_addresses.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/path.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/signaturevalidator.h"
-#include "omaha/base/system_info.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/const_group_policy.h"
-#include "omaha/net/network_config.h"
-#include "omaha/net/network_request.h"
-#include "omaha/net/simple_request.h"
-#include "omaha/recovery/client/google_update_recovery.h"
-#include "omaha/third_party/gtest/include/gtest/gtest.h"
-
-// TODO(omaha): Replicate some of these tests in signaturevalidator_unittest.cc.
-
-// As of Google Test 1.4.0, expressions get converted to 'bool', resulting in
-// "warning C4800: 'BOOL' : forcing value to bool 'true' or 'false' (performance
-// warning)" in some uses.
-// These must be kept in sync with gtest.h.
-// TODO(omaha): Try to get this fixed in Google Test.
-#undef EXPECT_TRUE
-#define EXPECT_TRUE(condition) \
-  GTEST_TEST_BOOLEAN_(!!(condition), #condition, false, true, \
-                      GTEST_NONFATAL_FAILURE_)
-#undef ASSERT_TRUE
-#define ASSERT_TRUE(condition) \
-  GTEST_TEST_BOOLEAN_(!!(condition), #condition, false, true, \
-                      GTEST_FATAL_FAILURE_)
-
-namespace omaha {
-
-namespace {
-
-const TCHAR kDummyAppGuid[] = _T("{8E472B0D-3E8B-43b1-B89A-E8506AAF1F16}");
-const TCHAR kDummyAppVersion[] = _T("3.4.5.6");
-const TCHAR kDummyAppLang[] = _T("en-us");
-
-const TCHAR kTempDirectory[] = _T("C:\\WINDOWS\\Temp");
-
-const TCHAR kFullMachineOmahaMainKeyPath[] =
-    _T("HKLM\\Software\\Google\\Update\\");
-const TCHAR kFullUserOmahaMainKeyPath[] =
-    _T("HKCU\\Software\\Google\\Update\\");
-const TCHAR kFullMachineOmahaClientKeyPath[] =
-    _T("HKLM\\Software\\Google\\Update\\Clients\\")
-    _T("{430FD4D0-B729-4f61-AA34-91526481799D}");
-const TCHAR kFullUserOmahaClientKeyPath[] =
-    _T("HKCU\\Software\\Google\\Update\\Clients\\")
-    _T("{430FD4D0-B729-4f61-AA34-91526481799D}");
-
-const HRESULT kDummyNoFileError = 0x80041234;
-
-const TCHAR kArgumentSavingExecutableRelativePath[] =
-    _T("unittest_support\\SaveArguments.exe");
-const TCHAR kSavedArgumentsFileName[] = _T("saved_arguments.txt");
-const TCHAR* const kInvalidFileUrl = _T("http://www.google.com/robots.txt");
-
-#define MACHINE_KEY_NAME _T("HKLM")
-#define MACHINE_KEY MACHINE_KEY_NAME _T("\\")
-#define USER_KEY_NAME _T("HKCU")
-#define USER_KEY USER_KEY_NAME _T("\\")
-
-// These methods were copied from omaha/testing/omaha_unittest.cpp.
-const TCHAR kRegistryHiveOverrideRoot[] =
-    _T("HKCU\\Software\\Google\\Update\\UnitTest\\");
-
-const TCHAR kExpectedUrlForDummyAppAndNoOmahaValues[] = _T("http://cr-tools.clients.google.com/service/check2?appid=%7B8E472B0D-3E8B-43b1-B89A-E8506AAF1F16%7D&appversion=3.4.5.6&applang=en-us&machine=1&version=0.0.0.0&osversion=");  // NOLINT
-const int kExpectedUrlForDummyAppAndNoOmahaValuesLength =
-    arraysize(kExpectedUrlForDummyAppAndNoOmahaValues) - 1;
-
-// Overrides the HKLM and HKCU registry hives so that accesses go to the
-// specified registry key instead.
-// This method is most often used in SetUp().
-void OverrideRegistryHives(const CString& hive_override_key_name) {
-  // Override the destinations of HKLM and HKCU to use a special location
-  // for the unit tests so that we don't disturb the actual Omaha state.
-  RegKey machine_key;
-  RegKey user_key;
-  EXPECT_HRESULT_SUCCEEDED(
-      machine_key.Create(hive_override_key_name + MACHINE_KEY));
-  EXPECT_HRESULT_SUCCEEDED(user_key.Create(hive_override_key_name + USER_KEY));
-  EXPECT_HRESULT_SUCCEEDED(::RegOverridePredefKey(HKEY_LOCAL_MACHINE,
-                                                  machine_key.Key()));
-  EXPECT_HRESULT_SUCCEEDED(::RegOverridePredefKey(HKEY_CURRENT_USER,
-                                                  user_key.Key()));
-}
-
-// Restores HKLM and HKCU registry accesses to the real hives.
-// This method is most often used in TearDown().
-void RestoreRegistryHives() {
-  EXPECT_HRESULT_SUCCEEDED(::RegOverridePredefKey(HKEY_LOCAL_MACHINE, NULL));
-  EXPECT_HRESULT_SUCCEEDED(::RegOverridePredefKey(HKEY_CURRENT_USER, NULL));
-}
-
-CString GetTmp() {
-  TCHAR temp_dir[MAX_PATH] = {0};
-  EXPECT_NE(0, ::GetEnvironmentVariable(_T("TMP"), temp_dir, MAX_PATH));
-  return temp_dir;
-}
-
-}  // namespace
-
-HRESULT VerifyFileSignature(const CString& filename);
-HRESULT VerifyRepairFileMarkup(const CString& filename);
-
-class GoogleUpdateRecoveryTest : public testing::Test {
- public:
-  static void set_saved_url(const CString& saved_url) {
-    saved_url_ = saved_url;
-  }
-
-  static void set_saved_file_path(const CString& saved_file_path) {
-    saved_file_path_ = saved_file_path;
-  }
-
-  static void set_saved_context(void* context) {
-    saved_context_ = context;
-  }
-
- protected:
-  GoogleUpdateRecoveryTest() {
-    saved_url_.Empty();
-    saved_file_path_.Empty();
-    saved_context_ = NULL;
-  }
-
-  virtual void SetUp() {
-  }
-
-  virtual void TearDown() {
-  }
-
-  void CheckSavedUrlOSFragment() {
-    OSVERSIONINFO os_version_info = { 0 };
-    os_version_info.dwOSVersionInfoSize = sizeof(os_version_info);
-    EXPECT_NE(0, ::GetVersionEx(&os_version_info));
-
-    CString escaped_service_pack;
-    EXPECT_HRESULT_SUCCEEDED(StringEscape(os_version_info.szCSDVersion,
-                                          false,
-                                          &escaped_service_pack));
-
-    CString expected_os_fragment;
-    expected_os_fragment.Format(_T("%d.%d&servicepack="),
-                                os_version_info.dwMajorVersion,
-                                os_version_info.dwMinorVersion);
-    expected_os_fragment += escaped_service_pack;
-
-    EXPECT_TRUE(expected_os_fragment ==
-                saved_url_.Right(expected_os_fragment.GetLength()));
-  }
-
-  void VerifySavedArgumentsFile(const CString& expected_string) {
-    CString saved_arguments_path = ConcatenatePath(
-                                       GetDirectoryFromPath(saved_file_path_),
-                                       kSavedArgumentsFileName);
-    bool is_found = false;
-    for (int tries = 0; tries < 100 && !is_found; ++tries) {
-      ::Sleep(50);
-      is_found = File::Exists(saved_arguments_path);
-    }
-    EXPECT_TRUE(is_found);
-
-    scoped_hfile file(::CreateFile(saved_arguments_path,
-                                   GENERIC_READ,
-                                   0,                     // do not share
-                                   NULL,                  // default security
-                                   OPEN_EXISTING,         // existing file only
-                                   FILE_ATTRIBUTE_NORMAL,
-                                   NULL));                // no template
-    EXPECT_NE(INVALID_HANDLE_VALUE, get(file));
-
-    const int kBufferLen = 50;
-    TCHAR buffer[kBufferLen + 1] = {0};
-    DWORD bytes_read = 0;
-
-    EXPECT_TRUE(::ReadFile(get(file),
-                           buffer,
-                           kBufferLen * sizeof(TCHAR),
-                           &bytes_read,
-                           NULL));
-    EXPECT_EQ(0, bytes_read % sizeof(TCHAR));
-    buffer[bytes_read / sizeof(TCHAR)] = _T('\0');
-
-    EXPECT_STREQ(expected_string, buffer);
-  }
-
-  void VerifyExpectedSavedFilePath(const CString& expected_temp_directory) {
-    const int kMaxUniqueChars = 4;
-    const CString expected_path_part_a = expected_temp_directory + _T("\\GUR");
-    const CString expected_path_part_b = _T(".exe");
-    EXPECT_STREQ(expected_path_part_a,
-                 saved_file_path_.Left(expected_path_part_a.GetLength()));
-    EXPECT_STREQ(expected_path_part_b,
-                 saved_file_path_.Right(expected_path_part_b.GetLength()));
-    const int constant_chars = expected_path_part_a.GetLength() +
-                               expected_path_part_b.GetLength();
-    EXPECT_GT(saved_file_path_.GetLength(), constant_chars);
-    EXPECT_LE(saved_file_path_.GetLength(), constant_chars + kMaxUniqueChars);
-  }
-
-  static CString saved_url_;
-  static CString saved_file_path_;
-  static void* saved_context_;
-
- protected:
-  // Copies SaveArguments.exe to the specified location.
-  static HRESULT DownloadArgumentSavingFile(const TCHAR* url,
-                                            const TCHAR* file_path,
-                                            void* context) {
-    ASSERT1(url);
-    ASSERT1(file_path);
-
-    GoogleUpdateRecoveryTest::set_saved_url(url);
-    GoogleUpdateRecoveryTest::set_saved_file_path(file_path);
-    GoogleUpdateRecoveryTest::set_saved_context(context);
-
-    CString executable_full_path(app_util::GetCurrentModuleDirectory());
-    VERIFY1(::PathAppend(CStrBuf(executable_full_path, MAX_PATH),
-                         kArgumentSavingExecutableRelativePath));
-
-    if (!::CopyFile(executable_full_path, file_path, false)) {
-      HRESULT hr = HRESULTFromLastError();
-      return hr;
-    }
-
-    return S_OK;
-  }
-
-  // Returns kDummyNoFileError, simulating no file to download.
-  static HRESULT DownloadFileNoFile(const TCHAR* url,
-                                    const TCHAR* file_path,
-                                    void* context) {
-    ASSERT1(url);
-    ASSERT1(file_path);
-
-    GoogleUpdateRecoveryTest::set_saved_url(url);
-    GoogleUpdateRecoveryTest::set_saved_file_path(file_path);
-    GoogleUpdateRecoveryTest::set_saved_context(context);
-
-    return kDummyNoFileError;
-  }
-
-  // Overrides the address to cause a file to be downloaded via HTTP.
-  // Uses a real HTTP stack, so it is similar to a real implementation.
-  // The file is invalid, so signature verification should return
-  // TRUST_E_SUBJECT_FORM_UNKNOWN.
-  static HRESULT DownloadFileInvalidFile(const TCHAR* url,
-                                         const TCHAR* file_path,
-                                         void* context) {
-    ASSERT1(url);
-    UNREFERENCED_PARAMETER(url);
-
-    return DownloadFileFromServer(kInvalidFileUrl, file_path, context);
-  }
-
-  // Uses a real HTTP stack, so it is similar to a real implementation.
-  static HRESULT DownloadFileFromServer(const TCHAR* url,
-                                        const TCHAR* file_path,
-                                        void* context) {
-    UTIL_LOG(L2, (_T("[DownloadFileFromServer][%s][%s]"), url, file_path));
-
-    ASSERT1(url);
-    ASSERT1(file_path);
-
-    GoogleUpdateRecoveryTest::set_saved_url(url);
-    GoogleUpdateRecoveryTest::set_saved_file_path(file_path);
-    GoogleUpdateRecoveryTest::set_saved_context(context);
-
-    NetworkConfig* network_config = NULL;
-    NetworkConfigManager& network_manager = NetworkConfigManager::Instance();
-    HRESULT hr = network_manager.GetUserNetworkConfig(&network_config);
-    if (FAILED(hr)) {
-      UTIL_LOG(LE, (_T("[GetUserNetworkConfig failed][0x%08x]"), hr));
-      return hr;
-    }
-    ON_SCOPE_EXIT_OBJ(*network_config, &NetworkConfig::Clear);
-    NetworkRequest network_request(network_config->session());
-
-    network_config->Clear();
-    network_config->Add(new UpdateDevProxyDetector);
-    network_config->Add(new FirefoxProxyDetector);
-    network_config->Add(new IEProxyDetector);
-
-    network_request.AddHttpRequest(new SimpleRequest);
-
-    hr = network_request.DownloadFile(url, CString(file_path));
-    if (FAILED(hr)) {
-      UTIL_LOG(LE, (_T("[DownloadFile failed][%s][0x%08x]"), url, hr));
-      return hr;
-    }
-
-    int status_code = network_request.http_status_code();
-    UTIL_LOG(L2, (_T("[HTTP status][%u]"), status_code));
-
-    if (HTTP_STATUS_OK == status_code) {
-      return S_OK;
-    } else if (HTTP_STATUS_NO_CONTENT == status_code) {
-      return kDummyNoFileError;
-    } else {
-      // Apps would not have this assumption.
-      ASSERT(false, (_T("Status code %i received. Expected 200 or 204."),
-                     status_code));
-      return E_FAIL;
-    }
-  }
-};
-
-CString GoogleUpdateRecoveryTest::saved_url_;
-CString GoogleUpdateRecoveryTest::saved_file_path_;
-void* GoogleUpdateRecoveryTest::saved_context_;
-
-class GoogleUpdateRecoveryRegistryProtectedTest
-    : public GoogleUpdateRecoveryTest {
- protected:
-  GoogleUpdateRecoveryRegistryProtectedTest()
-      : hive_override_key_name_(kRegistryHiveOverrideRoot) {
-  }
-
-  CString hive_override_key_name_;
-
-  virtual void SetUp() {
-    GoogleUpdateRecoveryTest::SetUp();
-    RegKey::DeleteKey(hive_override_key_name_, true);
-    OverrideRegistryHives(hive_override_key_name_);
-  }
-
-  virtual void TearDown() {
-    RestoreRegistryHives();
-    EXPECT_HRESULT_SUCCEEDED(RegKey::DeleteKey(hive_override_key_name_, true));
-    GoogleUpdateRecoveryTest::TearDown();
-  }
-};
-
-//
-// FixGoogleUpdate Tests
-//
-
-TEST_F(GoogleUpdateRecoveryTest, FixGoogleUpdate_UseRealHttpClient) {
-  EXPECT_EQ(TRUST_E_SUBJECT_FORM_UNKNOWN,
-            FixGoogleUpdate(kDummyAppGuid,
-                            kDummyAppVersion,
-                            kDummyAppLang,
-                            true,
-                            DownloadFileInvalidFile,
-                            NULL));
-}
-
-TEST_F(GoogleUpdateRecoveryTest, FixGoogleUpdate_FileReturned_Machine) {
-  CString saved_arguments_path = ConcatenatePath(app_util::GetTempDir(),
-                                                 kSavedArgumentsFileName);
-
-  ::DeleteFile(saved_arguments_path);
-  EXPECT_FALSE(File::Exists(saved_arguments_path));
-
-  CString context_string(_T("some context"));
-  EXPECT_HRESULT_SUCCEEDED(FixGoogleUpdate(kDummyAppGuid,
-                                           kDummyAppVersion,
-                                           kDummyAppLang,
-                                           true,
-                                           DownloadArgumentSavingFile,
-                                           &context_string));
-
-  EXPECT_EQ(&context_string, saved_context_);
-  EXPECT_STREQ(_T("some context"), *static_cast<CString*>(saved_context_));
-
-  ::Sleep(200);
-  EXPECT_TRUE(File::Exists(saved_file_path_));
-  VerifySavedArgumentsFile(_T("/recover /machine"));
-
-  EXPECT_TRUE(::DeleteFile(saved_file_path_));
-  EXPECT_TRUE(::DeleteFile(saved_arguments_path));
-}
-
-TEST_F(GoogleUpdateRecoveryTest, FixGoogleUpdate_FileReturned_User) {
-  CString saved_arguments_path = ConcatenatePath(app_util::GetTempDir(),
-                                                 kSavedArgumentsFileName);
-
-  ::DeleteFile(saved_arguments_path);
-  EXPECT_FALSE(File::Exists(saved_arguments_path));
-
-  CString context_string(_T("more context"));
-  EXPECT_HRESULT_SUCCEEDED(FixGoogleUpdate(kDummyAppGuid,
-                                           kDummyAppVersion,
-                                           kDummyAppLang,
-                                           false,
-                                           DownloadArgumentSavingFile,
-                                           &context_string));
-
-  EXPECT_EQ(&context_string, saved_context_);
-  EXPECT_STREQ(_T("more context"), *static_cast<CString*>(saved_context_));
-
-  ::Sleep(200);
-  EXPECT_TRUE(File::Exists(saved_file_path_));
-  VerifySavedArgumentsFile(_T("/recover"));
-
-  EXPECT_TRUE(::DeleteFile(saved_file_path_));
-  EXPECT_TRUE(::DeleteFile(saved_arguments_path));
-}
-
-TEST_F(GoogleUpdateRecoveryTest, FixGoogleUpdate_NoFile_Machine) {
-  EXPECT_EQ(kDummyNoFileError, FixGoogleUpdate(kDummyAppGuid,
-                                               kDummyAppVersion,
-                                               kDummyAppLang,
-                                               true,
-                                               DownloadFileNoFile,
-                                               NULL));
-
-  EXPECT_EQ(static_cast<void*>(NULL), saved_context_);
-  EXPECT_FALSE(File::Exists(saved_file_path_));
-
-  TCHAR temp_dir[MAX_PATH] = {0};
-  EXPECT_TRUE(::GetEnvironmentVariable(_T("TMP"), temp_dir, MAX_PATH));
-  EXPECT_TRUE(File::Exists(temp_dir))
-      << _T("The temp directory was deleted or not created.");
-}
-
-TEST_F(GoogleUpdateRecoveryTest, FixGoogleUpdate_NoFile_User) {
-  EXPECT_EQ(kDummyNoFileError, FixGoogleUpdate(kDummyAppGuid,
-                                               kDummyAppVersion,
-                                               kDummyAppLang,
-                                               false,
-                                               DownloadFileNoFile,
-                                               NULL));
-
-  EXPECT_EQ(static_cast<void*>(NULL), saved_context_);
-  EXPECT_FALSE(File::Exists(saved_file_path_));
-
-  TCHAR temp_dir[MAX_PATH] = {0};
-  EXPECT_TRUE(::GetEnvironmentVariable(_T("TMP"), temp_dir, MAX_PATH));
-  EXPECT_TRUE(File::Exists(temp_dir))
-      << _T("The temp directory was deleted or not created.");
-}
-
-TEST_F(GoogleUpdateRecoveryRegistryProtectedTest,
-       FixGoogleUpdate_AllValues_MachineApp) {
-  const TCHAR kExpectedUrl[] = _T("http://cr-tools.clients.google.com/service/check2?appid=%7B8E472B0D-3E8B-43b1-B89A-E8506AAF1F16%7D&appversion=3.4.5.6&applang=en-us&machine=1&version=5.6.78.1&osversion=");  // NOLINT
-
-  const CString prev_tmp = GetTmp();
-  EXPECT_TRUE(::SetEnvironmentVariable(_T("TMP"), kTempDirectory));
-
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kFullMachineOmahaClientKeyPath,
-                                            _T("pv"),
-                                            _T("5.6.78.1")));
-
-  EXPECT_EQ(kDummyNoFileError, FixGoogleUpdate(kDummyAppGuid,
-                                               kDummyAppVersion,
-                                               kDummyAppLang,
-                                               true,
-                                               DownloadFileNoFile,
-                                               NULL));
-
-  EXPECT_STREQ(kExpectedUrl, saved_url_.Left(arraysize(kExpectedUrl) - 1));
-  CheckSavedUrlOSFragment();
-  VerifyExpectedSavedFilePath(kTempDirectory);
-
-  EXPECT_TRUE(::SetEnvironmentVariable(_T("TMP"), prev_tmp));
-}
-
-TEST_F(GoogleUpdateRecoveryRegistryProtectedTest,
-       FixGoogleUpdate_AllValues_UserApp) {
-  const TCHAR kExpectedUrl[] = _T("http://cr-tools.clients.google.com/service/check2?appid=%7B8E472B0D-3E8B-43b1-B89A-E8506AAF1F16%7D&appversion=3.4.5.6&applang=en-us&machine=0&version=5.6.78.1&osversion=");  // NOLINT
-
-  const CString prev_tmp = GetTmp();
-  EXPECT_TRUE(::SetEnvironmentVariable(_T("TMP"), kTempDirectory));
-
-  EXPECT_HRESULT_SUCCEEDED(RegKey::SetValue(kFullUserOmahaClientKeyPath,
-                                            _T("pv"),
-                                            _T("5.6.78.1")));
-
-  EXPECT_EQ(kDummyNoFileError, FixGoogleUpdate(kDummyAppGuid,
-                                               kDummyAppVersion,
-                                               kDummyAppLang,
-                                               false,
-                                               DownloadFileNoFile,
-                                               NULL));
-
-  EXPECT_STREQ(kExpectedUrl, saved_url_.Left(arraysize(kExpectedUrl) - 1));
-  CheckSavedUrlOSFragment();
-  VerifyExpectedSavedFilePath(kTempDirectory);
-
-  EXPECT_TRUE(::SetEnvironmentVariable(_T("TMP"), prev_tmp));
-}
-
-TEST_F(GoogleUpdateRecoveryRegistryProtectedTest,
-       FixGoogleUpdate_NoOmahaRegKeys) {
-  EXPECT_EQ(kDummyNoFileError, FixGoogleUpdate(kDummyAppGuid,
-                                               kDummyAppVersion,
-                                               kDummyAppLang,
-                                               true,
-                                               DownloadFileNoFile,
-                                               NULL));
-  EXPECT_STREQ(kExpectedUrlForDummyAppAndNoOmahaValues,
-               saved_url_.Left(kExpectedUrlForDummyAppAndNoOmahaValuesLength));
-  CheckSavedUrlOSFragment();
-}
-
-TEST_F(GoogleUpdateRecoveryRegistryProtectedTest,
-       FixGoogleUpdate_EmptyAppInfo) {
-  const TCHAR kExpectedUrl[] = _T("http://cr-tools.clients.google.com/service/check2?appid=&appversion=&applang=&machine=1&version=0.0.0.0&osversion=");  // NOLINT
-
-  EXPECT_EQ(kDummyNoFileError, FixGoogleUpdate(_T(""),
-                                               _T(""),
-                                               _T(""),
-                                               true,
-                                               DownloadFileNoFile,
-                                               NULL));
-  EXPECT_STREQ(kExpectedUrl, saved_url_.Left(arraysize(kExpectedUrl) - 1));
-  CheckSavedUrlOSFragment();
-}
-
-TEST_F(GoogleUpdateRecoveryRegistryProtectedTest,
-       FixGoogleUpdate_NullArgs) {
-  EXPECT_EQ(E_INVALIDARG, FixGoogleUpdate(NULL,
-                                          _T(""),
-                                          _T(""),
-                                          true,
-                                          DownloadFileNoFile,
-                                          NULL));
-  EXPECT_EQ(E_INVALIDARG, FixGoogleUpdate(_T(""),
-                                          NULL,
-                                          _T(""),
-                                          true,
-                                          DownloadFileNoFile,
-                                          NULL));
-  EXPECT_EQ(E_INVALIDARG, FixGoogleUpdate(_T(""),
-                                          _T(""),
-                                          NULL,
-                                          true,
-                                          DownloadFileNoFile,
-                                          NULL));
-  EXPECT_EQ(E_INVALIDARG, FixGoogleUpdate(_T(""),
-                                          _T(""),
-                                          _T(""),
-                                          true,
-                                          NULL,
-                                          NULL));
-}
-
-// Setting kRegValueAutoUpdateCheckPeriodOverrideMinutes to zero disables
-// Code Red checks just as it does regular update checks.
-TEST_F(GoogleUpdateRecoveryRegistryProtectedTest,
-       FixGoogleUpdate_AutoUpdateCheckPeriodMinutesIsZeroDword) {
-  EXPECT_HRESULT_SUCCEEDED(
-      RegKey::SetValue(kRegKeyGoopdateGroupPolicy,
-                       kRegValueAutoUpdateCheckPeriodOverrideMinutes,
-                       static_cast<DWORD>(0)));
-
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_ACCESS_DISABLED_BY_POLICY),
-            FixGoogleUpdate(kDummyAppGuid,
-                            kDummyAppVersion,
-                            kDummyAppLang,
-                            true,
-                            DownloadFileNoFile,
-                            NULL));
-  EXPECT_TRUE(saved_url_.IsEmpty());
-}
-
-TEST_F(GoogleUpdateRecoveryRegistryProtectedTest,
-       FixGoogleUpdate_AutoUpdateCheckPeriodMinutesIsZeroDwordInHkcu) {
-  EXPECT_HRESULT_SUCCEEDED(
-      RegKey::SetValue(USER_KEY GOOPDATE_POLICIES_RELATIVE,
-                       kRegValueAutoUpdateCheckPeriodOverrideMinutes,
-                       static_cast<DWORD>(0)));
-
-  EXPECT_EQ(kDummyNoFileError, FixGoogleUpdate(kDummyAppGuid,
-                                               kDummyAppVersion,
-                                               kDummyAppLang,
-                                               true,
-                                               DownloadFileNoFile,
-                                               NULL));
-  EXPECT_STREQ(kExpectedUrlForDummyAppAndNoOmahaValues,
-               saved_url_.Left(kExpectedUrlForDummyAppAndNoOmahaValuesLength));
-  CheckSavedUrlOSFragment();
-}
-
-TEST_F(GoogleUpdateRecoveryRegistryProtectedTest,
-       FixGoogleUpdate_AutoUpdateCheckPeriodMinutesIsNonZeroDword) {
-  EXPECT_HRESULT_SUCCEEDED(
-      RegKey::SetValue(kRegKeyGoopdateGroupPolicy,
-                       kRegValueAutoUpdateCheckPeriodOverrideMinutes,
-                       static_cast<DWORD>(1400)));
-
-  EXPECT_EQ(kDummyNoFileError, FixGoogleUpdate(kDummyAppGuid,
-                                               kDummyAppVersion,
-                                               kDummyAppLang,
-                                               true,
-                                               DownloadFileNoFile,
-                                               NULL));
-  EXPECT_STREQ(kExpectedUrlForDummyAppAndNoOmahaValues,
-               saved_url_.Left(kExpectedUrlForDummyAppAndNoOmahaValuesLength));
-  CheckSavedUrlOSFragment();
-}
-
-TEST_F(GoogleUpdateRecoveryRegistryProtectedTest,
-       FixGoogleUpdate_AutoUpdateCheckPeriodMinutesIsZeroDword64) {
-  EXPECT_HRESULT_SUCCEEDED(
-      RegKey::SetValue(kRegKeyGoopdateGroupPolicy,
-                       kRegValueAutoUpdateCheckPeriodOverrideMinutes,
-                       static_cast<DWORD64>(0)));
-
-  EXPECT_EQ(kDummyNoFileError, FixGoogleUpdate(kDummyAppGuid,
-                                               kDummyAppVersion,
-                                               kDummyAppLang,
-                                               true,
-                                               DownloadFileNoFile,
-                                               NULL));
-  EXPECT_STREQ(kExpectedUrlForDummyAppAndNoOmahaValues,
-               saved_url_.Left(kExpectedUrlForDummyAppAndNoOmahaValuesLength));
-  CheckSavedUrlOSFragment();
-}
-
-TEST_F(GoogleUpdateRecoveryRegistryProtectedTest,
-       FixGoogleUpdate_AutoUpdateCheckPeriodMinutesIsNonZeroDword64) {
-  EXPECT_HRESULT_SUCCEEDED(
-      RegKey::SetValue(kRegKeyGoopdateGroupPolicy,
-                       kRegValueAutoUpdateCheckPeriodOverrideMinutes,
-                       static_cast<DWORD64>(1400)));
-
-  EXPECT_EQ(kDummyNoFileError, FixGoogleUpdate(kDummyAppGuid,
-                                               kDummyAppVersion,
-                                               kDummyAppLang,
-                                               true,
-                                               DownloadFileNoFile,
-                                               NULL));
-  EXPECT_STREQ(kExpectedUrlForDummyAppAndNoOmahaValues,
-               saved_url_.Left(kExpectedUrlForDummyAppAndNoOmahaValuesLength));
-  CheckSavedUrlOSFragment();
-}
-
-TEST_F(GoogleUpdateRecoveryRegistryProtectedTest,
-       FixGoogleUpdate_AutoUpdateCheckPeriodMinutesIsZeroAsString) {
-  EXPECT_HRESULT_SUCCEEDED(
-      RegKey::SetValue(kRegKeyGoopdateGroupPolicy,
-                       kRegValueAutoUpdateCheckPeriodOverrideMinutes,
-                       _T("0")));
-
-  EXPECT_EQ(kDummyNoFileError, FixGoogleUpdate(kDummyAppGuid,
-                                               kDummyAppVersion,
-                                               kDummyAppLang,
-                                               true,
-                                               DownloadFileNoFile,
-                                               NULL));
-  EXPECT_STREQ(kExpectedUrlForDummyAppAndNoOmahaValues,
-               saved_url_.Left(kExpectedUrlForDummyAppAndNoOmahaValuesLength));
-  CheckSavedUrlOSFragment();
-}
-
-TEST_F(GoogleUpdateRecoveryRegistryProtectedTest,
-       FixGoogleUpdate_AutoUpdateCheckPeriodMinutesIsZeroAsBinary) {
-  const byte zero = 0;
-  EXPECT_HRESULT_SUCCEEDED(
-      RegKey::SetValue(kRegKeyGoopdateGroupPolicy,
-                       kRegValueAutoUpdateCheckPeriodOverrideMinutes,
-                       &zero,
-                       sizeof(zero)));
-
-  EXPECT_EQ(kDummyNoFileError, FixGoogleUpdate(kDummyAppGuid,
-                                               kDummyAppVersion,
-                                               kDummyAppLang,
-                                               true,
-                                               DownloadFileNoFile,
-                                               NULL));
-  EXPECT_STREQ(kExpectedUrlForDummyAppAndNoOmahaValues,
-               saved_url_.Left(kExpectedUrlForDummyAppAndNoOmahaValuesLength));
-  CheckSavedUrlOSFragment();
-}
-
-TEST_F(GoogleUpdateRecoveryRegistryProtectedTest,
-       FixGoogleUpdate_GroupPolicyKeyExistsButNoAutoUpdateCheckPeriodMinutes) {
-  EXPECT_HRESULT_SUCCEEDED(RegKey::CreateKey(kRegKeyGoopdateGroupPolicy));
-
-  EXPECT_EQ(kDummyNoFileError, FixGoogleUpdate(kDummyAppGuid,
-                                               kDummyAppVersion,
-                                               kDummyAppLang,
-                                               true,
-                                               DownloadFileNoFile,
-                                               NULL));
-  EXPECT_STREQ(kExpectedUrlForDummyAppAndNoOmahaValues,
-               saved_url_.Left(kExpectedUrlForDummyAppAndNoOmahaValuesLength));
-  CheckSavedUrlOSFragment();
-}
-
-// Verifies that the file is saved even if the temp directory doesn't exist.
-TEST_F(GoogleUpdateRecoveryTest, FixGoogleUpdate_SaveToNonExistantDirectory) {
-  const TCHAR kNonExistantDirectory[] = _T("c:\\directory_does_not_exist");
-  DeleteDirectory(kNonExistantDirectory);
-  EXPECT_FALSE(File::Exists(kNonExistantDirectory));
-
-  const CString prev_tmp = GetTmp();
-  EXPECT_TRUE(::SetEnvironmentVariable(_T("TMP"), kNonExistantDirectory));
-
-  EXPECT_EQ(TRUST_E_SUBJECT_FORM_UNKNOWN,
-            FixGoogleUpdate(kDummyAppGuid,
-                            kDummyAppVersion,
-                            kDummyAppLang,
-                            true,
-                            DownloadFileInvalidFile,
-                            NULL));
-
-  VerifyExpectedSavedFilePath(kNonExistantDirectory);
-
-  EXPECT_TRUE(::SetEnvironmentVariable(_T("TMP"), prev_tmp));
-  EXPECT_HRESULT_SUCCEEDED(DeleteDirectory(kNonExistantDirectory));
-}
-
-TEST_F(GoogleUpdateRecoveryTest, FixGoogleUpdate_FileCollision) {
-  const CString prev_tmp = GetTmp();
-  EXPECT_TRUE(::SetEnvironmentVariable(_T("TMP"), kTempDirectory));
-
-  CString saved_arguments_path = ConcatenatePath(app_util::GetTempDir(),
-                                                 kSavedArgumentsFileName);
-
-  EXPECT_HRESULT_SUCCEEDED(FixGoogleUpdate(kDummyAppGuid,
-                                           kDummyAppVersion,
-                                           kDummyAppLang,
-                                           false,
-                                           DownloadArgumentSavingFile,
-                                           NULL));
-
-  EXPECT_TRUE(File::Exists(saved_file_path_));
-  VerifyExpectedSavedFilePath(kTempDirectory);
-
-  CString first_saved_file_path = saved_file_path_;
-
-  // Ensure that the first downloaded file is in use.
-  FileLock lock;
-  EXPECT_HRESULT_SUCCEEDED(lock.Lock(first_saved_file_path));
-
-  EXPECT_HRESULT_SUCCEEDED(FixGoogleUpdate(kDummyAppGuid,
-                                           kDummyAppVersion,
-                                           kDummyAppLang,
-                                           false,
-                                           DownloadArgumentSavingFile,
-                                           NULL));
-  EXPECT_TRUE(File::Exists(saved_file_path_));
-  VerifyExpectedSavedFilePath(kTempDirectory);
-
-  EXPECT_STRNE(first_saved_file_path, saved_file_path_);
-
-  EXPECT_HRESULT_SUCCEEDED(lock.Unlock());
-
-  bool is_deleted = false;
-  for (int tries = 0; tries < 100 && !is_deleted; ++tries) {
-    ::Sleep(50);
-    is_deleted = !!::DeleteFile(saved_file_path_);
-  }
-  EXPECT_TRUE(is_deleted);
-
-  EXPECT_TRUE(::DeleteFile(first_saved_file_path));
-  EXPECT_TRUE(::DeleteFile(saved_arguments_path));
-
-  EXPECT_TRUE(::SetEnvironmentVariable(_T("TMP"), prev_tmp));
-}
-
-//
-// VerifyFileSignature Tests
-//
-TEST_F(GoogleUpdateRecoveryTest, VerifyFileSignature_SignedValid) {
-  CString executable_full_path(app_util::GetCurrentModuleDirectory());
-  EXPECT_TRUE(::PathAppend(CStrBuf(executable_full_path, MAX_PATH),
-                           kArgumentSavingExecutableRelativePath));
-  EXPECT_TRUE(File::Exists(executable_full_path));
-  EXPECT_HRESULT_SUCCEEDED(VerifyFileSignature(executable_full_path));
-}
-
-TEST_F(GoogleUpdateRecoveryTest, VerifyFileSignature_NotSigned) {
-  const TCHAR kUnsignedExecutable[] = _T("GoogleUpdate_unsigned.exe");
-
-  CString executable_full_path(app_util::GetCurrentModuleDirectory());
-  EXPECT_TRUE(::PathAppend(CStrBuf(executable_full_path, MAX_PATH),
-                           kUnsignedExecutable));
-  EXPECT_TRUE(File::Exists(executable_full_path));
-  EXPECT_EQ(TRUST_E_NOSIGNATURE, VerifyFileSignature(executable_full_path));
-}
-
-// The certificate is still valid, but the executable was signed more than N
-// days ago.
-TEST_F(GoogleUpdateRecoveryTest, VerifyFileSignature_SignedOldWithValidCert) {
-  const TCHAR kRelativePath[] =
-      _T("unittest_support\\GoogleUpdate_old_signature.exe");
-
-  CString executable_full_path(app_util::GetCurrentModuleDirectory());
-  EXPECT_TRUE(::PathAppend(CStrBuf(executable_full_path, MAX_PATH),
-                           kRelativePath));
-  EXPECT_TRUE(File::Exists(executable_full_path));
-  EXPECT_EQ(TRUST_E_TIME_STAMP, VerifyFileSignature(executable_full_path));
-}
-
-// The certificate was valid when it was used to sign the executable, but it has
-// since expired.
-// TRUST_E_TIME_STAMP is returned because the file was signed more than the
-// allowable number of dates ago for the repair file. Otherwise, the signature
-// is fine.
-TEST_F(GoogleUpdateRecoveryTest, VerifyFileSignature_SignedWithNowExpiredCert) {
-  const TCHAR kRelativePath[] =
-      _T("unittest_support\\GoogleUpdate_now_expired_cert.exe");
-
-  CString executable_full_path(app_util::GetCurrentModuleDirectory());
-  EXPECT_TRUE(::PathAppend(CStrBuf(executable_full_path, MAX_PATH),
-                           kRelativePath));
-  EXPECT_TRUE(File::Exists(executable_full_path));
-  EXPECT_EQ(TRUST_E_TIME_STAMP, VerifyFileSignature(executable_full_path));
-}
-
-TEST_F(GoogleUpdateRecoveryTest, VerifyFileSignature_UntrustedChain) {
-  const TCHAR kUntrustedChainExecutable[] =
-      _T("unittest_support\\SaveArguments_OmahaTestSigned.exe");
-
-  CString executable_full_path(app_util::GetCurrentModuleDirectory());
-  EXPECT_TRUE(::PathAppend(CStrBuf(executable_full_path, MAX_PATH),
-                           kUntrustedChainExecutable));
-  EXPECT_TRUE(File::Exists(executable_full_path));
-  EXPECT_EQ(CERT_E_UNTRUSTEDROOT, VerifyFileSignature(executable_full_path));
-}
-
-TEST_F(GoogleUpdateRecoveryTest, VerifyFileSignature_HashFails) {
-  const TCHAR kCorruptedExecutable[] =
-      _T("unittest_support\\GoogleUpdate_corrupted.exe");
-
-  CString executable_full_path(app_util::GetCurrentModuleDirectory());
-  EXPECT_TRUE(::PathAppend(CStrBuf(executable_full_path, MAX_PATH),
-                           kCorruptedExecutable));
-  EXPECT_TRUE(File::Exists(executable_full_path));
-  EXPECT_EQ(TRUST_E_BAD_DIGEST, VerifyFileSignature(executable_full_path));
-}
-
-// The file for Windows Vista and later may not exist on all systems.
-TEST_F(GoogleUpdateRecoveryTest,
-       VerifyFileSignature_NonGoogleSignature) {
-  CString file_path = SystemInfo::IsRunningOnVistaOrLater() ?
-      _T("%SYSTEM%\\rcagent.exe") : _T("%SYSTEM%\\wuauclt.exe");
-  if (!File::Exists(file_path) && SystemInfo::IsRunningOnVistaOrLater()) {
-    std::wcout << _T("\tTest did not run because '") << file_path
-               << _T("' was not found.") << std::endl;
-    return;
-  }
-  EXPECT_HRESULT_SUCCEEDED(ExpandStringWithSpecialFolders(&file_path));
-  EXPECT_TRUE(File::Exists(file_path));
-  EXPECT_TRUE(SignatureIsValid(file_path, false));
-  EXPECT_EQ(CERT_E_CN_NO_MATCH, VerifyFileSignature(file_path));
-}
-
-TEST_F(GoogleUpdateRecoveryTest, VerifyFileSignature_BadFilenames) {
-  EXPECT_EQ(CRYPT_E_FILE_ERROR, VerifyFileSignature(_T("NoSuchFile.exe")));
-
-  EXPECT_EQ(CRYPT_E_FILE_ERROR, VerifyFileSignature(NULL));
-
-  EXPECT_EQ(CRYPT_E_FILE_ERROR, VerifyFileSignature(_T("")));
-}
-
-//
-// VerifyRepairFileMarkup Tests
-//
-TEST_F(GoogleUpdateRecoveryTest, VerifyRepairFileMarkup_ValidMarkup) {
-  const TCHAR kExecutableWithMarkup[] =
-      _T("unittest_support\\SaveArguments.exe");
-  EXPECT_HRESULT_SUCCEEDED(VerifyRepairFileMarkup(kExecutableWithMarkup));
-}
-
-TEST_F(GoogleUpdateRecoveryTest, VerifyRepairFileMarkup_InvalidMarkups) {
-  const TCHAR kNoResourcesExecutable[] =
-      _T("unittest_support\\SaveArguments_unsigned_no_resources.exe");
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_RESOURCE_DATA_NOT_FOUND),
-            VerifyRepairFileMarkup(kNoResourcesExecutable));
-
-  const TCHAR kResourcesButNoMarkupExecutable[] = _T("GoogleUpdate.exe");
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND),
-            VerifyRepairFileMarkup(kResourcesButNoMarkupExecutable));
-
-  const TCHAR kWrongMarkupResourceNameExecutable[] =
-      _T("unittest_support\\SaveArguments_unsigned_wrong_resource_name.exe");
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_RESOURCE_NAME_NOT_FOUND),
-            VerifyRepairFileMarkup(kWrongMarkupResourceNameExecutable));
-
-  const TCHAR kWrongMarkupSizeExecutable[] =
-      _T("unittest_support\\SaveArguments_unsigned_wrong_markup_size.exe");
-  EXPECT_EQ(E_UNEXPECTED, VerifyRepairFileMarkup(kWrongMarkupSizeExecutable));
-
-  const TCHAR kWrongMarkupValueExecutable[] =
-      _T("unittest_support\\SaveArguments_unsigned_wrong_markup_value.exe");
-  EXPECT_EQ(E_UNEXPECTED, VerifyRepairFileMarkup(kWrongMarkupValueExecutable));
-}
-
-TEST_F(GoogleUpdateRecoveryTest, VerifyRepairFileMarkup_BadFilenames) {
-  const TCHAR kMissingFile[] = _T("NoSuchFile.exe");
-  EXPECT_EQ(FALSE, ::PathFileExists(kMissingFile));
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            VerifyRepairFileMarkup(kMissingFile));
-  EXPECT_HRESULT_FAILED(VerifyRepairFileMarkup(_T("")));
-}
-
-//
-// VerifyRepairFileMarkup Tests
-//
-// TODO(omaha): Unit test VerifyIsValidRepairFile.
-
-//
-// Production Server Response Tests Tests
-//
-TEST_F(GoogleUpdateRecoveryTest, ProductionServerResponseTest) {
-  EXPECT_EQ(kDummyNoFileError, FixGoogleUpdate(kDummyAppGuid,
-                                               kDummyAppVersion,
-                                               kDummyAppLang,
-                                               true,
-                                               DownloadFileFromServer,
-                                               NULL)) <<
-      _T("The production server did not return 204. This may indicate network ")
-      _T("issues or that the Code Red server is configured incorrectly");
-}
-
-}  // namespace omaha
-
diff --git a/recovery/lib/bin/dbg/google_update_recovery.lib b/recovery/lib/bin/dbg/google_update_recovery.lib
deleted file mode 100644
index 1d7f2fd..0000000
--- a/recovery/lib/bin/dbg/google_update_recovery.lib
+++ /dev/null
Binary files differ
diff --git a/recovery/lib/bin/opt/google_update_recovery.lib b/recovery/lib/bin/opt/google_update_recovery.lib
deleted file mode 100644
index d82709d..0000000
--- a/recovery/lib/bin/opt/google_update_recovery.lib
+++ /dev/null
Binary files differ
diff --git a/recovery/lib/google_update_recovery.h b/recovery/lib/google_update_recovery.h
deleted file mode 100644
index a62627a..0000000
--- a/recovery/lib/google_update_recovery.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Defines the interface to the Google Update recovery mechanism to be included
-// in Google apps.
-
-#ifndef OMAHA_RECOVERY_LIB_GOOGLE_UPDATE_RECOVERY_H__
-#define OMAHA_RECOVERY_LIB_GOOGLE_UPDATE_RECOVERY_H__
-
-#include <tchar.h>
-#include <windows.h>
-
-#ifndef UNICODE
-#error The distributed library only supports UNICODE.
-#endif
-
-extern "C" {
-typedef HRESULT (*DownloadCallback)(const TCHAR* url,
-                                    const TCHAR* file_path,
-                                    void* context);
-
-// Determines whether there is a Code Red event for the current installation
-// and repairs it if necessary.
-// app_language should follow the external Internet standard
-// Best Common Practice (BCP) 47: http://www.rfc-editor.org/rfc/bcp/bcp47.txt
-// context can be NULL if download_callback does not use it.
-HRESULT FixGoogleUpdate(const TCHAR* app_guid,
-                        const TCHAR* app_version,
-                        const TCHAR* app_language,
-                        bool is_machine_app,
-                        DownloadCallback download_callback,
-                        void* context);
-}  // extern "C"
-
-#endif  // OMAHA_RECOVERY_LIB_GOOGLE_UPDATE_RECOVERY_H__
diff --git a/recovery/lib/readme.txt b/recovery/lib/readme.txt
deleted file mode 100644
index 9d4f645..0000000
--- a/recovery/lib/readme.txt
+++ /dev/null
@@ -1 +0,0 @@
-These files are for Omaha Code Red (Google Update Recovery). Use these files to integrate Code Red into your Omaha-compatible app.
diff --git a/recovery/recovery_markup.rc b/recovery/recovery_markup.rc
deleted file mode 100644
index e707c72..0000000
--- a/recovery/recovery_markup.rc
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <afxres.h>
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1252)
-#endif //_WIN32
-
-#define IDR_REPAIR_FILE_MARKUP 1
-
-IDR_REPAIR_FILE_MARKUP GOOGLEUPDATEREPAIR { 1L }
-
-#endif    // English (U.S.) resources
diff --git a/recovery/recovery_test.cc b/recovery/recovery_test.cc
deleted file mode 100644
index a99d33c..0000000
--- a/recovery/recovery_test.cc
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Test app for the Google Update recovery mechanism.
-#include <windows.h>
-#include <atlstr.h>
-#include "omaha/base/const_addresses.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/net/network_config.h"
-#include "omaha/net/network_request.h"
-#include "omaha/recovery/client/google_update_recovery.h"
-
-using omaha::UpdateDevProxyDetector;
-using omaha::FirefoxProxyDetector;
-using omaha::IEProxyDetector;
-using omaha::NetworkRequest;
-using omaha::NetworkConfig;
-using omaha::NetworkConfigManager;
-
-namespace {
-
-// Implements the DownloadFileMethod signature.
-HRESULT DownloadFile(const TCHAR* url, const TCHAR* file_path, void*) {
-  UTIL_LOG(L2, (_T("[DownloadFile][%s][%s]"), url, file_path));
-
-  ASSERT1(url);
-  ASSERT1(file_path);
-
-  CString test_url(url);
-  CString test_file_path(file_path);
-
-// Include this code to override the address portion of the URL.
-#if 1
-  // Change the URL below to point to a test repair exe of your own.
-  const TCHAR* const kTestAddress =
-      _T("http://dl.google.com/insert_your_file_here?");
-
-  VERIFY1(1 == test_url.Replace(omaha::kUrlCodeRedCheck, kTestAddress));
-#endif
-
-  // Initialize the network for user with no impersonation required.
-  NetworkConfigManager::set_is_machine(false);
-  NetworkConfig* network_config = NULL;
-  HRESULT hr = S_OK;
-  hr = NetworkConfigManager::Instance().GetUserNetworkConfig(&network_config);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[GetUserNetworkConfig failed][0x%08x]"), hr));
-    return hr;
-  }
-  network_config->Clear();
-  network_config->Add(new UpdateDevProxyDetector);
-  network_config->Add(new FirefoxProxyDetector);
-  network_config->Add(new IEProxyDetector);
-
-  NetworkRequest network_request(network_config->session());
-  hr = network_request.DownloadFile(test_url, CString(file_path));
-
-  hr = network_request.DownloadFile(test_url, CString(file_path));
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[DownloadFile failed][%s][0x%08x]"), test_url, hr));
-    return hr;
-  }
-
-  int status_code = network_request.http_status_code();
-  UTIL_LOG(L2, (_T("[HTTP status][%u]"), status_code));
-
-  return (HTTP_STATUS_OK == status_code) ? S_OK : E_FAIL;
-}
-
-}  // namespace
-
-int main() {
-  const TCHAR* const kDummyGuid = _T("{20F8FA32-8E16-4046-834B-88661E021AFC}");
-
-  HRESULT hr = FixGoogleUpdate(kDummyGuid,
-                               _T("1.0.555.0"),
-                               _T("en-us"),
-                               true,
-                               DownloadFile,
-                               NULL);
-
-  return hr;
-}
diff --git a/recovery/repair_exe/build.scons b/recovery/repair_exe/build.scons
deleted file mode 100644
index 541d963..0000000
--- a/recovery/repair_exe/build.scons
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-
-Import('env')
-
-
-local_env = env.Clone()
-
-inputs = [
-    'mspexecutableelevator.cc',
-    'repair_goopdate.cc',
-    ]
-
-repair_goopdate_lib = local_env.ComponentStaticLibrary('repair_goopdate',
-                                                       inputs)
-
-local_env.OmahaUnittest(
-    name='repair_exe_custom_action_unittest',
-    source=['mspexecutableelevator_unittest.cc', 'repair_goopdate_unittest.cc'],
-    LIBS=repair_goopdate_lib,
-)
-
-subdirs = [
-    'custom_action',
-    'msp',
-    ]
-
-for subdir in subdirs:
-  env.BuildSConscript(subdir)
diff --git a/recovery/repair_exe/custom_action/build.scons b/recovery/repair_exe/custom_action/build.scons
deleted file mode 100644
index 81942ed..0000000
--- a/recovery/repair_exe/custom_action/build.scons
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-
-Import('env')
-
-
-#
-# Build executecustomaction.dll
-#
-
-lib_target_name = 'executecustomaction_lib'
-
-lib_env = env.Clone()
-
-lib_inputs = [
-    'execute_repair_file.cc',
-    ]
-if env.Bit('use_precompiled_headers'):
-  lib_inputs += lib_env.EnablePrecompile(lib_target_name)
-
-lib_output = lib_env.ComponentLibrary(
-    lib_name=lib_target_name,
-    source=lib_inputs,
-)
-
-lib_env.OmahaUnittest(
-    name='repair_exe_custom_action_unittest',
-    source='execute_repair_file_unittest.cc',
-    LIBS=lib_target_name + '.lib',
-)
-
-
-dll_target_name = 'executecustomaction'
-
-dll_env = env.Clone(
-    # Build a dll, not a lib.
-    COMPONENT_STATIC = False,
-)
-
-dll_env.Append(
-    LIBS = [
-        ('atls.lib', 'atlsd.lib')[dll_env.Bit('debug')],
-        ('libcmt.lib', 'libcmtd.lib')[dll_env.Bit('debug')],
-        ('libcpmt.lib', 'libcpmtd.lib')[dll_env.Bit('debug')],
-        '$LIB_DIR/base.lib',
-        '$LIB_DIR/google_update_recovery.lib',
-        '$LIB_DIR/repair_goopdate.lib',
-        'crypt32.lib',
-        'msi.lib',
-        'wintrust.lib',
-
-        # These are required by base.lib
-        'netapi32.lib',
-        'psapi.lib',
-        'rasapi32.lib',
-        'shlwapi.lib',
-        'userenv.lib',
-        'version.lib',
-        'wtsapi32.lib',
-        lib_target_name + '.lib',
-        ],
-
-    CPPDEFINES = [
-        '_USRDLL',
-        ],
-)
-
-dll_inputs = [
-    'executecustomaction.cc',
-    'executecustomaction.def',
-    ]
-if env.Bit('use_precompiled_headers'):
-  dll_inputs += dll_env.EnablePrecompile(dll_target_name)
-
-dll_env.ComponentLibrary(
-    lib_name=dll_target_name,
-    source=dll_inputs,
-)
-
-
-#
-# Build testelevateusingmsp.exe
-#
-test_env = env.Clone()
-
-test_env['LIBS'] += [
-    ('atls.lib', 'atlsd.lib')[test_env.Bit('debug')],
-    ('libcmt.lib', 'libcmtd.lib')[test_env.Bit('debug')],
-    ('libcpmt.lib', 'libcpmtd.lib')[test_env.Bit('debug')],
-    '$LIB_DIR/base.lib',
-    '$LIB_DIR/repair_goopdate.lib',
-    'crypt32.lib',
-    'msi.lib',
-    'wintrust.lib',
-    # These are required by base.lib
-    'netapi32.lib',
-    'psapi.lib',
-    'rasapi32.lib',
-    'shlwapi.lib',
-    'userenv.lib',
-    'version.lib',
-    'wtsapi32.lib',
-    ]
-
-# This is a console application.
-test_env.FilterOut(LINKFLAGS = ['/SUBSYSTEM:WINDOWS'])
-test_env['LINKFLAGS'] += ['/SUBSYSTEM:CONSOLE']
-
-target_name = 'testelevateusingmsp'
-
-test_inputs = [
-    'testelevateusingmsp.cc',
-    ]
-if env.Bit('use_precompiled_headers'):
-  test_inputs += test_env.EnablePrecompile(target_name)
-
-# This test requires arguments, so do not create a run alias.
-test_env.ComponentTestProgram(
-    prog_name=target_name,
-    source=test_inputs,
-    COMPONENT_TEST_RUNNABLE=False
-)
diff --git a/recovery/repair_exe/custom_action/execute_repair_file.cc b/recovery/repair_exe/custom_action/execute_repair_file.cc
deleted file mode 100644
index f6d1af1..0000000
--- a/recovery/repair_exe/custom_action/execute_repair_file.cc
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Verifies and executes the repair file for the MSP custom action.
-
-#include "omaha/recovery/repair_exe/custom_action/execute_repair_file.h"
-#include <shlobj.h>
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/path.h"
-#include "omaha/base/string.h"
-#include "omaha/base/system.h"
-#include "omaha/base/utils.h"
-
-namespace omaha {
-
-namespace {
-
-// TODO(omaha): Add a parameter to specify the process working directory
-HRESULT ExecuteFile(const CString& filename, const CString& args) {
-  HRESULT hr = System::ShellExecuteProcess(filename, args, NULL, NULL);
-
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ExecuteFile - failed to exec][%s][%s][0x%08x]"),
-                  filename, args, hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT GetDir(int csidl, const CString& path_tail, CString* dir) {
-  ASSERT1(dir);
-
-  CString path;
-  HRESULT hr = GetFolderPath(csidl, &path);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  if (!::PathAppend(CStrBuf(path, MAX_PATH), path_tail)) {
-    return E_FAIL;
-  }
-  dir->SetString(path);
-
-  // Try to create the directory. Continue if the directory can't be created.
-  hr = CreateDir(path, NULL);
-  if (FAILED(hr)) {
-    UTIL_LOG(LW, (_T("[GetDir failed to create dir][%s][0x%08x]"), path, hr));
-  }
-  return S_OK;
-}
-
-// Creates machine wide goopdate install dir: "Program Files/Google/Update".
-CString GetMachineGoopdateInstallDir() {
-  CString path;
-  VERIFY1(SUCCEEDED(GetDir(CSIDL_PROGRAM_FILES,
-                           CString(OMAHA_REL_GOOPDATE_INSTALL_DIR),
-                           &path)));
-  return path;
-}
-
-// Copies the file to "%ProgramFiles%\Google\Update\".
-// Assumes %ProgramFiles% is secure, which it should be unless permissions have
-// been changed.
-// Note: Cannot use the temp dir because MSI uses the logon user's environment
-// and the user's temp dir is unlikely to be secure.
-HRESULT CopyToSecureLocation(const CString& source, CString* new_location) {
-  if (source.IsEmpty() || !new_location) {
-    return E_INVALIDARG;
-  }
-
-  CString filename = GetFileFromPath(source);
-  *new_location = GetMachineGoopdateInstallDir();
-  if (!::PathAppend(CStrBuf(*new_location, MAX_PATH), filename)) {
-    return HRESULTFromLastError();
-  }
-
-  return File::Copy(source, *new_location, true);
-}
-
-}  // namespace
-
-HRESULT VerifyIsValidRepairFile(const CString& filename);
-
-// Assumes it is called elevated or with admin permissions.
-// Copies the file to a secure location, before verifying and executing it.
-// When the file is an Omaha metainstaller, it is important that the temp
-// directory when elevated is also secure in order to maintain the security
-// of all files being executed while elevated.
-HRESULT VerifyFileAndExecute(const CString& filename, const CString& args) {
-  UTIL_LOG(L1, (_T("[VerifyFileAndExecute][%s][%s]"), filename, args));
-
-  CString secure_filename;
-  HRESULT hr = CopyToSecureLocation(filename, &secure_filename);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[CopyToSecureLocation failed][error 0x%08x]"), hr));
-    return hr;
-  }
-
-  hr = omaha::VerifyIsValidRepairFile(secure_filename);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[VerifyIsValidRepairFile failed][error 0x%08x]"), hr));
-    return hr;
-  }
-
-  hr = ExecuteFile(secure_filename, args);
-  if (FAILED(hr)) {
-    UTIL_LOG(LE, (_T("[ExecuteFile failed][error 0x%08x]"), hr));
-    return hr;
-  }
-
-  // Use the API directly rather than File::DeleteAfterReboot() because
-  // File::DeleteAfterReboot() moves the file immediately, causing the
-  // GetFileVersionInfoSize call in the metainstaller to fail.
-  // Because this is always run as SYSTEM, the delayed delete will succeed.
-  VERIFY1(::MoveFileEx(secure_filename, NULL, MOVEFILE_DELAY_UNTIL_REBOOT));
-
-  return S_OK;
-}
-
-}  // namespace omaha
diff --git a/recovery/repair_exe/custom_action/execute_repair_file.h b/recovery/repair_exe/custom_action/execute_repair_file.h
deleted file mode 100644
index 123b05d..0000000
--- a/recovery/repair_exe/custom_action/execute_repair_file.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Verifies and executes the repair file for the MSP custom action.
-
-#ifndef OMAHA_RECOVERY_REPAIR_EXE_CUSTOM_ACTION_EXECUTE_REPAIR_FILE_H__
-#define OMAHA_RECOVERY_REPAIR_EXE_CUSTOM_ACTION_EXECUTE_REPAIR_FILE_H__
-
-#include <windows.h>
-#include <atlstr.h>
-
-namespace omaha {
-
-// Verifies the repair file and executes it.
-HRESULT VerifyFileAndExecute(const CString& filename, const CString& args);
-
-}  // namespace omaha
-
-#endif  // OMAHA_RECOVERY_REPAIR_EXE_CUSTOM_ACTION_EXECUTE_REPAIR_FILE_H__
diff --git a/recovery/repair_exe/custom_action/execute_repair_file_unittest.cc b/recovery/repair_exe/custom_action/execute_repair_file_unittest.cc
deleted file mode 100644
index 1999970..0000000
--- a/recovery/repair_exe/custom_action/execute_repair_file_unittest.cc
+++ /dev/null
@@ -1,145 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-//
-// Unit tests for the file execution module of the MSP custom action.
-
-#include "omaha/base/app_util.h"
-#include "omaha/base/file.h"
-#include "omaha/base/path.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/recovery/repair_exe/custom_action/execute_repair_file.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-// The valid repair file saves the arguments passed to it to a file.
-void RunAndVerifySavedArgs(const CString& args) {
-  CString expected_copy_path =
-      _T("%PROGRAMFILES%\\Google\\Update\\SaveArguments.exe");
-  EXPECT_SUCCEEDED(ExpandStringWithSpecialFolders(&expected_copy_path));
-  CString saved_arguments_file_path =
-      _T("%PROGRAMFILES%\\Google\\Update\\saved_arguments.txt");
-  EXPECT_SUCCEEDED(ExpandStringWithSpecialFolders(&saved_arguments_file_path));
-
-  CString repair_file(app_util::GetCurrentModuleDirectory());
-  EXPECT_TRUE(::PathAppend(CStrBuf(repair_file, MAX_PATH),
-              _T("unittest_support\\SaveArguments.exe")));
-
-  ::DeleteFile(saved_arguments_file_path);
-
-  if (vista_util::IsUserAdmin()) {
-    EXPECT_FALSE(File::Exists(saved_arguments_file_path));
-
-    EXPECT_SUCCEEDED(omaha::VerifyFileAndExecute(repair_file, args));
-
-    bool is_found = false;
-    for (int tries = 0; tries < 100 && !is_found; ++tries) {
-      ::Sleep(50);
-      is_found = File::Exists(saved_arguments_file_path);
-    }
-    ASSERT_TRUE(is_found);
-
-    scoped_hfile file;
-    for (int tries = 0; tries < 100 && !valid(file); ++tries) {
-      ::Sleep(50);
-      reset(file, ::CreateFile(saved_arguments_file_path,
-                               GENERIC_READ,
-                               0,                        // do not share
-                               NULL,                     // default security
-                               OPEN_EXISTING,            // existing file only
-                               FILE_ATTRIBUTE_NORMAL,
-                               NULL));                   // no template
-    }
-    ASSERT_TRUE(valid(file));
-
-    const int kBufferLen = 50;
-    TCHAR buffer[kBufferLen + 1] = {0};
-    DWORD bytes_read = 0;
-
-    // Do not assume the buffer read by ReadFile remains zero-terminated.
-    EXPECT_TRUE(::ReadFile(get(file),
-                           buffer,
-                           kBufferLen * sizeof(TCHAR),
-                           &bytes_read,
-                           NULL));
-    EXPECT_EQ(0, bytes_read % sizeof(TCHAR));
-    buffer[bytes_read / sizeof(TCHAR)] = _T('\0');
-    EXPECT_STREQ(args, buffer);
-
-    reset(file);
-
-    ::DeleteFile(expected_copy_path);
-    EXPECT_TRUE(::DeleteFile(saved_arguments_file_path));
-  } else {
-    const bool expected_file_exists = File::Exists(saved_arguments_file_path);
-    EXPECT_EQ(E_ACCESSDENIED, omaha::VerifyFileAndExecute(repair_file, args));
-
-    // We can't force the file to be deleted, so make sure it wasn't created
-    // or deleted by the above method.
-    EXPECT_EQ(expected_file_exists, File::Exists(saved_arguments_file_path));
-  }
-}
-
-}  // namespace
-
-TEST(ExecuteRepairFileTest, VerifyFileAndExecute_EmptyFilename) {
-  EXPECT_EQ(E_INVALIDARG, VerifyFileAndExecute(_T(""), _T("")));
-}
-
-TEST(ExecuteRepairFileTest, VerifyFileAndExecute_FileDoesNotExist) {
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            VerifyFileAndExecute(_T("no_such_file.exe"), _T("")));
-}
-
-TEST(ExecuteRepairFileTest, VerifyFileAndExecute_FilenameIsDirectory) {
-  EXPECT_EQ(E_ACCESSDENIED,
-            VerifyFileAndExecute(_T("C:\\Windows"), _T("")));
-}
-
-TEST(ExecuteRepairFileTest, VerifyFileAndExecute_UnsignedFile) {
-  CString expected_copy_path =
-      _T("%PROGRAMFILES%\\Google\\Update\\GoogleUpdate_unsigned.exe");
-  EXPECT_SUCCEEDED(ExpandStringWithSpecialFolders(&expected_copy_path));
-  CString repair_file(app_util::GetCurrentModuleDirectory());
-  EXPECT_TRUE(::PathAppend(CStrBuf(repair_file, MAX_PATH),
-              _T("GoogleUpdate_unsigned.exe")));
-
-  if (vista_util::IsUserAdmin()) {
-    EXPECT_EQ(TRUST_E_NOSIGNATURE, VerifyFileAndExecute(repair_file, _T("")));
-
-    EXPECT_TRUE(File::Exists(expected_copy_path));
-    EXPECT_TRUE(::DeleteFile(expected_copy_path));
-  } else {
-    const bool expected_file_exists = File::Exists(expected_copy_path);
-    EXPECT_EQ(E_ACCESSDENIED, VerifyFileAndExecute(repair_file, _T("")));
-
-    // We can't force the file to be deleted, so make sure it wasn't created
-    // or deleted by the above method.
-    EXPECT_EQ(expected_file_exists, File::Exists(expected_copy_path));
-  }
-}
-
-TEST(ExecuteRepairFileTest, VerifyFileAndExecute_ValidRepairFileWithArgs) {
-  RunAndVerifySavedArgs(_T("These /are the args."));
-}
-
-TEST(ExecuteRepairFileTest, VerifyFileAndExecute_ValidRepairFileWithoutArgs) {
-  RunAndVerifySavedArgs(_T(""));
-}
-
-}  // namespace omaha
diff --git a/recovery/repair_exe/custom_action/executecustomaction.cc b/recovery/repair_exe/custom_action/executecustomaction.cc
deleted file mode 100644
index 2f1a5d4..0000000
--- a/recovery/repair_exe/custom_action/executecustomaction.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Custom action helper DLL:
-// The custom actions created in this project are for Google Update MSI patch,
-// which is installed temporarily and uses this DLL to verify a downloaded
-// executable and run it with elevated privileges.
-
-
-#include "omaha/recovery/repair_exe/custom_action/executecustomaction.h"
-#include <msiquery.h>
-#include "omaha/base/debug.h"
-#include "omaha/recovery/repair_exe/mspexecutableelevator.h"
-#include "omaha/recovery/repair_exe/custom_action/execute_repair_file.h"
-
-namespace {
-
-omaha::CustomActionModule _AtlModule;
-
-}  // namespace
-
-// DLL Entry Point
-extern "C" BOOL WINAPI DllMain(HINSTANCE,
-                               DWORD dwReason,
-                               LPVOID lpReserved) {
-  return _AtlModule.DllMain(dwReason, lpReserved);
-}
-
-// Verify an executable and run it
-UINT __stdcall VerifyFileAndExecute(MSIHANDLE install_handle) {
-  TCHAR custom_action_data[2048] = {0};
-  DWORD size = ARRAYSIZE(custom_action_data) - 1;
-  *custom_action_data = _T('\0');
-  if (ERROR_SUCCESS == ::MsiGetProperty(install_handle,
-                                        _T("CustomActionData"),
-                                        custom_action_data,
-                                        &size) &&
-      _T('\0') != *custom_action_data) {
-    custom_action_data[ARRAYSIZE(custom_action_data) - 1] = _T('\0');
-
-    TCHAR* executable = NULL;
-    TCHAR* arguments = NULL;
-    DWORD calling_process_id = 0;
-    if (omaha::msp_executable_elevator::ParseMSPCommandLine(
-            custom_action_data,
-            &executable,
-            &arguments,
-            &calling_process_id) &&
-        executable && arguments) {
-      HRESULT hr = omaha::VerifyFileAndExecute(executable, arguments);
-      VERIFY1(omaha::msp_executable_elevator::SetResultOfExecute(NULL, hr));
-    }
-  }
-  return 0;
-}
-
-// 4505: unreferenced local function has been removed
-#pragma warning(disable : 4505)
diff --git a/recovery/repair_exe/custom_action/executecustomaction.def b/recovery/repair_exe/custom_action/executecustomaction.def
deleted file mode 100644
index 827e1fd..0000000
--- a/recovery/repair_exe/custom_action/executecustomaction.def
+++ /dev/null
@@ -1,19 +0,0 @@
-; Copyright 2007-2009 Google Inc.
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-;      http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-; ========================================================================
-
-LIBRARY      "executecustomaction.dll"
-
-EXPORTS
-  VerifyFileAndExecute
diff --git a/recovery/repair_exe/custom_action/executecustomaction.h b/recovery/repair_exe/custom_action/executecustomaction.h
deleted file mode 100644
index 033f6f7..0000000
--- a/recovery/repair_exe/custom_action/executecustomaction.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Header files to precompile for the installer.
-
-#ifndef  OMAHA_RECOVERY_REPAIR_EXE_CUSTOM_ACTION_EXECUTECUSTOMACTION_H__
-#define  OMAHA_RECOVERY_REPAIR_EXE_CUSTOM_ACTION_EXECUTECUSTOMACTION_H__
-
-#include <windows.h>
-#include <msi.h>
-#include <atlbase.h>
-
-namespace omaha {
-
-class CustomActionModule : public CAtlDllModuleT<CustomActionModule> {
- public:
-  CustomActionModule() {}
-  ~CustomActionModule() {}
-};
-
-}  // namespace omaha
-
-extern "C"
-UINT __stdcall VerifyFileAndExecute(MSIHANDLE);
-
-#endif  // OMAHA_RECOVERY_REPAIR_EXE_CUSTOM_ACTION_EXECUTECUSTOMACTION_H__
diff --git a/recovery/repair_exe/custom_action/testelevateusingmsp.cc b/recovery/repair_exe/custom_action/testelevateusingmsp.cc
deleted file mode 100644
index f1f9714..0000000
--- a/recovery/repair_exe/custom_action/testelevateusingmsp.cc
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Command line utility that elevates an executable using an MSI Patch.
-// The MSI patch is assumed to be in the same directory as this executable.
-
-#include <windows.h>
-#include <atlstr.h>
-#include "omaha/base/constants.h"
-#include "omaha/recovery/repair_exe/mspexecutableelevator.h"
-
-int main(int argc, char** argv) {
-  DWORD process_id = 0;
-  if (2 <= argc) {
-    CString arguments;
-    if (3 <= argc) {
-      arguments = argv[2];
-    }
-    HANDLE process = NULL;
-    HRESULT hr = omaha::msp_executable_elevator::ExecuteGoogleSignedExe(
-        CString(argv[1]),
-        arguments,
-        omaha::kHelperInstallerProductGuid,
-        omaha::kHelperPatchGuid,
-        omaha::kHelperPatchName,
-        &process);
-    if (process) {
-      process_id = ::GetProcessId(process);
-      ::CloseHandle(process);
-    }
-    wprintf(_T("%s (process handle:%x process id: %u hresult:%x)"),
-           (SUCCEEDED(hr) ? _T("Success") : _T("Failure")),
-           process,
-           process_id,
-           static_cast<int>(hr));
-  } else {
-    static TCHAR explain_test[] =
-      _T("testelevateusingmsp\n\n")
-      _T("To use this test, pass the full path to an executable containing ")
-      _T("the Google Update Repair resource and is signed with a Google ")
-      _T("code-signing certificate that has a certain subject and ")
-      _T("organization unit name.")
-      _T("\n\nAn optional parameter to that executable may be passed as well.");
-    wprintf(explain_test);
-  }
-  return process_id;
-}
diff --git a/recovery/repair_exe/msp/build.scons b/recovery/repair_exe/msp/build.scons
deleted file mode 100644
index cbe8e6b..0000000
--- a/recovery/repair_exe/msp/build.scons
+++ /dev/null
@@ -1,162 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-#
-# Hammer file to create the stub .msi and .msp files
-#
-
-import os
-import stat
-
-Import('env')
-
-_repair_exe_obj_dir = '$OBJ_ROOT/recovery/repair_exe/'
-
-_custom_actions_path = (
-    _repair_exe_obj_dir + 'custom_action/executecustomaction.dll')
-_cert_file = env.File(GetOption('patching_certificate')).abspath
-_required_file = '$MAIN_DIR/recovery/repair_exe/msp/requiredfile.txt'
-
-# TODO(omaha): Update the build machine command lines to use
-# patching_certificate instead of authenticode_file and remove this.
-# The following is for backwards compatibility. Historically, the build server,
-# as specified the patching_certificate with --authenticode_file.
-if (env.Bit('build_server') and
-    GetOption('patching_certificate') == '$MAIN_DIR/data/OmahaTestCert.cer'):
-  _cert_file = env.File(GetOption('authenticode_file')).abspath
-
-
-omaha_version_info = env['omaha_versions_info'][0]
-omaha_version_string = omaha_version_info.GetVersionString()
-
-old_unsigned_env = env.Clone()
-old_unsigned_env.Append(
-    WIXCANDLEFLAGS = [
-        '-dFinalMsi=0',
-        '-dCertificateFile=' + _cert_file,
-        '-dRequiredFile=' + env.File(_required_file).abspath,
-        '-dGoogleUpdateVersion=' + omaha_version_string,
-        ],
-    WIXLIGHTFLAGS = [
-        '-dRequiredFile=' + env.File(_required_file).abspath,
-        ],
-)
-
-old_unsigned_output = old_unsigned_env.WiX('GoogleUpdateHelper_unsigned.msi',
-    'patchableinstaller.wxs')
-
-env.Depends(old_unsigned_output, [_custom_actions_path, _required_file])
-
-
-new_unsigned_env = env.Clone()
-new_unsigned_env.Append(
-    WIXCANDLEFLAGS = [
-        '-dFinalMsi=1',
-        '-dExecuteCustomActionDLL=' + env.File(_custom_actions_path).abspath,
-        '-dCertificateFile=' + _cert_file,
-        '-dRequiredFile=' + env.File(_required_file).abspath,
-        '-dGoogleUpdateVersion=' + omaha_version_string,
-        ],
-    WIXLIGHTFLAGS = [
-        '-dRequiredFile=' + env.File(_required_file).abspath,
-        ],
-)
-
-# Output to a subdirectory to avoid build breaks caused by two different actions
-# referencing files with the same name and path.
-new_unsigned_env['WIXOBJPREFIX'] = new_unsigned_env['WIXOBJPREFIX'] + 'new/'
-
-new_unsigned_output = new_unsigned_env.WiX(
-    target='new/GoogleUpdateHelper_unsigned.msi',
-    source='patchableinstaller.wxs'
-)
-
-env.Depends(new_unsigned_output, [_custom_actions_path, _required_file])
-
-
-#
-# Create the MSP file
-#
-msp_env = env.Clone()
-
-patch_output = msp_env.Command(
-    target='patch.wixobj',
-    source='patch.wxs',
-    action=('@candle.exe -nologo -out $TARGET $SOURCE -dAfterImage=%s'
-            ' -dBeforeImage=%s' % (env.File(new_unsigned_output[0]).abspath,
-                                   env.File(old_unsigned_output[0]).abspath))
-)
-
-# Required because the before and after images are not in the source.
-Depends(patch_output, [new_unsigned_output, old_unsigned_output])
-
-pcp_output = msp_env.Command(
-    target='patch.pcp',
-    source=patch_output,
-    action='@light.exe -nologo -out $TARGET $SOURCE'
-)
-
-# The PCP, and thus the MSP, fail to rebuild when the MSI files change without
-# this explicit dependency, probably because the .wixobj hash does not change.
-Depends(pcp_output, [patch_output, old_unsigned_output, new_unsigned_output])
-
-# Delete temp dir that vista sdk version of msimsp.exe cannot remove for itself.
-_temp_dir = os.path.join(env['ENV']['TMP'], '~pcw_tmp.tmp')
-if os.path.exists(_temp_dir):
-  # Recursively delete subdirectories
-  def rm_rf(dir):
-    for file in os.listdir(dir):
-      path = os.path.join(dir, file)
-      if os.path.isdir(path):
-        rm_rf(path)
-      else:
-        os.chmod(path, stat.S_IWRITE)  # Make sure file is writeable.
-        os.remove(path)
-    os.rmdir(dir)
-
-  # Remove the temp dir.
-  rm_rf(_temp_dir)
-
-unsigned_msp_name = 'GoogleUpdateHelperPatch_unsigned.msp'
-unsigned_msp_path = _repair_exe_obj_dir + 'msp/' + unsigned_msp_name
-
-msp_output = msp_env.Command(
-    target=unsigned_msp_name,
-    source=pcp_output,
-    action='@msimsp.exe -s $SOURCE -p $TARGET -l %s' % (
-        env.File(unsigned_msp_path + '.log').abspath),
-)
-
-# For unknown reasons, the PCP fails to rebuild and cause the MSP to rebuild
-# when the MSI files change without this explicit dependency.
-Depends(msp_output, pcp_output)
-
-
-#
-# Sign the old MSI and MSP
-#
-signed_msi = env.SignedBinary(
-    target='GoogleUpdateHelper.msi',
-    source=old_unsigned_output,
-)
-
-signed_msp = env.SignedBinary(
-    target='GoogleUpdateHelperPatch.msp',
-    source=msp_output,
-)
-
-env.Replicate('$STAGING_DIR', [signed_msi, signed_msp])
diff --git a/recovery/repair_exe/msp/patch.wxs b/recovery/repair_exe/msp/patch.wxs
deleted file mode 100644
index c46dcef..0000000
--- a/recovery/repair_exe/msp/patch.wxs
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
-  <PatchCreation Id="E0D0D2C9-5836-4023-AB1D-54EC3B90AD03"
-    AllowMajorVersionMismatches="no"
-    AllowProductCodeMismatches="no"
-    CleanWorkingFolder="yes"
-    WholeFilesOnly="yes">
-
-    <PatchInformation
-      Description="Patches Google Update"
-      Comments="Copyright 2007-2010 Google Inc."
-      Keywords="Installer"
-      Manufacturer="Google Inc."
-      ShortNames="no"
-      Languages="1033"
-      Compressed="no"
-      SummaryCodepage="1252" />
-
-    <!--TODO(omaha): Use kUrlMoreInformation for MoreInfoURL.-->
-    <PatchMetadata
-      Description="Patches Google Update"
-      DisplayName="Google Update patch"
-      TargetProductName="Google Update"
-      ManufacturerName="Google Inc."
-      MoreInfoURL="http://www.google.com/support/installer/?patch"
-      Classification="Service Pack"
-      AllowRemoval="yes" />
-
-    <Family DiskId="2" MediaSrcProp="GoogleUpdatePatchSrcPropName"
-            Name="GoogleUp" SequenceStart="1000">
-      <UpgradeImage Id="AfterImage" SourceFile="$(var.AfterImage)">
-        <TargetImage Id="BeforeImage" SourceFile="$(var.BeforeImage)"
-                     Order="2" IgnoreMissingFiles="no" />
-      </UpgradeImage>
-    </Family>
-
-    <TargetProductCode Id="A92DAB39-4E2C-4304-9AB6-BC44E68B55E2" />
-  </PatchCreation>
-</Wix>
diff --git a/recovery/repair_exe/msp/patchableinstaller.wxs b/recovery/repair_exe/msp/patchableinstaller.wxs
deleted file mode 100644
index 71f38d1..0000000
--- a/recovery/repair_exe/msp/patchableinstaller.wxs
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
-  <Product Id="A92DAB39-4E2C-4304-9AB6-BC44E68B55E2"
-    Name="Google Update Helper"
-    Language="1033"
-    Codepage="1252"
-    UpgradeCode="9515FFBD-40AB-4690-B983-4FA8E14EE7F5"
-    Version="$(var.GoogleUpdateVersion)"
-    Manufacturer="Google Inc.">
-
-    <Package Id="*"
-      Description="Google Update Helper"
-      Comments="Copyright 2007-2010 Google Inc."
-      Manufacturer="Google Inc."
-      Languages="1033"
-      SummaryCodepage="1252"
-      InstallerVersion="300"
-      InstallPrivileges="elevated"
-      Compressed="no" />
-
-    <!-- Cannot patch an msi without a file -->
-    <Media Id="1" Cabinet="required.cab" EmbedCab="yes"/>
-
-    <Directory Id="TARGETDIR" Name="SourceDir">
-      <Directory Id="ProgramFilesFolder">
-        <Directory Id="GoogleProgramDir" Name="Google">
-          <Directory Id="UpdateDir" Name="Update">
-
-            <Component Id="MainComponent" Guid="717B7059-A988-492f-AF1B-DCF70BE809AB">
-              <!-- Cannot have an msi patch without a file -->
-<?if $(var.FinalMsi) = 1 ?>
-              <File Id="RequiredFile" Name="RequiredFile.txt" DiskId="1" Source="$(var.RequiredFile)" Vital="yes"/>
-<?endif?>
-              <!-- Cannot have an empty component -->
-              <RegistryValue Id="NonEmptyComponent" Action="write" Root="HKLM" Key="SOFTWARE\Google\Update" Name="MsiStubRun" Type="integer" Value="0" />
-            </Component>
-
-          </Directory>
-        </Directory>
-      </Directory>
-    </Directory>
-
-    <PatchCertificates>
-      <DigitalCertificate Id="CertificateForPatching" SourceFile="$(var.CertificateFile)" />
-    </PatchCertificates>
-
-    <Feature Id="Complete" Level="1">
-      <ComponentRef Id="MainComponent" />
-    </Feature>
-
-<?if $(var.FinalMsi) = 1 ?>
-    <Binary Id="ExecuteLibrary" SourceFile="$(var.ExecuteCustomActionDLL)" />
-
-    <!-- Need to mark these custom properties as secure so that in Vista they are passed to the high-integrity msi server -->
-    <Property Id="EXECUTABLECOMMANDLINE" Secure="yes"/>
-
-    <CustomAction Id="LaunchFile.PropertyAssign" Property="LaunchFile" Value="[EXECUTABLECOMMANDLINE]" />
-
-    <CustomAction Id="LaunchFile" Return="ignore" Execute="deferred" Impersonate="no"
-      BinaryKey="ExecuteLibrary" DllEntry="VerifyFileAndExecute"/>
-
-    <InstallExecuteSequence>
-      <Custom Action="LaunchFile.PropertyAssign" Before="LaunchFile">NOT EXECUTABLECOMMANDLINE=""</Custom>
-      <Custom Action="LaunchFile" Before="InstallFinalize">NOT EXECUTABLECOMMANDLINE=""</Custom>
-    </InstallExecuteSequence>
-<?endif?>
-
-    <!-- Make sure the product shows up for all users -->
-    <Property Id="ALLUSERS" Value="1" />
-
-    <!-- Hide ARP entry -->
-    <Property Id="ARPSYSTEMCOMPONENT" Value="1" />
-
-    <!-- Disable rollback to make the msi and patch a little faster.
-         If an install, patch, or unpatch fails, it is ok to leave behind a partial install/patch/unpatch.
-         A failed install prevents patching anyway.
-         A failed patch should not stop us from patching again (at least for a few more times).
-         Rolling back a failed unpatch does not enable us to patch again.
-         And in all cases, the uninstaller should clean up whatever may be left behind. -->
-    <Property Id="DISABLEROLLBACK" Value="1" />
-
-  </Product>
-</Wix>
diff --git a/recovery/repair_exe/msp/requiredfile.txt b/recovery/repair_exe/msp/requiredfile.txt
deleted file mode 100644
index 0b41061..0000000
--- a/recovery/repair_exe/msp/requiredfile.txt
+++ /dev/null
@@ -1 +0,0 @@
-A file is required to patch an MSI.
\ No newline at end of file
diff --git a/recovery/repair_exe/msp/setup_env.bat b/recovery/repair_exe/msp/setup_env.bat
deleted file mode 100644
index 3ddcc76..0000000
--- a/recovery/repair_exe/msp/setup_env.bat
+++ /dev/null
@@ -1,5 +0,0 @@
-:: This script must not rely on any external tools or PATH values.
-@echo OFF
-
-:: Creating the MSP requires the msimsp.exe from the 2003 R2 SDK
-set PATH=%PATH%;%~dp0..\..\..\..\third_party\platformsdk_win_server_2003_r2_partial\Samples\SysMgmt\Msi\Patching
diff --git a/recovery/repair_exe/msp/testApplying300Patches.bat b/recovery/repair_exe/msp/testApplying300Patches.bat
deleted file mode 100644
index db59a5b..0000000
--- a/recovery/repair_exe/msp/testApplying300Patches.bat
+++ /dev/null
@@ -1,23 +0,0 @@
-@echo off
-
-rem normally, only 127 patches can be applied to an msi
-
-set /A ii=0
-
-rem msiexec /i GoogleUpdateHelper.msi /qn
-rem echo original product installed
-
-:repeat
-
-msiexec /update GoogleUpdateHelperPatch.msp REINSTALL=ALL /qn /L*v patchapply%ii%.log
-echo patch %ii% applied
-if %ii% GEQ 127 pause
-msiexec /uninstall {E0D0D2C9-5836-4023-AB1D-54EC3B90AD03} /package {A92DAB39-4E2C-4304-9AB6-BC44E68B55E2} /qn /L*v patchremove%ii%.log
-echo patch %ii% removed
-
-set /A ii=%ii%+1
-
-if %ii% NEQ 300 goto repeat
-rem if %ii% NEQ 127 goto repeat
-
-set ii=
diff --git a/recovery/repair_exe/mspexecutableelevator.cc b/recovery/repair_exe/mspexecutableelevator.cc
deleted file mode 100644
index cdf571b..0000000
--- a/recovery/repair_exe/mspexecutableelevator.cc
+++ /dev/null
@@ -1,215 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// This is the implementation of the API for verifying and executing
-// an executable under high integrity using an Msi Patch.
-//
-// This class assumes the following:
-//  1) its needed Msi has already been installed,
-//  2) its needed Msp is in the same directory as this module,
-//  3) the name of the Msp file,
-//  4) the name of the property passed as CustomActionData to the custom action,
-//  5) the guid of the patch, and
-//  6) the guid of the Msi install which will be patched.
-
-#define _WIN32_MSI 300
-
-#include "omaha/recovery/repair_exe/mspexecutableelevator.h"
-#include <atlpath.h>
-#include <msi.h>
-#include "omaha/base/debug.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/string.h"
-
-namespace omaha {
-
-namespace msp_executable_elevator {
-
-// Used to return information back to the process that called
-// ExecuteGoogleSignedExe.
-struct SharedMemoryInfo {
-  HANDLE process;
-  HRESULT launch_result;
-};
-
-// Used to store the name of the shared memory.  The name is retrieved from
-// the MSP command line when parsing the command line.  The code assumes that
-// only one thread per process will call ParseMSPCommandLine followed by
-// SetResultOfExecute (which is a safe assumption if this functionality is only
-// used for the purpose for which it was originally written).
-// Assumes that the MSP is in the same directory as the current process.
-static TCHAR parsed_shared_memory_name[200];
-
-HRESULT ExecuteGoogleSignedExe(const TCHAR* exe,
-                               const TCHAR* args,
-                               const TCHAR* kProductGuid,
-                               const TCHAR* kPatchGuid,
-                               const TCHAR* kPatchName,
-                               HANDLE* process) {
-  ASSERT1(exe);
-  ASSERT1(args);
-  ASSERT1(process);
-  ASSERT1(kProductGuid);
-  ASSERT1(kPatchGuid);
-  ASSERT1(kPatchName);
-
-  // Create shared memory in which to receive result of attempt to launch
-  // process and a handle to the launched process.
-  HRESULT hr = E_FAIL;
-  GUID random_guid = {0};
-  TCHAR shared_memory_name[200] = {0};
-  if (SUCCEEDED(::CoCreateGuid(&random_guid)) &&
-      0 < ::StringFromGUID2(random_guid,
-                            shared_memory_name,
-                            ARRAYSIZE(shared_memory_name))) {
-    HANDLE file_mapping = ::CreateFileMapping(INVALID_HANDLE_VALUE,
-                                              NULL,
-                                              PAGE_READWRITE,
-                                              0,
-                                              sizeof(file_mapping),
-                                              shared_memory_name);
-    if (file_mapping) {
-      SharedMemoryInfo* shared_info = reinterpret_cast<SharedMemoryInfo*>
-          (::MapViewOfFileEx(file_mapping,
-                             FILE_MAP_ALL_ACCESS,
-                             0,
-                             0,
-                             sizeof(*shared_info),
-                             0));
-      if (shared_info) {
-        shared_info->launch_result = E_FAIL;
-        shared_info->process = NULL;
-        // Create command line to pass to patch.  Parameters are the name of the
-        // shared memory just created, the current process id, the executable
-        // to launch, and the executable's arguments.
-        CString command_line;
-        SafeCStringFormat(&command_line,
-                          _T("EXECUTABLECOMMANDLINE=\"%s %u \"\"%s\"\" %s\" ")
-                          _T("REINSTALL=ALL"),
-                          shared_memory_name,
-                          GetCurrentProcessId(),
-                          exe,
-                          args);
-        // Generate path to patch using path to current module.
-        TCHAR module_name[MAX_PATH] = {0};
-        DWORD len = ::GetModuleFileName(_AtlBaseModule.GetModuleInstance(),
-                                        module_name,
-                                        ARRAYSIZE(module_name));
-        module_name[ARRAYSIZE(module_name) - 1] = '\0';
-        if (0 < len && len < ARRAYSIZE(module_name) &&
-            0 < command_line.GetLength()) {
-          CPath path = module_name;
-          if (path.RemoveFileSpec() && path.Append(kPatchName)) {
-            path.Canonicalize();
-            // Set install level to none so that user does not see
-            // an Msi window and so that a restore point is not created.
-            ::MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
-            UINT res = ::MsiApplyPatch(path,
-                                       NULL,
-                                       INSTALLTYPE_DEFAULT,
-                                       command_line);
-            // MsiApplyPatch will not return until the passed executable has
-            // been launched (or not) and the shared memory has been updated.
-            *process = shared_info->process;
-            hr = HRESULT_FROM_WIN32(res);
-            if (SUCCEEDED(hr))
-              hr = shared_info->launch_result;
-          }
-        }
-        ::MsiRemovePatches(kPatchGuid,
-                           kProductGuid,
-                           INSTALLTYPE_SINGLE_INSTANCE,
-                           NULL);
-        VERIFY1(::UnmapViewOfFile(shared_info));
-      }
-      VERIFY1(::CloseHandle(file_mapping));
-    }
-  }
-  return hr;
-}
-
-bool ParseMSPCommandLine(TCHAR* command_line,
-                         TCHAR** executable_result,
-                         TCHAR** arguments_result,
-                         DWORD* calling_process_id) {
-  ASSERT1(command_line);
-  ASSERT1(executable_result);
-  ASSERT1(arguments_result);
-  ASSERT1(calling_process_id);
-  // Parse command line.  First extract name of shared memory into which
-  // the process handle of launched executable will be written.  Then extract
-  // the process id of calling process.  This process id will be used to create
-  // for the calling process a handle to the launched executable. Finally,
-  // extract the path to executable so that we can verify the executable.
-  TCHAR* shared_memory_name = NULL;
-  TCHAR* process_id_param = NULL;
-  TCHAR* arguments = NULL;
-  if (SplitCommandLineInPlace(command_line, &shared_memory_name, &arguments) &&
-      shared_memory_name && arguments &&
-      SplitCommandLineInPlace(arguments, &process_id_param, &arguments) &&
-      process_id_param && arguments &&
-      SplitCommandLineInPlace(arguments, executable_result, &arguments) &&
-      *executable_result && arguments) {
-    *calling_process_id = static_cast<DWORD>(_wtoi(process_id_param));
-    *arguments_result = arguments;
-    _tcsncpy(parsed_shared_memory_name,
-             shared_memory_name,
-             ARRAYSIZE(parsed_shared_memory_name));
-    parsed_shared_memory_name[ARRAYSIZE(parsed_shared_memory_name) - 1] =
-        _T('\0');
-    return true;
-  }
-  return false;
-}
-
-// Copy process handle and result to shared memory.
-// Process can be NULL.
-bool SetResultOfExecute(HANDLE process, HRESULT result) {
-  bool success = false;
-  if (_T('\0') != *parsed_shared_memory_name) {
-    HANDLE file_mapping = ::OpenFileMapping(FILE_MAP_WRITE,
-                                            FALSE,
-                                            parsed_shared_memory_name);
-    if (file_mapping) {
-      SharedMemoryInfo* shared_info = reinterpret_cast<SharedMemoryInfo*>
-          (::MapViewOfFileEx(file_mapping,
-                             FILE_MAP_WRITE,
-                             0,
-                             0,
-                             sizeof(SharedMemoryInfo),
-                             0));
-      if (shared_info) {
-        shared_info->process = process;
-        shared_info->launch_result = result;
-        VERIFY1(::UnmapViewOfFile(shared_info));
-        success = true;
-      } else {
-        ASSERT(false, (_T("::MapViewOfFileEx failed.")));
-      }
-
-      VERIFY1(::CloseHandle(file_mapping));
-    } else {
-      ASSERT(false, (_T("::OpenFileMapping failed.")));
-    }
-  } else {
-    ASSERT(false, (_T("parsed_shared_memory_name is empty.")));
-  }
-  return success;
-}
-
-}  // namespace msp_executable_elevator
-
-}  // namespace omaha
-
diff --git a/recovery/repair_exe/mspexecutableelevator.h b/recovery/repair_exe/mspexecutableelevator.h
deleted file mode 100644
index 0cc35d5..0000000
--- a/recovery/repair_exe/mspexecutableelevator.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// This is the API for verifying and executing an executable under high
-// integrity using an Msi Patch.  This API assumes its needed Msi has already
-// been installed and its needed Msp is in the same directory as this module.
-//
-// This class encapsulates the code for passing information between a process
-// requesting that an executable be elevated and the custom action DLL
-// in the patch which actually elevates the executable.
-
-#ifndef OMAHA_RECOVERY_REPAIR_EXE_MSPEXECUTABLEELEVATOR_H__
-#define OMAHA_RECOVERY_REPAIR_EXE_MSPEXECUTABLEELEVATOR_H__
-
-#include <windows.h>
-#include <tchar.h>
-
-namespace omaha {
-
-namespace msp_executable_elevator {
-
-// The following function should be called by the code requesting that
-// an executable be elevated:
-
-// Use an MSI patch to verify and execute an executable.  Returns a handle
-// to the process executed.
-HRESULT ExecuteGoogleSignedExe(const TCHAR* executable,
-                               const TCHAR* arguments,
-                               const TCHAR* kProductGuid,
-                               const TCHAR* kPatchGuid,
-                               const TCHAR* kPatchName,
-                               HANDLE* process);
-
-// The following functions should be called by the code (i.e., the custom action
-// DLL) that actually elevates the executable:
-
-// From the command line passed to the MSP, retrieve the parameters that will be
-// passed to VerifyFileAndExecute.
-// This function is destructive to the passed command line buffer.  The pointers
-// "executable" and "arguments" will point into the command line buffer.
-bool ParseMSPCommandLine(TCHAR* command_line,
-                         TCHAR** executable,
-                         TCHAR** arguments,
-                         DWORD* calling_process_id);
-
-// Records the result of the call to VerifyFileAndExecute.
-bool SetResultOfExecute(HANDLE process, HRESULT result);
-
-}  // namespace msp_executable_elevator
-
-}  // namespace omaha
-
-#endif  // OMAHA_RECOVERY_REPAIR_EXE_MSPEXECUTABLEELEVATOR_H__
diff --git a/recovery/repair_exe/mspexecutableelevator_unittest.cc b/recovery/repair_exe/mspexecutableelevator_unittest.cc
deleted file mode 100644
index 4259014..0000000
--- a/recovery/repair_exe/mspexecutableelevator_unittest.cc
+++ /dev/null
@@ -1,264 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Unit tests for msp_executable_elevator.
-//
-// Note for Windows Vista and later: These tests will fail because the Msi*
-// methods return an error because they do not elevate due to the UI level NONE.
-// Enabling the UI would cause UAC prompts and the creation of restore points.
-// The workaround is to run from an administrator command prompt.
-
-#include <windows.h>
-#include <msi.h>
-#include "omaha/base/app_util.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/file.h"
-#include "omaha/base/path.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/recovery/repair_exe/mspexecutableelevator.h"
-#include "omaha/setup/msi_test_utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-// Note: For some reason, the product ID GUIDs are swizzled in the registry.
-extern const TCHAR kMsiProductPatchesKey[] =
-    _T("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\")
-    _T("Installer\\UserData\\S-1-5-18\\Products\\")
-    _T("93BAD29AC2E44034A96BCB446EB8552E\\Patches");
-
-void InstallMsi() {
-  CString msi_path(app_util::GetCurrentModuleDirectory());
-  EXPECT_TRUE(::PathAppend(CStrBuf(msi_path, MAX_PATH),
-                           kHelperInstallerName));
-  ::MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
-
-  UINT res = ::MsiInstallProduct(msi_path, _T(""));
-
-  if (vista_util::IsUserAdmin()) {
-    if (ERROR_SUCCESS != res) {
-      EXPECT_EQ(ERROR_PRODUCT_VERSION, res);
-      // The product may already be installed. Force a reinstall of everything.
-      res = ::MsiInstallProduct(msi_path,
-                                _T("REINSTALL=ALL REINSTALLMODE=vamus"));
-    }
-    EXPECT_EQ(ERROR_SUCCESS, res);
-  } else {
-    if (IsMsiHelperInstalled()) {
-      EXPECT_EQ(ERROR_INSTALL_PACKAGE_REJECTED, res);
-    } else {
-      EXPECT_EQ(ERROR_INSTALL_FAILURE, res);
-    }
-  }
-}
-
-void RemoveMsi() {
-  ::MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
-  UINT res = ::MsiConfigureProduct(kHelperInstallerProductGuid,
-                                   INSTALLLEVEL_DEFAULT,
-                                   INSTALLSTATE_ABSENT);
-  if (vista_util::IsUserAdmin()) {
-    EXPECT_TRUE((ERROR_SUCCESS == res) ||
-                ((ERROR_UNKNOWN_PRODUCT == res) && !IsMsiHelperInstalled()));
-  } else {
-    if (IsMsiHelperInstalled()) {
-      EXPECT_EQ(ERROR_INSTALL_FAILURE, res);
-    } else {
-      EXPECT_EQ(ERROR_UNKNOWN_PRODUCT, res);
-    }
-  }
-}
-
-HRESULT ExecuteGoogleSignedExeWithCorrectPatchInfo(const TCHAR* executable,
-                                                   const TCHAR* arguments,
-                                                   HANDLE* process) {
-  return msp_executable_elevator::ExecuteGoogleSignedExe(
-                                      executable,
-                                      arguments,
-                                      kHelperInstallerProductGuid,
-                                      kHelperPatchGuid,
-                                      kHelperPatchName,
-                                      process);
-}
-
-// Base class for tests that expect the MSI to be installed.
-// The elevation mechanism will not be installed when these test complete.
-class RepairGoopdateWithMsiInstalledTest : public testing::Test {
- protected:
-  static void SetUpTestCase() {
-    InstallMsi();
-  }
-
-  static void TearDownTestCase() {
-    RemoveMsi();
-  }
-};
-
-// Base class for tests that expect the MSI not to be installed.
-// The elevation mechanism will not be installed when these test complete.
-class RepairGoopdateWithoutMsiInstalledTest : public testing::Test {
- protected:
-  static void SetUpTestCase() {
-    RemoveMsi();
-  }
-};
-
-TEST_F(RepairGoopdateWithMsiInstalledTest,
-       ExecuteGoogleSignedExe_RepairFileDoesNotExist) {
-  CString repair_file(_T("no_such_file.exe"));
-  HANDLE process = NULL;
-  HRESULT hr = ExecuteGoogleSignedExeWithCorrectPatchInfo(repair_file,
-                                                          _T(""),
-                                                          &process);
-  if (vista_util::IsUserAdmin() || IsMsiHelperInstalled()) {
-    EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), hr);
-  } else {
-    EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_PATCH_TARGET_NOT_FOUND), hr);
-  }
-
-  EXPECT_TRUE(NULL == process);
-}
-
-TEST_F(RepairGoopdateWithMsiInstalledTest,
-       ExecuteGoogleSignedExe_UnsignedFile) {
-  CString repair_file(app_util::GetCurrentModuleDirectory());
-  EXPECT_TRUE(::PathAppend(CStrBuf(repair_file, MAX_PATH),
-              _T("GoogleUpdate_unsigned.exe")));
-  HANDLE process = NULL;
-  HRESULT hr = ExecuteGoogleSignedExeWithCorrectPatchInfo(repair_file,
-                                                          _T(""),
-                                                          &process);
-  if (vista_util::IsUserAdmin() || IsMsiHelperInstalled()) {
-    EXPECT_EQ(TRUST_E_NOSIGNATURE, hr);
-  } else {
-    EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_PATCH_TARGET_NOT_FOUND), hr);
-  }
-  EXPECT_TRUE(NULL == process);
-}
-
-// This valid repair file saves the arguments passed to it to a file.
-TEST_F(RepairGoopdateWithMsiInstalledTest,
-       ExecuteGoogleSignedExe_ValidRepairFile) {
-  const TCHAR kArgs[] = _T("These /are the args.");
-  CString repair_file(app_util::GetCurrentModuleDirectory());
-  EXPECT_TRUE(::PathAppend(CStrBuf(repair_file, MAX_PATH),
-              _T("unittest_support\\SaveArguments.exe")));
-  CString program_files_path;
-  EXPECT_SUCCEEDED(GetFolderPath(CSIDL_PROGRAM_FILES, &program_files_path));
-  CString saved_arguments_file_path =
-      program_files_path + _T("\\Google\\Update\\saved_arguments.txt");
-
-  ::DeleteFile(saved_arguments_file_path);
-
-  bool is_msi_installed = IsMsiHelperInstalled();
-
-  if (vista_util::IsUserAdmin() || is_msi_installed) {
-    if (vista_util::IsUserAdmin()) {
-      EXPECT_FALSE(File::Exists(saved_arguments_file_path));
-    }
-
-    // Verify that no patch is installed.
-    EXPECT_TRUE(RegKey::HasNativeKey(kMsiProductPatchesKey));
-    RegKey product_patches_key;
-    EXPECT_SUCCEEDED(product_patches_key.Open(kMsiProductPatchesKey,
-                                              KEY_READ | KEY_WOW64_64KEY));
-    EXPECT_EQ(0, product_patches_key.GetSubkeyCount());
-
-    HANDLE process = NULL;
-    EXPECT_SUCCEEDED(ExecuteGoogleSignedExeWithCorrectPatchInfo(repair_file,
-                                                                kArgs,
-                                                                &process));
-    EXPECT_TRUE(NULL == process);
-
-    // Verify that patch was uninstalled.
-    // GetSubkeyCount fails if we don't re-open the key.
-    EXPECT_SUCCEEDED(product_patches_key.Open(kMsiProductPatchesKey,
-                                              KEY_READ | KEY_WOW64_64KEY));
-    EXPECT_EQ(0, product_patches_key.GetSubkeyCount());
-
-    bool is_found = false;
-    for (int tries = 0; tries < 100 && !is_found; ++tries) {
-      ::Sleep(50);
-      is_found = File::Exists(saved_arguments_file_path);
-    }
-    ASSERT_TRUE(is_found);
-
-    scoped_hfile file;
-    for (int tries = 0; tries < 100 && !valid(file); ++tries) {
-      ::Sleep(50);
-      reset(file, ::CreateFile(saved_arguments_file_path,
-                               GENERIC_READ,
-                               0,                        // do not share
-                               NULL,                     // default security
-                               OPEN_EXISTING,            // existing file only
-                               FILE_ATTRIBUTE_NORMAL,
-                               NULL));                   // no template
-    }
-    ASSERT_TRUE(valid(file));
-
-    const int kBufferLen = 50;
-    TCHAR buffer[kBufferLen + 1] = {0};
-    DWORD bytes_read = 0;
-
-    EXPECT_TRUE(::ReadFile(get(file),
-                           buffer,
-                           kBufferLen * sizeof(TCHAR),
-                           &bytes_read,
-                           NULL));
-    EXPECT_EQ(0, bytes_read % sizeof(TCHAR));
-    buffer[bytes_read / sizeof(TCHAR)] = _T('\0');
-    EXPECT_STREQ(kArgs, buffer);
-
-    reset(file);
-
-    bool succeeded = !!::DeleteFile(saved_arguments_file_path);
-    if (vista_util::IsUserAdmin()) {
-      EXPECT_TRUE(succeeded);
-    }
-  } else {
-    bool expected_file_exists = File::Exists(saved_arguments_file_path);
-    HANDLE process = NULL;
-    EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_PATCH_TARGET_NOT_FOUND),
-              ExecuteGoogleSignedExeWithCorrectPatchInfo(repair_file,
-                                                         kArgs,
-                                                         &process));
-    EXPECT_TRUE(NULL == process);
-
-    // We can't force the file to be deleted, so make sure it wasn't created
-    // or deleted by the above method.
-    EXPECT_EQ(expected_file_exists, File::Exists(saved_arguments_file_path));
-  }
-}
-
-TEST_F(RepairGoopdateWithoutMsiInstalledTest,
-       ExecuteGoogleSignedExe_MsiNotInstalled) {
-  if (!vista_util::IsUserAdmin() && IsMsiHelperInstalled()) {
-    std::wcout << _T("\tThis test did not run because the user is not an ")
-                  _T("admin and the MSI is already installed.") << std::endl;
-    return;
-  }
-
-  CString repair_file(_T("notepad.exe"));
-  HANDLE process = NULL;
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_PATCH_TARGET_NOT_FOUND),
-            ExecuteGoogleSignedExeWithCorrectPatchInfo(repair_file,
-                                                       _T(""),
-                                                       &process));
-  EXPECT_TRUE(NULL == process);
-}
-
-}  // namespace omaha
diff --git a/recovery/repair_exe/repair_goopdate.cc b/recovery/repair_exe/repair_goopdate.cc
deleted file mode 100644
index f881bf4..0000000
--- a/recovery/repair_exe/repair_goopdate.cc
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Helper for the Google Update repair file. It launches the same repair file
-// elevated using the MSP.
-
-#include "omaha/recovery/repair_exe/repair_goopdate.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/recovery/repair_exe/mspexecutableelevator.h"
-
-namespace omaha {
-
-// Returns without launching the repair file if is_machine is false, running
-// on a pre-Windows Vista OS, or the current user is Local System.
-// This method does not always launch the repair file because we expect this
-// to be called from the repair file, and there is no reason to launch another
-// process.
-bool LaunchRepairFileElevated(bool is_machine,
-                              const TCHAR* repair_file,
-                              const TCHAR* args,
-                              HRESULT* elevation_hr) {
-  ASSERT1(elevation_hr);
-
-  *elevation_hr = S_OK;
-
-  if (!is_machine) {
-    UTIL_LOG(L2,  (_T("[user instance - not elevating]")));
-    return false;
-  }
-  if (!vista_util::IsVistaOrLater()) {
-    UTIL_LOG(L2,  (_T("[Pre-Windows Vista OS - not elevating]")));
-    return false;
-  }
-
-  bool is_user_local_system = false;
-  HRESULT hr = IsSystemProcess(&is_user_local_system);
-  if (SUCCEEDED(hr) && is_user_local_system) {
-    UTIL_LOG(L2,  (_T("[User is already SYSTEM - not elevating]")));
-    return false;
-  }
-
-  HANDLE process = NULL;
-  *elevation_hr = msp_executable_elevator::ExecuteGoogleSignedExe(
-                                               repair_file,
-                                               args,
-                                               kHelperInstallerProductGuid,
-                                               kHelperPatchGuid,
-                                               kHelperPatchName,
-                                               &process);
-  // Our implementation of msp_executable_elevator does not set the process
-  // handle parameter, but we did not remove it from the borrowed code.
-  ASSERT1(!process);
-
-  if (FAILED(*elevation_hr)) {
-    UTIL_LOG(LE, (_T("[ExecuteGoogleSignedExe failed][error 0x%08x]"),
-                  *elevation_hr));
-    return false;
-  }
-
-  return true;
-}
-
-}  // namespace omaha
diff --git a/recovery/repair_exe/repair_goopdate.h b/recovery/repair_exe/repair_goopdate.h
deleted file mode 100644
index bfb2a3c..0000000
--- a/recovery/repair_exe/repair_goopdate.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Helper for the Google Update repair file. It launches the same repair file
-// elevated using the MSP.
-
-#ifndef OMAHA_RECOVERY_REPAIR_EXE_REPAIR_GOOPDATE_H__
-#define OMAHA_RECOVERY_REPAIR_EXE_REPAIR_GOOPDATE_H__
-
-#include <windows.h>
-#include <tchar.h>
-
-namespace omaha {
-
-// Launches the repair file elevated if necessary.
-// Returns whether the repair file was successfully launched elevated.
-// When the method returns false, the caller should execute the repair
-// operations unelevated. Otherwise, the caller is done.
-// Example:
-//   if (!LaunchRepairFileElevated(...)) {
-//     DoRepairUnelevated();
-//   }
-bool LaunchRepairFileElevated(bool is_machine,
-                              const TCHAR* repair_file,
-                              const TCHAR* args,
-                              HRESULT* elevation_hr);
-
-}  // namespace omaha
-
-#endif  // OMAHA_RECOVERY_REPAIR_EXE_REPAIR_GOOPDATE_H__
diff --git a/recovery/repair_exe/repair_goopdate_unittest.cc b/recovery/repair_exe/repair_goopdate_unittest.cc
deleted file mode 100644
index 5335098..0000000
--- a/recovery/repair_exe/repair_goopdate_unittest.cc
+++ /dev/null
@@ -1,228 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Unit tests for the Omaha repair mechanism.
-
-#include "omaha/base/app_util.h"
-#include "omaha/base/file.h"
-#include "omaha/base/path.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/recovery/repair_exe/repair_goopdate.h"
-#include "omaha/setup/msi_test_utils.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-const TCHAR kArgumentSavingExecutableRelativePath[] =
-    _T("unittest_support\\SaveArguments.exe");
-
-extern const TCHAR kMsiProductPatchesKey[];
-void InstallMsi();
-void RemoveMsi();
-
-class RepairGoopdateTest : public testing::Test {
- protected:
-  static void SetUpTestCase() {
-    valid_path = app_util::GetCurrentModuleDirectory();
-    VERIFY1(::PathAppend(CStrBuf(valid_path, MAX_PATH),
-                         kArgumentSavingExecutableRelativePath));
-  }
-
-  static CString valid_path;
-};
-
-CString RepairGoopdateTest::valid_path;
-
-TEST_F(RepairGoopdateTest, LaunchRepairFileElevated_UserInstance) {
-  HRESULT hr = E_FAIL;
-  EXPECT_FALSE(LaunchRepairFileElevated(false, valid_path, _T("/update"), &hr));
-  EXPECT_SUCCEEDED(hr);
-}
-
-// This test only runs on pre-Windows Vista OSes.
-TEST_F(RepairGoopdateTest, LaunchRepairFileElevated_MachineInstancePreVista) {
-  if (!vista_util::IsVistaOrLater()) {
-    HRESULT hr = E_FAIL;
-    EXPECT_FALSE(LaunchRepairFileElevated(true, valid_path, _T(""), &hr));
-    EXPECT_SUCCEEDED(hr);
-  }
-}
-
-// This test only runs on Windows Vista and later OSes.
-TEST_F(RepairGoopdateTest,
-       LaunchRepairFileElevated_MachineInstanceVistaWithMsiInstalledValidFile) {
-  if (!vista_util::IsVistaOrLater()) {
-    std::wcout << _T("\tThis test did not run because it requires Windows ")
-                  _T("Vista or later.") << std::endl;
-    return;
-  }
-
-  const TCHAR kArgs[] = _T("/update");
-  CString saved_arguments_file_path =
-      _T("%PROGRAMFILES%\\Google\\Update\\saved_arguments.txt");
-  EXPECT_SUCCEEDED(ExpandStringWithSpecialFolders(&saved_arguments_file_path));
-
-  ::DeleteFile(saved_arguments_file_path);
-
-  bool is_msi_installed = IsMsiHelperInstalled();
-
-  if (vista_util::IsUserAdmin() || is_msi_installed) {
-    if (vista_util::IsUserAdmin()) {
-      EXPECT_FALSE(File::Exists(saved_arguments_file_path));
-    }
-
-    InstallMsi();
-
-    // Verify that no patch is installed.
-    EXPECT_TRUE(RegKey::HasNativeKey(kMsiProductPatchesKey));
-    RegKey product_patches_key;
-    EXPECT_SUCCEEDED(product_patches_key.Open(kMsiProductPatchesKey,
-                                              KEY_READ | KEY_WOW64_64KEY));
-    EXPECT_EQ(0, product_patches_key.GetSubkeyCount());
-
-    HRESULT hr = E_FAIL;
-    EXPECT_TRUE(LaunchRepairFileElevated(true, valid_path, kArgs, &hr));
-    EXPECT_SUCCEEDED(hr);
-
-    // Verify that patch was uninstalled.
-    // GetSubkeyCount fails if we don't re-open the key.
-    EXPECT_SUCCEEDED(product_patches_key.Open(kMsiProductPatchesKey,
-                                              KEY_READ | KEY_WOW64_64KEY));
-    EXPECT_EQ(0, product_patches_key.GetSubkeyCount());
-
-    bool is_found = false;
-    for (int tries = 0; tries < 100 && !is_found; ++tries) {
-      ::Sleep(50);
-      is_found = File::Exists(saved_arguments_file_path);
-    }
-    ASSERT_TRUE(is_found);
-
-    scoped_hfile file;
-    for (int tries = 0; tries < 100 && !valid(file); ++tries) {
-      ::Sleep(50);
-      reset(file, ::CreateFile(saved_arguments_file_path,
-                               GENERIC_READ,
-                               0,                        // do not share
-                               NULL,                     // default security
-                               OPEN_EXISTING,            // existing file only
-                               FILE_ATTRIBUTE_NORMAL,
-                               NULL));                   // no template
-    }
-    ASSERT_TRUE(valid(file));
-
-    const int kBufferLen = 50;
-    TCHAR buffer[kBufferLen + 1] = {0};
-    DWORD bytes_read = 0;
-
-    EXPECT_TRUE(::ReadFile(get(file),
-                           buffer,
-                           kBufferLen * sizeof(TCHAR),
-                           &bytes_read,
-                           NULL));
-
-    EXPECT_EQ(0, bytes_read % sizeof(TCHAR));
-    buffer[bytes_read / sizeof(TCHAR)] = _T('\0');
-    EXPECT_STREQ(kArgs, buffer);
-
-    reset(file);
-
-    BOOL succeeded = ::DeleteFile(saved_arguments_file_path);
-    if (vista_util::IsUserAdmin()) {
-      EXPECT_TRUE(succeeded);
-    }
-
-    RemoveMsi();
-  } else {
-    const bool expected_file_exists = File::Exists(saved_arguments_file_path);
-    HRESULT hr = E_FAIL;
-    EXPECT_FALSE(LaunchRepairFileElevated(true, valid_path, kArgs, &hr));
-    EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_PATCH_TARGET_NOT_FOUND), hr);
-
-    // We can't force the file to be deleted, so make sure it wasn't created
-    // or deleted by the above method.
-    EXPECT_EQ(expected_file_exists, File::Exists(saved_arguments_file_path));
-  }
-}
-
-// This test only runs on Windows Vista and later OSes.
-// The MSP to runs, but fails because the specified file (the unit tests)
-// is not a valid repair file.
-TEST_F(RepairGoopdateTest,
-       LaunchRepairFileElevated_MachineInstanceVistaWithMsiInstalledBadFile) {
-  if (!vista_util::IsVistaOrLater()) {
-    std::wcout << _T("\tThis test did not run because it requires Windows ")
-                  _T("Vista or later.") << std::endl;
-    return;
-  }
-
-  if (vista_util::IsUserAdmin() || IsMsiHelperInstalled()) {
-    InstallMsi();
-
-    // Verify that no patch is installed.
-    EXPECT_TRUE(RegKey::HasNativeKey(kMsiProductPatchesKey));
-    RegKey product_patches_key;
-    EXPECT_SUCCEEDED(product_patches_key.Open(kMsiProductPatchesKey,
-                                              KEY_READ | KEY_WOW64_64KEY));
-    EXPECT_EQ(0, product_patches_key.GetSubkeyCount());
-
-    HRESULT hr = E_FAIL;
-    EXPECT_FALSE(LaunchRepairFileElevated(true,
-                                          app_util::GetCurrentModulePath(),
-                                          _T("/update"),
-                                          &hr));
-    EXPECT_EQ(TRUST_E_NOSIGNATURE, hr);
-
-    // Verify that patch was uninstalled.
-    // GetSubkeyCount fails if we don't re-open the key.
-    EXPECT_SUCCEEDED(product_patches_key.Open(kMsiProductPatchesKey,
-                                              KEY_READ | KEY_WOW64_64KEY));
-    EXPECT_EQ(0, product_patches_key.GetSubkeyCount());
-
-    RemoveMsi();
-  } else {
-    HRESULT hr = E_FAIL;
-    EXPECT_FALSE(LaunchRepairFileElevated(true,
-                                          app_util::GetCurrentModulePath(),
-                                          _T("/update"),
-                                          &hr));
-    EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_PATCH_TARGET_NOT_FOUND), hr);
-  }
-}
-
-// This test only runs on Windows Vista and later OSes.
-TEST_F(RepairGoopdateTest,
-       LaunchRepairFileElevated_MachineInstanceVistaWithoutMsiInstalled) {
-  if (!vista_util::IsVistaOrLater()) {
-    std::wcout << _T("\tThis test did not run because it requires Windows ")
-                  _T("Vista or later.") << std::endl;
-    return;
-  }
-
-  if (vista_util::IsUserAdmin()) {
-    RemoveMsi();
-  } else if (IsMsiHelperInstalled()) {
-    std::wcout << _T("\tThis test did not run because the user is not an ")
-                  _T("admin and the MSI is already installed.") << std::endl;
-    return;
-  }
-  // else the user is not an admin but the MSI is not installed, so continue.
-
-  HRESULT hr = E_FAIL;
-  EXPECT_FALSE(LaunchRepairFileElevated(true, valid_path, _T("/update"), &hr));
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_PATCH_TARGET_NOT_FOUND), hr);
-}
-
-}  // namespace omaha
diff --git a/run_unit_tests.py b/run_unit_tests.py
deleted file mode 100644
index 775c0b6..0000000
--- a/run_unit_tests.py
+++ /dev/null
@@ -1,128 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-"""Runs a set of unit tests and returns success only if they all succeed.
-
-This script assumes it is being run from the omaha directory.
-
-To run unit tests for Omaha's default set of test directories, just run the file
-from the command line.
-"""
-
-
-import dircache
-import os
-
-TEST_EXECUTABLE_RHS = '_unittest.exe'
-
-# Build paths that contain tests.
-STAGING_PATH = 'scons-out\\dbg-win\\staging'
-TESTS_PATH = 'scons-out\\dbg-win\\tests'
-
-
-def RunTest(test_path):
-  """Runs a test and returns its exit code.
-
-    Assumes the tests can be run from any directory. In other words, it does not
-    chdir.
-
-  Args:
-    test_path: Path to test executables.
-
-  Returns:
-    The exit code from the test process.
-  """
-
-  print '\nRunning %s . . .\n' % test_path
-
-  # Put './' in front of the file name to avoid accidentally running a file with
-  # the same name in some other directory if test_path were just a file name.
-  return os.system(os.path.join('.', test_path))
-
-
-def RunTests(test_paths):
-  """Runs all tests specified by test_paths.
-
-  Args:
-    test_paths: A list of paths to test executables.
-
-  Returns:
-    0 if all tests are successful.
-    1 if some tests fail, or if there is an error.
-  """
-
-  if not test_paths or len(test_paths) < 1:
-    return 1
-
-  print 'Found the following tests to run:'
-  for test in test_paths:
-    print '\t%s' % test
-
-  # Run all tests and remembers those that failed.
-  failed_tests = [t for t in test_paths if RunTest(t)]
-
-  print '\n\n%s test executables were run.' % len(test_paths)
-
-  failed_test_count = len(failed_tests)
-  if failed_test_count:
-    # Lists the executables that failed so the user can investigate them.
-    print 'FAILED!'
-    print 'The following %s tests failed:\n' % failed_test_count
-    for test in failed_tests:
-      print test
-    return 1
-  else:
-    # No, there is none.
-    if test_paths:
-      print 'All of them PASSED!'
-    return 0
-
-
-def GetTestsInDirs(test_dirs):
-  """Returns a list of all unit test executables in test_dirs.
-
-    Does not search subdirectories.
-
-  Args:
-    test_dirs: A list of directories to search.
-
-  Returns:
-    List of all unit tests.
-  """
-
-  tests = []
-
-  for test_dir in test_dirs:
-    # Use dircache.listdir so order is alphabetical and thus deterministic.
-    files = dircache.listdir(test_dir)
-
-    for test_file in files:
-      if test_file.endswith(TEST_EXECUTABLE_RHS):
-        relative_path = os.path.join(test_dir, test_file)
-        if os.path.isfile(relative_path):
-          tests += [relative_path]
-
-  return tests
-
-# Run a unit test when the module is run directly.
-if __name__ == '__main__':
-  # List of paths that contain unit tests to run.
-  dirs_containing_tests = [STAGING_PATH, TESTS_PATH]
-
-  tests_to_run = GetTestsInDirs(dirs_containing_tests)
-
-  RunTests(tests_to_run)
diff --git a/service/build.scons b/service/build.scons
deleted file mode 100644
index 7ba41a6..0000000
--- a/service/build.scons
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright 2008-2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-# Create a local clone, so the parent environment is
-# unaffected by changes made here.
-local_env = env.Clone()
-
-local_env.Append(
-    CPPPATH = [
-        '$OBJ_ROOT',    # Needed for generated files.
-        ],
-)
-
-inputs = [
-    'service_main.cc',
-    ]
-
-# Build these into a library.
-local_env.ComponentLibrary('service', inputs)
diff --git a/service/service_main.cc b/service/service_main.cc
deleted file mode 100644
index 95322a6..0000000
--- a/service/service_main.cc
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Contains the ATL service.
-
-#include "omaha/service/service_main.h"
-
-namespace omaha {
-
-// Template arguments need to be non-const TCHAR arrays.
-TCHAR kHKRootService[] = _T("HKLM");
-TCHAR kProgIDUpdate3COMClassServiceLocal[] = kProgIDUpdate3COMClassService;
-
-// A private object map with custom registration works best, even though this
-// stuff is deprecated. This is because GoogleUpdate.exe has other objects
-// defined elsewhere and we do not want to expose those from the service.
-BEGIN_OBJECT_MAP(object_map_google_update3)
-  OBJECT_ENTRY(__uuidof(GoogleUpdate3ServiceClass), Update3COMClassService)
-END_OBJECT_MAP()
-
-BEGIN_OBJECT_MAP(object_map_google_update_medium)
-  OBJECT_ENTRY(__uuidof(OnDemandMachineAppsServiceClass), OnDemandService)
-  OBJECT_ENTRY(__uuidof(GoogleUpdate3WebServiceClass), Update3WebService)
-  OBJECT_ENTRY(__uuidof(GoogleUpdateCoreClass), GoogleUpdateCoreService)
-END_OBJECT_MAP()
-
-CommandLineMode Update3ServiceMode::commandline_mode() {
-  return COMMANDLINE_MODE_SERVICE;
-}
-
-CString Update3ServiceMode::reg_name() {
-  return kRegValueServiceName;
-}
-
-CString Update3ServiceMode::default_name() {
-  return kServicePrefix;
-}
-
-DWORD Update3ServiceMode::service_start_type() {
-  return SERVICE_AUTO_START;
-}
-
-_ATL_OBJMAP_ENTRY* Update3ServiceMode::object_map() {
-  return object_map_google_update3;
-}
-
-bool Update3ServiceMode::allow_access_from_medium() {
-  return false;
-}
-
-CString Update3ServiceMode::app_id_string() {
-  return GuidToString(__uuidof(GoogleUpdate3ServiceClass));
-}
-
-CString Update3ServiceMode::GetCurrentServiceName() {
-  return goopdate_utils::GetCurrentVersionedName(true, reg_name(),
-                                                 default_name());
-}
-
-HRESULT Update3ServiceMode::PreMessageLoop() {
-  SERVICE_LOG(L1, (_T("[Starting Google Update core...]")));
-  CommandLineBuilder builder(COMMANDLINE_MODE_CORE);
-  CString args = builder.GetCommandLineArgs();
-  return goopdate_utils::StartGoogleUpdateWithArgs(true, args, NULL);
-}
-
-CommandLineMode UpdateMediumServiceMode::commandline_mode() {
-  return COMMANDLINE_MODE_MEDIUM_SERVICE;
-}
-
-CString UpdateMediumServiceMode::reg_name() {
-  return kRegValueMediumServiceName;
-}
-
-CString UpdateMediumServiceMode::default_name() {
-  return kMediumServicePrefix;
-}
-
-DWORD UpdateMediumServiceMode::service_start_type() {
-  return SERVICE_DEMAND_START;
-}
-
-_ATL_OBJMAP_ENTRY* UpdateMediumServiceMode::object_map() {
-  return object_map_google_update_medium;
-}
-
-bool UpdateMediumServiceMode::allow_access_from_medium() {
-  return true;
-}
-
-CString UpdateMediumServiceMode::app_id_string() {
-  return GuidToString(__uuidof(OnDemandMachineAppsServiceClass));
-}
-
-CString UpdateMediumServiceMode::GetCurrentServiceName() {
-  return goopdate_utils::GetCurrentVersionedName(true, reg_name(),
-                                                 default_name());
-}
-
-HRESULT UpdateMediumServiceMode::PreMessageLoop() {
-  return S_OK;
-}
-
-}  // namespace omaha
diff --git a/service/service_main.h b/service/service_main.h
deleted file mode 100644
index 93b471f..0000000
--- a/service/service_main.h
+++ /dev/null
@@ -1,515 +0,0 @@
-// Copyright 2006-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// The service is a bootstrap for a local system process to start
-// when the computer starts. The service shuts itself down in 30 seconds.
-//
-// The service can be started in one of two modes:
-//   * As a regular service, typically at system startup.
-//   * As a COM service, typically by an Omaha client using IGoogleUpdateCore.
-// The COM case is distinguished from the regular service case by registering a
-// ServiceParameters command line in the AppID registration.
-//
-// In all cases, the service initializes COM, and allows for IGoogleUpdateCore
-// clients to connect to the service. In the regular service case, the service
-// shuts down after a small idle check timeout, provided that there are no COM
-// clients connected. In the COM server case, and in the case where there are
-// COM clients connected in the regular service case, the service will shut down
-// when the last client disconnects.
-//
-// To be exact, the service will initiate shutdown in all cases when the ATL
-// module count drops to zero.
-//
-// ATL does not allow for directly reusing the delayed COM shutdown mechanism
-// available for Local servers. The assumption likely being that services run
-// forever. Since we do not want our service to run forever, we override some
-// of the functions to get the same effect.
-
-#ifndef OMAHA_SERVICE_SERVICE_MAIN_H_
-#define OMAHA_SERVICE_SERVICE_MAIN_H_
-
-#include <atlbase.h>
-#include <atlcom.h>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/atlregmapex.h"
-#include "omaha/base/debug.h"
-// Use client/resource.h because it does not use StringFormatter and some of the
-// strings are only used during Setup, which is part of the client.
-// TODO(omaha3): It is a little unexpected to access strings in a header. It
-// would be nice to avoid that. Also, this file is included by both client
-// (setup_service.cc) and server (goopdate.cc) code.
-#include "omaha/client/resource.h"
-#include "omaha/common/command_line_builder.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/core/google_update_core.h"
-#include "omaha/goopdate/google_update3.h"
-#include "omaha/goopdate/non_localized_resource.h"
-#include "omaha/goopdate/ondemand.h"
-#include "omaha/goopdate/update3web.h"
-#include "omaha/goopdate/worker.h"
-#include "omaha/net/network_config.h"
-
-namespace omaha {
-
-class Update3ServiceMode {
- public:
-  static CommandLineMode commandline_mode();
-  static CString reg_name();
-  static CString default_name();
-  static DWORD service_start_type();
-  static _ATL_OBJMAP_ENTRY* object_map();
-  static bool allow_access_from_medium();
-  static CString app_id_string();
-  static CString GetCurrentServiceName();
-  static HRESULT PreMessageLoop();
-};
-
-class UpdateMediumServiceMode {
- public:
-  static CommandLineMode commandline_mode();
-  static CString reg_name();
-  static CString default_name();
-  static DWORD service_start_type();
-  static _ATL_OBJMAP_ENTRY* object_map();
-  static bool allow_access_from_medium();
-  static CString app_id_string();
-  static CString GetCurrentServiceName();
-  static HRESULT PreMessageLoop();
-};
-
-#pragma warning(push)
-// C4640: construction of local static object is not thread-safe
-#pragma warning(disable : 4640)
-
-template <typename T>
-class ServiceModule
-    : public CAtlServiceModuleT<ServiceModule<T>, IDS_SERVICE_NAME> {
- public:
-  typedef CAtlServiceModuleT<ServiceModule, IDS_SERVICE_NAME> Base;
-
-  DECLARE_REGISTRY_APPID_RESOURCEID_EX(IDR_GOOGLE_UPDATE3_SERVICE_APPID,
-                                       T::app_id_string())
-
-  BEGIN_REGISTRY_MAP()
-    REGMAP_ENTRY(_T("DESCRIPTION"),   _T("ServiceModule"))
-    REGMAP_ENTRY(_T("FILENAME"),      kServiceFileName)
-  END_REGISTRY_MAP()
-
-  ServiceModule()
-      : service_thread_(NULL),
-        is_service_com_server_(false) {
-    SERVICE_LOG(L1, (_T("[ServiceModule]")));
-    _tcscpy(m_szServiceName, T::GetCurrentServiceName());
-  }
-
-  ~ServiceModule() {
-    SERVICE_LOG(L1, (_T("[~ServiceModule]")));
-    ASSERT1(!service_thread_);
-
-    // ServiceModule is typically created on the stack. We cannot reset the
-    // _pAtlModule here, because objects are destroyed at destructor unwind
-    // time, and require access to the module.
-  }
-
-  HRESULT InitializeSecurity() throw() {
-    SERVICE_LOG(L3, (_T("[InitializeSecurity]")));
-
-    return InitializeServerSecurity(T::allow_access_from_medium());
-  }
-
-  void ServiceMain(DWORD argc, LPTSTR* argv) throw() {
-    ASSERT1(argc <= 2);
-    is_service_com_server_ =
-        argc == 2 && !CString(argv[1]).CompareNoCase(kCmdLineServiceComServer);
-    SERVICE_LOG(L3, (_T("[ServiceMain][is_service_com_server_][%d]"),
-                     is_service_com_server_));
-    Base::ServiceMain(argc, argv);
-  }
-
-  HRESULT RegisterClassObjects(DWORD class_context,
-                                              DWORD flags) throw() {
-    SERVICE_LOG(L3, (_T("[RegisterClassObjects]")));
-    for (_ATL_OBJMAP_ENTRY* objmap_entry = T::object_map();
-         objmap_entry->pclsid != NULL;
-         objmap_entry++) {
-      HRESULT hr = objmap_entry->RegisterClassObject(class_context, flags);
-      if (FAILED(hr)) {
-        SERVICE_LOG(LE, (_T("[RegisterClassObject failed][%s][0x%x]"),
-                         GuidToString(*objmap_entry->pclsid), hr));
-        return hr;
-      }
-    }
-
-    return S_OK;
-  }
-
-  HRESULT RevokeClassObjects() throw() {
-    SERVICE_LOG(L3, (_T("[RevokeClassObjects]")));
-    for (_ATL_OBJMAP_ENTRY* objmap_entry = T::object_map();
-         objmap_entry->pclsid != NULL;
-         objmap_entry++) {
-      HRESULT hr = objmap_entry->RevokeClassObject();
-      if (FAILED(hr)) {
-        SERVICE_LOG(LE, (_T("[RevokeClassObject failed][%s][0x%x]"),
-                         GuidToString(*objmap_entry->pclsid), hr));
-        return hr;
-      }
-    }
-
-    return S_OK;
-  }
-
-  HRESULT RegisterServer(BOOL, const CLSID* = NULL) throw() {
-    SERVICE_LOG(L3, (_T("[RegisterServer]")));
-    for (_ATL_OBJMAP_ENTRY* objmap_entry = T::object_map();
-         objmap_entry->pclsid != NULL;
-         objmap_entry++) {
-      HRESULT hr = objmap_entry->pfnUpdateRegistry(TRUE);
-      if (FAILED(hr)) {
-        SERVICE_LOG(LE, (_T("[pfnUpdateRegistry failed][%s][0x%x]"),
-                         GuidToString(*objmap_entry->pclsid), hr));
-        return hr;
-      }
-
-      hr = AtlRegisterClassCategoriesHelper(*objmap_entry->pclsid,
-                                            objmap_entry->pfnGetCategoryMap(),
-                                            TRUE);
-      if (FAILED(hr)) {
-        SERVICE_LOG(LE, (_T("[RegisterServer fail][%s][0x%x]"),
-                         GuidToString(*objmap_entry->pclsid), hr));
-        return hr;
-      }
-    }
-
-    return S_OK;
-  }
-
-  HRESULT UnregisterServer(BOOL, const CLSID* = NULL) throw() {
-    SERVICE_LOG(L3, (_T("[UnregisterServer]")));
-    for (_ATL_OBJMAP_ENTRY* objmap_entry = T::object_map();
-         objmap_entry->pclsid != NULL;
-         objmap_entry++) {
-      HRESULT hr = AtlRegisterClassCategoriesHelper(*objmap_entry->pclsid,
-                       objmap_entry->pfnGetCategoryMap(),
-                       FALSE);
-      if (FAILED(hr)) {
-        SERVICE_LOG(LE, (_T("[RegisterServer fail][%s][0x%x]"),
-                         GuidToString(*objmap_entry->pclsid), hr));
-        return hr;
-      }
-
-      hr = objmap_entry->pfnUpdateRegistry(FALSE);
-      if (FAILED(hr)) {
-        SERVICE_LOG(LE, (_T("[pfnUpdateRegistry failed][%s][0x%x]"),
-                         GuidToString(*objmap_entry->pclsid), hr));
-        return hr;
-      }
-    }
-
-    return S_OK;
-  }
-
-  HRESULT RegisterCOMService() {
-    SERVICE_LOG(L3, (_T("[RegisterCOMService]")));
-    HRESULT hr = UpdateRegistryAppId(TRUE);
-    if (FAILED(hr)) {
-      SERVICE_LOG(LE, (_T("[UpdateRegistryAppId failed][0x%x]"), hr));
-      return hr;
-    }
-
-    RegKey key_app_id;
-    hr = key_app_id.Open(HKEY_CLASSES_ROOT, _T("AppID"), KEY_WRITE);
-    if (FAILED(hr)) {
-      SERVICE_LOG(LE, (_T("[Could not open HKLM\\AppID][0x%x]"), hr));
-      return hr;
-    }
-
-    RegKey key;
-    hr = key.Create(key_app_id.Key(), GetAppIdT());
-    if (FAILED(hr)) {
-      SERVICE_LOG(LE, (_T("[Fail open HKLM-AppID-%s][0x%x]"), GetAppId(), hr));
-      return hr;
-    }
-
-    // m_szServiceName is set in the constructor.
-    hr = key.SetValue(_T("LocalService"), m_szServiceName);
-    if (FAILED(hr)) {
-      SERVICE_LOG(LE, (_T("[Could not set LocalService value][0x%x]"), hr));
-      return hr;
-    }
-
-    // The SCM will pass this switch to ServiceMain() during COM activation.
-    hr = key.SetValue(_T("ServiceParameters"), kCmdLineServiceComServer);
-    if (FAILED(hr)) {
-      SERVICE_LOG(LE, (_T("[Set ServiceParameters value failed][0x%x]"), hr));
-      return hr;
-    }
-
-    return RegisterServer(FALSE);
-  }
-
-  HRESULT UnregisterCOMService() {
-    SERVICE_LOG(L3, (_T("[UnregisterCOMService]")));
-    HRESULT hr = UnregisterServer(FALSE);
-    if (FAILED(hr)) {
-      SERVICE_LOG(LE, (_T("[UnregisterServer failed][0x%x]"), hr));
-      return hr;
-    }
-
-    return UpdateRegistryAppId(FALSE);
-  }
-
-  HRESULT PreMessageLoop(int show_cmd) {
-    UNREFERENCED_PARAMETER(show_cmd);
-
-    SERVICE_LOG(L1, (_T("[PreMessageLoop]")));
-
-    m_dwThreadID = ::GetCurrentThreadId();
-    service_thread_ = ::OpenThread(SYNCHRONIZE, false, m_dwThreadID);
-
-    if (is_service_com_server_) {
-      return InitializeCOMServer();
-    }
-
-    // This is the regular service case. Call T::PreMessageLoop() and exit.
-    SetServiceStatus(SERVICE_RUNNING);
-
-    HRESULT hr = T::PreMessageLoop();
-    if (FAILED(hr)) {
-      SERVICE_LOG(LE, (_T("[T::PreMessageLoop() failed][0x%x]"), hr));
-    }
-
-    SetServiceStatus(SERVICE_STOP_PENDING);
-
-    // S_FALSE is returned to exit the service immediately.
-    return S_FALSE;
-  }
-
-  HRESULT PostMessageLoop() {
-    SERVICE_LOG(L1, (_T("[PostMessageLoop]")));
-
-    if (!is_service_com_server_) {
-      return S_OK;
-    }
-
-    return Base::PostMessageLoop();
-  }
-
-  int Main(int show_cmd) {
-    if (CAtlBaseModule::m_bInitFailed) {
-      SERVICE_LOG(LE, (_T("[CAtlBaseModule init failed]")));
-      return -1;
-    }
-
-    return static_cast<int>(Start(show_cmd));
-  }
-
-  // This is cloned from CAtlExeModuleT.Lock(). The one difference is the call
-  // to ::CoAddRefServerProcess(). See the description for Unlock() below for
-  // further information.
-  virtual LONG Lock() throw() {
-    ::CoAddRefServerProcess();
-    LONG retval = CComGlobalsThreadModel::Increment(&m_nLockCnt);
-    SERVICE_LOG(L3, (_T("[ServiceModule::Lock][%d]"), retval));
-    return retval;
-  }
-
-  // This is cloned from CAtlExeModuleT.Unlock(). The differences are:
-  //
-  // * the call to ::CoReleaseServerProcess(), to ensure that the class
-  // factories are suspended once the lock count drops to zero. This fixes a
-  // a race condition where an activation request could come in in the middle
-  // of shutting down. This shutdown mechanism works with free threaded servers.
-  //
-  // There are race issues with the ATL  delayed shutdown mechanism, hence the
-  // associated code has been eliminated, and we have an assert to make sure
-  // m_bDelayShutdown is not set.
-  //
-  // * the call to "OnStop()" instead of the "::PostThreadMessage(m_dwMainThre".
-  // OnStop() correctly sets the service status to SERVICE_STOP_PENDING, and
-  // posts a WM_QUIT to the service thread.
-  virtual LONG Unlock() throw() {
-    ASSERT1(!m_bDelayShutdown);
-
-    ::CoReleaseServerProcess();
-    LONG retval = CComGlobalsThreadModel::Decrement(&m_nLockCnt);
-    SERVICE_LOG(L3, (_T("[ServiceModule::Unlock][%d]"), retval));
-
-    if (retval == 0) {
-      OnStop();
-    }
-
-    return retval;
-  }
-
-  // This is cloned from CAtlExeModuleT.MonitorShutdown(). The only difference
-  // is the call to "OnStop()" instead of the
-  // "::PostThreadMessage(m_dwMainThreadID".
-  void MonitorShutdown() throw() {
-    SERVICE_LOG(L3, (_T("[MonitorShutdown]")));
-
-    while (true) {
-      ::WaitForSingleObject(m_hEventShutdown, INFINITE);
-      SERVICE_LOG(L4, (_T("[Infinite Wait][%d][%d]"), m_bActivity, m_nLockCnt));
-
-      DWORD wait = 0;
-      do {
-        m_bActivity = false;
-        wait = ::WaitForSingleObject(m_hEventShutdown, m_dwTimeOut);
-      } while (wait == WAIT_OBJECT_0);
-
-      SERVICE_LOG(L4, (_T("[MonitorShutdown][%d][%d]"),
-                       m_bActivity, m_nLockCnt));
-      if (!m_bActivity && m_nLockCnt == 0) {
-        ::CoSuspendClassObjects();
-        if (m_nLockCnt == 0) {
-          break;
-        }
-      }
-    }
-
-    ::CloseHandle(m_hEventShutdown);
-    OnStop();
-  }
-
-  // This is cloned from CAtlExeModuleT.StartMonitor().
-  HANDLE StartMonitor() throw() {
-    SERVICE_LOG(L3, (_T("[StartMonitor]")));
-    m_hEventShutdown = ::CreateEvent(NULL, false, false, NULL);
-    if (m_hEventShutdown == NULL) {
-      return NULL;
-    }
-
-    DWORD thread_id(0);
-    HANDLE monitor = ::CreateThread(NULL, 0, MonitorProc, this, 0, &thread_id);
-    if (monitor == NULL) {
-      ::CloseHandle(m_hEventShutdown);
-    }
-
-    return monitor;
-  }
-
-  // This is cloned from CAtlExeModuleT.MonitorProc().
-  static DWORD WINAPI MonitorProc(void* pv) throw() {
-    SERVICE_LOG(L3, (_T("[MonitorProc]")));
-    ServiceModule* service_module = static_cast<ServiceModule*>(pv);
-    ASSERT1(service_module);
-
-    service_module->MonitorShutdown();
-    return 0;
-  }
-
- private:
-  // Should only be called from the client, such as during Setup, since it only
-  // supports one language.
-  // Assumes the resources have been loaded.
-  static CString GetServiceDescription() {
-    CString company_name;
-    VERIFY1(company_name.LoadString(IDS_FRIENDLY_COMPANY_NAME));
-    CString description;
-    description.FormatMessage(IDS_SERVICE_DESCRIPTION, company_name);
-    return description;
-  }
-
-  HRESULT InitializeCOMServer() {
-    SERVICE_LOG(L1, (_T("[InitializeCOMServer]")));
-
-    // Initialize COM security right at the beginning, because Worker
-    // initialization can cause interface marshaling. The first few lines below
-    // are adapted from the beginning of CAtlServiceModuleT::PreMessageLoop().
-    ASSERT1(m_bService);
-    HRESULT hr = InitializeSecurity();
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    DisableCOMExceptionHandling();
-
-    NetworkConfigManager::set_is_machine(true);
-
-    // Create NetworkConfigManager singleton by referencing it.
-    NetworkConfigManager::Instance();
-
-    // Register and resume the COM class objects. We call the CAtlExeModuleT
-    // member instead of CAtlServiceModuleT, because the latter also tries to
-    // initialize security, which we have already done above.
-    return CAtlExeModuleT<ServiceModule>::PreMessageLoop(SW_HIDE);
-  }
-
-  // When Start executes, it blocks on StartServiceCtrlDispatcher.
-  // Internally, the SCM creates a service thread which starts executing code
-  // specified by SERVICE_TABLE_ENTRY. The ATL code then calls PreMessageLoop
-  // and PostMessageLoop on this thread. When the service stops, the execution
-  // flow returns from StartServiceCtrlDispatcher and the main thread blocks
-  // waiting on the service thread to exit.
-  // Before synchronizing the main thread and the service thread, race condition
-  // resulted in http://b/1134747.
-  HRESULT Start(int show_cmd) {
-    SERVICE_LOG(L1, (_T("[Start]")));
-    UNREFERENCED_PARAMETER(show_cmd);
-
-    SERVICE_TABLE_ENTRY st[] = {
-      { m_szServiceName, Base::_ServiceMain },
-      { NULL, NULL }
-    };
-
-    m_status.dwWin32ExitCode = 0;
-    if (!::StartServiceCtrlDispatcher(st)) {
-      m_status.dwWin32ExitCode = ::GetLastError();
-    }
-
-    if (service_thread_) {
-      DWORD result(::WaitForSingleObject(service_thread_, kShutdownIntervalMs));
-      ASSERT1(result == WAIT_OBJECT_0);
-      ::CloseHandle(service_thread_);
-      service_thread_ = NULL;
-    }
-
-    return m_status.dwWin32ExitCode;
-  }
-
-  HANDLE service_thread_;   // The service thread provided by the SCM.
-  bool is_service_com_server_;  // True if the service is being invoked by COM.
-
-  // Service shut down wait timeout. The main thread waits for the service
-  // thread to exit, after the service stops.
-  static const DWORD kShutdownIntervalMs = 1000L * 30;         // 30 seconds.
-
-  // Service idle check timeout. The service shuts down itself after startup.
-  static const DWORD kIdleCheckIntervalMs = 1000L * 30;        // 30 seconds.
-
-  // Service failover constants.
-  //
-  // Time after which the SCM resets the failure count to zero if there are
-  // no failures.
-  static const DWORD kResetPeriodSec      = 60 * 60 * 24;     // 1 day.
-
-  // Time to wait before performing the specified action.
-  static const DWORD kActionDelayMs       = 1000L * 60 * 15;  // 15 minutes.
-
-  DISALLOW_EVIL_CONSTRUCTORS(ServiceModule);
-};
-
-#pragma warning(pop)
-
-typedef ServiceModule<Update3ServiceMode> Update3ServiceModule;
-typedef ServiceModule<UpdateMediumServiceMode> UpdateMediumServiceModule;
-
-}  // namespace omaha
-
-#endif  // OMAHA_SERVICE_SERVICE_MAIN_H_
diff --git a/setup/build.scons b/setup/build.scons
deleted file mode 100644
index 6af16a6..0000000
--- a/setup/build.scons
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright 2008-2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-local_env = env.Clone()
-
-inputs = [
-    'setup.cc',
-    'setup_files.cc',
-    'setup_google_update.cc',
-    'setup_metrics.cc',
-    ]
-
-# Need to look in output dir to find .h files generated by midl compiler.
-# This also allows Hammer to understand dependencies between this subdir
-# and the .idl files in the goopdate folder.
-# TODO(omaha): It would be nice to eliminate references to COM files from setup.
-local_env['CPPPATH'] += ['$OBJ_ROOT']
-
-
-# Build these into a static library.
-local_env.ComponentStaticLibrary('setup', inputs)
diff --git a/setup/msi_test_utils.cc b/setup/msi_test_utils.cc
deleted file mode 100644
index 127d492..0000000
--- a/setup/msi_test_utils.cc
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// IsMsiHelperInstalled requires MSI version 3.0 for MsiEnumProductsEx.
-// Omaha does not require MSI 3.0.
-#ifdef _WIN32_MSI
-#if (_WIN32_MSI < 300)
-#undef _WIN32_MSI
-#define _WIN32_MSI 300
-#endif
-#else
-#define _WIN32_MSI 300
-#endif
-
-#include <windows.h>
-#include <msi.h>
-#include "omaha/base/constants.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-bool IsMsiHelperInstalled() {
-  int res = ::MsiEnumProductsEx(kHelperInstallerProductGuid,
-                                NULL,
-                                MSIINSTALLCONTEXT_MACHINE,
-                                0,
-                                NULL,
-                                NULL,
-                                NULL,
-                                NULL);
-
-  bool is_msi_installed = (ERROR_SUCCESS == res);
-  EXPECT_TRUE(is_msi_installed || ERROR_NO_MORE_ITEMS == res);
-
-  return is_msi_installed;
-}
-
-}  // namespace omaha
diff --git a/setup/msi_test_utils.h b/setup/msi_test_utils.h
deleted file mode 100644
index bcdf8cf..0000000
--- a/setup/msi_test_utils.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_SETUP_MSI_TEST_UTILS_H_
-#define OMAHA_SETUP_MSI_TEST_UTILS_H_
-
-namespace omaha {
-
-// Returns true if the Helper MSI is installed.
-bool IsMsiHelperInstalled();
-
-}  // namespace omaha
-
-#endif  // OMAHA_SETUP_MSI_TEST_UTILS_H_
diff --git a/setup/setup.cc b/setup/setup.cc
deleted file mode 100644
index fd1a6e6..0000000
--- a/setup/setup.cc
+++ /dev/null
@@ -1,1378 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// This class handles the installation of Google Update when it is run with the
-// install or update switch. It is invoked when Google Update is launched from
-// the meta-installer and as part of self-update.
-
-#include "omaha/setup/setup.h"
-#include <regstr.h>
-#include <atlpath.h>
-#include <algorithm>
-#include <functional>
-#include <vector>
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/highres_timer-win32.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/process.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/system.h"
-#include "omaha/base/timer.h"
-#include "omaha/base/user_info.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/app_registry_utils.h"
-#include "omaha/common/command_line.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/event_logger.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/common/ping.h"
-#include "omaha/common/scheduled_task_utils.h"
-#include "omaha/common/stats_uploader.h"
-#include "omaha/setup/setup_files.h"
-#include "omaha/setup/setup_google_update.h"
-#include "omaha/setup/setup_metrics.h"
-#include "omaha/setup/setup_service.h"
-
-namespace omaha {
-
-namespace {
-
-const TCHAR* const kUninstallEventDescriptionFormat = _T("%s uninstall");
-
-const int kVersion12 = 12;
-
-void GetShutdownEventAttributes(bool is_machine, NamedObjectAttributes* attr) {
-  ASSERT1(attr);
-  GetNamedObjectAttributes(kShutdownEvent, is_machine, attr);
-}
-
-// Returns the process's mode based on its command line.
-HRESULT GetProcessModeFromPid(uint32 pid, CommandLineMode* mode) {
-  ASSERT1(mode);
-
-  CString cmd_line;
-  HRESULT hr = Process::GetCommandLine(pid, &cmd_line);
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[GetCommandLine failed][%u][0x%08x]"), pid, hr));
-    return hr;
-  }
-
-  CommandLineArgs args;
-  hr = ParseCommandLine(cmd_line, &args);
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[ParseCommandLine failed][%u][%s][0x%08x]"),
-                   pid, cmd_line, hr));
-    return hr;
-  }
-
-  OPT_LOG(L2, (_T("[Process %u][cmd line %s][mode %u]"),
-               pid, cmd_line, args.mode));
-  *mode = args.mode;
-  return S_OK;
-}
-
-void IncrementProcessWaitFailCount(CommandLineMode mode) {
-  switch (mode) {
-    case COMMANDLINE_MODE_UNKNOWN:
-      ++metric_setup_process_wait_failed_unknown;
-      break;
-    case COMMANDLINE_MODE_CORE:
-      ++metric_setup_process_wait_failed_core;
-      break;
-    case COMMANDLINE_MODE_REPORTCRASH:
-      ++metric_setup_process_wait_failed_report;
-      break;
-    case COMMANDLINE_MODE_UPDATE:
-      ++metric_setup_process_wait_failed_update;
-      break;
-    case COMMANDLINE_MODE_HANDOFF_INSTALL:
-      ++metric_setup_process_wait_failed_handoff;
-      break;
-    case COMMANDLINE_MODE_UA:
-      ++metric_setup_process_wait_failed_ua;
-      break;
-    case COMMANDLINE_MODE_CODE_RED_CHECK:
-      ++metric_setup_process_wait_failed_cr;
-      break;
-    case COMMANDLINE_MODE_NOARGS:
-    case COMMANDLINE_MODE_SERVICE:
-
-    case COMMANDLINE_MODE_REGSERVER:
-    case COMMANDLINE_MODE_UNREGSERVER:
-    case COMMANDLINE_MODE_NETDIAGS:
-    case COMMANDLINE_MODE_CRASH:
-    case COMMANDLINE_MODE_INSTALL:
-    case COMMANDLINE_MODE_RECOVER:
-    case COMMANDLINE_MODE_WEBPLUGIN:
-    case COMMANDLINE_MODE_COMSERVER:
-    case COMMANDLINE_MODE_REGISTER_PRODUCT:
-    case COMMANDLINE_MODE_UNREGISTER_PRODUCT:
-    case COMMANDLINE_MODE_SERVICE_REGISTER:
-    case COMMANDLINE_MODE_SERVICE_UNREGISTER:
-    case COMMANDLINE_MODE_CRASH_HANDLER:
-    case COMMANDLINE_MODE_COMBROKER:
-    case COMMANDLINE_MODE_ONDEMAND:
-    case COMMANDLINE_MODE_MEDIUM_SERVICE:
-    case COMMANDLINE_MODE_UNINSTALL:
-    case COMMANDLINE_MODE_PING:
-    default:
-      ++metric_setup_process_wait_failed_other;
-      break;
-  }
-}
-
-// Returns the pids of all other GoogleUpdate.exe processes with the specified
-// argument string. Checks processes for all users that it has privileges to
-// access.
-HRESULT GetPidsWithArgsForAllUsers(const CString& args,
-                                   std::vector<uint32>* pids) {
-  ASSERT1(pids);
-
-  std::vector<CString> command_line;
-  command_line.push_back(args);
-
-  DWORD flags = EXCLUDE_CURRENT_PROCESS |
-                INCLUDE_PROCESS_COMMAND_LINE_CONTAINING_STRING;
-  HRESULT hr = Process::FindProcesses(flags,
-                                      kOmahaShellFileName,
-                                      true,
-                                      CString(),
-                                      command_line,
-                                      pids);
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[FindProcesses failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-void WriteGoogleUpdateUninstallEvent(bool is_machine) {
-  CString description;
-  description.Format(kUninstallEventDescriptionFormat, kAppName);
-  GoogleUpdateLogEvent uninstall_event(EVENTLOG_INFORMATION_TYPE,
-                                       kUninstallEventId,
-                                       is_machine);
-  uninstall_event.set_event_desc(description);
-  uninstall_event.WriteEvent();
-}
-
-// TODO(omaha3): Enable. Will we still need this method?
-// Returns true if the mode can be determined and pid represents a "/c" process.
-bool IsCoreProcess(uint32 pid) {
-  CommandLineMode mode(COMMANDLINE_MODE_UNKNOWN);
-  return SUCCEEDED(GetProcessModeFromPid(pid, &mode)) &&
-         COMMANDLINE_MODE_CORE == mode;
-}
-
-}  // namespace
-
-bool Setup::did_uninstall_ = false;
-
-Setup::Setup(bool is_machine)
-    : is_machine_(is_machine),
-      is_self_update_(false),
-      extra_code1_(S_OK) {
-  SETUP_LOG(L2, (_T("[Setup::Setup]")));
-}
-
-Setup::~Setup() {
-  SETUP_LOG(L2, (_T("[Setup::~Setup]")));
-}
-
-// Protects all setup-related operations with:
-// * Setup Lock - Prevents other instances from installing Google Update for
-// this machine/user at the same time.
-// * Shutdown Event - Tells existing other instances and any instances that may
-// start during Setup to exit.
-// Setup-related operations do not include installation of the app.
-HRESULT Setup::Install(bool set_keepalive) {
-  SETUP_LOG(L3,
-      (_T("[Admin=%d, NEAdmin=%d, Update3Svc=%d, MedSvc=%d, Machine=%d"),
-       vista_util::IsUserAdmin(),
-       vista_util::IsUserNonElevatedAdmin(),
-       SetupUpdate3Service::IsServiceInstalled(),
-       SetupUpdateMediumService::IsServiceInstalled(),
-       is_machine_));
-
-  ASSERT1(!IsElevationRequired());
-
-  // Start the setup timer.
-  metrics_timer_.reset(new HighresTimer);
-
-  GLock setup_lock;
-
-  if (!InitSetupLock(is_machine_, &setup_lock)) {
-    SETUP_LOG(L2, (_T("[Setup::InitSetupLock failed]")));
-    extra_code1_ = kVersion12;
-    return GOOPDATE_E_SETUP_LOCK_INIT_FAILED;
-  }
-
-  HighresTimer lock_metrics_timer;
-
-  if (!setup_lock.Lock(kSetupLockWaitMs)) {
-    OPT_LOG(LE, (_T("[Failed to acquire setup lock]")));
-    return HandleLockFailed(kVersion12);
-  }
-  metric_setup_lock_acquire_ms.AddSample(lock_metrics_timer.GetElapsedMs());
-  SETUP_LOG(L1, (_T("[Setup Locks acquired]")));
-
-  HRESULT hr = DoProtectedInstall(set_keepalive);
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[Setup::DoProtectedInstall failed][0x%08x]"), hr));
-  }
-
-  SETUP_LOG(L1, (_T("[Releasing Setup Lock]")));
-  return hr;
-}
-
-// TODO(omaha3): Eliminate lock_version if we do not fix http://b/1076207.
-// Sets appropriate metrics and extra_code1_ value. It then tries to determine
-// the scenario that caused this failure and returns an appropriate error.
-// The detected processes may not actually be in conflict with this one, but are
-// more than likely the cause of the lock failure.
-HRESULT Setup::HandleLockFailed(int lock_version) {
-  ++metric_setup_locks_failed;
-
-  switch (lock_version) {
-    case kVersion12:
-      extra_code1_ = kVersion12;
-      ++metric_setup_lock12_failed;
-      break;
-    default:
-      ASSERT1(false);
-      extra_code1_ = -1;
-      break;
-  }
-
-  Pids matching_pids;
-  CString switch_to_include;
-
-  switch_to_include.Format(_T("/%s"), kCmdLineUpdate);
-  HRESULT hr = GetPidsWithArgsForAllUsers(switch_to_include, &matching_pids);
-  if (FAILED(hr)) {
-    ASSERT1(false);
-    return GOOPDATE_E_FAILED_TO_GET_LOCK;
-  }
-  if (!matching_pids.empty()) {
-    return GOOPDATE_E_FAILED_TO_GET_LOCK_UPDATE_PROCESS_RUNNING;
-  }
-
-  switch_to_include.Format(_T("/%s"), kCmdLineUninstall);
-  hr = GetPidsWithArgsForAllUsers(switch_to_include, &matching_pids);
-  if (FAILED(hr)) {
-    ASSERT1(false);
-    return GOOPDATE_E_FAILED_TO_GET_LOCK;
-  }
-  if (!matching_pids.empty()) {
-    return GOOPDATE_E_FAILED_TO_GET_LOCK_UNINSTALL_PROCESS_RUNNING;
-  }
-
-  switch_to_include.Format(_T("/%s"), kCmdLineInstall);
-  hr = GetPidsWithArgsForAllUsers(switch_to_include, &matching_pids);
-  if (FAILED(hr)) {
-    ASSERT1(false);
-    return GOOPDATE_E_FAILED_TO_GET_LOCK;
-  }
-  if (matching_pids.empty()) {
-    return GOOPDATE_E_FAILED_TO_GET_LOCK;
-  }
-
-  // Another /install process was found. Determine if it has the same cmd line.
-  const TCHAR* this_cmd_line = ::GetCommandLine();
-  if (!this_cmd_line) {
-    ASSERT1(false);
-    return GOOPDATE_E_FAILED_TO_GET_LOCK;
-  }
-  const CString current_cmd_line(this_cmd_line);
-  if (current_cmd_line.IsEmpty()) {
-    ASSERT1(false);
-    return GOOPDATE_E_FAILED_TO_GET_LOCK;
-  }
-
-  // Strip the directory path, which may vary, and executable name.
-  int exe_index = current_cmd_line.Find(kOmahaShellFileName);
-  if (-1 == exe_index) {
-    ASSERT(false, (_T("Unable to find %s in %s"),
-                   kOmahaShellFileName, current_cmd_line));
-    return GOOPDATE_E_FAILED_TO_GET_LOCK;
-  }
-  int args_start = exe_index + _tcslen(kOmahaShellFileName);
-  // Support enclosed paths; increment past closing double quote.
-  if (_T('"') == current_cmd_line.GetAt(args_start)) {
-    ++args_start;
-  }
-  const int args_length = current_cmd_line.GetLength() - args_start;
-  CString current_args = current_cmd_line.Right(args_length);
-  current_args.Trim();
-
-  for (size_t i = 0; i < matching_pids.size(); ++i) {
-    CString matching_pid_cmd_line;
-    if (FAILED(Process::GetCommandLine(matching_pids[i],
-                                       &matching_pid_cmd_line))) {
-      continue;
-    }
-
-    if (-1 != matching_pid_cmd_line.Find(current_args)) {
-      // Assume that this is a match and not a subset.
-      return GOOPDATE_E_FAILED_TO_GET_LOCK_MATCHING_INSTALL_PROCESS_RUNNING;
-    }
-  }
-
-  return GOOPDATE_E_FAILED_TO_GET_LOCK_NONMATCHING_INSTALL_PROCESS_RUNNING;
-}
-
-// Assumes the necessary locks have been acquired.
-HRESULT Setup::DoProtectedInstall(bool set_keepalive) {
-  SETUP_LOG(L2, (_T("[Setup::DoProtectedInstall]")));
-
-  SetupFiles setup_files(is_machine_);
-
-  HRESULT hr = setup_files.Init();
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[SetupFiles::Init failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  if (ShouldInstall(&setup_files)) {
-    ++metric_setup_do_self_install_total;
-
-    // TODO(omaha3): IMPORTANT: Try to avoid losing users due to firewall
-    // blocking caused by changing the constant shell. Try a simple ping using
-    // the new shell, and if it fails take one of the following actions:
-    //  1) Keep the old shell (if possible).
-    //  2) Fail the self-update. Leave the user on this version. Would need to
-    //     figure out a way to avoid updating the user every 5 hours.
-
-    HRESULT hr = DoProtectedGoogleUpdateInstall(&setup_files);
-    if (FAILED(hr)) {
-      SETUP_LOG(LE, (_T("[DoProtectedGoogleUpdateInstall fail][0x%08x]"), hr));
-      // Do not return until rolling back and releasing the events.
-    }
-
-    if (FAILED(hr)) {
-      RollBack(&setup_files);
-    }
-
-    // We need to hold the shutdown events until phase 2 is complete.
-    // Phase 2 will release the current version's event. Here we release all
-    // shutdown events, including the one that should have already been released
-    // to be safe (i.e. in case phase 2 crashes).
-    // This will happen before the Setup Lock is released, preventing any races.
-    ReleaseShutdownEvents();
-
-    if (FAILED(hr)) {
-      return hr;
-    }
-
-    // If we've been asked to defer uninstall (typically because we're doing
-    // an Omaha-only install to expose the COM API to a later process), set
-    // it on a successful install.
-    if (set_keepalive) {
-      SetDelayUninstall(true);
-    }
-
-    ++metric_setup_do_self_install_succeeded;
-  }
-
-  return S_OK;
-}
-
-// Assumes that the shell is the correct version for the existing Omaha version.
-bool Setup::ShouldInstall(SetupFiles* setup_files) {
-  SETUP_LOG(L2, (_T("[Setup::ShouldInstall]")));
-  ASSERT1(setup_files);
-
-  // TODO(omaha3): Figure out a different way to record these stats.
-  bool is_install = true;
-
-  ++metric_setup_should_install_total;
-
-  ULONGLONG my_version = GetVersion();
-
-  const ConfigManager* cm = ConfigManager::Instance();
-  CString existing_version;
-  HRESULT hr = RegKey::GetValue(cm->registry_clients_goopdate(is_machine_),
-                                kRegValueProductVersion,
-                                &existing_version);
-  if (FAILED(hr)) {
-    OPT_LOG(L2, (_T("[fresh install]")));
-    ++metric_setup_should_install_true_fresh_install;
-    return true;
-  }
-
-  OPT_LOG(L2, (_T("[Existing version: %s][Running version: %s]"),
-               existing_version, GetVersionString()));
-
-  // If running from the official install directory for this type of install
-  // (user/machine), it is most likely a OneClick install. Do not install self.
-  if (goopdate_utils::IsRunningFromOfficialGoopdateDir(is_machine_)) {
-    ++metric_setup_should_install_false_oc;
-    return false;
-  }
-
-  if (is_install) {
-    ++metric_setup_subsequent_install_total;
-  }
-
-  bool should_install(false);
-
-  ULONGLONG cv = VersionFromString(existing_version);
-  if (cv > my_version) {
-    SETUP_LOG(L2, (_T("[not installing, newer version exists]")));
-    ++metric_setup_should_install_false_older;
-    should_install = false;
-  } else if (cv < my_version) {
-    SETUP_LOG(L2, (_T("[installing with local build]")));
-    ++metric_setup_should_install_true_newer;
-    should_install = true;
-  } else {
-    // Same version.
-    should_install = ShouldOverinstallSameVersion(setup_files);
-    if (should_install) {
-      ++metric_setup_should_install_true_same;
-    } else {
-      ++metric_setup_should_install_false_same;
-    }
-  }
-
-  if (is_install && should_install) {
-    ++metric_setup_subsequent_install_should_install_true;
-  }
-
-  OPT_LOG(L1, (_T("[machine = %d][existing version = %s][should_install = %d]"),
-               is_machine_, existing_version, should_install));
-
-  return should_install;
-}
-
-// Checks the following:
-//  * OverInstall override.
-//  * The "installed" version in the registry equals this version.
-//    If not, this version was not fully installed even though "pv" says it is.
-//  * Files are properly installed.
-bool Setup::ShouldOverinstallSameVersion(SetupFiles* setup_files) {
-  SETUP_LOG(L2, (_T("[Setup::ShouldOverinstallSameVersion]")));
-  ASSERT1(setup_files);
-
-  const ConfigManager* cm = ConfigManager::Instance();
-
-  bool should_over_install = cm->CanOverInstall();
-  SETUP_LOG(L1, (_T("[should over install = %d]"), should_over_install));
-  if (should_over_install) {
-    SETUP_LOG(L2, (_T("[overinstalling with local build]")));
-    return true;
-  }
-
-  CString installed_version;
-  HRESULT hr = RegKey::GetValue(cm->registry_update(is_machine_),
-                                kRegValueInstalledVersion,
-                                &installed_version);
-  if (FAILED(hr) || GetVersionString() != installed_version) {
-    SETUP_LOG(L1, (_T("[installed version missing or did not match][%s]"),
-                   installed_version));
-    ++metric_setup_should_install_true_same_completion_missing;
-    return true;
-  }
-
-  if (setup_files->ShouldOverinstallSameVersion()) {
-    SETUP_LOG(L1, (_T("[files need over-install]")));
-    return true;
-  }
-
-  // TODO(omaha): Verify the current installation is complete and correct.
-  // For example, in Omaha 1, we would always set the run key to the version
-  // being installed. Now that code is in SetupGoogleUpdate, and it does not get
-  // called.
-
-  return false;
-}
-
-HRESULT Setup::DoProtectedGoogleUpdateInstall(SetupFiles* setup_files) {
-  ASSERT1(setup_files);
-  SETUP_LOG(L2, (_T("[Setup::DoProtectedGoogleUpdateInstall]")));
-
-  HRESULT hr = StopGoogleUpdateAndWait();
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[StopGoogleUpdateAndWait failed][0x%08x]"), hr));
-    if (E_ACCESSDENIED == hr) {
-      return GOOPDATE_E_ACCESSDENIED_STOP_PROCESSES;
-    }
-    return hr;
-  }
-
-// TODO(omaha3): Enable. Prefer to move out of Setup if possible.
-#if 0
-  VERIFY1(SUCCEEDED(ResetMetrics(is_machine_)));
-#endif
-
-  hr = RegKey::GetValue(
-             ConfigManager::Instance()->registry_clients_goopdate(is_machine_),
-             kRegValueProductVersion,
-             &saved_version_);
-  if (FAILED(hr)) {
-    SETUP_LOG(L3, (_T("[failed to get existing Omaha version][0x%08x]"), hr));
-    // Continue as this is expected for first installs.
-  }
-
-  hr = setup_files->Install();
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[SetupFiles::Install failed][0x%08x]"), hr));
-    extra_code1_ =
-        setup_files->extra_code1() | PingEvent::kSetupFilesExtraCodeMask;
-    return hr;
-  }
-
-  hr = SetupGoogleUpdate();
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[SetupGoogleUpdate failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  // TODO(omaha3): Maybe move out of Setup.
-  metric_setup_install_google_update_total_ms.AddSample(
-      metrics_timer_->GetElapsedMs());
-
-  return S_OK;
-}
-
-void Setup::RollBack(SetupFiles* setup_files) {
-  OPT_LOG(L1, (_T("[Roll back]")));
-  ASSERT1(setup_files);
-
-  // Restore the saved version.
-  if (!saved_version_.IsEmpty()) {
-    SETUP_LOG(L1, (_T("[Rolling back version to %s]"), saved_version_));
-    ++metric_setup_rollback_version;
-
-    VERIFY1(SUCCEEDED(RegKey::SetValue(
-        ConfigManager::Instance()->registry_clients_goopdate(is_machine_),
-        kRegValueProductVersion,
-        saved_version_)));
-  }
-
-  // TODO(omaha3): Rollback SetupGoogleUpdate.
-  VERIFY1(SUCCEEDED(setup_files->RollBack()));
-}
-
-// Assumes the caller is ensuring this is the only running instance of setup.
-// The original process holds the lock while it waits for this one to complete.
-HRESULT Setup::SetupGoogleUpdate() {
-  SETUP_LOG(L2, (_T("[Setup::SetupGoogleUpdate]")));
-
-  HighresTimer phase2_metrics_timer;
-
-  omaha::SetupGoogleUpdate setup_google_update(is_machine_);
-
-  HRESULT hr = setup_google_update.FinishInstall();
-  if (FAILED(hr)) {
-    extra_code1_ = setup_google_update.extra_code1();
-    SETUP_LOG(LE, (_T("[FinishInstall failed][0x%x][0x%x]"), hr, extra_code1_));
-    return hr;
-  }
-
-  // Release the shutdown event so that we can start the core if necessary, and
-  // we do not interfere with other app installs that may be waiting on the
-  // Setup Lock.
-  ASSERT1(shutdown_event_);
-  ReleaseShutdownEvents();
-
-  if (!scheduled_task_utils::IsUATaskHealthy(is_machine_)) {
-    HRESULT start_hr = StartCore();
-    if (FAILED(start_hr)) {
-      SETUP_LOG(LW, (_T("[StartCore failed][0x%x]"), start_hr));
-    }
-  }
-
-  // Registration of browser plugins is only done after the shutdown event has
-  // been released; this prevents race conditions where a browser could start
-  // a new install while the shutdown event was still being held.
-  HRESULT plugin_hr = setup_google_update.InstallBrowserPlugins();
-  if (FAILED(plugin_hr)) {
-    SETUP_LOG(LE, (_T("[InstallBrowserPlugins failed][0x%08x]"), plugin_hr));
-  }
-
-  // Setup is now complete.
-
-  metric_setup_phase2_ms.AddSample(phase2_metrics_timer.GetElapsedMs());
-  return S_OK;
-}
-
-// Stops all user/machine instances including the service, unregisters using
-// SetupGoogleUpdate, then deletes  the files using SetupFiles.
-// Does not wait for the processes to exit, except the service.
-// Protects all operations with the setup lock. If MSI is found busy, Omaha
-// won't uninstall.
-HRESULT Setup::Uninstall(bool send_uninstall_ping) {
-  OPT_LOG(L1, (_T("[Setup::Uninstall]")));
-  ASSERT1(!IsElevationRequired());
-
-  // Try to get the global setup lock; if the lock is taken, do not block
-  // waiting to uninstall; just return.
-  GLock setup_lock;
-  VERIFY1(InitSetupLock(is_machine_, &setup_lock));
-  if (!setup_lock.Lock(0)) {
-    OPT_LOG(LE, (_T("[Failed to acquire setup lock]")));
-    return E_FAIL;
-  }
-
-  return DoProtectedUninstall(send_uninstall_ping);
-}
-
-// Aggregates metrics regardless of whether uninstall is allowed.
-// Foces reporting of the metrics if uninstall is allowed.
-// Assumes that the current process holds the Setup Lock.
-HRESULT Setup::DoProtectedUninstall(bool send_uninstall_ping) {
-  const bool can_uninstall = CanUninstallGoogleUpdate();
-  OPT_LOG(L1, (_T("[CanUninstallGoogleUpdate returned %d]"), can_uninstall));
-
-  HRESULT hr = S_OK;
-  if (!can_uninstall) {
-    hr = GOOPDATE_E_CANT_UNINSTALL;
-  } else {
-    hr = StopGoogleUpdateAndWait();
-    if (FAILED(hr)) {
-      // If there are any clients that don't listen to the shutdown event,
-      // such as the current Update3Web workers, we'll need to wait until
-      // they can be shut down.
-      // TODO(omaha3): We might want to add a count metric for this case,
-      // and maybe go through with the uninstall anyways after several tries.
-      SETUP_LOG(L1, (_T("[StopGoogleUpdateAndWait returned 0x%08x]"), hr));
-      hr = GOOPDATE_E_CANT_UNINSTALL;
-    }
-  }
-
-  if (FAILED(hr)) {
-    VERIFY1(SUCCEEDED(AggregateMetrics(is_machine_)));
-    return hr;
-  }
-  hr = AggregateAndReportMetrics(is_machine_, true);
-  ASSERT1(SUCCEEDED(hr) || GOOPDATE_E_CANNOT_USE_NETWORK == hr);
-
-  bool can_use_network = ConfigManager::Instance()->CanUseNetwork(is_machine_);
-  if (can_use_network && send_uninstall_ping) {
-    SendUninstallPing();
-  }
-
-  // Write the event in the event log before uninstalling the program since
-  // the event contains version and language information, which are removed
-  // during the uninstall.
-  WriteGoogleUpdateUninstallEvent(is_machine_);
-
-  omaha::SetupGoogleUpdate setup_google_update(is_machine_);
-  setup_google_update.Uninstall();
-
-  SetupFiles setup_files(is_machine_);
-  setup_files.Uninstall();
-
-  OPT_LOG(L1, (_T("[Uninstall complete]")));
-  did_uninstall_ = true;
-  return S_OK;
-}
-
-// Should only be called after the point where Uninstall would have been called.
-// Works correctly in the case where the Setup Lock is not held but an app is
-// being installed because it does not check the number of registered apps.
-// Either Omaha is installed or has been cleaned up.
-// Installed means Clients, ClientState, etc. sub keys exist.
-// Cleaned up may mean the Update key does not exist or some values, such as
-// mid and uid exist, but there are no subkeys.
-// The Update key should never exist without any values.
-// Does not take the Setup Lock because it is just a dbg check. It is possible
-// for the value of did_uninstall_ to be changed in another thread or for
-// another process to install or uninstall Google Update while this is running.
-void Setup::CheckInstallStateConsistency(bool is_machine) {
-  UNREFERENCED_PARAMETER(is_machine);
-#if DEBUG
-  CString key_name = ConfigManager::Instance()->registry_update(is_machine);
-  if (!RegKey::HasKey(key_name)) {
-    // Either this instance called uninstall or it is the non-elevated machine
-    // instance on Vista and later. Both cannot be true in the same instance.
-    ASSERT1(did_uninstall_ != (is_machine && !vista_util::IsUserAdmin()));
-    return;
-  }
-
-  RegKey update_key;
-  ASSERT1(SUCCEEDED(update_key.Open(key_name, KEY_READ)));
-
-  ASSERT1(0 != update_key.GetValueCount());
-
-  if (did_uninstall_) {
-    ASSERT1(0 == update_key.GetSubkeyCount());
-    ASSERT1(!update_key.HasValue(kRegValueInstalledVersion));
-    ASSERT1(!update_key.HasValue(kRegValueInstalledPath));
-  } else {
-    ASSERT1(update_key.HasSubkey(_T("Clients")));
-    ASSERT1(update_key.HasSubkey(_T("ClientState")));
-    ASSERT1(update_key.HasSubkey(_T("network")));
-    ASSERT1(update_key.HasValue(kRegValueInstalledVersion));
-    ASSERT1(update_key.HasValue(kRegValueInstalledPath));
-
-    CString installed_version;
-    ASSERT1(SUCCEEDED(update_key.GetValue(kRegValueInstalledVersion,
-                                          &installed_version)));
-    const CString state_key_name =
-      ConfigManager::Instance()->registry_client_state_goopdate(is_machine);
-    CString pv;
-    ASSERT1(SUCCEEDED(RegKey::GetValue(state_key_name,
-                                       kRegValueProductVersion,
-                                       &pv)));
-    ASSERT1(installed_version == pv);
-  }
-#endif
-}
-
-// Stops both legacy and current instances.
-// Holds the shutdown events so that other instances do not start running.
-// The caller is responsible for releasing the events.
-// Because this waiting occurs before a UI is generated, we do not want to wait
-// too long.
-HRESULT Setup::StopGoogleUpdate() {
-  OPT_LOG(L1, (_T("[Stopping other instances]")));
-
-  HRESULT hr = SignalShutdownEvent();
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[SignalShutdownEvent failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT Setup::StopGoogleUpdateAndWait() {
-  HRESULT hr = StopGoogleUpdate();
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[StopGoogleUpdate failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  Pids pids;
-  hr = GetPidsToWaitFor(&pids);
-  if (FAILED(hr)) {
-    SETUP_LOG(LEVEL_ERROR, (_T("[GetPidsToWaitFor failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  hr = WaitForOtherInstancesToExit(pids);
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[WaitForOtherInstancesToExit failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// Signals >= 1.2.x processes to exit.
-HRESULT Setup::SignalShutdownEvent() {
-  SETUP_LOG(L1, (_T("[Setup::SignalShutdownEvent]")));
-  NamedObjectAttributes event_attr;
-  GetShutdownEventAttributes(is_machine_, &event_attr);
-
-  if (!shutdown_event_) {
-    HRESULT hr = goopdate_utils::CreateEvent(&event_attr,
-                                             address(shutdown_event_));
-    if (FAILED(hr)) {
-      SETUP_LOG(LE, (_T("[CreateEvent current failed][0x%08x]"), hr));
-      return hr;
-    }
-  }
-
-  VERIFY1(::SetEvent(get(shutdown_event_)));
-
-  return S_OK;
-}
-
-void Setup::ReleaseShutdownEvents() {
-  if (!shutdown_event_) {
-    return;
-  }
-
-  VERIFY1(::ResetEvent(get(shutdown_event_)));
-  reset(shutdown_event_);
-}
-
-// Because this waiting can occur before a UI is generated, we do not want to
-// wait too long.
-// If a process fails to stop, its mode is stored in extra_code1_.
-// Does not return until all opened handles have been closed.
-// TODO(omaha): Add a parameter to specify the amount of time to wait to this
-// method and StopGoogleUpdateAndWait after we unify Setup and always have a UI.
-HRESULT Setup::WaitForOtherInstancesToExit(const Pids& pids) {
-  OPT_LOG(L1, (_T("[Waiting for other instances to exit]")));
-
-  // Wait for all the processes to exit.
-  std::vector<HANDLE> handles;
-  for (size_t i = 0; i < pids.size(); ++i) {
-    SETUP_LOG(L2, (_T("[Waiting for process][%u]"), pids[i]));
-
-    DWORD desired_access =
-        PROCESS_QUERY_INFORMATION | SYNCHRONIZE | PROCESS_TERMINATE;
-    scoped_handle handle(::OpenProcess(desired_access,
-                                       FALSE,
-                                       pids[i]));
-    if (!handle) {
-      HRESULT hr = HRESULTFromLastError();
-      SETUP_LOG(LE, (_T("[::OpenProcess failed][%u][0x%08x]"), pids[i], hr));
-      continue;
-    }
-
-    handles.push_back(release(handle));
-  }
-
-  HRESULT hr = S_OK;
-  if (!handles.empty()) {
-    SETUP_LOG(L2, (_T("[Calling ::WaitForMultipleObjects]")));
-
-    HighresTimer metrics_timer;
-    const int wait_ms = is_self_update_ ? kSetupUpdateShutdownWaitMs :
-                                          kSetupInstallShutdownWaitMs;
-    DWORD res = ::WaitForMultipleObjects(handles.size(),
-                                         &handles.front(),
-                                         true,  // wait for all
-                                         wait_ms);
-    metric_setup_process_wait_ms.AddSample(metrics_timer.GetElapsedMs());
-
-    SETUP_LOG(L2, (_T("[::WaitForMultipleObjects returned]")));
-    ASSERT1(WAIT_OBJECT_0 == res || WAIT_TIMEOUT == res);
-    if (WAIT_FAILED == res) {
-      const DWORD error = ::GetLastError();
-      SETUP_LOG(LE, (_T("[::WaitForMultipleObjects failed][%u]"), error));
-      hr = HRESULT_FROM_WIN32(error);
-    } else if (WAIT_OBJECT_0 != res) {
-      OPT_LOG(LEVEL_ERROR, (_T("[Other GoogleUpdate.exe instances failed to ")
-                            _T("shutdown in time][%u]"), res));
-
-      extra_code1_ = COMMANDLINE_MODE_UNKNOWN;
-
-      SETUP_LOG(L2, (_T("[Listing processes that did not exit. This may be ")
-                    _T("incomplete if processes exited after ")
-                    _T("WaitForMultipleObjects returned.]")));
-      for (size_t i = 0; i < handles.size(); ++i) {
-        if (WAIT_TIMEOUT == ::WaitForSingleObject(handles[i], 0)) {
-          uint32 pid = Process::GetProcessIdFromHandle(handles[i]);
-          if (!pid) {
-            SETUP_LOG(LW, (_T(" [Process::GetProcessIdFromHandle failed][%u]"),
-                          ::GetLastError()));
-            SETUP_LOG(L2, (_T(" [Process did not exit][unknown]")));
-            continue;
-          }
-          SETUP_LOG(L2, (_T(" [Process did not exit][%u]"), pid));
-
-          CommandLineMode mode(COMMANDLINE_MODE_UNKNOWN);
-          if (SUCCEEDED(GetProcessModeFromPid(pid, &mode))) {
-            extra_code1_ = mode;
-          }
-          IncrementProcessWaitFailCount(mode);
-        }
-      }
-
-      ++metric_setup_process_wait_failed;
-      hr = GOOPDATE_E_INSTANCES_RUNNING;
-    }
-  }
-  if (SUCCEEDED(hr)) {
-    SETUP_LOG(L3, (_T("[Wait for all processes to exit succeeded]")));
-  } else {
-    for (size_t i = 0; i < handles.size(); ++i) {
-      if (!::TerminateProcess(handles[i], UINT_MAX)) {
-        const uint32 pid = Process::GetProcessIdFromHandle(handles[i]);
-        const DWORD error = ::GetLastError();
-        SETUP_LOG(LW, (_T("[::TerminateProcess failed][%u][%u]"), pid, error));
-      }
-    }
-
-    const int kTerminateWaitMs = 500;
-    DWORD res = ::WaitForMultipleObjects(handles.size(), &handles.front(),
-                                         true, kTerminateWaitMs);
-    if (res != WAIT_OBJECT_0) {
-      const DWORD error = ::GetLastError();
-      SETUP_LOG(LW, (_T("[Wait failed][%u][%u]"), res, error));
-    }
-  }
-
-  // Close the handles.
-  for (size_t i = 0; i < handles.size(); ++i) {
-    if (!::CloseHandle(handles[i])) {
-      HRESULT hr = HRESULTFromLastError();
-      SETUP_LOG(LEVEL_WARNING, (_T("[CloseHandle failed][0x%08x]"), hr));
-    }
-  }
-
-  return S_OK;
-}
-
-// Wait for all instances of Omaha running as the current user - or as any user
-// in the case of machine installs - except "/install" or "/registerproduct"
-// instances, which should be blocked by the Setup Lock, which we are holding.
-HRESULT Setup::GetPidsToWaitFor(Pids* pids) const {
-  ASSERT1(pids);
-
-  HRESULT hr = GetPidsToWaitForUsingCommandLine(pids);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  ASSERT1(pids->end() == std::find(pids->begin(), pids->end(),
-                                   ::GetCurrentProcessId()));
-  SETUP_LOG(L3, (_T("[found %d total processes to wait for]"), pids->size()));
-
-  return S_OK;
-}
-
-// Finds processes to wait for based on the command line.
-// Differences between Omaha 2 and this code:
-//  * User's processes running outside AppData are not caught. This should only
-//    be /install or /registerproduct.
-//  * In the user case, "machine" processes running as the user are EXcluded
-//    based on path instead of mode and "needsadmin=true". This additionally
-//    excludes oneclick cross-installs (u-to-m).
-//  * In the machine case, "machine" processes running as the user are INcluded
-//    based on path instead of mode and "needsadmin=true".
-//  * /pi: m-to-u running in PF as user with needsadmin=false: now INcluded.
-//    This is a good idea, since we do not want to delete the in-use file.
-//    /pi: u-to-m running in appdata as user with needsadmin=true: now
-//    EXcluded.
-HRESULT Setup::GetPidsToWaitForUsingCommandLine(Pids* pids) const {
-  CORE_LOG(L3, (_T("[Setup::GetPidsToWaitForUsingCommandLine]")));
-
-  ASSERT1(pids);
-
-  // Get processes running as the current user in the case of user, and all
-  // users as well as SYSTEM in the case of machine, except those with
-  // * "/install" - must be excluded because may be waiting for the Setup Lock.
-  // * "/registerproduct" - same as for /install.
-  std::vector<CString> command_lines;
-  CString switch_to_exclude;
-  switch_to_exclude.Format(_T("/%s"), kCmdLineInstall);
-  command_lines.push_back(switch_to_exclude);
-  switch_to_exclude.Format(_T("/%s"), kCmdLineRegisterProduct);
-
-  CString user_sid;
-  DWORD flags = EXCLUDE_CURRENT_PROCESS |
-                EXCLUDE_PROCESS_COMMAND_LINE_CONTAINING_STRING;
-
-  if (!is_machine_) {
-    // Search only the same sid as the current user.
-    flags |= INCLUDE_ONLY_PROCESS_OWNED_BY_USER;
-
-    HRESULT hr = user_info::GetProcessUser(NULL, NULL, &user_sid);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[GetProcessUser failed][0x%x]"), hr));
-      return hr;
-    }
-  }
-
-  std::vector<uint32> google_update_process_ids;
-  HRESULT hr = Process::FindProcesses(flags,
-                                      kOmahaShellFileName,
-                                      true,
-                                      user_sid,
-                                      command_lines,
-                                      &google_update_process_ids);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T(" [FindProcesses failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  const ConfigManager* cm = ConfigManager::Instance();
-  CString official_path(is_machine_ ?
-                        cm->GetMachineGoopdateInstallDirNoCreate() :
-                        cm->GetUserGoopdateInstallDirNoCreate());
-  ASSERT1(!official_path.IsEmpty());
-
-  // Only include processes running under the official path.
-  Pids pids_to_wait_for;
-  for (size_t i = 0; i < google_update_process_ids.size(); ++i) {
-    CString cmd_line;
-    const uint32 process_id = google_update_process_ids[i];
-    if (SUCCEEDED(Process::GetCommandLine(process_id, &cmd_line))) {
-      cmd_line.MakeLower();
-
-      CString exe_path;
-      if (SUCCEEDED(GetExePathFromCommandLine(cmd_line, &exe_path)) &&
-          String_StrNCmp(official_path, exe_path, official_path.GetLength(),
-                         true) == 0) {
-        CORE_LOG(L4, (_T(" [Including pid][%u][%s]"), process_id, cmd_line));
-        pids_to_wait_for.push_back(process_id);
-      }
-    }
-  }
-
-  pids->swap(pids_to_wait_for);
-  return S_OK;
-}
-
-// On Windows Vista, an admin must be elevated in order to install a machine app
-// without elevating. On Vista, IsUserAdmin returns false unless the user is
-// elevated.
-bool Setup::IsElevationRequired() const {
-  return is_machine_ && !vista_util::IsUserAdmin();
-}
-
-// Start the machine core process using one of the launch mechanisms.
-// We know that at least one of the service and scheduled task were installed
-// because otherwise we would have exited fatally.
-// If the service was not installed, starting it will just fail silently and we
-// will start the scheduled task.
-// do not call this method until the shutdown event has been released or the
-// process may immediately exit.
-// TODO(omaha): Provide service_hr and task_hr failures in a ping.
-HRESULT Setup::StartMachineCoreProcess() const {
-  SETUP_LOG(L3, (_T("[Setup::StartMachineCoreProcess]")));
-
-  HighresTimer metrics_timer;
-
-  // Start the service.
-  ++metric_setup_start_service_total;
-  HRESULT service_hr = SetupUpdate3Service::StartService();
-  if (SUCCEEDED(service_hr)) {
-    metric_setup_start_service_ms.AddSample(metrics_timer.GetElapsedMs());
-    OPT_LOG(L1, (_T("[Service started]")));
-    ++metric_setup_start_service_succeeded;
-    return S_OK;
-  }
-  metric_setup_start_service_failed_ms.AddSample(metrics_timer.GetElapsedMs());
-  OPT_LOG(LEVEL_ERROR, (_T("[Start service failed][0x%08x]"), service_hr));
-  metric_setup_start_service_error = service_hr;
-
-  // TODO(omaha): We should only skip this block when /install /silent fails
-  // and there are no other apps installed. Guarantee this somehow.
-  ++metric_setup_start_task_total;
-  const ULONGLONG start_task_start_ms = metrics_timer.GetElapsedMs();
-  HRESULT task_hr = scheduled_task_utils::StartGoopdateTaskCore(true);
-  if (SUCCEEDED(task_hr)) {
-    const ULONGLONG start_task_end_ms = metrics_timer.GetElapsedMs();
-    ASSERT1(start_task_end_ms >= start_task_start_ms);
-    metric_setup_start_task_ms.AddSample(
-        start_task_end_ms - start_task_start_ms);
-    OPT_LOG(L1, (_T("[run scheduled task succeeded]")));
-    ++metric_setup_start_task_succeeded;
-    return S_OK;
-  }
-  OPT_LOG(LE, (_T("[Start scheduled task failed][0x%08x]"), task_hr));
-  metric_setup_start_task_error = task_hr;
-
-  return service_hr;
-}
-
-// Start the user core process directly.
-// Do not call this method until the shutdown event has been released or the
-// process may immediately exit.
-HRESULT Setup::StartUserCoreProcess(const CString& core_cmd_line) const {
-  HRESULT hr = System::StartCommandLine(core_cmd_line);
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[Could not start Google Update Core][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT Setup::FindCoreProcesses(Pids* found_core_pids) const {
-  SETUP_LOG(L3, (_T("[Setup::FindCoreProcesses]")));
-  ASSERT1(found_core_pids);
-
-  CString user_sid;
-  HRESULT hr = GetAppropriateSid(&user_sid);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  std::vector<CString> command_lines;
-  CString switch_to_include;
-  switch_to_include.Format(_T("/%s"), kCmdLineCore);
-  command_lines.push_back(switch_to_include);
-
-  DWORD flags = INCLUDE_ONLY_PROCESS_OWNED_BY_USER |
-                EXCLUDE_CURRENT_PROCESS |
-                INCLUDE_PROCESS_COMMAND_LINE_CONTAINING_STRING;
-  hr = Process::FindProcesses(flags,
-                              kOmahaShellFileName,
-                              true,
-                              user_sid,
-                              command_lines,
-                              found_core_pids);
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[FindProcesses failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  // Remove PIDs where the command line is not actually the "/c" switch and is
-  // some other command line, such as "/cr".
-  const Pids::iterator new_end = std::remove_if(
-      found_core_pids->begin(),
-      found_core_pids->end(),
-      std::not1(std::ptr_fun(IsCoreProcess)));
-  if (new_end != found_core_pids->end()) {
-    found_core_pids->erase(new_end, found_core_pids->end());
-  }
-
-  SETUP_LOG(L2, (_T("[Core processes found][%u]"), found_core_pids->size()));
-  return S_OK;
-}
-
-// Does not try to terminate legacy processes.
-// Waits up to 500 ms for the terminated core processes to exit.
-HRESULT Setup::TerminateCoreProcesses() const {
-  SETUP_LOG(L2, (_T("[Setup::TerminateCoreProcesses]")));
-  Pids found_core_pids;
-  HRESULT hr = FindCoreProcesses(&found_core_pids);
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[FindCoreProcesses failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  std::vector<HANDLE> terminated_processes;
-  for (size_t i = 0; i < found_core_pids.size(); ++i) {
-    uint32 pid = found_core_pids[i];
-
-    SETUP_LOG(L2, (_T("[Terminating core process][%u]"), pid));
-
-    HANDLE process(::OpenProcess(SYNCHRONIZE | PROCESS_TERMINATE, FALSE, pid));
-    if (!process) {
-      SETUP_LOG(LW, (_T("[::OpenProcess failed][%u][%u]"),
-                     pid, ::GetLastError()));
-      continue;
-    }
-    terminated_processes.push_back(process);
-
-    if (!::TerminateProcess(process, static_cast<uint32>(-2))) {
-      SETUP_LOG(LW, (_T("[::TerminateProcess failed][%u][%u]"),
-                     pid, ::GetLastError()));
-    }
-  }
-
-  if (terminated_processes.empty()) {
-    return S_OK;
-  }
-  // Do not return until the handles have been closed.
-
-  const int kCoreTerminateWaitMs = 500;
-  DWORD res = ::WaitForMultipleObjects(terminated_processes.size(),
-                                       &terminated_processes.front(),
-                                       true,  // wait for all
-                                       kCoreTerminateWaitMs);
-  SETUP_LOG(L2, (_T("[::WaitForMultipleObjects returned]")));
-  ASSERT1(WAIT_OBJECT_0 == res || WAIT_TIMEOUT == res);
-  if (WAIT_FAILED == res) {
-    const DWORD error = ::GetLastError();
-    SETUP_LOG(LE, (_T("[::WaitForMultipleObjects failed][%u]"), error));
-    hr = HRESULT_FROM_WIN32(error);
-  } else {
-    hr = HRESULT_FROM_WIN32(res);
-  }
-
-  for (size_t i = 0; i < terminated_processes.size(); ++i) {
-    VERIFY1(::CloseHandle(terminated_processes[i]));
-  }
-
-  return hr;
-}
-
-// Tries to start the core using existing launch methods if present.
-// Uses the service or the scheduled task for machine, and the Run key value for
-// user.
-HRESULT Setup::StartCore() const {
-  SETUP_LOG(L2, (_T("[Attempting to start core]")));
-
-  if (is_machine_) {
-    HRESULT hr = StartMachineCoreProcess();
-    if (FAILED(hr)) {
-      SETUP_LOG(LW, (_T("[StartMachineCoreProcess failed][0x%08x]"), hr));
-      return hr;
-    }
-
-    return hr;
-  }
-
-  CString installed_run_cmd_line;
-  HRESULT hr = RegKey::GetValue(USER_KEY REGSTR_PATH_RUN, kRunValueName,
-                                &installed_run_cmd_line);
-  if (FAILED(hr)) {
-    SETUP_LOG(LW, (_T("[Failed to get Run val][%s][0x%x]"), kRunValueName, hr));
-    return hr;
-  }
-
-  hr = StartUserCoreProcess(installed_run_cmd_line);
-  if (FAILED(hr)) {
-    SETUP_LOG(LW, (_T("[StartUserCoreProcess failed][%s][0x%x]"),
-                   installed_run_cmd_line, hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// Returns Local System's SID for machine installs and the user's SID otherwise.
-HRESULT Setup::GetAppropriateSid(CString* sid) const {
-  ASSERT1(sid);
-  if (is_machine_) {
-    *sid = kLocalSystemSid;
-  } else {
-    HRESULT hr = user_info::GetProcessUser(NULL, NULL, sid);
-    if (FAILED(hr)) {
-      SETUP_LOG(LEVEL_ERROR, (_T("[GetProcessUser failed][0x%08x]"), hr));
-      return hr;
-    }
-  }
-
-  return S_OK;
-}
-
-bool Setup::InitSetupLock(bool is_machine, GLock* setup_lock) {
-  ASSERT1(setup_lock);
-  NamedObjectAttributes setup_lock_attr;
-  GetNamedObjectAttributes(kSetupMutex, is_machine, &setup_lock_attr);
-  return setup_lock->InitializeWithSecAttr(setup_lock_attr.name,
-                                           &setup_lock_attr.sa);
-}
-
-// Assumes that the Setup Lock is held.
-// This method is based on the assumption that if another install, which could
-// be modifying the number of clients, is in progress, that it either:
-//  (a) Has the Setup Lock, which is not possible because this process has it.
-//  (b) Has started an install worker.
-// TODO(omaha3): This is flawed: http://b/2764048.
-bool Setup::CanUninstallGoogleUpdate() const {
-  CORE_LOG(L2, (_T("[Setup::CanUninstallGoogleUpdate]")));
-  if (goopdate_utils::IsAppInstallWorkerRunning(is_machine_)) {
-    CORE_LOG(L2, (_T("[Found install workers. Not uninstalling]")));
-    return false;
-  }
-  if (ShouldDelayUninstall()) {
-    // If the DelayUninstall flag is set, that implies that someone has
-    // installed us with the runtime=true flag, expecting that they can
-    // use our API later from another process.  If 24 hours have passed
-    // since that initial Omaha install, we clear the flag but still
-    // return false for this check.  (That way, if a machine has been
-    // suspended in mid-install, they still have a grace period until
-    // the next /ua to get something installed.)
-    CORE_LOG(L3, (_T("[DelayUninstall is set. Not uninstalling.]")));
-    if (ConfigManager::Instance()->Is24HoursSinceInstall(is_machine_)) {
-      CORE_LOG(L4, (_T("[24 hours elapsed; clearing DelayUninstall.]")));
-      SetDelayUninstall(false);
-    }
-    return false;
-  }
-  size_t num_clients(0);
-  if (SUCCEEDED(app_registry_utils::GetNumClients(is_machine_, &num_clients)) &&
-      num_clients >= 2) {
-    CORE_LOG(L3, (_T("[Found products. Not uninstalling]")));
-    return false;
-  }
-
-  return true;
-}
-
-bool Setup::ShouldDelayUninstall() const {
-  const TCHAR* key = ConfigManager::Instance()->registry_update(is_machine_);
-  if (!RegKey::HasValue(key, kRegValueDelayOmahaUninstall)) {
-    return false;
-  }
-  DWORD should_delay = 0;
-  if (FAILED(RegKey::GetValue(key,
-                              kRegValueDelayOmahaUninstall,
-                              &should_delay))) {
-    return false;
-  }
-  return should_delay != 0;
-}
-
-HRESULT Setup::SetDelayUninstall(bool should_delay) const {
-  const TCHAR* key = ConfigManager::Instance()->registry_update(is_machine_);
-  if (should_delay) {
-    return RegKey::SetValue(key, kRegValueDelayOmahaUninstall, 1UL);
-  } else {
-    return RegKey::DeleteValue(key, kRegValueDelayOmahaUninstall);
-  }
-}
-
-HRESULT Setup::SendUninstallPing() {
-  CORE_LOG(L3, (_T("[SendUninstallPing]")));
-
-  const bool is_eula_accepted =
-      app_registry_utils::IsAppEulaAccepted(is_machine_,
-                                            kGoogleUpdateAppId,
-                                            false);
-
-  if (!is_eula_accepted) {
-    CORE_LOG(LE, (_T("[SendUninstallPing - eula not accepted]")));
-    return E_FAIL;
-  }
-
-  PingEventPtr uninstall_ping_event(
-      new PingEvent(PingEvent::EVENT_UNINSTALL,
-                    PingEvent::EVENT_RESULT_SUCCESS,
-                    0,
-                    0));
-
-  // Generate a session ID for uninstall pings.  NOTE: The assumption here is
-  // that if /uninstall was launched by /ua, we have no updates to check for,
-  // so we assume that /ua won't use its own session ID.  If /ua does any
-  // network activity on a no-clients case, we will have to start passing the
-  // session ID from /ua to /uninstall in the future.
-  CString session_id;
-  VERIFY1(SUCCEEDED(GetGuid(&session_id)));
-
-  // Send uninstall ping for uninstalled apps.
-  HRESULT hr = S_OK;
-  std::vector<CString> uninstalled_apps;
-  if (SUCCEEDED(app_registry_utils::GetUninstalledApps(is_machine_,
-                                                       &uninstalled_apps))) {
-    Ping apps_uninstall_ping(is_machine_, session_id, kInstallSource_Uninstall);
-    apps_uninstall_ping.LoadAppDataFromRegistry(uninstalled_apps);
-    apps_uninstall_ping.BuildAppsPing(uninstall_ping_event);
-
-    hr = apps_uninstall_ping.Send(false);
-    if (FAILED(hr)) {
-      CORE_LOG(LE, (_T("[SendUninstallPing: failed to send app uninstall ping]")
-                    _T("[0x%08x]"), hr));
-    }
-  }
-
-  // Send uninstall ping for Omaha.
-  const CString current_omaha_version(GetVersionString());
-  const CString next_omaha_version;     // Empty, in the uninstall case.
-  Ping omaha_uninstall_ping(is_machine_, session_id, kInstallSource_Uninstall);
-  omaha_uninstall_ping.LoadOmahaDataFromRegistry();
-  omaha_uninstall_ping.BuildOmahaPing(current_omaha_version,
-                                      next_omaha_version,
-                                      uninstall_ping_event);
-  hr = omaha_uninstall_ping.Send(false);
-  if (SUCCEEDED(hr)) {
-    // Clears the registry after ping is sent successfully.
-    std::vector<CString> uninstalled_apps;
-    app_registry_utils::GetUninstalledApps(is_machine_, &uninstalled_apps);
-    app_registry_utils::RemoveClientStateForApps(is_machine_, uninstalled_apps);
-  } else {
-    CORE_LOG(LE, (_T("[SendUninstallPing: failed to send Omaha uninstall ping]")
-                  _T("[0x%08x]"), hr));
-  }
-
-  return hr;
-}
-
-
-}  // namespace omaha
diff --git a/setup/setup.h b/setup/setup.h
deleted file mode 100644
index f61a9d6..0000000
--- a/setup/setup.h
+++ /dev/null
@@ -1,198 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// There are two phases of setup. Both are done in an instance running from a
-// temp location.
-//  1) Copy the Google Update files to the install location.
-//  2) Do everything else to install Google Update.
-//   * Executed by SetupGoogleUpdate().
-//
-//  Uninstall() undoes both phases of setup.
-//  All methods assume the instance is running with the correct permissions.
-
-#ifndef OMAHA_SETUP_SETUP_H__
-#define OMAHA_SETUP_SETUP_H__
-
-#include <windows.h>
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/scoped_any.h"
-
-namespace omaha {
-
-class GLock;
-class HighresTimer;
-struct NamedObjectAttributes;
-
-class SetupFiles;
-
-class Setup {
- public:
-  explicit Setup(bool is_machine);
-  ~Setup();
-
-  // Installs Omaha if necessary.
-  HRESULT Install(bool set_keepalive);
-
-  // Acquires the Setup Lock and uninstalls all Omaha versions if Omaha can be
-  // uninstalled.
-  HRESULT Uninstall(bool send_uninstall_ping);
-
-  // Verifies that Omaha is either properly installed or uninstalled completely.
-  // TODO(omaha): Consider making this and did_uninstall_ non-static after
-  // refactoring Setup phases. May require a Setup member in Goopdate.
-  static void CheckInstallStateConsistency(bool is_machine);
-
-  int extra_code1() const { return extra_code1_; }
-
-  void set_is_self_update(bool is_self_update) {
-    is_self_update_ = is_self_update;
-  }
-
- private:
-  typedef std::vector<uint32> Pids;
-
-  // Completes installation.
-  HRESULT SetupGoogleUpdate();
-
-  // Handles Setup lock acquisition failures and returns the error to report.
-  HRESULT HandleLockFailed(int lock_version);
-
-  // Does the install work within all necessary locks, which have already been
-  // acquired.
-  HRESULT DoProtectedInstall(bool set_keepalive);
-
-  // Uninstalls all Google Update versions after checking if Google Update can
-  // be uninstalled.
-  HRESULT DoProtectedUninstall(bool send_uninstall_ping);
-
-  // Returns whether Google Update should be installed.
-  bool ShouldInstall(SetupFiles* setup_files);
-
-  // Returns whether the same version of Google Update should be over-installed.
-  bool ShouldOverinstallSameVersion(SetupFiles* setup_files);
-
-  HRESULT DoProtectedGoogleUpdateInstall(SetupFiles* setup_files);
-
-  // Rolls back the changes made during DoProtectedGoogleUpdateInstall().
-  // Call when that method fails.
-  void RollBack(SetupFiles* setup_files);
-
-  // Tells other instances to stop.
-  HRESULT StopGoogleUpdate();
-
-  // Tells other instances to stop then waits for them to exit.
-  HRESULT StopGoogleUpdateAndWait();
-
-  // Sets the shutdown event to signal other instances for this user or machine
-  // to exit.
-  HRESULT SignalShutdownEvent();
-
-  // Releases all the shutdown events.
-  void ReleaseShutdownEvents();
-
-  // Waits for other instances of GoogleUpdate.exe to exit.
-  HRESULT WaitForOtherInstancesToExit(const Pids& pids);
-
-  // Gets the list of all the GoogleUpdate.exe processes to wait for.
-  HRESULT GetPidsToWaitFor(Pids* pids) const;
-
-  // Gets a list of GoogleUpdate.exe processes for user or machine that are
-  // running from the respective official directory, except "/install" or
-  // "/registerproduct" instances.
-  // In the machine case we search in all the accounts since the workers can be
-  // running in any admin account and the machine update worker runs as SYSTEM.
-  // In the user case, we only search the user's account.
-  // In both cases, the command line location is used to determine the
-  // machine/user cases.
-  HRESULT GetPidsToWaitForUsingCommandLine(Pids* pids) const;
-
-  // Returns whether elevation is required to perform this install.
-  bool IsElevationRequired() const;
-
-// TODO(omaha3): Support offline builds. Prefer to detect and maybe copy outside
-// Setup.
-#if 0
-  // Given a guid, finds and copies the offline manifest and binaries from the
-  // current module directory to the offline_dir passed in. offline_dir is
-  // typically the Google\Update\Offline\ directory. The offline manifest is
-  // copied to offline_dir\{GUID}.gup. The binaries are in the format
-  // "Installer.msi.{GUID}", and they are copied to the offline_dir under the
-  // subdirectory {GUID}, as Installer.msi.
-  static HRESULT CopyOfflineFilesForGuid(const CString& app_guid,
-                                         const CString& offline_dir);
-
-  // For all the applications that have been requested, copy the offline
-  // binaries. Calls CopyOfflineFilesForGuid() for each app_guid.
-  bool CopyOfflineFiles(const CString& offline_dir);
-#endif
-
-  // Starts the core.
-  HRESULT StartMachineCoreProcess() const;
-  HRESULT StartUserCoreProcess(const CString& core_cmd_line) const;
-
-  // Returns the pids of running Omaha 2 Core processes for this user/system.
-  HRESULT FindCoreProcesses(Pids* found_core_pids) const;
-
-  // Forcefully kills appropriate core processes using ::TerminateProcess().
-  HRESULT TerminateCoreProcesses() const;
-
-  // Verifies that the appropriate core is running.
-  bool IsCoreProcessRunning() const;
-
-  // Starts the long-lived Core process.
-  HRESULT StartCore() const;
-
-  // Returns the SID to use for process searches, mutexes, etc. during this
-  // installation.
-  HRESULT GetAppropriateSid(CString* sid) const;
-
-  // Initializes the Setup Lock with correct name and security attributes.
-  static bool InitSetupLock(bool is_machine, GLock* setup_lock);
-
-  // Returns true if GoogleUpdate can be uninstalled now.
-  bool CanUninstallGoogleUpdate() const;
-
-  // Control the state of the DelayUninstall flag.  If set, uninstall will
-  // be delayed for at least 24 hours after initial install.
-  bool ShouldDelayUninstall() const;
-  HRESULT SetDelayUninstall(bool should_delay) const;
-
-  // Sends the uninstall ping and waits for the ping to be sent.
-  HRESULT SendUninstallPing();
-
-  const bool is_machine_;
-  bool is_self_update_;
-  CString saved_version_;  // Previous version saved for roll back.
-  scoped_event shutdown_event_;
-  int extra_code1_;
-
-  scoped_ptr<HighresTimer> metrics_timer_;
-
-  // Whether this process uninstalled Google Update for any reason.
-  // Access must be protected by the Setup Lock.
-  static bool did_uninstall_;
-
-  friend class SetupTest;
-  friend class SetupOfflineInstallerTest;
-  DISALLOW_EVIL_CONSTRUCTORS(Setup);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_SETUP_SETUP_H__
-
diff --git a/setup/setup_files.cc b/setup/setup_files.cc
deleted file mode 100644
index a386fc9..0000000
--- a/setup/setup_files.cc
+++ /dev/null
@@ -1,538 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/setup/setup_files.h"
-
-#include <atlpath.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/highres_timer-win32.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/path.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/scoped_current_directory.h"
-#include "omaha/base/signatures.h"
-#include "omaha/base/signaturevalidator.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/goopdate/resource_manager.h"
-#include "omaha/setup/setup_metrics.h"
-
-namespace omaha {
-
-namespace {
-
-const int kNumberOfCreateServiceRetries = 5;
-const int kSleepBetweenCreateServiceRetryMs = 200;
-
-}  // namespace
-
-SetupFiles::SetupFiles(bool is_machine)
-: is_machine_(is_machine) {
-  SETUP_LOG(L2, (_T("[SetupFiles::SetupFiles]")));
-}
-
-SetupFiles::~SetupFiles() {
-  SETUP_LOG(L2, (_T("[SetupFiles::~SetupFiles]")));
-
-  if (!saved_shell_path_.IsEmpty()) {
-    // Delete the saved copy of the previous shell.
-    VERIFY1(SUCCEEDED(File::Remove(saved_shell_path_)));
-  }
-}
-
-HRESULT SetupFiles::Init() {
-  SETUP_LOG(L2, (_T("[SetupFiles::Init]")));
-
-  HRESULT hr = BuildFileLists();
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// We only do these checks for the same exact version. This is especially true
-// when doing file comparisons, because the filenames as well as the number of
-// files can change from version to version. An earlier version should not
-// overinstall a newer version by mistake because it is checking for files that
-// no longer exist in the new version.
-bool SetupFiles::ShouldOverinstallSameVersion() {
-  SETUP_LOG(L2, (_T("[SetupFiles::ShouldOverinstallSameVersion]")));
-
-  CPath install_dir = goopdate_utils::BuildInstallDirectory(is_machine_,
-                                                            GetVersionString());
-  for (size_t i = 0 ; i < core_program_files_.size(); ++i) {
-    CString full_path = ConcatenatePath(install_dir, core_program_files_[i]);
-    if (full_path.IsEmpty()) {
-      ASSERT1(false);
-      return true;
-    }
-    if (!File::Exists(full_path)) {
-      SETUP_LOG(L2, (_T("[core file missing - overinstall][%s]]"), full_path));
-      return true;
-    }
-  }
-
-  for (size_t i = 0 ; i < optional_files_.size(); ++i) {
-    CString full_path = ConcatenatePath(install_dir, optional_files_[i]);
-    if (full_path.IsEmpty()) {
-      ASSERT1(false);
-      return true;
-    }
-    if (!File::Exists(full_path)) {
-      SETUP_LOG(L2, (_T("[optional file missing - overinstall][%s]]"),
-                     full_path));
-      return true;
-    }
-  }
-
-  CString shell_path = goopdate_utils::BuildGoogleUpdateExePath(is_machine_);
-  if (!File::Exists(shell_path)) {
-    SETUP_LOG(L2, (_T("[shell missing - overinstall][%s]]"), shell_path));
-    return true;
-  }
-
-  return false;
-}
-
-// Install the required and optional files.
-// Assumes that the user already has the appropriate permissions
-// (e.g. is elevated for a machine install).
-// Assumes ShouldInstall has been called and returned true.
-// Assumes no other instances of GoogleUpdate.exe are running.
-HRESULT SetupFiles::Install() {
-  OPT_LOG(L1, (_T("[Install files]")));
-  ASSERT1(vista_util::IsUserAdmin() || !is_machine_);
-
-  ++metric_setup_files_total;
-  HighresTimer metrics_timer;
-
-  const bool should_over_install = ConfigManager::Instance()->CanOverInstall();
-
-  // Copy the core program files.
-  CPath install_dir = goopdate_utils::BuildInstallDirectory(is_machine_,
-                                                            GetVersionString());
-  HRESULT hr = CopyInstallFiles(core_program_files_,
-                                install_dir,
-                                should_over_install);
-  if (FAILED(hr)) {
-    OPT_LOG(LEVEL_ERROR, (_T("[Failed to copy the files][0x%08x]"), hr));
-    if (E_ACCESSDENIED == hr) {
-      return GOOPDATE_E_ACCESSDENIED_COPYING_CORE_FILES;
-    }
-    return hr;
-  }
-
-  hr = CopyShell();
-  if (FAILED(hr)) {
-    OPT_LOG(LEVEL_ERROR, (_T("[Failed to copy shell][0x%08x]"), hr));
-    if (E_ACCESSDENIED == hr) {
-      return GOOPDATE_E_ACCESSDENIED_COPYING_SHELL;
-    }
-    return hr;
-  }
-
-  // Copy the optional files.
-  VERIFY1(SUCCEEDED(CopyInstallFiles(optional_files_,
-                                     install_dir,
-                                     should_over_install)));
-
-  metric_setup_files_ms.AddSample(metrics_timer.GetElapsedMs());
-  ++metric_setup_files_verification_succeeded;
-  return S_OK;
-}
-
-// Currently only rolls back the shell file.
-HRESULT SetupFiles::RollBack() {
-  OPT_LOG(L1, (_T("[Roll back files]")));
-  ++metric_setup_rollback_files;
-
-  if (!saved_shell_path_.IsEmpty()) {
-    SETUP_LOG(L1, (_T("[Rolling back shell from %s]"), saved_shell_path_));
-    ++metric_setup_files_rollback_shell;
-
-    std::vector<CString> saved_paths;
-    saved_paths.push_back(saved_shell_path_);
-    std::vector<CString> install_paths;
-    install_paths.push_back(
-        goopdate_utils::BuildGoogleUpdateExePath(is_machine_));
-
-    HRESULT hr = CopyAndValidateFiles(saved_paths, install_paths, true);
-    if (FAILED(hr)) {
-      SETUP_LOG(LE, (_T("[CopyAndValidateFiles failed][0x%08x]"), hr));
-      return hr;
-    }
-  }
-
-  return S_OK;
-}
-
-void SetupFiles::Uninstall() {
-  SETUP_LOG(L2, (_T("[SetupFiles::Uninstall]")));
-
-  // In case we are deleting the current directory as well, let's reset the
-  // current directory to a temporary directory. On exit, we'll try to restore
-  // the directory (if it still exists).
-  scoped_current_directory root_dir(app_util::GetTempDir());
-
-  // Delete the install and crash reports directories.
-  CString install_dir(
-      is_machine_ ? ConfigManager::Instance()->GetMachineGoopdateInstallDir() :
-                    ConfigManager::Instance()->GetUserGoopdateInstallDir());
-  HRESULT hr = DeleteDirectory(install_dir);
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[DeleteDirectory failed][%s][0x%08x]"),
-                   install_dir, hr));
-  }
-}
-
-HRESULT SetupFiles::CopyShell() {
-  bool should_copy = false;
-  bool already_exists = false;
-  CString shell_path = goopdate_utils::BuildGoogleUpdateExePath(is_machine_);
-
-  HRESULT hr = ShouldCopyShell(shell_path,
-                               &should_copy,
-                               &already_exists);
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[ShouldCopyShell failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  if (should_copy) {
-    if (already_exists) {
-      ++metric_setup_files_replace_shell;
-      VERIFY1(SUCCEEDED(SaveShellForRollback(shell_path)));
-    }
-
-    std::vector<CString> shell_files;
-    shell_files.push_back(kOmahaShellFileName);
-    CPath shell_dir(shell_path);
-    VERIFY1(shell_dir.RemoveFileSpec());
-    hr = CopyInstallFiles(shell_files, shell_dir, already_exists);
-    if (FAILED(hr)) {
-      SETUP_LOG(LE, (_T("[CopyInstallFiles of shell failed][0x%08x]"), hr));
-      // TODO(omaha): If a shell already exists, we could try using the
-      // existing one, but that may lead to unexpected behavior.
-      return hr;
-    }
-  }
-
-  return S_OK;
-}
-
-HRESULT SetupFiles::ShouldCopyShell(const CString& shell_install_path,
-                                    bool* should_copy,
-                                    bool* already_exists) const {
-  ASSERT1(should_copy);
-  ASSERT1(already_exists);
-  *should_copy = false;
-  *already_exists = false;
-
-  CPath source_shell_path(app_util::GetCurrentModuleDirectory());
-  if (!source_shell_path.Append(kOmahaShellFileName)) {
-    return GOOPDATE_E_PATH_APPEND_FAILED;
-  }
-
-  if (!File::Exists(shell_install_path)) {
-    SETUP_LOG(L3, (_T("[shell does not exist - copying]")));
-    *should_copy = true;
-    return S_OK;
-  }
-  *already_exists = true;
-
-  ULONGLONG existing_version = app_util::GetVersionFromFile(shell_install_path);
-  if (!existing_version) {
-    ASSERT(false, (_T("[failed to get existing shell version - replacing]")));
-    *should_copy = true;
-    return S_OK;
-  }
-
-  ULONGLONG source_version = app_util::GetVersionFromFile(source_shell_path);
-  if (!source_version) {
-    ASSERT(false, (_T("[failed to get this shell version - not replacing]")));
-    *should_copy = false;
-    return E_FAIL;
-  }
-
-  if (existing_version > source_version) {
-    SETUP_LOG(L2, (_T("[newer shell version exists - not copying]")));
-    *should_copy = false;
-  } else if (existing_version < source_version) {
-    if (IsOlderShellVersionCompatible(existing_version)) {
-      SETUP_LOG(L2, (_T("[compatible shell version exists - not copying]")));
-      *should_copy = false;
-    } else {
-      SETUP_LOG(L2, (_T("[older shell version exists - copying]")));
-      *should_copy = true;
-    }
-  } else {
-    // Same version.
-    *should_copy = ConfigManager::Instance()->CanOverInstall();
-    SETUP_LOG(L2, (_T("[same version exists - %s copying]"),
-                  *should_copy ? _T("") : _T("not")));
-  }
-
-  return S_OK;
-}
-
-HRESULT SetupFiles::SaveShellForRollback(const CString& shell_install_path) {
-  // Copy existing file to a temporary file in case we need to roll back.
-  CString temp_file;
-  if (!::GetTempFileName(app_util::GetTempDir(),
-                         _T("gsh"),
-                         0,
-                         CStrBuf(temp_file, MAX_PATH))) {
-    const DWORD error = ::GetLastError();
-    SETUP_LOG(LEVEL_WARNING, (_T("[::GetTempFileName failed][%d]"), error));
-    return HRESULT_FROM_WIN32(error);
-  }
-
-  HRESULT hr = File::Copy(shell_install_path, temp_file, true);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  saved_shell_path_ = temp_file;
-  return S_OK;
-}
-
-// The list of files below needs to be kept in sync with payload_files in
-// omaha_version_utils.py.
-HRESULT SetupFiles::BuildFileLists() {
-  ASSERT1(core_program_files_.empty());
-  ASSERT1(optional_files_.empty());
-
-  core_program_files_.clear();
-  core_program_files_.push_back(kOmahaShellFileName);
-  core_program_files_.push_back(kOmahaDllName);
-  core_program_files_.push_back(kCrashHandlerFileName);
-
-  // TODO(omaha3): Try to not depend on ResourceManager. Maybe just find the
-  // files using wildcards.
-  ResourceManager::GetSupportedLanguageDllNames(&core_program_files_);
-
-  core_program_files_.push_back(kHelperInstallerName);
-
-  core_program_files_.push_back(kPSFileNameUser);
-  core_program_files_.push_back(kPSFileNameMachine);
-
-  // If files are removed from this list, unit tests such as
-  // ShouldInstall_SameVersionOptionalFileMissing may need to be updated.
-  optional_files_.clear();
-  optional_files_.push_back(UPDATE_PLUGIN_FILENAME);
-  optional_files_.push_back(kOmahaBrokerFileName);
-  optional_files_.push_back(kOmahaOnDemandFileName);
-  // Machine-specific files are always installed, to support cross installs from
-  // user to machine and machine to user.
-  // TODO(omaha3): Enable once it is being built.
-#if 0
-  optional_files_.push_back(BHO_FILENAME);
-#endif
-
-  return S_OK;
-}
-
-// Assumes that an install is needed.
-HRESULT SetupFiles::CopyInstallFiles(const std::vector<CString>& file_names,
-                                     const CString& destination_dir,
-                                     bool overwrite) {
-  SETUP_LOG(L1, (_T("[SetupFiles::CopyInstallFiles]")
-                 _T("[destination dir=%s][overwrite=%d]"),
-                destination_dir, overwrite));
-  ASSERT1(!file_names.empty());
-
-  CPath source_dir(app_util::GetCurrentModuleDirectory());
-  SETUP_LOG(L2, (_T("[source_dir=%s]"),
-                static_cast<const TCHAR*>(source_dir)));
-
-  if (!File::Exists(destination_dir)) {
-    // This creates the dir recursively.
-    HRESULT hr = CreateDir(destination_dir, NULL);
-    if (FAILED(hr)) {
-      return hr;
-    }
-  }
-
-  // Clean up any leftover pending removals that a previous uninstall
-  // may have left behind.
-  // Only do a prefix match if the directory is not the main Update directory.
-  // Otherwise, we may remove entries for previous version directories.
-  CPath install_path(destination_dir);
-  install_path.Canonicalize();
-  CPath goopdate_install_path(
-      is_machine_ ?
-      ConfigManager::Instance()->GetMachineGoopdateInstallDir() :
-      ConfigManager::Instance()->GetUserGoopdateInstallDir());
-  goopdate_install_path.Canonicalize();
-  bool prefix_match = install_path.m_strPath != goopdate_install_path.m_strPath;
-  HRESULT hr = File::RemoveFromMovesPendingReboot(destination_dir,
-                                                  prefix_match);
-  VERIFY1(SUCCEEDED(hr) || !vista_util::IsUserAdmin());
-
-  std::vector<CString> source_file_paths;
-  std::vector<CString> destination_file_paths;
-  for (size_t i = 0; i < file_names.size(); ++i) {
-    CPath file_from(source_dir);
-    if (!file_from.Append(file_names[i])) {
-      return GOOPDATE_E_PATH_APPEND_FAILED;
-    }
-    source_file_paths.push_back(file_from);
-
-    CPath file(destination_dir);
-    if (!file.Append(file_names[i])) {
-      return GOOPDATE_E_PATH_APPEND_FAILED;
-    }
-    destination_file_paths.push_back(file);
-  }
-
-  hr = CopyAndValidateFiles(source_file_paths,
-                            destination_file_paths,
-                            overwrite);
-
-  SETUP_LOG(L2, (_T("[SetupFiles::CopyInstallFiles][Done]")));
-  return hr;
-}
-
-HRESULT SetupFiles::CopyAndValidateFiles(
-    const std::vector<CString>& source_file_paths,
-    const std::vector<CString>& destination_file_paths,
-    bool overwrite) {
-  ASSERT1(!source_file_paths.empty());
-  ASSERT1(!destination_file_paths.empty());
-  ASSERT1(source_file_paths.size() == destination_file_paths.size());
-
-  if (overwrite) {
-    // Best effort attempt to delete the current set of files:
-    //  * try to remove an .old file that might be there.
-    //  * move the current file to a .old and delete it after reboot.
-    // Because this is a best effort, we do not propogate errors.
-
-    for (size_t i = 0; i != destination_file_paths.size(); ++i) {
-      const CString cur_file = destination_file_paths[i];
-      const CString dot_old(cur_file + _T(".old"));
-      VERIFY1(SUCCEEDED(File::Remove(dot_old)));
-      HRESULT hr = File::Move(cur_file, dot_old, true);
-      if (SUCCEEDED(hr)) {
-        // Delete after reboot only works for admins. .old files will be left
-        // for user installs not being run by elevated admins.
-        hr = File::DeleteAfterReboot(dot_old);
-        if (FAILED(hr)) {
-          SETUP_LOG(LW, (_T("DeleteAfterReboot of %s failed with 0x%08x."),
-                         dot_old, hr));
-        }
-      } else {
-        SETUP_LOG(L2, (_T("[failed to move][%s][0x%08x]"), cur_file, hr));
-        ASSERT1(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) == hr);
-      }
-    }
-  }
-
-  for (size_t i = 0; i != source_file_paths.size(); ++i) {
-    const CString& source_file = source_file_paths[i];
-    const CString& destination_file = destination_file_paths[i];
-    SETUP_LOG(L2, (_T("[CopyAndValidateFiles][from=%s][to=%s][overwrite=%d]")
-        _T("[destination file exists=%d]"), source_file, destination_file,
-        overwrite, File::Exists(destination_file)));
-
-    extra_code1_ = i + 1;  // 1-based; reserves 0 for success or not set.
-
-    if (overwrite || !File::Exists(destination_file)) {
-      HRESULT hr = VerifyFileSignature(source_file);
-      if (FAILED(hr)) {
-        OPT_LOG(LE, (_T("[precopy signature validation failed][from=%s][0x%x]"),
-                     source_file, hr));
-        ++metric_setup_files_verification_failed_pre;
-        return hr;
-      }
-
-      hr = File::Copy(source_file, destination_file, true);
-      if (FAILED(hr)) {
-        OPT_LOG(LE, (_T("[copy failed][from=%s][to=%s][0x%08x]"),
-                     source_file, destination_file, hr));
-        return hr;
-      }
-    }
-
-    HRESULT hr = File::AreFilesIdentical(source_file, destination_file) ?
-                    VerifyFileSignature(destination_file) :
-                    GOOPDATE_E_POST_COPY_VERIFICATION_FAILED;
-
-    if (FAILED(hr)) {
-      OPT_LOG(LE, (_T("[postcopy verification failed][from=%s][to=%s][0x%x]"),
-                   source_file, destination_file, hr));
-      ++metric_setup_files_verification_failed_post;
-      VERIFY1(SUCCEEDED(File::Remove(destination_file)));
-      return hr;
-    }
-  }
-
-  extra_code1_ = 0;
-  return S_OK;
-}
-
-// The only secure location we copy to is Program Files, which only happens for
-// machine installs.
-HRESULT SetupFiles::VerifyFileSignature(const CString& filepath) {
-  if (!is_machine_) {
-    return S_OK;
-  }
-
-  HighresTimer verification_timer;
-
-  // Verify the Authenticode signature but use use only the local cache for
-  // revocation checks.
-  HRESULT hr = VerifySignature(filepath, false);
-#if TEST_CERTIFICATE
-  // The chain of trust will not validate on builds signed with the test
-  // certificate.
-  if (CERT_E_UNTRUSTEDROOT == hr) {
-    hr = S_OK;
-  }
-#endif
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Verify that there is a Google certificate and that it has not expired.
-  if (!VerifySigneeIsGoogle(filepath)) {
-    return GOOPDATE_E_VERIFY_SIGNEE_IS_GOOGLE_FAILED;
-  }
-
-  CORE_LOG(L3, (_T("[SetupFiles::VerifyFileSignature succeeded][%d ms]"),
-                verification_timer.GetElapsedMs()));
-  return S_OK;
-}
-
-bool SetupFiles::IsOlderShellVersionCompatible(ULONGLONG version) {
-  for (int i = 0; i < arraysize(kCompatibleOlderShellVersions); ++i) {
-    if (version == kCompatibleOlderShellVersions[i]) {
-      return true;
-    }
-  }
-  return false;
-}
-
-}  // namespace omaha
diff --git a/setup/setup_files.h b/setup/setup_files.h
deleted file mode 100644
index f0ae734..0000000
--- a/setup/setup_files.h
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_SETUP_SETUP_FILES_H__
-#define OMAHA_SETUP_SETUP_FILES_H__
-
-#include <windows.h>
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-struct Files {
-  const TCHAR* file_name;
-};
-
-class SetupFiles {
- public:
-  explicit SetupFiles(bool is_machine);
-  ~SetupFiles();
-
-  HRESULT Init();
-
-  // Returns whether the same version of Google Update should be over-installed.
-  bool ShouldOverinstallSameVersion();
-
-  // Installs Google Update files but does not register or install any other
-  // applications. Returns whether Google Update was installed.
-  HRESULT Install();
-
-  // Rolls back the changes made during Install(). Call when Setup fails.
-  // Returns S_OK if there is nothing to do.
-  HRESULT RollBack();
-
-  // Uninstalls Google Update files installed by Install().
-  void Uninstall();
-
-  int extra_code1() const { return extra_code1_; }
-
- private:
-  // Copies the shell to the version-independent location if needed.
-  HRESULT CopyShell();
-
-  // Determines whether to copy the shell to the version-independent location.
-  HRESULT ShouldCopyShell(const CString& shell_dir,
-                          bool* should_copy,
-                          bool* already_exists) const;
-
-  // Saves the previous version of the shell in case we need to roll it back.
-  HRESULT SaveShellForRollback(const CString& shell_install_path);
-
-  // Creates the lists of files that belong to Google Update.
-  HRESULT BuildFileLists();
-
-  // Copies file_names from the current directory to the destination directory.
-  HRESULT CopyInstallFiles(const std::vector<CString>& file_names,
-                           const CString& destination_dir,
-                           bool overwrite);
-
-  // Copies each file from the source path to its corresponding destination
-  // path. Verifies the signature of the file on each side of the copy.
-  // If overwrite is true, files are moved to .old and scheduled for delete
-  // after reboot, which only works for elevated admins.
-  HRESULT CopyAndValidateFiles(
-      const std::vector<CString>& source_file_paths,
-      const std::vector<CString>& destination_file_paths,
-      bool overwrite);
-
-  // Verifies the file is signed with the Google Certificate.
-  // Returns true if filepath is properly signed.
-  // Only verifies files if they are being installed to a secure location.
-  // If not an official build, allows the Google Test Certificate.
-  // Only checks certain extensions since not all extensions can be signed.
-  HRESULT VerifyFileSignature(const CString& filepath);
-
-  // Returns whether an older shell version is compatible.
-  static bool IsOlderShellVersionCompatible(ULONGLONG version);
-
-  const bool is_machine_;
-  CString saved_shell_path_;  // Path of the previous shell saved for roll back.
-  std::vector<CString> core_program_files_;
-  std::vector<CString> optional_files_;
-
-  int extra_code1_;
-
-  friend class SetupFilesTest;
-
-  DISALLOW_EVIL_CONSTRUCTORS(SetupFiles);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_SETUP_SETUP_FILES_H__
-
diff --git a/setup/setup_files_unittest.cc b/setup/setup_files_unittest.cc
deleted file mode 100644
index 607aafe..0000000
--- a/setup/setup_files_unittest.cc
+++ /dev/null
@@ -1,562 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <vector>
-#include "base/scoped_ptr.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/path.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/setup/setup_files.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-// TODO(omaha3): Update the numbers in the else block as we build more files.
-// Eventually use the original values in the if block.
-const int kNumberOfLanguageDlls = 55;
-const int kNumberOfRequiredFiles = 6;
-#if 0
-const int kNumberOfOptionalFiles = 4;
-#else
-const int kNumberOfOptionalFiles = 3;
-#endif
-const int kNumberOfInstalledRequiredFiles =
-    kNumberOfLanguageDlls + kNumberOfRequiredFiles;
-// FindFiles returns "." and ".." in addition to the actual files.
-const int kExtraFilesReturnedByFindFiles = 2;
-const int kExpectedFilesReturnedByFindFiles =
-    kNumberOfInstalledRequiredFiles + kNumberOfOptionalFiles +
-    kExtraFilesReturnedByFindFiles;
-
-const TCHAR kFutureVersionString[] = _T("9.8.7.6");
-const ULONGLONG kFutureVersion = 0x0009000800070006;
-
-}  // namespace
-
-void CopyGoopdateFiles(const CString& omaha_path, const CString& version) {
-  EXPECT_SUCCEEDED(CreateDir(omaha_path, NULL));
-  const CString version_path = ConcatenatePath(omaha_path, version);
-
-  EXPECT_SUCCEEDED(File::Copy(
-      ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                      kOmahaShellFileName),
-      ConcatenatePath(omaha_path, kOmahaShellFileName),
-      false));
-
-  EXPECT_SUCCEEDED(CreateDir(version_path, NULL));
-
-  const TCHAR* files[] = {kCrashHandlerFileName,
-                          kOmahaShellFileName,
-                          kHelperInstallerName,
-                          kOmahaDllName,
-                          kOmahaBrokerFileName,
-                          kOmahaOnDemandFileName,
-// TODO(omaha3): Enable once this is being built.
-#if 0
-                          _T("GoopdateBho.dll"),
-#endif
-                          UPDATE_PLUGIN_FILENAME,
-                          kPSFileNameMachine,
-                          kPSFileNameUser,
-                          };
-  for (size_t i = 0; i < arraysize(files); ++i) {
-    EXPECT_SUCCEEDED(File::Copy(
-        ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                        files[i]),
-        ConcatenatePath(version_path, files[i]),
-        false)) << _T("Failed copying ") << files[i];
-  }
-
-  EXPECT_SUCCEEDED(File::CopyWildcards(app_util::GetCurrentModuleDirectory(),
-                                       version_path,
-                                       _T("goopdateres_\?\?.dll"),
-                                       false));
-  EXPECT_SUCCEEDED(File::CopyWildcards(app_util::GetCurrentModuleDirectory(),
-                                       version_path,
-                                       _T("goopdateres_\?\?\?.dll"),
-                                       false));
-  EXPECT_SUCCEEDED(File::CopyWildcards(app_util::GetCurrentModuleDirectory(),
-                                       version_path,
-                                       _T("goopdateres_\?\?-\?\?.dll"),
-                                       false));
-  EXPECT_SUCCEEDED(File::CopyWildcards(app_util::GetCurrentModuleDirectory(),
-                                       version_path,
-                                       _T("goopdateres_\?\?-\?\?\?.dll"),
-                                       false));
-}
-
-class SetupFilesTest : public testing::Test {
- protected:
-  explicit SetupFilesTest(bool is_machine)
-      : is_machine_(is_machine),
-        omaha_path_(is_machine ?
-            GetGoogleUpdateMachinePath() : GetGoogleUpdateUserPath()),
-        hive_override_key_name_(kRegistryHiveOverrideRoot) {
-  }
-
-  static void SetUpTestCase() {
-    exe_parent_dir_ = ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                                      _T("unittest_support\\"));
-
-    this_version_ = GetVersionString();
-
-    expected_is_overinstall_ = !OFFICIAL_BUILD;
-#ifdef DEBUG
-    if (RegKey::HasValue(MACHINE_REG_UPDATE_DEV, kRegValueNameOverInstall)) {
-      DWORD value = 0;
-      EXPECT_SUCCEEDED(RegKey::GetValue(MACHINE_REG_UPDATE_DEV,
-                                        kRegValueNameOverInstall,
-                                        &value));
-      expected_is_overinstall_ = value != 0;
-    }
-#endif
-  }
-
-  virtual void SetUp() {
-    RegKey::DeleteKey(hive_override_key_name_, true);
-    // Do not override HKLM because it contains the CSIDL_* definitions.
-    OverrideSpecifiedRegistryHives(hive_override_key_name_, false, true);
-
-    setup_files_.reset(new SetupFiles(is_machine_));
-
-    ASSERT_HRESULT_SUCCEEDED(setup_files_->Init());
-  }
-
-  virtual void TearDown() {
-    RestoreRegistryHives();
-    ASSERT_SUCCEEDED(RegKey::DeleteKey(hive_override_key_name_, true));
-  }
-
-  static bool IsOlderShellVersionCompatible(ULONGLONG version) {
-    return SetupFiles::IsOlderShellVersionCompatible(version);
-  }
-
-  // Assumes the executable version has been changed to the future version.
-  void InstallHelper(const CString& omaha_path) {
-    const CString version_path = ConcatenatePath(omaha_path,
-                                                 kFutureVersionString);
-
-    ASSERT_EQ(kNumberOfInstalledRequiredFiles,
-              setup_files_->core_program_files_.size());
-    ASSERT_EQ(kNumberOfOptionalFiles, setup_files_->optional_files_.size());
-
-    DeleteDirectory(version_path);
-    ASSERT_FALSE(File::IsDirectory(version_path));
-
-    EXPECT_SUCCEEDED(setup_files_->Install());
-
-    EXPECT_TRUE(File::Exists(ConcatenatePath(omaha_path,
-                             kOmahaShellFileName)));
-
-    EXPECT_TRUE(File::IsDirectory(version_path));
-
-    std::vector<CString> files;
-    EXPECT_SUCCEEDED(FindFiles(version_path, _T("*.*"), &files));
-    ASSERT_EQ(kExpectedFilesReturnedByFindFiles, files.size());
-    int file_index = kExtraFilesReturnedByFindFiles;
-    EXPECT_STREQ(kCrashHandlerFileName, files[file_index++]);
-    EXPECT_STREQ(kOmahaShellFileName, files[file_index++]);
-    EXPECT_STREQ(kOmahaBrokerFileName, files[file_index++]);
-    EXPECT_STREQ(kHelperInstallerName, files[file_index++]);
-    EXPECT_STREQ(kOmahaOnDemandFileName, files[file_index++]);
-    EXPECT_STREQ(kOmahaDllName, files[file_index++]);
-// TODO(omaha3): Enable as this is built.
-#if 0
-    EXPECT_STREQ(_T("GoopdateBho.dll"), files[file_index++]);
-#endif
-    EXPECT_STREQ(_T("goopdateres_am.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_ar.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_bg.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_bn.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_ca.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_cs.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_da.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_de.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_el.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_en-GB.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_en.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_es-419.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_es.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_et.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_fa.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_fi.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_fil.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_fr.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_gu.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_hi.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_hr.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_hu.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_id.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_is.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_it.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_iw.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_ja.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_kn.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_ko.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_lt.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_lv.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_ml.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_mr.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_ms.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_nl.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_no.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_pl.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_pt-BR.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_pt-PT.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_ro.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_ru.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_sk.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_sl.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_sr.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_sv.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_sw.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_ta.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_te.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_th.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_tr.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_uk.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_ur.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_vi.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_zh-CN.dll"), files[file_index++]);
-    EXPECT_STREQ(_T("goopdateres_zh-TW.dll"), files[file_index++]);
-    EXPECT_STREQ(UPDATE_PLUGIN_FILENAME, files[file_index++]);
-    EXPECT_STREQ(kPSFileNameMachine, files[file_index++]);
-    EXPECT_STREQ(kPSFileNameUser, files[file_index++]);
-
-    EXPECT_SUCCEEDED(DeleteDirectory(version_path));
-  }
-
-  HRESULT ShouldCopyShell(const CString& shell_install_path,
-                          bool* should_copy,
-                          bool* already_exists) const {
-    return setup_files_->ShouldCopyShell(shell_install_path,
-                                         should_copy,
-                                         already_exists);
-  }
-
-  const bool is_machine_;
-  const CString omaha_path_;
-  const CString hive_override_key_name_;
-  scoped_ptr<SetupFiles> setup_files_;
-
-  static CString exe_parent_dir_;
-  static CString this_version_;
-  static bool expected_is_overinstall_;
-};
-
-CString SetupFilesTest::exe_parent_dir_;
-CString SetupFilesTest::this_version_;
-bool SetupFilesTest::expected_is_overinstall_;
-
-class SetupFilesMachineTest : public SetupFilesTest {
- protected:
-  SetupFilesMachineTest()
-    : SetupFilesTest(true) {
-  }
-};
-
-class SetupFilesUserTest : public SetupFilesTest {
- protected:
-  SetupFilesUserTest()
-    : SetupFilesTest(false) {
-  }
-};
-
-TEST_F(SetupFilesUserTest,
-       ShouldOverinstallSameVersion_SameVersionFilesMissing) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    this_version_));
-  ASSERT_SUCCEEDED(
-      DeleteDirectory(ConcatenatePath(omaha_path_, this_version_)));
-  CString file_path = ConcatenatePath(
-                          ConcatenatePath(omaha_path_, this_version_),
-                          kOmahaDllName);
-  ASSERT_FALSE(File::Exists(file_path));
-
-  EXPECT_TRUE(setup_files_->ShouldOverinstallSameVersion());
-}
-
-TEST_F(SetupFilesUserTest,
-       ShouldOverinstallSameVersion_SameVersionFilesPresent) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    this_version_));
-
-  CopyGoopdateFiles(omaha_path_, this_version_);
-
-  EXPECT_FALSE(setup_files_->ShouldOverinstallSameVersion());
-}
-
-TEST_F(SetupFilesUserTest,
-       ShouldOverinstallSameVersion_SameVersionRequiredFileMissing) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    this_version_));
-
-  CopyGoopdateFiles(omaha_path_, this_version_);
-  CString path = ConcatenatePath(ConcatenatePath(omaha_path_, this_version_),
-                                 kOmahaDllName);
-  ASSERT_SUCCEEDED(File::Remove(path));
-  ASSERT_FALSE(File::Exists(path));
-
-  EXPECT_TRUE(setup_files_->ShouldOverinstallSameVersion());
-}
-
-TEST_F(SetupFilesUserTest,
-       ShouldOverinstallSameVersion_SameVersionOptionalFileMissing) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    this_version_));
-
-  CopyGoopdateFiles(omaha_path_, this_version_);
-  CString path = ConcatenatePath(ConcatenatePath(omaha_path_, this_version_),
-                                 UPDATE_PLUGIN_FILENAME);
-  ASSERT_SUCCEEDED(File::Remove(path));
-  ASSERT_FALSE(File::Exists(path));
-
-  EXPECT_TRUE(setup_files_->ShouldOverinstallSameVersion());
-}
-
-TEST_F(SetupFilesUserTest,
-       ShouldOverinstallSameVersion_SameVersionShellMissing) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    this_version_));
-
-  CopyGoopdateFiles(omaha_path_, this_version_);
-  CString shell_path = ConcatenatePath(omaha_path_, kOmahaShellFileName);
-  ASSERT_TRUE(SUCCEEDED(File::DeleteAfterReboot(shell_path)) ||
-              !vista_util::IsUserAdmin());
-  ASSERT_FALSE(File::Exists(shell_path));
-
-  EXPECT_TRUE(setup_files_->ShouldOverinstallSameVersion());
-}
-
-TEST_F(SetupFilesUserTest,
-       ShouldOverinstallSameVersion_NewerVersionShellMissing) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    kFutureVersionString));
-
-  CopyGoopdateFiles(omaha_path_, kFutureVersionString);
-  CString shell_path = ConcatenatePath(omaha_path_, kOmahaShellFileName);
-  ASSERT_TRUE(SUCCEEDED(File::DeleteAfterReboot(shell_path)) ||
-              !vista_util::IsUserAdmin());
-  ASSERT_FALSE(File::Exists(shell_path));
-
-  // Does not check the version.
-  EXPECT_TRUE(setup_files_->ShouldOverinstallSameVersion());
-
-  EXPECT_SUCCEEDED(
-      DeleteDirectory(ConcatenatePath(omaha_path_, kFutureVersionString)));
-}
-
-// "NotOverInstall" refers to there not being files in the directory.
-// should_over_install/overwrite will be true for unofficial builds.
-TEST_F(SetupFilesMachineTest, Install_NotOverInstall) {
-  if (vista_util::IsUserAdmin()) {
-    // Fake the version
-    const ULONGLONG module_version = GetVersion();
-    InitializeVersion(kFutureVersion);
-
-    InstallHelper(omaha_path_);
-
-    InitializeVersion(module_version);
-  } else {
-    // This method expects to be called elevated for machine installs.
-    ExpectAsserts expect_asserts;
-    EXPECT_EQ(GOOPDATE_E_ACCESSDENIED_COPYING_CORE_FILES,
-              setup_files_->Install());
-  }
-}
-
-TEST_F(SetupFilesUserTest, Install_NotOverInstall) {
-  // Fake the version
-  const ULONGLONG module_version = GetVersion();
-  InitializeVersion(kFutureVersion);
-
-  InstallHelper(omaha_path_);
-
-  InitializeVersion(module_version);
-}
-
-// TODO(omaha3): Need a 1.3.x_newer directory.
-TEST_F(SetupFilesUserTest, DISABLED_ShouldCopyShell_ExistingIsNewer) {
-  CString target_path = ConcatenatePath(
-      ConcatenatePath(exe_parent_dir_, _T("omaha_1.3.x_newer")),
-      kOmahaShellFileName);
-  ASSERT_TRUE(File::Exists(target_path));
-  bool should_copy = false;
-  bool already_exists = false;
-  EXPECT_SUCCEEDED(ShouldCopyShell(target_path, &should_copy, &already_exists));
-  EXPECT_FALSE(should_copy);
-  EXPECT_TRUE(already_exists);
-}
-
-TEST_F(SetupFilesUserTest, ShouldCopyShell_ExistingIsSame) {
-  CString target_path = ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                                        kOmahaShellFileName);
-  ASSERT_TRUE(File::Exists(target_path));
-  bool should_copy = false;
-  bool already_exists = false;
-
-  EXPECT_SUCCEEDED(ShouldCopyShell(target_path, &should_copy, &already_exists));
-  EXPECT_EQ(expected_is_overinstall_, should_copy);
-  EXPECT_TRUE(already_exists);
-
-  if (!ShouldRunLargeTest()) {
-    return;
-  }
-
-  // Override OverInstall to test official behavior on non-official builds.
-
-  DWORD existing_overinstall(0);
-  bool had_existing_overinstall = SUCCEEDED(RegKey::GetValue(
-                                                MACHINE_REG_UPDATE_DEV,
-                                                kRegValueNameOverInstall,
-                                                &existing_overinstall));
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueNameOverInstall,
-                                    static_cast<DWORD>(0)));
-
-  EXPECT_SUCCEEDED(
-      ShouldCopyShell(target_path, &should_copy, &already_exists));
-#ifdef DEBUG
-  EXPECT_FALSE(should_copy);
-#else
-  EXPECT_EQ(expected_is_overinstall_, should_copy);
-#endif
-  EXPECT_TRUE(already_exists);
-
-  // Restore "overinstall"
-  if (had_existing_overinstall) {
-    EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                      kRegValueNameOverInstall,
-                                      existing_overinstall));
-  } else {
-    EXPECT_SUCCEEDED(RegKey::DeleteValue(MACHINE_REG_UPDATE_DEV,
-                                         kRegValueNameOverInstall));
-  }
-}
-
-TEST_F(SetupFilesUserTest, IsOlderShellVersionCompatible_Compatible) {
-  EXPECT_TRUE(IsOlderShellVersionCompatible(MAKEDLLVERULL(1, 2, 131, 7)));
-  EXPECT_TRUE(IsOlderShellVersionCompatible(MAKEDLLVERULL(1, 2, 183, 9)));
-}
-
-TEST_F(SetupFilesUserTest, IsOlderShellVersionCompatible_Incompatible) {
-  // Vary the four elements of the version.
-  EXPECT_FALSE(IsOlderShellVersionCompatible(MAKEDLLVERULL(1, 2, 183, 7)));
-  EXPECT_FALSE(IsOlderShellVersionCompatible(MAKEDLLVERULL(1, 2, 185, 9)));
-  EXPECT_FALSE(IsOlderShellVersionCompatible(MAKEDLLVERULL(1, 3, 183, 9)));
-  EXPECT_FALSE(IsOlderShellVersionCompatible(MAKEDLLVERULL(2, 2, 183, 9)));
-
-  // Corner cases
-  EXPECT_FALSE(IsOlderShellVersionCompatible(_UI64_MAX));
-  EXPECT_FALSE(IsOlderShellVersionCompatible(0));
-  EXPECT_FALSE(IsOlderShellVersionCompatible(1));
-}
-
-TEST_F(SetupFilesUserTest,
-       ShouldCopyShell_ExistingIsOlderButCompatible_1_2_131_7) {
-  CString target_path = ConcatenatePath(
-      ConcatenatePath(exe_parent_dir_, _T("omaha_1.2.131.7_shell")),
-      kOmahaShellFileName);
-  ASSERT_TRUE(File::Exists(target_path));
-  bool should_copy = false;
-  bool already_exists = false;
-  EXPECT_SUCCEEDED(ShouldCopyShell(target_path, &should_copy, &already_exists));
-  EXPECT_FALSE(should_copy);
-  EXPECT_TRUE(already_exists);
-}
-
-TEST_F(SetupFilesUserTest,
-       ShouldCopyShell_ExistingIsOlderButCompatible_1_2_183_9) {
-  CString target_path = ConcatenatePath(
-      ConcatenatePath(exe_parent_dir_, _T("omaha_1.2.183.9_shell")),
-      kOmahaShellFileName);
-  ASSERT_TRUE(File::Exists(target_path));
-  bool should_copy = false;
-  bool already_exists = false;
-  EXPECT_SUCCEEDED(ShouldCopyShell(target_path, &should_copy, &already_exists));
-  EXPECT_FALSE(should_copy);
-  EXPECT_TRUE(already_exists);
-}
-
-TEST_F(SetupFilesUserTest, ShouldCopyShell_ExistingIsOlderMinor) {
-  CString target_path = ConcatenatePath(
-      ConcatenatePath(exe_parent_dir_, _T("omaha_1.2.x")),
-      kOmahaShellFileName);
-  ASSERT_TRUE(File::Exists(target_path));
-  bool should_copy = false;
-  bool already_exists = false;
-  EXPECT_SUCCEEDED(ShouldCopyShell(target_path, &should_copy, &already_exists));
-  EXPECT_TRUE(should_copy);
-  EXPECT_TRUE(already_exists);
-}
-
-// The 1.3.x directory will not always have an older GoogleUpdate.exe than the
-// saved version that we use for official builds.
-#if !OFFICIAL_BUILD
-TEST_F(SetupFilesUserTest, ShouldCopyShell_ExistingIsOlderSameMinor) {
-  CString target_path = ConcatenatePath(
-      ConcatenatePath(exe_parent_dir_, _T("omaha_1.3.x")),
-      kOmahaShellFileName);
-  ASSERT_TRUE(File::Exists(target_path));
-  bool should_copy = false;
-  bool already_exists = false;
-  EXPECT_SUCCEEDED(ShouldCopyShell(target_path, &should_copy, &already_exists));
-  EXPECT_TRUE(should_copy);
-  EXPECT_TRUE(already_exists);
-}
-#endif
-
-// Assumes LongRunningSilent.exe does not have a version resource.
-TEST_F(SetupFilesUserTest, ShouldCopyShell_ExistingHasNoVersion) {
-  CString target_path = ConcatenatePath(
-      ConcatenatePath(exe_parent_dir_, _T("does_not_shutdown")),
-      kOmahaShellFileName);
-  ASSERT_TRUE(File::Exists(target_path));
-  bool should_copy = false;
-  bool already_exists = false;
-  ExpectAsserts expect_asserts;
-  EXPECT_SUCCEEDED(ShouldCopyShell(target_path, &should_copy, &already_exists));
-  EXPECT_TRUE(should_copy);
-  EXPECT_TRUE(already_exists);
-}
-
-TEST_F(SetupFilesUserTest, ShouldCopyShell_NoExistingFile) {
-  CString target_path = ConcatenatePath(
-      ConcatenatePath(exe_parent_dir_, _T("no_such_dir")),
-      kOmahaShellFileName);
-  ASSERT_FALSE(File::Exists(target_path));
-  bool should_copy = false;
-  bool already_exists = false;
-  EXPECT_SUCCEEDED(ShouldCopyShell(target_path, &should_copy, &already_exists));
-  EXPECT_TRUE(should_copy);
-  EXPECT_FALSE(already_exists);
-}
-
-}  // namespace omaha
diff --git a/setup/setup_google_update.cc b/setup/setup_google_update.cc
deleted file mode 100644
index aaee71b..0000000
--- a/setup/setup_google_update.cc
+++ /dev/null
@@ -1,866 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/setup/setup_google_update.h"
-
-#include <msi.h>
-#include <atlpath.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/atlregmapex.h"
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/const_utils.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/highres_timer-win32.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/path.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/service_utils.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/user_info.h"
-#include "omaha/common/command_line_builder.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/common/scheduled_task_utils.h"
-#include "omaha/setup/setup_metrics.h"
-#include "omaha/setup/setup_service.h"
-
-namespace omaha {
-
-namespace {
-
-#ifdef _DEBUG
-HRESULT VerifyCOMLocalServerRegistration(bool is_machine) {
-// TODO(omaha3): Implement this for Omaha 3. Specifically, this code assumes
-// Setup is running from the installed location, which is no longer true.
-#if 0
-  // Validate the following:
-  // * LocalServer32 under CLSID_OnDemandMachineAppsClass or
-  //   CLSID_OnDemandUserAppsClass should be ...Google\Update\GoogleUpdate.exe.
-  // * InProcServer32 under CLSID of IID_IGoogleUpdate should be
-  //   ...Google\Update\{version}\goopdate.dll.
-  // * ProxyStubClsid32 under IGoogleUpdate interface should be the CLSID of the
-  //   proxy, which is IID_IGoogleUpdate.
-
-  CString base_clsid_key(goopdate_utils::GetHKRoot());
-  base_clsid_key += _T("\\Software\\Classes\\CLSID\\");
-  CString ondemand_clsid_key(base_clsid_key);
-  ondemand_clsid_key += GuidToString(is_machine ?
-                                     __uuidof(OnDemandMachineAppsClass) :
-                                     __uuidof(OnDemandUserAppsClass));
-  CString local_server_key(ondemand_clsid_key + _T("\\LocalServer32"));
-  CString installed_server;
-  ASSERT1(SUCCEEDED(RegKey::GetValue(local_server_key,
-                                     NULL,
-                                     &installed_server)));
-  ASSERT1(!installed_server.IsEmpty());
-
-  CString expected_server(app_util::GetModulePath(NULL));
-  EnclosePath(&expected_server);
-  ASSERT1(!expected_server.IsEmpty());
-  SETUP_LOG(L3, (_T("[installed_server=%s][expected_server=%s]"),
-                 installed_server, expected_server));
-  ASSERT1(installed_server == expected_server);
-
-  const GUID proxy_clsid = PROXY_CLSID_IS;
-  CString ondemand_proxy_clsid_key(base_clsid_key);
-  ondemand_proxy_clsid_key += GuidToString(proxy_clsid);
-  CString inproc_server_key(ondemand_proxy_clsid_key + _T("\\InProcServer32"));
-  ASSERT1(SUCCEEDED(RegKey::GetValue(inproc_server_key,
-                                     NULL,
-                                     &installed_server)));
-  ASSERT1(!installed_server.IsEmpty());
-  expected_server = app_util::GetCurrentModulePath();
-  ASSERT1(!expected_server.IsEmpty());
-  SETUP_LOG(L3, (_T("[installed proxy=%s][expected proxy=%s]"),
-                 installed_server, expected_server));
-  ASSERT1(installed_server == expected_server);
-
-  CString igoogleupdate_interface_key(goopdate_utils::GetHKRoot());
-  igoogleupdate_interface_key += _T("\\Software\\Classes\\Interface\\");
-  igoogleupdate_interface_key += GuidToString(__uuidof(IGoogleUpdate));
-  igoogleupdate_interface_key += _T("\\ProxyStubClsid32");
-  CString proxy_interface_value;
-  ASSERT1(SUCCEEDED(RegKey::GetValue(igoogleupdate_interface_key,
-                                     NULL,
-                                     &proxy_interface_value)));
-  ASSERT1(!proxy_interface_value.IsEmpty());
-  ASSERT1(proxy_interface_value == GuidToString(proxy_clsid));
-#else
-  UNREFERENCED_PARAMETER(is_machine);
-#endif
-  return S_OK;
-}
-#endif
-
-HRESULT RegisterOrUnregisterService(bool reg, CString service_path) {
-  EnclosePath(&service_path);
-
-  CommandLineBuilder builder(reg ? COMMANDLINE_MODE_SERVICE_REGISTER :
-                                   COMMANDLINE_MODE_SERVICE_UNREGISTER);
-  CString cmd_line = builder.GetCommandLineArgs();
-  return RegisterOrUnregisterExe(service_path, cmd_line);
-}
-
-}  // namespace
-
-SetupGoogleUpdate::SetupGoogleUpdate(bool is_machine)
-    : is_machine_(is_machine),
-      extra_code1_(S_OK)
-#ifdef _DEBUG
-      , have_called_uninstall_previous_versions_(false)
-#endif
-{  // NOLINT
-  this_version_ = GetVersionString();
-}
-
-SetupGoogleUpdate::~SetupGoogleUpdate() {
-  SETUP_LOG(L2, (_T("[SetupGoogleUpdate::~SetupGoogleUpdate]")));
-}
-
-// TODO(omaha): Add a VerifyInstall() method that can be called by /handoff
-// instances to verify the installation and call FinishInstall() if it fails.
-
-// Assumes the caller is ensuring this is the only running instance of setup.
-// The original process holds the lock while it waits for this one to complete.
-HRESULT SetupGoogleUpdate::FinishInstall() {
-  SETUP_LOG(L2, (_T("[SetupGoogleUpdate::FinishInstall]")));
-
-  HRESULT hr = InstallRegistryValues();
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[InstallRegistryValues failed][0x%08x]"), hr));
-    if (E_ACCESSDENIED == hr) {
-      return GOOPDATE_E_ACCESSDENIED_SETUP_REG_ACCESS;
-    }
-    return hr;
-  }
-
-  hr = InstallLaunchMechanisms();
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[InstallLaunchMechanisms failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  hr = InstallMsiHelper();
-  if (FAILED(hr)) {
-    SETUP_LOG(L1, (_T("[InstallMsiHelper failed][0x%08x]"), hr));
-    // TODO(omaha): Retry on ERROR_INSTALL_ALREADY_RUNNING like InstallerWrapper
-    // if we move helper MSI installation after app installation.
-    ASSERT1(HRESULT_FROM_WIN32(ERROR_INSTALL_SERVICE_FAILURE) == hr ||
-            HRESULT_FROM_WIN32(ERROR_INSTALL_ALREADY_RUNNING) == hr);
-  }
-
-  hr = RegisterOrUnregisterCOMLocalServer(true);
-  if (FAILED(hr)) {
-    OPT_LOG(LW, (_T("[RegisterOrUnregisterCOMLocalServer failed][0x%x]"), hr));
-
-    // Fall through. Omaha will attempt to install using the in-proc mode.
-  }
-
-  ASSERT1(SUCCEEDED(VerifyCOMLocalServerRegistration(is_machine_)));
-
-  // We would prefer to uninstall previous versions last, but the web plugin
-  // requires that the old plugin is uninstalled before installing the new one.
-  VERIFY1(SUCCEEDED(UninstallPreviousVersions()));
-
-  // Writing this value indicates that this Omaha version was successfully
-  // installed. This is an artifact of Omaha 2 when pv was set earlier in Setup.
-  CString reg_update = ConfigManager::Instance()->registry_update(is_machine_);
-  hr = RegKey::SetValue(reg_update, kRegValueInstalledVersion, this_version_);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Delete the "LastChecked" registry value after a successful install or
-  // update so that Omaha checks for updates soon after the install. This
-  // helps detecting a heart beat from the new version sooner as well as
-  // avoiding deferring application updates for too long in the case where both
-  // Omaha and application updates are available.
-  RegKey::DeleteValue(reg_update, kRegValueLastChecked);
-
-  return S_OK;
-}
-
-// Version values are written at the end of setup, not here.
-HRESULT SetupGoogleUpdate::InstallRegistryValues() {
-  OPT_LOG(L3, (_T("[SetupGoogleUpdate::InstallRegistryValues]")));
-
-  const ConfigManager* cm = ConfigManager::Instance();
-  const TCHAR* keys[] = { cm->registry_google(is_machine_),
-                          cm->registry_update(is_machine_),
-                          cm->registry_client_state(is_machine_),
-                          cm->registry_clients(is_machine_),
-                          cm->registry_clients_goopdate(is_machine_),
-                          cm->registry_client_state_goopdate(is_machine_),
-                        };
-
-  HRESULT hr = RegKey::CreateKeys(keys, arraysize(keys));
-  if (FAILED(hr)) {
-    OPT_LOG(LE, (_T("[Failed to create reg keys][0x%08x]"), hr));
-    return hr;
-  }
-
-  if (is_machine_) {
-    hr = CreateClientStateMedium();
-    if (FAILED(hr)) {
-      SETUP_LOG(L3, (_T("[CreateClientStateMedium failed][0x%08x]"), hr));
-      return hr;
-    }
-  }
-
-  CString shell_path = goopdate_utils::BuildGoogleUpdateExePath(is_machine_);
-  if (shell_path.IsEmpty() || !File::Exists(shell_path)) {
-    SETUP_LOG(LE, (_T("[Failed to get valid shell path]")));
-    return E_FAIL;
-  }
-  hr = RegKey::SetValue(cm->registry_update(is_machine_),
-                        kRegValueInstalledPath,
-                        shell_path);
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[Failed to write shell path][0x%08x]"), hr));
-    return hr;
-  }
-
-  ASSERT1(!this_version_.IsEmpty());
-
-  const CString omaha_clients_key_path =
-      cm->registry_clients_goopdate(is_machine_);
-
-  // Set the version so the constant shell will know which version to use.
-  // TODO(omaha3): This should be the atomic switch of the version, but it must
-  // be called before registering the COM servers because GoogleUpdate.exe needs
-  // the pv to find goopdate.dll. We may need to support rolling this back.
-  hr = RegKey::SetValue(omaha_clients_key_path,
-                        kRegValueProductVersion,
-                        this_version_);
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[Failed to set version in registry][0x%08x]"), hr));
-    if (E_ACCESSDENIED == hr) {
-      return GOOPDATE_E_ACCESSDENIED_SETUP_REG_ACCESS;
-    }
-    return hr;
-  }
-
-  // Write Omaha's localized name to the registry. During installation, this
-  // will use the installation language. For self-updates, it will use the
-  // user's/Local System's language.
-  CString omaha_name;
-  if (!omaha_name.LoadString(IDS_PRODUCT_DISPLAY_NAME)) {
-    ASSERT1(false);
-    omaha_name = kAppName;
-  }
-  VERIFY1(SUCCEEDED(RegKey::SetValue(omaha_clients_key_path,
-                                     kRegValueAppName,
-                                     omaha_name)));
-
-  // Set pv in ClientState for consistency. Optional, so ignore errors.
-  const CString omaha_client_state_key_path =
-      cm->registry_client_state_goopdate(is_machine_);
-  VERIFY1(SUCCEEDED(RegKey::SetValue(omaha_client_state_key_path,
-                                     kRegValueProductVersion,
-                                     this_version_)));
-
-  if (is_machine_) {
-    VERIFY1(SUCCEEDED(goopdate_utils::EnableSEHOP(true)));
-  }
-
-  return S_OK;
-}
-
-// Creates the ClientStateMedium key and adds ACLs that allows authenticated
-// users to read and write values in its subkeys.
-// Since this key is not as secure as other keys, the supported values must be
-// limited and the use of them must be carefully designed.
-HRESULT SetupGoogleUpdate::CreateClientStateMedium() {
-  ASSERT1(is_machine_);
-
-  // Authenticated non-admins may read, write, and create values.
-  const ACCESS_MASK kNonAdminAccessMask = KEY_READ | KEY_SET_VALUE;
-  // The override privileges apply to all subkeys and values but not to the
-  // ClientStateMedium key itself.
-  const uint8 kAceFlags =
-      CONTAINER_INHERIT_ACE | INHERIT_ONLY_ACE | OBJECT_INHERIT_ACE;
-
-  const CString key_full_name =
-      ConfigManager::Instance()->machine_registry_client_state_medium();
-  HRESULT hr = RegKey::CreateKey(key_full_name);
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[Create ClientStateMedium failed][0x%08x]"), hr));
-    return hr;
-  }
-
-  // GetNamedSecurityInfo requires the key name start with "MACHINE".
-  // TODO(omaha): Replace AddAllowedAce or add an override that takes a handle
-  // instead of a name to eliminate this issue.
-  CString compatible_key_name = key_full_name;
-  VERIFY1(1 == compatible_key_name.Replace(MACHINE_KEY_NAME, _T("MACHINE")));
-
-  hr = AddAllowedAce(compatible_key_name,
-                     SE_REGISTRY_KEY,
-                     Sids::Interactive(),
-                     kNonAdminAccessMask,
-                     kAceFlags);
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[AddAllowedAce failed][%s][0x%08x]"),
-                   key_full_name, hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT SetupGoogleUpdate::InstallLaunchMechanisms() {
-  SETUP_LOG(L3, (_T("[SetupGoogleUpdate::InstallLaunchMechanisms]")));
-  if (is_machine_) {
-    HRESULT hr = InstallMachineLaunchMechanisms();
-    if (FAILED(hr)) {
-      SETUP_LOG(LE, (_T("[InstallMachineLaunchMechanisms fail][0x%08x]"), hr));
-      return hr;
-    }
-  } else {
-    HRESULT hr = InstallUserLaunchMechanisms();
-    if (FAILED(hr)) {
-      SETUP_LOG(LE, (_T("[InstallUserLaunchMechanisms failed][0x%08x]"), hr));
-      return hr;
-    }
-  }
-
-  return S_OK;
-}
-
-void SetupGoogleUpdate::UninstallLaunchMechanisms() {
-  SETUP_LOG(L3, (_T("[SetupGoogleUpdate::UninstallLaunchMechanisms]")));
-  if (is_machine_) {
-    CString current_dir = app_util::GetModuleDirectory(NULL);
-    CString service_path = ConcatenatePath(current_dir, kServiceFileName);
-
-    VERIFY1(SUCCEEDED(RegisterOrUnregisterService(false, service_path)));
-  } else {
-    // We only need to do this in case of the user goopdate, as
-    // there is no machine Run at startup installation.
-    VERIFY1(SUCCEEDED(ConfigureUserRunAtStartup(false)));  // delete entry
-  }
-
-  VERIFY1(SUCCEEDED(scheduled_task_utils::UninstallGoopdateTasks(is_machine_)));
-}
-
-HRESULT SetupGoogleUpdate::InstallScheduledTask() {
-  CString exe_path = goopdate_utils::BuildGoogleUpdateExePath(is_machine_);
-
-  HighresTimer metrics_timer;
-  const ULONGLONG install_task_start_ms = metrics_timer.GetElapsedMs();
-
-  HRESULT hr = scheduled_task_utils::InstallGoopdateTasks(exe_path,
-                                                          is_machine_);
-
-  if (SUCCEEDED(hr)) {
-    const ULONGLONG install_task_end_ms = metrics_timer.GetElapsedMs();
-    ASSERT1(install_task_end_ms >= install_task_start_ms);
-    metric_setup_install_task_ms.AddSample(
-        install_task_end_ms - install_task_start_ms);
-    ++metric_setup_install_task_succeeded;
-  } else {
-    OPT_LOG(LEVEL_ERROR, (_T("[Install task failed][0x%08x]"), hr));
-    metric_setup_install_task_error = hr;
-  }
-
-  return hr;
-}
-
-// Assumes the any existing service instance has been stopped
-// TODO(omaha): Provide service_hr and task_hr failures in a ping.
-// They are no longer being provided in the URL.
-HRESULT SetupGoogleUpdate::InstallMachineLaunchMechanisms() {
-  SETUP_LOG(L3, (_T("[SetupGoogleUpdate::InstallMachineLaunchMechanisms]")));
-  ++metric_setup_install_service_task_total;
-
-  // Install the service and scheduled task. Failing to install both will
-  // fail setup.
-  OPT_LOG(L1, (_T("[Installing service]")));
-  HighresTimer metrics_timer;
-
-  HRESULT service_hr = RegisterOrUnregisterService(true,
-      goopdate_utils::BuildGoogleUpdateExePath(is_machine_));
-  ASSERT(SUCCEEDED(service_hr), (_T("[registration err][0x%x]"), service_hr));
-
-  if (SUCCEEDED(service_hr)) {
-    metric_setup_install_service_ms.AddSample(
-        metrics_timer.GetElapsedMs());
-    ++metric_setup_install_service_succeeded;
-  } else {
-    metric_setup_install_service_failed_ms.AddSample(
-        metrics_timer.GetElapsedMs());
-    OPT_LOG(LEVEL_ERROR, (_T("[Install service failed][0x%08x]"), service_hr));
-    metric_setup_install_service_error = service_hr;
-  }
-
-  HRESULT task_hr = InstallScheduledTask();
-
-  if (FAILED(service_hr) && FAILED(task_hr)) {
-    ++metric_setup_install_service_and_task_failed;
-    extra_code1_ = task_hr;
-    return service_hr;
-  }
-
-// TODO(omaha3): Setup does not know about OEM mode. Figure out a
-// different way to do this. Maybe just verify that both are installed.
-#if 0
-  if (args_->is_oem_set) {
-    // OEM installs are on clean systems in a controlled environment. We expect
-    // both mechanisms to install.
-    if (FAILED(service_hr)) {
-      return service_hr;
-    }
-    if (FAILED(task_hr)) {
-      return task_hr;
-    }
-  }
-#endif
-
-  if (SUCCEEDED(service_hr) && SUCCEEDED(task_hr)) {
-    ++metric_setup_install_service_and_task_succeeded;
-  }
-
-  return S_OK;
-}
-
-HRESULT SetupGoogleUpdate::InstallUserLaunchMechanisms() {
-  SETUP_LOG(L3, (_T("[SetupGoogleUpdate::InstallUserLaunchMechanisms]")));
-
-  HRESULT run_hr = ConfigureUserRunAtStartup(true);  // install
-  ASSERT(SUCCEEDED(run_hr), (_T("ConfigureRunAtStartup 0x%x"), run_hr));
-
-  HRESULT task_hr = InstallScheduledTask();
-  ASSERT(SUCCEEDED(task_hr), (_T("InstallScheduledTask 0x%x"), task_hr));
-
-  if (FAILED(run_hr) && FAILED(task_hr)) {
-    // We need atleast one launch mechanism.
-    extra_code1_ = task_hr;
-    return run_hr;
-  }
-
-  return S_OK;
-}
-
-// Sets a value in the Run key in the user registry to start the core.
-HRESULT SetupGoogleUpdate::ConfigureUserRunAtStartup(bool install) {
-  SETUP_LOG(L3, (_T("SetupGoogleUpdate::ConfigureUserRunAtStartup")));
-  // Always send false argument as this method is only called for user
-  // goopdate installs.
-  CString core_cmd = BuildCoreProcessCommandLine();
-  return ConfigureRunAtStartup(USER_KEY_NAME, kRunValueName, core_cmd, install);
-}
-
-HRESULT SetupGoogleUpdate::RegisterOrUnregisterCOMLocalServer(bool reg) {
-  SETUP_LOG(L3, (_T("[SetupGoogleUpdate::RegisterOrUnregisterCOMLocalServer]")
-                 _T("[%d]"), reg));
-  const CString google_update_path =
-      goopdate_utils::BuildGoogleUpdateExePath(is_machine_);
-  CString register_cmd;
-  register_cmd.Format(_T("/%s"), reg ? kCmdRegServer : kCmdUnregServer);
-  HRESULT hr = RegisterOrUnregisterExe(google_update_path, register_cmd);
-  if (FAILED(hr)) {
-    SETUP_LOG(LE, (_T("[RegisterOrUnregisterExe failed][0x%08x]"), hr));
-    return hr;
-  }
-  return S_OK;
-}
-
-// Assumes that the MSI is in the current directory.
-// To debug MSI failures, use the following statement:
-// ::MsiEnableLog(INSTALLLOGMODE_VERBOSE, _T("C:\\msi.log"), NULL);
-HRESULT SetupGoogleUpdate::InstallMsiHelper() {
-  SETUP_LOG(L3, (_T("[SetupGoogleUpdate::InstallMsiHelper]")));
-  if (!is_machine_) {
-    return S_OK;
-  }
-
-  ++metric_setup_helper_msi_install_total;
-  HighresTimer metrics_timer;
-
-  const CPath msi_path(BuildSupportFileInstallPath(kHelperInstallerName));
-  ASSERT1(File::Exists(msi_path));
-
-  // Setting INSTALLUILEVEL_NONE causes installation to be silent and not
-  // create a restore point.
-  ::MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
-
-  // Try a normal install.
-  UINT res = ::MsiInstallProduct(msi_path, kMsiSuppressAllRebootsCmdLine);
-  if (ERROR_PRODUCT_VERSION == res) {
-    // The product may already be installed. Force a reinstall of everything.
-    SETUP_LOG(L3, (_T("[ERROR_PRODUCT_VERSION returned - forcing reinstall]")));
-    CString force_install_cmd_line;
-    force_install_cmd_line.Format(_T("REINSTALL=ALL REINSTALLMODE=vamus %s"),
-                                  kMsiSuppressAllRebootsCmdLine);
-    res = ::MsiInstallProduct(msi_path, force_install_cmd_line);
-  }
-
-  HRESULT hr = HRESULT_FROM_WIN32(res);
-  if (FAILED(hr)) {
-    SETUP_LOG(L1, (_T("[MsiInstallProduct failed][0x%08x][%u]"), hr, res));
-    return hr;
-  }
-
-  metric_setup_helper_msi_install_ms.AddSample(metrics_timer.GetElapsedMs());
-  ++metric_setup_helper_msi_install_succeeded;
-  return S_OK;
-}
-
-// The MSI is uninstalled.
-// TODO(omaha): Make sure this works after deleting the MSI.
-HRESULT SetupGoogleUpdate::UninstallMsiHelper() {
-  SETUP_LOG(L3, (_T("[SetupGoogleUpdate::UninstallMsiHelper]")));
-  if (!is_machine_) {
-    return S_OK;
-  }
-
-  // Setting INSTALLUILEVEL_NONE causes installation to be silent and not
-  // create a restore point.
-  ::MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
-
-  // MSDN says that eInstallState must be INSTALLSTATE_DEFAULT in order for the
-  // command line to be used. Therefore, instead of using INSTALLSTATE_ABSENT
-  // to uninstall, we must pass REMOVE=ALL in the command line.
-  CString uninstall_cmd_line;
-  uninstall_cmd_line.Format(_T("REMOVE=ALL %s"),
-                            kMsiSuppressAllRebootsCmdLine);
-  UINT res = ::MsiConfigureProductEx(kHelperInstallerProductGuid,
-                                     INSTALLLEVEL_DEFAULT,
-                                     INSTALLSTATE_DEFAULT,
-                                     uninstall_cmd_line);
-
-  // Ignore the product not currently installed result.
-  if ((ERROR_SUCCESS != res) && (ERROR_UNKNOWN_PRODUCT != res)) {
-    HRESULT hr = HRESULT_FROM_WIN32(res);
-    if (FAILED(hr)) {
-      SETUP_LOG(L1, (_T("[MsiInstallProduct failed][0x%08x][%u]"), hr, res));
-      return hr;
-    }
-  }
-
-  return S_OK;
-}
-
-HRESULT SetupGoogleUpdate::InstallBrowserPlugins() {
-  SETUP_LOG(L3, (_T("[SetupGoogleUpdate::InstallBrowserPlugins]")));
-  ASSERT1(have_called_uninstall_previous_versions_);
-  // Failure of registration of optional components is acceptable in release
-  // builds.
-  HRESULT hr = S_OK;
-
-  CString plugin_path =
-      BuildSupportFileInstallPath(UPDATE_PLUGIN_FILENAME);
-  hr = RegisterDll(plugin_path);
-  if (FAILED(hr)) {
-    SETUP_LOG(L1, (_T("[Register plugin DLL failed][0x%08x]"), hr));
-  }
-
-// TODO(omaha): Enable when we ship the BHO.
-#if 0
-  // Only install the BHO for machine installs. There is no corresponding HKCU
-  // registration for BHOs.
-  if (is_machine_) {
-    CString goopdate_bho_proxy_path = BuildSupportFileInstallPath(BHO_FILENAME);
-    hr = RegisterDll(goopdate_bho_proxy_path);
-    if (FAILED(hr)) {
-      SETUP_LOG(L1, (_T("[Register bho_proxy DLL failed][0x%08x]"), hr));
-    }
-  }
-#endif
-
-  return hr;
-}
-
-HRESULT SetupGoogleUpdate::UninstallBrowserPlugins() {
-  SETUP_LOG(L3, (_T("[SetupGoogleUpdate::UninstallBrowserPlugins]")));
-  // Unregistration. Failure is acceptable in release builds.
-  HRESULT hr = S_OK;
-
-  CString plugin_path =
-      BuildSupportFileInstallPath(UPDATE_PLUGIN_FILENAME);
-  hr = UnregisterDll(plugin_path);
-  if (FAILED(hr)) {
-    SETUP_LOG(L1, (_T("[Unregister plugin DLL failed][0x%08x]"), hr));
-  }
-
-// TODO(omaha): Enable when we ship the BHO.
-#if 0
-  if (is_machine_) {
-    CString goopdate_bho_proxy_path = BuildSupportFileInstallPath(BHO_FILENAME);
-    hr = UnregisterDll(goopdate_bho_proxy_path);
-    if (FAILED(hr)) {
-      SETUP_LOG(L1, (_T("[Unregister bho_proxy DLL failed][0x%08x]"), hr));
-    }
-  }
-#endif
-
-  return hr;
-}
-
-CString SetupGoogleUpdate::BuildSupportFileInstallPath(
-    const CString& filename) const {
-  SETUP_LOG(L3, (_T("[SetupGoogleUpdate::BuildSupportFileInstallPath][%s]"),
-                 filename));
-  CPath install_file_path = goopdate_utils::BuildInstallDirectory(
-                                is_machine_,
-                                this_version_);
-  VERIFY1(install_file_path.Append(filename));
-
-  return install_file_path;
-}
-
-CString SetupGoogleUpdate::BuildCoreProcessCommandLine() const {
-  CString google_update_path =
-      goopdate_utils::BuildGoogleUpdateExePath(is_machine_);
-  CommandLineBuilder builder(COMMANDLINE_MODE_CORE);
-  return builder.GetCommandLine(google_update_path);
-}
-
-HRESULT SetupGoogleUpdate::UninstallPreviousVersions() {
-#ifdef _DEBUG
-  have_called_uninstall_previous_versions_ = true;
-#endif
-
-  VERIFY1(SUCCEEDED(
-      scheduled_task_utils::UninstallLegacyGoopdateTasks(is_machine_)));
-
-  CString install_path(
-      is_machine_ ? ConfigManager::Instance()->GetMachineGoopdateInstallDir() :
-                    ConfigManager::Instance()->GetUserGoopdateInstallDir());
-  SETUP_LOG(L1, (_T("[SetupGoogleUpdate::UninstallPreviousVersions][%s][%s]"),
-                 install_path, this_version_));
-  // An empty install_path can be disastrous as it will start deleting from the
-  // current directory.
-  ASSERT1(!install_path.IsEmpty());
-  if (install_path.IsEmpty()) {
-    return E_UNEXPECTED;
-  }
-
-  // In the Google\\Update directory, run over all files and directories.
-  WIN32_FIND_DATA file_data = {0};
-  CPath find_files(install_path);
-  VERIFY1(find_files.Append(_T("*.*")));
-
-  scoped_hfind find_handle(::FindFirstFile(find_files, &file_data));
-  ASSERT1(find_handle);
-  if (!find_handle) {
-    // We should have found ".", "..", and our versioned directory.
-    DWORD err = ::GetLastError();
-    SETUP_LOG(LE, (L"[Subdirs not found under dir][%s][%d]", find_files, err));
-    return HRESULT_FROM_WIN32(err);
-  }
-
-  // Find the rightmost path element of the download directory.
-  CPath download_dir(OMAHA_REL_DOWNLOAD_STORAGE_DIR);
-  download_dir.StripPath();
-
-  BOOL found_next = TRUE;
-  for (; found_next; found_next = ::FindNextFile(get(find_handle),
-                                                 &file_data)) {
-    CPath file_or_directory(install_path);
-    VERIFY1(file_or_directory.Append(file_data.cFileName));
-    if (!(file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
-      // Do not delete the shell as it is used by all versions.
-      if (_tcsicmp(file_data.cFileName, kOmahaShellFileName)) {
-        DeleteBeforeOrAfterReboot(file_or_directory);
-      }
-    } else if (_tcscmp(file_data.cFileName, _T("..")) &&
-               _tcscmp(file_data.cFileName, _T(".")) &&
-               _tcsicmp(file_data.cFileName, this_version_) &&
-               _tcsicmp(file_data.cFileName, download_dir)) {
-      // Unregister the previous version OneClick if it exists. Ignore
-      // failures. The file is named npGoogleOneClick*.dll.
-      CPath old_oneclick(file_or_directory);
-      VERIFY1(old_oneclick.Append(ONECLICK_PLUGIN_NAME _T("*.dll")));
-      WIN32_FIND_DATA old_oneclick_file_data = {};
-      scoped_hfind found_oneclick(::FindFirstFile(old_oneclick,
-                                                  &old_oneclick_file_data));
-      if (found_oneclick) {
-        CPath old_oneclick_file(file_or_directory);
-        VERIFY1(old_oneclick_file.Append(old_oneclick_file_data.cFileName));
-        VERIFY1(SUCCEEDED(UnregisterDll(old_oneclick_file)));
-      }
-
-      // Unregister the previous version of the plugin if it exists. Ignore
-      // failures. The file is named npGoogleUpdate*.dll.
-      CPath old_plugin(file_or_directory);
-      VERIFY1(old_plugin.Append(UPDATE_PLUGIN_NAME _T("*.dll")));
-      WIN32_FIND_DATA old_plugin_file_data = {};
-      scoped_hfind found_plugin(::FindFirstFile(old_plugin,
-                                                &old_plugin_file_data));
-      if (found_plugin) {
-        CPath old_plugin_file(file_or_directory);
-        VERIFY1(old_plugin_file.Append(old_plugin_file_data.cFileName));
-        VERIFY1(SUCCEEDED(UnregisterDll(old_plugin_file)));
-      }
-
-
-      if (is_machine_) {
-        // TODO(omaha): Enable when we ship the BHO.
-        /*
-        // BHO is only installed for the machine case.
-        // Unregister the previous version BHO if it exists. Ignore failures.
-        CPath old_bho_dll(file_or_directory);
-        VERIFY1(old_bho_dll.Append(BHO_FILENAME));
-        if (File::Exists(old_bho_dll)) {
-          if (FAILED(UnregisterDll(old_bho_dll))) {
-            SETUP_LOG(LW, (L"[UnregisterDll() failed][%s]", old_bho_dll));
-          }
-        }
-        */
-      }
-      // Delete entire sub-directory.
-      DeleteBeforeOrAfterReboot(file_or_directory);
-    }
-  }
-
-  if (!found_next) {
-    DWORD err = ::GetLastError();
-    if (ERROR_NO_MORE_FILES != err) {
-      SETUP_LOG(LE, (L"[::FindNextFile() failed][%d]", err));
-      return HRESULT_FROM_WIN32(err);
-    }
-  }
-
-  // Clean up existing machine ID and user ID since they are no longer used.
-  // Ignore failures as they may not be present and we may not have permission
-  // to HKLM.
-  const TCHAR* const kRegValueMachineId = _T("mi");
-  const TCHAR* const kRegValueUserId = _T("ui");
-  RegKey::DeleteValue(ConfigManager::Instance()->machine_registry_update(),
-                      kRegValueMachineId);
-  RegKey::DeleteValue(
-      ConfigManager::Instance()->registry_update(is_machine_),
-      kRegValueUserId);
-
-  return S_OK;
-}
-
-void SetupGoogleUpdate::Uninstall() {
-  OPT_LOG(L1, (_T("[SetupGoogleUpdate::Uninstall]")));
-
-  HRESULT hr = UninstallBrowserPlugins();
-  if (FAILED(hr)) {
-    SETUP_LOG(LW, (_T("[UninstallBrowserPlugins failed][0x%08x]"), hr));
-    ASSERT1(HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND) == hr);
-  }
-
-  // If running from the installed location instead of a temporary location,
-  // we assume that Omaha had been properly installed and can verify the COM
-  // registration.
-  if (goopdate_utils::IsRunningFromOfficialGoopdateDir(is_machine_)) {
-    ASSERT1(SUCCEEDED(VerifyCOMLocalServerRegistration(is_machine_)));
-  }
-
-  hr = RegisterOrUnregisterCOMLocalServer(false);
-  if (FAILED(hr)) {
-    SETUP_LOG(LW,
-              (_T("[RegisterOrUnregisterCOMLocalServer failed][0x%08x]"), hr));
-    ASSERT1(GOOGLEUPDATE_E_DLL_NOT_FOUND == hr ||
-            HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) == hr);
-  }
-
-  hr = UninstallMsiHelper();
-  if (FAILED(hr)) {
-    SETUP_LOG(L1, (_T("[UninstallMsiHelper failed][0x%08x]"), hr));
-    ASSERT1(HRESULT_FROM_WIN32(ERROR_INSTALL_SERVICE_FAILURE) == hr);
-  }
-
-  UninstallLaunchMechanisms();
-
-  // Remove everything under top level Google Update registry key.
-  hr = DeleteRegistryKeys();
-  ASSERT1(SUCCEEDED(hr) || HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) == hr);
-}
-
-// Also deletes the main Google Update key if there is nothing in it.
-HRESULT SetupGoogleUpdate::DeleteRegistryKeys() {
-  OPT_LOG(L3, (_T("[SetupGoogleUpdate::DeleteRegistryKeys]")));
-
-  if (is_machine_) {
-    VERIFY1(SUCCEEDED(goopdate_utils::EnableSEHOP(false)));
-  }
-
-  CString root_key = ConfigManager::Instance()->registry_update(is_machine_);
-  ASSERT1(!root_key.IsEmpty());
-
-  RegKey root;
-  HRESULT hr = root.Open(root_key);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  std::vector<CString> sub_keys;
-  size_t num_keys = root.GetSubkeyCount();
-  for (size_t i = 0; i < num_keys; ++i) {
-    CString sub_key_name;
-    hr = root.GetSubkeyNameAt(i, &sub_key_name);
-    ASSERT1(hr == S_OK);
-    if (SUCCEEDED(hr)) {
-      sub_keys.push_back(sub_key_name);
-    }
-  }
-
-  ASSERT1(num_keys == sub_keys.size());
-  // Delete all the sub keys of the root key.
-  for (size_t i = 0; i < num_keys; ++i) {
-    VERIFY1(SUCCEEDED(root.RecurseDeleteSubKey(sub_keys[i])));
-  }
-
-  // Now delete all the values of the root key.
-  // The Last* values are not deleted.
-  // TODO(omaha3): The above is a temporary fix for bug 1539293. Need a better
-  // long-term solution in Omaha 3.
-  size_t num_values = root.GetValueCount();
-  std::vector<CString> value_names;
-  for (size_t i = 0; i < num_values; ++i) {
-    CString value_name;
-    DWORD type = 0;
-    hr = root.GetValueNameAt(i, &value_name, &type);
-    ASSERT1(hr == S_OK);
-    // TODO(omaha): Remove kRegValueLast* once we have an install API.
-    if (SUCCEEDED(hr)) {
-      if (value_name != kRegValueUserId &&
-          value_name != kRegValueLastInstallerResult &&
-          value_name != kRegValueLastInstallerError &&
-          value_name != kRegValueLastInstallerExtraCode1 &&
-          value_name != kRegValueLastInstallerResultUIString &&
-          value_name != kRegValueLastInstallerSuccessLaunchCmdLine) {
-        value_names.push_back(value_name);
-      }
-    }
-  }
-
-  for (size_t i = 0; i < value_names.size(); ++i) {
-    VERIFY1(SUCCEEDED(root.DeleteValue(value_names[i])));
-  }
-
-  if (0 == root.GetValueCount() && 0 == root.GetSubkeyCount()) {
-    VERIFY1(SUCCEEDED(RegKey::DeleteKey(root_key, false)));
-  }
-
-  return S_OK;
-}
-
-}  // namespace omaha
diff --git a/setup/setup_google_update.h b/setup/setup_google_update.h
deleted file mode 100644
index 676acfd..0000000
--- a/setup/setup_google_update.h
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_SETUP_SETUP_GOOGLE_UPDATE_H__
-#define OMAHA_SETUP_SETUP_GOOGLE_UPDATE_H__
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-#include "omaha/base/constants.h"
-
-namespace omaha {
-
-class SetupGoogleUpdate {
- public:
-  explicit SetupGoogleUpdate(bool is_machine);
-  ~SetupGoogleUpdate();
-
-  HRESULT FinishInstall();
-
-  HRESULT InstallBrowserPlugins();
-
-  // Uninstalls Google Update registrations created by FinishInstall().
-  void Uninstall();
-
-  // Build the command line to execute the installed core.
-  CString BuildCoreProcessCommandLine() const;
-
-  int extra_code1() const { return extra_code1_; }
-
- private:
-  HRESULT FinishMachineInstall();
-
-  // Installs appropriate launch mechanism(s) starts one of them if appropriate.
-  HRESULT InstallLaunchMechanisms();
-
-  // Uninstalls appropriate launch mechanism(s).
-  void UninstallLaunchMechanisms();
-
-  // Installs the scheduled task which runs the GoogleUpdate core.
-  HRESULT InstallScheduledTask();
-
-  // Installs the service and scheduled task.
-  HRESULT InstallMachineLaunchMechanisms();
-
-  // Add Google Update to the user's Run key.
-  HRESULT InstallUserLaunchMechanisms();
-
-  // Configures goopdate to run at startup.
-  //
-  // @param install: true if we should configure to run at startup, false if we
-  //   should clean up the configuration (meaning that we should not run at
-  //   startup)
-  HRESULT ConfigureUserRunAtStartup(bool install);
-
-  HRESULT InstallRegistryValues();
-
-  // Create's the ClientStateMedium key with relaxed ACLs.
-  // Only call for machine installs.
-  HRESULT CreateClientStateMedium();
-
-  // Writes the Installation ID to the registry.
-  HRESULT SetInstallationId();
-
-  // Register COM classes and interfaces.
-  HRESULT RegisterOrUnregisterCOMLocalServer(bool register);
-
-  // Installs the helper (MSI).
-  HRESULT InstallMsiHelper();
-
-  // Uninstalls the helper (MSI).
-  HRESULT UninstallMsiHelper();
-
-  HRESULT UninstallBrowserPlugins();
-
-  // Build the install file path for support files. For example,
-  CString BuildSupportFileInstallPath(const CString& filename) const;
-
-  // Deletes the Omaha registry keys except the machine id and the user id
-  // values under the main update key.
-  HRESULT DeleteRegistryKeys();
-
-  // Uninstall previous versions after an overinstall of the new version. We do
-  // the following:
-  //   * Delete all sub-directories under Google\\Update, except the running
-  //     version's directory and the cache directory.
-  //   * Uninstall the BHO, so IE does not load it in the future.
-  HRESULT UninstallPreviousVersions();
-
-  const bool is_machine_;
-  CString this_version_;
-  int extra_code1_;
-
-#ifdef _DEBUG
-  bool have_called_uninstall_previous_versions_;
-#endif
-
-  friend class SetupGoogleUpdateTest;
-  friend class AppManagerTestBase;
-
-  DISALLOW_EVIL_CONSTRUCTORS(SetupGoogleUpdate);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_SETUP_SETUP_GOOGLE_UPDATE_H__
-
diff --git a/setup/setup_google_update_unittest.cc b/setup/setup_google_update_unittest.cc
deleted file mode 100644
index aeeffa8..0000000
--- a/setup/setup_google_update_unittest.cc
+++ /dev/null
@@ -1,837 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-#include <msi.h>
-#include <atlpath.h>
-#include "base/scoped_ptr.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/atlregmapex.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/file.h"
-#include "omaha/base/path.h"
-#include "omaha/base/time.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/common/scheduled_task_utils.h"
-#include "omaha/setup/msi_test_utils.h"
-#include "omaha/setup/setup_google_update.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-const TCHAR kMsiInstallRegValue[] = _T("MsiStubRun");
-const TCHAR kMsiUninstallKey[] =
-    _T("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\")
-    _T("Uninstall\\{A92DAB39-4E2C-4304-9AB6-BC44E68B55E2}");
-const TCHAR kRunKey[] =
-    _T("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run");
-
-const TCHAR* const kAppId1 = _T("{B7E61EF9-AAE5-4cdf-A2D3-E4C8DF975145}");
-const TCHAR* const kAppId2 = _T("{35F1A986-417D-4039-8718-781DD418232A}");
-
-const TCHAR kRegistryHiveOverrideRootInHklm[] =
-    _T("HKLM\\Software\\") _T(SHORT_COMPANY_NAME_ANSI)
-    _T("\\") _T(PRODUCT_NAME_ANSI)
-    _T("\\UnitTest\\");
-
-// Copies the shell and DLLs that FinishInstall needs.
-// Does not replace files if they already exist.
-void CopyFilesRequiredByFinishInstall(bool is_machine, const CString& version) {
-  const CString omaha_path = is_machine ?
-      GetGoogleUpdateMachinePath() : GetGoogleUpdateUserPath();
-  const CString expected_shell_path =
-      ConcatenatePath(omaha_path, kOmahaShellFileName);
-  const CString version_path = ConcatenatePath(omaha_path, version);
-
-  ASSERT_SUCCEEDED(CreateDir(omaha_path, NULL));
-  ASSERT_SUCCEEDED(File::Copy(
-      ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                      kOmahaShellFileName),
-      expected_shell_path,
-      false));
-
-  ASSERT_SUCCEEDED(CreateDir(version_path, NULL));
-
-  const TCHAR* files[] = {kOmahaDllName,
-                          kHelperInstallerName,
-// TODO(omaha3): Enable once this is being built.
-#if 0
-                          _T("GoopdateBho.dll"),
-#endif
-                          UPDATE_PLUGIN_FILENAME};
-  for (size_t i = 0; i < arraysize(files); ++i) {
-    ASSERT_SUCCEEDED(File::Copy(
-        ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                        files[i]),
-        ConcatenatePath(version_path, files[i]),
-        false));
-  }
-}
-
-// RegisterOrUnregisterCOMLocalServer() called from FinishInstall() runs in a
-// separate process. When using registry redirection in the test, the new
-// process writes to the real registry, so the unit test fails. This function
-// creates dummy entries that VerifyCOMLocalServerRegistration() verifies, and
-// is happy about.
-void SetupCOMLocalServerRegistration(bool is_machine) {
-  // Setup the following for the unit test:
-  // * LocalServer32 under CLSID_OnDemandMachineAppsClass or
-  //   CLSID_OnDemandUserAppsClass should be the current exe's module path.
-  // * InProcServer32 under CLSID of IID_IGoogleUpdate should be the path of the
-  //   current module.
-  // * ProxyStubClsid32 under IGoogleUpdate interface should be the CLSID of the
-  //   proxy, which is PROXY_CLSID_IS.
-
-  CString base_clsid_key(is_machine ? _T("HKLM") : _T("HKCU"));
-  base_clsid_key += _T("\\Software\\Classes\\CLSID\\");
-  CString ondemand_clsid_key(base_clsid_key);
-// TODO(omaha3): Implement this for Omaha 3.
-#if 0
-  ondemand_clsid_key += GuidToString(is_machine ?
-                                     __uuidof(OnDemandMachineAppsClass) :
-                                     __uuidof(OnDemandUserAppsClass));
-  CString local_server_key(ondemand_clsid_key + _T("\\LocalServer32"));
-  CString expected_server(app_util::GetModulePath(NULL));
-  EnclosePath(&expected_server);
-  ASSERT_FALSE(expected_server.IsEmpty());
-  ASSERT_SUCCEEDED(RegKey::SetValue(local_server_key,
-                                    NULL,
-                                    expected_server));
-
-  const GUID proxy_clsid = PROXY_CLSID_IS;
-  CString ondemand_proxy_clsid_key(base_clsid_key);
-  ondemand_proxy_clsid_key += GuidToString(proxy_clsid);
-  CString inproc_server_key(ondemand_proxy_clsid_key + _T("\\InProcServer32"));
-  expected_server = app_util::GetCurrentModulePath();
-  ASSERT_FALSE(expected_server.IsEmpty());
-  ASSERT_SUCCEEDED(RegKey::SetValue(inproc_server_key,
-                                    NULL,
-                                    expected_server));
-
-  CString igoogleupdate_interface_key(is_machine ? _T("HKLM") : _T("HKCU"));
-  igoogleupdate_interface_key += _T("\\Software\\Classes\\Interface\\");
-  igoogleupdate_interface_key += GuidToString(__uuidof(IGoogleUpdate));
-  igoogleupdate_interface_key += _T("\\ProxyStubClsid32");
-  CString proxy_interface_value(GuidToString(proxy_clsid));
-  ASSERT_FALSE(proxy_interface_value.IsEmpty());
-  ASSERT_SUCCEEDED(RegKey::SetValue(igoogleupdate_interface_key,
-                                    NULL,
-                                    proxy_interface_value));
-#endif
-}
-
-void VerifyAccessRightsForTrustee(const CString& key_name,
-                                  ACCESS_MASK expected_access_rights,
-                                  CDacl* dacl,
-                                  TRUSTEE* trustee) {
-  CString fail_message;
-  fail_message.Format(_T("Key: %s; Trustee: "), key_name);
-  if (TRUSTEE_IS_NAME == trustee->TrusteeForm) {
-    fail_message.Append(trustee->ptstrName);
-  } else {
-    EXPECT_TRUE(TRUSTEE_IS_SID == trustee->TrusteeForm);
-    fail_message.Append(_T("is a SID"));
-  }
-
-  // Cast away the const so the pointer can be passed to the API. This should
-  // be safe for these purposes and because this is a unit test.
-  PACL pacl = const_cast<PACL>(dacl->GetPACL());
-  ACCESS_MASK access_rights = 0;
-  EXPECT_EQ(ERROR_SUCCESS, ::GetEffectiveRightsFromAcl(pacl,
-                                                       trustee,
-                                                       &access_rights)) <<
-      fail_message.GetString();
-  EXPECT_EQ(expected_access_rights, access_rights) << fail_message.GetString();
-}
-
-// TODO(omaha): It would be nice to test the access for a non-admin process.
-// The test requires admin privileges to run, so this would likely require
-// running a de-elevated process.
-void VerifyHklmKeyHasIntegrity(
-    const CString& key_name,
-    ACCESS_MASK expected_non_admin_interactive_access) {
-
-  // These checks can take a long time, so avoid them by default.
-  if (!ShouldRunEnormousTest()) {
-    return;
-  }
-
-  const ACCESS_MASK kExpectedPowerUsersAccess = vista_util::IsVistaOrLater() ?
-      0 : DELETE | READ_CONTROL | KEY_READ | KEY_WRITE;
-
-  CDacl dacl;
-  RegKey key;
-  EXPECT_SUCCEEDED(key.Open(key_name));
-  EXPECT_TRUE(::AtlGetDacl(key.Key(), SE_REGISTRY_KEY, &dacl));
-
-  CString current_user_sid_string;
-  EXPECT_SUCCEEDED(
-      user_info::GetProcessUser(NULL, NULL, &current_user_sid_string));
-  PSID current_user_sid = NULL;
-  EXPECT_TRUE(ConvertStringSidToSid(current_user_sid_string,
-                                    &current_user_sid));
-  TRUSTEE current_user = {0};
-  current_user.TrusteeForm = TRUSTEE_IS_SID;
-  current_user.TrusteeType = TRUSTEE_IS_USER;
-  current_user.ptstrName = static_cast<LPTSTR>(current_user_sid);
-  VerifyAccessRightsForTrustee(key_name, KEY_ALL_ACCESS, &dacl, &current_user);
-  EXPECT_FALSE(::LocalFree(current_user_sid));
-
-  PSID local_system_sid = NULL;
-  EXPECT_TRUE(ConvertStringSidToSid(kLocalSystemSid, &local_system_sid));
-  TRUSTEE local_system = {0};
-  local_system.TrusteeForm = TRUSTEE_IS_SID;
-  local_system.TrusteeType = TRUSTEE_IS_USER;
-  local_system.ptstrName = static_cast<LPTSTR>(local_system_sid);
-  VerifyAccessRightsForTrustee(key_name, KEY_ALL_ACCESS, &dacl, &local_system);
-  EXPECT_FALSE(::LocalFree(local_system_sid));
-
-  TRUSTEE administrators = {0};
-  administrators.TrusteeForm = TRUSTEE_IS_NAME;
-  administrators.TrusteeType = TRUSTEE_IS_GROUP;
-  administrators.ptstrName = _T("Administrators");
-  VerifyAccessRightsForTrustee(key_name,
-                               KEY_ALL_ACCESS,
-                               &dacl,
-                               &administrators);
-
-  TRUSTEE users = {0};
-  users.TrusteeForm = TRUSTEE_IS_NAME;
-  users.TrusteeType = TRUSTEE_IS_GROUP;
-  users.ptstrName = _T("Users");
-  VerifyAccessRightsForTrustee(key_name, KEY_READ, &dacl, &users);
-
-  TRUSTEE power_users = {0};
-  power_users.TrusteeForm = TRUSTEE_IS_NAME;
-  power_users.TrusteeType = TRUSTEE_IS_GROUP;
-  power_users.ptstrName = _T("Power Users");
-  VerifyAccessRightsForTrustee(key_name,
-                               kExpectedPowerUsersAccess,
-                               &dacl,
-                               &power_users);
-
-  TRUSTEE interactive = {0};
-  interactive.TrusteeForm = TRUSTEE_IS_NAME;
-  interactive.TrusteeType = TRUSTEE_IS_GROUP;
-  interactive.ptstrName = _T("INTERACTIVE");
-  VerifyAccessRightsForTrustee(key_name,
-                               expected_non_admin_interactive_access,
-                               &dacl,
-                               &interactive);
-
-  TRUSTEE everyone = {0};
-  everyone.TrusteeForm = TRUSTEE_IS_NAME;
-  everyone.TrusteeType = TRUSTEE_IS_GROUP;
-  everyone.ptstrName = _T("Everyone");
-  VerifyAccessRightsForTrustee(key_name, 0, &dacl, &everyone);
-
-  TRUSTEE guest = {0};
-  guest.TrusteeForm = TRUSTEE_IS_NAME;
-  guest.TrusteeType = TRUSTEE_IS_USER;
-  guest.ptstrName = _T("Guest");
-  VerifyAccessRightsForTrustee(key_name, 0, &dacl, &guest);
-}
-
-}  // namespace
-
-// INTERACTIVE group inherits privileges from Users in the default case.
-void VerifyHklmKeyHasDefaultIntegrity(const CString& key_full_name) {
-  VerifyHklmKeyHasIntegrity(key_full_name, KEY_READ);
-}
-
-void VerifyHklmKeyHasMediumIntegrity(const CString& key_full_name) {
-  VerifyHklmKeyHasIntegrity(key_full_name, KEY_READ | KEY_SET_VALUE);
-}
-
-class SetupGoogleUpdateTest : public testing::Test {
- protected:
-  explicit SetupGoogleUpdateTest(bool is_machine)
-      : is_machine_(is_machine) {
-  }
-
-  virtual void SetUp() {
-    setup_google_update_.reset(new SetupGoogleUpdate(is_machine_));
-  }
-
-  HRESULT InstallRegistryValues() {
-    return setup_google_update_->InstallRegistryValues();
-  }
-
-  HRESULT InstallLaunchMechanisms() {
-    return setup_google_update_->InstallLaunchMechanisms();
-  }
-
-  void UninstallLaunchMechanisms() {
-    setup_google_update_->UninstallLaunchMechanisms();
-  }
-
-  HRESULT CreateClientStateMedium() {
-    return setup_google_update_->CreateClientStateMedium();
-  }
-
-  HRESULT InstallMsiHelper() {
-    return setup_google_update_->InstallMsiHelper();
-  }
-
-  HRESULT UninstallMsiHelper() {
-    return setup_google_update_->UninstallMsiHelper();
-  }
-
-  bool is_machine_;
-  scoped_ptr<SetupGoogleUpdate> setup_google_update_;
-};
-
-class SetupGoogleUpdateUserTest : public SetupGoogleUpdateTest {
- protected:
-  SetupGoogleUpdateUserTest()
-      : SetupGoogleUpdateTest(false) {
-  }
-};
-
-class SetupGoogleUpdateMachineTest : public SetupGoogleUpdateTest {
- protected:
-  SetupGoogleUpdateMachineTest()
-      : SetupGoogleUpdateTest(true) {
-  }
-};
-
-class SetupGoogleUpdateUserRegistryProtectedTest
-    : public SetupGoogleUpdateUserTest {
- protected:
-  SetupGoogleUpdateUserRegistryProtectedTest()
-      : SetupGoogleUpdateUserTest(),
-        hive_override_key_name_(kRegistryHiveOverrideRoot) {
-    const CString expected_shell_path =
-        ConcatenatePath(GetGoogleUpdateUserPath(), kOmahaShellFileName);
-    expected_run_key_value_.Format(_T("\"%s\" /c"), expected_shell_path);
-  }
-
-  virtual void SetUp() {
-    RegKey::DeleteKey(hive_override_key_name_, true);
-    // Do not override HKLM because it contains the CSIDL_* definitions.
-    OverrideSpecifiedRegistryHives(hive_override_key_name_, false, true);
-
-    SetupGoogleUpdateUserTest::SetUp();
-  }
-
-  virtual void TearDown() {
-    SetupGoogleUpdateUserTest::TearDown();
-
-    RestoreRegistryHives();
-    ASSERT_SUCCEEDED(RegKey::DeleteKey(hive_override_key_name_, true));
-  }
-
-  CString hive_override_key_name_;
-  CString expected_run_key_value_;
-};
-
-class SetupGoogleUpdateMachineRegistryProtectedTest
-    : public SetupGoogleUpdateMachineTest {
- protected:
-  SetupGoogleUpdateMachineRegistryProtectedTest()
-      : SetupGoogleUpdateMachineTest(),
-        hive_override_key_name_(kRegistryHiveOverrideRoot) {
-  }
-
-  virtual void SetUp() {
-    RegKey::DeleteKey(hive_override_key_name_, true);
-    OverrideRegistryHives(hive_override_key_name_);
-
-    // Add CSIDL values needed by the tests.
-    ASSERT_SUCCEEDED(RegKey::SetValue(kCsidlSystemIdsRegKey,
-                                      kCsidlProgramFilesRegValue,
-                                      _T("C:\\Program Files")));
-
-    SetupGoogleUpdateMachineTest::SetUp();
-  }
-
-  virtual void TearDown() {
-    SetupGoogleUpdateMachineTest::TearDown();
-
-    RestoreRegistryHives();
-    ASSERT_SUCCEEDED(RegKey::DeleteKey(hive_override_key_name_, true));
-  }
-
-  CString hive_override_key_name_;
-};
-
-// There are a few tests where keys need to inherit the HKLM privileges, so put
-// the override root in HKLM. All tests using this framework must run as admin.
-class SetupGoogleUpdateMachineRegistryProtectedInHklmTest
-    : public SetupGoogleUpdateMachineRegistryProtectedTest {
- protected:
-  SetupGoogleUpdateMachineRegistryProtectedInHklmTest()
-      : SetupGoogleUpdateMachineRegistryProtectedTest() {
-    hive_override_key_name_ = kRegistryHiveOverrideRootInHklm;
-  }
-};
-
-// This test uninstalls all other versions of Omaha.
-TEST_F(SetupGoogleUpdateUserRegistryProtectedTest,
-       FinishInstall_RunKeyDoesNotExist) {
-  if (!ShouldRunLargeTest()) {
-    return;
-  }
-
-  // The version in the real registry must be set because it is used by
-  // GoogleUpdate.exe during registrations.
-  RestoreRegistryHives();
-  const bool had_pv = RegKey::HasValue(USER_REG_CLIENTS_GOOPDATE,
-                                       kRegValueProductVersion);
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    GetVersionString()));
-  OverrideSpecifiedRegistryHives(hive_override_key_name_, false, true);
-
-  CopyFilesRequiredByFinishInstall(is_machine_, GetVersionString());
-  SetupCOMLocalServerRegistration(is_machine_);
-
-  EXPECT_SUCCEEDED(RegKey::CreateKey(_T("HKCU\\Software\\Classes")));
-
-  ASSERT_FALSE(RegKey::HasKey(kRunKey));
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("mi"),
-                                    _T("39980C99-CDD5-43A0-93C7-69D90C14729")));
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE,
-                                    _T("mi"),
-                                    _T("39980C99-CDD5-43A0-93C7-69D90C14729")));
-  EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    _T("ui"),
-                                    _T("49980C99-CDD5-43A0-93C7-69D90C14729")));
-
-  EXPECT_SUCCEEDED(setup_google_update_->FinishInstall());
-
-  // Check the system state.
-
-  CPath expected_shell_path(GetGoogleUpdateUserPath());
-  expected_shell_path.Append(kOmahaShellFileName);
-  CString shell_path;
-  EXPECT_SUCCEEDED(RegKey::GetValue(USER_REG_UPDATE, _T("path"), &shell_path));
-  EXPECT_STREQ(expected_shell_path, shell_path);
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kRunKey,
-                                    _T(OMAHA_APP_NAME_ANSI),
-                                    &value));
-  EXPECT_STREQ(expected_run_key_value_, value);
-  EXPECT_TRUE(scheduled_task_utils::IsInstalledGoopdateTaskUA(false));
-  EXPECT_FALSE(scheduled_task_utils::IsDisabledGoopdateTaskUA(false));
-
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(USER_REG_UPDATE, kRegValueInstalledVersion, &value));
-  EXPECT_EQ(GetVersionString(), value);
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, kRegValueLastChecked));
-
-  EXPECT_TRUE(RegKey::HasValue(USER_REG_UPDATE, _T("mi")));
-  EXPECT_FALSE(RegKey::HasValue(MACHINE_REG_UPDATE, _T("mi")));
-  EXPECT_FALSE(RegKey::HasValue(USER_REG_UPDATE, _T("ui")));
-
-  // TODO(omaha): Check for other state.
-
-  // Clean up the launch mechanisms, at least one of which is not in the
-  // overriding registry.
-  UninstallLaunchMechanisms();
-  EXPECT_FALSE(RegKey::HasValue(kRunKey, _T(OMAHA_APP_NAME_ANSI)));
-  EXPECT_FALSE(scheduled_task_utils::IsInstalledGoopdateTaskUA(false));
-
-  if (!had_pv) {
-    // Delete the pv value. Some tests or shell .exe instances may see this
-    // value and assume Omaha is correctly installed.
-    RestoreRegistryHives();
-    EXPECT_SUCCEEDED(RegKey::DeleteValue(USER_REG_CLIENTS_GOOPDATE,
-                                         kRegValueProductVersion));
-  }
-}
-
-// TODO(omaha): Assumes GoogleUpdate.exe exists in the installed location, which
-// is not always true when run independently.
-TEST_F(SetupGoogleUpdateUserRegistryProtectedTest, InstallRegistryValues) {
-  if (IsTestRunByLocalSystem()) {
-    return;
-  }
-
-  // For this test only, we must also override HKLM in order to check that
-  // MACHINE_REG_CLIENT_STATE_MEDIUM was not created.
-  // Get the correct value of and set the CSIDL value needed by the test.
-  CString profile_path;
-  EXPECT_SUCCEEDED(GetFolderPath(CSIDL_PROFILE, &profile_path));
-  OverrideSpecifiedRegistryHives(hive_override_key_name_, true, true);
-  CString user_sid;
-  EXPECT_SUCCEEDED(user_info::GetProcessUser(NULL, NULL, &user_sid));
-  const TCHAR* const kProfileListKey =
-      _T("HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\")
-      _T("ProfileList\\");
-  const CString profile_path_key = kProfileListKey + user_sid;
-  EXPECT_SUCCEEDED(
-    RegKey::SetValue(profile_path_key, _T("ProfileImagePath"), profile_path));
-
-  EXPECT_SUCCEEDED(InstallRegistryValues());
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  EXPECT_TRUE(RegKey::HasKey(USER_REG_GOOGLE));
-  EXPECT_TRUE(RegKey::HasKey(USER_REG_UPDATE));
-  EXPECT_TRUE(RegKey::HasKey(USER_REG_CLIENTS));
-  EXPECT_TRUE(RegKey::HasKey(USER_REG_CLIENT_STATE));
-  EXPECT_TRUE(RegKey::HasKey(USER_REG_CLIENTS_GOOPDATE));
-  EXPECT_TRUE(RegKey::HasKey(USER_REG_CLIENT_STATE_GOOPDATE));
-  EXPECT_FALSE(RegKey::HasKey(MACHINE_REG_CLIENT_STATE_MEDIUM));
-
-  // Ensure no unexpected keys were created.
-  RegKey google_key;
-  EXPECT_SUCCEEDED(google_key.Open(USER_REG_GOOGLE));
-  EXPECT_EQ(1, google_key.GetSubkeyCount());
-
-  RegKey update_key;
-  EXPECT_SUCCEEDED(update_key.Open(USER_REG_UPDATE));
-  EXPECT_EQ(2, update_key.GetSubkeyCount());
-
-  RegKey clients_key;
-  EXPECT_SUCCEEDED(clients_key.Open(USER_REG_CLIENTS));
-  EXPECT_EQ(1, clients_key.GetSubkeyCount());
-
-  RegKey client_state_key;
-  EXPECT_SUCCEEDED(client_state_key.Open(USER_REG_CLIENT_STATE));
-  EXPECT_EQ(1, client_state_key.GetSubkeyCount());
-
-  CPath expected_shell_path(GetGoogleUpdateUserPath());
-  expected_shell_path.Append(kOmahaShellFileName);
-  CString shell_path;
-  EXPECT_SUCCEEDED(RegKey::GetValue(USER_REG_UPDATE, _T("path"), &shell_path));
-  EXPECT_STREQ(expected_shell_path, shell_path);
-
-  CString product_version;
-  EXPECT_SUCCEEDED(RegKey::GetValue(USER_REG_CLIENT_STATE_GOOPDATE,
-                                    _T("pv"),
-                                    &product_version));
-  EXPECT_STREQ(GetVersionString(), product_version);
-}
-
-// TODO(omaha): Assumes GoogleUpdate.exe exists in the installed location, which
-// is not always true when run independently.
-// TODO(omaha): Fails when run by itself on Windows Vista.
-TEST_F(SetupGoogleUpdateMachineRegistryProtectedInHklmTest,
-       InstallRegistryValues) {
-  EXPECT_SUCCEEDED(InstallRegistryValues());
-  const uint32 now = Time64ToInt32(GetCurrent100NSTime());
-
-  EXPECT_TRUE(RegKey::HasKey(MACHINE_REG_GOOGLE));
-  EXPECT_TRUE(RegKey::HasKey(MACHINE_REG_UPDATE));
-  EXPECT_TRUE(RegKey::HasKey(MACHINE_REG_CLIENTS));
-  EXPECT_TRUE(RegKey::HasKey(MACHINE_REG_CLIENT_STATE));
-  EXPECT_TRUE(RegKey::HasKey(MACHINE_REG_CLIENTS_GOOPDATE));
-  EXPECT_TRUE(RegKey::HasKey(MACHINE_REG_CLIENT_STATE_GOOPDATE));
-  EXPECT_TRUE(RegKey::HasKey(MACHINE_REG_CLIENT_STATE_MEDIUM));
-
-  // Ensure no unexpected keys were created.
-  RegKey google_key;
-  EXPECT_SUCCEEDED(google_key.Open(MACHINE_REG_GOOGLE));
-  EXPECT_EQ(1, google_key.GetSubkeyCount());
-
-  RegKey update_key;
-  EXPECT_SUCCEEDED(update_key.Open(MACHINE_REG_UPDATE));
-  EXPECT_EQ(3, update_key.GetSubkeyCount());
-
-  RegKey clients_key;
-  EXPECT_SUCCEEDED(clients_key.Open(MACHINE_REG_CLIENTS));
-  EXPECT_EQ(1, clients_key.GetSubkeyCount());
-
-  RegKey client_state_key;
-  EXPECT_SUCCEEDED(client_state_key.Open(MACHINE_REG_CLIENT_STATE));
-  EXPECT_EQ(1, client_state_key.GetSubkeyCount());
-
-  RegKey client_state_medium_key;
-  EXPECT_SUCCEEDED(
-      client_state_medium_key.Open(MACHINE_REG_CLIENT_STATE_MEDIUM));
-  EXPECT_EQ(0, client_state_medium_key.GetSubkeyCount());
-  VerifyHklmKeyHasDefaultIntegrity(MACHINE_REG_CLIENT_STATE_MEDIUM);
-
-  CString expected_shell_path;
-  EXPECT_SUCCEEDED(GetFolderPath(CSIDL_PROGRAM_FILES, &expected_shell_path));
-  expected_shell_path.Append(_T("\\") SHORT_COMPANY_NAME
-                             _T("\\") PRODUCT_NAME
-                             _T("\\GoogleUpdate.exe"));
-  CString shell_path;
-  EXPECT_SUCCEEDED(
-      RegKey::GetValue(MACHINE_REG_UPDATE, _T("path"), &shell_path));
-  EXPECT_STREQ(expected_shell_path, shell_path);
-
-  CString product_version;
-  EXPECT_SUCCEEDED(RegKey::GetValue(MACHINE_REG_CLIENT_STATE_GOOPDATE,
-                                    _T("pv"),
-                                    &product_version));
-  EXPECT_STREQ(GetVersionString(), product_version);
-
-  // Test permission of Update and ClientState. ClientStateMedium checked above.
-  VerifyHklmKeyHasDefaultIntegrity(MACHINE_REG_UPDATE);
-  VerifyHklmKeyHasDefaultIntegrity(MACHINE_REG_CLIENT_STATE);
-
-  // Test the permission inheritance for ClientStateMedium.
-  const CString app_client_state_medium_key_name = AppendRegKeyPath(
-      MACHINE_REG_CLIENT_STATE_MEDIUM,
-      kAppId1);
-  EXPECT_SUCCEEDED(RegKey::CreateKey(app_client_state_medium_key_name));
-
-  VerifyHklmKeyHasMediumIntegrity(app_client_state_medium_key_name);
-}
-
-TEST_F(SetupGoogleUpdateMachineRegistryProtectedInHklmTest,
-       CreateClientStateMedium_KeyAlreadyExistsWithSamePermissions) {
-  EXPECT_SUCCEEDED(RegKey::CreateKey(MACHINE_REG_UPDATE));
-  EXPECT_SUCCEEDED(CreateClientStateMedium());
-  VerifyHklmKeyHasDefaultIntegrity(MACHINE_REG_CLIENT_STATE_MEDIUM);
-
-  EXPECT_SUCCEEDED(CreateClientStateMedium());
-  VerifyHklmKeyHasDefaultIntegrity(MACHINE_REG_CLIENT_STATE_MEDIUM);
-}
-
-// CreateClientStateMedium does not replace permissions on existing keys.
-TEST_F(SetupGoogleUpdateMachineRegistryProtectedInHklmTest,
-       CreateClientStateMedium_KeysAlreadyExistWithDifferentPermissions) {
-  // The checks in this test can take a long time, so avoid them by default.
-  if (!ShouldRunEnormousTest()) {
-    return;
-  }
-
-  const CString app1_client_state_medium_key_name = AppendRegKeyPath(
-      MACHINE_REG_CLIENT_STATE_MEDIUM,
-      kAppId1);
-  const CString app2_client_state_medium_key_name = AppendRegKeyPath(
-      MACHINE_REG_CLIENT_STATE_MEDIUM,
-      kAppId2);
-
-  TRUSTEE users = {0};
-  users.TrusteeForm = TRUSTEE_IS_NAME;
-  users.TrusteeType = TRUSTEE_IS_GROUP;
-  users.ptstrName = _T("Users");
-
-  TRUSTEE interactive = {0};
-  interactive.TrusteeForm = TRUSTEE_IS_NAME;
-  interactive.TrusteeType = TRUSTEE_IS_GROUP;
-  interactive.ptstrName = _T("INTERACTIVE");
-
-  EXPECT_SUCCEEDED(RegKey::CreateKey(MACHINE_REG_UPDATE));
-
-  CDacl dacl;
-  dacl.AddAllowedAce(Sids::Admins(), GENERIC_ALL);
-  // Interactive is not explicitly set.
-  dacl.AddAllowedAce(Sids::Users(), KEY_WRITE);
-
-  CSecurityDesc security_descriptor;
-  security_descriptor.SetDacl(dacl);
-  security_descriptor.MakeAbsolute();
-
-  CSecurityAttributes sa;
-  sa.Set(security_descriptor);
-
-  EXPECT_SUCCEEDED(RegKey::CreateKey(MACHINE_REG_CLIENT_STATE_MEDIUM,
-                                     REG_NONE,
-                                     REG_OPTION_NON_VOLATILE,
-                                     &sa));
-
-  EXPECT_SUCCEEDED(RegKey::CreateKey(app1_client_state_medium_key_name));
-
-
-  EXPECT_SUCCEEDED(CreateClientStateMedium());
-
-  // Verify the ACLs for the existing keys were not changed.
-  // INTERACTIVE appears to inherit the privileges of Users.
-  VerifyAccessRightsForTrustee(
-      MACHINE_REG_CLIENT_STATE_MEDIUM, KEY_WRITE, &dacl, &users);
-  VerifyAccessRightsForTrustee(
-      MACHINE_REG_CLIENT_STATE_MEDIUM, KEY_WRITE, &dacl, &interactive);
-  VerifyAccessRightsForTrustee(
-      app1_client_state_medium_key_name, KEY_WRITE, &dacl, &users);
-  VerifyAccessRightsForTrustee(
-      app1_client_state_medium_key_name, KEY_WRITE, &dacl, &interactive);
-
-  // Verify the ACLs of newly created subkeys.
-  EXPECT_SUCCEEDED(RegKey::CreateKey(app2_client_state_medium_key_name));
-  VerifyAccessRightsForTrustee(
-      app2_client_state_medium_key_name, KEY_WRITE, &dacl, &users);
-  VerifyAccessRightsForTrustee(
-      app2_client_state_medium_key_name, KEY_WRITE, &dacl, &interactive);
-}
-
-TEST_F(SetupGoogleUpdateUserRegistryProtectedTest,
-       InstallLaunchMechanisms_RunKeyValueExists) {
-  EXPECT_SUCCEEDED(RegKey::SetValue(kRunKey,
-                                    _T(OMAHA_APP_NAME_ANSI),
-                                    _T("fo /b")));
-
-  EXPECT_SUCCEEDED(InstallLaunchMechanisms());
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kRunKey,
-                                    _T(OMAHA_APP_NAME_ANSI),
-                                    &value));
-  EXPECT_STREQ(expected_run_key_value_, value);
-  EXPECT_TRUE(scheduled_task_utils::IsInstalledGoopdateTaskUA(false));
-  EXPECT_FALSE(scheduled_task_utils::IsDisabledGoopdateTaskUA(false));
-
-  UninstallLaunchMechanisms();
-  EXPECT_FALSE(RegKey::HasValue(kRunKey, _T(OMAHA_APP_NAME_ANSI)));
-  EXPECT_FALSE(scheduled_task_utils::IsInstalledGoopdateTaskUA(false));
-}
-
-TEST_F(SetupGoogleUpdateUserRegistryProtectedTest,
-       InstallLaunchMechanisms_RunKeyDoesNotExist) {
-  ASSERT_FALSE(RegKey::HasKey(kRunKey));
-
-  EXPECT_SUCCEEDED(InstallLaunchMechanisms());
-
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(kRunKey,
-                                    _T(OMAHA_APP_NAME_ANSI),
-                                    &value));
-  EXPECT_STREQ(expected_run_key_value_, value);
-  EXPECT_TRUE(scheduled_task_utils::IsInstalledGoopdateTaskUA(false));
-  EXPECT_FALSE(scheduled_task_utils::IsDisabledGoopdateTaskUA(false));
-
-  UninstallLaunchMechanisms();
-  EXPECT_FALSE(RegKey::HasValue(kRunKey, _T(OMAHA_APP_NAME_ANSI)));
-  EXPECT_FALSE(scheduled_task_utils::IsInstalledGoopdateTaskUA(false));
-}
-
-// The helper can be installed when the test begins.
-// It will not be installed when the test successfully completes.
-TEST_F(SetupGoogleUpdateMachineTest, InstallAndUninstallMsiHelper) {
-  if (!ShouldRunLargeTest()) {
-    return;
-  }
-  const TCHAR* MsiInstallRegValueKey =
-      ConfigManager::Instance()->machine_registry_update();
-
-  CopyFilesRequiredByFinishInstall(is_machine_, GetVersionString());
-
-  if (vista_util::IsUserAdmin()) {
-    // Prepare for the test - make sure the helper isn't installed.
-    EXPECT_HRESULT_SUCCEEDED(UninstallMsiHelper());
-    EXPECT_FALSE(RegKey::HasValue(MsiInstallRegValueKey, kMsiInstallRegValue));
-    EXPECT_FALSE(RegKey::HasKey(kMsiUninstallKey));
-
-    // Verify installation.
-    DWORD reg_value = 0xffffffff;
-    EXPECT_HRESULT_SUCCEEDED(InstallMsiHelper());
-    EXPECT_TRUE(RegKey::HasValue(MsiInstallRegValueKey, kMsiInstallRegValue));
-    EXPECT_HRESULT_SUCCEEDED(RegKey::GetValue(MsiInstallRegValueKey,
-                                              kMsiInstallRegValue,
-                                              &reg_value));
-    EXPECT_EQ(0, reg_value);
-    EXPECT_TRUE(RegKey::HasKey(kMsiUninstallKey));
-
-    // Verify over-install.
-    EXPECT_HRESULT_SUCCEEDED(InstallMsiHelper());
-    EXPECT_TRUE(RegKey::HasValue(MsiInstallRegValueKey, kMsiInstallRegValue));
-    EXPECT_HRESULT_SUCCEEDED(RegKey::GetValue(MsiInstallRegValueKey,
-                                              kMsiInstallRegValue,
-                                              &reg_value));
-    EXPECT_EQ(0, reg_value);
-    EXPECT_TRUE(RegKey::HasKey(kMsiUninstallKey));
-
-    // Verify uninstall.
-    EXPECT_HRESULT_SUCCEEDED(UninstallMsiHelper());
-    EXPECT_FALSE(RegKey::HasValue(MsiInstallRegValueKey, kMsiInstallRegValue));
-    EXPECT_FALSE(RegKey::HasKey(kMsiUninstallKey));
-
-    // Verify uninstall when not currently installed.
-    EXPECT_HRESULT_SUCCEEDED(UninstallMsiHelper());
-  } else {
-    {
-      // This method expects to be called elevated and makes an assumption
-      // about a return value.
-      ExpectAsserts expect_asserts;
-      EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_INSTALL_PACKAGE_REJECTED),
-                InstallMsiHelper());
-    }
-    if (IsMsiHelperInstalled()) {
-      // If the MSI is installed UninstallMsiHelper returns
-      // ERROR_INSTALL_FAILURE.
-      EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_INSTALL_FAILURE),
-                UninstallMsiHelper());
-    } else {
-      // If the MSI is not installed UninstallMsiHelper returns S_OK.
-      EXPECT_HRESULT_SUCCEEDED(UninstallMsiHelper());
-    }
-  }
-}
-
-// This test installs a different build of the helper installer then calls
-// InstallMsiHelper to install the one that has been built.
-// If run without the REINSTALL property, ERROR_PRODUCT_VERSION would occur.
-// This test verifies that such overinstalls are correctly handled and that the
-// registry value is correctly changed.
-// Note: The name of the installer cannot be different. MSI tries to find the
-// original filename in the new directory.
-// The helper can be installed when the test begins.
-// It will not be installed when the test successfully completes.
-TEST_F(SetupGoogleUpdateMachineTest,
-       InstallMsiHelper_OverinstallDifferentMsiBuild) {
-  if (!ShouldRunLargeTest()) {
-    return;
-  }
-  if (!vista_util::IsUserAdmin()) {
-    std::wcout << _T("\tThis test did not run because it must be run as admin.")
-               << std::endl;
-    return;
-  }
-
-  const TCHAR kDifferentMsi[] =
-      _T("unittest_support\\GoogleUpdateHelper.msi");
-  const TCHAR* MsiInstallRegValueKey =
-      ConfigManager::Instance()->machine_registry_update();
-
-  CopyFilesRequiredByFinishInstall(is_machine_, GetVersionString());
-
-  CString different_msi_path(app_util::GetCurrentModuleDirectory());
-  ASSERT_TRUE(::PathAppend(CStrBuf(different_msi_path, MAX_PATH),
-                           kDifferentMsi));
-
-  // Prepare for the test - make sure the helper is not installed.
-  EXPECT_HRESULT_SUCCEEDED(UninstallMsiHelper());
-  EXPECT_FALSE(RegKey::HasValue(MsiInstallRegValueKey, kMsiInstallRegValue));
-  EXPECT_FALSE(RegKey::HasKey(kMsiUninstallKey));
-
-  // Install an older version of the MSI.
-  DWORD reg_value = 0xffffffff;
-  ::MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
-  EXPECT_EQ(ERROR_SUCCESS, ::MsiInstallProduct(different_msi_path, _T("")));
-  EXPECT_TRUE(RegKey::HasValue(MsiInstallRegValueKey, kMsiInstallRegValue));
-  EXPECT_HRESULT_SUCCEEDED(
-      RegKey::GetValue(MsiInstallRegValueKey, kMsiInstallRegValue, &reg_value));
-  EXPECT_EQ(9, reg_value);
-  EXPECT_TRUE(RegKey::HasKey(kMsiUninstallKey));
-
-  // Over-install.
-  EXPECT_HRESULT_SUCCEEDED(InstallMsiHelper());
-  EXPECT_TRUE(RegKey::HasValue(MsiInstallRegValueKey, kMsiInstallRegValue));
-  EXPECT_HRESULT_SUCCEEDED(
-      RegKey::GetValue(MsiInstallRegValueKey, kMsiInstallRegValue, &reg_value));
-  EXPECT_EQ(0, reg_value);
-  EXPECT_TRUE(RegKey::HasKey(kMsiUninstallKey));
-
-  // Clean up.
-  EXPECT_HRESULT_SUCCEEDED(UninstallMsiHelper());
-  EXPECT_FALSE(RegKey::HasValue(MsiInstallRegValueKey, kMsiInstallRegValue));
-  EXPECT_FALSE(RegKey::HasKey(kMsiUninstallKey));
-}
-
-}  // namespace omaha
diff --git a/setup/setup_metrics.cc b/setup/setup_metrics.cc
deleted file mode 100644
index 78464c5..0000000
--- a/setup/setup_metrics.cc
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/setup/setup_metrics.h"
-
-namespace omaha {
-
-DEFINE_METRIC_count(setup_install_total);
-DEFINE_METRIC_count(setup_install_succeeded);
-
-DEFINE_METRIC_count(setup_update_self_total);
-DEFINE_METRIC_count(setup_update_self_succeeded);
-
-DEFINE_METRIC_count(setup_do_self_install_total);
-DEFINE_METRIC_count(setup_do_self_install_succeeded);
-
-DEFINE_METRIC_timing(setup_install_google_update_total_ms);
-
-DEFINE_METRIC_timing(setup_handoff_ui_ms);
-
-DEFINE_METRIC_count(setup_should_install_total);
-DEFINE_METRIC_count(setup_should_install_false_oc);
-DEFINE_METRIC_count(setup_should_install_true_fresh_install);
-DEFINE_METRIC_count(setup_should_install_false_older);
-DEFINE_METRIC_count(setup_should_install_true_newer);
-DEFINE_METRIC_count(setup_should_install_false_same);
-DEFINE_METRIC_count(setup_should_install_true_same);
-DEFINE_METRIC_count(setup_should_install_true_same_completion_missing);
-DEFINE_METRIC_count(setup_subsequent_install_total);
-DEFINE_METRIC_count(setup_subsequent_install_should_install_true);
-
-DEFINE_METRIC_count(setup_files_total);
-DEFINE_METRIC_count(setup_files_verification_succeeded);
-DEFINE_METRIC_count(setup_files_verification_failed_pre);
-DEFINE_METRIC_count(setup_files_verification_failed_post);
-
-DEFINE_METRIC_timing(setup_files_ms);
-
-DEFINE_METRIC_count(setup_files_replace_shell);
-
-DEFINE_METRIC_timing(setup_phase2_ms);
-
-DEFINE_METRIC_count(setup_install_service_task_total);
-DEFINE_METRIC_count(setup_install_service_succeeded);
-DEFINE_METRIC_count(setup_install_task_succeeded);
-DEFINE_METRIC_count(setup_install_service_and_task_succeeded);
-DEFINE_METRIC_count(setup_install_service_and_task_failed);
-DEFINE_METRIC_integer(setup_install_service_error);
-DEFINE_METRIC_integer(setup_install_task_error);
-
-DEFINE_METRIC_timing(setup_install_service_ms);
-DEFINE_METRIC_timing(setup_install_service_failed_ms);
-DEFINE_METRIC_timing(setup_install_task_ms);
-
-DEFINE_METRIC_count(setup_start_service_total);
-DEFINE_METRIC_count(setup_start_service_succeeded);
-DEFINE_METRIC_integer(setup_start_service_error);
-
-DEFINE_METRIC_timing(setup_start_service_ms);
-DEFINE_METRIC_timing(setup_start_service_failed_ms);
-
-DEFINE_METRIC_count(setup_start_task_total);
-DEFINE_METRIC_count(setup_start_task_succeeded);
-DEFINE_METRIC_integer(setup_start_task_error);
-
-DEFINE_METRIC_timing(setup_start_task_ms);
-
-DEFINE_METRIC_count(setup_helper_msi_install_total);
-DEFINE_METRIC_count(setup_helper_msi_install_succeeded);
-
-DEFINE_METRIC_timing(setup_helper_msi_install_ms);
-
-DEFINE_METRIC_count(setup_locks_failed);
-DEFINE_METRIC_count(setup_lock12_failed);
-
-DEFINE_METRIC_timing(setup_lock_acquire_ms);
-
-DEFINE_METRIC_count(setup_process_wait_failed);
-DEFINE_METRIC_count(setup_process_wait_failed_unknown);
-DEFINE_METRIC_count(setup_process_wait_failed_core);
-DEFINE_METRIC_count(setup_process_wait_failed_report);
-DEFINE_METRIC_count(setup_process_wait_failed_update);
-DEFINE_METRIC_count(setup_process_wait_failed_handoff);
-DEFINE_METRIC_count(setup_process_wait_failed_ua);
-DEFINE_METRIC_count(setup_process_wait_failed_cr);
-DEFINE_METRIC_count(setup_process_wait_failed_other);
-
-DEFINE_METRIC_timing(setup_process_wait_ms);
-
-DEFINE_METRIC_count(setup_rollback_version);
-DEFINE_METRIC_count(setup_rollback_files);
-DEFINE_METRIC_count(setup_files_rollback_shell);
-
-DEFINE_METRIC_count(setup_uac_succeeded);
-
-DEFINE_METRIC_count(setup_user_app_admin);
-DEFINE_METRIC_count(setup_machine_app_non_admin);
-
-}  // namespace omaha
-
diff --git a/setup/setup_metrics.h b/setup/setup_metrics.h
deleted file mode 100644
index 33c92d1..0000000
--- a/setup/setup_metrics.h
+++ /dev/null
@@ -1,213 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Declares the usage metrics used by the setup module.
-
-#ifndef OMAHA_SETUP_SETUP_METRICS_H_
-#define OMAHA_SETUP_SETUP_METRICS_H_
-
-#include "omaha/statsreport/metrics.h"
-
-namespace omaha {
-
-// TODO(omaha3): These descriptions need to be updated to match Omaha 3.
-// They may also need to be moved to other files.
-
-// How many times the Install() function was called.
-DECLARE_METRIC_count(setup_install_total);
-// How many times the Install() function succeeded.
-DECLARE_METRIC_count(setup_install_succeeded);
-
-// How many times the UpdateSelfSilently() function was called.
-DECLARE_METRIC_count(setup_update_self_total);
-// How many times the UpdateSelfSilently() function succeeded.
-DECLARE_METRIC_count(setup_update_self_succeeded);
-
-// How many times the Install() resulted in a Google Update install attempt.
-DECLARE_METRIC_count(setup_do_self_install_total);
-// How many times the Install() succeeded in installing Google Update.
-DECLARE_METRIC_count(setup_do_self_install_succeeded);
-
-// Total time (ms) spent installing Google Update as measured by time between
-// when DoInstall() is called and Setup phase 2 completes. Excludes handoffs.
-DECLARE_METRIC_timing(setup_install_google_update_total_ms);
-
-// Time (ms) from Setup starts until the hand off process displays its UI.
-DECLARE_METRIC_timing(setup_handoff_ui_ms);
-
-//
-// ShouldInstall metrics
-//
-
-// Times ShouldInstall() was called.
-DECLARE_METRIC_count(setup_should_install_total);
-
-// Times ShouldInstall() returned false because of OneClick case.
-DECLARE_METRIC_count(setup_should_install_false_oc);
-
-// Times ShouldInstall() returned true because not already installed.
-DECLARE_METRIC_count(setup_should_install_true_fresh_install);
-
-// Times ShouldInstall() returned false because older version than installed.
-DECLARE_METRIC_count(setup_should_install_false_older);
-
-// Times ShouldInstall() returned true because newer version than installed.
-DECLARE_METRIC_count(setup_should_install_true_newer);
-
-// Times ShouldInstall() returned false because same version fully installed.
-DECLARE_METRIC_count(setup_should_install_false_same);
-// Times ShouldInstall() returned true because same version not fully installed.
-DECLARE_METRIC_count(setup_should_install_true_same);
-// Times ShouldOverinstallSameVersion() returned true because the successful
-// install completion indicator was not present.
-DECLARE_METRIC_count(setup_should_install_true_same_completion_missing);
-
-// Times ShouldInstall() was called during a metainstaller installation when
-// some Omaha version was already installed.
-DECLARE_METRIC_count(setup_subsequent_install_total);
-// Times ShouldInstall() returned true during a metainstaller installation when
-// some Omaha version was already installed.
-DECLARE_METRIC_count(setup_subsequent_install_should_install_true);
-
-//
-// Setup Files
-//
-
-// How many times Setup attempted to install the files.
-DECLARE_METRIC_count(setup_files_total);
-// How many times Setup successfully installed the files.
-DECLARE_METRIC_count(setup_files_verification_succeeded);
-// How many times file install failed due to file verification before copy.
-DECLARE_METRIC_count(setup_files_verification_failed_pre);
-// How many times file install failed due to file verification after copy.
-DECLARE_METRIC_count(setup_files_verification_failed_post);
-
-// Total time (ms) spent installing files.
-DECLARE_METRIC_timing(setup_files_ms);
-
-// How many times the shell was replaced.
-DECLARE_METRIC_count(setup_files_replace_shell);
-
-//
-// Setup Phase 2
-//
-
-// Total time (ms) spent in Setup phase 2.
-DECLARE_METRIC_timing(setup_phase2_ms);
-
-// How many times Setup attempted to install the service and scheduled task.
-DECLARE_METRIC_count(setup_install_service_task_total);
-// How many times Setup successfully installed the service.
-DECLARE_METRIC_count(setup_install_service_succeeded);
-// How many times Setup successfully installed the scheduled task.
-DECLARE_METRIC_count(setup_install_task_succeeded);
-// How many times Setup successfully installed both service and scheduled task.
-DECLARE_METRIC_count(setup_install_service_and_task_succeeded);
-// How many times Setup failed to install both the service and scheduled task.
-DECLARE_METRIC_count(setup_install_service_and_task_failed);
-// The error returned by InstallService().
-DECLARE_METRIC_integer(setup_install_service_error);
-// The error returned by InstallScheduledTask().
-DECLARE_METRIC_integer(setup_install_task_error);
-
-// Time (ms) it took to install the service.
-DECLARE_METRIC_timing(setup_install_service_ms);
-// Time (ms) waited for the service to install when it failed to install.
-DECLARE_METRIC_timing(setup_install_service_failed_ms);
-// Time (ms) it took to install the scheduled task.
-DECLARE_METRIC_timing(setup_install_task_ms);
-
-
-// How many times Setup attempted to start the service.
-DECLARE_METRIC_count(setup_start_service_total);
-// How many times Setup successfully started the service.
-DECLARE_METRIC_count(setup_start_service_succeeded);
-// The error returned by StartService().
-DECLARE_METRIC_integer(setup_start_service_error);
-
-// Time (ms) it took to start the service.
-DECLARE_METRIC_timing(setup_start_service_ms);
-// Time (ms) waited for the service to start when it failed to start.
-DECLARE_METRIC_timing(setup_start_service_failed_ms);
-
-// How many times Setup attempted to start the scheduled task.
-DECLARE_METRIC_count(setup_start_task_total);
-// How many times Setup successfully started the scheduled task.
-DECLARE_METRIC_count(setup_start_task_succeeded);
-// The error returned by StartScheduledTask().
-DECLARE_METRIC_integer(setup_start_task_error);
-
-// Time (ms) it took to start scheduled task.
-DECLARE_METRIC_timing(setup_start_task_ms);
-
-// How many times Setup attempted to install the helper MSI.
-DECLARE_METRIC_count(setup_helper_msi_install_total);
-// How many times Setup successfully installed the helper MSI.
-DECLARE_METRIC_count(setup_helper_msi_install_succeeded);
-
-// Time (ms) it took to install the helper MSI.
-DECLARE_METRIC_timing(setup_helper_msi_install_ms);
-
-//
-// Specific Setup Failures
-//
-
-// How many times Setup failed to get any of the Setup locks.
-DECLARE_METRIC_count(setup_locks_failed);
-// How many times Setup failed to get the 1.2 Setup Lock.
-DECLARE_METRIC_count(setup_lock12_failed);
-
-// Time (ms) it took to acquire all Setup locks.
-DECLARE_METRIC_timing(setup_lock_acquire_ms);
-
-
-// How many times Setup failed waiting for processes to stop - all modes.
-DECLARE_METRIC_count(setup_process_wait_failed);
-// How many times Setup failed waiting for processes to stop - specific modes.
-// The sum of these should equal setup_process_wait_failed.
-DECLARE_METRIC_count(setup_process_wait_failed_unknown);
-DECLARE_METRIC_count(setup_process_wait_failed_core);
-DECLARE_METRIC_count(setup_process_wait_failed_report);
-DECLARE_METRIC_count(setup_process_wait_failed_update);
-DECLARE_METRIC_count(setup_process_wait_failed_handoff);
-DECLARE_METRIC_count(setup_process_wait_failed_ua);
-DECLARE_METRIC_count(setup_process_wait_failed_cr);
-DECLARE_METRIC_count(setup_process_wait_failed_other);   // All other modes.
-
-// Time (ms) spent waiting for processes to exit - both successes and failures.
-DECLARE_METRIC_timing(setup_process_wait_ms);
-
-//
-// Other Setup Statistics
-//
-
-// How many times Setup rolled back the version.
-DECLARE_METRIC_count(setup_rollback_version);
-// How many times Setup rolled back file installation.
-DECLARE_METRIC_count(setup_rollback_files);
-// How many times Setup rolled back the shell.
-DECLARE_METRIC_count(setup_files_rollback_shell);
-
-// How many times Setup ran after elevating.
-DECLARE_METRIC_count(setup_uac_succeeded);
-
-// How many times Setup installed a user app as an elevated admin on >= Vista.
-DECLARE_METRIC_count(setup_user_app_admin);
-// How many times Setup attempted to install machine app as non-admin on <Vista.
-DECLARE_METRIC_count(setup_machine_app_non_admin);
-
-}  // namespace omaha
-
-#endif  // OMAHA_SETUP_SETUP_METRICS_H_
diff --git a/setup/setup_service.h b/setup/setup_service.h
deleted file mode 100644
index d44fc22..0000000
--- a/setup/setup_service.h
+++ /dev/null
@@ -1,540 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Sets up and controls the Google Update service.
-
-// TODO(omaha3): Consolidate all the service related code into one file in base
-// and one file in service.
-
-#ifndef OMAHA_SETUP_SETUP_SERVICE_H_
-#define OMAHA_SETUP_SETUP_SERVICE_H_
-
-#include <windows.h>
-#include "base/basictypes.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/path.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/service_utils.h"
-#include "omaha/base/system_info.h"
-#include "omaha/client/resource.h"
-#include "omaha/common/command_line_builder.h"
-#include "omaha/common/const_cmd_line.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/service/service_main.h"
-
-namespace omaha {
-
-const uint32 kMaxQueryConfigBufferBytes = 8 * 1024;
-
-template <typename T>
-class SetupService {
- public:
-  static HRESULT StartService() {
-    OPT_LOG(L1, (_T("[StartService]")));
-
-    scoped_service scm(::OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS));
-    if (!scm) {
-      return HRESULTFromLastError();
-    }
-
-    CString service_name(T::GetCurrentServiceName());
-    scoped_service service(::OpenService(get(scm),
-                                         service_name,
-                                         SERVICE_QUERY_STATUS | SERVICE_START));
-    if (!service) {
-      return HRESULTFromLastError();
-    }
-
-    SERVICE_STATUS status = {0};
-    if (::QueryServiceStatus(get(service), &status)) {
-      if (status.dwCurrentState == SERVICE_RUNNING ||
-          status.dwCurrentState == SERVICE_START_PENDING) {
-        SETUP_LOG(L1, (_T("[QueryServiceStatus][Service already running][%u]"),
-                       status.dwCurrentState));
-        return S_OK;
-      }
-    }
-
-    // Start the service.
-    if (::StartService(get(service), 0, NULL)) {
-      SETUP_LOG(L1, (_T("[StartService][started]")));
-      return S_OK;
-    }
-
-    HRESULT hr = HRESULTFromLastError();
-    ASSERT1(hr != HRESULT_FROM_WIN32(ERROR_SERVICE_ALREADY_RUNNING));
-    if (hr == HRESULT_FROM_WIN32(ERROR_SERVICE_ALREADY_RUNNING)) {
-      SETUP_LOG(L1, (_T("[StartService][ERROR_SERVICE_ALREADY_RUNNING]")));
-      return S_OK;
-    }
-
-    return hr;
-  }
-
-  static HRESULT StopService() {
-    SETUP_LOG(L1, (_T("[StopService]")));
-
-    CString service_name(T::GetCurrentServiceName());
-    return ServiceInstall::StopService(service_name);
-  }
-
-  static HRESULT InstallService(const TCHAR* file_path) {
-    ASSERT1(file_path);
-
-    // Append the arguments to be passed to the service entry point.
-
-    CString service_cmd_line(file_path);
-    CommandLineBuilder builder(T::commandline_mode());
-    SafeCStringAppendFormat(&service_cmd_line, _T(" %s"),
-                            builder.GetCommandLineArgs());
-
-    SETUP_LOG(L2, (_T("[service command line][%s]"), service_cmd_line));
-
-    HRESULT hr = DoInstallService(service_cmd_line);
-    if (FAILED(hr)) {
-      SETUP_LOG(LE, (_T("[DoInstallService failed][0x%08x]"), hr));
-      return hr;
-    }
-
-    VERIFY1(SUCCEEDED(SetDescription(GetServiceDescription())));
-    VERIFY1(SUCCEEDED(SetDelayedAutoStart()));
-
-    return InstallCOMService();
-  }
-
-  // Uninstalls the service by:
-  // 1. unregistering it
-  // 2. deleting it from SCM if needed.
-  static HRESULT UninstallService() {
-    SETUP_LOG(L3, (_T("[UninstallService][%s]"), T::GetCurrentServiceName()));
-
-    HRESULT hr = StopService();
-    if (FAILED(hr)) {
-      SETUP_LOG(LW, (_T("[StopService failed][0x%08x]"), hr));
-      ASSERT1(HRESULT_FROM_WIN32(ERROR_SERVICE_DOES_NOT_EXIST) == hr);
-    }
-
-    VERIFY1(SUCCEEDED(UninstallCOMService()));
-
-    hr = DeleteService();
-    if (FAILED(hr)) {
-      OPT_LOG(LEVEL_ERROR, (_T("[Can't delete the service][0x%08x]"), hr));
-      return hr;
-    }
-
-    return S_OK;
-  }
-
-  static bool IsServiceInstalled() {
-    return ServiceInstall::IsServiceInstalled(T::GetCurrentServiceName());
-  }
-
- private:
-  static HRESULT InstallCOMService() {
-    SETUP_LOG(L1, (_T("[InstallCOMService]")));
-
-    HRESULT hr = ServiceModule<T>().RegisterCOMService();
-
-    // We reset the _pAtlModule to allow for the case where multiple instances
-    // of ServiceModule are installed serially.
-    _pAtlModule = NULL;
-
-    return hr;
-  }
-
-  static HRESULT UninstallCOMService() {
-    SETUP_LOG(L1, (_T("[UninstallCOMService]")));
-
-    HRESULT hr = ServiceModule<T>().UnregisterCOMService();
-
-    // We reset the _pAtlModule to allow for the case where multiple instances
-    // of ServiceModule are uninstalled serially.
-    _pAtlModule = NULL;
-
-    return hr;
-  }
-
-  static HRESULT DoInstallService(const TCHAR* service_cmd_line) {
-    SETUP_LOG(L1, (_T("[DoInstallService][%s]"), service_cmd_line));
-
-    ASSERT1(service_cmd_line);
-
-    if (IsServiceInstalled()) {
-      // Lightweight upgrade of existing service.
-      HRESULT hr = UpgradeService(service_cmd_line);
-      ASSERT(SUCCEEDED(hr), (_T("[UpgradeService failed][0x%x]"), hr));
-      if (SUCCEEDED(hr)) {
-        return hr;
-      }
-
-      // Delete the previous version of the service. Then create a new service
-      // name, and fall through to install that.
-      VERIFY1(SUCCEEDED(DeleteService()));
-      VERIFY1(SUCCEEDED(CreateAndSetVersionedServiceNameInRegistry()));
-      ASSERT1(!IsServiceInstalled());
-    }
-
-    return DoInstallNewService(service_cmd_line);
-  }
-
-  static HRESULT DoInstallNewService(const TCHAR* service_cmd_line) {
-    ASSERT1(service_cmd_line);
-
-    scoped_service scm(::OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS));
-    if (!scm) {
-      const DWORD error = ::GetLastError();
-      SETUP_LOG(LE, (_T("[Failed to open SC Manager][%u]"), error));
-      return HRESULT_FROM_WIN32(error);
-    }
-
-    CString service_name(T::GetCurrentServiceName());
-    CString service_display_name(GetCurrentServiceDisplayName());
-    scoped_service service(::CreateService(get(scm),
-                                           service_name,
-                                           service_display_name,
-                                           SERVICE_ALL_ACCESS,
-                                           SERVICE_WIN32_OWN_PROCESS,
-                                           T::service_start_type(),
-                                           SERVICE_ERROR_NORMAL,
-                                           service_cmd_line,
-                                           NULL,
-                                           NULL,
-                                           _T("RPCSS\0"),
-                                           NULL,
-                                           NULL));
-    if (!service) {
-      const DWORD error = ::GetLastError();
-      SETUP_LOG(LE, (_T("[CreateService failed][%u]"), error));
-      return HRESULT_FROM_WIN32(error);
-    }
-    SETUP_LOG(L1, (_T("[DoInstallNewService][service installed]")));
-    return S_OK;
-  }
-
-  static bool IsServiceCorrectlyConfigured(const TCHAR* service_cmd_line) {
-    scoped_service scm(::OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT));
-    if (!scm) {
-      HRESULT hr = HRESULTFromLastError();
-      SETUP_LOG(LE, (_T("[Failed to open SC Manager][0x%x]"), hr));
-      return false;
-    }
-
-    CString service_name(T::GetCurrentServiceName());
-    scoped_service service(::OpenService(get(scm),
-                                         service_name,
-                                         SERVICE_QUERY_CONFIG));
-    if (!service) {
-      HRESULT hr = HRESULTFromLastError();
-      SETUP_LOG(LE, (_T("[OpenService SERVICE_QUERY_CONFIG fail][0x%x]"), hr));
-      return false;
-    }
-
-    // ::QueryServiceConfig expects a buffer of at most 8K bytes, according to
-    // documentation. While the size of the buffer can be dynamically computed,
-    // we just assume the maximum size for simplicity.
-    uint8 buffer[kMaxQueryConfigBufferBytes] = { 0 };
-    DWORD bytes_needed_ignored = 0;
-    QUERY_SERVICE_CONFIG* service_config =
-      reinterpret_cast<QUERY_SERVICE_CONFIG*>(buffer);
-    if (!::QueryServiceConfig(get(service),
-                              service_config,
-                              sizeof(buffer),
-                              &bytes_needed_ignored)) {
-      HRESULT hr = HRESULTFromLastError();
-      SETUP_LOG(LE, (_T("[QueryServiceConfig failed][0x%x]"), hr));
-      return false;
-    }
-
-    bool does_service_cmd_line_match = false;
-    if (service_config->lpBinaryPathName == NULL || service_cmd_line == NULL) {
-      does_service_cmd_line_match =
-          (service_config->lpBinaryPathName == service_cmd_line);
-    } else {
-      does_service_cmd_line_match =
-          !_tcsicmp(service_config->lpBinaryPathName, service_cmd_line);
-    }
-    return service_config->dwServiceType == SERVICE_WIN32_OWN_PROCESS &&
-           service_config->dwStartType == T::service_start_type() &&
-           service_config->dwErrorControl == SERVICE_ERROR_NORMAL &&
-           does_service_cmd_line_match;
-  }
-
-  static HRESULT UpgradeService(const TCHAR* service_cmd_line) {
-    ASSERT1(service_cmd_line);
-    ASSERT1(IsServiceInstalled());
-
-    if (IsServiceCorrectlyConfigured(service_cmd_line)) {
-      return S_OK;
-    }
-
-    // Modify the configuration of the existing service.
-    HRESULT hr(StopService());
-    if (FAILED(hr)) {
-      SETUP_LOG(LE, (_T("[Can't stop the service][0x%08x]"), hr));
-      return hr;
-    }
-
-    scoped_service scm(::OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS));
-    if (!scm) {
-      const DWORD error = ::GetLastError();
-      SETUP_LOG(LE, (_T("[Failed to open SC Manager][%u]"), error));
-      return HRESULT_FROM_WIN32(error);
-    }
-
-    CString service_name(T::GetCurrentServiceName());
-    scoped_service service(::OpenService(get(scm),
-                                         service_name,
-                                         SERVICE_CHANGE_CONFIG));
-    if (!service) {
-      const DWORD error = ::GetLastError();
-      SETUP_LOG(LE, (_T("[Failed to open service for update][%u]"), error));
-      return HRESULT_FROM_WIN32(error);
-    }
-
-    if (!::ChangeServiceConfig(get(service),
-                               SERVICE_WIN32_OWN_PROCESS,
-                               T::service_start_type(),
-                               SERVICE_ERROR_NORMAL,
-                               service_cmd_line,
-                               NULL,
-                               NULL,
-                               NULL,
-                               NULL,
-                               NULL,
-                               NULL)) {
-      const DWORD error = ::GetLastError();
-      SETUP_LOG(LE, (_T("[Failed to change service config][%u]"), error));
-      return HRESULT_FROM_WIN32(error);
-    }
-
-    SETUP_LOG(L3, (_T("[ChangeServiceConfig succeeded]")));
-    return S_OK;
-  }
-
-  static bool IsDelayedAutoStart() {
-    scoped_service scm(::OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT));
-    if (!scm) {
-      HRESULT hr = HRESULTFromLastError();
-      SETUP_LOG(LE, (_T("[SC_MANAGER_CONNECT failed][0x%x]"), hr));
-      return false;
-    }
-
-    CString name(T::GetCurrentServiceName());
-    scoped_service service(::OpenService(get(scm), name, SERVICE_QUERY_CONFIG));
-    if (!service) {
-      HRESULT hr = HRESULTFromLastError();
-      SETUP_LOG(LE, (_T("[SERVICE_QUERY_CONFIG failed][%s][0x%x]"), name, hr));
-      return false;
-    }
-
-    uint8 buffer[kMaxQueryConfigBufferBytes] = { 0 };
-    DWORD bytes_needed_ignored = 0;
-    SERVICE_DELAYED_AUTO_START_INFO* service_config =
-      reinterpret_cast<SERVICE_DELAYED_AUTO_START_INFO*>(buffer);
-    if (!::QueryServiceConfig2(get(service),
-                               SERVICE_CONFIG_DELAYED_AUTO_START_INFO,
-                               buffer,
-                               sizeof(buffer),
-                               &bytes_needed_ignored)) {
-      HRESULT hr = HRESULTFromLastError();
-      SETUP_LOG(LE, (_T("[Query SERVICE_CONFIG_DELAYED_AUTO_START_INFO failed]")
-                     _T("[0x%x]"), hr));
-      return false;
-    }
-
-    return !!service_config->fDelayedAutostart;
-  }
-
-  static HRESULT SetDelayedAutoStart() {
-    if (!SystemInfo::IsRunningOnVistaOrLater()) {
-      return S_OK;
-    }
-
-    ASSERT1(IsServiceInstalled());
-
-    if (IsDelayedAutoStart()) {
-      return S_OK;
-    }
-
-    scoped_service scm(::OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS));
-    if (!scm) {
-      HRESULT hr = HRESULTFromLastError();
-      SETUP_LOG(LE, (_T("[OpenSCManager failed][0x%x]"), hr));
-      return hr;
-    }
-
-    CString service_name(T::GetCurrentServiceName());
-    scoped_service service(::OpenService(get(scm),
-                                         service_name,
-                                         SERVICE_CHANGE_CONFIG));
-    if (!service) {
-      HRESULT hr = HRESULTFromLastError();
-      SETUP_LOG(LE, (_T("[OpenService failed][0x%x]"), hr));
-      return hr;
-    }
-
-    SERVICE_DELAYED_AUTO_START_INFO auto_start_info = {TRUE};
-    if (!::ChangeServiceConfig2(get(service),
-                                SERVICE_CONFIG_DELAYED_AUTO_START_INFO,
-                                &auto_start_info)) {
-      HRESULT hr = HRESULTFromLastError();
-      SETUP_LOG(LE, (_T("[ChangeServiceConfig2 failed][0x%x]"), hr));
-      return hr;
-    }
-
-    SETUP_LOG(L3, (_T("[SetDelayedAutoStart succeeded]")));
-    return S_OK;
-  }
-
-  static HRESULT DeleteService() {
-    SETUP_LOG(L3, (_T("[DeleteService][%s]"), T::GetCurrentServiceName()));
-
-    scoped_service scm(::OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS));
-    if (!scm) {
-      return HRESULTFromLastError();
-    }
-    scoped_service service(::OpenService(get(scm),
-                                         T::GetCurrentServiceName(),
-                                         SERVICE_CHANGE_CONFIG | DELETE));
-    if (!service) {
-      return HRESULTFromLastError();
-    }
-
-    if (!::DeleteService(get(service))) {
-      HRESULT hr = HRESULTFromLastError();
-      SETUP_LOG(LW, (_T("[DeleteService failed][0x%x]"), hr));
-      if (hr != HRESULT_FROM_WIN32(ERROR_SERVICE_MARKED_FOR_DELETE)) {
-        return hr;
-      }
-    }
-
-    return S_OK;
-  }
-
-  static bool DoesDescriptionMatch(const TCHAR* description) {
-    ASSERT1(description);
-
-    scoped_service scm(::OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT));
-    if (!scm) {
-      HRESULT hr = HRESULTFromLastError();
-      SETUP_LOG(LE, (_T("[SC_MANAGER_CONNECT failed][0x%x]"), hr));
-      return false;
-    }
-
-    CString name(T::GetCurrentServiceName());
-    scoped_service service(::OpenService(get(scm), name, SERVICE_QUERY_CONFIG));
-    if (!service) {
-      HRESULT hr = HRESULTFromLastError();
-      SETUP_LOG(LE, (_T("[SERVICE_QUERY_CONFIG failed][%s][0x%x]"), name, hr));
-      return false;
-    }
-
-    uint8 buffer[kMaxQueryConfigBufferBytes] = { 0 };
-    DWORD bytes_needed_ignored = 0;
-    SERVICE_DESCRIPTION* service_config =
-      reinterpret_cast<SERVICE_DESCRIPTION*>(buffer);
-    if (!::QueryServiceConfig2(get(service),
-                               SERVICE_CONFIG_DESCRIPTION,
-                               buffer,
-                               sizeof(buffer),
-                               &bytes_needed_ignored)) {
-      HRESULT hr = HRESULTFromLastError();
-      SETUP_LOG(LE, (_T("[QuerySERVICE_CONFIG_DESCRIPTION failed][0x%x]"), hr));
-      return false;
-    }
-
-    if (service_config->lpDescription == NULL || description == NULL) {
-      return (service_config->lpDescription == description);
-    }
-
-    return !_tcsicmp(service_config->lpDescription, description);
-  }
-
-  static HRESULT SetDescription(const TCHAR* description) {
-    ASSERT1(description);
-
-    if (DoesDescriptionMatch(description)) {
-      return S_OK;
-    }
-
-    scoped_service scm(::OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS));
-    if (!scm) {
-      return HRESULTFromLastError();
-    }
-
-    CString name(T::GetCurrentServiceName());
-
-    // Opening the service with less rights fails the ChangeServiceConfig2 call
-    // with E_ACCESSDENIED.
-    scoped_service service(::OpenService(get(scm), name, SERVICE_ALL_ACCESS));
-    if (!service) {
-      return HRESULTFromLastError();
-    }
-    SERVICE_DESCRIPTION info = { const_cast<TCHAR*>(description) };
-    if (!::ChangeServiceConfig2(get(service),
-                                SERVICE_CONFIG_DESCRIPTION,
-                                &info)) {
-      return HRESULTFromLastError();
-    }
-    SETUP_LOG(L3, (_T("[service description changed successfully]")));
-    return S_OK;
-  }
-
-  static CString GetCurrentServiceDisplayName() {
-    CORE_LOG(L3, (_T("[GetCurrentServiceDisplayName]")));
-
-    CString product_name;
-    VERIFY1(product_name.LoadString(IDS_PRODUCT_DISPLAY_NAME));
-
-    CString display_name;
-    display_name.FormatMessage(IDS_SERVICE_DISPLAY_NAME, product_name);
-    display_name.AppendFormat(_T(" (%s)"), T::GetCurrentServiceName());
-    return display_name;
-  }
-
-  static CString GetServiceDescription() {
-    // TODO(omaha3): Do we need a different service description for the medium
-    // service?
-
-    CString company_name;
-    VERIFY1(company_name.LoadString(IDS_FRIENDLY_COMPANY_NAME));
-
-    CString service_description;
-    service_description.FormatMessage(IDS_SERVICE_DESCRIPTION, company_name);
-    return service_description;
-  }
-
-  static HRESULT CreateAndSetVersionedServiceNameInRegistry() {
-    CORE_LOG(L3, (_T("CreateAndSetVersionedServiceNameInRegistry")));
-    return goopdate_utils::CreateAndSetVersionedNameInRegistry(true,
-        T::default_name(), T::reg_name());
-  }
-
-  friend class SetupServiceTest;
-  friend class CoreUtilsTest;
-
-  DISALLOW_IMPLICIT_CONSTRUCTORS(SetupService);
-};
-
-typedef SetupService<Update3ServiceMode> SetupUpdate3Service;
-typedef SetupService<UpdateMediumServiceMode> SetupUpdateMediumService;
-
-}  // namespace omaha
-
-#endif  // OMAHA_SETUP_SETUP_SERVICE_H_
diff --git a/setup/setup_service_unittest.cc b/setup/setup_service_unittest.cc
deleted file mode 100644
index 4aa0dbc..0000000
--- a/setup/setup_service_unittest.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/app_util.h"
-#include "omaha/base/path.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/setup/setup_service.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-class SetupServiceTest : public testing::Test {
- protected:
-  static void SetUpTestCase() {
-    // The ServiceModule has it's own ATL module. ATL does not like having
-    // multiple ATL modules. This TestCase saves and restore the original ATL
-    // module to get around ATL's limitation. This is a hack.
-    original_atl_module_ = _pAtlModule;
-    _pAtlModule = NULL;
-  }
-
-  static void TearDownTestCase() {
-    _pAtlModule = original_atl_module_;
-  }
-
-  static HRESULT DeleteUpdate3Service() {
-    return SetupUpdate3Service::DeleteService();
-  }
-
-  static HRESULT DeleteMediumService() {
-    return SetupUpdateMediumService::DeleteService();
-  }
-
-  static CAtlModule* original_atl_module_;
-};
-
-CAtlModule* SetupServiceTest::original_atl_module_ = NULL;
-
-// TODO(omaha): Test SetupServiceTest
-
-TEST_F(SetupServiceTest, InstallService_FileDoesNotExist) {
-  if (!vista_util::IsUserAdmin()) {
-    std::wcout << _T("\tTest did not run because the user is not an admin.")
-               << std::endl;
-    return;
-  }
-
-  DeleteUpdate3Service();
-  DeleteMediumService();
-
-  CString service_path = ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                                         _T("NoSuchFile.exe"));
-
-  // The Windows service registration APIs do not rely on the file existing.
-  EXPECT_SUCCEEDED(
-      SetupUpdate3Service::InstallService(service_path));
-
-  EXPECT_SUCCEEDED(
-      SetupUpdateMediumService::InstallService(service_path));
-
-  EXPECT_SUCCEEDED(DeleteUpdate3Service());
-  EXPECT_SUCCEEDED(DeleteMediumService());
-}
-
-}  // namespace omaha
diff --git a/setup/setup_unittest.cc b/setup/setup_unittest.cc
deleted file mode 100644
index 412ae78..0000000
--- a/setup/setup_unittest.cc
+++ /dev/null
@@ -1,1246 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include <vector>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/error.h"
-#include "omaha/base/file.h"
-#include "omaha/base/path.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/process.h"
-#include "omaha/base/scope_guard.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/system.h"
-#include "omaha/base/thread.h"
-#include "omaha/base/user_info.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/command_line.h"
-#include "omaha/common/config_manager.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/setup/setup.h"
-#include "omaha/setup/setup_files.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-const int kProcessesCleanupWait = 30000;
-
-const TCHAR* const kFutureVersionString = _T("9.8.7.6");
-
-const TCHAR* const kAppMachineClientsPath =
-    _T("HKLM\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\Clients\\{50DA5C89-FF97-4536-BF3F-DF54C2F02EA8}\\");
-const TCHAR* const kAppMachineClientStatePath =
-    _T("HKLM\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientState\\{50DA5C89-FF97-4536-BF3F-DF54C2F02EA8}\\");
-const TCHAR* const kApp2MachineClientsPath =
-    _T("HKLM\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\Clients\\{CB8E8A3C-7295-4529-B083-D5F76DCD4CC2}\\");
-
-const TCHAR* const kAppUserClientsPath =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\Clients\\{50DA5C89-FF97-4536-BF3F-DF54C2F02EA8}\\");
-const TCHAR* const kAppUserClientStatePath =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\ClientState\\{50DA5C89-FF97-4536-BF3F-DF54C2F02EA8}\\");
-const TCHAR* const kApp2UserClientsPath =
-    _T("HKCU\\Software\\") SHORT_COMPANY_NAME _T("\\") PRODUCT_NAME
-    _T("\\Clients\\{CB8E8A3C-7295-4529-B083-D5F76DCD4CC2}\\");
-
-
-class HoldLock : public Runnable {
- public:
-  explicit HoldLock(bool is_machine)
-      : is_machine_(is_machine) {
-    reset(lock_acquired_event_, ::CreateEvent(NULL, false, false, NULL));
-    reset(stop_event_, ::CreateEvent(NULL, false, false, NULL));
-  }
-
-  virtual void Run() {
-    GLock setup_lock;
-    NamedObjectAttributes setup_lock_attr;
-    GetNamedObjectAttributes(omaha::kSetupMutex, is_machine_, &setup_lock_attr);
-    EXPECT_TRUE(setup_lock.InitializeWithSecAttr(setup_lock_attr.name,
-                                                 &setup_lock_attr.sa));
-    __mutexScope(setup_lock);
-
-    EXPECT_TRUE(::SetEvent(get(lock_acquired_event_)));
-
-    EXPECT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(get(stop_event_), INFINITE));
-  }
-
-  void Stop() {
-    EXPECT_TRUE(::SetEvent(get(stop_event_)));
-  }
-
-  void WaitForLockToBeAcquired() {
-    EXPECT_EQ(WAIT_OBJECT_0,
-              ::WaitForSingleObject(get(lock_acquired_event_), 2000));
-  }
-
- private:
-  const bool is_machine_;
-  scoped_event lock_acquired_event_;
-  scoped_event stop_event_;
-
-  DISALLOW_IMPLICIT_CONSTRUCTORS(HoldLock);
-};
-
-}  // namespace
-
-void CopyGoopdateFiles(const CString& omaha_path, const CString& version);
-
-class SetupTest : public testing::Test {
- protected:
-
-  typedef std::vector<uint32> Pids;
-
-  // Returns the path to the long-running GoogleUpdate.exe.
-  static CString CopyGoopdateAndLongRunningFiles(const CString& omaha_path,
-                                                 const CString& version) {
-    CopyGoopdateFiles(omaha_path, version);
-
-    CString long_running_target_path = ConcatenatePath(omaha_path,
-                                                       _T("does_not_shutdown"));
-    EXPECT_SUCCEEDED(CreateDir(long_running_target_path, NULL));
-    long_running_target_path = ConcatenatePath(long_running_target_path,
-                                               kOmahaShellFileName);
-    EXPECT_SUCCEEDED(File::Copy(
-        ConcatenatePath(ConcatenatePath(
-                            app_util::GetCurrentModuleDirectory(),
-                            _T("unittest_support\\does_not_shutdown")),
-                        kOmahaShellFileName),
-        long_running_target_path,
-        false));
-
-    return long_running_target_path;
-  }
-
-  static void SetUpTestCase() {
-    not_listening_machine_exe_path_ =
-        CopyGoopdateAndLongRunningFiles(GetGoogleUpdateMachinePath(),
-                                        GetVersionString());
-    not_listening_user_exe_path_ =
-        CopyGoopdateAndLongRunningFiles(GetGoogleUpdateUserPath(),
-                                        GetVersionString());
-  }
-
-  explicit SetupTest(bool is_machine)
-      : is_machine_(is_machine),
-        omaha_path_(is_machine ? GetGoogleUpdateMachinePath() :
-                                 GetGoogleUpdateUserPath()),
-        not_listening_exe_path_(is_machine ? not_listening_machine_exe_path_ :
-                                             not_listening_user_exe_path_),
-        not_listening_exe_opposite_path_(!is_machine ?
-                                         not_listening_machine_exe_path_ :
-                                         not_listening_user_exe_path_) {
-    omaha_exe_path_ = ConcatenatePath(omaha_path_, _T("GoogleUpdate.exe"));
-  }
-
-  virtual void SetUp() {
-    ASSERT_SUCCEEDED(CreateDir(omaha_path_, NULL));
-    setup_.reset(new omaha::Setup(is_machine_));
-  }
-
-  bool ShouldInstall() {
-    SetupFiles setup_files(is_machine_);
-    setup_files.Init();
-    return setup_->ShouldInstall(&setup_files);
-  }
-
-  HRESULT StopGoogleUpdateAndWait() {
-    return setup_->StopGoogleUpdateAndWait();
-  }
-
-  HRESULT TerminateCoreProcesses() const {
-    return setup_->TerminateCoreProcesses();
-  }
-
-  // Acquires the Setup Lock in another thread then calls TestInstall().
-  void TestInstallWhileHoldingLock() {
-    HoldLock hold_lock(is_machine_);
-
-    Thread thread;
-    thread.Start(&hold_lock);
-    hold_lock.WaitForLockToBeAcquired();
-
-    EXPECT_EQ(GOOPDATE_E_FAILED_TO_GET_LOCK, setup_->Install(false));
-
-    hold_lock.Stop();
-    thread.WaitTillExit(1000);
-  }
-
-  void StopGoogleUpdateAndWaitSucceedsTestHelper(bool use_job_objects_only) {
-    if (is_machine_ && !vista_util::IsUserAdmin()) {
-      std::wcout << _T("\tTest did not run because the user is not an admin.")
-                 << std::endl;
-      return;
-    }
-
-    if (!ShouldRunLargeTest()) {
-      return;
-    }
-    if (IsBuildSystem()) {
-      std::wcout << _T("\tTest not run because it is flaky on build system.")
-                 << std::endl;
-      return;
-    }
-
-    scoped_process core_process;
-    scoped_process install_process;
-    scoped_process opposite_process;
-    scoped_process user_handoff_process;
-    scoped_process user_install_goopdate_process;
-    scoped_process user_install_slashinstall_process;
-    scoped_process setup_phase1_job_process;
-    scoped_process setup_phase1_job_opposite_process;
-    scoped_process install_job_opposite_process;
-    scoped_process silent_job_opposite_process;
-    scoped_process silent_do_not_kill_job_opposite_process;
-    scoped_job setup_phase1_job;
-    scoped_job setup_phase1_job_opposite;
-    scoped_job install_job_opposite;
-    scoped_job silent_job_opposite;
-    scoped_job silent_do_not_kill_job_opposite;
-
-    StartCoreProcessesToShutdown(address(core_process));
-    ASSERT_TRUE(core_process);
-
-    if (use_job_objects_only && is_machine_) {
-      // When starting the core process with psexec, there is a race condition
-      // between that process initializing (and joining a Job Object) and
-      // StopGoogleUpdateAndWait() looking for processes. If the latter wins,
-      // the core process is not found and StopGoogleUpdateAndWait() does not
-      // wait for the core process. As a result,
-      // ::WaitForSingleObject(get(core_process), 0)) would fail intermittently.
-      // Sleep here to allow the process to start and join the job.
-      // Note that this race condition is similar to ones we might encounter
-      // in the field when using Job Objects.
-      ::Sleep(500);
-    }
-
-    // /install is always ignored.
-    LaunchProcess(not_listening_exe_path_,
-                  _T("/install"),
-                  is_machine_,
-                  address(install_process));
-    ASSERT_TRUE(install_process);
-    EXPECT_EQ(WAIT_TIMEOUT, ::WaitForSingleObject(get(install_process), 0));
-
-    if (vista_util::IsUserAdmin()) {
-      // GoogleUpdate running from the opposite directory should always be
-      // ignored. Using a command line that would not be ignored if it were not
-      // an opposite.
-      LaunchProcess(not_listening_exe_opposite_path_,
-                    _T(""),
-                    false,
-                    address(opposite_process));
-      EXPECT_TRUE(opposite_process);
-      EXPECT_EQ(WAIT_TIMEOUT, ::WaitForSingleObject(get(opposite_process), 0));
-    } else {
-      EXPECT_FALSE(is_machine_)
-          << _T("Unexpected call for machine when non-admin.");
-      // We can't launch a system process when non-admin.
-      std::wcout << _T("\tPart of this test did not run because the user is ")
-                    _T("not an admin.") << std::endl;
-    }
-
-    CString same_needsadmin = is_machine_ ? _T("\"needsadmin=True\"") :
-                                            _T("\"needsadmin=False\"");
-    // Machine setup looks for users running most modes from the machine
-    // official directory, and user setup looks for users running most modes
-    // from the user official directory.
-    // Launching with needsadmin=<same> tests that machine still ignores
-    // needsadmin=True and user ignores needsadmin=False when the opposite
-    // instances are running.
-    LaunchProcess(not_listening_exe_opposite_path_,
-                  _T("/handoff ") + same_needsadmin,
-                  false,  // As the user.
-                  address(user_handoff_process));
-    EXPECT_TRUE(user_handoff_process);
-    EXPECT_EQ(WAIT_TIMEOUT,
-              ::WaitForSingleObject(get(user_handoff_process), 0));
-
-    // This process should be ignored even though it is running from the correct
-    // official directory.
-    LaunchProcess(not_listening_exe_path_,
-                  _T("/install ") + same_needsadmin,
-                  false,  // As the user.
-                  address(user_install_slashinstall_process));
-    EXPECT_TRUE(user_install_goopdate_process);
-    EXPECT_EQ(WAIT_TIMEOUT,
-              ::WaitForSingleObject(get(user_install_goopdate_process), 0));
-
-    if (use_job_objects_only) {
-      // This Job Object is ignored.
-      // Only start this process when only using Job Objects because the
-      // argument-less process would be caught by the command line search.
-      LaunchJobProcess(is_machine_,
-                       is_machine_,
-                       kSetupPhase1NonSelfUpdateJobObject,
-                       address(setup_phase1_job_process),
-                       address(setup_phase1_job));
-      ASSERT_TRUE(setup_phase1_job_process);
-      EXPECT_EQ(WAIT_TIMEOUT,
-                ::WaitForSingleObject(get(setup_phase1_job_process), 0));
-    }
-
-    if (is_machine_ || vista_util::IsUserAdmin()) {
-      // These processes should be ignored because they are for the opposite
-      // set of processes.
-
-      LaunchJobProcess(!is_machine_,
-                       !is_machine_,
-                       kSetupPhase1NonSelfUpdateJobObject,
-                       address(setup_phase1_job_opposite_process),
-                       address(setup_phase1_job_opposite));
-      ASSERT_TRUE(setup_phase1_job_opposite_process);
-      EXPECT_EQ(WAIT_TIMEOUT,
-                ::WaitForSingleObject(get(setup_phase1_job_opposite_process),
-                                      0));
-
-      LaunchJobProcess(!is_machine_,
-                       !is_machine_,
-                       kAppInstallJobObject,
-                       address(install_job_opposite_process),
-                       address(install_job_opposite));
-      ASSERT_TRUE(install_job_opposite_process);
-      EXPECT_EQ(WAIT_TIMEOUT,
-                ::WaitForSingleObject(get(install_job_opposite_process), 0));
-
-      LaunchJobProcess(!is_machine_,
-                       !is_machine_,
-                       kSilentJobObject,
-                       address(silent_job_opposite_process),
-                       address(silent_job_opposite));
-      ASSERT_TRUE(install_job_opposite_process);
-      EXPECT_EQ(WAIT_TIMEOUT,
-                ::WaitForSingleObject(get(install_job_opposite_process), 0));
-
-      LaunchJobProcess(!is_machine_,
-                       !is_machine_,
-                       kSilentDoNotKillJobObject,
-                       address(silent_do_not_kill_job_opposite_process),
-                       address(silent_do_not_kill_job_opposite));
-      ASSERT_TRUE(install_job_opposite_process);
-      EXPECT_EQ(WAIT_TIMEOUT,
-                ::WaitForSingleObject(get(install_job_opposite_process), 0));
-    }
-
-    EXPECT_SUCCEEDED(StopGoogleUpdateAndWait());
-    EXPECT_EQ(0, setup_->extra_code1());
-
-    // Verify the real core process exited and terminate the processes that are
-    // not listening to shutdown.
-    EXPECT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(get(core_process), 0));
-
-    // Terminate all the processes and wait for them to exit to avoid
-    // interfering with other tests.
-    std::vector<HANDLE> started_processes;
-    started_processes.push_back(get(install_process));
-    if (vista_util::IsUserAdmin()) {
-      started_processes.push_back(get(opposite_process));
-    }
-    started_processes.push_back(get(user_handoff_process));
-    started_processes.push_back(get(user_install_goopdate_process));
-    started_processes.push_back(get(user_install_slashinstall_process));
-    if (use_job_objects_only) {
-      started_processes.push_back(get(setup_phase1_job_process));
-    }
-    if (is_machine_ || vista_util::IsUserAdmin()) {
-      started_processes.push_back(get(setup_phase1_job_opposite_process));
-      started_processes.push_back(get(install_job_opposite_process));
-      started_processes.push_back(get(silent_job_opposite_process));
-      started_processes.push_back(get(silent_do_not_kill_job_opposite_process));
-    }
-
-    for (size_t i = 0; i < started_processes.size(); ++i) {
-      SETUP_LOG(L1, (_T("Terminating PID %u]"),
-                     ::GetProcessId(started_processes[i])));
-      EXPECT_TRUE(::TerminateProcess(started_processes[i], 1));
-    }
-    EXPECT_EQ(WAIT_OBJECT_0, ::WaitForMultipleObjects(started_processes.size(),
-                                                      &started_processes[0],
-                                                      true,  // wait for all
-                                                      kProcessesCleanupWait));
-  }
-
-  void StopGoogleUpdateAndWaitSucceedsTest() {
-    StopGoogleUpdateAndWaitSucceedsTestHelper(false);
-  }
-
-  HRESULT GetRunningCoreProcesses(Pids* core_processes) {
-    ASSERT1(core_processes);
-
-    CString user_sid_to_use;
-    if (is_machine_) {
-      user_sid_to_use = kLocalSystemSid;
-    } else {
-      EXPECT_SUCCEEDED(user_info::GetProcessUser(NULL, NULL, &user_sid_to_use));
-    }
-
-    DWORD flags = INCLUDE_ONLY_PROCESS_OWNED_BY_USER |
-                  EXCLUDE_CURRENT_PROCESS |
-                  INCLUDE_PROCESS_COMMAND_LINE_CONTAINING_STRING;
-
-    std::vector<CString> command_lines;
-    command_lines.push_back(_T("/c"));
-
-    return Process::FindProcesses(flags,
-                                  kOmahaShellFileName,
-                                  true,
-                                  user_sid_to_use,
-                                  command_lines,
-                                  core_processes);
-  }
-
-  void KillRunningCoreProcesses() {
-    Pids core_processes;
-    EXPECT_SUCCEEDED(GetRunningCoreProcesses(&core_processes));
-
-    for (size_t i = 0; i < core_processes.size(); ++i) {
-      scoped_process process(::OpenProcess(PROCESS_TERMINATE,
-                                           FALSE,
-                                           core_processes[i]));
-      EXPECT_TRUE(process);
-      EXPECT_TRUE(::TerminateProcess(get(process), static_cast<uint32>(-2)));
-    }
-  }
-
-  // Uses psexec to start processes as SYSTEM if necessary.
-  // Assumes that psexec blocks until the process exits.
-  // TODO(omaha): Start the opposite instances and wait for them in
-  // StopGoogleUpdateAndWaitSucceedsTest. They should not close.
-  void StartCoreProcessesToShutdown(HANDLE* core_process) {
-    ASSERT_TRUE(core_process);
-
-    // Find the core process or start one if necessary.
-    Pids core_processes;
-    EXPECT_SUCCEEDED(GetRunningCoreProcesses(&core_processes));
-    ASSERT_LE(core_processes.size(), static_cast<size_t>(1))
-        << _T("Only one core should be running.");
-
-    if (core_processes.empty()) {
-      LaunchProcess(omaha_exe_path_,
-                    _T("/c"),
-                    is_machine_,
-                    core_process);
-    } else {
-      *core_process = ::OpenProcess(SYNCHRONIZE | PROCESS_TERMINATE,
-                                    FALSE,
-                                    core_processes[0]);
-    }
-    ASSERT_TRUE(*core_process);
-
-    HANDLE processes[] = {*core_process};
-    EXPECT_EQ(WAIT_TIMEOUT, ::WaitForMultipleObjects(arraysize(processes),
-                                                     processes,
-                                                     true,  // wait for all
-                                                     0));
-  }
-
-  // Launches an instance of GoogleUpdate.exe that doesn't exit.
-  void StopGoogleUpdateAndWaitProcessesDoNotStopTest() {
-    LaunchProcessAndExpectStopGoogleUpdateAndWaitKillsProcess(
-        is_machine_,
-        _T(""));
-  }
-
-  void LaunchProcessAndExpectStopGoogleUpdateAndWaitKillsProcess(
-      bool is_machine_process,
-      const CString& args) {
-    ASSERT_TRUE(args);
-
-    if (is_machine_ && !vista_util::IsUserAdmin()) {
-      std::wcout << _T("\tTest did not run because the user is not an admin.")
-                 << std::endl;
-      return;
-    }
-
-    if (!ShouldRunLargeTest()) {
-      return;
-    }
-    scoped_process process;
-    LaunchProcess(not_listening_exe_path_,
-                  args,
-                  is_machine_process,
-                  address(process));
-    ASSERT_TRUE(process);
-    EXPECT_EQ(WAIT_TIMEOUT, ::WaitForSingleObject(get(process), 0));
-
-    // Tests that use this method intermittently fail when run on build systems.
-    // This code attempts to ensure that the process is further along in the
-    // initialization process by waiting until Process::GetCommandLine succeeds.
-    HRESULT hr = E_FAIL;
-    CString process_cmd;
-    for (int tries = 0; tries < 100 && FAILED(hr); ++tries) {
-      hr = Process::GetCommandLine(::GetProcessId(get(process)), &process_cmd);
-      if (FAILED(hr)) {
-        ::Sleep(50);
-      }
-    }
-    EXPECT_SUCCEEDED(hr);
-
-    EXPECT_EQ(S_OK, StopGoogleUpdateAndWait());
-    // Make sure the process has been killed.
-    EXPECT_EQ(WAIT_OBJECT_0,
-              ::WaitForSingleObject(get(process), kProcessesCleanupWait));
-  }
-
-  // Starts a core process for this user, a core for the opposite type of user,
-  // and a /cr process (similar command line to /c), and a process without args.
-  void TestTerminateCoreProcessesWithBothTypesRunningAndOtherProcesses() {
-    scoped_process core_process;
-    scoped_process opposite_core_process;
-    scoped_process codered_process;
-    scoped_process noargs_process;
-    LaunchProcess(not_listening_exe_path_,
-                  _T("/c"),
-                  is_machine_,
-                  address(core_process));
-    ASSERT_TRUE(core_process);
-    EXPECT_EQ(WAIT_TIMEOUT, ::WaitForSingleObject(get(core_process), 0));
-    LaunchProcess(not_listening_exe_opposite_path_,
-                  _T("/c"),
-                  !is_machine_,
-                  address(opposite_core_process));
-    ASSERT_TRUE(opposite_core_process);
-    EXPECT_EQ(WAIT_TIMEOUT,
-              ::WaitForSingleObject(get(opposite_core_process), 0));
-    LaunchProcess(not_listening_exe_path_,
-                  _T("/cr"),
-                  is_machine_,
-                  address(codered_process));
-    ASSERT_TRUE(codered_process);
-    EXPECT_EQ(WAIT_TIMEOUT, ::WaitForSingleObject(get(codered_process), 0));
-    LaunchProcess(not_listening_exe_path_,
-                  _T(""),
-                  is_machine_,
-                  address(noargs_process));
-    ASSERT_TRUE(noargs_process);
-    EXPECT_EQ(WAIT_TIMEOUT, ::WaitForSingleObject(get(noargs_process), 0));
-
-    EXPECT_SUCCEEDED(TerminateCoreProcesses());
-
-    EXPECT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(get(core_process), 8000));
-    HANDLE ignored_processes[] = {get(opposite_core_process),
-                                  get(codered_process),
-                                  get(noargs_process)};
-    EXPECT_EQ(WAIT_TIMEOUT,
-              ::WaitForMultipleObjects(arraysize(ignored_processes),
-                                                 ignored_processes,
-                                                 false,  // wait for any
-                                                 1000));
-
-    HANDLE started_processes[] = {get(core_process),
-                                  get(opposite_core_process),
-                                  get(codered_process),
-                                  get(noargs_process)};
-    EXPECT_TRUE(::TerminateProcess(get(opposite_core_process), 1));
-    EXPECT_TRUE(::TerminateProcess(get(codered_process), 1));
-    EXPECT_TRUE(::TerminateProcess(get(noargs_process), 1));
-    EXPECT_EQ(WAIT_OBJECT_0,
-              ::WaitForMultipleObjects(arraysize(started_processes),
-                                                 started_processes,
-                                                 true,  // wait for all
-                                                 kProcessesCleanupWait));
-  }
-
-  // Starts dummy process that doesn't exit and assigns it to the specified job.
-  // The handle returned by ShellExecute does not have PROCESS_SET_QUOTA access
-  // rights, so we get a new handle with the correct access rights to return to
-  // the caller.
-  void LaunchJobProcess(bool is_machine,
-                        bool as_system,
-                        const CString& job_base_name,
-                        HANDLE* process,
-                        HANDLE* job) {
-    ASSERT_TRUE(process);
-    ASSERT_TRUE(job);
-    ASSERT_TRUE(is_machine || !as_system);
-
-    scoped_process launched_process;
-    LaunchProcess(is_machine ? not_listening_machine_exe_path_ :
-                               not_listening_user_exe_path_,
-                  _T(""),
-                  as_system,
-                  address(launched_process));
-    ASSERT_TRUE(launched_process);
-
-    *process = ::OpenProcess(PROCESS_ALL_ACCESS,
-                             false,
-                             ::GetProcessId(get(launched_process)));
-    ASSERT_TRUE(*process);
-
-    NamedObjectAttributes job_attr;
-    GetNamedObjectAttributes(job_base_name, is_machine, &job_attr);
-    *job = ::CreateJobObject(&job_attr.sa, job_attr.name);
-    ASSERT_TRUE(*job);
-
-    if (ERROR_ALREADY_EXISTS != ::GetLastError()) {
-      // Configure the newly created Job Object so it is compatible with any
-      // real processes that may be created.
-      JOBOBJECT_EXTENDED_LIMIT_INFORMATION extended_info = {0};
-
-      ASSERT_TRUE(::QueryInformationJobObject(
-                      *job,
-                      ::JobObjectExtendedLimitInformation,
-                      &extended_info,
-                      sizeof(extended_info),
-                      NULL)) <<
-          _T("Last Error: ") << ::GetLastError() << std::endl;
-
-      extended_info.BasicLimitInformation.LimitFlags =
-          JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK;
-      ASSERT_TRUE(::SetInformationJobObject(*job,
-                                            ::JobObjectExtendedLimitInformation,
-                                            &extended_info,
-                                            sizeof(extended_info))) <<
-          _T("Last Error: ") << ::GetLastError() << std::endl;
-    }
-
-    ASSERT_TRUE(::AssignProcessToJobObject(*job, *process)) <<
-        _T("Last Error: ") << ::GetLastError() << std::endl;
-  }
-
-  void TestShouldDelayUninstall() {
-    EXPECT_FALSE(setup_->ShouldDelayUninstall());
-
-    const TCHAR* key = ConfigManager::Instance()->registry_update(is_machine_);
-
-    DWORD value = 1;
-    EXPECT_SUCCEEDED(RegKey::SetValue(key,
-                                      kRegValueDelayOmahaUninstall,
-                                      value));
-    EXPECT_TRUE(setup_->ShouldDelayUninstall());
-
-    value = 0;
-    EXPECT_SUCCEEDED(RegKey::SetValue(key,
-                                      kRegValueDelayOmahaUninstall,
-                                      value));
-    EXPECT_FALSE(setup_->ShouldDelayUninstall());
-
-    EXPECT_SUCCEEDED(RegKey::DeleteValue(key,
-                                         kRegValueDelayOmahaUninstall));
-    EXPECT_FALSE(setup_->ShouldDelayUninstall());
-  }
-
-  void TestSetDelayUninstall() {
-    EXPECT_FALSE(setup_->ShouldDelayUninstall());
-
-    EXPECT_SUCCEEDED(setup_->SetDelayUninstall(true));
-    EXPECT_TRUE(setup_->ShouldDelayUninstall());
-
-    EXPECT_SUCCEEDED(setup_->SetDelayUninstall(true));
-    EXPECT_TRUE(setup_->ShouldDelayUninstall());
-
-    EXPECT_SUCCEEDED(setup_->SetDelayUninstall(false));
-    EXPECT_FALSE(setup_->ShouldDelayUninstall());
-
-    EXPECT_SUCCEEDED(setup_->SetDelayUninstall(false));
-    EXPECT_FALSE(setup_->ShouldDelayUninstall());
-  }
-
-  const bool is_machine_;
-  const CString omaha_path_;
-  CString omaha_exe_path_;
-  CString not_listening_exe_path_;
-  CString not_listening_exe_opposite_path_;
-  scoped_ptr<omaha::Setup> setup_;
-
-  static CString not_listening_user_exe_path_;
-  static CString not_listening_machine_exe_path_;
-};
-
-CString SetupTest::not_listening_user_exe_path_;
-CString SetupTest::not_listening_machine_exe_path_;
-
-class SetupMachineTest : public SetupTest {
- protected:
-  SetupMachineTest() : SetupTest(true) {
-  }
-
-  static void SetUpTestCase() {
-    // SeDebugPrivilege is required for elevated admins to open process open
-    // Local System processes with PROCESS_QUERY_INFORMATION access rights.
-    System::AdjustPrivilege(SE_DEBUG_NAME, true);
-
-    SetupTest::SetUpTestCase();
-  }
-};
-
-class SetupUserTest : public SetupTest {
- protected:
-  SetupUserTest() : SetupTest(false) {
-  }
-};
-
-class SetupFutureVersionInstalledUserTest : public SetupUserTest {
- protected:
-  SetupFutureVersionInstalledUserTest()
-      : SetupUserTest(),
-        future_version_path_(ConcatenatePath(omaha_path_,
-                                             kFutureVersionString)) {
-  }
-
-  virtual void SetUp() {
-    SetupUserTest::SetUp();
-
-    // Save the existing version if present.
-    RegKey::GetValue(USER_REG_CLIENTS_GOOPDATE,
-                     kRegValueProductVersion,
-                     &existing_version_);
-    InstallFutureVersion();
-  }
-
-  virtual void TearDown() {
-    EXPECT_SUCCEEDED(DeleteDirectory(future_version_path_));
-    if (existing_version_.IsEmpty()) {
-      EXPECT_SUCCEEDED(RegKey::DeleteValue(USER_REG_CLIENTS_GOOPDATE,
-                                           kRegValueProductVersion));
-    } else {
-      EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                        kRegValueProductVersion,
-                                        existing_version_));
-    }
-
-    SetupUserTest::TearDown();
-  }
-
-  void InstallFutureVersion() {
-    DeleteDirectory(future_version_path_);
-    EXPECT_FALSE(File::IsDirectory(future_version_path_));
-
-    EXPECT_SUCCEEDED(CreateDir(future_version_path_, NULL));
-
-    EXPECT_SUCCEEDED(File::Copy(
-        ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                        kOmahaShellFileName),
-        omaha_path_ + kOmahaShellFileName,
-        false));
-
-    EXPECT_SUCCEEDED(File::Copy(
-        ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                        kOmahaDllName),
-        ConcatenatePath(future_version_path_, kOmahaDllName),
-        false));
-    EXPECT_SUCCEEDED(File::Copy(
-        ConcatenatePath(app_util::GetCurrentModuleDirectory(),
-                        _T("goopdateres_en.dll")),
-        ConcatenatePath(future_version_path_, _T("goopdateres_en.dll")),
-        false));
-
-    EXPECT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                      kRegValueProductVersion,
-                                      kFutureVersionString));
-  }
-
-  CString existing_version_;  // Saves the existing version from the registry.
-  const CString future_version_path_;
-  static const TCHAR* const kAppGuid_;
-};
-
-const TCHAR* const SetupFutureVersionInstalledUserTest::kAppGuid_ =
-    _T("{01D33078-BA95-4da6-A3FC-F31593FD4AA2}");
-
-class SetupRegistryProtectedUserTest : public SetupUserTest {
- protected:
-  SetupRegistryProtectedUserTest()
-      : SetupUserTest(),
-        hive_override_key_name_(kRegistryHiveOverrideRoot) {
-  }
-
-  static void SetUpTestCase() {
-    this_version_ = GetVersionString();
-    expected_is_overinstall_ = !OFFICIAL_BUILD;
-#ifdef DEBUG
-    if (RegKey::HasValue(MACHINE_REG_UPDATE_DEV, kRegValueNameOverInstall)) {
-      DWORD value = 0;
-      EXPECT_SUCCEEDED(RegKey::GetValue(MACHINE_REG_UPDATE_DEV,
-                                        kRegValueNameOverInstall,
-                                        &value));
-      expected_is_overinstall_ = value != 0;
-    }
-#endif
-  }
-
-  virtual void SetUp() {
-    SetupUserTest::SetUp();
-
-    RegKey::DeleteKey(hive_override_key_name_, true);
-    // Do not override HKLM because it contains the CSIDL_* definitions.
-    OverrideSpecifiedRegistryHives(hive_override_key_name_, false, true);
-  }
-
-  virtual void TearDown() {
-    RestoreRegistryHives();
-    ASSERT_SUCCEEDED(RegKey::DeleteKey(hive_override_key_name_, true));
-
-    SetupUserTest::TearDown();
-  }
-
-  const CString hive_override_key_name_;
-
-  static CString this_version_;
-  static bool expected_is_overinstall_;
-};
-
-CString SetupRegistryProtectedUserTest::this_version_;
-bool SetupRegistryProtectedUserTest::expected_is_overinstall_;
-
-class SetupRegistryProtectedMachineTest : public SetupMachineTest {
- protected:
-  SetupRegistryProtectedMachineTest()
-      : SetupMachineTest(),
-        hive_override_key_name_(kRegistryHiveOverrideRoot) {
-  }
-
-  virtual void SetUp() {
-    SetupMachineTest::SetUp();
-
-    RegKey::DeleteKey(hive_override_key_name_, true);
-    OverrideRegistryHives(hive_override_key_name_);
-  }
-
-  virtual void TearDown() {
-    RestoreRegistryHives();
-    ASSERT_SUCCEEDED(RegKey::DeleteKey(hive_override_key_name_, true));
-
-    SetupMachineTest::TearDown();
-  }
-
-  const CString hive_override_key_name_;
-};
-
-// TODO(omaha3): These tests are left over from Omaha2's InstallSelfSilently(),
-// which like Omaha3's Install(), does not install the app. It did, however,
-// start another process to complete installation. This would cause it to fail
-// if the shell or main DLL were missing.
-TEST_F(SetupFutureVersionInstalledUserTest, DISABLED_Install_NoRunKey) {
-  RegKey::DeleteKey(kRegistryHiveOverrideRoot, true);
-  OverrideSpecifiedRegistryHives(kRegistryHiveOverrideRoot, false, true);
-
-  // Write the future version to the override registry.
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    kFutureVersionString));
-
-  CString dll_path = ConcatenatePath(future_version_path_, kOmahaDllName);
-  ASSERT_SUCCEEDED(File::Remove(dll_path));
-  ASSERT_FALSE(File::Exists(dll_path));
-
-  EXPECT_EQ(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
-            setup_->Install(false));
-  EXPECT_EQ(0, setup_->extra_code1());
-
-  RestoreRegistryHives();
-  ASSERT_SUCCEEDED(RegKey::DeleteKey(kRegistryHiveOverrideRoot, true));
-}
-
-// Command line must be valid to avoid displaying invalid command line error.
-TEST_F(SetupFutureVersionInstalledUserTest, Install_ValidRunKey) {
-  RegKey::DeleteKey(kRegistryHiveOverrideRoot, true);
-  OverrideSpecifiedRegistryHives(kRegistryHiveOverrideRoot, false, true);
-
-  // Write the future version to the override registry.
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    kFutureVersionString));
-
-  const TCHAR kRunKey[] =
-      _T("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run");
-  const CString shell_path = ConcatenatePath(omaha_path_, kOmahaShellFileName);
-  CString run_value;
-  run_value.Format(_T("\"%s\" /cr"), shell_path);
-  ASSERT_SUCCEEDED(RegKey::SetValue(kRunKey, _T("Google Update"), run_value));
-
-  CString dll_path = ConcatenatePath(future_version_path_, kOmahaDllName);
-  ASSERT_SUCCEEDED(File::Remove(dll_path));
-  ASSERT_FALSE(File::Exists(dll_path));
-
-  EXPECT_SUCCEEDED(setup_->Install(false));
-  EXPECT_EQ(0, setup_->extra_code1());
-
-  RestoreRegistryHives();
-  ASSERT_SUCCEEDED(RegKey::DeleteKey(kRegistryHiveOverrideRoot, true));
-}
-
-TEST_F(SetupUserTest, Install_LockTimedOut) {
-  TestInstallWhileHoldingLock();
-}
-
-TEST_F(SetupMachineTest, Install_LockTimedOut) {
-  if (!vista_util::IsUserAdmin()) {
-    std::wcout << _T("\tTest did not run because the user is not an admin.")
-               << std::endl;
-    return;
-  }
-
-  TestInstallWhileHoldingLock();
-}
-
-//
-// ShouldInstall tests.
-//
-
-TEST_F(SetupRegistryProtectedUserTest, ShouldInstall_NewerVersion) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    _T("1.0.3.4")));
-  EXPECT_TRUE(ShouldInstall());
-}
-
-TEST_F(SetupRegistryProtectedUserTest, ShouldInstall_OlderVersion) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    _T("9.8.7.6")));
-  EXPECT_FALSE(ShouldInstall());
-}
-
-TEST_F(SetupRegistryProtectedUserTest,
-       ShouldInstall_SameVersionFilesMissingSameLanguage) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    kRegValueInstalledVersion,
-                                    this_version_));
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    this_version_));
-  ASSERT_SUCCEEDED(
-      DeleteDirectory(ConcatenatePath(omaha_path_, this_version_)));
-  CString file_path = ConcatenatePath(
-                          ConcatenatePath(omaha_path_, this_version_),
-                          kOmahaDllName);
-  ASSERT_FALSE(File::Exists(file_path));
-
-  EXPECT_TRUE(ShouldInstall());
-}
-
-TEST_F(SetupRegistryProtectedUserTest,
-       ShouldInstall_SameVersionFilesPresentSameLanguage) {
-  if (!ShouldRunLargeTest()) {
-    return;
-  }
-
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    kRegValueInstalledVersion,
-                                    this_version_));
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    this_version_));
-
-  CopyGoopdateFiles(omaha_path_, this_version_);
-
-  EXPECT_EQ(expected_is_overinstall_, ShouldInstall());
-
-  // Override OverInstall to test official behavior on non-official builds.
-
-  DWORD existing_overinstall(0);
-  bool had_existing_overinstall = SUCCEEDED(RegKey::GetValue(
-                                                MACHINE_REG_UPDATE_DEV,
-                                                kRegValueNameOverInstall,
-                                                &existing_overinstall));
-
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueNameOverInstall,
-                                    static_cast<DWORD>(0)));
-#ifdef DEBUG
-  EXPECT_FALSE(ShouldInstall());
-#else
-  EXPECT_EQ(expected_is_overinstall_, ShouldInstall());
-#endif
-
-  // Restore "overinstall"
-  if (had_existing_overinstall) {
-    EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                      kRegValueNameOverInstall,
-                                      existing_overinstall));
-  } else {
-    EXPECT_SUCCEEDED(RegKey::DeleteValue(MACHINE_REG_UPDATE_DEV,
-                                         kRegValueNameOverInstall));
-  }
-}
-
-TEST_F(SetupRegistryProtectedUserTest,
-       ShouldInstall_SameVersionFilesPresentSameLanguageMissingInstalledVer) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    this_version_));
-
-  CopyGoopdateFiles(omaha_path_, this_version_);
-
-  EXPECT_TRUE(ShouldInstall());
-}
-
-TEST_F(SetupRegistryProtectedUserTest,
-       ShouldInstall_SameVersionFilesPresentSameLanguageNewerInstalledVer) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    kRegValueInstalledVersion,
-                                    kRegValueInstalledVersion));
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    this_version_));
-
-  CopyGoopdateFiles(omaha_path_, this_version_);
-
-  EXPECT_TRUE(ShouldInstall());
-}
-
-TEST_F(SetupRegistryProtectedUserTest,
-       ShouldInstall_SameVersionFilesPresentDifferentLanguage) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    kRegValueInstalledVersion,
-                                    this_version_));
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    this_version_));
-
-  CopyGoopdateFiles(omaha_path_, this_version_);
-
-  EXPECT_EQ(expected_is_overinstall_, ShouldInstall());
-}
-
-TEST_F(SetupRegistryProtectedUserTest,
-       ShouldInstall_SameVersionFilesPresentNoLanguage) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    kRegValueInstalledVersion,
-                                    this_version_));
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    this_version_));
-
-  CopyGoopdateFiles(omaha_path_, this_version_);
-
-  EXPECT_EQ(expected_is_overinstall_, ShouldInstall());
-}
-
-TEST_F(SetupRegistryProtectedUserTest,
-       ShouldInstall_SameVersionRequiredFileMissing) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    kRegValueInstalledVersion,
-                                    this_version_));
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    this_version_));
-
-  CopyGoopdateFiles(omaha_path_, this_version_);
-  CString path = ConcatenatePath(ConcatenatePath(omaha_path_, this_version_),
-                                 kOmahaDllName);
-  ASSERT_SUCCEEDED(File::Remove(path));
-  ASSERT_FALSE(File::Exists(path));
-
-  EXPECT_TRUE(ShouldInstall());
-}
-
-TEST_F(SetupRegistryProtectedUserTest,
-       ShouldInstall_SameVersionOptionalFileMissing) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    kRegValueInstalledVersion,
-                                    this_version_));
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    this_version_));
-
-  CopyGoopdateFiles(omaha_path_, this_version_);
-  CString path = ConcatenatePath(ConcatenatePath(omaha_path_, this_version_),
-                                 UPDATE_PLUGIN_FILENAME);
-  ASSERT_SUCCEEDED(File::Remove(path));
-  ASSERT_FALSE(File::Exists(path));
-
-  DWORD existing_overinstall(0);
-  bool had_existing_overinstall = SUCCEEDED(RegKey::GetValue(
-                                                MACHINE_REG_UPDATE_DEV,
-                                                kRegValueNameOverInstall,
-                                                &existing_overinstall));
-  if (had_existing_overinstall) {
-    EXPECT_SUCCEEDED(RegKey::DeleteValue(MACHINE_REG_UPDATE_DEV,
-                                         kRegValueNameOverInstall));
-  }
-
-  EXPECT_TRUE(ShouldInstall());
-
-  // Restore "overinstall"
-  if (had_existing_overinstall) {
-    EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                      kRegValueNameOverInstall,
-                                      existing_overinstall));
-  }
-}
-
-TEST_F(SetupRegistryProtectedUserTest, ShouldInstall_SameVersionShellMissing) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    kRegValueInstalledVersion,
-                                    this_version_));
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    this_version_));
-
-  CopyGoopdateFiles(omaha_path_, this_version_);
-  CString shell_path = ConcatenatePath(omaha_path_, kOmahaShellFileName);
-  ASSERT_TRUE(SUCCEEDED(File::DeleteAfterReboot(shell_path)) ||
-              !vista_util::IsUserAdmin());
-  ASSERT_FALSE(File::Exists(shell_path));
-
-  EXPECT_TRUE(ShouldInstall());
-}
-
-TEST_F(SetupRegistryProtectedUserTest, ShouldInstall_NewerVersionShellMissing) {
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_UPDATE,
-                                    kRegValueInstalledVersion,
-                                    this_version_));
-  ASSERT_SUCCEEDED(RegKey::SetValue(USER_REG_CLIENTS_GOOPDATE,
-                                    kRegValueProductVersion,
-                                    kFutureVersionString));
-
-  CopyGoopdateFiles(omaha_path_, kFutureVersionString);
-  CString shell_path = ConcatenatePath(omaha_path_, kOmahaShellFileName);
-  ASSERT_TRUE(SUCCEEDED(File::DeleteAfterReboot(shell_path)) ||
-              !vista_util::IsUserAdmin());
-  ASSERT_FALSE(File::Exists(shell_path));
-
-  EXPECT_FALSE(ShouldInstall());
-
-  EXPECT_SUCCEEDED(
-      DeleteDirectory(ConcatenatePath(omaha_path_, kFutureVersionString)));
-}
-
-//
-// ShouldDelayUninstall/SetDelayUninstall tests.
-//
-
-TEST_F(SetupRegistryProtectedUserTest, ShouldDelayUninstall) {
-  TestShouldDelayUninstall();
-}
-
-TEST_F(SetupRegistryProtectedUserTest, SetDelayUninstall) {
-  TestSetDelayUninstall();
-}
-
-TEST_F(SetupRegistryProtectedMachineTest, ShouldDelayUninstall) {
-  TestShouldDelayUninstall();
-}
-
-TEST_F(SetupRegistryProtectedMachineTest, SetDelayUninstall) {
-  TestSetDelayUninstall();
-}
-
-//
-// StopGoogleUpdateAndWait tests.
-//
-// These are "large" tests.
-// They kill currently running GoogleUpdate processes, including the core, owned
-// by the current user or SYSTEM.
-// A core may already be running, so if a core process is found, it is used for
-// the tests. Otherwise, they launch a core from a previous build.
-// Using a previous build ensures that the shutdown event hasn't changed.
-// There is no test directly that this version can shutdown itself, but that is
-// much less likely to break.
-// The Succeeds tests will fail if any processes that don't listen to the
-// shutdown event are running.
-//
-
-// TODO(omaha3): Make these tests pass.
-TEST_F(SetupUserTest, DISABLED_StopGoogleUpdateAndWait_Succeeds) {
-  StopGoogleUpdateAndWaitSucceedsTest();
-}
-
-TEST_F(SetupMachineTest, DISABLED_StopGoogleUpdateAndWait_Succeeds) {
-  StopGoogleUpdateAndWaitSucceedsTest();
-}
-
-// TODO(omaha): If start using Job Objects again, enable these tests.
-/*
-TEST_F(SetupUserTest, StopGoogleUpdateAndWait_SucceedsUsingOnlyJobObjects) {
-  StopGoogleUpdateAndWaitWithProcessSearchDisabledSucceedsTest();
-}
-
-TEST_F(SetupMachineTest, StopGoogleUpdateAndWait_SucceedsUsingOnlyJobObjects) {
-  StopGoogleUpdateAndWaitWithProcessSearchDisabledSucceedsTest();
-}
-*/
-
-TEST_F(SetupUserTest, StopGoogleUpdateAndWait_ProcessesDoNotStop) {
-  StopGoogleUpdateAndWaitProcessesDoNotStopTest();
-}
-
-TEST_F(SetupMachineTest, StopGoogleUpdateAndWait_ProcessesDoNotStop) {
-  StopGoogleUpdateAndWaitProcessesDoNotStopTest();
-}
-
-TEST_F(SetupMachineTest,
-       StopGoogleUpdateAndWait_MachineHandoffWorkerRunningAsUser) {
-  LaunchProcessAndExpectStopGoogleUpdateAndWaitKillsProcess(
-      false,
-      _T("/handoff \"needsadmin=True\""));
-}
-
-// Process mode is unknown because Omaha 3 does not recognize IG.
-TEST_F(SetupMachineTest,
-       StopGoogleUpdateAndWait_MachineLegacyInstallGoogleUpdateWorkerRunningAsUser) {   // NOLINT
-  LaunchProcessAndExpectStopGoogleUpdateAndWaitKillsProcess(
-      false,
-      _T("/ig \"needsadmin=True\""));
-}
-
-TEST_F(SetupMachineTest,
-       StopGoogleUpdateAndWait_UserHandoffWorkerRunningAsSystem) {
-  LaunchProcessAndExpectStopGoogleUpdateAndWaitKillsProcess(
-      true,
-      _T("/handoff \"needsadmin=False\""));
-}
-
-// Process mode is unknown because Omaha 3 does not recognize IG.
-TEST_F(SetupMachineTest,
-       StopGoogleUpdateAndWait_UserLegacyInstallGoogleUpdateWorkerRunningAsSystem) {   // NOLINT
-  LaunchProcessAndExpectStopGoogleUpdateAndWaitKillsProcess(
-      true,
-      _T("/ig \"needsadmin=False\""));
-}
-
-TEST_F(SetupUserTest, TerminateCoreProcesses_NoneRunning) {
-  KillRunningCoreProcesses();
-
-  EXPECT_SUCCEEDED(TerminateCoreProcesses());
-}
-
-TEST_F(SetupUserTest,
-       TerminateCoreProcesses_BothTypesRunningAndSimilarArgsProcess) {
-  TestTerminateCoreProcessesWithBothTypesRunningAndOtherProcesses();
-}
-
-TEST_F(SetupMachineTest, TerminateCoreProcesses_NoneRunning) {
-  KillRunningCoreProcesses();
-
-  EXPECT_SUCCEEDED(TerminateCoreProcesses());
-}
-
-TEST_F(SetupMachineTest,
-       TerminateCoreProcesses_BothTypesRunningAndSimilarArgsProcess) {
-  if (!vista_util::IsUserAdmin()) {
-    std::wcout << _T("\tTest did not run because the user is not an admin.")
-               << std::endl;
-    return;
-}
-  TestTerminateCoreProcessesWithBothTypesRunningAndOtherProcesses();
-}
-
-}  // namespace omaha
diff --git a/site_scons/site_init.py b/site_scons/site_init.py
deleted file mode 100644
index 84858e4..0000000
--- a/site_scons/site_init.py
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-"""Omaha site init for SCons."""
-
-# Nothing to see here.  This file just needs to exist so that SCons can load
-# the tools in the site_scons subdirectory.  Customization of environments and
-# their methods should be done via those tools.
diff --git a/site_scons/site_tools/omaha_builders.py b/site_scons/site_tools/omaha_builders.py
deleted file mode 100644
index 5b15cd0..0000000
--- a/site_scons/site_tools/omaha_builders.py
+++ /dev/null
@@ -1,450 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-"""Omaha builders tool for SCons."""
-
-import os.path
-import SCons.Action
-import SCons.Builder
-import SCons.Tool
-
-
-def EnablePrecompile(env, target_name):
-  """Enable use of precompiled headers for target_name.
-
-  Args:
-    env: The environment.
-    target_name: Name of component.
-
-  Returns:
-    The pch .obj file.
-  """
-  if env.Bit('use_precompiled_headers'):
-    # We enable all warnings on all levels. The goal is to fix the code that
-    # we have written and to programmatically disable the warnings for the
-    # code we do not control. This list of warnings should shrink as the code
-    # gets fixed.
-    env.FilterOut(CCFLAGS=['/W3'])
-    env.Append(
-        CCFLAGS=[
-            '/W4',
-            '/Wall',
-            ],
-        INCLUDES=[
-            '$MAIN_DIR/precompile/precompile.h'
-            ],
-    )
-
-    env['PCHSTOP'] = '$MAIN_DIR/precompile/precompile.h'
-
-    pch_env = env.Clone()
-    # Must manually force-include the header, as the precompilation step does
-    # not evaluate $INCLUDES
-    pch_env.Append(CCFLAGS=['/FI$MAIN_DIR/precompile/precompile.h'])
-    # Append '_pch' to the target base name to prevent target name collisions.
-    # One case where this might have occurred is when a .cc file has the same
-    # base name as the target program/library.
-    pch_output = pch_env.PCH(
-        target=target_name.replace('.', '_') + '_pch' + '.pch',
-        source='$MAIN_DIR/precompile/precompile.cc',
-    )
-
-    env['PCH'] = pch_output[0]
-
-    # Return the pch .obj file that is created, so it can be
-    # included with the inputs of a module
-    return [pch_output[1]]
-
-
-def SignDotNetManifest(env, target, unsigned_manifest):
-  """Signs a .NET manifest.
-
-  Args:
-    env: The environment.
-    target: Name of signed manifest.
-    unsigned_manifest: Unsigned manifest.
-
-  Returns:
-    Output node list from env.Command().
-  """
-  sign_manifest_cmd = ('@mage -Sign $SOURCE -ToFile $TARGET -TimestampUri '
-                       'http://timestamp.verisign.com/scripts/timstamp.dll ')
-
-  if env.Bit('build_server'):
-    # If signing fails with the following error, the hash may not match any
-    # certificates: "Internal error, please try again. Object reference not set
-    # to an instance of an object."
-    sign_manifest_cmd += ('-CertHash ' +
-                          env['build_server_certificate_hash'])
-  else:
-    sign_manifest_cmd += '-CertFile %s -Password %s' % (
-        env.GetOption('authenticode_file'),
-        env.GetOption('authenticode_password'))
-
-  signed_manifest = env.Command(
-      target=target,
-      source=unsigned_manifest,
-      action=sign_manifest_cmd
-  )
-
-  return signed_manifest
-
-
-#
-# Custom Library and Program builders.
-#
-# These builders have additional cababilities, including enabling precompiled
-# headers when appropriate and signing DLLs and EXEs.
-#
-
-# TODO(omaha): Make all build files use these builders instead of Hammer's.
-# This will eliminate many lines in build.scons files related to enabling
-# precompiled header and signing binaries.
-
-
-def _ConditionallyEnablePrecompile(env, target_name, *args, **kwargs):
-  """Enables precompiled headers for target_name when appropriate.
-
-  Enables precompiled headers if they are enabled for the build unless
-  use_pch_default = False. This requires that the source files are specified in
-  sources or in a list as the first argument after target_name.
-
-  Args:
-    env: Environment in which we were called.
-    target_name: Name of the build target.
-    args: Positional arguments.
-    kwargs: Keyword arguments.
-  """
-  use_pch_default = kwargs.get('use_pch_default', True)
-
-  if use_pch_default and env.Bit('use_precompiled_headers'):
-    pch_output = env.EnablePrecompile(target_name)
-
-    # Search the keyworded list first.
-    for key in ['source', 'sources', 'input', 'inputs']:
-      if key in kwargs:
-        kwargs[key] += pch_output
-        return
-
-    # If the keyword was not found, assume the sources are the first argument in
-    # the non-keyworded list.
-    if args:
-      args[0].append(pch_output[0])
-
-
-def ComponentStaticLibrary(env, lib_name, *args, **kwargs):
-  """Pseudo-builder for static library.
-
-  Enables precompiled headers if they are enabled for the build unless
-  use_pch_default = False. This requires that the source files are specified in
-  sources or in a list as the first argument after lib_name.
-
-  Args:
-    env: Environment in which we were called.
-    lib_name: Static library name.
-    args: Positional arguments.
-    kwargs: Keyword arguments.
-
-  Returns:
-    Output node list from env.ComponentLibrary().
-  """
-  _ConditionallyEnablePrecompile(env, lib_name, *args, **kwargs)
-
-  return env.ComponentLibrary(lib_name, *args, **kwargs)
-
-
-# TODO(omaha): Add signing.
-def ComponentDll(env, lib_name, *args, **kwargs):
-  """Pseudo-builder for DLL.
-
-  Enables precompiled headers if they are enabled for the build unless
-  use_pch_default = False. This requires that the source files are specified in
-  sources or in a list as the first argument after lib_name.
-
-  Args:
-    env: Environment in which we were called.
-    lib_name: DLL name.
-    args: Positional arguments.
-    kwargs: Keyword arguments.
-
-  Returns:
-    Output node list from env.ComponentLibrary().
-  """
-  env.Append(COMPONENT_STATIC=False)
-
-  _ConditionallyEnablePrecompile(env, lib_name, *args, **kwargs)
-
-  return env.ComponentLibrary(lib_name, *args, **kwargs)
-
-
-# TODO(omaha): Add signing.
-def ComponentSignedProgram(env, prog_name, *args, **kwargs):
-  """Pseudo-builder for signed EXEs.
-
-  Enables precompiled headers if they are enabled for the build unless
-  use_pch_default = False. This requires that the source files are specified in
-  sources or in a list as the first argument after prog_name.
-
-  Args:
-    env: Environment in which we were called.
-    prog_name: Executable name.
-    args: Positional arguments.
-    kwargs: Keyword arguments.
-
-  Returns:
-    Output node list from env.ComponentProgram().
-  """
-  _ConditionallyEnablePrecompile(env, prog_name, *args, **kwargs)
-
-  return env.ComponentProgram(prog_name, *args, **kwargs)
-
-
-# TODO(omaha): Put these in a tools/ directory instead of staging.
-def ComponentTool(env, prog_name, *args, **kwargs):
-  """Pseudo-builder for utility programs that do not need to be signed.
-
-  Enables precompiled headers if they are enabled for the build unless
-  use_pch_default = False. This requires that the source files are specified in
-  sources or in a list as the first argument after prog_name.
-
-  Args:
-    env: Environment in which we were called.
-    prog_name: Executable name.
-    args: Positional arguments.
-    kwargs: Keyword arguments.
-
-  Returns:
-    Output node list from env.ComponentProgram().
-  """
-  _ConditionallyEnablePrecompile(env, prog_name, *args, **kwargs)
-
-  return env.ComponentProgram(prog_name, *args, **kwargs)
-
-
-#
-# Unit Test Builders
-#
-
-
-def OmahaUnittest(env,  # pylint: disable-msg=C6409
-                  name,
-                  source,
-                  LIBS=None,
-                  all_in_one=True,
-                  COMPONENT_TEST_SIZE='large',
-                  is_small_tests_using_resources=False):
-  """Declares a new unit test.
-
-  Args:
-    env: The environment.
-    name: Name of the unit test.
-    source: Sources for the unittest.
-    LIBS: Any libs required for the unit test.
-    all_in_one: If true, the test will be added to an executable containing
-        all tests.
-    COMPONENT_TEST_SIZE: small, medium, or large.
-    is_small_tests_using_resources: True if COMPONENT_TEST_SIZE='small' and
-        the test requires resources, such as strings.
-
-  If !all_in_one and COMPONENT_TEST_SIZE is 'small', a main is automatically
-  provided. Otherwise, one must be provided in source or LIBS. The small main
-  is selected based on is_small_tests_using_resources.
-
-  Returns:
-    Output node list from env.ComponentTestProgram().
-
-  Raises:
-      Exception: Invalid combination of arguments.
-  """
-  test_env = env.Clone()
-
-  source = test_env.Flatten(source)
-
-  if COMPONENT_TEST_SIZE != 'small' and is_small_tests_using_resources:
-    raise Exception('is_small_tests_using_resources set for non-small test.')
-
-  if all_in_one:
-    test_env['all_in_one_unittest_sources'].extend(test_env.File(source))
-    if LIBS:
-      test_env['all_in_one_unittest_libs'].update(
-          test_env.File(test_env.Flatten(LIBS)))
-    # TODO(omaha): Get the node list automatically.
-    if 'HAMMER_RUNS_TESTS' in os.environ.keys():
-      test_program_dir = '$TESTS_DIR'
-    else:
-      test_program_dir = '$STAGING_DIR'
-    output = [os.path.join(test_program_dir, 'omaha_unittest.exe'),
-              os.path.join(test_program_dir, 'omaha_unittest.pdb')]
-  else:
-    test_env.FilterOut(LINKFLAGS=['/NODEFAULTLIB', '/SUBSYSTEM:WINDOWS'])
-    if LIBS:
-      test_env.Append(
-          LIBS=test_env.Flatten(LIBS),
-      )
-    # TODO(omaha): Let's try to eliminate this giant list of Win32 .libs here.
-    # They are generally dependencies of Omaha base, common, or net; it makes
-    # more sense for unit test authors to stay aware of dependencies and pass
-    # them in as part of the LIBS argument.
-    test_env.Append(
-        CPPPATH=[
-            '$MAIN_DIR/third_party/gmock/include',
-            '$MAIN_DIR/third_party/gtest/include',
-        ],
-        LIBS=[
-            '$LIB_DIR/base',
-            '$LIB_DIR/gmock',
-            '$LIB_DIR/gtest',
-            ('atls', 'atlsd')[test_env.Bit('debug')],
-
-            # Required by base/process.h, which is used by unit_test.cc.
-            'psapi',
-
-            # Required by omaha_version.h, which is used by omaha_unittest.cc.
-            'version',
-
-            # Rquired if base/utils.h, which is used by several modules used by
-            # omaha_unittest.cc, is used.
-            'netapi32',
-            'rasapi32',
-            'shlwapi',
-            'wtsapi32',
-        ],
-    )
-
-    if COMPONENT_TEST_SIZE == 'small':
-      if is_small_tests_using_resources:
-        test_env.Append(LIBS=['$LIB_DIR/unittest_base_small_with_resources'])
-      else:
-        test_env.Append(LIBS=['$LIB_DIR/unittest_base_small'])
-
-    if env.Bit('use_precompiled_headers'):
-      source += test_env.EnablePrecompile(name)
-
-    # Set environment variables specific to the tests.
-    for env_var in os.environ:
-      if (not env_var in test_env['ENV'] and
-          (env_var.startswith('GTEST_') or env_var.startswith('OMAHA_TEST_'))):
-        test_env['ENV'][env_var] = os.environ[env_var]
-
-    output = test_env.ComponentTestProgram(
-        name,
-        source + ['$OBJ_ROOT/testing/run_as_invoker.res'],
-        COMPONENT_TEST_SIZE=COMPONENT_TEST_SIZE,
-    )
-
-  # Add a manual dependency on the resource file used by omaha_unittest.cc to
-  # ensure it is always available before the test runs, which could be during
-  # the build.
-  test_env.Depends(output, '$TESTS_DIR/goopdateres_en.dll')
-
-  return output
-
-
-def GetAllInOneUnittestSources(env):
-  """Returns a list of source files for the all-in-one unit test.
-
-  Args:
-    env: The environment.
-
-  Returns:
-    A list of sources for the all-in-one unit test.
-  """
-  return env['all_in_one_unittest_sources']
-
-
-def GetAllInOneUnittestLibs(env):
-  """Returns a list of libs to be linked into the all-in-one unit test.
-
-  Args:
-    env: The environment.
-
-  Returns:
-    A list of libs for the all-in-one unit test.
-  """
-  # Sort to prevent spurious rebuilds caused by indeterminate ordering of a set.
-  return sorted(env['all_in_one_unittest_libs'],
-                key=SCons.Node.FS.Base.get_abspath)
-
-
-# If a .idl file does not result in any generated proxy code (no foo_p.c and
-# no foo_data.c), the default TypeLibrary builder will mistakenly believe that
-# the IDL needs to be run through midl.exe again to rebuild the missing files.
-def _MidlEmitter(target, source, env):
-  def IsNonProxyGeneratedFile(x):
-    """Returns true if x is not generated proxy code, false otherwise."""
-    return not (str(x).endswith('_p.c') or str(x).endswith('_data.c'))
-
-  (t, source) = SCons.Tool.midl.midl_emitter(target, source, env)
-  return (filter(IsNonProxyGeneratedFile, t), source)
-
-
-def IsCoverageBuild(env):
-  """Returns true if this is a coverage build.
-
-  Args:
-    env: The environment.
-
-  Returns:
-    whether this is a coverage build.
-  """
-  return 'coverage' in env.subst('$BUILD_TYPE')
-
-
-def CopyFileToDirectory(env, target, source):
-  """Copies the file to the directory using the DOS copy command.
-
-  In general, Replicate() should be used, but there are specific cases where
-  an explicit copy is required.
-
-  Args:
-    env: The environment.
-    target: The target directory.
-    source: The full path to the source file.
-
-  Returns:
-    Output node list from env.Command().
-  """
-  (_, source_filename) = os.path.split(source)
-  return env.Command(target=os.path.join(target, source_filename),
-                     source=source,
-                     action='@copy /y $SOURCE $TARGET')
-
-
-# NOTE: SCons requires the use of this name, which fails gpylint.
-def generate(env):  # pylint: disable-msg=C6409
-  """SCons entry point for this tool."""
-  env.AddMethod(EnablePrecompile)
-  env.AddMethod(SignDotNetManifest)
-  env.AddMethod(ComponentStaticLibrary)
-  env.AddMethod(ComponentDll)
-  env.AddMethod(ComponentSignedProgram)
-  env.AddMethod(ComponentTool)
-  env.AddMethod(OmahaUnittest)
-  env.AddMethod(GetAllInOneUnittestSources)
-  env.AddMethod(GetAllInOneUnittestLibs)
-  env.AddMethod(IsCoverageBuild)
-  env.AddMethod(CopyFileToDirectory)
-
-  env['MIDLNOPROXYCOM'] = ('$MIDL $MIDLFLAGS /tlb ${TARGETS[0]} '
-                           '/h ${TARGETS[1]} /iid ${TARGETS[2]} '
-                           '$SOURCE 2> NUL')
-  env['BUILDERS']['TypeLibraryWithNoProxy'] = SCons.Builder.Builder(
-      action=SCons.Action.Action('$MIDLNOPROXYCOM', '$MIDLNOPROXYCOMSTR'),
-      src_suffix='.idl',
-      suffix='.tlb',
-      emitter=_MidlEmitter,
-      source_scanner=SCons.Tool.midl.idl_scanner)
diff --git a/site_scons/site_tools/wix.py b/site_scons/site_tools/wix.py
deleted file mode 100644
index 6dfd9fa..0000000
--- a/site_scons/site_tools/wix.py
+++ /dev/null
@@ -1,154 +0,0 @@
-"""SCons.Tool.wix
-
-Tool-specific initialization for wix, the Windows Installer XML Tool.
-
-There normally shouldn't be any need to import this module directly.
-It will usually be imported through the generic SCons.Tool.Tool()
-selection method.
-"""
-
-#
-# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "src/engine/SCons/Tool/wix.py 3897 2009/01/13 06:45:54 scons"
-
-import SCons.Builder
-import SCons.Action
-import os
-import string
-
-def generate(env):
-    """Add Builders and construction variables for WiX to an Environment."""
-    if not exists(env):
-      return
-
-    env['WIXCANDLEFLAGS'] = ['-nologo']
-    env['WIXCANDLEINCLUDE'] = []
-    env['WIXCANDLECOM'] = '$WIXCANDLE $WIXCANDLEFLAGS -I $WIXCANDLEINCLUDE -o ${TARGET} ${SOURCE}'
-
-    env['WIXLIGHTFLAGS'].append( '-nologo' )
-    env['WIXLIGHTCOM'] = "$WIXLIGHT $WIXLIGHTFLAGS -out ${TARGET} ${SOURCES}"
-
-#BEGIN_OMAHA_ADDITION
-# Necessary to build multiple MSIs from a single .wxs without explicitly
-# building the .wixobj.
-# Follows the convention of obj file prefixes in other tools, such as
-# OBJPREFIX in msvc.py.
-    env['WIXOBJPREFIX'] = ''
-#END_OMAHA_ADDITION
-
-    object_builder = SCons.Builder.Builder(
-        action      = '$WIXCANDLECOM',
-#BEGIN_OMAHA_ADDITION
-        prefix      = '$WIXOBJPREFIX',
-#END_OMAHA_ADDITION
-#BEGIN_OMAHA_CHANGE
-# The correct/default suffix is .wixobj, not .wxiobj.
-#       suffix      = '.wxiobj',
-        suffix      = '.wixobj',
-#END_OMAHA_CHANGE
-        src_suffix  = '.wxs')
-
-    linker_builder = SCons.Builder.Builder(
-        action      = '$WIXLIGHTCOM',
-#BEGIN_OMAHA_CHANGE
-# The correct/default suffix is .wixobj, not .wxiobj.
-#       src_suffix  = '.wxiobj',
-        src_suffix  = '.wixobj',
-#END_OMAHA_CHANGE
-        src_builder = object_builder)
-
-    env['BUILDERS']['WiX'] = linker_builder
-
-def exists(env):
-    env['WIXCANDLE'] = 'candle.exe'
-    env['WIXLIGHT']  = 'light.exe'
-
-#BEGIN_OMAHA_CHANGE
-#   # try to find the candle.exe and light.exe tools and 
-    # try to find the candle.exe and light.exe tools and
-#END_OMAHA_CHANGE
-    # add the install directory to light libpath.
-#BEGIN_OMAHA_CHANGE
-
-    # For backwards compatibility, search PATH environment variable for tools.
-#   #for path in os.environ['PATH'].split(os.pathsep):
-#   for path in string.split(os.environ['PATH'], os.pathsep):
-    for path in os.environ['PATH'].split(os.pathsep):
-#END_OMAHA_CHANGE
-        if not path:
-            continue
-
-        # workaround for some weird python win32 bug.
-        if path[0] == '"' and path[-1:]=='"':
-            path = path[1:-1]
-
-        # normalize the path
-        path = os.path.normpath(path)
-
-        # search for the tools in the PATH environment variable
-        try:
-#BEGIN_OMAHA_CHANGE
-#           if env['WIXCANDLE'] in os.listdir(path) and\
-#              env['WIXLIGHT']  in os.listdir(path):
-            files = os.listdir(path)
-            if (env['WIXCANDLE'] in files and
-                env['WIXLIGHT']  in files):
-#                  env.PrependENVPath('PATH', path)
-                env.PrependENVPath('PATH', path)
-#                  env['WIXLIGHTFLAGS'] = [ os.path.join( path, 'wixui.wixlib' ),
-#                                           '-loc',
-#                                           os.path.join( path, 'WixUI_en-us.wxl' ) ]
-#                  return 1
-                break
-#END_OMAHA_CHANGE
-        except OSError:
-            pass # ignore this, could be a stale PATH entry.
-
-#BEGIN_OMAHA_ADDITION
-    # Search for the tools in the SCons paths.
-    for path in env['ENV'].get('PATH', '').split(os.pathsep):
-        try:
-            files = os.listdir(path)
-            if (env['WIXCANDLE'] in files and
-                env['WIXLIGHT']  in files):
-                # The following is for compatibility with versions prior to 3.
-                # Version 3 no longer has these files.
-                extra_files = [os.path.join(i) for i in ['wixui.wixlib',
-                                                         'WixUI_en-us.wxl']]
-                if (os.path.exists(extra_files[0]) and
-                    os.path.exists(extra_files[1])):
-                    env.Append(WIXLIGHTFLAGS=[
-                        extra_files[0],
-                        '-loc', extra_files[1]])
-                else:
-                    # Create empty variable so the append in generate() works.
-                    env.Append(WIXLIGHTFLAGS=[])
-
-                # WiX was found.
-                return 1
-        except OSError:
-            pass # ignore this, could be a stale PATH entry.
-#END_OMAHA_ADDITION
-
-    return None
diff --git a/standalone/__init__.py b/standalone/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/standalone/__init__.py
+++ /dev/null
diff --git a/standalone/build.scons b/standalone/build.scons
deleted file mode 100644
index e6a0ee0..0000000
--- a/standalone/build.scons
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-
-from standalone import standalone_installer
-
-# Build the standalone installer for each version.
-for omaha_version_info in env['omaha_versions_info']:
-  prefix = omaha_version_info.filename_prefix
-
-  source_binary = '$OBJ_ROOT/mi_exe_stub/%smi_exe_stub.exe' % (prefix)
-
-  standalone_installer.BuildOfflineInstallersVersion(
-      env,
-      omaha_version_info,
-      '$STAGING_DIR',
-      source_binary,
-      '$MAIN_DIR/standalone/standalone_installers.txt',
-      '$MAIN_DIR/standalone/manifests',
-      prefix)
diff --git "a/standalone/manifests/\1737DD1EF7B-D075-47c0-BD51-F624ED87CCF0\175.gup" "b/standalone/manifests/\1737DD1EF7B-D075-47c0-BD51-F624ED87CCF0\175.gup"
deleted file mode 100644
index c87fb9c..0000000
--- "a/standalone/manifests/\1737DD1EF7B-D075-47c0-BD51-F624ED87CCF0\175.gup"
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<response protocol="3.0">
-  <app appid="{7DD1EF7B-D075-47c0-BD51-F624ED87CCF0}" status="ok">
-    <updatecheck status="ok">
-      <urls>
-        <url codebase="http://dl.google.com/foo/${INSTALLER_VERSION}/"/>
-      </urls>
-      <manifest>
-        <packages>
-          <package name="SaveArguments.exe" hash="${INSTALLER_HASH}" size="${INSTALLER_SIZE}" required="true"/>
-        </packages>
-        <actions>
-          <action event="install" run="SaveArguments.exe" arguments="standalone installer arguments" needsadmin="true"/>
-        </actions>
-       </manifest>
-    </updatecheck>
-  </app>
-</response>
diff --git "a/standalone/manifests/\173D6B08267-B440-4C85-9F79-E195E80D9937\175.gup" "b/standalone/manifests/\173D6B08267-B440-4C85-9F79-E195E80D9937\175.gup"
deleted file mode 100644
index 245257d..0000000
--- "a/standalone/manifests/\173D6B08267-B440-4C85-9F79-E195E80D9937\175.gup"
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<response protocol="3.0">
-  <app appid="{D6B08267-B440-4C85-9F79-E195E80D9937}" status="ok">
-    <updatecheck status="ok">
-      <urls>
-        <url codebase="http://dl.google.com/foo/"/>
-      </urls>
-      <manifest version="${INSTALLER_VERSION}">
-        <packages>
-          <package name="test_foo_v${INSTALLER_VERSION}.msi" hash="${INSTALLER_HASH}" size="${INSTALLER_SIZE}" required="true"/>
-        </packages>
-        <actions>
-          <action event="install" run="test_foo_v${INSTALLER_VERSION}.msi" arguments="REGISTER_LAUNCH_COMMAND=1" needsadmin="true"/>
-        </actions>
-       </manifest>
-    </updatecheck>
-  </app>
-</response>
diff --git a/standalone/standalone_installer.py b/standalone/standalone_installer.py
deleted file mode 100644
index 2800ae6..0000000
--- a/standalone/standalone_installer.py
+++ /dev/null
@@ -1,442 +0,0 @@
-#!/usr/bin/python2.4
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-"""Builds standalone installers and MSI wrappers around them.
-
-This is very close to the logic within installers\build.scons. The difference
-is that we have an additional file standalone_installers.txt. This file
-contains a list of standalone installers to create along with necessary values.
-For each entry in standalone_installers.txt, we create a corresponding
-standalone installer, which is the meta-installer, app installer binaries, and
-update response tarred together.
-MSI installers that wrap the standalone installer may also be created.
-"""
-
-import array
-import base64
-import codecs
-import os
-import sha
-
-from enterprise.installer import build_enterprise_installer
-from installers import build_metainstaller
-from installers import tag_meta_installers
-from installers import tagged_installer
-
-
-class OfflineInstaller(object):
-  """Represents the information for a bundle."""
-
-  def __init__(self,
-               friendly_product_name,
-               exe_base_name,
-               binaries,
-               msi_base_name,
-               custom_tag_params,
-               silent_uninstall_args,
-               should_build_enterprise_msi,
-               msi_installer_data,
-               installers_txt_filename):
-    self.friendly_product_name = friendly_product_name
-    self.exe_base_name = exe_base_name
-    self.binaries = binaries
-    self.msi_base_name = msi_base_name
-    self.custom_tag_params = custom_tag_params
-    self.silent_uninstall_args = silent_uninstall_args
-    self.should_build_enterprise_msi = should_build_enterprise_msi
-    self.msi_installer_data = msi_installer_data
-    self.installers_txt_filename = installers_txt_filename
-
-
-def ReadOfflineInstallersFile(env, offline_installers_file_path):
-  """Enumerates the entries in the offline installers file.
-
-  Args:
-    env: Environment.
-    offline_installers_file_path: Path to file specifying installers to build.
-
-  Returns:
-    Returns a list of structures used for creating the prestamped binaries.
-  """
-
-  offline_installers = []
-  offline_abs_path = env.File(offline_installers_file_path).abspath
-  installer_file = codecs.open(offline_abs_path, 'r')
-  for line in installer_file:
-    line = line.strip()
-    if len(line) and not line.startswith('#'):
-      (friendly_product_name,
-       exe_base_name,
-       binaries,
-       msi_base_name,
-       custom_tag_params,
-       silent_uninstall_args,
-       should_build_enterprise_msi,
-       msi_installer_data,
-       installers_txt_filename) = eval(line)
-      installer = OfflineInstaller(friendly_product_name,
-                                   exe_base_name,
-                                   binaries,
-                                   msi_base_name,
-                                   custom_tag_params,
-                                   silent_uninstall_args,
-                                   should_build_enterprise_msi,
-                                   msi_installer_data,
-                                   installers_txt_filename)
-      offline_installers.append(installer)
-  return offline_installers
-
-
-def BuildOfflineInstallersVersion(env,
-                                  omaha_version_info,
-                                  omaha_files_path,
-                                  empty_metainstaller_path,
-                                  offline_installers_file_path,
-                                  manifest_files_path,
-                                  prefix='',
-                                  is_official=False):
-  """Builds all standalone installers specified in offline_installers_file_path.
-
-  Args:
-    env: Environment.
-    omaha_version_info: info about the version of the Omaha files
-    omaha_files_path: Path to the directory containing the Omaha binaries.
-    empty_metainstaller_path: Path to empty (no tarball) metainstaller binary.
-    offline_installers_file_path: Path to file specifying installers to build.
-    manifest_files_path: Path to the directory containing the manifests for the
-        apps specified in offline_installers_file_path.
-    prefix: Optional prefix for the resulting installer.
-    is_official: Whether to build official (vs. test) standalone installers.
-  """
-
-  offline_installers = ReadOfflineInstallersFile(env,
-                                                 offline_installers_file_path)
-
-  for offline_installer in offline_installers:
-    BuildOfflineInstaller(
-        env,
-        offline_installer,
-        omaha_version_info,
-        omaha_files_path,
-        empty_metainstaller_path,
-        offline_installers_file_path,
-        manifest_files_path,
-        prefix,
-        is_official
-    )
-
-
-def _GenerateUpdateResponseFile(target, source, env):
-  """Generate GUP file based on a list of sources.
-
-  Don't call function directly from this script. source may be
-  generated as part of build. Use function as action in env.Command.
-
-  Args:
-    target: Target GUP file name.
-    source: A list of source files. Source files should be listed as manifest1,
-      binary1, manifest2, binary2 and so on. Order is important so that
-      manifests and installers can be differentiated and 'INSTALLER_VERSIONS'
-      can be applied properly.
-    env: Construct environment. This environment must contain environment
-      variable 'INSTALLER_VERSIONS', which contains a list of versions for
-      corresponding binaries in source and should be in same order.
-
-  Raises:
-    Exception: When build encounters error.
-  """
-  xml_header = '<?xml version="1.0" encoding="UTF-8"?>\n'
-  response_header = '<response protocol="3.0">'
-  response_footer = '</response>'
-
-  local_env = env.Clone()
-
-  version_list = local_env['INSTALLER_VERSIONS']
-  if not version_list:
-    raise Exception('INSTALLER_VERSIONS is missing from environment.')
-
-  manifest_content_list = [xml_header, response_header]
-  for file_index in xrange(0, len(source), 2):
-    source_manifest_path = source[file_index]
-    binary_path = source[file_index + 1]
-    size = os.stat(binary_path.abspath).st_size
-    installer_file = open(binary_path.abspath, mode='rb')
-    data = array.array('B')
-    data.fromfile(installer_file, size)
-    installer_file.close()
-    s = sha.new(data)
-    hash_value = base64.b64encode(s.digest())
-
-    manifest_file = open(source_manifest_path.abspath)
-    manifest_content = manifest_file.read()
-    response_body_start_index = manifest_content.find('<response')
-    if response_body_start_index < 0:
-      raise Exception('GUP file does not contain response element.')
-    # + 1 to include the closing > in header
-    response_body_start_index = manifest_content.find(
-        '>', response_body_start_index)
-    if response_body_start_index < 0:
-      raise Exception('GUP file does not contain response element.')
-    response_body_start_index += 1
-    response_body_end_index = manifest_content.find(
-        '</response>', response_body_start_index)
-    if response_body_end_index < 0:
-      raise Exception('GUP file is not in valid response format.')
-    local_env['INSTALLER_SIZE'] = str(size)
-    local_env['INSTALLER_HASH'] = hash_value
-    local_env['INSTALLER_VERSION'] = version_list[file_index/2]
-    manifest_content_list.append(local_env.subst(
-        manifest_content[response_body_start_index:response_body_end_index],
-        raw=1))
-    manifest_file.close()
-  manifest_content_list.append(response_footer)
-
-  manifest_content_str = ''.join(manifest_content_list)
-  output_file = open(target[0].abspath, 'w')
-  output_file.write(manifest_content_str)
-  output_file.close()
-
-
-def BuildOfflineInstaller(
-    env,
-    offline_installer,
-    omaha_version_info,
-    omaha_files_path,
-    empty_metainstaller_path,
-    offline_installers_file_path,
-    manifest_files_path,
-    prefix='',
-    is_official=False,
-    installers_sources_path='$MAIN_DIR/installers',
-    enterprise_installers_sources_path='$MAIN_DIR/enterprise/installer',
-    lzma_path='$MAIN_DIR/third_party/lzma/v4_65/files/lzma.exe',
-    resmerge_path='$MAIN_DIR/tools/resmerge'):
-  """Builds the standalone installers specified by offline_installer.
-
-  Args:
-    env: Environment.
-    offline_installer: OfflineInstaller containing the information about the
-        standalone installer to build.
-    omaha_version_info: info about the version of the Omaha files
-    omaha_files_path: Path to the directory containing the Omaha binaries.
-    empty_metainstaller_path: Path to empty (no tarball) metainstaller binary.
-    offline_installers_file_path: Path to file specifying installers to build.
-    manifest_files_path: Path to the directory containing the manifests for the
-        apps specified in offline_installers_file_path.
-    prefix: Optional prefix for the resulting installer.
-    is_official: Whether to build official (vs. test) standalone installers.
-    installers_sources_path: path to the directory containing the source files
-        for building the metainstaller
-    enterprise_installers_sources_path: path to the directory containing the
-        source files for building enterprise installers
-    lzma_path: path to lzma.exe
-    resmerge_path: path to resmerge.exe
-
-  Returns:
-    Target nodes.
-
-  Raises:
-    Exception: Missing or invalid data specified in offline_installer.
-  """
-  standalone_installer_base_name = offline_installer.exe_base_name
-  if not standalone_installer_base_name:
-    raise Exception('Product name not specified.')
-
-  output_dir = '$STAGING_DIR'
-  if not is_official:
-    standalone_installer_base_name = ('UNOFFICIAL_' +
-                                      standalone_installer_base_name)
-    output_dir = '$TARGET_ROOT/Test_Installers'
-
-  target_base = prefix + standalone_installer_base_name
-  target_name = target_base + '.exe'
-  log_name = target_base + '_Contents.txt'
-
-  # Write Omaha's version.
-  log_text = '*** Omaha Version ***\n\n'
-  log_text += omaha_version_info.GetVersionString() + '\n'
-
-  # Rename the checked in binaries by adding the application guid as the
-  # extension. This is needed as the meta-installer expects the
-  # extension.
-  # Also, log information about each app.
-  additional_payload_contents = []
-  if not offline_installer.binaries:
-    raise Exception('No binaries specified.')
-
-  manifest_target = ''
-  manifest_source = []
-  version_list = []
-  for binary in offline_installer.binaries:
-    (version, installer_path, guid) = binary
-    if not installer_path or not guid or not version:
-      raise Exception('Application specification is incomplete.')
-
-    installer_path_modified = os.path.basename(installer_path) + '.' + guid
-    # Have to use Command('copy') here instead of replicate, as the
-    # file is being renamed in the process.
-    env.Command(
-        target=installer_path_modified,
-        source=installer_path,
-        action='@copy /y $SOURCES $TARGET'
-    )
-
-    manifest_source.extend([
-        manifest_files_path + '/' + guid + '.gup', installer_path_modified])
-    version_list.append(version)
-    additional_payload_contents.append(installer_path_modified)
-
-    # TODO(omaha): Use full guid and version to generate unique string, use
-    #   hash of the unique string as target directory name.
-    manifest_target += guid[0:4] + version
-
-    # Log info about the app.
-    log_text += '\n\n*** App: ' + guid + ' ***\n'
-    log_text += '\nVersion:' + version + '\n'
-    log_text += '\nINSTALLER:\n' + installer_path + '\n'
-
-  # Place the generated manifests in a subdirectory. This allows a single
-  # build to generate installers for multiple versions of the same app.
-  manifest_target += '/OfflineManifest.gup'
-  manifest_file_path = env.Command(
-      target=manifest_target,
-      source=manifest_source,
-      action=[_GenerateUpdateResponseFile],
-      INSTALLER_VERSIONS=version_list
-      )
-
-  # Use the BCJ2 tool from the official build we're using to generate this
-  # metainstaller, not the current build directory.
-  bcj2_path = omaha_files_path + '/bcj2.exe'
-
-  additional_payload_contents.append(manifest_file_path)
-
-  def WriteLog(target, source, env):
-    """Writes the log of what is being built."""
-    dump_data = ''
-    for f in source:
-      file_to_dump = open(env.File(f).abspath, 'r', -1)
-      content = file_to_dump.read()
-      file_to_dump.close()
-      dump_data += '\nMANIFEST:\n'
-      dump_data += str(f)
-      dump_data += '\n'
-      dump_data += content
-    source = source  # Avoid PyLint warning.
-    f = open(env.File(target[0]).abspath, 'w')
-    f.write(env['write_data'])
-    f.write(dump_data)
-    f.close()
-    return 0
-
-  env.Command(
-      target='%s/%s' % (output_dir, log_name),
-      source=manifest_file_path,
-      action=WriteLog,
-      write_data=log_text
-  )
-
-  results = []
-  results += build_metainstaller.BuildMetaInstaller(
-      env=env,
-      target_name=target_name,
-      omaha_version_info=omaha_version_info,
-      empty_metainstaller_path=empty_metainstaller_path,
-      omaha_files_path=omaha_files_path,
-      prefix=prefix,
-      suffix='_' + standalone_installer_base_name,
-      additional_payload_contents=additional_payload_contents,
-      additional_payload_contents_dependencies=offline_installers_file_path,
-      output_dir=output_dir,
-      installers_sources_path=installers_sources_path,
-      lzma_path=lzma_path,
-      resmerge_path=resmerge_path,
-      bcj2_path=bcj2_path
-  )
-
-  standalone_installer_path = '%s/%s' % (output_dir, target_name)
-
-  # Build an enterprise installer.
-  if offline_installer.should_build_enterprise_msi:
-    # TODO(omaha): Add support for bundles here and to
-    #   BuildEnterpriseInstallerFromStandaloneInstaller().
-    # TODO(omaha): Determine how product_version should be decided for MSI in
-    #   bundle scenarios.
-    # TODO(omaha): custom tag, silent uninstall args, distribution data may need
-    #   to be made per-app.
-    if 1 < len(offline_installer.binaries):
-      raise Exception('Enterprise installers do not currently support bundles.')
-    (product_version, installer_path, product_guid) = offline_installer.binaries[0]
-
-    # Note: msi_base_name should not include version info and cannot change!
-    friendly_product_name = offline_installer.friendly_product_name
-    msi_base_name = offline_installer.msi_base_name
-    custom_tag_params = offline_installer.custom_tag_params
-    silent_uninstall_args = offline_installer.silent_uninstall_args
-    msi_installer_data = offline_installer.msi_installer_data
-
-    # custom_tag_params and msi_installer_data are optional.
-    if (not product_version or not friendly_product_name or not msi_base_name or
-        not silent_uninstall_args):
-      raise Exception('Field required to build enterprise MSI is missing.')
-
-    if not is_official:
-      msi_base_name = ('UNOFFICIAL_' + msi_base_name)
-
-    results += (build_enterprise_installer.
-                BuildEnterpriseInstallerFromStandaloneInstaller(
-                    env,
-                    friendly_product_name,
-                    product_version,
-                    product_guid,
-                    custom_tag_params,
-                    silent_uninstall_args,
-                    msi_installer_data,
-                    standalone_installer_path,
-                    omaha_files_path + '/show_error_action.dll',
-                    prefix + msi_base_name,
-                    enterprise_installers_sources_path,
-                    output_dir=output_dir
-                    ))
-
-  # Tag the meta-installer if an installers.txt file was specified.
-  if offline_installer.installers_txt_filename:
-    installers_txt_path = env.File(
-        offline_installer.installers_txt_filename).abspath
-    app_bundles = tag_meta_installers.ReadBundleInstallerFile(
-        installers_txt_path)
-
-    bundles = {}
-    for (key, bundle_list) in app_bundles.items():
-      if not bundle_list or not key:
-        continue
-      if not key in bundles:
-        bundles[key] = bundle_list
-      else:
-        new_bundles_list = bundles[key] + bundle_list
-        bundles[key] = new_bundles_list
-
-    tag_meta_installers.SetOutputFileNames(target_name, bundles, '')
-    for bundles_lang in bundles.itervalues():
-      for bundle in bundles_lang:
-        results += tagged_installer.TagOneBundle(
-            env=env,
-            bundle=bundle,
-            untagged_binary_path=standalone_installer_path,
-            output_dir='$TARGET_ROOT/Tagged_Offline_Installers',
-        )
-
-  return results
diff --git a/standalone/standalone_installers.txt b/standalone/standalone_installers.txt
deleted file mode 100644
index 6a8f48e..0000000
--- a/standalone/standalone_installers.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-# Each line is evaluated as a tuple by the build script.
-#
-# The second and fourth fields are always required. Most other fields are required if "Build Enterprise MSI" is true.
-# When updating the version, update the second, third, and fourth  fields.
-#
-# The fields are:
-#  * Friendly product name (required for MSI). Can include spaces, etc.
-#  * Standalone installer exe name base (required) - everything but '.exe'.
-#    * We recommend including the version of your app in the name so that it is
-#      easy to differentiate different copies of the standalone installer. The
-#      version properties of the standalone installer have Omaha's version, not
-#      the app's, so the only way to determine the app version is to install it.
-#  * List of (App Version, App Installer Location, App ID) tuples (required).
-#  * MSI installer name base (required for MSI) - everything but '.msi'. Cannot change! Thus, should not include version info. Also, the resulting MSI must not be renamed.
-#  * Custom tag parameters for MSI installer (optional). Example: '&brand=FOOB&ap=enterprise'
-#  * Silent uninstall args (required for MSI). Args to add to the default uninstall command line to cause the uninstall to be silent.
-#  * Whether to build an enterprise MSI - True/False.
-#  * MSI Installer data (optional)
-#  * File Containing Tagging Info (optional)
-
-('Test Foo', 'TestFooStandaloneInstaller', [('1.0.101.0', '$STAGING_DIR/unittest_support/test_foo_v1.0.101.0.msi', '{D6B08267-B440-4C85-9F79-E195E80D9937}')], None, None, None, False, '', '$MAIN_DIR/installers/SampleApp_installers.txt')
-
-# Not a real installer.
-('Save Arguments', 'SaveArgumentsStandaloneInstaller', [('0.1.2.0', '$STAGING_DIR/unittest_support/SaveArguments.exe', '{7DD1EF7B-D075-47c0-BD51-F624ED87CCF0}')], 'SaveArgumentsStandaloneEnterprise', '', '/silentuninstall', True, '', '')
-('Bundle_Foo_Argument', 'Bundle_Foo_Argument_StandaloneInstaller', [('0.1.2.0', '$STAGING_DIR/unittest_support/SaveArguments.exe', '{7DD1EF7B-D075-47c0-BD51-F624ED87CCF0}'), ('1.0.101.0', '$STAGING_DIR/unittest_support/test_foo_v1.0.101.0.msi', '{D6B08267-B440-4C85-9F79-E195E80D9937}')], None, None, None, False, '', '')
diff --git a/statsreport/aggregator-win32.cc b/statsreport/aggregator-win32.cc
deleted file mode 100644
index b08468a..0000000
--- a/statsreport/aggregator-win32.cc
+++ /dev/null
@@ -1,147 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Implementation of Win32 metrics aggregator.
-#include "aggregator-win32.h"
-#include "const-win32.h"
-#include "util-win32.h"
-
-namespace stats_report {
-
-MetricsAggregatorWin32::MetricsAggregatorWin32(MetricCollection &coll,
-                                               const wchar_t *key_name)
-    : MetricsAggregator(coll),
-      is_machine_(false) {
-  DCHECK(NULL != key_name);
-
-  key_name_.Format(kStatsKeyFormatString, key_name);
-}
-
-MetricsAggregatorWin32::MetricsAggregatorWin32(MetricCollection &coll,
-                                               const wchar_t *key_name,
-                                               bool is_machine)
-    : MetricsAggregator(coll),
-      is_machine_(is_machine) {
-  DCHECK(NULL != key_name);
-
-  key_name_.Format(kStatsKeyFormatString, key_name);
-}
-
-MetricsAggregatorWin32::~MetricsAggregatorWin32() {
-}
-
-bool MetricsAggregatorWin32::StartAggregation() {
-  DCHECK(NULL == key_.m_hKey);
-
-  HKEY parent_key = is_machine_ ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
-  LONG err = key_.Create(parent_key, key_name_);
-  if (err != ERROR_SUCCESS)
-    return false;
-
-  return true;
-}
-
-void MetricsAggregatorWin32::EndAggregation() {
-  count_key_.Close();
-  timing_key_.Close();
-  integer_key_.Close();
-  bool_key_.Close();
-
-  key_.Close();
-}
-
-bool MetricsAggregatorWin32::EnsureKey(const wchar_t *name, CRegKey *key) {
-  if (NULL != key->m_hKey)
-    return true;
-
-  LONG err = key->Create(key_, name);
-  if (ERROR_SUCCESS != err) {
-    DCHECK(NULL == key->m_hKey);
-    // TODO(omaha): log?
-    return false;
-  }
-
-  return true;
-}
-
-void MetricsAggregatorWin32::Aggregate(CountMetric &metric) {
-  // do as little as possible if no value
-  int64 value = metric.Reset();
-  if (0 == value)
-    return;
-
-  if (!EnsureKey(kCountsKeyName, &count_key_))
-    return;
-
-  CString name(metric.name());
-  int64 reg_value = 0;
-  if (!GetData(count_key_, name, &reg_value)) {
-    // TODO(omaha): clean up??
-  }
-  reg_value += value;
-
-  LONG err = count_key_.SetBinaryValue(name, &reg_value, sizeof(reg_value));
-}
-
-void MetricsAggregatorWin32::Aggregate(TimingMetric &metric) {
-  // do as little as possible if no value
-  TimingMetric::TimingData value = metric.Reset();
-  if (0 == value.count)
-    return;
-
-  if (!EnsureKey(kTimingsKeyName, &timing_key_))
-    return;
-
-  CString name(metric.name());
-  TimingMetric::TimingData reg_value;
-  if (!GetData(timing_key_, name, &reg_value)) {
-    memcpy(&reg_value, &value, sizeof(value));
-  } else {
-    reg_value.count += value.count;
-    reg_value.sum += value.sum;
-    reg_value.minimum = std::min(reg_value.minimum, value.minimum);
-    reg_value.maximum = std::max(reg_value.maximum, value.maximum);
-  }
-
-  LONG err = timing_key_.SetBinaryValue(name, &reg_value, sizeof(reg_value));
-}
-
-void MetricsAggregatorWin32::Aggregate(IntegerMetric &metric) {
-  // do as little as possible if no value
-  int64 value = metric.value();
-  if (0 == value)
-    return;
-
-  if (!EnsureKey(kIntegersKeyName, &integer_key_))
-    return;
-
-  LONG err = integer_key_.SetBinaryValue(CString(metric.name()),
-                                         &value, sizeof(value));
-}
-
-void MetricsAggregatorWin32::Aggregate(BoolMetric &metric) {
-  // do as little as possible if no value
-  int32 value = metric.Reset();
-  if (BoolMetric::kBoolUnset == value)
-    return;
-
-  if (!EnsureKey(kBooleansKeyName, &bool_key_))
-    return;
-
-  LONG err = bool_key_.SetBinaryValue(CString(metric.name()),
-                                      &value, sizeof(value));
-}
-
-} // namespace stats_report
diff --git a/statsreport/aggregator-win32.h b/statsreport/aggregator-win32.h
deleted file mode 100644
index f9ad30b..0000000
--- a/statsreport/aggregator-win32.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Win32 aggregator, which aggregates counters to registry under a named
-// Mutex lock.
-#ifndef OMAHA_STATSREPORT_AGGREGATOR_WIN32_H__
-#define OMAHA_STATSREPORT_AGGREGATOR_WIN32_H__
-
-#include "aggregator.h"
-#include <atlbase.h>
-#include <atlstr.h>
-
-namespace stats_report {
-
-class MetricsAggregatorWin32: public MetricsAggregator {
-public:
-  /// @param coll the metrics collection to aggregate, most usually this
-  ///           is g_global_metrics.
-  /// @param app_name name of the subkey under HKCU\Software\Google we
-  ///           aggregate to.
-  MetricsAggregatorWin32(MetricCollection &coll,
-                         const wchar_t *app_name);
-
-  /// @param is_machine specifies the registry hive where the stats are
-  ///           aggregated to.
-  MetricsAggregatorWin32(MetricCollection &coll,
-                         const wchar_t *app_name,
-                         bool is_machine);
-  virtual ~MetricsAggregatorWin32();
-
-protected:
-  virtual bool StartAggregation();
-  virtual void EndAggregation();
-
-  virtual void Aggregate(CountMetric &metric);
-  virtual void Aggregate(TimingMetric &metric);
-  virtual void Aggregate(IntegerMetric &metric);
-  virtual void Aggregate(BoolMetric &metric);
-private:
-  enum {
-    /// Max length of time we wait for the mutex on StartAggregation.
-    kMaxMutexWaitMs = 1000, // 1 second for now
-  };
-
-  /// Ensures that *key is open, opening it if it's NULL
-  /// @return true on success, false on failure to open key
-  bool EnsureKey(const wchar_t *name, CRegKey *key);
-
-  /// Mutex name for locking access to key
-  CString mutex_name_;
-
-  /// Subkey name, as per constructor docs
-  CString key_name_;
-
-  /// Handle to our subkey under HKCU\Software\Google
-  CRegKey key_;
-
-  /// Subkeys under the above
-  /// @{
-  CRegKey count_key_;
-  CRegKey timing_key_;
-  CRegKey integer_key_;
-  CRegKey bool_key_;
-  /// @}
-
-  /// Specifies HKLM or HKCU, respectively.
-  bool is_machine_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(MetricsAggregatorWin32);
-};
-
-} // namespace stats_report
-
-#endif  // OMAHA_STATSREPORT_AGGREGATOR_WIN32_H__
diff --git a/statsreport/aggregator-win32_unittest.cc b/statsreport/aggregator-win32_unittest.cc
deleted file mode 100644
index 229b5b7..0000000
--- a/statsreport/aggregator-win32_unittest.cc
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Implementation of Win32 metrics aggregator.
-#include "aggregator-win32.h"
-#include "aggregator-win32_unittest.h"
-#include "aggregator_unittest.h"
-#include "omaha/third_party/gtest/include/gtest/gtest.h"
-
-using namespace stats_report;
-
-#define APP_NAME_STRING L"aggregator-win32_unittest"
-#define PREFIX_KEY_STRING L"Software\\" _T(SHORT_COMPANY_NAME_ANSI) L"\\"
-#define SUFFIX_KEY_STRING L"\\UsageStats\\Daily"
-#define ROOT_KEY_STRING PREFIX_KEY_STRING APP_NAME_STRING 
-#define KEY_STRING ROOT_KEY_STRING SUFFIX_KEY_STRING
-
-const wchar_t MetricsAggregatorWin32Test::kAppName[] = APP_NAME_STRING;
-const wchar_t MetricsAggregatorWin32Test::kRootKeyName[] = ROOT_KEY_STRING;
-const wchar_t MetricsAggregatorWin32Test::kCountsKeyName[] = 
-                                                      KEY_STRING L"\\Counts";
-const wchar_t MetricsAggregatorWin32Test::kTimingsKeyName[] = 
-                                                      KEY_STRING L"\\Timings";
-const wchar_t MetricsAggregatorWin32Test::kIntegersKeyName[] = 
-                                                      KEY_STRING L"\\Integers";
-const wchar_t MetricsAggregatorWin32Test::kBoolsKeyName[] = 
-                                                      KEY_STRING L"\\Booleans";
-
-
-#define EXPECT_REGVAL_EQ(value, key_name, value_name) do { \
-  char buf[sizeof(value)]; \
-  ULONG len = sizeof(buf); \
-  CRegKey key; \
-  ASSERT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, key_name)); \
-  EXPECT_EQ(ERROR_SUCCESS, key.QueryBinaryValue(value_name, buf, &len)); \
-  EXPECT_EQ(sizeof(buf), len); \
-  EXPECT_EQ(0, memcmp(&value, buf, sizeof(buf))); \
-} while(0)
-
-TEST_F(MetricsAggregatorWin32Test, AggregateWin32) {
-  MetricsAggregatorWin32 agg(coll_, kAppName);
-
-  EXPECT_TRUE(agg.AggregateMetrics());
-  AddStats();  
-  EXPECT_TRUE(agg.AggregateMetrics());  
-
-  {
-    int64 one = 1, two = 2;
-    EXPECT_REGVAL_EQ(one, kCountsKeyName, L"c1");
-    EXPECT_REGVAL_EQ(two, kCountsKeyName, L"c2");
-
-    TimingMetric::TimingData data1 = { 2, 0, 1500, 500, 1000 };  
-    TimingMetric::TimingData data2 = { 2, 0, 2030, 30, 2000 };  
-    EXPECT_REGVAL_EQ(data1, kTimingsKeyName, L"t1");
-    EXPECT_REGVAL_EQ(data2, kTimingsKeyName, L"t2");
-
-    EXPECT_REGVAL_EQ(one, kIntegersKeyName, L"i1");
-    EXPECT_REGVAL_EQ(two, kIntegersKeyName, L"i2");
-
-    int32 bool_true = 1, bool_false = 0;
-    EXPECT_REGVAL_EQ(bool_true, kBoolsKeyName, L"b1");
-    EXPECT_REGVAL_EQ(bool_false, kBoolsKeyName, L"b2");
-  }
-  
-  AddStats();  
-  EXPECT_TRUE(agg.AggregateMetrics());  
-
-  {
-    int64 two = 2, four = 4;
-    EXPECT_REGVAL_EQ(two, kCountsKeyName, L"c1");
-    EXPECT_REGVAL_EQ(four, kCountsKeyName, L"c2");
-
-    TimingMetric::TimingData data1 = { 4, 0, 3000, 500, 1000 };  
-    TimingMetric::TimingData data2 = { 4, 0, 4060, 30, 2000 };  
-    EXPECT_REGVAL_EQ(data1, kTimingsKeyName, L"t1");
-    EXPECT_REGVAL_EQ(data2, kTimingsKeyName, L"t2");
-
-    int64 one = 1;
-    EXPECT_REGVAL_EQ(one, kIntegersKeyName, L"i1");
-    EXPECT_REGVAL_EQ(two, kIntegersKeyName, L"i2");
-
-    int32 bool_true = 1, bool_false = 0;
-    EXPECT_REGVAL_EQ(bool_true, kBoolsKeyName, L"b1");
-    EXPECT_REGVAL_EQ(bool_false, kBoolsKeyName, L"b2");
-  }
-}
diff --git a/statsreport/aggregator-win32_unittest.h b/statsreport/aggregator-win32_unittest.h
deleted file mode 100644
index 72eefbf..0000000
--- a/statsreport/aggregator-win32_unittest.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-#ifndef OMAHA_STATSREPORT_AGGREGATOR_WIN32_UNITTEST_H__
-#define OMAHA_STATSREPORT_AGGREGATOR_WIN32_UNITTEST_H__
-
-#include "aggregator_unittest.h"
-#include "aggregator-win32.h"
-
-/// Shared test fixture for win32 unit tests
-class MetricsAggregatorWin32Test: public MetricsAggregatorTest {
-public:
-  virtual void SetUp() {
-    // clean the registry
-    SHDeleteKey(HKEY_CURRENT_USER, kRootKeyName);
-    MetricsAggregatorTest::SetUp();
-  }
-  virtual void TearDown() {
-    MetricsAggregatorTest::TearDown();
-    SHDeleteKey(HKEY_CURRENT_USER, kRootKeyName);
-  }
-
-  void AddStats() {
-    ++c1_;
-    ++c2_;
-    ++c2_;
-
-    t1_.AddSample(1000);
-    t1_.AddSample(500);
-
-    t2_.AddSample(2000);
-    t2_.AddSample(30);
-
-    i1_ = 1;
-    i2_ = 2;
-
-    b1_ = true;
-    b2_ = false;
-  }
-
-  static const wchar_t kAppName[];
-  static const wchar_t kRootKeyName[];
-  static const wchar_t kCountsKeyName[];
-  static const wchar_t kTimingsKeyName[];
-  static const wchar_t kIntegersKeyName[];
-  static const wchar_t kBoolsKeyName[];
-};
-
-#endif  // OMAHA_STATSREPORT_AGGREGATOR_WIN32_UNITTEST_H__
diff --git a/statsreport/aggregator.cc b/statsreport/aggregator.cc
deleted file mode 100644
index 754b496..0000000
--- a/statsreport/aggregator.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Implementation of helper classes to aggregate the collected in-memory 
-// stats to persistent storage.
-#include "aggregator.h"
-
-namespace stats_report {
-
-bool MetricsAggregator::AggregateMetrics() {
-  if (!StartAggregation())
-    return false;
-  
-  MetricIterator it(coll_), end;
-  for (; it != end; ++it) {
-    MetricBase *metric = *it;
-    DCHECK(NULL != metric);
-    
-    switch (metric->type()) {
-     case kCountType:
-      Aggregate(metric->AsCount());
-      break;
-     case kTimingType:
-      Aggregate(metric->AsTiming());
-      break;
-     case kIntegerType:
-      Aggregate(metric->AsInteger());
-      break;
-     case kBoolType:
-      Aggregate(metric->AsBool());
-      break;
-     default:
-      DCHECK(false && "Impossible metric type");
-      break;
-    }
-  }
-  
-  // done, close up
-  EndAggregation();
-  
-  return true;
-}
-
-MetricsAggregator::MetricsAggregator() : coll_(g_global_metrics) {
-  DCHECK(coll_.initialized());
-}
-
-MetricsAggregator::MetricsAggregator(const MetricCollection &coll) 
-    : coll_(coll) {
-  DCHECK(coll_.initialized());
-}
-
-MetricsAggregator::~MetricsAggregator() {
-}
-
-bool MetricsAggregator::StartAggregation() {
-  // nothing
-  return true;
-}
-
-void MetricsAggregator::EndAggregation() {
-  // nothing
-}
-
-} // namespace stats_report
\ No newline at end of file
diff --git a/statsreport/aggregator.h b/statsreport/aggregator.h
deleted file mode 100644
index 02cec72..0000000
--- a/statsreport/aggregator.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Helper class to aggregate the collected in-memory stats to persistent
-// storage.
-#ifndef OMAHA_STATSREPORT_AGGREGATOR_H__
-#define OMAHA_STATSREPORT_AGGREGATOR_H__
-
-#include "metrics.h"
-
-namespace stats_report {
-// TODO(omaha): Refactor to avoid cross platform code duplication.
-
-/// Wrapper class and interface for metrics aggregation. This is a platform
-/// independent class and needs to be subclassed for various platforms and/or
-/// metrics persistence methods
-class MetricsAggregator {
-public:
-  /// Aggregate all metrics in the associated collection
-  /// @returns true iff aggregation started successfully, false otherwise.
-  bool AggregateMetrics();
-
-protected:
-  MetricsAggregator();
-  MetricsAggregator(const MetricCollection &coll);
-  virtual ~MetricsAggregator();
-
-  /// Start aggregation. Override this to grab locks, open files, whatever
-  /// needs to happen or can expedite the individual aggregate steps.
-  /// @return true on success, false on failure.
-  /// @note aggregation will not progress if this function returns false
-  virtual bool StartAggregation();
-  virtual void EndAggregation();
-
-  virtual void Aggregate(CountMetric &metric) = 0;
-  virtual void Aggregate(TimingMetric &metric) = 0;
-  virtual void Aggregate(IntegerMetric &metric) = 0;
-  virtual void Aggregate(BoolMetric &metric) = 0;
-
-private:
-  DISALLOW_EVIL_CONSTRUCTORS(MetricsAggregator);
-
-  const MetricCollection &coll_;
-};
-
-} // namespace stats_report
-
-#endif  // OMAHA_STATSREPORT_AGGREGATOR_H__
diff --git a/statsreport/aggregator_unittest.cc b/statsreport/aggregator_unittest.cc
deleted file mode 100644
index fd03319..0000000
--- a/statsreport/aggregator_unittest.cc
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Implementation of helper classes to aggregate the collected in-memory
-// stats to persistent storage.
-#include "aggregator.h"
-#include "aggregator_unittest.h"
-
-using namespace stats_report;
-
-class TestMetricsAggregator: public MetricsAggregator {
-public:
-  TestMetricsAggregator(MetricCollection &coll) : MetricsAggregator(coll)
-      , aggregating_(false), counts_(0), timings_(0), integers_(0), bools_(0) {
-  }
-
-  ~TestMetricsAggregator() {
-  }
-
-  bool aggregating() const { return aggregating_; }
-  int counts() const { return counts_; }
-  int timings() const { return timings_; }
-  int integers() const { return integers_; }
-  int bools() const { return bools_; }
-
-protected:
-  virtual bool StartAggregation() {
-    aggregating_ = true;
-    counts_ = 0;
-    timings_ = 0;
-    integers_ = 0;
-    bools_ = 0;
-
-    return true;
-  }
-
-  virtual void EndAggregation() {
-    aggregating_ = false;
-  }
-
-  virtual void Aggregate(CountMetric &metric) {
-    EXPECT_TRUE(aggregating());
-    metric.Reset();
-    ++counts_;
-  }
-
-  virtual void Aggregate(TimingMetric &metric) {
-    UNREFERENCED_PARAMETER(metric);
-    EXPECT_TRUE(aggregating());
-    metric.Reset();
-    ++timings_;
-  }
-  virtual void Aggregate(IntegerMetric &metric) {
-    UNREFERENCED_PARAMETER(metric);
-    EXPECT_TRUE(aggregating());
-    // Integer metrics don't get reset on aggregation
-    ++integers_;
-  }
-  virtual void Aggregate(BoolMetric &metric) {
-    EXPECT_TRUE(aggregating());
-    metric.Reset();
-    ++bools_;
-  }
-
-private:
-  bool aggregating_;
-  int counts_;
-  int timings_;
-  int integers_;
-  int bools_;
-};
-
-TEST_F(MetricsAggregatorTest, Aggregate) {
-  TestMetricsAggregator agg(coll_);
-
-  EXPECT_FALSE(agg.aggregating());
-  EXPECT_EQ(0, agg.counts());
-  EXPECT_EQ(0, agg.timings());
-  EXPECT_EQ(0, agg.integers());
-  EXPECT_EQ(0, agg.bools());
-  EXPECT_TRUE(agg.AggregateMetrics());
-  EXPECT_FALSE(agg.aggregating());
-
-  // check that we saw all counters.
-  EXPECT_TRUE(kNumCounts == agg.counts());
-  EXPECT_TRUE(kNumTimings == agg.timings());
-  EXPECT_TRUE(kNumIntegers == agg.integers());
-  EXPECT_TRUE(kNumBools == agg.bools());
-}
-
-class FailureTestMetricsAggregator: public TestMetricsAggregator {
-public:
-  FailureTestMetricsAggregator(MetricCollection &coll) :
-      TestMetricsAggregator(coll) {
-  }
-
-protected:
-  virtual bool StartAggregation() {
-    return false;
-  }
-};
-
-TEST_F(MetricsAggregatorTest, AggregateFailure) {
-  FailureTestMetricsAggregator agg(coll_);
-
-  EXPECT_FALSE(agg.AggregateMetrics());
-}
diff --git a/statsreport/aggregator_unittest.h b/statsreport/aggregator_unittest.h
deleted file mode 100644
index 32d15ae..0000000
--- a/statsreport/aggregator_unittest.h
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-#ifndef OMAHA_STATSREPORT_AGGREGATOR_UNITTEST_H__
-#define OMAHA_STATSREPORT_AGGREGATOR_UNITTEST_H__
-
-#include "metrics.h"
-#include "omaha/third_party/gtest/include/gtest/gtest.h"
-
-/// Test fixture shared among aggregator unit tests
-class MetricsAggregatorTest: public testing::Test {
-public:
-#define INIT_METRIC(type, name) name##_(#name, &coll_)
-#define DECL_METRIC(type, name) stats_report::type##Metric name##_
-
-  MetricsAggregatorTest() :
-    INIT_METRIC(Count, c1),
-    INIT_METRIC(Count, c2),
-    INIT_METRIC(Timing, t1),
-    INIT_METRIC(Timing, t2),
-    INIT_METRIC(Integer, i1),
-    INIT_METRIC(Integer, i2),
-    INIT_METRIC(Bool, b1),
-    INIT_METRIC(Bool, b2) {
-  }
-
-  enum {
-    kNumCounts = 2,
-    kNumTimings = 2,
-    kNumIntegers = 2,
-    kNumBools = 2
-  };
-
-  stats_report::MetricCollection coll_;
-  DECL_METRIC(Count, c1);
-  DECL_METRIC(Count, c2);
-  DECL_METRIC(Timing, t1);
-  DECL_METRIC(Timing, t2);
-  DECL_METRIC(Integer, i1);
-  DECL_METRIC(Integer, i2);
-  DECL_METRIC(Bool, b1);
-  DECL_METRIC(Bool, b2);
-
-#undef INIT_METRIC
-#undef DECL_METRIC
-
-  virtual void SetUp() {
-    coll_.Initialize();
-  }
-
-  virtual void TearDown() {
-    coll_.Uninitialize();
-  }
-};
-
-#endif  // OMAHA_STATSREPORT_AGGREGATOR_UNITTEST_H__
diff --git a/statsreport/build.scons b/statsreport/build.scons
deleted file mode 100644
index febf93d..0000000
--- a/statsreport/build.scons
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright 2008-2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-# Create a local clone, so the parent environment is
-# unaffected by changes made here.
-local_env = env.Clone()
-
-local_env.Append(
-    CCFLAGS = [
-        '/we4018',
-        '/we4365',
-
-        # enumerator in switch is not explicitly handled by a case label
-        '/wd4061',
-        ],
-)
-
-inputs = [
-    'aggregator.cc',
-    'aggregator-win32.cc',
-    'const-win32.cc',
-    'formatter.cc',
-    'metrics.cc',
-    'persistent_iterator-win32.cc',
-    ]
-
-# Build these into a library.
-local_env.ComponentStaticLibrary('statsreport', inputs)
diff --git a/statsreport/const-win32.cc b/statsreport/const-win32.cc
deleted file mode 100644
index 79106ff..0000000
--- a/statsreport/const-win32.cc
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Constants for Win32 stats aggregation and uploading
-#include "const-win32.h"
-
-namespace stats_report {
-
-const wchar_t kTimingsKeyName[] = L"Timings";
-const wchar_t kCountsKeyName[] = L"Counts";
-const wchar_t kIntegersKeyName[] = L"Integers";
-const wchar_t kBooleansKeyName[] = L"Booleans";
-const wchar_t kStatsKeyFormatString[] = L"Software\\"
-                                        _T(SHORT_COMPANY_NAME_ANSI)
-                                        L"\\%ws\\UsageStats\\Daily";
-const wchar_t kLastTransmissionTimeValueName[] = L"LastTransmission";
-
-} // namespace stats_report
diff --git a/statsreport/const-win32.h b/statsreport/const-win32.h
deleted file mode 100644
index 058eda7..0000000
--- a/statsreport/const-win32.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Constants for Win32 stats aggregation and uploading
-#ifndef OMAHA_STATSREPORT_CONST_WIN32_H__
-#define OMAHA_STATSREPORT_CONST_WIN32_H__
-
-namespace stats_report {
-
-extern const wchar_t kCountsKeyName[];
-extern const wchar_t kTimingsKeyName[];
-extern const wchar_t kIntegersKeyName[];
-extern const wchar_t kBooleansKeyName[];
-extern const wchar_t kStatsKeyFormatString[];
-extern const wchar_t kLastTransmissionTimeValueName[];
-
-} // namespace stats_report
-
-#endif  // OMAHA_STATSREPORT_CONST_WIN32_H__
diff --git a/statsreport/formatter.cc b/statsreport/formatter.cc
deleted file mode 100644
index 6ac4681..0000000
--- a/statsreport/formatter.cc
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-//
-#include "formatter.h"
-
-namespace stats_report {
-
-Formatter::Formatter(const char *name, uint32 measurement_secs) {
-  output_ << name << "&" << measurement_secs;
-}
-
-Formatter::~Formatter() {
-}
-
-void Formatter::AddCount(const char *name, int64 value) {
-  output_ << "&" << name << ":c=" << value;
-}
-
-void Formatter::AddTiming(const char *name, int64 num, int64 avg,
-                          int64 min, int64 max) {
-  output_ << "&" << name << ":t=" << num << ";"
-                                  << avg << ";" << min << ";" << max;
-}
-
-void Formatter::AddInteger(const char *name, int64 value) {
-  output_ << "&" << name << ":i=" << value;
-}
-
-void Formatter::AddBoolean(const char *name, bool value) {
-  output_ << "&" << name << ":b=" << (value ? "t" : "f");
-}
-
-void Formatter::AddMetric(MetricBase *metric) {
-  switch (metric->type()) {
-    case kCountType: {
-      CountMetric &count = metric->AsCount();
-      AddCount(count.name(), count.value());
-    }
-    break;
-
-    case kTimingType: {
-      TimingMetric &timing = metric->AsTiming();
-      AddTiming(timing.name(), timing.count(), timing.average(),
-                timing.minimum(), timing.maximum());
-    }
-    break;
-
-    case kIntegerType: {
-      IntegerMetric &integer = metric->AsInteger();
-      AddInteger(integer.name(), integer.value());
-    }
-    break;
-
-    case kBoolType: {
-      BoolMetric &boolean = metric->AsBool();
-      // TODO(omaha): boolean.value() returns a TristateBoolValue. The
-      // formatter is going to serialize kBoolUnset to true.
-      DCHECK_NE(boolean.value(), BoolMetric::kBoolUnset);
-      AddBoolean(boolean.name(), boolean.value() != BoolMetric::kBoolFalse);
-    }
-    break;
-
-    default:
-      DCHECK(false && "Impossible metric type");
-  }
-}
-
-} // namespace stats_report
diff --git a/statsreport/formatter.h b/statsreport/formatter.h
deleted file mode 100644
index d219d89..0000000
--- a/statsreport/formatter.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Utility class to format metrics to a string suitable for posting to
-// TB stats server.
-#ifndef OMAHA_STATSREPORT_FORMATTER_H__
-#define OMAHA_STATSREPORT_FORMATTER_H__
-
-#include "base/basictypes.h"
-#include "metrics.h"
-#include <strstream>
-
-namespace stats_report {
-
-/// A utility class that knows how to turn metrics into a string for
-/// reporting to the Toolbar stats server.
-/// This code is mostly appropriated from the toolbars stats formatter
-class Formatter {
-public:
-  /// @param name the name of the application to report stats against
-  Formatter(const char *name, uint32 measurement_secs);
-  ~Formatter();
-
-  /// Add metric to the output string
-  void AddMetric(MetricBase *metric);
-
-  /// Add typed metrics to the output string
-  /// @{
-  void AddCount(const char *name, int64 value);
-  void AddTiming(const char *name, int64 num, int64 avg, int64 min,
-                 int64 max);
-  void AddInteger(const char *name, int64 value);
-  void AddBoolean(const char *name, bool value);
-  /// @}
-
-  /// Terminates the output string and returns it.
-  /// It is an error to add metrics after output() is called.
-  const char *output() { output_ << std::ends; return output_.str(); }
-
-private:
-  DISALLOW_EVIL_CONSTRUCTORS(Formatter);
-
-  mutable std::strstream output_;
-};
-
-} // namespace stats_report
-
-#endif  // OMAHA_STATSREPORT_FORMATTER_H__
diff --git a/statsreport/formatter_unittest.cc b/statsreport/formatter_unittest.cc
deleted file mode 100644
index e23ee77..0000000
--- a/statsreport/formatter_unittest.cc
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-#include "omaha/third_party/gtest/include/gtest/gtest.h"
-#include "formatter.h"
-
-using stats_report::Formatter;
-
-TEST(Formatter, Format) {
-  Formatter formatter("test_application", 86400);
-  
-  formatter.AddCount("count1", 10);
-  formatter.AddTiming("timing1", 2, 150, 50, 200);
-  formatter.AddInteger("integer1", 3000);
-  formatter.AddBoolean("boolean1", true);
-  formatter.AddBoolean("boolean2", false);
-  
-  EXPECT_STREQ("test_application&86400"
-               "&count1:c=10"
-               "&timing1:t=2;150;50;200"
-               "&integer1:i=3000"
-               "&boolean1:b=t"
-               "&boolean2:b=f",
-               formatter.output());
-}
\ No newline at end of file
diff --git a/statsreport/metrics.cc b/statsreport/metrics.cc
deleted file mode 100644
index 6cf6a97..0000000
--- a/statsreport/metrics.cc
+++ /dev/null
@@ -1,238 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Implements metrics and metrics collections
-#include "omaha/statsreport/metrics.h"
-#include "omaha/base/synchronized.h"
-
-namespace stats_report {
-// Make sure global stats collection is placed in zeroed storage so as to avoid
-// initialization order snafus.
-MetricCollectionBase g_global_metric_storage = { 0, 0 };
-MetricCollection &g_global_metrics =
-                  *static_cast<MetricCollection*>(&g_global_metric_storage);
-
-#pragma warning(push)
-// C4640: construction of local static object is not thread-safe.
-// C4073: initializers put in library initialization area.
-#pragma warning(disable : 4640 4073)
-
-// Serialize all metric manipulation and access under this lock.
-//
-// Initializes g_lock before other global objects of user defined types.
-// It assumes the program is single threaded while executing CRT startup and
-// exit code.
-#pragma init_seg(lib)
-omaha::LLock g_lock;
-#pragma warning(pop)
-
-class MetricBase::ObjectLock {
-public:
-  ObjectLock(const MetricBase *metric) : metric_(metric) {
-    metric_->Lock();
-  }
-
-  ~ObjectLock() {
-    metric_->Unlock();
-  }
-
-private:
-  MetricBase const *const metric_;
-  DISALLOW_EVIL_CONSTRUCTORS(MetricBase::ObjectLock);
-};
-
-void MetricBase::Lock() const {
-  g_lock.Lock();
-}
-
-void MetricBase::Unlock() const {
-  g_lock.Unlock();
-}
-
-MetricBase::MetricBase(const char *name,
-                       MetricType type,
-                       MetricCollectionBase *coll)
-    : name_(name), type_(type), next_(coll->first_), coll_(coll) {
-  DCHECK_NE(static_cast<MetricCollectionBase*>(NULL), coll_);
-  DCHECK_EQ(false, coll_->initialized_);
-  coll->first_ = this;
-}
-
-MetricBase::MetricBase(const char *name, MetricType type)
-    : name_(name), type_(type), next_(NULL), coll_(NULL) {
-}
-
-MetricBase::~MetricBase() {
-  if (coll_) {
-    DCHECK_EQ(this, coll_->first_);
-    DCHECK(!coll_->initialized_)
-      << "Metric destructor called without call to Uninitialize().";
-
-    coll_->first_ = next_;
-  } else {
-    DCHECK(NULL == next_);
-  }
-}
-
-void IntegerMetricBase::Set(int64 value) {
-  ObjectLock lock(this);
-  value_ = value;
-}
-
-int64 IntegerMetricBase::value() const {
-  ObjectLock lock(this);
-  int64 ret = value_;
-  return ret;
-}
-
-void IntegerMetricBase::Increment() {
-  ObjectLock lock(this);
-  ++value_;
-}
-
-void IntegerMetricBase::Decrement() {
-  ObjectLock lock(this);
-  --value_;
-}
-
-void IntegerMetricBase::Add(int64 value){
-  ObjectLock lock(this);
-  value_ += value;
-}
-
-void IntegerMetricBase::Subtract(int64 value) {
-  ObjectLock lock(this);
-  if (value_ < value)
-    value_ = 0;
-  else
-    value_ -= value;
-}
-
-int64 CountMetric::Reset() {
-  ObjectLock lock(this);
-  int64 ret = value_;
-  value_ = 0;
-  return ret;
-}
-
-TimingMetric::TimingData TimingMetric::Reset() {
-  ObjectLock lock(this);
-  TimingData ret = data_;
-  Clear();
-  return ret;
-}
-
-uint32 TimingMetric::count() const {
-  ObjectLock lock(this);
-  uint32 ret = data_.count;
-  return ret;
-}
-
-int64 TimingMetric::sum() const {
-  ObjectLock lock(this);
-  int64 ret = data_.sum;
-  return ret;
-}
-
-int64 TimingMetric::minimum() const {
-  ObjectLock lock(this);
-  int64 ret = data_.minimum;
-  return ret;
-}
-
-int64 TimingMetric::maximum() const {
-  ObjectLock lock(this);
-  int64 ret = data_.maximum;
-  return ret;
-}
-
-int64 TimingMetric::average() const {
-  ObjectLock lock(this);
-
-  int64 ret = 0;
-  if (0 == data_.count) {
-    DCHECK_EQ(0, data_.sum);
-  } else {
-    ret = data_.sum / data_.count;
-  }
-  return ret;
-}
-
-void TimingMetric::AddSample(int64 time_ms) {
-  ObjectLock lock(this);
-  if (0 == data_.count) {
-    data_.minimum = time_ms;
-    data_.maximum = time_ms;
-  } else {
-    if (data_.minimum > time_ms)
-      data_.minimum = time_ms;
-    if (data_.maximum < time_ms)
-      data_.maximum = time_ms;
-  }
-  data_.count++;
-  data_.sum += time_ms;
-}
-
-void TimingMetric::AddSamples(int64 count, int64 total_time_ms) {
-  if (0 == count)
-    return;
-
-  int64 time_ms = total_time_ms / count;
-
-  ObjectLock lock(this);
-  if (0 == data_.count) {
-    data_.minimum = time_ms;
-    data_.maximum = time_ms;
-  } else {
-    if (data_.minimum > time_ms)
-      data_.minimum = time_ms;
-    if (data_.maximum < time_ms)
-      data_.maximum = time_ms;
-  }
-
-  // TODO(omaha): truncation from 64 to 32 may occur here.
-  DCHECK_LE(count, kuint32max);
-  data_.count += static_cast<uint32>(count);
-  data_.sum += total_time_ms;
-}
-
-void TimingMetric::Clear() {
-  memset(&data_, 0, sizeof(data_));
-}
-
-void BoolMetric::Set(bool value) {
-  ObjectLock lock(this);
-  value_ = value ? kBoolTrue : kBoolFalse;
-}
-
-BoolMetric::TristateBoolValue BoolMetric::Reset() {
-  ObjectLock lock(this);
-  TristateBoolValue ret = value_;
-  value_ = kBoolUnset;
-  return ret;
-}
-
-void MetricCollection::Initialize() {
-  DCHECK(!initialized());
-  initialized_ = true;
-}
-
-void MetricCollection::Uninitialize() {
-  DCHECK(initialized());
-  initialized_ = false;
-}
-
-
-}  // namespace stats_report
diff --git a/statsreport/metrics.h b/statsreport/metrics.h
deleted file mode 100644
index 3603705..0000000
--- a/statsreport/metrics.h
+++ /dev/null
@@ -1,539 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Declares the interface to in-memory metrics capture
-#ifndef OMAHA_STATSREPORT_METRICS_H__
-#define OMAHA_STATSREPORT_METRICS_H__
-
-#include <iterator>
-#include "base/basictypes.h"
-#include "omaha/base/highres_timer-win32.h"
-#include "omaha/base/logging/logging.h"
-
-/// Macros to declare & define named & typed metrics.
-/// Put declarations in headers or in cpp files, where you need access
-/// to the metrics. For each declared metric, there must be precisely
-/// one definition in a compilation unit someplace.
-
-/// A count metric should be used to report anything that monotonically
-/// increases.
-/// Examples:
-///    # event count
-///      how often does this condition hit, this function get called
-///    # aggregate sums
-///      how many bytes are written
-#define DECLARE_METRIC_count(name)   DECLARE_METRIC(CountMetric, name)
-#define DEFINE_METRIC_count(name)   DEFINE_METRIC(CountMetric, name)
-
-/// Use timing metrics to report on the performance of important things.
-/// A timing metric will report the count of occurrences, as well as the
-/// average, min and max times.
-/// Samples are measured in milliseconds if you use the TIME_SCOPE macro
-/// or the HighResTimer class to collect samples.
-#define DECLARE_METRIC_timing(name)  DECLARE_METRIC(TimingMetric, name)
-#define DEFINE_METRIC_timing(name)  DEFINE_METRIC(TimingMetric, name)
-
-/// Collects a sample from here to the end of the current scope, and
-/// adds the sample to the timing metric supplied
-#define TIME_SCOPE(timing) \
-  stats_report::TimingSample __xxsample__(timing)
-
-/// Use integer metrics to report runtime values that fluctuate.
-/// Examples:
-///    # object count
-///      How many objects of some type exist
-///    # disk space or memory
-///      How much disk space or memory is in use
-#define DECLARE_METRIC_integer(name) DECLARE_METRIC(IntegerMetric, name)
-#define DEFINE_METRIC_integer(name) DEFINE_METRIC(IntegerMetric, name)
-
-
-/// Use boolean metrics to report the occurrence of important but rare events
-/// or conditions. Note that a boolean metric is tri-state, so you typically
-/// want to set it only in one direction, and typically to true.
-/// Setting a boolean metric one way or another on a trigger event will report
-/// the setting of the boolean immediately prior to reporting, which is
-/// typically not what you want.
-#define DECLARE_METRIC_bool(name)    DECLARE_METRIC(BoolMetric, name)
-#define DEFINE_METRIC_bool(name)    DEFINE_METRIC(BoolMetric, name)
-
-
-/// Implementation macros
-#define DECLARE_METRIC(type, name) \
-  namespace omaha_client_statsreport { \
-  extern stats_report::type metric_##name; \
-  } \
-  using omaha_client_statsreport::metric_##name
-
-#define DEFINE_METRIC(type, name) \
-  namespace omaha_client_statsreport { \
-  stats_report::type metric_##name(#name, \
-  &stats_report::g_global_metric_storage); \
-  } \
-  using omaha_client_statsreport::metric_##name
-
-
-namespace stats_report {
-
-enum MetricType {
-  // use zero for invalid, because global storage defaults to zero
-  kInvalidType = 0,
-  kCountType,
-  kTimingType,
-  kIntegerType,
-  kBoolType
-};
-
-// fwd.
-struct MetricCollectionBase;
-class MetricCollection;
-class MetricBase;
-class IntegerMetricBase;
-class CountMetric;
-class TimingMetric;
-class IntegerMetric;
-class BoolMetric;
-
-/// Base class for all stats instances.
-/// Stats instances are chained together against a MetricCollection to
-/// allow enumerating stats.
-///
-/// MetricCollection is factored into a class to make it easier to unittest
-/// the implementation.
-class MetricBase {
-public:
-  /// @name Downcasts
-  /// @{
-  CountMetric &AsCount();
-  TimingMetric &AsTiming();
-  IntegerMetric &AsInteger();
-  BoolMetric &AsBool();
-
-  const CountMetric &AsCount() const;
-  const TimingMetric &AsTiming() const;
-  const IntegerMetric &AsInteger() const;
-  const BoolMetric &AsBool() const;
-  /// @}
-
-  /// @name Accessors
-  /// @{
-  MetricType type() const { return type_; }
-  MetricBase *next() const { return next_; }
-  const char *name() const { return name_; }
-  /// @}
-
-  // TODO(omaha): does this need to be virtual?
-  virtual ~MetricBase() = 0;
-
-protected:
-  class ObjectLock;
-  void Lock() const;
-  void Unlock() const;
-
-  /// Constructs a MetricBase and adds to the provided MetricCollection.
-  /// @note Metrics can only be constructed up to the point where the
-  ///     MetricCollection is initialized, and there's no locking performed.
-  ///     The assumption is that outside unit tests, Metrics will we declared
-  ///     as static/global variables, and initialized at static initialization
-  ///     time - and static initialization is single-threaded.
-  MetricBase(const char *name, MetricType type, MetricCollectionBase *coll);
-
-  /// Constructs a named typed MetricBase
-  MetricBase(const char *name, MetricType type);
-
-  /// Our name
-  char const *const name_;
-
-  /// type of this metric
-  MetricType const type_;
-
-  /// chains to next stat instance
-  MetricBase *const next_;
-
-  /// The collection we're created against
-  MetricCollectionBase *const coll_;
-
-private:
-  DISALLOW_EVIL_CONSTRUCTORS(MetricBase);
-};
-
-/// Must be a POD
-struct MetricCollectionBase {
-  bool initialized_;
-  MetricBase *first_;
-};
-
-/// Inherit from base, which is a POD and can be initialized at link time.
-///
-/// The global MetricCollection is aliased to a link-time initialized
-/// instance of MetricCollectionBase, and must not extend the size of its
-/// base class.
-class MetricCollection: public MetricCollectionBase {
-public:
-  MetricCollection() {
-    initialized_ = false;
-    first_ = NULL;
-  }
-  ~MetricCollection() {
-    DCHECK(NULL == first_);
-  }
-
-  /// Initialize must be called after all metrics have been added to the
-  /// collection, but before enumerating it for e.g. aggregation or reporting.
-  /// The intent is that outside unit tests, there will only be the global
-  /// metrics collection, which will accrue all metrics defined with the
-  /// DEFINE_METRIC_* macros.
-  /// Typically you'd call Initialize very early in your main function, and
-  /// Uninitialize towards the end of main.
-  /// It is an error to Initialize() when the collection is initialized().
-  void Initialize();
-
-  /// Uninitialize must be called before removing (deleting or deconstructing)
-  /// metrics from the collection.
-  /// It is an error to Uninitialize() when the collection is !initialized().
-  void Uninitialize();
-
-  MetricBase *first() const { return first_; }
-  bool initialized() const { return initialized_; }
-
-private:
-  using MetricCollectionBase::initialized_;
-  using MetricCollectionBase::first_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(MetricCollection);
-
-  /// MetricBase is intimate with us
-  friend class MetricBase;
-};
-
-/// Implements a forward_iterator for MetricCollection.
-class MetricIterator: public std::iterator<std::forward_iterator_tag,
-                                           MetricBase *> {
-public:
-  MetricIterator() : curr_(NULL) {
-  }
-  MetricIterator(const MetricIterator &other) : curr_(other.curr_) {
-  }
-  MetricIterator(const MetricCollection &coll) : curr_(coll.first()) {
-    DCHECK(coll.initialized());
-  }
-
-  MetricBase *operator*() const {
-    return curr_;
-  }
-  MetricBase *operator->() const {
-    return curr_;
-  }
-  MetricIterator operator++() { // preincrement
-    if (curr_)
-      curr_ = curr_->next();
-
-    return (*this);
-  }
-  MetricIterator operator++(int) {// postincrement
-    MetricIterator ret = *this;
-    ++*this;
-    return (ret);
-  }
-
-private:
-  MetricBase *curr_;
-};
-
-inline bool operator == (const MetricIterator &a, const MetricIterator &b) {
-  return *a == *b;
-}
-inline bool operator != (const MetricIterator &a, const MetricIterator &b) {
-  return !operator == (a, b);
-}
-
-/// Globally defined counters are registered here
-extern MetricCollectionBase g_global_metric_storage;
-
-/// And more conveniently accessed through here
-extern MetricCollection &g_global_metrics;
-
-/// Base class for integer metrics
-class IntegerMetricBase: public MetricBase {
-public:
-  /// Sets the current value
-  void Set(int64 value);
-
-  /// Retrieves the current value
-  int64 value() const;
-
-  void operator ++ ()     { Increment(); }
-  void operator ++ (int)  { Increment(); }
-  void operator += (int64 addend) { Add(addend); }
-
-protected:
-  IntegerMetricBase(const char *name,
-                    MetricType type,
-                    MetricCollectionBase *coll)
-      : MetricBase(name, type, coll), value_(0) {
-  }
-  IntegerMetricBase(const char *name, MetricType type, int64 value)
-      : MetricBase(name, type), value_(value) {
-  }
-
-  void Increment();
-  void Decrement();
-  void Add(int64 value);
-  void Subtract(int64 value);
-
-  int64 value_;
-
-private:
-  DISALLOW_EVIL_CONSTRUCTORS(IntegerMetricBase);
-};
-
-/// A count metric is a cumulative counter of events.
-class CountMetric: public IntegerMetricBase {
-public:
-  CountMetric(const char *name, MetricCollectionBase *coll)
-      : IntegerMetricBase(name, kCountType, coll) {
-  }
-
-  CountMetric(const char *name, int64 value)
-      : IntegerMetricBase(name, kCountType, value) {
-  }
-
-  /// Nulls the metric and returns the current values.
-  int64 Reset();
-
-private:
-  DISALLOW_EVIL_CONSTRUCTORS(CountMetric);
-};
-
-class TimingMetric: public MetricBase {
-public:
-  struct TimingData {
-    uint32 count;
-    uint32 align; // allow access to the alignment gap between count and sum,
-                  // makes it esier to unittest.
-    int64 sum; // ms
-    int64 minimum; // ms
-    int64 maximum; // ms
-  };
-
-  TimingMetric(const char *name, MetricCollectionBase *coll)
-      : MetricBase(name, kTimingType, coll) {
-    Clear();
-  }
-
-  TimingMetric(const char *name, const TimingData &value)
-      : MetricBase(name, kTimingType), data_(value) {
-  }
-
-  uint32 count() const;
-  int64 sum() const;
-  int64 minimum() const;
-  int64 maximum() const;
-  int64 average() const;
-
-  /// Adds a single sample to the metric
-  /// @param time_ms time (in milliseconds) for this sample
-  void AddSample(int64 time_ms);
-
-  /// Adds count samples to the metric
-  /// @note use this when capturing time over a variable number of items to
-  ///     normalize e.g. download time per byte or KB. This records one sample
-  ///     over count items, which is numerically more stable for the average
-  ///     than dividing the captured time by the item count. As a side benefit
-  ///     the timer will also record the item count.
-  /// @note if count == 0, no sample will be recorded
-  /// @param count number of samples to add
-  /// @param total_time_ms the total time consumed by all the "count" samples
-  void AddSamples(int64 count, int64 total_time_ms);
-
-  /// Nulls the metric and returns the current values.
-  TimingData Reset();
-
-private:
-  DISALLOW_EVIL_CONSTRUCTORS(TimingMetric);
-
-  void Clear();
-
-  TimingData data_;
-};
-
-/// A convenience class to sample the time from construction to destruction
-/// against a given timing metric.
-class TimingSample {
-public:
-  /// @param timing the metric the sample is to be tallied against
-  explicit TimingSample(TimingMetric &timing) : timing_(timing), count_(1) {
-  }
-
-  /// @param timing the metric the sample is to be tallied against
-  /// @param item_count count of items processed, used to divide the sampled
-  ///     time so as to capture time per item, which is often a better measure
-  ///     than the total time over a varying number of items.
-  TimingSample(TimingMetric &timing, uint32 item_count) : timing_(timing),
-      count_(item_count) {
-  }
-
-  ~TimingSample() {
-    // We discard samples with a zero count
-    if(count_ == 1)
-      timing_.AddSample(timer_.GetElapsedMs());
-    else
-      timing_.AddSamples(count_, timer_.GetElapsedMs());
-  }
-
-  /// @name Accessors
-  /// @{
-  uint32 count() const { return count_; }
-  void set_count(uint32 count) { count_ = count; }
-  /// @}
-
-private:
-  /// Collects the sample for us.
-  omaha::HighresTimer timer_;
-
-  /// The metric we tally against.
-  TimingMetric &timing_;
-
-  /// The item count we divide the captured time by
-  uint32 count_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(TimingSample);
-};
-
-/// An integer metric is used to sample values that vary over time.
-/// On aggregation the instantaneous value of the integer metric is captured.
-class IntegerMetric: public IntegerMetricBase {
-public:
-  IntegerMetric(const char *name, MetricCollectionBase *coll)
-      : IntegerMetricBase(name, kIntegerType, coll) {
-  }
-
-  IntegerMetric(const char *name, int64 value)
-      : IntegerMetricBase(name, kIntegerType, value) {
-  }
-
-  void operator = (int64 value)   { Set(value); }
-
-  void operator -- ()     { Decrement(); }
-  void operator -- (int)  { Decrement(); }
-  void operator -= (int64 sub)    { Subtract(sub); }
-
-private:
-  DISALLOW_EVIL_CONSTRUCTORS(IntegerMetric);
-};
-
-/// A bool metric is tri-state, and can be:
-///    - unset,
-///    - true or
-///    - false
-/// to match other metrics, which are implicitly unset if they've not changed
-/// from their initial value.
-class BoolMetric: public MetricBase {
-public:
-  /// Values we can take
-  enum TristateBoolValue {
-    kBoolUnset = -1,
-    kBoolFalse,
-    kBoolTrue,
-  };
-
-  BoolMetric(const char *name, MetricCollectionBase *coll)
-        : MetricBase(name, kBoolType, coll), value_(kBoolUnset) {
-  }
-
-  BoolMetric(const char *name, uint32 value)
-        : MetricBase(name, kBoolType) {
-    switch (value) {
-     case kBoolFalse:
-     case kBoolTrue:
-      value_ = static_cast<TristateBoolValue>(value);
-      break;
-
-     default:
-      DCHECK(false && "Unexpected tristate bool value on construction");
-      value_ = kBoolUnset;
-    }
-  }
-
-  /// Sets the flag to the provided value.
-  void Set(bool value);
-
-  void operator = (bool value) {
-    Set(value);
-  }
-
-  /// Nulls the metric and returns the current values.
-  TristateBoolValue Reset();
-
-  /// Returns the current value - not threadsafe
-  TristateBoolValue value() const { return value_; };
-
-private:
-  DISALLOW_EVIL_CONSTRUCTORS(BoolMetric);
-
-  TristateBoolValue value_;
-};
-
-inline CountMetric &MetricBase::AsCount() {
-  DCHECK_EQ(kCountType, type());
-
-  return static_cast<CountMetric&>(*this);
-}
-
-inline TimingMetric &MetricBase::AsTiming() {
-  DCHECK_EQ(kTimingType, type());
-
-  return static_cast<TimingMetric&>(*this);
-}
-
-inline IntegerMetric &MetricBase::AsInteger() {
-  DCHECK_EQ(kIntegerType, type());
-
-  return static_cast<IntegerMetric&>(*this);
-}
-
-inline BoolMetric &MetricBase::AsBool() {
-  DCHECK_EQ(kBoolType, type());
-
-  return static_cast<BoolMetric&>(*this);
-}
-
-inline const CountMetric &MetricBase::AsCount() const {
-  DCHECK_EQ(kCountType, type());
-
-  return static_cast<const CountMetric&>(*this);
-}
-
-inline const TimingMetric &MetricBase::AsTiming() const {
-  DCHECK_EQ(kTimingType, type());
-
-  return static_cast<const TimingMetric&>(*this);
-}
-
-inline const IntegerMetric &MetricBase::AsInteger() const {
-  DCHECK_EQ(kIntegerType, type());
-
-  return static_cast<const IntegerMetric&>(*this);
-}
-
-inline const BoolMetric &MetricBase::AsBool() const {
-  DCHECK_EQ(kBoolType, type());
-
-  return static_cast<const BoolMetric&>(*this);
-}
-
-} // namespace stats_report
-
-#endif  // OMAHA_STATSREPORT_METRICS_H__
diff --git a/statsreport/metrics_unittest.cc b/statsreport/metrics_unittest.cc
deleted file mode 100644
index 155d049..0000000
--- a/statsreport/metrics_unittest.cc
+++ /dev/null
@@ -1,361 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// metrics report unit testing
-#include "omaha/third_party/gtest/include/gtest/gtest.h"
-#include "metrics.h"
-#include <algorithm>
-#include <new>
-
-DECLARE_METRIC_count(count);
-DEFINE_METRIC_count(count);
-
-DECLARE_METRIC_timing(timing);
-DEFINE_METRIC_timing(timing);
-
-DECLARE_METRIC_integer(integer);
-DEFINE_METRIC_integer(integer);
-
-DECLARE_METRIC_bool(bool);
-DEFINE_METRIC_bool(bool);
-
-using namespace stats_report;
-
-namespace {
-
-class MetricsTest: public testing::Test {
-protected:
-  MetricCollection coll_;
-};
-
-class MetricsEnumTest: public MetricsTest {
-public:
-  virtual void SetUp() {
-    coll_.Initialize();
-  }
-
-  virtual void TearDown() {
-    coll_.Uninitialize();
-  }
-
-protected:
-  MetricsEnumTest(): count_("count", &coll_), timing_("timing", &coll_),
-       integer_("integer", &coll_), bool_("bool", &coll_){
-  }
-
-  CountMetric count_;
-  TimingMetric timing_;
-  IntegerMetric integer_;
-  BoolMetric bool_;
-};
-
-} // namespace
-
-// Validates that the above-declared metrics are available
-// in the expected namespace
-TEST_F(MetricsTest, Globals) {
-  EXPECT_EQ(0, ::metric_count.Reset());
-  TimingMetric::TimingData data = ::metric_timing.Reset();
-  EXPECT_EQ(0, data.count);
-  EXPECT_EQ(0, data.maximum);
-  EXPECT_EQ(0, data.minimum);
-  EXPECT_EQ(0, data.sum);
-
-  EXPECT_EQ(0, ::metric_integer.value());
-  EXPECT_EQ(BoolMetric::kBoolUnset, ::metric_bool.Reset());
-
-  // Check for correct initialization
-  EXPECT_STREQ("count", metric_count.name());
-  EXPECT_STREQ("timing", metric_timing.name());
-  EXPECT_STREQ("integer", metric_integer.name());
-  EXPECT_STREQ("bool", metric_bool.name());
-}
-
-
-// make GTest happy
-inline std::ostream &operator << (std::ostream &str, const MetricIterator &it) {
-  str << std::hex << (void*)*it;
-  return str;
-}
-
-TEST_F(MetricsTest, CollectionInitialization) {
-  // The global MetricCollection is aliased to zero memory so as to ensure
-  // no initialization order snafus. If an initialized MetricCollection
-  // sets any of its storage to non-zero, there's a good chance that e.g. a
-  // vtbl has snuck in there, which must not happen
-  char buf1[sizeof(MetricCollection)] = { 0 };
-  char buf2[sizeof(MetricCollection)] = { 0 };
-
-  // Placement new a MetricCollection to one of the buffers
-  new (buf1) MetricCollection();
-
-  // and check they're still equivalent
-  EXPECT_EQ(0, memcmp(buf1, buf2, sizeof(MetricCollection)));
-
-  // MetricCollection must not extend MetricCollectionBase in size
-  EXPECT_EQ(sizeof(MetricCollection), sizeof(MetricCollectionBase));
-}
-
-TEST_F(MetricsTest, Count) {
-  CountMetric foo("foo", &coll_);
-
-  EXPECT_EQ(0, foo.Reset());
-  EXPECT_EQ(kCountType, foo.type());
-  CountMetric &foo_ref = foo.AsCount();
-
-  ++foo;
-  EXPECT_EQ(1, foo.value());
-  foo++;
-  EXPECT_EQ(2, foo.value());
-
-  foo += 100;
-  EXPECT_EQ(102, foo.value());
-}
-
-TEST_F(MetricsTest, Timing) {
-  TimingMetric foo("foo", &coll_);
-
-  EXPECT_EQ(kTimingType, foo.type());
-  TimingMetric &foo_ref = foo.AsTiming();
-
-  foo.AddSample(100);
-  foo.AddSample(50);
-
-  EXPECT_EQ(2, foo.count());
-  EXPECT_EQ(150, foo.sum());
-  EXPECT_EQ(100, foo.maximum());
-  EXPECT_EQ(50, foo.minimum());
-  EXPECT_EQ(75, foo.average());
-
-  TimingMetric::TimingData data = foo.Reset();
-  EXPECT_EQ(2, data.count);
-  EXPECT_EQ(150, data.sum);
-  EXPECT_EQ(100, data.maximum);
-  EXPECT_EQ(50, data.minimum);
-
-  EXPECT_EQ(0, foo.count());
-  EXPECT_EQ(0, foo.sum());
-  EXPECT_EQ(0, foo.maximum());
-  EXPECT_EQ(0, foo.minimum());
-  EXPECT_EQ(0, foo.average());
-
-  // Test counted samples
-  foo.AddSamples(10, 1000);
-  foo.AddSamples(10, 500);
-  EXPECT_EQ(20, foo.count());
-  EXPECT_EQ(1500, foo.sum());
-  EXPECT_EQ(100, foo.maximum());
-  EXPECT_EQ(50, foo.minimum());
-  EXPECT_EQ(75, foo.average());
-}
-
-TEST_F(MetricsTest, TimingSample) {
-  TimingMetric foo("foo", &coll_);
-
-  // add a sample to foo
-  {
-    TimingSample sample(foo);
-
-    ::Sleep(30);
-  }
-
-  TimingMetric::TimingData data = foo.Reset();
-
-  // Should be precisely one sample in there
-  EXPECT_EQ(1, data.count);
-
-  // Let's hope the scheduler doesn't leave us hanging more than 10 ms.
-  // Increased time from 40 to 100 because test failed intermittently on Pulse.
-  EXPECT_GE(30 + 70, data.sum);
-  // The sleep above seems to often terminate early on the build server,
-  // I've observed captured times down to 18 ms, which is strange.
-  // TODO(omaha): figure out whether the timer is broken or whether
-  //    sleep is breaking its promise, or whether e.g. we're getting different
-  //    walltimes on different CPUs due to BIOS bugs on the build server
-  EXPECT_LE(14, data.sum);
-
-  // again, this time with a non-unity count
-  {
-    TimingSample sample(foo, 2);
-
-    EXPECT_EQ(2, sample.count());
-    ::Sleep(30);
-  }
-
-  data = foo.Reset();
-
-  // Should be precisely two samples in there
-  EXPECT_EQ(2, data.count);
-
-  // Let's hope the scheduler doesn't leave us hanging more than 10 ms.
-  // Increased time from 40 to 100 because test failed intermittently on Pulse.
-  EXPECT_GE(30 + 70, data.sum);
-  EXPECT_LE(14, data.sum);
-
-  // now with zero count
-  {
-    TimingSample sample(foo, 0);
-  }
-
-  data = foo.Reset();
-
-  // Should be no samples in there
-  EXPECT_EQ(0, data.count);
-}
-
-TEST_F(MetricsTest, Integer) {
-  IntegerMetric foo("foo", &coll_);
-
-  EXPECT_EQ(kIntegerType, foo.type());
-  IntegerMetric &foo_ref = foo.AsInteger();
-
-  EXPECT_EQ(0, foo.value());
-  foo.Set(1005);
-  EXPECT_EQ(1005, foo.value());
-  foo = 1009UL;
-  EXPECT_EQ(1009, foo.value());
-
-  foo.Set(0);
-
-  ++foo;
-  EXPECT_EQ(1, foo.value());
-  foo++;
-  EXPECT_EQ(2, foo.value());
-
-  foo += 100;
-  EXPECT_EQ(102, foo.value());
-
-  foo -= 100;
-  EXPECT_EQ(2, foo.value());
-  foo--;
-  EXPECT_EQ(1, foo.value());
-  --foo;
-  EXPECT_EQ(0, foo.value());
-}
-
-TEST_F(MetricsTest, Bool) {
-  BoolMetric foo("foo", &coll_);
-
-  EXPECT_EQ(kBoolType, foo.type());
-  BoolMetric &foo_ref = foo.AsBool();
-
-  EXPECT_EQ(BoolMetric::kBoolUnset, foo.Reset());
-  foo.Set(true);
-  EXPECT_EQ(BoolMetric::kBoolTrue, foo.Reset());
-  foo.Set(false);
-  EXPECT_EQ(BoolMetric::kBoolFalse, foo.Reset());
-  EXPECT_EQ(BoolMetric::kBoolUnset, foo.Reset());
-}
-
-TEST_F(MetricsEnumTest, Enumeration) {
-  MetricBase *metrics[] = {
-        &count_,
-        &timing_,
-        &integer_,
-        &bool_,
-  };
-
-  for (int i = 0; i < sizeof(metrics) / sizeof(metrics[0]); ++i) {
-    MetricBase *stat = metrics[i];
-    MetricBase *curr = coll_.first();
-
-    for (; NULL != curr; curr = curr->next()) {
-      if (stat == curr)
-        break;
-    }
-
-    // if NULL, we didn't find our counter
-    EXPECT_TRUE(NULL != curr);
-  }
-}
-
-TEST_F(MetricsEnumTest, Iterator) {
-  typedef MetricBase *MetricBasePtr;
-  MetricBasePtr metrics[] = { &count_, &timing_, &integer_, &bool_, };
-  int num_stats = sizeof(metrics) / sizeof(metrics[0]);
-
-  MetricIterator it(coll_), end;
-  EXPECT_NE(it, end);
-
-  // copy construction
-  EXPECT_EQ(it, MetricIterator(it));
-  EXPECT_EQ(end, MetricIterator(end));
-
-  // # of iterations
-  int i = 0;
-  while (it++ != end)
-    ++i;
-  DCHECK_EQ(i, num_stats);
-  DCHECK_EQ(it, end);
-
-  // increment past end is idempotent
-  ++it;
-  DCHECK_EQ(it, end);
-
-  // Check that we return no garbage or nonsense
-  for (it = MetricIterator(coll_); it != end; ++it) {
-    MetricBasePtr *stats_end = &metrics[num_stats];
-    EXPECT_NE(stats_end, std::find(metrics, stats_end, *it));
-  }
-
-  // and that all metrics can be found
-  for (int i = 0; i < sizeof(metrics) / sizeof(metrics[0]); ++i) {
-    MetricBase *stat = metrics[i];
-
-    EXPECT_EQ(stat, *std::find(MetricIterator(coll_), end, stat));
-  }
-}
-
-TEST_F(MetricsTest, SimpleConstruction) {
-  const CountMetric c("c", 100);
-
-  EXPECT_EQ(100, c.value());
-  EXPECT_EQ(kCountType, c.type());
-  EXPECT_STREQ("c", c.name());
-  EXPECT_TRUE(NULL == c.next());
-
-  TimingMetric::TimingData data = { 10, 0, 1000, 10, 500 };
-  const TimingMetric t("t", data);
-
-  EXPECT_EQ(10, t.count());
-  EXPECT_EQ(1000, t.sum());
-  EXPECT_EQ(10, t.minimum());
-  EXPECT_EQ(500, t.maximum());
-  EXPECT_EQ(kTimingType, t.type());
-  EXPECT_STREQ("t", t.name());
-  EXPECT_TRUE(NULL == t.next());
-
-  const IntegerMetric i("i", 200);
-
-  EXPECT_EQ(200, i.value());
-  EXPECT_EQ(kIntegerType, i.type());
-  EXPECT_STREQ("i", i.name());
-  EXPECT_TRUE(NULL == i.next());
-
-  const BoolMetric bool_true("bool_true", BoolMetric::kBoolTrue);
-
-  EXPECT_EQ(BoolMetric::kBoolTrue, bool_true.value());
-  EXPECT_EQ(kBoolType, bool_true.type());
-  EXPECT_STREQ("bool_true", bool_true.name());
-  EXPECT_TRUE(NULL == bool_true.next());
-
-  const BoolMetric bool_false("bool_false", BoolMetric::kBoolFalse);
-
-  EXPECT_EQ(BoolMetric::kBoolFalse, bool_false.value());
-  EXPECT_EQ(kBoolType, bool_false.type());
-  EXPECT_STREQ("bool_false", bool_false.name());
-  EXPECT_TRUE(NULL == bool_false.next());
-}
-
diff --git a/statsreport/persistent_iterator-win32.cc b/statsreport/persistent_iterator-win32.cc
deleted file mode 100644
index 5b527e1..0000000
--- a/statsreport/persistent_iterator-win32.cc
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Iterator over persisted metrics
-#include "persistent_iterator-win32.h"
-
-namespace stats_report {
-
-void PersistentMetricsIteratorWin32::Next() {
-  current_value_.reset();
-
-  // Try to open the top-level key if we didn't already.
-  if (NULL == key_.m_hKey) {
-    HKEY parent_key = is_machine_ ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
-    LONG err = key_.Open(parent_key, key_name_, KEY_READ);
-    if (err != ERROR_SUCCESS)
-      return;
-  }
-
-  // Loop until we find a value
-  while (state_ != kFinished) {
-    if (NULL == sub_key_.m_hKey) {
-      const wchar_t *subkey_name = NULL;
-      switch (state_) {
-       case kUninitialized:
-        state_ = kCounts;
-        subkey_name = kCountsKeyName;
-        break;
-       case kCounts:
-        state_ = kTimings;
-        subkey_name = kTimingsKeyName;
-        break;
-       case kTimings:
-        state_ = kIntegers;
-        subkey_name = kIntegersKeyName;
-        break;
-       case kIntegers:
-        state_ = kBooleans;
-        subkey_name = kBooleansKeyName;
-        break;
-       case kBooleans:
-        state_ = kFinished;
-        break;
-       case kFinished:
-        break;
-      }
-
-      if (NULL != subkey_name) {
-        LONG err = sub_key_.Open(key_, subkey_name, KEY_READ);
-        // go around the loop on error to try the next key type
-        if (ERROR_SUCCESS != err)
-          continue;
-      }
-
-      // reset value enumeration
-      value_index_ = 0;
-    }
-
-    if (state_ != kFinished) {
-      DCHECK(NULL != sub_key_.m_hKey);
-      CString wide_value_name;
-      DWORD value_name_len = 255;
-      DWORD value_type = 0;
-      BYTE buf[sizeof(TimingMetric::TimingData)];
-      DWORD value_len = sizeof(buf);
-
-      // Get the next key and value
-      LONG err = ::RegEnumValue(sub_key_, value_index_,
-                     CStrBuf(wide_value_name, static_cast<int>(value_name_len)),
-                     &value_name_len,
-                     0, &value_type,
-                     buf, &value_len);
-
-      ++value_index_;
-
-      if (ERROR_NO_MORE_ITEMS == err) {
-        // done with this subkey, go around again
-        sub_key_.Close();
-        continue;
-      } else if (ERROR_SUCCESS != err) {
-        // some other error, broken into a separate case for ease of debugging
-        DCHECK(false && "Unexpected error during reg value enumeration");
-      } else {
-        DCHECK(ERROR_SUCCESS == err);
-
-        // convert value to ASCII
-        current_value_name_ = wide_value_name;
-
-        switch (state_) {
-         case kCounts:
-          if (value_len != sizeof(int64))
-            continue;
-          current_value_.reset(new CountMetric(current_value_name_ .GetString(),
-                                          *reinterpret_cast<int64*>(&buf[0])));
-          break;
-         case kTimings:
-          if (value_len != sizeof(TimingMetric::TimingData))
-            continue;
-          current_value_.reset(new TimingMetric(current_value_name_.GetString(),
-                        *reinterpret_cast<TimingMetric::TimingData*>(&buf[0])));
-          break;
-         case kIntegers:
-          if (value_len != sizeof(int64))
-            continue;
-          current_value_.reset(new IntegerMetric(
-                                      current_value_name_.GetString(),
-                                      *reinterpret_cast<int64*>(&buf[0])));
-          break;
-         case kBooleans:
-          if (value_len != sizeof(uint32))
-            continue;
-          current_value_.reset(new BoolMetric(current_value_name_.GetString(),
-                                          *reinterpret_cast<uint32*>(&buf[0])));
-          break;
-         default:
-          DCHECK(false && "Impossible state during reg value enumeration");
-          break;
-        }
-
-        if (current_value_.get())
-          return;
-      }
-    }
-  }
-}
-
-} // namespace stats_report
diff --git a/statsreport/persistent_iterator-win32.h b/statsreport/persistent_iterator-win32.h
deleted file mode 100644
index d35f91e..0000000
--- a/statsreport/persistent_iterator-win32.h
+++ /dev/null
@@ -1,136 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Iterator over persisted metrics
-#ifndef OMAHA_STATSREPORT_PERSISTENT_ITERATOR_WIN32_H__
-#define OMAHA_STATSREPORT_PERSISTENT_ITERATOR_WIN32_H__
-
-#include "base/scoped_ptr.h"
-#include "metrics.h"
-#include "const-win32.h"
-
-#include <atlbase.h>
-#include <atlstr.h>
-#include <iterator>
-
-namespace stats_report {
-
-/// Forward iterator for persisted metrics
-class PersistentMetricsIteratorWin32
-    : public std::iterator<std::forward_iterator_tag, const MetricBase *> {
-public:
-  /// @param app_name see MetricsAggregatorWin32
-  explicit PersistentMetricsIteratorWin32(const wchar_t *app_name)
-      : state_(kUninitialized),
-       is_machine_(false) {
-    key_name_.Format(kStatsKeyFormatString, app_name);
-    Next();
-  }
-
-  /// @param app_name see MetricsAggregatorWin32
-  /// @param is_machine specifies the registry hive
-  PersistentMetricsIteratorWin32(const wchar_t *app_name, bool is_machine)
-      : state_(kUninitialized),
-        is_machine_(is_machine) {
-    key_name_.Format(kStatsKeyFormatString, app_name);
-    Next();
-  }
-
-  /// Constructs the at-end iterator
-  PersistentMetricsIteratorWin32() : state_(kUninitialized) {
-  }
-
-  MetricBase *operator* () {
-    return Current();
-  }
-  MetricBase *operator-> () {
-    return Current();
-  }
-
-  /// Preincrement, we don't implement postincrement because we don't
-  /// want to deal with making iterators copyable, comparable etc.
-  PersistentMetricsIteratorWin32 &operator++() {
-    Next();
-
-    return (*this);
-  }
-
-  /// Compare for equality with o.
-  bool equals(const PersistentMetricsIteratorWin32 &o) const {
-    // compare equal to self, and end iterators compare equal
-    if ((this == &o) || (NULL == current_value_.get() &&
-                         NULL == o.current_value_.get()))
-      return true;
-
-    return false;
-  }
-
-private:
-  MetricBase *Current() {
-    DCHECK(current_value_.get());
-    return current_value_.get();
-  }
-
-  enum IterationState {
-    kUninitialized,
-    kCounts,
-    kTimings,
-    kIntegers,
-    kBooleans,
-    kFinished,
-  };
-
-  /// Walk to the next key/value under iteration
-  void Next();
-
-  /// Keeps track of which subkey we're iterating over
-  IterationState state_;
-
-  /// The full path from HKCU to the key we iterate over
-  CString key_name_;
-
-  /// The top-level key we're iterating over, valid only
-  /// after first call to Next().
-  CRegKey key_;
-
-  /// The subkey we're currently enumerating over
-  CRegKey sub_key_;
-
-  /// Current value we're indexing over
-  DWORD value_index_;
-
-  /// Name of the value under the iterator
-  CStringA current_value_name_;
-
-  /// The metric under the iterator
-  scoped_ptr<MetricBase> current_value_;
-
-  /// Specifies HKLM or HKCU, respectively.
-  bool is_machine_;
-};
-
-inline bool operator == (const PersistentMetricsIteratorWin32 &a,
-                         const PersistentMetricsIteratorWin32 &b) {
-  return a.equals(b);
-}
-
-inline bool operator != (const PersistentMetricsIteratorWin32 &a,
-                         const PersistentMetricsIteratorWin32 &b) {
-  return !a.equals(b);
-}
-
-} // namespace stats_report
-
-#endif  // OMAHA_STATSREPORT_PERSISTENT_ITERATOR_WIN32_H__
diff --git a/statsreport/persistent_iterator-win32_unittest.cc b/statsreport/persistent_iterator-win32_unittest.cc
deleted file mode 100644
index 6893b69..0000000
--- a/statsreport/persistent_iterator-win32_unittest.cc
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-#include "omaha/third_party/gtest/include/gtest/gtest.h"
-#include "const-win32.h"
-#include "aggregator-win32_unittest.h"
-#include "persistent_iterator-win32.h"
-#include <atlbase.h>
-#include <atlcom.h>
-#include <iterator>
-#include <map>
-
-using namespace stats_report;
-
-namespace {
-
-class PersistentMetricsIteratorWin32Test: public MetricsAggregatorWin32Test {
-public:
-  bool WriteStats() {
-    // put some persistent metrics into the registry
-    MetricsAggregatorWin32 agg(coll_, kAppName);
-    AddStats();
-    bool ret = agg.AggregateMetrics();
-
-    // Reset the stats, we should now have the same stats
-    // in our collection as in registry.
-    AddStats();
-
-    return ret;
-  }
-
-  typedef std::map<std::string, MetricBase*> MetricsMap;
-  void IndexMetrics(MetricsMap *metrics) {
-    // build a map over the metrics in our collection
-    MetricIterator it(coll_), end;
-
-    for (; it != end; ++it) {
-      metrics->insert(std::make_pair(std::string(it->name()), *it));
-    }
-  }
-};
-
-// compare two metrics instances for equality
-bool equals(MetricBase *a, MetricBase *b) {
-  if (!a || !b)
-    return false;
-
-  if (a->type() != b->type() || 0 != strcmp(a->name(), b->name()))
-    return false;
-
-  switch (a->type()) {
-   case kCountType:
-    return a->AsCount().value() == b->AsCount().value();
-    break;
-   case kTimingType: {
-      TimingMetric &at = a->AsTiming();
-      TimingMetric &bt = b->AsTiming();
-
-      return at.count() == bt.count() &&
-             at.sum() == bt.sum() &&
-             at.minimum() == bt.minimum() &&
-             at.maximum() == bt.maximum();
-    }
-    break;
-   case kIntegerType:
-    return a->AsInteger().value() == b->AsInteger().value();
-    break;
-   case kBoolType:
-    return a->AsBool().value() == b->AsBool().value();
-    break;
-
-   case kInvalidType:
-   default:
-    LOG(FATAL) << "Impossible metric type";
-  }
-
-  return false;
-}
-
-} // namespace
-
-TEST_F(PersistentMetricsIteratorWin32Test, Basic) {
-  EXPECT_TRUE(WriteStats());
-  PersistentMetricsIteratorWin32 a, b, c(kAppName);
-
-  EXPECT_TRUE(a == b);
-  EXPECT_TRUE(b == a);
-
-  EXPECT_FALSE(a == c);
-  EXPECT_FALSE(b == c);
-  EXPECT_FALSE(c == a);
-  EXPECT_FALSE(c == b);
-
-  ++a;
-  EXPECT_TRUE(a == b);
-  EXPECT_TRUE(b == a);
-}
-
-// Test to see whether we can reliably roundtrip metrics through
-// the registry without molestation
-TEST_F(PersistentMetricsIteratorWin32Test, UnmolestedValues) {
-  EXPECT_TRUE(WriteStats());
-
-  MetricsMap metrics;
-  IndexMetrics(&metrics);
-
-  PersistentMetricsIteratorWin32 it(kAppName), end;
-  int count = 0;
-  for (; it != end; ++it) {
-    MetricsMap::iterator found = metrics.find(it->name());
-
-    // make sure we found it, and that it's unmolested in value
-    EXPECT_TRUE(found != metrics.end() && equals(found->second, *it));
-    count++;
-  }
-
-  // Did we visit all metrics?
-  EXPECT_EQ(count, metrics.size());
-}
diff --git a/statsreport/util-win32.h b/statsreport/util-win32.h
deleted file mode 100644
index 22f7068..0000000
--- a/statsreport/util-win32.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Utility functions for Win32 stats aggregation and uploading
-#ifndef OMAHA_STATSREPORT_UTIL_WIN32_H__
-#define OMAHA_STATSREPORT_UTIL_WIN32_H__
-
-namespace stats_report {
-
-template <class ValueType>
-bool GetData(CRegKey &parent, const wchar_t *value_name, ValueType *value) {
-  ULONG len = sizeof(ValueType);
-  LONG err = parent.QueryBinaryValue(value_name, value, &len);
-  if (ERROR_SUCCESS != err || len != sizeof(ValueType)) {
-    memset(value, 0, sizeof(ValueType));
-    return false;
-  }
-
-  return true;
-}
-
-} // namespace stats_report
-
-#endif  // OMAHA_STATSREPORT_UTIL_WIN32_H__
diff --git a/test/build.scons b/test/build.scons
deleted file mode 100644
index c109412..0000000
--- a/test/build.scons
+++ /dev/null
@@ -1,243 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-import binascii
-import md5
-from enterprise.installer import build_enterprise_installer
-
-
-def BuildMSI(version, namespace, exe_name, wxs_template, msi_base_name,
-             is_enterprise=False, prefix=''):
-  if is_enterprise:
-    msi_base_name = 'enterprise_' + msi_base_name
-  msi_base_name = prefix + msi_base_name
-
-  # Have to use 'copy' here because we are renaming the file, and it is being
-  # renamed to match the final msi name to avoid collisions in the wixobj files.
-  copy_target = env.Command(
-      target=msi_base_name + '.wxs',
-      source=wxs_template,
-      action='@copy /y $SOURCE $TARGET',
-  )
-
-  PRODUCT_GUID = build_enterprise_installer.GenerateNameBasedGUID(
-      namespace,
-      'Product ' + version
-  )
-  COMPONENT_GUID = build_enterprise_installer.GenerateNameBasedGUID(
-      namespace,
-      'Component ' + version
-  )
-  COMPONENT_GUID_REGISTRY = build_enterprise_installer.GenerateNameBasedGUID(
-      namespace,
-      'Component Registry ' + version
-  )
-  COMPONENT_GUID_NOTIFY_SUCCESS = (
-      build_enterprise_installer.GenerateNameBasedGUID(
-          namespace,
-          'Component Notify Success ' + version
-      ))
-  COMPONENT_GUID_REGISTER_LAUNCH = (
-      build_enterprise_installer.GenerateNameBasedGUID(
-          namespace,
-          'Component Register Launch Command ' + version
-      ))
-  COMPONENT_GUID_NOTIFY_FAILED = (
-      build_enterprise_installer.GenerateNameBasedGUID(
-          namespace,
-          'Component Notify Failed ' + version
-      ))
-  COMPONENT_GUID_PROPERTY_BAR = (
-      build_enterprise_installer.GenerateNameBasedGUID(
-          namespace,
-          'Component Property Bar ' + version
-      ))
-
-  wix_env = env.Clone()
-  wix_env.Append(
-      WIXLIGHTFLAGS = [
-          # Add a supress for:
-          # warning LGHT1076 : ICE91: The file will be installed to the per user
-          # directory that doesn't vary based on ALLUSERS value. This file won't
-          # be copied to each user's profile even if a per machine installation
-          # is desired.
-          # This warning is generated by light when we produce a user only
-          # installer, and can be ignored as this is a user only installer.
-          '-sw1076'
-          ],
-      WIXCANDLEFLAGS = [
-          '-dFooExePath=' + wix_env.File(exe_name).abspath,
-          '-dFooVersion=' + version,
-          '-dFooProductGuid=' + PRODUCT_GUID,
-          '-dFooComponentGuid=' + COMPONENT_GUID,
-          '-dFooComponentGuidRegistry=' + COMPONENT_GUID_REGISTRY,
-          '-dFooComponentGuidNotifySuccess=' + COMPONENT_GUID_NOTIFY_SUCCESS,
-          '-dFooComponentRegisterLaunchCommand=' +
-              COMPONENT_GUID_REGISTER_LAUNCH,
-          '-dFooComponentGuidNotifyFailed=' + COMPONENT_GUID_NOTIFY_FAILED,
-          '-dFooComponentGuidPropertyBar=' + COMPONENT_GUID_PROPERTY_BAR,
-          ],
-  )
-
-  wix_inputs = copy_target
-  # Force a rebuild when the exe file changes.
-  additional_dependencies = [exe_name]
-
-  if is_enterprise:
-    output_dir = '$TARGET_ROOT/Test_Installers'
-    wix_env['WIXCANDLEFLAGS'] += ['-dIsEnterprise=1']
-
-    # The metainstaller change does not get passed through even though the
-    # .wixobj file is rebuilt because the hash of the .wixobj does not change.
-    metainstaller_path = '$STAGING_DIR/%sGoogleUpdateSetup.exe' % (prefix)
-    google_update_wixobj = build_enterprise_installer.BuildGoogleUpdateFragment(
-            env,
-            metainstaller_path,
-            'Test Foo',
-            version,
-            '{D6B08267-B440-4c85-9F79-E195E80D9937}',
-            '&ap=enterprise',
-            msi_base_name,
-            ('$MAIN_DIR/enterprise/installer/'
-                'google_update_installer_fragment.wxs.xml')
-    )
-
-    wix_inputs += [google_update_wixobj]
-    additional_dependencies += [metainstaller_path]
-  else:
-    output_dir = '$TESTS_DIR'
-    wix_env['WIXCANDLEFLAGS'] += ['-dIsEnterprise=0']
-
-  unsigned_msi = wix_env.WiX('unsigned_%s.msi' % msi_base_name, wix_inputs)
-
-  wix_env.Depends(unsigned_msi, additional_dependencies)
-
-  signed_output = env.SignedBinary(
-      target=msi_base_name + '.msi',
-      source=unsigned_msi,
-  )
-
-  env.Replicate(output_dir, signed_output)
-
-_GUID_NAMESPACE = binascii.a2b_hex('BE19B3E4502845af8B3E67A99FCDCFB1')
-_USER_GUID_NAMESPACE = binascii.a2b_hex('2B599C061F7C4eed9D686616EEBDDFDB')
-
-# test_foo.wxs.xml is so named because SCons tries to apply WiX building
-# rules to any input file with the .wxs suffix even in a custom command.
-_WXS_TEMPLATE_NAME = 'test_foo.wxs.xml'
-_USER_WXS_TEMPLATE_NAME = 'user_app.wxs.xml'
-
-for (major, minor, build, patch) in [(1,0,101,0), (1,0,102,0)]:
-  version = '%d.%d.%d.%d' % (major, minor, build, patch)
-  msi_base_name = 'test_foo_v' + version
-
-  ver_env = env.Clone()
-  ver_env.Append(
-      LIBS = [
-          ('libcmt.lib', 'libcmtd.lib')[env.Bit('debug')],
-          ('libcpmt.lib', 'libcpmtd.lib')[env.Bit('debug')],
-          'version.lib',
-          ],
-      RCFLAGS = [
-          '-DVERSION_STRING=%s' % version,
-          '-DMAJOR=%s' % major,
-          '-DMINOR=%s' % minor,
-          '-DBUILD=%s' % build,
-          '-DPATCH=%s' % patch
-          ],
-  )
-
-  ver_env['OBJPREFIX'] = '%s%s/' % (ver_env['OBJPREFIX'], version)
-
-  base_name = 'test_foo_v%s' % version.replace('.', '_')
-  signed_target_name = base_name + '.exe'
-  target_name = base_name + '_unsigned'
-
-  unsigned_exe = ver_env.ComponentTestProgram(
-      prog_name=target_name,
-      source=[
-          'test_foo.cc',
-          ver_env.RES('test_foo_v%s.res' % version, 'test_foo.rc'),
-          ],
-      COMPONENT_TEST_RUNNABLE=False
-  )
-
-  signed_output = ver_env.SignedBinary(
-      target=signed_target_name,
-      source=unsigned_exe,
-  )
-
-  ver_env.Replicate('$TESTS_DIR', signed_output)
-
-  signed_exe = signed_output[0]
-
-  BuildMSI(version, _GUID_NAMESPACE, signed_exe, _WXS_TEMPLATE_NAME,
-           msi_base_name)
-
-  # Build the enterprise installer for each version of Omaha.
-  for omaha_version_info in ver_env['omaha_versions_info']:
-    prefix = omaha_version_info.filename_prefix
-
-    BuildMSI(version, _GUID_NAMESPACE, signed_exe, _WXS_TEMPLATE_NAME,
-             msi_base_name, is_enterprise=True, prefix=prefix)
-
-  BuildMSI(version, _USER_GUID_NAMESPACE, signed_exe, _USER_WXS_TEMPLATE_NAME,
-           'user_app_v' + version)
-
-bar_env = env.Clone()
-bar_env.Append(
-    LIBS = [
-        ('libcmt.lib', 'libcmtd.lib')[env.Bit('debug')],
-        ('libcpmt.lib', 'libcpmtd.lib')[env.Bit('debug')],
-        ],
-)
-bar_env.ComponentTestProgram(prog_name='test_bar',
-                             source='test_bar.cc',
-                             COMPONENT_TEST_RUNNABLE=False)
-
-
-""" This is commented out because it step_test is currently unused,
-    and may be removed. Remove this if/when step_test is removed.
-
-omaha_system_env = env.Clone()
-omaha_system_env.Append(
-    CPPDEFINES = [
-        'UNICODE',
-        '_UNICODE'
-        ],
-    LIBS = [
-        '$LIB_PATH/common.lib',
-        ('atls.lib', 'atlsd.lib')[env.Bit('debug')],
-        ('libcmt.lib', 'libcmtd.lib')[env.Bit('debug')],
-        ('libcpmt.lib', 'libcpmtd.lib')[env.Bit('debug')],
-        ],
-)
-
-
-omaha_system_env.FilterOut(LINKFLAGS = ['/SUBSYSTEM:WINDOWS'])
-omaha_system_env['LINKFLAGS'] += ['/SUBSYSTEM:CONSOLE']
-
-omaha_system_env.ComponentTestProgram([
-    'omaha_system_test.cc',
-    'step_test.cc',
-    ],
-    COMPONENT_TEST_RUNNABLE=False
-)
-"""
-
diff --git a/test/omaha_system_test.cc b/test/omaha_system_test.cc
deleted file mode 100644
index c578d4f..0000000
--- a/test/omaha_system_test.cc
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#pragma warning(push)
-// C4548: expression before comma has no effect
-#pragma warning(disable : 4548)
-#include <atlstr.h>
-#pragma warning(pop)
-#include <regstr.h>
-#include "omaha/mi_exe_stub/mi_step_test.h"
-#include "omaha/test/step_test.h"
-
-class MIWatcher : public StepTestWatcher {
-public:
-  MIWatcher() : StepTestWatcher(MI_STEP_TEST_NAME),
-    system_should_be_clean_(true) {
-  }
-
-  ~MIWatcher() {
-  }
-
-protected:
-  bool VerifyStep(DWORD step, bool *testing_complete) {
-    bool result = true;
-    switch (step) {
-      case MI_STEP_VERIFY_PRECONDITIONS:
-        if (system_should_be_clean_) {
-          result = VerifyCleanSystem();
-        } else {
-          result = false;
-          _tprintf(_T("Unexpected state.\r\n"));
-        }
-        break;
-      case MI_STEP_PROGRAM_START:
-        if (system_should_be_clean_) {
-          result = VerifyCleanSystem();
-          system_should_be_clean_ = false;
-        } else {
-          result = false;
-          _tprintf(_T("Unexpected state.\r\n"));
-        }
-          break;
-      case MI_STEP_PROGRAM_END:
-        result  = VerifyTestFooInstalled();
-        result &= VerifyOmahaInstalled();
-        break;
-    }
-    *testing_complete = (step >= MI_STEP_PROGRAM_END);
-    return result;
-  }
-
-  void PrintIntroduction() {
-    _tprintf(
-      _T("Ready to test mi.exe.\r\n")
-      _T("System should not have any version of Omaha installed on it.\r\n")
-      _T("System should not have any version of \"!!! Test Foo\" installed on it.\r\n")
-      _T("Please run SampleSetup.exe now.\r\n")
-    );
-  }
-
-  void PrintConclusion() {
-    _tprintf(
-      _T("Test of mi.exe is complete.\r\n")
-    );
-  }
-
-private:
-  bool system_should_be_clean_;
-
-#define TEST_FOO_REG_UNINST_KEY "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{8EE7241A-9AFD-324A-884C-B62DC5DAE506}"
-#define TEST_FOO_V2_REG_UNINST_KEY "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{EE93BF87-0CDD-3F0B-A4D6-3B3A1C54E3FA}"
-
-  bool VerifyCleanSystem() {
-    if (RegistryKeyExists(HKEY_LOCAL_MACHINE, _T(TEST_FOO_REG_UNINST_KEY))) {
-      _tprintf(_T("Product !!! Test Foo (old version) appears to be installed on this system.\r\n"));
-      return false;
-    }
-    if (RegistryKeyExists(HKEY_LOCAL_MACHINE, _T(TEST_FOO_V2_REG_UNINST_KEY))) {
-      _tprintf(_T("Product !!! Test Foo appears to be installed on this system.\r\n"));
-      return false;
-    }
-    if (RegistryValueExists(HKEY_LOCAL_MACHINE, REGSTR_PATH_RUN, _T("Google Update"))) {
-      _tprintf(_T("Omaha Run key is present on this system.\r\n"));
-      return false;
-    }
-    return true;
-  }
-
-  bool VerifyTestFooInstalled() {
-    if (!RegistryKeyExists(HKEY_LOCAL_MACHINE, _T(TEST_FOO_V2_REG_UNINST_KEY))) {
-      _tprintf(_T("Product !!! Test Foo is not installed on this system.\r\n"));
-      return false;
-    }
-    return true;
-  }
-
-  bool VerifyOmahaInstalled() {
-    if (!RegistryValueExists(HKEY_LOCAL_MACHINE, REGSTR_PATH_RUN, _T("Google Update"))) {
-      _tprintf(_T("Omaha Run key is missing on this system.\r\n"));
-      return false;
-    }
-    return true;
-  }
-};
-
-int main() {
-
-  MIWatcher watcher;
-  watcher.Go();
-  return 0;
-}
diff --git a/test/step_test.cc b/test/step_test.cc
deleted file mode 100644
index ed0625d..0000000
--- a/test/step_test.cc
+++ /dev/null
@@ -1,157 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/test/step_test.h"
-
-const TCHAR *StepTestBase::RESUME_EVENT_TEMPLATE = _T("R %s");
-const TCHAR *StepTestBase::STEP_REACHED_EVENT_TEMPLATE = _T("SR %s");
-const TCHAR *StepTestBase::STATE_REG_KEY_TEMPLATE = _T("SOFTWARE\\GAT %s");
-const TCHAR *StepTestBase::STATE_REG_VALUE_NAME = _T("state");
-
-StepTestBase::StepTestBase(const TCHAR*) : step_reached_event_(NULL),
-resume_event_(NULL), state_key_(NULL) {
-}
-
-void StepTestBase::Terminate() {
-  CloseHandle(step_reached_event_);
-  CloseHandle(resume_event_);
-  RegCloseKey(state_key_);
-}
-
-StepTestBase::~StepTestBase() {
-  Terminate();
-}
-
-StepTestStepper::StepTestStepper(const TCHAR* name) :
-  StepTestBase(name),
-  is_someone_listening_(false) {
-  CString namebuf;
-
-  // A "broadcaster" is a program that notifies the "listener" program that
-  // the broadcaster has reached an interesting point in its execution, and
-  // the listener should check state.
-  //
-  // Results will be unpredictable if two broadcasters are running at the
-  // same time. However, since a broadcaster will only open the resume event
-  // and not create it, we shouldn't see any problems where two broadcasters
-  // deadlock each other.
-  namebuf.Format(RESUME_EVENT_TEMPLATE, name);
-  resume_event_ = OpenEvent(EVENT_ALL_ACCESS, FALSE, namebuf);
-  if (resume_event_ != NULL) {
-    is_someone_listening_ = true;
-
-    namebuf.Format(STEP_REACHED_EVENT_TEMPLATE, name);
-    step_reached_event_ = OpenEvent(EVENT_ALL_ACCESS, FALSE, namebuf);
-
-    namebuf.Format(STATE_REG_KEY_TEMPLATE, name);
-    RegCreateKeyEx(HKEY_CURRENT_USER, namebuf, 0, NULL, REG_OPTION_VOLATILE,
-      KEY_READ | KEY_WRITE, NULL, &state_key_, NULL);
-  } else {
-    Terminate();
-  }
-}
-
-StepTestStepper::~StepTestStepper() {
-  Terminate();
-}
-
-void StepTestStepper::Step(DWORD step) {
-  if (!is_someone_listening_) {
-    return;
-  }
-  RegSetValueEx(state_key_, STATE_REG_VALUE_NAME, 0, REG_DWORD,
-    reinterpret_cast<BYTE*>(&step), sizeof(step));
-  SetEvent(step_reached_event_);
-  WaitForSingleObject(resume_event_, INFINITE);
-}
-
-StepTestWatcher::StepTestWatcher(const TCHAR* name) : StepTestBase(name),
-  name_(name) {
-}
-
-StepTestWatcher::~StepTestWatcher() {
-  Terminate();
-}
-
-void StepTestWatcher::Go() {
-  DWORD step = 0;
-  bool done = false;
-
-  PrintIntroduction();
-
-  printf("Verifying preconditions...\r\n");
-  bool passed = VerifyStep(0, &done);
-  if (passed) {
-    _tprintf(_T("Preconditions OK.\r\n"));
-  } else {
-    _tprintf(_T("*** Preconditions FAILED. ***\r\n"));
-  }
-
-  CString namebuf;
-
-  namebuf.Format(RESUME_EVENT_TEMPLATE, name_);
-  resume_event_ = CreateEvent(NULL, FALSE, FALSE, namebuf);
-  namebuf.Format(STEP_REACHED_EVENT_TEMPLATE, name_);
-  step_reached_event_ = CreateEvent(NULL, FALSE, FALSE, namebuf);
-
-  namebuf.Format(STATE_REG_KEY_TEMPLATE, name_);
-  RegCreateKeyEx(HKEY_CURRENT_USER, namebuf, 0, NULL, REG_OPTION_VOLATILE,
-    KEY_READ, NULL, &state_key_, NULL);
-
-  printf("Begin test now.\r\n");
-
-  done = false;
-  while (!done) {
-    WaitForSingleObject(step_reached_event_, INFINITE);
-    DWORD step_size = sizeof(step);
-    RegQueryValueEx(state_key_, STATE_REG_VALUE_NAME, NULL, NULL,
-      reinterpret_cast<BYTE*>(&step), &step_size);
-    printf("Testing step %d.\r\n", step);
-    passed = VerifyStep(step, &done);
-    if (!passed) {
-      _tprintf(_T("\r\n\r\n*** TEST FAILURE: Step %d. ***\r\nr\n"), step);
-    }
-    SetEvent(resume_event_);
-  }
-
-  PrintConclusion();
-}
-
-bool StepTestWatcher::RegistryKeyExists(HKEY root, const TCHAR* name) {
-  HKEY key;
-  LONG result = RegOpenKeyEx(root, name, 0, KEY_READ, &key);
-  if (ERROR_SUCCESS == result) {
-    RegCloseKey(key);
-    return true;
-  }
-  return false;
-}
-
-bool StepTestWatcher::RegistryValueExists(HKEY root, const TCHAR* key_name,
-                                          const TCHAR* value_name) {
-  bool result = false;
-  HKEY key;
-  LONG reg_result = RegOpenKeyEx(root, key_name, 0, KEY_READ, &key);
-  if (ERROR_SUCCESS == reg_result) {
-    DWORD dummy_size = 0;
-    reg_result = RegQueryValueEx(key, value_name, NULL, NULL, NULL,
-      &dummy_size);
-    if (reg_result == ERROR_SUCCESS && dummy_size > 0) {
-      result = true;
-    }
-    RegCloseKey(key);
-  }
-  return result;
-}
diff --git a/test/step_test.h b/test/step_test.h
deleted file mode 100644
index 2905a9c..0000000
--- a/test/step_test.h
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#pragma warning(push)
-// C4548: expression before comma has no effect
-#pragma warning(disable : 4548)
-#include <atlstr.h>
-#pragma warning(pop)
-
-// Overview
-//
-// The program to be tested instantiates a StepTestStepper, passing in a
-// unique identifier (by convention, a GUID in registry format). It then
-// calls StepTestStepper::Step() with values representing specific points in
-// execution of the program.
-//
-// Then in test/omaha_system_test.cpp, derive a concrete subclass of
-// StepTestWatcher. In particular, implement VerifyStep(), which takes each of
-// the values passed in through the tested program's StepTestStepper::Step()
-// function, and verifies that the state of the system matches what it should
-// be.
-
-class StepTestBase {
-public:
-  StepTestBase(const TCHAR *name);
-  virtual ~StepTestBase();
-
-protected:
-  HANDLE step_reached_event_;
-  HANDLE resume_event_;
-  HKEY state_key_;
-
-  static const TCHAR *RESUME_EVENT_TEMPLATE;
-  static const TCHAR *STEP_REACHED_EVENT_TEMPLATE;
-  static const TCHAR *STATE_REG_KEY_TEMPLATE;
-  static const TCHAR *STATE_REG_VALUE_NAME;
-
-  void Terminate();
-};
-
-class StepTestStepper : public StepTestBase {
-public:
-  StepTestStepper(const TCHAR *name);
-  virtual ~StepTestStepper();
-
-  void Step(DWORD step);
-private:
-  bool is_someone_listening_;
-};
-
-class StepTestWatcher : public StepTestBase {
-public:
-  StepTestWatcher(const TCHAR *name);
-  virtual ~StepTestWatcher();
-
-  void Go();
-
-protected:
-  // Checks the state of the machine once the tested program has reached the
-  // given step.
-  //
-  // @param step: the step to be verified
-  // @param testing_complete: pointer to bool that should be set to true iff
-  // the testing instance is done testing and should now terminate.
-  // @return true iff the test of this step passed.
-  virtual bool VerifyStep(DWORD step, bool *testing_complete) = 0;
-
-  // Prints instructions to the console telling the human tester what the
-  // expected setup of the system should be.
-  virtual void PrintIntroduction() = 0;
-
-  // Prints a statement to the console indicating that testing is complete.
-  virtual void PrintConclusion() = 0;
-
-  // Returns true iff the given registry key exists on this machine.
-  bool RegistryKeyExists(HKEY root, const TCHAR *name);
-
-  // Returns true iff the given registry value exists on this machine.
-  bool RegistryValueExists(HKEY root, const TCHAR *key_name,
-    const TCHAR *value_name);
-
-  CString name_;
-};
diff --git a/test/test_bar.cc b/test/test_bar.cc
deleted file mode 100644
index 6236249..0000000
--- a/test/test_bar.cc
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-#include <tchar.h>
-
-// This file implements a tiny program that puts up a MessageBox and exits.
-// It's useful for generating test installation targets.
-int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) {
-  MessageBox(NULL, _T("I am bar"), _T("bar"), MB_OK | MB_ICONINFORMATION);
-  return 0;
-}
diff --git a/test/test_foo.cc b/test/test_foo.cc
deleted file mode 100644
index 905c492..0000000
--- a/test/test_foo.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include <windows.h>
-#include <tchar.h>
-
-// This file implements a tiny program that puts up a MessageBox and exits.
-// It's useful for generating test installation targets.
-int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int) {
-  TCHAR my_path[MAX_PATH];
-  char ver_buf[2048];
-  VS_FIXEDFILEINFO *ffi = NULL;
-  UINT ver_len = 0;
-  GetModuleFileName(hInstance, my_path, MAX_PATH);
-  GetFileVersionInfo(my_path, NULL, 2048, ver_buf);
-  VerQueryValue(ver_buf, _T("\\"), reinterpret_cast<LPVOID *>(&ffi), &ver_len);
-
-  TCHAR msgbuf[256];
-  _sntprintf(msgbuf, 256, _T("I am foo v. %d.%d.%d.%d!"),
-    HIWORD(ffi->dwFileVersionMS),
-    LOWORD(ffi->dwFileVersionMS),
-    HIWORD(ffi->dwFileVersionLS),
-    LOWORD(ffi->dwFileVersionLS));
-  MessageBox(NULL, msgbuf, _T("foo"), MB_OK | MB_ICONINFORMATION);
-  return 0;
-}
diff --git a/test/test_foo.rc b/test/test_foo.rc
deleted file mode 100644
index a9d997b..0000000
--- a/test/test_foo.rc
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Microsoft Visual C++ generated resource script.
-//
-#include "test/test_foo_resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "afxres.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
-    "test/test_foo_resource.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
-    "#include ""afxres.h""\r\n"
-    "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
-    "\r\n"
-    "\0"
-END
-
-#endif    // APSTUDIO_INVOKED
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION MAJOR,MINOR,BUILD,PATCH
- PRODUCTVERSION MAJOR,MINOR,BUILD,PATCH
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "040904e4"
-        BEGIN
-            VALUE "CompanyName", "Google Inc."
-            VALUE "FileDescription", "test_foo.exe"
-            VALUE "FileVersion", VERSION_STRING
-            VALUE "LegalCopyright", "Copyright 2007-2010 Google Inc."
-            VALUE "InternalName", "test_foo.exe"
-            VALUE "OriginalFilename", "test_foo.exe"
-            VALUE "ProductName", "test_foo.exe"
-            VALUE "ProductVersion", VERSION_STRING
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x409, 1252
-    END
-END
-
-#endif    // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif    // not APSTUDIO_INVOKED
-
diff --git a/test/test_foo.wxs.xml b/test/test_foo.wxs.xml
deleted file mode 100644
index 79a4891..0000000
--- a/test/test_foo.wxs.xml
+++ /dev/null
@@ -1,182 +0,0 @@
-<?xml version='1.0'?>
-<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
-  <?define UpgradeCode='96E1371A-A5A1-45cc-8E67-2EF6ABDE054D' ?>
-
-   <Product Id='$(var.FooProductGuid)' Name='!!! Test Foo' Language='1033'
-     Version='$(var.FooVersion)' Manufacturer='Google, Inc.'
-     UpgradeCode='$(var.UpgradeCode)'>
-
-        <!--
-        This file has all the values necessary to report success or failure.
-        It can also be made to report neither (for testing failure cases).
-        Note that the way failure is generated is NOT how it should be done for
-        real installers. See FooNotifyFailed for details.
-
-        This file supports several scenarios. Enabling each one is described below.
-        * Success (default)
-          - Do not specify any properties
-        * Success and tell Omaha to launch Foo
-          - Specify REGISTER_LAUNCH_COMMAND property (any value)
-        * Failure
-          - Specify the NOTIFY_FAILURE property (any value)
-        * No result reported (Omaha will use exit code)
-          - Specify the DO_NOT_NOTIFY_SUCCESS property (any value)
-
-        The registry value propbar can be written.
-          - Specify the PROPBAR property with value 7.
-
-        This file also supports failing product condtions. In this case, no
-        success or failure value is written, as would happen with real
-        installers.
-          - Specify the FAIL_PRODUCT_CONDITION property (any value)
-        -->
-
-        <Package Id='*'
-           Description='Test Foo'
-           Comments='Copyright 2007-2010 Google Inc.'
-           Manufacturer='Google Inc.'
-           InstallerVersion='200'
-           Compressed='yes' />
-
-        <Upgrade Id='$(var.UpgradeCode)'>
-          <UpgradeVersion Property='UPGRADING'
-                          OnlyDetect='no'
-                          Minimum='0.0.0.0' IncludeMinimum='yes'
-                          Maximum='$(var.FooVersion)' IncludeMaximum='no' />
-          <UpgradeVersion Property='NEWERVERSIONDETECTED'
-                          OnlyDetect='yes'
-                          Minimum='$(var.FooVersion)' IncludeMinimum='yes' />
-        </Upgrade>
-
-        <!-- Omaha id -->
-        <Property Id='UPDATE2_ID'>{D6B08267-B440-4c85-9F79-E195E80D9937}</Property>
-
-        <InstallExecuteSequence>
-          <!--  We can either put RemoveExistingProducts after InstallValidate
-            or InstallFinalize.
-            1) After InstallValidate
-               * The old verion goes away anyway no matter if the new version
-                 has been installed successfully.
-            2) After InstallFinalize
-               * Might leave both old version and new version in the system if
-                 MSI fails to uninstall the old version.
-               * Will remove files and registry entries, including Omaha
-                 registration, for the new version. Thus, we cannot use this
-                 option without adding complexity. Reference:
-                 http://blogs.msdn.com/astebner/archive/2007/09/06/4798334.aspx
-          -->
-          <RemoveExistingProducts After='InstallValidate'>UPGRADING</RemoveExistingProducts>
-          <Custom Action="NewerVersionError" After="FindRelatedProducts">NEWERVERSIONDETECTED</Custom>
-        </InstallExecuteSequence>
-
-        <CustomAction Id="NewerVersionError" Error="4000"/>
-
-        <Property Id="ALLUSERS"><![CDATA[1]]></Property>
-
-        <Media Id='1' Cabinet='product.cab' EmbedCab='yes' CompressionLevel='high' />
-
-        <Directory Id='TARGETDIR' Name='SourceDir'>
-          <Directory Id='ProgramFilesFolder'>
-            <Directory Id='FooDir' Name='Test Foo'>
-              <Directory Id='FooVersion' Name='$(var.FooVersion)'>
-                <Component Id='FooFiles' Guid='$(var.FooComponentGuid)'>
-                  <File Id='test_foo' Vital='yes' Name='test_foo.exe'
-                    DiskId='1' Source="$(var.FooExePath)"/>
-                </Component>
-              </Directory>
-              <Component Id='FooReg' Guid='$(var.FooComponentGuidRegistry)'>
-                <RegistryValue Root='HKLM'
-                  Key='Software\Google\Update\Clients\[UPDATE2_ID]'
-                  Name='name' Value="test_foo"
-                  Action='write' Type='string' />
-                <RegistryValue Root='HKLM'
-                  Key='Software\Google\Update\Clients\[UPDATE2_ID]'
-                  Name='pv' Value="$(var.FooVersion)"
-                  Action='write' Type='string' />
-              </Component>
-              <Component Id='FooNotifySuccess' Guid='$(var.FooComponentGuidNotifySuccess)'>
-                <!-- Controls whether to notify success. -->
-                <Condition>NOT NOTIFY_FAILURE AND NOT DO_NOT_NOTIFY_SUCCESS</Condition>
-                <RegistryValue Root='HKLM'
-                  Key='Software\Google\Update\ClientState\[UPDATE2_ID]'
-                  Name='InstallerResult' Value="0"
-                  Action='write' Type='integer' />
-                <RegistryValue Root='HKLM'
-                  Key='Software\Google\Update\ClientState\[UPDATE2_ID]'
-                  Name='InstallerError' Value="1234"
-                  Action='write' Type='integer' />
-              </Component>
-              <Component Id='FooRegisterLaunchCommand'
-                         Guid='$(var.FooComponentRegisterLaunchCommand)'>
-                <!-- Controls whether to notify success. -->
-                <Condition>REGISTER_LAUNCH_COMMAND AND NOT DO_NOT_NOTIFY_SUCCESS</Condition>
-                <RegistryValue Root='HKLM'
-                  Key='Software\Google\Update\ClientState\[UPDATE2_ID]'
-                  Name='InstallerSuccessLaunchCmdLine' Value="&quot;[#test_foo]&quot;"
-                  Action='write' Type='string' />
-              </Component>
-              <!--
-              Writes the registry entries that indicate failure.
-              This method of writing the registry for failures is only useful
-              for simple testing.
-              Real installers will NOT report failure in this way.
-              They would report the failure in custom action code.
-              The reason is that this component will only get run and the
-              side effects left in place if success succeeds.
-              -->
-              <Component Id='FooNotifyFailed' Guid='$(var.FooComponentGuidNotifyFailed)'>
-                <!-- Controls whether to notify failure. -->
-                <Condition>NOTIFY_FAILURE</Condition>
-                <RegistryValue Root='HKLM'
-                  Key='Software\Google\Update\ClientState\[UPDATE2_ID]'
-                  Name='InstallerResult' Value="1"
-                  Action='write' Type='integer' />
-                <RegistryValue Root='HKLM'
-                  Key='Software\Google\Update\ClientState\[UPDATE2_ID]'
-                  Name='InstallerError' Value="99"
-                  Action='write' Type='integer' />
-                <RegistryValue Root='HKLM'
-                  Key='Software\Google\Update\ClientState\[UPDATE2_ID]'
-                  Name='InstallerResultUIString' Value="&lt;b&gt;Test Foo&lt;/b&gt; installation failed because it wanted to! For more information visit &lt;a=http://labs.google.com/&gt;http://labs.google.com/&lt;/a&gt;."
-                  Action='write' Type='string' />
-              </Component>
-              <Component Id='FooPropBar' Guid='$(var.FooComponentGuidPropertyBar)'>
-                <!-- Controls whether to write propbar. -->
-                <Condition>PROPBAR=7</Condition>
-                <RegistryValue Root='HKLM'
-                  Key='Software\Google\Update\ClientState\[UPDATE2_ID]'
-                  Name='propbar' Value="7"
-                  Action='write' Type='integer' />
-              </Component>
-            </Directory>
-         </Directory>
-      </Directory>
-
-      <Feature Id='Foo' Title='Foo' Level='1'>
-        <ComponentRef Id='FooFiles' />
-        <ComponentRef Id='FooReg' />
-        <ComponentRef Id='FooNotifySuccess' />
-        <ComponentRef Id='FooRegisterLaunchCommand' />
-        <ComponentRef Id='FooNotifyFailed' />
-        <ComponentRef Id='FooPropBar' />
-<?if $(var.IsEnterprise) = 1 ?>
-        <ComponentRef Id='ComponentGoogleUpdate' />
-<?endif?>
-      </Feature>
-      <Property Id="UILevel"><![CDATA[1]]></Property>
-
-      <Condition Message='Test Foo runs only on Windows 2000 Service Pack 3 and later.'>
-        (VersionNT = 500 AND ServicePackLevel = 3) OR VersionNT >= 501
-      </Condition>
-
-     <Condition Message='The FAIL_PRODUCT_CONDITION property was specified.'>
-       NOT FAIL_PRODUCT_CONDITION
-     </Condition>
-
-     <UI>
-       <Error Id="4000">A newer version of this product is already installed.</Error>
-     </UI>
-
-   </Product>
-</Wix>
-
diff --git a/test/test_foo_resource.h b/test/test_foo_resource.h
deleted file mode 100644
index 731ce08..0000000
--- a/test/test_foo_resource.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by setup_grp.rc
-//
-
-// Next default values for new objects
-// 
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        101
-#define _APS_NEXT_COMMAND_VALUE         40001
-#define _APS_NEXT_CONTROL_VALUE         1001
-#define _APS_NEXT_SYMED_VALUE           101
-#endif
-#endif
diff --git a/test/user_app.wxs.xml b/test/user_app.wxs.xml
deleted file mode 100644
index fdd023a..0000000
--- a/test/user_app.wxs.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version='1.0'?>
-<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
-   <Product Id='$(var.FooProductGuid)' Name='!!! User Test Foo' Language='1033'
-     Version="$(var.FooVersion)" Manufacturer='Google'
-     UpgradeCode='97781963-8283-4602-A9DA-CAE7A5536C75'>
-     <Package Id='*'
-       Description='User Test Foo'
-       Comments='Copyright 2007-2010 Google Inc.'
-       Manufacturer='Google Inc.'
-       InstallerVersion='200'
-       Compressed='yes' />
-
-      <Upgrade Id='97781963-8283-4602-A9DA-CAE7A5536C75'>
-        <UpgradeVersion Property='UPGRADING'
-                        OnlyDetect='no'
-                        Minimum='0.0.0.0' IncludeMinimum='yes'
-                        Maximum='$(var.FooVersion)' IncludeMaximum='no' />
-        <UpgradeVersion Property='NEWERVERSIONDETECTED' 
-                        OnlyDetect='yes'
-                        Minimum='$(var.FooVersion)' IncludeMinimum='yes' />
-      </Upgrade>
-
-     <InstallExecuteSequence>
-       <RemoveExistingProducts After='InstallValidate'>UPGRADING</RemoveExistingProducts>
-     </InstallExecuteSequence>
-
-     <Media Id='1' Cabinet='product.cab' EmbedCab='yes' CompressionLevel='high' />
-
-     <Directory Id='TARGETDIR' Name='SourceDir'>
-       <Directory Id='LocalAppDataFolder' Name='PFiles'>
-          <Directory Id='UserFooDir' Name='UserTestFoo'>
-            <Directory Id='UserFooVersion' Name='$(var.FooVersion)'>
-              <Component Id='UserFooFiles' Guid='$(var.FooComponentGuid)'>
-                <File Id='test_foo' Vital='yes' Name='test_foo.exe'
-                  DiskId='1' Source="$(var.FooExePath)"/>
-                <RegistryValue Id='test_foo' Root='HKCU' Key='Software\Microsoft\RunAs\KeyPaths' Type='string' Value='test_foo.exe' KeyPath='yes' />
-                <RemoveFolder Id='UserFooVersion' Directory='UserFooVersion' On='uninstall'/>
-                <RemoveFolder Id='UserFooDir' Directory='UserFooDir' On='uninstall'/>
-                <Condition>NOT (ALLUSERS)</Condition>
-              </Component>
-            </Directory>
-            <Component Id='UserFooReg' Guid='$(var.FooComponentGuidRegistry)'>
-              <RegistryValue Root='HKCU'
-                Key='Software\Google\Update\Clients\{104844D6-7DDA-460b-89F0-FBF8AFDD0A67}'
-                Name='name' Value="user_test_foo"
-                Action='write' Type='string' />
-              <RegistryValue Root='HKCU'
-                Key='Software\Google\Update\Clients\{104844D6-7DDA-460b-89F0-FBF8AFDD0A67}'
-                Name='pv' Value="$(var.FooVersion)"
-                Action='write' Type='string' />
-              <Condition>NOT (ALLUSERS)</Condition>
-            </Component>
-          </Directory>
-       </Directory>
-     </Directory>
- 
-     <Feature Id='Foo' Title='Foo' Level='1'>
-       <ComponentRef Id='UserFooFiles' />
-       <ComponentRef Id='UserFooReg' />
-     </Feature>
-     <Property Id="UILevel"><![CDATA[1]]></Property>
-
-     <Condition Message='Test Foo runs only on Windows 2000 Service Pack 3 and later.'>
-       (VersionNT = 500 AND ServicePackLevel = 3) OR VersionNT >= 501
-     </Condition>
-
-     <Condition Message='User Test Foo only runs as a non admin'>
-       NOT ALLUSERS
-     </Condition>  
-   </Product>
-</Wix>
-
diff --git a/testing/build.scons b/testing/build.scons
deleted file mode 100644
index 7c7c9aa..0000000
--- a/testing/build.scons
+++ /dev/null
@@ -1,568 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-import os
-
-Import('env')
-
-
-def _AddCommonOptions(local_env):
-  local_env['CPPDEFINES'] += [
-      '_ATL_FREE_THREADED',
-      'UNITTEST',
-      ]
-
-  # A test is a console application, so we tell mk to link to
-  # main() as opposed to WinMain().
-  local_env.FilterOut(LINKFLAGS = ['/SUBSYSTEM:WINDOWS'])
-  local_env['LINKFLAGS'] += ['/SUBSYSTEM:CONSOLE']
-
-#=============omaha_unittest Dependencies======================================
-# TODO(omaha): Replace $STAGING_DIR with $TESTS_DIR when HAMMER_RUNS_TESTS
-# becomes the default.
-
-# Install files from the testing/unittest_support/ directory.
-unittest_support = env.Replicate('$STAGING_DIR/unittest_support/', [
-    # Files used by the common unit tests.
-    'unittest_support/certificate-with-private-key.pfx',
-    'unittest_support/certificate-without-private-key.cer',
-    'unittest_support/declaration.txt',
-    'unittest_support/manifest.xml',
-
-    # Installer files used by the Install Manager unit tests.
-    'unittest_support/test_foo_v1.0.101.0.msi',
-
-    'unittest_support/GoogleUpdate_corrupted.exe',
-    'unittest_support/GoogleUpdate_now_expired_cert.exe',
-    'unittest_support/GoogleUpdate_old_signature.exe',
-    'unittest_support/GoogleUpdateHelper.msi',
-    'unittest_support/SaveArguments.exe',
-    'unittest_support/SaveArguments_different_ou.exe',
-    'unittest_support/SaveArguments_multiple_cn.exe',
-    'unittest_support/SaveArguments_no_cn.exe',
-    'unittest_support/SaveArguments_OmahaTestSigned.exe',
-    'unittest_support/SaveArguments_unsigned_no_resources.exe',
-    'unittest_support/SaveArguments_unsigned_wrong_markup_size.exe',
-    'unittest_support/SaveArguments_unsigned_wrong_markup_value.exe',
-    'unittest_support/SaveArguments_unsigned_wrong_resource_name.exe',
-    'unittest_support/SaveArguments_wrong_cn.exe',
-
-    # Minidump file for the crash unit test.
-    'unittest_support/minidump.dmp',
-    'unittest_support/minidump.txt',
-
-    # PAC file for testing local PAC file support.
-    'unittest_support/localproxytest.pac',
-
-    # Files used by offline_utils_unittest.
-    'unittest_support/{CDABE316-39CD-43BA-8440-6D1E0547AEE6}.v2.gup',
-    'unittest_support/{CDABE316-39CD-43BA-8440-6D1E0547AEE6}.v3.gup',
-    ])
-
-# Saved versions of Google Update for the Setup tests.
-unittest_support += env.Replicate(
-    '$STAGING_DIR/unittest_support/omaha_1.2.131.7_shell/', [
-    'unittest_support/omaha_1.2.131.7_shell/GoogleUpdate.exe',
-    ])
-unittest_support += env.Replicate(
-    '$STAGING_DIR/unittest_support/omaha_1.2.183.9_shell/', [
-    'unittest_support/omaha_1.2.183.9_shell/GoogleUpdate.exe',
-    ])
-unittest_support += env.Replicate('$STAGING_DIR/unittest_support/omaha_1.2.x/',
-    'unittest_support/omaha_1.2.x/GoogleUpdate.exe'
-    )
-unittest_support += env.Replicate('$STAGING_DIR/unittest_support/omaha_1.3.x/',
-    [ 'unittest_support/omaha_1.3.x/GoogleUpdate.exe',
-      'unittest_support/omaha_1.3.x/goopdate.dll',
-      'unittest_support/omaha_1.3.x/goopdateres_en.dll',
-    ])
-
-# Newer versions of Google Update for the Setup tests.
-#unittest_support += env.Replicate(
-#              '$STAGING_DIR/unittest_support/omaha_1.3.x_newer/',
-#              'unittest_support/omaha_1.2.x_newer/GoogleUpdate.exe')
-
-# Copy longrunning.exe to GoogleUpdate.exe for use in Setup.
-unittest_support += env.Replicate(
-    target='$STAGING_DIR/unittest_support/does_not_shutdown/',
-    source='$MAIN_DIR/testing/unittest_support/LongRunningSilent.exe',
-    REPLICATE_REPLACE=[('LongRunningSilent\\.exe', 'GoogleUpdate.exe')],
-)
-
-# download_cache test files
-loc_guid = 'download_cache_test/{7101D597-3481-4971-AD23-455542964072}'
-unittest_support += env.Replicate(
-                        '$STAGING_DIR/unittest_support/' + loc_guid,
-                        'unittest_support/%s/livelysetup.exe' % loc_guid)
-
-loc_guid = 'download_cache_test/{89640431-FE64-4da8-9860-1A1085A60E13}'
-unittest_support += env.Replicate(
-                        '$STAGING_DIR/unittest_support/' + loc_guid,
-                        'unittest_support/%s/gears-win32-opt.msi' % loc_guid)
-
-#=============General Unit Test Dependencies===================================
-# Many unit tests rely on string resources. omaha_unittest.cc loads them but
-# assumes they are in the same directory as the tests.
-# For coverage builds, use a custom command instead of Replicate() because
-# Replicate() will cause the DLL to be re-instrumented.
-resource_dll = '$STAGING_DIR/goopdateres_en.dll'
-if env.IsCoverageBuild():
-  env.CopyFileToDirectory('$TESTS_DIR', resource_dll)
-else:
-  env.Replicate('$TESTS_DIR', resource_dll)
-
-#=============UnitTests========================================================
-
-
-omaha_version_info = env['omaha_versions_info'][0]
-version_string = omaha_version_info.GetVersionString()
-
-run_as_invoker = env.RES('run_as_invoker.res',
-                         '$MAIN_DIR/base/run_as_invoker.rc')
-
-#
-# Builds omaha_unittest
-#
-omaha_unittest_env = env.Clone()
-_AddCommonOptions(omaha_unittest_env)
-
-omaha_unittest_env.FilterOut(LINKFLAGS = ['/NODEFAULTLIB'])
-
-omaha_unittest_libs = [
-    ('atls.lib', 'atlsd.lib')[omaha_unittest_env.Bit('debug')],
-
-    '$LIB_DIR/base.lib',
-    '$LIB_DIR/breakpad.lib',
-    '$LIB_DIR/client.lib',  # TODO(omaha): Might be able to make separate exe.
-    '$LIB_DIR/common.lib',
-    '$LIB_DIR/core.lib',
-    '$LIB_DIR/gmock.lib',
-    '$LIB_DIR/google_update_recovery.lib',
-    '$LIB_DIR/goopdate_lib.lib',
-    '$LIB_DIR/gtest.lib',
-    '$LIB_DIR/logging.lib',
-    '$LIB_DIR/net.lib',
-    '$LIB_DIR/omaha3_idl.lib',
-    '$LIB_DIR/security.lib',
-    '$LIB_DIR/service.lib',
-    '$LIB_DIR/setup.lib',
-    '$LIB_DIR/statsreport.lib',
-    '$LIB_DIR/ui.lib',
-    '$LIB_DIR/unittest_base_large_with_network.lib',
-
-    'advapi32.lib',
-    'bits.lib',
-    'comctl32.lib',
-    'crypt32.lib',
-    'dbghelp.lib',
-    'delayimp.lib',       # For delay loading
-    'iphlpapi.lib',
-    'msi.lib',
-    'mstask.lib',
-    'netapi32.lib',
-    'ole32.lib',
-    'oleaut32.lib',
-    'psapi.lib',
-    'rasapi32.lib',
-    'rpcns4.lib',
-    'rpcrt4.lib',
-    'shlwapi.lib',
-    'taskschd.lib',
-    'urlmon.lib',
-    'userenv.lib',
-    'version.lib',
-    'wbemuuid.lib',
-    'wininet.lib',
-    'wintrust.lib',
-    'ws2_32.lib',
-    'wtsapi32.lib',
-]
-omaha_unittest_libs += omaha_unittest_env.GetAllInOneUnittestLibs()
-
-omaha_unittest_env.Append(
-    CPPPATH = [
-        '$OBJ_ROOT',                        # Needed for the generated files
-        '$MAIN_DIR/third_party/breakpad/src',
-        '$MAIN_DIR/third_party/c99/include',  # C99 inttypes.h for security
-        '$MAIN_DIR/third_party/gmock/include',
-        '$MAIN_DIR/third_party/gtest/include',
-        ],
-    CCFLAGS = [
-        '/wd4389',        # signed/unsigned mismatch
-        '/wd4510',        # default constructor could not be generated
-        '/wd4610',        # object 'class' can never be instantiated
-        ],
-    CPPDEFINES = [
-        'OMAHA_BUILD_VERSION=0x%.4x%.4x%.4x%.4x' % (
-            omaha_version_info.version_major,
-            omaha_version_info.version_minor,
-            omaha_version_info.version_build,
-            omaha_version_info.version_patch),
-        'OMAHA_BUILD_VERSION_STRING=_T(\\"%s\\")' % version_string,
-        ],
-    LIBS = omaha_unittest_libs,
-    LINKFLAGS = [
-        '/DELAYLOAD:shlwapi.dll',
-        '/DELAYLOAD:shell32.dll',
-        '/DELAYLOAD:psapi.dll',
-        '/DELAYLOAD:netapi32.dll',
-        '/DELAYLOAD:Wtsapi32.dll',
-        ],
-    RCFLAGS = [
-        '/DVERSION_MAJOR=%d' % omaha_version_info.version_major,
-        '/DVERSION_MINOR=%d' % omaha_version_info.version_minor,
-        '/DVERSION_BUILD=%d' % omaha_version_info.version_build,
-        '/DVERSION_PATCH=%d' % omaha_version_info.version_patch,
-        '/DVERSION_NUMBER_STRING=\\"%s\\"' % version_string,
-        '/DLANGUAGE_STRING=\\"en\\"'
-        ],
-)
-
-
-# TODO(omaha): Separate this environment as much as appropriate.
-unittest_base_env = omaha_unittest_env.Clone()
-
-unittest_base_env.Append(
-    LIBS = [
-        '$LIB_DIR/common.lib',
-    ],
-)
-
-unittest_base_env.ComponentStaticLibrary(
-  'unittest_base',
-  [ 'omaha_unittest.cc', 'unit_test.cc', ]
-)
-
-unittest_base_env.ComponentStaticLibrary(
-    'unittest_base_large_with_network',
-    [ 'unittest_base.lib',
-      'omaha_unittest_main.cc',
-      'omaha_unittest_network.cc',
-    ]
-)
-
-unittest_base_env.ComponentStaticLibrary(
-    'unittest_base_small',
-    [ 'unittest_base.lib', 'omaha_unittest_main_small_tests.cc', ]
-)
-
-unittest_base_env.ComponentStaticLibrary(
-    'unittest_base_small_with_resources',
-    [ 'unittest_base.lib',
-      'omaha_unittest_main_small_tests_with_resources.cc',
-    ]
-)
-
-
-# TODO(omaha3): Add tests from mainline that were removed during the integrate.
-
-omaha_unittest_inputs = [
-    # Base unit tests
-    '../base/app_util_unittest.cc',
-    '../base/apply_tag.cc',
-    '../base/atlassert_unittest.cc',
-    '../base/atl_regexp_unittest.cc',
-    '../base/browser_utils_unittest.cc',
-    '../base/cgi_unittest.cc',
-    '../base/command_line_parser_unittest.cc',
-    '../base/command_line_validator_unittest.cc',
-    '../base/commands_unittest.cc',
-    '../base/disk_unittest.cc',
-    '../base/dynamic_link_kernel32_unittest.cc',
-    '../base/encrypt_test.cc',
-    '../base/error_unittest.cc',
-    '../base/etw_log_writer_unittest.cc',
-    '../base/event_trace_consumer_unittest.cc',
-    '../base/event_trace_controller_unittest.cc',
-    '../base/event_trace_provider_unittest.cc',
-    '../base/extractor_unittest.cc',
-    '../base/file_reader_unittest.cc',
-    '../base/file_store_unittest.cc',
-    '../base/file_unittest.cc',
-    '../base/firewall_product_detection_unittest.cc',
-    '../base/highres_timer_unittest.cc',
-    '../base/localization_unittest.cc',
-    '../base/lock_ptr_unittest.cc',
-    '../base/logging_unittest.cc',
-    '../base/md5_unittest.cc',
-    '../base/module_utils_unittest.cc',
-    '../base/omaha_version_unittest.cc',
-    '../base/path_unittest.cc',
-    '../base/pe_utils_unittest.cc',
-    '../base/proc_utils_unittest.cc',
-    '../base/process_unittest.cc',
-    '../base/queue_timer_unittest.cc',
-    '../base/reactor_unittest.cc',
-    '../base/reg_key_unittest.cc',
-    '../base/registry_monitor_manager_unittest.cc',
-    '../base/registry_store_unittest.cc',
-    '../base/safe_format_unittest.cc',
-    '../base/scoped_impersonation_unittest.cc',
-    '../base/scoped_ptr_cotask_unittest.cc',
-    '../base/serializable_object_unittest.cc',
-    '../base/service_utils_unittest.cc',
-    '../base/shell_unittest.cc',
-    '../base/signatures_unittest.cc',
-    '../base/signaturevalidator_unittest.cc',
-    '../base/sta_unittest.cc',
-    '../base/string_unittest.cc',
-    '../base/synchronized_unittest.cc',
-    '../base/system_unittest.cc',
-    '../base/system_info_unittest.cc',
-    '../base/thread_pool_unittest.cc',
-    '../base/time_unittest.cc',
-    '../base/timer_unittest.cc',
-    '../base/tr_rand_unittest.cc',
-    '../base/user_info_unittest.cc',
-    '../base/user_rights_unittest.cc',
-    '../base/utils_unittest.cc',
-    '../base/vistautil_unittest.cc',
-    '../base/vista_utils_unittest.cc',
-    '../base/wmi_query_unittest.cc',
-    '../base/xml_utils_unittest.cc',
-
-    # Client unit tests
-    '../client/bundle_creator_test.cc',
-    '../client/bundle_installer_unittest.cc',
-    '../client/install_apps_unittest.cc',
-    '../client/install_self_unittest.cc',
-    '../client/install_unittest.cc',
-
-    # Common unit tests
-    '../common/app_registry_utils_unittest.cc',
-    '../common/command_line_unittest.cc',
-    '../common/command_line_builder_unittest.cc',
-    '../common/config_manager_unittest.cc',
-    '../common/event_logger_unittest.cc',
-    '../common/experiment_labels_unittest.cc',
-    '../common/extra_args_parser_unittest.cc',
-    '../common/goopdate_utils_unittest.cc',
-    '../common/lang_unittest.cc',
-    '../common/oem_install_utils_test.cc',
-    '../common/ping_test.cc',
-    '../common/protocol_definition_test.cc',
-    '../common/scheduled_task_utils_unittest.cc',
-    '../common/stats_uploader_unittest.cc',
-    '../common/update_request_unittest.cc',
-    '../common/webplugin_utils_unittest.cc',
-    '../common/web_services_client_unittest.cc',
-    '../common/xml_parser_unittest.cc',
-
-    # Core unit tests
-    '../core/core_unittest.cc',
-    '../core/system_monitor_unittest.cc',
-    '../core/google_update_core_unittest.cc',
-
-    # Google Update unit tests.
-    '../google_update/google_update_unittest.cc',
-
-    # Goopdate unit tests
-    '../goopdate/application_usage_data_unittest.cc',
-    '../goopdate/app_unittest.cc',
-    '../goopdate/app_command_unittest.cc',
-    '../goopdate/app_bundle_unittest.cc',
-    '../goopdate/app_manager_unittest.cc',
-    '../goopdate/app_version_unittest.cc',
-    '../goopdate/crash_unittest.cc',
-    '../goopdate/cred_dialog_unittest.cc',
-    '../goopdate/download_manager_unittest.cc',
-    '../goopdate/download_complete_ping_event_test.cc',
-    '../goopdate/goopdate_unittest.cc',
-    '../goopdate/install_manager_unittest.cc',
-    '../goopdate/installer_wrapper_unittest.cc',
-    '../goopdate/main_unittest.cc',
-    '../goopdate/model_unittest.cc',
-    '../goopdate/offline_utils_unittest.cc',
-    '../goopdate/string_formatter_unittest.cc',
-    '../goopdate/package_cache_unittest.cc',
-    '../goopdate/resource_manager_unittest.cc',
-    '../goopdate/update_request_utils_unittest.cc',
-    '../goopdate/update_response_utils_unittest.cc',
-    '../goopdate/worker_unittest.cc',
-    '../goopdate/worker_utils_unittest.cc',
-
-    # Net unit tests.
-    '../net/bits_request_unittest.cc',
-    '../net/bits_utils_unittest.cc',
-    '../net/cup_request_unittest.cc',
-    '../net/cup_utils_unittest.cc',
-    '../net/detector_unittest.cc',
-    '../net/http_client_unittest.cc',
-    '../net/net_utils_unittest.cc',
-    '../net/network_config_unittest.cc',
-    '../net/network_request_unittest.cc',
-    '../net/simple_request_unittest.cc',
-    '../net/winhttp_adapter_unittest.cc',
-    '../net/winhttp_vtable_unittest.cc',
-
-    # Plugin unit tests are specified in the individual build.scons files.
-
-    # Code Red-related unit tests.
-    # Others are specified in the individual build.scons files.
-    '../recovery/client/google_update_recovery_unittest.cc',
-
-    # Setup unit tests.
-    '../setup/msi_test_utils.cc',
-    '../setup/setup_unittest.cc',
-    '../setup/setup_files_unittest.cc',
-    '../setup/setup_google_update_unittest.cc',
-    '../setup/setup_service_unittest.cc',
-
-    # Statsreport unit tests.
-    '../statsreport/aggregator_unittest.cc',
-    '../statsreport/aggregator-win32_unittest.cc',
-    '../statsreport/formatter_unittest.cc',
-    '../statsreport/metrics_unittest.cc',
-    '../statsreport/persistent_iterator-win32_unittest.cc',
-
-    # Resource files.
-    omaha_unittest_env.RES('omaha_unittest.rc'),
-    omaha_unittest_env.RES('omaha_unittest_version.rc'),
-    run_as_invoker,
-
-    # Testing unit tests.
-    'unit_test_unittest.cc',
-    'unittest_debug_helper_unittest.cc',
-]
-omaha_unittest_inputs += omaha_unittest_env.GetAllInOneUnittestSources()
-
-# Force a rebuild when the version changes and when the header changes since
-# the .rc file scanner does not.
-omaha_unittest_env.Depends(
-    '$OBJ_ROOT/testing/omaha_unittest.res',
-    [ '$MAIN_DIR/VERSION', 'resource.h' ]
-)
-
-# Ensure that obj files don't collide with ones from non-test build
-# TODO(omaha): We should try to avoid rebuilding production code files. Doing so
-# should make this unnecessary.
-omaha_unittest_env['OBJPREFIX'] = omaha_unittest_env['OBJPREFIX'] + 'testing/'
-
-target_name = 'omaha_unittest'
-
-if env.Bit('use_precompiled_headers'):
-  omaha_unittest_inputs += omaha_unittest_env.EnablePrecompile(target_name)
-
-# omaha_unittest can be built as a test program in 'tests\' or a normal program
-# in 'staging\'.
-# TODO(omaha3): Switch entirely to the former.
-if 'HAMMER_RUNS_TESTS' in os.environ.keys():
-  print 'If build fails, you may need to delete test executables from staging\.'
-  # Copy all the files from staging to the tests directory so that the unit
-  # tests can use them.
-  # TODO(omaha3): Consider using the files from staging, though that may cause
-  # staging to be polluted.
-  omaha_unittest_env.Publish(target_name, 'test_input', '$STAGING_DIR/*')
-  # UnitTestHelpersTest.GetLocalAppDataPath requires 'USERNAME'.
-  omaha_unittest_env['ENV']['USERNAME'] = os.environ['USERNAME']
-  # ConfigManagerTest.GetDir requires 'USERPROFILE'.
-  omaha_unittest_env['ENV']['USERPROFILE'] = os.environ['USERPROFILE']
-  # UtilsTest.GetEnvironmentVariableAsString requires 'OS'.
-  omaha_unittest_env['ENV']['OS'] = os.environ['OS']
-  # Tests that use psexec require 'OMAHA_PSEXEC_DIR'
-  omaha_unittest_env['ENV']['OMAHA_PSEXEC_DIR'] = os.environ['OMAHA_PSEXEC_DIR']
-
-  # Set environment variables specific to the tests.
-  for env_var in os.environ:
-    if (not env_var in omaha_unittest_env['ENV'] and
-        (env_var.startswith('GTEST_') or env_var.startswith('OMAHA_TEST_'))):
-      omaha_unittest_env['ENV'][env_var] = os.environ[env_var]
-
-  test = omaha_unittest_env.ComponentTestProgram(target_name,
-                                                 omaha_unittest_inputs,
-                                                 COMPONENT_TEST_SIZE='large')
-
-  # The tests depend on the unittest_support directory.
-  omaha_unittest_env.Depends(test, unittest_support)
-
-  # resource_manager_unittest.cc uses the Russian resources.
-  omaha_unittest_env.Depends(test, '$TESTS_DIR/goopdateres_ru.dll')
-
-else:
-  test = omaha_unittest_env.ComponentProgram(target_name, omaha_unittest_inputs)
-
-  # The tests depend on the unittest_support directory.
-  omaha_unittest_env.Depends(test, unittest_support)
-
-  # resource_manager_unittest.cc uses the Russian resources.
-  omaha_unittest_env.Depends(test, '$STAGING_DIR/goopdateres_ru.dll')
-
-if env.Bit('all'):
-  save_args_env = env.Clone()
-  save_args_env.Append(
-      CPPPATH = [
-          '$OBJ_ROOT',    # Needed for the generated files
-          ],
-      LIBS = [
-          ('atls.lib', 'atlsd.lib')[save_args_env.Bit('debug')],
-          ('libcmt.lib', 'libcmtd.lib')[save_args_env.Bit('debug')],
-          ('libcpmt.lib', 'libcpmtd.lib')[save_args_env.Bit('debug')],
-          '$LIB_DIR/base.lib',
-
-          # These are required by common_lib
-          'netapi32.lib',
-          'psapi.lib',
-          'rasapi32.lib',
-          'shlwapi.lib',
-          'userenv.lib',
-          'version.lib',
-          'wtsapi32.lib',
-          ],
-      RCFLAGS = [
-          '/DVERSION_MAJOR=%d' % omaha_version_info.version_major,
-          '/DVERSION_MINOR=%d' % omaha_version_info.version_minor,
-          '/DVERSION_BUILD=%d' % omaha_version_info.version_build,
-          '/DVERSION_PATCH=%d' % omaha_version_info.version_patch,
-          '/DVERSION_NUMBER_STRING=\\"%s\\"' % version_string,
-          '/DLANGUAGE_STRING=\\"en\\"'
-          ],
-  )
-
-  save_args_env.FilterOut(LINKFLAGS = ['/SUBSYSTEM:WINDOWS'])
-  save_args_env['LINKFLAGS'] += ['/SUBSYSTEM:CONSOLE']
-
-  target_name = 'SaveArguments_unsigned'
-
-  unsigned_inputs = [
-      'save_arguments.cc',
-      save_args_env.RES('save_arguments_version.rc'),
-      run_as_invoker,
-      save_args_env.RES('recovery_markup.res',
-                        '$MAIN_DIR/recovery/recovery_markup.rc'),
-      ]
-
-  # Force a rebuild when the version changes.
-  save_args_env.Depends('$OBJ_ROOT/testing/save_arguments_version.res',
-                        '$MAIN_DIR/VERSION'
-  )
-
-  if env.Bit('use_precompiled_headers'):
-    unsigned_inputs += save_args_env.EnablePrecompile(target_name)
-
-  # Build the *unsigned* executeable
-  unsigned_output = save_args_env.ComponentTestProgram(
-      prog_name=target_name,
-      source=unsigned_inputs,
-      COMPONENT_TEST_RUNNABLE=False
-  )
-
-  signed_output = save_args_env.SignedBinary(
-      target='SaveArguments.exe',
-      source=unsigned_output,
-  )
-
-  save_args_env.Replicate('$TESTS_DIR', signed_output)
diff --git a/testing/omaha_customization_test.h b/testing/omaha_customization_test.h
deleted file mode 100644
index a4ee955..0000000
--- a/testing/omaha_customization_test.h
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Common include file for Omaha customization tests.
-
-#ifndef OMAHA_TESTING_OMAHA_CUSTOMIZATION_TEST_H_
-#define OMAHA_TESTING_OMAHA_CUSTOMIZATION_TEST_H_
-
-#include "omaha/testing/unit_test.h"
-
-#ifdef GOOGLE_UPDATE_BUILD
-// For Google Update builds, expect the values to be equal and for the
-// interface names to exist.
-
-// Test fixture for a Google Update-specific interface name.
-// Tests using this fixture must be in the global namespace.
-#define TEST_GU_INT_F(test_fixture, test_name) TEST_F(test_fixture, test_name)
-
-// Expect the values to be equal only in the case of Google Update builds.
-#define EXPECT_GU_EQ(expected, actual) EXPECT_EQ(expected, actual)
-#define EXPECT_GU_STREQ(expected, actual) EXPECT_STREQ(expected, actual)
-#define EXPECT_GU_TRUE(condition) EXPECT_TRUE(condition)
-#define EXPECT_GU_FALSE(condition) EXPECT_FALSE(condition)
-
-// Expect an interface name that is Google Update-specific to have the uuid.
-#define EXPECT_GU_ID_EQ(uuid, interface_id) \
-    EXPECT_STREQ(CString(uuid).MakeUpper(), \
-                 omaha::GuidToString(interface_id));
-
-#else
-// For open source builds, expect the values to not be equal.  (Interfaces
-// should still exist.)
-
-#define TEST_GU_INT_F(test_fixture, test_name) TEST_F(test_fixture, test_name)
-
-#define EXPECT_GU_EQ(expected, actual) EXPECT_NE(expected, actual)
-#define EXPECT_GU_STREQ(expected, actual) EXPECT_STRNE(expected, actual)
-#define EXPECT_GU_TRUE(condition) EXPECT_FALSE(condition)
-#define EXPECT_GU_FALSE(condition) EXPECT_TRUE(condition)
-
-#define EXPECT_GU_ID_EQ(uuid, interface_id) \
-    EXPECT_STRNE(CString(uuid).MakeUpper(), \
-                 omaha::GuidToString(interface_id));
-
-#endif
-
-
-class OmahaCustomizationTypeLibComInterfaceTest : public testing::Test {
- protected:
-  explicit OmahaCustomizationTypeLibComInterfaceTest(const CString& dll_name)
-      : dll_name_(dll_name),
-        type_lib_(NULL),
-        help_context_(UINT_MAX) {
-  }
-
-  virtual void SetUp() {
-    CString omaha_dll_path;
-    omaha_dll_path.Format(_T("..\\staging\\%s"), dll_name_);
-    EXPECT_SUCCEEDED(::LoadTypeLib(omaha_dll_path, &type_lib_));
-  }
-
-  HRESULT GetDocumentation(int type_description_index) {
-    return type_lib_->GetDocumentation(type_description_index,
-                                      &item_name_,
-                                      &item_doc_string_,
-                                      &help_context_,
-                                      &help_file_);
-  }
-
-  CString dll_name_;
-  ITypeLib* type_lib_;
-
-  CComBSTR item_name_;
-  CComBSTR item_doc_string_;
-  unsigned long help_context_;  // NOLINT
-  CComBSTR help_file_;
-};
-
-#endif  // OMAHA_TESTING_OMAHA_CUSTOMIZATION_TEST_H_
diff --git a/testing/omaha_unittest.cc b/testing/omaha_unittest.cc
deleted file mode 100644
index 20d8588..0000000
--- a/testing/omaha_unittest.cc
+++ /dev/null
@@ -1,303 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/testing/omaha_unittest.h"
-#include <atlpath.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/file.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-namespace {
-
-//
-// Subset of Google Test arguments.
-//
-const TCHAR* const kUnitTestBreakOnFailure   = _T("--gtest_break_on_failure");
-const TCHAR* const kUnitTestFilter           = _T("--gtest_filter");
-const TCHAR* const kUnitTestListTests        = _T("--gtest_list_tests");
-
-//
-// Omaha-specifc arguments.
-//
-const TCHAR* const kOmahaArgIsBuildSystem    = _T("--omaha_buildsystem");
-const TCHAR* const kOmahaArgPsexecDir        = _T("--omaha_psexec_dir");
-// Only use kOmahaArgAcceptPsexecEula for automated testing when you have
-// already read and agreed to the EULA terms.
-// If present both are present, kOmahaArgAcceptPsexecEula must appear after
-// kOmahaArgPsexecDir on the command line.
-const TCHAR* const kOmahaArgAcceptPsexecEula = _T("--omaha_accept_psexec_eula");
-
-// Logs the start, end, and failures of each test in the Omaha log.
-// TODO(omaha): Consider adding a logging category for tests.
-class TestLogger : public ::testing::EmptyTestEventListener {
-  // Called before a test starts.
-  virtual void OnTestStart(const ::testing::TestInfo& test_info) {
-    OPT_LOG(L3, (_T("*** TEST %s.%s starting."),
-                 CString(CA2W(test_info.test_case_name())),
-                 CString(CA2W(test_info.name()))));
-  }
-
-  // Called after a failed assertion or a SUCCESS().
-  virtual void OnTestPartResult(
-      const ::testing::TestPartResult& test_part_result) {
-    OPT_LOG(L3, (_T("%s in %s:%d\n%s"),
-                 (test_part_result.failed() ? _T("*** TEST Failure") :
-                                              _T("TEST Success")),
-                 CString(CA2W(test_part_result.file_name())),
-                 test_part_result.line_number(),
-                 CString(CA2W(test_part_result.summary()))));
-  }
-
-  // Called after a test ends.
-  virtual void OnTestEnd(const ::testing::TestInfo& test_info) {
-    OPT_LOG(L3, (_T("*** TEST %s.%s ending."),
-                 CString(CA2W(test_info.test_case_name())),
-                 CString(CA2W(test_info.name()))));
-  }
-};
-
-void LogCommandLineAndEnvironment(int argc, TCHAR** argv) {
-  ASSERT1(1 <= argc);
-  ASSERT1(argv);
-
-  CString command_line = argv[0];
-  for (int i = 1; i < argc; ++i) {
-    command_line.AppendFormat(_T(" %s"), argv[i]);
-  }
-  OPT_LOG(L1, (_T("[Omaha unit test command line][%s]"), command_line));
-
-  TCHAR* env_vars = ::GetEnvironmentStrings();
-  if (env_vars == NULL) {
-    ASSERT1(false);
-    return;
-  }
-
-  // Iterate through the environment variables string. The format of the string
-  // is Name1=Value1\0Name2=Value2\0Name3=Value3\0\0.
-  const TCHAR* const kPartialMatchToIgnore = _T("PASSW");
-  const TCHAR* current = env_vars;
-  CString environment_variables;
-  while (*current) {
-    size_t sub_length = _tcslen(current) + 1;
-    if (!_tcsstr(current, kPartialMatchToIgnore)) {
-      environment_variables.AppendFormat(_T("\t%s\r\n"), current);
-    }
-    current += sub_length;
-  }
-
-  OPT_LOG(L3, (_T("[Omaha unit test environment][\r\n%s]"),
-               environment_variables));
-}
-
-// Sets values based on environment variables.
-void ProcessEnvironmentVariables() {
-  if (IsEnvironmentVariableSet(_T("OMAHA_TEST_BUILD_SYSTEM"))) {
-    SetIsBuildSystem();
-  }
-
-  TCHAR psexec_dir[MAX_PATH] = {0};
-  if (::GetEnvironmentVariable(_T("OMAHA_PSEXEC_DIR"),
-                                psexec_dir,
-                                arraysize(psexec_dir))) {
-    SetPsexecDir(psexec_dir);
-  }
-}
-
-bool ParseOmahaArgPsexecDir(const CString& arg) {
-  CString psexec_dir_arg_begin;
-  psexec_dir_arg_begin.Format(_T("%s="), kOmahaArgPsexecDir);
-
-  if (arg.Left(psexec_dir_arg_begin.GetLength()) != psexec_dir_arg_begin) {
-    return false;
-  }
-
-  SetPsexecDir(arg.Mid(psexec_dir_arg_begin.GetLength()));
-  return true;
-}
-
-// Must be called after ParseOmahaArgPsexecDir().
-bool ParseOmahaArgAcceptPsexecEula(const TCHAR* arg) {
-  ASSERT1(arg);
-  if (_tcsicmp(arg, kOmahaArgAcceptPsexecEula)) {
-    return false;
-  }
-
-  EXPECT_TRUE(AcceptPsexecEula())
-        << _T("Make sure '") << kOmahaArgPsexecDir << _T("' appears after '")
-        << kOmahaArgAcceptPsexecEula << _T("' on the command line and that ")
-        << _T("psexec.exe is in the specified location.");
-  return true;
-}
-
-bool ParseOmahaArgIsBuildMachine(const TCHAR* arg) {
-  ASSERT1(arg);
-  if (_tcsicmp(arg, kOmahaArgIsBuildSystem)) {
-    return false;
-  }
-  SetIsBuildSystem();
-  return true;
-}
-
-// Parse args. Print help message if invalid arguments.
-bool ParseUnitTestArgs(int argc, TCHAR** argv) {
-  testing::InitGoogleTest(&argc, argv);
-
-  if (argc > 1) {
-    // One or more args were unparsed by the Google Test parser. Handle
-    // Omaha-specific arguments that may be present. Code is based on
-    // ParseGoogleTestFlagsOnlyImpl.
-    for (int i = 1; i < argc; i++) {
-      if (ParseOmahaArgPsexecDir(argv[i]) ||
-          ParseOmahaArgAcceptPsexecEula(argv[i]) ||
-          ParseOmahaArgIsBuildMachine(argv[i])) {
-        // Yes.  Shift the remainder of the argv list left by one.  Note
-        // that argv has (*argc + 1) elements, the last one always being
-        // NULL.  The following loop moves the trailing NULL element as
-        // well.
-        for (int j = i; j != argc; j++) {
-          argv[j] = argv[j + 1];
-        }
-
-        // Decrements the argument count.
-        argc--;
-
-        // We also need to decrement the iterator as we just removed
-        // an element.
-        i--;
-      }
-    }
-  }
-
-  if (argc <= 1) {
-    return true;
-  }
-
-  _tprintf(_T("ERROR: Invalid Command line!\n"), argv[1]);
-  _tprintf(_T("  First invalid command option: %s\n\n"), argv[1]);
-  _tprintf(_T("Valid options:\n"));
-  _tprintf(_T("%25s   Cause an av when a test fails (for use with debugger)\n"),
-           kUnitTestBreakOnFailure);
-  _tprintf(_T("%25s   Sets a filter on the unit tests.\n")
-           _T("%25s   Format: %s=Filter[:Filter] where\n")
-           _T("%25s   Filter is TestCase[.Test] and * is a wildcard.\n"),
-           kUnitTestFilter, _T(""), kUnitTestFilter, _T(""));
-  _tprintf(_T("%25s   Lists all tests\n"),
-           kUnitTestListTests);
-  return false;
-}
-
-}  // namespace
-
-// If a test launches or checks other processes, uses shared resources, or uses
-// the network, it is a medium or larger test.
-// COM is always initialized.
-int RunTests(bool is_medium_or_large_test,
-             bool load_resources,
-             int argc,
-             TCHAR** argv) {
-  ASSERT1(!is_medium_or_large_test || load_resources);
-
-  // TODO(omaha): Add executable name.
-  OPT_LOG(L1, (_T("[Starting Omaha unit tests]")));
-  LogCommandLineAndEnvironment(argc, argv);
-
-  // Process the environment variables before the args to allow the args to take
-  // precedence.
-  ProcessEnvironmentVariables();
-
-  if (!ParseUnitTestArgs(argc, argv)) {
-    return -1;
-  }
-  FailOnAssert fail_on_assert;
-
-  InitializeVersionFromModule(NULL);
-
-  scoped_co_init co_init(COINIT_MULTITHREADED);
-  VERIFY1(SUCCEEDED(co_init.hresult()));
-
-  const bool is_build_system = IsBuildSystem();
-
-  if (is_build_system) {
-    // Some tests only run as admin. We want to know if the build system is no
-    // longer running unit tests as admin.
-    if (!vista_util::IsUserAdmin()) {
-      _tprintf(_T("\nUser is not an admin. All tests may not run.\n"));
-    }
-
-    // TODO(omaha): Remove this and the app_util.h, file.h, and atlpath.h
-    // includes once the test system does this for us.
-    const TCHAR* const kDllRequiredForCoverageRuns = _T("VSCover80.dll");
-    CPath source_path(app_util::GetCurrentModuleDirectory());
-    source_path.Append(kDllRequiredForCoverageRuns);
-    if (File::Exists(source_path)) {
-      CPath target_path(app_util::GetSystemDir());
-      target_path.Append(kDllRequiredForCoverageRuns);
-      _tprintf(_T("\nCopying '%s' to '%s'.\n"), source_path, target_path);
-      VERIFY1(SUCCEEDED(File::Copy(source_path, target_path, false)));
-    }
-  }
-
-  if (is_medium_or_large_test) {
-    TerminateAllGoogleUpdateProcesses();
-  }
-
-  int result = InitializeNetwork();
-  if (result) {
-    return result;
-  }
-
-  if (load_resources) {
-    // Load a resource DLL so that strings can be loaded during tests and add it
-    // to the list of modules used for CString.LoadString and CreateDialog
-    // calls. The unittest executable includes unittest-specific resources.
-    HMODULE resource_dll = ::LoadLibraryEx(_T("goopdateres_en.dll"),
-                            NULL,
-                            LOAD_LIBRARY_AS_DATAFILE);
-    ASSERT1(resource_dll);
-    _AtlBaseModule.AddResourceInstance(resource_dll);
-  }
-
-  // A COM module is required to create COM objects.
-  // Create it regardless of whether COM is actually used by this executable.
-  CComModule module;
-
-  // Add an event listener. Google Test takes the ownership.
-  ::testing::TestEventListeners& listeners =
-      ::testing::UnitTest::GetInstance()->listeners();
-  listeners.Append(new TestLogger);
-
-  result = RUN_ALL_TESTS();
-
-  DeinitializeNetwork();
-
-  if (is_build_system && is_medium_or_large_test) {
-    TerminateAllGoogleUpdateProcesses();
-  }
-
-  return result;
-}
-
-int g_assert_count = 0;
-
-}  // namespace omaha
diff --git a/testing/omaha_unittest.h b/testing/omaha_unittest.h
deleted file mode 100644
index ab4c0cb..0000000
--- a/testing/omaha_unittest.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_TESTING_OMAHA_UNITTEST_H_
-#define OMAHA_TESTING_OMAHA_UNITTEST_H_
-
-#include <windows.h>
-
-namespace omaha {
-
-int RunTests(bool is_medium_or_large_test,
-             bool load_resources,
-             int argc,
-             TCHAR** argv);
-
-// These functions must be implemented by users of RunTests and linked into the
-// test binary.
-
-// Initializes the network if necessary for the test.
-int InitializeNetwork();
-
-// Performs and teardown of the network if necessary.
-int DeinitializeNetwork();
-
-}  // namespace omaha
-
-#endif  // OMAHA_TESTING_OMAHA_UNITTEST_H_
diff --git a/testing/omaha_unittest.rc b/testing/omaha_unittest.rc
deleted file mode 100644
index 9d8d04b..0000000
--- a/testing/omaha_unittest.rc
+++ /dev/null
Binary files differ
diff --git a/testing/omaha_unittest_main.cc b/testing/omaha_unittest_main.cc
deleted file mode 100644
index 6923678..0000000
--- a/testing/omaha_unittest_main.cc
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-#include <shellapi.h>
-
-#include "omaha/testing/omaha_unittest.h"
-
-// The entry point for the Omaha unit tests.
-// We use main instead of _tmain since _tmain doesn't like being part of a
-// static library...
-int main(int unused_argc, char** unused_argv) {
-  UNREFERENCED_PARAMETER(unused_argc);
-  UNREFERENCED_PARAMETER(unused_argv);
-
-  int argc = 0;
-  WCHAR** argv = ::CommandLineToArgvW(::GetCommandLine(), &argc);
-  return omaha::RunTests(true,  // is_medium_or_large_test.
-                         true,  // load_resources.
-                         argc,
-                         argv);
-}
diff --git a/testing/omaha_unittest_main_small_tests.cc b/testing/omaha_unittest_main_small_tests.cc
deleted file mode 100644
index fef078c..0000000
--- a/testing/omaha_unittest_main_small_tests.cc
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-#include <shellapi.h>
-
-#include "omaha/testing/omaha_unittest.h"
-
-// The entry point for the Omaha unit tests.
-// We use main instead of _tmain since _tmain doesn't like being part of a
-// static library...
-int main(int unused_argc, char** unused_argv) {
-  UNREFERENCED_PARAMETER(unused_argc);
-  UNREFERENCED_PARAMETER(unused_argv);
-
-  int argc = 0;
-  WCHAR** argv = ::CommandLineToArgvW(::GetCommandLine(), &argc);
-  return omaha::RunTests(false,  // is_medium_or_large_test.
-                         false,  // load_resources.
-                         argc,
-                         argv);
-}
-
-namespace omaha {
-
-// The network is not needed for small tests.
-
-int InitializeNetwork() {
-  return 0;
-}
-
-int DeinitializeNetwork() {
-  return 0;
-}
-
-}  // namespace omaha
diff --git a/testing/omaha_unittest_main_small_tests_with_resources.cc b/testing/omaha_unittest_main_small_tests_with_resources.cc
deleted file mode 100644
index 4c1fc63..0000000
--- a/testing/omaha_unittest_main_small_tests_with_resources.cc
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-#include <shellapi.h>
-
-#include "omaha/testing/omaha_unittest.h"
-
-// The entry point for the Omaha unit tests.
-// We use main instead of _tmain since _tmain doesn't like being part of a
-// static library...
-int main(int unused_argc, char** unused_argv) {
-  UNREFERENCED_PARAMETER(unused_argc);
-  UNREFERENCED_PARAMETER(unused_argv);
-
-  int argc = 0;
-  WCHAR** argv = ::CommandLineToArgvW(::GetCommandLine(), &argc);
-  return omaha::RunTests(false,  // is_medium_or_large_test.
-                         true,   // load_resources.
-                         argc,
-                         argv);
-}
-
-namespace omaha {
-
-// The network is not needed for small tests.
-
-int InitializeNetwork() {
-  return 0;
-}
-
-int DeinitializeNetwork() {
-  return 0;
-}
-
-}  // namespace omaha
diff --git a/testing/omaha_unittest_network.cc b/testing/omaha_unittest_network.cc
deleted file mode 100644
index 985c0e2..0000000
--- a/testing/omaha_unittest_network.cc
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/vistautil.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/common/const_goopdate.h"
-#include "omaha/net/network_config.h"
-#include "omaha/testing/omaha_unittest.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-int InitializeNetwork() {
-  if (IsBuildSystem()) {
-    // Until testsource can be set outside the tests on the build system,
-    // tests that use the network must be run as admin so the it can be set.
-    ASSERT1(vista_util::IsUserAdmin());
-    SetBuildSystemTestSource();
-  }
-
-  // Ensure that any system running unittests has testsource set.
-  // Some unit tests generate pings, and these must be filtered.
-  CString value;
-  HRESULT hr =
-      RegKey::GetValue(MACHINE_REG_UPDATE_DEV, kRegValueTestSource, &value);
-  if (FAILED(hr) || value.IsEmpty()) {
-    ADD_FAILURE() << _T("'") << kRegValueTestSource << _T("'")
-                  << _T(" is not present in ")
-                  << _T("'") << MACHINE_REG_UPDATE_DEV << _T("'")
-                  << _T(" or it is empty. Since you are running Omaha unit ")
-                  << _T("tests, it should probably be set to 'dev' or 'qa'.");
-    return -1;
-  }
-
-  // Many unit tests require the network configuration be initialized.
-  // Referencing the singleton instance creats it if not exist.
-  // On Windows Vista only admins can write to HKLM therefore the
-  // initialization of the NetworkConfig must correspond to the integrity
-  // level the user is running as.
-  NetworkConfigManager::set_is_machine(vista_util::IsUserAdmin());
-  NetworkConfigManager::Instance();
-
-  return 0;
-}
-
-int DeinitializeNetwork() {
-  NetworkConfigManager::DeleteInstance();
-  return 0;
-}
-
-}  // namespace omaha
diff --git a/testing/omaha_unittest_version.rc b/testing/omaha_unittest_version.rc
deleted file mode 100644
index 4e3b5cc..0000000
--- a/testing/omaha_unittest_version.rc
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2007 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <afxres.h>
-
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
-VS_VERSION_INFO VERSIONINFO
-// Resource Editor does not handle constants from main.scons.
-#ifndef APSTUDIO_INVOKED
- FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_BUILD,VERSION_PATCH
- PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_BUILD,VERSION_PATCH
-#endif  // APSTUDIO_INVOKED
- FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
-#if defined _DEBUG && OFFICIAL_BUILD
- FILEFLAGS VS_FF_DEBUG
-#elif defined _DEBUG
- FILEFLAGS VS_FF_DEBUG | VS_FF_PRIVATEBUILD
-#elif !OFFICIAL_BUILD
- FILEFLAGS VS_FF_PRIVATEBUILD
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS VOS_NT_WINDOWS32
- FILETYPE VFT_APP
- FILESUBTYPE VFT2_UNKNOWN
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "040904b0"
-        BEGIN
-// Requires constants from mains.scons that cannot be loaded in Resource Editor.
-#ifndef APSTUDIO_INVOKED
-            VALUE "CompanyName", FULL_COMPANY_NAME_ANSI
-            VALUE "FileDescription", OMAHA_APP_NAME_ANSI " unit test"
-            VALUE "FileVersion", VERSION_NUMBER_STRING
-            VALUE "InternalName", OMAHA_APP_NAME_ANSI
-            VALUE "LegalCopyright", OMAHA_COPYRIGHT_STRING_ENGLISH
-            VALUE "OriginalFilename", "omaha_unittest.exe"
-            VALUE "ProductName", OMAHA_APP_NAME_ANSI
-            VALUE "ProductVersion", VERSION_NUMBER_STRING
-  #ifdef _DEBUG
-            VALUE "Debug", ""
-  #endif
-  #if !OFFICIAL_BUILD
-            VALUE "PrivateBuild", BUILD_NUMBER
-  #endif
-#else
-            VALUE "_SpecialView",
-                  "Most values are not shown in Resource Editor because they "
-                  "require build file constants."
-#endif  // APSTUDIO_INVOKED
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x0409, 1200
-    END
-END
diff --git a/testing/ondemandsystem_unittest.cc b/testing/ondemandsystem_unittest.cc
deleted file mode 100644
index 272d95c..0000000
--- a/testing/ondemandsystem_unittest.cc
+++ /dev/null
@@ -1,294 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-//
-// System level tests for On Demand.  Unlike omaha_unittest.cpp, this test
-// should be run one test at a time view --gtest_filter.  The tests all assume
-// that there is an update available for the app (specified via guid as the
-// first argument).
-
-#include "base/basictypes.h"
-#include "omaha/testing/unit_test.h"
-#include "omaha/third_party/gtest/include/gtest/gtest.h"
-#include "omaha/tools/performondemand/performondemand.h"
-#include "omaha/base/utils.h"
-#include <windows.h>
-#include <atltime.h>
-
-namespace omaha {
-
-// Lazily define the guid and is_machine (passed in at the command line) global.
-CString guid;
-bool is_machine;
-const int UPDATE_TIMEOUT = 60;
-
-class OnDemandTest : public testing::Test {
- protected:
-
-  virtual void SetUp() {
-    wprintf(_T("Initializing\n"));
-    HRESULT hr = CComObject<JobObserver>::CreateInstance(&job_observer);
-    ASSERT_EQ(S_OK, hr);
-    job_holder = job_observer;
-    ASSERT_EQ(Reconnect(), S_OK);
-  }
-
-  virtual HRESULT Reconnect() {
-    on_demand = NULL;
-    if (is_machine) {
-      return on_demand.CoCreateInstance(
-          L"GoogleUpdate.OnDemandCOMClassMachine");
-    } else {
-      return on_demand.CoCreateInstance(
-          L"GoogleUpdate.OnDemandCOMClassUser");
-    }
-  }
-
-  virtual void TearDown() {
-    job_holder = NULL;
-    on_demand = NULL;
-  }
-
-  void WaitForUpdateCompletion(int timeout) {
-    MSG msg;
-    SYSTEMTIME start_system_time = {0};
-    SYSTEMTIME current_system_time = {0};
-    ::GetSystemTime(&start_system_time);
-    CTime start_time(start_system_time);
-    CTimeSpan timeout_period(0, 0, 0, timeout);
-
-    while (::GetMessage(&msg, NULL, 0, 0))
-    {
-      ::TranslateMessage(&msg);
-      ::DispatchMessage(&msg);
-      ::GetSystemTime(&current_system_time);
-      CTime current_time(current_system_time);
-      CTimeSpan elapsed_time = current_time - start_time;
-      if (timeout_period < elapsed_time) {
-        wprintf(_T("Timed out.\n"));
-        break;
-      }
-    }
-
-    PrintSummary();
-  }
-
-  void PrintSummary() {
-    wprintf(_T("Observed: [0x%x]\n"), job_observer->observed);
-  }
-
-  void ExpectSuccessful() {
-    // Make sure we got a succesfful install.
-    char* err_msg = "Did not observe a complete, successful install!";
-    EXPECT_TRUE(job_observer->observed & (
-        // Complete codes we don't expect are intentially commented out.
-        ON_COMPLETE_SUCCESS |
-        //ON_COMPLETE_SUCCESS_CLOSE_UI |
-        //ON_COMPLETE_RESTART_ALL_BROWSERS |
-        //ON_COMPLETE_REBOOT |
-        //ON_COMPLETE_RESTART_BROWSER |
-        ON_COMPLETE_RESTART_ALL_BROWSERS_NOTICE_ONLY
-        //ON_COMPLETE_REBOOT_NOTICE_ONLY |
-        //ON_COMPLETE_RESTART_BROWSER_NOTICE_ONLY |
-        //ON_COMPLETE_RUN_COMMAND
-        )) << err_msg;
-  }
-
-  CComObject<JobObserver>* job_observer;
-  CComPtr<IJobObserver> job_holder;
-  CComPtr<IGoogleUpdate> on_demand;
-};
-
-TEST_F(OnDemandTest, BasicUpdate) {
-  wprintf(_T("Starting Update\n"));
-  HRESULT hr = on_demand->Update(guid, job_observer);
-  ASSERT_EQ(S_OK, hr);
-  WaitForUpdateCompletion(UPDATE_TIMEOUT);
-
-  ExpectSuccessful();
-  char* err_msg = "Did not observe a complete, successful install!";
-  EXPECT_TRUE(job_observer->observed & ON_INSTALLING) << err_msg;
-}
-
-TEST_F(OnDemandTest, OnDemandDuringAutoUpdate) {
-  wprintf(_T("Starting Update\n"));
-  HRESULT hr = on_demand->Update(guid, job_observer);
-  ASSERT_EQ(S_OK, hr);
-  WaitForUpdateCompletion(UPDATE_TIMEOUT);
-
-  ExpectSuccessful();
-  char* err_msg = "Did not observe a complete, successful install!";
-  EXPECT_TRUE(job_observer->observed & ON_INSTALLING) << err_msg;
-}
-
-
-TEST_F(OnDemandTest, UpdateThenNoUpdate) {
-  wprintf(_T("Starting Update\n"));
-  HRESULT hr = on_demand->Update(guid, job_observer);
-  ASSERT_EQ(S_OK, hr);
-  WaitForUpdateCompletion(UPDATE_TIMEOUT);
-
-  ExpectSuccessful();
-  char* err_msg = "Did not observe a complete, successful install!";
-  EXPECT_TRUE(job_observer->observed & ON_INSTALLING) << err_msg;
-
-
-  wprintf(_T("Starting Second Update Request\n"));
-  // Reset the memory of observed actions.
-  job_observer->Reset();
-  hr = on_demand->Update(guid, job_observer);
-  ASSERT_EQ(S_OK, hr);
-  WaitForUpdateCompletion(UPDATE_TIMEOUT);
-
-  ExpectSuccessful();
-  EXPECT_FALSE(job_observer->observed & ON_INSTALLING) << err_msg;
-}
-
-
-TEST_F(OnDemandTest, CloseDuringCheckingForUpdates) {
-  wprintf(_T("Starting Update\n"));
-
-  job_observer->AddCloseMode(ON_CHECKING_FOR_UPDATES);
-
-  HRESULT hr = on_demand->Update(guid, job_observer);
-  ASSERT_EQ(S_OK, hr);
-  WaitForUpdateCompletion(UPDATE_TIMEOUT);
-
-  char* err_msg = "Observed a complete install when should have closed!";
-  EXPECT_TRUE(job_observer->observed & ON_COMPLETE_ERROR) << err_msg;
-  EXPECT_FALSE(job_observer->observed & ON_INSTALLING) << err_msg;
-}
-
-
-TEST_F(OnDemandTest, CloseDuringDownload) {
-  wprintf(_T("Starting Update\n"));
-
-  job_observer->AddCloseMode(ON_DOWNLOADING);
-
-  HRESULT hr = on_demand->Update(guid, job_observer);
-  ASSERT_EQ(S_OK, hr);
-  WaitForUpdateCompletion(UPDATE_TIMEOUT);
-
-  char* err_msg = "Observed an install when should have closed!";
-  EXPECT_FALSE(job_observer->observed & ON_INSTALLING) << err_msg;
-}
-
-
-TEST_F(OnDemandTest, CloseDuringDownloadAndTryAgain) {
-  wprintf(_T("Starting Update\n"));
-
-  job_observer->AddCloseMode(ON_DOWNLOADING);
-
-  HRESULT hr = on_demand->Update(guid, job_observer);
-  ASSERT_EQ(S_OK, hr);
-  WaitForUpdateCompletion(UPDATE_TIMEOUT);
-
-  char* err_msg = "Observed a complete, install when should have closed!";
-  EXPECT_FALSE(job_observer->observed & ON_INSTALLING) << err_msg;
-
-  wprintf(_T("Requesting update.\n"));
-  // Try a second time, but this time don't interfere.  An update should ensue.
-  job_observer->Reset();
-  hr = on_demand->Update(guid, job_observer);
-  ASSERT_EQ(S_OK, hr);
-  WaitForUpdateCompletion(UPDATE_TIMEOUT);
-
-  ExpectSuccessful();
-  EXPECT_TRUE(job_observer->observed & ON_INSTALLING) << err_msg;
-}
-
-
-TEST_F(OnDemandTest, UpdateWithOmahaUpdateAvailable) {
-  wprintf(_T("Starting Update\n"));
-  HRESULT hr = on_demand->Update(guid, job_observer);
-  ASSERT_EQ(S_OK, hr);
-  WaitForUpdateCompletion(UPDATE_TIMEOUT);
-
-  ExpectSuccessful();
-  char* err_msg = "Did not observe a complete, successful install!";
-  EXPECT_TRUE(job_observer->observed & ON_INSTALLING) << err_msg;
-}
-
-
-TEST_F(OnDemandTest, UpdateAfterOmahaUpdate) {
-  // Test shutdown code by first connecting the the com instance, waiting around
-  // for Omaha to update (done by OnDemandTestFactory.py), and then updating.
-  wprintf(_T("Waiting 60 seconds for omaha to update itself.\n"));
-  ::SleepEx(60000, true);
-
-  wprintf(_T("Attempting update on shut-down server.\n"));
-  HRESULT hr = on_demand->Update(guid, job_observer);
-  ASSERT_EQ(hr, HRESULT_FROM_WIN32(RPC_S_SERVER_UNAVAILABLE)) <<
-      "Goopdate should have shutdown.";
-
-  wprintf(_T("Reconnecting to COM\n"));
-  ASSERT_EQ(Reconnect(), S_OK);
-
-  wprintf(_T("Starting Update\n"));
-  hr = on_demand->Update(guid, job_observer);
-  ASSERT_EQ(S_OK, hr);
-
-  WaitForUpdateCompletion(UPDATE_TIMEOUT);
-
-  ExpectSuccessful();
-  char* err_msg = "Did not observe a complete, successful install!";
-  EXPECT_TRUE(job_observer->observed & ON_INSTALLING) << err_msg;
-}
-
-
-
-bool ParseParams(int argc, TCHAR* argv[], CString* guid, bool* is_machine) {
-  ASSERT1(argv);
-  ASSERT1(guid);
-  if (argc < 3) {
-    return false;
-  }
-  *guid = argv[1];
-  // NOTE(cnygaard): I tried static casting from int to bool but it gave me a
-  // nasty warning about losing efficiency.
-  if (0 == _ttoi(argv[2])) {
-    *is_machine = false;
-  } else {
-    *is_machine = true;
-  }
-
-  // Verify that the guid is valid.
-  GUID parsed = StringToGuid(*guid);
-  if (parsed == GUID_NULL) {
-    return false;
-  }
-
-  argc -= 2;
-  testing::InitGoogleTest(&argc, argv+2);
-  return true;
-}
-
-}  // namespace omaha
-
-int _tmain(int argc, TCHAR** argv) {
-
-  if (!omaha::ParseParams(argc, argv, &omaha::guid, &omaha::is_machine)) {
-    wprintf(_T("Usage: ondemandsystem_unittest.exe \n"));
-    wprintf(_T("  [{GUID}] [is_machine (0|1)] --gtest_filter=<testname>\n"));
-    return 0;
-  }
-  omaha::FailOnAssert fail_on_assert;
-  CComModule module;
-  scoped_co_init com_apt;
-
-  int result = RUN_ALL_TESTS();
-  return result;
-}
-
diff --git a/testing/resource.h b/testing/resource.h
deleted file mode 100644
index 28b1d7f..0000000
--- a/testing/resource.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_TESTING_RESOURCE_H_
-#define OMAHA_TESTING_RESOURCE_H_
-
-#define IDS_ESCAPE_TEST                             8120
-#define IDS_ESCAPE_TEST1                            8121
-#define IDS_BUNDLE_INSTALLED_SUCCESSFULLY           8130
-#define IDS_INSTALLER_FAILED_WITH_MESSAGE           8131
-
-#define IDR_OMAHA3_TLB                              1
-
-// Needed for SetupServiceTest.
-#include "omaha/goopdate/non_localized_resource.h"
-
-#endif  // OMAHA_TESTING_RESOURCE_H_
diff --git a/testing/save_arguments.cc b/testing/save_arguments.cc
deleted file mode 100644
index 1640772..0000000
--- a/testing/save_arguments.cc
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Saves the arguments passed to this application to saved_arguments.txt in the
-// same directory as the executable.
-
-#include <atlstr.h>
-#include <stdio.h>
-#include <tchar.h>
-#include <windows.h>
-#include "omaha/base/app_util.h"
-#include "omaha/base/scoped_any.h"
-
-namespace {
-
-
-const TCHAR kSavedArgumentsFileName[] = _T("saved_arguments.txt");
-
-// Reports a Win32 error to the command line and debug output then exits the
-// process. Call immediately after the failed Win32 API call.
-void HandleWin32ErrorAndExit(const TCHAR* method) {
-  _ASSERTE(method);
-  int res = ::GetLastError();
-  CString error_message;
-  error_message.Format(_T("%s failed with error %i."), method, res);
-
-
-  _tprintf(_T("%s\n"), error_message);
-
-  CString debug_message;
-  debug_message.Format(_T("[SaveArguments.exe][%s]"), error_message);
-  ::OutputDebugString(debug_message);
-
-  exit(res);
-}
-
-// Performs actions that are useful for debugging.
-void DoDebugHelper() {
-  // This is useful for debugging Code Red.
-  CString message;
-  message.AppendFormat(_T("[SaveArguments.exe][Temp directory: %s]"),
-                       omaha::app_util::GetTempDir());
-  ::OutputDebugString(message);
-}
-
-// Performs actions that are helpful or required for Omaha unit tests.
-void DoUnitTestHelpers() {
-  // The following code adapted from mi.cpp allows unit test to verify that the
-  // executable file still exists and has not been deleted after the process
-  // is created.
-  TCHAR file_name[MAX_PATH] = {0};
-  if (!::GetModuleFileName(NULL, file_name, MAX_PATH)) {
-    HandleWin32ErrorAndExit(_T("GetModuleFileName"));
-  }
-  DWORD handle = 0;
-  DWORD ver_info_size = ::GetFileVersionInfoSize(file_name, &handle);
-  if (ver_info_size == 0) {
-    HandleWin32ErrorAndExit(_T("GetFileVersionInfoSize"));
-  }
-}
-
-// Writes the provided arguments to the file.
-// Returns whether it was successful.
-int WriteArgsToFile(const CString& arguments) {
-  CString file_path(omaha::app_util::GetCurrentModuleDirectory());
-  if (!::PathAppend(CStrBuf(file_path, MAX_PATH), kSavedArgumentsFileName)) {
-    _ASSERTE(false);
-    return -1;
-  }
-
-  scoped_hfile file(::CreateFile(file_path,
-                             GENERIC_READ | GENERIC_WRITE,
-                             0,                        // do not share
-                             NULL,                     // default security
-                             CREATE_ALWAYS,            // overwrite existing
-                             FILE_ATTRIBUTE_NORMAL,
-                             NULL));                    // no template
-  if (get(file) == INVALID_HANDLE_VALUE) {
-    HandleWin32ErrorAndExit(_T("CreateFile"));
-  }
-
-  DWORD bytes_written = 0;
-  if (!::WriteFile(get(file),
-                   arguments.GetString(),
-                   arguments.GetLength() * sizeof(TCHAR),
-                   &bytes_written,
-                   NULL)) {
-    HandleWin32ErrorAndExit(_T("WriteFile"));
-  }
-
-  return 0;
-}
-
-}  // namespace
-
-
-// Returns 0 on success and non-zero otherwise.
-int _tmain(int argc, TCHAR* argv[]) {
-  DoDebugHelper();
-  DoUnitTestHelpers();
-
-  CString arguments;
-
-  // Skip the first argument, which is the executable path.
-  for (int i = 1; i < argc; i++) {
-    arguments += argv[i];
-    if (i < argc - 1) {
-      arguments += " ";
-    }
-  }
-
-  return WriteArgsToFile(arguments);
-}
diff --git a/testing/save_arguments_version.rc b/testing/save_arguments_version.rc
deleted file mode 100644
index 08e779d..0000000
--- a/testing/save_arguments_version.rc
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2007 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <afxres.h>
-
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
-VS_VERSION_INFO VERSIONINFO
-// Resource Editor does not handle constants from main.scons.
-#ifndef APSTUDIO_INVOKED
- FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_BUILD,VERSION_PATCH
- PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_BUILD,VERSION_PATCH
-#endif  // APSTUDIO_INVOKED
- FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
-#if defined _DEBUG && OFFICIAL_BUILD
- FILEFLAGS VS_FF_DEBUG
-#elif defined _DEBUG
- FILEFLAGS VS_FF_DEBUG | VS_FF_PRIVATEBUILD
-#elif !OFFICIAL_BUILD
- FILEFLAGS VS_FF_PRIVATEBUILD
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS VOS_NT_WINDOWS32
- FILETYPE VFT_APP
- FILESUBTYPE VFT2_UNKNOWN
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "040904b0"
-        BEGIN
-// Requires constants from mains.scons that cannot be loaded in Resource Editor.
-#ifndef APSTUDIO_INVOKED
-            VALUE "CompanyName", FULL_COMPANY_NAME_ANSI
-            VALUE "FileDescription", OMAHA_APP_NAME_ANSI " SaveArguments"
-            VALUE "FileVersion", VERSION_NUMBER_STRING
-            VALUE "InternalName", OMAHA_APP_NAME_ANSI
-            VALUE "LegalCopyright", OMAHA_COPYRIGHT_STRING_ENGLISH
-            VALUE "OriginalFilename", "SaveArguments.exe"
-            VALUE "ProductName", OMAHA_APP_NAME_ANSI
-            VALUE "ProductVersion", VERSION_NUMBER_STRING
-  #ifdef _DEBUG
-            VALUE "Debug", ""
-  #endif
-  #if !OFFICIAL_BUILD
-            VALUE "PrivateBuild", BUILD_NUMBER
-  #endif
-#else
-            VALUE "_SpecialView",
-                  "Most values are not shown in Resource Editor because they "
-                  "require build file constants."
-#endif  // APSTUDIO_INVOKED
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x0409, 1200
-    END
-END
diff --git a/testing/ui/build.scons b/testing/ui/build.scons
deleted file mode 100644
index 7eb3304..0000000
--- a/testing/ui/build.scons
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-
-Import('env')
-
-
-local_env = env.Clone()
-
-omaha_version_info = local_env['omaha_versions_info'][0]
-
-local_env.FilterOut(LINKFLAGS = ['/NODEFAULTLIB'])
-
-local_env.Append(
-    CPPPATH = [
-        '$OBJ_ROOT',                    # Needed for the generated files
-        '$MAIN_DIR/goopdate/resources',
-        '$MAIN_DIR/third_party/gtest/include',
-        ],
-    CPPDEFINES = [
-        'UNITTEST',
-        '_ATL_APARTMENT_THREADED',
-        ],
-    LIBS = [
-        '$LIB_DIR/breakpad.lib',
-        '$LIB_DIR/core.lib',
-        '$LIB_DIR/goopdate_dll.lib',
-        '$LIB_DIR/google_update_ps.lib',
-        '$LIB_DIR/google_update_recovery.lib',
-        '$LIB_DIR/logging.lib',
-        '$LIB_DIR/net.lib',
-        '$LIB_DIR/repair_goopdate.lib',
-        '$LIB_DIR/security.lib',
-        '$LIB_DIR/service.lib',
-        '$LIB_DIR/statsreport.lib',
-        '$LIB_DIR/setup.lib',
-        '$LIB_DIR/worker.lib',
-        '$LIB_DIR/gtest.lib',
-        '$LIB_DIR/common.lib',
-        ('atls.lib', 'atlsd.lib')[local_env.Bit('debug')],
-        'comctl32.lib',
-        'crypt32.lib',
-        'iphlpapi.lib',
-        'msi.lib',
-        'mstask.lib',
-        'netapi32.lib',
-        'psapi.lib',
-        'rasapi32.lib',
-        'rpcns4.lib',
-        'rpcrt4.lib',
-        'shlwapi.lib',
-        'urlmon.lib',
-        'userenv.lib',
-        'version.lib',
-        'wininet.lib',
-        'wintrust.lib',
-        'wtsapi32.lib',
-        ],
-    RCFLAGS = [
-        '/DVERSION_MAJOR=%d' % omaha_version_info.version_major,
-        '/DVERSION_MINOR=%d' % omaha_version_info.version_minor,
-        '/DVERSION_BUILD=%d' % omaha_version_info.version_build,
-        '/DVERSION_PATCH=%d' % omaha_version_info.version_patch,
-        '/DVERSION_NUMBER_STRING=\\"%s\\"' % (
-            omaha_version_info.GetVersionString()),
-        '/DLANGUAGE_STRING=\\"en\\"'
-        ],
-)
-
-unittest_res = local_env.RES('ui_unittest.rc'),
-
-local_env.Depends(unittest_res, '$MAIN_DIR/VERSION')
-
-# A test is a console application, so we tell mk to link to
-# main() as opposed to WinMain().
-local_env.FilterOut(LINKFLAGS = ['/SUBSYSTEM:WINDOWS'])
-local_env['LINKFLAGS'] += ['/SUBSYSTEM:CONSOLE']
-
-# Do not name the output _unittest.exe or _test.exe to avoid the build machine
-# automatically running it after the build. See rut.py for details.
-target_name = 'ui_systemtest'
-
-inputs = [
-    'ui_unittest.cc',
-    '../../worker/progresswnd_unittest.cc',
-    unittest_res,
-    ]
-if env.Bit('use_precompiled_headers'):
-  inputs += local_env.EnablePrecompile(target_name)
-
-local_env.ComponentTestProgram(
-    prog_name=target_name,
-    source=inputs,
-    COMPONENT_TEST_RUNNABLE=False
-)
-
diff --git a/testing/ui/ui_unittest.cc b/testing/ui/ui_unittest.cc
deleted file mode 100644
index 3a6b092..0000000
--- a/testing/ui/ui_unittest.cc
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/testing/unit_test.h"
-
-int _tmain(int argc, TCHAR** argv) {
-  testing::InitGoogleTest(&argc, argv);
-  int result = RUN_ALL_TESTS();
-
-  return result;
-}
-
diff --git a/testing/ui/ui_unittest.manifest b/testing/ui/ui_unittest.manifest
deleted file mode 100644
index 6165751..0000000
--- a/testing/ui/ui_unittest.manifest
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
-  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
-    <security>
-      <requestedPrivileges>
-        <requestedExecutionLevel level="asInvoker" />
-      </requestedPrivileges>
-    </security>
-  </trustInfo>
-  <dependency>
-    <dependentAssembly>
-        <assemblyIdentity
-            type="win32"
-            name="Microsoft.Windows.Common-Controls"
-            version="6.0.0.0"
-            processorArchitecture="X86"
-            publicKeyToken="6595b64144ccf1df"
-            language="*"
-        />
-    </dependentAssembly>
-  </dependency>
-  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
-    <application>
-      <!--The ID below indicates application support for Windows Vista -->
-      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
-      <!--The ID below indicates application support for Windows 7 -->
-      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
-    </application>
-  </compatibility>
-</assembly>
diff --git a/testing/ui/ui_unittest.rc b/testing/ui/ui_unittest.rc
deleted file mode 100644
index 4b1cdfa..0000000
--- a/testing/ui/ui_unittest.rc
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/goopdate/resource.h"
-
-#include <afxres.h>
-
-#include "omaha/goopdate/resources/goopdateres/generated_resources_en.rc"
-
-1 RT_MANIFEST "ui_unittest.manifest"
-
-IDI_APP   ICON  "omaha/goopdate/goopdate.ico"
-
diff --git a/testing/unit_test.cc b/testing/unit_test.cc
deleted file mode 100644
index 96ae11c..0000000
--- a/testing/unit_test.cc
+++ /dev/null
@@ -1,371 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "testing/unit_test.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/path.h"
-#include "omaha/base/process.h"
-#include "omaha/base/reg_key.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/system.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/user_info.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/command_line.h"
-#include "omaha/common/command_line_builder.h"
-#include "omaha/common/const_goopdate.h"
-
-namespace omaha {
-
-namespace {
-
-static bool is_buildsystem = false;
-static TCHAR psexec_dir[MAX_PATH] = {0};
-
-// Returns whether all unit tests should be run.
-bool ShouldRunAllTests() {
-  if (is_buildsystem) {
-    return true;
-  }
-
-  EXPECT_FALSE(IsEnvironmentVariableSet(_T("OMAHA_RUN_ALL_TESTS")))
-      << _T("Use OMAHA_TEST_RUN_ALL instead of OMAHA_RUN_ALL_TESTS.");
-
-  return IsEnvironmentVariableSet(_T("OMAHA_TEST_RUN_ALL"));
-}
-
-}  // namespace
-
-bool IsEnvironmentVariableSet(const TCHAR* name) {
-  ASSERT1(name);
-  TCHAR var[100] = {0};
-  DWORD res = ::GetEnvironmentVariable(name, var, arraysize(var));
-  if (0 == res) {
-    ASSERT1(ERROR_ENVVAR_NOT_FOUND == ::GetLastError());
-    return false;
-  } else {
-    return true;
-  }
-}
-
-bool IsTestRunByLocalSystem() {
-  return user_info::IsRunningAsSystem();
-}
-
-CString GetLocalAppDataPath() {
-  CString expected_local_app_data_path;
-  EXPECT_SUCCEEDED(GetFolderPath(CSIDL_LOCAL_APPDATA | CSIDL_FLAG_DONT_VERIFY,
-                                 &expected_local_app_data_path));
-  expected_local_app_data_path.Append(_T("\\"));
-  return expected_local_app_data_path;
-}
-
-CString GetGoogleUserPath() {
-  return GetLocalAppDataPath() + SHORT_COMPANY_NAME + _T("\\");
-}
-
-// TODO(omaha): make GetGoogleUpdateUserPath and GetGoogleUpdateMachinePath
-// consistent. They should end with \ or not.
-CString GetGoogleUpdateUserPath() {
-  return GetGoogleUserPath() + PRODUCT_NAME + _T("\\");
-}
-
-CString GetGoogleUpdateMachinePath() {
-  CString program_files;
-  GetFolderPath(CSIDL_PROGRAM_FILES, &program_files);
-  return program_files + _T("\\") + SHORT_COMPANY_NAME
-                        + _T("\\") + PRODUCT_NAME;
-}
-
-DWORD GetDwordValue(const CString& full_key_name, const CString& value_name) {
-  DWORD value = 0;
-  EXPECT_SUCCEEDED(RegKey::GetValue(full_key_name, value_name, &value));
-  return value;
-}
-
-CString GetSzValue(const CString& full_key_name, const CString& value_name) {
-  CString value;
-  EXPECT_SUCCEEDED(RegKey::GetValue(full_key_name, value_name, &value));
-  return value;
-}
-
-GUID StringToGuid(const CString& str) {
-  GUID guid(GUID_NULL);
-  VERIFY(SUCCEEDED(StringToGuidSafe(str, &guid)), (_T("guid '%s'"), str));
-  return guid;
-}
-
-void OverrideRegistryHives(const CString& hive_override_key_name) {
-  OverrideSpecifiedRegistryHives(hive_override_key_name, true, true);
-}
-
-void OverrideSpecifiedRegistryHives(const CString& hive_override_key_name,
-                                    bool override_hklm,
-                                    bool override_hkcu) {
-  // Override the destinations of HKLM and HKCU to use a special location
-  // for the unit tests so that we don't disturb the actual Omaha state.
-  RegKey machine_key;
-  RegKey user_key;
-  ASSERT_SUCCEEDED(machine_key.Create(hive_override_key_name + MACHINE_KEY));
-  ASSERT_SUCCEEDED(user_key.Create(hive_override_key_name + USER_KEY));
-  if (override_hklm) {
-    ASSERT_SUCCEEDED(::RegOverridePredefKey(HKEY_LOCAL_MACHINE,
-                                            machine_key.Key()));
-  }
-  if (override_hkcu) {
-    ASSERT_SUCCEEDED(::RegOverridePredefKey(HKEY_CURRENT_USER,
-                                            user_key.Key()));
-  }
-}
-
-// When tests execute programs (i.e. with ShellExecute or indirectly), Windows
-// looks at kMyComputerSecurityZoneKeyPathL:kMiscSecurityZonesValueName
-// to see if it should run the program.
-// Normally, these reads are not redirected to the override key even though
-// it seems like they should be. In this case, the execution succeeds.
-// In certain cases, the reads are redirected and the program execution
-// fails due to permission denied errors.
-// This has been observed when XmlUtilsTest::LoadSave() is run before such
-// tests. Specifically, the my_xmldoc->load() call in LoadXMLFromFile()
-// appears to somehow cause the redirection to occur.
-//
-// See http://support.microsoft.com/kb/182569 for information on security
-// zones.
-void OverrideRegistryHivesWithExecutionPermissions(
-         const CString& hive_override_key_name) {
-  OverrideRegistryHives(hive_override_key_name);
-
-  const TCHAR kMyComputerSecurityZoneKeyPath[] =
-      _T("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\")
-      _T("Internet Settings\\Zones\\0");
-  const TCHAR kMiscSecurityZonesValueName[] = _T("1806");
-  const DWORD kPermitAction = 0;
-
-  RegKey my_computer_zone_key;
-  ASSERT_SUCCEEDED(my_computer_zone_key.Create(
-      kMyComputerSecurityZoneKeyPath));
-  ASSERT_SUCCEEDED(my_computer_zone_key.SetValue(kMiscSecurityZonesValueName,
-                                                 kPermitAction));
-}
-
-void RestoreRegistryHives() {
-  ASSERT_SUCCEEDED(::RegOverridePredefKey(HKEY_LOCAL_MACHINE, NULL));
-  ASSERT_SUCCEEDED(::RegOverridePredefKey(HKEY_CURRENT_USER, NULL));
-}
-
-void SetPsexecDir(const CString& dir) {
-  _tcscpy_s(psexec_dir, arraysize(psexec_dir), dir.GetString());
-}
-
-CString GetPsexecDir() {
-  EXPECT_TRUE(_tcsnlen(psexec_dir, arraysize(psexec_dir)));
-  return psexec_dir;
-}
-
-// Must be called after SetPsexecDir().
-// Does not wait for the EULA accepting process to complete.
-bool AcceptPsexecEula() {
-  CString psexec_dir = GetPsexecDir();
-  if (psexec_dir.IsEmpty()) {
-    return false;
-  }
-
-  CString psexec_path = ConcatenatePath(psexec_dir, _T("psexec.exe"));
-  return SUCCEEDED(System::StartProcessWithArgs(psexec_path,
-                                                _T("/accepteula")));
-}
-
-void SetIsBuildSystem() {
-  is_buildsystem = true;
-}
-
-bool IsBuildSystem() {
-  return is_buildsystem;
-}
-
-void SetBuildSystemTestSource() {
-  EXPECT_SUCCEEDED(RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                    kRegValueTestSource,
-                                    _T("buildsystem")));
-}
-
-bool ShouldRunLargeTest() {
-  if (ShouldRunAllTests()) {
-    return true;
-  }
-
-  if (IsEnvironmentVariableSet(_T("OMAHA_TEST_RUN_LARGE"))) {
-    return true;
-  } else {
-    std::wcout << _T("\tThis large test did not run because neither ")
-                  _T("'OMAHA_TEST_RUN_LARGE' or 'OMAHA_TEST_RUN_ALL' is set ")
-                  _T("in the environment.") << std::endl;
-    return false;
-  }
-}
-
-bool ShouldRunEnormousTest() {
-  if (ShouldRunAllTests()) {
-    return true;
-  }
-
-  std::wcout << _T("\tThis large test did not run because ")
-              _T("'OMAHA_TEST_RUN_ALL' is not set in the environment.")
-           << std::endl;
-  return false;
-}
-
-void TerminateAllProcessesByName(const TCHAR* process_name) {
-  std::vector<uint32> process_pids;
-  ASSERT_SUCCEEDED(Process::FindProcesses(0,  // No flags.
-                                          process_name,
-                                          true,
-                                          &process_pids));
-
-  for (size_t i = 0; i < process_pids.size(); ++i) {
-    scoped_process process(::OpenProcess(PROCESS_TERMINATE,
-                                         FALSE,
-                                         process_pids[i]));
-    EXPECT_TRUE(process);
-    EXPECT_TRUE(::TerminateProcess(get(process), static_cast<uint32>(-3)));
-  }
-}
-
-void TerminateAllGoogleUpdateProcesses() {
-  TerminateAllProcessesByName(kOmahaShellFileName);
-  TerminateAllProcessesByName(kCrashHandlerFileName);
-}
-
-// The exit code of psexec is the pid it started when -d is used.
-// Wait for psexec to exit, get the exit code, and use it to get a handle
-// to the GoogleUpdate.exe instance.
-void LaunchProcessAsSystem(const CString& launch_cmd, HANDLE* process) {
-  ASSERT_TRUE(process);
-
-  CString app_launcher = ConcatenatePath(GetPsexecDir(), _T("psexec.exe"));
-  CString cmd_line_args;
-  cmd_line_args.Format(_T("-s -d %s"), launch_cmd);
-
-  PROCESS_INFORMATION pi = {0};
-  EXPECT_SUCCEEDED(System::StartProcessWithArgsAndInfo(app_launcher,
-                                                       cmd_line_args,
-                                                       &pi));
-  ::CloseHandle(pi.hThread);
-  scoped_handle started_process(pi.hProcess);
-  ASSERT_TRUE(started_process);
-
-  DWORD google_update_pid = 0;
-  EXPECT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(get(started_process), 30000));
-  EXPECT_TRUE(::GetExitCodeProcess(get(started_process), &google_update_pid));
-  DWORD desired_access =
-      PROCESS_QUERY_INFORMATION | SYNCHRONIZE | PROCESS_TERMINATE;
-  *process = ::OpenProcess(desired_access, false, google_update_pid);
-  DWORD last_error(::GetLastError());
-
-  // psexec sometimes returns errors instead of PIDs and there is no way to
-  // tell the difference. We see ERROR_SERVICE_MARKED_FOR_DELETE (1072)
-  // intermittently on the build server, but do not expect any other errors.
-  EXPECT_TRUE(*process ||
-              ERROR_SERVICE_MARKED_FOR_DELETE == google_update_pid) <<
-      _T("::OpenProcess failed in a case where psexec did not return ")
-      _T("ERROR_SERVICE_MARKED_FOR_DELETE.") << _T(" The error was ")
-      << last_error << _T(".");
-}
-
-void LaunchProcess(const CString& exe_path,
-                   const CString& args,
-                   bool as_system,
-                   HANDLE* process) {
-  ASSERT_TRUE(process);
-  *process = NULL;
-
-  CString launch_cmd = exe_path;
-  EnclosePath(&launch_cmd);
-  launch_cmd += args.IsEmpty() ? _T("") : _T(" ") + args;
-
-  if (as_system) {
-    // Retry the process launch if the process handle is invalid. Hopefully this
-    // is robust against intermittent ERROR_SERVICE_MARKED_FOR_DELETE errors.
-    for (int tries = 0; tries < 10 && !*process; ++tries) {
-      LaunchProcessAsSystem(launch_cmd, process);
-      if (!*process) {
-        ::Sleep(1000);
-      }
-    }
-  } else {
-    PROCESS_INFORMATION pi = {0};
-    EXPECT_SUCCEEDED(System::StartProcess(NULL, launch_cmd.GetBuffer(), &pi));
-    ::CloseHandle(pi.hThread);
-    *process = pi.hProcess;
-  }
-
-  ASSERT_TRUE(*process);
-}
-
-void RegistryProtectedTest::SetUp() {
-  RegKey::DeleteKey(hive_override_key_name_, true);
-  OverrideRegistryHives(hive_override_key_name_);
-}
-
-void RegistryProtectedTest::TearDown() {
-  RestoreRegistryHives();
-  ASSERT_SUCCEEDED(RegKey::DeleteKey(hive_override_key_name_, true));
-}
-
-CString GetUniqueTempDirectoryName() {
-  CString guid;
-  EXPECT_HRESULT_SUCCEEDED(GetGuid(&guid));
-  return ConcatenatePath(app_util::GetTempDir(), guid);
-}
-
-void RunAsAdmin(const CString& exe_path, const CString& cmd_line) {
-  if (vista_util::IsUserAdmin()) {
-    EXPECT_SUCCEEDED(RegisterOrUnregisterExe(exe_path, cmd_line));
-    return;
-  }
-
-  // Elevate for medium integrity users on Vista and above.
-  DWORD exit_code(S_OK);
-  EXPECT_SUCCEEDED(vista_util::RunElevated(exe_path,
-                                           cmd_line,
-                                           SW_SHOWNORMAL,
-                                           &exit_code));
-  EXPECT_SUCCEEDED(exit_code);
-}
-
-void RegisterOrUnregisterGoopdateLocalServer(bool reg) {
-  CString server_path = ConcatenatePath(GetGoogleUpdateMachinePath(),
-                                        kOmahaShellFileName);
-  EnclosePath(&server_path);
-
-  CommandLineBuilder builder(reg ? COMMANDLINE_MODE_REGSERVER :
-                                   COMMANDLINE_MODE_UNREGSERVER);
-  CString cmd_line = builder.GetCommandLineArgs();
-  RunAsAdmin(server_path, cmd_line);
-}
-
-void RegisterOrUnregisterGoopdateService(bool reg) {
-  CString service_path = ConcatenatePath(GetGoogleUpdateMachinePath(),
-                                         kServiceFileName);
-  EnclosePath(&service_path);
-
-  CommandLineBuilder builder(reg ? COMMANDLINE_MODE_SERVICE_REGISTER :
-                                   COMMANDLINE_MODE_SERVICE_UNREGISTER);
-  CString cmd_line = builder.GetCommandLineArgs();
-  RunAsAdmin(service_path, cmd_line);
-}
-
-}  // namespace omaha
diff --git a/testing/unit_test.h b/testing/unit_test.h
deleted file mode 100644
index b861f6c..0000000
--- a/testing/unit_test.h
+++ /dev/null
@@ -1,247 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Common include file for unit testing.
-
-#ifndef OMAHA_TESTING_UNIT_TEST_H_
-#define OMAHA_TESTING_UNIT_TEST_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/scoped_ptr.h"
-#include "omaha/testing/unittest_debug_helper.h"
-#pragma warning(push)
-// C4628: digraphs not supported with -Ze.
-#pragma warning(disable : 4628)
-// C4826: Conversion from 'TYPE *' to 'testing::internal::UInt64' is
-// sign-extended. This may cause unexpected runtime behavior.
-// Caused by a hack in DefaultPrintTo.
-#pragma warning(disable : 4826)
-#include "omaha/third_party/gmock/include/gmock/gmock.h"
-#pragma warning(pop)
-#include "omaha/third_party/gtest/include/gtest/gtest.h"
-
-namespace omaha {
-
-const TCHAR* const kUnittestName = _T("omaha_unittest.exe");
-
-// Predicates needed by ASSERT_PRED1 for function returning an HRESULT.
-inline testing::AssertionResult Succeeded(const char* s, HRESULT hr) {
-  if (SUCCEEDED(hr)) {
-    return testing::AssertionSuccess();
-  } else {
-    CStringA text;
-    text.AppendFormat("%s failed with error 0x%08x", s, hr);
-    testing::Message msg;
-    msg << text;
-    return testing::AssertionFailure(msg);
-  }
-}
-
-inline testing::AssertionResult Failed(const char* s, HRESULT hr) {
-  if (FAILED(hr)) {
-    return testing::AssertionSuccess();
-  } else {
-    CStringA text;
-    text.AppendFormat("%s failed with error 0x%08x", s, hr);
-    testing::Message msg;
-    msg << text;
-    return testing::AssertionFailure(msg);
-  }
-}
-
-// Returns true if the variable exists in the environment, even if it is "0".
-bool IsEnvironmentVariableSet(const TCHAR* name);
-
-// Returns true if current unit test process owner is LOCALSYSTEM.
-bool IsTestRunByLocalSystem();
-
-// Returns the path to the base local app data directory for the user on the
-// current OS.
-CString GetLocalAppDataPath();
-
-// Returns the path to the base Google directory for the user on the current OS.
-CString GetGoogleUserPath();
-
-// Returns the path to the base Google Update directory for the user on the
-// current OS.
-CString GetGoogleUpdateUserPath();
-
-// Returns the path to the base Google Update directory for the per-machine
-// install on the current OS.
-CString GetGoogleUpdateMachinePath();
-
-// Returns a DWORD registry value from the registry. Assumes the value exists.
-// Useful for inline comparisons in EXPECT_EQ.
-DWORD GetDwordValue(const CString& full_key_name, const CString& value_name);
-
-// Returns a SZ registry value from the registry. Assumes the value exists.
-// Useful for inline comparisons in EXPECT_STREQ.
-CString GetSzValue(const CString& full_key_name, const CString& value_name);
-
-// Converts string to GUID. Assumes the string is a valid GUID.
-GUID StringToGuid(const CString& str);
-
-const TCHAR* const kRegistryHiveOverrideRoot =
-    _T("HKCU\\Software\\") _T(SHORT_COMPANY_NAME_ANSI)
-    _T("\\") _T(PRODUCT_NAME_ANSI)
-    _T("\\UnitTest\\");
-const TCHAR* const kCsidlSystemIdsRegKey =
-    _T("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion");
-const TCHAR* const kCsidlProgramFilesRegValue =
-    _T("ProgramFilesDir");
-
-// TODO(omaha): consider renaming hive_override_key_name to new_key.
-// TODO(omaha): consider making these utility functions, maybe extend the
-//               RegKey class.
-//
-// Overrides the HKLM and HKCU registry hives so that accesses go to the
-// specified registry key instead. The function creates the
-// hive_override_key_name. In other words, overriding HKCU with
-// "HKCU\\Software\\Google\\Update\\UnitTest\\" and accessing HKCU\\Foo results
-// in an access at "HKCU\\Software\\Google\\Update\\UnitTest\\Foo".
-// This method is most often used in SetUp().
-void OverrideRegistryHives(const CString& hive_override_key_name);
-
-// Overrides only the specified hives.
-// This is useful when modifying registry settings in one hive while using
-// code (e.g. WinHttp) that relies on valid registry entries that are difficult
-// to reproduce.
-//
-// TODO(omaha): Consider renaming to:
-// void OverrideRegistryHive(HKEY hive, const CString& new_key);
-void OverrideSpecifiedRegistryHives(const CString& hive_override_key_name,
-                                    bool override_hklm,
-                                    bool override_hkcu);
-
-// Overrides the HKLM and HKCU registry hives so that accesses go to the
-// specified registry key instead. Provides permissions to execute local files.
-void OverrideRegistryHivesWithExecutionPermissions(
-         const CString& hive_override_key_name);
-
-// Restores HKLM and HKCU registry accesses to the real hives.
-// This method is most often used in TearDown(). It does not cleanup the
-// registry key that is created by OverrideRegistryHives.
-void RestoreRegistryHives();
-
-// Specifies the location of psexec.exe. Only call during initialization.
-void SetPsexecDir(const CString& dir);
-
-// Returns the location of psexec.exe.
-CString GetPsexecDir();
-
-// Accepts the psexec.exe EULA. Only use for automated testing when you have
-// already read and agreed to the EULA terms.
-// Returns true if the process was successfully started.
-bool AcceptPsexecEula();
-
-// Specifies that the tests are running on or on behalf of the build system.
-void SetIsBuildSystem();
-
-// Returns whether tests are running on or on behalf of the build system.
-bool IsBuildSystem();
-
-// Sets TestSource=buildsystem.
-void SetBuildSystemTestSource();
-
-// Returns whether large tests should be run. Large tests are always run on the
-// build system and if the "OMAHA_TEST_RUN_LARGE" or "OMAHA_TEST_RUN_ALL"
-// environment variable is set.
-bool ShouldRunLargeTest();
-
-// Returns whether enourmous tests should be run. Enormous tests are always run
-// on the build system and if the "OMAHA_TEST_RUN_ALL" environment variable is
-// set. This method should be used sparingly and only by tests that take a
-// really long time to complete.
-bool ShouldRunEnormousTest();
-
-// Terminates all processes named GoogleUpdate.exe or GoogleCrashHandler.exe.
-void TerminateAllGoogleUpdateProcesses();
-
-// Launches a process and returns its handle.
-void LaunchProcess(const CString& exe_path,
-                   const CString& args,
-                   bool as_system,
-                   HANDLE* process);
-
-// Launches a process as system and returns its handle. The function uses
-// psexec to run the process.
-void LaunchProcessAsSystem(const CString& launch_cmd, HANDLE* process);
-
-// Copies Omaha installation files under omaha_path.
-void CopyGoopdateFiles(const CString& omaha_path, const CString& version);
-
-// A generic test fixture that overrides the HKLM and HKCU hives.
-class RegistryProtectedTest : public testing::Test {
- protected:
-  RegistryProtectedTest()
-      : hive_override_key_name_(kRegistryHiveOverrideRoot) {
-  }
-
-  virtual void SetUp();
-  virtual void TearDown();
-
-  const CString hive_override_key_name_;
-};
-
-// Returns the full path of a unique directory under the user temp directory.
-CString GetUniqueTempDirectoryName();
-
-// Runs the command as an administrator.
-void RunAsAdmin(const CString& exe_path, const CString& cmd_line);
-
-void RegisterOrUnregisterGoopdateLocalServer(bool reg);
-
-void RegisterOrUnregisterGoopdateService(bool reg);
-
-}  // namespace omaha
-
-// TODO(omaha): Replace custom predicates with EXPECT_HRESULT_SUCCEEDED/FAILED.
-#define ASSERT_SUCCEEDED(x) ASSERT_PRED_FORMAT1(omaha::Succeeded, x)
-#define EXPECT_SUCCEEDED(x) EXPECT_PRED_FORMAT1(omaha::Succeeded, x)
-#define ASSERT_FAILED(x) ASSERT_PRED_FORMAT1(omaha::Failed, x)
-#define EXPECT_FAILED(x) EXPECT_PRED_FORMAT1(omaha::Failed, x)
-
-// As of Google Test 1.4.0, expressions get converted to 'bool', resulting in
-// "warning C4800: 'BOOL' : forcing value to bool 'true' or 'false' (performance
-// warning)" in some uses.
-// These must be kept in sync with gtest.h.
-// TODO(omaha): Try to get this fixed in Google Test.
-#undef EXPECT_TRUE
-#define EXPECT_TRUE(condition) \
-  GTEST_TEST_BOOLEAN_(!!(condition), #condition, false, true, \
-                      GTEST_NONFATAL_FAILURE_)
-#undef ASSERT_TRUE
-#define ASSERT_TRUE(condition) \
-  GTEST_TEST_BOOLEAN_(!!(condition), #condition, false, true, \
-                      GTEST_FATAL_FAILURE_)
-
-// GMock's ACTION* macros have 10 parameters, most of which go unused.
-// This macro can be used inside ACTION* definitions to suppress warning
-// C4100: unreferenced formal parameter.
-#define UNREFERENCED_ACTION_PARAMETERS \
-    UNREFERENCED_PARAMETER(args); \
-    UNREFERENCED_PARAMETER(arg0); \
-    UNREFERENCED_PARAMETER(arg1); \
-    UNREFERENCED_PARAMETER(arg2); \
-    UNREFERENCED_PARAMETER(arg3); \
-    UNREFERENCED_PARAMETER(arg4); \
-    UNREFERENCED_PARAMETER(arg5); \
-    UNREFERENCED_PARAMETER(arg6); \
-    UNREFERENCED_PARAMETER(arg7); \
-    UNREFERENCED_PARAMETER(arg8); \
-    UNREFERENCED_PARAMETER(arg9)
-
-#endif  // OMAHA_TESTING_UNIT_TEST_H_
diff --git a/testing/unit_test_unittest.cc b/testing/unit_test_unittest.cc
deleted file mode 100644
index 6f50e1f..0000000
--- a/testing/unit_test_unittest.cc
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright 2009-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/utils.h"
-#include "omaha/base/user_info.h"
-#include "omaha/base/vistautil.h"
-#include "testing/unit_test.h"
-
-namespace omaha {
-
-TEST(UnitTestHelpersTest, GetLocalAppDataPath) {
-  if (IsTestRunByLocalSystem()) {
-    return;
-  }
-
-  const TCHAR kUserXpLocalAppDataPathFormat[] =
-      _T("C:\\Documents and Settings\\%s\\Local Settings\\Application Data\\");
-  const TCHAR kUserVistaLocalAppDataPathFormat[] =
-      _T("C:\\Users\\%s\\AppData\\Local\\");
-
-  TCHAR username[MAX_PATH] = {0};
-  EXPECT_TRUE(::GetEnvironmentVariable(_T("USERNAME"),
-                                       username,
-                                       arraysize(username)));
-  CString expected_path;
-  expected_path.Format(vista_util::IsVistaOrLater() ?
-                           kUserVistaLocalAppDataPathFormat :
-                           kUserXpLocalAppDataPathFormat,
-                       username);
-  EXPECT_STREQ(expected_path, GetLocalAppDataPath());
-}
-
-// GUIDs cannot be compared in GTest because there is no << operator. Therefore,
-// we must treat them as strings. All these tests rely on GuidToString working.
-#define EXPECT_GUID_EQ(expected, actual) \
-    EXPECT_STREQ(GuidToString(expected), GuidToString(actual))
-
-TEST(UnitTestHelpersTest, StringToGuid_InvalidString) {
-  ExpectAsserts expect_asserts;  // Invalid strings cause an assert.
-
-  EXPECT_GUID_EQ(GUID_NULL, StringToGuid(_T("")));
-  EXPECT_GUID_EQ(GUID_NULL, StringToGuid(_T("{}")));
-  EXPECT_GUID_EQ(GUID_NULL, StringToGuid(_T("a")));
-  EXPECT_GUID_EQ(GUID_NULL,
-                 StringToGuid(_T("CA3045BFA6B14fb8A0EFA615CEFE452C")));
-
-  // Missing {}
-  EXPECT_GUID_EQ(GUID_NULL,
-                 StringToGuid(_T("CA3045BF-A6B1-4fb8-A0EF-A615CEFE452C")));
-
-  // Invalid char X
-  EXPECT_GUID_EQ(GUID_NULL,
-                 StringToGuid(_T("{XA3045BF-A6B1-4fb8-A0EF-A615CEFE452C}")));
-
-  // Invalid binary char 0x200
-  EXPECT_GUID_EQ(
-      GUID_NULL,
-      StringToGuid(_T("{\0x200a3045bf-a6b1-4fb8-a0ef-a615cefe452c}")));
-
-  // Missing -
-  EXPECT_GUID_EQ(GUID_NULL,
-                 StringToGuid(_T("{CA3045BFA6B14fb8A0EFA615CEFE452C}")));
-
-  // Double quotes
-  EXPECT_GUID_EQ(
-      GUID_NULL,
-      StringToGuid(_T("\"{ca3045bf-a6b1-4fb8-a0ef-a615cefe452c}\"")));
-}
-
-TEST(UnitTestHelpersTest, StringToGuid_ValidString) {
-  const GUID kExpectedGuid = {0xCA3045BF, 0xA6B1, 0x4FB8,
-                              {0xA0, 0xEF, 0xA6, 0x15, 0xCE, 0xFE, 0x45, 0x2C}};
-
-  // Converted successfully, but indistinguishable from failures.
-  EXPECT_GUID_EQ(GUID_NULL,
-                 StringToGuid(_T("{00000000-0000-0000-0000-000000000000}")));
-
-  EXPECT_GUID_EQ(kExpectedGuid,
-                 StringToGuid(_T("{CA3045BF-A6B1-4fb8-A0EF-A615CEFE452C}")));
-
-  EXPECT_GUID_EQ(kExpectedGuid,
-                 StringToGuid(_T("{ca3045bf-a6b1-4fb8-a0ef-a615cefe452c}")));
-}
-
-}  // namespace omaha
diff --git a/testing/unittest_debug_helper.h b/testing/unittest_debug_helper.h
deleted file mode 100644
index ac1787c..0000000
--- a/testing/unittest_debug_helper.h
+++ /dev/null
@@ -1,148 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-// Unit Test Debug Helper
-
-// This file contains assert override functions
-// It is meant to be #included only in unittest.cc files.
-
-#ifndef OMAHA_TESTING_UNITTEST_DEBUG_HELPER_H__
-#define OMAHA_TESTING_UNITTEST_DEBUG_HELPER_H__
-
-#include "base/basictypes.h"
-#include "omaha/base/debug.h"
-#include "third_party/gtest/include/gtest/gtest.h"
-
-namespace omaha {
-
-typedef int AssertResponse;
-#define IGNORE_ALWAYS 0
-#define IGNORE_ONCE   0
-
-extern int g_assert_count;
-
-// A class with no methods which will, once acquired, cause asserts to
-// be routed through the given function; once released, they will return
-// to the previous handler.
-class UseAssertFunction {
- public:
-  explicit UseAssertFunction(DebugAssertFunctionType *function) {
-    function;
-    old_function_ = REPLACE_ASSERT_FUNCTION(function);
-  }
-
-  ~UseAssertFunction() {
-    REPLACE_ASSERT_FUNCTION(old_function_);
-  }
-
-  bool asserts_enabled() {
-    return old_function_ != NULL;  // "!= NULL" fixes the perf warning C4800
-  }
-
- private:
-  DebugAssertFunctionType *old_function_;
-  DISALLOW_EVIL_CONSTRUCTORS(UseAssertFunction);
-};
-
-
-// A class with no methods which will send asserts to GTest as failures;
-// once released, it restores the assert handler to the previous handler.
-// Example usage:
-//  int main() {
-//    // Report asserts to GTest, not a messagebox.
-//    FailOnAssert a;
-//    return RUN_ALL_TESTS();
-//  }
-class FailOnAssert {
- public:
-  FailOnAssert() : inner_(AssertHandler) {
-  }
-
-  static AssertResponse AssertHandler(const char *expression,
-      const char *message, const char *file, int line) {
-    ADD_FAILURE() << "ASSERT in " << file << "(" << line << "): "
-                  << expression << "; \"" << message << "\"";
-    return IGNORE_ALWAYS;
-  }
-
- private:
-  UseAssertFunction inner_;
-  DISALLOW_EVIL_CONSTRUCTORS(FailOnAssert);
-};
-
-// A class with no methods which will cause asserts to be ignored;
-// once released, it restores the assert handler to the previous handler.
-// Example usage:
-//  test1() {
-//    IngoreAssert a;
-//    TestSomethingWhichMayOrMayNotAssert();
-//  }
-class IgnoreAsserts {
- public:
-  IgnoreAsserts() : inner_(AssertHandler) {
-  }
-
-  static AssertResponse AssertHandler(const char *,
-                                      const char *,
-                                      const char *,
-                                      int) {
-    return IGNORE_ALWAYS;
-  }
-
- private:
-  UseAssertFunction inner_;
-  DISALLOW_EVIL_CONSTRUCTORS(IgnoreAsserts);
-};
-
-// A class with no methods which will cause asserts to be counted but otherwise
-// ignored; once released, a GTest assert will be run to see if any asserts
-// were fired, and the assert handler will be restored to the previous handler.
-// Example usage:
-//  test2() {
-//    ExpectAsserts a;
-//    TestSomethingWhichIsKnownToAssert();
-//  }
-class ExpectAsserts {
- public:
-  ExpectAsserts() : inner_(AssertHandler),
-    old_assert_count_(g_assert_count) {
-  }
-
-  ~ExpectAsserts() {
-    DeInit();
-  }
-
-  static AssertResponse AssertHandler(const char *,
-                                      const char *,
-                                      const char *,
-                                      int) {
-    ++g_assert_count;
-    return IGNORE_ONCE;
-  }
- private:
-  void DeInit() {
-    if (inner_.asserts_enabled()) {
-      ASSERT_GT(g_assert_count, old_assert_count_)
-          << "This test was expected to trigger at least one assert.";
-    }
-  }
-
-  int old_assert_count_;
-  UseAssertFunction inner_;
-  DISALLOW_EVIL_CONSTRUCTORS(ExpectAsserts);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_TESTING_UNITTEST_DEBUG_HELPER_H__
diff --git a/testing/unittest_debug_helper_unittest.cc b/testing/unittest_debug_helper_unittest.cc
deleted file mode 100644
index fae8691..0000000
--- a/testing/unittest_debug_helper_unittest.cc
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/base/debug.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha{
-
-TEST(DebugHelperTest, ExpectAssert) {
-  ExpectAsserts expect_asserts;
-  ASSERT1(false);
-}
-
-}  // namespace omaha
-
diff --git a/testing/unittest_support/GoogleUpdateHelper.msi b/testing/unittest_support/GoogleUpdateHelper.msi
deleted file mode 100644
index ca3a69f..0000000
--- a/testing/unittest_support/GoogleUpdateHelper.msi
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/GoogleUpdate_corrupted.exe b/testing/unittest_support/GoogleUpdate_corrupted.exe
deleted file mode 100644
index b9b4ccc..0000000
--- a/testing/unittest_support/GoogleUpdate_corrupted.exe
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/GoogleUpdate_now_expired_cert.exe b/testing/unittest_support/GoogleUpdate_now_expired_cert.exe
deleted file mode 100644
index 99e597f..0000000
--- a/testing/unittest_support/GoogleUpdate_now_expired_cert.exe
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/GoogleUpdate_old_signature.exe b/testing/unittest_support/GoogleUpdate_old_signature.exe
deleted file mode 100644
index 3191884..0000000
--- a/testing/unittest_support/GoogleUpdate_old_signature.exe
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/LongRunning.exe b/testing/unittest_support/LongRunning.exe
deleted file mode 100644
index e7252e0..0000000
--- a/testing/unittest_support/LongRunning.exe
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/LongRunningSilent.exe b/testing/unittest_support/LongRunningSilent.exe
deleted file mode 100644
index 122f358..0000000
--- a/testing/unittest_support/LongRunningSilent.exe
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/LongRunningSilent_exe.pdb b/testing/unittest_support/LongRunningSilent_exe.pdb
deleted file mode 100644
index 13305c2..0000000
--- a/testing/unittest_support/LongRunningSilent_exe.pdb
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/LongRunning_exe.pdb b/testing/unittest_support/LongRunning_exe.pdb
deleted file mode 100644
index 76a27a5..0000000
--- a/testing/unittest_support/LongRunning_exe.pdb
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/Omaha_1.2.x_resources/goopdateres_ar.dll b/testing/unittest_support/Omaha_1.2.x_resources/goopdateres_ar.dll
deleted file mode 100644
index 46bf255..0000000
--- a/testing/unittest_support/Omaha_1.2.x_resources/goopdateres_ar.dll
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/Omaha_1.2.x_resources/goopdateres_bg.dll b/testing/unittest_support/Omaha_1.2.x_resources/goopdateres_bg.dll
deleted file mode 100644
index e4168cd..0000000
--- a/testing/unittest_support/Omaha_1.2.x_resources/goopdateres_bg.dll
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/Omaha_1.2.x_resources/goopdateres_ca.dll b/testing/unittest_support/Omaha_1.2.x_resources/goopdateres_ca.dll
deleted file mode 100644
index c8fe946..0000000
--- a/testing/unittest_support/Omaha_1.2.x_resources/goopdateres_ca.dll
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/Readme.txt b/testing/unittest_support/Readme.txt
deleted file mode 100644
index 26ab8de..0000000
--- a/testing/unittest_support/Readme.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-This directory contains binaries, etc. needed for the unit tests.
-
-In particular, the "test" project is not currently built by default, so the test .msi files aren't necessarily available for unit tests.
-setup_foo_v1.0.101.0.msi is built from ..\..\test\test_foo.wxs.xml.
-
-SaveArguments.exe must be updated periodically to keep its signature from being more than N days old where N is defined in google_update_recovery.cc.
-
-* omaha_1.0.x contains files from the last official release of Omaha 1.0.x.
-  - One use is testing the legacy quiet mode (shutdown) event.
-* omaha_1.1.x contains files from the last version of Omaha 1.1.x.
-  - One use is testing the quiet mode (shutdown) event.
-* omaha_1.2.x contains an older version of Omaha 1.2.x.
-  - One use is testing the shutdown event works with older versions.
-* omaha_1.3.x contains an older version of Omaha 1.3.x.
-  - One use is testing the shutdown event works with older versions.
-* omaha_1.3.x_newer contains a version that is newer than any expected build.
-  - GoogleUpdate.exe was generated by hardcoding the four version values in generated_resources_en.rc and building.
-  
\ No newline at end of file
diff --git a/testing/unittest_support/SaveArguments.exe b/testing/unittest_support/SaveArguments.exe
deleted file mode 100644
index 91789a4..0000000
--- a/testing/unittest_support/SaveArguments.exe
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/SaveArguments_OmahaTestSigned.exe b/testing/unittest_support/SaveArguments_OmahaTestSigned.exe
deleted file mode 100644
index 88363c5..0000000
--- a/testing/unittest_support/SaveArguments_OmahaTestSigned.exe
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/SaveArguments_different_ou.exe b/testing/unittest_support/SaveArguments_different_ou.exe
deleted file mode 100644
index f53b2b8..0000000
--- a/testing/unittest_support/SaveArguments_different_ou.exe
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/SaveArguments_multiple_cn.exe b/testing/unittest_support/SaveArguments_multiple_cn.exe
deleted file mode 100644
index 566abbc..0000000
--- a/testing/unittest_support/SaveArguments_multiple_cn.exe
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/SaveArguments_no_cn.exe b/testing/unittest_support/SaveArguments_no_cn.exe
deleted file mode 100644
index e38d051..0000000
--- a/testing/unittest_support/SaveArguments_no_cn.exe
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/SaveArguments_unsigned_no_resources.exe b/testing/unittest_support/SaveArguments_unsigned_no_resources.exe
deleted file mode 100644
index dd81c63..0000000
--- a/testing/unittest_support/SaveArguments_unsigned_no_resources.exe
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/SaveArguments_unsigned_wrong_markup_size.exe b/testing/unittest_support/SaveArguments_unsigned_wrong_markup_size.exe
deleted file mode 100644
index 1c489c3..0000000
--- a/testing/unittest_support/SaveArguments_unsigned_wrong_markup_size.exe
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/SaveArguments_unsigned_wrong_markup_value.exe b/testing/unittest_support/SaveArguments_unsigned_wrong_markup_value.exe
deleted file mode 100644
index d4cfb69..0000000
--- a/testing/unittest_support/SaveArguments_unsigned_wrong_markup_value.exe
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/SaveArguments_unsigned_wrong_resource_name.exe b/testing/unittest_support/SaveArguments_unsigned_wrong_resource_name.exe
deleted file mode 100644
index 5ea6408..0000000
--- a/testing/unittest_support/SaveArguments_unsigned_wrong_resource_name.exe
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/SaveArguments_wrong_cn.exe b/testing/unittest_support/SaveArguments_wrong_cn.exe
deleted file mode 100644
index 1e39c48..0000000
--- a/testing/unittest_support/SaveArguments_wrong_cn.exe
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/certificate-with-private-key.pfx b/testing/unittest_support/certificate-with-private-key.pfx
deleted file mode 100644
index 7eaa2da..0000000
--- a/testing/unittest_support/certificate-with-private-key.pfx
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/certificate-without-private-key.cer b/testing/unittest_support/certificate-without-private-key.cer
deleted file mode 100644
index b456dfc..0000000
--- a/testing/unittest_support/certificate-without-private-key.cer
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/declaration.txt b/testing/unittest_support/declaration.txt
deleted file mode 100644
index 5a5ff02..0000000
--- a/testing/unittest_support/declaration.txt
+++ /dev/null
@@ -1,109 +0,0 @@
-The Declaration of Independence of the Thirteen Colonies
-In CONGRESS, July 4, 1776 
-
-The unanimous Declaration of the thirteen united States of America, 
-
-When in the Course of human events, it becomes necessary for one people to dissolve the political bands which have connected them with another, and to assume among the powers of the earth, the separate and equal station to which the Laws of Nature and of Nature's God entitle them, a decent respect to the opinions of mankind requires that they should declare the causes which impel them to the separation. 
-
-We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable Rights, that among these are Life, Liberty and the pursuit of Happiness. --That to secure these rights, Governments are instituted among Men, deriving their just powers from the consent of the governed, --That whenever any Form of Government becomes destructive of these ends, it is the Right of the People to alter or to abolish it, and to institute new Government, laying its foundation on such principles and organizing its powers in such form, as to them shall seem most likely to effect their Safety and Happiness. Prudence, indeed, will dictate that Governments long established should not be changed for light and transient causes; and accordingly all experience hath shewn, that mankind are more disposed to suffer, while evils are sufferable, than to right themselves by abolishing the forms to which they are accustomed. But when a long train of abuses and usurpations, pursuing invariably the same Object evinces a design to reduce them under absolute Despotism, it is their right, it is their duty, to throw off such Government, and to provide new Guards for their future security. —Such has been the patient sufferance of these Colonies; and such is now the necessity which constrains them to alter their former Systems of Government. The history of the present King of Great Britain [George III] is a history of repeated injuries and usurpations, all having in direct object the establishment of an absolute Tyranny over these States. To prove this, let Facts be submitted to a candid world. 
-
-He has refused his Assent to Laws, the most wholesome and necessary for the public good. 
-
-He has forbidden his Governors to pass Laws of immediate and pressing importance, unless suspended in their operation till his Assent should be obtained; and when so suspended, he has utterly neglected to attend to them. 
-
-He has refused to pass other Laws for the accommodation of large districts of people, unless those people would relinquish the right of Representation in the Legislature, a right inestimable to them and formidable to tyrants only. 
-
-He has called together legislative bodies at places unusual, uncomfortable, and distant from the depository of their public Records, for the sole purpose of fatiguing them into compliance with his measures. 
-
-He has dissolved Representative Houses repeatedly, for opposing with manly firmness his invasions on the rights of the people. 
-
-He has refused for a long time, after such dissolutions, to cause others to be elected; whereby the Legislative powers, incapable of Annihilation, have returned to the People at large for their exercise; the State remaining in the mean time exposed to all the dangers of invasion from without, and convulsions within. 
-
-He has endeavoured to prevent the population of these States; for that purpose obstructing the Laws for Naturalization of Foreigners; refusing to pass others to encourage their migrations hither, and raising the conditions of new Appropriations of Lands. 
-
-He has obstructed the Administration of Justice, by refusing his Assent to Laws for establishing Judiciary powers. 
-
-He has made Judges dependent on his Will alone, for the tenure of their offices, and the amount and payment of their salaries. 
-
-He has erected a multitude of New Offices, and sent hither swarms of Officers to harass our people, and eat out their substance. 
-
-He has kept among us, in times of peace, Standing Armies without the consent of our legislatures. 
-
-He has affected to render the Military independent of and superior to the Civil power. 
-
-He has combined with others to subject us to a jurisdiction foreign to our constitution and unacknowledged by our laws; giving his Assent to their Acts of pretended Legislation: 
-
-For Quartering large bodies of armed troops among us: 
-
-For protecting them, by a mock Trial, from punishment for any Murders which they should commit on the Inhabitants of these States: 
-
-For cutting off our Trade with all parts of the world: 
-
-For imposing Taxes on us without our Consent: 
-
-For depriving us, in many cases, of the benefits of Trial by Jury: 
-
-For transporting us beyond Seas to be tried for pretended offences: 
-
-For abolishing the free System of English Laws in a neighbouring Province, establishing therein an Arbitrary government, and enlarging its Boundaries so as to render it at once an example and fit instrument for introducing the same absolute rule into these Colonies: 
-
-For taking away our Charters, abolishing our most valuable Laws, and altering fundamentally the Forms of our Governments: 
-
-For suspending our own Legislatures, and declaring themselves invested with power to legislate for us in all cases whatsoever. 
-
-He has abdicated Government here, by declaring us out of his Protection and waging War against us. 
-
-He has plundered our seas, ravaged our Coasts, burnt our towns, and destroyed the lives of our people. 
-
-He is at this time transporting large Armies of foreign Mercenaries to compleat the works of death, desolation and tyranny, already begun with circumstances of Cruelty and perfidy scarcely paralleled in the most barbarous ages, and totally unworthy the Head of a civilized nation. 
-
-He has constrained our fellow Citizens taken Captive on the high Seas to bear Arms against their Country, to become the executioners of their friends and Brethren, or to fall themselves by their Hands. 
-
-He has excited domestic insurrections amongst us, and has endeavoured to bring on the inhabitants of our frontiers, the merciless Indian Savages, whose known rule of warfare, is an undistinguished destruction of all ages, sexes and conditions. 
-
-In every stage of these Oppressions We have Petitioned for Redress in the most humble terms: Our repeated Petitions have been answered only by repeated injury. A Prince whose character is thus marked by every act which may define a Tyrant, is unfit to be the ruler of a free people. 
-
-Nor have We been wanting in attentions to our British brethren. We have warned them from time to time of attempts by their legislature to extend an unwarrantable jurisdiction over us. We have reminded them of the circumstances of our emigration and settlement here. We have appealed to their native justice and magnanimity, and we have conjured them by the ties of our common kindred to disavow these usurpations, which, would inevitably interrupt our connections and correspondence. They too have been deaf to the voice of justice and of consanguinity. We must, therefore, acquiesce in the necessity, which denounces our Separation, and hold them, as we hold the rest of mankind, Enemies in War, in Peace Friends. 
-
-We, therefore, the Representatives of the united States of America, in General Congress, Assembled, appealing to the Supreme Judge of the world for the rectitude of our intentions, do, in the Name, and by the Authority of the good People of these Colonies, solemnly publish and declare, That these United Colonies are, and of Right ought to be Free and Independent States; that they are Absolved from all Allegiance to the British Crown, and that all political connection between them and the State of Great Britain, is and ought to be totally dissolved; and that as Free and Independent States, they have full Power to levy War, conclude Peace, contract Alliances, establish Commerce, and to do all other Acts and Things which Independent States may of right do. And for the support of this Declaration, with a firm reliance on the protection of divine Providence, we mutually pledge to each other our Lives, our Fortunes and our sacred Honor. 
-
-The signers of the Declaration represented the new states as follows: 
-
-New Hampshire
-Josiah Bartlett, William Whipple, Matthew Thornton 
-
-Massachusetts
-John Hancock, Samual Adams, John Adams, Robert Treat Paine, Elbridge Gerry 
-
-Rhode Island
-Stephen Hopkins, William Ellery 
-
-Connecticut
-Roger Sherman, Samuel Huntington, William Williams, Oliver Wolcott 
-
-New York
-William Floyd, Philip Livingston, Francis Lewis, Lewis Morris 
-
-New Jersey
-Richard Stockton, John Witherspoon, Francis Hopkinson, John Hart, Abraham Clark 
-
-Pennsylvania
-Robert Morris, Benjamin Rush, Benjamin Franklin, John Morton, George Clymer, James Smith, George Taylor, James Wilson, George Ross 
-
-Delaware
-Caesar Rodney, George Read, Thomas McKean 
-
-Maryland
-Samuel Chase, William Paca, Thomas Stone, Charles Carroll of Carrollton 
-
-Virginia
-George Wythe, Richard Henry Lee, Thomas Jefferson, Benjamin Harrison, Thomas Nelson, Jr., Francis Lightfoot Lee, Carter Braxton 
-
-North Carolina
-William Hooper, Joseph Hewes, John Penn 
-
-South Carolina
-Edward Rutledge, Thomas Heyward, Jr., Thomas Lynch, Jr., Arthur Middleton 
-
-Georgia
-Button Gwinnett, Lyman Hall, George Walton 
diff --git "a/testing/unittest_support/download_cache_test/\1737101D597-3481-4971-AD23-455542964072\175/livelysetup.exe" "b/testing/unittest_support/download_cache_test/\1737101D597-3481-4971-AD23-455542964072\175/livelysetup.exe"
deleted file mode 100644
index 6cb8607..0000000
--- "a/testing/unittest_support/download_cache_test/\1737101D597-3481-4971-AD23-455542964072\175/livelysetup.exe"
+++ /dev/null
Binary files differ
diff --git "a/testing/unittest_support/download_cache_test/\17389640431-FE64-4da8-9860-1A1085A60E13\175/gears-win32-opt.msi" "b/testing/unittest_support/download_cache_test/\17389640431-FE64-4da8-9860-1A1085A60E13\175/gears-win32-opt.msi"
deleted file mode 100644
index c09ca8d..0000000
--- "a/testing/unittest_support/download_cache_test/\17389640431-FE64-4da8-9860-1A1085A60E13\175/gears-win32-opt.msi"
+++ /dev/null
Binary files differ
diff --git "a/testing/unittest_support/download_cache_test/\173C5CC8735-9BE0-45c5-804C-F117E96047C7\175/GoogleUpdateSetup.exe" "b/testing/unittest_support/download_cache_test/\173C5CC8735-9BE0-45c5-804C-F117E96047C7\175/GoogleUpdateSetup.exe"
deleted file mode 100644
index 3975fa3..0000000
--- "a/testing/unittest_support/download_cache_test/\173C5CC8735-9BE0-45c5-804C-F117E96047C7\175/GoogleUpdateSetup.exe"
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/localproxytest.pac b/testing/unittest_support/localproxytest.pac
deleted file mode 100644
index 057c85c..0000000
--- a/testing/unittest_support/localproxytest.pac
+++ /dev/null
@@ -1,7 +0,0 @@
-function FindProxyForURL(url, host) {
-  if (shExpMatch(host, "*.omahaproxytest.com")) {
-    return "PROXY omaha_unittest1; SOCKS should_not_appear:12345; PROXY omaha_unittest2:8080; DIRECT; PROXY should_not_be_included";
-  }
-  return "DIRECT";
-}
-
diff --git a/testing/unittest_support/manifest.xml b/testing/unittest_support/manifest.xml
deleted file mode 100644
index 46f9e47..0000000
--- a/testing/unittest_support/manifest.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--Sample XML file generated by XMLSPY v2004 rel. 3 U (http://www.xmlspy.com)-->
-<Manifest ci:ver="1.0" ci:timestamp="aaaa" xmlns="http://www.google.com/ci/manifest" xmlns:ci="http://www.google.com/ci/manifest">
-  <App id="001" sig="abcd">
-    <Lang>EN-US</Lang>
-    <DisplayName>Google Toolbar</DisplayName>
-    <CreationDate>October 27, 2005</CreationDate>
-    <Ver>2.0</Ver>
-    <Description>Take the power of Google with you anywhere on the web.</Description>
-    <Logo>http://www.google.com/toolbar-logo.gif</Logo>
-    <MoreInfoUrl>http://toolbar.google.com</MoreInfoUrl>
-    <CodeBase>http://gpdl.google.com/GoogleEarth.exe</CodeBase>
-    <CodeBase file="setup.iss">http://gpdl.google.com/GoogleEarthSetup.iss</CodeBase>
-    <Size>476304</Size>
-    <Hash>JustTesting</Hash>
-    <CodeBase2>http://gpdl.google.com/GoogleEarthPatch.exe</CodeBase2>
-    <Size2>21391</Size2>
-    <Hash2>JustTesting2</Hash2>
-    <MinRequiredVersion>1.0</MinRequiredVersion>
-    <MinRecommendedVersion>1.0</MinRecommendedVersion>
-    <Versions>
-      <Version>
-        <ProductCode>HKLM\Software\Adobe\Acrobat Reader\7.0\Installer\ENU_GUID</ProductCode>
-        <AppPath>HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AcroRd32.exe\</AppPath>
-      </Version>
-      <Version>
-        <ProductCode>HKLM\Software\Adobe\Acrobat Reader\6.0\Installer\ENU_GUID</ProductCode>
-        <AppPath>HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AcroRd32.exe\</AppPath>
-      </Version>
-      <Version>
-        <ProductCode>Adobe Acrobat 5.0</ProductCode>
-        <AppPath>HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AcroRd32.exe\</AppPath>
-      </Version>
-      <Version>
-        <ProductCode>Adobe Acrobat 4.0</ProductCode>
-        <AppPath>HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AcroRd32.exe\</AppPath>
-      </Version>
-    </Versions>
-    <UsageStatsSwitch on="/u" off="/-u" />
-    <GoogleApp>1</GoogleApp>
-    <AltCommandLineParameters>-bundle=GCDR /nods /notb -silent /noshortcut</AltCommandLineParameters>
-    <AltVisualCommandLineParameters>-bundle=GCDR /nods /notb</AltVisualCommandLineParameters>
-    <WhatsNewUrl>http://earth.google.com/earth4.html</WhatsNewUrl>
-    <MinAutoupdateVersion>4.0.0.0</MinAutoupdateVersion>
-    <FlowMappings>
-      <Flow name="RegularPack">-bundle=GPCK /noshortcut</Flow>
-      <Flow name="EarthInt" replace="1">-bundle=GCDR</Flow>
-      <Flow name="OEM" replace="false">-o -r:%OEMBRAND%</Flow>
-    </FlowMappings>
-  </App>
-  <App id="002" sig="1234">
-    <Lang>En-US</Lang>
-    <DisplayName>Google Desktop Search</DisplayName>
-    <Ver>1.0</Ver>
-    <CreationDate>October 27, 2005</CreationDate>
-    <Description>Search your own computer.</Description>
-    <Logo>http://www.google.com/desktop-logo.gif</Logo>
-    <MoreInfoUrl>http://desktop.google.com</MoreInfoUrl>
-    <CodeBase>http://dl.google.com/desktop/GoogleDesktopSearchSetup.exe</CodeBase>
-    <Size>740456</Size>
-    <Hash>JustTesting</Hash>
-    <GoogleApp>false</GoogleApp> 
-  </App>
-</Manifest>
diff --git a/testing/unittest_support/minidump.dmp b/testing/unittest_support/minidump.dmp
deleted file mode 100644
index b7860c2..0000000
--- a/testing/unittest_support/minidump.dmp
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/minidump.txt b/testing/unittest_support/minidump.txt
deleted file mode 100644
index 069d681..0000000
--- a/testing/unittest_support/minidump.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-; This is a custom info file to report out of process crashes.
-[ClientCustomData]
-prod=Update2
-ver=9.8.7.6
diff --git a/testing/unittest_support/omaha_1.0.x/GoogleUpdate.exe b/testing/unittest_support/omaha_1.0.x/GoogleUpdate.exe
deleted file mode 100644
index a650b8a..0000000
--- a/testing/unittest_support/omaha_1.0.x/GoogleUpdate.exe
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/omaha_1.0.x/goopdate.dll b/testing/unittest_support/omaha_1.0.x/goopdate.dll
deleted file mode 100644
index 24a4b91..0000000
--- a/testing/unittest_support/omaha_1.0.x/goopdate.dll
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/omaha_1.1.x/GoogleUpdate.exe b/testing/unittest_support/omaha_1.1.x/GoogleUpdate.exe
deleted file mode 100644
index ec666c2..0000000
--- a/testing/unittest_support/omaha_1.1.x/GoogleUpdate.exe
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/omaha_1.1.x/goopdate.dll b/testing/unittest_support/omaha_1.1.x/goopdate.dll
deleted file mode 100644
index bed6232..0000000
--- a/testing/unittest_support/omaha_1.1.x/goopdate.dll
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/omaha_1.1.x/goopdateres_en.dll b/testing/unittest_support/omaha_1.1.x/goopdateres_en.dll
deleted file mode 100644
index 45cbb7c..0000000
--- a/testing/unittest_support/omaha_1.1.x/goopdateres_en.dll
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/omaha_1.2.131.7_shell/GoogleUpdate.exe b/testing/unittest_support/omaha_1.2.131.7_shell/GoogleUpdate.exe
deleted file mode 100644
index 3edfbc9..0000000
--- a/testing/unittest_support/omaha_1.2.131.7_shell/GoogleUpdate.exe
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/omaha_1.2.183.9_shell/GoogleUpdate.exe b/testing/unittest_support/omaha_1.2.183.9_shell/GoogleUpdate.exe
deleted file mode 100644
index 9997fbe..0000000
--- a/testing/unittest_support/omaha_1.2.183.9_shell/GoogleUpdate.exe
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/omaha_1.2.x/GoogleUpdate.exe b/testing/unittest_support/omaha_1.2.x/GoogleUpdate.exe
deleted file mode 100644
index 2ab4b36..0000000
--- a/testing/unittest_support/omaha_1.2.x/GoogleUpdate.exe
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/omaha_1.2.x/goopdate.dll b/testing/unittest_support/omaha_1.2.x/goopdate.dll
deleted file mode 100644
index 0c18394..0000000
--- a/testing/unittest_support/omaha_1.2.x/goopdate.dll
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/omaha_1.2.x/goopdateres_en.dll b/testing/unittest_support/omaha_1.2.x/goopdateres_en.dll
deleted file mode 100644
index 9f83143..0000000
--- a/testing/unittest_support/omaha_1.2.x/goopdateres_en.dll
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/omaha_1.2.x_newer/GoogleUpdate.exe b/testing/unittest_support/omaha_1.2.x_newer/GoogleUpdate.exe
deleted file mode 100644
index 3a1fd60..0000000
--- a/testing/unittest_support/omaha_1.2.x_newer/GoogleUpdate.exe
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/omaha_1.3.x/GoogleUpdate.exe b/testing/unittest_support/omaha_1.3.x/GoogleUpdate.exe
deleted file mode 100644
index 1105e67..0000000
--- a/testing/unittest_support/omaha_1.3.x/GoogleUpdate.exe
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/omaha_1.3.x/goopdate.dll b/testing/unittest_support/omaha_1.3.x/goopdate.dll
deleted file mode 100644
index 1950a81..0000000
--- a/testing/unittest_support/omaha_1.3.x/goopdate.dll
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/omaha_1.3.x/goopdateres_en.dll b/testing/unittest_support/omaha_1.3.x/goopdateres_en.dll
deleted file mode 100644
index f36ddad..0000000
--- a/testing/unittest_support/omaha_1.3.x/goopdateres_en.dll
+++ /dev/null
Binary files differ
diff --git a/testing/unittest_support/test_foo_v1.0.101.0.msi b/testing/unittest_support/test_foo_v1.0.101.0.msi
deleted file mode 100644
index 3f78c24..0000000
--- a/testing/unittest_support/test_foo_v1.0.101.0.msi
+++ /dev/null
Binary files differ
diff --git "a/testing/unittest_support/\173CDABE316-39CD-43BA-8440-6D1E0547AEE6\175.v2.gup" "b/testing/unittest_support/\173CDABE316-39CD-43BA-8440-6D1E0547AEE6\175.v2.gup"
deleted file mode 100644
index b87c348..0000000
--- "a/testing/unittest_support/\173CDABE316-39CD-43BA-8440-6D1E0547AEE6\175.v2.gup"
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gupdate xmlns="http://www.google.com/update2/response" protocol="2.0">
-  <app appid="{CDABE316-39CD-43BA-8440-6D1E0547AEE6}" status="ok">
-    <updatecheck Version="1.2.3.4"
-                 arguments="-baz"
-                 codebase="http://dl.google.com/foo/install/1.2.3.4/foo_installer.exe"
-                 hash="abcdef" needsadmin="false"
-                 onsuccess="exitsilentlyonlaunchcmd" size="12345678"
-                 status="ok"/>
-    <!-- "system_level" is not included in any of the definitions. needsadmin
-          controls this. -->
-    <data index="verboselogging" name="install" status="ok">
-      {
-        "distribution": {
-          "verbose_logging": true
-        }
-      }
-    </data>
-    <data index="foobarapp" name="install" status="ok">
-      {
-        "distribution": {
-          "skip_first_run_ui": true,
-          "show_welcome_page": true,
-          "import_search_engine": true,
-          "import_history": false,
-          "create_all_shortcuts": true,
-          "do_not_launch_foo": true,
-          "make_foo_default": false,
-          "verbose_logging": false
-        }
-      }
-    </data>
-  </app>
-</gupdate>
diff --git "a/testing/unittest_support/\173CDABE316-39CD-43BA-8440-6D1E0547AEE6\175.v3.gup" "b/testing/unittest_support/\173CDABE316-39CD-43BA-8440-6D1E0547AEE6\175.v3.gup"
deleted file mode 100644
index 2aaaa46..0000000
--- "a/testing/unittest_support/\173CDABE316-39CD-43BA-8440-6D1E0547AEE6\175.v3.gup"
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<response protocol="3.0">
-  <app appid="{CDABE316-39CD-43BA-8440-6D1E0547AEE6}" status="ok">
-    <updatecheck status="ok">
-      <urls>
-        <url codebase="http://dl.google.com/foo/install/1.2.3.4/"/>
-      </urls>
-      <manifest version="1.2.3.4">
-        <packages>
-          <package hash="abcdef" name="foo_installer.exe" required="true" size="12345678"/>
-        </packages>
-        <actions>
-          <action event="install" needsadmin="false" run="foo_installer.exe" arguments="-baz"/>
-          <action event="postinstall" onsuccess="exitsilentlyonlaunchcmd"/>
-        </actions>
-      </manifest>
-    </updatecheck>
-    <!-- "system_level" is not included in any of the definitions. needsadmin
-          controls this. -->
-    <data index="verboselogging" name="install" status="ok">
-      {
-        "distribution": {
-          "verbose_logging": true
-        }
-      }
-    </data>
-    <data index="foobarapp" name="install" status="ok">
-      {
-        "distribution": {
-          "skip_first_run_ui": true,
-          "show_welcome_page": true,
-          "import_search_engine": true,
-          "import_history": false,
-          "create_all_shortcuts": true,
-          "do_not_launch_foo": true,
-          "make_foo_default": false,
-          "verbose_logging": false
-        }
-      }
-    </data>
-  </app>
-</response>
diff --git a/third_party/bar/shared_ptr.h b/third_party/bar/shared_ptr.h
deleted file mode 100644
index 5f70388..0000000
--- a/third_party/bar/shared_ptr.h
+++ /dev/null
@@ -1,438 +0,0 @@
-// Copyright 2006 and onwards Google Inc.
-// Author: Michael Ellman (with suggestions from jrvb, m3b, toddw, jwray)
-//
-// A simple reference counted pointer implementation. It is a subset
-// of the boost/tr1 shared_ptr class, which is expected to be part of
-// the next C++ standard.  See section 20.8.10 [util.smartptr] of the
-// draft standard for a full description of the standard interface.
-//
-// Standard features that have been omitted from this implementation include:
-//   - no custom deallocators - uses delete
-//   - shared_ptr<T>'s constructor isn't templated: its argument is just T*.
-//   - no support for smart pointer casts
-//   - no support for unowned pointers
-//   - no support for variadic templates or rvalue references
-//   - no integration with auto_ptr or unique_ptr
-//   - not exception-safe
-//   - no overloaded comparison operators (e.g. operator<). They're
-//     convenient, but they can be explicitly defined outside the class.
-//
-// It's usually the case that when you want to share an object, there
-// is a clear owner that outlives the other users.  If that's the case,
-// the owner can use scoped_ptr and the rest can use a raw pointer.
-//
-// A somewhat common design pattern that doesn't have a clear object
-// owner is when there is a shared container in which older versions
-// of an object are replaced with newer versions.  The objects should be
-// deleted only when (a) they are replaced with a new version and (b)
-// there are no outside users of the old version.  Replacing raw pointers
-// in the implementation with shared_ptr's ensures that the accounting
-// and object lifetimes are handled appropriately.
-//
-// The typical usage is as follows.
-//
-//  1. Functions using shared_ptr's should declare shared_ptr parameters to
-//     be of type const reference since the caller will still have its own
-//     shared_ptr for the entire call.
-//
-//       void foo(const shared_ptr<T>& param)
-//
-//  2. Functions setting shared_ptr's should declare shared_ptr parameters
-//     to be of pointer type.
-//
-//     typedef map<Key, shared_ptr<Value> > MyMap;
-//     void GetAndSharedObject(const Key& key, shared_ptr<Value>* value) {
-//       ReaderMutexLock l(&lock_);
-//       MyMap::iterator iter = shared_container.find(key);
-//       *value = iter->second;
-//     }
-//
-// Thread Safety:
-//   Once constructed, a shared_ptr has the same thread-safety as built-in
-//   types.  In particular, it is safe to read a shared object simultaneously
-//   from multiple threads.
-//
-// Weak ptrs
-//   The weak_ptr auxiliary class (see clause 20.8.10.3 of the draft standard)
-//   is used to break ownership cycles. A weak_ptr points to an object that's
-//   owned by a shared_ptr, but the weak_ptr is an observer, not an owner. When
-//   the last shared_ptr that points to the object disappears, the weak_ptr
-//   expires, at which point the expired() member function will return true.
-//
-//   You can't directly get a raw pointer from weak_ptr, i.e. it has no get()
-//   or operator*() member function. (These features were intentionally left out
-//   to avoid the risk of dangling pointers.) To access a weak_ptr's pointed-to
-//   object, use lock() to obtain a temporary shared_ptr.
-//
-// enable_shared_from_this
-//   A user-defined class T can inherit from enable_shared_from_this<T> (see
-//   clause 20.8.10.5 of the draft standard) to inherit T::shared_from_this(),
-//   which returns a shared_ptr pointing to *this. It is similar to weak_ptr in
-//   that there must already be at least one shared_ptr instance that owns
-//   *this.
-
-#ifndef BAR_COMMON_SHARED_PTR_H_
-#define BAR_COMMON_SHARED_PTR_H_
-
-#include <windows.h>
-#include <algorithm>  // for swap
-
-template <typename T> class shared_ptr;
-template <typename T> class weak_ptr;
-
-// This class is an internal implementation detail for shared_ptr. If two
-// shared_ptrs point to the same object, they also share a control block.
-// An "empty" shared_pointer refers to NULL and also has a NULL control block.
-// It contains all of the state that's needed for reference counting or any
-// other kind of resource management. In this implementation the control block
-// happens to consist of two atomic words, the reference count (the number
-// of shared_ptrs that share ownership of the object) and the weak count
-// (the number of weak_ptrs that observe the object, plus 1 if the
-// refcount is nonzero).
-//
-// The "plus 1" is to prevent a race condition in the shared_ptr and
-// weak_ptr destructors. We need to make sure the control block is
-// only deleted once, so we need to make sure that at most one
-// object sees the weak count decremented from 1 to 0.
-class SharedPtrControlBlock {
-  template <typename T> friend class shared_ptr;
-  template <typename T> friend class weak_ptr;
- private:
-  SharedPtrControlBlock() : refcount_(1), weak_count_(1) { }
-  LONG refcount_;
-  LONG weak_count_;
-};
-
-// Forward declaration. The class is defined below.
-template <typename T> class enable_shared_from_this;
-
-template <typename T>
-class shared_ptr {
-  template <typename U> friend class weak_ptr;
- public:
-  typedef T element_type;
-
-  explicit shared_ptr(T* ptr = NULL)
-      : ptr_(ptr),
-        control_block_(ptr != NULL ? new SharedPtrControlBlock : NULL) {
-    // If p is non-null and T inherits from enable_shared_from_this, we
-    // set up the data that shared_from_this needs.
-    MaybeSetupWeakThis(ptr);
-  }
-
-  // Copy constructor: makes this object a copy of ptr, and increments
-  // the reference count.
-  template <typename U>
-  shared_ptr(const shared_ptr<U>& ptr)
-      : ptr_(NULL),
-        control_block_(NULL) {
-    Initialize(ptr);
-  }
-  // Need non-templated version to prevent the compiler-generated default
-  shared_ptr(const shared_ptr<T>& ptr)
-      : ptr_(NULL),
-        control_block_(NULL) {
-    Initialize(ptr);
-  }
-
-  // Assignment operator. Replaces the existing shared_ptr with ptr.
-  // Increment ptr's reference count and decrement the one being replaced.
-  template <typename U>
-  shared_ptr<T>& operator=(const shared_ptr<U>& ptr) {
-    if (ptr_ != ptr.ptr_) {
-      shared_ptr<T> me(ptr);   // will hold our previous state to be destroyed.
-      swap(me);
-    }
-    return *this;
-  }
-
-  // Need non-templated version to prevent the compiler-generated default
-  shared_ptr<T>& operator=(const shared_ptr<T>& ptr) {
-    if (ptr_ != ptr.ptr_) {
-      shared_ptr<T> me(ptr);   // will hold our previous state to be destroyed.
-      swap(me);
-    }
-    return *this;
-  }
-
-  // TODO(austern): Consider providing this constructor. The draft C++ standard
-  // (20.8.10.2.1) includes it. However, it says that this constructor throws
-  // a bad_weak_ptr exception when ptr is expired. Is it better to provide this
-  // constructor and make it do something else, like fail with a CHECK, or to
-  // leave this constructor out entirely?
-  //
-  // template <typename U>
-  // shared_ptr(const weak_ptr<U>& ptr);
-
-  ~shared_ptr() {
-    if (ptr_ != NULL) {
-      if (::InterlockedDecrement(&control_block_->refcount_) == 0) {
-        delete ptr_;
-
-        // weak_count_ is defined as the number of weak_ptrs that observe
-        // ptr_, plus 1 if refcount_ is nonzero.
-        if (::InterlockedDecrement(&control_block_->weak_count_) == 0) {
-          delete control_block_;
-        }
-      }
-    }
-  }
-
-  // Replaces underlying raw pointer with the one passed in.  The reference
-  // count is set to one (or zero if the pointer is NULL) for the pointer
-  // being passed in and decremented for the one being replaced.
-  void reset(T* p = NULL) {
-    if (p != ptr_) {
-      shared_ptr<T> tmp(p);
-      tmp.swap(*this);
-    }
-  }
-
-  // Exchanges the contents of this with the contents of r.  This function
-  // supports more efficient swapping since it eliminates the need for a
-  // temporary shared_ptr object.
-  void swap(shared_ptr<T>& r) {
-    std::swap(ptr_, r.ptr_);
-    std::swap(control_block_, r.control_block_);
-  }
-
-  // The following function is useful for gaining access to the underlying
-  // pointer when a shared_ptr remains in scope so the reference-count is
-  // known to be > 0 (e.g. for parameter passing).
-  T* get() const {
-    return ptr_;
-  }
-
-  T& operator*() const {
-    return *ptr_;
-  }
-
-  T* operator->() const {
-    return ptr_;
-  }
-
-  LONG use_count() const {
-    return control_block_ ? control_block_->refcount_ : 1;
-  }
-
-  bool unique() const {
-    return use_count() == 1;
-  }
-
- private:
-  // If r is non-empty, initialize *this to share ownership with r,
-  // increasing the underlying reference count.
-  // If r is empty, *this remains empty.
-  // Requires: this is empty, namely this->ptr_ == NULL.
-  template <typename U>
-  void Initialize(const shared_ptr<U>& r) {
-    if (r.control_block_ != NULL) {
-      ::InterlockedIncrement(&r.control_block_->refcount_);
-
-      ptr_ = r.ptr_;
-      control_block_ = r.control_block_;
-    }
-  }
-
-  // Helper function for the constructor that takes a raw pointer. If T
-  // doesn't inherit from enable_shared_from_this<T> then we have nothing to
-  // do, so this function is trivial and inline. The other version is declared
-  // out of line, after the class definition of enable_shared_from_this.
-  void MaybeSetupWeakThis(enable_shared_from_this<T>* ptr);
-  void MaybeSetupWeakThis(...) { }
-
-  T* ptr_;
-  SharedPtrControlBlock* control_block_;
-
-  template <typename U>
-  friend class shared_ptr;
-};
-
-// Matches the interface of std::swap as an aid to generic programming.
-template <typename T> void swap(shared_ptr<T>& r, shared_ptr<T>& s) {
-  r.swap(s);
-}
-
-// See comments at the top of the file for a description of why this
-// class exists, and the draft C++ standard (as of July 2009 the
-// latest draft is N2914) for the detailed specification.
-template <typename T>
-class weak_ptr {
-  template <typename U> friend class weak_ptr;
- public:
-  typedef T element_type;
-
-  // Create an empty (i.e. already expired) weak_ptr.
-  weak_ptr() : ptr_(NULL), control_block_(NULL) { }
-
-  // Create a weak_ptr that observes the same object that ptr points
-  // to.  Note that there is no race condition here: we know that the
-  // control block can't disappear while we're looking at it because
-  // it is owned by at least one shared_ptr, ptr.
-  template <typename U> weak_ptr(const shared_ptr<U>& ptr) {
-    CopyFrom(ptr.ptr_, ptr.control_block_);
-  }
-
-  // Copy a weak_ptr. The object it points to might disappear, but we
-  // don't care: we're only working with the control block, and it can't
-  // disappear while we're looking at because it's owned by at least one
-  // weak_ptr, ptr.
-  template <typename U> weak_ptr(const weak_ptr<U>& ptr) {
-    CopyFrom(ptr.ptr_, ptr.control_block_);
-  }
-
-  // Need non-templated version to prevent default copy constructor
-  weak_ptr(const weak_ptr& ptr) {
-    CopyFrom(ptr.ptr_, ptr.control_block_);
-  }
-
-  // Destroy the weak_ptr. If no shared_ptr owns the control block, and if
-  // we are the last weak_ptr to own it, then it can be deleted. Note that
-  // weak_count_ is defined as the number of weak_ptrs sharing this control
-  // block, plus 1 if there are any shared_ptrs. We therefore know that it's
-  // safe to delete the control block when weak_count_ reaches 0, without
-  // having to perform any additional tests.
-  ~weak_ptr() {
-    if (control_block_ != NULL &&
-        ::InterlockedDecrement(&control_block_->weak_count_) == 0) {
-      delete control_block_;
-    }
-  }
-
-  weak_ptr& operator=(const weak_ptr& ptr) {
-    if (&ptr != this) {
-      weak_ptr tmp(ptr);
-      tmp.swap(*this);
-    }
-    return *this;
-  }
-  template <typename U> weak_ptr& operator=(const weak_ptr<U>& ptr) {
-    weak_ptr tmp(ptr);
-    tmp.swap(*this);
-    return *this;
-  }
-  template <typename U> weak_ptr& operator=(const shared_ptr<U>& ptr) {
-    weak_ptr tmp(ptr);
-    tmp.swap(*this);
-    return *this;
-  }
-
-  void swap(weak_ptr& ptr) {
-    std::swap(ptr_, ptr.ptr_);
-    std::swap(control_block_, ptr.control_block_);
-  }
-
-  void reset() {
-    weak_ptr tmp;
-    tmp.swap(*this);
-  }
-
-  // Return the number of shared_ptrs that own the object we are observing.
-  // Note that this number can be 0 (if this pointer has expired).
-  LONG use_count() const {
-    return control_block_ != NULL ? control_block_->refcount_ : 0;
-  }
-
-  bool expired() const { return use_count() == 0; }
-
-  // Return a shared_ptr that owns the object we are observing. If we
-  // have expired, the shared_ptr will be empty. We have to be careful
-  // about concurrency, though, since some other thread might be
-  // destroying the last owning shared_ptr while we're in this
-  // function.  We want to increment the refcount only if it's nonzero
-  // and get the new value, and we want that whole operation to be
-  // atomic.
-  shared_ptr<T> lock() const {
-    shared_ptr<T> result;
-    if (control_block_ != NULL) {
-      LONG old_refcount;
-      do {
-        old_refcount = control_block_->refcount_;
-        if (old_refcount == 0)
-          break;
-      } while (old_refcount !=
-               ::InterlockedCompareExchange(
-                      &control_block_->refcount_, old_refcount + 1,
-                      old_refcount));
-      if (old_refcount > 0) {
-        result.ptr_ = ptr_;
-        result.control_block_ = control_block_;
-      }
-    }
-
-    return result;
-  }
-
- private:
-  void CopyFrom(T* ptr, SharedPtrControlBlock* control_block) {
-    ptr_ = ptr;
-    control_block_ = control_block;
-    if (control_block_ != NULL)
-      ::InterlockedIncrement(&control_block_->weak_count_);
-  }
-
- private:
-  element_type* ptr_;
-  SharedPtrControlBlock* control_block_;
-};
-
-template <typename T> void swap(weak_ptr<T>& r, weak_ptr<T>& s) {
-  r.swap(s);
-}
-
-// See comments at the top of the file for a description of why this class
-// exists, and section 20.8.10.5 of the draft C++ standard (as of July 2009
-// the latest draft is N2914) for the detailed specification.
-template <typename T>
-class enable_shared_from_this {
-  friend class shared_ptr<T>;
- public:
-  // Precondition: there must be a shared_ptr that owns *this and that was
-  // created, directly or indirectly, from a raw pointer of type T*. (The
-  // latter part of the condition is technical but not quite redundant; it
-  // rules out some complicated uses involving inheritance hierarchies.)
-  shared_ptr<T> shared_from_this() {
-    // Behavior is undefined if the precondition isn't satisfied; we choose
-    // to die with an access violation exception.
-#if DEBUG
-    if (weak_this_.expired()) {
-      // No shared_ptr owns this object.
-      *static_cast<int*>(NULL) = 0;
-    }
-#endif
-    return weak_this_.lock();
-  }
-  shared_ptr<const T> shared_from_this() const {
-#if DEBUG
-    if (weak_this_.expired()) {
-      // No shared_ptr owns this object.
-      *static_cast<int*>(NULL) = 0;
-    }
-#endif
-    return weak_this_.lock();
-  }
-
- protected:
-  enable_shared_from_this() { }
-  enable_shared_from_this(const enable_shared_from_this& other) { }
-  enable_shared_from_this& operator=(const enable_shared_from_this& other) {
-    return *this;
-  }
-  ~enable_shared_from_this() { }
-
- private:
-  weak_ptr<T> weak_this_;
-};
-
-// This is a helper function called by shared_ptr's constructor from a raw
-// pointer. If T inherits from enable_shared_from_this<T>, it sets up
-// weak_this_ so that shared_from_this works correctly. If T does not inherit
-// from weak_this we get a different overload, defined inline, which does
-// nothing.
-template<typename T>
-void shared_ptr<T>::MaybeSetupWeakThis(enable_shared_from_this<T>* ptr) {
-  if (ptr)
-    ptr->weak_this_ = *this;
-}
-
-#endif  // BAR_COMMON_SHARED_PTR_H_
diff --git a/third_party/breakpad/build.scons b/third_party/breakpad/build.scons
deleted file mode 100644
index 9f5c0ba..0000000
--- a/third_party/breakpad/build.scons
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-
-Import('env')
-
-#
-# Build BreakPad library
-#
-
-breakpad_env = env.Clone()
-breakpad_env.Append(
-    CPPPATH = [
-        '$MAIN_DIR/third_party/breakpad/src/',
-        ],
-    CCFLAGS = [
-        '/wd4061',  # enumerator in switch is not handled by a case label
-        '/wd4826',  # conversion is sign-extended
-        ],
-    CPPDEFINES = [
-        # Make breakpad not use a TerminateThread call to clean up one of its
-        # worker threads. This is required in order to pass App Verifier tests.
-        'BREAKPAD_NO_TERMINATE_THREAD',
-        ],
-)
-
-target_name = 'breakpad'
-
-breakpad_inputs = [
-    'src/common/windows/guid_string.cc',
-    'src/common/windows/http_upload.cc',
-    'src/client/windows/crash_generation/client_info.cc',
-    'src/client/windows/crash_generation/crash_generation_client.cc',
-    'src/client/windows/crash_generation/crash_generation_server.cc',
-    'src/client/windows/crash_generation/minidump_generator.cc',
-    'src/client/windows/handler/exception_handler.cc',
-    'src/client/windows/sender/crash_report_sender.cc',
-    ]
-if env.Bit('use_precompiled_headers'):
-  breakpad_inputs += breakpad_env.EnablePrecompile(target_name)
-
-breakpad_env.ComponentLibrary(
-    lib_name=target_name,
-    source=breakpad_inputs,
-)
-
diff --git a/third_party/breakpad/src/client/windows/common/auto_critical_section.h b/third_party/breakpad/src/client/windows/common/auto_critical_section.h
deleted file mode 100644
index 82c7b7f..0000000
--- a/third_party/breakpad/src/client/windows/common/auto_critical_section.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright (c) 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef CLIENT_WINDOWS_COMMON_AUTO_CRITICAL_SECTION_H__
-#define CLIENT_WINDOWS_COMMON_AUTO_CRITICAL_SECTION_H__
-
-#include <Windows.h>
-
-namespace google_breakpad {
-
-// Automatically enters the critical section in the constructor and leaves
-// the critical section in the destructor.
-class AutoCriticalSection {
- public:
-  // Creates a new instance with the given critical section object
-  // and enters the critical section immediately.
-  explicit AutoCriticalSection(CRITICAL_SECTION* cs) : cs_(cs) {
-    assert(cs_);
-    EnterCriticalSection(cs_);
-  }
-
-  // Destructor: leaves the critical section.
-  ~AutoCriticalSection() {
-    LeaveCriticalSection(cs_);
-  }
-
- private:
-  // Disable copy ctor and operator=.
-  AutoCriticalSection(const AutoCriticalSection&);
-  AutoCriticalSection& operator=(const AutoCriticalSection&);
-
-  CRITICAL_SECTION* cs_;
-};
-
-}  // namespace google_breakpad
-
-#endif  // CLIENT_WINDOWS_COMMON_AUTO_CRITICAL_SECTION_H__
diff --git a/third_party/breakpad/src/client/windows/common/ipc_protocol.h b/third_party/breakpad/src/client/windows/common/ipc_protocol.h
deleted file mode 100644
index 7d101d3..0000000
--- a/third_party/breakpad/src/client/windows/common/ipc_protocol.h
+++ /dev/null
@@ -1,179 +0,0 @@
-// Copyright (c) 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef CLIENT_WINDOWS_COMMON_IPC_PROTOCOL_H__
-#define CLIENT_WINDOWS_COMMON_IPC_PROTOCOL_H__
-
-#include <Windows.h>
-#include <DbgHelp.h>
-#include <string>
-#include <utility>
-#include "common/windows/string_utils-inl.h"
-#include "google_breakpad/common/minidump_format.h"
-
-namespace google_breakpad {
-
-// Name/value pair for custom client information.
-struct CustomInfoEntry {
-  // Maximum length for name and value for client custom info.
-  static const int kNameMaxLength = 64;
-  static const int kValueMaxLength = 64;
-
-  CustomInfoEntry() {
-    // Putting name and value in initializer list makes VC++ show warning 4351.
-    set_name(NULL);
-    set_value(NULL);
-  }
-
-  CustomInfoEntry(const wchar_t* name_arg, const wchar_t* value_arg) {
-    set_name(name_arg);
-    set_value(value_arg);
-  }
-
-  void set_name(const wchar_t* name_arg) {
-    if (!name_arg) {
-      name[0] = L'\0';
-      return;
-    }
-    WindowsStringUtils::safe_wcscpy(name, kNameMaxLength, name_arg);
-  }
-
-  void set_value(const wchar_t* value_arg) {
-    if (!value_arg) {
-      value[0] = L'\0';
-      return;
-    }
-
-    WindowsStringUtils::safe_wcscpy(value, kValueMaxLength, value_arg);
-  }
-
-  void set(const wchar_t* name_arg, const wchar_t* value_arg) {
-    set_name(name_arg);
-    set_value(value_arg);
-  }
-
-  wchar_t name[kNameMaxLength];
-  wchar_t value[kValueMaxLength];
-};
-
-// Constants for the protocol between client and the server.
-
-// Tags sent with each message indicating the purpose of
-// the message.
-enum MessageTag {
-  MESSAGE_TAG_NONE = 0,
-  MESSAGE_TAG_REGISTRATION_REQUEST = 1,
-  MESSAGE_TAG_REGISTRATION_RESPONSE = 2,
-  MESSAGE_TAG_REGISTRATION_ACK = 3
-};
-
-struct CustomClientInfo {
-  const CustomInfoEntry* entries;
-  size_t count;
-};
-
-// Message structure for IPC between crash client and crash server.
-struct ProtocolMessage {
-  ProtocolMessage()
-      : tag(MESSAGE_TAG_NONE),
-        pid(0),
-        dump_type(MiniDumpNormal),
-        thread_id(0),
-        exception_pointers(NULL),
-        assert_info(NULL),
-        custom_client_info(),
-        dump_request_handle(NULL),
-        dump_generated_handle(NULL),
-        server_alive_handle(NULL) {
-  }
-
-  // Creates an instance with the given parameters.
-  ProtocolMessage(MessageTag arg_tag,
-                  DWORD arg_pid,
-                  MINIDUMP_TYPE arg_dump_type,
-                  DWORD* arg_thread_id,
-                  EXCEPTION_POINTERS** arg_exception_pointers,
-                  MDRawAssertionInfo* arg_assert_info,
-                  const CustomClientInfo& custom_info,
-                  HANDLE arg_dump_request_handle,
-                  HANDLE arg_dump_generated_handle,
-                  HANDLE arg_server_alive)
-    : tag(arg_tag),
-      pid(arg_pid),
-      dump_type(arg_dump_type),
-      thread_id(arg_thread_id),
-      exception_pointers(arg_exception_pointers),
-      assert_info(arg_assert_info),
-      custom_client_info(custom_info),
-      dump_request_handle(arg_dump_request_handle),
-      dump_generated_handle(arg_dump_generated_handle),
-      server_alive_handle(arg_server_alive) {
-  }
-
-  // Tag in the message.
-  MessageTag tag;
-
-  // Process id.
-  DWORD pid;
-
-  // Dump type requested.
-  MINIDUMP_TYPE dump_type;
-
-  // Client thread id pointer.
-  DWORD* thread_id;
-
-  // Exception information.
-  EXCEPTION_POINTERS** exception_pointers;
-
-  // Assert information in case of an invalid parameter or
-  // pure call failure.
-  MDRawAssertionInfo* assert_info;
-
-  // Custom client information.
-  CustomClientInfo custom_client_info;
-
-  // Handle to signal the crash event.
-  HANDLE dump_request_handle;
-
-  // Handle to check if server is done generating crash.
-  HANDLE dump_generated_handle;
-
-  // Handle to a mutex that becomes signaled (WAIT_ABANDONED)
-  // if server process goes down.
-  HANDLE server_alive_handle;
-
- private:
-  // Disable copy ctor and operator=.
-  ProtocolMessage(const ProtocolMessage& msg);
-  ProtocolMessage& operator=(const ProtocolMessage& msg);
-};
-
-}  // namespace google_breakpad
-
-#endif  // CLIENT_WINDOWS_COMMON_IPC_PROTOCOL_H__
diff --git a/third_party/breakpad/src/client/windows/crash_generation/client_info.cc b/third_party/breakpad/src/client/windows/crash_generation/client_info.cc
deleted file mode 100644
index 94f9c3c..0000000
--- a/third_party/breakpad/src/client/windows/crash_generation/client_info.cc
+++ /dev/null
@@ -1,200 +0,0 @@
-// Copyright (c) 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include "client/windows/crash_generation/client_info.h"
-#include "client/windows/common/ipc_protocol.h"
-
-static const wchar_t kCustomInfoProcessUptimeName[] = L"ptime";
-
-namespace google_breakpad {
-
-ClientInfo::ClientInfo(CrashGenerationServer* crash_server,
-                       DWORD pid,
-                       MINIDUMP_TYPE dump_type,
-                       DWORD* thread_id,
-                       EXCEPTION_POINTERS** ex_info,
-                       MDRawAssertionInfo* assert_info,
-                       const CustomClientInfo& custom_client_info)
-    : crash_server_(crash_server),
-      pid_(pid),
-      dump_type_(dump_type),
-      ex_info_(ex_info),
-      assert_info_(assert_info),
-      custom_client_info_(custom_client_info),
-      thread_id_(thread_id),
-      process_handle_(NULL),
-      dump_requested_handle_(NULL),
-      dump_generated_handle_(NULL),
-      dump_request_wait_handle_(NULL),
-      process_exit_wait_handle_(NULL) {
-  GetSystemTimeAsFileTime(&start_time_);
-}
-
-bool ClientInfo::Initialize() {
-  process_handle_ = OpenProcess(GENERIC_ALL, FALSE, pid_);
-  if (!process_handle_) {
-    return false;
-  }
-
-  dump_requested_handle_ = CreateEvent(NULL,    // Security attributes.
-                                       TRUE,    // Manual reset.
-                                       FALSE,   // Initial state.
-                                       NULL);   // Name.
-  if (!dump_requested_handle_) {
-    return false;
-  }
-
-  dump_generated_handle_ = CreateEvent(NULL,    // Security attributes.
-                                       TRUE,    // Manual reset.
-                                       FALSE,   // Initial state.
-                                       NULL);   // Name.
-  return dump_generated_handle_ != NULL;
-}
-
-ClientInfo::~ClientInfo() {
-  if (dump_request_wait_handle_) {
-    // Wait for callbacks that might already be running to finish.
-    UnregisterWaitEx(dump_request_wait_handle_, INVALID_HANDLE_VALUE);
-  }
-
-  if (process_exit_wait_handle_) {
-    // Wait for the callback that might already be running to finish.
-    UnregisterWaitEx(process_exit_wait_handle_, INVALID_HANDLE_VALUE);
-  }
-
-  if (process_handle_) {
-    CloseHandle(process_handle_);
-  }
-
-  if (dump_requested_handle_) {
-    CloseHandle(dump_requested_handle_);
-  }
-
-  if (dump_generated_handle_) {
-    CloseHandle(dump_generated_handle_);
-  }
-}
-
-void ClientInfo::UnregisterWaits() {
-  if (dump_request_wait_handle_) {
-    UnregisterWait(dump_request_wait_handle_);
-    dump_request_wait_handle_ = NULL;
-  }
-
-  if (process_exit_wait_handle_) {
-    UnregisterWait(process_exit_wait_handle_);
-    process_exit_wait_handle_ = NULL;
-  }
-}
-
-bool ClientInfo::GetClientExceptionInfo(EXCEPTION_POINTERS** ex_info) const {
-  SIZE_T bytes_count = 0;
-  if (!ReadProcessMemory(process_handle_,
-                         ex_info_,
-                         ex_info,
-                         sizeof(*ex_info),
-                         &bytes_count)) {
-    return false;
-  }
-
-  return bytes_count == sizeof(*ex_info);
-}
-
-bool ClientInfo::GetClientThreadId(DWORD* thread_id) const {
-  SIZE_T bytes_count = 0;
-  if (!ReadProcessMemory(process_handle_,
-                         thread_id_,
-                         thread_id,
-                         sizeof(*thread_id),
-                         &bytes_count)) {
-    return false;
-  }
-
-  return bytes_count == sizeof(*thread_id);
-}
-
-void ClientInfo::SetProcessUptime() {
-  FILETIME now = {0};
-  GetSystemTimeAsFileTime(&now);
-
-  ULARGE_INTEGER time_start;
-  time_start.HighPart = start_time_.dwHighDateTime;
-  time_start.LowPart = start_time_.dwLowDateTime;
-
-  ULARGE_INTEGER time_now;
-  time_now.HighPart = now.dwHighDateTime;
-  time_now.LowPart = now.dwLowDateTime;
-
-  // Calculate the delay and convert it from 100-nanoseconds to milliseconds.
-  __int64 delay = (time_now.QuadPart - time_start.QuadPart) / 10 / 1000;
-
-  // Convert it to a string.
-  wchar_t* value = custom_info_entries_.get()[custom_client_info_.count].value;
-  _i64tow_s(delay, value, CustomInfoEntry::kValueMaxLength, 10);
-}
-
-bool ClientInfo::PopulateCustomInfo() {
-  SIZE_T bytes_count = 0;
-  SIZE_T read_count = sizeof(CustomInfoEntry) * custom_client_info_.count;
-
-  // If the scoped array for custom info already has an array, it will be
-  // the same size as what we need. This is because the number of custom info
-  // entries is always the same. So allocate memory only if scoped array has
-  // a NULL pointer.
-  if (!custom_info_entries_.get()) {
-    // Allocate an extra entry for reporting uptime for the client process.
-    custom_info_entries_.reset(
-        new CustomInfoEntry[custom_client_info_.count + 1]);
-    // Use the last element in the array for uptime.
-    custom_info_entries_.get()[custom_client_info_.count].set_name(
-        kCustomInfoProcessUptimeName);
-  }
-
-  if (!ReadProcessMemory(process_handle_,
-                         custom_client_info_.entries,
-                         custom_info_entries_.get(),
-                         read_count,
-                         &bytes_count)) {
-    return false;
-  }
-
-  SetProcessUptime();
-  return (bytes_count != read_count);
-}
-
-CustomClientInfo ClientInfo::GetCustomInfo() const {
-  CustomClientInfo custom_info;
-  custom_info.entries = custom_info_entries_.get();
-  // Add 1 to the count from the client process to account for extra entry for
-  // process uptime.
-  custom_info.count = custom_client_info_.count + 1;
-  return custom_info;
-}
-
-}  // namespace google_breakpad
diff --git a/third_party/breakpad/src/client/windows/crash_generation/client_info.h b/third_party/breakpad/src/client/windows/crash_generation/client_info.h
deleted file mode 100644
index 47a5d21..0000000
--- a/third_party/breakpad/src/client/windows/crash_generation/client_info.h
+++ /dev/null
@@ -1,170 +0,0 @@
-// Copyright (c) 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef CLIENT_WINDOWS_CRASH_GENERATION_CLIENT_INFO_H__
-#define CLIENT_WINDOWS_CRASH_GENERATION_CLIENT_INFO_H__
-
-#include <Windows.h>
-#include <DbgHelp.h>
-#include "client/windows/common/ipc_protocol.h"
-#include "google_breakpad/common/minidump_format.h"
-#include "processor/scoped_ptr.h"
-
-namespace google_breakpad {
-
-class CrashGenerationServer;
-
-// Abstraction for a crash client process.
-class ClientInfo {
- public:
-  // Creates an instance with the given values. Gets the process
-  // handle for the given process id and creates necessary event
-  // objects.
-  ClientInfo(CrashGenerationServer* crash_server,
-             DWORD pid,
-             MINIDUMP_TYPE dump_type,
-             DWORD* thread_id,
-             EXCEPTION_POINTERS** ex_info,
-             MDRawAssertionInfo* assert_info,
-             const CustomClientInfo& custom_client_info);
-
-  ~ClientInfo();
-
-  CrashGenerationServer* crash_server() const { return crash_server_; }
-  DWORD pid() const { return pid_; }
-  MINIDUMP_TYPE dump_type() const { return dump_type_; }
-  EXCEPTION_POINTERS** ex_info() const { return ex_info_; }
-  MDRawAssertionInfo* assert_info() const { return assert_info_; }
-  DWORD* thread_id() const { return thread_id_; }
-  HANDLE process_handle() const { return process_handle_; }
-  HANDLE dump_requested_handle() const { return dump_requested_handle_; }
-  HANDLE dump_generated_handle() const { return dump_generated_handle_; }
-
-  HANDLE dump_request_wait_handle() const {
-    return dump_request_wait_handle_;
-  }
-
-  void set_dump_request_wait_handle(HANDLE value) {
-    dump_request_wait_handle_ = value;
-  }
-
-  HANDLE process_exit_wait_handle() const {
-    return process_exit_wait_handle_;
-  }
-
-  void set_process_exit_wait_handle(HANDLE value) {
-    process_exit_wait_handle_ = value;
-  }
-
-  // Unregister all waits for the client.
-  void UnregisterWaits();
-
-  bool Initialize();
-  bool GetClientExceptionInfo(EXCEPTION_POINTERS** ex_info) const;
-  bool GetClientThreadId(DWORD* thread_id) const;
-
-  // Reads the custom information from the client process address space.
-  bool PopulateCustomInfo();
-
-  // Returns the client custom information.
-  CustomClientInfo GetCustomInfo() const;
-
- private:
-  // Calcualtes the uptime for the client process, converts it to a string and
-  // stores it in the last entry of client custom info.
-  void SetProcessUptime();
-
-  // Crash generation server.
-  CrashGenerationServer* crash_server_;
-
-  // Client process ID.
-  DWORD pid_;
-
-  // Dump type requested by the client.
-  MINIDUMP_TYPE dump_type_;
-
-  // Address of an EXCEPTION_POINTERS* variable in the client
-  // process address space that will point to an instance of
-  // EXCEPTION_POINTERS containing information about crash.
-  //
-  // WARNING: Do not dereference these pointers as they are pointers
-  // in the address space of another process.
-  EXCEPTION_POINTERS** ex_info_;
-
-  // Address of an instance of MDRawAssertionInfo in the client
-  // process address space that will contain information about
-  // non-exception related crashes like invalid parameter assertion
-  // failures and pure calls.
-  //
-  // WARNING: Do not dereference these pointers as they are pointers
-  // in the address space of another process.
-  MDRawAssertionInfo* assert_info_;
-
-  // Custom information about the client.
-  CustomClientInfo custom_client_info_;
-
-  // Contains the custom client info entries read from the client process
-  // memory. This will be populated only if the method GetClientCustomInfo
-  // is called.
-  scoped_array<CustomInfoEntry> custom_info_entries_;
-
-  // Address of a variable in the client process address space that
-  // will contain the thread id of the crashing client thread.
-  //
-  // WARNING: Do not dereference these pointers as they are pointers
-  // in the address space of another process.
-  DWORD* thread_id_;
-
-  // Client process handle.
-  HANDLE process_handle_;
-
-  // Dump request event handle.
-  HANDLE dump_requested_handle_;
-
-  // Dump generated event handle.
-  HANDLE dump_generated_handle_;
-
-  // Wait handle for dump request event.
-  HANDLE dump_request_wait_handle_;
-
-  // Wait handle for process exit event.
-  HANDLE process_exit_wait_handle_;
-
-  // Time when the client process started. It is used to determine the uptime
-  // for the client process when it signals a crash.
-  FILETIME start_time_;
-
-  // Disallow copy ctor and operator=.
-  ClientInfo(const ClientInfo& client_info);
-  ClientInfo& operator=(const ClientInfo& client_info);
-};
-
-}  // namespace google_breakpad
-
-#endif  // CLIENT_WINDOWS_CRASH_GENERATION_CLIENT_INFO_H__
diff --git a/third_party/breakpad/src/client/windows/crash_generation/crash_generation_client.cc b/third_party/breakpad/src/client/windows/crash_generation/crash_generation_client.cc
deleted file mode 100644
index 5e4e3cb..0000000
--- a/third_party/breakpad/src/client/windows/crash_generation/crash_generation_client.cc
+++ /dev/null
@@ -1,328 +0,0 @@
-// Copyright (c) 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include "client/windows/crash_generation/crash_generation_client.h"
-#include <cassert>
-#include <utility>
-#include "client/windows/common/ipc_protocol.h"
-
-namespace google_breakpad {
-
-const int kPipeBusyWaitTimeoutMs = 2000;
-
-#ifdef _DEBUG
-const DWORD kWaitForServerTimeoutMs = INFINITE;
-#else
-const DWORD kWaitForServerTimeoutMs = 15000;
-#endif
-
-const int kPipeConnectMaxAttempts = 2;
-
-const DWORD kPipeDesiredAccess = FILE_READ_DATA |
-                                 FILE_WRITE_DATA |
-                                 FILE_WRITE_ATTRIBUTES;
-
-const DWORD kPipeFlagsAndAttributes = SECURITY_IDENTIFICATION |
-                                      SECURITY_SQOS_PRESENT;
-
-const DWORD kPipeMode = PIPE_READMODE_MESSAGE;
-
-const size_t kWaitEventCount = 2;
-
-// This function is orphan for production code. It can be used
-// for debugging to help repro some scenarios like the client
-// is slow in writing to the pipe after connecting, the client
-// is slow in reading from the pipe after writing, etc. The parameter
-// overlapped below is not used and it is present to match the signature
-// of this function to TransactNamedPipe Win32 API. Uncomment if needed
-// for debugging.
-/**
-static bool TransactNamedPipeDebugHelper(HANDLE pipe,
-                                         const void* in_buffer,
-                                         DWORD in_size,
-                                         void* out_buffer,
-                                         DWORD out_size,
-                                         DWORD* bytes_count,
-                                         LPOVERLAPPED) {
-  // Uncomment the next sleep to create a gap before writing
-  // to pipe.
-  // Sleep(5000);
-
-  if (!WriteFile(pipe,
-                 in_buffer,
-                 in_size,
-                 bytes_count,
-                 NULL)) {
-    return false;
-  }
-
-  // Uncomment the next sleep to create a gap between write
-  // and read.
-  // Sleep(5000);
-
-  return ReadFile(pipe, out_buffer, out_size, bytes_count, NULL) != FALSE;
-}
-**/
-
-CrashGenerationClient::CrashGenerationClient(
-    const wchar_t* pipe_name,
-    MINIDUMP_TYPE dump_type,
-    const CustomClientInfo* custom_info)
-        : pipe_name_(pipe_name),
-          dump_type_(dump_type),
-          thread_id_(0),
-          server_process_id_(0),
-          crash_event_(NULL),
-          crash_generated_(NULL),
-          server_alive_(NULL),
-          exception_pointers_(NULL),
-          custom_info_() {
-  memset(&assert_info_, 0, sizeof(assert_info_));
-  if (custom_info) {
-    custom_info_ = *custom_info;
-  }
-}
-
-CrashGenerationClient::~CrashGenerationClient() {
-  if (crash_event_) {
-    CloseHandle(crash_event_);
-  }
-
-  if (crash_generated_) {
-    CloseHandle(crash_generated_);
-  }
-
-  if (server_alive_) {
-    CloseHandle(server_alive_);
-  }
-}
-
-// Performs the registration step with the server process.
-// The registration step involves communicating with the server
-// via a named pipe. The client sends the following pieces of
-// data to the server:
-//
-// * Message tag indicating the client is requesting registration.
-// * Process id of the client process.
-// * Address of a DWORD variable in the client address space
-//   that will contain the thread id of the client thread that
-//   caused the crash.
-// * Address of a EXCEPTION_POINTERS* variable in the client
-//   address space that will point to an instance of EXCEPTION_POINTERS
-//   when the crash happens.
-// * Address of an instance of MDRawAssertionInfo that will contain
-//   relevant information in case of non-exception crashes like assertion
-//   failures and pure calls.
-//
-// In return the client expects the following information from the server:
-//
-// * Message tag indicating successful registration.
-// * Server process id.
-// * Handle to an object that client can signal to request dump
-//   generation from the server.
-// * Handle to an object that client can wait on after requesting
-//   dump generation for the server to finish dump generation.
-// * Handle to a mutex object that client can wait on to make sure
-//   server is still alive.
-//
-// If any step of the expected behavior mentioned above fails, the
-// registration step is not considered successful and hence out-of-process
-// dump generation service is not available.
-//
-// Returns true if the registration is successful; false otherwise.
-bool CrashGenerationClient::Register() {
-  HANDLE pipe = ConnectToServer();
-  if (!pipe) {
-    return false;
-  }
-
-  bool success = RegisterClient(pipe);
-  CloseHandle(pipe);
-  return success;
-}
-
-HANDLE CrashGenerationClient::ConnectToServer() {
-  HANDLE pipe = ConnectToPipe(pipe_name_.c_str(),
-                              kPipeDesiredAccess,
-                              kPipeFlagsAndAttributes);
-  if (!pipe) {
-    return NULL;
-  }
-
-  DWORD mode = kPipeMode;
-  if (!SetNamedPipeHandleState(pipe, &mode, NULL, NULL)) {
-    CloseHandle(pipe);
-    pipe = NULL;
-  }
-
-  return pipe;
-}
-
-bool CrashGenerationClient::RegisterClient(HANDLE pipe) {
-  ProtocolMessage msg(MESSAGE_TAG_REGISTRATION_REQUEST,
-                      GetCurrentProcessId(),
-                      dump_type_,
-                      &thread_id_,
-                      &exception_pointers_,
-                      &assert_info_,
-                      custom_info_,
-                      NULL,
-                      NULL,
-                      NULL);
-  ProtocolMessage reply;
-  DWORD bytes_count = 0;
-  // The call to TransactNamedPipe below can be changed to a call
-  // to TransactNamedPipeDebugHelper to help repro some scenarios.
-  // For details see comments for TransactNamedPipeDebugHelper.
-  if (!TransactNamedPipe(pipe,
-                         &msg,
-                         sizeof(msg),
-                         &reply,
-                         sizeof(ProtocolMessage),
-                         &bytes_count,
-                         NULL)) {
-    return false;
-  }
-
-  if (!ValidateResponse(reply)) {
-    return false;
-  }
-
-  ProtocolMessage ack_msg;
-  ack_msg.tag = MESSAGE_TAG_REGISTRATION_ACK;
-
-  if (!WriteFile(pipe, &ack_msg, sizeof(ack_msg), &bytes_count, NULL)) {
-    return false;
-  }
-  crash_event_ = reply.dump_request_handle;
-  crash_generated_ = reply.dump_generated_handle;
-  server_alive_ = reply.server_alive_handle;
-  server_process_id_ = reply.pid;
-
-  return true;
-}
-
-HANDLE CrashGenerationClient::ConnectToPipe(const wchar_t* pipe_name,
-                                            DWORD pipe_access,
-                                            DWORD flags_attrs) {
-  for (int i = 0; i < kPipeConnectMaxAttempts; ++i) {
-    HANDLE pipe = CreateFile(pipe_name,
-                             pipe_access,
-                             0,
-                             NULL,
-                             OPEN_EXISTING,
-                             flags_attrs,
-                             NULL);
-    if (pipe != INVALID_HANDLE_VALUE) {
-      return pipe;
-    }
-
-    // Cannot continue retrying if error is something other than
-    // ERROR_PIPE_BUSY.
-    if (GetLastError() != ERROR_PIPE_BUSY) {
-      break;
-    }
-
-    // Cannot continue retrying if wait on pipe fails.
-    if (!WaitNamedPipe(pipe_name, kPipeBusyWaitTimeoutMs)) {
-      break;
-    }
-  }
-
-  return NULL;
-}
-
-bool CrashGenerationClient::ValidateResponse(
-    const ProtocolMessage& msg) const {
-  return (msg.tag == MESSAGE_TAG_REGISTRATION_RESPONSE) &&
-         (msg.pid != 0) &&
-         (msg.dump_request_handle != NULL) &&
-         (msg.dump_generated_handle != NULL) &&
-         (msg.server_alive_handle != NULL);
-}
-
-bool CrashGenerationClient::IsRegistered() const {
-  return crash_event_ != NULL;
-}
-
-bool CrashGenerationClient::RequestDump(EXCEPTION_POINTERS* ex_info,
-                                        MDRawAssertionInfo* assert_info) {
-  if (!IsRegistered()) {
-    return false;
-  }
-
-  exception_pointers_ = ex_info;
-  thread_id_ = GetCurrentThreadId();
-
-  if (assert_info) {
-    memcpy(&assert_info_, assert_info, sizeof(assert_info_));
-  } else {
-    memset(&assert_info_, 0, sizeof(assert_info_));
-  }
-
-  return SignalCrashEventAndWait();
-}
-
-bool CrashGenerationClient::RequestDump(EXCEPTION_POINTERS* ex_info) {
-  return RequestDump(ex_info, NULL);
-}
-
-bool CrashGenerationClient::RequestDump(MDRawAssertionInfo* assert_info) {
-  return RequestDump(NULL, assert_info);
-}
-
-bool CrashGenerationClient::SignalCrashEventAndWait() {
-  assert(crash_event_);
-  assert(crash_generated_);
-  assert(server_alive_);
-
-  // Reset the dump generated event before signaling the crash
-  // event so that the server can set the dump generated event
-  // once it is done generating the event.
-  if (!ResetEvent(crash_generated_)) {
-    return false;
-  }
-
-  if (!SetEvent(crash_event_)) {
-    return false;
-  }
-
-  HANDLE wait_handles[kWaitEventCount] = {crash_generated_, server_alive_};
-
-  DWORD result = WaitForMultipleObjects(kWaitEventCount,
-                                        wait_handles,
-                                        FALSE,
-                                        kWaitForServerTimeoutMs);
-
-  // Crash dump was successfully generated only if the server
-  // signaled the crash generated event.
-  return result == WAIT_OBJECT_0;
-}
-
-}  // namespace google_breakpad
diff --git a/third_party/breakpad/src/client/windows/crash_generation/crash_generation_client.h b/third_party/breakpad/src/client/windows/crash_generation/crash_generation_client.h
deleted file mode 100644
index 01d13dd..0000000
--- a/third_party/breakpad/src/client/windows/crash_generation/crash_generation_client.h
+++ /dev/null
@@ -1,162 +0,0 @@
-// Copyright (c) 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef CLIENT_WINDOWS_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H_
-#define CLIENT_WINDOWS_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H_
-
-#include <windows.h>
-#include <dbghelp.h>
-#include <string>
-#include <utility>
-#include "client/windows/common/ipc_protocol.h"
-#include "processor/scoped_ptr.h"
-
-namespace google_breakpad {
-
-struct CustomClientInfo;
-
-// Abstraction of client-side implementation of out of process
-// crash generation.
-//
-// The process that desires to have out-of-process crash dump
-// generation service can use this class in the following way:
-//
-// * Create an instance.
-// * Call Register method so that the client tries to register
-//   with the server process and check the return value. If
-//   registration is not successful, out-of-process crash dump
-//   generation will not be available
-// * Request dump generation by calling either of the two
-//   overloaded RequestDump methods - one in case of exceptions
-//   and the other in case of assertion failures
-//
-// Note that it is the responsibility of the client code of
-// this class to set the unhandled exception filter with the
-// system by calling the SetUnhandledExceptionFilter function
-// and the client code should explicitly request dump generation.
-class CrashGenerationClient {
- public:
-  CrashGenerationClient(const wchar_t* pipe_name,
-                        MINIDUMP_TYPE dump_type,
-                        const CustomClientInfo* custom_info);
-
-  ~CrashGenerationClient();
-
-  // Registers the client process with the crash server.
-  //
-  // Returns true if the registration is successful; false otherwise.
-  bool Register();
-
-  bool RequestDump(EXCEPTION_POINTERS* ex_info,
-                   MDRawAssertionInfo* assert_info);
-
-  // Requests the crash server to generate a dump with the given
-  // exception information.
-  //
-  // Returns true if the dump was successful; false otherwise. Note that
-  // if the registration step was not performed or it was not successful,
-  // false will be returned.
-  bool RequestDump(EXCEPTION_POINTERS* ex_info);
-
-  // Requests the crash server to generate a dump with the given
-  // assertion information.
-  //
-  // Returns true if the dump was successful; false otherwise. Note that
-  // if the registration step was not performed or it was not successful,
-  // false will be returned.
-  bool RequestDump(MDRawAssertionInfo* assert_info);
-
- private:
-  // Connects to the appropriate pipe and sets the pipe handle state.
-  //
-  // Returns the pipe handle if everything goes well; otherwise Returns NULL.
-  HANDLE ConnectToServer();
-
-  // Performs a handshake with the server over the given pipe which should be
-  // already connected to the server.
-  //
-  // Returns true if handshake with the server was successful; false otherwise.
-  bool RegisterClient(HANDLE pipe);
-
-  // Validates the given server response.
-  bool ValidateResponse(const ProtocolMessage& msg) const;
-
-  // Returns true if the registration step succeeded; false otherwise.
-  bool IsRegistered() const;
-
-  // Connects to the given named pipe with given parameters.
-  //
-  // Returns true if the connection is successful; false otherwise.
-  HANDLE ConnectToPipe(const wchar_t* pipe_name,
-                       DWORD pipe_access,
-                       DWORD flags_attrs);
-
-  // Signals the crash event and wait for the server to generate crash.
-  bool SignalCrashEventAndWait();
-
-  // Pipe name to use to talk to server.
-  std::wstring pipe_name_;
-
-  // Custom client information
-  CustomClientInfo custom_info_;
-
-  // Type of dump to generate.
-  MINIDUMP_TYPE dump_type_;
-
-  // Event to signal in case of a crash.
-  HANDLE crash_event_;
-
-  // Handle to wait on after signaling a crash for the server
-  // to finish generating crash dump.
-  HANDLE crash_generated_;
-
-  // Handle to a mutex that will become signaled with WAIT_ABANDONED
-  // if the server process goes down.
-  HANDLE server_alive_;
-
-  // Server process id.
-  DWORD server_process_id_;
-
-  // Id of the thread that caused the crash.
-  DWORD thread_id_;
-
-  // Exception pointers for an exception crash.
-  EXCEPTION_POINTERS* exception_pointers_;
-
-  // Assertion info for an invalid parameter or pure call crash.
-  MDRawAssertionInfo assert_info_;
-
-  // Disable copy ctor and operator=.
-  CrashGenerationClient(const CrashGenerationClient& crash_client);
-  CrashGenerationClient& operator=(const CrashGenerationClient& crash_client);
-};
-
-}  // namespace google_breakpad
-
-#endif  // CLIENT_WINDOWS_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H_
diff --git a/third_party/breakpad/src/client/windows/crash_generation/crash_generation_server.cc b/third_party/breakpad/src/client/windows/crash_generation/crash_generation_server.cc
deleted file mode 100644
index 61af1b2..0000000
--- a/third_party/breakpad/src/client/windows/crash_generation/crash_generation_server.cc
+++ /dev/null
@@ -1,880 +0,0 @@
-// Copyright (c) 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include "client/windows/crash_generation/crash_generation_server.h"
-#include <windows.h>
-#include <cassert>
-#include <list>
-#include "client/windows/common/auto_critical_section.h"
-#include "processor/scoped_ptr.h"
-
-#include "client/windows/crash_generation/client_info.h"
-
-namespace google_breakpad {
-
-// Output buffer size.
-static const size_t kOutBufferSize = 64;
-
-// Input buffer size.
-static const size_t kInBufferSize = 64;
-
-// Access flags for the client on the dump request event.
-static const DWORD kDumpRequestEventAccess = EVENT_MODIFY_STATE;
-
-// Access flags for the client on the dump generated event.
-static const DWORD kDumpGeneratedEventAccess = EVENT_MODIFY_STATE |
-                                               SYNCHRONIZE;
-
-// Access flags for the client on the mutex.
-static const DWORD kMutexAccess = SYNCHRONIZE;
-
-// Attribute flags for the pipe.
-static const DWORD kPipeAttr = FILE_FLAG_FIRST_PIPE_INSTANCE |
-                               PIPE_ACCESS_DUPLEX |
-                               FILE_FLAG_OVERLAPPED;
-
-// Mode for the pipe.
-static const DWORD kPipeMode = PIPE_TYPE_MESSAGE |
-                               PIPE_READMODE_MESSAGE |
-                               PIPE_WAIT;
-
-// For pipe I/O, execute the callback in the wait thread itself,
-// since the callback does very little work. The callback executes
-// the code for one of the states of the server state machine and
-// the code for all of the states perform async I/O and hence
-// finish very quickly.
-static const ULONG kPipeIOThreadFlags = WT_EXECUTEINWAITTHREAD;
-
-// Dump request threads will, most likely, generate dumps. That may
-// take some time to finish, so specify WT_EXECUTELONGFUNCTION flag.
-static const ULONG kDumpRequestThreadFlags = WT_EXECUTEINWAITTHREAD |
-                                             WT_EXECUTELONGFUNCTION;
-
-// Maximum delay during server shutdown if some work items
-// are still executing.
-static const int kShutdownDelayMs = 10000;
-
-// Interval for each sleep during server shutdown.
-static const int kShutdownSleepIntervalMs = 5;
-
-static bool IsClientRequestValid(const ProtocolMessage& msg) {
-  return msg.tag == MESSAGE_TAG_REGISTRATION_REQUEST &&
-         msg.pid != 0 &&
-         msg.thread_id != NULL &&
-         msg.exception_pointers != NULL &&
-         msg.assert_info != NULL;
-}
-
-CrashGenerationServer::CrashGenerationServer(
-    const std::wstring& pipe_name,
-    SECURITY_ATTRIBUTES* pipe_sec_attrs,
-    OnClientConnectedCallback connect_callback,
-    void* connect_context,
-    OnClientDumpRequestCallback dump_callback,
-    void* dump_context,
-    OnClientExitedCallback exit_callback,
-    void* exit_context,
-    bool generate_dumps,
-    const std::wstring* dump_path)
-    : pipe_name_(pipe_name),
-      pipe_sec_attrs_(pipe_sec_attrs),
-      pipe_(NULL),
-      pipe_wait_handle_(NULL),
-      server_alive_handle_(NULL),
-      connect_callback_(connect_callback),
-      connect_context_(connect_context),
-      dump_callback_(dump_callback),
-      dump_context_(dump_context),
-      exit_callback_(exit_callback),
-      exit_context_(exit_context),
-      generate_dumps_(generate_dumps),
-      dump_generator_(NULL),
-      server_state_(IPC_SERVER_STATE_UNINITIALIZED),
-      shutting_down_(false),
-      overlapped_(),
-      client_info_(NULL),
-      cleanup_item_count_(0) {
-  InitializeCriticalSection(&clients_sync_);
-
-  if (dump_path) {
-    dump_generator_.reset(new MinidumpGenerator(*dump_path));
-  }
-}
-
-CrashGenerationServer::~CrashGenerationServer() {
-  // Indicate to existing threads that server is shutting down.
-  shutting_down_ = true;
-
-  // Even if there are no current worker threads running, it is possible that
-  // an I/O request is pending on the pipe right now but not yet done. In fact,
-  // it's very likely this is the case unless we are in an ERROR state. If we
-  // don't wait for the pending I/O to be done, then when the I/O completes,
-  // it may write to invalid memory. AppVerifier will flag this problem too.
-  // So we disconnect from the pipe and then wait for the server to get into
-  // error state so that the pending I/O will fail and get cleared.
-  DisconnectNamedPipe(pipe_);
-  int num_tries = 100;
-  while (num_tries-- && server_state_ != IPC_SERVER_STATE_ERROR) {
-    Sleep(10);
-  }
-
-  // Unregister wait on the pipe.
-  if (pipe_wait_handle_) {
-    // Wait for already executing callbacks to finish.
-    UnregisterWaitEx(pipe_wait_handle_, INVALID_HANDLE_VALUE);
-  }
-
-  // Close the pipe to avoid further client connections.
-  if (pipe_) {
-    CloseHandle(pipe_);
-  }
-
-  // Request all ClientInfo objects to unregister all waits.
-  // New scope to hold the lock for the shortest time.
-  {
-    AutoCriticalSection lock(&clients_sync_);
-
-    std::list<ClientInfo*>::iterator iter;
-    for (iter = clients_.begin(); iter != clients_.end(); ++iter) {
-      ClientInfo* client_info = *iter;
-      client_info->UnregisterWaits();
-    }
-  }
-
-  // Now that all waits have been unregistered, wait for some time
-  // for all pending work items to finish.
-  int total_wait = 0;
-  while (cleanup_item_count_ > 0) {
-    Sleep(kShutdownSleepIntervalMs);
-
-    total_wait += kShutdownSleepIntervalMs;
-
-    if (total_wait >= kShutdownDelayMs) {
-      break;
-    }
-  }
-
-  // Clean up all the ClientInfo objects.
-  // New scope to hold the lock for the shortest time.
-  {
-    AutoCriticalSection lock(&clients_sync_);
-
-    std::list<ClientInfo*>::iterator iter;
-    for (iter = clients_.begin(); iter != clients_.end(); ++iter) {
-      ClientInfo* client_info = *iter;
-      delete client_info;
-    }
-  }
-
-  if (server_alive_handle_) {
-    // Release the mutex before closing the handle so that clients requesting
-    // dumps wait for a long time for the server to generate a dump.
-    ReleaseMutex(server_alive_handle_);
-    CloseHandle(server_alive_handle_);
-  }
-
-  if (overlapped_.hEvent) {
-    CloseHandle(overlapped_.hEvent);
-  }
-
-  DeleteCriticalSection(&clients_sync_);
-}
-
-bool CrashGenerationServer::Start() {
-  if (server_state_ != IPC_SERVER_STATE_UNINITIALIZED) {
-    return false;
-  }
-
-  server_state_ = IPC_SERVER_STATE_INITIAL;
-
-  server_alive_handle_ = CreateMutex(NULL, TRUE, NULL);
-  if (!server_alive_handle_) {
-    return false;
-  }
-
-  // Event to signal the client connection and pipe reads and writes.
-  overlapped_.hEvent = CreateEvent(NULL,   // Security descriptor.
-                                   TRUE,   // Manual reset.
-                                   FALSE,  // Initially signaled.
-                                   NULL);  // Name.
-  if (!overlapped_.hEvent) {
-    return false;
-  }
-
-  // Register a callback with the thread pool for the client connection.
-  if (!RegisterWaitForSingleObject(&pipe_wait_handle_,
-                                   overlapped_.hEvent,
-                                   OnPipeConnected,
-                                   this,
-                                   INFINITE,
-                                   kPipeIOThreadFlags)) {
-    return false;
-  }
-
-  pipe_ = CreateNamedPipe(pipe_name_.c_str(),
-                          kPipeAttr,
-                          kPipeMode,
-                          1,
-                          kOutBufferSize,
-                          kInBufferSize,
-                          0,
-                          pipe_sec_attrs_);
-  if (pipe_ == INVALID_HANDLE_VALUE) {
-    return false;
-  }
-
-  // Kick-start the state machine. This will initiate an asynchronous wait
-  // for client connections.
-  HandleInitialState();
-
-  // If we are in error state, it's because we failed to start listening.
-  return server_state_ != IPC_SERVER_STATE_ERROR;
-}
-
-// If the server thread serving clients ever gets into the
-// ERROR state, reset the event, close the pipe and remain
-// in the error state forever. Error state means something
-// that we didn't account for has happened, and it's dangerous
-// to do anything unknowingly.
-void CrashGenerationServer::HandleErrorState() {
-  assert(server_state_ == IPC_SERVER_STATE_ERROR);
-
-  // If the server is shutting down anyway, don't clean up
-  // here since shut down process will clean up.
-  if (shutting_down_) {
-    return;
-  }
-
-  if (pipe_wait_handle_) {
-    UnregisterWait(pipe_wait_handle_);
-    pipe_wait_handle_ = NULL;
-  }
-
-  if (pipe_) {
-    CloseHandle(pipe_);
-    pipe_ = NULL;
-  }
-
-  if (overlapped_.hEvent) {
-    CloseHandle(overlapped_.hEvent);
-    overlapped_.hEvent = NULL;
-  }
-}
-
-// When the server thread serving clients is in the INITIAL state,
-// try to connect to the pipe asynchronously. If the connection
-// finishes synchronously, directly go into the CONNECTED state;
-// otherwise go into the CONNECTING state. For any problems, go
-// into the ERROR state.
-void CrashGenerationServer::HandleInitialState() {
-  assert(server_state_ == IPC_SERVER_STATE_INITIAL);
-
-  if (!ResetEvent(overlapped_.hEvent)) {
-    EnterErrorState();
-    return;
-  }
-
-  bool success = ConnectNamedPipe(pipe_, &overlapped_) != FALSE;
-  DWORD error_code = success ? ERROR_SUCCESS : GetLastError();
-
-  // From MSDN, it is not clear that when ConnectNamedPipe is used
-  // in an overlapped mode, will it ever return non-zero value, and
-  // if so, in what cases.
-  assert(!success);
-
-  switch (error_code) {
-    case ERROR_IO_PENDING:
-      EnterStateWhenSignaled(IPC_SERVER_STATE_CONNECTING);
-      break;
-
-    case ERROR_PIPE_CONNECTED:
-      EnterStateImmediately(IPC_SERVER_STATE_CONNECTED);
-      break;
-
-    default:
-      EnterErrorState();
-      break;
-  }
-}
-
-// When the server thread serving the clients is in the CONNECTING state,
-// try to get the result of the asynchronous connection request using
-// the OVERLAPPED object. If the result indicates the connection is done,
-// go into the CONNECTED state. If the result indicates I/O is still
-// INCOMPLETE, remain in the CONNECTING state. For any problems,
-// go into the DISCONNECTING state.
-void CrashGenerationServer::HandleConnectingState() {
-  assert(server_state_ == IPC_SERVER_STATE_CONNECTING);
-
-  DWORD bytes_count = 0;
-  bool success = GetOverlappedResult(pipe_,
-                                     &overlapped_,
-                                     &bytes_count,
-                                     FALSE) != FALSE;
-  DWORD error_code = success ? ERROR_SUCCESS : GetLastError();
-
-  if (success) {
-    EnterStateImmediately(IPC_SERVER_STATE_CONNECTED);
-  } else if (error_code != ERROR_IO_INCOMPLETE) {
-    EnterStateImmediately(IPC_SERVER_STATE_DISCONNECTING);
-  } else {
-    // remain in CONNECTING state
-  }
-}
-
-// When the server thread serving the clients is in the CONNECTED state,
-// try to issue an asynchronous read from the pipe. If read completes
-// synchronously or if I/O is pending then go into the READING state.
-// For any problems, go into the DISCONNECTING state.
-void CrashGenerationServer::HandleConnectedState() {
-  assert(server_state_ == IPC_SERVER_STATE_CONNECTED);
-
-  DWORD bytes_count = 0;
-  memset(&msg_, 0, sizeof(msg_));
-  bool success = ReadFile(pipe_,
-                          &msg_,
-                          sizeof(msg_),
-                          &bytes_count,
-                          &overlapped_) != FALSE;
-  DWORD error_code = success ? ERROR_SUCCESS : GetLastError();
-
-  // Note that the asynchronous read issued above can finish before the
-  // code below executes. But, it is okay to change state after issuing
-  // the asynchronous read. This is because even if the asynchronous read
-  // is done, the callback for it would not be executed until the current
-  // thread finishes its execution.
-  if (success || error_code == ERROR_IO_PENDING) {
-    EnterStateWhenSignaled(IPC_SERVER_STATE_READING);
-  } else {
-    EnterStateImmediately(IPC_SERVER_STATE_DISCONNECTING);
-  }
-}
-
-// When the server thread serving the clients is in the READING state,
-// try to get the result of the async read. If async read is done,
-// go into the READ_DONE state. For any problems, go into the
-// DISCONNECTING state.
-void CrashGenerationServer::HandleReadingState() {
-  assert(server_state_ == IPC_SERVER_STATE_READING);
-
-  DWORD bytes_count = 0;
-  bool success = GetOverlappedResult(pipe_,
-                                     &overlapped_,
-                                     &bytes_count,
-                                     FALSE) != FALSE;
-  DWORD error_code = success ? ERROR_SUCCESS : GetLastError();
-
-  if (success && bytes_count == sizeof(ProtocolMessage)) {
-    EnterStateImmediately(IPC_SERVER_STATE_READ_DONE);
-  } else {
-    // We should never get an I/O incomplete since we should not execute this
-    // unless the Read has finished and the overlapped event is signaled. If
-    // we do get INCOMPLETE, we have a bug in our code.
-    assert(error_code != ERROR_IO_INCOMPLETE);
-
-    EnterStateImmediately(IPC_SERVER_STATE_DISCONNECTING);
-  }
-}
-
-// When the server thread serving the client is in the READ_DONE state,
-// validate the client's request message, register the client by
-// creating appropriate objects and prepare the response.  Then try to
-// write the response to the pipe asynchronously. If that succeeds,
-// go into the WRITING state. For any problems, go into the DISCONNECTING
-// state.
-void CrashGenerationServer::HandleReadDoneState() {
-  assert(server_state_ == IPC_SERVER_STATE_READ_DONE);
-
-  if (!IsClientRequestValid(msg_)) {
-    EnterStateImmediately(IPC_SERVER_STATE_DISCONNECTING);
-    return;
-  }
-
-  scoped_ptr<ClientInfo> client_info(
-      new ClientInfo(this,
-                     msg_.pid,
-                     msg_.dump_type,
-                     msg_.thread_id,
-                     msg_.exception_pointers,
-                     msg_.assert_info,
-                     msg_.custom_client_info));
-
-  if (!client_info->Initialize()) {
-    EnterStateImmediately(IPC_SERVER_STATE_DISCONNECTING);
-    return;
-  }
-
-  // Issues an asynchronous WriteFile call if successful.
-  // Iff successful, assigns ownership of the client_info pointer to the server
-  // instance, in which case we must be sure not to free it in this function.
-  if (!RespondToClient(client_info.get())) {
-    EnterStateImmediately(IPC_SERVER_STATE_DISCONNECTING);
-    return;
-  }
-
-  client_info_ = client_info.release();
-
-  // Note that the asynchronous write issued by RespondToClient function
-  // can finish before  the code below executes. But it is okay to change
-  // state after issuing the asynchronous write. This is because even if
-  // the asynchronous write is done, the callback for it would not be
-  // executed until the current thread finishes its execution.
-  EnterStateWhenSignaled(IPC_SERVER_STATE_WRITING);
-}
-
-// When the server thread serving the clients is in the WRITING state,
-// try to get the result of the async write. If the async write is done,
-// go into the WRITE_DONE state. For any problems, go into the
-// DISONNECTING state.
-void CrashGenerationServer::HandleWritingState() {
-  assert(server_state_ == IPC_SERVER_STATE_WRITING);
-
-  DWORD bytes_count = 0;
-  bool success = GetOverlappedResult(pipe_,
-                                     &overlapped_,
-                                     &bytes_count,
-                                     FALSE) != FALSE;
-  DWORD error_code = success ? ERROR_SUCCESS : GetLastError();
-
-  if (success) {
-    EnterStateImmediately(IPC_SERVER_STATE_WRITE_DONE);
-    return;
-  }
-
-  // We should never get an I/O incomplete since we should not execute this
-  // unless the Write has finished and the overlapped event is signaled. If
-  // we do get INCOMPLETE, we have a bug in our code.
-  assert(error_code != ERROR_IO_INCOMPLETE);
-
-  EnterStateImmediately(IPC_SERVER_STATE_DISCONNECTING);
-}
-
-// When the server thread serving the clients is in the WRITE_DONE state,
-// try to issue an async read on the pipe. If the read completes synchronously
-// or if I/O is still pending then go into the READING_ACK state. For any
-// issues, go into the DISCONNECTING state.
-void CrashGenerationServer::HandleWriteDoneState() {
-  assert(server_state_ == IPC_SERVER_STATE_WRITE_DONE);
-
-  DWORD bytes_count = 0;
-  bool success = ReadFile(pipe_,
-                           &msg_,
-                           sizeof(msg_),
-                           &bytes_count,
-                           &overlapped_) != FALSE;
-  DWORD error_code = success ? ERROR_SUCCESS : GetLastError();
-
-  if (success) {
-    EnterStateImmediately(IPC_SERVER_STATE_READING_ACK);
-  } else if (error_code == ERROR_IO_PENDING) {
-    EnterStateWhenSignaled(IPC_SERVER_STATE_READING_ACK);
-  } else {
-    EnterStateImmediately(IPC_SERVER_STATE_DISCONNECTING);
-  }
-}
-
-// When the server thread serving the clients is in the READING_ACK state,
-// try to get result of async read. Go into the DISCONNECTING state.
-void CrashGenerationServer::HandleReadingAckState() {
-  assert(server_state_ == IPC_SERVER_STATE_READING_ACK);
-
-  DWORD bytes_count = 0;
-  bool success = GetOverlappedResult(pipe_,
-                                     &overlapped_,
-                                     &bytes_count,
-                                     FALSE) != FALSE;
-  DWORD error_code = success ? ERROR_SUCCESS : GetLastError();
-
-  if (success) {
-    // The connection handshake with the client is now complete; perform
-    // the callback.
-    if (connect_callback_) {
-      connect_callback_(connect_context_, client_info_);
-    }
-  } else {
-    // We should never get an I/O incomplete since we should not execute this
-    // unless the Read has finished and the overlapped event is signaled. If
-    // we do get INCOMPLETE, we have a bug in our code.
-    assert(error_code != ERROR_IO_INCOMPLETE);
-  }
-
-  EnterStateImmediately(IPC_SERVER_STATE_DISCONNECTING);
-}
-
-// When the server thread serving the client is in the DISCONNECTING state,
-// disconnect from the pipe and reset the event. If anything fails, go into
-// the ERROR state. If it goes well, go into the INITIAL state and set the
-// event to start all over again.
-void CrashGenerationServer::HandleDisconnectingState() {
-  assert(server_state_ == IPC_SERVER_STATE_DISCONNECTING);
-
-  // Done serving the client.
-  client_info_ = NULL;
-
-  overlapped_.Internal = NULL;
-  overlapped_.InternalHigh = NULL;
-  overlapped_.Offset = 0;
-  overlapped_.OffsetHigh = 0;
-  overlapped_.Pointer = NULL;
-
-  if (!ResetEvent(overlapped_.hEvent)) {
-    EnterErrorState();
-    return;
-  }
-
-  if (!DisconnectNamedPipe(pipe_)) {
-    EnterErrorState();
-    return;
-  }
-
-  // If the server is shutting down do not connect to the
-  // next client.
-  if (shutting_down_) {
-    return;
-  }
-
-  EnterStateImmediately(IPC_SERVER_STATE_INITIAL);
-}
-
-void CrashGenerationServer::EnterErrorState() {
-  SetEvent(overlapped_.hEvent);
-  server_state_ = IPC_SERVER_STATE_ERROR;
-}
-
-void CrashGenerationServer::EnterStateWhenSignaled(IPCServerState state) {
-  server_state_ = state;
-}
-
-void CrashGenerationServer::EnterStateImmediately(IPCServerState state) {
-  server_state_ = state;
-
-  if (!SetEvent(overlapped_.hEvent)) {
-    server_state_ = IPC_SERVER_STATE_ERROR;
-  }
-}
-
-bool CrashGenerationServer::PrepareReply(const ClientInfo& client_info,
-                                         ProtocolMessage* reply) const {
-  reply->tag = MESSAGE_TAG_REGISTRATION_RESPONSE;
-  reply->pid = GetCurrentProcessId();
-
-  if (CreateClientHandles(client_info, reply)) {
-    return true;
-  }
-
-  if (reply->dump_request_handle) {
-    CloseHandle(reply->dump_request_handle);
-  }
-
-  if (reply->dump_generated_handle) {
-    CloseHandle(reply->dump_generated_handle);
-  }
-
-  if (reply->server_alive_handle) {
-    CloseHandle(reply->server_alive_handle);
-  }
-
-  return false;
-}
-
-bool CrashGenerationServer::CreateClientHandles(const ClientInfo& client_info,
-                                                ProtocolMessage* reply) const {
-  HANDLE current_process = GetCurrentProcess();
-  if (!DuplicateHandle(current_process,
-                       client_info.dump_requested_handle(),
-                       client_info.process_handle(),
-                       &reply->dump_request_handle,
-                       kDumpRequestEventAccess,
-                       FALSE,
-                       0)) {
-    return false;
-  }
-
-  if (!DuplicateHandle(current_process,
-                       client_info.dump_generated_handle(),
-                       client_info.process_handle(),
-                       &reply->dump_generated_handle,
-                       kDumpGeneratedEventAccess,
-                       FALSE,
-                       0)) {
-    return false;
-  }
-
-  if (!DuplicateHandle(current_process,
-                       server_alive_handle_,
-                       client_info.process_handle(),
-                       &reply->server_alive_handle,
-                       kMutexAccess,
-                       FALSE,
-                       0)) {
-    return false;
-  }
-
-  return true;
-}
-
-bool CrashGenerationServer::RespondToClient(ClientInfo* client_info) {
-  ProtocolMessage reply;
-  if (!PrepareReply(*client_info, &reply)) {
-    return false;
-  }
-
-  DWORD bytes_count = 0;
-  bool success = WriteFile(pipe_,
-                            &reply,
-                            sizeof(reply),
-                            &bytes_count,
-                            &overlapped_) != FALSE;
-  DWORD error_code = success ? ERROR_SUCCESS : GetLastError();
-
-  if (!success && error_code != ERROR_IO_PENDING) {
-    return false;
-  }
-
-  // Takes over ownership of client_info. We MUST return true if AddClient
-  // succeeds.
-  if (!AddClient(client_info)) {
-    return false;
-  }
-
-  return true;
-}
-
-// The server thread servicing the clients runs this method. The method
-// implements the state machine described in ReadMe.txt along with the
-// helper methods HandleXXXState.
-void CrashGenerationServer::HandleConnectionRequest() {
-  // If we are shutting doen then get into ERROR state, reset the event so more
-  // workers don't run and return immediately.
-  if (shutting_down_) {
-    server_state_ = IPC_SERVER_STATE_ERROR;
-    ResetEvent(overlapped_.hEvent);
-    return;
-  }
-
-  switch (server_state_) {
-    case IPC_SERVER_STATE_ERROR:
-      HandleErrorState();
-      break;
-
-    case IPC_SERVER_STATE_INITIAL:
-      HandleInitialState();
-      break;
-
-    case IPC_SERVER_STATE_CONNECTING:
-      HandleConnectingState();
-      break;
-
-    case IPC_SERVER_STATE_CONNECTED:
-      HandleConnectedState();
-      break;
-
-    case IPC_SERVER_STATE_READING:
-      HandleReadingState();
-      break;
-
-    case IPC_SERVER_STATE_READ_DONE:
-      HandleReadDoneState();
-      break;
-
-    case IPC_SERVER_STATE_WRITING:
-      HandleWritingState();
-      break;
-
-    case IPC_SERVER_STATE_WRITE_DONE:
-      HandleWriteDoneState();
-      break;
-
-    case IPC_SERVER_STATE_READING_ACK:
-      HandleReadingAckState();
-      break;
-
-    case IPC_SERVER_STATE_DISCONNECTING:
-      HandleDisconnectingState();
-      break;
-
-    default:
-      assert(false);
-      // This indicates that we added one more state without
-      // adding handling code.
-      server_state_ = IPC_SERVER_STATE_ERROR;
-      break;
-  }
-}
-
-bool CrashGenerationServer::AddClient(ClientInfo* client_info) {
-  HANDLE request_wait_handle = NULL;
-  if (!RegisterWaitForSingleObject(&request_wait_handle,
-                                   client_info->dump_requested_handle(),
-                                   OnDumpRequest,
-                                   client_info,
-                                   INFINITE,
-                                   kDumpRequestThreadFlags)) {
-    return false;
-  }
-
-  client_info->set_dump_request_wait_handle(request_wait_handle);
-
-  // OnClientEnd will be called when the client process terminates.
-  HANDLE process_wait_handle = NULL;
-  if (!RegisterWaitForSingleObject(&process_wait_handle,
-                                   client_info->process_handle(),
-                                   OnClientEnd,
-                                   client_info,
-                                   INFINITE,
-                                   WT_EXECUTEONLYONCE)) {
-    return false;
-  }
-
-  client_info->set_process_exit_wait_handle(process_wait_handle);
-
-  // New scope to hold the lock for the shortest time.
-  {
-    AutoCriticalSection lock(&clients_sync_);
-    clients_.push_back(client_info);
-  }
-
-  return true;
-}
-
-// static
-void CALLBACK CrashGenerationServer::OnPipeConnected(void* context, BOOLEAN) {
-  assert(context);
-
-  CrashGenerationServer* obj =
-      reinterpret_cast<CrashGenerationServer*>(context);
-  obj->HandleConnectionRequest();
-}
-
-// static
-void CALLBACK CrashGenerationServer::OnDumpRequest(void* context, BOOLEAN) {
-  assert(context);
-  ClientInfo* client_info = reinterpret_cast<ClientInfo*>(context);
-  client_info->PopulateCustomInfo();
-
-  CrashGenerationServer* crash_server = client_info->crash_server();
-  assert(crash_server);
-  crash_server->HandleDumpRequest(*client_info);
-
-  ResetEvent(client_info->dump_requested_handle());
-}
-
-// static
-void CALLBACK CrashGenerationServer::OnClientEnd(void* context, BOOLEAN) {
-  assert(context);
-  ClientInfo* client_info = reinterpret_cast<ClientInfo*>(context);
-
-  CrashGenerationServer* crash_server = client_info->crash_server();
-  assert(crash_server);
-
-  InterlockedIncrement(&crash_server->cleanup_item_count_);
-
-  if (!QueueUserWorkItem(CleanupClient, context, WT_EXECUTEDEFAULT)) {
-    InterlockedDecrement(&crash_server->cleanup_item_count_);
-  }
-}
-
-// static
-DWORD WINAPI CrashGenerationServer::CleanupClient(void* context) {
-  assert(context);
-  ClientInfo* client_info = reinterpret_cast<ClientInfo*>(context);
-
-  CrashGenerationServer* crash_server = client_info->crash_server();
-  assert(crash_server);
-
-  if (crash_server->exit_callback_) {
-    crash_server->exit_callback_(crash_server->exit_context_, client_info);
-  }
-
-  crash_server->DoCleanup(client_info);
-
-  InterlockedDecrement(&crash_server->cleanup_item_count_);
-  return 0;
-}
-
-void CrashGenerationServer::DoCleanup(ClientInfo* client_info) {
-  assert(client_info);
-
-  // Start a new scope to release lock automatically.
-  {
-    AutoCriticalSection lock(&clients_sync_);
-    clients_.remove(client_info);
-  }
-
-  delete client_info;
-}
-
-void CrashGenerationServer::HandleDumpRequest(const ClientInfo& client_info) {
-  // Generate the dump only if it's explicitly requested by the
-  // server application; otherwise the server might want to generate
-  // dump in the callback.
-  std::wstring dump_path;
-  if (generate_dumps_) {
-    if (!GenerateDump(client_info, &dump_path)) {
-      return;
-    }
-  }
-
-  if (dump_callback_) {
-    std::wstring* ptr_dump_path = (dump_path == L"") ? NULL : &dump_path;
-    dump_callback_(dump_context_, &client_info, ptr_dump_path);
-  }
-
-  SetEvent(client_info.dump_generated_handle());
-}
-
-bool CrashGenerationServer::GenerateDump(const ClientInfo& client,
-                                         std::wstring* dump_path) {
-  assert(client.pid() != 0);
-  assert(client.process_handle());
-
-  // We have to get the address of EXCEPTION_INFORMATION from
-  // the client process address space.
-  EXCEPTION_POINTERS* client_ex_info = NULL;
-  if (!client.GetClientExceptionInfo(&client_ex_info)) {
-    return false;
-  }
-
-  DWORD client_thread_id = 0;
-  if (!client.GetClientThreadId(&client_thread_id)) {
-    return false;
-  }
-
-  return dump_generator_->WriteMinidump(client.process_handle(),
-                                        client.pid(),
-                                        client_thread_id,
-                                        GetCurrentThreadId(),
-                                        client_ex_info,
-                                        client.assert_info(),
-                                        client.dump_type(),
-                                        true,
-                                        dump_path);
-}
-
-}  // namespace google_breakpad
diff --git a/third_party/breakpad/src/client/windows/crash_generation/crash_generation_server.h b/third_party/breakpad/src/client/windows/crash_generation/crash_generation_server.h
deleted file mode 100644
index 31a353b..0000000
--- a/third_party/breakpad/src/client/windows/crash_generation/crash_generation_server.h
+++ /dev/null
@@ -1,288 +0,0 @@
-// Copyright (c) 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef CLIENT_WINDOWS_CRASH_GENERATION_CRASH_GENERATION_SERVER_H__
-#define CLIENT_WINDOWS_CRASH_GENERATION_CRASH_GENERATION_SERVER_H__
-
-#include <list>
-#include <string>
-#include "client/windows/common/ipc_protocol.h"
-#include "client/windows/crash_generation/minidump_generator.h"
-#include "processor/scoped_ptr.h"
-
-namespace google_breakpad {
-class ClientInfo;
-
-// Abstraction for server side implementation of out-of-process crash
-// generation protocol for Windows platform only. It generates Windows
-// minidump files for client processes that request dump generation. When
-// the server is requested to start listening for clients (by calling the
-// Start method), it creates a named pipe and waits for the clients to
-// register. In response, it hands them event handles that the client can
-// signal to request dump generation. When the clients request dump
-// generation in this way, the server generates Windows minidump files.
-class CrashGenerationServer {
- public:
-  typedef void (*OnClientConnectedCallback)(void* context,
-                                            const ClientInfo* client_info);
-
-  typedef void (*OnClientDumpRequestCallback)(void* context,
-                                              const ClientInfo* client_info,
-                                              const std::wstring* file_path);
-
-  typedef void (*OnClientExitedCallback)(void* context,
-                                         const ClientInfo* client_info);
-
-  // Creates an instance with the given parameters.
-  //
-  // Parameter pipe_name: Name of the Windows named pipe
-  // Parameter pipe_sec_attrs Security attributes to set on the pipe. Pass
-  //     NULL to use default security on the pipe. By default, the pipe created
-  //     allows Local System, Administrators and the Creator full control and
-  //     the Everyone group read access on the pipe.
-  // Parameter connect_callback: Callback for a new client connection.
-  // Parameter connect_context: Context for client connection callback.
-  // Parameter crash_callback: Callback for a client crash dump request.
-  // Parameter crash_context: Context for client crash dump request callback.
-  // Parameter exit_callback: Callback for client process exit.
-  // Parameter exit_context: Context for client exit callback.
-  // Parameter generate_dumps: Whether to automatically generate dumps.
-  // Client code of this class might want to generate dumps explicitly in the
-  // crash dump request callback. In that case, false can be passed for this
-  // parameter.
-  // Parameter dump_path: Path for generating dumps; required only if true is
-  // passed for generateDumps parameter; NULL can be passed otherwise.
-  CrashGenerationServer(const std::wstring& pipe_name,
-                        SECURITY_ATTRIBUTES* pipe_sec_attrs,
-                        OnClientConnectedCallback connect_callback,
-                        void* connect_context,
-                        OnClientDumpRequestCallback dump_callback,
-                        void* dump_context,
-                        OnClientExitedCallback exit_callback,
-                        void* exit_context,
-                        bool generate_dumps,
-                        const std::wstring* dump_path);
-
-  ~CrashGenerationServer();
-
-  // Performs initialization steps needed to start listening to clients. Upon
-  // successful return clients may connect to this server's pipe.
-  //
-  // Returns true if initialization is successful; false otherwise.
-  bool Start();
-
- private:
-  // Various states the client can be in during the handshake with
-  // the server.
-  enum IPCServerState {
-    // Server starts in this state.
-    IPC_SERVER_STATE_UNINITIALIZED,
-
-    // Server is in error state and it cannot serve any clients.
-    IPC_SERVER_STATE_ERROR,
-
-    // Server starts in this state.
-    IPC_SERVER_STATE_INITIAL,
-
-    // Server has issued an async connect to the pipe and it is waiting
-    // for the connection to be established.
-    IPC_SERVER_STATE_CONNECTING,
-
-    // Server is connected successfully.
-    IPC_SERVER_STATE_CONNECTED,
-
-    // Server has issued an async read from the pipe and it is waiting for
-    // the read to finish.
-    IPC_SERVER_STATE_READING,
-
-    // Server is done reading from the pipe.
-    IPC_SERVER_STATE_READ_DONE,
-
-    // Server has issued an async write to the pipe and it is waiting for
-    // the write to finish.
-    IPC_SERVER_STATE_WRITING,
-
-    // Server is done writing to the pipe.
-    IPC_SERVER_STATE_WRITE_DONE,
-
-    // Server has issued an async read from the pipe for an ack and it
-    // is waiting for the read to finish.
-    IPC_SERVER_STATE_READING_ACK,
-
-    // Server is done writing to the pipe and it is now ready to disconnect
-    // and reconnect.
-    IPC_SERVER_STATE_DISCONNECTING
-  };
-
-  //
-  // Helper methods to handle various server IPC states.
-  //
-  void HandleErrorState();
-  void HandleInitialState();
-  void HandleConnectingState();
-  void HandleConnectedState();
-  void HandleReadingState();
-  void HandleReadDoneState();
-  void HandleWritingState();
-  void HandleWriteDoneState();
-  void HandleReadingAckState();
-  void HandleDisconnectingState();
-
-  // Prepares reply for a client from the given parameters.
-  bool PrepareReply(const ClientInfo& client_info,
-                    ProtocolMessage* reply) const;
-
-  // Duplicates various handles in the ClientInfo object for the client
-  // process and stores them in the given ProtocolMessage instance. If
-  // creating any handle fails, ProtocolMessage will contain the handles
-  // already created successfully, which should be closed by the caller.
-  bool CreateClientHandles(const ClientInfo& client_info,
-                           ProtocolMessage* reply) const;
-
-  // Response to the given client. Return true if all steps of
-  // responding to the client succeed, false otherwise.
-  bool RespondToClient(ClientInfo* client_info);
-
-  // Handles a connection request from the client.
-  void HandleConnectionRequest();
-
-  // Handles a dump request from the client.
-  void HandleDumpRequest(const ClientInfo& client_info);
-
-  // Callback for pipe connected event.
-  static void CALLBACK OnPipeConnected(void* context, BOOLEAN timer_or_wait);
-
-  // Callback for a dump request.
-  static void CALLBACK OnDumpRequest(void* context, BOOLEAN timer_or_wait);
-
-  // Callback for client process exit event.
-  static void CALLBACK OnClientEnd(void* context, BOOLEAN timer_or_wait);
-
-  // Releases resources for a client.
-  static DWORD WINAPI CleanupClient(void* context);
-
-  // Cleans up for the given client.
-  void DoCleanup(ClientInfo* client_info);
-
-  // Adds the given client to the list of registered clients.
-  bool AddClient(ClientInfo* client_info);
-
-  // Generates dump for the given client.
-  bool GenerateDump(const ClientInfo& client, std::wstring* dump_path);
-
-  // Puts the server in a permanent error state and sets a signal such that
-  // the state will be immediately entered after the current state transition
-  // is complete.
-  void EnterErrorState();
-
-  // Puts the server in the specified state and sets a signal such that the
-  // state is immediately entered after the current state transition is
-  // complete.
-  void EnterStateImmediately(IPCServerState state);
-
-  // Puts the server in the specified state. No signal will be set, so the state
-  // transition will only occur when signaled manually or by completion of an
-  // asynchronous IO operation.
-  void EnterStateWhenSignaled(IPCServerState state);
-
-  // Sync object for thread-safe access to the shared list of clients.
-  CRITICAL_SECTION clients_sync_;
-
-  // List of clients.
-  std::list<ClientInfo*> clients_;
-
-  // Pipe name.
-  std::wstring pipe_name_;
-
-  // Pipe security attributes
-  SECURITY_ATTRIBUTES* pipe_sec_attrs_;
-
-  // Handle to the pipe used for handshake with clients.
-  HANDLE pipe_;
-
-  // Pipe wait handle.
-  HANDLE pipe_wait_handle_;
-
-  // Handle to server-alive mutex.
-  HANDLE server_alive_handle_;
-
-  // Callback for a successful client connection.
-  OnClientConnectedCallback connect_callback_;
-
-  // Context for client connected callback.
-  void* connect_context_;
-
-  // Callback for a client dump request.
-  OnClientDumpRequestCallback dump_callback_;
-
-  // Context for client dump request callback.
-  void* dump_context_;
-
-  // Callback for client process exit.
-  OnClientExitedCallback exit_callback_;
-
-  // Context for client process exit callback.
-  void* exit_context_;
-
-  // Whether to generate dumps.
-  bool generate_dumps_;
-
-  // Instance of a mini dump generator.
-  scoped_ptr<MinidumpGenerator> dump_generator_;
-
-  // State of the server in performing the IPC with the client.
-  // Note that since we restrict the pipe to one instance, we
-  // only need to keep one state of the server. Otherwise, server
-  // would have one state per client it is talking to.
-  volatile IPCServerState server_state_;
-
-  // Whether the server is shutting down.
-  volatile bool shutting_down_;
-
-  // Overlapped instance for async I/O on the pipe.
-  OVERLAPPED overlapped_;
-
-  // Message object used in IPC with the client.
-  ProtocolMessage msg_;
-
-  // Client Info for the client that's connecting to the server.
-  ClientInfo* client_info_;
-
-  // Count of clean-up work items that are currently running or are
-  // already queued to run.
-  volatile LONG cleanup_item_count_;
-
-  // Disable copy ctor and operator=.
-  CrashGenerationServer(const CrashGenerationServer& crash_server);
-  CrashGenerationServer& operator=(const CrashGenerationServer& crash_server);
-};
-
-}  // namespace google_breakpad
-
-#endif  // CLIENT_WINDOWS_CRASH_GENERATION_CRASH_GENERATION_SERVER_H__
diff --git a/third_party/breakpad/src/client/windows/crash_generation/minidump_generator.cc b/third_party/breakpad/src/client/windows/crash_generation/minidump_generator.cc
deleted file mode 100644
index 37bd55e..0000000
--- a/third_party/breakpad/src/client/windows/crash_generation/minidump_generator.cc
+++ /dev/null
@@ -1,309 +0,0 @@
-// Copyright (c) 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include "client/windows/crash_generation/minidump_generator.h"
-#include <cassert>
-#include "client/windows/common/auto_critical_section.h"
-#include "common/windows/guid_string.h"
-
-using std::wstring;
-
-namespace google_breakpad {
-
-MinidumpGenerator::MinidumpGenerator(const wstring& dump_path)
-    : dbghelp_module_(NULL),
-      rpcrt4_module_(NULL),
-      dump_path_(dump_path),
-      write_dump_(NULL),
-      create_uuid_(NULL) {
-  InitializeCriticalSection(&module_load_sync_);
-  InitializeCriticalSection(&get_proc_address_sync_);
-}
-
-MinidumpGenerator::~MinidumpGenerator() {
-  if (dbghelp_module_) {
-    FreeLibrary(dbghelp_module_);
-  }
-
-  if (rpcrt4_module_) {
-    FreeLibrary(rpcrt4_module_);
-  }
-
-  DeleteCriticalSection(&get_proc_address_sync_);
-  DeleteCriticalSection(&module_load_sync_);
-}
-
-bool MinidumpGenerator::WriteMinidump(HANDLE process_handle,
-                                      DWORD process_id,
-                                      DWORD thread_id,
-                                      DWORD requesting_thread_id,
-                                      EXCEPTION_POINTERS* exception_pointers,
-                                      MDRawAssertionInfo* assert_info,
-                                      MINIDUMP_TYPE dump_type,
-                                      bool is_client_pointers,
-                                      wstring* dump_path) {
-  // Just call the full WriteMinidump with NULL as the full_dump_path.
-  return this->WriteMinidump(process_handle, process_id, thread_id,
-                             requesting_thread_id, exception_pointers,
-                             assert_info, dump_type, is_client_pointers,
-                             dump_path, NULL);
-}
-
-bool MinidumpGenerator::WriteMinidump(HANDLE process_handle,
-                                      DWORD process_id,
-                                      DWORD thread_id,
-                                      DWORD requesting_thread_id,
-                                      EXCEPTION_POINTERS* exception_pointers,
-                                      MDRawAssertionInfo* assert_info,
-                                      MINIDUMP_TYPE dump_type,
-                                      bool is_client_pointers,
-                                      wstring* dump_path,
-                                      wstring* full_dump_path) {
-  MiniDumpWriteDumpType write_dump = GetWriteDump();
-  if (!write_dump) {
-    return false;
-  }
-
-  wstring dump_file_path;
-  if (!GenerateDumpFilePath(&dump_file_path)) {
-    return false;
-  }
-
-  // If the client requests a full memory dump, we will write a normal mini
-  // dump and a full memory dump. Both dump files use the same uuid as file
-  // name prefix.
-  bool full_memory_dump = (dump_type & MiniDumpWithFullMemory) != 0;
-  wstring full_dump_file_path;
-  if (full_memory_dump) {
-    full_dump_file_path.assign(dump_file_path);
-    full_dump_file_path.resize(full_dump_file_path.size() - 4);  // strip .dmp
-    full_dump_file_path.append(TEXT("-full.dmp"));
-  }
-
-  HANDLE dump_file = CreateFile(dump_file_path.c_str(),
-                                GENERIC_WRITE,
-                                0,
-                                NULL,
-                                CREATE_NEW,
-                                FILE_ATTRIBUTE_NORMAL,
-                                NULL);
-
-  if (dump_file == INVALID_HANDLE_VALUE) {
-    return false;
-  }
-
-  HANDLE full_dump_file = INVALID_HANDLE_VALUE;
-  if (full_memory_dump) {
-    full_dump_file = CreateFile(full_dump_file_path.c_str(),
-                                GENERIC_WRITE,
-                                0,
-                                NULL,
-                                CREATE_NEW,
-                                FILE_ATTRIBUTE_NORMAL,
-                                NULL);
-
-    if (full_dump_file == INVALID_HANDLE_VALUE) {
-      CloseHandle(dump_file);
-      return false;
-    }
-  }
-
-  MINIDUMP_EXCEPTION_INFORMATION* dump_exception_pointers = NULL;
-  MINIDUMP_EXCEPTION_INFORMATION dump_exception_info;
-
-  // Setup the exception information object only if it's a dump
-  // due to an exception.
-  if (exception_pointers) {
-    dump_exception_pointers = &dump_exception_info;
-    dump_exception_info.ThreadId = thread_id;
-    dump_exception_info.ExceptionPointers = exception_pointers;
-    dump_exception_info.ClientPointers = is_client_pointers;
-  }
-
-  // Add an MDRawBreakpadInfo stream to the minidump, to provide additional
-  // information about the exception handler to the Breakpad processor.
-  // The information will help the processor determine which threads are
-  // relevant. The Breakpad processor does not require this information but
-  // can function better with Breakpad-generated dumps when it is present.
-  // The native debugger is not harmed by the presence of this information.
-  MDRawBreakpadInfo breakpad_info = {0};
-  if (!is_client_pointers) {
-    // Set the dump thread id and requesting thread id only in case of
-    // in-process dump generation.
-    breakpad_info.validity = MD_BREAKPAD_INFO_VALID_DUMP_THREAD_ID |
-                             MD_BREAKPAD_INFO_VALID_REQUESTING_THREAD_ID;
-    breakpad_info.dump_thread_id = thread_id;
-    breakpad_info.requesting_thread_id = requesting_thread_id;
-  }
-
-  // Leave room in user_stream_array for a possible assertion info stream.
-  MINIDUMP_USER_STREAM user_stream_array[2];
-  user_stream_array[0].Type = MD_BREAKPAD_INFO_STREAM;
-  user_stream_array[0].BufferSize = sizeof(breakpad_info);
-  user_stream_array[0].Buffer = &breakpad_info;
-
-  MINIDUMP_USER_STREAM_INFORMATION user_streams;
-  user_streams.UserStreamCount = 1;
-  user_streams.UserStreamArray = user_stream_array;
-
-  MDRawAssertionInfo* actual_assert_info = assert_info;
-  MDRawAssertionInfo client_assert_info = {0};
-
-  if (assert_info) {
-    // If the assertion info object lives in the client process,
-    // read the memory of the client process.
-    if (is_client_pointers) {
-      SIZE_T bytes_read = 0;
-      if (!ReadProcessMemory(process_handle,
-                             assert_info,
-                             &client_assert_info,
-                             sizeof(client_assert_info),
-                             &bytes_read)) {
-        CloseHandle(dump_file);
-        if (full_dump_file != INVALID_HANDLE_VALUE)
-          CloseHandle(full_dump_file);
-        return false;
-      }
-
-      if (bytes_read != sizeof(client_assert_info)) {
-        CloseHandle(dump_file);
-        if (full_dump_file != INVALID_HANDLE_VALUE)
-          CloseHandle(full_dump_file);
-        return false;
-      }
-
-      actual_assert_info  = &client_assert_info;
-    }
-
-    user_stream_array[1].Type = MD_ASSERTION_INFO_STREAM;
-    user_stream_array[1].BufferSize = sizeof(MDRawAssertionInfo);
-    user_stream_array[1].Buffer = actual_assert_info;
-    ++user_streams.UserStreamCount;
-  }
-
-  bool result_minidump = write_dump(
-      process_handle,
-      process_id,
-      dump_file,
-      static_cast<MINIDUMP_TYPE>((dump_type & (~MiniDumpWithFullMemory))
-                                  | MiniDumpNormal),
-      exception_pointers ? &dump_exception_info : NULL,
-      &user_streams,
-      NULL) != FALSE;
-
-  bool result_full_memory = true;
-  if (full_memory_dump) {
-    result_full_memory = write_dump(
-        process_handle,
-        process_id,
-        full_dump_file,
-        static_cast<MINIDUMP_TYPE>(dump_type & (~MiniDumpNormal)),
-        exception_pointers ? &dump_exception_info : NULL,
-        &user_streams,
-        NULL) != FALSE;
-  }
-
-  bool result = result_minidump && result_full_memory;
-
-  CloseHandle(dump_file);
-  if (full_dump_file != INVALID_HANDLE_VALUE)
-    CloseHandle(full_dump_file);
-
-  // Store the path of the dump file in the out parameter if dump generation
-  // succeeded.
-  if (result && dump_path) {
-    *dump_path = dump_file_path;
-  }
-  if (result && full_memory_dump && full_dump_path) {
-    *full_dump_path = full_dump_file_path;
-  }
-
-  return result;
-}
-
-HMODULE MinidumpGenerator::GetDbghelpModule() {
-  AutoCriticalSection lock(&module_load_sync_);
-  if (!dbghelp_module_) {
-    dbghelp_module_ = LoadLibrary(TEXT("dbghelp.dll"));
-  }
-
-  return dbghelp_module_;
-}
-
-MinidumpGenerator::MiniDumpWriteDumpType MinidumpGenerator::GetWriteDump() {
-  AutoCriticalSection lock(&get_proc_address_sync_);
-  if (!write_dump_) {
-    HMODULE module = GetDbghelpModule();
-    if (module) {
-      FARPROC proc = GetProcAddress(module, "MiniDumpWriteDump");
-      write_dump_ = reinterpret_cast<MiniDumpWriteDumpType>(proc);
-    }
-  }
-
-  return write_dump_;
-}
-
-HMODULE MinidumpGenerator::GetRpcrt4Module() {
-  AutoCriticalSection lock(&module_load_sync_);
-  if (!rpcrt4_module_) {
-    rpcrt4_module_ = LoadLibrary(TEXT("rpcrt4.dll"));
-  }
-
-  return rpcrt4_module_;
-}
-
-MinidumpGenerator::UuidCreateType MinidumpGenerator::GetCreateUuid() {
-  AutoCriticalSection lock(&module_load_sync_);
-  if (!create_uuid_) {
-    HMODULE module = GetRpcrt4Module();
-    if (module) {
-      FARPROC proc = GetProcAddress(module, "UuidCreate");
-      create_uuid_ = reinterpret_cast<UuidCreateType>(proc);
-    }
-  }
-
-  return create_uuid_;
-}
-
-bool MinidumpGenerator::GenerateDumpFilePath(wstring* file_path) {
-  UUID id = {0};
-
-  UuidCreateType create_uuid = GetCreateUuid();
-  if (!create_uuid) {
-    return false;
-  }
-
-  create_uuid(&id);
-  wstring id_str = GUIDString::GUIDToWString(&id);
-
-  *file_path = dump_path_ + TEXT("\\") + id_str + TEXT(".dmp");
-  return true;
-}
-
-}  // namespace google_breakpad
diff --git a/third_party/breakpad/src/client/windows/crash_generation/minidump_generator.h b/third_party/breakpad/src/client/windows/crash_generation/minidump_generator.h
deleted file mode 100644
index 5f9e4b5..0000000
--- a/third_party/breakpad/src/client/windows/crash_generation/minidump_generator.h
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright (c) 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef CLIENT_WINDOWS_CRASH_GENERATION_MINIDUMP_GENERATOR_H_
-#define CLIENT_WINDOWS_CRASH_GENERATION_MINIDUMP_GENERATOR_H_
-
-#include <windows.h>
-#include <dbghelp.h>
-#include <list>
-#include "google_breakpad/common/minidump_format.h"
-
-namespace google_breakpad {
-
-// Abstraction for various objects and operations needed to generate
-// minidump on Windows. This abstraction is useful to hide all the gory
-// details for minidump generation and provide a clean interface to
-// the clients to generate minidumps.
-class MinidumpGenerator {
- public:
-  // Creates an instance with the given dump path.
-  explicit MinidumpGenerator(const std::wstring& dump_path);
-
-  ~MinidumpGenerator();
-
-  // Writes the minidump with the given parameters. Stores the
-  // dump file path in the dump_path parameter if dump generation
-  // succeeds.
-  bool WriteMinidump(HANDLE process_handle,
-                     DWORD process_id,
-                     DWORD thread_id,
-                     DWORD requesting_thread_id,
-                     EXCEPTION_POINTERS* exception_pointers,
-                     MDRawAssertionInfo* assert_info,
-                     MINIDUMP_TYPE dump_type,
-                     bool is_client_pointers,
-                     std::wstring* dump_path);
-
-  // Writes the minidump with the given parameters. Stores the dump file
-  // path in the dump_path (and full_dump_path) parameter if dump
-  // generation succeeds. full_dump_path and dump_path can be NULL.
-  bool WriteMinidump(HANDLE process_handle,
-                     DWORD process_id,
-                     DWORD thread_id,
-                     DWORD requesting_thread_id,
-                     EXCEPTION_POINTERS* exception_pointers,
-                     MDRawAssertionInfo* assert_info,
-                     MINIDUMP_TYPE dump_type,
-                     bool is_client_pointers,
-                     std::wstring* dump_path,
-                     std::wstring* full_dump_path);
-
- private:
-  // Function pointer type for MiniDumpWriteDump, which is looked up
-  // dynamically.
-  typedef BOOL (WINAPI* MiniDumpWriteDumpType)(
-      HANDLE hProcess,
-      DWORD ProcessId,
-      HANDLE hFile,
-      MINIDUMP_TYPE DumpType,
-      CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
-      CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
-      CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam);
-
-  // Function pointer type for UuidCreate, which is looked up dynamically.
-  typedef RPC_STATUS (RPC_ENTRY* UuidCreateType)(UUID* Uuid);
-
-  // Loads the appropriate DLL lazily in a thread safe way.
-  HMODULE GetDbghelpModule();
-
-  // Loads the appropriate DLL and gets a pointer to the MiniDumpWriteDump
-  // function lazily and in a thread-safe manner.
-  MiniDumpWriteDumpType GetWriteDump();
-
-  // Loads the appropriate DLL lazily in a thread safe way.
-  HMODULE GetRpcrt4Module();
-
-  // Loads the appropriate DLL and gets a pointer to the UuidCreate
-  // function lazily and in a thread-safe manner.
-  UuidCreateType GetCreateUuid();
-
-  // Returns the path for the file to write dump to.
-  bool GenerateDumpFilePath(std::wstring* file_path);
-
-  // Handle to dynamically loaded DbgHelp.dll.
-  HMODULE dbghelp_module_;
-
-  // Pointer to the MiniDumpWriteDump function.
-  MiniDumpWriteDumpType write_dump_;
-
-  // Handle to dynamically loaded rpcrt4.dll.
-  HMODULE rpcrt4_module_;
-
-  // Pointer to the UuidCreate function.
-  UuidCreateType create_uuid_;
-
-  // Folder path to store dump files.
-  std::wstring dump_path_;
-
-  // Critical section to sychronize action of loading modules dynamically.
-  CRITICAL_SECTION module_load_sync_;
-
-  // Critical section to synchronize action of dynamically getting function
-  // addresses from modules.
-  CRITICAL_SECTION get_proc_address_sync_;
-};
-
-}  // namespace google_breakpad
-
-#endif  // CLIENT_WINDOWS_CRASH_GENERATION_MINIDUMP_GENERATOR_H_
diff --git a/third_party/breakpad/src/client/windows/handler/exception_handler.cc b/third_party/breakpad/src/client/windows/handler/exception_handler.cc
deleted file mode 100644
index ec5397d..0000000
--- a/third_party/breakpad/src/client/windows/handler/exception_handler.cc
+++ /dev/null
@@ -1,898 +0,0 @@
-// Copyright (c) 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include <ObjBase.h>
-
-#include <algorithm>
-#include <cassert>
-#include <cstdio>
-
-#include "common/windows/string_utils-inl.h"
-
-#include "client/windows/common/ipc_protocol.h"
-#include "client/windows/handler/exception_handler.h"
-#include "common/windows/guid_string.h"
-
-typedef VOID (WINAPI *RtlCaptureContextPtr) (PCONTEXT pContextRecord);
-
-namespace google_breakpad {
-
-static const int kWaitForHandlerThreadMs = 60000;
-static const int kExceptionHandlerThreadInitialStackSize = 64 * 1024;
-
-// This is passed as the context to the MinidumpWriteDump callback.
-typedef struct {
-  ULONG64 memory_base;
-  ULONG memory_size;
-  bool finished;
-} MinidumpCallbackContext;
-
-vector<ExceptionHandler*>* ExceptionHandler::handler_stack_ = NULL;
-LONG ExceptionHandler::handler_stack_index_ = 0;
-CRITICAL_SECTION ExceptionHandler::handler_stack_critical_section_;
-volatile LONG ExceptionHandler::instance_count_ = 0;
-
-ExceptionHandler::ExceptionHandler(const wstring& dump_path,
-                                   FilterCallback filter,
-                                   MinidumpCallback callback,
-                                   void* callback_context,
-                                   int handler_types,
-                                   MINIDUMP_TYPE dump_type,
-                                   const wchar_t* pipe_name,
-                                   const CustomClientInfo* custom_info) {
-  Initialize(dump_path,
-             filter,
-             callback,
-             callback_context,
-             handler_types,
-             dump_type,
-             pipe_name,
-             custom_info);
-}
-
-ExceptionHandler::ExceptionHandler(const wstring &dump_path,
-                                   FilterCallback filter,
-                                   MinidumpCallback callback,
-                                   void* callback_context,
-                                   int handler_types) {
-  Initialize(dump_path,
-             filter,
-             callback,
-             callback_context,
-             handler_types,
-             MiniDumpNormal,
-             NULL,
-             NULL);
-}
-
-void ExceptionHandler::Initialize(const wstring& dump_path,
-                                  FilterCallback filter,
-                                  MinidumpCallback callback,
-                                  void* callback_context,
-                                  int handler_types,
-                                  MINIDUMP_TYPE dump_type,
-                                  const wchar_t* pipe_name,
-                                  const CustomClientInfo* custom_info) {
-  LONG instance_count = InterlockedIncrement(&instance_count_);
-  filter_ = filter;
-  callback_ = callback;
-  callback_context_ = callback_context;
-  dump_path_c_ = NULL;
-  next_minidump_id_c_ = NULL;
-  next_minidump_path_c_ = NULL;
-  dbghelp_module_ = NULL;
-  minidump_write_dump_ = NULL;
-  dump_type_ = dump_type;
-  rpcrt4_module_ = NULL;
-  uuid_create_ = NULL;
-  handler_types_ = handler_types;
-  previous_filter_ = NULL;
-#if _MSC_VER >= 1400  // MSVC 2005/8
-  previous_iph_ = NULL;
-#endif  // _MSC_VER >= 1400
-  previous_pch_ = NULL;
-  handler_thread_ = NULL;
-  is_shutdown_ = false;
-  handler_start_semaphore_ = NULL;
-  handler_finish_semaphore_ = NULL;
-  requesting_thread_id_ = 0;
-  exception_info_ = NULL;
-  assertion_ = NULL;
-  handler_return_value_ = false;
-  handle_debug_exceptions_ = false;
-
-  // Attempt to use out-of-process if user has specified pipe name.
-  if (pipe_name != NULL) {
-    scoped_ptr<CrashGenerationClient> client(
-        new CrashGenerationClient(pipe_name,
-                                  dump_type_,
-                                  custom_info));
-
-    // If successful in registering with the monitoring process,
-    // there is no need to setup in-process crash generation.
-    if (client->Register()) {
-      crash_generation_client_.reset(client.release());
-    }
-  }
-
-  if (!IsOutOfProcess()) {
-    // Either client did not ask for out-of-process crash generation
-    // or registration with the server process failed. In either case,
-    // setup to do in-process crash generation.
-
-    // Set synchronization primitives and the handler thread.  Each
-    // ExceptionHandler object gets its own handler thread because that's the
-    // only way to reliably guarantee sufficient stack space in an exception,
-    // and it allows an easy way to get a snapshot of the requesting thread's
-    // context outside of an exception.
-    InitializeCriticalSection(&handler_critical_section_);
-    handler_start_semaphore_ = CreateSemaphore(NULL, 0, 1, NULL);
-    assert(handler_start_semaphore_ != NULL);
-
-    handler_finish_semaphore_ = CreateSemaphore(NULL, 0, 1, NULL);
-    assert(handler_finish_semaphore_ != NULL);
-
-    // Don't attempt to create the thread if we could not create the semaphores.
-    if (handler_finish_semaphore_ != NULL && handler_start_semaphore_ != NULL) {
-      DWORD thread_id;
-      handler_thread_ = CreateThread(NULL,         // lpThreadAttributes
-                                     kExceptionHandlerThreadInitialStackSize,
-                                     ExceptionHandlerThreadMain,
-                                     this,         // lpParameter
-                                     0,            // dwCreationFlags
-                                     &thread_id);
-      assert(handler_thread_ != NULL);
-    }
-
-    dbghelp_module_ = LoadLibrary(L"dbghelp.dll");
-    if (dbghelp_module_) {
-      minidump_write_dump_ = reinterpret_cast<MiniDumpWriteDump_type>(
-          GetProcAddress(dbghelp_module_, "MiniDumpWriteDump"));
-    }
-
-    // Load this library dynamically to not affect existing projects.  Most
-    // projects don't link against this directly, it's usually dynamically
-    // loaded by dependent code.
-    rpcrt4_module_ = LoadLibrary(L"rpcrt4.dll");
-    if (rpcrt4_module_) {
-      uuid_create_ = reinterpret_cast<UuidCreate_type>(
-          GetProcAddress(rpcrt4_module_, "UuidCreate"));
-    }
-
-    // set_dump_path calls UpdateNextID.  This sets up all of the path and id
-    // strings, and their equivalent c_str pointers.
-    set_dump_path(dump_path);
-  }
-
-  // There is a race condition here. If the first instance has not yet
-  // initialized the critical section, the second (and later) instances may
-  // try to use uninitialized critical section object. The feature of multiple
-  // instances in one module is not used much, so leave it as is for now.
-  // One way to solve this in the current design (that is, keeping the static
-  // handler stack) is to use spin locks with volatile bools to synchronize
-  // the handler stack. This works only if the compiler guarantees to generate
-  // cache coherent code for volatile.
-  // TODO(munjal): Fix this in a better way by changing the design if possible.
-
-  // Lazy initialization of the handler_stack_critical_section_
-  if (instance_count == 1) {
-    InitializeCriticalSection(&handler_stack_critical_section_);
-  }
-
-  if (handler_types != HANDLER_NONE) {
-    EnterCriticalSection(&handler_stack_critical_section_);
-
-    // The first time an ExceptionHandler that installs a handler is
-    // created, set up the handler stack.
-    if (!handler_stack_) {
-      handler_stack_ = new vector<ExceptionHandler*>();
-    }
-    handler_stack_->push_back(this);
-
-    if (handler_types & HANDLER_EXCEPTION)
-      previous_filter_ = SetUnhandledExceptionFilter(HandleException);
-
-#if _MSC_VER >= 1400  // MSVC 2005/8
-    if (handler_types & HANDLER_INVALID_PARAMETER)
-      previous_iph_ = _set_invalid_parameter_handler(HandleInvalidParameter);
-#endif  // _MSC_VER >= 1400
-
-    if (handler_types & HANDLER_PURECALL)
-      previous_pch_ = _set_purecall_handler(HandlePureVirtualCall);
-
-    LeaveCriticalSection(&handler_stack_critical_section_);
-  }
-}
-
-ExceptionHandler::~ExceptionHandler() {
-  if (dbghelp_module_) {
-    FreeLibrary(dbghelp_module_);
-  }
-
-  if (rpcrt4_module_) {
-    FreeLibrary(rpcrt4_module_);
-  }
-
-  if (handler_types_ != HANDLER_NONE) {
-    EnterCriticalSection(&handler_stack_critical_section_);
-
-    if (handler_types_ & HANDLER_EXCEPTION)
-      SetUnhandledExceptionFilter(previous_filter_);
-
-#if _MSC_VER >= 1400  // MSVC 2005/8
-    if (handler_types_ & HANDLER_INVALID_PARAMETER)
-      _set_invalid_parameter_handler(previous_iph_);
-#endif  // _MSC_VER >= 1400
-
-    if (handler_types_ & HANDLER_PURECALL)
-      _set_purecall_handler(previous_pch_);
-
-    if (handler_stack_->back() == this) {
-      handler_stack_->pop_back();
-    } else {
-      // TODO(mmentovai): use advapi32!ReportEvent to log the warning to the
-      // system's application event log.
-      fprintf(stderr, "warning: removing Breakpad handler out of order\n");
-      vector<ExceptionHandler*>::iterator iterator = handler_stack_->begin();
-      while (iterator != handler_stack_->end()) {
-        if (*iterator == this) {
-          iterator = handler_stack_->erase(iterator);
-        } else {
-          ++iterator;
-        }
-      }
-    }
-
-    if (handler_stack_->empty()) {
-      // When destroying the last ExceptionHandler that installed a handler,
-      // clean up the handler stack.
-      delete handler_stack_;
-      handler_stack_ = NULL;
-    }
-
-    LeaveCriticalSection(&handler_stack_critical_section_);
-  }
-
-  // Some of the objects were only initialized if out of process
-  // registration was not done.
-  if (!IsOutOfProcess()) {
-#ifdef BREAKPAD_NO_TERMINATE_THREAD
-    // Clean up the handler thread and synchronization primitives. The handler
-    // thread is either waiting on the semaphore to handle a crash or it is
-    // handling a crash. Coming out of the wait is fast but wait more in the
-    // eventuality a crash is handled.  This compilation option results in a
-    // deadlock if the exception handler is destroyed while executing code
-    // inside DllMain.
-    is_shutdown_ = true;
-    ReleaseSemaphore(handler_start_semaphore_, 1, NULL);
-    WaitForSingleObject(handler_thread_, kWaitForHandlerThreadMs);
-#else
-    TerminateThread(handler_thread_, 1);
-#endif  // BREAKPAD_NO_TERMINATE_THREAD
-
-    CloseHandle(handler_thread_);
-    handler_thread_ = NULL;
-    DeleteCriticalSection(&handler_critical_section_);
-    CloseHandle(handler_start_semaphore_);
-    CloseHandle(handler_finish_semaphore_);
-  }
-
-  // There is a race condition in the code below: if this instance is
-  // deleting the static critical section and a new instance of the class
-  // is created, then there is a possibility that the critical section be
-  // initialized while the same critical section is being deleted. Given the
-  // usage pattern for the code, this race condition is unlikely to hit, but it
-  // is a race condition nonetheless.
-  if (InterlockedDecrement(&instance_count_) == 0) {
-    DeleteCriticalSection(&handler_stack_critical_section_);
-  }
-}
-
-// static
-DWORD ExceptionHandler::ExceptionHandlerThreadMain(void* lpParameter) {
-  ExceptionHandler* self = reinterpret_cast<ExceptionHandler *>(lpParameter);
-  assert(self);
-  assert(self->handler_start_semaphore_ != NULL);
-  assert(self->handler_finish_semaphore_ != NULL);
-
-  while (true) {
-    if (WaitForSingleObject(self->handler_start_semaphore_, INFINITE) ==
-        WAIT_OBJECT_0) {
-      // Perform the requested action.
-      if (self->is_shutdown_) {
-        // The instance of the exception handler is being destroyed.
-        break;
-      } else {
-        self->handler_return_value_ =
-            self->WriteMinidumpWithException(self->requesting_thread_id_,
-                                             self->exception_info_,
-                                             self->assertion_);
-      }
-
-      // Allow the requesting thread to proceed.
-      ReleaseSemaphore(self->handler_finish_semaphore_, 1, NULL);
-    }
-  }
-
-  // This statement is not reached when the thread is unconditionally
-  // terminated by the ExceptionHandler destructor.
-  return 0;
-}
-
-// HandleException and HandleInvalidParameter must create an
-// AutoExceptionHandler object to maintain static state and to determine which
-// ExceptionHandler instance to use.  The constructor locates the correct
-// instance, and makes it available through get_handler().  The destructor
-// restores the state in effect prior to allocating the AutoExceptionHandler.
-class AutoExceptionHandler {
- public:
-  AutoExceptionHandler() {
-    // Increment handler_stack_index_ so that if another Breakpad handler is
-    // registered using this same HandleException function, and it needs to be
-    // called while this handler is running (either because this handler
-    // declines to handle the exception, or an exception occurs during
-    // handling), HandleException will find the appropriate ExceptionHandler
-    // object in handler_stack_ to deliver the exception to.
-    //
-    // Because handler_stack_ is addressed in reverse (as |size - index|),
-    // preincrementing handler_stack_index_ avoids needing to subtract 1 from
-    // the argument to |at|.
-    //
-    // The index is maintained instead of popping elements off of the handler
-    // stack and pushing them at the end of this method.  This avoids ruining
-    // the order of elements in the stack in the event that some other thread
-    // decides to manipulate the handler stack (such as creating a new
-    // ExceptionHandler object) while an exception is being handled.
-    EnterCriticalSection(&ExceptionHandler::handler_stack_critical_section_);
-    handler_ = ExceptionHandler::handler_stack_->at(
-        ExceptionHandler::handler_stack_->size() -
-        ++ExceptionHandler::handler_stack_index_);
-
-    // In case another exception occurs while this handler is doing its thing,
-    // it should be delivered to the previous filter.
-    SetUnhandledExceptionFilter(handler_->previous_filter_);
-#if _MSC_VER >= 1400  // MSVC 2005/8
-    _set_invalid_parameter_handler(handler_->previous_iph_);
-#endif  // _MSC_VER >= 1400
-    _set_purecall_handler(handler_->previous_pch_);
-  }
-
-  ~AutoExceptionHandler() {
-    // Put things back the way they were before entering this handler.
-    SetUnhandledExceptionFilter(ExceptionHandler::HandleException);
-#if _MSC_VER >= 1400  // MSVC 2005/8
-    _set_invalid_parameter_handler(ExceptionHandler::HandleInvalidParameter);
-#endif  // _MSC_VER >= 1400
-    _set_purecall_handler(ExceptionHandler::HandlePureVirtualCall);
-
-    --ExceptionHandler::handler_stack_index_;
-    LeaveCriticalSection(&ExceptionHandler::handler_stack_critical_section_);
-  }
-
-  ExceptionHandler* get_handler() const { return handler_; }
-
- private:
-  ExceptionHandler* handler_;
-};
-
-// static
-LONG ExceptionHandler::HandleException(EXCEPTION_POINTERS* exinfo) {
-  AutoExceptionHandler auto_exception_handler;
-  ExceptionHandler* current_handler = auto_exception_handler.get_handler();
-
-  // Ignore EXCEPTION_BREAKPOINT and EXCEPTION_SINGLE_STEP exceptions.  This
-  // logic will short-circuit before calling WriteMinidumpOnHandlerThread,
-  // allowing something else to handle the breakpoint without incurring the
-  // overhead transitioning to and from the handler thread.  This behavior
-  // can be overridden by calling ExceptionHandler::set_handle_debug_exceptions.
-  DWORD code = exinfo->ExceptionRecord->ExceptionCode;
-  LONG action;
-  bool is_debug_exception = (code == EXCEPTION_BREAKPOINT) ||
-                            (code == EXCEPTION_SINGLE_STEP);
-
-  bool success = false;
-
-  if (!is_debug_exception ||
-      current_handler->get_handle_debug_exceptions()) {
-    // If out-of-proc crash handler client is available, we have to use that
-    // to generate dump and we cannot fall back on in-proc dump generation
-    // because we never prepared for an in-proc dump generation
-
-    // In case of out-of-process dump generation, directly call
-    // WriteMinidumpWithException since there is no separate thread running.
-    if (current_handler->IsOutOfProcess()) {
-      success = current_handler->WriteMinidumpWithException(
-          GetCurrentThreadId(),
-          exinfo,
-          NULL);
-    } else {
-      success = current_handler->WriteMinidumpOnHandlerThread(exinfo, NULL);
-    }
-  }
-
-  // The handler fully handled the exception.  Returning
-  // EXCEPTION_EXECUTE_HANDLER indicates this to the system, and usually
-  // results in the application being terminated.
-  //
-  // Note: If the application was launched from within the Cygwin
-  // environment, returning EXCEPTION_EXECUTE_HANDLER seems to cause the
-  // application to be restarted.
-  if (success) {
-    action = EXCEPTION_EXECUTE_HANDLER;
-  } else {
-    // There was an exception, it was a breakpoint or something else ignored
-    // above, or it was passed to the handler, which decided not to handle it.
-    // This could be because the filter callback didn't want it, because
-    // minidump writing failed for some reason, or because the post-minidump
-    // callback function indicated failure.  Give the previous handler a
-    // chance to do something with the exception.  If there is no previous
-    // handler, return EXCEPTION_CONTINUE_SEARCH, which will allow a debugger
-    // or native "crashed" dialog to handle the exception.
-    if (current_handler->previous_filter_) {
-      action = current_handler->previous_filter_(exinfo);
-    } else {
-      action = EXCEPTION_CONTINUE_SEARCH;
-    }
-  }
-
-  return action;
-}
-
-#if _MSC_VER >= 1400  // MSVC 2005/8
-// static
-void ExceptionHandler::HandleInvalidParameter(const wchar_t* expression,
-                                              const wchar_t* function,
-                                              const wchar_t* file,
-                                              unsigned int line,
-                                              uintptr_t reserved) {
-  // This is an invalid parameter, not an exception.  It's safe to play with
-  // sprintf here.
-  AutoExceptionHandler auto_exception_handler;
-  ExceptionHandler* current_handler = auto_exception_handler.get_handler();
-
-  MDRawAssertionInfo assertion;
-  memset(&assertion, 0, sizeof(assertion));
-  _snwprintf_s(reinterpret_cast<wchar_t*>(assertion.expression),
-               sizeof(assertion.expression) / sizeof(assertion.expression[0]),
-               _TRUNCATE, L"%s", expression);
-  _snwprintf_s(reinterpret_cast<wchar_t*>(assertion.function),
-               sizeof(assertion.function) / sizeof(assertion.function[0]),
-               _TRUNCATE, L"%s", function);
-  _snwprintf_s(reinterpret_cast<wchar_t*>(assertion.file),
-               sizeof(assertion.file) / sizeof(assertion.file[0]),
-               _TRUNCATE, L"%s", file);
-  assertion.line = line;
-  assertion.type = MD_ASSERTION_INFO_TYPE_INVALID_PARAMETER;
-
-  // Make up an exception record for the current thread and CPU context
-  // to make it possible for the crash processor to classify these
-  // as do regular crashes, and to make it humane for developers to
-  // analyze them.
-  EXCEPTION_RECORD exception_record = {};
-  CONTEXT exception_context = {};
-  EXCEPTION_POINTERS exception_ptrs = { &exception_record, &exception_context };
-
-  EXCEPTION_POINTERS* exinfo = NULL;
-
-  RtlCaptureContextPtr fnRtlCaptureContext = (RtlCaptureContextPtr)
-    GetProcAddress(GetModuleHandleW(L"kernel32"), "RtlCaptureContext");
-  if (fnRtlCaptureContext) {
-    fnRtlCaptureContext(&exception_context);
-
-    exception_record.ExceptionCode = STATUS_NONCONTINUABLE_EXCEPTION;
-
-    // We store pointers to the the expression and function strings,
-    // and the line as exception parameters to make them easy to
-    // access by the developer on the far side.
-    exception_record.NumberParameters = 3;
-    exception_record.ExceptionInformation[0] =
-        reinterpret_cast<ULONG_PTR>(&assertion.expression);
-    exception_record.ExceptionInformation[1] =
-        reinterpret_cast<ULONG_PTR>(&assertion.file);
-    exception_record.ExceptionInformation[2] = assertion.line;
-
-    exinfo = &exception_ptrs;
-  }
-
-  bool success = false;
-  // In case of out-of-process dump generation, directly call
-  // WriteMinidumpWithException since there is no separate thread running.
-  if (current_handler->IsOutOfProcess()) {
-    success = current_handler->WriteMinidumpWithException(
-        GetCurrentThreadId(),
-        exinfo,
-        &assertion);
-  } else {
-    success = current_handler->WriteMinidumpOnHandlerThread(exinfo,
-                                                            &assertion);
-  }
-
-  if (!success) {
-    if (current_handler->previous_iph_) {
-      // The handler didn't fully handle the exception.  Give it to the
-      // previous invalid parameter handler.
-      current_handler->previous_iph_(expression,
-                                     function,
-                                     file,
-                                     line,
-                                     reserved);
-    } else {
-      // If there's no previous handler, pass the exception back in to the
-      // invalid parameter handler's core.  That's the routine that called this
-      // function, but now, since this function is no longer registered (and in
-      // fact, no function at all is registered), this will result in the
-      // default code path being taken: _CRT_DEBUGGER_HOOK and _invoke_watson.
-      // Use _invalid_parameter where it exists (in _DEBUG builds) as it passes
-      // more information through.  In non-debug builds, it is not available,
-      // so fall back to using _invalid_parameter_noinfo.  See invarg.c in the
-      // CRT source.
-#ifdef _DEBUG
-      _invalid_parameter(expression, function, file, line, reserved);
-#else  // _DEBUG
-      _invalid_parameter_noinfo();
-#endif  // _DEBUG
-    }
-  }
-
-  // The handler either took care of the invalid parameter problem itself,
-  // or passed it on to another handler.  "Swallow" it by exiting, paralleling
-  // the behavior of "swallowing" exceptions.
-  exit(0);
-}
-#endif  // _MSC_VER >= 1400
-
-// static
-void ExceptionHandler::HandlePureVirtualCall() {
-  // This is an pure virtual function call, not an exception.  It's safe to
-  // play with sprintf here.
-  AutoExceptionHandler auto_exception_handler;
-  ExceptionHandler* current_handler = auto_exception_handler.get_handler();
-
-  MDRawAssertionInfo assertion;
-  memset(&assertion, 0, sizeof(assertion));
-  assertion.type = MD_ASSERTION_INFO_TYPE_PURE_VIRTUAL_CALL;
-
-  // Make up an exception record for the current thread and CPU context
-  // to make it possible for the crash processor to classify these
-  // as do regular crashes, and to make it humane for developers to
-  // analyze them.
-  EXCEPTION_RECORD exception_record = {};
-  CONTEXT exception_context = {};
-  EXCEPTION_POINTERS exception_ptrs = { &exception_record, &exception_context };
-
-  EXCEPTION_POINTERS* exinfo = NULL;
-
-  RtlCaptureContextPtr fnRtlCaptureContext = (RtlCaptureContextPtr)
-    GetProcAddress(GetModuleHandleW(L"kernel32"), "RtlCaptureContext");
-  if (fnRtlCaptureContext) {
-    fnRtlCaptureContext(&exception_context);
-
-    exception_record.ExceptionCode = STATUS_NONCONTINUABLE_EXCEPTION;
-
-    // We store pointers to the the expression and function strings,
-    // and the line as exception parameters to make them easy to
-    // access by the developer on the far side.
-    exception_record.NumberParameters = 3;
-    exception_record.ExceptionInformation[0] =
-        reinterpret_cast<ULONG_PTR>(&assertion.expression);
-    exception_record.ExceptionInformation[1] =
-        reinterpret_cast<ULONG_PTR>(&assertion.file);
-    exception_record.ExceptionInformation[2] = assertion.line;
-
-    exinfo = &exception_ptrs;
-  }
-
-  bool success = false;
-  // In case of out-of-process dump generation, directly call
-  // WriteMinidumpWithException since there is no separate thread running.
-
-  if (current_handler->IsOutOfProcess()) {
-    success = current_handler->WriteMinidumpWithException(
-        GetCurrentThreadId(),
-        exinfo,
-        &assertion);
-  } else {
-    success = current_handler->WriteMinidumpOnHandlerThread(exinfo,
-                                                            &assertion);
-  }
-
-  if (!success) {
-    if (current_handler->previous_pch_) {
-      // The handler didn't fully handle the exception.  Give it to the
-      // previous purecall handler.
-      current_handler->previous_pch_();
-    } else {
-      // If there's no previous handler, return and let _purecall handle it.
-      // This will just put up an assertion dialog.
-      return;
-    }
-  }
-
-  // The handler either took care of the invalid parameter problem itself,
-  // or passed it on to another handler.  "Swallow" it by exiting, paralleling
-  // the behavior of "swallowing" exceptions.
-  exit(0);
-}
-
-bool ExceptionHandler::WriteMinidumpOnHandlerThread(
-    EXCEPTION_POINTERS* exinfo, MDRawAssertionInfo* assertion) {
-  EnterCriticalSection(&handler_critical_section_);
-
-  // There isn't much we can do if the handler thread
-  // was not successfully created.
-  if (handler_thread_ == NULL) {
-    LeaveCriticalSection(&handler_critical_section_);
-    return false;
-  }
-
-  // The handler thread should only be created when the semaphores are valid.
-  assert(handler_start_semaphore_ != NULL);
-  assert(handler_finish_semaphore_ != NULL);
-
-  // Set up data to be passed in to the handler thread.
-  requesting_thread_id_ = GetCurrentThreadId();
-  exception_info_ = exinfo;
-  assertion_ = assertion;
-
-  // This causes the handler thread to call WriteMinidumpWithException.
-  ReleaseSemaphore(handler_start_semaphore_, 1, NULL);
-
-  // Wait until WriteMinidumpWithException is done and collect its return value.
-  WaitForSingleObject(handler_finish_semaphore_, INFINITE);
-  bool status = handler_return_value_;
-
-  // Clean up.
-  requesting_thread_id_ = 0;
-  exception_info_ = NULL;
-  assertion_ = NULL;
-
-  LeaveCriticalSection(&handler_critical_section_);
-
-  return status;
-}
-
-bool ExceptionHandler::WriteMinidump() {
-  return WriteMinidumpForException(NULL);
-}
-
-bool ExceptionHandler::WriteMinidumpForException(EXCEPTION_POINTERS* exinfo) {
-  // In case of out-of-process dump generation, directly call
-  // WriteMinidumpWithException since there is no separate thread running.
-  if (IsOutOfProcess()) {
-    return WriteMinidumpWithException(GetCurrentThreadId(),
-                                      exinfo,
-                                      NULL);
-  }
-
-  bool success = WriteMinidumpOnHandlerThread(exinfo, NULL);
-  UpdateNextID();
-  return success;
-}
-
-// static
-bool ExceptionHandler::WriteMinidump(const wstring &dump_path,
-                                     MinidumpCallback callback,
-                                     void* callback_context) {
-  ExceptionHandler handler(dump_path, NULL, callback, callback_context,
-                           HANDLER_NONE);
-  return handler.WriteMinidump();
-}
-
-bool ExceptionHandler::WriteMinidumpWithException(
-    DWORD requesting_thread_id,
-    EXCEPTION_POINTERS* exinfo,
-    MDRawAssertionInfo* assertion) {
-  // Give user code a chance to approve or prevent writing a minidump.  If the
-  // filter returns false, don't handle the exception at all.  If this method
-  // was called as a result of an exception, returning false will cause
-  // HandleException to call any previous handler or return
-  // EXCEPTION_CONTINUE_SEARCH on the exception thread, allowing it to appear
-  // as though this handler were not present at all.
-  if (filter_ && !filter_(callback_context_, exinfo, assertion)) {
-    return false;
-  }
-
-  bool success = false;
-  if (IsOutOfProcess()) {
-    success = crash_generation_client_->RequestDump(exinfo, assertion);
-  } else {
-    if (minidump_write_dump_) {
-      HANDLE dump_file = CreateFile(next_minidump_path_c_,
-                                    GENERIC_WRITE,
-                                    0,  // no sharing
-                                    NULL,
-                                    CREATE_NEW,  // fail if exists
-                                    FILE_ATTRIBUTE_NORMAL,
-                                    NULL);
-      if (dump_file != INVALID_HANDLE_VALUE) {
-        MINIDUMP_EXCEPTION_INFORMATION except_info;
-        except_info.ThreadId = requesting_thread_id;
-        except_info.ExceptionPointers = exinfo;
-        except_info.ClientPointers = FALSE;
-
-        // Add an MDRawBreakpadInfo stream to the minidump, to provide
-        // additional information about the exception handler to the Breakpad
-        // processor. The information will help the processor determine which
-        // threads are relevant.  The Breakpad processor does not require this
-        // information but can function better with Breakpad-generated dumps
-        // when it is present. The native debugger is not harmed by the
-        // presence of this information.
-        MDRawBreakpadInfo breakpad_info;
-        breakpad_info.validity = MD_BREAKPAD_INFO_VALID_DUMP_THREAD_ID |
-                               MD_BREAKPAD_INFO_VALID_REQUESTING_THREAD_ID;
-        breakpad_info.dump_thread_id = GetCurrentThreadId();
-        breakpad_info.requesting_thread_id = requesting_thread_id;
-
-        // Leave room in user_stream_array for a possible assertion info stream.
-        MINIDUMP_USER_STREAM user_stream_array[2];
-        user_stream_array[0].Type = MD_BREAKPAD_INFO_STREAM;
-        user_stream_array[0].BufferSize = sizeof(breakpad_info);
-        user_stream_array[0].Buffer = &breakpad_info;
-
-        MINIDUMP_USER_STREAM_INFORMATION user_streams;
-        user_streams.UserStreamCount = 1;
-        user_streams.UserStreamArray = user_stream_array;
-
-        if (assertion) {
-          user_stream_array[1].Type = MD_ASSERTION_INFO_STREAM;
-          user_stream_array[1].BufferSize = sizeof(MDRawAssertionInfo);
-          user_stream_array[1].Buffer = assertion;
-          ++user_streams.UserStreamCount;
-        }
-
-        MINIDUMP_CALLBACK_INFORMATION callback;
-        MinidumpCallbackContext context;
-        MINIDUMP_CALLBACK_INFORMATION* callback_pointer = NULL;
-        // Older versions of DbgHelp.dll don't correctly put the memory around
-        // the faulting instruction pointer into the minidump. This
-        // callback will ensure that it gets included.
-        if (exinfo) {
-          // Find a memory region of 256 bytes centered on the
-          // faulting instruction pointer.
-          const ULONG64 instruction_pointer = 
-#if defined(_M_IX86)
-            exinfo->ContextRecord->Eip;
-#elif defined(_M_AMD64)
-            exinfo->ContextRecord->Rip;
-#else
-#error Unsupported platform
-#endif
-
-          MEMORY_BASIC_INFORMATION info;
-          if (VirtualQuery(reinterpret_cast<LPCVOID>(instruction_pointer),
-                           &info,
-                           sizeof(MEMORY_BASIC_INFORMATION)) != 0 &&
-              info.State == MEM_COMMIT) {
-            // Attempt to get 128 bytes before and after the instruction
-            // pointer, but settle for whatever's available up to the
-            // boundaries of the memory region.
-            const ULONG64 kIPMemorySize = 256;
-            context.memory_base =
-              (std::max)(reinterpret_cast<ULONG64>(info.BaseAddress),
-                       instruction_pointer - (kIPMemorySize / 2));
-            ULONG64 end_of_range =
-              (std::min)(instruction_pointer + (kIPMemorySize / 2),
-                       reinterpret_cast<ULONG64>(info.BaseAddress)
-                       + info.RegionSize);
-            context.memory_size =
-                static_cast<ULONG>(end_of_range - context.memory_base);
-
-            context.finished = false;
-            callback.CallbackRoutine = MinidumpWriteDumpCallback;
-            callback.CallbackParam = reinterpret_cast<void*>(&context);
-            callback_pointer = &callback;
-          }
-        }
-
-        // The explicit comparison to TRUE avoids a warning (C4800).
-        success = (minidump_write_dump_(GetCurrentProcess(),
-                                        GetCurrentProcessId(),
-                                        dump_file,
-                                        dump_type_,
-                                        exinfo ? &except_info : NULL,
-                                        &user_streams,
-                                        callback_pointer) == TRUE);
-
-        CloseHandle(dump_file);
-      }
-    }
-  }
-
-  if (callback_) {
-    // TODO(munjal): In case of out-of-process dump generation, both
-    // dump_path_c_ and next_minidump_id_ will be NULL. For out-of-process
-    // scenario, the server process ends up creating the dump path and dump
-    // id so they are not known to the client.
-    success = callback_(dump_path_c_, next_minidump_id_c_, callback_context_,
-                        exinfo, assertion, success);
-  }
-
-  return success;
-}
-
-// static
-BOOL CALLBACK ExceptionHandler::MinidumpWriteDumpCallback(
-    PVOID context,
-    const PMINIDUMP_CALLBACK_INPUT callback_input,
-    PMINIDUMP_CALLBACK_OUTPUT callback_output) {
-  switch (callback_input->CallbackType) {
-  case MemoryCallback: {
-    MinidumpCallbackContext* callback_context =
-        reinterpret_cast<MinidumpCallbackContext*>(context);
-    if (callback_context->finished)
-      return FALSE;
-
-    // Include the specified memory region.
-    callback_output->MemoryBase = callback_context->memory_base;
-    callback_output->MemorySize = callback_context->memory_size;
-    callback_context->finished = true;
-    return TRUE;
-  }
-    
-    // Include all modules.
-  case IncludeModuleCallback:
-  case ModuleCallback:
-    return TRUE;
-
-    // Include all threads.
-  case IncludeThreadCallback:
-  case ThreadCallback:
-    return TRUE;
-
-    // Stop receiving cancel callbacks.
-  case CancelCallback:
-    callback_output->CheckCancel = FALSE;
-    callback_output->Cancel = FALSE;
-    return TRUE;
-  }
-  // Ignore other callback types.
-  return FALSE;
-}
-
-void ExceptionHandler::UpdateNextID() {
-  assert(uuid_create_);
-  UUID id = {0};
-  if (uuid_create_) {
-    uuid_create_(&id);
-  }
-  next_minidump_id_ = GUIDString::GUIDToWString(&id);
-  next_minidump_id_c_ = next_minidump_id_.c_str();
-
-  wchar_t minidump_path[MAX_PATH];
-  swprintf(minidump_path, MAX_PATH, L"%s\\%s.dmp",
-           dump_path_c_, next_minidump_id_c_);
-
-  // remove when VC++7.1 is no longer supported
-  minidump_path[MAX_PATH - 1] = L'\0';
-
-  next_minidump_path_ = minidump_path;
-  next_minidump_path_c_ = next_minidump_path_.c_str();
-}
-
-}  // namespace google_breakpad
diff --git a/third_party/breakpad/src/client/windows/handler/exception_handler.h b/third_party/breakpad/src/client/windows/handler/exception_handler.h
deleted file mode 100644
index 2c2e7b7..0000000
--- a/third_party/breakpad/src/client/windows/handler/exception_handler.h
+++ /dev/null
@@ -1,422 +0,0 @@
-// Copyright (c) 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// ExceptionHandler can write a minidump file when an exception occurs,
-// or when WriteMinidump() is called explicitly by your program.
-//
-// To have the exception handler write minidumps when an uncaught exception
-// (crash) occurs, you should create an instance early in the execution
-// of your program, and keep it around for the entire time you want to
-// have crash handling active (typically, until shutdown).
-//
-// If you want to write minidumps without installing the exception handler,
-// you can create an ExceptionHandler with install_handler set to false,
-// then call WriteMinidump.  You can also use this technique if you want to
-// use different minidump callbacks for different call sites.
-//
-// In either case, a callback function is called when a minidump is written,
-// which receives the unqiue id of the minidump.  The caller can use this
-// id to collect and write additional application state, and to launch an
-// external crash-reporting application.
-//
-// It is important that creation and destruction of ExceptionHandler objects
-// be nested cleanly, when using install_handler = true.
-// Avoid the following pattern:
-//   ExceptionHandler *e = new ExceptionHandler(...);
-//   ExceptionHandler *f = new ExceptionHandler(...);
-//   delete e;
-// This will put the exception filter stack into an inconsistent state.
-
-#ifndef CLIENT_WINDOWS_HANDLER_EXCEPTION_HANDLER_H__
-#define CLIENT_WINDOWS_HANDLER_EXCEPTION_HANDLER_H__
-
-#include <stdlib.h>
-#include <Windows.h>
-#include <DbgHelp.h>
-#include <rpc.h>
-
-#pragma warning( push )
-// Disable exception handler warnings.
-#pragma warning( disable : 4530 )
-
-#include <string>
-#include <vector>
-
-#include "client/windows/common/ipc_protocol.h"
-#include "client/windows/crash_generation/crash_generation_client.h"
-#include "google_breakpad/common/minidump_format.h"
-#include "processor/scoped_ptr.h"
-
-namespace google_breakpad {
-
-using std::vector;
-using std::wstring;
-
-class ExceptionHandler {
- public:
-  // A callback function to run before Breakpad performs any substantial
-  // processing of an exception.  A FilterCallback is called before writing
-  // a minidump.  context is the parameter supplied by the user as
-  // callback_context when the handler was created.  exinfo points to the
-  // exception record, if any; assertion points to assertion information,
-  // if any.
-  //
-  // If a FilterCallback returns true, Breakpad will continue processing,
-  // attempting to write a minidump.  If a FilterCallback returns false, Breakpad
-  // will immediately report the exception as unhandled without writing a
-  // minidump, allowing another handler the opportunity to handle it.
-  typedef bool (*FilterCallback)(void* context, EXCEPTION_POINTERS* exinfo,
-                                 MDRawAssertionInfo* assertion);
-
-  // A callback function to run after the minidump has been written.
-  // minidump_id is a unique id for the dump, so the minidump
-  // file is <dump_path>\<minidump_id>.dmp.  context is the parameter supplied
-  // by the user as callback_context when the handler was created.  exinfo
-  // points to the exception record, or NULL if no exception occurred.
-  // succeeded indicates whether a minidump file was successfully written.
-  // assertion points to information about an assertion if the handler was
-  // invoked by an assertion.
-  //
-  // If an exception occurred and the callback returns true, Breakpad will treat
-  // the exception as fully-handled, suppressing any other handlers from being
-  // notified of the exception.  If the callback returns false, Breakpad will
-  // treat the exception as unhandled, and allow another handler to handle it.
-  // If there are no other handlers, Breakpad will report the exception to the
-  // system as unhandled, allowing a debugger or native crash dialog the
-  // opportunity to handle the exception.  Most callback implementations
-  // should normally return the value of |succeeded|, or when they wish to
-  // not report an exception of handled, false.  Callbacks will rarely want to
-  // return true directly (unless |succeeded| is true).
-  //
-  // For out-of-process dump generation, dump path and minidump ID will always
-  // be NULL. In case of out-of-process dump generation, the dump path and
-  // minidump id are controlled by the server process and are not communicated
-  // back to the crashing process.
-  typedef bool (*MinidumpCallback)(const wchar_t* dump_path,
-                                   const wchar_t* minidump_id,
-                                   void* context,
-                                   EXCEPTION_POINTERS* exinfo,
-                                   MDRawAssertionInfo* assertion,
-                                   bool succeeded);
-
-  // HandlerType specifies which types of handlers should be installed, if
-  // any.  Use HANDLER_NONE for an ExceptionHandler that remains idle,
-  // without catching any failures on its own.  This type of handler may
-  // still be triggered by calling WriteMinidump.  Otherwise, use a
-  // combination of the other HANDLER_ values, or HANDLER_ALL to install
-  // all handlers.
-  enum HandlerType {
-    HANDLER_NONE = 0,
-    HANDLER_EXCEPTION = 1 << 0,          // SetUnhandledExceptionFilter
-    HANDLER_INVALID_PARAMETER = 1 << 1,  // _set_invalid_parameter_handler
-    HANDLER_PURECALL = 1 << 2,           // _set_purecall_handler
-    HANDLER_ALL = HANDLER_EXCEPTION |
-                  HANDLER_INVALID_PARAMETER |
-                  HANDLER_PURECALL
-  };
-
-  // Creates a new ExceptionHandler instance to handle writing minidumps.
-  // Before writing a minidump, the optional filter callback will be called.
-  // Its return value determines whether or not Breakpad should write a
-  // minidump.  Minidump files will be written to dump_path, and the optional
-  // callback is called after writing the dump file, as described above.
-  // handler_types specifies the types of handlers that should be installed.
-  ExceptionHandler(const wstring& dump_path,
-                   FilterCallback filter,
-                   MinidumpCallback callback,
-                   void* callback_context,
-                   int handler_types);
-
-  // Creates a new ExcetpionHandler instance that can attempt to perform
-  // out-of-process dump generation if pipe_name is not NULL. If pipe_name is
-  // NULL, or if out-of-process dump generation registration step fails,
-  // in-process dump generation will be used. This also allows specifying
-  // the dump type to generate.
-  ExceptionHandler(const wstring& dump_path,
-                   FilterCallback filter,
-                   MinidumpCallback callback,
-                   void* callback_context,
-                   int handler_types,
-                   MINIDUMP_TYPE dump_type,
-                   const wchar_t* pipe_name,
-                   const CustomClientInfo* custom_info);
-
-  ~ExceptionHandler();
-
-  // Get and set the minidump path.
-  wstring dump_path() const { return dump_path_; }
-  void set_dump_path(const wstring &dump_path) {
-    dump_path_ = dump_path;
-    dump_path_c_ = dump_path_.c_str();
-    UpdateNextID();  // Necessary to put dump_path_ in next_minidump_path_.
-  }
-
-  // Writes a minidump immediately.  This can be used to capture the
-  // execution state independently of a crash.  Returns true on success.
-  bool WriteMinidump();
-
-  // Writes a minidump immediately, with the user-supplied exception
-  // information.
-  bool WriteMinidumpForException(EXCEPTION_POINTERS* exinfo);
-
-  // Convenience form of WriteMinidump which does not require an
-  // ExceptionHandler instance.
-  static bool WriteMinidump(const wstring &dump_path,
-                            MinidumpCallback callback, void* callback_context);
-
-  // Get the thread ID of the thread requesting the dump (either the exception
-  // thread or any other thread that called WriteMinidump directly).  This
-  // may be useful if you want to include additional thread state in your
-  // dumps.
-  DWORD get_requesting_thread_id() const { return requesting_thread_id_; }
-
-  // Controls behavior of EXCEPTION_BREAKPOINT and EXCEPTION_SINGLE_STEP.
-  bool get_handle_debug_exceptions() const { return handle_debug_exceptions_; }
-  void set_handle_debug_exceptions(bool handle_debug_exceptions) {
-    handle_debug_exceptions_ = handle_debug_exceptions;
-  }
-
-  // Returns whether out-of-process dump generation is used or not.
-  bool IsOutOfProcess() const { return crash_generation_client_.get() != NULL; }
-
- private:
-  friend class AutoExceptionHandler;
-
-  // Initializes the instance with given values.
-  void Initialize(const wstring& dump_path,
-                  FilterCallback filter,
-                  MinidumpCallback callback,
-                  void* callback_context,
-                  int handler_types,
-                  MINIDUMP_TYPE dump_type,
-                  const wchar_t* pipe_name,
-                  const CustomClientInfo* custom_info);
-
-  // Function pointer type for MiniDumpWriteDump, which is looked up
-  // dynamically.
-  typedef BOOL (WINAPI *MiniDumpWriteDump_type)(
-      HANDLE hProcess,
-      DWORD dwPid,
-      HANDLE hFile,
-      MINIDUMP_TYPE DumpType,
-      CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
-      CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
-      CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam);
-
-  // Function pointer type for UuidCreate, which is looked up dynamically.
-  typedef RPC_STATUS (RPC_ENTRY *UuidCreate_type)(UUID* Uuid);
-
-  // Runs the main loop for the exception handler thread.
-  static DWORD WINAPI ExceptionHandlerThreadMain(void* lpParameter);
-
-  // Called on the exception thread when an unhandled exception occurs.
-  // Signals the exception handler thread to handle the exception.
-  static LONG WINAPI HandleException(EXCEPTION_POINTERS* exinfo);
-
-#if _MSC_VER >= 1400  // MSVC 2005/8
-  // This function will be called by some CRT functions when they detect
-  // that they were passed an invalid parameter.  Note that in _DEBUG builds,
-  // the CRT may display an assertion dialog before calling this function,
-  // and the function will not be called unless the assertion dialog is
-  // dismissed by clicking "Ignore."
-  static void HandleInvalidParameter(const wchar_t* expression,
-                                     const wchar_t* function,
-                                     const wchar_t* file,
-                                     unsigned int line,
-                                     uintptr_t reserved);
-#endif  // _MSC_VER >= 1400
-
-  // This function will be called by the CRT when a pure virtual
-  // function is called.
-  static void HandlePureVirtualCall();
-
-  // This is called on the exception thread or on another thread that
-  // the user wishes to produce a dump from.  It calls
-  // WriteMinidumpWithException on the handler thread, avoiding stack
-  // overflows and inconsistent dumps due to writing the dump from
-  // the exception thread.  If the dump is requested as a result of an
-  // exception, exinfo contains exception information, otherwise, it
-  // is NULL.  If the dump is requested as a result of an assertion
-  // (such as an invalid parameter being passed to a CRT function),
-  // assertion contains data about the assertion, otherwise, it is NULL.
-  bool WriteMinidumpOnHandlerThread(EXCEPTION_POINTERS* exinfo,
-                                    MDRawAssertionInfo* assertion);
-
-  // This function does the actual writing of a minidump.  It is called
-  // on the handler thread.  requesting_thread_id is the ID of the thread
-  // that requested the dump.  If the dump is requested as a result of
-  // an exception, exinfo contains exception information, otherwise,
-  // it is NULL.
-  bool WriteMinidumpWithException(DWORD requesting_thread_id,
-                                  EXCEPTION_POINTERS* exinfo,
-                                  MDRawAssertionInfo* assertion);
-
-  // This function is used as a callback when calling MinidumpWriteDump,
-  // in order to add additional memory regions to the dump.
-  static BOOL CALLBACK MinidumpWriteDumpCallback(
-      PVOID context,
-      const PMINIDUMP_CALLBACK_INPUT callback_input,
-      PMINIDUMP_CALLBACK_OUTPUT callback_output);
-
-  // Generates a new ID and stores it in next_minidump_id_, and stores the
-  // path of the next minidump to be written in next_minidump_path_.
-  void UpdateNextID();
-
-  FilterCallback filter_;
-  MinidumpCallback callback_;
-  void* callback_context_;
-
-  scoped_ptr<CrashGenerationClient> crash_generation_client_;
-
-  // The directory in which a minidump will be written, set by the dump_path
-  // argument to the constructor, or set_dump_path.
-  wstring dump_path_;
-
-  // The basename of the next minidump to be written, without the extension.
-  wstring next_minidump_id_;
-
-  // The full pathname of the next minidump to be written, including the file
-  // extension.
-  wstring next_minidump_path_;
-
-  // Pointers to C-string representations of the above.  These are set when
-  // the above wstring versions are set in order to avoid calling c_str during
-  // an exception, as c_str may attempt to allocate heap memory.  These
-  // pointers are not owned by the ExceptionHandler object, but their lifetimes
-  // should be equivalent to the lifetimes of the associated wstring, provided
-  // that the wstrings are not altered.
-  const wchar_t* dump_path_c_;
-  const wchar_t* next_minidump_id_c_;
-  const wchar_t* next_minidump_path_c_;
-
-  HMODULE dbghelp_module_;
-  MiniDumpWriteDump_type minidump_write_dump_;
-  MINIDUMP_TYPE dump_type_;
-
-  HMODULE rpcrt4_module_;
-  UuidCreate_type uuid_create_;
-
-  // Tracks the handler types that were installed according to the
-  // handler_types constructor argument.
-  int handler_types_;
-
-  // When installed_handler_ is true, previous_filter_ is the unhandled
-  // exception filter that was set prior to installing ExceptionHandler as
-  // the unhandled exception filter and pointing it to |this|.  NULL indicates
-  // that there is no previous unhandled exception filter.
-  LPTOP_LEVEL_EXCEPTION_FILTER previous_filter_;
-
-#if _MSC_VER >= 1400  // MSVC 2005/8
-  // Beginning in VC 8, the CRT provides an invalid parameter handler that will
-  // be called when some CRT functions are passed invalid parameters.  In
-  // earlier CRTs, the same conditions would cause unexpected behavior or
-  // crashes.
-  _invalid_parameter_handler previous_iph_;
-#endif  // _MSC_VER >= 1400
-
-  // The CRT allows you to override the default handler for pure
-  // virtual function calls.
-  _purecall_handler previous_pch_;
-
-  // The exception handler thread.
-  HANDLE handler_thread_;
-
-  // True if the exception handler is being destroyed.
-  // Starting with MSVC 2005, Visual C has stronger guarantees on volatile vars.
-  // It has release semantics on write and acquire semantics on reads.
-  // See the msdn documentation.
-  volatile bool is_shutdown_;
-
-  // The critical section enforcing the requirement that only one exception be
-  // handled by a handler at a time.
-  CRITICAL_SECTION handler_critical_section_;
-
-  // Semaphores used to move exception handling between the exception thread
-  // and the handler thread.  handler_start_semaphore_ is signalled by the
-  // exception thread to wake up the handler thread when an exception occurs.
-  // handler_finish_semaphore_ is signalled by the handler thread to wake up
-  // the exception thread when handling is complete.
-  HANDLE handler_start_semaphore_;
-  HANDLE handler_finish_semaphore_;
-
-  // The next 2 fields contain data passed from the requesting thread to
-  // the handler thread.
-
-  // The thread ID of the thread requesting the dump (either the exception
-  // thread or any other thread that called WriteMinidump directly).
-  DWORD requesting_thread_id_;
-
-  // The exception info passed to the exception handler on the exception
-  // thread, if an exception occurred.  NULL for user-requested dumps.
-  EXCEPTION_POINTERS* exception_info_;
-
-  // If the handler is invoked due to an assertion, this will contain a
-  // pointer to the assertion information.  It is NULL at other times.
-  MDRawAssertionInfo* assertion_;
-
-  // The return value of the handler, passed from the handler thread back to
-  // the requesting thread.
-  bool handler_return_value_;
-
-  // If true, the handler will intercept EXCEPTION_BREAKPOINT and
-  // EXCEPTION_SINGLE_STEP exceptions.  Leave this false (the default)
-  // to not interfere with debuggers.
-  bool handle_debug_exceptions_;
-
-  // A stack of ExceptionHandler objects that have installed unhandled
-  // exception filters.  This vector is used by HandleException to determine
-  // which ExceptionHandler object to route an exception to.  When an
-  // ExceptionHandler is created with install_handler true, it will append
-  // itself to this list.
-  static vector<ExceptionHandler*>* handler_stack_;
-
-  // The index of the ExceptionHandler in handler_stack_ that will handle the
-  // next exception.  Note that 0 means the last entry in handler_stack_, 1
-  // means the next-to-last entry, and so on.  This is used by HandleException
-  // to support multiple stacked Breakpad handlers.
-  static LONG handler_stack_index_;
-
-  // handler_stack_critical_section_ guards operations on handler_stack_ and
-  // handler_stack_index_. The critical section is initialized by the
-  // first instance of the class and destroyed by the last instance of it.
-  static CRITICAL_SECTION handler_stack_critical_section_;
-
-  // The number of instances of this class.
-  volatile static LONG instance_count_;
-
-  // disallow copy ctor and operator=
-  explicit ExceptionHandler(const ExceptionHandler &);
-  void operator=(const ExceptionHandler &);
-};
-
-}  // namespace google_breakpad
-
-#pragma warning( pop )
-
-#endif  // CLIENT_WINDOWS_HANDLER_EXCEPTION_HANDLER_H__
diff --git a/third_party/breakpad/src/client/windows/sender/crash_report_sender.cc b/third_party/breakpad/src/client/windows/sender/crash_report_sender.cc
deleted file mode 100644
index ecf626d..0000000
--- a/third_party/breakpad/src/client/windows/sender/crash_report_sender.cc
+++ /dev/null
@@ -1,142 +0,0 @@
-// Copyright (c) 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Disable exception handler warnings.
-#pragma warning( disable : 4530 )
-
-#include <errno.h>
-
-#include "client/windows/sender/crash_report_sender.h"
-#include "common/windows/http_upload.h"
-
-#if _MSC_VER < 1400  // MSVC 2005/8
-// Older MSVC doesn't have fscanf_s, but they are compatible as long as
-// we don't use the string conversions (%s/%c/%S/%C).
-#define fscanf_s fscanf
-#endif
-
-namespace google_breakpad {
-
-static const char kCheckpointSignature[] = "GBP1\n";
-
-CrashReportSender::CrashReportSender(const wstring &checkpoint_file)
-    : checkpoint_file_(checkpoint_file),
-      max_reports_per_day_(-1),
-      last_sent_date_(-1),
-      reports_sent_(0) {
-  FILE *fd;
-  if (OpenCheckpointFile(L"r", &fd) == 0) {
-    ReadCheckpoint(fd);
-    fclose(fd);
-  }
-}
-
-ReportResult CrashReportSender::SendCrashReport(
-    const wstring &url, const map<wstring, wstring> &parameters,
-    const wstring &dump_file_name, wstring *report_code) {
-  int today = GetCurrentDate();
-  if (today == last_sent_date_ &&
-      max_reports_per_day_ != -1 &&
-      reports_sent_ >= max_reports_per_day_) {
-    return RESULT_THROTTLED;
-  }
-
-  int http_response = 0;
-  bool result = HTTPUpload::SendRequest(
-    url, parameters, dump_file_name, L"upload_file_minidump", NULL, report_code,
-    &http_response);
-
-  if (result) {
-    ReportSent(today);
-    return RESULT_SUCCEEDED;
-  } else if (http_response >= 400 && http_response < 500) {
-    return RESULT_REJECTED;
-  } else {
-    return RESULT_FAILED;
-  }
-}
-
-void CrashReportSender::ReadCheckpoint(FILE *fd) {
-  char buf[128];
-  if (!fgets(buf, sizeof(buf), fd) ||
-      strcmp(buf, kCheckpointSignature) != 0) {
-    return;
-  }
-
-  if (fscanf_s(fd, "%d\n", &last_sent_date_) != 1) {
-    last_sent_date_ = -1;
-    return;
-  }
-  if (fscanf_s(fd, "%d\n", &reports_sent_) != 1) {
-    reports_sent_ = 0;
-    return;
-  }
-}
-
-void CrashReportSender::ReportSent(int today) {
-  // Update the report stats
-  if (today != last_sent_date_) {
-    last_sent_date_ = today;
-    reports_sent_ = 0;
-  }
-  ++reports_sent_;
-
-  // Update the checkpoint file
-  FILE *fd;
-  if (OpenCheckpointFile(L"w", &fd) == 0) {
-    fputs(kCheckpointSignature, fd);
-    fprintf(fd, "%d\n", last_sent_date_);
-    fprintf(fd, "%d\n", reports_sent_);
-    fclose(fd);
-  }
-}
-
-int CrashReportSender::GetCurrentDate() const {
-  SYSTEMTIME system_time;
-  GetSystemTime(&system_time);
-  return (system_time.wYear * 10000) + (system_time.wMonth * 100) +
-      system_time.wDay;
-}
-
-int CrashReportSender::OpenCheckpointFile(const wchar_t *mode, FILE **fd) {
-  if (checkpoint_file_.empty()) {
-    return ENOENT;
-  }
-#if _MSC_VER >= 1400  // MSVC 2005/8
-  return _wfopen_s(fd, checkpoint_file_.c_str(), mode);
-#else
-  *fd = _wfopen(checkpoint_file_.c_str(), mode);
-  if (*fd == NULL) {
-    return errno;
-  }
-  return 0;
-#endif
-}
-
-}  // namespace google_breakpad
diff --git a/third_party/breakpad/src/client/windows/sender/crash_report_sender.h b/third_party/breakpad/src/client/windows/sender/crash_report_sender.h
deleted file mode 100644
index da1ed0a..0000000
--- a/third_party/breakpad/src/client/windows/sender/crash_report_sender.h
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright (c) 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef CLIENT_WINDOWS_SENDER_CRASH_REPORT_SENDER_H__
-#define CLIENT_WINDOWS_SENDER_CRASH_REPORT_SENDER_H__
-
-// CrashReportSender is a "static" class which provides an API to upload
-// crash reports via HTTP(S).  A crash report is formatted as a multipart POST
-// request, which contains a set of caller-supplied string key/value pairs,
-// and a minidump file to upload.
-//
-// To use this library in your project, you will need to link against
-// wininet.lib.
-
-#pragma warning( push )
-// Disable exception handler warnings.
-#pragma warning( disable : 4530 ) 
-
-#include <map>
-#include <string>
-
-namespace google_breakpad {
-
-using std::wstring;
-using std::map;
-
-typedef enum {
-  RESULT_FAILED = 0,  // Failed to communicate with the server; try later.
-  RESULT_REJECTED,    // Successfully sent the crash report, but the
-                      // server rejected it; don't resend this report.
-  RESULT_SUCCEEDED,   // The server accepted the crash report.
-  RESULT_THROTTLED    // No attempt was made to send the crash report, because
-                      // we exceeded the maximum reports per day.
-} ReportResult;
-
-class CrashReportSender {
- public:
-  // Initializes a CrashReportSender instance.
-  // If checkpoint_file is non-empty, breakpad will persist crash report
-  // state to this file.  A checkpoint file is required for
-  // set_max_reports_per_day() to function properly.
-  explicit CrashReportSender(const wstring &checkpoint_file);
-  ~CrashReportSender() {}
-
-  // Sets the maximum number of crash reports that will be sent in a 24-hour
-  // period.  This uses the state persisted to the checkpoint file.
-  // The default value of -1 means that there is no limit on reports sent.
-  void set_max_reports_per_day(int reports) {
-    max_reports_per_day_ = reports;
-  }
-
-  int max_reports_per_day() const { return max_reports_per_day_; }
-
-  // Sends the specified minidump file, along with the map of
-  // name value pairs, as a multipart POST request to the given URL.
-  // Parameter names must contain only printable ASCII characters,
-  // and may not contain a quote (") character.
-  // Only HTTP(S) URLs are currently supported.  The return value indicates
-  // the result of the operation (see above for possible results).
-  // If report_code is non-NULL and the report is sent successfully (that is,
-  // the return value is RESULT_SUCCEEDED), a code uniquely identifying the
-  // report will be returned in report_code.
-  // (Otherwise, report_code will be unchanged.)
-  ReportResult SendCrashReport(const wstring &url,
-                               const map<wstring, wstring> &parameters,
-                               const wstring &dump_file_name,
-                               wstring *report_code);
-
- private:
-  // Reads persistent state from a checkpoint file.
-  void ReadCheckpoint(FILE *fd);
-
-  // Called when a new report has been sent, to update the checkpoint state.
-  void ReportSent(int today);
-
-  // Returns today's date (UTC) formatted as YYYYMMDD.
-  int GetCurrentDate() const;
-
-  // Opens the checkpoint file with the specified mode.
-  // Returns zero on success, or an error code on failure.
-  int OpenCheckpointFile(const wchar_t *mode, FILE **fd);
-
-  wstring checkpoint_file_;
-  int max_reports_per_day_;
-  // The last date on which we sent a report, expressed as YYYYMMDD.
-  int last_sent_date_;
-  // Number of reports sent on last_sent_date_
-  int reports_sent_;
-
-  // Disallow copy constructor and operator=
-  explicit CrashReportSender(const CrashReportSender &);
-  void operator=(const CrashReportSender &);
-};
-
-}  // namespace google_breakpad
-
-#pragma warning( pop )
-
-#endif  // CLIENT_WINDOWS_SENDER_CRASH_REPORT_SENDER_H__
diff --git a/third_party/breakpad/src/common/windows/guid_string.cc b/third_party/breakpad/src/common/windows/guid_string.cc
deleted file mode 100644
index b7f877e..0000000
--- a/third_party/breakpad/src/common/windows/guid_string.cc
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// guid_string.cc: Convert GUIDs to strings.
-//
-// See guid_string.h for documentation.
-
-#include <wchar.h>
-
-#include "common/windows/string_utils-inl.h"
-
-#include "common/windows/guid_string.h"
-
-namespace google_breakpad {
-
-// static
-wstring GUIDString::GUIDToWString(GUID *guid) {
-  wchar_t guid_string[37];
-  swprintf(
-      guid_string, sizeof(guid_string) / sizeof(guid_string[0]),
-      L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
-      guid->Data1, guid->Data2, guid->Data3,
-      guid->Data4[0], guid->Data4[1], guid->Data4[2],
-      guid->Data4[3], guid->Data4[4], guid->Data4[5],
-      guid->Data4[6], guid->Data4[7]);
-
-  // remove when VC++7.1 is no longer supported
-  guid_string[sizeof(guid_string) / sizeof(guid_string[0]) - 1] = L'\0';
-
-  return wstring(guid_string);
-}
-
-// static
-wstring GUIDString::GUIDToSymbolServerWString(GUID *guid) {
-  wchar_t guid_string[33];
-  swprintf(
-      guid_string, sizeof(guid_string) / sizeof(guid_string[0]),
-      L"%08X%04X%04X%02X%02X%02X%02X%02X%02X%02X%02X",
-      guid->Data1, guid->Data2, guid->Data3,
-      guid->Data4[0], guid->Data4[1], guid->Data4[2],
-      guid->Data4[3], guid->Data4[4], guid->Data4[5],
-      guid->Data4[6], guid->Data4[7]);
-
-  // remove when VC++7.1 is no longer supported
-  guid_string[sizeof(guid_string) / sizeof(guid_string[0]) - 1] = L'\0';
-
-  return wstring(guid_string);
-}
-
-}  // namespace google_breakpad
diff --git a/third_party/breakpad/src/common/windows/guid_string.h b/third_party/breakpad/src/common/windows/guid_string.h
deleted file mode 100644
index f8aa8a2..0000000
--- a/third_party/breakpad/src/common/windows/guid_string.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// guid_string.cc: Convert GUIDs to strings.
-
-#ifndef COMMON_WINDOWS_GUID_STRING_H__
-#define COMMON_WINDOWS_GUID_STRING_H__
-
-#include <Guiddef.h>
-
-#include <string>
-
-namespace google_breakpad {
-
-using std::wstring;
-
-class GUIDString {
- public:
-  // Converts guid to a string in the format recommended by RFC 4122 and
-  // returns the string.
-  static wstring GUIDToWString(GUID *guid);
-
-  // Converts guid to a string formatted as uppercase hexadecimal, with
-  // no separators, and returns the string.  This is the format used for
-  // symbol server identifiers, although identifiers have an age tacked
-  // on to the string.
-  static wstring GUIDToSymbolServerWString(GUID *guid);
-};
-
-}  // namespace google_breakpad
-
-#endif  // COMMON_WINDOWS_GUID_STRING_H__
diff --git a/third_party/breakpad/src/common/windows/http_upload.cc b/third_party/breakpad/src/common/windows/http_upload.cc
deleted file mode 100644
index ddf61f7..0000000
--- a/third_party/breakpad/src/common/windows/http_upload.cc
+++ /dev/null
@@ -1,412 +0,0 @@
-// Copyright (c) 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include <assert.h>
-
-// Disable exception handler warnings.
-#pragma warning( disable : 4530 )
-
-#include <fstream>
-
-#include "common/windows/string_utils-inl.h"
-
-#include "common/windows/http_upload.h"
-
-namespace google_breakpad {
-
-using std::ifstream;
-using std::ios;
-
-static const wchar_t kUserAgent[] = L"Breakpad/1.0 (Windows)";
-
-// Helper class which closes an internet handle when it goes away
-class HTTPUpload::AutoInternetHandle {
- public:
-  explicit AutoInternetHandle(HINTERNET handle) : handle_(handle) {}
-  ~AutoInternetHandle() {
-    if (handle_) {
-      InternetCloseHandle(handle_);
-    }
-  }
-
-  HINTERNET get() { return handle_; }
-
- private:
-  HINTERNET handle_;
-};
-
-// static
-bool HTTPUpload::SendRequest(const wstring &url,
-                             const map<wstring, wstring> &parameters,
-                             const wstring &upload_file,
-                             const wstring &file_part_name,
-                             int *timeout,
-                             wstring *response_body,
-                             int *response_code) {
-  if (response_code) {
-    *response_code = 0;
-  }
-
-  // TODO(bryner): support non-ASCII parameter names
-  if (!CheckParameters(parameters)) {
-    return false;
-  }
-
-  // Break up the URL and make sure we can handle it
-  wchar_t scheme[16], host[256], path[256];
-  URL_COMPONENTS components;
-  memset(&components, 0, sizeof(components));
-  components.dwStructSize = sizeof(components);
-  components.lpszScheme = scheme;
-  components.dwSchemeLength = sizeof(scheme) / sizeof(scheme[0]);
-  components.lpszHostName = host;
-  components.dwHostNameLength = sizeof(host) / sizeof(host[0]);
-  components.lpszUrlPath = path;
-  components.dwUrlPathLength = sizeof(path) / sizeof(path[0]);
-  if (!InternetCrackUrl(url.c_str(), static_cast<DWORD>(url.size()),
-                        0, &components)) {
-    return false;
-  }
-  bool secure = false;
-  if (wcscmp(scheme, L"https") == 0) {
-    secure = true;
-  } else if (wcscmp(scheme, L"http") != 0) {
-    return false;
-  }
-
-  AutoInternetHandle internet(InternetOpen(kUserAgent,
-                                           INTERNET_OPEN_TYPE_PRECONFIG,
-                                           NULL,  // proxy name
-                                           NULL,  // proxy bypass
-                                           0));   // flags
-  if (!internet.get()) {
-    return false;
-  }
-
-  AutoInternetHandle connection(InternetConnect(internet.get(),
-                                                host,
-                                                components.nPort,
-                                                NULL,    // user name
-                                                NULL,    // password
-                                                INTERNET_SERVICE_HTTP,
-                                                0,       // flags
-                                                NULL));  // context
-  if (!connection.get()) {
-    return false;
-  }
-
-  DWORD http_open_flags = secure ? INTERNET_FLAG_SECURE : 0;
-  http_open_flags |= INTERNET_FLAG_NO_COOKIES;
-  AutoInternetHandle request(HttpOpenRequest(connection.get(),
-                                             L"POST",
-                                             path,
-                                             NULL,    // version
-                                             NULL,    // referer
-                                             NULL,    // agent type
-                                             http_open_flags,
-                                             NULL));  // context
-  if (!request.get()) {
-    return false;
-  }
-
-  wstring boundary = GenerateMultipartBoundary();
-  wstring content_type_header = GenerateRequestHeader(boundary);
-  HttpAddRequestHeaders(request.get(),
-                        content_type_header.c_str(),
-                        static_cast<DWORD>(-1),
-                        HTTP_ADDREQ_FLAG_ADD);
-
-  string request_body;
-  if (!GenerateRequestBody(parameters, upload_file,
-                           file_part_name, boundary, &request_body)) {
-    return false;
-  }
-
-  if (timeout) {
-    if (!InternetSetOption(request.get(),
-                           INTERNET_OPTION_SEND_TIMEOUT,
-                           timeout,
-                           sizeof(timeout))) {
-      fwprintf(stderr, L"Could not unset send timeout, continuing...\n");
-    }
-
-    if (!InternetSetOption(request.get(),
-                           INTERNET_OPTION_RECEIVE_TIMEOUT,
-                           timeout,
-                           sizeof(timeout))) {
-      fwprintf(stderr, L"Could not unset receive timeout, continuing...\n");
-    }
-  }
-  
-  if (!HttpSendRequest(request.get(), NULL, 0,
-                       const_cast<char *>(request_body.data()),
-                       static_cast<DWORD>(request_body.size()))) {
-    return false;
-  }
-
-  // The server indicates a successful upload with HTTP status 200.
-  wchar_t http_status[4];
-  DWORD http_status_size = sizeof(http_status);
-  if (!HttpQueryInfo(request.get(), HTTP_QUERY_STATUS_CODE,
-                     static_cast<LPVOID>(&http_status), &http_status_size,
-                     0)) {
-    return false;
-  }
-
-  int http_response = wcstol(http_status, NULL, 10);
-  if (response_code) {
-    *response_code = http_response;
-  }
-
-  bool result = (http_response == 200);
-
-  if (result) {
-    result = ReadResponse(request.get(), response_body);
-  }
-
-  return result;
-}
-
-// static
-bool HTTPUpload::ReadResponse(HINTERNET request, wstring *response) {
-  bool has_content_length_header = false;
-  wchar_t content_length[32];
-  DWORD content_length_size = sizeof(content_length);
-  DWORD claimed_size = 0;
-  string response_body;
-
-  if (HttpQueryInfo(request, HTTP_QUERY_CONTENT_LENGTH,
-                    static_cast<LPVOID>(&content_length),
-                    &content_length_size, 0)) {
-    has_content_length_header = true;
-    claimed_size = wcstol(content_length, NULL, 10);
-    response_body.reserve(claimed_size);
-  }
-
-
-  DWORD bytes_available;
-  DWORD total_read = 0;
-  BOOL return_code;
-
-  while (((return_code = InternetQueryDataAvailable(request, &bytes_available,
-	  0, 0)) != 0) && bytes_available > 0) {
-
-    vector<char> response_buffer(bytes_available);
-    DWORD size_read;
-
-    return_code = InternetReadFile(request,
-                                   &response_buffer[0],
-                                   bytes_available, &size_read);
-
-    if (return_code && size_read > 0) {
-      total_read += size_read;
-      response_body.append(&response_buffer[0], size_read);
-    } else {
-      break;
-    }
-  }
-
-  bool succeeded = return_code && (!has_content_length_header ||
-                                   (total_read == claimed_size));
-  if (succeeded && response) {
-    *response = UTF8ToWide(response_body);
-  }
-
-  return succeeded;
-}
-
-// static
-wstring HTTPUpload::GenerateMultipartBoundary() {
-  // The boundary has 27 '-' characters followed by 16 hex digits
-  static const wchar_t kBoundaryPrefix[] = L"---------------------------";
-  static const int kBoundaryLength = 27 + 16 + 1;
-
-  // Generate some random numbers to fill out the boundary
-  int r0 = rand();
-  int r1 = rand();
-
-  wchar_t temp[kBoundaryLength];
-  swprintf(temp, kBoundaryLength, L"%s%08X%08X", kBoundaryPrefix, r0, r1);
-
-  // remove when VC++7.1 is no longer supported
-  temp[kBoundaryLength - 1] = L'\0';
-
-  return wstring(temp);
-}
-
-// static
-wstring HTTPUpload::GenerateRequestHeader(const wstring &boundary) {
-  wstring header = L"Content-Type: multipart/form-data; boundary=";
-  header += boundary;
-  return header;
-}
-
-// static
-bool HTTPUpload::GenerateRequestBody(const map<wstring, wstring> &parameters,
-                                     const wstring &upload_file,
-                                     const wstring &file_part_name,
-                                     const wstring &boundary,
-                                     string *request_body) {
-  vector<char> contents;
-  if (!GetFileContents(upload_file, &contents)) {
-    return false;
-  }
-
-  string boundary_str = WideToUTF8(boundary);
-  if (boundary_str.empty()) {
-    return false;
-  }
-
-  request_body->clear();
-
-  // Append each of the parameter pairs as a form-data part
-  for (map<wstring, wstring>::const_iterator pos = parameters.begin();
-       pos != parameters.end(); ++pos) {
-    request_body->append("--" + boundary_str + "\r\n");
-    request_body->append("Content-Disposition: form-data; name=\"" +
-                         WideToUTF8(pos->first) + "\"\r\n\r\n" +
-                         WideToUTF8(pos->second) + "\r\n");
-  }
-
-  // Now append the upload file as a binary (octet-stream) part
-  string filename_utf8 = WideToUTF8(upload_file);
-  if (filename_utf8.empty()) {
-    return false;
-  }
-
-  string file_part_name_utf8 = WideToUTF8(file_part_name);
-  if (file_part_name_utf8.empty()) {
-    return false;
-  }
-
-  request_body->append("--" + boundary_str + "\r\n");
-  request_body->append("Content-Disposition: form-data; "
-                       "name=\"" + file_part_name_utf8 + "\"; "
-                       "filename=\"" + filename_utf8 + "\"\r\n");
-  request_body->append("Content-Type: application/octet-stream\r\n");
-  request_body->append("\r\n");
-
-  if (!contents.empty()) {
-      request_body->append(&(contents[0]), contents.size());
-  }
-  request_body->append("\r\n");
-  request_body->append("--" + boundary_str + "--\r\n");
-  return true;
-}
-
-// static
-bool HTTPUpload::GetFileContents(const wstring &filename,
-                                 vector<char> *contents) {
-  // The "open" method on pre-MSVC8 ifstream implementations doesn't accept a
-  // wchar_t* filename, so use _wfopen directly in that case.  For VC8 and
-  // later, _wfopen has been deprecated in favor of _wfopen_s, which does
-  // not exist in earlier versions, so let the ifstream open the file itself.
-#if _MSC_VER >= 1400  // MSVC 2005/8
-  ifstream file;
-  file.open(filename.c_str(), ios::binary);
-#else  // _MSC_VER >= 1400
-  ifstream file(_wfopen(filename.c_str(), L"rb"));
-#endif  // _MSC_VER >= 1400
-  if (file.is_open()) {
-    file.seekg(0, ios::end);
-    std::streamoff length = file.tellg();
-    contents->resize(length);
-    if (length != 0) {
-      file.seekg(0, ios::beg);
-      file.read(&((*contents)[0]), length);
-    }
-    file.close();
-    return true;
-  }
-  return false;
-}
-
-// static
-wstring HTTPUpload::UTF8ToWide(const string &utf8) {
-  if (utf8.length() == 0) {
-    return wstring();
-  }
-
-  // compute the length of the buffer we'll need
-  int charcount = MultiByteToWideChar(CP_UTF8, 0, utf8.c_str(), -1, NULL, 0);
-
-  if (charcount == 0) {
-    return wstring();
-  }
-
-  // convert
-  wchar_t* buf = new wchar_t[charcount];
-  MultiByteToWideChar(CP_UTF8, 0, utf8.c_str(), -1, buf, charcount);
-  wstring result(buf);
-  delete[] buf;
-  return result;
-}
-
-// static
-string HTTPUpload::WideToUTF8(const wstring &wide) {
-  if (wide.length() == 0) {
-    return string();
-  }
-
-  // compute the length of the buffer we'll need
-  int charcount = WideCharToMultiByte(CP_UTF8, 0, wide.c_str(), -1,
-                                      NULL, 0, NULL, NULL);
-  if (charcount == 0) {
-    return string();
-  }
-
-  // convert
-  char *buf = new char[charcount];
-  WideCharToMultiByte(CP_UTF8, 0, wide.c_str(), -1, buf, charcount,
-                      NULL, NULL);
-
-  string result(buf);
-  delete[] buf;
-  return result;
-}
-
-// static
-bool HTTPUpload::CheckParameters(const map<wstring, wstring> &parameters) {
-  for (map<wstring, wstring>::const_iterator pos = parameters.begin();
-       pos != parameters.end(); ++pos) {
-    const wstring &str = pos->first;
-    if (str.size() == 0) {
-      return false;  // disallow empty parameter names
-    }
-    for (unsigned int i = 0; i < str.size(); ++i) {
-      wchar_t c = str[i];
-      if (c < 32 || c == '"' || c > 127) {
-        return false;
-      }
-    }
-  }
-  return true;
-}
-
-}  // namespace google_breakpad
diff --git a/third_party/breakpad/src/common/windows/http_upload.h b/third_party/breakpad/src/common/windows/http_upload.h
deleted file mode 100644
index 8a17aab..0000000
--- a/third_party/breakpad/src/common/windows/http_upload.h
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright (c) 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// HTTPUpload provides a "nice" API to send a multipart HTTP(S) POST
-// request using wininet.  It currently supports requests that contain
-// a set of string parameters (key/value pairs), and a file to upload.
-
-#ifndef COMMON_WINDOWS_HTTP_UPLOAD_H__
-#define COMMON_WINDOWS_HTTP_UPLOAD_H__
-
-#pragma warning( push )
-// Disable exception handler warnings.
-#pragma warning( disable : 4530 ) 
-
-#include <Windows.h>
-#include <WinInet.h>
-
-#include <map>
-#include <string>
-#include <vector>
-
-namespace google_breakpad {
-
-using std::string;
-using std::wstring;
-using std::map;
-using std::vector;
-
-class HTTPUpload {
- public:
-  // Sends the given set of parameters, along with the contents of
-  // upload_file, as a multipart POST request to the given URL.
-  // file_part_name contains the name of the file part of the request
-  // (i.e. it corresponds to the name= attribute on an <input type="file">.
-  // Parameter names must contain only printable ASCII characters,
-  // and may not contain a quote (") character.
-  // Only HTTP(S) URLs are currently supported.  Returns true on success.
-  // If the request is successful and response_body is non-NULL,
-  // the response body will be returned in response_body.
-  // If response_code is non-NULL, it will be set to the HTTP response code
-  // received (or 0 if the request failed before getting an HTTP response).
-  static bool SendRequest(const wstring &url,
-                          const map<wstring, wstring> &parameters,
-                          const wstring &upload_file,
-                          const wstring &file_part_name,
-                          int *timeout,
-                          wstring *response_body,
-                          int *response_code);
-
- private:
-  class AutoInternetHandle;
-
-  // Retrieves the HTTP response.  If NULL is passed in for response,
-  // this merely checks (via the return value) that we were successfully
-  // able to retrieve exactly as many bytes of content in the response as
-  // were specified in the Content-Length header.
-  static bool HTTPUpload::ReadResponse(HINTERNET request, wstring* response);
-
-  // Generates a new multipart boundary for a POST request
-  static wstring GenerateMultipartBoundary();
-
-  // Generates a HTTP request header for a multipart form submit.
-  static wstring GenerateRequestHeader(const wstring &boundary);
-
-  // Given a set of parameters, an upload filename, and a file part name,
-  // generates a multipart request body string with these parameters
-  // and minidump contents.  Returns true on success.
-  static bool GenerateRequestBody(const map<wstring, wstring> &parameters,
-                                  const wstring &upload_file,
-                                  const wstring &file_part_name,
-                                  const wstring &boundary,
-                                  string *request_body);
-
-  // Fills the supplied vector with the contents of filename.
-  static bool GetFileContents(const wstring &filename, vector<char> *contents);
-
-  // Converts a UTF8 string to UTF16.
-  static wstring UTF8ToWide(const string &utf8);
-
-  // Converts a UTF16 string to UTF8.
-  static string WideToUTF8(const wstring &wide);
-
-  // Checks that the given list of parameters has only printable
-  // ASCII characters in the parameter name, and does not contain
-  // any quote (") characters.  Returns true if so.
-  static bool CheckParameters(const map<wstring, wstring> &parameters);
-
-  // No instances of this class should be created.
-  // Disallow all constructors, destructors, and operator=.
-  HTTPUpload();
-  explicit HTTPUpload(const HTTPUpload &);
-  void operator=(const HTTPUpload &);
-  ~HTTPUpload();
-};
-
-}  // namespace google_breakpad
-
-#pragma warning( pop )
-
-#endif  // COMMON_WINDOWS_HTTP_UPLOAD_H__
diff --git a/third_party/breakpad/src/common/windows/string_utils-inl.h b/third_party/breakpad/src/common/windows/string_utils-inl.h
deleted file mode 100644
index d281aaa..0000000
--- a/third_party/breakpad/src/common/windows/string_utils-inl.h
+++ /dev/null
@@ -1,142 +0,0 @@
-// Copyright (c) 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// string_utils-inl.h: Safer string manipulation on Windows, supporting
-// pre-MSVC8 environments.
-
-#ifndef COMMON_WINDOWS_STRING_UTILS_INL_H__
-#define COMMON_WINDOWS_STRING_UTILS_INL_H__
-
-#include <stdarg.h>
-#include <wchar.h>
-
-#include <string>
-
-// The "ll" printf format size specifier corresponding to |long long| was
-// intrudced in MSVC8.  Earlier versions did not provide this size specifier,
-// but "I64" can be used to print 64-bit types.  Don't use "I64" where "ll"
-// is available, in the event of oddball systems where |long long| is not
-// 64 bits wide.
-#if _MSC_VER >= 1400  // MSVC 2005/8
-#define WIN_STRING_FORMAT_LL "ll"
-#else  // MSC_VER >= 1400
-#define WIN_STRING_FORMAT_LL "I64"
-#endif  // MSC_VER >= 1400
-
-// A nonconforming version of swprintf, without the length argument, was
-// included with the CRT prior to MSVC8.  Although a conforming version was
-// also available via an overload, it is not reliably chosen.  _snwprintf
-// behaves as a standards-confirming swprintf should, so force the use of
-// _snwprintf when using older CRTs.
-#if _MSC_VER < 1400  // MSVC 2005/8
-#define swprintf _snwprintf
-#else
-// For MSVC8 and newer, swprintf_s is the recommended method. Conveniently,
-// it takes the same argument list as swprintf.
-#define swprintf swprintf_s
-#endif  // MSC_VER < 1400
-
-namespace google_breakpad {
-
-using std::string;
-using std::wstring;
-
-class WindowsStringUtils {
- public:
-  // Roughly equivalent to MSVC8's wcscpy_s, except pre-MSVC8, this does
-  // not fail if source is longer than destination_size.  The destination
-  // buffer is always 0-terminated.
-  static void safe_wcscpy(wchar_t *destination, size_t destination_size,
-                          const wchar_t *source);
-
-  // Roughly equivalent to MSVC8's wcsncpy_s, except that _TRUNCATE cannot
-  // be passed directly, and pre-MSVC8, this will not fail if source or count
-  // are longer than destination_size.  The destination buffer is always
-  // 0-terminated.
-  static void safe_wcsncpy(wchar_t *destination, size_t destination_size,
-                           const wchar_t *source, size_t count);
-
-  // Performs multi-byte to wide character conversion on C++ strings, using
-  // mbstowcs_s (MSVC8) or mbstowcs (pre-MSVC8).  Returns false on failure,
-  // without setting wcs.
-  static bool safe_mbstowcs(const string &mbs, wstring *wcs);
-
-  // The inverse of safe_mbstowcs.
-  static bool safe_wcstombs(const wstring &wcs, string *mbs);
-
-  // Returns the base name of a file, e.g. strips off the path.
-  static wstring GetBaseName(const wstring &filename);
-
- private:
-  // Disallow instantiation and other object-based operations.
-  WindowsStringUtils();
-  WindowsStringUtils(const WindowsStringUtils&);
-  ~WindowsStringUtils();
-  void operator=(const WindowsStringUtils&);
-};
-
-// static
-inline void WindowsStringUtils::safe_wcscpy(wchar_t *destination,
-                                            size_t destination_size,
-                                            const wchar_t *source) {
-#if _MSC_VER >= 1400  // MSVC 2005/8
-  wcscpy_s(destination, destination_size, source);
-#else  // _MSC_VER >= 1400
-  // Pre-MSVC 2005/8 doesn't have wcscpy_s.  Simulate it with wcsncpy.
-  // wcsncpy doesn't 0-terminate the destination buffer if the source string
-  // is longer than size.  Ensure that the destination is 0-terminated.
-  wcsncpy(destination, source, destination_size);
-  if (destination && destination_size)
-    destination[destination_size - 1] = 0;
-#endif  // _MSC_VER >= 1400
-}
-
-// static
-inline void WindowsStringUtils::safe_wcsncpy(wchar_t *destination,
-                                             size_t destination_size,
-                                             const wchar_t *source,
-                                             size_t count) {
-#if _MSC_VER >= 1400  // MSVC 2005/8
-  wcsncpy_s(destination, destination_size, source, count);
-#else  // _MSC_VER >= 1400
-  // Pre-MSVC 2005/8 doesn't have wcsncpy_s.  Simulate it with wcsncpy.
-  // wcsncpy doesn't 0-terminate the destination buffer if the source string
-  // is longer than size.  Ensure that the destination is 0-terminated.
-  if (destination_size < count)
-    count = destination_size;
-
-  wcsncpy(destination, source, count);
-  if (destination && count)
-    destination[count - 1] = 0;
-#endif  // _MSC_VER >= 1400
-}
-
-}  // namespace google_breakpad
-
-#endif  // COMMON_WINDOWS_STRING_UTILS_INL_H__
diff --git a/third_party/breakpad/src/google_breakpad/common/breakpad_types.h b/third_party/breakpad/src/google_breakpad/common/breakpad_types.h
deleted file mode 100644
index 926b47f..0000000
--- a/third_party/breakpad/src/google_breakpad/common/breakpad_types.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Copyright (c) 2006, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-
-/* breakpad_types.h: Precise-width types
- *
- * (This is C99 source, please don't corrupt it with C++.)
- *
- * This file ensures that types u_intN_t are defined for N = 8, 16, 32, and
- * 64.  Types of precise widths are crucial to the task of writing data
- * structures on one platform and reading them on another.
- *
- * Author: Mark Mentovai */
-
-#ifndef GOOGLE_BREAKPAD_COMMON_BREAKPAD_TYPES_H__
-#define GOOGLE_BREAKPAD_COMMON_BREAKPAD_TYPES_H__
-
-#ifndef _WIN32
-
-#include <sys/types.h>
-#ifndef __STDC_FORMAT_MACROS
-#define __STDC_FORMAT_MACROS
-#endif  /* __STDC_FORMAT_MACROS */
-#include <inttypes.h>
-
-#if defined(__SUNPRO_CC) || (defined(__GNUC__) && defined(__sun__))
-typedef uint8_t u_int8_t;
-typedef uint16_t u_int16_t;
-typedef uint32_t u_int32_t;
-typedef uint64_t u_int64_t;
-#endif
-
-#else  /* !_WIN32 */
-
-#include <WTypes.h>
-
-typedef unsigned __int8  u_int8_t;
-typedef unsigned __int16 u_int16_t;
-typedef unsigned __int32 u_int32_t;
-typedef unsigned __int64 u_int64_t;
-
-#endif  /* !_WIN32 */
-
-typedef struct {
-  u_int64_t high;
-  u_int64_t low;
-} u_int128_t;
-
-typedef u_int64_t breakpad_time_t;
-
-/* Try to get PRIx64 from inttypes.h, but if it's not defined, fall back to
- * llx, which is the format string for "long long" - this is a 64-bit
- * integral type on many systems. */
-#ifndef PRIx64
-#define PRIx64 "llx"
-#endif  /* !PRIx64 */
-
-#endif  /* GOOGLE_BREAKPAD_COMMON_BREAKPAD_TYPES_H__ */
diff --git a/third_party/breakpad/src/google_breakpad/common/minidump_cpu_amd64.h b/third_party/breakpad/src/google_breakpad/common/minidump_cpu_amd64.h
deleted file mode 100644
index 75dae7d..0000000
--- a/third_party/breakpad/src/google_breakpad/common/minidump_cpu_amd64.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/* Copyright (c) 2006, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-
-/* minidump_format.h: A cross-platform reimplementation of minidump-related
- * portions of DbgHelp.h from the Windows Platform SDK.
- *
- * (This is C99 source, please don't corrupt it with C++.)
- *
- * This file contains the necessary definitions to read minidump files
- * produced on amd64.  These files may be read on any platform provided
- * that the alignments of these structures on the processing system are
- * identical to the alignments of these structures on the producing system.
- * For this reason, precise-sized types are used.  The structures defined
- * by this file have been laid out to minimize alignment problems by ensuring
- * ensuring that all members are aligned on their natural boundaries.  In
- * In some cases, tail-padding may be significant when different ABIs specify
- * different tail-padding behaviors.  To avoid problems when reading or
- * writing affected structures, MD_*_SIZE macros are provided where needed,
- * containing the useful size of the structures without padding.
- *
- * Structures that are defined by Microsoft to contain a zero-length array
- * are instead defined here to contain an array with one element, as
- * zero-length arrays are forbidden by standard C and C++.  In these cases,
- * *_minsize constants are provided to be used in place of sizeof.  For a
- * cleaner interface to these sizes when using C++, see minidump_size.h.
- *
- * These structures are also sufficient to populate minidump files.
- *
- * These definitions may be extended to support handling minidump files
- * for other CPUs and other operating systems.
- *
- * Because precise data type sizes are crucial for this implementation to
- * function properly and portably in terms of interoperability with minidumps
- * produced by DbgHelp on Windows, a set of primitive types with known sizes
- * are used as the basis of each structure defined by this file.  DbgHelp
- * on Windows is assumed to be the reference implementation; this file
- * seeks to provide a cross-platform compatible implementation.  To avoid
- * collisions with the types and values defined and used by DbgHelp in the
- * event that this implementation is used on Windows, each type and value
- * defined here is given a new name, beginning with "MD".  Names of the
- * equivalent types and values in the Windows Platform SDK are given in
- * comments.
- *
- * Author: Mark Mentovai 
- * Change to split into its own file: Neal Sidhwaney */
-
-#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_AMD64_H__
-#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_AMD64_H__
-
-
-/*
- * AMD64 support, see WINNT.H
- */
-
-typedef struct {
-  u_int16_t  control_word;
-  u_int16_t  status_word;
-  u_int8_t   tag_word;
-  u_int8_t   reserved1;
-  u_int16_t  error_opcode;
-  u_int32_t  error_offset;
-  u_int16_t  error_selector;
-  u_int16_t  reserved2;
-  u_int32_t  data_offset;
-  u_int16_t  data_selector;
-  u_int16_t  reserved3;
-  u_int32_t  mx_csr;
-  u_int32_t  mx_csr_mask;
-  u_int128_t float_registers[8];
-  u_int128_t xmm_registers[16];
-  u_int8_t   reserved4[96];
-} MDXmmSaveArea32AMD64;  /* XMM_SAVE_AREA32 */
-
-#define MD_CONTEXT_AMD64_VR_COUNT 26
-
-typedef struct {
-  /*
-   * Register parameter home addresses.
-   */
-  u_int64_t  p1_home;
-  u_int64_t  p2_home;
-  u_int64_t  p3_home;
-  u_int64_t  p4_home;
-  u_int64_t  p5_home;
-  u_int64_t  p6_home;
-
-  /* The next field determines the layout of the structure, and which parts
-   * of it are populated */
-  u_int32_t  context_flags;
-  u_int32_t  mx_csr;
-
-  /* The next register is included with MD_CONTEXT_AMD64_CONTROL */
-  u_int16_t  cs;
-
-  /* The next 4 registers are included with MD_CONTEXT_AMD64_SEGMENTS */
-  u_int16_t  ds;
-  u_int16_t  es;
-  u_int16_t  fs;
-  u_int16_t  gs;
-
-  /* The next 2 registers are included with MD_CONTEXT_AMD64_CONTROL */
-  u_int16_t  ss;
-  u_int32_t  eflags;
-  
-  /* The next 6 registers are included with MD_CONTEXT_AMD64_DEBUG_REGISTERS */
-  u_int64_t  dr0;
-  u_int64_t  dr1;
-  u_int64_t  dr2;
-  u_int64_t  dr3;
-  u_int64_t  dr6;
-  u_int64_t  dr7;
-
-  /* The next 4 registers are included with MD_CONTEXT_AMD64_INTEGER */
-  u_int64_t  rax;
-  u_int64_t  rcx;
-  u_int64_t  rdx;
-  u_int64_t  rbx;
-
-  /* The next register is included with MD_CONTEXT_AMD64_CONTROL */
-  u_int64_t  rsp;
-
-  /* The next 11 registers are included with MD_CONTEXT_AMD64_INTEGER */
-  u_int64_t  rbp;
-  u_int64_t  rsi;
-  u_int64_t  rdi;
-  u_int64_t  r8;
-  u_int64_t  r9;
-  u_int64_t  r10;
-  u_int64_t  r11;
-  u_int64_t  r12;
-  u_int64_t  r13;
-  u_int64_t  r14;
-  u_int64_t  r15;
-
-  /* The next register is included with MD_CONTEXT_AMD64_CONTROL */
-  u_int64_t  rip;
-
-  /* The next set of registers are included with
-   * MD_CONTEXT_AMD64_FLOATING_POINT
-   */
-  union {
-    MDXmmSaveArea32AMD64 flt_save;
-    struct {
-      u_int128_t header[2];
-      u_int128_t legacy[8];
-      u_int128_t xmm0;
-      u_int128_t xmm1;
-      u_int128_t xmm2;
-      u_int128_t xmm3;
-      u_int128_t xmm4;
-      u_int128_t xmm5;
-      u_int128_t xmm6;
-      u_int128_t xmm7;
-      u_int128_t xmm8;
-      u_int128_t xmm9;
-      u_int128_t xmm10;
-      u_int128_t xmm11;
-      u_int128_t xmm12;
-      u_int128_t xmm13;
-      u_int128_t xmm14;
-      u_int128_t xmm15;
-    } sse_registers;
-  };
-
-  u_int128_t vector_register[MD_CONTEXT_AMD64_VR_COUNT];
-  u_int64_t  vector_control;
-
-  /* The next 5 registers are included with MD_CONTEXT_AMD64_DEBUG_REGISTERS */
-  u_int64_t debug_control;
-  u_int64_t last_branch_to_rip;
-  u_int64_t last_branch_from_rip;
-  u_int64_t last_exception_to_rip;
-  u_int64_t last_exception_from_rip;
-  
-} MDRawContextAMD64;  /* CONTEXT */
-
-/* For (MDRawContextAMD64).context_flags.  These values indicate the type of
- * context stored in the structure.  The high 26 bits identify the CPU, the
- * low 6 bits identify the type of context saved. */
-#define MD_CONTEXT_AMD64_CONTROL         (MD_CONTEXT_AMD64 | 0x00000001)
-     /* CONTEXT_CONTROL */
-#define MD_CONTEXT_AMD64_INTEGER         (MD_CONTEXT_AMD64 | 0x00000002)
-     /* CONTEXT_INTEGER */
-#define MD_CONTEXT_AMD64_SEGMENTS        (MD_CONTEXT_AMD64 | 0x00000004)
-     /* CONTEXT_SEGMENTS */
-#define MD_CONTEXT_AMD64_FLOATING_POINT  (MD_CONTEXT_AMD64 | 0x00000008)
-     /* CONTEXT_FLOATING_POINT */
-#define MD_CONTEXT_AMD64_DEBUG_REGISTERS (MD_CONTEXT_AMD64 | 0x00000010)
-     /* CONTEXT_DEBUG_REGISTERS */
-/* WinNT.h refers to CONTEXT_MMX_REGISTERS but doesn't appear to define it
- * I think it really means CONTEXT_FLOATING_POINT.
- */
-
-#define MD_CONTEXT_AMD64_FULL            (MD_CONTEXT_AMD64_CONTROL | \
-                                          MD_CONTEXT_AMD64_INTEGER | \
-                                          MD_CONTEXT_AMD64_FLOATING_POINT)
-     /* CONTEXT_FULL */
-
-#define MD_CONTEXT_AMD64_ALL             (MD_CONTEXT_AMD64_FULL | \
-                                          MD_CONTEXT_AMD64_SEGMENTS | \
-                                          MD_CONTEXT_X86_DEBUG_REGISTERS)
-     /* CONTEXT_ALL */
-
-
-#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_AMD64_H__ */
diff --git a/third_party/breakpad/src/google_breakpad/common/minidump_cpu_arm.h b/third_party/breakpad/src/google_breakpad/common/minidump_cpu_arm.h
deleted file mode 100644
index 14d8146..0000000
--- a/third_party/breakpad/src/google_breakpad/common/minidump_cpu_arm.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/* Copyright (c) 2009, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-
-/* minidump_format.h: A cross-platform reimplementation of minidump-related
- * portions of DbgHelp.h from the Windows Platform SDK.
- *
- * (This is C99 source, please don't corrupt it with C++.)
- *
- * This file contains the necessary definitions to read minidump files
- * produced on ARM.  These files may be read on any platform provided
- * that the alignments of these structures on the processing system are
- * identical to the alignments of these structures on the producing system.
- * For this reason, precise-sized types are used.  The structures defined
- * by this file have been laid out to minimize alignment problems by
- * ensuring that all members are aligned on their natural boundaries.
- * In some cases, tail-padding may be significant when different ABIs specify
- * different tail-padding behaviors.  To avoid problems when reading or
- * writing affected structures, MD_*_SIZE macros are provided where needed,
- * containing the useful size of the structures without padding.
- *
- * Structures that are defined by Microsoft to contain a zero-length array
- * are instead defined here to contain an array with one element, as
- * zero-length arrays are forbidden by standard C and C++.  In these cases,
- * *_minsize constants are provided to be used in place of sizeof.  For a
- * cleaner interface to these sizes when using C++, see minidump_size.h.
- *
- * These structures are also sufficient to populate minidump files.
- *
- * Because precise data type sizes are crucial for this implementation to
- * function properly and portably, a set of primitive types with known sizes
- * are used as the basis of each structure defined by this file.
- *
- * Author: Julian Seward
- */
-
-/*
- * ARM support
- */
-
-#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_ARM_H__
-#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_ARM_H__
-
-#define MD_FLOATINGSAVEAREA_ARM_FPR_COUNT 32
-#define MD_FLOATINGSAVEAREA_ARM_FPEXTRA_COUNT 8
-
-/*
- * Note that these structures *do not* map directly to the CONTEXT
- * structure defined in WinNT.h in the Windows Mobile SDK. That structure
- * does not accomodate VFPv3, and I'm unsure if it was ever used in the
- * wild anyway, as Windows CE only seems to produce "cedumps" which
- * are not exactly minidumps.
- */
-typedef struct {
-  u_int64_t	fpscr;      /* FPU status register */
-
-  /* 32 64-bit floating point registers, d0 .. d31. */
-  u_int64_t	regs[MD_FLOATINGSAVEAREA_ARM_FPR_COUNT];
-
-  /* Miscellaneous control words */
-  u_int32_t     extra[MD_FLOATINGSAVEAREA_ARM_FPEXTRA_COUNT];
-} MDFloatingSaveAreaARM;
-
-#define MD_CONTEXT_ARM_GPR_COUNT 16
-
-typedef struct {
-  /* The next field determines the layout of the structure, and which parts
-   * of it are populated
-   */
-  u_int32_t	context_flags;
-
-  /* 16 32-bit integer registers, r0 .. r15
-   * Note the following fixed uses:
-   *   r13 is the stack pointer
-   *   r14 is the link register
-   *   r15 is the program counter
-   */
-  u_int32_t     iregs[MD_CONTEXT_ARM_GPR_COUNT];
-
-  /* CPSR (flags, basically): 32 bits:
-        bit 31 - N (negative)
-        bit 30 - Z (zero)
-        bit 29 - C (carry)
-        bit 28 - V (overflow)
-        bit 27 - Q (saturation flag, sticky)
-     All other fields -- ignore */
-  u_int32_t    cpsr;
-
-  /* The next field is included with MD_CONTEXT_ARM_FLOATING_POINT */
-  MDFloatingSaveAreaARM float_save;
-
-} MDRawContextARM;
-
-/* Indices into iregs for registers with a dedicated or conventional 
- * purpose.
- */
-enum MDARMRegisterNumbers {
-  MD_CONTEXT_ARM_REG_FP = 11,
-  MD_CONTEXT_ARM_REG_SP = 13,
-  MD_CONTEXT_ARM_REG_LR = 14,
-  MD_CONTEXT_ARM_REG_PC = 15
-};
-
-/* For (MDRawContextARM).context_flags.  These values indicate the type of
- * context stored in the structure. */
-#define MD_CONTEXT_ARM_INTEGER           (MD_CONTEXT_ARM | 0x00000002)
-#define MD_CONTEXT_ARM_FLOATING_POINT    (MD_CONTEXT_ARM | 0x00000004)
-
-#define MD_CONTEXT_ARM_FULL              (MD_CONTEXT_ARM_INTEGER | \
-                                          MD_CONTEXT_ARM_FLOATING_POINT)
-
-#define MD_CONTEXT_ARM_ALL               (MD_CONTEXT_ARM_INTEGER | \
-                                          MD_CONTEXT_ARM_FLOATING_POINT)
-
-#endif  /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_ARM_H__ */
diff --git a/third_party/breakpad/src/google_breakpad/common/minidump_cpu_ppc.h b/third_party/breakpad/src/google_breakpad/common/minidump_cpu_ppc.h
deleted file mode 100644
index 038e921..0000000
--- a/third_party/breakpad/src/google_breakpad/common/minidump_cpu_ppc.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/* Copyright (c) 2006, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-
-/* minidump_format.h: A cross-platform reimplementation of minidump-related
- * portions of DbgHelp.h from the Windows Platform SDK.
- *
- * (This is C99 source, please don't corrupt it with C++.)
- *
- * This file contains the necessary definitions to read minidump files
- * produced on ppc.  These files may be read on any platform provided
- * that the alignments of these structures on the processing system are
- * identical to the alignments of these structures on the producing system.
- * For this reason, precise-sized types are used.  The structures defined
- * by this file have been laid out to minimize alignment problems by ensuring
- * ensuring that all members are aligned on their natural boundaries.  In
- * In some cases, tail-padding may be significant when different ABIs specify
- * different tail-padding behaviors.  To avoid problems when reading or
- * writing affected structures, MD_*_SIZE macros are provided where needed,
- * containing the useful size of the structures without padding.
- *
- * Structures that are defined by Microsoft to contain a zero-length array
- * are instead defined here to contain an array with one element, as
- * zero-length arrays are forbidden by standard C and C++.  In these cases,
- * *_minsize constants are provided to be used in place of sizeof.  For a
- * cleaner interface to these sizes when using C++, see minidump_size.h.
- *
- * These structures are also sufficient to populate minidump files.
- *
- * These definitions may be extended to support handling minidump files
- * for other CPUs and other operating systems.
- *
- * Because precise data type sizes are crucial for this implementation to
- * function properly and portably in terms of interoperability with minidumps
- * produced by DbgHelp on Windows, a set of primitive types with known sizes
- * are used as the basis of each structure defined by this file.  DbgHelp
- * on Windows is assumed to be the reference implementation; this file
- * seeks to provide a cross-platform compatible implementation.  To avoid
- * collisions with the types and values defined and used by DbgHelp in the
- * event that this implementation is used on Windows, each type and value
- * defined here is given a new name, beginning with "MD".  Names of the
- * equivalent types and values in the Windows Platform SDK are given in
- * comments.
- *
- * Author: Mark Mentovai 
- * Change to split into its own file: Neal Sidhwaney */
-
-/*
- * Breakpad minidump extension for PowerPC support.  Based on Darwin/Mac OS X'
- * mach/ppc/_types.h
- */
-
-#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_PPC_H__
-#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_PPC_H__
-
-#define MD_FLOATINGSAVEAREA_PPC_FPR_COUNT 32
-
-typedef struct {
-  /* fpregs is a double[32] in mach/ppc/_types.h, but a u_int64_t is used
-   * here for precise sizing. */
-  u_int64_t fpregs[MD_FLOATINGSAVEAREA_PPC_FPR_COUNT];
-  u_int32_t fpscr_pad;
-  u_int32_t fpscr;      /* Status/control */
-} MDFloatingSaveAreaPPC;  /* Based on ppc_float_state */
-
-
-#define MD_VECTORSAVEAREA_PPC_VR_COUNT 32
-
-typedef struct {
-  /* Vector registers (including vscr) are 128 bits, but mach/ppc/_types.h
-   * exposes them as four 32-bit quantities. */
-  u_int128_t save_vr[MD_VECTORSAVEAREA_PPC_VR_COUNT];
-  u_int128_t save_vscr;  /* Status/control */
-  u_int32_t  save_pad5[4];
-  u_int32_t  save_vrvalid;  /* Identifies which vector registers are saved */
-  u_int32_t  save_pad6[7];
-} MDVectorSaveAreaPPC;  /* ppc_vector_state */
-
-
-#define MD_CONTEXT_PPC_GPR_COUNT 32
-
-/* Use the same 32-bit alignment when accessing this structure from 64-bit code
- * as is used natively in 32-bit code.  #pragma pack is a MSVC extension
- * supported by gcc. */
-#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-#pragma pack(4)
-#else
-#pragma pack(push, 4)
-#endif
-
-typedef struct {
-  /* context_flags is not present in ppc_thread_state, but it aids
-   * identification of MDRawContextPPC among other raw context types,
-   * and it guarantees alignment when we get to float_save. */
-  u_int32_t             context_flags;
-
-  u_int32_t             srr0;    /* Machine status save/restore: stores pc
-                                  * (instruction) */
-  u_int32_t             srr1;    /* Machine status save/restore: stores msr
-                                  * (ps, program/machine state) */
-  /* ppc_thread_state contains 32 fields, r0 .. r31.  Here, an array is
-   * used for brevity. */
-  u_int32_t             gpr[MD_CONTEXT_PPC_GPR_COUNT];
-  u_int32_t             cr;      /* Condition */
-  u_int32_t             xer;     /* Integer (fiXed-point) exception */
-  u_int32_t             lr;      /* Link */
-  u_int32_t             ctr;     /* Count */
-  u_int32_t             mq;      /* Multiply/Quotient (PPC 601, POWER only) */
-  u_int32_t             vrsave;  /* Vector save */
-
-  /* float_save and vector_save aren't present in ppc_thread_state, but
-   * are represented in separate structures that still define a thread's
-   * context. */
-  MDFloatingSaveAreaPPC float_save;
-  MDVectorSaveAreaPPC   vector_save;
-} MDRawContextPPC;  /* Based on ppc_thread_state */
-
-#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-#pragma pack(0)
-#else
-#pragma pack(pop)
-#endif
-
-/* For (MDRawContextPPC).context_flags.  These values indicate the type of
- * context stored in the structure.  MD_CONTEXT_PPC is Breakpad-defined.  Its
- * value was chosen to avoid likely conflicts with MD_CONTEXT_* for other
- * CPUs. */
-#define MD_CONTEXT_PPC                0x20000000
-#define MD_CONTEXT_PPC_BASE           (MD_CONTEXT_PPC | 0x00000001)
-#define MD_CONTEXT_PPC_FLOATING_POINT (MD_CONTEXT_PPC | 0x00000008)
-#define MD_CONTEXT_PPC_VECTOR         (MD_CONTEXT_PPC | 0x00000020)
-
-#define MD_CONTEXT_PPC_FULL           MD_CONTEXT_PPC_BASE
-#define MD_CONTEXT_PPC_ALL            (MD_CONTEXT_PPC_FULL | \
-                                       MD_CONTEXT_PPC_FLOATING_POINT | \
-                                       MD_CONTEXT_PPC_VECTOR)
-
-#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_PPC_H__ */
diff --git a/third_party/breakpad/src/google_breakpad/common/minidump_cpu_ppc64.h b/third_party/breakpad/src/google_breakpad/common/minidump_cpu_ppc64.h
deleted file mode 100644
index a788e5d..0000000
--- a/third_party/breakpad/src/google_breakpad/common/minidump_cpu_ppc64.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Copyright (c) 2008, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-
-/* minidump_format.h: A cross-platform reimplementation of minidump-related
- * portions of DbgHelp.h from the Windows Platform SDK.
- *
- * (This is C99 source, please don't corrupt it with C++.)
- *
- * This file contains the necessary definitions to read minidump files
- * produced on ppc64.  These files may be read on any platform provided
- * that the alignments of these structures on the processing system are
- * identical to the alignments of these structures on the producing system.
- * For this reason, precise-sized types are used.  The structures defined
- * by this file have been laid out to minimize alignment problems by ensuring
- * ensuring that all members are aligned on their natural boundaries.  In
- * In some cases, tail-padding may be significant when different ABIs specify
- * different tail-padding behaviors.  To avoid problems when reading or
- * writing affected structures, MD_*_SIZE macros are provided where needed,
- * containing the useful size of the structures without padding.
- *
- * Structures that are defined by Microsoft to contain a zero-length array
- * are instead defined here to contain an array with one element, as
- * zero-length arrays are forbidden by standard C and C++.  In these cases,
- * *_minsize constants are provided to be used in place of sizeof.  For a
- * cleaner interface to these sizes when using C++, see minidump_size.h.
- *
- * These structures are also sufficient to populate minidump files.
- *
- * These definitions may be extended to support handling minidump files
- * for other CPUs and other operating systems.
- *
- * Because precise data type sizes are crucial for this implementation to
- * function properly and portably in terms of interoperability with minidumps
- * produced by DbgHelp on Windows, a set of primitive types with known sizes
- * are used as the basis of each structure defined by this file.  DbgHelp
- * on Windows is assumed to be the reference implementation; this file
- * seeks to provide a cross-platform compatible implementation.  To avoid
- * collisions with the types and values defined and used by DbgHelp in the
- * event that this implementation is used on Windows, each type and value
- * defined here is given a new name, beginning with "MD".  Names of the
- * equivalent types and values in the Windows Platform SDK are given in
- * comments.
- *
- * Author: Neal Sidhwaney */
-
-
-/*
- * Breakpad minidump extension for PPC64 support.  Based on Darwin/Mac OS X'
- * mach/ppc/_types.h
- */
-
-#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_PPC64_H__
-#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_PPC64_H__
-
-#include "minidump_cpu_ppc.h"
-
-// these types are the same in ppc64 & ppc
-typedef MDFloatingSaveAreaPPC MDFloatingSaveAreaPPC64;
-typedef MDVectorSaveAreaPPC MDVectorSaveAreaPPC64;
-
-#define MD_CONTEXT_PPC64_GPR_COUNT MD_CONTEXT_PPC_GPR_COUNT
-
-typedef struct {
-  /* context_flags is not present in ppc_thread_state, but it aids
-   * identification of MDRawContextPPC among other raw context types,
-   * and it guarantees alignment when we get to float_save. */
-  u_int64_t             context_flags;
-
-  u_int64_t             srr0;    /* Machine status save/restore: stores pc
-                                  * (instruction) */
-  u_int64_t             srr1;    /* Machine status save/restore: stores msr
-                                  * (ps, program/machine state) */
-  /* ppc_thread_state contains 32 fields, r0 .. r31.  Here, an array is
-   * used for brevity. */
-  u_int64_t             gpr[MD_CONTEXT_PPC64_GPR_COUNT];
-  u_int64_t             cr;      /* Condition */
-  u_int64_t             xer;     /* Integer (fiXed-point) exception */
-  u_int64_t             lr;      /* Link */
-  u_int64_t             ctr;     /* Count */
-  u_int64_t             vrsave;  /* Vector save */
-
-  /* float_save and vector_save aren't present in ppc_thread_state, but
-   * are represented in separate structures that still define a thread's
-   * context. */
-  MDFloatingSaveAreaPPC float_save;
-  MDVectorSaveAreaPPC   vector_save;
-} MDRawContextPPC64;  /* Based on ppc_thread_state */
-
-/* For (MDRawContextPPC).context_flags.  These values indicate the type of
- * context stored in the structure.  MD_CONTEXT_PPC is Breakpad-defined.  Its
- * value was chosen to avoid likely conflicts with MD_CONTEXT_* for other
- * CPUs. */
-#define MD_CONTEXT_PPC                0x20000000
-#define MD_CONTEXT_PPC_BASE           (MD_CONTEXT_PPC | 0x00000001)
-#define MD_CONTEXT_PPC_FLOATING_POINT (MD_CONTEXT_PPC | 0x00000008)
-#define MD_CONTEXT_PPC_VECTOR         (MD_CONTEXT_PPC | 0x00000020)
-
-#define MD_CONTEXT_PPC_FULL           MD_CONTEXT_PPC_BASE
-#define MD_CONTEXT_PPC_ALL            (MD_CONTEXT_PPC_FULL | \
-                                       MD_CONTEXT_PPC_FLOATING_POINT | \
-                                       MD_CONTEXT_PPC_VECTOR)
-
-#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_PPC64_H__ */
diff --git a/third_party/breakpad/src/google_breakpad/common/minidump_cpu_sparc.h b/third_party/breakpad/src/google_breakpad/common/minidump_cpu_sparc.h
deleted file mode 100644
index ee95b64..0000000
--- a/third_party/breakpad/src/google_breakpad/common/minidump_cpu_sparc.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/* Copyright (c) 2006, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-
-/* minidump_format.h: A cross-platform reimplementation of minidump-related
- * portions of DbgHelp.h from the Windows Platform SDK.
- *
- * (This is C99 source, please don't corrupt it with C++.)
- *
- * This file contains the necessary definitions to read minidump files
- * produced on sparc.  These files may be read on any platform provided
- * that the alignments of these structures on the processing system are
- * identical to the alignments of these structures on the producing system.
- * For this reason, precise-sized types are used.  The structures defined
- * by this file have been laid out to minimize alignment problems by ensuring
- * ensuring that all members are aligned on their natural boundaries.  In
- * In some cases, tail-padding may be significant when different ABIs specify
- * different tail-padding behaviors.  To avoid problems when reading or
- * writing affected structures, MD_*_SIZE macros are provided where needed,
- * containing the useful size of the structures without padding.
- *
- * Structures that are defined by Microsoft to contain a zero-length array
- * are instead defined here to contain an array with one element, as
- * zero-length arrays are forbidden by standard C and C++.  In these cases,
- * *_minsize constants are provided to be used in place of sizeof.  For a
- * cleaner interface to these sizes when using C++, see minidump_size.h.
- *
- * These structures are also sufficient to populate minidump files.
- *
- * These definitions may be extended to support handling minidump files
- * for other CPUs and other operating systems.
- *
- * Because precise data type sizes are crucial for this implementation to
- * function properly and portably in terms of interoperability with minidumps
- * produced by DbgHelp on Windows, a set of primitive types with known sizes
- * are used as the basis of each structure defined by this file.  DbgHelp
- * on Windows is assumed to be the reference implementation; this file
- * seeks to provide a cross-platform compatible implementation.  To avoid
- * collisions with the types and values defined and used by DbgHelp in the
- * event that this implementation is used on Windows, each type and value
- * defined here is given a new name, beginning with "MD".  Names of the
- * equivalent types and values in the Windows Platform SDK are given in
- * comments.
- *
- * Author: Mark Mentovai
- * Change to split into its own file: Neal Sidhwaney */
-
-/*
- * SPARC support, see (solaris)sys/procfs_isa.h also
- */
-
-#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_SPARC_H__
-#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_SPARC_H__
-
-#define MD_FLOATINGSAVEAREA_SPARC_FPR_COUNT 32
-
-typedef struct {
-
-  /* FPU floating point regs */
-  u_int64_t	regs[MD_FLOATINGSAVEAREA_SPARC_FPR_COUNT];
-
-  u_int64_t	filler;
-  u_int64_t	fsr;        /* FPU status register */
-} MDFloatingSaveAreaSPARC;  /* FLOATING_SAVE_AREA */
-
-#define MD_CONTEXT_SPARC_GPR_COUNT 32
-
-typedef struct {
-  /* The next field determines the layout of the structure, and which parts
-   * of it are populated
-   */
-  u_int32_t	context_flags;
-  u_int32_t	flag_pad;
-  /*
-   * General register access (SPARC).
-   * Don't confuse definitions here with definitions in <sys/regset.h>.
-   * Registers are 32 bits for ILP32, 64 bits for LP64.
-   * SPARC V7/V8 is for 32bit, SPARC V9 is for 64bit
-   */
-
-  /* 32 Integer working registers */
-
-  /* g_r[0-7]   global registers(g0-g7)
-   * g_r[8-15]  out registers(o0-o7)
-   * g_r[16-23] local registers(l0-l7)
-   * g_r[24-31] in registers(i0-i7)
-   */
-  u_int64_t     g_r[MD_CONTEXT_SPARC_GPR_COUNT];
-
-  /* several control registers */
-
-  /* Processor State register(PSR) for SPARC V7/V8
-   * Condition Code register (CCR) for SPARC V9
-   */
-  u_int64_t     ccr;
-
-  u_int64_t     pc;     /* Program Counter register (PC) */
-  u_int64_t     npc;    /* Next Program Counter register (nPC) */
-  u_int64_t     y;      /* Y register (Y) */
-
-  /* Address Space Identifier register (ASI) for SPARC V9
-   * WIM for SPARC V7/V8
-   */
-  u_int64_t     asi;
-
-  /* Floating-Point Registers State register (FPRS) for SPARC V9
-   * TBR for for SPARC V7/V8
-   */
-  u_int64_t     fprs;
-
-  /* The next field is included with MD_CONTEXT_SPARC_FLOATING_POINT */
-  MDFloatingSaveAreaSPARC float_save;
-
-} MDRawContextSPARC;  /* CONTEXT_SPARC */
-
-/* For (MDRawContextSPARC).context_flags.  These values indicate the type of
- * context stored in the structure.  MD_CONTEXT_SPARC is Breakpad-defined.  Its
- * value was chosen to avoid likely conflicts with MD_CONTEXT_* for other
- * CPUs. */
-#define MD_CONTEXT_SPARC                 0x10000000
-#define MD_CONTEXT_SPARC_CONTROL         (MD_CONTEXT_SPARC | 0x00000001)
-#define MD_CONTEXT_SPARC_INTEGER         (MD_CONTEXT_SPARC | 0x00000002)
-#define MD_CONTEXT_SAPARC_FLOATING_POINT (MD_CONTEXT_SPARC | 0x00000004)
-#define MD_CONTEXT_SAPARC_EXTRA          (MD_CONTEXT_SPARC | 0x00000008)
-
-#define MD_CONTEXT_SPARC_FULL            (MD_CONTEXT_SPARC_CONTROL | \
-                                          MD_CONTEXT_SPARC_INTEGER)
-
-#define MD_CONTEXT_SPARC_ALL             (MD_CONTEXT_SPARC_FULL | \
-                                          MD_CONTEXT_SAPARC_FLOATING_POINT | \
-                                          MD_CONTEXT_SAPARC_EXTRA)
-
-#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_SPARC_H__ */
diff --git a/third_party/breakpad/src/google_breakpad/common/minidump_cpu_x86.h b/third_party/breakpad/src/google_breakpad/common/minidump_cpu_x86.h
deleted file mode 100644
index 4dbc0e9..0000000
--- a/third_party/breakpad/src/google_breakpad/common/minidump_cpu_x86.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/* Copyright (c) 2006, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-
-/* minidump_format.h: A cross-platform reimplementation of minidump-related
- * portions of DbgHelp.h from the Windows Platform SDK.
- *
- * (This is C99 source, please don't corrupt it with C++.)
- *
- * This file contains the necessary definitions to read minidump files
- * produced on x86.  These files may be read on any platform provided
- * that the alignments of these structures on the processing system are
- * identical to the alignments of these structures on the producing system.
- * For this reason, precise-sized types are used.  The structures defined
- * by this file have been laid out to minimize alignment problems by ensuring
- * ensuring that all members are aligned on their natural boundaries.  In
- * In some cases, tail-padding may be significant when different ABIs specify
- * different tail-padding behaviors.  To avoid problems when reading or
- * writing affected structures, MD_*_SIZE macros are provided where needed,
- * containing the useful size of the structures without padding.
- *
- * Structures that are defined by Microsoft to contain a zero-length array
- * are instead defined here to contain an array with one element, as
- * zero-length arrays are forbidden by standard C and C++.  In these cases,
- * *_minsize constants are provided to be used in place of sizeof.  For a
- * cleaner interface to these sizes when using C++, see minidump_size.h.
- *
- * These structures are also sufficient to populate minidump files.
- *
- * These definitions may be extended to support handling minidump files
- * for other CPUs and other operating systems.
- *
- * Because precise data type sizes are crucial for this implementation to
- * function properly and portably in terms of interoperability with minidumps
- * produced by DbgHelp on Windows, a set of primitive types with known sizes
- * are used as the basis of each structure defined by this file.  DbgHelp
- * on Windows is assumed to be the reference implementation; this file
- * seeks to provide a cross-platform compatible implementation.  To avoid
- * collisions with the types and values defined and used by DbgHelp in the
- * event that this implementation is used on Windows, each type and value
- * defined here is given a new name, beginning with "MD".  Names of the
- * equivalent types and values in the Windows Platform SDK are given in
- * comments.
- *
- * Author: Mark Mentovai */
-
-#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_X86_H__
-#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_X86_H__
-
-#define MD_FLOATINGSAVEAREA_X86_REGISTERAREA_SIZE 80
-     /* SIZE_OF_80387_REGISTERS */
-
-typedef struct {
-  u_int32_t control_word;
-  u_int32_t status_word;
-  u_int32_t tag_word;
-  u_int32_t error_offset;
-  u_int32_t error_selector;
-  u_int32_t data_offset;
-  u_int32_t data_selector;
-
-  /* register_area contains eight 80-bit (x87 "long double") quantities for
-   * floating-point registers %st0 (%mm0) through %st7 (%mm7). */
-  u_int8_t  register_area[MD_FLOATINGSAVEAREA_X86_REGISTERAREA_SIZE];
-  u_int32_t cr0_npx_state;
-} MDFloatingSaveAreaX86;  /* FLOATING_SAVE_AREA */
-
-
-#define MD_CONTEXT_X86_EXTENDED_REGISTERS_SIZE 512
-     /* MAXIMUM_SUPPORTED_EXTENSION */
-
-typedef struct {
-  /* The next field determines the layout of the structure, and which parts
-   * of it are populated */
-  u_int32_t             context_flags;
-
-  /* The next 6 registers are included with MD_CONTEXT_X86_DEBUG_REGISTERS */
-  u_int32_t             dr0;
-  u_int32_t             dr1;
-  u_int32_t             dr2;
-  u_int32_t             dr3;
-  u_int32_t             dr6;
-  u_int32_t             dr7;
-
-  /* The next field is included with MD_CONTEXT_X86_FLOATING_POINT */
-  MDFloatingSaveAreaX86 float_save;
-
-  /* The next 4 registers are included with MD_CONTEXT_X86_SEGMENTS */
-  u_int32_t             gs; 
-  u_int32_t             fs;
-  u_int32_t             es;
-  u_int32_t             ds;
-  /* The next 6 registers are included with MD_CONTEXT_X86_INTEGER */
-  u_int32_t             edi;
-  u_int32_t             esi;
-  u_int32_t             ebx;
-  u_int32_t             edx;
-  u_int32_t             ecx;
-  u_int32_t             eax;
-
-  /* The next 6 registers are included with MD_CONTEXT_X86_CONTROL */
-  u_int32_t             ebp;
-  u_int32_t             eip;
-  u_int32_t             cs;      /* WinNT.h says "must be sanitized" */
-  u_int32_t             eflags;  /* WinNT.h says "must be sanitized" */
-  u_int32_t             esp;
-  u_int32_t             ss;
-
-  /* The next field is included with MD_CONTEXT_X86_EXTENDED_REGISTERS.
-   * It contains vector (MMX/SSE) registers.  It it laid out in the
-   * format used by the fxsave and fsrstor instructions, so it includes
-   * a copy of the x87 floating-point registers as well.  See FXSAVE in
-   * "Intel Architecture Software Developer's Manual, Volume 2." */
-  u_int8_t              extended_registers[
-                         MD_CONTEXT_X86_EXTENDED_REGISTERS_SIZE];
-} MDRawContextX86;  /* CONTEXT */
-
-/* For (MDRawContextX86).context_flags.  These values indicate the type of
- * context stored in the structure.  The high 26 bits identify the CPU, the
- * low 6 bits identify the type of context saved. */
-#define MD_CONTEXT_X86                    0x00010000
-     /* CONTEXT_i386, CONTEXT_i486: identifies CPU */
-#define MD_CONTEXT_X86_CONTROL            (MD_CONTEXT_X86 | 0x00000001)
-     /* CONTEXT_CONTROL */
-#define MD_CONTEXT_X86_INTEGER            (MD_CONTEXT_X86 | 0x00000002)
-     /* CONTEXT_INTEGER */
-#define MD_CONTEXT_X86_SEGMENTS           (MD_CONTEXT_X86 | 0x00000004)
-     /* CONTEXT_SEGMENTS */
-#define MD_CONTEXT_X86_FLOATING_POINT     (MD_CONTEXT_X86 | 0x00000008)
-     /* CONTEXT_FLOATING_POINT */
-#define MD_CONTEXT_X86_DEBUG_REGISTERS    (MD_CONTEXT_X86 | 0x00000010)
-     /* CONTEXT_DEBUG_REGISTERS */
-#define MD_CONTEXT_X86_EXTENDED_REGISTERS (MD_CONTEXT_X86 | 0x00000020)
-     /* CONTEXT_EXTENDED_REGISTERS */
-
-#define MD_CONTEXT_X86_FULL              (MD_CONTEXT_X86_CONTROL | \
-                                          MD_CONTEXT_X86_INTEGER | \
-                                          MD_CONTEXT_X86_SEGMENTS)
-     /* CONTEXT_FULL */
-
-#define MD_CONTEXT_X86_ALL               (MD_CONTEXT_X86_FULL | \
-                                          MD_CONTEXT_X86_FLOATING_POINT | \
-                                          MD_CONTEXT_X86_DEBUG_REGISTERS | \
-                                          MD_CONTEXT_X86_EXTENDED_REGISTERS)
-     /* CONTEXT_ALL */
-
-#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_X86_H__ */
diff --git a/third_party/breakpad/src/google_breakpad/common/minidump_exception_linux.h b/third_party/breakpad/src/google_breakpad/common/minidump_exception_linux.h
deleted file mode 100644
index d52c751..0000000
--- a/third_party/breakpad/src/google_breakpad/common/minidump_exception_linux.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Copyright (c) 2006, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-
-/* minidump_exception_linux.h: A definition of exception codes for
- * Linux
- *
- * (This is C99 source, please don't corrupt it with C++.)
- *
- * Author: Mark Mentovai
- * Split into its own file: Neal Sidhwaney */
- 
-
-#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_LINUX_H__
-#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_LINUX_H__
-
-#include <stddef.h>
-
-#include "google_breakpad/common/breakpad_types.h"
-
-
-/* For (MDException).exception_code.  These values come from bits/signum.h.
- */
-typedef enum {
-  MD_EXCEPTION_CODE_LIN_SIGHUP = 1,      /* Hangup (POSIX) */
-  MD_EXCEPTION_CODE_LIN_SIGINT = 2,      /* Interrupt (ANSI) */
-  MD_EXCEPTION_CODE_LIN_SIGQUIT = 3,     /* Quit (POSIX) */
-  MD_EXCEPTION_CODE_LIN_SIGILL = 4,      /* Illegal instruction (ANSI) */
-  MD_EXCEPTION_CODE_LIN_SIGTRAP = 5,     /* Trace trap (POSIX) */
-  MD_EXCEPTION_CODE_LIN_SIGABRT = 6,     /* Abort (ANSI) */
-  MD_EXCEPTION_CODE_LIN_SIGBUS = 7,      /* BUS error (4.2 BSD) */
-  MD_EXCEPTION_CODE_LIN_SIGFPE = 8,      /* Floating-point exception (ANSI) */
-  MD_EXCEPTION_CODE_LIN_SIGKILL = 9,     /* Kill, unblockable (POSIX) */
-  MD_EXCEPTION_CODE_LIN_SIGUSR1 = 10,    /* User-defined signal 1 (POSIX).  */
-  MD_EXCEPTION_CODE_LIN_SIGSEGV = 11,    /* Segmentation violation (ANSI) */
-  MD_EXCEPTION_CODE_LIN_SIGUSR2 = 12,    /* User-defined signal 2 (POSIX) */
-  MD_EXCEPTION_CODE_LIN_SIGPIPE = 13,    /* Broken pipe (POSIX) */
-  MD_EXCEPTION_CODE_LIN_SIGALRM = 14,    /* Alarm clock (POSIX) */
-  MD_EXCEPTION_CODE_LIN_SIGTERM = 15,    /* Termination (ANSI) */
-  MD_EXCEPTION_CODE_LIN_SIGSTKFLT = 16,  /* Stack faultd */
-  MD_EXCEPTION_CODE_LIN_SIGCHLD = 17,    /* Child status has changed (POSIX) */
-  MD_EXCEPTION_CODE_LIN_SIGCONT = 18,    /* Continue (POSIX) */
-  MD_EXCEPTION_CODE_LIN_SIGSTOP = 19,    /* Stop, unblockable (POSIX) */
-  MD_EXCEPTION_CODE_LIN_SIGTSTP = 20,    /* Keyboard stop (POSIX) */
-  MD_EXCEPTION_CODE_LIN_SIGTTIN = 21,    /* Background read from tty (POSIX) */
-  MD_EXCEPTION_CODE_LIN_SIGTTOU = 22,    /* Background write to tty (POSIX) */
-  MD_EXCEPTION_CODE_LIN_SIGURG = 23,
-    /* Urgent condition on socket (4.2 BSD) */
-  MD_EXCEPTION_CODE_LIN_SIGXCPU = 24,    /* CPU limit exceeded (4.2 BSD) */
-  MD_EXCEPTION_CODE_LIN_SIGXFSZ = 25,
-    /* File size limit exceeded (4.2 BSD) */
-  MD_EXCEPTION_CODE_LIN_SIGVTALRM = 26,  /* Virtual alarm clock (4.2 BSD) */
-  MD_EXCEPTION_CODE_LIN_SIGPROF = 27,    /* Profiling alarm clock (4.2 BSD) */
-  MD_EXCEPTION_CODE_LIN_SIGWINCH = 28,   /* Window size change (4.3 BSD, Sun) */
-  MD_EXCEPTION_CODE_LIN_SIGIO = 29,      /* I/O now possible (4.2 BSD) */
-  MD_EXCEPTION_CODE_LIN_SIGPWR = 30,     /* Power failure restart (System V) */
-  MD_EXCEPTION_CODE_LIN_SIGSYS = 31      /* Bad system call */
-} MDExceptionCodeLinux;
-
-#endif  /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_LINUX_H__ */
diff --git a/third_party/breakpad/src/google_breakpad/common/minidump_exception_mac.h b/third_party/breakpad/src/google_breakpad/common/minidump_exception_mac.h
deleted file mode 100644
index 5fba44c..0000000
--- a/third_party/breakpad/src/google_breakpad/common/minidump_exception_mac.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/* Copyright (c) 2006, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-
-/* minidump_exception_mac.h: A definition of exception codes for Mac
- * OS X
- *
- * (This is C99 source, please don't corrupt it with C++.)
- *
- * Author: Mark Mentovai
- * Split into its own file: Neal Sidhwaney */
- 
-
-#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_MAC_H__
-#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_MAC_H__
-
-#include <stddef.h>
-
-#include "google_breakpad/common/breakpad_types.h"
-
-/* For (MDException).exception_code.  Breakpad minidump extension for Mac OS X
- * support.  Based on Darwin/Mac OS X' mach/exception_types.h.  This is
- * what Mac OS X calls an "exception", not a "code". */
-typedef enum {
-  /* Exception code.  The high 16 bits of exception_code contains one of
-   * these values. */
-  MD_EXCEPTION_MAC_BAD_ACCESS      = 1,  /* code can be a kern_return_t */
-      /* EXC_BAD_ACCESS */
-  MD_EXCEPTION_MAC_BAD_INSTRUCTION = 2,  /* code is CPU-specific */
-      /* EXC_BAD_INSTRUCTION */
-  MD_EXCEPTION_MAC_ARITHMETIC      = 3,  /* code is CPU-specific */
-      /* EXC_ARITHMETIC */
-  MD_EXCEPTION_MAC_EMULATION       = 4,  /* code is CPU-specific */
-      /* EXC_EMULATION */
-  MD_EXCEPTION_MAC_SOFTWARE        = 5,
-      /* EXC_SOFTWARE */
-  MD_EXCEPTION_MAC_BREAKPOINT      = 6,  /* code is CPU-specific */
-      /* EXC_BREAKPOINT */
-  MD_EXCEPTION_MAC_SYSCALL         = 7,
-      /* EXC_SYSCALL */
-  MD_EXCEPTION_MAC_MACH_SYSCALL    = 8,
-      /* EXC_MACH_SYSCALL */
-  MD_EXCEPTION_MAC_RPC_ALERT       = 9
-      /* EXC_RPC_ALERT */
-} MDExceptionMac;
-
-/* For (MDException).exception_flags.  Breakpad minidump extension for Mac OS X
- * support.  Based on Darwin/Mac OS X' mach/ppc/exception.h and
- * mach/i386/exception.h.  This is what Mac OS X calls a "code". */
-typedef enum {
-  /* With MD_EXCEPTION_BAD_ACCESS.  These are relevant kern_return_t values
-   * from mach/kern_return.h. */
-  MD_EXCEPTION_CODE_MAC_INVALID_ADDRESS    =  1,
-      /* KERN_INVALID_ADDRESS */
-  MD_EXCEPTION_CODE_MAC_PROTECTION_FAILURE =  2,
-      /* KERN_PROTECTION_FAILURE */
-  MD_EXCEPTION_CODE_MAC_NO_ACCESS          =  8,
-      /* KERN_NO_ACCESS */
-  MD_EXCEPTION_CODE_MAC_MEMORY_FAILURE     =  9,
-      /* KERN_MEMORY_FAILURE */
-  MD_EXCEPTION_CODE_MAC_MEMORY_ERROR       = 10,
-      /* KERN_MEMORY_ERROR */
-
-  /* With MD_EXCEPTION_SOFTWARE */
-  MD_EXCEPTION_CODE_MAC_BAD_SYSCALL = 0x00010000,  /* Mach SIGSYS */
-  MD_EXCEPTION_CODE_MAC_BAD_PIPE    = 0x00010001,  /* Mach SIGPIPE */
-  MD_EXCEPTION_CODE_MAC_ABORT       = 0x00010002,  /* Mach SIGABRT */
-
-  /* With MD_EXCEPTION_MAC_BAD_ACCESS on ppc */
-  MD_EXCEPTION_CODE_MAC_PPC_VM_PROT_READ = 0x0101,
-      /* EXC_PPC_VM_PROT_READ */
-  MD_EXCEPTION_CODE_MAC_PPC_BADSPACE     = 0x0102,
-      /* EXC_PPC_BADSPACE */
-  MD_EXCEPTION_CODE_MAC_PPC_UNALIGNED    = 0x0103,
-      /* EXC_PPC_UNALIGNED */
-
-  /* With MD_EXCEPTION_MAC_BAD_INSTRUCTION on ppc */
-  MD_EXCEPTION_CODE_MAC_PPC_INVALID_SYSCALL           = 1,
-      /* EXC_PPC_INVALID_SYSCALL */
-  MD_EXCEPTION_CODE_MAC_PPC_UNIMPLEMENTED_INSTRUCTION = 2,
-      /* EXC_PPC_UNIPL_INST */
-  MD_EXCEPTION_CODE_MAC_PPC_PRIVILEGED_INSTRUCTION    = 3,
-      /* EXC_PPC_PRIVINST */
-  MD_EXCEPTION_CODE_MAC_PPC_PRIVILEGED_REGISTER       = 4,
-      /* EXC_PPC_PRIVREG */
-  MD_EXCEPTION_CODE_MAC_PPC_TRACE                     = 5,
-      /* EXC_PPC_TRACE */
-  MD_EXCEPTION_CODE_MAC_PPC_PERFORMANCE_MONITOR       = 6,
-      /* EXC_PPC_PERFMON */
-
-  /* With MD_EXCEPTION_MAC_ARITHMETIC on ppc */
-  MD_EXCEPTION_CODE_MAC_PPC_OVERFLOW           = 1,
-      /* EXC_PPC_OVERFLOW */
-  MD_EXCEPTION_CODE_MAC_PPC_ZERO_DIVIDE        = 2,
-      /* EXC_PPC_ZERO_DIVIDE */
-  MD_EXCEPTION_CODE_MAC_PPC_FLOAT_INEXACT      = 3,
-      /* EXC_FLT_INEXACT */
-  MD_EXCEPTION_CODE_MAC_PPC_FLOAT_ZERO_DIVIDE  = 4,
-      /* EXC_PPC_FLT_ZERO_DIVIDE */
-  MD_EXCEPTION_CODE_MAC_PPC_FLOAT_UNDERFLOW    = 5,
-      /* EXC_PPC_FLT_UNDERFLOW */
-  MD_EXCEPTION_CODE_MAC_PPC_FLOAT_OVERFLOW     = 6,
-      /* EXC_PPC_FLT_OVERFLOW */
-  MD_EXCEPTION_CODE_MAC_PPC_FLOAT_NOT_A_NUMBER = 7,
-      /* EXC_PPC_FLT_NOT_A_NUMBER */
-
-  /* With MD_EXCEPTION_MAC_EMULATION on ppc */
-  MD_EXCEPTION_CODE_MAC_PPC_NO_EMULATION   = 8,
-      /* EXC_PPC_NOEMULATION */
-  MD_EXCEPTION_CODE_MAC_PPC_ALTIVEC_ASSIST = 9,
-      /* EXC_PPC_ALTIVECASSIST */
-
-  /* With MD_EXCEPTION_MAC_SOFTWARE on ppc */
-  MD_EXCEPTION_CODE_MAC_PPC_TRAP    = 0x00000001,  /* EXC_PPC_TRAP */
-  MD_EXCEPTION_CODE_MAC_PPC_MIGRATE = 0x00010100,  /* EXC_PPC_MIGRATE */
-
-  /* With MD_EXCEPTION_MAC_BREAKPOINT on ppc */
-  MD_EXCEPTION_CODE_MAC_PPC_BREAKPOINT = 1,  /* EXC_PPC_BREAKPOINT */
-
-  /* With MD_EXCEPTION_MAC_BAD_INSTRUCTION on x86, see also x86 interrupt
-   * values below. */
-  MD_EXCEPTION_CODE_MAC_X86_INVALID_OPERATION = 1,  /* EXC_I386_INVOP */
-
-  /* With MD_EXCEPTION_MAC_ARITHMETIC on x86 */
-  MD_EXCEPTION_CODE_MAC_X86_DIV       = 1,  /* EXC_I386_DIV */
-  MD_EXCEPTION_CODE_MAC_X86_INTO      = 2,  /* EXC_I386_INTO */
-  MD_EXCEPTION_CODE_MAC_X86_NOEXT     = 3,  /* EXC_I386_NOEXT */
-  MD_EXCEPTION_CODE_MAC_X86_EXTOVR    = 4,  /* EXC_I386_EXTOVR */
-  MD_EXCEPTION_CODE_MAC_X86_EXTERR    = 5,  /* EXC_I386_EXTERR */
-  MD_EXCEPTION_CODE_MAC_X86_EMERR     = 6,  /* EXC_I386_EMERR */
-  MD_EXCEPTION_CODE_MAC_X86_BOUND     = 7,  /* EXC_I386_BOUND */
-  MD_EXCEPTION_CODE_MAC_X86_SSEEXTERR = 8,  /* EXC_I386_SSEEXTERR */
-
-  /* With MD_EXCEPTION_MAC_BREAKPOINT on x86 */
-  MD_EXCEPTION_CODE_MAC_X86_SGL = 1,  /* EXC_I386_SGL */
-  MD_EXCEPTION_CODE_MAC_X86_BPT = 2,  /* EXC_I386_BPT */
-
-  /* With MD_EXCEPTION_MAC_BAD_INSTRUCTION on x86.  These are the raw
-   * x86 interrupt codes.  Most of these are mapped to other Mach
-   * exceptions and codes, are handled, or should not occur in user space.
-   * A few of these will do occur with MD_EXCEPTION_MAC_BAD_INSTRUCTION. */
-  /* EXC_I386_DIVERR    =  0: mapped to EXC_ARITHMETIC/EXC_I386_DIV */
-  /* EXC_I386_SGLSTP    =  1: mapped to EXC_BREAKPOINT/EXC_I386_SGL */
-  /* EXC_I386_NMIFLT    =  2: should not occur in user space */
-  /* EXC_I386_BPTFLT    =  3: mapped to EXC_BREAKPOINT/EXC_I386_BPT */
-  /* EXC_I386_INTOFLT   =  4: mapped to EXC_ARITHMETIC/EXC_I386_INTO */
-  /* EXC_I386_BOUNDFLT  =  5: mapped to EXC_ARITHMETIC/EXC_I386_BOUND */
-  /* EXC_I386_INVOPFLT  =  6: mapped to EXC_BAD_INSTRUCTION/EXC_I386_INVOP */
-  /* EXC_I386_NOEXTFLT  =  7: should be handled by the kernel */
-  /* EXC_I386_DBLFLT    =  8: should be handled (if possible) by the kernel */
-  /* EXC_I386_EXTOVRFLT =  9: mapped to EXC_BAD_ACCESS/(PROT_READ|PROT_EXEC) */
-  MD_EXCEPTION_CODE_MAC_X86_INVALID_TASK_STATE_SEGMENT = 10,
-      /* EXC_INVTSSFLT */
-  MD_EXCEPTION_CODE_MAC_X86_SEGMENT_NOT_PRESENT        = 11,
-      /* EXC_SEGNPFLT */
-  MD_EXCEPTION_CODE_MAC_X86_STACK_FAULT                = 12,
-      /* EXC_STKFLT */
-  MD_EXCEPTION_CODE_MAC_X86_GENERAL_PROTECTION_FAULT   = 13,
-      /* EXC_GPFLT */
-  /* EXC_I386_PGFLT     = 14: should not occur in user space */
-  /* EXC_I386_EXTERRFLT = 16: mapped to EXC_ARITHMETIC/EXC_I386_EXTERR */
-  MD_EXCEPTION_CODE_MAC_X86_ALIGNMENT_FAULT            = 17
-      /* EXC_ALIGNFLT (for vector operations) */
-  /* EXC_I386_ENOEXTFLT = 32: should be handled by the kernel */
-  /* EXC_I386_ENDPERR   = 33: should not occur */
-} MDExceptionCodeMac;
-
-#endif  /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_MAC_OSX_H__ */
diff --git a/third_party/breakpad/src/google_breakpad/common/minidump_exception_solaris.h b/third_party/breakpad/src/google_breakpad/common/minidump_exception_solaris.h
deleted file mode 100644
index f18ddf4..0000000
--- a/third_party/breakpad/src/google_breakpad/common/minidump_exception_solaris.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Copyright (c) 2006, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-
-/* minidump_exception_solaris.h: A definition of exception codes for
- * Solaris
- *
- * (This is C99 source, please don't corrupt it with C++.)
- *
- * Author: Mark Mentovai
- * Split into its own file: Neal Sidhwaney */
-
-
-#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_SOLARIS_H__
-#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_SOLARIS_H__
-
-#include <stddef.h>
-
-#include "google_breakpad/common/breakpad_types.h"
-
-/* For (MDException).exception_code.  These values come from sys/iso/signal_iso.h
- */
-typedef enum {
-  MD_EXCEPTION_CODE_SOL_SIGHUP = 1,      /* Hangup */
-  MD_EXCEPTION_CODE_SOL_SIGINT = 2,      /* interrupt (rubout) */
-  MD_EXCEPTION_CODE_SOL_SIGQUIT = 3,     /* quit (ASCII FS) */
-  MD_EXCEPTION_CODE_SOL_SIGILL = 4,      /* illegal instruction (not reset when caught) */
-  MD_EXCEPTION_CODE_SOL_SIGTRAP = 5,     /* trace trap (not reset when caught) */
-  MD_EXCEPTION_CODE_SOL_SIGIOT = 6,      /* IOT instruction */
-  MD_EXCEPTION_CODE_SOL_SIGABRT = 6,     /* used by abort, replace SIGIOT in the future */
-  MD_EXCEPTION_CODE_SOL_SIGEMT = 7,      /* EMT instruction */
-  MD_EXCEPTION_CODE_SOL_SIGFPE = 8,      /* floating point exception */
-  MD_EXCEPTION_CODE_SOL_SIGKILL = 9,     /* kill (cannot be caught or ignored) */
-  MD_EXCEPTION_CODE_SOL_SIGBUS = 10,     /* bus error */
-  MD_EXCEPTION_CODE_SOL_SIGSEGV = 11,    /* segmentation violation */
-  MD_EXCEPTION_CODE_SOL_SIGSYS = 12,     /* bad argument to system call */
-  MD_EXCEPTION_CODE_SOL_SIGPIPE = 13,    /* write on a pipe with no one to read it */
-  MD_EXCEPTION_CODE_SOL_SIGALRM = 14,    /* alarm clock */
-  MD_EXCEPTION_CODE_SOL_SIGTERM = 15,    /* software termination signal from kill */
-  MD_EXCEPTION_CODE_SOL_SIGUSR1 = 16,    /* user defined signal 1 */
-  MD_EXCEPTION_CODE_SOL_SIGUSR2 = 17,    /* user defined signal 2 */
-  MD_EXCEPTION_CODE_SOL_SIGCLD = 18,     /* child status change */
-  MD_EXCEPTION_CODE_SOL_SIGCHLD = 18,    /* child status change alias (POSIX) */
-  MD_EXCEPTION_CODE_SOL_SIGPWR = 19,     /* power-fail restart */
-  MD_EXCEPTION_CODE_SOL_SIGWINCH = 20,   /* window size change */
-  MD_EXCEPTION_CODE_SOL_SIGURG = 21,     /* urgent socket condition */
-  MD_EXCEPTION_CODE_SOL_SIGPOLL = 22,    /* pollable event occurred */
-  MD_EXCEPTION_CODE_SOL_SIGIO = 22,      /* socket I/O possible (SIGPOLL alias) */
-  MD_EXCEPTION_CODE_SOL_SIGSTOP = 23,    /* stop (cannot be caught or ignored) */
-  MD_EXCEPTION_CODE_SOL_SIGTSTP = 24,    /* user stop requested from tty */
-  MD_EXCEPTION_CODE_SOL_SIGCONT = 25,    /* stopped process has been continued */
-  MD_EXCEPTION_CODE_SOL_SIGTTIN = 26,    /* background tty read attempted */
-  MD_EXCEPTION_CODE_SOL_SIGTTOU = 27,    /* background tty write attempted */
-  MD_EXCEPTION_CODE_SOL_SIGVTALRM = 28,  /* virtual timer expired */
-  MD_EXCEPTION_CODE_SOL_SIGPROF = 29,    /* profiling timer expired */
-  MD_EXCEPTION_CODE_SOL_SIGXCPU = 30,    /* exceeded cpu limit */
-  MD_EXCEPTION_CODE_SOL_SIGXFSZ = 31,    /* exceeded file size limit */
-  MD_EXCEPTION_CODE_SOL_SIGWAITING = 32, /* reserved signal no longer used by threading code */
-  MD_EXCEPTION_CODE_SOL_SIGLWP = 33,     /* reserved signal no longer used by threading code */
-  MD_EXCEPTION_CODE_SOL_SIGFREEZE = 34,  /* special signal used by CPR */
-  MD_EXCEPTION_CODE_SOL_SIGTHAW = 35,    /* special signal used by CPR */
-  MD_EXCEPTION_CODE_SOL_SIGCANCEL = 36,  /* reserved signal for thread cancellation */
-  MD_EXCEPTION_CODE_SOL_SIGLOST = 37,    /* resource lost (eg, record-lock lost) */
-  MD_EXCEPTION_CODE_SOL_SIGXRES = 38,    /* resource control exceeded */
-  MD_EXCEPTION_CODE_SOL_SIGJVM1 = 39,    /* reserved signal for Java Virtual Machine */
-  MD_EXCEPTION_CODE_SOL_SIGJVM2 = 40     /* reserved signal for Java Virtual Machine */
-} MDExceptionCodeSolaris;
-
-#endif  /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_SOLARIS_H__ */
diff --git a/third_party/breakpad/src/google_breakpad/common/minidump_exception_win32.h b/third_party/breakpad/src/google_breakpad/common/minidump_exception_win32.h
deleted file mode 100644
index 458a705..0000000
--- a/third_party/breakpad/src/google_breakpad/common/minidump_exception_win32.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Copyright (c) 2006, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-
-/* minidump_exception_win32.h: Definitions of exception codes for
- * Win32 platform
- *
- * (This is C99 source, please don't corrupt it with C++.)
- *
- * Author: Mark Mentovai
- * Split into its own file: Neal Sidhwaney */
-
-
-#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_WIN32_H__
-#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_WIN32_H__
-
-#include <stddef.h>
-
-#include "google_breakpad/common/breakpad_types.h"
-
-
-/* For (MDException).exception_code.  These values come from WinBase.h
- * and WinNT.h (names beginning with EXCEPTION_ are in WinBase.h,
- * they are STATUS_ in WinNT.h). */
-typedef enum {
-  MD_EXCEPTION_CODE_WIN_CONTROL_C                = 0x40010005,
-      /* DBG_CONTROL_C */
-  MD_EXCEPTION_CODE_WIN_GUARD_PAGE_VIOLATION     = 0x80000001,
-      /* EXCEPTION_GUARD_PAGE */
-  MD_EXCEPTION_CODE_WIN_DATATYPE_MISALIGNMENT    = 0x80000002,
-      /* EXCEPTION_DATATYPE_MISALIGNMENT */
-  MD_EXCEPTION_CODE_WIN_BREAKPOINT               = 0x80000003,
-      /* EXCEPTION_BREAKPOINT */
-  MD_EXCEPTION_CODE_WIN_SINGLE_STEP              = 0x80000004,
-      /* EXCEPTION_SINGLE_STEP */
-  MD_EXCEPTION_CODE_WIN_ACCESS_VIOLATION         = 0xc0000005,
-      /* EXCEPTION_ACCESS_VIOLATION */
-  MD_EXCEPTION_CODE_WIN_IN_PAGE_ERROR            = 0xc0000006,
-      /* EXCEPTION_IN_PAGE_ERROR */
-  MD_EXCEPTION_CODE_WIN_INVALID_HANDLE           = 0xc0000008,
-      /* EXCEPTION_INVALID_HANDLE */
-  MD_EXCEPTION_CODE_WIN_ILLEGAL_INSTRUCTION      = 0xc000001d,
-      /* EXCEPTION_ILLEGAL_INSTRUCTION */
-  MD_EXCEPTION_CODE_WIN_NONCONTINUABLE_EXCEPTION = 0xc0000025,
-      /* EXCEPTION_NONCONTINUABLE_EXCEPTION */
-  MD_EXCEPTION_CODE_WIN_INVALID_DISPOSITION      = 0xc0000026,
-      /* EXCEPTION_INVALID_DISPOSITION */
-  MD_EXCEPTION_CODE_WIN_ARRAY_BOUNDS_EXCEEDED    = 0xc000008c,
-      /* EXCEPTION_BOUNDS_EXCEEDED */
-  MD_EXCEPTION_CODE_WIN_FLOAT_DENORMAL_OPERAND   = 0xc000008d,
-      /* EXCEPTION_FLT_DENORMAL_OPERAND */
-  MD_EXCEPTION_CODE_WIN_FLOAT_DIVIDE_BY_ZERO     = 0xc000008e,
-      /* EXCEPTION_FLT_DIVIDE_BY_ZERO */
-  MD_EXCEPTION_CODE_WIN_FLOAT_INEXACT_RESULT     = 0xc000008f,
-      /* EXCEPTION_FLT_INEXACT_RESULT */
-  MD_EXCEPTION_CODE_WIN_FLOAT_INVALID_OPERATION  = 0xc0000090,
-      /* EXCEPTION_FLT_INVALID_OPERATION */
-  MD_EXCEPTION_CODE_WIN_FLOAT_OVERFLOW           = 0xc0000091,
-      /* EXCEPTION_FLT_OVERFLOW */
-  MD_EXCEPTION_CODE_WIN_FLOAT_STACK_CHECK        = 0xc0000092,
-      /* EXCEPTION_FLT_STACK_CHECK */
-  MD_EXCEPTION_CODE_WIN_FLOAT_UNDERFLOW          = 0xc0000093,
-      /* EXCEPTION_FLT_UNDERFLOW */
-  MD_EXCEPTION_CODE_WIN_INTEGER_DIVIDE_BY_ZERO   = 0xc0000094,
-      /* EXCEPTION_INT_DIVIDE_BY_ZERO */
-  MD_EXCEPTION_CODE_WIN_INTEGER_OVERFLOW         = 0xc0000095,
-      /* EXCEPTION_INT_OVERFLOW */
-  MD_EXCEPTION_CODE_WIN_PRIVILEGED_INSTRUCTION   = 0xc0000096,
-      /* EXCEPTION_PRIV_INSTRUCTION */
-  MD_EXCEPTION_CODE_WIN_STACK_OVERFLOW           = 0xc00000fd,
-      /* EXCEPTION_STACK_OVERFLOW */
-  MD_EXCEPTION_CODE_WIN_POSSIBLE_DEADLOCK        = 0xc0000194,
-      /* EXCEPTION_POSSIBLE_DEADLOCK */
-  MD_EXCEPTION_CODE_WIN_STACK_BUFFER_OVERRUN     = 0xc0000409,
-      /* STATUS_STACK_BUFFER_OVERRUN */
-  MD_EXCEPTION_CODE_WIN_HEAP_CORRUPTION          = 0xc0000374,
-      /* STATUS_HEAP_CORRUPTION */
-  MD_EXCEPTION_CODE_WIN_UNHANDLED_CPP_EXCEPTION  = 0xe06d7363
-      /* Per http://support.microsoft.com/kb/185294,
-         generated by Visual C++ compiler */
-} MDExceptionCodeWin;
-
-// These constants are defined in the MSDN documentation of
-// the EXCEPTION_RECORD structure.
-typedef enum {
-  MD_ACCESS_VIOLATION_WIN_READ  = 0,
-  MD_ACCESS_VIOLATION_WIN_WRITE = 1,
-  MD_ACCESS_VIOLATION_WIN_EXEC  = 8
-} MDAccessViolationTypeWin;
-
-#endif  /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_WIN32_H__ */
diff --git a/third_party/breakpad/src/google_breakpad/common/minidump_format.h b/third_party/breakpad/src/google_breakpad/common/minidump_format.h
deleted file mode 100644
index 77f28ca..0000000
--- a/third_party/breakpad/src/google_breakpad/common/minidump_format.h
+++ /dev/null
@@ -1,792 +0,0 @@
-/* Copyright (c) 2006, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-
-/* minidump_format.h: A cross-platform reimplementation of minidump-related
- * portions of DbgHelp.h from the Windows Platform SDK.
- *
- * (This is C99 source, please don't corrupt it with C++.)
- *
- * Structures that are defined by Microsoft to contain a zero-length array
- * are instead defined here to contain an array with one element, as
- * zero-length arrays are forbidden by standard C and C++.  In these cases,
- * *_minsize constants are provided to be used in place of sizeof.  For a
- * cleaner interface to these sizes when using C++, see minidump_size.h.
- *
- * These structures are also sufficient to populate minidump files.
- *
- * These definitions may be extended to support handling minidump files
- * for other CPUs and other operating systems.
- *
- * Because precise data type sizes are crucial for this implementation to
- * function properly and portably in terms of interoperability with minidumps
- * produced by DbgHelp on Windows, a set of primitive types with known sizes
- * are used as the basis of each structure defined by this file.  DbgHelp
- * on Windows is assumed to be the reference implementation; this file
- * seeks to provide a cross-platform compatible implementation.  To avoid
- * collisions with the types and values defined and used by DbgHelp in the
- * event that this implementation is used on Windows, each type and value
- * defined here is given a new name, beginning with "MD".  Names of the
- * equivalent types and values in the Windows Platform SDK are given in
- * comments.
- *
- * Author: Mark Mentovai */
-
-
-#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_FORMAT_H__
-#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_FORMAT_H__
-
-#include <stddef.h>
-
-#include "google_breakpad/common/breakpad_types.h"
-
-
-#if defined(_MSC_VER)
-/* Disable "zero-sized array in struct/union" warnings when compiling in
- * MSVC.  DbgHelp.h does this too. */
-#pragma warning(push)
-#pragma warning(disable:4200)
-#endif  /* _MSC_VER */
-
-
-/*
- * guiddef.h
- */
-
-typedef struct {
-  u_int32_t data1;
-  u_int16_t data2;
-  u_int16_t data3;
-  u_int8_t  data4[8];
-} MDGUID;  /* GUID */
-
-
-/*
- * WinNT.h
- */
-
-/* Non-x86 CPU identifiers found in the high 26 bits of
- * (MDRawContext*).context_flags.  These aren't used by Breakpad, but are
- * defined here for reference, to avoid assigning values that conflict
- * (although some values already conflict). */
-#define MD_CONTEXT_IA64  0x00080000  /* CONTEXT_IA64 */
-#define MD_CONTEXT_AMD64 0x00100000  /* CONTEXT_AMD64 */
-/* Additional values from winnt.h in the Windows CE 5.0 SDK: */
-#define MD_CONTEXT_SHX   0x000000c0  /* CONTEXT_SH4 (Super-H, includes SH3) */
-#define MD_CONTEXT_ARM   0x00000040  /* CONTEXT_ARM (0x40 bit set in SHx?) */
-#define MD_CONTEXT_MIPS  0x00010000  /* CONTEXT_R4000 (same value as x86?) */
-#define MD_CONTEXT_ALPHA 0x00020000  /* CONTEXT_ALPHA */
-
-#define MD_CONTEXT_CPU_MASK 0xffffffc0
-
-
-/* This is a base type for MDRawContextX86 and MDRawContextPPC.  This
- * structure should never be allocated directly.  The actual structure type
- * can be determined by examining the context_flags field. */
-typedef struct {
-  u_int32_t context_flags;
-} MDRawContextBase;
-
-#include "minidump_cpu_amd64.h"
-#include "minidump_cpu_arm.h"
-#include "minidump_cpu_ppc.h"
-#include "minidump_cpu_ppc64.h"
-#include "minidump_cpu_sparc.h"
-#include "minidump_cpu_x86.h"
-
-/*
- * WinVer.h
- */
-
-
-typedef struct {
-  u_int32_t signature;
-  u_int32_t struct_version;
-  u_int32_t file_version_hi;
-  u_int32_t file_version_lo;
-  u_int32_t product_version_hi;
-  u_int32_t product_version_lo;
-  u_int32_t file_flags_mask;    /* Identifies valid bits in fileFlags */
-  u_int32_t file_flags;
-  u_int32_t file_os;
-  u_int32_t file_type;
-  u_int32_t file_subtype;
-  u_int32_t file_date_hi;
-  u_int32_t file_date_lo;
-} MDVSFixedFileInfo;  /* VS_FIXEDFILEINFO */
-
-/* For (MDVSFixedFileInfo).signature */
-#define MD_VSFIXEDFILEINFO_SIGNATURE 0xfeef04bd
-     /* VS_FFI_SIGNATURE */
-
-/* For (MDVSFixedFileInfo).version */
-#define MD_VSFIXEDFILEINFO_VERSION 0x00010000
-     /* VS_FFI_STRUCVERSION */
-
-/* For (MDVSFixedFileInfo).file_flags_mask and
- * (MDVSFixedFileInfo).file_flags */
-#define MD_VSFIXEDFILEINFO_FILE_FLAGS_DEBUG        0x00000001
-     /* VS_FF_DEBUG */
-#define MD_VSFIXEDFILEINFO_FILE_FLAGS_PRERELEASE   0x00000002
-     /* VS_FF_PRERELEASE */
-#define MD_VSFIXEDFILEINFO_FILE_FLAGS_PATCHED      0x00000004
-     /* VS_FF_PATCHED */
-#define MD_VSFIXEDFILEINFO_FILE_FLAGS_PRIVATEBUILD 0x00000008
-     /* VS_FF_PRIVATEBUILD */
-#define MD_VSFIXEDFILEINFO_FILE_FLAGS_INFOINFERRED 0x00000010
-     /* VS_FF_INFOINFERRED */
-#define MD_VSFIXEDFILEINFO_FILE_FLAGS_SPECIALBUILD 0x00000020
-     /* VS_FF_SPECIALBUILD */
-
-/* For (MDVSFixedFileInfo).file_os: high 16 bits */
-#define MD_VSFIXEDFILEINFO_FILE_OS_UNKNOWN    0          /* VOS_UNKNOWN */
-#define MD_VSFIXEDFILEINFO_FILE_OS_DOS        (1 << 16)  /* VOS_DOS */
-#define MD_VSFIXEDFILEINFO_FILE_OS_OS216      (2 << 16)  /* VOS_OS216 */
-#define MD_VSFIXEDFILEINFO_FILE_OS_OS232      (3 << 16)  /* VOS_OS232 */
-#define MD_VSFIXEDFILEINFO_FILE_OS_NT         (4 << 16)  /* VOS_NT */
-#define MD_VSFIXEDFILEINFO_FILE_OS_WINCE      (5 << 16)  /* VOS_WINCE */
-/* Low 16 bits */
-#define MD_VSFIXEDFILEINFO_FILE_OS__BASE      0          /* VOS__BASE */
-#define MD_VSFIXEDFILEINFO_FILE_OS__WINDOWS16 1          /* VOS__WINDOWS16 */
-#define MD_VSFIXEDFILEINFO_FILE_OS__PM16      2          /* VOS__PM16 */
-#define MD_VSFIXEDFILEINFO_FILE_OS__PM32      3          /* VOS__PM32 */
-#define MD_VSFIXEDFILEINFO_FILE_OS__WINDOWS32 4          /* VOS__WINDOWS32 */
-
-/* For (MDVSFixedFileInfo).file_type */
-#define MD_VSFIXEDFILEINFO_FILE_TYPE_UNKNOWN    0  /* VFT_UNKNOWN */
-#define MD_VSFIXEDFILEINFO_FILE_TYPE_APP        1  /* VFT_APP */
-#define MD_VSFIXEDFILEINFO_FILE_TYPE_DLL        2  /* VFT_DLL */
-#define MD_VSFIXEDFILEINFO_FILE_TYPE_DRV        3  /* VFT_DLL */
-#define MD_VSFIXEDFILEINFO_FILE_TYPE_FONT       4  /* VFT_FONT */
-#define MD_VSFIXEDFILEINFO_FILE_TYPE_VXD        5  /* VFT_VXD */
-#define MD_VSFIXEDFILEINFO_FILE_TYPE_STATIC_LIB 7  /* VFT_STATIC_LIB */
-
-/* For (MDVSFixedFileInfo).file_subtype */
-#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_UNKNOWN                0
-     /* VFT2_UNKNOWN */
-/* with file_type = MD_VSFIXEDFILEINFO_FILETYPE_DRV */
-#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_PRINTER            1
-     /* VFT2_DRV_PRINTER */
-#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_KEYBOARD           2
-     /* VFT2_DRV_KEYBOARD */
-#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_LANGUAGE           3
-     /* VFT2_DRV_LANGUAGE */
-#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_DISPLAY            4
-     /* VFT2_DRV_DISPLAY */
-#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_MOUSE              5
-     /* VFT2_DRV_MOUSE */
-#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_NETWORK            6
-     /* VFT2_DRV_NETWORK */
-#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_SYSTEM             7
-     /* VFT2_DRV_SYSTEM */
-#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_INSTALLABLE        8
-     /* VFT2_DRV_INSTALLABLE */
-#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_SOUND              9
-     /* VFT2_DRV_SOUND */
-#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_COMM              10
-     /* VFT2_DRV_COMM */
-#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_INPUTMETHOD       11
-     /* VFT2_DRV_INPUTMETHOD */
-#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_VERSIONED_PRINTER 12
-     /* VFT2_DRV_VERSIONED_PRINTER */
-/* with file_type = MD_VSFIXEDFILEINFO_FILETYPE_FONT */
-#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_FONT_RASTER            1
-     /* VFT2_FONT_RASTER */
-#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_FONT_VECTOR            2
-     /* VFT2_FONT_VECTOR */
-#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_FONT_TRUETYPE          3
-     /* VFT2_FONT_TRUETYPE */
-
-
-/*
- * DbgHelp.h
- */
-
-
-/* An MDRVA is an offset into the minidump file.  The beginning of the
- * MDRawHeader is at offset 0. */
-typedef u_int32_t MDRVA;  /* RVA */
-
-typedef struct {
-  u_int32_t data_size;
-  MDRVA     rva;
-} MDLocationDescriptor;  /* MINIDUMP_LOCATION_DESCRIPTOR */
-
-
-typedef struct {
-  /* The base address of the memory range on the host that produced the
-   * minidump. */
-  u_int64_t            start_of_memory_range;
-
-  MDLocationDescriptor memory;
-} MDMemoryDescriptor;  /* MINIDUMP_MEMORY_DESCRIPTOR */
-
-
-typedef struct {
-  u_int32_t signature;
-  u_int32_t version;
-  u_int32_t stream_count;
-  MDRVA     stream_directory_rva;  /* A |stream_count|-sized array of
-                                    * MDRawDirectory structures. */
-  u_int32_t checksum;              /* Can be 0.  In fact, that's all that's
-                                    * been found in minidump files. */
-  u_int32_t time_date_stamp;       /* time_t */
-  u_int64_t flags;
-} MDRawHeader;  /* MINIDUMP_HEADER */
-
-/* For (MDRawHeader).signature and (MDRawHeader).version.  Note that only the
- * low 16 bits of (MDRawHeader).version are MD_HEADER_VERSION.  Per the
- * documentation, the high 16 bits are implementation-specific. */
-#define MD_HEADER_SIGNATURE 0x504d444d /* 'PMDM' */
-     /* MINIDUMP_SIGNATURE */
-#define MD_HEADER_VERSION   0x0000a793 /* 42899 */
-     /* MINIDUMP_VERSION */
-
-/* For (MDRawHeader).flags: */
-typedef enum {
-  /* MD_NORMAL is the standard type of minidump.  It includes full
-   * streams for the thread list, module list, exception, system info,
-   * and miscellaneous info.  A memory list stream is also present,
-   * pointing to the same stack memory contained in the thread list,
-   * as well as a 256-byte region around the instruction address that
-   * was executing when the exception occurred.  Stack memory is from
-   * 4 bytes below a thread's stack pointer up to the top of the
-   * memory region encompassing the stack. */
-  MD_NORMAL                            = 0x00000000,
-  MD_WITH_DATA_SEGS                    = 0x00000001,
-  MD_WITH_FULL_MEMORY                  = 0x00000002,
-  MD_WITH_HANDLE_DATA                  = 0x00000004,
-  MD_FILTER_MEMORY                     = 0x00000008,
-  MD_SCAN_MEMORY                       = 0x00000010,
-  MD_WITH_UNLOADED_MODULES             = 0x00000020,
-  MD_WITH_INDIRECTLY_REFERENCED_MEMORY = 0x00000040,
-  MD_FILTER_MODULE_PATHS               = 0x00000080,
-  MD_WITH_PROCESS_THREAD_DATA          = 0x00000100,
-  MD_WITH_PRIVATE_READ_WRITE_MEMORY    = 0x00000200,
-  MD_WITHOUT_OPTIONAL_DATA             = 0x00000400,
-  MD_WITH_FULL_MEMORY_INFO             = 0x00000800,
-  MD_WITH_THREAD_INFO                  = 0x00001000,
-  MD_WITH_CODE_SEGS                    = 0x00002000,
-  MD_WITHOUT_AUXILLIARY_SEGS           = 0x00004000,
-  MD_WITH_FULL_AUXILLIARY_STATE        = 0x00008000,
-  MD_WITH_PRIVATE_WRITE_COPY_MEMORY    = 0x00010000,
-  MD_IGNORE_INACCESSIBLE_MEMORY        = 0x00020000,
-  MD_WITH_TOKEN_INFORMATION            = 0x00040000
-} MDType;  /* MINIDUMP_TYPE */
-
-
-typedef struct {
-  u_int32_t            stream_type;
-  MDLocationDescriptor location;
-} MDRawDirectory;  /* MINIDUMP_DIRECTORY */
-
-/* For (MDRawDirectory).stream_type */
-typedef enum {
-  MD_UNUSED_STREAM               =  0,
-  MD_RESERVED_STREAM_0           =  1,
-  MD_RESERVED_STREAM_1           =  2,
-  MD_THREAD_LIST_STREAM          =  3,  /* MDRawThreadList */
-  MD_MODULE_LIST_STREAM          =  4,  /* MDRawModuleList */
-  MD_MEMORY_LIST_STREAM          =  5,  /* MDRawMemoryList */
-  MD_EXCEPTION_STREAM            =  6,  /* MDRawExceptionStream */
-  MD_SYSTEM_INFO_STREAM          =  7,  /* MDRawSystemInfo */
-  MD_THREAD_EX_LIST_STREAM       =  8,
-  MD_MEMORY_64_LIST_STREAM       =  9,
-  MD_COMMENT_STREAM_A            = 10,
-  MD_COMMENT_STREAM_W            = 11,
-  MD_HANDLE_DATA_STREAM          = 12,
-  MD_FUNCTION_TABLE_STREAM       = 13,
-  MD_UNLOADED_MODULE_LIST_STREAM = 14,
-  MD_MISC_INFO_STREAM            = 15,  /* MDRawMiscInfo */
-  MD_MEMORY_INFO_LIST_STREAM     = 16,  /* MDRawMemoryInfoList */
-  MD_THREAD_INFO_LIST_STREAM     = 17,
-  MD_HANDLE_OPERATION_LIST_STREAM = 18,
-  MD_LAST_RESERVED_STREAM        = 0x0000ffff,
-
-  /* Breakpad extension types.  0x4767 = "Gg" */
-  MD_BREAKPAD_INFO_STREAM        = 0x47670001,  /* MDRawBreakpadInfo */
-  MD_ASSERTION_INFO_STREAM       = 0x47670002   /* MDRawAssertionInfo */
-} MDStreamType;  /* MINIDUMP_STREAM_TYPE */
-
-
-typedef struct {
-  u_int32_t length;     /* Length of buffer in bytes (not characters),
-                         * excluding 0-terminator */
-  u_int16_t buffer[1];  /* UTF-16-encoded, 0-terminated */
-} MDString;  /* MINIDUMP_STRING */
-
-static const size_t MDString_minsize = offsetof(MDString, buffer[0]);
-
-
-typedef struct {
-  u_int32_t            thread_id;
-  u_int32_t            suspend_count;
-  u_int32_t            priority_class;
-  u_int32_t            priority;
-  u_int64_t            teb;             /* Thread environment block */
-  MDMemoryDescriptor   stack;
-  MDLocationDescriptor thread_context;  /* MDRawContext[CPU] */
-} MDRawThread;  /* MINIDUMP_THREAD */
-
-
-typedef struct {
-  u_int32_t   number_of_threads;
-  MDRawThread threads[1];
-} MDRawThreadList;  /* MINIDUMP_THREAD_LIST */
-
-static const size_t MDRawThreadList_minsize = offsetof(MDRawThreadList,
-                                                       threads[0]);
-
-
-typedef struct {
-  u_int64_t            base_of_image;
-  u_int32_t            size_of_image;
-  u_int32_t            checksum;         /* 0 if unknown */
-  u_int32_t            time_date_stamp;  /* time_t */
-  MDRVA                module_name_rva;  /* MDString, pathname or filename */
-  MDVSFixedFileInfo    version_info;
-
-  /* The next field stores a CodeView record and is populated when a module's
-   * debug information resides in a PDB file.  It identifies the PDB file. */
-  MDLocationDescriptor cv_record;
-
-  /* The next field is populated when a module's debug information resides
-   * in a DBG file.  It identifies the DBG file.  This field is effectively
-   * obsolete with modules built by recent toolchains. */
-  MDLocationDescriptor misc_record;
-
-  /* Alignment problem: reserved0 and reserved1 are defined by the platform
-   * SDK as 64-bit quantities.  However, that results in a structure whose
-   * alignment is unpredictable on different CPUs and ABIs.  If the ABI
-   * specifies full alignment of 64-bit quantities in structures (as ppc
-   * does), there will be padding between miscRecord and reserved0.  If
-   * 64-bit quantities can be aligned on 32-bit boundaries (as on x86),
-   * this padding will not exist.  (Note that the structure up to this point
-   * contains 1 64-bit member followed by 21 32-bit members.)
-   * As a workaround, reserved0 and reserved1 are instead defined here as
-   * four 32-bit quantities.  This should be harmless, as there are
-   * currently no known uses for these fields. */
-  u_int32_t            reserved0[2];
-  u_int32_t            reserved1[2];
-} MDRawModule;  /* MINIDUMP_MODULE */
-
-/* The inclusion of a 64-bit type in MINIDUMP_MODULE forces the struct to
- * be tail-padded out to a multiple of 64 bits under some ABIs (such as PPC).
- * This doesn't occur on systems that don't tail-pad in this manner.  Define
- * this macro to be the usable size of the MDRawModule struct, and use it in
- * place of sizeof(MDRawModule). */
-#define MD_MODULE_SIZE 108
-
-
-/* (MDRawModule).cv_record can reference MDCVInfoPDB20 or MDCVInfoPDB70.
- * Ref.: http://www.debuginfo.com/articles/debuginfomatch.html
- * MDCVInfoPDB70 is the expected structure type with recent toolchains. */
-
-typedef struct {
-  u_int32_t signature;
-  u_int32_t offset;     /* Offset to debug data (expect 0 in minidump) */
-} MDCVHeader;
-
-typedef struct {
-  MDCVHeader cv_header;
-  u_int32_t  signature;         /* time_t debug information created */
-  u_int32_t  age;               /* revision of PDB file */
-  u_int8_t   pdb_file_name[1];  /* Pathname or filename of PDB file */
-} MDCVInfoPDB20;
-
-static const size_t MDCVInfoPDB20_minsize = offsetof(MDCVInfoPDB20,
-                                                     pdb_file_name[0]);
-
-#define MD_CVINFOPDB20_SIGNATURE 0x3031424e  /* cvHeader.signature = '01BN' */
-
-typedef struct {
-  u_int32_t cv_signature;
-  MDGUID    signature;         /* GUID, identifies PDB file */
-  u_int32_t age;               /* Identifies incremental changes to PDB file */
-  u_int8_t  pdb_file_name[1];  /* Pathname or filename of PDB file,
-                                * 0-terminated 8-bit character data (UTF-8?) */
-} MDCVInfoPDB70;
-
-static const size_t MDCVInfoPDB70_minsize = offsetof(MDCVInfoPDB70,
-                                                     pdb_file_name[0]);
-
-#define MD_CVINFOPDB70_SIGNATURE 0x53445352  /* cvSignature = 'SDSR' */
-
-typedef struct {
-  u_int32_t data1[2];
-  u_int32_t data2;
-  u_int32_t data3;
-  u_int32_t data4;
-  u_int32_t data5[3];
-  u_int8_t extra[2];
-} MDCVInfoELF;
-
-/* In addition to the two CodeView record formats above, used for linking
- * to external pdb files, it is possible for debugging data to be carried
- * directly in the CodeView record itself.  These signature values will
- * be found in the first 4 bytes of the CodeView record.  Additional values
- * not commonly experienced in the wild are given by "Microsoft Symbol and
- * Type Information", http://www.x86.org/ftp/manuals/tools/sym.pdf, section
- * 7.2.  An in-depth description of the CodeView 4.1 format is given by
- * "Undocumented Windows 2000 Secrets", Windows 2000 Debugging Support/
- * Microsoft Symbol File Internals/CodeView Subsections,
- * http://www.rawol.com/features/undocumented/sbs-w2k-1-windows-2000-debugging-support.pdf
- */
-#define MD_CVINFOCV41_SIGNATURE 0x3930424e  /* '90BN', CodeView 4.10. */
-#define MD_CVINFOCV50_SIGNATURE 0x3131424e  /* '11BN', CodeView 5.0,
-                                             * MS C7-format (/Z7). */
-
-#define MD_CVINFOUNKNOWN_SIGNATURE 0xffffffff  /* An unlikely value. */
-
-/* (MDRawModule).miscRecord can reference MDImageDebugMisc.  The Windows
- * structure is actually defined in WinNT.h.  This structure is effectively
- * obsolete with modules built by recent toolchains. */
-
-typedef struct {
-  u_int32_t data_type;    /* IMAGE_DEBUG_TYPE_*, not defined here because
-                           * this debug record type is mostly obsolete. */
-  u_int32_t length;       /* Length of entire MDImageDebugMisc structure */
-  u_int8_t  unicode;      /* True if data is multibyte */
-  u_int8_t  reserved[3];
-  u_int8_t  data[1];
-} MDImageDebugMisc;  /* IMAGE_DEBUG_MISC */
-
-static const size_t MDImageDebugMisc_minsize = offsetof(MDImageDebugMisc,
-                                                        data[0]);
-
-
-typedef struct {
-  u_int32_t   number_of_modules;
-  MDRawModule modules[1];
-} MDRawModuleList;  /* MINIDUMP_MODULE_LIST */
-
-static const size_t MDRawModuleList_minsize = offsetof(MDRawModuleList,
-                                                       modules[0]);
-
-
-typedef struct {
-  u_int32_t          number_of_memory_ranges;
-  MDMemoryDescriptor memory_ranges[1];
-} MDRawMemoryList;  /* MINIDUMP_MEMORY_LIST */
-
-static const size_t MDRawMemoryList_minsize = offsetof(MDRawMemoryList,
-                                                       memory_ranges[0]);
-
-
-#define MD_EXCEPTION_MAXIMUM_PARAMETERS 15
-
-typedef struct {
-  u_int32_t exception_code;     /* Windows: MDExceptionCodeWin,
-                                 * Mac OS X: MDExceptionMac,
-                                 * Linux: MDExceptionCodeLinux. */
-  u_int32_t exception_flags;    /* Windows: 1 if noncontinuable,
-                                   Mac OS X: MDExceptionCodeMac. */
-  u_int64_t exception_record;   /* Address (in the minidump-producing host's
-                                 * memory) of another MDException, for
-                                 * nested exceptions. */
-  u_int64_t exception_address;  /* The address that caused the exception.
-                                 * Mac OS X: exception subcode (which is
-                                 *           typically the address). */
-  u_int32_t number_parameters;  /* Number of valid elements in
-                                 * exception_information. */
-  u_int32_t __align;
-  u_int64_t exception_information[MD_EXCEPTION_MAXIMUM_PARAMETERS];
-} MDException;  /* MINIDUMP_EXCEPTION */
-
-#include "minidump_exception_win32.h"
-#include "minidump_exception_mac.h"
-#include "minidump_exception_linux.h"
-#include "minidump_exception_solaris.h"
-
-typedef struct {
-  u_int32_t            thread_id;         /* Thread in which the exception
-                                           * occurred.  Corresponds to
-                                           * (MDRawThread).thread_id. */
-  u_int32_t            __align;
-  MDException          exception_record;
-  MDLocationDescriptor thread_context;    /* MDRawContext[CPU] */
-} MDRawExceptionStream;  /* MINIDUMP_EXCEPTION_STREAM */
-
-
-typedef union {
-  struct {
-    u_int32_t vendor_id[3];               /* cpuid 0: ebx, edx, ecx */
-    u_int32_t version_information;        /* cpuid 1: eax */
-    u_int32_t feature_information;        /* cpuid 1: edx */
-    u_int32_t amd_extended_cpu_features;  /* cpuid 0x80000001, ebx */
-  } x86_cpu_info;
-  struct {
-    u_int64_t processor_features[2];
-  } other_cpu_info;
-} MDCPUInformation;  /* CPU_INFORMATION */
-
-
-typedef struct {
-  /* The next 3 fields and numberOfProcessors are from the SYSTEM_INFO
-   * structure as returned by GetSystemInfo */
-  u_int16_t        processor_architecture;
-  u_int16_t        processor_level;         /* x86: 5 = 586, 6 = 686, ... */
-  u_int16_t        processor_revision;      /* x86: 0xMMSS, where MM=model,
-                                             *      SS=stepping */
-
-  u_int8_t         number_of_processors;
-  u_int8_t         product_type;            /* Windows: VER_NT_* from WinNT.h */
-
-  /* The next 5 fields are from the OSVERSIONINFO structure as returned
-   * by GetVersionEx */
-  u_int32_t        major_version;
-  u_int32_t        minor_version;
-  u_int32_t        build_number;
-  u_int32_t        platform_id;
-  MDRVA            csd_version_rva;  /* MDString further identifying the
-                                      * host OS.
-                                      * Windows: name of the installed OS
-                                      *          service pack.
-                                      * Mac OS X: the Apple OS build number
-                                      *           (sw_vers -buildVersion).
-                                      * Linux: uname -srvmo */
-
-  u_int16_t        suite_mask;       /* Windows: VER_SUITE_* from WinNT.h */
-  u_int16_t        reserved2;
-
-  MDCPUInformation cpu;
-} MDRawSystemInfo;  /* MINIDUMP_SYSTEM_INFO */
-
-/* For (MDRawSystemInfo).processor_architecture: */
-typedef enum {
-  MD_CPU_ARCHITECTURE_X86       =  0,  /* PROCESSOR_ARCHITECTURE_INTEL */
-  MD_CPU_ARCHITECTURE_MIPS      =  1,  /* PROCESSOR_ARCHITECTURE_MIPS */
-  MD_CPU_ARCHITECTURE_ALPHA     =  2,  /* PROCESSOR_ARCHITECTURE_ALPHA */
-  MD_CPU_ARCHITECTURE_PPC       =  3,  /* PROCESSOR_ARCHITECTURE_PPC */
-  MD_CPU_ARCHITECTURE_SHX       =  4,  /* PROCESSOR_ARCHITECTURE_SHX
-                                        * (Super-H) */
-  MD_CPU_ARCHITECTURE_ARM       =  5,  /* PROCESSOR_ARCHITECTURE_ARM */
-  MD_CPU_ARCHITECTURE_IA64      =  6,  /* PROCESSOR_ARCHITECTURE_IA64 */
-  MD_CPU_ARCHITECTURE_ALPHA64   =  7,  /* PROCESSOR_ARCHITECTURE_ALPHA64 */
-  MD_CPU_ARCHITECTURE_MSIL      =  8,  /* PROCESSOR_ARCHITECTURE_MSIL
-                                        * (Microsoft Intermediate Language) */
-  MD_CPU_ARCHITECTURE_AMD64     =  9,  /* PROCESSOR_ARCHITECTURE_AMD64 */
-  MD_CPU_ARCHITECTURE_X86_WIN64 = 10,
-      /* PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 (WoW64) */
-  MD_CPU_ARCHITECTURE_SPARC     = 0x8001, /* Breakpad-defined value for SPARC */
-  MD_CPU_ARCHITECTURE_UNKNOWN   = 0xffff  /* PROCESSOR_ARCHITECTURE_UNKNOWN */
-} MDCPUArchitecture;
-
-/* For (MDRawSystemInfo).platform_id: */
-typedef enum {
-  MD_OS_WIN32S        = 0,  /* VER_PLATFORM_WIN32s (Windows 3.1) */
-  MD_OS_WIN32_WINDOWS = 1,  /* VER_PLATFORM_WIN32_WINDOWS (Windows 95-98-Me) */
-  MD_OS_WIN32_NT      = 2,  /* VER_PLATFORM_WIN32_NT (Windows NT, 2000+) */
-  MD_OS_WIN32_CE      = 3,  /* VER_PLATFORM_WIN32_CE, VER_PLATFORM_WIN32_HH
-                             * (Windows CE, Windows Mobile, "Handheld") */
-
-  /* The following values are Breakpad-defined. */
-  MD_OS_UNIX          = 0x8000,  /* Generic Unix-ish */
-  MD_OS_MAC_OS_X      = 0x8101,  /* Mac OS X/Darwin */
-  MD_OS_LINUX         = 0x8201,  /* Linux */
-  MD_OS_SOLARIS       = 0x8202   /* Solaris */
-} MDOSPlatform;
-
-
-typedef struct {
-  u_int32_t size_of_info;  /* Length of entire MDRawMiscInfo structure. */
-  u_int32_t flags1;
-
-  /* The next field is only valid if flags1 contains
-   * MD_MISCINFO_FLAGS1_PROCESS_ID. */
-  u_int32_t process_id;
-
-  /* The next 3 fields are only valid if flags1 contains
-   * MD_MISCINFO_FLAGS1_PROCESS_TIMES. */
-  u_int32_t process_create_time;  /* time_t process started */
-  u_int32_t process_user_time;    /* seconds of user CPU time */
-  u_int32_t process_kernel_time;  /* seconds of kernel CPU time */
-
-  /* The following fields are not present in MINIDUMP_MISC_INFO but are
-   * in MINIDUMP_MISC_INFO_2.  When this struct is populated, these values
-   * may not be set.  Use flags1 or sizeOfInfo to determine whether these
-   * values are present.  These are only valid when flags1 contains
-   * MD_MISCINFO_FLAGS1_PROCESSOR_POWER_INFO. */
-  u_int32_t processor_max_mhz;
-  u_int32_t processor_current_mhz;
-  u_int32_t processor_mhz_limit;
-  u_int32_t processor_max_idle_state;
-  u_int32_t processor_current_idle_state;
-} MDRawMiscInfo;  /* MINIDUMP_MISC_INFO, MINIDUMP_MISC_INFO2 */
-
-#define MD_MISCINFO_SIZE 24
-#define MD_MISCINFO2_SIZE 44
-
-/* For (MDRawMiscInfo).flags1.  These values indicate which fields in the
- * MDRawMiscInfoStructure are valid. */
-typedef enum {
-  MD_MISCINFO_FLAGS1_PROCESS_ID           = 0x00000001,
-      /* MINIDUMP_MISC1_PROCESS_ID */
-  MD_MISCINFO_FLAGS1_PROCESS_TIMES        = 0x00000002,
-      /* MINIDUMP_MISC1_PROCESS_TIMES */
-  MD_MISCINFO_FLAGS1_PROCESSOR_POWER_INFO = 0x00000004
-      /* MINIDUMP_MISC1_PROCESSOR_POWER_INFO */
-} MDMiscInfoFlags1;
-
-/* 
- * Around DbgHelp version 6.0, the style of new LIST structures changed
- * from including an array of length 1 at the end of the struct to
- * represent the variable-length data to including explicit
- * "size of header", "size of entry" and "number of entries" fields
- * in the header, presumably to allow backwards-compatibly-extending
- * the structures in the future. The actual list entries follow the
- * header data directly in this case.
- */
-
-typedef struct {
-  u_int32_t size_of_header;    /* sizeof(MDRawMemoryInfoList) */
-  u_int32_t size_of_entry;     /* sizeof(MDRawMemoryInfo) */
-  u_int64_t number_of_entries;
-} MDRawMemoryInfoList;  /* MINIDUMP_MEMORY_INFO_LIST */
-
-typedef struct {
-  u_int64_t base_address;           /* Base address of a region of pages */
-  u_int64_t allocation_base;        /* Base address of a range of pages
-                                     * within this region. */
-  u_int32_t allocation_protection;  /* Memory protection when this region
-                                     * was originally allocated:
-                                     * MDMemoryProtection */
-  u_int32_t __alignment1;
-  u_int64_t region_size;
-  u_int32_t state;                  /* MDMemoryState */
-  u_int32_t protection;             /* MDMemoryProtection */
-  u_int32_t type;                   /* MDMemoryType */
-  u_int32_t __alignment2;
-} MDRawMemoryInfo;  /* MINIDUMP_MEMORY_INFO */
-
-/* For (MDRawMemoryInfo).state */
-typedef enum {
-  MD_MEMORY_STATE_COMMIT   = 0x1000,  /* physical storage has been allocated */
-  MD_MEMORY_STATE_RESERVE  = 0x2000,  /* reserved, but no physical storage */
-  MD_MEMORY_STATE_FREE     = 0x10000  /* available to be allocated */
-} MDMemoryState;
-
-/* For (MDRawMemoryInfo).allocation_protection and .protection */
-typedef enum {
-  MD_MEMORY_PROTECT_NOACCESS          = 0x01,  /* PAGE_NOACCESS */
-  MD_MEMORY_PROTECT_READONLY          = 0x02,  /* PAGE_READONLY */
-  MD_MEMORY_PROTECT_READWRITE         = 0x04,  /* PAGE_READWRITE */
-  MD_MEMORY_PROTECT_WRITECOPY         = 0x08,  /* PAGE_WRITECOPY */
-  MD_MEMORY_PROTECT_EXECUTE           = 0x10,  /* PAGE_EXECUTE */
-  MD_MEMORY_PROTECT_EXECUTE_READ      = 0x20,  /* PAGE_EXECUTE_READ */
-  MD_MEMORY_PROTECT_EXECUTE_READWRITE = 0x40,  /* PAGE_EXECUTE_READWRITE */
-  MD_MEMORY_PROTECT_EXECUTE_WRITECOPY = 0x80,  /* PAGE_EXECUTE_WRITECOPY */
-  /* These options can be combined with the previous flags. */
-  MD_MEMORY_PROTECT_GUARD             = 0x100,  /* PAGE_GUARD */
-  MD_MEMORY_PROTECT_NOCACHE           = 0x200,  /* PAGE_NOCACHE */
-  MD_MEMORY_PROTECT_WRITECOMBINE      = 0x400,  /* PAGE_WRITECOMBINE */
-} MDMemoryProtection;
-
-/* Used to mask the mutually exclusive options from the combinable flags. */
-const u_int32_t MD_MEMORY_PROTECTION_ACCESS_MASK = 0xFF;
-
-/* For (MDRawMemoryInfo).type */
-typedef enum {
-  MD_MEMORY_TYPE_PRIVATE = 0x20000,   /* not shared by other processes */
-  MD_MEMORY_TYPE_MAPPED  = 0x40000,   /* mapped into the view of a section */
-  MD_MEMORY_TYPE_IMAGE   = 0x1000000  /* mapped into the view of an image */
-} MDMemoryType;
-
-/*
- * Breakpad extension types
- */
-
-
-typedef struct {
-  /* validity is a bitmask with values from MDBreakpadInfoValidity, indicating
-   * which of the other fields in the structure are valid. */
-  u_int32_t validity;
-
-  /* Thread ID of the handler thread.  dump_thread_id should correspond to
-   * the thread_id of an MDRawThread in the minidump's MDRawThreadList if
-   * a dedicated thread in that list was used to produce the minidump.  If
-   * the MDRawThreadList does not contain a dedicated thread used to produce
-   * the minidump, this field should be set to 0 and the validity field
-   * must not contain MD_BREAKPAD_INFO_VALID_DUMP_THREAD_ID. */
-  u_int32_t dump_thread_id;
-
-  /* Thread ID of the thread that requested the minidump be produced.  As
-   * with dump_thread_id, requesting_thread_id should correspond to the
-   * thread_id of an MDRawThread in the minidump's MDRawThreadList.  For
-   * minidumps produced as a result of an exception, requesting_thread_id
-   * will be the same as the MDRawExceptionStream's thread_id field.  For
-   * minidumps produced "manually" at the program's request,
-   * requesting_thread_id will indicate which thread caused the dump to be
-   * written.  If the minidump was produced at the request of something
-   * other than a thread in the MDRawThreadList, this field should be set
-   * to 0 and the validity field must not contain
-   * MD_BREAKPAD_INFO_VALID_REQUESTING_THREAD_ID. */
-  u_int32_t requesting_thread_id;
-} MDRawBreakpadInfo;
-
-/* For (MDRawBreakpadInfo).validity: */
-typedef enum {
-  /* When set, the dump_thread_id field is valid. */
-  MD_BREAKPAD_INFO_VALID_DUMP_THREAD_ID       = 1 << 0,
-
-  /* When set, the requesting_thread_id field is valid. */
-  MD_BREAKPAD_INFO_VALID_REQUESTING_THREAD_ID = 1 << 1
-} MDBreakpadInfoValidity;
-
-typedef struct {
-  /* expression, function, and file are 0-terminated UTF-16 strings.  They
-   * may be truncated if necessary, but should always be 0-terminated when
-   * written to a file.
-   * Fixed-length strings are used because MiniDumpWriteDump doesn't offer
-   * a way for user streams to point to arbitrary RVAs for strings. */
-  u_int16_t expression[128];  /* Assertion that failed... */
-  u_int16_t function[128];    /* ...within this function... */
-  u_int16_t file[128];        /* ...in this file... */
-  u_int32_t line;             /* ...at this line. */
-  u_int32_t type;
-} MDRawAssertionInfo;
-
-/* For (MDRawAssertionInfo).type: */
-typedef enum {
-  MD_ASSERTION_INFO_TYPE_UNKNOWN = 0,
-
-  /* Used for assertions that would be raised by the MSVC CRT but are
-   * directed to an invalid parameter handler instead. */
-  MD_ASSERTION_INFO_TYPE_INVALID_PARAMETER,
-
-  /* Used for assertions that would be raised by the MSVC CRT but are
-   * directed to a pure virtual call handler instead. */
-  MD_ASSERTION_INFO_TYPE_PURE_VIRTUAL_CALL
-} MDAssertionInfoData;
-
-#if defined(_MSC_VER)
-#pragma warning(pop)
-#endif  /* _MSC_VER */
-
-
-#endif  /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_FORMAT_H__ */
diff --git a/third_party/breakpad/src/google_breakpad/common/minidump_size.h b/third_party/breakpad/src/google_breakpad/common/minidump_size.h
deleted file mode 100644
index 918544b..0000000
--- a/third_party/breakpad/src/google_breakpad/common/minidump_size.h
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (c) 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-
-// minidump_size.h: Provides a C++ template for programmatic access to
-// the sizes of various types defined in minidump_format.h.
-//
-// Author: Mark Mentovai
-
-#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_SIZE_H__
-#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_SIZE_H__
-
-#include <sys/types.h>
-
-#include "google_breakpad/common/minidump_format.h"
-
-namespace google_breakpad {
-
-template<typename T>
-class minidump_size {
- public:
-  static size_t size() { return sizeof(T); }
-};
-
-// Explicit specializations for variable-length types.  The size returned
-// for these should be the size for an object without its variable-length
-// section.
-
-template<>
-class minidump_size<MDString> {
- public:
-  static size_t size() { return MDString_minsize; }
-};
-
-template<>
-class minidump_size<MDRawThreadList> {
- public:
-  static size_t size() { return MDRawThreadList_minsize; }
-};
-
-template<>
-class minidump_size<MDCVInfoPDB20> {
- public:
-  static size_t size() { return MDCVInfoPDB20_minsize; }
-};
-
-template<>
-class minidump_size<MDCVInfoPDB70> {
- public:
-  static size_t size() { return MDCVInfoPDB70_minsize; }
-};
-
-template<>
-class minidump_size<MDImageDebugMisc> {
- public:
-  static size_t size() { return MDImageDebugMisc_minsize; }
-};
-
-template<>
-class minidump_size<MDRawModuleList> {
- public:
-  static size_t size() { return MDRawModuleList_minsize; }
-};
-
-template<>
-class minidump_size<MDRawMemoryList> {
- public:
-  static size_t size() { return MDRawMemoryList_minsize; }
-};
-
-// Explicit specialization for MDRawModule, for which sizeof may include
-// tail-padding on some architectures but not others.
-
-template<>
-class minidump_size<MDRawModule> {
- public:
-  static size_t size() { return MD_MODULE_SIZE; }
-};
-
-}  // namespace google_breakpad
-
-#endif  // GOOGLE_BREAKPAD_COMMON_MINIDUMP_SIZE_H__
diff --git a/third_party/breakpad/src/google_breakpad/processor/basic_source_line_resolver.h b/third_party/breakpad/src/google_breakpad/processor/basic_source_line_resolver.h
deleted file mode 100644
index f77b3bb..0000000
--- a/third_party/breakpad/src/google_breakpad/processor/basic_source_line_resolver.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (c) 2010 Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// basic_source_line_resolver.h: BasicSourceLineResolver is derived from
-// SourceLineResolverBase, and is a concrete implementation of
-// SourceLineResolverInterface, using address map files produced by a
-// compatible writer, e.g. PDBSourceLineWriter.
-//
-// see "processor/source_line_resolver_base.h"
-// and "source_line_resolver_interface.h" for more documentation.
-
-#ifndef GOOGLE_BREAKPAD_PROCESSOR_BASIC_SOURCE_LINE_RESOLVER_H__
-#define GOOGLE_BREAKPAD_PROCESSOR_BASIC_SOURCE_LINE_RESOLVER_H__
-
-#include <map>
-
-#include "google_breakpad/processor/source_line_resolver_base.h"
-
-namespace google_breakpad {
-
-using std::string;
-using std::map;
-
-class BasicSourceLineResolver : public SourceLineResolverBase {
- public:
-  BasicSourceLineResolver();
-  virtual ~BasicSourceLineResolver() { }
-
-  using SourceLineResolverBase::LoadModule;
-  using SourceLineResolverBase::LoadModuleUsingMapBuffer;
-  using SourceLineResolverBase::LoadModuleUsingMemoryBuffer;
-  using SourceLineResolverBase::ShouldDeleteMemoryBufferAfterLoadModule;
-  using SourceLineResolverBase::UnloadModule;
-  using SourceLineResolverBase::HasModule;
-  using SourceLineResolverBase::FillSourceLineInfo;
-  using SourceLineResolverBase::FindWindowsFrameInfo;
-  using SourceLineResolverBase::FindCFIFrameInfo;
-
- private:
-  // friend declarations:
-  friend class BasicModuleFactory;
-  friend class ModuleComparer;
-  friend class ModuleSerializer;
-  template<class> friend class SimpleSerializer;
-
-  // Function derives from SourceLineResolverBase::Function.
-  struct Function;
-  // Module implements SourceLineResolverBase::Module interface.
-  class Module;
-
-  // Disallow unwanted copy ctor and assignment operator
-  BasicSourceLineResolver(const BasicSourceLineResolver&);
-  void operator=(const BasicSourceLineResolver&);
-};
-
-}  // namespace google_breakpad
-
-#endif  // GOOGLE_BREAKPAD_PROCESSOR_BASIC_SOURCE_LINE_RESOLVER_H__
diff --git a/third_party/breakpad/src/google_breakpad/processor/call_stack.h b/third_party/breakpad/src/google_breakpad/processor/call_stack.h
deleted file mode 100644
index 21f595e..0000000
--- a/third_party/breakpad/src/google_breakpad/processor/call_stack.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// call_stack.h: A call stack comprised of stack frames.
-//
-// This class manages a vector of stack frames.  It is used instead of
-// exposing the vector directly to allow the CallStack to own StackFrame
-// pointers without having to publicly export the linked_ptr class.  A
-// CallStack must be composed of pointers instead of objects to allow for
-// CPU-specific StackFrame subclasses.
-//
-// By convention, the stack frame at index 0 is the innermost callee frame,
-// and the frame at the highest index in a call stack is the outermost
-// caller.  CallStack only allows stacks to be built by pushing frames,
-// beginning with the innermost callee frame.
-//
-// Author: Mark Mentovai
-
-#ifndef GOOGLE_BREAKPAD_PROCESSOR_CALL_STACK_H__
-#define GOOGLE_BREAKPAD_PROCESSOR_CALL_STACK_H__
-
-#include <vector>
-
-namespace google_breakpad {
-
-using std::vector;
-
-struct StackFrame;
-template<typename T> class linked_ptr;
-
-class CallStack {
- public:
-  CallStack() { Clear(); }
-  ~CallStack();
-
-  // Resets the CallStack to its initial empty state
-  void Clear();
-  
-  const vector<StackFrame*>* frames() const { return &frames_; }
-
- private:
-  // Stackwalker is responsible for building the frames_ vector.
-  friend class Stackwalker;
-
-  // Storage for pushed frames.
-  vector<StackFrame*> frames_;
-};
-
-}  // namespace google_breakpad
-
-#endif  // GOOGLE_BREAKPAD_PROCSSOR_CALL_STACK_H__
diff --git a/third_party/breakpad/src/google_breakpad/processor/code_module.h b/third_party/breakpad/src/google_breakpad/processor/code_module.h
deleted file mode 100644
index 38ee956..0000000
--- a/third_party/breakpad/src/google_breakpad/processor/code_module.h
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright (c) 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// code_module.h: Carries information about code modules that are loaded
-// into a process.
-//
-// Author: Mark Mentovai
-
-#ifndef GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULE_H__
-#define GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULE_H__
-
-#include <string>
-#include "google_breakpad/common/breakpad_types.h"
-
-namespace google_breakpad {
-
-using std::string;
-
-class CodeModule {
- public:
-  virtual ~CodeModule() {}
-
-  // The base address of this code module as it was loaded by the process.
-  // (u_int64_t)-1 on error.
-  virtual u_int64_t base_address() const = 0;
-
-  // The size of the code module.  0 on error.
-  virtual u_int64_t size() const = 0;
-
-  // The path or file name that the code module was loaded from.  Empty on
-  // error.
-  virtual string code_file() const = 0;
-
-  // An identifying string used to discriminate between multiple versions and
-  // builds of the same code module.  This may contain a uuid, timestamp,
-  // version number, or any combination of this or other information, in an
-  // implementation-defined format.  Empty on error.
-  virtual string code_identifier() const = 0;
-
-  // The filename containing debugging information associated with the code
-  // module.  If debugging information is stored in a file separate from the
-  // code module itself (as is the case when .pdb or .dSYM files are used),
-  // this will be different from code_file.  If debugging information is
-  // stored in the code module itself (possibly prior to stripping), this
-  // will be the same as code_file.  Empty on error.
-  virtual string debug_file() const = 0;
-
-  // An identifying string similar to code_identifier, but identifies a
-  // specific version and build of the associated debug file.  This may be
-  // the same as code_identifier when the debug_file and code_file are
-  // identical or when the same identifier is used to identify distinct
-  // debug and code files.
-  virtual string debug_identifier() const = 0;
-
-  // A human-readable representation of the code module's version.  Empty on
-  // error.
-  virtual string version() const = 0;
-
-  // Creates a new copy of this CodeModule object, which the caller takes
-  // ownership of.  The new CodeModule may be of a different concrete class
-  // than the CodeModule being copied, but will behave identically to the
-  // copied CodeModule as far as the CodeModule interface is concerned.
-  virtual const CodeModule* Copy() const = 0;
-};
-
-}  // namespace google_breakpad
-
-#endif  // GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULE_H__
diff --git a/third_party/breakpad/src/google_breakpad/processor/code_modules.h b/third_party/breakpad/src/google_breakpad/processor/code_modules.h
deleted file mode 100644
index 29c55d4..0000000
--- a/third_party/breakpad/src/google_breakpad/processor/code_modules.h
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright (c) 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// code_modules.h: Contains all of the CodeModule objects that were loaded
-// into a single process.
-//
-// Author: Mark Mentovai
-
-#ifndef GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULES_H__
-#define GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULES_H__
-
-#include "google_breakpad/common/breakpad_types.h"
-
-namespace google_breakpad {
-
-class CodeModule;
-
-class CodeModules {
- public:
-  virtual ~CodeModules() {}
-
-  // The number of contained CodeModule objects.
-  virtual unsigned int module_count() const = 0;
-
-  // Random access to modules.  Returns the module whose code is present
-  // at the address indicated by |address|.  If no module is present at this
-  // address, returns NULL.  Ownership of the returned CodeModule is retained
-  // by the CodeModules object; pointers returned by this method are valid for
-  // comparison with pointers returned by the other Get methods.
-  virtual const CodeModule* GetModuleForAddress(u_int64_t address) const = 0;
-
-  // Returns the module corresponding to the main executable.  If there is
-  // no main executable, returns NULL.  Ownership of the returned CodeModule
-  // is retained by the CodeModules object; pointers returned by this method
-  // are valid for comparison with pointers returned by the other Get
-  // methods.
-  virtual const CodeModule* GetMainModule() const = 0;
-
-  // Sequential access to modules.  A sequence number of 0 corresponds to the
-  // module residing lowest in memory.  If the sequence number is out of
-  // range, returns NULL.  Ownership of the returned CodeModule is retained
-  // by the CodeModules object; pointers returned by this method are valid for
-  // comparison with pointers returned by the other Get methods.
-  virtual const CodeModule* GetModuleAtSequence(
-      unsigned int sequence) const = 0;
-
-  // Sequential access to modules.  This is similar to GetModuleAtSequence,
-  // except no ordering requirement is enforced.  A CodeModules implementation
-  // may return CodeModule objects from GetModuleAtIndex in any order it
-  // wishes, provided that the order remain the same throughout the life of
-  // the CodeModules object.  Typically, GetModuleAtIndex would be used by
-  // a caller to enumerate all CodeModule objects quickly when the enumeration
-  // does not require any ordering.  If the index argument is out of range,
-  // returns NULL.  Ownership of the returned CodeModule is retained by
-  // the CodeModules object; pointers returned by this method are valid for
-  // comparison with pointers returned by the other Get methods.
-  virtual const CodeModule* GetModuleAtIndex(unsigned int index) const = 0;
-
-  // Creates a new copy of this CodeModules object, which the caller takes
-  // ownership of.  The new object will also contain copies of the existing
-  // object's child CodeModule objects.  The new CodeModules object may be of
-  // a different concrete class than the object being copied, but will behave
-  // identically to the copied object as far as the CodeModules and CodeModule
-  // interfaces are concerned, except that the order that GetModuleAtIndex
-  // returns objects in may differ between a copy and the original CodeModules
-  // object.
-  virtual const CodeModules* Copy() const = 0;
-};
-
-}  // namespace google_breakpad
-
-#endif  // GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULES_H__
diff --git a/third_party/breakpad/src/google_breakpad/processor/exploitability.h b/third_party/breakpad/src/google_breakpad/processor/exploitability.h
deleted file mode 100644
index 225206d..0000000
--- a/third_party/breakpad/src/google_breakpad/processor/exploitability.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (c) 2010 Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// exploitability_engine.h: Generic exploitability engine.
-//
-// The Exploitability class is an abstract base class providing common
-// generic methods that apply to exploitability engines for specific platforms.
-// Specific implementations will extend this class by providing run
-// methods to fill in the exploitability_ enumeration of the ProcessState
-// for a crash.
-//
-// Author: Cris Neckar
-
-#ifndef GOOGLE_BREAKPAD_PROCESSOR_EXPLOITABILITY_H_
-#define GOOGLE_BREAKPAD_PROCESSOR_EXPLOITABILITY_H_
-
-#include "google_breakpad/common/breakpad_types.h"
-#include "google_breakpad/processor/minidump.h"
-#include "google_breakpad/processor/process_state.h"
-
-namespace google_breakpad {
-
-class Exploitability {
- public:
-  virtual ~Exploitability() {}
-
-  static Exploitability *ExploitabilityForPlatform(Minidump *dump,
-                                                   ProcessState *process_state);
-
-  ExploitabilityRating CheckExploitability();
-  bool AddressIsAscii(u_int64_t);
-
- protected:
-  Exploitability(Minidump *dump,
-                 ProcessState *process_state);
-
-  Minidump *dump_;
-  ProcessState *process_state_;
-  SystemInfo *system_info_;
-
- private:
-  virtual ExploitabilityRating CheckPlatformExploitability() = 0;
-};
-
-}  // namespace google_breakpad
-
-#endif  // GOOGLE_BREAKPAD_PROCESSOR_EXPLOITABILITY_H_
diff --git a/third_party/breakpad/src/google_breakpad/processor/fast_source_line_resolver.h b/third_party/breakpad/src/google_breakpad/processor/fast_source_line_resolver.h
deleted file mode 100644
index 60f6dfc..0000000
--- a/third_party/breakpad/src/google_breakpad/processor/fast_source_line_resolver.h
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (c) 2010 Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// fast_source_line_resolver.h: FastSourceLineResolver is derived from
-// SourceLineResolverBase, and is a concrete implementation of
-// SourceLineResolverInterface.
-//
-// FastSourceLineResolver is a sibling class of BasicSourceLineResolver.  The
-// difference is FastSourceLineResolver loads a serialized memory chunk of data
-// which can be used directly a Module without parsing or copying of underlying
-// data.  Therefore loading a symbol in FastSourceLineResolver is much faster
-// and more memory-efficient than BasicSourceLineResolver.
-//
-// See "source_line_resolver_base.h" and
-// "google_breakpad/source_line_resolver_interface.h" for more reference.
-//
-// Author: Siyang Xie (lambxsy@google.com)
-
-#ifndef GOOGLE_BREAKPAD_PROCESSOR_FAST_SOURCE_LINE_RESOLVER_H__
-#define GOOGLE_BREAKPAD_PROCESSOR_FAST_SOURCE_LINE_RESOLVER_H__
-
-#include <map>
-#include <string>
-
-#include "google_breakpad/processor/source_line_resolver_base.h"
-
-namespace google_breakpad {
-
-using std::map;
-
-class FastSourceLineResolver : public SourceLineResolverBase {
- public:
-  FastSourceLineResolver();
-  virtual ~FastSourceLineResolver() { }
-
-  using SourceLineResolverBase::FillSourceLineInfo;
-  using SourceLineResolverBase::FindCFIFrameInfo;
-  using SourceLineResolverBase::FindWindowsFrameInfo;
-  using SourceLineResolverBase::HasModule;
-  using SourceLineResolverBase::LoadModule;
-  using SourceLineResolverBase::LoadModuleUsingMapBuffer;
-  using SourceLineResolverBase::LoadModuleUsingMemoryBuffer;
-  using SourceLineResolverBase::UnloadModule;
-
- private:
-  // Friend declarations.
-  friend class ModuleComparer;
-  friend class ModuleSerializer;
-  friend class FastModuleFactory;
-
-  // Nested types that will derive from corresponding nested types defined in
-  // SourceLineResolverBase.
-  struct Line;
-  struct Function;
-  struct PublicSymbol;
-  class Module;
-
-  // Deserialize raw memory data to construct a WindowsFrameInfo object.
-  static WindowsFrameInfo CopyWFI(const char *raw_memory);
-
-  // FastSourceLineResolver requires the memory buffer stays alive during the
-  // lifetime of a corresponding module, therefore it needs to redefine this
-  // virtual method.
-  virtual bool ShouldDeleteMemoryBufferAfterLoadModule();
-
-  // Disallow unwanted copy ctor and assignment operator
-  FastSourceLineResolver(const FastSourceLineResolver&);
-  void operator=(const FastSourceLineResolver&);
-};
-
-}  // namespace google_breakpad
-
-#endif  // GOOGLE_BREAKPAD_PROCESSOR_FAST_SOURCE_LINE_RESOLVER_H__
diff --git a/third_party/breakpad/src/google_breakpad/processor/memory_region.h b/third_party/breakpad/src/google_breakpad/processor/memory_region.h
deleted file mode 100644
index 15e23dd..0000000
--- a/third_party/breakpad/src/google_breakpad/processor/memory_region.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) 2010 Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// memory_region.h: Access to memory regions.
-//
-// A MemoryRegion provides virtual access to a range of memory.  It is an
-// abstraction allowing the actual source of memory to be independent of
-// methods which need to access a virtual memory space.
-//
-// Author: Mark Mentovai
-
-#ifndef GOOGLE_BREAKPAD_PROCESSOR_MEMORY_REGION_H__
-#define GOOGLE_BREAKPAD_PROCESSOR_MEMORY_REGION_H__
-
-
-#include "google_breakpad/common/breakpad_types.h"
-
-
-namespace google_breakpad {
-
-
-class MemoryRegion {
- public:
-  virtual ~MemoryRegion() {}
-
-  // The base address of this memory region.
-  virtual u_int64_t GetBase() const = 0;
-
-  // The size of this memory region.
-  virtual u_int32_t GetSize() const = 0;
-
-  // Access to data of various sizes within the memory region.  address
-  // is a pointer to read, and it must lie within the memory region as
-  // defined by its base address and size.  The location pointed to by
-  // value is set to the value at address.  Byte-swapping is performed
-  // if necessary so that the value is appropriate for the running
-  // program.  Returns true on success.  Fails and returns false if address
-  // is out of the region's bounds (after considering the width of value),
-  // or for other types of errors.
-  virtual bool GetMemoryAtAddress(u_int64_t address, u_int8_t*  value) const =0;
-  virtual bool GetMemoryAtAddress(u_int64_t address, u_int16_t* value) const =0;
-  virtual bool GetMemoryAtAddress(u_int64_t address, u_int32_t* value) const =0;
-  virtual bool GetMemoryAtAddress(u_int64_t address, u_int64_t* value) const =0;
-};
-
-
-}  // namespace google_breakpad
-
-
-#endif  // GOOGLE_BREAKPAD_PROCESSOR_MEMORY_REGION_H__
diff --git a/third_party/breakpad/src/google_breakpad/processor/minidump.h b/third_party/breakpad/src/google_breakpad/processor/minidump.h
deleted file mode 100644
index 012a813..0000000
--- a/third_party/breakpad/src/google_breakpad/processor/minidump.h
+++ /dev/null
@@ -1,1032 +0,0 @@
-// Copyright (c) 2010 Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// minidump.h: A minidump reader.
-//
-// The basic structure of this module tracks the structure of the minidump
-// file itself.  At the top level, a minidump file is represented by a
-// Minidump object.  Like most other classes in this module, Minidump
-// provides a Read method that initializes the object with information from
-// the file.  Most of the classes in this file are wrappers around the
-// "raw" structures found in the minidump file itself, and defined in
-// minidump_format.h.  For example, each thread is represented by a
-// MinidumpThread object, whose parameters are specified in an MDRawThread
-// structure.  A properly byte-swapped MDRawThread can be obtained from a
-// MinidumpThread easily by calling its thread() method.
-//
-// Most of the module lazily reads only the portion of the minidump file
-// necessary to fulfill the user's request.  Calling Minidump::Read
-// only reads the minidump's directory.  The thread list is not read until
-// it is needed, and even once it's read, the memory regions for each
-// thread's stack aren't read until they're needed.  This strategy avoids
-// unnecessary file input, and allocating memory for data in which the user
-// has no interest.  Note that although memory allocations for a typical
-// minidump file are not particularly large, it is possible for legitimate
-// minidumps to be sizable.  A full-memory minidump, for example, contains
-// a snapshot of the entire mapped memory space.  Even a normal minidump,
-// with stack memory only, can be large if, for example, the dump was
-// generated in response to a crash that occurred due to an infinite-
-// recursion bug that caused the stack's limits to be exceeded.  Finally,
-// some users of this library will unfortunately find themselves in the
-// position of having to process potentially-hostile minidumps that might
-// attempt to cause problems by forcing the minidump processor to over-
-// allocate memory.
-//
-// Memory management in this module is based on a strict
-// you-don't-own-anything policy.  The only object owned by the user is
-// the top-level Minidump object, the creation and destruction of which
-// must be the user's own responsibility.  All other objects obtained
-// through interaction with this module are ultimately owned by the
-// Minidump object, and will be freed upon the Minidump object's destruction.
-// Because memory regions can potentially involve large allocations, a
-// FreeMemory method is provided by MinidumpMemoryRegion, allowing the user
-// to release data when it is no longer needed.  Use of this method is
-// optional but recommended.  If freed data is later required, it will
-// be read back in from the minidump file again.
-//
-// There is one exception to this memory management policy:
-// Minidump::ReadString will return a string object to the user, and the user
-// is responsible for its deletion.
-//
-// Author: Mark Mentovai
-
-#ifndef GOOGLE_BREAKPAD_PROCESSOR_MINIDUMP_H__
-#define GOOGLE_BREAKPAD_PROCESSOR_MINIDUMP_H__
-
-#ifndef _WIN32
-#include <unistd.h>
-#endif
-
-#include <iostream>
-#include <map>
-#include <string>
-#include <vector>
-
-#include "google_breakpad/common/minidump_format.h"
-#include "google_breakpad/processor/code_module.h"
-#include "google_breakpad/processor/code_modules.h"
-#include "google_breakpad/processor/memory_region.h"
-
-
-namespace google_breakpad {
-
-
-using std::map;
-using std::string;
-using std::vector;
-
-
-class Minidump;
-template<typename AddressType, typename EntryType> class RangeMap;
-
-
-// MinidumpObject is the base of all Minidump* objects except for Minidump
-// itself.
-class MinidumpObject {
- public:
-  virtual ~MinidumpObject() {}
-
-  bool valid() const { return valid_; }
-
- protected:
-  explicit MinidumpObject(Minidump* minidump);
-
-  // Refers to the Minidump object that is the ultimate parent of this
-  // Some MinidumpObjects are owned by other MinidumpObjects, but at the
-  // root of the ownership tree is always a Minidump.  The Minidump object
-  // is kept here for access to its seeking and reading facilities, and
-  // for access to data about the minidump file itself, such as whether
-  // it should be byte-swapped.
-  Minidump* minidump_;
-
-  // MinidumpObjects are not valid when created.  When a subclass populates
-  // its own fields, it can set valid_ to true.  Accessors and mutators may
-  // wish to consider or alter the valid_ state as they interact with
-  // objects.
-  bool      valid_;
-};
-
-
-// This class exists primarily to provide a virtual destructor in a base
-// class common to all objects that might be stored in
-// Minidump::mStreamObjects.  Some object types (MinidumpContext) will
-// never be stored in Minidump::mStreamObjects, but are represented as
-// streams and adhere to the same interface, and may be derived from
-// this class.
-class MinidumpStream : public MinidumpObject {
- public:
-  virtual ~MinidumpStream() {}
-
- protected:
-  explicit MinidumpStream(Minidump* minidump);
-
- private:
-  // Populate (and validate) the MinidumpStream.  minidump_ is expected
-  // to be positioned at the beginning of the stream, so that the next
-  // read from the minidump will be at the beginning of the stream.
-  // expected_size should be set to the stream's length as contained in
-  // the MDRawDirectory record or other identifying record.  A class
-  // that implements MinidumpStream can compare expected_size to a
-  // known size as an integrity check.
-  virtual bool Read(u_int32_t expected_size) = 0;
-};
-
-
-// MinidumpContext carries a CPU-specific MDRawContext structure, which
-// contains CPU context such as register states.  Each thread has its
-// own context, and the exception record, if present, also has its own
-// context.  Note that if the exception record is present, the context it
-// refers to is probably what the user wants to use for the exception
-// thread, instead of that thread's own context.  The exception thread's
-// context (as opposed to the exception record's context) will contain
-// context for the exception handler (which performs minidump generation),
-// and not the context that caused the exception (which is probably what the
-// user wants).
-class MinidumpContext : public MinidumpStream {
- public:
-  virtual ~MinidumpContext();
-
-  // Returns an MD_CONTEXT_* value such as MD_CONTEXT_X86 or MD_CONTEXT_PPC
-  // identifying the CPU type that the context was collected from.  The
-  // returned value will identify the CPU only, and will have any other
-  // MD_CONTEXT_* bits masked out.  Returns 0 on failure.
-  u_int32_t GetContextCPU() const;
-
-  // Returns raw CPU-specific context data for the named CPU type.  If the
-  // context data does not match the CPU type or does not exist, returns
-  // NULL.
-  const MDRawContextAMD64* GetContextAMD64() const;
-  const MDRawContextARM*   GetContextARM() const;
-  const MDRawContextPPC*   GetContextPPC() const;
-  const MDRawContextSPARC* GetContextSPARC() const;
-  const MDRawContextX86*   GetContextX86() const;
- 
-  // Print a human-readable representation of the object to stdout.
-  void Print();
-
- private:
-  friend class MinidumpThread;
-  friend class MinidumpException;
-
-  explicit MinidumpContext(Minidump* minidump);
-
-  bool Read(u_int32_t expected_size);
-
-  // Free the CPU-specific context structure.
-  void FreeContext();
-
-  // If the minidump contains a SYSTEM_INFO_STREAM, makes sure that the
-  // system info stream gives an appropriate CPU type matching the context
-  // CPU type in context_cpu_type.  Returns false if the CPU type does not
-  // match.  Returns true if the CPU type matches or if the minidump does
-  // not contain a system info stream.
-  bool CheckAgainstSystemInfo(u_int32_t context_cpu_type);
-
-  // Store this separately because of the weirdo AMD64 context
-  u_int32_t context_flags_;
-
-  // The CPU-specific context structure.
-  union {
-    MDRawContextBase*  base;
-    MDRawContextX86*   x86;
-    MDRawContextPPC*   ppc;
-    MDRawContextAMD64* amd64;
-    // on Solaris SPARC, sparc is defined as a numeric constant,
-    // so variables can NOT be named as sparc
-    MDRawContextSPARC* ctx_sparc;
-    MDRawContextARM*   arm;
-  } context_;
-};
-
-
-// MinidumpMemoryRegion does not wrap any MDRaw structure, and only contains
-// a reference to an MDMemoryDescriptor.  This object is intended to wrap
-// portions of a minidump file that contain memory dumps.  In normal
-// minidumps, each MinidumpThread owns a MinidumpMemoryRegion corresponding
-// to the thread's stack memory.  MinidumpMemoryList also gives access to
-// memory regions in its list as MinidumpMemoryRegions.  This class
-// adheres to MemoryRegion so that it may be used as a data provider to
-// the Stackwalker family of classes.
-class MinidumpMemoryRegion : public MinidumpObject,
-                             public MemoryRegion {
- public:
-  virtual ~MinidumpMemoryRegion();
-
-  static void set_max_bytes(u_int32_t max_bytes) { max_bytes_ = max_bytes; }
-  static u_int32_t max_bytes() { return max_bytes_; }
-
-  // Returns a pointer to the base of the memory region.  Returns the
-  // cached value if available, otherwise, reads the minidump file and
-  // caches the memory region.
-  const u_int8_t* GetMemory() const;
-
-  // The address of the base of the memory region.
-  u_int64_t GetBase() const;
-
-  // The size, in bytes, of the memory region.
-  u_int32_t GetSize() const;
-
-  // Frees the cached memory region, if cached.
-  void FreeMemory();
-
-  // Obtains the value of memory at the pointer specified by address.
-  bool GetMemoryAtAddress(u_int64_t address, u_int8_t*  value) const;
-  bool GetMemoryAtAddress(u_int64_t address, u_int16_t* value) const;
-  bool GetMemoryAtAddress(u_int64_t address, u_int32_t* value) const;
-  bool GetMemoryAtAddress(u_int64_t address, u_int64_t* value) const;
-
-  // Print a human-readable representation of the object to stdout.
-  void Print();
-
- private:
-  friend class MinidumpThread;
-  friend class MinidumpMemoryList;
-
-  explicit MinidumpMemoryRegion(Minidump* minidump);
-
-  // Identify the base address and size of the memory region, and the
-  // location it may be found in the minidump file.
-  void SetDescriptor(MDMemoryDescriptor* descriptor);
-
-  // Implementation for GetMemoryAtAddress
-  template<typename T> bool GetMemoryAtAddressInternal(u_int64_t address,
-                                                       T*        value) const;
-
-  // The largest memory region that will be read from a minidump.  The
-  // default is 1MB.
-  static u_int32_t max_bytes_;
-
-  // Base address and size of the memory region, and its position in the
-  // minidump file.
-  MDMemoryDescriptor* descriptor_;
-
-  // Cached memory.
-  mutable vector<u_int8_t>* memory_;
-};
-
-
-// MinidumpThread contains information about a thread of execution,
-// including a snapshot of the thread's stack and CPU context.  For
-// the thread that caused an exception, the context carried by
-// MinidumpException is probably desired instead of the CPU context
-// provided here.
-class MinidumpThread : public MinidumpObject {
- public:
-  virtual ~MinidumpThread();
-
-  const MDRawThread* thread() const { return valid_ ? &thread_ : NULL; }
-  MinidumpMemoryRegion* GetMemory();
-  MinidumpContext* GetContext();
-
-  // The thread ID is used to determine if a thread is the exception thread,
-  // so a special getter is provided to retrieve this data from the
-  // MDRawThread structure.  Returns false if the thread ID cannot be
-  // determined.
-  bool GetThreadID(u_int32_t *thread_id) const;
-
-  // Print a human-readable representation of the object to stdout.
-  void Print();
-
- private:
-  // These objects are managed by MinidumpThreadList.
-  friend class MinidumpThreadList;
-
-  explicit MinidumpThread(Minidump* minidump);
-
-  // This works like MinidumpStream::Read, but is driven by
-  // MinidumpThreadList.  No size checking is done, because
-  // MinidumpThreadList handles that directly.
-  bool Read();
-
-  MDRawThread           thread_;
-  MinidumpMemoryRegion* memory_;
-  MinidumpContext*      context_;
-};
-
-
-// MinidumpThreadList contains all of the threads (as MinidumpThreads) in
-// a process.
-class MinidumpThreadList : public MinidumpStream {
- public:
-  virtual ~MinidumpThreadList();
-
-  static void set_max_threads(u_int32_t max_threads) {
-    max_threads_ = max_threads;
-  }
-  static u_int32_t max_threads() { return max_threads_; }
-
-  unsigned int thread_count() const {
-    return valid_ ? thread_count_ : 0;
-  }
-
-  // Sequential access to threads.
-  MinidumpThread* GetThreadAtIndex(unsigned int index) const;
-
-  // Random access to threads.
-  MinidumpThread* GetThreadByID(u_int32_t thread_id);
-
-  // Print a human-readable representation of the object to stdout.
-  void Print();
-
- private:
-  friend class Minidump;
-
-  typedef map<u_int32_t, MinidumpThread*> IDToThreadMap;
-  typedef vector<MinidumpThread> MinidumpThreads;
-
-  static const u_int32_t kStreamType = MD_THREAD_LIST_STREAM;
-
-  explicit MinidumpThreadList(Minidump* aMinidump);
-
-  bool Read(u_int32_t aExpectedSize);
-
-  // The largest number of threads that will be read from a minidump.  The
-  // default is 256.
-  static u_int32_t max_threads_;
-
-  // Access to threads using the thread ID as the key.
-  IDToThreadMap    id_to_thread_map_;
-
-  // The list of threads.
-  MinidumpThreads* threads_;
-  u_int32_t        thread_count_;
-};
-
-
-// MinidumpModule wraps MDRawModule, which contains information about loaded
-// code modules.  Access is provided to various data referenced indirectly
-// by MDRawModule, such as the module's name and a specification for where
-// to locate debugging information for the module.
-class MinidumpModule : public MinidumpObject,
-                       public CodeModule {
- public:
-  virtual ~MinidumpModule();
-
-  static void set_max_cv_bytes(u_int32_t max_cv_bytes) {
-    max_cv_bytes_ = max_cv_bytes;
-  }
-  static u_int32_t max_cv_bytes() { return max_cv_bytes_; }
-
-  static void set_max_misc_bytes(u_int32_t max_misc_bytes) {
-    max_misc_bytes_ = max_misc_bytes;
-  }
-  static u_int32_t max_misc_bytes() { return max_misc_bytes_; }
-
-  const MDRawModule* module() const { return valid_ ? &module_ : NULL; }
-
-  // CodeModule implementation
-  virtual u_int64_t base_address() const {
-    return valid_ ? module_.base_of_image : static_cast<u_int64_t>(-1);
-  }
-  virtual u_int64_t size() const { return valid_ ? module_.size_of_image : 0; }
-  virtual string code_file() const;
-  virtual string code_identifier() const;
-  virtual string debug_file() const;
-  virtual string debug_identifier() const;
-  virtual string version() const;
-  virtual const CodeModule* Copy() const;
-
-  // The CodeView record, which contains information to locate the module's
-  // debugging information (pdb).  This is returned as u_int8_t* because
-  // the data can be of types MDCVInfoPDB20* or MDCVInfoPDB70*, or it may be
-  // of a type unknown to Breakpad, in which case the raw data will still be
-  // returned but no byte-swapping will have been performed.  Check the
-  // record's signature in the first four bytes to differentiate between
-  // the various types.  Current toolchains generate modules which carry
-  // MDCVInfoPDB70 by default.  Returns a pointer to the CodeView record on
-  // success, and NULL on failure.  On success, the optional |size| argument
-  // is set to the size of the CodeView record.
-  const u_int8_t* GetCVRecord(u_int32_t* size);
-
-  // The miscellaneous debug record, which is obsolete.  Current toolchains
-  // do not generate this type of debugging information (dbg), and this
-  // field is not expected to be present.  Returns a pointer to the debugging
-  // record on success, and NULL on failure.  On success, the optional |size|
-  // argument is set to the size of the debugging record.
-  const MDImageDebugMisc* GetMiscRecord(u_int32_t* size);
-
-  // Print a human-readable representation of the object to stdout.
-  void Print();
-
- private:
-  // These objects are managed by MinidumpModuleList.
-  friend class MinidumpModuleList;
-
-  explicit MinidumpModule(Minidump* minidump);
-
-  // This works like MinidumpStream::Read, but is driven by
-  // MinidumpModuleList.  No size checking is done, because
-  // MinidumpModuleList handles that directly.
-  bool Read();
-
-  // Reads indirectly-referenced data, including the module name, CodeView
-  // record, and miscellaneous debugging record.  This is necessary to allow
-  // MinidumpModuleList to fully construct MinidumpModule objects without
-  // requiring seeks to read a contiguous set of MinidumpModule objects.
-  // All auxiliary data should be available when Read is called, in order to
-  // allow the CodeModule getters to be const methods.
-  bool ReadAuxiliaryData();
-
-  // The largest number of bytes that will be read from a minidump for a
-  // CodeView record or miscellaneous debugging record, respectively.  The
-  // default for each is 1024.
-  static u_int32_t max_cv_bytes_;
-  static u_int32_t max_misc_bytes_;
-
-  // True after a successful Read.  This is different from valid_, which is
-  // not set true until ReadAuxiliaryData also completes successfully.
-  // module_valid_ is only used by ReadAuxiliaryData and the functions it
-  // calls to determine whether the object is ready for auxiliary data to 
-  // be read.
-  bool              module_valid_;
-
-  // True if debug info was read from the module.  Certain modules
-  // may contain debug records in formats we don't support,
-  // so we can just set this to false to ignore them.
-  bool              has_debug_info_;
-
-  MDRawModule       module_;
-
-  // Cached module name.
-  const string*     name_;
-
-  // Cached CodeView record - this is MDCVInfoPDB20 or (likely)
-  // MDCVInfoPDB70, or possibly something else entirely.  Stored as a u_int8_t
-  // because the structure contains a variable-sized string and its exact
-  // size cannot be known until it is processed.
-  vector<u_int8_t>* cv_record_;
-
-  // If cv_record_ is present, cv_record_signature_ contains a copy of the
-  // CodeView record's first four bytes, for ease of determinining the
-  // type of structure that cv_record_ contains.
-  u_int32_t cv_record_signature_;
-
-  // Cached MDImageDebugMisc (usually not present), stored as u_int8_t
-  // because the structure contains a variable-sized string and its exact
-  // size cannot be known until it is processed.
-  vector<u_int8_t>* misc_record_;
-};
-
-
-// MinidumpModuleList contains all of the loaded code modules for a process
-// in the form of MinidumpModules.  It maintains a map of these modules
-// so that it may easily provide a code module corresponding to a specific
-// address.
-class MinidumpModuleList : public MinidumpStream,
-                           public CodeModules {
- public:
-  virtual ~MinidumpModuleList();
-
-  static void set_max_modules(u_int32_t max_modules) {
-    max_modules_ = max_modules;
-  }
-  static u_int32_t max_modules() { return max_modules_; }
-
-  // CodeModules implementation.
-  virtual unsigned int module_count() const {
-    return valid_ ? module_count_ : 0;
-  }
-  virtual const MinidumpModule* GetModuleForAddress(u_int64_t address) const;
-  virtual const MinidumpModule* GetMainModule() const;
-  virtual const MinidumpModule* GetModuleAtSequence(
-      unsigned int sequence) const;
-  virtual const MinidumpModule* GetModuleAtIndex(unsigned int index) const;
-  virtual const CodeModules* Copy() const;
-
-  // Print a human-readable representation of the object to stdout.
-  void Print();
-
- private:
-  friend class Minidump;
-
-  typedef vector<MinidumpModule> MinidumpModules;
-
-  static const u_int32_t kStreamType = MD_MODULE_LIST_STREAM;
-
-  explicit MinidumpModuleList(Minidump* minidump);
-
-  bool Read(u_int32_t expected_size);
-
-  // The largest number of modules that will be read from a minidump.  The
-  // default is 1024.
-  static u_int32_t max_modules_;
-
-  // Access to modules using addresses as the key.
-  RangeMap<u_int64_t, unsigned int> *range_map_;
-
-  MinidumpModules *modules_;
-  u_int32_t module_count_;
-};
-
-
-// MinidumpMemoryList corresponds to a minidump's MEMORY_LIST_STREAM stream,
-// which references the snapshots of all of the memory regions contained
-// within the minidump.  For a normal minidump, this includes stack memory
-// (also referenced by each MinidumpThread, in fact, the MDMemoryDescriptors
-// here and in MDRawThread both point to exactly the same data in a
-// minidump file, conserving space), as well as a 256-byte snapshot of memory
-// surrounding the instruction pointer in the case of an exception.  Other
-// types of minidumps may contain significantly more memory regions.  Full-
-// memory minidumps contain all of a process' mapped memory.
-class MinidumpMemoryList : public MinidumpStream {
- public:
-  virtual ~MinidumpMemoryList();
-
-  static void set_max_regions(u_int32_t max_regions) {
-    max_regions_ = max_regions;
-  }
-  static u_int32_t max_regions() { return max_regions_; }
-
-  unsigned int region_count() const { return valid_ ? region_count_ : 0; }
-
-  // Sequential access to memory regions.
-  MinidumpMemoryRegion* GetMemoryRegionAtIndex(unsigned int index);
-
-  // Random access to memory regions.  Returns the region encompassing
-  // the address identified by address.
-  MinidumpMemoryRegion* GetMemoryRegionForAddress(u_int64_t address);
-
-  // Print a human-readable representation of the object to stdout.
-  void Print();
-
- private:
-  friend class Minidump;
-
-  typedef vector<MDMemoryDescriptor>   MemoryDescriptors;
-  typedef vector<MinidumpMemoryRegion> MemoryRegions;
-
-  static const u_int32_t kStreamType = MD_MEMORY_LIST_STREAM;
-
-  explicit MinidumpMemoryList(Minidump* minidump);
-
-  bool Read(u_int32_t expected_size);
-
-  // The largest number of memory regions that will be read from a minidump.
-  // The default is 256.
-  static u_int32_t max_regions_;
-
-  // Access to memory regions using addresses as the key.
-  RangeMap<u_int64_t, unsigned int> *range_map_;
-
-  // The list of descriptors.  This is maintained separately from the list
-  // of regions, because MemoryRegion doesn't own its MemoryDescriptor, it
-  // maintains a pointer to it.  descriptors_ provides the storage for this
-  // purpose.
-  MemoryDescriptors *descriptors_;
-
-  // The list of regions.
-  MemoryRegions *regions_;
-  u_int32_t region_count_;
-};
-
-
-// MinidumpException wraps MDRawExceptionStream, which contains information
-// about the exception that caused the minidump to be generated, if the
-// minidump was generated in an exception handler called as a result of
-// an exception.  It also provides access to a MinidumpContext object,
-// which contains the CPU context for the exception thread at the time
-// the exception occurred.
-class MinidumpException : public MinidumpStream {
- public:
-  virtual ~MinidumpException();
-
-  const MDRawExceptionStream* exception() const {
-    return valid_ ? &exception_ : NULL;
-  }
-
-  // The thread ID is used to determine if a thread is the exception thread,
-  // so a special getter is provided to retrieve this data from the
-  // MDRawExceptionStream structure.  Returns false if the thread ID cannot
-  // be determined.
-  bool GetThreadID(u_int32_t *thread_id) const;
-
-  MinidumpContext* GetContext();
-
-  // Print a human-readable representation of the object to stdout.
-  void Print();
-
- private:
-  friend class Minidump;
-
-  static const u_int32_t kStreamType = MD_EXCEPTION_STREAM;
-
-  explicit MinidumpException(Minidump* minidump);
-
-  bool Read(u_int32_t expected_size);
-
-  MDRawExceptionStream exception_;
-  MinidumpContext*     context_;
-};
-
-// MinidumpAssertion wraps MDRawAssertionInfo, which contains information
-// about an assertion that caused the minidump to be generated.
-class MinidumpAssertion : public MinidumpStream {
- public:
-  virtual ~MinidumpAssertion();
-
-  const MDRawAssertionInfo* assertion() const {
-    return valid_ ? &assertion_ : NULL;
-  }
-
-  string expression() const {
-    return valid_ ? expression_ : "";
-  }
-
-  string function() const {
-    return valid_ ? function_ : "";
-  }
-
-  string file() const {
-    return valid_ ? file_ : "";
-  }
-
-  // Print a human-readable representation of the object to stdout.
-  void Print();
-
- private:
-  friend class Minidump;
-
-  static const u_int32_t kStreamType = MD_ASSERTION_INFO_STREAM;
-
-  explicit MinidumpAssertion(Minidump* minidump);
-
-  bool Read(u_int32_t expected_size);
-
-  MDRawAssertionInfo assertion_;
-  string expression_;
-  string function_;
-  string file_;
-};
-
-
-// MinidumpSystemInfo wraps MDRawSystemInfo and provides information about
-// the system on which the minidump was generated.  See also MinidumpMiscInfo.
-class MinidumpSystemInfo : public MinidumpStream {
- public:
-  virtual ~MinidumpSystemInfo();
-
-  const MDRawSystemInfo* system_info() const {
-    return valid_ ? &system_info_ : NULL;
-  }
-
-  // GetOS and GetCPU return textual representations of the operating system
-  // and CPU that produced the minidump.  Unlike most other Minidump* methods,
-  // they return string objects, not weak pointers.  Defined values for
-  // GetOS() are "mac", "windows", and "linux".  Defined values for GetCPU
-  // are "x86" and "ppc".  These methods return an empty string when their
-  // values are unknown.
-  string GetOS();
-  string GetCPU();
-
-  // I don't know what CSD stands for, but this field is documented as
-  // returning a textual representation of the OS service pack.  On other
-  // platforms, this provides additional information about an OS version
-  // level beyond major.minor.micro.  Returns NULL if unknown.
-  const string* GetCSDVersion();
-
-  // If a CPU vendor string can be determined, returns a pointer to it,
-  // otherwise, returns NULL.  CPU vendor strings can be determined from
-  // x86 CPUs with CPUID 0.
-  const string* GetCPUVendor();
-
-  // Print a human-readable representation of the object to stdout.
-  void Print();
-
- private:
-  friend class Minidump;
-
-  static const u_int32_t kStreamType = MD_SYSTEM_INFO_STREAM;
-
-  explicit MinidumpSystemInfo(Minidump* minidump);
-
-  bool Read(u_int32_t expected_size);
-
-  MDRawSystemInfo system_info_;
-
-  // Textual representation of the OS service pack, for minidumps produced
-  // by MiniDumpWriteDump on Windows.
-  const string* csd_version_;
-
-  // A string identifying the CPU vendor, if known.
-  const string* cpu_vendor_;
-};
-
-
-// MinidumpMiscInfo wraps MDRawMiscInfo and provides information about
-// the process that generated the minidump, and optionally additional system
-// information.  See also MinidumpSystemInfo.
-class MinidumpMiscInfo : public MinidumpStream {
- public:
-  const MDRawMiscInfo* misc_info() const {
-    return valid_ ? &misc_info_ : NULL;
-  }
-
-  // Print a human-readable representation of the object to stdout.
-  void Print();
-
- private:
-  friend class Minidump;
-
-  static const u_int32_t kStreamType = MD_MISC_INFO_STREAM;
-
-  explicit MinidumpMiscInfo(Minidump* minidump_);
-
-  bool Read(u_int32_t expected_size_);
-
-  MDRawMiscInfo misc_info_;
-};
-
-
-// MinidumpBreakpadInfo wraps MDRawBreakpadInfo, which is an optional stream in
-// a minidump that provides additional information about the process state
-// at the time the minidump was generated.
-class MinidumpBreakpadInfo : public MinidumpStream {
- public:
-  const MDRawBreakpadInfo* breakpad_info() const {
-    return valid_ ? &breakpad_info_ : NULL;
-  }
-
-  // These thread IDs are used to determine if threads deserve special
-  // treatment, so special getters are provided to retrieve this data from
-  // the MDRawBreakpadInfo structure.  The getters return false if the thread
-  // IDs cannot be determined.
-  bool GetDumpThreadID(u_int32_t *thread_id) const;
-  bool GetRequestingThreadID(u_int32_t *thread_id) const;
-
-  // Print a human-readable representation of the object to stdout.
-  void Print();
-
- private:
-  friend class Minidump;
-
-  static const u_int32_t kStreamType = MD_BREAKPAD_INFO_STREAM;
-
-  explicit MinidumpBreakpadInfo(Minidump* minidump_);
-
-  bool Read(u_int32_t expected_size_);
-
-  MDRawBreakpadInfo breakpad_info_;
-};
-
-// MinidumpMemoryInfo wraps MDRawMemoryInfo, which provides information
-// about mapped memory regions in a process, including their ranges
-// and protection.
-class MinidumpMemoryInfo : public MinidumpObject {
- public:
-  const MDRawMemoryInfo* info() const { return valid_ ? &memory_info_ : NULL; }
-
-  // The address of the base of the memory region.
-  u_int64_t GetBase() const { return valid_ ? memory_info_.base_address : 0; }
-
-  // The size, in bytes, of the memory region.
-  u_int32_t GetSize() const { return valid_ ? memory_info_.region_size : 0; }
-
-  // Return true if the memory protection allows execution.
-  bool IsExecutable() const;
-
-  // Return true if the memory protection allows writing.
-  bool IsWritable() const;
-
-  // Print a human-readable representation of the object to stdout.
-  void Print();
-
- private:
-  // These objects are managed by MinidumpMemoryInfoList.
-  friend class MinidumpMemoryInfoList;
-
-  explicit MinidumpMemoryInfo(Minidump* minidump);
-
-  // This works like MinidumpStream::Read, but is driven by
-  // MinidumpMemoryInfoList.  No size checking is done, because
-  // MinidumpMemoryInfoList handles that directly.
-  bool Read();
-
-  MDRawMemoryInfo memory_info_;
-};
-
-// MinidumpMemoryInfoList contains a list of information about
-// mapped memory regions for a process in the form of MDRawMemoryInfo.
-// It maintains a map of these structures so that it may easily provide
-// info corresponding to a specific address.
-class MinidumpMemoryInfoList : public MinidumpStream {
- public:
-  virtual ~MinidumpMemoryInfoList();
-
-  unsigned int info_count() const { return valid_ ? info_count_ : 0; }
-
-  const MinidumpMemoryInfo* GetMemoryInfoForAddress(u_int64_t address) const;
-  const MinidumpMemoryInfo* GetMemoryInfoAtIndex(unsigned int index) const;
-
-  // Print a human-readable representation of the object to stdout.
-  void Print();
-
- private:
-  friend class Minidump;
-
-  typedef vector<MinidumpMemoryInfo> MinidumpMemoryInfos;
-
-  static const u_int32_t kStreamType = MD_MEMORY_INFO_LIST_STREAM;
-
-  explicit MinidumpMemoryInfoList(Minidump* minidump);
-
-  bool Read(u_int32_t expected_size);
-
-  // Access to memory info using addresses as the key.
-  RangeMap<u_int64_t, unsigned int> *range_map_;
-
-  MinidumpMemoryInfos* infos_;
-  u_int32_t info_count_;
-};
-
-
-// Minidump is the user's interface to a minidump file.  It wraps MDRawHeader
-// and provides access to the minidump's top-level stream directory.
-class Minidump {
- public:
-  // path is the pathname of a file containing the minidump.
-  explicit Minidump(const string& path);
-  // input is an istream wrapping minidump data. Minidump holds a
-  // weak pointer to input, and the caller must ensure that the stream
-  // is valid as long as the Minidump object is.
-  explicit Minidump(std::istream& input);
-
-  virtual ~Minidump();
-
-  // path may be empty if the minidump was not opened from a file
-  virtual string path() const {
-    return path_;
-  }
-  static void set_max_streams(u_int32_t max_streams) {
-    max_streams_ = max_streams;
-  }
-  static u_int32_t max_streams() { return max_streams_; }
-
-  static void set_max_string_length(u_int32_t max_string_length) {
-    max_string_length_ = max_string_length;
-  }
-  static u_int32_t max_string_length() { return max_string_length_; }
-
-  virtual const MDRawHeader* header() const { return valid_ ? &header_ : NULL; }
-
-  // Reads the minidump file's header and top-level stream directory.
-  // The minidump is expected to be positioned at the beginning of the
-  // header.  Read() sets up the stream list and map, and validates the
-  // Minidump object.
-  virtual bool Read();
-
-  // The next set of methods are stubs that call GetStream.  They exist to
-  // force code generation of the templatized API within the module, and
-  // to avoid exposing an ugly API (GetStream needs to accept a garbage
-  // parameter).
-  virtual MinidumpThreadList* GetThreadList();
-  MinidumpModuleList* GetModuleList();
-  MinidumpMemoryList* GetMemoryList();
-  MinidumpException* GetException();
-  MinidumpAssertion* GetAssertion();
-  MinidumpSystemInfo* GetSystemInfo();
-  MinidumpMiscInfo* GetMiscInfo();
-  MinidumpBreakpadInfo* GetBreakpadInfo();
-  MinidumpMemoryInfoList* GetMemoryInfoList();
-
-  // The next set of methods are provided for users who wish to access
-  // data in minidump files directly, while leveraging the rest of
-  // this class and related classes to handle the basic minidump
-  // structure and known stream types.
-
-  unsigned int GetDirectoryEntryCount() const {
-    return valid_ ? header_.stream_count : 0;
-  }
-  const MDRawDirectory* GetDirectoryEntryAtIndex(unsigned int index) const;
-
-  // The next 2 methods are lower-level I/O routines.  They use fd_.
-
-  // Reads count bytes from the minidump at the current position into
-  // the storage area pointed to by bytes.  bytes must be of sufficient
-  // size.  After the read, the file position is advanced by count.
-  bool ReadBytes(void* bytes, size_t count);
-
-  // Sets the position of the minidump file to offset.
-  bool SeekSet(off_t offset);
-
-  // Returns the current position of the minidump file.
-  off_t Tell();
-
-  // The next 2 methods are medium-level I/O routines.
-
-  // ReadString returns a string which is owned by the caller!  offset
-  // specifies the offset that a length-encoded string is stored at in the
-  // minidump file.
-  string* ReadString(off_t offset);
-
-  // SeekToStreamType positions the file at the beginning of a stream
-  // identified by stream_type, and informs the caller of the stream's
-  // length by setting *stream_length.  Because stream_map maps each stream
-  // type to only one stream in the file, this might mislead the user into
-  // thinking that the stream that this seeks to is the only stream with
-  // type stream_type.  That can't happen for streams that these classes
-  // deal with directly, because they're only supposed to be present in the
-  // file singly, and that's verified when stream_map_ is built.  Users who
-  // are looking for other stream types should be aware of this
-  // possibility, and consider using GetDirectoryEntryAtIndex (possibly
-  // with GetDirectoryEntryCount) if expecting multiple streams of the same
-  // type in a single minidump file.
-  bool SeekToStreamType(u_int32_t stream_type, u_int32_t* stream_length);
-
-  bool swap() const { return valid_ ? swap_ : false; }
-
-  // Print a human-readable representation of the object to stdout.
-  void Print();
-
- private:
-  // MinidumpStreamInfo is used in the MinidumpStreamMap.  It lets
-  // the Minidump object locate interesting streams quickly, and
-  // provides a convenient place to stash MinidumpStream objects.
-  struct MinidumpStreamInfo {
-    MinidumpStreamInfo() : stream_index(0), stream(NULL) {}
-    ~MinidumpStreamInfo() { delete stream; }
-
-    // Index into the MinidumpDirectoryEntries vector
-    unsigned int    stream_index;
-
-    // Pointer to the stream if cached, or NULL if not yet populated
-    MinidumpStream* stream;
-  };
-
-  typedef vector<MDRawDirectory> MinidumpDirectoryEntries;
-  typedef map<u_int32_t, MinidumpStreamInfo> MinidumpStreamMap;
-
-  template<typename T> T* GetStream(T** stream);
-
-  // Opens the minidump file, or if already open, seeks to the beginning.
-  bool Open();
-
-  // The largest number of top-level streams that will be read from a minidump.
-  // Note that streams are only read (and only consume memory) as needed,
-  // when directed by the caller.  The default is 128.
-  static u_int32_t max_streams_;
-
-  // The maximum length of a UTF-16 string that will be read from a minidump
-  // in 16-bit words.  The default is 1024.  UTF-16 strings are converted
-  // to UTF-8 when stored in memory, and each UTF-16 word will be represented
-  // by as many as 3 bytes in UTF-8.
-  static unsigned int max_string_length_;
-
-  MDRawHeader               header_;
-
-  // The list of streams.
-  MinidumpDirectoryEntries* directory_;
-
-  // Access to streams using the stream type as the key.
-  MinidumpStreamMap*        stream_map_;
-
-  // The pathname of the minidump file to process, set in the constructor.
-  // This may be empty if the minidump was opened directly from a stream.
-  const string              path_;
-
-  // The stream for all file I/O.  Used by ReadBytes and SeekSet.
-  // Set based on the path in Open, or directly in the constructor.
-  std::istream*             stream_;
-
-  // swap_ is true if the minidump file should be byte-swapped.  If the
-  // minidump was produced by a CPU that is other-endian than the CPU
-  // processing the minidump, this will be true.  If the two CPUs are
-  // same-endian, this will be false.
-  bool                      swap_;
-
-  // Validity of the Minidump structure, false immediately after
-  // construction or after a failed Read(); true following a successful
-  // Read().
-  bool                      valid_;
-};
-
-
-}  // namespace google_breakpad
-
-
-#endif  // GOOGLE_BREAKPAD_PROCESSOR_MINIDUMP_H__
diff --git a/third_party/breakpad/src/google_breakpad/processor/minidump_processor.h b/third_party/breakpad/src/google_breakpad/processor/minidump_processor.h
deleted file mode 100644
index 384c60c..0000000
--- a/third_party/breakpad/src/google_breakpad/processor/minidump_processor.h
+++ /dev/null
@@ -1,169 +0,0 @@
-// Copyright (c) 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef GOOGLE_BREAKPAD_PROCESSOR_MINIDUMP_PROCESSOR_H__
-#define GOOGLE_BREAKPAD_PROCESSOR_MINIDUMP_PROCESSOR_H__
-
-#include <assert.h>
-#include <string>
-#include "google_breakpad/common/breakpad_types.h"
-
-namespace google_breakpad {
-
-using std::string;
-
-class Minidump;
-class ProcessState;
-class SourceLineResolverInterface;
-class SymbolSupplier;
-class SystemInfo;
-// Return type for Process()
-enum ProcessResult {
-  PROCESS_OK,                                 // The minidump was
-                                              // processed
-                                              // successfully.
-
-  PROCESS_ERROR_MINIDUMP_NOT_FOUND,           // The minidump file
-                                              // was not found.
-
-  PROCESS_ERROR_NO_MINIDUMP_HEADER,           // The minidump file
-                                              // had no header
-
-  PROCESS_ERROR_NO_THREAD_LIST,               // The minidump file
-                                              // had no thread list.
-
-  PROCESS_ERROR_GETTING_THREAD,               // There was an error
-                                              // getting one
-                                              // thread's data from
-                                              // the minidump.
-
-  PROCESS_ERROR_GETTING_THREAD_ID,            // There was an error
-                                              // getting a thread id
-                                              // from the thread's
-                                              // data.
-
-  PROCESS_ERROR_DUPLICATE_REQUESTING_THREADS, // There was more than
-                                              // one requesting
-                                              // thread.
-
-  PROCESS_ERROR_NO_MEMORY_FOR_THREAD,         // A thread had no
-                                              // memory region.
-
-  PROCESS_ERROR_NO_STACKWALKER_FOR_THREAD,    // We couldn't
-                                              // determine the
-                                              // StackWalker to walk
-                                              // the minidump's
-                                              // threads.
-
-  PROCESS_SYMBOL_SUPPLIER_INTERRUPTED         // The minidump
-                                              // processing was
-                                              // interrupted by the
-                                              // SymbolSupplier(not
-                                              // fatal)
-};
-
-class MinidumpProcessor {
- public:
-  // Initializes this MinidumpProcessor.  supplier should be an
-  // implementation of the SymbolSupplier abstract base class.
-  MinidumpProcessor(SymbolSupplier *supplier,
-                    SourceLineResolverInterface *resolver);
-
-  // Initializes the MinidumpProcessor with the option of
-  // enabling the exploitability framework to analyze dumps
-  // for probable security relevance.
-  MinidumpProcessor(SymbolSupplier *supplier,
-                    SourceLineResolverInterface *resolver,
-                    bool enable_exploitability);
-
-  ~MinidumpProcessor();
-
-  // Processes the minidump file and fills process_state with the result.
-  ProcessResult Process(const string &minidump_file,
-                        ProcessState *process_state);
-
-  // Processes the minidump structure and fills process_state with the
-  // result.
-  ProcessResult Process(Minidump *minidump,
-                        ProcessState *process_state);
-  // Populates the cpu_* fields of the |info| parameter with textual
-  // representations of the CPU type that the minidump in |dump| was
-  // produced on.  Returns false if this information is not available in
-  // the minidump.
-  static bool GetCPUInfo(Minidump *dump, SystemInfo *info);
-
-  // Populates the os_* fields of the |info| parameter with textual
-  // representations of the operating system that the minidump in |dump|
-  // was produced on.  Returns false if this information is not available in
-  // the minidump.
-  static bool GetOSInfo(Minidump *dump, SystemInfo *info);
-
-  // Returns a textual representation of the reason that a crash occurred,
-  // if the minidump in dump was produced as a result of a crash.  Returns
-  // an empty string if this information cannot be determined.  If address
-  // is non-NULL, it will be set to contain the address that caused the
-  // exception, if this information is available.  This will be a code
-  // address when the crash was caused by problems such as illegal
-  // instructions or divisions by zero, or a data address when the crash
-  // was caused by a memory access violation.
-  static string GetCrashReason(Minidump *dump, u_int64_t *address);
-
-  // This function returns true if the passed-in error code is
-  // something unrecoverable(i.e. retry should not happen).  For
-  // instance, if the minidump is corrupt, then it makes no sense to
-  // retry as we won't be able to glean additional information.
-  // However, as an example of the other case, the symbol supplier can
-  // return an error code indicating it was 'interrupted', which can
-  // happen of the symbols are fetched from a remote store, and a
-  // retry might be successful later on.
-  // You should not call this method with PROCESS_OK! Test for
-  // that separately before calling this.
-  static bool IsErrorUnrecoverable(ProcessResult p) {
-    assert(p !=  PROCESS_OK);
-    return (p != PROCESS_SYMBOL_SUPPLIER_INTERRUPTED);
-  }
-
-  // Returns a textual representation of an assertion included
-  // in the minidump.  Returns an empty string if this information
-  // does not exist or cannot be determined.
-  static string GetAssertion(Minidump *dump);
-
- private:
-  SymbolSupplier *supplier_;
-  SourceLineResolverInterface *resolver_;
-
-  // This flag enables the exploitability scanner which attempts to
-  // guess how likely it is that the crash represents an exploitable
-  // memory corruption issue.
-  bool enable_exploitability_;
-};
-
-}  // namespace google_breakpad
-
-#endif  // GOOGLE_BREAKPAD_PROCESSOR_MINIDUMP_PROCESSOR_H__
diff --git a/third_party/breakpad/src/google_breakpad/processor/network_source_line_resolver.h b/third_party/breakpad/src/google_breakpad/processor/network_source_line_resolver.h
deleted file mode 100644
index 138b2f5..0000000
--- a/third_party/breakpad/src/google_breakpad/processor/network_source_line_resolver.h
+++ /dev/null
@@ -1,184 +0,0 @@
-// Copyright (c) 2010, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// NetworkSourceLineResolver implements SourceLineResolverInterface and
-// SymbolSupplier using a UDP-based network protocol to communicate to a
-// server process which handles the lower-level details of loading symbols
-// and resolving source info. When used, it must be used simultaneously
-// as the SourceLineResolver and SymbolSupplier.
-//
-// See network_source_line_server.h for a description of the protocol used.
-// An implementation of the server side of the protocol is provided there
-// as NetworkSourceLineServer.
-
-#ifndef GOOGLE_BREAKPAD_PROCESSOR_NETWORK_SOURCE_LINE_RESOLVER_H__
-#define GOOGLE_BREAKPAD_PROCESSOR_NETWORK_SOURCE_LINE_RESOLVER_H__
-
-#include <sys/socket.h>
-
-#include <map>
-#include <set>
-
-#include "google_breakpad/common/breakpad_types.h"
-#include "google_breakpad/processor/source_line_resolver_interface.h"
-#include "google_breakpad/processor/stack_frame.h"
-#include "google_breakpad/processor/symbol_supplier.h"
-#include "processor/binarystream.h"
-#include "processor/linked_ptr.h"
-#include "processor/network_interface.h"
-
-namespace google_breakpad {
-
-using std::string;
-
-class NetworkSourceLineResolver : public SourceLineResolverInterface,
-                                  public SymbolSupplier {
- public:
-  // The server and port to connect to, and the
-  // maximum time (in milliseconds) to wait for network replies.
-  NetworkSourceLineResolver(const string &server,
-                            unsigned short port,
-                            int wait_milliseconds);
-  // The network interface to connect to, and maximum wait time.
-  NetworkSourceLineResolver(NetworkInterface *net,
-                            int wait_milliseconds);
-  virtual ~NetworkSourceLineResolver();
-  
-  // SourceLineResolverInterface methods, see source_line_resolver_interface.h
-  // for more details.
-
-
-  // These methods are actually NOOPs in this implementation.
-  // The server loads modules as a result of the GetSymbolFile call.
-  // Since we're both the symbol supplier and source line resolver,
-  // this is an optimization.
-  virtual bool LoadModule(const CodeModule *module, const string &map_file);
-  virtual bool LoadModuleUsingMapBuffer(const CodeModule *module,
-                                        const string &map_buffer);
-  virtual bool LoadModuleUsingMemoryBuffer(const CodeModule *module,
-                                           char *memory_buffer);
-
-  // It doesn't matter whether returns true or false, since no memory buffer
-  // will be allocated in GetCStringSymbolData().
-  virtual bool ShouldDeleteMemoryBufferAfterLoadModule() { return true; }
-
-  void UnloadModule(const CodeModule *module);
-
-  virtual bool HasModule(const CodeModule *module);
-
-  virtual void FillSourceLineInfo(StackFrame *frame);
-  virtual WindowsFrameInfo *FindWindowsFrameInfo(const StackFrame *frame);
-  virtual CFIFrameInfo *FindCFIFrameInfo(const StackFrame *frame);
-
-  // SymbolSupplier methods, see symbol_supplier.h for more details.
-  // Note that the server will actually load the symbol data
-  // in response to this request, as an optimization.
-  virtual SymbolResult GetSymbolFile(const CodeModule *module,
-                                     const SystemInfo *system_info,
-                                     string *symbol_file);
-  //FIXME: we'll never return symbol_data here, it doesn't make sense.
-  // the SymbolSupplier interface should just state that the supplier
-  // *may* fill in symbol_data if it desires, and clients should
-  // handle it gracefully either way.
-  virtual SymbolResult GetSymbolFile(const CodeModule *module,
-                                     const SystemInfo *system_info,
-                                     string *symbol_file,
-                                     string *symbol_data);
-  // Similar as the above GetSymbolFile() method, see the comment above.
-  virtual SymbolResult GetCStringSymbolData(const CodeModule *module,
-                                            const SystemInfo *system_info,
-                                            string *symbol_file,
-                                            char **symbol_data);
-
-  // Delete the data buffer allocated in GetCStringSymbolData().
-  // Since the above GetCStringSymbolData() won't allocate any memory at all,
-  // this method is no-op.
-  virtual void FreeSymbolData(const CodeModule *module) { }
-
- private:
-  int wait_milliseconds_;
-  // if false, some part of our network setup failed.
-  bool initialized_;
-  // sequence number of the last request we made
-  u_int16_t sequence_;
-  NetworkInterface *net_;
-  // cached list of loaded modules, so we can quickly answer
-  // HasModule requests for modules we've already queried the
-  // server about, avoiding another network round-trip.
-  std::set<string> module_cache_;
-  // cached list of modules for which we don't have symbols,
-  // so we can short-circuit that as well.
-  std::set<string> no_symbols_cache_;
-
-  // Cached list of source line info, to avoid repeated GET requests
-  // for the same frame. In Multithreaded apps that use the same
-  // framework across threads, it's pretty common to hit the same
-  // exact set of frames in multiple threads.
-  // Data is stored in the cache keyed by instruction pointer
-  typedef std::map<u_int64_t, StackFrame> SourceCache;
-  SourceCache source_line_info_cache_;
-
-  // Cached list of WindowsFrameInfo/CFIFrameInfo, for the same reason.
-  // Stored as serialized strings to avoid shuffling around pointers.
-  typedef std::map<u_int64_t, string> FrameInfoCache;
-
-  typedef enum {
-    kWindowsFrameInfo = 0,
-    kCFIFrameInfo = 1,
-  } FrameInfoType;
-  FrameInfoCache frame_info_cache_[2];
-  
-  // Send a message to the server, wait a certain amount of time for a reply.
-  // Returns true if a response is received, with the response data
-  // in |response|.
-  // Returns false if the response times out.
-  bool SendMessageGetResponse(const binarystream &message,
-                              binarystream &response);
-
-  // See if this stack frame is cached, and fill in the source line info
-  // if so.
-  bool FindCachedSourceLineInfo(StackFrame *frame) const;
-  bool FindCachedFrameInfo(const StackFrame *frame,
-                           FrameInfoType type,
-                           string *info) const;
-
-  // Save this stack frame in the cache
-  void CacheSourceLineInfo(const StackFrame *frame);
-  void CacheFrameInfo(const StackFrame *frame,
-                      FrameInfoType type,
-                      const string &info);
-
-  // Disallow unwanted copy ctor and assignment operator
-  NetworkSourceLineResolver(const NetworkSourceLineResolver&);
-  void operator=(const NetworkSourceLineResolver&);
-};
-
-}  // namespace google_breakpad
-
-#endif  // GOOGLE_BREAKPAD_PROCESSOR_NETWORK_SOURCE_LINE_RESOLVER_H__
diff --git a/third_party/breakpad/src/google_breakpad/processor/process_state.h b/third_party/breakpad/src/google_breakpad/processor/process_state.h
deleted file mode 100644
index f3f2ec4..0000000
--- a/third_party/breakpad/src/google_breakpad/processor/process_state.h
+++ /dev/null
@@ -1,168 +0,0 @@
-// Copyright (c) 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// process_state.h: A snapshot of a process, in a fully-digested state.
-//
-// Author: Mark Mentovai
-
-#ifndef GOOGLE_BREAKPAD_PROCESSOR_PROCESS_STATE_H__
-#define GOOGLE_BREAKPAD_PROCESSOR_PROCESS_STATE_H__
-
-#include <string>
-#include <vector>
-#include "google_breakpad/common/breakpad_types.h"
-#include "google_breakpad/processor/system_info.h"
-#include "google_breakpad/processor/minidump.h"
-
-namespace google_breakpad {
-
-using std::string;
-using std::vector;
-
-class CallStack;
-class CodeModules;
-
-enum ExploitabilityRating {
-  EXPLOITABILITY_HIGH,                    // The crash likely represents
-                                          // a exploitable memory corruption
-                                          // vulnerability.
-
-  EXPLOITABLITY_MEDIUM,                   // The crash appears to corrupt
-                                          // memory in a way which may be
-                                          // exploitable in some situations.
-
-  EXPLOITABILITY_LOW,                     // The crash either does not corrupt
-                                          // memory directly or control over
-                                          // the effected data is limited. The
-                                          // issue may still be exploitable
-                                          // on certain platforms or situations.
-
-  EXPLOITABILITY_INTERESTING,             // The crash does not appear to be
-                                          // directly exploitable. However it
-                                          // represents a condition which should
-                                          // be furthur analyzed.
-
-  EXPLOITABILITY_NONE,                    // The crash does not appear to represent
-                                          // an exploitable condition.
-
-  EXPLOITABILITY_NOT_ANALYZED,            // The crash was not analyzed for
-                                          // exploitability because the engine
-                                          // was disabled.
-
-  EXPLOITABILITY_ERR_NOENGINE,            // The supplied minidump's platform does
-                                          // not have a exploitability engine
-                                          // associated with it.
-
-  EXPLOITABILITY_ERR_PROCESSING           // An error occured within the
-                                          // exploitability engine and no rating
-                                          // was calculated.
-};
-
-class ProcessState {
- public:
-  ProcessState() : modules_(NULL) { Clear(); }
-  ~ProcessState();
-
-  // Resets the ProcessState to its default values
-  void Clear();
-
-  // Accessors.  See the data declarations below.
-  u_int32_t time_date_stamp() const { return time_date_stamp_; }
-  bool crashed() const { return crashed_; }
-  string crash_reason() const { return crash_reason_; }
-  u_int64_t crash_address() const { return crash_address_; }
-  string assertion() const { return assertion_; }
-  int requesting_thread() const { return requesting_thread_; }
-  const vector<CallStack*>* threads() const { return &threads_; }
-  const vector<MinidumpMemoryRegion*>* thread_memory_regions() const {
-    return &thread_memory_regions_;
-  }
-  const SystemInfo* system_info() const { return &system_info_; }
-  const CodeModules* modules() const { return modules_; }
-  ExploitabilityRating exploitability() const { return exploitability_; }
-
- private:
-  // MinidumpProcessor is responsible for building ProcessState objects.
-  friend class MinidumpProcessor;
-
-  // The time-date stamp of the minidump (time_t format)
-  u_int32_t time_date_stamp_;
-
-  // True if the process crashed, false if the dump was produced outside
-  // of an exception handler.
-  bool crashed_;
-
-  // If the process crashed, the type of crash.  OS- and possibly CPU-
-  // specific.  For example, "EXCEPTION_ACCESS_VIOLATION" (Windows),
-  // "EXC_BAD_ACCESS / KERN_INVALID_ADDRESS" (Mac OS X), "SIGSEGV"
-  // (other Unix).
-  string crash_reason_;
-
-  // If the process crashed, and if crash_reason implicates memory,
-  // the memory address that caused the crash.  For data access errors,
-  // this will be the data address that caused the fault.  For code errors,
-  // this will be the address of the instruction that caused the fault.
-  u_int64_t crash_address_;
-
-  // If there was an assertion that was hit, a textual representation
-  // of that assertion, possibly including the file and line at which
-  // it occurred.
-  string assertion_;
-
-  // The index of the thread that requested a dump be written in the
-  // threads vector.  If a dump was produced as a result of a crash, this
-  // will point to the thread that crashed.  If the dump was produced as
-  // by user code without crashing, and the dump contains extended Breakpad
-  // information, this will point to the thread that requested the dump.
-  // If the dump was not produced as a result of an exception and no
-  // extended Breakpad information is present, this field will be set to -1,
-  // indicating that the dump thread is not available.
-  int requesting_thread_;
-
-  // Stacks for each thread (except possibly the exception handler
-  // thread) at the time of the crash.
-  vector<CallStack*> threads_;
-  vector<MinidumpMemoryRegion*> thread_memory_regions_;
-
-  // OS and CPU information.
-  SystemInfo system_info_;
-
-  // The modules that were loaded into the process represented by the
-  // ProcessState.
-  const CodeModules *modules_;
-
-  // The exploitability rating as determined by the exploitability
-  // engine. When the exploitability engine is not enabled this
-  // defaults to EXPLOITABILITY_NONE.
-  ExploitabilityRating exploitability_;
-};
-
-}  // namespace google_breakpad
-
-#endif  // GOOGLE_BREAKPAD_PROCESSOR_PROCESS_STATE_H__
diff --git a/third_party/breakpad/src/google_breakpad/processor/source_line_resolver_base.h b/third_party/breakpad/src/google_breakpad/processor/source_line_resolver_base.h
deleted file mode 100644
index efa76e7..0000000
--- a/third_party/breakpad/src/google_breakpad/processor/source_line_resolver_base.h
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright (c) 2010 Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// source_line_resolver_base.h: SourceLineResolverBase, an (incomplete)
-// implementation of SourceLineResolverInterface.  It serves as a common base
-// class for concrete implementations: FastSourceLineResolver and
-// BasicSourceLineResolver.  It is designed for refactoring that removes
-// code redundancy in the two concrete source line resolver classes.
-//
-// See "google_breakpad/processor/source_line_resolver_interface.h" for more
-// documentation.
-
-// Author: Siyang Xie (lambxsy@google.com)
-
-#ifndef GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_BASE_H__
-#define GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_BASE_H__
-
-#include <map>
-#include <string>
-
-#include "google_breakpad/processor/source_line_resolver_interface.h"
-
-namespace google_breakpad {
-
-using std::map;
-
-// Forward declaration.
-// ModuleFactory is a simple factory interface for creating a Module instance
-// at run-time.
-class ModuleFactory;
-
-class SourceLineResolverBase : public SourceLineResolverInterface {
- public:
-  // Read the symbol_data from a file with given file_name.
-  // The part of code was originally in BasicSourceLineResolver::Module's
-  // LoadMap() method.
-  // Place dynamically allocated heap buffer in symbol_data. Caller has the
-  // ownership of the buffer, and should call delete [] to free the buffer.
-  static bool ReadSymbolFile(char **symbol_data, const string &file_name);
-
- protected:
-  // Users are not allowed create SourceLineResolverBase instance directly.
-  SourceLineResolverBase(ModuleFactory *module_factory);
-  virtual ~SourceLineResolverBase();
-
-  // Virtual methods inherited from SourceLineResolverInterface.
-  virtual bool LoadModule(const CodeModule *module, const string &map_file);
-  virtual bool LoadModuleUsingMapBuffer(const CodeModule *module,
-                                        const string &map_buffer);
-  virtual bool LoadModuleUsingMemoryBuffer(const CodeModule *module,
-                                           char *memory_buffer);
-  virtual bool ShouldDeleteMemoryBufferAfterLoadModule();
-  virtual void UnloadModule(const CodeModule *module);
-  virtual bool HasModule(const CodeModule *module);
-  virtual void FillSourceLineInfo(StackFrame *frame);
-  virtual WindowsFrameInfo *FindWindowsFrameInfo(const StackFrame *frame);
-  virtual CFIFrameInfo *FindCFIFrameInfo(const StackFrame *frame);
-
-  // Nested structs and classes.
-  struct Line;
-  struct Function;
-  struct PublicSymbol;
-  struct CompareString {
-    bool operator()(const string &s1, const string &s2) const;
-  };
-  // Module is an interface for an in-memory symbol file.
-  class Module;
-  class AutoFileCloser;
-
-  // All of the modules that are loaded.
-  typedef map<string, Module*, CompareString> ModuleMap;
-  ModuleMap *modules_;
-
-  // All of heap-allocated buffers that are owned locally by resolver.
-  typedef std::map<string, char*, CompareString> MemoryMap;
-  MemoryMap *memory_buffers_;
-
-  // Creates a concrete module at run-time.
-  ModuleFactory *module_factory_;
-
- private:
-  // ModuleFactory needs to have access to protected type Module.
-  friend class ModuleFactory;
-
-  // Disallow unwanted copy ctor and assignment operator
-  SourceLineResolverBase(const SourceLineResolverBase&);
-  void operator=(const SourceLineResolverBase&);
-};
-
-}  // namespace google_breakpad
-
-#endif  // GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_BASE_H__
diff --git a/third_party/breakpad/src/google_breakpad/processor/source_line_resolver_interface.h b/third_party/breakpad/src/google_breakpad/processor/source_line_resolver_interface.h
deleted file mode 100644
index 103f979..0000000
--- a/third_party/breakpad/src/google_breakpad/processor/source_line_resolver_interface.h
+++ /dev/null
@@ -1,111 +0,0 @@
-// -*- mode: C++ -*-
-
-// Copyright (c) 2010 Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Abstract interface to return function/file/line info for a memory address.
-
-#ifndef GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__
-#define GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__
-
-#include <string>
-#include "google_breakpad/common/breakpad_types.h"
-#include "google_breakpad/processor/code_module.h"
-
-namespace google_breakpad {
-
-using std::string;
-
-struct StackFrame;
-struct WindowsFrameInfo;
-struct CFIFrameInfo;
-
-class SourceLineResolverInterface {
- public:
-  typedef u_int64_t MemAddr;
-
-  virtual ~SourceLineResolverInterface() {}
-
-  // Adds a module to this resolver, returning true on success.
-  //
-  // module should have at least the code_file, debug_file,
-  // and debug_identifier members populated.
-  //
-  // map_file should contain line/address mappings for this module.
-  virtual bool LoadModule(const CodeModule *module,
-                          const string &map_file) = 0;
-  // Same as above, but takes the contents of a pre-read map buffer
-  virtual bool LoadModuleUsingMapBuffer(const CodeModule *module,
-                                        const string &map_buffer) = 0;
-
-  // Add an interface to load symbol using C-String data insteading string.
-  // This is useful in the optimization design for avoiding unnecessary copying
-  // of symbol data, in order to improve memory efficiency.
-  // LoadModuleUsingMemoryBuffer() does NOT take ownership of memory_buffer.
-  virtual bool LoadModuleUsingMemoryBuffer(const CodeModule *module,
-                                           char *memory_buffer) = 0;
-
-  // Return true if the memory buffer should be deleted immediately after
-  // LoadModuleUsingMemoryBuffer(). Return false if the memory buffer has to be
-  // alive during the lifetime of the corresponding Module.
-  virtual bool ShouldDeleteMemoryBufferAfterLoadModule() = 0;
-
-  // Request that the specified module be unloaded from this resolver.
-  // A resolver may choose to ignore such a request.
-  virtual void UnloadModule(const CodeModule *module) = 0;
-
-  // Returns true if the module has been loaded.
-  virtual bool HasModule(const CodeModule *module) = 0;
-
-  // Fills in the function_base, function_name, source_file_name,
-  // and source_line fields of the StackFrame.  The instruction and
-  // module_name fields must already be filled in.
-  virtual void FillSourceLineInfo(StackFrame *frame) = 0;
-
-  // If Windows stack walking information is available covering
-  // FRAME's instruction address, return a WindowsFrameInfo structure
-  // describing it. If the information is not available, returns NULL.
-  // A NULL return value does not indicate an error. The caller takes
-  // ownership of any returned WindowsFrameInfo object.
-  virtual WindowsFrameInfo *FindWindowsFrameInfo(const StackFrame *frame) = 0;
-
-  // If CFI stack walking information is available covering ADDRESS,
-  // return a CFIFrameInfo structure describing it. If the information
-  // is not available, return NULL. The caller takes ownership of any
-  // returned CFIFrameInfo object.
-  virtual CFIFrameInfo *FindCFIFrameInfo(const StackFrame *frame) = 0;
-
- protected:
-  // SourceLineResolverInterface cannot be instantiated except by subclasses
-  SourceLineResolverInterface() {}
-};
-
-}  // namespace google_breakpad
-
-#endif  // GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__
diff --git a/third_party/breakpad/src/google_breakpad/processor/stack_frame.h b/third_party/breakpad/src/google_breakpad/processor/stack_frame.h
deleted file mode 100644
index c444993..0000000
--- a/third_party/breakpad/src/google_breakpad/processor/stack_frame.h
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright (c) 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_H__
-#define GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_H__
-
-#include <string>
-#include "google_breakpad/common/breakpad_types.h"
-
-namespace google_breakpad {
-
-class CodeModule;
-
-using std::string;
-
-struct StackFrame {
-  // Indicates how well the instruction pointer derived during
-  // stack walking is trusted. Since the stack walker can resort to
-  // stack scanning, it can wind up with dubious frames.
-  // In rough order of "trust metric".
-  enum FrameTrust {
-    FRAME_TRUST_NONE,     // Unknown
-    FRAME_TRUST_SCAN,     // Scanned the stack, found this
-    FRAME_TRUST_CFI_SCAN, // Scanned the stack using call frame info, found this
-    FRAME_TRUST_FP,       // Derived from frame pointer
-    FRAME_TRUST_CFI,      // Derived from call frame info
-    FRAME_TRUST_CONTEXT   // Given as instruction pointer in a context
-  };
-
-  StackFrame()
-      : instruction(),
-        module(NULL),
-        function_name(),
-        function_base(),
-        source_file_name(),
-        source_line(),
-        source_line_base(),
-        trust(FRAME_TRUST_NONE) {}
-  virtual ~StackFrame() {}
-
-  // Return a string describing how this stack frame was found
-  // by the stackwalker.
-  string trust_description() const {
-    switch (trust) {
-      case StackFrame::FRAME_TRUST_CONTEXT:
-        return "given as instruction pointer in context";
-      case StackFrame::FRAME_TRUST_CFI:
-        return "call frame info";
-      case StackFrame::FRAME_TRUST_CFI_SCAN:
-        return "call frame info with scanning";
-      case StackFrame::FRAME_TRUST_FP:
-        return "previous frame's frame pointer";
-      case StackFrame::FRAME_TRUST_SCAN:
-        return "stack scanning";
-      default:
-        return "unknown";
-    }
-  };
-
-  // The program counter location as an absolute virtual address.  For the
-  // innermost called frame in a stack, this will be an exact program counter
-  // or instruction pointer value.  For all other frames, this will be within
-  // the instruction that caused execution to branch to a called function,
-  // but may not necessarily point to the exact beginning of that instruction.
-  u_int64_t instruction;
-
-  // The module in which the instruction resides.
-  const CodeModule *module;
-
-  // The function name, may be omitted if debug symbols are not available.
-  string function_name;
-
-  // The start address of the function, may be omitted if debug symbols
-  // are not available.
-  u_int64_t function_base;
-
-  // The source file name, may be omitted if debug symbols are not available.
-  string source_file_name;
-
-  // The (1-based) source line number, may be omitted if debug symbols are
-  // not available.
-  int source_line;
-
-  // The start address of the source line, may be omitted if debug symbols
-  // are not available.
-  u_int64_t source_line_base;
-
-  // Amount of trust the stack walker has in the instruction pointer
-  // of this frame.
-  FrameTrust trust;
-};
-
-}  // namespace google_breakpad
-
-#endif  // GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_H__
diff --git a/third_party/breakpad/src/google_breakpad/processor/stack_frame_cpu.h b/third_party/breakpad/src/google_breakpad/processor/stack_frame_cpu.h
deleted file mode 100644
index 805b6bc..0000000
--- a/third_party/breakpad/src/google_breakpad/processor/stack_frame_cpu.h
+++ /dev/null
@@ -1,243 +0,0 @@
-// -*- mode: c++ -*-
-
-// Copyright (c) 2010 Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// stack_frame_cpu.h: CPU-specific StackFrame extensions.
-//
-// These types extend the StackFrame structure to carry CPU-specific register
-// state.  They are defined in this header instead of stack_frame.h to
-// avoid the need to include minidump_format.h when only the generic
-// StackFrame type is needed.
-//
-// Author: Mark Mentovai
-
-#ifndef GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_CPU_H__
-#define GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_CPU_H__
-
-#include "google_breakpad/common/minidump_format.h"
-#include "google_breakpad/processor/stack_frame.h"
-
-namespace google_breakpad {
-
-struct WindowsFrameInfo;
-struct CFIFrameInfo;
-
-struct StackFrameX86 : public StackFrame {
-  // ContextValidity has one entry for each relevant hardware pointer
-  // register (%eip and %esp) and one entry for each general-purpose
-  // register. It's worthwhile having validity flags for caller-saves
-  // registers: they are valid in the youngest frame, and such a frame
-  // might save a callee-saves register in a caller-saves register, but
-  // SimpleCFIWalker won't touch registers unless they're marked as valid.
-  enum ContextValidity {
-    CONTEXT_VALID_NONE = 0,
-    CONTEXT_VALID_EIP  = 1 << 0,
-    CONTEXT_VALID_ESP  = 1 << 1,
-    CONTEXT_VALID_EBP  = 1 << 2,
-    CONTEXT_VALID_EAX  = 1 << 3,
-    CONTEXT_VALID_EBX  = 1 << 4,
-    CONTEXT_VALID_ECX  = 1 << 5,
-    CONTEXT_VALID_EDX  = 1 << 6,
-    CONTEXT_VALID_ESI  = 1 << 7,
-    CONTEXT_VALID_EDI  = 1 << 8,
-    CONTEXT_VALID_ALL  = -1
-  };
-
- StackFrameX86()
-     : context(),
-       context_validity(CONTEXT_VALID_NONE),
-       windows_frame_info(NULL),
-       cfi_frame_info(NULL) {}
-  ~StackFrameX86();
-
-  // Register state.  This is only fully valid for the topmost frame in a
-  // stack.  In other frames, the values of nonvolatile registers may be
-  // present, given sufficient debugging information.  Refer to
-  // context_validity.
-  MDRawContextX86 context;
-
-  // context_validity is actually ContextValidity, but int is used because
-  // the OR operator doesn't work well with enumerated types.  This indicates
-  // which fields in context are valid.
-  int context_validity;
-
-  // Any stack walking information we found describing this.instruction.
-  // These may be NULL if there is no such information for that address.
-  WindowsFrameInfo *windows_frame_info;
-  CFIFrameInfo *cfi_frame_info;
-};
-
-struct StackFramePPC : public StackFrame {
-  // ContextValidity should eventually contain entries for the validity of
-  // other nonvolatile (callee-save) registers as in
-  // StackFrameX86::ContextValidity, but the ppc stackwalker doesn't currently
-  // locate registers other than the ones listed here.
-  enum ContextValidity {
-    CONTEXT_VALID_NONE = 0,
-    CONTEXT_VALID_SRR0 = 1 << 0,
-    CONTEXT_VALID_GPR1 = 1 << 1,
-    CONTEXT_VALID_ALL  = -1
-  };
-
-  StackFramePPC() : context(), context_validity(CONTEXT_VALID_NONE) {}
-
-  // Register state.  This is only fully valid for the topmost frame in a
-  // stack.  In other frames, the values of nonvolatile registers may be
-  // present, given sufficient debugging information.  Refer to
-  // context_validity.
-  MDRawContextPPC context;
-
-  // context_validity is actually ContextValidity, but int is used because
-  // the OR operator doesn't work well with enumerated types.  This indicates
-  // which fields in context are valid.
-  int context_validity;
-};
-
-struct StackFrameAMD64 : public StackFrame {
-  // ContextValidity has one entry for each register that we might be able
-  // to recover.
-  enum ContextValidity {
-    CONTEXT_VALID_NONE  = 0,
-    CONTEXT_VALID_RAX   = 1 << 0,
-    CONTEXT_VALID_RDX   = 1 << 1,
-    CONTEXT_VALID_RCX   = 1 << 2,
-    CONTEXT_VALID_RBX   = 1 << 3,
-    CONTEXT_VALID_RSI   = 1 << 4,
-    CONTEXT_VALID_RDI   = 1 << 5,
-    CONTEXT_VALID_RBP   = 1 << 6,
-    CONTEXT_VALID_RSP   = 1 << 7,
-    CONTEXT_VALID_R8    = 1 << 8,
-    CONTEXT_VALID_R9    = 1 << 9,
-    CONTEXT_VALID_R10   = 1 << 10,
-    CONTEXT_VALID_R11   = 1 << 11,
-    CONTEXT_VALID_R12   = 1 << 12,
-    CONTEXT_VALID_R13   = 1 << 13,
-    CONTEXT_VALID_R14   = 1 << 14,
-    CONTEXT_VALID_R15   = 1 << 15,
-    CONTEXT_VALID_RIP   = 1 << 16,
-    CONTEXT_VALID_ALL  = -1
-  };
-
-  StackFrameAMD64() : context(), context_validity(CONTEXT_VALID_NONE) {}
-
-  // Register state. This is only fully valid for the topmost frame in a
-  // stack. In other frames, which registers are present depends on what
-  // debugging information we had available. Refer to context_validity.
-  MDRawContextAMD64 context;
-
-  // For each register in context whose value has been recovered, we set
-  // the corresponding CONTEXT_VALID_ bit in context_validity.
-  //
-  // context_validity's type should actually be ContextValidity, but
-  // we use int instead because the bitwise inclusive or operator
-  // yields an int when applied to enum values, and C++ doesn't
-  // silently convert from ints to enums.
-  int context_validity;
-};
-
-struct StackFrameSPARC : public StackFrame {
-  // to be confirmed
-  enum ContextValidity {
-    CONTEXT_VALID_NONE = 0,
-    CONTEXT_VALID_PC   = 1 << 0,
-    CONTEXT_VALID_SP   = 1 << 1,
-    CONTEXT_VALID_FP   = 1 << 2,
-    CONTEXT_VALID_ALL  = -1
-  };
-
-  StackFrameSPARC() : context(), context_validity(CONTEXT_VALID_NONE) {}
-
-  // Register state.  This is only fully valid for the topmost frame in a
-  // stack.  In other frames, the values of nonvolatile registers may be
-  // present, given sufficient debugging information.  Refer to
-  // context_validity.
-  MDRawContextSPARC context;
-
-  // context_validity is actually ContextValidity, but int is used because
-  // the OR operator doesn't work well with enumerated types.  This indicates
-  // which fields in context are valid.
-  int context_validity;
-};
-
-struct StackFrameARM : public StackFrame {
-  // A flag for each register we might know.
-  enum ContextValidity {
-    CONTEXT_VALID_NONE = 0,
-    CONTEXT_VALID_R0   = 1 << 0,
-    CONTEXT_VALID_R1   = 1 << 1,
-    CONTEXT_VALID_R2   = 1 << 2,
-    CONTEXT_VALID_R3   = 1 << 3,
-    CONTEXT_VALID_R4   = 1 << 4,
-    CONTEXT_VALID_R5   = 1 << 5,
-    CONTEXT_VALID_R6   = 1 << 6,
-    CONTEXT_VALID_R7   = 1 << 7,
-    CONTEXT_VALID_R8   = 1 << 8,
-    CONTEXT_VALID_R9   = 1 << 9,
-    CONTEXT_VALID_R10  = 1 << 10,
-    CONTEXT_VALID_R11  = 1 << 11,
-    CONTEXT_VALID_R12  = 1 << 12,
-    CONTEXT_VALID_R13  = 1 << 13,
-    CONTEXT_VALID_R14  = 1 << 14,
-    CONTEXT_VALID_R15  = 1 << 15,
-    CONTEXT_VALID_ALL  = ~CONTEXT_VALID_NONE,
-
-    // Aliases for registers with dedicated or conventional roles.
-    CONTEXT_VALID_FP   = CONTEXT_VALID_R11,
-    CONTEXT_VALID_SP   = CONTEXT_VALID_R13,
-    CONTEXT_VALID_LR   = CONTEXT_VALID_R14,
-    CONTEXT_VALID_PC   = CONTEXT_VALID_R15
-  };
-
-  StackFrameARM() : context(), context_validity(CONTEXT_VALID_NONE) {}
-
-  // Return the ContextValidity flag for register rN.
-  static ContextValidity RegisterValidFlag(int n) {
-    return ContextValidity(1 << n);
-  } 
-
-  // Register state.  This is only fully valid for the topmost frame in a
-  // stack.  In other frames, the values of nonvolatile registers may be
-  // present, given sufficient debugging information.  Refer to
-  // context_validity.
-  MDRawContextARM context;
-
-  // For each register in context whose value has been recovered, we set
-  // the corresponding CONTEXT_VALID_ bit in context_validity.
-  //
-  // context_validity's type should actually be ContextValidity, but
-  // we use int instead because the bitwise inclusive or operator
-  // yields an int when applied to enum values, and C++ doesn't
-  // silently convert from ints to enums.
-  int context_validity;
-};
-
-}  // namespace google_breakpad
-
-#endif  // GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_CPU_H__
diff --git a/third_party/breakpad/src/google_breakpad/processor/stackwalker.h b/third_party/breakpad/src/google_breakpad/processor/stackwalker.h
deleted file mode 100644
index 6822f16..0000000
--- a/third_party/breakpad/src/google_breakpad/processor/stackwalker.h
+++ /dev/null
@@ -1,194 +0,0 @@
-// Copyright (c) 2010 Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// stackwalker.h: Generic stackwalker.
-//
-// The Stackwalker class is an abstract base class providing common generic
-// methods that apply to stacks from all systems.  Specific implementations
-// will extend this class by providing GetContextFrame and GetCallerFrame
-// methods to fill in system-specific data in a StackFrame structure.
-// Stackwalker assembles these StackFrame strucutres into a CallStack.
-//
-// Author: Mark Mentovai
-
-
-#ifndef GOOGLE_BREAKPAD_PROCESSOR_STACKWALKER_H__
-#define GOOGLE_BREAKPAD_PROCESSOR_STACKWALKER_H__
-
-#include <set>
-#include <string>
-#include "google_breakpad/common/breakpad_types.h"
-#include "google_breakpad/processor/code_modules.h"
-#include "google_breakpad/processor/memory_region.h"
-
-namespace google_breakpad {
-
-class CallStack;
-class MinidumpContext;
-class SourceLineResolverInterface;
-struct StackFrame;
-class SymbolSupplier;
-class SystemInfo;
-
-using std::set;
-
-
-class Stackwalker {
- public:
-  virtual ~Stackwalker() {}
-
-  // Populates the given CallStack by calling GetContextFrame and
-  // GetCallerFrame.  The frames are further processed to fill all available
-  // data.  Returns true if the stackwalk completed, or false if it was
-  // interrupted by SymbolSupplier::GetSymbolFile().
-  bool Walk(CallStack *stack);
-
-  // Returns a new concrete subclass suitable for the CPU that a stack was
-  // generated on, according to the CPU type indicated by the context
-  // argument.  If no suitable concrete subclass exists, returns NULL.
-  static Stackwalker* StackwalkerForCPU(const SystemInfo *system_info,
-                                        MinidumpContext *context,
-                                        MemoryRegion *memory,
-                                        const CodeModules *modules,
-                                        SymbolSupplier *supplier,
-                                        SourceLineResolverInterface *resolver);
-
-  static void set_max_frames(u_int32_t max_frames) { max_frames_ = max_frames; }
-  static u_int32_t max_frames() { return max_frames_; }
-
- protected:
-  // system_info identifies the operating system, NULL or empty if unknown.
-  // memory identifies a MemoryRegion that provides the stack memory
-  // for the stack to walk.  modules, if non-NULL, is a CodeModules
-  // object that is used to look up which code module each stack frame is
-  // associated with.  supplier is an optional caller-supplied SymbolSupplier
-  // implementation.  If supplier is NULL, source line info will not be
-  // resolved.  resolver is an instance of SourceLineResolverInterface
-  // (see source_line_resolver_interface.h and basic_source_line_resolver.h).
-  // If resolver is NULL, source line info will not be resolved.
-  Stackwalker(const SystemInfo *system_info,
-              MemoryRegion *memory,
-              const CodeModules *modules,
-              SymbolSupplier *supplier,
-              SourceLineResolverInterface *resolver);
-
-  // This can be used to filter out potential return addresses when
-  // the stack walker resorts to stack scanning.
-  // Returns true if any of:
-  // * This address is within a loaded module, but we don't have symbols
-  //   for that module.
-  // * This address is within a loaded module for which we have symbols,
-  //   and falls inside a function in that module.
-  // Returns false otherwise.
-  bool InstructionAddressSeemsValid(u_int64_t address);
-
-  // Scan the stack starting at location_start, looking for an address
-  // that looks like a valid instruction pointer. Addresses must
-  // 1) be contained in the current stack memory
-  // 2) pass the checks in InstructionAddressSeemsValid
-  //
-  // Returns true if a valid-looking instruction pointer was found.
-  // When returning true, sets location_found to the address at which
-  // the value was found, and ip_found to the value contained at that
-  // location in memory.
-  template<typename InstructionType>
-  bool ScanForReturnAddress(InstructionType location_start,
-                            InstructionType *location_found,
-                            InstructionType *ip_found) {
-    const int kRASearchWords = 30;
-    for (InstructionType location = location_start;
-         location <= location_start + kRASearchWords * sizeof(InstructionType);
-         location += sizeof(InstructionType)) {
-      InstructionType ip;
-      if (!memory_->GetMemoryAtAddress(location, &ip))
-        break;
-
-      if (modules_ && modules_->GetModuleForAddress(ip) &&
-          InstructionAddressSeemsValid(ip)) {
-
-        *ip_found = ip;
-        *location_found = location;
-        return true;
-      }
-    }
-    // nothing found
-    return false;
-  }
-
-  // Information about the system that produced the minidump.  Subclasses
-  // and the SymbolSupplier may find this information useful.
-  const SystemInfo *system_info_;
-
-  // The stack memory to walk.  Subclasses will require this region to
-  // get information from the stack.
-  MemoryRegion *memory_;
-
-  // A list of modules, for populating each StackFrame's module information.
-  // This field is optional and may be NULL.
-  const CodeModules *modules_;
-
- protected:
-  // The SourceLineResolver implementation.
-  SourceLineResolverInterface *resolver_;
-
- private:
-  // Obtains the context frame, the innermost called procedure in a stack
-  // trace.  Returns NULL on failure.  GetContextFrame allocates a new
-  // StackFrame (or StackFrame subclass), ownership of which is taken by
-  // the caller.
-  virtual StackFrame* GetContextFrame() = 0;
-
-  // Obtains a caller frame.  Each call to GetCallerFrame should return the
-  // frame that called the last frame returned by GetContextFrame or
-  // GetCallerFrame.  To aid this purpose, stack contains the CallStack
-  // made of frames that have already been walked.  GetCallerFrame should
-  // return NULL on failure or when there are no more caller frames (when
-  // the end of the stack has been reached).  GetCallerFrame allocates a new
-  // StackFrame (or StackFrame subclass), ownership of which is taken by
-  // the caller.
-  virtual StackFrame* GetCallerFrame(const CallStack *stack) = 0;
-
-  // The optional SymbolSupplier for resolving source line info.
-  SymbolSupplier *supplier_;
-
-  // A list of modules that we haven't found symbols for.  We track
-  // this in order to avoid repeatedly looking them up again within
-  // one minidump.
-  set<std::string> no_symbol_modules_;
-
-  // The maximum number of frames Stackwalker will walk through.
-  // This defaults to 1024 to prevent infinite loops.
-  static u_int32_t max_frames_;
-};
-
-
-}  // namespace google_breakpad
-
-
-#endif  // GOOGLE_BREAKPAD_PROCESSOR_STACKWALKER_H__
diff --git a/third_party/breakpad/src/google_breakpad/processor/symbol_supplier.h b/third_party/breakpad/src/google_breakpad/processor/symbol_supplier.h
deleted file mode 100644
index 26f5d7f..0000000
--- a/third_party/breakpad/src/google_breakpad/processor/symbol_supplier.h
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright (c) 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The caller may implement the SymbolSupplier abstract base class
-// to provide symbols for a given module.
-
-#ifndef GOOGLE_BREAKPAD_PROCESSOR_SYMBOL_SUPPLIER_H__
-#define GOOGLE_BREAKPAD_PROCESSOR_SYMBOL_SUPPLIER_H__
-
-#include <string>
-
-namespace google_breakpad {
-
-using std::string;
-class CodeModule;
-class SystemInfo;
-
-class SymbolSupplier {
- public:
-  // Result type for GetSymbolFile
-  enum SymbolResult {
-    // no symbols were found, but continue processing
-    NOT_FOUND,
-
-    // symbols were found, and the path has been placed in symbol_file
-    FOUND,
-
-    // stops processing the minidump immediately
-    INTERRUPT
-  };
-
-  virtual ~SymbolSupplier() {}
-
-  // Retrieves the symbol file for the given CodeModule, placing the
-  // path in symbol_file if successful.  system_info contains strings
-  // identifying the operating system and CPU; SymbolSupplier may use
-  // to help locate the symbol file.  system_info may be NULL or its
-  // fields may be empty if these values are unknown.  symbol_file
-  // must be a pointer to a valid string
-  virtual SymbolResult GetSymbolFile(const CodeModule *module,
-                                     const SystemInfo *system_info,
-                                     string *symbol_file) = 0;
-  // Same as above, except also places symbol data into symbol_data.
-  // If symbol_data is NULL, the data is not returned.
-  // TODO(nealsid) Once we have symbol data caching behavior implemented
-  // investigate making all symbol suppliers implement all methods,
-  // and make this pure virtual
-  virtual SymbolResult GetSymbolFile(const CodeModule *module,
-                                     const SystemInfo *system_info,
-                                     string *symbol_file,
-                                     string *symbol_data) = 0;
-
-  // Same as above, except allocates data buffer on heap and then places the
-  // symbol data into the buffer as C-string.
-  // SymbolSupplier is responsible for deleting the data buffer. After the call
-  // to GetCStringSymbolData(), the caller should call FreeSymbolData(const
-  // Module *module) once the data buffer is no longer needed.
-  // If symbol_data is not NULL, symbol supplier won't return FOUND unless it
-  // returns a valid buffer in symbol_data, e.g., returns INTERRUPT on memory
-  // allocation failure.
-  virtual SymbolResult GetCStringSymbolData(const CodeModule *module,
-                                            const SystemInfo *system_info,
-                                            string *symbol_file,
-                                            char **symbol_data) = 0;
-
-  // Frees the data buffer allocated for the module in GetCStringSymbolData.
-  virtual void FreeSymbolData(const CodeModule *module) = 0;
-};
-
-}  // namespace google_breakpad
-
-#endif  // GOOGLE_BREAKPAD_PROCESSOR_SYMBOL_SUPPLIER_H__
diff --git a/third_party/breakpad/src/google_breakpad/processor/system_info.h b/third_party/breakpad/src/google_breakpad/processor/system_info.h
deleted file mode 100644
index fdbdbfd..0000000
--- a/third_party/breakpad/src/google_breakpad/processor/system_info.h
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (c) 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// system_info.h: Information about the system that was running a program
-// when a crash report was produced.
-//
-// Author: Mark Mentovai
-
-#ifndef GOOGLE_BREAKPAD_PROCESSOR_SYSTEM_INFO_H__
-#define GOOGLE_BREAKPAD_PROCESSOR_SYSTEM_INFO_H__
-
-#include <string>
-
-namespace google_breakpad {
-
-using std::string;
-
-struct SystemInfo {
- public:
-  SystemInfo() : os(), os_short(), os_version(), cpu(), cpu_info(),
-    cpu_count(0) {}
-
-  // Resets the SystemInfo object to its default values.
-  void Clear() {
-    os.clear();
-    os_short.clear();
-    os_version.clear();
-    cpu.clear();
-    cpu_info.clear();
-    cpu_count = 0;
-  }
-
-  // A string identifying the operating system, such as "Windows NT",
-  // "Mac OS X", or "Linux".  If the information is present in the dump but
-  // its value is unknown, this field will contain a numeric value.  If
-  // the information is not present in the dump, this field will be empty.
-  string os;
-
-  // A short form of the os string, using lowercase letters and no spaces,
-  // suitable for use in a filesystem.  Possible values are "windows",
-  // "mac", and "linux".  Empty if the information is not present in the dump
-  // or if the OS given by the dump is unknown.  The values stored in this
-  // field should match those used by MinidumpSystemInfo::GetOS.
-  string os_short;
-
-  // A string identifying the version of the operating system, such as
-  // "5.1.2600 Service Pack 2" or "10.4.8 8L2127".  If the dump does not
-  // contain this information, this field will be empty.
-  string os_version;
-
-  // A string identifying the basic CPU family, such as "x86" or "ppc".
-  // If this information is present in the dump but its value is unknown,
-  // this field will contain a numeric value.  If the information is not
-  // present in the dump, this field will be empty.  The values stored in
-  // this field should match those used by MinidumpSystemInfo::GetCPU.
-  string cpu;
-
-  // A string further identifying the specific CPU, such as
-  // "GenuineIntel level 6 model 13 stepping 8".  If the information is not
-  // present in the dump, or additional identifying information is not
-  // defined for the CPU family, this field will be empty.
-  string cpu_info;
-
-  // The number of processors in the system.  Will be greater than one for
-  // multi-core systems.
-  int cpu_count;
-};
-
-}  // namespace google_breakpad
-
-#endif  // GOOGLE_BREAKPAD_PROCESSOR_SYSTEM_INFO_H__
diff --git a/third_party/breakpad/src/processor/scoped_ptr.h b/third_party/breakpad/src/processor/scoped_ptr.h
deleted file mode 100644
index 0d4f7fd..0000000
--- a/third_party/breakpad/src/processor/scoped_ptr.h
+++ /dev/null
@@ -1,335 +0,0 @@
-//  (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
-//  Copyright (c) 2001, 2002 Peter Dimov
-//
-//  Permission to copy, use, modify, sell and distribute this software
-//  is granted provided this copyright notice appears in all copies.
-//  This software is provided "as is" without express or implied
-//  warranty, and with no claim as to its suitability for any purpose.
-//
-//  See http://www.boost.org/libs/smart_ptr/scoped_ptr.htm for documentation.
-//
-
-//  scoped_ptr mimics a built-in pointer except that it guarantees deletion
-//  of the object pointed to, either on destruction of the scoped_ptr or via
-//  an explicit reset(). scoped_ptr is a simple solution for simple needs;
-//  use shared_ptr or std::auto_ptr if your needs are more complex.
-
-//  *** NOTE ***
-//  If your scoped_ptr is a class member of class FOO pointing to a 
-//  forward declared type BAR (as shown below), then you MUST use a non-inlined 
-//  version of the destructor.  The destructor of a scoped_ptr (called from
-//  FOO's destructor) must have a complete definition of BAR in order to 
-//  destroy it.  Example:
-//
-//  -- foo.h --
-//  class BAR;
-//
-//  class FOO {
-//   public:
-//    FOO();
-//    ~FOO();  // Required for sources that instantiate class FOO to compile!
-//    
-//   private:
-//    scoped_ptr<BAR> bar_;
-//  };
-//
-//  -- foo.cc --
-//  #include "foo.h"
-//  FOO::~FOO() {} // Empty, but must be non-inlined to FOO's class definition.
-
-//  scoped_ptr_malloc added by Google
-//  When one of these goes out of scope, instead of doing a delete or
-//  delete[], it calls free().  scoped_ptr_malloc<char> is likely to see
-//  much more use than any other specializations.
-
-//  release() added by Google
-//  Use this to conditionally transfer ownership of a heap-allocated object
-//  to the caller, usually on method success.
-
-#ifndef PROCESSOR_SCOPED_PTR_H__
-#define PROCESSOR_SCOPED_PTR_H__
-
-#include <cstddef>            // for std::ptrdiff_t
-#include <assert.h>           // for assert
-#include <stdlib.h>           // for free() decl
-
-namespace google_breakpad {
-
-template <typename T>
-class scoped_ptr {
- private:
-
-  T* ptr;
-
-  scoped_ptr(scoped_ptr const &);
-  scoped_ptr & operator=(scoped_ptr const &);
-
- public:
-
-  typedef T element_type;
-
-  explicit scoped_ptr(T* p = 0): ptr(p) {}
-
-  ~scoped_ptr() {
-    typedef char type_must_be_complete[sizeof(T)];
-    delete ptr;
-  }
-
-  void reset(T* p = 0) {
-    typedef char type_must_be_complete[sizeof(T)];
-
-    if (ptr != p) {
-      delete ptr;
-      ptr = p;
-    }
-  }
-
-  T& operator*() const {
-    assert(ptr != 0);
-    return *ptr;
-  }
-
-  T* operator->() const  {
-    assert(ptr != 0);
-    return ptr;
-  }
-
-  bool operator==(T* p) const {
-    return ptr == p;
-  }
-
-  bool operator!=(T* p) const {
-    return ptr != p;
-  }
-
-  T* get() const  {
-    return ptr;
-  }
-
-  void swap(scoped_ptr & b) {
-    T* tmp = b.ptr;
-    b.ptr = ptr;
-    ptr = tmp;
-  }
-
-  T* release() {
-    T* tmp = ptr;
-    ptr = 0;
-    return tmp;
-  }
-
- private:
-
-  // no reason to use these: each scoped_ptr should have its own object
-  template <typename U> bool operator==(scoped_ptr<U> const& p) const;
-  template <typename U> bool operator!=(scoped_ptr<U> const& p) const;
-};
-
-template<typename T> inline
-void swap(scoped_ptr<T>& a, scoped_ptr<T>& b) {
-  a.swap(b);
-}
-
-template<typename T> inline
-bool operator==(T* p, const scoped_ptr<T>& b) {
-  return p == b.get();
-}
-
-template<typename T> inline
-bool operator!=(T* p, const scoped_ptr<T>& b) {
-  return p != b.get();
-}
-
-//  scoped_array extends scoped_ptr to arrays. Deletion of the array pointed to
-//  is guaranteed, either on destruction of the scoped_array or via an explicit
-//  reset(). Use shared_array or std::vector if your needs are more complex.
-
-template<typename T>
-class scoped_array {
- private:
-
-  T* ptr;
-
-  scoped_array(scoped_array const &);
-  scoped_array & operator=(scoped_array const &);
-
- public:
-
-  typedef T element_type;
-
-  explicit scoped_array(T* p = 0) : ptr(p) {}
-
-  ~scoped_array() {
-    typedef char type_must_be_complete[sizeof(T)];
-    delete[] ptr;
-  }
-
-  void reset(T* p = 0) {
-    typedef char type_must_be_complete[sizeof(T)];
-
-    if (ptr != p) {
-      delete [] ptr;
-      ptr = p;
-    }
-  }
-
-  T& operator[](std::ptrdiff_t i) const {
-    assert(ptr != 0);
-    assert(i >= 0);
-    return ptr[i];
-  }
-
-  bool operator==(T* p) const {
-    return ptr == p;
-  }
-
-  bool operator!=(T* p) const {
-    return ptr != p;
-  }
-
-  T* get() const {
-    return ptr;
-  }
-
-  void swap(scoped_array & b) {
-    T* tmp = b.ptr;
-    b.ptr = ptr;
-    ptr = tmp;
-  }
-
-  T* release() {
-    T* tmp = ptr;
-    ptr = 0;
-    return tmp;
-  }
-
- private:
-
-  // no reason to use these: each scoped_array should have its own object
-  template <typename U> bool operator==(scoped_array<U> const& p) const;
-  template <typename U> bool operator!=(scoped_array<U> const& p) const;
-};
-
-template<class T> inline
-void swap(scoped_array<T>& a, scoped_array<T>& b) {
-  a.swap(b);
-}
-
-template<typename T> inline
-bool operator==(T* p, const scoped_array<T>& b) {
-  return p == b.get();
-}
-
-template<typename T> inline
-bool operator!=(T* p, const scoped_array<T>& b) {
-  return p != b.get();
-}
-
-
-// This class wraps the c library function free() in a class that can be
-// passed as a template argument to scoped_ptr_malloc below.
-class ScopedPtrMallocFree {
- public:
-  inline void operator()(void* x) const {
-    free(x);
-  }
-};
-
-// scoped_ptr_malloc<> is similar to scoped_ptr<>, but it accepts a
-// second template argument, the functor used to free the object.
-
-template<typename T, typename FreeProc = ScopedPtrMallocFree>
-class scoped_ptr_malloc {
- private:
-
-  T* ptr;
-
-  scoped_ptr_malloc(scoped_ptr_malloc const &);
-  scoped_ptr_malloc & operator=(scoped_ptr_malloc const &);
-
- public:
-
-  typedef T element_type;
-
-  explicit scoped_ptr_malloc(T* p = 0): ptr(p) {}
-
-  ~scoped_ptr_malloc() {
-    typedef char type_must_be_complete[sizeof(T)];
-    free_((void*) ptr);
-  }
-
-  void reset(T* p = 0) {
-    typedef char type_must_be_complete[sizeof(T)];
-
-    if (ptr != p) {
-      free_((void*) ptr);
-      ptr = p;
-    }
-  }
-
-  T& operator*() const {
-    assert(ptr != 0);
-    return *ptr;
-  }
-
-  T* operator->() const {
-    assert(ptr != 0);
-    return ptr;
-  }
-
-  bool operator==(T* p) const {
-    return ptr == p;
-  }
-
-  bool operator!=(T* p) const {
-    return ptr != p;
-  }
-
-  T* get() const {
-    return ptr;
-  }
-
-  void swap(scoped_ptr_malloc & b) {
-    T* tmp = b.ptr;
-    b.ptr = ptr;
-    ptr = tmp;
-  }
-
-  T* release() {
-    T* tmp = ptr;
-    ptr = 0;
-    return tmp;
-  }
-
- private:
-
-  // no reason to use these: each scoped_ptr_malloc should have its own object
-  template <typename U, typename GP>
-  bool operator==(scoped_ptr_malloc<U, GP> const& p) const;
-  template <typename U, typename GP>
-  bool operator!=(scoped_ptr_malloc<U, GP> const& p) const;
-
-  static FreeProc const free_;
-};
-
-template<typename T, typename FP>
-FP const scoped_ptr_malloc<T,FP>::free_ = FP();
-
-template<typename T, typename FP> inline
-void swap(scoped_ptr_malloc<T,FP>& a, scoped_ptr_malloc<T,FP>& b) {
-  a.swap(b);
-}
-
-template<typename T, typename FP> inline
-bool operator==(T* p, const scoped_ptr_malloc<T,FP>& b) {
-  return p == b.get();
-}
-
-template<typename T, typename FP> inline
-bool operator!=(T* p, const scoped_ptr_malloc<T,FP>& b) {
-  return p != b.get();
-}
-
-}  // namespace google_breakpad
-
-#endif  // PROCESSOR_SCOPED_PTR_H__
diff --git a/third_party/build.scons b/third_party/build.scons
deleted file mode 100644
index 669628a..0000000
--- a/third_party/build.scons
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-
-Import('env')
-
-subdirs = [
-    'breakpad',
-    'gmock',
-    'gtest',
-    'lzma',
-    'minicrt',
-    ]
-
-for dir in subdirs:
-  env.BuildSConscript(dir)
diff --git a/third_party/c99/include/inttypes.h b/third_party/c99/include/inttypes.h
deleted file mode 100644
index 43f2034..0000000
--- a/third_party/c99/include/inttypes.h
+++ /dev/null
@@ -1,20 +0,0 @@
-//
-// Posix integer types, defined in terms of native Windows types.
-
-#ifndef __INTTYPES_H_
-#define __INTTYPES_H_
-
-typedef __int8 int8_t;
-typedef __int16 int16_t;
-typedef __int32 int32_t;
-typedef __int64 int64_t;
-typedef unsigned __int8 uint8_t;
-typedef unsigned __int16 uint16_t;
-typedef unsigned __int32 uint32_t;
-typedef unsigned __int64 uint64_t;
-typedef uint8_t u_int8_t;
-typedef uint16_t u_int16_t;
-typedef uint32_t u_int32_t;
-typedef uint64_t u_int64_t;
-
-#endif  // __INTTYPES_H_
diff --git a/third_party/chrome/base/basictypes.h b/third_party/chrome/base/basictypes.h
deleted file mode 100644
index 46b8364..0000000
--- a/third_party/chrome/base/basictypes.h
+++ /dev/null
@@ -1,396 +0,0 @@
-// Copyright (c) 2006-2008 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 BASE_BASICTYPES_H_
-#define BASE_BASICTYPES_H_
-
-#include <assert.h>         // for use with down_cast<>
-#include <limits.h>         // So we can set the bounds of our types
-#include <stddef.h>         // For size_t
-#include <string.h>         // for memcpy
-
-#include "base/port.h"    // Types that only need exist on certain systems
-
-#ifndef COMPILER_MSVC
-// stdint.h is part of C99 but MSVC doesn't have it.
-#include <stdint.h>         // For intptr_t.
-#endif
-
-typedef signed char         schar;
-typedef signed char         int8;
-typedef short               int16;
-// TODO(mbelshe) Remove these type guards.  These are
-//               temporary to avoid conflicts with npapi.h.
-#ifndef _INT32
-#define _INT32
-typedef int                 int32;
-#endif
-typedef long long           int64;
-
-// NOTE: unsigned types are DANGEROUS in loops and other arithmetical
-// places.  Use the signed types unless your variable represents a bit
-// pattern (eg a hash value) or you really need the extra bit.  Do NOT
-// use 'unsigned' to express "this value should always be positive";
-// use assertions for this.
-
-typedef unsigned char      uint8;
-typedef unsigned short     uint16;
-// TODO(mbelshe) Remove these type guards.  These are
-//               temporary to avoid conflicts with npapi.h.
-#ifndef _UINT32
-#define _UINT32
-typedef unsigned int       uint32;
-#endif
-typedef unsigned long long uint64;
-
-// A type to represent a Unicode code-point value. As of Unicode 4.0,
-// such values require up to 21 bits.
-// (For type-checking on pointers, make this explicitly signed,
-// and it should always be the signed version of whatever int32 is.)
-typedef signed int         char32;
-
-const uint8  kuint8max  = (( uint8) 0xFF);
-const uint16 kuint16max = ((uint16) 0xFFFF);
-const uint32 kuint32max = ((uint32) 0xFFFFFFFF);
-const uint64 kuint64max = ((uint64) GG_LONGLONG(0xFFFFFFFFFFFFFFFF));
-const  int8  kint8min   = ((  int8) 0x80);
-const  int8  kint8max   = ((  int8) 0x7F);
-const  int16 kint16min  = (( int16) 0x8000);
-const  int16 kint16max  = (( int16) 0x7FFF);
-const  int32 kint32min  = (( int32) 0x80000000);
-const  int32 kint32max  = (( int32) 0x7FFFFFFF);
-const  int64 kint64min  = (( int64) GG_LONGLONG(0x8000000000000000));
-const  int64 kint64max  = (( int64) GG_LONGLONG(0x7FFFFFFFFFFFFFFF));
-
-// id for odp categories
-typedef uint32 CatId;
-const CatId kIllegalCatId = static_cast<CatId>(0);
-
-typedef uint32 TermId;
-const TermId kIllegalTermId = static_cast<TermId>(0);
-
-typedef uint32 HostId;
-const HostId kIllegalHostId = static_cast<HostId>(0);
-
-typedef uint32 DomainId;
-const DomainId kIllegalDomainId = static_cast<DomainId>(0);
-
-// A macro to disallow the copy constructor and operator= functions
-// This should be used in the private: declarations for a class
-#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
-  TypeName(const TypeName&);               \
-  void operator=(const TypeName&)
-
-// An older, deprecated, politically incorrect name for the above.
-#define DISALLOW_EVIL_CONSTRUCTORS(TypeName) DISALLOW_COPY_AND_ASSIGN(TypeName)
-
-// A macro to disallow all the implicit constructors, namely the
-// default constructor, copy constructor and operator= functions.
-//
-// This should be used in the private: declarations for a class
-// that wants to prevent anyone from instantiating it. This is
-// especially useful for classes containing only static methods.
-#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
-  TypeName();                                    \
-  DISALLOW_COPY_AND_ASSIGN(TypeName)
-
-// The arraysize(arr) macro returns the # of elements in an array arr.
-// The expression is a compile-time constant, and therefore can be
-// used in defining new arrays, for example.  If you use arraysize on
-// a pointer by mistake, you will get a compile-time error.
-//
-// One caveat is that arraysize() doesn't accept any array of an
-// anonymous type or a type defined inside a function.  In these rare
-// cases, you have to use the unsafe ARRAYSIZE_UNSAFE() macro below.  This is
-// due to a limitation in C++'s template system.  The limitation might
-// eventually be removed, but it hasn't happened yet.
-
-// This template function declaration is used in defining arraysize.
-// Note that the function doesn't need an implementation, as we only
-// use its type.
-template <typename T, size_t N>
-char (&ArraySizeHelper(T (&array)[N]))[N];
-
-// That gcc wants both of these prototypes seems mysterious. VC, for
-// its part, can't decide which to use (another mystery). Matching of
-// template overloads: the final frontier.
-#ifndef _MSC_VER
-template <typename T, size_t N>
-char (&ArraySizeHelper(const T (&array)[N]))[N];
-#endif
-
-#define arraysize(array) (sizeof(ArraySizeHelper(array)))
-
-// ARRAYSIZE_UNSAFE performs essentially the same calculation as arraysize,
-// but can be used on anonymous types or types defined inside
-// functions.  It's less safe than arraysize as it accepts some
-// (although not all) pointers.  Therefore, you should use arraysize
-// whenever possible.
-//
-// The expression ARRAYSIZE_UNSAFE(a) is a compile-time constant of type
-// size_t.
-//
-// ARRAYSIZE_UNSAFE catches a few type errors.  If you see a compiler error
-//
-//   "warning: division by zero in ..."
-//
-// when using ARRAYSIZE_UNSAFE, you are (wrongfully) giving it a pointer.
-// You should only use ARRAYSIZE_UNSAFE on statically allocated arrays.
-//
-// The following comments are on the implementation details, and can
-// be ignored by the users.
-//
-// ARRAYSIZE_UNSAFE(arr) works by inspecting sizeof(arr) (the # of bytes in
-// the array) and sizeof(*(arr)) (the # of bytes in one array
-// element).  If the former is divisible by the latter, perhaps arr is
-// indeed an array, in which case the division result is the # of
-// elements in the array.  Otherwise, arr cannot possibly be an array,
-// and we generate a compiler error to prevent the code from
-// compiling.
-//
-// Since the size of bool is implementation-defined, we need to cast
-// !(sizeof(a) & sizeof(*(a))) to size_t in order to ensure the final
-// result has type size_t.
-//
-// This macro is not perfect as it wrongfully accepts certain
-// pointers, namely where the pointer size is divisible by the pointee
-// size.  Since all our code has to go through a 32-bit compiler,
-// where a pointer is 4 bytes, this means all pointers to a type whose
-// size is 3 or greater than 4 will be (righteously) rejected.
-
-#define ARRAYSIZE_UNSAFE(a) \
-  ((sizeof(a) / sizeof(*(a))) / \
-   static_cast<size_t>(!(sizeof(a) % sizeof(*(a)))))
-
-
-// Use implicit_cast as a safe version of static_cast or const_cast
-// for upcasting in the type hierarchy (i.e. casting a pointer to Foo
-// to a pointer to SuperclassOfFoo or casting a pointer to Foo to
-// a const pointer to Foo).
-// When you use implicit_cast, the compiler checks that the cast is safe.
-// Such explicit implicit_casts are necessary in surprisingly many
-// situations where C++ demands an exact type match instead of an
-// argument type convertable to a target type.
-//
-// The From type can be inferred, so the preferred syntax for using
-// implicit_cast is the same as for static_cast etc.:
-//
-//   implicit_cast<ToType>(expr)
-//
-// implicit_cast would have been part of the C++ standard library,
-// but the proposal was submitted too late.  It will probably make
-// its way into the language in the future.
-template<typename To, typename From>
-inline To implicit_cast(From const &f) {
-  return f;
-}
-
-
-// When you upcast (that is, cast a pointer from type Foo to type
-// SuperclassOfFoo), it's fine to use implicit_cast<>, since upcasts
-// always succeed.  When you downcast (that is, cast a pointer from
-// type Foo to type SubclassOfFoo), static_cast<> isn't safe, because
-// how do you know the pointer is really of type SubclassOfFoo?  It
-// could be a bare Foo, or of type DifferentSubclassOfFoo.  Thus,
-// when you downcast, you should use this macro.  In debug mode, we
-// use dynamic_cast<> to double-check the downcast is legal (we die
-// if it's not).  In normal mode, we do the efficient static_cast<>
-// instead.  Thus, it's important to test in debug mode to make sure
-// the cast is legal!
-//    This is the only place in the code we should use dynamic_cast<>.
-// In particular, you SHOULDN'T be using dynamic_cast<> in order to
-// do RTTI (eg code like this:
-//    if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo);
-//    if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo);
-// You should design the code some other way not to need this.
-
-template<typename To, typename From>     // use like this: down_cast<T*>(foo);
-inline To down_cast(From* f) {                   // so we only accept pointers
-  // Ensures that To is a sub-type of From *.  This test is here only
-  // for compile-time type checking, and has no overhead in an
-  // optimized build at run-time, as it will be optimized away
-  // completely.
-  if (false) {
-    implicit_cast<From*, To>(0);
-  }
-
-  assert(f == NULL || dynamic_cast<To>(f) != NULL);  // RTTI: debug mode only!
-  return static_cast<To>(f);
-}
-
-// The COMPILE_ASSERT macro can be used to verify that a compile time
-// expression is true. For example, you could use it to verify the
-// size of a static array:
-//
-//   COMPILE_ASSERT(ARRAYSIZE_UNSAFE(content_type_names) == CONTENT_NUM_TYPES,
-//                  content_type_names_incorrect_size);
-//
-// or to make sure a struct is smaller than a certain size:
-//
-//   COMPILE_ASSERT(sizeof(foo) < 128, foo_too_large);
-//
-// The second argument to the macro is the name of the variable. If
-// the expression is false, most compilers will issue a warning/error
-// containing the name of the variable.
-
-template <bool>
-struct CompileAssert {
-};
-
-#undef COMPILE_ASSERT
-#define COMPILE_ASSERT(expr, msg) \
-  typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
-
-// Implementation details of COMPILE_ASSERT:
-//
-// - COMPILE_ASSERT works by defining an array type that has -1
-//   elements (and thus is invalid) when the expression is false.
-//
-// - The simpler definition
-//
-//     #define COMPILE_ASSERT(expr, msg) typedef char msg[(expr) ? 1 : -1]
-//
-//   does not work, as gcc supports variable-length arrays whose sizes
-//   are determined at run-time (this is gcc's extension and not part
-//   of the C++ standard).  As a result, gcc fails to reject the
-//   following code with the simple definition:
-//
-//     int foo;
-//     COMPILE_ASSERT(foo, msg); // not supposed to compile as foo is
-//                               // not a compile-time constant.
-//
-// - By using the type CompileAssert<(bool(expr))>, we ensures that
-//   expr is a compile-time constant.  (Template arguments must be
-//   determined at compile-time.)
-//
-// - The outter parentheses in CompileAssert<(bool(expr))> are necessary
-//   to work around a bug in gcc 3.4.4 and 4.0.1.  If we had written
-//
-//     CompileAssert<bool(expr)>
-//
-//   instead, these compilers will refuse to compile
-//
-//     COMPILE_ASSERT(5 > 0, some_message);
-//
-//   (They seem to think the ">" in "5 > 0" marks the end of the
-//   template argument list.)
-//
-// - The array size is (bool(expr) ? 1 : -1), instead of simply
-//
-//     ((expr) ? 1 : -1).
-//
-//   This is to avoid running into a bug in MS VC 7.1, which
-//   causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1.
-
-
-// MetatagId refers to metatag-id that we assign to
-// each metatag <name, value> pair..
-typedef uint32 MetatagId;
-
-// Argument type used in interfaces that can optionally take ownership
-// of a passed in argument.  If TAKE_OWNERSHIP is passed, the called
-// object takes ownership of the argument.  Otherwise it does not.
-enum Ownership {
-  DO_NOT_TAKE_OWNERSHIP,
-  TAKE_OWNERSHIP
-};
-
-// Use these as the mlock_bytes parameter to MLock and MLockGeneral
-enum { MLOCK_ALL = -1, MLOCK_NONE = 0 };
-
-// Helper routine to avoid buggy code like the following:
-//      if (pos + N < end) ...
-// If pos is large enough, "pos + N" may overflow.  For example,
-// pos==0xfffff000 and N==1MB.
-//
-// PointerRangeSize(a,b) returns the size of the range [a,b-1]
-inline size_t PointerRangeSize(const char* start, const char* end) {
-  assert(start <= end);
-  return end - start;
-}
-
-// bit_cast<Dest,Source> is a template function that implements the
-// equivalent of "*reinterpret_cast<Dest*>(&source)".  We need this in
-// very low-level functions like the protobuf library and fast math
-// support.
-//
-//   float f = 3.14159265358979;
-//   int i = bit_cast<int32>(f);
-//   // i = 0x40490fdb
-//
-// The classical address-casting method is:
-//
-//   // WRONG
-//   float f = 3.14159265358979;            // WRONG
-//   int i = * reinterpret_cast<int*>(&f);  // WRONG
-//
-// The address-casting method actually produces undefined behavior
-// according to ISO C++ specification section 3.10 -15 -.  Roughly, this
-// section says: if an object in memory has one type, and a program
-// accesses it with a different type, then the result is undefined
-// behavior for most values of "different type".
-//
-// This is true for any cast syntax, either *(int*)&f or
-// *reinterpret_cast<int*>(&f).  And it is particularly true for
-// conversions betweeen integral lvalues and floating-point lvalues.
-//
-// The purpose of 3.10 -15- is to allow optimizing compilers to assume
-// that expressions with different types refer to different memory.  gcc
-// 4.0.1 has an optimizer that takes advantage of this.  So a
-// non-conforming program quietly produces wildly incorrect output.
-//
-// The problem is not the use of reinterpret_cast.  The problem is type
-// punning: holding an object in memory of one type and reading its bits
-// back using a different type.
-//
-// The C++ standard is more subtle and complex than this, but that
-// is the basic idea.
-//
-// Anyways ...
-//
-// bit_cast<> calls memcpy() which is blessed by the standard,
-// especially by the example in section 3.9 .  Also, of course,
-// bit_cast<> wraps up the nasty logic in one place.
-//
-// Fortunately memcpy() is very fast.  In optimized mode, with a
-// constant size, gcc 2.95.3, gcc 4.0.1, and msvc 7.1 produce inline
-// code with the minimal amount of data movement.  On a 32-bit system,
-// memcpy(d,s,4) compiles to one load and one store, and memcpy(d,s,8)
-// compiles to two loads and two stores.
-//
-// I tested this code with gcc 2.95.3, gcc 4.0.1, icc 8.1, and msvc 7.1.
-//
-// WARNING: if Dest or Source is a non-POD type, the result of the memcpy
-// is likely to surprise you.
-
-template <class Dest, class Source>
-inline Dest bit_cast(const Source& source) {
-  // Compile time assertion: sizeof(Dest) == sizeof(Source)
-  // A compile error here means your Dest and Source have different sizes.
-  typedef char VerifySizesAreEqual [sizeof(Dest) == sizeof(Source) ? 1 : -1];
-
-  Dest dest;
-  memcpy(&dest, &source, sizeof(dest));
-  return dest;
-}
-
-// The following enum should be used only as a constructor argument to indicate
-// that the variable has static storage class, and that the constructor should
-// do nothing to its state.  It indicates to the reader that it is legal to
-// declare a static instance of the class, provided the constructor is given
-// the base::LINKER_INITIALIZED argument.  Normally, it is unsafe to declare a
-// static variable that has a constructor or a destructor because invocation
-// order is undefined.  However, IF the type can be initialized by filling with
-// zeroes (which the loader does for static variables), AND the destructor also
-// does nothing to the storage, AND there are no virtual methods, then a
-// constructor declared as
-//       explicit MyClass(base::LinkerInitialized x) {}
-// and invoked as
-//       static MyClass my_variable_name(base::LINKER_INITIALIZED);
-namespace base {
-enum LinkerInitialized { LINKER_INITIALIZED };
-}  // base
-
-
-#endif  // BASE_BASICTYPES_H_
diff --git a/third_party/chrome/base/port.h b/third_party/chrome/base/port.h
deleted file mode 100644
index d077705..0000000
--- a/third_party/chrome/base/port.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) 2006-2008 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 BASE_PORT_H_
-#define BASE_PORT_H_
-
-#include <stdarg.h>
-#include "build/build_config.h"
-
-#ifdef COMPILER_MSVC
-#define GG_LONGLONG(x) x##I64
-#define GG_ULONGLONG(x) x##UI64
-#else
-#define GG_LONGLONG(x) x##LL
-#define GG_ULONGLONG(x) x##ULL
-#endif
-
-// Per C99 7.8.14, define __STDC_CONSTANT_MACROS before including <stdint.h>
-// to get the INTn_C and UINTn_C macros for integer constants.  It's difficult
-// to guarantee any specific ordering of header includes, so it's difficult to
-// guarantee that the INTn_C macros can be defined by including <stdint.h> at
-// any specific point.  Provide GG_INTn_C macros instead.
-
-#define GG_INT8_C(x)    (x)
-#define GG_INT16_C(x)   (x)
-#define GG_INT32_C(x)   (x)
-#define GG_INT64_C(x)   GG_LONGLONG(x)
-
-#define GG_UINT8_C(x)   (x ## U)
-#define GG_UINT16_C(x)  (x ## U)
-#define GG_UINT32_C(x)  (x ## U)
-#define GG_UINT64_C(x)  GG_ULONGLONG(x)
-
-namespace base {
-
-// It's possible for functions that use a va_list, such as StringPrintf, to
-// invalidate the data in it upon use.  The fix is to make a copy of the
-// structure before using it and use that copy instead.  va_copy is provided
-// for this purpose.  MSVC does not provide va_copy, so define an
-// implementation here.  It is not guaranteed that assignment is a copy, so the
-// StringUtil.VariableArgsFunc unit test tests this capability.
-inline void va_copy(va_list& a, va_list& b) {
-#if defined(COMPILER_GCC)
-  ::va_copy(a, b);
-#elif defined(COMPILER_MSVC)
-  a = b;
-#endif
-}
-
-}  // namespace base
-
-// Define an OS-neutral wrapper for shared library entry points
-#if defined(OS_WIN)
-#define API_CALL __stdcall
-#elif defined(OS_LINUX) || defined(OS_MACOSX)
-#define API_CALL
-#endif
-
-#endif  // BASE_PORT_H_
diff --git a/third_party/chrome/base/scoped_ptr.h b/third_party/chrome/base/scoped_ptr.h
deleted file mode 100644
index 4489f2d..0000000
--- a/third_party/chrome/base/scoped_ptr.h
+++ /dev/null
@@ -1,380 +0,0 @@
-// Copyright (c) 2006-2008 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.
-
-// Scopers help you manage ownership of a pointer, helping you easily manage the
-// a pointer within a scope, and automatically destroying the pointer at the
-// end of a scope.  There are two main classes you will use, which coorespond
-// to the operators new/delete and new[]/delete[].
-//
-// Example usage (scoped_ptr):
-//   {
-//     scoped_ptr<Foo> foo(new Foo("wee"));
-//   }  // foo goes out of scope, releasing the pointer with it.
-//
-//   {
-//     scoped_ptr<Foo> foo;          // No pointer managed.
-//     foo.reset(new Foo("wee"));    // Now a pointer is managed.
-//     foo.reset(new Foo("wee2"));   // Foo("wee") was destroyed.
-//     foo.reset(new Foo("wee3"));   // Foo("wee2") was destroyed.
-//     foo->Method();                // Foo::Method() called.
-//     foo.get()->Method();          // Foo::Method() called.
-//     SomeFunc(foo.Release());      // SomeFunc takes owernship, foo no longer
-//                                   // manages a pointer.
-//     foo.reset(new Foo("wee4"));   // foo manages a pointer again.
-//     foo.reset();                  // Foo("wee4") destroyed, foo no longer
-//                                   // manages a pointer.
-//   }  // foo wasn't managing a pointer, so nothing was destroyed.
-//
-// Example usage (scoped_array):
-//   {
-//     scoped_array<Foo> foo(new Foo[100]);
-//     foo.get()->Method();  // Foo::Method on the 0th element.
-//     foo[10].Method();     // Foo::Method on the 10th element.
-//   }
-
-#ifndef BASE_SCOPED_PTR_H_
-#define BASE_SCOPED_PTR_H_
-
-// This is an implementation designed to match the anticipated future TR2
-// implementation of the scoped_ptr class, and its closely-related brethren,
-// scoped_array, scoped_ptr_malloc.
-
-#include <assert.h>
-#include <stdlib.h>
-#include <cstddef>
-
-// A scoped_ptr<T> is like a T*, except that the destructor of scoped_ptr<T>
-// automatically deletes the pointer it holds (if any).
-// That is, scoped_ptr<T> owns the T object that it points to.
-// Like a T*, a scoped_ptr<T> may hold either NULL or a pointer to a T object.
-// Also like T*, scoped_ptr<T> is thread-compatible, and once you
-// dereference it, you get the threadsafety guarantees of T.
-//
-// The size of a scoped_ptr is small:
-// sizeof(scoped_ptr<C>) == sizeof(C*)
-template <class C>
-class scoped_ptr {
- public:
-
-  // The element type
-  typedef C element_type;
-
-  // Constructor.  Defaults to intializing with NULL.
-  // There is no way to create an uninitialized scoped_ptr.
-  // The input parameter must be allocated with new.
-  explicit scoped_ptr(C* p = NULL) : ptr_(p) { }
-
-  // Destructor.  If there is a C object, delete it.
-  // We don't need to test ptr_ == NULL because C++ does that for us.
-  ~scoped_ptr() {
-    enum { type_must_be_complete = sizeof(C) };
-    delete ptr_;
-  }
-
-  // Reset.  Deletes the current owned object, if any.
-  // Then takes ownership of a new object, if given.
-  // this->reset(this->get()) works.
-  void reset(C* p = NULL) {
-    if (p != ptr_) {
-      enum { type_must_be_complete = sizeof(C) };
-      delete ptr_;
-      ptr_ = p;
-    }
-  }
-
-  // Accessors to get the owned object.
-  // operator* and operator-> will assert() if there is no current object.
-  C& operator*() const {
-    assert(ptr_ != NULL);
-    return *ptr_;
-  }
-  C* operator->() const  {
-    assert(ptr_ != NULL);
-    return ptr_;
-  }
-  C* get() const { return ptr_; }
-
-  // Comparison operators.
-  // These return whether two scoped_ptr refer to the same object, not just to
-  // two different but equal objects.
-  bool operator==(C* p) const { return ptr_ == p; }
-  bool operator!=(C* p) const { return ptr_ != p; }
-
-  // Swap two scoped pointers.
-  void swap(scoped_ptr& p2) {
-    C* tmp = ptr_;
-    ptr_ = p2.ptr_;
-    p2.ptr_ = tmp;
-  }
-
-  // Release a pointer.
-  // The return value is the current pointer held by this object.
-  // If this object holds a NULL pointer, the return value is NULL.
-  // After this operation, this object will hold a NULL pointer,
-  // and will not own the object any more.
-  C* release() {
-    C* retVal = ptr_;
-    ptr_ = NULL;
-    return retVal;
-  }
-
- private:
-  C* ptr_;
-
-  // Forbid comparison of scoped_ptr types.  If C2 != C, it totally doesn't
-  // make sense, and if C2 == C, it still doesn't make sense because you should
-  // never have the same object owned by two different scoped_ptrs.
-  template <class C2> bool operator==(scoped_ptr<C2> const& p2) const;
-  template <class C2> bool operator!=(scoped_ptr<C2> const& p2) const;
-
-  // Disallow evil constructors
-  scoped_ptr(const scoped_ptr&);
-  void operator=(const scoped_ptr&);
-};
-
-// Free functions
-template <class C>
-void swap(scoped_ptr<C>& p1, scoped_ptr<C>& p2) {
-  p1.swap(p2);
-}
-
-template <class C>
-bool operator==(C* p1, const scoped_ptr<C>& p2) {
-  return p1 == p2.get();
-}
-
-template <class C>
-bool operator!=(C* p1, const scoped_ptr<C>& p2) {
-  return p1 != p2.get();
-}
-
-// scoped_array<C> is like scoped_ptr<C>, except that the caller must allocate
-// with new [] and the destructor deletes objects with delete [].
-//
-// As with scoped_ptr<C>, a scoped_array<C> either points to an object
-// or is NULL.  A scoped_array<C> owns the object that it points to.
-// scoped_array<T> is thread-compatible, and once you index into it,
-// the returned objects have only the threadsafety guarantees of T.
-//
-// Size: sizeof(scoped_array<C>) == sizeof(C*)
-template <class C>
-class scoped_array {
- public:
-
-  // The element type
-  typedef C element_type;
-
-  // Constructor.  Defaults to intializing with NULL.
-  // There is no way to create an uninitialized scoped_array.
-  // The input parameter must be allocated with new [].
-  explicit scoped_array(C* p = NULL) : array_(p) { }
-
-  // Destructor.  If there is a C object, delete it.
-  // We don't need to test ptr_ == NULL because C++ does that for us.
-  ~scoped_array() {
-    enum { type_must_be_complete = sizeof(C) };
-    delete[] array_;
-  }
-
-  // Reset.  Deletes the current owned object, if any.
-  // Then takes ownership of a new object, if given.
-  // this->reset(this->get()) works.
-  void reset(C* p = NULL) {
-    if (p != array_) {
-      enum { type_must_be_complete = sizeof(C) };
-      delete[] array_;
-      array_ = p;
-    }
-  }
-
-  // Get one element of the current object.
-  // Will assert() if there is no current object, or index i is negative.
-  C& operator[](std::ptrdiff_t i) const {
-    assert(i >= 0);
-    assert(array_ != NULL);
-    return array_[i];
-  }
-
-  // Get a pointer to the zeroth element of the current object.
-  // If there is no current object, return NULL.
-  C* get() const {
-    return array_;
-  }
-
-  // Comparison operators.
-  // These return whether two scoped_array refer to the same object, not just to
-  // two different but equal objects.
-  bool operator==(C* p) const { return array_ == p; }
-  bool operator!=(C* p) const { return array_ != p; }
-
-  // Swap two scoped arrays.
-  void swap(scoped_array& p2) {
-    C* tmp = array_;
-    array_ = p2.array_;
-    p2.array_ = tmp;
-  }
-
-  // Release an array.
-  // The return value is the current pointer held by this object.
-  // If this object holds a NULL pointer, the return value is NULL.
-  // After this operation, this object will hold a NULL pointer,
-  // and will not own the object any more.
-  C* release() {
-    C* retVal = array_;
-    array_ = NULL;
-    return retVal;
-  }
-
- private:
-  C* array_;
-
-  // Forbid comparison of different scoped_array types.
-  template <class C2> bool operator==(scoped_array<C2> const& p2) const;
-  template <class C2> bool operator!=(scoped_array<C2> const& p2) const;
-
-  // Disallow evil constructors
-  scoped_array(const scoped_array&);
-  void operator=(const scoped_array&);
-};
-
-// Free functions
-template <class C>
-void swap(scoped_array<C>& p1, scoped_array<C>& p2) {
-  p1.swap(p2);
-}
-
-template <class C>
-bool operator==(C* p1, const scoped_array<C>& p2) {
-  return p1 == p2.get();
-}
-
-template <class C>
-bool operator!=(C* p1, const scoped_array<C>& p2) {
-  return p1 != p2.get();
-}
-
-// This class wraps the c library function free() in a class that can be
-// passed as a template argument to scoped_ptr_malloc below.
-class ScopedPtrMallocFree {
- public:
-  inline void operator()(void* x) const {
-    free(x);
-  }
-};
-
-// scoped_ptr_malloc<> is similar to scoped_ptr<>, but it accepts a
-// second template argument, the functor used to free the object.
-
-template<class C, class FreeProc = ScopedPtrMallocFree>
-class scoped_ptr_malloc {
- public:
-
-  // The element type
-  typedef C element_type;
-
-  // Constructor.  Defaults to intializing with NULL.
-  // There is no way to create an uninitialized scoped_ptr.
-  // The input parameter must be allocated with an allocator that matches the
-  // Free functor.  For the default Free functor, this is malloc, calloc, or
-  // realloc.
-  explicit scoped_ptr_malloc(C* p = NULL): ptr_(p) {}
-
-  // Destructor.  If there is a C object, call the Free functor.
-  ~scoped_ptr_malloc() {
-    free_(ptr_);
-  }
-
-  // Reset.  Calls the Free functor on the current owned object, if any.
-  // Then takes ownership of a new object, if given.
-  // this->reset(this->get()) works.
-  void reset(C* p = NULL) {
-    if (ptr_ != p) {
-      free_(ptr_);
-      ptr_ = p;
-    }
-  }
-
-  // Get the current object.
-  // operator* and operator-> will cause an assert() failure if there is
-  // no current object.
-  C& operator*() const {
-    assert(ptr_ != NULL);
-    return *ptr_;
-  }
-
-  C* operator->() const {
-    assert(ptr_ != NULL);
-    return ptr_;
-  }
-
-  C* get() const {
-    return ptr_;
-  }
-
-  // Comparison operators.
-  // These return whether a scoped_ptr_malloc and a plain pointer refer
-  // to the same object, not just to two different but equal objects.
-  // For compatibility wwith the boost-derived implementation, these
-  // take non-const arguments.
-  bool operator==(C* p) const {
-    return ptr_ == p;
-  }
-
-  bool operator!=(C* p) const {
-    return ptr_ != p;
-  }
-
-  // Swap two scoped pointers.
-  void swap(scoped_ptr_malloc & b) {
-    C* tmp = b.ptr_;
-    b.ptr_ = ptr_;
-    ptr_ = tmp;
-  }
-
-  // Release a pointer.
-  // The return value is the current pointer held by this object.
-  // If this object holds a NULL pointer, the return value is NULL.
-  // After this operation, this object will hold a NULL pointer,
-  // and will not own the object any more.
-  C* release() {
-    C* tmp = ptr_;
-    ptr_ = NULL;
-    return tmp;
-  }
-
- private:
-  C* ptr_;
-
-  // no reason to use these: each scoped_ptr_malloc should have its own object
-  template <class C2, class GP>
-  bool operator==(scoped_ptr_malloc<C2, GP> const& p) const;
-  template <class C2, class GP>
-  bool operator!=(scoped_ptr_malloc<C2, GP> const& p) const;
-
-  static FreeProc const free_;
-
-  // Disallow evil constructors
-  scoped_ptr_malloc(const scoped_ptr_malloc&);
-  void operator=(const scoped_ptr_malloc&);
-};
-
-template<class C, class FP>
-FP const scoped_ptr_malloc<C, FP>::free_ = FP();
-
-template<class C, class FP> inline
-void swap(scoped_ptr_malloc<C, FP>& a, scoped_ptr_malloc<C, FP>& b) {
-  a.swap(b);
-}
-
-template<class C, class FP> inline
-bool operator==(C* p, const scoped_ptr_malloc<C, FP>& b) {
-  return p == b.get();
-}
-
-template<class C, class FP> inline
-bool operator!=(C* p, const scoped_ptr_malloc<C, FP>& b) {
-  return p != b.get();
-}
-
-#endif  // BASE_SCOPED_PTR_H_
diff --git a/third_party/chrome/build/build_config.h b/third_party/chrome/build/build_config.h
deleted file mode 100644
index c4c8ed7..0000000
--- a/third_party/chrome/build/build_config.h
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (c) 2006-2008 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.
-
-// This file adds defines about the platform we're currently building on.
-//  Operating System:
-//    OS_WIN / OS_MACOSX / OS_LINUX / OS_POSIX (MACOSX or LINUX)
-//  Compiler:
-//    COMPILER_MSVC / COMPILER_GCC
-//  Processor:
-//    ARCH_CPU_X86 / ARCH_CPU_X86_64 / ARCH_CPU_X86_FAMILY (X86 or X86_64)
-//    ARCH_CPU_32_BITS / ARCH_CPU_64_BITS
-
-#ifndef BUILD_BUILD_CONFIG_H_
-#define BUILD_BUILD_CONFIG_H_
-
-// A set of macros to use for platform detection.
-#if defined(__APPLE__)
-#define OS_MACOSX 1
-#elif defined(__linux__)
-#define OS_LINUX 1
-#elif defined(_WIN32)
-#define OS_WIN 1
-#else
-#error Please add support for your platform in build/build_config.h
-#endif
-
-// For access to standard POSIX features, use OS_POSIX instead of a more
-// specific macro.
-#if defined(OS_MACOSX) || defined(OS_LINUX)
-#define OS_POSIX 1
-#endif
-
-// Compiler detection.
-#if defined(__GNUC__)
-#define COMPILER_GCC 1
-#elif defined(_MSC_VER)
-#define COMPILER_MSVC 1
-#else
-#error Please add support for your compiler in build/build_config.h
-#endif
-
-// Processor architecture detection.  For more info on what's defined, see:
-//   http://msdn.microsoft.com/en-us/library/b0084kay.aspx
-//   http://www.agner.org/optimize/calling_conventions.pdf
-#if defined(_M_X64) || defined(__x86_64__)
-#define ARCH_CPU_X86_FAMILY 1
-#define ARCH_CPU_X86_64 1
-#define ARCH_CPU_64_BITS 1
-#elif defined(_M_IX86) || defined(__i386__)
-#define ARCH_CPU_X86_FAMILY 1
-#define ARCH_CPU_X86 1
-#define ARCH_CPU_32_BITS 1
-#else
-#error Please add support for your architecture in build/build_config.h
-#endif
-
-// Type detection for wchar_t.
-#if defined(OS_WIN)
-#define WCHAR_T_IS_UTF16
-#elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
-    defined(__WCHAR_MAX__) && __WCHAR_MAX__ == 0x7fffffff
-#define WCHAR_T_IS_UTF32
-#else
-#error Please add support for your compiler in build/build_config.h
-#endif
-
-#endif  // BUILD_BUILD_CONFIG_H_
diff --git a/third_party/chrome/third_party/npapi/bindings/npapi.h b/third_party/chrome/third_party/npapi/bindings/npapi.h
deleted file mode 100644
index 1e6e7e2..0000000
--- a/third_party/chrome/third_party/npapi/bindings/npapi.h
+++ /dev/null
@@ -1,932 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-
-/*
- *  Netscape client plug-in API spec
- */
-
-
-#ifndef _NPAPI_H_
-#define _NPAPI_H_
-
-
-/* BEGIN GOOGLE MODIFICATIONS */
-
-#ifdef __native_client__
-#include <stdint.h>
-#else
-#include "base/basictypes.h"
-#endif  /* __native_client__ */
-
-/* END GOOGLE MODIFICATIONS */
-
-#ifdef INCLUDE_JAVA
-#include "jri.h"                /* Java Runtime Interface */
-#else
-#define jref    void *
-#define JRIEnv  void
-#endif
-
-#ifdef _WIN32
-#    ifndef XP_WIN
-#        define XP_WIN 1
-#    endif /* XP_WIN */
-#endif /* _WIN32 */
-
-/* BEGIN GOOGLE MODIFICATIONS */
-/* On Linux and Mac, be sure to set Mozilla-specific macros. */
-#if defined(USE_X11)
-#define XP_UNIX 1
-#define MOZ_X11 1
-#endif
-/* END GOOGLE MODIFICATIONS */
-
-#ifdef __MWERKS__
-#    define _declspec __declspec
-#    ifdef macintosh
-#        ifndef XP_MAC
-#            define XP_MAC 1
-#        endif /* XP_MAC */
-#    endif /* macintosh */
-#    ifdef __INTEL__
-#        undef NULL
-#        ifndef XP_WIN
-#            define XP_WIN 1
-#        endif /* __INTEL__ */
-#    endif /* XP_PC */
-#endif /* __MWERKS__ */
-
-#ifdef __SYMBIAN32__
-#   ifndef XP_SYMBIAN
-#       define XP_SYMBIAN 1
-#       undef XP_WIN
-#   endif
-#endif  /* __SYMBIAN32__ */
-
-#if defined(__APPLE_CC__) && !defined(__MACOS_CLASSIC__) && !defined(XP_UNIX)
-#   define XP_MACOSX
-#endif
-
-#ifdef XP_MAC
-#include <Quickdraw.h>
-#include <Events.h>
-#endif
-
-#if defined(XP_MACOSX) && defined(__LP64__)
-#define NP_NO_QUICKDRAW
-#define NP_NO_CARBON
-#endif
-
-#ifdef XP_MACOSX
-#include <ApplicationServices/ApplicationServices.h>
-#include <OpenGL/OpenGL.h>
-#ifndef NP_NO_CARBON
-#include <Carbon/Carbon.h>
-#endif
-#endif
-
-#if defined(XP_UNIX) 
-#	include <stdio.h>
-/* BEGIN GOOGLE MODIFICATIONS */
-#if 0
-/* END GOOGLE MODIFICATIONS */
-#	if defined(MOZ_X11)
-#		include <X11/Xlib.h>
-#		include <X11/Xutil.h>
-#	endif
-/* BEGIN GOOGLE MODIFICATIONS */
-#endif
-/* END GOOGLE MODIFICATIONS */
-#endif
-
-#ifdef XP_WIN
-#include <windows.h>
-#endif
-
-/*----------------------------------------------------------------------*/
-/*             Plugin Version Constants                                 */
-/*----------------------------------------------------------------------*/
-
-#define NP_VERSION_MAJOR 0
-/* BEGIN GOOGLE MODIFICATIONS */
-#define NP_VERSION_MINOR 23 /* maximum version currently supported by Chromium */
-/* END GOOGLE MODIFICATIONS */
-
-
-/*----------------------------------------------------------------------*/
-/*             Definition of Basic Types                                */
-/*----------------------------------------------------------------------*/
-
-/* QNX sets the _INT16 and friends defines, but does not typedef the types */
-#ifdef __QNXNTO__
-#undef _UINT16
-#undef _INT16
-#undef _UINT32
-#undef _INT32
-#endif
-
-#ifndef _UINT16
-#define _UINT16
-typedef unsigned short uint16;
-#endif
-
-#ifndef _UINT32
-#define _UINT32
-#ifdef __LP64__
-typedef unsigned int uint32;
-#else /* __LP64__ */
-typedef unsigned long uint32;
-#endif /* __LP64__ */
-#endif
-
-#ifndef _INT16
-#define _INT16
-typedef short int16;
-#endif
-
-#ifndef _INT32
-#define _INT32
-#ifdef __LP64__
-typedef int int32;
-#else /* __LP64__ */
-typedef long int32;
-#endif /* __LP64__ */
-#endif
-
-#ifndef FALSE
-#define FALSE (0)
-#endif
-#ifndef TRUE
-#define TRUE (1)
-#endif
-#ifndef NULL
-#define NULL (0L)
-#endif
-
-typedef unsigned char    NPBool;
-typedef int16            NPError;
-typedef int16            NPReason;
-typedef char*            NPMIMEType;
-
-
-
-/*----------------------------------------------------------------------*/
-/*                       Structures and definitions                     */
-/*----------------------------------------------------------------------*/
-
-#if !defined(__LP64__)
-#if defined(XP_MAC) || defined(XP_MACOSX)
-#pragma options align=mac68k
-#endif
-#endif /* __LP64__ */
-
-/*
- *  NPP is a plug-in's opaque instance handle
- */
-typedef struct _NPP
-{
-  void*	pdata;      /* plug-in private data */
-  void*	ndata;      /* netscape private data */
-} NPP_t;
-
-typedef NPP_t*  NPP;
-
-
-typedef struct _NPStream
-{
-  void*  pdata; /* plug-in private data */
-  void*  ndata; /* netscape private data */
-  const  char* url;
-  uint32 end;
-  uint32 lastmodified;
-  void*  notifyData;
-  const  char* headers; /* Response headers from host.
-                         * Exists only for >= NPVERS_HAS_RESPONSE_HEADERS.
-                         * Used for HTTP only; NULL for non-HTTP.
-                         * Available from NPP_NewStream onwards.
-                         * Plugin should copy this data before storing it.
-                         * Includes HTTP status line and all headers,
-                         * preferably verbatim as received from server,
-                         * headers formatted as in HTTP ("Header: Value"),
-                         * and newlines (\n, NOT \r\n) separating lines.
-                         * Terminated by \n\0 (NOT \n\n\0). */
-} NPStream;
-
-
-typedef struct _NPByteRange
-{
-  int32  offset; /* negative offset means from the end */
-  uint32 length;
-  struct _NPByteRange* next;
-} NPByteRange;
-
-
-typedef struct _NPSavedData
-{
-  int32	len;
-  void*	buf;
-} NPSavedData;
-
-
-typedef struct _NPRect
-{
-  uint16 top;
-  uint16 left;
-  uint16 bottom;
-  uint16 right;
-} NPRect;
-
-
-#ifdef XP_UNIX
-/*
- * Unix specific structures and definitions
- */
-
-/*
- * Callback Structures.
- *
- * These are used to pass additional platform specific information.
- */
-enum {
-  NP_SETWINDOW = 1,
-  NP_PRINT
-};
-
-typedef struct
-{
-  int32 type;
-} NPAnyCallbackStruct;
-
-/* BEGIN GOOGLE MODIFICATIONS */
-typedef struct _NPSetWindowCallbackStruct NPSetWindowCallbackStruct;
-/* END GOOGLE MODIFICATIONS */
-
-typedef struct
-{
-  int32 type;
-  FILE* fp;
-} NPPrintCallbackStruct;
-
-#endif /* XP_UNIX */
-
-
-/*
- *   The following masks are applied on certain platforms to NPNV and 
- *   NPPV selectors that pass around pointers to COM interfaces. Newer 
- *   compilers on some platforms may generate vtables that are not 
- *   compatible with older compilers. To prevent older plugins from 
- *   not understanding a new browser's ABI, these masks change the 
- *   values of those selectors on those platforms. To remain backwards
- *   compatible with differenet versions of the browser, plugins can 
- *   use these masks to dynamically determine and use the correct C++
- *   ABI that the browser is expecting. This does not apply to Windows 
- *   as Microsoft's COM ABI will likely not change.
- */
-
-#define NP_ABI_GCC3_MASK  0x10000000
-/*
- *   gcc 3.x generated vtables on UNIX and OSX are incompatible with 
- *   previous compilers.
- */
-#if (defined (XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3))
-#define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK
-#else
-#define _NP_ABI_MIXIN_FOR_GCC3 0
-#endif
-
-#define NP_ABI_MACHO_MASK 0x01000000
-/*
- *   On OSX, the Mach-O executable format is significantly
- *   different than CFM. In addition to having a different
- *   C++ ABI, it also has has different C calling convention.
- *   You must use glue code when calling between CFM and
- *   Mach-O C functions. 
- */
-#if (defined(TARGET_RT_MAC_MACHO))
-#define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK
-#else
-#define _NP_ABI_MIXIN_FOR_MACHO 0
-#endif
-
-
-#define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO)
-
-/*
- * List of variable names for which NPP_GetValue shall be implemented
- */
-typedef enum {
-  NPPVpluginNameString = 1,
-  NPPVpluginDescriptionString,
-  NPPVpluginWindowBool,
-  NPPVpluginTransparentBool,
-  NPPVjavaClass,                /* Not implemented in Mozilla 1.0 */
-  NPPVpluginWindowSize,
-  NPPVpluginTimerInterval,
-
-  NPPVpluginScriptableInstance = (10 | NP_ABI_MASK),
-  NPPVpluginScriptableIID = 11,
-
-  /* Introduced in Mozilla 0.9.9 */
-  NPPVjavascriptPushCallerBool = 12,
-
-  /* Introduced in Mozilla 1.0 */
-  NPPVpluginKeepLibraryInMemory = 13,
-  NPPVpluginNeedsXEmbed         = 14,
-
-  /* Get the NPObject for scripting the plugin. Introduced in Firefox
-   * 1.0 (NPAPI minor version 14).
-   */
-  NPPVpluginScriptableNPObject  = 15,
-
-  /* Get the plugin value (as \0-terminated UTF-8 string data) for
-   * form submission if the plugin is part of a form. Use
-   * NPN_MemAlloc() to allocate memory for the string data.
-   */
-  NPPVformValue = 16,    /* Not implemented in WebKit */
-  
-  NPPVpluginUrlRequestsDisplayedBool = 17, /* Not implemented in WebKit */
-  
-  /* Checks if the plugin is interested in receiving the http body of
-   * failed http requests (http status != 200).
-   */
-  NPPVpluginWantsAllNetworkStreams = 18,
-  
-  /* Checks to see if the plug-in would like the browser to load the "src" attribute. */
-  NPPVpluginCancelSrcStream = 20
-  
-#ifdef XP_MACOSX
-  /* Used for negotiating drawing models */
-  , NPPVpluginDrawingModel = 1000,
-  /* Used for negotiating event models */
-  NPPVpluginEventModel = 1001,
-  /* In the NPDrawingModelCoreAnimation drawing model, the browser asks the plug-in for a Core Animation layer. */
-  NPPVpluginCoreAnimationLayer = 1003  
-#endif
-} NPPVariable;
-
-/*
- * List of variable names for which NPN_GetValue is implemented by Mozilla
- */
-typedef enum {
-  NPNVxDisplay = 1,
-  NPNVxtAppContext,
-  NPNVnetscapeWindow,
-  NPNVjavascriptEnabledBool,
-  NPNVasdEnabledBool,
-  NPNVisOfflineBool,
-
-  /* 10 and over are available on Mozilla builds starting with 0.9.4 */
-  NPNVserviceManager = (10 | NP_ABI_MASK),
-  NPNVDOMElement     = (11 | NP_ABI_MASK),   /* available in Mozilla 1.2 */
-  NPNVDOMWindow      = (12 | NP_ABI_MASK),
-  NPNVToolkit        = (13 | NP_ABI_MASK),
-  NPNVSupportsXEmbedBool = 14,
-
-  /* Get the NPObject wrapper for the browser window. */
-  NPNVWindowNPObject = 15,
-
-  /* Get the NPObject wrapper for the plugins DOM element. */
-  NPNVPluginElementNPObject = 16,
-
-  NPNVSupportsWindowless = 17,
-
-  NPNVprivateModeBool = 18
-
-#ifdef XP_MACOSX
-  /* Used for negotiating drawing models */
-  , NPNVpluginDrawingModel = 1000
-#ifndef NP_NO_QUICKDRAW
-  , NPNVsupportsQuickDrawBool = 2000
-#endif
-  , NPNVsupportsCoreGraphicsBool = 2001
-  , NPNVsupportsOpenGLBool = 2002 /* TRUE if the browser supports the OpenGL drawing model (CGL on Mac) */
-  , NPNVsupportsCoreAnimationBool = 2003 /* TRUE if the browser supports the CoreAnimation drawing model */
-  
-#ifndef NP_NO_CARBON
-  , NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon event model */
-#endif
-  , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */
-#endif
-} NPNVariable;
-
-typedef enum {
-  NPNURLVCookie = 501,
-  NPNURLVProxy
-} NPNURLVariable;
-
-/* BEGIN GOOGLE MODIFICATIONS */
-/*
- * The type of Tookkit the widgets use
- */
-typedef enum {
-  NPNVGtk12 = 1,
-  NPNVGtk2
-} NPNToolkitType;
-/* END GOOGLE MODIFICATIONS */
-
-/*
- * The type of a NPWindow - it specifies the type of the data structure
- * returned in the window field.
- */
-typedef enum {
-  NPWindowTypeWindow = 1,
-  NPWindowTypeDrawable
-} NPWindowType;
-
-#ifdef XP_MACOSX
-
-/*
- * The drawing model for a Mac OS X plugin.  These are the possible values for the NPNVpluginDrawingModel variable.
- */
-
-typedef enum {
-#ifndef NP_NO_QUICKDRAW
-  NPDrawingModelQuickDraw = 0,
-#endif
-  NPDrawingModelCoreGraphics = 1,
-  NPDrawingModelOpenGL = 2,
-  NPDrawingModelCoreAnimation = 3
-} NPDrawingModel;
-
-/*
- * The event model for a Mac OS X plugin. These are the possible values for the NPNVpluginEventModel variable.
- */
-
-typedef enum {
-#ifndef NP_NO_CARBON
-  NPEventModelCarbon = 0,
-#endif
-  NPEventModelCocoa = 1
-} NPEventModel;
-
-typedef enum {
-  NPCocoaEventDrawRect = 1,
-  NPCocoaEventMouseDown,
-  NPCocoaEventMouseUp,
-  NPCocoaEventMouseMoved,
-  NPCocoaEventMouseEntered,
-  NPCocoaEventMouseExited,
-  NPCocoaEventMouseDragged,
-  NPCocoaEventKeyDown,
-  NPCocoaEventKeyUp,
-  NPCocoaEventFlagsChanged,
-  NPCocoaEventFocusChanged,
-  NPCocoaEventWindowFocusChanged,
-  NPCocoaEventScrollWheel,
-  NPCocoaEventTextInput
-} NPCocoaEventType;
-
-typedef struct _NPNSString NPNSString;
-typedef struct _NPNSWindow NPNSWindow;
-typedef struct _NPNSMenu NPNSMenu;
-
-typedef struct _NPCocoaEvent {
-  NPCocoaEventType type;
-  uint32 version;
-  
-  union {
-    struct {
-      uint32 modifierFlags;
-      double pluginX;
-      double pluginY;            
-      int32 buttonNumber;
-      int32 clickCount;
-      double deltaX;
-      double deltaY;
-      double deltaZ;
-    } mouse;
-    struct {
-      uint32 modifierFlags;
-      NPNSString *characters;
-      NPNSString *charactersIgnoringModifiers;
-      NPBool isARepeat;
-      uint16 keyCode;
-    } key;
-    struct {
-      CGContextRef context;
-      
-      double x;
-      double y;
-      double width;
-      double height;
-    } draw;
-    struct {
-      NPBool hasFocus;
-    } focus;
-    struct {
-      NPNSString *text;
-    } text;
-  } data;
-} NPCocoaEvent;
-
-#endif
-
-typedef struct _NPWindow
-{
-  void* window;  /* Platform specific window handle */
-  int32 x;       /* Position of top left corner relative */
-  int32 y;       /* to a netscape page.					*/
-  uint32 width;  /* Maximum window size */
-  uint32 height;
-  NPRect clipRect; /* Clipping rectangle in port coordinates */
-                   /* Used by MAC only.			  */
-#if defined(XP_UNIX) && !defined(XP_MACOSX)
-  void * ws_info; /* Platform-dependent additonal data */
-#endif /* XP_UNIX */
-  NPWindowType type; /* Is this a window or a drawable? */
-} NPWindow;
-
-
-typedef struct _NPFullPrint
-{
-  NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */
-  NPBool printOne;		 /* TRUE if plugin should print one copy to default printer */
-  void* platformPrint; /* Platform-specific printing info */
-} NPFullPrint;
-
-typedef struct _NPEmbedPrint
-{
-  NPWindow window;
-  void* platformPrint; /* Platform-specific printing info */
-} NPEmbedPrint;
-
-typedef struct _NPPrint
-{
-  uint16 mode;               /* NP_FULL or NP_EMBED */
-  union
-  {
-    NPFullPrint fullPrint;   /* if mode is NP_FULL */
-    NPEmbedPrint embedPrint; /* if mode is NP_EMBED */
-  } print;
-} NPPrint;
-
-#ifdef XP_MACOSX
-/* BEGIN GOOGLE MODIFICATIONS */
-typedef struct _NPNSMenu NPNSMenu;
-/* END GOOGLE MODIFICATIONS */
-typedef NPNSMenu NPMenu;
-#else
-typedef void * NPMenu;
-#endif
-
-typedef enum {
-  NPCoordinateSpacePlugin = 1,
-  NPCoordinateSpaceWindow,
-  NPCoordinateSpaceFlippedWindow,
-  NPCoordinateSpaceScreen,
-  NPCoordinateSpaceFlippedScreen
-} NPCoordinateSpace;
-
-#if defined(XP_MAC) || defined(XP_MACOSX)
-
-#ifndef NP_NO_CARBON
-typedef EventRecord    NPEvent;
-#endif
-
-#elif defined(XP_WIN)
-typedef struct _NPEvent
-{
-  uint16 event;
-  uint32 wParam;
-  uint32 lParam;
-} NPEvent;
-#elif defined (XP_UNIX) && defined(MOZ_X11)
-/* BEGIN GOOGLE MODIFICATIONS */
-typedef union _XEvent XEvent;
-/* END GOOGLE MODIFICATIONS */
-typedef XEvent NPEvent;
-#else
-typedef void*			NPEvent;
-#endif /* XP_MACOSX */
-
-#if defined(XP_MAC)
-typedef RgnHandle NPRegion;
-#elif defined(XP_MACOSX)
-/* 
- * NPRegion's type depends on the drawing model specified by the plugin (see NPNVpluginDrawingModel).
- * NPQDRegion represents a QuickDraw RgnHandle and is used with the QuickDraw drawing model.
- * NPCGRegion repesents a graphical region when using any other drawing model.
- */
-typedef void *NPRegion;
-#ifndef NP_NO_QUICKDRAW
-typedef RgnHandle NPQDRegion;
-#endif
-typedef CGPathRef NPCGRegion;
-#elif defined(XP_WIN)
-typedef HRGN NPRegion;
-#elif defined(XP_UNIX)
-/* BEGIN GOOGLE MODIFICATIONS */
-typedef struct _XRegion *Region;	
-/* END GOOGLE MODIFICATIONS */
-typedef Region NPRegion;
-#else
-typedef void *NPRegion;
-#endif /* XP_MAC */
-
-#ifdef XP_MACOSX
-
-/* 
- * NP_CGContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelCoreGraphics
- * as its drawing model.
- */
-
-typedef struct NP_CGContext
-{
-  CGContextRef context;
-#ifdef NP_NO_CARBON
-  NPNSWindow *window;
-#else
-  void *window; /* Can be either an NSWindow or a WindowRef depending on the event model */
-#endif
-} NP_CGContext;
-
-/* 
- * NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelOpenGL as its
- * drawing model.
- */
-
-typedef struct NP_GLContext
-{
-  CGLContextObj context;
-#ifdef NP_NO_CARBON
-  NPNSWindow *window;
-#else
-  void *window; /* Can be either an NSWindow or a WindowRef depending on the event model */
-#endif
-} NP_GLContext;
-
-#endif /* XP_MACOSX */
-
-#if defined(XP_MAC) || defined(XP_MACOSX)
-
-/*
- *  Mac-specific structures and definitions.
- */
-
-#ifndef NP_NO_QUICKDRAW
-
-/* 
- * NP_Port is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelQuickDraw as its
- * drawing model, or the plugin does not specify a drawing model.
- *
- * It is not recommended that new plugins use NPDrawingModelQuickDraw or NP_Port, as QuickDraw has been
- * deprecated in Mac OS X 10.5.  CoreGraphics is the preferred drawing API.
- *
- * NP_Port is not available in 64-bit.
- */
-
-typedef struct NP_Port
-{
-  CGrafPtr     port;        /* Grafport */
-  int32        portx;        /* position inside the topmost window */
-  int32        porty;
-} NP_Port;
-
-#endif /* NP_NO_QUICKDRAW */
-
-/*
- *  Non-standard event types that can be passed to HandleEvent
- */
-/* BEGIN GOOGLE MODIFICATIONS */
-#ifndef NP_NO_CARBON
-enum NPEventType {
-  NPEventType_GetFocusEvent = (osEvt + 16),
-  NPEventType_LoseFocusEvent,
-  NPEventType_AdjustCursorEvent,
-  NPEventType_MenuCommandEvent,
-  NPEventType_ClippingChangedEvent,
-  NPEventType_ScrollingBeginsEvent = 1000,
-  NPEventType_ScrollingEndsEvent
-};
-
-#ifdef OBSOLETE
-#define getFocusEvent     (osEvt + 16)
-#define loseFocusEvent    (osEvt + 17)
-#define adjustCursorEvent (osEvt + 18)
-#endif
-#endif /* NP_NO_CARBON */
-/* END GOOGLE MODIFICATIONS */
-
-#endif /* XP_MACOSX */
-
-/*
- * Values for mode passed to NPP_New:
- */
-#define NP_EMBED 1
-#define NP_FULL  2
-
-/*
- * Values for stream type passed to NPP_NewStream:
- */
-#define NP_NORMAL     1
-#define NP_SEEK       2
-#define NP_ASFILE     3
-#define NP_ASFILEONLY 4
-
-#define NP_MAXREADY	(((unsigned)(~0)<<1)>>1)
-
-#if !defined(__LP64__)
-#if defined(XP_MAC) || defined(XP_MACOSX)
-#pragma options align=reset
-#endif
-#endif /* __LP64__ */
-
-
-/*----------------------------------------------------------------------*/
-/*		     Error and Reason Code definitions			*/
-/*----------------------------------------------------------------------*/
-
-/*
- * Values of type NPError:
- */
-#define NPERR_BASE                         0
-#define NPERR_NO_ERROR                    (NPERR_BASE + 0)
-#define NPERR_GENERIC_ERROR               (NPERR_BASE + 1)
-#define NPERR_INVALID_INSTANCE_ERROR      (NPERR_BASE + 2)
-#define NPERR_INVALID_FUNCTABLE_ERROR     (NPERR_BASE + 3)
-#define NPERR_MODULE_LOAD_FAILED_ERROR    (NPERR_BASE + 4)
-#define NPERR_OUT_OF_MEMORY_ERROR         (NPERR_BASE + 5)
-#define NPERR_INVALID_PLUGIN_ERROR        (NPERR_BASE + 6)
-#define NPERR_INVALID_PLUGIN_DIR_ERROR    (NPERR_BASE + 7)
-#define NPERR_INCOMPATIBLE_VERSION_ERROR  (NPERR_BASE + 8)
-#define NPERR_INVALID_PARAM               (NPERR_BASE + 9)
-#define NPERR_INVALID_URL                 (NPERR_BASE + 10)
-#define NPERR_FILE_NOT_FOUND              (NPERR_BASE + 11)
-#define NPERR_NO_DATA                     (NPERR_BASE + 12)
-#define NPERR_STREAM_NOT_SEEKABLE         (NPERR_BASE + 13)
-
-/*
- * Values of type NPReason:
- */
-#define NPRES_BASE          0
-#define NPRES_DONE         (NPRES_BASE + 0)
-#define NPRES_NETWORK_ERR  (NPRES_BASE + 1)
-#define NPRES_USER_BREAK   (NPRES_BASE + 2)
-
-/*
- * Don't use these obsolete error codes any more.
- */
-#define NP_NOERR  NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
-#define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
-#define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
-
-/*
- * Version feature information
- */
-#define NPVERS_HAS_STREAMOUTPUT             8
-#define NPVERS_HAS_NOTIFICATION             9
-#define NPVERS_HAS_LIVECONNECT              9
-#define NPVERS_WIN16_HAS_LIVECONNECT        9
-#define NPVERS_68K_HAS_LIVECONNECT          11
-#define NPVERS_HAS_WINDOWLESS               11
-#define NPVERS_HAS_XPCONNECT_SCRIPTING      13
-#define NPVERS_HAS_NPRUNTIME_SCRIPTING      14
-#define NPVERS_HAS_FORM_VALUES              15
-#define NPVERS_HAS_POPUPS_ENABLED_STATE     16
-#define NPVERS_HAS_RESPONSE_HEADERS         17
-#define NPVERS_HAS_NPOBJECT_ENUM            18
-#define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19
-#define NPVERS_HAS_ALL_NETWORK_STREAMS      20
-#define NPVERS_HAS_URL_AND_AUTH_INFO        21
-#define NPVERS_HAS_PRIVATE_MODE             22
-#define NPVERS_MACOSX_HAS_EVENT_MODELS      23
-#define NPVERS_HAS_CANCEL_SRC_STREAM        24
-
-/*----------------------------------------------------------------------*/
-/*                        Function Prototypes                           */
-/*----------------------------------------------------------------------*/
-
-#if defined(_WINDOWS) && !defined(WIN32)
-#define NP_LOADDS  _loadds
-#else
-#define NP_LOADDS
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * NPP_* functions are provided by the plugin and called by the navigator.
- */
-
-#ifdef XP_UNIX
-char* NPP_GetMIMEDescription(void);
-#endif /* XP_UNIX */
-
-NPError     NPP_Initialize(void);
-void        NPP_Shutdown(void);
-NPError     NP_LOADDS    NPP_New(NPMIMEType pluginType, NPP instance,
-                                 uint16 mode, int16 argc, char* argn[],
-                                 char* argv[], NPSavedData* saved);
-NPError     NP_LOADDS    NPP_Destroy(NPP instance, NPSavedData** save);
-NPError     NP_LOADDS    NPP_SetWindow(NPP instance, NPWindow* window);
-NPError     NP_LOADDS    NPP_NewStream(NPP instance, NPMIMEType type,
-                                       NPStream* stream, NPBool seekable,
-                                       uint16* stype);
-NPError     NP_LOADDS    NPP_DestroyStream(NPP instance, NPStream* stream,
-                                           NPReason reason);
-int32        NP_LOADDS    NPP_WriteReady(NPP instance, NPStream* stream);
-int32        NP_LOADDS    NPP_Write(NPP instance, NPStream* stream, int32 offset,
-                                    int32 len, void* buffer);
-void        NP_LOADDS    NPP_StreamAsFile(NPP instance, NPStream* stream,
-                                          const char* fname);
-void        NP_LOADDS    NPP_Print(NPP instance, NPPrint* platformPrint);
-int16            NPP_HandleEvent(NPP instance, void* event);
-void        NP_LOADDS    NPP_URLNotify(NPP instance, const char* url,
-                                       NPReason reason, void* notifyData);
-jref        NP_LOADDS            NPP_GetJavaClass(void);
-NPError     NPP_GetValue(NPP instance, NPPVariable variable,
-                         void *value);
-NPError     NPP_SetValue(NPP instance, NPNVariable variable,
-                         void *value);
-
-/*
- * NPN_* functions are provided by the navigator and called by the plugin.
- */
-
-void        NPN_Version(int* plugin_major, int* plugin_minor,
-                        int* netscape_major, int* netscape_minor);
-NPError     NPN_GetURLNotify(NPP instance, const char* url,
-                             const char* target, void* notifyData);
-NPError     NPN_GetURL(NPP instance, const char* url,
-                       const char* target);
-NPError     NPN_PostURLNotify(NPP instance, const char* url,
-                              const char* target, uint32 len,
-                              const char* buf, NPBool file,
-                              void* notifyData);
-NPError     NPN_PostURL(NPP instance, const char* url,
-                        const char* target, uint32 len,
-                        const char* buf, NPBool file);
-NPError     NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
-NPError     NPN_NewStream(NPP instance, NPMIMEType type,
-                          const char* target, NPStream** stream);
-int32        NPN_Write(NPP instance, NPStream* stream, int32 len,
-                       void* buffer);
-NPError     NPN_DestroyStream(NPP instance, NPStream* stream,
-                              NPReason reason);
-void        NPN_Status(NPP instance, const char* message);
-const char*    NPN_UserAgent(NPP instance);
-void*        NPN_MemAlloc(uint32 size);
-void        NPN_MemFree(void* ptr);
-uint32        NPN_MemFlush(uint32 size);
-void        NPN_ReloadPlugins(NPBool reloadPages);
-JRIEnv*     NPN_GetJavaEnv(void);
-jref        NPN_GetJavaPeer(NPP instance);
-NPError     NPN_GetValue(NPP instance, NPNVariable variable,
-                         void *value);
-NPError     NPN_SetValue(NPP instance, NPPVariable variable,
-                         void *value);
-void        NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
-void        NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion);
-void        NPN_ForceRedraw(NPP instance);
-void        NPN_PushPopupsEnabledState(NPP instance, NPBool enabled);
-void        NPN_PopPopupsEnabledState(NPP instance);
-void        NPN_PluginThreadAsyncCall(NPP instance, void (*func) (void *), void *userData);
-NPError     NPN_GetValueForURL(NPP instance, NPNURLVariable variable, const char* url, char** value, uint32* len);
-NPError     NPN_SetValueForURL(NPP instance, NPNURLVariable variable, const char* url, const char* value, uint32 len);
-NPError     NPN_GetAuthenticationInfo(NPP instance, const char* protocol, const char* host, int32 port, const char* scheme, const char *realm, char** username, uint32* ulen, char** password, uint32* plen);
-uint32      NPN_ScheduleTimer(NPP instance, uint32 interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32 timerID));
-void        NPN_UnscheduleTimer(NPP instance, uint32 timerID);
-NPError     NPN_PopUpContextMenu(NPP instance, NPMenu* menu);
-NPBool      NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
-
-#ifdef __cplusplus
-}  /* end extern "C" */
-#endif
-
-#endif /* _NPAPI_H_ */
diff --git a/third_party/chrome/third_party/npapi/bindings/npapi_extensions.h b/third_party/chrome/third_party/npapi/bindings/npapi_extensions.h
deleted file mode 100644
index f8c05f4..0000000
--- a/third_party/chrome/third_party/npapi/bindings/npapi_extensions.h
+++ /dev/null
@@ -1,646 +0,0 @@
-/* Copyright (c) 2006-2009 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 _NP_EXTENSIONS_H_
-#define _NP_EXTENSIONS_H_
-
-// Use the shorter include path here so that this file can be used in non-
-// Chromium projects, such as the Native Client SDK.
-#include "npapi.h"
-
-/*
- * A fake "enum" value for getting browser-implemented Pepper extensions.
- * The variable returns a pointer to an NPNExtensions structure. */
-#define NPNVPepperExtensions ((NPNVariable) 4000)
-
-/*
- * A fake "enum" value for getting plugin-implemented Pepper extensions.
- * The variable returns a pointer to an NPPExtensions structure. */
-#define NPPVPepperExtensions ((NPPVariable) 4001)
-
-typedef void NPDeviceConfig;
-typedef void NPDeviceContext;
-typedef void NPUserData;
-
-/* unique id for each device interface */
-typedef int32 NPDeviceID;
-
-typedef struct _NPPoint {
-  uint16 x;
-  uint16 y;
-} NPPoint;
-
-typedef enum {
-  NPThemeItemScrollbarDownArrow       = 0,
-  NPThemeItemScrollbarLeftArrow       = 1,
-  NPThemeItemScrollbarRightArrow      = 2,
-  NPThemeItemScrollbarUpArrow         = 3,
-  NPThemeItemScrollbarHorizontalThumb = 4,
-  NPThemeItemScrollbarVerticalThumb   = 5,
-  NPThemeItemScrollbarHoriztonalTrack = 6,
-  NPThemeItemScrollbarVerticalTrack   = 7
-} NPThemeItem;
-
-typedef enum {
-  NPThemeStateDisabled = 0,
-  // Mouse is over this item.
-  NPThemeStateHot      = 1,
-  // Mouse is over another part of this component.  This is only used on Windows
-  // Vista and above.  The plugin should pass it in, and the host will convert
-  // it to NPThemeStateNormal if on other platforms or on Windows XP.
-  NPThemeStateHover    = 2,
-  NPThemeStateNormal   = 3,
-  NPThemeStatePressed  = 4
-} NPThemeState;
-
-typedef struct _NPThemeParams {
-  NPThemeItem item;
-  NPThemeState state;
-  NPRect location;
-  // Used for scroll bar tracks, needed for classic theme in Windows which draws
-  // a checkered pattern.
-  NPPoint align;
-} NPThemeParams;
-
-typedef struct _NPDeviceBuffer {
-  void* ptr;
-  size_t size;
-} NPDeviceBuffer;
-
-/* completion callback for flush device */
-typedef void (*NPDeviceFlushContextCallbackPtr)(
-    NPP instance,
-    NPDeviceContext* context,
-    NPError err,
-    NPUserData* userData);
-
-/* query single capabilities of device */
-typedef NPError (
-    *NPDeviceQueryCapabilityPtr)(NPP instance,
-    int32 capability,
-    int32 *value);
-/* query config (configuration == a set of capabilities) */
-typedef NPError (
-    *NPDeviceQueryConfigPtr)(NPP instance,
-    const NPDeviceConfig* request,
-    NPDeviceConfig* obtain);
-/* device initialization */
-typedef NPError (*NPDeviceInitializeContextPtr)(
-    NPP instance,
-    const NPDeviceConfig* config,
-    NPDeviceContext* context);
-/* peek at device state */
-typedef NPError (*NPDeviceGetStateContextPtr) (
-    NPP instance,
-    NPDeviceContext* context,
-    int32 state,
-    intptr_t* value);
-/* poke device state */
-typedef NPError (*NPDeviceSetStateContextPtr) (
-    NPP instance,
-    NPDeviceContext* context,
-    int32 state,
-    intptr_t value);
-/* flush context, if callback, userData are NULL */
-/* this becomes a blocking call */
-typedef NPError (*NPDeviceFlushContextPtr)(
-    NPP instance,
-    NPDeviceContext* context,
-    NPDeviceFlushContextCallbackPtr callback,
-    void* userData);
-/* destroy device context.  Application responsible for */
-/* freeing context, if applicable */
-typedef NPError (*NPDeviceDestroyContextPtr)(
-    NPP instance,
-    NPDeviceContext* context);
-/* Create a buffer associated with a particular context. The usage of the */
-/* buffer is device specific. The lifetime of the buffer is scoped with the */
-/* lifetime of the context. */
-typedef NPError (*NPDeviceCreateBufferPtr)(
-    NPP instance,
-    NPDeviceContext* context,
-    size_t size,
-    int32* id);
-/* Destroy a buffer associated with a particular context. */
-typedef NPError (*NPDeviceDestroyBufferPtr)(
-    NPP instance,
-    NPDeviceContext* context,
-    int32 id);
-/* Map a buffer id to its address. */
-typedef NPError (*NPDeviceMapBufferPtr)(
-    NPP instance,
-    NPDeviceContext* context,
-    int32 id,
-    NPDeviceBuffer* buffer);
-/* Gets the size of the given theme component.  For variable sized items like */
-/* vertical scrollbar tracks, the width will be the required width of the */
-/* track while the height will be the minimum height. */
-typedef NPError (*NPDeviceThemeGetSize)(
-    NPP instance,
-    NPThemeItem item,
-    int* width,
-    int* height);
-/* Draw a themed item (i.e. scrollbar arrow). */
-typedef NPError (*NPDeviceThemePaint)(
-    NPP instance,
-    NPDeviceContext* context,
-    NPThemeParams* params);
-
-
-/* forward decl typdef structs */
-typedef struct NPDevice NPDevice;
-typedef struct NPNExtensions NPNExtensions;
-
-// DEPRECATED: this typedef is just for the NaCl code until they switch to NPNExtensions.
-// PLEASE REMOVE THIS WHEN THE NACL CODE IS UPDATED.
-typedef struct NPNExtensions NPExtensions;
-
-/* generic device interface */
-struct NPDevice {
-  NPDeviceQueryCapabilityPtr queryCapability;
-  NPDeviceQueryConfigPtr queryConfig;
-  NPDeviceInitializeContextPtr initializeContext;
-  NPDeviceSetStateContextPtr setStateContext;
-  NPDeviceGetStateContextPtr getStateContext;
-  NPDeviceFlushContextPtr flushContext;
-  NPDeviceDestroyContextPtr destroyContext;
-  NPDeviceCreateBufferPtr createBuffer;
-  NPDeviceDestroyBufferPtr destroyBuffer;
-  NPDeviceMapBufferPtr mapBuffer;
-  NPDeviceThemeGetSize themeGetSize;
-  NPDeviceThemePaint themePaint;
-};
-
-/* returns NULL if deviceID unavailable / unrecognized */
-typedef NPDevice* (*NPAcquireDevicePtr)(
-    NPP instance,
-    NPDeviceID device);
-
-/* Copy UTF-8 string into clipboard */
-typedef void (*NPCopyTextToClipboardPtr)(
-    NPP instance,
-    const char* content);
-
-/* Updates the number of find results for the current search term.  If
- * there are no matches 0 should be passed in.  Only when the plugin has
- * finished searching should it pass in the final count with finalResult set to
- * true. */
-typedef void (*NPNumberOfFindResultsChangedPtr)(
-    NPP instance,
-    int total,
-    bool finalResult);
-
- /* Updates the index of the currently selected search item. */
-typedef void (*NPSelectedFindResultChangedPtr)(
-    NPP instance,
-    int index);
-
-/* Supports opening files anywhere on the system after prompting the user to
- * pick one.
- *
- * This API is asynchronous. It will return immediately and the user will be
- * prompted in parallel to pick a file. The plugin may continue to receive
- * events while the open file dialog is up, and may continue to paint. Plugins
- * may want to ignore input events between the call and the callback to avoid
- * reentrant behavior. If the return value is not NPERR_NO_ERROR, the callback
- * will NOT be executed.
- *
- * It is an error to call BrowseForFile before a previous call has executed
- * the callback.
- *
- * Setting the flags to "Open" requires that the file exist to allow picking.
- * Setting the flags to "Save" allows selecting nonexistant files (which will
- * then be created), and will prompt the user if they want to overwrite an
- * existing file if it exists.
- *
- * The plugin may specify a comma-separated list of possible mime types in
- * the "extensions" parameter. If no extensions are specified, the dialog box
- * will default to allowing all extensions. The first extension in the list
- * will be the default.
- *
- * TODO(brettw) On Windows the extensions traditionally include a text
- * description with the extension in the popup, do we want to allow this?
- * We should probably also allow the ability to put "All files" in the
- * list on Windows.
- *
- * Once the user has picked a file or has canceled the dialog box, the given
- * callback will be called with the results of the operation and the passed in
- * "user data" pointer. If the user successfully picked a file, the filename
- * will be non-NULL and will contain a pointer to an array of strings, one for
- * each file picked (the first file will be file_paths[0]). This buffer will
- * become invalid as soon as the call completes, so it is the plugin's
- * responsibility to copy the filename(sp if it needs future access to them.
- * A NULL file_paths in the callback means the user canceled the dialog box.
- *
- * The filename will be in UTF-8. It may not actually correspond to the actual
- * file on disk on a Linux system, because we'll do our best to convert it from
- * the filesystem's locale to UTF-8. Instead, the string will be appropriate for
- * displaying to the user which file they picked.
- * */
-typedef enum {
-  NPChooseFile_Open = 1,
-  NPChooseFile_OpenMultiple = 2,
-  NPChooseFile_Save = 3,
-} NPChooseFileMode;
-typedef void (*NPChooseFileCallback)(const char** filePaths,
-                                     uint32 pathCount,
-                                     void* userData);
-typedef NPError (*NPChooseFilePtr)(
-    NPP instance,
-    const char* mimeTypes,
-    NPChooseFileMode mode,
-    NPChooseFileCallback callback,
-    void* userData);
-
-/* Pepper extensions */
-struct NPNExtensions {
-  /* Device interface acquisition */
-  NPAcquireDevicePtr acquireDevice;
-  /* Clipboard functionality */
-  NPCopyTextToClipboardPtr copyTextToClipboard;
-  /* Find */
-  NPNumberOfFindResultsChangedPtr numberOfFindResultsChanged;
-  NPSelectedFindResultChangedPtr selectedFindResultChanged;
-  /* File I/O extensions */
-  NPChooseFilePtr chooseFile;
-};
-
-/* Events -------------------------------------------------------------------*/
-
-typedef enum {
-  NPMouseButton_None    = -1,
-  NPMouseButton_Left    = 0,
-  NPMouseButton_Middle  = 1,
-  NPMouseButton_Right   = 2
-} NPMouseButtons;
-
-typedef enum {
-  NPEventType_Undefined   = -1,
-  NPEventType_MouseDown   = 0,
-  NPEventType_MouseUp     = 1,
-  NPEventType_MouseMove   = 2,
-  NPEventType_MouseEnter  = 3,
-  NPEventType_MouseLeave  = 4,
-  NPEventType_MouseWheel  = 5,
-  NPEventType_RawKeyDown  = 6,
-  NPEventType_KeyDown     = 7,
-  NPEventType_KeyUp       = 8,
-  NPEventType_Char        = 9,
-  NPEventType_Minimize    = 10,
-  NPEventType_Focus       = 11,
-  NPEventType_Device      = 12
-} NPEventTypes;
-
-typedef enum {
-  NPEventModifier_ShiftKey         = 1 << 0,
-  NPEventModifier_ControlKey       = 1 << 1,
-  NPEventModifier_AltKey           = 1 << 2,
-  NPEventModifier_MetaKey          = 1 << 3,
-  NPEventModifier_IsKeyPad         = 1 << 4,
-  NPEventModifier_IsAutoRepeat     = 1 << 5,
-  NPEventModifier_LeftButtonDown   = 1 << 6,
-  NPEventModifier_MiddleButtonDown = 1 << 7,
-  NPEventModifier_RightButtonDown  = 1 << 8
-} NPEventModifiers;
-
-typedef struct _NPKeyEvent
-{
-  uint32 modifier;
-  uint32 normalizedKeyCode;
-} NPKeyEvent;
-
-typedef struct _NPCharacterEvent
-{
-  uint32 modifier;
-  uint16 text[4];
-  uint16 unmodifiedText[4];
-} NPCharacterEvent;
-
-typedef struct _NPMouseEvent
-{
-  uint32 modifier;
-  int32 button;
-  int32 x;
-  int32 y;
-  int32 clickCount;
-} NPMouseEvent;
-
-typedef struct _NPMouseWheelEvent
-{
-  uint32 modifier;
-  float deltaX;
-  float deltaY;
-  float wheelTicksX;
-  float wheelTicksY;
-  uint32 scrollByPage;
-} NPMouseWheelEvent;
-
-typedef struct _NPDeviceEvent {
-  uint32 device_uid;
-  uint32 subtype;
-  /* uint8 generic[0]; */
-} NPDeviceEvent;
-
-typedef struct _NPMinimizeEvent {
-  int32 value;
-} NPMinimizeEvent;
-
-typedef struct _NPFocusEvent {
-  int32 value;
-} NPFocusEvent;
-
-typedef struct _NPPepperEvent
-{
-  uint32 size;
-  int32 type;
-  double timeStampSeconds;
-  union {
-    NPKeyEvent key;
-    NPCharacterEvent character;
-    NPMouseEvent mouse;
-    NPMouseWheelEvent wheel;
-    NPMinimizeEvent minimize;
-    NPFocusEvent focus;
-    NPDeviceEvent device;
-  } u;
-} NPPepperEvent;
-
-/* 2D -----------------------------------------------------------------------*/
-
-#define NPPepper2DDevice 1
-
-typedef struct _NPDeviceContext2DConfig {
-} NPDeviceContext2DConfig;
-
-typedef struct _NPDeviceContext2D
-{
-  /* Internal value used by the browser to identify this device. */
-  void* reserved;
-
-  /* A pointer to the pixel data. This data is 8-bit values in BGRA order in
-   * memory. Each row will start |stride| bytes after the previous one.
-   *
-   * THIS DATA USES PREMULTIPLIED ALPHA. This means that each color channel has
-   * been multiplied with the corresponding alpha, which makes compositing
-   * easier. If any color channels have a value greater than the alpha value,
-   * you'll likely get crazy colors and weird artifacts. */
-  void* region;
-
-  /* Length of each row of pixels in bytes. This may be larger than width * 4
-   * if there is padding at the end of each row to help with alignment. */
-  int32 stride;
-
-  /* The dirty region that the plugin has painted into the buffer. This
-   * will be initialized to the size of the plugin image in
-   * initializeContextPtr. The plugin can change the values to only
-   * update portions of the image. */
-  struct {
-    int32 left;
-    int32 top;
-    int32 right;
-    int32 bottom;
-  } dirty;
-} NPDeviceContext2D;
-
-/* 3D -----------------------------------------------------------------------*/
-
-#define NPPepper3DDevice 2
-
-typedef struct _NPDeviceContext3DConfig {
-  int32 commandBufferSize;
-} NPDeviceContext3DConfig;
-
-typedef enum _NPDeviceContext3DError {
-  // No error has ocurred.
-  NPDeviceContext3DError_NoError,
-
-  // The size of a command was invalid.
-  NPDeviceContext3DError_InvalidSize,
-
-  // An offset was out of bounds.
-  NPDeviceContext3DError_OutOfBounds,
-
-  // A command was not recognized.
-  NPDeviceContext3DError_UnknownCommand,
-
-  // The arguments to a command were invalid.
-  NPDeviceContext3DError_InvalidArguments,
-
-  // The 3D context was lost, for example due to a power management event. The
-  // context must be destroyed and a new one created.
-  NPDeviceContext3DError_LostContext,
-
-  // Any other error.
-  NPDeviceContext3DError_GenericError
-} NPDeviceContext3DError;
-
-typedef struct _NPDeviceContext3D NPDeviceContext3D;
-
-typedef void (*NPDeviceContext3DRepaintPtr)(NPP npp,
-                                            NPDeviceContext3D* context);
-
-typedef struct _NPDeviceContext3D
-{
-  void* reserved;
-
-  // If true, then a flush will only complete once the get offset has advanced
-  // on the GPU thread. If false, then the get offset might have changed but
-  // the GPU thread will respond as quickly as possible without guaranteeing
-  // having made any progress in executing pending commands. Set to true
-  // to ensure that progress is made or when flushing in a loop waiting for the
-  // GPU to reach a certain state, for example in advancing beyond a particular
-  // token. Set to false when flushing to query the current state, for example
-  // whether an error has occurred.
-  bool waitForProgress;
-
-  // Buffer in which commands are stored.
-  void* commandBuffer;
-  int32 commandBufferSize;
-
-  // Offset in command buffer reader has reached. Synchronized on flush.
-  int32 getOffset;
-
-  // Offset in command buffer writer has reached. Synchronized on flush.
-  int32 putOffset;
-
-  // Last processed token. Synchronized on flush.
-  int32 token;
-
-  // Callback invoked on the main thread when the context must be repainted.
-  // TODO(apatrick): move this out of the context struct like the rest of the
-  // fields.
-  NPDeviceContext3DRepaintPtr repaintCallback;
-
-  // Error status. Synchronized on flush.
-  NPDeviceContext3DError error;
-} NPDeviceContext3D;
-
-/* Audio --------------------------------------------------------------------*/
-
-#define NPPepperAudioDevice 3
-
-/* min & max sample frame count */
-typedef enum {
-  NPAudioMinSampleFrameCount = 64,
-  NPAudioMaxSampleFrameCount = 32768
-} NPAudioSampleFrameCounts;
-
-/* supported sample rates */
-typedef enum {
-  NPAudioSampleRate44100Hz = 44100,
-  NPAudioSampleRate48000Hz = 48000,
-  NPAudioSampleRate96000Hz = 96000
-} NPAudioSampleRates;
-
-/* supported sample formats */
-typedef enum {
-  NPAudioSampleTypeInt16   = 0,
-  NPAudioSampleTypeFloat32 = 1
-} NPAudioSampleTypes;
-
-/* supported channel layouts */
-/* there is code that depends on these being the actual number of channels */
-typedef enum {
-  NPAudioChannelNone     = 0,
-  NPAudioChannelMono     = 1,
-  NPAudioChannelStereo   = 2,
-  NPAudioChannelThree    = 3,
-  NPAudioChannelFour     = 4,
-  NPAudioChannelFive     = 5,
-  NPAudioChannelFiveOne  = 6,
-  NPAudioChannelSeven    = 7,
-  NPAudioChannelSevenOne = 8
-} NPAudioChannels;
-
-/* audio context states */
-typedef enum {
-  NPAudioContextStateCallback = 0,
-  NPAudioContextStateUnderrunCounter = 1
-} NPAudioContextStates;
-
-/* audio context state values */
-typedef enum {
-  NPAudioCallbackStop = 0,
-  NPAudioCallbackStart = 1
-} NPAudioContextStateValues;
-
-/* audio query capabilities */
-typedef enum {
-  NPAudioCapabilitySampleRate              = 0,
-  NPAudioCapabilitySampleType              = 1,
-  NPAudioCapabilitySampleFrameCount        = 2,
-  NPAudioCapabilitySampleFrameCount44100Hz = 3,
-  NPAudioCapabilitySampleFrameCount48000Hz = 4,
-  NPAudioCapabilitySampleFrameCount96000Hz = 5,
-  NPAudioCapabilityOutputChannelMap        = 6,
-  NPAudioCapabilityInputChannelMap         = 7
-} NPAudioCapabilities;
-
-typedef struct _NPDeviceContextAudio NPDeviceContextAudio;
-
-/* user supplied callback function */
-typedef void (*NPAudioCallback)(NPDeviceContextAudio *context);
-
-typedef struct _NPDeviceContextAudioConfig {
-  int32 sampleRate;
-  int32 sampleType;
-  int32 outputChannelMap;
-  int32 inputChannelMap;
-  int32 sampleFrameCount;
-  uint32 startThread;
-  uint32 flags;
-  NPAudioCallback callback;
-  void *userData;
-} NPDeviceContextAudioConfig;
-
-struct _NPDeviceContextAudio {
-  NPDeviceContextAudioConfig config;
-  void *outBuffer;
-  void *inBuffer;
-  void *reserved;
-};
-
-/* Printing related APIs ---------------------------------------------------*/
-
-/* Being a print operation. Returns the total number of pages to print at the
- * given printableArea size and DPI. printableArea is in points (a point is 1/72
- * of an inch). The plugin is expected to remember the values of printableArea
- * and printerDPI for use in subsequent print interface calls. These values
- * should be cleared in printEnd. */
-typedef NPError (*NPPPrintBeginPtr) (
-    NPP instance,
-    NPRect* printableArea,
-    int32 printerDPI,
-    int32* numPages);
-/* Returns the required raster dimensions for the given page. */
-typedef NPError (*NPPGetRasterDimensionsPtr) (
-    NPP instance,
-    int32 pageNumber,
-    int32* widthInPixels,
-    int32* heightInPixels);
-/* Prints the specified page This allows the plugin to print a raster output. */
-typedef NPError (*NPPPrintPageRasterPtr) (
-    NPP instance,
-    int32 pageNumber,
-    NPDeviceContext2D* printSurface);
-/* Ends the print operation */
-typedef NPError (*NPPPrintEndPtr) (NPP instance);
-
-/* TODO(sanjeevr) : Provide a vector interface for printing. We need to decide
- * on a vector format that can support embedded fonts. A vector format will
- * greatly reduce the size of the required output buffer. */
-
-typedef struct _NPPPrintExtensions {
-  NPPPrintBeginPtr printBegin;
-  NPPGetRasterDimensionsPtr getRasterDimensions;
-  NPPPrintPageRasterPtr printPageRaster;
-  NPPPrintEndPtr printEnd;
-} NPPPrintExtensions;
-
-/* Returns NULL if the plugin does not support print extensions */
-typedef NPPPrintExtensions* (*NPPGetPrintExtensionsPtr)(NPP instance);
-
-/* Find ---------------------------------------------------------------------*/
-
-/* Finds the given UTF-8 text starting at the current selection.  The number of
- * results will be updated asynchronously via numberOfFindResultsChanged.  Note
- * that multiple StartFind calls can happen before StopFind is called in the
- * case of the search term changing. */
-typedef NPError (*NPPStartFindPtr) (
-    NPP instance,
-    const char* text,
-    bool caseSensitive);
-
-/* Go to the next/previous result. */
-typedef NPError (*NPPSelectFindResultPtr) (
-    NPP instance,
-    bool forward);
-
-/* Tells the plugin that the find operation has stopped, so it should clear
- * any highlighting. */
-typedef NPError (*NPPStopFindPtr) (
-    NPP instance);
-
-typedef struct _NPPFindExtensions {
-  NPPStartFindPtr startFind;
-  NPPSelectFindResultPtr selectFindResult;
-  NPPStopFindPtr stopFind;
-} NPPFindExtensions;
-
-/* Returns NULL if the plugin does not support find extensions. */
-typedef NPPFindExtensions* (*NPPGetFindExtensionsPtr)(NPP instance);
-
-/* Zooms plugins.  0 means reset, -1 means zoom out, and +1 means zoom in. */
-typedef NPError (*NPPZoomPtr) (
-    NPP instance,
-    int factor);
-
-typedef struct _NPPExtensions {
-  NPPGetPrintExtensionsPtr getPrintExtensions;
-  NPPGetFindExtensionsPtr getFindExtensions;
-  NPPZoomPtr zoom;
-} NPPExtensions;
-
-#endif  /* _NP_EXTENSIONS_H_ */
diff --git a/third_party/chrome/third_party/npapi/bindings/npapi_extensions_private.h b/third_party/chrome/third_party/npapi/bindings/npapi_extensions_private.h
deleted file mode 100644
index 3b0a458..0000000
--- a/third_party/chrome/third_party/npapi/bindings/npapi_extensions_private.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (c) 2006-2010 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 _NP_EXTENSIONS_PRIVATE_H_
-#define _NP_EXTENSIONS_PRIVATE_H_
-
-#include "third_party/npapi/bindings/npapi.h"
-
-// Some reserved GetStateContext/SetStateContext selectors.
-typedef enum {
-  NPExtensionsReservedStateSharedMemory = 66536,
-  // Used by the Device2D and Audio devices to return a pointer to the
-  // structure used to implement the shared memory buffer for the device.
-  NPExtensionsReservedStateSharedMemorySize = 66537,
-  // Used by the Audio device to return a pointer to the
-  // structure used to implement the shared memory buffer for the device.
-  NPExtensionsReservedStateSyncChannel = 66538,
-  // Used by the Audio device to return a pointer to the
-  // structure used to implement the synchronization channel for the device.
-  NPExtensionsReservedStateSharedMemoryChecksum = 66539
-  // Used by the Device2D to return the CRC32 checksum of the content
-  // stored in the shared memory buffer for the device.
-} NPExtensionsReservedStates;
-
-#endif  /* _NP_EXTENSIONS_PRIVATE_H_ */
diff --git a/third_party/chrome/third_party/npapi/bindings/npapi_x11.h b/third_party/chrome/third_party/npapi/bindings/npapi_x11.h
deleted file mode 100644
index c586419..0000000
--- a/third_party/chrome/third_party/npapi/bindings/npapi_x11.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef THIRD_PARTY_NPAPI_BINDINGS_NPAPI_X11_H_
-#define THIRD_PARTY_NPAPI_BINDINGS_NPAPI_X11_H_
-
-// This file was split off the original npapi.h, to avoid including intrusive X
-// headers unless necessary.
-
-#include "third_party/npapi/bindings/npapi.h"
-
-#ifdef XP_UNIX
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-typedef struct _NPSetWindowCallbackStruct
-{
-  int32        type;
-#ifdef MOZ_X11
-  Display*     display;
-  Visual*      visual;
-  Colormap     colormap;
-  unsigned int depth;
-#endif
-} NPSetWindowCallbackStruct;
-#endif
-
-#endif  // THIRD_PARTY_NPAPI_BINDINGS_NPAPI_X11_H_
diff --git a/third_party/chrome/third_party/npapi/bindings/nphostapi.h b/third_party/chrome/third_party/npapi/bindings/nphostapi.h
deleted file mode 100644
index 69bad70..0000000
--- a/third_party/chrome/third_party/npapi/bindings/nphostapi.h
+++ /dev/null
@@ -1,325 +0,0 @@
-// Copyright (c) 2010 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.
-
-// TODO:  Did not implement JRIGlobalRef function yet.  Not sure if this is used?
-
-#ifndef _NPHOSTAPI_H_
-#define _NPHOSTAPI_H_
-
-#include "base/port.h"
-#include "third_party/npapi/bindings/npapi.h"
-#include "third_party/npapi/bindings/npapi_extensions.h"
-#include "third_party/npapi/bindings/npruntime.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-//
-// NPAPI NPP Function Pointers
-//
-typedef NPError      (*NPP_NewProcPtr)(NPMIMEType pluginType,
-                         NPP instance,
-                         uint16 mode,
-                         int16 argc,
-                         char* argn[],
-                         char* argv[],
-                         NPSavedData* saved);
-typedef NPError      (*NPP_DestroyProcPtr)(NPP instance,
-                         NPSavedData** save);
-typedef NPError      (*NPP_SetWindowProcPtr)(NPP instance,
-                         NPWindow* window);
-typedef NPError      (*NPP_NewStreamProcPtr)(NPP instance,
-                         NPMIMEType type,
-                         NPStream* stream,
-                         NPBool seekable,
-                         uint16* stype);
-typedef NPError      (*NPP_DestroyStreamProcPtr)(NPP instance,
-                         NPStream* stream,
-                         NPReason reason);
-typedef int32        (*NPP_WriteReadyProcPtr)(NPP instance,
-                         NPStream* stream);
-typedef int32        (*NPP_WriteProcPtr)(NPP instance,
-                         NPStream* stream,
-                         int32 offset,
-                         int32 len,
-                         void* buffer);
-typedef void         (*NPP_StreamAsFileProcPtr)(NPP instance,
-                         NPStream* stream,
-                         const char* fname);
-typedef void         (*NPP_PrintProcPtr)(NPP instance,
-                         NPPrint* platformPrint);
-typedef int16        (*NPP_HandleEventProcPtr)(NPP instance,
-                         void* event);
-typedef void         (*NPP_URLNotifyProcPtr)(NPP instance,
-                         const char* url,
-                         NPReason reason,
-                         void* notifyData);
-typedef void* JRIGlobalRef; //not using this right now
-typedef NPError      (*NPP_GetValueProcPtr)(NPP instance,
-                         NPPVariable variable,
-                         void *ret_alue);
-typedef NPError      (*NPP_SetValueProcPtr)(NPP instance,
-                         NPNVariable variable,
-                         void *ret_alue);
-
-//
-// NPAPI NPN Function Pointers
-//
-typedef NPError      (*NPN_GetURLProcPtr)(NPP instance,
-                         const char* URL,
-                         const char* window);
-typedef NPError      (*NPN_PostURLProcPtr)(NPP instance,
-                         const char* URL,
-                         const char* window,
-                         uint32 len,
-                         const char* buf,
-                         NPBool file);
-typedef NPError      (*NPN_RequestReadProcPtr)(NPStream* stream,
-                         NPByteRange* rangeList);
-typedef NPError      (*NPN_NewStreamProcPtr)(NPP instance,
-                         NPMIMEType type,
-                         const char* window,
-                         NPStream** stream);
-typedef int32        (*NPN_WriteProcPtr)(NPP instance,
-                         NPStream* stream,
-                         int32 len,
-                         void* buffer);
-typedef NPError      (*NPN_DestroyStreamProcPtr)(NPP instance,
-                         NPStream* stream,
-                         NPReason reason);
-typedef void         (*NPN_StatusProcPtr)(NPP instance,
-                         const char* message);
-typedef const char*  (*NPN_UserAgentProcPtr)(NPP instance);
-typedef void*        (*NPN_MemAllocProcPtr)(uint32 size);
-typedef void         (*NPN_MemFreeProcPtr)(void* ptr);
-typedef uint32       (*NPN_MemFlushProcPtr)(uint32 size);
-typedef void         (*NPN_ReloadPluginsProcPtr)(NPBool reloadPages);
-
-typedef void*        (*NPN_GetJavaEnvProcPtr)(void);
-typedef void*        (*NPN_GetJavaPeerProcPtr)(NPP instance);
-
-typedef NPError      (*NPN_GetURLNotifyProcPtr)(NPP instance,
-                         const char* URL,
-                         const char* window,
-                         void* notifyData);
-typedef NPError      (*NPN_PostURLNotifyProcPtr)(NPP instance,
-                         const char* URL,
-                         const char* window,
-                         uint32 len,
-                         const char* buf,
-                         NPBool file,
-                         void* notifyData);
-typedef NPError      (*NPN_GetValueProcPtr)(NPP instance,
-                         NPNVariable variable,
-                         void *ret_value);
-typedef NPError      (*NPN_SetValueProcPtr)(NPP instance,
-                         NPPVariable variable,
-                         void *value);
-typedef void         (*NPN_InvalidateRectProcPtr)(NPP instance,
-                         NPRect *rect);
-typedef void         (*NPN_InvalidateRegionProcPtr)(NPP instance,
-                         NPRegion region);
-typedef void         (*NPN_ForceRedrawProcPtr)(NPP instance);
-
-typedef void         (*NPN_ReleaseVariantValueProcPtr) (NPVariant *variant);
-
-typedef NPIdentifier (*NPN_GetStringIdentifierProcPtr) (const NPUTF8 *name);
-typedef void         (*NPN_GetStringIdentifiersProcPtr) (const NPUTF8 **names,
-                         int32_t nameCount,
-                         NPIdentifier *identifiers);
-typedef NPIdentifier (*NPN_GetIntIdentifierProcPtr) (int32_t intid);
-typedef int32_t      (*NPN_IntFromIdentifierProcPtr) (NPIdentifier identifier);
-typedef bool         (*NPN_IdentifierIsStringProcPtr) (NPIdentifier identifier);
-typedef NPUTF8 *     (*NPN_UTF8FromIdentifierProcPtr) (NPIdentifier identifier);
-
-typedef NPObject*    (*NPN_CreateObjectProcPtr) (NPP,
-                         NPClass *aClass);
-typedef NPObject*    (*NPN_RetainObjectProcPtr) (NPObject *obj);
-typedef void         (*NPN_ReleaseObjectProcPtr) (NPObject *obj);
-typedef bool         (*NPN_InvokeProcPtr) (NPP npp,
-                         NPObject *obj,
-                         NPIdentifier methodName,
-                         const NPVariant *args,
-                         unsigned argCount,
-                         NPVariant *result);
-typedef bool         (*NPN_InvokeDefaultProcPtr) (NPP npp,
-                         NPObject *obj,
-                         const NPVariant *args,
-                         unsigned argCount,
-                         NPVariant *result);
-typedef bool         (*NPN_EvaluateProcPtr) (NPP npp,
-                         NPObject *obj,
-                         NPString *script,
-                         NPVariant *result);
-typedef bool         (*NPN_GetPropertyProcPtr) (NPP npp,
-                         NPObject *obj,
-                         NPIdentifier propertyName,
-                         NPVariant *result);
-typedef bool         (*NPN_SetPropertyProcPtr) (NPP npp,
-                         NPObject *obj,
-                         NPIdentifier propertyName,
-                         const NPVariant *value);
-typedef bool         (*NPN_HasPropertyProcPtr) (NPP,
-                         NPObject *npobj,
-                         NPIdentifier propertyName);
-typedef bool         (*NPN_HasMethodProcPtr) (NPP npp,
-                         NPObject *npobj,
-                         NPIdentifier methodName);
-typedef bool         (*NPN_RemovePropertyProcPtr) (NPP npp,
-                         NPObject *obj,
-                         NPIdentifier propertyName);
-typedef void         (*NPN_SetExceptionProcPtr) (NPObject *obj,
-                         const NPUTF8 *message);
-typedef void         (*NPN_PushPopupsEnabledStateProcPtr)(NPP npp,
-                         NPBool enabled);
-typedef void         (*NPN_PopPopupsEnabledStateProcPtr)(NPP npp);
-typedef bool         (*NPN_EnumerateProcPtr)(NPP npp,
-                         NPObject *obj,
-                         NPIdentifier **identifier,
-                         uint32_t *count);
-typedef void         (*NPN_PluginThreadAsyncCallProcPtr)(NPP instance,
-                         void (*func)(void *),
-                         void *userData);
-typedef bool         (*NPN_ConstructProcPtr)(NPP npp,
-                         NPObject* obj,
-                         const NPVariant *args,
-                         uint32_t argCount,
-                         NPVariant *result);
-typedef NPError      (*NPN_GetValueForURLPtr)(NPP npp,
-                         NPNURLVariable variable,
-                         const char *url,
-                         char **value,
-                         uint32_t *len);
-typedef NPError      (*NPN_SetValueForURLPtr)(NPP npp,
-                         NPNURLVariable variable,
-                         const char *url,
-                         const char *value,
-                         uint32_t len);
-typedef NPError      (*NPN_GetAuthenticationInfoPtr)(NPP npp,
-                         const char *protocol,
-                         const char *host,
-                         int32_t port,
-                         const char *scheme,
-                         const char *realm,
-                         char **username,
-                         uint32_t *ulen,
-                         char **password,
-                         uint32_t *plen);
-typedef uint32       (*NPN_ScheduleTimerPtr)(NPP npp,
-                         uint32 interval,
-                         NPBool repeat,
-                         void (*timerFunc)(NPP npp, uint32 timerID));
-typedef void         (*NPN_UnscheduleTimerPtr)(NPP npp,
-                         uint32 timerID);
-typedef NPError      (*NPN_PopUpContextMenuPtr)(NPP npp,
-                         NPMenu* menu);
-typedef NPBool       (*NPN_ConvertPointPtr)(NPP npp,
-                         double sourceX,
-                         double sourceY,
-                         NPCoordinateSpace sourceSpace,
-                         double *destX,
-                         double *destY,
-                         NPCoordinateSpace destSpace);
-
-//
-// NPAPI Function table of NPP functions (functions provided by plugin to host)
-//
-typedef struct _NPPluginFuncs {
-    unsigned short size;
-    unsigned short version;
-    NPP_NewProcPtr newp;
-    NPP_DestroyProcPtr destroy;
-    NPP_SetWindowProcPtr setwindow;
-    NPP_NewStreamProcPtr newstream;
-    NPP_DestroyStreamProcPtr destroystream;
-    NPP_StreamAsFileProcPtr asfile;
-    NPP_WriteReadyProcPtr writeready;
-    NPP_WriteProcPtr write;
-    NPP_PrintProcPtr print;
-    NPP_HandleEventProcPtr event;
-    NPP_URLNotifyProcPtr urlnotify;
-    JRIGlobalRef javaClass;
-    NPP_GetValueProcPtr getvalue;
-    NPP_SetValueProcPtr setvalue;
-} NPPluginFuncs;
-
-//
-// NPAPI Function table NPN functions (functions provided by host to plugin)
-//
-typedef struct _NPNetscapeFuncs {
-    uint16 size;
-    uint16 version;
-    NPN_GetURLProcPtr geturl;
-    NPN_PostURLProcPtr posturl;
-    NPN_RequestReadProcPtr requestread;
-    NPN_NewStreamProcPtr newstream;
-    NPN_WriteProcPtr write;
-    NPN_DestroyStreamProcPtr destroystream;
-    NPN_StatusProcPtr status;
-    NPN_UserAgentProcPtr uagent;
-    NPN_MemAllocProcPtr memalloc;
-    NPN_MemFreeProcPtr memfree;
-    NPN_MemFlushProcPtr memflush;
-    NPN_ReloadPluginsProcPtr reloadplugins;
-    NPN_GetJavaEnvProcPtr getJavaEnv;
-    NPN_GetJavaPeerProcPtr getJavaPeer;
-    NPN_GetURLNotifyProcPtr geturlnotify;
-    NPN_PostURLNotifyProcPtr posturlnotify;
-    NPN_GetValueProcPtr getvalue;
-    NPN_SetValueProcPtr setvalue;
-    NPN_InvalidateRectProcPtr invalidaterect;
-    NPN_InvalidateRegionProcPtr invalidateregion;
-    NPN_ForceRedrawProcPtr forceredraw;
-
-    NPN_GetStringIdentifierProcPtr getstringidentifier;
-    NPN_GetStringIdentifiersProcPtr getstringidentifiers;
-    NPN_GetIntIdentifierProcPtr getintidentifier;
-    NPN_IdentifierIsStringProcPtr identifierisstring;
-    NPN_UTF8FromIdentifierProcPtr utf8fromidentifier;
-    NPN_IntFromIdentifierProcPtr intfromidentifier;
-    NPN_CreateObjectProcPtr createobject;
-    NPN_RetainObjectProcPtr retainobject;
-    NPN_ReleaseObjectProcPtr releaseobject;
-    NPN_InvokeProcPtr invoke;
-    NPN_InvokeDefaultProcPtr invokeDefault;
-    NPN_EvaluateProcPtr evaluate;
-    NPN_GetPropertyProcPtr getproperty;
-    NPN_SetPropertyProcPtr setproperty;
-    NPN_RemovePropertyProcPtr removeproperty;
-    NPN_HasPropertyProcPtr hasproperty;
-    NPN_HasMethodProcPtr hasmethod;
-    NPN_ReleaseVariantValueProcPtr releasevariantvalue;
-    NPN_SetExceptionProcPtr setexception;
-    NPN_PushPopupsEnabledStateProcPtr pushpopupsenabledstate;
-    NPN_PopPopupsEnabledStateProcPtr poppopupsenabledstate;
-    NPN_EnumerateProcPtr enumerate;
-    NPN_PluginThreadAsyncCallProcPtr pluginthreadasynccall;
-    NPN_ConstructProcPtr construct;
-    NPN_GetValueForURLPtr getvalueforurl;
-    NPN_SetValueForURLPtr setvalueforurl;
-    NPN_GetAuthenticationInfoPtr getauthenticationinfo;
-    NPN_ScheduleTimerPtr scheduletimer;
-    NPN_UnscheduleTimerPtr unscheduletimer;
-    NPN_PopUpContextMenuPtr popupcontextmenu;
-    NPN_ConvertPointPtr convertpoint;
-} NPNetscapeFuncs;
-
-//
-// NPAPI library entry points
-//
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
-typedef NPError (API_CALL * NP_InitializeFunc)(NPNetscapeFuncs* pNFuncs,
-                                               NPPluginFuncs* pPFuncs);
-#else
-typedef NPError (API_CALL * NP_InitializeFunc)(NPNetscapeFuncs* pFuncs);
-typedef NPError (API_CALL * NP_GetEntryPointsFunc)(NPPluginFuncs* pFuncs);
-#endif
-typedef NPError (API_CALL * NP_ShutdownFunc)(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // _NPHOSTAPI_H_
diff --git a/third_party/chrome/third_party/npapi/bindings/npruntime.h b/third_party/chrome/third_party/npapi/bindings/npruntime.h
deleted file mode 100644
index e050b21..0000000
--- a/third_party/chrome/third_party/npapi/bindings/npruntime.h
+++ /dev/null
@@ -1,396 +0,0 @@
-/*
- * Copyright (C) 2004, Apple Computer, Inc. and The Mozilla Foundation. 
- * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the names of Apple Computer, Inc. ("Apple") or The Mozilla
- * Foundation ("Mozilla") nor the names of their contributors may be used
- * to endorse or promote products derived from this software without
- * specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY APPLE, MOZILLA AND THEIR CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE, MOZILLA OR
- * THEIR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Revision 1 (March 4, 2004):
- * Initial proposal.
- *
- * Revision 2 (March 10, 2004):
- * All calls into script were made asynchronous.  Results are
- * provided via the NPScriptResultFunctionPtr callback.
- *
- * Revision 3 (March 10, 2004):
- * Corrected comments to not refer to class retain/release FunctionPtrs.
- *
- * Revision 4 (March 11, 2004):
- * Added additional convenience NPN_SetExceptionWithUTF8().
- * Changed NPHasPropertyFunctionPtr and NPHasMethodFunctionPtr to take NPClass
- * pointers instead of NPObject pointers.
- * Added NPIsValidIdentifier().
- *
- * Revision 5 (March 17, 2004):
- * Added context parameter to result callbacks from ScriptObject functions.
- *
- * Revision 6 (March 29, 2004):
- * Renamed functions implemented by user agent to NPN_*.  Removed _ from
- * type names.
- * Renamed "JavaScript" types to "Script".
- *
- * Revision 7 (April 21, 2004):
- * NPIdentifier becomes a void*, was int32_t
- * Remove NP_IsValidIdentifier, renamed NP_IdentifierFromUTF8 to NP_GetIdentifier
- * Added NPVariant and modified functions to use this new type.
- *
- * Revision 8 (July 9, 2004):
- * Updated to joint Apple-Mozilla license.
- *
- * Revision 9 (August 12, 2004):
- * Changed NPVariantType enum values to form PVariantType_XXX
- * Added NPP arguments to NPObject functions.
- * Replaced NPVariant functions with macros.
- */
-#ifndef _NP_RUNTIME_H_
-#define _NP_RUNTIME_H_
-
-
-// BEGIN GOOGLE MODIFICATIONS
-#include "npapi.h"
-#ifndef __native_client__
-typedef uint8 uint8_t;
-typedef int8 int8_t;
-typedef uint16 uint16_t;
-typedef int16 int16_t;
-typedef uint32 uint32_t;
-typedef int32 int32_t;
-typedef int64 int64_t;
-typedef uint64 uint64_t;
-#endif  /* __native_client__ */
-// END GOOGLE MODIFICATIONS
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-    This API is used to facilitate binding code written in C to script
-    objects.  The API in this header does not assume the presence of a
-    user agent.  That is, it can be used to bind C code to scripting
-    environments outside of the context of a user agent.
-    
-    However, the normal use of the this API is in the context of a
-    scripting environment running in a browser or other user agent.
-    In particular it is used to support the extended Netscape
-    script-ability API for plugins (NP-SAP).  NP-SAP is an extension
-    of the Netscape plugin API.  As such we have adopted the use of
-    the "NP" prefix for this API.
-
-    The following NP{N|P}Variables were added to the Netscape plugin
-    API (in npapi.h):
-
-    NPNVWindowNPObject
-    NPNVPluginElementNPObject
-    NPPVpluginScriptableNPObject
-
-    These variables are exposed through NPN_GetValue() and
-    NPP_GetValue() (respectively) and are used to establish the
-    initial binding between the user agent and native code.  The DOM
-    objects in the user agent can be examined and manipulated using
-    the NPN_ functions that operate on NPObjects described in this
-    header.
-
-    To the extent possible the assumptions about the scripting
-    language used by the scripting environment have been minimized.
-*/
-
-
-/*
-    Objects (non-primitive data) passed between 'C' and script is
-    always wrapped in an NPObject.  The 'interface' of an NPObject is
-    described by an NPClass.
-*/
-typedef struct NPObject NPObject;
-typedef struct NPClass NPClass;
-
-typedef char NPUTF8;
-typedef struct _NPString {
-    const NPUTF8 *UTF8Characters;
-    uint32_t UTF8Length;
-} NPString;
-  
-typedef enum {
-    NPVariantType_Void,
-    NPVariantType_Null,
-    NPVariantType_Bool,
-    NPVariantType_Int32,
-    NPVariantType_Double,
-    NPVariantType_String,
-    NPVariantType_Object
-} NPVariantType;
-
-typedef struct _NPVariant {
-    NPVariantType type;
-    union {
-        bool boolValue;
-        int32_t intValue;
-        double doubleValue;
-        NPString stringValue;
-        NPObject *objectValue;
-    } value;
-} NPVariant;
-
-/*
-    NPN_ReleaseVariantValue is called on all 'out' parameters references.
-    Specifically it is called on variants that are resultant out parameters
-    in NPGetPropertyFunctionPtr and NPInvokeFunctionPtr.  Resultant variants
-    from these two functions should be initialized using the
-    NPN_InitializeVariantXXX() functions.
-    
-    After calling NPReleaseVariantValue, the type of the variant will
-    be set to NPVariantUndefinedType.
-*/
-void NPN_ReleaseVariantValue (NPVariant *variant);
-
-#define NPVARIANT_IS_VOID(_v)    ((_v).type == NPVariantType_Void)
-#define NPVARIANT_IS_NULL(_v)    ((_v).type == NPVariantType_Null)
-#define NPVARIANT_IS_BOOLEAN(_v) ((_v).type == NPVariantType_Bool)
-#define NPVARIANT_IS_INT32(_v)   ((_v).type == NPVariantType_Int32)
-#define NPVARIANT_IS_DOUBLE(_v)  ((_v).type == NPVariantType_Double)
-#define NPVARIANT_IS_STRING(_v)  ((_v).type == NPVariantType_String)
-#define NPVARIANT_IS_OBJECT(_v)  ((_v).type == NPVariantType_Object)
-
-#define NPVARIANT_TO_BOOLEAN(_v) ((_v).value.boolValue)
-#define NPVARIANT_TO_INT32(_v)   ((_v).value.intValue)
-#define NPVARIANT_TO_DOUBLE(_v)  ((_v).value.doubleValue)
-#define NPVARIANT_TO_STRING(_v)  ((_v).value.stringValue)
-#define NPVARIANT_TO_OBJECT(_v)  ((_v).value.objectValue)
-
-#define NP_BEGIN_MACRO  do {
-#define NP_END_MACRO    } while (0)
-
-#define VOID_TO_NPVARIANT(_v)                NP_BEGIN_MACRO (_v).type = NPVariantType_Void; (_v).value.objectValue = NULL; NP_END_MACRO
-#define NULL_TO_NPVARIANT(_v)                NP_BEGIN_MACRO (_v).type = NPVariantType_Null; (_v).value.objectValue = NULL; NP_END_MACRO
-#define BOOLEAN_TO_NPVARIANT(_val, _v)       NP_BEGIN_MACRO (_v).type = NPVariantType_Bool; (_v).value.boolValue = !!(_val); NP_END_MACRO
-#define INT32_TO_NPVARIANT(_val, _v)         NP_BEGIN_MACRO (_v).type = NPVariantType_Int32; (_v).value.intValue = _val; NP_END_MACRO
-#define DOUBLE_TO_NPVARIANT(_val, _v)        NP_BEGIN_MACRO (_v).type = NPVariantType_Double; (_v).value.doubleValue = _val; NP_END_MACRO
-#define STRINGZ_TO_NPVARIANT(_val, _v)       NP_BEGIN_MACRO (_v).type = NPVariantType_String; NPString str = { _val, strlen(_val) }; (_v).value.stringValue = str; NP_END_MACRO
-#define STRINGN_TO_NPVARIANT(_val, _len, _v) NP_BEGIN_MACRO (_v).type = NPVariantType_String; NPString str = { _val, _len }; (_v).value.stringValue = str; NP_END_MACRO
-#define OBJECT_TO_NPVARIANT(_val, _v)        NP_BEGIN_MACRO (_v).type = NPVariantType_Object; (_v).value.objectValue = _val; NP_END_MACRO
-
-/*
-        Type mappings (JavaScript types have been used for illustration
-    purposes):
-
-        JavaScript       to             C (NPVariant with type:)
-        undefined                       NPVariantType_Void
-        null                            NPVariantType_Null
-        Boolean                         NPVariantType_Bool
-        Number                          NPVariantType_Double or NPVariantType_Int32
-        String                          NPVariantType_String
-        Object                          NPVariantType_Object
-
-        C (NPVariant with type:)   to   JavaScript
-        NPVariantType_Void              undefined
-        NPVariantType_Null              null
-        NPVariantType_Bool              Boolean 
-        NPVariantType_Int32             Number
-        NPVariantType_Double            Number
-        NPVariantType_String            String
-        NPVariantType_Object            Object
-*/
-
-typedef void *NPIdentifier;
-
-/*
-    NPObjects have methods and properties.  Methods and properties are
-    identified with NPIdentifiers.  These identifiers may be reflected
-    in script.  NPIdentifiers can be either strings or integers, IOW,
-    methods and properties can be identified by either strings or
-    integers (i.e. foo["bar"] vs foo[1]). NPIdentifiers can be
-    compared using ==.  In case of any errors, the requested
-    NPIdentifier(s) will be NULL.
-*/
-NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name);
-void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, NPIdentifier *identifiers);
-NPIdentifier NPN_GetIntIdentifier(int32_t intid);
-bool NPN_IdentifierIsString(NPIdentifier identifier);
-
-/*
-    The NPUTF8 returned from NPN_UTF8FromIdentifier SHOULD be freed.
-*/
-NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier);
-
-/*
-    Get the integer represented by identifier. If identifier is not an
-    integer identifier, the behaviour is undefined.
-*/
-int32_t NPN_IntFromIdentifier(NPIdentifier identifier);
-
-/*
-    NPObject behavior is implemented using the following set of
-    callback functions.
-
-    The NPVariant *result argument of these functions (where
-    applicable) should be released using NPN_ReleaseVariantValue().
-*/
-typedef NPObject *(*NPAllocateFunctionPtr)(NPP npp, NPClass *aClass);
-typedef void (*NPDeallocateFunctionPtr)(NPObject *obj);
-typedef void (*NPInvalidateFunctionPtr)(NPObject *obj);
-typedef bool (*NPHasMethodFunctionPtr)(NPObject *obj, NPIdentifier name);
-typedef bool (*NPInvokeFunctionPtr)(NPObject *obj, NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result);
-typedef bool (*NPInvokeDefaultFunctionPtr)(NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result);
-typedef bool (*NPHasPropertyFunctionPtr)(NPObject *obj, NPIdentifier name);
-typedef bool (*NPGetPropertyFunctionPtr)(NPObject *obj, NPIdentifier name, NPVariant *result);
-typedef bool (*NPSetPropertyFunctionPtr)(NPObject *obj, NPIdentifier name, const NPVariant *value);
-typedef bool (*NPRemovePropertyFunctionPtr)(NPObject *npobj, NPIdentifier name);
-typedef bool (*NPEnumerationFunctionPtr)(NPObject *npobj, NPIdentifier **value, uint32_t *count);
-typedef bool (*NPConstructFunctionPtr)(NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result);
-
-/*
-    NPObjects returned by create have a reference count of one.  It is the caller's responsibility
-    to release the returned object.
-
-    NPInvokeFunctionPtr function may return false to indicate a the method could not be invoked.
-    
-    NPGetPropertyFunctionPtr and NPSetPropertyFunctionPtr may return false to indicate a property doesn't
-    exist.
-    
-    NPInvalidateFunctionPtr is called by the scripting environment when the native code is
-    shutdown.  Any attempt to message a NPObject instance after the invalidate
-    callback has been called will result in undefined behavior, even if the
-    native code is still retaining those NPObject instances.
-    (The runtime will typically return immediately, with 0 or NULL, from an attempt to
-    dispatch to a NPObject, but this behavior should not be depended upon.)
-    
-    The NPEnumerationFunctionPtr function may pass an array of                  
-    NPIdentifiers back to the caller. The callee allocs the memory of           
-    the array using NPN_MemAlloc(), and it's the caller's responsibility        
-    to release it using NPN_MemFree().           
-*/
-struct NPClass
-{
-    uint32_t structVersion;
-    NPAllocateFunctionPtr allocate;
-    NPDeallocateFunctionPtr deallocate;
-    NPInvalidateFunctionPtr invalidate;
-    NPHasMethodFunctionPtr hasMethod;
-    NPInvokeFunctionPtr invoke;
-    NPInvokeDefaultFunctionPtr invokeDefault;
-    NPHasPropertyFunctionPtr hasProperty;
-    NPGetPropertyFunctionPtr getProperty;
-    NPSetPropertyFunctionPtr setProperty;
-    NPRemovePropertyFunctionPtr removeProperty;
-    NPEnumerationFunctionPtr enumerate;
-    NPConstructFunctionPtr construct;
-};
-
-#define NP_CLASS_STRUCT_VERSION      3
-#define NP_CLASS_STRUCT_VERSION_ENUM 2
-#define NP_CLASS_STRUCT_VERSION_CTOR 3
-
-#define NP_CLASS_STRUCT_VERSION_HAS_ENUM(npclass)   \
-    ((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_ENUM)
-#define NP_CLASS_STRUCT_VERSION_HAS_CTOR(npclass)   \
-    ((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_CTOR)
-
-struct NPObject {
-    NPClass *_class;
-    uint32_t referenceCount;
-    // Additional space may be allocated here by types of NPObjects
-};
-
-/*
-    If the class has an allocate function, NPN_CreateObject invokes that function,
-    otherwise a NPObject is allocated and returned.  If a class has an allocate
-    function it is the responsibility of that implementation to set the initial retain
-    count to 1.
-*/
-NPObject *NPN_CreateObject(NPP npp, NPClass *aClass);
-
-/*
-    Increment the NPObject's reference count.
-*/
-NPObject *NPN_RetainObject (NPObject *obj);
-
-/*
-    Decremented the NPObject's reference count.  If the reference
-    count goes to zero, the class's destroy function is invoke if
-    specified, otherwise the object is freed directly.
-*/
-void NPN_ReleaseObject (NPObject *obj);
-
-/*
-    Functions to access script objects represented by NPObject.
-
-    Calls to script objects are synchronous.  If a function returns a
-    value, it will be supplied via the result NPVariant
-    argument. Successful calls will return true, false will be
-    returned in case of an error.
-    
-    Calls made from plugin code to script must be made from the thread
-    on which the plugin was initialized.
-*/
-bool NPN_Invoke(NPP npp, NPObject *npobj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result);
-bool NPN_InvokeDefault(NPP npp, NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result);
-bool NPN_Evaluate(NPP npp, NPObject *npobj, NPString *script, NPVariant *result);
-bool NPN_GetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName, NPVariant *result);
-bool NPN_SetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName, const NPVariant *value);
-bool NPN_RemoveProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName);
-bool NPN_HasProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName);
-bool NPN_HasMethod(NPP npp, NPObject *npobj, NPIdentifier methodName);
-bool NPN_Enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier, uint32_t *count);
-bool NPN_Construct(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
-
-// Helper function for evaluating a script in the scope of the NPObject passed in.
-// Parameters
-// npp
-//  The plugin's opaque instance handle (Can be NULL)
-// popups_allowed
-//  Indicates if popups created in the context of the script being executed are
-//  blocked or not.
-// npobj
-//  The NPObject.
-// npscript
-//  The script being executed.
-// result
-//  On return contains the value returned by the script.
-// Returns true on success.
-bool NPN_EvaluateHelper(NPP npp, bool popups_allowed, NPObject* npobj, 
-                        NPString* npscript, NPVariant *result);
-
-// BEGIN GOOGLE MODIFICATIONS
-
-void* NPP_GetJavaClass(void);
-void* NPN_GetJavaEnv(void);
-void* NPN_GetJavaPeer(NPP instance);
-void NPN_PluginThreadAsyncCall(NPP id, void (*func)(void *), void *userData);
-
-// END GOOGLE MODIFICATIONS
-
-/*
-    NPN_SetException may be called to trigger a script exception upon return
-    from entry points into NPObjects.
-*/
-void NPN_SetException (NPObject *obj, const NPUTF8 *message);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/third_party/gmock/CHANGES b/third_party/gmock/CHANGES
deleted file mode 100644
index f703ac2..0000000
--- a/third_party/gmock/CHANGES
+++ /dev/null
@@ -1,39 +0,0 @@
-Changes for 1.4.0 (we skipped 1.2.* and 1.3.* to match the version of
-Google Test):
-
- * Works in more environments: Symbian and minGW, Visual C++ 7.1.
- * Lighter weight: comes with our own implementation of TR1 tuple (no
-   more dependency on Boost!).
- * New feature: --gmock_catch_leaked_mocks for detecting leaked mocks.
- * New feature: ACTION_TEMPLATE for defining templatized actions.
- * New feature: the .After() clause for specifying expectation order.
- * New feature: the .With() clause for for specifying inter-argument
-   constraints.
- * New feature: actions ReturnArg<k>(), ReturnNew<T>(...), and
-   DeleteArg<k>().
- * New feature: matchers Key(), Pair(), Args<...>(), AllArgs(), IsNull(),
-   and Contains().
- * New feature: utility class MockFunction<F>, useful for checkpoints, etc.
- * New feature: functions Value(x, m) and SafeMatcherCast<T>(m).
- * New feature: copying a mock object is rejected at compile time.
- * New feature: a script for fusing all Google Mock and Google Test
-   source files for easy deployment.
- * Improved the Google Mock doctor to diagnose more diseases.
- * Improved the Google Mock generator script.
- * Compatibility fixes for Mac OS X and gcc.
- * Bug fixes and implementation clean-ups.
-
-Changes for 1.1.0:
-
- * New feature: ability to use Google Mock with any testing framework.
- * New feature: macros for easily defining new matchers
- * New feature: macros for easily defining new actions.
- * New feature: more container matchers.
- * New feature: actions for accessing function arguments and throwing
-   exceptions.
- * Improved the Google Mock doctor script for diagnosing compiler errors.
- * Bug fixes and implementation clean-ups.
-
-Changes for 1.0.0:
-
- * Initial Open Source release of Google Mock
diff --git a/third_party/gmock/CONTRIBUTORS b/third_party/gmock/CONTRIBUTORS
deleted file mode 100644
index 9a8cc2e..0000000
--- a/third_party/gmock/CONTRIBUTORS
+++ /dev/null
@@ -1,39 +0,0 @@
-# This file contains a list of people who've made non-trivial
-# contribution to the Google C++ Mocking Framework project.  People
-# who commit code to the project are encouraged to add their names
-# here.  Please keep the list sorted by first names.
-
-Benoit Sigoure <tsuna@google.com>
-Bogdan Piloca <boo@google.com>
-Chandler Carruth <chandlerc@google.com>
-Dave MacLachlan <dmaclach@gmail.com>
-David Anderson <danderson@google.com>
-Dean Sturtevant
-Gene Volovich <gv@cite.com>
-Hal Burch <gmock@hburch.com>
-Jeffrey Yasskin <jyasskin@google.com>
-Jim Keller <jimkeller@google.com>
-Joe Walnes <joe@truemesh.com>
-Jon Wray <jwray@google.com>
-Keir Mierle <mierle@gmail.com>
-Keith Ray <keith.ray@gmail.com>
-Kostya Serebryany <kcc@google.com>
-Lev Makhlis
-Mario Tanev <radix@google.com>
-Mark Paskin
-Markus Heule <markus.heule@gmail.com>
-Matthew Simmons <simmonmt@acm.org>
-Mike Bland <mbland@google.com>
-Neal Norwitz <nnorwitz@gmail.com>
-Nermin Ozkiranartli <nermin@google.com>
-Owen Carlsen <ocarlsen@google.com>
-Paneendra Ba <paneendra@google.com>
-Paul Menage <menage@google.com>
-Piotr Kaminski <piotrk@google.com>
-Russ Rufer <russ@pentad.com>
-Sverre Sundsdal <sundsdal@gmail.com>
-Takeshi Yoshino <tyoshino@google.com>
-Vadim Berman <vadimb@google.com>
-Vlad Losev <vladl@google.com>
-Wolfgang Klier <wklier@google.com>
-Zhanyong Wan <wan@google.com>
diff --git a/third_party/gmock/COPYING b/third_party/gmock/COPYING
deleted file mode 100644
index 1941a11..0000000
--- a/third_party/gmock/COPYING
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright 2008, Google Inc.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-    * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-    * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/third_party/gmock/README b/third_party/gmock/README
deleted file mode 100644
index 9cbda5d..0000000
--- a/third_party/gmock/README
+++ /dev/null
@@ -1,328 +0,0 @@
-Google C++ Mocking Framework
-============================
-http://code.google.com/p/googlemock/
-
-Overview
---------
-Google's framework for writing and using C++ mock classes on Linux,
-Mac OS X, and Windows.  Inspired by jMock, EasyMock, and Hamcrest, and
-designed with C++'s specifics in mind, it can help you derive better
-designs of your system and write better tests.
-
-Google Mock:
-
-- provides a declarative syntax for defining mocks,
-- can easily define partial (hybrid) mocks, which are a cross of real
-  and mock objects,
-- handles functions of arbitrary types and overloaded functions,
-- comes with a rich set of matchers for validating function arguments,
-- uses an intuitive syntax for controlling the behavior of a mock,
-- does automatic verification of expectations (no record-and-replay
-  needed),
-- allows arbitrary (partial) ordering constraints on
-  function calls to be expressed,
-- lets a user extend it by defining new matchers and actions.
-- does not use exceptions, and
-- is easy to learn and use.
-
-Please see the project page above for more information as well as mailing lists
-for questions, discussions, and development. There is also an IRC channel on
-OFTC (irc.oftc.net) #gtest available. Please join us!
-
-Please note that code under scripts/generator/ is from the cppclean
-project (http://code.google.com/p/cppclean/) and under the Apache
-License, which is different from Google Mock's license.
-
-Requirements
-------------
-Google Mock is not a testing framework itself. Instead, it needs a
-testing framework for writing tests. It works with Google Test
-(http://code.google.com/p/googletest/) out of the box. You can use
-either the copy of Google Test that comes with Google Mock, or a
-compatible version you already have.  This version of Google Mock
-requires Google Test 1.4.0.
-
-You can also easily configure Google Mock to work with another testing
-framework of your choice; although it will still need Google Test as
-an internal dependency.  Please read
-http://code.google.com/p/googlemock/wiki/ForDummies#Using_Google_Mock_with_Any_Testing_Framework
-for how to do it.
-
-Google Mock depends on advanced C++ features and thus requires a more
-modern compiler.  The following are needed to use Google Mock:
-
-### Linux Requirements ###
-These are the base requirements to build and use Google Mock from a source
-package (as described below):
-  * GNU-compatible Make or "gmake"
-  * POSIX-standard shell
-  * POSIX(-2) Regular Expressions (regex.h)
-  * gcc 3.4 or newer.
-
-Furthermore, if you are building Google Mock from a VCS Checkout (also
-described below), there are further requirements:
-  * Automake version 1.9 or newer
-  * Autoconf version 2.59 or newer
-  * Libtool / Libtoolize
-  * Python version 2.3 or newer
-
-### Windows Requirements ###
-  * Microsoft Visual C++ 8.0 SP1 or newer
-
-### Mac OS X Requirements ###
-  * Mac OS X 10.4 Tiger or newer
-  * Developer Tools Installed
-
-Getting the Source
-------------------
-There are two primary ways of getting Google Mock's source code: you can
-download a source release in your preferred archive format, or directly check
-out the source from a Version Control System (VCS, we use Google Code's
-Subversion hosting). The VCS checkout requires a few extra steps and some extra
-software packages on your system, but lets you track development, and make
-patches to contribute much more easily, so we highly encourage it.
-
-### VCS Checkout: ###
-The first step is to select whether you want to check out the main line of
-development on Google Mock, or one of the released branches. The former will be
-much more active and have the latest features, but the latter provides much
-more stability and predictability. Choose whichever fits your needs best, and
-proceed with the following Subversion commands:
-
-  svn checkout http://googlemock.googlecode.com/svn/trunk/ gmock-svn
-
-or for a release version X.Y.*'s branch:
-
-  svn checkout http://googlemock.googlecode.com/svn/branches/release-X.Y/ \
-    gmock-X.Y-svn
-
-Next you will need to prepare the GNU Autotools build system, if you
-are using Linux or Mac OS X. Enter the target directory of the
-checkout command you used ('gmock-svn' or 'gmock-X.Y-svn' above) and
-proceed with the following command:
-
-  autoreconf -fvi
-
-Once you have completed this step, you are ready to build the library. Note
-that you should only need to complete this step once. The subsequent `make'
-invocations will automatically re-generate the bits of the build system that
-need to be changed.
-
-If your system uses older versions of the autotools, the above command will
-fail. You may need to explicitly specify a version to use. For instance, if you
-have both GNU Automake 1.4 and 1.9 installed and `automake' would invoke the
-1.4, use instead:
-
-  AUTOMAKE=automake-1.9 ACLOCAL=aclocal-1.9 autoreconf -fvi
-
-Make sure you're using the same version of automake and aclocal.
-
-### Source Package: ###
-Google Mock is also released in source packages which can be downloaded from
-its Google Code download page[1]. Several different archive formats are
-provided, but the only difference is the tools needed to extract their
-contents, and the size of the resulting file. Download whichever you are most
-comfortable with.
-
-  [1] Google Mock Downloads: http://code.google.com/p/googlemock/downloads/list
-
-Once downloaded expand the archive using whichever tools you prefer for that
-type. This will always result in a new directory with the name "gmock-X.Y.Z"
-which contains all of the source code. Here are some examples in Linux:
-
-  tar -xvzf gmock-X.Y.Z.tar.gz
-  tar -xvjf gmock-X.Y.Z.tar.bz2
-  unzip gmock-X.Y.Z.zip
-
-Choosing a TR1 Tuple Library
-----------------------------
-Google Mock uses the C++ Technical Report 1 (TR1) tuple library
-heavily.  Unfortunately TR1 tuple is not yet widely available with all
-compilers.  The good news is that Google Test 1.4.0+ implements a
-subset of TR1 tuple that's enough for Google Mock's need.  Google Mock
-will automatically use that implementation when the compiler doesn't
-provide TR1 tuple.
-
-Usually you don't need to care about which tuple library Google Test
-and Google Mock use.  However, if your project already uses TR1 tuple,
-you need to tell Google Test and Google Mock to use the same TR1 tuple
-library the rest of your project uses (this requirement is new in
-Google Test 1.4.0 and Google Mock 1.2.0, so you may need to take care
-of it when upgrading from an earlier version), or the two tuple
-implementations will clash.  To do that, add
-
-  -DGTEST_USE_OWN_TR1_TUPLE=0
-
-to the compiler flags while compiling Google Test, Google Mock, and
-your tests.
-
-If you want to use Boost's TR1 tuple library with Google Mock, please
-refer to the Boost website (http://www.boost.org/) for how to obtain
-it and set it up.
-
-Building the Source
--------------------
-### Linux and Mac OS X (without Xcode) ###
-There are two primary options for building the source at this point: build it
-inside the source code tree, or in a separate directory. We recommend building
-in a separate directory as that tends to produce both more consistent results
-and be easier to clean up should anything go wrong, but both patterns are
-supported. The only hard restriction is that while the build directory can be
-a subdirectory of the source directory, the opposite is not possible and will
-result in errors. Once you have selected where you wish to build Google Mock,
-create the directory if necessary, and enter it. The following steps apply for
-either approach by simply substituting the shell variable SRCDIR with "." for
-building inside the source directory, and the relative path to the source
-directory otherwise.
-
-  ${SRCDIR}/configure  # Standard GNU configure script, --help for more info
-
-The default behavior of the configure script with respect to locating and using
-Google Test is to first search for a 'gtest-config' in the system path, and
-lacking this, build an internal copy of Google Test. You may optionally specify
-a custom Google Test you wish to build Google Mock against, provided it is
-a new enough version.
-
-  # Configure against an installation in '/opt' with '/opt/bin/gtest-config'.
-  ${SRCDIR}/configure --with-gtest=/opt
-
-This can also be used to specify a Google Test which hasn't yet been installed.
-However, it must have been configured and built as described in the Google Test
-README before you configure Google Mock. To enable this feature, simply pass
-the directory where you configured and built Google Test (which is not
-necessarily its source directory) to Google Mock's configure script.
-
-  # Configure against a build of Google Test in an arbitrary directory.
-  ${SRCDIR}/configure --with-gtest=../../my_gtest_build
-
-Finally, if you have a version of Google Test installed but for some reason
-wish to forcibly prevent it from being used, we provide a special option.
-Typically this is not needed as we fall back to the internal Google Test
-packaged with Google Mock if an installed version is either unavailable or too
-old to build Google Mock. When using the internally packaged Google Test, the
-user does *not* need to configure or build it, that is automatically handled by
-Google Mock's build system.
-
-  # Force the use of the internally packaged Google Test, despite
-  # 'gtest-config' being in your PATH.
-  ${SRCDIR}/configure --disable-external-gtest
-
-Once you have successfully configured Google Mock, the build steps are standard
-for GNU-style OSS packages.
-
-  make  # Standard makefile following GNU conventions
-  make check  # Builds and runs all tests - all should pass
-
-Other programs will only be able to use Google Mock's functionality if you
-install it in a location which they can access, in Linux this is typically
-under '/usr/local'. The following command will install all of the Google Mock
-libraries, public headers, and utilities necessary for other programs and
-libraries to leverage it. Note that if Google Mock was unable to find an
-external Google Test to build against, it will also install the internally
-packaged Google Test in order to allow the installed Google Mock to function
-properly. This Google Test install will be fully functional, and if installed
-will also be uninstalled by uninstalling Google Mock.
-
-  sudo make install  # Not necessary, but allows use by other programs
-
-Should you need to remove Google Mock from your system after having installed
-it, run the following command, and it will back out its changes.  However, note
-carefully that you must run this command on the *same* Google Mock build that
-you ran the install from, or the results are not predictable.  If you install
-Google Mock on your system, and are working from a VCS checkout, make sure you
-run this *before* updating your checkout of the source in order to uninstall
-the same version which you installed.
-
-  sudo make uninstall  # Must be run against the exact same build as "install"
-
-Your project can build against Google Mock and Google Test simply by leveraging
-the 'gmock-config' script. This script can be invoked directly out of the
-'scripts' subdirectory of the build tree, and it will be installed in the
-binary directory specified during the 'configure'. Here are some examples of
-its use, see 'gmock-config --help' for more detailed information.
-
-  gmock-config --min-version=1.0 || echo "Insufficient Google Mock version."
-
-  g++ $(gmock-config --cppflags --cxxflags) -o foo.o -c foo.cpp
-  g++ $(gmock-config --ldflags --libs) -o foo foo.o
-
-  # When using a built but not installed Google Mock:
-  g++ $(../../my_gmock_build/scripts/gmock-config ...) ...
-
-Note that when building your project against Google Mock, you are building
-against Google Test as well. There is no need to configure Google Test
-separately.
-
-### Windows ###
-The msvc/ directory contains VC++ 2005 projects for building Google
-Mock and selected tests.
-
-If you want to use a version of Google Test other then the one bundled with
-Google Mock, change the value of the GTestDir macro in gmock_config.vsprop
-to point to the new location.
-
-Open msvc/gmock.sln and build the library and tests. If you want to
-create your own project to use with Google Mock, you'll have to
-configure it to use the gmock_config propety sheet. For that:
- * Open the Property Manager window (View | Other Windows | Property Manager)
- * Right-click on your project and select "Add Existing Property Sheet..."
- * Navigate to gmock_config.vsprops and select it.
- * In Project Properties | Configuration Properties | General | Additional
-   Include Directories, type <path to Google Mock>/include.
-
-TODO(wan@google.com): update the .vsprops and .vcproj files such that the
-last step is unnecessary.
-
-### Using GNU Make ###
-The make/ directory contains a Makefile that you can use to build
-Google Mock on systems where GNU make is available (e.g. Linux and Mac
-OS X).  It doesn't try to build Google Mock's own tests.  Instead, it
-just builds the Google Mock libraries and some sample tests.  You can
-use it as a starting point for your own Makefile.
-
-If the default settings are correct for your environment, the
-following commands should succeed:
-
-  cd ${SRCDIR}/make
-  make
-  ./gmock_test
-
-If you see errors, try to tweak the contents of make/Makefile to make
-them go away.  There are instructions in make/Makefile on how to do
-it.
-
-### Using Your Own Build System ###
-If none of the build solutions we provide works for you, or if you
-prefer your own build system, you just need to compile
-${GTEST_SRCDIR}/src/gtest-all.cc (where GTEST_SRCDIR is the root of
-the Google Test source tree) and src/gmock-all.cc into a library and
-link your tests with it.  Assuming a Linux-like system and gcc,
-something like the following will do:
-
-  cd ${SRCDIR}
-  g++ -I. -I./include -I${GTEST_SRCDIR} -I${GTEST_SRCDIR}/include \
-    -c {GTEST_SRCDIR}/src/gtest-all.cc
-  g++ -I. -I./include -I${GTEST_SRCDIR} -I${GTEST_SRCDIR}/include \
-    -c src/gmock-all.cc
-  ar -rv libgmock.a gtest-all.o gmock-all.o
-  g++ -I. -I./include -I${GTEST_SRCDIR} -I${GTEST_SRCDIR}/include \
-    path/to/your_test.cc libgmock.a -o your_test
-
-Regenerating Source Files
--------------------------
-Some of Google Mock's source files are generated from templates (not
-in the C++ sense) using a script.  A template file is named FOO.pump,
-where FOO is the name of the file it will generate.  For example, the
-file include/gmock/gmock-generated-actions.h.pump is used to generate
-gmock-generated-actions.h in the same directory.
-
-Normally you don't need to worry about regenerating the source files,
-unless you need to modify them (e.g. if you are working on a patch for
-Google Mock).  In that case, you should modify the corresponding .pump
-files instead and run the 'pump' script (for Pump is Useful for Meta
-Programming) to regenerate them.  We are still working on releasing
-the script and its documentation.  If you need it now, please email
-googlemock@googlegroups.com such that we know to make it happen
-sooner.
-
-Happy testing!
diff --git a/third_party/gmock/build.scons b/third_party/gmock/build.scons
deleted file mode 100644
index d75284c..0000000
--- a/third_party/gmock/build.scons
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-gmock_env = env.Clone()
-gmock_env.Append(
-    CPPPATH = [
-        '$MAIN_DIR/third_party/gmock',
-        '$MAIN_DIR/third_party/gmock/include',
-        '$MAIN_DIR/third_party/gtest/include',
-        ],
-    CCFLAGS = [
-        '/wd4061',  # enumerator is not explicitly handled by a case label
-        '/wd4242',  # conversion from type1 to type2, possible loss of data
-        '/wd4244',  # conversion from type1 to type2, possible loss of data
-        '/wd4628',  # digraphs not supported with -Ze
-        '/wd4640',  # construction of local static object is not thread-safe
-        ],
-)
-
-target_name = 'gmock'
-
-gmock_inputs = [ 'src/gmock-all.cc' ]
-
-if env.Bit('use_precompiled_headers'):
-    gmock_inputs += gmock_env.EnablePrecompile(target_name)
-
-gmock_env.ComponentLibrary(
-    lib_name=target_name,
-    source=gmock_inputs,
-)
-
diff --git a/third_party/gmock/include/gmock/gmock-actions.h b/third_party/gmock/include/gmock/gmock-actions.h
deleted file mode 100644
index 214b291..0000000
--- a/third_party/gmock/include/gmock/gmock-actions.h
+++ /dev/null
@@ -1,981 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements some commonly used actions.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_
-
-#include <algorithm>
-#include <string>
-
-#ifndef _WIN32_WCE
-#include <errno.h>
-#endif
-
-#include <gmock/gmock-printers.h>
-#include <gmock/internal/gmock-internal-utils.h>
-#include <gmock/internal/gmock-port.h>
-
-namespace testing {
-
-// To implement an action Foo, define:
-//   1. a class FooAction that implements the ActionInterface interface, and
-//   2. a factory function that creates an Action object from a
-//      const FooAction*.
-//
-// The two-level delegation design follows that of Matcher, providing
-// consistency for extension developers.  It also eases ownership
-// management as Action objects can now be copied like plain values.
-
-namespace internal {
-
-template <typename F>
-class MonomorphicDoDefaultActionImpl;
-
-template <typename F1, typename F2>
-class ActionAdaptor;
-
-// BuiltInDefaultValue<T>::Get() returns the "built-in" default
-// value for type T, which is NULL when T is a pointer type, 0 when T
-// is a numeric type, false when T is bool, or "" when T is string or
-// std::string.  For any other type T, this value is undefined and the
-// function will abort the process.
-template <typename T>
-class BuiltInDefaultValue {
- public:
-  // This function returns true iff type T has a built-in default value.
-  static bool Exists() { return false; }
-  static T Get() {
-    Assert(false, __FILE__, __LINE__,
-           "Default action undefined for the function return type.");
-    return internal::Invalid<T>();
-    // The above statement will never be reached, but is required in
-    // order for this function to compile.
-  }
-};
-
-// This partial specialization says that we use the same built-in
-// default value for T and const T.
-template <typename T>
-class BuiltInDefaultValue<const T> {
- public:
-  static bool Exists() { return BuiltInDefaultValue<T>::Exists(); }
-  static T Get() { return BuiltInDefaultValue<T>::Get(); }
-};
-
-// This partial specialization defines the default values for pointer
-// types.
-template <typename T>
-class BuiltInDefaultValue<T*> {
- public:
-  static bool Exists() { return true; }
-  static T* Get() { return NULL; }
-};
-
-// The following specializations define the default values for
-// specific types we care about.
-#define GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(type, value) \
-  template <> \
-  class BuiltInDefaultValue<type> { \
-   public: \
-    static bool Exists() { return true; } \
-    static type Get() { return value; } \
-  }
-
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(void, );  // NOLINT
-#if GTEST_HAS_GLOBAL_STRING
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(::string, "");
-#endif  // GTEST_HAS_GLOBAL_STRING
-#if GTEST_HAS_STD_STRING
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(::std::string, "");
-#endif  // GTEST_HAS_STD_STRING
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(bool, false);
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned char, '\0');
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed char, '\0');
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(char, '\0');
-
-// There's no need for a default action for signed wchar_t, as that
-// type is the same as wchar_t for gcc, and invalid for MSVC.
-//
-// There's also no need for a default action for unsigned wchar_t, as
-// that type is the same as unsigned int for gcc, and invalid for
-// MSVC.
-#if GMOCK_WCHAR_T_IS_NATIVE_
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(wchar_t, 0U);  // NOLINT
-#endif
-
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned short, 0U);  // NOLINT
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed short, 0);     // NOLINT
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned int, 0U);
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed int, 0);
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned long, 0UL);  // NOLINT
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed long, 0L);     // NOLINT
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(UInt64, 0);
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(Int64, 0);
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(float, 0);
-GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(double, 0);
-
-#undef GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_
-
-}  // namespace internal
-
-// When an unexpected function call is encountered, Google Mock will
-// let it return a default value if the user has specified one for its
-// return type, or if the return type has a built-in default value;
-// otherwise Google Mock won't know what value to return and will have
-// to abort the process.
-//
-// The DefaultValue<T> class allows a user to specify the
-// default value for a type T that is both copyable and publicly
-// destructible (i.e. anything that can be used as a function return
-// type).  The usage is:
-//
-//   // Sets the default value for type T to be foo.
-//   DefaultValue<T>::Set(foo);
-template <typename T>
-class DefaultValue {
- public:
-  // Sets the default value for type T; requires T to be
-  // copy-constructable and have a public destructor.
-  static void Set(T x) {
-    delete value_;
-    value_ = new T(x);
-  }
-
-  // Unsets the default value for type T.
-  static void Clear() {
-    delete value_;
-    value_ = NULL;
-  }
-
-  // Returns true iff the user has set the default value for type T.
-  static bool IsSet() { return value_ != NULL; }
-
-  // Returns true if T has a default return value set by the user or there
-  // exists a built-in default value.
-  static bool Exists() {
-    return IsSet() || internal::BuiltInDefaultValue<T>::Exists();
-  }
-
-  // Returns the default value for type T if the user has set one;
-  // otherwise returns the built-in default value if there is one;
-  // otherwise aborts the process.
-  static T Get() {
-    return value_ == NULL ?
-        internal::BuiltInDefaultValue<T>::Get() : *value_;
-  }
- private:
-  static const T* value_;
-};
-
-// This partial specialization allows a user to set default values for
-// reference types.
-template <typename T>
-class DefaultValue<T&> {
- public:
-  // Sets the default value for type T&.
-  static void Set(T& x) {  // NOLINT
-    address_ = &x;
-  }
-
-  // Unsets the default value for type T&.
-  static void Clear() {
-    address_ = NULL;
-  }
-
-  // Returns true iff the user has set the default value for type T&.
-  static bool IsSet() { return address_ != NULL; }
-
-  // Returns true if T has a default return value set by the user or there
-  // exists a built-in default value.
-  static bool Exists() {
-    return IsSet() || internal::BuiltInDefaultValue<T&>::Exists();
-  }
-
-  // Returns the default value for type T& if the user has set one;
-  // otherwise returns the built-in default value if there is one;
-  // otherwise aborts the process.
-  static T& Get() {
-    return address_ == NULL ?
-        internal::BuiltInDefaultValue<T&>::Get() : *address_;
-  }
- private:
-  static T* address_;
-};
-
-// This specialization allows DefaultValue<void>::Get() to
-// compile.
-template <>
-class DefaultValue<void> {
- public:
-  static bool Exists() { return true; }
-  static void Get() {}
-};
-
-// Points to the user-set default value for type T.
-template <typename T>
-const T* DefaultValue<T>::value_ = NULL;
-
-// Points to the user-set default value for type T&.
-template <typename T>
-T* DefaultValue<T&>::address_ = NULL;
-
-// Implement this interface to define an action for function type F.
-template <typename F>
-class ActionInterface {
- public:
-  typedef typename internal::Function<F>::Result Result;
-  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
-  ActionInterface() : is_do_default_(false) {}
-
-  virtual ~ActionInterface() {}
-
-  // Performs the action.  This method is not const, as in general an
-  // action can have side effects and be stateful.  For example, a
-  // get-the-next-element-from-the-collection action will need to
-  // remember the current element.
-  virtual Result Perform(const ArgumentTuple& args) = 0;
-
-  // Returns true iff this is the DoDefault() action.
-  bool IsDoDefault() const { return is_do_default_; }
- private:
-  template <typename Function>
-  friend class internal::MonomorphicDoDefaultActionImpl;
-
-  // This private constructor is reserved for implementing
-  // DoDefault(), the default action for a given mock function.
-  explicit ActionInterface(bool is_do_default)
-      : is_do_default_(is_do_default) {}
-
-  // True iff this action is DoDefault().
-  const bool is_do_default_;
-};
-
-// An Action<F> is a copyable and IMMUTABLE (except by assignment)
-// object that represents an action to be taken when a mock function
-// of type F is called.  The implementation of Action<T> is just a
-// linked_ptr to const ActionInterface<T>, so copying is fairly cheap.
-// Don't inherit from Action!
-//
-// You can view an object implementing ActionInterface<F> as a
-// concrete action (including its current state), and an Action<F>
-// object as a handle to it.
-template <typename F>
-class Action {
- public:
-  typedef typename internal::Function<F>::Result Result;
-  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
-  // Constructs a null Action.  Needed for storing Action objects in
-  // STL containers.
-  Action() : impl_(NULL) {}
-
-  // Constructs an Action from its implementation.
-  explicit Action(ActionInterface<F>* impl) : impl_(impl) {}
-
-  // Copy constructor.
-  Action(const Action& action) : impl_(action.impl_) {}
-
-  // This constructor allows us to turn an Action<Func> object into an
-  // Action<F>, as long as F's arguments can be implicitly converted
-  // to Func's and Func's return type can be implicitly converted to
-  // F's.
-  template <typename Func>
-  explicit Action(const Action<Func>& action);
-
-  // Returns true iff this is the DoDefault() action.
-  bool IsDoDefault() const { return impl_->IsDoDefault(); }
-
-  // Performs the action.  Note that this method is const even though
-  // the corresponding method in ActionInterface is not.  The reason
-  // is that a const Action<F> means that it cannot be re-bound to
-  // another concrete action, not that the concrete action it binds to
-  // cannot change state.  (Think of the difference between a const
-  // pointer and a pointer to const.)
-  Result Perform(const ArgumentTuple& args) const {
-    return impl_->Perform(args);
-  }
- private:
-  template <typename F1, typename F2>
-  friend class internal::ActionAdaptor;
-
-  internal::linked_ptr<ActionInterface<F> > impl_;
-};
-
-// The PolymorphicAction class template makes it easy to implement a
-// polymorphic action (i.e. an action that can be used in mock
-// functions of than one type, e.g. Return()).
-//
-// To define a polymorphic action, a user first provides a COPYABLE
-// implementation class that has a Perform() method template:
-//
-//   class FooAction {
-//    public:
-//     template <typename Result, typename ArgumentTuple>
-//     Result Perform(const ArgumentTuple& args) const {
-//       // Processes the arguments and returns a result, using
-//       // tr1::get<N>(args) to get the N-th (0-based) argument in the tuple.
-//     }
-//     ...
-//   };
-//
-// Then the user creates the polymorphic action using
-// MakePolymorphicAction(object) where object has type FooAction.  See
-// the definition of Return(void) and SetArgumentPointee<N>(value) for
-// complete examples.
-template <typename Impl>
-class PolymorphicAction {
- public:
-  explicit PolymorphicAction(const Impl& impl) : impl_(impl) {}
-
-  template <typename F>
-  operator Action<F>() const {
-    return Action<F>(new MonomorphicImpl<F>(impl_));
-  }
- private:
-  template <typename F>
-  class MonomorphicImpl : public ActionInterface<F> {
-   public:
-    typedef typename internal::Function<F>::Result Result;
-    typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
-    explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {}
-
-    virtual Result Perform(const ArgumentTuple& args) {
-      return impl_.template Perform<Result>(args);
-    }
-
-   private:
-    Impl impl_;
-  };
-
-  Impl impl_;
-};
-
-// Creates an Action from its implementation and returns it.  The
-// created Action object owns the implementation.
-template <typename F>
-Action<F> MakeAction(ActionInterface<F>* impl) {
-  return Action<F>(impl);
-}
-
-// Creates a polymorphic action from its implementation.  This is
-// easier to use than the PolymorphicAction<Impl> constructor as it
-// doesn't require you to explicitly write the template argument, e.g.
-//
-//   MakePolymorphicAction(foo);
-// vs
-//   PolymorphicAction<TypeOfFoo>(foo);
-template <typename Impl>
-inline PolymorphicAction<Impl> MakePolymorphicAction(const Impl& impl) {
-  return PolymorphicAction<Impl>(impl);
-}
-
-namespace internal {
-
-// Allows an Action<F2> object to pose as an Action<F1>, as long as F2
-// and F1 are compatible.
-template <typename F1, typename F2>
-class ActionAdaptor : public ActionInterface<F1> {
- public:
-  typedef typename internal::Function<F1>::Result Result;
-  typedef typename internal::Function<F1>::ArgumentTuple ArgumentTuple;
-
-  explicit ActionAdaptor(const Action<F2>& from) : impl_(from.impl_) {}
-
-  virtual Result Perform(const ArgumentTuple& args) {
-    return impl_->Perform(args);
-  }
- private:
-  const internal::linked_ptr<ActionInterface<F2> > impl_;
-};
-
-// Implements the polymorphic Return(x) action, which can be used in
-// any function that returns the type of x, regardless of the argument
-// types.
-//
-// Note: The value passed into Return must be converted into
-// Function<F>::Result when this action is cast to Action<F> rather than
-// when that action is performed. This is important in scenarios like
-//
-// MOCK_METHOD1(Method, T(U));
-// ...
-// {
-//   Foo foo;
-//   X x(&foo);
-//   EXPECT_CALL(mock, Method(_)).WillOnce(Return(x));
-// }
-//
-// In the example above the variable x holds reference to foo which leaves
-// scope and gets destroyed.  If copying X just copies a reference to foo,
-// that copy will be left with a hanging reference.  If conversion to T
-// makes a copy of foo, the above code is safe. To support that scenario, we
-// need to make sure that the type conversion happens inside the EXPECT_CALL
-// statement, and conversion of the result of Return to Action<T(U)> is a
-// good place for that.
-//
-template <typename R>
-class ReturnAction {
- public:
-  // Constructs a ReturnAction object from the value to be returned.
-  // 'value' is passed by value instead of by const reference in order
-  // to allow Return("string literal") to compile.
-  explicit ReturnAction(R value) : value_(value) {}
-
-  // This template type conversion operator allows Return(x) to be
-  // used in ANY function that returns x's type.
-  template <typename F>
-  operator Action<F>() const {
-    // Assert statement belongs here because this is the best place to verify
-    // conditions on F. It produces the clearest error messages
-    // in most compilers.
-    // Impl really belongs in this scope as a local class but can't
-    // because MSVC produces duplicate symbols in different translation units
-    // in this case. Until MS fixes that bug we put Impl into the class scope
-    // and put the typedef both here (for use in assert statement) and
-    // in the Impl class. But both definitions must be the same.
-    typedef typename Function<F>::Result Result;
-    GMOCK_COMPILE_ASSERT_(
-        !internal::is_reference<Result>::value,
-        use_ReturnRef_instead_of_Return_to_return_a_reference);
-    return Action<F>(new Impl<F>(value_));
-  }
- private:
-  // Implements the Return(x) action for a particular function type F.
-  template <typename F>
-  class Impl : public ActionInterface<F> {
-   public:
-    typedef typename Function<F>::Result Result;
-    typedef typename Function<F>::ArgumentTuple ArgumentTuple;
-
-    // The implicit cast is necessary when Result has more than one
-    // single-argument constructor (e.g. Result is std::vector<int>) and R
-    // has a type conversion operator template.  In that case, value_(value)
-    // won't compile as the compiler doesn't known which constructor of
-    // Result to call.  implicit_cast forces the compiler to convert R to
-    // Result without considering explicit constructors, thus resolving the
-    // ambiguity. value_ is then initialized using its copy constructor.
-    explicit Impl(R value)
-        : value_(::testing::internal::implicit_cast<Result>(value)) {}
-
-    virtual Result Perform(const ArgumentTuple&) { return value_; }
-
-   private:
-    GMOCK_COMPILE_ASSERT_(!internal::is_reference<Result>::value,
-                          Result_cannot_be_a_reference_type);
-    Result value_;
-  };
-
-  R value_;
-};
-
-// Implements the ReturnNull() action.
-class ReturnNullAction {
- public:
-  // Allows ReturnNull() to be used in any pointer-returning function.
-  template <typename Result, typename ArgumentTuple>
-  static Result Perform(const ArgumentTuple&) {
-    GMOCK_COMPILE_ASSERT_(internal::is_pointer<Result>::value,
-                          ReturnNull_can_be_used_to_return_a_pointer_only);
-    return NULL;
-  }
-};
-
-// Implements the Return() action.
-class ReturnVoidAction {
- public:
-  // Allows Return() to be used in any void-returning function.
-  template <typename Result, typename ArgumentTuple>
-  static void Perform(const ArgumentTuple&) {
-    CompileAssertTypesEqual<void, Result>();
-  }
-};
-
-// Implements the polymorphic ReturnRef(x) action, which can be used
-// in any function that returns a reference to the type of x,
-// regardless of the argument types.
-template <typename T>
-class ReturnRefAction {
- public:
-  // Constructs a ReturnRefAction object from the reference to be returned.
-  explicit ReturnRefAction(T& ref) : ref_(ref) {}  // NOLINT
-
-  // This template type conversion operator allows ReturnRef(x) to be
-  // used in ANY function that returns a reference to x's type.
-  template <typename F>
-  operator Action<F>() const {
-    typedef typename Function<F>::Result Result;
-    // Asserts that the function return type is a reference.  This
-    // catches the user error of using ReturnRef(x) when Return(x)
-    // should be used, and generates some helpful error message.
-    GMOCK_COMPILE_ASSERT_(internal::is_reference<Result>::value,
-                          use_Return_instead_of_ReturnRef_to_return_a_value);
-    return Action<F>(new Impl<F>(ref_));
-  }
- private:
-  // Implements the ReturnRef(x) action for a particular function type F.
-  template <typename F>
-  class Impl : public ActionInterface<F> {
-   public:
-    typedef typename Function<F>::Result Result;
-    typedef typename Function<F>::ArgumentTuple ArgumentTuple;
-
-    explicit Impl(T& ref) : ref_(ref) {}  // NOLINT
-
-    virtual Result Perform(const ArgumentTuple&) {
-      return ref_;
-    }
-   private:
-    T& ref_;
-  };
-
-  T& ref_;
-};
-
-// Implements the DoDefault() action for a particular function type F.
-template <typename F>
-class MonomorphicDoDefaultActionImpl : public ActionInterface<F> {
- public:
-  typedef typename Function<F>::Result Result;
-  typedef typename Function<F>::ArgumentTuple ArgumentTuple;
-
-  MonomorphicDoDefaultActionImpl() : ActionInterface<F>(true) {}
-
-  // For technical reasons, DoDefault() cannot be used inside a
-  // composite action (e.g. DoAll(...)).  It can only be used at the
-  // top level in an EXPECT_CALL().  If this function is called, the
-  // user must be using DoDefault() inside a composite action, and we
-  // have to generate a run-time error.
-  virtual Result Perform(const ArgumentTuple&) {
-    Assert(false, __FILE__, __LINE__,
-           "You are using DoDefault() inside a composite action like "
-           "DoAll() or WithArgs().  This is not supported for technical "
-           "reasons.  Please instead spell out the default action, or "
-           "assign the default action to an Action variable and use "
-           "the variable in various places.");
-    return internal::Invalid<Result>();
-    // The above statement will never be reached, but is required in
-    // order for this function to compile.
-  }
-};
-
-// Implements the polymorphic DoDefault() action.
-class DoDefaultAction {
- public:
-  // This template type conversion operator allows DoDefault() to be
-  // used in any function.
-  template <typename F>
-  operator Action<F>() const {
-    return Action<F>(new MonomorphicDoDefaultActionImpl<F>);
-  }
-};
-
-// Implements the Assign action to set a given pointer referent to a
-// particular value.
-template <typename T1, typename T2>
-class AssignAction {
- public:
-  AssignAction(T1* ptr, T2 value) : ptr_(ptr), value_(value) {}
-
-  template <typename Result, typename ArgumentTuple>
-  void Perform(const ArgumentTuple& /* args */) const {
-    *ptr_ = value_;
-  }
- private:
-  T1* const ptr_;
-  const T2 value_;
-};
-
-#if !GTEST_OS_WINDOWS_MOBILE
-
-// Implements the SetErrnoAndReturn action to simulate return from
-// various system calls and libc functions.
-template <typename T>
-class SetErrnoAndReturnAction {
- public:
-  SetErrnoAndReturnAction(int errno_value, T result)
-      : errno_(errno_value),
-        result_(result) {}
-  template <typename Result, typename ArgumentTuple>
-  Result Perform(const ArgumentTuple& /* args */) const {
-    errno = errno_;
-    return result_;
-  }
- private:
-  const int errno_;
-  const T result_;
-};
-
-#endif  // !GTEST_OS_WINDOWS_MOBILE
-
-// Implements the SetArgumentPointee<N>(x) action for any function
-// whose N-th argument (0-based) is a pointer to x's type.  The
-// template parameter kIsProto is true iff type A is ProtocolMessage,
-// proto2::Message, or a sub-class of those.
-template <size_t N, typename A, bool kIsProto>
-class SetArgumentPointeeAction {
- public:
-  // Constructs an action that sets the variable pointed to by the
-  // N-th function argument to 'value'.
-  explicit SetArgumentPointeeAction(const A& value) : value_(value) {}
-
-  template <typename Result, typename ArgumentTuple>
-  void Perform(const ArgumentTuple& args) const {
-    CompileAssertTypesEqual<void, Result>();
-    *::std::tr1::get<N>(args) = value_;
-  }
-
- private:
-  const A value_;
-};
-
-template <size_t N, typename Proto>
-class SetArgumentPointeeAction<N, Proto, true> {
- public:
-  // Constructs an action that sets the variable pointed to by the
-  // N-th function argument to 'proto'.  Both ProtocolMessage and
-  // proto2::Message have the CopyFrom() method, so the same
-  // implementation works for both.
-  explicit SetArgumentPointeeAction(const Proto& proto) : proto_(new Proto) {
-    proto_->CopyFrom(proto);
-  }
-
-  template <typename Result, typename ArgumentTuple>
-  void Perform(const ArgumentTuple& args) const {
-    CompileAssertTypesEqual<void, Result>();
-    ::std::tr1::get<N>(args)->CopyFrom(*proto_);
-  }
- private:
-  const internal::linked_ptr<Proto> proto_;
-};
-
-// Implements the InvokeWithoutArgs(f) action.  The template argument
-// FunctionImpl is the implementation type of f, which can be either a
-// function pointer or a functor.  InvokeWithoutArgs(f) can be used as an
-// Action<F> as long as f's type is compatible with F (i.e. f can be
-// assigned to a tr1::function<F>).
-template <typename FunctionImpl>
-class InvokeWithoutArgsAction {
- public:
-  // The c'tor makes a copy of function_impl (either a function
-  // pointer or a functor).
-  explicit InvokeWithoutArgsAction(FunctionImpl function_impl)
-      : function_impl_(function_impl) {}
-
-  // Allows InvokeWithoutArgs(f) to be used as any action whose type is
-  // compatible with f.
-  template <typename Result, typename ArgumentTuple>
-  Result Perform(const ArgumentTuple&) { return function_impl_(); }
- private:
-  FunctionImpl function_impl_;
-};
-
-// Implements the InvokeWithoutArgs(object_ptr, &Class::Method) action.
-template <class Class, typename MethodPtr>
-class InvokeMethodWithoutArgsAction {
- public:
-  InvokeMethodWithoutArgsAction(Class* obj_ptr, MethodPtr method_ptr)
-      : obj_ptr_(obj_ptr), method_ptr_(method_ptr) {}
-
-  template <typename Result, typename ArgumentTuple>
-  Result Perform(const ArgumentTuple&) const {
-    return (obj_ptr_->*method_ptr_)();
-  }
- private:
-  Class* const obj_ptr_;
-  const MethodPtr method_ptr_;
-};
-
-// Implements the IgnoreResult(action) action.
-template <typename A>
-class IgnoreResultAction {
- public:
-  explicit IgnoreResultAction(const A& action) : action_(action) {}
-
-  template <typename F>
-  operator Action<F>() const {
-    // Assert statement belongs here because this is the best place to verify
-    // conditions on F. It produces the clearest error messages
-    // in most compilers.
-    // Impl really belongs in this scope as a local class but can't
-    // because MSVC produces duplicate symbols in different translation units
-    // in this case. Until MS fixes that bug we put Impl into the class scope
-    // and put the typedef both here (for use in assert statement) and
-    // in the Impl class. But both definitions must be the same.
-    typedef typename internal::Function<F>::Result Result;
-
-    // Asserts at compile time that F returns void.
-    CompileAssertTypesEqual<void, Result>();
-
-    return Action<F>(new Impl<F>(action_));
-  }
- private:
-  template <typename F>
-  class Impl : public ActionInterface<F> {
-   public:
-    typedef typename internal::Function<F>::Result Result;
-    typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
-    explicit Impl(const A& action) : action_(action) {}
-
-    virtual void Perform(const ArgumentTuple& args) {
-      // Performs the action and ignores its result.
-      action_.Perform(args);
-    }
-
-   private:
-    // Type OriginalFunction is the same as F except that its return
-    // type is IgnoredValue.
-    typedef typename internal::Function<F>::MakeResultIgnoredValue
-        OriginalFunction;
-
-    const Action<OriginalFunction> action_;
-  };
-
-  const A action_;
-};
-
-// A ReferenceWrapper<T> object represents a reference to type T,
-// which can be either const or not.  It can be explicitly converted
-// from, and implicitly converted to, a T&.  Unlike a reference,
-// ReferenceWrapper<T> can be copied and can survive template type
-// inference.  This is used to support by-reference arguments in the
-// InvokeArgument<N>(...) action.  The idea was from "reference
-// wrappers" in tr1, which we don't have in our source tree yet.
-template <typename T>
-class ReferenceWrapper {
- public:
-  // Constructs a ReferenceWrapper<T> object from a T&.
-  explicit ReferenceWrapper(T& l_value) : pointer_(&l_value) {}  // NOLINT
-
-  // Allows a ReferenceWrapper<T> object to be implicitly converted to
-  // a T&.
-  operator T&() const { return *pointer_; }
- private:
-  T* pointer_;
-};
-
-// Allows the expression ByRef(x) to be printed as a reference to x.
-template <typename T>
-void PrintTo(const ReferenceWrapper<T>& ref, ::std::ostream* os) {
-  T& value = ref;
-  UniversalPrinter<T&>::Print(value, os);
-}
-
-// Does two actions sequentially.  Used for implementing the DoAll(a1,
-// a2, ...) action.
-template <typename Action1, typename Action2>
-class DoBothAction {
- public:
-  DoBothAction(Action1 action1, Action2 action2)
-      : action1_(action1), action2_(action2) {}
-
-  // This template type conversion operator allows DoAll(a1, ..., a_n)
-  // to be used in ANY function of compatible type.
-  template <typename F>
-  operator Action<F>() const {
-    return Action<F>(new Impl<F>(action1_, action2_));
-  }
-
- private:
-  // Implements the DoAll(...) action for a particular function type F.
-  template <typename F>
-  class Impl : public ActionInterface<F> {
-   public:
-    typedef typename Function<F>::Result Result;
-    typedef typename Function<F>::ArgumentTuple ArgumentTuple;
-    typedef typename Function<F>::MakeResultVoid VoidResult;
-
-    Impl(const Action<VoidResult>& action1, const Action<F>& action2)
-        : action1_(action1), action2_(action2) {}
-
-    virtual Result Perform(const ArgumentTuple& args) {
-      action1_.Perform(args);
-      return action2_.Perform(args);
-    }
-
-   private:
-    const Action<VoidResult> action1_;
-    const Action<F> action2_;
-  };
-
-  Action1 action1_;
-  Action2 action2_;
-};
-
-}  // namespace internal
-
-// An Unused object can be implicitly constructed from ANY value.
-// This is handy when defining actions that ignore some or all of the
-// mock function arguments.  For example, given
-//
-//   MOCK_METHOD3(Foo, double(const string& label, double x, double y));
-//   MOCK_METHOD3(Bar, double(int index, double x, double y));
-//
-// instead of
-//
-//   double DistanceToOriginWithLabel(const string& label, double x, double y) {
-//     return sqrt(x*x + y*y);
-//   }
-//   double DistanceToOriginWithIndex(int index, double x, double y) {
-//     return sqrt(x*x + y*y);
-//   }
-//   ...
-//   EXEPCT_CALL(mock, Foo("abc", _, _))
-//       .WillOnce(Invoke(DistanceToOriginWithLabel));
-//   EXEPCT_CALL(mock, Bar(5, _, _))
-//       .WillOnce(Invoke(DistanceToOriginWithIndex));
-//
-// you could write
-//
-//   // We can declare any uninteresting argument as Unused.
-//   double DistanceToOrigin(Unused, double x, double y) {
-//     return sqrt(x*x + y*y);
-//   }
-//   ...
-//   EXEPCT_CALL(mock, Foo("abc", _, _)).WillOnce(Invoke(DistanceToOrigin));
-//   EXEPCT_CALL(mock, Bar(5, _, _)).WillOnce(Invoke(DistanceToOrigin));
-typedef internal::IgnoredValue Unused;
-
-// This constructor allows us to turn an Action<From> object into an
-// Action<To>, as long as To's arguments can be implicitly converted
-// to From's and From's return type cann be implicitly converted to
-// To's.
-template <typename To>
-template <typename From>
-Action<To>::Action(const Action<From>& from)
-    : impl_(new internal::ActionAdaptor<To, From>(from)) {}
-
-// Creates an action that returns 'value'.  'value' is passed by value
-// instead of const reference - otherwise Return("string literal")
-// will trigger a compiler error about using array as initializer.
-template <typename R>
-internal::ReturnAction<R> Return(R value) {
-  return internal::ReturnAction<R>(value);
-}
-
-// Creates an action that returns NULL.
-inline PolymorphicAction<internal::ReturnNullAction> ReturnNull() {
-  return MakePolymorphicAction(internal::ReturnNullAction());
-}
-
-// Creates an action that returns from a void function.
-inline PolymorphicAction<internal::ReturnVoidAction> Return() {
-  return MakePolymorphicAction(internal::ReturnVoidAction());
-}
-
-// Creates an action that returns the reference to a variable.
-template <typename R>
-inline internal::ReturnRefAction<R> ReturnRef(R& x) {  // NOLINT
-  return internal::ReturnRefAction<R>(x);
-}
-
-// Creates an action that does the default action for the give mock function.
-inline internal::DoDefaultAction DoDefault() {
-  return internal::DoDefaultAction();
-}
-
-// Creates an action that sets the variable pointed by the N-th
-// (0-based) function argument to 'value'.
-template <size_t N, typename T>
-PolymorphicAction<
-  internal::SetArgumentPointeeAction<
-    N, T, internal::IsAProtocolMessage<T>::value> >
-SetArgumentPointee(const T& x) {
-  return MakePolymorphicAction(internal::SetArgumentPointeeAction<
-      N, T, internal::IsAProtocolMessage<T>::value>(x));
-}
-
-// Creates an action that sets a pointer referent to a given value.
-template <typename T1, typename T2>
-PolymorphicAction<internal::AssignAction<T1, T2> > Assign(T1* ptr, T2 val) {
-  return MakePolymorphicAction(internal::AssignAction<T1, T2>(ptr, val));
-}
-
-#if !GTEST_OS_WINDOWS_MOBILE
-
-// Creates an action that sets errno and returns the appropriate error.
-template <typename T>
-PolymorphicAction<internal::SetErrnoAndReturnAction<T> >
-SetErrnoAndReturn(int errval, T result) {
-  return MakePolymorphicAction(
-      internal::SetErrnoAndReturnAction<T>(errval, result));
-}
-
-#endif  // !GTEST_OS_WINDOWS_MOBILE
-
-// Various overloads for InvokeWithoutArgs().
-
-// Creates an action that invokes 'function_impl' with no argument.
-template <typename FunctionImpl>
-PolymorphicAction<internal::InvokeWithoutArgsAction<FunctionImpl> >
-InvokeWithoutArgs(FunctionImpl function_impl) {
-  return MakePolymorphicAction(
-      internal::InvokeWithoutArgsAction<FunctionImpl>(function_impl));
-}
-
-// Creates an action that invokes the given method on the given object
-// with no argument.
-template <class Class, typename MethodPtr>
-PolymorphicAction<internal::InvokeMethodWithoutArgsAction<Class, MethodPtr> >
-InvokeWithoutArgs(Class* obj_ptr, MethodPtr method_ptr) {
-  return MakePolymorphicAction(
-      internal::InvokeMethodWithoutArgsAction<Class, MethodPtr>(
-          obj_ptr, method_ptr));
-}
-
-// Creates an action that performs an_action and throws away its
-// result.  In other words, it changes the return type of an_action to
-// void.  an_action MUST NOT return void, or the code won't compile.
-template <typename A>
-inline internal::IgnoreResultAction<A> IgnoreResult(const A& an_action) {
-  return internal::IgnoreResultAction<A>(an_action);
-}
-
-// Creates a reference wrapper for the given L-value.  If necessary,
-// you can explicitly specify the type of the reference.  For example,
-// suppose 'derived' is an object of type Derived, ByRef(derived)
-// would wrap a Derived&.  If you want to wrap a const Base& instead,
-// where Base is a base class of Derived, just write:
-//
-//   ByRef<const Base>(derived)
-template <typename T>
-inline internal::ReferenceWrapper<T> ByRef(T& l_value) {  // NOLINT
-  return internal::ReferenceWrapper<T>(l_value);
-}
-
-}  // namespace testing
-
-#endif  // GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_
diff --git a/third_party/gmock/include/gmock/gmock-cardinalities.h b/third_party/gmock/include/gmock/gmock-cardinalities.h
deleted file mode 100644
index ae4cb64..0000000
--- a/third_party/gmock/include/gmock/gmock-cardinalities.h
+++ /dev/null
@@ -1,146 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements some commonly used cardinalities.  More
-// cardinalities can be defined by the user implementing the
-// CardinalityInterface interface if necessary.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_
-
-#include <limits.h>
-#include <ostream>  // NOLINT
-#include <gmock/internal/gmock-port.h>
-#include <gtest/gtest.h>
-
-namespace testing {
-
-// To implement a cardinality Foo, define:
-//   1. a class FooCardinality that implements the
-//      CardinalityInterface interface, and
-//   2. a factory function that creates a Cardinality object from a
-//      const FooCardinality*.
-//
-// The two-level delegation design follows that of Matcher, providing
-// consistency for extension developers.  It also eases ownership
-// management as Cardinality objects can now be copied like plain values.
-
-// The implementation of a cardinality.
-class CardinalityInterface {
- public:
-  virtual ~CardinalityInterface() {}
-
-  // Conservative estimate on the lower/upper bound of the number of
-  // calls allowed.
-  virtual int ConservativeLowerBound() const { return 0; }
-  virtual int ConservativeUpperBound() const { return INT_MAX; }
-
-  // Returns true iff call_count calls will satisfy this cardinality.
-  virtual bool IsSatisfiedByCallCount(int call_count) const = 0;
-
-  // Returns true iff call_count calls will saturate this cardinality.
-  virtual bool IsSaturatedByCallCount(int call_count) const = 0;
-
-  // Describes self to an ostream.
-  virtual void DescribeTo(::std::ostream* os) const = 0;
-};
-
-// A Cardinality is a copyable and IMMUTABLE (except by assignment)
-// object that specifies how many times a mock function is expected to
-// be called.  The implementation of Cardinality is just a linked_ptr
-// to const CardinalityInterface, so copying is fairly cheap.
-// Don't inherit from Cardinality!
-class Cardinality {
- public:
-  // Constructs a null cardinality.  Needed for storing Cardinality
-  // objects in STL containers.
-  Cardinality() {}
-
-  // Constructs a Cardinality from its implementation.
-  explicit Cardinality(const CardinalityInterface* impl) : impl_(impl) {}
-
-  // Conservative estimate on the lower/upper bound of the number of
-  // calls allowed.
-  int ConservativeLowerBound() const { return impl_->ConservativeLowerBound(); }
-  int ConservativeUpperBound() const { return impl_->ConservativeUpperBound(); }
-
-  // Returns true iff call_count calls will satisfy this cardinality.
-  bool IsSatisfiedByCallCount(int call_count) const {
-    return impl_->IsSatisfiedByCallCount(call_count);
-  }
-
-  // Returns true iff call_count calls will saturate this cardinality.
-  bool IsSaturatedByCallCount(int call_count) const {
-    return impl_->IsSaturatedByCallCount(call_count);
-  }
-
-  // Returns true iff call_count calls will over-saturate this
-  // cardinality, i.e. exceed the maximum number of allowed calls.
-  bool IsOverSaturatedByCallCount(int call_count) const {
-    return impl_->IsSaturatedByCallCount(call_count) &&
-        !impl_->IsSatisfiedByCallCount(call_count);
-  }
-
-  // Describes self to an ostream
-  void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); }
-
-  // Describes the given actual call count to an ostream.
-  static void DescribeActualCallCountTo(int actual_call_count,
-                                        ::std::ostream* os);
- private:
-  internal::linked_ptr<const CardinalityInterface> impl_;
-};
-
-// Creates a cardinality that allows at least n calls.
-Cardinality AtLeast(int n);
-
-// Creates a cardinality that allows at most n calls.
-Cardinality AtMost(int n);
-
-// Creates a cardinality that allows any number of calls.
-Cardinality AnyNumber();
-
-// Creates a cardinality that allows between min and max calls.
-Cardinality Between(int min, int max);
-
-// Creates a cardinality that allows exactly n calls.
-Cardinality Exactly(int n);
-
-// Creates a cardinality from its implementation.
-inline Cardinality MakeCardinality(const CardinalityInterface* c) {
-  return Cardinality(c);
-}
-
-}  // namespace testing
-
-#endif  // GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_
diff --git a/third_party/gmock/include/gmock/gmock-generated-actions.h b/third_party/gmock/include/gmock/gmock-generated-actions.h
deleted file mode 100644
index 143a99b..0000000
--- a/third_party/gmock/include/gmock/gmock-generated-actions.h
+++ /dev/null
@@ -1,2355 +0,0 @@
-// This file was GENERATED by a script.  DO NOT EDIT BY HAND!!!
-
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements some commonly used variadic actions.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
-
-#include <gmock/gmock-actions.h>
-#include <gmock/internal/gmock-port.h>
-
-namespace testing {
-namespace internal {
-
-// InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary
-// function or method with the unpacked values, where F is a function
-// type that takes N arguments.
-template <typename Result, typename ArgumentTuple>
-class InvokeHelper;
-
-template <typename R>
-class InvokeHelper<R, ::std::tr1::tuple<> > {
- public:
-  template <typename Function>
-  static R Invoke(Function function, const ::std::tr1::tuple<>&) {
-    return function();
-  }
-
-  template <class Class, typename MethodPtr>
-  static R InvokeMethod(Class* obj_ptr,
-                        MethodPtr method_ptr,
-                        const ::std::tr1::tuple<>&) {
-    return (obj_ptr->*method_ptr)();
-  }
-};
-
-template <typename R, typename A1>
-class InvokeHelper<R, ::std::tr1::tuple<A1> > {
- public:
-  template <typename Function>
-  static R Invoke(Function function, const ::std::tr1::tuple<A1>& args) {
-    using ::std::tr1::get;
-    return function(get<0>(args));
-  }
-
-  template <class Class, typename MethodPtr>
-  static R InvokeMethod(Class* obj_ptr,
-                        MethodPtr method_ptr,
-                        const ::std::tr1::tuple<A1>& args) {
-    using ::std::tr1::get;
-    return (obj_ptr->*method_ptr)(get<0>(args));
-  }
-};
-
-template <typename R, typename A1, typename A2>
-class InvokeHelper<R, ::std::tr1::tuple<A1, A2> > {
- public:
-  template <typename Function>
-  static R Invoke(Function function, const ::std::tr1::tuple<A1, A2>& args) {
-    using ::std::tr1::get;
-    return function(get<0>(args), get<1>(args));
-  }
-
-  template <class Class, typename MethodPtr>
-  static R InvokeMethod(Class* obj_ptr,
-                        MethodPtr method_ptr,
-                        const ::std::tr1::tuple<A1, A2>& args) {
-    using ::std::tr1::get;
-    return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args));
-  }
-};
-
-template <typename R, typename A1, typename A2, typename A3>
-class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3> > {
- public:
-  template <typename Function>
-  static R Invoke(Function function, const ::std::tr1::tuple<A1, A2,
-      A3>& args) {
-    using ::std::tr1::get;
-    return function(get<0>(args), get<1>(args), get<2>(args));
-  }
-
-  template <class Class, typename MethodPtr>
-  static R InvokeMethod(Class* obj_ptr,
-                        MethodPtr method_ptr,
-                        const ::std::tr1::tuple<A1, A2, A3>& args) {
-    using ::std::tr1::get;
-    return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args));
-  }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4>
-class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4> > {
- public:
-  template <typename Function>
-  static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3,
-      A4>& args) {
-    using ::std::tr1::get;
-    return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args));
-  }
-
-  template <class Class, typename MethodPtr>
-  static R InvokeMethod(Class* obj_ptr,
-                        MethodPtr method_ptr,
-                        const ::std::tr1::tuple<A1, A2, A3, A4>& args) {
-    using ::std::tr1::get;
-    return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
-        get<3>(args));
-  }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
-    typename A5>
-class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5> > {
- public:
-  template <typename Function>
-  static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
-      A5>& args) {
-    using ::std::tr1::get;
-    return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
-        get<4>(args));
-  }
-
-  template <class Class, typename MethodPtr>
-  static R InvokeMethod(Class* obj_ptr,
-                        MethodPtr method_ptr,
-                        const ::std::tr1::tuple<A1, A2, A3, A4, A5>& args) {
-    using ::std::tr1::get;
-    return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
-        get<3>(args), get<4>(args));
-  }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
-    typename A5, typename A6>
-class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6> > {
- public:
-  template <typename Function>
-  static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
-      A5, A6>& args) {
-    using ::std::tr1::get;
-    return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
-        get<4>(args), get<5>(args));
-  }
-
-  template <class Class, typename MethodPtr>
-  static R InvokeMethod(Class* obj_ptr,
-                        MethodPtr method_ptr,
-                        const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6>& args) {
-    using ::std::tr1::get;
-    return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
-        get<3>(args), get<4>(args), get<5>(args));
-  }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
-    typename A5, typename A6, typename A7>
-class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7> > {
- public:
-  template <typename Function>
-  static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
-      A5, A6, A7>& args) {
-    using ::std::tr1::get;
-    return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
-        get<4>(args), get<5>(args), get<6>(args));
-  }
-
-  template <class Class, typename MethodPtr>
-  static R InvokeMethod(Class* obj_ptr,
-                        MethodPtr method_ptr,
-                        const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6,
-                            A7>& args) {
-    using ::std::tr1::get;
-    return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
-        get<3>(args), get<4>(args), get<5>(args), get<6>(args));
-  }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
-    typename A5, typename A6, typename A7, typename A8>
-class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
- public:
-  template <typename Function>
-  static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
-      A5, A6, A7, A8>& args) {
-    using ::std::tr1::get;
-    return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
-        get<4>(args), get<5>(args), get<6>(args), get<7>(args));
-  }
-
-  template <class Class, typename MethodPtr>
-  static R InvokeMethod(Class* obj_ptr,
-                        MethodPtr method_ptr,
-                        const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7,
-                            A8>& args) {
-    using ::std::tr1::get;
-    return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
-        get<3>(args), get<4>(args), get<5>(args), get<6>(args), get<7>(args));
-  }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
-    typename A5, typename A6, typename A7, typename A8, typename A9>
-class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
- public:
-  template <typename Function>
-  static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
-      A5, A6, A7, A8, A9>& args) {
-    using ::std::tr1::get;
-    return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
-        get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args));
-  }
-
-  template <class Class, typename MethodPtr>
-  static R InvokeMethod(Class* obj_ptr,
-                        MethodPtr method_ptr,
-                        const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8,
-                            A9>& args) {
-    using ::std::tr1::get;
-    return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
-        get<3>(args), get<4>(args), get<5>(args), get<6>(args), get<7>(args),
-        get<8>(args));
-  }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
-    typename A5, typename A6, typename A7, typename A8, typename A9,
-    typename A10>
-class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
-    A10> > {
- public:
-  template <typename Function>
-  static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4,
-      A5, A6, A7, A8, A9, A10>& args) {
-    using ::std::tr1::get;
-    return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args),
-        get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args),
-        get<9>(args));
-  }
-
-  template <class Class, typename MethodPtr>
-  static R InvokeMethod(Class* obj_ptr,
-                        MethodPtr method_ptr,
-                        const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8,
-                            A9, A10>& args) {
-    using ::std::tr1::get;
-    return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args),
-        get<3>(args), get<4>(args), get<5>(args), get<6>(args), get<7>(args),
-        get<8>(args), get<9>(args));
-  }
-};
-
-// CallableHelper has static methods for invoking "callables",
-// i.e. function pointers and functors.  It uses overloading to
-// provide a uniform interface for invoking different kinds of
-// callables.  In particular, you can use:
-//
-//   CallableHelper<R>::Call(callable, a1, a2, ..., an)
-//
-// to invoke an n-ary callable, where R is its return type.  If an
-// argument, say a2, needs to be passed by reference, you should write
-// ByRef(a2) instead of a2 in the above expression.
-template <typename R>
-class CallableHelper {
- public:
-  // Calls a nullary callable.
-  template <typename Function>
-  static R Call(Function function) { return function(); }
-
-  // Calls a unary callable.
-
-  // We deliberately pass a1 by value instead of const reference here
-  // in case it is a C-string literal.  If we had declared the
-  // parameter as 'const A1& a1' and write Call(function, "Hi"), the
-  // compiler would've thought A1 is 'char[3]', which causes trouble
-  // when you need to copy a value of type A1.  By declaring the
-  // parameter as 'A1 a1', the compiler will correctly infer that A1
-  // is 'const char*' when it sees Call(function, "Hi").
-  //
-  // Since this function is defined inline, the compiler can get rid
-  // of the copying of the arguments.  Therefore the performance won't
-  // be hurt.
-  template <typename Function, typename A1>
-  static R Call(Function function, A1 a1) { return function(a1); }
-
-  // Calls a binary callable.
-  template <typename Function, typename A1, typename A2>
-  static R Call(Function function, A1 a1, A2 a2) {
-    return function(a1, a2);
-  }
-
-  // Calls a ternary callable.
-  template <typename Function, typename A1, typename A2, typename A3>
-  static R Call(Function function, A1 a1, A2 a2, A3 a3) {
-    return function(a1, a2, a3);
-  }
-
-  // Calls a 4-ary callable.
-  template <typename Function, typename A1, typename A2, typename A3,
-      typename A4>
-  static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4) {
-    return function(a1, a2, a3, a4);
-  }
-
-  // Calls a 5-ary callable.
-  template <typename Function, typename A1, typename A2, typename A3,
-      typename A4, typename A5>
-  static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
-    return function(a1, a2, a3, a4, a5);
-  }
-
-  // Calls a 6-ary callable.
-  template <typename Function, typename A1, typename A2, typename A3,
-      typename A4, typename A5, typename A6>
-  static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) {
-    return function(a1, a2, a3, a4, a5, a6);
-  }
-
-  // Calls a 7-ary callable.
-  template <typename Function, typename A1, typename A2, typename A3,
-      typename A4, typename A5, typename A6, typename A7>
-  static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
-      A7 a7) {
-    return function(a1, a2, a3, a4, a5, a6, a7);
-  }
-
-  // Calls a 8-ary callable.
-  template <typename Function, typename A1, typename A2, typename A3,
-      typename A4, typename A5, typename A6, typename A7, typename A8>
-  static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
-      A7 a7, A8 a8) {
-    return function(a1, a2, a3, a4, a5, a6, a7, a8);
-  }
-
-  // Calls a 9-ary callable.
-  template <typename Function, typename A1, typename A2, typename A3,
-      typename A4, typename A5, typename A6, typename A7, typename A8,
-      typename A9>
-  static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
-      A7 a7, A8 a8, A9 a9) {
-    return function(a1, a2, a3, a4, a5, a6, a7, a8, a9);
-  }
-
-  // Calls a 10-ary callable.
-  template <typename Function, typename A1, typename A2, typename A3,
-      typename A4, typename A5, typename A6, typename A7, typename A8,
-      typename A9, typename A10>
-  static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
-      A7 a7, A8 a8, A9 a9, A10 a10) {
-    return function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
-  }
-
-};  // class CallableHelper
-
-// An INTERNAL macro for extracting the type of a tuple field.  It's
-// subject to change without notice - DO NOT USE IN USER CODE!
-#define GMOCK_FIELD_(Tuple, N) \
-    typename ::std::tr1::tuple_element<N, Tuple>::type
-
-// SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::type is the
-// type of an n-ary function whose i-th (1-based) argument type is the
-// k{i}-th (0-based) field of ArgumentTuple, which must be a tuple
-// type, and whose return type is Result.  For example,
-//   SelectArgs<int, ::std::tr1::tuple<bool, char, double, long>, 0, 3>::type
-// is int(bool, long).
-//
-// SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::Select(args)
-// returns the selected fields (k1, k2, ..., k_n) of args as a tuple.
-// For example,
-//   SelectArgs<int, ::std::tr1::tuple<bool, char, double>, 2, 0>::Select(
-//       ::std::tr1::make_tuple(true, 'a', 2.5))
-// returns ::std::tr1::tuple (2.5, true).
-//
-// The numbers in list k1, k2, ..., k_n must be >= 0, where n can be
-// in the range [0, 10].  Duplicates are allowed and they don't have
-// to be in an ascending or descending order.
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
-    int k4, int k5, int k6, int k7, int k8, int k9, int k10>
-class SelectArgs {
- public:
-  typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
-      GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
-      GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
-      GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
-      GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9),
-      GMOCK_FIELD_(ArgumentTuple, k10));
-  typedef typename Function<type>::ArgumentTuple SelectedArgs;
-  static SelectedArgs Select(const ArgumentTuple& args) {
-    using ::std::tr1::get;
-    return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
-        get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
-        get<k8>(args), get<k9>(args), get<k10>(args));
-  }
-};
-
-template <typename Result, typename ArgumentTuple>
-class SelectArgs<Result, ArgumentTuple,
-                 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
- public:
-  typedef Result type();
-  typedef typename Function<type>::ArgumentTuple SelectedArgs;
-  static SelectedArgs Select(const ArgumentTuple& /* args */) {
-    using ::std::tr1::get;
-    return SelectedArgs();
-  }
-};
-
-template <typename Result, typename ArgumentTuple, int k1>
-class SelectArgs<Result, ArgumentTuple,
-                 k1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
- public:
-  typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1));
-  typedef typename Function<type>::ArgumentTuple SelectedArgs;
-  static SelectedArgs Select(const ArgumentTuple& args) {
-    using ::std::tr1::get;
-    return SelectedArgs(get<k1>(args));
-  }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2>
-class SelectArgs<Result, ArgumentTuple,
-                 k1, k2, -1, -1, -1, -1, -1, -1, -1, -1> {
- public:
-  typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
-      GMOCK_FIELD_(ArgumentTuple, k2));
-  typedef typename Function<type>::ArgumentTuple SelectedArgs;
-  static SelectedArgs Select(const ArgumentTuple& args) {
-    using ::std::tr1::get;
-    return SelectedArgs(get<k1>(args), get<k2>(args));
-  }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3>
-class SelectArgs<Result, ArgumentTuple,
-                 k1, k2, k3, -1, -1, -1, -1, -1, -1, -1> {
- public:
-  typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
-      GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3));
-  typedef typename Function<type>::ArgumentTuple SelectedArgs;
-  static SelectedArgs Select(const ArgumentTuple& args) {
-    using ::std::tr1::get;
-    return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args));
-  }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
-    int k4>
-class SelectArgs<Result, ArgumentTuple,
-                 k1, k2, k3, k4, -1, -1, -1, -1, -1, -1> {
- public:
-  typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
-      GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
-      GMOCK_FIELD_(ArgumentTuple, k4));
-  typedef typename Function<type>::ArgumentTuple SelectedArgs;
-  static SelectedArgs Select(const ArgumentTuple& args) {
-    using ::std::tr1::get;
-    return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
-        get<k4>(args));
-  }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
-    int k4, int k5>
-class SelectArgs<Result, ArgumentTuple,
-                 k1, k2, k3, k4, k5, -1, -1, -1, -1, -1> {
- public:
-  typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
-      GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
-      GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5));
-  typedef typename Function<type>::ArgumentTuple SelectedArgs;
-  static SelectedArgs Select(const ArgumentTuple& args) {
-    using ::std::tr1::get;
-    return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
-        get<k4>(args), get<k5>(args));
-  }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
-    int k4, int k5, int k6>
-class SelectArgs<Result, ArgumentTuple,
-                 k1, k2, k3, k4, k5, k6, -1, -1, -1, -1> {
- public:
-  typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
-      GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
-      GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
-      GMOCK_FIELD_(ArgumentTuple, k6));
-  typedef typename Function<type>::ArgumentTuple SelectedArgs;
-  static SelectedArgs Select(const ArgumentTuple& args) {
-    using ::std::tr1::get;
-    return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
-        get<k4>(args), get<k5>(args), get<k6>(args));
-  }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
-    int k4, int k5, int k6, int k7>
-class SelectArgs<Result, ArgumentTuple,
-                 k1, k2, k3, k4, k5, k6, k7, -1, -1, -1> {
- public:
-  typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
-      GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
-      GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
-      GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7));
-  typedef typename Function<type>::ArgumentTuple SelectedArgs;
-  static SelectedArgs Select(const ArgumentTuple& args) {
-    using ::std::tr1::get;
-    return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
-        get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args));
-  }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
-    int k4, int k5, int k6, int k7, int k8>
-class SelectArgs<Result, ArgumentTuple,
-                 k1, k2, k3, k4, k5, k6, k7, k8, -1, -1> {
- public:
-  typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
-      GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
-      GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
-      GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
-      GMOCK_FIELD_(ArgumentTuple, k8));
-  typedef typename Function<type>::ArgumentTuple SelectedArgs;
-  static SelectedArgs Select(const ArgumentTuple& args) {
-    using ::std::tr1::get;
-    return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
-        get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
-        get<k8>(args));
-  }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
-    int k4, int k5, int k6, int k7, int k8, int k9>
-class SelectArgs<Result, ArgumentTuple,
-                 k1, k2, k3, k4, k5, k6, k7, k8, k9, -1> {
- public:
-  typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
-      GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
-      GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
-      GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
-      GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9));
-  typedef typename Function<type>::ArgumentTuple SelectedArgs;
-  static SelectedArgs Select(const ArgumentTuple& args) {
-    using ::std::tr1::get;
-    return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
-        get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
-        get<k8>(args), get<k9>(args));
-  }
-};
-
-#undef GMOCK_FIELD_
-
-// Implements the WithArgs action.
-template <typename InnerAction, int k1 = -1, int k2 = -1, int k3 = -1,
-    int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1,
-    int k9 = -1, int k10 = -1>
-class WithArgsAction {
- public:
-  explicit WithArgsAction(const InnerAction& action) : action_(action) {}
-
-  template <typename F>
-  operator Action<F>() const { return MakeAction(new Impl<F>(action_)); }
-
- private:
-  template <typename F>
-  class Impl : public ActionInterface<F> {
-   public:
-    typedef typename Function<F>::Result Result;
-    typedef typename Function<F>::ArgumentTuple ArgumentTuple;
-
-    explicit Impl(const InnerAction& action) : action_(action) {}
-
-    virtual Result Perform(const ArgumentTuple& args) {
-      return action_.Perform(SelectArgs<Result, ArgumentTuple, k1, k2, k3, k4,
-          k5, k6, k7, k8, k9, k10>::Select(args));
-    }
-
-   private:
-    typedef typename SelectArgs<Result, ArgumentTuple,
-        k1, k2, k3, k4, k5, k6, k7, k8, k9, k10>::type InnerFunctionType;
-
-    Action<InnerFunctionType> action_;
-  };
-
-  const InnerAction action_;
-};
-
-// A macro from the ACTION* family (defined later in this file)
-// defines an action that can be used in a mock function.  Typically,
-// these actions only care about a subset of the arguments of the mock
-// function.  For example, if such an action only uses the second
-// argument, it can be used in any mock function that takes >= 2
-// arguments where the type of the second argument is compatible.
-//
-// Therefore, the action implementation must be prepared to take more
-// arguments than it needs.  The ExcessiveArg type is used to
-// represent those excessive arguments.  In order to keep the compiler
-// error messages tractable, we define it in the testing namespace
-// instead of testing::internal.  However, this is an INTERNAL TYPE
-// and subject to change without notice, so a user MUST NOT USE THIS
-// TYPE DIRECTLY.
-struct ExcessiveArg {};
-
-// A helper class needed for implementing the ACTION* macros.
-template <typename Result, class Impl>
-class ActionHelper {
- public:
-  static Result Perform(Impl* impl, const ::std::tr1::tuple<>& args) {
-    using ::std::tr1::get;
-    return impl->template gmock_PerformImpl<>(args, ExcessiveArg(),
-        ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
-        ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
-        ExcessiveArg());
-  }
-
-  template <typename A0>
-  static Result Perform(Impl* impl, const ::std::tr1::tuple<A0>& args) {
-    using ::std::tr1::get;
-    return impl->template gmock_PerformImpl<A0>(args, get<0>(args),
-        ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
-        ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
-        ExcessiveArg());
-  }
-
-  template <typename A0, typename A1>
-  static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1>& args) {
-    using ::std::tr1::get;
-    return impl->template gmock_PerformImpl<A0, A1>(args, get<0>(args),
-        get<1>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
-        ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
-        ExcessiveArg());
-  }
-
-  template <typename A0, typename A1, typename A2>
-  static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2>& args) {
-    using ::std::tr1::get;
-    return impl->template gmock_PerformImpl<A0, A1, A2>(args, get<0>(args),
-        get<1>(args), get<2>(args), ExcessiveArg(), ExcessiveArg(),
-        ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
-        ExcessiveArg());
-  }
-
-  template <typename A0, typename A1, typename A2, typename A3>
-  static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2,
-      A3>& args) {
-    using ::std::tr1::get;
-    return impl->template gmock_PerformImpl<A0, A1, A2, A3>(args, get<0>(args),
-        get<1>(args), get<2>(args), get<3>(args), ExcessiveArg(),
-        ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
-        ExcessiveArg());
-  }
-
-  template <typename A0, typename A1, typename A2, typename A3, typename A4>
-  static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3,
-      A4>& args) {
-    using ::std::tr1::get;
-    return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4>(args,
-        get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
-        ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
-        ExcessiveArg());
-  }
-
-  template <typename A0, typename A1, typename A2, typename A3, typename A4,
-      typename A5>
-  static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4,
-      A5>& args) {
-    using ::std::tr1::get;
-    return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5>(args,
-        get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
-        get<5>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
-        ExcessiveArg());
-  }
-
-  template <typename A0, typename A1, typename A2, typename A3, typename A4,
-      typename A5, typename A6>
-  static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4,
-      A5, A6>& args) {
-    using ::std::tr1::get;
-    return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6>(args,
-        get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
-        get<5>(args), get<6>(args), ExcessiveArg(), ExcessiveArg(),
-        ExcessiveArg());
-  }
-
-  template <typename A0, typename A1, typename A2, typename A3, typename A4,
-      typename A5, typename A6, typename A7>
-  static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4,
-      A5, A6, A7>& args) {
-    using ::std::tr1::get;
-    return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6,
-        A7>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
-        get<4>(args), get<5>(args), get<6>(args), get<7>(args), ExcessiveArg(),
-        ExcessiveArg());
-  }
-
-  template <typename A0, typename A1, typename A2, typename A3, typename A4,
-      typename A5, typename A6, typename A7, typename A8>
-  static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4,
-      A5, A6, A7, A8>& args) {
-    using ::std::tr1::get;
-    return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7,
-        A8>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
-        get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args),
-        ExcessiveArg());
-  }
-
-  template <typename A0, typename A1, typename A2, typename A3, typename A4,
-      typename A5, typename A6, typename A7, typename A8, typename A9>
-  static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4,
-      A5, A6, A7, A8, A9>& args) {
-    using ::std::tr1::get;
-    return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7, A8,
-        A9>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
-        get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args),
-        get<9>(args));
-  }
-};
-
-}  // namespace internal
-
-// Various overloads for Invoke().
-
-// WithArgs<N1, N2, ..., Nk>(an_action) creates an action that passes
-// the selected arguments of the mock function to an_action and
-// performs it.  It serves as an adaptor between actions with
-// different argument lists.  C++ doesn't support default arguments for
-// function templates, so we have to overload it.
-template <int k1, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1>
-WithArgs(const InnerAction& action) {
-  return internal::WithArgsAction<InnerAction, k1>(action);
-}
-
-template <int k1, int k2, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2>
-WithArgs(const InnerAction& action) {
-  return internal::WithArgsAction<InnerAction, k1, k2>(action);
-}
-
-template <int k1, int k2, int k3, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3>
-WithArgs(const InnerAction& action) {
-  return internal::WithArgsAction<InnerAction, k1, k2, k3>(action);
-}
-
-template <int k1, int k2, int k3, int k4, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4>
-WithArgs(const InnerAction& action) {
-  return internal::WithArgsAction<InnerAction, k1, k2, k3, k4>(action);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5>
-WithArgs(const InnerAction& action) {
-  return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5>(action);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6>
-WithArgs(const InnerAction& action) {
-  return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6>(action);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7,
-    typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7>
-WithArgs(const InnerAction& action) {
-  return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6,
-      k7>(action);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
-    typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8>
-WithArgs(const InnerAction& action) {
-  return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7,
-      k8>(action);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
-    int k9, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8, k9>
-WithArgs(const InnerAction& action) {
-  return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
-      k9>(action);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
-    int k9, int k10, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
-    k9, k10>
-WithArgs(const InnerAction& action) {
-  return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
-      k9, k10>(action);
-}
-
-// Creates an action that does actions a1, a2, ..., sequentially in
-// each invocation.
-template <typename Action1, typename Action2>
-inline internal::DoBothAction<Action1, Action2>
-DoAll(Action1 a1, Action2 a2) {
-  return internal::DoBothAction<Action1, Action2>(a1, a2);
-}
-
-template <typename Action1, typename Action2, typename Action3>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
-    Action3> >
-DoAll(Action1 a1, Action2 a2, Action3 a3) {
-  return DoAll(a1, DoAll(a2, a3));
-}
-
-template <typename Action1, typename Action2, typename Action3,
-    typename Action4>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
-    internal::DoBothAction<Action3, Action4> > >
-DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4) {
-  return DoAll(a1, DoAll(a2, a3, a4));
-}
-
-template <typename Action1, typename Action2, typename Action3,
-    typename Action4, typename Action5>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
-    internal::DoBothAction<Action3, internal::DoBothAction<Action4,
-    Action5> > > >
-DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5) {
-  return DoAll(a1, DoAll(a2, a3, a4, a5));
-}
-
-template <typename Action1, typename Action2, typename Action3,
-    typename Action4, typename Action5, typename Action6>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
-    internal::DoBothAction<Action3, internal::DoBothAction<Action4,
-    internal::DoBothAction<Action5, Action6> > > > >
-DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6) {
-  return DoAll(a1, DoAll(a2, a3, a4, a5, a6));
-}
-
-template <typename Action1, typename Action2, typename Action3,
-    typename Action4, typename Action5, typename Action6, typename Action7>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
-    internal::DoBothAction<Action3, internal::DoBothAction<Action4,
-    internal::DoBothAction<Action5, internal::DoBothAction<Action6,
-    Action7> > > > > >
-DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
-    Action7 a7) {
-  return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7));
-}
-
-template <typename Action1, typename Action2, typename Action3,
-    typename Action4, typename Action5, typename Action6, typename Action7,
-    typename Action8>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
-    internal::DoBothAction<Action3, internal::DoBothAction<Action4,
-    internal::DoBothAction<Action5, internal::DoBothAction<Action6,
-    internal::DoBothAction<Action7, Action8> > > > > > >
-DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
-    Action7 a7, Action8 a8) {
-  return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8));
-}
-
-template <typename Action1, typename Action2, typename Action3,
-    typename Action4, typename Action5, typename Action6, typename Action7,
-    typename Action8, typename Action9>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
-    internal::DoBothAction<Action3, internal::DoBothAction<Action4,
-    internal::DoBothAction<Action5, internal::DoBothAction<Action6,
-    internal::DoBothAction<Action7, internal::DoBothAction<Action8,
-    Action9> > > > > > > >
-DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
-    Action7 a7, Action8 a8, Action9 a9) {
-  return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9));
-}
-
-template <typename Action1, typename Action2, typename Action3,
-    typename Action4, typename Action5, typename Action6, typename Action7,
-    typename Action8, typename Action9, typename Action10>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
-    internal::DoBothAction<Action3, internal::DoBothAction<Action4,
-    internal::DoBothAction<Action5, internal::DoBothAction<Action6,
-    internal::DoBothAction<Action7, internal::DoBothAction<Action8,
-    internal::DoBothAction<Action9, Action10> > > > > > > > >
-DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
-    Action7 a7, Action8 a8, Action9 a9, Action10 a10) {
-  return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9, a10));
-}
-
-}  // namespace testing
-
-// The ACTION* family of macros can be used in a namespace scope to
-// define custom actions easily.  The syntax:
-//
-//   ACTION(name) { statements; }
-//
-// will define an action with the given name that executes the
-// statements.  The value returned by the statements will be used as
-// the return value of the action.  Inside the statements, you can
-// refer to the K-th (0-based) argument of the mock function by
-// 'argK', and refer to its type by 'argK_type'.  For example:
-//
-//   ACTION(IncrementArg1) {
-//     arg1_type temp = arg1;
-//     return ++(*temp);
-//   }
-//
-// allows you to write
-//
-//   ...WillOnce(IncrementArg1());
-//
-// You can also refer to the entire argument tuple and its type by
-// 'args' and 'args_type', and refer to the mock function type and its
-// return type by 'function_type' and 'return_type'.
-//
-// Note that you don't need to specify the types of the mock function
-// arguments.  However rest assured that your code is still type-safe:
-// you'll get a compiler error if *arg1 doesn't support the ++
-// operator, or if the type of ++(*arg1) isn't compatible with the
-// mock function's return type, for example.
-//
-// Sometimes you'll want to parameterize the action.   For that you can use
-// another macro:
-//
-//   ACTION_P(name, param_name) { statements; }
-//
-// For example:
-//
-//   ACTION_P(Add, n) { return arg0 + n; }
-//
-// will allow you to write:
-//
-//   ...WillOnce(Add(5));
-//
-// Note that you don't need to provide the type of the parameter
-// either.  If you need to reference the type of a parameter named
-// 'foo', you can write 'foo_type'.  For example, in the body of
-// ACTION_P(Add, n) above, you can write 'n_type' to refer to the type
-// of 'n'.
-//
-// We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P10 to support
-// multi-parameter actions.
-//
-// For the purpose of typing, you can view
-//
-//   ACTION_Pk(Foo, p1, ..., pk) { ... }
-//
-// as shorthand for
-//
-//   template <typename p1_type, ..., typename pk_type>
-//   FooActionPk<p1_type, ..., pk_type> Foo(p1_type p1, ..., pk_type pk) { ... }
-//
-// In particular, you can provide the template type arguments
-// explicitly when invoking Foo(), as in Foo<long, bool>(5, false);
-// although usually you can rely on the compiler to infer the types
-// for you automatically.  You can assign the result of expression
-// Foo(p1, ..., pk) to a variable of type FooActionPk<p1_type, ...,
-// pk_type>.  This can be useful when composing actions.
-//
-// You can also overload actions with different numbers of parameters:
-//
-//   ACTION_P(Plus, a) { ... }
-//   ACTION_P2(Plus, a, b) { ... }
-//
-// While it's tempting to always use the ACTION* macros when defining
-// a new action, you should also consider implementing ActionInterface
-// or using MakePolymorphicAction() instead, especially if you need to
-// use the action a lot.  While these approaches require more work,
-// they give you more control on the types of the mock function
-// arguments and the action parameters, which in general leads to
-// better compiler error messages that pay off in the long run.  They
-// also allow overloading actions based on parameter types (as opposed
-// to just based on the number of parameters).
-//
-// CAVEAT:
-//
-// ACTION*() can only be used in a namespace scope.  The reason is
-// that C++ doesn't yet allow function-local types to be used to
-// instantiate templates.  The up-coming C++0x standard will fix this.
-// Once that's done, we'll consider supporting using ACTION*() inside
-// a function.
-//
-// MORE INFORMATION:
-//
-// To learn more about using these macros, please search for 'ACTION'
-// on http://code.google.com/p/googlemock/wiki/CookBook.
-
-// An internal macro needed for implementing ACTION*().
-#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\
-    const args_type& args GTEST_ATTRIBUTE_UNUSED_,\
-    arg0_type arg0 GTEST_ATTRIBUTE_UNUSED_,\
-    arg1_type arg1 GTEST_ATTRIBUTE_UNUSED_,\
-    arg2_type arg2 GTEST_ATTRIBUTE_UNUSED_,\
-    arg3_type arg3 GTEST_ATTRIBUTE_UNUSED_,\
-    arg4_type arg4 GTEST_ATTRIBUTE_UNUSED_,\
-    arg5_type arg5 GTEST_ATTRIBUTE_UNUSED_,\
-    arg6_type arg6 GTEST_ATTRIBUTE_UNUSED_,\
-    arg7_type arg7 GTEST_ATTRIBUTE_UNUSED_,\
-    arg8_type arg8 GTEST_ATTRIBUTE_UNUSED_,\
-    arg9_type arg9 GTEST_ATTRIBUTE_UNUSED_
-
-// Sometimes you want to give an action explicit template parameters
-// that cannot be inferred from its value parameters.  ACTION() and
-// ACTION_P*() don't support that.  ACTION_TEMPLATE() remedies that
-// and can be viewed as an extension to ACTION() and ACTION_P*().
-//
-// The syntax:
-//
-//   ACTION_TEMPLATE(ActionName,
-//                   HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_m),
-//                   AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; }
-//
-// defines an action template that takes m explicit template
-// parameters and n value parameters.  name_i is the name of the i-th
-// template parameter, and kind_i specifies whether it's a typename,
-// an integral constant, or a template.  p_i is the name of the i-th
-// value parameter.
-//
-// Example:
-//
-//   // DuplicateArg<k, T>(output) converts the k-th argument of the mock
-//   // function to type T and copies it to *output.
-//   ACTION_TEMPLATE(DuplicateArg,
-//                   HAS_2_TEMPLATE_PARAMS(int, k, typename, T),
-//                   AND_1_VALUE_PARAMS(output)) {
-//     *output = T(std::tr1::get<k>(args));
-//   }
-//   ...
-//     int n;
-//     EXPECT_CALL(mock, Foo(_, _))
-//         .WillOnce(DuplicateArg<1, unsigned char>(&n));
-//
-// To create an instance of an action template, write:
-//
-//   ActionName<t1, ..., t_m>(v1, ..., v_n)
-//
-// where the ts are the template arguments and the vs are the value
-// arguments.  The value argument types are inferred by the compiler.
-// If you want to explicitly specify the value argument types, you can
-// provide additional template arguments:
-//
-//   ActionName<t1, ..., t_m, u1, ..., u_k>(v1, ..., v_n)
-//
-// where u_i is the desired type of v_i.
-//
-// ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded on the
-// number of value parameters, but not on the number of template
-// parameters.  Without the restriction, the meaning of the following
-// is unclear:
-//
-//   OverloadedAction<int, bool>(x);
-//
-// Are we using a single-template-parameter action where 'bool' refers
-// to the type of x, or are we using a two-template-parameter action
-// where the compiler is asked to infer the type of x?
-//
-// Implementation notes:
-//
-// GMOCK_INTERNAL_*_HAS_m_TEMPLATE_PARAMS and
-// GMOCK_INTERNAL_*_AND_n_VALUE_PARAMS are internal macros for
-// implementing ACTION_TEMPLATE.  The main trick we use is to create
-// new macro invocations when expanding a macro.  For example, we have
-//
-//   #define ACTION_TEMPLATE(name, template_params, value_params)
-//       ... GMOCK_INTERNAL_DECL_##template_params ...
-//
-// which causes ACTION_TEMPLATE(..., HAS_1_TEMPLATE_PARAMS(typename, T), ...)
-// to expand to
-//
-//       ... GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(typename, T) ...
-//
-// Since GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS is a macro, the
-// preprocessor will continue to expand it to
-//
-//       ... typename T ...
-//
-// This technique conforms to the C++ standard and is portable.  It
-// allows us to implement action templates using O(N) code, where N is
-// the maximum number of template/value parameters supported.  Without
-// using it, we'd have to devote O(N^2) amount of code to implement all
-// combinations of m and n.
-
-// Declares the template parameters.
-#define GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(kind0, name0) kind0 name0
-#define GMOCK_INTERNAL_DECL_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \
-    name1) kind0 name0, kind1 name1
-#define GMOCK_INTERNAL_DECL_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
-    kind2, name2) kind0 name0, kind1 name1, kind2 name2
-#define GMOCK_INTERNAL_DECL_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
-    kind2, name2, kind3, name3) kind0 name0, kind1 name1, kind2 name2, \
-    kind3 name3
-#define GMOCK_INTERNAL_DECL_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
-    kind2, name2, kind3, name3, kind4, name4) kind0 name0, kind1 name1, \
-    kind2 name2, kind3 name3, kind4 name4
-#define GMOCK_INTERNAL_DECL_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
-    kind2, name2, kind3, name3, kind4, name4, kind5, name5) kind0 name0, \
-    kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5
-#define GMOCK_INTERNAL_DECL_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
-    kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
-    name6) kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, \
-    kind5 name5, kind6 name6
-#define GMOCK_INTERNAL_DECL_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
-    kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
-    kind7, name7) kind0 name0, kind1 name1, kind2 name2, kind3 name3, \
-    kind4 name4, kind5 name5, kind6 name6, kind7 name7
-#define GMOCK_INTERNAL_DECL_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
-    kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
-    kind7, name7, kind8, name8) kind0 name0, kind1 name1, kind2 name2, \
-    kind3 name3, kind4 name4, kind5 name5, kind6 name6, kind7 name7, \
-    kind8 name8
-#define GMOCK_INTERNAL_DECL_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \
-    name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
-    name6, kind7, name7, kind8, name8, kind9, name9) kind0 name0, \
-    kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5, \
-    kind6 name6, kind7 name7, kind8 name8, kind9 name9
-
-// Lists the template parameters.
-#define GMOCK_INTERNAL_LIST_HAS_1_TEMPLATE_PARAMS(kind0, name0) name0
-#define GMOCK_INTERNAL_LIST_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \
-    name1) name0, name1
-#define GMOCK_INTERNAL_LIST_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
-    kind2, name2) name0, name1, name2
-#define GMOCK_INTERNAL_LIST_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
-    kind2, name2, kind3, name3) name0, name1, name2, name3
-#define GMOCK_INTERNAL_LIST_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
-    kind2, name2, kind3, name3, kind4, name4) name0, name1, name2, name3, \
-    name4
-#define GMOCK_INTERNAL_LIST_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
-    kind2, name2, kind3, name3, kind4, name4, kind5, name5) name0, name1, \
-    name2, name3, name4, name5
-#define GMOCK_INTERNAL_LIST_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
-    kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
-    name6) name0, name1, name2, name3, name4, name5, name6
-#define GMOCK_INTERNAL_LIST_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
-    kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
-    kind7, name7) name0, name1, name2, name3, name4, name5, name6, name7
-#define GMOCK_INTERNAL_LIST_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
-    kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
-    kind7, name7, kind8, name8) name0, name1, name2, name3, name4, name5, \
-    name6, name7, name8
-#define GMOCK_INTERNAL_LIST_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \
-    name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
-    name6, kind7, name7, kind8, name8, kind9, name9) name0, name1, name2, \
-    name3, name4, name5, name6, name7, name8, name9
-
-// Declares the types of value parameters.
-#define GMOCK_INTERNAL_DECL_TYPE_AND_0_VALUE_PARAMS()
-#define GMOCK_INTERNAL_DECL_TYPE_AND_1_VALUE_PARAMS(p0) , typename p0##_type
-#define GMOCK_INTERNAL_DECL_TYPE_AND_2_VALUE_PARAMS(p0, p1) , \
-    typename p0##_type, typename p1##_type
-#define GMOCK_INTERNAL_DECL_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , \
-    typename p0##_type, typename p1##_type, typename p2##_type
-#define GMOCK_INTERNAL_DECL_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \
-    typename p0##_type, typename p1##_type, typename p2##_type, \
-    typename p3##_type
-#define GMOCK_INTERNAL_DECL_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \
-    typename p0##_type, typename p1##_type, typename p2##_type, \
-    typename p3##_type, typename p4##_type
-#define GMOCK_INTERNAL_DECL_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \
-    typename p0##_type, typename p1##_type, typename p2##_type, \
-    typename p3##_type, typename p4##_type, typename p5##_type
-#define GMOCK_INTERNAL_DECL_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
-    p6) , typename p0##_type, typename p1##_type, typename p2##_type, \
-    typename p3##_type, typename p4##_type, typename p5##_type, \
-    typename p6##_type
-#define GMOCK_INTERNAL_DECL_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
-    p6, p7) , typename p0##_type, typename p1##_type, typename p2##_type, \
-    typename p3##_type, typename p4##_type, typename p5##_type, \
-    typename p6##_type, typename p7##_type
-#define GMOCK_INTERNAL_DECL_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
-    p6, p7, p8) , typename p0##_type, typename p1##_type, typename p2##_type, \
-    typename p3##_type, typename p4##_type, typename p5##_type, \
-    typename p6##_type, typename p7##_type, typename p8##_type
-#define GMOCK_INTERNAL_DECL_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
-    p6, p7, p8, p9) , typename p0##_type, typename p1##_type, \
-    typename p2##_type, typename p3##_type, typename p4##_type, \
-    typename p5##_type, typename p6##_type, typename p7##_type, \
-    typename p8##_type, typename p9##_type
-
-// Initializes the value parameters.
-#define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\
-    ()
-#define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\
-    (p0##_type gmock_p0) : p0(gmock_p0)
-#define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\
-    (p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), p1(gmock_p1)
-#define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\
-    (p0##_type gmock_p0, p1##_type gmock_p1, \
-        p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2)
-#define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\
-    (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
-        p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
-        p3(gmock_p3)
-#define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)\
-    (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
-        p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), \
-        p2(gmock_p2), p3(gmock_p3), p4(gmock_p4)
-#define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)\
-    (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
-        p3##_type gmock_p3, p4##_type gmock_p4, \
-        p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
-        p3(gmock_p3), p4(gmock_p4), p5(gmock_p5)
-#define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)\
-    (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
-        p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
-        p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
-        p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6)
-#define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)\
-    (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
-        p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
-        p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), \
-        p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
-        p7(gmock_p7)
-#define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
-    p7, p8)\
-    (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
-        p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
-        p6##_type gmock_p6, p7##_type gmock_p7, \
-        p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
-        p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
-        p8(gmock_p8)
-#define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
-    p7, p8, p9)\
-    (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
-        p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
-        p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
-        p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
-        p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
-        p8(gmock_p8), p9(gmock_p9)
-
-// Declares the fields for storing the value parameters.
-#define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS()
-#define GMOCK_INTERNAL_DEFN_AND_1_VALUE_PARAMS(p0) p0##_type p0;
-#define GMOCK_INTERNAL_DEFN_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0; \
-    p1##_type p1;
-#define GMOCK_INTERNAL_DEFN_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0; \
-    p1##_type p1; p2##_type p2;
-#define GMOCK_INTERNAL_DEFN_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0; \
-    p1##_type p1; p2##_type p2; p3##_type p3;
-#define GMOCK_INTERNAL_DEFN_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \
-    p4) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4;
-#define GMOCK_INTERNAL_DEFN_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \
-    p5) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
-    p5##_type p5;
-#define GMOCK_INTERNAL_DEFN_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
-    p6) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
-    p5##_type p5; p6##_type p6;
-#define GMOCK_INTERNAL_DEFN_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
-    p7) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
-    p5##_type p5; p6##_type p6; p7##_type p7;
-#define GMOCK_INTERNAL_DEFN_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
-    p7, p8) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \
-    p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8;
-#define GMOCK_INTERNAL_DEFN_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
-    p7, p8, p9) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \
-    p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; \
-    p9##_type p9;
-
-// Lists the value parameters.
-#define GMOCK_INTERNAL_LIST_AND_0_VALUE_PARAMS()
-#define GMOCK_INTERNAL_LIST_AND_1_VALUE_PARAMS(p0) p0
-#define GMOCK_INTERNAL_LIST_AND_2_VALUE_PARAMS(p0, p1) p0, p1
-#define GMOCK_INTERNAL_LIST_AND_3_VALUE_PARAMS(p0, p1, p2) p0, p1, p2
-#define GMOCK_INTERNAL_LIST_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0, p1, p2, p3
-#define GMOCK_INTERNAL_LIST_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) p0, p1, \
-    p2, p3, p4
-#define GMOCK_INTERNAL_LIST_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) p0, \
-    p1, p2, p3, p4, p5
-#define GMOCK_INTERNAL_LIST_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
-    p6) p0, p1, p2, p3, p4, p5, p6
-#define GMOCK_INTERNAL_LIST_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
-    p7) p0, p1, p2, p3, p4, p5, p6, p7
-#define GMOCK_INTERNAL_LIST_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
-    p7, p8) p0, p1, p2, p3, p4, p5, p6, p7, p8
-#define GMOCK_INTERNAL_LIST_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
-    p7, p8, p9) p0, p1, p2, p3, p4, p5, p6, p7, p8, p9
-
-// Lists the value parameter types.
-#define GMOCK_INTERNAL_LIST_TYPE_AND_0_VALUE_PARAMS()
-#define GMOCK_INTERNAL_LIST_TYPE_AND_1_VALUE_PARAMS(p0) , p0##_type
-#define GMOCK_INTERNAL_LIST_TYPE_AND_2_VALUE_PARAMS(p0, p1) , p0##_type, \
-    p1##_type
-#define GMOCK_INTERNAL_LIST_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , p0##_type, \
-    p1##_type, p2##_type
-#define GMOCK_INTERNAL_LIST_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \
-    p0##_type, p1##_type, p2##_type, p3##_type
-#define GMOCK_INTERNAL_LIST_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \
-    p0##_type, p1##_type, p2##_type, p3##_type, p4##_type
-#define GMOCK_INTERNAL_LIST_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \
-    p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type
-#define GMOCK_INTERNAL_LIST_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
-    p6) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type, \
-    p6##_type
-#define GMOCK_INTERNAL_LIST_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
-    p6, p7) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
-    p5##_type, p6##_type, p7##_type
-#define GMOCK_INTERNAL_LIST_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
-    p6, p7, p8) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
-    p5##_type, p6##_type, p7##_type, p8##_type
-#define GMOCK_INTERNAL_LIST_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
-    p6, p7, p8, p9) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
-    p5##_type, p6##_type, p7##_type, p8##_type, p9##_type
-
-// Declares the value parameters.
-#define GMOCK_INTERNAL_DECL_AND_0_VALUE_PARAMS()
-#define GMOCK_INTERNAL_DECL_AND_1_VALUE_PARAMS(p0) p0##_type p0
-#define GMOCK_INTERNAL_DECL_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0, \
-    p1##_type p1
-#define GMOCK_INTERNAL_DECL_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0, \
-    p1##_type p1, p2##_type p2
-#define GMOCK_INTERNAL_DECL_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0, \
-    p1##_type p1, p2##_type p2, p3##_type p3
-#define GMOCK_INTERNAL_DECL_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \
-    p4) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4
-#define GMOCK_INTERNAL_DECL_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \
-    p5) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
-    p5##_type p5
-#define GMOCK_INTERNAL_DECL_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
-    p6) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
-    p5##_type p5, p6##_type p6
-#define GMOCK_INTERNAL_DECL_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
-    p7) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
-    p5##_type p5, p6##_type p6, p7##_type p7
-#define GMOCK_INTERNAL_DECL_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
-    p7, p8) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
-    p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8
-#define GMOCK_INTERNAL_DECL_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
-    p7, p8, p9) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
-    p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \
-    p9##_type p9
-
-// The suffix of the class template implementing the action template.
-#define GMOCK_INTERNAL_COUNT_AND_0_VALUE_PARAMS()
-#define GMOCK_INTERNAL_COUNT_AND_1_VALUE_PARAMS(p0) P
-#define GMOCK_INTERNAL_COUNT_AND_2_VALUE_PARAMS(p0, p1) P2
-#define GMOCK_INTERNAL_COUNT_AND_3_VALUE_PARAMS(p0, p1, p2) P3
-#define GMOCK_INTERNAL_COUNT_AND_4_VALUE_PARAMS(p0, p1, p2, p3) P4
-#define GMOCK_INTERNAL_COUNT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) P5
-#define GMOCK_INTERNAL_COUNT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) P6
-#define GMOCK_INTERNAL_COUNT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6) P7
-#define GMOCK_INTERNAL_COUNT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
-    p7) P8
-#define GMOCK_INTERNAL_COUNT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
-    p7, p8) P9
-#define GMOCK_INTERNAL_COUNT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
-    p7, p8, p9) P10
-
-// The name of the class template implementing the action template.
-#define GMOCK_ACTION_CLASS_(name, value_params)\
-    GMOCK_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params)
-
-#define ACTION_TEMPLATE(name, template_params, value_params)\
-  template <GMOCK_INTERNAL_DECL_##template_params\
-            GMOCK_INTERNAL_DECL_TYPE_##value_params>\
-  class GMOCK_ACTION_CLASS_(name, value_params) {\
-   public:\
-    GMOCK_ACTION_CLASS_(name, value_params)\
-        GMOCK_INTERNAL_INIT_##value_params {}\
-    template <typename F>\
-    class gmock_Impl : public ::testing::ActionInterface<F> {\
-     public:\
-      typedef F function_type;\
-      typedef typename ::testing::internal::Function<F>::Result return_type;\
-      typedef typename ::testing::internal::Function<F>::ArgumentTuple\
-          args_type;\
-      explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\
-      virtual return_type Perform(const args_type& args) {\
-        return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
-            Perform(this, args);\
-      }\
-      template <typename arg0_type, typename arg1_type, typename arg2_type, \
-          typename arg3_type, typename arg4_type, typename arg5_type, \
-          typename arg6_type, typename arg7_type, typename arg8_type, \
-          typename arg9_type>\
-      return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
-          arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
-          arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
-          arg9_type arg9) const;\
-      GMOCK_INTERNAL_DEFN_##value_params\
-    };\
-    template <typename F> operator ::testing::Action<F>() const {\
-      return ::testing::Action<F>(\
-          new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\
-    }\
-    GMOCK_INTERNAL_DEFN_##value_params\
-  };\
-  template <GMOCK_INTERNAL_DECL_##template_params\
-            GMOCK_INTERNAL_DECL_TYPE_##value_params>\
-  inline GMOCK_ACTION_CLASS_(name, value_params)<\
-      GMOCK_INTERNAL_LIST_##template_params\
-      GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\
-          GMOCK_INTERNAL_DECL_##value_params) {\
-    return GMOCK_ACTION_CLASS_(name, value_params)<\
-        GMOCK_INTERNAL_LIST_##template_params\
-        GMOCK_INTERNAL_LIST_TYPE_##value_params>(\
-            GMOCK_INTERNAL_LIST_##value_params);\
-  }\
-  template <GMOCK_INTERNAL_DECL_##template_params\
-            GMOCK_INTERNAL_DECL_TYPE_##value_params>\
-  template <typename F>\
-  template <typename arg0_type, typename arg1_type, typename arg2_type,\
-      typename arg3_type, typename arg4_type, typename arg5_type,\
-      typename arg6_type, typename arg7_type, typename arg8_type,\
-      typename arg9_type>\
-  typename ::testing::internal::Function<F>::Result\
-      GMOCK_ACTION_CLASS_(name, value_params)<\
-          GMOCK_INTERNAL_LIST_##template_params\
-          GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl<F>::\
-              gmock_PerformImpl(\
-          GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION(name)\
-  class name##Action {\
-   public:\
-    name##Action() {}\
-    template <typename F>\
-    class gmock_Impl : public ::testing::ActionInterface<F> {\
-     public:\
-      typedef F function_type;\
-      typedef typename ::testing::internal::Function<F>::Result return_type;\
-      typedef typename ::testing::internal::Function<F>::ArgumentTuple\
-          args_type;\
-      gmock_Impl() {}\
-      virtual return_type Perform(const args_type& args) {\
-        return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
-            Perform(this, args);\
-      }\
-      template <typename arg0_type, typename arg1_type, typename arg2_type, \
-          typename arg3_type, typename arg4_type, typename arg5_type, \
-          typename arg6_type, typename arg7_type, typename arg8_type, \
-          typename arg9_type>\
-      return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
-          arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
-          arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
-          arg9_type arg9) const;\
-    };\
-    template <typename F> operator ::testing::Action<F>() const {\
-      return ::testing::Action<F>(new gmock_Impl<F>());\
-    }\
-  };\
-  inline name##Action name() {\
-    return name##Action();\
-  }\
-  template <typename F>\
-  template <typename arg0_type, typename arg1_type, typename arg2_type, \
-      typename arg3_type, typename arg4_type, typename arg5_type, \
-      typename arg6_type, typename arg7_type, typename arg8_type, \
-      typename arg9_type>\
-  typename ::testing::internal::Function<F>::Result\
-      name##Action::gmock_Impl<F>::gmock_PerformImpl(\
-          GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P(name, p0)\
-  template <typename p0##_type>\
-  class name##ActionP {\
-   public:\
-    name##ActionP(p0##_type gmock_p0) : p0(gmock_p0) {}\
-    template <typename F>\
-    class gmock_Impl : public ::testing::ActionInterface<F> {\
-     public:\
-      typedef F function_type;\
-      typedef typename ::testing::internal::Function<F>::Result return_type;\
-      typedef typename ::testing::internal::Function<F>::ArgumentTuple\
-          args_type;\
-      explicit gmock_Impl(p0##_type gmock_p0) : p0(gmock_p0) {}\
-      virtual return_type Perform(const args_type& args) {\
-        return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
-            Perform(this, args);\
-      }\
-      template <typename arg0_type, typename arg1_type, typename arg2_type, \
-          typename arg3_type, typename arg4_type, typename arg5_type, \
-          typename arg6_type, typename arg7_type, typename arg8_type, \
-          typename arg9_type>\
-      return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
-          arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
-          arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
-          arg9_type arg9) const;\
-      p0##_type p0;\
-    };\
-    template <typename F> operator ::testing::Action<F>() const {\
-      return ::testing::Action<F>(new gmock_Impl<F>(p0));\
-    }\
-    p0##_type p0;\
-  };\
-  template <typename p0##_type>\
-  inline name##ActionP<p0##_type> name(p0##_type p0) {\
-    return name##ActionP<p0##_type>(p0);\
-  }\
-  template <typename p0##_type>\
-  template <typename F>\
-  template <typename arg0_type, typename arg1_type, typename arg2_type, \
-      typename arg3_type, typename arg4_type, typename arg5_type, \
-      typename arg6_type, typename arg7_type, typename arg8_type, \
-      typename arg9_type>\
-  typename ::testing::internal::Function<F>::Result\
-      name##ActionP<p0##_type>::gmock_Impl<F>::gmock_PerformImpl(\
-          GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P2(name, p0, p1)\
-  template <typename p0##_type, typename p1##_type>\
-  class name##ActionP2 {\
-   public:\
-    name##ActionP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \
-        p1(gmock_p1) {}\
-    template <typename F>\
-    class gmock_Impl : public ::testing::ActionInterface<F> {\
-     public:\
-      typedef F function_type;\
-      typedef typename ::testing::internal::Function<F>::Result return_type;\
-      typedef typename ::testing::internal::Function<F>::ArgumentTuple\
-          args_type;\
-      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \
-          p1(gmock_p1) {}\
-      virtual return_type Perform(const args_type& args) {\
-        return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
-            Perform(this, args);\
-      }\
-      template <typename arg0_type, typename arg1_type, typename arg2_type, \
-          typename arg3_type, typename arg4_type, typename arg5_type, \
-          typename arg6_type, typename arg7_type, typename arg8_type, \
-          typename arg9_type>\
-      return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
-          arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
-          arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
-          arg9_type arg9) const;\
-      p0##_type p0;\
-      p1##_type p1;\
-    };\
-    template <typename F> operator ::testing::Action<F>() const {\
-      return ::testing::Action<F>(new gmock_Impl<F>(p0, p1));\
-    }\
-    p0##_type p0;\
-    p1##_type p1;\
-  };\
-  template <typename p0##_type, typename p1##_type>\
-  inline name##ActionP2<p0##_type, p1##_type> name(p0##_type p0, \
-      p1##_type p1) {\
-    return name##ActionP2<p0##_type, p1##_type>(p0, p1);\
-  }\
-  template <typename p0##_type, typename p1##_type>\
-  template <typename F>\
-  template <typename arg0_type, typename arg1_type, typename arg2_type, \
-      typename arg3_type, typename arg4_type, typename arg5_type, \
-      typename arg6_type, typename arg7_type, typename arg8_type, \
-      typename arg9_type>\
-  typename ::testing::internal::Function<F>::Result\
-      name##ActionP2<p0##_type, p1##_type>::gmock_Impl<F>::gmock_PerformImpl(\
-          GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P3(name, p0, p1, p2)\
-  template <typename p0##_type, typename p1##_type, typename p2##_type>\
-  class name##ActionP3 {\
-   public:\
-    name##ActionP3(p0##_type gmock_p0, p1##_type gmock_p1, \
-        p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\
-    template <typename F>\
-    class gmock_Impl : public ::testing::ActionInterface<F> {\
-     public:\
-      typedef F function_type;\
-      typedef typename ::testing::internal::Function<F>::Result return_type;\
-      typedef typename ::testing::internal::Function<F>::ArgumentTuple\
-          args_type;\
-      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \
-          p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\
-      virtual return_type Perform(const args_type& args) {\
-        return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
-            Perform(this, args);\
-      }\
-      template <typename arg0_type, typename arg1_type, typename arg2_type, \
-          typename arg3_type, typename arg4_type, typename arg5_type, \
-          typename arg6_type, typename arg7_type, typename arg8_type, \
-          typename arg9_type>\
-      return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
-          arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
-          arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
-          arg9_type arg9) const;\
-      p0##_type p0;\
-      p1##_type p1;\
-      p2##_type p2;\
-    };\
-    template <typename F> operator ::testing::Action<F>() const {\
-      return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2));\
-    }\
-    p0##_type p0;\
-    p1##_type p1;\
-    p2##_type p2;\
-  };\
-  template <typename p0##_type, typename p1##_type, typename p2##_type>\
-  inline name##ActionP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
-      p1##_type p1, p2##_type p2) {\
-    return name##ActionP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\
-  }\
-  template <typename p0##_type, typename p1##_type, typename p2##_type>\
-  template <typename F>\
-  template <typename arg0_type, typename arg1_type, typename arg2_type, \
-      typename arg3_type, typename arg4_type, typename arg5_type, \
-      typename arg6_type, typename arg7_type, typename arg8_type, \
-      typename arg9_type>\
-  typename ::testing::internal::Function<F>::Result\
-      name##ActionP3<p0##_type, p1##_type, \
-          p2##_type>::gmock_Impl<F>::gmock_PerformImpl(\
-          GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P4(name, p0, p1, p2, p3)\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type>\
-  class name##ActionP4 {\
-   public:\
-    name##ActionP4(p0##_type gmock_p0, p1##_type gmock_p1, \
-        p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \
-        p2(gmock_p2), p3(gmock_p3) {}\
-    template <typename F>\
-    class gmock_Impl : public ::testing::ActionInterface<F> {\
-     public:\
-      typedef F function_type;\
-      typedef typename ::testing::internal::Function<F>::Result return_type;\
-      typedef typename ::testing::internal::Function<F>::ArgumentTuple\
-          args_type;\
-      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
-          p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
-          p3(gmock_p3) {}\
-      virtual return_type Perform(const args_type& args) {\
-        return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
-            Perform(this, args);\
-      }\
-      template <typename arg0_type, typename arg1_type, typename arg2_type, \
-          typename arg3_type, typename arg4_type, typename arg5_type, \
-          typename arg6_type, typename arg7_type, typename arg8_type, \
-          typename arg9_type>\
-      return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
-          arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
-          arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
-          arg9_type arg9) const;\
-      p0##_type p0;\
-      p1##_type p1;\
-      p2##_type p2;\
-      p3##_type p3;\
-    };\
-    template <typename F> operator ::testing::Action<F>() const {\
-      return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3));\
-    }\
-    p0##_type p0;\
-    p1##_type p1;\
-    p2##_type p2;\
-    p3##_type p3;\
-  };\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type>\
-  inline name##ActionP4<p0##_type, p1##_type, p2##_type, \
-      p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
-      p3##_type p3) {\
-    return name##ActionP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, p1, \
-        p2, p3);\
-  }\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type>\
-  template <typename F>\
-  template <typename arg0_type, typename arg1_type, typename arg2_type, \
-      typename arg3_type, typename arg4_type, typename arg5_type, \
-      typename arg6_type, typename arg7_type, typename arg8_type, \
-      typename arg9_type>\
-  typename ::testing::internal::Function<F>::Result\
-      name##ActionP4<p0##_type, p1##_type, p2##_type, \
-          p3##_type>::gmock_Impl<F>::gmock_PerformImpl(\
-          GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P5(name, p0, p1, p2, p3, p4)\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type>\
-  class name##ActionP5 {\
-   public:\
-    name##ActionP5(p0##_type gmock_p0, p1##_type gmock_p1, \
-        p2##_type gmock_p2, p3##_type gmock_p3, \
-        p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
-        p3(gmock_p3), p4(gmock_p4) {}\
-    template <typename F>\
-    class gmock_Impl : public ::testing::ActionInterface<F> {\
-     public:\
-      typedef F function_type;\
-      typedef typename ::testing::internal::Function<F>::Result return_type;\
-      typedef typename ::testing::internal::Function<F>::ArgumentTuple\
-          args_type;\
-      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
-          p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), \
-          p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4) {}\
-      virtual return_type Perform(const args_type& args) {\
-        return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
-            Perform(this, args);\
-      }\
-      template <typename arg0_type, typename arg1_type, typename arg2_type, \
-          typename arg3_type, typename arg4_type, typename arg5_type, \
-          typename arg6_type, typename arg7_type, typename arg8_type, \
-          typename arg9_type>\
-      return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
-          arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
-          arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
-          arg9_type arg9) const;\
-      p0##_type p0;\
-      p1##_type p1;\
-      p2##_type p2;\
-      p3##_type p3;\
-      p4##_type p4;\
-    };\
-    template <typename F> operator ::testing::Action<F>() const {\
-      return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4));\
-    }\
-    p0##_type p0;\
-    p1##_type p1;\
-    p2##_type p2;\
-    p3##_type p3;\
-    p4##_type p4;\
-  };\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type>\
-  inline name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
-      p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
-      p4##_type p4) {\
-    return name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
-        p4##_type>(p0, p1, p2, p3, p4);\
-  }\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type>\
-  template <typename F>\
-  template <typename arg0_type, typename arg1_type, typename arg2_type, \
-      typename arg3_type, typename arg4_type, typename arg5_type, \
-      typename arg6_type, typename arg7_type, typename arg8_type, \
-      typename arg9_type>\
-  typename ::testing::internal::Function<F>::Result\
-      name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
-          p4##_type>::gmock_Impl<F>::gmock_PerformImpl(\
-          GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P6(name, p0, p1, p2, p3, p4, p5)\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type>\
-  class name##ActionP6 {\
-   public:\
-    name##ActionP6(p0##_type gmock_p0, p1##_type gmock_p1, \
-        p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
-        p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
-        p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\
-    template <typename F>\
-    class gmock_Impl : public ::testing::ActionInterface<F> {\
-     public:\
-      typedef F function_type;\
-      typedef typename ::testing::internal::Function<F>::Result return_type;\
-      typedef typename ::testing::internal::Function<F>::ArgumentTuple\
-          args_type;\
-      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
-          p3##_type gmock_p3, p4##_type gmock_p4, \
-          p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
-          p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\
-      virtual return_type Perform(const args_type& args) {\
-        return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
-            Perform(this, args);\
-      }\
-      template <typename arg0_type, typename arg1_type, typename arg2_type, \
-          typename arg3_type, typename arg4_type, typename arg5_type, \
-          typename arg6_type, typename arg7_type, typename arg8_type, \
-          typename arg9_type>\
-      return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
-          arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
-          arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
-          arg9_type arg9) const;\
-      p0##_type p0;\
-      p1##_type p1;\
-      p2##_type p2;\
-      p3##_type p3;\
-      p4##_type p4;\
-      p5##_type p5;\
-    };\
-    template <typename F> operator ::testing::Action<F>() const {\
-      return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5));\
-    }\
-    p0##_type p0;\
-    p1##_type p1;\
-    p2##_type p2;\
-    p3##_type p3;\
-    p4##_type p4;\
-    p5##_type p5;\
-  };\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type>\
-  inline name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \
-      p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
-      p3##_type p3, p4##_type p4, p5##_type p5) {\
-    return name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \
-        p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\
-  }\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type>\
-  template <typename F>\
-  template <typename arg0_type, typename arg1_type, typename arg2_type, \
-      typename arg3_type, typename arg4_type, typename arg5_type, \
-      typename arg6_type, typename arg7_type, typename arg8_type, \
-      typename arg9_type>\
-  typename ::testing::internal::Function<F>::Result\
-      name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
-          p5##_type>::gmock_Impl<F>::gmock_PerformImpl(\
-          GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P7(name, p0, p1, p2, p3, p4, p5, p6)\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type>\
-  class name##ActionP7 {\
-   public:\
-    name##ActionP7(p0##_type gmock_p0, p1##_type gmock_p1, \
-        p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
-        p5##_type gmock_p5, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), \
-        p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \
-        p6(gmock_p6) {}\
-    template <typename F>\
-    class gmock_Impl : public ::testing::ActionInterface<F> {\
-     public:\
-      typedef F function_type;\
-      typedef typename ::testing::internal::Function<F>::Result return_type;\
-      typedef typename ::testing::internal::Function<F>::ArgumentTuple\
-          args_type;\
-      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
-          p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
-          p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
-          p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\
-      virtual return_type Perform(const args_type& args) {\
-        return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
-            Perform(this, args);\
-      }\
-      template <typename arg0_type, typename arg1_type, typename arg2_type, \
-          typename arg3_type, typename arg4_type, typename arg5_type, \
-          typename arg6_type, typename arg7_type, typename arg8_type, \
-          typename arg9_type>\
-      return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
-          arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
-          arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
-          arg9_type arg9) const;\
-      p0##_type p0;\
-      p1##_type p1;\
-      p2##_type p2;\
-      p3##_type p3;\
-      p4##_type p4;\
-      p5##_type p5;\
-      p6##_type p6;\
-    };\
-    template <typename F> operator ::testing::Action<F>() const {\
-      return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
-          p6));\
-    }\
-    p0##_type p0;\
-    p1##_type p1;\
-    p2##_type p2;\
-    p3##_type p3;\
-    p4##_type p4;\
-    p5##_type p5;\
-    p6##_type p6;\
-  };\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type>\
-  inline name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \
-      p4##_type, p5##_type, p6##_type> name(p0##_type p0, p1##_type p1, \
-      p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
-      p6##_type p6) {\
-    return name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \
-        p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\
-  }\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type>\
-  template <typename F>\
-  template <typename arg0_type, typename arg1_type, typename arg2_type, \
-      typename arg3_type, typename arg4_type, typename arg5_type, \
-      typename arg6_type, typename arg7_type, typename arg8_type, \
-      typename arg9_type>\
-  typename ::testing::internal::Function<F>::Result\
-      name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
-          p5##_type, p6##_type>::gmock_Impl<F>::gmock_PerformImpl(\
-          GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P8(name, p0, p1, p2, p3, p4, p5, p6, p7)\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type, typename p7##_type>\
-  class name##ActionP8 {\
-   public:\
-    name##ActionP8(p0##_type gmock_p0, p1##_type gmock_p1, \
-        p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
-        p5##_type gmock_p5, p6##_type gmock_p6, \
-        p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
-        p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
-        p7(gmock_p7) {}\
-    template <typename F>\
-    class gmock_Impl : public ::testing::ActionInterface<F> {\
-     public:\
-      typedef F function_type;\
-      typedef typename ::testing::internal::Function<F>::Result return_type;\
-      typedef typename ::testing::internal::Function<F>::ArgumentTuple\
-          args_type;\
-      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
-          p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
-          p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), \
-          p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), \
-          p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\
-      virtual return_type Perform(const args_type& args) {\
-        return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
-            Perform(this, args);\
-      }\
-      template <typename arg0_type, typename arg1_type, typename arg2_type, \
-          typename arg3_type, typename arg4_type, typename arg5_type, \
-          typename arg6_type, typename arg7_type, typename arg8_type, \
-          typename arg9_type>\
-      return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
-          arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
-          arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
-          arg9_type arg9) const;\
-      p0##_type p0;\
-      p1##_type p1;\
-      p2##_type p2;\
-      p3##_type p3;\
-      p4##_type p4;\
-      p5##_type p5;\
-      p6##_type p6;\
-      p7##_type p7;\
-    };\
-    template <typename F> operator ::testing::Action<F>() const {\
-      return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
-          p6, p7));\
-    }\
-    p0##_type p0;\
-    p1##_type p1;\
-    p2##_type p2;\
-    p3##_type p3;\
-    p4##_type p4;\
-    p5##_type p5;\
-    p6##_type p6;\
-    p7##_type p7;\
-  };\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type, typename p7##_type>\
-  inline name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \
-      p4##_type, p5##_type, p6##_type, p7##_type> name(p0##_type p0, \
-      p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
-      p6##_type p6, p7##_type p7) {\
-    return name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \
-        p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \
-        p6, p7);\
-  }\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type, typename p7##_type>\
-  template <typename F>\
-  template <typename arg0_type, typename arg1_type, typename arg2_type, \
-      typename arg3_type, typename arg4_type, typename arg5_type, \
-      typename arg6_type, typename arg7_type, typename arg8_type, \
-      typename arg9_type>\
-  typename ::testing::internal::Function<F>::Result\
-      name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
-          p5##_type, p6##_type, \
-          p7##_type>::gmock_Impl<F>::gmock_PerformImpl(\
-          GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8)\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type, typename p7##_type, typename p8##_type>\
-  class name##ActionP9 {\
-   public:\
-    name##ActionP9(p0##_type gmock_p0, p1##_type gmock_p1, \
-        p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
-        p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
-        p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
-        p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
-        p8(gmock_p8) {}\
-    template <typename F>\
-    class gmock_Impl : public ::testing::ActionInterface<F> {\
-     public:\
-      typedef F function_type;\
-      typedef typename ::testing::internal::Function<F>::Result return_type;\
-      typedef typename ::testing::internal::Function<F>::ArgumentTuple\
-          args_type;\
-      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
-          p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
-          p6##_type gmock_p6, p7##_type gmock_p7, \
-          p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
-          p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
-          p7(gmock_p7), p8(gmock_p8) {}\
-      virtual return_type Perform(const args_type& args) {\
-        return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
-            Perform(this, args);\
-      }\
-      template <typename arg0_type, typename arg1_type, typename arg2_type, \
-          typename arg3_type, typename arg4_type, typename arg5_type, \
-          typename arg6_type, typename arg7_type, typename arg8_type, \
-          typename arg9_type>\
-      return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
-          arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
-          arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
-          arg9_type arg9) const;\
-      p0##_type p0;\
-      p1##_type p1;\
-      p2##_type p2;\
-      p3##_type p3;\
-      p4##_type p4;\
-      p5##_type p5;\
-      p6##_type p6;\
-      p7##_type p7;\
-      p8##_type p8;\
-    };\
-    template <typename F> operator ::testing::Action<F>() const {\
-      return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
-          p6, p7, p8));\
-    }\
-    p0##_type p0;\
-    p1##_type p1;\
-    p2##_type p2;\
-    p3##_type p3;\
-    p4##_type p4;\
-    p5##_type p5;\
-    p6##_type p6;\
-    p7##_type p7;\
-    p8##_type p8;\
-  };\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type, typename p7##_type, typename p8##_type>\
-  inline name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \
-      p4##_type, p5##_type, p6##_type, p7##_type, \
-      p8##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
-      p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \
-      p8##_type p8) {\
-    return name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \
-        p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \
-        p3, p4, p5, p6, p7, p8);\
-  }\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type, typename p7##_type, typename p8##_type>\
-  template <typename F>\
-  template <typename arg0_type, typename arg1_type, typename arg2_type, \
-      typename arg3_type, typename arg4_type, typename arg5_type, \
-      typename arg6_type, typename arg7_type, typename arg8_type, \
-      typename arg9_type>\
-  typename ::testing::internal::Function<F>::Result\
-      name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
-          p5##_type, p6##_type, p7##_type, \
-          p8##_type>::gmock_Impl<F>::gmock_PerformImpl(\
-          GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type, typename p7##_type, typename p8##_type, \
-      typename p9##_type>\
-  class name##ActionP10 {\
-   public:\
-    name##ActionP10(p0##_type gmock_p0, p1##_type gmock_p1, \
-        p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
-        p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
-        p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \
-        p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
-        p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\
-    template <typename F>\
-    class gmock_Impl : public ::testing::ActionInterface<F> {\
-     public:\
-      typedef F function_type;\
-      typedef typename ::testing::internal::Function<F>::Result return_type;\
-      typedef typename ::testing::internal::Function<F>::ArgumentTuple\
-          args_type;\
-      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
-          p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
-          p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
-          p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
-          p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
-          p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\
-      virtual return_type Perform(const args_type& args) {\
-        return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
-            Perform(this, args);\
-      }\
-      template <typename arg0_type, typename arg1_type, typename arg2_type, \
-          typename arg3_type, typename arg4_type, typename arg5_type, \
-          typename arg6_type, typename arg7_type, typename arg8_type, \
-          typename arg9_type>\
-      return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
-          arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
-          arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
-          arg9_type arg9) const;\
-      p0##_type p0;\
-      p1##_type p1;\
-      p2##_type p2;\
-      p3##_type p3;\
-      p4##_type p4;\
-      p5##_type p5;\
-      p6##_type p6;\
-      p7##_type p7;\
-      p8##_type p8;\
-      p9##_type p9;\
-    };\
-    template <typename F> operator ::testing::Action<F>() const {\
-      return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
-          p6, p7, p8, p9));\
-    }\
-    p0##_type p0;\
-    p1##_type p1;\
-    p2##_type p2;\
-    p3##_type p3;\
-    p4##_type p4;\
-    p5##_type p5;\
-    p6##_type p6;\
-    p7##_type p7;\
-    p8##_type p8;\
-    p9##_type p9;\
-  };\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type, typename p7##_type, typename p8##_type, \
-      typename p9##_type>\
-  inline name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \
-      p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
-      p9##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
-      p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \
-      p9##_type p9) {\
-    return name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \
-        p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \
-        p1, p2, p3, p4, p5, p6, p7, p8, p9);\
-  }\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type, typename p7##_type, typename p8##_type, \
-      typename p9##_type>\
-  template <typename F>\
-  template <typename arg0_type, typename arg1_type, typename arg2_type, \
-      typename arg3_type, typename arg4_type, typename arg5_type, \
-      typename arg6_type, typename arg7_type, typename arg8_type, \
-      typename arg9_type>\
-  typename ::testing::internal::Function<F>::Result\
-      name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
-          p5##_type, p6##_type, p7##_type, p8##_type, \
-          p9##_type>::gmock_Impl<F>::gmock_PerformImpl(\
-          GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-// TODO(wan@google.com): move the following to a different .h file
-// such that we don't have to run 'pump' every time the code is
-// updated.
-namespace testing {
-
-// Various overloads for InvokeArgument<N>().
-//
-// The InvokeArgument<N>(a1, a2, ..., a_k) action invokes the N-th
-// (0-based) argument, which must be a k-ary callable, of the mock
-// function, with arguments a1, a2, ..., a_k.
-//
-// Notes:
-//
-//   1. The arguments are passed by value by default.  If you need to
-//   pass an argument by reference, wrap it inside ByRef().  For
-//   example,
-//
-//     InvokeArgument<1>(5, string("Hello"), ByRef(foo))
-//
-//   passes 5 and string("Hello") by value, and passes foo by
-//   reference.
-//
-//   2. If the callable takes an argument by reference but ByRef() is
-//   not used, it will receive the reference to a copy of the value,
-//   instead of the original value.  For example, when the 0-th
-//   argument of the mock function takes a const string&, the action
-//
-//     InvokeArgument<0>(string("Hello"))
-//
-//   makes a copy of the temporary string("Hello") object and passes a
-//   reference of the copy, instead of the original temporary object,
-//   to the callable.  This makes it easy for a user to define an
-//   InvokeArgument action from temporary values and have it performed
-//   later.
-
-ACTION_TEMPLATE(InvokeArgument,
-                HAS_1_TEMPLATE_PARAMS(int, k),
-                AND_0_VALUE_PARAMS()) {
-  return internal::CallableHelper<return_type>::Call(
-      ::std::tr1::get<k>(args));
-}
-
-ACTION_TEMPLATE(InvokeArgument,
-                HAS_1_TEMPLATE_PARAMS(int, k),
-                AND_1_VALUE_PARAMS(p0)) {
-  return internal::CallableHelper<return_type>::Call(
-      ::std::tr1::get<k>(args), p0);
-}
-
-ACTION_TEMPLATE(InvokeArgument,
-                HAS_1_TEMPLATE_PARAMS(int, k),
-                AND_2_VALUE_PARAMS(p0, p1)) {
-  return internal::CallableHelper<return_type>::Call(
-      ::std::tr1::get<k>(args), p0, p1);
-}
-
-ACTION_TEMPLATE(InvokeArgument,
-                HAS_1_TEMPLATE_PARAMS(int, k),
-                AND_3_VALUE_PARAMS(p0, p1, p2)) {
-  return internal::CallableHelper<return_type>::Call(
-      ::std::tr1::get<k>(args), p0, p1, p2);
-}
-
-ACTION_TEMPLATE(InvokeArgument,
-                HAS_1_TEMPLATE_PARAMS(int, k),
-                AND_4_VALUE_PARAMS(p0, p1, p2, p3)) {
-  return internal::CallableHelper<return_type>::Call(
-      ::std::tr1::get<k>(args), p0, p1, p2, p3);
-}
-
-ACTION_TEMPLATE(InvokeArgument,
-                HAS_1_TEMPLATE_PARAMS(int, k),
-                AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) {
-  return internal::CallableHelper<return_type>::Call(
-      ::std::tr1::get<k>(args), p0, p1, p2, p3, p4);
-}
-
-ACTION_TEMPLATE(InvokeArgument,
-                HAS_1_TEMPLATE_PARAMS(int, k),
-                AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) {
-  return internal::CallableHelper<return_type>::Call(
-      ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5);
-}
-
-ACTION_TEMPLATE(InvokeArgument,
-                HAS_1_TEMPLATE_PARAMS(int, k),
-                AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) {
-  return internal::CallableHelper<return_type>::Call(
-      ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6);
-}
-
-ACTION_TEMPLATE(InvokeArgument,
-                HAS_1_TEMPLATE_PARAMS(int, k),
-                AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) {
-  return internal::CallableHelper<return_type>::Call(
-      ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7);
-}
-
-ACTION_TEMPLATE(InvokeArgument,
-                HAS_1_TEMPLATE_PARAMS(int, k),
-                AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) {
-  return internal::CallableHelper<return_type>::Call(
-      ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8);
-}
-
-ACTION_TEMPLATE(InvokeArgument,
-                HAS_1_TEMPLATE_PARAMS(int, k),
-                AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) {
-  return internal::CallableHelper<return_type>::Call(
-      ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
-}
-
-// Various overloads for ReturnNew<T>().
-//
-// The ReturnNew<T>(a1, a2, ..., a_k) action returns a pointer to a new
-// instance of type T, constructed on the heap with constructor arguments
-// a1, a2, ..., and a_k. The caller assumes ownership of the returned value.
-ACTION_TEMPLATE(ReturnNew,
-                HAS_1_TEMPLATE_PARAMS(typename, T),
-                AND_0_VALUE_PARAMS()) {
-  return new T();
-}
-
-ACTION_TEMPLATE(ReturnNew,
-                HAS_1_TEMPLATE_PARAMS(typename, T),
-                AND_1_VALUE_PARAMS(p0)) {
-  return new T(p0);
-}
-
-ACTION_TEMPLATE(ReturnNew,
-                HAS_1_TEMPLATE_PARAMS(typename, T),
-                AND_2_VALUE_PARAMS(p0, p1)) {
-  return new T(p0, p1);
-}
-
-ACTION_TEMPLATE(ReturnNew,
-                HAS_1_TEMPLATE_PARAMS(typename, T),
-                AND_3_VALUE_PARAMS(p0, p1, p2)) {
-  return new T(p0, p1, p2);
-}
-
-ACTION_TEMPLATE(ReturnNew,
-                HAS_1_TEMPLATE_PARAMS(typename, T),
-                AND_4_VALUE_PARAMS(p0, p1, p2, p3)) {
-  return new T(p0, p1, p2, p3);
-}
-
-ACTION_TEMPLATE(ReturnNew,
-                HAS_1_TEMPLATE_PARAMS(typename, T),
-                AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) {
-  return new T(p0, p1, p2, p3, p4);
-}
-
-ACTION_TEMPLATE(ReturnNew,
-                HAS_1_TEMPLATE_PARAMS(typename, T),
-                AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) {
-  return new T(p0, p1, p2, p3, p4, p5);
-}
-
-ACTION_TEMPLATE(ReturnNew,
-                HAS_1_TEMPLATE_PARAMS(typename, T),
-                AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) {
-  return new T(p0, p1, p2, p3, p4, p5, p6);
-}
-
-ACTION_TEMPLATE(ReturnNew,
-                HAS_1_TEMPLATE_PARAMS(typename, T),
-                AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) {
-  return new T(p0, p1, p2, p3, p4, p5, p6, p7);
-}
-
-ACTION_TEMPLATE(ReturnNew,
-                HAS_1_TEMPLATE_PARAMS(typename, T),
-                AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) {
-  return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8);
-}
-
-ACTION_TEMPLATE(ReturnNew,
-                HAS_1_TEMPLATE_PARAMS(typename, T),
-                AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) {
-  return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
-}
-
-}  // namespace testing
-
-#endif  // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
diff --git a/third_party/gmock/include/gmock/gmock-generated-function-mockers.h b/third_party/gmock/include/gmock/gmock-generated-function-mockers.h
deleted file mode 100644
index 9f3a956..0000000
--- a/third_party/gmock/include/gmock/gmock-generated-function-mockers.h
+++ /dev/null
@@ -1,869 +0,0 @@
-// This file was GENERATED by a script.  DO NOT EDIT BY HAND!!!
-
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements function mockers of various arities.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
-
-#include <gmock/gmock-spec-builders.h>
-#include <gmock/internal/gmock-internal-utils.h>
-
-namespace testing {
-namespace internal {
-
-template <typename F>
-class FunctionMockerBase;
-
-// Note: class FunctionMocker really belongs to the ::testing
-// namespace.  However if we define it in ::testing, MSVC will
-// complain when classes in ::testing::internal declare it as a
-// friend class template.  To workaround this compiler bug, we define
-// FunctionMocker in ::testing::internal and import it into ::testing.
-template <typename F>
-class FunctionMocker;
-
-template <typename R>
-class FunctionMocker<R()> : public
-    internal::FunctionMockerBase<R()> {
- public:
-  typedef R F();
-  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
-  MockSpec<F>& With() {
-    return this->current_spec();
-  }
-
-  R Invoke() {
-    // Even though gcc and MSVC don't enforce it, 'this->' is required
-    // by the C++ standard [14.6.4] here, as the base class type is
-    // dependent on the template argument (and thus shouldn't be
-    // looked into when resolving InvokeWith).
-    return this->InvokeWith(ArgumentTuple());
-  }
-};
-
-template <typename R, typename A1>
-class FunctionMocker<R(A1)> : public
-    internal::FunctionMockerBase<R(A1)> {
- public:
-  typedef R F(A1);
-  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
-  MockSpec<F>& With(const Matcher<A1>& m1) {
-    this->current_spec().SetMatchers(::std::tr1::make_tuple(m1));
-    return this->current_spec();
-  }
-
-  R Invoke(A1 a1) {
-    // Even though gcc and MSVC don't enforce it, 'this->' is required
-    // by the C++ standard [14.6.4] here, as the base class type is
-    // dependent on the template argument (and thus shouldn't be
-    // looked into when resolving InvokeWith).
-    return this->InvokeWith(ArgumentTuple(a1));
-  }
-};
-
-template <typename R, typename A1, typename A2>
-class FunctionMocker<R(A1, A2)> : public
-    internal::FunctionMockerBase<R(A1, A2)> {
- public:
-  typedef R F(A1, A2);
-  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
-  MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2) {
-    this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2));
-    return this->current_spec();
-  }
-
-  R Invoke(A1 a1, A2 a2) {
-    // Even though gcc and MSVC don't enforce it, 'this->' is required
-    // by the C++ standard [14.6.4] here, as the base class type is
-    // dependent on the template argument (and thus shouldn't be
-    // looked into when resolving InvokeWith).
-    return this->InvokeWith(ArgumentTuple(a1, a2));
-  }
-};
-
-template <typename R, typename A1, typename A2, typename A3>
-class FunctionMocker<R(A1, A2, A3)> : public
-    internal::FunctionMockerBase<R(A1, A2, A3)> {
- public:
-  typedef R F(A1, A2, A3);
-  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
-  MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
-      const Matcher<A3>& m3) {
-    this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3));
-    return this->current_spec();
-  }
-
-  R Invoke(A1 a1, A2 a2, A3 a3) {
-    // Even though gcc and MSVC don't enforce it, 'this->' is required
-    // by the C++ standard [14.6.4] here, as the base class type is
-    // dependent on the template argument (and thus shouldn't be
-    // looked into when resolving InvokeWith).
-    return this->InvokeWith(ArgumentTuple(a1, a2, a3));
-  }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4>
-class FunctionMocker<R(A1, A2, A3, A4)> : public
-    internal::FunctionMockerBase<R(A1, A2, A3, A4)> {
- public:
-  typedef R F(A1, A2, A3, A4);
-  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
-  MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
-      const Matcher<A3>& m3, const Matcher<A4>& m4) {
-    this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4));
-    return this->current_spec();
-  }
-
-  R Invoke(A1 a1, A2 a2, A3 a3, A4 a4) {
-    // Even though gcc and MSVC don't enforce it, 'this->' is required
-    // by the C++ standard [14.6.4] here, as the base class type is
-    // dependent on the template argument (and thus shouldn't be
-    // looked into when resolving InvokeWith).
-    return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4));
-  }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
-    typename A5>
-class FunctionMocker<R(A1, A2, A3, A4, A5)> : public
-    internal::FunctionMockerBase<R(A1, A2, A3, A4, A5)> {
- public:
-  typedef R F(A1, A2, A3, A4, A5);
-  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
-  MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
-      const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5) {
-    this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4,
-        m5));
-    return this->current_spec();
-  }
-
-  R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
-    // Even though gcc and MSVC don't enforce it, 'this->' is required
-    // by the C++ standard [14.6.4] here, as the base class type is
-    // dependent on the template argument (and thus shouldn't be
-    // looked into when resolving InvokeWith).
-    return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5));
-  }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
-    typename A5, typename A6>
-class FunctionMocker<R(A1, A2, A3, A4, A5, A6)> : public
-    internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6)> {
- public:
-  typedef R F(A1, A2, A3, A4, A5, A6);
-  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
-  MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
-      const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
-      const Matcher<A6>& m6) {
-    this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5,
-        m6));
-    return this->current_spec();
-  }
-
-  R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) {
-    // Even though gcc and MSVC don't enforce it, 'this->' is required
-    // by the C++ standard [14.6.4] here, as the base class type is
-    // dependent on the template argument (and thus shouldn't be
-    // looked into when resolving InvokeWith).
-    return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6));
-  }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
-    typename A5, typename A6, typename A7>
-class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7)> : public
-    internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7)> {
- public:
-  typedef R F(A1, A2, A3, A4, A5, A6, A7);
-  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
-  MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
-      const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
-      const Matcher<A6>& m6, const Matcher<A7>& m7) {
-    this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5,
-        m6, m7));
-    return this->current_spec();
-  }
-
-  R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) {
-    // Even though gcc and MSVC don't enforce it, 'this->' is required
-    // by the C++ standard [14.6.4] here, as the base class type is
-    // dependent on the template argument (and thus shouldn't be
-    // looked into when resolving InvokeWith).
-    return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7));
-  }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
-    typename A5, typename A6, typename A7, typename A8>
-class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8)> : public
-    internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8)> {
- public:
-  typedef R F(A1, A2, A3, A4, A5, A6, A7, A8);
-  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
-  MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
-      const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
-      const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8) {
-    this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5,
-        m6, m7, m8));
-    return this->current_spec();
-  }
-
-  R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) {
-    // Even though gcc and MSVC don't enforce it, 'this->' is required
-    // by the C++ standard [14.6.4] here, as the base class type is
-    // dependent on the template argument (and thus shouldn't be
-    // looked into when resolving InvokeWith).
-    return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8));
-  }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
-    typename A5, typename A6, typename A7, typename A8, typename A9>
-class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> : public
-    internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
- public:
-  typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9);
-  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
-  MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
-      const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
-      const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8,
-      const Matcher<A9>& m9) {
-    this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5,
-        m6, m7, m8, m9));
-    return this->current_spec();
-  }
-
-  R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) {
-    // Even though gcc and MSVC don't enforce it, 'this->' is required
-    // by the C++ standard [14.6.4] here, as the base class type is
-    // dependent on the template argument (and thus shouldn't be
-    // looked into when resolving InvokeWith).
-    return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8, a9));
-  }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
-    typename A5, typename A6, typename A7, typename A8, typename A9,
-    typename A10>
-class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> : public
-    internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> {
- public:
-  typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
-  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
-  MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
-      const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
-      const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8,
-      const Matcher<A9>& m9, const Matcher<A10>& m10) {
-    this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5,
-        m6, m7, m8, m9, m10));
-    return this->current_spec();
-  }
-
-  R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9,
-      A10 a10) {
-    // Even though gcc and MSVC don't enforce it, 'this->' is required
-    // by the C++ standard [14.6.4] here, as the base class type is
-    // dependent on the template argument (and thus shouldn't be
-    // looked into when resolving InvokeWith).
-    return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8, a9,
-        a10));
-  }
-};
-
-}  // namespace internal
-
-// The style guide prohibits "using" statements in a namespace scope
-// inside a header file.  However, the FunctionMocker class template
-// is meant to be defined in the ::testing namespace.  The following
-// line is just a trick for working around a bug in MSVC 8.0, which
-// cannot handle it if we define FunctionMocker in ::testing.
-using internal::FunctionMocker;
-
-// The result type of function type F.
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_RESULT_(tn, F) tn ::testing::internal::Function<F>::Result
-
-// The type of argument N of function type F.
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_ARG_(tn, F, N) tn ::testing::internal::Function<F>::Argument##N
-
-// The matcher type for argument N of function type F.
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_MATCHER_(tn, F, N) const ::testing::Matcher<GMOCK_ARG_(tn, F, N)>&
-
-// The variable for mocking the given method.
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_MOCKER_(arity, constness, Method) \
-    GMOCK_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD0_(tn, constness, ct, Method, F) \
-  GMOCK_RESULT_(tn, F) ct Method() constness { \
-    GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
-        tn ::testing::internal::Function<F>::ArgumentTuple>::value == 0, \
-        this_method_does_not_take_0_arguments); \
-    GMOCK_MOCKER_(0, constness, Method).SetOwnerAndName(this, #Method); \
-    return GMOCK_MOCKER_(0, constness, Method).Invoke(); \
-  } \
-  ::testing::MockSpec<F>& \
-      gmock_##Method() constness { \
-    return GMOCK_MOCKER_(0, constness, Method).RegisterOwner(this).With(); \
-  } \
-  mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(0, constness, Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD1_(tn, constness, ct, Method, F) \
-  GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1) constness { \
-    GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
-        tn ::testing::internal::Function<F>::ArgumentTuple>::value == 1, \
-        this_method_does_not_take_1_argument); \
-    GMOCK_MOCKER_(1, constness, Method).SetOwnerAndName(this, #Method); \
-    return GMOCK_MOCKER_(1, constness, Method).Invoke(gmock_a1); \
-  } \
-  ::testing::MockSpec<F>& \
-      gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1) constness { \
-    return GMOCK_MOCKER_(1, constness, \
-        Method).RegisterOwner(this).With(gmock_a1); \
-  } \
-  mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(1, constness, Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD2_(tn, constness, ct, Method, F) \
-  GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
-                                 GMOCK_ARG_(tn, F, 2) gmock_a2) constness { \
-    GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
-        tn ::testing::internal::Function<F>::ArgumentTuple>::value == 2, \
-        this_method_does_not_take_2_arguments); \
-    GMOCK_MOCKER_(2, constness, Method).SetOwnerAndName(this, #Method); \
-    return GMOCK_MOCKER_(2, constness, Method).Invoke(gmock_a1, gmock_a2); \
-  } \
-  ::testing::MockSpec<F>& \
-      gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
-                     GMOCK_MATCHER_(tn, F, 2) gmock_a2) constness { \
-    return GMOCK_MOCKER_(2, constness, \
-        Method).RegisterOwner(this).With(gmock_a1, gmock_a2); \
-  } \
-  mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(2, constness, Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD3_(tn, constness, ct, Method, F) \
-  GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
-                                 GMOCK_ARG_(tn, F, 2) gmock_a2, \
-                                 GMOCK_ARG_(tn, F, 3) gmock_a3) constness { \
-    GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
-        tn ::testing::internal::Function<F>::ArgumentTuple>::value == 3, \
-        this_method_does_not_take_3_arguments); \
-    GMOCK_MOCKER_(3, constness, Method).SetOwnerAndName(this, #Method); \
-    return GMOCK_MOCKER_(3, constness, Method).Invoke(gmock_a1, gmock_a2, \
-        gmock_a3); \
-  } \
-  ::testing::MockSpec<F>& \
-      gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
-                     GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
-                     GMOCK_MATCHER_(tn, F, 3) gmock_a3) constness { \
-    return GMOCK_MOCKER_(3, constness, \
-        Method).RegisterOwner(this).With(gmock_a1, gmock_a2, gmock_a3); \
-  } \
-  mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(3, constness, Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD4_(tn, constness, ct, Method, F) \
-  GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
-                                 GMOCK_ARG_(tn, F, 2) gmock_a2, \
-                                 GMOCK_ARG_(tn, F, 3) gmock_a3, \
-                                 GMOCK_ARG_(tn, F, 4) gmock_a4) constness { \
-    GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
-        tn ::testing::internal::Function<F>::ArgumentTuple>::value == 4, \
-        this_method_does_not_take_4_arguments); \
-    GMOCK_MOCKER_(4, constness, Method).SetOwnerAndName(this, #Method); \
-    return GMOCK_MOCKER_(4, constness, Method).Invoke(gmock_a1, gmock_a2, \
-        gmock_a3, gmock_a4); \
-  } \
-  ::testing::MockSpec<F>& \
-      gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
-                     GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
-                     GMOCK_MATCHER_(tn, F, 3) gmock_a3, \
-                     GMOCK_MATCHER_(tn, F, 4) gmock_a4) constness { \
-    return GMOCK_MOCKER_(4, constness, \
-        Method).RegisterOwner(this).With(gmock_a1, gmock_a2, gmock_a3, \
-        gmock_a4); \
-  } \
-  mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(4, constness, Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD5_(tn, constness, ct, Method, F) \
-  GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
-                                 GMOCK_ARG_(tn, F, 2) gmock_a2, \
-                                 GMOCK_ARG_(tn, F, 3) gmock_a3, \
-                                 GMOCK_ARG_(tn, F, 4) gmock_a4, \
-                                 GMOCK_ARG_(tn, F, 5) gmock_a5) constness { \
-    GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
-        tn ::testing::internal::Function<F>::ArgumentTuple>::value == 5, \
-        this_method_does_not_take_5_arguments); \
-    GMOCK_MOCKER_(5, constness, Method).SetOwnerAndName(this, #Method); \
-    return GMOCK_MOCKER_(5, constness, Method).Invoke(gmock_a1, gmock_a2, \
-        gmock_a3, gmock_a4, gmock_a5); \
-  } \
-  ::testing::MockSpec<F>& \
-      gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
-                     GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
-                     GMOCK_MATCHER_(tn, F, 3) gmock_a3, \
-                     GMOCK_MATCHER_(tn, F, 4) gmock_a4, \
-                     GMOCK_MATCHER_(tn, F, 5) gmock_a5) constness { \
-    return GMOCK_MOCKER_(5, constness, \
-        Method).RegisterOwner(this).With(gmock_a1, gmock_a2, gmock_a3, \
-        gmock_a4, gmock_a5); \
-  } \
-  mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(5, constness, Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD6_(tn, constness, ct, Method, F) \
-  GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
-                                 GMOCK_ARG_(tn, F, 2) gmock_a2, \
-                                 GMOCK_ARG_(tn, F, 3) gmock_a3, \
-                                 GMOCK_ARG_(tn, F, 4) gmock_a4, \
-                                 GMOCK_ARG_(tn, F, 5) gmock_a5, \
-                                 GMOCK_ARG_(tn, F, 6) gmock_a6) constness { \
-    GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
-        tn ::testing::internal::Function<F>::ArgumentTuple>::value == 6, \
-        this_method_does_not_take_6_arguments); \
-    GMOCK_MOCKER_(6, constness, Method).SetOwnerAndName(this, #Method); \
-    return GMOCK_MOCKER_(6, constness, Method).Invoke(gmock_a1, gmock_a2, \
-        gmock_a3, gmock_a4, gmock_a5, gmock_a6); \
-  } \
-  ::testing::MockSpec<F>& \
-      gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
-                     GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
-                     GMOCK_MATCHER_(tn, F, 3) gmock_a3, \
-                     GMOCK_MATCHER_(tn, F, 4) gmock_a4, \
-                     GMOCK_MATCHER_(tn, F, 5) gmock_a5, \
-                     GMOCK_MATCHER_(tn, F, 6) gmock_a6) constness { \
-    return GMOCK_MOCKER_(6, constness, \
-        Method).RegisterOwner(this).With(gmock_a1, gmock_a2, gmock_a3, \
-        gmock_a4, gmock_a5, gmock_a6); \
-  } \
-  mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(6, constness, Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD7_(tn, constness, ct, Method, F) \
-  GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
-                                 GMOCK_ARG_(tn, F, 2) gmock_a2, \
-                                 GMOCK_ARG_(tn, F, 3) gmock_a3, \
-                                 GMOCK_ARG_(tn, F, 4) gmock_a4, \
-                                 GMOCK_ARG_(tn, F, 5) gmock_a5, \
-                                 GMOCK_ARG_(tn, F, 6) gmock_a6, \
-                                 GMOCK_ARG_(tn, F, 7) gmock_a7) constness { \
-    GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
-        tn ::testing::internal::Function<F>::ArgumentTuple>::value == 7, \
-        this_method_does_not_take_7_arguments); \
-    GMOCK_MOCKER_(7, constness, Method).SetOwnerAndName(this, #Method); \
-    return GMOCK_MOCKER_(7, constness, Method).Invoke(gmock_a1, gmock_a2, \
-        gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \
-  } \
-  ::testing::MockSpec<F>& \
-      gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
-                     GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
-                     GMOCK_MATCHER_(tn, F, 3) gmock_a3, \
-                     GMOCK_MATCHER_(tn, F, 4) gmock_a4, \
-                     GMOCK_MATCHER_(tn, F, 5) gmock_a5, \
-                     GMOCK_MATCHER_(tn, F, 6) gmock_a6, \
-                     GMOCK_MATCHER_(tn, F, 7) gmock_a7) constness { \
-    return GMOCK_MOCKER_(7, constness, \
-        Method).RegisterOwner(this).With(gmock_a1, gmock_a2, gmock_a3, \
-        gmock_a4, gmock_a5, gmock_a6, gmock_a7); \
-  } \
-  mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(7, constness, Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD8_(tn, constness, ct, Method, F) \
-  GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
-                                 GMOCK_ARG_(tn, F, 2) gmock_a2, \
-                                 GMOCK_ARG_(tn, F, 3) gmock_a3, \
-                                 GMOCK_ARG_(tn, F, 4) gmock_a4, \
-                                 GMOCK_ARG_(tn, F, 5) gmock_a5, \
-                                 GMOCK_ARG_(tn, F, 6) gmock_a6, \
-                                 GMOCK_ARG_(tn, F, 7) gmock_a7, \
-                                 GMOCK_ARG_(tn, F, 8) gmock_a8) constness { \
-    GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
-        tn ::testing::internal::Function<F>::ArgumentTuple>::value == 8, \
-        this_method_does_not_take_8_arguments); \
-    GMOCK_MOCKER_(8, constness, Method).SetOwnerAndName(this, #Method); \
-    return GMOCK_MOCKER_(8, constness, Method).Invoke(gmock_a1, gmock_a2, \
-        gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \
-  } \
-  ::testing::MockSpec<F>& \
-      gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
-                     GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
-                     GMOCK_MATCHER_(tn, F, 3) gmock_a3, \
-                     GMOCK_MATCHER_(tn, F, 4) gmock_a4, \
-                     GMOCK_MATCHER_(tn, F, 5) gmock_a5, \
-                     GMOCK_MATCHER_(tn, F, 6) gmock_a6, \
-                     GMOCK_MATCHER_(tn, F, 7) gmock_a7, \
-                     GMOCK_MATCHER_(tn, F, 8) gmock_a8) constness { \
-    return GMOCK_MOCKER_(8, constness, \
-        Method).RegisterOwner(this).With(gmock_a1, gmock_a2, gmock_a3, \
-        gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \
-  } \
-  mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(8, constness, Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD9_(tn, constness, ct, Method, F) \
-  GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
-                                 GMOCK_ARG_(tn, F, 2) gmock_a2, \
-                                 GMOCK_ARG_(tn, F, 3) gmock_a3, \
-                                 GMOCK_ARG_(tn, F, 4) gmock_a4, \
-                                 GMOCK_ARG_(tn, F, 5) gmock_a5, \
-                                 GMOCK_ARG_(tn, F, 6) gmock_a6, \
-                                 GMOCK_ARG_(tn, F, 7) gmock_a7, \
-                                 GMOCK_ARG_(tn, F, 8) gmock_a8, \
-                                 GMOCK_ARG_(tn, F, 9) gmock_a9) constness { \
-    GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
-        tn ::testing::internal::Function<F>::ArgumentTuple>::value == 9, \
-        this_method_does_not_take_9_arguments); \
-    GMOCK_MOCKER_(9, constness, Method).SetOwnerAndName(this, #Method); \
-    return GMOCK_MOCKER_(9, constness, Method).Invoke(gmock_a1, gmock_a2, \
-        gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \
-        gmock_a9); \
-  } \
-  ::testing::MockSpec<F>& \
-      gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
-                     GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
-                     GMOCK_MATCHER_(tn, F, 3) gmock_a3, \
-                     GMOCK_MATCHER_(tn, F, 4) gmock_a4, \
-                     GMOCK_MATCHER_(tn, F, 5) gmock_a5, \
-                     GMOCK_MATCHER_(tn, F, 6) gmock_a6, \
-                     GMOCK_MATCHER_(tn, F, 7) gmock_a7, \
-                     GMOCK_MATCHER_(tn, F, 8) gmock_a8, \
-                     GMOCK_MATCHER_(tn, F, 9) gmock_a9) constness { \
-    return GMOCK_MOCKER_(9, constness, \
-        Method).RegisterOwner(this).With(gmock_a1, gmock_a2, gmock_a3, \
-        gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9); \
-  } \
-  mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(9, constness, Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD10_(tn, constness, ct, Method, F) \
-  GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
-                                 GMOCK_ARG_(tn, F, 2) gmock_a2, \
-                                 GMOCK_ARG_(tn, F, 3) gmock_a3, \
-                                 GMOCK_ARG_(tn, F, 4) gmock_a4, \
-                                 GMOCK_ARG_(tn, F, 5) gmock_a5, \
-                                 GMOCK_ARG_(tn, F, 6) gmock_a6, \
-                                 GMOCK_ARG_(tn, F, 7) gmock_a7, \
-                                 GMOCK_ARG_(tn, F, 8) gmock_a8, \
-                                 GMOCK_ARG_(tn, F, 9) gmock_a9, \
-                                 GMOCK_ARG_(tn, F, 10) gmock_a10) constness { \
-    GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
-        tn ::testing::internal::Function<F>::ArgumentTuple>::value == 10, \
-        this_method_does_not_take_10_arguments); \
-    GMOCK_MOCKER_(10, constness, Method).SetOwnerAndName(this, #Method); \
-    return GMOCK_MOCKER_(10, constness, Method).Invoke(gmock_a1, gmock_a2, \
-        gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \
-        gmock_a10); \
-  } \
-  ::testing::MockSpec<F>& \
-      gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
-                     GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
-                     GMOCK_MATCHER_(tn, F, 3) gmock_a3, \
-                     GMOCK_MATCHER_(tn, F, 4) gmock_a4, \
-                     GMOCK_MATCHER_(tn, F, 5) gmock_a5, \
-                     GMOCK_MATCHER_(tn, F, 6) gmock_a6, \
-                     GMOCK_MATCHER_(tn, F, 7) gmock_a7, \
-                     GMOCK_MATCHER_(tn, F, 8) gmock_a8, \
-                     GMOCK_MATCHER_(tn, F, 9) gmock_a9, \
-                     GMOCK_MATCHER_(tn, F, 10) gmock_a10) constness { \
-    return GMOCK_MOCKER_(10, constness, \
-        Method).RegisterOwner(this).With(gmock_a1, gmock_a2, gmock_a3, \
-        gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \
-        gmock_a10); \
-  } \
-  mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(10, constness, Method)
-
-#define MOCK_METHOD0(m, F) GMOCK_METHOD0_(, , , m, F)
-#define MOCK_METHOD1(m, F) GMOCK_METHOD1_(, , , m, F)
-#define MOCK_METHOD2(m, F) GMOCK_METHOD2_(, , , m, F)
-#define MOCK_METHOD3(m, F) GMOCK_METHOD3_(, , , m, F)
-#define MOCK_METHOD4(m, F) GMOCK_METHOD4_(, , , m, F)
-#define MOCK_METHOD5(m, F) GMOCK_METHOD5_(, , , m, F)
-#define MOCK_METHOD6(m, F) GMOCK_METHOD6_(, , , m, F)
-#define MOCK_METHOD7(m, F) GMOCK_METHOD7_(, , , m, F)
-#define MOCK_METHOD8(m, F) GMOCK_METHOD8_(, , , m, F)
-#define MOCK_METHOD9(m, F) GMOCK_METHOD9_(, , , m, F)
-#define MOCK_METHOD10(m, F) GMOCK_METHOD10_(, , , m, F)
-
-#define MOCK_CONST_METHOD0(m, F) GMOCK_METHOD0_(, const, , m, F)
-#define MOCK_CONST_METHOD1(m, F) GMOCK_METHOD1_(, const, , m, F)
-#define MOCK_CONST_METHOD2(m, F) GMOCK_METHOD2_(, const, , m, F)
-#define MOCK_CONST_METHOD3(m, F) GMOCK_METHOD3_(, const, , m, F)
-#define MOCK_CONST_METHOD4(m, F) GMOCK_METHOD4_(, const, , m, F)
-#define MOCK_CONST_METHOD5(m, F) GMOCK_METHOD5_(, const, , m, F)
-#define MOCK_CONST_METHOD6(m, F) GMOCK_METHOD6_(, const, , m, F)
-#define MOCK_CONST_METHOD7(m, F) GMOCK_METHOD7_(, const, , m, F)
-#define MOCK_CONST_METHOD8(m, F) GMOCK_METHOD8_(, const, , m, F)
-#define MOCK_CONST_METHOD9(m, F) GMOCK_METHOD9_(, const, , m, F)
-#define MOCK_CONST_METHOD10(m, F) GMOCK_METHOD10_(, const, , m, F)
-
-#define MOCK_METHOD0_T(m, F) GMOCK_METHOD0_(typename, , , m, F)
-#define MOCK_METHOD1_T(m, F) GMOCK_METHOD1_(typename, , , m, F)
-#define MOCK_METHOD2_T(m, F) GMOCK_METHOD2_(typename, , , m, F)
-#define MOCK_METHOD3_T(m, F) GMOCK_METHOD3_(typename, , , m, F)
-#define MOCK_METHOD4_T(m, F) GMOCK_METHOD4_(typename, , , m, F)
-#define MOCK_METHOD5_T(m, F) GMOCK_METHOD5_(typename, , , m, F)
-#define MOCK_METHOD6_T(m, F) GMOCK_METHOD6_(typename, , , m, F)
-#define MOCK_METHOD7_T(m, F) GMOCK_METHOD7_(typename, , , m, F)
-#define MOCK_METHOD8_T(m, F) GMOCK_METHOD8_(typename, , , m, F)
-#define MOCK_METHOD9_T(m, F) GMOCK_METHOD9_(typename, , , m, F)
-#define MOCK_METHOD10_T(m, F) GMOCK_METHOD10_(typename, , , m, F)
-
-#define MOCK_CONST_METHOD0_T(m, F) GMOCK_METHOD0_(typename, const, , m, F)
-#define MOCK_CONST_METHOD1_T(m, F) GMOCK_METHOD1_(typename, const, , m, F)
-#define MOCK_CONST_METHOD2_T(m, F) GMOCK_METHOD2_(typename, const, , m, F)
-#define MOCK_CONST_METHOD3_T(m, F) GMOCK_METHOD3_(typename, const, , m, F)
-#define MOCK_CONST_METHOD4_T(m, F) GMOCK_METHOD4_(typename, const, , m, F)
-#define MOCK_CONST_METHOD5_T(m, F) GMOCK_METHOD5_(typename, const, , m, F)
-#define MOCK_CONST_METHOD6_T(m, F) GMOCK_METHOD6_(typename, const, , m, F)
-#define MOCK_CONST_METHOD7_T(m, F) GMOCK_METHOD7_(typename, const, , m, F)
-#define MOCK_CONST_METHOD8_T(m, F) GMOCK_METHOD8_(typename, const, , m, F)
-#define MOCK_CONST_METHOD9_T(m, F) GMOCK_METHOD9_(typename, const, , m, F)
-#define MOCK_CONST_METHOD10_T(m, F) GMOCK_METHOD10_(typename, const, , m, F)
-
-#define MOCK_METHOD0_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD0_(, , ct, m, F)
-#define MOCK_METHOD1_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD1_(, , ct, m, F)
-#define MOCK_METHOD2_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD2_(, , ct, m, F)
-#define MOCK_METHOD3_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD3_(, , ct, m, F)
-#define MOCK_METHOD4_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD4_(, , ct, m, F)
-#define MOCK_METHOD5_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD5_(, , ct, m, F)
-#define MOCK_METHOD6_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD6_(, , ct, m, F)
-#define MOCK_METHOD7_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD7_(, , ct, m, F)
-#define MOCK_METHOD8_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD8_(, , ct, m, F)
-#define MOCK_METHOD9_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD9_(, , ct, m, F)
-#define MOCK_METHOD10_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD10_(, , ct, m, F)
-
-#define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD0_(, const, ct, m, F)
-#define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD1_(, const, ct, m, F)
-#define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD2_(, const, ct, m, F)
-#define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD3_(, const, ct, m, F)
-#define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD4_(, const, ct, m, F)
-#define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD5_(, const, ct, m, F)
-#define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD6_(, const, ct, m, F)
-#define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD7_(, const, ct, m, F)
-#define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD8_(, const, ct, m, F)
-#define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD9_(, const, ct, m, F)
-#define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD10_(, const, ct, m, F)
-
-#define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD0_(typename, , ct, m, F)
-#define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD1_(typename, , ct, m, F)
-#define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD2_(typename, , ct, m, F)
-#define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD3_(typename, , ct, m, F)
-#define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD4_(typename, , ct, m, F)
-#define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD5_(typename, , ct, m, F)
-#define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD6_(typename, , ct, m, F)
-#define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD7_(typename, , ct, m, F)
-#define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD8_(typename, , ct, m, F)
-#define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD9_(typename, , ct, m, F)
-#define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD10_(typename, , ct, m, F)
-
-#define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD0_(typename, const, ct, m, F)
-#define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD1_(typename, const, ct, m, F)
-#define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD2_(typename, const, ct, m, F)
-#define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD3_(typename, const, ct, m, F)
-#define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD4_(typename, const, ct, m, F)
-#define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD5_(typename, const, ct, m, F)
-#define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD6_(typename, const, ct, m, F)
-#define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD7_(typename, const, ct, m, F)
-#define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD8_(typename, const, ct, m, F)
-#define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD9_(typename, const, ct, m, F)
-#define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, F) \
-    GMOCK_METHOD10_(typename, const, ct, m, F)
-
-// A MockFunction<F> class has one mock method whose type is F.  It is
-// useful when you just want your test code to emit some messages and
-// have Google Mock verify the right messages are sent (and perhaps at
-// the right times).  For example, if you are exercising code:
-//
-//   Foo(1);
-//   Foo(2);
-//   Foo(3);
-//
-// and want to verify that Foo(1) and Foo(3) both invoke
-// mock.Bar("a"), but Foo(2) doesn't invoke anything, you can write:
-//
-// TEST(FooTest, InvokesBarCorrectly) {
-//   MyMock mock;
-//   MockFunction<void(string check_point_name)> check;
-//   {
-//     InSequence s;
-//
-//     EXPECT_CALL(mock, Bar("a"));
-//     EXPECT_CALL(check, Call("1"));
-//     EXPECT_CALL(check, Call("2"));
-//     EXPECT_CALL(mock, Bar("a"));
-//   }
-//   Foo(1);
-//   check.Call("1");
-//   Foo(2);
-//   check.Call("2");
-//   Foo(3);
-// }
-//
-// The expectation spec says that the first Bar("a") must happen
-// before check point "1", the second Bar("a") must happen after check
-// point "2", and nothing should happen between the two check
-// points. The explicit check points make it easy to tell which
-// Bar("a") is called by which call to Foo().
-template <typename F>
-class MockFunction;
-
-template <typename R>
-class MockFunction<R()> {
- public:
-  MOCK_METHOD0_T(Call, R());
-};
-
-template <typename R, typename A0>
-class MockFunction<R(A0)> {
- public:
-  MOCK_METHOD1_T(Call, R(A0));
-};
-
-template <typename R, typename A0, typename A1>
-class MockFunction<R(A0, A1)> {
- public:
-  MOCK_METHOD2_T(Call, R(A0, A1));
-};
-
-template <typename R, typename A0, typename A1, typename A2>
-class MockFunction<R(A0, A1, A2)> {
- public:
-  MOCK_METHOD3_T(Call, R(A0, A1, A2));
-};
-
-template <typename R, typename A0, typename A1, typename A2, typename A3>
-class MockFunction<R(A0, A1, A2, A3)> {
- public:
-  MOCK_METHOD4_T(Call, R(A0, A1, A2, A3));
-};
-
-template <typename R, typename A0, typename A1, typename A2, typename A3,
-    typename A4>
-class MockFunction<R(A0, A1, A2, A3, A4)> {
- public:
-  MOCK_METHOD5_T(Call, R(A0, A1, A2, A3, A4));
-};
-
-template <typename R, typename A0, typename A1, typename A2, typename A3,
-    typename A4, typename A5>
-class MockFunction<R(A0, A1, A2, A3, A4, A5)> {
- public:
-  MOCK_METHOD6_T(Call, R(A0, A1, A2, A3, A4, A5));
-};
-
-template <typename R, typename A0, typename A1, typename A2, typename A3,
-    typename A4, typename A5, typename A6>
-class MockFunction<R(A0, A1, A2, A3, A4, A5, A6)> {
- public:
-  MOCK_METHOD7_T(Call, R(A0, A1, A2, A3, A4, A5, A6));
-};
-
-template <typename R, typename A0, typename A1, typename A2, typename A3,
-    typename A4, typename A5, typename A6, typename A7>
-class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7)> {
- public:
-  MOCK_METHOD8_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7));
-};
-
-template <typename R, typename A0, typename A1, typename A2, typename A3,
-    typename A4, typename A5, typename A6, typename A7, typename A8>
-class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> {
- public:
-  MOCK_METHOD9_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8));
-};
-
-template <typename R, typename A0, typename A1, typename A2, typename A3,
-    typename A4, typename A5, typename A6, typename A7, typename A8,
-    typename A9>
-class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
- public:
-  MOCK_METHOD10_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9));
-};
-
-}  // namespace testing
-
-#endif  // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
diff --git a/third_party/gmock/include/gmock/gmock-generated-matchers.h b/third_party/gmock/include/gmock/gmock-generated-matchers.h
deleted file mode 100644
index a59e457..0000000
--- a/third_party/gmock/include/gmock/gmock-generated-matchers.h
+++ /dev/null
@@ -1,1700 +0,0 @@
-// This file was GENERATED by a script.  DO NOT EDIT BY HAND!!!
-
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements some commonly used variadic matchers.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
-
-#include <sstream>
-#include <string>
-#include <vector>
-#include <gmock/gmock-matchers.h>
-#include <gmock/gmock-printers.h>
-
-namespace testing {
-namespace internal {
-
-// The type of the i-th (0-based) field of Tuple.
-#define GMOCK_FIELD_TYPE_(Tuple, i) \
-    typename ::std::tr1::tuple_element<i, Tuple>::type
-
-// TupleFields<Tuple, k0, ..., kn> is for selecting fields from a
-// tuple of type Tuple.  It has two members:
-//
-//   type: a tuple type whose i-th field is the ki-th field of Tuple.
-//   GetSelectedFields(t): returns fields k0, ..., and kn of t as a tuple.
-//
-// For example, in class TupleFields<tuple<bool, char, int>, 2, 0>, we have:
-//
-//   type is tuple<int, bool>, and
-//   GetSelectedFields(make_tuple(true, 'a', 42)) is (42, true).
-
-template <class Tuple, int k0 = -1, int k1 = -1, int k2 = -1, int k3 = -1,
-    int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1,
-    int k9 = -1>
-class TupleFields;
-
-// This generic version is used when there are 10 selectors.
-template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6,
-    int k7, int k8, int k9>
-class TupleFields {
- public:
-  typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
-      GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
-      GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
-      GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6),
-      GMOCK_FIELD_TYPE_(Tuple, k7), GMOCK_FIELD_TYPE_(Tuple, k8),
-      GMOCK_FIELD_TYPE_(Tuple, k9)> type;
-  static type GetSelectedFields(const Tuple& t) {
-    using ::std::tr1::get;
-    return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
-        get<k5>(t), get<k6>(t), get<k7>(t), get<k8>(t), get<k9>(t));
-  }
-};
-
-// The following specialization is used for 0 ~ 9 selectors.
-
-template <class Tuple>
-class TupleFields<Tuple, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
- public:
-  typedef ::std::tr1::tuple<> type;
-  static type GetSelectedFields(const Tuple& t) {
-    using ::std::tr1::get;
-    return type();
-  }
-};
-
-template <class Tuple, int k0>
-class TupleFields<Tuple, k0, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
- public:
-  typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0)> type;
-  static type GetSelectedFields(const Tuple& t) {
-    using ::std::tr1::get;
-    return type(get<k0>(t));
-  }
-};
-
-template <class Tuple, int k0, int k1>
-class TupleFields<Tuple, k0, k1, -1, -1, -1, -1, -1, -1, -1, -1> {
- public:
-  typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
-      GMOCK_FIELD_TYPE_(Tuple, k1)> type;
-  static type GetSelectedFields(const Tuple& t) {
-    using ::std::tr1::get;
-    return type(get<k0>(t), get<k1>(t));
-  }
-};
-
-template <class Tuple, int k0, int k1, int k2>
-class TupleFields<Tuple, k0, k1, k2, -1, -1, -1, -1, -1, -1, -1> {
- public:
-  typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
-      GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2)> type;
-  static type GetSelectedFields(const Tuple& t) {
-    using ::std::tr1::get;
-    return type(get<k0>(t), get<k1>(t), get<k2>(t));
-  }
-};
-
-template <class Tuple, int k0, int k1, int k2, int k3>
-class TupleFields<Tuple, k0, k1, k2, k3, -1, -1, -1, -1, -1, -1> {
- public:
-  typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
-      GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
-      GMOCK_FIELD_TYPE_(Tuple, k3)> type;
-  static type GetSelectedFields(const Tuple& t) {
-    using ::std::tr1::get;
-    return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t));
-  }
-};
-
-template <class Tuple, int k0, int k1, int k2, int k3, int k4>
-class TupleFields<Tuple, k0, k1, k2, k3, k4, -1, -1, -1, -1, -1> {
- public:
-  typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
-      GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
-      GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4)> type;
-  static type GetSelectedFields(const Tuple& t) {
-    using ::std::tr1::get;
-    return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t));
-  }
-};
-
-template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5>
-class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, -1, -1, -1, -1> {
- public:
-  typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
-      GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
-      GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
-      GMOCK_FIELD_TYPE_(Tuple, k5)> type;
-  static type GetSelectedFields(const Tuple& t) {
-    using ::std::tr1::get;
-    return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
-        get<k5>(t));
-  }
-};
-
-template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6>
-class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, -1, -1, -1> {
- public:
-  typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
-      GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
-      GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
-      GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6)> type;
-  static type GetSelectedFields(const Tuple& t) {
-    using ::std::tr1::get;
-    return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
-        get<k5>(t), get<k6>(t));
-  }
-};
-
-template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6,
-    int k7>
-class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, k7, -1, -1> {
- public:
-  typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
-      GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
-      GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
-      GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6),
-      GMOCK_FIELD_TYPE_(Tuple, k7)> type;
-  static type GetSelectedFields(const Tuple& t) {
-    using ::std::tr1::get;
-    return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
-        get<k5>(t), get<k6>(t), get<k7>(t));
-  }
-};
-
-template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6,
-    int k7, int k8>
-class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, k7, k8, -1> {
- public:
-  typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
-      GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
-      GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
-      GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6),
-      GMOCK_FIELD_TYPE_(Tuple, k7), GMOCK_FIELD_TYPE_(Tuple, k8)> type;
-  static type GetSelectedFields(const Tuple& t) {
-    using ::std::tr1::get;
-    return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
-        get<k5>(t), get<k6>(t), get<k7>(t), get<k8>(t));
-  }
-};
-
-#undef GMOCK_FIELD_TYPE_
-
-// Implements the Args() matcher.
-template <class ArgsTuple, int k0 = -1, int k1 = -1, int k2 = -1, int k3 = -1,
-    int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1,
-    int k9 = -1>
-class ArgsMatcherImpl : public MatcherInterface<ArgsTuple> {
- public:
-  // ArgsTuple may have top-level const or reference modifiers.
-  typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(ArgsTuple)) RawArgsTuple;
-  typedef typename internal::TupleFields<RawArgsTuple, k0, k1, k2, k3, k4, k5,
-      k6, k7, k8, k9>::type SelectedArgs;
-  typedef Matcher<const SelectedArgs&> MonomorphicInnerMatcher;
-
-  template <typename InnerMatcher>
-  explicit ArgsMatcherImpl(const InnerMatcher& inner_matcher)
-      : inner_matcher_(SafeMatcherCast<const SelectedArgs&>(inner_matcher)) {}
-
-  virtual bool Matches(ArgsTuple args) const {
-    return inner_matcher_.Matches(GetSelectedArgs(args));
-  }
-
-  virtual void DescribeTo(::std::ostream* os) const {
-    PrintIndices(os);
-    inner_matcher_.DescribeTo(os);
-  }
-
-  virtual void DescribeNegationTo(::std::ostream* os) const {
-    PrintIndices(os);
-    inner_matcher_.DescribeNegationTo(os);
-  }
-
-  virtual void ExplainMatchResultTo(ArgsTuple args,
-                                    ::std::ostream* os) const {
-    inner_matcher_.ExplainMatchResultTo(GetSelectedArgs(args), os);
-  }
-
- private:
-  static SelectedArgs GetSelectedArgs(ArgsTuple args) {
-    return TupleFields<RawArgsTuple, k0, k1, k2, k3, k4, k5, k6, k7, k8,
-        k9>::GetSelectedFields(args);
-  }
-
-  // Prints the indices of the selected fields.
-  static void PrintIndices(::std::ostream* os) {
-    *os << "are a tuple whose fields (";
-    const int indices[10] = { k0, k1, k2, k3, k4, k5, k6, k7, k8, k9 };
-    for (int i = 0; i < 10; i++) {
-      if (indices[i] < 0)
-        break;
-
-      if (i >= 1)
-        *os << ", ";
-
-      *os << "#" << indices[i];
-    }
-    *os << ") ";
-  }
-
-  const MonomorphicInnerMatcher inner_matcher_;
-};
-
-template <class InnerMatcher, int k0 = -1, int k1 = -1, int k2 = -1,
-    int k3 = -1, int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1,
-    int k8 = -1, int k9 = -1>
-class ArgsMatcher {
- public:
-  explicit ArgsMatcher(const InnerMatcher& inner_matcher)
-      : inner_matcher_(inner_matcher) {}
-
-  template <typename ArgsTuple>
-  operator Matcher<ArgsTuple>() const {
-    return MakeMatcher(new ArgsMatcherImpl<ArgsTuple, k0, k1, k2, k3, k4, k5,
-        k6, k7, k8, k9>(inner_matcher_));
-  }
-
-  const InnerMatcher inner_matcher_;
-};
-
-// Implements ElementsAre() of 1-10 arguments.
-
-template <typename T1>
-class ElementsAreMatcher1 {
- public:
-  explicit ElementsAreMatcher1(const T1& e1) : e1_(e1) {}
-
-  template <typename Container>
-  operator Matcher<Container>() const {
-    typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
-        RawContainer;
-    typedef typename internal::StlContainerView<RawContainer>::type::value_type
-        Element;
-
-    // Nokia's Symbian Compiler has a nasty bug where the object put
-    // in a one-element local array is not destructed when the array
-    // goes out of scope.  This leads to obvious badness as we've
-    // added the linked_ptr in it to our other linked_ptrs list.
-    // Hence we implement ElementsAreMatcher1 specially to avoid using
-    // a local array.
-    const Matcher<const Element&> matcher =
-        MatcherCast<const Element&>(e1_);
-    return MakeMatcher(new ElementsAreMatcherImpl<Container>(&matcher, 1));
-  }
-
- private:
-  const T1& e1_;
-};
-
-template <typename T1, typename T2>
-class ElementsAreMatcher2 {
- public:
-  ElementsAreMatcher2(const T1& e1, const T2& e2) : e1_(e1), e2_(e2) {}
-
-  template <typename Container>
-  operator Matcher<Container>() const {
-    typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
-        RawContainer;
-    typedef typename internal::StlContainerView<RawContainer>::type::value_type
-        Element;
-
-    const Matcher<const Element&> matchers[] = {
-      MatcherCast<const Element&>(e1_),
-      MatcherCast<const Element&>(e2_),
-    };
-
-    return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 2));
-  }
-
- private:
-  const T1& e1_;
-  const T2& e2_;
-};
-
-template <typename T1, typename T2, typename T3>
-class ElementsAreMatcher3 {
- public:
-  ElementsAreMatcher3(const T1& e1, const T2& e2, const T3& e3) : e1_(e1),
-      e2_(e2), e3_(e3) {}
-
-  template <typename Container>
-  operator Matcher<Container>() const {
-    typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
-        RawContainer;
-    typedef typename internal::StlContainerView<RawContainer>::type::value_type
-        Element;
-
-    const Matcher<const Element&> matchers[] = {
-      MatcherCast<const Element&>(e1_),
-      MatcherCast<const Element&>(e2_),
-      MatcherCast<const Element&>(e3_),
-    };
-
-    return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 3));
-  }
-
- private:
-  const T1& e1_;
-  const T2& e2_;
-  const T3& e3_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4>
-class ElementsAreMatcher4 {
- public:
-  ElementsAreMatcher4(const T1& e1, const T2& e2, const T3& e3,
-      const T4& e4) : e1_(e1), e2_(e2), e3_(e3), e4_(e4) {}
-
-  template <typename Container>
-  operator Matcher<Container>() const {
-    typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
-        RawContainer;
-    typedef typename internal::StlContainerView<RawContainer>::type::value_type
-        Element;
-
-    const Matcher<const Element&> matchers[] = {
-      MatcherCast<const Element&>(e1_),
-      MatcherCast<const Element&>(e2_),
-      MatcherCast<const Element&>(e3_),
-      MatcherCast<const Element&>(e4_),
-    };
-
-    return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 4));
-  }
-
- private:
-  const T1& e1_;
-  const T2& e2_;
-  const T3& e3_;
-  const T4& e4_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-class ElementsAreMatcher5 {
- public:
-  ElementsAreMatcher5(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
-      const T5& e5) : e1_(e1), e2_(e2), e3_(e3), e4_(e4), e5_(e5) {}
-
-  template <typename Container>
-  operator Matcher<Container>() const {
-    typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
-        RawContainer;
-    typedef typename internal::StlContainerView<RawContainer>::type::value_type
-        Element;
-
-    const Matcher<const Element&> matchers[] = {
-      MatcherCast<const Element&>(e1_),
-      MatcherCast<const Element&>(e2_),
-      MatcherCast<const Element&>(e3_),
-      MatcherCast<const Element&>(e4_),
-      MatcherCast<const Element&>(e5_),
-    };
-
-    return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 5));
-  }
-
- private:
-  const T1& e1_;
-  const T2& e2_;
-  const T3& e3_;
-  const T4& e4_;
-  const T5& e5_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6>
-class ElementsAreMatcher6 {
- public:
-  ElementsAreMatcher6(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
-      const T5& e5, const T6& e6) : e1_(e1), e2_(e2), e3_(e3), e4_(e4),
-      e5_(e5), e6_(e6) {}
-
-  template <typename Container>
-  operator Matcher<Container>() const {
-    typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
-        RawContainer;
-    typedef typename internal::StlContainerView<RawContainer>::type::value_type
-        Element;
-
-    const Matcher<const Element&> matchers[] = {
-      MatcherCast<const Element&>(e1_),
-      MatcherCast<const Element&>(e2_),
-      MatcherCast<const Element&>(e3_),
-      MatcherCast<const Element&>(e4_),
-      MatcherCast<const Element&>(e5_),
-      MatcherCast<const Element&>(e6_),
-    };
-
-    return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 6));
-  }
-
- private:
-  const T1& e1_;
-  const T2& e2_;
-  const T3& e3_;
-  const T4& e4_;
-  const T5& e5_;
-  const T6& e6_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7>
-class ElementsAreMatcher7 {
- public:
-  ElementsAreMatcher7(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
-      const T5& e5, const T6& e6, const T7& e7) : e1_(e1), e2_(e2), e3_(e3),
-      e4_(e4), e5_(e5), e6_(e6), e7_(e7) {}
-
-  template <typename Container>
-  operator Matcher<Container>() const {
-    typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
-        RawContainer;
-    typedef typename internal::StlContainerView<RawContainer>::type::value_type
-        Element;
-
-    const Matcher<const Element&> matchers[] = {
-      MatcherCast<const Element&>(e1_),
-      MatcherCast<const Element&>(e2_),
-      MatcherCast<const Element&>(e3_),
-      MatcherCast<const Element&>(e4_),
-      MatcherCast<const Element&>(e5_),
-      MatcherCast<const Element&>(e6_),
-      MatcherCast<const Element&>(e7_),
-    };
-
-    return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 7));
-  }
-
- private:
-  const T1& e1_;
-  const T2& e2_;
-  const T3& e3_;
-  const T4& e4_;
-  const T5& e5_;
-  const T6& e6_;
-  const T7& e7_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8>
-class ElementsAreMatcher8 {
- public:
-  ElementsAreMatcher8(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
-      const T5& e5, const T6& e6, const T7& e7, const T8& e8) : e1_(e1),
-      e2_(e2), e3_(e3), e4_(e4), e5_(e5), e6_(e6), e7_(e7), e8_(e8) {}
-
-  template <typename Container>
-  operator Matcher<Container>() const {
-    typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
-        RawContainer;
-    typedef typename internal::StlContainerView<RawContainer>::type::value_type
-        Element;
-
-    const Matcher<const Element&> matchers[] = {
-      MatcherCast<const Element&>(e1_),
-      MatcherCast<const Element&>(e2_),
-      MatcherCast<const Element&>(e3_),
-      MatcherCast<const Element&>(e4_),
-      MatcherCast<const Element&>(e5_),
-      MatcherCast<const Element&>(e6_),
-      MatcherCast<const Element&>(e7_),
-      MatcherCast<const Element&>(e8_),
-    };
-
-    return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 8));
-  }
-
- private:
-  const T1& e1_;
-  const T2& e2_;
-  const T3& e3_;
-  const T4& e4_;
-  const T5& e5_;
-  const T6& e6_;
-  const T7& e7_;
-  const T8& e8_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9>
-class ElementsAreMatcher9 {
- public:
-  ElementsAreMatcher9(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
-      const T5& e5, const T6& e6, const T7& e7, const T8& e8,
-      const T9& e9) : e1_(e1), e2_(e2), e3_(e3), e4_(e4), e5_(e5), e6_(e6),
-      e7_(e7), e8_(e8), e9_(e9) {}
-
-  template <typename Container>
-  operator Matcher<Container>() const {
-    typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
-        RawContainer;
-    typedef typename internal::StlContainerView<RawContainer>::type::value_type
-        Element;
-
-    const Matcher<const Element&> matchers[] = {
-      MatcherCast<const Element&>(e1_),
-      MatcherCast<const Element&>(e2_),
-      MatcherCast<const Element&>(e3_),
-      MatcherCast<const Element&>(e4_),
-      MatcherCast<const Element&>(e5_),
-      MatcherCast<const Element&>(e6_),
-      MatcherCast<const Element&>(e7_),
-      MatcherCast<const Element&>(e8_),
-      MatcherCast<const Element&>(e9_),
-    };
-
-    return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 9));
-  }
-
- private:
-  const T1& e1_;
-  const T2& e2_;
-  const T3& e3_;
-  const T4& e4_;
-  const T5& e5_;
-  const T6& e6_;
-  const T7& e7_;
-  const T8& e8_;
-  const T9& e9_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10>
-class ElementsAreMatcher10 {
- public:
-  ElementsAreMatcher10(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
-      const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9,
-      const T10& e10) : e1_(e1), e2_(e2), e3_(e3), e4_(e4), e5_(e5), e6_(e6),
-      e7_(e7), e8_(e8), e9_(e9), e10_(e10) {}
-
-  template <typename Container>
-  operator Matcher<Container>() const {
-    typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
-        RawContainer;
-    typedef typename internal::StlContainerView<RawContainer>::type::value_type
-        Element;
-
-    const Matcher<const Element&> matchers[] = {
-      MatcherCast<const Element&>(e1_),
-      MatcherCast<const Element&>(e2_),
-      MatcherCast<const Element&>(e3_),
-      MatcherCast<const Element&>(e4_),
-      MatcherCast<const Element&>(e5_),
-      MatcherCast<const Element&>(e6_),
-      MatcherCast<const Element&>(e7_),
-      MatcherCast<const Element&>(e8_),
-      MatcherCast<const Element&>(e9_),
-      MatcherCast<const Element&>(e10_),
-    };
-
-    return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 10));
-  }
-
- private:
-  const T1& e1_;
-  const T2& e2_;
-  const T3& e3_;
-  const T4& e4_;
-  const T5& e5_;
-  const T6& e6_;
-  const T7& e7_;
-  const T8& e8_;
-  const T9& e9_;
-  const T10& e10_;
-};
-
-}  // namespace internal
-
-// Args<N1, N2, ..., Nk>(a_matcher) matches a tuple if the selected
-// fields of it matches a_matcher.  C++ doesn't support default
-// arguments for function templates, so we have to overload it.
-template <typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher>
-Args(const InnerMatcher& matcher) {
-  return internal::ArgsMatcher<InnerMatcher>(matcher);
-}
-
-template <int k1, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1>
-Args(const InnerMatcher& matcher) {
-  return internal::ArgsMatcher<InnerMatcher, k1>(matcher);
-}
-
-template <int k1, int k2, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2>
-Args(const InnerMatcher& matcher) {
-  return internal::ArgsMatcher<InnerMatcher, k1, k2>(matcher);
-}
-
-template <int k1, int k2, int k3, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3>
-Args(const InnerMatcher& matcher) {
-  return internal::ArgsMatcher<InnerMatcher, k1, k2, k3>(matcher);
-}
-
-template <int k1, int k2, int k3, int k4, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4>
-Args(const InnerMatcher& matcher) {
-  return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4>(matcher);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5>
-Args(const InnerMatcher& matcher) {
-  return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5>(matcher);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6>
-Args(const InnerMatcher& matcher) {
-  return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6>(matcher);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7,
-    typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7>
-Args(const InnerMatcher& matcher) {
-  return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6,
-      k7>(matcher);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
-    typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8>
-Args(const InnerMatcher& matcher) {
-  return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7,
-      k8>(matcher);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
-    int k9, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8, k9>
-Args(const InnerMatcher& matcher) {
-  return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8,
-      k9>(matcher);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
-    int k9, int k10, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8, k9,
-    k10>
-Args(const InnerMatcher& matcher) {
-  return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8,
-      k9, k10>(matcher);
-}
-
-// ElementsAre(e0, e1, ..., e_n) matches an STL-style container with
-// (n + 1) elements, where the i-th element in the container must
-// match the i-th argument in the list.  Each argument of
-// ElementsAre() can be either a value or a matcher.  We support up to
-// 10 arguments.
-//
-// NOTE: Since ElementsAre() cares about the order of the elements, it
-// must not be used with containers whose elements's order is
-// undefined (e.g. hash_map).
-
-inline internal::ElementsAreMatcher0 ElementsAre() {
-  return internal::ElementsAreMatcher0();
-}
-
-template <typename T1>
-inline internal::ElementsAreMatcher1<T1> ElementsAre(const T1& e1) {
-  return internal::ElementsAreMatcher1<T1>(e1);
-}
-
-template <typename T1, typename T2>
-inline internal::ElementsAreMatcher2<T1, T2> ElementsAre(const T1& e1,
-    const T2& e2) {
-  return internal::ElementsAreMatcher2<T1, T2>(e1, e2);
-}
-
-template <typename T1, typename T2, typename T3>
-inline internal::ElementsAreMatcher3<T1, T2, T3> ElementsAre(const T1& e1,
-    const T2& e2, const T3& e3) {
-  return internal::ElementsAreMatcher3<T1, T2, T3>(e1, e2, e3);
-}
-
-template <typename T1, typename T2, typename T3, typename T4>
-inline internal::ElementsAreMatcher4<T1, T2, T3, T4> ElementsAre(const T1& e1,
-    const T2& e2, const T3& e3, const T4& e4) {
-  return internal::ElementsAreMatcher4<T1, T2, T3, T4>(e1, e2, e3, e4);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-inline internal::ElementsAreMatcher5<T1, T2, T3, T4,
-    T5> ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
-    const T5& e5) {
-  return internal::ElementsAreMatcher5<T1, T2, T3, T4, T5>(e1, e2, e3, e4, e5);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6>
-inline internal::ElementsAreMatcher6<T1, T2, T3, T4, T5,
-    T6> ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
-    const T5& e5, const T6& e6) {
-  return internal::ElementsAreMatcher6<T1, T2, T3, T4, T5, T6>(e1, e2, e3, e4,
-      e5, e6);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7>
-inline internal::ElementsAreMatcher7<T1, T2, T3, T4, T5, T6,
-    T7> ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
-    const T5& e5, const T6& e6, const T7& e7) {
-  return internal::ElementsAreMatcher7<T1, T2, T3, T4, T5, T6, T7>(e1, e2, e3,
-      e4, e5, e6, e7);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8>
-inline internal::ElementsAreMatcher8<T1, T2, T3, T4, T5, T6, T7,
-    T8> ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
-    const T5& e5, const T6& e6, const T7& e7, const T8& e8) {
-  return internal::ElementsAreMatcher8<T1, T2, T3, T4, T5, T6, T7, T8>(e1, e2,
-      e3, e4, e5, e6, e7, e8);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9>
-inline internal::ElementsAreMatcher9<T1, T2, T3, T4, T5, T6, T7, T8,
-    T9> ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
-    const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9) {
-  return internal::ElementsAreMatcher9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(e1,
-      e2, e3, e4, e5, e6, e7, e8, e9);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10>
-inline internal::ElementsAreMatcher10<T1, T2, T3, T4, T5, T6, T7, T8, T9,
-    T10> ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
-    const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9,
-    const T10& e10) {
-  return internal::ElementsAreMatcher10<T1, T2, T3, T4, T5, T6, T7, T8, T9,
-      T10>(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10);
-}
-
-// ElementsAreArray(array) and ElementAreArray(array, count) are like
-// ElementsAre(), except that they take an array of values or
-// matchers.  The former form infers the size of 'array', which must
-// be a static C-style array.  In the latter form, 'array' can either
-// be a static array or a pointer to a dynamically created array.
-
-template <typename T>
-inline internal::ElementsAreArrayMatcher<T> ElementsAreArray(
-    const T* first, size_t count) {
-  return internal::ElementsAreArrayMatcher<T>(first, count);
-}
-
-template <typename T, size_t N>
-inline internal::ElementsAreArrayMatcher<T>
-ElementsAreArray(const T (&array)[N]) {
-  return internal::ElementsAreArrayMatcher<T>(array, N);
-}
-
-}  // namespace testing
-
-// The MATCHER* family of macros can be used in a namespace scope to
-// define custom matchers easily.  The syntax:
-//
-//   MATCHER(name, description_string) { statements; }
-//
-// will define a matcher with the given name that executes the
-// statements, which must return a bool to indicate if the match
-// succeeds.  Inside the statements, you can refer to the value being
-// matched by 'arg', and refer to its type by 'arg_type'.
-//
-// The description string documents what the matcher does, and is used
-// to generate the failure message when the match fails.  Since a
-// MATCHER() is usually defined in a header file shared by multiple
-// C++ source files, we require the description to be a C-string
-// literal to avoid possible side effects.  It can be empty, in which
-// case we'll use the sequence of words in the matcher name as the
-// description.
-//
-// For example:
-//
-//   MATCHER(IsEven, "") { return (arg % 2) == 0; }
-//
-// allows you to write
-//
-//   // Expects mock_foo.Bar(n) to be called where n is even.
-//   EXPECT_CALL(mock_foo, Bar(IsEven()));
-//
-// or,
-//
-//   // Verifies that the value of some_expression is even.
-//   EXPECT_THAT(some_expression, IsEven());
-//
-// If the above assertion fails, it will print something like:
-//
-//   Value of: some_expression
-//   Expected: is even
-//     Actual: 7
-//
-// where the description "is even" is automatically calculated from the
-// matcher name IsEven.
-//
-// Note that the type of the value being matched (arg_type) is
-// determined by the context in which you use the matcher and is
-// supplied to you by the compiler, so you don't need to worry about
-// declaring it (nor can you).  This allows the matcher to be
-// polymorphic.  For example, IsEven() can be used to match any type
-// where the value of "(arg % 2) == 0" can be implicitly converted to
-// a bool.  In the "Bar(IsEven())" example above, if method Bar()
-// takes an int, 'arg_type' will be int; if it takes an unsigned long,
-// 'arg_type' will be unsigned long; and so on.
-//
-// Sometimes you'll want to parameterize the matcher.  For that you
-// can use another macro:
-//
-//   MATCHER_P(name, param_name, description_string) { statements; }
-//
-// For example:
-//
-//   MATCHER_P(HasAbsoluteValue, value, "") { return abs(arg) == value; }
-//
-// will allow you to write:
-//
-//   EXPECT_THAT(Blah("a"), HasAbsoluteValue(n));
-//
-// which may lead to this message (assuming n is 10):
-//
-//   Value of: Blah("a")
-//   Expected: has absolute value 10
-//     Actual: -9
-//
-// Note that both the matcher description and its parameter are
-// printed, making the message human-friendly.
-//
-// In the matcher definition body, you can write 'foo_type' to
-// reference the type of a parameter named 'foo'.  For example, in the
-// body of MATCHER_P(HasAbsoluteValue, value) above, you can write
-// 'value_type' to refer to the type of 'value'.
-//
-// We also provide MATCHER_P2, MATCHER_P3, ..., up to MATCHER_P10 to
-// support multi-parameter matchers.
-//
-// When defining a parameterized matcher, you can use Python-style
-// interpolations in the description string to refer to the parameter
-// values.  We support the following syntax currently:
-//
-//   %%       a single '%' character
-//   %(*)s    all parameters of the matcher printed as a tuple
-//   %(foo)s  value of the matcher parameter named 'foo'
-//
-// For example,
-//
-//   MATCHER_P2(InClosedRange, low, hi, "is in range [%(low)s, %(hi)s]") {
-//     return low <= arg && arg <= hi;
-//   }
-//   ...
-//   EXPECT_THAT(3, InClosedRange(4, 6));
-//
-// would generate a failure that contains the message:
-//
-//   Expected: is in range [4, 6]
-//
-// If you specify "" as the description, the failure message will
-// contain the sequence of words in the matcher name followed by the
-// parameter values printed as a tuple.  For example,
-//
-//   MATCHER_P2(InClosedRange, low, hi, "") { ... }
-//   ...
-//   EXPECT_THAT(3, InClosedRange(4, 6));
-//
-// would generate a failure that contains the text:
-//
-//   Expected: in closed range (4, 6)
-//
-// For the purpose of typing, you can view
-//
-//   MATCHER_Pk(Foo, p1, ..., pk, description_string) { ... }
-//
-// as shorthand for
-//
-//   template <typename p1_type, ..., typename pk_type>
-//   FooMatcherPk<p1_type, ..., pk_type>
-//   Foo(p1_type p1, ..., pk_type pk) { ... }
-//
-// When you write Foo(v1, ..., vk), the compiler infers the types of
-// the parameters v1, ..., and vk for you.  If you are not happy with
-// the result of the type inference, you can specify the types by
-// explicitly instantiating the template, as in Foo<long, bool>(5,
-// false).  As said earlier, you don't get to (or need to) specify
-// 'arg_type' as that's determined by the context in which the matcher
-// is used.  You can assign the result of expression Foo(p1, ..., pk)
-// to a variable of type FooMatcherPk<p1_type, ..., pk_type>.  This
-// can be useful when composing matchers.
-//
-// While you can instantiate a matcher template with reference types,
-// passing the parameters by pointer usually makes your code more
-// readable.  If, however, you still want to pass a parameter by
-// reference, be aware that in the failure message generated by the
-// matcher you will see the value of the referenced object but not its
-// address.
-//
-// You can overload matchers with different numbers of parameters:
-//
-//   MATCHER_P(Blah, a, description_string1) { ... }
-//   MATCHER_P2(Blah, a, b, description_string2) { ... }
-//
-// While it's tempting to always use the MATCHER* macros when defining
-// a new matcher, you should also consider implementing
-// MatcherInterface or using MakePolymorphicMatcher() instead,
-// especially if you need to use the matcher a lot.  While these
-// approaches require more work, they give you more control on the
-// types of the value being matched and the matcher parameters, which
-// in general leads to better compiler error messages that pay off in
-// the long run.  They also allow overloading matchers based on
-// parameter types (as opposed to just based on the number of
-// parameters).
-//
-// CAVEAT:
-//
-// MATCHER*() can only be used in a namespace scope.  The reason is
-// that C++ doesn't yet allow function-local types to be used to
-// instantiate templates.  The up-coming C++0x standard will fix this.
-// Once that's done, we'll consider supporting using MATCHER*() inside
-// a function.
-//
-// MORE INFORMATION:
-//
-// To learn more about using these macros, please search for 'MATCHER'
-// on http://code.google.com/p/googlemock/wiki/CookBook.
-
-#define MATCHER(name, description)\
-  class name##Matcher {\
-   public:\
-    template <typename arg_type>\
-    class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
-     public:\
-      gmock_Impl(const ::testing::internal::Interpolations& gmock_interp)\
-           : gmock_interp_(gmock_interp) {}\
-      virtual bool Matches(arg_type arg) const;\
-      virtual void DescribeTo(::std::ostream* gmock_os) const {\
-        const ::testing::internal::Strings& gmock_printed_params = \
-            ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
-                ::std::tr1::tuple<>());\
-        *gmock_os << ::testing::internal::FormatMatcherDescription(\
-                     #name, description, gmock_interp_, gmock_printed_params);\
-      }\
-      const ::testing::internal::Interpolations gmock_interp_;\
-    };\
-    template <typename arg_type>\
-    operator ::testing::Matcher<arg_type>() const {\
-      return ::testing::Matcher<arg_type>(\
-          new gmock_Impl<arg_type>(gmock_interp_));\
-    }\
-    name##Matcher() {\
-      const char* gmock_param_names[] = { NULL };\
-      gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\
-          gmock_param_names, ("" description ""));\
-    }\
-    ::testing::internal::Interpolations gmock_interp_;\
-  };\
-  inline name##Matcher name() {\
-    return name##Matcher();\
-  }\
-  template <typename arg_type>\
-  bool name##Matcher::\
-      gmock_Impl<arg_type>::Matches(arg_type arg) const
-
-#define MATCHER_P(name, p0, description)\
-  template <typename p0##_type>\
-  class name##MatcherP {\
-   public:\
-    template <typename arg_type>\
-    class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
-     public:\
-      explicit gmock_Impl(p0##_type gmock_p0, \
-          const ::testing::internal::Interpolations& gmock_interp)\
-           : p0(gmock_p0), gmock_interp_(gmock_interp) {}\
-      virtual bool Matches(arg_type arg) const;\
-      virtual void DescribeTo(::std::ostream* gmock_os) const {\
-        const ::testing::internal::Strings& gmock_printed_params = \
-            ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
-                ::std::tr1::tuple<p0##_type>(p0));\
-        *gmock_os << ::testing::internal::FormatMatcherDescription(\
-                     #name, description, gmock_interp_, gmock_printed_params);\
-      }\
-      p0##_type p0;\
-      const ::testing::internal::Interpolations gmock_interp_;\
-    };\
-    template <typename arg_type>\
-    operator ::testing::Matcher<arg_type>() const {\
-      return ::testing::Matcher<arg_type>(\
-          new gmock_Impl<arg_type>(p0, gmock_interp_));\
-    }\
-    name##MatcherP(p0##_type gmock_p0) : p0(gmock_p0) {\
-      const char* gmock_param_names[] = { #p0, NULL };\
-      gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\
-          gmock_param_names, ("" description ""));\
-    }\
-    p0##_type p0;\
-    ::testing::internal::Interpolations gmock_interp_;\
-  };\
-  template <typename p0##_type>\
-  inline name##MatcherP<p0##_type> name(p0##_type p0) {\
-    return name##MatcherP<p0##_type>(p0);\
-  }\
-  template <typename p0##_type>\
-  template <typename arg_type>\
-  bool name##MatcherP<p0##_type>::\
-      gmock_Impl<arg_type>::Matches(arg_type arg) const
-
-#define MATCHER_P2(name, p0, p1, description)\
-  template <typename p0##_type, typename p1##_type>\
-  class name##MatcherP2 {\
-   public:\
-    template <typename arg_type>\
-    class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
-     public:\
-      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \
-          const ::testing::internal::Interpolations& gmock_interp)\
-           : p0(gmock_p0), p1(gmock_p1), gmock_interp_(gmock_interp) {}\
-      virtual bool Matches(arg_type arg) const;\
-      virtual void DescribeTo(::std::ostream* gmock_os) const {\
-        const ::testing::internal::Strings& gmock_printed_params = \
-            ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
-                ::std::tr1::tuple<p0##_type, p1##_type>(p0, p1));\
-        *gmock_os << ::testing::internal::FormatMatcherDescription(\
-                     #name, description, gmock_interp_, gmock_printed_params);\
-      }\
-      p0##_type p0;\
-      p1##_type p1;\
-      const ::testing::internal::Interpolations gmock_interp_;\
-    };\
-    template <typename arg_type>\
-    operator ::testing::Matcher<arg_type>() const {\
-      return ::testing::Matcher<arg_type>(\
-          new gmock_Impl<arg_type>(p0, p1, gmock_interp_));\
-    }\
-    name##MatcherP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \
-        p1(gmock_p1) {\
-      const char* gmock_param_names[] = { #p0, #p1, NULL };\
-      gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\
-          gmock_param_names, ("" description ""));\
-    }\
-    p0##_type p0;\
-    p1##_type p1;\
-    ::testing::internal::Interpolations gmock_interp_;\
-  };\
-  template <typename p0##_type, typename p1##_type>\
-  inline name##MatcherP2<p0##_type, p1##_type> name(p0##_type p0, \
-      p1##_type p1) {\
-    return name##MatcherP2<p0##_type, p1##_type>(p0, p1);\
-  }\
-  template <typename p0##_type, typename p1##_type>\
-  template <typename arg_type>\
-  bool name##MatcherP2<p0##_type, p1##_type>::\
-      gmock_Impl<arg_type>::Matches(arg_type arg) const
-
-#define MATCHER_P3(name, p0, p1, p2, description)\
-  template <typename p0##_type, typename p1##_type, typename p2##_type>\
-  class name##MatcherP3 {\
-   public:\
-    template <typename arg_type>\
-    class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
-     public:\
-      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
-          const ::testing::internal::Interpolations& gmock_interp)\
-           : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
-               gmock_interp_(gmock_interp) {}\
-      virtual bool Matches(arg_type arg) const;\
-      virtual void DescribeTo(::std::ostream* gmock_os) const {\
-        const ::testing::internal::Strings& gmock_printed_params = \
-            ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
-                ::std::tr1::tuple<p0##_type, p1##_type, p2##_type>(p0, p1, \
-                    p2));\
-        *gmock_os << ::testing::internal::FormatMatcherDescription(\
-                     #name, description, gmock_interp_, gmock_printed_params);\
-      }\
-      p0##_type p0;\
-      p1##_type p1;\
-      p2##_type p2;\
-      const ::testing::internal::Interpolations gmock_interp_;\
-    };\
-    template <typename arg_type>\
-    operator ::testing::Matcher<arg_type>() const {\
-      return ::testing::Matcher<arg_type>(\
-          new gmock_Impl<arg_type>(p0, p1, p2, gmock_interp_));\
-    }\
-    name##MatcherP3(p0##_type gmock_p0, p1##_type gmock_p1, \
-        p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {\
-      const char* gmock_param_names[] = { #p0, #p1, #p2, NULL };\
-      gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\
-          gmock_param_names, ("" description ""));\
-    }\
-    p0##_type p0;\
-    p1##_type p1;\
-    p2##_type p2;\
-    ::testing::internal::Interpolations gmock_interp_;\
-  };\
-  template <typename p0##_type, typename p1##_type, typename p2##_type>\
-  inline name##MatcherP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
-      p1##_type p1, p2##_type p2) {\
-    return name##MatcherP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\
-  }\
-  template <typename p0##_type, typename p1##_type, typename p2##_type>\
-  template <typename arg_type>\
-  bool name##MatcherP3<p0##_type, p1##_type, p2##_type>::\
-      gmock_Impl<arg_type>::Matches(arg_type arg) const
-
-#define MATCHER_P4(name, p0, p1, p2, p3, description)\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type>\
-  class name##MatcherP4 {\
-   public:\
-    template <typename arg_type>\
-    class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
-     public:\
-      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
-          p3##_type gmock_p3, \
-          const ::testing::internal::Interpolations& gmock_interp)\
-           : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
-               gmock_interp_(gmock_interp) {}\
-      virtual bool Matches(arg_type arg) const;\
-      virtual void DescribeTo(::std::ostream* gmock_os) const {\
-        const ::testing::internal::Strings& gmock_printed_params = \
-            ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
-                ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, \
-                    p3##_type>(p0, p1, p2, p3));\
-        *gmock_os << ::testing::internal::FormatMatcherDescription(\
-                     #name, description, gmock_interp_, gmock_printed_params);\
-      }\
-      p0##_type p0;\
-      p1##_type p1;\
-      p2##_type p2;\
-      p3##_type p3;\
-      const ::testing::internal::Interpolations gmock_interp_;\
-    };\
-    template <typename arg_type>\
-    operator ::testing::Matcher<arg_type>() const {\
-      return ::testing::Matcher<arg_type>(\
-          new gmock_Impl<arg_type>(p0, p1, p2, p3, gmock_interp_));\
-    }\
-    name##MatcherP4(p0##_type gmock_p0, p1##_type gmock_p1, \
-        p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \
-        p2(gmock_p2), p3(gmock_p3) {\
-      const char* gmock_param_names[] = { #p0, #p1, #p2, #p3, NULL };\
-      gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\
-          gmock_param_names, ("" description ""));\
-    }\
-    p0##_type p0;\
-    p1##_type p1;\
-    p2##_type p2;\
-    p3##_type p3;\
-    ::testing::internal::Interpolations gmock_interp_;\
-  };\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type>\
-  inline name##MatcherP4<p0##_type, p1##_type, p2##_type, \
-      p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
-      p3##_type p3) {\
-    return name##MatcherP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, \
-        p1, p2, p3);\
-  }\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type>\
-  template <typename arg_type>\
-  bool name##MatcherP4<p0##_type, p1##_type, p2##_type, p3##_type>::\
-      gmock_Impl<arg_type>::Matches(arg_type arg) const
-
-#define MATCHER_P5(name, p0, p1, p2, p3, p4, description)\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type>\
-  class name##MatcherP5 {\
-   public:\
-    template <typename arg_type>\
-    class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
-     public:\
-      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
-          p3##_type gmock_p3, p4##_type gmock_p4, \
-          const ::testing::internal::Interpolations& gmock_interp)\
-           : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
-               p4(gmock_p4), gmock_interp_(gmock_interp) {}\
-      virtual bool Matches(arg_type arg) const;\
-      virtual void DescribeTo(::std::ostream* gmock_os) const {\
-        const ::testing::internal::Strings& gmock_printed_params = \
-            ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
-                ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
-                    p4##_type>(p0, p1, p2, p3, p4));\
-        *gmock_os << ::testing::internal::FormatMatcherDescription(\
-                     #name, description, gmock_interp_, gmock_printed_params);\
-      }\
-      p0##_type p0;\
-      p1##_type p1;\
-      p2##_type p2;\
-      p3##_type p3;\
-      p4##_type p4;\
-      const ::testing::internal::Interpolations gmock_interp_;\
-    };\
-    template <typename arg_type>\
-    operator ::testing::Matcher<arg_type>() const {\
-      return ::testing::Matcher<arg_type>(\
-          new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, gmock_interp_));\
-    }\
-    name##MatcherP5(p0##_type gmock_p0, p1##_type gmock_p1, \
-        p2##_type gmock_p2, p3##_type gmock_p3, \
-        p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
-        p3(gmock_p3), p4(gmock_p4) {\
-      const char* gmock_param_names[] = { #p0, #p1, #p2, #p3, #p4, NULL };\
-      gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\
-          gmock_param_names, ("" description ""));\
-    }\
-    p0##_type p0;\
-    p1##_type p1;\
-    p2##_type p2;\
-    p3##_type p3;\
-    p4##_type p4;\
-    ::testing::internal::Interpolations gmock_interp_;\
-  };\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type>\
-  inline name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \
-      p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
-      p4##_type p4) {\
-    return name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \
-        p4##_type>(p0, p1, p2, p3, p4);\
-  }\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type>\
-  template <typename arg_type>\
-  bool name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type>::\
-      gmock_Impl<arg_type>::Matches(arg_type arg) const
-
-#define MATCHER_P6(name, p0, p1, p2, p3, p4, p5, description)\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type>\
-  class name##MatcherP6 {\
-   public:\
-    template <typename arg_type>\
-    class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
-     public:\
-      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
-          p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
-          const ::testing::internal::Interpolations& gmock_interp)\
-           : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
-               p4(gmock_p4), p5(gmock_p5), gmock_interp_(gmock_interp) {}\
-      virtual bool Matches(arg_type arg) const;\
-      virtual void DescribeTo(::std::ostream* gmock_os) const {\
-        const ::testing::internal::Strings& gmock_printed_params = \
-            ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
-                ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
-                    p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5));\
-        *gmock_os << ::testing::internal::FormatMatcherDescription(\
-                     #name, description, gmock_interp_, gmock_printed_params);\
-      }\
-      p0##_type p0;\
-      p1##_type p1;\
-      p2##_type p2;\
-      p3##_type p3;\
-      p4##_type p4;\
-      p5##_type p5;\
-      const ::testing::internal::Interpolations gmock_interp_;\
-    };\
-    template <typename arg_type>\
-    operator ::testing::Matcher<arg_type>() const {\
-      return ::testing::Matcher<arg_type>(\
-          new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, gmock_interp_));\
-    }\
-    name##MatcherP6(p0##_type gmock_p0, p1##_type gmock_p1, \
-        p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
-        p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
-        p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {\
-      const char* gmock_param_names[] = { #p0, #p1, #p2, #p3, #p4, #p5, NULL };\
-      gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\
-          gmock_param_names, ("" description ""));\
-    }\
-    p0##_type p0;\
-    p1##_type p1;\
-    p2##_type p2;\
-    p3##_type p3;\
-    p4##_type p4;\
-    p5##_type p5;\
-    ::testing::internal::Interpolations gmock_interp_;\
-  };\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type>\
-  inline name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, \
-      p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
-      p3##_type p3, p4##_type p4, p5##_type p5) {\
-    return name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, \
-        p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\
-  }\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type>\
-  template <typename arg_type>\
-  bool name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
-      p5##_type>::\
-      gmock_Impl<arg_type>::Matches(arg_type arg) const
-
-#define MATCHER_P7(name, p0, p1, p2, p3, p4, p5, p6, description)\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type>\
-  class name##MatcherP7 {\
-   public:\
-    template <typename arg_type>\
-    class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
-     public:\
-      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
-          p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
-          p6##_type gmock_p6, \
-          const ::testing::internal::Interpolations& gmock_interp)\
-           : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
-               p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
-               gmock_interp_(gmock_interp) {}\
-      virtual bool Matches(arg_type arg) const;\
-      virtual void DescribeTo(::std::ostream* gmock_os) const {\
-        const ::testing::internal::Strings& gmock_printed_params = \
-            ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
-                ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
-                    p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, \
-                    p6));\
-        *gmock_os << ::testing::internal::FormatMatcherDescription(\
-                     #name, description, gmock_interp_, gmock_printed_params);\
-      }\
-      p0##_type p0;\
-      p1##_type p1;\
-      p2##_type p2;\
-      p3##_type p3;\
-      p4##_type p4;\
-      p5##_type p5;\
-      p6##_type p6;\
-      const ::testing::internal::Interpolations gmock_interp_;\
-    };\
-    template <typename arg_type>\
-    operator ::testing::Matcher<arg_type>() const {\
-      return ::testing::Matcher<arg_type>(\
-          new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, gmock_interp_));\
-    }\
-    name##MatcherP7(p0##_type gmock_p0, p1##_type gmock_p1, \
-        p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
-        p5##_type gmock_p5, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), \
-        p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \
-        p6(gmock_p6) {\
-      const char* gmock_param_names[] = { #p0, #p1, #p2, #p3, #p4, #p5, #p6, \
-          NULL };\
-      gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\
-          gmock_param_names, ("" description ""));\
-    }\
-    p0##_type p0;\
-    p1##_type p1;\
-    p2##_type p2;\
-    p3##_type p3;\
-    p4##_type p4;\
-    p5##_type p5;\
-    p6##_type p6;\
-    ::testing::internal::Interpolations gmock_interp_;\
-  };\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type>\
-  inline name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, \
-      p4##_type, p5##_type, p6##_type> name(p0##_type p0, p1##_type p1, \
-      p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
-      p6##_type p6) {\
-    return name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, \
-        p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\
-  }\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type>\
-  template <typename arg_type>\
-  bool name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
-      p5##_type, p6##_type>::\
-      gmock_Impl<arg_type>::Matches(arg_type arg) const
-
-#define MATCHER_P8(name, p0, p1, p2, p3, p4, p5, p6, p7, description)\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type, typename p7##_type>\
-  class name##MatcherP8 {\
-   public:\
-    template <typename arg_type>\
-    class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
-     public:\
-      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
-          p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
-          p6##_type gmock_p6, p7##_type gmock_p7, \
-          const ::testing::internal::Interpolations& gmock_interp)\
-           : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
-               p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
-               gmock_interp_(gmock_interp) {}\
-      virtual bool Matches(arg_type arg) const;\
-      virtual void DescribeTo(::std::ostream* gmock_os) const {\
-        const ::testing::internal::Strings& gmock_printed_params = \
-            ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
-                ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
-                    p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, \
-                    p3, p4, p5, p6, p7));\
-        *gmock_os << ::testing::internal::FormatMatcherDescription(\
-                     #name, description, gmock_interp_, gmock_printed_params);\
-      }\
-      p0##_type p0;\
-      p1##_type p1;\
-      p2##_type p2;\
-      p3##_type p3;\
-      p4##_type p4;\
-      p5##_type p5;\
-      p6##_type p6;\
-      p7##_type p7;\
-      const ::testing::internal::Interpolations gmock_interp_;\
-    };\
-    template <typename arg_type>\
-    operator ::testing::Matcher<arg_type>() const {\
-      return ::testing::Matcher<arg_type>(\
-          new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7, \
-              gmock_interp_));\
-    }\
-    name##MatcherP8(p0##_type gmock_p0, p1##_type gmock_p1, \
-        p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
-        p5##_type gmock_p5, p6##_type gmock_p6, \
-        p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
-        p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
-        p7(gmock_p7) {\
-      const char* gmock_param_names[] = { #p0, #p1, #p2, #p3, #p4, #p5, #p6, \
-          #p7, NULL };\
-      gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\
-          gmock_param_names, ("" description ""));\
-    }\
-    p0##_type p0;\
-    p1##_type p1;\
-    p2##_type p2;\
-    p3##_type p3;\
-    p4##_type p4;\
-    p5##_type p5;\
-    p6##_type p6;\
-    p7##_type p7;\
-    ::testing::internal::Interpolations gmock_interp_;\
-  };\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type, typename p7##_type>\
-  inline name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, \
-      p4##_type, p5##_type, p6##_type, p7##_type> name(p0##_type p0, \
-      p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
-      p6##_type p6, p7##_type p7) {\
-    return name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, \
-        p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \
-        p6, p7);\
-  }\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type, typename p7##_type>\
-  template <typename arg_type>\
-  bool name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
-      p5##_type, p6##_type, p7##_type>::\
-      gmock_Impl<arg_type>::Matches(arg_type arg) const
-
-#define MATCHER_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, description)\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type, typename p7##_type, typename p8##_type>\
-  class name##MatcherP9 {\
-   public:\
-    template <typename arg_type>\
-    class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
-     public:\
-      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
-          p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
-          p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
-          const ::testing::internal::Interpolations& gmock_interp)\
-           : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
-               p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
-               p8(gmock_p8), gmock_interp_(gmock_interp) {}\
-      virtual bool Matches(arg_type arg) const;\
-      virtual void DescribeTo(::std::ostream* gmock_os) const {\
-        const ::testing::internal::Strings& gmock_printed_params = \
-            ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
-                ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
-                    p4##_type, p5##_type, p6##_type, p7##_type, \
-                    p8##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8));\
-        *gmock_os << ::testing::internal::FormatMatcherDescription(\
-                     #name, description, gmock_interp_, gmock_printed_params);\
-      }\
-      p0##_type p0;\
-      p1##_type p1;\
-      p2##_type p2;\
-      p3##_type p3;\
-      p4##_type p4;\
-      p5##_type p5;\
-      p6##_type p6;\
-      p7##_type p7;\
-      p8##_type p8;\
-      const ::testing::internal::Interpolations gmock_interp_;\
-    };\
-    template <typename arg_type>\
-    operator ::testing::Matcher<arg_type>() const {\
-      return ::testing::Matcher<arg_type>(\
-          new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, \
-              gmock_interp_));\
-    }\
-    name##MatcherP9(p0##_type gmock_p0, p1##_type gmock_p1, \
-        p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
-        p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
-        p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \
-        p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
-        p8(gmock_p8) {\
-      const char* gmock_param_names[] = { #p0, #p1, #p2, #p3, #p4, #p5, #p6, \
-          #p7, #p8, NULL };\
-      gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\
-          gmock_param_names, ("" description ""));\
-    }\
-    p0##_type p0;\
-    p1##_type p1;\
-    p2##_type p2;\
-    p3##_type p3;\
-    p4##_type p4;\
-    p5##_type p5;\
-    p6##_type p6;\
-    p7##_type p7;\
-    p8##_type p8;\
-    ::testing::internal::Interpolations gmock_interp_;\
-  };\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type, typename p7##_type, typename p8##_type>\
-  inline name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, \
-      p4##_type, p5##_type, p6##_type, p7##_type, \
-      p8##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
-      p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \
-      p8##_type p8) {\
-    return name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, \
-        p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \
-        p3, p4, p5, p6, p7, p8);\
-  }\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type, typename p7##_type, typename p8##_type>\
-  template <typename arg_type>\
-  bool name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
-      p5##_type, p6##_type, p7##_type, p8##_type>::\
-      gmock_Impl<arg_type>::Matches(arg_type arg) const
-
-#define MATCHER_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, description)\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type, typename p7##_type, typename p8##_type, \
-      typename p9##_type>\
-  class name##MatcherP10 {\
-   public:\
-    template <typename arg_type>\
-    class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
-     public:\
-      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
-          p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
-          p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
-          p9##_type gmock_p9, \
-          const ::testing::internal::Interpolations& gmock_interp)\
-           : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \
-               p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \
-               p8(gmock_p8), p9(gmock_p9), gmock_interp_(gmock_interp) {}\
-      virtual bool Matches(arg_type arg) const;\
-      virtual void DescribeTo(::std::ostream* gmock_os) const {\
-        const ::testing::internal::Strings& gmock_printed_params = \
-            ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
-                ::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
-                    p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
-                    p9##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9));\
-        *gmock_os << ::testing::internal::FormatMatcherDescription(\
-                     #name, description, gmock_interp_, gmock_printed_params);\
-      }\
-      p0##_type p0;\
-      p1##_type p1;\
-      p2##_type p2;\
-      p3##_type p3;\
-      p4##_type p4;\
-      p5##_type p5;\
-      p6##_type p6;\
-      p7##_type p7;\
-      p8##_type p8;\
-      p9##_type p9;\
-      const ::testing::internal::Interpolations gmock_interp_;\
-    };\
-    template <typename arg_type>\
-    operator ::testing::Matcher<arg_type>() const {\
-      return ::testing::Matcher<arg_type>(\
-          new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, \
-              gmock_interp_));\
-    }\
-    name##MatcherP10(p0##_type gmock_p0, p1##_type gmock_p1, \
-        p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
-        p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
-        p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \
-        p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \
-        p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {\
-      const char* gmock_param_names[] = { #p0, #p1, #p2, #p3, #p4, #p5, #p6, \
-          #p7, #p8, #p9, NULL };\
-      gmock_interp_ = ::testing::internal::ValidateMatcherDescription(\
-          gmock_param_names, ("" description ""));\
-    }\
-    p0##_type p0;\
-    p1##_type p1;\
-    p2##_type p2;\
-    p3##_type p3;\
-    p4##_type p4;\
-    p5##_type p5;\
-    p6##_type p6;\
-    p7##_type p7;\
-    p8##_type p8;\
-    p9##_type p9;\
-    ::testing::internal::Interpolations gmock_interp_;\
-  };\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type, typename p7##_type, typename p8##_type, \
-      typename p9##_type>\
-  inline name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \
-      p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
-      p9##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
-      p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \
-      p9##_type p9) {\
-    return name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \
-        p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \
-        p1, p2, p3, p4, p5, p6, p7, p8, p9);\
-  }\
-  template <typename p0##_type, typename p1##_type, typename p2##_type, \
-      typename p3##_type, typename p4##_type, typename p5##_type, \
-      typename p6##_type, typename p7##_type, typename p8##_type, \
-      typename p9##_type>\
-  template <typename arg_type>\
-  bool name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \
-      p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>::\
-      gmock_Impl<arg_type>::Matches(arg_type arg) const
-
-#endif  // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
diff --git a/third_party/gmock/include/gmock/gmock-generated-nice-strict.h b/third_party/gmock/include/gmock/gmock-generated-nice-strict.h
deleted file mode 100644
index fc9a81b..0000000
--- a/third_party/gmock/include/gmock/gmock-generated-nice-strict.h
+++ /dev/null
@@ -1,268 +0,0 @@
-// This file was GENERATED by a script.  DO NOT EDIT BY HAND!!!
-
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Implements class templates NiceMock and StrictMock.
-//
-// Given a mock class MockFoo that is created using Google Mock,
-// NiceMock<MockFoo> is a subclass of MockFoo that allows
-// uninteresting calls (i.e. calls to mock methods that have no
-// EXPECT_CALL specs), and StrictMock<MockFoo> is a subclass of
-// MockFoo that treats all uninteresting calls as errors.
-//
-// NiceMock and StrictMock "inherits" the constructors of their
-// respective base class, with up-to 10 arguments.  Therefore you can
-// write NiceMock<MockFoo>(5, "a") to construct a nice mock where
-// MockFoo has a constructor that accepts (int, const char*), for
-// example.
-//
-// A known limitation is that NiceMock<MockFoo> and
-// StrictMock<MockFoo> only works for mock methods defined using the
-// MOCK_METHOD* family of macros DIRECTLY in the MockFoo class.  If a
-// mock method is defined in a base class of MockFoo, the "nice" or
-// "strict" modifier may not affect it, depending on the compiler.  In
-// particular, nesting NiceMock and StrictMock is NOT supported.
-//
-// Another known limitation is that the constructors of the base mock
-// cannot have arguments passed by non-const reference, which are
-// banned by the Google C++ style guide anyway.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
-
-#include <gmock/gmock-spec-builders.h>
-#include <gmock/internal/gmock-port.h>
-
-namespace testing {
-
-template <class MockClass>
-class NiceMock : public MockClass {
- public:
-  // We don't factor out the constructor body to a common method, as
-  // we have to avoid a possible clash with members of MockClass.
-  NiceMock() {
-    ::testing::Mock::AllowUninterestingCalls(
-        internal::implicit_cast<MockClass*>(this));
-  }
-
-  // C++ doesn't (yet) allow inheritance of constructors, so we have
-  // to define it for each arity.
-  template <typename A1>
-  explicit NiceMock(const A1& a1) : MockClass(a1) {
-    ::testing::Mock::AllowUninterestingCalls(
-        internal::implicit_cast<MockClass*>(this));
-  }
-  template <typename A1, typename A2>
-  NiceMock(const A1& a1, const A2& a2) : MockClass(a1, a2) {
-    ::testing::Mock::AllowUninterestingCalls(
-        internal::implicit_cast<MockClass*>(this));
-  }
-
-  template <typename A1, typename A2, typename A3>
-  NiceMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a3) {
-    ::testing::Mock::AllowUninterestingCalls(
-        internal::implicit_cast<MockClass*>(this));
-  }
-
-  template <typename A1, typename A2, typename A3, typename A4>
-  NiceMock(const A1& a1, const A2& a2, const A3& a3,
-      const A4& a4) : MockClass(a1, a2, a3, a4) {
-    ::testing::Mock::AllowUninterestingCalls(
-        internal::implicit_cast<MockClass*>(this));
-  }
-
-  template <typename A1, typename A2, typename A3, typename A4, typename A5>
-  NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
-      const A5& a5) : MockClass(a1, a2, a3, a4, a5) {
-    ::testing::Mock::AllowUninterestingCalls(
-        internal::implicit_cast<MockClass*>(this));
-  }
-
-  template <typename A1, typename A2, typename A3, typename A4, typename A5,
-      typename A6>
-  NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
-      const A5& a5, const A6& a6) : MockClass(a1, a2, a3, a4, a5, a6) {
-    ::testing::Mock::AllowUninterestingCalls(
-        internal::implicit_cast<MockClass*>(this));
-  }
-
-  template <typename A1, typename A2, typename A3, typename A4, typename A5,
-      typename A6, typename A7>
-  NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
-      const A5& a5, const A6& a6, const A7& a7) : MockClass(a1, a2, a3, a4, a5,
-      a6, a7) {
-    ::testing::Mock::AllowUninterestingCalls(
-        internal::implicit_cast<MockClass*>(this));
-  }
-
-  template <typename A1, typename A2, typename A3, typename A4, typename A5,
-      typename A6, typename A7, typename A8>
-  NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
-      const A5& a5, const A6& a6, const A7& a7, const A8& a8) : MockClass(a1,
-      a2, a3, a4, a5, a6, a7, a8) {
-    ::testing::Mock::AllowUninterestingCalls(
-        internal::implicit_cast<MockClass*>(this));
-  }
-
-  template <typename A1, typename A2, typename A3, typename A4, typename A5,
-      typename A6, typename A7, typename A8, typename A9>
-  NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
-      const A5& a5, const A6& a6, const A7& a7, const A8& a8,
-      const A9& a9) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9) {
-    ::testing::Mock::AllowUninterestingCalls(
-        internal::implicit_cast<MockClass*>(this));
-  }
-
-  template <typename A1, typename A2, typename A3, typename A4, typename A5,
-      typename A6, typename A7, typename A8, typename A9, typename A10>
-  NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
-      const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9,
-      const A10& a10) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) {
-    ::testing::Mock::AllowUninterestingCalls(
-        internal::implicit_cast<MockClass*>(this));
-  }
-
-  virtual ~NiceMock() {
-    ::testing::Mock::UnregisterCallReaction(
-        internal::implicit_cast<MockClass*>(this));
-  }
-};
-
-template <class MockClass>
-class StrictMock : public MockClass {
- public:
-  // We don't factor out the constructor body to a common method, as
-  // we have to avoid a possible clash with members of MockClass.
-  StrictMock() {
-    ::testing::Mock::FailUninterestingCalls(
-        internal::implicit_cast<MockClass*>(this));
-  }
-
-  template <typename A1>
-  explicit StrictMock(const A1& a1) : MockClass(a1) {
-    ::testing::Mock::FailUninterestingCalls(
-        internal::implicit_cast<MockClass*>(this));
-  }
-  template <typename A1, typename A2>
-  StrictMock(const A1& a1, const A2& a2) : MockClass(a1, a2) {
-    ::testing::Mock::FailUninterestingCalls(
-        internal::implicit_cast<MockClass*>(this));
-  }
-
-  template <typename A1, typename A2, typename A3>
-  StrictMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a3) {
-    ::testing::Mock::FailUninterestingCalls(
-        internal::implicit_cast<MockClass*>(this));
-  }
-
-  template <typename A1, typename A2, typename A3, typename A4>
-  StrictMock(const A1& a1, const A2& a2, const A3& a3,
-      const A4& a4) : MockClass(a1, a2, a3, a4) {
-    ::testing::Mock::FailUninterestingCalls(
-        internal::implicit_cast<MockClass*>(this));
-  }
-
-  template <typename A1, typename A2, typename A3, typename A4, typename A5>
-  StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
-      const A5& a5) : MockClass(a1, a2, a3, a4, a5) {
-    ::testing::Mock::FailUninterestingCalls(
-        internal::implicit_cast<MockClass*>(this));
-  }
-
-  template <typename A1, typename A2, typename A3, typename A4, typename A5,
-      typename A6>
-  StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
-      const A5& a5, const A6& a6) : MockClass(a1, a2, a3, a4, a5, a6) {
-    ::testing::Mock::FailUninterestingCalls(
-        internal::implicit_cast<MockClass*>(this));
-  }
-
-  template <typename A1, typename A2, typename A3, typename A4, typename A5,
-      typename A6, typename A7>
-  StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
-      const A5& a5, const A6& a6, const A7& a7) : MockClass(a1, a2, a3, a4, a5,
-      a6, a7) {
-    ::testing::Mock::FailUninterestingCalls(
-        internal::implicit_cast<MockClass*>(this));
-  }
-
-  template <typename A1, typename A2, typename A3, typename A4, typename A5,
-      typename A6, typename A7, typename A8>
-  StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
-      const A5& a5, const A6& a6, const A7& a7, const A8& a8) : MockClass(a1,
-      a2, a3, a4, a5, a6, a7, a8) {
-    ::testing::Mock::FailUninterestingCalls(
-        internal::implicit_cast<MockClass*>(this));
-  }
-
-  template <typename A1, typename A2, typename A3, typename A4, typename A5,
-      typename A6, typename A7, typename A8, typename A9>
-  StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
-      const A5& a5, const A6& a6, const A7& a7, const A8& a8,
-      const A9& a9) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9) {
-    ::testing::Mock::FailUninterestingCalls(
-        internal::implicit_cast<MockClass*>(this));
-  }
-
-  template <typename A1, typename A2, typename A3, typename A4, typename A5,
-      typename A6, typename A7, typename A8, typename A9, typename A10>
-  StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
-      const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9,
-      const A10& a10) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) {
-    ::testing::Mock::FailUninterestingCalls(
-        internal::implicit_cast<MockClass*>(this));
-  }
-
-  virtual ~StrictMock() {
-    ::testing::Mock::UnregisterCallReaction(
-        internal::implicit_cast<MockClass*>(this));
-  }
-};
-
-// The following specializations catch some (relatively more common)
-// user errors of nesting nice and strict mocks.  They do NOT catch
-// all possible errors.
-
-// These specializations are declared but not defined, as NiceMock and
-// StrictMock cannot be nested.
-template <typename MockClass>
-class NiceMock<NiceMock<MockClass> >;
-template <typename MockClass>
-class NiceMock<StrictMock<MockClass> >;
-template <typename MockClass>
-class StrictMock<NiceMock<MockClass> >;
-template <typename MockClass>
-class StrictMock<StrictMock<MockClass> >;
-
-}  // namespace testing
-
-#endif  // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
diff --git a/third_party/gmock/include/gmock/gmock-matchers.h b/third_party/gmock/include/gmock/gmock-matchers.h
deleted file mode 100644
index deb0946..0000000
--- a/third_party/gmock/include/gmock/gmock-matchers.h
+++ /dev/null
@@ -1,2799 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements some commonly used argument matchers.  More
-// matchers can be defined by the user implementing the
-// MatcherInterface<T> interface if necessary.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_
-
-#include <algorithm>
-#include <limits>
-#include <ostream>  // NOLINT
-#include <sstream>
-#include <string>
-#include <vector>
-
-#include <gmock/gmock-printers.h>
-#include <gmock/internal/gmock-internal-utils.h>
-#include <gmock/internal/gmock-port.h>
-#include <gtest/gtest.h>
-
-namespace testing {
-
-// To implement a matcher Foo for type T, define:
-//   1. a class FooMatcherImpl that implements the
-//      MatcherInterface<T> interface, and
-//   2. a factory function that creates a Matcher<T> object from a
-//      FooMatcherImpl*.
-//
-// The two-level delegation design makes it possible to allow a user
-// to write "v" instead of "Eq(v)" where a Matcher is expected, which
-// is impossible if we pass matchers by pointers.  It also eases
-// ownership management as Matcher objects can now be copied like
-// plain values.
-
-// The implementation of a matcher.
-template <typename T>
-class MatcherInterface {
- public:
-  virtual ~MatcherInterface() {}
-
-  // Returns true iff the matcher matches x.
-  virtual bool Matches(T x) const = 0;
-
-  // Describes this matcher to an ostream.
-  virtual void DescribeTo(::std::ostream* os) const = 0;
-
-  // Describes the negation of this matcher to an ostream.  For
-  // example, if the description of this matcher is "is greater than
-  // 7", the negated description could be "is not greater than 7".
-  // You are not required to override this when implementing
-  // MatcherInterface, but it is highly advised so that your matcher
-  // can produce good error messages.
-  virtual void DescribeNegationTo(::std::ostream* os) const {
-    *os << "not (";
-    DescribeTo(os);
-    *os << ")";
-  }
-
-  // Explains why x matches, or doesn't match, the matcher.  Override
-  // this to provide any additional information that helps a user
-  // understand the match result.
-  virtual void ExplainMatchResultTo(T /* x */, ::std::ostream* /* os */) const {
-    // By default, nothing more needs to be explained, as Google Mock
-    // has already printed the value of x when this function is
-    // called.
-  }
-};
-
-namespace internal {
-
-// An internal class for implementing Matcher<T>, which will derive
-// from it.  We put functionalities common to all Matcher<T>
-// specializations here to avoid code duplication.
-template <typename T>
-class MatcherBase {
- public:
-  // Returns true iff this matcher matches x.
-  bool Matches(T x) const { return impl_->Matches(x); }
-
-  // Describes this matcher to an ostream.
-  void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); }
-
-  // Describes the negation of this matcher to an ostream.
-  void DescribeNegationTo(::std::ostream* os) const {
-    impl_->DescribeNegationTo(os);
-  }
-
-  // Explains why x matches, or doesn't match, the matcher.
-  void ExplainMatchResultTo(T x, ::std::ostream* os) const {
-    impl_->ExplainMatchResultTo(x, os);
-  }
- protected:
-  MatcherBase() {}
-
-  // Constructs a matcher from its implementation.
-  explicit MatcherBase(const MatcherInterface<T>* impl)
-      : impl_(impl) {}
-
-  virtual ~MatcherBase() {}
- private:
-  // shared_ptr (util/gtl/shared_ptr.h) and linked_ptr have similar
-  // interfaces.  The former dynamically allocates a chunk of memory
-  // to hold the reference count, while the latter tracks all
-  // references using a circular linked list without allocating
-  // memory.  It has been observed that linked_ptr performs better in
-  // typical scenarios.  However, shared_ptr can out-perform
-  // linked_ptr when there are many more uses of the copy constructor
-  // than the default constructor.
-  //
-  // If performance becomes a problem, we should see if using
-  // shared_ptr helps.
-  ::testing::internal::linked_ptr<const MatcherInterface<T> > impl_;
-};
-
-// The default implementation of ExplainMatchResultTo() for
-// polymorphic matchers.
-template <typename PolymorphicMatcherImpl, typename T>
-inline void ExplainMatchResultTo(const PolymorphicMatcherImpl& /* impl */,
-                                 const T& /* x */,
-                                 ::std::ostream* /* os */) {
-  // By default, nothing more needs to be said, as Google Mock already
-  // prints the value of x elsewhere.
-}
-
-}  // namespace internal
-
-// A Matcher<T> is a copyable and IMMUTABLE (except by assignment)
-// object that can check whether a value of type T matches.  The
-// implementation of Matcher<T> is just a linked_ptr to const
-// MatcherInterface<T>, so copying is fairly cheap.  Don't inherit
-// from Matcher!
-template <typename T>
-class Matcher : public internal::MatcherBase<T> {
- public:
-  // Constructs a null matcher.  Needed for storing Matcher objects in
-  // STL containers.
-  Matcher() {}
-
-  // Constructs a matcher from its implementation.
-  explicit Matcher(const MatcherInterface<T>* impl)
-      : internal::MatcherBase<T>(impl) {}
-
-  // Implicit constructor here allows people to write
-  // EXPECT_CALL(foo, Bar(5)) instead of EXPECT_CALL(foo, Bar(Eq(5))) sometimes
-  Matcher(T value);  // NOLINT
-};
-
-// The following two specializations allow the user to write str
-// instead of Eq(str) and "foo" instead of Eq("foo") when a string
-// matcher is expected.
-template <>
-class Matcher<const internal::string&>
-    : public internal::MatcherBase<const internal::string&> {
- public:
-  Matcher() {}
-
-  explicit Matcher(const MatcherInterface<const internal::string&>* impl)
-      : internal::MatcherBase<const internal::string&>(impl) {}
-
-  // Allows the user to write str instead of Eq(str) sometimes, where
-  // str is a string object.
-  Matcher(const internal::string& s);  // NOLINT
-
-  // Allows the user to write "foo" instead of Eq("foo") sometimes.
-  Matcher(const char* s);  // NOLINT
-};
-
-template <>
-class Matcher<internal::string>
-    : public internal::MatcherBase<internal::string> {
- public:
-  Matcher() {}
-
-  explicit Matcher(const MatcherInterface<internal::string>* impl)
-      : internal::MatcherBase<internal::string>(impl) {}
-
-  // Allows the user to write str instead of Eq(str) sometimes, where
-  // str is a string object.
-  Matcher(const internal::string& s);  // NOLINT
-
-  // Allows the user to write "foo" instead of Eq("foo") sometimes.
-  Matcher(const char* s);  // NOLINT
-};
-
-// The PolymorphicMatcher class template makes it easy to implement a
-// polymorphic matcher (i.e. a matcher that can match values of more
-// than one type, e.g. Eq(n) and NotNull()).
-//
-// To define a polymorphic matcher, a user first provides a Impl class
-// that has a Matches() method, a DescribeTo() method, and a
-// DescribeNegationTo() method.  The Matches() method is usually a
-// method template (such that it works with multiple types).  Then the
-// user creates the polymorphic matcher using
-// MakePolymorphicMatcher().  To provide additional explanation to the
-// match result, define a FREE function (or function template)
-//
-//   void ExplainMatchResultTo(const Impl& matcher, const Value& value,
-//                             ::std::ostream* os);
-//
-// in the SAME NAME SPACE where Impl is defined.  See the definition
-// of NotNull() for a complete example.
-template <class Impl>
-class PolymorphicMatcher {
- public:
-  explicit PolymorphicMatcher(const Impl& impl) : impl_(impl) {}
-
-  // Returns a mutable reference to the underlying matcher
-  // implementation object.
-  Impl& mutable_impl() { return impl_; }
-
-  // Returns an immutable reference to the underlying matcher
-  // implementation object.
-  const Impl& impl() const { return impl_; }
-
-  template <typename T>
-  operator Matcher<T>() const {
-    return Matcher<T>(new MonomorphicImpl<T>(impl_));
-  }
- private:
-  template <typename T>
-  class MonomorphicImpl : public MatcherInterface<T> {
-   public:
-    explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {}
-
-    virtual bool Matches(T x) const { return impl_.Matches(x); }
-
-    virtual void DescribeTo(::std::ostream* os) const {
-      impl_.DescribeTo(os);
-    }
-
-    virtual void DescribeNegationTo(::std::ostream* os) const {
-      impl_.DescribeNegationTo(os);
-    }
-
-    virtual void ExplainMatchResultTo(T x, ::std::ostream* os) const {
-      using ::testing::internal::ExplainMatchResultTo;
-
-      // C++ uses Argument-Dependent Look-up (aka Koenig Look-up) to
-      // resolve the call to ExplainMatchResultTo() here.  This
-      // means that if there's a ExplainMatchResultTo() function
-      // defined in the name space where class Impl is defined, it
-      // will be picked by the compiler as the better match.
-      // Otherwise the default implementation of it in
-      // ::testing::internal will be picked.
-      //
-      // This look-up rule lets a writer of a polymorphic matcher
-      // customize the behavior of ExplainMatchResultTo() when he
-      // cares to.  Nothing needs to be done by the writer if he
-      // doesn't need to customize it.
-      ExplainMatchResultTo(impl_, x, os);
-    }
-
-   private:
-    const Impl impl_;
-  };
-
-  Impl impl_;
-};
-
-// Creates a matcher from its implementation.  This is easier to use
-// than the Matcher<T> constructor as it doesn't require you to
-// explicitly write the template argument, e.g.
-//
-//   MakeMatcher(foo);
-// vs
-//   Matcher<const string&>(foo);
-template <typename T>
-inline Matcher<T> MakeMatcher(const MatcherInterface<T>* impl) {
-  return Matcher<T>(impl);
-};
-
-// Creates a polymorphic matcher from its implementation.  This is
-// easier to use than the PolymorphicMatcher<Impl> constructor as it
-// doesn't require you to explicitly write the template argument, e.g.
-//
-//   MakePolymorphicMatcher(foo);
-// vs
-//   PolymorphicMatcher<TypeOfFoo>(foo);
-template <class Impl>
-inline PolymorphicMatcher<Impl> MakePolymorphicMatcher(const Impl& impl) {
-  return PolymorphicMatcher<Impl>(impl);
-}
-
-// In order to be safe and clear, casting between different matcher
-// types is done explicitly via MatcherCast<T>(m), which takes a
-// matcher m and returns a Matcher<T>.  It compiles only when T can be
-// statically converted to the argument type of m.
-template <typename T, typename M>
-Matcher<T> MatcherCast(M m);
-
-// Implements SafeMatcherCast().
-//
-// We use an intermediate class to do the actual safe casting as Nokia's
-// Symbian compiler cannot decide between
-// template <T, M> ... (M) and
-// template <T, U> ... (const Matcher<U>&)
-// for function templates but can for member function templates.
-template <typename T>
-class SafeMatcherCastImpl {
- public:
-  // This overload handles polymorphic matchers only since monomorphic
-  // matchers are handled by the next one.
-  template <typename M>
-  static inline Matcher<T> Cast(M polymorphic_matcher) {
-    return Matcher<T>(polymorphic_matcher);
-  }
-
-  // This overload handles monomorphic matchers.
-  //
-  // In general, if type T can be implicitly converted to type U, we can
-  // safely convert a Matcher<U> to a Matcher<T> (i.e. Matcher is
-  // contravariant): just keep a copy of the original Matcher<U>, convert the
-  // argument from type T to U, and then pass it to the underlying Matcher<U>.
-  // The only exception is when U is a reference and T is not, as the
-  // underlying Matcher<U> may be interested in the argument's address, which
-  // is not preserved in the conversion from T to U.
-  template <typename U>
-  static inline Matcher<T> Cast(const Matcher<U>& matcher) {
-    // Enforce that T can be implicitly converted to U.
-    GMOCK_COMPILE_ASSERT_((internal::ImplicitlyConvertible<T, U>::value),
-                          T_must_be_implicitly_convertible_to_U);
-    // Enforce that we are not converting a non-reference type T to a reference
-    // type U.
-    GMOCK_COMPILE_ASSERT_(
-        internal::is_reference<T>::value || !internal::is_reference<U>::value,
-        cannot_convert_non_referentce_arg_to_reference);
-    // In case both T and U are arithmetic types, enforce that the
-    // conversion is not lossy.
-    typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(T)) RawT;
-    typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(U)) RawU;
-    const bool kTIsOther = GMOCK_KIND_OF_(RawT) == internal::kOther;
-    const bool kUIsOther = GMOCK_KIND_OF_(RawU) == internal::kOther;
-    GMOCK_COMPILE_ASSERT_(
-        kTIsOther || kUIsOther ||
-        (internal::LosslessArithmeticConvertible<RawT, RawU>::value),
-        conversion_of_arithmetic_types_must_be_lossless);
-    return MatcherCast<T>(matcher);
-  }
-};
-
-template <typename T, typename M>
-inline Matcher<T> SafeMatcherCast(const M& polymorphic_matcher) {
-  return SafeMatcherCastImpl<T>::Cast(polymorphic_matcher);
-}
-
-// A<T>() returns a matcher that matches any value of type T.
-template <typename T>
-Matcher<T> A();
-
-// Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION
-// and MUST NOT BE USED IN USER CODE!!!
-namespace internal {
-
-// Appends the explanation on the result of matcher.Matches(value) to
-// os iff the explanation is not empty.
-template <typename T>
-void ExplainMatchResultAsNeededTo(const Matcher<T>& matcher, T value,
-                                  ::std::ostream* os) {
-  ::std::stringstream reason;
-  matcher.ExplainMatchResultTo(value, &reason);
-  const internal::string s = reason.str();
-  if (s != "") {
-    *os << " (" << s << ")";
-  }
-}
-
-// An internal helper class for doing compile-time loop on a tuple's
-// fields.
-template <size_t N>
-class TuplePrefix {
- public:
-  // TuplePrefix<N>::Matches(matcher_tuple, value_tuple) returns true
-  // iff the first N fields of matcher_tuple matches the first N
-  // fields of value_tuple, respectively.
-  template <typename MatcherTuple, typename ValueTuple>
-  static bool Matches(const MatcherTuple& matcher_tuple,
-                      const ValueTuple& value_tuple) {
-    using ::std::tr1::get;
-    return TuplePrefix<N - 1>::Matches(matcher_tuple, value_tuple)
-        && get<N - 1>(matcher_tuple).Matches(get<N - 1>(value_tuple));
-  }
-
-  // TuplePrefix<N>::DescribeMatchFailuresTo(matchers, values, os)
-  // describes failures in matching the first N fields of matchers
-  // against the first N fields of values.  If there is no failure,
-  // nothing will be streamed to os.
-  template <typename MatcherTuple, typename ValueTuple>
-  static void DescribeMatchFailuresTo(const MatcherTuple& matchers,
-                                      const ValueTuple& values,
-                                      ::std::ostream* os) {
-    using ::std::tr1::tuple_element;
-    using ::std::tr1::get;
-
-    // First, describes failures in the first N - 1 fields.
-    TuplePrefix<N - 1>::DescribeMatchFailuresTo(matchers, values, os);
-
-    // Then describes the failure (if any) in the (N - 1)-th (0-based)
-    // field.
-    typename tuple_element<N - 1, MatcherTuple>::type matcher =
-        get<N - 1>(matchers);
-    typedef typename tuple_element<N - 1, ValueTuple>::type Value;
-    Value value = get<N - 1>(values);
-    if (!matcher.Matches(value)) {
-      // TODO(wan): include in the message the name of the parameter
-      // as used in MOCK_METHOD*() when possible.
-      *os << "  Expected arg #" << N - 1 << ": ";
-      get<N - 1>(matchers).DescribeTo(os);
-      *os << "\n           Actual: ";
-      // We remove the reference in type Value to prevent the
-      // universal printer from printing the address of value, which
-      // isn't interesting to the user most of the time.  The
-      // matcher's ExplainMatchResultTo() method handles the case when
-      // the address is interesting.
-      internal::UniversalPrinter<GMOCK_REMOVE_REFERENCE_(Value)>::
-          Print(value, os);
-      ExplainMatchResultAsNeededTo<Value>(matcher, value, os);
-      *os << "\n";
-    }
-  }
-};
-
-// The base case.
-template <>
-class TuplePrefix<0> {
- public:
-  template <typename MatcherTuple, typename ValueTuple>
-  static bool Matches(const MatcherTuple& /* matcher_tuple */,
-                      const ValueTuple& /* value_tuple */) {
-    return true;
-  }
-
-  template <typename MatcherTuple, typename ValueTuple>
-  static void DescribeMatchFailuresTo(const MatcherTuple& /* matchers */,
-                                      const ValueTuple& /* values */,
-                                      ::std::ostream* /* os */) {}
-};
-
-// TupleMatches(matcher_tuple, value_tuple) returns true iff all
-// matchers in matcher_tuple match the corresponding fields in
-// value_tuple.  It is a compiler error if matcher_tuple and
-// value_tuple have different number of fields or incompatible field
-// types.
-template <typename MatcherTuple, typename ValueTuple>
-bool TupleMatches(const MatcherTuple& matcher_tuple,
-                  const ValueTuple& value_tuple) {
-  using ::std::tr1::tuple_size;
-  // Makes sure that matcher_tuple and value_tuple have the same
-  // number of fields.
-  GMOCK_COMPILE_ASSERT_(tuple_size<MatcherTuple>::value ==
-                        tuple_size<ValueTuple>::value,
-                        matcher_and_value_have_different_numbers_of_fields);
-  return TuplePrefix<tuple_size<ValueTuple>::value>::
-      Matches(matcher_tuple, value_tuple);
-}
-
-// Describes failures in matching matchers against values.  If there
-// is no failure, nothing will be streamed to os.
-template <typename MatcherTuple, typename ValueTuple>
-void DescribeMatchFailureTupleTo(const MatcherTuple& matchers,
-                                 const ValueTuple& values,
-                                 ::std::ostream* os) {
-  using ::std::tr1::tuple_size;
-  TuplePrefix<tuple_size<MatcherTuple>::value>::DescribeMatchFailuresTo(
-      matchers, values, os);
-}
-
-// The MatcherCastImpl class template is a helper for implementing
-// MatcherCast().  We need this helper in order to partially
-// specialize the implementation of MatcherCast() (C++ allows
-// class/struct templates to be partially specialized, but not
-// function templates.).
-
-// This general version is used when MatcherCast()'s argument is a
-// polymorphic matcher (i.e. something that can be converted to a
-// Matcher but is not one yet; for example, Eq(value)).
-template <typename T, typename M>
-class MatcherCastImpl {
- public:
-  static Matcher<T> Cast(M polymorphic_matcher) {
-    return Matcher<T>(polymorphic_matcher);
-  }
-};
-
-// This more specialized version is used when MatcherCast()'s argument
-// is already a Matcher.  This only compiles when type T can be
-// statically converted to type U.
-template <typename T, typename U>
-class MatcherCastImpl<T, Matcher<U> > {
- public:
-  static Matcher<T> Cast(const Matcher<U>& source_matcher) {
-    return Matcher<T>(new Impl(source_matcher));
-  }
- private:
-  class Impl : public MatcherInterface<T> {
-   public:
-    explicit Impl(const Matcher<U>& source_matcher)
-        : source_matcher_(source_matcher) {}
-
-    // We delegate the matching logic to the source matcher.
-    virtual bool Matches(T x) const {
-      return source_matcher_.Matches(static_cast<U>(x));
-    }
-
-    virtual void DescribeTo(::std::ostream* os) const {
-      source_matcher_.DescribeTo(os);
-    }
-
-    virtual void DescribeNegationTo(::std::ostream* os) const {
-      source_matcher_.DescribeNegationTo(os);
-    }
-
-    virtual void ExplainMatchResultTo(T x, ::std::ostream* os) const {
-      source_matcher_.ExplainMatchResultTo(static_cast<U>(x), os);
-    }
-   private:
-    const Matcher<U> source_matcher_;
-  };
-};
-
-// This even more specialized version is used for efficiently casting
-// a matcher to its own type.
-template <typename T>
-class MatcherCastImpl<T, Matcher<T> > {
- public:
-  static Matcher<T> Cast(const Matcher<T>& matcher) { return matcher; }
-};
-
-// Implements A<T>().
-template <typename T>
-class AnyMatcherImpl : public MatcherInterface<T> {
- public:
-  virtual bool Matches(T /* x */) const { return true; }
-  virtual void DescribeTo(::std::ostream* os) const { *os << "is anything"; }
-  virtual void DescribeNegationTo(::std::ostream* os) const {
-    // This is mostly for completeness' safe, as it's not very useful
-    // to write Not(A<bool>()).  However we cannot completely rule out
-    // such a possibility, and it doesn't hurt to be prepared.
-    *os << "never matches";
-  }
-};
-
-// Implements _, a matcher that matches any value of any
-// type.  This is a polymorphic matcher, so we need a template type
-// conversion operator to make it appearing as a Matcher<T> for any
-// type T.
-class AnythingMatcher {
- public:
-  template <typename T>
-  operator Matcher<T>() const { return A<T>(); }
-};
-
-// Implements a matcher that compares a given value with a
-// pre-supplied value using one of the ==, <=, <, etc, operators.  The
-// two values being compared don't have to have the same type.
-//
-// The matcher defined here is polymorphic (for example, Eq(5) can be
-// used to match an int, a short, a double, etc).  Therefore we use
-// a template type conversion operator in the implementation.
-//
-// We define this as a macro in order to eliminate duplicated source
-// code.
-//
-// The following template definition assumes that the Rhs parameter is
-// a "bare" type (i.e. neither 'const T' nor 'T&').
-#define GMOCK_IMPLEMENT_COMPARISON_MATCHER_(name, op, relation) \
-  template <typename Rhs> class name##Matcher { \
-   public: \
-    explicit name##Matcher(const Rhs& rhs) : rhs_(rhs) {} \
-    template <typename Lhs> \
-    operator Matcher<Lhs>() const { \
-      return MakeMatcher(new Impl<Lhs>(rhs_)); \
-    } \
-   private: \
-    template <typename Lhs> \
-    class Impl : public MatcherInterface<Lhs> { \
-     public: \
-      explicit Impl(const Rhs& rhs) : rhs_(rhs) {} \
-      virtual bool Matches(Lhs lhs) const { return lhs op rhs_; } \
-      virtual void DescribeTo(::std::ostream* os) const { \
-        *os << "is " relation  " "; \
-        UniversalPrinter<Rhs>::Print(rhs_, os); \
-      } \
-      virtual void DescribeNegationTo(::std::ostream* os) const { \
-        *os << "is not " relation  " "; \
-        UniversalPrinter<Rhs>::Print(rhs_, os); \
-      } \
-     private: \
-      Rhs rhs_; \
-    }; \
-    Rhs rhs_; \
-  }
-
-// Implements Eq(v), Ge(v), Gt(v), Le(v), Lt(v), and Ne(v)
-// respectively.
-GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Eq, ==, "equal to");
-GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Ge, >=, "greater than or equal to");
-GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Gt, >, "greater than");
-GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Le, <=, "less than or equal to");
-GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Lt, <, "less than");
-GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Ne, !=, "not equal to");
-
-#undef GMOCK_IMPLEMENT_COMPARISON_MATCHER_
-
-// Implements the polymorphic IsNull() matcher, which matches any raw or smart
-// pointer that is NULL.
-class IsNullMatcher {
- public:
-  template <typename Pointer>
-  bool Matches(const Pointer& p) const { return GetRawPointer(p) == NULL; }
-
-  void DescribeTo(::std::ostream* os) const { *os << "is NULL"; }
-  void DescribeNegationTo(::std::ostream* os) const {
-    *os << "is not NULL";
-  }
-};
-
-// Implements the polymorphic NotNull() matcher, which matches any raw or smart
-// pointer that is not NULL.
-class NotNullMatcher {
- public:
-  template <typename Pointer>
-  bool Matches(const Pointer& p) const { return GetRawPointer(p) != NULL; }
-
-  void DescribeTo(::std::ostream* os) const { *os << "is not NULL"; }
-  void DescribeNegationTo(::std::ostream* os) const {
-    *os << "is NULL";
-  }
-};
-
-// Ref(variable) matches any argument that is a reference to
-// 'variable'.  This matcher is polymorphic as it can match any
-// super type of the type of 'variable'.
-//
-// The RefMatcher template class implements Ref(variable).  It can
-// only be instantiated with a reference type.  This prevents a user
-// from mistakenly using Ref(x) to match a non-reference function
-// argument.  For example, the following will righteously cause a
-// compiler error:
-//
-//   int n;
-//   Matcher<int> m1 = Ref(n);   // This won't compile.
-//   Matcher<int&> m2 = Ref(n);  // This will compile.
-template <typename T>
-class RefMatcher;
-
-template <typename T>
-class RefMatcher<T&> {
-  // Google Mock is a generic framework and thus needs to support
-  // mocking any function types, including those that take non-const
-  // reference arguments.  Therefore the template parameter T (and
-  // Super below) can be instantiated to either a const type or a
-  // non-const type.
- public:
-  // RefMatcher() takes a T& instead of const T&, as we want the
-  // compiler to catch using Ref(const_value) as a matcher for a
-  // non-const reference.
-  explicit RefMatcher(T& x) : object_(x) {}  // NOLINT
-
-  template <typename Super>
-  operator Matcher<Super&>() const {
-    // By passing object_ (type T&) to Impl(), which expects a Super&,
-    // we make sure that Super is a super type of T.  In particular,
-    // this catches using Ref(const_value) as a matcher for a
-    // non-const reference, as you cannot implicitly convert a const
-    // reference to a non-const reference.
-    return MakeMatcher(new Impl<Super>(object_));
-  }
- private:
-  template <typename Super>
-  class Impl : public MatcherInterface<Super&> {
-   public:
-    explicit Impl(Super& x) : object_(x) {}  // NOLINT
-
-    // Matches() takes a Super& (as opposed to const Super&) in
-    // order to match the interface MatcherInterface<Super&>.
-    virtual bool Matches(Super& x) const { return &x == &object_; }  // NOLINT
-
-    virtual void DescribeTo(::std::ostream* os) const {
-      *os << "references the variable ";
-      UniversalPrinter<Super&>::Print(object_, os);
-    }
-
-    virtual void DescribeNegationTo(::std::ostream* os) const {
-      *os << "does not reference the variable ";
-      UniversalPrinter<Super&>::Print(object_, os);
-    }
-
-    virtual void ExplainMatchResultTo(Super& x,  // NOLINT
-                                      ::std::ostream* os) const {
-      *os << "is located @" << static_cast<const void*>(&x);
-    }
-   private:
-    const Super& object_;
-  };
-
-  T& object_;
-};
-
-// Polymorphic helper functions for narrow and wide string matchers.
-inline bool CaseInsensitiveCStringEquals(const char* lhs, const char* rhs) {
-  return String::CaseInsensitiveCStringEquals(lhs, rhs);
-}
-
-inline bool CaseInsensitiveCStringEquals(const wchar_t* lhs,
-                                         const wchar_t* rhs) {
-  return String::CaseInsensitiveWideCStringEquals(lhs, rhs);
-}
-
-// String comparison for narrow or wide strings that can have embedded NUL
-// characters.
-template <typename StringType>
-bool CaseInsensitiveStringEquals(const StringType& s1,
-                                 const StringType& s2) {
-  // Are the heads equal?
-  if (!CaseInsensitiveCStringEquals(s1.c_str(), s2.c_str())) {
-    return false;
-  }
-
-  // Skip the equal heads.
-  const typename StringType::value_type nul = 0;
-  const size_t i1 = s1.find(nul), i2 = s2.find(nul);
-
-  // Are we at the end of either s1 or s2?
-  if (i1 == StringType::npos || i2 == StringType::npos) {
-    return i1 == i2;
-  }
-
-  // Are the tails equal?
-  return CaseInsensitiveStringEquals(s1.substr(i1 + 1), s2.substr(i2 + 1));
-}
-
-// String matchers.
-
-// Implements equality-based string matchers like StrEq, StrCaseNe, and etc.
-template <typename StringType>
-class StrEqualityMatcher {
- public:
-  typedef typename StringType::const_pointer ConstCharPointer;
-
-  StrEqualityMatcher(const StringType& str, bool expect_eq,
-                     bool case_sensitive)
-      : string_(str), expect_eq_(expect_eq), case_sensitive_(case_sensitive) {}
-
-  // When expect_eq_ is true, returns true iff s is equal to string_;
-  // otherwise returns true iff s is not equal to string_.
-  bool Matches(ConstCharPointer s) const {
-    if (s == NULL) {
-      return !expect_eq_;
-    }
-    return Matches(StringType(s));
-  }
-
-  bool Matches(const StringType& s) const {
-    const bool eq = case_sensitive_ ? s == string_ :
-        CaseInsensitiveStringEquals(s, string_);
-    return expect_eq_ == eq;
-  }
-
-  void DescribeTo(::std::ostream* os) const {
-    DescribeToHelper(expect_eq_, os);
-  }
-
-  void DescribeNegationTo(::std::ostream* os) const {
-    DescribeToHelper(!expect_eq_, os);
-  }
- private:
-  void DescribeToHelper(bool expect_eq, ::std::ostream* os) const {
-    *os << "is ";
-    if (!expect_eq) {
-      *os << "not ";
-    }
-    *os << "equal to ";
-    if (!case_sensitive_) {
-      *os << "(ignoring case) ";
-    }
-    UniversalPrinter<StringType>::Print(string_, os);
-  }
-
-  const StringType string_;
-  const bool expect_eq_;
-  const bool case_sensitive_;
-};
-
-// Implements the polymorphic HasSubstr(substring) matcher, which
-// can be used as a Matcher<T> as long as T can be converted to a
-// string.
-template <typename StringType>
-class HasSubstrMatcher {
- public:
-  typedef typename StringType::const_pointer ConstCharPointer;
-
-  explicit HasSubstrMatcher(const StringType& substring)
-      : substring_(substring) {}
-
-  // These overloaded methods allow HasSubstr(substring) to be used as a
-  // Matcher<T> as long as T can be converted to string.  Returns true
-  // iff s contains substring_ as a substring.
-  bool Matches(ConstCharPointer s) const {
-    return s != NULL && Matches(StringType(s));
-  }
-
-  bool Matches(const StringType& s) const {
-    return s.find(substring_) != StringType::npos;
-  }
-
-  // Describes what this matcher matches.
-  void DescribeTo(::std::ostream* os) const {
-    *os << "has substring ";
-    UniversalPrinter<StringType>::Print(substring_, os);
-  }
-
-  void DescribeNegationTo(::std::ostream* os) const {
-    *os << "has no substring ";
-    UniversalPrinter<StringType>::Print(substring_, os);
-  }
- private:
-  const StringType substring_;
-};
-
-// Implements the polymorphic StartsWith(substring) matcher, which
-// can be used as a Matcher<T> as long as T can be converted to a
-// string.
-template <typename StringType>
-class StartsWithMatcher {
- public:
-  typedef typename StringType::const_pointer ConstCharPointer;
-
-  explicit StartsWithMatcher(const StringType& prefix) : prefix_(prefix) {
-  }
-
-  // These overloaded methods allow StartsWith(prefix) to be used as a
-  // Matcher<T> as long as T can be converted to string.  Returns true
-  // iff s starts with prefix_.
-  bool Matches(ConstCharPointer s) const {
-    return s != NULL && Matches(StringType(s));
-  }
-
-  bool Matches(const StringType& s) const {
-    return s.length() >= prefix_.length() &&
-        s.substr(0, prefix_.length()) == prefix_;
-  }
-
-  void DescribeTo(::std::ostream* os) const {
-    *os << "starts with ";
-    UniversalPrinter<StringType>::Print(prefix_, os);
-  }
-
-  void DescribeNegationTo(::std::ostream* os) const {
-    *os << "doesn't start with ";
-    UniversalPrinter<StringType>::Print(prefix_, os);
-  }
- private:
-  const StringType prefix_;
-};
-
-// Implements the polymorphic EndsWith(substring) matcher, which
-// can be used as a Matcher<T> as long as T can be converted to a
-// string.
-template <typename StringType>
-class EndsWithMatcher {
- public:
-  typedef typename StringType::const_pointer ConstCharPointer;
-
-  explicit EndsWithMatcher(const StringType& suffix) : suffix_(suffix) {}
-
-  // These overloaded methods allow EndsWith(suffix) to be used as a
-  // Matcher<T> as long as T can be converted to string.  Returns true
-  // iff s ends with suffix_.
-  bool Matches(ConstCharPointer s) const {
-    return s != NULL && Matches(StringType(s));
-  }
-
-  bool Matches(const StringType& s) const {
-    return s.length() >= suffix_.length() &&
-        s.substr(s.length() - suffix_.length()) == suffix_;
-  }
-
-  void DescribeTo(::std::ostream* os) const {
-    *os << "ends with ";
-    UniversalPrinter<StringType>::Print(suffix_, os);
-  }
-
-  void DescribeNegationTo(::std::ostream* os) const {
-    *os << "doesn't end with ";
-    UniversalPrinter<StringType>::Print(suffix_, os);
-  }
- private:
-  const StringType suffix_;
-};
-
-#if GMOCK_HAS_REGEX
-
-// Implements polymorphic matchers MatchesRegex(regex) and
-// ContainsRegex(regex), which can be used as a Matcher<T> as long as
-// T can be converted to a string.
-class MatchesRegexMatcher {
- public:
-  MatchesRegexMatcher(const RE* regex, bool full_match)
-      : regex_(regex), full_match_(full_match) {}
-
-  // These overloaded methods allow MatchesRegex(regex) to be used as
-  // a Matcher<T> as long as T can be converted to string.  Returns
-  // true iff s matches regular expression regex.  When full_match_ is
-  // true, a full match is done; otherwise a partial match is done.
-  bool Matches(const char* s) const {
-    return s != NULL && Matches(internal::string(s));
-  }
-
-  bool Matches(const internal::string& s) const {
-    return full_match_ ? RE::FullMatch(s, *regex_) :
-        RE::PartialMatch(s, *regex_);
-  }
-
-  void DescribeTo(::std::ostream* os) const {
-    *os << (full_match_ ? "matches" : "contains")
-        << " regular expression ";
-    UniversalPrinter<internal::string>::Print(regex_->pattern(), os);
-  }
-
-  void DescribeNegationTo(::std::ostream* os) const {
-    *os << "doesn't " << (full_match_ ? "match" : "contain")
-        << " regular expression ";
-    UniversalPrinter<internal::string>::Print(regex_->pattern(), os);
-  }
- private:
-  const internal::linked_ptr<const RE> regex_;
-  const bool full_match_;
-};
-
-#endif  // GMOCK_HAS_REGEX
-
-// Implements a matcher that compares the two fields of a 2-tuple
-// using one of the ==, <=, <, etc, operators.  The two fields being
-// compared don't have to have the same type.
-//
-// The matcher defined here is polymorphic (for example, Eq() can be
-// used to match a tuple<int, short>, a tuple<const long&, double>,
-// etc).  Therefore we use a template type conversion operator in the
-// implementation.
-//
-// We define this as a macro in order to eliminate duplicated source
-// code.
-#define GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(name, op) \
-  class name##2Matcher { \
-   public: \
-    template <typename T1, typename T2> \
-    operator Matcher<const ::std::tr1::tuple<T1, T2>&>() const { \
-      return MakeMatcher(new Impl<T1, T2>); \
-    } \
-   private: \
-    template <typename T1, typename T2> \
-    class Impl : public MatcherInterface<const ::std::tr1::tuple<T1, T2>&> { \
-     public: \
-      virtual bool Matches(const ::std::tr1::tuple<T1, T2>& args) const { \
-        return ::std::tr1::get<0>(args) op ::std::tr1::get<1>(args); \
-      } \
-      virtual void DescribeTo(::std::ostream* os) const { \
-        *os << "are a pair (x, y) where x " #op " y"; \
-      } \
-      virtual void DescribeNegationTo(::std::ostream* os) const { \
-        *os << "are a pair (x, y) where x " #op " y is false"; \
-      } \
-    }; \
-  }
-
-// Implements Eq(), Ge(), Gt(), Le(), Lt(), and Ne() respectively.
-GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Eq, ==);
-GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Ge, >=);
-GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Gt, >);
-GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Le, <=);
-GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Lt, <);
-GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Ne, !=);
-
-#undef GMOCK_IMPLEMENT_COMPARISON2_MATCHER_
-
-// Implements the Not(...) matcher for a particular argument type T.
-// We do not nest it inside the NotMatcher class template, as that
-// will prevent different instantiations of NotMatcher from sharing
-// the same NotMatcherImpl<T> class.
-template <typename T>
-class NotMatcherImpl : public MatcherInterface<T> {
- public:
-  explicit NotMatcherImpl(const Matcher<T>& matcher)
-      : matcher_(matcher) {}
-
-  virtual bool Matches(T x) const {
-    return !matcher_.Matches(x);
-  }
-
-  virtual void DescribeTo(::std::ostream* os) const {
-    matcher_.DescribeNegationTo(os);
-  }
-
-  virtual void DescribeNegationTo(::std::ostream* os) const {
-    matcher_.DescribeTo(os);
-  }
-
-  virtual void ExplainMatchResultTo(T x, ::std::ostream* os) const {
-    matcher_.ExplainMatchResultTo(x, os);
-  }
- private:
-  const Matcher<T> matcher_;
-};
-
-// Implements the Not(m) matcher, which matches a value that doesn't
-// match matcher m.
-template <typename InnerMatcher>
-class NotMatcher {
- public:
-  explicit NotMatcher(InnerMatcher matcher) : matcher_(matcher) {}
-
-  // This template type conversion operator allows Not(m) to be used
-  // to match any type m can match.
-  template <typename T>
-  operator Matcher<T>() const {
-    return Matcher<T>(new NotMatcherImpl<T>(SafeMatcherCast<T>(matcher_)));
-  }
- private:
-  InnerMatcher matcher_;
-};
-
-// Implements the AllOf(m1, m2) matcher for a particular argument type
-// T. We do not nest it inside the BothOfMatcher class template, as
-// that will prevent different instantiations of BothOfMatcher from
-// sharing the same BothOfMatcherImpl<T> class.
-template <typename T>
-class BothOfMatcherImpl : public MatcherInterface<T> {
- public:
-  BothOfMatcherImpl(const Matcher<T>& matcher1, const Matcher<T>& matcher2)
-      : matcher1_(matcher1), matcher2_(matcher2) {}
-
-  virtual bool Matches(T x) const {
-    return matcher1_.Matches(x) && matcher2_.Matches(x);
-  }
-
-  virtual void DescribeTo(::std::ostream* os) const {
-    *os << "(";
-    matcher1_.DescribeTo(os);
-    *os << ") and (";
-    matcher2_.DescribeTo(os);
-    *os << ")";
-  }
-
-  virtual void DescribeNegationTo(::std::ostream* os) const {
-    *os << "not ";
-    DescribeTo(os);
-  }
-
-  virtual void ExplainMatchResultTo(T x, ::std::ostream* os) const {
-    if (Matches(x)) {
-      // When both matcher1_ and matcher2_ match x, we need to
-      // explain why *both* of them match.
-      ::std::stringstream ss1;
-      matcher1_.ExplainMatchResultTo(x, &ss1);
-      const internal::string s1 = ss1.str();
-
-      ::std::stringstream ss2;
-      matcher2_.ExplainMatchResultTo(x, &ss2);
-      const internal::string s2 = ss2.str();
-
-      if (s1 == "") {
-        *os << s2;
-      } else {
-        *os << s1;
-        if (s2 != "") {
-          *os << "; " << s2;
-        }
-      }
-    } else {
-      // Otherwise we only need to explain why *one* of them fails
-      // to match.
-      if (!matcher1_.Matches(x)) {
-        matcher1_.ExplainMatchResultTo(x, os);
-      } else {
-        matcher2_.ExplainMatchResultTo(x, os);
-      }
-    }
-  }
- private:
-  const Matcher<T> matcher1_;
-  const Matcher<T> matcher2_;
-};
-
-// Used for implementing the AllOf(m_1, ..., m_n) matcher, which
-// matches a value that matches all of the matchers m_1, ..., and m_n.
-template <typename Matcher1, typename Matcher2>
-class BothOfMatcher {
- public:
-  BothOfMatcher(Matcher1 matcher1, Matcher2 matcher2)
-      : matcher1_(matcher1), matcher2_(matcher2) {}
-
-  // This template type conversion operator allows a
-  // BothOfMatcher<Matcher1, Matcher2> object to match any type that
-  // both Matcher1 and Matcher2 can match.
-  template <typename T>
-  operator Matcher<T>() const {
-    return Matcher<T>(new BothOfMatcherImpl<T>(SafeMatcherCast<T>(matcher1_),
-                                               SafeMatcherCast<T>(matcher2_)));
-  }
- private:
-  Matcher1 matcher1_;
-  Matcher2 matcher2_;
-};
-
-// Implements the AnyOf(m1, m2) matcher for a particular argument type
-// T.  We do not nest it inside the AnyOfMatcher class template, as
-// that will prevent different instantiations of AnyOfMatcher from
-// sharing the same EitherOfMatcherImpl<T> class.
-template <typename T>
-class EitherOfMatcherImpl : public MatcherInterface<T> {
- public:
-  EitherOfMatcherImpl(const Matcher<T>& matcher1, const Matcher<T>& matcher2)
-      : matcher1_(matcher1), matcher2_(matcher2) {}
-
-  virtual bool Matches(T x) const {
-    return matcher1_.Matches(x) || matcher2_.Matches(x);
-  }
-
-  virtual void DescribeTo(::std::ostream* os) const {
-    *os << "(";
-    matcher1_.DescribeTo(os);
-    *os << ") or (";
-    matcher2_.DescribeTo(os);
-    *os << ")";
-  }
-
-  virtual void DescribeNegationTo(::std::ostream* os) const {
-    *os << "not ";
-    DescribeTo(os);
-  }
-
-  virtual void ExplainMatchResultTo(T x, ::std::ostream* os) const {
-    if (Matches(x)) {
-      // If either matcher1_ or matcher2_ matches x, we just need
-      // to explain why *one* of them matches.
-      if (matcher1_.Matches(x)) {
-        matcher1_.ExplainMatchResultTo(x, os);
-      } else {
-        matcher2_.ExplainMatchResultTo(x, os);
-      }
-    } else {
-      // Otherwise we need to explain why *neither* matches.
-      ::std::stringstream ss1;
-      matcher1_.ExplainMatchResultTo(x, &ss1);
-      const internal::string s1 = ss1.str();
-
-      ::std::stringstream ss2;
-      matcher2_.ExplainMatchResultTo(x, &ss2);
-      const internal::string s2 = ss2.str();
-
-      if (s1 == "") {
-        *os << s2;
-      } else {
-        *os << s1;
-        if (s2 != "") {
-          *os << "; " << s2;
-        }
-      }
-    }
-  }
- private:
-  const Matcher<T> matcher1_;
-  const Matcher<T> matcher2_;
-};
-
-// Used for implementing the AnyOf(m_1, ..., m_n) matcher, which
-// matches a value that matches at least one of the matchers m_1, ...,
-// and m_n.
-template <typename Matcher1, typename Matcher2>
-class EitherOfMatcher {
- public:
-  EitherOfMatcher(Matcher1 matcher1, Matcher2 matcher2)
-      : matcher1_(matcher1), matcher2_(matcher2) {}
-
-  // This template type conversion operator allows a
-  // EitherOfMatcher<Matcher1, Matcher2> object to match any type that
-  // both Matcher1 and Matcher2 can match.
-  template <typename T>
-  operator Matcher<T>() const {
-    return Matcher<T>(new EitherOfMatcherImpl<T>(
-        SafeMatcherCast<T>(matcher1_), SafeMatcherCast<T>(matcher2_)));
-  }
- private:
-  Matcher1 matcher1_;
-  Matcher2 matcher2_;
-};
-
-// Used for implementing Truly(pred), which turns a predicate into a
-// matcher.
-template <typename Predicate>
-class TrulyMatcher {
- public:
-  explicit TrulyMatcher(Predicate pred) : predicate_(pred) {}
-
-  // This method template allows Truly(pred) to be used as a matcher
-  // for type T where T is the argument type of predicate 'pred'.  The
-  // argument is passed by reference as the predicate may be
-  // interested in the address of the argument.
-  template <typename T>
-  bool Matches(T& x) const {  // NOLINT
-#if GTEST_OS_WINDOWS
-    // MSVC warns about converting a value into bool (warning 4800).
-#pragma warning(push)          // Saves the current warning state.
-#pragma warning(disable:4800)  // Temporarily disables warning 4800.
-#endif  // GTEST_OS_WINDOWS
-    return predicate_(x);
-#if GTEST_OS_WINDOWS
-#pragma warning(pop)           // Restores the warning state.
-#endif  // GTEST_OS_WINDOWS
-  }
-
-  void DescribeTo(::std::ostream* os) const {
-    *os << "satisfies the given predicate";
-  }
-
-  void DescribeNegationTo(::std::ostream* os) const {
-    *os << "doesn't satisfy the given predicate";
-  }
- private:
-  Predicate predicate_;
-};
-
-// Used for implementing Matches(matcher), which turns a matcher into
-// a predicate.
-template <typename M>
-class MatcherAsPredicate {
- public:
-  explicit MatcherAsPredicate(M matcher) : matcher_(matcher) {}
-
-  // This template operator() allows Matches(m) to be used as a
-  // predicate on type T where m is a matcher on type T.
-  //
-  // The argument x is passed by reference instead of by value, as
-  // some matcher may be interested in its address (e.g. as in
-  // Matches(Ref(n))(x)).
-  template <typename T>
-  bool operator()(const T& x) const {
-    // We let matcher_ commit to a particular type here instead of
-    // when the MatcherAsPredicate object was constructed.  This
-    // allows us to write Matches(m) where m is a polymorphic matcher
-    // (e.g. Eq(5)).
-    //
-    // If we write Matcher<T>(matcher_).Matches(x) here, it won't
-    // compile when matcher_ has type Matcher<const T&>; if we write
-    // Matcher<const T&>(matcher_).Matches(x) here, it won't compile
-    // when matcher_ has type Matcher<T>; if we just write
-    // matcher_.Matches(x), it won't compile when matcher_ is
-    // polymorphic, e.g. Eq(5).
-    //
-    // MatcherCast<const T&>() is necessary for making the code work
-    // in all of the above situations.
-    return MatcherCast<const T&>(matcher_).Matches(x);
-  }
- private:
-  M matcher_;
-};
-
-// For implementing ASSERT_THAT() and EXPECT_THAT().  The template
-// argument M must be a type that can be converted to a matcher.
-template <typename M>
-class PredicateFormatterFromMatcher {
- public:
-  explicit PredicateFormatterFromMatcher(const M& m) : matcher_(m) {}
-
-  // This template () operator allows a PredicateFormatterFromMatcher
-  // object to act as a predicate-formatter suitable for using with
-  // Google Test's EXPECT_PRED_FORMAT1() macro.
-  template <typename T>
-  AssertionResult operator()(const char* value_text, const T& x) const {
-    // We convert matcher_ to a Matcher<const T&> *now* instead of
-    // when the PredicateFormatterFromMatcher object was constructed,
-    // as matcher_ may be polymorphic (e.g. NotNull()) and we won't
-    // know which type to instantiate it to until we actually see the
-    // type of x here.
-    //
-    // We write MatcherCast<const T&>(matcher_) instead of
-    // Matcher<const T&>(matcher_), as the latter won't compile when
-    // matcher_ has type Matcher<T> (e.g. An<int>()).
-    const Matcher<const T&> matcher = MatcherCast<const T&>(matcher_);
-    if (matcher.Matches(x)) {
-      return AssertionSuccess();
-    } else {
-      ::std::stringstream ss;
-      ss << "Value of: " << value_text << "\n"
-         << "Expected: ";
-      matcher.DescribeTo(&ss);
-      ss << "\n  Actual: ";
-      UniversalPrinter<T>::Print(x, &ss);
-      ExplainMatchResultAsNeededTo<const T&>(matcher, x, &ss);
-      return AssertionFailure(Message() << ss.str());
-    }
-  }
- private:
-  const M matcher_;
-};
-
-// A helper function for converting a matcher to a predicate-formatter
-// without the user needing to explicitly write the type.  This is
-// used for implementing ASSERT_THAT() and EXPECT_THAT().
-template <typename M>
-inline PredicateFormatterFromMatcher<M>
-MakePredicateFormatterFromMatcher(const M& matcher) {
-  return PredicateFormatterFromMatcher<M>(matcher);
-}
-
-// Implements the polymorphic floating point equality matcher, which
-// matches two float values using ULP-based approximation.  The
-// template is meant to be instantiated with FloatType being either
-// float or double.
-template <typename FloatType>
-class FloatingEqMatcher {
- public:
-  // Constructor for FloatingEqMatcher.
-  // The matcher's input will be compared with rhs.  The matcher treats two
-  // NANs as equal if nan_eq_nan is true.  Otherwise, under IEEE standards,
-  // equality comparisons between NANs will always return false.
-  FloatingEqMatcher(FloatType rhs, bool nan_eq_nan) :
-    rhs_(rhs), nan_eq_nan_(nan_eq_nan) {}
-
-  // Implements floating point equality matcher as a Matcher<T>.
-  template <typename T>
-  class Impl : public MatcherInterface<T> {
-   public:
-    Impl(FloatType rhs, bool nan_eq_nan) :
-      rhs_(rhs), nan_eq_nan_(nan_eq_nan) {}
-
-    virtual bool Matches(T value) const {
-      const FloatingPoint<FloatType> lhs(value), rhs(rhs_);
-
-      // Compares NaNs first, if nan_eq_nan_ is true.
-      if (nan_eq_nan_ && lhs.is_nan()) {
-        return rhs.is_nan();
-      }
-
-      return lhs.AlmostEquals(rhs);
-    }
-
-    virtual void DescribeTo(::std::ostream* os) const {
-      // os->precision() returns the previously set precision, which we
-      // store to restore the ostream to its original configuration
-      // after outputting.
-      const ::std::streamsize old_precision = os->precision(
-          ::std::numeric_limits<FloatType>::digits10 + 2);
-      if (FloatingPoint<FloatType>(rhs_).is_nan()) {
-        if (nan_eq_nan_) {
-          *os << "is NaN";
-        } else {
-          *os << "never matches";
-        }
-      } else {
-        *os << "is approximately " << rhs_;
-      }
-      os->precision(old_precision);
-    }
-
-    virtual void DescribeNegationTo(::std::ostream* os) const {
-      // As before, get original precision.
-      const ::std::streamsize old_precision = os->precision(
-          ::std::numeric_limits<FloatType>::digits10 + 2);
-      if (FloatingPoint<FloatType>(rhs_).is_nan()) {
-        if (nan_eq_nan_) {
-          *os << "is not NaN";
-        } else {
-          *os << "is anything";
-        }
-      } else {
-        *os << "is not approximately " << rhs_;
-      }
-      // Restore original precision.
-      os->precision(old_precision);
-    }
-
-   private:
-    const FloatType rhs_;
-    const bool nan_eq_nan_;
-  };
-
-  // The following 3 type conversion operators allow FloatEq(rhs) and
-  // NanSensitiveFloatEq(rhs) to be used as a Matcher<float>, a
-  // Matcher<const float&>, or a Matcher<float&>, but nothing else.
-  // (While Google's C++ coding style doesn't allow arguments passed
-  // by non-const reference, we may see them in code not conforming to
-  // the style.  Therefore Google Mock needs to support them.)
-  operator Matcher<FloatType>() const {
-    return MakeMatcher(new Impl<FloatType>(rhs_, nan_eq_nan_));
-  }
-
-  operator Matcher<const FloatType&>() const {
-    return MakeMatcher(new Impl<const FloatType&>(rhs_, nan_eq_nan_));
-  }
-
-  operator Matcher<FloatType&>() const {
-    return MakeMatcher(new Impl<FloatType&>(rhs_, nan_eq_nan_));
-  }
- private:
-  const FloatType rhs_;
-  const bool nan_eq_nan_;
-};
-
-// Implements the Pointee(m) matcher for matching a pointer whose
-// pointee matches matcher m.  The pointer can be either raw or smart.
-template <typename InnerMatcher>
-class PointeeMatcher {
- public:
-  explicit PointeeMatcher(const InnerMatcher& matcher) : matcher_(matcher) {}
-
-  // This type conversion operator template allows Pointee(m) to be
-  // used as a matcher for any pointer type whose pointee type is
-  // compatible with the inner matcher, where type Pointer can be
-  // either a raw pointer or a smart pointer.
-  //
-  // The reason we do this instead of relying on
-  // MakePolymorphicMatcher() is that the latter is not flexible
-  // enough for implementing the DescribeTo() method of Pointee().
-  template <typename Pointer>
-  operator Matcher<Pointer>() const {
-    return MakeMatcher(new Impl<Pointer>(matcher_));
-  }
- private:
-  // The monomorphic implementation that works for a particular pointer type.
-  template <typename Pointer>
-  class Impl : public MatcherInterface<Pointer> {
-   public:
-    typedef typename PointeeOf<GMOCK_REMOVE_CONST_(  // NOLINT
-        GMOCK_REMOVE_REFERENCE_(Pointer))>::type Pointee;
-
-    explicit Impl(const InnerMatcher& matcher)
-        : matcher_(MatcherCast<const Pointee&>(matcher)) {}
-
-    virtual bool Matches(Pointer p) const {
-      return GetRawPointer(p) != NULL && matcher_.Matches(*p);
-    }
-
-    virtual void DescribeTo(::std::ostream* os) const {
-      *os << "points to a value that ";
-      matcher_.DescribeTo(os);
-    }
-
-    virtual void DescribeNegationTo(::std::ostream* os) const {
-      *os << "does not point to a value that ";
-      matcher_.DescribeTo(os);
-    }
-
-    virtual void ExplainMatchResultTo(Pointer pointer,
-                                      ::std::ostream* os) const {
-      if (GetRawPointer(pointer) == NULL)
-        return;
-
-      ::std::stringstream ss;
-      matcher_.ExplainMatchResultTo(*pointer, &ss);
-      const internal::string s = ss.str();
-      if (s != "") {
-        *os << "points to a value that " << s;
-      }
-    }
-   private:
-    const Matcher<const Pointee&> matcher_;
-  };
-
-  const InnerMatcher matcher_;
-};
-
-// Implements the Field() matcher for matching a field (i.e. member
-// variable) of an object.
-template <typename Class, typename FieldType>
-class FieldMatcher {
- public:
-  FieldMatcher(FieldType Class::*field,
-               const Matcher<const FieldType&>& matcher)
-      : field_(field), matcher_(matcher) {}
-
-  // Returns true iff the inner matcher matches obj.field.
-  bool Matches(const Class& obj) const {
-    return matcher_.Matches(obj.*field_);
-  }
-
-  // Returns true iff the inner matcher matches obj->field.
-  bool Matches(const Class* p) const {
-    return (p != NULL) && matcher_.Matches(p->*field_);
-  }
-
-  void DescribeTo(::std::ostream* os) const {
-    *os << "the given field ";
-    matcher_.DescribeTo(os);
-  }
-
-  void DescribeNegationTo(::std::ostream* os) const {
-    *os << "the given field ";
-    matcher_.DescribeNegationTo(os);
-  }
-
-  // The first argument of ExplainMatchResultTo() is needed to help
-  // Symbian's C++ compiler choose which overload to use.  Its type is
-  // true_type iff the Field() matcher is used to match a pointer.
-  void ExplainMatchResultTo(false_type /* is_not_pointer */, const Class& obj,
-                            ::std::ostream* os) const {
-    ::std::stringstream ss;
-    matcher_.ExplainMatchResultTo(obj.*field_, &ss);
-    const internal::string s = ss.str();
-    if (s != "") {
-      *os << "the given field " << s;
-    }
-  }
-
-  void ExplainMatchResultTo(true_type /* is_pointer */, const Class* p,
-                            ::std::ostream* os) const {
-    if (p != NULL) {
-      // Since *p has a field, it must be a class/struct/union type
-      // and thus cannot be a pointer.  Therefore we pass false_type()
-      // as the first argument.
-      ExplainMatchResultTo(false_type(), *p, os);
-    }
-  }
- private:
-  const FieldType Class::*field_;
-  const Matcher<const FieldType&> matcher_;
-};
-
-// Explains the result of matching an object or pointer against a field matcher.
-template <typename Class, typename FieldType, typename T>
-void ExplainMatchResultTo(const FieldMatcher<Class, FieldType>& matcher,
-                          const T& value, ::std::ostream* os) {
-  matcher.ExplainMatchResultTo(
-      typename ::testing::internal::is_pointer<T>::type(), value, os);
-}
-
-// Implements the Property() matcher for matching a property
-// (i.e. return value of a getter method) of an object.
-template <typename Class, typename PropertyType>
-class PropertyMatcher {
- public:
-  // The property may have a reference type, so 'const PropertyType&'
-  // may cause double references and fail to compile.  That's why we
-  // need GMOCK_REFERENCE_TO_CONST, which works regardless of
-  // PropertyType being a reference or not.
-  typedef GMOCK_REFERENCE_TO_CONST_(PropertyType) RefToConstProperty;
-
-  PropertyMatcher(PropertyType (Class::*property)() const,
-                  const Matcher<RefToConstProperty>& matcher)
-      : property_(property), matcher_(matcher) {}
-
-  // Returns true iff obj.property() matches the inner matcher.
-  bool Matches(const Class& obj) const {
-    return matcher_.Matches((obj.*property_)());
-  }
-
-  // Returns true iff p->property() matches the inner matcher.
-  bool Matches(const Class* p) const {
-    return (p != NULL) && matcher_.Matches((p->*property_)());
-  }
-
-  void DescribeTo(::std::ostream* os) const {
-    *os << "the given property ";
-    matcher_.DescribeTo(os);
-  }
-
-  void DescribeNegationTo(::std::ostream* os) const {
-    *os << "the given property ";
-    matcher_.DescribeNegationTo(os);
-  }
-
-  // The first argument of ExplainMatchResultTo() is needed to help
-  // Symbian's C++ compiler choose which overload to use.  Its type is
-  // true_type iff the Property() matcher is used to match a pointer.
-  void ExplainMatchResultTo(false_type /* is_not_pointer */, const Class& obj,
-                            ::std::ostream* os) const {
-    ::std::stringstream ss;
-    matcher_.ExplainMatchResultTo((obj.*property_)(), &ss);
-    const internal::string s = ss.str();
-    if (s != "") {
-      *os << "the given property " << s;
-    }
-  }
-
-  void ExplainMatchResultTo(true_type /* is_pointer */, const Class* p,
-                            ::std::ostream* os) const {
-    if (p != NULL) {
-      // Since *p has a property method, it must be a
-      // class/struct/union type and thus cannot be a pointer.
-      // Therefore we pass false_type() as the first argument.
-      ExplainMatchResultTo(false_type(), *p, os);
-    }
-  }
- private:
-  PropertyType (Class::*property_)() const;
-  const Matcher<RefToConstProperty> matcher_;
-};
-
-// Explains the result of matching an object or pointer against a
-// property matcher.
-template <typename Class, typename PropertyType, typename T>
-void ExplainMatchResultTo(const PropertyMatcher<Class, PropertyType>& matcher,
-                          const T& value, ::std::ostream* os) {
-  matcher.ExplainMatchResultTo(
-      typename ::testing::internal::is_pointer<T>::type(), value, os);
-}
-
-// Type traits specifying various features of different functors for ResultOf.
-// The default template specifies features for functor objects.
-// Functor classes have to typedef argument_type and result_type
-// to be compatible with ResultOf.
-template <typename Functor>
-struct CallableTraits {
-  typedef typename Functor::result_type ResultType;
-  typedef Functor StorageType;
-
-  static void CheckIsValid(Functor functor) {}
-  template <typename T>
-  static ResultType Invoke(Functor f, T arg) { return f(arg); }
-};
-
-// Specialization for function pointers.
-template <typename ArgType, typename ResType>
-struct CallableTraits<ResType(*)(ArgType)> {
-  typedef ResType ResultType;
-  typedef ResType(*StorageType)(ArgType);
-
-  static void CheckIsValid(ResType(*f)(ArgType)) {
-    GTEST_CHECK_(f != NULL)
-        << "NULL function pointer is passed into ResultOf().";
-  }
-  template <typename T>
-  static ResType Invoke(ResType(*f)(ArgType), T arg) {
-    return (*f)(arg);
-  }
-};
-
-// Implements the ResultOf() matcher for matching a return value of a
-// unary function of an object.
-template <typename Callable>
-class ResultOfMatcher {
- public:
-  typedef typename CallableTraits<Callable>::ResultType ResultType;
-
-  ResultOfMatcher(Callable callable, const Matcher<ResultType>& matcher)
-      : callable_(callable), matcher_(matcher) {
-    CallableTraits<Callable>::CheckIsValid(callable_);
-  }
-
-  template <typename T>
-  operator Matcher<T>() const {
-    return Matcher<T>(new Impl<T>(callable_, matcher_));
-  }
-
- private:
-  typedef typename CallableTraits<Callable>::StorageType CallableStorageType;
-
-  template <typename T>
-  class Impl : public MatcherInterface<T> {
-   public:
-    Impl(CallableStorageType callable, const Matcher<ResultType>& matcher)
-        : callable_(callable), matcher_(matcher) {}
-    // Returns true iff callable_(obj) matches the inner matcher.
-    // The calling syntax is different for different types of callables
-    // so we abstract it in CallableTraits<Callable>::Invoke().
-    virtual bool Matches(T obj) const {
-      return matcher_.Matches(
-          CallableTraits<Callable>::template Invoke<T>(callable_, obj));
-    }
-
-    virtual void DescribeTo(::std::ostream* os) const {
-      *os << "result of the given callable ";
-      matcher_.DescribeTo(os);
-    }
-
-    virtual void DescribeNegationTo(::std::ostream* os) const {
-      *os << "result of the given callable ";
-      matcher_.DescribeNegationTo(os);
-    }
-
-    virtual void ExplainMatchResultTo(T obj, ::std::ostream* os) const {
-      ::std::stringstream ss;
-      matcher_.ExplainMatchResultTo(
-          CallableTraits<Callable>::template Invoke<T>(callable_, obj),
-          &ss);
-      const internal::string s = ss.str();
-      if (s != "")
-        *os << "result of the given callable " << s;
-    }
-   private:
-    // Functors often define operator() as non-const method even though
-    // they are actualy stateless. But we need to use them even when
-    // 'this' is a const pointer. It's the user's responsibility not to
-    // use stateful callables with ResultOf(), which does't guarantee
-    // how many times the callable will be invoked.
-    mutable CallableStorageType callable_;
-    const Matcher<ResultType> matcher_;
-  };  // class Impl
-
-  const CallableStorageType callable_;
-  const Matcher<ResultType> matcher_;
-};
-
-// Explains the result of matching a value against a functor matcher.
-template <typename T, typename Callable>
-void ExplainMatchResultTo(const ResultOfMatcher<Callable>& matcher,
-                          T obj, ::std::ostream* os) {
-  matcher.ExplainMatchResultTo(obj, os);
-}
-
-// Implements an equality matcher for any STL-style container whose elements
-// support ==. This matcher is like Eq(), but its failure explanations provide
-// more detailed information that is useful when the container is used as a set.
-// The failure message reports elements that are in one of the operands but not
-// the other. The failure messages do not report duplicate or out-of-order
-// elements in the containers (which don't properly matter to sets, but can
-// occur if the containers are vectors or lists, for example).
-//
-// Uses the container's const_iterator, value_type, operator ==,
-// begin(), and end().
-template <typename Container>
-class ContainerEqMatcher {
- public:
-  typedef internal::StlContainerView<Container> View;
-  typedef typename View::type StlContainer;
-  typedef typename View::const_reference StlContainerReference;
-
-  // We make a copy of rhs in case the elements in it are modified
-  // after this matcher is created.
-  explicit ContainerEqMatcher(const Container& rhs) : rhs_(View::Copy(rhs)) {
-    // Makes sure the user doesn't instantiate this class template
-    // with a const or reference type.
-    testing::StaticAssertTypeEq<Container,
-        GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))>();
-  }
-
-  template <typename LhsContainer>
-  bool Matches(const LhsContainer& lhs) const {
-    // GMOCK_REMOVE_CONST_() is needed to work around an MSVC 8.0 bug
-    // that causes LhsContainer to be a const type sometimes.
-    typedef internal::StlContainerView<GMOCK_REMOVE_CONST_(LhsContainer)>
-        LhsView;
-    StlContainerReference lhs_stl_container = LhsView::ConstReference(lhs);
-    return lhs_stl_container == rhs_;
-  }
-  void DescribeTo(::std::ostream* os) const {
-    *os << "equals ";
-    UniversalPrinter<StlContainer>::Print(rhs_, os);
-  }
-  void DescribeNegationTo(::std::ostream* os) const {
-    *os << "does not equal ";
-    UniversalPrinter<StlContainer>::Print(rhs_, os);
-  }
-
-  template <typename LhsContainer>
-  void ExplainMatchResultTo(const LhsContainer& lhs,
-                            ::std::ostream* os) const {
-    // GMOCK_REMOVE_CONST_() is needed to work around an MSVC 8.0 bug
-    // that causes LhsContainer to be a const type sometimes.
-    typedef internal::StlContainerView<GMOCK_REMOVE_CONST_(LhsContainer)>
-        LhsView;
-    typedef typename LhsView::type LhsStlContainer;
-    StlContainerReference lhs_stl_container = LhsView::ConstReference(lhs);
-
-    // Something is different. Check for missing values first.
-    bool printed_header = false;
-    for (typename LhsStlContainer::const_iterator it =
-             lhs_stl_container.begin();
-         it != lhs_stl_container.end(); ++it) {
-      if (internal::ArrayAwareFind(rhs_.begin(), rhs_.end(), *it) ==
-          rhs_.end()) {
-        if (printed_header) {
-          *os << ", ";
-        } else {
-          *os << "Only in actual: ";
-          printed_header = true;
-        }
-        UniversalPrinter<typename LhsStlContainer::value_type>::Print(*it, os);
-      }
-    }
-
-    // Now check for extra values.
-    bool printed_header2 = false;
-    for (typename StlContainer::const_iterator it = rhs_.begin();
-         it != rhs_.end(); ++it) {
-      if (internal::ArrayAwareFind(
-              lhs_stl_container.begin(), lhs_stl_container.end(), *it) ==
-          lhs_stl_container.end()) {
-        if (printed_header2) {
-          *os << ", ";
-        } else {
-          *os << (printed_header ? "; not" : "Not") << " in actual: ";
-          printed_header2 = true;
-        }
-        UniversalPrinter<typename StlContainer::value_type>::Print(*it, os);
-      }
-    }
-  }
- private:
-  const StlContainer rhs_;
-};
-
-template <typename LhsContainer, typename Container>
-void ExplainMatchResultTo(const ContainerEqMatcher<Container>& matcher,
-                          const LhsContainer& lhs,
-                          ::std::ostream* os) {
-  matcher.ExplainMatchResultTo(lhs, os);
-}
-
-// Implements Contains(element_matcher) for the given argument type Container.
-template <typename Container>
-class ContainsMatcherImpl : public MatcherInterface<Container> {
- public:
-  typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) RawContainer;
-  typedef StlContainerView<RawContainer> View;
-  typedef typename View::type StlContainer;
-  typedef typename View::const_reference StlContainerReference;
-  typedef typename StlContainer::value_type Element;
-
-  template <typename InnerMatcher>
-  explicit ContainsMatcherImpl(InnerMatcher inner_matcher)
-      : inner_matcher_(
-          testing::SafeMatcherCast<const Element&>(inner_matcher)) {}
-
-  // Returns true iff 'container' matches.
-  virtual bool Matches(Container container) const {
-    StlContainerReference stl_container = View::ConstReference(container);
-    for (typename StlContainer::const_iterator it = stl_container.begin();
-         it != stl_container.end(); ++it) {
-      if (inner_matcher_.Matches(*it))
-        return true;
-    }
-    return false;
-  }
-
-  // Describes what this matcher does.
-  virtual void DescribeTo(::std::ostream* os) const {
-    *os << "contains at least one element that ";
-    inner_matcher_.DescribeTo(os);
-  }
-
-  // Describes what the negation of this matcher does.
-  virtual void DescribeNegationTo(::std::ostream* os) const {
-    *os << "doesn't contain any element that ";
-    inner_matcher_.DescribeTo(os);
-  }
-
-  // Explains why 'container' matches, or doesn't match, this matcher.
-  virtual void ExplainMatchResultTo(Container container,
-                                    ::std::ostream* os) const {
-    StlContainerReference stl_container = View::ConstReference(container);
-
-    // We need to explain which (if any) element matches inner_matcher_.
-    typename StlContainer::const_iterator it = stl_container.begin();
-    for (size_t i = 0; it != stl_container.end(); ++it, ++i) {
-      if (inner_matcher_.Matches(*it)) {
-        *os << "element " << i << " matches";
-        return;
-      }
-    }
-  }
-
- private:
-  const Matcher<const Element&> inner_matcher_;
-};
-
-// Implements polymorphic Contains(element_matcher).
-template <typename M>
-class ContainsMatcher {
- public:
-  explicit ContainsMatcher(M m) : inner_matcher_(m) {}
-
-  template <typename Container>
-  operator Matcher<Container>() const {
-    return MakeMatcher(new ContainsMatcherImpl<Container>(inner_matcher_));
-  }
-
- private:
-  const M inner_matcher_;
-};
-
-// Implements Key(inner_matcher) for the given argument pair type.
-// Key(inner_matcher) matches an std::pair whose 'first' field matches
-// inner_matcher.  For example, Contains(Key(Ge(5))) can be used to match an
-// std::map that contains at least one element whose key is >= 5.
-template <typename PairType>
-class KeyMatcherImpl : public MatcherInterface<PairType> {
- public:
-  typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(PairType)) RawPairType;
-  typedef typename RawPairType::first_type KeyType;
-
-  template <typename InnerMatcher>
-  explicit KeyMatcherImpl(InnerMatcher inner_matcher)
-      : inner_matcher_(
-          testing::SafeMatcherCast<const KeyType&>(inner_matcher)) {
-  }
-
-  // Returns true iff 'key_value.first' (the key) matches the inner matcher.
-  virtual bool Matches(PairType key_value) const {
-    return inner_matcher_.Matches(key_value.first);
-  }
-
-  // Describes what this matcher does.
-  virtual void DescribeTo(::std::ostream* os) const {
-    *os << "has a key that ";
-    inner_matcher_.DescribeTo(os);
-  }
-
-  // Describes what the negation of this matcher does.
-  virtual void DescribeNegationTo(::std::ostream* os) const {
-    *os << "doesn't have a key that ";
-    inner_matcher_.DescribeTo(os);
-  }
-
-  // Explains why 'key_value' matches, or doesn't match, this matcher.
-  virtual void ExplainMatchResultTo(PairType key_value,
-                                    ::std::ostream* os) const {
-    inner_matcher_.ExplainMatchResultTo(key_value.first, os);
-  }
-
- private:
-  const Matcher<const KeyType&> inner_matcher_;
-};
-
-// Implements polymorphic Key(matcher_for_key).
-template <typename M>
-class KeyMatcher {
- public:
-  explicit KeyMatcher(M m) : matcher_for_key_(m) {}
-
-  template <typename PairType>
-  operator Matcher<PairType>() const {
-    return MakeMatcher(new KeyMatcherImpl<PairType>(matcher_for_key_));
-  }
-
- private:
-  const M matcher_for_key_;
-};
-
-// Implements Pair(first_matcher, second_matcher) for the given argument pair
-// type with its two matchers. See Pair() function below.
-template <typename PairType>
-class PairMatcherImpl : public MatcherInterface<PairType> {
- public:
-  typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(PairType)) RawPairType;
-  typedef typename RawPairType::first_type FirstType;
-  typedef typename RawPairType::second_type SecondType;
-
-  template <typename FirstMatcher, typename SecondMatcher>
-  PairMatcherImpl(FirstMatcher first_matcher, SecondMatcher second_matcher)
-      : first_matcher_(
-            testing::SafeMatcherCast<const FirstType&>(first_matcher)),
-        second_matcher_(
-            testing::SafeMatcherCast<const SecondType&>(second_matcher)) {
-  }
-
-  // Returns true iff 'a_pair.first' matches first_matcher and 'a_pair.second'
-  // matches second_matcher.
-  virtual bool Matches(PairType a_pair) const {
-    return first_matcher_.Matches(a_pair.first) &&
-           second_matcher_.Matches(a_pair.second);
-  }
-
-  // Describes what this matcher does.
-  virtual void DescribeTo(::std::ostream* os) const {
-    *os << "has a first field that ";
-    first_matcher_.DescribeTo(os);
-    *os << ", and has a second field that ";
-    second_matcher_.DescribeTo(os);
-  }
-
-  // Describes what the negation of this matcher does.
-  virtual void DescribeNegationTo(::std::ostream* os) const {
-    *os << "has a first field that ";
-    first_matcher_.DescribeNegationTo(os);
-    *os << ", or has a second field that ";
-    second_matcher_.DescribeNegationTo(os);
-  }
-
-  // Explains why 'a_pair' matches, or doesn't match, this matcher.
-  virtual void ExplainMatchResultTo(PairType a_pair,
-                                    ::std::ostream* os) const {
-    ::std::stringstream ss1;
-    first_matcher_.ExplainMatchResultTo(a_pair.first, &ss1);
-    internal::string s1 = ss1.str();
-    if (s1 != "") {
-       s1 = "the first field " + s1;
-    }
-
-    ::std::stringstream ss2;
-    second_matcher_.ExplainMatchResultTo(a_pair.second, &ss2);
-    internal::string s2 = ss2.str();
-    if (s2 != "") {
-       s2 = "the second field " + s2;
-    }
-
-    *os << s1;
-    if (s1 != "" && s2 != "") {
-       *os << ", and ";
-    }
-    *os << s2;
-  }
-
- private:
-  const Matcher<const FirstType&> first_matcher_;
-  const Matcher<const SecondType&> second_matcher_;
-};
-
-// Implements polymorphic Pair(first_matcher, second_matcher).
-template <typename FirstMatcher, typename SecondMatcher>
-class PairMatcher {
- public:
-  PairMatcher(FirstMatcher first_matcher, SecondMatcher second_matcher)
-      : first_matcher_(first_matcher), second_matcher_(second_matcher) {}
-
-  template <typename PairType>
-  operator Matcher<PairType> () const {
-    return MakeMatcher(
-        new PairMatcherImpl<PairType>(
-            first_matcher_, second_matcher_));
-  }
-
- private:
-  const FirstMatcher first_matcher_;
-  const SecondMatcher second_matcher_;
-};
-
-// Implements ElementsAre() and ElementsAreArray().
-template <typename Container>
-class ElementsAreMatcherImpl : public MatcherInterface<Container> {
- public:
-  typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) RawContainer;
-  typedef internal::StlContainerView<RawContainer> View;
-  typedef typename View::type StlContainer;
-  typedef typename View::const_reference StlContainerReference;
-  typedef typename StlContainer::value_type Element;
-
-  // Constructs the matcher from a sequence of element values or
-  // element matchers.
-  template <typename InputIter>
-  ElementsAreMatcherImpl(InputIter first, size_t count) {
-    matchers_.reserve(count);
-    InputIter it = first;
-    for (size_t i = 0; i != count; ++i, ++it) {
-      matchers_.push_back(MatcherCast<const Element&>(*it));
-    }
-  }
-
-  // Returns true iff 'container' matches.
-  virtual bool Matches(Container container) const {
-    StlContainerReference stl_container = View::ConstReference(container);
-    if (stl_container.size() != count())
-      return false;
-
-    typename StlContainer::const_iterator it = stl_container.begin();
-    for (size_t i = 0; i != count();  ++it, ++i) {
-      if (!matchers_[i].Matches(*it))
-        return false;
-    }
-
-    return true;
-  }
-
-  // Describes what this matcher does.
-  virtual void DescribeTo(::std::ostream* os) const {
-    if (count() == 0) {
-      *os << "is empty";
-    } else if (count() == 1) {
-      *os << "has 1 element that ";
-      matchers_[0].DescribeTo(os);
-    } else {
-      *os << "has " << Elements(count()) << " where\n";
-      for (size_t i = 0; i != count(); ++i) {
-        *os << "element " << i << " ";
-        matchers_[i].DescribeTo(os);
-        if (i + 1 < count()) {
-          *os << ",\n";
-        }
-      }
-    }
-  }
-
-  // Describes what the negation of this matcher does.
-  virtual void DescribeNegationTo(::std::ostream* os) const {
-    if (count() == 0) {
-      *os << "is not empty";
-      return;
-    }
-
-    *os << "does not have " << Elements(count()) << ", or\n";
-    for (size_t i = 0; i != count(); ++i) {
-      *os << "element " << i << " ";
-      matchers_[i].DescribeNegationTo(os);
-      if (i + 1 < count()) {
-        *os << ", or\n";
-      }
-    }
-  }
-
-  // Explains why 'container' matches, or doesn't match, this matcher.
-  virtual void ExplainMatchResultTo(Container container,
-                                    ::std::ostream* os) const {
-    StlContainerReference stl_container = View::ConstReference(container);
-    if (Matches(container)) {
-      // We need to explain why *each* element matches (the obvious
-      // ones can be skipped).
-
-      bool reason_printed = false;
-      typename StlContainer::const_iterator it = stl_container.begin();
-      for (size_t i = 0; i != count(); ++it, ++i) {
-        ::std::stringstream ss;
-        matchers_[i].ExplainMatchResultTo(*it, &ss);
-
-        const string s = ss.str();
-        if (!s.empty()) {
-          if (reason_printed) {
-            *os << ",\n";
-          }
-          *os << "element " << i << " " << s;
-          reason_printed = true;
-        }
-      }
-    } else {
-      // We need to explain why the container doesn't match.
-      const size_t actual_count = stl_container.size();
-      if (actual_count != count()) {
-        // The element count doesn't match.  If the container is
-        // empty, there's no need to explain anything as Google Mock
-        // already prints the empty container.  Otherwise we just need
-        // to show how many elements there actually are.
-        if (actual_count != 0) {
-          *os << "has " << Elements(actual_count);
-        }
-        return;
-      }
-
-      // The container has the right size but at least one element
-      // doesn't match expectation.  We need to find this element and
-      // explain why it doesn't match.
-      typename StlContainer::const_iterator it = stl_container.begin();
-      for (size_t i = 0; i != count(); ++it, ++i) {
-        if (matchers_[i].Matches(*it)) {
-          continue;
-        }
-
-        *os << "element " << i << " doesn't match";
-
-        ::std::stringstream ss;
-        matchers_[i].ExplainMatchResultTo(*it, &ss);
-        const string s = ss.str();
-        if (!s.empty()) {
-          *os << " (" << s << ")";
-        }
-        return;
-      }
-    }
-  }
-
- private:
-  static Message Elements(size_t count) {
-    return Message() << count << (count == 1 ? " element" : " elements");
-  }
-
-  size_t count() const { return matchers_.size(); }
-  std::vector<Matcher<const Element&> > matchers_;
-};
-
-// Implements ElementsAre() of 0 arguments.
-class ElementsAreMatcher0 {
- public:
-  ElementsAreMatcher0() {}
-
-  template <typename Container>
-  operator Matcher<Container>() const {
-    typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
-        RawContainer;
-    typedef typename internal::StlContainerView<RawContainer>::type::value_type
-        Element;
-
-    const Matcher<const Element&>* const matchers = NULL;
-    return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 0));
-  }
-};
-
-// Implements ElementsAreArray().
-template <typename T>
-class ElementsAreArrayMatcher {
- public:
-  ElementsAreArrayMatcher(const T* first, size_t count) :
-      first_(first), count_(count) {}
-
-  template <typename Container>
-  operator Matcher<Container>() const {
-    typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
-        RawContainer;
-    typedef typename internal::StlContainerView<RawContainer>::type::value_type
-        Element;
-
-    return MakeMatcher(new ElementsAreMatcherImpl<Container>(first_, count_));
-  }
-
- private:
-  const T* const first_;
-  const size_t count_;
-};
-
-// Constants denoting interpolations in a matcher description string.
-const int kTupleInterpolation = -1;    // "%(*)s"
-const int kPercentInterpolation = -2;  // "%%"
-const int kInvalidInterpolation = -3;  // "%" followed by invalid text
-
-// Records the location and content of an interpolation.
-struct Interpolation {
-  Interpolation(const char* start, const char* end, int param)
-      : start_pos(start), end_pos(end), param_index(param) {}
-
-  // Points to the start of the interpolation (the '%' character).
-  const char* start_pos;
-  // Points to the first character after the interpolation.
-  const char* end_pos;
-  // 0-based index of the interpolated matcher parameter;
-  // kTupleInterpolation for "%(*)s"; kPercentInterpolation for "%%".
-  int param_index;
-};
-
-typedef ::std::vector<Interpolation> Interpolations;
-
-// Parses a matcher description string and returns a vector of
-// interpolations that appear in the string; generates non-fatal
-// failures iff 'description' is an invalid matcher description.
-// 'param_names' is a NULL-terminated array of parameter names in the
-// order they appear in the MATCHER_P*() parameter list.
-Interpolations ValidateMatcherDescription(
-    const char* param_names[], const char* description);
-
-// Returns the actual matcher description, given the matcher name,
-// user-supplied description template string, interpolations in the
-// string, and the printed values of the matcher parameters.
-string FormatMatcherDescription(
-    const char* matcher_name, const char* description,
-    const Interpolations& interp, const Strings& param_values);
-
-}  // namespace internal
-
-// Implements MatcherCast().
-template <typename T, typename M>
-inline Matcher<T> MatcherCast(M matcher) {
-  return internal::MatcherCastImpl<T, M>::Cast(matcher);
-}
-
-// _ is a matcher that matches anything of any type.
-//
-// This definition is fine as:
-//
-//   1. The C++ standard permits using the name _ in a namespace that
-//      is not the global namespace or ::std.
-//   2. The AnythingMatcher class has no data member or constructor,
-//      so it's OK to create global variables of this type.
-//   3. c-style has approved of using _ in this case.
-const internal::AnythingMatcher _ = {};
-// Creates a matcher that matches any value of the given type T.
-template <typename T>
-inline Matcher<T> A() { return MakeMatcher(new internal::AnyMatcherImpl<T>()); }
-
-// Creates a matcher that matches any value of the given type T.
-template <typename T>
-inline Matcher<T> An() { return A<T>(); }
-
-// Creates a polymorphic matcher that matches anything equal to x.
-// Note: if the parameter of Eq() were declared as const T&, Eq("foo")
-// wouldn't compile.
-template <typename T>
-inline internal::EqMatcher<T> Eq(T x) { return internal::EqMatcher<T>(x); }
-
-// Constructs a Matcher<T> from a 'value' of type T.  The constructed
-// matcher matches any value that's equal to 'value'.
-template <typename T>
-Matcher<T>::Matcher(T value) { *this = Eq(value); }
-
-// Creates a monomorphic matcher that matches anything with type Lhs
-// and equal to rhs.  A user may need to use this instead of Eq(...)
-// in order to resolve an overloading ambiguity.
-//
-// TypedEq<T>(x) is just a convenient short-hand for Matcher<T>(Eq(x))
-// or Matcher<T>(x), but more readable than the latter.
-//
-// We could define similar monomorphic matchers for other comparison
-// operations (e.g. TypedLt, TypedGe, and etc), but decided not to do
-// it yet as those are used much less than Eq() in practice.  A user
-// can always write Matcher<T>(Lt(5)) to be explicit about the type,
-// for example.
-template <typename Lhs, typename Rhs>
-inline Matcher<Lhs> TypedEq(const Rhs& rhs) { return Eq(rhs); }
-
-// Creates a polymorphic matcher that matches anything >= x.
-template <typename Rhs>
-inline internal::GeMatcher<Rhs> Ge(Rhs x) {
-  return internal::GeMatcher<Rhs>(x);
-}
-
-// Creates a polymorphic matcher that matches anything > x.
-template <typename Rhs>
-inline internal::GtMatcher<Rhs> Gt(Rhs x) {
-  return internal::GtMatcher<Rhs>(x);
-}
-
-// Creates a polymorphic matcher that matches anything <= x.
-template <typename Rhs>
-inline internal::LeMatcher<Rhs> Le(Rhs x) {
-  return internal::LeMatcher<Rhs>(x);
-}
-
-// Creates a polymorphic matcher that matches anything < x.
-template <typename Rhs>
-inline internal::LtMatcher<Rhs> Lt(Rhs x) {
-  return internal::LtMatcher<Rhs>(x);
-}
-
-// Creates a polymorphic matcher that matches anything != x.
-template <typename Rhs>
-inline internal::NeMatcher<Rhs> Ne(Rhs x) {
-  return internal::NeMatcher<Rhs>(x);
-}
-
-// Creates a polymorphic matcher that matches any NULL pointer.
-inline PolymorphicMatcher<internal::IsNullMatcher > IsNull() {
-  return MakePolymorphicMatcher(internal::IsNullMatcher());
-}
-
-// Creates a polymorphic matcher that matches any non-NULL pointer.
-// This is convenient as Not(NULL) doesn't compile (the compiler
-// thinks that that expression is comparing a pointer with an integer).
-inline PolymorphicMatcher<internal::NotNullMatcher > NotNull() {
-  return MakePolymorphicMatcher(internal::NotNullMatcher());
-}
-
-// Creates a polymorphic matcher that matches any argument that
-// references variable x.
-template <typename T>
-inline internal::RefMatcher<T&> Ref(T& x) {  // NOLINT
-  return internal::RefMatcher<T&>(x);
-}
-
-// Creates a matcher that matches any double argument approximately
-// equal to rhs, where two NANs are considered unequal.
-inline internal::FloatingEqMatcher<double> DoubleEq(double rhs) {
-  return internal::FloatingEqMatcher<double>(rhs, false);
-}
-
-// Creates a matcher that matches any double argument approximately
-// equal to rhs, including NaN values when rhs is NaN.
-inline internal::FloatingEqMatcher<double> NanSensitiveDoubleEq(double rhs) {
-  return internal::FloatingEqMatcher<double>(rhs, true);
-}
-
-// Creates a matcher that matches any float argument approximately
-// equal to rhs, where two NANs are considered unequal.
-inline internal::FloatingEqMatcher<float> FloatEq(float rhs) {
-  return internal::FloatingEqMatcher<float>(rhs, false);
-}
-
-// Creates a matcher that matches any double argument approximately
-// equal to rhs, including NaN values when rhs is NaN.
-inline internal::FloatingEqMatcher<float> NanSensitiveFloatEq(float rhs) {
-  return internal::FloatingEqMatcher<float>(rhs, true);
-}
-
-// Creates a matcher that matches a pointer (raw or smart) that points
-// to a value that matches inner_matcher.
-template <typename InnerMatcher>
-inline internal::PointeeMatcher<InnerMatcher> Pointee(
-    const InnerMatcher& inner_matcher) {
-  return internal::PointeeMatcher<InnerMatcher>(inner_matcher);
-}
-
-// Creates a matcher that matches an object whose given field matches
-// 'matcher'.  For example,
-//   Field(&Foo::number, Ge(5))
-// matches a Foo object x iff x.number >= 5.
-template <typename Class, typename FieldType, typename FieldMatcher>
-inline PolymorphicMatcher<
-  internal::FieldMatcher<Class, FieldType> > Field(
-    FieldType Class::*field, const FieldMatcher& matcher) {
-  return MakePolymorphicMatcher(
-      internal::FieldMatcher<Class, FieldType>(
-          field, MatcherCast<const FieldType&>(matcher)));
-  // The call to MatcherCast() is required for supporting inner
-  // matchers of compatible types.  For example, it allows
-  //   Field(&Foo::bar, m)
-  // to compile where bar is an int32 and m is a matcher for int64.
-}
-
-// Creates a matcher that matches an object whose given property
-// matches 'matcher'.  For example,
-//   Property(&Foo::str, StartsWith("hi"))
-// matches a Foo object x iff x.str() starts with "hi".
-template <typename Class, typename PropertyType, typename PropertyMatcher>
-inline PolymorphicMatcher<
-  internal::PropertyMatcher<Class, PropertyType> > Property(
-    PropertyType (Class::*property)() const, const PropertyMatcher& matcher) {
-  return MakePolymorphicMatcher(
-      internal::PropertyMatcher<Class, PropertyType>(
-          property,
-          MatcherCast<GMOCK_REFERENCE_TO_CONST_(PropertyType)>(matcher)));
-  // The call to MatcherCast() is required for supporting inner
-  // matchers of compatible types.  For example, it allows
-  //   Property(&Foo::bar, m)
-  // to compile where bar() returns an int32 and m is a matcher for int64.
-}
-
-// Creates a matcher that matches an object iff the result of applying
-// a callable to x matches 'matcher'.
-// For example,
-//   ResultOf(f, StartsWith("hi"))
-// matches a Foo object x iff f(x) starts with "hi".
-// callable parameter can be a function, function pointer, or a functor.
-// Callable has to satisfy the following conditions:
-//   * It is required to keep no state affecting the results of
-//     the calls on it and make no assumptions about how many calls
-//     will be made. Any state it keeps must be protected from the
-//     concurrent access.
-//   * If it is a function object, it has to define type result_type.
-//     We recommend deriving your functor classes from std::unary_function.
-template <typename Callable, typename ResultOfMatcher>
-internal::ResultOfMatcher<Callable> ResultOf(
-    Callable callable, const ResultOfMatcher& matcher) {
-  return internal::ResultOfMatcher<Callable>(
-          callable,
-          MatcherCast<typename internal::CallableTraits<Callable>::ResultType>(
-              matcher));
-  // The call to MatcherCast() is required for supporting inner
-  // matchers of compatible types.  For example, it allows
-  //   ResultOf(Function, m)
-  // to compile where Function() returns an int32 and m is a matcher for int64.
-}
-
-// String matchers.
-
-// Matches a string equal to str.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::string> >
-    StrEq(const internal::string& str) {
-  return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::string>(
-      str, true, true));
-}
-
-// Matches a string not equal to str.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::string> >
-    StrNe(const internal::string& str) {
-  return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::string>(
-      str, false, true));
-}
-
-// Matches a string equal to str, ignoring case.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::string> >
-    StrCaseEq(const internal::string& str) {
-  return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::string>(
-      str, true, false));
-}
-
-// Matches a string not equal to str, ignoring case.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::string> >
-    StrCaseNe(const internal::string& str) {
-  return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::string>(
-      str, false, false));
-}
-
-// Creates a matcher that matches any string, std::string, or C string
-// that contains the given substring.
-inline PolymorphicMatcher<internal::HasSubstrMatcher<internal::string> >
-    HasSubstr(const internal::string& substring) {
-  return MakePolymorphicMatcher(internal::HasSubstrMatcher<internal::string>(
-      substring));
-}
-
-// Matches a string that starts with 'prefix' (case-sensitive).
-inline PolymorphicMatcher<internal::StartsWithMatcher<internal::string> >
-    StartsWith(const internal::string& prefix) {
-  return MakePolymorphicMatcher(internal::StartsWithMatcher<internal::string>(
-      prefix));
-}
-
-// Matches a string that ends with 'suffix' (case-sensitive).
-inline PolymorphicMatcher<internal::EndsWithMatcher<internal::string> >
-    EndsWith(const internal::string& suffix) {
-  return MakePolymorphicMatcher(internal::EndsWithMatcher<internal::string>(
-      suffix));
-}
-
-#ifdef GMOCK_HAS_REGEX
-
-// Matches a string that fully matches regular expression 'regex'.
-// The matcher takes ownership of 'regex'.
-inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
-    const internal::RE* regex) {
-  return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, true));
-}
-inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
-    const internal::string& regex) {
-  return MatchesRegex(new internal::RE(regex));
-}
-
-// Matches a string that contains regular expression 'regex'.
-// The matcher takes ownership of 'regex'.
-inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
-    const internal::RE* regex) {
-  return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, false));
-}
-inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
-    const internal::string& regex) {
-  return ContainsRegex(new internal::RE(regex));
-}
-
-#endif  // GMOCK_HAS_REGEX
-
-#if GTEST_HAS_GLOBAL_WSTRING || GTEST_HAS_STD_WSTRING
-// Wide string matchers.
-
-// Matches a string equal to str.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::wstring> >
-    StrEq(const internal::wstring& str) {
-  return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::wstring>(
-      str, true, true));
-}
-
-// Matches a string not equal to str.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::wstring> >
-    StrNe(const internal::wstring& str) {
-  return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::wstring>(
-      str, false, true));
-}
-
-// Matches a string equal to str, ignoring case.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::wstring> >
-    StrCaseEq(const internal::wstring& str) {
-  return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::wstring>(
-      str, true, false));
-}
-
-// Matches a string not equal to str, ignoring case.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::wstring> >
-    StrCaseNe(const internal::wstring& str) {
-  return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::wstring>(
-      str, false, false));
-}
-
-// Creates a matcher that matches any wstring, std::wstring, or C wide string
-// that contains the given substring.
-inline PolymorphicMatcher<internal::HasSubstrMatcher<internal::wstring> >
-    HasSubstr(const internal::wstring& substring) {
-  return MakePolymorphicMatcher(internal::HasSubstrMatcher<internal::wstring>(
-      substring));
-}
-
-// Matches a string that starts with 'prefix' (case-sensitive).
-inline PolymorphicMatcher<internal::StartsWithMatcher<internal::wstring> >
-    StartsWith(const internal::wstring& prefix) {
-  return MakePolymorphicMatcher(internal::StartsWithMatcher<internal::wstring>(
-      prefix));
-}
-
-// Matches a string that ends with 'suffix' (case-sensitive).
-inline PolymorphicMatcher<internal::EndsWithMatcher<internal::wstring> >
-    EndsWith(const internal::wstring& suffix) {
-  return MakePolymorphicMatcher(internal::EndsWithMatcher<internal::wstring>(
-      suffix));
-}
-
-#endif  // GTEST_HAS_GLOBAL_WSTRING || GTEST_HAS_STD_WSTRING
-
-// Creates a polymorphic matcher that matches a 2-tuple where the
-// first field == the second field.
-inline internal::Eq2Matcher Eq() { return internal::Eq2Matcher(); }
-
-// Creates a polymorphic matcher that matches a 2-tuple where the
-// first field >= the second field.
-inline internal::Ge2Matcher Ge() { return internal::Ge2Matcher(); }
-
-// Creates a polymorphic matcher that matches a 2-tuple where the
-// first field > the second field.
-inline internal::Gt2Matcher Gt() { return internal::Gt2Matcher(); }
-
-// Creates a polymorphic matcher that matches a 2-tuple where the
-// first field <= the second field.
-inline internal::Le2Matcher Le() { return internal::Le2Matcher(); }
-
-// Creates a polymorphic matcher that matches a 2-tuple where the
-// first field < the second field.
-inline internal::Lt2Matcher Lt() { return internal::Lt2Matcher(); }
-
-// Creates a polymorphic matcher that matches a 2-tuple where the
-// first field != the second field.
-inline internal::Ne2Matcher Ne() { return internal::Ne2Matcher(); }
-
-// Creates a matcher that matches any value of type T that m doesn't
-// match.
-template <typename InnerMatcher>
-inline internal::NotMatcher<InnerMatcher> Not(InnerMatcher m) {
-  return internal::NotMatcher<InnerMatcher>(m);
-}
-
-// Creates a matcher that matches any value that matches all of the
-// given matchers.
-//
-// For now we only support up to 5 matchers.  Support for more
-// matchers can be added as needed, or the user can use nested
-// AllOf()s.
-template <typename Matcher1, typename Matcher2>
-inline internal::BothOfMatcher<Matcher1, Matcher2>
-AllOf(Matcher1 m1, Matcher2 m2) {
-  return internal::BothOfMatcher<Matcher1, Matcher2>(m1, m2);
-}
-
-template <typename Matcher1, typename Matcher2, typename Matcher3>
-inline internal::BothOfMatcher<Matcher1,
-           internal::BothOfMatcher<Matcher2, Matcher3> >
-AllOf(Matcher1 m1, Matcher2 m2, Matcher3 m3) {
-  return AllOf(m1, AllOf(m2, m3));
-}
-
-template <typename Matcher1, typename Matcher2, typename Matcher3,
-          typename Matcher4>
-inline internal::BothOfMatcher<Matcher1,
-           internal::BothOfMatcher<Matcher2,
-               internal::BothOfMatcher<Matcher3, Matcher4> > >
-AllOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4) {
-  return AllOf(m1, AllOf(m2, m3, m4));
-}
-
-template <typename Matcher1, typename Matcher2, typename Matcher3,
-          typename Matcher4, typename Matcher5>
-inline internal::BothOfMatcher<Matcher1,
-           internal::BothOfMatcher<Matcher2,
-               internal::BothOfMatcher<Matcher3,
-                   internal::BothOfMatcher<Matcher4, Matcher5> > > >
-AllOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5) {
-  return AllOf(m1, AllOf(m2, m3, m4, m5));
-}
-
-// Creates a matcher that matches any value that matches at least one
-// of the given matchers.
-//
-// For now we only support up to 5 matchers.  Support for more
-// matchers can be added as needed, or the user can use nested
-// AnyOf()s.
-template <typename Matcher1, typename Matcher2>
-inline internal::EitherOfMatcher<Matcher1, Matcher2>
-AnyOf(Matcher1 m1, Matcher2 m2) {
-  return internal::EitherOfMatcher<Matcher1, Matcher2>(m1, m2);
-}
-
-template <typename Matcher1, typename Matcher2, typename Matcher3>
-inline internal::EitherOfMatcher<Matcher1,
-           internal::EitherOfMatcher<Matcher2, Matcher3> >
-AnyOf(Matcher1 m1, Matcher2 m2, Matcher3 m3) {
-  return AnyOf(m1, AnyOf(m2, m3));
-}
-
-template <typename Matcher1, typename Matcher2, typename Matcher3,
-          typename Matcher4>
-inline internal::EitherOfMatcher<Matcher1,
-           internal::EitherOfMatcher<Matcher2,
-               internal::EitherOfMatcher<Matcher3, Matcher4> > >
-AnyOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4) {
-  return AnyOf(m1, AnyOf(m2, m3, m4));
-}
-
-template <typename Matcher1, typename Matcher2, typename Matcher3,
-          typename Matcher4, typename Matcher5>
-inline internal::EitherOfMatcher<Matcher1,
-           internal::EitherOfMatcher<Matcher2,
-               internal::EitherOfMatcher<Matcher3,
-                   internal::EitherOfMatcher<Matcher4, Matcher5> > > >
-AnyOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5) {
-  return AnyOf(m1, AnyOf(m2, m3, m4, m5));
-}
-
-// Returns a matcher that matches anything that satisfies the given
-// predicate.  The predicate can be any unary function or functor
-// whose return type can be implicitly converted to bool.
-template <typename Predicate>
-inline PolymorphicMatcher<internal::TrulyMatcher<Predicate> >
-Truly(Predicate pred) {
-  return MakePolymorphicMatcher(internal::TrulyMatcher<Predicate>(pred));
-}
-
-// Returns a matcher that matches an equal container.
-// This matcher behaves like Eq(), but in the event of mismatch lists the
-// values that are included in one container but not the other. (Duplicate
-// values and order differences are not explained.)
-template <typename Container>
-inline PolymorphicMatcher<internal::ContainerEqMatcher<
-                            GMOCK_REMOVE_CONST_(Container)> >
-    ContainerEq(const Container& rhs) {
-  // This following line is for working around a bug in MSVC 8.0,
-  // which causes Container to be a const type sometimes.
-  typedef GMOCK_REMOVE_CONST_(Container) RawContainer;
-  return MakePolymorphicMatcher(internal::ContainerEqMatcher<RawContainer>(rhs));
-}
-
-// Matches an STL-style container or a native array that contains at
-// least one element matching the given value or matcher.
-//
-// Examples:
-//   ::std::set<int> page_ids;
-//   page_ids.insert(3);
-//   page_ids.insert(1);
-//   EXPECT_THAT(page_ids, Contains(1));
-//   EXPECT_THAT(page_ids, Contains(Gt(2)));
-//   EXPECT_THAT(page_ids, Not(Contains(4)));
-//
-//   ::std::map<int, size_t> page_lengths;
-//   page_lengths[1] = 100;
-//   EXPECT_THAT(page_lengths,
-//               Contains(::std::pair<const int, size_t>(1, 100)));
-//
-//   const char* user_ids[] = { "joe", "mike", "tom" };
-//   EXPECT_THAT(user_ids, Contains(Eq(::std::string("tom"))));
-template <typename M>
-inline internal::ContainsMatcher<M> Contains(M matcher) {
-  return internal::ContainsMatcher<M>(matcher);
-}
-
-// Key(inner_matcher) matches an std::pair whose 'first' field matches
-// inner_matcher.  For example, Contains(Key(Ge(5))) can be used to match an
-// std::map that contains at least one element whose key is >= 5.
-template <typename M>
-inline internal::KeyMatcher<M> Key(M inner_matcher) {
-  return internal::KeyMatcher<M>(inner_matcher);
-}
-
-// Pair(first_matcher, second_matcher) matches a std::pair whose 'first' field
-// matches first_matcher and whose 'second' field matches second_matcher.  For
-// example, EXPECT_THAT(map_type, ElementsAre(Pair(Ge(5), "foo"))) can be used
-// to match a std::map<int, string> that contains exactly one element whose key
-// is >= 5 and whose value equals "foo".
-template <typename FirstMatcher, typename SecondMatcher>
-inline internal::PairMatcher<FirstMatcher, SecondMatcher>
-Pair(FirstMatcher first_matcher, SecondMatcher second_matcher) {
-  return internal::PairMatcher<FirstMatcher, SecondMatcher>(
-      first_matcher, second_matcher);
-}
-
-// Returns a predicate that is satisfied by anything that matches the
-// given matcher.
-template <typename M>
-inline internal::MatcherAsPredicate<M> Matches(M matcher) {
-  return internal::MatcherAsPredicate<M>(matcher);
-}
-
-// Returns true iff the value matches the matcher.
-template <typename T, typename M>
-inline bool Value(const T& value, M matcher) {
-  return testing::Matches(matcher)(value);
-}
-
-// AllArgs(m) is a synonym of m.  This is useful in
-//
-//   EXPECT_CALL(foo, Bar(_, _)).With(AllArgs(Eq()));
-//
-// which is easier to read than
-//
-//   EXPECT_CALL(foo, Bar(_, _)).With(Eq());
-template <typename InnerMatcher>
-inline InnerMatcher AllArgs(const InnerMatcher& matcher) { return matcher; }
-
-// These macros allow using matchers to check values in Google Test
-// tests.  ASSERT_THAT(value, matcher) and EXPECT_THAT(value, matcher)
-// succeed iff the value matches the matcher.  If the assertion fails,
-// the value and the description of the matcher will be printed.
-#define ASSERT_THAT(value, matcher) ASSERT_PRED_FORMAT1(\
-    ::testing::internal::MakePredicateFormatterFromMatcher(matcher), value)
-#define EXPECT_THAT(value, matcher) EXPECT_PRED_FORMAT1(\
-    ::testing::internal::MakePredicateFormatterFromMatcher(matcher), value)
-
-}  // namespace testing
-
-#endif  // GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_
diff --git a/third_party/gmock/include/gmock/gmock-more-actions.h b/third_party/gmock/include/gmock/gmock-more-actions.h
deleted file mode 100644
index c6fa6bb..0000000
--- a/third_party/gmock/include/gmock/gmock-more-actions.h
+++ /dev/null
@@ -1,190 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements some actions that depend on gmock-generated-actions.h.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
-
-#include <gmock/gmock-generated-actions.h>
-
-namespace testing {
-namespace internal {
-
-// Implements the Invoke(f) action.  The template argument
-// FunctionImpl is the implementation type of f, which can be either a
-// function pointer or a functor.  Invoke(f) can be used as an
-// Action<F> as long as f's type is compatible with F (i.e. f can be
-// assigned to a tr1::function<F>).
-template <typename FunctionImpl>
-class InvokeAction {
- public:
-  // The c'tor makes a copy of function_impl (either a function
-  // pointer or a functor).
-  explicit InvokeAction(FunctionImpl function_impl)
-      : function_impl_(function_impl) {}
-
-  template <typename Result, typename ArgumentTuple>
-  Result Perform(const ArgumentTuple& args) {
-    return InvokeHelper<Result, ArgumentTuple>::Invoke(function_impl_, args);
-  }
- private:
-  FunctionImpl function_impl_;
-};
-
-// Implements the Invoke(object_ptr, &Class::Method) action.
-template <class Class, typename MethodPtr>
-class InvokeMethodAction {
- public:
-  InvokeMethodAction(Class* obj_ptr, MethodPtr method_ptr)
-      : obj_ptr_(obj_ptr), method_ptr_(method_ptr) {}
-
-  template <typename Result, typename ArgumentTuple>
-  Result Perform(const ArgumentTuple& args) const {
-    return InvokeHelper<Result, ArgumentTuple>::InvokeMethod(
-        obj_ptr_, method_ptr_, args);
-  }
- private:
-  Class* const obj_ptr_;
-  const MethodPtr method_ptr_;
-};
-
-}  // namespace internal
-
-// Various overloads for Invoke().
-
-// Creates an action that invokes 'function_impl' with the mock
-// function's arguments.
-template <typename FunctionImpl>
-PolymorphicAction<internal::InvokeAction<FunctionImpl> > Invoke(
-    FunctionImpl function_impl) {
-  return MakePolymorphicAction(
-      internal::InvokeAction<FunctionImpl>(function_impl));
-}
-
-// Creates an action that invokes the given method on the given object
-// with the mock function's arguments.
-template <class Class, typename MethodPtr>
-PolymorphicAction<internal::InvokeMethodAction<Class, MethodPtr> > Invoke(
-    Class* obj_ptr, MethodPtr method_ptr) {
-  return MakePolymorphicAction(
-      internal::InvokeMethodAction<Class, MethodPtr>(obj_ptr, method_ptr));
-}
-
-// WithoutArgs(inner_action) can be used in a mock function with a
-// non-empty argument list to perform inner_action, which takes no
-// argument.  In other words, it adapts an action accepting no
-// argument to one that accepts (and ignores) arguments.
-template <typename InnerAction>
-inline internal::WithArgsAction<InnerAction>
-WithoutArgs(const InnerAction& action) {
-  return internal::WithArgsAction<InnerAction>(action);
-}
-
-// WithArg<k>(an_action) creates an action that passes the k-th
-// (0-based) argument of the mock function to an_action and performs
-// it.  It adapts an action accepting one argument to one that accepts
-// multiple arguments.  For convenience, we also provide
-// WithArgs<k>(an_action) (defined below) as a synonym.
-template <int k, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k>
-WithArg(const InnerAction& action) {
-  return internal::WithArgsAction<InnerAction, k>(action);
-}
-
-// Action ReturnArg<k>() returns the k-th argument of the mock function.
-ACTION_TEMPLATE(ReturnArg,
-                HAS_1_TEMPLATE_PARAMS(int, k),
-                AND_0_VALUE_PARAMS()) {
-  return std::tr1::get<k>(args);
-}
-
-// Action SaveArg<k>(pointer) saves the k-th (0-based) argument of the
-// mock function to *pointer.
-ACTION_TEMPLATE(SaveArg,
-                HAS_1_TEMPLATE_PARAMS(int, k),
-                AND_1_VALUE_PARAMS(pointer)) {
-  *pointer = ::std::tr1::get<k>(args);
-}
-
-// Action SetArgReferee<k>(value) assigns 'value' to the variable
-// referenced by the k-th (0-based) argument of the mock function.
-ACTION_TEMPLATE(SetArgReferee,
-                HAS_1_TEMPLATE_PARAMS(int, k),
-                AND_1_VALUE_PARAMS(value)) {
-  typedef typename ::std::tr1::tuple_element<k, args_type>::type argk_type;
-  // Ensures that argument #k is a reference.  If you get a compiler
-  // error on the next line, you are using SetArgReferee<k>(value) in
-  // a mock function whose k-th (0-based) argument is not a reference.
-  GMOCK_COMPILE_ASSERT_(internal::is_reference<argk_type>::value,
-                        SetArgReferee_must_be_used_with_a_reference_argument);
-  ::std::tr1::get<k>(args) = value;
-}
-
-// Action SetArrayArgument<k>(first, last) copies the elements in
-// source range [first, last) to the array pointed to by the k-th
-// (0-based) argument, which can be either a pointer or an
-// iterator. The action does not take ownership of the elements in the
-// source range.
-ACTION_TEMPLATE(SetArrayArgument,
-                HAS_1_TEMPLATE_PARAMS(int, k),
-                AND_2_VALUE_PARAMS(first, last)) {
-  // Microsoft compiler deprecates ::std::copy, so we want to suppress warning
-  // 4996 (Function call with parameters that may be unsafe) there.
-#ifdef _MSC_VER
-#pragma warning(push)          // Saves the current warning state.
-#pragma warning(disable:4996)  // Temporarily disables warning 4996.
-#endif
-  ::std::copy(first, last, ::std::tr1::get<k>(args));
-#ifdef _MSC_VER
-#pragma warning(pop)           // Restores the warning state.
-#endif
-}
-
-// Action DeleteArg<k>() deletes the k-th (0-based) argument of the mock
-// function.
-ACTION_TEMPLATE(DeleteArg,
-                HAS_1_TEMPLATE_PARAMS(int, k),
-                AND_0_VALUE_PARAMS()) {
-  delete ::std::tr1::get<k>(args);
-}
-
-// Action Throw(exception) can be used in a mock function of any type
-// to throw the given exception.  Any copyable value can be thrown.
-#if GTEST_HAS_EXCEPTIONS
-ACTION_P(Throw, exception) { throw exception; }
-#endif  // GTEST_HAS_EXCEPTIONS
-
-}  // namespace testing
-
-#endif  // GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
diff --git a/third_party/gmock/include/gmock/gmock-printers.h b/third_party/gmock/include/gmock/gmock-printers.h
deleted file mode 100644
index 9f024d0..0000000
--- a/third_party/gmock/include/gmock/gmock-printers.h
+++ /dev/null
@@ -1,747 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements a universal value printer that can print a
-// value of any type T:
-//
-//   void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);
-//
-// A user can teach this function how to print a class type T by
-// defining either operator<<() or PrintTo() in the namespace that
-// defines T.  More specifically, the FIRST defined function in the
-// following list will be used (assuming T is defined in namespace
-// foo):
-//
-//   1. foo::PrintTo(const T&, ostream*)
-//   2. operator<<(ostream&, const T&) defined in either foo or the
-//      global namespace.
-//
-// If none of the above is defined, it will print the debug string of
-// the value if it is a protocol buffer, or print the raw bytes in the
-// value otherwise.
-//
-// To aid debugging: when T is a reference type, the address of the
-// value is also printed; when T is a (const) char pointer, both the
-// pointer value and the NUL-terminated string it points to are
-// printed.
-//
-// We also provide some convenient wrappers:
-//
-//   // Prints a value as the given type to a string.
-//   string ::testing::internal::UniversalPrinter<T>::PrintToString(value);
-//
-//   // Prints a value tersely: for a reference type, the referenced
-//   // value (but not the address) is printed; for a (const) char
-//   // pointer, the NUL-terminated string (but not the pointer) is
-//   // printed.
-//   void ::testing::internal::UniversalTersePrint(const T& value, ostream*);
-//
-//   // Prints value using the type inferred by the compiler.  The difference
-//   // from UniversalTersePrint() is that this function prints both the
-//   // pointer and the NUL-terminated string for a (const) char pointer.
-//   void ::testing::internal::UniversalPrint(const T& value, ostream*);
-//
-//   // Prints the fields of a tuple tersely to a string vector, one
-//   // element for each field.
-//   std::vector<string> UniversalTersePrintTupleFieldsToStrings(
-//       const Tuple& value);
-//
-// Known limitation:
-//
-// The print primitives print the elements of an STL-style container
-// using the compiler-inferred type of *iter where iter is a
-// const_iterator of the container.  When const_iterator is an input
-// iterator but not a forward iterator, this inferred type may not
-// match value_type, and the print output may be incorrect.  In
-// practice, this is rarely a problem as for most containers
-// const_iterator is a forward iterator.  We'll fix this if there's an
-// actual need for it.  Note that this fix cannot rely on value_type
-// being defined as many user-defined container types don't have
-// value_type.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_PRINTERS_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_PRINTERS_H_
-
-#include <ostream>  // NOLINT
-#include <sstream>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include <gmock/internal/gmock-internal-utils.h>
-#include <gmock/internal/gmock-port.h>
-#include <gtest/gtest.h>
-
-namespace testing {
-
-// Definitions in the 'internal' and 'internal2' name spaces are
-// subject to change without notice.  DO NOT USE THEM IN USER CODE!
-namespace internal2 {
-
-// Prints the given number of bytes in the given object to the given
-// ostream.
-void PrintBytesInObjectTo(const unsigned char* obj_bytes,
-                          size_t count,
-                          ::std::ostream* os);
-
-// TypeWithoutFormatter<T, kIsProto>::PrintValue(value, os) is called
-// by the universal printer to print a value of type T when neither
-// operator<< nor PrintTo() is defined for type T.  When T is
-// ProtocolMessage, proto2::Message, or a subclass of those, kIsProto
-// will be true and the short debug string of the protocol message
-// value will be printed; otherwise kIsProto will be false and the
-// bytes in the value will be printed.
-template <typename T, bool kIsProto>
-class TypeWithoutFormatter {
- public:
-  static void PrintValue(const T& value, ::std::ostream* os) {
-    PrintBytesInObjectTo(reinterpret_cast<const unsigned char*>(&value),
-                         sizeof(value), os);
-  }
-};
-
-// We print a protobuf using its ShortDebugString() when the string
-// doesn't exceed this many characters; otherwise we print it using
-// DebugString() for better readability.
-const size_t kProtobufOneLinerMaxLength = 50;
-
-template <typename T>
-class TypeWithoutFormatter<T, true> {
- public:
-  static void PrintValue(const T& value, ::std::ostream* os) {
-    const ::testing::internal::string short_str = value.ShortDebugString();
-    const ::testing::internal::string pretty_str =
-        short_str.length() <= kProtobufOneLinerMaxLength ?
-        short_str : ("\n" + value.DebugString());
-    ::std::operator<<(*os, "<" + pretty_str + ">");
-  }
-};
-
-// Prints the given value to the given ostream.  If the value is a
-// protocol message, its short debug string is printed; otherwise the
-// bytes in the value are printed.  This is what
-// UniversalPrinter<T>::Print() does when it knows nothing about type
-// T and T has no << operator.
-//
-// A user can override this behavior for a class type Foo by defining
-// a << operator in the namespace where Foo is defined.
-//
-// We put this operator in namespace 'internal2' instead of 'internal'
-// to simplify the implementation, as much code in 'internal' needs to
-// use << in STL, which would conflict with our own << were it defined
-// in 'internal'.
-//
-// Note that this operator<< takes a generic std::basic_ostream<Char,
-// CharTraits> type instead of the more restricted std::ostream.  If
-// we define it to take an std::ostream instead, we'll get an
-// "ambiguous overloads" compiler error when trying to print a type
-// Foo that supports streaming to std::basic_ostream<Char,
-// CharTraits>, as the compiler cannot tell whether
-// operator<<(std::ostream&, const T&) or
-// operator<<(std::basic_stream<Char, CharTraits>, const Foo&) is more
-// specific.
-template <typename Char, typename CharTraits, typename T>
-::std::basic_ostream<Char, CharTraits>& operator<<(
-    ::std::basic_ostream<Char, CharTraits>& os, const T& x) {
-  TypeWithoutFormatter<T, ::testing::internal::IsAProtocolMessage<T>::value>::
-      PrintValue(x, &os);
-  return os;
-}
-
-}  // namespace internal2
-}  // namespace testing
-
-// This namespace MUST NOT BE NESTED IN ::testing, or the name look-up
-// magic needed for implementing UniversalPrinter won't work.
-namespace testing_internal {
-
-// Used to print a value that is not an STL-style container when the
-// user doesn't define PrintTo() for it.
-template <typename T>
-void DefaultPrintNonContainerTo(const T& value, ::std::ostream* os) {
-  // With the following statement, during unqualified name lookup,
-  // testing::internal2::operator<< appears as if it was declared in
-  // the nearest enclosing namespace that contains both
-  // ::testing_internal and ::testing::internal2, i.e. the global
-  // namespace.  For more details, refer to the C++ Standard section
-  // 7.3.4-1 [namespace.udir].  This allows us to fall back onto
-  // testing::internal2::operator<< in case T doesn't come with a <<
-  // operator.
-  //
-  // We cannot write 'using ::testing::internal2::operator<<;', which
-  // gcc 3.3 fails to compile due to a compiler bug.
-  using namespace ::testing::internal2;  // NOLINT
-
-  // Assuming T is defined in namespace foo, in the next statement,
-  // the compiler will consider all of:
-  //
-  //   1. foo::operator<< (thanks to Koenig look-up),
-  //   2. ::operator<< (as the current namespace is enclosed in ::),
-  //   3. testing::internal2::operator<< (thanks to the using statement above).
-  //
-  // The operator<< whose type matches T best will be picked.
-  //
-  // We deliberately allow #2 to be a candidate, as sometimes it's
-  // impossible to define #1 (e.g. when foo is ::std, defining
-  // anything in it is undefined behavior unless you are a compiler
-  // vendor.).
-  *os << value;
-}
-
-}  // namespace testing_internal
-
-namespace testing {
-namespace internal {
-
-// UniversalPrinter<T>::Print(value, ostream_ptr) prints the given
-// value to the given ostream.  The caller must ensure that
-// 'ostream_ptr' is not NULL, or the behavior is undefined.
-//
-// We define UniversalPrinter as a class template (as opposed to a
-// function template), as we need to partially specialize it for
-// reference types, which cannot be done with function templates.
-template <typename T>
-class UniversalPrinter;
-
-template <typename T>
-void UniversalPrint(const T& value, ::std::ostream* os);
-
-// Used to print an STL-style container when the user doesn't define
-// a PrintTo() for it.
-template <typename C>
-void DefaultPrintTo(IsContainer /* dummy */,
-                    false_type /* is not a pointer */,
-                    const C& container, ::std::ostream* os) {
-  const size_t kMaxCount = 32;  // The maximum number of elements to print.
-  *os << '{';
-  size_t count = 0;
-  for (typename C::const_iterator it = container.begin();
-       it != container.end(); ++it, ++count) {
-    if (count > 0) {
-      *os << ',';
-      if (count == kMaxCount) {  // Enough has been printed.
-        *os << " ...";
-        break;
-      }
-    }
-    *os << ' ';
-    // We cannot call PrintTo(*it, os) here as PrintTo() doesn't
-    // handle *it being a native array.
-    internal::UniversalPrint(*it, os);
-  }
-
-  if (count > 0) {
-    *os << ' ';
-  }
-  *os << '}';
-}
-
-// Used to print a pointer that is neither a char pointer nor a member
-// pointer, when the user doesn't define PrintTo() for it.  (A member
-// variable pointer or member function pointer doesn't really point to
-// a location in the address space.  Their representation is
-// implementation-defined.  Therefore they will be printed as raw
-// bytes.)
-template <typename T>
-void DefaultPrintTo(IsNotContainer /* dummy */,
-                    true_type /* is a pointer */,
-                    T* p, ::std::ostream* os) {
-  if (p == NULL) {
-    *os << "NULL";
-  } else {
-    // We want to print p as a const void*.  However, we cannot cast
-    // it to const void* directly, even using reinterpret_cast, as
-    // earlier versions of gcc (e.g. 3.4.5) cannot compile the cast
-    // when p is a function pointer.  Casting to UInt64 first solves
-    // the problem.
-    *os << reinterpret_cast<const void*>(reinterpret_cast<internal::UInt64>(p));
-  }
-}
-
-// Used to print a non-container, non-pointer value when the user
-// doesn't define PrintTo() for it.
-template <typename T>
-void DefaultPrintTo(IsNotContainer /* dummy */,
-                    false_type /* is not a pointer */,
-                    const T& value, ::std::ostream* os) {
-  ::testing_internal::DefaultPrintNonContainerTo(value, os);
-}
-
-// Prints the given value using the << operator if it has one;
-// otherwise prints the bytes in it.  This is what
-// UniversalPrinter<T>::Print() does when PrintTo() is not specialized
-// or overloaded for type T.
-//
-// A user can override this behavior for a class type Foo by defining
-// an overload of PrintTo() in the namespace where Foo is defined.  We
-// give the user this option as sometimes defining a << operator for
-// Foo is not desirable (e.g. the coding style may prevent doing it,
-// or there is already a << operator but it doesn't do what the user
-// wants).
-template <typename T>
-void PrintTo(const T& value, ::std::ostream* os) {
-  // DefaultPrintTo() is overloaded.  The type of its first two
-  // arguments determine which version will be picked.  If T is an
-  // STL-style container, the version for container will be called; if
-  // T is a pointer, the pointer version will be called; otherwise the
-  // generic version will be called.
-  //
-  // Note that we check for container types here, prior to we check
-  // for protocol message types in our operator<<.  The rationale is:
-  //
-  // For protocol messages, we want to give people a chance to
-  // override Google Mock's format by defining a PrintTo() or
-  // operator<<.  For STL containers, other formats can be
-  // incompatible with Google Mock's format for the container
-  // elements; therefore we check for container types here to ensure
-  // that our format is used.
-  //
-  // The second argument of DefaultPrintTo() is needed to bypass a bug
-  // in Symbian's C++ compiler that prevents it from picking the right
-  // overload between:
-  //
-  //   PrintTo(const T& x, ...);
-  //   PrintTo(T* x, ...);
-  DefaultPrintTo(IsContainerTest<T>(0), is_pointer<T>(), value, os);
-}
-
-// The following list of PrintTo() overloads tells
-// UniversalPrinter<T>::Print() how to print standard types (built-in
-// types, strings, plain arrays, and pointers).
-
-// Overloads for various char types.
-void PrintCharTo(char c, int char_code, ::std::ostream* os);
-inline void PrintTo(unsigned char c, ::std::ostream* os) {
-  PrintCharTo(c, c, os);
-}
-inline void PrintTo(signed char c, ::std::ostream* os) {
-  PrintCharTo(c, c, os);
-}
-inline void PrintTo(char c, ::std::ostream* os) {
-  // When printing a plain char, we always treat it as unsigned.  This
-  // way, the output won't be affected by whether the compiler thinks
-  // char is signed or not.
-  PrintTo(static_cast<unsigned char>(c), os);
-}
-
-// Overloads for other simple built-in types.
-inline void PrintTo(bool x, ::std::ostream* os) {
-  *os << (x ? "true" : "false");
-}
-
-// Overload for wchar_t type.
-// Prints a wchar_t as a symbol if it is printable or as its internal
-// code otherwise and also as its decimal code (except for L'\0').
-// The L'\0' char is printed as "L'\\0'". The decimal code is printed
-// as signed integer when wchar_t is implemented by the compiler
-// as a signed type and is printed as an unsigned integer when wchar_t
-// is implemented as an unsigned type.
-void PrintTo(wchar_t wc, ::std::ostream* os);
-
-// Overloads for C strings.
-void PrintTo(const char* s, ::std::ostream* os);
-inline void PrintTo(char* s, ::std::ostream* os) {
-  PrintTo(implicit_cast<const char*>(s), os);
-}
-
-// MSVC can be configured to define wchar_t as a typedef of unsigned
-// short.  It defines _NATIVE_WCHAR_T_DEFINED when wchar_t is a native
-// type.  When wchar_t is a typedef, defining an overload for const
-// wchar_t* would cause unsigned short* be printed as a wide string,
-// possibly causing invalid memory accesses.
-#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
-// Overloads for wide C strings
-void PrintTo(const wchar_t* s, ::std::ostream* os);
-inline void PrintTo(wchar_t* s, ::std::ostream* os) {
-  PrintTo(implicit_cast<const wchar_t*>(s), os);
-}
-#endif
-
-// Overload for C arrays.  Multi-dimensional arrays are printed
-// properly.
-
-// Prints the given number of elements in an array, without printing
-// the curly braces.
-template <typename T>
-void PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) {
-  UniversalPrinter<T>::Print(a[0], os);
-  for (size_t i = 1; i != count; i++) {
-    *os << ", ";
-    UniversalPrinter<T>::Print(a[i], os);
-  }
-}
-
-// Overloads for ::string and ::std::string.
-#if GTEST_HAS_GLOBAL_STRING
-void PrintStringTo(const ::string&s, ::std::ostream* os);
-inline void PrintTo(const ::string& s, ::std::ostream* os) {
-  PrintStringTo(s, os);
-}
-#endif  // GTEST_HAS_GLOBAL_STRING
-
-#if GTEST_HAS_STD_STRING
-void PrintStringTo(const ::std::string&s, ::std::ostream* os);
-inline void PrintTo(const ::std::string& s, ::std::ostream* os) {
-  PrintStringTo(s, os);
-}
-#endif  // GTEST_HAS_STD_STRING
-
-// Overloads for ::wstring and ::std::wstring.
-#if GTEST_HAS_GLOBAL_WSTRING
-void PrintWideStringTo(const ::wstring&s, ::std::ostream* os);
-inline void PrintTo(const ::wstring& s, ::std::ostream* os) {
-  PrintWideStringTo(s, os);
-}
-#endif  // GTEST_HAS_GLOBAL_WSTRING
-
-#if GTEST_HAS_STD_WSTRING
-void PrintWideStringTo(const ::std::wstring&s, ::std::ostream* os);
-inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) {
-  PrintWideStringTo(s, os);
-}
-#endif  // GTEST_HAS_STD_WSTRING
-
-// Overload for ::std::tr1::tuple.  Needed for printing function
-// arguments, which are packed as tuples.
-
-// Helper function for printing a tuple.  T must be instantiated with
-// a tuple type.
-template <typename T>
-void PrintTupleTo(const T& t, ::std::ostream* os);
-
-// Overloaded PrintTo() for tuples of various arities.  We support
-// tuples of up-to 10 fields.  The following implementation works
-// regardless of whether tr1::tuple is implemented using the
-// non-standard variadic template feature or not.
-
-inline void PrintTo(const ::std::tr1::tuple<>& t, ::std::ostream* os) {
-  PrintTupleTo(t, os);
-}
-
-template <typename T1>
-void PrintTo(const ::std::tr1::tuple<T1>& t, ::std::ostream* os) {
-  PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2>
-void PrintTo(const ::std::tr1::tuple<T1, T2>& t, ::std::ostream* os) {
-  PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3>& t, ::std::ostream* os) {
-  PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4>& t, ::std::ostream* os) {
-  PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5>& t,
-             ::std::ostream* os) {
-  PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-          typename T6>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6>& t,
-             ::std::ostream* os) {
-  PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-          typename T6, typename T7>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7>& t,
-             ::std::ostream* os) {
-  PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-          typename T6, typename T7, typename T8>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8>& t,
-             ::std::ostream* os) {
-  PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-          typename T6, typename T7, typename T8, typename T9>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>& t,
-             ::std::ostream* os) {
-  PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-          typename T6, typename T7, typename T8, typename T9, typename T10>
-void PrintTo(
-    const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>& t,
-    ::std::ostream* os) {
-  PrintTupleTo(t, os);
-}
-
-// Overload for std::pair.
-template <typename T1, typename T2>
-void PrintTo(const ::std::pair<T1, T2>& value, ::std::ostream* os) {
-  *os << '(';
-  UniversalPrinter<T1>::Print(value.first, os);
-  *os << ", ";
-  UniversalPrinter<T2>::Print(value.second, os);
-  *os << ')';
-}
-
-// Implements printing a non-reference type T by letting the compiler
-// pick the right overload of PrintTo() for T.
-template <typename T>
-class UniversalPrinter {
- public:
-  // MSVC warns about adding const to a function type, so we want to
-  // disable the warning.
-#ifdef _MSC_VER
-#pragma warning(push)          // Saves the current warning state.
-#pragma warning(disable:4180)  // Temporarily disables warning 4180.
-#endif  // _MSC_VER
-
-  // Note: we deliberately don't call this PrintTo(), as that name
-  // conflicts with ::testing::internal::PrintTo in the body of the
-  // function.
-  static void Print(const T& value, ::std::ostream* os) {
-    // By default, ::testing::internal::PrintTo() is used for printing
-    // the value.
-    //
-    // Thanks to Koenig look-up, if T is a class and has its own
-    // PrintTo() function defined in its namespace, that function will
-    // be visible here.  Since it is more specific than the generic ones
-    // in ::testing::internal, it will be picked by the compiler in the
-    // following statement - exactly what we want.
-    PrintTo(value, os);
-  }
-
-  // A convenient wrapper for Print() that returns the print-out as a
-  // string.
-  static string PrintToString(const T& value) {
-    ::std::stringstream ss;
-    Print(value, &ss);
-    return ss.str();
-  }
-
-#ifdef _MSC_VER
-#pragma warning(pop)           // Restores the warning state.
-#endif  // _MSC_VER
-};
-
-// UniversalPrintArray(begin, len, os) prints an array of 'len'
-// elements, starting at address 'begin'.
-template <typename T>
-void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {
-  if (len == 0) {
-    *os << "{}";
-  } else {
-    *os << "{ ";
-    const size_t kThreshold = 18;
-    const size_t kChunkSize = 8;
-    // If the array has more than kThreshold elements, we'll have to
-    // omit some details by printing only the first and the last
-    // kChunkSize elements.
-    // TODO(wan@google.com): let the user control the threshold using a flag.
-    if (len <= kThreshold) {
-      PrintRawArrayTo(begin, len, os);
-    } else {
-      PrintRawArrayTo(begin, kChunkSize, os);
-      *os << ", ..., ";
-      PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os);
-    }
-    *os << " }";
-  }
-}
-// This overload prints a (const) char array compactly.
-void UniversalPrintArray(const char* begin, size_t len, ::std::ostream* os);
-
-// Prints an array of 'len' elements, starting at address 'begin', to a string.
-template <typename T>
-string UniversalPrintArrayToString(const T* begin, size_t len) {
-  ::std::stringstream ss;
-  UniversalPrintArray(begin, len, &ss);
-  return ss.str();
-}
-
-// Implements printing an array type T[N].
-template <typename T, size_t N>
-class UniversalPrinter<T[N]> {
- public:
-  // Prints the given array, omitting some elements when there are too
-  // many.
-  static void Print(const T (&a)[N], ::std::ostream* os) {
-    UniversalPrintArray(a, N, os);
-  }
-
-  // A convenient wrapper for Print() that returns the print-out as a
-  // string.
-  static string PrintToString(const T (&a)[N]) {
-    return UniversalPrintArrayToString(a, N);
-  }
-};
-
-// Implements printing a reference type T&.
-template <typename T>
-class UniversalPrinter<T&> {
- public:
-  // MSVC warns about adding const to a function type, so we want to
-  // disable the warning.
-#ifdef _MSC_VER
-#pragma warning(push)          // Saves the current warning state.
-#pragma warning(disable:4180)  // Temporarily disables warning 4180.
-#endif  // _MSC_VER
-
-  static void Print(const T& value, ::std::ostream* os) {
-    // Prints the address of the value.  We use reinterpret_cast here
-    // as static_cast doesn't compile when T is a function type.
-    *os << "@" << reinterpret_cast<const void*>(&value) << " ";
-
-    // Then prints the value itself.
-    UniversalPrinter<T>::Print(value, os);
-  }
-
-  // A convenient wrapper for Print() that returns the print-out as a
-  // string.
-  static string PrintToString(const T& value) {
-    ::std::stringstream ss;
-    Print(value, &ss);
-    return ss.str();
-  }
-
-#ifdef _MSC_VER
-#pragma warning(pop)           // Restores the warning state.
-#endif  // _MSC_VER
-};
-
-// Prints a value tersely: for a reference type, the referenced value
-// (but not the address) is printed; for a (const) char pointer, the
-// NUL-terminated string (but not the pointer) is printed.
-template <typename T>
-void UniversalTersePrint(const T& value, ::std::ostream* os) {
-  UniversalPrinter<T>::Print(value, os);
-}
-inline void UniversalTersePrint(const char* str, ::std::ostream* os) {
-  if (str == NULL) {
-    *os << "NULL";
-  } else {
-    UniversalPrinter<string>::Print(string(str), os);
-  }
-}
-inline void UniversalTersePrint(char* str, ::std::ostream* os) {
-  UniversalTersePrint(static_cast<const char*>(str), os);
-}
-
-// Prints a value using the type inferred by the compiler.  The
-// difference between this and UniversalTersePrint() is that for a
-// (const) char pointer, this prints both the pointer and the
-// NUL-terminated string.
-template <typename T>
-void UniversalPrint(const T& value, ::std::ostream* os) {
-  UniversalPrinter<T>::Print(value, os);
-}
-
-typedef ::std::vector<string> Strings;
-
-// This helper template allows PrintTo() for tuples and
-// UniversalTersePrintTupleFieldsToStrings() to be defined by
-// induction on the number of tuple fields.  The idea is that
-// TuplePrefixPrinter<N>::PrintPrefixTo(t, os) prints the first N
-// fields in tuple t, and can be defined in terms of
-// TuplePrefixPrinter<N - 1>.
-
-// The inductive case.
-template <size_t N>
-struct TuplePrefixPrinter {
-  // Prints the first N fields of a tuple.
-  template <typename Tuple>
-  static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) {
-    TuplePrefixPrinter<N - 1>::PrintPrefixTo(t, os);
-    *os << ", ";
-    UniversalPrinter<typename ::std::tr1::tuple_element<N - 1, Tuple>::type>
-        ::Print(::std::tr1::get<N - 1>(t), os);
-  }
-
-  // Tersely prints the first N fields of a tuple to a string vector,
-  // one element for each field.
-  template <typename Tuple>
-  static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) {
-    TuplePrefixPrinter<N - 1>::TersePrintPrefixToStrings(t, strings);
-    ::std::stringstream ss;
-    UniversalTersePrint(::std::tr1::get<N - 1>(t), &ss);
-    strings->push_back(ss.str());
-  }
-};
-
-// Base cases.
-template <>
-struct TuplePrefixPrinter<0> {
-  template <typename Tuple>
-  static void PrintPrefixTo(const Tuple&, ::std::ostream*) {}
-
-  template <typename Tuple>
-  static void TersePrintPrefixToStrings(const Tuple&, Strings*) {}
-};
-template <>
-template <typename Tuple>
-void TuplePrefixPrinter<1>::PrintPrefixTo(const Tuple& t, ::std::ostream* os) {
-  UniversalPrinter<typename ::std::tr1::tuple_element<0, Tuple>::type>::
-      Print(::std::tr1::get<0>(t), os);
-}
-
-// Helper function for printing a tuple.  T must be instantiated with
-// a tuple type.
-template <typename T>
-void PrintTupleTo(const T& t, ::std::ostream* os) {
-  *os << "(";
-  TuplePrefixPrinter< ::std::tr1::tuple_size<T>::value>::
-      PrintPrefixTo(t, os);
-  *os << ")";
-}
-
-// Prints the fields of a tuple tersely to a string vector, one
-// element for each field.  See the comment before
-// UniversalTersePrint() for how we define "tersely".
-template <typename Tuple>
-Strings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) {
-  Strings result;
-  TuplePrefixPrinter< ::std::tr1::tuple_size<Tuple>::value>::
-      TersePrintPrefixToStrings(value, &result);
-  return result;
-}
-
-}  // namespace internal
-}  // namespace testing
-
-#endif  // GMOCK_INCLUDE_GMOCK_GMOCK_PRINTERS_H_
diff --git a/third_party/gmock/include/gmock/gmock-spec-builders.h b/third_party/gmock/include/gmock/gmock-spec-builders.h
deleted file mode 100644
index 9cb549a..0000000
--- a/third_party/gmock/include/gmock/gmock-spec-builders.h
+++ /dev/null
@@ -1,1840 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements the ON_CALL() and EXPECT_CALL() macros.
-//
-// A user can use the ON_CALL() macro to specify the default action of
-// a mock method.  The syntax is:
-//
-//   ON_CALL(mock_object, Method(argument-matchers))
-//       .With(multi-argument-matcher)
-//       .WillByDefault(action);
-//
-//  where the .With() clause is optional.
-//
-// A user can use the EXPECT_CALL() macro to specify an expectation on
-// a mock method.  The syntax is:
-//
-//   EXPECT_CALL(mock_object, Method(argument-matchers))
-//       .With(multi-argument-matchers)
-//       .Times(cardinality)
-//       .InSequence(sequences)
-//       .After(expectations)
-//       .WillOnce(action)
-//       .WillRepeatedly(action)
-//       .RetiresOnSaturation();
-//
-// where all clauses are optional, and .InSequence()/.After()/
-// .WillOnce() can appear any number of times.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
-
-#include <map>
-#include <set>
-#include <sstream>
-#include <string>
-#include <vector>
-
-#include <gmock/gmock-actions.h>
-#include <gmock/gmock-cardinalities.h>
-#include <gmock/gmock-matchers.h>
-#include <gmock/gmock-printers.h>
-#include <gmock/internal/gmock-internal-utils.h>
-#include <gmock/internal/gmock-port.h>
-#include <gtest/gtest.h>
-
-namespace testing {
-
-// An abstract handle of an expectation.
-class Expectation;
-
-// A set of expectation handles.
-class ExpectationSet;
-
-// Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION
-// and MUST NOT BE USED IN USER CODE!!!
-namespace internal {
-
-// Implements a mock function.
-template <typename F> class FunctionMocker;
-
-// Base class for expectations.
-class ExpectationBase;
-
-// Implements an expectation.
-template <typename F> class TypedExpectation;
-
-// Helper class for testing the Expectation class template.
-class ExpectationTester;
-
-// Base class for function mockers.
-template <typename F> class FunctionMockerBase;
-
-// Protects the mock object registry (in class Mock), all function
-// mockers, and all expectations.
-//
-// The reason we don't use more fine-grained protection is: when a
-// mock function Foo() is called, it needs to consult its expectations
-// to see which one should be picked.  If another thread is allowed to
-// call a mock function (either Foo() or a different one) at the same
-// time, it could affect the "retired" attributes of Foo()'s
-// expectations when InSequence() is used, and thus affect which
-// expectation gets picked.  Therefore, we sequence all mock function
-// calls to ensure the integrity of the mock objects' states.
-extern Mutex g_gmock_mutex;
-
-// Abstract base class of FunctionMockerBase.  This is the
-// type-agnostic part of the function mocker interface.  Its pure
-// virtual methods are implemented by FunctionMockerBase.
-class UntypedFunctionMockerBase {
- public:
-  virtual ~UntypedFunctionMockerBase() {}
-
-  // Verifies that all expectations on this mock function have been
-  // satisfied.  Reports one or more Google Test non-fatal failures
-  // and returns false if not.
-  // L >= g_gmock_mutex
-  virtual bool VerifyAndClearExpectationsLocked() = 0;
-
-  // Clears the ON_CALL()s set on this mock function.
-  // L >= g_gmock_mutex
-  virtual void ClearDefaultActionsLocked() = 0;
-};  // class UntypedFunctionMockerBase
-
-// This template class implements a default action spec (i.e. an
-// ON_CALL() statement).
-template <typename F>
-class DefaultActionSpec {
- public:
-  typedef typename Function<F>::ArgumentTuple ArgumentTuple;
-  typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple;
-
-  // Constructs a DefaultActionSpec object from the information inside
-  // the parenthesis of an ON_CALL() statement.
-  DefaultActionSpec(const char* file, int line,
-                    const ArgumentMatcherTuple& matchers)
-      : file_(file),
-        line_(line),
-        matchers_(matchers),
-        // By default, extra_matcher_ should match anything.  However,
-        // we cannot initialize it with _ as that triggers a compiler
-        // bug in Symbian's C++ compiler (cannot decide between two
-        // overloaded constructors of Matcher<const ArgumentTuple&>).
-        extra_matcher_(A<const ArgumentTuple&>()),
-        last_clause_(kNone) {
-  }
-
-  // Where in the source file was the default action spec defined?
-  const char* file() const { return file_; }
-  int line() const { return line_; }
-
-  // Implements the .With() clause.
-  DefaultActionSpec& With(const Matcher<const ArgumentTuple&>& m) {
-    // Makes sure this is called at most once.
-    ExpectSpecProperty(last_clause_ < kWith,
-                       ".With() cannot appear "
-                       "more than once in an ON_CALL().");
-    last_clause_ = kWith;
-
-    extra_matcher_ = m;
-    return *this;
-  }
-
-  // Implements the .WillByDefault() clause.
-  DefaultActionSpec& WillByDefault(const Action<F>& action) {
-    ExpectSpecProperty(last_clause_ < kWillByDefault,
-                       ".WillByDefault() must appear "
-                       "exactly once in an ON_CALL().");
-    last_clause_ = kWillByDefault;
-
-    ExpectSpecProperty(!action.IsDoDefault(),
-                       "DoDefault() cannot be used in ON_CALL().");
-    action_ = action;
-    return *this;
-  }
-
-  // Returns true iff the given arguments match the matchers.
-  bool Matches(const ArgumentTuple& args) const {
-    return TupleMatches(matchers_, args) && extra_matcher_.Matches(args);
-  }
-
-  // Returns the action specified by the user.
-  const Action<F>& GetAction() const {
-    AssertSpecProperty(last_clause_ == kWillByDefault,
-                       ".WillByDefault() must appear exactly "
-                       "once in an ON_CALL().");
-    return action_;
-  }
- private:
-  // Gives each clause in the ON_CALL() statement a name.
-  enum Clause {
-    // Do not change the order of the enum members!  The run-time
-    // syntax checking relies on it.
-    kNone,
-    kWith,
-    kWillByDefault,
-  };
-
-  // Asserts that the ON_CALL() statement has a certain property.
-  void AssertSpecProperty(bool property, const string& failure_message) const {
-    Assert(property, file_, line_, failure_message);
-  }
-
-  // Expects that the ON_CALL() statement has a certain property.
-  void ExpectSpecProperty(bool property, const string& failure_message) const {
-    Expect(property, file_, line_, failure_message);
-  }
-
-  // The information in statement
-  //
-  //   ON_CALL(mock_object, Method(matchers))
-  //       .With(multi-argument-matcher)
-  //       .WillByDefault(action);
-  //
-  // is recorded in the data members like this:
-  //
-  //   source file that contains the statement => file_
-  //   line number of the statement            => line_
-  //   matchers                                => matchers_
-  //   multi-argument-matcher                  => extra_matcher_
-  //   action                                  => action_
-  const char* file_;
-  int line_;
-  ArgumentMatcherTuple matchers_;
-  Matcher<const ArgumentTuple&> extra_matcher_;
-  Action<F> action_;
-
-  // The last clause in the ON_CALL() statement as seen so far.
-  // Initially kNone and changes as the statement is parsed.
-  Clause last_clause_;
-};  // class DefaultActionSpec
-
-// Possible reactions on uninteresting calls.  TODO(wan@google.com):
-// rename the enum values to the kFoo style.
-enum CallReaction {
-  ALLOW,
-  WARN,
-  FAIL,
-};
-
-}  // namespace internal
-
-// Utilities for manipulating mock objects.
-class Mock {
- public:
-  // The following public methods can be called concurrently.
-
-  // Tells Google Mock to ignore mock_obj when checking for leaked
-  // mock objects.
-  static void AllowLeak(const void* mock_obj);
-
-  // Verifies and clears all expectations on the given mock object.
-  // If the expectations aren't satisfied, generates one or more
-  // Google Test non-fatal failures and returns false.
-  static bool VerifyAndClearExpectations(void* mock_obj);
-
-  // Verifies all expectations on the given mock object and clears its
-  // default actions and expectations.  Returns true iff the
-  // verification was successful.
-  static bool VerifyAndClear(void* mock_obj);
- private:
-  // Needed for a function mocker to register itself (so that we know
-  // how to clear a mock object).
-  template <typename F>
-  friend class internal::FunctionMockerBase;
-
-  template <typename M>
-  friend class NiceMock;
-
-  template <typename M>
-  friend class StrictMock;
-
-  // Tells Google Mock to allow uninteresting calls on the given mock
-  // object.
-  // L < g_gmock_mutex
-  static void AllowUninterestingCalls(const void* mock_obj);
-
-  // Tells Google Mock to warn the user about uninteresting calls on
-  // the given mock object.
-  // L < g_gmock_mutex
-  static void WarnUninterestingCalls(const void* mock_obj);
-
-  // Tells Google Mock to fail uninteresting calls on the given mock
-  // object.
-  // L < g_gmock_mutex
-  static void FailUninterestingCalls(const void* mock_obj);
-
-  // Tells Google Mock the given mock object is being destroyed and
-  // its entry in the call-reaction table should be removed.
-  // L < g_gmock_mutex
-  static void UnregisterCallReaction(const void* mock_obj);
-
-  // Returns the reaction Google Mock will have on uninteresting calls
-  // made on the given mock object.
-  // L < g_gmock_mutex
-  static internal::CallReaction GetReactionOnUninterestingCalls(
-      const void* mock_obj);
-
-  // Verifies that all expectations on the given mock object have been
-  // satisfied.  Reports one or more Google Test non-fatal failures
-  // and returns false if not.
-  // L >= g_gmock_mutex
-  static bool VerifyAndClearExpectationsLocked(void* mock_obj);
-
-  // Clears all ON_CALL()s set on the given mock object.
-  // L >= g_gmock_mutex
-  static void ClearDefaultActionsLocked(void* mock_obj);
-
-  // Registers a mock object and a mock method it owns.
-  // L < g_gmock_mutex
-  static void Register(const void* mock_obj,
-                       internal::UntypedFunctionMockerBase* mocker);
-
-  // Tells Google Mock where in the source code mock_obj is used in an
-  // ON_CALL or EXPECT_CALL.  In case mock_obj is leaked, this
-  // information helps the user identify which object it is.
-  // L < g_gmock_mutex
-  static void RegisterUseByOnCallOrExpectCall(
-      const void* mock_obj, const char* file, int line);
-
-  // Unregisters a mock method; removes the owning mock object from
-  // the registry when the last mock method associated with it has
-  // been unregistered.  This is called only in the destructor of
-  // FunctionMockerBase.
-  // L >= g_gmock_mutex
-  static void UnregisterLocked(internal::UntypedFunctionMockerBase* mocker);
-};  // class Mock
-
-// An abstract handle of an expectation.  Useful in the .After()
-// clause of EXPECT_CALL() for setting the (partial) order of
-// expectations.  The syntax:
-//
-//   Expectation e1 = EXPECT_CALL(...)...;
-//   EXPECT_CALL(...).After(e1)...;
-//
-// sets two expectations where the latter can only be matched after
-// the former has been satisfied.
-//
-// Notes:
-//   - This class is copyable and has value semantics.
-//   - Constness is shallow: a const Expectation object itself cannot
-//     be modified, but the mutable methods of the ExpectationBase
-//     object it references can be called via expectation_base().
-//   - The constructors and destructor are defined out-of-line because
-//     the Symbian WINSCW compiler wants to otherwise instantiate them
-//     when it sees this class definition, at which point it doesn't have
-//     ExpectationBase available yet, leading to incorrect destruction
-//     in the linked_ptr (or compilation errors if using a checking
-//     linked_ptr).
-class Expectation {
- public:
-  // Constructs a null object that doesn't reference any expectation.
-  Expectation();
-
-  ~Expectation();
-
-  // This single-argument ctor must not be explicit, in order to support the
-  //   Expectation e = EXPECT_CALL(...);
-  // syntax.
-  //
-  // A TypedExpectation object stores its pre-requisites as
-  // Expectation objects, and needs to call the non-const Retire()
-  // method on the ExpectationBase objects they reference.  Therefore
-  // Expectation must receive a *non-const* reference to the
-  // ExpectationBase object.
-  Expectation(internal::ExpectationBase& exp);  // NOLINT
-
-  // The compiler-generated copy ctor and operator= work exactly as
-  // intended, so we don't need to define our own.
-
-  // Returns true iff rhs references the same expectation as this object does.
-  bool operator==(const Expectation& rhs) const {
-    return expectation_base_ == rhs.expectation_base_;
-  }
-
-  bool operator!=(const Expectation& rhs) const { return !(*this == rhs); }
-
- private:
-  friend class ExpectationSet;
-  friend class Sequence;
-  friend class ::testing::internal::ExpectationBase;
-
-  template <typename F>
-  friend class ::testing::internal::FunctionMockerBase;
-
-  template <typename F>
-  friend class ::testing::internal::TypedExpectation;
-
-  // This comparator is needed for putting Expectation objects into a set.
-  class Less {
-   public:
-    bool operator()(const Expectation& lhs, const Expectation& rhs) const {
-      return lhs.expectation_base_.get() < rhs.expectation_base_.get();
-    }
-  };
-
-  typedef ::std::set<Expectation, Less> Set;
-
-  Expectation(
-      const internal::linked_ptr<internal::ExpectationBase>& expectation_base);
-
-  // Returns the expectation this object references.
-  const internal::linked_ptr<internal::ExpectationBase>&
-  expectation_base() const {
-    return expectation_base_;
-  }
-
-  // A linked_ptr that co-owns the expectation this handle references.
-  internal::linked_ptr<internal::ExpectationBase> expectation_base_;
-};
-
-// A set of expectation handles.  Useful in the .After() clause of
-// EXPECT_CALL() for setting the (partial) order of expectations.  The
-// syntax:
-//
-//   ExpectationSet es;
-//   es += EXPECT_CALL(...)...;
-//   es += EXPECT_CALL(...)...;
-//   EXPECT_CALL(...).After(es)...;
-//
-// sets three expectations where the last one can only be matched
-// after the first two have both been satisfied.
-//
-// This class is copyable and has value semantics.
-class ExpectationSet {
- public:
-  // A bidirectional iterator that can read a const element in the set.
-  typedef Expectation::Set::const_iterator const_iterator;
-
-  // An object stored in the set.  This is an alias of Expectation.
-  typedef Expectation::Set::value_type value_type;
-
-  // Constructs an empty set.
-  ExpectationSet() {}
-
-  // This single-argument ctor must not be explicit, in order to support the
-  //   ExpectationSet es = EXPECT_CALL(...);
-  // syntax.
-  ExpectationSet(internal::ExpectationBase& exp) {  // NOLINT
-    *this += Expectation(exp);
-  }
-
-  // This single-argument ctor implements implicit conversion from
-  // Expectation and thus must not be explicit.  This allows either an
-  // Expectation or an ExpectationSet to be used in .After().
-  ExpectationSet(const Expectation& e) {  // NOLINT
-    *this += e;
-  }
-
-  // The compiler-generator ctor and operator= works exactly as
-  // intended, so we don't need to define our own.
-
-  // Returns true iff rhs contains the same set of Expectation objects
-  // as this does.
-  bool operator==(const ExpectationSet& rhs) const {
-    return expectations_ == rhs.expectations_;
-  }
-
-  bool operator!=(const ExpectationSet& rhs) const { return !(*this == rhs); }
-
-  // Implements the syntax
-  //   expectation_set += EXPECT_CALL(...);
-  ExpectationSet& operator+=(const Expectation& e) {
-    expectations_.insert(e);
-    return *this;
-  }
-
-  int size() const { return static_cast<int>(expectations_.size()); }
-
-  const_iterator begin() const { return expectations_.begin(); }
-  const_iterator end() const { return expectations_.end(); }
-
- private:
-  Expectation::Set expectations_;
-};
-
-
-// Sequence objects are used by a user to specify the relative order
-// in which the expectations should match.  They are copyable (we rely
-// on the compiler-defined copy constructor and assignment operator).
-class Sequence {
- public:
-  // Constructs an empty sequence.
-  Sequence() : last_expectation_(new Expectation) {}
-
-  // Adds an expectation to this sequence.  The caller must ensure
-  // that no other thread is accessing this Sequence object.
-  void AddExpectation(const Expectation& expectation) const;
-
- private:
-  // The last expectation in this sequence.  We use a linked_ptr here
-  // because Sequence objects are copyable and we want the copies to
-  // be aliases.  The linked_ptr allows the copies to co-own and share
-  // the same Expectation object.
-  internal::linked_ptr<Expectation> last_expectation_;
-};  // class Sequence
-
-// An object of this type causes all EXPECT_CALL() statements
-// encountered in its scope to be put in an anonymous sequence.  The
-// work is done in the constructor and destructor.  You should only
-// create an InSequence object on the stack.
-//
-// The sole purpose for this class is to support easy definition of
-// sequential expectations, e.g.
-//
-//   {
-//     InSequence dummy;  // The name of the object doesn't matter.
-//
-//     // The following expectations must match in the order they appear.
-//     EXPECT_CALL(a, Bar())...;
-//     EXPECT_CALL(a, Baz())...;
-//     ...
-//     EXPECT_CALL(b, Xyz())...;
-//   }
-//
-// You can create InSequence objects in multiple threads, as long as
-// they are used to affect different mock objects.  The idea is that
-// each thread can create and set up its own mocks as if it's the only
-// thread.  However, for clarity of your tests we recommend you to set
-// up mocks in the main thread unless you have a good reason not to do
-// so.
-class InSequence {
- public:
-  InSequence();
-  ~InSequence();
- private:
-  bool sequence_created_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(InSequence);  // NOLINT
-} GMOCK_ATTRIBUTE_UNUSED_;
-
-namespace internal {
-
-// Points to the implicit sequence introduced by a living InSequence
-// object (if any) in the current thread or NULL.
-extern ThreadLocal<Sequence*> g_gmock_implicit_sequence;
-
-// Base class for implementing expectations.
-//
-// There are two reasons for having a type-agnostic base class for
-// Expectation:
-//
-//   1. We need to store collections of expectations of different
-//   types (e.g. all pre-requisites of a particular expectation, all
-//   expectations in a sequence).  Therefore these expectation objects
-//   must share a common base class.
-//
-//   2. We can avoid binary code bloat by moving methods not depending
-//   on the template argument of Expectation to the base class.
-//
-// This class is internal and mustn't be used by user code directly.
-class ExpectationBase {
- public:
-  // source_text is the EXPECT_CALL(...) source that created this Expectation.
-  ExpectationBase(const char* file, int line, const string& source_text);
-
-  virtual ~ExpectationBase();
-
-  // Where in the source file was the expectation spec defined?
-  const char* file() const { return file_; }
-  int line() const { return line_; }
-  const char* source_text() const { return source_text_.c_str(); }
-  // Returns the cardinality specified in the expectation spec.
-  const Cardinality& cardinality() const { return cardinality_; }
-
-  // Describes the source file location of this expectation.
-  void DescribeLocationTo(::std::ostream* os) const {
-    *os << file() << ":" << line() << ": ";
-  }
-
-  // Describes how many times a function call matching this
-  // expectation has occurred.
-  // L >= g_gmock_mutex
-  virtual void DescribeCallCountTo(::std::ostream* os) const = 0;
- protected:
-  friend class ::testing::Expectation;
-
-  enum Clause {
-    // Don't change the order of the enum members!
-    kNone,
-    kWith,
-    kTimes,
-    kInSequence,
-    kAfter,
-    kWillOnce,
-    kWillRepeatedly,
-    kRetiresOnSaturation,
-  };
-
-  // Returns an Expectation object that references and co-owns this
-  // expectation.
-  virtual Expectation GetHandle() = 0;
-
-  // Asserts that the EXPECT_CALL() statement has the given property.
-  void AssertSpecProperty(bool property, const string& failure_message) const {
-    Assert(property, file_, line_, failure_message);
-  }
-
-  // Expects that the EXPECT_CALL() statement has the given property.
-  void ExpectSpecProperty(bool property, const string& failure_message) const {
-    Expect(property, file_, line_, failure_message);
-  }
-
-  // Explicitly specifies the cardinality of this expectation.  Used
-  // by the subclasses to implement the .Times() clause.
-  void SpecifyCardinality(const Cardinality& cardinality);
-
-  // Returns true iff the user specified the cardinality explicitly
-  // using a .Times().
-  bool cardinality_specified() const { return cardinality_specified_; }
-
-  // Sets the cardinality of this expectation spec.
-  void set_cardinality(const Cardinality& cardinality) {
-    cardinality_ = cardinality;
-  }
-
-  // The following group of methods should only be called after the
-  // EXPECT_CALL() statement, and only when g_gmock_mutex is held by
-  // the current thread.
-
-  // Retires all pre-requisites of this expectation.
-  // L >= g_gmock_mutex
-  void RetireAllPreRequisites();
-
-  // Returns true iff this expectation is retired.
-  // L >= g_gmock_mutex
-  bool is_retired() const {
-    g_gmock_mutex.AssertHeld();
-    return retired_;
-  }
-
-  // Retires this expectation.
-  // L >= g_gmock_mutex
-  void Retire() {
-    g_gmock_mutex.AssertHeld();
-    retired_ = true;
-  }
-
-  // Returns true iff this expectation is satisfied.
-  // L >= g_gmock_mutex
-  bool IsSatisfied() const {
-    g_gmock_mutex.AssertHeld();
-    return cardinality().IsSatisfiedByCallCount(call_count_);
-  }
-
-  // Returns true iff this expectation is saturated.
-  // L >= g_gmock_mutex
-  bool IsSaturated() const {
-    g_gmock_mutex.AssertHeld();
-    return cardinality().IsSaturatedByCallCount(call_count_);
-  }
-
-  // Returns true iff this expectation is over-saturated.
-  // L >= g_gmock_mutex
-  bool IsOverSaturated() const {
-    g_gmock_mutex.AssertHeld();
-    return cardinality().IsOverSaturatedByCallCount(call_count_);
-  }
-
-  // Returns true iff all pre-requisites of this expectation are satisfied.
-  // L >= g_gmock_mutex
-  bool AllPrerequisitesAreSatisfied() const;
-
-  // Adds unsatisfied pre-requisites of this expectation to 'result'.
-  // L >= g_gmock_mutex
-  void FindUnsatisfiedPrerequisites(ExpectationSet* result) const;
-
-  // Returns the number this expectation has been invoked.
-  // L >= g_gmock_mutex
-  int call_count() const {
-    g_gmock_mutex.AssertHeld();
-    return call_count_;
-  }
-
-  // Increments the number this expectation has been invoked.
-  // L >= g_gmock_mutex
-  void IncrementCallCount() {
-    g_gmock_mutex.AssertHeld();
-    call_count_++;
-  }
-
- private:
-  friend class ::testing::Sequence;
-  friend class ::testing::internal::ExpectationTester;
-
-  template <typename Function>
-  friend class TypedExpectation;
-
-  // This group of fields are part of the spec and won't change after
-  // an EXPECT_CALL() statement finishes.
-  const char* file_;          // The file that contains the expectation.
-  int line_;                  // The line number of the expectation.
-  const string source_text_;  // The EXPECT_CALL(...) source text.
-  // True iff the cardinality is specified explicitly.
-  bool cardinality_specified_;
-  Cardinality cardinality_;            // The cardinality of the expectation.
-  // The immediate pre-requisites (i.e. expectations that must be
-  // satisfied before this expectation can be matched) of this
-  // expectation.  We use linked_ptr in the set because we want an
-  // Expectation object to be co-owned by its FunctionMocker and its
-  // successors.  This allows multiple mock objects to be deleted at
-  // different times.
-  ExpectationSet immediate_prerequisites_;
-
-  // This group of fields are the current state of the expectation,
-  // and can change as the mock function is called.
-  int call_count_;  // How many times this expectation has been invoked.
-  bool retired_;    // True iff this expectation has retired.
-};  // class ExpectationBase
-
-// Impements an expectation for the given function type.
-template <typename F>
-class TypedExpectation : public ExpectationBase {
- public:
-  typedef typename Function<F>::ArgumentTuple ArgumentTuple;
-  typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple;
-  typedef typename Function<F>::Result Result;
-
-  TypedExpectation(FunctionMockerBase<F>* owner,
-                   const char* file, int line, const string& source_text,
-                   const ArgumentMatcherTuple& m)
-      : ExpectationBase(file, line, source_text),
-        owner_(owner),
-        matchers_(m),
-        extra_matcher_specified_(false),
-        // By default, extra_matcher_ should match anything.  However,
-        // we cannot initialize it with _ as that triggers a compiler
-        // bug in Symbian's C++ compiler (cannot decide between two
-        // overloaded constructors of Matcher<const ArgumentTuple&>).
-        extra_matcher_(A<const ArgumentTuple&>()),
-        repeated_action_specified_(false),
-        repeated_action_(DoDefault()),
-        retires_on_saturation_(false),
-        last_clause_(kNone),
-        action_count_checked_(false) {}
-
-  virtual ~TypedExpectation() {
-    // Check the validity of the action count if it hasn't been done
-    // yet (for example, if the expectation was never used).
-    CheckActionCountIfNotDone();
-  }
-
-  // Implements the .With() clause.
-  TypedExpectation& With(const Matcher<const ArgumentTuple&>& m) {
-    if (last_clause_ == kWith) {
-      ExpectSpecProperty(false,
-                         ".With() cannot appear "
-                         "more than once in an EXPECT_CALL().");
-    } else {
-      ExpectSpecProperty(last_clause_ < kWith,
-                         ".With() must be the first "
-                         "clause in an EXPECT_CALL().");
-    }
-    last_clause_ = kWith;
-
-    extra_matcher_ = m;
-    extra_matcher_specified_ = true;
-    return *this;
-  }
-
-  // Implements the .Times() clause.
-  TypedExpectation& Times(const Cardinality& cardinality) {
-    if (last_clause_ ==kTimes) {
-      ExpectSpecProperty(false,
-                         ".Times() cannot appear "
-                         "more than once in an EXPECT_CALL().");
-    } else {
-      ExpectSpecProperty(last_clause_ < kTimes,
-                         ".Times() cannot appear after "
-                         ".InSequence(), .WillOnce(), .WillRepeatedly(), "
-                         "or .RetiresOnSaturation().");
-    }
-    last_clause_ = kTimes;
-
-    ExpectationBase::SpecifyCardinality(cardinality);
-    return *this;
-  }
-
-  // Implements the .Times() clause.
-  TypedExpectation& Times(int n) {
-    return Times(Exactly(n));
-  }
-
-  // Implements the .InSequence() clause.
-  TypedExpectation& InSequence(const Sequence& s) {
-    ExpectSpecProperty(last_clause_ <= kInSequence,
-                       ".InSequence() cannot appear after .After(),"
-                       " .WillOnce(), .WillRepeatedly(), or "
-                       ".RetiresOnSaturation().");
-    last_clause_ = kInSequence;
-
-    s.AddExpectation(GetHandle());
-    return *this;
-  }
-  TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2) {
-    return InSequence(s1).InSequence(s2);
-  }
-  TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2,
-                               const Sequence& s3) {
-    return InSequence(s1, s2).InSequence(s3);
-  }
-  TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2,
-                               const Sequence& s3, const Sequence& s4) {
-    return InSequence(s1, s2, s3).InSequence(s4);
-  }
-  TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2,
-                               const Sequence& s3, const Sequence& s4,
-                               const Sequence& s5) {
-    return InSequence(s1, s2, s3, s4).InSequence(s5);
-  }
-
-  // Implements that .After() clause.
-  TypedExpectation& After(const ExpectationSet& s) {
-    ExpectSpecProperty(last_clause_ <= kAfter,
-                       ".After() cannot appear after .WillOnce(),"
-                       " .WillRepeatedly(), or "
-                       ".RetiresOnSaturation().");
-    last_clause_ = kAfter;
-
-    for (ExpectationSet::const_iterator it = s.begin(); it != s.end(); ++it) {
-      immediate_prerequisites_ += *it;
-    }
-    return *this;
-  }
-  TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2) {
-    return After(s1).After(s2);
-  }
-  TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2,
-                          const ExpectationSet& s3) {
-    return After(s1, s2).After(s3);
-  }
-  TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2,
-                          const ExpectationSet& s3, const ExpectationSet& s4) {
-    return After(s1, s2, s3).After(s4);
-  }
-  TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2,
-                          const ExpectationSet& s3, const ExpectationSet& s4,
-                          const ExpectationSet& s5) {
-    return After(s1, s2, s3, s4).After(s5);
-  }
-
-  // Implements the .WillOnce() clause.
-  TypedExpectation& WillOnce(const Action<F>& action) {
-    ExpectSpecProperty(last_clause_ <= kWillOnce,
-                       ".WillOnce() cannot appear after "
-                       ".WillRepeatedly() or .RetiresOnSaturation().");
-    last_clause_ = kWillOnce;
-
-    actions_.push_back(action);
-    if (!cardinality_specified()) {
-      set_cardinality(Exactly(static_cast<int>(actions_.size())));
-    }
-    return *this;
-  }
-
-  // Implements the .WillRepeatedly() clause.
-  TypedExpectation& WillRepeatedly(const Action<F>& action) {
-    if (last_clause_ == kWillRepeatedly) {
-      ExpectSpecProperty(false,
-                         ".WillRepeatedly() cannot appear "
-                         "more than once in an EXPECT_CALL().");
-    } else {
-      ExpectSpecProperty(last_clause_ < kWillRepeatedly,
-                         ".WillRepeatedly() cannot appear "
-                         "after .RetiresOnSaturation().");
-    }
-    last_clause_ = kWillRepeatedly;
-    repeated_action_specified_ = true;
-
-    repeated_action_ = action;
-    if (!cardinality_specified()) {
-      set_cardinality(AtLeast(static_cast<int>(actions_.size())));
-    }
-
-    // Now that no more action clauses can be specified, we check
-    // whether their count makes sense.
-    CheckActionCountIfNotDone();
-    return *this;
-  }
-
-  // Implements the .RetiresOnSaturation() clause.
-  TypedExpectation& RetiresOnSaturation() {
-    ExpectSpecProperty(last_clause_ < kRetiresOnSaturation,
-                       ".RetiresOnSaturation() cannot appear "
-                       "more than once.");
-    last_clause_ = kRetiresOnSaturation;
-    retires_on_saturation_ = true;
-
-    // Now that no more action clauses can be specified, we check
-    // whether their count makes sense.
-    CheckActionCountIfNotDone();
-    return *this;
-  }
-
-  // Returns the matchers for the arguments as specified inside the
-  // EXPECT_CALL() macro.
-  const ArgumentMatcherTuple& matchers() const {
-    return matchers_;
-  }
-
-  // Returns the matcher specified by the .With() clause.
-  const Matcher<const ArgumentTuple&>& extra_matcher() const {
-    return extra_matcher_;
-  }
-
-  // Returns the sequence of actions specified by the .WillOnce() clause.
-  const std::vector<Action<F> >& actions() const { return actions_; }
-
-  // Returns the action specified by the .WillRepeatedly() clause.
-  const Action<F>& repeated_action() const { return repeated_action_; }
-
-  // Returns true iff the .RetiresOnSaturation() clause was specified.
-  bool retires_on_saturation() const { return retires_on_saturation_; }
-
-  // Describes how many times a function call matching this
-  // expectation has occurred (implements
-  // ExpectationBase::DescribeCallCountTo()).
-  // L >= g_gmock_mutex
-  virtual void DescribeCallCountTo(::std::ostream* os) const {
-    g_gmock_mutex.AssertHeld();
-
-    // Describes how many times the function is expected to be called.
-    *os << "         Expected: to be ";
-    cardinality().DescribeTo(os);
-    *os << "\n           Actual: ";
-    Cardinality::DescribeActualCallCountTo(call_count(), os);
-
-    // Describes the state of the expectation (e.g. is it satisfied?
-    // is it active?).
-    *os << " - " << (IsOverSaturated() ? "over-saturated" :
-                     IsSaturated() ? "saturated" :
-                     IsSatisfied() ? "satisfied" : "unsatisfied")
-        << " and "
-        << (is_retired() ? "retired" : "active");
-  }
-
-  void MaybeDescribeExtraMatcherTo(::std::ostream* os) {
-    if (extra_matcher_specified_) {
-      *os << "    Expected args: ";
-      extra_matcher_.DescribeTo(os);
-      *os << "\n";
-    }
-  }
-
- private:
-  template <typename Function>
-  friend class FunctionMockerBase;
-
-  // Returns an Expectation object that references and co-owns this
-  // expectation.
-  virtual Expectation GetHandle() {
-    return owner_->GetHandleOf(this);
-  }
-
-  // The following methods will be called only after the EXPECT_CALL()
-  // statement finishes and when the current thread holds
-  // g_gmock_mutex.
-
-  // Returns true iff this expectation matches the given arguments.
-  // L >= g_gmock_mutex
-  bool Matches(const ArgumentTuple& args) const {
-    g_gmock_mutex.AssertHeld();
-    return TupleMatches(matchers_, args) && extra_matcher_.Matches(args);
-  }
-
-  // Returns true iff this expectation should handle the given arguments.
-  // L >= g_gmock_mutex
-  bool ShouldHandleArguments(const ArgumentTuple& args) const {
-    g_gmock_mutex.AssertHeld();
-
-    // In case the action count wasn't checked when the expectation
-    // was defined (e.g. if this expectation has no WillRepeatedly()
-    // or RetiresOnSaturation() clause), we check it when the
-    // expectation is used for the first time.
-    CheckActionCountIfNotDone();
-    return !is_retired() && AllPrerequisitesAreSatisfied() && Matches(args);
-  }
-
-  // Describes the result of matching the arguments against this
-  // expectation to the given ostream.
-  // L >= g_gmock_mutex
-  void DescribeMatchResultTo(const ArgumentTuple& args,
-                             ::std::ostream* os) const {
-    g_gmock_mutex.AssertHeld();
-
-    if (is_retired()) {
-      *os << "         Expected: the expectation is active\n"
-          << "           Actual: it is retired\n";
-    } else if (!Matches(args)) {
-      if (!TupleMatches(matchers_, args)) {
-        DescribeMatchFailureTupleTo(matchers_, args, os);
-      }
-      if (!extra_matcher_.Matches(args)) {
-        *os << "    Expected args: ";
-        extra_matcher_.DescribeTo(os);
-        *os << "\n           Actual: don't match";
-
-        internal::ExplainMatchResultAsNeededTo<const ArgumentTuple&>(
-            extra_matcher_, args, os);
-        *os << "\n";
-      }
-    } else if (!AllPrerequisitesAreSatisfied()) {
-      *os << "         Expected: all pre-requisites are satisfied\n"
-          << "           Actual: the following immediate pre-requisites "
-          << "are not satisfied:\n";
-      ExpectationSet unsatisfied_prereqs;
-      FindUnsatisfiedPrerequisites(&unsatisfied_prereqs);
-      int i = 0;
-      for (ExpectationSet::const_iterator it = unsatisfied_prereqs.begin();
-           it != unsatisfied_prereqs.end(); ++it) {
-        it->expectation_base()->DescribeLocationTo(os);
-        *os << "pre-requisite #" << i++ << "\n";
-      }
-      *os << "                   (end of pre-requisites)\n";
-    } else {
-      // This line is here just for completeness' sake.  It will never
-      // be executed as currently the DescribeMatchResultTo() function
-      // is called only when the mock function call does NOT match the
-      // expectation.
-      *os << "The call matches the expectation.\n";
-    }
-  }
-
-  // Returns the action that should be taken for the current invocation.
-  // L >= g_gmock_mutex
-  const Action<F>& GetCurrentAction(const FunctionMockerBase<F>* mocker,
-                                    const ArgumentTuple& args) const {
-    g_gmock_mutex.AssertHeld();
-    const int count = call_count();
-    Assert(count >= 1, __FILE__, __LINE__,
-           "call_count() is <= 0 when GetCurrentAction() is "
-           "called - this should never happen.");
-
-    const int action_count = static_cast<int>(actions().size());
-    if (action_count > 0 && !repeated_action_specified_ &&
-        count > action_count) {
-      // If there is at least one WillOnce() and no WillRepeatedly(),
-      // we warn the user when the WillOnce() clauses ran out.
-      ::std::stringstream ss;
-      DescribeLocationTo(&ss);
-      ss << "Actions ran out in " << source_text() << "...\n"
-         << "Called " << count << " times, but only "
-         << action_count << " WillOnce()"
-         << (action_count == 1 ? " is" : "s are") << " specified - ";
-      mocker->DescribeDefaultActionTo(args, &ss);
-      Log(WARNING, ss.str(), 1);
-    }
-
-    return count <= action_count ? actions()[count - 1] : repeated_action();
-  }
-
-  // Given the arguments of a mock function call, if the call will
-  // over-saturate this expectation, returns the default action;
-  // otherwise, returns the next action in this expectation.  Also
-  // describes *what* happened to 'what', and explains *why* Google
-  // Mock does it to 'why'.  This method is not const as it calls
-  // IncrementCallCount().
-  // L >= g_gmock_mutex
-  Action<F> GetActionForArguments(const FunctionMockerBase<F>* mocker,
-                                  const ArgumentTuple& args,
-                                  ::std::ostream* what,
-                                  ::std::ostream* why) {
-    g_gmock_mutex.AssertHeld();
-    if (IsSaturated()) {
-      // We have an excessive call.
-      IncrementCallCount();
-      *what << "Mock function called more times than expected - ";
-      mocker->DescribeDefaultActionTo(args, what);
-      DescribeCallCountTo(why);
-
-      // TODO(wan): allow the user to control whether unexpected calls
-      // should fail immediately or continue using a flag
-      // --gmock_unexpected_calls_are_fatal.
-      return DoDefault();
-    }
-
-    IncrementCallCount();
-    RetireAllPreRequisites();
-
-    if (retires_on_saturation() && IsSaturated()) {
-      Retire();
-    }
-
-    // Must be done after IncrementCount()!
-    *what << "Mock function call matches " << source_text() <<"...\n";
-    return GetCurrentAction(mocker, args);
-  }
-
-  // Checks the action count (i.e. the number of WillOnce() and
-  // WillRepeatedly() clauses) against the cardinality if this hasn't
-  // been done before.  Prints a warning if there are too many or too
-  // few actions.
-  // L < mutex_
-  void CheckActionCountIfNotDone() const {
-    bool should_check = false;
-    {
-      MutexLock l(&mutex_);
-      if (!action_count_checked_) {
-        action_count_checked_ = true;
-        should_check = true;
-      }
-    }
-
-    if (should_check) {
-      if (!cardinality_specified_) {
-        // The cardinality was inferred - no need to check the action
-        // count against it.
-        return;
-      }
-
-      // The cardinality was explicitly specified.
-      const int action_count = static_cast<int>(actions_.size());
-      const int upper_bound = cardinality().ConservativeUpperBound();
-      const int lower_bound = cardinality().ConservativeLowerBound();
-      bool too_many;  // True if there are too many actions, or false
-                      // if there are too few.
-      if (action_count > upper_bound ||
-          (action_count == upper_bound && repeated_action_specified_)) {
-        too_many = true;
-      } else if (0 < action_count && action_count < lower_bound &&
-                 !repeated_action_specified_) {
-        too_many = false;
-      } else {
-        return;
-      }
-
-      ::std::stringstream ss;
-      DescribeLocationTo(&ss);
-      ss << "Too " << (too_many ? "many" : "few")
-         << " actions specified in " << source_text() << "...\n"
-         << "Expected to be ";
-      cardinality().DescribeTo(&ss);
-      ss << ", but has " << (too_many ? "" : "only ")
-         << action_count << " WillOnce()"
-         << (action_count == 1 ? "" : "s");
-      if (repeated_action_specified_) {
-        ss << " and a WillRepeatedly()";
-      }
-      ss << ".";
-      Log(WARNING, ss.str(), -1);  // -1 means "don't print stack trace".
-    }
-  }
-
-  // All the fields below won't change once the EXPECT_CALL()
-  // statement finishes.
-  FunctionMockerBase<F>* const owner_;
-  ArgumentMatcherTuple matchers_;
-  bool extra_matcher_specified_;
-  Matcher<const ArgumentTuple&> extra_matcher_;
-  std::vector<Action<F> > actions_;
-  bool repeated_action_specified_;  // True if a WillRepeatedly() was specified.
-  Action<F> repeated_action_;
-  bool retires_on_saturation_;
-  Clause last_clause_;
-  mutable bool action_count_checked_;  // Under mutex_.
-  mutable Mutex mutex_;  // Protects action_count_checked_.
-};  // class TypedExpectation
-
-// A MockSpec object is used by ON_CALL() or EXPECT_CALL() for
-// specifying the default behavior of, or expectation on, a mock
-// function.
-
-// Note: class MockSpec really belongs to the ::testing namespace.
-// However if we define it in ::testing, MSVC will complain when
-// classes in ::testing::internal declare it as a friend class
-// template.  To workaround this compiler bug, we define MockSpec in
-// ::testing::internal and import it into ::testing.
-
-template <typename F>
-class MockSpec {
- public:
-  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-  typedef typename internal::Function<F>::ArgumentMatcherTuple
-      ArgumentMatcherTuple;
-
-  // Constructs a MockSpec object, given the function mocker object
-  // that the spec is associated with.
-  explicit MockSpec(internal::FunctionMockerBase<F>* function_mocker)
-      : function_mocker_(function_mocker) {}
-
-  // Adds a new default action spec to the function mocker and returns
-  // the newly created spec.
-  internal::DefaultActionSpec<F>& InternalDefaultActionSetAt(
-      const char* file, int line, const char* obj, const char* call) {
-    LogWithLocation(internal::INFO, file, line,
-        string("ON_CALL(") + obj + ", " + call + ") invoked");
-    return function_mocker_->AddNewDefaultActionSpec(file, line, matchers_);
-  }
-
-  // Adds a new expectation spec to the function mocker and returns
-  // the newly created spec.
-  internal::TypedExpectation<F>& InternalExpectedAt(
-      const char* file, int line, const char* obj, const char* call) {
-    const string source_text(string("EXPECT_CALL(") + obj + ", " + call + ")");
-    LogWithLocation(internal::INFO, file, line, source_text + " invoked");
-    return function_mocker_->AddNewExpectation(
-        file, line, source_text, matchers_);
-  }
-
- private:
-  template <typename Function>
-  friend class internal::FunctionMocker;
-
-  void SetMatchers(const ArgumentMatcherTuple& matchers) {
-    matchers_ = matchers;
-  }
-
-  // Logs a message including file and line number information.
-  void LogWithLocation(testing::internal::LogSeverity severity,
-                       const char* file, int line,
-                       const string& message) {
-    ::std::ostringstream s;
-    s << file << ":" << line << ": " << message << ::std::endl;
-    Log(severity, s.str(), 0);
-  }
-
-  // The function mocker that owns this spec.
-  internal::FunctionMockerBase<F>* const function_mocker_;
-  // The argument matchers specified in the spec.
-  ArgumentMatcherTuple matchers_;
-};  // class MockSpec
-
-// MSVC warns about using 'this' in base member initializer list, so
-// we need to temporarily disable the warning.  We have to do it for
-// the entire class to suppress the warning, even though it's about
-// the constructor only.
-
-#ifdef _MSC_VER
-#pragma warning(push)          // Saves the current warning state.
-#pragma warning(disable:4355)  // Temporarily disables warning 4355.
-#endif  // _MSV_VER
-
-// C++ treats the void type specially.  For example, you cannot define
-// a void-typed variable or pass a void value to a function.
-// ActionResultHolder<T> holds a value of type T, where T must be a
-// copyable type or void (T doesn't need to be default-constructable).
-// It hides the syntactic difference between void and other types, and
-// is used to unify the code for invoking both void-returning and
-// non-void-returning mock functions.  This generic definition is used
-// when T is not void.
-template <typename T>
-class ActionResultHolder {
- public:
-  explicit ActionResultHolder(T value) : value_(value) {}
-
-  // The compiler-generated copy constructor and assignment operator
-  // are exactly what we need, so we don't need to define them.
-
-  T value() const { return value_; }
-
-  // Prints the held value as an action's result to os.
-  void PrintAsActionResult(::std::ostream* os) const {
-    *os << "\n          Returns: ";
-    UniversalPrinter<T>::Print(value_, os);
-  }
-
-  // Performs the given mock function's default action and returns the
-  // result in a ActionResultHolder.
-  template <typename Function, typename Arguments>
-  static ActionResultHolder PerformDefaultAction(
-      const FunctionMockerBase<Function>* func_mocker,
-      const Arguments& args,
-      const string& call_description) {
-    return ActionResultHolder(
-        func_mocker->PerformDefaultAction(args, call_description));
-  }
-
-  // Performs the given action and returns the result in a
-  // ActionResultHolder.
-  template <typename Function, typename Arguments>
-  static ActionResultHolder PerformAction(const Action<Function>& action,
-                                          const Arguments& args) {
-    return ActionResultHolder(action.Perform(args));
-  }
-
- private:
-  T value_;
-};
-
-// Specialization for T = void.
-template <>
-class ActionResultHolder<void> {
- public:
-  ActionResultHolder() {}
-  void value() const {}
-  void PrintAsActionResult(::std::ostream* /* os */) const {}
-
-  template <typename Function, typename Arguments>
-  static ActionResultHolder PerformDefaultAction(
-      const FunctionMockerBase<Function>* func_mocker,
-      const Arguments& args,
-      const string& call_description) {
-    func_mocker->PerformDefaultAction(args, call_description);
-    return ActionResultHolder();
-  }
-
-  template <typename Function, typename Arguments>
-  static ActionResultHolder PerformAction(const Action<Function>& action,
-                                          const Arguments& args) {
-    action.Perform(args);
-    return ActionResultHolder();
-  }
-};
-
-// The base of the function mocker class for the given function type.
-// We put the methods in this class instead of its child to avoid code
-// bloat.
-template <typename F>
-class FunctionMockerBase : public UntypedFunctionMockerBase {
- public:
-  typedef typename Function<F>::Result Result;
-  typedef typename Function<F>::ArgumentTuple ArgumentTuple;
-  typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple;
-
-  FunctionMockerBase() : mock_obj_(NULL), name_(""), current_spec_(this) {}
-
-  // The destructor verifies that all expectations on this mock
-  // function have been satisfied.  If not, it will report Google Test
-  // non-fatal failures for the violations.
-  // L < g_gmock_mutex
-  virtual ~FunctionMockerBase() {
-    MutexLock l(&g_gmock_mutex);
-    VerifyAndClearExpectationsLocked();
-    Mock::UnregisterLocked(this);
-  }
-
-  // Returns the ON_CALL spec that matches this mock function with the
-  // given arguments; returns NULL if no matching ON_CALL is found.
-  // L = *
-  const DefaultActionSpec<F>* FindDefaultActionSpec(
-      const ArgumentTuple& args) const {
-    for (typename std::vector<DefaultActionSpec<F> >::const_reverse_iterator it
-             = default_actions_.rbegin();
-         it != default_actions_.rend(); ++it) {
-      const DefaultActionSpec<F>& spec = *it;
-      if (spec.Matches(args))
-        return &spec;
-    }
-
-    return NULL;
-  }
-
-  // Performs the default action of this mock function on the given arguments
-  // and returns the result. Asserts with a helpful call descrption if there is
-  // no valid return value. This method doesn't depend on the mutable state of
-  // this object, and thus can be called concurrently without locking.
-  // L = *
-  Result PerformDefaultAction(const ArgumentTuple& args,
-                              const string& call_description) const {
-    const DefaultActionSpec<F>* const spec = FindDefaultActionSpec(args);
-    if (spec != NULL) {
-      return spec->GetAction().Perform(args);
-    }
-    Assert(DefaultValue<Result>::Exists(), "", -1,
-           call_description + "\n    The mock function has no default action "
-           "set, and its return type has no default value set.");
-    return DefaultValue<Result>::Get();
-  }
-
-  // Registers this function mocker and the mock object owning it;
-  // returns a reference to the function mocker object.  This is only
-  // called by the ON_CALL() and EXPECT_CALL() macros.
-  // L < g_gmock_mutex
-  FunctionMocker<F>& RegisterOwner(const void* mock_obj) {
-    {
-      MutexLock l(&g_gmock_mutex);
-      mock_obj_ = mock_obj;
-    }
-    Mock::Register(mock_obj, this);
-    return *::testing::internal::down_cast<FunctionMocker<F>*>(this);
-  }
-
-  // The following two functions are from UntypedFunctionMockerBase.
-
-  // Verifies that all expectations on this mock function have been
-  // satisfied.  Reports one or more Google Test non-fatal failures
-  // and returns false if not.
-  // L >= g_gmock_mutex
-  virtual bool VerifyAndClearExpectationsLocked();
-
-  // Clears the ON_CALL()s set on this mock function.
-  // L >= g_gmock_mutex
-  virtual void ClearDefaultActionsLocked() {
-    g_gmock_mutex.AssertHeld();
-    default_actions_.clear();
-  }
-
-  // Sets the name of the function being mocked.  Will be called upon
-  // each invocation of this mock function.
-  // L < g_gmock_mutex
-  void SetOwnerAndName(const void* mock_obj, const char* name) {
-    // We protect name_ under g_gmock_mutex in case this mock function
-    // is called from two threads concurrently.
-    MutexLock l(&g_gmock_mutex);
-    mock_obj_ = mock_obj;
-    name_ = name;
-  }
-
-  // Returns the address of the mock object this method belongs to.
-  // Must be called after SetOwnerAndName() has been called.
-  // L < g_gmock_mutex
-  const void* MockObject() const {
-    const void* mock_obj;
-    {
-      // We protect mock_obj_ under g_gmock_mutex in case this mock
-      // function is called from two threads concurrently.
-      MutexLock l(&g_gmock_mutex);
-      mock_obj = mock_obj_;
-    }
-    return mock_obj;
-  }
-
-  // Returns the name of the function being mocked.  Must be called
-  // after SetOwnerAndName() has been called.
-  // L < g_gmock_mutex
-  const char* Name() const {
-    const char* name;
-    {
-      // We protect name_ under g_gmock_mutex in case this mock
-      // function is called from two threads concurrently.
-      MutexLock l(&g_gmock_mutex);
-      name = name_;
-    }
-    return name;
-  }
- protected:
-  template <typename Function>
-  friend class MockSpec;
-
-  // Returns the result of invoking this mock function with the given
-  // arguments.  This function can be safely called from multiple
-  // threads concurrently.
-  // L < g_gmock_mutex
-  Result InvokeWith(const ArgumentTuple& args);
-
-  // Adds and returns a default action spec for this mock function.
-  // L < g_gmock_mutex
-  DefaultActionSpec<F>& AddNewDefaultActionSpec(
-      const char* file, int line,
-      const ArgumentMatcherTuple& m) {
-    Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line);
-    default_actions_.push_back(DefaultActionSpec<F>(file, line, m));
-    return default_actions_.back();
-  }
-
-  // Adds and returns an expectation spec for this mock function.
-  // L < g_gmock_mutex
-  TypedExpectation<F>& AddNewExpectation(
-      const char* file,
-      int line,
-      const string& source_text,
-      const ArgumentMatcherTuple& m) {
-    Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line);
-    const linked_ptr<TypedExpectation<F> > expectation(
-        new TypedExpectation<F>(this, file, line, source_text, m));
-    expectations_.push_back(expectation);
-
-    // Adds this expectation into the implicit sequence if there is one.
-    Sequence* const implicit_sequence = g_gmock_implicit_sequence.get();
-    if (implicit_sequence != NULL) {
-      implicit_sequence->AddExpectation(Expectation(expectation));
-    }
-
-    return *expectation;
-  }
-
-  // The current spec (either default action spec or expectation spec)
-  // being described on this function mocker.
-  MockSpec<F>& current_spec() { return current_spec_; }
- private:
-  template <typename Func> friend class TypedExpectation;
-
-  typedef std::vector<internal::linked_ptr<TypedExpectation<F> > >
-  TypedExpectations;
-
-  // Returns an Expectation object that references and co-owns exp,
-  // which must be an expectation on this mock function.
-  Expectation GetHandleOf(TypedExpectation<F>* exp) {
-    for (typename TypedExpectations::const_iterator it = expectations_.begin();
-         it != expectations_.end(); ++it) {
-      if (it->get() == exp) {
-        return Expectation(*it);
-      }
-    }
-
-    Assert(false, __FILE__, __LINE__, "Cannot find expectation.");
-    return Expectation();
-    // The above statement is just to make the code compile, and will
-    // never be executed.
-  }
-
-  // Some utilities needed for implementing InvokeWith().
-
-  // Describes what default action will be performed for the given
-  // arguments.
-  // L = *
-  void DescribeDefaultActionTo(const ArgumentTuple& args,
-                               ::std::ostream* os) const {
-    const DefaultActionSpec<F>* const spec = FindDefaultActionSpec(args);
-
-    if (spec == NULL) {
-      *os << (internal::type_equals<Result, void>::value ?
-              "returning directly.\n" :
-              "returning default value.\n");
-    } else {
-      *os << "taking default action specified at:\n"
-          << spec->file() << ":" << spec->line() << ":\n";
-    }
-  }
-
-  // Writes a message that the call is uninteresting (i.e. neither
-  // explicitly expected nor explicitly unexpected) to the given
-  // ostream.
-  // L < g_gmock_mutex
-  void DescribeUninterestingCall(const ArgumentTuple& args,
-                                 ::std::ostream* os) const {
-    *os << "Uninteresting mock function call - ";
-    DescribeDefaultActionTo(args, os);
-    *os << "    Function call: " << Name();
-    UniversalPrinter<ArgumentTuple>::Print(args, os);
-  }
-
-  // Critical section: We must find the matching expectation and the
-  // corresponding action that needs to be taken in an ATOMIC
-  // transaction.  Otherwise another thread may call this mock
-  // method in the middle and mess up the state.
-  //
-  // However, performing the action has to be left out of the critical
-  // section.  The reason is that we have no control on what the
-  // action does (it can invoke an arbitrary user function or even a
-  // mock function) and excessive locking could cause a dead lock.
-  // L < g_gmock_mutex
-  bool FindMatchingExpectationAndAction(
-      const ArgumentTuple& args, TypedExpectation<F>** exp, Action<F>* action,
-      bool* is_excessive, ::std::ostream* what, ::std::ostream* why) {
-    MutexLock l(&g_gmock_mutex);
-    *exp = this->FindMatchingExpectationLocked(args);
-    if (*exp == NULL) {  // A match wasn't found.
-      *action = DoDefault();
-      this->FormatUnexpectedCallMessageLocked(args, what, why);
-      return false;
-    }
-
-    // This line must be done before calling GetActionForArguments(),
-    // which will increment the call count for *exp and thus affect
-    // its saturation status.
-    *is_excessive = (*exp)->IsSaturated();
-    *action = (*exp)->GetActionForArguments(this, args, what, why);
-    return true;
-  }
-
-  // Returns the expectation that matches the arguments, or NULL if no
-  // expectation matches them.
-  // L >= g_gmock_mutex
-  TypedExpectation<F>* FindMatchingExpectationLocked(
-      const ArgumentTuple& args) const {
-    g_gmock_mutex.AssertHeld();
-    for (typename TypedExpectations::const_reverse_iterator it =
-             expectations_.rbegin();
-         it != expectations_.rend(); ++it) {
-      TypedExpectation<F>* const exp = it->get();
-      if (exp->ShouldHandleArguments(args)) {
-        return exp;
-      }
-    }
-    return NULL;
-  }
-
-  // Returns a message that the arguments don't match any expectation.
-  // L >= g_gmock_mutex
-  void FormatUnexpectedCallMessageLocked(const ArgumentTuple& args,
-                                         ::std::ostream* os,
-                                         ::std::ostream* why) const {
-    g_gmock_mutex.AssertHeld();
-    *os << "\nUnexpected mock function call - ";
-    DescribeDefaultActionTo(args, os);
-    PrintTriedExpectationsLocked(args, why);
-  }
-
-  // Prints a list of expectations that have been tried against the
-  // current mock function call.
-  // L >= g_gmock_mutex
-  void PrintTriedExpectationsLocked(const ArgumentTuple& args,
-                                    ::std::ostream* why) const {
-    g_gmock_mutex.AssertHeld();
-    const int count = static_cast<int>(expectations_.size());
-    *why << "Google Mock tried the following " << count << " "
-         << (count == 1 ? "expectation, but it didn't match" :
-             "expectations, but none matched")
-         << ":\n";
-    for (int i = 0; i < count; i++) {
-      *why << "\n";
-      expectations_[i]->DescribeLocationTo(why);
-      if (count > 1) {
-        *why << "tried expectation #" << i << ": ";
-      }
-      *why << expectations_[i]->source_text() << "...\n";
-      expectations_[i]->DescribeMatchResultTo(args, why);
-      expectations_[i]->DescribeCallCountTo(why);
-    }
-  }
-
-  // Address of the mock object this mock method belongs to.  Only
-  // valid after this mock method has been called or
-  // ON_CALL/EXPECT_CALL has been invoked on it.
-  const void* mock_obj_;  // Protected by g_gmock_mutex.
-
-  // Name of the function being mocked.  Only valid after this mock
-  // method has been called.
-  const char* name_;  // Protected by g_gmock_mutex.
-
-  // The current spec (either default action spec or expectation spec)
-  // being described on this function mocker.
-  MockSpec<F> current_spec_;
-
-  // All default action specs for this function mocker.
-  std::vector<DefaultActionSpec<F> > default_actions_;
-  // All expectations for this function mocker.
-  TypedExpectations expectations_;
-
-  // There is no generally useful and implementable semantics of
-  // copying a mock object, so copying a mock is usually a user error.
-  // Thus we disallow copying function mockers.  If the user really
-  // wants to copy a mock object, he should implement his own copy
-  // operation, for example:
-  //
-  //   class MockFoo : public Foo {
-  //    public:
-  //     // Defines a copy constructor explicitly.
-  //     MockFoo(const MockFoo& src) {}
-  //     ...
-  //   };
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(FunctionMockerBase);
-};  // class FunctionMockerBase
-
-#ifdef _MSC_VER
-#pragma warning(pop)  // Restores the warning state.
-#endif  // _MSV_VER
-
-// Implements methods of FunctionMockerBase.
-
-// Verifies that all expectations on this mock function have been
-// satisfied.  Reports one or more Google Test non-fatal failures and
-// returns false if not.
-// L >= g_gmock_mutex
-template <typename F>
-bool FunctionMockerBase<F>::VerifyAndClearExpectationsLocked() {
-  g_gmock_mutex.AssertHeld();
-  bool expectations_met = true;
-  for (typename TypedExpectations::const_iterator it = expectations_.begin();
-       it != expectations_.end(); ++it) {
-    TypedExpectation<F>* const exp = it->get();
-
-    if (exp->IsOverSaturated()) {
-      // There was an upper-bound violation.  Since the error was
-      // already reported when it occurred, there is no need to do
-      // anything here.
-      expectations_met = false;
-    } else if (!exp->IsSatisfied()) {
-      expectations_met = false;
-      ::std::stringstream ss;
-      ss  << "Actual function call count doesn't match "
-          << exp->source_text() << "...\n";
-      // No need to show the source file location of the expectation
-      // in the description, as the Expect() call that follows already
-      // takes care of it.
-      exp->MaybeDescribeExtraMatcherTo(&ss);
-      exp->DescribeCallCountTo(&ss);
-      Expect(false, exp->file(), exp->line(), ss.str());
-    }
-  }
-  expectations_.clear();
-  return expectations_met;
-}
-
-// Reports an uninteresting call (whose description is in msg) in the
-// manner specified by 'reaction'.
-void ReportUninterestingCall(CallReaction reaction, const string& msg);
-
-// Calculates the result of invoking this mock function with the given
-// arguments, prints it, and returns it.
-// L < g_gmock_mutex
-template <typename F>
-typename Function<F>::Result FunctionMockerBase<F>::InvokeWith(
-    const typename Function<F>::ArgumentTuple& args) {
-  typedef ActionResultHolder<Result> ResultHolder;
-
-  if (expectations_.size() == 0) {
-    // No expectation is set on this mock method - we have an
-    // uninteresting call.
-
-    // We must get Google Mock's reaction on uninteresting calls
-    // made on this mock object BEFORE performing the action,
-    // because the action may DELETE the mock object and make the
-    // following expression meaningless.
-    const CallReaction reaction =
-        Mock::GetReactionOnUninterestingCalls(MockObject());
-
-    // True iff we need to print this call's arguments and return
-    // value.  This definition must be kept in sync with
-    // the behavior of ReportUninterestingCall().
-    const bool need_to_report_uninteresting_call =
-        // If the user allows this uninteresting call, we print it
-        // only when he wants informational messages.
-        reaction == ALLOW ? LogIsVisible(INFO) :
-        // If the user wants this to be a warning, we print it only
-        // when he wants to see warnings.
-        reaction == WARN ? LogIsVisible(WARNING) :
-        // Otherwise, the user wants this to be an error, and we
-        // should always print detailed information in the error.
-        true;
-
-    if (!need_to_report_uninteresting_call) {
-      // Perform the action without printing the call information.
-      return PerformDefaultAction(args, "");
-    }
-
-    // Warns about the uninteresting call.
-    ::std::stringstream ss;
-    DescribeUninterestingCall(args, &ss);
-
-    // Calculates the function result.
-    const ResultHolder result =
-        ResultHolder::PerformDefaultAction(this, args, ss.str());
-
-    // Prints the function result.
-    result.PrintAsActionResult(&ss);
-
-    ReportUninterestingCall(reaction, ss.str());
-    return result.value();
-  }
-
-  bool is_excessive = false;
-  ::std::stringstream ss;
-  ::std::stringstream why;
-  ::std::stringstream loc;
-  Action<F> action;
-  TypedExpectation<F>* exp;
-
-  // The FindMatchingExpectationAndAction() function acquires and
-  // releases g_gmock_mutex.
-  const bool found = FindMatchingExpectationAndAction(
-      args, &exp, &action, &is_excessive, &ss, &why);
-
-  // True iff we need to print the call's arguments and return value.
-  // This definition must be kept in sync with the uses of Expect()
-  // and Log() in this function.
-  const bool need_to_report_call = !found || is_excessive || LogIsVisible(INFO);
-  if (!need_to_report_call) {
-    // Perform the action without printing the call information.
-    return action.IsDoDefault() ? PerformDefaultAction(args, "") :
-        action.Perform(args);
-  }
-
-  ss << "    Function call: " << Name();
-  UniversalPrinter<ArgumentTuple>::Print(args, &ss);
-
-  // In case the action deletes a piece of the expectation, we
-  // generate the message beforehand.
-  if (found && !is_excessive) {
-    exp->DescribeLocationTo(&loc);
-  }
-
-  const ResultHolder result = action.IsDoDefault() ?
-      ResultHolder::PerformDefaultAction(this, args, ss.str()) :
-      ResultHolder::PerformAction(action, args);
-  result.PrintAsActionResult(&ss);
-  ss << "\n" << why.str();
-
-  if (!found) {
-    // No expectation matches this call - reports a failure.
-    Expect(false, NULL, -1, ss.str());
-  } else if (is_excessive) {
-    // We had an upper-bound violation and the failure message is in ss.
-    Expect(false, exp->file(), exp->line(), ss.str());
-  } else {
-    // We had an expected call and the matching expectation is
-    // described in ss.
-    Log(INFO, loc.str() + ss.str(), 2);
-  }
-  return result.value();
-}
-
-}  // namespace internal
-
-// The style guide prohibits "using" statements in a namespace scope
-// inside a header file.  However, the MockSpec class template is
-// meant to be defined in the ::testing namespace.  The following line
-// is just a trick for working around a bug in MSVC 8.0, which cannot
-// handle it if we define MockSpec in ::testing.
-using internal::MockSpec;
-
-// Const(x) is a convenient function for obtaining a const reference
-// to x.  This is useful for setting expectations on an overloaded
-// const mock method, e.g.
-//
-//   class MockFoo : public FooInterface {
-//    public:
-//     MOCK_METHOD0(Bar, int());
-//     MOCK_CONST_METHOD0(Bar, int&());
-//   };
-//
-//   MockFoo foo;
-//   // Expects a call to non-const MockFoo::Bar().
-//   EXPECT_CALL(foo, Bar());
-//   // Expects a call to const MockFoo::Bar().
-//   EXPECT_CALL(Const(foo), Bar());
-template <typename T>
-inline const T& Const(const T& x) { return x; }
-
-// Constructs an Expectation object that references and co-owns exp.
-inline Expectation::Expectation(internal::ExpectationBase& exp)  // NOLINT
-    : expectation_base_(exp.GetHandle().expectation_base()) {}
-
-}  // namespace testing
-
-// A separate macro is required to avoid compile errors when the name
-// of the method used in call is a result of macro expansion.
-// See CompilesWithMethodNameExpandedFromMacro tests in
-// internal/gmock-spec-builders_test.cc for more details.
-#define GMOCK_ON_CALL_IMPL_(obj, call) \
-    ((obj).gmock_##call).InternalDefaultActionSetAt(__FILE__, __LINE__, \
-                                                    #obj, #call)
-#define ON_CALL(obj, call) GMOCK_ON_CALL_IMPL_(obj, call)
-
-#define GMOCK_EXPECT_CALL_IMPL_(obj, call) \
-    ((obj).gmock_##call).InternalExpectedAt(__FILE__, __LINE__, #obj, #call)
-#define EXPECT_CALL(obj, call) GMOCK_EXPECT_CALL_IMPL_(obj, call)
-
-#endif  // GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
diff --git a/third_party/gmock/include/gmock/gmock.h b/third_party/gmock/include/gmock/gmock.h
deleted file mode 100644
index daf5288..0000000
--- a/third_party/gmock/include/gmock/gmock.h
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This is the main header file a user should include.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_H_
-
-// This file implements the following syntax:
-//
-//   ON_CALL(mock_object.Method(...))
-//     .With(...) ?
-//     .WillByDefault(...);
-//
-// where With() is optional and WillByDefault() must appear exactly
-// once.
-//
-//   EXPECT_CALL(mock_object.Method(...))
-//     .With(...) ?
-//     .Times(...) ?
-//     .InSequence(...) *
-//     .WillOnce(...) *
-//     .WillRepeatedly(...) ?
-//     .RetiresOnSaturation() ? ;
-//
-// where all clauses are optional and WillOnce() can be repeated.
-
-#include <gmock/gmock-actions.h>
-#include <gmock/gmock-cardinalities.h>
-#include <gmock/gmock-generated-actions.h>
-#include <gmock/gmock-generated-function-mockers.h>
-#include <gmock/gmock-generated-matchers.h>
-#include <gmock/gmock-more-actions.h>
-#include <gmock/gmock-generated-nice-strict.h>
-#include <gmock/gmock-matchers.h>
-#include <gmock/gmock-printers.h>
-#include <gmock/internal/gmock-internal-utils.h>
-
-namespace testing {
-
-// Declares Google Mock flags that we want a user to use programmatically.
-GMOCK_DECLARE_bool_(catch_leaked_mocks);
-GMOCK_DECLARE_string_(verbose);
-
-// Initializes Google Mock.  This must be called before running the
-// tests.  In particular, it parses the command line for the flags
-// that Google Mock recognizes.  Whenever a Google Mock flag is seen,
-// it is removed from argv, and *argc is decremented.
-//
-// No value is returned.  Instead, the Google Mock flag variables are
-// updated.
-//
-// Since Google Test is needed for Google Mock to work, this function
-// also initializes Google Test and parses its flags, if that hasn't
-// been done.
-void InitGoogleMock(int* argc, char** argv);
-
-// This overloaded version can be used in Windows programs compiled in
-// UNICODE mode.
-void InitGoogleMock(int* argc, wchar_t** argv);
-
-}  // namespace testing
-
-#endif  // GMOCK_INCLUDE_GMOCK_GMOCK_H_
diff --git a/third_party/gmock/include/gmock/internal/gmock-generated-internal-utils.h b/third_party/gmock/include/gmock/internal/gmock-generated-internal-utils.h
deleted file mode 100644
index 6386b05..0000000
--- a/third_party/gmock/include/gmock/internal/gmock-generated-internal-utils.h
+++ /dev/null
@@ -1,277 +0,0 @@
-// This file was GENERATED by a script.  DO NOT EDIT BY HAND!!!
-
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file contains template meta-programming utility classes needed
-// for implementing Google Mock.
-
-#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
-#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
-
-#include <gmock/internal/gmock-port.h>
-
-namespace testing {
-
-template <typename T>
-class Matcher;
-
-namespace internal {
-
-// An IgnoredValue object can be implicitly constructed from ANY value.
-// This is used in implementing the IgnoreResult(a) action.
-class IgnoredValue {
- public:
-  // This constructor template allows any value to be implicitly
-  // converted to IgnoredValue.  The object has no data member and
-  // doesn't try to remember anything about the argument.  We
-  // deliberately omit the 'explicit' keyword in order to allow the
-  // conversion to be implicit.
-  template <typename T>
-  IgnoredValue(const T&) {}
-};
-
-// MatcherTuple<T>::type is a tuple type where each field is a Matcher
-// for the corresponding field in tuple type T.
-template <typename Tuple>
-struct MatcherTuple;
-
-template <>
-struct MatcherTuple< ::std::tr1::tuple<> > {
-  typedef ::std::tr1::tuple< > type;
-};
-
-template <typename A1>
-struct MatcherTuple< ::std::tr1::tuple<A1> > {
-  typedef ::std::tr1::tuple<Matcher<A1> > type;
-};
-
-template <typename A1, typename A2>
-struct MatcherTuple< ::std::tr1::tuple<A1, A2> > {
-  typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2> > type;
-};
-
-template <typename A1, typename A2, typename A3>
-struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3> > {
-  typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4>
-struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3, A4> > {
-  typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>,
-      Matcher<A4> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5>
-struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3, A4, A5> > {
-  typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
-      Matcher<A5> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5,
-    typename A6>
-struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3, A4, A5, A6> > {
-  typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
-      Matcher<A5>, Matcher<A6> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5,
-    typename A6, typename A7>
-struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7> > {
-  typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
-      Matcher<A5>, Matcher<A6>, Matcher<A7> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5,
-    typename A6, typename A7, typename A8>
-struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
-  typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
-      Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5,
-    typename A6, typename A7, typename A8, typename A9>
-struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
-  typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
-      Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>, Matcher<A9> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5,
-    typename A6, typename A7, typename A8, typename A9, typename A10>
-struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
-    A10> > {
-  typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
-      Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>, Matcher<A9>,
-      Matcher<A10> > type;
-};
-
-// Template struct Function<F>, where F must be a function type, contains
-// the following typedefs:
-//
-//   Result:               the function's return type.
-//   ArgumentN:            the type of the N-th argument, where N starts with 1.
-//   ArgumentTuple:        the tuple type consisting of all parameters of F.
-//   ArgumentMatcherTuple: the tuple type consisting of Matchers for all
-//                         parameters of F.
-//   MakeResultVoid:       the function type obtained by substituting void
-//                         for the return type of F.
-//   MakeResultIgnoredValue:
-//                         the function type obtained by substituting Something
-//                         for the return type of F.
-template <typename F>
-struct Function;
-
-template <typename R>
-struct Function<R()> {
-  typedef R Result;
-  typedef ::std::tr1::tuple<> ArgumentTuple;
-  typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
-  typedef void MakeResultVoid();
-  typedef IgnoredValue MakeResultIgnoredValue();
-};
-
-template <typename R, typename A1>
-struct Function<R(A1)>
-    : Function<R()> {
-  typedef A1 Argument1;
-  typedef ::std::tr1::tuple<A1> ArgumentTuple;
-  typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
-  typedef void MakeResultVoid(A1);
-  typedef IgnoredValue MakeResultIgnoredValue(A1);
-};
-
-template <typename R, typename A1, typename A2>
-struct Function<R(A1, A2)>
-    : Function<R(A1)> {
-  typedef A2 Argument2;
-  typedef ::std::tr1::tuple<A1, A2> ArgumentTuple;
-  typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
-  typedef void MakeResultVoid(A1, A2);
-  typedef IgnoredValue MakeResultIgnoredValue(A1, A2);
-};
-
-template <typename R, typename A1, typename A2, typename A3>
-struct Function<R(A1, A2, A3)>
-    : Function<R(A1, A2)> {
-  typedef A3 Argument3;
-  typedef ::std::tr1::tuple<A1, A2, A3> ArgumentTuple;
-  typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
-  typedef void MakeResultVoid(A1, A2, A3);
-  typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4>
-struct Function<R(A1, A2, A3, A4)>
-    : Function<R(A1, A2, A3)> {
-  typedef A4 Argument4;
-  typedef ::std::tr1::tuple<A1, A2, A3, A4> ArgumentTuple;
-  typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
-  typedef void MakeResultVoid(A1, A2, A3, A4);
-  typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
-    typename A5>
-struct Function<R(A1, A2, A3, A4, A5)>
-    : Function<R(A1, A2, A3, A4)> {
-  typedef A5 Argument5;
-  typedef ::std::tr1::tuple<A1, A2, A3, A4, A5> ArgumentTuple;
-  typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
-  typedef void MakeResultVoid(A1, A2, A3, A4, A5);
-  typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
-    typename A5, typename A6>
-struct Function<R(A1, A2, A3, A4, A5, A6)>
-    : Function<R(A1, A2, A3, A4, A5)> {
-  typedef A6 Argument6;
-  typedef ::std::tr1::tuple<A1, A2, A3, A4, A5, A6> ArgumentTuple;
-  typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
-  typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6);
-  typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
-    typename A5, typename A6, typename A7>
-struct Function<R(A1, A2, A3, A4, A5, A6, A7)>
-    : Function<R(A1, A2, A3, A4, A5, A6)> {
-  typedef A7 Argument7;
-  typedef ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7> ArgumentTuple;
-  typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
-  typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7);
-  typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
-    typename A5, typename A6, typename A7, typename A8>
-struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8)>
-    : Function<R(A1, A2, A3, A4, A5, A6, A7)> {
-  typedef A8 Argument8;
-  typedef ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8> ArgumentTuple;
-  typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
-  typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8);
-  typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
-    typename A5, typename A6, typename A7, typename A8, typename A9>
-struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)>
-    : Function<R(A1, A2, A3, A4, A5, A6, A7, A8)> {
-  typedef A9 Argument9;
-  typedef ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> ArgumentTuple;
-  typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
-  typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9);
-  typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8,
-      A9);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
-    typename A5, typename A6, typename A7, typename A8, typename A9,
-    typename A10>
-struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)>
-    : Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
-  typedef A10 Argument10;
-  typedef ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
-      A10> ArgumentTuple;
-  typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
-  typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
-  typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8,
-      A9, A10);
-};
-
-}  // namespace internal
-
-}  // namespace testing
-
-#endif  // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
diff --git a/third_party/gmock/include/gmock/internal/gmock-internal-utils.h b/third_party/gmock/include/gmock/internal/gmock-internal-utils.h
deleted file mode 100644
index 7b17335..0000000
--- a/third_party/gmock/include/gmock/internal/gmock-internal-utils.h
+++ /dev/null
@@ -1,763 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file defines some utilities useful for implementing Google
-// Mock.  They are subject to change without notice, so please DO NOT
-// USE THEM IN USER CODE.
-
-#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
-#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
-
-#include <stdio.h>
-#include <ostream>  // NOLINT
-#include <string>
-
-#include <gmock/internal/gmock-generated-internal-utils.h>
-#include <gmock/internal/gmock-port.h>
-#include <gtest/gtest.h>
-
-// Concatenates two pre-processor symbols; works for concatenating
-// built-in macros like __FILE__ and __LINE__.
-#define GMOCK_CONCAT_TOKEN_IMPL_(foo, bar) foo##bar
-#define GMOCK_CONCAT_TOKEN_(foo, bar) GMOCK_CONCAT_TOKEN_IMPL_(foo, bar)
-
-#ifdef __GNUC__
-#define GMOCK_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
-#else
-#define GMOCK_ATTRIBUTE_UNUSED_
-#endif  // __GNUC__
-
-class ProtocolMessage;
-namespace proto2 { class Message; }
-
-namespace testing {
-namespace internal {
-
-// Converts an identifier name to a space-separated list of lower-case
-// words.  Each maximum substring of the form [A-Za-z][a-z]*|\d+ is
-// treated as one word.  For example, both "FooBar123" and
-// "foo_bar_123" are converted to "foo bar 123".
-string ConvertIdentifierNameToWords(const char* id_name);
-
-// Defining a variable of type CompileAssertTypesEqual<T1, T2> will cause a
-// compiler error iff T1 and T2 are different types.
-template <typename T1, typename T2>
-struct CompileAssertTypesEqual;
-
-template <typename T>
-struct CompileAssertTypesEqual<T, T> {
-};
-
-// Removes the reference from a type if it is a reference type,
-// otherwise leaves it unchanged.  This is the same as
-// tr1::remove_reference, which is not widely available yet.
-template <typename T>
-struct RemoveReference { typedef T type; };  // NOLINT
-template <typename T>
-struct RemoveReference<T&> { typedef T type; };  // NOLINT
-
-// A handy wrapper around RemoveReference that works when the argument
-// T depends on template parameters.
-#define GMOCK_REMOVE_REFERENCE_(T) \
-    typename ::testing::internal::RemoveReference<T>::type
-
-// Removes const from a type if it is a const type, otherwise leaves
-// it unchanged.  This is the same as tr1::remove_const, which is not
-// widely available yet.
-template <typename T>
-struct RemoveConst { typedef T type; };  // NOLINT
-template <typename T>
-struct RemoveConst<const T> { typedef T type; };  // NOLINT
-
-// MSVC 8.0 has a bug which causes the above definition to fail to
-// remove the const in 'const int[3]'.  The following specialization
-// works around the bug.  However, it causes trouble with gcc and thus
-// needs to be conditionally compiled.
-#ifdef _MSC_VER
-template <typename T, size_t N>
-struct RemoveConst<T[N]> {
-  typedef typename RemoveConst<T>::type type[N];
-};
-#endif  // _MSC_VER
-
-// A handy wrapper around RemoveConst that works when the argument
-// T depends on template parameters.
-#define GMOCK_REMOVE_CONST_(T) \
-    typename ::testing::internal::RemoveConst<T>::type
-
-// Adds reference to a type if it is not a reference type,
-// otherwise leaves it unchanged.  This is the same as
-// tr1::add_reference, which is not widely available yet.
-template <typename T>
-struct AddReference { typedef T& type; };  // NOLINT
-template <typename T>
-struct AddReference<T&> { typedef T& type; };  // NOLINT
-
-// A handy wrapper around AddReference that works when the argument T
-// depends on template parameters.
-#define GMOCK_ADD_REFERENCE_(T) \
-    typename ::testing::internal::AddReference<T>::type
-
-// Adds a reference to const on top of T as necessary.  For example,
-// it transforms
-//
-//   char         ==> const char&
-//   const char   ==> const char&
-//   char&        ==> const char&
-//   const char&  ==> const char&
-//
-// The argument T must depend on some template parameters.
-#define GMOCK_REFERENCE_TO_CONST_(T) \
-    GMOCK_ADD_REFERENCE_(const GMOCK_REMOVE_REFERENCE_(T))
-
-// PointeeOf<Pointer>::type is the type of a value pointed to by a
-// Pointer, which can be either a smart pointer or a raw pointer.  The
-// following default implementation is for the case where Pointer is a
-// smart pointer.
-template <typename Pointer>
-struct PointeeOf {
-  // Smart pointer classes define type element_type as the type of
-  // their pointees.
-  typedef typename Pointer::element_type type;
-};
-// This specialization is for the raw pointer case.
-template <typename T>
-struct PointeeOf<T*> { typedef T type; };  // NOLINT
-
-// GetRawPointer(p) returns the raw pointer underlying p when p is a
-// smart pointer, or returns p itself when p is already a raw pointer.
-// The following default implementation is for the smart pointer case.
-template <typename Pointer>
-inline typename Pointer::element_type* GetRawPointer(const Pointer& p) {
-  return p.get();
-}
-// This overloaded version is for the raw pointer case.
-template <typename Element>
-inline Element* GetRawPointer(Element* p) { return p; }
-
-// This comparator allows linked_ptr to be stored in sets.
-template <typename T>
-struct LinkedPtrLessThan {
-  bool operator()(const ::testing::internal::linked_ptr<T>& lhs,
-                  const ::testing::internal::linked_ptr<T>& rhs) const {
-    return lhs.get() < rhs.get();
-  }
-};
-
-// ImplicitlyConvertible<From, To>::value is a compile-time bool
-// constant that's true iff type From can be implicitly converted to
-// type To.
-template <typename From, typename To>
-class ImplicitlyConvertible {
- private:
-  // We need the following helper functions only for their types.
-  // They have no implementations.
-
-  // MakeFrom() is an expression whose type is From.  We cannot simply
-  // use From(), as the type From may not have a public default
-  // constructor.
-  static From MakeFrom();
-
-  // These two functions are overloaded.  Given an expression
-  // Helper(x), the compiler will pick the first version if x can be
-  // implicitly converted to type To; otherwise it will pick the
-  // second version.
-  //
-  // The first version returns a value of size 1, and the second
-  // version returns a value of size 2.  Therefore, by checking the
-  // size of Helper(x), which can be done at compile time, we can tell
-  // which version of Helper() is used, and hence whether x can be
-  // implicitly converted to type To.
-  static char Helper(To);
-  static char (&Helper(...))[2];  // NOLINT
-
-  // We have to put the 'public' section after the 'private' section,
-  // or MSVC refuses to compile the code.
- public:
-  // MSVC warns about implicitly converting from double to int for
-  // possible loss of data, so we need to temporarily disable the
-  // warning.
-#ifdef _MSC_VER
-#pragma warning(push)          // Saves the current warning state.
-#pragma warning(disable:4244)  // Temporarily disables warning 4244.
-  static const bool value =
-      sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
-#pragma warning(pop)           // Restores the warning state.
-#else
-  static const bool value =
-      sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
-#endif  // _MSV_VER
-};
-template <typename From, typename To>
-const bool ImplicitlyConvertible<From, To>::value;
-
-// Symbian compilation can be done with wchar_t being either a native
-// type or a typedef.  Using Google Mock with OpenC without wchar_t
-// should require the definition of _STLP_NO_WCHAR_T.
-//
-// MSVC treats wchar_t as a native type usually, but treats it as the
-// same as unsigned short when the compiler option /Zc:wchar_t- is
-// specified.  It defines _NATIVE_WCHAR_T_DEFINED symbol when wchar_t
-// is a native type.
-#if (GTEST_OS_SYMBIAN && defined(_STLP_NO_WCHAR_T)) || \
-    (defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED))
-// wchar_t is a typedef.
-#else
-#define GMOCK_WCHAR_T_IS_NATIVE_ 1
-#endif
-
-// signed wchar_t and unsigned wchar_t are NOT in the C++ standard.
-// Using them is a bad practice and not portable.  So DON'T use them.
-//
-// Still, Google Mock is designed to work even if the user uses signed
-// wchar_t or unsigned wchar_t (obviously, assuming the compiler
-// supports them).
-//
-// To gcc,
-//   wchar_t == signed wchar_t != unsigned wchar_t == unsigned int
-#ifdef __GNUC__
-#define GMOCK_HAS_SIGNED_WCHAR_T_ 1  // signed/unsigned wchar_t are valid types.
-#endif
-
-// In what follows, we use the term "kind" to indicate whether a type
-// is bool, an integer type (excluding bool), a floating-point type,
-// or none of them.  This categorization is useful for determining
-// when a matcher argument type can be safely converted to another
-// type in the implementation of SafeMatcherCast.
-enum TypeKind {
-  kBool, kInteger, kFloatingPoint, kOther
-};
-
-// KindOf<T>::value is the kind of type T.
-template <typename T> struct KindOf {
-  enum { value = kOther };  // The default kind.
-};
-
-// This macro declares that the kind of 'type' is 'kind'.
-#define GMOCK_DECLARE_KIND_(type, kind) \
-  template <> struct KindOf<type> { enum { value = kind }; }
-
-GMOCK_DECLARE_KIND_(bool, kBool);
-
-// All standard integer types.
-GMOCK_DECLARE_KIND_(char, kInteger);
-GMOCK_DECLARE_KIND_(signed char, kInteger);
-GMOCK_DECLARE_KIND_(unsigned char, kInteger);
-GMOCK_DECLARE_KIND_(short, kInteger);  // NOLINT
-GMOCK_DECLARE_KIND_(unsigned short, kInteger);  // NOLINT
-GMOCK_DECLARE_KIND_(int, kInteger);
-GMOCK_DECLARE_KIND_(unsigned int, kInteger);
-GMOCK_DECLARE_KIND_(long, kInteger);  // NOLINT
-GMOCK_DECLARE_KIND_(unsigned long, kInteger);  // NOLINT
-
-#if GMOCK_WCHAR_T_IS_NATIVE_
-GMOCK_DECLARE_KIND_(wchar_t, kInteger);
-#endif
-
-// Non-standard integer types.
-GMOCK_DECLARE_KIND_(Int64, kInteger);
-GMOCK_DECLARE_KIND_(UInt64, kInteger);
-
-// All standard floating-point types.
-GMOCK_DECLARE_KIND_(float, kFloatingPoint);
-GMOCK_DECLARE_KIND_(double, kFloatingPoint);
-GMOCK_DECLARE_KIND_(long double, kFloatingPoint);
-
-#undef GMOCK_DECLARE_KIND_
-
-// Evaluates to the kind of 'type'.
-#define GMOCK_KIND_OF_(type) \
-  static_cast< ::testing::internal::TypeKind>( \
-      ::testing::internal::KindOf<type>::value)
-
-// Evaluates to true iff integer type T is signed.
-#define GMOCK_IS_SIGNED_(T) (static_cast<T>(-1) < 0)
-
-// LosslessArithmeticConvertibleImpl<kFromKind, From, kToKind, To>::value
-// is true iff arithmetic type From can be losslessly converted to
-// arithmetic type To.
-//
-// It's the user's responsibility to ensure that both From and To are
-// raw (i.e. has no CV modifier, is not a pointer, and is not a
-// reference) built-in arithmetic types, kFromKind is the kind of
-// From, and kToKind is the kind of To; the value is
-// implementation-defined when the above pre-condition is violated.
-template <TypeKind kFromKind, typename From, TypeKind kToKind, typename To>
-struct LosslessArithmeticConvertibleImpl : public false_type {};
-
-// Converting bool to bool is lossless.
-template <>
-struct LosslessArithmeticConvertibleImpl<kBool, bool, kBool, bool>
-    : public true_type {};  // NOLINT
-
-// Converting bool to any integer type is lossless.
-template <typename To>
-struct LosslessArithmeticConvertibleImpl<kBool, bool, kInteger, To>
-    : public true_type {};  // NOLINT
-
-// Converting bool to any floating-point type is lossless.
-template <typename To>
-struct LosslessArithmeticConvertibleImpl<kBool, bool, kFloatingPoint, To>
-    : public true_type {};  // NOLINT
-
-// Converting an integer to bool is lossy.
-template <typename From>
-struct LosslessArithmeticConvertibleImpl<kInteger, From, kBool, bool>
-    : public false_type {};  // NOLINT
-
-// Converting an integer to another non-bool integer is lossless iff
-// the target type's range encloses the source type's range.
-template <typename From, typename To>
-struct LosslessArithmeticConvertibleImpl<kInteger, From, kInteger, To>
-    : public bool_constant<
-      // When converting from a smaller size to a larger size, we are
-      // fine as long as we are not converting from signed to unsigned.
-      ((sizeof(From) < sizeof(To)) &&
-       (!GMOCK_IS_SIGNED_(From) || GMOCK_IS_SIGNED_(To))) ||
-      // When converting between the same size, the signedness must match.
-      ((sizeof(From) == sizeof(To)) &&
-       (GMOCK_IS_SIGNED_(From) == GMOCK_IS_SIGNED_(To)))> {};  // NOLINT
-
-#undef GMOCK_IS_SIGNED_
-
-// Converting an integer to a floating-point type may be lossy, since
-// the format of a floating-point number is implementation-defined.
-template <typename From, typename To>
-struct LosslessArithmeticConvertibleImpl<kInteger, From, kFloatingPoint, To>
-    : public false_type {};  // NOLINT
-
-// Converting a floating-point to bool is lossy.
-template <typename From>
-struct LosslessArithmeticConvertibleImpl<kFloatingPoint, From, kBool, bool>
-    : public false_type {};  // NOLINT
-
-// Converting a floating-point to an integer is lossy.
-template <typename From, typename To>
-struct LosslessArithmeticConvertibleImpl<kFloatingPoint, From, kInteger, To>
-    : public false_type {};  // NOLINT
-
-// Converting a floating-point to another floating-point is lossless
-// iff the target type is at least as big as the source type.
-template <typename From, typename To>
-struct LosslessArithmeticConvertibleImpl<
-  kFloatingPoint, From, kFloatingPoint, To>
-    : public bool_constant<sizeof(From) <= sizeof(To)> {};  // NOLINT
-
-// LosslessArithmeticConvertible<From, To>::value is true iff arithmetic
-// type From can be losslessly converted to arithmetic type To.
-//
-// It's the user's responsibility to ensure that both From and To are
-// raw (i.e. has no CV modifier, is not a pointer, and is not a
-// reference) built-in arithmetic types; the value is
-// implementation-defined when the above pre-condition is violated.
-template <typename From, typename To>
-struct LosslessArithmeticConvertible
-    : public LosslessArithmeticConvertibleImpl<
-  GMOCK_KIND_OF_(From), From, GMOCK_KIND_OF_(To), To> {};  // NOLINT
-
-// IsAProtocolMessage<T>::value is a compile-time bool constant that's
-// true iff T is type ProtocolMessage, proto2::Message, or a subclass
-// of those.
-template <typename T>
-struct IsAProtocolMessage
-    : public bool_constant<
-  ImplicitlyConvertible<const T*, const ::ProtocolMessage*>::value ||
-  ImplicitlyConvertible<const T*, const ::proto2::Message*>::value> {
-};
-
-// When the compiler sees expression IsContainerTest<C>(0), the first
-// overload of IsContainerTest will be picked if C is an STL-style
-// container class (since C::const_iterator* is a valid type and 0 can
-// be converted to it), while the second overload will be picked
-// otherwise (since C::const_iterator will be an invalid type in this
-// case).  Therefore, we can determine whether C is a container class
-// by checking the type of IsContainerTest<C>(0).  The value of the
-// expression is insignificant.
-typedef int IsContainer;
-template <class C>
-IsContainer IsContainerTest(typename C::const_iterator*) { return 0; }
-
-typedef char IsNotContainer;
-template <class C>
-IsNotContainer IsContainerTest(...) { return '\0'; }
-
-// This interface knows how to report a Google Mock failure (either
-// non-fatal or fatal).
-class FailureReporterInterface {
- public:
-  // The type of a failure (either non-fatal or fatal).
-  enum FailureType {
-    NONFATAL, FATAL
-  };
-
-  virtual ~FailureReporterInterface() {}
-
-  // Reports a failure that occurred at the given source file location.
-  virtual void ReportFailure(FailureType type, const char* file, int line,
-                             const string& message) = 0;
-};
-
-// Returns the failure reporter used by Google Mock.
-FailureReporterInterface* GetFailureReporter();
-
-// Asserts that condition is true; aborts the process with the given
-// message if condition is false.  We cannot use LOG(FATAL) or CHECK()
-// as Google Mock might be used to mock the log sink itself.  We
-// inline this function to prevent it from showing up in the stack
-// trace.
-inline void Assert(bool condition, const char* file, int line,
-                   const string& msg) {
-  if (!condition) {
-    GetFailureReporter()->ReportFailure(FailureReporterInterface::FATAL,
-                                        file, line, msg);
-  }
-}
-inline void Assert(bool condition, const char* file, int line) {
-  Assert(condition, file, line, "Assertion failed.");
-}
-
-// Verifies that condition is true; generates a non-fatal failure if
-// condition is false.
-inline void Expect(bool condition, const char* file, int line,
-                   const string& msg) {
-  if (!condition) {
-    GetFailureReporter()->ReportFailure(FailureReporterInterface::NONFATAL,
-                                        file, line, msg);
-  }
-}
-inline void Expect(bool condition, const char* file, int line) {
-  Expect(condition, file, line, "Expectation failed.");
-}
-
-// Severity level of a log.
-enum LogSeverity {
-  INFO = 0,
-  WARNING = 1,
-};
-
-// Valid values for the --gmock_verbose flag.
-
-// All logs (informational and warnings) are printed.
-const char kInfoVerbosity[] = "info";
-// Only warnings are printed.
-const char kWarningVerbosity[] = "warning";
-// No logs are printed.
-const char kErrorVerbosity[] = "error";
-
-// Returns true iff a log with the given severity is visible according
-// to the --gmock_verbose flag.
-bool LogIsVisible(LogSeverity severity);
-
-// Prints the given message to stdout iff 'severity' >= the level
-// specified by the --gmock_verbose flag.  If stack_frames_to_skip >=
-// 0, also prints the stack trace excluding the top
-// stack_frames_to_skip frames.  In opt mode, any positive
-// stack_frames_to_skip is treated as 0, since we don't know which
-// function calls will be inlined by the compiler and need to be
-// conservative.
-void Log(LogSeverity severity, const string& message, int stack_frames_to_skip);
-
-// TODO(wan@google.com): group all type utilities together.
-
-// Type traits.
-
-// is_reference<T>::value is non-zero iff T is a reference type.
-template <typename T> struct is_reference : public false_type {};
-template <typename T> struct is_reference<T&> : public true_type {};
-
-// type_equals<T1, T2>::value is non-zero iff T1 and T2 are the same type.
-template <typename T1, typename T2> struct type_equals : public false_type {};
-template <typename T> struct type_equals<T, T> : public true_type {};
-
-// remove_reference<T>::type removes the reference from type T, if any.
-template <typename T> struct remove_reference { typedef T type; };  // NOLINT
-template <typename T> struct remove_reference<T&> { typedef T type; }; // NOLINT
-
-// Invalid<T>() returns an invalid value of type T.  This is useful
-// when a value of type T is needed for compilation, but the statement
-// will not really be executed (or we don't care if the statement
-// crashes).
-template <typename T>
-inline T Invalid() {
-  return *static_cast<typename remove_reference<T>::type*>(NULL);
-}
-template <>
-inline void Invalid<void>() {}
-
-// Utilities for native arrays.
-
-// ArrayEq() compares two k-dimensional native arrays using the
-// elements' operator==, where k can be any integer >= 0.  When k is
-// 0, ArrayEq() degenerates into comparing a single pair of values.
-
-template <typename T, typename U>
-bool ArrayEq(const T* lhs, size_t size, const U* rhs);
-
-// This generic version is used when k is 0.
-template <typename T, typename U>
-inline bool ArrayEq(const T& lhs, const U& rhs) { return lhs == rhs; }
-
-// This overload is used when k >= 1.
-template <typename T, typename U, size_t N>
-inline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) {
-  return internal::ArrayEq(lhs, N, rhs);
-}
-
-// This helper reduces code bloat.  If we instead put its logic inside
-// the previous ArrayEq() function, arrays with different sizes would
-// lead to different copies of the template code.
-template <typename T, typename U>
-bool ArrayEq(const T* lhs, size_t size, const U* rhs) {
-  for (size_t i = 0; i != size; i++) {
-    if (!internal::ArrayEq(lhs[i], rhs[i]))
-      return false;
-  }
-  return true;
-}
-
-// Finds the first element in the iterator range [begin, end) that
-// equals elem.  Element may be a native array type itself.
-template <typename Iter, typename Element>
-Iter ArrayAwareFind(Iter begin, Iter end, const Element& elem) {
-  for (Iter it = begin; it != end; ++it) {
-    if (internal::ArrayEq(*it, elem))
-      return it;
-  }
-  return end;
-}
-
-// CopyArray() copies a k-dimensional native array using the elements'
-// operator=, where k can be any integer >= 0.  When k is 0,
-// CopyArray() degenerates into copying a single value.
-
-template <typename T, typename U>
-void CopyArray(const T* from, size_t size, U* to);
-
-// This generic version is used when k is 0.
-template <typename T, typename U>
-inline void CopyArray(const T& from, U* to) { *to = from; }
-
-// This overload is used when k >= 1.
-template <typename T, typename U, size_t N>
-inline void CopyArray(const T(&from)[N], U(*to)[N]) {
-  internal::CopyArray(from, N, *to);
-}
-
-// This helper reduces code bloat.  If we instead put its logic inside
-// the previous CopyArray() function, arrays with different sizes
-// would lead to different copies of the template code.
-template <typename T, typename U>
-void CopyArray(const T* from, size_t size, U* to) {
-  for (size_t i = 0; i != size; i++) {
-    internal::CopyArray(from[i], to + i);
-  }
-}
-
-// The relation between an NativeArray object (see below) and the
-// native array it represents.
-enum RelationToSource {
-  kReference,  // The NativeArray references the native array.
-  kCopy        // The NativeArray makes a copy of the native array and
-               // owns the copy.
-};
-
-// Adapts a native array to a read-only STL-style container.  Instead
-// of the complete STL container concept, this adaptor only implements
-// members useful for Google Mock's container matchers.  New members
-// should be added as needed.  To simplify the implementation, we only
-// support Element being a raw type (i.e. having no top-level const or
-// reference modifier).  It's the client's responsibility to satisfy
-// this requirement.  Element can be an array type itself (hence
-// multi-dimensional arrays are supported).
-template <typename Element>
-class NativeArray {
- public:
-  // STL-style container typedefs.
-  typedef Element value_type;
-  typedef const Element* const_iterator;
-
-  // Constructs from a native array.
-  NativeArray(const Element* array, size_t count, RelationToSource relation) {
-    Init(array, count, relation);
-  }
-
-  // Copy constructor.
-  NativeArray(const NativeArray& rhs) {
-    Init(rhs.array_, rhs.size_, rhs.relation_to_source_);
-  }
-
-  ~NativeArray() {
-    // Ensures that the user doesn't instantiate NativeArray with a
-    // const or reference type.
-    testing::StaticAssertTypeEq<Element,
-        GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Element))>();
-    if (relation_to_source_ == kCopy)
-      delete[] array_;
-  }
-
-  // STL-style container methods.
-  size_t size() const { return size_; }
-  const_iterator begin() const { return array_; }
-  const_iterator end() const { return array_ + size_; }
-  bool operator==(const NativeArray& rhs) const {
-    return size() == rhs.size() &&
-        ArrayEq(begin(), size(), rhs.begin());
-  }
-
- private:
-  // Not implemented as we don't want to support assignment.
-  void operator=(const NativeArray& rhs);
-
-  // Initializes this object; makes a copy of the input array if
-  // 'relation' is kCopy.
-  void Init(const Element* array, size_t size, RelationToSource relation) {
-    if (relation == kReference) {
-      array_ = array;
-    } else {
-      Element* const copy = new Element[size];
-      CopyArray(array, size, copy);
-      array_ = copy;
-    }
-    size_ = size;
-    relation_to_source_ = relation;
-  }
-
-  const Element* array_;
-  size_t size_;
-  RelationToSource relation_to_source_;
-};
-
-// Given a raw type (i.e. having no top-level reference or const
-// modifier) RawContainer that's either an STL-style container or a
-// native array, class StlContainerView<RawContainer> has the
-// following members:
-//
-//   - type is a type that provides an STL-style container view to
-//     (i.e. implements the STL container concept for) RawContainer;
-//   - const_reference is a type that provides a reference to a const
-//     RawContainer;
-//   - ConstReference(raw_container) returns a const reference to an STL-style
-//     container view to raw_container, which is a RawContainer.
-//   - Copy(raw_container) returns an STL-style container view of a
-//     copy of raw_container, which is a RawContainer.
-//
-// This generic version is used when RawContainer itself is already an
-// STL-style container.
-template <class RawContainer>
-class StlContainerView {
- public:
-  typedef RawContainer type;
-  typedef const type& const_reference;
-
-  static const_reference ConstReference(const RawContainer& container) {
-    // Ensures that RawContainer is not a const type.
-    testing::StaticAssertTypeEq<RawContainer,
-        GMOCK_REMOVE_CONST_(RawContainer)>();
-    return container;
-  }
-  static type Copy(const RawContainer& container) { return container; }
-};
-
-// This specialization is used when RawContainer is a native array type.
-template <typename Element, size_t N>
-class StlContainerView<Element[N]> {
- public:
-  typedef GMOCK_REMOVE_CONST_(Element) RawElement;
-  typedef internal::NativeArray<RawElement> type;
-  // NativeArray<T> can represent a native array either by value or by
-  // reference (selected by a constructor argument), so 'const type'
-  // can be used to reference a const native array.  We cannot
-  // 'typedef const type& const_reference' here, as that would mean
-  // ConstReference() has to return a reference to a local variable.
-  typedef const type const_reference;
-
-  static const_reference ConstReference(const Element (&array)[N]) {
-    // Ensures that Element is not a const type.
-    testing::StaticAssertTypeEq<Element, RawElement>();
-#if GTEST_OS_SYMBIAN
-    // The Nokia Symbian compiler confuses itself in template instantiation
-    // for this call without the cast to Element*:
-    // function call '[testing::internal::NativeArray<char *>].NativeArray(
-    //     {lval} const char *[4], long, testing::internal::RelationToSource)'
-    //     does not match
-    // 'testing::internal::NativeArray<char *>::NativeArray(
-    //     char *const *, unsigned int, testing::internal::RelationToSource)'
-    // (instantiating: 'testing::internal::ContainsMatcherImpl
-    //     <const char * (&)[4]>::Matches(const char * (&)[4]) const')
-    // (instantiating: 'testing::internal::StlContainerView<char *[4]>::
-    //     ConstReference(const char * (&)[4])')
-    // (and though the N parameter type is mismatched in the above explicit
-    // conversion of it doesn't help - only the conversion of the array).
-    return type(const_cast<Element*>(&array[0]), N, kReference);
-#else
-    return type(array, N, kReference);
-#endif  // GTEST_OS_SYMBIAN
-  }
-  static type Copy(const Element (&array)[N]) {
-#if GTEST_OS_SYMBIAN
-    return type(const_cast<Element*>(&array[0]), N, kCopy);
-#else
-    return type(array, N, kCopy);
-#endif  // GTEST_OS_SYMBIAN
-  }
-};
-
-// This specialization is used when RawContainer is a native array
-// represented as a (pointer, size) tuple.
-template <typename ElementPointer, typename Size>
-class StlContainerView< ::std::tr1::tuple<ElementPointer, Size> > {
- public:
-  typedef GMOCK_REMOVE_CONST_(
-      typename internal::PointeeOf<ElementPointer>::type) RawElement;
-  typedef internal::NativeArray<RawElement> type;
-  typedef const type const_reference;
-
-  static const_reference ConstReference(
-      const ::std::tr1::tuple<ElementPointer, Size>& array) {
-    using ::std::tr1::get;
-    return type(get<0>(array), get<1>(array), kReference);
-  }
-  static type Copy(const ::std::tr1::tuple<ElementPointer, Size>& array) {
-    using ::std::tr1::get;
-    return type(get<0>(array), get<1>(array), kCopy);
-  }
-};
-
-// The following specialization prevents the user from instantiating
-// StlContainer with a reference type.
-template <typename T> class StlContainerView<T&>;
-
-}  // namespace internal
-}  // namespace testing
-
-#endif  // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
diff --git a/third_party/gmock/include/gmock/internal/gmock-port.h b/third_party/gmock/include/gmock/internal/gmock-port.h
deleted file mode 100644
index 649f838..0000000
--- a/third_party/gmock/include/gmock/internal/gmock-port.h
+++ /dev/null
@@ -1,235 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: vadimb@google.com (Vadim Berman)
-//
-// Low-level types and utilities for porting Google Mock to various
-// platforms.  They are subject to change without notice.  DO NOT USE
-// THEM IN USER CODE.
-
-#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
-#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
-
-#include <assert.h>
-#include <stdlib.h>
-#include <iostream>
-
-// Most of the types needed for porting Google Mock are also required
-// for Google Test and are defined in gtest-port.h.
-#include <gtest/internal/gtest-linked_ptr.h>
-#include <gtest/internal/gtest-port.h>
-
-// To avoid conditional compilation everywhere, we make it
-// gmock-port.h's responsibility to #include the header implementing
-// tr1/tuple.  gmock-port.h does this via gtest-port.h, which is
-// guaranteed to pull in the tuple header.
-
-#if GTEST_OS_LINUX
-
-// On some platforms, <regex.h> needs someone to define size_t, and
-// won't compile otherwise.  We can #include it here as we already
-// included <stdlib.h>, which is guaranteed to define size_t through
-// <stddef.h>.
-#include <regex.h>  // NOLINT
-
-// Defines this iff Google Mock uses the enhanced POSIX regular
-// expression syntax.  This is public as it affects how a user uses
-// regular expression matchers.
-#define GMOCK_USES_POSIX_RE 1
-
-#endif  // GTEST_OS_LINUX
-
-#if defined(GMOCK_USES_PCRE) || defined(GMOCK_USES_POSIX_RE)
-// Defines this iff regular expression matchers are supported.  This
-// is public as it tells a user whether he can use regular expression
-// matchers.
-#define GMOCK_HAS_REGEX 1
-#endif  // defined(GMOCK_USES_PCRE) || defined(GMOCK_USES_POSIX_RE)
-
-namespace testing {
-namespace internal {
-
-// For MS Visual C++, check the compiler version. At least VS 2003 is
-// required to compile Google Mock.
-#if defined(_MSC_VER) && _MSC_VER < 1310
-#error "At least Visual C++ 2003 (7.1) is required to compile Google Mock."
-#endif
-
-// Use implicit_cast as a safe version of static_cast for upcasting in
-// the type hierarchy (e.g. casting a Foo* to a SuperclassOfFoo* or a
-// const Foo*).  When you use implicit_cast, the compiler checks that
-// the cast is safe.  Such explicit implicit_casts are necessary in
-// surprisingly many situations where C++ demands an exact type match
-// instead of an argument type convertable to a target type.
-//
-// The syntax for using implicit_cast is the same as for static_cast:
-//
-//   implicit_cast<ToType>(expr)
-//
-// implicit_cast would have been part of the C++ standard library,
-// but the proposal was submitted too late.  It will probably make
-// its way into the language in the future.
-template<typename To>
-inline To implicit_cast(To x) { return x; }
-
-// When you upcast (that is, cast a pointer from type Foo to type
-// SuperclassOfFoo), it's fine to use implicit_cast<>, since upcasts
-// always succeed.  When you downcast (that is, cast a pointer from
-// type Foo to type SubclassOfFoo), static_cast<> isn't safe, because
-// how do you know the pointer is really of type SubclassOfFoo?  It
-// could be a bare Foo, or of type DifferentSubclassOfFoo.  Thus,
-// when you downcast, you should use this macro.  In debug mode, we
-// use dynamic_cast<> to double-check the downcast is legal (we die
-// if it's not).  In normal mode, we do the efficient static_cast<>
-// instead.  Thus, it's important to test in debug mode to make sure
-// the cast is legal!
-//    This is the only place in the code we should use dynamic_cast<>.
-// In particular, you SHOULDN'T be using dynamic_cast<> in order to
-// do RTTI (eg code like this:
-//    if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo);
-//    if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo);
-// You should design the code some other way not to need this.
-template<typename To, typename From>  // use like this: down_cast<T*>(foo);
-inline To down_cast(From* f) {  // so we only accept pointers
-  // Ensures that To is a sub-type of From *.  This test is here only
-  // for compile-time type checking, and has no overhead in an
-  // optimized build at run-time, as it will be optimized away
-  // completely.
-  if (false) {
-    const To to = NULL;
-    ::testing::internal::implicit_cast<From*>(to);
-  }
-
-#if GTEST_HAS_RTTI
-  assert(f == NULL || dynamic_cast<To>(f) != NULL);  // RTTI: debug mode only!
-#endif
-  return static_cast<To>(f);
-}
-
-// The GMOCK_COMPILE_ASSERT_ macro can be used to verify that a compile time
-// expression is true. For example, you could use it to verify the
-// size of a static array:
-//
-//   GMOCK_COMPILE_ASSERT_(ARRAYSIZE(content_type_names) == CONTENT_NUM_TYPES,
-//                         content_type_names_incorrect_size);
-//
-// or to make sure a struct is smaller than a certain size:
-//
-//   GMOCK_COMPILE_ASSERT_(sizeof(foo) < 128, foo_too_large);
-//
-// The second argument to the macro is the name of the variable. If
-// the expression is false, most compilers will issue a warning/error
-// containing the name of the variable.
-
-template <bool>
-struct CompileAssert {
-};
-
-#define GMOCK_COMPILE_ASSERT_(expr, msg) \
-  typedef ::testing::internal::CompileAssert<(bool(expr))> \
-      msg[bool(expr) ? 1 : -1]
-
-// Implementation details of GMOCK_COMPILE_ASSERT_:
-//
-// - GMOCK_COMPILE_ASSERT_ works by defining an array type that has -1
-//   elements (and thus is invalid) when the expression is false.
-//
-// - The simpler definition
-//
-//    #define GMOCK_COMPILE_ASSERT_(expr, msg) typedef char msg[(expr) ? 1 : -1]
-//
-//   does not work, as gcc supports variable-length arrays whose sizes
-//   are determined at run-time (this is gcc's extension and not part
-//   of the C++ standard).  As a result, gcc fails to reject the
-//   following code with the simple definition:
-//
-//     int foo;
-//     GMOCK_COMPILE_ASSERT_(foo, msg); // not supposed to compile as foo is
-//                                      // not a compile-time constant.
-//
-// - By using the type CompileAssert<(bool(expr))>, we ensures that
-//   expr is a compile-time constant.  (Template arguments must be
-//   determined at compile-time.)
-//
-// - The outter parentheses in CompileAssert<(bool(expr))> are necessary
-//   to work around a bug in gcc 3.4.4 and 4.0.1.  If we had written
-//
-//     CompileAssert<bool(expr)>
-//
-//   instead, these compilers will refuse to compile
-//
-//     GMOCK_COMPILE_ASSERT_(5 > 0, some_message);
-//
-//   (They seem to think the ">" in "5 > 0" marks the end of the
-//   template argument list.)
-//
-// - The array size is (bool(expr) ? 1 : -1), instead of simply
-//
-//     ((expr) ? 1 : -1).
-//
-//   This is to avoid running into a bug in MS VC 7.1, which
-//   causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1.
-
-#if GTEST_HAS_GLOBAL_STRING
-typedef ::string string;
-#elif GTEST_HAS_STD_STRING
-typedef ::std::string string;
-#else
-#error "Google Mock requires ::std::string to compile."
-#endif  // GTEST_HAS_GLOBAL_STRING
-
-#if GTEST_HAS_GLOBAL_WSTRING
-typedef ::wstring wstring;
-#elif GTEST_HAS_STD_WSTRING
-typedef ::std::wstring wstring;
-#endif  // GTEST_HAS_GLOBAL_WSTRING
-
-}  // namespace internal
-}  // namespace testing
-
-// Macro for referencing flags.  This is public as we want the user to
-// use this syntax to reference Google Mock flags.
-#define GMOCK_FLAG(name) FLAGS_gmock_##name
-
-// Macros for declaring flags.
-#define GMOCK_DECLARE_bool_(name) extern bool GMOCK_FLAG(name)
-#define GMOCK_DECLARE_int32_(name) \
-    extern ::testing::internal::Int32 GMOCK_FLAG(name)
-#define GMOCK_DECLARE_string_(name) \
-    extern ::testing::internal::String GMOCK_FLAG(name)
-
-// Macros for defining flags.
-#define GMOCK_DEFINE_bool_(name, default_val, doc) \
-    bool GMOCK_FLAG(name) = (default_val)
-#define GMOCK_DEFINE_int32_(name, default_val, doc) \
-    ::testing::internal::Int32 GMOCK_FLAG(name) = (default_val)
-#define GMOCK_DEFINE_string_(name, default_val, doc) \
-    ::testing::internal::String GMOCK_FLAG(name) = (default_val)
-
-#endif  // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
diff --git a/third_party/gmock/scripts/generator/COPYING b/third_party/gmock/scripts/generator/COPYING
deleted file mode 100644
index 87ea063..0000000
--- a/third_party/gmock/scripts/generator/COPYING
+++ /dev/null
@@ -1,203 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [2007] Neal Norwitz
-   Portions Copyright [2007] Google Inc.
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
diff --git a/third_party/gmock/scripts/generator/README b/third_party/gmock/scripts/generator/README
deleted file mode 100644
index d6f9597..0000000
--- a/third_party/gmock/scripts/generator/README
+++ /dev/null
@@ -1,35 +0,0 @@
-
-The Google Mock class generator is an application that is part of cppclean.
-For more information about cppclean, see the README.cppclean file or
-visit http://code.google.com/p/cppclean/
-
-cppclean requires Python 2.3.5 or later.  If you don't have Python installed
-on your system, you will also need to install it.  You can download Python
-from:  http://www.python.org/download/releases/
-
-To use the Google Mock class generator, you need to call it
-on the command line passing the header file and class for which you want
-to generate a Google Mock class.
-
-Make sure to install the scripts somewhere in your path.  Then you can
-run the program.
-
-  gmock_gen.py header-file.h [ClassName]...
-
-If no ClassNames are specified, all classes in the file are emitted.
-
-To change the indentation from the default of 2, set INDENT in
-the environment.  For example to use an indent of 4 spaces:
-
-INDENT=4 gmock_gen.py header-file.h ClassName
-
-This version was made from SVN revision 281 in the cppclean repository.
-
-Known Limitations
------------------
-Not all code will be generated properly.  For example, when mocking templated
-classes, the template information is lost.  You will need to add the template
-information manually.
-
-Not all permutations of using multiple pointers/references will be rendered
-properly.  These will also have to be fixed manually.
diff --git a/third_party/gmock/scripts/generator/README.cppclean b/third_party/gmock/scripts/generator/README.cppclean
deleted file mode 100644
index 65431b6..0000000
--- a/third_party/gmock/scripts/generator/README.cppclean
+++ /dev/null
@@ -1,115 +0,0 @@
-Goal:
------
-  CppClean attempts to find problems in C++ source that slow development
-  in large code bases, for example various forms of unused code.
-  Unused code can be unused functions, methods, data members, types, etc
-  to unnecessary #include directives.  Unnecessary #includes can cause
-  considerable extra compiles increasing the edit-compile-run cycle.
-
-  The project home page is:   http://code.google.com/p/cppclean/
-
-
-Features:
----------
- * Find and print C++ language constructs: classes, methods, functions, etc.
- * Find classes with virtual methods, no virtual destructor, and no bases
- * Find global/static data that are potential problems when using threads
- * Unnecessary forward class declarations
- * Unnecessary function declarations
- * Undeclared function definitions
- * (planned) Find unnecessary header files #included
-   - No direct reference to anything in the header
-   - Header is unnecessary if classes were forward declared instead
- * (planned) Source files that reference headers not directly #included,
-   ie, files that rely on a transitive #include from another header
- * (planned) Unused members (private, protected, & public) methods and data
- * (planned) Store AST in a SQL database so relationships can be queried
-
-AST is Abstract Syntax Tree, a representation of parsed source code.
-http://en.wikipedia.org/wiki/Abstract_syntax_tree
-
-
-System Requirements:
---------------------
- * Python 2.4 or later (2.3 probably works too)
- * Works on Windows (untested), Mac OS X, and Unix
-
-
-How to Run:
------------
-  For all examples, it is assumed that cppclean resides in a directory called
-  /cppclean.
-
-  To print warnings for classes with virtual methods, no virtual destructor and
-  no base classes:
-
-      /cppclean/run.sh nonvirtual_dtors.py file1.h file2.h file3.cc ...
-
-  To print all the functions defined in header file(s):
-
-      /cppclean/run.sh functions.py file1.h file2.h ...
-
-  All the commands take multiple files on the command line.  Other programs
-  include: find_warnings, headers, methods, and types.  Some other programs
-  are available, but used primarily for debugging.
-
-  run.sh is a simple wrapper that sets PYTHONPATH to /cppclean and then
-  runs the program in /cppclean/cpp/PROGRAM.py.  There is currently
-  no equivalent for Windows.  Contributions for a run.bat file
-  would be greatly appreciated.
-
-
-How to Configure:
------------------
-  You can add a siteheaders.py file in /cppclean/cpp to configure where
-  to look for other headers (typically -I options passed to a compiler).
-  Currently two values are supported:  _TRANSITIVE and GetIncludeDirs.
-  _TRANSITIVE should be set to a boolean value (True or False) indicating
-  whether to transitively process all header files.  The default is False.
-
-  GetIncludeDirs is a function that takes a single argument and returns
-  a sequence of directories to include.  This can be a generator or
-  return a static list.
-
-      def GetIncludeDirs(filename):
-          return ['/some/path/with/other/headers']
-
-      # Here is a more complicated example.
-      def GetIncludeDirs(filename):
-          yield '/path1'
-          yield os.path.join('/path2', os.path.dirname(filename))
-          yield '/path3'
-
-
-How to Test:
-------------
-  For all examples, it is assumed that cppclean resides in a directory called
-  /cppclean.  The tests require
-
-  cd /cppclean
-  make test
-  # To generate expected results after a change:
-  make expected
-
-
-Current Status:
----------------
-  The parser works pretty well for header files, parsing about 99% of Google's
-  header files.  Anything which inspects structure of C++ source files should
-  work reasonably well.  Function bodies are not transformed to an AST,
-  but left as tokens.  Much work is still needed on finding unused header files
-  and storing an AST in a database.
-
-
-Non-goals:
-----------
- * Parsing all valid C++ source
- * Handling invalid C++ source gracefully
- * Compiling to machine code (or anything beyond an AST)
-
-
-Contact:
---------
-  If you used cppclean, I would love to hear about your experiences
-  cppclean@googlegroups.com.  Even if you don't use cppclean, I'd like to
-  hear from you.  :-)  (You can contact me directly at:  nnorwitz@gmail.com)
diff --git a/third_party/gmock/scripts/generator/cpp/__init__.py b/third_party/gmock/scripts/generator/cpp/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/third_party/gmock/scripts/generator/cpp/__init__.py
+++ /dev/null
diff --git a/third_party/gmock/scripts/generator/cpp/ast.py b/third_party/gmock/scripts/generator/cpp/ast.py
deleted file mode 100644
index 47dc9a0..0000000
--- a/third_party/gmock/scripts/generator/cpp/ast.py
+++ /dev/null
@@ -1,1717 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2007 Neal Norwitz
-# Portions Copyright 2007 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Generate an Abstract Syntax Tree (AST) for C++."""
-
-__author__ = 'nnorwitz@google.com (Neal Norwitz)'
-
-
-# TODO:
-#  * Tokens should never be exported, need to convert to Nodes
-#    (return types, parameters, etc.)
-#  * Handle static class data for templatized classes
-#  * Handle casts (both C++ and C-style)
-#  * Handle conditions and loops (if/else, switch, for, while/do)
-#
-# TODO much, much later:
-#  * Handle #define
-#  * exceptions
-
-
-try:
-    # Python 3.x
-    import builtins
-except ImportError:
-    # Python 2.x
-    import __builtin__ as builtins
-
-import sys
-import traceback
-
-from cpp import keywords
-from cpp import tokenize
-from cpp import utils
-
-
-if not hasattr(builtins, 'reversed'):
-    # Support Python 2.3 and earlier.
-    def reversed(seq):
-        for i in range(len(seq)-1, -1, -1):
-            yield seq[i]
-
-if not hasattr(builtins, 'next'):
-    # Support Python 2.5 and earlier.
-    def next(obj):
-        return obj.next()
-
-
-VISIBILITY_PUBLIC, VISIBILITY_PROTECTED, VISIBILITY_PRIVATE = range(3)
-
-FUNCTION_NONE = 0x00
-FUNCTION_CONST = 0x01
-FUNCTION_VIRTUAL = 0x02
-FUNCTION_PURE_VIRTUAL = 0x04
-FUNCTION_CTOR = 0x08
-FUNCTION_DTOR = 0x10
-FUNCTION_ATTRIBUTE = 0x20
-FUNCTION_UNKNOWN_ANNOTATION = 0x40
-FUNCTION_THROW = 0x80
-
-"""
-These are currently unused.  Should really handle these properly at some point.
-
-TYPE_MODIFIER_INLINE   = 0x010000
-TYPE_MODIFIER_EXTERN   = 0x020000
-TYPE_MODIFIER_STATIC   = 0x040000
-TYPE_MODIFIER_CONST    = 0x080000
-TYPE_MODIFIER_REGISTER = 0x100000
-TYPE_MODIFIER_VOLATILE = 0x200000
-TYPE_MODIFIER_MUTABLE  = 0x400000
-
-TYPE_MODIFIER_MAP = {
-    'inline': TYPE_MODIFIER_INLINE,
-    'extern': TYPE_MODIFIER_EXTERN,
-    'static': TYPE_MODIFIER_STATIC,
-    'const': TYPE_MODIFIER_CONST,
-    'register': TYPE_MODIFIER_REGISTER,
-    'volatile': TYPE_MODIFIER_VOLATILE,
-    'mutable': TYPE_MODIFIER_MUTABLE,
-    }
-"""
-
-_INTERNAL_TOKEN = 'internal'
-_NAMESPACE_POP = 'ns-pop'
-
-
-# TODO(nnorwitz): use this as a singleton for templated_types, etc
-# where we don't want to create a new empty dict each time.  It is also const.
-class _NullDict(object):
-    __contains__ = lambda self: False
-    keys = values = items = iterkeys = itervalues = iteritems = lambda self: ()
-
-
-# TODO(nnorwitz): move AST nodes into a separate module.
-class Node(object):
-    """Base AST node."""
-
-    def __init__(self, start, end):
-        self.start = start
-        self.end = end
-
-    def IsDeclaration(self):
-        """Returns bool if this node is a declaration."""
-        return False
-
-    def IsDefinition(self):
-        """Returns bool if this node is a definition."""
-        return False
-
-    def IsExportable(self):
-        """Returns bool if this node exportable from a header file."""
-        return False
-
-    def Requires(self, node):
-        """Does this AST node require the definition of the node passed in?"""
-        return False
-
-    def XXX__str__(self):
-        return self._StringHelper(self.__class__.__name__, '')
-
-    def _StringHelper(self, name, suffix):
-        if not utils.DEBUG:
-            return '%s(%s)' % (name, suffix)
-        return '%s(%d, %d, %s)' % (name, self.start, self.end, suffix)
-
-    def __repr__(self):
-        return str(self)
-
-
-class Define(Node):
-    def __init__(self, start, end, name, definition):
-        Node.__init__(self, start, end)
-        self.name = name
-        self.definition = definition
-
-    def __str__(self):
-        value = '%s %s' % (self.name, self.definition)
-        return self._StringHelper(self.__class__.__name__, value)
-
-
-class Include(Node):
-    def __init__(self, start, end, filename, system):
-        Node.__init__(self, start, end)
-        self.filename = filename
-        self.system = system
-
-    def __str__(self):
-        fmt = '"%s"'
-        if self.system:
-            fmt = '<%s>'
-        return self._StringHelper(self.__class__.__name__, fmt % self.filename)
-
-
-class Goto(Node):
-    def __init__(self, start, end, label):
-        Node.__init__(self, start, end)
-        self.label = label
-
-    def __str__(self):
-        return self._StringHelper(self.__class__.__name__, str(self.label))
-
-
-class Expr(Node):
-    def __init__(self, start, end, expr):
-        Node.__init__(self, start, end)
-        self.expr = expr
-
-    def Requires(self, node):
-        # TODO(nnorwitz): impl.
-        return False
-
-    def __str__(self):
-        return self._StringHelper(self.__class__.__name__, str(self.expr))
-
-
-class Return(Expr):
-    pass
-
-
-class Delete(Expr):
-    pass
-
-
-class Friend(Expr):
-    def __init__(self, start, end, expr, namespace):
-        Expr.__init__(self, start, end, expr)
-        self.namespace = namespace[:]
-
-
-class Using(Node):
-    def __init__(self, start, end, names):
-        Node.__init__(self, start, end)
-        self.names = names
-
-    def __str__(self):
-        return self._StringHelper(self.__class__.__name__, str(self.names))
-
-
-class Parameter(Node):
-    def __init__(self, start, end, name, parameter_type, default):
-        Node.__init__(self, start, end)
-        self.name = name
-        self.type = parameter_type
-        self.default = default
-
-    def Requires(self, node):
-        # TODO(nnorwitz): handle namespaces, etc.
-        return self.type.name == node.name
-
-    def __str__(self):
-        name = str(self.type)
-        suffix = '%s %s' % (name, self.name)
-        if self.default:
-            suffix += ' = ' + ''.join([d.name for d in self.default])
-        return self._StringHelper(self.__class__.__name__, suffix)
-
-
-class _GenericDeclaration(Node):
-    def __init__(self, start, end, name, namespace):
-        Node.__init__(self, start, end)
-        self.name = name
-        self.namespace = namespace[:]
-
-    def FullName(self):
-        prefix = ''
-        if self.namespace and self.namespace[-1]:
-            prefix = '::'.join(self.namespace) + '::'
-        return prefix + self.name
-
-    def _TypeStringHelper(self, suffix):
-        if self.namespace:
-            names = [n or '<anonymous>' for n in self.namespace]
-            suffix += ' in ' + '::'.join(names)
-        return self._StringHelper(self.__class__.__name__, suffix)
-
-
-# TODO(nnorwitz): merge with Parameter in some way?
-class VariableDeclaration(_GenericDeclaration):
-    def __init__(self, start, end, name, var_type, initial_value, namespace):
-        _GenericDeclaration.__init__(self, start, end, name, namespace)
-        self.type = var_type
-        self.initial_value = initial_value
-
-    def Requires(self, node):
-        # TODO(nnorwitz): handle namespaces, etc.
-        return self.type.name == node.name
-
-    def ToString(self):
-        """Return a string that tries to reconstitute the variable decl."""
-        suffix = '%s %s' % (self.type, self.name)
-        if self.initial_value:
-            suffix += ' = ' + self.initial_value
-        return suffix
-
-    def __str__(self):
-        return self._StringHelper(self.__class__.__name__, self.ToString())
-
-
-class Typedef(_GenericDeclaration):
-    def __init__(self, start, end, name, alias, namespace):
-        _GenericDeclaration.__init__(self, start, end, name, namespace)
-        self.alias = alias
-
-    def IsDefinition(self):
-        return True
-
-    def IsExportable(self):
-        return True
-
-    def Requires(self, node):
-        # TODO(nnorwitz): handle namespaces, etc.
-        name = node.name
-        for token in self.alias:
-            if token is not None and name == token.name:
-                return True
-        return False
-
-    def __str__(self):
-        suffix = '%s, %s' % (self.name, self.alias)
-        return self._TypeStringHelper(suffix)
-
-
-class _NestedType(_GenericDeclaration):
-    def __init__(self, start, end, name, fields, namespace):
-        _GenericDeclaration.__init__(self, start, end, name, namespace)
-        self.fields = fields
-
-    def IsDefinition(self):
-        return True
-
-    def IsExportable(self):
-        return True
-
-    def __str__(self):
-        suffix = '%s, {%s}' % (self.name, self.fields)
-        return self._TypeStringHelper(suffix)
-
-
-class Union(_NestedType):
-    pass
-
-
-class Enum(_NestedType):
-    pass
-
-
-class Class(_GenericDeclaration):
-    def __init__(self, start, end, name, bases, templated_types, body, namespace):
-        _GenericDeclaration.__init__(self, start, end, name, namespace)
-        self.bases = bases
-        self.body = body
-        self.templated_types = templated_types
-
-    def IsDeclaration(self):
-        return self.bases is None and self.body is None
-
-    def IsDefinition(self):
-        return not self.IsDeclaration()
-
-    def IsExportable(self):
-        return not self.IsDeclaration()
-
-    def Requires(self, node):
-        # TODO(nnorwitz): handle namespaces, etc.
-        if self.bases:
-            for token_list in self.bases:
-                # TODO(nnorwitz): bases are tokens, do name comparision.
-                for token in token_list:
-                    if token.name == node.name:
-                        return True
-        # TODO(nnorwitz): search in body too.
-        return False
-
-    def __str__(self):
-        name = self.name
-        if self.templated_types:
-            name += '<%s>' % self.templated_types
-        suffix = '%s, %s, %s' % (name, self.bases, self.body)
-        return self._TypeStringHelper(suffix)
-
-
-class Struct(Class):
-    pass
-
-
-class Function(_GenericDeclaration):
-    def __init__(self, start, end, name, return_type, parameters,
-                 modifiers, templated_types, body, namespace):
-        _GenericDeclaration.__init__(self, start, end, name, namespace)
-        converter = TypeConverter(namespace)
-        self.return_type = converter.CreateReturnType(return_type)
-        self.parameters = converter.ToParameters(parameters)
-        self.modifiers = modifiers
-        self.body = body
-        self.templated_types = templated_types
-
-    def IsDeclaration(self):
-        return self.body is None
-
-    def IsDefinition(self):
-        return self.body is not None
-
-    def IsExportable(self):
-        if self.return_type and 'static' in self.return_type.modifiers:
-            return False
-        return None not in self.namespace
-
-    def Requires(self, node):
-        if self.parameters:
-            # TODO(nnorwitz): parameters are tokens, do name comparision.
-            for p in self.parameters:
-                if p.name == node.name:
-                    return True
-        # TODO(nnorwitz): search in body too.
-        return False
-
-    def __str__(self):
-        # TODO(nnorwitz): add templated_types.
-        suffix = ('%s %s(%s), 0x%02x, %s' %
-                  (self.return_type, self.name, self.parameters,
-                   self.modifiers, self.body))
-        return self._TypeStringHelper(suffix)
-
-
-class Method(Function):
-    def __init__(self, start, end, name, in_class, return_type, parameters,
-                 modifiers, templated_types, body, namespace):
-        Function.__init__(self, start, end, name, return_type, parameters,
-                          modifiers, templated_types, body, namespace)
-        # TODO(nnorwitz): in_class could also be a namespace which can
-        # mess up finding functions properly.
-        self.in_class = in_class
-
-
-class Type(_GenericDeclaration):
-    """Type used for any variable (eg class, primitive, struct, etc)."""
-
-    def __init__(self, start, end, name, templated_types, modifiers,
-                 reference, pointer, array):
-        """
-        Args:
-          name: str name of main type
-          templated_types: [Class (Type?)] template type info between <>
-          modifiers: [str] type modifiers (keywords) eg, const, mutable, etc.
-          reference, pointer, array: bools
-        """
-        _GenericDeclaration.__init__(self, start, end, name, [])
-        self.templated_types = templated_types
-        if not name and modifiers:
-            self.name = modifiers.pop()
-        self.modifiers = modifiers
-        self.reference = reference
-        self.pointer = pointer
-        self.array = array
-
-    def __str__(self):
-        prefix = ''
-        if self.modifiers:
-            prefix = ' '.join(self.modifiers) + ' '
-        name = str(self.name)
-        if self.templated_types:
-            name += '<%s>' % self.templated_types
-        suffix = prefix + name
-        if self.reference:
-            suffix += '&'
-        if self.pointer:
-            suffix += '*'
-        if self.array:
-            suffix += '[]'
-        return self._TypeStringHelper(suffix)
-
-    # By definition, Is* are always False.  A Type can only exist in
-    # some sort of variable declaration, parameter, or return value.
-    def IsDeclaration(self):
-        return False
-
-    def IsDefinition(self):
-        return False
-
-    def IsExportable(self):
-        return False
-
-
-class TypeConverter(object):
-
-    def __init__(self, namespace_stack):
-        self.namespace_stack = namespace_stack
-
-    def _GetTemplateEnd(self, tokens, start):
-        count = 1
-        end = start
-        while 1:
-            token = tokens[end]
-            end += 1
-            if token.name == '<':
-                count += 1
-            elif token.name == '>':
-                count -= 1
-                if count == 0:
-                    break
-        return tokens[start:end-1], end
-
-    def ToType(self, tokens):
-        """Convert [Token,...] to [Class(...), ] useful for base classes.
-        For example, code like class Foo : public Bar<x, y> { ... };
-        the "Bar<x, y>" portion gets converted to an AST.
-
-        Returns:
-          [Class(...), ...]
-        """
-        result = []
-        name_tokens = []
-        reference = pointer = array = False
-
-        def AddType(templated_types):
-            # Partition tokens into name and modifier tokens.
-            names = []
-            modifiers = []
-            for t in name_tokens:
-                if keywords.IsKeyword(t.name):
-                    modifiers.append(t.name)
-                else:
-                    names.append(t.name)
-            name = ''.join(names)
-            result.append(Type(name_tokens[0].start, name_tokens[-1].end,
-                               name, templated_types, modifiers,
-                               reference, pointer, array))
-            del name_tokens[:]
-
-        i = 0
-        end = len(tokens)
-        while i < end:
-            token = tokens[i]
-            if token.name == '<':
-                new_tokens, new_end = self._GetTemplateEnd(tokens, i+1)
-                AddType(self.ToType(new_tokens))
-                # If there is a comma after the template, we need to consume
-                # that here otherwise it becomes part of the name.
-                i = new_end
-                reference = pointer = array = False
-            elif token.name == ',':
-                AddType([])
-                reference = pointer = array = False
-            elif token.name == '*':
-                pointer = True
-            elif token.name == '&':
-                reference = True
-            elif token.name == '[':
-               pointer = True
-            elif token.name == ']':
-                pass
-            else:
-                name_tokens.append(token)
-            i += 1
-
-        if name_tokens:
-            # No '<' in the tokens, just a simple name and no template.
-            AddType([])
-        return result
-
-    def DeclarationToParts(self, parts, needs_name_removed):
-        name = None
-        default = []
-        if needs_name_removed:
-            # Handle default (initial) values properly.
-            for i, t in enumerate(parts):
-                if t.name == '=':
-                    default = parts[i+1:]
-                    name = parts[i-1].name
-                    if name == ']' and parts[i-2].name == '[':
-                        name = parts[i-3].name
-                        i -= 1
-                    parts = parts[:i-1]
-                    break
-            else:
-                if parts[-1].token_type == tokenize.NAME:
-                    name = parts.pop().name
-                else:
-                    # TODO(nnorwitz): this is a hack that happens for code like
-                    # Register(Foo<T>); where it thinks this is a function call
-                    # but it's actually a declaration.
-                    name = '???'
-        modifiers = []
-        type_name = []
-        other_tokens = []
-        templated_types = []
-        i = 0
-        end = len(parts)
-        while i < end:
-            p = parts[i]
-            if keywords.IsKeyword(p.name):
-                modifiers.append(p.name)
-            elif p.name == '<':
-                templated_tokens, new_end = self._GetTemplateEnd(parts, i+1)
-                templated_types = self.ToType(templated_tokens)
-                i = new_end - 1
-                # Don't add a spurious :: to data members being initialized.
-                next_index = i + 1
-                if next_index < end and parts[next_index].name == '::':
-                    i += 1
-            elif p.name in ('[', ']', '='):
-                # These are handled elsewhere.
-                other_tokens.append(p)
-            elif p.name not in ('*', '&', '>'):
-                # Ensure that names have a space between them.
-                if (type_name and type_name[-1].token_type == tokenize.NAME and
-                    p.token_type == tokenize.NAME):
-                    type_name.append(tokenize.Token(tokenize.SYNTAX, ' ', 0, 0))
-                type_name.append(p)
-            else:
-                other_tokens.append(p)
-            i += 1
-        type_name = ''.join([t.name for t in type_name])
-        return name, type_name, templated_types, modifiers, default, other_tokens
-
-    def ToParameters(self, tokens):
-        if not tokens:
-            return []
-
-        result = []
-        name = type_name = ''
-        type_modifiers = []
-        pointer = reference = array = False
-        first_token = None
-        default = []
-
-        def AddParameter():
-            if default:
-                del default[0]  # Remove flag.
-            end = type_modifiers[-1].end
-            parts = self.DeclarationToParts(type_modifiers, True)
-            (name, type_name, templated_types, modifiers,
-             unused_default, unused_other_tokens) = parts
-            parameter_type = Type(first_token.start, first_token.end,
-                                  type_name, templated_types, modifiers,
-                                  reference, pointer, array)
-            p = Parameter(first_token.start, end, name,
-                          parameter_type, default)
-            result.append(p)
-
-        template_count = 0
-        for s in tokens:
-            if not first_token:
-                first_token = s
-            if s.name == '<':
-                template_count += 1
-            elif s.name == '>':
-                template_count -= 1
-            if template_count > 0:
-                type_modifiers.append(s)
-                continue
-
-            if s.name == ',':
-                AddParameter()
-                name = type_name = ''
-                type_modifiers = []
-                pointer = reference = array = False
-                first_token = None
-                default = []
-            elif s.name == '*':
-                pointer = True
-            elif s.name == '&':
-                reference = True
-            elif s.name == '[':
-                array = True
-            elif s.name == ']':
-                pass  # Just don't add to type_modifiers.
-            elif s.name == '=':
-                # Got a default value.  Add any value (None) as a flag.
-                default.append(None)
-            elif default:
-                default.append(s)
-            else:
-                type_modifiers.append(s)
-        AddParameter()
-        return result
-
-    def CreateReturnType(self, return_type_seq):
-        if not return_type_seq:
-            return None
-        start = return_type_seq[0].start
-        end = return_type_seq[-1].end
-        _, name, templated_types, modifiers, default, other_tokens = \
-           self.DeclarationToParts(return_type_seq, False)
-        names = [n.name for n in other_tokens]
-        reference = '&' in names
-        pointer = '*' in names
-        array = '[' in names
-        return Type(start, end, name, templated_types, modifiers,
-                    reference, pointer, array)
-
-    def GetTemplateIndices(self, names):
-        # names is a list of strings.
-        start = names.index('<')
-        end = len(names) - 1
-        while end > 0:
-            if names[end] == '>':
-                break
-            end -= 1
-        return start, end+1
-
-class AstBuilder(object):
-    def __init__(self, token_stream, filename, in_class='', visibility=None,
-                 namespace_stack=[]):
-        self.tokens = token_stream
-        self.filename = filename
-        # TODO(nnorwitz): use a better data structure (deque) for the queue.
-        # Switching directions of the "queue" improved perf by about 25%.
-        # Using a deque should be even better since we access from both sides.
-        self.token_queue = []
-        self.namespace_stack = namespace_stack[:]
-        self.in_class = in_class
-        if in_class is None:
-            self.in_class_name_only = None
-        else:
-            self.in_class_name_only = in_class.split('::')[-1]
-        self.visibility = visibility
-        self.in_function = False
-        self.current_token = None
-        # Keep the state whether we are currently handling a typedef or not.
-        self._handling_typedef = False
-
-        self.converter = TypeConverter(self.namespace_stack)
-
-    def HandleError(self, msg, token):
-        printable_queue = list(reversed(self.token_queue[-20:]))
-        sys.stderr.write('Got %s in %s @ %s %s\n' %
-                         (msg, self.filename, token, printable_queue))
-
-    def Generate(self):
-        while 1:
-            token = self._GetNextToken()
-            if not token:
-                break
-
-            # Get the next token.
-            self.current_token = token
-
-            # Dispatch on the next token type.
-            if token.token_type == _INTERNAL_TOKEN:
-                if token.name == _NAMESPACE_POP:
-                    self.namespace_stack.pop()
-                continue
-
-            try:
-                result = self._GenerateOne(token)
-                if result is not None:
-                    yield result
-            except:
-                self.HandleError('exception', token)
-                raise
-
-    def _CreateVariable(self, pos_token, name, type_name, type_modifiers,
-                        ref_pointer_name_seq, templated_types, value=None):
-        reference = '&' in ref_pointer_name_seq
-        pointer = '*' in ref_pointer_name_seq
-        array = '[' in ref_pointer_name_seq
-        var_type = Type(pos_token.start, pos_token.end, type_name,
-                        templated_types, type_modifiers,
-                        reference, pointer, array)
-        return VariableDeclaration(pos_token.start, pos_token.end,
-                                   name, var_type, value, self.namespace_stack)
-
-    def _GenerateOne(self, token):
-        if token.token_type == tokenize.NAME:
-            if (keywords.IsKeyword(token.name) and
-                not keywords.IsBuiltinType(token.name)):
-                method = getattr(self, 'handle_' + token.name)
-                return method()
-            elif token.name == self.in_class_name_only:
-                # The token name is the same as the class, must be a ctor if
-                # there is a paren.  Otherwise, it's the return type.
-                # Peek ahead to get the next token to figure out which.
-                next = self._GetNextToken()
-                self._AddBackToken(next)
-                if next.token_type == tokenize.SYNTAX and next.name == '(':
-                    return self._GetMethod([token], FUNCTION_CTOR, None, True)
-                # Fall through--handle like any other method.
-
-            # Handle data or function declaration/definition.
-            syntax = tokenize.SYNTAX
-            temp_tokens, last_token = \
-                self._GetVarTokensUpTo(syntax, '(', ';', '{', '[')
-            temp_tokens.insert(0, token)
-            if last_token.name == '(':
-                # If there is an assignment before the paren,
-                # this is an expression, not a method.
-                expr = bool([e for e in temp_tokens if e.name == '='])
-                if expr:
-                    new_temp = self._GetTokensUpTo(tokenize.SYNTAX, ';')
-                    temp_tokens.append(last_token)
-                    temp_tokens.extend(new_temp)
-                    last_token = tokenize.Token(tokenize.SYNTAX, ';', 0, 0)
-
-            if last_token.name == '[':
-                # Handle array, this isn't a method, unless it's an operator.
-                # TODO(nnorwitz): keep the size somewhere.
-                # unused_size = self._GetTokensUpTo(tokenize.SYNTAX, ']')
-                temp_tokens.append(last_token)
-                if temp_tokens[-2].name == 'operator':
-                    temp_tokens.append(self._GetNextToken())
-                else:
-                    temp_tokens2, last_token = \
-                        self._GetVarTokensUpTo(tokenize.SYNTAX, ';')
-                    temp_tokens.extend(temp_tokens2)
-
-            if last_token.name == ';':
-                # Handle data, this isn't a method.
-                parts = self.converter.DeclarationToParts(temp_tokens, True)
-                (name, type_name, templated_types, modifiers, default,
-                 unused_other_tokens) = parts
-
-                t0 = temp_tokens[0]
-                names = [t.name for t in temp_tokens]
-                if templated_types:
-                    start, end = self.converter.GetTemplateIndices(names)
-                    names = names[:start] + names[end:]
-                default = ''.join([t.name for t in default])
-                return self._CreateVariable(t0, name, type_name, modifiers,
-                                            names, templated_types, default)
-            if last_token.name == '{':
-                self._AddBackTokens(temp_tokens[1:])
-                self._AddBackToken(last_token)
-                method_name = temp_tokens[0].name
-                method = getattr(self, 'handle_' + method_name, None)
-                if not method:
-                    # Must be declaring a variable.
-                    # TODO(nnorwitz): handle the declaration.
-                    return None
-                return method()
-            return self._GetMethod(temp_tokens, 0, None, False)
-        elif token.token_type == tokenize.SYNTAX:
-            if token.name == '~' and self.in_class:
-                # Must be a dtor (probably not in method body).
-                token = self._GetNextToken()
-                # self.in_class can contain A::Name, but the dtor will only
-                # be Name.  Make sure to compare against the right value.
-                if (token.token_type == tokenize.NAME and
-                    token.name == self.in_class_name_only):
-                    return self._GetMethod([token], FUNCTION_DTOR, None, True)
-            # TODO(nnorwitz): handle a lot more syntax.
-        elif token.token_type == tokenize.PREPROCESSOR:
-            # TODO(nnorwitz): handle more preprocessor directives.
-            # token starts with a #, so remove it and strip whitespace.
-            name = token.name[1:].lstrip()
-            if name.startswith('include'):
-                # Remove "include".
-                name = name[7:].strip()
-                assert name
-                # Handle #include \<newline> "header-on-second-line.h".
-                if name.startswith('\\'):
-                    name = name[1:].strip()
-                assert name[0] in '<"', token
-                assert name[-1] in '>"', token
-                system = name[0] == '<'
-                filename = name[1:-1]
-                return Include(token.start, token.end, filename, system)
-            if name.startswith('define'):
-                # Remove "define".
-                name = name[6:].strip()
-                assert name
-                value = ''
-                for i, c in enumerate(name):
-                    if c.isspace():
-                        value = name[i:].lstrip()
-                        name = name[:i]
-                        break
-                return Define(token.start, token.end, name, value)
-            if name.startswith('if') and name[2:3].isspace():
-                condition = name[3:].strip()
-                if condition.startswith('0') or condition.startswith('(0)'):
-                    self._SkipIf0Blocks()
-        return None
-
-    def _GetTokensUpTo(self, expected_token_type, expected_token):
-        return self._GetVarTokensUpTo(expected_token_type, expected_token)[0]
-
-    def _GetVarTokensUpTo(self, expected_token_type, *expected_tokens):
-        last_token = self._GetNextToken()
-        tokens = []
-        while (last_token.token_type != expected_token_type or
-               last_token.name not in expected_tokens):
-            tokens.append(last_token)
-            last_token = self._GetNextToken()
-        return tokens, last_token
-
-    # TODO(nnorwitz): remove _IgnoreUpTo() it shouldn't be necesary.
-    def _IgnoreUpTo(self, token_type, token):
-        unused_tokens = self._GetTokensUpTo(token_type, token)
-
-    def _SkipIf0Blocks(self):
-        count = 1
-        while 1:
-            token = self._GetNextToken()
-            if token.token_type != tokenize.PREPROCESSOR:
-                continue
-
-            name = token.name[1:].lstrip()
-            if name.startswith('endif'):
-                count -= 1
-                if count == 0:
-                    break
-            elif name.startswith('if'):
-                count += 1
-
-    def _GetMatchingChar(self, open_paren, close_paren, GetNextToken=None):
-        if GetNextToken is None:
-            GetNextToken = self._GetNextToken
-        # Assumes the current token is open_paren and we will consume
-        # and return up to the close_paren.
-        count = 1
-        token = GetNextToken()
-        while 1:
-            if token.token_type == tokenize.SYNTAX:
-                if token.name == open_paren:
-                    count += 1
-                elif token.name == close_paren:
-                    count -= 1
-                    if count == 0:
-                        break
-            yield token
-            token = GetNextToken()
-        yield token
-
-    def _GetParameters(self):
-        return self._GetMatchingChar('(', ')')
-
-    def GetScope(self):
-        return self._GetMatchingChar('{', '}')
-
-    def _GetNextToken(self):
-        if self.token_queue:
-            return self.token_queue.pop()
-        return next(self.tokens)
-
-    def _AddBackToken(self, token):
-        if token.whence == tokenize.WHENCE_STREAM:
-            token.whence = tokenize.WHENCE_QUEUE
-            self.token_queue.insert(0, token)
-        else:
-            assert token.whence == tokenize.WHENCE_QUEUE, token
-            self.token_queue.append(token)
-
-    def _AddBackTokens(self, tokens):
-        if tokens:
-            if tokens[-1].whence == tokenize.WHENCE_STREAM:
-                for token in tokens:
-                    token.whence = tokenize.WHENCE_QUEUE
-                self.token_queue[:0] = reversed(tokens)
-            else:
-                assert tokens[-1].whence == tokenize.WHENCE_QUEUE, tokens
-                self.token_queue.extend(reversed(tokens))
-
-    def GetName(self, seq=None):
-        """Returns ([tokens], next_token_info)."""
-        GetNextToken = self._GetNextToken
-        if seq is not None:
-            it = iter(seq)
-            GetNextToken = lambda: next(it)
-        next_token = GetNextToken()
-        tokens = []
-        last_token_was_name = False
-        while (next_token.token_type == tokenize.NAME or
-               (next_token.token_type == tokenize.SYNTAX and
-                next_token.name in ('::', '<'))):
-            # Two NAMEs in a row means the identifier should terminate.
-            # It's probably some sort of variable declaration.
-            if last_token_was_name and next_token.token_type == tokenize.NAME:
-                break
-            last_token_was_name = next_token.token_type == tokenize.NAME
-            tokens.append(next_token)
-            # Handle templated names.
-            if next_token.name == '<':
-                tokens.extend(self._GetMatchingChar('<', '>', GetNextToken))
-                last_token_was_name = True
-            next_token = GetNextToken()
-        return tokens, next_token
-
-    def GetMethod(self, modifiers, templated_types):
-        return_type_and_name = self._GetTokensUpTo(tokenize.SYNTAX, '(')
-        assert len(return_type_and_name) >= 1
-        return self._GetMethod(return_type_and_name, modifiers, templated_types,
-                               False)
-
-    def _GetMethod(self, return_type_and_name, modifiers, templated_types,
-                   get_paren):
-        template_portion = None
-        if get_paren:
-            token = self._GetNextToken()
-            assert token.token_type == tokenize.SYNTAX, token
-            if token.name == '<':
-                # Handle templatized dtors.
-                template_portion = [token]
-                template_portion.extend(self._GetMatchingChar('<', '>'))
-                token = self._GetNextToken()
-            assert token.token_type == tokenize.SYNTAX, token
-            assert token.name == '(', token
-
-        name = return_type_and_name.pop()
-        # Handle templatized ctors.
-        if name.name == '>':
-            index = 1
-            while return_type_and_name[index].name != '<':
-                index += 1
-            template_portion = return_type_and_name[index:] + [name]
-            del return_type_and_name[index:]
-            name = return_type_and_name.pop()
-        elif name.name == ']':
-            rt = return_type_and_name
-            assert rt[-1].name == '[', return_type_and_name
-            assert rt[-2].name == 'operator', return_type_and_name
-            name_seq = return_type_and_name[-2:]
-            del return_type_and_name[-2:]
-            name = tokenize.Token(tokenize.NAME, 'operator[]',
-                                  name_seq[0].start, name.end)
-            # Get the open paren so _GetParameters() below works.
-            unused_open_paren = self._GetNextToken()
-
-        # TODO(nnorwitz): store template_portion.
-        return_type = return_type_and_name
-        indices = name
-        if return_type:
-            indices = return_type[0]
-
-        # Force ctor for templatized ctors.
-        if name.name == self.in_class and not modifiers:
-            modifiers |= FUNCTION_CTOR
-        parameters = list(self._GetParameters())
-        del parameters[-1]              # Remove trailing ')'.
-
-        # Handling operator() is especially weird.
-        if name.name == 'operator' and not parameters:
-            token = self._GetNextToken()
-            assert token.name == '(', token
-            parameters = list(self._GetParameters())
-            del parameters[-1]          # Remove trailing ')'.
-
-        token = self._GetNextToken()
-        while token.token_type == tokenize.NAME:
-            modifier_token = token
-            token = self._GetNextToken()
-            if modifier_token.name == 'const':
-                modifiers |= FUNCTION_CONST
-            elif modifier_token.name == '__attribute__':
-                # TODO(nnorwitz): handle more __attribute__ details.
-                modifiers |= FUNCTION_ATTRIBUTE
-                assert token.name == '(', token
-                # Consume everything between the (parens).
-                unused_tokens = list(self._GetMatchingChar('(', ')'))
-                token = self._GetNextToken()
-            elif modifier_token.name == 'throw':
-                modifiers |= FUNCTION_THROW
-                assert token.name == '(', token
-                # Consume everything between the (parens).
-                unused_tokens = list(self._GetMatchingChar('(', ')'))
-                token = self._GetNextToken()
-            elif modifier_token.name == modifier_token.name.upper():
-                # HACK(nnorwitz):  assume that all upper-case names
-                # are some macro we aren't expanding.
-                modifiers |= FUNCTION_UNKNOWN_ANNOTATION
-            else:
-                self.HandleError('unexpected token', modifier_token)
-
-        assert token.token_type == tokenize.SYNTAX, token
-        # Handle ctor initializers.
-        if token.name == ':':
-            # TODO(nnorwitz): anything else to handle for initializer list?
-            while token.name != ';' and token.name != '{':
-                token = self._GetNextToken()
-
-        # Handle pointer to functions that are really data but look
-        # like method declarations.
-        if token.name == '(':
-            if parameters[0].name == '*':
-                # name contains the return type.
-                name = parameters.pop()
-                # parameters contains the name of the data.
-                modifiers = [p.name for p in parameters]
-                # Already at the ( to open the parameter list.
-                function_parameters = list(self._GetMatchingChar('(', ')'))
-                del function_parameters[-1]  # Remove trailing ')'.
-                # TODO(nnorwitz): store the function_parameters.
-                token = self._GetNextToken()
-                assert token.token_type == tokenize.SYNTAX, token
-                assert token.name == ';', token
-                return self._CreateVariable(indices, name.name, indices.name,
-                                            modifiers, '', None)
-            # At this point, we got something like:
-            #  return_type (type::*name_)(params);
-            # This is a data member called name_ that is a function pointer.
-            # With this code: void (sq_type::*field_)(string&);
-            # We get: name=void return_type=[] parameters=sq_type ... field_
-            # TODO(nnorwitz): is return_type always empty?
-            # TODO(nnorwitz): this isn't even close to being correct.
-            # Just put in something so we don't crash and can move on.
-            real_name = parameters[-1]
-            modifiers = [p.name for p in self._GetParameters()]
-            del modifiers[-1]           # Remove trailing ')'.
-            return self._CreateVariable(indices, real_name.name, indices.name,
-                                        modifiers, '', None)
-
-        if token.name == '{':
-            body = list(self.GetScope())
-            del body[-1]                # Remove trailing '}'.
-        else:
-            body = None
-            if token.name == '=':
-                token = self._GetNextToken()
-                assert token.token_type == tokenize.CONSTANT, token
-                assert token.name == '0', token
-                modifiers |= FUNCTION_PURE_VIRTUAL
-                token = self._GetNextToken()
-
-            if token.name == '[':
-                # TODO(nnorwitz): store tokens and improve parsing.
-                # template <typename T, size_t N> char (&ASH(T (&seq)[N]))[N];
-                tokens = list(self._GetMatchingChar('[', ']'))
-                token = self._GetNextToken()
-
-            assert token.name == ';', (token, return_type_and_name, parameters)
-
-        # Looks like we got a method, not a function.
-        if len(return_type) > 2 and return_type[-1].name == '::':
-            return_type, in_class = \
-                         self._GetReturnTypeAndClassName(return_type)
-            return Method(indices.start, indices.end, name.name, in_class,
-                          return_type, parameters, modifiers, templated_types,
-                          body, self.namespace_stack)
-        return Function(indices.start, indices.end, name.name, return_type,
-                        parameters, modifiers, templated_types, body,
-                        self.namespace_stack)
-
-    def _GetReturnTypeAndClassName(self, token_seq):
-        # Splitting the return type from the class name in a method
-        # can be tricky.  For example, Return::Type::Is::Hard::To::Find().
-        # Where is the return type and where is the class name?
-        # The heuristic used is to pull the last name as the class name.
-        # This includes all the templated type info.
-        # TODO(nnorwitz): if there is only One name like in the
-        # example above, punt and assume the last bit is the class name.
-
-        # Ignore a :: prefix, if exists so we can find the first real name.
-        i = 0
-        if token_seq[0].name == '::':
-            i = 1
-        # Ignore a :: suffix, if exists.
-        end = len(token_seq) - 1
-        if token_seq[end-1].name == '::':
-            end -= 1
-
-        # Make a copy of the sequence so we can append a sentinel
-        # value. This is required for GetName will has to have some
-        # terminating condition beyond the last name.
-        seq_copy = token_seq[i:end]
-        seq_copy.append(tokenize.Token(tokenize.SYNTAX, '', 0, 0))
-        names = []
-        while i < end:
-            # Iterate through the sequence parsing out each name.
-            new_name, next = self.GetName(seq_copy[i:])
-            assert new_name, 'Got empty new_name, next=%s' % next
-            # We got a pointer or ref.  Add it to the name.
-            if next and next.token_type == tokenize.SYNTAX:
-                new_name.append(next)
-            names.append(new_name)
-            i += len(new_name)
-
-        # Now that we have the names, it's time to undo what we did.
-
-        # Remove the sentinel value.
-        names[-1].pop()
-        # Flatten the token sequence for the return type.
-        return_type = [e for seq in names[:-1] for e in seq]
-        # The class name is the last name.
-        class_name = names[-1]
-        return return_type, class_name
-
-    def handle_bool(self):
-        pass
-
-    def handle_char(self):
-        pass
-
-    def handle_int(self):
-        pass
-
-    def handle_long(self):
-        pass
-
-    def handle_short(self):
-        pass
-
-    def handle_double(self):
-        pass
-
-    def handle_float(self):
-        pass
-
-    def handle_void(self):
-        pass
-
-    def handle_wchar_t(self):
-        pass
-
-    def handle_unsigned(self):
-        pass
-
-    def handle_signed(self):
-        pass
-
-    def _GetNestedType(self, ctor):
-        name = None
-        name_tokens, token = self.GetName()
-        if name_tokens:
-            name = ''.join([t.name for t in name_tokens])
-
-        # Handle forward declarations.
-        if token.token_type == tokenize.SYNTAX and token.name == ';':
-            return ctor(token.start, token.end, name, None,
-                        self.namespace_stack)
-
-        if token.token_type == tokenize.NAME and self._handling_typedef:
-            self._AddBackToken(token)
-            return ctor(token.start, token.end, name, None,
-                        self.namespace_stack)
-
-        # Must be the type declaration.
-        fields = list(self._GetMatchingChar('{', '}'))
-        del fields[-1]                  # Remove trailing '}'.
-        if token.token_type == tokenize.SYNTAX and token.name == '{':
-            next = self._GetNextToken()
-            new_type = ctor(token.start, token.end, name, fields,
-                            self.namespace_stack)
-            # A name means this is an anonymous type and the name
-            # is the variable declaration.
-            if next.token_type != tokenize.NAME:
-                return new_type
-            name = new_type
-            token = next
-
-        # Must be variable declaration using the type prefixed with keyword.
-        assert token.token_type == tokenize.NAME, token
-        return self._CreateVariable(token, token.name, name, [], '', None)
-
-    def handle_struct(self):
-        # Special case the handling typedef/aliasing of structs here.
-        # It would be a pain to handle in the class code.
-        name_tokens, var_token = self.GetName()
-        if name_tokens:
-            next_token = self._GetNextToken()
-            is_syntax = (var_token.token_type == tokenize.SYNTAX and
-                         var_token.name[0] in '*&')
-            is_variable = (var_token.token_type == tokenize.NAME and
-                           next_token.name == ';')
-            variable = var_token
-            if is_syntax and not is_variable:
-                variable = next_token
-                temp = self._GetNextToken()
-                if temp.token_type == tokenize.SYNTAX and temp.name == '(':
-                    # Handle methods declared to return a struct.
-                    t0 = name_tokens[0]
-                    struct = tokenize.Token(tokenize.NAME, 'struct',
-                                            t0.start-7, t0.start-2)
-                    type_and_name = [struct]
-                    type_and_name.extend(name_tokens)
-                    type_and_name.extend((var_token, next_token))
-                    return self._GetMethod(type_and_name, 0, None, False)
-                assert temp.name == ';', (temp, name_tokens, var_token)
-            if is_syntax or (is_variable and not self._handling_typedef):
-                modifiers = ['struct']
-                type_name = ''.join([t.name for t in name_tokens])
-                position = name_tokens[0]
-                return self._CreateVariable(position, variable.name, type_name,
-                                            modifiers, var_token.name, None)
-            name_tokens.extend((var_token, next_token))
-            self._AddBackTokens(name_tokens)
-        else:
-            self._AddBackToken(var_token)
-        return self._GetClass(Struct, VISIBILITY_PUBLIC, None)
-
-    def handle_union(self):
-        return self._GetNestedType(Union)
-
-    def handle_enum(self):
-        return self._GetNestedType(Enum)
-
-    def handle_auto(self):
-        # TODO(nnorwitz): warn about using auto?  Probably not since it
-        # will be reclaimed and useful for C++0x.
-        pass
-
-    def handle_register(self):
-        pass
-
-    def handle_const(self):
-        pass
-
-    def handle_inline(self):
-        pass
-
-    def handle_extern(self):
-        pass
-
-    def handle_static(self):
-        pass
-
-    def handle_virtual(self):
-        # What follows must be a method.
-        token = token2 = self._GetNextToken()
-        if token.name == 'inline':
-            # HACK(nnorwitz): handle inline dtors by ignoring 'inline'.
-            token2 = self._GetNextToken()
-        if token2.token_type == tokenize.SYNTAX and token2.name == '~':
-            return self.GetMethod(FUNCTION_VIRTUAL + FUNCTION_DTOR, None)
-        assert token.token_type == tokenize.NAME or token.name == '::', token
-        return_type_and_name = self._GetTokensUpTo(tokenize.SYNTAX, '(')
-        return_type_and_name.insert(0, token)
-        if token2 is not token:
-            return_type_and_name.insert(1, token2)
-        return self._GetMethod(return_type_and_name, FUNCTION_VIRTUAL,
-                               None, False)
-
-    def handle_volatile(self):
-        pass
-
-    def handle_mutable(self):
-        pass
-
-    def handle_public(self):
-        assert self.in_class
-        self.visibility = VISIBILITY_PUBLIC
-
-    def handle_protected(self):
-        assert self.in_class
-        self.visibility = VISIBILITY_PROTECTED
-
-    def handle_private(self):
-        assert self.in_class
-        self.visibility = VISIBILITY_PRIVATE
-
-    def handle_friend(self):
-        tokens = self._GetTokensUpTo(tokenize.SYNTAX, ';')
-        assert tokens
-        t0 = tokens[0]
-        return Friend(t0.start, t0.end, tokens, self.namespace_stack)
-
-    def handle_static_cast(self):
-        pass
-
-    def handle_const_cast(self):
-        pass
-
-    def handle_dynamic_cast(self):
-        pass
-
-    def handle_reinterpret_cast(self):
-        pass
-
-    def handle_new(self):
-        pass
-
-    def handle_delete(self):
-        tokens = self._GetTokensUpTo(tokenize.SYNTAX, ';')
-        assert tokens
-        return Delete(tokens[0].start, tokens[0].end, tokens)
-
-    def handle_typedef(self):
-        token = self._GetNextToken()
-        if (token.token_type == tokenize.NAME and
-            keywords.IsKeyword(token.name)):
-            # Token must be struct/enum/union/class.
-            method = getattr(self, 'handle_' + token.name)
-            self._handling_typedef = True
-            tokens = [method()]
-            self._handling_typedef = False
-        else:
-            tokens = [token]
-
-        # Get the remainder of the typedef up to the semi-colon.
-        tokens.extend(self._GetTokensUpTo(tokenize.SYNTAX, ';'))
-
-        # TODO(nnorwitz): clean all this up.
-        assert tokens
-        name = tokens.pop()
-        indices = name
-        if tokens:
-            indices = tokens[0]
-        if not indices:
-            indices = token
-        if name.name == ')':
-            # HACK(nnorwitz): Handle pointers to functions "properly".
-            if (len(tokens) >= 4 and
-                tokens[1].name == '(' and tokens[2].name == '*'):
-                tokens.append(name)
-                name = tokens[3]
-        elif name.name == ']':
-            # HACK(nnorwitz): Handle arrays properly.
-            if len(tokens) >= 2:
-                tokens.append(name)
-                name = tokens[1]
-        new_type = tokens
-        if tokens and isinstance(tokens[0], tokenize.Token):
-            new_type = self.converter.ToType(tokens)[0]
-        return Typedef(indices.start, indices.end, name.name,
-                       new_type, self.namespace_stack)
-
-    def handle_typeid(self):
-        pass  # Not needed yet.
-
-    def handle_typename(self):
-        pass  # Not needed yet.
-
-    def _GetTemplatedTypes(self):
-        result = {}
-        tokens = list(self._GetMatchingChar('<', '>'))
-        len_tokens = len(tokens) - 1    # Ignore trailing '>'.
-        i = 0
-        while i < len_tokens:
-            key = tokens[i].name
-            i += 1
-            if keywords.IsKeyword(key) or key == ',':
-                continue
-            type_name = default = None
-            if i < len_tokens:
-                i += 1
-                if tokens[i-1].name == '=':
-                    assert i < len_tokens, '%s %s' % (i, tokens)
-                    default, unused_next_token = self.GetName(tokens[i:])
-                    i += len(default)
-                else:
-                    if tokens[i-1].name != ',':
-                        # We got something like: Type variable.
-                        # Re-adjust the key (variable) and type_name (Type).
-                        key = tokens[i-1].name
-                        type_name = tokens[i-2]
-
-            result[key] = (type_name, default)
-        return result
-
-    def handle_template(self):
-        token = self._GetNextToken()
-        assert token.token_type == tokenize.SYNTAX, token
-        assert token.name == '<', token
-        templated_types = self._GetTemplatedTypes()
-        # TODO(nnorwitz): for now, just ignore the template params.
-        token = self._GetNextToken()
-        if token.token_type == tokenize.NAME:
-            if token.name == 'class':
-                return self._GetClass(Class, VISIBILITY_PRIVATE, templated_types)
-            elif token.name == 'struct':
-                return self._GetClass(Struct, VISIBILITY_PUBLIC, templated_types)
-            elif token.name == 'friend':
-                return self.handle_friend()
-        self._AddBackToken(token)
-        tokens, last = self._GetVarTokensUpTo(tokenize.SYNTAX, '(', ';')
-        tokens.append(last)
-        self._AddBackTokens(tokens)
-        if last.name == '(':
-            return self.GetMethod(FUNCTION_NONE, templated_types)
-        # Must be a variable definition.
-        return None
-
-    def handle_true(self):
-        pass  # Nothing to do.
-
-    def handle_false(self):
-        pass  # Nothing to do.
-
-    def handle_asm(self):
-        pass  # Not needed yet.
-
-    def handle_class(self):
-        return self._GetClass(Class, VISIBILITY_PRIVATE, None)
-
-    def _GetBases(self):
-        # Get base classes.
-        bases = []
-        while 1:
-            token = self._GetNextToken()
-            assert token.token_type == tokenize.NAME, token
-            # TODO(nnorwitz): store kind of inheritance...maybe.
-            if token.name not in ('public', 'protected', 'private'):
-                # If inheritance type is not specified, it is private.
-                # Just put the token back so we can form a name.
-                # TODO(nnorwitz): it would be good to warn about this.
-                self._AddBackToken(token)
-            else:
-                # Check for virtual inheritance.
-                token = self._GetNextToken()
-                if token.name != 'virtual':
-                    self._AddBackToken(token)
-                else:
-                    # TODO(nnorwitz): store that we got virtual for this base.
-                    pass
-            base, next_token = self.GetName()
-            bases_ast = self.converter.ToType(base)
-            assert len(bases_ast) == 1, bases_ast
-            bases.append(bases_ast[0])
-            assert next_token.token_type == tokenize.SYNTAX, next_token
-            if next_token.name == '{':
-                token = next_token
-                break
-            # Support multiple inheritance.
-            assert next_token.name == ',', next_token
-        return bases, token
-
-    def _GetClass(self, class_type, visibility, templated_types):
-        class_name = None
-        class_token = self._GetNextToken()
-        if class_token.token_type != tokenize.NAME:
-            assert class_token.token_type == tokenize.SYNTAX, class_token
-            token = class_token
-        else:
-            self._AddBackToken(class_token)
-            name_tokens, token = self.GetName()
-            class_name = ''.join([t.name for t in name_tokens])
-        bases = None
-        if token.token_type == tokenize.SYNTAX:
-            if token.name == ';':
-                # Forward declaration.
-                return class_type(class_token.start, class_token.end,
-                                  class_name, None, templated_types, None,
-                                  self.namespace_stack)
-            if token.name in '*&':
-                # Inline forward declaration.  Could be method or data.
-                name_token = self._GetNextToken()
-                next_token = self._GetNextToken()
-                if next_token.name == ';':
-                    # Handle data
-                    modifiers = ['class']
-                    return self._CreateVariable(class_token, name_token.name,
-                                                class_name,
-                                                modifiers, token.name, None)
-                else:
-                    # Assume this is a method.
-                    tokens = (class_token, token, name_token, next_token)
-                    self._AddBackTokens(tokens)
-                    return self.GetMethod(FUNCTION_NONE, None)
-            if token.name == ':':
-                bases, token = self._GetBases()
-
-        body = None
-        if token.token_type == tokenize.SYNTAX and token.name == '{':
-            assert token.token_type == tokenize.SYNTAX, token
-            assert token.name == '{', token
-
-            ast = AstBuilder(self.GetScope(), self.filename, class_name,
-                             visibility, self.namespace_stack)
-            body = list(ast.Generate())
-
-            if not self._handling_typedef:
-                token = self._GetNextToken()
-                if token.token_type != tokenize.NAME:
-                    assert token.token_type == tokenize.SYNTAX, token
-                    assert token.name == ';', token
-                else:
-                    new_class = class_type(class_token.start, class_token.end,
-                                           class_name, bases, None,
-                                           body, self.namespace_stack)
-
-                    modifiers = []
-                    return self._CreateVariable(class_token,
-                                                token.name, new_class,
-                                                modifiers, token.name, None)
-        else:
-            if not self._handling_typedef:
-                self.HandleError('non-typedef token', token)
-            self._AddBackToken(token)
-
-        return class_type(class_token.start, class_token.end, class_name,
-                          bases, None, body, self.namespace_stack)
-
-    def handle_namespace(self):
-        token = self._GetNextToken()
-        # Support anonymous namespaces.
-        name = None
-        if token.token_type == tokenize.NAME:
-            name = token.name
-            token = self._GetNextToken()
-        self.namespace_stack.append(name)
-        assert token.token_type == tokenize.SYNTAX, token
-        # Create an internal token that denotes when the namespace is complete.
-        internal_token = tokenize.Token(_INTERNAL_TOKEN, _NAMESPACE_POP,
-                                        None, None)
-        internal_token.whence = token.whence
-        if token.name == '=':
-            # TODO(nnorwitz): handle aliasing namespaces.
-            name, next_token = self.GetName()
-            assert next_token.name == ';', next_token
-            self._AddBackToken(internal_token)
-        else:
-            assert token.name == '{', token
-            tokens = list(self.GetScope())
-            # Replace the trailing } with the internal namespace pop token.
-            tokens[-1] = internal_token
-            # Handle namespace with nothing in it.
-            self._AddBackTokens(tokens)
-        return None
-
-    def handle_using(self):
-        tokens = self._GetTokensUpTo(tokenize.SYNTAX, ';')
-        assert tokens
-        return Using(tokens[0].start, tokens[0].end, tokens)
-
-    def handle_explicit(self):
-        assert self.in_class
-        # Nothing much to do.
-        # TODO(nnorwitz): maybe verify the method name == class name.
-        # This must be a ctor.
-        return self.GetMethod(FUNCTION_CTOR, None)
-
-    def handle_this(self):
-        pass  # Nothing to do.
-
-    def handle_operator(self):
-        # Pull off the next token(s?) and make that part of the method name.
-        pass
-
-    def handle_sizeof(self):
-        pass
-
-    def handle_case(self):
-        pass
-
-    def handle_switch(self):
-        pass
-
-    def handle_default(self):
-        token = self._GetNextToken()
-        assert token.token_type == tokenize.SYNTAX
-        assert token.name == ':'
-
-    def handle_if(self):
-        pass
-
-    def handle_else(self):
-        pass
-
-    def handle_return(self):
-        tokens = self._GetTokensUpTo(tokenize.SYNTAX, ';')
-        if not tokens:
-            return Return(self.current_token.start, self.current_token.end, None)
-        return Return(tokens[0].start, tokens[0].end, tokens)
-
-    def handle_goto(self):
-        tokens = self._GetTokensUpTo(tokenize.SYNTAX, ';')
-        assert len(tokens) == 1, str(tokens)
-        return Goto(tokens[0].start, tokens[0].end, tokens[0].name)
-
-    def handle_try(self):
-        pass  # Not needed yet.
-
-    def handle_catch(self):
-        pass  # Not needed yet.
-
-    def handle_throw(self):
-        pass  # Not needed yet.
-
-    def handle_while(self):
-        pass
-
-    def handle_do(self):
-        pass
-
-    def handle_for(self):
-        pass
-
-    def handle_break(self):
-        self._IgnoreUpTo(tokenize.SYNTAX, ';')
-
-    def handle_continue(self):
-        self._IgnoreUpTo(tokenize.SYNTAX, ';')
-
-
-def BuilderFromSource(source, filename):
-    """Utility method that returns an AstBuilder from source code.
-
-    Args:
-      source: 'C++ source code'
-      filename: 'file1'
-
-    Returns:
-      AstBuilder
-    """
-    return AstBuilder(tokenize.GetTokens(source), filename)
-
-
-def PrintIndentifiers(filename, should_print):
-    """Prints all identifiers for a C++ source file.
-
-    Args:
-      filename: 'file1'
-      should_print: predicate with signature: bool Function(token)
-    """
-    source = utils.ReadFile(filename, False)
-    if source is None:
-        sys.stderr.write('Unable to find: %s\n' % filename)
-        return
-
-    #print('Processing %s' % actual_filename)
-    builder = BuilderFromSource(source, filename)
-    try:
-        for node in builder.Generate():
-            if should_print(node):
-                print(node.name)
-    except KeyboardInterrupt:
-        return
-    except:
-        pass
-
-
-def PrintAllIndentifiers(filenames, should_print):
-    """Prints all identifiers for each C++ source file in filenames.
-
-    Args:
-      filenames: ['file1', 'file2', ...]
-      should_print: predicate with signature: bool Function(token)
-    """
-    for path in filenames:
-        PrintIndentifiers(path, should_print)
-
-
-def main(argv):
-    for filename in argv[1:]:
-        source = utils.ReadFile(filename)
-        if source is None:
-            continue
-
-        print('Processing %s' % filename)
-        builder = BuilderFromSource(source, filename)
-        try:
-            entire_ast = filter(None, builder.Generate())
-        except KeyboardInterrupt:
-            return
-        except:
-            # Already printed a warning, print the traceback and continue.
-            traceback.print_exc()
-        else:
-            if utils.DEBUG:
-                for ast in entire_ast:
-                    print(ast)
-
-
-if __name__ == '__main__':
-    main(sys.argv)
diff --git a/third_party/gmock/scripts/generator/cpp/gmock_class.py b/third_party/gmock/scripts/generator/cpp/gmock_class.py
deleted file mode 100644
index 3ad0bcd..0000000
--- a/third_party/gmock/scripts/generator/cpp/gmock_class.py
+++ /dev/null
@@ -1,178 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2008 Google Inc.  All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Generate Google Mock classes from base classes.
-
-This program will read in a C++ source file and output the Google Mock
-classes for the specified classes.  If no class is specified, all
-classes in the source file are emitted.
-
-Usage:
-  gmock_class.py header-file.h [ClassName]...
-
-Output is sent to stdout.
-"""
-
-__author__ = 'nnorwitz@google.com (Neal Norwitz)'
-
-
-import os
-import re
-import sets
-import sys
-
-from cpp import ast
-from cpp import utils
-
-_VERSION = (1, 0, 1)  # The version of this script.
-# How many spaces to indent.  Can set me with the INDENT environment variable.
-_INDENT = 2
-
-
-def _GenerateMethods(output_lines, source, class_node):
-  function_type = ast.FUNCTION_VIRTUAL | ast.FUNCTION_PURE_VIRTUAL
-  ctor_or_dtor = ast.FUNCTION_CTOR | ast.FUNCTION_DTOR
-
-  for node in class_node.body:
-    # We only care about virtual functions.
-    if (isinstance(node, ast.Function) and
-        node.modifiers & function_type and
-        not node.modifiers & ctor_or_dtor):
-      # Pick out all the elements we need from the original function.
-      const = ''
-      if node.modifiers & ast.FUNCTION_CONST:
-        const = 'CONST_'
-      return_type = 'void'
-      if node.return_type:
-        # Add modifiers like 'const'.
-        modifiers = ''
-        if node.return_type.modifiers:
-          modifiers = ' '.join(node.return_type.modifiers) + ' '
-        return_type = modifiers + node.return_type.name
-        if node.return_type.pointer:
-          return_type += '*'
-        if node.return_type.reference:
-          return_type += '&'
-      prefix = 'MOCK_%sMETHOD%d' % (const, len(node.parameters))
-      args = ''
-      if node.parameters:
-        # Get the full text of the parameters from the start
-        # of the first parameter to the end of the last parameter.
-        start = node.parameters[0].start
-        end = node.parameters[-1].end
-        # Remove // comments.
-        args_strings = re.sub(r'//.*', '', source[start:end])
-        # Condense multiple spaces and eliminate newlines putting the
-        # parameters together on a single line.  Ensure there is a
-        # space in an argument which is split by a newline without
-        # intervening whitespace, e.g.: int\nBar
-        args = re.sub('  +', ' ', args_strings.replace('\n', ' '))
-
-      # Create the prototype.
-      indent = ' ' * _INDENT
-      line = ('%s%s(%s,\n%s%s(%s));' %
-              (indent, prefix, node.name, indent*3, return_type, args))
-      output_lines.append(line)
-
-
-def _GenerateMocks(filename, source, ast_list, desired_class_names):
-  processed_class_names = sets.Set()
-  lines = []
-  for node in ast_list:
-    if (isinstance(node, ast.Class) and node.body and
-        # desired_class_names being None means that all classes are selected.
-        (not desired_class_names or node.name in desired_class_names)):
-      class_name = node.name
-      processed_class_names.add(class_name)
-      class_node = node
-      # Add namespace before the class.
-      if class_node.namespace:
-        lines.extend(['namespace %s {' % n for n in class_node.namespace])  # }
-        lines.append('')
-
-      # Add the class prolog.
-      lines.append('class Mock%s : public %s {' % (class_name, class_name))  # }
-      lines.append('%spublic:' % (' ' * (_INDENT // 2)))
-
-      # Add all the methods.
-      _GenerateMethods(lines, source, class_node)
-
-      # Close the class.
-      if lines:
-        # If there are no virtual methods, no need for a public label.
-        if len(lines) == 2:
-          del lines[-1]
-
-        # Only close the class if there really is a class.
-        lines.append('};')
-        lines.append('')  # Add an extra newline.
-
-      # Close the namespace.
-      if class_node.namespace:
-        for i in range(len(class_node.namespace)-1, -1, -1):
-          lines.append('}  // namespace %s' % class_node.namespace[i])
-        lines.append('')  # Add an extra newline.
-
-  if desired_class_names:
-    missing_class_name_list = list(desired_class_names - processed_class_names)
-    if missing_class_name_list:
-      missing_class_name_list.sort()
-      sys.stderr.write('Class(es) not found in %s: %s\n' %
-                       (filename, ', '.join(missing_class_name_list)))
-  elif not processed_class_names:
-    sys.stderr.write('No class found in %s\n' % filename)
-
-  return lines
-
-
-def main(argv=sys.argv):
-  if len(argv) < 2:
-    sys.stderr.write('Google Mock Class Generator v%s\n\n' %
-                     '.'.join(map(str, _VERSION)))
-    sys.stderr.write(__doc__)
-    return 1
-
-  global _INDENT
-  try:
-    _INDENT = int(os.environ['INDENT'])
-  except KeyError:
-    pass
-  except:
-    sys.stderr.write('Unable to use indent of %s\n' % os.environ.get('INDENT'))
-
-  filename = argv[1]
-  desired_class_names = None  # None means all classes in the source file.
-  if len(argv) >= 3:
-    desired_class_names = sets.Set(argv[2:])
-  source = utils.ReadFile(filename)
-  if source is None:
-    return 1
-
-  builder = ast.BuilderFromSource(source, filename)
-  try:
-    entire_ast = filter(None, builder.Generate())
-  except KeyboardInterrupt:
-    return
-  except:
-    # An error message was already printed since we couldn't parse.
-    pass
-  else:
-    lines = _GenerateMocks(filename, source, entire_ast, desired_class_names)
-    sys.stdout.write('\n'.join(lines))
-
-
-if __name__ == '__main__':
-  main(sys.argv)
diff --git a/third_party/gmock/scripts/generator/cpp/gmock_class_test.py b/third_party/gmock/scripts/generator/cpp/gmock_class_test.py
deleted file mode 100644
index ae00800..0000000
--- a/third_party/gmock/scripts/generator/cpp/gmock_class_test.py
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2009 Neal Norwitz All Rights Reserved.
-# Portions Copyright 2009 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Tests for gmock.scripts.generator.cpp.gmock_class."""
-
-__author__ = 'nnorwitz@google.com (Neal Norwitz)'
-
-
-import os
-import sys
-import unittest
-
-# Allow the cpp imports below to work when run as a standalone script.
-sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
-
-from cpp import ast
-from cpp import gmock_class
-
-
-class TestCase(unittest.TestCase):
-  """Helper class that adds assert methods."""
-
-  def assertEqualIgnoreLeadingWhitespace(self, expected_lines, lines):
-    """Specialized assert that ignores the indent level."""
-    stripped_lines = '\n'.join([s.lstrip() for s in lines.split('\n')])
-    self.assertEqual(expected_lines, stripped_lines)
-
-
-class GenerateMethodsTest(TestCase):
-
-  def GenerateMethodSource(self, cpp_source):
-    """Helper method to convert C++ source to gMock output source lines."""
-    method_source_lines = []
-    # <test> is a pseudo-filename, it is not read or written.
-    builder = ast.BuilderFromSource(cpp_source, '<test>')
-    ast_list = list(builder.Generate())
-    gmock_class._GenerateMethods(method_source_lines, cpp_source, ast_list[0])
-    return ''.join(method_source_lines)
-
-  def testStrangeNewlineInParameter(self):
-    source = """
-class Foo {
- public:
-  virtual void Bar(int
-a) = 0;
-};
-"""
-    self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_METHOD1(Bar,\nvoid(int a));',
-        self.GenerateMethodSource(source))
-
-  def testDoubleSlashCommentsInParameterListAreRemoved(self):
-    source = """
-class Foo {
- public:
-  virtual void Bar(int a,  // inline comments should be elided.
-                   int b   // inline comments should be elided.
-                   ) const = 0;
-};
-"""
-    self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_CONST_METHOD2(Bar,\nvoid(int a, int b));',
-        self.GenerateMethodSource(source))
-
-  def testCStyleCommentsInParameterListAreNotRemoved(self):
-    # NOTE(nnorwitz): I'm not sure if it's the best behavior to keep these
-    # comments.  Also note that C style comments after the last parameter
-    # are still elided.
-    source = """
-class Foo {
- public:
-  virtual const string& Bar(int /* keeper */, int b);
-};
-"""
-    self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_METHOD2(Bar,\nconst string&(int /* keeper */, int b));',
-        self.GenerateMethodSource(source))
-
-
-class GenerateMocksTest(TestCase):
-
-  def GenerateMocks(self, cpp_source):
-    """Helper method to convert C++ source to complete gMock output source."""
-    # <test> is a pseudo-filename, it is not read or written.
-    filename = '<test>'
-    builder = ast.BuilderFromSource(cpp_source, filename)
-    ast_list = list(builder.Generate())
-    lines = gmock_class._GenerateMocks(filename, cpp_source, ast_list, None)
-    return '\n'.join(lines)
-
-  def testNamespaces(self):
-    source = """
-namespace Foo {
-namespace Bar { class Forward; }
-namespace Baz {
-
-class Test {
- public:
-  virtual void Foo();
-};
-
-}  // namespace Baz
-}  // namespace Foo
-"""
-    expected = """\
-namespace Foo {
-namespace Baz {
-
-class MockTest : public Test {
-public:
-MOCK_METHOD0(Foo,
-void());
-};
-
-}  // namespace Baz
-}  // namespace Foo
-"""
-    self.assertEqualIgnoreLeadingWhitespace(
-        expected, self.GenerateMocks(source))
-
-
-if __name__ == '__main__':
-  unittest.main()
diff --git a/third_party/gmock/scripts/generator/cpp/keywords.py b/third_party/gmock/scripts/generator/cpp/keywords.py
deleted file mode 100644
index f694450..0000000
--- a/third_party/gmock/scripts/generator/cpp/keywords.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2007 Neal Norwitz
-# Portions Copyright 2007 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""C++ keywords and helper utilities for determining keywords."""
-
-__author__ = 'nnorwitz@google.com (Neal Norwitz)'
-
-
-try:
-    # Python 3.x
-    import builtins
-except ImportError:
-    # Python 2.x
-    import __builtin__ as builtins
-
-
-if not hasattr(builtins, 'set'):
-    # Nominal support for Python 2.3.
-    from sets import Set as set
-
-
-TYPES = set('bool char int long short double float void wchar_t unsigned signed'.split())
-TYPE_MODIFIERS = set('auto register const inline extern static virtual volatile mutable'.split())
-ACCESS = set('public protected private friend'.split())
-
-CASTS = set('static_cast const_cast dynamic_cast reinterpret_cast'.split())
-
-OTHERS = set('true false asm class namespace using explicit this operator sizeof'.split())
-OTHER_TYPES = set('new delete typedef struct union enum typeid typename template'.split())
-
-CONTROL = set('case switch default if else return goto'.split())
-EXCEPTION = set('try catch throw'.split())
-LOOP = set('while do for break continue'.split())
-
-ALL = TYPES | TYPE_MODIFIERS | ACCESS | CASTS | OTHERS | OTHER_TYPES | CONTROL | EXCEPTION | LOOP
-
-
-def IsKeyword(token):
-    return token in ALL
-
-def IsBuiltinType(token):
-    if token in ('virtual', 'inline'):
-        # These only apply to methods, they can't be types by themselves.
-        return False
-    return token in TYPES or token in TYPE_MODIFIERS
diff --git a/third_party/gmock/scripts/generator/cpp/tokenize.py b/third_party/gmock/scripts/generator/cpp/tokenize.py
deleted file mode 100644
index 28c3345..0000000
--- a/third_party/gmock/scripts/generator/cpp/tokenize.py
+++ /dev/null
@@ -1,287 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2007 Neal Norwitz
-# Portions Copyright 2007 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Tokenize C++ source code."""
-
-__author__ = 'nnorwitz@google.com (Neal Norwitz)'
-
-
-try:
-    # Python 3.x
-    import builtins
-except ImportError:
-    # Python 2.x
-    import __builtin__ as builtins
-
-
-import sys
-
-from cpp import utils
-
-
-if not hasattr(builtins, 'set'):
-    # Nominal support for Python 2.3.
-    from sets import Set as set
-
-
-# Add $ as a valid identifier char since so much code uses it.
-_letters = 'abcdefghijklmnopqrstuvwxyz'
-VALID_IDENTIFIER_CHARS = set(_letters + _letters.upper() + '_0123456789$')
-HEX_DIGITS = set('0123456789abcdefABCDEF')
-INT_OR_FLOAT_DIGITS = set('01234567890eE-+')
-
-
-# C++0x string preffixes.
-_STR_PREFIXES = set(('R', 'u8', 'u8R', 'u', 'uR', 'U', 'UR', 'L', 'LR'))
-
-
-# Token types.
-UNKNOWN = 'UNKNOWN'
-SYNTAX = 'SYNTAX'
-CONSTANT = 'CONSTANT'
-NAME = 'NAME'
-PREPROCESSOR = 'PREPROCESSOR'
-
-# Where the token originated from.  This can be used for backtracking.
-# It is always set to WHENCE_STREAM in this code.
-WHENCE_STREAM, WHENCE_QUEUE = range(2)
-
-
-class Token(object):
-    """Data container to represent a C++ token.
-
-    Tokens can be identifiers, syntax char(s), constants, or
-    pre-processor directives.
-
-    start contains the index of the first char of the token in the source
-    end contains the index of the last char of the token in the source
-    """
-
-    def __init__(self, token_type, name, start, end):
-        self.token_type = token_type
-        self.name = name
-        self.start = start
-        self.end = end
-        self.whence = WHENCE_STREAM
-
-    def __str__(self):
-        if not utils.DEBUG:
-            return 'Token(%r)' % self.name
-        return 'Token(%r, %s, %s)' % (self.name, self.start, self.end)
-
-    __repr__ = __str__
-
-
-def _GetString(source, start, i):
-    i = source.find('"', i+1)
-    while source[i-1] == '\\':
-        # Count the trailing backslashes.
-        backslash_count = 1
-        j = i - 2
-        while source[j] == '\\':
-            backslash_count += 1
-            j -= 1
-        # When trailing backslashes are even, they escape each other.
-        if (backslash_count % 2) == 0:
-            break
-        i = source.find('"', i+1)
-    return i + 1
-
-
-def _GetChar(source, start, i):
-    # NOTE(nnorwitz): may not be quite correct, should be good enough.
-    i = source.find("'", i+1)
-    while source[i-1] == '\\':
-        # Need to special case '\\'.
-        if (i - 2) > start and source[i-2] == '\\':
-            break
-        i = source.find("'", i+1)
-    # Try to handle unterminated single quotes (in a #if 0 block).
-    if i < 0:
-        i = start
-    return i + 1
-
-
-def GetTokens(source):
-    """Returns a sequence of Tokens.
-
-    Args:
-      source: string of C++ source code.
-
-    Yields:
-      Token that represents the next token in the source.
-    """
-    # Cache various valid character sets for speed.
-    valid_identifier_chars = VALID_IDENTIFIER_CHARS
-    hex_digits = HEX_DIGITS
-    int_or_float_digits = INT_OR_FLOAT_DIGITS
-    int_or_float_digits2 = int_or_float_digits | set('.')
-
-    # Only ignore errors while in a #if 0 block.
-    ignore_errors = False
-    count_ifs = 0
-
-    i = 0
-    end = len(source)
-    while i < end:
-        # Skip whitespace.
-        while i < end and source[i].isspace():
-            i += 1
-        if i >= end:
-            return
-
-        token_type = UNKNOWN
-        start = i
-        c = source[i]
-        if c.isalpha() or c == '_':              # Find a string token.
-            token_type = NAME
-            while source[i] in valid_identifier_chars:
-                i += 1
-            # String and character constants can look like a name if
-            # they are something like L"".
-            if (source[i] == "'" and (i - start) == 1 and
-                source[start:i] in 'uUL'):
-                # u, U, and L are valid C++0x character preffixes.
-                token_type = CONSTANT
-                i = _GetChar(source, start, i)
-            elif source[i] == "'" and source[start:i] in _STR_PREFIXES:
-                token_type = CONSTANT
-                i = _GetString(source, start, i)
-        elif c == '/' and source[i+1] == '/':    # Find // comments.
-            i = source.find('\n', i)
-            if i == -1:  # Handle EOF.
-                i = end
-            continue
-        elif c == '/' and source[i+1] == '*':    # Find /* comments. */
-            i = source.find('*/', i) + 2
-            continue
-        elif c in ':+-<>&|*=':                   # : or :: (plus other chars).
-            token_type = SYNTAX
-            i += 1
-            new_ch = source[i]
-            if new_ch == c:
-                i += 1
-            elif c == '-' and new_ch == '>':
-                i += 1
-            elif new_ch == '=':
-                i += 1
-        elif c in '()[]{}~!?^%;/.,':             # Handle single char tokens.
-            token_type = SYNTAX
-            i += 1
-            if c == '.' and source[i].isdigit():
-                token_type = CONSTANT
-                i += 1
-                while source[i] in int_or_float_digits:
-                    i += 1
-                # Handle float suffixes.
-                for suffix in ('l', 'f'):
-                    if suffix == source[i:i+1].lower():
-                        i += 1
-                        break
-        elif c.isdigit():                        # Find integer.
-            token_type = CONSTANT
-            if c == '0' and source[i+1] in 'xX':
-                # Handle hex digits.
-                i += 2
-                while source[i] in hex_digits:
-                    i += 1
-            else:
-                while source[i] in int_or_float_digits2:
-                    i += 1
-            # Handle integer (and float) suffixes.
-            for suffix in ('ull', 'll', 'ul', 'l', 'f', 'u'):
-                size = len(suffix)
-                if suffix == source[i:i+size].lower():
-                    i += size
-                    break
-        elif c == '"':                           # Find string.
-            token_type = CONSTANT
-            i = _GetString(source, start, i)
-        elif c == "'":                           # Find char.
-            token_type = CONSTANT
-            i = _GetChar(source, start, i)
-        elif c == '#':                           # Find pre-processor command.
-            token_type = PREPROCESSOR
-            got_if = source[i:i+3] == '#if' and source[i+3:i+4].isspace()
-            if got_if:
-                count_ifs += 1
-            elif source[i:i+6] == '#endif':
-                count_ifs -= 1
-                if count_ifs == 0:
-                    ignore_errors = False
-
-            # TODO(nnorwitz): handle preprocessor statements (\ continuations).
-            while 1:
-                i1 = source.find('\n', i)
-                i2 = source.find('//', i)
-                i3 = source.find('/*', i)
-                i4 = source.find('"', i)
-                # NOTE(nnorwitz): doesn't handle comments in #define macros.
-                # Get the first important symbol (newline, comment, EOF/end).
-                i = min([x for x in (i1, i2, i3, i4, end) if x != -1])
-
-                # Handle #include "dir//foo.h" properly.
-                if source[i] == '"':
-                    i = source.find('"', i+1) + 1
-                    assert i > 0
-                    continue
-                # Keep going if end of the line and the line ends with \.
-                if not (i == i1 and source[i-1] == '\\'):
-                    if got_if:
-                        condition = source[start+4:i].lstrip()
-                        if (condition.startswith('0') or
-                            condition.startswith('(0)')):
-                            ignore_errors = True
-                    break
-                i += 1
-        elif c == '\\':                          # Handle \ in code.
-            # This is different from the pre-processor \ handling.
-            i += 1
-            continue
-        elif ignore_errors:
-            # The tokenizer seems to be in pretty good shape.  This
-            # raise is conditionally disabled so that bogus code
-            # in an #if 0 block can be handled.  Since we will ignore
-            # it anyways, this is probably fine.  So disable the
-            # exception and  return the bogus char.
-            i += 1
-        else:
-            sys.stderr.write('Got invalid token in %s @ %d token:%s: %r\n' %
-                             ('?', i, c, source[i-10:i+10]))
-            raise RuntimeError('unexpected token')
-
-        if i <= 0:
-            print('Invalid index, exiting now.')
-            return
-        yield Token(token_type, source[start:i], start, i)
-
-
-if __name__ == '__main__':
-    def main(argv):
-        """Driver mostly for testing purposes."""
-        for filename in argv[1:]:
-            source = utils.ReadFile(filename)
-            if source is None:
-                continue
-
-            for token in GetTokens(source):
-                print('%-12s: %s' % (token.token_type, token.name))
-                # print('\r%6.2f%%' % (100.0 * index / token.end),)
-            sys.stdout.write('\n')
-
-
-    main(sys.argv)
diff --git a/third_party/gmock/scripts/generator/cpp/utils.py b/third_party/gmock/scripts/generator/cpp/utils.py
deleted file mode 100644
index eab36ee..0000000
--- a/third_party/gmock/scripts/generator/cpp/utils.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2007 Neal Norwitz
-# Portions Copyright 2007 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Generic utilities for C++ parsing."""
-
-__author__ = 'nnorwitz@google.com (Neal Norwitz)'
-
-
-import sys
-
-
-# Set to True to see the start/end token indices.
-DEBUG = True
-
-
-def ReadFile(filename, print_error=True):
-    """Returns the contents of a file."""
-    try:
-        fp = open(filename)
-        try:
-            return fp.read()
-        finally:
-            fp.close()
-    except IOError:
-        if print_error:
-            print('Error reading %s: %s' % (filename, sys.exc_info()[1]))
-        return None
diff --git a/third_party/gmock/scripts/generator/gmock_gen.py b/third_party/gmock/scripts/generator/gmock_gen.py
deleted file mode 100644
index 8cc0d13..0000000
--- a/third_party/gmock/scripts/generator/gmock_gen.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2008 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Driver for starting up Google Mock class generator."""
-
-__author__ = 'nnorwitz@google.com (Neal Norwitz)'
-
-import os
-import sys
-
-if __name__ == '__main__':
-  # Add the directory of this script to the path so we can import gmock_class.
-  sys.path.append(os.path.dirname(__file__))
-
-  from cpp import gmock_class
-  # Fix the docstring in case they require the usage.
-  gmock_class.__doc__ = gmock_class.__doc__.replace('gmock_class.py', __file__)
-  gmock_class.main()
diff --git a/third_party/gmock/scripts/gmock_doctor.py b/third_party/gmock/scripts/gmock_doctor.py
deleted file mode 100644
index bc814ad..0000000
--- a/third_party/gmock/scripts/gmock_doctor.py
+++ /dev/null
@@ -1,519 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2008, Google Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-#     * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-#     * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-"""Converts gcc errors in code using Google Mock to plain English."""
-
-__author__ = 'wan@google.com (Zhanyong Wan)'
-
-import re
-import sys
-
-_VERSION = '1.0.3'
-
-_COMMON_GMOCK_SYMBOLS = [
-    # Matchers
-    '_',
-    'A',
-    'AddressSatisfies',
-    'AllOf',
-    'An',
-    'AnyOf',
-    'ContainerEq',
-    'Contains',
-    'ContainsRegex',
-    'DoubleEq',
-    'ElementsAre',
-    'ElementsAreArray',
-    'EndsWith',
-    'Eq',
-    'Field',
-    'FloatEq',
-    'Ge',
-    'Gt',
-    'HasSubstr',
-    'IsInitializedProto',
-    'Le',
-    'Lt',
-    'MatcherCast',
-    'Matches',
-    'MatchesRegex',
-    'NanSensitiveDoubleEq',
-    'NanSensitiveFloatEq',
-    'Ne',
-    'Not',
-    'NotNull',
-    'Pointee',
-    'Property',
-    'Ref',
-    'ResultOf',
-    'SafeMatcherCast',
-    'StartsWith',
-    'StrCaseEq',
-    'StrCaseNe',
-    'StrEq',
-    'StrNe',
-    'Truly',
-    'TypedEq',
-    'Value',
-
-    # Actions
-    'Assign',
-    'ByRef',
-    'DeleteArg',
-    'DoAll',
-    'DoDefault',
-    'IgnoreResult',
-    'Invoke',
-    'InvokeArgument',
-    'InvokeWithoutArgs',
-    'Return',
-    'ReturnNew',
-    'ReturnNull',
-    'ReturnRef',
-    'SaveArg',
-    'SetArgReferee',
-    'SetArgumentPointee',
-    'SetArrayArgument',
-    'SetErrnoAndReturn',
-    'Throw',
-    'WithArg',
-    'WithArgs',
-    'WithoutArgs',
-
-    # Cardinalities
-    'AnyNumber',
-    'AtLeast',
-    'AtMost',
-    'Between',
-    'Exactly',
-
-    # Sequences
-    'InSequence',
-    'Sequence',
-
-    # Misc
-    'DefaultValue',
-    'Mock',
-    ]
-
-# Regex for matching source file path and line number in gcc's errors.
-_FILE_LINE_RE = r'(?P<file>.*):(?P<line>\d+):\s+'
-
-
-def _FindAllMatches(regex, s):
-  """Generates all matches of regex in string s."""
-
-  r = re.compile(regex)
-  return r.finditer(s)
-
-
-def _GenericDiagnoser(short_name, long_name, regex, diagnosis, msg):
-  """Diagnoses the given disease by pattern matching.
-
-  Args:
-    short_name: Short name of the disease.
-    long_name:  Long name of the disease.
-    regex:      Regex for matching the symptoms.
-    diagnosis:  Pattern for formatting the diagnosis.
-    msg:        Gcc's error messages.
-  Yields:
-    Tuples of the form
-      (short name of disease, long name of disease, diagnosis).
-  """
-
-  diagnosis = '%(file)s:%(line)s:' + diagnosis
-  for m in _FindAllMatches(regex, msg):
-    yield (short_name, long_name, diagnosis % m.groupdict())
-
-
-def _NeedToReturnReferenceDiagnoser(msg):
-  """Diagnoses the NRR disease, given the error messages by gcc."""
-
-  regex = (r'In member function \'testing::internal::ReturnAction<R>.*\n'
-           + _FILE_LINE_RE + r'instantiated from here\n'
-           r'.*gmock-actions\.h.*error: creating array with negative size')
-  diagnosis = """
-You are using an Return() action in a function that returns a reference.
-Please use ReturnRef() instead."""
-  return _GenericDiagnoser('NRR', 'Need to Return Reference',
-                           regex, diagnosis, msg)
-
-
-def _NeedToReturnSomethingDiagnoser(msg):
-  """Diagnoses the NRS disease, given the error messages by gcc."""
-
-  regex = (_FILE_LINE_RE +
-           r'(instantiated from here\n.'
-           r'*gmock.*actions\.h.*error: void value not ignored)'
-           r'|(error: control reaches end of non-void function)')
-  diagnosis = """
-You are using an action that returns void, but it needs to return
-*something*.  Please tell it *what* to return.  Perhaps you can use
-the pattern DoAll(some_action, Return(some_value))?"""
-  return _GenericDiagnoser('NRS', 'Need to Return Something',
-                           regex, diagnosis, msg)
-
-
-def _NeedToReturnNothingDiagnoser(msg):
-  """Diagnoses the NRN disease, given the error messages by gcc."""
-
-  regex = (_FILE_LINE_RE + r'instantiated from here\n'
-           r'.*gmock-actions\.h.*error: instantiation of '
-           r'\'testing::internal::ReturnAction<R>::Impl<F>::value_\' '
-           r'as type \'void\'')
-  diagnosis = """
-You are using an action that returns *something*, but it needs to return
-void.  Please use a void-returning action instead.
-
-All actions but the last in DoAll(...) must return void.  Perhaps you need
-to re-arrange the order of actions in a DoAll(), if you are using one?"""
-  return _GenericDiagnoser('NRN', 'Need to Return Nothing',
-                           regex, diagnosis, msg)
-
-
-def _IncompleteByReferenceArgumentDiagnoser(msg):
-  """Diagnoses the IBRA disease, given the error messages by gcc."""
-
-  regex = (_FILE_LINE_RE + r'instantiated from here\n'
-           r'.*gmock-printers\.h.*error: invalid application of '
-           r'\'sizeof\' to incomplete type \'(?P<type>.*)\'')
-  diagnosis = """
-In order to mock this function, Google Mock needs to see the definition
-of type "%(type)s" - declaration alone is not enough.  Either #include
-the header that defines it, or change the argument to be passed
-by pointer."""
-  return _GenericDiagnoser('IBRA', 'Incomplete By-Reference Argument Type',
-                           regex, diagnosis, msg)
-
-
-def _OverloadedFunctionMatcherDiagnoser(msg):
-  """Diagnoses the OFM disease, given the error messages by gcc."""
-
-  regex = (_FILE_LINE_RE + r'error: no matching function for '
-           r'call to \'Truly\(<unresolved overloaded function type>\)')
-  diagnosis = """
-The argument you gave to Truly() is an overloaded function.  Please tell
-gcc which overloaded version you want to use.
-
-For example, if you want to use the version whose signature is
-  bool Foo(int n);
-you should write
-  Truly(static_cast<bool (*)(int n)>(Foo))"""
-  return _GenericDiagnoser('OFM', 'Overloaded Function Matcher',
-                           regex, diagnosis, msg)
-
-
-def _OverloadedFunctionActionDiagnoser(msg):
-  """Diagnoses the OFA disease, given the error messages by gcc."""
-
-  regex = (_FILE_LINE_RE + r'error: no matching function for call to \'Invoke\('
-           r'<unresolved overloaded function type>')
-  diagnosis = """
-You are passing an overloaded function to Invoke().  Please tell gcc
-which overloaded version you want to use.
-
-For example, if you want to use the version whose signature is
-  bool MyFunction(int n, double x);
-you should write something like
-  Invoke(static_cast<bool (*)(int n, double x)>(MyFunction))"""
-  return _GenericDiagnoser('OFA', 'Overloaded Function Action',
-                           regex, diagnosis, msg)
-
-
-def _OverloadedMethodActionDiagnoser1(msg):
-  """Diagnoses the OMA disease, given the error messages by gcc."""
-
-  regex = (_FILE_LINE_RE + r'error: '
-           r'.*no matching function for call to \'Invoke\(.*, '
-           r'unresolved overloaded function type>')
-  diagnosis = """
-The second argument you gave to Invoke() is an overloaded method.  Please
-tell gcc which overloaded version you want to use.
-
-For example, if you want to use the version whose signature is
-  class Foo {
-    ...
-    bool Bar(int n, double x);
-  };
-you should write something like
-  Invoke(foo, static_cast<bool (Foo::*)(int n, double x)>(&Foo::Bar))"""
-  return _GenericDiagnoser('OMA', 'Overloaded Method Action',
-                           regex, diagnosis, msg)
-
-
-def _MockObjectPointerDiagnoser(msg):
-  """Diagnoses the MOP disease, given the error messages by gcc."""
-
-  regex = (_FILE_LINE_RE + r'error: request for member '
-           r'\'gmock_(?P<method>.+)\' in \'(?P<mock_object>.+)\', '
-           r'which is of non-class type \'(.*::)*(?P<class_name>.+)\*\'')
-  diagnosis = """
-The first argument to ON_CALL() and EXPECT_CALL() must be a mock *object*,
-not a *pointer* to it.  Please write '*(%(mock_object)s)' instead of
-'%(mock_object)s' as your first argument.
-
-For example, given the mock class:
-
-  class %(class_name)s : public ... {
-    ...
-    MOCK_METHOD0(%(method)s, ...);
-  };
-
-and the following mock instance:
-
-  %(class_name)s* mock_ptr = ...
-
-you should use the EXPECT_CALL like this:
-
-  EXPECT_CALL(*mock_ptr, %(method)s(...));"""
-  return _GenericDiagnoser('MOP', 'Mock Object Pointer',
-                           regex, diagnosis, msg)
-
-
-def _OverloadedMethodActionDiagnoser2(msg):
-  """Diagnoses the OMA disease, given the error messages by gcc."""
-
-  regex = (_FILE_LINE_RE + r'error: no matching function for '
-           r'call to \'Invoke\(.+, <unresolved overloaded function type>\)')
-  diagnosis = """
-The second argument you gave to Invoke() is an overloaded method.  Please
-tell gcc which overloaded version you want to use.
-
-For example, if you want to use the version whose signature is
-  class Foo {
-    ...
-    bool Bar(int n, double x);
-  };
-you should write something like
-  Invoke(foo, static_cast<bool (Foo::*)(int n, double x)>(&Foo::Bar))"""
-  return _GenericDiagnoser('OMA', 'Overloaded Method Action',
-                           regex, diagnosis, msg)
-
-
-def _NeedToUseSymbolDiagnoser(msg):
-  """Diagnoses the NUS disease, given the error messages by gcc."""
-
-  regex = (_FILE_LINE_RE + r'error: \'(?P<symbol>.+)\' '
-           r'(was not declared in this scope|has not been declared)')
-  diagnosis = """
-'%(symbol)s' is defined by Google Mock in the testing namespace.
-Did you forget to write
-  using testing::%(symbol)s;
-?"""
-  for m in _FindAllMatches(regex, msg):
-    symbol = m.groupdict()['symbol']
-    if symbol in _COMMON_GMOCK_SYMBOLS:
-      yield ('NUS', 'Need to Use Symbol', diagnosis % m.groupdict())
-
-
-def _NeedToUseReturnNullDiagnoser(msg):
-  """Diagnoses the NRNULL disease, given the error messages by gcc."""
-
-  regex = ('instantiated from \'testing::internal::ReturnAction<R>'
-           '::operator testing::Action<Func>\(\) const.*\n' +
-           _FILE_LINE_RE + r'instantiated from here\n'
-           r'.*error: no matching function for call to \'implicit_cast\('
-           r'long int&\)')
-  diagnosis = """
-You are probably calling Return(NULL) and the compiler isn't sure how to turn
-NULL into the right type. Use ReturnNull() instead.
-Note: the line number may be off; please fix all instances of Return(NULL)."""
-  return _GenericDiagnoser('NRNULL', 'Need to use ReturnNull',
-                           regex, diagnosis, msg)
-
-
-_TTB_DIAGNOSIS = """
-In a mock class template, types or typedefs defined in the base class
-template are *not* automatically visible.  This is how C++ works.  Before
-you can use a type or typedef named %(type)s defined in base class Base<T>, you
-need to make it visible.  One way to do it is:
-
-  typedef typename Base<T>::%(type)s %(type)s;"""
-
-
-def _TypeInTemplatedBaseDiagnoser1(msg):
-  """Diagnoses the TTB disease, given the error messages by gcc.
-
-  This version works when the type is used as the mock function's return
-  type.
-  """
-
-  gcc_4_3_1_regex = (
-      r'In member function \'int .*\n' + _FILE_LINE_RE +
-      r'error: a function call cannot appear in a constant-expression')
-  gcc_4_4_0_regex = (
-      r'error: a function call cannot appear in a constant-expression'
-      + _FILE_LINE_RE + r'error: template argument 1 is invalid\n')
-  diagnosis = _TTB_DIAGNOSIS % {'type': 'Foo'}
-  return (list(_GenericDiagnoser('TTB', 'Type in Template Base',
-                                gcc_4_3_1_regex, diagnosis, msg)) +
-          list(_GenericDiagnoser('TTB', 'Type in Template Base',
-                                 gcc_4_4_0_regex, diagnosis, msg)))
-
-
-def _TypeInTemplatedBaseDiagnoser2(msg):
-  """Diagnoses the TTB disease, given the error messages by gcc.
-
-  This version works when the type is used as the mock function's sole
-  parameter type.
-  """
-
-  regex = (_FILE_LINE_RE +
-           r'error: \'(?P<type>.+)\' was not declared in this scope\n'
-           r'.*error: template argument 1 is invalid\n')
-  return _GenericDiagnoser('TTB', 'Type in Template Base',
-                           regex, _TTB_DIAGNOSIS, msg)
-
-
-def _TypeInTemplatedBaseDiagnoser3(msg):
-  """Diagnoses the TTB disease, given the error messages by gcc.
-
-  This version works when the type is used as a parameter of a mock
-  function that has multiple parameters.
-  """
-
-  regex = (r'error: expected `;\' before \'::\' token\n'
-           + _FILE_LINE_RE +
-           r'error: \'(?P<type>.+)\' was not declared in this scope\n'
-           r'.*error: template argument 1 is invalid\n'
-           r'.*error: \'.+\' was not declared in this scope')
-  return _GenericDiagnoser('TTB', 'Type in Template Base',
-                           regex, _TTB_DIAGNOSIS, msg)
-
-
-def _WrongMockMethodMacroDiagnoser(msg):
-  """Diagnoses the WMM disease, given the error messages by gcc."""
-
-  regex = (_FILE_LINE_RE +
-           r'.*this_method_does_not_take_(?P<wrong_args>\d+)_argument.*\n'
-           r'.*\n'
-           r'.*candidates are.*FunctionMocker<[^>]+A(?P<args>\d+)\)>')
-  diagnosis = """
-You are using MOCK_METHOD%(wrong_args)s to define a mock method that has
-%(args)s arguments. Use MOCK_METHOD%(args)s (or MOCK_CONST_METHOD%(args)s,
-MOCK_METHOD%(args)s_T, MOCK_CONST_METHOD%(args)s_T as appropriate) instead."""
-  return _GenericDiagnoser('WMM', 'Wrong MOCK_METHODn Macro',
-                           regex, diagnosis, msg)
-
-
-def _WrongParenPositionDiagnoser(msg):
-  """Diagnoses the WPP disease, given the error messages by gcc."""
-
-  regex = (_FILE_LINE_RE +
-           r'error:.*testing::internal::MockSpec<.* has no member named \''
-           r'(?P<method>\w+)\'')
-  diagnosis = """
-The closing parenthesis of ON_CALL or EXPECT_CALL should be *before*
-".%(method)s".  For example, you should write:
-  EXPECT_CALL(my_mock, Foo(_)).%(method)s(...);
-instead of:
-  EXPECT_CALL(my_mock, Foo(_).%(method)s(...));"""
-  return _GenericDiagnoser('WPP', 'Wrong Parenthesis Position',
-                           regex, diagnosis, msg)
-
-
-_DIAGNOSERS = [
-    _IncompleteByReferenceArgumentDiagnoser,
-    _MockObjectPointerDiagnoser,
-    _NeedToReturnNothingDiagnoser,
-    _NeedToReturnReferenceDiagnoser,
-    _NeedToReturnSomethingDiagnoser,
-    _NeedToUseReturnNullDiagnoser,
-    _NeedToUseSymbolDiagnoser,
-    _OverloadedFunctionActionDiagnoser,
-    _OverloadedFunctionMatcherDiagnoser,
-    _OverloadedMethodActionDiagnoser1,
-    _OverloadedMethodActionDiagnoser2,
-    _TypeInTemplatedBaseDiagnoser1,
-    _TypeInTemplatedBaseDiagnoser2,
-    _TypeInTemplatedBaseDiagnoser3,
-    _WrongMockMethodMacroDiagnoser,
-    _WrongParenPositionDiagnoser,
-    ]
-
-
-def Diagnose(msg):
-  """Generates all possible diagnoses given the gcc error message."""
-
-  diagnoses = []
-  for diagnoser in _DIAGNOSERS:
-    for diag in diagnoser(msg):
-      diagnosis = '[%s - %s]\n%s' % diag
-      if not diagnosis in diagnoses:
-        diagnoses.append(diagnosis)
-  return diagnoses
-
-
-def main():
-  print ('Google Mock Doctor v%s - '
-         'diagnoses problems in code using Google Mock.' % _VERSION)
-
-  if sys.stdin.isatty():
-    print ('Please copy and paste the compiler errors here.  Press c-D when '
-           'you are done:')
-  else:
-    print 'Waiting for compiler errors on stdin . . .'
-
-  msg = sys.stdin.read().strip()
-  diagnoses = Diagnose(msg)
-  count = len(diagnoses)
-  if not count:
-    print '\nGcc complained:'
-    print '8<------------------------------------------------------------'
-    print msg
-    print '------------------------------------------------------------>8'
-    print """
-Uh-oh, I'm not smart enough to figure out what the problem is. :-(
-However...
-If you send your source code and gcc's error messages to
-googlemock@googlegroups.com, you can be helped and I can get smarter --
-win-win for us!"""
-  else:
-    print '------------------------------------------------------------'
-    print 'Your code appears to have the following',
-    if count > 1:
-      print '%s diseases:' % (count,)
-    else:
-      print 'disease:'
-    i = 0
-    for d in diagnoses:
-      i += 1
-      if count > 1:
-        print '\n#%s:' % (i,)
-      print d
-    print """
-How did I do?  If you think I'm wrong or unhelpful, please send your
-source code and gcc's error messages to googlemock@googlegroups.com.  Then
-you can be helped and I can get smarter -- I promise I won't be upset!"""
-
-
-if __name__ == '__main__':
-  main()
diff --git a/third_party/gmock/src/gmock-all.cc b/third_party/gmock/src/gmock-all.cc
deleted file mode 100644
index c9223fc..0000000
--- a/third_party/gmock/src/gmock-all.cc
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// Google C++ Mocking Framework (Google Mock)
-//
-// This file #includes all Google Mock implementation .cc files.  The
-// purpose is to allow a user to build Google Mock by compiling this
-// file alone.
-
-// This line ensures that gmock.h can be compiled on its own, even
-// when it's fused.
-#include <gmock/gmock.h>
-
-// The following lines pull in the real gmock *.cc files.
-#include "src/gmock-cardinalities.cc"
-#include "src/gmock-internal-utils.cc"
-#include "src/gmock-matchers.cc"
-#include "src/gmock-printers.cc"
-#include "src/gmock-spec-builders.cc"
-#include "src/gmock.cc"
diff --git a/third_party/gmock/src/gmock-cardinalities.cc b/third_party/gmock/src/gmock-cardinalities.cc
deleted file mode 100644
index 07eed46..0000000
--- a/third_party/gmock/src/gmock-cardinalities.cc
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements cardinalities.
-
-#include <gmock/gmock-cardinalities.h>
-
-#include <limits.h>
-#include <ostream>  // NOLINT
-#include <sstream>
-#include <string>
-#include <gmock/internal/gmock-internal-utils.h>
-#include <gtest/gtest.h>
-
-namespace testing {
-
-namespace {
-
-// Implements the Between(m, n) cardinality.
-class BetweenCardinalityImpl : public CardinalityInterface {
- public:
-  BetweenCardinalityImpl(int min, int max)
-      : min_(min >= 0 ? min : 0),
-        max_(max >= min_ ? max : min_) {
-    std::stringstream ss;
-    if (min < 0) {
-      ss << "The invocation lower bound must be >= 0, "
-         << "but is actually " << min << ".";
-      internal::Expect(false, __FILE__, __LINE__, ss.str());
-    } else if (max < 0) {
-      ss << "The invocation upper bound must be >= 0, "
-         << "but is actually " << max << ".";
-      internal::Expect(false, __FILE__, __LINE__, ss.str());
-    } else if (min > max) {
-      ss << "The invocation upper bound (" << max
-         << ") must be >= the invocation lower bound (" << min
-         << ").";
-      internal::Expect(false, __FILE__, __LINE__, ss.str());
-    }
-  }
-
-  // Conservative estimate on the lower/upper bound of the number of
-  // calls allowed.
-  virtual int ConservativeLowerBound() const { return min_; }
-  virtual int ConservativeUpperBound() const { return max_; }
-
-  virtual bool IsSatisfiedByCallCount(int call_count) const {
-    return min_ <= call_count && call_count <= max_ ;
-  }
-
-  virtual bool IsSaturatedByCallCount(int call_count) const {
-    return call_count >= max_;
-  }
-
-  virtual void DescribeTo(::std::ostream* os) const;
- private:
-  const int min_;
-  const int max_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(BetweenCardinalityImpl);
-};
-
-// Formats "n times" in a human-friendly way.
-inline internal::string FormatTimes(int n) {
-  if (n == 1) {
-    return "once";
-  } else if (n == 2) {
-    return "twice";
-  } else {
-    std::stringstream ss;
-    ss << n << " times";
-    return ss.str();
-  }
-}
-
-// Describes the Between(m, n) cardinality in human-friendly text.
-void BetweenCardinalityImpl::DescribeTo(::std::ostream* os) const {
-  if (min_ == 0) {
-    if (max_ == 0) {
-      *os << "never called";
-    } else if (max_ == INT_MAX) {
-      *os << "called any number of times";
-    } else {
-      *os << "called at most " << FormatTimes(max_);
-    }
-  } else if (min_ == max_) {
-    *os << "called " << FormatTimes(min_);
-  } else if (max_ == INT_MAX) {
-    *os << "called at least " << FormatTimes(min_);
-  } else {
-    // 0 < min_ < max_ < INT_MAX
-    *os << "called between " << min_ << " and " << max_ << " times";
-  }
-}
-
-}  // Unnamed namespace
-
-// Describes the given call count to an ostream.
-void Cardinality::DescribeActualCallCountTo(int actual_call_count,
-                                            ::std::ostream* os) {
-  if (actual_call_count > 0) {
-    *os << "called " << FormatTimes(actual_call_count);
-  } else {
-    *os << "never called";
-  }
-}
-
-// Creates a cardinality that allows at least n calls.
-Cardinality AtLeast(int n) { return Between(n, INT_MAX); }
-
-// Creates a cardinality that allows at most n calls.
-Cardinality AtMost(int n) { return Between(0, n); }
-
-// Creates a cardinality that allows any number of calls.
-Cardinality AnyNumber() { return AtLeast(0); }
-
-// Creates a cardinality that allows between min and max calls.
-Cardinality Between(int min, int max) {
-  return Cardinality(new BetweenCardinalityImpl(min, max));
-}
-
-// Creates a cardinality that allows exactly n calls.
-Cardinality Exactly(int n) { return Between(n, n); }
-
-}  // namespace testing
diff --git a/third_party/gmock/src/gmock-internal-utils.cc b/third_party/gmock/src/gmock-internal-utils.cc
deleted file mode 100644
index 196ec74..0000000
--- a/third_party/gmock/src/gmock-internal-utils.cc
+++ /dev/null
@@ -1,173 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file defines some utilities useful for implementing Google
-// Mock.  They are subject to change without notice, so please DO NOT
-// USE THEM IN USER CODE.
-
-#include <gmock/internal/gmock-internal-utils.h>
-
-#include <ctype.h>
-#include <ostream>  // NOLINT
-#include <string>
-#include <gmock/gmock.h>
-#include <gmock/internal/gmock-port.h>
-#include <gtest/gtest.h>
-
-namespace testing {
-namespace internal {
-
-// Converts an identifier name to a space-separated list of lower-case
-// words.  Each maximum substring of the form [A-Za-z][a-z]*|\d+ is
-// treated as one word.  For example, both "FooBar123" and
-// "foo_bar_123" are converted to "foo bar 123".
-string ConvertIdentifierNameToWords(const char* id_name) {
-  string result;
-  char prev_char = '\0';
-  for (const char* p = id_name; *p != '\0'; prev_char = *(p++)) {
-    // We don't care about the current locale as the input is
-    // guaranteed to be a valid C++ identifier name.
-    const bool starts_new_word = isupper(*p) ||
-        (!isalpha(prev_char) && islower(*p)) ||
-        (!isdigit(prev_char) && isdigit(*p));
-
-    if (isalnum(*p)) {
-      if (starts_new_word && result != "")
-        result += ' ';
-      result += tolower(*p);
-    }
-  }
-  return result;
-}
-
-// This class reports Google Mock failures as Google Test failures.  A
-// user can define another class in a similar fashion if he intends to
-// use Google Mock with a testing framework other than Google Test.
-class GoogleTestFailureReporter : public FailureReporterInterface {
- public:
-  virtual void ReportFailure(FailureType type, const char* file, int line,
-                             const string& message) {
-    AssertHelper(type == FATAL ?
-                 TestPartResult::kFatalFailure :
-                 TestPartResult::kNonFatalFailure,
-                 file,
-                 line,
-                 message.c_str()) = Message();
-    if (type == FATAL) {
-      posix::Abort();
-    }
-  }
-};
-
-// Returns the global failure reporter.  Will create a
-// GoogleTestFailureReporter and return it the first time called.
-FailureReporterInterface* GetFailureReporter() {
-  // Points to the global failure reporter used by Google Mock.  gcc
-  // guarantees that the following use of failure_reporter is
-  // thread-safe.  We may need to add additional synchronization to
-  // protect failure_reporter if we port Google Mock to other
-  // compilers.
-  static FailureReporterInterface* const failure_reporter =
-      new GoogleTestFailureReporter();
-  return failure_reporter;
-}
-
-// Protects global resources (stdout in particular) used by Log().
-static Mutex g_log_mutex(Mutex::NO_CONSTRUCTOR_NEEDED_FOR_STATIC_MUTEX);
-
-// Returns true iff a log with the given severity is visible according
-// to the --gmock_verbose flag.
-bool LogIsVisible(LogSeverity severity) {
-  if (GMOCK_FLAG(verbose) == kInfoVerbosity) {
-    // Always show the log if --gmock_verbose=info.
-    return true;
-  } else if (GMOCK_FLAG(verbose) == kErrorVerbosity) {
-    // Always hide it if --gmock_verbose=error.
-    return false;
-  } else {
-    // If --gmock_verbose is neither "info" nor "error", we treat it
-    // as "warning" (its default value).
-    return severity == WARNING;
-  }
-}
-
-// Prints the given message to stdout iff 'severity' >= the level
-// specified by the --gmock_verbose flag.  If stack_frames_to_skip >=
-// 0, also prints the stack trace excluding the top
-// stack_frames_to_skip frames.  In opt mode, any positive
-// stack_frames_to_skip is treated as 0, since we don't know which
-// function calls will be inlined by the compiler and need to be
-// conservative.
-void Log(LogSeverity severity, const string& message,
-         int stack_frames_to_skip) {
-  if (!LogIsVisible(severity))
-    return;
-
-  // Ensures that logs from different threads don't interleave.
-  MutexLock l(&g_log_mutex);
-
-  // "using ::std::cout;" doesn't work with Symbian's STLport, where cout is a
-  // macro.
-
-  if (severity == WARNING) {
-    // Prints a GMOCK WARNING marker to make the warnings easily searchable.
-    std::cout << "\nGMOCK WARNING:";
-  }
-  // Pre-pends a new-line to message if it doesn't start with one.
-  if (message.empty() || message[0] != '\n') {
-    std::cout << "\n";
-  }
-  std::cout << message;
-  if (stack_frames_to_skip >= 0) {
-#ifdef NDEBUG
-    // In opt mode, we have to be conservative and skip no stack frame.
-    const int actual_to_skip = 0;
-#else
-    // In dbg mode, we can do what the caller tell us to do (plus one
-    // for skipping this function's stack frame).
-    const int actual_to_skip = stack_frames_to_skip + 1;
-#endif  // NDEBUG
-
-    // Appends a new-line to message if it doesn't end with one.
-    if (!message.empty() && *message.rbegin() != '\n') {
-      std::cout << "\n";
-    }
-    std::cout << "Stack trace:\n"
-         << ::testing::internal::GetCurrentOsStackTraceExceptTop(
-             ::testing::UnitTest::GetInstance(), actual_to_skip);
-  }
-  std::cout << ::std::flush;
-}
-
-}  // namespace internal
-}  // namespace testing
diff --git a/third_party/gmock/src/gmock-matchers.cc b/third_party/gmock/src/gmock-matchers.cc
deleted file mode 100644
index 0abca70..0000000
--- a/third_party/gmock/src/gmock-matchers.cc
+++ /dev/null
@@ -1,190 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements Matcher<const string&>, Matcher<string>, and
-// utilities for defining matchers.
-
-#include <gmock/gmock-matchers.h>
-#include <gmock/gmock-generated-matchers.h>
-
-#include <string.h>
-#include <sstream>
-#include <string>
-
-namespace testing {
-
-// Constructs a matcher that matches a const string& whose value is
-// equal to s.
-Matcher<const internal::string&>::Matcher(const internal::string& s) {
-  *this = Eq(s);
-}
-
-// Constructs a matcher that matches a const string& whose value is
-// equal to s.
-Matcher<const internal::string&>::Matcher(const char* s) {
-  *this = Eq(internal::string(s));
-}
-
-// Constructs a matcher that matches a string whose value is equal to s.
-Matcher<internal::string>::Matcher(const internal::string& s) { *this = Eq(s); }
-
-// Constructs a matcher that matches a string whose value is equal to s.
-Matcher<internal::string>::Matcher(const char* s) {
-  *this = Eq(internal::string(s));
-}
-
-namespace internal {
-
-// Utilities for validating and formatting description strings in the
-// MATCHER*() macros.
-
-// Returns the 0-based index of the given parameter in the
-// NULL-terminated parameter array; if the parameter is "*", returns
-// kTupleInterpolation; if it's not found in the list, returns
-// kInvalidInterpolation.
-int GetParamIndex(const char* param_names[], const string& param_name) {
-  if (param_name == "*")
-    return kTupleInterpolation;
-
-  for (int i = 0; param_names[i] != NULL; i++) {
-    if (param_name == param_names[i])
-      return i;
-  }
-  return kInvalidInterpolation;
-}
-
-// Helper function used by ValidateMatcherDescription() to format
-// error messages.
-string FormatMatcherDescriptionSyntaxError(const char* description,
-                                           const char* error_pos) {
-  ::std::stringstream ss;
-  ss << "Syntax error at index " << (error_pos - description)
-     << " in matcher description \"" << description << "\": ";
-  return ss.str();
-}
-
-// Parses a matcher description string and returns a vector of
-// interpolations that appear in the string; generates non-fatal
-// failures iff 'description' is an invalid matcher description.
-// 'param_names' is a NULL-terminated array of parameter names in the
-// order they appear in the MATCHER_P*() parameter list.
-Interpolations ValidateMatcherDescription(
-    const char* param_names[], const char* description) {
-  Interpolations interps;
-  for (const char* p = description; *p != '\0';) {
-    if (SkipPrefix("%%", &p)) {
-      interps.push_back(Interpolation(p - 2, p, kPercentInterpolation));
-    } else if (SkipPrefix("%(", &p)) {
-      const char* const q = strstr(p, ")s");
-      if (q == NULL) {
-        // TODO(wan@google.com): change the source file location in
-        // the failure to point to where the MATCHER*() macro is used.
-        ADD_FAILURE() << FormatMatcherDescriptionSyntaxError(description, p - 2)
-                      << "an interpolation must end with \")s\", "
-                      << "but \"" << (p - 2) << "\" does not.";
-      } else {
-        const string param_name(p, q);
-        const int param_index = GetParamIndex(param_names, param_name);
-        if (param_index == kInvalidInterpolation) {
-          ADD_FAILURE() << FormatMatcherDescriptionSyntaxError(description, p)
-                        << "\"" << param_name
-                        << "\" is an invalid parameter name.";
-        } else {
-          interps.push_back(Interpolation(p - 2, q + 2, param_index));
-          p = q + 2;
-        }
-      }
-    } else {
-      EXPECT_NE(*p, '%') << FormatMatcherDescriptionSyntaxError(description, p)
-                         << "use \"%%\" instead of \"%\" to print \"%\".";
-      ++p;
-    }
-  }
-  return interps;
-}
-
-// Joins a vector of strings as if they are fields of a tuple; returns
-// the joined string.
-string JoinAsTuple(const Strings& fields) {
-  switch (fields.size()) {
-    case 0:
-      return "";
-    case 1:
-      return fields[0];
-    default:
-      string result = "(" + fields[0];
-      for (size_t i = 1; i < fields.size(); i++) {
-        result += ", ";
-        result += fields[i];
-      }
-      result += ")";
-      return result;
-  }
-}
-
-// Returns the actual matcher description, given the matcher name,
-// user-supplied description template string, interpolations in the
-// string, and the printed values of the matcher parameters.
-string FormatMatcherDescription(
-    const char* matcher_name, const char* description,
-    const Interpolations& interp, const Strings& param_values) {
-  string result;
-  if (*description == '\0') {
-    // When the user supplies an empty description, we calculate one
-    // from the matcher name.
-    result = ConvertIdentifierNameToWords(matcher_name);
-    if (param_values.size() >= 1)
-      result += " " + JoinAsTuple(param_values);
-  } else {
-    // The end position of the last interpolation.
-    const char* last_interp_end = description;
-    for (size_t i = 0; i < interp.size(); i++) {
-      result.append(last_interp_end, interp[i].start_pos);
-      const int param_index = interp[i].param_index;
-      if (param_index == kTupleInterpolation) {
-        result += JoinAsTuple(param_values);
-      } else if (param_index == kPercentInterpolation) {
-        result += '%';
-      } else if (param_index != kInvalidInterpolation) {
-        result += param_values[param_index];
-      }
-      last_interp_end = interp[i].end_pos;
-    }
-    result += last_interp_end;
-  }
-
-  return result;
-}
-
-}  // namespace internal
-}  // namespace testing
diff --git a/third_party/gmock/src/gmock-printers.cc b/third_party/gmock/src/gmock-printers.cc
deleted file mode 100644
index 8efba78..0000000
--- a/third_party/gmock/src/gmock-printers.cc
+++ /dev/null
@@ -1,320 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements a universal value printer that can print a
-// value of any type T:
-//
-//   void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);
-//
-// It uses the << operator when possible, and prints the bytes in the
-// object otherwise.  A user can override its behavior for a class
-// type Foo by defining either operator<<(::std::ostream&, const Foo&)
-// or void PrintTo(const Foo&, ::std::ostream*) in the namespace that
-// defines Foo.
-
-#include <gmock/gmock-printers.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <ostream>  // NOLINT
-#include <string>
-#include <gmock/internal/gmock-port.h>
-
-namespace testing {
-
-namespace {
-
-using ::std::ostream;
-
-#if GTEST_OS_WINDOWS_MOBILE  // Windows CE does not define _snprintf_s.
-#define snprintf _snprintf
-#elif _MSC_VER >= 1400  // VC 8.0 and later deprecate snprintf and _snprintf.
-#define snprintf _snprintf_s
-#elif _MSC_VER
-#define snprintf _snprintf
-#endif  // GTEST_OS_WINDOWS_MOBILE
-
-// Prints a segment of bytes in the given object.
-void PrintByteSegmentInObjectTo(const unsigned char* obj_bytes, size_t start,
-                                size_t count, ostream* os) {
-  char text[5] = "";
-  for (size_t i = 0; i != count; i++) {
-    const size_t j = start + i;
-    if (i != 0) {
-      // Organizes the bytes into groups of 2 for easy parsing by
-      // human.
-      if ((j % 2) == 0) {
-        *os << " ";
-      }
-    }
-    snprintf(text, sizeof(text), "%02X", obj_bytes[j]);
-    *os << text;
-  }
-}
-
-// Prints the bytes in the given value to the given ostream.
-void PrintBytesInObjectToImpl(const unsigned char* obj_bytes, size_t count,
-                              ostream* os) {
-  // Tells the user how big the object is.
-  *os << count << "-byte object <";
-
-  const size_t kThreshold = 132;
-  const size_t kChunkSize = 64;
-  // If the object size is bigger than kThreshold, we'll have to omit
-  // some details by printing only the first and the last kChunkSize
-  // bytes.
-  // TODO(wan): let the user control the threshold using a flag.
-  if (count < kThreshold) {
-    PrintByteSegmentInObjectTo(obj_bytes, 0, count, os);
-  } else {
-    PrintByteSegmentInObjectTo(obj_bytes, 0, kChunkSize, os);
-    *os << " ... ";
-    // Rounds up to 2-byte boundary.
-    const size_t resume_pos = (count - kChunkSize + 1)/2*2;
-    PrintByteSegmentInObjectTo(obj_bytes, resume_pos, count - resume_pos, os);
-  }
-  *os << ">";
-}
-
-}  // namespace
-
-namespace internal2 {
-
-// Delegates to PrintBytesInObjectToImpl() to print the bytes in the
-// given object.  The delegation simplifies the implementation, which
-// uses the << operator and thus is easier done outside of the
-// ::testing::internal namespace, which contains a << operator that
-// sometimes conflicts with the one in STL.
-void PrintBytesInObjectTo(const unsigned char* obj_bytes, size_t count,
-                          ostream* os) {
-  PrintBytesInObjectToImpl(obj_bytes, count, os);
-}
-
-}  // namespace internal2
-
-namespace internal {
-
-// Prints a wide char as a char literal without the quotes, escaping it
-// when necessary.
-static void PrintAsWideCharLiteralTo(wchar_t c, ostream* os) {
-  switch (c) {
-    case L'\0':
-      *os << "\\0";
-      break;
-    case L'\'':
-      *os << "\\'";
-      break;
-    case L'\?':
-      *os << "\\?";
-      break;
-    case L'\\':
-      *os << "\\\\";
-      break;
-    case L'\a':
-      *os << "\\a";
-      break;
-    case L'\b':
-      *os << "\\b";
-      break;
-    case L'\f':
-      *os << "\\f";
-      break;
-    case L'\n':
-      *os << "\\n";
-      break;
-    case L'\r':
-      *os << "\\r";
-      break;
-    case L'\t':
-      *os << "\\t";
-      break;
-    case L'\v':
-      *os << "\\v";
-      break;
-    default:
-      // Checks whether c is printable or not. Printable characters are in
-      // the range [0x20,0x7E].
-      // We test the value of c directly instead of calling isprint(), as
-      // isprint() is buggy on Windows mobile.
-      if (0x20 <= c && c <= 0x7E) {
-        *os << static_cast<char>(c);
-      } else {
-        // Buffer size enough for the maximum number of digits and \0.
-        char text[2 * sizeof(unsigned long) + 1] = "";
-        snprintf(text, sizeof(text), "%lX", static_cast<unsigned long>(c));
-        *os << "\\x" << text;
-      }
-  }
-}
-
-// Prints a char as if it's part of a string literal, escaping it when
-// necessary.
-static void PrintAsWideStringLiteralTo(wchar_t c, ostream* os) {
-  switch (c) {
-    case L'\'':
-      *os << "'";
-      break;
-    case L'"':
-      *os << "\\\"";
-      break;
-    default:
-      PrintAsWideCharLiteralTo(c, os);
-  }
-}
-
-// Prints a char as a char literal without the quotes, escaping it
-// when necessary.
-static void PrintAsCharLiteralTo(char c, ostream* os) {
-  PrintAsWideCharLiteralTo(static_cast<unsigned char>(c), os);
-}
-
-// Prints a char as if it's part of a string literal, escaping it when
-// necessary.
-static void PrintAsStringLiteralTo(char c, ostream* os) {
-  PrintAsWideStringLiteralTo(static_cast<unsigned char>(c), os);
-}
-
-// Prints a char and its code.  The '\0' char is printed as "'\\0'",
-// other unprintable characters are also properly escaped using the
-// standard C++ escape sequence.
-void PrintCharTo(char c, int char_code, ostream* os) {
-  *os << "'";
-  PrintAsCharLiteralTo(c, os);
-  *os << "'";
-  if (c != '\0')
-    *os << " (" << char_code << ")";
-}
-
-// Prints a wchar_t as a symbol if it is printable or as its internal
-// code otherwise and also as its decimal code (except for L'\0').
-// The L'\0' char is printed as "L'\\0'". The decimal code is printed
-// as signed integer when wchar_t is implemented by the compiler
-// as a signed type and is printed as an unsigned integer when wchar_t
-// is implemented as an unsigned type.
-void PrintTo(wchar_t wc, ostream* os) {
-  *os << "L'";
-  PrintAsWideCharLiteralTo(wc, os);
-  *os << "'";
-  if (wc != L'\0') {
-    // Type Int64 is used because it provides more storage than wchar_t thus
-    // when the compiler converts signed or unsigned implementation of wchar_t
-    // to Int64 it fills higher bits with either zeros or the sign bit
-    // passing it to operator <<() as either signed or unsigned integer.
-    *os << " (" << static_cast<Int64>(wc) << ")";
-  }
-}
-
-// Prints the given array of characters to the ostream.
-// The array starts at *begin, the length is len, it may include '\0' characters
-// and may not be null-terminated.
-static void PrintCharsAsStringTo(const char* begin, size_t len, ostream* os) {
-  *os << "\"";
-  for (size_t index = 0; index < len; ++index) {
-    PrintAsStringLiteralTo(begin[index], os);
-  }
-  *os << "\"";
-}
-
-// Prints a (const) char array of 'len' elements, starting at address 'begin'.
-void UniversalPrintArray(const char* begin, size_t len, ostream* os) {
-  PrintCharsAsStringTo(begin, len, os);
-}
-
-// Prints the given array of wide characters to the ostream.
-// The array starts at *begin, the length is len, it may include L'\0'
-// characters and may not be null-terminated.
-static void PrintWideCharsAsStringTo(const wchar_t* begin, size_t len,
-                                     ostream* os) {
-  *os << "L\"";
-  for (size_t index = 0; index < len; ++index) {
-    PrintAsWideStringLiteralTo(begin[index], os);
-  }
-  *os << "\"";
-}
-
-// Prints the given C string to the ostream.
-void PrintTo(const char* s, ostream* os) {
-  if (s == NULL) {
-    *os << "NULL";
-  } else {
-    *os << implicit_cast<const void*>(s) << " pointing to ";
-    PrintCharsAsStringTo(s, strlen(s), os);
-  }
-}
-
-// MSVC compiler can be configured to define whar_t as a typedef
-// of unsigned short. Defining an overload for const wchar_t* in that case
-// would cause pointers to unsigned shorts be printed as wide strings,
-// possibly accessing more memory than intended and causing invalid
-// memory accesses. MSVC defines _NATIVE_WCHAR_T_DEFINED symbol when
-// wchar_t is implemented as a native type.
-#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
-// Prints the given wide C string to the ostream.
-void PrintTo(const wchar_t* s, ostream* os) {
-  if (s == NULL) {
-    *os << "NULL";
-  } else {
-    *os << implicit_cast<const void*>(s) << " pointing to ";
-    PrintWideCharsAsStringTo(s, wcslen(s), os);
-  }
-}
-#endif  // wchar_t is native
-
-// Prints a ::string object.
-#if GTEST_HAS_GLOBAL_STRING
-void PrintStringTo(const ::string& s, ostream* os) {
-  PrintCharsAsStringTo(s.data(), s.size(), os);
-}
-#endif  // GTEST_HAS_GLOBAL_STRING
-
-#if GTEST_HAS_STD_STRING
-void PrintStringTo(const ::std::string& s, ostream* os) {
-  PrintCharsAsStringTo(s.data(), s.size(), os);
-}
-#endif  // GTEST_HAS_STD_STRING
-
-// Prints a ::wstring object.
-#if GTEST_HAS_GLOBAL_WSTRING
-void PrintWideStringTo(const ::wstring& s, ostream* os) {
-  PrintWideCharsAsStringTo(s.data(), s.size(), os);
-}
-#endif  // GTEST_HAS_GLOBAL_WSTRING
-
-#if GTEST_HAS_STD_WSTRING
-void PrintWideStringTo(const ::std::wstring& s, ostream* os) {
-  PrintWideCharsAsStringTo(s.data(), s.size(), os);
-}
-#endif  // GTEST_HAS_STD_WSTRING
-
-}  // namespace internal
-
-}  // namespace testing
diff --git a/third_party/gmock/src/gmock-spec-builders.cc b/third_party/gmock/src/gmock-spec-builders.cc
deleted file mode 100644
index edd60fe..0000000
--- a/third_party/gmock/src/gmock-spec-builders.cc
+++ /dev/null
@@ -1,465 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements the spec builder syntax (ON_CALL and
-// EXPECT_CALL).
-
-#include <gmock/gmock-spec-builders.h>
-
-#include <stdlib.h>
-#include <iostream>  // NOLINT
-#include <map>
-#include <set>
-#include <string>
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
-#if GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC
-#include <unistd.h>  // NOLINT
-#endif
-
-namespace testing {
-namespace internal {
-
-// Protects the mock object registry (in class Mock), all function
-// mockers, and all expectations.
-Mutex g_gmock_mutex(Mutex::NO_CONSTRUCTOR_NEEDED_FOR_STATIC_MUTEX);
-
-// Constructs an ExpectationBase object.
-ExpectationBase::ExpectationBase(const char* file,
-                                 int line,
-                                 const string& source_text)
-    : file_(file),
-      line_(line),
-      source_text_(source_text),
-      cardinality_specified_(false),
-      cardinality_(Exactly(1)),
-      call_count_(0),
-      retired_(false) {
-}
-
-// Destructs an ExpectationBase object.
-ExpectationBase::~ExpectationBase() {}
-
-// Explicitly specifies the cardinality of this expectation.  Used by
-// the subclasses to implement the .Times() clause.
-void ExpectationBase::SpecifyCardinality(const Cardinality& cardinality) {
-  cardinality_specified_ = true;
-  cardinality_ = cardinality;
-}
-
-// Retires all pre-requisites of this expectation.
-void ExpectationBase::RetireAllPreRequisites() {
-  if (is_retired()) {
-    // We can take this short-cut as we never retire an expectation
-    // until we have retired all its pre-requisites.
-    return;
-  }
-
-  for (ExpectationSet::const_iterator it = immediate_prerequisites_.begin();
-       it != immediate_prerequisites_.end(); ++it) {
-    ExpectationBase* const prerequisite = it->expectation_base().get();
-    if (!prerequisite->is_retired()) {
-      prerequisite->RetireAllPreRequisites();
-      prerequisite->Retire();
-    }
-  }
-}
-
-// Returns true iff all pre-requisites of this expectation have been
-// satisfied.
-// L >= g_gmock_mutex
-bool ExpectationBase::AllPrerequisitesAreSatisfied() const {
-  g_gmock_mutex.AssertHeld();
-  for (ExpectationSet::const_iterator it = immediate_prerequisites_.begin();
-       it != immediate_prerequisites_.end(); ++it) {
-    if (!(it->expectation_base()->IsSatisfied()) ||
-        !(it->expectation_base()->AllPrerequisitesAreSatisfied()))
-      return false;
-  }
-  return true;
-}
-
-// Adds unsatisfied pre-requisites of this expectation to 'result'.
-// L >= g_gmock_mutex
-void ExpectationBase::FindUnsatisfiedPrerequisites(
-    ExpectationSet* result) const {
-  g_gmock_mutex.AssertHeld();
-  for (ExpectationSet::const_iterator it = immediate_prerequisites_.begin();
-       it != immediate_prerequisites_.end(); ++it) {
-    if (it->expectation_base()->IsSatisfied()) {
-      // If *it is satisfied and has a call count of 0, some of its
-      // pre-requisites may not be satisfied yet.
-      if (it->expectation_base()->call_count_ == 0) {
-        it->expectation_base()->FindUnsatisfiedPrerequisites(result);
-      }
-    } else {
-      // Now that we know *it is unsatisfied, we are not so interested
-      // in whether its pre-requisites are satisfied.  Therefore we
-      // don't recursively call FindUnsatisfiedPrerequisites() here.
-      *result += *it;
-    }
-  }
-}
-
-// Points to the implicit sequence introduced by a living InSequence
-// object (if any) in the current thread or NULL.
-ThreadLocal<Sequence*> g_gmock_implicit_sequence;
-
-// Reports an uninteresting call (whose description is in msg) in the
-// manner specified by 'reaction'.
-void ReportUninterestingCall(CallReaction reaction, const string& msg) {
-  switch (reaction) {
-    case ALLOW:
-      Log(INFO, msg, 3);
-      break;
-    case WARN:
-      Log(WARNING, msg, 3);
-      break;
-    default:  // FAIL
-      Expect(false, NULL, -1, msg);
-  }
-}
-
-}  // namespace internal
-
-// Class Mock.
-
-namespace {
-
-typedef std::set<internal::UntypedFunctionMockerBase*> FunctionMockers;
-
-// The current state of a mock object.  Such information is needed for
-// detecting leaked mock objects and explicitly verifying a mock's
-// expectations.
-struct MockObjectState {
-  MockObjectState()
-      : first_used_file(NULL), first_used_line(-1), leakable(false) {}
-
-  // Where in the source file an ON_CALL or EXPECT_CALL is first
-  // invoked on this mock object.
-  const char* first_used_file;
-  int first_used_line;
-  ::std::string first_used_test_case;
-  ::std::string first_used_test;
-  bool leakable;  // true iff it's OK to leak the object.
-  FunctionMockers function_mockers;  // All registered methods of the object.
-};
-
-// A global registry holding the state of all mock objects that are
-// alive.  A mock object is added to this registry the first time
-// Mock::AllowLeak(), ON_CALL(), or EXPECT_CALL() is called on it.  It
-// is removed from the registry in the mock object's destructor.
-class MockObjectRegistry {
- public:
-  // Maps a mock object (identified by its address) to its state.
-  typedef std::map<const void*, MockObjectState> StateMap;
-
-  // This destructor will be called when a program exits, after all
-  // tests in it have been run.  By then, there should be no mock
-  // object alive.  Therefore we report any living object as test
-  // failure, unless the user explicitly asked us to ignore it.
-  ~MockObjectRegistry() {
-
-    // "using ::std::cout;" doesn't work with Symbian's STLport, where cout is
-    // a macro.
-
-    if (!GMOCK_FLAG(catch_leaked_mocks))
-      return;
-
-    int leaked_count = 0;
-    for (StateMap::const_iterator it = states_.begin(); it != states_.end();
-         ++it) {
-      if (it->second.leakable)  // The user said it's fine to leak this object.
-        continue;
-
-      // TODO(wan@google.com): Print the type of the leaked object.
-      // This can help the user identify the leaked object.
-      std::cout << "\n";
-      const MockObjectState& state = it->second;
-      std::cout << internal::FormatFileLocation(state.first_used_file,
-                                                state.first_used_line);
-      std::cout << " ERROR: this mock object";
-      if (state.first_used_test != "") {
-        std::cout << " (used in test " << state.first_used_test_case << "."
-             << state.first_used_test << ")";
-      }
-      std::cout << " should be deleted but never is. Its address is @"
-           << it->first << ".";
-      leaked_count++;
-    }
-    if (leaked_count > 0) {
-      std::cout << "\nERROR: " << leaked_count
-           << " leaked mock " << (leaked_count == 1 ? "object" : "objects")
-           << " found at program exit.\n";
-      std::cout.flush();
-      ::std::cerr.flush();
-      // RUN_ALL_TESTS() has already returned when this destructor is
-      // called.  Therefore we cannot use the normal Google Test
-      // failure reporting mechanism.
-      _exit(1);  // We cannot call exit() as it is not reentrant and
-                 // may already have been called.
-    }
-  }
-
-  StateMap& states() { return states_; }
- private:
-  StateMap states_;
-};
-
-// Protected by g_gmock_mutex.
-MockObjectRegistry g_mock_object_registry;
-
-// Maps a mock object to the reaction Google Mock should have when an
-// uninteresting method is called.  Protected by g_gmock_mutex.
-std::map<const void*, internal::CallReaction> g_uninteresting_call_reaction;
-
-// Sets the reaction Google Mock should have when an uninteresting
-// method of the given mock object is called.
-// L < g_gmock_mutex
-void SetReactionOnUninterestingCalls(const void* mock_obj,
-                                     internal::CallReaction reaction) {
-  internal::MutexLock l(&internal::g_gmock_mutex);
-  g_uninteresting_call_reaction[mock_obj] = reaction;
-}
-
-}  // namespace
-
-// Tells Google Mock to allow uninteresting calls on the given mock
-// object.
-// L < g_gmock_mutex
-void Mock::AllowUninterestingCalls(const void* mock_obj) {
-  SetReactionOnUninterestingCalls(mock_obj, internal::ALLOW);
-}
-
-// Tells Google Mock to warn the user about uninteresting calls on the
-// given mock object.
-// L < g_gmock_mutex
-void Mock::WarnUninterestingCalls(const void* mock_obj) {
-  SetReactionOnUninterestingCalls(mock_obj, internal::WARN);
-}
-
-// Tells Google Mock to fail uninteresting calls on the given mock
-// object.
-// L < g_gmock_mutex
-void Mock::FailUninterestingCalls(const void* mock_obj) {
-  SetReactionOnUninterestingCalls(mock_obj, internal::FAIL);
-}
-
-// Tells Google Mock the given mock object is being destroyed and its
-// entry in the call-reaction table should be removed.
-// L < g_gmock_mutex
-void Mock::UnregisterCallReaction(const void* mock_obj) {
-  internal::MutexLock l(&internal::g_gmock_mutex);
-  g_uninteresting_call_reaction.erase(mock_obj);
-}
-
-// Returns the reaction Google Mock will have on uninteresting calls
-// made on the given mock object.
-// L < g_gmock_mutex
-internal::CallReaction Mock::GetReactionOnUninterestingCalls(
-    const void* mock_obj) {
-  internal::MutexLock l(&internal::g_gmock_mutex);
-  return (g_uninteresting_call_reaction.count(mock_obj) == 0) ?
-      internal::WARN : g_uninteresting_call_reaction[mock_obj];
-}
-
-// Tells Google Mock to ignore mock_obj when checking for leaked mock
-// objects.
-// L < g_gmock_mutex
-void Mock::AllowLeak(const void* mock_obj) {
-  internal::MutexLock l(&internal::g_gmock_mutex);
-  g_mock_object_registry.states()[mock_obj].leakable = true;
-}
-
-// Verifies and clears all expectations on the given mock object.  If
-// the expectations aren't satisfied, generates one or more Google
-// Test non-fatal failures and returns false.
-// L < g_gmock_mutex
-bool Mock::VerifyAndClearExpectations(void* mock_obj) {
-  internal::MutexLock l(&internal::g_gmock_mutex);
-  return VerifyAndClearExpectationsLocked(mock_obj);
-}
-
-// Verifies all expectations on the given mock object and clears its
-// default actions and expectations.  Returns true iff the
-// verification was successful.
-// L < g_gmock_mutex
-bool Mock::VerifyAndClear(void* mock_obj) {
-  internal::MutexLock l(&internal::g_gmock_mutex);
-  ClearDefaultActionsLocked(mock_obj);
-  return VerifyAndClearExpectationsLocked(mock_obj);
-}
-
-// Verifies and clears all expectations on the given mock object.  If
-// the expectations aren't satisfied, generates one or more Google
-// Test non-fatal failures and returns false.
-// L >= g_gmock_mutex
-bool Mock::VerifyAndClearExpectationsLocked(void* mock_obj) {
-  internal::g_gmock_mutex.AssertHeld();
-  if (g_mock_object_registry.states().count(mock_obj) == 0) {
-    // No EXPECT_CALL() was set on the given mock object.
-    return true;
-  }
-
-  // Verifies and clears the expectations on each mock method in the
-  // given mock object.
-  bool expectations_met = true;
-  FunctionMockers& mockers =
-      g_mock_object_registry.states()[mock_obj].function_mockers;
-  for (FunctionMockers::const_iterator it = mockers.begin();
-       it != mockers.end(); ++it) {
-    if (!(*it)->VerifyAndClearExpectationsLocked()) {
-      expectations_met = false;
-    }
-  }
-
-  // We don't clear the content of mockers, as they may still be
-  // needed by ClearDefaultActionsLocked().
-  return expectations_met;
-}
-
-// Registers a mock object and a mock method it owns.
-// L < g_gmock_mutex
-void Mock::Register(const void* mock_obj,
-                    internal::UntypedFunctionMockerBase* mocker) {
-  internal::MutexLock l(&internal::g_gmock_mutex);
-  g_mock_object_registry.states()[mock_obj].function_mockers.insert(mocker);
-}
-
-// Tells Google Mock where in the source code mock_obj is used in an
-// ON_CALL or EXPECT_CALL.  In case mock_obj is leaked, this
-// information helps the user identify which object it is.
-// L < g_gmock_mutex
-void Mock::RegisterUseByOnCallOrExpectCall(
-    const void* mock_obj, const char* file, int line) {
-  internal::MutexLock l(&internal::g_gmock_mutex);
-  MockObjectState& state = g_mock_object_registry.states()[mock_obj];
-  if (state.first_used_file == NULL) {
-    state.first_used_file = file;
-    state.first_used_line = line;
-    const TestInfo* const test_info =
-        UnitTest::GetInstance()->current_test_info();
-    if (test_info != NULL) {
-      // TODO(wan@google.com): record the test case name when the
-      // ON_CALL or EXPECT_CALL is invoked from SetUpTestCase() or
-      // TearDownTestCase().
-      state.first_used_test_case = test_info->test_case_name();
-      state.first_used_test = test_info->name();
-    }
-  }
-}
-
-// Unregisters a mock method; removes the owning mock object from the
-// registry when the last mock method associated with it has been
-// unregistered.  This is called only in the destructor of
-// FunctionMockerBase.
-// L >= g_gmock_mutex
-void Mock::UnregisterLocked(internal::UntypedFunctionMockerBase* mocker) {
-  internal::g_gmock_mutex.AssertHeld();
-  for (MockObjectRegistry::StateMap::iterator it =
-           g_mock_object_registry.states().begin();
-       it != g_mock_object_registry.states().end(); ++it) {
-    FunctionMockers& mockers = it->second.function_mockers;
-    if (mockers.erase(mocker) > 0) {
-      // mocker was in mockers and has been just removed.
-      if (mockers.empty()) {
-        g_mock_object_registry.states().erase(it);
-      }
-      return;
-    }
-  }
-}
-
-// Clears all ON_CALL()s set on the given mock object.
-// L >= g_gmock_mutex
-void Mock::ClearDefaultActionsLocked(void* mock_obj) {
-  internal::g_gmock_mutex.AssertHeld();
-
-  if (g_mock_object_registry.states().count(mock_obj) == 0) {
-    // No ON_CALL() was set on the given mock object.
-    return;
-  }
-
-  // Clears the default actions for each mock method in the given mock
-  // object.
-  FunctionMockers& mockers =
-      g_mock_object_registry.states()[mock_obj].function_mockers;
-  for (FunctionMockers::const_iterator it = mockers.begin();
-       it != mockers.end(); ++it) {
-    (*it)->ClearDefaultActionsLocked();
-  }
-
-  // We don't clear the content of mockers, as they may still be
-  // needed by VerifyAndClearExpectationsLocked().
-}
-
-Expectation::Expectation() {}
-
-Expectation::Expectation(
-    const internal::linked_ptr<internal::ExpectationBase>& expectation_base)
-    : expectation_base_(expectation_base) {}
-
-Expectation::~Expectation() {}
-
-// Adds an expectation to a sequence.
-void Sequence::AddExpectation(const Expectation& expectation) const {
-  if (*last_expectation_ != expectation) {
-    if (last_expectation_->expectation_base() != NULL) {
-      expectation.expectation_base()->immediate_prerequisites_
-          += *last_expectation_;
-    }
-    *last_expectation_ = expectation;
-  }
-}
-
-// Creates the implicit sequence if there isn't one.
-InSequence::InSequence() {
-  if (internal::g_gmock_implicit_sequence.get() == NULL) {
-    internal::g_gmock_implicit_sequence.set(new Sequence);
-    sequence_created_ = true;
-  } else {
-    sequence_created_ = false;
-  }
-}
-
-// Deletes the implicit sequence if it was created by the constructor
-// of this object.
-InSequence::~InSequence() {
-  if (sequence_created_) {
-    delete internal::g_gmock_implicit_sequence.get();
-    internal::g_gmock_implicit_sequence.set(NULL);
-  }
-}
-
-}  // namespace testing
diff --git a/third_party/gmock/src/gmock.cc b/third_party/gmock/src/gmock.cc
deleted file mode 100644
index f487265..0000000
--- a/third_party/gmock/src/gmock.cc
+++ /dev/null
@@ -1,182 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-#include <gmock/gmock.h>
-#include <gmock/internal/gmock-port.h>
-
-namespace testing {
-
-// TODO(wan@google.com): support using environment variables to
-// control the flag values, like what Google Test does.
-
-GMOCK_DEFINE_bool_(catch_leaked_mocks, true,
-                   "true iff Google Mock should report leaked mock objects "
-                   "as failures.");
-
-GMOCK_DEFINE_string_(verbose, internal::kWarningVerbosity,
-                     "Controls how verbose Google Mock's output is."
-                     "  Valid values:\n"
-                     "  info    - prints all messages.\n"
-                     "  warning - prints warnings and errors.\n"
-                     "  error   - prints errors only.");
-
-namespace internal {
-
-// Parses a string as a command line flag.  The string should have the
-// format "--gmock_flag=value".  When def_optional is true, the
-// "=value" part can be omitted.
-//
-// Returns the value of the flag, or NULL if the parsing failed.
-static const char* ParseGoogleMockFlagValue(const char* str,
-                                            const char* flag,
-                                            bool def_optional) {
-  // str and flag must not be NULL.
-  if (str == NULL || flag == NULL) return NULL;
-
-  // The flag must start with "--gmock_".
-  const String flag_str = String::Format("--gmock_%s", flag);
-  const size_t flag_len = flag_str.length();
-  if (strncmp(str, flag_str.c_str(), flag_len) != 0) return NULL;
-
-  // Skips the flag name.
-  const char* flag_end = str + flag_len;
-
-  // When def_optional is true, it's OK to not have a "=value" part.
-  if (def_optional && (flag_end[0] == '\0')) {
-    return flag_end;
-  }
-
-  // If def_optional is true and there are more characters after the
-  // flag name, or if def_optional is false, there must be a '=' after
-  // the flag name.
-  if (flag_end[0] != '=') return NULL;
-
-  // Returns the string after "=".
-  return flag_end + 1;
-}
-
-// Parses a string for a Google Mock bool flag, in the form of
-// "--gmock_flag=value".
-//
-// On success, stores the value of the flag in *value, and returns
-// true.  On failure, returns false without changing *value.
-static bool ParseGoogleMockBoolFlag(const char* str, const char* flag,
-                                    bool* value) {
-  // Gets the value of the flag as a string.
-  const char* const value_str = ParseGoogleMockFlagValue(str, flag, true);
-
-  // Aborts if the parsing failed.
-  if (value_str == NULL) return false;
-
-  // Converts the string value to a bool.
-  *value = !(*value_str == '0' || *value_str == 'f' || *value_str == 'F');
-  return true;
-}
-
-// Parses a string for a Google Mock string flag, in the form of
-// "--gmock_flag=value".
-//
-// On success, stores the value of the flag in *value, and returns
-// true.  On failure, returns false without changing *value.
-static bool ParseGoogleMockStringFlag(const char* str, const char* flag,
-                                      String* value) {
-  // Gets the value of the flag as a string.
-  const char* const value_str = ParseGoogleMockFlagValue(str, flag, false);
-
-  // Aborts if the parsing failed.
-  if (value_str == NULL) return false;
-
-  // Sets *value to the value of the flag.
-  *value = value_str;
-  return true;
-}
-
-// The internal implementation of InitGoogleMock().
-//
-// The type parameter CharType can be instantiated to either char or
-// wchar_t.
-template <typename CharType>
-void InitGoogleMockImpl(int* argc, CharType** argv) {
-  // Makes sure Google Test is initialized.  InitGoogleTest() is
-  // idempotent, so it's fine if the user has already called it.
-  InitGoogleTest(argc, argv);
-  if (*argc <= 0) return;
-
-  for (int i = 1; i != *argc; i++) {
-    const String arg_string = StreamableToString(argv[i]);
-    const char* const arg = arg_string.c_str();
-
-    // Do we see a Google Mock flag?
-    if (ParseGoogleMockBoolFlag(arg, "catch_leaked_mocks",
-                                &GMOCK_FLAG(catch_leaked_mocks)) ||
-        ParseGoogleMockStringFlag(arg, "verbose", &GMOCK_FLAG(verbose))) {
-      // Yes.  Shift the remainder of the argv list left by one.  Note
-      // that argv has (*argc + 1) elements, the last one always being
-      // NULL.  The following loop moves the trailing NULL element as
-      // well.
-      for (int j = i; j != *argc; j++) {
-        argv[j] = argv[j + 1];
-      }
-
-      // Decrements the argument count.
-      (*argc)--;
-
-      // We also need to decrement the iterator as we just removed
-      // an element.
-      i--;
-    }
-  }
-}
-
-}  // namespace internal
-
-// Initializes Google Mock.  This must be called before running the
-// tests.  In particular, it parses a command line for the flags that
-// Google Mock recognizes.  Whenever a Google Mock flag is seen, it is
-// removed from argv, and *argc is decremented.
-//
-// No value is returned.  Instead, the Google Mock flag variables are
-// updated.
-//
-// Since Google Test is needed for Google Mock to work, this function
-// also initializes Google Test and parses its flags, if that hasn't
-// been done.
-void InitGoogleMock(int* argc, char** argv) {
-  internal::InitGoogleMockImpl(argc, argv);
-}
-
-// This overloaded version can be used in Windows programs compiled in
-// UNICODE mode.
-void InitGoogleMock(int* argc, wchar_t** argv) {
-  internal::InitGoogleMockImpl(argc, argv);
-}
-
-}  // namespace testing
diff --git a/third_party/gmock/src/gmock_main.cc b/third_party/gmock/src/gmock_main.cc
deleted file mode 100644
index 0a3071b..0000000
--- a/third_party/gmock/src/gmock_main.cc
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-#include <iostream>
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
-// MS C++ compiler/linker has a bug on Windows (not on Windows CE), which
-// causes a link error when _tmain is defined in a static library and UNICODE
-// is enabled. For this reason instead of _tmain, main function is used on
-// Windows. See the following link to track the current status of this bug:
-// http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=394464  // NOLINT
-#if GTEST_OS_WINDOWS_MOBILE
-#include <tchar.h>  // NOLINT
-
-int _tmain(int argc, TCHAR** argv) {
-#else
-int main(int argc, char** argv) {
-#endif  // GTEST_OS_WINDOWS_MOBILE
-  std::cout << "Running main() from gmock_main.cc\n";
-  // Since Google Mock depends on Google Test, InitGoogleMock() is
-  // also responsible for initializing Google Test.  Therefore there's
-  // no need for calling testing::InitGoogleTest() separately.
-  testing::InitGoogleMock(&argc, argv);
-  return RUN_ALL_TESTS();
-}
diff --git a/third_party/gtest/CHANGES b/third_party/gtest/CHANGES
deleted file mode 100644
index 1858f7f..0000000
--- a/third_party/gtest/CHANGES
+++ /dev/null
@@ -1,76 +0,0 @@
-Changes for 1.4.0:
-
- * New feature: the event listener API
- * New feature: test shuffling
- * New feature: the XML report format is closer to junitreport and can
-   be parsed by Hudson now.
- * New feature: when a test runs under Visual Studio, its failures are
-   integrated in the IDE.
- * New feature: /MD(d) versions of VC++ projects.
- * New feature: elapsed time for the tests is printed by default.
- * New feature: comes with a TR1 tuple implementation such that Boost
-   is no longer needed for Combine().
- * New feature: EXPECT_DEATH_IF_SUPPORTED macro and friends.
- * New feature: the Xcode project can now produce static gtest
-   libraries in addition to a framework.
- * Compatibility fixes for Solaris, Cygwin, minGW, Windows Mobile,
-   Symbian, gcc, and C++Builder.
- * Bug fixes and implementation clean-ups.
-
-Changes for 1.3.0:
-
- * New feature: death tests on Windows, Cygwin, and Mac.
- * New feature: ability to use Google Test assertions in other testing
-   frameworks.
- * New feature: ability to run disabled test via
-   --gtest_also_run_disabled_tests.
- * New feature: the --help flag for printing the usage.
- * New feature: access to Google Test flag values in user code.
- * New feature: a script that packs Google Test into one .h and one
-   .cc file for easy deployment.
- * New feature: support for distributing test functions to multiple
-   machines (requires support from the test runner).
- * Bug fixes and implementation clean-ups.
-
-Changes for 1.2.1:
-
- * Compatibility fixes for Linux IA-64 and IBM z/OS.
- * Added support for using Boost and other TR1 implementations.
- * Changes to the build scripts to support upcoming release of Google C++
-   Mocking Framework.
- * Added Makefile to the distribution package.
- * Improved build instructions in README.
-
-Changes for 1.2.0:
-
- * New feature: value-parameterized tests.
- * New feature: the ASSERT/EXPECT_(NON)FATAL_FAILURE(_ON_ALL_THREADS)
-   macros.
- * Changed the XML report format to match JUnit/Ant's.
- * Added tests to the Xcode project.
- * Added scons/SConscript for building with SCons.
- * Added src/gtest-all.cc for building Google Test from a single file.
- * Fixed compatibility with Solaris and z/OS.
- * Enabled running Python tests on systems with python 2.3 installed,
-   e.g. Mac OS X 10.4.
- * Bug fixes.
-
-Changes for 1.1.0:
-
- * New feature: type-parameterized tests.
- * New feature: exception assertions.
- * New feature: printing elapsed time of tests.
- * Improved the robustness of death tests.
- * Added an Xcode project and samples.
- * Adjusted the output format on Windows to be understandable by Visual Studio.
- * Minor bug fixes.
-
-Changes for 1.0.1:
-
- * Added project files for Visual Studio 7.1.
- * Fixed issues with compiling on Mac OS X.
- * Fixed issues with compiling on Cygwin.
-
-Changes for 1.0.0:
-
- * Initial Open Source release of Google Test
diff --git a/third_party/gtest/CONTRIBUTORS b/third_party/gtest/CONTRIBUTORS
deleted file mode 100644
index 40ce6c8..0000000
--- a/third_party/gtest/CONTRIBUTORS
+++ /dev/null
@@ -1,33 +0,0 @@
-# This file contains a list of people who've made non-trivial
-# contribution to the Google C++ Testing Framework project.  People
-# who commit code to the project are encouraged to add their names
-# here.  Please keep the list sorted by first names.
-
-Ajay Joshi <jaj@google.com>
-Balázs Dán <balazs.dan@gmail.com>
-Bharat Mediratta <bharat@menalto.com>
-Chandler Carruth <chandlerc@google.com>
-Chris Prince <cprince@google.com>
-Chris Taylor <taylorc@google.com>
-Dan Egnor <egnor@google.com>
-Eric Roman <eroman@chromium.org>
-Jeffrey Yasskin <jyasskin@google.com>
-Jói Sigurðsson <joi@google.com>
-Keir Mierle <mierle@gmail.com>
-Keith Ray <keith.ray@gmail.com>
-Kenton Varda <kenton@google.com>
-Markus Heule <markus.heule@gmail.com>
-Mika Raento <mikie@iki.fi>
-Patrick Hanna <phanna@google.com>
-Patrick Riley <pfr@google.com>
-Peter Kaminski <piotrk@google.com>
-Preston Jackson <preston.a.jackson@gmail.com>
-Rainer Klaffenboeck <rainer.klaffenboeck@dynatrace.com>
-Russ Cox <rsc@google.com>
-Russ Rufer <russ@pentad.com>
-Sean Mcafee <eefacm@gmail.com>
-Sigurður Ásgeirsson <siggi@google.com>
-Tracy Bialik <tracy@pentad.com>
-Vadim Berman <vadimb@google.com>
-Vlad Losev <vladl@google.com>
-Zhanyong Wan <wan@google.com>
diff --git a/third_party/gtest/COPYING b/third_party/gtest/COPYING
deleted file mode 100644
index 1941a11..0000000
--- a/third_party/gtest/COPYING
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright 2008, Google Inc.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-    * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-    * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/third_party/gtest/README b/third_party/gtest/README
deleted file mode 100644
index a9172c5..0000000
--- a/third_party/gtest/README
+++ /dev/null
@@ -1,318 +0,0 @@
-Google C++ Testing Framework
-============================
-http://code.google.com/p/googletest/
-
-Overview
---------
-Google's framework for writing C++ tests on a variety of platforms (Linux, Mac
-OS X, Windows, Windows CE, Symbian, and etc). Based on the xUnit architecture.
-Supports automatic test discovery, a rich set of assertions, user-defined
-assertions, death tests, fatal and non-fatal failures, various options for
-running the tests, and XML test report generation.
-
-Please see the project page above for more information as well as mailing lists
-for questions, discussions, and development. There is also an IRC channel on
-OFTC (irc.oftc.net) #gtest available. Please join us!
-
-Requirements
-------------
-Google Test is designed to have fairly minimal requirements to build
-and use with your projects, but there are some. Currently, we support
-building Google Test on Linux, Windows, Mac OS X, and Cygwin.  We will
-also make our best effort to support other platforms (e.g. Solaris and
-IBM z/OS).  However, since core members of the Google Test project
-have no access to them, Google Test may have outstanding issues on
-these platforms.  If you notice any problems on your platform, please
-notify googletestframework@googlegroups.com (patches for fixing them
-are even more welcome!).
-
-### Linux Requirements ###
-These are the base requirements to build and use Google Test from a source
-package (as described below):
-  * GNU-compatible Make or "gmake"
-  * POSIX-standard shell
-  * POSIX(-2) Regular Expressions (regex.h)
-  * A C++98 standards compliant compiler
-
-Furthermore, if you are building Google Test from a VCS Checkout (also
-described below), there are further requirements:
-  * Automake version 1.9 or newer
-  * Autoconf version 2.59 or newer
-  * Libtool / Libtoolize
-  * Python version 2.4 or newer
-
-### Windows Requirements ###
-  * Microsoft Visual Studio 7.1 or newer
-
-### Cygwin Requirements ###
-  * Cygwin 1.5.25-14 or newer
-
-### Mac OS X Requirements ###
-  * Mac OS X 10.4 Tiger or newer
-  * Developer Tools Installed
-  * Optional: Xcode 2.5 or later for univeral-binary framework; see note below.
-
-Getting the Source
-------------------
-There are two primary ways of getting Google Test's source code: you can
-download a source release in your preferred archive format, or directly check
-out the source from a Version Control System (VCS, we use Google Code's
-Subversion hosting). The VCS checkout requires a few extra steps and some extra
-software packages on your system, but lets you track development, and make
-patches to contribute much more easily, so we highly encourage it.
-
-### VCS Checkout: ###
-The first step is to select whether you want to check out the main line of
-development on Google Test, or one of the released branches. The former will be
-much more active and have the latest features, but the latter provides much
-more stability and predictability. Choose whichever fits your needs best, and
-proceed with the following Subversion commands:
-
-  svn checkout http://googletest.googlecode.com/svn/trunk/ gtest-svn
-
-or for a release version X.Y.*'s branch:
-
-  svn checkout http://googletest.googlecode.com/svn/branches/release-X.Y/ \
-    gtest-X.Y-svn
-
-Next you will need to prepare the GNU Autotools build system, if you
-are using Linux, Mac OS X, or Cygwin. Enter the target directory of
-the checkout command you used ('gtest-svn' or 'gtest-X.Y-svn' above)
-and proceed with the following command:
-
-  autoreconf -fvi
-
-Once you have completed this step, you are ready to build the library. Note
-that you should only need to complete this step once. The subsequent `make'
-invocations will automatically re-generate the bits of the build system that
-need to be changed.
-
-If your system uses older versions of the autotools, the above command will
-fail. You may need to explicitly specify a version to use. For instance, if you
-have both GNU Automake 1.4 and 1.9 installed and `automake' would invoke the
-1.4, use instead:
-
-  AUTOMAKE=automake-1.9 ACLOCAL=aclocal-1.9 autoreconf -fvi
-
-Make sure you're using the same version of automake and aclocal.
-
-### Source Package: ###
-Google Test is also released in source packages which can be downloaded from
-its Google Code download page[1]. Several different archive formats are
-provided, but the only difference is the tools used to manipulate them, and the
-size of the resulting file. Download whichever you are most comfortable with.
-
-  [1] Google Test Downloads: http://code.google.com/p/googletest/downloads/list
-
-Once downloaded expand the archive using whichever tools you prefer for that
-type. This will always result in a new directory with the name "gtest-X.Y.Z"
-which contains all of the source code. Here are some examples in Linux:
-
-  tar -xvzf gtest-X.Y.Z.tar.gz
-  tar -xvjf gtest-X.Y.Z.tar.bz2
-  unzip gtest-X.Y.Z.zip
-
-Choosing a TR1 Tuple Library
-----------------------------
-Some Google Test features require the C++ Technical Report 1 (TR1)
-tuple library, which is not yet widely available with all compilers.
-The good news is that Google Test implements a subset of TR1 tuple
-that's enough for its own need, and will automatically use this when
-the compiler doesn't provide TR1 tuple.
-
-Usually you don't need to care about which tuple library Google Test
-uses.  However, if your project already uses TR1 tuple, you need to
-tell Google Test to use the same TR1 tuple library the rest of your
-project uses (this requirement is new in Google Test 1.4.0, so you may
-need to take care of it when upgrading from an earlier version), or
-the two tuple implementations will clash.  To do that, add
-
-  -DGTEST_USE_OWN_TR1_TUPLE=0
-
-to the compiler flags while compiling Google Test and your tests.
-
-If you don't want Google Test to use tuple at all, add
-
-  -DGTEST_HAS_TR1_TUPLE=0
-
-to the compiler flags.  All features using tuple will be disabled in
-this mode.
-
-Building the Source
--------------------
-### Linux, Mac OS X (without Xcode), and Cygwin ###
-There are two primary options for building the source at this point: build it
-inside the source code tree, or in a separate directory. We recommend building
-in a separate directory as that tends to produce both more consistent results
-and be easier to clean up should anything go wrong, but both patterns are
-supported. The only hard restriction is that while the build directory can be
-a subdirectory of the source directory, the opposite is not possible and will
-result in errors. Once you have selected where you wish to build Google Test,
-create the directory if necessary, and enter it. The following steps apply for
-either approach by simply substituting the shell variable SRCDIR with "." for
-building inside the source directory, and the relative path to the source
-directory otherwise.
-
-  ${SRCDIR}/configure  # Standard GNU configure script, --help for more info
-  make  # Standard makefile following GNU conventions
-  make check  # Builds and runs all tests - all should pass
-
-Other programs will only be able to use Google Test's functionality if you
-install it in a location which they can access, in Linux this is typically
-under '/usr/local'. The following command will install all of the Google Test
-libraries, public headers, and utilities necessary for other programs and
-libraries to leverage it:
-
-  sudo make install  # Not necessary, but allows use by other programs
-
-Should you need to remove Google Test from your system after having installed
-it, run the following command, and it will back out its changes.  However, note
-carefully that you must run this command on the *same* Google Test build that
-you ran the install from, or the results are not predictable.  If you install
-Google Test on your system, and are working from a VCS checkout, make sure you
-run this *before* updating your checkout of the source in order to uninstall
-the same version which you installed.
-
-  sudo make uninstall  # Must be run against the exact same build as "install"
-
-Your project can build against Google Test simply by leveraging the
-'gtest-config' script. This script can be invoked directly out of the 'scripts'
-subdirectory of the build tree, and it will be installed in the binary
-directory specified during the 'configure'. Here are some examples of its use,
-see 'gtest-config --help' for more detailed information.
-
-  gtest-config --min-version=1.0 || echo "Insufficient Google Test version."
-
-  g++ $(gtest-config --cppflags --cxxflags) -o foo.o -c foo.cpp
-  g++ $(gtest-config --ldflags --libs) -o foo foo.o
-
-  # When using a built but not installed Google Test:
-  g++ $(../../my_gtest_build/scripts/gtest-config ...) ...
-
-### Windows ###
-The msvc\ folder contains two solutions with Visual C++ projects. Open the
-gtest.sln or gtest-md.sln file using Visual Studio, and you are ready to
-build Google Test the same way you build any Visual Studio project. Files
-that have names ending with -md use DLL versions of Microsoft runtime
-libraries (the /MD or the /MDd compiler option). Files without that suffix
-use static versions of the runtime libraries (the /MT or the /MTd option).
-Please note that one must use the same option to compile both gtest and his
-test code. If you use Visual Studio 2005 or above, we recommend the -md
-version as /MD is the default for new projects in these versions of Visual
-Studio.
-
-### Mac OS X (universal-binary framework) ###
-Open the gtest.xcodeproj in the xcode/ folder using Xcode. Build the "gtest"
-target. The universal binary framework will end up in your selected build
-directory (selected in the Xcode "Preferences..." -> "Building" pane and
-defaults to xcode/build). Alternatively, at the command line, enter:
-
-  xcodebuild
-
-This will build the "Release" configuration of gtest.framework in your
-default build location. See the "xcodebuild" man page for more information about
-building different configurations and building in different locations.
-
-To test the gtest.framework in Xcode, change the active target to "Check" and
-then build. This target builds all of the tests and then runs them. Don't worry
-if you see some errors. Xcode reports all test failures (even the intentional
-ones) as errors. However, you should see a "Build succeeded" message at the end
-of the build log. To run all of the tests from the command line, enter:
-
-  xcodebuild -target Check
-
-Installation with xcodebuild requires specifying an installation desitination
-directory, known as the DSTROOT. Three items will be installed when using
-xcodebuild:
-
-  $DSTROOT/Library/Frameworks/gtest.framework
-  $DSTROOT/usr/local/lib/libgtest.a
-  $DSTROOT/usr/local/lib/libgtest_main.a
-
-You specify the installation directory on the command line with the other
-xcodebuild options. Here's how you would install in a user-visible location:
-
-  xcodebuild install DSTROOT=~
-
-To perform a system-wide inistall, escalate to an administrator and specify
-the file system root as the DSTROOT:
-
-  sudo xcodebuild install DSTROOT=/
-
-To uninstall gtest.framework via the command line, you need to delete the three
-items listed above. Remember to escalate to an administrator if deleting these
-from the system-wide location using the commands listed below:
-
-  sudo rm -r /Library/Frameworks/gtest.framework
-  sudo rm /usr/local/lib/libgtest.a
-  sudo rm /usr/local/lib/libgtest_main.a
-
-It is also possible to build and execute individual tests within Xcode. Each
-test has its own Xcode "Target" and Xcode "Executable". To build any of the
-tests, change the active target and the active executable to the test of
-interest and then build and run.
-
-Individual tests can be built from the command line using:
-
-  xcodebuild -target <test_name>
-
-These tests can be executed from the command line by moving to the build
-directory and then (in bash)
-
-  export DYLD_FRAMEWORK_PATH=`pwd`
-  ./<test_name>  # (e.g. ./gtest_unittest)
-
-To use gtest.framework for your own tests, first, install the framework using
-the steps described above. Then add it to your Xcode project by selecting
-Project->Add to Project... from the main menu. Next, add libgtest_main.a from
-gtest.framework/Resources directory using the same menu command. Finally,
-create a new executable target and add gtest.framework and libgtest_main.a to
-the "Link Binary With Libraries" build phase.
-
-### Using GNU Make ###
-The make/ directory contains a Makefile that you can use to build
-Google Test on systems where GNU make is available (e.g. Linux, Mac OS
-X, and Cygwin).  It doesn't try to build Google Test's own tests.
-Instead, it just builds the Google Test library and a sample test.
-You can use it as a starting point for your own Makefile.
-
-If the default settings are correct for your environment, the
-following commands should succeed:
-
-  cd ${SRCDIR}/make
-  make
-  ./sample1_unittest
-
-If you see errors, try to tweak the contents of make/Makefile to make
-them go away.  There are instructions in make/Makefile on how to do
-it.
-
-### Using Your Own Build System ###
-If none of the build solutions we provide works for you, or if you
-prefer your own build system, you just need to compile
-src/gtest-all.cc into a library and link your tests with it.  Assuming
-a Linux-like system and gcc, something like the following will do:
-
-  cd ${SRCDIR}
-  g++ -I. -I./include -c src/gtest-all.cc
-  ar -rv libgtest.a gtest-all.o
-  g++ -I. -I./include path/to/your_test.cc libgtest.a -o your_test
-
-Regenerating Source Files
--------------------------
-Some of Google Test's source files are generated from templates (not
-in the C++ sense) using a script.  A template file is named FOO.pump,
-where FOO is the name of the file it will generate.  For example, the
-file include/gtest/internal/gtest-type-util.h.pump is used to generate
-gtest-type-util.h in the same directory.
-
-Normally you don't need to worry about regenerating the source files,
-unless you need to modify them (e.g. if you are working on a patch for
-Google Test).  In that case, you should modify the corresponding .pump
-files instead and run the 'pump' script (for Pump is Useful for Meta
-Programming) to regenerate them.  We are still working on releasing
-the script and its documentation.  If you need it now, please email
-googletestframework@googlegroups.com such that we know to make it
-happen sooner.
-
-Happy testing!
diff --git a/third_party/gtest/build.scons b/third_party/gtest/build.scons
deleted file mode 100644
index 831cdc3..0000000
--- a/third_party/gtest/build.scons
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-gtest_env = env.Clone()
-gtest_env.Append(
-    CPPPATH = [
-        '$MAIN_DIR/third_party/gtest/include',
-        '$MAIN_DIR/third_party/gtest',
-        ],
-    CCFLAGS = [
-        '/wd4061',  # enumerator in switch is not handled by a case label
-        '/wd4100',  # unreferenced formal parameter
-        '/wd4640',  # construction of local static object is not thread-safe
-        '/wd4505',  # unreferenced local function has been removed
-        '/wd4548',  # expression before comma has no effect
-        ],
-    CPPDEFINES = [
-        '_CRT_NONSTDC_NO_DEPRECATE',
-        ],
-)
-
-target_name = 'gtest'
-
-gtest_inputs = [ 'src/gtest-all.cc' ]
-if env.Bit('use_precompiled_headers'):
-  gtest_inputs += gtest_env.EnablePrecompile(target_name)
-
-gtest_env.ComponentLibrary(
-    lib_name=target_name,
-    source=gtest_inputs,
-)
-
diff --git a/third_party/gtest/include/gtest/gtest-death-test.h b/third_party/gtest/include/gtest/gtest-death-test.h
deleted file mode 100644
index fdb497f..0000000
--- a/third_party/gtest/include/gtest/gtest-death-test.h
+++ /dev/null
@@ -1,283 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file defines the public API for death tests.  It is
-// #included by gtest.h so a user doesn't need to include this
-// directly.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
-
-#include <gtest/internal/gtest-death-test-internal.h>
-
-namespace testing {
-
-// This flag controls the style of death tests.  Valid values are "threadsafe",
-// meaning that the death test child process will re-execute the test binary
-// from the start, running only a single death test, or "fast",
-// meaning that the child process will execute the test logic immediately
-// after forking.
-GTEST_DECLARE_string_(death_test_style);
-
-#if GTEST_HAS_DEATH_TEST
-
-// The following macros are useful for writing death tests.
-
-// Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is
-// executed:
-//
-//   1. It generates a warning if there is more than one active
-//   thread.  This is because it's safe to fork() or clone() only
-//   when there is a single thread.
-//
-//   2. The parent process clone()s a sub-process and runs the death
-//   test in it; the sub-process exits with code 0 at the end of the
-//   death test, if it hasn't exited already.
-//
-//   3. The parent process waits for the sub-process to terminate.
-//
-//   4. The parent process checks the exit code and error message of
-//   the sub-process.
-//
-// Examples:
-//
-//   ASSERT_DEATH(server.SendMessage(56, "Hello"), "Invalid port number");
-//   for (int i = 0; i < 5; i++) {
-//     EXPECT_DEATH(server.ProcessRequest(i),
-//                  "Invalid request .* in ProcessRequest()")
-//         << "Failed to die on request " << i);
-//   }
-//
-//   ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting");
-//
-//   bool KilledBySIGHUP(int exit_code) {
-//     return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP;
-//   }
-//
-//   ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
-//
-// On the regular expressions used in death tests:
-//
-//   On POSIX-compliant systems (*nix), we use the <regex.h> library,
-//   which uses the POSIX extended regex syntax.
-//
-//   On other platforms (e.g. Windows), we only support a simple regex
-//   syntax implemented as part of Google Test.  This limited
-//   implementation should be enough most of the time when writing
-//   death tests; though it lacks many features you can find in PCRE
-//   or POSIX extended regex syntax.  For example, we don't support
-//   union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and
-//   repetition count ("x{5,7}"), among others.
-//
-//   Below is the syntax that we do support.  We chose it to be a
-//   subset of both PCRE and POSIX extended regex, so it's easy to
-//   learn wherever you come from.  In the following: 'A' denotes a
-//   literal character, period (.), or a single \\ escape sequence;
-//   'x' and 'y' denote regular expressions; 'm' and 'n' are for
-//   natural numbers.
-//
-//     c     matches any literal character c
-//     \\d   matches any decimal digit
-//     \\D   matches any character that's not a decimal digit
-//     \\f   matches \f
-//     \\n   matches \n
-//     \\r   matches \r
-//     \\s   matches any ASCII whitespace, including \n
-//     \\S   matches any character that's not a whitespace
-//     \\t   matches \t
-//     \\v   matches \v
-//     \\w   matches any letter, _, or decimal digit
-//     \\W   matches any character that \\w doesn't match
-//     \\c   matches any literal character c, which must be a punctuation
-//     .     matches any single character except \n
-//     A?    matches 0 or 1 occurrences of A
-//     A*    matches 0 or many occurrences of A
-//     A+    matches 1 or many occurrences of A
-//     ^     matches the beginning of a string (not that of each line)
-//     $     matches the end of a string (not that of each line)
-//     xy    matches x followed by y
-//
-//   If you accidentally use PCRE or POSIX extended regex features
-//   not implemented by us, you will get a run-time failure.  In that
-//   case, please try to rewrite your regular expression within the
-//   above syntax.
-//
-//   This implementation is *not* meant to be as highly tuned or robust
-//   as a compiled regex library, but should perform well enough for a
-//   death test, which already incurs significant overhead by launching
-//   a child process.
-//
-// Known caveats:
-//
-//   A "threadsafe" style death test obtains the path to the test
-//   program from argv[0] and re-executes it in the sub-process.  For
-//   simplicity, the current implementation doesn't search the PATH
-//   when launching the sub-process.  This means that the user must
-//   invoke the test program via a path that contains at least one
-//   path separator (e.g. path/to/foo_test and
-//   /absolute/path/to/bar_test are fine, but foo_test is not).  This
-//   is rarely a problem as people usually don't put the test binary
-//   directory in PATH.
-//
-// TODO(wan@google.com): make thread-safe death tests search the PATH.
-
-// Asserts that a given statement causes the program to exit, with an
-// integer exit status that satisfies predicate, and emitting error output
-// that matches regex.
-#define ASSERT_EXIT(statement, predicate, regex) \
-  GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)
-
-// Like ASSERT_EXIT, but continues on to successive tests in the
-// test case, if any:
-#define EXPECT_EXIT(statement, predicate, regex) \
-  GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)
-
-// Asserts that a given statement causes the program to exit, either by
-// explicitly exiting with a nonzero exit code or being killed by a
-// signal, and emitting error output that matches regex.
-#define ASSERT_DEATH(statement, regex) \
-  ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
-
-// Like ASSERT_DEATH, but continues on to successive tests in the
-// test case, if any:
-#define EXPECT_DEATH(statement, regex) \
-  EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
-
-// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
-
-// Tests that an exit code describes a normal exit with a given exit code.
-class ExitedWithCode {
- public:
-  explicit ExitedWithCode(int exit_code);
-  bool operator()(int exit_status) const;
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ExitedWithCode& other);
-
-  const int exit_code_;
-};
-
-#if !GTEST_OS_WINDOWS
-// Tests that an exit code describes an exit due to termination by a
-// given signal.
-class KilledBySignal {
- public:
-  explicit KilledBySignal(int signum);
-  bool operator()(int exit_status) const;
- private:
-  const int signum_;
-};
-#endif  // !GTEST_OS_WINDOWS
-
-// EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
-// The death testing framework causes this to have interesting semantics,
-// since the sideeffects of the call are only visible in opt mode, and not
-// in debug mode.
-//
-// In practice, this can be used to test functions that utilize the
-// LOG(DFATAL) macro using the following style:
-//
-// int DieInDebugOr12(int* sideeffect) {
-//   if (sideeffect) {
-//     *sideeffect = 12;
-//   }
-//   LOG(DFATAL) << "death";
-//   return 12;
-// }
-//
-// TEST(TestCase, TestDieOr12WorksInDgbAndOpt) {
-//   int sideeffect = 0;
-//   // Only asserts in dbg.
-//   EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), "death");
-//
-// #ifdef NDEBUG
-//   // opt-mode has sideeffect visible.
-//   EXPECT_EQ(12, sideeffect);
-// #else
-//   // dbg-mode no visible sideeffect.
-//   EXPECT_EQ(0, sideeffect);
-// #endif
-// }
-//
-// This will assert that DieInDebugReturn12InOpt() crashes in debug
-// mode, usually due to a DCHECK or LOG(DFATAL), but returns the
-// appropriate fallback value (12 in this case) in opt mode. If you
-// need to test that a function has appropriate side-effects in opt
-// mode, include assertions against the side-effects.  A general
-// pattern for this is:
-//
-// EXPECT_DEBUG_DEATH({
-//   // Side-effects here will have an effect after this statement in
-//   // opt mode, but none in debug mode.
-//   EXPECT_EQ(12, DieInDebugOr12(&sideeffect));
-// }, "death");
-//
-#ifdef NDEBUG
-
-#define EXPECT_DEBUG_DEATH(statement, regex) \
-  do { statement; } while (::testing::internal::AlwaysFalse())
-
-#define ASSERT_DEBUG_DEATH(statement, regex) \
-  do { statement; } while (::testing::internal::AlwaysFalse())
-
-#else
-
-#define EXPECT_DEBUG_DEATH(statement, regex) \
-  EXPECT_DEATH(statement, regex)
-
-#define ASSERT_DEBUG_DEATH(statement, regex) \
-  ASSERT_DEATH(statement, regex)
-
-#endif  // NDEBUG for EXPECT_DEBUG_DEATH
-#endif  // GTEST_HAS_DEATH_TEST
-
-// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
-// ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
-// death tests are supported; otherwise they just issue a warning.  This is
-// useful when you are combining death test assertions with normal test
-// assertions in one test.
-#if GTEST_HAS_DEATH_TEST
-#define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
-    EXPECT_DEATH(statement, regex)
-#define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
-    ASSERT_DEATH(statement, regex)
-#else
-#define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
-    GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, )
-#define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
-    GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return)
-#endif
-
-}  // namespace testing
-
-#endif  // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
diff --git a/third_party/gtest/include/gtest/gtest-message.h b/third_party/gtest/include/gtest/gtest-message.h
deleted file mode 100644
index 6398712..0000000
--- a/third_party/gtest/include/gtest/gtest-message.h
+++ /dev/null
@@ -1,224 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file defines the Message class.
-//
-// IMPORTANT NOTE: Due to limitation of the C++ language, we have to
-// leave some internal implementation details in this header file.
-// They are clearly marked by comments like this:
-//
-//   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-//
-// Such code is NOT meant to be used by a user directly, and is subject
-// to CHANGE WITHOUT NOTICE.  Therefore DO NOT DEPEND ON IT in a user
-// program!
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
-#define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
-
-#include <gtest/internal/gtest-string.h>
-#include <gtest/internal/gtest-internal.h>
-
-namespace testing {
-
-// The Message class works like an ostream repeater.
-//
-// Typical usage:
-//
-//   1. You stream a bunch of values to a Message object.
-//      It will remember the text in a StrStream.
-//   2. Then you stream the Message object to an ostream.
-//      This causes the text in the Message to be streamed
-//      to the ostream.
-//
-// For example;
-//
-//   testing::Message foo;
-//   foo << 1 << " != " << 2;
-//   std::cout << foo;
-//
-// will print "1 != 2".
-//
-// Message is not intended to be inherited from.  In particular, its
-// destructor is not virtual.
-//
-// Note that StrStream behaves differently in gcc and in MSVC.  You
-// can stream a NULL char pointer to it in the former, but not in the
-// latter (it causes an access violation if you do).  The Message
-// class hides this difference by treating a NULL char pointer as
-// "(null)".
-class Message {
- private:
-  // The type of basic IO manipulators (endl, ends, and flush) for
-  // narrow streams.
-  typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&);
-
- public:
-  // Constructs an empty Message.
-  // We allocate the StrStream separately because it otherwise each use of
-  // ASSERT/EXPECT in a procedure adds over 200 bytes to the procedure's
-  // stack frame leading to huge stack frames in some cases; gcc does not reuse
-  // the stack space.
-  Message() : ss_(new internal::StrStream) {}
-
-  // Copy constructor.
-  Message(const Message& msg) : ss_(new internal::StrStream) {  // NOLINT
-    *ss_ << msg.GetString();
-  }
-
-  // Constructs a Message from a C-string.
-  explicit Message(const char* str) : ss_(new internal::StrStream) {
-    *ss_ << str;
-  }
-
-  ~Message() { delete ss_; }
-#if GTEST_OS_SYMBIAN
-  // Streams a value (either a pointer or not) to this object.
-  template <typename T>
-  inline Message& operator <<(const T& value) {
-    StreamHelper(typename internal::is_pointer<T>::type(), value);
-    return *this;
-  }
-#else
-  // Streams a non-pointer value to this object.
-  template <typename T>
-  inline Message& operator <<(const T& val) {
-    ::GTestStreamToHelper(ss_, val);
-    return *this;
-  }
-
-  // Streams a pointer value to this object.
-  //
-  // This function is an overload of the previous one.  When you
-  // stream a pointer to a Message, this definition will be used as it
-  // is more specialized.  (The C++ Standard, section
-  // [temp.func.order].)  If you stream a non-pointer, then the
-  // previous definition will be used.
-  //
-  // The reason for this overload is that streaming a NULL pointer to
-  // ostream is undefined behavior.  Depending on the compiler, you
-  // may get "0", "(nil)", "(null)", or an access violation.  To
-  // ensure consistent result across compilers, we always treat NULL
-  // as "(null)".
-  template <typename T>
-  inline Message& operator <<(T* const& pointer) {  // NOLINT
-    if (pointer == NULL) {
-      *ss_ << "(null)";
-    } else {
-      ::GTestStreamToHelper(ss_, pointer);
-    }
-    return *this;
-  }
-#endif  // GTEST_OS_SYMBIAN
-
-  // Since the basic IO manipulators are overloaded for both narrow
-  // and wide streams, we have to provide this specialized definition
-  // of operator <<, even though its body is the same as the
-  // templatized version above.  Without this definition, streaming
-  // endl or other basic IO manipulators to Message will confuse the
-  // compiler.
-  Message& operator <<(BasicNarrowIoManip val) {
-    *ss_ << val;
-    return *this;
-  }
-
-  // Instead of 1/0, we want to see true/false for bool values.
-  Message& operator <<(bool b) {
-    return *this << (b ? "true" : "false");
-  }
-
-  // These two overloads allow streaming a wide C string to a Message
-  // using the UTF-8 encoding.
-  Message& operator <<(const wchar_t* wide_c_str) {
-    return *this << internal::String::ShowWideCString(wide_c_str);
-  }
-  Message& operator <<(wchar_t* wide_c_str) {
-    return *this << internal::String::ShowWideCString(wide_c_str);
-  }
-
-#if GTEST_HAS_STD_WSTRING
-  // Converts the given wide string to a narrow string using the UTF-8
-  // encoding, and streams the result to this Message object.
-  Message& operator <<(const ::std::wstring& wstr);
-#endif  // GTEST_HAS_STD_WSTRING
-
-#if GTEST_HAS_GLOBAL_WSTRING
-  // Converts the given wide string to a narrow string using the UTF-8
-  // encoding, and streams the result to this Message object.
-  Message& operator <<(const ::wstring& wstr);
-#endif  // GTEST_HAS_GLOBAL_WSTRING
-
-  // Gets the text streamed to this object so far as a String.
-  // Each '\0' character in the buffer is replaced with "\\0".
-  //
-  // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-  internal::String GetString() const {
-    return internal::StrStreamToString(ss_);
-  }
-
- private:
-#if GTEST_OS_SYMBIAN
-  // These are needed as the Nokia Symbian Compiler cannot decide between
-  // const T& and const T* in a function template. The Nokia compiler _can_
-  // decide between class template specializations for T and T*, so a
-  // tr1::type_traits-like is_pointer works, and we can overload on that.
-  template <typename T>
-  inline void StreamHelper(internal::true_type /*dummy*/, T* pointer) {
-    if (pointer == NULL) {
-      *ss_ << "(null)";
-    } else {
-      ::GTestStreamToHelper(ss_, pointer);
-    }
-  }
-  template <typename T>
-  inline void StreamHelper(internal::false_type /*dummy*/, const T& value) {
-    ::GTestStreamToHelper(ss_, value);
-  }
-#endif  // GTEST_OS_SYMBIAN
-
-  // We'll hold the text streamed to this object here.
-  internal::StrStream* const ss_;
-
-  // We declare (but don't implement) this to prevent the compiler
-  // from implementing the assignment operator.
-  void operator=(const Message&);
-};
-
-// Streams a Message to an ostream.
-inline std::ostream& operator <<(std::ostream& os, const Message& sb) {
-  return os << sb.GetString();
-}
-
-}  // namespace testing
-
-#endif  // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
diff --git a/third_party/gtest/include/gtest/gtest-param-test.h b/third_party/gtest/include/gtest/gtest-param-test.h
deleted file mode 100644
index c0c85e3..0000000
--- a/third_party/gtest/include/gtest/gtest-param-test.h
+++ /dev/null
@@ -1,1389 +0,0 @@
-// This file was GENERATED by a script.  DO NOT EDIT BY HAND!!!
-
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: vladl@google.com (Vlad Losev)
-//
-// Macros and functions for implementing parameterized tests
-// in Google C++ Testing Framework (Google Test)
-//
-// This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!
-//
-#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
-
-
-// Value-parameterized tests allow you to test your code with different
-// parameters without writing multiple copies of the same test.
-//
-// Here is how you use value-parameterized tests:
-
-#if 0
-
-// To write value-parameterized tests, first you should define a fixture
-// class. It must be derived from testing::TestWithParam<T>, where T is
-// the type of your parameter values. TestWithParam<T> is itself derived
-// from testing::Test. T can be any copyable type. If it's a raw pointer,
-// you are responsible for managing the lifespan of the pointed values.
-
-class FooTest : public ::testing::TestWithParam<const char*> {
-  // You can implement all the usual class fixture members here.
-};
-
-// Then, use the TEST_P macro to define as many parameterized tests
-// for this fixture as you want. The _P suffix is for "parameterized"
-// or "pattern", whichever you prefer to think.
-
-TEST_P(FooTest, DoesBlah) {
-  // Inside a test, access the test parameter with the GetParam() method
-  // of the TestWithParam<T> class:
-  EXPECT_TRUE(foo.Blah(GetParam()));
-  ...
-}
-
-TEST_P(FooTest, HasBlahBlah) {
-  ...
-}
-
-// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test
-// case with any set of parameters you want. Google Test defines a number
-// of functions for generating test parameters. They return what we call
-// (surprise!) parameter generators. Here is a  summary of them, which
-// are all in the testing namespace:
-//
-//
-//  Range(begin, end [, step]) - Yields values {begin, begin+step,
-//                               begin+step+step, ...}. The values do not
-//                               include end. step defaults to 1.
-//  Values(v1, v2, ..., vN)    - Yields values {v1, v2, ..., vN}.
-//  ValuesIn(container)        - Yields values from a C-style array, an STL
-//  ValuesIn(begin,end)          container, or an iterator range [begin, end).
-//  Bool()                     - Yields sequence {false, true}.
-//  Combine(g1, g2, ..., gN)   - Yields all combinations (the Cartesian product
-//                               for the math savvy) of the values generated
-//                               by the N generators.
-//
-// For more details, see comments at the definitions of these functions below
-// in this file.
-//
-// The following statement will instantiate tests from the FooTest test case
-// each with parameter values "meeny", "miny", and "moe".
-
-INSTANTIATE_TEST_CASE_P(InstantiationName,
-                        FooTest,
-                        Values("meeny", "miny", "moe"));
-
-// To distinguish different instances of the pattern, (yes, you
-// can instantiate it more then once) the first argument to the
-// INSTANTIATE_TEST_CASE_P macro is a prefix that will be added to the
-// actual test case name. Remember to pick unique prefixes for different
-// instantiations. The tests from the instantiation above will have
-// these names:
-//
-//    * InstantiationName/FooTest.DoesBlah/0 for "meeny"
-//    * InstantiationName/FooTest.DoesBlah/1 for "miny"
-//    * InstantiationName/FooTest.DoesBlah/2 for "moe"
-//    * InstantiationName/FooTest.HasBlahBlah/0 for "meeny"
-//    * InstantiationName/FooTest.HasBlahBlah/1 for "miny"
-//    * InstantiationName/FooTest.HasBlahBlah/2 for "moe"
-//
-// You can use these names in --gtest_filter.
-//
-// This statement will instantiate all tests from FooTest again, each
-// with parameter values "cat" and "dog":
-
-const char* pets[] = {"cat", "dog"};
-INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
-
-// The tests from the instantiation above will have these names:
-//
-//    * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat"
-//    * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog"
-//    * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat"
-//    * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog"
-//
-// Please note that INSTANTIATE_TEST_CASE_P will instantiate all tests
-// in the given test case, whether their definitions come before or
-// AFTER the INSTANTIATE_TEST_CASE_P statement.
-//
-// Please also note that generator expressions are evaluated in
-// RUN_ALL_TESTS(), after main() has started. This allows evaluation of
-// parameter list based on command line parameters.
-//
-// You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc
-// for more examples.
-//
-// In the future, we plan to publish the API for defining new parameter
-// generators. But for now this interface remains part of the internal
-// implementation and is subject to change.
-
-#endif  // 0
-
-#include <gtest/internal/gtest-port.h>
-
-#if !GTEST_OS_SYMBIAN
-#include <utility>
-#endif
-
-// scripts/fuse_gtest.py depends on gtest's own header being #included
-// *unconditionally*.  Therefore these #includes cannot be moved
-// inside #if GTEST_HAS_PARAM_TEST.
-#include <gtest/internal/gtest-internal.h>
-#include <gtest/internal/gtest-param-util.h>
-#include <gtest/internal/gtest-param-util-generated.h>
-
-#if GTEST_HAS_PARAM_TEST
-
-namespace testing {
-
-// Functions producing parameter generators.
-//
-// Google Test uses these generators to produce parameters for value-
-// parameterized tests. When a parameterized test case is instantiated
-// with a particular generator, Google Test creates and runs tests
-// for each element in the sequence produced by the generator.
-//
-// In the following sample, tests from test case FooTest are instantiated
-// each three times with parameter values 3, 5, and 8:
-//
-// class FooTest : public TestWithParam<int> { ... };
-//
-// TEST_P(FooTest, TestThis) {
-// }
-// TEST_P(FooTest, TestThat) {
-// }
-// INSTANTIATE_TEST_CASE_P(TestSequence, FooTest, Values(3, 5, 8));
-//
-
-// Range() returns generators providing sequences of values in a range.
-//
-// Synopsis:
-// Range(start, end)
-//   - returns a generator producing a sequence of values {start, start+1,
-//     start+2, ..., }.
-// Range(start, end, step)
-//   - returns a generator producing a sequence of values {start, start+step,
-//     start+step+step, ..., }.
-// Notes:
-//   * The generated sequences never include end. For example, Range(1, 5)
-//     returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)
-//     returns a generator producing {1, 3, 5, 7}.
-//   * start and end must have the same type. That type may be any integral or
-//     floating-point type or a user defined type satisfying these conditions:
-//     * It must be assignable (have operator=() defined).
-//     * It must have operator+() (operator+(int-compatible type) for
-//       two-operand version).
-//     * It must have operator<() defined.
-//     Elements in the resulting sequences will also have that type.
-//   * Condition start < end must be satisfied in order for resulting sequences
-//     to contain any elements.
-//
-template <typename T, typename IncrementT>
-internal::ParamGenerator<T> Range(T start, T end, IncrementT step) {
-  return internal::ParamGenerator<T>(
-      new internal::RangeGenerator<T, IncrementT>(start, end, step));
-}
-
-template <typename T>
-internal::ParamGenerator<T> Range(T start, T end) {
-  return Range(start, end, 1);
-}
-
-// ValuesIn() function allows generation of tests with parameters coming from
-// a container.
-//
-// Synopsis:
-// ValuesIn(const T (&array)[N])
-//   - returns a generator producing sequences with elements from
-//     a C-style array.
-// ValuesIn(const Container& container)
-//   - returns a generator producing sequences with elements from
-//     an STL-style container.
-// ValuesIn(Iterator begin, Iterator end)
-//   - returns a generator producing sequences with elements from
-//     a range [begin, end) defined by a pair of STL-style iterators. These
-//     iterators can also be plain C pointers.
-//
-// Please note that ValuesIn copies the values from the containers
-// passed in and keeps them to generate tests in RUN_ALL_TESTS().
-//
-// Examples:
-//
-// This instantiates tests from test case StringTest
-// each with C-string values of "foo", "bar", and "baz":
-//
-// const char* strings[] = {"foo", "bar", "baz"};
-// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings));
-//
-// This instantiates tests from test case StlStringTest
-// each with STL strings with values "a" and "b":
-//
-// ::std::vector< ::std::string> GetParameterStrings() {
-//   ::std::vector< ::std::string> v;
-//   v.push_back("a");
-//   v.push_back("b");
-//   return v;
-// }
-//
-// INSTANTIATE_TEST_CASE_P(CharSequence,
-//                         StlStringTest,
-//                         ValuesIn(GetParameterStrings()));
-//
-//
-// This will also instantiate tests from CharTest
-// each with parameter values 'a' and 'b':
-//
-// ::std::list<char> GetParameterChars() {
-//   ::std::list<char> list;
-//   list.push_back('a');
-//   list.push_back('b');
-//   return list;
-// }
-// ::std::list<char> l = GetParameterChars();
-// INSTANTIATE_TEST_CASE_P(CharSequence2,
-//                         CharTest,
-//                         ValuesIn(l.begin(), l.end()));
-//
-template <typename ForwardIterator>
-internal::ParamGenerator<
-    typename ::std::iterator_traits<ForwardIterator>::value_type> ValuesIn(
-  ForwardIterator begin,
-  ForwardIterator end) {
-  typedef typename ::std::iterator_traits<ForwardIterator>::value_type
-      ParamType;
-  return internal::ParamGenerator<ParamType>(
-      new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));
-}
-
-template <typename T, size_t N>
-internal::ParamGenerator<T> ValuesIn(const T (&array)[N]) {
-  return ValuesIn(array, array + N);
-}
-
-template <class Container>
-internal::ParamGenerator<typename Container::value_type> ValuesIn(
-    const Container& container) {
-  return ValuesIn(container.begin(), container.end());
-}
-
-// Values() allows generating tests from explicitly specified list of
-// parameters.
-//
-// Synopsis:
-// Values(T v1, T v2, ..., T vN)
-//   - returns a generator producing sequences with elements v1, v2, ..., vN.
-//
-// For example, this instantiates tests from test case BarTest each
-// with values "one", "two", and "three":
-//
-// INSTANTIATE_TEST_CASE_P(NumSequence, BarTest, Values("one", "two", "three"));
-//
-// This instantiates tests from test case BazTest each with values 1, 2, 3.5.
-// The exact type of values will depend on the type of parameter in BazTest.
-//
-// INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));
-//
-// Currently, Values() supports from 1 to 50 parameters.
-//
-template <typename T1>
-internal::ValueArray1<T1> Values(T1 v1) {
-  return internal::ValueArray1<T1>(v1);
-}
-
-template <typename T1, typename T2>
-internal::ValueArray2<T1, T2> Values(T1 v1, T2 v2) {
-  return internal::ValueArray2<T1, T2>(v1, v2);
-}
-
-template <typename T1, typename T2, typename T3>
-internal::ValueArray3<T1, T2, T3> Values(T1 v1, T2 v2, T3 v3) {
-  return internal::ValueArray3<T1, T2, T3>(v1, v2, v3);
-}
-
-template <typename T1, typename T2, typename T3, typename T4>
-internal::ValueArray4<T1, T2, T3, T4> Values(T1 v1, T2 v2, T3 v3, T4 v4) {
-  return internal::ValueArray4<T1, T2, T3, T4>(v1, v2, v3, v4);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-internal::ValueArray5<T1, T2, T3, T4, T5> Values(T1 v1, T2 v2, T3 v3, T4 v4,
-    T5 v5) {
-  return internal::ValueArray5<T1, T2, T3, T4, T5>(v1, v2, v3, v4, v5);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6>
-internal::ValueArray6<T1, T2, T3, T4, T5, T6> Values(T1 v1, T2 v2, T3 v3,
-    T4 v4, T5 v5, T6 v6) {
-  return internal::ValueArray6<T1, T2, T3, T4, T5, T6>(v1, v2, v3, v4, v5, v6);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7>
-internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7> Values(T1 v1, T2 v2, T3 v3,
-    T4 v4, T5 v5, T6 v6, T7 v7) {
-  return internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7>(v1, v2, v3, v4, v5,
-      v6, v7);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8>
-internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8> Values(T1 v1, T2 v2,
-    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8) {
-  return internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8>(v1, v2, v3, v4,
-      v5, v6, v7, v8);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9>
-internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9> Values(T1 v1, T2 v2,
-    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9) {
-  return internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(v1, v2, v3,
-      v4, v5, v6, v7, v8, v9);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10>
-internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Values(T1 v1,
-    T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10) {
-  return internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(v1,
-      v2, v3, v4, v5, v6, v7, v8, v9, v10);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11>
-internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
-    T11> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-    T10 v10, T11 v11) {
-  return internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
-      T11>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12>
-internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-    T12> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-    T10 v10, T11 v11, T12 v12) {
-  return internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13>
-internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-    T13> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-    T10 v10, T11 v11, T12 v12, T13 v13) {
-  return internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14>
-internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) {
-  return internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
-      v14);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15>
-internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
-    T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) {
-  return internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
-      v13, v14, v15);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16>
-internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
-    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
-    T16 v16) {
-  return internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
-      v12, v13, v14, v15, v16);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17>
-internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
-    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
-    T16 v16, T17 v17) {
-  return internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
-      v11, v12, v13, v14, v15, v16, v17);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18>
-internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
-    T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
-    T16 v16, T17 v17, T18 v18) {
-  return internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
-      v10, v11, v12, v13, v14, v15, v16, v17, v18);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19>
-internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
-    T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
-    T15 v15, T16 v16, T17 v17, T18 v18, T19 v19) {
-  return internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19>(v1, v2, v3, v4, v5, v6, v7, v8,
-      v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20>
-internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20> Values(T1 v1, T2 v2, T3 v3, T4 v4,
-    T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
-    T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20) {
-  return internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20>(v1, v2, v3, v4, v5, v6, v7,
-      v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21>
-internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21> Values(T1 v1, T2 v2, T3 v3, T4 v4,
-    T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
-    T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21) {
-  return internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(v1, v2, v3, v4, v5, v6,
-      v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22>
-internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22> Values(T1 v1, T2 v2, T3 v3,
-    T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
-    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
-    T21 v21, T22 v22) {
-  return internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22>(v1, v2, v3, v4,
-      v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
-      v20, v21, v22);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23>
-internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> Values(T1 v1, T2 v2,
-    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
-    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
-    T21 v21, T22 v22, T23 v23) {
-  return internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23>(v1, v2, v3,
-      v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
-      v20, v21, v22, v23);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24>
-internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Values(T1 v1, T2 v2,
-    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
-    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
-    T21 v21, T22 v22, T23 v23, T24 v24) {
-  return internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24>(v1, v2,
-      v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,
-      v19, v20, v21, v22, v23, v24);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25>
-internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Values(T1 v1,
-    T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,
-    T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,
-    T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25) {
-  return internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25>(v1,
-      v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,
-      v18, v19, v20, v21, v22, v23, v24, v25);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26>
-internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-    T26> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-    T26 v26) {
-  return internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
-      v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27>
-internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-    T27> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-    T26 v26, T27 v27) {
-  return internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,
-      v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28>
-internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-    T28> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-    T26 v26, T27 v27, T28 v28) {
-  return internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
-      v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,
-      v28);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29>
-internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-    T26 v26, T27 v27, T28 v28, T29 v29) {
-  return internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28, T29>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
-      v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,
-      v27, v28, v29);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30>
-internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29, T30> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
-    T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
-    T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
-    T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) {
-  return internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28, T29, T30>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
-      v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,
-      v26, v27, v28, v29, v30);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31>
-internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29, T30, T31> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
-    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
-    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
-    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) {
-  return internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28, T29, T30, T31>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
-      v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,
-      v25, v26, v27, v28, v29, v30, v31);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32>
-internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29, T30, T31, T32> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
-    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
-    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
-    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
-    T32 v32) {
-  return internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28, T29, T30, T31, T32>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
-      v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
-      v24, v25, v26, v27, v28, v29, v30, v31, v32);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33>
-internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29, T30, T31, T32, T33> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
-    T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
-    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
-    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
-    T32 v32, T33 v33) {
-  return internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28, T29, T30, T31, T32, T33>(v1, v2, v3, v4, v5, v6, v7, v8,
-      v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
-      v24, v25, v26, v27, v28, v29, v30, v31, v32, v33);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34>
-internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29, T30, T31, T32, T33, T34> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
-    T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
-    T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,
-    T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,
-    T31 v31, T32 v32, T33 v33, T34 v34) {
-  return internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28, T29, T30, T31, T32, T33, T34>(v1, v2, v3, v4, v5, v6, v7,
-      v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,
-      v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35>
-internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29, T30, T31, T32, T33, T34, T35> Values(T1 v1, T2 v2, T3 v3, T4 v4,
-    T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
-    T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
-    T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
-    T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35) {
-  return internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35>(v1, v2, v3, v4, v5, v6,
-      v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,
-      v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36>
-internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29, T30, T31, T32, T33, T34, T35, T36> Values(T1 v1, T2 v2, T3 v3, T4 v4,
-    T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
-    T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
-    T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
-    T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36) {
-  return internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36>(v1, v2, v3, v4,
-      v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
-      v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
-      v34, v35, v36);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37>
-internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29, T30, T31, T32, T33, T34, T35, T36, T37> Values(T1 v1, T2 v2, T3 v3,
-    T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
-    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
-    T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
-    T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
-    T37 v37) {
-  return internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37>(v1, v2, v3,
-      v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
-      v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
-      v34, v35, v36, v37);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38>
-internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Values(T1 v1, T2 v2,
-    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
-    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
-    T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
-    T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
-    T37 v37, T38 v38) {
-  return internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38>(v1, v2,
-      v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,
-      v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32,
-      v33, v34, v35, v36, v37, v38);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39>
-internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Values(T1 v1, T2 v2,
-    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
-    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
-    T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
-    T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
-    T37 v37, T38 v38, T39 v39) {
-  return internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39>(v1,
-      v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,
-      v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31,
-      v32, v33, v34, v35, v36, v37, v38, v39);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40>
-internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Values(T1 v1,
-    T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,
-    T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,
-    T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27,
-    T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35,
-    T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) {
-  return internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
-      T40>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
-      v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29,
-      v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41>
-internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
-    T41> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-    T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
-    T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41) {
-  return internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
-      T40, T41>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,
-      v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28,
-      v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42>
-internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
-    T42> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-    T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
-    T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
-    T42 v42) {
-  return internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
-      T40, T41, T42>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
-      v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,
-      v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41,
-      v42);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43>
-internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
-    T43> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-    T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
-    T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
-    T42 v42, T43 v43) {
-  return internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
-      T40, T41, T42, T43>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
-      v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,
-      v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40,
-      v41, v42, v43);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44>
-internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
-    T44> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-    T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
-    T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
-    T42 v42, T43 v43, T44 v44) {
-  return internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
-      T40, T41, T42, T43, T44>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
-      v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,
-      v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39,
-      v40, v41, v42, v43, v44);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45>
-internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
-    T44, T45> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
-    T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
-    T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
-    T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,
-    T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,
-    T41 v41, T42 v42, T43 v43, T44 v44, T45 v45) {
-  return internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
-      T40, T41, T42, T43, T44, T45>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
-      v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,
-      v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38,
-      v39, v40, v41, v42, v43, v44, v45);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45,
-    typename T46>
-internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
-    T44, T45, T46> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
-    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
-    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
-    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
-    T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
-    T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) {
-  return internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
-      T40, T41, T42, T43, T44, T45, T46>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
-      v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
-      v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,
-      v38, v39, v40, v41, v42, v43, v44, v45, v46);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45,
-    typename T46, typename T47>
-internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
-    T44, T45, T46, T47> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
-    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
-    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
-    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
-    T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
-    T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) {
-  return internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
-      T40, T41, T42, T43, T44, T45, T46, T47>(v1, v2, v3, v4, v5, v6, v7, v8,
-      v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
-      v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,
-      v38, v39, v40, v41, v42, v43, v44, v45, v46, v47);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45,
-    typename T46, typename T47, typename T48>
-internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
-    T44, T45, T46, T47, T48> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
-    T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
-    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
-    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
-    T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
-    T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47,
-    T48 v48) {
-  return internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
-      T40, T41, T42, T43, T44, T45, T46, T47, T48>(v1, v2, v3, v4, v5, v6, v7,
-      v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,
-      v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36,
-      v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45,
-    typename T46, typename T47, typename T48, typename T49>
-internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
-    T44, T45, T46, T47, T48, T49> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
-    T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
-    T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,
-    T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,
-    T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38,
-    T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46,
-    T47 v47, T48 v48, T49 v49) {
-  return internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
-      T40, T41, T42, T43, T44, T45, T46, T47, T48, T49>(v1, v2, v3, v4, v5, v6,
-      v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,
-      v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35,
-      v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45,
-    typename T46, typename T47, typename T48, typename T49, typename T50>
-internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
-    T44, T45, T46, T47, T48, T49, T50> Values(T1 v1, T2 v2, T3 v3, T4 v4,
-    T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
-    T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
-    T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
-    T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37,
-    T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45,
-    T46 v46, T47 v47, T48 v48, T49 v49, T50 v50) {
-  return internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
-      T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>(v1, v2, v3, v4,
-      v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
-      v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
-      v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47,
-      v48, v49, v50);
-}
-
-// Bool() allows generating tests with parameters in a set of (false, true).
-//
-// Synopsis:
-// Bool()
-//   - returns a generator producing sequences with elements {false, true}.
-//
-// It is useful when testing code that depends on Boolean flags. Combinations
-// of multiple flags can be tested when several Bool()'s are combined using
-// Combine() function.
-//
-// In the following example all tests in the test case FlagDependentTest
-// will be instantiated twice with parameters false and true.
-//
-// class FlagDependentTest : public testing::TestWithParam<bool> {
-//   virtual void SetUp() {
-//     external_flag = GetParam();
-//   }
-// }
-// INSTANTIATE_TEST_CASE_P(BoolSequence, FlagDependentTest, Bool());
-//
-inline internal::ParamGenerator<bool> Bool() {
-  return Values(false, true);
-}
-
-#if GTEST_HAS_COMBINE
-// Combine() allows the user to combine two or more sequences to produce
-// values of a Cartesian product of those sequences' elements.
-//
-// Synopsis:
-// Combine(gen1, gen2, ..., genN)
-//   - returns a generator producing sequences with elements coming from
-//     the Cartesian product of elements from the sequences generated by
-//     gen1, gen2, ..., genN. The sequence elements will have a type of
-//     tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types
-//     of elements from sequences produces by gen1, gen2, ..., genN.
-//
-// Combine can have up to 10 arguments. This number is currently limited
-// by the maximum number of elements in the tuple implementation used by Google
-// Test.
-//
-// Example:
-//
-// This will instantiate tests in test case AnimalTest each one with
-// the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
-// tuple("dog", BLACK), and tuple("dog", WHITE):
-//
-// enum Color { BLACK, GRAY, WHITE };
-// class AnimalTest
-//     : public testing::TestWithParam<tuple<const char*, Color> > {...};
-//
-// TEST_P(AnimalTest, AnimalLooksNice) {...}
-//
-// INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest,
-//                         Combine(Values("cat", "dog"),
-//                                 Values(BLACK, WHITE)));
-//
-// This will instantiate tests in FlagDependentTest with all variations of two
-// Boolean flags:
-//
-// class FlagDependentTest
-//     : public testing::TestWithParam<tuple(bool, bool)> > {
-//   virtual void SetUp() {
-//     // Assigns external_flag_1 and external_flag_2 values from the tuple.
-//     tie(external_flag_1, external_flag_2) = GetParam();
-//   }
-// };
-//
-// TEST_P(FlagDependentTest, TestFeature1) {
-//   // Test your code using external_flag_1 and external_flag_2 here.
-// }
-// INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest,
-//                         Combine(Bool(), Bool()));
-//
-template <typename Generator1, typename Generator2>
-internal::CartesianProductHolder2<Generator1, Generator2> Combine(
-    const Generator1& g1, const Generator2& g2) {
-  return internal::CartesianProductHolder2<Generator1, Generator2>(
-      g1, g2);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3>
-internal::CartesianProductHolder3<Generator1, Generator2, Generator3> Combine(
-    const Generator1& g1, const Generator2& g2, const Generator3& g3) {
-  return internal::CartesianProductHolder3<Generator1, Generator2, Generator3>(
-      g1, g2, g3);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
-    typename Generator4>
-internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
-    Generator4> Combine(
-    const Generator1& g1, const Generator2& g2, const Generator3& g3,
-        const Generator4& g4) {
-  return internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
-      Generator4>(
-      g1, g2, g3, g4);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
-    typename Generator4, typename Generator5>
-internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
-    Generator4, Generator5> Combine(
-    const Generator1& g1, const Generator2& g2, const Generator3& g3,
-        const Generator4& g4, const Generator5& g5) {
-  return internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
-      Generator4, Generator5>(
-      g1, g2, g3, g4, g5);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
-    typename Generator4, typename Generator5, typename Generator6>
-internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
-    Generator4, Generator5, Generator6> Combine(
-    const Generator1& g1, const Generator2& g2, const Generator3& g3,
-        const Generator4& g4, const Generator5& g5, const Generator6& g6) {
-  return internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
-      Generator4, Generator5, Generator6>(
-      g1, g2, g3, g4, g5, g6);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
-    typename Generator4, typename Generator5, typename Generator6,
-    typename Generator7>
-internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
-    Generator4, Generator5, Generator6, Generator7> Combine(
-    const Generator1& g1, const Generator2& g2, const Generator3& g3,
-        const Generator4& g4, const Generator5& g5, const Generator6& g6,
-        const Generator7& g7) {
-  return internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
-      Generator4, Generator5, Generator6, Generator7>(
-      g1, g2, g3, g4, g5, g6, g7);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
-    typename Generator4, typename Generator5, typename Generator6,
-    typename Generator7, typename Generator8>
-internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
-    Generator4, Generator5, Generator6, Generator7, Generator8> Combine(
-    const Generator1& g1, const Generator2& g2, const Generator3& g3,
-        const Generator4& g4, const Generator5& g5, const Generator6& g6,
-        const Generator7& g7, const Generator8& g8) {
-  return internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
-      Generator4, Generator5, Generator6, Generator7, Generator8>(
-      g1, g2, g3, g4, g5, g6, g7, g8);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
-    typename Generator4, typename Generator5, typename Generator6,
-    typename Generator7, typename Generator8, typename Generator9>
-internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
-    Generator4, Generator5, Generator6, Generator7, Generator8,
-    Generator9> Combine(
-    const Generator1& g1, const Generator2& g2, const Generator3& g3,
-        const Generator4& g4, const Generator5& g5, const Generator6& g6,
-        const Generator7& g7, const Generator8& g8, const Generator9& g9) {
-  return internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
-      Generator4, Generator5, Generator6, Generator7, Generator8, Generator9>(
-      g1, g2, g3, g4, g5, g6, g7, g8, g9);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
-    typename Generator4, typename Generator5, typename Generator6,
-    typename Generator7, typename Generator8, typename Generator9,
-    typename Generator10>
-internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
-    Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
-    Generator10> Combine(
-    const Generator1& g1, const Generator2& g2, const Generator3& g3,
-        const Generator4& g4, const Generator5& g5, const Generator6& g6,
-        const Generator7& g7, const Generator8& g8, const Generator9& g9,
-        const Generator10& g10) {
-  return internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
-      Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
-      Generator10>(
-      g1, g2, g3, g4, g5, g6, g7, g8, g9, g10);
-}
-#endif  // GTEST_HAS_COMBINE
-
-
-
-#define TEST_P(test_case_name, test_name) \
-  class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
-      : public test_case_name { \
-   public: \
-    GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \
-    virtual void TestBody(); \
-   private: \
-    static int AddToRegistry() { \
-      ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
-          GetTestCasePatternHolder<test_case_name>(\
-              #test_case_name, __FILE__, __LINE__)->AddTestPattern(\
-                  #test_case_name, \
-                  #test_name, \
-                  new ::testing::internal::TestMetaFactory< \
-                      GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>()); \
-      return 0; \
-    } \
-    static int gtest_registering_dummy_; \
-    GTEST_DISALLOW_COPY_AND_ASSIGN_(\
-        GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
-  }; \
-  int GTEST_TEST_CLASS_NAME_(test_case_name, \
-                             test_name)::gtest_registering_dummy_ = \
-      GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
-  void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
-
-#define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \
-  ::testing::internal::ParamGenerator<test_case_name::ParamType> \
-      gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
-  int gtest_##prefix##test_case_name##_dummy_ = \
-      ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
-          GetTestCasePatternHolder<test_case_name>(\
-              #test_case_name, __FILE__, __LINE__)->AddTestCaseInstantiation(\
-                  #prefix, \
-                  &gtest_##prefix##test_case_name##_EvalGenerator_, \
-                  __FILE__, __LINE__)
-
-}  // namespace testing
-
-#endif  // GTEST_HAS_PARAM_TEST
-
-#endif  // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
diff --git a/third_party/gtest/include/gtest/gtest-spi.h b/third_party/gtest/include/gtest/gtest-spi.h
deleted file mode 100644
index 2953411..0000000
--- a/third_party/gtest/include/gtest/gtest-spi.h
+++ /dev/null
@@ -1,232 +0,0 @@
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// Utilities for testing Google Test itself and code that uses Google Test
-// (e.g. frameworks built on top of Google Test).
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_SPI_H_
-#define GTEST_INCLUDE_GTEST_GTEST_SPI_H_
-
-#include <gtest/gtest.h>
-
-namespace testing {
-
-// This helper class can be used to mock out Google Test failure reporting
-// so that we can test Google Test or code that builds on Google Test.
-//
-// An object of this class appends a TestPartResult object to the
-// TestPartResultArray object given in the constructor whenever a Google Test
-// failure is reported. It can either intercept only failures that are
-// generated in the same thread that created this object or it can intercept
-// all generated failures. The scope of this mock object can be controlled with
-// the second argument to the two arguments constructor.
-class ScopedFakeTestPartResultReporter
-    : public TestPartResultReporterInterface {
- public:
-  // The two possible mocking modes of this object.
-  enum InterceptMode {
-    INTERCEPT_ONLY_CURRENT_THREAD,  // Intercepts only thread local failures.
-    INTERCEPT_ALL_THREADS           // Intercepts all failures.
-  };
-
-  // The c'tor sets this object as the test part result reporter used
-  // by Google Test.  The 'result' parameter specifies where to report the
-  // results. This reporter will only catch failures generated in the current
-  // thread. DEPRECATED
-  explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result);
-
-  // Same as above, but you can choose the interception scope of this object.
-  ScopedFakeTestPartResultReporter(InterceptMode intercept_mode,
-                                   TestPartResultArray* result);
-
-  // The d'tor restores the previous test part result reporter.
-  virtual ~ScopedFakeTestPartResultReporter();
-
-  // Appends the TestPartResult object to the TestPartResultArray
-  // received in the constructor.
-  //
-  // This method is from the TestPartResultReporterInterface
-  // interface.
-  virtual void ReportTestPartResult(const TestPartResult& result);
- private:
-  void Init();
-
-  const InterceptMode intercept_mode_;
-  TestPartResultReporterInterface* old_reporter_;
-  TestPartResultArray* const result_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter);
-};
-
-namespace internal {
-
-// A helper class for implementing EXPECT_FATAL_FAILURE() and
-// EXPECT_NONFATAL_FAILURE().  Its destructor verifies that the given
-// TestPartResultArray contains exactly one failure that has the given
-// type and contains the given substring.  If that's not the case, a
-// non-fatal failure will be generated.
-class SingleFailureChecker {
- public:
-  // The constructor remembers the arguments.
-  SingleFailureChecker(const TestPartResultArray* results,
-                       TestPartResult::Type type,
-                       const char* substr);
-  ~SingleFailureChecker();
- private:
-  const TestPartResultArray* const results_;
-  const TestPartResult::Type type_;
-  const String substr_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker);
-};
-
-}  // namespace internal
-
-}  // namespace testing
-
-// A set of macros for testing Google Test assertions or code that's expected
-// to generate Google Test fatal failures.  It verifies that the given
-// statement will cause exactly one fatal Google Test failure with 'substr'
-// being part of the failure message.
-//
-// There are two different versions of this macro. EXPECT_FATAL_FAILURE only
-// affects and considers failures generated in the current thread and
-// EXPECT_FATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
-//
-// The verification of the assertion is done correctly even when the statement
-// throws an exception or aborts the current function.
-//
-// Known restrictions:
-//   - 'statement' cannot reference local non-static variables or
-//     non-static members of the current object.
-//   - 'statement' cannot return a value.
-//   - You cannot stream a failure message to this macro.
-//
-// Note that even though the implementations of the following two
-// macros are much alike, we cannot refactor them to use a common
-// helper macro, due to some peculiarity in how the preprocessor
-// works.  The AcceptsMacroThatExpandsToUnprotectedComma test in
-// gtest_unittest.cc will fail to compile if we do that.
-#define EXPECT_FATAL_FAILURE(statement, substr) \
-  do { \
-    class GTestExpectFatalFailureHelper {\
-     public:\
-      static void Execute() { statement; }\
-    };\
-    ::testing::TestPartResultArray gtest_failures;\
-    ::testing::internal::SingleFailureChecker gtest_checker(\
-        &gtest_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
-    {\
-      ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
-          ::testing::ScopedFakeTestPartResultReporter:: \
-          INTERCEPT_ONLY_CURRENT_THREAD, &gtest_failures);\
-      GTestExpectFatalFailureHelper::Execute();\
-    }\
-  } while (::testing::internal::AlwaysFalse())
-
-#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
-  do { \
-    class GTestExpectFatalFailureHelper {\
-     public:\
-      static void Execute() { statement; }\
-    };\
-    ::testing::TestPartResultArray gtest_failures;\
-    ::testing::internal::SingleFailureChecker gtest_checker(\
-        &gtest_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
-    {\
-      ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
-          ::testing::ScopedFakeTestPartResultReporter:: \
-          INTERCEPT_ALL_THREADS, &gtest_failures);\
-      GTestExpectFatalFailureHelper::Execute();\
-    }\
-  } while (::testing::internal::AlwaysFalse())
-
-// A macro for testing Google Test assertions or code that's expected to
-// generate Google Test non-fatal failures.  It asserts that the given
-// statement will cause exactly one non-fatal Google Test failure with 'substr'
-// being part of the failure message.
-//
-// There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only
-// affects and considers failures generated in the current thread and
-// EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
-//
-// 'statement' is allowed to reference local variables and members of
-// the current object.
-//
-// The verification of the assertion is done correctly even when the statement
-// throws an exception or aborts the current function.
-//
-// Known restrictions:
-//   - You cannot stream a failure message to this macro.
-//
-// Note that even though the implementations of the following two
-// macros are much alike, we cannot refactor them to use a common
-// helper macro, due to some peculiarity in how the preprocessor
-// works.  If we do that, the code won't compile when the user gives
-// EXPECT_NONFATAL_FAILURE() a statement that contains a macro that
-// expands to code containing an unprotected comma.  The
-// AcceptsMacroThatExpandsToUnprotectedComma test in gtest_unittest.cc
-// catches that.
-//
-// For the same reason, we have to write
-//   if (::testing::internal::AlwaysTrue()) { statement; }
-// instead of
-//   GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
-// to avoid an MSVC warning on unreachable code.
-#define EXPECT_NONFATAL_FAILURE(statement, substr) \
-  do {\
-    ::testing::TestPartResultArray gtest_failures;\
-    ::testing::internal::SingleFailureChecker gtest_checker(\
-        &gtest_failures, ::testing::TestPartResult::kNonFatalFailure, \
-        (substr));\
-    {\
-      ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
-          ::testing::ScopedFakeTestPartResultReporter:: \
-          INTERCEPT_ONLY_CURRENT_THREAD, &gtest_failures);\
-      if (::testing::internal::AlwaysTrue()) { statement; }\
-    }\
-  } while (::testing::internal::AlwaysFalse())
-
-#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
-  do {\
-    ::testing::TestPartResultArray gtest_failures;\
-    ::testing::internal::SingleFailureChecker gtest_checker(\
-        &gtest_failures, ::testing::TestPartResult::kNonFatalFailure, \
-        (substr));\
-    {\
-      ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
-          ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS,\
-          &gtest_failures);\
-      if (::testing::internal::AlwaysTrue()) { statement; }\
-    }\
-  } while (::testing::internal::AlwaysFalse())
-
-#endif  // GTEST_INCLUDE_GTEST_GTEST_SPI_H_
diff --git a/third_party/gtest/include/gtest/gtest-test-part.h b/third_party/gtest/include/gtest/gtest-test-part.h
deleted file mode 100644
index 58e7df9..0000000
--- a/third_party/gtest/include/gtest/gtest-test-part.h
+++ /dev/null
@@ -1,178 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: mheule@google.com (Markus Heule)
-//
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
-#define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
-
-#include <iosfwd>
-#include <gtest/internal/gtest-internal.h>
-#include <gtest/internal/gtest-string.h>
-
-namespace testing {
-
-// A copyable object representing the result of a test part (i.e. an
-// assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).
-//
-// Don't inherit from TestPartResult as its destructor is not virtual.
-class TestPartResult {
- public:
-  // The possible outcomes of a test part (i.e. an assertion or an
-  // explicit SUCCEED(), FAIL(), or ADD_FAILURE()).
-  enum Type {
-    kSuccess,          // Succeeded.
-    kNonFatalFailure,  // Failed but the test can continue.
-    kFatalFailure      // Failed and the test should be terminated.
-  };
-
-  // C'tor.  TestPartResult does NOT have a default constructor.
-  // Always use this constructor (with parameters) to create a
-  // TestPartResult object.
-  TestPartResult(Type type,
-                 const char* file_name,
-                 int line_number,
-                 const char* message)
-      : type_(type),
-        file_name_(file_name),
-        line_number_(line_number),
-        summary_(ExtractSummary(message)),
-        message_(message) {
-  }
-
-  // Gets the outcome of the test part.
-  Type type() const { return type_; }
-
-  // Gets the name of the source file where the test part took place, or
-  // NULL if it's unknown.
-  const char* file_name() const { return file_name_.c_str(); }
-
-  // Gets the line in the source file where the test part took place,
-  // or -1 if it's unknown.
-  int line_number() const { return line_number_; }
-
-  // Gets the summary of the failure message.
-  const char* summary() const { return summary_.c_str(); }
-
-  // Gets the message associated with the test part.
-  const char* message() const { return message_.c_str(); }
-
-  // Returns true iff the test part passed.
-  bool passed() const { return type_ == kSuccess; }
-
-  // Returns true iff the test part failed.
-  bool failed() const { return type_ != kSuccess; }
-
-  // Returns true iff the test part non-fatally failed.
-  bool nonfatally_failed() const { return type_ == kNonFatalFailure; }
-
-  // Returns true iff the test part fatally failed.
-  bool fatally_failed() const { return type_ == kFatalFailure; }
- private:
-  Type type_;
-
-  // Gets the summary of the failure message by omitting the stack
-  // trace in it.
-  static internal::String ExtractSummary(const char* message);
-
-  // The name of the source file where the test part took place, or
-  // NULL if the source file is unknown.
-  internal::String file_name_;
-  // The line in the source file where the test part took place, or -1
-  // if the line number is unknown.
-  int line_number_;
-  internal::String summary_;  // The test failure summary.
-  internal::String message_;  // The test failure message.
-};
-
-// Prints a TestPartResult object.
-std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
-
-// An array of TestPartResult objects.
-//
-// We define this class as we cannot use STL containers when compiling
-// Google Test with MSVC 7.1 and exceptions disabled.
-//
-// Don't inherit from TestPartResultArray as its destructor is not
-// virtual.
-class TestPartResultArray {
- public:
-  TestPartResultArray();
-  ~TestPartResultArray();
-
-  // Appends the given TestPartResult to the array.
-  void Append(const TestPartResult& result);
-
-  // Returns the TestPartResult at the given index (0-based).
-  const TestPartResult& GetTestPartResult(int index) const;
-
-  // Returns the number of TestPartResult objects in the array.
-  int size() const;
- private:
-  // Internally we use a Vector to implement the array.
-  internal::Vector<TestPartResult>* const array_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray);
-};
-
-// This interface knows how to report a test part result.
-class TestPartResultReporterInterface {
- public:
-  virtual ~TestPartResultReporterInterface() {}
-
-  virtual void ReportTestPartResult(const TestPartResult& result) = 0;
-};
-
-namespace internal {
-
-// This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a
-// statement generates new fatal failures. To do so it registers itself as the
-// current test part result reporter. Besides checking if fatal failures were
-// reported, it only delegates the reporting to the former result reporter.
-// The original result reporter is restored in the destructor.
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-class HasNewFatalFailureHelper : public TestPartResultReporterInterface {
- public:
-  HasNewFatalFailureHelper();
-  virtual ~HasNewFatalFailureHelper();
-  virtual void ReportTestPartResult(const TestPartResult& result);
-  bool has_new_fatal_failure() const { return has_new_fatal_failure_; }
- private:
-  bool has_new_fatal_failure_;
-  TestPartResultReporterInterface* original_reporter_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper);
-};
-
-}  // namespace internal
-
-}  // namespace testing
-
-#endif  // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
diff --git a/third_party/gtest/include/gtest/gtest-typed-test.h b/third_party/gtest/include/gtest/gtest-typed-test.h
deleted file mode 100644
index 519edfe..0000000
--- a/third_party/gtest/include/gtest/gtest-typed-test.h
+++ /dev/null
@@ -1,253 +0,0 @@
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
-
-// This header implements typed tests and type-parameterized tests.
-
-// Typed (aka type-driven) tests repeat the same test for types in a
-// list.  You must know which types you want to test with when writing
-// typed tests. Here's how you do it:
-
-#if 0
-
-// First, define a fixture class template.  It should be parameterized
-// by a type.  Remember to derive it from testing::Test.
-template <typename T>
-class FooTest : public testing::Test {
- public:
-  ...
-  typedef std::list<T> List;
-  static T shared_;
-  T value_;
-};
-
-// Next, associate a list of types with the test case, which will be
-// repeated for each type in the list.  The typedef is necessary for
-// the macro to parse correctly.
-typedef testing::Types<char, int, unsigned int> MyTypes;
-TYPED_TEST_CASE(FooTest, MyTypes);
-
-// If the type list contains only one type, you can write that type
-// directly without Types<...>:
-//   TYPED_TEST_CASE(FooTest, int);
-
-// Then, use TYPED_TEST() instead of TEST_F() to define as many typed
-// tests for this test case as you want.
-TYPED_TEST(FooTest, DoesBlah) {
-  // Inside a test, refer to TypeParam to get the type parameter.
-  // Since we are inside a derived class template, C++ requires use to
-  // visit the members of FooTest via 'this'.
-  TypeParam n = this->value_;
-
-  // To visit static members of the fixture, add the TestFixture::
-  // prefix.
-  n += TestFixture::shared_;
-
-  // To refer to typedefs in the fixture, add the "typename
-  // TestFixture::" prefix.
-  typename TestFixture::List values;
-  values.push_back(n);
-  ...
-}
-
-TYPED_TEST(FooTest, HasPropertyA) { ... }
-
-#endif  // 0
-
-// Type-parameterized tests are abstract test patterns parameterized
-// by a type.  Compared with typed tests, type-parameterized tests
-// allow you to define the test pattern without knowing what the type
-// parameters are.  The defined pattern can be instantiated with
-// different types any number of times, in any number of translation
-// units.
-//
-// If you are designing an interface or concept, you can define a
-// suite of type-parameterized tests to verify properties that any
-// valid implementation of the interface/concept should have.  Then,
-// each implementation can easily instantiate the test suite to verify
-// that it conforms to the requirements, without having to write
-// similar tests repeatedly.  Here's an example:
-
-#if 0
-
-// First, define a fixture class template.  It should be parameterized
-// by a type.  Remember to derive it from testing::Test.
-template <typename T>
-class FooTest : public testing::Test {
-  ...
-};
-
-// Next, declare that you will define a type-parameterized test case
-// (the _P suffix is for "parameterized" or "pattern", whichever you
-// prefer):
-TYPED_TEST_CASE_P(FooTest);
-
-// Then, use TYPED_TEST_P() to define as many type-parameterized tests
-// for this type-parameterized test case as you want.
-TYPED_TEST_P(FooTest, DoesBlah) {
-  // Inside a test, refer to TypeParam to get the type parameter.
-  TypeParam n = 0;
-  ...
-}
-
-TYPED_TEST_P(FooTest, HasPropertyA) { ... }
-
-// Now the tricky part: you need to register all test patterns before
-// you can instantiate them.  The first argument of the macro is the
-// test case name; the rest are the names of the tests in this test
-// case.
-REGISTER_TYPED_TEST_CASE_P(FooTest,
-                           DoesBlah, HasPropertyA);
-
-// Finally, you are free to instantiate the pattern with the types you
-// want.  If you put the above code in a header file, you can #include
-// it in multiple C++ source files and instantiate it multiple times.
-//
-// To distinguish different instances of the pattern, the first
-// argument to the INSTANTIATE_* macro is a prefix that will be added
-// to the actual test case name.  Remember to pick unique prefixes for
-// different instances.
-typedef testing::Types<char, int, unsigned int> MyTypes;
-INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
-
-// If the type list contains only one type, you can write that type
-// directly without Types<...>:
-//   INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, int);
-
-#endif  // 0
-
-#include <gtest/internal/gtest-port.h>
-#include <gtest/internal/gtest-type-util.h>
-
-// Implements typed tests.
-
-#if GTEST_HAS_TYPED_TEST
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Expands to the name of the typedef for the type parameters of the
-// given test case.
-#define GTEST_TYPE_PARAMS_(TestCaseName) gtest_type_params_##TestCaseName##_
-
-#define TYPED_TEST_CASE(CaseName, Types) \
-  typedef ::testing::internal::TypeList<Types>::type \
-      GTEST_TYPE_PARAMS_(CaseName)
-
-#define TYPED_TEST(CaseName, TestName) \
-  template <typename gtest_TypeParam_> \
-  class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \
-      : public CaseName<gtest_TypeParam_> { \
-   private: \
-    typedef CaseName<gtest_TypeParam_> TestFixture; \
-    typedef gtest_TypeParam_ TypeParam; \
-    virtual void TestBody(); \
-  }; \
-  bool gtest_##CaseName##_##TestName##_registered_ = \
-      ::testing::internal::TypeParameterizedTest< \
-          CaseName, \
-          ::testing::internal::TemplateSel< \
-              GTEST_TEST_CLASS_NAME_(CaseName, TestName)>, \
-          GTEST_TYPE_PARAMS_(CaseName)>::Register(\
-              "", #CaseName, #TestName, 0); \
-  template <typename gtest_TypeParam_> \
-  void GTEST_TEST_CLASS_NAME_(CaseName, TestName)<gtest_TypeParam_>::TestBody()
-
-#endif  // GTEST_HAS_TYPED_TEST
-
-// Implements type-parameterized tests.
-
-#if GTEST_HAS_TYPED_TEST_P
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Expands to the namespace name that the type-parameterized tests for
-// the given type-parameterized test case are defined in.  The exact
-// name of the namespace is subject to change without notice.
-#define GTEST_CASE_NAMESPACE_(TestCaseName) \
-  gtest_case_##TestCaseName##_
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Expands to the name of the variable used to remember the names of
-// the defined tests in the given test case.
-#define GTEST_TYPED_TEST_CASE_P_STATE_(TestCaseName) \
-  gtest_typed_test_case_p_state_##TestCaseName##_
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY.
-//
-// Expands to the name of the variable used to remember the names of
-// the registered tests in the given test case.
-#define GTEST_REGISTERED_TEST_NAMES_(TestCaseName) \
-  gtest_registered_test_names_##TestCaseName##_
-
-// The variables defined in the type-parameterized test macros are
-// static as typically these macros are used in a .h file that can be
-// #included in multiple translation units linked together.
-#define TYPED_TEST_CASE_P(CaseName) \
-  static ::testing::internal::TypedTestCasePState \
-      GTEST_TYPED_TEST_CASE_P_STATE_(CaseName)
-
-#define TYPED_TEST_P(CaseName, TestName) \
-  namespace GTEST_CASE_NAMESPACE_(CaseName) { \
-  template <typename gtest_TypeParam_> \
-  class TestName : public CaseName<gtest_TypeParam_> { \
-   private: \
-    typedef CaseName<gtest_TypeParam_> TestFixture; \
-    typedef gtest_TypeParam_ TypeParam; \
-    virtual void TestBody(); \
-  }; \
-  static bool gtest_##TestName##_defined_ = \
-      GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).AddTestName(\
-          __FILE__, __LINE__, #CaseName, #TestName); \
-  } \
-  template <typename gtest_TypeParam_> \
-  void GTEST_CASE_NAMESPACE_(CaseName)::TestName<gtest_TypeParam_>::TestBody()
-
-#define REGISTER_TYPED_TEST_CASE_P(CaseName, ...) \
-  namespace GTEST_CASE_NAMESPACE_(CaseName) { \
-  typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \
-  } \
-  static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) = \
-      GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames(\
-          __FILE__, __LINE__, #__VA_ARGS__)
-
-#define INSTANTIATE_TYPED_TEST_CASE_P(Prefix, CaseName, Types) \
-  bool gtest_##Prefix##_##CaseName = \
-      ::testing::internal::TypeParameterizedTestCase<CaseName, \
-          GTEST_CASE_NAMESPACE_(CaseName)::gtest_AllTests_, \
-          ::testing::internal::TypeList<Types>::type>::Register(\
-              #Prefix, #CaseName, GTEST_REGISTERED_TEST_NAMES_(CaseName))
-
-#endif  // GTEST_HAS_TYPED_TEST_P
-
-#endif  // GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
diff --git a/third_party/gtest/include/gtest/gtest.h b/third_party/gtest/include/gtest/gtest.h
deleted file mode 100644
index 33e2f7f..0000000
--- a/third_party/gtest/include/gtest/gtest.h
+++ /dev/null
@@ -1,2042 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file defines the public API for Google Test.  It should be
-// included by any test program that uses Google Test.
-//
-// IMPORTANT NOTE: Due to limitation of the C++ language, we have to
-// leave some internal implementation details in this header file.
-// They are clearly marked by comments like this:
-//
-//   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-//
-// Such code is NOT meant to be used by a user directly, and is subject
-// to CHANGE WITHOUT NOTICE.  Therefore DO NOT DEPEND ON IT in a user
-// program!
-//
-// Acknowledgment: Google Test borrowed the idea of automatic test
-// registration from Barthelemy Dagenais' (barthelemy@prologique.com)
-// easyUnit framework.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_H_
-
-#include <limits>
-#include <gtest/internal/gtest-internal.h>
-#include <gtest/internal/gtest-string.h>
-#include <gtest/gtest-death-test.h>
-#include <gtest/gtest-message.h>
-#include <gtest/gtest-param-test.h>
-#include <gtest/gtest_prod.h>
-#include <gtest/gtest-test-part.h>
-#include <gtest/gtest-typed-test.h>
-
-// Depending on the platform, different string classes are available.
-// On Windows, ::std::string compiles only when exceptions are
-// enabled.  On Linux, in addition to ::std::string, Google also makes
-// use of class ::string, which has the same interface as
-// ::std::string, but has a different implementation.
-//
-// The user can tell us whether ::std::string is available in his
-// environment by defining the macro GTEST_HAS_STD_STRING to either 1
-// or 0 on the compiler command line.  He can also define
-// GTEST_HAS_GLOBAL_STRING to 1 to indicate that ::string is available
-// AND is a distinct type to ::std::string, or define it to 0 to
-// indicate otherwise.
-//
-// If the user's ::std::string and ::string are the same class due to
-// aliasing, he should define GTEST_HAS_STD_STRING to 1 and
-// GTEST_HAS_GLOBAL_STRING to 0.
-//
-// If the user doesn't define GTEST_HAS_STD_STRING and/or
-// GTEST_HAS_GLOBAL_STRING, they are defined heuristically.
-
-namespace testing {
-
-// Declares the flags.
-
-// This flag temporary enables the disabled tests.
-GTEST_DECLARE_bool_(also_run_disabled_tests);
-
-// This flag brings the debugger on an assertion failure.
-GTEST_DECLARE_bool_(break_on_failure);
-
-// This flag controls whether Google Test catches all test-thrown exceptions
-// and logs them as failures.
-GTEST_DECLARE_bool_(catch_exceptions);
-
-// This flag enables using colors in terminal output. Available values are
-// "yes" to enable colors, "no" (disable colors), or "auto" (the default)
-// to let Google Test decide.
-GTEST_DECLARE_string_(color);
-
-// This flag sets up the filter to select by name using a glob pattern
-// the tests to run. If the filter is not given all tests are executed.
-GTEST_DECLARE_string_(filter);
-
-// This flag causes the Google Test to list tests. None of the tests listed
-// are actually run if the flag is provided.
-GTEST_DECLARE_bool_(list_tests);
-
-// This flag controls whether Google Test emits a detailed XML report to a file
-// in addition to its normal textual output.
-GTEST_DECLARE_string_(output);
-
-// This flags control whether Google Test prints the elapsed time for each
-// test.
-GTEST_DECLARE_bool_(print_time);
-
-// This flag specifies the random number seed.
-GTEST_DECLARE_int32_(random_seed);
-
-// This flag sets how many times the tests are repeated. The default value
-// is 1. If the value is -1 the tests are repeating forever.
-GTEST_DECLARE_int32_(repeat);
-
-// This flag controls whether Google Test includes Google Test internal
-// stack frames in failure stack traces.
-GTEST_DECLARE_bool_(show_internal_stack_frames);
-
-// When this flag is specified, tests' order is randomized on every iteration.
-GTEST_DECLARE_bool_(shuffle);
-
-// This flag specifies the maximum number of stack frames to be
-// printed in a failure message.
-GTEST_DECLARE_int32_(stack_trace_depth);
-
-// When this flag is specified, a failed assertion will throw an
-// exception if exceptions are enabled, or exit the program with a
-// non-zero code otherwise.
-GTEST_DECLARE_bool_(throw_on_failure);
-
-// The upper limit for valid stack trace depths.
-const int kMaxStackTraceDepth = 100;
-
-namespace internal {
-
-class AssertHelper;
-class DefaultGlobalTestPartResultReporter;
-class ExecDeathTest;
-class NoExecDeathTest;
-class FinalSuccessChecker;
-class GTestFlagSaver;
-class TestInfoImpl;
-class TestResultAccessor;
-class TestEventListenersAccessor;
-class TestEventRepeater;
-class WindowsDeathTest;
-class UnitTestImpl* GetUnitTestImpl();
-void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
-                                    const String& message);
-class PrettyUnitTestResultPrinter;
-class XmlUnitTestResultPrinter;
-
-// Converts a streamable value to a String.  A NULL pointer is
-// converted to "(null)".  When the input value is a ::string,
-// ::std::string, ::wstring, or ::std::wstring object, each NUL
-// character in it is replaced with "\\0".
-// Declared in gtest-internal.h but defined here, so that it has access
-// to the definition of the Message class, required by the ARM
-// compiler.
-template <typename T>
-String StreamableToString(const T& streamable) {
-  return (Message() << streamable).GetString();
-}
-
-}  // namespace internal
-
-// A class for indicating whether an assertion was successful.  When
-// the assertion wasn't successful, the AssertionResult object
-// remembers a non-empty message that describes how it failed.
-//
-// To create an instance of this class, use one of the factory functions
-// (AssertionSuccess() and AssertionFailure()).
-//
-// This class is useful for two purposes:
-//   1. Defining predicate functions to be used with Boolean test assertions
-//      EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts
-//   2. Defining predicate-format functions to be
-//      used with predicate assertions (ASSERT_PRED_FORMAT*, etc).
-//
-// For example, if you define IsEven predicate:
-//
-//   testing::AssertionResult IsEven(int n) {
-//     if ((n % 2) == 0)
-//       return testing::AssertionSuccess();
-//     else
-//       return testing::AssertionFailure() << n << " is odd";
-//   }
-//
-// Then the failed expectation EXPECT_TRUE(IsEven(Fib(5)))
-// will print the message
-//
-//   Value of: IsEven(Fib(5))
-//     Actual: false (5 is odd)
-//   Expected: true
-//
-// instead of a more opaque
-//
-//   Value of: IsEven(Fib(5))
-//     Actual: false
-//   Expected: true
-//
-// in case IsEven is a simple Boolean predicate.
-//
-// If you expect your predicate to be reused and want to support informative
-// messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up
-// about half as often as positive ones in our tests), supply messages for
-// both success and failure cases:
-//
-//   testing::AssertionResult IsEven(int n) {
-//     if ((n % 2) == 0)
-//       return testing::AssertionSuccess() << n << " is even";
-//     else
-//       return testing::AssertionFailure() << n << " is odd";
-//   }
-//
-// Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print
-//
-//   Value of: IsEven(Fib(6))
-//     Actual: true (8 is even)
-//   Expected: false
-//
-// NB: Predicates that support negative Boolean assertions have reduced
-// performance in positive ones so be careful not to use them in tests
-// that have lots (tens of thousands) of positive Boolean assertions.
-//
-// To use this class with EXPECT_PRED_FORMAT assertions such as:
-//
-//   // Verifies that Foo() returns an even number.
-//   EXPECT_PRED_FORMAT1(IsEven, Foo());
-//
-// you need to define:
-//
-//   testing::AssertionResult IsEven(const char* expr, int n) {
-//     if ((n % 2) == 0)
-//       return testing::AssertionSuccess();
-//     else
-//       return testing::AssertionFailure()
-//         << "Expected: " << expr << " is even\n  Actual: it's " << n;
-//   }
-//
-// If Foo() returns 5, you will see the following message:
-//
-//   Expected: Foo() is even
-//     Actual: it's 5
-//
-class AssertionResult {
- public:
-  // Copy constructor.
-  // Used in EXPECT_TRUE/FALSE(assertion_result).
-  AssertionResult(const AssertionResult& other);
-  // Used in the EXPECT_TRUE/FALSE(bool_expression).
-  explicit AssertionResult(bool success) : success_(success) {}
-
-  // Returns true iff the assertion succeeded.
-  operator bool() const { return success_; }  // NOLINT
-
-  // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
-  AssertionResult operator!() const;
-
-  // Returns the text streamed into this AssertionResult. Test assertions
-  // use it when they fail (i.e., the predicate's outcome doesn't match the
-  // assertion's expectation). When nothing has been streamed into the
-  // object, returns an empty string.
-  const char* message() const {
-    return message_.get() != NULL && message_->c_str() != NULL ?
-           message_->c_str() : "";
-  }
-  // TODO(vladl@google.com): Remove this after making sure no clients use it.
-  // Deprecated; please use message() instead.
-  const char* failure_message() const { return message(); }
-
-  // Streams a custom failure message into this object.
-  template <typename T> AssertionResult& operator<<(const T& value);
-
- private:
-  // No implementation - we want AssertionResult to be
-  // copy-constructible but not assignable.
-  void operator=(const AssertionResult& other);
-
-  // Stores result of the assertion predicate.
-  bool success_;
-  // Stores the message describing the condition in case the expectation
-  // construct is not satisfied with the predicate's outcome.
-  // Referenced via a pointer to avoid taking too much stack frame space
-  // with test assertions.
-  internal::scoped_ptr<internal::String> message_;
-};  // class AssertionResult
-
-// Streams a custom failure message into this object.
-template <typename T>
-AssertionResult& AssertionResult::operator<<(const T& value) {
-  Message msg;
-  if (message_.get() != NULL)
-    msg << *message_;
-  msg << value;
-  message_.reset(new internal::String(msg.GetString()));
-  return *this;
-}
-
-// Makes a successful assertion result.
-AssertionResult AssertionSuccess();
-
-// Makes a failed assertion result.
-AssertionResult AssertionFailure();
-
-// Makes a failed assertion result with the given failure message.
-// Deprecated; use AssertionFailure() << msg.
-AssertionResult AssertionFailure(const Message& msg);
-
-// The abstract class that all tests inherit from.
-//
-// In Google Test, a unit test program contains one or many TestCases, and
-// each TestCase contains one or many Tests.
-//
-// When you define a test using the TEST macro, you don't need to
-// explicitly derive from Test - the TEST macro automatically does
-// this for you.
-//
-// The only time you derive from Test is when defining a test fixture
-// to be used a TEST_F.  For example:
-//
-//   class FooTest : public testing::Test {
-//    protected:
-//     virtual void SetUp() { ... }
-//     virtual void TearDown() { ... }
-//     ...
-//   };
-//
-//   TEST_F(FooTest, Bar) { ... }
-//   TEST_F(FooTest, Baz) { ... }
-//
-// Test is not copyable.
-class Test {
- public:
-  friend class internal::TestInfoImpl;
-
-  // Defines types for pointers to functions that set up and tear down
-  // a test case.
-  typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc;
-  typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc;
-
-  // The d'tor is virtual as we intend to inherit from Test.
-  virtual ~Test();
-
-  // Sets up the stuff shared by all tests in this test case.
-  //
-  // Google Test will call Foo::SetUpTestCase() before running the first
-  // test in test case Foo.  Hence a sub-class can define its own
-  // SetUpTestCase() method to shadow the one defined in the super
-  // class.
-  static void SetUpTestCase() {}
-
-  // Tears down the stuff shared by all tests in this test case.
-  //
-  // Google Test will call Foo::TearDownTestCase() after running the last
-  // test in test case Foo.  Hence a sub-class can define its own
-  // TearDownTestCase() method to shadow the one defined in the super
-  // class.
-  static void TearDownTestCase() {}
-
-  // Returns true iff the current test has a fatal failure.
-  static bool HasFatalFailure();
-
-  // Returns true iff the current test has a non-fatal failure.
-  static bool HasNonfatalFailure();
-
-  // Returns true iff the current test has a (either fatal or
-  // non-fatal) failure.
-  static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); }
-
-  // Logs a property for the current test.  Only the last value for a given
-  // key is remembered.
-  // These are public static so they can be called from utility functions
-  // that are not members of the test fixture.
-  // The arguments are const char* instead strings, as Google Test is used
-  // on platforms where string doesn't compile.
-  //
-  // Note that a driving consideration for these RecordProperty methods
-  // was to produce xml output suited to the Greenspan charting utility,
-  // which at present will only chart values that fit in a 32-bit int. It
-  // is the user's responsibility to restrict their values to 32-bit ints
-  // if they intend them to be used with Greenspan.
-  static void RecordProperty(const char* key, const char* value);
-  static void RecordProperty(const char* key, int value);
-
- protected:
-  // Creates a Test object.
-  Test();
-
-  // Sets up the test fixture.
-  virtual void SetUp();
-
-  // Tears down the test fixture.
-  virtual void TearDown();
-
- private:
-  // Returns true iff the current test has the same fixture class as
-  // the first test in the current test case.
-  static bool HasSameFixtureClass();
-
-  // Runs the test after the test fixture has been set up.
-  //
-  // A sub-class must implement this to define the test logic.
-  //
-  // DO NOT OVERRIDE THIS FUNCTION DIRECTLY IN A USER PROGRAM.
-  // Instead, use the TEST or TEST_F macro.
-  virtual void TestBody() = 0;
-
-  // Sets up, executes, and tears down the test.
-  void Run();
-
-  // Uses a GTestFlagSaver to save and restore all Google Test flags.
-  const internal::GTestFlagSaver* const gtest_flag_saver_;
-
-  // Often a user mis-spells SetUp() as Setup() and spends a long time
-  // wondering why it is never called by Google Test.  The declaration of
-  // the following method is solely for catching such an error at
-  // compile time:
-  //
-  //   - The return type is deliberately chosen to be not void, so it
-  //   will be a conflict if a user declares void Setup() in his test
-  //   fixture.
-  //
-  //   - This method is private, so it will be another compiler error
-  //   if a user calls it from his test fixture.
-  //
-  // DO NOT OVERRIDE THIS FUNCTION.
-  //
-  // If you see an error about overriding the following function or
-  // about it being private, you have mis-spelled SetUp() as Setup().
-  struct Setup_should_be_spelled_SetUp {};
-  virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
-
-  // We disallow copying Tests.
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(Test);
-};
-
-typedef internal::TimeInMillis TimeInMillis;
-
-// A copyable object representing a user specified test property which can be
-// output as a key/value string pair.
-//
-// Don't inherit from TestProperty as its destructor is not virtual.
-class TestProperty {
- public:
-  // C'tor.  TestProperty does NOT have a default constructor.
-  // Always use this constructor (with parameters) to create a
-  // TestProperty object.
-  TestProperty(const char* key, const char* value) :
-    key_(key), value_(value) {
-  }
-
-  // Gets the user supplied key.
-  const char* key() const {
-    return key_.c_str();
-  }
-
-  // Gets the user supplied value.
-  const char* value() const {
-    return value_.c_str();
-  }
-
-  // Sets a new value, overriding the one supplied in the constructor.
-  void SetValue(const char* new_value) {
-    value_ = new_value;
-  }
-
- private:
-  // The key supplied by the user.
-  internal::String key_;
-  // The value supplied by the user.
-  internal::String value_;
-};
-
-// The result of a single Test.  This includes a list of
-// TestPartResults, a list of TestProperties, a count of how many
-// death tests there are in the Test, and how much time it took to run
-// the Test.
-//
-// TestResult is not copyable.
-class TestResult {
- public:
-  // Creates an empty TestResult.
-  TestResult();
-
-  // D'tor.  Do not inherit from TestResult.
-  ~TestResult();
-
-  // Gets the number of all test parts.  This is the sum of the number
-  // of successful test parts and the number of failed test parts.
-  int total_part_count() const;
-
-  // Returns the number of the test properties.
-  int test_property_count() const;
-
-  // Returns true iff the test passed (i.e. no test part failed).
-  bool Passed() const { return !Failed(); }
-
-  // Returns true iff the test failed.
-  bool Failed() const;
-
-  // Returns true iff the test fatally failed.
-  bool HasFatalFailure() const;
-
-  // Returns true iff the test has a non-fatal failure.
-  bool HasNonfatalFailure() const;
-
-  // Returns the elapsed time, in milliseconds.
-  TimeInMillis elapsed_time() const { return elapsed_time_; }
-
-  // Returns the i-th test part result among all the results. i can range
-  // from 0 to test_property_count() - 1. If i is not in that range, aborts
-  // the program.
-  const TestPartResult& GetTestPartResult(int i) const;
-
-  // Returns the i-th test property. i can range from 0 to
-  // test_property_count() - 1. If i is not in that range, aborts the
-  // program.
-  const TestProperty& GetTestProperty(int i) const;
-
- private:
-  friend class TestInfo;
-  friend class UnitTest;
-  friend class internal::DefaultGlobalTestPartResultReporter;
-  friend class internal::ExecDeathTest;
-  friend class internal::TestInfoImpl;
-  friend class internal::TestResultAccessor;
-  friend class internal::UnitTestImpl;
-  friend class internal::WindowsDeathTest;
-
-  // Gets the vector of TestPartResults.
-  const internal::Vector<TestPartResult>& test_part_results() const {
-    return *test_part_results_;
-  }
-
-  // Gets the vector of TestProperties.
-  const internal::Vector<TestProperty>& test_properties() const {
-    return *test_properties_;
-  }
-
-  // Sets the elapsed time.
-  void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; }
-
-  // Adds a test property to the list. The property is validated and may add
-  // a non-fatal failure if invalid (e.g., if it conflicts with reserved
-  // key names). If a property is already recorded for the same key, the
-  // value will be updated, rather than storing multiple values for the same
-  // key.
-  void RecordProperty(const TestProperty& test_property);
-
-  // Adds a failure if the key is a reserved attribute of Google Test
-  // testcase tags.  Returns true if the property is valid.
-  // TODO(russr): Validate attribute names are legal and human readable.
-  static bool ValidateTestProperty(const TestProperty& test_property);
-
-  // Adds a test part result to the list.
-  void AddTestPartResult(const TestPartResult& test_part_result);
-
-  // Returns the death test count.
-  int death_test_count() const { return death_test_count_; }
-
-  // Increments the death test count, returning the new count.
-  int increment_death_test_count() { return ++death_test_count_; }
-
-  // Clears the test part results.
-  void ClearTestPartResults();
-
-  // Clears the object.
-  void Clear();
-
-  // Protects mutable state of the property vector and of owned
-  // properties, whose values may be updated.
-  internal::Mutex test_properites_mutex_;
-
-  // The vector of TestPartResults
-  internal::scoped_ptr<internal::Vector<TestPartResult> > test_part_results_;
-  // The vector of TestProperties
-  internal::scoped_ptr<internal::Vector<TestProperty> > test_properties_;
-  // Running count of death tests.
-  int death_test_count_;
-  // The elapsed time, in milliseconds.
-  TimeInMillis elapsed_time_;
-
-  // We disallow copying TestResult.
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult);
-};  // class TestResult
-
-// A TestInfo object stores the following information about a test:
-//
-//   Test case name
-//   Test name
-//   Whether the test should be run
-//   A function pointer that creates the test object when invoked
-//   Test result
-//
-// The constructor of TestInfo registers itself with the UnitTest
-// singleton such that the RUN_ALL_TESTS() macro knows which tests to
-// run.
-class TestInfo {
- public:
-  // Destructs a TestInfo object.  This function is not virtual, so
-  // don't inherit from TestInfo.
-  ~TestInfo();
-
-  // Returns the test case name.
-  const char* test_case_name() const;
-
-  // Returns the test name.
-  const char* name() const;
-
-  // Returns the test case comment.
-  const char* test_case_comment() const;
-
-  // Returns the test comment.
-  const char* comment() const;
-
-  // Returns true if this test should run, that is if the test is not disabled
-  // (or it is disabled but the also_run_disabled_tests flag has been specified)
-  // and its full name matches the user-specified filter.
-  //
-  // Google Test allows the user to filter the tests by their full names.
-  // The full name of a test Bar in test case Foo is defined as
-  // "Foo.Bar".  Only the tests that match the filter will run.
-  //
-  // A filter is a colon-separated list of glob (not regex) patterns,
-  // optionally followed by a '-' and a colon-separated list of
-  // negative patterns (tests to exclude).  A test is run if it
-  // matches one of the positive patterns and does not match any of
-  // the negative patterns.
-  //
-  // For example, *A*:Foo.* is a filter that matches any string that
-  // contains the character 'A' or starts with "Foo.".
-  bool should_run() const;
-
-  // Returns the result of the test.
-  const TestResult* result() const;
-
- private:
-#if GTEST_HAS_DEATH_TEST
-  friend class internal::DefaultDeathTestFactory;
-#endif  // GTEST_HAS_DEATH_TEST
-  friend class Test;
-  friend class TestCase;
-  friend class internal::TestInfoImpl;
-  friend class internal::UnitTestImpl;
-  friend TestInfo* internal::MakeAndRegisterTestInfo(
-      const char* test_case_name, const char* name,
-      const char* test_case_comment, const char* comment,
-      internal::TypeId fixture_class_id,
-      Test::SetUpTestCaseFunc set_up_tc,
-      Test::TearDownTestCaseFunc tear_down_tc,
-      internal::TestFactoryBase* factory);
-
-  // Returns true if this test matches the user-specified filter.
-  bool matches_filter() const;
-
-  // Increments the number of death tests encountered in this test so
-  // far.
-  int increment_death_test_count();
-
-  // Accessors for the implementation object.
-  internal::TestInfoImpl* impl() { return impl_; }
-  const internal::TestInfoImpl* impl() const { return impl_; }
-
-  // Constructs a TestInfo object. The newly constructed instance assumes
-  // ownership of the factory object.
-  TestInfo(const char* test_case_name, const char* name,
-           const char* test_case_comment, const char* comment,
-           internal::TypeId fixture_class_id,
-           internal::TestFactoryBase* factory);
-
-  // An opaque implementation object.
-  internal::TestInfoImpl* impl_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo);
-};
-
-// A test case, which consists of a vector of TestInfos.
-//
-// TestCase is not copyable.
-class TestCase {
- public:
-  // Creates a TestCase with the given name.
-  //
-  // TestCase does NOT have a default constructor.  Always use this
-  // constructor to create a TestCase object.
-  //
-  // Arguments:
-  //
-  //   name:         name of the test case
-  //   set_up_tc:    pointer to the function that sets up the test case
-  //   tear_down_tc: pointer to the function that tears down the test case
-  TestCase(const char* name, const char* comment,
-           Test::SetUpTestCaseFunc set_up_tc,
-           Test::TearDownTestCaseFunc tear_down_tc);
-
-  // Destructor of TestCase.
-  virtual ~TestCase();
-
-  // Gets the name of the TestCase.
-  const char* name() const { return name_.c_str(); }
-
-  // Returns the test case comment.
-  const char* comment() const { return comment_.c_str(); }
-
-  // Returns true if any test in this test case should run.
-  bool should_run() const { return should_run_; }
-
-  // Gets the number of successful tests in this test case.
-  int successful_test_count() const;
-
-  // Gets the number of failed tests in this test case.
-  int failed_test_count() const;
-
-  // Gets the number of disabled tests in this test case.
-  int disabled_test_count() const;
-
-  // Get the number of tests in this test case that should run.
-  int test_to_run_count() const;
-
-  // Gets the number of all tests in this test case.
-  int total_test_count() const;
-
-  // Returns true iff the test case passed.
-  bool Passed() const { return !Failed(); }
-
-  // Returns true iff the test case failed.
-  bool Failed() const { return failed_test_count() > 0; }
-
-  // Returns the elapsed time, in milliseconds.
-  TimeInMillis elapsed_time() const { return elapsed_time_; }
-
-  // Returns the i-th test among all the tests. i can range from 0 to
-  // total_test_count() - 1. If i is not in that range, returns NULL.
-  const TestInfo* GetTestInfo(int i) const;
-
- private:
-  friend class Test;
-  friend class internal::UnitTestImpl;
-
-  // Gets the (mutable) vector of TestInfos in this TestCase.
-  internal::Vector<TestInfo*>& test_info_list() { return *test_info_list_; }
-
-  // Gets the (immutable) vector of TestInfos in this TestCase.
-  const internal::Vector<TestInfo *> & test_info_list() const {
-    return *test_info_list_;
-  }
-
-  // Returns the i-th test among all the tests. i can range from 0 to
-  // total_test_count() - 1. If i is not in that range, returns NULL.
-  TestInfo* GetMutableTestInfo(int i);
-
-  // Sets the should_run member.
-  void set_should_run(bool should) { should_run_ = should; }
-
-  // Adds a TestInfo to this test case.  Will delete the TestInfo upon
-  // destruction of the TestCase object.
-  void AddTestInfo(TestInfo * test_info);
-
-  // Clears the results of all tests in this test case.
-  void ClearResult();
-
-  // Clears the results of all tests in the given test case.
-  static void ClearTestCaseResult(TestCase* test_case) {
-    test_case->ClearResult();
-  }
-
-  // Runs every test in this TestCase.
-  void Run();
-
-  // Returns true iff test passed.
-  static bool TestPassed(const TestInfo * test_info);
-
-  // Returns true iff test failed.
-  static bool TestFailed(const TestInfo * test_info);
-
-  // Returns true iff test is disabled.
-  static bool TestDisabled(const TestInfo * test_info);
-
-  // Returns true if the given test should run.
-  static bool ShouldRunTest(const TestInfo *test_info);
-
-  // Shuffles the tests in this test case.
-  void ShuffleTests(internal::Random* random);
-
-  // Restores the test order to before the first shuffle.
-  void UnshuffleTests();
-
-  // Name of the test case.
-  internal::String name_;
-  // Comment on the test case.
-  internal::String comment_;
-  // The vector of TestInfos in their original order.  It owns the
-  // elements in the vector.
-  const internal::scoped_ptr<internal::Vector<TestInfo*> > test_info_list_;
-  // Provides a level of indirection for the test list to allow easy
-  // shuffling and restoring the test order.  The i-th element in this
-  // vector is the index of the i-th test in the shuffled test list.
-  const internal::scoped_ptr<internal::Vector<int> > test_indices_;
-  // Pointer to the function that sets up the test case.
-  Test::SetUpTestCaseFunc set_up_tc_;
-  // Pointer to the function that tears down the test case.
-  Test::TearDownTestCaseFunc tear_down_tc_;
-  // True iff any test in this test case should run.
-  bool should_run_;
-  // Elapsed time, in milliseconds.
-  TimeInMillis elapsed_time_;
-
-  // We disallow copying TestCases.
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestCase);
-};
-
-// An Environment object is capable of setting up and tearing down an
-// environment.  The user should subclass this to define his own
-// environment(s).
-//
-// An Environment object does the set-up and tear-down in virtual
-// methods SetUp() and TearDown() instead of the constructor and the
-// destructor, as:
-//
-//   1. You cannot safely throw from a destructor.  This is a problem
-//      as in some cases Google Test is used where exceptions are enabled, and
-//      we may want to implement ASSERT_* using exceptions where they are
-//      available.
-//   2. You cannot use ASSERT_* directly in a constructor or
-//      destructor.
-class Environment {
- public:
-  // The d'tor is virtual as we need to subclass Environment.
-  virtual ~Environment() {}
-
-  // Override this to define how to set up the environment.
-  virtual void SetUp() {}
-
-  // Override this to define how to tear down the environment.
-  virtual void TearDown() {}
- private:
-  // If you see an error about overriding the following function or
-  // about it being private, you have mis-spelled SetUp() as Setup().
-  struct Setup_should_be_spelled_SetUp {};
-  virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
-};
-
-// The interface for tracing execution of tests. The methods are organized in
-// the order the corresponding events are fired.
-class TestEventListener {
- public:
-  virtual ~TestEventListener() {}
-
-  // Fired before any test activity starts.
-  virtual void OnTestProgramStart(const UnitTest& unit_test) = 0;
-
-  // Fired before each iteration of tests starts.  There may be more than
-  // one iteration if GTEST_FLAG(repeat) is set. iteration is the iteration
-  // index, starting from 0.
-  virtual void OnTestIterationStart(const UnitTest& unit_test,
-                                    int iteration) = 0;
-
-  // Fired before environment set-up for each iteration of tests starts.
-  virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) = 0;
-
-  // Fired after environment set-up for each iteration of tests ends.
-  virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) = 0;
-
-  // Fired before the test case starts.
-  virtual void OnTestCaseStart(const TestCase& test_case) = 0;
-
-  // Fired before the test starts.
-  virtual void OnTestStart(const TestInfo& test_info) = 0;
-
-  // Fired after a failed assertion or a SUCCESS().
-  virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0;
-
-  // Fired after the test ends.
-  virtual void OnTestEnd(const TestInfo& test_info) = 0;
-
-  // Fired after the test case ends.
-  virtual void OnTestCaseEnd(const TestCase& test_case) = 0;
-
-  // Fired before environment tear-down for each iteration of tests starts.
-  virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) = 0;
-
-  // Fired after environment tear-down for each iteration of tests ends.
-  virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0;
-
-  // Fired after each iteration of tests finishes.
-  virtual void OnTestIterationEnd(const UnitTest& unit_test,
-                                  int iteration) = 0;
-
-  // Fired after all test activities have ended.
-  virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0;
-};
-
-// The convenience class for users who need to override just one or two
-// methods and are not concerned that a possible change to a signature of
-// the methods they override will not be caught during the build.  For
-// comments about each method please see the definition of TestEventListener
-// above.
-class EmptyTestEventListener : public TestEventListener {
- public:
-  virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}
-  virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,
-                                    int /*iteration*/) {}
-  virtual void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) {}
-  virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {}
-  virtual void OnTestCaseStart(const TestCase& /*test_case*/) {}
-  virtual void OnTestStart(const TestInfo& /*test_info*/) {}
-  virtual void OnTestPartResult(const TestPartResult& /*test_part_result*/) {}
-  virtual void OnTestEnd(const TestInfo& /*test_info*/) {}
-  virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {}
-  virtual void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) {}
-  virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {}
-  virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/,
-                                  int /*iteration*/) {}
-  virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {}
-};
-
-// TestEventListeners lets users add listeners to track events in Google Test.
-class TestEventListeners {
- public:
-  TestEventListeners();
-  ~TestEventListeners();
-
-  // Appends an event listener to the end of the list. Google Test assumes
-  // the ownership of the listener (i.e. it will delete the listener when
-  // the test program finishes).
-  void Append(TestEventListener* listener);
-
-  // Removes the given event listener from the list and returns it.  It then
-  // becomes the caller's responsibility to delete the listener. Returns
-  // NULL if the listener is not found in the list.
-  TestEventListener* Release(TestEventListener* listener);
-
-  // Returns the standard listener responsible for the default console
-  // output.  Can be removed from the listeners list to shut down default
-  // console output.  Note that removing this object from the listener list
-  // with Release transfers its ownership to the caller and makes this
-  // function return NULL the next time.
-  TestEventListener* default_result_printer() const {
-    return default_result_printer_;
-  }
-
-  // Returns the standard listener responsible for the default XML output
-  // controlled by the --gtest_output=xml flag.  Can be removed from the
-  // listeners list by users who want to shut down the default XML output
-  // controlled by this flag and substitute it with custom one.  Note that
-  // removing this object from the listener list with Release transfers its
-  // ownership to the caller and makes this function return NULL the next
-  // time.
-  TestEventListener* default_xml_generator() const {
-    return default_xml_generator_;
-  }
-
- private:
-  friend class TestCase;
-  friend class internal::DefaultGlobalTestPartResultReporter;
-  friend class internal::NoExecDeathTest;
-  friend class internal::TestEventListenersAccessor;
-  friend class internal::TestInfoImpl;
-  friend class internal::UnitTestImpl;
-
-  // Returns repeater that broadcasts the TestEventListener events to all
-  // subscribers.
-  TestEventListener* repeater();
-
-  // Sets the default_result_printer attribute to the provided listener.
-  // The listener is also added to the listener list and previous
-  // default_result_printer is removed from it and deleted. The listener can
-  // also be NULL in which case it will not be added to the list. Does
-  // nothing if the previous and the current listener objects are the same.
-  void SetDefaultResultPrinter(TestEventListener* listener);
-
-  // Sets the default_xml_generator attribute to the provided listener.  The
-  // listener is also added to the listener list and previous
-  // default_xml_generator is removed from it and deleted. The listener can
-  // also be NULL in which case it will not be added to the list. Does
-  // nothing if the previous and the current listener objects are the same.
-  void SetDefaultXmlGenerator(TestEventListener* listener);
-
-  // Controls whether events will be forwarded by the repeater to the
-  // listeners in the list.
-  bool EventForwardingEnabled() const;
-  void SuppressEventForwarding();
-
-  // The actual list of listeners.
-  internal::TestEventRepeater* repeater_;
-  // Listener responsible for the standard result output.
-  TestEventListener* default_result_printer_;
-  // Listener responsible for the creation of the XML output file.
-  TestEventListener* default_xml_generator_;
-
-  // We disallow copying TestEventListeners.
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventListeners);
-};
-
-// A UnitTest consists of a vector of TestCases.
-//
-// This is a singleton class.  The only instance of UnitTest is
-// created when UnitTest::GetInstance() is first called.  This
-// instance is never deleted.
-//
-// UnitTest is not copyable.
-//
-// This class is thread-safe as long as the methods are called
-// according to their specification.
-class UnitTest {
- public:
-  // Gets the singleton UnitTest object.  The first time this method
-  // is called, a UnitTest object is constructed and returned.
-  // Consecutive calls will return the same object.
-  static UnitTest* GetInstance();
-
-  // Runs all tests in this UnitTest object and prints the result.
-  // Returns 0 if successful, or 1 otherwise.
-  //
-  // This method can only be called from the main thread.
-  //
-  // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-  int Run() GTEST_MUST_USE_RESULT_;
-
-  // Returns the working directory when the first TEST() or TEST_F()
-  // was executed.  The UnitTest object owns the string.
-  const char* original_working_dir() const;
-
-  // Returns the TestCase object for the test that's currently running,
-  // or NULL if no test is running.
-  const TestCase* current_test_case() const;
-
-  // Returns the TestInfo object for the test that's currently running,
-  // or NULL if no test is running.
-  const TestInfo* current_test_info() const;
-
-  // Returns the random seed used at the start of the current test run.
-  int random_seed() const;
-
-#if GTEST_HAS_PARAM_TEST
-  // Returns the ParameterizedTestCaseRegistry object used to keep track of
-  // value-parameterized tests and instantiate and register them.
-  //
-  // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-  internal::ParameterizedTestCaseRegistry& parameterized_test_registry();
-#endif  // GTEST_HAS_PARAM_TEST
-
-  // Gets the number of successful test cases.
-  int successful_test_case_count() const;
-
-  // Gets the number of failed test cases.
-  int failed_test_case_count() const;
-
-  // Gets the number of all test cases.
-  int total_test_case_count() const;
-
-  // Gets the number of all test cases that contain at least one test
-  // that should run.
-  int test_case_to_run_count() const;
-
-  // Gets the number of successful tests.
-  int successful_test_count() const;
-
-  // Gets the number of failed tests.
-  int failed_test_count() const;
-
-  // Gets the number of disabled tests.
-  int disabled_test_count() const;
-
-  // Gets the number of all tests.
-  int total_test_count() const;
-
-  // Gets the number of tests that should run.
-  int test_to_run_count() const;
-
-  // Gets the elapsed time, in milliseconds.
-  TimeInMillis elapsed_time() const;
-
-  // Returns true iff the unit test passed (i.e. all test cases passed).
-  bool Passed() const;
-
-  // Returns true iff the unit test failed (i.e. some test case failed
-  // or something outside of all tests failed).
-  bool Failed() const;
-
-  // Gets the i-th test case among all the test cases. i can range from 0 to
-  // total_test_case_count() - 1. If i is not in that range, returns NULL.
-  const TestCase* GetTestCase(int i) const;
-
-  // Returns the list of event listeners that can be used to track events
-  // inside Google Test.
-  TestEventListeners& listeners();
-
- private:
-  // Registers and returns a global test environment.  When a test
-  // program is run, all global test environments will be set-up in
-  // the order they were registered.  After all tests in the program
-  // have finished, all global test environments will be torn-down in
-  // the *reverse* order they were registered.
-  //
-  // The UnitTest object takes ownership of the given environment.
-  //
-  // This method can only be called from the main thread.
-  Environment* AddEnvironment(Environment* env);
-
-  // Adds a TestPartResult to the current TestResult object.  All
-  // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc)
-  // eventually call this to report their results.  The user code
-  // should use the assertion macros instead of calling this directly.
-  void AddTestPartResult(TestPartResult::Type result_type,
-                         const char* file_name,
-                         int line_number,
-                         const internal::String& message,
-                         const internal::String& os_stack_trace);
-
-  // Adds a TestProperty to the current TestResult object. If the result already
-  // contains a property with the same key, the value will be updated.
-  void RecordPropertyForCurrentTest(const char* key, const char* value);
-
-  // Gets the i-th test case among all the test cases. i can range from 0 to
-  // total_test_case_count() - 1. If i is not in that range, returns NULL.
-  TestCase* GetMutableTestCase(int i);
-
-  // Accessors for the implementation object.
-  internal::UnitTestImpl* impl() { return impl_; }
-  const internal::UnitTestImpl* impl() const { return impl_; }
-
-  // These classes and funcions are friends as they need to access private
-  // members of UnitTest.
-  friend class Test;
-  friend class internal::AssertHelper;
-  friend class internal::ScopedTrace;
-  friend Environment* AddGlobalTestEnvironment(Environment* env);
-  friend internal::UnitTestImpl* internal::GetUnitTestImpl();
-  friend void internal::ReportFailureInUnknownLocation(
-      TestPartResult::Type result_type,
-      const internal::String& message);
-
-  // Creates an empty UnitTest.
-  UnitTest();
-
-  // D'tor
-  virtual ~UnitTest();
-
-  // Pushes a trace defined by SCOPED_TRACE() on to the per-thread
-  // Google Test trace stack.
-  void PushGTestTrace(const internal::TraceInfo& trace);
-
-  // Pops a trace from the per-thread Google Test trace stack.
-  void PopGTestTrace();
-
-  // Protects mutable state in *impl_.  This is mutable as some const
-  // methods need to lock it too.
-  mutable internal::Mutex mutex_;
-
-  // Opaque implementation object.  This field is never changed once
-  // the object is constructed.  We don't mark it as const here, as
-  // doing so will cause a warning in the constructor of UnitTest.
-  // Mutable state in *impl_ is protected by mutex_.
-  internal::UnitTestImpl* impl_;
-
-  // We disallow copying UnitTest.
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTest);
-};
-
-// A convenient wrapper for adding an environment for the test
-// program.
-//
-// You should call this before RUN_ALL_TESTS() is called, probably in
-// main().  If you use gtest_main, you need to call this before main()
-// starts for it to take effect.  For example, you can define a global
-// variable like this:
-//
-//   testing::Environment* const foo_env =
-//       testing::AddGlobalTestEnvironment(new FooEnvironment);
-//
-// However, we strongly recommend you to write your own main() and
-// call AddGlobalTestEnvironment() there, as relying on initialization
-// of global variables makes the code harder to read and may cause
-// problems when you register multiple environments from different
-// translation units and the environments have dependencies among them
-// (remember that the compiler doesn't guarantee the order in which
-// global variables from different translation units are initialized).
-inline Environment* AddGlobalTestEnvironment(Environment* env) {
-  return UnitTest::GetInstance()->AddEnvironment(env);
-}
-
-// Initializes Google Test.  This must be called before calling
-// RUN_ALL_TESTS().  In particular, it parses a command line for the
-// flags that Google Test recognizes.  Whenever a Google Test flag is
-// seen, it is removed from argv, and *argc is decremented.
-//
-// No value is returned.  Instead, the Google Test flag variables are
-// updated.
-//
-// Calling the function for the second time has no user-visible effect.
-void InitGoogleTest(int* argc, char** argv);
-
-// This overloaded version can be used in Windows programs compiled in
-// UNICODE mode.
-void InitGoogleTest(int* argc, wchar_t** argv);
-
-namespace internal {
-
-// These overloaded versions handle ::std::string and ::std::wstring.
-#if GTEST_HAS_STD_STRING
-inline String FormatForFailureMessage(const ::std::string& str) {
-  return (Message() << '"' << str << '"').GetString();
-}
-#endif  // GTEST_HAS_STD_STRING
-
-#if GTEST_HAS_STD_WSTRING
-inline String FormatForFailureMessage(const ::std::wstring& wstr) {
-  return (Message() << "L\"" << wstr << '"').GetString();
-}
-#endif  // GTEST_HAS_STD_WSTRING
-
-// These overloaded versions handle ::string and ::wstring.
-#if GTEST_HAS_GLOBAL_STRING
-inline String FormatForFailureMessage(const ::string& str) {
-  return (Message() << '"' << str << '"').GetString();
-}
-#endif  // GTEST_HAS_GLOBAL_STRING
-
-#if GTEST_HAS_GLOBAL_WSTRING
-inline String FormatForFailureMessage(const ::wstring& wstr) {
-  return (Message() << "L\"" << wstr << '"').GetString();
-}
-#endif  // GTEST_HAS_GLOBAL_WSTRING
-
-// Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc)
-// operand to be used in a failure message.  The type (but not value)
-// of the other operand may affect the format.  This allows us to
-// print a char* as a raw pointer when it is compared against another
-// char*, and print it as a C string when it is compared against an
-// std::string object, for example.
-//
-// The default implementation ignores the type of the other operand.
-// Some specialized versions are used to handle formatting wide or
-// narrow C strings.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-template <typename T1, typename T2>
-String FormatForComparisonFailureMessage(const T1& value,
-                                         const T2& /* other_operand */) {
-  return FormatForFailureMessage(value);
-}
-
-// The helper function for {ASSERT|EXPECT}_EQ.
-template <typename T1, typename T2>
-AssertionResult CmpHelperEQ(const char* expected_expression,
-                            const char* actual_expression,
-                            const T1& expected,
-                            const T2& actual) {
-#ifdef _MSC_VER
-#pragma warning(push)          // Saves the current warning state.
-#pragma warning(disable:4389)  // Temporarily disables warning on
-                               // signed/unsigned mismatch.
-#endif
-
-  if (expected == actual) {
-    return AssertionSuccess();
-  }
-
-#ifdef _MSC_VER
-#pragma warning(pop)          // Restores the warning state.
-#endif
-
-  return EqFailure(expected_expression,
-                   actual_expression,
-                   FormatForComparisonFailureMessage(expected, actual),
-                   FormatForComparisonFailureMessage(actual, expected),
-                   false);
-}
-
-// With this overloaded version, we allow anonymous enums to be used
-// in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums
-// can be implicitly cast to BiggestInt.
-AssertionResult CmpHelperEQ(const char* expected_expression,
-                            const char* actual_expression,
-                            BiggestInt expected,
-                            BiggestInt actual);
-
-// The helper class for {ASSERT|EXPECT}_EQ.  The template argument
-// lhs_is_null_literal is true iff the first argument to ASSERT_EQ()
-// is a null pointer literal.  The following default implementation is
-// for lhs_is_null_literal being false.
-template <bool lhs_is_null_literal>
-class EqHelper {
- public:
-  // This templatized version is for the general case.
-  template <typename T1, typename T2>
-  static AssertionResult Compare(const char* expected_expression,
-                                 const char* actual_expression,
-                                 const T1& expected,
-                                 const T2& actual) {
-    return CmpHelperEQ(expected_expression, actual_expression, expected,
-                       actual);
-  }
-
-  // With this overloaded version, we allow anonymous enums to be used
-  // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous
-  // enums can be implicitly cast to BiggestInt.
-  //
-  // Even though its body looks the same as the above version, we
-  // cannot merge the two, as it will make anonymous enums unhappy.
-  static AssertionResult Compare(const char* expected_expression,
-                                 const char* actual_expression,
-                                 BiggestInt expected,
-                                 BiggestInt actual) {
-    return CmpHelperEQ(expected_expression, actual_expression, expected,
-                       actual);
-  }
-};
-
-// This specialization is used when the first argument to ASSERT_EQ()
-// is a null pointer literal.
-template <>
-class EqHelper<true> {
- public:
-  // We define two overloaded versions of Compare().  The first
-  // version will be picked when the second argument to ASSERT_EQ() is
-  // NOT a pointer, e.g. ASSERT_EQ(0, AnIntFunction()) or
-  // EXPECT_EQ(false, a_bool).
-  template <typename T1, typename T2>
-  static AssertionResult Compare(const char* expected_expression,
-                                 const char* actual_expression,
-                                 const T1& expected,
-                                 const T2& actual) {
-    return CmpHelperEQ(expected_expression, actual_expression, expected,
-                       actual);
-  }
-
-  // This version will be picked when the second argument to
-  // ASSERT_EQ() is a pointer, e.g. ASSERT_EQ(NULL, a_pointer).
-  template <typename T1, typename T2>
-  static AssertionResult Compare(const char* expected_expression,
-                                 const char* actual_expression,
-                                 const T1& /* expected */,
-                                 T2* actual) {
-    // We already know that 'expected' is a null pointer.
-    return CmpHelperEQ(expected_expression, actual_expression,
-                       static_cast<T2*>(NULL), actual);
-  }
-};
-
-// A macro for implementing the helper functions needed to implement
-// ASSERT_?? and EXPECT_??.  It is here just to avoid copy-and-paste
-// of similar code.
-//
-// For each templatized helper function, we also define an overloaded
-// version for BiggestInt in order to reduce code bloat and allow
-// anonymous enums to be used with {ASSERT|EXPECT}_?? when compiled
-// with gcc 4.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-#define GTEST_IMPL_CMP_HELPER_(op_name, op)\
-template <typename T1, typename T2>\
-AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
-                                   const T1& val1, const T2& val2) {\
-  if (val1 op val2) {\
-    return AssertionSuccess();\
-  } else {\
-    Message msg;\
-    msg << "Expected: (" << expr1 << ") " #op " (" << expr2\
-        << "), actual: " << FormatForComparisonFailureMessage(val1, val2)\
-        << " vs " << FormatForComparisonFailureMessage(val2, val1);\
-    return AssertionFailure(msg);\
-  }\
-}\
-AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
-                                   BiggestInt val1, BiggestInt val2);
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-
-// Implements the helper function for {ASSERT|EXPECT}_NE
-GTEST_IMPL_CMP_HELPER_(NE, !=)
-// Implements the helper function for {ASSERT|EXPECT}_LE
-GTEST_IMPL_CMP_HELPER_(LE, <=)
-// Implements the helper function for {ASSERT|EXPECT}_LT
-GTEST_IMPL_CMP_HELPER_(LT, < )
-// Implements the helper function for {ASSERT|EXPECT}_GE
-GTEST_IMPL_CMP_HELPER_(GE, >=)
-// Implements the helper function for {ASSERT|EXPECT}_GT
-GTEST_IMPL_CMP_HELPER_(GT, > )
-
-#undef GTEST_IMPL_CMP_HELPER_
-
-// The helper function for {ASSERT|EXPECT}_STREQ.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-AssertionResult CmpHelperSTREQ(const char* expected_expression,
-                               const char* actual_expression,
-                               const char* expected,
-                               const char* actual);
-
-// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
-                                   const char* actual_expression,
-                                   const char* expected,
-                                   const char* actual);
-
-// The helper function for {ASSERT|EXPECT}_STRNE.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-AssertionResult CmpHelperSTRNE(const char* s1_expression,
-                               const char* s2_expression,
-                               const char* s1,
-                               const char* s2);
-
-// The helper function for {ASSERT|EXPECT}_STRCASENE.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
-                                   const char* s2_expression,
-                                   const char* s1,
-                                   const char* s2);
-
-
-// Helper function for *_STREQ on wide strings.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-AssertionResult CmpHelperSTREQ(const char* expected_expression,
-                               const char* actual_expression,
-                               const wchar_t* expected,
-                               const wchar_t* actual);
-
-// Helper function for *_STRNE on wide strings.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-AssertionResult CmpHelperSTRNE(const char* s1_expression,
-                               const char* s2_expression,
-                               const wchar_t* s1,
-                               const wchar_t* s2);
-
-}  // namespace internal
-
-// IsSubstring() and IsNotSubstring() are intended to be used as the
-// first argument to {EXPECT,ASSERT}_PRED_FORMAT2(), not by
-// themselves.  They check whether needle is a substring of haystack
-// (NULL is considered a substring of itself only), and return an
-// appropriate error message when they fail.
-//
-// The {needle,haystack}_expr arguments are the stringified
-// expressions that generated the two real arguments.
-AssertionResult IsSubstring(
-    const char* needle_expr, const char* haystack_expr,
-    const char* needle, const char* haystack);
-AssertionResult IsSubstring(
-    const char* needle_expr, const char* haystack_expr,
-    const wchar_t* needle, const wchar_t* haystack);
-AssertionResult IsNotSubstring(
-    const char* needle_expr, const char* haystack_expr,
-    const char* needle, const char* haystack);
-AssertionResult IsNotSubstring(
-    const char* needle_expr, const char* haystack_expr,
-    const wchar_t* needle, const wchar_t* haystack);
-#if GTEST_HAS_STD_STRING
-AssertionResult IsSubstring(
-    const char* needle_expr, const char* haystack_expr,
-    const ::std::string& needle, const ::std::string& haystack);
-AssertionResult IsNotSubstring(
-    const char* needle_expr, const char* haystack_expr,
-    const ::std::string& needle, const ::std::string& haystack);
-#endif  // GTEST_HAS_STD_STRING
-
-#if GTEST_HAS_STD_WSTRING
-AssertionResult IsSubstring(
-    const char* needle_expr, const char* haystack_expr,
-    const ::std::wstring& needle, const ::std::wstring& haystack);
-AssertionResult IsNotSubstring(
-    const char* needle_expr, const char* haystack_expr,
-    const ::std::wstring& needle, const ::std::wstring& haystack);
-#endif  // GTEST_HAS_STD_WSTRING
-
-namespace internal {
-
-// Helper template function for comparing floating-points.
-//
-// Template parameter:
-//
-//   RawType: the raw floating-point type (either float or double)
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-template <typename RawType>
-AssertionResult CmpHelperFloatingPointEQ(const char* expected_expression,
-                                         const char* actual_expression,
-                                         RawType expected,
-                                         RawType actual) {
-  const FloatingPoint<RawType> lhs(expected), rhs(actual);
-
-  if (lhs.AlmostEquals(rhs)) {
-    return AssertionSuccess();
-  }
-
-  StrStream expected_ss;
-  expected_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
-              << expected;
-
-  StrStream actual_ss;
-  actual_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
-            << actual;
-
-  return EqFailure(expected_expression,
-                   actual_expression,
-                   StrStreamToString(&expected_ss),
-                   StrStreamToString(&actual_ss),
-                   false);
-}
-
-// Helper function for implementing ASSERT_NEAR.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-AssertionResult DoubleNearPredFormat(const char* expr1,
-                                     const char* expr2,
-                                     const char* abs_error_expr,
-                                     double val1,
-                                     double val2,
-                                     double abs_error);
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-// A class that enables one to stream messages to assertion macros
-class AssertHelper {
- public:
-  // Constructor.
-  AssertHelper(TestPartResult::Type type,
-               const char* file,
-               int line,
-               const char* message);
-  ~AssertHelper();
-
-  // Message assignment is a semantic trick to enable assertion
-  // streaming; see the GTEST_MESSAGE_ macro below.
-  void operator=(const Message& message) const;
-
- private:
-  // We put our data in a struct so that the size of the AssertHelper class can
-  // be as small as possible.  This is important because gcc is incapable of
-  // re-using stack space even for temporary variables, so every EXPECT_EQ
-  // reserves stack space for another AssertHelper.
-  struct AssertHelperData {
-    AssertHelperData(TestPartResult::Type t,
-                     const char* srcfile,
-                     int line_num,
-                     const char* msg)
-        : type(t), file(srcfile), line(line_num), message(msg) { }
-
-    TestPartResult::Type const type;
-    const char*        const file;
-    int                const line;
-    String             const message;
-
-   private:
-    GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData);
-  };
-
-  AssertHelperData* const data_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper);
-};
-
-}  // namespace internal
-
-#if GTEST_HAS_PARAM_TEST
-// The abstract base class that all value-parameterized tests inherit from.
-//
-// This class adds support for accessing the test parameter value via
-// the GetParam() method.
-//
-// Use it with one of the parameter generator defining functions, like Range(),
-// Values(), ValuesIn(), Bool(), and Combine().
-//
-// class FooTest : public ::testing::TestWithParam<int> {
-//  protected:
-//   FooTest() {
-//     // Can use GetParam() here.
-//   }
-//   virtual ~FooTest() {
-//     // Can use GetParam() here.
-//   }
-//   virtual void SetUp() {
-//     // Can use GetParam() here.
-//   }
-//   virtual void TearDown {
-//     // Can use GetParam() here.
-//   }
-// };
-// TEST_P(FooTest, DoesBar) {
-//   // Can use GetParam() method here.
-//   Foo foo;
-//   ASSERT_TRUE(foo.DoesBar(GetParam()));
-// }
-// INSTANTIATE_TEST_CASE_P(OneToTenRange, FooTest, ::testing::Range(1, 10));
-
-template <typename T>
-class TestWithParam : public Test {
- public:
-  typedef T ParamType;
-
-  // The current parameter value. Is also available in the test fixture's
-  // constructor.
-  const ParamType& GetParam() const { return *parameter_; }
-
- private:
-  // Sets parameter value. The caller is responsible for making sure the value
-  // remains alive and unchanged throughout the current test.
-  static void SetParam(const ParamType* parameter) {
-    parameter_ = parameter;
-  }
-
-  // Static value used for accessing parameter during a test lifetime.
-  static const ParamType* parameter_;
-
-  // TestClass must be a subclass of TestWithParam<T>.
-  template <class TestClass> friend class internal::ParameterizedTestFactory;
-};
-
-template <typename T>
-const T* TestWithParam<T>::parameter_ = NULL;
-
-#endif  // GTEST_HAS_PARAM_TEST
-
-// Macros for indicating success/failure in test code.
-
-// ADD_FAILURE unconditionally adds a failure to the current test.
-// SUCCEED generates a success - it doesn't automatically make the
-// current test successful, as a test is only successful when it has
-// no failure.
-//
-// EXPECT_* verifies that a certain condition is satisfied.  If not,
-// it behaves like ADD_FAILURE.  In particular:
-//
-//   EXPECT_TRUE  verifies that a Boolean condition is true.
-//   EXPECT_FALSE verifies that a Boolean condition is false.
-//
-// FAIL and ASSERT_* are similar to ADD_FAILURE and EXPECT_*, except
-// that they will also abort the current function on failure.  People
-// usually want the fail-fast behavior of FAIL and ASSERT_*, but those
-// writing data-driven tests often find themselves using ADD_FAILURE
-// and EXPECT_* more.
-//
-// Examples:
-//
-//   EXPECT_TRUE(server.StatusIsOK());
-//   ASSERT_FALSE(server.HasPendingRequest(port))
-//       << "There are still pending requests " << "on port " << port;
-
-// Generates a nonfatal failure with a generic message.
-#define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed")
-
-// Generates a fatal failure with a generic message.
-#define FAIL() GTEST_FATAL_FAILURE_("Failed")
-
-// Generates a success with a generic message.
-#define SUCCEED() GTEST_SUCCESS_("Succeeded")
-
-// Macros for testing exceptions.
-//
-//    * {ASSERT|EXPECT}_THROW(statement, expected_exception):
-//         Tests that the statement throws the expected exception.
-//    * {ASSERT|EXPECT}_NO_THROW(statement):
-//         Tests that the statement doesn't throw any exception.
-//    * {ASSERT|EXPECT}_ANY_THROW(statement):
-//         Tests that the statement throws an exception.
-
-#define EXPECT_THROW(statement, expected_exception) \
-  GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_NO_THROW(statement) \
-  GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_ANY_THROW(statement) \
-  GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_THROW(statement, expected_exception) \
-  GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_)
-#define ASSERT_NO_THROW(statement) \
-  GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_)
-#define ASSERT_ANY_THROW(statement) \
-  GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_)
-
-// Boolean assertions. Condition can be either a Boolean expression or an
-// AssertionResult. For more information on how to use AssertionResult with
-// these macros see comments on that class.
-#define EXPECT_TRUE(condition) \
-  GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
-                      GTEST_NONFATAL_FAILURE_)
-#define EXPECT_FALSE(condition) \
-  GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
-                      GTEST_NONFATAL_FAILURE_)
-#define ASSERT_TRUE(condition) \
-  GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
-                      GTEST_FATAL_FAILURE_)
-#define ASSERT_FALSE(condition) \
-  GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
-                      GTEST_FATAL_FAILURE_)
-
-// Includes the auto-generated header that implements a family of
-// generic predicate assertion macros.
-#include <gtest/gtest_pred_impl.h>
-
-// Macros for testing equalities and inequalities.
-//
-//    * {ASSERT|EXPECT}_EQ(expected, actual): Tests that expected == actual
-//    * {ASSERT|EXPECT}_NE(v1, v2):           Tests that v1 != v2
-//    * {ASSERT|EXPECT}_LT(v1, v2):           Tests that v1 < v2
-//    * {ASSERT|EXPECT}_LE(v1, v2):           Tests that v1 <= v2
-//    * {ASSERT|EXPECT}_GT(v1, v2):           Tests that v1 > v2
-//    * {ASSERT|EXPECT}_GE(v1, v2):           Tests that v1 >= v2
-//
-// When they are not, Google Test prints both the tested expressions and
-// their actual values.  The values must be compatible built-in types,
-// or you will get a compiler error.  By "compatible" we mean that the
-// values can be compared by the respective operator.
-//
-// Note:
-//
-//   1. It is possible to make a user-defined type work with
-//   {ASSERT|EXPECT}_??(), but that requires overloading the
-//   comparison operators and is thus discouraged by the Google C++
-//   Usage Guide.  Therefore, you are advised to use the
-//   {ASSERT|EXPECT}_TRUE() macro to assert that two objects are
-//   equal.
-//
-//   2. The {ASSERT|EXPECT}_??() macros do pointer comparisons on
-//   pointers (in particular, C strings).  Therefore, if you use it
-//   with two C strings, you are testing how their locations in memory
-//   are related, not how their content is related.  To compare two C
-//   strings by content, use {ASSERT|EXPECT}_STR*().
-//
-//   3. {ASSERT|EXPECT}_EQ(expected, actual) is preferred to
-//   {ASSERT|EXPECT}_TRUE(expected == actual), as the former tells you
-//   what the actual value is when it fails, and similarly for the
-//   other comparisons.
-//
-//   4. Do not depend on the order in which {ASSERT|EXPECT}_??()
-//   evaluate their arguments, which is undefined.
-//
-//   5. These macros evaluate their arguments exactly once.
-//
-// Examples:
-//
-//   EXPECT_NE(5, Foo());
-//   EXPECT_EQ(NULL, a_pointer);
-//   ASSERT_LT(i, array_size);
-//   ASSERT_GT(records.size(), 0) << "There is no record left.";
-
-#define EXPECT_EQ(expected, actual) \
-  EXPECT_PRED_FORMAT2(::testing::internal:: \
-                      EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \
-                      expected, actual)
-#define EXPECT_NE(expected, actual) \
-  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, expected, actual)
-#define EXPECT_LE(val1, val2) \
-  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
-#define EXPECT_LT(val1, val2) \
-  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
-#define EXPECT_GE(val1, val2) \
-  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
-#define EXPECT_GT(val1, val2) \
-  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
-
-#define ASSERT_EQ(expected, actual) \
-  ASSERT_PRED_FORMAT2(::testing::internal:: \
-                      EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \
-                      expected, actual)
-#define ASSERT_NE(val1, val2) \
-  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
-#define ASSERT_LE(val1, val2) \
-  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
-#define ASSERT_LT(val1, val2) \
-  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
-#define ASSERT_GE(val1, val2) \
-  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
-#define ASSERT_GT(val1, val2) \
-  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
-
-// C String Comparisons.  All tests treat NULL and any non-NULL string
-// as different.  Two NULLs are equal.
-//
-//    * {ASSERT|EXPECT}_STREQ(s1, s2):     Tests that s1 == s2
-//    * {ASSERT|EXPECT}_STRNE(s1, s2):     Tests that s1 != s2
-//    * {ASSERT|EXPECT}_STRCASEEQ(s1, s2): Tests that s1 == s2, ignoring case
-//    * {ASSERT|EXPECT}_STRCASENE(s1, s2): Tests that s1 != s2, ignoring case
-//
-// For wide or narrow string objects, you can use the
-// {ASSERT|EXPECT}_??() macros.
-//
-// Don't depend on the order in which the arguments are evaluated,
-// which is undefined.
-//
-// These macros evaluate their arguments exactly once.
-
-#define EXPECT_STREQ(expected, actual) \
-  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)
-#define EXPECT_STRNE(s1, s2) \
-  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
-#define EXPECT_STRCASEEQ(expected, actual) \
-  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)
-#define EXPECT_STRCASENE(s1, s2)\
-  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
-
-#define ASSERT_STREQ(expected, actual) \
-  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)
-#define ASSERT_STRNE(s1, s2) \
-  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
-#define ASSERT_STRCASEEQ(expected, actual) \
-  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)
-#define ASSERT_STRCASENE(s1, s2)\
-  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
-
-// Macros for comparing floating-point numbers.
-//
-//    * {ASSERT|EXPECT}_FLOAT_EQ(expected, actual):
-//         Tests that two float values are almost equal.
-//    * {ASSERT|EXPECT}_DOUBLE_EQ(expected, actual):
-//         Tests that two double values are almost equal.
-//    * {ASSERT|EXPECT}_NEAR(v1, v2, abs_error):
-//         Tests that v1 and v2 are within the given distance to each other.
-//
-// Google Test uses ULP-based comparison to automatically pick a default
-// error bound that is appropriate for the operands.  See the
-// FloatingPoint template class in gtest-internal.h if you are
-// interested in the implementation details.
-
-#define EXPECT_FLOAT_EQ(expected, actual)\
-  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
-                      expected, actual)
-
-#define EXPECT_DOUBLE_EQ(expected, actual)\
-  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
-                      expected, actual)
-
-#define ASSERT_FLOAT_EQ(expected, actual)\
-  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
-                      expected, actual)
-
-#define ASSERT_DOUBLE_EQ(expected, actual)\
-  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
-                      expected, actual)
-
-#define EXPECT_NEAR(val1, val2, abs_error)\
-  EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
-                      val1, val2, abs_error)
-
-#define ASSERT_NEAR(val1, val2, abs_error)\
-  ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
-                      val1, val2, abs_error)
-
-// These predicate format functions work on floating-point values, and
-// can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g.
-//
-//   EXPECT_PRED_FORMAT2(testing::DoubleLE, Foo(), 5.0);
-
-// Asserts that val1 is less than, or almost equal to, val2.  Fails
-// otherwise.  In particular, it fails if either val1 or val2 is NaN.
-AssertionResult FloatLE(const char* expr1, const char* expr2,
-                        float val1, float val2);
-AssertionResult DoubleLE(const char* expr1, const char* expr2,
-                         double val1, double val2);
-
-
-#if GTEST_OS_WINDOWS
-
-// Macros that test for HRESULT failure and success, these are only useful
-// on Windows, and rely on Windows SDK macros and APIs to compile.
-//
-//    * {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}(expr)
-//
-// When expr unexpectedly fails or succeeds, Google Test prints the
-// expected result and the actual result with both a human-readable
-// string representation of the error, if available, as well as the
-// hex result code.
-#define EXPECT_HRESULT_SUCCEEDED(expr) \
-    EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
-
-#define ASSERT_HRESULT_SUCCEEDED(expr) \
-    ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
-
-#define EXPECT_HRESULT_FAILED(expr) \
-    EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
-
-#define ASSERT_HRESULT_FAILED(expr) \
-    ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
-
-#endif  // GTEST_OS_WINDOWS
-
-// Macros that execute statement and check that it doesn't generate new fatal
-// failures in the current thread.
-//
-//   * {ASSERT|EXPECT}_NO_FATAL_FAILURE(statement);
-//
-// Examples:
-//
-//   EXPECT_NO_FATAL_FAILURE(Process());
-//   ASSERT_NO_FATAL_FAILURE(Process()) << "Process() failed";
-//
-#define ASSERT_NO_FATAL_FAILURE(statement) \
-    GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)
-#define EXPECT_NO_FATAL_FAILURE(statement) \
-    GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
-
-// Causes a trace (including the source file path, the current line
-// number, and the given message) to be included in every test failure
-// message generated by code in the current scope.  The effect is
-// undone when the control leaves the current scope.
-//
-// The message argument can be anything streamable to std::ostream.
-//
-// In the implementation, we include the current line number as part
-// of the dummy variable name, thus allowing multiple SCOPED_TRACE()s
-// to appear in the same block - as long as they are on different
-// lines.
-#define SCOPED_TRACE(message) \
-  ::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
-    __FILE__, __LINE__, ::testing::Message() << (message))
-
-namespace internal {
-
-// This template is declared, but intentionally undefined.
-template <typename T1, typename T2>
-struct StaticAssertTypeEqHelper;
-
-template <typename T>
-struct StaticAssertTypeEqHelper<T, T> {};
-
-}  // namespace internal
-
-// Compile-time assertion for type equality.
-// StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are
-// the same type.  The value it returns is not interesting.
-//
-// Instead of making StaticAssertTypeEq a class template, we make it a
-// function template that invokes a helper class template.  This
-// prevents a user from misusing StaticAssertTypeEq<T1, T2> by
-// defining objects of that type.
-//
-// CAVEAT:
-//
-// When used inside a method of a class template,
-// StaticAssertTypeEq<T1, T2>() is effective ONLY IF the method is
-// instantiated.  For example, given:
-//
-//   template <typename T> class Foo {
-//    public:
-//     void Bar() { testing::StaticAssertTypeEq<int, T>(); }
-//   };
-//
-// the code:
-//
-//   void Test1() { Foo<bool> foo; }
-//
-// will NOT generate a compiler error, as Foo<bool>::Bar() is never
-// actually instantiated.  Instead, you need:
-//
-//   void Test2() { Foo<bool> foo; foo.Bar(); }
-//
-// to cause a compiler error.
-template <typename T1, typename T2>
-bool StaticAssertTypeEq() {
-  internal::StaticAssertTypeEqHelper<T1, T2>();
-  return true;
-}
-
-// Defines a test.
-//
-// The first parameter is the name of the test case, and the second
-// parameter is the name of the test within the test case.
-//
-// The convention is to end the test case name with "Test".  For
-// example, a test case for the Foo class can be named FooTest.
-//
-// The user should put his test code between braces after using this
-// macro.  Example:
-//
-//   TEST(FooTest, InitializesCorrectly) {
-//     Foo foo;
-//     EXPECT_TRUE(foo.StatusIsOK());
-//   }
-
-// Note that we call GetTestTypeId() instead of GetTypeId<
-// ::testing::Test>() here to get the type ID of testing::Test.  This
-// is to work around a suspected linker bug when using Google Test as
-// a framework on Mac OS X.  The bug causes GetTypeId<
-// ::testing::Test>() to return different values depending on whether
-// the call is from the Google Test framework itself or from user test
-// code.  GetTestTypeId() is guaranteed to always return the same
-// value, as it always calls GetTypeId<>() from the Google Test
-// framework.
-#define TEST(test_case_name, test_name)\
-  GTEST_TEST_(test_case_name, test_name, \
-              ::testing::Test, ::testing::internal::GetTestTypeId())
-
-
-// Defines a test that uses a test fixture.
-//
-// The first parameter is the name of the test fixture class, which
-// also doubles as the test case name.  The second parameter is the
-// name of the test within the test case.
-//
-// A test fixture class must be declared earlier.  The user should put
-// his test code between braces after using this macro.  Example:
-//
-//   class FooTest : public testing::Test {
-//    protected:
-//     virtual void SetUp() { b_.AddElement(3); }
-//
-//     Foo a_;
-//     Foo b_;
-//   };
-//
-//   TEST_F(FooTest, InitializesCorrectly) {
-//     EXPECT_TRUE(a_.StatusIsOK());
-//   }
-//
-//   TEST_F(FooTest, ReturnsElementCountCorrectly) {
-//     EXPECT_EQ(0, a_.size());
-//     EXPECT_EQ(1, b_.size());
-//   }
-
-#define TEST_F(test_fixture, test_name)\
-  GTEST_TEST_(test_fixture, test_name, test_fixture, \
-              ::testing::internal::GetTypeId<test_fixture>())
-
-// Use this macro in main() to run all tests.  It returns 0 if all
-// tests are successful, or 1 otherwise.
-//
-// RUN_ALL_TESTS() should be invoked after the command line has been
-// parsed by InitGoogleTest().
-
-#define RUN_ALL_TESTS()\
-  (::testing::UnitTest::GetInstance()->Run())
-
-}  // namespace testing
-
-#endif  // GTEST_INCLUDE_GTEST_GTEST_H_
diff --git a/third_party/gtest/include/gtest/gtest_pred_impl.h b/third_party/gtest/include/gtest/gtest_pred_impl.h
deleted file mode 100644
index e1e2f8c..0000000
--- a/third_party/gtest/include/gtest/gtest_pred_impl.h
+++ /dev/null
@@ -1,368 +0,0 @@
-// Copyright 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// This file is AUTOMATICALLY GENERATED on 10/02/2008 by command
-// 'gen_gtest_pred_impl.py 5'.  DO NOT EDIT BY HAND!
-//
-// Implements a family of generic predicate assertion macros.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
-#define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
-
-// Makes sure this header is not included before gtest.h.
-#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
-#error Do not include gtest_pred_impl.h directly.  Include gtest.h instead.
-#endif  // GTEST_INCLUDE_GTEST_GTEST_H_
-
-// This header implements a family of generic predicate assertion
-// macros:
-//
-//   ASSERT_PRED_FORMAT1(pred_format, v1)
-//   ASSERT_PRED_FORMAT2(pred_format, v1, v2)
-//   ...
-//
-// where pred_format is a function or functor that takes n (in the
-// case of ASSERT_PRED_FORMATn) values and their source expression
-// text, and returns a testing::AssertionResult.  See the definition
-// of ASSERT_EQ in gtest.h for an example.
-//
-// If you don't care about formatting, you can use the more
-// restrictive version:
-//
-//   ASSERT_PRED1(pred, v1)
-//   ASSERT_PRED2(pred, v1, v2)
-//   ...
-//
-// where pred is an n-ary function or functor that returns bool,
-// and the values v1, v2, ..., must support the << operator for
-// streaming to std::ostream.
-//
-// We also define the EXPECT_* variations.
-//
-// For now we only support predicates whose arity is at most 5.
-// Please email googletestframework@googlegroups.com if you need
-// support for higher arities.
-
-// GTEST_ASSERT_ is the basic statement to which all of the assertions
-// in this file reduce.  Don't use this in your code.
-
-#define GTEST_ASSERT_(expression, on_failure) \
-  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
-  if (const ::testing::AssertionResult gtest_ar = (expression)) \
-    ; \
-  else \
-    on_failure(gtest_ar.failure_message())
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED1.  Don't use
-// this in your code.
-template <typename Pred,
-          typename T1>
-AssertionResult AssertPred1Helper(const char* pred_text,
-                                  const char* e1,
-                                  Pred pred,
-                                  const T1& v1) {
-  if (pred(v1)) return AssertionSuccess();
-
-  Message msg;
-  msg << pred_text << "("
-      << e1 << ") evaluates to false, where"
-      << "\n" << e1 << " evaluates to " << v1;
-  return AssertionFailure(msg);
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\
-  GTEST_ASSERT_(pred_format(#v1, v1),\
-                on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED1.  Don't use
-// this in your code.
-#define GTEST_PRED1_(pred, v1, on_failure)\
-  GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \
-                                             #v1, \
-                                             pred, \
-                                             v1), on_failure)
-
-// Unary predicate assertion macros.
-#define EXPECT_PRED_FORMAT1(pred_format, v1) \
-  GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED1(pred, v1) \
-  GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT1(pred_format, v1) \
-  GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED1(pred, v1) \
-  GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_)
-
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED2.  Don't use
-// this in your code.
-template <typename Pred,
-          typename T1,
-          typename T2>
-AssertionResult AssertPred2Helper(const char* pred_text,
-                                  const char* e1,
-                                  const char* e2,
-                                  Pred pred,
-                                  const T1& v1,
-                                  const T2& v2) {
-  if (pred(v1, v2)) return AssertionSuccess();
-
-  Message msg;
-  msg << pred_text << "("
-      << e1 << ", "
-      << e2 << ") evaluates to false, where"
-      << "\n" << e1 << " evaluates to " << v1
-      << "\n" << e2 << " evaluates to " << v2;
-  return AssertionFailure(msg);
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
-  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2),\
-                on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED2.  Don't use
-// this in your code.
-#define GTEST_PRED2_(pred, v1, v2, on_failure)\
-  GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \
-                                             #v1, \
-                                             #v2, \
-                                             pred, \
-                                             v1, \
-                                             v2), on_failure)
-
-// Binary predicate assertion macros.
-#define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \
-  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED2(pred, v1, v2) \
-  GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \
-  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED2(pred, v1, v2) \
-  GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_)
-
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED3.  Don't use
-// this in your code.
-template <typename Pred,
-          typename T1,
-          typename T2,
-          typename T3>
-AssertionResult AssertPred3Helper(const char* pred_text,
-                                  const char* e1,
-                                  const char* e2,
-                                  const char* e3,
-                                  Pred pred,
-                                  const T1& v1,
-                                  const T2& v2,
-                                  const T3& v3) {
-  if (pred(v1, v2, v3)) return AssertionSuccess();
-
-  Message msg;
-  msg << pred_text << "("
-      << e1 << ", "
-      << e2 << ", "
-      << e3 << ") evaluates to false, where"
-      << "\n" << e1 << " evaluates to " << v1
-      << "\n" << e2 << " evaluates to " << v2
-      << "\n" << e3 << " evaluates to " << v3;
-  return AssertionFailure(msg);
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\
-  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3),\
-                on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED3.  Don't use
-// this in your code.
-#define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\
-  GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \
-                                             #v1, \
-                                             #v2, \
-                                             #v3, \
-                                             pred, \
-                                             v1, \
-                                             v2, \
-                                             v3), on_failure)
-
-// Ternary predicate assertion macros.
-#define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \
-  GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED3(pred, v1, v2, v3) \
-  GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \
-  GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED3(pred, v1, v2, v3) \
-  GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_)
-
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED4.  Don't use
-// this in your code.
-template <typename Pred,
-          typename T1,
-          typename T2,
-          typename T3,
-          typename T4>
-AssertionResult AssertPred4Helper(const char* pred_text,
-                                  const char* e1,
-                                  const char* e2,
-                                  const char* e3,
-                                  const char* e4,
-                                  Pred pred,
-                                  const T1& v1,
-                                  const T2& v2,
-                                  const T3& v3,
-                                  const T4& v4) {
-  if (pred(v1, v2, v3, v4)) return AssertionSuccess();
-
-  Message msg;
-  msg << pred_text << "("
-      << e1 << ", "
-      << e2 << ", "
-      << e3 << ", "
-      << e4 << ") evaluates to false, where"
-      << "\n" << e1 << " evaluates to " << v1
-      << "\n" << e2 << " evaluates to " << v2
-      << "\n" << e3 << " evaluates to " << v3
-      << "\n" << e4 << " evaluates to " << v4;
-  return AssertionFailure(msg);
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\
-  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4),\
-                on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED4.  Don't use
-// this in your code.
-#define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\
-  GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \
-                                             #v1, \
-                                             #v2, \
-                                             #v3, \
-                                             #v4, \
-                                             pred, \
-                                             v1, \
-                                             v2, \
-                                             v3, \
-                                             v4), on_failure)
-
-// 4-ary predicate assertion macros.
-#define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
-  GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED4(pred, v1, v2, v3, v4) \
-  GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
-  GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED4(pred, v1, v2, v3, v4) \
-  GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
-
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED5.  Don't use
-// this in your code.
-template <typename Pred,
-          typename T1,
-          typename T2,
-          typename T3,
-          typename T4,
-          typename T5>
-AssertionResult AssertPred5Helper(const char* pred_text,
-                                  const char* e1,
-                                  const char* e2,
-                                  const char* e3,
-                                  const char* e4,
-                                  const char* e5,
-                                  Pred pred,
-                                  const T1& v1,
-                                  const T2& v2,
-                                  const T3& v3,
-                                  const T4& v4,
-                                  const T5& v5) {
-  if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess();
-
-  Message msg;
-  msg << pred_text << "("
-      << e1 << ", "
-      << e2 << ", "
-      << e3 << ", "
-      << e4 << ", "
-      << e5 << ") evaluates to false, where"
-      << "\n" << e1 << " evaluates to " << v1
-      << "\n" << e2 << " evaluates to " << v2
-      << "\n" << e3 << " evaluates to " << v3
-      << "\n" << e4 << " evaluates to " << v4
-      << "\n" << e5 << " evaluates to " << v5;
-  return AssertionFailure(msg);
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\
-  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5),\
-                on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED5.  Don't use
-// this in your code.
-#define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\
-  GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \
-                                             #v1, \
-                                             #v2, \
-                                             #v3, \
-                                             #v4, \
-                                             #v5, \
-                                             pred, \
-                                             v1, \
-                                             v2, \
-                                             v3, \
-                                             v4, \
-                                             v5), on_failure)
-
-// 5-ary predicate assertion macros.
-#define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
-  GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \
-  GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
-  GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \
-  GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
-
-
-
-#endif  // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
diff --git a/third_party/gtest/include/gtest/gtest_prod.h b/third_party/gtest/include/gtest/gtest_prod.h
deleted file mode 100644
index da80ddc..0000000
--- a/third_party/gtest/include/gtest/gtest_prod.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// Google C++ Testing Framework definitions useful in production code.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_
-#define GTEST_INCLUDE_GTEST_GTEST_PROD_H_
-
-// When you need to test the private or protected members of a class,
-// use the FRIEND_TEST macro to declare your tests as friends of the
-// class.  For example:
-//
-// class MyClass {
-//  private:
-//   void MyMethod();
-//   FRIEND_TEST(MyClassTest, MyMethod);
-// };
-//
-// class MyClassTest : public testing::Test {
-//   // ...
-// };
-//
-// TEST_F(MyClassTest, MyMethod) {
-//   // Can call MyClass::MyMethod() here.
-// }
-
-#define FRIEND_TEST(test_case_name, test_name)\
-friend class test_case_name##_##test_name##_Test
-
-#endif  // GTEST_INCLUDE_GTEST_GTEST_PROD_H_
diff --git a/third_party/gtest/include/gtest/internal/gtest-death-test-internal.h b/third_party/gtest/include/gtest/internal/gtest-death-test-internal.h
deleted file mode 100644
index 5aba1a0..0000000
--- a/third_party/gtest/include/gtest/internal/gtest-death-test-internal.h
+++ /dev/null
@@ -1,274 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file defines internal utilities needed for implementing
-// death tests.  They are subject to change without notice.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
-
-#include <gtest/internal/gtest-internal.h>
-
-namespace testing {
-namespace internal {
-
-GTEST_DECLARE_string_(internal_run_death_test);
-
-// Names of the flags (needed for parsing Google Test flags).
-const char kDeathTestStyleFlag[] = "death_test_style";
-const char kDeathTestUseFork[] = "death_test_use_fork";
-const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
-
-#if GTEST_HAS_DEATH_TEST
-
-// DeathTest is a class that hides much of the complexity of the
-// GTEST_DEATH_TEST_ macro.  It is abstract; its static Create method
-// returns a concrete class that depends on the prevailing death test
-// style, as defined by the --gtest_death_test_style and/or
-// --gtest_internal_run_death_test flags.
-
-// In describing the results of death tests, these terms are used with
-// the corresponding definitions:
-//
-// exit status:  The integer exit information in the format specified
-//               by wait(2)
-// exit code:    The integer code passed to exit(3), _exit(2), or
-//               returned from main()
-class DeathTest {
- public:
-  // Create returns false if there was an error determining the
-  // appropriate action to take for the current death test; for example,
-  // if the gtest_death_test_style flag is set to an invalid value.
-  // The LastMessage method will return a more detailed message in that
-  // case.  Otherwise, the DeathTest pointer pointed to by the "test"
-  // argument is set.  If the death test should be skipped, the pointer
-  // is set to NULL; otherwise, it is set to the address of a new concrete
-  // DeathTest object that controls the execution of the current test.
-  static bool Create(const char* statement, const RE* regex,
-                     const char* file, int line, DeathTest** test);
-  DeathTest();
-  virtual ~DeathTest() { }
-
-  // A helper class that aborts a death test when it's deleted.
-  class ReturnSentinel {
-   public:
-    explicit ReturnSentinel(DeathTest* test) : test_(test) { }
-    ~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); }
-   private:
-    DeathTest* const test_;
-    GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel);
-  } GTEST_ATTRIBUTE_UNUSED_;
-
-  // An enumeration of possible roles that may be taken when a death
-  // test is encountered.  EXECUTE means that the death test logic should
-  // be executed immediately.  OVERSEE means that the program should prepare
-  // the appropriate environment for a child process to execute the death
-  // test, then wait for it to complete.
-  enum TestRole { OVERSEE_TEST, EXECUTE_TEST };
-
-  // An enumeration of the two reasons that a test might be aborted.
-  enum AbortReason { TEST_ENCOUNTERED_RETURN_STATEMENT, TEST_DID_NOT_DIE };
-
-  // Assumes one of the above roles.
-  virtual TestRole AssumeRole() = 0;
-
-  // Waits for the death test to finish and returns its status.
-  virtual int Wait() = 0;
-
-  // Returns true if the death test passed; that is, the test process
-  // exited during the test, its exit status matches a user-supplied
-  // predicate, and its stderr output matches a user-supplied regular
-  // expression.
-  // The user-supplied predicate may be a macro expression rather
-  // than a function pointer or functor, or else Wait and Passed could
-  // be combined.
-  virtual bool Passed(bool exit_status_ok) = 0;
-
-  // Signals that the death test did not die as expected.
-  virtual void Abort(AbortReason reason) = 0;
-
-  // Returns a human-readable outcome message regarding the outcome of
-  // the last death test.
-  static const char* LastMessage();
-
-  static void set_last_death_test_message(const String& message);
-
- private:
-  // A string containing a description of the outcome of the last death test.
-  static String last_death_test_message_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);
-};
-
-// Factory interface for death tests.  May be mocked out for testing.
-class DeathTestFactory {
- public:
-  virtual ~DeathTestFactory() { }
-  virtual bool Create(const char* statement, const RE* regex,
-                      const char* file, int line, DeathTest** test) = 0;
-};
-
-// A concrete DeathTestFactory implementation for normal use.
-class DefaultDeathTestFactory : public DeathTestFactory {
- public:
-  virtual bool Create(const char* statement, const RE* regex,
-                      const char* file, int line, DeathTest** test);
-};
-
-// Returns true if exit_status describes a process that was terminated
-// by a signal, or exited normally with a nonzero exit code.
-bool ExitedUnsuccessfully(int exit_status);
-
-// This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
-// ASSERT_EXIT*, and EXPECT_EXIT*.
-#define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \
-  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
-  if (::testing::internal::AlwaysTrue()) { \
-    const ::testing::internal::RE& gtest_regex = (regex); \
-    ::testing::internal::DeathTest* gtest_dt; \
-    if (!::testing::internal::DeathTest::Create(#statement, &gtest_regex, \
-        __FILE__, __LINE__, &gtest_dt)) { \
-      goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
-    } \
-    if (gtest_dt != NULL) { \
-      ::testing::internal::scoped_ptr< ::testing::internal::DeathTest> \
-          gtest_dt_ptr(gtest_dt); \
-      switch (gtest_dt->AssumeRole()) { \
-        case ::testing::internal::DeathTest::OVERSEE_TEST: \
-          if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \
-            goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
-          } \
-          break; \
-        case ::testing::internal::DeathTest::EXECUTE_TEST: { \
-          ::testing::internal::DeathTest::ReturnSentinel \
-              gtest_sentinel(gtest_dt); \
-          GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
-          gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \
-          break; \
-        } \
-      } \
-    } \
-  } else \
-    GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__): \
-      fail(::testing::internal::DeathTest::LastMessage())
-// The symbol "fail" here expands to something into which a message
-// can be streamed.
-
-// A class representing the parsed contents of the
-// --gtest_internal_run_death_test flag, as it existed when
-// RUN_ALL_TESTS was called.
-class InternalRunDeathTestFlag {
- public:
-  InternalRunDeathTestFlag(const String& file,
-                           int line,
-                           int index,
-                           int write_fd)
-      : file_(file), line_(line), index_(index), write_fd_(write_fd) {}
-
-  ~InternalRunDeathTestFlag() {
-    if (write_fd_ >= 0)
-      posix::Close(write_fd_);
-  }
-
-  String file() const { return file_; }
-  int line() const { return line_; }
-  int index() const { return index_; }
-  int write_fd() const { return write_fd_; }
-
- private:
-  String file_;
-  int line_;
-  int index_;
-  int write_fd_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag);
-};
-
-// Returns a newly created InternalRunDeathTestFlag object with fields
-// initialized from the GTEST_FLAG(internal_run_death_test) flag if
-// the flag is specified; otherwise returns NULL.
-InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();
-
-#else  // GTEST_HAS_DEATH_TEST
-
-// This macro is used for implementing macros such as
-// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
-// death tests are not supported. Those macros must compile on such systems
-// iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on
-// systems that support death tests. This allows one to write such a macro
-// on a system that does not support death tests and be sure that it will
-// compile on a death-test supporting system.
-//
-// Parameters:
-//   statement -  A statement that a macro such as EXPECT_DEATH would test
-//                for program termination. This macro has to make sure this
-//                statement is compiled but not executed, to ensure that
-//                EXPECT_DEATH_IF_SUPPORTED compiles with a certain
-//                parameter iff EXPECT_DEATH compiles with it.
-//   regex     -  A regex that a macro such as EXPECT_DEATH would use to test
-//                the output of statement.  This parameter has to be
-//                compiled but not evaluated by this macro, to ensure that
-//                this macro only accepts expressions that a macro such as
-//                EXPECT_DEATH would accept.
-//   terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED
-//                and a return statement for ASSERT_DEATH_IF_SUPPORTED.
-//                This ensures that ASSERT_DEATH_IF_SUPPORTED will not
-//                compile inside functions where ASSERT_DEATH doesn't
-//                compile.
-//
-//  The branch that has an always false condition is used to ensure that
-//  statement and regex are compiled (and thus syntactically correct) but
-//  never executed. The unreachable code macro protects the terminator
-//  statement from generating an 'unreachable code' warning in case
-//  statement unconditionally returns or throws. The Message constructor at
-//  the end allows the syntax of streaming additional messages into the
-//  macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
-#define GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, terminator) \
-    GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
-    if (::testing::internal::AlwaysTrue()) { \
-      GTEST_LOG_(WARNING) \
-          << "Death tests are not supported on this platform.\n" \
-          << "Statement '" #statement "' cannot be verified."; \
-    } else if (::testing::internal::AlwaysFalse()) { \
-      ::testing::internal::RE::PartialMatch(".*", (regex)); \
-      GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
-      terminator; \
-    } else \
-      ::testing::Message()
-
-#endif  // GTEST_HAS_DEATH_TEST
-
-}  // namespace internal
-}  // namespace testing
-
-#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
diff --git a/third_party/gtest/include/gtest/internal/gtest-filepath.h b/third_party/gtest/include/gtest/internal/gtest-filepath.h
deleted file mode 100644
index 1b2f586..0000000
--- a/third_party/gtest/include/gtest/internal/gtest-filepath.h
+++ /dev/null
@@ -1,201 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: keith.ray@gmail.com (Keith Ray)
-//
-// Google Test filepath utilities
-//
-// This header file declares classes and functions used internally by
-// Google Test.  They are subject to change without notice.
-//
-// This file is #included in <gtest/internal/gtest-internal.h>.
-// Do not include this header file separately!
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
-
-#include <gtest/internal/gtest-string.h>
-
-namespace testing {
-namespace internal {
-
-// FilePath - a class for file and directory pathname manipulation which
-// handles platform-specific conventions (like the pathname separator).
-// Used for helper functions for naming files in a directory for xml output.
-// Except for Set methods, all methods are const or static, which provides an
-// "immutable value object" -- useful for peace of mind.
-// A FilePath with a value ending in a path separator ("like/this/") represents
-// a directory, otherwise it is assumed to represent a file. In either case,
-// it may or may not represent an actual file or directory in the file system.
-// Names are NOT checked for syntax correctness -- no checking for illegal
-// characters, malformed paths, etc.
-
-class FilePath {
- public:
-  FilePath() : pathname_("") { }
-  FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { }
-
-  explicit FilePath(const char* pathname) : pathname_(pathname) {
-    Normalize();
-  }
-
-  explicit FilePath(const String& pathname) : pathname_(pathname) {
-    Normalize();
-  }
-
-  FilePath& operator=(const FilePath& rhs) {
-    Set(rhs);
-    return *this;
-  }
-
-  void Set(const FilePath& rhs) {
-    pathname_ = rhs.pathname_;
-  }
-
-  String ToString() const { return pathname_; }
-  const char* c_str() const { return pathname_.c_str(); }
-
-  // Returns the current working directory, or "" if unsuccessful.
-  static FilePath GetCurrentDir();
-
-  // Given directory = "dir", base_name = "test", number = 0,
-  // extension = "xml", returns "dir/test.xml". If number is greater
-  // than zero (e.g., 12), returns "dir/test_12.xml".
-  // On Windows platform, uses \ as the separator rather than /.
-  static FilePath MakeFileName(const FilePath& directory,
-                               const FilePath& base_name,
-                               int number,
-                               const char* extension);
-
-  // Given directory = "dir", relative_path = "test.xml",
-  // returns "dir/test.xml".
-  // On Windows, uses \ as the separator rather than /.
-  static FilePath ConcatPaths(const FilePath& directory,
-                              const FilePath& relative_path);
-
-  // Returns a pathname for a file that does not currently exist. The pathname
-  // will be directory/base_name.extension or
-  // directory/base_name_<number>.extension if directory/base_name.extension
-  // already exists. The number will be incremented until a pathname is found
-  // that does not already exist.
-  // Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.
-  // There could be a race condition if two or more processes are calling this
-  // function at the same time -- they could both pick the same filename.
-  static FilePath GenerateUniqueFileName(const FilePath& directory,
-                                         const FilePath& base_name,
-                                         const char* extension);
-
-  // Returns true iff the path is NULL or "".
-  bool IsEmpty() const { return c_str() == NULL || *c_str() == '\0'; }
-
-  // If input name has a trailing separator character, removes it and returns
-  // the name, otherwise return the name string unmodified.
-  // On Windows platform, uses \ as the separator, other platforms use /.
-  FilePath RemoveTrailingPathSeparator() const;
-
-  // Returns a copy of the FilePath with the directory part removed.
-  // Example: FilePath("path/to/file").RemoveDirectoryName() returns
-  // FilePath("file"). If there is no directory part ("just_a_file"), it returns
-  // the FilePath unmodified. If there is no file part ("just_a_dir/") it
-  // returns an empty FilePath ("").
-  // On Windows platform, '\' is the path separator, otherwise it is '/'.
-  FilePath RemoveDirectoryName() const;
-
-  // RemoveFileName returns the directory path with the filename removed.
-  // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
-  // If the FilePath is "a_file" or "/a_file", RemoveFileName returns
-  // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
-  // not have a file, like "just/a/dir/", it returns the FilePath unmodified.
-  // On Windows platform, '\' is the path separator, otherwise it is '/'.
-  FilePath RemoveFileName() const;
-
-  // Returns a copy of the FilePath with the case-insensitive extension removed.
-  // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
-  // FilePath("dir/file"). If a case-insensitive extension is not
-  // found, returns a copy of the original FilePath.
-  FilePath RemoveExtension(const char* extension) const;
-
-  // Creates directories so that path exists. Returns true if successful or if
-  // the directories already exist; returns false if unable to create
-  // directories for any reason. Will also return false if the FilePath does
-  // not represent a directory (that is, it doesn't end with a path separator).
-  bool CreateDirectoriesRecursively() const;
-
-  // Create the directory so that path exists. Returns true if successful or
-  // if the directory already exists; returns false if unable to create the
-  // directory for any reason, including if the parent directory does not
-  // exist. Not named "CreateDirectory" because that's a macro on Windows.
-  bool CreateFolder() const;
-
-  // Returns true if FilePath describes something in the file-system,
-  // either a file, directory, or whatever, and that something exists.
-  bool FileOrDirectoryExists() const;
-
-  // Returns true if pathname describes a directory in the file-system
-  // that exists.
-  bool DirectoryExists() const;
-
-  // Returns true if FilePath ends with a path separator, which indicates that
-  // it is intended to represent a directory. Returns false otherwise.
-  // This does NOT check that a directory (or file) actually exists.
-  bool IsDirectory() const;
-
-  // Returns true if pathname describes a root directory. (Windows has one
-  // root directory per disk drive.)
-  bool IsRootDirectory() const;
-
-  // Returns true if pathname describes an absolute path.
-  bool IsAbsolutePath() const;
-
- private:
-  // Replaces multiple consecutive separators with a single separator.
-  // For example, "bar///foo" becomes "bar/foo". Does not eliminate other
-  // redundancies that might be in a pathname involving "." or "..".
-  //
-  // A pathname with multiple consecutive separators may occur either through
-  // user error or as a result of some scripts or APIs that generate a pathname
-  // with a trailing separator. On other platforms the same API or script
-  // may NOT generate a pathname with a trailing "/". Then elsewhere that
-  // pathname may have another "/" and pathname components added to it,
-  // without checking for the separator already being there.
-  // The script language and operating system may allow paths like "foo//bar"
-  // but some of the functions in FilePath will not handle that correctly. In
-  // particular, RemoveTrailingPathSeparator() only removes one separator, and
-  // it is called in CreateDirectoriesRecursively() assuming that it will change
-  // a pathname from directory syntax (trailing separator) to filename syntax.
-
-  void Normalize();
-
-  String pathname_;
-};  // class FilePath
-
-}  // namespace internal
-}  // namespace testing
-
-#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
diff --git a/third_party/gtest/include/gtest/internal/gtest-internal.h b/third_party/gtest/include/gtest/internal/gtest-internal.h
deleted file mode 100644
index e9f8e7c..0000000
--- a/third_party/gtest/include/gtest/internal/gtest-internal.h
+++ /dev/null
@@ -1,922 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file declares functions and macros used internally by
-// Google Test.  They are subject to change without notice.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
-
-#include <gtest/internal/gtest-port.h>
-
-#if GTEST_OS_LINUX
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#endif  // GTEST_OS_LINUX
-
-#include <ctype.h>
-#include <string.h>
-#include <iomanip>
-#include <limits>
-#include <set>
-
-#include <gtest/internal/gtest-string.h>
-#include <gtest/internal/gtest-filepath.h>
-#include <gtest/internal/gtest-type-util.h>
-
-// Due to C++ preprocessor weirdness, we need double indirection to
-// concatenate two tokens when one of them is __LINE__.  Writing
-//
-//   foo ## __LINE__
-//
-// will result in the token foo__LINE__, instead of foo followed by
-// the current line number.  For more details, see
-// http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6
-#define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
-#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
-
-// Google Test defines the testing::Message class to allow construction of
-// test messages via the << operator.  The idea is that anything
-// streamable to std::ostream can be streamed to a testing::Message.
-// This allows a user to use his own types in Google Test assertions by
-// overloading the << operator.
-//
-// util/gtl/stl_logging-inl.h overloads << for STL containers.  These
-// overloads cannot be defined in the std namespace, as that will be
-// undefined behavior.  Therefore, they are defined in the global
-// namespace instead.
-//
-// C++'s symbol lookup rule (i.e. Koenig lookup) says that these
-// overloads are visible in either the std namespace or the global
-// namespace, but not other namespaces, including the testing
-// namespace which Google Test's Message class is in.
-//
-// To allow STL containers (and other types that has a << operator
-// defined in the global namespace) to be used in Google Test assertions,
-// testing::Message must access the custom << operator from the global
-// namespace.  Hence this helper function.
-//
-// Note: Jeffrey Yasskin suggested an alternative fix by "using
-// ::operator<<;" in the definition of Message's operator<<.  That fix
-// doesn't require a helper function, but unfortunately doesn't
-// compile with MSVC.
-template <typename T>
-inline void GTestStreamToHelper(std::ostream* os, const T& val) {
-  *os << val;
-}
-
-namespace testing {
-
-// Forward declaration of classes.
-
-class AssertionResult;                 // Result of an assertion.
-class Message;                         // Represents a failure message.
-class Test;                            // Represents a test.
-class TestInfo;                        // Information about a test.
-class TestPartResult;                  // Result of a test part.
-class UnitTest;                        // A collection of test cases.
-
-namespace internal {
-
-struct TraceInfo;                      // Information about a trace point.
-class ScopedTrace;                     // Implements scoped trace.
-class TestInfoImpl;                    // Opaque implementation of TestInfo
-class UnitTestImpl;                    // Opaque implementation of UnitTest
-template <typename E> class Vector;    // A generic vector.
-
-// How many times InitGoogleTest() has been called.
-extern int g_init_gtest_count;
-
-// The text used in failure messages to indicate the start of the
-// stack trace.
-extern const char kStackTraceMarker[];
-
-// A secret type that Google Test users don't know about.  It has no
-// definition on purpose.  Therefore it's impossible to create a
-// Secret object, which is what we want.
-class Secret;
-
-// Two overloaded helpers for checking at compile time whether an
-// expression is a null pointer literal (i.e. NULL or any 0-valued
-// compile-time integral constant).  Their return values have
-// different sizes, so we can use sizeof() to test which version is
-// picked by the compiler.  These helpers have no implementations, as
-// we only need their signatures.
-//
-// Given IsNullLiteralHelper(x), the compiler will pick the first
-// version if x can be implicitly converted to Secret*, and pick the
-// second version otherwise.  Since Secret is a secret and incomplete
-// type, the only expression a user can write that has type Secret* is
-// a null pointer literal.  Therefore, we know that x is a null
-// pointer literal if and only if the first version is picked by the
-// compiler.
-char IsNullLiteralHelper(Secret* p);
-char (&IsNullLiteralHelper(...))[2];  // NOLINT
-
-// A compile-time bool constant that is true if and only if x is a
-// null pointer literal (i.e. NULL or any 0-valued compile-time
-// integral constant).
-#ifdef GTEST_ELLIPSIS_NEEDS_POD_
-// We lose support for NULL detection where the compiler doesn't like
-// passing non-POD classes through ellipsis (...).
-#define GTEST_IS_NULL_LITERAL_(x) false
-#else
-#define GTEST_IS_NULL_LITERAL_(x) \
-    (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)
-#endif  // GTEST_ELLIPSIS_NEEDS_POD_
-
-// Appends the user-supplied message to the Google-Test-generated message.
-String AppendUserMessage(const String& gtest_msg,
-                         const Message& user_msg);
-
-// A helper class for creating scoped traces in user programs.
-class ScopedTrace {
- public:
-  // The c'tor pushes the given source file location and message onto
-  // a trace stack maintained by Google Test.
-  ScopedTrace(const char* file, int line, const Message& message);
-
-  // The d'tor pops the info pushed by the c'tor.
-  //
-  // Note that the d'tor is not virtual in order to be efficient.
-  // Don't inherit from ScopedTrace!
-  ~ScopedTrace();
-
- private:
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);
-} GTEST_ATTRIBUTE_UNUSED_;  // A ScopedTrace object does its job in its
-                            // c'tor and d'tor.  Therefore it doesn't
-                            // need to be used otherwise.
-
-// Converts a streamable value to a String.  A NULL pointer is
-// converted to "(null)".  When the input value is a ::string,
-// ::std::string, ::wstring, or ::std::wstring object, each NUL
-// character in it is replaced with "\\0".
-// Declared here but defined in gtest.h, so that it has access
-// to the definition of the Message class, required by the ARM
-// compiler.
-template <typename T>
-String StreamableToString(const T& streamable);
-
-// Formats a value to be used in a failure message.
-
-#ifdef GTEST_NEEDS_IS_POINTER_
-
-// These are needed as the Nokia Symbian and IBM XL C/C++ compilers
-// cannot decide between const T& and const T* in a function template.
-// These compilers _can_ decide between class template specializations
-// for T and T*, so a tr1::type_traits-like is_pointer works, and we
-// can overload on that.
-
-// This overload makes sure that all pointers (including
-// those to char or wchar_t) are printed as raw pointers.
-template <typename T>
-inline String FormatValueForFailureMessage(internal::true_type /*dummy*/,
-                                           T* pointer) {
-  return StreamableToString(static_cast<const void*>(pointer));
-}
-
-template <typename T>
-inline String FormatValueForFailureMessage(internal::false_type /*dummy*/,
-                                           const T& value) {
-  return StreamableToString(value);
-}
-
-template <typename T>
-inline String FormatForFailureMessage(const T& value) {
-  return FormatValueForFailureMessage(
-      typename internal::is_pointer<T>::type(), value);
-}
-
-#else
-
-// These are needed as the above solution using is_pointer has the
-// limitation that T cannot be a type without external linkage, when
-// compiled using MSVC.
-
-template <typename T>
-inline String FormatForFailureMessage(const T& value) {
-  return StreamableToString(value);
-}
-
-// This overload makes sure that all pointers (including
-// those to char or wchar_t) are printed as raw pointers.
-template <typename T>
-inline String FormatForFailureMessage(T* pointer) {
-  return StreamableToString(static_cast<const void*>(pointer));
-}
-
-#endif  // GTEST_NEEDS_IS_POINTER_
-
-// These overloaded versions handle narrow and wide characters.
-String FormatForFailureMessage(char ch);
-String FormatForFailureMessage(wchar_t wchar);
-
-// When this operand is a const char* or char*, and the other operand
-// is a ::std::string or ::string, we print this operand as a C string
-// rather than a pointer.  We do the same for wide strings.
-
-// This internal macro is used to avoid duplicated code.
-#define GTEST_FORMAT_IMPL_(operand2_type, operand1_printer)\
-inline String FormatForComparisonFailureMessage(\
-    operand2_type::value_type* str, const operand2_type& /*operand2*/) {\
-  return operand1_printer(str);\
-}\
-inline String FormatForComparisonFailureMessage(\
-    const operand2_type::value_type* str, const operand2_type& /*operand2*/) {\
-  return operand1_printer(str);\
-}
-
-#if GTEST_HAS_STD_STRING
-GTEST_FORMAT_IMPL_(::std::string, String::ShowCStringQuoted)
-#endif  // GTEST_HAS_STD_STRING
-#if GTEST_HAS_STD_WSTRING
-GTEST_FORMAT_IMPL_(::std::wstring, String::ShowWideCStringQuoted)
-#endif  // GTEST_HAS_STD_WSTRING
-
-#if GTEST_HAS_GLOBAL_STRING
-GTEST_FORMAT_IMPL_(::string, String::ShowCStringQuoted)
-#endif  // GTEST_HAS_GLOBAL_STRING
-#if GTEST_HAS_GLOBAL_WSTRING
-GTEST_FORMAT_IMPL_(::wstring, String::ShowWideCStringQuoted)
-#endif  // GTEST_HAS_GLOBAL_WSTRING
-
-#undef GTEST_FORMAT_IMPL_
-
-// Constructs and returns the message for an equality assertion
-// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
-//
-// The first four parameters are the expressions used in the assertion
-// and their values, as strings.  For example, for ASSERT_EQ(foo, bar)
-// where foo is 5 and bar is 6, we have:
-//
-//   expected_expression: "foo"
-//   actual_expression:   "bar"
-//   expected_value:      "5"
-//   actual_value:        "6"
-//
-// The ignoring_case parameter is true iff the assertion is a
-// *_STRCASEEQ*.  When it's true, the string " (ignoring case)" will
-// be inserted into the message.
-AssertionResult EqFailure(const char* expected_expression,
-                          const char* actual_expression,
-                          const String& expected_value,
-                          const String& actual_value,
-                          bool ignoring_case);
-
-// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
-String GetBoolAssertionFailureMessage(const AssertionResult& assertion_result,
-                                      const char* expression_text,
-                                      const char* actual_predicate_value,
-                                      const char* expected_predicate_value);
-
-// This template class represents an IEEE floating-point number
-// (either single-precision or double-precision, depending on the
-// template parameters).
-//
-// The purpose of this class is to do more sophisticated number
-// comparison.  (Due to round-off error, etc, it's very unlikely that
-// two floating-points will be equal exactly.  Hence a naive
-// comparison by the == operation often doesn't work.)
-//
-// Format of IEEE floating-point:
-//
-//   The most-significant bit being the leftmost, an IEEE
-//   floating-point looks like
-//
-//     sign_bit exponent_bits fraction_bits
-//
-//   Here, sign_bit is a single bit that designates the sign of the
-//   number.
-//
-//   For float, there are 8 exponent bits and 23 fraction bits.
-//
-//   For double, there are 11 exponent bits and 52 fraction bits.
-//
-//   More details can be found at
-//   http://en.wikipedia.org/wiki/IEEE_floating-point_standard.
-//
-// Template parameter:
-//
-//   RawType: the raw floating-point type (either float or double)
-template <typename RawType>
-class FloatingPoint {
- public:
-  // Defines the unsigned integer type that has the same size as the
-  // floating point number.
-  typedef typename TypeWithSize<sizeof(RawType)>::UInt Bits;
-
-  // Constants.
-
-  // # of bits in a number.
-  static const size_t kBitCount = 8*sizeof(RawType);
-
-  // # of fraction bits in a number.
-  static const size_t kFractionBitCount =
-    std::numeric_limits<RawType>::digits - 1;
-
-  // # of exponent bits in a number.
-  static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount;
-
-  // The mask for the sign bit.
-  static const Bits kSignBitMask = static_cast<Bits>(1) << (kBitCount - 1);
-
-  // The mask for the fraction bits.
-  static const Bits kFractionBitMask =
-    ~static_cast<Bits>(0) >> (kExponentBitCount + 1);
-
-  // The mask for the exponent bits.
-  static const Bits kExponentBitMask = ~(kSignBitMask | kFractionBitMask);
-
-  // How many ULP's (Units in the Last Place) we want to tolerate when
-  // comparing two numbers.  The larger the value, the more error we
-  // allow.  A 0 value means that two numbers must be exactly the same
-  // to be considered equal.
-  //
-  // The maximum error of a single floating-point operation is 0.5
-  // units in the last place.  On Intel CPU's, all floating-point
-  // calculations are done with 80-bit precision, while double has 64
-  // bits.  Therefore, 4 should be enough for ordinary use.
-  //
-  // See the following article for more details on ULP:
-  // http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm.
-  static const size_t kMaxUlps = 4;
-
-  // Constructs a FloatingPoint from a raw floating-point number.
-  //
-  // On an Intel CPU, passing a non-normalized NAN (Not a Number)
-  // around may change its bits, although the new value is guaranteed
-  // to be also a NAN.  Therefore, don't expect this constructor to
-  // preserve the bits in x when x is a NAN.
-  explicit FloatingPoint(const RawType& x) { u_.value_ = x; }
-
-  // Static methods
-
-  // Reinterprets a bit pattern as a floating-point number.
-  //
-  // This function is needed to test the AlmostEquals() method.
-  static RawType ReinterpretBits(const Bits bits) {
-    FloatingPoint fp(0);
-    fp.u_.bits_ = bits;
-    return fp.u_.value_;
-  }
-
-  // Returns the floating-point number that represent positive infinity.
-  static RawType Infinity() {
-    return ReinterpretBits(kExponentBitMask);
-  }
-
-  // Non-static methods
-
-  // Returns the bits that represents this number.
-  const Bits &bits() const { return u_.bits_; }
-
-  // Returns the exponent bits of this number.
-  Bits exponent_bits() const { return kExponentBitMask & u_.bits_; }
-
-  // Returns the fraction bits of this number.
-  Bits fraction_bits() const { return kFractionBitMask & u_.bits_; }
-
-  // Returns the sign bit of this number.
-  Bits sign_bit() const { return kSignBitMask & u_.bits_; }
-
-  // Returns true iff this is NAN (not a number).
-  bool is_nan() const {
-    // It's a NAN if the exponent bits are all ones and the fraction
-    // bits are not entirely zeros.
-    return (exponent_bits() == kExponentBitMask) && (fraction_bits() != 0);
-  }
-
-  // Returns true iff this number is at most kMaxUlps ULP's away from
-  // rhs.  In particular, this function:
-  //
-  //   - returns false if either number is (or both are) NAN.
-  //   - treats really large numbers as almost equal to infinity.
-  //   - thinks +0.0 and -0.0 are 0 DLP's apart.
-  bool AlmostEquals(const FloatingPoint& rhs) const {
-    // The IEEE standard says that any comparison operation involving
-    // a NAN must return false.
-    if (is_nan() || rhs.is_nan()) return false;
-
-    return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_)
-        <= kMaxUlps;
-  }
-
- private:
-  // The data type used to store the actual floating-point number.
-  union FloatingPointUnion {
-    RawType value_;  // The raw floating-point number.
-    Bits bits_;      // The bits that represent the number.
-  };
-
-  // Converts an integer from the sign-and-magnitude representation to
-  // the biased representation.  More precisely, let N be 2 to the
-  // power of (kBitCount - 1), an integer x is represented by the
-  // unsigned number x + N.
-  //
-  // For instance,
-  //
-  //   -N + 1 (the most negative number representable using
-  //          sign-and-magnitude) is represented by 1;
-  //   0      is represented by N; and
-  //   N - 1  (the biggest number representable using
-  //          sign-and-magnitude) is represented by 2N - 1.
-  //
-  // Read http://en.wikipedia.org/wiki/Signed_number_representations
-  // for more details on signed number representations.
-  static Bits SignAndMagnitudeToBiased(const Bits &sam) {
-    if (kSignBitMask & sam) {
-      // sam represents a negative number.
-      return ~sam + 1;
-    } else {
-      // sam represents a positive number.
-      return kSignBitMask | sam;
-    }
-  }
-
-  // Given two numbers in the sign-and-magnitude representation,
-  // returns the distance between them as an unsigned number.
-  static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1,
-                                                     const Bits &sam2) {
-    const Bits biased1 = SignAndMagnitudeToBiased(sam1);
-    const Bits biased2 = SignAndMagnitudeToBiased(sam2);
-    return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1);
-  }
-
-  FloatingPointUnion u_;
-};
-
-// Typedefs the instances of the FloatingPoint template class that we
-// care to use.
-typedef FloatingPoint<float> Float;
-typedef FloatingPoint<double> Double;
-
-// In order to catch the mistake of putting tests that use different
-// test fixture classes in the same test case, we need to assign
-// unique IDs to fixture classes and compare them.  The TypeId type is
-// used to hold such IDs.  The user should treat TypeId as an opaque
-// type: the only operation allowed on TypeId values is to compare
-// them for equality using the == operator.
-typedef const void* TypeId;
-
-template <typename T>
-class TypeIdHelper {
- public:
-  // dummy_ must not have a const type.  Otherwise an overly eager
-  // compiler (e.g. MSVC 7.1 & 8.0) may try to merge
-  // TypeIdHelper<T>::dummy_ for different Ts as an "optimization".
-  static bool dummy_;
-};
-
-template <typename T>
-bool TypeIdHelper<T>::dummy_ = false;
-
-// GetTypeId<T>() returns the ID of type T.  Different values will be
-// returned for different types.  Calling the function twice with the
-// same type argument is guaranteed to return the same ID.
-template <typename T>
-TypeId GetTypeId() {
-  // The compiler is required to allocate a different
-  // TypeIdHelper<T>::dummy_ variable for each T used to instantiate
-  // the template.  Therefore, the address of dummy_ is guaranteed to
-  // be unique.
-  return &(TypeIdHelper<T>::dummy_);
-}
-
-// Returns the type ID of ::testing::Test.  Always call this instead
-// of GetTypeId< ::testing::Test>() to get the type ID of
-// ::testing::Test, as the latter may give the wrong result due to a
-// suspected linker bug when compiling Google Test as a Mac OS X
-// framework.
-TypeId GetTestTypeId();
-
-// Defines the abstract factory interface that creates instances
-// of a Test object.
-class TestFactoryBase {
- public:
-  virtual ~TestFactoryBase() {}
-
-  // Creates a test instance to run. The instance is both created and destroyed
-  // within TestInfoImpl::Run()
-  virtual Test* CreateTest() = 0;
-
- protected:
-  TestFactoryBase() {}
-
- private:
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase);
-};
-
-// This class provides implementation of TeastFactoryBase interface.
-// It is used in TEST and TEST_F macros.
-template <class TestClass>
-class TestFactoryImpl : public TestFactoryBase {
- public:
-  virtual Test* CreateTest() { return new TestClass; }
-};
-
-#if GTEST_OS_WINDOWS
-
-// Predicate-formatters for implementing the HRESULT checking macros
-// {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}
-// We pass a long instead of HRESULT to avoid causing an
-// include dependency for the HRESULT type.
-AssertionResult IsHRESULTSuccess(const char* expr, long hr);  // NOLINT
-AssertionResult IsHRESULTFailure(const char* expr, long hr);  // NOLINT
-
-#endif  // GTEST_OS_WINDOWS
-
-// Formats a source file path and a line number as they would appear
-// in a compiler error message.
-inline String FormatFileLocation(const char* file, int line) {
-  const char* const file_name = file == NULL ? "unknown file" : file;
-  if (line < 0) {
-    return String::Format("%s:", file_name);
-  }
-#ifdef _MSC_VER
-  return String::Format("%s(%d):", file_name, line);
-#else
-  return String::Format("%s:%d:", file_name, line);
-#endif  // _MSC_VER
-}
-
-// Types of SetUpTestCase() and TearDownTestCase() functions.
-typedef void (*SetUpTestCaseFunc)();
-typedef void (*TearDownTestCaseFunc)();
-
-// Creates a new TestInfo object and registers it with Google Test;
-// returns the created object.
-//
-// Arguments:
-//
-//   test_case_name:   name of the test case
-//   name:             name of the test
-//   test_case_comment: a comment on the test case that will be included in
-//                      the test output
-//   comment:          a comment on the test that will be included in the
-//                     test output
-//   fixture_class_id: ID of the test fixture class
-//   set_up_tc:        pointer to the function that sets up the test case
-//   tear_down_tc:     pointer to the function that tears down the test case
-//   factory:          pointer to the factory that creates a test object.
-//                     The newly created TestInfo instance will assume
-//                     ownership of the factory object.
-TestInfo* MakeAndRegisterTestInfo(
-    const char* test_case_name, const char* name,
-    const char* test_case_comment, const char* comment,
-    TypeId fixture_class_id,
-    SetUpTestCaseFunc set_up_tc,
-    TearDownTestCaseFunc tear_down_tc,
-    TestFactoryBase* factory);
-
-// If *pstr starts with the given prefix, modifies *pstr to be right
-// past the prefix and returns true; otherwise leaves *pstr unchanged
-// and returns false.  None of pstr, *pstr, and prefix can be NULL.
-bool SkipPrefix(const char* prefix, const char** pstr);
-
-#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-// State of the definition of a type-parameterized test case.
-class TypedTestCasePState {
- public:
-  TypedTestCasePState() : registered_(false) {}
-
-  // Adds the given test name to defined_test_names_ and return true
-  // if the test case hasn't been registered; otherwise aborts the
-  // program.
-  bool AddTestName(const char* file, int line, const char* case_name,
-                   const char* test_name) {
-    if (registered_) {
-      fprintf(stderr, "%s Test %s must be defined before "
-              "REGISTER_TYPED_TEST_CASE_P(%s, ...).\n",
-              FormatFileLocation(file, line).c_str(), test_name, case_name);
-      fflush(stderr);
-      posix::Abort();
-    }
-    defined_test_names_.insert(test_name);
-    return true;
-  }
-
-  // Verifies that registered_tests match the test names in
-  // defined_test_names_; returns registered_tests if successful, or
-  // aborts the program otherwise.
-  const char* VerifyRegisteredTestNames(
-      const char* file, int line, const char* registered_tests);
-
- private:
-  bool registered_;
-  ::std::set<const char*> defined_test_names_;
-};
-
-// Skips to the first non-space char after the first comma in 'str';
-// returns NULL if no comma is found in 'str'.
-inline const char* SkipComma(const char* str) {
-  const char* comma = strchr(str, ',');
-  if (comma == NULL) {
-    return NULL;
-  }
-  while (isspace(*(++comma))) {}
-  return comma;
-}
-
-// Returns the prefix of 'str' before the first comma in it; returns
-// the entire string if it contains no comma.
-inline String GetPrefixUntilComma(const char* str) {
-  const char* comma = strchr(str, ',');
-  return comma == NULL ? String(str) : String(str, comma - str);
-}
-
-// TypeParameterizedTest<Fixture, TestSel, Types>::Register()
-// registers a list of type-parameterized tests with Google Test.  The
-// return value is insignificant - we just need to return something
-// such that we can call this function in a namespace scope.
-//
-// Implementation note: The GTEST_TEMPLATE_ macro declares a template
-// template parameter.  It's defined in gtest-type-util.h.
-template <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types>
-class TypeParameterizedTest {
- public:
-  // 'index' is the index of the test in the type list 'Types'
-  // specified in INSTANTIATE_TYPED_TEST_CASE_P(Prefix, TestCase,
-  // Types).  Valid values for 'index' are [0, N - 1] where N is the
-  // length of Types.
-  static bool Register(const char* prefix, const char* case_name,
-                       const char* test_names, int index) {
-    typedef typename Types::Head Type;
-    typedef Fixture<Type> FixtureClass;
-    typedef typename GTEST_BIND_(TestSel, Type) TestClass;
-
-    // First, registers the first type-parameterized test in the type
-    // list.
-    MakeAndRegisterTestInfo(
-        String::Format("%s%s%s/%d", prefix, prefix[0] == '\0' ? "" : "/",
-                       case_name, index).c_str(),
-        GetPrefixUntilComma(test_names).c_str(),
-        String::Format("TypeParam = %s", GetTypeName<Type>().c_str()).c_str(),
-        "",
-        GetTypeId<FixtureClass>(),
-        TestClass::SetUpTestCase,
-        TestClass::TearDownTestCase,
-        new TestFactoryImpl<TestClass>);
-
-    // Next, recurses (at compile time) with the tail of the type list.
-    return TypeParameterizedTest<Fixture, TestSel, typename Types::Tail>
-        ::Register(prefix, case_name, test_names, index + 1);
-  }
-};
-
-// The base case for the compile time recursion.
-template <GTEST_TEMPLATE_ Fixture, class TestSel>
-class TypeParameterizedTest<Fixture, TestSel, Types0> {
- public:
-  static bool Register(const char* /*prefix*/, const char* /*case_name*/,
-                       const char* /*test_names*/, int /*index*/) {
-    return true;
-  }
-};
-
-// TypeParameterizedTestCase<Fixture, Tests, Types>::Register()
-// registers *all combinations* of 'Tests' and 'Types' with Google
-// Test.  The return value is insignificant - we just need to return
-// something such that we can call this function in a namespace scope.
-template <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types>
-class TypeParameterizedTestCase {
- public:
-  static bool Register(const char* prefix, const char* case_name,
-                       const char* test_names) {
-    typedef typename Tests::Head Head;
-
-    // First, register the first test in 'Test' for each type in 'Types'.
-    TypeParameterizedTest<Fixture, Head, Types>::Register(
-        prefix, case_name, test_names, 0);
-
-    // Next, recurses (at compile time) with the tail of the test list.
-    return TypeParameterizedTestCase<Fixture, typename Tests::Tail, Types>
-        ::Register(prefix, case_name, SkipComma(test_names));
-  }
-};
-
-// The base case for the compile time recursion.
-template <GTEST_TEMPLATE_ Fixture, typename Types>
-class TypeParameterizedTestCase<Fixture, Templates0, Types> {
- public:
-  static bool Register(const char* /*prefix*/, const char* /*case_name*/,
-                       const char* /*test_names*/) {
-    return true;
-  }
-};
-
-#endif  // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-// Returns the current OS stack trace as a String.
-//
-// The maximum number of stack frames to be included is specified by
-// the gtest_stack_trace_depth flag.  The skip_count parameter
-// specifies the number of top frames to be skipped, which doesn't
-// count against the number of frames to be included.
-//
-// For example, if Foo() calls Bar(), which in turn calls
-// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
-// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
-String GetCurrentOsStackTraceExceptTop(UnitTest* unit_test, int skip_count);
-
-// Helpers for suppressing warnings on unreachable code or constant
-// condition.
-
-// Always returns true.
-bool AlwaysTrue();
-
-// Always returns false.
-inline bool AlwaysFalse() { return !AlwaysTrue(); }
-
-// A simple Linear Congruential Generator for generating random
-// numbers with a uniform distribution.  Unlike rand() and srand(), it
-// doesn't use global state (and therefore can't interfere with user
-// code).  Unlike rand_r(), it's portable.  An LCG isn't very random,
-// but it's good enough for our purposes.
-class Random {
- public:
-  static const UInt32 kMaxRange = 1u << 31;
-
-  explicit Random(UInt32 seed) : state_(seed) {}
-
-  void Reseed(UInt32 seed) { state_ = seed; }
-
-  // Generates a random number from [0, range).  Crashes if 'range' is
-  // 0 or greater than kMaxRange.
-  UInt32 Generate(UInt32 range);
-
- private:
-  UInt32 state_;
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(Random);
-};
-
-}  // namespace internal
-}  // namespace testing
-
-#define GTEST_MESSAGE_(message, result_type) \
-  ::testing::internal::AssertHelper(result_type, __FILE__, __LINE__, message) \
-    = ::testing::Message()
-
-#define GTEST_FATAL_FAILURE_(message) \
-  return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure)
-
-#define GTEST_NONFATAL_FAILURE_(message) \
-  GTEST_MESSAGE_(message, ::testing::TestPartResult::kNonFatalFailure)
-
-#define GTEST_SUCCESS_(message) \
-  GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess)
-
-// Suppresses MSVC warnings 4072 (unreachable code) for the code following
-// statement if it returns or throws (or doesn't return or throw in some
-// situations).
-#define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \
-  if (::testing::internal::AlwaysTrue()) { statement; }
-
-#define GTEST_TEST_THROW_(statement, expected_exception, fail) \
-  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
-  if (const char* gtest_msg = "") { \
-    bool gtest_caught_expected = false; \
-    try { \
-      GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
-    } \
-    catch (expected_exception const&) { \
-      gtest_caught_expected = true; \
-    } \
-    catch (...) { \
-      gtest_msg = "Expected: " #statement " throws an exception of type " \
-                  #expected_exception ".\n  Actual: it throws a different " \
-                  "type."; \
-      goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
-    } \
-    if (!gtest_caught_expected) { \
-      gtest_msg = "Expected: " #statement " throws an exception of type " \
-                  #expected_exception ".\n  Actual: it throws nothing."; \
-      goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
-    } \
-  } else \
-    GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \
-      fail(gtest_msg)
-
-#define GTEST_TEST_NO_THROW_(statement, fail) \
-  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
-  if (const char* gtest_msg = "") { \
-    try { \
-      GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
-    } \
-    catch (...) { \
-      gtest_msg = "Expected: " #statement " doesn't throw an exception.\n" \
-                  "  Actual: it throws."; \
-      goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
-    } \
-  } else \
-    GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \
-      fail(gtest_msg)
-
-#define GTEST_TEST_ANY_THROW_(statement, fail) \
-  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
-  if (const char* gtest_msg = "") { \
-    bool gtest_caught_any = false; \
-    try { \
-      GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
-    } \
-    catch (...) { \
-      gtest_caught_any = true; \
-    } \
-    if (!gtest_caught_any) { \
-      gtest_msg = "Expected: " #statement " throws an exception.\n" \
-                  "  Actual: it doesn't."; \
-      goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \
-    } \
-  } else \
-    GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \
-      fail(gtest_msg)
-
-
-// Implements Boolean test assertions such as EXPECT_TRUE. expression can be
-// either a boolean expression or an AssertionResult. text is a textual
-// represenation of expression as it was passed into the EXPECT_TRUE.
-#define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \
-  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
-  if (const ::testing::AssertionResult gtest_ar_ = \
-      ::testing::AssertionResult(expression)) \
-    ; \
-  else \
-    fail(::testing::internal::GetBoolAssertionFailureMessage(\
-        gtest_ar_, text, #actual, #expected).c_str())
-
-#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
-  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
-  if (const char* gtest_msg = "") { \
-    ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
-    GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
-    if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
-      gtest_msg = "Expected: " #statement " doesn't generate new fatal " \
-                  "failures in the current thread.\n" \
-                  "  Actual: it does."; \
-      goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
-    } \
-  } else \
-    GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \
-      fail(gtest_msg)
-
-// Expands to the name of the class that implements the given test.
-#define GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
-  test_case_name##_##test_name##_Test
-
-// Helper macro for defining tests.
-#define GTEST_TEST_(test_case_name, test_name, parent_class, parent_id)\
-class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
- public:\
-  GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
- private:\
-  virtual void TestBody();\
-  static ::testing::TestInfo* const test_info_;\
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(\
-      GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
-};\
-\
-::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_case_name, test_name)\
-  ::test_info_ =\
-    ::testing::internal::MakeAndRegisterTestInfo(\
-        #test_case_name, #test_name, "", "", \
-        (parent_id), \
-        parent_class::SetUpTestCase, \
-        parent_class::TearDownTestCase, \
-        new ::testing::internal::TestFactoryImpl<\
-            GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\
-void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
-
-#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
diff --git a/third_party/gtest/include/gtest/internal/gtest-linked_ptr.h b/third_party/gtest/include/gtest/internal/gtest-linked_ptr.h
deleted file mode 100644
index f98af0b..0000000
--- a/third_party/gtest/include/gtest/internal/gtest-linked_ptr.h
+++ /dev/null
@@ -1,242 +0,0 @@
-// Copyright 2003 Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: Dan Egnor (egnor@google.com)
-//
-// A "smart" pointer type with reference tracking.  Every pointer to a
-// particular object is kept on a circular linked list.  When the last pointer
-// to an object is destroyed or reassigned, the object is deleted.
-//
-// Used properly, this deletes the object when the last reference goes away.
-// There are several caveats:
-// - Like all reference counting schemes, cycles lead to leaks.
-// - Each smart pointer is actually two pointers (8 bytes instead of 4).
-// - Every time a pointer is assigned, the entire list of pointers to that
-//   object is traversed.  This class is therefore NOT SUITABLE when there
-//   will often be more than two or three pointers to a particular object.
-// - References are only tracked as long as linked_ptr<> objects are copied.
-//   If a linked_ptr<> is converted to a raw pointer and back, BAD THINGS
-//   will happen (double deletion).
-//
-// A good use of this class is storing object references in STL containers.
-// You can safely put linked_ptr<> in a vector<>.
-// Other uses may not be as good.
-//
-// Note: If you use an incomplete type with linked_ptr<>, the class
-// *containing* linked_ptr<> must have a constructor and destructor (even
-// if they do nothing!).
-//
-// Bill Gibbons suggested we use something like this.
-//
-// Thread Safety:
-//   Unlike other linked_ptr implementations, in this implementation
-//   a linked_ptr object is thread-safe in the sense that:
-//     - it's safe to copy linked_ptr objects concurrently,
-//     - it's safe to copy *from* a linked_ptr and read its underlying
-//       raw pointer (e.g. via get()) concurrently, and
-//     - it's safe to write to two linked_ptrs that point to the same
-//       shared object concurrently.
-// TODO(wan@google.com): rename this to safe_linked_ptr to avoid
-// confusion with normal linked_ptr.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
-
-#include <stdlib.h>
-#include <assert.h>
-
-#include <gtest/internal/gtest-port.h>
-
-namespace testing {
-namespace internal {
-
-// Protects copying of all linked_ptr objects.
-extern Mutex g_linked_ptr_mutex;
-
-// This is used internally by all instances of linked_ptr<>.  It needs to be
-// a non-template class because different types of linked_ptr<> can refer to
-// the same object (linked_ptr<Superclass>(obj) vs linked_ptr<Subclass>(obj)).
-// So, it needs to be possible for different types of linked_ptr to participate
-// in the same circular linked list, so we need a single class type here.
-//
-// DO NOT USE THIS CLASS DIRECTLY YOURSELF.  Use linked_ptr<T>.
-class linked_ptr_internal {
- public:
-  // Create a new circle that includes only this instance.
-  void join_new() {
-    next_ = this;
-  }
-
-  // Many linked_ptr operations may change p.link_ for some linked_ptr
-  // variable p in the same circle as this object.  Therefore we need
-  // to prevent two such operations from occurring concurrently.
-  //
-  // Note that different types of linked_ptr objects can coexist in a
-  // circle (e.g. linked_ptr<Base>, linked_ptr<Derived1>, and
-  // linked_ptr<Derived2>).  Therefore we must use a single mutex to
-  // protect all linked_ptr objects.  This can create serious
-  // contention in production code, but is acceptable in a testing
-  // framework.
-
-  // Join an existing circle.
-  // L < g_linked_ptr_mutex
-  void join(linked_ptr_internal const* ptr) {
-    MutexLock lock(&g_linked_ptr_mutex);
-
-    linked_ptr_internal const* p = ptr;
-    while (p->next_ != ptr) p = p->next_;
-    p->next_ = this;
-    next_ = ptr;
-  }
-
-  // Leave whatever circle we're part of.  Returns true if we were the
-  // last member of the circle.  Once this is done, you can join() another.
-  // L < g_linked_ptr_mutex
-  bool depart() {
-    MutexLock lock(&g_linked_ptr_mutex);
-
-    if (next_ == this) return true;
-    linked_ptr_internal const* p = next_;
-    while (p->next_ != this) p = p->next_;
-    p->next_ = next_;
-    return false;
-  }
-
- private:
-  mutable linked_ptr_internal const* next_;
-};
-
-template <typename T>
-class linked_ptr {
- public:
-  typedef T element_type;
-
-  // Take over ownership of a raw pointer.  This should happen as soon as
-  // possible after the object is created.
-  explicit linked_ptr(T* ptr = NULL) { capture(ptr); }
-  ~linked_ptr() { depart(); }
-
-  // Copy an existing linked_ptr<>, adding ourselves to the list of references.
-  template <typename U> linked_ptr(linked_ptr<U> const& ptr) { copy(&ptr); }
-  linked_ptr(linked_ptr const& ptr) {  // NOLINT
-    assert(&ptr != this);
-    copy(&ptr);
-  }
-
-  // Assignment releases the old value and acquires the new.
-  template <typename U> linked_ptr& operator=(linked_ptr<U> const& ptr) {
-    depart();
-    copy(&ptr);
-    return *this;
-  }
-
-  linked_ptr& operator=(linked_ptr const& ptr) {
-    if (&ptr != this) {
-      depart();
-      copy(&ptr);
-    }
-    return *this;
-  }
-
-  // Smart pointer members.
-  void reset(T* ptr = NULL) {
-    depart();
-    capture(ptr);
-  }
-  T* get() const { return value_; }
-  T* operator->() const { return value_; }
-  T& operator*() const { return *value_; }
-  // Release ownership of the pointed object and returns it.
-  // Sole ownership by this linked_ptr object is required.
-  T* release() {
-    bool last = link_.depart();
-    assert(last);
-    T* v = value_;
-    value_ = NULL;
-    return v;
-  }
-
-  bool operator==(T* p) const { return value_ == p; }
-  bool operator!=(T* p) const { return value_ != p; }
-  template <typename U>
-  bool operator==(linked_ptr<U> const& ptr) const {
-    return value_ == ptr.get();
-  }
-  template <typename U>
-  bool operator!=(linked_ptr<U> const& ptr) const {
-    return value_ != ptr.get();
-  }
-
- private:
-  template <typename U>
-  friend class linked_ptr;
-
-  T* value_;
-  linked_ptr_internal link_;
-
-  void depart() {
-    if (link_.depart()) delete value_;
-  }
-
-  void capture(T* ptr) {
-    value_ = ptr;
-    link_.join_new();
-  }
-
-  template <typename U> void copy(linked_ptr<U> const* ptr) {
-    value_ = ptr->get();
-    if (value_)
-      link_.join(&ptr->link_);
-    else
-      link_.join_new();
-  }
-};
-
-template<typename T> inline
-bool operator==(T* ptr, const linked_ptr<T>& x) {
-  return ptr == x.get();
-}
-
-template<typename T> inline
-bool operator!=(T* ptr, const linked_ptr<T>& x) {
-  return ptr != x.get();
-}
-
-// A function to convert T* into linked_ptr<T>
-// Doing e.g. make_linked_ptr(new FooBarBaz<type>(arg)) is a shorter notation
-// for linked_ptr<FooBarBaz<type> >(new FooBarBaz<type>(arg))
-template <typename T>
-linked_ptr<T> make_linked_ptr(T* ptr) {
-  return linked_ptr<T>(ptr);
-}
-
-}  // namespace internal
-}  // namespace testing
-
-#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
diff --git a/third_party/gtest/include/gtest/internal/gtest-param-util-generated.h b/third_party/gtest/include/gtest/internal/gtest-param-util-generated.h
deleted file mode 100644
index ab4ab56..0000000
--- a/third_party/gtest/include/gtest/internal/gtest-param-util-generated.h
+++ /dev/null
@@ -1,4820 +0,0 @@
-// This file was GENERATED by a script.  DO NOT EDIT BY HAND!!!
-
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: vladl@google.com (Vlad Losev)
-
-// Type and function utilities for implementing parameterized tests.
-// This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!
-//
-// Currently Google Test supports at most 50 arguments in Values,
-// and at most 10 arguments in Combine. Please contact
-// googletestframework@googlegroups.com if you need more.
-// Please note that the number of arguments to Combine is limited
-// by the maximum arity of the implementation of tr1::tuple which is
-// currently set at 10.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
-
-// scripts/fuse_gtest.py depends on gtest's own header being #included
-// *unconditionally*.  Therefore these #includes cannot be moved
-// inside #if GTEST_HAS_PARAM_TEST.
-#include <gtest/internal/gtest-param-util.h>
-#include <gtest/internal/gtest-port.h>
-
-#if GTEST_HAS_PARAM_TEST
-
-namespace testing {
-
-// Forward declarations of ValuesIn(), which is implemented in
-// include/gtest/gtest-param-test.h.
-template <typename ForwardIterator>
-internal::ParamGenerator<
-    typename ::std::iterator_traits<ForwardIterator>::value_type> ValuesIn(
-        ForwardIterator begin, ForwardIterator end);
-
-template <typename T, size_t N>
-internal::ParamGenerator<T> ValuesIn(const T (&array)[N]);
-
-template <class Container>
-internal::ParamGenerator<typename Container::value_type> ValuesIn(
-    const Container& container);
-
-namespace internal {
-
-// Used in the Values() function to provide polymorphic capabilities.
-template <typename T1>
-class ValueArray1 {
- public:
-  explicit ValueArray1(T1 v1) : v1_(v1) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const { return ValuesIn(&v1_, &v1_ + 1); }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray1& other);
-
-  const T1 v1_;
-};
-
-template <typename T1, typename T2>
-class ValueArray2 {
- public:
-  ValueArray2(T1 v1, T2 v2) : v1_(v1), v2_(v2) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray2& other);
-
-  const T1 v1_;
-  const T2 v2_;
-};
-
-template <typename T1, typename T2, typename T3>
-class ValueArray3 {
- public:
-  ValueArray3(T1 v1, T2 v2, T3 v3) : v1_(v1), v2_(v2), v3_(v3) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray3& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4>
-class ValueArray4 {
- public:
-  ValueArray4(T1 v1, T2 v2, T3 v3, T4 v4) : v1_(v1), v2_(v2), v3_(v3),
-      v4_(v4) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray4& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-class ValueArray5 {
- public:
-  ValueArray5(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) : v1_(v1), v2_(v2), v3_(v3),
-      v4_(v4), v5_(v5) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray5& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6>
-class ValueArray6 {
- public:
-  ValueArray6(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6) : v1_(v1), v2_(v2),
-      v3_(v3), v4_(v4), v5_(v5), v6_(v6) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray6& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7>
-class ValueArray7 {
- public:
-  ValueArray7(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7) : v1_(v1),
-      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray7& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8>
-class ValueArray8 {
- public:
-  ValueArray8(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
-      T8 v8) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
-      v8_(v8) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray8& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9>
-class ValueArray9 {
- public:
-  ValueArray9(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
-      T9 v9) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
-      v8_(v8), v9_(v9) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray9& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10>
-class ValueArray10 {
- public:
-  ValueArray10(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
-      v8_(v8), v9_(v9), v10_(v10) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray10& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11>
-class ValueArray11 {
- public:
-  ValueArray11(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
-      v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray11& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12>
-class ValueArray12 {
- public:
-  ValueArray12(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
-      v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray12& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13>
-class ValueArray13 {
- public:
-  ValueArray13(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
-      v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
-      v12_(v12), v13_(v13) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray13& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14>
-class ValueArray14 {
- public:
-  ValueArray14(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) : v1_(v1), v2_(v2), v3_(v3),
-      v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
-      v11_(v11), v12_(v12), v13_(v13), v14_(v14) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray14& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15>
-class ValueArray15 {
- public:
-  ValueArray15(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) : v1_(v1), v2_(v2),
-      v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
-      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray15& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16>
-class ValueArray16 {
- public:
-  ValueArray16(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16) : v1_(v1),
-      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
-      v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
-      v16_(v16) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray16& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17>
-class ValueArray17 {
- public:
-  ValueArray17(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
-      T17 v17) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
-      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
-      v15_(v15), v16_(v16), v17_(v17) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray17& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18>
-class ValueArray18 {
- public:
-  ValueArray18(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
-      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
-      v15_(v15), v16_(v16), v17_(v17), v18_(v18) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray18& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19>
-class ValueArray19 {
- public:
-  ValueArray19(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
-      v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
-      v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray19& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20>
-class ValueArray20 {
- public:
-  ValueArray20(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
-      v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
-      v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
-      v19_(v19), v20_(v20) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray20& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21>
-class ValueArray21 {
- public:
-  ValueArray21(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
-      v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
-      v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
-      v18_(v18), v19_(v19), v20_(v20), v21_(v21) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray21& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22>
-class ValueArray22 {
- public:
-  ValueArray22(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22) : v1_(v1), v2_(v2), v3_(v3),
-      v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
-      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
-      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray22& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23>
-class ValueArray23 {
- public:
-  ValueArray23(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23) : v1_(v1), v2_(v2),
-      v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
-      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
-      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
-      v23_(v23) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_,
-        v23_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray23& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24>
-class ValueArray24 {
- public:
-  ValueArray24(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24) : v1_(v1),
-      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
-      v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
-      v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
-      v22_(v22), v23_(v23), v24_(v24) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray24& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25>
-class ValueArray25 {
- public:
-  ValueArray25(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
-      T25 v25) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
-      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
-      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
-      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray25& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26>
-class ValueArray26 {
- public:
-  ValueArray26(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
-      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
-      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
-      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray26& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27>
-class ValueArray27 {
- public:
-  ValueArray27(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
-      v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
-      v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
-      v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
-      v26_(v26), v27_(v27) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray27& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28>
-class ValueArray28 {
- public:
-  ValueArray28(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
-      v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
-      v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
-      v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
-      v25_(v25), v26_(v26), v27_(v27), v28_(v28) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray28& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29>
-class ValueArray29 {
- public:
-  ValueArray29(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28, T29 v29) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
-      v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
-      v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
-      v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
-      v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray29& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-  const T29 v29_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30>
-class ValueArray30 {
- public:
-  ValueArray30(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) : v1_(v1), v2_(v2), v3_(v3),
-      v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
-      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
-      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
-      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
-      v29_(v29), v30_(v30) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray30& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-  const T29 v29_;
-  const T30 v30_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31>
-class ValueArray31 {
- public:
-  ValueArray31(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) : v1_(v1), v2_(v2),
-      v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
-      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
-      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
-      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
-      v29_(v29), v30_(v30), v31_(v31) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray31& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-  const T29 v29_;
-  const T30 v30_;
-  const T31 v31_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32>
-class ValueArray32 {
- public:
-  ValueArray32(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32) : v1_(v1),
-      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
-      v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
-      v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
-      v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
-      v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray32& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-  const T29 v29_;
-  const T30 v30_;
-  const T31 v31_;
-  const T32 v32_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33>
-class ValueArray33 {
- public:
-  ValueArray33(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,
-      T33 v33) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
-      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
-      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
-      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
-      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
-      v33_(v33) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray33& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-  const T29 v29_;
-  const T30 v30_;
-  const T31 v31_;
-  const T32 v32_;
-  const T33 v33_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34>
-class ValueArray34 {
- public:
-  ValueArray34(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
-      T34 v34) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
-      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
-      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
-      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
-      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
-      v33_(v33), v34_(v34) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray34& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-  const T29 v29_;
-  const T30 v30_;
-  const T31 v31_;
-  const T32 v32_;
-  const T33 v33_;
-  const T34 v34_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35>
-class ValueArray35 {
- public:
-  ValueArray35(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
-      T34 v34, T35 v35) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
-      v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
-      v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
-      v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
-      v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),
-      v32_(v32), v33_(v33), v34_(v34), v35_(v35) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_,
-        v35_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray35& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-  const T29 v29_;
-  const T30 v30_;
-  const T31 v31_;
-  const T32 v32_;
-  const T33 v33_;
-  const T34 v34_;
-  const T35 v35_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36>
-class ValueArray36 {
- public:
-  ValueArray36(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
-      T34 v34, T35 v35, T36 v36) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
-      v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
-      v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
-      v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
-      v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),
-      v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray36& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-  const T29 v29_;
-  const T30 v30_;
-  const T31 v31_;
-  const T32 v32_;
-  const T33 v33_;
-  const T34 v34_;
-  const T35 v35_;
-  const T36 v36_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37>
-class ValueArray37 {
- public:
-  ValueArray37(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
-      T34 v34, T35 v35, T36 v36, T37 v37) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
-      v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
-      v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
-      v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
-      v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),
-      v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),
-      v36_(v36), v37_(v37) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray37& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-  const T29 v29_;
-  const T30 v30_;
-  const T31 v31_;
-  const T32 v32_;
-  const T33 v33_;
-  const T34 v34_;
-  const T35 v35_;
-  const T36 v36_;
-  const T37 v37_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38>
-class ValueArray38 {
- public:
-  ValueArray38(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
-      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38) : v1_(v1), v2_(v2), v3_(v3),
-      v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
-      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
-      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
-      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
-      v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
-      v35_(v35), v36_(v36), v37_(v37), v38_(v38) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray38& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-  const T29 v29_;
-  const T30 v30_;
-  const T31 v31_;
-  const T32 v32_;
-  const T33 v33_;
-  const T34 v34_;
-  const T35 v35_;
-  const T36 v36_;
-  const T37 v37_;
-  const T38 v38_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39>
-class ValueArray39 {
- public:
-  ValueArray39(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
-      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39) : v1_(v1), v2_(v2),
-      v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
-      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
-      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
-      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
-      v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
-      v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray39& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-  const T29 v29_;
-  const T30 v30_;
-  const T31 v31_;
-  const T32 v32_;
-  const T33 v33_;
-  const T34 v34_;
-  const T35 v35_;
-  const T36 v36_;
-  const T37 v37_;
-  const T38 v38_;
-  const T39 v39_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40>
-class ValueArray40 {
- public:
-  ValueArray40(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
-      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) : v1_(v1),
-      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
-      v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
-      v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
-      v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
-      v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),
-      v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),
-      v40_(v40) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray40& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-  const T29 v29_;
-  const T30 v30_;
-  const T31 v31_;
-  const T32 v32_;
-  const T33 v33_;
-  const T34 v34_;
-  const T35 v35_;
-  const T36 v36_;
-  const T37 v37_;
-  const T38 v38_;
-  const T39 v39_;
-  const T40 v40_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41>
-class ValueArray41 {
- public:
-  ValueArray41(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
-      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,
-      T41 v41) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
-      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
-      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
-      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
-      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
-      v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
-      v39_(v39), v40_(v40), v41_(v41) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray41& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-  const T29 v29_;
-  const T30 v30_;
-  const T31 v31_;
-  const T32 v32_;
-  const T33 v33_;
-  const T34 v34_;
-  const T35 v35_;
-  const T36 v36_;
-  const T37 v37_;
-  const T38 v38_;
-  const T39 v39_;
-  const T40 v40_;
-  const T41 v41_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42>
-class ValueArray42 {
- public:
-  ValueArray42(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
-      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
-      T42 v42) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
-      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
-      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
-      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
-      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
-      v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
-      v39_(v39), v40_(v40), v41_(v41), v42_(v42) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray42& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-  const T29 v29_;
-  const T30 v30_;
-  const T31 v31_;
-  const T32 v32_;
-  const T33 v33_;
-  const T34 v34_;
-  const T35 v35_;
-  const T36 v36_;
-  const T37 v37_;
-  const T38 v38_;
-  const T39 v39_;
-  const T40 v40_;
-  const T41 v41_;
-  const T42 v42_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43>
-class ValueArray43 {
- public:
-  ValueArray43(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
-      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
-      T42 v42, T43 v43) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
-      v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
-      v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
-      v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
-      v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),
-      v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37),
-      v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray43& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-  const T29 v29_;
-  const T30 v30_;
-  const T31 v31_;
-  const T32 v32_;
-  const T33 v33_;
-  const T34 v34_;
-  const T35 v35_;
-  const T36 v36_;
-  const T37 v37_;
-  const T38 v38_;
-  const T39 v39_;
-  const T40 v40_;
-  const T41 v41_;
-  const T42 v42_;
-  const T43 v43_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44>
-class ValueArray44 {
- public:
-  ValueArray44(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
-      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
-      T42 v42, T43 v43, T44 v44) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
-      v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
-      v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
-      v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
-      v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),
-      v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36),
-      v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42),
-      v43_(v43), v44_(v44) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray44& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-  const T29 v29_;
-  const T30 v30_;
-  const T31 v31_;
-  const T32 v32_;
-  const T33 v33_;
-  const T34 v34_;
-  const T35 v35_;
-  const T36 v36_;
-  const T37 v37_;
-  const T38 v38_;
-  const T39 v39_;
-  const T40 v40_;
-  const T41 v41_;
-  const T42 v42_;
-  const T43 v43_;
-  const T44 v44_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45>
-class ValueArray45 {
- public:
-  ValueArray45(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
-      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
-      T42 v42, T43 v43, T44 v44, T45 v45) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
-      v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
-      v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
-      v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
-      v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),
-      v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),
-      v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41),
-      v42_(v42), v43_(v43), v44_(v44), v45_(v45) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray45& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-  const T29 v29_;
-  const T30 v30_;
-  const T31 v31_;
-  const T32 v32_;
-  const T33 v33_;
-  const T34 v34_;
-  const T35 v35_;
-  const T36 v36_;
-  const T37 v37_;
-  const T38 v38_;
-  const T39 v39_;
-  const T40 v40_;
-  const T41 v41_;
-  const T42 v42_;
-  const T43 v43_;
-  const T44 v44_;
-  const T45 v45_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45,
-    typename T46>
-class ValueArray46 {
- public:
-  ValueArray46(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
-      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
-      T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) : v1_(v1), v2_(v2), v3_(v3),
-      v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
-      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
-      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
-      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
-      v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
-      v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),
-      v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray46& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-  const T29 v29_;
-  const T30 v30_;
-  const T31 v31_;
-  const T32 v32_;
-  const T33 v33_;
-  const T34 v34_;
-  const T35 v35_;
-  const T36 v36_;
-  const T37 v37_;
-  const T38 v38_;
-  const T39 v39_;
-  const T40 v40_;
-  const T41 v41_;
-  const T42 v42_;
-  const T43 v43_;
-  const T44 v44_;
-  const T45 v45_;
-  const T46 v46_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45,
-    typename T46, typename T47>
-class ValueArray47 {
- public:
-  ValueArray47(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
-      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
-      T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) : v1_(v1), v2_(v2),
-      v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
-      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
-      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
-      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
-      v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
-      v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),
-      v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46),
-      v47_(v47) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_,
-        v47_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray47& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-  const T29 v29_;
-  const T30 v30_;
-  const T31 v31_;
-  const T32 v32_;
-  const T33 v33_;
-  const T34 v34_;
-  const T35 v35_;
-  const T36 v36_;
-  const T37 v37_;
-  const T38 v38_;
-  const T39 v39_;
-  const T40 v40_;
-  const T41 v41_;
-  const T42 v42_;
-  const T43 v43_;
-  const T44 v44_;
-  const T45 v45_;
-  const T46 v46_;
-  const T47 v47_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45,
-    typename T46, typename T47, typename T48>
-class ValueArray48 {
- public:
-  ValueArray48(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
-      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
-      T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48) : v1_(v1),
-      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
-      v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
-      v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
-      v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
-      v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),
-      v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),
-      v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45),
-      v46_(v46), v47_(v47), v48_(v48) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v47_,
-        v48_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray48& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-  const T29 v29_;
-  const T30 v30_;
-  const T31 v31_;
-  const T32 v32_;
-  const T33 v33_;
-  const T34 v34_;
-  const T35 v35_;
-  const T36 v36_;
-  const T37 v37_;
-  const T38 v38_;
-  const T39 v39_;
-  const T40 v40_;
-  const T41 v41_;
-  const T42 v42_;
-  const T43 v43_;
-  const T44 v44_;
-  const T45 v45_;
-  const T46 v46_;
-  const T47 v47_;
-  const T48 v48_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45,
-    typename T46, typename T47, typename T48, typename T49>
-class ValueArray49 {
- public:
-  ValueArray49(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
-      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
-      T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48,
-      T49 v49) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
-      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
-      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
-      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
-      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
-      v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
-      v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),
-      v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v47_,
-        v48_, v49_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray49& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-  const T29 v29_;
-  const T30 v30_;
-  const T31 v31_;
-  const T32 v32_;
-  const T33 v33_;
-  const T34 v34_;
-  const T35 v35_;
-  const T36 v36_;
-  const T37 v37_;
-  const T38 v38_;
-  const T39 v39_;
-  const T40 v40_;
-  const T41 v41_;
-  const T42 v42_;
-  const T43 v43_;
-  const T44 v44_;
-  const T45 v45_;
-  const T46 v46_;
-  const T47 v47_;
-  const T48 v48_;
-  const T49 v49_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45,
-    typename T46, typename T47, typename T48, typename T49, typename T50>
-class ValueArray50 {
- public:
-  ValueArray50(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
-      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
-      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
-      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
-      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
-      T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48, T49 v49,
-      T50 v50) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
-      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
-      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
-      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
-      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
-      v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
-      v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),
-      v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49), v50_(v50) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v47_,
-        v48_, v49_, v50_};
-    return ValuesIn(array);
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray50& other);
-
-  const T1 v1_;
-  const T2 v2_;
-  const T3 v3_;
-  const T4 v4_;
-  const T5 v5_;
-  const T6 v6_;
-  const T7 v7_;
-  const T8 v8_;
-  const T9 v9_;
-  const T10 v10_;
-  const T11 v11_;
-  const T12 v12_;
-  const T13 v13_;
-  const T14 v14_;
-  const T15 v15_;
-  const T16 v16_;
-  const T17 v17_;
-  const T18 v18_;
-  const T19 v19_;
-  const T20 v20_;
-  const T21 v21_;
-  const T22 v22_;
-  const T23 v23_;
-  const T24 v24_;
-  const T25 v25_;
-  const T26 v26_;
-  const T27 v27_;
-  const T28 v28_;
-  const T29 v29_;
-  const T30 v30_;
-  const T31 v31_;
-  const T32 v32_;
-  const T33 v33_;
-  const T34 v34_;
-  const T35 v35_;
-  const T36 v36_;
-  const T37 v37_;
-  const T38 v38_;
-  const T39 v39_;
-  const T40 v40_;
-  const T41 v41_;
-  const T42 v42_;
-  const T43 v43_;
-  const T44 v44_;
-  const T45 v45_;
-  const T46 v46_;
-  const T47 v47_;
-  const T48 v48_;
-  const T49 v49_;
-  const T50 v50_;
-};
-
-#if GTEST_HAS_COMBINE
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Generates values from the Cartesian product of values produced
-// by the argument generators.
-//
-template <typename T1, typename T2>
-class CartesianProductGenerator2
-    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2> > {
- public:
-  typedef ::std::tr1::tuple<T1, T2> ParamType;
-
-  CartesianProductGenerator2(const ParamGenerator<T1>& g1,
-      const ParamGenerator<T2>& g2)
-      : g1_(g1), g2_(g2) {}
-  virtual ~CartesianProductGenerator2() {}
-
-  virtual ParamIteratorInterface<ParamType>* Begin() const {
-    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin());
-  }
-  virtual ParamIteratorInterface<ParamType>* End() const {
-    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end());
-  }
-
- private:
-  class Iterator : public ParamIteratorInterface<ParamType> {
-   public:
-    Iterator(const ParamGeneratorInterface<ParamType>* base,
-      const ParamGenerator<T1>& g1,
-      const typename ParamGenerator<T1>::iterator& current1,
-      const ParamGenerator<T2>& g2,
-      const typename ParamGenerator<T2>::iterator& current2)
-        : base_(base),
-          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
-          begin2_(g2.begin()), end2_(g2.end()), current2_(current2)    {
-      ComputeCurrentValue();
-    }
-    virtual ~Iterator() {}
-
-    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
-      return base_;
-    }
-    // Advance should not be called on beyond-of-range iterators
-    // so no component iterators must be beyond end of range, either.
-    virtual void Advance() {
-      assert(!AtEnd());
-      ++current2_;
-      if (current2_ == end2_) {
-        current2_ = begin2_;
-        ++current1_;
-      }
-      ComputeCurrentValue();
-    }
-    virtual ParamIteratorInterface<ParamType>* Clone() const {
-      return new Iterator(*this);
-    }
-    virtual const ParamType* Current() const { return &current_value_; }
-    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
-      // Having the same base generator guarantees that the other
-      // iterator is of the same type and we can downcast.
-      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
-          << "The program attempted to compare iterators "
-          << "from different generators." << std::endl;
-      const Iterator* typed_other =
-          CheckedDowncastToActualType<const Iterator>(&other);
-      // We must report iterators equal if they both point beyond their
-      // respective ranges. That can happen in a variety of fashions,
-      // so we have to consult AtEnd().
-      return (AtEnd() && typed_other->AtEnd()) ||
-         (
-          current1_ == typed_other->current1_ &&
-          current2_ == typed_other->current2_);
-    }
-
-   private:
-    Iterator(const Iterator& other)
-        : base_(other.base_),
-        begin1_(other.begin1_),
-        end1_(other.end1_),
-        current1_(other.current1_),
-        begin2_(other.begin2_),
-        end2_(other.end2_),
-        current2_(other.current2_) {
-      ComputeCurrentValue();
-    }
-
-    void ComputeCurrentValue() {
-      if (!AtEnd())
-        current_value_ = ParamType(*current1_, *current2_);
-    }
-    bool AtEnd() const {
-      // We must report iterator past the end of the range when either of the
-      // component iterators has reached the end of its range.
-      return
-          current1_ == end1_ ||
-          current2_ == end2_;
-    }
-
-    // No implementation - assignment is unsupported.
-    void operator=(const Iterator& other);
-
-    const ParamGeneratorInterface<ParamType>* const base_;
-    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
-    // current[i]_ is the actual traversing iterator.
-    const typename ParamGenerator<T1>::iterator begin1_;
-    const typename ParamGenerator<T1>::iterator end1_;
-    typename ParamGenerator<T1>::iterator current1_;
-    const typename ParamGenerator<T2>::iterator begin2_;
-    const typename ParamGenerator<T2>::iterator end2_;
-    typename ParamGenerator<T2>::iterator current2_;
-    ParamType current_value_;
-  };  // class CartesianProductGenerator2::Iterator
-
-  // No implementation - assignment is unsupported.
-  void operator=(const CartesianProductGenerator2& other);
-
-  const ParamGenerator<T1> g1_;
-  const ParamGenerator<T2> g2_;
-};  // class CartesianProductGenerator2
-
-
-template <typename T1, typename T2, typename T3>
-class CartesianProductGenerator3
-    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3> > {
- public:
-  typedef ::std::tr1::tuple<T1, T2, T3> ParamType;
-
-  CartesianProductGenerator3(const ParamGenerator<T1>& g1,
-      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3)
-      : g1_(g1), g2_(g2), g3_(g3) {}
-  virtual ~CartesianProductGenerator3() {}
-
-  virtual ParamIteratorInterface<ParamType>* Begin() const {
-    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
-        g3_.begin());
-  }
-  virtual ParamIteratorInterface<ParamType>* End() const {
-    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end());
-  }
-
- private:
-  class Iterator : public ParamIteratorInterface<ParamType> {
-   public:
-    Iterator(const ParamGeneratorInterface<ParamType>* base,
-      const ParamGenerator<T1>& g1,
-      const typename ParamGenerator<T1>::iterator& current1,
-      const ParamGenerator<T2>& g2,
-      const typename ParamGenerator<T2>::iterator& current2,
-      const ParamGenerator<T3>& g3,
-      const typename ParamGenerator<T3>::iterator& current3)
-        : base_(base),
-          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
-          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
-          begin3_(g3.begin()), end3_(g3.end()), current3_(current3)    {
-      ComputeCurrentValue();
-    }
-    virtual ~Iterator() {}
-
-    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
-      return base_;
-    }
-    // Advance should not be called on beyond-of-range iterators
-    // so no component iterators must be beyond end of range, either.
-    virtual void Advance() {
-      assert(!AtEnd());
-      ++current3_;
-      if (current3_ == end3_) {
-        current3_ = begin3_;
-        ++current2_;
-      }
-      if (current2_ == end2_) {
-        current2_ = begin2_;
-        ++current1_;
-      }
-      ComputeCurrentValue();
-    }
-    virtual ParamIteratorInterface<ParamType>* Clone() const {
-      return new Iterator(*this);
-    }
-    virtual const ParamType* Current() const { return &current_value_; }
-    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
-      // Having the same base generator guarantees that the other
-      // iterator is of the same type and we can downcast.
-      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
-          << "The program attempted to compare iterators "
-          << "from different generators." << std::endl;
-      const Iterator* typed_other =
-          CheckedDowncastToActualType<const Iterator>(&other);
-      // We must report iterators equal if they both point beyond their
-      // respective ranges. That can happen in a variety of fashions,
-      // so we have to consult AtEnd().
-      return (AtEnd() && typed_other->AtEnd()) ||
-         (
-          current1_ == typed_other->current1_ &&
-          current2_ == typed_other->current2_ &&
-          current3_ == typed_other->current3_);
-    }
-
-   private:
-    Iterator(const Iterator& other)
-        : base_(other.base_),
-        begin1_(other.begin1_),
-        end1_(other.end1_),
-        current1_(other.current1_),
-        begin2_(other.begin2_),
-        end2_(other.end2_),
-        current2_(other.current2_),
-        begin3_(other.begin3_),
-        end3_(other.end3_),
-        current3_(other.current3_) {
-      ComputeCurrentValue();
-    }
-
-    void ComputeCurrentValue() {
-      if (!AtEnd())
-        current_value_ = ParamType(*current1_, *current2_, *current3_);
-    }
-    bool AtEnd() const {
-      // We must report iterator past the end of the range when either of the
-      // component iterators has reached the end of its range.
-      return
-          current1_ == end1_ ||
-          current2_ == end2_ ||
-          current3_ == end3_;
-    }
-
-    // No implementation - assignment is unsupported.
-    void operator=(const Iterator& other);
-
-    const ParamGeneratorInterface<ParamType>* const base_;
-    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
-    // current[i]_ is the actual traversing iterator.
-    const typename ParamGenerator<T1>::iterator begin1_;
-    const typename ParamGenerator<T1>::iterator end1_;
-    typename ParamGenerator<T1>::iterator current1_;
-    const typename ParamGenerator<T2>::iterator begin2_;
-    const typename ParamGenerator<T2>::iterator end2_;
-    typename ParamGenerator<T2>::iterator current2_;
-    const typename ParamGenerator<T3>::iterator begin3_;
-    const typename ParamGenerator<T3>::iterator end3_;
-    typename ParamGenerator<T3>::iterator current3_;
-    ParamType current_value_;
-  };  // class CartesianProductGenerator3::Iterator
-
-  // No implementation - assignment is unsupported.
-  void operator=(const CartesianProductGenerator3& other);
-
-  const ParamGenerator<T1> g1_;
-  const ParamGenerator<T2> g2_;
-  const ParamGenerator<T3> g3_;
-};  // class CartesianProductGenerator3
-
-
-template <typename T1, typename T2, typename T3, typename T4>
-class CartesianProductGenerator4
-    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4> > {
- public:
-  typedef ::std::tr1::tuple<T1, T2, T3, T4> ParamType;
-
-  CartesianProductGenerator4(const ParamGenerator<T1>& g1,
-      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
-      const ParamGenerator<T4>& g4)
-      : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
-  virtual ~CartesianProductGenerator4() {}
-
-  virtual ParamIteratorInterface<ParamType>* Begin() const {
-    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
-        g3_.begin(), g4_, g4_.begin());
-  }
-  virtual ParamIteratorInterface<ParamType>* End() const {
-    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
-        g4_, g4_.end());
-  }
-
- private:
-  class Iterator : public ParamIteratorInterface<ParamType> {
-   public:
-    Iterator(const ParamGeneratorInterface<ParamType>* base,
-      const ParamGenerator<T1>& g1,
-      const typename ParamGenerator<T1>::iterator& current1,
-      const ParamGenerator<T2>& g2,
-      const typename ParamGenerator<T2>::iterator& current2,
-      const ParamGenerator<T3>& g3,
-      const typename ParamGenerator<T3>::iterator& current3,
-      const ParamGenerator<T4>& g4,
-      const typename ParamGenerator<T4>::iterator& current4)
-        : base_(base),
-          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
-          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
-          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
-          begin4_(g4.begin()), end4_(g4.end()), current4_(current4)    {
-      ComputeCurrentValue();
-    }
-    virtual ~Iterator() {}
-
-    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
-      return base_;
-    }
-    // Advance should not be called on beyond-of-range iterators
-    // so no component iterators must be beyond end of range, either.
-    virtual void Advance() {
-      assert(!AtEnd());
-      ++current4_;
-      if (current4_ == end4_) {
-        current4_ = begin4_;
-        ++current3_;
-      }
-      if (current3_ == end3_) {
-        current3_ = begin3_;
-        ++current2_;
-      }
-      if (current2_ == end2_) {
-        current2_ = begin2_;
-        ++current1_;
-      }
-      ComputeCurrentValue();
-    }
-    virtual ParamIteratorInterface<ParamType>* Clone() const {
-      return new Iterator(*this);
-    }
-    virtual const ParamType* Current() const { return &current_value_; }
-    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
-      // Having the same base generator guarantees that the other
-      // iterator is of the same type and we can downcast.
-      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
-          << "The program attempted to compare iterators "
-          << "from different generators." << std::endl;
-      const Iterator* typed_other =
-          CheckedDowncastToActualType<const Iterator>(&other);
-      // We must report iterators equal if they both point beyond their
-      // respective ranges. That can happen in a variety of fashions,
-      // so we have to consult AtEnd().
-      return (AtEnd() && typed_other->AtEnd()) ||
-         (
-          current1_ == typed_other->current1_ &&
-          current2_ == typed_other->current2_ &&
-          current3_ == typed_other->current3_ &&
-          current4_ == typed_other->current4_);
-    }
-
-   private:
-    Iterator(const Iterator& other)
-        : base_(other.base_),
-        begin1_(other.begin1_),
-        end1_(other.end1_),
-        current1_(other.current1_),
-        begin2_(other.begin2_),
-        end2_(other.end2_),
-        current2_(other.current2_),
-        begin3_(other.begin3_),
-        end3_(other.end3_),
-        current3_(other.current3_),
-        begin4_(other.begin4_),
-        end4_(other.end4_),
-        current4_(other.current4_) {
-      ComputeCurrentValue();
-    }
-
-    void ComputeCurrentValue() {
-      if (!AtEnd())
-        current_value_ = ParamType(*current1_, *current2_, *current3_,
-            *current4_);
-    }
-    bool AtEnd() const {
-      // We must report iterator past the end of the range when either of the
-      // component iterators has reached the end of its range.
-      return
-          current1_ == end1_ ||
-          current2_ == end2_ ||
-          current3_ == end3_ ||
-          current4_ == end4_;
-    }
-
-    // No implementation - assignment is unsupported.
-    void operator=(const Iterator& other);
-
-    const ParamGeneratorInterface<ParamType>* const base_;
-    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
-    // current[i]_ is the actual traversing iterator.
-    const typename ParamGenerator<T1>::iterator begin1_;
-    const typename ParamGenerator<T1>::iterator end1_;
-    typename ParamGenerator<T1>::iterator current1_;
-    const typename ParamGenerator<T2>::iterator begin2_;
-    const typename ParamGenerator<T2>::iterator end2_;
-    typename ParamGenerator<T2>::iterator current2_;
-    const typename ParamGenerator<T3>::iterator begin3_;
-    const typename ParamGenerator<T3>::iterator end3_;
-    typename ParamGenerator<T3>::iterator current3_;
-    const typename ParamGenerator<T4>::iterator begin4_;
-    const typename ParamGenerator<T4>::iterator end4_;
-    typename ParamGenerator<T4>::iterator current4_;
-    ParamType current_value_;
-  };  // class CartesianProductGenerator4::Iterator
-
-  // No implementation - assignment is unsupported.
-  void operator=(const CartesianProductGenerator4& other);
-
-  const ParamGenerator<T1> g1_;
-  const ParamGenerator<T2> g2_;
-  const ParamGenerator<T3> g3_;
-  const ParamGenerator<T4> g4_;
-};  // class CartesianProductGenerator4
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-class CartesianProductGenerator5
-    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5> > {
- public:
-  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5> ParamType;
-
-  CartesianProductGenerator5(const ParamGenerator<T1>& g1,
-      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
-      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5)
-      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
-  virtual ~CartesianProductGenerator5() {}
-
-  virtual ParamIteratorInterface<ParamType>* Begin() const {
-    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
-        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin());
-  }
-  virtual ParamIteratorInterface<ParamType>* End() const {
-    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
-        g4_, g4_.end(), g5_, g5_.end());
-  }
-
- private:
-  class Iterator : public ParamIteratorInterface<ParamType> {
-   public:
-    Iterator(const ParamGeneratorInterface<ParamType>* base,
-      const ParamGenerator<T1>& g1,
-      const typename ParamGenerator<T1>::iterator& current1,
-      const ParamGenerator<T2>& g2,
-      const typename ParamGenerator<T2>::iterator& current2,
-      const ParamGenerator<T3>& g3,
-      const typename ParamGenerator<T3>::iterator& current3,
-      const ParamGenerator<T4>& g4,
-      const typename ParamGenerator<T4>::iterator& current4,
-      const ParamGenerator<T5>& g5,
-      const typename ParamGenerator<T5>::iterator& current5)
-        : base_(base),
-          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
-          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
-          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
-          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
-          begin5_(g5.begin()), end5_(g5.end()), current5_(current5)    {
-      ComputeCurrentValue();
-    }
-    virtual ~Iterator() {}
-
-    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
-      return base_;
-    }
-    // Advance should not be called on beyond-of-range iterators
-    // so no component iterators must be beyond end of range, either.
-    virtual void Advance() {
-      assert(!AtEnd());
-      ++current5_;
-      if (current5_ == end5_) {
-        current5_ = begin5_;
-        ++current4_;
-      }
-      if (current4_ == end4_) {
-        current4_ = begin4_;
-        ++current3_;
-      }
-      if (current3_ == end3_) {
-        current3_ = begin3_;
-        ++current2_;
-      }
-      if (current2_ == end2_) {
-        current2_ = begin2_;
-        ++current1_;
-      }
-      ComputeCurrentValue();
-    }
-    virtual ParamIteratorInterface<ParamType>* Clone() const {
-      return new Iterator(*this);
-    }
-    virtual const ParamType* Current() const { return &current_value_; }
-    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
-      // Having the same base generator guarantees that the other
-      // iterator is of the same type and we can downcast.
-      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
-          << "The program attempted to compare iterators "
-          << "from different generators." << std::endl;
-      const Iterator* typed_other =
-          CheckedDowncastToActualType<const Iterator>(&other);
-      // We must report iterators equal if they both point beyond their
-      // respective ranges. That can happen in a variety of fashions,
-      // so we have to consult AtEnd().
-      return (AtEnd() && typed_other->AtEnd()) ||
-         (
-          current1_ == typed_other->current1_ &&
-          current2_ == typed_other->current2_ &&
-          current3_ == typed_other->current3_ &&
-          current4_ == typed_other->current4_ &&
-          current5_ == typed_other->current5_);
-    }
-
-   private:
-    Iterator(const Iterator& other)
-        : base_(other.base_),
-        begin1_(other.begin1_),
-        end1_(other.end1_),
-        current1_(other.current1_),
-        begin2_(other.begin2_),
-        end2_(other.end2_),
-        current2_(other.current2_),
-        begin3_(other.begin3_),
-        end3_(other.end3_),
-        current3_(other.current3_),
-        begin4_(other.begin4_),
-        end4_(other.end4_),
-        current4_(other.current4_),
-        begin5_(other.begin5_),
-        end5_(other.end5_),
-        current5_(other.current5_) {
-      ComputeCurrentValue();
-    }
-
-    void ComputeCurrentValue() {
-      if (!AtEnd())
-        current_value_ = ParamType(*current1_, *current2_, *current3_,
-            *current4_, *current5_);
-    }
-    bool AtEnd() const {
-      // We must report iterator past the end of the range when either of the
-      // component iterators has reached the end of its range.
-      return
-          current1_ == end1_ ||
-          current2_ == end2_ ||
-          current3_ == end3_ ||
-          current4_ == end4_ ||
-          current5_ == end5_;
-    }
-
-    // No implementation - assignment is unsupported.
-    void operator=(const Iterator& other);
-
-    const ParamGeneratorInterface<ParamType>* const base_;
-    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
-    // current[i]_ is the actual traversing iterator.
-    const typename ParamGenerator<T1>::iterator begin1_;
-    const typename ParamGenerator<T1>::iterator end1_;
-    typename ParamGenerator<T1>::iterator current1_;
-    const typename ParamGenerator<T2>::iterator begin2_;
-    const typename ParamGenerator<T2>::iterator end2_;
-    typename ParamGenerator<T2>::iterator current2_;
-    const typename ParamGenerator<T3>::iterator begin3_;
-    const typename ParamGenerator<T3>::iterator end3_;
-    typename ParamGenerator<T3>::iterator current3_;
-    const typename ParamGenerator<T4>::iterator begin4_;
-    const typename ParamGenerator<T4>::iterator end4_;
-    typename ParamGenerator<T4>::iterator current4_;
-    const typename ParamGenerator<T5>::iterator begin5_;
-    const typename ParamGenerator<T5>::iterator end5_;
-    typename ParamGenerator<T5>::iterator current5_;
-    ParamType current_value_;
-  };  // class CartesianProductGenerator5::Iterator
-
-  // No implementation - assignment is unsupported.
-  void operator=(const CartesianProductGenerator5& other);
-
-  const ParamGenerator<T1> g1_;
-  const ParamGenerator<T2> g2_;
-  const ParamGenerator<T3> g3_;
-  const ParamGenerator<T4> g4_;
-  const ParamGenerator<T5> g5_;
-};  // class CartesianProductGenerator5
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6>
-class CartesianProductGenerator6
-    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5,
-        T6> > {
- public:
-  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> ParamType;
-
-  CartesianProductGenerator6(const ParamGenerator<T1>& g1,
-      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
-      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
-      const ParamGenerator<T6>& g6)
-      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
-  virtual ~CartesianProductGenerator6() {}
-
-  virtual ParamIteratorInterface<ParamType>* Begin() const {
-    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
-        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin());
-  }
-  virtual ParamIteratorInterface<ParamType>* End() const {
-    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
-        g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end());
-  }
-
- private:
-  class Iterator : public ParamIteratorInterface<ParamType> {
-   public:
-    Iterator(const ParamGeneratorInterface<ParamType>* base,
-      const ParamGenerator<T1>& g1,
-      const typename ParamGenerator<T1>::iterator& current1,
-      const ParamGenerator<T2>& g2,
-      const typename ParamGenerator<T2>::iterator& current2,
-      const ParamGenerator<T3>& g3,
-      const typename ParamGenerator<T3>::iterator& current3,
-      const ParamGenerator<T4>& g4,
-      const typename ParamGenerator<T4>::iterator& current4,
-      const ParamGenerator<T5>& g5,
-      const typename ParamGenerator<T5>::iterator& current5,
-      const ParamGenerator<T6>& g6,
-      const typename ParamGenerator<T6>::iterator& current6)
-        : base_(base),
-          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
-          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
-          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
-          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
-          begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
-          begin6_(g6.begin()), end6_(g6.end()), current6_(current6)    {
-      ComputeCurrentValue();
-    }
-    virtual ~Iterator() {}
-
-    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
-      return base_;
-    }
-    // Advance should not be called on beyond-of-range iterators
-    // so no component iterators must be beyond end of range, either.
-    virtual void Advance() {
-      assert(!AtEnd());
-      ++current6_;
-      if (current6_ == end6_) {
-        current6_ = begin6_;
-        ++current5_;
-      }
-      if (current5_ == end5_) {
-        current5_ = begin5_;
-        ++current4_;
-      }
-      if (current4_ == end4_) {
-        current4_ = begin4_;
-        ++current3_;
-      }
-      if (current3_ == end3_) {
-        current3_ = begin3_;
-        ++current2_;
-      }
-      if (current2_ == end2_) {
-        current2_ = begin2_;
-        ++current1_;
-      }
-      ComputeCurrentValue();
-    }
-    virtual ParamIteratorInterface<ParamType>* Clone() const {
-      return new Iterator(*this);
-    }
-    virtual const ParamType* Current() const { return &current_value_; }
-    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
-      // Having the same base generator guarantees that the other
-      // iterator is of the same type and we can downcast.
-      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
-          << "The program attempted to compare iterators "
-          << "from different generators." << std::endl;
-      const Iterator* typed_other =
-          CheckedDowncastToActualType<const Iterator>(&other);
-      // We must report iterators equal if they both point beyond their
-      // respective ranges. That can happen in a variety of fashions,
-      // so we have to consult AtEnd().
-      return (AtEnd() && typed_other->AtEnd()) ||
-         (
-          current1_ == typed_other->current1_ &&
-          current2_ == typed_other->current2_ &&
-          current3_ == typed_other->current3_ &&
-          current4_ == typed_other->current4_ &&
-          current5_ == typed_other->current5_ &&
-          current6_ == typed_other->current6_);
-    }
-
-   private:
-    Iterator(const Iterator& other)
-        : base_(other.base_),
-        begin1_(other.begin1_),
-        end1_(other.end1_),
-        current1_(other.current1_),
-        begin2_(other.begin2_),
-        end2_(other.end2_),
-        current2_(other.current2_),
-        begin3_(other.begin3_),
-        end3_(other.end3_),
-        current3_(other.current3_),
-        begin4_(other.begin4_),
-        end4_(other.end4_),
-        current4_(other.current4_),
-        begin5_(other.begin5_),
-        end5_(other.end5_),
-        current5_(other.current5_),
-        begin6_(other.begin6_),
-        end6_(other.end6_),
-        current6_(other.current6_) {
-      ComputeCurrentValue();
-    }
-
-    void ComputeCurrentValue() {
-      if (!AtEnd())
-        current_value_ = ParamType(*current1_, *current2_, *current3_,
-            *current4_, *current5_, *current6_);
-    }
-    bool AtEnd() const {
-      // We must report iterator past the end of the range when either of the
-      // component iterators has reached the end of its range.
-      return
-          current1_ == end1_ ||
-          current2_ == end2_ ||
-          current3_ == end3_ ||
-          current4_ == end4_ ||
-          current5_ == end5_ ||
-          current6_ == end6_;
-    }
-
-    // No implementation - assignment is unsupported.
-    void operator=(const Iterator& other);
-
-    const ParamGeneratorInterface<ParamType>* const base_;
-    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
-    // current[i]_ is the actual traversing iterator.
-    const typename ParamGenerator<T1>::iterator begin1_;
-    const typename ParamGenerator<T1>::iterator end1_;
-    typename ParamGenerator<T1>::iterator current1_;
-    const typename ParamGenerator<T2>::iterator begin2_;
-    const typename ParamGenerator<T2>::iterator end2_;
-    typename ParamGenerator<T2>::iterator current2_;
-    const typename ParamGenerator<T3>::iterator begin3_;
-    const typename ParamGenerator<T3>::iterator end3_;
-    typename ParamGenerator<T3>::iterator current3_;
-    const typename ParamGenerator<T4>::iterator begin4_;
-    const typename ParamGenerator<T4>::iterator end4_;
-    typename ParamGenerator<T4>::iterator current4_;
-    const typename ParamGenerator<T5>::iterator begin5_;
-    const typename ParamGenerator<T5>::iterator end5_;
-    typename ParamGenerator<T5>::iterator current5_;
-    const typename ParamGenerator<T6>::iterator begin6_;
-    const typename ParamGenerator<T6>::iterator end6_;
-    typename ParamGenerator<T6>::iterator current6_;
-    ParamType current_value_;
-  };  // class CartesianProductGenerator6::Iterator
-
-  // No implementation - assignment is unsupported.
-  void operator=(const CartesianProductGenerator6& other);
-
-  const ParamGenerator<T1> g1_;
-  const ParamGenerator<T2> g2_;
-  const ParamGenerator<T3> g3_;
-  const ParamGenerator<T4> g4_;
-  const ParamGenerator<T5> g5_;
-  const ParamGenerator<T6> g6_;
-};  // class CartesianProductGenerator6
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7>
-class CartesianProductGenerator7
-    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
-        T7> > {
- public:
-  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7> ParamType;
-
-  CartesianProductGenerator7(const ParamGenerator<T1>& g1,
-      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
-      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
-      const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7)
-      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
-  virtual ~CartesianProductGenerator7() {}
-
-  virtual ParamIteratorInterface<ParamType>* Begin() const {
-    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
-        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
-        g7_.begin());
-  }
-  virtual ParamIteratorInterface<ParamType>* End() const {
-    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
-        g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end());
-  }
-
- private:
-  class Iterator : public ParamIteratorInterface<ParamType> {
-   public:
-    Iterator(const ParamGeneratorInterface<ParamType>* base,
-      const ParamGenerator<T1>& g1,
-      const typename ParamGenerator<T1>::iterator& current1,
-      const ParamGenerator<T2>& g2,
-      const typename ParamGenerator<T2>::iterator& current2,
-      const ParamGenerator<T3>& g3,
-      const typename ParamGenerator<T3>::iterator& current3,
-      const ParamGenerator<T4>& g4,
-      const typename ParamGenerator<T4>::iterator& current4,
-      const ParamGenerator<T5>& g5,
-      const typename ParamGenerator<T5>::iterator& current5,
-      const ParamGenerator<T6>& g6,
-      const typename ParamGenerator<T6>::iterator& current6,
-      const ParamGenerator<T7>& g7,
-      const typename ParamGenerator<T7>::iterator& current7)
-        : base_(base),
-          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
-          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
-          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
-          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
-          begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
-          begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
-          begin7_(g7.begin()), end7_(g7.end()), current7_(current7)    {
-      ComputeCurrentValue();
-    }
-    virtual ~Iterator() {}
-
-    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
-      return base_;
-    }
-    // Advance should not be called on beyond-of-range iterators
-    // so no component iterators must be beyond end of range, either.
-    virtual void Advance() {
-      assert(!AtEnd());
-      ++current7_;
-      if (current7_ == end7_) {
-        current7_ = begin7_;
-        ++current6_;
-      }
-      if (current6_ == end6_) {
-        current6_ = begin6_;
-        ++current5_;
-      }
-      if (current5_ == end5_) {
-        current5_ = begin5_;
-        ++current4_;
-      }
-      if (current4_ == end4_) {
-        current4_ = begin4_;
-        ++current3_;
-      }
-      if (current3_ == end3_) {
-        current3_ = begin3_;
-        ++current2_;
-      }
-      if (current2_ == end2_) {
-        current2_ = begin2_;
-        ++current1_;
-      }
-      ComputeCurrentValue();
-    }
-    virtual ParamIteratorInterface<ParamType>* Clone() const {
-      return new Iterator(*this);
-    }
-    virtual const ParamType* Current() const { return &current_value_; }
-    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
-      // Having the same base generator guarantees that the other
-      // iterator is of the same type and we can downcast.
-      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
-          << "The program attempted to compare iterators "
-          << "from different generators." << std::endl;
-      const Iterator* typed_other =
-          CheckedDowncastToActualType<const Iterator>(&other);
-      // We must report iterators equal if they both point beyond their
-      // respective ranges. That can happen in a variety of fashions,
-      // so we have to consult AtEnd().
-      return (AtEnd() && typed_other->AtEnd()) ||
-         (
-          current1_ == typed_other->current1_ &&
-          current2_ == typed_other->current2_ &&
-          current3_ == typed_other->current3_ &&
-          current4_ == typed_other->current4_ &&
-          current5_ == typed_other->current5_ &&
-          current6_ == typed_other->current6_ &&
-          current7_ == typed_other->current7_);
-    }
-
-   private:
-    Iterator(const Iterator& other)
-        : base_(other.base_),
-        begin1_(other.begin1_),
-        end1_(other.end1_),
-        current1_(other.current1_),
-        begin2_(other.begin2_),
-        end2_(other.end2_),
-        current2_(other.current2_),
-        begin3_(other.begin3_),
-        end3_(other.end3_),
-        current3_(other.current3_),
-        begin4_(other.begin4_),
-        end4_(other.end4_),
-        current4_(other.current4_),
-        begin5_(other.begin5_),
-        end5_(other.end5_),
-        current5_(other.current5_),
-        begin6_(other.begin6_),
-        end6_(other.end6_),
-        current6_(other.current6_),
-        begin7_(other.begin7_),
-        end7_(other.end7_),
-        current7_(other.current7_) {
-      ComputeCurrentValue();
-    }
-
-    void ComputeCurrentValue() {
-      if (!AtEnd())
-        current_value_ = ParamType(*current1_, *current2_, *current3_,
-            *current4_, *current5_, *current6_, *current7_);
-    }
-    bool AtEnd() const {
-      // We must report iterator past the end of the range when either of the
-      // component iterators has reached the end of its range.
-      return
-          current1_ == end1_ ||
-          current2_ == end2_ ||
-          current3_ == end3_ ||
-          current4_ == end4_ ||
-          current5_ == end5_ ||
-          current6_ == end6_ ||
-          current7_ == end7_;
-    }
-
-    // No implementation - assignment is unsupported.
-    void operator=(const Iterator& other);
-
-    const ParamGeneratorInterface<ParamType>* const base_;
-    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
-    // current[i]_ is the actual traversing iterator.
-    const typename ParamGenerator<T1>::iterator begin1_;
-    const typename ParamGenerator<T1>::iterator end1_;
-    typename ParamGenerator<T1>::iterator current1_;
-    const typename ParamGenerator<T2>::iterator begin2_;
-    const typename ParamGenerator<T2>::iterator end2_;
-    typename ParamGenerator<T2>::iterator current2_;
-    const typename ParamGenerator<T3>::iterator begin3_;
-    const typename ParamGenerator<T3>::iterator end3_;
-    typename ParamGenerator<T3>::iterator current3_;
-    const typename ParamGenerator<T4>::iterator begin4_;
-    const typename ParamGenerator<T4>::iterator end4_;
-    typename ParamGenerator<T4>::iterator current4_;
-    const typename ParamGenerator<T5>::iterator begin5_;
-    const typename ParamGenerator<T5>::iterator end5_;
-    typename ParamGenerator<T5>::iterator current5_;
-    const typename ParamGenerator<T6>::iterator begin6_;
-    const typename ParamGenerator<T6>::iterator end6_;
-    typename ParamGenerator<T6>::iterator current6_;
-    const typename ParamGenerator<T7>::iterator begin7_;
-    const typename ParamGenerator<T7>::iterator end7_;
-    typename ParamGenerator<T7>::iterator current7_;
-    ParamType current_value_;
-  };  // class CartesianProductGenerator7::Iterator
-
-  // No implementation - assignment is unsupported.
-  void operator=(const CartesianProductGenerator7& other);
-
-  const ParamGenerator<T1> g1_;
-  const ParamGenerator<T2> g2_;
-  const ParamGenerator<T3> g3_;
-  const ParamGenerator<T4> g4_;
-  const ParamGenerator<T5> g5_;
-  const ParamGenerator<T6> g6_;
-  const ParamGenerator<T7> g7_;
-};  // class CartesianProductGenerator7
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8>
-class CartesianProductGenerator8
-    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
-        T7, T8> > {
- public:
-  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8> ParamType;
-
-  CartesianProductGenerator8(const ParamGenerator<T1>& g1,
-      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
-      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
-      const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
-      const ParamGenerator<T8>& g8)
-      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),
-          g8_(g8) {}
-  virtual ~CartesianProductGenerator8() {}
-
-  virtual ParamIteratorInterface<ParamType>* Begin() const {
-    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
-        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
-        g7_.begin(), g8_, g8_.begin());
-  }
-  virtual ParamIteratorInterface<ParamType>* End() const {
-    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
-        g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
-        g8_.end());
-  }
-
- private:
-  class Iterator : public ParamIteratorInterface<ParamType> {
-   public:
-    Iterator(const ParamGeneratorInterface<ParamType>* base,
-      const ParamGenerator<T1>& g1,
-      const typename ParamGenerator<T1>::iterator& current1,
-      const ParamGenerator<T2>& g2,
-      const typename ParamGenerator<T2>::iterator& current2,
-      const ParamGenerator<T3>& g3,
-      const typename ParamGenerator<T3>::iterator& current3,
-      const ParamGenerator<T4>& g4,
-      const typename ParamGenerator<T4>::iterator& current4,
-      const ParamGenerator<T5>& g5,
-      const typename ParamGenerator<T5>::iterator& current5,
-      const ParamGenerator<T6>& g6,
-      const typename ParamGenerator<T6>::iterator& current6,
-      const ParamGenerator<T7>& g7,
-      const typename ParamGenerator<T7>::iterator& current7,
-      const ParamGenerator<T8>& g8,
-      const typename ParamGenerator<T8>::iterator& current8)
-        : base_(base),
-          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
-          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
-          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
-          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
-          begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
-          begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
-          begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
-          begin8_(g8.begin()), end8_(g8.end()), current8_(current8)    {
-      ComputeCurrentValue();
-    }
-    virtual ~Iterator() {}
-
-    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
-      return base_;
-    }
-    // Advance should not be called on beyond-of-range iterators
-    // so no component iterators must be beyond end of range, either.
-    virtual void Advance() {
-      assert(!AtEnd());
-      ++current8_;
-      if (current8_ == end8_) {
-        current8_ = begin8_;
-        ++current7_;
-      }
-      if (current7_ == end7_) {
-        current7_ = begin7_;
-        ++current6_;
-      }
-      if (current6_ == end6_) {
-        current6_ = begin6_;
-        ++current5_;
-      }
-      if (current5_ == end5_) {
-        current5_ = begin5_;
-        ++current4_;
-      }
-      if (current4_ == end4_) {
-        current4_ = begin4_;
-        ++current3_;
-      }
-      if (current3_ == end3_) {
-        current3_ = begin3_;
-        ++current2_;
-      }
-      if (current2_ == end2_) {
-        current2_ = begin2_;
-        ++current1_;
-      }
-      ComputeCurrentValue();
-    }
-    virtual ParamIteratorInterface<ParamType>* Clone() const {
-      return new Iterator(*this);
-    }
-    virtual const ParamType* Current() const { return &current_value_; }
-    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
-      // Having the same base generator guarantees that the other
-      // iterator is of the same type and we can downcast.
-      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
-          << "The program attempted to compare iterators "
-          << "from different generators." << std::endl;
-      const Iterator* typed_other =
-          CheckedDowncastToActualType<const Iterator>(&other);
-      // We must report iterators equal if they both point beyond their
-      // respective ranges. That can happen in a variety of fashions,
-      // so we have to consult AtEnd().
-      return (AtEnd() && typed_other->AtEnd()) ||
-         (
-          current1_ == typed_other->current1_ &&
-          current2_ == typed_other->current2_ &&
-          current3_ == typed_other->current3_ &&
-          current4_ == typed_other->current4_ &&
-          current5_ == typed_other->current5_ &&
-          current6_ == typed_other->current6_ &&
-          current7_ == typed_other->current7_ &&
-          current8_ == typed_other->current8_);
-    }
-
-   private:
-    Iterator(const Iterator& other)
-        : base_(other.base_),
-        begin1_(other.begin1_),
-        end1_(other.end1_),
-        current1_(other.current1_),
-        begin2_(other.begin2_),
-        end2_(other.end2_),
-        current2_(other.current2_),
-        begin3_(other.begin3_),
-        end3_(other.end3_),
-        current3_(other.current3_),
-        begin4_(other.begin4_),
-        end4_(other.end4_),
-        current4_(other.current4_),
-        begin5_(other.begin5_),
-        end5_(other.end5_),
-        current5_(other.current5_),
-        begin6_(other.begin6_),
-        end6_(other.end6_),
-        current6_(other.current6_),
-        begin7_(other.begin7_),
-        end7_(other.end7_),
-        current7_(other.current7_),
-        begin8_(other.begin8_),
-        end8_(other.end8_),
-        current8_(other.current8_) {
-      ComputeCurrentValue();
-    }
-
-    void ComputeCurrentValue() {
-      if (!AtEnd())
-        current_value_ = ParamType(*current1_, *current2_, *current3_,
-            *current4_, *current5_, *current6_, *current7_, *current8_);
-    }
-    bool AtEnd() const {
-      // We must report iterator past the end of the range when either of the
-      // component iterators has reached the end of its range.
-      return
-          current1_ == end1_ ||
-          current2_ == end2_ ||
-          current3_ == end3_ ||
-          current4_ == end4_ ||
-          current5_ == end5_ ||
-          current6_ == end6_ ||
-          current7_ == end7_ ||
-          current8_ == end8_;
-    }
-
-    // No implementation - assignment is unsupported.
-    void operator=(const Iterator& other);
-
-    const ParamGeneratorInterface<ParamType>* const base_;
-    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
-    // current[i]_ is the actual traversing iterator.
-    const typename ParamGenerator<T1>::iterator begin1_;
-    const typename ParamGenerator<T1>::iterator end1_;
-    typename ParamGenerator<T1>::iterator current1_;
-    const typename ParamGenerator<T2>::iterator begin2_;
-    const typename ParamGenerator<T2>::iterator end2_;
-    typename ParamGenerator<T2>::iterator current2_;
-    const typename ParamGenerator<T3>::iterator begin3_;
-    const typename ParamGenerator<T3>::iterator end3_;
-    typename ParamGenerator<T3>::iterator current3_;
-    const typename ParamGenerator<T4>::iterator begin4_;
-    const typename ParamGenerator<T4>::iterator end4_;
-    typename ParamGenerator<T4>::iterator current4_;
-    const typename ParamGenerator<T5>::iterator begin5_;
-    const typename ParamGenerator<T5>::iterator end5_;
-    typename ParamGenerator<T5>::iterator current5_;
-    const typename ParamGenerator<T6>::iterator begin6_;
-    const typename ParamGenerator<T6>::iterator end6_;
-    typename ParamGenerator<T6>::iterator current6_;
-    const typename ParamGenerator<T7>::iterator begin7_;
-    const typename ParamGenerator<T7>::iterator end7_;
-    typename ParamGenerator<T7>::iterator current7_;
-    const typename ParamGenerator<T8>::iterator begin8_;
-    const typename ParamGenerator<T8>::iterator end8_;
-    typename ParamGenerator<T8>::iterator current8_;
-    ParamType current_value_;
-  };  // class CartesianProductGenerator8::Iterator
-
-  // No implementation - assignment is unsupported.
-  void operator=(const CartesianProductGenerator8& other);
-
-  const ParamGenerator<T1> g1_;
-  const ParamGenerator<T2> g2_;
-  const ParamGenerator<T3> g3_;
-  const ParamGenerator<T4> g4_;
-  const ParamGenerator<T5> g5_;
-  const ParamGenerator<T6> g6_;
-  const ParamGenerator<T7> g7_;
-  const ParamGenerator<T8> g8_;
-};  // class CartesianProductGenerator8
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9>
-class CartesianProductGenerator9
-    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
-        T7, T8, T9> > {
- public:
-  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> ParamType;
-
-  CartesianProductGenerator9(const ParamGenerator<T1>& g1,
-      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
-      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
-      const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
-      const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9)
-      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
-          g9_(g9) {}
-  virtual ~CartesianProductGenerator9() {}
-
-  virtual ParamIteratorInterface<ParamType>* Begin() const {
-    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
-        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
-        g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin());
-  }
-  virtual ParamIteratorInterface<ParamType>* End() const {
-    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
-        g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
-        g8_.end(), g9_, g9_.end());
-  }
-
- private:
-  class Iterator : public ParamIteratorInterface<ParamType> {
-   public:
-    Iterator(const ParamGeneratorInterface<ParamType>* base,
-      const ParamGenerator<T1>& g1,
-      const typename ParamGenerator<T1>::iterator& current1,
-      const ParamGenerator<T2>& g2,
-      const typename ParamGenerator<T2>::iterator& current2,
-      const ParamGenerator<T3>& g3,
-      const typename ParamGenerator<T3>::iterator& current3,
-      const ParamGenerator<T4>& g4,
-      const typename ParamGenerator<T4>::iterator& current4,
-      const ParamGenerator<T5>& g5,
-      const typename ParamGenerator<T5>::iterator& current5,
-      const ParamGenerator<T6>& g6,
-      const typename ParamGenerator<T6>::iterator& current6,
-      const ParamGenerator<T7>& g7,
-      const typename ParamGenerator<T7>::iterator& current7,
-      const ParamGenerator<T8>& g8,
-      const typename ParamGenerator<T8>::iterator& current8,
-      const ParamGenerator<T9>& g9,
-      const typename ParamGenerator<T9>::iterator& current9)
-        : base_(base),
-          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
-          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
-          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
-          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
-          begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
-          begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
-          begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
-          begin8_(g8.begin()), end8_(g8.end()), current8_(current8),
-          begin9_(g9.begin()), end9_(g9.end()), current9_(current9)    {
-      ComputeCurrentValue();
-    }
-    virtual ~Iterator() {}
-
-    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
-      return base_;
-    }
-    // Advance should not be called on beyond-of-range iterators
-    // so no component iterators must be beyond end of range, either.
-    virtual void Advance() {
-      assert(!AtEnd());
-      ++current9_;
-      if (current9_ == end9_) {
-        current9_ = begin9_;
-        ++current8_;
-      }
-      if (current8_ == end8_) {
-        current8_ = begin8_;
-        ++current7_;
-      }
-      if (current7_ == end7_) {
-        current7_ = begin7_;
-        ++current6_;
-      }
-      if (current6_ == end6_) {
-        current6_ = begin6_;
-        ++current5_;
-      }
-      if (current5_ == end5_) {
-        current5_ = begin5_;
-        ++current4_;
-      }
-      if (current4_ == end4_) {
-        current4_ = begin4_;
-        ++current3_;
-      }
-      if (current3_ == end3_) {
-        current3_ = begin3_;
-        ++current2_;
-      }
-      if (current2_ == end2_) {
-        current2_ = begin2_;
-        ++current1_;
-      }
-      ComputeCurrentValue();
-    }
-    virtual ParamIteratorInterface<ParamType>* Clone() const {
-      return new Iterator(*this);
-    }
-    virtual const ParamType* Current() const { return &current_value_; }
-    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
-      // Having the same base generator guarantees that the other
-      // iterator is of the same type and we can downcast.
-      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
-          << "The program attempted to compare iterators "
-          << "from different generators." << std::endl;
-      const Iterator* typed_other =
-          CheckedDowncastToActualType<const Iterator>(&other);
-      // We must report iterators equal if they both point beyond their
-      // respective ranges. That can happen in a variety of fashions,
-      // so we have to consult AtEnd().
-      return (AtEnd() && typed_other->AtEnd()) ||
-         (
-          current1_ == typed_other->current1_ &&
-          current2_ == typed_other->current2_ &&
-          current3_ == typed_other->current3_ &&
-          current4_ == typed_other->current4_ &&
-          current5_ == typed_other->current5_ &&
-          current6_ == typed_other->current6_ &&
-          current7_ == typed_other->current7_ &&
-          current8_ == typed_other->current8_ &&
-          current9_ == typed_other->current9_);
-    }
-
-   private:
-    Iterator(const Iterator& other)
-        : base_(other.base_),
-        begin1_(other.begin1_),
-        end1_(other.end1_),
-        current1_(other.current1_),
-        begin2_(other.begin2_),
-        end2_(other.end2_),
-        current2_(other.current2_),
-        begin3_(other.begin3_),
-        end3_(other.end3_),
-        current3_(other.current3_),
-        begin4_(other.begin4_),
-        end4_(other.end4_),
-        current4_(other.current4_),
-        begin5_(other.begin5_),
-        end5_(other.end5_),
-        current5_(other.current5_),
-        begin6_(other.begin6_),
-        end6_(other.end6_),
-        current6_(other.current6_),
-        begin7_(other.begin7_),
-        end7_(other.end7_),
-        current7_(other.current7_),
-        begin8_(other.begin8_),
-        end8_(other.end8_),
-        current8_(other.current8_),
-        begin9_(other.begin9_),
-        end9_(other.end9_),
-        current9_(other.current9_) {
-      ComputeCurrentValue();
-    }
-
-    void ComputeCurrentValue() {
-      if (!AtEnd())
-        current_value_ = ParamType(*current1_, *current2_, *current3_,
-            *current4_, *current5_, *current6_, *current7_, *current8_,
-            *current9_);
-    }
-    bool AtEnd() const {
-      // We must report iterator past the end of the range when either of the
-      // component iterators has reached the end of its range.
-      return
-          current1_ == end1_ ||
-          current2_ == end2_ ||
-          current3_ == end3_ ||
-          current4_ == end4_ ||
-          current5_ == end5_ ||
-          current6_ == end6_ ||
-          current7_ == end7_ ||
-          current8_ == end8_ ||
-          current9_ == end9_;
-    }
-
-    // No implementation - assignment is unsupported.
-    void operator=(const Iterator& other);
-
-    const ParamGeneratorInterface<ParamType>* const base_;
-    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
-    // current[i]_ is the actual traversing iterator.
-    const typename ParamGenerator<T1>::iterator begin1_;
-    const typename ParamGenerator<T1>::iterator end1_;
-    typename ParamGenerator<T1>::iterator current1_;
-    const typename ParamGenerator<T2>::iterator begin2_;
-    const typename ParamGenerator<T2>::iterator end2_;
-    typename ParamGenerator<T2>::iterator current2_;
-    const typename ParamGenerator<T3>::iterator begin3_;
-    const typename ParamGenerator<T3>::iterator end3_;
-    typename ParamGenerator<T3>::iterator current3_;
-    const typename ParamGenerator<T4>::iterator begin4_;
-    const typename ParamGenerator<T4>::iterator end4_;
-    typename ParamGenerator<T4>::iterator current4_;
-    const typename ParamGenerator<T5>::iterator begin5_;
-    const typename ParamGenerator<T5>::iterator end5_;
-    typename ParamGenerator<T5>::iterator current5_;
-    const typename ParamGenerator<T6>::iterator begin6_;
-    const typename ParamGenerator<T6>::iterator end6_;
-    typename ParamGenerator<T6>::iterator current6_;
-    const typename ParamGenerator<T7>::iterator begin7_;
-    const typename ParamGenerator<T7>::iterator end7_;
-    typename ParamGenerator<T7>::iterator current7_;
-    const typename ParamGenerator<T8>::iterator begin8_;
-    const typename ParamGenerator<T8>::iterator end8_;
-    typename ParamGenerator<T8>::iterator current8_;
-    const typename ParamGenerator<T9>::iterator begin9_;
-    const typename ParamGenerator<T9>::iterator end9_;
-    typename ParamGenerator<T9>::iterator current9_;
-    ParamType current_value_;
-  };  // class CartesianProductGenerator9::Iterator
-
-  // No implementation - assignment is unsupported.
-  void operator=(const CartesianProductGenerator9& other);
-
-  const ParamGenerator<T1> g1_;
-  const ParamGenerator<T2> g2_;
-  const ParamGenerator<T3> g3_;
-  const ParamGenerator<T4> g4_;
-  const ParamGenerator<T5> g5_;
-  const ParamGenerator<T6> g6_;
-  const ParamGenerator<T7> g7_;
-  const ParamGenerator<T8> g8_;
-  const ParamGenerator<T9> g9_;
-};  // class CartesianProductGenerator9
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10>
-class CartesianProductGenerator10
-    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
-        T7, T8, T9, T10> > {
- public:
-  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ParamType;
-
-  CartesianProductGenerator10(const ParamGenerator<T1>& g1,
-      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
-      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
-      const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
-      const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9,
-      const ParamGenerator<T10>& g10)
-      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
-          g9_(g9), g10_(g10) {}
-  virtual ~CartesianProductGenerator10() {}
-
-  virtual ParamIteratorInterface<ParamType>* Begin() const {
-    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
-        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
-        g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin(), g10_, g10_.begin());
-  }
-  virtual ParamIteratorInterface<ParamType>* End() const {
-    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
-        g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
-        g8_.end(), g9_, g9_.end(), g10_, g10_.end());
-  }
-
- private:
-  class Iterator : public ParamIteratorInterface<ParamType> {
-   public:
-    Iterator(const ParamGeneratorInterface<ParamType>* base,
-      const ParamGenerator<T1>& g1,
-      const typename ParamGenerator<T1>::iterator& current1,
-      const ParamGenerator<T2>& g2,
-      const typename ParamGenerator<T2>::iterator& current2,
-      const ParamGenerator<T3>& g3,
-      const typename ParamGenerator<T3>::iterator& current3,
-      const ParamGenerator<T4>& g4,
-      const typename ParamGenerator<T4>::iterator& current4,
-      const ParamGenerator<T5>& g5,
-      const typename ParamGenerator<T5>::iterator& current5,
-      const ParamGenerator<T6>& g6,
-      const typename ParamGenerator<T6>::iterator& current6,
-      const ParamGenerator<T7>& g7,
-      const typename ParamGenerator<T7>::iterator& current7,
-      const ParamGenerator<T8>& g8,
-      const typename ParamGenerator<T8>::iterator& current8,
-      const ParamGenerator<T9>& g9,
-      const typename ParamGenerator<T9>::iterator& current9,
-      const ParamGenerator<T10>& g10,
-      const typename ParamGenerator<T10>::iterator& current10)
-        : base_(base),
-          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
-          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
-          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
-          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
-          begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
-          begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
-          begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
-          begin8_(g8.begin()), end8_(g8.end()), current8_(current8),
-          begin9_(g9.begin()), end9_(g9.end()), current9_(current9),
-          begin10_(g10.begin()), end10_(g10.end()), current10_(current10)    {
-      ComputeCurrentValue();
-    }
-    virtual ~Iterator() {}
-
-    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
-      return base_;
-    }
-    // Advance should not be called on beyond-of-range iterators
-    // so no component iterators must be beyond end of range, either.
-    virtual void Advance() {
-      assert(!AtEnd());
-      ++current10_;
-      if (current10_ == end10_) {
-        current10_ = begin10_;
-        ++current9_;
-      }
-      if (current9_ == end9_) {
-        current9_ = begin9_;
-        ++current8_;
-      }
-      if (current8_ == end8_) {
-        current8_ = begin8_;
-        ++current7_;
-      }
-      if (current7_ == end7_) {
-        current7_ = begin7_;
-        ++current6_;
-      }
-      if (current6_ == end6_) {
-        current6_ = begin6_;
-        ++current5_;
-      }
-      if (current5_ == end5_) {
-        current5_ = begin5_;
-        ++current4_;
-      }
-      if (current4_ == end4_) {
-        current4_ = begin4_;
-        ++current3_;
-      }
-      if (current3_ == end3_) {
-        current3_ = begin3_;
-        ++current2_;
-      }
-      if (current2_ == end2_) {
-        current2_ = begin2_;
-        ++current1_;
-      }
-      ComputeCurrentValue();
-    }
-    virtual ParamIteratorInterface<ParamType>* Clone() const {
-      return new Iterator(*this);
-    }
-    virtual const ParamType* Current() const { return &current_value_; }
-    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
-      // Having the same base generator guarantees that the other
-      // iterator is of the same type and we can downcast.
-      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
-          << "The program attempted to compare iterators "
-          << "from different generators." << std::endl;
-      const Iterator* typed_other =
-          CheckedDowncastToActualType<const Iterator>(&other);
-      // We must report iterators equal if they both point beyond their
-      // respective ranges. That can happen in a variety of fashions,
-      // so we have to consult AtEnd().
-      return (AtEnd() && typed_other->AtEnd()) ||
-         (
-          current1_ == typed_other->current1_ &&
-          current2_ == typed_other->current2_ &&
-          current3_ == typed_other->current3_ &&
-          current4_ == typed_other->current4_ &&
-          current5_ == typed_other->current5_ &&
-          current6_ == typed_other->current6_ &&
-          current7_ == typed_other->current7_ &&
-          current8_ == typed_other->current8_ &&
-          current9_ == typed_other->current9_ &&
-          current10_ == typed_other->current10_);
-    }
-
-   private:
-    Iterator(const Iterator& other)
-        : base_(other.base_),
-        begin1_(other.begin1_),
-        end1_(other.end1_),
-        current1_(other.current1_),
-        begin2_(other.begin2_),
-        end2_(other.end2_),
-        current2_(other.current2_),
-        begin3_(other.begin3_),
-        end3_(other.end3_),
-        current3_(other.current3_),
-        begin4_(other.begin4_),
-        end4_(other.end4_),
-        current4_(other.current4_),
-        begin5_(other.begin5_),
-        end5_(other.end5_),
-        current5_(other.current5_),
-        begin6_(other.begin6_),
-        end6_(other.end6_),
-        current6_(other.current6_),
-        begin7_(other.begin7_),
-        end7_(other.end7_),
-        current7_(other.current7_),
-        begin8_(other.begin8_),
-        end8_(other.end8_),
-        current8_(other.current8_),
-        begin9_(other.begin9_),
-        end9_(other.end9_),
-        current9_(other.current9_),
-        begin10_(other.begin10_),
-        end10_(other.end10_),
-        current10_(other.current10_) {
-      ComputeCurrentValue();
-    }
-
-    void ComputeCurrentValue() {
-      if (!AtEnd())
-        current_value_ = ParamType(*current1_, *current2_, *current3_,
-            *current4_, *current5_, *current6_, *current7_, *current8_,
-            *current9_, *current10_);
-    }
-    bool AtEnd() const {
-      // We must report iterator past the end of the range when either of the
-      // component iterators has reached the end of its range.
-      return
-          current1_ == end1_ ||
-          current2_ == end2_ ||
-          current3_ == end3_ ||
-          current4_ == end4_ ||
-          current5_ == end5_ ||
-          current6_ == end6_ ||
-          current7_ == end7_ ||
-          current8_ == end8_ ||
-          current9_ == end9_ ||
-          current10_ == end10_;
-    }
-
-    // No implementation - assignment is unsupported.
-    void operator=(const Iterator& other);
-
-    const ParamGeneratorInterface<ParamType>* const base_;
-    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
-    // current[i]_ is the actual traversing iterator.
-    const typename ParamGenerator<T1>::iterator begin1_;
-    const typename ParamGenerator<T1>::iterator end1_;
-    typename ParamGenerator<T1>::iterator current1_;
-    const typename ParamGenerator<T2>::iterator begin2_;
-    const typename ParamGenerator<T2>::iterator end2_;
-    typename ParamGenerator<T2>::iterator current2_;
-    const typename ParamGenerator<T3>::iterator begin3_;
-    const typename ParamGenerator<T3>::iterator end3_;
-    typename ParamGenerator<T3>::iterator current3_;
-    const typename ParamGenerator<T4>::iterator begin4_;
-    const typename ParamGenerator<T4>::iterator end4_;
-    typename ParamGenerator<T4>::iterator current4_;
-    const typename ParamGenerator<T5>::iterator begin5_;
-    const typename ParamGenerator<T5>::iterator end5_;
-    typename ParamGenerator<T5>::iterator current5_;
-    const typename ParamGenerator<T6>::iterator begin6_;
-    const typename ParamGenerator<T6>::iterator end6_;
-    typename ParamGenerator<T6>::iterator current6_;
-    const typename ParamGenerator<T7>::iterator begin7_;
-    const typename ParamGenerator<T7>::iterator end7_;
-    typename ParamGenerator<T7>::iterator current7_;
-    const typename ParamGenerator<T8>::iterator begin8_;
-    const typename ParamGenerator<T8>::iterator end8_;
-    typename ParamGenerator<T8>::iterator current8_;
-    const typename ParamGenerator<T9>::iterator begin9_;
-    const typename ParamGenerator<T9>::iterator end9_;
-    typename ParamGenerator<T9>::iterator current9_;
-    const typename ParamGenerator<T10>::iterator begin10_;
-    const typename ParamGenerator<T10>::iterator end10_;
-    typename ParamGenerator<T10>::iterator current10_;
-    ParamType current_value_;
-  };  // class CartesianProductGenerator10::Iterator
-
-  // No implementation - assignment is unsupported.
-  void operator=(const CartesianProductGenerator10& other);
-
-  const ParamGenerator<T1> g1_;
-  const ParamGenerator<T2> g2_;
-  const ParamGenerator<T3> g3_;
-  const ParamGenerator<T4> g4_;
-  const ParamGenerator<T5> g5_;
-  const ParamGenerator<T6> g6_;
-  const ParamGenerator<T7> g7_;
-  const ParamGenerator<T8> g8_;
-  const ParamGenerator<T9> g9_;
-  const ParamGenerator<T10> g10_;
-};  // class CartesianProductGenerator10
-
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Helper classes providing Combine() with polymorphic features. They allow
-// casting CartesianProductGeneratorN<T> to ParamGenerator<U> if T is
-// convertible to U.
-//
-template <class Generator1, class Generator2>
-class CartesianProductHolder2 {
- public:
-CartesianProductHolder2(const Generator1& g1, const Generator2& g2)
-      : g1_(g1), g2_(g2) {}
-  template <typename T1, typename T2>
-  operator ParamGenerator< ::std::tr1::tuple<T1, T2> >() const {
-    return ParamGenerator< ::std::tr1::tuple<T1, T2> >(
-        new CartesianProductGenerator2<T1, T2>(
-        static_cast<ParamGenerator<T1> >(g1_),
-        static_cast<ParamGenerator<T2> >(g2_)));
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const CartesianProductHolder2& other);
-
-  const Generator1 g1_;
-  const Generator2 g2_;
-};  // class CartesianProductHolder2
-
-template <class Generator1, class Generator2, class Generator3>
-class CartesianProductHolder3 {
- public:
-CartesianProductHolder3(const Generator1& g1, const Generator2& g2,
-    const Generator3& g3)
-      : g1_(g1), g2_(g2), g3_(g3) {}
-  template <typename T1, typename T2, typename T3>
-  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3> >() const {
-    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3> >(
-        new CartesianProductGenerator3<T1, T2, T3>(
-        static_cast<ParamGenerator<T1> >(g1_),
-        static_cast<ParamGenerator<T2> >(g2_),
-        static_cast<ParamGenerator<T3> >(g3_)));
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const CartesianProductHolder3& other);
-
-  const Generator1 g1_;
-  const Generator2 g2_;
-  const Generator3 g3_;
-};  // class CartesianProductHolder3
-
-template <class Generator1, class Generator2, class Generator3,
-    class Generator4>
-class CartesianProductHolder4 {
- public:
-CartesianProductHolder4(const Generator1& g1, const Generator2& g2,
-    const Generator3& g3, const Generator4& g4)
-      : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
-  template <typename T1, typename T2, typename T3, typename T4>
-  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4> >() const {
-    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4> >(
-        new CartesianProductGenerator4<T1, T2, T3, T4>(
-        static_cast<ParamGenerator<T1> >(g1_),
-        static_cast<ParamGenerator<T2> >(g2_),
-        static_cast<ParamGenerator<T3> >(g3_),
-        static_cast<ParamGenerator<T4> >(g4_)));
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const CartesianProductHolder4& other);
-
-  const Generator1 g1_;
-  const Generator2 g2_;
-  const Generator3 g3_;
-  const Generator4 g4_;
-};  // class CartesianProductHolder4
-
-template <class Generator1, class Generator2, class Generator3,
-    class Generator4, class Generator5>
-class CartesianProductHolder5 {
- public:
-CartesianProductHolder5(const Generator1& g1, const Generator2& g2,
-    const Generator3& g3, const Generator4& g4, const Generator5& g5)
-      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
-  template <typename T1, typename T2, typename T3, typename T4, typename T5>
-  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5> >() const {
-    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5> >(
-        new CartesianProductGenerator5<T1, T2, T3, T4, T5>(
-        static_cast<ParamGenerator<T1> >(g1_),
-        static_cast<ParamGenerator<T2> >(g2_),
-        static_cast<ParamGenerator<T3> >(g3_),
-        static_cast<ParamGenerator<T4> >(g4_),
-        static_cast<ParamGenerator<T5> >(g5_)));
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const CartesianProductHolder5& other);
-
-  const Generator1 g1_;
-  const Generator2 g2_;
-  const Generator3 g3_;
-  const Generator4 g4_;
-  const Generator5 g5_;
-};  // class CartesianProductHolder5
-
-template <class Generator1, class Generator2, class Generator3,
-    class Generator4, class Generator5, class Generator6>
-class CartesianProductHolder6 {
- public:
-CartesianProductHolder6(const Generator1& g1, const Generator2& g2,
-    const Generator3& g3, const Generator4& g4, const Generator5& g5,
-    const Generator6& g6)
-      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
-  template <typename T1, typename T2, typename T3, typename T4, typename T5,
-      typename T6>
-  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> >() const {
-    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> >(
-        new CartesianProductGenerator6<T1, T2, T3, T4, T5, T6>(
-        static_cast<ParamGenerator<T1> >(g1_),
-        static_cast<ParamGenerator<T2> >(g2_),
-        static_cast<ParamGenerator<T3> >(g3_),
-        static_cast<ParamGenerator<T4> >(g4_),
-        static_cast<ParamGenerator<T5> >(g5_),
-        static_cast<ParamGenerator<T6> >(g6_)));
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const CartesianProductHolder6& other);
-
-  const Generator1 g1_;
-  const Generator2 g2_;
-  const Generator3 g3_;
-  const Generator4 g4_;
-  const Generator5 g5_;
-  const Generator6 g6_;
-};  // class CartesianProductHolder6
-
-template <class Generator1, class Generator2, class Generator3,
-    class Generator4, class Generator5, class Generator6, class Generator7>
-class CartesianProductHolder7 {
- public:
-CartesianProductHolder7(const Generator1& g1, const Generator2& g2,
-    const Generator3& g3, const Generator4& g4, const Generator5& g5,
-    const Generator6& g6, const Generator7& g7)
-      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
-  template <typename T1, typename T2, typename T3, typename T4, typename T5,
-      typename T6, typename T7>
-  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
-      T7> >() const {
-    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7> >(
-        new CartesianProductGenerator7<T1, T2, T3, T4, T5, T6, T7>(
-        static_cast<ParamGenerator<T1> >(g1_),
-        static_cast<ParamGenerator<T2> >(g2_),
-        static_cast<ParamGenerator<T3> >(g3_),
-        static_cast<ParamGenerator<T4> >(g4_),
-        static_cast<ParamGenerator<T5> >(g5_),
-        static_cast<ParamGenerator<T6> >(g6_),
-        static_cast<ParamGenerator<T7> >(g7_)));
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const CartesianProductHolder7& other);
-
-  const Generator1 g1_;
-  const Generator2 g2_;
-  const Generator3 g3_;
-  const Generator4 g4_;
-  const Generator5 g5_;
-  const Generator6 g6_;
-  const Generator7 g7_;
-};  // class CartesianProductHolder7
-
-template <class Generator1, class Generator2, class Generator3,
-    class Generator4, class Generator5, class Generator6, class Generator7,
-    class Generator8>
-class CartesianProductHolder8 {
- public:
-CartesianProductHolder8(const Generator1& g1, const Generator2& g2,
-    const Generator3& g3, const Generator4& g4, const Generator5& g5,
-    const Generator6& g6, const Generator7& g7, const Generator8& g8)
-      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),
-          g8_(g8) {}
-  template <typename T1, typename T2, typename T3, typename T4, typename T5,
-      typename T6, typename T7, typename T8>
-  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7,
-      T8> >() const {
-    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8> >(
-        new CartesianProductGenerator8<T1, T2, T3, T4, T5, T6, T7, T8>(
-        static_cast<ParamGenerator<T1> >(g1_),
-        static_cast<ParamGenerator<T2> >(g2_),
-        static_cast<ParamGenerator<T3> >(g3_),
-        static_cast<ParamGenerator<T4> >(g4_),
-        static_cast<ParamGenerator<T5> >(g5_),
-        static_cast<ParamGenerator<T6> >(g6_),
-        static_cast<ParamGenerator<T7> >(g7_),
-        static_cast<ParamGenerator<T8> >(g8_)));
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const CartesianProductHolder8& other);
-
-  const Generator1 g1_;
-  const Generator2 g2_;
-  const Generator3 g3_;
-  const Generator4 g4_;
-  const Generator5 g5_;
-  const Generator6 g6_;
-  const Generator7 g7_;
-  const Generator8 g8_;
-};  // class CartesianProductHolder8
-
-template <class Generator1, class Generator2, class Generator3,
-    class Generator4, class Generator5, class Generator6, class Generator7,
-    class Generator8, class Generator9>
-class CartesianProductHolder9 {
- public:
-CartesianProductHolder9(const Generator1& g1, const Generator2& g2,
-    const Generator3& g3, const Generator4& g4, const Generator5& g5,
-    const Generator6& g6, const Generator7& g7, const Generator8& g8,
-    const Generator9& g9)
-      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
-          g9_(g9) {}
-  template <typename T1, typename T2, typename T3, typename T4, typename T5,
-      typename T6, typename T7, typename T8, typename T9>
-  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
-      T9> >() const {
-    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
-        T9> >(
-        new CartesianProductGenerator9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
-        static_cast<ParamGenerator<T1> >(g1_),
-        static_cast<ParamGenerator<T2> >(g2_),
-        static_cast<ParamGenerator<T3> >(g3_),
-        static_cast<ParamGenerator<T4> >(g4_),
-        static_cast<ParamGenerator<T5> >(g5_),
-        static_cast<ParamGenerator<T6> >(g6_),
-        static_cast<ParamGenerator<T7> >(g7_),
-        static_cast<ParamGenerator<T8> >(g8_),
-        static_cast<ParamGenerator<T9> >(g9_)));
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const CartesianProductHolder9& other);
-
-  const Generator1 g1_;
-  const Generator2 g2_;
-  const Generator3 g3_;
-  const Generator4 g4_;
-  const Generator5 g5_;
-  const Generator6 g6_;
-  const Generator7 g7_;
-  const Generator8 g8_;
-  const Generator9 g9_;
-};  // class CartesianProductHolder9
-
-template <class Generator1, class Generator2, class Generator3,
-    class Generator4, class Generator5, class Generator6, class Generator7,
-    class Generator8, class Generator9, class Generator10>
-class CartesianProductHolder10 {
- public:
-CartesianProductHolder10(const Generator1& g1, const Generator2& g2,
-    const Generator3& g3, const Generator4& g4, const Generator5& g5,
-    const Generator6& g6, const Generator7& g7, const Generator8& g8,
-    const Generator9& g9, const Generator10& g10)
-      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
-          g9_(g9), g10_(g10) {}
-  template <typename T1, typename T2, typename T3, typename T4, typename T5,
-      typename T6, typename T7, typename T8, typename T9, typename T10>
-  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
-      T9, T10> >() const {
-    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
-        T9, T10> >(
-        new CartesianProductGenerator10<T1, T2, T3, T4, T5, T6, T7, T8, T9,
-            T10>(
-        static_cast<ParamGenerator<T1> >(g1_),
-        static_cast<ParamGenerator<T2> >(g2_),
-        static_cast<ParamGenerator<T3> >(g3_),
-        static_cast<ParamGenerator<T4> >(g4_),
-        static_cast<ParamGenerator<T5> >(g5_),
-        static_cast<ParamGenerator<T6> >(g6_),
-        static_cast<ParamGenerator<T7> >(g7_),
-        static_cast<ParamGenerator<T8> >(g8_),
-        static_cast<ParamGenerator<T9> >(g9_),
-        static_cast<ParamGenerator<T10> >(g10_)));
-  }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const CartesianProductHolder10& other);
-
-  const Generator1 g1_;
-  const Generator2 g2_;
-  const Generator3 g3_;
-  const Generator4 g4_;
-  const Generator5 g5_;
-  const Generator6 g6_;
-  const Generator7 g7_;
-  const Generator8 g8_;
-  const Generator9 g9_;
-  const Generator10 g10_;
-};  // class CartesianProductHolder10
-
-#endif  // GTEST_HAS_COMBINE
-
-}  // namespace internal
-}  // namespace testing
-
-#endif  //  GTEST_HAS_PARAM_TEST
-
-#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
diff --git a/third_party/gtest/include/gtest/internal/gtest-param-util.h b/third_party/gtest/include/gtest/internal/gtest-param-util.h
deleted file mode 100644
index 19295d7..0000000
--- a/third_party/gtest/include/gtest/internal/gtest-param-util.h
+++ /dev/null
@@ -1,640 +0,0 @@
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: vladl@google.com (Vlad Losev)
-
-// Type and function utilities for implementing parameterized tests.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
-
-#include <iterator>
-#include <utility>
-#include <vector>
-
-// scripts/fuse_gtest.py depends on gtest's own header being #included
-// *unconditionally*.  Therefore these #includes cannot be moved
-// inside #if GTEST_HAS_PARAM_TEST.
-#include <gtest/internal/gtest-internal.h>
-#include <gtest/internal/gtest-linked_ptr.h>
-#include <gtest/internal/gtest-port.h>
-
-#if GTEST_HAS_PARAM_TEST
-
-#if GTEST_HAS_RTTI
-#include <typeinfo>  // NOLINT
-#endif  // GTEST_HAS_RTTI
-
-namespace testing {
-namespace internal {
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Outputs a message explaining invalid registration of different
-// fixture class for the same test case. This may happen when
-// TEST_P macro is used to define two tests with the same name
-// but in different namespaces.
-void ReportInvalidTestCaseType(const char* test_case_name,
-                               const char* file, int line);
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Downcasts the pointer of type Base to Derived.
-// Derived must be a subclass of Base. The parameter MUST
-// point to a class of type Derived, not any subclass of it.
-// When RTTI is available, the function performs a runtime
-// check to enforce this.
-template <class Derived, class Base>
-Derived* CheckedDowncastToActualType(Base* base) {
-#if GTEST_HAS_RTTI
-  GTEST_CHECK_(typeid(*base) == typeid(Derived));
-  Derived* derived = dynamic_cast<Derived*>(base);  // NOLINT
-#else
-  Derived* derived = static_cast<Derived*>(base);  // Poor man's downcast.
-#endif  // GTEST_HAS_RTTI
-  return derived;
-}
-
-template <typename> class ParamGeneratorInterface;
-template <typename> class ParamGenerator;
-
-// Interface for iterating over elements provided by an implementation
-// of ParamGeneratorInterface<T>.
-template <typename T>
-class ParamIteratorInterface {
- public:
-  virtual ~ParamIteratorInterface() {}
-  // A pointer to the base generator instance.
-  // Used only for the purposes of iterator comparison
-  // to make sure that two iterators belong to the same generator.
-  virtual const ParamGeneratorInterface<T>* BaseGenerator() const = 0;
-  // Advances iterator to point to the next element
-  // provided by the generator. The caller is responsible
-  // for not calling Advance() on an iterator equal to
-  // BaseGenerator()->End().
-  virtual void Advance() = 0;
-  // Clones the iterator object. Used for implementing copy semantics
-  // of ParamIterator<T>.
-  virtual ParamIteratorInterface* Clone() const = 0;
-  // Dereferences the current iterator and provides (read-only) access
-  // to the pointed value. It is the caller's responsibility not to call
-  // Current() on an iterator equal to BaseGenerator()->End().
-  // Used for implementing ParamGenerator<T>::operator*().
-  virtual const T* Current() const = 0;
-  // Determines whether the given iterator and other point to the same
-  // element in the sequence generated by the generator.
-  // Used for implementing ParamGenerator<T>::operator==().
-  virtual bool Equals(const ParamIteratorInterface& other) const = 0;
-};
-
-// Class iterating over elements provided by an implementation of
-// ParamGeneratorInterface<T>. It wraps ParamIteratorInterface<T>
-// and implements the const forward iterator concept.
-template <typename T>
-class ParamIterator {
- public:
-  typedef T value_type;
-  typedef const T& reference;
-  typedef ptrdiff_t difference_type;
-
-  // ParamIterator assumes ownership of the impl_ pointer.
-  ParamIterator(const ParamIterator& other) : impl_(other.impl_->Clone()) {}
-  ParamIterator& operator=(const ParamIterator& other) {
-    if (this != &other)
-      impl_.reset(other.impl_->Clone());
-    return *this;
-  }
-
-  const T& operator*() const { return *impl_->Current(); }
-  const T* operator->() const { return impl_->Current(); }
-  // Prefix version of operator++.
-  ParamIterator& operator++() {
-    impl_->Advance();
-    return *this;
-  }
-  // Postfix version of operator++.
-  ParamIterator operator++(int /*unused*/) {
-    ParamIteratorInterface<T>* clone = impl_->Clone();
-    impl_->Advance();
-    return ParamIterator(clone);
-  }
-  bool operator==(const ParamIterator& other) const {
-    return impl_.get() == other.impl_.get() || impl_->Equals(*other.impl_);
-  }
-  bool operator!=(const ParamIterator& other) const {
-    return !(*this == other);
-  }
-
- private:
-  friend class ParamGenerator<T>;
-  explicit ParamIterator(ParamIteratorInterface<T>* impl) : impl_(impl) {}
-  scoped_ptr<ParamIteratorInterface<T> > impl_;
-};
-
-// ParamGeneratorInterface<T> is the binary interface to access generators
-// defined in other translation units.
-template <typename T>
-class ParamGeneratorInterface {
- public:
-  typedef T ParamType;
-
-  virtual ~ParamGeneratorInterface() {}
-
-  // Generator interface definition
-  virtual ParamIteratorInterface<T>* Begin() const = 0;
-  virtual ParamIteratorInterface<T>* End() const = 0;
-};
-
-// Wraps ParamGeneratorInetrface<T> and provides general generator syntax
-// compatible with the STL Container concept.
-// This class implements copy initialization semantics and the contained
-// ParamGeneratorInterface<T> instance is shared among all copies
-// of the original object. This is possible because that instance is immutable.
-template<typename T>
-class ParamGenerator {
- public:
-  typedef ParamIterator<T> iterator;
-
-  explicit ParamGenerator(ParamGeneratorInterface<T>* impl) : impl_(impl) {}
-  ParamGenerator(const ParamGenerator& other) : impl_(other.impl_) {}
-
-  ParamGenerator& operator=(const ParamGenerator& other) {
-    impl_ = other.impl_;
-    return *this;
-  }
-
-  iterator begin() const { return iterator(impl_->Begin()); }
-  iterator end() const { return iterator(impl_->End()); }
-
- private:
-  ::testing::internal::linked_ptr<const ParamGeneratorInterface<T> > impl_;
-};
-
-// Generates values from a range of two comparable values. Can be used to
-// generate sequences of user-defined types that implement operator+() and
-// operator<().
-// This class is used in the Range() function.
-template <typename T, typename IncrementT>
-class RangeGenerator : public ParamGeneratorInterface<T> {
- public:
-  RangeGenerator(T begin, T end, IncrementT step)
-      : begin_(begin), end_(end),
-        step_(step), end_index_(CalculateEndIndex(begin, end, step)) {}
-  virtual ~RangeGenerator() {}
-
-  virtual ParamIteratorInterface<T>* Begin() const {
-    return new Iterator(this, begin_, 0, step_);
-  }
-  virtual ParamIteratorInterface<T>* End() const {
-    return new Iterator(this, end_, end_index_, step_);
-  }
-
- private:
-  class Iterator : public ParamIteratorInterface<T> {
-   public:
-    Iterator(const ParamGeneratorInterface<T>* base, T value, int index,
-             IncrementT step)
-        : base_(base), value_(value), index_(index), step_(step) {}
-    virtual ~Iterator() {}
-
-    virtual const ParamGeneratorInterface<T>* BaseGenerator() const {
-      return base_;
-    }
-    virtual void Advance() {
-      value_ = value_ + step_;
-      index_++;
-    }
-    virtual ParamIteratorInterface<T>* Clone() const {
-      return new Iterator(*this);
-    }
-    virtual const T* Current() const { return &value_; }
-    virtual bool Equals(const ParamIteratorInterface<T>& other) const {
-      // Having the same base generator guarantees that the other
-      // iterator is of the same type and we can downcast.
-      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
-          << "The program attempted to compare iterators "
-          << "from different generators." << std::endl;
-      const int other_index =
-          CheckedDowncastToActualType<const Iterator>(&other)->index_;
-      return index_ == other_index;
-    }
-
-   private:
-    Iterator(const Iterator& other)
-        : base_(other.base_), value_(other.value_), index_(other.index_),
-          step_(other.step_) {}
-
-    // No implementation - assignment is unsupported.
-    void operator=(const Iterator& other);
-
-    const ParamGeneratorInterface<T>* const base_;
-    T value_;
-    int index_;
-    const IncrementT step_;
-  };  // class RangeGenerator::Iterator
-
-  static int CalculateEndIndex(const T& begin,
-                               const T& end,
-                               const IncrementT& step) {
-    int end_index = 0;
-    for (T i = begin; i < end; i = i + step)
-      end_index++;
-    return end_index;
-  }
-
-  // No implementation - assignment is unsupported.
-  void operator=(const RangeGenerator& other);
-
-  const T begin_;
-  const T end_;
-  const IncrementT step_;
-  // The index for the end() iterator. All the elements in the generated
-  // sequence are indexed (0-based) to aid iterator comparison.
-  const int end_index_;
-};  // class RangeGenerator
-
-
-// Generates values from a pair of STL-style iterators. Used in the
-// ValuesIn() function. The elements are copied from the source range
-// since the source can be located on the stack, and the generator
-// is likely to persist beyond that stack frame.
-template <typename T>
-class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> {
- public:
-  template <typename ForwardIterator>
-  ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end)
-      : container_(begin, end) {}
-  virtual ~ValuesInIteratorRangeGenerator() {}
-
-  virtual ParamIteratorInterface<T>* Begin() const {
-    return new Iterator(this, container_.begin());
-  }
-  virtual ParamIteratorInterface<T>* End() const {
-    return new Iterator(this, container_.end());
-  }
-
- private:
-  typedef typename ::std::vector<T> ContainerType;
-
-  class Iterator : public ParamIteratorInterface<T> {
-   public:
-    Iterator(const ParamGeneratorInterface<T>* base,
-             typename ContainerType::const_iterator iterator)
-        :  base_(base), iterator_(iterator) {}
-    virtual ~Iterator() {}
-
-    virtual const ParamGeneratorInterface<T>* BaseGenerator() const {
-      return base_;
-    }
-    virtual void Advance() {
-      ++iterator_;
-      value_.reset();
-    }
-    virtual ParamIteratorInterface<T>* Clone() const {
-      return new Iterator(*this);
-    }
-    // We need to use cached value referenced by iterator_ because *iterator_
-    // can return a temporary object (and of type other then T), so just
-    // having "return &*iterator_;" doesn't work.
-    // value_ is updated here and not in Advance() because Advance()
-    // can advance iterator_ beyond the end of the range, and we cannot
-    // detect that fact. The client code, on the other hand, is
-    // responsible for not calling Current() on an out-of-range iterator.
-    virtual const T* Current() const {
-      if (value_.get() == NULL)
-        value_.reset(new T(*iterator_));
-      return value_.get();
-    }
-    virtual bool Equals(const ParamIteratorInterface<T>& other) const {
-      // Having the same base generator guarantees that the other
-      // iterator is of the same type and we can downcast.
-      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
-          << "The program attempted to compare iterators "
-          << "from different generators." << std::endl;
-      return iterator_ ==
-          CheckedDowncastToActualType<const Iterator>(&other)->iterator_;
-    }
-
-   private:
-    Iterator(const Iterator& other)
-          // The explicit constructor call suppresses a false warning
-          // emitted by gcc when supplied with the -Wextra option.
-        : ParamIteratorInterface<T>(),
-          base_(other.base_),
-          iterator_(other.iterator_) {}
-
-    const ParamGeneratorInterface<T>* const base_;
-    typename ContainerType::const_iterator iterator_;
-    // A cached value of *iterator_. We keep it here to allow access by
-    // pointer in the wrapping iterator's operator->().
-    // value_ needs to be mutable to be accessed in Current().
-    // Use of scoped_ptr helps manage cached value's lifetime,
-    // which is bound by the lifespan of the iterator itself.
-    mutable scoped_ptr<const T> value_;
-  };  // class ValuesInIteratorRangeGenerator::Iterator
-
-  // No implementation - assignment is unsupported.
-  void operator=(const ValuesInIteratorRangeGenerator& other);
-
-  const ContainerType container_;
-};  // class ValuesInIteratorRangeGenerator
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Stores a parameter value and later creates tests parameterized with that
-// value.
-template <class TestClass>
-class ParameterizedTestFactory : public TestFactoryBase {
- public:
-  typedef typename TestClass::ParamType ParamType;
-  explicit ParameterizedTestFactory(ParamType parameter) :
-      parameter_(parameter) {}
-  virtual Test* CreateTest() {
-    TestClass::SetParam(&parameter_);
-    return new TestClass();
-  }
-
- private:
-  const ParamType parameter_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestFactory);
-};
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// TestMetaFactoryBase is a base class for meta-factories that create
-// test factories for passing into MakeAndRegisterTestInfo function.
-template <class ParamType>
-class TestMetaFactoryBase {
- public:
-  virtual ~TestMetaFactoryBase() {}
-
-  virtual TestFactoryBase* CreateTestFactory(ParamType parameter) = 0;
-};
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// TestMetaFactory creates test factories for passing into
-// MakeAndRegisterTestInfo function. Since MakeAndRegisterTestInfo receives
-// ownership of test factory pointer, same factory object cannot be passed
-// into that method twice. But ParameterizedTestCaseInfo is going to call
-// it for each Test/Parameter value combination. Thus it needs meta factory
-// creator class.
-template <class TestCase>
-class TestMetaFactory
-    : public TestMetaFactoryBase<typename TestCase::ParamType> {
- public:
-  typedef typename TestCase::ParamType ParamType;
-
-  TestMetaFactory() {}
-
-  virtual TestFactoryBase* CreateTestFactory(ParamType parameter) {
-    return new ParameterizedTestFactory<TestCase>(parameter);
-  }
-
- private:
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestMetaFactory);
-};
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// ParameterizedTestCaseInfoBase is a generic interface
-// to ParameterizedTestCaseInfo classes. ParameterizedTestCaseInfoBase
-// accumulates test information provided by TEST_P macro invocations
-// and generators provided by INSTANTIATE_TEST_CASE_P macro invocations
-// and uses that information to register all resulting test instances
-// in RegisterTests method. The ParameterizeTestCaseRegistry class holds
-// a collection of pointers to the ParameterizedTestCaseInfo objects
-// and calls RegisterTests() on each of them when asked.
-class ParameterizedTestCaseInfoBase {
- public:
-  virtual ~ParameterizedTestCaseInfoBase() {}
-
-  // Base part of test case name for display purposes.
-  virtual const String& GetTestCaseName() const = 0;
-  // Test case id to verify identity.
-  virtual TypeId GetTestCaseTypeId() const = 0;
-  // UnitTest class invokes this method to register tests in this
-  // test case right before running them in RUN_ALL_TESTS macro.
-  // This method should not be called more then once on any single
-  // instance of a ParameterizedTestCaseInfoBase derived class.
-  virtual void RegisterTests() = 0;
-
- protected:
-  ParameterizedTestCaseInfoBase() {}
-
- private:
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfoBase);
-};
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// ParameterizedTestCaseInfo accumulates tests obtained from TEST_P
-// macro invocations for a particular test case and generators
-// obtained from INSTANTIATE_TEST_CASE_P macro invocations for that
-// test case. It registers tests with all values generated by all
-// generators when asked.
-template <class TestCase>
-class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
- public:
-  // ParamType and GeneratorCreationFunc are private types but are required
-  // for declarations of public methods AddTestPattern() and
-  // AddTestCaseInstantiation().
-  typedef typename TestCase::ParamType ParamType;
-  // A function that returns an instance of appropriate generator type.
-  typedef ParamGenerator<ParamType>(GeneratorCreationFunc)();
-
-  explicit ParameterizedTestCaseInfo(const char* name)
-      : test_case_name_(name) {}
-
-  // Test case base name for display purposes.
-  virtual const String& GetTestCaseName() const { return test_case_name_; }
-  // Test case id to verify identity.
-  virtual TypeId GetTestCaseTypeId() const { return GetTypeId<TestCase>(); }
-  // TEST_P macro uses AddTestPattern() to record information
-  // about a single test in a LocalTestInfo structure.
-  // test_case_name is the base name of the test case (without invocation
-  // prefix). test_base_name is the name of an individual test without
-  // parameter index. For the test SequenceA/FooTest.DoBar/1 FooTest is
-  // test case base name and DoBar is test base name.
-  void AddTestPattern(const char* test_case_name,
-                      const char* test_base_name,
-                      TestMetaFactoryBase<ParamType>* meta_factory) {
-    tests_.push_back(linked_ptr<TestInfo>(new TestInfo(test_case_name,
-                                                       test_base_name,
-                                                       meta_factory)));
-  }
-  // INSTANTIATE_TEST_CASE_P macro uses AddGenerator() to record information
-  // about a generator.
-  int AddTestCaseInstantiation(const char* instantiation_name,
-                               GeneratorCreationFunc* func,
-                               const char* /* file */,
-                               int /* line */) {
-    instantiations_.push_back(::std::make_pair(instantiation_name, func));
-    return 0;  // Return value used only to run this method in namespace scope.
-  }
-  // UnitTest class invokes this method to register tests in this test case
-  // test cases right before running tests in RUN_ALL_TESTS macro.
-  // This method should not be called more then once on any single
-  // instance of a ParameterizedTestCaseInfoBase derived class.
-  // UnitTest has a guard to prevent from calling this method more then once.
-  virtual void RegisterTests() {
-    for (typename TestInfoContainer::iterator test_it = tests_.begin();
-         test_it != tests_.end(); ++test_it) {
-      linked_ptr<TestInfo> test_info = *test_it;
-      for (typename InstantiationContainer::iterator gen_it =
-               instantiations_.begin(); gen_it != instantiations_.end();
-               ++gen_it) {
-        const String& instantiation_name = gen_it->first;
-        ParamGenerator<ParamType> generator((*gen_it->second)());
-
-        Message test_case_name_stream;
-        if ( !instantiation_name.empty() )
-          test_case_name_stream << instantiation_name.c_str() << "/";
-        test_case_name_stream << test_info->test_case_base_name.c_str();
-
-        int i = 0;
-        for (typename ParamGenerator<ParamType>::iterator param_it =
-                 generator.begin();
-             param_it != generator.end(); ++param_it, ++i) {
-          Message test_name_stream;
-          test_name_stream << test_info->test_base_name.c_str() << "/" << i;
-          ::testing::internal::MakeAndRegisterTestInfo(
-              test_case_name_stream.GetString().c_str(),
-              test_name_stream.GetString().c_str(),
-              "",  // test_case_comment
-              "",  // comment; TODO(vladl@google.com): provide parameter value
-                   //                                  representation.
-              GetTestCaseTypeId(),
-              TestCase::SetUpTestCase,
-              TestCase::TearDownTestCase,
-              test_info->test_meta_factory->CreateTestFactory(*param_it));
-        }  // for param_it
-      }  // for gen_it
-    }  // for test_it
-  }  // RegisterTests
-
- private:
-  // LocalTestInfo structure keeps information about a single test registered
-  // with TEST_P macro.
-  struct TestInfo {
-    TestInfo(const char* test_case_base_name,
-             const char* test_base_name,
-             TestMetaFactoryBase<ParamType>* test_meta_factory) :
-        test_case_base_name(test_case_base_name),
-        test_base_name(test_base_name),
-        test_meta_factory(test_meta_factory) {}
-
-    const String test_case_base_name;
-    const String test_base_name;
-    const scoped_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory;
-  };
-  typedef ::std::vector<linked_ptr<TestInfo> > TestInfoContainer;
-  // Keeps pairs of <Instantiation name, Sequence generator creation function>
-  // received from INSTANTIATE_TEST_CASE_P macros.
-  typedef ::std::vector<std::pair<String, GeneratorCreationFunc*> >
-      InstantiationContainer;
-
-  const String test_case_name_;
-  TestInfoContainer tests_;
-  InstantiationContainer instantiations_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfo);
-};  // class ParameterizedTestCaseInfo
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// ParameterizedTestCaseRegistry contains a map of ParameterizedTestCaseInfoBase
-// classes accessed by test case names. TEST_P and INSTANTIATE_TEST_CASE_P
-// macros use it to locate their corresponding ParameterizedTestCaseInfo
-// descriptors.
-class ParameterizedTestCaseRegistry {
- public:
-  ParameterizedTestCaseRegistry() {}
-  ~ParameterizedTestCaseRegistry() {
-    for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
-         it != test_case_infos_.end(); ++it) {
-      delete *it;
-    }
-  }
-
-  // Looks up or creates and returns a structure containing information about
-  // tests and instantiations of a particular test case.
-  template <class TestCase>
-  ParameterizedTestCaseInfo<TestCase>* GetTestCasePatternHolder(
-      const char* test_case_name,
-      const char* file,
-      int line) {
-    ParameterizedTestCaseInfo<TestCase>* typed_test_info = NULL;
-    for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
-         it != test_case_infos_.end(); ++it) {
-      if ((*it)->GetTestCaseName() == test_case_name) {
-        if ((*it)->GetTestCaseTypeId() != GetTypeId<TestCase>()) {
-          // Complain about incorrect usage of Google Test facilities
-          // and terminate the program since we cannot guaranty correct
-          // test case setup and tear-down in this case.
-          ReportInvalidTestCaseType(test_case_name,  file, line);
-          abort();
-        } else {
-          // At this point we are sure that the object we found is of the same
-          // type we are looking for, so we downcast it to that type
-          // without further checks.
-          typed_test_info = CheckedDowncastToActualType<
-              ParameterizedTestCaseInfo<TestCase> >(*it);
-        }
-        break;
-      }
-    }
-    if (typed_test_info == NULL) {
-      typed_test_info = new ParameterizedTestCaseInfo<TestCase>(test_case_name);
-      test_case_infos_.push_back(typed_test_info);
-    }
-    return typed_test_info;
-  }
-  void RegisterTests() {
-    for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
-         it != test_case_infos_.end(); ++it) {
-      (*it)->RegisterTests();
-    }
-  }
-
- private:
-  typedef ::std::vector<ParameterizedTestCaseInfoBase*> TestCaseInfoContainer;
-
-  TestCaseInfoContainer test_case_infos_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseRegistry);
-};
-
-}  // namespace internal
-}  // namespace testing
-
-#endif  //  GTEST_HAS_PARAM_TEST
-
-#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
diff --git a/third_party/gtest/include/gtest/internal/gtest-port.h b/third_party/gtest/include/gtest/internal/gtest-port.h
deleted file mode 100644
index 603e7f1..0000000
--- a/third_party/gtest/include/gtest/internal/gtest-port.h
+++ /dev/null
@@ -1,1088 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: wan@google.com (Zhanyong Wan)
-//
-// Low-level types and utilities for porting Google Test to various
-// platforms.  They are subject to change without notice.  DO NOT USE
-// THEM IN USER CODE.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
-
-// The user can define the following macros in the build script to
-// control Google Test's behavior.  If the user doesn't define a macro
-// in this list, Google Test will define it.
-//
-//   GTEST_HAS_CLONE          - Define it to 1/0 to indicate that clone(2)
-//                              is/isn't available.
-//   GTEST_HAS_GLOBAL_STRING  - Define it to 1/0 to indicate that ::string
-//                              is/isn't available (some systems define
-//                              ::string, which is different to std::string).
-//   GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string
-//                              is/isn't available (some systems define
-//                              ::wstring, which is different to std::wstring).
-//   GTEST_HAS_PTHREAD        - Define it to 1/0 to indicate that <pthread.h>
-//                              is/isn't available.
-//   GTEST_HAS_RTTI           - Define it to 1/0 to indicate that RTTI is/isn't
-//                              enabled.
-//   GTEST_HAS_STD_STRING     - Define it to 1/0 to indicate that
-//                              std::string does/doesn't work (Google Test can
-//                              be used where std::string is unavailable).
-//   GTEST_HAS_STD_WSTRING    - Define it to 1/0 to indicate that
-//                              std::wstring does/doesn't work (Google Test can
-//                              be used where std::wstring is unavailable).
-//   GTEST_HAS_TR1_TUPLE      - Define it to 1/0 to indicate tr1::tuple
-//                              is/isn't available.
-//   GTEST_HAS_SEH            - Define it to 1/0 to indicate whether the
-//                              compiler supports Microsoft's "Structured
-//                              Exception Handling".
-//   GTEST_USE_OWN_TR1_TUPLE  - Define it to 1/0 to indicate whether Google
-//                              Test's own tr1 tuple implementation should be
-//                              used.  Unused when the user sets
-//                              GTEST_HAS_TR1_TUPLE to 0.
-
-// This header defines the following utilities:
-//
-// Macros indicating the current platform (defined to 1 if compiled on
-// the given platform; otherwise undefined):
-//   GTEST_OS_CYGWIN   - Cygwin
-//   GTEST_OS_LINUX    - Linux
-//   GTEST_OS_MAC      - Mac OS X
-//   GTEST_OS_SOLARIS  - Sun Solaris
-//   GTEST_OS_SYMBIAN  - Symbian
-//   GTEST_OS_WINDOWS  - Windows (Desktop, MinGW, or Mobile)
-//     GTEST_OS_WINDOWS_DESKTOP  - Windows Desktop
-//     GTEST_OS_WINDOWS_MINGW    - MinGW
-//     GTEST_OS_WINODWS_MOBILE   - Windows Mobile
-//   GTEST_OS_ZOS      - z/OS
-//
-// Among the platforms, Cygwin, Linux, Max OS X, and Windows have the
-// most stable support.  Since core members of the Google Test project
-// don't have access to other platforms, support for them may be less
-// stable.  If you notice any problems on your platform, please notify
-// googletestframework@googlegroups.com (patches for fixing them are
-// even more welcome!).
-//
-// Note that it is possible that none of the GTEST_OS_* macros are defined.
-//
-// Macros indicating available Google Test features (defined to 1 if
-// the corresponding feature is supported; otherwise undefined):
-//   GTEST_HAS_COMBINE      - the Combine() function (for value-parameterized
-//                            tests)
-//   GTEST_HAS_DEATH_TEST   - death tests
-//   GTEST_HAS_PARAM_TEST   - value-parameterized tests
-//   GTEST_HAS_TYPED_TEST   - typed tests
-//   GTEST_HAS_TYPED_TEST_P - type-parameterized tests
-//   GTEST_USES_POSIX_RE    - enhanced POSIX regex is used.
-//   GTEST_USES_SIMPLE_RE   - our own simple regex is used;
-//                            the above two are mutually exclusive.
-//
-// Macros for basic C++ coding:
-//   GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.
-//   GTEST_ATTRIBUTE_UNUSED_  - declares that a class' instances or a
-//                              variable don't have to be used.
-//   GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=.
-//   GTEST_MUST_USE_RESULT_   - declares that a function's result must be used.
-//
-// Synchronization:
-//   Mutex, MutexLock, ThreadLocal, GetThreadCount()
-//                  - synchronization primitives.
-//   GTEST_IS_THREADSAFE - defined to 1 to indicate that the above
-//                         synchronization primitives have real implementations
-//                         and Google Test is thread-safe; or 0 otherwise.
-//
-// Template meta programming:
-//   is_pointer     - as in TR1; needed on Symbian and IBM XL C/C++ only.
-//
-// Smart pointers:
-//   scoped_ptr     - as in TR2.
-//
-// Regular expressions:
-//   RE             - a simple regular expression class using the POSIX
-//                    Extended Regular Expression syntax.  Not available on
-//                    Windows.
-//
-// Logging:
-//   GTEST_LOG_()   - logs messages at the specified severity level.
-//   LogToStderr()  - directs all log messages to stderr.
-//   FlushInfoLog() - flushes informational log messages.
-//
-// Stderr capturing:
-//   CaptureStderr()     - starts capturing stderr.
-//   GetCapturedStderr() - stops capturing stderr and returns the captured
-//                         string.
-//
-// Integer types:
-//   TypeWithSize   - maps an integer to a int type.
-//   Int32, UInt32, Int64, UInt64, TimeInMillis
-//                  - integers of known sizes.
-//   BiggestInt     - the biggest signed integer type.
-//
-// Command-line utilities:
-//   GTEST_FLAG()       - references a flag.
-//   GTEST_DECLARE_*()  - declares a flag.
-//   GTEST_DEFINE_*()   - defines a flag.
-//   GetArgvs()         - returns the command line as a vector of strings.
-//
-// Environment variable utilities:
-//   GetEnv()             - gets the value of an environment variable.
-//   BoolFromGTestEnv()   - parses a bool environment variable.
-//   Int32FromGTestEnv()  - parses an Int32 environment variable.
-//   StringFromGTestEnv() - parses a string environment variable.
-
-#include <stddef.h>  // For ptrdiff_t
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#ifndef _WIN32_WCE
-#include <sys/stat.h>
-#endif  // !_WIN32_WCE
-
-#include <iostream>  // NOLINT
-
-#define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
-#define GTEST_FLAG_PREFIX_ "gtest_"
-#define GTEST_FLAG_PREFIX_DASH_ "gtest-"
-#define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
-#define GTEST_NAME_ "Google Test"
-#define GTEST_PROJECT_URL_ "http://code.google.com/p/googletest/"
-
-// Determines the version of gcc that is used to compile this.
-#ifdef __GNUC__
-// 40302 means version 4.3.2.
-#define GTEST_GCC_VER_ \
-    (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
-#endif  // __GNUC__
-
-// Determines the platform on which Google Test is compiled.
-#ifdef __CYGWIN__
-#define GTEST_OS_CYGWIN 1
-#elif defined __SYMBIAN32__
-#define GTEST_OS_SYMBIAN 1
-#elif defined _WIN32
-#define GTEST_OS_WINDOWS 1
-#ifdef _WIN32_WCE
-#define GTEST_OS_WINDOWS_MOBILE 1
-#elif defined(__MINGW__) || defined(__MINGW32__)
-#define GTEST_OS_WINDOWS_MINGW 1
-#else
-#define GTEST_OS_WINDOWS_DESKTOP 1
-#endif  // _WIN32_WCE
-#elif defined __APPLE__
-#define GTEST_OS_MAC 1
-#elif defined __linux__
-#define GTEST_OS_LINUX 1
-#elif defined __MVS__
-#define GTEST_OS_ZOS 1
-#elif defined(__sun) && defined(__SVR4)
-#define GTEST_OS_SOLARIS 1
-#endif  // __CYGWIN__
-
-#if GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_SYMBIAN || \
-    GTEST_OS_SOLARIS
-
-// On some platforms, <regex.h> needs someone to define size_t, and
-// won't compile otherwise.  We can #include it here as we already
-// included <stdlib.h>, which is guaranteed to define size_t through
-// <stddef.h>.
-#include <regex.h>  // NOLINT
-#include <strings.h>  // NOLINT
-#include <sys/types.h>  // NOLINT
-#include <unistd.h>  // NOLINT
-
-#define GTEST_USES_POSIX_RE 1
-
-#elif GTEST_OS_WINDOWS
-
-#if !GTEST_OS_WINDOWS_MOBILE
-#include <direct.h>  // NOLINT
-#include <io.h>  // NOLINT
-#endif
-
-// <regex.h> is not available on Windows.  Use our own simple regex
-// implementation instead.
-#define GTEST_USES_SIMPLE_RE 1
-
-#else
-
-// <regex.h> may not be available on this platform.  Use our own
-// simple regex implementation instead.
-#define GTEST_USES_SIMPLE_RE 1
-
-#endif  // GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC ||
-        // GTEST_OS_SYMBIAN || GTEST_OS_SOLARIS
-
-// Defines GTEST_HAS_EXCEPTIONS to 1 if exceptions are enabled, or 0
-// otherwise.
-
-#if defined(_MSC_VER) || defined(__BORLANDC__)
-// MSVC's and C++Builder's implementations of the STL use the _HAS_EXCEPTIONS
-// macro to enable exceptions, so we'll do the same.
-// Assumes that exceptions are enabled by default.
-#ifndef _HAS_EXCEPTIONS
-#define _HAS_EXCEPTIONS 1
-#endif  // _HAS_EXCEPTIONS
-#define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
-#else  // The compiler is not MSVC or C++Builder.
-// gcc defines __EXCEPTIONS to 1 iff exceptions are enabled.  For
-// other compilers, we assume exceptions are disabled to be
-// conservative.
-#if defined(__GNUC__) && __EXCEPTIONS
-#define GTEST_HAS_EXCEPTIONS 1
-#else
-#define GTEST_HAS_EXCEPTIONS 0
-#endif  // defined(__GNUC__) && __EXCEPTIONS
-#endif  // defined(_MSC_VER) || defined(__BORLANDC__)
-
-// Determines whether ::std::string and ::string are available.
-
-#ifndef GTEST_HAS_STD_STRING
-// The user didn't tell us whether ::std::string is available, so we
-// need to figure it out.  The only environment that we know
-// ::std::string is not available is MSVC 7.1 or lower with exceptions
-// disabled.
-#if defined(_MSC_VER) && (_MSC_VER < 1400) && !GTEST_HAS_EXCEPTIONS
-#define GTEST_HAS_STD_STRING 0
-#else
-#define GTEST_HAS_STD_STRING 1
-#endif
-#endif  // GTEST_HAS_STD_STRING
-
-#ifndef GTEST_HAS_GLOBAL_STRING
-// The user didn't tell us whether ::string is available, so we need
-// to figure it out.
-
-#define GTEST_HAS_GLOBAL_STRING 0
-
-#endif  // GTEST_HAS_GLOBAL_STRING
-
-#ifndef GTEST_HAS_STD_WSTRING
-// The user didn't tell us whether ::std::wstring is available, so we need
-// to figure it out.
-// TODO(wan@google.com): uses autoconf to detect whether ::std::wstring
-//   is available.
-
-#if GTEST_OS_CYGWIN || GTEST_OS_SOLARIS
-// Cygwin 1.5 and below doesn't support ::std::wstring.
-// Cygwin 1.7 might add wstring support; this should be updated when clear.
-// Solaris' libc++ doesn't support it either.
-#define GTEST_HAS_STD_WSTRING 0
-#else
-#define GTEST_HAS_STD_WSTRING GTEST_HAS_STD_STRING
-#endif  // GTEST_OS_CYGWIN || GTEST_OS_SOLARIS
-
-#endif  // GTEST_HAS_STD_WSTRING
-
-#ifndef GTEST_HAS_GLOBAL_WSTRING
-// The user didn't tell us whether ::wstring is available, so we need
-// to figure it out.
-#define GTEST_HAS_GLOBAL_WSTRING \
-    (GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING)
-#endif  // GTEST_HAS_GLOBAL_WSTRING
-
-#if GTEST_HAS_STD_STRING || GTEST_HAS_GLOBAL_STRING || \
-    GTEST_HAS_STD_WSTRING || GTEST_HAS_GLOBAL_WSTRING
-#include <string>  // NOLINT
-#endif  // GTEST_HAS_STD_STRING || GTEST_HAS_GLOBAL_STRING ||
-        // GTEST_HAS_STD_WSTRING || GTEST_HAS_GLOBAL_WSTRING
-
-#if GTEST_HAS_STD_STRING
-#include <sstream>  // NOLINT
-#else
-#include <strstream>  // NOLINT
-#endif  // GTEST_HAS_STD_STRING
-
-// Determines whether RTTI is available.
-#ifndef GTEST_HAS_RTTI
-// The user didn't tell us whether RTTI is enabled, so we need to
-// figure it out.
-
-#ifdef _MSC_VER
-
-#ifdef _CPPRTTI  // MSVC defines this macro iff RTTI is enabled.
-#define GTEST_HAS_RTTI 1
-#else
-#define GTEST_HAS_RTTI 0
-#endif  // _CPPRTTI
-
-#elif defined(__GNUC__)
-
-// Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled.
-#if GTEST_GCC_VER_ >= 40302
-#ifdef __GXX_RTTI
-#define GTEST_HAS_RTTI 1
-#else
-#define GTEST_HAS_RTTI 0
-#endif  // __GXX_RTTI
-#else
-// For gcc versions smaller than 4.3.2, we assume RTTI is enabled.
-#define GTEST_HAS_RTTI 1
-#endif  // GTEST_GCC_VER >= 40302
-
-#else
-
-// Unknown compiler - assume RTTI is enabled.
-#define GTEST_HAS_RTTI 1
-
-#endif  // _MSC_VER
-
-#endif  // GTEST_HAS_RTTI
-
-// Determines whether <pthread.h> is available.
-#ifndef GTEST_HAS_PTHREAD
-// The user didn't tell us, so we need to figure it out.
-#define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC)
-#endif  // GTEST_HAS_PTHREAD
-
-// Determines whether Google Test can use tr1/tuple.  You can define
-// this macro to 0 to prevent Google Test from using tuple (any
-// feature depending on tuple with be disabled in this mode).
-#ifndef GTEST_HAS_TR1_TUPLE
-// The user didn't tell us not to do it, so we assume it's OK.
-#define GTEST_HAS_TR1_TUPLE 1
-#endif  // GTEST_HAS_TR1_TUPLE
-
-// Determines whether Google Test's own tr1 tuple implementation
-// should be used.
-#ifndef GTEST_USE_OWN_TR1_TUPLE
-// The user didn't tell us, so we need to figure it out.
-
-// We use our own tr1 tuple if we aren't sure the user has an
-// implementation of it already.  At this time, GCC 4.0.0+ is the only
-// mainstream compiler that comes with a TR1 tuple implementation.
-// MSVC 2008 (9.0) provides TR1 tuple in a 323 MB Feature Pack
-// download, which we cannot assume the user has.  MSVC 2010 isn't
-// released yet.
-#if defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
-#define GTEST_USE_OWN_TR1_TUPLE 0
-#else
-#define GTEST_USE_OWN_TR1_TUPLE 1
-#endif  // defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
-
-#endif  // GTEST_USE_OWN_TR1_TUPLE
-
-// To avoid conditional compilation everywhere, we make it
-// gtest-port.h's responsibility to #include the header implementing
-// tr1/tuple.
-#if GTEST_HAS_TR1_TUPLE
-
-#if GTEST_USE_OWN_TR1_TUPLE
-#include <gtest/internal/gtest-tuple.h>
-#elif GTEST_OS_SYMBIAN
-
-// On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to
-// use STLport's tuple implementation, which unfortunately doesn't
-// work as the copy of STLport distributed with Symbian is incomplete.
-// By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to
-// use its own tuple implementation.
-#ifdef BOOST_HAS_TR1_TUPLE
-#undef BOOST_HAS_TR1_TUPLE
-#endif  // BOOST_HAS_TR1_TUPLE
-
-// This prevents <boost/tr1/detail/config.hpp>, which defines
-// BOOST_HAS_TR1_TUPLE, from being #included by Boost's <tuple>.
-#define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED
-#include <tuple>
-
-#elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
-// GCC 4.0+ implements tr1/tuple in the <tr1/tuple> header.  This does
-// not conform to the TR1 spec, which requires the header to be <tuple>.
-
-#if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
-// Until version 4.3.2, gcc has a bug that causes <tr1/functional>,
-// which is #included by <tr1/tuple>, to not compile when RTTI is
-// disabled.  _TR1_FUNCTIONAL is the header guard for
-// <tr1/functional>.  Hence the following #define is a hack to prevent
-// <tr1/functional> from being included.
-#define _TR1_FUNCTIONAL 1
-#include <tr1/tuple>
-#undef _TR1_FUNCTIONAL  // Allows the user to #include
-                        // <tr1/functional> if he chooses to.
-#else
-#include <tr1/tuple>
-#endif  // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
-
-#else
-// If the compiler is not GCC 4.0+, we assume the user is using a
-// spec-conforming TR1 implementation.
-#include <tuple>
-#endif  // GTEST_USE_OWN_TR1_TUPLE
-
-#endif  // GTEST_HAS_TR1_TUPLE
-
-// Determines whether clone(2) is supported.
-// Usually it will only be available on Linux, excluding
-// Linux on the Itanium architecture.
-// Also see http://linux.die.net/man/2/clone.
-#ifndef GTEST_HAS_CLONE
-// The user didn't tell us, so we need to figure it out.
-
-#if GTEST_OS_LINUX && !defined(__ia64__)
-#define GTEST_HAS_CLONE 1
-#else
-#define GTEST_HAS_CLONE 0
-#endif  // GTEST_OS_LINUX && !defined(__ia64__)
-
-#endif  // GTEST_HAS_CLONE
-
-// Determines whether to support death tests.
-// Google Test does not support death tests for VC 7.1 and earlier for
-// these reasons:
-//   1. std::vector does not build in VC 7.1 when exceptions are disabled.
-//   2. std::string does not build in VC 7.1 when exceptions are disabled
-//      (this is covered by GTEST_HAS_STD_STRING guard).
-//   3. abort() in a VC 7.1 application compiled as GUI in debug config
-//      pops up a dialog window that cannot be suppressed programmatically.
-#if GTEST_HAS_STD_STRING && \
-    (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_CYGWIN || \
-     (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || GTEST_OS_WINDOWS_MINGW)
-#define GTEST_HAS_DEATH_TEST 1
-#include <vector>  // NOLINT
-#endif
-
-// Determines whether to support value-parameterized tests.
-
-#if defined(__GNUC__) || (_MSC_VER >= 1400)
-// TODO(vladl@google.com): get the implementation rid of vector and list
-// to compile on MSVC 7.1.
-#define GTEST_HAS_PARAM_TEST 1
-#endif  // defined(__GNUC__) || (_MSC_VER >= 1400)
-
-// Determines whether to support type-driven tests.
-
-// Typed tests need <typeinfo> and variadic macros, which gcc and VC
-// 8.0+ support.
-#if defined(__GNUC__) || (_MSC_VER >= 1400)
-#define GTEST_HAS_TYPED_TEST 1
-#define GTEST_HAS_TYPED_TEST_P 1
-#endif  // defined(__GNUC__) || (_MSC_VER >= 1400)
-
-// Determines whether to support Combine(). This only makes sense when
-// value-parameterized tests are enabled.
-#if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE
-#define GTEST_HAS_COMBINE 1
-#endif  // GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE
-
-// Determines whether the system compiler uses UTF-16 for encoding wide strings.
-#define GTEST_WIDE_STRING_USES_UTF16_ \
-    (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN)
-
-// Defines some utility macros.
-
-// The GNU compiler emits a warning if nested "if" statements are followed by
-// an "else" statement and braces are not used to explicitly disambiguate the
-// "else" binding.  This leads to problems with code like:
-//
-//   if (gate)
-//     ASSERT_*(condition) << "Some message";
-//
-// The "switch (0) case 0:" idiom is used to suppress this.
-#ifdef __INTEL_COMPILER
-#define GTEST_AMBIGUOUS_ELSE_BLOCKER_
-#else
-#define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0:  // NOLINT
-#endif
-
-// Use this annotation at the end of a struct/class definition to
-// prevent the compiler from optimizing away instances that are never
-// used.  This is useful when all interesting logic happens inside the
-// c'tor and / or d'tor.  Example:
-//
-//   struct Foo {
-//     Foo() { ... }
-//   } GTEST_ATTRIBUTE_UNUSED_;
-//
-// Also use it after a variable or parameter declaration to tell the
-// compiler the variable/parameter does not have to be used.
-#if defined(__GNUC__) && !defined(COMPILER_ICC)
-#define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
-#else
-#define GTEST_ATTRIBUTE_UNUSED_
-#endif
-
-// A macro to disallow the evil copy constructor and operator= functions
-// This should be used in the private: declarations for a class.
-#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\
-  type(const type &);\
-  void operator=(const type &)
-
-// Tell the compiler to warn about unused return values for functions declared
-// with this macro.  The macro should be used on function declarations
-// following the argument list:
-//
-//   Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_;
-#if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC)
-#define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result))
-#else
-#define GTEST_MUST_USE_RESULT_
-#endif  // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC
-
-// Determine whether the compiler supports Microsoft's Structured Exception
-// Handling.  This is supported by several Windows compilers but generally
-// does not exist on any other system.
-#ifndef GTEST_HAS_SEH
-// The user didn't tell us, so we need to figure it out.
-
-#if defined(_MSC_VER) || defined(__BORLANDC__)
-// These two compilers are known to support SEH.
-#define GTEST_HAS_SEH 1
-#else
-// Assume no SEH.
-#define GTEST_HAS_SEH 0
-#endif
-
-#endif  // GTEST_HAS_SEH
-
-namespace testing {
-
-class Message;
-
-namespace internal {
-
-class String;
-
-// std::strstream is deprecated.  However, we have to use it on
-// Windows as std::stringstream won't compile on Windows when
-// exceptions are disabled.  We use std::stringstream on other
-// platforms to avoid compiler warnings there.
-#if GTEST_HAS_STD_STRING
-typedef ::std::stringstream StrStream;
-#else
-typedef ::std::strstream StrStream;
-#endif  // GTEST_HAS_STD_STRING
-
-// A helper for suppressing warnings on constant condition.  It just
-// returns 'condition'.
-bool IsTrue(bool condition);
-
-// Defines scoped_ptr.
-
-// This implementation of scoped_ptr is PARTIAL - it only contains
-// enough stuff to satisfy Google Test's need.
-template <typename T>
-class scoped_ptr {
- public:
-  typedef T element_type;
-
-  explicit scoped_ptr(T* p = NULL) : ptr_(p) {}
-  ~scoped_ptr() { reset(); }
-
-  T& operator*() const { return *ptr_; }
-  T* operator->() const { return ptr_; }
-  T* get() const { return ptr_; }
-
-  T* release() {
-    T* const ptr = ptr_;
-    ptr_ = NULL;
-    return ptr;
-  }
-
-  void reset(T* p = NULL) {
-    if (p != ptr_) {
-      if (IsTrue(sizeof(T) > 0)) {  // Makes sure T is a complete type.
-        delete ptr_;
-      }
-      ptr_ = p;
-    }
-  }
- private:
-  T* ptr_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr);
-};
-
-// Defines RE.
-
-// A simple C++ wrapper for <regex.h>.  It uses the POSIX Enxtended
-// Regular Expression syntax.
-class RE {
- public:
-  // Constructs an RE from a string.
-#if GTEST_HAS_STD_STRING
-  RE(const ::std::string& regex) { Init(regex.c_str()); }  // NOLINT
-#endif  // GTEST_HAS_STD_STRING
-
-#if GTEST_HAS_GLOBAL_STRING
-  RE(const ::string& regex) { Init(regex.c_str()); }  // NOLINT
-#endif  // GTEST_HAS_GLOBAL_STRING
-
-  RE(const char* regex) { Init(regex); }  // NOLINT
-  ~RE();
-
-  // Returns the string representation of the regex.
-  const char* pattern() const { return pattern_; }
-
-  // FullMatch(str, re) returns true iff regular expression re matches
-  // the entire str.
-  // PartialMatch(str, re) returns true iff regular expression re
-  // matches a substring of str (including str itself).
-  //
-  // TODO(wan@google.com): make FullMatch() and PartialMatch() work
-  // when str contains NUL characters.
-#if GTEST_HAS_STD_STRING
-  static bool FullMatch(const ::std::string& str, const RE& re) {
-    return FullMatch(str.c_str(), re);
-  }
-  static bool PartialMatch(const ::std::string& str, const RE& re) {
-    return PartialMatch(str.c_str(), re);
-  }
-#endif  // GTEST_HAS_STD_STRING
-
-#if GTEST_HAS_GLOBAL_STRING
-  static bool FullMatch(const ::string& str, const RE& re) {
-    return FullMatch(str.c_str(), re);
-  }
-  static bool PartialMatch(const ::string& str, const RE& re) {
-    return PartialMatch(str.c_str(), re);
-  }
-#endif  // GTEST_HAS_GLOBAL_STRING
-
-  static bool FullMatch(const char* str, const RE& re);
-  static bool PartialMatch(const char* str, const RE& re);
-
- private:
-  void Init(const char* regex);
-
-  // We use a const char* instead of a string, as Google Test may be used
-  // where string is not available.  We also do not use Google Test's own
-  // String type here, in order to simplify dependencies between the
-  // files.
-  const char* pattern_;
-  bool is_valid_;
-#if GTEST_USES_POSIX_RE
-  regex_t full_regex_;     // For FullMatch().
-  regex_t partial_regex_;  // For PartialMatch().
-#else  // GTEST_USES_SIMPLE_RE
-  const char* full_pattern_;  // For FullMatch();
-#endif
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(RE);
-};
-
-// Defines logging utilities:
-//   GTEST_LOG_(severity) - logs messages at the specified severity level. The
-//                          message itself is streamed into the macro.
-//   LogToStderr()  - directs all log messages to stderr.
-//   FlushInfoLog() - flushes informational log messages.
-
-enum GTestLogSeverity {
-  GTEST_INFO,
-  GTEST_WARNING,
-  GTEST_ERROR,
-  GTEST_FATAL
-};
-
-// Formats log entry severity, provides a stream object for streaming the
-// log message, and terminates the message with a newline when going out of
-// scope.
-class GTestLog {
- public:
-  GTestLog(GTestLogSeverity severity, const char* file, int line);
-
-  // Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.
-  ~GTestLog();
-
-  ::std::ostream& GetStream() { return ::std::cerr; }
-
- private:
-  const GTestLogSeverity severity_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestLog);
-};
-
-#define GTEST_LOG_(severity) \
-    ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \
-                                  __FILE__, __LINE__).GetStream()
-
-inline void LogToStderr() {}
-inline void FlushInfoLog() { fflush(NULL); }
-
-// Defines the stderr capturer:
-//   CaptureStderr     - starts capturing stderr.
-//   GetCapturedStderr - stops capturing stderr and returns the captured string.
-
-void CaptureStderr();
-String GetCapturedStderr();
-
-#if GTEST_HAS_DEATH_TEST
-
-// A copy of all command line arguments.  Set by InitGoogleTest().
-extern ::std::vector<String> g_argvs;
-
-// GTEST_HAS_DEATH_TEST implies we have ::std::string.
-const ::std::vector<String>& GetArgvs();
-
-#endif  // GTEST_HAS_DEATH_TEST
-
-// Defines synchronization primitives.
-
-// A dummy implementation of synchronization primitives (mutex, lock,
-// and thread-local variable).  Necessary for compiling Google Test where
-// mutex is not supported - using Google Test in multiple threads is not
-// supported on such platforms.
-
-class Mutex {
- public:
-  Mutex() {}
-  explicit Mutex(int /*unused*/) {}
-  void AssertHeld() const {}
-  enum { NO_CONSTRUCTOR_NEEDED_FOR_STATIC_MUTEX = 0 };
-};
-
-// We cannot call it MutexLock directly as the ctor declaration would
-// conflict with a macro named MutexLock, which is defined on some
-// platforms.  Hence the typedef trick below.
-class GTestMutexLock {
- public:
-  explicit GTestMutexLock(Mutex*) {}  // NOLINT
-};
-
-typedef GTestMutexLock MutexLock;
-
-template <typename T>
-class ThreadLocal {
- public:
-  ThreadLocal() : value_() {}
-  explicit ThreadLocal(const T& value) : value_(value) {}
-  T* pointer() { return &value_; }
-  const T* pointer() const { return &value_; }
-  const T& get() const { return value_; }
-  void set(const T& value) { value_ = value; }
- private:
-  T value_;
-};
-
-// Returns the number of threads running in the process, or 0 to indicate that
-// we cannot detect it.
-size_t GetThreadCount();
-
-// The above synchronization primitives have dummy implementations.
-// Therefore Google Test is not thread-safe.
-#define GTEST_IS_THREADSAFE 0
-
-// Passing non-POD classes through ellipsis (...) crashes the ARM
-// compiler and generates a warning in Sun Studio.  The Nokia Symbian
-// and the IBM XL C/C++ compiler try to instantiate a copy constructor
-// for objects passed through ellipsis (...), failing for uncopyable
-// objects.  We define this to ensure that only POD is passed through
-// ellipsis on these systems.
-#if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)
-#define GTEST_ELLIPSIS_NEEDS_POD_ 1
-#endif
-
-// The Nokia Symbian and IBM XL C/C++ compilers cannot decide between
-// const T& and const T* in a function template.  These compilers
-// _can_ decide between class template specializations for T and T*,
-// so a tr1::type_traits-like is_pointer works.
-#if defined(__SYMBIAN32__) || defined(__IBMCPP__)
-#define GTEST_NEEDS_IS_POINTER_ 1
-#endif
-
-template <bool bool_value>
-struct bool_constant {
-  typedef bool_constant<bool_value> type;
-  static const bool value = bool_value;
-};
-template <bool bool_value> const bool bool_constant<bool_value>::value;
-
-typedef bool_constant<false> false_type;
-typedef bool_constant<true> true_type;
-
-template <typename T>
-struct is_pointer : public false_type {};
-
-template <typename T>
-struct is_pointer<T*> : public true_type {};
-
-#if GTEST_OS_WINDOWS
-#define GTEST_PATH_SEP_ "\\"
-// The biggest signed integer type the compiler supports.
-typedef __int64 BiggestInt;
-#else
-#define GTEST_PATH_SEP_ "/"
-typedef long long BiggestInt;  // NOLINT
-#endif  // GTEST_OS_WINDOWS
-
-// The testing::internal::posix namespace holds wrappers for common
-// POSIX functions.  These wrappers hide the differences between
-// Windows/MSVC and POSIX systems.  Since some compilers define these
-// standard functions as macros, the wrapper cannot have the same name
-// as the wrapped function.
-
-namespace posix {
-
-// Functions with a different name on Windows.
-
-#if GTEST_OS_WINDOWS
-
-typedef struct _stat StatStruct;
-
-#ifdef __BORLANDC__
-inline int IsATTY(int fd) { return isatty(fd); }
-inline int StrCaseCmp(const char* s1, const char* s2) {
-  return stricmp(s1, s2);
-}
-inline char* StrDup(const char* src) { return strdup(src); }
-#else  // !__BORLANDC__
-#if GTEST_OS_WINDOWS_MOBILE
-inline int IsATTY(int /* fd */) { return 0; }
-#else
-inline int IsATTY(int fd) { return _isatty(fd); }
-#endif  // GTEST_OS_WINDOWS_MOBILE
-inline int StrCaseCmp(const char* s1, const char* s2) {
-  return _stricmp(s1, s2);
-}
-inline char* StrDup(const char* src) { return _strdup(src); }
-#endif  // __BORLANDC__
-
-#if GTEST_OS_WINDOWS_MOBILE
-inline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)); }
-// Stat(), RmDir(), and IsDir() are not needed on Windows CE at this
-// time and thus not defined there.
-#else
-inline int FileNo(FILE* file) { return _fileno(file); }
-inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); }
-inline int RmDir(const char* dir) { return _rmdir(dir); }
-inline bool IsDir(const StatStruct& st) {
-  return (_S_IFDIR & st.st_mode) != 0;
-}
-#endif  // GTEST_OS_WINDOWS_MOBILE
-
-#else
-
-typedef struct stat StatStruct;
-
-inline int FileNo(FILE* file) { return fileno(file); }
-inline int IsATTY(int fd) { return isatty(fd); }
-inline int Stat(const char* path, StatStruct* buf) { return stat(path, buf); }
-inline int StrCaseCmp(const char* s1, const char* s2) {
-  return strcasecmp(s1, s2);
-}
-inline char* StrDup(const char* src) { return strdup(src); }
-inline int RmDir(const char* dir) { return rmdir(dir); }
-inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
-
-#endif  // GTEST_OS_WINDOWS
-
-// Functions deprecated by MSVC 8.0.
-
-#ifdef _MSC_VER
-// Temporarily disable warning 4996 (deprecated function).
-#pragma warning(push)
-#pragma warning(disable:4996)
-#endif
-
-inline const char* StrNCpy(char* dest, const char* src, size_t n) {
-  return strncpy(dest, src, n);
-}
-
-// ChDir(), FReopen(), FDOpen(), Read(), Write(), Close(), and
-// StrError() aren't needed on Windows CE at this time and thus not
-// defined there.
-
-#if !GTEST_OS_WINDOWS_MOBILE
-inline int ChDir(const char* dir) { return chdir(dir); }
-#endif
-inline FILE* FOpen(const char* path, const char* mode) {
-  return fopen(path, mode);
-}
-#if !GTEST_OS_WINDOWS_MOBILE
-inline FILE *FReopen(const char* path, const char* mode, FILE* stream) {
-  return freopen(path, mode, stream);
-}
-inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); }
-#endif
-inline int FClose(FILE* fp) { return fclose(fp); }
-#if !GTEST_OS_WINDOWS_MOBILE
-inline int Read(int fd, void* buf, unsigned int count) {
-  return static_cast<int>(read(fd, buf, count));
-}
-inline int Write(int fd, const void* buf, unsigned int count) {
-  return static_cast<int>(write(fd, buf, count));
-}
-inline int Close(int fd) { return close(fd); }
-inline const char* StrError(int errnum) { return strerror(errnum); }
-#endif
-inline const char* GetEnv(const char* name) {
-#if GTEST_OS_WINDOWS_MOBILE
-  // We are on Windows CE, which has no environment variables.
-  return NULL;
-#elif defined(__BORLANDC__)
-  // Environment variables which we programmatically clear will be set to the
-  // empty string rather than unset (NULL).  Handle that case.
-  const char* const env = getenv(name);
-  return (env != NULL && env[0] != '\0') ? env : NULL;
-#else
-  return getenv(name);
-#endif
-}
-
-#ifdef _MSC_VER
-#pragma warning(pop)  // Restores the warning state.
-#endif
-
-#if GTEST_OS_WINDOWS_MOBILE
-// Windows CE has no C library. The abort() function is used in
-// several places in Google Test. This implementation provides a reasonable
-// imitation of standard behaviour.
-void Abort();
-#else
-inline void Abort() { abort(); }
-#endif  // GTEST_OS_WINDOWS_MOBILE
-
-}  // namespace posix
-
-// The maximum number a BiggestInt can represent.  This definition
-// works no matter BiggestInt is represented in one's complement or
-// two's complement.
-//
-// We cannot rely on numeric_limits in STL, as __int64 and long long
-// are not part of standard C++ and numeric_limits doesn't need to be
-// defined for them.
-const BiggestInt kMaxBiggestInt =
-    ~(static_cast<BiggestInt>(1) << (8*sizeof(BiggestInt) - 1));
-
-// This template class serves as a compile-time function from size to
-// type.  It maps a size in bytes to a primitive type with that
-// size. e.g.
-//
-//   TypeWithSize<4>::UInt
-//
-// is typedef-ed to be unsigned int (unsigned integer made up of 4
-// bytes).
-//
-// Such functionality should belong to STL, but I cannot find it
-// there.
-//
-// Google Test uses this class in the implementation of floating-point
-// comparison.
-//
-// For now it only handles UInt (unsigned int) as that's all Google Test
-// needs.  Other types can be easily added in the future if need
-// arises.
-template <size_t size>
-class TypeWithSize {
- public:
-  // This prevents the user from using TypeWithSize<N> with incorrect
-  // values of N.
-  typedef void UInt;
-};
-
-// The specialization for size 4.
-template <>
-class TypeWithSize<4> {
- public:
-  // unsigned int has size 4 in both gcc and MSVC.
-  //
-  // As base/basictypes.h doesn't compile on Windows, we cannot use
-  // uint32, uint64, and etc here.
-  typedef int Int;
-  typedef unsigned int UInt;
-};
-
-// The specialization for size 8.
-template <>
-class TypeWithSize<8> {
- public:
-#if GTEST_OS_WINDOWS
-  typedef __int64 Int;
-  typedef unsigned __int64 UInt;
-#else
-  typedef long long Int;  // NOLINT
-  typedef unsigned long long UInt;  // NOLINT
-#endif  // GTEST_OS_WINDOWS
-};
-
-// Integer types of known sizes.
-typedef TypeWithSize<4>::Int Int32;
-typedef TypeWithSize<4>::UInt UInt32;
-typedef TypeWithSize<8>::Int Int64;
-typedef TypeWithSize<8>::UInt UInt64;
-typedef TypeWithSize<8>::Int TimeInMillis;  // Represents time in milliseconds.
-
-// Utilities for command line flags and environment variables.
-
-// INTERNAL IMPLEMENTATION - DO NOT USE.
-//
-// GTEST_CHECK_ is an all-mode assert. It aborts the program if the condition
-// is not satisfied.
-//  Synopsys:
-//    GTEST_CHECK_(boolean_condition);
-//     or
-//    GTEST_CHECK_(boolean_condition) << "Additional message";
-//
-//    This checks the condition and if the condition is not satisfied
-//    it prints message about the condition violation, including the
-//    condition itself, plus additional message streamed into it, if any,
-//    and then it aborts the program. It aborts the program irrespective of
-//    whether it is built in the debug mode or not.
-#define GTEST_CHECK_(condition) \
-    GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
-    if (::testing::internal::IsTrue(condition)) \
-      ; \
-    else \
-      GTEST_LOG_(FATAL) << "Condition " #condition " failed. "
-
-// Macro for referencing flags.
-#define GTEST_FLAG(name) FLAGS_gtest_##name
-
-// Macros for declaring flags.
-#define GTEST_DECLARE_bool_(name) extern bool GTEST_FLAG(name)
-#define GTEST_DECLARE_int32_(name) \
-    extern ::testing::internal::Int32 GTEST_FLAG(name)
-#define GTEST_DECLARE_string_(name) \
-    extern ::testing::internal::String GTEST_FLAG(name)
-
-// Macros for defining flags.
-#define GTEST_DEFINE_bool_(name, default_val, doc) \
-    bool GTEST_FLAG(name) = (default_val)
-#define GTEST_DEFINE_int32_(name, default_val, doc) \
-    ::testing::internal::Int32 GTEST_FLAG(name) = (default_val)
-#define GTEST_DEFINE_string_(name, default_val, doc) \
-    ::testing::internal::String GTEST_FLAG(name) = (default_val)
-
-// Parses 'str' for a 32-bit signed integer.  If successful, writes the result
-// to *value and returns true; otherwise leaves *value unchanged and returns
-// false.
-// TODO(chandlerc): Find a better way to refactor flag and environment parsing
-// out of both gtest-port.cc and gtest.cc to avoid exporting this utility
-// function.
-bool ParseInt32(const Message& src_text, const char* str, Int32* value);
-
-// Parses a bool/Int32/string from the environment variable
-// corresponding to the given Google Test flag.
-bool BoolFromGTestEnv(const char* flag, bool default_val);
-Int32 Int32FromGTestEnv(const char* flag, Int32 default_val);
-const char* StringFromGTestEnv(const char* flag, const char* default_val);
-
-}  // namespace internal
-}  // namespace testing
-
-#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
diff --git a/third_party/gtest/include/gtest/internal/gtest-string.h b/third_party/gtest/include/gtest/internal/gtest-string.h
deleted file mode 100644
index 4bc8241..0000000
--- a/third_party/gtest/include/gtest/internal/gtest-string.h
+++ /dev/null
@@ -1,348 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file declares the String class and functions used internally by
-// Google Test.  They are subject to change without notice. They should not used
-// by code external to Google Test.
-//
-// This header file is #included by <gtest/internal/gtest-internal.h>.
-// It should not be #included by other files.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
-
-#include <string.h>
-#include <gtest/internal/gtest-port.h>
-
-#if GTEST_HAS_GLOBAL_STRING || GTEST_HAS_STD_STRING
-#include <string>
-#endif  // GTEST_HAS_GLOBAL_STRING || GTEST_HAS_STD_STRING
-
-namespace testing {
-namespace internal {
-
-// String - a UTF-8 string class.
-//
-// We cannot use std::string as Microsoft's STL implementation in
-// Visual C++ 7.1 has problems when exception is disabled.  There is a
-// hack to work around this, but we've seen cases where the hack fails
-// to work.
-//
-// Also, String is different from std::string in that it can represent
-// both NULL and the empty string, while std::string cannot represent
-// NULL.
-//
-// NULL and the empty string are considered different.  NULL is less
-// than anything (including the empty string) except itself.
-//
-// This class only provides minimum functionality necessary for
-// implementing Google Test.  We do not intend to implement a full-fledged
-// string class here.
-//
-// Since the purpose of this class is to provide a substitute for
-// std::string on platforms where it cannot be used, we define a copy
-// constructor and assignment operators such that we don't need
-// conditional compilation in a lot of places.
-//
-// In order to make the representation efficient, the d'tor of String
-// is not virtual.  Therefore DO NOT INHERIT FROM String.
-class String {
- public:
-  // Static utility methods
-
-  // Returns the input enclosed in double quotes if it's not NULL;
-  // otherwise returns "(null)".  For example, "\"Hello\"" is returned
-  // for input "Hello".
-  //
-  // This is useful for printing a C string in the syntax of a literal.
-  //
-  // Known issue: escape sequences are not handled yet.
-  static String ShowCStringQuoted(const char* c_str);
-
-  // Clones a 0-terminated C string, allocating memory using new.  The
-  // caller is responsible for deleting the return value using
-  // delete[].  Returns the cloned string, or NULL if the input is
-  // NULL.
-  //
-  // This is different from strdup() in string.h, which allocates
-  // memory using malloc().
-  static const char* CloneCString(const char* c_str);
-
-#if GTEST_OS_WINDOWS_MOBILE
-  // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be
-  // able to pass strings to Win32 APIs on CE we need to convert them
-  // to 'Unicode', UTF-16.
-
-  // Creates a UTF-16 wide string from the given ANSI string, allocating
-  // memory using new. The caller is responsible for deleting the return
-  // value using delete[]. Returns the wide string, or NULL if the
-  // input is NULL.
-  //
-  // The wide string is created using the ANSI codepage (CP_ACP) to
-  // match the behaviour of the ANSI versions of Win32 calls and the
-  // C runtime.
-  static LPCWSTR AnsiToUtf16(const char* c_str);
-
-  // Creates an ANSI string from the given wide string, allocating
-  // memory using new. The caller is responsible for deleting the return
-  // value using delete[]. Returns the ANSI string, or NULL if the
-  // input is NULL.
-  //
-  // The returned string is created using the ANSI codepage (CP_ACP) to
-  // match the behaviour of the ANSI versions of Win32 calls and the
-  // C runtime.
-  static const char* Utf16ToAnsi(LPCWSTR utf16_str);
-#endif
-
-  // Compares two C strings.  Returns true iff they have the same content.
-  //
-  // Unlike strcmp(), this function can handle NULL argument(s).  A
-  // NULL C string is considered different to any non-NULL C string,
-  // including the empty string.
-  static bool CStringEquals(const char* lhs, const char* rhs);
-
-  // Converts a wide C string to a String using the UTF-8 encoding.
-  // NULL will be converted to "(null)".  If an error occurred during
-  // the conversion, "(failed to convert from wide string)" is
-  // returned.
-  static String ShowWideCString(const wchar_t* wide_c_str);
-
-  // Similar to ShowWideCString(), except that this function encloses
-  // the converted string in double quotes.
-  static String ShowWideCStringQuoted(const wchar_t* wide_c_str);
-
-  // Compares two wide C strings.  Returns true iff they have the same
-  // content.
-  //
-  // Unlike wcscmp(), this function can handle NULL argument(s).  A
-  // NULL C string is considered different to any non-NULL C string,
-  // including the empty string.
-  static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs);
-
-  // Compares two C strings, ignoring case.  Returns true iff they
-  // have the same content.
-  //
-  // Unlike strcasecmp(), this function can handle NULL argument(s).
-  // A NULL C string is considered different to any non-NULL C string,
-  // including the empty string.
-  static bool CaseInsensitiveCStringEquals(const char* lhs,
-                                           const char* rhs);
-
-  // Compares two wide C strings, ignoring case.  Returns true iff they
-  // have the same content.
-  //
-  // Unlike wcscasecmp(), this function can handle NULL argument(s).
-  // A NULL C string is considered different to any non-NULL wide C string,
-  // including the empty string.
-  // NB: The implementations on different platforms slightly differ.
-  // On windows, this method uses _wcsicmp which compares according to LC_CTYPE
-  // environment variable. On GNU platform this method uses wcscasecmp
-  // which compares according to LC_CTYPE category of the current locale.
-  // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
-  // current locale.
-  static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
-                                               const wchar_t* rhs);
-
-  // Formats a list of arguments to a String, using the same format
-  // spec string as for printf.
-  //
-  // We do not use the StringPrintf class as it is not universally
-  // available.
-  //
-  // The result is limited to 4096 characters (including the tailing
-  // 0).  If 4096 characters are not enough to format the input,
-  // "<buffer exceeded>" is returned.
-  static String Format(const char* format, ...);
-
-  // C'tors
-
-  // The default c'tor constructs a NULL string.
-  String() : c_str_(NULL), length_(0) {}
-
-  // Constructs a String by cloning a 0-terminated C string.
-  String(const char* c_str) {  // NOLINT
-    if (c_str == NULL) {
-      c_str_ = NULL;
-      length_ = 0;
-    } else {
-      ConstructNonNull(c_str, strlen(c_str));
-    }
-  }
-
-  // Constructs a String by copying a given number of chars from a
-  // buffer.  E.g. String("hello", 3) creates the string "hel",
-  // String("a\0bcd", 4) creates "a\0bc", String(NULL, 0) creates "",
-  // and String(NULL, 1) results in access violation.
-  String(const char* buffer, size_t length) {
-    ConstructNonNull(buffer, length);
-  }
-
-  // The copy c'tor creates a new copy of the string.  The two
-  // String objects do not share content.
-  String(const String& str) : c_str_(NULL), length_(0) { *this = str; }
-
-  // D'tor.  String is intended to be a final class, so the d'tor
-  // doesn't need to be virtual.
-  ~String() { delete[] c_str_; }
-
-  // Allows a String to be implicitly converted to an ::std::string or
-  // ::string, and vice versa.  Converting a String containing a NULL
-  // pointer to ::std::string or ::string is undefined behavior.
-  // Converting a ::std::string or ::string containing an embedded NUL
-  // character to a String will result in the prefix up to the first
-  // NUL character.
-#if GTEST_HAS_STD_STRING
-  String(const ::std::string& str) {
-    ConstructNonNull(str.c_str(), str.length());
-  }
-
-  operator ::std::string() const { return ::std::string(c_str(), length()); }
-#endif  // GTEST_HAS_STD_STRING
-
-#if GTEST_HAS_GLOBAL_STRING
-  String(const ::string& str) {
-    ConstructNonNull(str.c_str(), str.length());
-  }
-
-  operator ::string() const { return ::string(c_str(), length()); }
-#endif  // GTEST_HAS_GLOBAL_STRING
-
-  // Returns true iff this is an empty string (i.e. "").
-  bool empty() const { return (c_str() != NULL) && (length() == 0); }
-
-  // Compares this with another String.
-  // Returns < 0 if this is less than rhs, 0 if this is equal to rhs, or > 0
-  // if this is greater than rhs.
-  int Compare(const String& rhs) const;
-
-  // Returns true iff this String equals the given C string.  A NULL
-  // string and a non-NULL string are considered not equal.
-  bool operator==(const char* c_str) const { return Compare(c_str) == 0; }
-
-  // Returns true iff this String is less than the given String.  A
-  // NULL string is considered less than "".
-  bool operator<(const String& rhs) const { return Compare(rhs) < 0; }
-
-  // Returns true iff this String doesn't equal the given C string.  A NULL
-  // string and a non-NULL string are considered not equal.
-  bool operator!=(const char* c_str) const { return !(*this == c_str); }
-
-  // Returns true iff this String ends with the given suffix.  *Any*
-  // String is considered to end with a NULL or empty suffix.
-  bool EndsWith(const char* suffix) const;
-
-  // Returns true iff this String ends with the given suffix, not considering
-  // case. Any String is considered to end with a NULL or empty suffix.
-  bool EndsWithCaseInsensitive(const char* suffix) const;
-
-  // Returns the length of the encapsulated string, or 0 if the
-  // string is NULL.
-  size_t length() const { return length_; }
-
-  // Gets the 0-terminated C string this String object represents.
-  // The String object still owns the string.  Therefore the caller
-  // should NOT delete the return value.
-  const char* c_str() const { return c_str_; }
-
-  // Assigns a C string to this object.  Self-assignment works.
-  const String& operator=(const char* c_str) { return *this = String(c_str); }
-
-  // Assigns a String object to this object.  Self-assignment works.
-  const String& operator=(const String& rhs) {
-    if (this != &rhs) {
-      delete[] c_str_;
-      if (rhs.c_str() == NULL) {
-        c_str_ = NULL;
-        length_ = 0;
-      } else {
-        ConstructNonNull(rhs.c_str(), rhs.length());
-      }
-    }
-
-    return *this;
-  }
-
- private:
-  // Constructs a non-NULL String from the given content.  This
-  // function can only be called when data_ has not been allocated.
-  // ConstructNonNull(NULL, 0) results in an empty string ("").
-  // ConstructNonNull(NULL, non_zero) is undefined behavior.
-  void ConstructNonNull(const char* buffer, size_t length) {
-    char* const str = new char[length + 1];
-    memcpy(str, buffer, length);
-    str[length] = '\0';
-    c_str_ = str;
-    length_ = length;
-  }
-
-  const char* c_str_;
-  size_t length_;
-};  // class String
-
-// Streams a String to an ostream.  Each '\0' character in the String
-// is replaced with "\\0".
-inline ::std::ostream& operator<<(::std::ostream& os, const String& str) {
-  if (str.c_str() == NULL) {
-    os << "(null)";
-  } else {
-    const char* const c_str = str.c_str();
-    for (size_t i = 0; i != str.length(); i++) {
-      if (c_str[i] == '\0') {
-        os << "\\0";
-      } else {
-        os << c_str[i];
-      }
-    }
-  }
-  return os;
-}
-
-// Gets the content of the StrStream's buffer as a String.  Each '\0'
-// character in the buffer is replaced with "\\0".
-String StrStreamToString(StrStream* stream);
-
-// Converts a streamable value to a String.  A NULL pointer is
-// converted to "(null)".  When the input value is a ::string,
-// ::std::string, ::wstring, or ::std::wstring object, each NUL
-// character in it is replaced with "\\0".
-
-// Declared here but defined in gtest.h, so that it has access
-// to the definition of the Message class, required by the ARM
-// compiler.
-template <typename T>
-String StreamableToString(const T& streamable);
-
-}  // namespace internal
-}  // namespace testing
-
-#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
diff --git a/third_party/gtest/include/gtest/internal/gtest-tuple.h b/third_party/gtest/include/gtest/internal/gtest-tuple.h
deleted file mode 100644
index c201f5c..0000000
--- a/third_party/gtest/include/gtest/internal/gtest-tuple.h
+++ /dev/null
@@ -1,967 +0,0 @@
-// This file was GENERATED by a script.  DO NOT EDIT BY HAND!!!
-
-// Copyright 2009 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
-
-#include <utility>  // For ::std::pair.
-
-// The compiler used in Symbian has a bug that prevents us from declaring the
-// tuple template as a friend (it complains that tuple is redefined).  This
-// hack bypasses the bug by declaring the members that should otherwise be
-// private as public.
-#if defined(__SYMBIAN32__)
-#define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
-#else
-#define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
-    template <GTEST_10_TYPENAMES_(U)> friend class tuple; \
-   private:
-#endif
-
-// GTEST_n_TUPLE_(T) is the type of an n-tuple.
-#define GTEST_0_TUPLE_(T) tuple<>
-#define GTEST_1_TUPLE_(T) tuple<T##0, void, void, void, void, void, void, \
-    void, void, void>
-#define GTEST_2_TUPLE_(T) tuple<T##0, T##1, void, void, void, void, void, \
-    void, void, void>
-#define GTEST_3_TUPLE_(T) tuple<T##0, T##1, T##2, void, void, void, void, \
-    void, void, void>
-#define GTEST_4_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, void, void, void, \
-    void, void, void>
-#define GTEST_5_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, void, void, \
-    void, void, void>
-#define GTEST_6_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, void, \
-    void, void, void>
-#define GTEST_7_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
-    void, void, void>
-#define GTEST_8_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
-    T##7, void, void>
-#define GTEST_9_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
-    T##7, T##8, void>
-#define GTEST_10_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
-    T##7, T##8, T##9>
-
-// GTEST_n_TYPENAMES_(T) declares a list of n typenames.
-#define GTEST_0_TYPENAMES_(T)
-#define GTEST_1_TYPENAMES_(T) typename T##0
-#define GTEST_2_TYPENAMES_(T) typename T##0, typename T##1
-#define GTEST_3_TYPENAMES_(T) typename T##0, typename T##1, typename T##2
-#define GTEST_4_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
-    typename T##3
-#define GTEST_5_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
-    typename T##3, typename T##4
-#define GTEST_6_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
-    typename T##3, typename T##4, typename T##5
-#define GTEST_7_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
-    typename T##3, typename T##4, typename T##5, typename T##6
-#define GTEST_8_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
-    typename T##3, typename T##4, typename T##5, typename T##6, typename T##7
-#define GTEST_9_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
-    typename T##3, typename T##4, typename T##5, typename T##6, \
-    typename T##7, typename T##8
-#define GTEST_10_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
-    typename T##3, typename T##4, typename T##5, typename T##6, \
-    typename T##7, typename T##8, typename T##9
-
-// In theory, defining stuff in the ::std namespace is undefined
-// behavior.  We can do this as we are playing the role of a standard
-// library vendor.
-namespace std {
-namespace tr1 {
-
-template <typename T0 = void, typename T1 = void, typename T2 = void,
-    typename T3 = void, typename T4 = void, typename T5 = void,
-    typename T6 = void, typename T7 = void, typename T8 = void,
-    typename T9 = void>
-class tuple;
-
-// Anything in namespace gtest_internal is Google Test's INTERNAL
-// IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.
-namespace gtest_internal {
-
-// ByRef<T>::type is T if T is a reference; otherwise it's const T&.
-template <typename T>
-struct ByRef { typedef const T& type; };  // NOLINT
-template <typename T>
-struct ByRef<T&> { typedef T& type; };  // NOLINT
-
-// A handy wrapper for ByRef.
-#define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type
-
-// AddRef<T>::type is T if T is a reference; otherwise it's T&.  This
-// is the same as tr1::add_reference<T>::type.
-template <typename T>
-struct AddRef { typedef T& type; };  // NOLINT
-template <typename T>
-struct AddRef<T&> { typedef T& type; };  // NOLINT
-
-// A handy wrapper for AddRef.
-#define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type
-
-// A helper for implementing get<k>().
-template <int k> class Get;
-
-// A helper for implementing tuple_element<k, T>.  kIndexValid is true
-// iff k < the number of fields in tuple type T.
-template <bool kIndexValid, int kIndex, class Tuple>
-struct TupleElement;
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 0, GTEST_10_TUPLE_(T)> { typedef T0 type; };
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 1, GTEST_10_TUPLE_(T)> { typedef T1 type; };
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 2, GTEST_10_TUPLE_(T)> { typedef T2 type; };
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 3, GTEST_10_TUPLE_(T)> { typedef T3 type; };
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 4, GTEST_10_TUPLE_(T)> { typedef T4 type; };
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 5, GTEST_10_TUPLE_(T)> { typedef T5 type; };
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 6, GTEST_10_TUPLE_(T)> { typedef T6 type; };
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 7, GTEST_10_TUPLE_(T)> { typedef T7 type; };
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 8, GTEST_10_TUPLE_(T)> { typedef T8 type; };
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 9, GTEST_10_TUPLE_(T)> { typedef T9 type; };
-
-}  // namespace gtest_internal
-
-template <>
-class tuple<> {
- public:
-  tuple() {}
-  tuple(const tuple& /* t */)  {}
-  tuple& operator=(const tuple& /* t */) { return *this; }
-};
-
-template <GTEST_1_TYPENAMES_(T)>
-class GTEST_1_TUPLE_(T) {
- public:
-  template <int k> friend class gtest_internal::Get;
-
-  tuple() : f0_() {}
-
-  explicit tuple(GTEST_BY_REF_(T0) f0) : f0_(f0) {}
-
-  tuple(const tuple& t) : f0_(t.f0_) {}
-
-  template <GTEST_1_TYPENAMES_(U)>
-  tuple(const GTEST_1_TUPLE_(U)& t) : f0_(t.f0_) {}
-
-  tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
-  template <GTEST_1_TYPENAMES_(U)>
-  tuple& operator=(const GTEST_1_TUPLE_(U)& t) {
-    return CopyFrom(t);
-  }
-
-  GTEST_DECLARE_TUPLE_AS_FRIEND_
-
-  template <GTEST_1_TYPENAMES_(U)>
-  tuple& CopyFrom(const GTEST_1_TUPLE_(U)& t) {
-    f0_ = t.f0_;
-    return *this;
-  }
-
-  T0 f0_;
-};
-
-template <GTEST_2_TYPENAMES_(T)>
-class GTEST_2_TUPLE_(T) {
- public:
-  template <int k> friend class gtest_internal::Get;
-
-  tuple() : f0_(), f1_() {}
-
-  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1) : f0_(f0),
-      f1_(f1) {}
-
-  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_) {}
-
-  template <GTEST_2_TYPENAMES_(U)>
-  tuple(const GTEST_2_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_) {}
-  template <typename U0, typename U1>
-  tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {}
-
-  tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
-  template <GTEST_2_TYPENAMES_(U)>
-  tuple& operator=(const GTEST_2_TUPLE_(U)& t) {
-    return CopyFrom(t);
-  }
-  template <typename U0, typename U1>
-  tuple& operator=(const ::std::pair<U0, U1>& p) {
-    f0_ = p.first;
-    f1_ = p.second;
-    return *this;
-  }
-
-  GTEST_DECLARE_TUPLE_AS_FRIEND_
-
-  template <GTEST_2_TYPENAMES_(U)>
-  tuple& CopyFrom(const GTEST_2_TUPLE_(U)& t) {
-    f0_ = t.f0_;
-    f1_ = t.f1_;
-    return *this;
-  }
-
-  T0 f0_;
-  T1 f1_;
-};
-
-template <GTEST_3_TYPENAMES_(T)>
-class GTEST_3_TUPLE_(T) {
- public:
-  template <int k> friend class gtest_internal::Get;
-
-  tuple() : f0_(), f1_(), f2_() {}
-
-  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
-      GTEST_BY_REF_(T2) f2) : f0_(f0), f1_(f1), f2_(f2) {}
-
-  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
-
-  template <GTEST_3_TYPENAMES_(U)>
-  tuple(const GTEST_3_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
-
-  tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
-  template <GTEST_3_TYPENAMES_(U)>
-  tuple& operator=(const GTEST_3_TUPLE_(U)& t) {
-    return CopyFrom(t);
-  }
-
-  GTEST_DECLARE_TUPLE_AS_FRIEND_
-
-  template <GTEST_3_TYPENAMES_(U)>
-  tuple& CopyFrom(const GTEST_3_TUPLE_(U)& t) {
-    f0_ = t.f0_;
-    f1_ = t.f1_;
-    f2_ = t.f2_;
-    return *this;
-  }
-
-  T0 f0_;
-  T1 f1_;
-  T2 f2_;
-};
-
-template <GTEST_4_TYPENAMES_(T)>
-class GTEST_4_TUPLE_(T) {
- public:
-  template <int k> friend class gtest_internal::Get;
-
-  tuple() : f0_(), f1_(), f2_(), f3_() {}
-
-  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
-      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3) : f0_(f0), f1_(f1), f2_(f2),
-      f3_(f3) {}
-
-  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {}
-
-  template <GTEST_4_TYPENAMES_(U)>
-  tuple(const GTEST_4_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
-      f3_(t.f3_) {}
-
-  tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
-  template <GTEST_4_TYPENAMES_(U)>
-  tuple& operator=(const GTEST_4_TUPLE_(U)& t) {
-    return CopyFrom(t);
-  }
-
-  GTEST_DECLARE_TUPLE_AS_FRIEND_
-
-  template <GTEST_4_TYPENAMES_(U)>
-  tuple& CopyFrom(const GTEST_4_TUPLE_(U)& t) {
-    f0_ = t.f0_;
-    f1_ = t.f1_;
-    f2_ = t.f2_;
-    f3_ = t.f3_;
-    return *this;
-  }
-
-  T0 f0_;
-  T1 f1_;
-  T2 f2_;
-  T3 f3_;
-};
-
-template <GTEST_5_TYPENAMES_(T)>
-class GTEST_5_TUPLE_(T) {
- public:
-  template <int k> friend class gtest_internal::Get;
-
-  tuple() : f0_(), f1_(), f2_(), f3_(), f4_() {}
-
-  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
-      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3,
-      GTEST_BY_REF_(T4) f4) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4) {}
-
-  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
-      f4_(t.f4_) {}
-
-  template <GTEST_5_TYPENAMES_(U)>
-  tuple(const GTEST_5_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
-      f3_(t.f3_), f4_(t.f4_) {}
-
-  tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
-  template <GTEST_5_TYPENAMES_(U)>
-  tuple& operator=(const GTEST_5_TUPLE_(U)& t) {
-    return CopyFrom(t);
-  }
-
-  GTEST_DECLARE_TUPLE_AS_FRIEND_
-
-  template <GTEST_5_TYPENAMES_(U)>
-  tuple& CopyFrom(const GTEST_5_TUPLE_(U)& t) {
-    f0_ = t.f0_;
-    f1_ = t.f1_;
-    f2_ = t.f2_;
-    f3_ = t.f3_;
-    f4_ = t.f4_;
-    return *this;
-  }
-
-  T0 f0_;
-  T1 f1_;
-  T2 f2_;
-  T3 f3_;
-  T4 f4_;
-};
-
-template <GTEST_6_TYPENAMES_(T)>
-class GTEST_6_TUPLE_(T) {
- public:
-  template <int k> friend class gtest_internal::Get;
-
-  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_() {}
-
-  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
-      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
-      GTEST_BY_REF_(T5) f5) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
-      f5_(f5) {}
-
-  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
-      f4_(t.f4_), f5_(t.f5_) {}
-
-  template <GTEST_6_TYPENAMES_(U)>
-  tuple(const GTEST_6_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
-      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {}
-
-  tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
-  template <GTEST_6_TYPENAMES_(U)>
-  tuple& operator=(const GTEST_6_TUPLE_(U)& t) {
-    return CopyFrom(t);
-  }
-
-  GTEST_DECLARE_TUPLE_AS_FRIEND_
-
-  template <GTEST_6_TYPENAMES_(U)>
-  tuple& CopyFrom(const GTEST_6_TUPLE_(U)& t) {
-    f0_ = t.f0_;
-    f1_ = t.f1_;
-    f2_ = t.f2_;
-    f3_ = t.f3_;
-    f4_ = t.f4_;
-    f5_ = t.f5_;
-    return *this;
-  }
-
-  T0 f0_;
-  T1 f1_;
-  T2 f2_;
-  T3 f3_;
-  T4 f4_;
-  T5 f5_;
-};
-
-template <GTEST_7_TYPENAMES_(T)>
-class GTEST_7_TUPLE_(T) {
- public:
-  template <int k> friend class gtest_internal::Get;
-
-  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_() {}
-
-  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
-      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
-      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6) : f0_(f0), f1_(f1), f2_(f2),
-      f3_(f3), f4_(f4), f5_(f5), f6_(f6) {}
-
-  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
-      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
-
-  template <GTEST_7_TYPENAMES_(U)>
-  tuple(const GTEST_7_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
-      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
-
-  tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
-  template <GTEST_7_TYPENAMES_(U)>
-  tuple& operator=(const GTEST_7_TUPLE_(U)& t) {
-    return CopyFrom(t);
-  }
-
-  GTEST_DECLARE_TUPLE_AS_FRIEND_
-
-  template <GTEST_7_TYPENAMES_(U)>
-  tuple& CopyFrom(const GTEST_7_TUPLE_(U)& t) {
-    f0_ = t.f0_;
-    f1_ = t.f1_;
-    f2_ = t.f2_;
-    f3_ = t.f3_;
-    f4_ = t.f4_;
-    f5_ = t.f5_;
-    f6_ = t.f6_;
-    return *this;
-  }
-
-  T0 f0_;
-  T1 f1_;
-  T2 f2_;
-  T3 f3_;
-  T4 f4_;
-  T5 f5_;
-  T6 f6_;
-};
-
-template <GTEST_8_TYPENAMES_(T)>
-class GTEST_8_TUPLE_(T) {
- public:
-  template <int k> friend class gtest_internal::Get;
-
-  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_() {}
-
-  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
-      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
-      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6,
-      GTEST_BY_REF_(T7) f7) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
-      f5_(f5), f6_(f6), f7_(f7) {}
-
-  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
-      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
-
-  template <GTEST_8_TYPENAMES_(U)>
-  tuple(const GTEST_8_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
-      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
-
-  tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
-  template <GTEST_8_TYPENAMES_(U)>
-  tuple& operator=(const GTEST_8_TUPLE_(U)& t) {
-    return CopyFrom(t);
-  }
-
-  GTEST_DECLARE_TUPLE_AS_FRIEND_
-
-  template <GTEST_8_TYPENAMES_(U)>
-  tuple& CopyFrom(const GTEST_8_TUPLE_(U)& t) {
-    f0_ = t.f0_;
-    f1_ = t.f1_;
-    f2_ = t.f2_;
-    f3_ = t.f3_;
-    f4_ = t.f4_;
-    f5_ = t.f5_;
-    f6_ = t.f6_;
-    f7_ = t.f7_;
-    return *this;
-  }
-
-  T0 f0_;
-  T1 f1_;
-  T2 f2_;
-  T3 f3_;
-  T4 f4_;
-  T5 f5_;
-  T6 f6_;
-  T7 f7_;
-};
-
-template <GTEST_9_TYPENAMES_(T)>
-class GTEST_9_TUPLE_(T) {
- public:
-  template <int k> friend class gtest_internal::Get;
-
-  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_() {}
-
-  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
-      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
-      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
-      GTEST_BY_REF_(T8) f8) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
-      f5_(f5), f6_(f6), f7_(f7), f8_(f8) {}
-
-  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
-      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
-
-  template <GTEST_9_TYPENAMES_(U)>
-  tuple(const GTEST_9_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
-      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
-
-  tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
-  template <GTEST_9_TYPENAMES_(U)>
-  tuple& operator=(const GTEST_9_TUPLE_(U)& t) {
-    return CopyFrom(t);
-  }
-
-  GTEST_DECLARE_TUPLE_AS_FRIEND_
-
-  template <GTEST_9_TYPENAMES_(U)>
-  tuple& CopyFrom(const GTEST_9_TUPLE_(U)& t) {
-    f0_ = t.f0_;
-    f1_ = t.f1_;
-    f2_ = t.f2_;
-    f3_ = t.f3_;
-    f4_ = t.f4_;
-    f5_ = t.f5_;
-    f6_ = t.f6_;
-    f7_ = t.f7_;
-    f8_ = t.f8_;
-    return *this;
-  }
-
-  T0 f0_;
-  T1 f1_;
-  T2 f2_;
-  T3 f3_;
-  T4 f4_;
-  T5 f5_;
-  T6 f6_;
-  T7 f7_;
-  T8 f8_;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-class tuple {
- public:
-  template <int k> friend class gtest_internal::Get;
-
-  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_(),
-      f9_() {}
-
-  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
-      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
-      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
-      GTEST_BY_REF_(T8) f8, GTEST_BY_REF_(T9) f9) : f0_(f0), f1_(f1), f2_(f2),
-      f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8), f9_(f9) {}
-
-  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
-      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {}
-
-  template <GTEST_10_TYPENAMES_(U)>
-  tuple(const GTEST_10_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
-      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_),
-      f9_(t.f9_) {}
-
-  tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
-  template <GTEST_10_TYPENAMES_(U)>
-  tuple& operator=(const GTEST_10_TUPLE_(U)& t) {
-    return CopyFrom(t);
-  }
-
-  GTEST_DECLARE_TUPLE_AS_FRIEND_
-
-  template <GTEST_10_TYPENAMES_(U)>
-  tuple& CopyFrom(const GTEST_10_TUPLE_(U)& t) {
-    f0_ = t.f0_;
-    f1_ = t.f1_;
-    f2_ = t.f2_;
-    f3_ = t.f3_;
-    f4_ = t.f4_;
-    f5_ = t.f5_;
-    f6_ = t.f6_;
-    f7_ = t.f7_;
-    f8_ = t.f8_;
-    f9_ = t.f9_;
-    return *this;
-  }
-
-  T0 f0_;
-  T1 f1_;
-  T2 f2_;
-  T3 f3_;
-  T4 f4_;
-  T5 f5_;
-  T6 f6_;
-  T7 f7_;
-  T8 f8_;
-  T9 f9_;
-};
-
-// 6.1.3.2 Tuple creation functions.
-
-// Known limitations: we don't support passing an
-// std::tr1::reference_wrapper<T> to make_tuple().  And we don't
-// implement tie().
-
-inline tuple<> make_tuple() { return tuple<>(); }
-
-template <GTEST_1_TYPENAMES_(T)>
-inline GTEST_1_TUPLE_(T) make_tuple(const T0& f0) {
-  return GTEST_1_TUPLE_(T)(f0);
-}
-
-template <GTEST_2_TYPENAMES_(T)>
-inline GTEST_2_TUPLE_(T) make_tuple(const T0& f0, const T1& f1) {
-  return GTEST_2_TUPLE_(T)(f0, f1);
-}
-
-template <GTEST_3_TYPENAMES_(T)>
-inline GTEST_3_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2) {
-  return GTEST_3_TUPLE_(T)(f0, f1, f2);
-}
-
-template <GTEST_4_TYPENAMES_(T)>
-inline GTEST_4_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
-    const T3& f3) {
-  return GTEST_4_TUPLE_(T)(f0, f1, f2, f3);
-}
-
-template <GTEST_5_TYPENAMES_(T)>
-inline GTEST_5_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
-    const T3& f3, const T4& f4) {
-  return GTEST_5_TUPLE_(T)(f0, f1, f2, f3, f4);
-}
-
-template <GTEST_6_TYPENAMES_(T)>
-inline GTEST_6_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
-    const T3& f3, const T4& f4, const T5& f5) {
-  return GTEST_6_TUPLE_(T)(f0, f1, f2, f3, f4, f5);
-}
-
-template <GTEST_7_TYPENAMES_(T)>
-inline GTEST_7_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
-    const T3& f3, const T4& f4, const T5& f5, const T6& f6) {
-  return GTEST_7_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6);
-}
-
-template <GTEST_8_TYPENAMES_(T)>
-inline GTEST_8_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
-    const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7) {
-  return GTEST_8_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7);
-}
-
-template <GTEST_9_TYPENAMES_(T)>
-inline GTEST_9_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
-    const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
-    const T8& f8) {
-  return GTEST_9_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8);
-}
-
-template <GTEST_10_TYPENAMES_(T)>
-inline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
-    const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
-    const T8& f8, const T9& f9) {
-  return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9);
-}
-
-// 6.1.3.3 Tuple helper classes.
-
-template <typename Tuple> struct tuple_size;
-
-template <GTEST_0_TYPENAMES_(T)>
-struct tuple_size<GTEST_0_TUPLE_(T)> { static const int value = 0; };
-
-template <GTEST_1_TYPENAMES_(T)>
-struct tuple_size<GTEST_1_TUPLE_(T)> { static const int value = 1; };
-
-template <GTEST_2_TYPENAMES_(T)>
-struct tuple_size<GTEST_2_TUPLE_(T)> { static const int value = 2; };
-
-template <GTEST_3_TYPENAMES_(T)>
-struct tuple_size<GTEST_3_TUPLE_(T)> { static const int value = 3; };
-
-template <GTEST_4_TYPENAMES_(T)>
-struct tuple_size<GTEST_4_TUPLE_(T)> { static const int value = 4; };
-
-template <GTEST_5_TYPENAMES_(T)>
-struct tuple_size<GTEST_5_TUPLE_(T)> { static const int value = 5; };
-
-template <GTEST_6_TYPENAMES_(T)>
-struct tuple_size<GTEST_6_TUPLE_(T)> { static const int value = 6; };
-
-template <GTEST_7_TYPENAMES_(T)>
-struct tuple_size<GTEST_7_TUPLE_(T)> { static const int value = 7; };
-
-template <GTEST_8_TYPENAMES_(T)>
-struct tuple_size<GTEST_8_TUPLE_(T)> { static const int value = 8; };
-
-template <GTEST_9_TYPENAMES_(T)>
-struct tuple_size<GTEST_9_TUPLE_(T)> { static const int value = 9; };
-
-template <GTEST_10_TYPENAMES_(T)>
-struct tuple_size<GTEST_10_TUPLE_(T)> { static const int value = 10; };
-
-template <int k, class Tuple>
-struct tuple_element {
-  typedef typename gtest_internal::TupleElement<
-      k < (tuple_size<Tuple>::value), k, Tuple>::type type;
-};
-
-#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type
-
-// 6.1.3.4 Element access.
-
-namespace gtest_internal {
-
-template <>
-class Get<0> {
- public:
-  template <class Tuple>
-  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
-  Field(Tuple& t) { return t.f0_; }  // NOLINT
-
-  template <class Tuple>
-  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
-  ConstField(const Tuple& t) { return t.f0_; }
-};
-
-template <>
-class Get<1> {
- public:
-  template <class Tuple>
-  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
-  Field(Tuple& t) { return t.f1_; }  // NOLINT
-
-  template <class Tuple>
-  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
-  ConstField(const Tuple& t) { return t.f1_; }
-};
-
-template <>
-class Get<2> {
- public:
-  template <class Tuple>
-  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
-  Field(Tuple& t) { return t.f2_; }  // NOLINT
-
-  template <class Tuple>
-  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
-  ConstField(const Tuple& t) { return t.f2_; }
-};
-
-template <>
-class Get<3> {
- public:
-  template <class Tuple>
-  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
-  Field(Tuple& t) { return t.f3_; }  // NOLINT
-
-  template <class Tuple>
-  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
-  ConstField(const Tuple& t) { return t.f3_; }
-};
-
-template <>
-class Get<4> {
- public:
-  template <class Tuple>
-  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
-  Field(Tuple& t) { return t.f4_; }  // NOLINT
-
-  template <class Tuple>
-  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
-  ConstField(const Tuple& t) { return t.f4_; }
-};
-
-template <>
-class Get<5> {
- public:
-  template <class Tuple>
-  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
-  Field(Tuple& t) { return t.f5_; }  // NOLINT
-
-  template <class Tuple>
-  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
-  ConstField(const Tuple& t) { return t.f5_; }
-};
-
-template <>
-class Get<6> {
- public:
-  template <class Tuple>
-  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
-  Field(Tuple& t) { return t.f6_; }  // NOLINT
-
-  template <class Tuple>
-  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
-  ConstField(const Tuple& t) { return t.f6_; }
-};
-
-template <>
-class Get<7> {
- public:
-  template <class Tuple>
-  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
-  Field(Tuple& t) { return t.f7_; }  // NOLINT
-
-  template <class Tuple>
-  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
-  ConstField(const Tuple& t) { return t.f7_; }
-};
-
-template <>
-class Get<8> {
- public:
-  template <class Tuple>
-  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
-  Field(Tuple& t) { return t.f8_; }  // NOLINT
-
-  template <class Tuple>
-  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
-  ConstField(const Tuple& t) { return t.f8_; }
-};
-
-template <>
-class Get<9> {
- public:
-  template <class Tuple>
-  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
-  Field(Tuple& t) { return t.f9_; }  // NOLINT
-
-  template <class Tuple>
-  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
-  ConstField(const Tuple& t) { return t.f9_; }
-};
-
-}  // namespace gtest_internal
-
-template <int k, GTEST_10_TYPENAMES_(T)>
-GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T)))
-get(GTEST_10_TUPLE_(T)& t) {
-  return gtest_internal::Get<k>::Field(t);
-}
-
-template <int k, GTEST_10_TYPENAMES_(T)>
-GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k,  GTEST_10_TUPLE_(T)))
-get(const GTEST_10_TUPLE_(T)& t) {
-  return gtest_internal::Get<k>::ConstField(t);
-}
-
-// 6.1.3.5 Relational operators
-
-// We only implement == and !=, as we don't have a need for the rest yet.
-
-namespace gtest_internal {
-
-// SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the
-// first k fields of t1 equals the first k fields of t2.
-// SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if
-// k1 != k2.
-template <int kSize1, int kSize2>
-struct SameSizeTuplePrefixComparator;
-
-template <>
-struct SameSizeTuplePrefixComparator<0, 0> {
-  template <class Tuple1, class Tuple2>
-  static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) {
-    return true;
-  }
-};
-
-template <int k>
-struct SameSizeTuplePrefixComparator<k, k> {
-  template <class Tuple1, class Tuple2>
-  static bool Eq(const Tuple1& t1, const Tuple2& t2) {
-    return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) &&
-        ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);
-  }
-};
-
-}  // namespace gtest_internal
-
-template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
-inline bool operator==(const GTEST_10_TUPLE_(T)& t,
-                       const GTEST_10_TUPLE_(U)& u) {
-  return gtest_internal::SameSizeTuplePrefixComparator<
-      tuple_size<GTEST_10_TUPLE_(T)>::value,
-      tuple_size<GTEST_10_TUPLE_(U)>::value>::Eq(t, u);
-}
-
-template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
-inline bool operator!=(const GTEST_10_TUPLE_(T)& t,
-                       const GTEST_10_TUPLE_(U)& u) { return !(t == u); }
-
-// 6.1.4 Pairs.
-// Unimplemented.
-
-}  // namespace tr1
-}  // namespace std
-
-#undef GTEST_0_TUPLE_
-#undef GTEST_1_TUPLE_
-#undef GTEST_2_TUPLE_
-#undef GTEST_3_TUPLE_
-#undef GTEST_4_TUPLE_
-#undef GTEST_5_TUPLE_
-#undef GTEST_6_TUPLE_
-#undef GTEST_7_TUPLE_
-#undef GTEST_8_TUPLE_
-#undef GTEST_9_TUPLE_
-#undef GTEST_10_TUPLE_
-
-#undef GTEST_0_TYPENAMES_
-#undef GTEST_1_TYPENAMES_
-#undef GTEST_2_TYPENAMES_
-#undef GTEST_3_TYPENAMES_
-#undef GTEST_4_TYPENAMES_
-#undef GTEST_5_TYPENAMES_
-#undef GTEST_6_TYPENAMES_
-#undef GTEST_7_TYPENAMES_
-#undef GTEST_8_TYPENAMES_
-#undef GTEST_9_TYPENAMES_
-#undef GTEST_10_TYPENAMES_
-
-#undef GTEST_DECLARE_TUPLE_AS_FRIEND_
-#undef GTEST_BY_REF_
-#undef GTEST_ADD_REF_
-#undef GTEST_TUPLE_ELEMENT_
-
-#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
diff --git a/third_party/gtest/include/gtest/internal/gtest-type-util.h b/third_party/gtest/include/gtest/internal/gtest-type-util.h
deleted file mode 100644
index f1b1bed..0000000
--- a/third_party/gtest/include/gtest/internal/gtest-type-util.h
+++ /dev/null
@@ -1,3321 +0,0 @@
-// This file was GENERATED by a script.  DO NOT EDIT BY HAND!!!
-
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Type utilities needed for implementing typed and type-parameterized
-// tests.  This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!
-//
-// Currently we support at most 50 types in a list, and at most 50
-// type-parameterized tests in one type-parameterized test case.
-// Please contact googletestframework@googlegroups.com if you need
-// more.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
-
-#include <gtest/internal/gtest-port.h>
-#include <gtest/internal/gtest-string.h>
-
-#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-// #ifdef __GNUC__ is too general here.  It is possible to use gcc without using
-// libstdc++ (which is where cxxabi.h comes from).
-#ifdef __GLIBCXX__
-#include <cxxabi.h>
-#endif  // __GLIBCXX__
-
-#include <typeinfo>
-
-namespace testing {
-namespace internal {
-
-// AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same
-// type.  This can be used as a compile-time assertion to ensure that
-// two types are equal.
-
-template <typename T1, typename T2>
-struct AssertTypeEq;
-
-template <typename T>
-struct AssertTypeEq<T, T> {
-  typedef bool type;
-};
-
-// GetTypeName<T>() returns a human-readable name of type T.
-template <typename T>
-String GetTypeName() {
-#if GTEST_HAS_RTTI
-
-  const char* const name = typeid(T).name();
-#ifdef __GLIBCXX__
-  int status = 0;
-  // gcc's implementation of typeid(T).name() mangles the type name,
-  // so we have to demangle it.
-  char* const readable_name = abi::__cxa_demangle(name, 0, 0, &status);
-  const String name_str(status == 0 ? readable_name : name);
-  free(readable_name);
-  return name_str;
-#else
-  return name;
-#endif  // __GLIBCXX__
-
-#else
-  return "<type>";
-#endif  // GTEST_HAS_RTTI
-}
-
-// A unique type used as the default value for the arguments of class
-// template Types.  This allows us to simulate variadic templates
-// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
-// support directly.
-struct None {};
-
-// The following family of struct and struct templates are used to
-// represent type lists.  In particular, TypesN<T1, T2, ..., TN>
-// represents a type list with N types (T1, T2, ..., and TN) in it.
-// Except for Types0, every struct in the family has two member types:
-// Head for the first type in the list, and Tail for the rest of the
-// list.
-
-// The empty type list.
-struct Types0 {};
-
-// Type lists of length 1, 2, 3, and so on.
-
-template <typename T1>
-struct Types1 {
-  typedef T1 Head;
-  typedef Types0 Tail;
-};
-template <typename T1, typename T2>
-struct Types2 {
-  typedef T1 Head;
-  typedef Types1<T2> Tail;
-};
-
-template <typename T1, typename T2, typename T3>
-struct Types3 {
-  typedef T1 Head;
-  typedef Types2<T2, T3> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4>
-struct Types4 {
-  typedef T1 Head;
-  typedef Types3<T2, T3, T4> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-struct Types5 {
-  typedef T1 Head;
-  typedef Types4<T2, T3, T4, T5> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6>
-struct Types6 {
-  typedef T1 Head;
-  typedef Types5<T2, T3, T4, T5, T6> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7>
-struct Types7 {
-  typedef T1 Head;
-  typedef Types6<T2, T3, T4, T5, T6, T7> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8>
-struct Types8 {
-  typedef T1 Head;
-  typedef Types7<T2, T3, T4, T5, T6, T7, T8> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9>
-struct Types9 {
-  typedef T1 Head;
-  typedef Types8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10>
-struct Types10 {
-  typedef T1 Head;
-  typedef Types9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11>
-struct Types11 {
-  typedef T1 Head;
-  typedef Types10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12>
-struct Types12 {
-  typedef T1 Head;
-  typedef Types11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13>
-struct Types13 {
-  typedef T1 Head;
-  typedef Types12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14>
-struct Types14 {
-  typedef T1 Head;
-  typedef Types13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15>
-struct Types15 {
-  typedef T1 Head;
-  typedef Types14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16>
-struct Types16 {
-  typedef T1 Head;
-  typedef Types15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17>
-struct Types17 {
-  typedef T1 Head;
-  typedef Types16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18>
-struct Types18 {
-  typedef T1 Head;
-  typedef Types17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19>
-struct Types19 {
-  typedef T1 Head;
-  typedef Types18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20>
-struct Types20 {
-  typedef T1 Head;
-  typedef Types19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21>
-struct Types21 {
-  typedef T1 Head;
-  typedef Types20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22>
-struct Types22 {
-  typedef T1 Head;
-  typedef Types21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23>
-struct Types23 {
-  typedef T1 Head;
-  typedef Types22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24>
-struct Types24 {
-  typedef T1 Head;
-  typedef Types23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25>
-struct Types25 {
-  typedef T1 Head;
-  typedef Types24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26>
-struct Types26 {
-  typedef T1 Head;
-  typedef Types25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27>
-struct Types27 {
-  typedef T1 Head;
-  typedef Types26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28>
-struct Types28 {
-  typedef T1 Head;
-  typedef Types27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29>
-struct Types29 {
-  typedef T1 Head;
-  typedef Types28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30>
-struct Types30 {
-  typedef T1 Head;
-  typedef Types29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-      T30> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31>
-struct Types31 {
-  typedef T1 Head;
-  typedef Types30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-      T30, T31> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32>
-struct Types32 {
-  typedef T1 Head;
-  typedef Types31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-      T30, T31, T32> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33>
-struct Types33 {
-  typedef T1 Head;
-  typedef Types32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-      T30, T31, T32, T33> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34>
-struct Types34 {
-  typedef T1 Head;
-  typedef Types33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-      T30, T31, T32, T33, T34> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35>
-struct Types35 {
-  typedef T1 Head;
-  typedef Types34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-      T30, T31, T32, T33, T34, T35> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36>
-struct Types36 {
-  typedef T1 Head;
-  typedef Types35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-      T30, T31, T32, T33, T34, T35, T36> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37>
-struct Types37 {
-  typedef T1 Head;
-  typedef Types36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-      T30, T31, T32, T33, T34, T35, T36, T37> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38>
-struct Types38 {
-  typedef T1 Head;
-  typedef Types37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-      T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39>
-struct Types39 {
-  typedef T1 Head;
-  typedef Types38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40>
-struct Types40 {
-  typedef T1 Head;
-  typedef Types39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41>
-struct Types41 {
-  typedef T1 Head;
-  typedef Types40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42>
-struct Types42 {
-  typedef T1 Head;
-  typedef Types41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43>
-struct Types43 {
-  typedef T1 Head;
-  typedef Types42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
-      T43> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44>
-struct Types44 {
-  typedef T1 Head;
-  typedef Types43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
-      T44> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45>
-struct Types45 {
-  typedef T1 Head;
-  typedef Types44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
-      T44, T45> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45,
-    typename T46>
-struct Types46 {
-  typedef T1 Head;
-  typedef Types45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
-      T44, T45, T46> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45,
-    typename T46, typename T47>
-struct Types47 {
-  typedef T1 Head;
-  typedef Types46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
-      T44, T45, T46, T47> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45,
-    typename T46, typename T47, typename T48>
-struct Types48 {
-  typedef T1 Head;
-  typedef Types47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
-      T44, T45, T46, T47, T48> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45,
-    typename T46, typename T47, typename T48, typename T49>
-struct Types49 {
-  typedef T1 Head;
-  typedef Types48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
-      T44, T45, T46, T47, T48, T49> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45,
-    typename T46, typename T47, typename T48, typename T49, typename T50>
-struct Types50 {
-  typedef T1 Head;
-  typedef Types49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
-      T44, T45, T46, T47, T48, T49, T50> Tail;
-};
-
-
-}  // namespace internal
-
-// We don't want to require the users to write TypesN<...> directly,
-// as that would require them to count the length.  Types<...> is much
-// easier to write, but generates horrible messages when there is a
-// compiler error, as gcc insists on printing out each template
-// argument, even if it has the default value (this means Types<int>
-// will appear as Types<int, None, None, ..., None> in the compiler
-// errors).
-//
-// Our solution is to combine the best part of the two approaches: a
-// user would write Types<T1, ..., TN>, and Google Test will translate
-// that to TypesN<T1, ..., TN> internally to make error messages
-// readable.  The translation is done by the 'type' member of the
-// Types template.
-template <typename T1 = internal::None, typename T2 = internal::None,
-    typename T3 = internal::None, typename T4 = internal::None,
-    typename T5 = internal::None, typename T6 = internal::None,
-    typename T7 = internal::None, typename T8 = internal::None,
-    typename T9 = internal::None, typename T10 = internal::None,
-    typename T11 = internal::None, typename T12 = internal::None,
-    typename T13 = internal::None, typename T14 = internal::None,
-    typename T15 = internal::None, typename T16 = internal::None,
-    typename T17 = internal::None, typename T18 = internal::None,
-    typename T19 = internal::None, typename T20 = internal::None,
-    typename T21 = internal::None, typename T22 = internal::None,
-    typename T23 = internal::None, typename T24 = internal::None,
-    typename T25 = internal::None, typename T26 = internal::None,
-    typename T27 = internal::None, typename T28 = internal::None,
-    typename T29 = internal::None, typename T30 = internal::None,
-    typename T31 = internal::None, typename T32 = internal::None,
-    typename T33 = internal::None, typename T34 = internal::None,
-    typename T35 = internal::None, typename T36 = internal::None,
-    typename T37 = internal::None, typename T38 = internal::None,
-    typename T39 = internal::None, typename T40 = internal::None,
-    typename T41 = internal::None, typename T42 = internal::None,
-    typename T43 = internal::None, typename T44 = internal::None,
-    typename T45 = internal::None, typename T46 = internal::None,
-    typename T47 = internal::None, typename T48 = internal::None,
-    typename T49 = internal::None, typename T50 = internal::None>
-struct Types {
-  typedef internal::Types50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
-      T41, T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
-};
-
-template <>
-struct Types<internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None> {
-  typedef internal::Types0 type;
-};
-template <typename T1>
-struct Types<T1, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None> {
-  typedef internal::Types1<T1> type;
-};
-template <typename T1, typename T2>
-struct Types<T1, T2, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None> {
-  typedef internal::Types2<T1, T2> type;
-};
-template <typename T1, typename T2, typename T3>
-struct Types<T1, T2, T3, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None> {
-  typedef internal::Types3<T1, T2, T3> type;
-};
-template <typename T1, typename T2, typename T3, typename T4>
-struct Types<T1, T2, T3, T4, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None> {
-  typedef internal::Types4<T1, T2, T3, T4> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-struct Types<T1, T2, T3, T4, T5, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None> {
-  typedef internal::Types5<T1, T2, T3, T4, T5> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6>
-struct Types<T1, T2, T3, T4, T5, T6, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None> {
-  typedef internal::Types6<T1, T2, T3, T4, T5, T6> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7>
-struct Types<T1, T2, T3, T4, T5, T6, T7, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None> {
-  typedef internal::Types7<T1, T2, T3, T4, T5, T6, T7> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None> {
-  typedef internal::Types8<T1, T2, T3, T4, T5, T6, T7, T8> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None> {
-  typedef internal::Types9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None> {
-  typedef internal::Types10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None> {
-  typedef internal::Types11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None> {
-  typedef internal::Types12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
-      T12> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None> {
-  typedef internal::Types13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None> {
-  typedef internal::Types14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None> {
-  typedef internal::Types15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None> {
-  typedef internal::Types16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None> {
-  typedef internal::Types17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None> {
-  typedef internal::Types18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None> {
-  typedef internal::Types19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None> {
-  typedef internal::Types20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None> {
-  typedef internal::Types21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None> {
-  typedef internal::Types22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None> {
-  typedef internal::Types23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None> {
-  typedef internal::Types24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None> {
-  typedef internal::Types25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None> {
-  typedef internal::Types26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
-      T26> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None> {
-  typedef internal::Types27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None> {
-  typedef internal::Types28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None> {
-  typedef internal::Types29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None> {
-  typedef internal::Types30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29, T30> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
-    T31, internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None> {
-  typedef internal::Types31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29, T30, T31> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
-    T31, T32, internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None> {
-  typedef internal::Types32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29, T30, T31, T32> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
-    T31, T32, T33, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None> {
-  typedef internal::Types33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29, T30, T31, T32, T33> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
-    T31, T32, T33, T34, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None> {
-  typedef internal::Types34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29, T30, T31, T32, T33, T34> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
-    T31, T32, T33, T34, T35, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None> {
-  typedef internal::Types35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29, T30, T31, T32, T33, T34, T35> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
-    T31, T32, T33, T34, T35, T36, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None> {
-  typedef internal::Types36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
-    T31, T32, T33, T34, T35, T36, T37, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None> {
-  typedef internal::Types37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
-    T31, T32, T33, T34, T35, T36, T37, T38, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None> {
-  typedef internal::Types38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
-    T31, T32, T33, T34, T35, T36, T37, T38, T39, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None> {
-  typedef internal::Types39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
-    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None> {
-  typedef internal::Types40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
-      T40> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
-    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None, internal::None> {
-  typedef internal::Types41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
-      T41> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
-    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, internal::None,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None> {
-  typedef internal::Types42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
-      T41, T42> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
-    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None, internal::None> {
-  typedef internal::Types43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
-      T41, T42, T43> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
-    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None, internal::None> {
-  typedef internal::Types44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
-      T41, T42, T43, T44> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
-    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
-    internal::None, internal::None, internal::None, internal::None,
-    internal::None> {
-  typedef internal::Types45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
-      T41, T42, T43, T44, T45> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45,
-    typename T46>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
-    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
-    T46, internal::None, internal::None, internal::None, internal::None> {
-  typedef internal::Types46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
-      T41, T42, T43, T44, T45, T46> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45,
-    typename T46, typename T47>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
-    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
-    T46, T47, internal::None, internal::None, internal::None> {
-  typedef internal::Types47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
-      T41, T42, T43, T44, T45, T46, T47> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45,
-    typename T46, typename T47, typename T48>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
-    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
-    T46, T47, T48, internal::None, internal::None> {
-  typedef internal::Types48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
-      T41, T42, T43, T44, T45, T46, T47, T48> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45,
-    typename T46, typename T47, typename T48, typename T49>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
-    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
-    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
-    T46, T47, T48, T49, internal::None> {
-  typedef internal::Types49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
-      T41, T42, T43, T44, T45, T46, T47, T48, T49> type;
-};
-
-namespace internal {
-
-#define GTEST_TEMPLATE_ template <typename T> class
-
-// The template "selector" struct TemplateSel<Tmpl> is used to
-// represent Tmpl, which must be a class template with one type
-// parameter, as a type.  TemplateSel<Tmpl>::Bind<T>::type is defined
-// as the type Tmpl<T>.  This allows us to actually instantiate the
-// template "selected" by TemplateSel<Tmpl>.
-//
-// This trick is necessary for simulating typedef for class templates,
-// which C++ doesn't support directly.
-template <GTEST_TEMPLATE_ Tmpl>
-struct TemplateSel {
-  template <typename T>
-  struct Bind {
-    typedef Tmpl<T> type;
-  };
-};
-
-#define GTEST_BIND_(TmplSel, T) \
-  TmplSel::template Bind<T>::type
-
-// A unique struct template used as the default value for the
-// arguments of class template Templates.  This allows us to simulate
-// variadic templates (e.g. Templates<int>, Templates<int, double>,
-// and etc), which C++ doesn't support directly.
-template <typename T>
-struct NoneT {};
-
-// The following family of struct and struct templates are used to
-// represent template lists.  In particular, TemplatesN<T1, T2, ...,
-// TN> represents a list of N templates (T1, T2, ..., and TN).  Except
-// for Templates0, every struct in the family has two member types:
-// Head for the selector of the first template in the list, and Tail
-// for the rest of the list.
-
-// The empty template list.
-struct Templates0 {};
-
-// Template lists of length 1, 2, 3, and so on.
-
-template <GTEST_TEMPLATE_ T1>
-struct Templates1 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates0 Tail;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
-struct Templates2 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates1<T2> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
-struct Templates3 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates2<T2, T3> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4>
-struct Templates4 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates3<T2, T3, T4> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
-struct Templates5 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates4<T2, T3, T4, T5> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
-struct Templates6 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates5<T2, T3, T4, T5, T6> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7>
-struct Templates7 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates6<T2, T3, T4, T5, T6, T7> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
-struct Templates8 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates7<T2, T3, T4, T5, T6, T7, T8> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
-struct Templates9 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10>
-struct Templates10 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
-struct Templates11 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
-struct Templates12 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13>
-struct Templates13 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
-struct Templates14 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
-struct Templates15 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16>
-struct Templates16 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
-struct Templates17 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
-struct Templates18 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19>
-struct Templates19 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
-struct Templates20 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
-struct Templates21 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22>
-struct Templates22 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
-struct Templates23 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
-struct Templates24 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25>
-struct Templates25 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
-struct Templates26 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
-struct Templates27 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28>
-struct Templates28 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
-struct Templates29 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
-struct Templates30 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29, T30> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31>
-struct Templates31 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29, T30, T31> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
-struct Templates32 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29, T30, T31, T32> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
-struct Templates33 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29, T30, T31, T32, T33> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34>
-struct Templates34 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29, T30, T31, T32, T33, T34> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
-struct Templates35 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29, T30, T31, T32, T33, T34, T35> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
-struct Templates36 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29, T30, T31, T32, T33, T34, T35, T36> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37>
-struct Templates37 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29, T30, T31, T32, T33, T34, T35, T36, T37> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
-struct Templates38 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
-struct Templates39 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
-    GTEST_TEMPLATE_ T40>
-struct Templates40 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
-    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
-struct Templates41 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
-    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
-struct Templates42 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
-      T42> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
-    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
-    GTEST_TEMPLATE_ T43>
-struct Templates43 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
-      T43> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
-    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
-    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
-struct Templates44 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
-      T43, T44> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
-    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
-    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
-struct Templates45 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
-      T43, T44, T45> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
-    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
-    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
-    GTEST_TEMPLATE_ T46>
-struct Templates46 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
-      T43, T44, T45, T46> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
-    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
-    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
-    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
-struct Templates47 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
-      T43, T44, T45, T46, T47> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
-    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
-    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
-    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
-struct Templates48 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
-      T43, T44, T45, T46, T47, T48> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
-    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
-    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
-    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
-    GTEST_TEMPLATE_ T49>
-struct Templates49 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
-      T43, T44, T45, T46, T47, T48, T49> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
-    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
-    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
-    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
-    GTEST_TEMPLATE_ T49, GTEST_TEMPLATE_ T50>
-struct Templates50 {
-  typedef TemplateSel<T1> Head;
-  typedef Templates49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
-      T43, T44, T45, T46, T47, T48, T49, T50> Tail;
-};
-
-
-// We don't want to require the users to write TemplatesN<...> directly,
-// as that would require them to count the length.  Templates<...> is much
-// easier to write, but generates horrible messages when there is a
-// compiler error, as gcc insists on printing out each template
-// argument, even if it has the default value (this means Templates<list>
-// will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler
-// errors).
-//
-// Our solution is to combine the best part of the two approaches: a
-// user would write Templates<T1, ..., TN>, and Google Test will translate
-// that to TemplatesN<T1, ..., TN> internally to make error messages
-// readable.  The translation is done by the 'type' member of the
-// Templates template.
-template <GTEST_TEMPLATE_ T1 = NoneT, GTEST_TEMPLATE_ T2 = NoneT,
-    GTEST_TEMPLATE_ T3 = NoneT, GTEST_TEMPLATE_ T4 = NoneT,
-    GTEST_TEMPLATE_ T5 = NoneT, GTEST_TEMPLATE_ T6 = NoneT,
-    GTEST_TEMPLATE_ T7 = NoneT, GTEST_TEMPLATE_ T8 = NoneT,
-    GTEST_TEMPLATE_ T9 = NoneT, GTEST_TEMPLATE_ T10 = NoneT,
-    GTEST_TEMPLATE_ T11 = NoneT, GTEST_TEMPLATE_ T12 = NoneT,
-    GTEST_TEMPLATE_ T13 = NoneT, GTEST_TEMPLATE_ T14 = NoneT,
-    GTEST_TEMPLATE_ T15 = NoneT, GTEST_TEMPLATE_ T16 = NoneT,
-    GTEST_TEMPLATE_ T17 = NoneT, GTEST_TEMPLATE_ T18 = NoneT,
-    GTEST_TEMPLATE_ T19 = NoneT, GTEST_TEMPLATE_ T20 = NoneT,
-    GTEST_TEMPLATE_ T21 = NoneT, GTEST_TEMPLATE_ T22 = NoneT,
-    GTEST_TEMPLATE_ T23 = NoneT, GTEST_TEMPLATE_ T24 = NoneT,
-    GTEST_TEMPLATE_ T25 = NoneT, GTEST_TEMPLATE_ T26 = NoneT,
-    GTEST_TEMPLATE_ T27 = NoneT, GTEST_TEMPLATE_ T28 = NoneT,
-    GTEST_TEMPLATE_ T29 = NoneT, GTEST_TEMPLATE_ T30 = NoneT,
-    GTEST_TEMPLATE_ T31 = NoneT, GTEST_TEMPLATE_ T32 = NoneT,
-    GTEST_TEMPLATE_ T33 = NoneT, GTEST_TEMPLATE_ T34 = NoneT,
-    GTEST_TEMPLATE_ T35 = NoneT, GTEST_TEMPLATE_ T36 = NoneT,
-    GTEST_TEMPLATE_ T37 = NoneT, GTEST_TEMPLATE_ T38 = NoneT,
-    GTEST_TEMPLATE_ T39 = NoneT, GTEST_TEMPLATE_ T40 = NoneT,
-    GTEST_TEMPLATE_ T41 = NoneT, GTEST_TEMPLATE_ T42 = NoneT,
-    GTEST_TEMPLATE_ T43 = NoneT, GTEST_TEMPLATE_ T44 = NoneT,
-    GTEST_TEMPLATE_ T45 = NoneT, GTEST_TEMPLATE_ T46 = NoneT,
-    GTEST_TEMPLATE_ T47 = NoneT, GTEST_TEMPLATE_ T48 = NoneT,
-    GTEST_TEMPLATE_ T49 = NoneT, GTEST_TEMPLATE_ T50 = NoneT>
-struct Templates {
-  typedef Templates50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
-      T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
-};
-
-template <>
-struct Templates<NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT> {
-  typedef Templates0 type;
-};
-template <GTEST_TEMPLATE_ T1>
-struct Templates<T1, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT> {
-  typedef Templates1<T1> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
-struct Templates<T1, T2, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT> {
-  typedef Templates2<T1, T2> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
-struct Templates<T1, T2, T3, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates3<T1, T2, T3> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4>
-struct Templates<T1, T2, T3, T4, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates4<T1, T2, T3, T4> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
-struct Templates<T1, T2, T3, T4, T5, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates5<T1, T2, T3, T4, T5> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
-struct Templates<T1, T2, T3, T4, T5, T6, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates6<T1, T2, T3, T4, T5, T6> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates7<T1, T2, T3, T4, T5, T6, T7> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates8<T1, T2, T3, T4, T5, T6, T7, T8> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT> {
-  typedef Templates22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT> {
-  typedef Templates23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT> {
-  typedef Templates24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT> {
-  typedef Templates25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT> {
-  typedef Templates26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT> {
-  typedef Templates27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT> {
-  typedef Templates28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT> {
-  typedef Templates29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28, T29> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-    T30, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28, T29, T30> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-    T30, T31, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28, T29, T30, T31> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-    T30, T31, T32, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28, T29, T30, T31, T32> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-    T30, T31, T32, T33, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28, T29, T30, T31, T32, T33> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-    T30, T31, T32, T33, T34, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28, T29, T30, T31, T32, T33, T34> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-    T30, T31, T32, T33, T34, T35, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28, T29, T30, T31, T32, T33, T34, T35> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-    T30, T31, T32, T33, T34, T35, T36, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-    T30, T31, T32, T33, T34, T35, T36, T37, NoneT, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-    T30, T31, T32, T33, T34, T35, T36, T37, T38, NoneT, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
-    GTEST_TEMPLATE_ T40>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, NoneT, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
-    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, NoneT, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
-      T41> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
-    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, NoneT,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
-      T42> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
-    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
-    GTEST_TEMPLATE_ T43>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
-      T42, T43> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
-    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
-    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
-    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
-      T42, T43, T44> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
-    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
-    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
-    T45, NoneT, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
-      T42, T43, T44, T45> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
-    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
-    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
-    GTEST_TEMPLATE_ T46>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
-    T45, T46, NoneT, NoneT, NoneT, NoneT> {
-  typedef Templates46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
-      T42, T43, T44, T45, T46> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
-    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
-    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
-    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
-    T45, T46, T47, NoneT, NoneT, NoneT> {
-  typedef Templates47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
-      T42, T43, T44, T45, T46, T47> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
-    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
-    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
-    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
-    T45, T46, T47, T48, NoneT, NoneT> {
-  typedef Templates48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
-      T42, T43, T44, T45, T46, T47, T48> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
-    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
-    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
-    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
-    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
-    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
-    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
-    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
-    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
-    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
-    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
-    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
-    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
-    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
-    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
-    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
-    GTEST_TEMPLATE_ T49>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
-    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
-    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
-    T45, T46, T47, T48, T49, NoneT> {
-  typedef Templates49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
-      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
-      T42, T43, T44, T45, T46, T47, T48, T49> type;
-};
-
-// The TypeList template makes it possible to use either a single type
-// or a Types<...> list in TYPED_TEST_CASE() and
-// INSTANTIATE_TYPED_TEST_CASE_P().
-
-template <typename T>
-struct TypeList { typedef Types1<T> type; };
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
-    typename T6, typename T7, typename T8, typename T9, typename T10,
-    typename T11, typename T12, typename T13, typename T14, typename T15,
-    typename T16, typename T17, typename T18, typename T19, typename T20,
-    typename T21, typename T22, typename T23, typename T24, typename T25,
-    typename T26, typename T27, typename T28, typename T29, typename T30,
-    typename T31, typename T32, typename T33, typename T34, typename T35,
-    typename T36, typename T37, typename T38, typename T39, typename T40,
-    typename T41, typename T42, typename T43, typename T44, typename T45,
-    typename T46, typename T47, typename T48, typename T49, typename T50>
-struct TypeList<Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
-    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
-    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
-    T44, T45, T46, T47, T48, T49, T50> > {
-  typedef typename Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
-      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
-      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
-      T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>::type type;
-};
-
-}  // namespace internal
-}  // namespace testing
-
-#endif  // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
diff --git a/third_party/gtest/src/gtest-all.cc b/third_party/gtest/src/gtest-all.cc
deleted file mode 100644
index fe34765..0000000
--- a/third_party/gtest/src/gtest-all.cc
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: mheule@google.com (Markus Heule)
-//
-// Google C++ Testing Framework (Google Test)
-//
-// Sometimes it's desirable to build Google Test by compiling a single file.
-// This file serves this purpose.
-
-// This line ensures that gtest.h can be compiled on its own, even
-// when it's fused.
-#include <gtest/gtest.h>
-
-// The following lines pull in the real gtest *.cc files.
-#include "src/gtest.cc"
-#include "src/gtest-death-test.cc"
-#include "src/gtest-filepath.cc"
-#include "src/gtest-port.cc"
-#include "src/gtest-test-part.cc"
-#include "src/gtest-typed-test.cc"
diff --git a/third_party/gtest/src/gtest-death-test.cc b/third_party/gtest/src/gtest-death-test.cc
deleted file mode 100644
index 106b01c..0000000
--- a/third_party/gtest/src/gtest-death-test.cc
+++ /dev/null
@@ -1,1174 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan), vladl@google.com (Vlad Losev)
-//
-// This file implements death tests.
-
-#include <gtest/gtest-death-test.h>
-#include <gtest/internal/gtest-port.h>
-
-#if GTEST_HAS_DEATH_TEST
-
-#if GTEST_OS_MAC
-#include <crt_externs.h>
-#endif  // GTEST_OS_MAC
-
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <stdarg.h>
-
-#if GTEST_OS_WINDOWS
-#include <windows.h>
-#else
-#include <sys/mman.h>
-#include <sys/wait.h>
-#endif  // GTEST_OS_WINDOWS
-
-#endif  // GTEST_HAS_DEATH_TEST
-
-#include <gtest/gtest-message.h>
-#include <gtest/internal/gtest-string.h>
-
-// Indicates that this translation unit is part of Google Test's
-// implementation.  It must come before gtest-internal-inl.h is
-// included, or there will be a compiler error.  This trick is to
-// prevent a user from accidentally including gtest-internal-inl.h in
-// his code.
-#define GTEST_IMPLEMENTATION_ 1
-#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION_
-
-namespace testing {
-
-// Constants.
-
-// The default death test style.
-static const char kDefaultDeathTestStyle[] = "fast";
-
-GTEST_DEFINE_string_(
-    death_test_style,
-    internal::StringFromGTestEnv("death_test_style", kDefaultDeathTestStyle),
-    "Indicates how to run a death test in a forked child process: "
-    "\"threadsafe\" (child process re-executes the test binary "
-    "from the beginning, running only the specific death test) or "
-    "\"fast\" (child process runs the death test immediately "
-    "after forking).");
-
-GTEST_DEFINE_bool_(
-    death_test_use_fork,
-    internal::BoolFromGTestEnv("death_test_use_fork", false),
-    "Instructs to use fork()/_exit() instead of clone() in death tests. "
-    "Ignored and always uses fork() on POSIX systems where clone() is not "
-    "implemented. Useful when running under valgrind or similar tools if "
-    "those do not support clone(). Valgrind 3.3.1 will just fail if "
-    "it sees an unsupported combination of clone() flags. "
-    "It is not recommended to use this flag w/o valgrind though it will "
-    "work in 99% of the cases. Once valgrind is fixed, this flag will "
-    "most likely be removed.");
-
-namespace internal {
-GTEST_DEFINE_string_(
-    internal_run_death_test, "",
-    "Indicates the file, line number, temporal index of "
-    "the single death test to run, and a file descriptor to "
-    "which a success code may be sent, all separated by "
-    "colons.  This flag is specified if and only if the current "
-    "process is a sub-process launched for running a thread-safe "
-    "death test.  FOR INTERNAL USE ONLY.");
-}  // namespace internal
-
-#if GTEST_HAS_DEATH_TEST
-
-// ExitedWithCode constructor.
-ExitedWithCode::ExitedWithCode(int exit_code) : exit_code_(exit_code) {
-}
-
-// ExitedWithCode function-call operator.
-bool ExitedWithCode::operator()(int exit_status) const {
-#if GTEST_OS_WINDOWS
-  return exit_status == exit_code_;
-#else
-  return WIFEXITED(exit_status) && WEXITSTATUS(exit_status) == exit_code_;
-#endif  // GTEST_OS_WINDOWS
-}
-
-#if !GTEST_OS_WINDOWS
-// KilledBySignal constructor.
-KilledBySignal::KilledBySignal(int signum) : signum_(signum) {
-}
-
-// KilledBySignal function-call operator.
-bool KilledBySignal::operator()(int exit_status) const {
-  return WIFSIGNALED(exit_status) && WTERMSIG(exit_status) == signum_;
-}
-#endif  // !GTEST_OS_WINDOWS
-
-namespace internal {
-
-// Utilities needed for death tests.
-
-// Generates a textual description of a given exit code, in the format
-// specified by wait(2).
-static String ExitSummary(int exit_code) {
-  Message m;
-#if GTEST_OS_WINDOWS
-  m << "Exited with exit status " << exit_code;
-#else
-  if (WIFEXITED(exit_code)) {
-    m << "Exited with exit status " << WEXITSTATUS(exit_code);
-  } else if (WIFSIGNALED(exit_code)) {
-    m << "Terminated by signal " << WTERMSIG(exit_code);
-  }
-#ifdef WCOREDUMP
-  if (WCOREDUMP(exit_code)) {
-    m << " (core dumped)";
-  }
-#endif
-#endif  // GTEST_OS_WINDOWS
-  return m.GetString();
-}
-
-// Returns true if exit_status describes a process that was terminated
-// by a signal, or exited normally with a nonzero exit code.
-bool ExitedUnsuccessfully(int exit_status) {
-  return !ExitedWithCode(0)(exit_status);
-}
-
-#if !GTEST_OS_WINDOWS
-// Generates a textual failure message when a death test finds more than
-// one thread running, or cannot determine the number of threads, prior
-// to executing the given statement.  It is the responsibility of the
-// caller not to pass a thread_count of 1.
-static String DeathTestThreadWarning(size_t thread_count) {
-  Message msg;
-  msg << "Death tests use fork(), which is unsafe particularly"
-      << " in a threaded context. For this test, " << GTEST_NAME_ << " ";
-  if (thread_count == 0)
-    msg << "couldn't detect the number of threads.";
-  else
-    msg << "detected " << thread_count << " threads.";
-  return msg.GetString();
-}
-#endif  // !GTEST_OS_WINDOWS
-
-// Flag characters for reporting a death test that did not die.
-static const char kDeathTestLived = 'L';
-static const char kDeathTestReturned = 'R';
-static const char kDeathTestInternalError = 'I';
-
-// An enumeration describing all of the possible ways that a death test
-// can conclude.  DIED means that the process died while executing the
-// test code; LIVED means that process lived beyond the end of the test
-// code; and RETURNED means that the test statement attempted a "return,"
-// which is not allowed.  IN_PROGRESS means the test has not yet
-// concluded.
-enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED };
-
-// Routine for aborting the program which is safe to call from an
-// exec-style death test child process, in which case the error
-// message is propagated back to the parent process.  Otherwise, the
-// message is simply printed to stderr.  In either case, the program
-// then exits with status 1.
-void DeathTestAbort(const String& message) {
-  // On a POSIX system, this function may be called from a threadsafe-style
-  // death test child process, which operates on a very small stack.  Use
-  // the heap for any additional non-minuscule memory requirements.
-  const InternalRunDeathTestFlag* const flag =
-      GetUnitTestImpl()->internal_run_death_test_flag();
-  if (flag != NULL) {
-    FILE* parent = posix::FDOpen(flag->write_fd(), "w");
-    fputc(kDeathTestInternalError, parent);
-    fprintf(parent, "%s", message.c_str());
-    fflush(parent);
-    _exit(1);
-  } else {
-    fprintf(stderr, "%s", message.c_str());
-    fflush(stderr);
-    abort();
-  }
-}
-
-// A replacement for CHECK that calls DeathTestAbort if the assertion
-// fails.
-#define GTEST_DEATH_TEST_CHECK_(expression) \
-  do { \
-    if (!::testing::internal::IsTrue(expression)) { \
-      DeathTestAbort(::testing::internal::String::Format( \
-          "CHECK failed: File %s, line %d: %s", \
-          __FILE__, __LINE__, #expression)); \
-    } \
-  } while (::testing::internal::AlwaysFalse())
-
-// This macro is similar to GTEST_DEATH_TEST_CHECK_, but it is meant for
-// evaluating any system call that fulfills two conditions: it must return
-// -1 on failure, and set errno to EINTR when it is interrupted and
-// should be tried again.  The macro expands to a loop that repeatedly
-// evaluates the expression as long as it evaluates to -1 and sets
-// errno to EINTR.  If the expression evaluates to -1 but errno is
-// something other than EINTR, DeathTestAbort is called.
-#define GTEST_DEATH_TEST_CHECK_SYSCALL_(expression) \
-  do { \
-    int gtest_retval; \
-    do { \
-      gtest_retval = (expression); \
-    } while (gtest_retval == -1 && errno == EINTR); \
-    if (gtest_retval == -1) { \
-      DeathTestAbort(::testing::internal::String::Format( \
-          "CHECK failed: File %s, line %d: %s != -1", \
-          __FILE__, __LINE__, #expression)); \
-    } \
-  } while (::testing::internal::AlwaysFalse())
-
-// Returns the message describing the last system error in errno.
-String GetLastErrnoDescription() {
-    return String(errno == 0 ? "" : posix::StrError(errno));
-}
-
-// This is called from a death test parent process to read a failure
-// message from the death test child process and log it with the FATAL
-// severity. On Windows, the message is read from a pipe handle. On other
-// platforms, it is read from a file descriptor.
-static void FailFromInternalError(int fd) {
-  Message error;
-  char buffer[256];
-  int num_read;
-
-  do {
-    while ((num_read = posix::Read(fd, buffer, 255)) > 0) {
-      buffer[num_read] = '\0';
-      error << buffer;
-    }
-  } while (num_read == -1 && errno == EINTR);
-
-  if (num_read == 0) {
-    GTEST_LOG_(FATAL) << error.GetString();
-  } else {
-    const int last_error = errno;
-    GTEST_LOG_(FATAL) << "Error while reading death test internal: "
-                      << GetLastErrnoDescription() << " [" << last_error << "]";
-  }
-}
-
-// Death test constructor.  Increments the running death test count
-// for the current test.
-DeathTest::DeathTest() {
-  TestInfo* const info = GetUnitTestImpl()->current_test_info();
-  if (info == NULL) {
-    DeathTestAbort("Cannot run a death test outside of a TEST or "
-                   "TEST_F construct");
-  }
-}
-
-// Creates and returns a death test by dispatching to the current
-// death test factory.
-bool DeathTest::Create(const char* statement, const RE* regex,
-                       const char* file, int line, DeathTest** test) {
-  return GetUnitTestImpl()->death_test_factory()->Create(
-      statement, regex, file, line, test);
-}
-
-const char* DeathTest::LastMessage() {
-  return last_death_test_message_.c_str();
-}
-
-void DeathTest::set_last_death_test_message(const String& message) {
-  last_death_test_message_ = message;
-}
-
-String DeathTest::last_death_test_message_;
-
-// Provides cross platform implementation for some death functionality.
-class DeathTestImpl : public DeathTest {
- protected:
-  DeathTestImpl(const char* statement, const RE* regex)
-      : statement_(statement),
-        regex_(regex),
-        spawned_(false),
-        status_(-1),
-        outcome_(IN_PROGRESS),
-        read_fd_(-1),
-        write_fd_(-1) {}
-
-  // read_fd_ is expected to be closed and cleared by a derived class.
-  ~DeathTestImpl() { GTEST_DEATH_TEST_CHECK_(read_fd_ == -1); }
-
-  void Abort(AbortReason reason);
-  virtual bool Passed(bool status_ok);
-
-  const char* statement() const { return statement_; }
-  const RE* regex() const { return regex_; }
-  bool spawned() const { return spawned_; }
-  void set_spawned(bool spawned) { spawned_ = spawned; }
-  int status() const { return status_; }
-  void set_status(int status) { status_ = status; }
-  DeathTestOutcome outcome() const { return outcome_; }
-  void set_outcome(DeathTestOutcome outcome) { outcome_ = outcome; }
-  int read_fd() const { return read_fd_; }
-  void set_read_fd(int fd) { read_fd_ = fd; }
-  int write_fd() const { return write_fd_; }
-  void set_write_fd(int fd) { write_fd_ = fd; }
-
-  // Called in the parent process only. Reads the result code of the death
-  // test child process via a pipe, interprets it to set the outcome_
-  // member, and closes read_fd_.  Outputs diagnostics and terminates in
-  // case of unexpected codes.
-  void ReadAndInterpretStatusByte();
-
- private:
-  // The textual content of the code this object is testing.  This class
-  // doesn't own this string and should not attempt to delete it.
-  const char* const statement_;
-  // The regular expression which test output must match.  DeathTestImpl
-  // doesn't own this object and should not attempt to delete it.
-  const RE* const regex_;
-  // True if the death test child process has been successfully spawned.
-  bool spawned_;
-  // The exit status of the child process.
-  int status_;
-  // How the death test concluded.
-  DeathTestOutcome outcome_;
-  // Descriptor to the read end of the pipe to the child process.  It is
-  // always -1 in the child process.  The child keeps its write end of the
-  // pipe in write_fd_.
-  int read_fd_;
-  // Descriptor to the child's write end of the pipe to the parent process.
-  // It is always -1 in the parent process.  The parent keeps its end of the
-  // pipe in read_fd_.
-  int write_fd_;
-};
-
-// Called in the parent process only. Reads the result code of the death
-// test child process via a pipe, interprets it to set the outcome_
-// member, and closes read_fd_.  Outputs diagnostics and terminates in
-// case of unexpected codes.
-void DeathTestImpl::ReadAndInterpretStatusByte() {
-  char flag;
-  int bytes_read;
-
-  // The read() here blocks until data is available (signifying the
-  // failure of the death test) or until the pipe is closed (signifying
-  // its success), so it's okay to call this in the parent before
-  // the child process has exited.
-  do {
-    bytes_read = posix::Read(read_fd(), &flag, 1);
-  } while (bytes_read == -1 && errno == EINTR);
-
-  if (bytes_read == 0) {
-    set_outcome(DIED);
-  } else if (bytes_read == 1) {
-    switch (flag) {
-      case kDeathTestReturned:
-        set_outcome(RETURNED);
-        break;
-      case kDeathTestLived:
-        set_outcome(LIVED);
-        break;
-      case kDeathTestInternalError:
-        FailFromInternalError(read_fd());  // Does not return.
-        break;
-      default:
-        GTEST_LOG_(FATAL) << "Death test child process reported "
-                          << "unexpected status byte ("
-                          << static_cast<unsigned int>(flag) << ")";
-    }
-  } else {
-    GTEST_LOG_(FATAL) << "Read from death test child process failed: "
-                      << GetLastErrnoDescription();
-  }
-  GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Close(read_fd()));
-  set_read_fd(-1);
-}
-
-// Signals that the death test code which should have exited, didn't.
-// Should be called only in a death test child process.
-// Writes a status byte to the child's status file descriptor, then
-// calls _exit(1).
-void DeathTestImpl::Abort(AbortReason reason) {
-  // The parent process considers the death test to be a failure if
-  // it finds any data in our pipe.  So, here we write a single flag byte
-  // to the pipe, then exit.
-  const char status_ch =
-      reason == TEST_DID_NOT_DIE ? kDeathTestLived : kDeathTestReturned;
-  GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Write(write_fd(), &status_ch, 1));
-  GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Close(write_fd()));
-  _exit(1);  // Exits w/o any normal exit hooks (we were supposed to crash)
-}
-
-// Assesses the success or failure of a death test, using both private
-// members which have previously been set, and one argument:
-//
-// Private data members:
-//   outcome:  An enumeration describing how the death test
-//             concluded: DIED, LIVED, or RETURNED.  The death test fails
-//             in the latter two cases.
-//   status:   The exit status of the child process. On *nix, it is in the
-//             in the format specified by wait(2). On Windows, this is the
-//             value supplied to the ExitProcess() API or a numeric code
-//             of the exception that terminated the program.
-//   regex:    A regular expression object to be applied to
-//             the test's captured standard error output; the death test
-//             fails if it does not match.
-//
-// Argument:
-//   status_ok: true if exit_status is acceptable in the context of
-//              this particular death test, which fails if it is false
-//
-// Returns true iff all of the above conditions are met.  Otherwise, the
-// first failing condition, in the order given above, is the one that is
-// reported. Also sets the last death test message string.
-bool DeathTestImpl::Passed(bool status_ok) {
-  if (!spawned())
-    return false;
-
-  const String error_message = GetCapturedStderr();
-
-  bool success = false;
-  Message buffer;
-
-  buffer << "Death test: " << statement() << "\n";
-  switch (outcome()) {
-    case LIVED:
-      buffer << "    Result: failed to die.\n"
-             << " Error msg: " << error_message;
-      break;
-    case RETURNED:
-      buffer << "    Result: illegal return in test statement.\n"
-             << " Error msg: " << error_message;
-      break;
-    case DIED:
-      if (status_ok) {
-        const bool matched = RE::PartialMatch(error_message.c_str(), *regex());
-        if (matched) {
-          success = true;
-        } else {
-          buffer << "    Result: died but not with expected error.\n"
-                 << "  Expected: " << regex()->pattern() << "\n"
-                 << "Actual msg: " << error_message;
-        }
-      } else {
-        buffer << "    Result: died but not with expected exit code:\n"
-               << "            " << ExitSummary(status()) << "\n";
-      }
-      break;
-    case IN_PROGRESS:
-    default:
-      GTEST_LOG_(FATAL)
-          << "DeathTest::Passed somehow called before conclusion of test";
-  }
-
-  DeathTest::set_last_death_test_message(buffer.GetString());
-  return success;
-}
-
-#if GTEST_OS_WINDOWS
-// WindowsDeathTest implements death tests on Windows. Due to the
-// specifics of starting new processes on Windows, death tests there are
-// always threadsafe, and Google Test considers the
-// --gtest_death_test_style=fast setting to be equivalent to
-// --gtest_death_test_style=threadsafe there.
-//
-// A few implementation notes:  Like the Linux version, the Windows
-// implementation uses pipes for child-to-parent communication. But due to
-// the specifics of pipes on Windows, some extra steps are required:
-//
-// 1. The parent creates a communication pipe and stores handles to both
-//    ends of it.
-// 2. The parent starts the child and provides it with the information
-//    necessary to acquire the handle to the write end of the pipe.
-// 3. The child acquires the write end of the pipe and signals the parent
-//    using a Windows event.
-// 4. Now the parent can release the write end of the pipe on its side. If
-//    this is done before step 3, the object's reference count goes down to
-//    0 and it is destroyed, preventing the child from acquiring it. The
-//    parent now has to release it, or read operations on the read end of
-//    the pipe will not return when the child terminates.
-// 5. The parent reads child's output through the pipe (outcome code and
-//    any possible error messages) from the pipe, and its stderr and then
-//    determines whether to fail the test.
-//
-// Note: to distinguish Win32 API calls from the local method and function
-// calls, the former are explicitly resolved in the global namespace.
-//
-class WindowsDeathTest : public DeathTestImpl {
- public:
-  WindowsDeathTest(const char* statement,
-                   const RE* regex,
-                   const char* file,
-                   int line)
-      : DeathTestImpl(statement, regex), file_(file), line_(line) {}
-
-  // All of these virtual functions are inherited from DeathTest.
-  virtual int Wait();
-  virtual TestRole AssumeRole();
-
- private:
-  // The name of the file in which the death test is located.
-  const char* const file_;
-  // The line number on which the death test is located.
-  const int line_;
-  // Handle to the write end of the pipe to the child process.
-  AutoHandle write_handle_;
-  // Child process handle.
-  AutoHandle child_handle_;
-  // Event the child process uses to signal the parent that it has
-  // acquired the handle to the write end of the pipe. After seeing this
-  // event the parent can release its own handles to make sure its
-  // ReadFile() calls return when the child terminates.
-  AutoHandle event_handle_;
-};
-
-// Waits for the child in a death test to exit, returning its exit
-// status, or 0 if no child process exists.  As a side effect, sets the
-// outcome data member.
-int WindowsDeathTest::Wait() {
-  if (!spawned())
-    return 0;
-
-  // Wait until the child either signals that it has acquired the write end
-  // of the pipe or it dies.
-  const HANDLE wait_handles[2] = { child_handle_.Get(), event_handle_.Get() };
-  switch (::WaitForMultipleObjects(2,
-                                   wait_handles,
-                                   FALSE,  // Waits for any of the handles.
-                                   INFINITE)) {
-    case WAIT_OBJECT_0:
-    case WAIT_OBJECT_0 + 1:
-      break;
-    default:
-      GTEST_DEATH_TEST_CHECK_(false);  // Should not get here.
-  }
-
-  // The child has acquired the write end of the pipe or exited.
-  // We release the handle on our side and continue.
-  write_handle_.Reset();
-  event_handle_.Reset();
-
-  ReadAndInterpretStatusByte();
-
-  // Waits for the child process to exit if it haven't already. This
-  // returns immediately if the child has already exited, regardless of
-  // whether previous calls to WaitForMultipleObjects synchronized on this
-  // handle or not.
-  GTEST_DEATH_TEST_CHECK_(
-      WAIT_OBJECT_0 == ::WaitForSingleObject(child_handle_.Get(),
-                                             INFINITE));
-  DWORD status;
-  GTEST_DEATH_TEST_CHECK_(::GetExitCodeProcess(child_handle_.Get(), &status)
-                          != FALSE);
-  child_handle_.Reset();
-  set_status(static_cast<int>(status));
-  return this->status();
-}
-
-// The AssumeRole process for a Windows death test.  It creates a child
-// process with the same executable as the current process to run the
-// death test.  The child process is given the --gtest_filter and
-// --gtest_internal_run_death_test flags such that it knows to run the
-// current death test only.
-DeathTest::TestRole WindowsDeathTest::AssumeRole() {
-  const UnitTestImpl* const impl = GetUnitTestImpl();
-  const InternalRunDeathTestFlag* const flag =
-      impl->internal_run_death_test_flag();
-  const TestInfo* const info = impl->current_test_info();
-  const int death_test_index = info->result()->death_test_count();
-
-  if (flag != NULL) {
-    // ParseInternalRunDeathTestFlag() has performed all the necessary
-    // processing.
-    set_write_fd(flag->write_fd());
-    return EXECUTE_TEST;
-  }
-
-  // WindowsDeathTest uses an anonymous pipe to communicate results of
-  // a death test.
-  SECURITY_ATTRIBUTES handles_are_inheritable = {
-    sizeof(SECURITY_ATTRIBUTES), NULL, TRUE };
-  HANDLE read_handle, write_handle;
-  GTEST_DEATH_TEST_CHECK_(
-      ::CreatePipe(&read_handle, &write_handle, &handles_are_inheritable,
-                   0)  // Default buffer size.
-      != FALSE);
-  set_read_fd(::_open_osfhandle(reinterpret_cast<intptr_t>(read_handle),
-                                O_RDONLY));
-  write_handle_.Reset(write_handle);
-  event_handle_.Reset(::CreateEvent(
-      &handles_are_inheritable,
-      TRUE,    // The event will automatically reset to non-signaled state.
-      FALSE,   // The initial state is non-signalled.
-      NULL));  // The even is unnamed.
-  GTEST_DEATH_TEST_CHECK_(event_handle_.Get() != NULL);
-  const String filter_flag = String::Format("--%s%s=%s.%s",
-                                            GTEST_FLAG_PREFIX_, kFilterFlag,
-                                            info->test_case_name(),
-                                            info->name());
-  const String internal_flag = String::Format(
-    "--%s%s=%s|%d|%d|%u|%Iu|%Iu",
-      GTEST_FLAG_PREFIX_,
-      kInternalRunDeathTestFlag,
-      file_, line_,
-      death_test_index,
-      static_cast<unsigned int>(::GetCurrentProcessId()),
-      // size_t has the same with as pointers on both 32-bit and 64-bit
-      // Windows platforms.
-      // See http://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx.
-      reinterpret_cast<size_t>(write_handle),
-      reinterpret_cast<size_t>(event_handle_.Get()));
-
-  char executable_path[_MAX_PATH + 1];  // NOLINT
-  GTEST_DEATH_TEST_CHECK_(
-      _MAX_PATH + 1 != ::GetModuleFileNameA(NULL,
-                                            executable_path,
-                                            _MAX_PATH));
-
-  String command_line = String::Format("%s %s \"%s\"",
-                                       ::GetCommandLineA(),
-                                       filter_flag.c_str(),
-                                       internal_flag.c_str());
-
-  DeathTest::set_last_death_test_message("");
-
-  CaptureStderr();
-  // Flush the log buffers since the log streams are shared with the child.
-  FlushInfoLog();
-
-  // The child process will share the standard handles with the parent.
-  STARTUPINFOA startup_info;
-  memset(&startup_info, 0, sizeof(STARTUPINFO));
-  startup_info.dwFlags = STARTF_USESTDHANDLES;
-  startup_info.hStdInput = ::GetStdHandle(STD_INPUT_HANDLE);
-  startup_info.hStdOutput = ::GetStdHandle(STD_OUTPUT_HANDLE);
-  startup_info.hStdError = ::GetStdHandle(STD_ERROR_HANDLE);
-
-  PROCESS_INFORMATION process_info;
-  GTEST_DEATH_TEST_CHECK_(::CreateProcessA(
-      executable_path,
-      const_cast<char*>(command_line.c_str()),
-      NULL,   // Retuned process handle is not inheritable.
-      NULL,   // Retuned thread handle is not inheritable.
-      TRUE,   // Child inherits all inheritable handles (for write_handle_).
-      0x0,    // Default creation flags.
-      NULL,   // Inherit the parent's environment.
-      UnitTest::GetInstance()->original_working_dir(),
-      &startup_info,
-      &process_info) != FALSE);
-  child_handle_.Reset(process_info.hProcess);
-  ::CloseHandle(process_info.hThread);
-  set_spawned(true);
-  return OVERSEE_TEST;
-}
-#else  // We are not on Windows.
-
-// ForkingDeathTest provides implementations for most of the abstract
-// methods of the DeathTest interface.  Only the AssumeRole method is
-// left undefined.
-class ForkingDeathTest : public DeathTestImpl {
- public:
-  ForkingDeathTest(const char* statement, const RE* regex);
-
-  // All of these virtual functions are inherited from DeathTest.
-  virtual int Wait();
-
- protected:
-  void set_child_pid(pid_t child_pid) { child_pid_ = child_pid; }
-
- private:
-  // PID of child process during death test; 0 in the child process itself.
-  pid_t child_pid_;
-};
-
-// Constructs a ForkingDeathTest.
-ForkingDeathTest::ForkingDeathTest(const char* statement, const RE* regex)
-    : DeathTestImpl(statement, regex),
-      child_pid_(-1) {}
-
-// Waits for the child in a death test to exit, returning its exit
-// status, or 0 if no child process exists.  As a side effect, sets the
-// outcome data member.
-int ForkingDeathTest::Wait() {
-  if (!spawned())
-    return 0;
-
-  ReadAndInterpretStatusByte();
-
-  int status;
-  GTEST_DEATH_TEST_CHECK_SYSCALL_(waitpid(child_pid_, &status, 0));
-  set_status(status);
-  return status;
-}
-
-// A concrete death test class that forks, then immediately runs the test
-// in the child process.
-class NoExecDeathTest : public ForkingDeathTest {
- public:
-  NoExecDeathTest(const char* statement, const RE* regex) :
-      ForkingDeathTest(statement, regex) { }
-  virtual TestRole AssumeRole();
-};
-
-// The AssumeRole process for a fork-and-run death test.  It implements a
-// straightforward fork, with a simple pipe to transmit the status byte.
-DeathTest::TestRole NoExecDeathTest::AssumeRole() {
-  const size_t thread_count = GetThreadCount();
-  if (thread_count != 1) {
-    GTEST_LOG_(WARNING) << DeathTestThreadWarning(thread_count);
-  }
-
-  int pipe_fd[2];
-  GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1);
-
-  DeathTest::set_last_death_test_message("");
-  CaptureStderr();
-  // When we fork the process below, the log file buffers are copied, but the
-  // file descriptors are shared.  We flush all log files here so that closing
-  // the file descriptors in the child process doesn't throw off the
-  // synchronization between descriptors and buffers in the parent process.
-  // This is as close to the fork as possible to avoid a race condition in case
-  // there are multiple threads running before the death test, and another
-  // thread writes to the log file.
-  FlushInfoLog();
-
-  const pid_t child_pid = fork();
-  GTEST_DEATH_TEST_CHECK_(child_pid != -1);
-  set_child_pid(child_pid);
-  if (child_pid == 0) {
-    GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[0]));
-    set_write_fd(pipe_fd[1]);
-    // Redirects all logging to stderr in the child process to prevent
-    // concurrent writes to the log files.  We capture stderr in the parent
-    // process and append the child process' output to a log.
-    LogToStderr();
-    // Event forwarding to the listeners of event listener API mush be shut
-    // down in death test subprocesses.
-    GetUnitTestImpl()->listeners()->SuppressEventForwarding();
-    return EXECUTE_TEST;
-  } else {
-    GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
-    set_read_fd(pipe_fd[0]);
-    set_spawned(true);
-    return OVERSEE_TEST;
-  }
-}
-
-// A concrete death test class that forks and re-executes the main
-// program from the beginning, with command-line flags set that cause
-// only this specific death test to be run.
-class ExecDeathTest : public ForkingDeathTest {
- public:
-  ExecDeathTest(const char* statement, const RE* regex,
-                const char* file, int line) :
-      ForkingDeathTest(statement, regex), file_(file), line_(line) { }
-  virtual TestRole AssumeRole();
- private:
-  // The name of the file in which the death test is located.
-  const char* const file_;
-  // The line number on which the death test is located.
-  const int line_;
-};
-
-// Utility class for accumulating command-line arguments.
-class Arguments {
- public:
-  Arguments() {
-    args_.push_back(NULL);
-  }
-
-  ~Arguments() {
-    for (std::vector<char*>::iterator i = args_.begin(); i != args_.end();
-         ++i) {
-      free(*i);
-    }
-  }
-  void AddArgument(const char* argument) {
-    args_.insert(args_.end() - 1, posix::StrDup(argument));
-  }
-
-  template <typename Str>
-  void AddArguments(const ::std::vector<Str>& arguments) {
-    for (typename ::std::vector<Str>::const_iterator i = arguments.begin();
-         i != arguments.end();
-         ++i) {
-      args_.insert(args_.end() - 1, posix::StrDup(i->c_str()));
-    }
-  }
-  char* const* Argv() {
-    return &args_[0];
-  }
- private:
-  std::vector<char*> args_;
-};
-
-// A struct that encompasses the arguments to the child process of a
-// threadsafe-style death test process.
-struct ExecDeathTestArgs {
-  char* const* argv;  // Command-line arguments for the child's call to exec
-  int close_fd;       // File descriptor to close; the read end of a pipe
-};
-
-#if GTEST_OS_MAC
-inline char** GetEnviron() {
-  // When Google Test is built as a framework on MacOS X, the environ variable
-  // is unavailable. Apple's documentation (man environ) recommends using
-  // _NSGetEnviron() instead.
-  return *_NSGetEnviron();
-}
-#else
-// Some POSIX platforms expect you to declare environ. extern "C" makes
-// it reside in the global namespace.
-extern "C" char** environ;
-inline char** GetEnviron() { return environ; }
-#endif  // GTEST_OS_MAC
-
-// The main function for a threadsafe-style death test child process.
-// This function is called in a clone()-ed process and thus must avoid
-// any potentially unsafe operations like malloc or libc functions.
-static int ExecDeathTestChildMain(void* child_arg) {
-  ExecDeathTestArgs* const args = static_cast<ExecDeathTestArgs*>(child_arg);
-  GTEST_DEATH_TEST_CHECK_SYSCALL_(close(args->close_fd));
-
-  // We need to execute the test program in the same environment where
-  // it was originally invoked.  Therefore we change to the original
-  // working directory first.
-  const char* const original_dir =
-      UnitTest::GetInstance()->original_working_dir();
-  // We can safely call chdir() as it's a direct system call.
-  if (chdir(original_dir) != 0) {
-    DeathTestAbort(String::Format("chdir(\"%s\") failed: %s",
-                                  original_dir,
-                                  GetLastErrnoDescription().c_str()));
-    return EXIT_FAILURE;
-  }
-
-  // We can safely call execve() as it's a direct system call.  We
-  // cannot use execvp() as it's a libc function and thus potentially
-  // unsafe.  Since execve() doesn't search the PATH, the user must
-  // invoke the test program via a valid path that contains at least
-  // one path separator.
-  execve(args->argv[0], args->argv, GetEnviron());
-  DeathTestAbort(String::Format("execve(%s, ...) in %s failed: %s",
-                                args->argv[0],
-                                original_dir,
-                                GetLastErrnoDescription().c_str()));
-  return EXIT_FAILURE;
-}
-
-// Two utility routines that together determine the direction the stack
-// grows.
-// This could be accomplished more elegantly by a single recursive
-// function, but we want to guard against the unlikely possibility of
-// a smart compiler optimizing the recursion away.
-bool StackLowerThanAddress(const void* ptr) {
-  int dummy;
-  return &dummy < ptr;
-}
-
-bool StackGrowsDown() {
-  int dummy;
-  return StackLowerThanAddress(&dummy);
-}
-
-// A threadsafe implementation of fork(2) for threadsafe-style death tests
-// that uses clone(2).  It dies with an error message if anything goes
-// wrong.
-static pid_t ExecDeathTestFork(char* const* argv, int close_fd) {
-  ExecDeathTestArgs args = { argv, close_fd };
-  pid_t child_pid = -1;
-
-#if GTEST_HAS_CLONE
-  const bool use_fork = GTEST_FLAG(death_test_use_fork);
-
-  if (!use_fork) {
-    static const bool stack_grows_down = StackGrowsDown();
-    const size_t stack_size = getpagesize();
-    // MMAP_ANONYMOUS is not defined on Mac, so we use MAP_ANON instead.
-    void* const stack = mmap(NULL, stack_size, PROT_READ | PROT_WRITE,
-                             MAP_ANON | MAP_PRIVATE, -1, 0);
-    GTEST_DEATH_TEST_CHECK_(stack != MAP_FAILED);
-    void* const stack_top =
-        static_cast<char*>(stack) + (stack_grows_down ? stack_size : 0);
-
-    child_pid = clone(&ExecDeathTestChildMain, stack_top, SIGCHLD, &args);
-
-    GTEST_DEATH_TEST_CHECK_(munmap(stack, stack_size) != -1);
-  }
-#else
-  const bool use_fork = true;
-#endif  // GTEST_HAS_CLONE
-
-  if (use_fork && (child_pid = fork()) == 0) {
-      ExecDeathTestChildMain(&args);
-      _exit(0);
-  }
-
-  GTEST_DEATH_TEST_CHECK_(child_pid != -1);
-  return child_pid;
-}
-
-// The AssumeRole process for a fork-and-exec death test.  It re-executes the
-// main program from the beginning, setting the --gtest_filter
-// and --gtest_internal_run_death_test flags to cause only the current
-// death test to be re-run.
-DeathTest::TestRole ExecDeathTest::AssumeRole() {
-  const UnitTestImpl* const impl = GetUnitTestImpl();
-  const InternalRunDeathTestFlag* const flag =
-      impl->internal_run_death_test_flag();
-  const TestInfo* const info = impl->current_test_info();
-  const int death_test_index = info->result()->death_test_count();
-
-  if (flag != NULL) {
-    set_write_fd(flag->write_fd());
-    return EXECUTE_TEST;
-  }
-
-  int pipe_fd[2];
-  GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1);
-  // Clear the close-on-exec flag on the write end of the pipe, lest
-  // it be closed when the child process does an exec:
-  GTEST_DEATH_TEST_CHECK_(fcntl(pipe_fd[1], F_SETFD, 0) != -1);
-
-  const String filter_flag =
-      String::Format("--%s%s=%s.%s",
-                     GTEST_FLAG_PREFIX_, kFilterFlag,
-                     info->test_case_name(), info->name());
-  const String internal_flag =
-      String::Format("--%s%s=%s|%d|%d|%d",
-                     GTEST_FLAG_PREFIX_, kInternalRunDeathTestFlag,
-                     file_, line_, death_test_index, pipe_fd[1]);
-  Arguments args;
-  args.AddArguments(GetArgvs());
-  args.AddArgument(filter_flag.c_str());
-  args.AddArgument(internal_flag.c_str());
-
-  DeathTest::set_last_death_test_message("");
-
-  CaptureStderr();
-  // See the comment in NoExecDeathTest::AssumeRole for why the next line
-  // is necessary.
-  FlushInfoLog();
-
-  const pid_t child_pid = ExecDeathTestFork(args.Argv(), pipe_fd[0]);
-  GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
-  set_child_pid(child_pid);
-  set_read_fd(pipe_fd[0]);
-  set_spawned(true);
-  return OVERSEE_TEST;
-}
-
-#endif  // !GTEST_OS_WINDOWS
-
-// Creates a concrete DeathTest-derived class that depends on the
-// --gtest_death_test_style flag, and sets the pointer pointed to
-// by the "test" argument to its address.  If the test should be
-// skipped, sets that pointer to NULL.  Returns true, unless the
-// flag is set to an invalid value.
-bool DefaultDeathTestFactory::Create(const char* statement, const RE* regex,
-                                     const char* file, int line,
-                                     DeathTest** test) {
-  UnitTestImpl* const impl = GetUnitTestImpl();
-  const InternalRunDeathTestFlag* const flag =
-      impl->internal_run_death_test_flag();
-  const int death_test_index = impl->current_test_info()
-      ->increment_death_test_count();
-
-  if (flag != NULL) {
-    if (death_test_index > flag->index()) {
-      DeathTest::set_last_death_test_message(String::Format(
-          "Death test count (%d) somehow exceeded expected maximum (%d)",
-          death_test_index, flag->index()));
-      return false;
-    }
-
-    if (!(flag->file() == file && flag->line() == line &&
-          flag->index() == death_test_index)) {
-      *test = NULL;
-      return true;
-    }
-  }
-
-#if GTEST_OS_WINDOWS
-  if (GTEST_FLAG(death_test_style) == "threadsafe" ||
-      GTEST_FLAG(death_test_style) == "fast") {
-    *test = new WindowsDeathTest(statement, regex, file, line);
-  }
-#else
-  if (GTEST_FLAG(death_test_style) == "threadsafe") {
-    *test = new ExecDeathTest(statement, regex, file, line);
-  } else if (GTEST_FLAG(death_test_style) == "fast") {
-    *test = new NoExecDeathTest(statement, regex);
-  }
-#endif  // GTEST_OS_WINDOWS
-  else {  // NOLINT - this is more readable than unbalanced brackets inside #if.
-    DeathTest::set_last_death_test_message(String::Format(
-        "Unknown death test style \"%s\" encountered",
-        GTEST_FLAG(death_test_style).c_str()));
-    return false;
-  }
-
-  return true;
-}
-
-// Splits a given string on a given delimiter, populating a given
-// vector with the fields.  GTEST_HAS_DEATH_TEST implies that we have
-// ::std::string, so we can use it here.
-// TODO(vladl@google.com): Get rid of std::vector to be able to build on
-// Visual C++ 7.1 with exceptions disabled.
-static void SplitString(const ::std::string& str, char delimiter,
-                        ::std::vector< ::std::string>* dest) {
-  ::std::vector< ::std::string> parsed;
-  ::std::string::size_type pos = 0;
-  while (::testing::internal::AlwaysTrue()) {
-    const ::std::string::size_type colon = str.find(delimiter, pos);
-    if (colon == ::std::string::npos) {
-      parsed.push_back(str.substr(pos));
-      break;
-    } else {
-      parsed.push_back(str.substr(pos, colon - pos));
-      pos = colon + 1;
-    }
-  }
-  dest->swap(parsed);
-}
-
-#if GTEST_OS_WINDOWS
-// Recreates the pipe and event handles from the provided parameters,
-// signals the event, and returns a file descriptor wrapped around the pipe
-// handle. This function is called in the child process only.
-int GetStatusFileDescriptor(unsigned int parent_process_id,
-                            size_t write_handle_as_size_t,
-                            size_t event_handle_as_size_t) {
-  AutoHandle parent_process_handle(::OpenProcess(PROCESS_DUP_HANDLE,
-                                                   FALSE,  // Non-inheritable.
-                                                   parent_process_id));
-  if (parent_process_handle.Get() == INVALID_HANDLE_VALUE) {
-    DeathTestAbort(String::Format("Unable to open parent process %u",
-                                  parent_process_id));
-  }
-
-  // TODO(vladl@google.com): Replace the following check with a
-  // compile-time assertion when available.
-  GTEST_CHECK_(sizeof(HANDLE) <= sizeof(size_t));
-
-  const HANDLE write_handle =
-      reinterpret_cast<HANDLE>(write_handle_as_size_t);
-  HANDLE dup_write_handle;
-
-  // The newly initialized handle is accessible only in in the parent
-  // process. To obtain one accessible within the child, we need to use
-  // DuplicateHandle.
-  if (!::DuplicateHandle(parent_process_handle.Get(), write_handle,
-                         ::GetCurrentProcess(), &dup_write_handle,
-                         0x0,    // Requested privileges ignored since
-                                 // DUPLICATE_SAME_ACCESS is used.
-                         FALSE,  // Request non-inheritable handler.
-                         DUPLICATE_SAME_ACCESS)) {
-    DeathTestAbort(String::Format(
-        "Unable to duplicate the pipe handle %Iu from the parent process %u",
-        write_handle_as_size_t, parent_process_id));
-  }
-
-  const HANDLE event_handle = reinterpret_cast<HANDLE>(event_handle_as_size_t);
-  HANDLE dup_event_handle;
-
-  if (!::DuplicateHandle(parent_process_handle.Get(), event_handle,
-                         ::GetCurrentProcess(), &dup_event_handle,
-                         0x0,
-                         FALSE,
-                         DUPLICATE_SAME_ACCESS)) {
-    DeathTestAbort(String::Format(
-        "Unable to duplicate the event handle %Iu from the parent process %u",
-        event_handle_as_size_t, parent_process_id));
-  }
-
-  const int write_fd =
-      ::_open_osfhandle(reinterpret_cast<intptr_t>(dup_write_handle), O_APPEND);
-  if (write_fd == -1) {
-    DeathTestAbort(String::Format(
-        "Unable to convert pipe handle %Iu to a file descriptor",
-        write_handle_as_size_t));
-  }
-
-  // Signals the parent that the write end of the pipe has been acquired
-  // so the parent can release its own write end.
-  ::SetEvent(dup_event_handle);
-
-  return write_fd;
-}
-#endif  // GTEST_OS_WINDOWS
-
-// Returns a newly created InternalRunDeathTestFlag object with fields
-// initialized from the GTEST_FLAG(internal_run_death_test) flag if
-// the flag is specified; otherwise returns NULL.
-InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() {
-  if (GTEST_FLAG(internal_run_death_test) == "") return NULL;
-
-  // GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we
-  // can use it here.
-  int line = -1;
-  int index = -1;
-  ::std::vector< ::std::string> fields;
-  SplitString(GTEST_FLAG(internal_run_death_test).c_str(), '|', &fields);
-  int write_fd = -1;
-
-#if GTEST_OS_WINDOWS
-  unsigned int parent_process_id = 0;
-  size_t write_handle_as_size_t = 0;
-  size_t event_handle_as_size_t = 0;
-
-  if (fields.size() != 6
-      || !ParseNaturalNumber(fields[1], &line)
-      || !ParseNaturalNumber(fields[2], &index)
-      || !ParseNaturalNumber(fields[3], &parent_process_id)
-      || !ParseNaturalNumber(fields[4], &write_handle_as_size_t)
-      || !ParseNaturalNumber(fields[5], &event_handle_as_size_t)) {
-    DeathTestAbort(String::Format(
-        "Bad --gtest_internal_run_death_test flag: %s",
-        GTEST_FLAG(internal_run_death_test).c_str()));
-  }
-  write_fd = GetStatusFileDescriptor(parent_process_id,
-                                     write_handle_as_size_t,
-                                     event_handle_as_size_t);
-#else
-  if (fields.size() != 4
-      || !ParseNaturalNumber(fields[1], &line)
-      || !ParseNaturalNumber(fields[2], &index)
-      || !ParseNaturalNumber(fields[3], &write_fd)) {
-    DeathTestAbort(String::Format(
-        "Bad --gtest_internal_run_death_test flag: %s",
-        GTEST_FLAG(internal_run_death_test).c_str()));
-  }
-#endif  // GTEST_OS_WINDOWS
-  return new InternalRunDeathTestFlag(fields[0], line, index, write_fd);
-}
-
-}  // namespace internal
-
-#endif  // GTEST_HAS_DEATH_TEST
-
-}  // namespace testing
diff --git a/third_party/gtest/src/gtest-filepath.cc b/third_party/gtest/src/gtest-filepath.cc
deleted file mode 100644
index 515d61c..0000000
--- a/third_party/gtest/src/gtest-filepath.cc
+++ /dev/null
@@ -1,340 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: keith.ray@gmail.com (Keith Ray)
-
-#include <gtest/internal/gtest-filepath.h>
-#include <gtest/internal/gtest-port.h>
-
-#include <stdlib.h>
-
-#if GTEST_OS_WINDOWS_MOBILE
-#include <windows.h>
-#elif GTEST_OS_WINDOWS
-#include <direct.h>
-#include <io.h>
-#elif GTEST_OS_SYMBIAN
-// Symbian OpenC has PATH_MAX in sys/syslimits.h
-#include <sys/syslimits.h>
-#else
-#include <limits.h>
-#include <climits>  // Some Linux distributions define PATH_MAX here.
-#endif  // GTEST_OS_WINDOWS_MOBILE
-
-#if GTEST_OS_WINDOWS
-#define GTEST_PATH_MAX_ _MAX_PATH
-#elif defined(PATH_MAX)
-#define GTEST_PATH_MAX_ PATH_MAX
-#elif defined(_XOPEN_PATH_MAX)
-#define GTEST_PATH_MAX_ _XOPEN_PATH_MAX
-#else
-#define GTEST_PATH_MAX_ _POSIX_PATH_MAX
-#endif  // GTEST_OS_WINDOWS
-
-#include <gtest/internal/gtest-string.h>
-
-namespace testing {
-namespace internal {
-
-#if GTEST_OS_WINDOWS
-const char kPathSeparator = '\\';
-const char kPathSeparatorString[] = "\\";
-#if GTEST_OS_WINDOWS_MOBILE
-// Windows CE doesn't have a current directory. You should not use
-// the current directory in tests on Windows CE, but this at least
-// provides a reasonable fallback.
-const char kCurrentDirectoryString[] = "\\";
-// Windows CE doesn't define INVALID_FILE_ATTRIBUTES
-const DWORD kInvalidFileAttributes = 0xffffffff;
-#else
-const char kCurrentDirectoryString[] = ".\\";
-#endif  // GTEST_OS_WINDOWS_MOBILE
-#else
-const char kPathSeparator = '/';
-const char kPathSeparatorString[] = "/";
-const char kCurrentDirectoryString[] = "./";
-#endif  // GTEST_OS_WINDOWS
-
-// Returns the current working directory, or "" if unsuccessful.
-FilePath FilePath::GetCurrentDir() {
-#if GTEST_OS_WINDOWS_MOBILE
-  // Windows CE doesn't have a current directory, so we just return
-  // something reasonable.
-  return FilePath(kCurrentDirectoryString);
-#elif GTEST_OS_WINDOWS
-  char cwd[GTEST_PATH_MAX_ + 1] = { '\0' };
-  return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
-#else
-  char cwd[GTEST_PATH_MAX_ + 1] = { '\0' };
-  return FilePath(getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
-#endif  // GTEST_OS_WINDOWS_MOBILE
-}
-
-// Returns a copy of the FilePath with the case-insensitive extension removed.
-// Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
-// FilePath("dir/file"). If a case-insensitive extension is not
-// found, returns a copy of the original FilePath.
-FilePath FilePath::RemoveExtension(const char* extension) const {
-  String dot_extension(String::Format(".%s", extension));
-  if (pathname_.EndsWithCaseInsensitive(dot_extension.c_str())) {
-    return FilePath(String(pathname_.c_str(), pathname_.length() - 4));
-  }
-  return *this;
-}
-
-// Returns a copy of the FilePath with the directory part removed.
-// Example: FilePath("path/to/file").RemoveDirectoryName() returns
-// FilePath("file"). If there is no directory part ("just_a_file"), it returns
-// the FilePath unmodified. If there is no file part ("just_a_dir/") it
-// returns an empty FilePath ("").
-// On Windows platform, '\' is the path separator, otherwise it is '/'.
-FilePath FilePath::RemoveDirectoryName() const {
-  const char* const last_sep = strrchr(c_str(), kPathSeparator);
-  return last_sep ? FilePath(String(last_sep + 1)) : *this;
-}
-
-// RemoveFileName returns the directory path with the filename removed.
-// Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
-// If the FilePath is "a_file" or "/a_file", RemoveFileName returns
-// FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
-// not have a file, like "just/a/dir/", it returns the FilePath unmodified.
-// On Windows platform, '\' is the path separator, otherwise it is '/'.
-FilePath FilePath::RemoveFileName() const {
-  const char* const last_sep = strrchr(c_str(), kPathSeparator);
-  String dir;
-  if (last_sep) {
-    dir = String(c_str(), last_sep + 1 - c_str());
-  } else {
-    dir = kCurrentDirectoryString;
-  }
-  return FilePath(dir);
-}
-
-// Helper functions for naming files in a directory for xml output.
-
-// Given directory = "dir", base_name = "test", number = 0,
-// extension = "xml", returns "dir/test.xml". If number is greater
-// than zero (e.g., 12), returns "dir/test_12.xml".
-// On Windows platform, uses \ as the separator rather than /.
-FilePath FilePath::MakeFileName(const FilePath& directory,
-                                const FilePath& base_name,
-                                int number,
-                                const char* extension) {
-  String file;
-  if (number == 0) {
-    file = String::Format("%s.%s", base_name.c_str(), extension);
-  } else {
-    file = String::Format("%s_%d.%s", base_name.c_str(), number, extension);
-  }
-  return ConcatPaths(directory, FilePath(file));
-}
-
-// Given directory = "dir", relative_path = "test.xml", returns "dir/test.xml".
-// On Windows, uses \ as the separator rather than /.
-FilePath FilePath::ConcatPaths(const FilePath& directory,
-                               const FilePath& relative_path) {
-  if (directory.IsEmpty())
-    return relative_path;
-  const FilePath dir(directory.RemoveTrailingPathSeparator());
-  return FilePath(String::Format("%s%c%s", dir.c_str(), kPathSeparator,
-                                 relative_path.c_str()));
-}
-
-// Returns true if pathname describes something findable in the file-system,
-// either a file, directory, or whatever.
-bool FilePath::FileOrDirectoryExists() const {
-#if GTEST_OS_WINDOWS_MOBILE
-  LPCWSTR unicode = String::AnsiToUtf16(pathname_.c_str());
-  const DWORD attributes = GetFileAttributes(unicode);
-  delete [] unicode;
-  return attributes != kInvalidFileAttributes;
-#else
-  posix::StatStruct file_stat;
-  return posix::Stat(pathname_.c_str(), &file_stat) == 0;
-#endif  // GTEST_OS_WINDOWS_MOBILE
-}
-
-// Returns true if pathname describes a directory in the file-system
-// that exists.
-bool FilePath::DirectoryExists() const {
-  bool result = false;
-#if GTEST_OS_WINDOWS
-  // Don't strip off trailing separator if path is a root directory on
-  // Windows (like "C:\\").
-  const FilePath& path(IsRootDirectory() ? *this :
-                                           RemoveTrailingPathSeparator());
-#else
-  const FilePath& path(*this);
-#endif
-
-#if GTEST_OS_WINDOWS_MOBILE
-  LPCWSTR unicode = String::AnsiToUtf16(path.c_str());
-  const DWORD attributes = GetFileAttributes(unicode);
-  delete [] unicode;
-  if ((attributes != kInvalidFileAttributes) &&
-      (attributes & FILE_ATTRIBUTE_DIRECTORY)) {
-    result = true;
-  }
-#else
-  posix::StatStruct file_stat;
-  result = posix::Stat(path.c_str(), &file_stat) == 0 &&
-      posix::IsDir(file_stat);
-#endif  // GTEST_OS_WINDOWS_MOBILE
-
-  return result;
-}
-
-// Returns true if pathname describes a root directory. (Windows has one
-// root directory per disk drive.)
-bool FilePath::IsRootDirectory() const {
-#if GTEST_OS_WINDOWS
-  // TODO(wan@google.com): on Windows a network share like
-  // \\server\share can be a root directory, although it cannot be the
-  // current directory.  Handle this properly.
-  return pathname_.length() == 3 && IsAbsolutePath();
-#else
-  return pathname_ == kPathSeparatorString;
-#endif
-}
-
-// Returns true if pathname describes an absolute path.
-bool FilePath::IsAbsolutePath() const {
-  const char* const name = pathname_.c_str();
-#if GTEST_OS_WINDOWS
-  return pathname_.length() >= 3 &&
-     ((name[0] >= 'a' && name[0] <= 'z') ||
-      (name[0] >= 'A' && name[0] <= 'Z')) &&
-     name[1] == ':' &&
-     name[2] == kPathSeparator;
-#else
-  return name[0] == kPathSeparator;
-#endif
-}
-
-// Returns a pathname for a file that does not currently exist. The pathname
-// will be directory/base_name.extension or
-// directory/base_name_<number>.extension if directory/base_name.extension
-// already exists. The number will be incremented until a pathname is found
-// that does not already exist.
-// Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.
-// There could be a race condition if two or more processes are calling this
-// function at the same time -- they could both pick the same filename.
-FilePath FilePath::GenerateUniqueFileName(const FilePath& directory,
-                                          const FilePath& base_name,
-                                          const char* extension) {
-  FilePath full_pathname;
-  int number = 0;
-  do {
-    full_pathname.Set(MakeFileName(directory, base_name, number++, extension));
-  } while (full_pathname.FileOrDirectoryExists());
-  return full_pathname;
-}
-
-// Returns true if FilePath ends with a path separator, which indicates that
-// it is intended to represent a directory. Returns false otherwise.
-// This does NOT check that a directory (or file) actually exists.
-bool FilePath::IsDirectory() const {
-  return pathname_.EndsWith(kPathSeparatorString);
-}
-
-// Create directories so that path exists. Returns true if successful or if
-// the directories already exist; returns false if unable to create directories
-// for any reason.
-bool FilePath::CreateDirectoriesRecursively() const {
-  if (!this->IsDirectory()) {
-    return false;
-  }
-
-  if (pathname_.length() == 0 || this->DirectoryExists()) {
-    return true;
-  }
-
-  const FilePath parent(this->RemoveTrailingPathSeparator().RemoveFileName());
-  return parent.CreateDirectoriesRecursively() && this->CreateFolder();
-}
-
-// Create the directory so that path exists. Returns true if successful or
-// if the directory already exists; returns false if unable to create the
-// directory for any reason, including if the parent directory does not
-// exist. Not named "CreateDirectory" because that's a macro on Windows.
-bool FilePath::CreateFolder() const {
-#if GTEST_OS_WINDOWS_MOBILE
-  FilePath removed_sep(this->RemoveTrailingPathSeparator());
-  LPCWSTR unicode = String::AnsiToUtf16(removed_sep.c_str());
-  int result = CreateDirectory(unicode, NULL) ? 0 : -1;
-  delete [] unicode;
-#elif GTEST_OS_WINDOWS
-  int result = _mkdir(pathname_.c_str());
-#else
-  int result = mkdir(pathname_.c_str(), 0777);
-#endif  // GTEST_OS_WINDOWS_MOBILE
-
-  if (result == -1) {
-    return this->DirectoryExists();  // An error is OK if the directory exists.
-  }
-  return true;  // No error.
-}
-
-// If input name has a trailing separator character, remove it and return the
-// name, otherwise return the name string unmodified.
-// On Windows platform, uses \ as the separator, other platforms use /.
-FilePath FilePath::RemoveTrailingPathSeparator() const {
-  return pathname_.EndsWith(kPathSeparatorString)
-      ? FilePath(String(pathname_.c_str(), pathname_.length() - 1))
-      : *this;
-}
-
-// Normalize removes any redundant separators that might be in the pathname.
-// For example, "bar///foo" becomes "bar/foo". Does not eliminate other
-// redundancies that might be in a pathname involving "." or "..".
-void FilePath::Normalize() {
-  if (pathname_.c_str() == NULL) {
-    pathname_ = "";
-    return;
-  }
-  const char* src = pathname_.c_str();
-  char* const dest = new char[pathname_.length() + 1];
-  char* dest_ptr = dest;
-  memset(dest_ptr, 0, pathname_.length() + 1);
-
-  while (*src != '\0') {
-    *dest_ptr++ = *src;
-    if (*src != kPathSeparator)
-      src++;
-    else
-      while (*src == kPathSeparator)
-        src++;
-  }
-  *dest_ptr = '\0';
-  pathname_ = dest;
-  delete[] dest;
-}
-
-}  // namespace internal
-}  // namespace testing
diff --git a/third_party/gtest/src/gtest-internal-inl.h b/third_party/gtest/src/gtest-internal-inl.h
deleted file mode 100644
index 45a4c10..0000000
--- a/third_party/gtest/src/gtest-internal-inl.h
+++ /dev/null
@@ -1,1251 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Utility functions and classes used by the Google C++ testing framework.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// This file contains purely Google Test's internal implementation.  Please
-// DO NOT #INCLUDE IT IN A USER PROGRAM.
-
-#ifndef GTEST_SRC_GTEST_INTERNAL_INL_H_
-#define GTEST_SRC_GTEST_INTERNAL_INL_H_
-
-// GTEST_IMPLEMENTATION_ is defined to 1 iff the current translation unit is
-// part of Google Test's implementation; otherwise it's undefined.
-#if !GTEST_IMPLEMENTATION_
-// A user is trying to include this from his code - just say no.
-#error "gtest-internal-inl.h is part of Google Test's internal implementation."
-#error "It must not be included except by Google Test itself."
-#endif  // GTEST_IMPLEMENTATION_
-
-#ifndef _WIN32_WCE
-#include <errno.h>
-#endif  // !_WIN32_WCE
-#include <stddef.h>
-#include <stdlib.h>  // For strtoll/_strtoul64/malloc/free.
-#include <string.h>  // For memmove.
-
-#include <string>
-
-#include <gtest/internal/gtest-port.h>
-
-#if GTEST_OS_WINDOWS
-#include <windows.h>  // For DWORD.
-#endif  // GTEST_OS_WINDOWS
-
-#include <gtest/gtest.h>
-#include <gtest/gtest-spi.h>
-
-namespace testing {
-
-// Declares the flags.
-//
-// We don't want the users to modify this flag in the code, but want
-// Google Test's own unit tests to be able to access it. Therefore we
-// declare it here as opposed to in gtest.h.
-GTEST_DECLARE_bool_(death_test_use_fork);
-
-namespace internal {
-
-// The value of GetTestTypeId() as seen from within the Google Test
-// library.  This is solely for testing GetTestTypeId().
-extern const TypeId kTestTypeIdInGoogleTest;
-
-// Names of the flags (needed for parsing Google Test flags).
-const char kAlsoRunDisabledTestsFlag[] = "also_run_disabled_tests";
-const char kBreakOnFailureFlag[] = "break_on_failure";
-const char kCatchExceptionsFlag[] = "catch_exceptions";
-const char kColorFlag[] = "color";
-const char kFilterFlag[] = "filter";
-const char kListTestsFlag[] = "list_tests";
-const char kOutputFlag[] = "output";
-const char kPrintTimeFlag[] = "print_time";
-const char kRandomSeedFlag[] = "random_seed";
-const char kRepeatFlag[] = "repeat";
-const char kShuffleFlag[] = "shuffle";
-const char kStackTraceDepthFlag[] = "stack_trace_depth";
-const char kThrowOnFailureFlag[] = "throw_on_failure";
-
-// A valid random seed must be in [1, kMaxRandomSeed].
-const int kMaxRandomSeed = 99999;
-
-// Returns the current time in milliseconds.
-TimeInMillis GetTimeInMillis();
-
-// Returns a random seed in range [1, kMaxRandomSeed] based on the
-// given --gtest_random_seed flag value.
-inline int GetRandomSeedFromFlag(Int32 random_seed_flag) {
-  const unsigned int raw_seed = (random_seed_flag == 0) ?
-      static_cast<unsigned int>(GetTimeInMillis()) :
-      static_cast<unsigned int>(random_seed_flag);
-
-  // Normalizes the actual seed to range [1, kMaxRandomSeed] such that
-  // it's easy to type.
-  const int normalized_seed =
-      static_cast<int>((raw_seed - 1U) %
-                       static_cast<unsigned int>(kMaxRandomSeed)) + 1;
-  return normalized_seed;
-}
-
-// Returns the first valid random seed after 'seed'.  The behavior is
-// undefined if 'seed' is invalid.  The seed after kMaxRandomSeed is
-// considered to be 1.
-inline int GetNextRandomSeed(int seed) {
-  GTEST_CHECK_(1 <= seed && seed <= kMaxRandomSeed)
-      << "Invalid random seed " << seed << " - must be in [1, "
-      << kMaxRandomSeed << "].";
-  const int next_seed = seed + 1;
-  return (next_seed > kMaxRandomSeed) ? 1 : next_seed;
-}
-
-// This class saves the values of all Google Test flags in its c'tor, and
-// restores them in its d'tor.
-class GTestFlagSaver {
- public:
-  // The c'tor.
-  GTestFlagSaver() {
-    also_run_disabled_tests_ = GTEST_FLAG(also_run_disabled_tests);
-    break_on_failure_ = GTEST_FLAG(break_on_failure);
-    catch_exceptions_ = GTEST_FLAG(catch_exceptions);
-    color_ = GTEST_FLAG(color);
-    death_test_style_ = GTEST_FLAG(death_test_style);
-    death_test_use_fork_ = GTEST_FLAG(death_test_use_fork);
-    filter_ = GTEST_FLAG(filter);
-    internal_run_death_test_ = GTEST_FLAG(internal_run_death_test);
-    list_tests_ = GTEST_FLAG(list_tests);
-    output_ = GTEST_FLAG(output);
-    print_time_ = GTEST_FLAG(print_time);
-    random_seed_ = GTEST_FLAG(random_seed);
-    repeat_ = GTEST_FLAG(repeat);
-    shuffle_ = GTEST_FLAG(shuffle);
-    stack_trace_depth_ = GTEST_FLAG(stack_trace_depth);
-    throw_on_failure_ = GTEST_FLAG(throw_on_failure);
-  }
-
-  // The d'tor is not virtual.  DO NOT INHERIT FROM THIS CLASS.
-  ~GTestFlagSaver() {
-    GTEST_FLAG(also_run_disabled_tests) = also_run_disabled_tests_;
-    GTEST_FLAG(break_on_failure) = break_on_failure_;
-    GTEST_FLAG(catch_exceptions) = catch_exceptions_;
-    GTEST_FLAG(color) = color_;
-    GTEST_FLAG(death_test_style) = death_test_style_;
-    GTEST_FLAG(death_test_use_fork) = death_test_use_fork_;
-    GTEST_FLAG(filter) = filter_;
-    GTEST_FLAG(internal_run_death_test) = internal_run_death_test_;
-    GTEST_FLAG(list_tests) = list_tests_;
-    GTEST_FLAG(output) = output_;
-    GTEST_FLAG(print_time) = print_time_;
-    GTEST_FLAG(random_seed) = random_seed_;
-    GTEST_FLAG(repeat) = repeat_;
-    GTEST_FLAG(shuffle) = shuffle_;
-    GTEST_FLAG(stack_trace_depth) = stack_trace_depth_;
-    GTEST_FLAG(throw_on_failure) = throw_on_failure_;
-  }
- private:
-  // Fields for saving the original values of flags.
-  bool also_run_disabled_tests_;
-  bool break_on_failure_;
-  bool catch_exceptions_;
-  String color_;
-  String death_test_style_;
-  bool death_test_use_fork_;
-  String filter_;
-  String internal_run_death_test_;
-  bool list_tests_;
-  String output_;
-  bool print_time_;
-  bool pretty_;
-  internal::Int32 random_seed_;
-  internal::Int32 repeat_;
-  bool shuffle_;
-  internal::Int32 stack_trace_depth_;
-  bool throw_on_failure_;
-} GTEST_ATTRIBUTE_UNUSED_;
-
-// Converts a Unicode code point to a narrow string in UTF-8 encoding.
-// code_point parameter is of type UInt32 because wchar_t may not be
-// wide enough to contain a code point.
-// The output buffer str must containt at least 32 characters.
-// The function returns the address of the output buffer.
-// If the code_point is not a valid Unicode code point
-// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be output
-// as '(Invalid Unicode 0xXXXXXXXX)'.
-char* CodePointToUtf8(UInt32 code_point, char* str);
-
-// Converts a wide string to a narrow string in UTF-8 encoding.
-// The wide string is assumed to have the following encoding:
-//   UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin, Symbian OS)
-//   UTF-32 if sizeof(wchar_t) == 4 (on Linux)
-// Parameter str points to a null-terminated wide string.
-// Parameter num_chars may additionally limit the number
-// of wchar_t characters processed. -1 is used when the entire string
-// should be processed.
-// If the string contains code points that are not valid Unicode code points
-// (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output
-// as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding
-// and contains invalid UTF-16 surrogate pairs, values in those pairs
-// will be encoded as individual Unicode characters from Basic Normal Plane.
-String WideStringToUtf8(const wchar_t* str, int num_chars);
-
-// Returns the number of active threads, or 0 when there is an error.
-size_t GetThreadCount();
-
-// Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file
-// if the variable is present. If a file already exists at this location, this
-// function will write over it. If the variable is present, but the file cannot
-// be created, prints an error and exits.
-void WriteToShardStatusFileIfNeeded();
-
-// Checks whether sharding is enabled by examining the relevant
-// environment variable values. If the variables are present,
-// but inconsistent (e.g., shard_index >= total_shards), prints
-// an error and exits. If in_subprocess_for_death_test, sharding is
-// disabled because it must only be applied to the original test
-// process. Otherwise, we could filter out death tests we intended to execute.
-bool ShouldShard(const char* total_shards_str, const char* shard_index_str,
-                 bool in_subprocess_for_death_test);
-
-// Parses the environment variable var as an Int32. If it is unset,
-// returns default_val. If it is not an Int32, prints an error and
-// and aborts.
-Int32 Int32FromEnvOrDie(const char* env_var, Int32 default_val);
-
-// Given the total number of shards, the shard index, and the test id,
-// returns true iff the test should be run on this shard. The test id is
-// some arbitrary but unique non-negative integer assigned to each test
-// method. Assumes that 0 <= shard_index < total_shards.
-bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id);
-
-// Vector is an ordered container that supports random access to the
-// elements.
-//
-// We cannot use std::vector, as Visual C++ 7.1's implementation of
-// STL has problems compiling when exceptions are disabled.  There is
-// a hack to work around the problems, but we've seen cases where the
-// hack fails to work.
-//
-// The element type must support copy constructor and operator=.
-template <typename E>  // E is the element type.
-class Vector {
- public:
-  // Creates an empty Vector.
-  Vector() : elements_(NULL), capacity_(0), size_(0) {}
-
-  // D'tor.
-  virtual ~Vector() { Clear(); }
-
-  // Clears the Vector.
-  void Clear() {
-    if (elements_ != NULL) {
-      for (int i = 0; i < size_; i++) {
-        delete elements_[i];
-      }
-
-      free(elements_);
-      elements_ = NULL;
-      capacity_ = size_ = 0;
-    }
-  }
-
-  // Gets the number of elements.
-  int size() const { return size_; }
-
-  // Adds an element to the end of the Vector.  A copy of the element
-  // is created using the copy constructor, and then stored in the
-  // Vector.  Changes made to the element in the Vector doesn't affect
-  // the source object, and vice versa.
-  void PushBack(const E& element) { Insert(element, size_); }
-
-  // Adds an element to the beginning of this Vector.
-  void PushFront(const E& element) { Insert(element, 0); }
-
-  // Removes an element from the beginning of this Vector.  If the
-  // result argument is not NULL, the removed element is stored in the
-  // memory it points to.  Otherwise the element is thrown away.
-  // Returns true iff the vector wasn't empty before the operation.
-  bool PopFront(E* result) {
-    if (size_ == 0)
-      return false;
-
-    if (result != NULL)
-      *result = GetElement(0);
-
-    Erase(0);
-    return true;
-  }
-
-  // Inserts an element at the given index.  It's the caller's
-  // responsibility to ensure that the given index is in the range [0,
-  // size()].
-  void Insert(const E& element, int index) {
-    GrowIfNeeded();
-    MoveElements(index, size_ - index, index + 1);
-    elements_[index] = new E(element);
-    size_++;
-  }
-
-  // Erases the element at the specified index, or aborts the program if the
-  // index is not in range [0, size()).
-  void Erase(int index) {
-    GTEST_CHECK_(0 <= index && index < size_)
-        << "Invalid Vector index " << index << ": must be in range [0, "
-        << (size_ - 1) << "].";
-
-    delete elements_[index];
-    MoveElements(index + 1, size_ - index - 1, index);
-    size_--;
-  }
-
-  // Returns the number of elements that satisfy a given predicate.
-  // The parameter 'predicate' is a Boolean function or functor that
-  // accepts a 'const E &', where E is the element type.
-  template <typename P>  // P is the type of the predicate function/functor
-  int CountIf(P predicate) const {
-    int count = 0;
-    for (int i = 0; i < size_; i++) {
-      if (predicate(*(elements_[i]))) {
-        count++;
-      }
-    }
-
-    return count;
-  }
-
-  // Applies a function/functor to each element in the Vector.  The
-  // parameter 'functor' is a function/functor that accepts a 'const
-  // E &', where E is the element type.  This method does not change
-  // the elements.
-  template <typename F>  // F is the type of the function/functor
-  void ForEach(F functor) const {
-    for (int i = 0; i < size_; i++) {
-      functor(*(elements_[i]));
-    }
-  }
-
-  // Returns the first node whose element satisfies a given predicate,
-  // or NULL if none is found.  The parameter 'predicate' is a
-  // function/functor that accepts a 'const E &', where E is the
-  // element type.  This method does not change the elements.
-  template <typename P>  // P is the type of the predicate function/functor.
-  const E* FindIf(P predicate) const {
-    for (int i = 0; i < size_; i++) {
-      if (predicate(*elements_[i])) {
-        return elements_[i];
-      }
-    }
-    return NULL;
-  }
-
-  template <typename P>
-  E* FindIf(P predicate) {
-    for (int i = 0; i < size_; i++) {
-      if (predicate(*elements_[i])) {
-        return elements_[i];
-      }
-    }
-    return NULL;
-  }
-
-  // Returns the i-th element of the Vector, or aborts the program if i
-  // is not in range [0, size()).
-  const E& GetElement(int i) const {
-    GTEST_CHECK_(0 <= i && i < size_)
-        << "Invalid Vector index " << i << ": must be in range [0, "
-        << (size_ - 1) << "].";
-
-    return *(elements_[i]);
-  }
-
-  // Returns a mutable reference to the i-th element of the Vector, or
-  // aborts the program if i is not in range [0, size()).
-  E& GetMutableElement(int i) {
-    GTEST_CHECK_(0 <= i && i < size_)
-        << "Invalid Vector index " << i << ": must be in range [0, "
-        << (size_ - 1) << "].";
-
-    return *(elements_[i]);
-  }
-
-  // Returns the i-th element of the Vector, or default_value if i is not
-  // in range [0, size()).
-  E GetElementOr(int i, E default_value) const {
-    return (i < 0 || i >= size_) ? default_value : *(elements_[i]);
-  }
-
-  // Swaps the i-th and j-th elements of the Vector.  Crashes if i or
-  // j is invalid.
-  void Swap(int i, int j) {
-    GTEST_CHECK_(0 <= i && i < size_)
-        << "Invalid first swap element " << i << ": must be in range [0, "
-        << (size_ - 1) << "].";
-    GTEST_CHECK_(0 <= j && j < size_)
-        << "Invalid second swap element " << j << ": must be in range [0, "
-        << (size_ - 1) << "].";
-
-    E* const temp = elements_[i];
-    elements_[i] = elements_[j];
-    elements_[j] = temp;
-  }
-
-  // Performs an in-place shuffle of a range of this Vector's nodes.
-  // 'begin' and 'end' are element indices as an STL-style range;
-  // i.e. [begin, end) are shuffled, where 'end' == size() means to
-  // shuffle to the end of the Vector.
-  void ShuffleRange(internal::Random* random, int begin, int end) {
-    GTEST_CHECK_(0 <= begin && begin <= size_)
-        << "Invalid shuffle range start " << begin << ": must be in range [0, "
-        << size_ << "].";
-    GTEST_CHECK_(begin <= end && end <= size_)
-        << "Invalid shuffle range finish " << end << ": must be in range ["
-        << begin << ", " << size_ << "].";
-
-    // Fisher-Yates shuffle, from
-    // http://en.wikipedia.org/wiki/Fisher-Yates_shuffle
-    for (int range_width = end - begin; range_width >= 2; range_width--) {
-      const int last_in_range = begin + range_width - 1;
-      const int selected = begin + random->Generate(range_width);
-      Swap(selected, last_in_range);
-    }
-  }
-
-  // Performs an in-place shuffle of this Vector's nodes.
-  void Shuffle(internal::Random* random) {
-    ShuffleRange(random, 0, size());
-  }
-
-  // Returns a copy of this Vector.
-  Vector* Clone() const {
-    Vector* const clone = new Vector;
-    clone->Reserve(size_);
-    for (int i = 0; i < size_; i++) {
-      clone->PushBack(GetElement(i));
-    }
-    return clone;
-  }
-
- private:
-  // Makes sure this Vector's capacity is at least the given value.
-  void Reserve(int new_capacity) {
-    if (new_capacity <= capacity_)
-      return;
-
-    capacity_ = new_capacity;
-    elements_ = static_cast<E**>(
-        realloc(elements_, capacity_*sizeof(elements_[0])));
-  }
-
-  // Grows the buffer if it is not big enough to hold one more element.
-  void GrowIfNeeded() {
-    if (size_ < capacity_)
-      return;
-
-    // Exponential bump-up is necessary to ensure that inserting N
-    // elements is O(N) instead of O(N^2).  The factor 3/2 means that
-    // no more than 1/3 of the slots are wasted.
-    const int new_capacity = 3*(capacity_/2 + 1);
-    GTEST_CHECK_(new_capacity > capacity_)  // Does the new capacity overflow?
-        << "Cannot grow a Vector with " << capacity_ << " elements already.";
-    Reserve(new_capacity);
-  }
-
-  // Moves the give consecutive elements to a new index in the Vector.
-  void MoveElements(int source, int count, int dest) {
-    memmove(elements_ + dest, elements_ + source, count*sizeof(elements_[0]));
-  }
-
-  E** elements_;
-  int capacity_;  // The number of elements allocated for elements_.
-  int size_;      // The number of elements; in the range [0, capacity_].
-
-  // We disallow copying Vector.
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(Vector);
-};  // class Vector
-
-// A function for deleting an object.  Handy for being used as a
-// functor.
-template <typename T>
-static void Delete(T * x) {
-  delete x;
-}
-
-// A predicate that checks the key of a TestProperty against a known key.
-//
-// TestPropertyKeyIs is copyable.
-class TestPropertyKeyIs {
- public:
-  // Constructor.
-  //
-  // TestPropertyKeyIs has NO default constructor.
-  explicit TestPropertyKeyIs(const char* key)
-      : key_(key) {}
-
-  // Returns true iff the test name of test property matches on key_.
-  bool operator()(const TestProperty& test_property) const {
-    return String(test_property.key()).Compare(key_) == 0;
-  }
-
- private:
-  String key_;
-};
-
-class TestInfoImpl {
- public:
-  TestInfoImpl(TestInfo* parent, const char* test_case_name,
-               const char* name, const char* test_case_comment,
-               const char* comment, TypeId fixture_class_id,
-               internal::TestFactoryBase* factory);
-  ~TestInfoImpl();
-
-  // Returns true if this test should run.
-  bool should_run() const { return should_run_; }
-
-  // Sets the should_run member.
-  void set_should_run(bool should) { should_run_ = should; }
-
-  // Returns true if this test is disabled. Disabled tests are not run.
-  bool is_disabled() const { return is_disabled_; }
-
-  // Sets the is_disabled member.
-  void set_is_disabled(bool is) { is_disabled_ = is; }
-
-  // Returns true if this test matches the filter specified by the user.
-  bool matches_filter() const { return matches_filter_; }
-
-  // Sets the matches_filter member.
-  void set_matches_filter(bool matches) { matches_filter_ = matches; }
-
-  // Returns the test case name.
-  const char* test_case_name() const { return test_case_name_.c_str(); }
-
-  // Returns the test name.
-  const char* name() const { return name_.c_str(); }
-
-  // Returns the test case comment.
-  const char* test_case_comment() const { return test_case_comment_.c_str(); }
-
-  // Returns the test comment.
-  const char* comment() const { return comment_.c_str(); }
-
-  // Returns the ID of the test fixture class.
-  TypeId fixture_class_id() const { return fixture_class_id_; }
-
-  // Returns the test result.
-  TestResult* result() { return &result_; }
-  const TestResult* result() const { return &result_; }
-
-  // Creates the test object, runs it, records its result, and then
-  // deletes it.
-  void Run();
-
-  // Clears the test result.
-  void ClearResult() { result_.Clear(); }
-
-  // Clears the test result in the given TestInfo object.
-  static void ClearTestResult(TestInfo * test_info) {
-    test_info->impl()->ClearResult();
-  }
-
- private:
-  // These fields are immutable properties of the test.
-  TestInfo* const parent_;          // The owner of this object
-  const String test_case_name_;     // Test case name
-  const String name_;               // Test name
-  const String test_case_comment_;  // Test case comment
-  const String comment_;            // Test comment
-  const TypeId fixture_class_id_;   // ID of the test fixture class
-  bool should_run_;                 // True iff this test should run
-  bool is_disabled_;                // True iff this test is disabled
-  bool matches_filter_;             // True if this test matches the
-                                    // user-specified filter.
-  internal::TestFactoryBase* const factory_;  // The factory that creates
-                                              // the test object
-
-  // This field is mutable and needs to be reset before running the
-  // test for the second time.
-  TestResult result_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfoImpl);
-};
-
-// Class UnitTestOptions.
-//
-// This class contains functions for processing options the user
-// specifies when running the tests.  It has only static members.
-//
-// In most cases, the user can specify an option using either an
-// environment variable or a command line flag.  E.g. you can set the
-// test filter using either GTEST_FILTER or --gtest_filter.  If both
-// the variable and the flag are present, the latter overrides the
-// former.
-class UnitTestOptions {
- public:
-  // Functions for processing the gtest_output flag.
-
-  // Returns the output format, or "" for normal printed output.
-  static String GetOutputFormat();
-
-  // Returns the absolute path of the requested output file, or the
-  // default (test_detail.xml in the original working directory) if
-  // none was explicitly specified.
-  static String GetAbsolutePathToOutputFile();
-
-  // Functions for processing the gtest_filter flag.
-
-  // Returns true iff the wildcard pattern matches the string.  The
-  // first ':' or '\0' character in pattern marks the end of it.
-  //
-  // This recursive algorithm isn't very efficient, but is clear and
-  // works well enough for matching test names, which are short.
-  static bool PatternMatchesString(const char *pattern, const char *str);
-
-  // Returns true iff the user-specified filter matches the test case
-  // name and the test name.
-  static bool FilterMatchesTest(const String &test_case_name,
-                                const String &test_name);
-
-#if GTEST_OS_WINDOWS
-  // Function for supporting the gtest_catch_exception flag.
-
-  // Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the
-  // given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise.
-  // This function is useful as an __except condition.
-  static int GTestShouldProcessSEH(DWORD exception_code);
-#endif  // GTEST_OS_WINDOWS
-
-  // Returns true if "name" matches the ':' separated list of glob-style
-  // filters in "filter".
-  static bool MatchesFilter(const String& name, const char* filter);
-};
-
-// Returns the current application's name, removing directory path if that
-// is present.  Used by UnitTestOptions::GetOutputFile.
-FilePath GetCurrentExecutableName();
-
-// The role interface for getting the OS stack trace as a string.
-class OsStackTraceGetterInterface {
- public:
-  OsStackTraceGetterInterface() {}
-  virtual ~OsStackTraceGetterInterface() {}
-
-  // Returns the current OS stack trace as a String.  Parameters:
-  //
-  //   max_depth  - the maximum number of stack frames to be included
-  //                in the trace.
-  //   skip_count - the number of top frames to be skipped; doesn't count
-  //                against max_depth.
-  virtual String CurrentStackTrace(int max_depth, int skip_count) = 0;
-
-  // UponLeavingGTest() should be called immediately before Google Test calls
-  // user code. It saves some information about the current stack that
-  // CurrentStackTrace() will use to find and hide Google Test stack frames.
-  virtual void UponLeavingGTest() = 0;
-
- private:
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetterInterface);
-};
-
-// A working implementation of the OsStackTraceGetterInterface interface.
-class OsStackTraceGetter : public OsStackTraceGetterInterface {
- public:
-  OsStackTraceGetter() : caller_frame_(NULL) {}
-  virtual String CurrentStackTrace(int max_depth, int skip_count);
-  virtual void UponLeavingGTest();
-
-  // This string is inserted in place of stack frames that are part of
-  // Google Test's implementation.
-  static const char* const kElidedFramesMarker;
-
- private:
-  Mutex mutex_;  // protects all internal state
-
-  // We save the stack frame below the frame that calls user code.
-  // We do this because the address of the frame immediately below
-  // the user code changes between the call to UponLeavingGTest()
-  // and any calls to CurrentStackTrace() from within the user code.
-  void* caller_frame_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetter);
-};
-
-// Information about a Google Test trace point.
-struct TraceInfo {
-  const char* file;
-  int line;
-  String message;
-};
-
-// This is the default global test part result reporter used in UnitTestImpl.
-// This class should only be used by UnitTestImpl.
-class DefaultGlobalTestPartResultReporter
-  : public TestPartResultReporterInterface {
- public:
-  explicit DefaultGlobalTestPartResultReporter(UnitTestImpl* unit_test);
-  // Implements the TestPartResultReporterInterface. Reports the test part
-  // result in the current test.
-  virtual void ReportTestPartResult(const TestPartResult& result);
-
- private:
-  UnitTestImpl* const unit_test_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultGlobalTestPartResultReporter);
-};
-
-// This is the default per thread test part result reporter used in
-// UnitTestImpl. This class should only be used by UnitTestImpl.
-class DefaultPerThreadTestPartResultReporter
-    : public TestPartResultReporterInterface {
- public:
-  explicit DefaultPerThreadTestPartResultReporter(UnitTestImpl* unit_test);
-  // Implements the TestPartResultReporterInterface. The implementation just
-  // delegates to the current global test part result reporter of *unit_test_.
-  virtual void ReportTestPartResult(const TestPartResult& result);
-
- private:
-  UnitTestImpl* const unit_test_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultPerThreadTestPartResultReporter);
-};
-
-// The private implementation of the UnitTest class.  We don't protect
-// the methods under a mutex, as this class is not accessible by a
-// user and the UnitTest class that delegates work to this class does
-// proper locking.
-class UnitTestImpl {
- public:
-  explicit UnitTestImpl(UnitTest* parent);
-  virtual ~UnitTestImpl();
-
-  // There are two different ways to register your own TestPartResultReporter.
-  // You can register your own repoter to listen either only for test results
-  // from the current thread or for results from all threads.
-  // By default, each per-thread test result repoter just passes a new
-  // TestPartResult to the global test result reporter, which registers the
-  // test part result for the currently running test.
-
-  // Returns the global test part result reporter.
-  TestPartResultReporterInterface* GetGlobalTestPartResultReporter();
-
-  // Sets the global test part result reporter.
-  void SetGlobalTestPartResultReporter(
-      TestPartResultReporterInterface* reporter);
-
-  // Returns the test part result reporter for the current thread.
-  TestPartResultReporterInterface* GetTestPartResultReporterForCurrentThread();
-
-  // Sets the test part result reporter for the current thread.
-  void SetTestPartResultReporterForCurrentThread(
-      TestPartResultReporterInterface* reporter);
-
-  // Gets the number of successful test cases.
-  int successful_test_case_count() const;
-
-  // Gets the number of failed test cases.
-  int failed_test_case_count() const;
-
-  // Gets the number of all test cases.
-  int total_test_case_count() const;
-
-  // Gets the number of all test cases that contain at least one test
-  // that should run.
-  int test_case_to_run_count() const;
-
-  // Gets the number of successful tests.
-  int successful_test_count() const;
-
-  // Gets the number of failed tests.
-  int failed_test_count() const;
-
-  // Gets the number of disabled tests.
-  int disabled_test_count() const;
-
-  // Gets the number of all tests.
-  int total_test_count() const;
-
-  // Gets the number of tests that should run.
-  int test_to_run_count() const;
-
-  // Gets the elapsed time, in milliseconds.
-  TimeInMillis elapsed_time() const { return elapsed_time_; }
-
-  // Returns true iff the unit test passed (i.e. all test cases passed).
-  bool Passed() const { return !Failed(); }
-
-  // Returns true iff the unit test failed (i.e. some test case failed
-  // or something outside of all tests failed).
-  bool Failed() const {
-    return failed_test_case_count() > 0 || ad_hoc_test_result()->Failed();
-  }
-
-  // Gets the i-th test case among all the test cases. i can range from 0 to
-  // total_test_case_count() - 1. If i is not in that range, returns NULL.
-  const TestCase* GetTestCase(int i) const {
-    const int index = test_case_indices_.GetElementOr(i, -1);
-    return index < 0 ? NULL : test_cases_.GetElement(i);
-  }
-
-  // Gets the i-th test case among all the test cases. i can range from 0 to
-  // total_test_case_count() - 1. If i is not in that range, returns NULL.
-  TestCase* GetMutableTestCase(int i) {
-    const int index = test_case_indices_.GetElementOr(i, -1);
-    return index < 0 ? NULL : test_cases_.GetElement(index);
-  }
-
-  // Provides access to the event listener list.
-  TestEventListeners* listeners() { return &listeners_; }
-
-  // Returns the TestResult for the test that's currently running, or
-  // the TestResult for the ad hoc test if no test is running.
-  TestResult* current_test_result();
-
-  // Returns the TestResult for the ad hoc test.
-  const TestResult* ad_hoc_test_result() const { return &ad_hoc_test_result_; }
-
-  // Sets the OS stack trace getter.
-  //
-  // Does nothing if the input and the current OS stack trace getter
-  // are the same; otherwise, deletes the old getter and makes the
-  // input the current getter.
-  void set_os_stack_trace_getter(OsStackTraceGetterInterface* getter);
-
-  // Returns the current OS stack trace getter if it is not NULL;
-  // otherwise, creates an OsStackTraceGetter, makes it the current
-  // getter, and returns it.
-  OsStackTraceGetterInterface* os_stack_trace_getter();
-
-  // Returns the current OS stack trace as a String.
-  //
-  // The maximum number of stack frames to be included is specified by
-  // the gtest_stack_trace_depth flag.  The skip_count parameter
-  // specifies the number of top frames to be skipped, which doesn't
-  // count against the number of frames to be included.
-  //
-  // For example, if Foo() calls Bar(), which in turn calls
-  // CurrentOsStackTraceExceptTop(1), Foo() will be included in the
-  // trace but Bar() and CurrentOsStackTraceExceptTop() won't.
-  String CurrentOsStackTraceExceptTop(int skip_count);
-
-  // Finds and returns a TestCase with the given name.  If one doesn't
-  // exist, creates one and returns it.
-  //
-  // Arguments:
-  //
-  //   test_case_name: name of the test case
-  //   set_up_tc:      pointer to the function that sets up the test case
-  //   tear_down_tc:   pointer to the function that tears down the test case
-  TestCase* GetTestCase(const char* test_case_name,
-                        const char* comment,
-                        Test::SetUpTestCaseFunc set_up_tc,
-                        Test::TearDownTestCaseFunc tear_down_tc);
-
-  // Adds a TestInfo to the unit test.
-  //
-  // Arguments:
-  //
-  //   set_up_tc:    pointer to the function that sets up the test case
-  //   tear_down_tc: pointer to the function that tears down the test case
-  //   test_info:    the TestInfo object
-  void AddTestInfo(Test::SetUpTestCaseFunc set_up_tc,
-                   Test::TearDownTestCaseFunc tear_down_tc,
-                   TestInfo * test_info) {
-    // In order to support thread-safe death tests, we need to
-    // remember the original working directory when the test program
-    // was first invoked.  We cannot do this in RUN_ALL_TESTS(), as
-    // the user may have changed the current directory before calling
-    // RUN_ALL_TESTS().  Therefore we capture the current directory in
-    // AddTestInfo(), which is called to register a TEST or TEST_F
-    // before main() is reached.
-    if (original_working_dir_.IsEmpty()) {
-      original_working_dir_.Set(FilePath::GetCurrentDir());
-      GTEST_CHECK_(!original_working_dir_.IsEmpty())
-          << "Failed to get the current working directory.";
-    }
-
-    GetTestCase(test_info->test_case_name(),
-                test_info->test_case_comment(),
-                set_up_tc,
-                tear_down_tc)->AddTestInfo(test_info);
-  }
-
-#if GTEST_HAS_PARAM_TEST
-  // Returns ParameterizedTestCaseRegistry object used to keep track of
-  // value-parameterized tests and instantiate and register them.
-  internal::ParameterizedTestCaseRegistry& parameterized_test_registry() {
-    return parameterized_test_registry_;
-  }
-#endif  // GTEST_HAS_PARAM_TEST
-
-  // Sets the TestCase object for the test that's currently running.
-  void set_current_test_case(TestCase* current_test_case) {
-    current_test_case_ = current_test_case;
-  }
-
-  // Sets the TestInfo object for the test that's currently running.  If
-  // current_test_info is NULL, the assertion results will be stored in
-  // ad_hoc_test_result_.
-  void set_current_test_info(TestInfo* current_test_info) {
-    current_test_info_ = current_test_info;
-  }
-
-  // Registers all parameterized tests defined using TEST_P and
-  // INSTANTIATE_TEST_P, creating regular tests for each test/parameter
-  // combination. This method can be called more then once; it has
-  // guards protecting from registering the tests more then once.
-  // If value-parameterized tests are disabled, RegisterParameterizedTests
-  // is present but does nothing.
-  void RegisterParameterizedTests();
-
-  // Runs all tests in this UnitTest object, prints the result, and
-  // returns 0 if all tests are successful, or 1 otherwise.  If any
-  // exception is thrown during a test on Windows, this test is
-  // considered to be failed, but the rest of the tests will still be
-  // run.  (We disable exceptions on Linux and Mac OS X, so the issue
-  // doesn't apply there.)
-  int RunAllTests();
-
-  // Clears the results of all tests, including the ad hoc test.
-  void ClearResult() {
-    test_cases_.ForEach(TestCase::ClearTestCaseResult);
-    ad_hoc_test_result_.Clear();
-  }
-
-  enum ReactionToSharding {
-    HONOR_SHARDING_PROTOCOL,
-    IGNORE_SHARDING_PROTOCOL
-  };
-
-  // Matches the full name of each test against the user-specified
-  // filter to decide whether the test should run, then records the
-  // result in each TestCase and TestInfo object.
-  // If shard_tests == HONOR_SHARDING_PROTOCOL, further filters tests
-  // based on sharding variables in the environment.
-  // Returns the number of tests that should run.
-  int FilterTests(ReactionToSharding shard_tests);
-
-  // Prints the names of the tests matching the user-specified filter flag.
-  void ListTestsMatchingFilter();
-
-  const TestCase* current_test_case() const { return current_test_case_; }
-  TestInfo* current_test_info() { return current_test_info_; }
-  const TestInfo* current_test_info() const { return current_test_info_; }
-
-  // Returns the vector of environments that need to be set-up/torn-down
-  // before/after the tests are run.
-  internal::Vector<Environment*>* environments() { return &environments_; }
-  internal::Vector<Environment*>* environments_in_reverse_order() {
-    return &environments_in_reverse_order_;
-  }
-
-  // Getters for the per-thread Google Test trace stack.
-  internal::Vector<TraceInfo>* gtest_trace_stack() {
-    return gtest_trace_stack_.pointer();
-  }
-  const internal::Vector<TraceInfo>* gtest_trace_stack() const {
-    return gtest_trace_stack_.pointer();
-  }
-
-#if GTEST_HAS_DEATH_TEST
-  void InitDeathTestSubprocessControlInfo() {
-    internal_run_death_test_flag_.reset(ParseInternalRunDeathTestFlag());
-  }
-  // Returns a pointer to the parsed --gtest_internal_run_death_test
-  // flag, or NULL if that flag was not specified.
-  // This information is useful only in a death test child process.
-  // Must not be called before a call to InitGoogleTest.
-  const InternalRunDeathTestFlag* internal_run_death_test_flag() const {
-    return internal_run_death_test_flag_.get();
-  }
-
-  // Returns a pointer to the current death test factory.
-  internal::DeathTestFactory* death_test_factory() {
-    return death_test_factory_.get();
-  }
-
-  void SuppressTestEventsIfInSubprocess();
-
-  friend class ReplaceDeathTestFactory;
-#endif  // GTEST_HAS_DEATH_TEST
-
-  // Initializes the event listener performing XML output as specified by
-  // UnitTestOptions. Must not be called before InitGoogleTest.
-  void ConfigureXmlOutput();
-
-  // Performs initialization dependent upon flag values obtained in
-  // ParseGoogleTestFlagsOnly.  Is called from InitGoogleTest after the call to
-  // ParseGoogleTestFlagsOnly.  In case a user neglects to call InitGoogleTest
-  // this function is also called from RunAllTests.  Since this function can be
-  // called more than once, it has to be idempotent.
-  void PostFlagParsingInit();
-
-  // Gets the random seed used at the start of the current test iteration.
-  int random_seed() const { return random_seed_; }
-
-  // Gets the random number generator.
-  internal::Random* random() { return &random_; }
-
-  // Shuffles all test cases, and the tests within each test case,
-  // making sure that death tests are still run first.
-  void ShuffleTests();
-
-  // Restores the test cases and tests to their order before the first shuffle.
-  void UnshuffleTests();
-
- private:
-  friend class ::testing::UnitTest;
-
-  // The UnitTest object that owns this implementation object.
-  UnitTest* const parent_;
-
-  // The working directory when the first TEST() or TEST_F() was
-  // executed.
-  internal::FilePath original_working_dir_;
-
-  // The default test part result reporters.
-  DefaultGlobalTestPartResultReporter default_global_test_part_result_reporter_;
-  DefaultPerThreadTestPartResultReporter
-      default_per_thread_test_part_result_reporter_;
-
-  // Points to (but doesn't own) the global test part result reporter.
-  TestPartResultReporterInterface* global_test_part_result_repoter_;
-
-  // Protects read and write access to global_test_part_result_reporter_.
-  internal::Mutex global_test_part_result_reporter_mutex_;
-
-  // Points to (but doesn't own) the per-thread test part result reporter.
-  internal::ThreadLocal<TestPartResultReporterInterface*>
-      per_thread_test_part_result_reporter_;
-
-  // The vector of environments that need to be set-up/torn-down
-  // before/after the tests are run.  environments_in_reverse_order_
-  // simply mirrors environments_ in reverse order.
-  internal::Vector<Environment*> environments_;
-  internal::Vector<Environment*> environments_in_reverse_order_;
-
-  // The vector of TestCases in their original order.  It owns the
-  // elements in the vector.
-  internal::Vector<TestCase*> test_cases_;
-
-  // Provides a level of indirection for the test case list to allow
-  // easy shuffling and restoring the test case order.  The i-th
-  // element of this vector is the index of the i-th test case in the
-  // shuffled order.
-  internal::Vector<int> test_case_indices_;
-
-#if GTEST_HAS_PARAM_TEST
-  // ParameterizedTestRegistry object used to register value-parameterized
-  // tests.
-  internal::ParameterizedTestCaseRegistry parameterized_test_registry_;
-
-  // Indicates whether RegisterParameterizedTests() has been called already.
-  bool parameterized_tests_registered_;
-#endif  // GTEST_HAS_PARAM_TEST
-
-  // Index of the last death test case registered.  Initially -1.
-  int last_death_test_case_;
-
-  // This points to the TestCase for the currently running test.  It
-  // changes as Google Test goes through one test case after another.
-  // When no test is running, this is set to NULL and Google Test
-  // stores assertion results in ad_hoc_test_result_.  Initially NULL.
-  TestCase* current_test_case_;
-
-  // This points to the TestInfo for the currently running test.  It
-  // changes as Google Test goes through one test after another.  When
-  // no test is running, this is set to NULL and Google Test stores
-  // assertion results in ad_hoc_test_result_.  Initially NULL.
-  TestInfo* current_test_info_;
-
-  // Normally, a user only writes assertions inside a TEST or TEST_F,
-  // or inside a function called by a TEST or TEST_F.  Since Google
-  // Test keeps track of which test is current running, it can
-  // associate such an assertion with the test it belongs to.
-  //
-  // If an assertion is encountered when no TEST or TEST_F is running,
-  // Google Test attributes the assertion result to an imaginary "ad hoc"
-  // test, and records the result in ad_hoc_test_result_.
-  TestResult ad_hoc_test_result_;
-
-  // The list of event listeners that can be used to track events inside
-  // Google Test.
-  TestEventListeners listeners_;
-
-  // The OS stack trace getter.  Will be deleted when the UnitTest
-  // object is destructed.  By default, an OsStackTraceGetter is used,
-  // but the user can set this field to use a custom getter if that is
-  // desired.
-  OsStackTraceGetterInterface* os_stack_trace_getter_;
-
-  // True iff PostFlagParsingInit() has been called.
-  bool post_flag_parse_init_performed_;
-
-  // The random number seed used at the beginning of the test run.
-  int random_seed_;
-
-  // Our random number generator.
-  internal::Random random_;
-
-  // How long the test took to run, in milliseconds.
-  TimeInMillis elapsed_time_;
-
-#if GTEST_HAS_DEATH_TEST
-  // The decomposed components of the gtest_internal_run_death_test flag,
-  // parsed when RUN_ALL_TESTS is called.
-  internal::scoped_ptr<InternalRunDeathTestFlag> internal_run_death_test_flag_;
-  internal::scoped_ptr<internal::DeathTestFactory> death_test_factory_;
-#endif  // GTEST_HAS_DEATH_TEST
-
-  // A per-thread stack of traces created by the SCOPED_TRACE() macro.
-  internal::ThreadLocal<internal::Vector<TraceInfo> > gtest_trace_stack_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTestImpl);
-};  // class UnitTestImpl
-
-// Convenience function for accessing the global UnitTest
-// implementation object.
-inline UnitTestImpl* GetUnitTestImpl() {
-  return UnitTest::GetInstance()->impl();
-}
-
-// Internal helper functions for implementing the simple regular
-// expression matcher.
-bool IsInSet(char ch, const char* str);
-bool IsDigit(char ch);
-bool IsPunct(char ch);
-bool IsRepeat(char ch);
-bool IsWhiteSpace(char ch);
-bool IsWordChar(char ch);
-bool IsValidEscape(char ch);
-bool AtomMatchesChar(bool escaped, char pattern, char ch);
-bool ValidateRegex(const char* regex);
-bool MatchRegexAtHead(const char* regex, const char* str);
-bool MatchRepetitionAndRegexAtHead(
-    bool escaped, char ch, char repeat, const char* regex, const char* str);
-bool MatchRegexAnywhere(const char* regex, const char* str);
-
-// Parses the command line for Google Test flags, without initializing
-// other parts of Google Test.
-void ParseGoogleTestFlagsOnly(int* argc, char** argv);
-void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv);
-
-#if GTEST_HAS_DEATH_TEST
-
-// Returns the message describing the last system error, regardless of the
-// platform.
-String GetLastErrnoDescription();
-
-#if GTEST_OS_WINDOWS
-// Provides leak-safe Windows kernel handle ownership.
-class AutoHandle {
- public:
-  AutoHandle() : handle_(INVALID_HANDLE_VALUE) {}
-  explicit AutoHandle(HANDLE handle) : handle_(handle) {}
-
-  ~AutoHandle() { Reset(); }
-
-  HANDLE Get() const { return handle_; }
-  void Reset() { Reset(INVALID_HANDLE_VALUE); }
-  void Reset(HANDLE handle) {
-    if (handle != handle_) {
-      if (handle_ != INVALID_HANDLE_VALUE)
-        ::CloseHandle(handle_);
-      handle_ = handle;
-    }
-  }
-
- private:
-  HANDLE handle_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle);
-};
-#endif  // GTEST_OS_WINDOWS
-
-// Attempts to parse a string into a positive integer pointed to by the
-// number parameter.  Returns true if that is possible.
-// GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we can use
-// it here.
-template <typename Integer>
-bool ParseNaturalNumber(const ::std::string& str, Integer* number) {
-  // Fail fast if the given string does not begin with a digit;
-  // this bypasses strtoXXX's "optional leading whitespace and plus
-  // or minus sign" semantics, which are undesirable here.
-  if (str.empty() || !isdigit(str[0])) {
-    return false;
-  }
-  errno = 0;
-
-  char* end;
-  // BiggestConvertible is the largest integer type that system-provided
-  // string-to-number conversion routines can return.
-#if GTEST_OS_WINDOWS && !defined(__GNUC__)
-  // MSVC and C++ Builder define __int64 instead of the standard long long.
-  typedef unsigned __int64 BiggestConvertible;
-  const BiggestConvertible parsed = _strtoui64(str.c_str(), &end, 10);
-#else
-  typedef unsigned long long BiggestConvertible;  // NOLINT
-  const BiggestConvertible parsed = strtoull(str.c_str(), &end, 10);
-#endif  // GTEST_OS_WINDOWS && !defined(__GNUC__)
-  const bool parse_success = *end == '\0' && errno == 0;
-
-  // TODO(vladl@google.com): Convert this to compile time assertion when it is
-  // available.
-  GTEST_CHECK_(sizeof(Integer) <= sizeof(parsed));
-
-  const Integer result = static_cast<Integer>(parsed);
-  if (parse_success && static_cast<BiggestConvertible>(result) == parsed) {
-    *number = result;
-    return true;
-  }
-  return false;
-}
-#endif  // GTEST_HAS_DEATH_TEST
-
-// TestResult contains some private methods that should be hidden from
-// Google Test user but are required for testing. This class allow our tests
-// to access them.
-class TestResultAccessor {
- public:
-  static void RecordProperty(TestResult* test_result,
-                             const TestProperty& property) {
-    test_result->RecordProperty(property);
-  }
-
-  static void ClearTestPartResults(TestResult* test_result) {
-    test_result->ClearTestPartResults();
-  }
-
-  static const Vector<testing::TestPartResult>& test_part_results(
-      const TestResult& test_result) {
-    return test_result.test_part_results();
-  }
-};
-
-}  // namespace internal
-}  // namespace testing
-
-#endif  // GTEST_SRC_GTEST_INTERNAL_INL_H_
diff --git a/third_party/gtest/src/gtest-port.cc b/third_party/gtest/src/gtest-port.cc
deleted file mode 100644
index de169e2..0000000
--- a/third_party/gtest/src/gtest-port.cc
+++ /dev/null
@@ -1,680 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-#include <gtest/internal/gtest-port.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#if GTEST_OS_WINDOWS_MOBILE
-#include <windows.h>  // For TerminateProcess()
-#elif GTEST_OS_WINDOWS
-#include <io.h>
-#include <sys/stat.h>
-#else
-#include <unistd.h>
-#endif  // GTEST_OS_WINDOWS_MOBILE
-
-#if GTEST_OS_MAC
-#include <mach/mach_init.h>
-#include <mach/task.h>
-#include <mach/vm_map.h>
-#endif  // GTEST_OS_MAC
-
-#include <gtest/gtest-spi.h>
-#include <gtest/gtest-message.h>
-#include <gtest/internal/gtest-string.h>
-
-// Indicates that this translation unit is part of Google Test's
-// implementation.  It must come before gtest-internal-inl.h is
-// included, or there will be a compiler error.  This trick is to
-// prevent a user from accidentally including gtest-internal-inl.h in
-// his code.
-#define GTEST_IMPLEMENTATION_ 1
-#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION_
-
-namespace testing {
-namespace internal {
-
-#if defined(_MSC_VER) || defined(__BORLANDC__)
-// MSVC and C++Builder do not provide a definition of STDERR_FILENO.
-const int kStdErrFileno = 2;
-#else
-const int kStdErrFileno = STDERR_FILENO;
-#endif  // _MSC_VER
-
-#if GTEST_OS_MAC
-
-// Returns the number of threads running in the process, or 0 to indicate that
-// we cannot detect it.
-size_t GetThreadCount() {
-  const task_t task = mach_task_self();
-  mach_msg_type_number_t thread_count;
-  thread_act_array_t thread_list;
-  const kern_return_t status = task_threads(task, &thread_list, &thread_count);
-  if (status == KERN_SUCCESS) {
-    // task_threads allocates resources in thread_list and we need to free them
-    // to avoid leaks.
-    vm_deallocate(task,
-                  reinterpret_cast<vm_address_t>(thread_list),
-                  sizeof(thread_t) * thread_count);
-    return static_cast<size_t>(thread_count);
-  } else {
-    return 0;
-  }
-}
-
-#else
-
-size_t GetThreadCount() {
-  // There's no portable way to detect the number of threads, so we just
-  // return 0 to indicate that we cannot detect it.
-  return 0;
-}
-
-#endif  // GTEST_OS_MAC
-
-#if GTEST_USES_POSIX_RE
-
-// Implements RE.  Currently only needed for death tests.
-
-RE::~RE() {
-  regfree(&partial_regex_);
-  regfree(&full_regex_);
-  free(const_cast<char*>(pattern_));
-}
-
-// Returns true iff regular expression re matches the entire str.
-bool RE::FullMatch(const char* str, const RE& re) {
-  if (!re.is_valid_) return false;
-
-  regmatch_t match;
-  return regexec(&re.full_regex_, str, 1, &match, 0) == 0;
-}
-
-// Returns true iff regular expression re matches a substring of str
-// (including str itself).
-bool RE::PartialMatch(const char* str, const RE& re) {
-  if (!re.is_valid_) return false;
-
-  regmatch_t match;
-  return regexec(&re.partial_regex_, str, 1, &match, 0) == 0;
-}
-
-// Initializes an RE from its string representation.
-void RE::Init(const char* regex) {
-  pattern_ = posix::StrDup(regex);
-
-  // Reserves enough bytes to hold the regular expression used for a
-  // full match.
-  const size_t full_regex_len = strlen(regex) + 10;
-  char* const full_pattern = new char[full_regex_len];
-
-  snprintf(full_pattern, full_regex_len, "^(%s)$", regex);
-  is_valid_ = regcomp(&full_regex_, full_pattern, REG_EXTENDED) == 0;
-  // We want to call regcomp(&partial_regex_, ...) even if the
-  // previous expression returns false.  Otherwise partial_regex_ may
-  // not be properly initialized can may cause trouble when it's
-  // freed.
-  //
-  // Some implementation of POSIX regex (e.g. on at least some
-  // versions of Cygwin) doesn't accept the empty string as a valid
-  // regex.  We change it to an equivalent form "()" to be safe.
-  const char* const partial_regex = (*regex == '\0') ? "()" : regex;
-  is_valid_ = (regcomp(&partial_regex_, partial_regex, REG_EXTENDED) == 0)
-      && is_valid_;
-  EXPECT_TRUE(is_valid_)
-      << "Regular expression \"" << regex
-      << "\" is not a valid POSIX Extended regular expression.";
-
-  delete[] full_pattern;
-}
-
-#elif GTEST_USES_SIMPLE_RE
-
-// Returns true iff ch appears anywhere in str (excluding the
-// terminating '\0' character).
-bool IsInSet(char ch, const char* str) {
-  return ch != '\0' && strchr(str, ch) != NULL;
-}
-
-// Returns true iff ch belongs to the given classification.  Unlike
-// similar functions in <ctype.h>, these aren't affected by the
-// current locale.
-bool IsDigit(char ch) { return '0' <= ch && ch <= '9'; }
-bool IsPunct(char ch) {
-  return IsInSet(ch, "^-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~");
-}
-bool IsRepeat(char ch) { return IsInSet(ch, "?*+"); }
-bool IsWhiteSpace(char ch) { return IsInSet(ch, " \f\n\r\t\v"); }
-bool IsWordChar(char ch) {
-  return ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') ||
-      ('0' <= ch && ch <= '9') || ch == '_';
-}
-
-// Returns true iff "\\c" is a supported escape sequence.
-bool IsValidEscape(char c) {
-  return (IsPunct(c) || IsInSet(c, "dDfnrsStvwW"));
-}
-
-// Returns true iff the given atom (specified by escaped and pattern)
-// matches ch.  The result is undefined if the atom is invalid.
-bool AtomMatchesChar(bool escaped, char pattern_char, char ch) {
-  if (escaped) {  // "\\p" where p is pattern_char.
-    switch (pattern_char) {
-      case 'd': return IsDigit(ch);
-      case 'D': return !IsDigit(ch);
-      case 'f': return ch == '\f';
-      case 'n': return ch == '\n';
-      case 'r': return ch == '\r';
-      case 's': return IsWhiteSpace(ch);
-      case 'S': return !IsWhiteSpace(ch);
-      case 't': return ch == '\t';
-      case 'v': return ch == '\v';
-      case 'w': return IsWordChar(ch);
-      case 'W': return !IsWordChar(ch);
-    }
-    return IsPunct(pattern_char) && pattern_char == ch;
-  }
-
-  return (pattern_char == '.' && ch != '\n') || pattern_char == ch;
-}
-
-// Helper function used by ValidateRegex() to format error messages.
-String FormatRegexSyntaxError(const char* regex, int index) {
-  return (Message() << "Syntax error at index " << index
-          << " in simple regular expression \"" << regex << "\": ").GetString();
-}
-
-// Generates non-fatal failures and returns false if regex is invalid;
-// otherwise returns true.
-bool ValidateRegex(const char* regex) {
-  if (regex == NULL) {
-    // TODO(wan@google.com): fix the source file location in the
-    // assertion failures to match where the regex is used in user
-    // code.
-    ADD_FAILURE() << "NULL is not a valid simple regular expression.";
-    return false;
-  }
-
-  bool is_valid = true;
-
-  // True iff ?, *, or + can follow the previous atom.
-  bool prev_repeatable = false;
-  for (int i = 0; regex[i]; i++) {
-    if (regex[i] == '\\') {  // An escape sequence
-      i++;
-      if (regex[i] == '\0') {
-        ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1)
-                      << "'\\' cannot appear at the end.";
-        return false;
-      }
-
-      if (!IsValidEscape(regex[i])) {
-        ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1)
-                      << "invalid escape sequence \"\\" << regex[i] << "\".";
-        is_valid = false;
-      }
-      prev_repeatable = true;
-    } else {  // Not an escape sequence.
-      const char ch = regex[i];
-
-      if (ch == '^' && i > 0) {
-        ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
-                      << "'^' can only appear at the beginning.";
-        is_valid = false;
-      } else if (ch == '$' && regex[i + 1] != '\0') {
-        ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
-                      << "'$' can only appear at the end.";
-        is_valid = false;
-      } else if (IsInSet(ch, "()[]{}|")) {
-        ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
-                      << "'" << ch << "' is unsupported.";
-        is_valid = false;
-      } else if (IsRepeat(ch) && !prev_repeatable) {
-        ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
-                      << "'" << ch << "' can only follow a repeatable token.";
-        is_valid = false;
-      }
-
-      prev_repeatable = !IsInSet(ch, "^$?*+");
-    }
-  }
-
-  return is_valid;
-}
-
-// Matches a repeated regex atom followed by a valid simple regular
-// expression.  The regex atom is defined as c if escaped is false,
-// or \c otherwise.  repeat is the repetition meta character (?, *,
-// or +).  The behavior is undefined if str contains too many
-// characters to be indexable by size_t, in which case the test will
-// probably time out anyway.  We are fine with this limitation as
-// std::string has it too.
-bool MatchRepetitionAndRegexAtHead(
-    bool escaped, char c, char repeat, const char* regex,
-    const char* str) {
-  const size_t min_count = (repeat == '+') ? 1 : 0;
-  const size_t max_count = (repeat == '?') ? 1 :
-      static_cast<size_t>(-1) - 1;
-  // We cannot call numeric_limits::max() as it conflicts with the
-  // max() macro on Windows.
-
-  for (size_t i = 0; i <= max_count; ++i) {
-    // We know that the atom matches each of the first i characters in str.
-    if (i >= min_count && MatchRegexAtHead(regex, str + i)) {
-      // We have enough matches at the head, and the tail matches too.
-      // Since we only care about *whether* the pattern matches str
-      // (as opposed to *how* it matches), there is no need to find a
-      // greedy match.
-      return true;
-    }
-    if (str[i] == '\0' || !AtomMatchesChar(escaped, c, str[i]))
-      return false;
-  }
-  return false;
-}
-
-// Returns true iff regex matches a prefix of str.  regex must be a
-// valid simple regular expression and not start with "^", or the
-// result is undefined.
-bool MatchRegexAtHead(const char* regex, const char* str) {
-  if (*regex == '\0')  // An empty regex matches a prefix of anything.
-    return true;
-
-  // "$" only matches the end of a string.  Note that regex being
-  // valid guarantees that there's nothing after "$" in it.
-  if (*regex == '$')
-    return *str == '\0';
-
-  // Is the first thing in regex an escape sequence?
-  const bool escaped = *regex == '\\';
-  if (escaped)
-    ++regex;
-  if (IsRepeat(regex[1])) {
-    // MatchRepetitionAndRegexAtHead() calls MatchRegexAtHead(), so
-    // here's an indirect recursion.  It terminates as the regex gets
-    // shorter in each recursion.
-    return MatchRepetitionAndRegexAtHead(
-        escaped, regex[0], regex[1], regex + 2, str);
-  } else {
-    // regex isn't empty, isn't "$", and doesn't start with a
-    // repetition.  We match the first atom of regex with the first
-    // character of str and recurse.
-    return (*str != '\0') && AtomMatchesChar(escaped, *regex, *str) &&
-        MatchRegexAtHead(regex + 1, str + 1);
-  }
-}
-
-// Returns true iff regex matches any substring of str.  regex must be
-// a valid simple regular expression, or the result is undefined.
-//
-// The algorithm is recursive, but the recursion depth doesn't exceed
-// the regex length, so we won't need to worry about running out of
-// stack space normally.  In rare cases the time complexity can be
-// exponential with respect to the regex length + the string length,
-// but usually it's must faster (often close to linear).
-bool MatchRegexAnywhere(const char* regex, const char* str) {
-  if (regex == NULL || str == NULL)
-    return false;
-
-  if (*regex == '^')
-    return MatchRegexAtHead(regex + 1, str);
-
-  // A successful match can be anywhere in str.
-  do {
-    if (MatchRegexAtHead(regex, str))
-      return true;
-  } while (*str++ != '\0');
-  return false;
-}
-
-// Implements the RE class.
-
-RE::~RE() {
-  free(const_cast<char*>(pattern_));
-  free(const_cast<char*>(full_pattern_));
-}
-
-// Returns true iff regular expression re matches the entire str.
-bool RE::FullMatch(const char* str, const RE& re) {
-  return re.is_valid_ && MatchRegexAnywhere(re.full_pattern_, str);
-}
-
-// Returns true iff regular expression re matches a substring of str
-// (including str itself).
-bool RE::PartialMatch(const char* str, const RE& re) {
-  return re.is_valid_ && MatchRegexAnywhere(re.pattern_, str);
-}
-
-// Initializes an RE from its string representation.
-void RE::Init(const char* regex) {
-  pattern_ = full_pattern_ = NULL;
-  if (regex != NULL) {
-    pattern_ = posix::StrDup(regex);
-  }
-
-  is_valid_ = ValidateRegex(regex);
-  if (!is_valid_) {
-    // No need to calculate the full pattern when the regex is invalid.
-    return;
-  }
-
-  const size_t len = strlen(regex);
-  // Reserves enough bytes to hold the regular expression used for a
-  // full match: we need space to prepend a '^', append a '$', and
-  // terminate the string with '\0'.
-  char* buffer = static_cast<char*>(malloc(len + 3));
-  full_pattern_ = buffer;
-
-  if (*regex != '^')
-    *buffer++ = '^';  // Makes sure full_pattern_ starts with '^'.
-
-  // We don't use snprintf or strncpy, as they trigger a warning when
-  // compiled with VC++ 8.0.
-  memcpy(buffer, regex, len);
-  buffer += len;
-
-  if (len == 0 || regex[len - 1] != '$')
-    *buffer++ = '$';  // Makes sure full_pattern_ ends with '$'.
-
-  *buffer = '\0';
-}
-
-#endif  // GTEST_USES_POSIX_RE
-
-
-GTestLog::GTestLog(GTestLogSeverity severity, const char* file, int line)
-    : severity_(severity) {
-  const char* const marker =
-      severity == GTEST_INFO ?    "[  INFO ]" :
-      severity == GTEST_WARNING ? "[WARNING]" :
-      severity == GTEST_ERROR ?   "[ ERROR ]" : "[ FATAL ]";
-  GetStream() << ::std::endl << marker << " "
-              << FormatFileLocation(file, line).c_str() << ": ";
-}
-
-// Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.
-GTestLog::~GTestLog() {
-  GetStream() << ::std::endl;
-  if (severity_ == GTEST_FATAL) {
-    fflush(stderr);
-    posix::Abort();
-  }
-}
-// Disable Microsoft deprecation warnings for POSIX functions called from
-// this class (creat, dup, dup2, and close)
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable: 4996)
-#endif  // _MSC_VER
-
-// Defines the stderr capturer.
-
-class CapturedStderr {
- public:
-  // The ctor redirects stderr to a temporary file.
-  CapturedStderr() {
-#if GTEST_OS_WINDOWS_MOBILE
-    // Not supported on Windows CE.
-    posix::Abort();
-#else
-    uncaptured_fd_ = dup(kStdErrFileno);
-
-#if GTEST_OS_WINDOWS
-    char temp_dir_path[MAX_PATH + 1] = { '\0' };  // NOLINT
-    char temp_file_path[MAX_PATH + 1] = { '\0' };  // NOLINT
-
-    ::GetTempPathA(sizeof(temp_dir_path), temp_dir_path);
-    ::GetTempFileNameA(temp_dir_path, "gtest_redir", 0, temp_file_path);
-    const int captured_fd = creat(temp_file_path, _S_IREAD | _S_IWRITE);
-    filename_ = temp_file_path;
-#else
-    // There's no guarantee that a test has write access to the
-    // current directory, so we create the temporary file in the /tmp
-    // directory instead.
-    char name_template[] = "/tmp/captured_stderr.XXXXXX";
-    const int captured_fd = mkstemp(name_template);
-    filename_ = name_template;
-#endif  // GTEST_OS_WINDOWS
-    fflush(NULL);
-    dup2(captured_fd, kStdErrFileno);
-    close(captured_fd);
-#endif  // GTEST_OS_WINDOWS_MOBILE
-  }
-
-  ~CapturedStderr() {
-#if !GTEST_OS_WINDOWS_MOBILE
-    remove(filename_.c_str());
-#endif  // !GTEST_OS_WINDOWS_MOBILE
-  }
-
-  // Stops redirecting stderr.
-  void StopCapture() {
-#if !GTEST_OS_WINDOWS_MOBILE
-    // Restores the original stream.
-    fflush(NULL);
-    dup2(uncaptured_fd_, kStdErrFileno);
-    close(uncaptured_fd_);
-    uncaptured_fd_ = -1;
-#endif  // !GTEST_OS_WINDOWS_MOBILE
-  }
-
-  // Returns the name of the temporary file holding the stderr output.
-  // GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we
-  // can use it here.
-  ::std::string filename() const { return filename_; }
-
- private:
-  int uncaptured_fd_;
-  ::std::string filename_;
-};
-
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif  // _MSC_VER
-
-static CapturedStderr* g_captured_stderr = NULL;
-
-// Returns the size (in bytes) of a file.
-static size_t GetFileSize(FILE * file) {
-  fseek(file, 0, SEEK_END);
-  return static_cast<size_t>(ftell(file));
-}
-
-// Reads the entire content of a file as a string.
-static String ReadEntireFile(FILE * file) {
-  const size_t file_size = GetFileSize(file);
-  char* const buffer = new char[file_size];
-
-  size_t bytes_last_read = 0;  // # of bytes read in the last fread()
-  size_t bytes_read = 0;       // # of bytes read so far
-
-  fseek(file, 0, SEEK_SET);
-
-  // Keeps reading the file until we cannot read further or the
-  // pre-determined file size is reached.
-  do {
-    bytes_last_read = fread(buffer+bytes_read, 1, file_size-bytes_read, file);
-    bytes_read += bytes_last_read;
-  } while (bytes_last_read > 0 && bytes_read < file_size);
-
-  const String content(buffer, bytes_read);
-  delete[] buffer;
-
-  return content;
-}
-
-// Starts capturing stderr.
-void CaptureStderr() {
-  if (g_captured_stderr != NULL) {
-    GTEST_LOG_(FATAL) << "Only one stderr capturer can exist at one time.";
-  }
-  g_captured_stderr = new CapturedStderr;
-}
-
-// Stops capturing stderr and returns the captured string.
-// GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we can
-// use it here.
-String GetCapturedStderr() {
-  g_captured_stderr->StopCapture();
-
-  FILE* const file = posix::FOpen(g_captured_stderr->filename().c_str(), "r");
-  const String content = ReadEntireFile(file);
-  posix::FClose(file);
-
-  delete g_captured_stderr;
-  g_captured_stderr = NULL;
-
-  return content;
-}
-
-#if GTEST_HAS_DEATH_TEST
-
-// A copy of all command line arguments.  Set by InitGoogleTest().
-::std::vector<String> g_argvs;
-
-// Returns the command line as a vector of strings.
-const ::std::vector<String>& GetArgvs() { return g_argvs; }
-
-#endif  // GTEST_HAS_DEATH_TEST
-
-#if GTEST_OS_WINDOWS_MOBILE
-namespace posix {
-void Abort() {
-  DebugBreak();
-  TerminateProcess(GetCurrentProcess(), 1);
-}
-}  // namespace posix
-#endif  // GTEST_OS_WINDOWS_MOBILE
-
-// Returns the name of the environment variable corresponding to the
-// given flag.  For example, FlagToEnvVar("foo") will return
-// "GTEST_FOO" in the open-source version.
-static String FlagToEnvVar(const char* flag) {
-  const String full_flag =
-      (Message() << GTEST_FLAG_PREFIX_ << flag).GetString();
-
-  Message env_var;
-  for (size_t i = 0; i != full_flag.length(); i++) {
-    env_var << static_cast<char>(toupper(full_flag.c_str()[i]));
-  }
-
-  return env_var.GetString();
-}
-
-// Parses 'str' for a 32-bit signed integer.  If successful, writes
-// the result to *value and returns true; otherwise leaves *value
-// unchanged and returns false.
-bool ParseInt32(const Message& src_text, const char* str, Int32* value) {
-  // Parses the environment variable as a decimal integer.
-  char* end = NULL;
-  const long long_value = strtol(str, &end, 10);  // NOLINT
-
-  // Has strtol() consumed all characters in the string?
-  if (*end != '\0') {
-    // No - an invalid character was encountered.
-    Message msg;
-    msg << "WARNING: " << src_text
-        << " is expected to be a 32-bit integer, but actually"
-        << " has value \"" << str << "\".\n";
-    printf("%s", msg.GetString().c_str());
-    fflush(stdout);
-    return false;
-  }
-
-  // Is the parsed value in the range of an Int32?
-  const Int32 result = static_cast<Int32>(long_value);
-  if (long_value == LONG_MAX || long_value == LONG_MIN ||
-      // The parsed value overflows as a long.  (strtol() returns
-      // LONG_MAX or LONG_MIN when the input overflows.)
-      result != long_value
-      // The parsed value overflows as an Int32.
-      ) {
-    Message msg;
-    msg << "WARNING: " << src_text
-        << " is expected to be a 32-bit integer, but actually"
-        << " has value " << str << ", which overflows.\n";
-    printf("%s", msg.GetString().c_str());
-    fflush(stdout);
-    return false;
-  }
-
-  *value = result;
-  return true;
-}
-
-// Reads and returns the Boolean environment variable corresponding to
-// the given flag; if it's not set, returns default_value.
-//
-// The value is considered true iff it's not "0".
-bool BoolFromGTestEnv(const char* flag, bool default_value) {
-  const String env_var = FlagToEnvVar(flag);
-  const char* const string_value = posix::GetEnv(env_var.c_str());
-  return string_value == NULL ?
-      default_value : strcmp(string_value, "0") != 0;
-}
-
-// Reads and returns a 32-bit integer stored in the environment
-// variable corresponding to the given flag; if it isn't set or
-// doesn't represent a valid 32-bit integer, returns default_value.
-Int32 Int32FromGTestEnv(const char* flag, Int32 default_value) {
-  const String env_var = FlagToEnvVar(flag);
-  const char* const string_value = posix::GetEnv(env_var.c_str());
-  if (string_value == NULL) {
-    // The environment variable is not set.
-    return default_value;
-  }
-
-  Int32 result = default_value;
-  if (!ParseInt32(Message() << "Environment variable " << env_var,
-                  string_value, &result)) {
-    printf("The default value %s is used.\n",
-           (Message() << default_value).GetString().c_str());
-    fflush(stdout);
-    return default_value;
-  }
-
-  return result;
-}
-
-// Reads and returns the string environment variable corresponding to
-// the given flag; if it's not set, returns default_value.
-const char* StringFromGTestEnv(const char* flag, const char* default_value) {
-  const String env_var = FlagToEnvVar(flag);
-  const char* const value = posix::GetEnv(env_var.c_str());
-  return value == NULL ? default_value : value;
-}
-
-}  // namespace internal
-}  // namespace testing
diff --git a/third_party/gtest/src/gtest-test-part.cc b/third_party/gtest/src/gtest-test-part.cc
deleted file mode 100644
index 4f36df6..0000000
--- a/third_party/gtest/src/gtest-test-part.cc
+++ /dev/null
@@ -1,120 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: mheule@google.com (Markus Heule)
-//
-// The Google C++ Testing Framework (Google Test)
-
-#include <gtest/gtest-test-part.h>
-
-// Indicates that this translation unit is part of Google Test's
-// implementation.  It must come before gtest-internal-inl.h is
-// included, or there will be a compiler error.  This trick is to
-// prevent a user from accidentally including gtest-internal-inl.h in
-// his code.
-#define GTEST_IMPLEMENTATION_ 1
-#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION_
-
-namespace testing {
-
-using internal::GetUnitTestImpl;
-
-// Gets the summary of the failure message by omitting the stack trace
-// in it.
-internal::String TestPartResult::ExtractSummary(const char* message) {
-  const char* const stack_trace = strstr(message, internal::kStackTraceMarker);
-  return stack_trace == NULL ? internal::String(message) :
-      internal::String(message, stack_trace - message);
-}
-
-// Prints a TestPartResult object.
-std::ostream& operator<<(std::ostream& os, const TestPartResult& result) {
-  return os
-      << result.file_name() << ":" << result.line_number() << ": "
-      << (result.type() == TestPartResult::kSuccess ? "Success" :
-          result.type() == TestPartResult::kFatalFailure ? "Fatal failure" :
-          "Non-fatal failure") << ":\n"
-      << result.message() << std::endl;
-}
-
-// Constructs an empty TestPartResultArray.
-TestPartResultArray::TestPartResultArray()
-    : array_(new internal::Vector<TestPartResult>) {
-}
-
-// Destructs a TestPartResultArray.
-TestPartResultArray::~TestPartResultArray() {
-  delete array_;
-}
-
-// Appends a TestPartResult to the array.
-void TestPartResultArray::Append(const TestPartResult& result) {
-  array_->PushBack(result);
-}
-
-// Returns the TestPartResult at the given index (0-based).
-const TestPartResult& TestPartResultArray::GetTestPartResult(int index) const {
-  if (index < 0 || index >= size()) {
-    printf("\nInvalid index (%d) into TestPartResultArray.\n", index);
-    internal::posix::Abort();
-  }
-
-  return array_->GetElement(index);
-}
-
-// Returns the number of TestPartResult objects in the array.
-int TestPartResultArray::size() const {
-  return array_->size();
-}
-
-namespace internal {
-
-HasNewFatalFailureHelper::HasNewFatalFailureHelper()
-    : has_new_fatal_failure_(false),
-      original_reporter_(GetUnitTestImpl()->
-                         GetTestPartResultReporterForCurrentThread()) {
-  GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(this);
-}
-
-HasNewFatalFailureHelper::~HasNewFatalFailureHelper() {
-  GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(
-      original_reporter_);
-}
-
-void HasNewFatalFailureHelper::ReportTestPartResult(
-    const TestPartResult& result) {
-  if (result.fatally_failed())
-    has_new_fatal_failure_ = true;
-  original_reporter_->ReportTestPartResult(result);
-}
-
-}  // namespace internal
-
-}  // namespace testing
diff --git a/third_party/gtest/src/gtest-typed-test.cc b/third_party/gtest/src/gtest-typed-test.cc
deleted file mode 100644
index 4a0f657..0000000
--- a/third_party/gtest/src/gtest-typed-test.cc
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-#include <gtest/gtest-typed-test.h>
-#include <gtest/gtest.h>
-
-namespace testing {
-namespace internal {
-
-#if GTEST_HAS_TYPED_TEST_P
-
-// Verifies that registered_tests match the test names in
-// defined_test_names_; returns registered_tests if successful, or
-// aborts the program otherwise.
-const char* TypedTestCasePState::VerifyRegisteredTestNames(
-    const char* file, int line, const char* registered_tests) {
-  typedef ::std::set<const char*>::const_iterator DefinedTestIter;
-  registered_ = true;
-
-  Message errors;
-  ::std::set<String> tests;
-  for (const char* names = registered_tests; names != NULL;
-       names = SkipComma(names)) {
-    const String name = GetPrefixUntilComma(names);
-    if (tests.count(name) != 0) {
-      errors << "Test " << name << " is listed more than once.\n";
-      continue;
-    }
-
-    bool found = false;
-    for (DefinedTestIter it = defined_test_names_.begin();
-         it != defined_test_names_.end();
-         ++it) {
-      if (name == *it) {
-        found = true;
-        break;
-      }
-    }
-
-    if (found) {
-      tests.insert(name);
-    } else {
-      errors << "No test named " << name
-             << " can be found in this test case.\n";
-    }
-  }
-
-  for (DefinedTestIter it = defined_test_names_.begin();
-       it != defined_test_names_.end();
-       ++it) {
-    if (tests.count(*it) == 0) {
-      errors << "You forgot to list test " << *it << ".\n";
-    }
-  }
-
-  const String& errors_str = errors.GetString();
-  if (errors_str != "") {
-    fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(),
-            errors_str.c_str());
-    fflush(stderr);
-    posix::Abort();
-  }
-
-  return registered_tests;
-}
-
-#endif  // GTEST_HAS_TYPED_TEST_P
-
-}  // namespace internal
-}  // namespace testing
diff --git a/third_party/gtest/src/gtest.cc b/third_party/gtest/src/gtest.cc
deleted file mode 100644
index aa50b25..0000000
--- a/third_party/gtest/src/gtest.cc
+++ /dev/null
@@ -1,4705 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// The Google C++ Testing Framework (Google Test)
-
-#include <gtest/gtest.h>
-#include <gtest/gtest-spi.h>
-
-#include <ctype.h>
-#include <math.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include <ostream>
-
-#if GTEST_OS_LINUX
-
-// TODO(kenton@google.com): Use autoconf to detect availability of
-// gettimeofday().
-#define GTEST_HAS_GETTIMEOFDAY_ 1
-
-#include <fcntl.h>
-#include <limits.h>
-#include <sched.h>
-// Declares vsnprintf().  This header is not available on Windows.
-#include <strings.h>
-#include <sys/mman.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <string>
-#include <vector>
-
-#elif GTEST_OS_SYMBIAN
-#define GTEST_HAS_GETTIMEOFDAY_ 1
-#include <sys/time.h>  // NOLINT
-
-#elif GTEST_OS_ZOS
-#define GTEST_HAS_GETTIMEOFDAY_ 1
-#include <sys/time.h>  // NOLINT
-
-// On z/OS we additionally need strings.h for strcasecmp.
-#include <strings.h>  // NOLINT
-
-#elif GTEST_OS_WINDOWS_MOBILE  // We are on Windows CE.
-
-#include <windows.h>  // NOLINT
-
-#elif GTEST_OS_WINDOWS  // We are on Windows proper.
-
-#include <io.h>  // NOLINT
-#include <sys/timeb.h>  // NOLINT
-#include <sys/types.h>  // NOLINT
-#include <sys/stat.h>  // NOLINT
-
-#if GTEST_OS_WINDOWS_MINGW
-// MinGW has gettimeofday() but not _ftime64().
-// TODO(kenton@google.com): Use autoconf to detect availability of
-//   gettimeofday().
-// TODO(kenton@google.com): There are other ways to get the time on
-//   Windows, like GetTickCount() or GetSystemTimeAsFileTime().  MinGW
-//   supports these.  consider using them instead.
-#define GTEST_HAS_GETTIMEOFDAY_ 1
-#include <sys/time.h>  // NOLINT
-#endif  // GTEST_OS_WINDOWS_MINGW
-
-// cpplint thinks that the header is already included, so we want to
-// silence it.
-#include <windows.h>  // NOLINT
-
-#else
-
-// Assume other platforms have gettimeofday().
-// TODO(kenton@google.com): Use autoconf to detect availability of
-//   gettimeofday().
-#define GTEST_HAS_GETTIMEOFDAY_ 1
-
-// cpplint thinks that the header is already included, so we want to
-// silence it.
-#include <sys/time.h>  // NOLINT
-#include <unistd.h>  // NOLINT
-
-#endif  // GTEST_OS_LINUX
-
-#if GTEST_HAS_EXCEPTIONS
-#include <stdexcept>
-#endif
-
-// Indicates that this translation unit is part of Google Test's
-// implementation.  It must come before gtest-internal-inl.h is
-// included, or there will be a compiler error.  This trick is to
-// prevent a user from accidentally including gtest-internal-inl.h in
-// his code.
-#define GTEST_IMPLEMENTATION_ 1
-#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION_
-
-#if GTEST_OS_WINDOWS
-#define vsnprintf _vsnprintf
-#endif  // GTEST_OS_WINDOWS
-
-namespace testing {
-
-// Constants.
-
-// A test whose test case name or test name matches this filter is
-// disabled and not run.
-static const char kDisableTestFilter[] = "DISABLED_*:*/DISABLED_*";
-
-// A test case whose name matches this filter is considered a death
-// test case and will be run before test cases whose name doesn't
-// match this filter.
-static const char kDeathTestCaseFilter[] = "*DeathTest:*DeathTest/*";
-
-// A test filter that matches everything.
-static const char kUniversalFilter[] = "*";
-
-// The default output file for XML output.
-static const char kDefaultOutputFile[] = "test_detail.xml";
-
-// The environment variable name for the test shard index.
-static const char kTestShardIndex[] = "GTEST_SHARD_INDEX";
-// The environment variable name for the total number of test shards.
-static const char kTestTotalShards[] = "GTEST_TOTAL_SHARDS";
-// The environment variable name for the test shard status file.
-static const char kTestShardStatusFile[] = "GTEST_SHARD_STATUS_FILE";
-
-namespace internal {
-
-// The text used in failure messages to indicate the start of the
-// stack trace.
-const char kStackTraceMarker[] = "\nStack trace:\n";
-
-// g_help_flag is true iff the --help flag or an equivalent form is
-// specified on the command line.
-bool g_help_flag = false;
-
-}  // namespace internal
-
-GTEST_DEFINE_bool_(
-    also_run_disabled_tests,
-    internal::BoolFromGTestEnv("also_run_disabled_tests", false),
-    "Run disabled tests too, in addition to the tests normally being run.");
-
-GTEST_DEFINE_bool_(
-    break_on_failure,
-    internal::BoolFromGTestEnv("break_on_failure", false),
-    "True iff a failed assertion should be a debugger break-point.");
-
-GTEST_DEFINE_bool_(
-    catch_exceptions,
-    internal::BoolFromGTestEnv("catch_exceptions", false),
-    "True iff " GTEST_NAME_
-    " should catch exceptions and treat them as test failures.");
-
-GTEST_DEFINE_string_(
-    color,
-    internal::StringFromGTestEnv("color", "auto"),
-    "Whether to use colors in the output.  Valid values: yes, no, "
-    "and auto.  'auto' means to use colors if the output is "
-    "being sent to a terminal and the TERM environment variable "
-    "is set to xterm, xterm-color, xterm-256color, linux or cygwin.");
-
-GTEST_DEFINE_string_(
-    filter,
-    internal::StringFromGTestEnv("filter", kUniversalFilter),
-    "A colon-separated list of glob (not regex) patterns "
-    "for filtering the tests to run, optionally followed by a "
-    "'-' and a : separated list of negative patterns (tests to "
-    "exclude).  A test is run if it matches one of the positive "
-    "patterns and does not match any of the negative patterns.");
-
-GTEST_DEFINE_bool_(list_tests, false,
-                   "List all tests without running them.");
-
-GTEST_DEFINE_string_(
-    output,
-    internal::StringFromGTestEnv("output", ""),
-    "A format (currently must be \"xml\"), optionally followed "
-    "by a colon and an output file name or directory. A directory "
-    "is indicated by a trailing pathname separator. "
-    "Examples: \"xml:filename.xml\", \"xml::directoryname/\". "
-    "If a directory is specified, output files will be created "
-    "within that directory, with file-names based on the test "
-    "executable's name and, if necessary, made unique by adding "
-    "digits.");
-
-GTEST_DEFINE_bool_(
-    print_time,
-    internal::BoolFromGTestEnv("print_time", true),
-    "True iff " GTEST_NAME_
-    " should display elapsed time in text output.");
-
-GTEST_DEFINE_int32_(
-    random_seed,
-    internal::Int32FromGTestEnv("random_seed", 0),
-    "Random number seed to use when shuffling test orders.  Must be in range "
-    "[1, 99999], or 0 to use a seed based on the current time.");
-
-GTEST_DEFINE_int32_(
-    repeat,
-    internal::Int32FromGTestEnv("repeat", 1),
-    "How many times to repeat each test.  Specify a negative number "
-    "for repeating forever.  Useful for shaking out flaky tests.");
-
-GTEST_DEFINE_bool_(
-    show_internal_stack_frames, false,
-    "True iff " GTEST_NAME_ " should include internal stack frames when "
-    "printing test failure stack traces.");
-
-GTEST_DEFINE_bool_(
-    shuffle,
-    internal::BoolFromGTestEnv("shuffle", false),
-    "True iff " GTEST_NAME_
-    " should randomize tests' order on every run.");
-
-GTEST_DEFINE_int32_(
-    stack_trace_depth,
-    internal::Int32FromGTestEnv("stack_trace_depth", kMaxStackTraceDepth),
-    "The maximum number of stack frames to print when an "
-    "assertion fails.  The valid range is 0 through 100, inclusive.");
-
-GTEST_DEFINE_bool_(
-    throw_on_failure,
-    internal::BoolFromGTestEnv("throw_on_failure", false),
-    "When this flag is specified, a failed assertion will throw an exception "
-    "if exceptions are enabled or exit the program with a non-zero code "
-    "otherwise.");
-
-namespace internal {
-
-// Generates a random number from [0, range), using a Linear
-// Congruential Generator (LCG).  Crashes if 'range' is 0 or greater
-// than kMaxRange.
-UInt32 Random::Generate(UInt32 range) {
-  // These constants are the same as are used in glibc's rand(3).
-  state_ = (1103515245U*state_ + 12345U) % kMaxRange;
-
-  GTEST_CHECK_(range > 0)
-      << "Cannot generate a number in the range [0, 0).";
-  GTEST_CHECK_(range <= kMaxRange)
-      << "Generation of a number in [0, " << range << ") was requested, "
-      << "but this can only generate numbers in [0, " << kMaxRange << ").";
-
-  // Converting via modulus introduces a bit of downward bias, but
-  // it's simple, and a linear congruential generator isn't too good
-  // to begin with.
-  return state_ % range;
-}
-
-// GTestIsInitialized() returns true iff the user has initialized
-// Google Test.  Useful for catching the user mistake of not initializing
-// Google Test before calling RUN_ALL_TESTS().
-//
-// A user must call testing::InitGoogleTest() to initialize Google
-// Test.  g_init_gtest_count is set to the number of times
-// InitGoogleTest() has been called.  We don't protect this variable
-// under a mutex as it is only accessed in the main thread.
-int g_init_gtest_count = 0;
-static bool GTestIsInitialized() { return g_init_gtest_count != 0; }
-
-// Iterates over a vector of TestCases, keeping a running sum of the
-// results of calling a given int-returning method on each.
-// Returns the sum.
-static int SumOverTestCaseList(const internal::Vector<TestCase*>& case_list,
-                               int (TestCase::*method)() const) {
-  int sum = 0;
-  for (int i = 0; i < case_list.size(); i++) {
-    sum += (case_list.GetElement(i)->*method)();
-  }
-  return sum;
-}
-
-// Returns true iff the test case passed.
-static bool TestCasePassed(const TestCase* test_case) {
-  return test_case->should_run() && test_case->Passed();
-}
-
-// Returns true iff the test case failed.
-static bool TestCaseFailed(const TestCase* test_case) {
-  return test_case->should_run() && test_case->Failed();
-}
-
-// Returns true iff test_case contains at least one test that should
-// run.
-static bool ShouldRunTestCase(const TestCase* test_case) {
-  return test_case->should_run();
-}
-
-// AssertHelper constructor.
-AssertHelper::AssertHelper(TestPartResult::Type type,
-                           const char* file,
-                           int line,
-                           const char* message)
-    : data_(new AssertHelperData(type, file, line, message)) {
-}
-
-AssertHelper::~AssertHelper() {
-  delete data_;
-}
-
-// Message assignment, for assertion streaming support.
-void AssertHelper::operator=(const Message& message) const {
-  UnitTest::GetInstance()->
-    AddTestPartResult(data_->type, data_->file, data_->line,
-                      AppendUserMessage(data_->message, message),
-                      UnitTest::GetInstance()->impl()
-                      ->CurrentOsStackTraceExceptTop(1)
-                      // Skips the stack frame for this function itself.
-                      );  // NOLINT
-}
-
-// Mutex for linked pointers.
-Mutex g_linked_ptr_mutex(Mutex::NO_CONSTRUCTOR_NEEDED_FOR_STATIC_MUTEX);
-
-// Application pathname gotten in InitGoogleTest.
-String g_executable_path;
-
-// Returns the current application's name, removing directory path if that
-// is present.
-FilePath GetCurrentExecutableName() {
-  FilePath result;
-
-#if GTEST_OS_WINDOWS
-  result.Set(FilePath(g_executable_path).RemoveExtension("exe"));
-#else
-  result.Set(FilePath(g_executable_path));
-#endif  // GTEST_OS_WINDOWS
-
-  return result.RemoveDirectoryName();
-}
-
-// Functions for processing the gtest_output flag.
-
-// Returns the output format, or "" for normal printed output.
-String UnitTestOptions::GetOutputFormat() {
-  const char* const gtest_output_flag = GTEST_FLAG(output).c_str();
-  if (gtest_output_flag == NULL) return String("");
-
-  const char* const colon = strchr(gtest_output_flag, ':');
-  return (colon == NULL) ?
-      String(gtest_output_flag) :
-      String(gtest_output_flag, colon - gtest_output_flag);
-}
-
-// Returns the name of the requested output file, or the default if none
-// was explicitly specified.
-String UnitTestOptions::GetAbsolutePathToOutputFile() {
-  const char* const gtest_output_flag = GTEST_FLAG(output).c_str();
-  if (gtest_output_flag == NULL)
-    return String("");
-
-  const char* const colon = strchr(gtest_output_flag, ':');
-  if (colon == NULL)
-    return String(internal::FilePath::ConcatPaths(
-               internal::FilePath(
-                   UnitTest::GetInstance()->original_working_dir()),
-               internal::FilePath(kDefaultOutputFile)).ToString() );
-
-  internal::FilePath output_name(colon + 1);
-  if (!output_name.IsAbsolutePath())
-    // TODO(wan@google.com): on Windows \some\path is not an absolute
-    // path (as its meaning depends on the current drive), yet the
-    // following logic for turning it into an absolute path is wrong.
-    // Fix it.
-    output_name = internal::FilePath::ConcatPaths(
-        internal::FilePath(UnitTest::GetInstance()->original_working_dir()),
-        internal::FilePath(colon + 1));
-
-  if (!output_name.IsDirectory())
-    return output_name.ToString();
-
-  internal::FilePath result(internal::FilePath::GenerateUniqueFileName(
-      output_name, internal::GetCurrentExecutableName(),
-      GetOutputFormat().c_str()));
-  return result.ToString();
-}
-
-// Returns true iff the wildcard pattern matches the string.  The
-// first ':' or '\0' character in pattern marks the end of it.
-//
-// This recursive algorithm isn't very efficient, but is clear and
-// works well enough for matching test names, which are short.
-bool UnitTestOptions::PatternMatchesString(const char *pattern,
-                                           const char *str) {
-  switch (*pattern) {
-    case '\0':
-    case ':':  // Either ':' or '\0' marks the end of the pattern.
-      return *str == '\0';
-    case '?':  // Matches any single character.
-      return *str != '\0' && PatternMatchesString(pattern + 1, str + 1);
-    case '*':  // Matches any string (possibly empty) of characters.
-      return (*str != '\0' && PatternMatchesString(pattern, str + 1)) ||
-          PatternMatchesString(pattern + 1, str);
-    default:  // Non-special character.  Matches itself.
-      return *pattern == *str &&
-          PatternMatchesString(pattern + 1, str + 1);
-  }
-}
-
-bool UnitTestOptions::MatchesFilter(const String& name, const char* filter) {
-  const char *cur_pattern = filter;
-  for (;;) {
-    if (PatternMatchesString(cur_pattern, name.c_str())) {
-      return true;
-    }
-
-    // Finds the next pattern in the filter.
-    cur_pattern = strchr(cur_pattern, ':');
-
-    // Returns if no more pattern can be found.
-    if (cur_pattern == NULL) {
-      return false;
-    }
-
-    // Skips the pattern separater (the ':' character).
-    cur_pattern++;
-  }
-}
-
-// TODO(keithray): move String function implementations to gtest-string.cc.
-
-// Returns true iff the user-specified filter matches the test case
-// name and the test name.
-bool UnitTestOptions::FilterMatchesTest(const String &test_case_name,
-                                        const String &test_name) {
-  const String& full_name = String::Format("%s.%s",
-                                           test_case_name.c_str(),
-                                           test_name.c_str());
-
-  // Split --gtest_filter at '-', if there is one, to separate into
-  // positive filter and negative filter portions
-  const char* const p = GTEST_FLAG(filter).c_str();
-  const char* const dash = strchr(p, '-');
-  String positive;
-  String negative;
-  if (dash == NULL) {
-    positive = GTEST_FLAG(filter).c_str();  // Whole string is a positive filter
-    negative = String("");
-  } else {
-    positive = String(p, dash - p);  // Everything up to the dash
-    negative = String(dash+1);       // Everything after the dash
-    if (positive.empty()) {
-      // Treat '-test1' as the same as '*-test1'
-      positive = kUniversalFilter;
-    }
-  }
-
-  // A filter is a colon-separated list of patterns.  It matches a
-  // test if any pattern in it matches the test.
-  return (MatchesFilter(full_name, positive.c_str()) &&
-          !MatchesFilter(full_name, negative.c_str()));
-}
-
-#if GTEST_OS_WINDOWS
-// Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the
-// given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise.
-// This function is useful as an __except condition.
-int UnitTestOptions::GTestShouldProcessSEH(DWORD exception_code) {
-  // Google Test should handle an exception if:
-  //   1. the user wants it to, AND
-  //   2. this is not a breakpoint exception.
-  return (GTEST_FLAG(catch_exceptions) &&
-          exception_code != EXCEPTION_BREAKPOINT) ?
-      EXCEPTION_EXECUTE_HANDLER :
-      EXCEPTION_CONTINUE_SEARCH;
-}
-#endif  // GTEST_OS_WINDOWS
-
-}  // namespace internal
-
-// The c'tor sets this object as the test part result reporter used by
-// Google Test.  The 'result' parameter specifies where to report the
-// results. Intercepts only failures from the current thread.
-ScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter(
-    TestPartResultArray* result)
-    : intercept_mode_(INTERCEPT_ONLY_CURRENT_THREAD),
-      result_(result) {
-  Init();
-}
-
-// The c'tor sets this object as the test part result reporter used by
-// Google Test.  The 'result' parameter specifies where to report the
-// results.
-ScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter(
-    InterceptMode intercept_mode, TestPartResultArray* result)
-    : intercept_mode_(intercept_mode),
-      result_(result) {
-  Init();
-}
-
-void ScopedFakeTestPartResultReporter::Init() {
-  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
-  if (intercept_mode_ == INTERCEPT_ALL_THREADS) {
-    old_reporter_ = impl->GetGlobalTestPartResultReporter();
-    impl->SetGlobalTestPartResultReporter(this);
-  } else {
-    old_reporter_ = impl->GetTestPartResultReporterForCurrentThread();
-    impl->SetTestPartResultReporterForCurrentThread(this);
-  }
-}
-
-// The d'tor restores the test part result reporter used by Google Test
-// before.
-ScopedFakeTestPartResultReporter::~ScopedFakeTestPartResultReporter() {
-  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
-  if (intercept_mode_ == INTERCEPT_ALL_THREADS) {
-    impl->SetGlobalTestPartResultReporter(old_reporter_);
-  } else {
-    impl->SetTestPartResultReporterForCurrentThread(old_reporter_);
-  }
-}
-
-// Increments the test part result count and remembers the result.
-// This method is from the TestPartResultReporterInterface interface.
-void ScopedFakeTestPartResultReporter::ReportTestPartResult(
-    const TestPartResult& result) {
-  result_->Append(result);
-}
-
-namespace internal {
-
-// Returns the type ID of ::testing::Test.  We should always call this
-// instead of GetTypeId< ::testing::Test>() to get the type ID of
-// testing::Test.  This is to work around a suspected linker bug when
-// using Google Test as a framework on Mac OS X.  The bug causes
-// GetTypeId< ::testing::Test>() to return different values depending
-// on whether the call is from the Google Test framework itself or
-// from user test code.  GetTestTypeId() is guaranteed to always
-// return the same value, as it always calls GetTypeId<>() from the
-// gtest.cc, which is within the Google Test framework.
-TypeId GetTestTypeId() {
-  return GetTypeId<Test>();
-}
-
-// The value of GetTestTypeId() as seen from within the Google Test
-// library.  This is solely for testing GetTestTypeId().
-extern const TypeId kTestTypeIdInGoogleTest = GetTestTypeId();
-
-// This predicate-formatter checks that 'results' contains a test part
-// failure of the given type and that the failure message contains the
-// given substring.
-AssertionResult HasOneFailure(const char* /* results_expr */,
-                              const char* /* type_expr */,
-                              const char* /* substr_expr */,
-                              const TestPartResultArray& results,
-                              TestPartResult::Type type,
-                              const char* substr) {
-  const String expected(type == TestPartResult::kFatalFailure ?
-                        "1 fatal failure" :
-                        "1 non-fatal failure");
-  Message msg;
-  if (results.size() != 1) {
-    msg << "Expected: " << expected << "\n"
-        << "  Actual: " << results.size() << " failures";
-    for (int i = 0; i < results.size(); i++) {
-      msg << "\n" << results.GetTestPartResult(i);
-    }
-    return AssertionFailure(msg);
-  }
-
-  const TestPartResult& r = results.GetTestPartResult(0);
-  if (r.type() != type) {
-    msg << "Expected: " << expected << "\n"
-        << "  Actual:\n"
-        << r;
-    return AssertionFailure(msg);
-  }
-
-  if (strstr(r.message(), substr) == NULL) {
-    msg << "Expected: " << expected << " containing \""
-        << substr << "\"\n"
-        << "  Actual:\n"
-        << r;
-    return AssertionFailure(msg);
-  }
-
-  return AssertionSuccess();
-}
-
-// The constructor of SingleFailureChecker remembers where to look up
-// test part results, what type of failure we expect, and what
-// substring the failure message should contain.
-SingleFailureChecker:: SingleFailureChecker(
-    const TestPartResultArray* results,
-    TestPartResult::Type type,
-    const char* substr)
-    : results_(results),
-      type_(type),
-      substr_(substr) {}
-
-// The destructor of SingleFailureChecker verifies that the given
-// TestPartResultArray contains exactly one failure that has the given
-// type and contains the given substring.  If that's not the case, a
-// non-fatal failure will be generated.
-SingleFailureChecker::~SingleFailureChecker() {
-  EXPECT_PRED_FORMAT3(HasOneFailure, *results_, type_, substr_.c_str());
-}
-
-DefaultGlobalTestPartResultReporter::DefaultGlobalTestPartResultReporter(
-    UnitTestImpl* unit_test) : unit_test_(unit_test) {}
-
-void DefaultGlobalTestPartResultReporter::ReportTestPartResult(
-    const TestPartResult& result) {
-  unit_test_->current_test_result()->AddTestPartResult(result);
-  unit_test_->listeners()->repeater()->OnTestPartResult(result);
-}
-
-DefaultPerThreadTestPartResultReporter::DefaultPerThreadTestPartResultReporter(
-    UnitTestImpl* unit_test) : unit_test_(unit_test) {}
-
-void DefaultPerThreadTestPartResultReporter::ReportTestPartResult(
-    const TestPartResult& result) {
-  unit_test_->GetGlobalTestPartResultReporter()->ReportTestPartResult(result);
-}
-
-// Returns the global test part result reporter.
-TestPartResultReporterInterface*
-UnitTestImpl::GetGlobalTestPartResultReporter() {
-  internal::MutexLock lock(&global_test_part_result_reporter_mutex_);
-  return global_test_part_result_repoter_;
-}
-
-// Sets the global test part result reporter.
-void UnitTestImpl::SetGlobalTestPartResultReporter(
-    TestPartResultReporterInterface* reporter) {
-  internal::MutexLock lock(&global_test_part_result_reporter_mutex_);
-  global_test_part_result_repoter_ = reporter;
-}
-
-// Returns the test part result reporter for the current thread.
-TestPartResultReporterInterface*
-UnitTestImpl::GetTestPartResultReporterForCurrentThread() {
-  return per_thread_test_part_result_reporter_.get();
-}
-
-// Sets the test part result reporter for the current thread.
-void UnitTestImpl::SetTestPartResultReporterForCurrentThread(
-    TestPartResultReporterInterface* reporter) {
-  per_thread_test_part_result_reporter_.set(reporter);
-}
-
-// Gets the number of successful test cases.
-int UnitTestImpl::successful_test_case_count() const {
-  return test_cases_.CountIf(TestCasePassed);
-}
-
-// Gets the number of failed test cases.
-int UnitTestImpl::failed_test_case_count() const {
-  return test_cases_.CountIf(TestCaseFailed);
-}
-
-// Gets the number of all test cases.
-int UnitTestImpl::total_test_case_count() const {
-  return test_cases_.size();
-}
-
-// Gets the number of all test cases that contain at least one test
-// that should run.
-int UnitTestImpl::test_case_to_run_count() const {
-  return test_cases_.CountIf(ShouldRunTestCase);
-}
-
-// Gets the number of successful tests.
-int UnitTestImpl::successful_test_count() const {
-  return SumOverTestCaseList(test_cases_, &TestCase::successful_test_count);
-}
-
-// Gets the number of failed tests.
-int UnitTestImpl::failed_test_count() const {
-  return SumOverTestCaseList(test_cases_, &TestCase::failed_test_count);
-}
-
-// Gets the number of disabled tests.
-int UnitTestImpl::disabled_test_count() const {
-  return SumOverTestCaseList(test_cases_, &TestCase::disabled_test_count);
-}
-
-// Gets the number of all tests.
-int UnitTestImpl::total_test_count() const {
-  return SumOverTestCaseList(test_cases_, &TestCase::total_test_count);
-}
-
-// Gets the number of tests that should run.
-int UnitTestImpl::test_to_run_count() const {
-  return SumOverTestCaseList(test_cases_, &TestCase::test_to_run_count);
-}
-
-// Returns the current OS stack trace as a String.
-//
-// The maximum number of stack frames to be included is specified by
-// the gtest_stack_trace_depth flag.  The skip_count parameter
-// specifies the number of top frames to be skipped, which doesn't
-// count against the number of frames to be included.
-//
-// For example, if Foo() calls Bar(), which in turn calls
-// CurrentOsStackTraceExceptTop(1), Foo() will be included in the
-// trace but Bar() and CurrentOsStackTraceExceptTop() won't.
-String UnitTestImpl::CurrentOsStackTraceExceptTop(int skip_count) {
-  (void)skip_count;
-  return String("");
-}
-
-// Returns the current time in milliseconds.
-TimeInMillis GetTimeInMillis() {
-#if GTEST_OS_WINDOWS_MOBILE || defined(__BORLANDC__)
-  // Difference between 1970-01-01 and 1601-01-01 in milliseconds.
-  // http://analogous.blogspot.com/2005/04/epoch.html
-  const TimeInMillis kJavaEpochToWinFileTimeDelta =
-    static_cast<TimeInMillis>(116444736UL) * 100000UL;
-  const DWORD kTenthMicrosInMilliSecond = 10000;
-
-  SYSTEMTIME now_systime;
-  FILETIME now_filetime;
-  ULARGE_INTEGER now_int64;
-  // TODO(kenton@google.com): Shouldn't this just use
-  //   GetSystemTimeAsFileTime()?
-  GetSystemTime(&now_systime);
-  if (SystemTimeToFileTime(&now_systime, &now_filetime)) {
-    now_int64.LowPart = now_filetime.dwLowDateTime;
-    now_int64.HighPart = now_filetime.dwHighDateTime;
-    now_int64.QuadPart = (now_int64.QuadPart / kTenthMicrosInMilliSecond) -
-      kJavaEpochToWinFileTimeDelta;
-    return now_int64.QuadPart;
-  }
-  return 0;
-#elif GTEST_OS_WINDOWS && !GTEST_HAS_GETTIMEOFDAY_
-  __timeb64 now;
-#ifdef _MSC_VER
-  // MSVC 8 deprecates _ftime64(), so we want to suppress warning 4996
-  // (deprecated function) there.
-  // TODO(kenton@google.com): Use GetTickCount()?  Or use
-  //   SystemTimeToFileTime()
-#pragma warning(push)          // Saves the current warning state.
-#pragma warning(disable:4996)  // Temporarily disables warning 4996.
-  _ftime64(&now);
-#pragma warning(pop)           // Restores the warning state.
-#else
-  _ftime64(&now);
-#endif  // _MSC_VER
-  return static_cast<TimeInMillis>(now.time) * 1000 + now.millitm;
-#elif GTEST_HAS_GETTIMEOFDAY_
-  struct timeval now;
-  gettimeofday(&now, NULL);
-  return static_cast<TimeInMillis>(now.tv_sec) * 1000 + now.tv_usec / 1000;
-#else
-#error "Don't know how to get the current time on your system."
-#endif
-}
-
-// Utilities
-
-// class String
-
-// Returns the input enclosed in double quotes if it's not NULL;
-// otherwise returns "(null)".  For example, "\"Hello\"" is returned
-// for input "Hello".
-//
-// This is useful for printing a C string in the syntax of a literal.
-//
-// Known issue: escape sequences are not handled yet.
-String String::ShowCStringQuoted(const char* c_str) {
-  return c_str ? String::Format("\"%s\"", c_str) : String("(null)");
-}
-
-// Copies at most length characters from str into a newly-allocated
-// piece of memory of size length+1.  The memory is allocated with new[].
-// A terminating null byte is written to the memory, and a pointer to it
-// is returned.  If str is NULL, NULL is returned.
-static char* CloneString(const char* str, size_t length) {
-  if (str == NULL) {
-    return NULL;
-  } else {
-    char* const clone = new char[length + 1];
-    posix::StrNCpy(clone, str, length);
-    clone[length] = '\0';
-    return clone;
-  }
-}
-
-// Clones a 0-terminated C string, allocating memory using new.  The
-// caller is responsible for deleting[] the return value.  Returns the
-// cloned string, or NULL if the input is NULL.
-const char * String::CloneCString(const char* c_str) {
-  return (c_str == NULL) ?
-                    NULL : CloneString(c_str, strlen(c_str));
-}
-
-#if GTEST_OS_WINDOWS_MOBILE
-// Creates a UTF-16 wide string from the given ANSI string, allocating
-// memory using new. The caller is responsible for deleting the return
-// value using delete[]. Returns the wide string, or NULL if the
-// input is NULL.
-LPCWSTR String::AnsiToUtf16(const char* ansi) {
-  if (!ansi) return NULL;
-  const int length = strlen(ansi);
-  const int unicode_length =
-      MultiByteToWideChar(CP_ACP, 0, ansi, length,
-                          NULL, 0);
-  WCHAR* unicode = new WCHAR[unicode_length + 1];
-  MultiByteToWideChar(CP_ACP, 0, ansi, length,
-                      unicode, unicode_length);
-  unicode[unicode_length] = 0;
-  return unicode;
-}
-
-// Creates an ANSI string from the given wide string, allocating
-// memory using new. The caller is responsible for deleting the return
-// value using delete[]. Returns the ANSI string, or NULL if the
-// input is NULL.
-const char* String::Utf16ToAnsi(LPCWSTR utf16_str)  {
-  if (!utf16_str) return NULL;
-  const int ansi_length =
-      WideCharToMultiByte(CP_ACP, 0, utf16_str, -1,
-                          NULL, 0, NULL, NULL);
-  char* ansi = new char[ansi_length + 1];
-  WideCharToMultiByte(CP_ACP, 0, utf16_str, -1,
-                      ansi, ansi_length, NULL, NULL);
-  ansi[ansi_length] = 0;
-  return ansi;
-}
-
-#endif  // GTEST_OS_WINDOWS_MOBILE
-
-// Compares two C strings.  Returns true iff they have the same content.
-//
-// Unlike strcmp(), this function can handle NULL argument(s).  A NULL
-// C string is considered different to any non-NULL C string,
-// including the empty string.
-bool String::CStringEquals(const char * lhs, const char * rhs) {
-  if ( lhs == NULL ) return rhs == NULL;
-
-  if ( rhs == NULL ) return false;
-
-  return strcmp(lhs, rhs) == 0;
-}
-
-#if GTEST_HAS_STD_WSTRING || GTEST_HAS_GLOBAL_WSTRING
-
-// Converts an array of wide chars to a narrow string using the UTF-8
-// encoding, and streams the result to the given Message object.
-static void StreamWideCharsToMessage(const wchar_t* wstr, size_t length,
-                                     Message* msg) {
-  // TODO(wan): consider allowing a testing::String object to
-  // contain '\0'.  This will make it behave more like std::string,
-  // and will allow ToUtf8String() to return the correct encoding
-  // for '\0' s.t. we can get rid of the conditional here (and in
-  // several other places).
-  for (size_t i = 0; i != length; ) {  // NOLINT
-    if (wstr[i] != L'\0') {
-      *msg << WideStringToUtf8(wstr + i, static_cast<int>(length - i));
-      while (i != length && wstr[i] != L'\0')
-        i++;
-    } else {
-      *msg << '\0';
-      i++;
-    }
-  }
-}
-
-#endif  // GTEST_HAS_STD_WSTRING || GTEST_HAS_GLOBAL_WSTRING
-
-}  // namespace internal
-
-#if GTEST_HAS_STD_WSTRING
-// Converts the given wide string to a narrow string using the UTF-8
-// encoding, and streams the result to this Message object.
-Message& Message::operator <<(const ::std::wstring& wstr) {
-  internal::StreamWideCharsToMessage(wstr.c_str(), wstr.length(), this);
-  return *this;
-}
-#endif  // GTEST_HAS_STD_WSTRING
-
-#if GTEST_HAS_GLOBAL_WSTRING
-// Converts the given wide string to a narrow string using the UTF-8
-// encoding, and streams the result to this Message object.
-Message& Message::operator <<(const ::wstring& wstr) {
-  internal::StreamWideCharsToMessage(wstr.c_str(), wstr.length(), this);
-  return *this;
-}
-#endif  // GTEST_HAS_GLOBAL_WSTRING
-
-namespace internal {
-
-// Formats a value to be used in a failure message.
-
-// For a char value, we print it as a C++ char literal and as an
-// unsigned integer (both in decimal and in hexadecimal).
-String FormatForFailureMessage(char ch) {
-  const unsigned int ch_as_uint = ch;
-  // A String object cannot contain '\0', so we print "\\0" when ch is
-  // '\0'.
-  return String::Format("'%s' (%u, 0x%X)",
-                        ch ? String::Format("%c", ch).c_str() : "\\0",
-                        ch_as_uint, ch_as_uint);
-}
-
-// For a wchar_t value, we print it as a C++ wchar_t literal and as an
-// unsigned integer (both in decimal and in hexidecimal).
-String FormatForFailureMessage(wchar_t wchar) {
-  // The C++ standard doesn't specify the exact size of the wchar_t
-  // type.  It just says that it shall have the same size as another
-  // integral type, called its underlying type.
-  //
-  // Therefore, in order to print a wchar_t value in the numeric form,
-  // we first convert it to the largest integral type (UInt64) and
-  // then print the converted value.
-  //
-  // We use streaming to print the value as "%llu" doesn't work
-  // correctly with MSVC 7.1.
-  const UInt64 wchar_as_uint64 = wchar;
-  Message msg;
-  // A String object cannot contain '\0', so we print "\\0" when wchar is
-  // L'\0'.
-  char buffer[32];  // CodePointToUtf8 requires a buffer that big.
-  msg << "L'"
-      << (wchar ? CodePointToUtf8(static_cast<UInt32>(wchar), buffer) : "\\0")
-      << "' (" << wchar_as_uint64 << ", 0x" << ::std::setbase(16)
-      << wchar_as_uint64 << ")";
-  return msg.GetString();
-}
-
-}  // namespace internal
-
-// AssertionResult constructors.
-// Used in EXPECT_TRUE/FALSE(assertion_result).
-AssertionResult::AssertionResult(const AssertionResult& other)
-    : success_(other.success_),
-      message_(other.message_.get() != NULL ?
-               new internal::String(*other.message_) :
-               static_cast<internal::String*>(NULL)) {
-}
-
-// Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
-AssertionResult AssertionResult::operator!() const {
-  AssertionResult negation(!success_);
-  if (message_.get() != NULL)
-    negation << *message_;
-  return negation;
-}
-
-// Makes a successful assertion result.
-AssertionResult AssertionSuccess() {
-  return AssertionResult(true);
-}
-
-// Makes a failed assertion result.
-AssertionResult AssertionFailure() {
-  return AssertionResult(false);
-}
-
-// Makes a failed assertion result with the given failure message.
-// Deprecated; use AssertionFailure() << message.
-AssertionResult AssertionFailure(const Message& message) {
-  return AssertionFailure() << message;
-}
-
-namespace internal {
-
-// Constructs and returns the message for an equality assertion
-// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
-//
-// The first four parameters are the expressions used in the assertion
-// and their values, as strings.  For example, for ASSERT_EQ(foo, bar)
-// where foo is 5 and bar is 6, we have:
-//
-//   expected_expression: "foo"
-//   actual_expression:   "bar"
-//   expected_value:      "5"
-//   actual_value:        "6"
-//
-// The ignoring_case parameter is true iff the assertion is a
-// *_STRCASEEQ*.  When it's true, the string " (ignoring case)" will
-// be inserted into the message.
-AssertionResult EqFailure(const char* expected_expression,
-                          const char* actual_expression,
-                          const String& expected_value,
-                          const String& actual_value,
-                          bool ignoring_case) {
-  Message msg;
-  msg << "Value of: " << actual_expression;
-  if (actual_value != actual_expression) {
-    msg << "\n  Actual: " << actual_value;
-  }
-
-  msg << "\nExpected: " << expected_expression;
-  if (ignoring_case) {
-    msg << " (ignoring case)";
-  }
-  if (expected_value != expected_expression) {
-    msg << "\nWhich is: " << expected_value;
-  }
-
-  return AssertionFailure(msg);
-}
-
-// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
-String GetBoolAssertionFailureMessage(const AssertionResult& assertion_result,
-                                      const char* expression_text,
-                                      const char* actual_predicate_value,
-                                      const char* expected_predicate_value) {
-  const char* actual_message = assertion_result.message();
-  Message msg;
-  msg << "Value of: " << expression_text
-      << "\n  Actual: " << actual_predicate_value;
-  if (actual_message[0] != '\0')
-    msg << " (" << actual_message << ")";
-  msg << "\nExpected: " << expected_predicate_value;
-  return msg.GetString();
-}
-
-// Helper function for implementing ASSERT_NEAR.
-AssertionResult DoubleNearPredFormat(const char* expr1,
-                                     const char* expr2,
-                                     const char* abs_error_expr,
-                                     double val1,
-                                     double val2,
-                                     double abs_error) {
-  const double diff = fabs(val1 - val2);
-  if (diff <= abs_error) return AssertionSuccess();
-
-  // TODO(wan): do not print the value of an expression if it's
-  // already a literal.
-  Message msg;
-  msg << "The difference between " << expr1 << " and " << expr2
-      << " is " << diff << ", which exceeds " << abs_error_expr << ", where\n"
-      << expr1 << " evaluates to " << val1 << ",\n"
-      << expr2 << " evaluates to " << val2 << ", and\n"
-      << abs_error_expr << " evaluates to " << abs_error << ".";
-  return AssertionFailure(msg);
-}
-
-
-// Helper template for implementing FloatLE() and DoubleLE().
-template <typename RawType>
-AssertionResult FloatingPointLE(const char* expr1,
-                                const char* expr2,
-                                RawType val1,
-                                RawType val2) {
-  // Returns success if val1 is less than val2,
-  if (val1 < val2) {
-    return AssertionSuccess();
-  }
-
-  // or if val1 is almost equal to val2.
-  const FloatingPoint<RawType> lhs(val1), rhs(val2);
-  if (lhs.AlmostEquals(rhs)) {
-    return AssertionSuccess();
-  }
-
-  // Note that the above two checks will both fail if either val1 or
-  // val2 is NaN, as the IEEE floating-point standard requires that
-  // any predicate involving a NaN must return false.
-
-  StrStream val1_ss;
-  val1_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
-          << val1;
-
-  StrStream val2_ss;
-  val2_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
-          << val2;
-
-  Message msg;
-  msg << "Expected: (" << expr1 << ") <= (" << expr2 << ")\n"
-      << "  Actual: " << StrStreamToString(&val1_ss) << " vs "
-      << StrStreamToString(&val2_ss);
-
-  return AssertionFailure(msg);
-}
-
-}  // namespace internal
-
-// Asserts that val1 is less than, or almost equal to, val2.  Fails
-// otherwise.  In particular, it fails if either val1 or val2 is NaN.
-AssertionResult FloatLE(const char* expr1, const char* expr2,
-                        float val1, float val2) {
-  return internal::FloatingPointLE<float>(expr1, expr2, val1, val2);
-}
-
-// Asserts that val1 is less than, or almost equal to, val2.  Fails
-// otherwise.  In particular, it fails if either val1 or val2 is NaN.
-AssertionResult DoubleLE(const char* expr1, const char* expr2,
-                         double val1, double val2) {
-  return internal::FloatingPointLE<double>(expr1, expr2, val1, val2);
-}
-
-namespace internal {
-
-// The helper function for {ASSERT|EXPECT}_EQ with int or enum
-// arguments.
-AssertionResult CmpHelperEQ(const char* expected_expression,
-                            const char* actual_expression,
-                            BiggestInt expected,
-                            BiggestInt actual) {
-  if (expected == actual) {
-    return AssertionSuccess();
-  }
-
-  return EqFailure(expected_expression,
-                   actual_expression,
-                   FormatForComparisonFailureMessage(expected, actual),
-                   FormatForComparisonFailureMessage(actual, expected),
-                   false);
-}
-
-// A macro for implementing the helper functions needed to implement
-// ASSERT_?? and EXPECT_?? with integer or enum arguments.  It is here
-// just to avoid copy-and-paste of similar code.
-#define GTEST_IMPL_CMP_HELPER_(op_name, op)\
-AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
-                                   BiggestInt val1, BiggestInt val2) {\
-  if (val1 op val2) {\
-    return AssertionSuccess();\
-  } else {\
-    Message msg;\
-    msg << "Expected: (" << expr1 << ") " #op " (" << expr2\
-        << "), actual: " << FormatForComparisonFailureMessage(val1, val2)\
-        << " vs " << FormatForComparisonFailureMessage(val2, val1);\
-    return AssertionFailure(msg);\
-  }\
-}
-
-// Implements the helper function for {ASSERT|EXPECT}_NE with int or
-// enum arguments.
-GTEST_IMPL_CMP_HELPER_(NE, !=)
-// Implements the helper function for {ASSERT|EXPECT}_LE with int or
-// enum arguments.
-GTEST_IMPL_CMP_HELPER_(LE, <=)
-// Implements the helper function for {ASSERT|EXPECT}_LT with int or
-// enum arguments.
-GTEST_IMPL_CMP_HELPER_(LT, < )
-// Implements the helper function for {ASSERT|EXPECT}_GE with int or
-// enum arguments.
-GTEST_IMPL_CMP_HELPER_(GE, >=)
-// Implements the helper function for {ASSERT|EXPECT}_GT with int or
-// enum arguments.
-GTEST_IMPL_CMP_HELPER_(GT, > )
-
-#undef GTEST_IMPL_CMP_HELPER_
-
-// The helper function for {ASSERT|EXPECT}_STREQ.
-AssertionResult CmpHelperSTREQ(const char* expected_expression,
-                               const char* actual_expression,
-                               const char* expected,
-                               const char* actual) {
-  if (String::CStringEquals(expected, actual)) {
-    return AssertionSuccess();
-  }
-
-  return EqFailure(expected_expression,
-                   actual_expression,
-                   String::ShowCStringQuoted(expected),
-                   String::ShowCStringQuoted(actual),
-                   false);
-}
-
-// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
-AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
-                                   const char* actual_expression,
-                                   const char* expected,
-                                   const char* actual) {
-  if (String::CaseInsensitiveCStringEquals(expected, actual)) {
-    return AssertionSuccess();
-  }
-
-  return EqFailure(expected_expression,
-                   actual_expression,
-                   String::ShowCStringQuoted(expected),
-                   String::ShowCStringQuoted(actual),
-                   true);
-}
-
-// The helper function for {ASSERT|EXPECT}_STRNE.
-AssertionResult CmpHelperSTRNE(const char* s1_expression,
-                               const char* s2_expression,
-                               const char* s1,
-                               const char* s2) {
-  if (!String::CStringEquals(s1, s2)) {
-    return AssertionSuccess();
-  } else {
-    Message msg;
-    msg << "Expected: (" << s1_expression << ") != ("
-        << s2_expression << "), actual: \""
-        << s1 << "\" vs \"" << s2 << "\"";
-    return AssertionFailure(msg);
-  }
-}
-
-// The helper function for {ASSERT|EXPECT}_STRCASENE.
-AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
-                                   const char* s2_expression,
-                                   const char* s1,
-                                   const char* s2) {
-  if (!String::CaseInsensitiveCStringEquals(s1, s2)) {
-    return AssertionSuccess();
-  } else {
-    Message msg;
-    msg << "Expected: (" << s1_expression << ") != ("
-        << s2_expression << ") (ignoring case), actual: \""
-        << s1 << "\" vs \"" << s2 << "\"";
-    return AssertionFailure(msg);
-  }
-}
-
-}  // namespace internal
-
-namespace {
-
-// Helper functions for implementing IsSubString() and IsNotSubstring().
-
-// This group of overloaded functions return true iff needle is a
-// substring of haystack.  NULL is considered a substring of itself
-// only.
-
-bool IsSubstringPred(const char* needle, const char* haystack) {
-  if (needle == NULL || haystack == NULL)
-    return needle == haystack;
-
-  return strstr(haystack, needle) != NULL;
-}
-
-bool IsSubstringPred(const wchar_t* needle, const wchar_t* haystack) {
-  if (needle == NULL || haystack == NULL)
-    return needle == haystack;
-
-  return wcsstr(haystack, needle) != NULL;
-}
-
-// StringType here can be either ::std::string or ::std::wstring.
-template <typename StringType>
-bool IsSubstringPred(const StringType& needle,
-                     const StringType& haystack) {
-  return haystack.find(needle) != StringType::npos;
-}
-
-// This function implements either IsSubstring() or IsNotSubstring(),
-// depending on the value of the expected_to_be_substring parameter.
-// StringType here can be const char*, const wchar_t*, ::std::string,
-// or ::std::wstring.
-template <typename StringType>
-AssertionResult IsSubstringImpl(
-    bool expected_to_be_substring,
-    const char* needle_expr, const char* haystack_expr,
-    const StringType& needle, const StringType& haystack) {
-  if (IsSubstringPred(needle, haystack) == expected_to_be_substring)
-    return AssertionSuccess();
-
-  const bool is_wide_string = sizeof(needle[0]) > 1;
-  const char* const begin_string_quote = is_wide_string ? "L\"" : "\"";
-  return AssertionFailure(
-      Message()
-      << "Value of: " << needle_expr << "\n"
-      << "  Actual: " << begin_string_quote << needle << "\"\n"
-      << "Expected: " << (expected_to_be_substring ? "" : "not ")
-      << "a substring of " << haystack_expr << "\n"
-      << "Which is: " << begin_string_quote << haystack << "\"");
-}
-
-}  // namespace
-
-// IsSubstring() and IsNotSubstring() check whether needle is a
-// substring of haystack (NULL is considered a substring of itself
-// only), and return an appropriate error message when they fail.
-
-AssertionResult IsSubstring(
-    const char* needle_expr, const char* haystack_expr,
-    const char* needle, const char* haystack) {
-  return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsSubstring(
-    const char* needle_expr, const char* haystack_expr,
-    const wchar_t* needle, const wchar_t* haystack) {
-  return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsNotSubstring(
-    const char* needle_expr, const char* haystack_expr,
-    const char* needle, const char* haystack) {
-  return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsNotSubstring(
-    const char* needle_expr, const char* haystack_expr,
-    const wchar_t* needle, const wchar_t* haystack) {
-  return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
-}
-
-#if GTEST_HAS_STD_STRING
-AssertionResult IsSubstring(
-    const char* needle_expr, const char* haystack_expr,
-    const ::std::string& needle, const ::std::string& haystack) {
-  return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsNotSubstring(
-    const char* needle_expr, const char* haystack_expr,
-    const ::std::string& needle, const ::std::string& haystack) {
-  return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
-}
-#endif  // GTEST_HAS_STD_STRING
-
-#if GTEST_HAS_STD_WSTRING
-AssertionResult IsSubstring(
-    const char* needle_expr, const char* haystack_expr,
-    const ::std::wstring& needle, const ::std::wstring& haystack) {
-  return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsNotSubstring(
-    const char* needle_expr, const char* haystack_expr,
-    const ::std::wstring& needle, const ::std::wstring& haystack) {
-  return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
-}
-#endif  // GTEST_HAS_STD_WSTRING
-
-namespace internal {
-
-#if GTEST_OS_WINDOWS
-
-namespace {
-
-// Helper function for IsHRESULT{SuccessFailure} predicates
-AssertionResult HRESULTFailureHelper(const char* expr,
-                                     const char* expected,
-                                     long hr) {  // NOLINT
-#if GTEST_OS_WINDOWS_MOBILE
-  // Windows CE doesn't support FormatMessage.
-  const char error_text[] = "";
-#else
-  // Looks up the human-readable system message for the HRESULT code
-  // and since we're not passing any params to FormatMessage, we don't
-  // want inserts expanded.
-  const DWORD kFlags = FORMAT_MESSAGE_FROM_SYSTEM |
-                       FORMAT_MESSAGE_IGNORE_INSERTS;
-  const DWORD kBufSize = 4096;  // String::Format can't exceed this length.
-  // Gets the system's human readable message string for this HRESULT.
-  char error_text[kBufSize] = { '\0' };
-  DWORD message_length = ::FormatMessageA(kFlags,
-                                          0,  // no source, we're asking system
-                                          hr,  // the error
-                                          0,  // no line width restrictions
-                                          error_text,  // output buffer
-                                          kBufSize,  // buf size
-                                          NULL);  // no arguments for inserts
-  // Trims tailing white space (FormatMessage leaves a trailing cr-lf)
-  for (; message_length && isspace(error_text[message_length - 1]);
-          --message_length) {
-    error_text[message_length - 1] = '\0';
-  }
-#endif  // GTEST_OS_WINDOWS_MOBILE
-
-  const String error_hex(String::Format("0x%08X ", hr));
-  Message msg;
-  msg << "Expected: " << expr << " " << expected << ".\n"
-      << "  Actual: " << error_hex << error_text << "\n";
-
-  return ::testing::AssertionFailure(msg);
-}
-
-}  // namespace
-
-AssertionResult IsHRESULTSuccess(const char* expr, long hr) {  // NOLINT
-  if (SUCCEEDED(hr)) {
-    return AssertionSuccess();
-  }
-  return HRESULTFailureHelper(expr, "succeeds", hr);
-}
-
-AssertionResult IsHRESULTFailure(const char* expr, long hr) {  // NOLINT
-  if (FAILED(hr)) {
-    return AssertionSuccess();
-  }
-  return HRESULTFailureHelper(expr, "fails", hr);
-}
-
-#endif  // GTEST_OS_WINDOWS
-
-// Utility functions for encoding Unicode text (wide strings) in
-// UTF-8.
-
-// A Unicode code-point can have upto 21 bits, and is encoded in UTF-8
-// like this:
-//
-// Code-point length   Encoding
-//   0 -  7 bits       0xxxxxxx
-//   8 - 11 bits       110xxxxx 10xxxxxx
-//  12 - 16 bits       1110xxxx 10xxxxxx 10xxxxxx
-//  17 - 21 bits       11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
-
-// The maximum code-point a one-byte UTF-8 sequence can represent.
-const UInt32 kMaxCodePoint1 = (static_cast<UInt32>(1) <<  7) - 1;
-
-// The maximum code-point a two-byte UTF-8 sequence can represent.
-const UInt32 kMaxCodePoint2 = (static_cast<UInt32>(1) << (5 + 6)) - 1;
-
-// The maximum code-point a three-byte UTF-8 sequence can represent.
-const UInt32 kMaxCodePoint3 = (static_cast<UInt32>(1) << (4 + 2*6)) - 1;
-
-// The maximum code-point a four-byte UTF-8 sequence can represent.
-const UInt32 kMaxCodePoint4 = (static_cast<UInt32>(1) << (3 + 3*6)) - 1;
-
-// Chops off the n lowest bits from a bit pattern.  Returns the n
-// lowest bits.  As a side effect, the original bit pattern will be
-// shifted to the right by n bits.
-inline UInt32 ChopLowBits(UInt32* bits, int n) {
-  const UInt32 low_bits = *bits & ((static_cast<UInt32>(1) << n) - 1);
-  *bits >>= n;
-  return low_bits;
-}
-
-// Converts a Unicode code point to a narrow string in UTF-8 encoding.
-// code_point parameter is of type UInt32 because wchar_t may not be
-// wide enough to contain a code point.
-// The output buffer str must containt at least 32 characters.
-// The function returns the address of the output buffer.
-// If the code_point is not a valid Unicode code point
-// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be output
-// as '(Invalid Unicode 0xXXXXXXXX)'.
-char* CodePointToUtf8(UInt32 code_point, char* str) {
-  if (code_point <= kMaxCodePoint1) {
-    str[1] = '\0';
-    str[0] = static_cast<char>(code_point);                          // 0xxxxxxx
-  } else if (code_point <= kMaxCodePoint2) {
-    str[2] = '\0';
-    str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
-    str[0] = static_cast<char>(0xC0 | code_point);                   // 110xxxxx
-  } else if (code_point <= kMaxCodePoint3) {
-    str[3] = '\0';
-    str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
-    str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
-    str[0] = static_cast<char>(0xE0 | code_point);                   // 1110xxxx
-  } else if (code_point <= kMaxCodePoint4) {
-    str[4] = '\0';
-    str[3] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
-    str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
-    str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
-    str[0] = static_cast<char>(0xF0 | code_point);                   // 11110xxx
-  } else {
-    // The longest string String::Format can produce when invoked
-    // with these parameters is 28 character long (not including
-    // the terminating nul character). We are asking for 32 character
-    // buffer just in case. This is also enough for strncpy to
-    // null-terminate the destination string.
-    posix::StrNCpy(
-        str, String::Format("(Invalid Unicode 0x%X)", code_point).c_str(), 32);
-    str[31] = '\0';  // Makes sure no change in the format to strncpy leaves
-                     // the result unterminated.
-  }
-  return str;
-}
-
-// The following two functions only make sense if the the system
-// uses UTF-16 for wide string encoding. All supported systems
-// with 16 bit wchar_t (Windows, Cygwin, Symbian OS) do use UTF-16.
-
-// Determines if the arguments constitute UTF-16 surrogate pair
-// and thus should be combined into a single Unicode code point
-// using CreateCodePointFromUtf16SurrogatePair.
-inline bool IsUtf16SurrogatePair(wchar_t first, wchar_t second) {
-  return sizeof(wchar_t) == 2 &&
-      (first & 0xFC00) == 0xD800 && (second & 0xFC00) == 0xDC00;
-}
-
-// Creates a Unicode code point from UTF16 surrogate pair.
-inline UInt32 CreateCodePointFromUtf16SurrogatePair(wchar_t first,
-                                                    wchar_t second) {
-  const UInt32 mask = (1 << 10) - 1;
-  return (sizeof(wchar_t) == 2) ?
-      (((first & mask) << 10) | (second & mask)) + 0x10000 :
-      // This function should not be called when the condition is
-      // false, but we provide a sensible default in case it is.
-      static_cast<UInt32>(first);
-}
-
-// Converts a wide string to a narrow string in UTF-8 encoding.
-// The wide string is assumed to have the following encoding:
-//   UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin, Symbian OS)
-//   UTF-32 if sizeof(wchar_t) == 4 (on Linux)
-// Parameter str points to a null-terminated wide string.
-// Parameter num_chars may additionally limit the number
-// of wchar_t characters processed. -1 is used when the entire string
-// should be processed.
-// If the string contains code points that are not valid Unicode code points
-// (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output
-// as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding
-// and contains invalid UTF-16 surrogate pairs, values in those pairs
-// will be encoded as individual Unicode characters from Basic Normal Plane.
-String WideStringToUtf8(const wchar_t* str, int num_chars) {
-  if (num_chars == -1)
-    num_chars = static_cast<int>(wcslen(str));
-
-  StrStream stream;
-  for (int i = 0; i < num_chars; ++i) {
-    UInt32 unicode_code_point;
-
-    if (str[i] == L'\0') {
-      break;
-    } else if (i + 1 < num_chars && IsUtf16SurrogatePair(str[i], str[i + 1])) {
-      unicode_code_point = CreateCodePointFromUtf16SurrogatePair(str[i],
-                                                                 str[i + 1]);
-      i++;
-    } else {
-      unicode_code_point = static_cast<UInt32>(str[i]);
-    }
-
-    char buffer[32];  // CodePointToUtf8 requires a buffer this big.
-    stream << CodePointToUtf8(unicode_code_point, buffer);
-  }
-  return StrStreamToString(&stream);
-}
-
-// Converts a wide C string to a String using the UTF-8 encoding.
-// NULL will be converted to "(null)".
-String String::ShowWideCString(const wchar_t * wide_c_str) {
-  if (wide_c_str == NULL) return String("(null)");
-
-  return String(internal::WideStringToUtf8(wide_c_str, -1).c_str());
-}
-
-// Similar to ShowWideCString(), except that this function encloses
-// the converted string in double quotes.
-String String::ShowWideCStringQuoted(const wchar_t* wide_c_str) {
-  if (wide_c_str == NULL) return String("(null)");
-
-  return String::Format("L\"%s\"",
-                        String::ShowWideCString(wide_c_str).c_str());
-}
-
-// Compares two wide C strings.  Returns true iff they have the same
-// content.
-//
-// Unlike wcscmp(), this function can handle NULL argument(s).  A NULL
-// C string is considered different to any non-NULL C string,
-// including the empty string.
-bool String::WideCStringEquals(const wchar_t * lhs, const wchar_t * rhs) {
-  if (lhs == NULL) return rhs == NULL;
-
-  if (rhs == NULL) return false;
-
-  return wcscmp(lhs, rhs) == 0;
-}
-
-// Helper function for *_STREQ on wide strings.
-AssertionResult CmpHelperSTREQ(const char* expected_expression,
-                               const char* actual_expression,
-                               const wchar_t* expected,
-                               const wchar_t* actual) {
-  if (String::WideCStringEquals(expected, actual)) {
-    return AssertionSuccess();
-  }
-
-  return EqFailure(expected_expression,
-                   actual_expression,
-                   String::ShowWideCStringQuoted(expected),
-                   String::ShowWideCStringQuoted(actual),
-                   false);
-}
-
-// Helper function for *_STRNE on wide strings.
-AssertionResult CmpHelperSTRNE(const char* s1_expression,
-                               const char* s2_expression,
-                               const wchar_t* s1,
-                               const wchar_t* s2) {
-  if (!String::WideCStringEquals(s1, s2)) {
-    return AssertionSuccess();
-  }
-
-  Message msg;
-  msg << "Expected: (" << s1_expression << ") != ("
-      << s2_expression << "), actual: "
-      << String::ShowWideCStringQuoted(s1)
-      << " vs " << String::ShowWideCStringQuoted(s2);
-  return AssertionFailure(msg);
-}
-
-// Compares two C strings, ignoring case.  Returns true iff they have
-// the same content.
-//
-// Unlike strcasecmp(), this function can handle NULL argument(s).  A
-// NULL C string is considered different to any non-NULL C string,
-// including the empty string.
-bool String::CaseInsensitiveCStringEquals(const char * lhs, const char * rhs) {
-  if (lhs == NULL)
-    return rhs == NULL;
-  if (rhs == NULL)
-    return false;
-  return posix::StrCaseCmp(lhs, rhs) == 0;
-}
-
-  // Compares two wide C strings, ignoring case.  Returns true iff they
-  // have the same content.
-  //
-  // Unlike wcscasecmp(), this function can handle NULL argument(s).
-  // A NULL C string is considered different to any non-NULL wide C string,
-  // including the empty string.
-  // NB: The implementations on different platforms slightly differ.
-  // On windows, this method uses _wcsicmp which compares according to LC_CTYPE
-  // environment variable. On GNU platform this method uses wcscasecmp
-  // which compares according to LC_CTYPE category of the current locale.
-  // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
-  // current locale.
-bool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
-                                              const wchar_t* rhs) {
-  if ( lhs == NULL ) return rhs == NULL;
-
-  if ( rhs == NULL ) return false;
-
-#if GTEST_OS_WINDOWS
-  return _wcsicmp(lhs, rhs) == 0;
-#elif GTEST_OS_LINUX
-  return wcscasecmp(lhs, rhs) == 0;
-#else
-  // Mac OS X and Cygwin don't define wcscasecmp.  Other unknown OSes
-  // may not define it either.
-  wint_t left, right;
-  do {
-    left = towlower(*lhs++);
-    right = towlower(*rhs++);
-  } while (left && left == right);
-  return left == right;
-#endif  // OS selector
-}
-
-// Compares this with another String.
-// Returns < 0 if this is less than rhs, 0 if this is equal to rhs, or > 0
-// if this is greater than rhs.
-int String::Compare(const String & rhs) const {
-  const char* const lhs_c_str = c_str();
-  const char* const rhs_c_str = rhs.c_str();
-
-  if (lhs_c_str == NULL) {
-    return rhs_c_str == NULL ? 0 : -1;  // NULL < anything except NULL
-  } else if (rhs_c_str == NULL) {
-    return 1;
-  }
-
-  const size_t shorter_str_len =
-      length() <= rhs.length() ? length() : rhs.length();
-  for (size_t i = 0; i != shorter_str_len; i++) {
-    if (lhs_c_str[i] < rhs_c_str[i]) {
-      return -1;
-    } else if (lhs_c_str[i] > rhs_c_str[i]) {
-      return 1;
-    }
-  }
-  return (length() < rhs.length()) ? -1 :
-      (length() > rhs.length()) ? 1 : 0;
-}
-
-// Returns true iff this String ends with the given suffix.  *Any*
-// String is considered to end with a NULL or empty suffix.
-bool String::EndsWith(const char* suffix) const {
-  if (suffix == NULL || CStringEquals(suffix, "")) return true;
-
-  if (c_str() == NULL) return false;
-
-  const size_t this_len = strlen(c_str());
-  const size_t suffix_len = strlen(suffix);
-  return (this_len >= suffix_len) &&
-         CStringEquals(c_str() + this_len - suffix_len, suffix);
-}
-
-// Returns true iff this String ends with the given suffix, ignoring case.
-// Any String is considered to end with a NULL or empty suffix.
-bool String::EndsWithCaseInsensitive(const char* suffix) const {
-  if (suffix == NULL || CStringEquals(suffix, "")) return true;
-
-  if (c_str() == NULL) return false;
-
-  const size_t this_len = strlen(c_str());
-  const size_t suffix_len = strlen(suffix);
-  return (this_len >= suffix_len) &&
-         CaseInsensitiveCStringEquals(c_str() + this_len - suffix_len, suffix);
-}
-
-// Formats a list of arguments to a String, using the same format
-// spec string as for printf.
-//
-// We do not use the StringPrintf class as it is not universally
-// available.
-//
-// The result is limited to 4096 characters (including the tailing 0).
-// If 4096 characters are not enough to format the input, or if
-// there's an error, "<formatting error or buffer exceeded>" is
-// returned.
-String String::Format(const char * format, ...) {
-  va_list args;
-  va_start(args, format);
-
-  char buffer[4096];
-  const int kBufferSize = sizeof(buffer)/sizeof(buffer[0]);
-
-  // MSVC 8 deprecates vsnprintf(), so we want to suppress warning
-  // 4996 (deprecated function) there.
-#ifdef _MSC_VER  // We are using MSVC.
-#pragma warning(push)          // Saves the current warning state.
-#pragma warning(disable:4996)  // Temporarily disables warning 4996.
-  const int size = vsnprintf(buffer, kBufferSize, format, args);
-#pragma warning(pop)           // Restores the warning state.
-#else  // We are not using MSVC.
-  const int size = vsnprintf(buffer, kBufferSize, format, args);
-#endif  // _MSC_VER
-  va_end(args);
-
-  // vsnprintf()'s behavior is not portable.  When the buffer is not
-  // big enough, it returns a negative value in MSVC, and returns the
-  // needed buffer size on Linux.  When there is an output error, it
-  // always returns a negative value.  For simplicity, we lump the two
-  // error cases together.
-  if (size < 0 || size >= kBufferSize) {
-    return String("<formatting error or buffer exceeded>");
-  } else {
-    return String(buffer, size);
-  }
-}
-
-// Converts the buffer in a StrStream to a String, converting NUL
-// bytes to "\\0" along the way.
-String StrStreamToString(StrStream* ss) {
-#if GTEST_HAS_STD_STRING
-  const ::std::string& str = ss->str();
-  const char* const start = str.c_str();
-  const char* const end = start + str.length();
-#else
-  const char* const start = ss->str();
-  const char* const end = start + ss->pcount();
-#endif  // GTEST_HAS_STD_STRING
-
-  // We need to use a helper StrStream to do this transformation
-  // because String doesn't support push_back().
-  StrStream helper;
-  for (const char* ch = start; ch != end; ++ch) {
-    if (*ch == '\0') {
-      helper << "\\0";  // Replaces NUL with "\\0";
-    } else {
-      helper.put(*ch);
-    }
-  }
-
-#if GTEST_HAS_STD_STRING
-  return String(helper.str().c_str());
-#else
-  const String str(helper.str(), helper.pcount());
-  helper.freeze(false);
-  ss->freeze(false);
-  return str;
-#endif  // GTEST_HAS_STD_STRING
-}
-
-// Appends the user-supplied message to the Google-Test-generated message.
-String AppendUserMessage(const String& gtest_msg,
-                         const Message& user_msg) {
-  // Appends the user message if it's non-empty.
-  const String user_msg_string = user_msg.GetString();
-  if (user_msg_string.empty()) {
-    return gtest_msg;
-  }
-
-  Message msg;
-  msg << gtest_msg << "\n" << user_msg_string;
-
-  return msg.GetString();
-}
-
-}  // namespace internal
-
-// class TestResult
-
-// Creates an empty TestResult.
-TestResult::TestResult()
-    : test_part_results_(new internal::Vector<TestPartResult>),
-      test_properties_(new internal::Vector<TestProperty>),
-      death_test_count_(0),
-      elapsed_time_(0) {
-}
-
-// D'tor.
-TestResult::~TestResult() {
-}
-
-// Returns the i-th test part result among all the results. i can
-// range from 0 to total_part_count() - 1. If i is not in that range,
-// aborts the program.
-const TestPartResult& TestResult::GetTestPartResult(int i) const {
-  return test_part_results_->GetElement(i);
-}
-
-// Returns the i-th test property. i can range from 0 to
-// test_property_count() - 1. If i is not in that range, aborts the
-// program.
-const TestProperty& TestResult::GetTestProperty(int i) const {
-  return test_properties_->GetElement(i);
-}
-
-// Clears the test part results.
-void TestResult::ClearTestPartResults() {
-  test_part_results_->Clear();
-}
-
-// Adds a test part result to the list.
-void TestResult::AddTestPartResult(const TestPartResult& test_part_result) {
-  test_part_results_->PushBack(test_part_result);
-}
-
-// Adds a test property to the list. If a property with the same key as the
-// supplied property is already represented, the value of this test_property
-// replaces the old value for that key.
-void TestResult::RecordProperty(const TestProperty& test_property) {
-  if (!ValidateTestProperty(test_property)) {
-    return;
-  }
-  internal::MutexLock lock(&test_properites_mutex_);
-  TestProperty* const property_with_matching_key =
-      test_properties_->FindIf(
-          internal::TestPropertyKeyIs(test_property.key()));
-  if (property_with_matching_key == NULL) {
-    test_properties_->PushBack(test_property);
-    return;
-  }
-  property_with_matching_key->SetValue(test_property.value());
-}
-
-// Adds a failure if the key is a reserved attribute of Google Test
-// testcase tags.  Returns true if the property is valid.
-bool TestResult::ValidateTestProperty(const TestProperty& test_property) {
-  internal::String key(test_property.key());
-  if (key == "name" || key == "status" || key == "time" || key == "classname") {
-    ADD_FAILURE()
-        << "Reserved key used in RecordProperty(): "
-        << key
-        << " ('name', 'status', 'time', and 'classname' are reserved by "
-        << GTEST_NAME_ << ")";
-    return false;
-  }
-  return true;
-}
-
-// Clears the object.
-void TestResult::Clear() {
-  test_part_results_->Clear();
-  test_properties_->Clear();
-  death_test_count_ = 0;
-  elapsed_time_ = 0;
-}
-
-// Returns true iff the test failed.
-bool TestResult::Failed() const {
-  for (int i = 0; i < total_part_count(); ++i) {
-    if (GetTestPartResult(i).failed())
-      return true;
-  }
-  return false;
-}
-
-// Returns true iff the test part fatally failed.
-static bool TestPartFatallyFailed(const TestPartResult& result) {
-  return result.fatally_failed();
-}
-
-// Returns true iff the test fatally failed.
-bool TestResult::HasFatalFailure() const {
-  return test_part_results_->CountIf(TestPartFatallyFailed) > 0;
-}
-
-// Returns true iff the test part non-fatally failed.
-static bool TestPartNonfatallyFailed(const TestPartResult& result) {
-  return result.nonfatally_failed();
-}
-
-// Returns true iff the test has a non-fatal failure.
-bool TestResult::HasNonfatalFailure() const {
-  return test_part_results_->CountIf(TestPartNonfatallyFailed) > 0;
-}
-
-// Gets the number of all test parts.  This is the sum of the number
-// of successful test parts and the number of failed test parts.
-int TestResult::total_part_count() const {
-  return test_part_results_->size();
-}
-
-// Returns the number of the test properties.
-int TestResult::test_property_count() const {
-  return test_properties_->size();
-}
-
-// class Test
-
-// Creates a Test object.
-
-// The c'tor saves the values of all Google Test flags.
-Test::Test()
-    : gtest_flag_saver_(new internal::GTestFlagSaver) {
-}
-
-// The d'tor restores the values of all Google Test flags.
-Test::~Test() {
-  delete gtest_flag_saver_;
-}
-
-// Sets up the test fixture.
-//
-// A sub-class may override this.
-void Test::SetUp() {
-}
-
-// Tears down the test fixture.
-//
-// A sub-class may override this.
-void Test::TearDown() {
-}
-
-// Allows user supplied key value pairs to be recorded for later output.
-void Test::RecordProperty(const char* key, const char* value) {
-  UnitTest::GetInstance()->RecordPropertyForCurrentTest(key, value);
-}
-
-// Allows user supplied key value pairs to be recorded for later output.
-void Test::RecordProperty(const char* key, int value) {
-  Message value_message;
-  value_message << value;
-  RecordProperty(key, value_message.GetString().c_str());
-}
-
-namespace internal {
-
-void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
-                                    const String& message) {
-  // This function is a friend of UnitTest and as such has access to
-  // AddTestPartResult.
-  UnitTest::GetInstance()->AddTestPartResult(
-      result_type,
-      NULL,  // No info about the source file where the exception occurred.
-      -1,    // We have no info on which line caused the exception.
-      message,
-      String());  // No stack trace, either.
-}
-
-}  // namespace internal
-
-#if GTEST_OS_WINDOWS
-// We are on Windows.
-
-// Adds an "exception thrown" fatal failure to the current test.
-static void AddExceptionThrownFailure(DWORD exception_code,
-                                      const char* location) {
-  Message message;
-  message << "Exception thrown with code 0x" << std::setbase(16) <<
-    exception_code << std::setbase(10) << " in " << location << ".";
-
-  internal::ReportFailureInUnknownLocation(TestPartResult::kFatalFailure,
-                                           message.GetString());
-}
-
-#endif  // GTEST_OS_WINDOWS
-
-// Google Test requires all tests in the same test case to use the same test
-// fixture class.  This function checks if the current test has the
-// same fixture class as the first test in the current test case.  If
-// yes, it returns true; otherwise it generates a Google Test failure and
-// returns false.
-bool Test::HasSameFixtureClass() {
-  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
-  const TestCase* const test_case = impl->current_test_case();
-
-  // Info about the first test in the current test case.
-  const internal::TestInfoImpl* const first_test_info =
-      test_case->test_info_list().GetElement(0)->impl();
-  const internal::TypeId first_fixture_id = first_test_info->fixture_class_id();
-  const char* const first_test_name = first_test_info->name();
-
-  // Info about the current test.
-  const internal::TestInfoImpl* const this_test_info =
-      impl->current_test_info()->impl();
-  const internal::TypeId this_fixture_id = this_test_info->fixture_class_id();
-  const char* const this_test_name = this_test_info->name();
-
-  if (this_fixture_id != first_fixture_id) {
-    // Is the first test defined using TEST?
-    const bool first_is_TEST = first_fixture_id == internal::GetTestTypeId();
-    // Is this test defined using TEST?
-    const bool this_is_TEST = this_fixture_id == internal::GetTestTypeId();
-
-    if (first_is_TEST || this_is_TEST) {
-      // The user mixed TEST and TEST_F in this test case - we'll tell
-      // him/her how to fix it.
-
-      // Gets the name of the TEST and the name of the TEST_F.  Note
-      // that first_is_TEST and this_is_TEST cannot both be true, as
-      // the fixture IDs are different for the two tests.
-      const char* const TEST_name =
-          first_is_TEST ? first_test_name : this_test_name;
-      const char* const TEST_F_name =
-          first_is_TEST ? this_test_name : first_test_name;
-
-      ADD_FAILURE()
-          << "All tests in the same test case must use the same test fixture\n"
-          << "class, so mixing TEST_F and TEST in the same test case is\n"
-          << "illegal.  In test case " << this_test_info->test_case_name()
-          << ",\n"
-          << "test " << TEST_F_name << " is defined using TEST_F but\n"
-          << "test " << TEST_name << " is defined using TEST.  You probably\n"
-          << "want to change the TEST to TEST_F or move it to another test\n"
-          << "case.";
-    } else {
-      // The user defined two fixture classes with the same name in
-      // two namespaces - we'll tell him/her how to fix it.
-      ADD_FAILURE()
-          << "All tests in the same test case must use the same test fixture\n"
-          << "class.  However, in test case "
-          << this_test_info->test_case_name() << ",\n"
-          << "you defined test " << first_test_name
-          << " and test " << this_test_name << "\n"
-          << "using two different test fixture classes.  This can happen if\n"
-          << "the two classes are from different namespaces or translation\n"
-          << "units and have the same name.  You should probably rename one\n"
-          << "of the classes to put the tests into different test cases.";
-    }
-    return false;
-  }
-
-  return true;
-}
-
-// Runs the test and updates the test result.
-void Test::Run() {
-  if (!HasSameFixtureClass()) return;
-
-  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
-#if GTEST_HAS_SEH
-  // Catch SEH-style exceptions.
-  impl->os_stack_trace_getter()->UponLeavingGTest();
-  __try {
-    SetUp();
-  } __except(internal::UnitTestOptions::GTestShouldProcessSEH(
-      GetExceptionCode())) {
-    AddExceptionThrownFailure(GetExceptionCode(), "SetUp()");
-  }
-
-  // We will run the test only if SetUp() had no fatal failure.
-  if (!HasFatalFailure()) {
-    impl->os_stack_trace_getter()->UponLeavingGTest();
-    __try {
-      TestBody();
-    } __except(internal::UnitTestOptions::GTestShouldProcessSEH(
-        GetExceptionCode())) {
-      AddExceptionThrownFailure(GetExceptionCode(), "the test body");
-    }
-  }
-
-  // However, we want to clean up as much as possible.  Hence we will
-  // always call TearDown(), even if SetUp() or the test body has
-  // failed.
-  impl->os_stack_trace_getter()->UponLeavingGTest();
-  __try {
-    TearDown();
-  } __except(internal::UnitTestOptions::GTestShouldProcessSEH(
-      GetExceptionCode())) {
-    AddExceptionThrownFailure(GetExceptionCode(), "TearDown()");
-  }
-
-#else  // We are on a compiler or platform that doesn't support SEH.
-  impl->os_stack_trace_getter()->UponLeavingGTest();
-  SetUp();
-
-  // We will run the test only if SetUp() was successful.
-  if (!HasFatalFailure()) {
-    impl->os_stack_trace_getter()->UponLeavingGTest();
-    TestBody();
-  }
-
-  // However, we want to clean up as much as possible.  Hence we will
-  // always call TearDown(), even if SetUp() or the test body has
-  // failed.
-  impl->os_stack_trace_getter()->UponLeavingGTest();
-  TearDown();
-#endif  // GTEST_HAS_SEH
-}
-
-
-// Returns true iff the current test has a fatal failure.
-bool Test::HasFatalFailure() {
-  return internal::GetUnitTestImpl()->current_test_result()->HasFatalFailure();
-}
-
-// Returns true iff the current test has a non-fatal failure.
-bool Test::HasNonfatalFailure() {
-  return internal::GetUnitTestImpl()->current_test_result()->
-      HasNonfatalFailure();
-}
-
-// class TestInfo
-
-// Constructs a TestInfo object. It assumes ownership of the test factory
-// object via impl_.
-TestInfo::TestInfo(const char* test_case_name,
-                   const char* name,
-                   const char* test_case_comment,
-                   const char* comment,
-                   internal::TypeId fixture_class_id,
-                   internal::TestFactoryBase* factory) {
-  impl_ = new internal::TestInfoImpl(this, test_case_name, name,
-                                     test_case_comment, comment,
-                                     fixture_class_id, factory);
-}
-
-// Destructs a TestInfo object.
-TestInfo::~TestInfo() {
-  delete impl_;
-}
-
-namespace internal {
-
-// Creates a new TestInfo object and registers it with Google Test;
-// returns the created object.
-//
-// Arguments:
-//
-//   test_case_name:   name of the test case
-//   name:             name of the test
-//   test_case_comment: a comment on the test case that will be included in
-//                      the test output
-//   comment:          a comment on the test that will be included in the
-//                     test output
-//   fixture_class_id: ID of the test fixture class
-//   set_up_tc:        pointer to the function that sets up the test case
-//   tear_down_tc:     pointer to the function that tears down the test case
-//   factory:          pointer to the factory that creates a test object.
-//                     The newly created TestInfo instance will assume
-//                     ownership of the factory object.
-TestInfo* MakeAndRegisterTestInfo(
-    const char* test_case_name, const char* name,
-    const char* test_case_comment, const char* comment,
-    TypeId fixture_class_id,
-    SetUpTestCaseFunc set_up_tc,
-    TearDownTestCaseFunc tear_down_tc,
-    TestFactoryBase* factory) {
-  TestInfo* const test_info =
-      new TestInfo(test_case_name, name, test_case_comment, comment,
-                   fixture_class_id, factory);
-  GetUnitTestImpl()->AddTestInfo(set_up_tc, tear_down_tc, test_info);
-  return test_info;
-}
-
-#if GTEST_HAS_PARAM_TEST
-void ReportInvalidTestCaseType(const char* test_case_name,
-                               const char* file, int line) {
-  Message errors;
-  errors
-      << "Attempted redefinition of test case " << test_case_name << ".\n"
-      << "All tests in the same test case must use the same test fixture\n"
-      << "class.  However, in test case " << test_case_name << ", you tried\n"
-      << "to define a test using a fixture class different from the one\n"
-      << "used earlier. This can happen if the two fixture classes are\n"
-      << "from different namespaces and have the same name. You should\n"
-      << "probably rename one of the classes to put the tests into different\n"
-      << "test cases.";
-
-  fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(),
-          errors.GetString().c_str());
-}
-#endif  // GTEST_HAS_PARAM_TEST
-
-}  // namespace internal
-
-// Returns the test case name.
-const char* TestInfo::test_case_name() const {
-  return impl_->test_case_name();
-}
-
-// Returns the test name.
-const char* TestInfo::name() const {
-  return impl_->name();
-}
-
-// Returns the test case comment.
-const char* TestInfo::test_case_comment() const {
-  return impl_->test_case_comment();
-}
-
-// Returns the test comment.
-const char* TestInfo::comment() const {
-  return impl_->comment();
-}
-
-// Returns true if this test should run.
-bool TestInfo::should_run() const { return impl_->should_run(); }
-
-// Returns true if this test matches the user-specified filter.
-bool TestInfo::matches_filter() const { return impl_->matches_filter(); }
-
-// Returns the result of the test.
-const TestResult* TestInfo::result() const { return impl_->result(); }
-
-// Increments the number of death tests encountered in this test so
-// far.
-int TestInfo::increment_death_test_count() {
-  return impl_->result()->increment_death_test_count();
-}
-
-namespace {
-
-// A predicate that checks the test name of a TestInfo against a known
-// value.
-//
-// This is used for implementation of the TestCase class only.  We put
-// it in the anonymous namespace to prevent polluting the outer
-// namespace.
-//
-// TestNameIs is copyable.
-class TestNameIs {
- public:
-  // Constructor.
-  //
-  // TestNameIs has NO default constructor.
-  explicit TestNameIs(const char* name)
-      : name_(name) {}
-
-  // Returns true iff the test name of test_info matches name_.
-  bool operator()(const TestInfo * test_info) const {
-    return test_info && internal::String(test_info->name()).Compare(name_) == 0;
-  }
-
- private:
-  internal::String name_;
-};
-
-}  // namespace
-
-namespace internal {
-
-// This method expands all parameterized tests registered with macros TEST_P
-// and INSTANTIATE_TEST_CASE_P into regular tests and registers those.
-// This will be done just once during the program runtime.
-void UnitTestImpl::RegisterParameterizedTests() {
-#if GTEST_HAS_PARAM_TEST
-  if (!parameterized_tests_registered_) {
-    parameterized_test_registry_.RegisterTests();
-    parameterized_tests_registered_ = true;
-  }
-#endif
-}
-
-// Creates the test object, runs it, records its result, and then
-// deletes it.
-void TestInfoImpl::Run() {
-  if (!should_run_) return;
-
-  // Tells UnitTest where to store test result.
-  UnitTestImpl* const impl = internal::GetUnitTestImpl();
-  impl->set_current_test_info(parent_);
-
-  TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater();
-
-  // Notifies the unit test event listeners that a test is about to start.
-  repeater->OnTestStart(*parent_);
-
-  const TimeInMillis start = GetTimeInMillis();
-
-  impl->os_stack_trace_getter()->UponLeavingGTest();
-#if GTEST_HAS_SEH
-  // Catch SEH-style exceptions.
-  Test* test = NULL;
-
-  __try {
-    // Creates the test object.
-    test = factory_->CreateTest();
-  } __except(internal::UnitTestOptions::GTestShouldProcessSEH(
-      GetExceptionCode())) {
-    AddExceptionThrownFailure(GetExceptionCode(),
-                              "the test fixture's constructor");
-    return;
-  }
-#else  // We are on a compiler or platform that doesn't support SEH.
-
-  // TODO(wan): If test->Run() throws, test won't be deleted.  This is
-  // not a problem now as we don't use exceptions.  If we were to
-  // enable exceptions, we should revise the following to be
-  // exception-safe.
-
-  // Creates the test object.
-  Test* test = factory_->CreateTest();
-#endif  // GTEST_HAS_SEH
-
-  // Runs the test only if the constructor of the test fixture didn't
-  // generate a fatal failure.
-  if (!Test::HasFatalFailure()) {
-    test->Run();
-  }
-
-  // Deletes the test object.
-  impl->os_stack_trace_getter()->UponLeavingGTest();
-  delete test;
-  test = NULL;
-
-  result_.set_elapsed_time(GetTimeInMillis() - start);
-
-  // Notifies the unit test event listener that a test has just finished.
-  repeater->OnTestEnd(*parent_);
-
-  // Tells UnitTest to stop associating assertion results to this
-  // test.
-  impl->set_current_test_info(NULL);
-}
-
-}  // namespace internal
-
-// class TestCase
-
-// Gets the number of successful tests in this test case.
-int TestCase::successful_test_count() const {
-  return test_info_list_->CountIf(TestPassed);
-}
-
-// Gets the number of failed tests in this test case.
-int TestCase::failed_test_count() const {
-  return test_info_list_->CountIf(TestFailed);
-}
-
-int TestCase::disabled_test_count() const {
-  return test_info_list_->CountIf(TestDisabled);
-}
-
-// Get the number of tests in this test case that should run.
-int TestCase::test_to_run_count() const {
-  return test_info_list_->CountIf(ShouldRunTest);
-}
-
-// Gets the number of all tests.
-int TestCase::total_test_count() const {
-  return test_info_list_->size();
-}
-
-// Creates a TestCase with the given name.
-//
-// Arguments:
-//
-//   name:         name of the test case
-//   set_up_tc:    pointer to the function that sets up the test case
-//   tear_down_tc: pointer to the function that tears down the test case
-TestCase::TestCase(const char* name, const char* comment,
-                   Test::SetUpTestCaseFunc set_up_tc,
-                   Test::TearDownTestCaseFunc tear_down_tc)
-    : name_(name),
-      comment_(comment),
-      test_info_list_(new internal::Vector<TestInfo*>),
-      test_indices_(new internal::Vector<int>),
-      set_up_tc_(set_up_tc),
-      tear_down_tc_(tear_down_tc),
-      should_run_(false),
-      elapsed_time_(0) {
-}
-
-// Destructor of TestCase.
-TestCase::~TestCase() {
-  // Deletes every Test in the collection.
-  test_info_list_->ForEach(internal::Delete<TestInfo>);
-}
-
-// Returns the i-th test among all the tests. i can range from 0 to
-// total_test_count() - 1. If i is not in that range, returns NULL.
-const TestInfo* TestCase::GetTestInfo(int i) const {
-  const int index = test_indices_->GetElementOr(i, -1);
-  return index < 0 ? NULL : test_info_list_->GetElement(index);
-}
-
-// Returns the i-th test among all the tests. i can range from 0 to
-// total_test_count() - 1. If i is not in that range, returns NULL.
-TestInfo* TestCase::GetMutableTestInfo(int i) {
-  const int index = test_indices_->GetElementOr(i, -1);
-  return index < 0 ? NULL : test_info_list_->GetElement(index);
-}
-
-// Adds a test to this test case.  Will delete the test upon
-// destruction of the TestCase object.
-void TestCase::AddTestInfo(TestInfo * test_info) {
-  test_info_list_->PushBack(test_info);
-  test_indices_->PushBack(test_indices_->size());
-}
-
-// Runs every test in this TestCase.
-void TestCase::Run() {
-  if (!should_run_) return;
-
-  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
-  impl->set_current_test_case(this);
-
-  TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater();
-
-  repeater->OnTestCaseStart(*this);
-  impl->os_stack_trace_getter()->UponLeavingGTest();
-  set_up_tc_();
-
-  const internal::TimeInMillis start = internal::GetTimeInMillis();
-  for (int i = 0; i < total_test_count(); i++) {
-    GetMutableTestInfo(i)->impl()->Run();
-  }
-  elapsed_time_ = internal::GetTimeInMillis() - start;
-
-  impl->os_stack_trace_getter()->UponLeavingGTest();
-  tear_down_tc_();
-  repeater->OnTestCaseEnd(*this);
-  impl->set_current_test_case(NULL);
-}
-
-// Clears the results of all tests in this test case.
-void TestCase::ClearResult() {
-  test_info_list_->ForEach(internal::TestInfoImpl::ClearTestResult);
-}
-
-// Returns true iff test passed.
-bool TestCase::TestPassed(const TestInfo * test_info) {
-  const internal::TestInfoImpl* const impl = test_info->impl();
-  return impl->should_run() && impl->result()->Passed();
-}
-
-// Returns true iff test failed.
-bool TestCase::TestFailed(const TestInfo * test_info) {
-  const internal::TestInfoImpl* const impl = test_info->impl();
-  return impl->should_run() && impl->result()->Failed();
-}
-
-// Returns true iff test is disabled.
-bool TestCase::TestDisabled(const TestInfo * test_info) {
-  return test_info->impl()->is_disabled();
-}
-
-// Returns true if the given test should run.
-bool TestCase::ShouldRunTest(const TestInfo *test_info) {
-  return test_info->impl()->should_run();
-}
-
-// Shuffles the tests in this test case.
-void TestCase::ShuffleTests(internal::Random* random) {
-  test_indices_->Shuffle(random);
-}
-
-// Restores the test order to before the first shuffle.
-void TestCase::UnshuffleTests() {
-  for (int i = 0; i < test_indices_->size(); i++) {
-    test_indices_->GetMutableElement(i) = i;
-  }
-}
-
-// Formats a countable noun.  Depending on its quantity, either the
-// singular form or the plural form is used. e.g.
-//
-// FormatCountableNoun(1, "formula", "formuli") returns "1 formula".
-// FormatCountableNoun(5, "book", "books") returns "5 books".
-static internal::String FormatCountableNoun(int count,
-                                            const char * singular_form,
-                                            const char * plural_form) {
-  return internal::String::Format("%d %s", count,
-                                  count == 1 ? singular_form : plural_form);
-}
-
-// Formats the count of tests.
-static internal::String FormatTestCount(int test_count) {
-  return FormatCountableNoun(test_count, "test", "tests");
-}
-
-// Formats the count of test cases.
-static internal::String FormatTestCaseCount(int test_case_count) {
-  return FormatCountableNoun(test_case_count, "test case", "test cases");
-}
-
-// Converts a TestPartResult::Type enum to human-friendly string
-// representation.  Both kNonFatalFailure and kFatalFailure are translated
-// to "Failure", as the user usually doesn't care about the difference
-// between the two when viewing the test result.
-static const char * TestPartResultTypeToString(TestPartResult::Type type) {
-  switch (type) {
-    case TestPartResult::kSuccess:
-      return "Success";
-
-    case TestPartResult::kNonFatalFailure:
-    case TestPartResult::kFatalFailure:
-#ifdef _MSC_VER
-      return "error: ";
-#else
-      return "Failure\n";
-#endif
-  }
-
-  return "Unknown result type";
-}
-
-// Prints a TestPartResult to a String.
-static internal::String PrintTestPartResultToString(
-    const TestPartResult& test_part_result) {
-  return (Message()
-          << internal::FormatFileLocation(test_part_result.file_name(),
-                                          test_part_result.line_number())
-          << " " << TestPartResultTypeToString(test_part_result.type())
-          << test_part_result.message()).GetString();
-}
-
-// Prints a TestPartResult.
-static void PrintTestPartResult(const TestPartResult& test_part_result) {
-  const internal::String& result =
-      PrintTestPartResultToString(test_part_result);
-  printf("%s\n", result.c_str());
-  fflush(stdout);
-  // If the test program runs in Visual Studio or a debugger, the
-  // following statements add the test part result message to the Output
-  // window such that the user can double-click on it to jump to the
-  // corresponding source code location; otherwise they do nothing.
-#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
-  // We don't call OutputDebugString*() on Windows Mobile, as printing
-  // to stdout is done by OutputDebugString() there already - we don't
-  // want the same message printed twice.
-  ::OutputDebugStringA(result.c_str());
-  ::OutputDebugStringA("\n");
-#endif
-}
-
-// class PrettyUnitTestResultPrinter
-
-namespace internal {
-
-enum GTestColor {
-  COLOR_DEFAULT,
-  COLOR_RED,
-  COLOR_GREEN,
-  COLOR_YELLOW
-};
-
-#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
-
-// Returns the character attribute for the given color.
-WORD GetColorAttribute(GTestColor color) {
-  switch (color) {
-    case COLOR_RED:    return FOREGROUND_RED;
-    case COLOR_GREEN:  return FOREGROUND_GREEN;
-    case COLOR_YELLOW: return FOREGROUND_RED | FOREGROUND_GREEN;
-    default:           return 0;
-  }
-}
-
-#else
-
-// Returns the ANSI color code for the given color.  COLOR_DEFAULT is
-// an invalid input.
-const char* GetAnsiColorCode(GTestColor color) {
-  switch (color) {
-    case COLOR_RED:     return "1";
-    case COLOR_GREEN:   return "2";
-    case COLOR_YELLOW:  return "3";
-    default:            return NULL;
-  };
-}
-
-#endif  // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
-
-// Returns true iff Google Test should use colors in the output.
-bool ShouldUseColor(bool stdout_is_tty) {
-  const char* const gtest_color = GTEST_FLAG(color).c_str();
-
-  if (String::CaseInsensitiveCStringEquals(gtest_color, "auto")) {
-#if GTEST_OS_WINDOWS
-    // On Windows the TERM variable is usually not set, but the
-    // console there does support colors.
-    return stdout_is_tty;
-#else
-    // On non-Windows platforms, we rely on the TERM variable.
-    const char* const term = posix::GetEnv("TERM");
-    const bool term_supports_color =
-        String::CStringEquals(term, "xterm") ||
-        String::CStringEquals(term, "xterm-color") ||
-        String::CStringEquals(term, "xterm-256color") ||
-        String::CStringEquals(term, "linux") ||
-        String::CStringEquals(term, "cygwin");
-    return stdout_is_tty && term_supports_color;
-#endif  // GTEST_OS_WINDOWS
-  }
-
-  return String::CaseInsensitiveCStringEquals(gtest_color, "yes") ||
-      String::CaseInsensitiveCStringEquals(gtest_color, "true") ||
-      String::CaseInsensitiveCStringEquals(gtest_color, "t") ||
-      String::CStringEquals(gtest_color, "1");
-  // We take "yes", "true", "t", and "1" as meaning "yes".  If the
-  // value is neither one of these nor "auto", we treat it as "no" to
-  // be conservative.
-}
-
-// Helpers for printing colored strings to stdout. Note that on Windows, we
-// cannot simply emit special characters and have the terminal change colors.
-// This routine must actually emit the characters rather than return a string
-// that would be colored when printed, as can be done on Linux.
-void ColoredPrintf(GTestColor color, const char* fmt, ...) {
-  va_list args;
-  va_start(args, fmt);
-
-#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || GTEST_OS_ZOS
-  const bool use_color = false;
-#else
-  static const bool in_color_mode =
-      ShouldUseColor(posix::IsATTY(posix::FileNo(stdout)) != 0);
-  const bool use_color = in_color_mode && (color != COLOR_DEFAULT);
-#endif  // GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || GTEST_OS_ZOS
-  // The '!= 0' comparison is necessary to satisfy MSVC 7.1.
-
-  if (!use_color) {
-    vprintf(fmt, args);
-    va_end(args);
-    return;
-  }
-
-#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
-  const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);
-
-  // Gets the current text color.
-  CONSOLE_SCREEN_BUFFER_INFO buffer_info;
-  GetConsoleScreenBufferInfo(stdout_handle, &buffer_info);
-  const WORD old_color_attrs = buffer_info.wAttributes;
-
-  SetConsoleTextAttribute(stdout_handle,
-                          GetColorAttribute(color) | FOREGROUND_INTENSITY);
-  vprintf(fmt, args);
-
-  // Restores the text color.
-  SetConsoleTextAttribute(stdout_handle, old_color_attrs);
-#else
-  printf("\033[0;3%sm", GetAnsiColorCode(color));
-  vprintf(fmt, args);
-  printf("\033[m");  // Resets the terminal to default.
-#endif  // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
-  va_end(args);
-}
-
-// This class implements the TestEventListener interface.
-//
-// Class PrettyUnitTestResultPrinter is copyable.
-class PrettyUnitTestResultPrinter : public TestEventListener {
- public:
-  PrettyUnitTestResultPrinter() {}
-  static void PrintTestName(const char * test_case, const char * test) {
-    printf("%s.%s", test_case, test);
-  }
-
-  // The following methods override what's in the TestEventListener class.
-  virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}
-  virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration);
-  virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test);
-  virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {}
-  virtual void OnTestCaseStart(const TestCase& test_case);
-  virtual void OnTestStart(const TestInfo& test_info);
-  virtual void OnTestPartResult(const TestPartResult& result);
-  virtual void OnTestEnd(const TestInfo& test_info);
-  virtual void OnTestCaseEnd(const TestCase& test_case);
-  virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test);
-  virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {}
-  virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
-  virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {}
-
- private:
-  static void PrintFailedTests(const UnitTest& unit_test);
-
-  internal::String test_case_name_;
-};
-
-  // Fired before each iteration of tests starts.
-void PrettyUnitTestResultPrinter::OnTestIterationStart(
-    const UnitTest& unit_test, int iteration) {
-  if (GTEST_FLAG(repeat) != 1)
-    printf("\nRepeating all tests (iteration %d) . . .\n\n", iteration + 1);
-
-  const char* const filter = GTEST_FLAG(filter).c_str();
-
-  // Prints the filter if it's not *.  This reminds the user that some
-  // tests may be skipped.
-  if (!internal::String::CStringEquals(filter, kUniversalFilter)) {
-    ColoredPrintf(COLOR_YELLOW,
-                  "Note: %s filter = %s\n", GTEST_NAME_, filter);
-  }
-
-  if (internal::ShouldShard(kTestTotalShards, kTestShardIndex, false)) {
-    ColoredPrintf(COLOR_YELLOW,
-                  "Note: This is test shard %s of %s.\n",
-                  internal::posix::GetEnv(kTestShardIndex),
-                  internal::posix::GetEnv(kTestTotalShards));
-  }
-
-  if (GTEST_FLAG(shuffle)) {
-    ColoredPrintf(COLOR_YELLOW,
-                  "Note: Randomizing tests' orders with a seed of %d .\n",
-                  unit_test.random_seed());
-  }
-
-  ColoredPrintf(COLOR_GREEN,  "[==========] ");
-  printf("Running %s from %s.\n",
-         FormatTestCount(unit_test.test_to_run_count()).c_str(),
-         FormatTestCaseCount(unit_test.test_case_to_run_count()).c_str());
-  fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnEnvironmentsSetUpStart(
-    const UnitTest& /*unit_test*/) {
-  ColoredPrintf(COLOR_GREEN,  "[----------] ");
-  printf("Global test environment set-up.\n");
-  fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnTestCaseStart(const TestCase& test_case) {
-  test_case_name_ = test_case.name();
-  const internal::String counts =
-      FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
-  ColoredPrintf(COLOR_GREEN, "[----------] ");
-  printf("%s from %s", counts.c_str(), test_case_name_.c_str());
-  if (test_case.comment()[0] == '\0') {
-    printf("\n");
-  } else {
-    printf(", where %s\n", test_case.comment());
-  }
-  fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnTestStart(const TestInfo& test_info) {
-  ColoredPrintf(COLOR_GREEN,  "[ RUN      ] ");
-  PrintTestName(test_case_name_.c_str(), test_info.name());
-  if (test_info.comment()[0] == '\0') {
-    printf("\n");
-  } else {
-    printf(", where %s\n", test_info.comment());
-  }
-  fflush(stdout);
-}
-
-// Called after an assertion failure.
-void PrettyUnitTestResultPrinter::OnTestPartResult(
-    const TestPartResult& result) {
-  // If the test part succeeded, we don't need to do anything.
-  if (result.type() == TestPartResult::kSuccess)
-    return;
-
-  // Print failure message from the assertion (e.g. expected this and got that).
-  PrintTestPartResult(result);
-  fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) {
-  if (test_info.result()->Passed()) {
-    ColoredPrintf(COLOR_GREEN, "[       OK ] ");
-  } else {
-    ColoredPrintf(COLOR_RED, "[  FAILED  ] ");
-  }
-  PrintTestName(test_case_name_.c_str(), test_info.name());
-  if (GTEST_FLAG(print_time)) {
-    printf(" (%s ms)\n", internal::StreamableToString(
-           test_info.result()->elapsed_time()).c_str());
-  } else {
-    printf("\n");
-  }
-  fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnTestCaseEnd(const TestCase& test_case) {
-  if (!GTEST_FLAG(print_time)) return;
-
-  test_case_name_ = test_case.name();
-  const internal::String counts =
-      FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
-  ColoredPrintf(COLOR_GREEN, "[----------] ");
-  printf("%s from %s (%s ms total)\n\n",
-         counts.c_str(), test_case_name_.c_str(),
-         internal::StreamableToString(test_case.elapsed_time()).c_str());
-  fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnEnvironmentsTearDownStart(
-    const UnitTest& /*unit_test*/) {
-  ColoredPrintf(COLOR_GREEN,  "[----------] ");
-  printf("Global test environment tear-down\n");
-  fflush(stdout);
-}
-
-// Internal helper for printing the list of failed tests.
-void PrettyUnitTestResultPrinter::PrintFailedTests(const UnitTest& unit_test) {
-  const int failed_test_count = unit_test.failed_test_count();
-  if (failed_test_count == 0) {
-    return;
-  }
-
-  for (int i = 0; i < unit_test.total_test_case_count(); ++i) {
-    const TestCase& test_case = *unit_test.GetTestCase(i);
-    if (!test_case.should_run() || (test_case.failed_test_count() == 0)) {
-      continue;
-    }
-    for (int j = 0; j < test_case.total_test_count(); ++j) {
-      const TestInfo& test_info = *test_case.GetTestInfo(j);
-      if (!test_info.should_run() || test_info.result()->Passed()) {
-        continue;
-      }
-      ColoredPrintf(COLOR_RED, "[  FAILED  ] ");
-      printf("%s.%s", test_case.name(), test_info.name());
-      if (test_case.comment()[0] != '\0' ||
-          test_info.comment()[0] != '\0') {
-        printf(", where %s", test_case.comment());
-        if (test_case.comment()[0] != '\0' &&
-            test_info.comment()[0] != '\0') {
-          printf(" and ");
-        }
-      }
-      printf("%s\n", test_info.comment());
-    }
-  }
-}
-
- void PrettyUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
-                                                      int /*iteration*/) {
-  ColoredPrintf(COLOR_GREEN,  "[==========] ");
-  printf("%s from %s ran.",
-         FormatTestCount(unit_test.test_to_run_count()).c_str(),
-         FormatTestCaseCount(unit_test.test_case_to_run_count()).c_str());
-  if (GTEST_FLAG(print_time)) {
-    printf(" (%s ms total)",
-           internal::StreamableToString(unit_test.elapsed_time()).c_str());
-  }
-  printf("\n");
-  ColoredPrintf(COLOR_GREEN,  "[  PASSED  ] ");
-  printf("%s.\n", FormatTestCount(unit_test.successful_test_count()).c_str());
-
-  int num_failures = unit_test.failed_test_count();
-  if (!unit_test.Passed()) {
-    const int failed_test_count = unit_test.failed_test_count();
-    ColoredPrintf(COLOR_RED,  "[  FAILED  ] ");
-    printf("%s, listed below:\n", FormatTestCount(failed_test_count).c_str());
-    PrintFailedTests(unit_test);
-    printf("\n%2d FAILED %s\n", num_failures,
-                        num_failures == 1 ? "TEST" : "TESTS");
-  }
-
-  int num_disabled = unit_test.disabled_test_count();
-  if (num_disabled && !GTEST_FLAG(also_run_disabled_tests)) {
-    if (!num_failures) {
-      printf("\n");  // Add a spacer if no FAILURE banner is displayed.
-    }
-    ColoredPrintf(COLOR_YELLOW,
-                  "  YOU HAVE %d DISABLED %s\n\n",
-                  num_disabled,
-                  num_disabled == 1 ? "TEST" : "TESTS");
-  }
-  // Ensure that Google Test output is printed before, e.g., heapchecker output.
-  fflush(stdout);
-}
-
-// End PrettyUnitTestResultPrinter
-
-// class TestEventRepeater
-//
-// This class forwards events to other event listeners.
-class TestEventRepeater : public TestEventListener {
- public:
-  TestEventRepeater() : forwarding_enabled_(true) {}
-  virtual ~TestEventRepeater();
-  void Append(TestEventListener *listener);
-  TestEventListener* Release(TestEventListener* listener);
-
-  // Controls whether events will be forwarded to listeners_. Set to false
-  // in death test child processes.
-  bool forwarding_enabled() const { return forwarding_enabled_; }
-  void set_forwarding_enabled(bool enable) { forwarding_enabled_ = enable; }
-
-  virtual void OnTestProgramStart(const UnitTest& unit_test);
-  virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration);
-  virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test);
-  virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test);
-  virtual void OnTestCaseStart(const TestCase& test_case);
-  virtual void OnTestStart(const TestInfo& test_info);
-  virtual void OnTestPartResult(const TestPartResult& result);
-  virtual void OnTestEnd(const TestInfo& test_info);
-  virtual void OnTestCaseEnd(const TestCase& test_case);
-  virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test);
-  virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test);
-  virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
-  virtual void OnTestProgramEnd(const UnitTest& unit_test);
-
- private:
-  // Controls whether events will be forwarded to listeners_. Set to false
-  // in death test child processes.
-  bool forwarding_enabled_;
-  // The list of listeners that receive events.
-  Vector<TestEventListener*> listeners_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventRepeater);
-};
-
-TestEventRepeater::~TestEventRepeater() {
-  for (int i = 0; i < listeners_.size(); i++) {
-    delete listeners_.GetElement(i);
-  }
-}
-
-void TestEventRepeater::Append(TestEventListener *listener) {
-  listeners_.PushBack(listener);
-}
-
-// TODO(vladl@google.com): Factor the search functionality into Vector::Find.
-TestEventListener* TestEventRepeater::Release(TestEventListener *listener) {
-  for (int i = 0; i < listeners_.size(); ++i) {
-    if (listeners_.GetElement(i) == listener) {
-      listeners_.Erase(i);
-      return listener;
-    }
-  }
-
-  return NULL;
-}
-
-// Since most methods are very similar, use macros to reduce boilerplate.
-// This defines a member that forwards the call to all listeners.
-#define GTEST_REPEATER_METHOD_(Name, Type) \
-void TestEventRepeater::Name(const Type& parameter) { \
-  if (forwarding_enabled_) { \
-    for (int i = 0; i < listeners_.size(); i++) { \
-      listeners_.GetElement(i)->Name(parameter); \
-    } \
-  } \
-}
-// This defines a member that forwards the call to all listeners in reverse
-// order.
-#define GTEST_REVERSE_REPEATER_METHOD_(Name, Type) \
-void TestEventRepeater::Name(const Type& parameter) { \
-  if (forwarding_enabled_) { \
-    for (int i = static_cast<int>(listeners_.size()) - 1; i >= 0; i--) { \
-      listeners_.GetElement(i)->Name(parameter); \
-    } \
-  } \
-}
-
-GTEST_REPEATER_METHOD_(OnTestProgramStart, UnitTest)
-GTEST_REPEATER_METHOD_(OnEnvironmentsSetUpStart, UnitTest)
-GTEST_REPEATER_METHOD_(OnTestCaseStart, TestCase)
-GTEST_REPEATER_METHOD_(OnTestStart, TestInfo)
-GTEST_REPEATER_METHOD_(OnTestPartResult, TestPartResult)
-GTEST_REPEATER_METHOD_(OnEnvironmentsTearDownStart, UnitTest)
-GTEST_REVERSE_REPEATER_METHOD_(OnEnvironmentsSetUpEnd, UnitTest)
-GTEST_REVERSE_REPEATER_METHOD_(OnEnvironmentsTearDownEnd, UnitTest)
-GTEST_REVERSE_REPEATER_METHOD_(OnTestEnd, TestInfo)
-GTEST_REVERSE_REPEATER_METHOD_(OnTestCaseEnd, TestCase)
-GTEST_REVERSE_REPEATER_METHOD_(OnTestProgramEnd, UnitTest)
-
-#undef GTEST_REPEATER_METHOD_
-#undef GTEST_REVERSE_REPEATER_METHOD_
-
-void TestEventRepeater::OnTestIterationStart(const UnitTest& unit_test,
-                                             int iteration) {
-  if (forwarding_enabled_) {
-    for (int i = 0; i < listeners_.size(); i++) {
-      listeners_.GetElement(i)->OnTestIterationStart(unit_test, iteration);
-    }
-  }
-}
-
-void TestEventRepeater::OnTestIterationEnd(const UnitTest& unit_test,
-                                           int iteration) {
-  if (forwarding_enabled_) {
-    for (int i = static_cast<int>(listeners_.size()) - 1; i >= 0; i--) {
-      listeners_.GetElement(i)->OnTestIterationEnd(unit_test, iteration);
-    }
-  }
-}
-
-// End TestEventRepeater
-
-// This class generates an XML output file.
-class XmlUnitTestResultPrinter : public EmptyTestEventListener {
- public:
-  explicit XmlUnitTestResultPrinter(const char* output_file);
-
-  virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
-
- private:
-  // Is c a whitespace character that is normalized to a space character
-  // when it appears in an XML attribute value?
-  static bool IsNormalizableWhitespace(char c) {
-    return c == 0x9 || c == 0xA || c == 0xD;
-  }
-
-  // May c appear in a well-formed XML document?
-  static bool IsValidXmlCharacter(char c) {
-    return IsNormalizableWhitespace(c) || c >= 0x20;
-  }
-
-  // Returns an XML-escaped copy of the input string str.  If
-  // is_attribute is true, the text is meant to appear as an attribute
-  // value, and normalizable whitespace is preserved by replacing it
-  // with character references.
-  static String EscapeXml(const char* str, bool is_attribute);
-
-  // Returns the given string with all characters invalid in XML removed.
-  static String RemoveInvalidXmlCharacters(const char* str);
-
-  // Convenience wrapper around EscapeXml when str is an attribute value.
-  static String EscapeXmlAttribute(const char* str) {
-    return EscapeXml(str, true);
-  }
-
-  // Convenience wrapper around EscapeXml when str is not an attribute value.
-  static String EscapeXmlText(const char* str) { return EscapeXml(str, false); }
-
-  // Streams an XML CDATA section, escaping invalid CDATA sequences as needed.
-  static void OutputXmlCDataSection(::std::ostream* stream, const char* data);
-
-  // Streams an XML representation of a TestInfo object.
-  static void OutputXmlTestInfo(::std::ostream* stream,
-                                const char* test_case_name,
-                                const TestInfo& test_info);
-
-  // Prints an XML representation of a TestCase object
-  static void PrintXmlTestCase(FILE* out, const TestCase& test_case);
-
-  // Prints an XML summary of unit_test to output stream out.
-  static void PrintXmlUnitTest(FILE* out, const UnitTest& unit_test);
-
-  // Produces a string representing the test properties in a result as space
-  // delimited XML attributes based on the property key="value" pairs.
-  // When the String is not empty, it includes a space at the beginning,
-  // to delimit this attribute from prior attributes.
-  static String TestPropertiesAsXmlAttributes(const TestResult& result);
-
-  // The output file.
-  const String output_file_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(XmlUnitTestResultPrinter);
-};
-
-// Creates a new XmlUnitTestResultPrinter.
-XmlUnitTestResultPrinter::XmlUnitTestResultPrinter(const char* output_file)
-    : output_file_(output_file) {
-  if (output_file_.c_str() == NULL || output_file_.empty()) {
-    fprintf(stderr, "XML output file may not be null\n");
-    fflush(stderr);
-    exit(EXIT_FAILURE);
-  }
-}
-
-// Called after the unit test ends.
-void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
-                                                  int /*iteration*/) {
-  FILE* xmlout = NULL;
-  FilePath output_file(output_file_);
-  FilePath output_dir(output_file.RemoveFileName());
-
-  if (output_dir.CreateDirectoriesRecursively()) {
-    xmlout = posix::FOpen(output_file_.c_str(), "w");
-  }
-  if (xmlout == NULL) {
-    // TODO(wan): report the reason of the failure.
-    //
-    // We don't do it for now as:
-    //
-    //   1. There is no urgent need for it.
-    //   2. It's a bit involved to make the errno variable thread-safe on
-    //      all three operating systems (Linux, Windows, and Mac OS).
-    //   3. To interpret the meaning of errno in a thread-safe way,
-    //      we need the strerror_r() function, which is not available on
-    //      Windows.
-    fprintf(stderr,
-            "Unable to open file \"%s\"\n",
-            output_file_.c_str());
-    fflush(stderr);
-    exit(EXIT_FAILURE);
-  }
-  PrintXmlUnitTest(xmlout, unit_test);
-  fclose(xmlout);
-}
-
-// Returns an XML-escaped copy of the input string str.  If is_attribute
-// is true, the text is meant to appear as an attribute value, and
-// normalizable whitespace is preserved by replacing it with character
-// references.
-//
-// Invalid XML characters in str, if any, are stripped from the output.
-// It is expected that most, if not all, of the text processed by this
-// module will consist of ordinary English text.
-// If this module is ever modified to produce version 1.1 XML output,
-// most invalid characters can be retained using character references.
-// TODO(wan): It might be nice to have a minimally invasive, human-readable
-// escaping scheme for invalid characters, rather than dropping them.
-String XmlUnitTestResultPrinter::EscapeXml(const char* str, bool is_attribute) {
-  Message m;
-
-  if (str != NULL) {
-    for (const char* src = str; *src; ++src) {
-      switch (*src) {
-        case '<':
-          m << "&lt;";
-          break;
-        case '>':
-          m << "&gt;";
-          break;
-        case '&':
-          m << "&amp;";
-          break;
-        case '\'':
-          if (is_attribute)
-            m << "&apos;";
-          else
-            m << '\'';
-          break;
-        case '"':
-          if (is_attribute)
-            m << "&quot;";
-          else
-            m << '"';
-          break;
-        default:
-          if (IsValidXmlCharacter(*src)) {
-            if (is_attribute && IsNormalizableWhitespace(*src))
-              m << String::Format("&#x%02X;", unsigned(*src));
-            else
-              m << *src;
-          }
-          break;
-      }
-    }
-  }
-
-  return m.GetString();
-}
-
-// Returns the given string with all characters invalid in XML removed.
-// Currently invalid characters are dropped from the string. An
-// alternative is to replace them with certain characters such as . or ?.
-String XmlUnitTestResultPrinter::RemoveInvalidXmlCharacters(const char* str) {
-  char* const output = new char[strlen(str) + 1];
-  char* appender = output;
-  for (char ch = *str; ch != '\0'; ch = *++str)
-    if (IsValidXmlCharacter(ch))
-      *appender++ = ch;
-  *appender = '\0';
-
-  String ret_value(output);
-  delete[] output;
-  return ret_value;
-}
-
-// The following routines generate an XML representation of a UnitTest
-// object.
-//
-// This is how Google Test concepts map to the DTD:
-//
-// <testsuites name="AllTests">        <-- corresponds to a UnitTest object
-//   <testsuite name="testcase-name">  <-- corresponds to a TestCase object
-//     <testcase name="test-name">     <-- corresponds to a TestInfo object
-//       <failure message="...">...</failure>
-//       <failure message="...">...</failure>
-//       <failure message="...">...</failure>
-//                                     <-- individual assertion failures
-//     </testcase>
-//   </testsuite>
-// </testsuites>
-
-// Formats the given time in milliseconds as seconds.  The returned
-// C-string is owned by this function and cannot be released by the
-// caller.  Calling the function again invalidates the previous
-// result.
-const char* FormatTimeInMillisAsSeconds(TimeInMillis ms) {
-  static String str;
-  str = (Message() << (ms/1000.0)).GetString();
-  return str.c_str();
-}
-
-// Streams an XML CDATA section, escaping invalid CDATA sequences as needed.
-void XmlUnitTestResultPrinter::OutputXmlCDataSection(::std::ostream* stream,
-                                                     const char* data) {
-  const char* segment = data;
-  *stream << "<![CDATA[";
-  for (;;) {
-    const char* const next_segment = strstr(segment, "]]>");
-    if (next_segment != NULL) {
-      stream->write(
-          segment, static_cast<std::streamsize>(next_segment - segment));
-      *stream << "]]>]]&gt;<![CDATA[";
-      segment = next_segment + strlen("]]>");
-    } else {
-      *stream << segment;
-      break;
-    }
-  }
-  *stream << "]]>";
-}
-
-// Prints an XML representation of a TestInfo object.
-// TODO(wan): There is also value in printing properties with the plain printer.
-void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,
-                                                 const char* test_case_name,
-                                                 const TestInfo& test_info) {
-  const TestResult& result = *test_info.result();
-  *stream << "    <testcase name=\""
-          << EscapeXmlAttribute(test_info.name()).c_str()
-          << "\" status=\""
-          << (test_info.should_run() ? "run" : "notrun")
-          << "\" time=\""
-          << FormatTimeInMillisAsSeconds(result.elapsed_time())
-          << "\" classname=\"" << EscapeXmlAttribute(test_case_name).c_str()
-          << "\"" << TestPropertiesAsXmlAttributes(result).c_str();
-
-  int failures = 0;
-  for (int i = 0; i < result.total_part_count(); ++i) {
-    const TestPartResult& part = result.GetTestPartResult(i);
-    if (part.failed()) {
-      if (++failures == 1)
-        *stream << ">\n";
-      *stream << "      <failure message=\""
-              << EscapeXmlAttribute(part.summary()).c_str()
-              << "\" type=\"\">";
-      const String message = RemoveInvalidXmlCharacters(String::Format(
-          "%s:%d\n%s",
-          part.file_name(), part.line_number(),
-          part.message()).c_str());
-      OutputXmlCDataSection(stream, message.c_str());
-      *stream << "</failure>\n";
-    }
-  }
-
-  if (failures == 0)
-    *stream << " />\n";
-  else
-    *stream << "    </testcase>\n";
-}
-
-// Prints an XML representation of a TestCase object
-void XmlUnitTestResultPrinter::PrintXmlTestCase(FILE* out,
-                                                const TestCase& test_case) {
-  fprintf(out,
-          "  <testsuite name=\"%s\" tests=\"%d\" failures=\"%d\" "
-          "disabled=\"%d\" ",
-          EscapeXmlAttribute(test_case.name()).c_str(),
-          test_case.total_test_count(),
-          test_case.failed_test_count(),
-          test_case.disabled_test_count());
-  fprintf(out,
-          "errors=\"0\" time=\"%s\">\n",
-          FormatTimeInMillisAsSeconds(test_case.elapsed_time()));
-  for (int i = 0; i < test_case.total_test_count(); ++i) {
-    StrStream stream;
-    OutputXmlTestInfo(&stream, test_case.name(), *test_case.GetTestInfo(i));
-    fprintf(out, "%s", StrStreamToString(&stream).c_str());
-  }
-  fprintf(out, "  </testsuite>\n");
-}
-
-// Prints an XML summary of unit_test to output stream out.
-void XmlUnitTestResultPrinter::PrintXmlUnitTest(FILE* out,
-                                                const UnitTest& unit_test) {
-  fprintf(out, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
-  fprintf(out,
-          "<testsuites tests=\"%d\" failures=\"%d\" disabled=\"%d\" "
-          "errors=\"0\" time=\"%s\" ",
-          unit_test.total_test_count(),
-          unit_test.failed_test_count(),
-          unit_test.disabled_test_count(),
-          FormatTimeInMillisAsSeconds(unit_test.elapsed_time()));
-  if (GTEST_FLAG(shuffle)) {
-    fprintf(out, "random_seed=\"%d\" ", unit_test.random_seed());
-  }
-  fprintf(out, "name=\"AllTests\">\n");
-  for (int i = 0; i < unit_test.total_test_case_count(); ++i)
-    PrintXmlTestCase(out, *unit_test.GetTestCase(i));
-  fprintf(out, "</testsuites>\n");
-}
-
-// Produces a string representing the test properties in a result as space
-// delimited XML attributes based on the property key="value" pairs.
-String XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes(
-    const TestResult& result) {
-  Message attributes;
-  for (int i = 0; i < result.test_property_count(); ++i) {
-    const TestProperty& property = result.GetTestProperty(i);
-    attributes << " " << property.key() << "="
-        << "\"" << EscapeXmlAttribute(property.value()) << "\"";
-  }
-  return attributes.GetString();
-}
-
-// End XmlUnitTestResultPrinter
-
-// Class ScopedTrace
-
-// Pushes the given source file location and message onto a per-thread
-// trace stack maintained by Google Test.
-// L < UnitTest::mutex_
-ScopedTrace::ScopedTrace(const char* file, int line, const Message& message) {
-  TraceInfo trace;
-  trace.file = file;
-  trace.line = line;
-  trace.message = message.GetString();
-
-  UnitTest::GetInstance()->PushGTestTrace(trace);
-}
-
-// Pops the info pushed by the c'tor.
-// L < UnitTest::mutex_
-ScopedTrace::~ScopedTrace() {
-  UnitTest::GetInstance()->PopGTestTrace();
-}
-
-
-// class OsStackTraceGetter
-
-// Returns the current OS stack trace as a String.  Parameters:
-//
-//   max_depth  - the maximum number of stack frames to be included
-//                in the trace.
-//   skip_count - the number of top frames to be skipped; doesn't count
-//                against max_depth.
-//
-// L < mutex_
-// We use "L < mutex_" to denote that the function may acquire mutex_.
-String OsStackTraceGetter::CurrentStackTrace(int, int) {
-  return String("");
-}
-
-// L < mutex_
-void OsStackTraceGetter::UponLeavingGTest() {
-}
-
-const char* const
-OsStackTraceGetter::kElidedFramesMarker =
-    "... " GTEST_NAME_ " internal frames ...";
-
-}  // namespace internal
-
-// class TestEventListeners
-
-TestEventListeners::TestEventListeners()
-    : repeater_(new internal::TestEventRepeater()),
-      default_result_printer_(NULL),
-      default_xml_generator_(NULL) {
-}
-
-TestEventListeners::~TestEventListeners() { delete repeater_; }
-
-// Returns the standard listener responsible for the default console
-// output.  Can be removed from the listeners list to shut down default
-// console output.  Note that removing this object from the listener list
-// with Release transfers its ownership to the user.
-void TestEventListeners::Append(TestEventListener* listener) {
-  repeater_->Append(listener);
-}
-
-// Removes the given event listener from the list and returns it.  It then
-// becomes the caller's responsibility to delete the listener. Returns
-// NULL if the listener is not found in the list.
-TestEventListener* TestEventListeners::Release(TestEventListener* listener) {
-  if (listener == default_result_printer_)
-    default_result_printer_ = NULL;
-  else if (listener == default_xml_generator_)
-    default_xml_generator_ = NULL;
-  return repeater_->Release(listener);
-}
-
-// Returns repeater that broadcasts the TestEventListener events to all
-// subscribers.
-TestEventListener* TestEventListeners::repeater() { return repeater_; }
-
-// Sets the default_result_printer attribute to the provided listener.
-// The listener is also added to the listener list and previous
-// default_result_printer is removed from it and deleted. The listener can
-// also be NULL in which case it will not be added to the list. Does
-// nothing if the previous and the current listener objects are the same.
-void TestEventListeners::SetDefaultResultPrinter(TestEventListener* listener) {
-  if (default_result_printer_ != listener) {
-    // It is an error to pass this method a listener that is already in the
-    // list.
-    delete Release(default_result_printer_);
-    default_result_printer_ = listener;
-    if (listener != NULL)
-      Append(listener);
-  }
-}
-
-// Sets the default_xml_generator attribute to the provided listener.  The
-// listener is also added to the listener list and previous
-// default_xml_generator is removed from it and deleted. The listener can
-// also be NULL in which case it will not be added to the list. Does
-// nothing if the previous and the current listener objects are the same.
-void TestEventListeners::SetDefaultXmlGenerator(TestEventListener* listener) {
-  if (default_xml_generator_ != listener) {
-    // It is an error to pass this method a listener that is already in the
-    // list.
-    delete Release(default_xml_generator_);
-    default_xml_generator_ = listener;
-    if (listener != NULL)
-      Append(listener);
-  }
-}
-
-// Controls whether events will be forwarded by the repeater to the
-// listeners in the list.
-bool TestEventListeners::EventForwardingEnabled() const {
-  return repeater_->forwarding_enabled();
-}
-
-void TestEventListeners::SuppressEventForwarding() {
-  repeater_->set_forwarding_enabled(false);
-}
-
-// class UnitTest
-
-// Gets the singleton UnitTest object.  The first time this method is
-// called, a UnitTest object is constructed and returned.  Consecutive
-// calls will return the same object.
-//
-// We don't protect this under mutex_ as a user is not supposed to
-// call this before main() starts, from which point on the return
-// value will never change.
-UnitTest * UnitTest::GetInstance() {
-  // When compiled with MSVC 7.1 in optimized mode, destroying the
-  // UnitTest object upon exiting the program messes up the exit code,
-  // causing successful tests to appear failed.  We have to use a
-  // different implementation in this case to bypass the compiler bug.
-  // This implementation makes the compiler happy, at the cost of
-  // leaking the UnitTest object.
-
-  // CodeGear C++Builder insists on a public destructor for the
-  // default implementation.  Use this implementation to keep good OO
-  // design with private destructor.
-
-#if (_MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__)
-  static UnitTest* const instance = new UnitTest;
-  return instance;
-#else
-  static UnitTest instance;
-  return &instance;
-#endif  // (_MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__)
-}
-
-// Gets the number of successful test cases.
-int UnitTest::successful_test_case_count() const {
-  return impl()->successful_test_case_count();
-}
-
-// Gets the number of failed test cases.
-int UnitTest::failed_test_case_count() const {
-  return impl()->failed_test_case_count();
-}
-
-// Gets the number of all test cases.
-int UnitTest::total_test_case_count() const {
-  return impl()->total_test_case_count();
-}
-
-// Gets the number of all test cases that contain at least one test
-// that should run.
-int UnitTest::test_case_to_run_count() const {
-  return impl()->test_case_to_run_count();
-}
-
-// Gets the number of successful tests.
-int UnitTest::successful_test_count() const {
-  return impl()->successful_test_count();
-}
-
-// Gets the number of failed tests.
-int UnitTest::failed_test_count() const { return impl()->failed_test_count(); }
-
-// Gets the number of disabled tests.
-int UnitTest::disabled_test_count() const {
-  return impl()->disabled_test_count();
-}
-
-// Gets the number of all tests.
-int UnitTest::total_test_count() const { return impl()->total_test_count(); }
-
-// Gets the number of tests that should run.
-int UnitTest::test_to_run_count() const { return impl()->test_to_run_count(); }
-
-// Gets the elapsed time, in milliseconds.
-internal::TimeInMillis UnitTest::elapsed_time() const {
-  return impl()->elapsed_time();
-}
-
-// Returns true iff the unit test passed (i.e. all test cases passed).
-bool UnitTest::Passed() const { return impl()->Passed(); }
-
-// Returns true iff the unit test failed (i.e. some test case failed
-// or something outside of all tests failed).
-bool UnitTest::Failed() const { return impl()->Failed(); }
-
-// Gets the i-th test case among all the test cases. i can range from 0 to
-// total_test_case_count() - 1. If i is not in that range, returns NULL.
-const TestCase* UnitTest::GetTestCase(int i) const {
-  return impl()->GetTestCase(i);
-}
-
-// Gets the i-th test case among all the test cases. i can range from 0 to
-// total_test_case_count() - 1. If i is not in that range, returns NULL.
-TestCase* UnitTest::GetMutableTestCase(int i) {
-  return impl()->GetMutableTestCase(i);
-}
-
-// Returns the list of event listeners that can be used to track events
-// inside Google Test.
-TestEventListeners& UnitTest::listeners() {
-  return *impl()->listeners();
-}
-
-// Registers and returns a global test environment.  When a test
-// program is run, all global test environments will be set-up in the
-// order they were registered.  After all tests in the program have
-// finished, all global test environments will be torn-down in the
-// *reverse* order they were registered.
-//
-// The UnitTest object takes ownership of the given environment.
-//
-// We don't protect this under mutex_, as we only support calling it
-// from the main thread.
-Environment* UnitTest::AddEnvironment(Environment* env) {
-  if (env == NULL) {
-    return NULL;
-  }
-
-  impl_->environments()->PushBack(env);
-  impl_->environments_in_reverse_order()->PushFront(env);
-  return env;
-}
-
-#if GTEST_HAS_EXCEPTIONS
-// A failed Google Test assertion will throw an exception of this type
-// when exceptions are enabled.  We derive it from std::runtime_error,
-// which is for errors presumably detectable only at run time.  Since
-// std::runtime_error inherits from std::exception, many testing
-// frameworks know how to extract and print the message inside it.
-class GoogleTestFailureException : public ::std::runtime_error {
- public:
-  explicit GoogleTestFailureException(const TestPartResult& failure)
-      : ::std::runtime_error(PrintTestPartResultToString(failure).c_str()) {}
-};
-#endif
-
-// Adds a TestPartResult to the current TestResult object.  All Google Test
-// assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc) eventually call
-// this to report their results.  The user code should use the
-// assertion macros instead of calling this directly.
-// L < mutex_
-void UnitTest::AddTestPartResult(TestPartResult::Type result_type,
-                                 const char* file_name,
-                                 int line_number,
-                                 const internal::String& message,
-                                 const internal::String& os_stack_trace) {
-  Message msg;
-  msg << message;
-
-  internal::MutexLock lock(&mutex_);
-  if (impl_->gtest_trace_stack()->size() > 0) {
-    msg << "\n" << GTEST_NAME_ << " trace:";
-
-    for (int i = 0; i < impl_->gtest_trace_stack()->size(); i++) {
-      const internal::TraceInfo& trace =
-          impl_->gtest_trace_stack()->GetElement(i);
-      msg << "\n" << internal::FormatFileLocation(trace.file, trace.line)
-          << " " << trace.message;
-    }
-  }
-
-  if (os_stack_trace.c_str() != NULL && !os_stack_trace.empty()) {
-    msg << internal::kStackTraceMarker << os_stack_trace;
-  }
-
-  const TestPartResult result =
-    TestPartResult(result_type, file_name, line_number,
-                   msg.GetString().c_str());
-  impl_->GetTestPartResultReporterForCurrentThread()->
-      ReportTestPartResult(result);
-
-  if (result_type != TestPartResult::kSuccess) {
-    // gtest_break_on_failure takes precedence over
-    // gtest_throw_on_failure.  This allows a user to set the latter
-    // in the code (perhaps in order to use Google Test assertions
-    // with another testing framework) and specify the former on the
-    // command line for debugging.
-    if (GTEST_FLAG(break_on_failure)) {
-#if GTEST_OS_WINDOWS
-      // Using DebugBreak on Windows allows gtest to still break into a debugger
-      // when a failure happens and both the --gtest_break_on_failure and
-      // the --gtest_catch_exceptions flags are specified.
-      DebugBreak();
-#else
-      *static_cast<int*>(NULL) = 1;
-#endif  // GTEST_OS_WINDOWS
-    } else if (GTEST_FLAG(throw_on_failure)) {
-#if GTEST_HAS_EXCEPTIONS
-      throw GoogleTestFailureException(result);
-#else
-      // We cannot call abort() as it generates a pop-up in debug mode
-      // that cannot be suppressed in VC 7.1 or below.
-      exit(1);
-#endif
-    }
-  }
-}
-
-// Creates and adds a property to the current TestResult. If a property matching
-// the supplied value already exists, updates its value instead.
-void UnitTest::RecordPropertyForCurrentTest(const char* key,
-                                            const char* value) {
-  const TestProperty test_property(key, value);
-  impl_->current_test_result()->RecordProperty(test_property);
-}
-
-// Runs all tests in this UnitTest object and prints the result.
-// Returns 0 if successful, or 1 otherwise.
-//
-// We don't protect this under mutex_, as we only support calling it
-// from the main thread.
-int UnitTest::Run() {
-#if GTEST_HAS_SEH
-  // Catch SEH-style exceptions.
-
-  const bool in_death_test_child_process =
-      internal::GTEST_FLAG(internal_run_death_test).length() > 0;
-
-  // Either the user wants Google Test to catch exceptions thrown by the
-  // tests or this is executing in the context of death test child
-  // process. In either case the user does not want to see pop-up dialogs
-  // about crashes - they are expected..
-  if (GTEST_FLAG(catch_exceptions) || in_death_test_child_process) {
-#if !GTEST_OS_WINDOWS_MOBILE
-    // SetErrorMode doesn't exist on CE.
-    SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT |
-                 SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);
-#endif  // !GTEST_OS_WINDOWS_MOBILE
-
-#if (defined(_MSC_VER) || GTEST_OS_WINDOWS_MINGW) && !GTEST_OS_WINDOWS_MOBILE
-    // Death test children can be terminated with _abort().  On Windows,
-    // _abort() can show a dialog with a warning message.  This forces the
-    // abort message to go to stderr instead.
-    _set_error_mode(_OUT_TO_STDERR);
-#endif
-
-#if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE
-    // In the debug version, Visual Studio pops up a separate dialog
-    // offering a choice to debug the aborted program. We need to suppress
-    // this dialog or it will pop up for every EXPECT/ASSERT_DEATH statement
-    // executed. Google Test will notify the user of any unexpected
-    // failure via stderr.
-    //
-    // VC++ doesn't define _set_abort_behavior() prior to the version 8.0.
-    // Users of prior VC versions shall suffer the agony and pain of
-    // clicking through the countless debug dialogs.
-    // TODO(vladl@google.com): find a way to suppress the abort dialog() in the
-    // debug mode when compiled with VC 7.1 or lower.
-    if (!GTEST_FLAG(break_on_failure))
-      _set_abort_behavior(
-          0x0,                                    // Clear the following flags:
-          _WRITE_ABORT_MSG | _CALL_REPORTFAULT);  // pop-up window, core dump.
-#endif
-  }
-
-  __try {
-    return impl_->RunAllTests();
-  } __except(internal::UnitTestOptions::GTestShouldProcessSEH(
-      GetExceptionCode())) {
-    printf("Exception thrown with code 0x%x.\nFAIL\n", GetExceptionCode());
-    fflush(stdout);
-    return 1;
-  }
-
-#else  // We are on a compiler or platform that doesn't support SEH.
-
-  return impl_->RunAllTests();
-#endif  // GTEST_HAS_SEH
-}
-
-// Returns the working directory when the first TEST() or TEST_F() was
-// executed.
-const char* UnitTest::original_working_dir() const {
-  return impl_->original_working_dir_.c_str();
-}
-
-// Returns the TestCase object for the test that's currently running,
-// or NULL if no test is running.
-// L < mutex_
-const TestCase* UnitTest::current_test_case() const {
-  internal::MutexLock lock(&mutex_);
-  return impl_->current_test_case();
-}
-
-// Returns the TestInfo object for the test that's currently running,
-// or NULL if no test is running.
-// L < mutex_
-const TestInfo* UnitTest::current_test_info() const {
-  internal::MutexLock lock(&mutex_);
-  return impl_->current_test_info();
-}
-
-// Returns the random seed used at the start of the current test run.
-int UnitTest::random_seed() const { return impl_->random_seed(); }
-
-#if GTEST_HAS_PARAM_TEST
-// Returns ParameterizedTestCaseRegistry object used to keep track of
-// value-parameterized tests and instantiate and register them.
-// L < mutex_
-internal::ParameterizedTestCaseRegistry&
-    UnitTest::parameterized_test_registry() {
-  return impl_->parameterized_test_registry();
-}
-#endif  // GTEST_HAS_PARAM_TEST
-
-// Creates an empty UnitTest.
-UnitTest::UnitTest() {
-  impl_ = new internal::UnitTestImpl(this);
-}
-
-// Destructor of UnitTest.
-UnitTest::~UnitTest() {
-  delete impl_;
-}
-
-// Pushes a trace defined by SCOPED_TRACE() on to the per-thread
-// Google Test trace stack.
-// L < mutex_
-void UnitTest::PushGTestTrace(const internal::TraceInfo& trace) {
-  internal::MutexLock lock(&mutex_);
-  impl_->gtest_trace_stack()->PushFront(trace);
-}
-
-// Pops a trace from the per-thread Google Test trace stack.
-// L < mutex_
-void UnitTest::PopGTestTrace() {
-  internal::MutexLock lock(&mutex_);
-  impl_->gtest_trace_stack()->PopFront(NULL);
-}
-
-namespace internal {
-
-UnitTestImpl::UnitTestImpl(UnitTest* parent)
-    : parent_(parent),
-#ifdef _MSC_VER
-#pragma warning(push)                    // Saves the current warning state.
-#pragma warning(disable:4355)            // Temporarily disables warning 4355
-                                         // (using this in initializer).
-      default_global_test_part_result_reporter_(this),
-      default_per_thread_test_part_result_reporter_(this),
-#pragma warning(pop)                     // Restores the warning state again.
-#else
-      default_global_test_part_result_reporter_(this),
-      default_per_thread_test_part_result_reporter_(this),
-#endif  // _MSC_VER
-      global_test_part_result_repoter_(
-          &default_global_test_part_result_reporter_),
-      per_thread_test_part_result_reporter_(
-          &default_per_thread_test_part_result_reporter_),
-#if GTEST_HAS_PARAM_TEST
-      parameterized_test_registry_(),
-      parameterized_tests_registered_(false),
-#endif  // GTEST_HAS_PARAM_TEST
-      last_death_test_case_(-1),
-      current_test_case_(NULL),
-      current_test_info_(NULL),
-      ad_hoc_test_result_(),
-      os_stack_trace_getter_(NULL),
-      post_flag_parse_init_performed_(false),
-      random_seed_(0),  // Will be overridden by the flag before first use.
-      random_(0),  // Will be reseeded before first use.
-#if GTEST_HAS_DEATH_TEST
-      elapsed_time_(0),
-      internal_run_death_test_flag_(NULL),
-      death_test_factory_(new DefaultDeathTestFactory) {
-#else
-      elapsed_time_(0) {
-#endif  // GTEST_HAS_DEATH_TEST
-  listeners()->SetDefaultResultPrinter(new PrettyUnitTestResultPrinter);
-}
-
-UnitTestImpl::~UnitTestImpl() {
-  // Deletes every TestCase.
-  test_cases_.ForEach(internal::Delete<TestCase>);
-
-  // Deletes every Environment.
-  environments_.ForEach(internal::Delete<Environment>);
-
-  delete os_stack_trace_getter_;
-}
-
-#if GTEST_HAS_DEATH_TEST
-// Disables event forwarding if the control is currently in a death test
-// subprocess. Must not be called before InitGoogleTest.
-void UnitTestImpl::SuppressTestEventsIfInSubprocess() {
-  if (internal_run_death_test_flag_.get() != NULL)
-    listeners()->SuppressEventForwarding();
-}
-#endif  // GTEST_HAS_DEATH_TEST
-
-// Initializes event listeners performing XML output as specified by
-// UnitTestOptions. Must not be called before InitGoogleTest.
-void UnitTestImpl::ConfigureXmlOutput() {
-  const String& output_format = UnitTestOptions::GetOutputFormat();
-  if (output_format == "xml") {
-    listeners()->SetDefaultXmlGenerator(new XmlUnitTestResultPrinter(
-        UnitTestOptions::GetAbsolutePathToOutputFile().c_str()));
-  } else if (output_format != "") {
-    printf("WARNING: unrecognized output format \"%s\" ignored.\n",
-           output_format.c_str());
-    fflush(stdout);
-  }
-}
-
-// Performs initialization dependent upon flag values obtained in
-// ParseGoogleTestFlagsOnly.  Is called from InitGoogleTest after the call to
-// ParseGoogleTestFlagsOnly.  In case a user neglects to call InitGoogleTest
-// this function is also called from RunAllTests.  Since this function can be
-// called more than once, it has to be idempotent.
-void UnitTestImpl::PostFlagParsingInit() {
-  // Ensures that this function does not execute more than once.
-  if (!post_flag_parse_init_performed_) {
-    post_flag_parse_init_performed_ = true;
-
-#if GTEST_HAS_DEATH_TEST
-    InitDeathTestSubprocessControlInfo();
-    SuppressTestEventsIfInSubprocess();
-#endif  // GTEST_HAS_DEATH_TEST
-
-    // Registers parameterized tests. This makes parameterized tests
-    // available to the UnitTest reflection API without running
-    // RUN_ALL_TESTS.
-    RegisterParameterizedTests();
-
-    // Configures listeners for XML output. This makes it possible for users
-    // to shut down the default XML output before invoking RUN_ALL_TESTS.
-    ConfigureXmlOutput();
-  }
-}
-
-// A predicate that checks the name of a TestCase against a known
-// value.
-//
-// This is used for implementation of the UnitTest class only.  We put
-// it in the anonymous namespace to prevent polluting the outer
-// namespace.
-//
-// TestCaseNameIs is copyable.
-class TestCaseNameIs {
- public:
-  // Constructor.
-  explicit TestCaseNameIs(const String& name)
-      : name_(name) {}
-
-  // Returns true iff the name of test_case matches name_.
-  bool operator()(const TestCase* test_case) const {
-    return test_case != NULL && strcmp(test_case->name(), name_.c_str()) == 0;
-  }
-
- private:
-  String name_;
-};
-
-// Finds and returns a TestCase with the given name.  If one doesn't
-// exist, creates one and returns it.  It's the CALLER'S
-// RESPONSIBILITY to ensure that this function is only called WHEN THE
-// TESTS ARE NOT SHUFFLED.
-//
-// Arguments:
-//
-//   test_case_name: name of the test case
-//   set_up_tc:      pointer to the function that sets up the test case
-//   tear_down_tc:   pointer to the function that tears down the test case
-TestCase* UnitTestImpl::GetTestCase(const char* test_case_name,
-                                    const char* comment,
-                                    Test::SetUpTestCaseFunc set_up_tc,
-                                    Test::TearDownTestCaseFunc tear_down_tc) {
-  // Can we find a TestCase with the given name?
-  TestCase** test_case = test_cases_.FindIf(TestCaseNameIs(test_case_name));
-
-  if (test_case != NULL)
-    return *test_case;
-
-  // No.  Let's create one.
-  TestCase* const new_test_case =
-      new TestCase(test_case_name, comment, set_up_tc, tear_down_tc);
-
-  // Is this a death test case?
-  if (internal::UnitTestOptions::MatchesFilter(String(test_case_name),
-                                               kDeathTestCaseFilter)) {
-    // Yes.  Inserts the test case after the last death test case
-    // defined so far.  This only works when the test cases haven't
-    // been shuffled.  Otherwise we may end up running a death test
-    // after a non-death test.
-    test_cases_.Insert(new_test_case, ++last_death_test_case_);
-  } else {
-    // No.  Appends to the end of the list.
-    test_cases_.PushBack(new_test_case);
-  }
-
-  test_case_indices_.PushBack(test_case_indices_.size());
-  return new_test_case;
-}
-
-// Helpers for setting up / tearing down the given environment.  They
-// are for use in the Vector::ForEach() method.
-static void SetUpEnvironment(Environment* env) { env->SetUp(); }
-static void TearDownEnvironment(Environment* env) { env->TearDown(); }
-
-// Runs all tests in this UnitTest object, prints the result, and
-// returns 0 if all tests are successful, or 1 otherwise.  If any
-// exception is thrown during a test on Windows, this test is
-// considered to be failed, but the rest of the tests will still be
-// run.  (We disable exceptions on Linux and Mac OS X, so the issue
-// doesn't apply there.)
-// When parameterized tests are enabled, it expands and registers
-// parameterized tests first in RegisterParameterizedTests().
-// All other functions called from RunAllTests() may safely assume that
-// parameterized tests are ready to be counted and run.
-int UnitTestImpl::RunAllTests() {
-  // Makes sure InitGoogleTest() was called.
-  if (!GTestIsInitialized()) {
-    printf("%s",
-           "\nThis test program did NOT call ::testing::InitGoogleTest "
-           "before calling RUN_ALL_TESTS().  Please fix it.\n");
-    return 1;
-  }
-
-  // Do not run any test if the --help flag was specified.
-  if (g_help_flag)
-    return 0;
-
-  // Repeats the call to the post-flag parsing initialization in case the
-  // user didn't call InitGoogleTest.
-  PostFlagParsingInit();
-
-  // Even if sharding is not on, test runners may want to use the
-  // GTEST_SHARD_STATUS_FILE to query whether the test supports the sharding
-  // protocol.
-  internal::WriteToShardStatusFileIfNeeded();
-
-  // True iff we are in a subprocess for running a thread-safe-style
-  // death test.
-  bool in_subprocess_for_death_test = false;
-
-#if GTEST_HAS_DEATH_TEST
-  in_subprocess_for_death_test = (internal_run_death_test_flag_.get() != NULL);
-#endif  // GTEST_HAS_DEATH_TEST
-
-  const bool should_shard = ShouldShard(kTestTotalShards, kTestShardIndex,
-                                        in_subprocess_for_death_test);
-
-  // Compares the full test names with the filter to decide which
-  // tests to run.
-  const bool has_tests_to_run = FilterTests(should_shard
-                                              ? HONOR_SHARDING_PROTOCOL
-                                              : IGNORE_SHARDING_PROTOCOL) > 0;
-
-  // Lists the tests and exits if the --gtest_list_tests flag was specified.
-  if (GTEST_FLAG(list_tests)) {
-    // This must be called *after* FilterTests() has been called.
-    ListTestsMatchingFilter();
-    return 0;
-  }
-
-  random_seed_ = GTEST_FLAG(shuffle) ?
-      GetRandomSeedFromFlag(GTEST_FLAG(random_seed)) : 0;
-
-  // True iff at least one test has failed.
-  bool failed = false;
-
-  TestEventListener* repeater = listeners()->repeater();
-
-  repeater->OnTestProgramStart(*parent_);
-
-  // How many times to repeat the tests?  We don't want to repeat them
-  // when we are inside the subprocess of a death test.
-  const int repeat = in_subprocess_for_death_test ? 1 : GTEST_FLAG(repeat);
-  // Repeats forever if the repeat count is negative.
-  const bool forever = repeat < 0;
-  for (int i = 0; forever || i != repeat; i++) {
-    ClearResult();
-
-    const TimeInMillis start = GetTimeInMillis();
-
-    // Shuffles test cases and tests if requested.
-    if (has_tests_to_run && GTEST_FLAG(shuffle)) {
-      random()->Reseed(random_seed_);
-      // This should be done before calling OnTestIterationStart(),
-      // such that a test event listener can see the actual test order
-      // in the event.
-      ShuffleTests();
-    }
-
-    // Tells the unit test event listeners that the tests are about to start.
-    repeater->OnTestIterationStart(*parent_, i);
-
-    // Runs each test case if there is at least one test to run.
-    if (has_tests_to_run) {
-      // Sets up all environments beforehand.
-      repeater->OnEnvironmentsSetUpStart(*parent_);
-      environments_.ForEach(SetUpEnvironment);
-      repeater->OnEnvironmentsSetUpEnd(*parent_);
-
-      // Runs the tests only if there was no fatal failure during global
-      // set-up.
-      if (!Test::HasFatalFailure()) {
-        for (int i = 0; i < total_test_case_count(); i++) {
-          GetMutableTestCase(i)->Run();
-        }
-      }
-
-      // Tears down all environments in reverse order afterwards.
-      repeater->OnEnvironmentsTearDownStart(*parent_);
-      environments_in_reverse_order_.ForEach(TearDownEnvironment);
-      repeater->OnEnvironmentsTearDownEnd(*parent_);
-    }
-
-    elapsed_time_ = GetTimeInMillis() - start;
-
-    // Tells the unit test event listener that the tests have just finished.
-    repeater->OnTestIterationEnd(*parent_, i);
-
-    // Gets the result and clears it.
-    if (!Passed()) {
-      failed = true;
-    }
-
-    // Restores the original test order after the iteration.  This
-    // allows the user to quickly repro a failure that happens in the
-    // N-th iteration without repeating the first (N - 1) iterations.
-    // This is not enclosed in "if (GTEST_FLAG(shuffle)) { ... }", in
-    // case the user somehow changes the value of the flag somewhere
-    // (it's always safe to unshuffle the tests).
-    UnshuffleTests();
-
-    if (GTEST_FLAG(shuffle)) {
-      // Picks a new random seed for each iteration.
-      random_seed_ = GetNextRandomSeed(random_seed_);
-    }
-  }
-
-  repeater->OnTestProgramEnd(*parent_);
-
-  // Returns 0 if all tests passed, or 1 other wise.
-  return failed ? 1 : 0;
-}
-
-// Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file
-// if the variable is present. If a file already exists at this location, this
-// function will write over it. If the variable is present, but the file cannot
-// be created, prints an error and exits.
-void WriteToShardStatusFileIfNeeded() {
-  const char* const test_shard_file = posix::GetEnv(kTestShardStatusFile);
-  if (test_shard_file != NULL) {
-    FILE* const file = posix::FOpen(test_shard_file, "w");
-    if (file == NULL) {
-      ColoredPrintf(COLOR_RED,
-                    "Could not write to the test shard status file \"%s\" "
-                    "specified by the %s environment variable.\n",
-                    test_shard_file, kTestShardStatusFile);
-      fflush(stdout);
-      exit(EXIT_FAILURE);
-    }
-    fclose(file);
-  }
-}
-
-// Checks whether sharding is enabled by examining the relevant
-// environment variable values. If the variables are present,
-// but inconsistent (i.e., shard_index >= total_shards), prints
-// an error and exits. If in_subprocess_for_death_test, sharding is
-// disabled because it must only be applied to the original test
-// process. Otherwise, we could filter out death tests we intended to execute.
-bool ShouldShard(const char* total_shards_env,
-                 const char* shard_index_env,
-                 bool in_subprocess_for_death_test) {
-  if (in_subprocess_for_death_test) {
-    return false;
-  }
-
-  const Int32 total_shards = Int32FromEnvOrDie(total_shards_env, -1);
-  const Int32 shard_index = Int32FromEnvOrDie(shard_index_env, -1);
-
-  if (total_shards == -1 && shard_index == -1) {
-    return false;
-  } else if (total_shards == -1 && shard_index != -1) {
-    const Message msg = Message()
-      << "Invalid environment variables: you have "
-      << kTestShardIndex << " = " << shard_index
-      << ", but have left " << kTestTotalShards << " unset.\n";
-    ColoredPrintf(COLOR_RED, msg.GetString().c_str());
-    fflush(stdout);
-    exit(EXIT_FAILURE);
-  } else if (total_shards != -1 && shard_index == -1) {
-    const Message msg = Message()
-      << "Invalid environment variables: you have "
-      << kTestTotalShards << " = " << total_shards
-      << ", but have left " << kTestShardIndex << " unset.\n";
-    ColoredPrintf(COLOR_RED, msg.GetString().c_str());
-    fflush(stdout);
-    exit(EXIT_FAILURE);
-  } else if (shard_index < 0 || shard_index >= total_shards) {
-    const Message msg = Message()
-      << "Invalid environment variables: we require 0 <= "
-      << kTestShardIndex << " < " << kTestTotalShards
-      << ", but you have " << kTestShardIndex << "=" << shard_index
-      << ", " << kTestTotalShards << "=" << total_shards << ".\n";
-    ColoredPrintf(COLOR_RED, msg.GetString().c_str());
-    fflush(stdout);
-    exit(EXIT_FAILURE);
-  }
-
-  return total_shards > 1;
-}
-
-// Parses the environment variable var as an Int32. If it is unset,
-// returns default_val. If it is not an Int32, prints an error
-// and aborts.
-Int32 Int32FromEnvOrDie(const char* const var, Int32 default_val) {
-  const char* str_val = posix::GetEnv(var);
-  if (str_val == NULL) {
-    return default_val;
-  }
-
-  Int32 result;
-  if (!ParseInt32(Message() << "The value of environment variable " << var,
-                  str_val, &result)) {
-    exit(EXIT_FAILURE);
-  }
-  return result;
-}
-
-// Given the total number of shards, the shard index, and the test id,
-// returns true iff the test should be run on this shard. The test id is
-// some arbitrary but unique non-negative integer assigned to each test
-// method. Assumes that 0 <= shard_index < total_shards.
-bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id) {
-  return (test_id % total_shards) == shard_index;
-}
-
-// Compares the name of each test with the user-specified filter to
-// decide whether the test should be run, then records the result in
-// each TestCase and TestInfo object.
-// If shard_tests == true, further filters tests based on sharding
-// variables in the environment - see
-// http://code.google.com/p/googletest/wiki/GoogleTestAdvancedGuide.
-// Returns the number of tests that should run.
-int UnitTestImpl::FilterTests(ReactionToSharding shard_tests) {
-  const Int32 total_shards = shard_tests == HONOR_SHARDING_PROTOCOL ?
-      Int32FromEnvOrDie(kTestTotalShards, -1) : -1;
-  const Int32 shard_index = shard_tests == HONOR_SHARDING_PROTOCOL ?
-      Int32FromEnvOrDie(kTestShardIndex, -1) : -1;
-
-  // num_runnable_tests are the number of tests that will
-  // run across all shards (i.e., match filter and are not disabled).
-  // num_selected_tests are the number of tests to be run on
-  // this shard.
-  int num_runnable_tests = 0;
-  int num_selected_tests = 0;
-  for (int i = 0; i < test_cases_.size(); i++) {
-    TestCase* const test_case = test_cases_.GetElement(i);
-    const String &test_case_name = test_case->name();
-    test_case->set_should_run(false);
-
-    for (int j = 0; j < test_case->test_info_list().size(); j++) {
-      TestInfo* const test_info = test_case->test_info_list().GetElement(j);
-      const String test_name(test_info->name());
-      // A test is disabled if test case name or test name matches
-      // kDisableTestFilter.
-      const bool is_disabled =
-          internal::UnitTestOptions::MatchesFilter(test_case_name,
-                                                   kDisableTestFilter) ||
-          internal::UnitTestOptions::MatchesFilter(test_name,
-                                                   kDisableTestFilter);
-      test_info->impl()->set_is_disabled(is_disabled);
-
-      const bool matches_filter =
-          internal::UnitTestOptions::FilterMatchesTest(test_case_name,
-                                                       test_name);
-      test_info->impl()->set_matches_filter(matches_filter);
-
-      const bool is_runnable =
-          (GTEST_FLAG(also_run_disabled_tests) || !is_disabled) &&
-          matches_filter;
-
-      const bool is_selected = is_runnable &&
-          (shard_tests == IGNORE_SHARDING_PROTOCOL ||
-           ShouldRunTestOnShard(total_shards, shard_index,
-                                num_runnable_tests));
-
-      num_runnable_tests += is_runnable;
-      num_selected_tests += is_selected;
-
-      test_info->impl()->set_should_run(is_selected);
-      test_case->set_should_run(test_case->should_run() || is_selected);
-    }
-  }
-  return num_selected_tests;
-}
-
-// Prints the names of the tests matching the user-specified filter flag.
-void UnitTestImpl::ListTestsMatchingFilter() {
-  for (int i = 0; i < test_cases_.size(); i++) {
-    const TestCase* const test_case = test_cases_.GetElement(i);
-    bool printed_test_case_name = false;
-
-    for (int j = 0; j < test_case->test_info_list().size(); j++) {
-      const TestInfo* const test_info =
-          test_case->test_info_list().GetElement(j);
-      if (test_info->matches_filter()) {
-        if (!printed_test_case_name) {
-          printed_test_case_name = true;
-          printf("%s.\n", test_case->name());
-        }
-        printf("  %s\n", test_info->name());
-      }
-    }
-  }
-  fflush(stdout);
-}
-
-// Sets the OS stack trace getter.
-//
-// Does nothing if the input and the current OS stack trace getter are
-// the same; otherwise, deletes the old getter and makes the input the
-// current getter.
-void UnitTestImpl::set_os_stack_trace_getter(
-    OsStackTraceGetterInterface* getter) {
-  if (os_stack_trace_getter_ != getter) {
-    delete os_stack_trace_getter_;
-    os_stack_trace_getter_ = getter;
-  }
-}
-
-// Returns the current OS stack trace getter if it is not NULL;
-// otherwise, creates an OsStackTraceGetter, makes it the current
-// getter, and returns it.
-OsStackTraceGetterInterface* UnitTestImpl::os_stack_trace_getter() {
-  if (os_stack_trace_getter_ == NULL) {
-    os_stack_trace_getter_ = new OsStackTraceGetter;
-  }
-
-  return os_stack_trace_getter_;
-}
-
-// Returns the TestResult for the test that's currently running, or
-// the TestResult for the ad hoc test if no test is running.
-TestResult* UnitTestImpl::current_test_result() {
-  return current_test_info_ ?
-    current_test_info_->impl()->result() : &ad_hoc_test_result_;
-}
-
-// Shuffles all test cases, and the tests within each test case,
-// making sure that death tests are still run first.
-void UnitTestImpl::ShuffleTests() {
-  // Shuffles the death test cases.
-  test_case_indices_.ShuffleRange(random(), 0, last_death_test_case_ + 1);
-
-  // Shuffles the non-death test cases.
-  test_case_indices_.ShuffleRange(random(), last_death_test_case_ + 1,
-                                  test_cases_.size());
-
-  // Shuffles the tests inside each test case.
-  for (int i = 0; i < test_cases_.size(); i++) {
-    test_cases_.GetElement(i)->ShuffleTests(random());
-  }
-}
-
-// Restores the test cases and tests to their order before the first shuffle.
-void UnitTestImpl::UnshuffleTests() {
-  for (int i = 0; i < test_cases_.size(); i++) {
-    // Unshuffles the tests in each test case.
-    test_cases_.GetElement(i)->UnshuffleTests();
-    // Resets the index of each test case.
-    test_case_indices_.GetMutableElement(i) = i;
-  }
-}
-
-// TestInfoImpl constructor. The new instance assumes ownership of the test
-// factory object.
-TestInfoImpl::TestInfoImpl(TestInfo* parent,
-                           const char* test_case_name,
-                           const char* name,
-                           const char* test_case_comment,
-                           const char* comment,
-                           TypeId fixture_class_id,
-                           internal::TestFactoryBase* factory) :
-    parent_(parent),
-    test_case_name_(String(test_case_name)),
-    name_(String(name)),
-    test_case_comment_(String(test_case_comment)),
-    comment_(String(comment)),
-    fixture_class_id_(fixture_class_id),
-    should_run_(false),
-    is_disabled_(false),
-    matches_filter_(false),
-    factory_(factory) {
-}
-
-// TestInfoImpl destructor.
-TestInfoImpl::~TestInfoImpl() {
-  delete factory_;
-}
-
-// Returns the current OS stack trace as a String.
-//
-// The maximum number of stack frames to be included is specified by
-// the gtest_stack_trace_depth flag.  The skip_count parameter
-// specifies the number of top frames to be skipped, which doesn't
-// count against the number of frames to be included.
-//
-// For example, if Foo() calls Bar(), which in turn calls
-// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
-// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
-String GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/,
-                                       int skip_count) {
-  // We pass skip_count + 1 to skip this wrapper function in addition
-  // to what the user really wants to skip.
-  return GetUnitTestImpl()->CurrentOsStackTraceExceptTop(skip_count + 1);
-}
-
-// Used by the GTEST_HIDE_UNREACHABLE_CODE_ macro to suppress unreachable
-// code warnings.
-namespace {
-class ClassUniqueToAlwaysTrue {};
-}
-
-bool IsTrue(bool condition) { return condition; }
-
-bool AlwaysTrue() {
-#if GTEST_HAS_EXCEPTIONS
-  // This condition is always false so AlwaysTrue() never actually throws,
-  // but it makes the compiler think that it may throw.
-  if (IsTrue(false))
-    throw ClassUniqueToAlwaysTrue();
-#endif  // GTEST_HAS_EXCEPTIONS
-  return true;
-}
-
-// If *pstr starts with the given prefix, modifies *pstr to be right
-// past the prefix and returns true; otherwise leaves *pstr unchanged
-// and returns false.  None of pstr, *pstr, and prefix can be NULL.
-bool SkipPrefix(const char* prefix, const char** pstr) {
-  const size_t prefix_len = strlen(prefix);
-  if (strncmp(*pstr, prefix, prefix_len) == 0) {
-    *pstr += prefix_len;
-    return true;
-  }
-  return false;
-}
-
-// Parses a string as a command line flag.  The string should have
-// the format "--flag=value".  When def_optional is true, the "=value"
-// part can be omitted.
-//
-// Returns the value of the flag, or NULL if the parsing failed.
-const char* ParseFlagValue(const char* str,
-                           const char* flag,
-                           bool def_optional) {
-  // str and flag must not be NULL.
-  if (str == NULL || flag == NULL) return NULL;
-
-  // The flag must start with "--" followed by GTEST_FLAG_PREFIX_.
-  const String flag_str = String::Format("--%s%s", GTEST_FLAG_PREFIX_, flag);
-  const size_t flag_len = flag_str.length();
-  if (strncmp(str, flag_str.c_str(), flag_len) != 0) return NULL;
-
-  // Skips the flag name.
-  const char* flag_end = str + flag_len;
-
-  // When def_optional is true, it's OK to not have a "=value" part.
-  if (def_optional && (flag_end[0] == '\0')) {
-    return flag_end;
-  }
-
-  // If def_optional is true and there are more characters after the
-  // flag name, or if def_optional is false, there must be a '=' after
-  // the flag name.
-  if (flag_end[0] != '=') return NULL;
-
-  // Returns the string after "=".
-  return flag_end + 1;
-}
-
-// Parses a string for a bool flag, in the form of either
-// "--flag=value" or "--flag".
-//
-// In the former case, the value is taken as true as long as it does
-// not start with '0', 'f', or 'F'.
-//
-// In the latter case, the value is taken as true.
-//
-// On success, stores the value of the flag in *value, and returns
-// true.  On failure, returns false without changing *value.
-bool ParseBoolFlag(const char* str, const char* flag, bool* value) {
-  // Gets the value of the flag as a string.
-  const char* const value_str = ParseFlagValue(str, flag, true);
-
-  // Aborts if the parsing failed.
-  if (value_str == NULL) return false;
-
-  // Converts the string value to a bool.
-  *value = !(*value_str == '0' || *value_str == 'f' || *value_str == 'F');
-  return true;
-}
-
-// Parses a string for an Int32 flag, in the form of
-// "--flag=value".
-//
-// On success, stores the value of the flag in *value, and returns
-// true.  On failure, returns false without changing *value.
-bool ParseInt32Flag(const char* str, const char* flag, Int32* value) {
-  // Gets the value of the flag as a string.
-  const char* const value_str = ParseFlagValue(str, flag, false);
-
-  // Aborts if the parsing failed.
-  if (value_str == NULL) return false;
-
-  // Sets *value to the value of the flag.
-  return ParseInt32(Message() << "The value of flag --" << flag,
-                    value_str, value);
-}
-
-// Parses a string for a string flag, in the form of
-// "--flag=value".
-//
-// On success, stores the value of the flag in *value, and returns
-// true.  On failure, returns false without changing *value.
-bool ParseStringFlag(const char* str, const char* flag, String* value) {
-  // Gets the value of the flag as a string.
-  const char* const value_str = ParseFlagValue(str, flag, false);
-
-  // Aborts if the parsing failed.
-  if (value_str == NULL) return false;
-
-  // Sets *value to the value of the flag.
-  *value = value_str;
-  return true;
-}
-
-// Determines whether a string has a prefix that Google Test uses for its
-// flags, i.e., starts with GTEST_FLAG_PREFIX_ or GTEST_FLAG_PREFIX_DASH_.
-// If Google Test detects that a command line flag has its prefix but is not
-// recognized, it will print its help message. Flags starting with
-// GTEST_INTERNAL_PREFIX_ followed by "internal_" are considered Google Test
-// internal flags and do not trigger the help message.
-static bool HasGoogleTestFlagPrefix(const char* str) {
-  return (SkipPrefix("--", &str) ||
-          SkipPrefix("-", &str) ||
-          SkipPrefix("/", &str)) &&
-         !SkipPrefix(GTEST_FLAG_PREFIX_ "internal_", &str) &&
-         (SkipPrefix(GTEST_FLAG_PREFIX_, &str) ||
-          SkipPrefix(GTEST_FLAG_PREFIX_DASH_, &str));
-}
-
-// Prints a string containing code-encoded text.  The following escape
-// sequences can be used in the string to control the text color:
-//
-//   @@    prints a single '@' character.
-//   @R    changes the color to red.
-//   @G    changes the color to green.
-//   @Y    changes the color to yellow.
-//   @D    changes to the default terminal text color.
-//
-// TODO(wan@google.com): Write tests for this once we add stdout
-// capturing to Google Test.
-static void PrintColorEncoded(const char* str) {
-  GTestColor color = COLOR_DEFAULT;  // The current color.
-
-  // Conceptually, we split the string into segments divided by escape
-  // sequences.  Then we print one segment at a time.  At the end of
-  // each iteration, the str pointer advances to the beginning of the
-  // next segment.
-  for (;;) {
-    const char* p = strchr(str, '@');
-    if (p == NULL) {
-      ColoredPrintf(color, "%s", str);
-      return;
-    }
-
-    ColoredPrintf(color, "%s", String(str, p - str).c_str());
-
-    const char ch = p[1];
-    str = p + 2;
-    if (ch == '@') {
-      ColoredPrintf(color, "@");
-    } else if (ch == 'D') {
-      color = COLOR_DEFAULT;
-    } else if (ch == 'R') {
-      color = COLOR_RED;
-    } else if (ch == 'G') {
-      color = COLOR_GREEN;
-    } else if (ch == 'Y') {
-      color = COLOR_YELLOW;
-    } else {
-      --str;
-    }
-  }
-}
-
-static const char kColorEncodedHelpMessage[] =
-"This program contains tests written using " GTEST_NAME_ ". You can use the\n"
-"following command line flags to control its behavior:\n"
-"\n"
-"Test Selection:\n"
-"  @G--" GTEST_FLAG_PREFIX_ "list_tests@D\n"
-"      List the names of all tests instead of running them. The name of\n"
-"      TEST(Foo, Bar) is \"Foo.Bar\".\n"
-"  @G--" GTEST_FLAG_PREFIX_ "filter=@YPOSTIVE_PATTERNS"
-    "[@G-@YNEGATIVE_PATTERNS]@D\n"
-"      Run only the tests whose name matches one of the positive patterns but\n"
-"      none of the negative patterns. '?' matches any single character; '*'\n"
-"      matches any substring; ':' separates two patterns.\n"
-"  @G--" GTEST_FLAG_PREFIX_ "also_run_disabled_tests@D\n"
-"      Run all disabled tests too.\n"
-"\n"
-"Test Execution:\n"
-"  @G--" GTEST_FLAG_PREFIX_ "repeat=@Y[COUNT]@D\n"
-"      Run the tests repeatedly; use a negative count to repeat forever.\n"
-"  @G--" GTEST_FLAG_PREFIX_ "shuffle@D\n"
-"      Randomize tests' orders on every iteration.\n"
-"  @G--" GTEST_FLAG_PREFIX_ "random_seed=@Y[NUMBER]@D\n"
-"      Random number seed to use for shuffling test orders (between 1 and\n"
-"      99999, or 0 to use a seed based on the current time).\n"
-"\n"
-"Test Output:\n"
-"  @G--" GTEST_FLAG_PREFIX_ "color=@Y(@Gyes@Y|@Gno@Y|@Gauto@Y)@D\n"
-"      Enable/disable colored output. The default is @Gauto@D.\n"
-"  -@G-" GTEST_FLAG_PREFIX_ "print_time=0@D\n"
-"      Don't print the elapsed time of each test.\n"
-"  @G--" GTEST_FLAG_PREFIX_ "output=xml@Y[@G:@YDIRECTORY_PATH@G"
-    GTEST_PATH_SEP_ "@Y|@G:@YFILE_PATH]@D\n"
-"      Generate an XML report in the given directory or with the given file\n"
-"      name. @YFILE_PATH@D defaults to @Gtest_details.xml@D.\n"
-"\n"
-"Assertion Behavior:\n"
-#if GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS
-"  @G--" GTEST_FLAG_PREFIX_ "death_test_style=@Y(@Gfast@Y|@Gthreadsafe@Y)@D\n"
-"      Set the default death test style.\n"
-#endif  // GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS
-"  @G--" GTEST_FLAG_PREFIX_ "break_on_failure@D\n"
-"      Turn assertion failures into debugger break-points.\n"
-"  @G--" GTEST_FLAG_PREFIX_ "throw_on_failure@D\n"
-"      Turn assertion failures into C++ exceptions.\n"
-#if GTEST_OS_WINDOWS
-"  @G--" GTEST_FLAG_PREFIX_ "catch_exceptions@D\n"
-"      Suppress pop-ups caused by exceptions.\n"
-#endif  // GTEST_OS_WINDOWS
-"\n"
-"Except for @G--" GTEST_FLAG_PREFIX_ "list_tests@D, you can alternatively set "
-    "the corresponding\n"
-"environment variable of a flag (all letters in upper-case). For example, to\n"
-"disable colored text output, you can either specify @G--" GTEST_FLAG_PREFIX_
-    "color=no@D or set\n"
-"the @G" GTEST_FLAG_PREFIX_UPPER_ "COLOR@D environment variable to @Gno@D.\n"
-"\n"
-"For more information, please read the " GTEST_NAME_ " documentation at\n"
-"@G" GTEST_PROJECT_URL_ "@D. If you find a bug in " GTEST_NAME_ "\n"
-"(not one in your own code or tests), please report it to\n"
-"@G<" GTEST_DEV_EMAIL_ ">@D.\n";
-
-// Parses the command line for Google Test flags, without initializing
-// other parts of Google Test.  The type parameter CharType can be
-// instantiated to either char or wchar_t.
-template <typename CharType>
-void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {
-  for (int i = 1; i < *argc; i++) {
-    const String arg_string = StreamableToString(argv[i]);
-    const char* const arg = arg_string.c_str();
-
-    using internal::ParseBoolFlag;
-    using internal::ParseInt32Flag;
-    using internal::ParseStringFlag;
-
-    // Do we see a Google Test flag?
-    if (ParseBoolFlag(arg, kAlsoRunDisabledTestsFlag,
-                      &GTEST_FLAG(also_run_disabled_tests)) ||
-        ParseBoolFlag(arg, kBreakOnFailureFlag,
-                      &GTEST_FLAG(break_on_failure)) ||
-        ParseBoolFlag(arg, kCatchExceptionsFlag,
-                      &GTEST_FLAG(catch_exceptions)) ||
-        ParseStringFlag(arg, kColorFlag, &GTEST_FLAG(color)) ||
-        ParseStringFlag(arg, kDeathTestStyleFlag,
-                        &GTEST_FLAG(death_test_style)) ||
-        ParseBoolFlag(arg, kDeathTestUseFork,
-                      &GTEST_FLAG(death_test_use_fork)) ||
-        ParseStringFlag(arg, kFilterFlag, &GTEST_FLAG(filter)) ||
-        ParseStringFlag(arg, kInternalRunDeathTestFlag,
-                        &GTEST_FLAG(internal_run_death_test)) ||
-        ParseBoolFlag(arg, kListTestsFlag, &GTEST_FLAG(list_tests)) ||
-        ParseStringFlag(arg, kOutputFlag, &GTEST_FLAG(output)) ||
-        ParseBoolFlag(arg, kPrintTimeFlag, &GTEST_FLAG(print_time)) ||
-        ParseInt32Flag(arg, kRandomSeedFlag, &GTEST_FLAG(random_seed)) ||
-        ParseInt32Flag(arg, kRepeatFlag, &GTEST_FLAG(repeat)) ||
-        ParseBoolFlag(arg, kShuffleFlag, &GTEST_FLAG(shuffle)) ||
-        ParseInt32Flag(arg, kStackTraceDepthFlag,
-                       &GTEST_FLAG(stack_trace_depth)) ||
-        ParseBoolFlag(arg, kThrowOnFailureFlag, &GTEST_FLAG(throw_on_failure))
-        ) {
-      // Yes.  Shift the remainder of the argv list left by one.  Note
-      // that argv has (*argc + 1) elements, the last one always being
-      // NULL.  The following loop moves the trailing NULL element as
-      // well.
-      for (int j = i; j != *argc; j++) {
-        argv[j] = argv[j + 1];
-      }
-
-      // Decrements the argument count.
-      (*argc)--;
-
-      // We also need to decrement the iterator as we just removed
-      // an element.
-      i--;
-    } else if (arg_string == "--help" || arg_string == "-h" ||
-               arg_string == "-?" || arg_string == "/?" ||
-               HasGoogleTestFlagPrefix(arg)) {
-      // Both help flag and unrecognized Google Test flags (excluding
-      // internal ones) trigger help display.
-      g_help_flag = true;
-    }
-  }
-
-  if (g_help_flag) {
-    // We print the help here instead of in RUN_ALL_TESTS(), as the
-    // latter may not be called at all if the user is using Google
-    // Test with another testing framework.
-    PrintColorEncoded(kColorEncodedHelpMessage);
-  }
-}
-
-// Parses the command line for Google Test flags, without initializing
-// other parts of Google Test.
-void ParseGoogleTestFlagsOnly(int* argc, char** argv) {
-  ParseGoogleTestFlagsOnlyImpl(argc, argv);
-}
-void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv) {
-  ParseGoogleTestFlagsOnlyImpl(argc, argv);
-}
-
-// The internal implementation of InitGoogleTest().
-//
-// The type parameter CharType can be instantiated to either char or
-// wchar_t.
-template <typename CharType>
-void InitGoogleTestImpl(int* argc, CharType** argv) {
-  g_init_gtest_count++;
-
-  // We don't want to run the initialization code twice.
-  if (g_init_gtest_count != 1) return;
-
-  if (*argc <= 0) return;
-
-  internal::g_executable_path = internal::StreamableToString(argv[0]);
-
-#if GTEST_HAS_DEATH_TEST
-  g_argvs.clear();
-  for (int i = 0; i != *argc; i++) {
-    g_argvs.push_back(StreamableToString(argv[i]));
-  }
-#endif  // GTEST_HAS_DEATH_TEST
-
-  ParseGoogleTestFlagsOnly(argc, argv);
-  GetUnitTestImpl()->PostFlagParsingInit();
-}
-
-}  // namespace internal
-
-// Initializes Google Test.  This must be called before calling
-// RUN_ALL_TESTS().  In particular, it parses a command line for the
-// flags that Google Test recognizes.  Whenever a Google Test flag is
-// seen, it is removed from argv, and *argc is decremented.
-//
-// No value is returned.  Instead, the Google Test flag variables are
-// updated.
-//
-// Calling the function for the second time has no user-visible effect.
-void InitGoogleTest(int* argc, char** argv) {
-  internal::InitGoogleTestImpl(argc, argv);
-}
-
-// This overloaded version can be used in Windows programs compiled in
-// UNICODE mode.
-void InitGoogleTest(int* argc, wchar_t** argv) {
-  internal::InitGoogleTestImpl(argc, argv);
-}
-
-}  // namespace testing
diff --git a/third_party/gtest/src/gtest_main.cc b/third_party/gtest/src/gtest_main.cc
deleted file mode 100644
index d20c02f..0000000
--- a/third_party/gtest/src/gtest_main.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include <iostream>
-
-#include <gtest/gtest.h>
-
-int main(int argc, char **argv) {
-  std::cout << "Running main() from gtest_main.cc\n";
-
-  testing::InitGoogleTest(&argc, argv);
-  return RUN_ALL_TESTS();
-}
diff --git a/third_party/lzma/build.scons b/third_party/lzma/build.scons
deleted file mode 100644
index 1eb3845..0000000
--- a/third_party/lzma/build.scons
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-env.BuildSConscript('v4_65')
diff --git a/third_party/lzma/v4_43/LzmaStateDecode.c b/third_party/lzma/v4_43/LzmaStateDecode.c
deleted file mode 100644
index b37ba51..0000000
--- a/third_party/lzma/v4_43/LzmaStateDecode.c
+++ /dev/null
@@ -1,527 +0,0 @@
-/*
-  LzmaStateDecode.c
-  LZMA Decoder (State version)
-  
-  LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01)
-  http://www.7-zip.org/
-
-  LZMA SDK is licensed under two licenses:
-  1) GNU Lesser General Public License (GNU LGPL)
-  2) Common Public License (CPL)
-  It means that you can select one of these two licenses and 
-  follow rules of that license.
-
-  SPECIAL EXCEPTION:
-  Igor Pavlov, as the author of this Code, expressly permits you to 
-  statically or dynamically link your Code (or bind by name) to the 
-  interfaces of this file without subjecting your linked Code to the 
-  terms of the CPL or GNU LGPL. Any modifications or additions 
-  to this file, however, are subject to the LGPL or CPL terms.
-*/
-
-#include "LzmaStateDecode.h"
-
-#define kNumTopBits 24
-#define kTopValue ((UInt32)1 << kNumTopBits)
-
-#define kNumBitModelTotalBits 11
-#define kBitModelTotal (1 << kNumBitModelTotalBits)
-#define kNumMoveBits 5
-
-#define RC_READ_BYTE (*Buffer++)
-
-#define RC_INIT Code = 0; Range = 0xFFFFFFFF; \
-  { int i; for(i = 0; i < 5; i++) { Code = (Code << 8) | RC_READ_BYTE; }}
-
-#define RC_NORMALIZE if (Range < kTopValue) { Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; }
-
-#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound)
-#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits;
-#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits;
-
-#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \
-  { UpdateBit0(p); mi <<= 1; A0; } else \
-  { UpdateBit1(p); mi = (mi + mi) + 1; A1; } 
-  
-#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)               
-
-#define RangeDecoderBitTreeDecode(probs, numLevels, res) \
-  { int i = numLevels; res = 1; \
-  do { CProb *p = probs + res; RC_GET_BIT(p, res) } while(--i != 0); \
-  res -= (1 << numLevels); }
-
-
-#define kNumPosBitsMax 4
-#define kNumPosStatesMax (1 << kNumPosBitsMax)
-
-#define kLenNumLowBits 3
-#define kLenNumLowSymbols (1 << kLenNumLowBits)
-#define kLenNumMidBits 3
-#define kLenNumMidSymbols (1 << kLenNumMidBits)
-#define kLenNumHighBits 8
-#define kLenNumHighSymbols (1 << kLenNumHighBits)
-
-#define LenChoice 0
-#define LenChoice2 (LenChoice + 1)
-#define LenLow (LenChoice2 + 1)
-#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
-#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
-#define kNumLenProbs (LenHigh + kLenNumHighSymbols) 
-
-
-#define kNumStates 12
-#define kNumLitStates 7
-
-#define kStartPosModelIndex 4
-#define kEndPosModelIndex 14
-#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
-
-#define kNumPosSlotBits 6
-#define kNumLenToPosStates 4
-
-#define kNumAlignBits 4
-#define kAlignTableSize (1 << kNumAlignBits)
-
-#define kMatchMinLen 2
-
-#define IsMatch 0
-#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
-#define IsRepG0 (IsRep + kNumStates)
-#define IsRepG1 (IsRepG0 + kNumStates)
-#define IsRepG2 (IsRepG1 + kNumStates)
-#define IsRep0Long (IsRepG2 + kNumStates)
-#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
-#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
-#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
-#define LenCoder (Align + kAlignTableSize)
-#define RepLenCoder (LenCoder + kNumLenProbs)
-#define Literal (RepLenCoder + kNumLenProbs)
-
-#if Literal != LZMA_BASE_SIZE
-StopCompilingDueBUG
-#endif
-
-/* kRequiredInBufferSize = number of required input bytes for worst case: 
-   longest match with longest distance.
-   kLzmaInBufferSize must be larger than kRequiredInBufferSize 
-   23 bits = 2 (match select) + 10 (len) + 6 (distance) + 4(align) + 1 (RC_NORMALIZE)
-*/
-
-#define kRequiredInBufferSize ((23 * (kNumBitModelTotalBits - kNumMoveBits + 1) + 26 + 9) / 8)
-
-#define kLzmaStreamWasFinishedId (-1)
-
-int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size)
-{
-  unsigned char prop0;
-  if (size < LZMA_PROPERTIES_SIZE)
-    return LZMA_RESULT_DATA_ERROR;
-  prop0 = propsData[0];
-  if (prop0 >= (9 * 5 * 5))
-    return LZMA_RESULT_DATA_ERROR;
-  {
-    for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5));
-    for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9);
-    propsRes->lc = prop0;
-    /*
-    unsigned char remainder = (unsigned char)(prop0 / 9);
-    propsRes->lc = prop0 % 9;
-    propsRes->pb = remainder / 5;
-    propsRes->lp = remainder % 5;
-    */
-  }
-
-  {
-    int i;
-    propsRes->DictionarySize = 0;
-    for (i = 0; i < 4; i++)
-      propsRes->DictionarySize += (UInt32)(propsData[1 + i]) << (i * 8);
-    if (propsRes->DictionarySize == 0)
-      propsRes->DictionarySize = 1;
-    return LZMA_RESULT_OK;
-  }
-}
-
-int LzmaDecode(
-    CLzmaDecoderState *vs,
-    const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
-    unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed,
-    int finishDecoding)
-{
-  UInt32 Range = vs->Range;
-  UInt32 Code = vs->Code;
-
-  unsigned char *Buffer = vs->Buffer;
-  int BufferSize = vs->BufferSize; /* don't change it to unsigned int */
-  CProb *p = vs->Probs;
-
-  int state = vs->State;
-  unsigned char previousByte;
-  UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3];
-  SizeT nowPos = 0;
-  UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1;
-  UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1;
-  int lc = vs->Properties.lc;
-  int len = vs->RemainLen;
-  UInt32 globalPos = vs->GlobalPos;
-  UInt32 distanceLimit = vs->DistanceLimit;
-
-  unsigned char *dictionary = vs->Dictionary;
-  UInt32 dictionarySize = vs->Properties.DictionarySize;
-  UInt32 dictionaryPos = vs->DictionaryPos;
-
-  unsigned char tempDictionary[4];
-  //BEGIN_GOOGLE_ADDITION(jeanluc)
-  int usesInternalTempDictionary = (dictionarySize == 0);
-  //END_GOOGLE_ADDITION(jeanluc)
-
-  (*inSizeProcessed) = 0;
-  (*outSizeProcessed) = 0;
-  if (len == kLzmaStreamWasFinishedId)
-    return LZMA_RESULT_OK;
-
-  if (dictionarySize == 0)
-  {
-    dictionary = tempDictionary;
-    dictionarySize = 1;
-    tempDictionary[0] = vs->TempDictionary[0];
-  }
-
-  if (len == kLzmaNeedInitId)
-  {
-    while (inSize > 0 && BufferSize < kLzmaInBufferSize)
-    {
-      Buffer[BufferSize++] = *inStream++;
-      (*inSizeProcessed)++;
-      inSize--;
-    }
-    if (BufferSize < 5)
-    {
-      vs->BufferSize = BufferSize;
-      return finishDecoding ? LZMA_RESULT_DATA_ERROR : LZMA_RESULT_OK;
-    }
-    {
-      UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
-      UInt32 i;
-      for (i = 0; i < numProbs; i++)
-        p[i] = kBitModelTotal >> 1; 
-      rep0 = rep1 = rep2 = rep3 = 1;
-      state = 0;
-      globalPos = 0;
-      distanceLimit = 0;
-      dictionaryPos = 0;
-      dictionary[dictionarySize - 1] = 0;
-      RC_INIT;
-    }
-    len = 0;
-  }
-  while(len != 0 && nowPos < outSize)
-  {
-    UInt32 pos = dictionaryPos - rep0;
-    if (pos >= dictionarySize)
-      pos += dictionarySize;
-    outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos];
-    if (++dictionaryPos == dictionarySize)
-      dictionaryPos = 0;
-    len--;
-  }
-  if (dictionaryPos == 0)
-    previousByte = dictionary[dictionarySize - 1];
-  else
-    previousByte = dictionary[dictionaryPos - 1];
-
-  while(1)
-  {
-    int bufferPos = (int)(Buffer - vs->Buffer);
-    if (BufferSize - bufferPos < kRequiredInBufferSize)
-    {
-      int i;
-      BufferSize -= bufferPos;
-      if (BufferSize < 0)
-        return LZMA_RESULT_DATA_ERROR;
-      for (i = 0; i < BufferSize; i++)
-        vs->Buffer[i] = Buffer[i];
-      Buffer = vs->Buffer;
-      while (inSize > 0 && BufferSize < kLzmaInBufferSize)
-      {
-        Buffer[BufferSize++] = *inStream++;
-        (*inSizeProcessed)++;
-        inSize--;
-      }
-      if (BufferSize < kRequiredInBufferSize && !finishDecoding)
-        break;
-    }
-    if (nowPos >= outSize)
-      break;
-    {
-    CProb *prob;
-    UInt32 bound;
-    int posState = (int)((nowPos + globalPos) & posStateMask);
-
-    prob = p + IsMatch + (state << kNumPosBitsMax) + posState;
-    IfBit0(prob)
-    {
-      int symbol = 1;
-      UpdateBit0(prob)
-      prob = p + Literal + (LZMA_LIT_SIZE * 
-        ((((nowPos + globalPos)& literalPosMask) << lc) + (previousByte >> (8 - lc))));
-
-      if (state >= kNumLitStates)
-      {
-        int matchByte;
-        UInt32 pos = dictionaryPos - rep0;
-        if (pos >= dictionarySize)
-          pos += dictionarySize;
-        matchByte = dictionary[pos];
-        do
-        {
-          int bit;
-          CProb *probLit;
-          matchByte <<= 1;
-          bit = (matchByte & 0x100);
-          probLit = prob + 0x100 + bit + symbol;
-          RC_GET_BIT2(probLit, symbol, if (bit != 0) break, if (bit == 0) break)
-        }
-        while (symbol < 0x100);
-      }
-      while (symbol < 0x100)
-      {
-        CProb *probLit = prob + symbol;
-        RC_GET_BIT(probLit, symbol)
-      }
-      previousByte = (unsigned char)symbol;
-
-      outStream[nowPos++] = previousByte;
-      if (distanceLimit < dictionarySize)
-        distanceLimit++;
-
-      dictionary[dictionaryPos] = previousByte;
-      if (++dictionaryPos == dictionarySize)
-        dictionaryPos = 0;
-      if (state < 4) state = 0;
-      else if (state < 10) state -= 3;
-      else state -= 6;
-    }
-    else             
-    {
-      UpdateBit1(prob);
-      prob = p + IsRep + state;
-      IfBit0(prob)
-      {
-        UpdateBit0(prob);
-        rep3 = rep2;
-        rep2 = rep1;
-        rep1 = rep0;
-        state = state < kNumLitStates ? 0 : 3;
-        prob = p + LenCoder;
-      }
-      else
-      {
-        UpdateBit1(prob);
-        prob = p + IsRepG0 + state;
-        IfBit0(prob)
-        {
-          UpdateBit0(prob);
-          prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState;
-          IfBit0(prob)
-          {
-            UInt32 pos;
-            UpdateBit0(prob);
-            if (distanceLimit == 0)
-              return LZMA_RESULT_DATA_ERROR;
-            if (distanceLimit < dictionarySize)
-              distanceLimit++;
-            state = state < kNumLitStates ? 9 : 11;
-            pos = dictionaryPos - rep0;
-            if (pos >= dictionarySize)
-              pos += dictionarySize;
-            previousByte = dictionary[pos];
-            dictionary[dictionaryPos] = previousByte;
-            if (++dictionaryPos == dictionarySize)
-              dictionaryPos = 0;
-            outStream[nowPos++] = previousByte;
-            continue;
-          }
-          else
-          {
-            UpdateBit1(prob);
-          }
-        }
-        else
-        {
-          UInt32 distance;
-          UpdateBit1(prob);
-          prob = p + IsRepG1 + state;
-          IfBit0(prob)
-          {
-            UpdateBit0(prob);
-            distance = rep1;
-          }
-          else 
-          {
-            UpdateBit1(prob);
-            prob = p + IsRepG2 + state;
-            IfBit0(prob)
-            {
-              UpdateBit0(prob);
-              distance = rep2;
-            }
-            else
-            {
-              UpdateBit1(prob);
-              distance = rep3;
-              rep3 = rep2;
-            }
-            rep2 = rep1;
-          }
-          rep1 = rep0;
-          rep0 = distance;
-        }
-        state = state < kNumLitStates ? 8 : 11;
-        prob = p + RepLenCoder;
-      }
-      {
-        int numBits, offset;
-        CProb *probLen = prob + LenChoice;
-        IfBit0(probLen)
-        {
-          UpdateBit0(probLen);
-          probLen = prob + LenLow + (posState << kLenNumLowBits);
-          offset = 0;
-          numBits = kLenNumLowBits;
-        }
-        else
-        {
-          UpdateBit1(probLen);
-          probLen = prob + LenChoice2;
-          IfBit0(probLen)
-          {
-            UpdateBit0(probLen);
-            probLen = prob + LenMid + (posState << kLenNumMidBits);
-            offset = kLenNumLowSymbols;
-            numBits = kLenNumMidBits;
-          }
-          else
-          {
-            UpdateBit1(probLen);
-            probLen = prob + LenHigh;
-            offset = kLenNumLowSymbols + kLenNumMidSymbols;
-            numBits = kLenNumHighBits;
-          }
-        }
-        RangeDecoderBitTreeDecode(probLen, numBits, len);
-        len += offset;
-      }
-
-      if (state < 4)
-      {
-        int posSlot;
-        state += kNumLitStates;
-        prob = p + PosSlot +
-            ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << 
-            kNumPosSlotBits);
-        RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot);
-        if (posSlot >= kStartPosModelIndex)
-        {
-          int numDirectBits = ((posSlot >> 1) - 1);
-          rep0 = (2 | ((UInt32)posSlot & 1));
-          if (posSlot < kEndPosModelIndex)
-          {
-            rep0 <<= numDirectBits;
-            prob = p + SpecPos + rep0 - posSlot - 1;
-          }
-          else
-          {
-            numDirectBits -= kNumAlignBits;
-            do
-            {
-              RC_NORMALIZE
-              Range >>= 1;
-              rep0 <<= 1;
-              if (Code >= Range)
-              {
-                Code -= Range;
-                rep0 |= 1;
-              }
-            }
-            while (--numDirectBits != 0);
-            prob = p + Align;
-            rep0 <<= kNumAlignBits;
-            numDirectBits = kNumAlignBits;
-          }
-          {
-            int i = 1;
-            int mi = 1;
-            do
-            {
-              CProb *prob3 = prob + mi;
-              RC_GET_BIT2(prob3, mi, ; , rep0 |= i);
-              i <<= 1;
-            }
-            while(--numDirectBits != 0);
-          }
-        }
-        else
-          rep0 = posSlot;
-        if (++rep0 == (UInt32)(0))
-        {
-          /* it's for stream version */
-          len = kLzmaStreamWasFinishedId;
-          break;
-        }
-      }
-
-      len += kMatchMinLen;
-      if (rep0 > distanceLimit) 
-        return LZMA_RESULT_DATA_ERROR;
-      if (dictionarySize - distanceLimit > (UInt32)len)
-        distanceLimit += len;
-      else
-        distanceLimit = dictionarySize;
-
-      do
-      {
-        UInt32 pos = dictionaryPos - rep0;
-        if (pos >= dictionarySize)
-          pos += dictionarySize;
-        previousByte = dictionary[pos];
-        dictionary[dictionaryPos] = previousByte;
-        if (++dictionaryPos == dictionarySize)
-          dictionaryPos = 0;
-        len--;
-        outStream[nowPos++] = previousByte;
-      }
-      while(len != 0 && nowPos < outSize);
-    }
-    }
-  }
-  RC_NORMALIZE;
-
-  BufferSize -= (int)(Buffer - vs->Buffer);
-  if (BufferSize < 0)
-    return LZMA_RESULT_DATA_ERROR;
-  {
-    int i;
-    for (i = 0; i < BufferSize; i++)
-      vs->Buffer[i] = Buffer[i];
-  }
-  vs->BufferSize = BufferSize;
-  vs->Range = Range;
-  vs->Code = Code;
-  vs->DictionaryPos = dictionaryPos;
-  vs->GlobalPos = (UInt32)(globalPos + nowPos);
-  vs->DistanceLimit = distanceLimit;
-  vs->Reps[0] = rep0;
-  vs->Reps[1] = rep1;
-  vs->Reps[2] = rep2;
-  vs->Reps[3] = rep3;
-  vs->State = state;
-  vs->RemainLen = len;
-  //BEGIN_GOOGLE_ADDITION(jeanluc)
-  if (usesInternalTempDictionary)
-  //END_GOOGLE_ADDITION(jeanluc)
-    vs->TempDictionary[0] = tempDictionary[0];
-
-  (*outSizeProcessed) = nowPos;
-  return LZMA_RESULT_OK;
-}
diff --git a/third_party/lzma/v4_43/LzmaStateDecode.h b/third_party/lzma/v4_43/LzmaStateDecode.h
deleted file mode 100644
index 26490d6..0000000
--- a/third_party/lzma/v4_43/LzmaStateDecode.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* 
-  LzmaStateDecode.h
-  LZMA Decoder interface (State version)
-
-  LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01)
-  http://www.7-zip.org/
-
-  LZMA SDK is licensed under two licenses:
-  1) GNU Lesser General Public License (GNU LGPL)
-  2) Common Public License (CPL)
-  It means that you can select one of these two licenses and 
-  follow rules of that license.
-
-  SPECIAL EXCEPTION:
-  Igor Pavlov, as the author of this code, expressly permits you to 
-  statically or dynamically link your code (or bind by name) to the 
-  interfaces of this file without subjecting your linked code to the 
-  terms of the CPL or GNU LGPL. Any modifications or additions 
-  to this file, however, are subject to the LGPL or CPL terms.
-*/
-
-#ifndef __LZMASTATEDECODE_H
-#define __LZMASTATEDECODE_H
-
-#include "LzmaTypes.h"
-
-/* #define _LZMA_PROB32 */
-/* It can increase speed on some 32-bit CPUs, 
-   but memory usage will be doubled in that case */
-
-#ifdef _LZMA_PROB32
-#define CProb UInt32
-#else
-#define CProb UInt16
-#endif
-
-#define LZMA_RESULT_OK 0
-#define LZMA_RESULT_DATA_ERROR 1
-
-#define LZMA_BASE_SIZE 1846
-#define LZMA_LIT_SIZE 768
-
-#define LZMA_PROPERTIES_SIZE 5
-
-typedef struct _CLzmaProperties
-{
-  int lc;
-  int lp;
-  int pb;
-  UInt32 DictionarySize;
-}CLzmaProperties;
-
-int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size);
-
-#define LzmaGetNumProbs(lzmaProps) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((lzmaProps)->lc + (lzmaProps)->lp)))
-
-#define kLzmaInBufferSize 64   /* don't change it. it must be larger than kRequiredInBufferSize */
-
-#define kLzmaNeedInitId (-2)
-
-typedef struct _CLzmaDecoderState
-{
-  CLzmaProperties Properties;
-  CProb *Probs;
-  unsigned char *Dictionary;
-
-  unsigned char Buffer[kLzmaInBufferSize];
-  int BufferSize;
-
-  UInt32 Range;
-  UInt32 Code;
-  UInt32 DictionaryPos;
-  UInt32 GlobalPos;
-  UInt32 DistanceLimit;
-  UInt32 Reps[4];
-  int State;
-  int RemainLen;  /* -2: decoder needs internal initialization
-                     -1: stream was finished, 
-                      0: ok
-                    > 0: need to write RemainLen bytes as match Reps[0],
-                  */
-  unsigned char TempDictionary[4];  /* it's required when DictionarySize = 0 */
-} CLzmaDecoderState;
-
-#define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; (vs)->BufferSize = 0; }
-
-/* LzmaDecode: decoding from input stream to output stream.
-  If finishDecoding != 0, then there are no more bytes in input stream
-  after inStream[inSize - 1]. */
-
-int LzmaDecode(CLzmaDecoderState *vs,
-    const unsigned char *inStream, SizeT inSize,  SizeT *inSizeProcessed,
-    unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed,
-    int finishDecoding);
-
-#endif
diff --git a/third_party/lzma/v4_43/LzmaTypes.h b/third_party/lzma/v4_43/LzmaTypes.h
deleted file mode 100644
index 288c5e4..0000000
--- a/third_party/lzma/v4_43/LzmaTypes.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* 
-LzmaTypes.h 
-
-Types for LZMA Decoder
-
-This file written and distributed to public domain by Igor Pavlov.
-This file is part of LZMA SDK 4.40 (2006-05-01)
-*/
-
-#ifndef __LZMATYPES_H
-#define __LZMATYPES_H
-
-#ifndef _7ZIP_BYTE_DEFINED
-#define _7ZIP_BYTE_DEFINED
-typedef unsigned char Byte;
-#endif 
-
-#ifndef _7ZIP_UINT16_DEFINED
-#define _7ZIP_UINT16_DEFINED
-typedef unsigned short UInt16;
-#endif 
-
-#ifndef _7ZIP_UINT32_DEFINED
-#define _7ZIP_UINT32_DEFINED
-#ifdef _LZMA_UINT32_IS_ULONG
-typedef unsigned long UInt32;
-#else
-typedef unsigned int UInt32;
-#endif
-#endif 
-
-/* #define _LZMA_SYSTEM_SIZE_T */
-/* Use system's size_t. You can use it to enable 64-bit sizes supporting */
-
-#ifndef _7ZIP_SIZET_DEFINED
-#define _7ZIP_SIZET_DEFINED
-#ifdef _LZMA_SYSTEM_SIZE_T
-#include <stddef.h>
-typedef size_t SizeT;
-#else
-typedef UInt32 SizeT;
-#endif
-#endif
-
-#endif
diff --git a/third_party/lzma/v4_43/build.scons b/third_party/lzma/v4_43/build.scons
deleted file mode 100644
index 5cd142d..0000000
--- a/third_party/lzma/v4_43/build.scons
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-env.ComponentLibrary(
-    lib_name='lzma',
-    source='LzmaStateDecode.c',
-)
-
-
diff --git a/third_party/lzma/v4_43/lzma.exe b/third_party/lzma/v4_43/lzma.exe
deleted file mode 100644
index 6ce17a1..0000000
--- a/third_party/lzma/v4_43/lzma.exe
+++ /dev/null
Binary files differ
diff --git a/third_party/lzma/v4_65/build.scons b/third_party/lzma/v4_65/build.scons
deleted file mode 100644
index eb3a64b..0000000
--- a/third_party/lzma/v4_65/build.scons
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-local_env = env.Clone()
-local_env.FilterOut(CCFLAGS=['/RTC1'])
-
-local_env.ComponentLibrary(
-    lib_name='lzma',
-    source=[
-        'files/C/Bcj2.c',
-        'files/C/Bra86.c',
-        'files/C/LzmaDec.c',
-    ],
-)
diff --git a/third_party/lzma/v4_65/files/7zC.txt b/third_party/lzma/v4_65/files/7zC.txt
deleted file mode 100644
index 5d5d06d..0000000
--- a/third_party/lzma/v4_65/files/7zC.txt
+++ /dev/null
@@ -1,194 +0,0 @@
-7z ANSI-C Decoder 4.62
-----------------------
-
-7z ANSI-C provides 7z/LZMA decoding.
-7z ANSI-C version is simplified version ported from C++ code.
-
-LZMA is default and general compression method of 7z format
-in 7-Zip compression program (www.7-zip.org). LZMA provides high 
-compression ratio and very fast decompression.
-
-
-LICENSE
--------
-
-7z ANSI-C Decoder is part of the LZMA SDK.
-LZMA SDK is written and placed in the public domain by Igor Pavlov.
-
-Files
----------------------
-
-7zDecode.*   - Low level 7z decoding
-7zExtract.*  - High level 7z decoding
-7zHeader.*   - .7z format constants
-7zIn.*       - .7z archive opening
-7zItem.*     - .7z structures
-7zMain.c     - Test application
-
-
-How To Use
-----------
-
-You must download 7-Zip program from www.7-zip.org.
-
-You can create .7z archive with 7z.exe or 7za.exe:
-
-  7za.exe a archive.7z *.htm -r -mx -m0fb=255
-
-If you have big number of files in archive, and you need fast extracting, 
-you can use partly-solid archives:
-  
-  7za.exe a archive.7z *.htm -ms=512K -r -mx -m0fb=255 -m0d=512K
-
-In that example 7-Zip will use 512KB solid blocks. So it needs to decompress only 
-512KB for extracting one file from such archive.
-
-
-Limitations of current version of 7z ANSI-C Decoder
----------------------------------------------------
-
- - It reads only "FileName", "Size", "LastWriteTime" and "CRC" information for each file in archive.
- - It supports only LZMA and Copy (no compression) methods with BCJ or BCJ2 filters.
- - It converts original UTF-16 Unicode file names to UTF-8 Unicode file names.
- 
-These limitations will be fixed in future versions.
-
-
-Using 7z ANSI-C Decoder Test application:
------------------------------------------
-
-Usage: 7zDec <command> <archive_name>
-
-<Command>:
-  e: Extract files from archive
-  l: List contents of archive
-  t: Test integrity of archive
-
-Example: 
-
-  7zDec l archive.7z
-
-lists contents of archive.7z
-
-  7zDec e archive.7z
-
-extracts files from archive.7z to current folder.
-
-
-How to use .7z Decoder
-----------------------
-
-Memory allocation
-~~~~~~~~~~~~~~~~~
-
-7z Decoder uses two memory pools:
-1) Temporary pool
-2) Main pool
-Such scheme can allow you to avoid fragmentation of allocated blocks.
-
-
-Steps for using 7z decoder
---------------------------
-
-Use code at 7zMain.c as example.
-
-1) Declare variables:
-  inStream                 /* implements ILookInStream interface */
-  CSzArEx db;              /* 7z archive database structure */
-  ISzAlloc allocImp;       /* memory functions for main pool */
-  ISzAlloc allocTempImp;   /* memory functions for temporary pool */
-
-2) call CrcGenerateTable(); function to initialize CRC structures.
-
-3) call SzArEx_Init(&db); function to initialize db structures.
-
-4) call SzArEx_Open(&db, inStream, &allocMain, &allocTemp) to open archive
-
-This function opens archive "inStream" and reads headers to "db".
-All items in "db" will be allocated with "allocMain" functions.
-SzArEx_Open function allocates and frees temporary structures by "allocTemp" functions.
-
-5) List items or Extract items
-
-  Listing code:
-  ~~~~~~~~~~~~~
-    {
-      UInt32 i;
-      for (i = 0; i < db.db.NumFiles; i++)
-      {
-        CFileItem *f = db.db.Files + i;
-        printf("%10d  %s\n", (int)f->Size, f->Name);
-      }
-    }
-
-  Extracting code:
-  ~~~~~~~~~~~~~~~~
-
-  SZ_RESULT SzAr_Extract(
-    CArchiveDatabaseEx *db,
-    ILookInStream *inStream, 
-    UInt32 fileIndex,         /* index of file */
-    UInt32 *blockIndex,       /* index of solid block */
-    Byte **outBuffer,         /* pointer to pointer to output buffer (allocated with allocMain) */
-    size_t *outBufferSize,    /* buffer size for output buffer */
-    size_t *offset,           /* offset of stream for required file in *outBuffer */
-    size_t *outSizeProcessed, /* size of file in *outBuffer */
-    ISzAlloc *allocMain,
-    ISzAlloc *allocTemp);
-
-  If you need to decompress more than one file, you can send these values from previous call:
-    blockIndex, 
-    outBuffer, 
-    outBufferSize,
-  You can consider "outBuffer" as cache of solid block. If your archive is solid, 
-  it will increase decompression speed.
-
-  After decompressing you must free "outBuffer":
-  allocImp.Free(outBuffer);
-
-6) call SzArEx_Free(&db, allocImp.Free) to free allocated items in "db".
-
-
-
-
-Memory requirements for .7z decoding 
-------------------------------------
-
-Memory usage for Archive opening:
-  - Temporary pool:
-     - Memory for uncompressed .7z headers
-     - some other temporary blocks
-  - Main pool:
-     - Memory for database: 
-       Estimated size of one file structures in solid archive:
-         - Size (4 or 8 Bytes)
-         - CRC32 (4 bytes)
-         - LastWriteTime (8 bytes)
-         - Some file information (4 bytes)
-         - File Name (variable length) + pointer + allocation structures
-
-Memory usage for archive Decompressing:
-  - Temporary pool:
-     - Memory for LZMA decompressing structures
-  - Main pool:
-     - Memory for decompressed solid block
-     - Memory for temprorary buffers, if BCJ2 fileter is used. Usually these 
-       temprorary buffers can be about 15% of solid block size. 
-  
-
-7z Decoder doesn't allocate memory for compressed blocks. 
-Instead of this, you must allocate buffer with desired 
-size before calling 7z Decoder. Use 7zMain.c as example.
-
-
-Defines
--------
-
-_SZ_ALLOC_DEBUG   - define it if you want to debug alloc/free operations to stderr.
-
-
----
-
-http://www.7-zip.org
-http://www.7-zip.org/sdk.html
-http://www.7-zip.org/support.html
diff --git a/third_party/lzma/v4_65/files/7zFormat.txt b/third_party/lzma/v4_65/files/7zFormat.txt
deleted file mode 100644
index e1cf738..0000000
--- a/third_party/lzma/v4_65/files/7zFormat.txt
+++ /dev/null
@@ -1,471 +0,0 @@
-7z Format description (2.30 Beta 25)
------------------------------------
-
-This file contains description of 7z archive format. 
-7z archive can contain files compressed with any method.
-See "Methods.txt" for description for defined compressing methods.
-
-
-Format structure Overview
--------------------------
-
-Some fields can be optional.
-
-Archive structure
-~~~~~~~~~~~~~~~~~  
-SignatureHeader
-[PackedStreams]
-[PackedStreamsForHeaders]
-[
-  Header 
-  or 
-  {
-    Packed Header
-    HeaderInfo
-  }
-]
-
-
-
-Header structure
-~~~~~~~~~~~~~~~~  
-{
-  ArchiveProperties
-  AdditionalStreams
-  {
-    PackInfo
-    {
-      PackPos
-      NumPackStreams
-      Sizes[NumPackStreams]
-      CRCs[NumPackStreams]
-    }
-    CodersInfo
-    {
-      NumFolders
-      Folders[NumFolders]
-      {
-        NumCoders
-        CodersInfo[NumCoders]
-        {
-          ID
-          NumInStreams;
-          NumOutStreams;
-          PropertiesSize
-          Properties[PropertiesSize]
-        }
-        NumBindPairs
-        BindPairsInfo[NumBindPairs]
-        {
-          InIndex;
-          OutIndex;
-        }
-        PackedIndices
-      }
-      UnPackSize[Folders][Folders.NumOutstreams]
-      CRCs[NumFolders]
-    }
-    SubStreamsInfo
-    {
-      NumUnPackStreamsInFolders[NumFolders];
-      UnPackSizes[]
-      CRCs[]
-    }
-  }
-  MainStreamsInfo
-  {
-    (Same as in AdditionalStreams)
-  }
-  FilesInfo
-  {
-    NumFiles
-    Properties[]
-    {
-      ID
-      Size
-      Data
-    }
-  }
-}
-
-HeaderInfo structure
-~~~~~~~~~~~~~~~~~~~~
-{
-  (Same as in AdditionalStreams)
-}
-
-
-
-Notes about Notation and encoding
----------------------------------
-
-7z uses little endian encoding.
-
-7z archive format has optional headers that are marked as
-[]
-Header
-[]
-
-REAL_UINT64 means real UINT64.
-
-UINT64 means real UINT64 encoded with the following scheme:
-
-  Size of encoding sequence depends from first byte:
-  First_Byte  Extra_Bytes        Value
-  (binary)   
-  0xxxxxxx               : ( xxxxxxx           )
-  10xxxxxx    BYTE y[1]  : (  xxxxxx << (8 * 1)) + y
-  110xxxxx    BYTE y[2]  : (   xxxxx << (8 * 2)) + y
-  ...
-  1111110x    BYTE y[6]  : (       x << (8 * 6)) + y
-  11111110    BYTE y[7]  :                         y
-  11111111    BYTE y[8]  :                         y
-
-
-
-Property IDs
-------------
-
-0x00 = kEnd,
-
-0x01 = kHeader,
-
-0x02 = kArchiveProperties,
-    
-0x03 = kAdditionalStreamsInfo,
-0x04 = kMainStreamsInfo,
-0x05 = kFilesInfo,
-    
-0x06 = kPackInfo,
-0x07 = kUnPackInfo,
-0x08 = kSubStreamsInfo,
-
-0x09 = kSize,
-0x0A = kCRC,
-
-0x0B = kFolder,
-
-0x0C = kCodersUnPackSize,
-0x0D = kNumUnPackStream,
-
-0x0E = kEmptyStream,
-0x0F = kEmptyFile,
-0x10 = kAnti,
-
-0x11 = kName,
-0x12 = kCreationTime,
-0x13 = kLastAccessTime,
-0x14 = kLastWriteTime,
-0x15 = kWinAttributes,
-0x16 = kComment,
-
-0x17 = kEncodedHeader,
-
-
-7z format headers
------------------
-
-SignatureHeader
-~~~~~~~~~~~~~~~
-  BYTE kSignature[6] = {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C};
-
-  ArchiveVersion
-  {
-    BYTE Major;   // now = 0
-    BYTE Minor;   // now = 2
-  };
-
-  UINT32 StartHeaderCRC;
-
-  StartHeader
-  {
-    REAL_UINT64 NextHeaderOffset
-    REAL_UINT64 NextHeaderSize
-    UINT32 NextHeaderCRC
-  }
-
-
-...........................
-
-
-ArchiveProperties
-~~~~~~~~~~~~~~~~~
-BYTE NID::kArchiveProperties (0x02)
-for (;;)
-{
-  BYTE PropertyType;
-  if (aType == 0)
-    break;
-  UINT64 PropertySize;
-  BYTE PropertyData[PropertySize];
-}
-
-
-Digests (NumStreams)
-~~~~~~~~~~~~~~~~~~~~~
-  BYTE AllAreDefined
-  if (AllAreDefined == 0)
-  {
-    for(NumStreams)
-      BIT Defined
-  }
-  UINT32 CRCs[NumDefined]
-
-
-PackInfo
-~~~~~~~~~~~~
-  BYTE NID::kPackInfo  (0x06)
-  UINT64 PackPos
-  UINT64 NumPackStreams
-
-  []
-  BYTE NID::kSize    (0x09)
-  UINT64 PackSizes[NumPackStreams]
-  []
-
-  []
-  BYTE NID::kCRC      (0x0A)
-  PackStreamDigests[NumPackStreams]
-  []
-
-  BYTE NID::kEnd
-
-
-Folder
-~~~~~~
-  UINT64 NumCoders;
-  for (NumCoders)
-  {
-    BYTE 
-    {
-      0:3 DecompressionMethod.IDSize
-      4:
-        0 - IsSimple
-        1 - Is not simple
-      5:
-        0 - No Attributes
-        1 - There Are Attributes
-      7:
-        0 - Last Method in Alternative_Method_List
-        1 - There are more alternative methods
-    } 
-    BYTE DecompressionMethod.ID[DecompressionMethod.IDSize]
-    if (!IsSimple)
-    {
-      UINT64 NumInStreams;
-      UINT64 NumOutStreams;
-    }
-    if (DecompressionMethod[0] != 0)
-    {
-      UINT64 PropertiesSize
-      BYTE Properties[PropertiesSize]
-    }
-  }
-    
-  NumBindPairs = NumOutStreamsTotal - 1;
-
-  for (NumBindPairs)
-  {
-    UINT64 InIndex;
-    UINT64 OutIndex;
-  }
-
-  NumPackedStreams = NumInStreamsTotal - NumBindPairs;
-  if (NumPackedStreams > 1)
-    for(NumPackedStreams)
-    {
-      UINT64 Index;
-    };
-
-
-
-
-Coders Info
-~~~~~~~~~~~
-
-  BYTE NID::kUnPackInfo  (0x07)
-
-
-  BYTE NID::kFolder  (0x0B)
-  UINT64 NumFolders
-  BYTE External
-  switch(External)
-  {
-    case 0:
-      Folders[NumFolders]
-    case 1:
-      UINT64 DataStreamIndex
-  }
-
-
-  BYTE ID::kCodersUnPackSize  (0x0C)
-  for(Folders)
-    for(Folder.NumOutStreams)
-     UINT64 UnPackSize;
-
-
-  []
-  BYTE NID::kCRC   (0x0A)
-  UnPackDigests[NumFolders]
-  []
-
-  
-
-  BYTE NID::kEnd
-
-
-
-SubStreams Info
-~~~~~~~~~~~~~~
-  BYTE NID::kSubStreamsInfo; (0x08)
-
-  []
-  BYTE NID::kNumUnPackStream; (0x0D)
-  UINT64 NumUnPackStreamsInFolders[NumFolders];
-  []
-
-
-  []
-  BYTE NID::kSize  (0x09)
-  UINT64 UnPackSizes[]
-  []
-
-
-  []
-  BYTE NID::kCRC  (0x0A)
-  Digests[Number of streams with unknown CRC]
-  []
-
-  
-  BYTE NID::kEnd
-
-
-Streams Info
-~~~~~~~~~~~~
-
-  []
-  PackInfo
-  []
-
-
-  []
-  CodersInfo
-  []
-
-
-  []
-  SubStreamsInfo
-  []
-
-  BYTE NID::kEnd
-
-
-FilesInfo
-~~~~~~~~~
-  BYTE NID::kFilesInfo;  (0x05)
-  UINT64 NumFiles
-
-  for (;;)
-  {
-    BYTE PropertyType;
-    if (aType == 0)
-      break;
-
-    UINT64 Size;
-
-    switch(PropertyType)
-    {
-      kEmptyStream:   (0x0E)
-        for(NumFiles)
-          BIT IsEmptyStream
-
-      kEmptyFile:     (0x0F)
-        for(EmptyStreams)
-          BIT IsEmptyFile
-
-      kAnti:          (0x10)
-        for(EmptyStreams)
-          BIT IsAntiFile
-      
-      case kCreationTime:   (0x12)
-      case kLastAccessTime: (0x13)
-      case kLastWriteTime:  (0x14)
-        BYTE AllAreDefined
-        if (AllAreDefined == 0)
-        {
-          for(NumFiles)
-            BIT TimeDefined
-        }
-        BYTE External;
-        if(External != 0)
-          UINT64 DataIndex
-        []
-        for(Definded Items)
-          UINT32 Time
-        []
-      
-      kNames:     (0x11)
-        BYTE External;
-        if(External != 0)
-          UINT64 DataIndex
-        []
-        for(Files)
-        {
-          wchar_t Names[NameSize];
-          wchar_t 0;
-        }
-        []
-
-      kAttributes:  (0x15)
-        BYTE AllAreDefined
-        if (AllAreDefined == 0)
-        {
-          for(NumFiles)
-            BIT AttributesAreDefined
-        }
-        BYTE External;
-        if(External != 0)
-          UINT64 DataIndex
-        []
-        for(Definded Attributes)
-          UINT32 Attributes
-        []
-    }
-  }
-
-
-Header
-~~~~~~
-  BYTE NID::kHeader (0x01)
-
-  []
-  ArchiveProperties
-  []
-
-  []
-  BYTE NID::kAdditionalStreamsInfo; (0x03)
-  StreamsInfo
-  []
-
-  []
-  BYTE NID::kMainStreamsInfo;    (0x04)
-  StreamsInfo
-  []
-
-  []
-  FilesInfo
-  []
-
-  BYTE NID::kEnd
-
-
-HeaderInfo
-~~~~~~~~~~
-  []
-  BYTE NID::kEncodedHeader; (0x17)
-  StreamsInfo for Encoded Header
-  []
-
-
----
-End of document
diff --git a/third_party/lzma/v4_65/files/C/7zBuf.c b/third_party/lzma/v4_65/files/C/7zBuf.c
deleted file mode 100644
index 14e7f4e..0000000
--- a/third_party/lzma/v4_65/files/C/7zBuf.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* 7zBuf.c -- Byte Buffer
-2008-03-28
-Igor Pavlov
-Public domain */
-
-#include "7zBuf.h"
-
-void Buf_Init(CBuf *p)
-{
-  p->data = 0;
-  p->size = 0;
-}
-
-int Buf_Create(CBuf *p, size_t size, ISzAlloc *alloc)
-{
-  p->size = 0;
-  if (size == 0)
-  {
-    p->data = 0;
-    return 1;
-  }
-  p->data = (Byte *)alloc->Alloc(alloc, size);
-  if (p->data != 0)
-  {
-    p->size = size;
-    return 1;
-  }
-  return 0;
-}
-
-void Buf_Free(CBuf *p, ISzAlloc *alloc)
-{
-  alloc->Free(alloc, p->data);
-  p->data = 0;
-  p->size = 0;
-}
diff --git a/third_party/lzma/v4_65/files/C/7zBuf.h b/third_party/lzma/v4_65/files/C/7zBuf.h
deleted file mode 100644
index c5bd718..0000000
--- a/third_party/lzma/v4_65/files/C/7zBuf.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* 7zBuf.h -- Byte Buffer
-2008-10-04 : Igor Pavlov : Public domain */
-
-#ifndef __7Z_BUF_H
-#define __7Z_BUF_H
-
-#include "Types.h"
-
-typedef struct
-{
-  Byte *data;
-  size_t size;
-} CBuf;
-
-void Buf_Init(CBuf *p);
-int Buf_Create(CBuf *p, size_t size, ISzAlloc *alloc);
-void Buf_Free(CBuf *p, ISzAlloc *alloc);
-
-typedef struct
-{
-  Byte *data;
-  size_t size;
-  size_t pos;
-} CDynBuf;
-
-void DynBuf_Construct(CDynBuf *p);
-void DynBuf_SeekToBeg(CDynBuf *p);
-int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAlloc *alloc);
-void DynBuf_Free(CDynBuf *p, ISzAlloc *alloc);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/C/7zBuf2.c b/third_party/lzma/v4_65/files/C/7zBuf2.c
deleted file mode 100644
index 8d17e0d..0000000
--- a/third_party/lzma/v4_65/files/C/7zBuf2.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* 7zBuf2.c -- Byte Buffer
-2008-10-04 : Igor Pavlov : Public domain */
-
-#include <string.h>
-#include "7zBuf.h"
-
-void DynBuf_Construct(CDynBuf *p)
-{
-  p->data = 0;
-  p->size = 0;
-  p->pos = 0;
-}
-
-void DynBuf_SeekToBeg(CDynBuf *p)
-{
-  p->pos = 0;
-}
-
-int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAlloc *alloc)
-{
-  if (size > p->size - p->pos)
-  {
-    size_t newSize = p->pos + size;
-    Byte *data;
-    newSize += newSize / 4;
-    data = (Byte *)alloc->Alloc(alloc, newSize);
-    if (data == 0)
-      return 0;
-    p->size = newSize;
-    memcpy(data, p->data, p->pos);
-    alloc->Free(alloc, p->data);
-    p->data = data;
-  }
-  memcpy(p->data + p->pos, buf, size);
-  p->pos += size;
-  return 1;
-}
-
-void DynBuf_Free(CDynBuf *p, ISzAlloc *alloc)
-{
-  alloc->Free(alloc, p->data);
-  p->data = 0;
-  p->size = 0;
-  p->pos = 0;
-}
diff --git a/third_party/lzma/v4_65/files/C/7zCrc.c b/third_party/lzma/v4_65/files/C/7zCrc.c
deleted file mode 100644
index 71962b2..0000000
--- a/third_party/lzma/v4_65/files/C/7zCrc.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* 7zCrc.c -- CRC32 calculation
-2008-08-05
-Igor Pavlov
-Public domain */
-
-#include "7zCrc.h"
-
-#define kCrcPoly 0xEDB88320
-UInt32 g_CrcTable[256];
-
-void MY_FAST_CALL CrcGenerateTable(void)
-{
-  UInt32 i;
-  for (i = 0; i < 256; i++)
-  {
-    UInt32 r = i;
-    int j;
-    for (j = 0; j < 8; j++)
-      r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1));
-    g_CrcTable[i] = r;
-  }
-}
-
-UInt32 MY_FAST_CALL CrcUpdate(UInt32 v, const void *data, size_t size)
-{
-  const Byte *p = (const Byte *)data;
-  for (; size > 0 ; size--, p++)
-    v = CRC_UPDATE_BYTE(v, *p);
-  return v;
-}
-
-UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size)
-{
-  return CrcUpdate(CRC_INIT_VAL, data, size) ^ 0xFFFFFFFF;
-}
diff --git a/third_party/lzma/v4_65/files/C/7zCrc.h b/third_party/lzma/v4_65/files/C/7zCrc.h
deleted file mode 100644
index 00dc29c..0000000
--- a/third_party/lzma/v4_65/files/C/7zCrc.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* 7zCrc.h -- CRC32 calculation
-2008-03-13
-Igor Pavlov
-Public domain */
-
-#ifndef __7Z_CRC_H
-#define __7Z_CRC_H
-
-#include <stddef.h>
-
-#include "Types.h"
-
-extern UInt32 g_CrcTable[];
-
-void MY_FAST_CALL CrcGenerateTable(void);
-
-#define CRC_INIT_VAL 0xFFFFFFFF
-#define CRC_GET_DIGEST(crc) ((crc) ^ 0xFFFFFFFF)
-#define CRC_UPDATE_BYTE(crc, b) (g_CrcTable[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
-
-UInt32 MY_FAST_CALL CrcUpdate(UInt32 crc, const void *data, size_t size);
-UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/C/7zFile.c b/third_party/lzma/v4_65/files/C/7zFile.c
deleted file mode 100644
index 9a44c59..0000000
--- a/third_party/lzma/v4_65/files/C/7zFile.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/* 7zFile.c -- File IO
-2008-11-22 : Igor Pavlov : Public domain */
-
-#include "7zFile.h"
-
-#ifndef USE_WINDOWS_FILE
-
-#include <errno.h>
-
-#endif
-
-#ifdef USE_WINDOWS_FILE
-
-/*
-   ReadFile and WriteFile functions in Windows have BUG:
-   If you Read or Write 64MB or more (probably min_failure_size = 64MB - 32KB + 1)
-   from/to Network file, it returns ERROR_NO_SYSTEM_RESOURCES
-   (Insufficient system resources exist to complete the requested service).
-   Probably in some version of Windows there are problems with other sizes:
-   for 32 MB (maybe also for 16 MB).
-   And message can be "Network connection was lost"
-*/
-
-#define kChunkSizeMax (1 << 22)
-
-#endif
-
-void File_Construct(CSzFile *p)
-{
-  #ifdef USE_WINDOWS_FILE
-  p->handle = INVALID_HANDLE_VALUE;
-  #else
-  p->file = NULL;
-  #endif
-}
-
-static WRes File_Open(CSzFile *p, const char *name, int writeMode)
-{
-  #ifdef USE_WINDOWS_FILE
-  p->handle = CreateFileA(name,
-      writeMode ? GENERIC_WRITE : GENERIC_READ,
-      FILE_SHARE_READ, NULL,
-      writeMode ? CREATE_ALWAYS : OPEN_EXISTING,
-      FILE_ATTRIBUTE_NORMAL, NULL);
-  return (p->handle != INVALID_HANDLE_VALUE) ? 0 : GetLastError();
-  #else
-  p->file = fopen(name, writeMode ? "wb+" : "rb");
-  return (p->file != 0) ? 0 : errno;
-  #endif
-}
-
-WRes InFile_Open(CSzFile *p, const char *name) { return File_Open(p, name, 0); }
-WRes OutFile_Open(CSzFile *p, const char *name) { return File_Open(p, name, 1); }
-
-WRes File_Close(CSzFile *p)
-{
-  #ifdef USE_WINDOWS_FILE
-  if (p->handle != INVALID_HANDLE_VALUE)
-  {
-    if (!CloseHandle(p->handle))
-      return GetLastError();
-    p->handle = INVALID_HANDLE_VALUE;
-  }
-  #else
-  if (p->file != NULL)
-  {
-    int res = fclose(p->file);
-    if (res != 0)
-      return res;
-    p->file = NULL;
-  }
-  #endif
-  return 0;
-}
-
-WRes File_Read(CSzFile *p, void *data, size_t *size)
-{
-  size_t originalSize = *size;
-  if (originalSize == 0)
-    return 0;
-
-  #ifdef USE_WINDOWS_FILE
-
-  *size = 0;
-  do
-  {
-    DWORD curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : (DWORD)originalSize;
-    DWORD processed = 0;
-    BOOL res = ReadFile(p->handle, data, curSize, &processed, NULL);
-    data = (void *)((Byte *)data + processed);
-    originalSize -= processed;
-    *size += processed;
-    if (!res)
-      return GetLastError();
-    if (processed == 0)
-      break;
-  }
-  while (originalSize > 0);
-  return 0;
-
-  #else
-  
-  *size = fread(data, 1, originalSize, p->file);
-  if (*size == originalSize)
-    return 0;
-  return ferror(p->file);
-  
-  #endif
-}
-
-WRes File_Write(CSzFile *p, const void *data, size_t *size)
-{
-  size_t originalSize = *size;
-  if (originalSize == 0)
-    return 0;
-  
-  #ifdef USE_WINDOWS_FILE
-
-  *size = 0;
-  do
-  {
-    DWORD curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : (DWORD)originalSize;
-    DWORD processed = 0;
-    BOOL res = WriteFile(p->handle, data, curSize, &processed, NULL);
-    data = (void *)((Byte *)data + processed);
-    originalSize -= processed;
-    *size += processed;
-    if (!res)
-      return GetLastError();
-    if (processed == 0)
-      break;
-  }
-  while (originalSize > 0);
-  return 0;
-
-  #else
-
-  *size = fwrite(data, 1, originalSize, p->file);
-  if (*size == originalSize)
-    return 0;
-  return ferror(p->file);
-  
-  #endif
-}
-
-WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin)
-{
-  #ifdef USE_WINDOWS_FILE
-
-  LARGE_INTEGER value;
-  DWORD moveMethod;
-  value.LowPart = (DWORD)*pos;
-  value.HighPart = (LONG)((UInt64)*pos >> 16 >> 16); /* for case when UInt64 is 32-bit only */
-  switch (origin)
-  {
-    case SZ_SEEK_SET: moveMethod = FILE_BEGIN; break;
-    case SZ_SEEK_CUR: moveMethod = FILE_CURRENT; break;
-    case SZ_SEEK_END: moveMethod = FILE_END; break;
-    default: return ERROR_INVALID_PARAMETER;
-  }
-  value.LowPart = SetFilePointer(p->handle, value.LowPart, &value.HighPart, moveMethod);
-  if (value.LowPart == 0xFFFFFFFF)
-  {
-    WRes res = GetLastError();
-    if (res != NO_ERROR)
-      return res;
-  }
-  *pos = ((Int64)value.HighPart << 32) | value.LowPart;
-  return 0;
-
-  #else
-  
-  int moveMethod;
-  int res;
-  switch (origin)
-  {
-    case SZ_SEEK_SET: moveMethod = SEEK_SET; break;
-    case SZ_SEEK_CUR: moveMethod = SEEK_CUR; break;
-    case SZ_SEEK_END: moveMethod = SEEK_END; break;
-    default: return 1;
-  }
-  res = fseek(p->file, (long)*pos, moveMethod);
-  *pos = ftell(p->file);
-  return res;
-  
-  #endif
-}
-
-WRes File_GetLength(CSzFile *p, UInt64 *length)
-{
-  #ifdef USE_WINDOWS_FILE
-  
-  DWORD sizeHigh;
-  DWORD sizeLow = GetFileSize(p->handle, &sizeHigh);
-  if (sizeLow == 0xFFFFFFFF)
-  {
-    DWORD res = GetLastError();
-    if (res != NO_ERROR)
-      return res;
-  }
-  *length = (((UInt64)sizeHigh) << 32) + sizeLow;
-  return 0;
-  
-  #else
-  
-  long pos = ftell(p->file);
-  int res = fseek(p->file, 0, SEEK_END);
-  *length = ftell(p->file);
-  fseek(p->file, pos, SEEK_SET);
-  return res;
-  
-  #endif
-}
-
-
-/* ---------- FileSeqInStream ---------- */
-
-static SRes FileSeqInStream_Read(void *pp, void *buf, size_t *size)
-{
-  CFileSeqInStream *p = (CFileSeqInStream *)pp;
-  return File_Read(&p->file, buf, size) == 0 ? SZ_OK : SZ_ERROR_READ;
-}
-
-void FileSeqInStream_CreateVTable(CFileSeqInStream *p)
-{
-  p->s.Read = FileSeqInStream_Read;
-}
-
-
-/* ---------- FileInStream ---------- */
-
-static SRes FileInStream_Read(void *pp, void *buf, size_t *size)
-{
-  CFileInStream *p = (CFileInStream *)pp;
-  return (File_Read(&p->file, buf, size) == 0) ? SZ_OK : SZ_ERROR_READ;
-}
-
-static SRes FileInStream_Seek(void *pp, Int64 *pos, ESzSeek origin)
-{
-  CFileInStream *p = (CFileInStream *)pp;
-  return File_Seek(&p->file, pos, origin);
-}
-
-void FileInStream_CreateVTable(CFileInStream *p)
-{
-  p->s.Read = FileInStream_Read;
-  p->s.Seek = FileInStream_Seek;
-}
-
-
-/* ---------- FileOutStream ---------- */
-
-static size_t FileOutStream_Write(void *pp, const void *data, size_t size)
-{
-  CFileOutStream *p = (CFileOutStream *)pp;
-  File_Write(&p->file, data, &size);
-  return size;
-}
-
-void FileOutStream_CreateVTable(CFileOutStream *p)
-{
-  p->s.Write = FileOutStream_Write;
-}
diff --git a/third_party/lzma/v4_65/files/C/7zFile.h b/third_party/lzma/v4_65/files/C/7zFile.h
deleted file mode 100644
index fbef683..0000000
--- a/third_party/lzma/v4_65/files/C/7zFile.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* 7zFile.h -- File IO
-2008-11-22 : Igor Pavlov : Public domain */
-
-#ifndef __7Z_FILE_H
-#define __7Z_FILE_H
-
-#ifdef _WIN32
-#define USE_WINDOWS_FILE
-#endif
-
-#ifdef USE_WINDOWS_FILE
-#include <windows.h>
-#else
-#include <stdio.h>
-#endif
-
-#include "Types.h"
-
-
-/* ---------- File ---------- */
-
-typedef struct
-{
-  #ifdef USE_WINDOWS_FILE
-  HANDLE handle;
-  #else
-  FILE *file;
-  #endif
-} CSzFile;
-
-void File_Construct(CSzFile *p);
-WRes InFile_Open(CSzFile *p, const char *name);
-WRes OutFile_Open(CSzFile *p, const char *name);
-WRes File_Close(CSzFile *p);
-
-/* reads max(*size, remain file's size) bytes */
-WRes File_Read(CSzFile *p, void *data, size_t *size);
-
-/* writes *size bytes */
-WRes File_Write(CSzFile *p, const void *data, size_t *size);
-
-WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin);
-WRes File_GetLength(CSzFile *p, UInt64 *length);
-
-
-/* ---------- FileInStream ---------- */
-
-typedef struct
-{
-  ISeqInStream s;
-  CSzFile file;
-} CFileSeqInStream;
-
-void FileSeqInStream_CreateVTable(CFileSeqInStream *p);
-
-
-typedef struct
-{
-  ISeekInStream s;
-  CSzFile file;
-} CFileInStream;
-
-void FileInStream_CreateVTable(CFileInStream *p);
-
-
-typedef struct
-{
-  ISeqOutStream s;
-  CSzFile file;
-} CFileOutStream;
-
-void FileOutStream_CreateVTable(CFileOutStream *p);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/C/7zStream.c b/third_party/lzma/v4_65/files/C/7zStream.c
deleted file mode 100644
index 86232aa..0000000
--- a/third_party/lzma/v4_65/files/C/7zStream.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* 7zStream.c -- 7z Stream functions
-2008-11-23 : Igor Pavlov : Public domain */
-
-#include <string.h>
-
-#include "Types.h"
-
-SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType)
-{
-  while (size != 0)
-  {
-    size_t processed = size;
-    RINOK(stream->Read(stream, buf, &processed));
-    if (processed == 0)
-      return errorType;
-    buf = (void *)((Byte *)buf + processed);
-    size -= processed;
-  }
-  return SZ_OK;
-}
-
-SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size)
-{
-  return SeqInStream_Read2(stream, buf, size, SZ_ERROR_INPUT_EOF);
-}
-
-SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf)
-{
-  size_t processed = 1;
-  RINOK(stream->Read(stream, buf, &processed));
-  return (processed == 1) ? SZ_OK : SZ_ERROR_INPUT_EOF;
-}
-
-SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset)
-{
-  Int64 t = offset;
-  return stream->Seek(stream, &t, SZ_SEEK_SET);
-}
-
-SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size)
-{
-  void *lookBuf;
-  if (*size == 0)
-    return SZ_OK;
-  RINOK(stream->Look(stream, &lookBuf, size));
-  memcpy(buf, lookBuf, *size);
-  return stream->Skip(stream, *size);
-}
-
-SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType)
-{
-  while (size != 0)
-  {
-    size_t processed = size;
-    RINOK(stream->Read(stream, buf, &processed));
-    if (processed == 0)
-      return errorType;
-    buf = (void *)((Byte *)buf + processed);
-    size -= processed;
-  }
-  return SZ_OK;
-}
-
-SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size)
-{
-  return LookInStream_Read2(stream, buf, size, SZ_ERROR_INPUT_EOF);
-}
-
-static SRes LookToRead_Look_Lookahead(void *pp, void **buf, size_t *size)
-{
-  SRes res = SZ_OK;
-  CLookToRead *p = (CLookToRead *)pp;
-  size_t size2 = p->size - p->pos;
-  if (size2 == 0 && *size > 0)
-  {
-    p->pos = 0;
-    size2 = LookToRead_BUF_SIZE;
-    res = p->realStream->Read(p->realStream, p->buf, &size2);
-    p->size = size2;
-  }
-  if (size2 < *size)
-    *size = size2;
-  *buf = p->buf + p->pos;
-  return res;
-}
-
-static SRes LookToRead_Look_Exact(void *pp, void **buf, size_t *size)
-{
-  SRes res = SZ_OK;
-  CLookToRead *p = (CLookToRead *)pp;
-  size_t size2 = p->size - p->pos;
-  if (size2 == 0 && *size > 0)
-  {
-    p->pos = 0;
-    if (*size > LookToRead_BUF_SIZE)
-      *size = LookToRead_BUF_SIZE;
-    res = p->realStream->Read(p->realStream, p->buf, size);
-    size2 = p->size = *size;
-  }
-  if (size2 < *size)
-    *size = size2;
-  *buf = p->buf + p->pos;
-  return res;
-}
-
-static SRes LookToRead_Skip(void *pp, size_t offset)
-{
-  CLookToRead *p = (CLookToRead *)pp;
-  p->pos += offset;
-  return SZ_OK;
-}
-
-static SRes LookToRead_Read(void *pp, void *buf, size_t *size)
-{
-  CLookToRead *p = (CLookToRead *)pp;
-  size_t rem = p->size - p->pos;
-  if (rem == 0)
-    return p->realStream->Read(p->realStream, buf, size);
-  if (rem > *size)
-    rem = *size;
-  memcpy(buf, p->buf + p->pos, rem);
-  p->pos += rem;
-  *size = rem;
-  return SZ_OK;
-}
-
-static SRes LookToRead_Seek(void *pp, Int64 *pos, ESzSeek origin)
-{
-  CLookToRead *p = (CLookToRead *)pp;
-  p->pos = p->size = 0;
-  return p->realStream->Seek(p->realStream, pos, origin);
-}
-
-void LookToRead_CreateVTable(CLookToRead *p, int lookahead)
-{
-  p->s.Look = lookahead ?
-      LookToRead_Look_Lookahead :
-      LookToRead_Look_Exact;
-  p->s.Skip = LookToRead_Skip;
-  p->s.Read = LookToRead_Read;
-  p->s.Seek = LookToRead_Seek;
-}
-
-void LookToRead_Init(CLookToRead *p)
-{
-  p->pos = p->size = 0;
-}
-
-static SRes SecToLook_Read(void *pp, void *buf, size_t *size)
-{
-  CSecToLook *p = (CSecToLook *)pp;
-  return LookInStream_LookRead(p->realStream, buf, size);
-}
-
-void SecToLook_CreateVTable(CSecToLook *p)
-{
-  p->s.Read = SecToLook_Read;
-}
-
-static SRes SecToRead_Read(void *pp, void *buf, size_t *size)
-{
-  CSecToRead *p = (CSecToRead *)pp;
-  return p->realStream->Read(p->realStream, buf, size);
-}
-
-void SecToRead_CreateVTable(CSecToRead *p)
-{
-  p->s.Read = SecToRead_Read;
-}
diff --git a/third_party/lzma/v4_65/files/C/7zVersion.h b/third_party/lzma/v4_65/files/C/7zVersion.h
deleted file mode 100644
index b7eb235..0000000
--- a/third_party/lzma/v4_65/files/C/7zVersion.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#define MY_VER_MAJOR 4
-#define MY_VER_MINOR 65
-#define MY_VER_BUILD 0
-#define MY_VERSION "4.65"
-#define MY_DATE "2009-02-03"
-#define MY_COPYRIGHT ": Igor Pavlov : Public domain"
-#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " : " MY_DATE
diff --git a/third_party/lzma/v4_65/files/C/Alloc.c b/third_party/lzma/v4_65/files/C/Alloc.c
deleted file mode 100644
index 358a7b5..0000000
--- a/third_party/lzma/v4_65/files/C/Alloc.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* Alloc.c -- Memory allocation functions
-2008-09-24
-Igor Pavlov
-Public domain */
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-#include <stdlib.h>
-
-#include "Alloc.h"
-
-/* #define _SZ_ALLOC_DEBUG */
-
-/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */
-#ifdef _SZ_ALLOC_DEBUG
-#include <stdio.h>
-int g_allocCount = 0;
-int g_allocCountMid = 0;
-int g_allocCountBig = 0;
-#endif
-
-void *MyAlloc(size_t size)
-{
-  if (size == 0)
-    return 0;
-  #ifdef _SZ_ALLOC_DEBUG
-  {
-    void *p = malloc(size);
-    fprintf(stderr, "\nAlloc %10d bytes, count = %10d,  addr = %8X", size, g_allocCount++, (unsigned)p);
-    return p;
-  }
-  #else
-  return malloc(size);
-  #endif
-}
-
-void MyFree(void *address)
-{
-  #ifdef _SZ_ALLOC_DEBUG
-  if (address != 0)
-    fprintf(stderr, "\nFree; count = %10d,  addr = %8X", --g_allocCount, (unsigned)address);
-  #endif
-  free(address);
-}
-
-#ifdef _WIN32
-
-void *MidAlloc(size_t size)
-{
-  if (size == 0)
-    return 0;
-  #ifdef _SZ_ALLOC_DEBUG
-  fprintf(stderr, "\nAlloc_Mid %10d bytes;  count = %10d", size, g_allocCountMid++);
-  #endif
-  return VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
-}
-
-void MidFree(void *address)
-{
-  #ifdef _SZ_ALLOC_DEBUG
-  if (address != 0)
-    fprintf(stderr, "\nFree_Mid; count = %10d", --g_allocCountMid);
-  #endif
-  if (address == 0)
-    return;
-  VirtualFree(address, 0, MEM_RELEASE);
-}
-
-#ifndef MEM_LARGE_PAGES
-#undef _7ZIP_LARGE_PAGES
-#endif
-
-#ifdef _7ZIP_LARGE_PAGES
-SIZE_T g_LargePageSize = 0;
-typedef SIZE_T (WINAPI *GetLargePageMinimumP)();
-#endif
-
-void SetLargePageSize()
-{
-  #ifdef _7ZIP_LARGE_PAGES
-  SIZE_T size = 0;
-  GetLargePageMinimumP largePageMinimum = (GetLargePageMinimumP)
-        GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetLargePageMinimum");
-  if (largePageMinimum == 0)
-    return;
-  size = largePageMinimum();
-  if (size == 0 || (size & (size - 1)) != 0)
-    return;
-  g_LargePageSize = size;
-  #endif
-}
-
-
-void *BigAlloc(size_t size)
-{
-  if (size == 0)
-    return 0;
-  #ifdef _SZ_ALLOC_DEBUG
-  fprintf(stderr, "\nAlloc_Big %10d bytes;  count = %10d", size, g_allocCountBig++);
-  #endif
-  
-  #ifdef _7ZIP_LARGE_PAGES
-  if (g_LargePageSize != 0 && g_LargePageSize <= (1 << 30) && size >= (1 << 18))
-  {
-    void *res = VirtualAlloc(0, (size + g_LargePageSize - 1) & (~(g_LargePageSize - 1)),
-        MEM_COMMIT | MEM_LARGE_PAGES, PAGE_READWRITE);
-    if (res != 0)
-      return res;
-  }
-  #endif
-  return VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
-}
-
-void BigFree(void *address)
-{
-  #ifdef _SZ_ALLOC_DEBUG
-  if (address != 0)
-    fprintf(stderr, "\nFree_Big; count = %10d", --g_allocCountBig);
-  #endif
-  
-  if (address == 0)
-    return;
-  VirtualFree(address, 0, MEM_RELEASE);
-}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/C/Alloc.h b/third_party/lzma/v4_65/files/C/Alloc.h
deleted file mode 100644
index ff0669c..0000000
--- a/third_party/lzma/v4_65/files/C/Alloc.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Alloc.h -- Memory allocation functions
-2008-03-13
-Igor Pavlov
-Public domain */
-
-#ifndef __COMMON_ALLOC_H
-#define __COMMON_ALLOC_H
-
-#include <stddef.h>
-
-void *MyAlloc(size_t size);
-void MyFree(void *address);
-
-#ifdef _WIN32
-
-void SetLargePageSize();
-
-void *MidAlloc(size_t size);
-void MidFree(void *address);
-void *BigAlloc(size_t size);
-void BigFree(void *address);
-
-#else
-
-#define MidAlloc(size) MyAlloc(size)
-#define MidFree(address) MyFree(address)
-#define BigAlloc(size) MyAlloc(size)
-#define BigFree(address) MyFree(address)
-
-#endif
-
-#endif
diff --git a/third_party/lzma/v4_65/files/C/Archive/7z/7z.dsp b/third_party/lzma/v4_65/files/C/Archive/7z/7z.dsp
deleted file mode 100644
index 9626b03..0000000
--- a/third_party/lzma/v4_65/files/C/Archive/7z/7z.dsp
+++ /dev/null
@@ -1,199 +0,0 @@
-# Microsoft Developer Studio Project File - Name="7z" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=7z - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "7z.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "7z.mak" CFG="7z - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "7z - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "7z - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "7z - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FAs /YX /FD /c
-# ADD BASE RSC /l 0x419 /d "NDEBUG"
-# ADD RSC /l 0x419 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"Release/7zDec.exe" /opt:NOWIN98
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF  "$(CFG)" == "7z - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W4 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_SZ_ALLOC_DEBUG2" /D "_SZ_NO_INT_64_A" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x419 /d "_DEBUG"
-# ADD RSC /l 0x419 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Debug/7zDec.exe" /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "7z - Win32 Release"
-# Name "7z - Win32 Debug"
-# Begin Group "Common"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\7zBuf.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\7zBuf.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\7zCrc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\7zCrc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\7zFile.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\7zFile.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\7zStream.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Bcj2.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Bcj2.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Bra.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Bra86.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\LzmaDec.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\LzmaDec.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Types.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\7zAlloc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\7zAlloc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\7zDecode.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\7zDecode.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\7zExtract.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\7zExtract.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\7zHeader.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\7zHeader.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\7zIn.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\7zIn.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\7zItem.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\7zItem.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\7zMain.c
-# End Source File
-# End Target
-# End Project
diff --git a/third_party/lzma/v4_65/files/C/Archive/7z/7z.dsw b/third_party/lzma/v4_65/files/C/Archive/7z/7z.dsw
deleted file mode 100644
index 848d13c..0000000
--- a/third_party/lzma/v4_65/files/C/Archive/7z/7z.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "7z"=.\7z.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/third_party/lzma/v4_65/files/C/Archive/7z/7zAlloc.c b/third_party/lzma/v4_65/files/C/Archive/7z/7zAlloc.c
deleted file mode 100644
index 4bfaf42..0000000
--- a/third_party/lzma/v4_65/files/C/Archive/7z/7zAlloc.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* 7zAlloc.c -- Allocation functions
-2008-10-04 : Igor Pavlov : Public domain */
-
-#include <stdlib.h>
-#include "7zAlloc.h"
-
-/* #define _SZ_ALLOC_DEBUG */
-/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */
-
-#ifdef _SZ_ALLOC_DEBUG
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-
-#include <stdio.h>
-int g_allocCount = 0;
-int g_allocCountTemp = 0;
-
-#endif
-
-void *SzAlloc(void *p, size_t size)
-{
-  p = p;
-  if (size == 0)
-    return 0;
-  #ifdef _SZ_ALLOC_DEBUG
-  fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, g_allocCount);
-  g_allocCount++;
-  #endif
-  return malloc(size);
-}
-
-void SzFree(void *p, void *address)
-{
-  p = p;
-  #ifdef _SZ_ALLOC_DEBUG
-  if (address != 0)
-  {
-    g_allocCount--;
-    fprintf(stderr, "\nFree; count = %10d", g_allocCount);
-  }
-  #endif
-  free(address);
-}
-
-void *SzAllocTemp(void *p, size_t size)
-{
-  p = p;
-  if (size == 0)
-    return 0;
-  #ifdef _SZ_ALLOC_DEBUG
-  fprintf(stderr, "\nAlloc_temp %10d bytes;  count = %10d", size, g_allocCountTemp);
-  g_allocCountTemp++;
-  #ifdef _WIN32
-  return HeapAlloc(GetProcessHeap(), 0, size);
-  #endif
-  #endif
-  return malloc(size);
-}
-
-void SzFreeTemp(void *p, void *address)
-{
-  p = p;
-  #ifdef _SZ_ALLOC_DEBUG
-  if (address != 0)
-  {
-    g_allocCountTemp--;
-    fprintf(stderr, "\nFree_temp; count = %10d", g_allocCountTemp);
-  }
-  #ifdef _WIN32
-  HeapFree(GetProcessHeap(), 0, address);
-  return;
-  #endif
-  #endif
-  free(address);
-}
diff --git a/third_party/lzma/v4_65/files/C/Archive/7z/7zAlloc.h b/third_party/lzma/v4_65/files/C/Archive/7z/7zAlloc.h
deleted file mode 100644
index e752ef1..0000000
--- a/third_party/lzma/v4_65/files/C/Archive/7z/7zAlloc.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* 7zAlloc.h -- Allocation functions
-2008-10-04 : Igor Pavlov : Public domain */
-
-#ifndef __7Z_ALLOC_H
-#define __7Z_ALLOC_H
-
-#include <stddef.h>
-
-void *SzAlloc(void *p, size_t size);
-void SzFree(void *p, void *address);
-
-void *SzAllocTemp(void *p, size_t size);
-void SzFreeTemp(void *p, void *address);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/C/Archive/7z/7zDecode.c b/third_party/lzma/v4_65/files/C/Archive/7z/7zDecode.c
deleted file mode 100644
index 02526f0..0000000
--- a/third_party/lzma/v4_65/files/C/Archive/7z/7zDecode.c
+++ /dev/null
@@ -1,254 +0,0 @@
-/* 7zDecode.c -- Decoding from 7z folder
-2008-11-23 : Igor Pavlov : Public domain */
-
-#include <string.h>
-
-#include "../../Bcj2.h"
-#include "../../Bra.h"
-#include "../../LzmaDec.h"
-#include "7zDecode.h"
-
-#define k_Copy 0
-#define k_LZMA 0x30101
-#define k_BCJ 0x03030103
-#define k_BCJ2 0x0303011B
-
-static SRes SzDecodeLzma(CSzCoderInfo *coder, UInt64 inSize, ILookInStream *inStream,
-    Byte *outBuffer, SizeT outSize, ISzAlloc *allocMain)
-{
-  CLzmaDec state;
-  SRes res = SZ_OK;
-
-  LzmaDec_Construct(&state);
-  RINOK(LzmaDec_AllocateProbs(&state, coder->Props.data, (unsigned)coder->Props.size, allocMain));
-  state.dic = outBuffer;
-  state.dicBufSize = outSize;
-  LzmaDec_Init(&state);
-
-  for (;;)
-  {
-    Byte *inBuf = NULL;
-    size_t lookahead = (1 << 18);
-    if (lookahead > inSize)
-      lookahead = (size_t)inSize;
-    res = inStream->Look((void *)inStream, (void **)&inBuf, &lookahead);
-    if (res != SZ_OK)
-      break;
-
-    {
-      SizeT inProcessed = (SizeT)lookahead, dicPos = state.dicPos;
-      ELzmaStatus status;
-      res = LzmaDec_DecodeToDic(&state, outSize, inBuf, &inProcessed, LZMA_FINISH_END, &status);
-      lookahead -= inProcessed;
-      inSize -= inProcessed;
-      if (res != SZ_OK)
-        break;
-      if (state.dicPos == state.dicBufSize || (inProcessed == 0 && dicPos == state.dicPos))
-      {
-        if (state.dicBufSize != outSize || lookahead != 0 ||
-            (status != LZMA_STATUS_FINISHED_WITH_MARK &&
-             status != LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK))
-          res = SZ_ERROR_DATA;
-        break;
-      }
-      res = inStream->Skip((void *)inStream, inProcessed);
-      if (res != SZ_OK)
-        break;
-    }
-  }
-
-  LzmaDec_FreeProbs(&state, allocMain);
-  return res;
-}
-
-static SRes SzDecodeCopy(UInt64 inSize, ILookInStream *inStream, Byte *outBuffer)
-{
-  while (inSize > 0)
-  {
-    void *inBuf;
-    size_t curSize = (1 << 18);
-    if (curSize > inSize)
-      curSize = (size_t)inSize;
-    RINOK(inStream->Look((void *)inStream, (void **)&inBuf, &curSize));
-    if (curSize == 0)
-      return SZ_ERROR_INPUT_EOF;
-    memcpy(outBuffer, inBuf, curSize);
-    outBuffer += curSize;
-    inSize -= curSize;
-    RINOK(inStream->Skip((void *)inStream, curSize));
-  }
-  return SZ_OK;
-}
-
-#define IS_UNSUPPORTED_METHOD(m) ((m) != k_Copy && (m) != k_LZMA)
-#define IS_UNSUPPORTED_CODER(c) (IS_UNSUPPORTED_METHOD(c.MethodID) || c.NumInStreams != 1 || c.NumOutStreams != 1)
-#define IS_NO_BCJ(c) (c.MethodID != k_BCJ || c.NumInStreams != 1 || c.NumOutStreams != 1)
-#define IS_NO_BCJ2(c) (c.MethodID != k_BCJ2 || c.NumInStreams != 4 || c.NumOutStreams != 1)
-
-SRes CheckSupportedFolder(const CSzFolder *f)
-{
-  if (f->NumCoders < 1 || f->NumCoders > 4)
-    return SZ_ERROR_UNSUPPORTED;
-  if (IS_UNSUPPORTED_CODER(f->Coders[0]))
-    return SZ_ERROR_UNSUPPORTED;
-  if (f->NumCoders == 1)
-  {
-    if (f->NumPackStreams != 1 || f->PackStreams[0] != 0 || f->NumBindPairs != 0)
-      return SZ_ERROR_UNSUPPORTED;
-    return SZ_OK;
-  }
-  if (f->NumCoders == 2)
-  {
-    if (IS_NO_BCJ(f->Coders[1]) ||
-        f->NumPackStreams != 1 || f->PackStreams[0] != 0 ||
-        f->NumBindPairs != 1 ||
-        f->BindPairs[0].InIndex != 1 || f->BindPairs[0].OutIndex != 0)
-      return SZ_ERROR_UNSUPPORTED;
-    return SZ_OK;
-  }
-  if (f->NumCoders == 4)
-  {
-    if (IS_UNSUPPORTED_CODER(f->Coders[1]) ||
-        IS_UNSUPPORTED_CODER(f->Coders[2]) ||
-        IS_NO_BCJ2(f->Coders[3]))
-      return SZ_ERROR_UNSUPPORTED;
-    if (f->NumPackStreams != 4 ||
-        f->PackStreams[0] != 2 ||
-        f->PackStreams[1] != 6 ||
-        f->PackStreams[2] != 1 ||
-        f->PackStreams[3] != 0 ||
-        f->NumBindPairs != 3 ||
-        f->BindPairs[0].InIndex != 5 || f->BindPairs[0].OutIndex != 0 ||
-        f->BindPairs[1].InIndex != 4 || f->BindPairs[1].OutIndex != 1 ||
-        f->BindPairs[2].InIndex != 3 || f->BindPairs[2].OutIndex != 2)
-      return SZ_ERROR_UNSUPPORTED;
-    return SZ_OK;
-  }
-  return SZ_ERROR_UNSUPPORTED;
-}
-
-UInt64 GetSum(const UInt64 *values, UInt32 index)
-{
-  UInt64 sum = 0;
-  UInt32 i;
-  for (i = 0; i < index; i++)
-    sum += values[i];
-  return sum;
-}
-
-SRes SzDecode2(const UInt64 *packSizes, const CSzFolder *folder,
-    ILookInStream *inStream, UInt64 startPos,
-    Byte *outBuffer, SizeT outSize, ISzAlloc *allocMain,
-    Byte *tempBuf[])
-{
-  UInt32 ci;
-  SizeT tempSizes[3] = { 0, 0, 0};
-  SizeT tempSize3 = 0;
-  Byte *tempBuf3 = 0;
-
-  RINOK(CheckSupportedFolder(folder));
-
-  for (ci = 0; ci < folder->NumCoders; ci++)
-  {
-    CSzCoderInfo *coder = &folder->Coders[ci];
-
-    if (coder->MethodID == k_Copy || coder->MethodID == k_LZMA)
-    {
-      UInt32 si = 0;
-      UInt64 offset;
-      UInt64 inSize;
-      Byte *outBufCur = outBuffer;
-      SizeT outSizeCur = outSize;
-      if (folder->NumCoders == 4)
-      {
-        UInt32 indices[] = { 3, 2, 0 };
-        UInt64 unpackSize = folder->UnpackSizes[ci];
-        si = indices[ci];
-        if (ci < 2)
-        {
-          Byte *temp;
-          outSizeCur = (SizeT)unpackSize;
-          if (outSizeCur != unpackSize)
-            return SZ_ERROR_MEM;
-          temp = (Byte *)IAlloc_Alloc(allocMain, outSizeCur);
-          if (temp == 0 && outSizeCur != 0)
-            return SZ_ERROR_MEM;
-          outBufCur = tempBuf[1 - ci] = temp;
-          tempSizes[1 - ci] = outSizeCur;
-        }
-        else if (ci == 2)
-        {
-          if (unpackSize > outSize) /* check it */
-            return SZ_ERROR_PARAM;
-          tempBuf3 = outBufCur = outBuffer + (outSize - (size_t)unpackSize);
-          tempSize3 = outSizeCur = (SizeT)unpackSize;
-        }
-        else
-          return SZ_ERROR_UNSUPPORTED;
-      }
-      offset = GetSum(packSizes, si);
-      inSize = packSizes[si];
-      RINOK(LookInStream_SeekTo(inStream, startPos + offset));
-
-      if (coder->MethodID == k_Copy)
-      {
-        if (inSize != outSizeCur) /* check it */
-          return SZ_ERROR_DATA;
-        RINOK(SzDecodeCopy(inSize, inStream, outBufCur));
-      }
-      else
-      {
-        RINOK(SzDecodeLzma(coder, inSize, inStream, outBufCur, outSizeCur, allocMain));
-      }
-    }
-    else if (coder->MethodID == k_BCJ)
-    {
-      UInt32 state;
-      if (ci != 1)
-        return SZ_ERROR_UNSUPPORTED;
-      x86_Convert_Init(state);
-      x86_Convert(outBuffer, outSize, 0, &state, 0);
-    }
-    else if (coder->MethodID == k_BCJ2)
-    {
-      UInt64 offset = GetSum(packSizes, 1);
-      UInt64 s3Size = packSizes[1];
-      SRes res;
-      if (ci != 3)
-        return SZ_ERROR_UNSUPPORTED;
-      RINOK(LookInStream_SeekTo(inStream, startPos + offset));
-      tempSizes[2] = (SizeT)s3Size;
-      if (tempSizes[2] != s3Size)
-        return SZ_ERROR_MEM;
-      tempBuf[2] = (Byte *)IAlloc_Alloc(allocMain, tempSizes[2]);
-      if (tempBuf[2] == 0 && tempSizes[2] != 0)
-        return SZ_ERROR_MEM;
-      res = SzDecodeCopy(s3Size, inStream, tempBuf[2]);
-      RINOK(res)
-
-      res = Bcj2_Decode(
-          tempBuf3, tempSize3,
-          tempBuf[0], tempSizes[0],
-          tempBuf[1], tempSizes[1],
-          tempBuf[2], tempSizes[2],
-          outBuffer, outSize);
-      RINOK(res)
-    }
-    else
-      return SZ_ERROR_UNSUPPORTED;
-  }
-  return SZ_OK;
-}
-
-SRes SzDecode(const UInt64 *packSizes, const CSzFolder *folder,
-    ILookInStream *inStream, UInt64 startPos,
-    Byte *outBuffer, size_t outSize, ISzAlloc *allocMain)
-{
-  Byte *tempBuf[3] = { 0, 0, 0};
-  int i;
-  SRes res = SzDecode2(packSizes, folder, inStream, startPos,
-      outBuffer, (SizeT)outSize, allocMain, tempBuf);
-  for (i = 0; i < 3; i++)
-    IAlloc_Free(allocMain, tempBuf[i]);
-  return res;
-}
diff --git a/third_party/lzma/v4_65/files/C/Archive/7z/7zDecode.h b/third_party/lzma/v4_65/files/C/Archive/7z/7zDecode.h
deleted file mode 100644
index e19fe38..0000000
--- a/third_party/lzma/v4_65/files/C/Archive/7z/7zDecode.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* 7zDecode.h -- Decoding from 7z folder
-2008-11-23 : Igor Pavlov : Public domain */
-
-#ifndef __7Z_DECODE_H
-#define __7Z_DECODE_H
-
-#include "7zItem.h"
-
-SRes SzDecode(const UInt64 *packSizes, const CSzFolder *folder,
-    ILookInStream *stream, UInt64 startPos,
-    Byte *outBuffer, size_t outSize, ISzAlloc *allocMain);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/C/Archive/7z/7zExtract.c b/third_party/lzma/v4_65/files/C/Archive/7z/7zExtract.c
deleted file mode 100644
index ff79802..0000000
--- a/third_party/lzma/v4_65/files/C/Archive/7z/7zExtract.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/* 7zExtract.c -- Extracting from 7z archive
-2008-11-23 : Igor Pavlov : Public domain */
-
-#include "../../7zCrc.h"
-#include "7zDecode.h"
-#include "7zExtract.h"
-
-SRes SzAr_Extract(
-    const CSzArEx *p,
-    ILookInStream *inStream,
-    UInt32 fileIndex,
-    UInt32 *blockIndex,
-    Byte **outBuffer,
-    size_t *outBufferSize,
-    size_t *offset,
-    size_t *outSizeProcessed,
-    ISzAlloc *allocMain,
-    ISzAlloc *allocTemp)
-{
-  UInt32 folderIndex = p->FileIndexToFolderIndexMap[fileIndex];
-  SRes res = SZ_OK;
-  *offset = 0;
-  *outSizeProcessed = 0;
-  if (folderIndex == (UInt32)-1)
-  {
-    IAlloc_Free(allocMain, *outBuffer);
-    *blockIndex = folderIndex;
-    *outBuffer = 0;
-    *outBufferSize = 0;
-    return SZ_OK;
-  }
-
-  if (*outBuffer == 0 || *blockIndex != folderIndex)
-  {
-    CSzFolder *folder = p->db.Folders + folderIndex;
-    UInt64 unpackSizeSpec = SzFolder_GetUnpackSize(folder);
-    size_t unpackSize = (size_t)unpackSizeSpec;
-    UInt64 startOffset = SzArEx_GetFolderStreamPos(p, folderIndex, 0);
-
-    if (unpackSize != unpackSizeSpec)
-      return SZ_ERROR_MEM;
-    *blockIndex = folderIndex;
-    IAlloc_Free(allocMain, *outBuffer);
-    *outBuffer = 0;
-    
-    RINOK(LookInStream_SeekTo(inStream, startOffset));
-    
-    if (res == SZ_OK)
-    {
-      *outBufferSize = unpackSize;
-      if (unpackSize != 0)
-      {
-        *outBuffer = (Byte *)IAlloc_Alloc(allocMain, unpackSize);
-        if (*outBuffer == 0)
-          res = SZ_ERROR_MEM;
-      }
-      if (res == SZ_OK)
-      {
-        res = SzDecode(p->db.PackSizes +
-          p->FolderStartPackStreamIndex[folderIndex], folder,
-          inStream, startOffset,
-          *outBuffer, unpackSize, allocTemp);
-        if (res == SZ_OK)
-        {
-          if (folder->UnpackCRCDefined)
-          {
-            if (CrcCalc(*outBuffer, unpackSize) != folder->UnpackCRC)
-              res = SZ_ERROR_CRC;
-          }
-        }
-      }
-    }
-  }
-  if (res == SZ_OK)
-  {
-    UInt32 i;
-    CSzFileItem *fileItem = p->db.Files + fileIndex;
-    *offset = 0;
-    for (i = p->FolderStartFileIndex[folderIndex]; i < fileIndex; i++)
-      *offset += (UInt32)p->db.Files[i].Size;
-    *outSizeProcessed = (size_t)fileItem->Size;
-    if (*offset + *outSizeProcessed > *outBufferSize)
-      return SZ_ERROR_FAIL;
-    {
-      if (fileItem->FileCRCDefined)
-      {
-        if (CrcCalc(*outBuffer + *offset, *outSizeProcessed) != fileItem->FileCRC)
-          res = SZ_ERROR_CRC;
-      }
-    }
-  }
-  return res;
-}
diff --git a/third_party/lzma/v4_65/files/C/Archive/7z/7zExtract.h b/third_party/lzma/v4_65/files/C/Archive/7z/7zExtract.h
deleted file mode 100644
index 5f78415..0000000
--- a/third_party/lzma/v4_65/files/C/Archive/7z/7zExtract.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* 7zExtract.h -- Extracting from 7z archive
-2008-11-23 : Igor Pavlov : Public domain */
-
-#ifndef __7Z_EXTRACT_H
-#define __7Z_EXTRACT_H
-
-#include "7zIn.h"
-
-/*
-  SzExtract extracts file from archive
-
-  *outBuffer must be 0 before first call for each new archive.
-
-  Extracting cache:
-    If you need to decompress more than one file, you can send
-    these values from previous call:
-      *blockIndex,
-      *outBuffer,
-      *outBufferSize
-    You can consider "*outBuffer" as cache of solid block. If your archive is solid,
-    it will increase decompression speed.
-  
-    If you use external function, you can declare these 3 cache variables
-    (blockIndex, outBuffer, outBufferSize) as static in that external function.
-    
-    Free *outBuffer and set *outBuffer to 0, if you want to flush cache.
-*/
-
-SRes SzAr_Extract(
-    const CSzArEx *db,
-    ILookInStream *inStream,
-    UInt32 fileIndex,         /* index of file */
-    UInt32 *blockIndex,       /* index of solid block */
-    Byte **outBuffer,         /* pointer to pointer to output buffer (allocated with allocMain) */
-    size_t *outBufferSize,    /* buffer size for output buffer */
-    size_t *offset,           /* offset of stream for required file in *outBuffer */
-    size_t *outSizeProcessed, /* size of file in *outBuffer */
-    ISzAlloc *allocMain,
-    ISzAlloc *allocTemp);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/C/Archive/7z/7zHeader.c b/third_party/lzma/v4_65/files/C/Archive/7z/7zHeader.c
deleted file mode 100644
index e48faa4..0000000
--- a/third_party/lzma/v4_65/files/C/Archive/7z/7zHeader.c
+++ /dev/null
@@ -1,6 +0,0 @@
-/*  7zHeader.c -- 7z Headers
-2008-10-04 : Igor Pavlov : Public domain */
-
-#include "7zHeader.h"
-
-Byte k7zSignature[k7zSignatureSize] = {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C};
diff --git a/third_party/lzma/v4_65/files/C/Archive/7z/7zHeader.h b/third_party/lzma/v4_65/files/C/Archive/7z/7zHeader.h
deleted file mode 100644
index 9941b6f..0000000
--- a/third_party/lzma/v4_65/files/C/Archive/7z/7zHeader.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* 7zHeader.h -- 7z Headers
-2008-10-04 : Igor Pavlov : Public domain */
-
-#ifndef __7Z_HEADER_H
-#define __7Z_HEADER_H
-
-#include "../../Types.h"
-
-#define k7zSignatureSize 6
-extern Byte k7zSignature[k7zSignatureSize];
-
-#define k7zMajorVersion 0
-
-#define k7zStartHeaderSize 0x20
-
-enum EIdEnum
-{
-  k7zIdEnd,
-    
-  k7zIdHeader,
-    
-  k7zIdArchiveProperties,
-    
-  k7zIdAdditionalStreamsInfo,
-  k7zIdMainStreamsInfo,
-  k7zIdFilesInfo,
-  
-  k7zIdPackInfo,
-  k7zIdUnpackInfo,
-  k7zIdSubStreamsInfo,
-  
-  k7zIdSize,
-  k7zIdCRC,
-  
-  k7zIdFolder,
-  
-  k7zIdCodersUnpackSize,
-  k7zIdNumUnpackStream,
-  
-  k7zIdEmptyStream,
-  k7zIdEmptyFile,
-  k7zIdAnti,
-  
-  k7zIdName,
-  k7zIdCTime,
-  k7zIdATime,
-  k7zIdMTime,
-  k7zIdWinAttributes,
-  k7zIdComment,
-  
-  k7zIdEncodedHeader,
-  
-  k7zIdStartPos,
-  k7zIdDummy
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/C/Archive/7z/7zIn.c b/third_party/lzma/v4_65/files/C/Archive/7z/7zIn.c
deleted file mode 100644
index f6143f8..0000000
--- a/third_party/lzma/v4_65/files/C/Archive/7z/7zIn.c
+++ /dev/null
@@ -1,1204 +0,0 @@
-/* 7zIn.c -- 7z Input functions
-2008-12-31 : Igor Pavlov : Public domain */
-
-#include "../../7zCrc.h"
-#include "../../CpuArch.h"
-
-#include "7zDecode.h"
-#include "7zIn.h"
-
-#define RINOM(x) { if ((x) == 0) return SZ_ERROR_MEM; }
-
-#define NUM_FOLDER_CODERS_MAX 32
-#define NUM_CODER_STREAMS_MAX 32
-
-void SzArEx_Init(CSzArEx *p)
-{
-  SzAr_Init(&p->db);
-  p->FolderStartPackStreamIndex = 0;
-  p->PackStreamStartPositions = 0;
-  p->FolderStartFileIndex = 0;
-  p->FileIndexToFolderIndexMap = 0;
-}
-
-void SzArEx_Free(CSzArEx *p, ISzAlloc *alloc)
-{
-  IAlloc_Free(alloc, p->FolderStartPackStreamIndex);
-  IAlloc_Free(alloc, p->PackStreamStartPositions);
-  IAlloc_Free(alloc, p->FolderStartFileIndex);
-  IAlloc_Free(alloc, p->FileIndexToFolderIndexMap);
-  SzAr_Free(&p->db, alloc);
-  SzArEx_Init(p);
-}
-
-/*
-UInt64 GetFolderPackStreamSize(int folderIndex, int streamIndex) const
-{
-  return PackSizes[FolderStartPackStreamIndex[folderIndex] + streamIndex];
-}
-
-UInt64 GetFilePackSize(int fileIndex) const
-{
-  int folderIndex = FileIndexToFolderIndexMap[fileIndex];
-  if (folderIndex >= 0)
-  {
-    const CSzFolder &folderInfo = Folders[folderIndex];
-    if (FolderStartFileIndex[folderIndex] == fileIndex)
-    return GetFolderFullPackSize(folderIndex);
-  }
-  return 0;
-}
-*/
-
-#define MY_ALLOC(T, p, size, alloc) { if ((size) == 0) p = 0; else \
-  if ((p = (T *)IAlloc_Alloc(alloc, (size) * sizeof(T))) == 0) return SZ_ERROR_MEM; }
-
-static SRes SzArEx_Fill(CSzArEx *p, ISzAlloc *alloc)
-{
-  UInt32 startPos = 0;
-  UInt64 startPosSize = 0;
-  UInt32 i;
-  UInt32 folderIndex = 0;
-  UInt32 indexInFolder = 0;
-  MY_ALLOC(UInt32, p->FolderStartPackStreamIndex, p->db.NumFolders, alloc);
-  for (i = 0; i < p->db.NumFolders; i++)
-  {
-    p->FolderStartPackStreamIndex[i] = startPos;
-    startPos += p->db.Folders[i].NumPackStreams;
-  }
-
-  MY_ALLOC(UInt64, p->PackStreamStartPositions, p->db.NumPackStreams, alloc);
-
-  for (i = 0; i < p->db.NumPackStreams; i++)
-  {
-    p->PackStreamStartPositions[i] = startPosSize;
-    startPosSize += p->db.PackSizes[i];
-  }
-
-  MY_ALLOC(UInt32, p->FolderStartFileIndex, p->db.NumFolders, alloc);
-  MY_ALLOC(UInt32, p->FileIndexToFolderIndexMap, p->db.NumFiles, alloc);
-
-  for (i = 0; i < p->db.NumFiles; i++)
-  {
-    CSzFileItem *file = p->db.Files + i;
-    int emptyStream = !file->HasStream;
-    if (emptyStream && indexInFolder == 0)
-    {
-      p->FileIndexToFolderIndexMap[i] = (UInt32)-1;
-      continue;
-    }
-    if (indexInFolder == 0)
-    {
-      /*
-      v3.13 incorrectly worked with empty folders
-      v4.07: Loop for skipping empty folders
-      */
-      for (;;)
-      {
-        if (folderIndex >= p->db.NumFolders)
-          return SZ_ERROR_ARCHIVE;
-        p->FolderStartFileIndex[folderIndex] = i;
-        if (p->db.Folders[folderIndex].NumUnpackStreams != 0)
-          break;
-        folderIndex++;
-      }
-    }
-    p->FileIndexToFolderIndexMap[i] = folderIndex;
-    if (emptyStream)
-      continue;
-    indexInFolder++;
-    if (indexInFolder >= p->db.Folders[folderIndex].NumUnpackStreams)
-    {
-      folderIndex++;
-      indexInFolder = 0;
-    }
-  }
-  return SZ_OK;
-}
-
-
-UInt64 SzArEx_GetFolderStreamPos(const CSzArEx *p, UInt32 folderIndex, UInt32 indexInFolder)
-{
-  return p->dataPos +
-    p->PackStreamStartPositions[p->FolderStartPackStreamIndex[folderIndex] + indexInFolder];
-}
-
-int SzArEx_GetFolderFullPackSize(const CSzArEx *p, UInt32 folderIndex, UInt64 *resSize)
-{
-  UInt32 packStreamIndex = p->FolderStartPackStreamIndex[folderIndex];
-  CSzFolder *folder = p->db.Folders + folderIndex;
-  UInt64 size = 0;
-  UInt32 i;
-  for (i = 0; i < folder->NumPackStreams; i++)
-  {
-    UInt64 t = size + p->db.PackSizes[packStreamIndex + i];
-    if (t < size) /* check it */
-      return SZ_ERROR_FAIL;
-    size = t;
-  }
-  *resSize = size;
-  return SZ_OK;
-}
-
-
-/*
-SRes SzReadTime(const CObjectVector<CBuf> &dataVector,
-    CObjectVector<CSzFileItem> &files, UInt64 type)
-{
-  CBoolVector boolVector;
-  RINOK(ReadBoolVector2(files.Size(), boolVector))
-
-  CStreamSwitch streamSwitch;
-  RINOK(streamSwitch.Set(this, &dataVector));
-
-  for (int i = 0; i < files.Size(); i++)
-  {
-    CSzFileItem &file = files[i];
-    CArchiveFileTime fileTime;
-    bool defined = boolVector[i];
-    if (defined)
-    {
-      UInt32 low, high;
-      RINOK(SzReadUInt32(low));
-      RINOK(SzReadUInt32(high));
-      fileTime.dwLowDateTime = low;
-      fileTime.dwHighDateTime = high;
-    }
-    switch(type)
-    {
-      case k7zIdCTime: file.IsCTimeDefined = defined; if (defined) file.CTime = fileTime; break;
-      case k7zIdATime: file.IsATimeDefined = defined; if (defined) file.ATime = fileTime; break;
-      case k7zIdMTime: file.IsMTimeDefined = defined; if (defined) file.MTime = fileTime; break;
-    }
-  }
-  return SZ_OK;
-}
-*/
-
-static int TestSignatureCandidate(Byte *testBytes)
-{
-  size_t i;
-  for (i = 0; i < k7zSignatureSize; i++)
-    if (testBytes[i] != k7zSignature[i])
-      return 0;
-  return 1;
-}
-
-typedef struct _CSzState
-{
-  Byte *Data;
-  size_t Size;
-}CSzData;
-
-static SRes SzReadByte(CSzData *sd, Byte *b)
-{
-  if (sd->Size == 0)
-    return SZ_ERROR_ARCHIVE;
-  sd->Size--;
-  *b = *sd->Data++;
-  return SZ_OK;
-}
-
-static SRes SzReadBytes(CSzData *sd, Byte *data, size_t size)
-{
-  size_t i;
-  for (i = 0; i < size; i++)
-  {
-    RINOK(SzReadByte(sd, data + i));
-  }
-  return SZ_OK;
-}
-
-static SRes SzReadUInt32(CSzData *sd, UInt32 *value)
-{
-  int i;
-  *value = 0;
-  for (i = 0; i < 4; i++)
-  {
-    Byte b;
-    RINOK(SzReadByte(sd, &b));
-    *value |= ((UInt32)(b) << (8 * i));
-  }
-  return SZ_OK;
-}
-
-static SRes SzReadNumber(CSzData *sd, UInt64 *value)
-{
-  Byte firstByte;
-  Byte mask = 0x80;
-  int i;
-  RINOK(SzReadByte(sd, &firstByte));
-  *value = 0;
-  for (i = 0; i < 8; i++)
-  {
-    Byte b;
-    if ((firstByte & mask) == 0)
-    {
-      UInt64 highPart = firstByte & (mask - 1);
-      *value += (highPart << (8 * i));
-      return SZ_OK;
-    }
-    RINOK(SzReadByte(sd, &b));
-    *value |= ((UInt64)b << (8 * i));
-    mask >>= 1;
-  }
-  return SZ_OK;
-}
-
-static SRes SzReadNumber32(CSzData *sd, UInt32 *value)
-{
-  UInt64 value64;
-  RINOK(SzReadNumber(sd, &value64));
-  if (value64 >= 0x80000000)
-    return SZ_ERROR_UNSUPPORTED;
-  if (value64 >= ((UInt64)(1) << ((sizeof(size_t) - 1) * 8 + 2)))
-    return SZ_ERROR_UNSUPPORTED;
-  *value = (UInt32)value64;
-  return SZ_OK;
-}
-
-static SRes SzReadID(CSzData *sd, UInt64 *value)
-{
-  return SzReadNumber(sd, value);
-}
-
-static SRes SzSkeepDataSize(CSzData *sd, UInt64 size)
-{
-  if (size > sd->Size)
-    return SZ_ERROR_ARCHIVE;
-  sd->Size -= (size_t)size;
-  sd->Data += (size_t)size;
-  return SZ_OK;
-}
-
-static SRes SzSkeepData(CSzData *sd)
-{
-  UInt64 size;
-  RINOK(SzReadNumber(sd, &size));
-  return SzSkeepDataSize(sd, size);
-}
-
-static SRes SzReadArchiveProperties(CSzData *sd)
-{
-  for (;;)
-  {
-    UInt64 type;
-    RINOK(SzReadID(sd, &type));
-    if (type == k7zIdEnd)
-      break;
-    SzSkeepData(sd);
-  }
-  return SZ_OK;
-}
-
-static SRes SzWaitAttribute(CSzData *sd, UInt64 attribute)
-{
-  for (;;)
-  {
-    UInt64 type;
-    RINOK(SzReadID(sd, &type));
-    if (type == attribute)
-      return SZ_OK;
-    if (type == k7zIdEnd)
-      return SZ_ERROR_ARCHIVE;
-    RINOK(SzSkeepData(sd));
-  }
-}
-
-static SRes SzReadBoolVector(CSzData *sd, size_t numItems, Byte **v, ISzAlloc *alloc)
-{
-  Byte b = 0;
-  Byte mask = 0;
-  size_t i;
-  MY_ALLOC(Byte, *v, numItems, alloc);
-  for (i = 0; i < numItems; i++)
-  {
-    if (mask == 0)
-    {
-      RINOK(SzReadByte(sd, &b));
-      mask = 0x80;
-    }
-    (*v)[i] = (Byte)(((b & mask) != 0) ? 1 : 0);
-    mask >>= 1;
-  }
-  return SZ_OK;
-}
-
-static SRes SzReadBoolVector2(CSzData *sd, size_t numItems, Byte **v, ISzAlloc *alloc)
-{
-  Byte allAreDefined;
-  size_t i;
-  RINOK(SzReadByte(sd, &allAreDefined));
-  if (allAreDefined == 0)
-    return SzReadBoolVector(sd, numItems, v, alloc);
-  MY_ALLOC(Byte, *v, numItems, alloc);
-  for (i = 0; i < numItems; i++)
-    (*v)[i] = 1;
-  return SZ_OK;
-}
-
-static SRes SzReadHashDigests(
-    CSzData *sd,
-    size_t numItems,
-    Byte **digestsDefined,
-    UInt32 **digests,
-    ISzAlloc *alloc)
-{
-  size_t i;
-  RINOK(SzReadBoolVector2(sd, numItems, digestsDefined, alloc));
-  MY_ALLOC(UInt32, *digests, numItems, alloc);
-  for (i = 0; i < numItems; i++)
-    if ((*digestsDefined)[i])
-    {
-      RINOK(SzReadUInt32(sd, (*digests) + i));
-    }
-  return SZ_OK;
-}
-
-static SRes SzReadPackInfo(
-    CSzData *sd,
-    UInt64 *dataOffset,
-    UInt32 *numPackStreams,
-    UInt64 **packSizes,
-    Byte **packCRCsDefined,
-    UInt32 **packCRCs,
-    ISzAlloc *alloc)
-{
-  UInt32 i;
-  RINOK(SzReadNumber(sd, dataOffset));
-  RINOK(SzReadNumber32(sd, numPackStreams));
-
-  RINOK(SzWaitAttribute(sd, k7zIdSize));
-
-  MY_ALLOC(UInt64, *packSizes, (size_t)*numPackStreams, alloc);
-
-  for (i = 0; i < *numPackStreams; i++)
-  {
-    RINOK(SzReadNumber(sd, (*packSizes) + i));
-  }
-
-  for (;;)
-  {
-    UInt64 type;
-    RINOK(SzReadID(sd, &type));
-    if (type == k7zIdEnd)
-      break;
-    if (type == k7zIdCRC)
-    {
-      RINOK(SzReadHashDigests(sd, (size_t)*numPackStreams, packCRCsDefined, packCRCs, alloc));
-      continue;
-    }
-    RINOK(SzSkeepData(sd));
-  }
-  if (*packCRCsDefined == 0)
-  {
-    MY_ALLOC(Byte, *packCRCsDefined, (size_t)*numPackStreams, alloc);
-    MY_ALLOC(UInt32, *packCRCs, (size_t)*numPackStreams, alloc);
-    for (i = 0; i < *numPackStreams; i++)
-    {
-      (*packCRCsDefined)[i] = 0;
-      (*packCRCs)[i] = 0;
-    }
-  }
-  return SZ_OK;
-}
-
-static SRes SzReadSwitch(CSzData *sd)
-{
-  Byte external;
-  RINOK(SzReadByte(sd, &external));
-  return (external == 0) ? SZ_OK: SZ_ERROR_UNSUPPORTED;
-}
-
-static SRes SzGetNextFolderItem(CSzData *sd, CSzFolder *folder, ISzAlloc *alloc)
-{
-  UInt32 numCoders, numBindPairs, numPackStreams, i;
-  UInt32 numInStreams = 0, numOutStreams = 0;
-  
-  RINOK(SzReadNumber32(sd, &numCoders));
-  if (numCoders > NUM_FOLDER_CODERS_MAX)
-    return SZ_ERROR_UNSUPPORTED;
-  folder->NumCoders = numCoders;
-  
-  MY_ALLOC(CSzCoderInfo, folder->Coders, (size_t)numCoders, alloc);
-
-  for (i = 0; i < numCoders; i++)
-    SzCoderInfo_Init(folder->Coders + i);
-
-  for (i = 0; i < numCoders; i++)
-  {
-    Byte mainByte;
-    CSzCoderInfo *coder = folder->Coders + i;
-    {
-      unsigned idSize, j;
-      Byte longID[15];
-      RINOK(SzReadByte(sd, &mainByte));
-      idSize = (unsigned)(mainByte & 0xF);
-      RINOK(SzReadBytes(sd, longID, idSize));
-      if (idSize > sizeof(coder->MethodID))
-        return SZ_ERROR_UNSUPPORTED;
-      coder->MethodID = 0;
-      for (j = 0; j < idSize; j++)
-        coder->MethodID |= (UInt64)longID[idSize - 1 - j] << (8 * j);
-
-      if ((mainByte & 0x10) != 0)
-      {
-        RINOK(SzReadNumber32(sd, &coder->NumInStreams));
-        RINOK(SzReadNumber32(sd, &coder->NumOutStreams));
-        if (coder->NumInStreams > NUM_CODER_STREAMS_MAX ||
-            coder->NumOutStreams > NUM_CODER_STREAMS_MAX)
-          return SZ_ERROR_UNSUPPORTED;
-      }
-      else
-      {
-        coder->NumInStreams = 1;
-        coder->NumOutStreams = 1;
-      }
-      if ((mainByte & 0x20) != 0)
-      {
-        UInt64 propertiesSize = 0;
-        RINOK(SzReadNumber(sd, &propertiesSize));
-        if (!Buf_Create(&coder->Props, (size_t)propertiesSize, alloc))
-          return SZ_ERROR_MEM;
-        RINOK(SzReadBytes(sd, coder->Props.data, (size_t)propertiesSize));
-      }
-    }
-    while ((mainByte & 0x80) != 0)
-    {
-      RINOK(SzReadByte(sd, &mainByte));
-      RINOK(SzSkeepDataSize(sd, (mainByte & 0xF)));
-      if ((mainByte & 0x10) != 0)
-      {
-        UInt32 n;
-        RINOK(SzReadNumber32(sd, &n));
-        RINOK(SzReadNumber32(sd, &n));
-      }
-      if ((mainByte & 0x20) != 0)
-      {
-        UInt64 propertiesSize = 0;
-        RINOK(SzReadNumber(sd, &propertiesSize));
-        RINOK(SzSkeepDataSize(sd, propertiesSize));
-      }
-    }
-    numInStreams += coder->NumInStreams;
-    numOutStreams += coder->NumOutStreams;
-  }
-
-  if (numOutStreams == 0)
-    return SZ_ERROR_UNSUPPORTED;
-
-  folder->NumBindPairs = numBindPairs = numOutStreams - 1;
-  MY_ALLOC(CBindPair, folder->BindPairs, (size_t)numBindPairs, alloc);
-
-  for (i = 0; i < numBindPairs; i++)
-  {
-    CBindPair *bp = folder->BindPairs + i;
-    RINOK(SzReadNumber32(sd, &bp->InIndex));
-    RINOK(SzReadNumber32(sd, &bp->OutIndex));
-  }
-
-  if (numInStreams < numBindPairs)
-    return SZ_ERROR_UNSUPPORTED;
-
-  folder->NumPackStreams = numPackStreams = numInStreams - numBindPairs;
-  MY_ALLOC(UInt32, folder->PackStreams, (size_t)numPackStreams, alloc);
-
-  if (numPackStreams == 1)
-  {
-    for (i = 0; i < numInStreams ; i++)
-      if (SzFolder_FindBindPairForInStream(folder, i) < 0)
-        break;
-    if (i == numInStreams)
-      return SZ_ERROR_UNSUPPORTED;
-    folder->PackStreams[0] = i;
-  }
-  else
-    for (i = 0; i < numPackStreams; i++)
-    {
-      RINOK(SzReadNumber32(sd, folder->PackStreams + i));
-    }
-  return SZ_OK;
-}
-
-static SRes SzReadUnpackInfo(
-    CSzData *sd,
-    UInt32 *numFolders,
-    CSzFolder **folders,  /* for alloc */
-    ISzAlloc *alloc,
-    ISzAlloc *allocTemp)
-{
-  UInt32 i;
-  RINOK(SzWaitAttribute(sd, k7zIdFolder));
-  RINOK(SzReadNumber32(sd, numFolders));
-  {
-    RINOK(SzReadSwitch(sd));
-
-    MY_ALLOC(CSzFolder, *folders, (size_t)*numFolders, alloc);
-
-    for (i = 0; i < *numFolders; i++)
-      SzFolder_Init((*folders) + i);
-
-    for (i = 0; i < *numFolders; i++)
-    {
-      RINOK(SzGetNextFolderItem(sd, (*folders) + i, alloc));
-    }
-  }
-
-  RINOK(SzWaitAttribute(sd, k7zIdCodersUnpackSize));
-
-  for (i = 0; i < *numFolders; i++)
-  {
-    UInt32 j;
-    CSzFolder *folder = (*folders) + i;
-    UInt32 numOutStreams = SzFolder_GetNumOutStreams(folder);
-
-    MY_ALLOC(UInt64, folder->UnpackSizes, (size_t)numOutStreams, alloc);
-
-    for (j = 0; j < numOutStreams; j++)
-    {
-      RINOK(SzReadNumber(sd, folder->UnpackSizes + j));
-    }
-  }
-
-  for (;;)
-  {
-    UInt64 type;
-    RINOK(SzReadID(sd, &type));
-    if (type == k7zIdEnd)
-      return SZ_OK;
-    if (type == k7zIdCRC)
-    {
-      SRes res;
-      Byte *crcsDefined = 0;
-      UInt32 *crcs = 0;
-      res = SzReadHashDigests(sd, *numFolders, &crcsDefined, &crcs, allocTemp);
-      if (res == SZ_OK)
-      {
-        for (i = 0; i < *numFolders; i++)
-        {
-          CSzFolder *folder = (*folders) + i;
-          folder->UnpackCRCDefined = crcsDefined[i];
-          folder->UnpackCRC = crcs[i];
-        }
-      }
-      IAlloc_Free(allocTemp, crcs);
-      IAlloc_Free(allocTemp, crcsDefined);
-      RINOK(res);
-      continue;
-    }
-    RINOK(SzSkeepData(sd));
-  }
-}
-
-static SRes SzReadSubStreamsInfo(
-    CSzData *sd,
-    UInt32 numFolders,
-    CSzFolder *folders,
-    UInt32 *numUnpackStreams,
-    UInt64 **unpackSizes,
-    Byte **digestsDefined,
-    UInt32 **digests,
-    ISzAlloc *allocTemp)
-{
-  UInt64 type = 0;
-  UInt32 i;
-  UInt32 si = 0;
-  UInt32 numDigests = 0;
-
-  for (i = 0; i < numFolders; i++)
-    folders[i].NumUnpackStreams = 1;
-  *numUnpackStreams = numFolders;
-
-  for (;;)
-  {
-    RINOK(SzReadID(sd, &type));
-    if (type == k7zIdNumUnpackStream)
-    {
-      *numUnpackStreams = 0;
-      for (i = 0; i < numFolders; i++)
-      {
-        UInt32 numStreams;
-        RINOK(SzReadNumber32(sd, &numStreams));
-        folders[i].NumUnpackStreams = numStreams;
-        *numUnpackStreams += numStreams;
-      }
-      continue;
-    }
-    if (type == k7zIdCRC || type == k7zIdSize)
-      break;
-    if (type == k7zIdEnd)
-      break;
-    RINOK(SzSkeepData(sd));
-  }
-
-  if (*numUnpackStreams == 0)
-  {
-    *unpackSizes = 0;
-    *digestsDefined = 0;
-    *digests = 0;
-  }
-  else
-  {
-    *unpackSizes = (UInt64 *)IAlloc_Alloc(allocTemp, (size_t)*numUnpackStreams * sizeof(UInt64));
-    RINOM(*unpackSizes);
-    *digestsDefined = (Byte *)IAlloc_Alloc(allocTemp, (size_t)*numUnpackStreams * sizeof(Byte));
-    RINOM(*digestsDefined);
-    *digests = (UInt32 *)IAlloc_Alloc(allocTemp, (size_t)*numUnpackStreams * sizeof(UInt32));
-    RINOM(*digests);
-  }
-
-  for (i = 0; i < numFolders; i++)
-  {
-    /*
-    v3.13 incorrectly worked with empty folders
-    v4.07: we check that folder is empty
-    */
-    UInt64 sum = 0;
-    UInt32 j;
-    UInt32 numSubstreams = folders[i].NumUnpackStreams;
-    if (numSubstreams == 0)
-      continue;
-    if (type == k7zIdSize)
-    for (j = 1; j < numSubstreams; j++)
-    {
-      UInt64 size;
-      RINOK(SzReadNumber(sd, &size));
-      (*unpackSizes)[si++] = size;
-      sum += size;
-    }
-    (*unpackSizes)[si++] = SzFolder_GetUnpackSize(folders + i) - sum;
-  }
-  if (type == k7zIdSize)
-  {
-    RINOK(SzReadID(sd, &type));
-  }
-
-  for (i = 0; i < *numUnpackStreams; i++)
-  {
-    (*digestsDefined)[i] = 0;
-    (*digests)[i] = 0;
-  }
-
-
-  for (i = 0; i < numFolders; i++)
-  {
-    UInt32 numSubstreams = folders[i].NumUnpackStreams;
-    if (numSubstreams != 1 || !folders[i].UnpackCRCDefined)
-      numDigests += numSubstreams;
-  }
-
- 
-  si = 0;
-  for (;;)
-  {
-    if (type == k7zIdCRC)
-    {
-      int digestIndex = 0;
-      Byte *digestsDefined2 = 0;
-      UInt32 *digests2 = 0;
-      SRes res = SzReadHashDigests(sd, numDigests, &digestsDefined2, &digests2, allocTemp);
-      if (res == SZ_OK)
-      {
-        for (i = 0; i < numFolders; i++)
-        {
-          CSzFolder *folder = folders + i;
-          UInt32 numSubstreams = folder->NumUnpackStreams;
-          if (numSubstreams == 1 && folder->UnpackCRCDefined)
-          {
-            (*digestsDefined)[si] = 1;
-            (*digests)[si] = folder->UnpackCRC;
-            si++;
-          }
-          else
-          {
-            UInt32 j;
-            for (j = 0; j < numSubstreams; j++, digestIndex++)
-            {
-              (*digestsDefined)[si] = digestsDefined2[digestIndex];
-              (*digests)[si] = digests2[digestIndex];
-              si++;
-            }
-          }
-        }
-      }
-      IAlloc_Free(allocTemp, digestsDefined2);
-      IAlloc_Free(allocTemp, digests2);
-      RINOK(res);
-    }
-    else if (type == k7zIdEnd)
-      return SZ_OK;
-    else
-    {
-      RINOK(SzSkeepData(sd));
-    }
-    RINOK(SzReadID(sd, &type));
-  }
-}
-
-
-static SRes SzReadStreamsInfo(
-    CSzData *sd,
-    UInt64 *dataOffset,
-    CSzAr *p,
-    UInt32 *numUnpackStreams,
-    UInt64 **unpackSizes, /* allocTemp */
-    Byte **digestsDefined,   /* allocTemp */
-    UInt32 **digests,        /* allocTemp */
-    ISzAlloc *alloc,
-    ISzAlloc *allocTemp)
-{
-  for (;;)
-  {
-    UInt64 type;
-    RINOK(SzReadID(sd, &type));
-    if ((UInt64)(int)type != type)
-      return SZ_ERROR_UNSUPPORTED;
-    switch((int)type)
-    {
-      case k7zIdEnd:
-        return SZ_OK;
-      case k7zIdPackInfo:
-      {
-        RINOK(SzReadPackInfo(sd, dataOffset, &p->NumPackStreams,
-            &p->PackSizes, &p->PackCRCsDefined, &p->PackCRCs, alloc));
-        break;
-      }
-      case k7zIdUnpackInfo:
-      {
-        RINOK(SzReadUnpackInfo(sd, &p->NumFolders, &p->Folders, alloc, allocTemp));
-        break;
-      }
-      case k7zIdSubStreamsInfo:
-      {
-        RINOK(SzReadSubStreamsInfo(sd, p->NumFolders, p->Folders,
-            numUnpackStreams, unpackSizes, digestsDefined, digests, allocTemp));
-        break;
-      }
-      default:
-        return SZ_ERROR_UNSUPPORTED;
-    }
-  }
-}
-
-Byte kUtf8Limits[5] = { 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
-
-static SRes SzReadFileNames(CSzData *sd, UInt32 numFiles, CSzFileItem *files, ISzAlloc *alloc)
-{
-  UInt32 i;
-  for (i = 0; i < numFiles; i++)
-  {
-    UInt32 len = 0;
-    UInt32 pos = 0;
-    CSzFileItem *file = files + i;
-    while (pos + 2 <= sd->Size)
-    {
-      int numAdds;
-      UInt32 value = (UInt32)(sd->Data[pos] | (((UInt32)sd->Data[pos + 1]) << 8));
-      pos += 2;
-      len++;
-      if (value == 0)
-        break;
-      if (value < 0x80)
-        continue;
-      if (value >= 0xD800 && value < 0xE000)
-      {
-        UInt32 c2;
-        if (value >= 0xDC00)
-          return SZ_ERROR_ARCHIVE;
-        if (pos + 2 > sd->Size)
-          return SZ_ERROR_ARCHIVE;
-        c2 = (UInt32)(sd->Data[pos] | (((UInt32)sd->Data[pos + 1]) << 8));
-        pos += 2;
-        if (c2 < 0xDC00 || c2 >= 0xE000)
-          return SZ_ERROR_ARCHIVE;
-        value = ((value - 0xD800) << 10) | (c2 - 0xDC00);
-      }
-      for (numAdds = 1; numAdds < 5; numAdds++)
-        if (value < (((UInt32)1) << (numAdds * 5 + 6)))
-          break;
-      len += numAdds;
-    }
-
-    MY_ALLOC(char, file->Name, (size_t)len, alloc);
-
-    len = 0;
-    while (2 <= sd->Size)
-    {
-      int numAdds;
-      UInt32 value = (UInt32)(sd->Data[0] | (((UInt32)sd->Data[1]) << 8));
-      SzSkeepDataSize(sd, 2);
-      if (value < 0x80)
-      {
-        file->Name[len++] = (char)value;
-        if (value == 0)
-          break;
-        continue;
-      }
-      if (value >= 0xD800 && value < 0xE000)
-      {
-        UInt32 c2 = (UInt32)(sd->Data[0] | (((UInt32)sd->Data[1]) << 8));
-        SzSkeepDataSize(sd, 2);
-        value = ((value - 0xD800) << 10) | (c2 - 0xDC00);
-      }
-      for (numAdds = 1; numAdds < 5; numAdds++)
-        if (value < (((UInt32)1) << (numAdds * 5 + 6)))
-          break;
-      file->Name[len++] = (char)(kUtf8Limits[numAdds - 1] + (value >> (6 * numAdds)));
-      do
-      {
-        numAdds--;
-        file->Name[len++] = (char)(0x80 + ((value >> (6 * numAdds)) & 0x3F));
-      }
-      while (numAdds > 0);
-
-      len += numAdds;
-    }
-  }
-  return SZ_OK;
-}
-
-static SRes SzReadHeader2(
-    CSzArEx *p,   /* allocMain */
-    CSzData *sd,
-    UInt64 **unpackSizes,  /* allocTemp */
-    Byte **digestsDefined,    /* allocTemp */
-    UInt32 **digests,         /* allocTemp */
-    Byte **emptyStreamVector, /* allocTemp */
-    Byte **emptyFileVector,   /* allocTemp */
-    Byte **lwtVector,         /* allocTemp */
-    ISzAlloc *allocMain,
-    ISzAlloc *allocTemp)
-{
-  UInt64 type;
-  UInt32 numUnpackStreams = 0;
-  UInt32 numFiles = 0;
-  CSzFileItem *files = 0;
-  UInt32 numEmptyStreams = 0;
-  UInt32 i;
-
-  RINOK(SzReadID(sd, &type));
-
-  if (type == k7zIdArchiveProperties)
-  {
-    RINOK(SzReadArchiveProperties(sd));
-    RINOK(SzReadID(sd, &type));
-  }
- 
- 
-  if (type == k7zIdMainStreamsInfo)
-  {
-    RINOK(SzReadStreamsInfo(sd,
-        &p->dataPos,
-        &p->db,
-        &numUnpackStreams,
-        unpackSizes,
-        digestsDefined,
-        digests, allocMain, allocTemp));
-    p->dataPos += p->startPosAfterHeader;
-    RINOK(SzReadID(sd, &type));
-  }
-
-  if (type == k7zIdEnd)
-    return SZ_OK;
-  if (type != k7zIdFilesInfo)
-    return SZ_ERROR_ARCHIVE;
-  
-  RINOK(SzReadNumber32(sd, &numFiles));
-  p->db.NumFiles = numFiles;
-
-  MY_ALLOC(CSzFileItem, files, (size_t)numFiles, allocMain);
-
-  p->db.Files = files;
-  for (i = 0; i < numFiles; i++)
-    SzFile_Init(files + i);
-
-  for (;;)
-  {
-    UInt64 type;
-    UInt64 size;
-    RINOK(SzReadID(sd, &type));
-    if (type == k7zIdEnd)
-      break;
-    RINOK(SzReadNumber(sd, &size));
-
-    if ((UInt64)(int)type != type)
-    {
-      RINOK(SzSkeepDataSize(sd, size));
-    }
-    else
-    switch((int)type)
-    {
-      case k7zIdName:
-      {
-        RINOK(SzReadSwitch(sd));
-        RINOK(SzReadFileNames(sd, numFiles, files, allocMain))
-        break;
-      }
-      case k7zIdEmptyStream:
-      {
-        RINOK(SzReadBoolVector(sd, numFiles, emptyStreamVector, allocTemp));
-        numEmptyStreams = 0;
-        for (i = 0; i < numFiles; i++)
-          if ((*emptyStreamVector)[i])
-            numEmptyStreams++;
-        break;
-      }
-      case k7zIdEmptyFile:
-      {
-        RINOK(SzReadBoolVector(sd, numEmptyStreams, emptyFileVector, allocTemp));
-        break;
-      }
-      case k7zIdMTime:
-      {
-        RINOK(SzReadBoolVector2(sd, numFiles, lwtVector, allocTemp));
-        RINOK(SzReadSwitch(sd));
-        for (i = 0; i < numFiles; i++)
-        {
-          CSzFileItem *f = &files[i];
-          Byte defined = (*lwtVector)[i];
-          f->MTimeDefined = defined;
-          f->MTime.Low = f->MTime.High = 0;
-          if (defined)
-          {
-            RINOK(SzReadUInt32(sd, &f->MTime.Low));
-            RINOK(SzReadUInt32(sd, &f->MTime.High));
-          }
-        }
-        break;
-      }
-      default:
-      {
-        RINOK(SzSkeepDataSize(sd, size));
-      }
-    }
-  }
-
-  {
-    UInt32 emptyFileIndex = 0;
-    UInt32 sizeIndex = 0;
-    for (i = 0; i < numFiles; i++)
-    {
-      CSzFileItem *file = files + i;
-      file->IsAnti = 0;
-      if (*emptyStreamVector == 0)
-        file->HasStream = 1;
-      else
-        file->HasStream = (Byte)((*emptyStreamVector)[i] ? 0 : 1);
-      if (file->HasStream)
-      {
-        file->IsDir = 0;
-        file->Size = (*unpackSizes)[sizeIndex];
-        file->FileCRC = (*digests)[sizeIndex];
-        file->FileCRCDefined = (Byte)(*digestsDefined)[sizeIndex];
-        sizeIndex++;
-      }
-      else
-      {
-        if (*emptyFileVector == 0)
-          file->IsDir = 1;
-        else
-          file->IsDir = (Byte)((*emptyFileVector)[emptyFileIndex] ? 0 : 1);
-        emptyFileIndex++;
-        file->Size = 0;
-        file->FileCRCDefined = 0;
-      }
-    }
-  }
-  return SzArEx_Fill(p, allocMain);
-}
-
-static SRes SzReadHeader(
-    CSzArEx *p,
-    CSzData *sd,
-    ISzAlloc *allocMain,
-    ISzAlloc *allocTemp)
-{
-  UInt64 *unpackSizes = 0;
-  Byte *digestsDefined = 0;
-  UInt32 *digests = 0;
-  Byte *emptyStreamVector = 0;
-  Byte *emptyFileVector = 0;
-  Byte *lwtVector = 0;
-  SRes res = SzReadHeader2(p, sd,
-      &unpackSizes, &digestsDefined, &digests,
-      &emptyStreamVector, &emptyFileVector, &lwtVector,
-      allocMain, allocTemp);
-  IAlloc_Free(allocTemp, unpackSizes);
-  IAlloc_Free(allocTemp, digestsDefined);
-  IAlloc_Free(allocTemp, digests);
-  IAlloc_Free(allocTemp, emptyStreamVector);
-  IAlloc_Free(allocTemp, emptyFileVector);
-  IAlloc_Free(allocTemp, lwtVector);
-  return res;
-}
-
-static SRes SzReadAndDecodePackedStreams2(
-    ILookInStream *inStream,
-    CSzData *sd,
-    CBuf *outBuffer,
-    UInt64 baseOffset,
-    CSzAr *p,
-    UInt64 **unpackSizes,
-    Byte **digestsDefined,
-    UInt32 **digests,
-    ISzAlloc *allocTemp)
-{
-
-  UInt32 numUnpackStreams = 0;
-  UInt64 dataStartPos;
-  CSzFolder *folder;
-  UInt64 unpackSize;
-  SRes res;
-
-  RINOK(SzReadStreamsInfo(sd, &dataStartPos, p,
-      &numUnpackStreams,  unpackSizes, digestsDefined, digests,
-      allocTemp, allocTemp));
-  
-  dataStartPos += baseOffset;
-  if (p->NumFolders != 1)
-    return SZ_ERROR_ARCHIVE;
-
-  folder = p->Folders;
-  unpackSize = SzFolder_GetUnpackSize(folder);
-  
-  RINOK(LookInStream_SeekTo(inStream, dataStartPos));
-
-  if (!Buf_Create(outBuffer, (size_t)unpackSize, allocTemp))
-    return SZ_ERROR_MEM;
-  
-  res = SzDecode(p->PackSizes, folder,
-          inStream, dataStartPos,
-          outBuffer->data, (size_t)unpackSize, allocTemp);
-  RINOK(res);
-  if (folder->UnpackCRCDefined)
-    if (CrcCalc(outBuffer->data, (size_t)unpackSize) != folder->UnpackCRC)
-      return SZ_ERROR_CRC;
-  return SZ_OK;
-}
-
-static SRes SzReadAndDecodePackedStreams(
-    ILookInStream *inStream,
-    CSzData *sd,
-    CBuf *outBuffer,
-    UInt64 baseOffset,
-    ISzAlloc *allocTemp)
-{
-  CSzAr p;
-  UInt64 *unpackSizes = 0;
-  Byte *digestsDefined = 0;
-  UInt32 *digests = 0;
-  SRes res;
-  SzAr_Init(&p);
-  res = SzReadAndDecodePackedStreams2(inStream, sd, outBuffer, baseOffset,
-    &p, &unpackSizes, &digestsDefined, &digests,
-    allocTemp);
-  SzAr_Free(&p, allocTemp);
-  IAlloc_Free(allocTemp, unpackSizes);
-  IAlloc_Free(allocTemp, digestsDefined);
-  IAlloc_Free(allocTemp, digests);
-  return res;
-}
-
-static SRes SzArEx_Open2(
-    CSzArEx *p,
-    ILookInStream *inStream,
-    ISzAlloc *allocMain,
-    ISzAlloc *allocTemp)
-{
-  Byte header[k7zStartHeaderSize];
-  UInt64 nextHeaderOffset, nextHeaderSize;
-  size_t nextHeaderSizeT;
-  UInt32 nextHeaderCRC;
-  CBuf buffer;
-  SRes res;
-
-  RINOK(LookInStream_Read2(inStream, header, k7zStartHeaderSize, SZ_ERROR_NO_ARCHIVE));
-
-  if (!TestSignatureCandidate(header))
-    return SZ_ERROR_NO_ARCHIVE;
-  if (header[6] != k7zMajorVersion)
-    return SZ_ERROR_UNSUPPORTED;
-
-  nextHeaderOffset = GetUi64(header + 12);
-  nextHeaderSize = GetUi64(header + 20);
-  nextHeaderCRC = GetUi32(header + 28);
-
-  p->startPosAfterHeader = k7zStartHeaderSize;
-  
-  if (CrcCalc(header + 12, 20) != GetUi32(header + 8))
-    return SZ_ERROR_CRC;
-
-  nextHeaderSizeT = (size_t)nextHeaderSize;
-  if (nextHeaderSizeT != nextHeaderSize)
-    return SZ_ERROR_MEM;
-  if (nextHeaderSizeT == 0)
-    return SZ_OK;
-  if (nextHeaderOffset > nextHeaderOffset + nextHeaderSize ||
-      nextHeaderOffset > nextHeaderOffset + nextHeaderSize + k7zStartHeaderSize)
-    return SZ_ERROR_NO_ARCHIVE;
-
-  {
-    Int64 pos = 0;
-    RINOK(inStream->Seek(inStream, &pos, SZ_SEEK_END));
-    if ((UInt64)pos < nextHeaderOffset ||
-        (UInt64)pos < k7zStartHeaderSize + nextHeaderOffset ||
-        (UInt64)pos < k7zStartHeaderSize + nextHeaderOffset + nextHeaderSize)
-      return SZ_ERROR_INPUT_EOF;
-  }
-
-  RINOK(LookInStream_SeekTo(inStream, k7zStartHeaderSize + nextHeaderOffset));
-
-  if (!Buf_Create(&buffer, nextHeaderSizeT, allocTemp))
-    return SZ_ERROR_MEM;
-
-  res = LookInStream_Read(inStream, buffer.data, nextHeaderSizeT);
-  if (res == SZ_OK)
-  {
-    res = SZ_ERROR_ARCHIVE;
-    if (CrcCalc(buffer.data, nextHeaderSizeT) == nextHeaderCRC)
-    {
-      CSzData sd;
-      UInt64 type;
-      sd.Data = buffer.data;
-      sd.Size = buffer.size;
-      res = SzReadID(&sd, &type);
-      if (res == SZ_OK)
-      {
-        if (type == k7zIdEncodedHeader)
-        {
-          CBuf outBuffer;
-          Buf_Init(&outBuffer);
-          res = SzReadAndDecodePackedStreams(inStream, &sd, &outBuffer, p->startPosAfterHeader, allocTemp);
-          if (res != SZ_OK)
-            Buf_Free(&outBuffer, allocTemp);
-          else
-          {
-            Buf_Free(&buffer, allocTemp);
-            buffer.data = outBuffer.data;
-            buffer.size = outBuffer.size;
-            sd.Data = buffer.data;
-            sd.Size = buffer.size;
-            res = SzReadID(&sd, &type);
-          }
-        }
-      }
-      if (res == SZ_OK)
-      {
-        if (type == k7zIdHeader)
-          res = SzReadHeader(p, &sd, allocMain, allocTemp);
-        else
-          res = SZ_ERROR_UNSUPPORTED;
-      }
-    }
-  }
-  Buf_Free(&buffer, allocTemp);
-  return res;
-}
-
-SRes SzArEx_Open(CSzArEx *p, ILookInStream *inStream, ISzAlloc *allocMain, ISzAlloc *allocTemp)
-{
-  SRes res = SzArEx_Open2(p, inStream, allocMain, allocTemp);
-  if (res != SZ_OK)
-    SzArEx_Free(p, allocMain);
-  return res;
-}
diff --git a/third_party/lzma/v4_65/files/C/Archive/7z/7zIn.h b/third_party/lzma/v4_65/files/C/Archive/7z/7zIn.h
deleted file mode 100644
index c8430a7..0000000
--- a/third_party/lzma/v4_65/files/C/Archive/7z/7zIn.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* 7zIn.h -- 7z Input functions
-2008-11-23 : Igor Pavlov : Public domain */
-
-#ifndef __7Z_IN_H
-#define __7Z_IN_H
-
-#include "7zHeader.h"
-#include "7zItem.h"
-
-typedef struct
-{
-  CSzAr db;
-  
-  UInt64 startPosAfterHeader;
-  UInt64 dataPos;
-
-  UInt32 *FolderStartPackStreamIndex;
-  UInt64 *PackStreamStartPositions;
-  UInt32 *FolderStartFileIndex;
-  UInt32 *FileIndexToFolderIndexMap;
-} CSzArEx;
-
-void SzArEx_Init(CSzArEx *p);
-void SzArEx_Free(CSzArEx *p, ISzAlloc *alloc);
-UInt64 SzArEx_GetFolderStreamPos(const CSzArEx *p, UInt32 folderIndex, UInt32 indexInFolder);
-int SzArEx_GetFolderFullPackSize(const CSzArEx *p, UInt32 folderIndex, UInt64 *resSize);
-
-/*
-Errors:
-SZ_ERROR_NO_ARCHIVE
-SZ_ERROR_ARCHIVE
-SZ_ERROR_UNSUPPORTED
-SZ_ERROR_MEM
-SZ_ERROR_CRC
-SZ_ERROR_INPUT_EOF
-SZ_ERROR_FAIL
-*/
-
-SRes SzArEx_Open(CSzArEx *p, ILookInStream *inStream, ISzAlloc *allocMain, ISzAlloc *allocTemp);
- 
-#endif
diff --git a/third_party/lzma/v4_65/files/C/Archive/7z/7zItem.c b/third_party/lzma/v4_65/files/C/Archive/7z/7zItem.c
deleted file mode 100644
index db44571..0000000
--- a/third_party/lzma/v4_65/files/C/Archive/7z/7zItem.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* 7zItem.c -- 7z Items
-2008-10-04 : Igor Pavlov : Public domain */
-
-#include "7zItem.h"
-
-void SzCoderInfo_Init(CSzCoderInfo *p)
-{
-  Buf_Init(&p->Props);
-}
-
-void SzCoderInfo_Free(CSzCoderInfo *p, ISzAlloc *alloc)
-{
-  Buf_Free(&p->Props, alloc);
-  SzCoderInfo_Init(p);
-}
-
-void SzFolder_Init(CSzFolder *p)
-{
-  p->Coders = 0;
-  p->BindPairs = 0;
-  p->PackStreams = 0;
-  p->UnpackSizes = 0;
-  p->NumCoders = 0;
-  p->NumBindPairs = 0;
-  p->NumPackStreams = 0;
-  p->UnpackCRCDefined = 0;
-  p->UnpackCRC = 0;
-  p->NumUnpackStreams = 0;
-}
-
-void SzFolder_Free(CSzFolder *p, ISzAlloc *alloc)
-{
-  UInt32 i;
-  if (p->Coders)
-    for (i = 0; i < p->NumCoders; i++)
-      SzCoderInfo_Free(&p->Coders[i], alloc);
-  IAlloc_Free(alloc, p->Coders);
-  IAlloc_Free(alloc, p->BindPairs);
-  IAlloc_Free(alloc, p->PackStreams);
-  IAlloc_Free(alloc, p->UnpackSizes);
-  SzFolder_Init(p);
-}
-
-UInt32 SzFolder_GetNumOutStreams(CSzFolder *p)
-{
-  UInt32 result = 0;
-  UInt32 i;
-  for (i = 0; i < p->NumCoders; i++)
-    result += p->Coders[i].NumOutStreams;
-  return result;
-}
-
-int SzFolder_FindBindPairForInStream(CSzFolder *p, UInt32 inStreamIndex)
-{
-  UInt32 i;
-  for (i = 0; i < p->NumBindPairs; i++)
-    if (p->BindPairs[i].InIndex == inStreamIndex)
-      return i;
-  return -1;
-}
-
-
-int SzFolder_FindBindPairForOutStream(CSzFolder *p, UInt32 outStreamIndex)
-{
-  UInt32 i;
-  for (i = 0; i < p->NumBindPairs; i++)
-    if (p->BindPairs[i].OutIndex == outStreamIndex)
-      return i;
-  return -1;
-}
-
-UInt64 SzFolder_GetUnpackSize(CSzFolder *p)
-{
-  int i = (int)SzFolder_GetNumOutStreams(p);
-  if (i == 0)
-    return 0;
-  for (i--; i >= 0; i--)
-    if (SzFolder_FindBindPairForOutStream(p, i) < 0)
-      return p->UnpackSizes[i];
-  /* throw 1; */
-  return 0;
-}
-
-void SzFile_Init(CSzFileItem *p)
-{
-  p->HasStream = 1;
-  p->IsDir = 0;
-  p->IsAnti = 0;
-  p->FileCRCDefined = 0;
-  p->MTimeDefined = 0;
-  p->Name = 0;
-}
-
-static void SzFile_Free(CSzFileItem *p, ISzAlloc *alloc)
-{
-  IAlloc_Free(alloc, p->Name);
-  SzFile_Init(p);
-}
-
-void SzAr_Init(CSzAr *p)
-{
-  p->PackSizes = 0;
-  p->PackCRCsDefined = 0;
-  p->PackCRCs = 0;
-  p->Folders = 0;
-  p->Files = 0;
-  p->NumPackStreams = 0;
-  p->NumFolders = 0;
-  p->NumFiles = 0;
-}
-
-void SzAr_Free(CSzAr *p, ISzAlloc *alloc)
-{
-  UInt32 i;
-  if (p->Folders)
-    for (i = 0; i < p->NumFolders; i++)
-      SzFolder_Free(&p->Folders[i], alloc);
-  if (p->Files)
-    for (i = 0; i < p->NumFiles; i++)
-      SzFile_Free(&p->Files[i], alloc);
-  IAlloc_Free(alloc, p->PackSizes);
-  IAlloc_Free(alloc, p->PackCRCsDefined);
-  IAlloc_Free(alloc, p->PackCRCs);
-  IAlloc_Free(alloc, p->Folders);
-  IAlloc_Free(alloc, p->Files);
-  SzAr_Init(p);
-}
diff --git a/third_party/lzma/v4_65/files/C/Archive/7z/7zItem.h b/third_party/lzma/v4_65/files/C/Archive/7z/7zItem.h
deleted file mode 100644
index 9f1366c..0000000
--- a/third_party/lzma/v4_65/files/C/Archive/7z/7zItem.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* 7zItem.h -- 7z Items
-2008-10-04 : Igor Pavlov : Public domain */
-
-#ifndef __7Z_ITEM_H
-#define __7Z_ITEM_H
-
-#include "../../7zBuf.h"
-
-typedef struct
-{
-  UInt32 NumInStreams;
-  UInt32 NumOutStreams;
-  UInt64 MethodID;
-  CBuf Props;
-} CSzCoderInfo;
-
-void SzCoderInfo_Init(CSzCoderInfo *p);
-void SzCoderInfo_Free(CSzCoderInfo *p, ISzAlloc *alloc);
-
-typedef struct
-{
-  UInt32 InIndex;
-  UInt32 OutIndex;
-} CBindPair;
-
-typedef struct
-{
-  CSzCoderInfo *Coders;
-  CBindPair *BindPairs;
-  UInt32 *PackStreams;
-  UInt64 *UnpackSizes;
-  UInt32 NumCoders;
-  UInt32 NumBindPairs;
-  UInt32 NumPackStreams;
-  int UnpackCRCDefined;
-  UInt32 UnpackCRC;
-
-  UInt32 NumUnpackStreams;
-} CSzFolder;
-
-void SzFolder_Init(CSzFolder *p);
-UInt64 SzFolder_GetUnpackSize(CSzFolder *p);
-int SzFolder_FindBindPairForInStream(CSzFolder *p, UInt32 inStreamIndex);
-UInt32 SzFolder_GetNumOutStreams(CSzFolder *p);
-UInt64 SzFolder_GetUnpackSize(CSzFolder *p);
-
-typedef struct
-{
-  UInt32 Low;
-  UInt32 High;
-} CNtfsFileTime;
-
-typedef struct
-{
-  CNtfsFileTime MTime;
-  UInt64 Size;
-  char *Name;
-  UInt32 FileCRC;
-
-  Byte HasStream;
-  Byte IsDir;
-  Byte IsAnti;
-  Byte FileCRCDefined;
-  Byte MTimeDefined;
-} CSzFileItem;
-
-void SzFile_Init(CSzFileItem *p);
-
-typedef struct
-{
-  UInt64 *PackSizes;
-  Byte *PackCRCsDefined;
-  UInt32 *PackCRCs;
-  CSzFolder *Folders;
-  CSzFileItem *Files;
-  UInt32 NumPackStreams;
-  UInt32 NumFolders;
-  UInt32 NumFiles;
-} CSzAr;
-
-void SzAr_Init(CSzAr *p);
-void SzAr_Free(CSzAr *p, ISzAlloc *alloc);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/C/Archive/7z/7zMain.c b/third_party/lzma/v4_65/files/C/Archive/7z/7zMain.c
deleted file mode 100644
index 0c20e8c..0000000
--- a/third_party/lzma/v4_65/files/C/Archive/7z/7zMain.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/* 7zMain.c - Test application for 7z Decoder
-2008-11-23 : Igor Pavlov : Public domain */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "../../7zCrc.h"
-#include "../../7zFile.h"
-#include "../../7zVersion.h"
-
-#include "7zAlloc.h"
-#include "7zExtract.h"
-#include "7zIn.h"
-
-static void ConvertNumberToString(UInt64 value, char *s)
-{
-  char temp[32];
-  int pos = 0;
-  do
-  {
-    temp[pos++] = (char)('0' + (int)(value % 10));
-    value /= 10;
-  }
-  while (value != 0);
-  do
-    *s++ = temp[--pos];
-  while (pos > 0);
-  *s = '\0';
-}
-
-#define PERIOD_4 (4 * 365 + 1)
-#define PERIOD_100 (PERIOD_4 * 25 - 1)
-#define PERIOD_400 (PERIOD_100 * 4 + 1)
-
-static void ConvertFileTimeToString(CNtfsFileTime *ft, char *s)
-{
-  unsigned year, mon, day, hour, min, sec;
-  UInt64 v64 = ft->Low | ((UInt64)ft->High << 32);
-  Byte ms[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
-  unsigned temp;
-  UInt32 v;
-  v64 /= 10000000;
-  sec = (unsigned)(v64 % 60);
-  v64 /= 60;
-  min = (unsigned)(v64 % 60);
-  v64 /= 60;
-  hour = (unsigned)(v64 % 24);
-  v64 /= 24;
-
-  v = (UInt32)v64;
-
-  year = (unsigned)(1601 + v / PERIOD_400 * 400);
-  v %= PERIOD_400;
-
-  temp = (unsigned)(v / PERIOD_100);
-  if (temp == 4)
-    temp = 3;
-  year += temp * 100;
-  v -= temp * PERIOD_100;
-
-  temp = v / PERIOD_4;
-  if (temp == 25)
-    temp = 24;
-  year += temp * 4;
-  v -= temp * PERIOD_4;
-
-  temp = v / 365;
-  if (temp == 4)
-    temp = 3;
-  year += temp;
-  v -= temp * 365;
-
-  if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))
-    ms[1] = 29;
-  for (mon = 1; mon <= 12; mon++)
-  {
-    unsigned s = ms[mon - 1];
-    if (v < s)
-      break;
-    v -= s;
-  }
-  day = (unsigned)v + 1;
-  sprintf(s, "%04d-%02d-%02d %02d:%02d:%02d", year, mon, day, hour, min, sec);
-}
-
-void PrintError(char *sz)
-{
-  printf("\nERROR: %s\n", sz);
-}
-
-int MY_CDECL main(int numargs, char *args[])
-{
-  CFileInStream archiveStream;
-  CLookToRead lookStream;
-  CSzArEx db;
-  SRes res;
-  ISzAlloc allocImp;
-  ISzAlloc allocTempImp;
-
-  printf("\n7z ANSI-C Decoder " MY_VERSION_COPYRIGHT_DATE "\n");
-  if (numargs == 1)
-  {
-    printf(
-      "\nUsage: 7zDec <command> <archive_name>\n\n"
-      "<Commands>\n"
-      "  e: Extract files from archive\n"
-      "  l: List contents of archive\n"
-      "  t: Test integrity of archive\n");
-    return 0;
-  }
-  if (numargs < 3)
-  {
-    PrintError("incorrect command");
-    return 1;
-  }
-
-  if (InFile_Open(&archiveStream.file, args[2]))
-  {
-    PrintError("can not open input file");
-    return 1;
-  }
-
-  
-  FileInStream_CreateVTable(&archiveStream);
-  LookToRead_CreateVTable(&lookStream, False);
-  
-  lookStream.realStream = &archiveStream.s;
-  LookToRead_Init(&lookStream);
-
-  allocImp.Alloc = SzAlloc;
-  allocImp.Free = SzFree;
-
-  allocTempImp.Alloc = SzAllocTemp;
-  allocTempImp.Free = SzFreeTemp;
-
-  CrcGenerateTable();
-
-  SzArEx_Init(&db);
-  res = SzArEx_Open(&db, &lookStream.s, &allocImp, &allocTempImp);
-  if (res == SZ_OK)
-  {
-    char *command = args[1];
-    int listCommand = 0, testCommand = 0, extractCommand = 0;
-    if (strcmp(command, "l") == 0) listCommand = 1;
-    else if (strcmp(command, "t") == 0) testCommand = 1;
-    else if (strcmp(command, "e") == 0) extractCommand = 1;
-
-    if (listCommand)
-    {
-      UInt32 i;
-      for (i = 0; i < db.db.NumFiles; i++)
-      {
-        CSzFileItem *f = db.db.Files + i;
-        char s[32], t[32];
-        ConvertNumberToString(f->Size, s);
-        if (f->MTimeDefined)
-          ConvertFileTimeToString(&f->MTime, t);
-        else
-          strcpy(t, "                   ");
-
-        printf("%s %10s  %s\n", t, s, f->Name);
-      }
-    }
-    else if (testCommand || extractCommand)
-    {
-      UInt32 i;
-
-      /*
-      if you need cache, use these 3 variables.
-      if you use external function, you can make these variable as static.
-      */
-      UInt32 blockIndex = 0xFFFFFFFF; /* it can have any value before first call (if outBuffer = 0) */
-      Byte *outBuffer = 0; /* it must be 0 before first call for each new archive. */
-      size_t outBufferSize = 0;  /* it can have any value before first call (if outBuffer = 0) */
-
-      printf("\n");
-      for (i = 0; i < db.db.NumFiles; i++)
-      {
-        size_t offset;
-        size_t outSizeProcessed;
-        CSzFileItem *f = db.db.Files + i;
-        if (f->IsDir)
-          printf("Directory ");
-        else
-          printf(testCommand ?
-            "Testing   ":
-            "Extracting");
-        printf(" %s", f->Name);
-        if (f->IsDir)
-        {
-          printf("\n");
-          continue;
-        }
-        res = SzAr_Extract(&db, &lookStream.s, i,
-            &blockIndex, &outBuffer, &outBufferSize,
-            &offset, &outSizeProcessed,
-            &allocImp, &allocTempImp);
-        if (res != SZ_OK)
-          break;
-        if (!testCommand)
-        {
-          CSzFile outFile;
-          size_t processedSize;
-          char *fileName = f->Name;
-          size_t nameLen = strlen(f->Name);
-          for (; nameLen > 0; nameLen--)
-            if (f->Name[nameLen - 1] == '/')
-            {
-              fileName = f->Name + nameLen;
-              break;
-            }
-            
-          if (OutFile_Open(&outFile, fileName))
-          {
-            PrintError("can not open output file");
-            res = SZ_ERROR_FAIL;
-            break;
-          }
-          processedSize = outSizeProcessed;
-          if (File_Write(&outFile, outBuffer + offset, &processedSize) != 0 ||
-              processedSize != outSizeProcessed)
-          {
-            PrintError("can not write output file");
-            res = SZ_ERROR_FAIL;
-            break;
-          }
-          if (File_Close(&outFile))
-          {
-            PrintError("can not close output file");
-            res = SZ_ERROR_FAIL;
-            break;
-          }
-        }
-        printf("\n");
-      }
-      IAlloc_Free(&allocImp, outBuffer);
-    }
-    else
-    {
-      PrintError("incorrect command");
-      res = SZ_ERROR_FAIL;
-    }
-  }
-  SzArEx_Free(&db, &allocImp);
-
-  File_Close(&archiveStream.file);
-  if (res == SZ_OK)
-  {
-    printf("\nEverything is Ok\n");
-    return 0;
-  }
-  if (res == SZ_ERROR_UNSUPPORTED)
-    PrintError("decoder doesn't support this archive");
-  else if (res == SZ_ERROR_MEM)
-    PrintError("can not allocate memory");
-  else if (res == SZ_ERROR_CRC)
-    PrintError("CRC error");
-  else
-    printf("\nERROR #%d\n", res);
-  return 1;
-}
diff --git a/third_party/lzma/v4_65/files/C/Archive/7z/makefile b/third_party/lzma/v4_65/files/C/Archive/7z/makefile
deleted file mode 100644
index c7bb05b..0000000
--- a/third_party/lzma/v4_65/files/C/Archive/7z/makefile
+++ /dev/null
@@ -1,33 +0,0 @@
-MY_STATIC_LINK=1
-
-PROG = 7zDec.exe
-
-C_OBJS = \
-  $O\7zBuf.obj \
-  $O\7zBuf2.obj \
-  $O\7zCrc.obj \
-  $O\LzmaDec.obj \
-  $O\Bra86.obj \
-  $O\Bcj2.obj \
-  $O\7zFile.obj \
-  $O\7zStream.obj \
-
-7Z_OBJS = \
-  $O\7zAlloc.obj \
-  $O\7zDecode.obj \
-  $O\7zExtract.obj \
-  $O\7zHeader.obj \
-  $O\7zIn.obj \
-  $O\7zItem.obj \
-  $O\7zMain.obj \
-
-OBJS = \
-  $(7Z_OBJS) \
-  $(C_OBJS) \
-
-!include "../../../CPP/Build.mak"
-
-$(7Z_OBJS): $(*B).c
-	$(COMPL_O1)
-$(C_OBJS): ../../$(*B).c
-	$(COMPL_O2)
diff --git a/third_party/lzma/v4_65/files/C/Archive/7z/makefile.gcc b/third_party/lzma/v4_65/files/C/Archive/7z/makefile.gcc
deleted file mode 100644
index 2203dfc..0000000
--- a/third_party/lzma/v4_65/files/C/Archive/7z/makefile.gcc
+++ /dev/null
@@ -1,61 +0,0 @@
-PROG = 7zDec
-CXX = g++
-LIB =
-RM = rm -f
-CFLAGS = -c -O2 -Wall
-
-OBJS = 7zAlloc.o 7zBuf.o 7zBuf2.o 7zCrc.o 7zDecode.o 7zExtract.o 7zHeader.o 7zIn.o 7zItem.o 7zMain.o LzmaDec.o Bra86.o Bcj2.o 7zFile.o 7zStream.o
-
-all: $(PROG)
-
-$(PROG): $(OBJS)
-	$(CXX) -o $(PROG) $(LDFLAGS) $(OBJS) $(LIB)
-
-7zAlloc.o: 7zAlloc.c
-	$(CXX) $(CFLAGS) 7zAlloc.c
-
-7zBuf.o: ../../7zBuf.c
-	$(CXX) $(CFLAGS) ../../7zBuf.c
-
-7zBuf2.o: ../../7zBuf2.c
-	$(CXX) $(CFLAGS) ../../7zBuf2.c
-
-7zCrc.o: ../../7zCrc.c
-	$(CXX) $(CFLAGS) ../../7zCrc.c
-
-7zDecode.o: 7zDecode.c
-	$(CXX) $(CFLAGS) 7zDecode.c
-
-7zExtract.o: 7zExtract.c
-	$(CXX) $(CFLAGS) 7zExtract.c
-
-7zHeader.o: 7zHeader.c
-	$(CXX) $(CFLAGS) 7zHeader.c
-
-7zIn.o: 7zIn.c
-	$(CXX) $(CFLAGS) 7zIn.c
-
-7zItem.o: 7zItem.c
-	$(CXX) $(CFLAGS) 7zItem.c
-
-7zMain.o: 7zMain.c
-	$(CXX) $(CFLAGS) 7zMain.c
-
-LzmaDec.o: ../../LzmaDec.c
-	$(CXX) $(CFLAGS) ../../LzmaDec.c
-
-Bra86.o: ../../Bra86.c
-	$(CXX) $(CFLAGS) ../../Bra86.c
-
-Bcj2.o: ../../Bcj2.c
-	$(CXX) $(CFLAGS) ../../Bcj2.c
-
-7zFile.o: ../../7zFile.c
-	$(CXX) $(CFLAGS) ../../7zFile.c
-
-7zStream.o: ../../7zStream.c
-	$(CXX) $(CFLAGS) ../../7zStream.c
-
-clean:
-	-$(RM) $(PROG) $(OBJS)
-
diff --git a/third_party/lzma/v4_65/files/C/Bcj2.c b/third_party/lzma/v4_65/files/C/Bcj2.c
deleted file mode 100644
index 20199ce..0000000
--- a/third_party/lzma/v4_65/files/C/Bcj2.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/* Bcj2.c -- Converter for x86 code (BCJ2)
-2008-10-04 : Igor Pavlov : Public domain */
-
-#include "Bcj2.h"
-
-#ifdef _LZMA_PROB32
-#define CProb UInt32
-#else
-#define CProb UInt16
-#endif
-
-#define IsJcc(b0, b1) ((b0) == 0x0F && ((b1) & 0xF0) == 0x80)
-#define IsJ(b0, b1) ((b1 & 0xFE) == 0xE8 || IsJcc(b0, b1))
-
-#define kNumTopBits 24
-#define kTopValue ((UInt32)1 << kNumTopBits)
-
-#define kNumBitModelTotalBits 11
-#define kBitModelTotal (1 << kNumBitModelTotalBits)
-#define kNumMoveBits 5
-
-#define RC_READ_BYTE (*buffer++)
-#define RC_TEST { if (buffer == bufferLim) return SZ_ERROR_DATA; }
-#define RC_INIT2 code = 0; range = 0xFFFFFFFF; \
-  { int i; for (i = 0; i < 5; i++) { RC_TEST; code = (code << 8) | RC_READ_BYTE; }}
-
-#define NORMALIZE if (range < kTopValue) { RC_TEST; range <<= 8; code = (code << 8) | RC_READ_BYTE; }
-
-#define IF_BIT_0(p) ttt = *(p); bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
-#define UPDATE_0(p) range = bound; *(p) = (CProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits)); NORMALIZE;
-#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CProb)(ttt - (ttt >> kNumMoveBits)); NORMALIZE;
-
-int Bcj2_Decode(
-    const Byte *buf0, SizeT size0,
-    const Byte *buf1, SizeT size1,
-    const Byte *buf2, SizeT size2,
-    const Byte *buf3, SizeT size3,
-    Byte *outBuf, SizeT outSize)
-{
-  CProb p[256 + 2];
-  SizeT inPos = 0, outPos = 0;
-
-  const Byte *buffer, *bufferLim;
-  UInt32 range, code;
-  Byte prevByte = 0;
-
-  unsigned int i;
-  for (i = 0; i < sizeof(p) / sizeof(p[0]); i++)
-    p[i] = kBitModelTotal >> 1;
-
-  buffer = buf3;
-  bufferLim = buffer + size3;
-  RC_INIT2
-
-  if (outSize == 0)
-    return SZ_OK;
-
-  for (;;)
-  {
-    Byte b;
-    CProb *prob;
-    UInt32 bound;
-    UInt32 ttt;
-
-    SizeT limit = size0 - inPos;
-    if (outSize - outPos < limit)
-      limit = outSize - outPos;
-    while (limit != 0)
-    {
-      Byte b = buf0[inPos];
-      outBuf[outPos++] = b;
-      if (IsJ(prevByte, b))
-        break;
-      inPos++;
-      prevByte = b;
-      limit--;
-    }
-
-    if (limit == 0 || outPos == outSize)
-      break;
-
-    b = buf0[inPos++];
-
-    if (b == 0xE8)
-      prob = p + prevByte;
-    else if (b == 0xE9)
-      prob = p + 256;
-    else
-      prob = p + 257;
-
-    IF_BIT_0(prob)
-    {
-      UPDATE_0(prob)
-      prevByte = b;
-    }
-    else
-    {
-      UInt32 dest;
-      const Byte *v;
-      UPDATE_1(prob)
-      if (b == 0xE8)
-      {
-        v = buf1;
-        if (size1 < 4)
-          return SZ_ERROR_DATA;
-        buf1 += 4;
-        size1 -= 4;
-      }
-      else
-      {
-        v = buf2;
-        if (size2 < 4)
-          return SZ_ERROR_DATA;
-        buf2 += 4;
-        size2 -= 4;
-      }
-      dest = (((UInt32)v[0] << 24) | ((UInt32)v[1] << 16) |
-          ((UInt32)v[2] << 8) | ((UInt32)v[3])) - ((UInt32)outPos + 4);
-      outBuf[outPos++] = (Byte)dest;
-      if (outPos == outSize)
-        break;
-      outBuf[outPos++] = (Byte)(dest >> 8);
-      if (outPos == outSize)
-        break;
-      outBuf[outPos++] = (Byte)(dest >> 16);
-      if (outPos == outSize)
-        break;
-      outBuf[outPos++] = prevByte = (Byte)(dest >> 24);
-    }
-  }
-  return (outPos == outSize) ? SZ_OK : SZ_ERROR_DATA;
-}
diff --git a/third_party/lzma/v4_65/files/C/Bcj2.h b/third_party/lzma/v4_65/files/C/Bcj2.h
deleted file mode 100644
index 32d450b..0000000
--- a/third_party/lzma/v4_65/files/C/Bcj2.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Bcj2.h -- Converter for x86 code (BCJ2)
-2008-10-04 : Igor Pavlov : Public domain */
-
-#ifndef __BCJ2_H
-#define __BCJ2_H
-
-#include "Types.h"
-
-/*
-Conditions:
-  outSize <= FullOutputSize,
-  where FullOutputSize is full size of output stream of x86_2 filter.
-
-If buf0 overlaps outBuf, there are two required conditions:
-  1) (buf0 >= outBuf)
-  2) (buf0 + size0 >= outBuf + FullOutputSize).
-
-Returns:
-  SZ_OK
-  SZ_ERROR_DATA - Data error
-*/
-
-int Bcj2_Decode(
-    const Byte *buf0, SizeT size0,
-    const Byte *buf1, SizeT size1,
-    const Byte *buf2, SizeT size2,
-    const Byte *buf3, SizeT size3,
-    Byte *outBuf, SizeT outSize);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/C/Bra.c b/third_party/lzma/v4_65/files/C/Bra.c
deleted file mode 100644
index 5e54695..0000000
--- a/third_party/lzma/v4_65/files/C/Bra.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* Bra.c -- Converters for RISC code
-2008-10-04 : Igor Pavlov : Public domain */
-
-#include "Bra.h"
-
-SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
-{
-  SizeT i;
-  if (size < 4)
-    return 0;
-  size -= 4;
-  ip += 8;
-  for (i = 0; i <= size; i += 4)
-  {
-    if (data[i + 3] == 0xEB)
-    {
-      UInt32 dest;
-      UInt32 src = ((UInt32)data[i + 2] << 16) | ((UInt32)data[i + 1] << 8) | (data[i + 0]);
-      src <<= 2;
-      if (encoding)
-        dest = ip + (UInt32)i + src;
-      else
-        dest = src - (ip + (UInt32)i);
-      dest >>= 2;
-      data[i + 2] = (Byte)(dest >> 16);
-      data[i + 1] = (Byte)(dest >> 8);
-      data[i + 0] = (Byte)dest;
-    }
-  }
-  return i;
-}
-
-SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
-{
-  SizeT i;
-  if (size < 4)
-    return 0;
-  size -= 4;
-  ip += 4;
-  for (i = 0; i <= size; i += 2)
-  {
-    if ((data[i + 1] & 0xF8) == 0xF0 &&
-        (data[i + 3] & 0xF8) == 0xF8)
-    {
-      UInt32 dest;
-      UInt32 src =
-        (((UInt32)data[i + 1] & 0x7) << 19) |
-        ((UInt32)data[i + 0] << 11) |
-        (((UInt32)data[i + 3] & 0x7) << 8) |
-        (data[i + 2]);
-      
-      src <<= 1;
-      if (encoding)
-        dest = ip + (UInt32)i + src;
-      else
-        dest = src - (ip + (UInt32)i);
-      dest >>= 1;
-      
-      data[i + 1] = (Byte)(0xF0 | ((dest >> 19) & 0x7));
-      data[i + 0] = (Byte)(dest >> 11);
-      data[i + 3] = (Byte)(0xF8 | ((dest >> 8) & 0x7));
-      data[i + 2] = (Byte)dest;
-      i += 2;
-    }
-  }
-  return i;
-}
-
-SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
-{
-  SizeT i;
-  if (size < 4)
-    return 0;
-  size -= 4;
-  for (i = 0; i <= size; i += 4)
-  {
-    if ((data[i] >> 2) == 0x12 && (data[i + 3] & 3) == 1)
-    {
-      UInt32 src = ((UInt32)(data[i + 0] & 3) << 24) |
-        ((UInt32)data[i + 1] << 16) |
-        ((UInt32)data[i + 2] << 8) |
-        ((UInt32)data[i + 3] & (~3));
-      
-      UInt32 dest;
-      if (encoding)
-        dest = ip + (UInt32)i + src;
-      else
-        dest = src - (ip + (UInt32)i);
-      data[i + 0] = (Byte)(0x48 | ((dest >> 24) &  0x3));
-      data[i + 1] = (Byte)(dest >> 16);
-      data[i + 2] = (Byte)(dest >> 8);
-      data[i + 3] &= 0x3;
-      data[i + 3] |= dest;
-    }
-  }
-  return i;
-}
-
-SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
-{
-  UInt32 i;
-  if (size < 4)
-    return 0;
-  size -= 4;
-  for (i = 0; i <= size; i += 4)
-  {
-    if (data[i] == 0x40 && (data[i + 1] & 0xC0) == 0x00 ||
-        data[i] == 0x7F && (data[i + 1] & 0xC0) == 0xC0)
-    {
-      UInt32 src =
-        ((UInt32)data[i + 0] << 24) |
-        ((UInt32)data[i + 1] << 16) |
-        ((UInt32)data[i + 2] << 8) |
-        ((UInt32)data[i + 3]);
-      UInt32 dest;
-      
-      src <<= 2;
-      if (encoding)
-        dest = ip + i + src;
-      else
-        dest = src - (ip + i);
-      dest >>= 2;
-      
-      dest = (((0 - ((dest >> 22) & 1)) << 22) & 0x3FFFFFFF) | (dest & 0x3FFFFF) | 0x40000000;
-
-      data[i + 0] = (Byte)(dest >> 24);
-      data[i + 1] = (Byte)(dest >> 16);
-      data[i + 2] = (Byte)(dest >> 8);
-      data[i + 3] = (Byte)dest;
-    }
-  }
-  return i;
-}
diff --git a/third_party/lzma/v4_65/files/C/Bra.h b/third_party/lzma/v4_65/files/C/Bra.h
deleted file mode 100644
index 45e231e..0000000
--- a/third_party/lzma/v4_65/files/C/Bra.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Bra.h -- Branch converters for executables
-2008-10-04 : Igor Pavlov : Public domain */
-
-#ifndef __BRA_H
-#define __BRA_H
-
-#include "Types.h"
-
-/*
-These functions convert relative addresses to absolute addresses
-in CALL instructions to increase the compression ratio.
-  
-  In:
-    data     - data buffer
-    size     - size of data
-    ip       - current virtual Instruction Pinter (IP) value
-    state    - state variable for x86 converter
-    encoding - 0 (for decoding), 1 (for encoding)
-  
-  Out:
-    state    - state variable for x86 converter
-
-  Returns:
-    The number of processed bytes. If you call these functions with multiple calls,
-    you must start next call with first byte after block of processed bytes.
-  
-  Type   Endian  Alignment  LookAhead
-  
-  x86    little      1          4
-  ARMT   little      2          2
-  ARM    little      4          0
-  PPC     big        4          0
-  SPARC   big        4          0
-  IA64   little     16          0
-
-  size must be >= Alignment + LookAhead, if it's not last block.
-  If (size < Alignment + LookAhead), converter returns 0.
-
-  Example:
-
-    UInt32 ip = 0;
-    for ()
-    {
-      ; size must be >= Alignment + LookAhead, if it's not last block
-      SizeT processed = Convert(data, size, ip, 1);
-      data += processed;
-      size -= processed;
-      ip += processed;
-    }
-*/
-
-#define x86_Convert_Init(state) { state = 0; }
-SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding);
-SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
-SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
-SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
-SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
-SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/C/Bra86.c b/third_party/lzma/v4_65/files/C/Bra86.c
deleted file mode 100644
index 1ee0e70..0000000
--- a/third_party/lzma/v4_65/files/C/Bra86.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Bra86.c -- Converter for x86 code (BCJ)
-2008-10-04 : Igor Pavlov : Public domain */
-
-#include "Bra.h"
-
-#define Test86MSByte(b) ((b) == 0 || (b) == 0xFF)
-
-const Byte kMaskToAllowedStatus[8] = {1, 1, 1, 0, 1, 0, 0, 0};
-const Byte kMaskToBitNumber[8] = {0, 1, 2, 2, 3, 3, 3, 3};
-
-SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding)
-{
-  SizeT bufferPos = 0, prevPosT;
-  UInt32 prevMask = *state & 0x7;
-  if (size < 5)
-    return 0;
-  ip += 5;
-  prevPosT = (SizeT)0 - 1;
-
-  for (;;)
-  {
-    Byte *p = data + bufferPos;
-    Byte *limit = data + size - 4;
-    for (; p < limit; p++)
-      if ((*p & 0xFE) == 0xE8)
-        break;
-    bufferPos = (SizeT)(p - data);
-    if (p >= limit)
-      break;
-    prevPosT = bufferPos - prevPosT;
-    if (prevPosT > 3)
-      prevMask = 0;
-    else
-    {
-      prevMask = (prevMask << ((int)prevPosT - 1)) & 0x7;
-      if (prevMask != 0)
-      {
-        Byte b = p[4 - kMaskToBitNumber[prevMask]];
-        if (!kMaskToAllowedStatus[prevMask] || Test86MSByte(b))
-        {
-          prevPosT = bufferPos;
-          prevMask = ((prevMask << 1) & 0x7) | 1;
-          bufferPos++;
-          continue;
-        }
-      }
-    }
-    prevPosT = bufferPos;
-
-    if (Test86MSByte(p[4]))
-    {
-      UInt32 src = ((UInt32)p[4] << 24) | ((UInt32)p[3] << 16) | ((UInt32)p[2] << 8) | ((UInt32)p[1]);
-      UInt32 dest;
-      for (;;)
-      {
-        Byte b;
-        int index;
-        if (encoding)
-          dest = (ip + (UInt32)bufferPos) + src;
-        else
-          dest = src - (ip + (UInt32)bufferPos);
-        if (prevMask == 0)
-          break;
-        index = kMaskToBitNumber[prevMask] * 8;
-        b = (Byte)(dest >> (24 - index));
-        if (!Test86MSByte(b))
-          break;
-        src = dest ^ ((1 << (32 - index)) - 1);
-      }
-      p[4] = (Byte)(~(((dest >> 24) & 1) - 1));
-      p[3] = (Byte)(dest >> 16);
-      p[2] = (Byte)(dest >> 8);
-      p[1] = (Byte)dest;
-      bufferPos += 5;
-    }
-    else
-    {
-      prevMask = ((prevMask << 1) & 0x7) | 1;
-      bufferPos++;
-    }
-  }
-  prevPosT = bufferPos - prevPosT;
-  *state = ((prevPosT > 3) ? 0 : ((prevMask << ((int)prevPosT - 1)) & 0x7));
-  return bufferPos;
-}
diff --git a/third_party/lzma/v4_65/files/C/BraIA64.c b/third_party/lzma/v4_65/files/C/BraIA64.c
deleted file mode 100644
index 0b4ee85..0000000
--- a/third_party/lzma/v4_65/files/C/BraIA64.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* BraIA64.c -- Converter for IA-64 code
-2008-10-04 : Igor Pavlov : Public domain */
-
-#include "Bra.h"
-
-static const Byte kBranchTable[32] =
-{
-  0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0,
-  4, 4, 6, 6, 0, 0, 7, 7,
-  4, 4, 0, 0, 4, 4, 0, 0
-};
-
-SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
-{
-  SizeT i;
-  if (size < 16)
-    return 0;
-  size -= 16;
-  for (i = 0; i <= size; i += 16)
-  {
-    UInt32 instrTemplate = data[i] & 0x1F;
-    UInt32 mask = kBranchTable[instrTemplate];
-    UInt32 bitPos = 5;
-    int slot;
-    for (slot = 0; slot < 3; slot++, bitPos += 41)
-    {
-      UInt32 bytePos, bitRes;
-      UInt64 instruction, instNorm;
-      int j;
-      if (((mask >> slot) & 1) == 0)
-        continue;
-      bytePos = (bitPos >> 3);
-      bitRes = bitPos & 0x7;
-      instruction = 0;
-      for (j = 0; j < 6; j++)
-        instruction += (UInt64)data[i + j + bytePos] << (8 * j);
-
-      instNorm = instruction >> bitRes;
-      if (((instNorm >> 37) & 0xF) == 0x5 && ((instNorm >> 9) & 0x7) == 0)
-      {
-        UInt32 src = (UInt32)((instNorm >> 13) & 0xFFFFF);
-        UInt32 dest;
-        src |= ((UInt32)(instNorm >> 36) & 1) << 20;
-        
-        src <<= 4;
-        
-        if (encoding)
-          dest = ip + (UInt32)i + src;
-        else
-          dest = src - (ip + (UInt32)i);
-        
-        dest >>= 4;
-        
-        instNorm &= ~((UInt64)(0x8FFFFF) << 13);
-        instNorm |= ((UInt64)(dest & 0xFFFFF) << 13);
-        instNorm |= ((UInt64)(dest & 0x100000) << (36 - 20));
-        
-        instruction &= (1 << bitRes) - 1;
-        instruction |= (instNorm << bitRes);
-        for (j = 0; j < 6; j++)
-          data[i + j + bytePos] = (Byte)(instruction >> (8 * j));
-      }
-    }
-  }
-  return i;
-}
diff --git a/third_party/lzma/v4_65/files/C/CpuArch.h b/third_party/lzma/v4_65/files/C/CpuArch.h
deleted file mode 100644
index 7384b0c..0000000
--- a/third_party/lzma/v4_65/files/C/CpuArch.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* CpuArch.h
-2008-08-05
-Igor Pavlov
-Public domain */
-
-#ifndef __CPUARCH_H
-#define __CPUARCH_H
-
-/*
-LITTLE_ENDIAN_UNALIGN means:
-  1) CPU is LITTLE_ENDIAN
-  2) it's allowed to make unaligned memory accesses
-if LITTLE_ENDIAN_UNALIGN is not defined, it means that we don't know
-about these properties of platform.
-*/
-
-#if defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64) || defined(__i386__) || defined(__x86_64__)
-#define LITTLE_ENDIAN_UNALIGN
-#endif
-
-#ifdef LITTLE_ENDIAN_UNALIGN
-
-#define GetUi16(p) (*(const UInt16 *)(p))
-#define GetUi32(p) (*(const UInt32 *)(p))
-#define GetUi64(p) (*(const UInt64 *)(p))
-#define SetUi32(p, d) *(UInt32 *)(p) = (d);
-
-#else
-
-#define GetUi16(p) (((const Byte *)(p))[0] | ((UInt16)((const Byte *)(p))[1] << 8))
-
-#define GetUi32(p) ( \
-             ((const Byte *)(p))[0]        | \
-    ((UInt32)((const Byte *)(p))[1] <<  8) | \
-    ((UInt32)((const Byte *)(p))[2] << 16) | \
-    ((UInt32)((const Byte *)(p))[3] << 24))
-
-#define GetUi64(p) (GetUi32(p) | ((UInt64)GetUi32(((const Byte *)(p)) + 4) << 32))
-
-#define SetUi32(p, d) { UInt32 _x_ = (d); \
-    ((Byte *)(p))[0] = (Byte)_x_; \
-    ((Byte *)(p))[1] = (Byte)(_x_ >> 8); \
-    ((Byte *)(p))[2] = (Byte)(_x_ >> 16); \
-    ((Byte *)(p))[3] = (Byte)(_x_ >> 24); }
-
-#endif
-
-#if defined(LITTLE_ENDIAN_UNALIGN) && defined(_WIN64) && (_MSC_VER >= 1300)
-
-#pragma intrinsic(_byteswap_ulong)
-#pragma intrinsic(_byteswap_uint64)
-#define GetBe32(p) _byteswap_ulong(*(const UInt32 *)(const Byte *)(p))
-#define GetBe64(p) _byteswap_uint64(*(const UInt64 *)(const Byte *)(p))
-
-#else
-
-#define GetBe32(p) ( \
-    ((UInt32)((const Byte *)(p))[0] << 24) | \
-    ((UInt32)((const Byte *)(p))[1] << 16) | \
-    ((UInt32)((const Byte *)(p))[2] <<  8) | \
-             ((const Byte *)(p))[3] )
-
-#define GetBe64(p) (((UInt64)GetBe32(p) << 32) | GetBe32(((const Byte *)(p)) + 4))
-
-#endif
-
-#define GetBe16(p) (((UInt16)((const Byte *)(p))[0] << 8) | ((const Byte *)(p))[1])
-
-#endif
diff --git a/third_party/lzma/v4_65/files/C/LzFind.c b/third_party/lzma/v4_65/files/C/LzFind.c
deleted file mode 100644
index 34f4f09..0000000
--- a/third_party/lzma/v4_65/files/C/LzFind.c
+++ /dev/null
@@ -1,751 +0,0 @@
-/* LzFind.c -- Match finder for LZ algorithms
-2008-10-04 : Igor Pavlov : Public domain */
-
-#include <string.h>
-
-#include "LzFind.h"
-#include "LzHash.h"
-
-#define kEmptyHashValue 0
-#define kMaxValForNormalize ((UInt32)0xFFFFFFFF)
-#define kNormalizeStepMin (1 << 10) /* it must be power of 2 */
-#define kNormalizeMask (~(kNormalizeStepMin - 1))
-#define kMaxHistorySize ((UInt32)3 << 30)
-
-#define kStartMaxLen 3
-
-static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc)
-{
-  if (!p->directInput)
-  {
-    alloc->Free(alloc, p->bufferBase);
-    p->bufferBase = 0;
-  }
-}
-
-/* keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) */
-
-static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc)
-{
-  UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv;
-  if (p->directInput)
-  {
-    p->blockSize = blockSize;
-    return 1;
-  }
-  if (p->bufferBase == 0 || p->blockSize != blockSize)
-  {
-    LzInWindow_Free(p, alloc);
-    p->blockSize = blockSize;
-    p->bufferBase = (Byte *)alloc->Alloc(alloc, (size_t)blockSize);
-  }
-  return (p->bufferBase != 0);
-}
-
-Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; }
-Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; }
-
-UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; }
-
-void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue)
-{
-  p->posLimit -= subValue;
-  p->pos -= subValue;
-  p->streamPos -= subValue;
-}
-
-static void MatchFinder_ReadBlock(CMatchFinder *p)
-{
-  if (p->streamEndWasReached || p->result != SZ_OK)
-    return;
-  for (;;)
-  {
-    Byte *dest = p->buffer + (p->streamPos - p->pos);
-    size_t size = (p->bufferBase + p->blockSize - dest);
-    if (size == 0)
-      return;
-    p->result = p->stream->Read(p->stream, dest, &size);
-    if (p->result != SZ_OK)
-      return;
-    if (size == 0)
-    {
-      p->streamEndWasReached = 1;
-      return;
-    }
-    p->streamPos += (UInt32)size;
-    if (p->streamPos - p->pos > p->keepSizeAfter)
-      return;
-  }
-}
-
-void MatchFinder_MoveBlock(CMatchFinder *p)
-{
-  memmove(p->bufferBase,
-    p->buffer - p->keepSizeBefore,
-    (size_t)(p->streamPos - p->pos + p->keepSizeBefore));
-  p->buffer = p->bufferBase + p->keepSizeBefore;
-}
-
-int MatchFinder_NeedMove(CMatchFinder *p)
-{
-  /* if (p->streamEndWasReached) return 0; */
-  return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter);
-}
-
-void MatchFinder_ReadIfRequired(CMatchFinder *p)
-{
-  if (p->streamEndWasReached)
-    return;
-  if (p->keepSizeAfter >= p->streamPos - p->pos)
-    MatchFinder_ReadBlock(p);
-}
-
-static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p)
-{
-  if (MatchFinder_NeedMove(p))
-    MatchFinder_MoveBlock(p);
-  MatchFinder_ReadBlock(p);
-}
-
-static void MatchFinder_SetDefaultSettings(CMatchFinder *p)
-{
-  p->cutValue = 32;
-  p->btMode = 1;
-  p->numHashBytes = 4;
-  /* p->skipModeBits = 0; */
-  p->directInput = 0;
-  p->bigHash = 0;
-}
-
-#define kCrcPoly 0xEDB88320
-
-void MatchFinder_Construct(CMatchFinder *p)
-{
-  UInt32 i;
-  p->bufferBase = 0;
-  p->directInput = 0;
-  p->hash = 0;
-  MatchFinder_SetDefaultSettings(p);
-
-  for (i = 0; i < 256; i++)
-  {
-    UInt32 r = i;
-    int j;
-    for (j = 0; j < 8; j++)
-      r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1));
-    p->crc[i] = r;
-  }
-}
-
-static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAlloc *alloc)
-{
-  alloc->Free(alloc, p->hash);
-  p->hash = 0;
-}
-
-void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc)
-{
-  MatchFinder_FreeThisClassMemory(p, alloc);
-  LzInWindow_Free(p, alloc);
-}
-
-static CLzRef* AllocRefs(UInt32 num, ISzAlloc *alloc)
-{
-  size_t sizeInBytes = (size_t)num * sizeof(CLzRef);
-  if (sizeInBytes / sizeof(CLzRef) != num)
-    return 0;
-  return (CLzRef *)alloc->Alloc(alloc, sizeInBytes);
-}
-
-int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
-    UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
-    ISzAlloc *alloc)
-{
-  UInt32 sizeReserv;
-  if (historySize > kMaxHistorySize)
-  {
-    MatchFinder_Free(p, alloc);
-    return 0;
-  }
-  sizeReserv = historySize >> 1;
-  if (historySize > ((UInt32)2 << 30))
-    sizeReserv = historySize >> 2;
-  sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19);
-
-  p->keepSizeBefore = historySize + keepAddBufferBefore + 1;
-  p->keepSizeAfter = matchMaxLen + keepAddBufferAfter;
-  /* we need one additional byte, since we use MoveBlock after pos++ and before dictionary using */
-  if (LzInWindow_Create(p, sizeReserv, alloc))
-  {
-    UInt32 newCyclicBufferSize = (historySize /* >> p->skipModeBits */) + 1;
-    UInt32 hs;
-    p->matchMaxLen = matchMaxLen;
-    {
-      p->fixedHashSize = 0;
-      if (p->numHashBytes == 2)
-        hs = (1 << 16) - 1;
-      else
-      {
-        hs = historySize - 1;
-        hs |= (hs >> 1);
-        hs |= (hs >> 2);
-        hs |= (hs >> 4);
-        hs |= (hs >> 8);
-        hs >>= 1;
-        /* hs >>= p->skipModeBits; */
-        hs |= 0xFFFF; /* don't change it! It's required for Deflate */
-        if (hs > (1 << 24))
-        {
-          if (p->numHashBytes == 3)
-            hs = (1 << 24) - 1;
-          else
-            hs >>= 1;
-        }
-      }
-      p->hashMask = hs;
-      hs++;
-      if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size;
-      if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size;
-      if (p->numHashBytes > 4) p->fixedHashSize += kHash4Size;
-      hs += p->fixedHashSize;
-    }
-
-    {
-      UInt32 prevSize = p->hashSizeSum + p->numSons;
-      UInt32 newSize;
-      p->historySize = historySize;
-      p->hashSizeSum = hs;
-      p->cyclicBufferSize = newCyclicBufferSize;
-      p->numSons = (p->btMode ? newCyclicBufferSize * 2 : newCyclicBufferSize);
-      newSize = p->hashSizeSum + p->numSons;
-      if (p->hash != 0 && prevSize == newSize)
-        return 1;
-      MatchFinder_FreeThisClassMemory(p, alloc);
-      p->hash = AllocRefs(newSize, alloc);
-      if (p->hash != 0)
-      {
-        p->son = p->hash + p->hashSizeSum;
-        return 1;
-      }
-    }
-  }
-  MatchFinder_Free(p, alloc);
-  return 0;
-}
-
-static void MatchFinder_SetLimits(CMatchFinder *p)
-{
-  UInt32 limit = kMaxValForNormalize - p->pos;
-  UInt32 limit2 = p->cyclicBufferSize - p->cyclicBufferPos;
-  if (limit2 < limit)
-    limit = limit2;
-  limit2 = p->streamPos - p->pos;
-  if (limit2 <= p->keepSizeAfter)
-  {
-    if (limit2 > 0)
-      limit2 = 1;
-  }
-  else
-    limit2 -= p->keepSizeAfter;
-  if (limit2 < limit)
-    limit = limit2;
-  {
-    UInt32 lenLimit = p->streamPos - p->pos;
-    if (lenLimit > p->matchMaxLen)
-      lenLimit = p->matchMaxLen;
-    p->lenLimit = lenLimit;
-  }
-  p->posLimit = p->pos + limit;
-}
-
-void MatchFinder_Init(CMatchFinder *p)
-{
-  UInt32 i;
-  for (i = 0; i < p->hashSizeSum; i++)
-    p->hash[i] = kEmptyHashValue;
-  p->cyclicBufferPos = 0;
-  p->buffer = p->bufferBase;
-  p->pos = p->streamPos = p->cyclicBufferSize;
-  p->result = SZ_OK;
-  p->streamEndWasReached = 0;
-  MatchFinder_ReadBlock(p);
-  MatchFinder_SetLimits(p);
-}
-
-static UInt32 MatchFinder_GetSubValue(CMatchFinder *p)
-{
-  return (p->pos - p->historySize - 1) & kNormalizeMask;
-}
-
-void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems)
-{
-  UInt32 i;
-  for (i = 0; i < numItems; i++)
-  {
-    UInt32 value = items[i];
-    if (value <= subValue)
-      value = kEmptyHashValue;
-    else
-      value -= subValue;
-    items[i] = value;
-  }
-}
-
-static void MatchFinder_Normalize(CMatchFinder *p)
-{
-  UInt32 subValue = MatchFinder_GetSubValue(p);
-  MatchFinder_Normalize3(subValue, p->hash, p->hashSizeSum + p->numSons);
-  MatchFinder_ReduceOffsets(p, subValue);
-}
-
-static void MatchFinder_CheckLimits(CMatchFinder *p)
-{
-  if (p->pos == kMaxValForNormalize)
-    MatchFinder_Normalize(p);
-  if (!p->streamEndWasReached && p->keepSizeAfter == p->streamPos - p->pos)
-    MatchFinder_CheckAndMoveAndRead(p);
-  if (p->cyclicBufferPos == p->cyclicBufferSize)
-    p->cyclicBufferPos = 0;
-  MatchFinder_SetLimits(p);
-}
-
-static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
-    UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
-    UInt32 *distances, UInt32 maxLen)
-{
-  son[_cyclicBufferPos] = curMatch;
-  for (;;)
-  {
-    UInt32 delta = pos - curMatch;
-    if (cutValue-- == 0 || delta >= _cyclicBufferSize)
-      return distances;
-    {
-      const Byte *pb = cur - delta;
-      curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)];
-      if (pb[maxLen] == cur[maxLen] && *pb == *cur)
-      {
-        UInt32 len = 0;
-        while (++len != lenLimit)
-          if (pb[len] != cur[len])
-            break;
-        if (maxLen < len)
-        {
-          *distances++ = maxLen = len;
-          *distances++ = delta - 1;
-          if (len == lenLimit)
-            return distances;
-        }
-      }
-    }
-  }
-}
-
-UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
-    UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
-    UInt32 *distances, UInt32 maxLen)
-{
-  CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
-  CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
-  UInt32 len0 = 0, len1 = 0;
-  for (;;)
-  {
-    UInt32 delta = pos - curMatch;
-    if (cutValue-- == 0 || delta >= _cyclicBufferSize)
-    {
-      *ptr0 = *ptr1 = kEmptyHashValue;
-      return distances;
-    }
-    {
-      CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
-      const Byte *pb = cur - delta;
-      UInt32 len = (len0 < len1 ? len0 : len1);
-      if (pb[len] == cur[len])
-      {
-        if (++len != lenLimit && pb[len] == cur[len])
-          while (++len != lenLimit)
-            if (pb[len] != cur[len])
-              break;
-        if (maxLen < len)
-        {
-          *distances++ = maxLen = len;
-          *distances++ = delta - 1;
-          if (len == lenLimit)
-          {
-            *ptr1 = pair[0];
-            *ptr0 = pair[1];
-            return distances;
-          }
-        }
-      }
-      if (pb[len] < cur[len])
-      {
-        *ptr1 = curMatch;
-        ptr1 = pair + 1;
-        curMatch = *ptr1;
-        len1 = len;
-      }
-      else
-      {
-        *ptr0 = curMatch;
-        ptr0 = pair;
-        curMatch = *ptr0;
-        len0 = len;
-      }
-    }
-  }
-}
-
-static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
-    UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue)
-{
-  CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
-  CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
-  UInt32 len0 = 0, len1 = 0;
-  for (;;)
-  {
-    UInt32 delta = pos - curMatch;
-    if (cutValue-- == 0 || delta >= _cyclicBufferSize)
-    {
-      *ptr0 = *ptr1 = kEmptyHashValue;
-      return;
-    }
-    {
-      CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
-      const Byte *pb = cur - delta;
-      UInt32 len = (len0 < len1 ? len0 : len1);
-      if (pb[len] == cur[len])
-      {
-        while (++len != lenLimit)
-          if (pb[len] != cur[len])
-            break;
-        {
-          if (len == lenLimit)
-          {
-            *ptr1 = pair[0];
-            *ptr0 = pair[1];
-            return;
-          }
-        }
-      }
-      if (pb[len] < cur[len])
-      {
-        *ptr1 = curMatch;
-        ptr1 = pair + 1;
-        curMatch = *ptr1;
-        len1 = len;
-      }
-      else
-      {
-        *ptr0 = curMatch;
-        ptr0 = pair;
-        curMatch = *ptr0;
-        len0 = len;
-      }
-    }
-  }
-}
-
-#define MOVE_POS \
-  ++p->cyclicBufferPos; \
-  p->buffer++; \
-  if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p);
-
-#define MOVE_POS_RET MOVE_POS return offset;
-
-static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; }
-
-#define GET_MATCHES_HEADER2(minLen, ret_op) \
-  UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \
-  lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \
-  cur = p->buffer;
-
-#define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return 0)
-#define SKIP_HEADER(minLen)        GET_MATCHES_HEADER2(minLen, continue)
-
-#define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue
-
-#define GET_MATCHES_FOOTER(offset, maxLen) \
-  offset = (UInt32)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMS(p), \
-  distances + offset, maxLen) - distances); MOVE_POS_RET;
-
-#define SKIP_FOOTER \
-  SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS;
-
-static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
-{
-  UInt32 offset;
-  GET_MATCHES_HEADER(2)
-  HASH2_CALC;
-  curMatch = p->hash[hashValue];
-  p->hash[hashValue] = p->pos;
-  offset = 0;
-  GET_MATCHES_FOOTER(offset, 1)
-}
-
-UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
-{
-  UInt32 offset;
-  GET_MATCHES_HEADER(3)
-  HASH_ZIP_CALC;
-  curMatch = p->hash[hashValue];
-  p->hash[hashValue] = p->pos;
-  offset = 0;
-  GET_MATCHES_FOOTER(offset, 2)
-}
-
-static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
-{
-  UInt32 hash2Value, delta2, maxLen, offset;
-  GET_MATCHES_HEADER(3)
-
-  HASH3_CALC;
-
-  delta2 = p->pos - p->hash[hash2Value];
-  curMatch = p->hash[kFix3HashSize + hashValue];
-  
-  p->hash[hash2Value] =
-  p->hash[kFix3HashSize + hashValue] = p->pos;
-
-
-  maxLen = 2;
-  offset = 0;
-  if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
-  {
-    for (; maxLen != lenLimit; maxLen++)
-      if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
-        break;
-    distances[0] = maxLen;
-    distances[1] = delta2 - 1;
-    offset = 2;
-    if (maxLen == lenLimit)
-    {
-      SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
-      MOVE_POS_RET;
-    }
-  }
-  GET_MATCHES_FOOTER(offset, maxLen)
-}
-
-static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
-{
-  UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset;
-  GET_MATCHES_HEADER(4)
-
-  HASH4_CALC;
-
-  delta2 = p->pos - p->hash[                hash2Value];
-  delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
-  curMatch = p->hash[kFix4HashSize + hashValue];
-  
-  p->hash[                hash2Value] =
-  p->hash[kFix3HashSize + hash3Value] =
-  p->hash[kFix4HashSize + hashValue] = p->pos;
-
-  maxLen = 1;
-  offset = 0;
-  if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
-  {
-    distances[0] = maxLen = 2;
-    distances[1] = delta2 - 1;
-    offset = 2;
-  }
-  if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur)
-  {
-    maxLen = 3;
-    distances[offset + 1] = delta3 - 1;
-    offset += 2;
-    delta2 = delta3;
-  }
-  if (offset != 0)
-  {
-    for (; maxLen != lenLimit; maxLen++)
-      if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
-        break;
-    distances[offset - 2] = maxLen;
-    if (maxLen == lenLimit)
-    {
-      SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
-      MOVE_POS_RET;
-    }
-  }
-  if (maxLen < 3)
-    maxLen = 3;
-  GET_MATCHES_FOOTER(offset, maxLen)
-}
-
-static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
-{
-  UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset;
-  GET_MATCHES_HEADER(4)
-
-  HASH4_CALC;
-
-  delta2 = p->pos - p->hash[                hash2Value];
-  delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
-  curMatch = p->hash[kFix4HashSize + hashValue];
-
-  p->hash[                hash2Value] =
-  p->hash[kFix3HashSize + hash3Value] =
-  p->hash[kFix4HashSize + hashValue] = p->pos;
-
-  maxLen = 1;
-  offset = 0;
-  if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
-  {
-    distances[0] = maxLen = 2;
-    distances[1] = delta2 - 1;
-    offset = 2;
-  }
-  if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur)
-  {
-    maxLen = 3;
-    distances[offset + 1] = delta3 - 1;
-    offset += 2;
-    delta2 = delta3;
-  }
-  if (offset != 0)
-  {
-    for (; maxLen != lenLimit; maxLen++)
-      if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
-        break;
-    distances[offset - 2] = maxLen;
-    if (maxLen == lenLimit)
-    {
-      p->son[p->cyclicBufferPos] = curMatch;
-      MOVE_POS_RET;
-    }
-  }
-  if (maxLen < 3)
-    maxLen = 3;
-  offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
-    distances + offset, maxLen) - (distances));
-  MOVE_POS_RET
-}
-
-UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
-{
-  UInt32 offset;
-  GET_MATCHES_HEADER(3)
-  HASH_ZIP_CALC;
-  curMatch = p->hash[hashValue];
-  p->hash[hashValue] = p->pos;
-  offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
-    distances, 2) - (distances));
-  MOVE_POS_RET
-}
-
-static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
-{
-  do
-  {
-    SKIP_HEADER(2)
-    HASH2_CALC;
-    curMatch = p->hash[hashValue];
-    p->hash[hashValue] = p->pos;
-    SKIP_FOOTER
-  }
-  while (--num != 0);
-}
-
-void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
-{
-  do
-  {
-    SKIP_HEADER(3)
-    HASH_ZIP_CALC;
-    curMatch = p->hash[hashValue];
-    p->hash[hashValue] = p->pos;
-    SKIP_FOOTER
-  }
-  while (--num != 0);
-}
-
-static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
-{
-  do
-  {
-    UInt32 hash2Value;
-    SKIP_HEADER(3)
-    HASH3_CALC;
-    curMatch = p->hash[kFix3HashSize + hashValue];
-    p->hash[hash2Value] =
-    p->hash[kFix3HashSize + hashValue] = p->pos;
-    SKIP_FOOTER
-  }
-  while (--num != 0);
-}
-
-static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
-{
-  do
-  {
-    UInt32 hash2Value, hash3Value;
-    SKIP_HEADER(4)
-    HASH4_CALC;
-    curMatch = p->hash[kFix4HashSize + hashValue];
-    p->hash[                hash2Value] =
-    p->hash[kFix3HashSize + hash3Value] = p->pos;
-    p->hash[kFix4HashSize + hashValue] = p->pos;
-    SKIP_FOOTER
-  }
-  while (--num != 0);
-}
-
-static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
-{
-  do
-  {
-    UInt32 hash2Value, hash3Value;
-    SKIP_HEADER(4)
-    HASH4_CALC;
-    curMatch = p->hash[kFix4HashSize + hashValue];
-    p->hash[                hash2Value] =
-    p->hash[kFix3HashSize + hash3Value] =
-    p->hash[kFix4HashSize + hashValue] = p->pos;
-    p->son[p->cyclicBufferPos] = curMatch;
-    MOVE_POS
-  }
-  while (--num != 0);
-}
-
-void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
-{
-  do
-  {
-    SKIP_HEADER(3)
-    HASH_ZIP_CALC;
-    curMatch = p->hash[hashValue];
-    p->hash[hashValue] = p->pos;
-    p->son[p->cyclicBufferPos] = curMatch;
-    MOVE_POS
-  }
-  while (--num != 0);
-}
-
-void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable)
-{
-  vTable->Init = (Mf_Init_Func)MatchFinder_Init;
-  vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte;
-  vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes;
-  vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos;
-  if (!p->btMode)
-  {
-    vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches;
-    vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip;
-  }
-  else if (p->numHashBytes == 2)
-  {
-    vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches;
-    vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip;
-  }
-  else if (p->numHashBytes == 3)
-  {
-    vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches;
-    vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip;
-  }
-  else
-  {
-    vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches;
-    vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip;
-  }
-}
diff --git a/third_party/lzma/v4_65/files/C/LzFind.h b/third_party/lzma/v4_65/files/C/LzFind.h
deleted file mode 100644
index 5b9cebf..0000000
--- a/third_party/lzma/v4_65/files/C/LzFind.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* LzFind.h -- Match finder for LZ algorithms
-2008-10-04 : Igor Pavlov : Public domain */
-
-#ifndef __LZFIND_H
-#define __LZFIND_H
-
-#include "Types.h"
-
-typedef UInt32 CLzRef;
-
-typedef struct _CMatchFinder
-{
-  Byte *buffer;
-  UInt32 pos;
-  UInt32 posLimit;
-  UInt32 streamPos;
-  UInt32 lenLimit;
-
-  UInt32 cyclicBufferPos;
-  UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */
-
-  UInt32 matchMaxLen;
-  CLzRef *hash;
-  CLzRef *son;
-  UInt32 hashMask;
-  UInt32 cutValue;
-
-  Byte *bufferBase;
-  ISeqInStream *stream;
-  int streamEndWasReached;
-
-  UInt32 blockSize;
-  UInt32 keepSizeBefore;
-  UInt32 keepSizeAfter;
-
-  UInt32 numHashBytes;
-  int directInput;
-  int btMode;
-  /* int skipModeBits; */
-  int bigHash;
-  UInt32 historySize;
-  UInt32 fixedHashSize;
-  UInt32 hashSizeSum;
-  UInt32 numSons;
-  SRes result;
-  UInt32 crc[256];
-} CMatchFinder;
-
-#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer)
-#define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)])
-
-#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
-
-int MatchFinder_NeedMove(CMatchFinder *p);
-Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
-void MatchFinder_MoveBlock(CMatchFinder *p);
-void MatchFinder_ReadIfRequired(CMatchFinder *p);
-
-void MatchFinder_Construct(CMatchFinder *p);
-
-/* Conditions:
-     historySize <= 3 GB
-     keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB
-*/
-int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
-    UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
-    ISzAlloc *alloc);
-void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc);
-void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems);
-void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
-
-UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,
-    UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
-    UInt32 *distances, UInt32 maxLen);
-
-/*
-Conditions:
-  Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func.
-  Mf_GetPointerToCurrentPos_Func's result must be used only before any other function
-*/
-
-typedef void (*Mf_Init_Func)(void *object);
-typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index);
-typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object);
-typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object);
-typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
-typedef void (*Mf_Skip_Func)(void *object, UInt32);
-
-typedef struct _IMatchFinder
-{
-  Mf_Init_Func Init;
-  Mf_GetIndexByte_Func GetIndexByte;
-  Mf_GetNumAvailableBytes_Func GetNumAvailableBytes;
-  Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos;
-  Mf_GetMatches_Func GetMatches;
-  Mf_Skip_Func Skip;
-} IMatchFinder;
-
-void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
-
-void MatchFinder_Init(CMatchFinder *p);
-UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
-UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
-void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
-void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/C/LzFindMt.c b/third_party/lzma/v4_65/files/C/LzFindMt.c
deleted file mode 100644
index b49cd76..0000000
--- a/third_party/lzma/v4_65/files/C/LzFindMt.c
+++ /dev/null
@@ -1,793 +0,0 @@
-/* LzFindMt.c -- multithreaded Match finder for LZ algorithms
-2008-10-04 : Igor Pavlov : Public domain */
-
-#include "LzHash.h"
-
-#include "LzFindMt.h"
-
-void MtSync_Construct(CMtSync *p)
-{
-  p->wasCreated = False;
-  p->csWasInitialized = False;
-  p->csWasEntered = False;
-  Thread_Construct(&p->thread);
-  Event_Construct(&p->canStart);
-  Event_Construct(&p->wasStarted);
-  Event_Construct(&p->wasStopped);
-  Semaphore_Construct(&p->freeSemaphore);
-  Semaphore_Construct(&p->filledSemaphore);
-}
-
-void MtSync_GetNextBlock(CMtSync *p)
-{
-  if (p->needStart)
-  {
-    p->numProcessedBlocks = 1;
-    p->needStart = False;
-    p->stopWriting = False;
-    p->exit = False;
-    Event_Reset(&p->wasStarted);
-    Event_Reset(&p->wasStopped);
-
-    Event_Set(&p->canStart);
-    Event_Wait(&p->wasStarted);
-  }
-  else
-  {
-    CriticalSection_Leave(&p->cs);
-    p->csWasEntered = False;
-    p->numProcessedBlocks++;
-    Semaphore_Release1(&p->freeSemaphore);
-  }
-  Semaphore_Wait(&p->filledSemaphore);
-  CriticalSection_Enter(&p->cs);
-  p->csWasEntered = True;
-}
-
-/* MtSync_StopWriting must be called if Writing was started */
-
-void MtSync_StopWriting(CMtSync *p)
-{
-  UInt32 myNumBlocks = p->numProcessedBlocks;
-  if (!Thread_WasCreated(&p->thread) || p->needStart)
-    return;
-  p->stopWriting = True;
-  if (p->csWasEntered)
-  {
-    CriticalSection_Leave(&p->cs);
-    p->csWasEntered = False;
-  }
-  Semaphore_Release1(&p->freeSemaphore);
- 
-  Event_Wait(&p->wasStopped);
-
-  while (myNumBlocks++ != p->numProcessedBlocks)
-  {
-    Semaphore_Wait(&p->filledSemaphore);
-    Semaphore_Release1(&p->freeSemaphore);
-  }
-  p->needStart = True;
-}
-
-void MtSync_Destruct(CMtSync *p)
-{
-  if (Thread_WasCreated(&p->thread))
-  {
-    MtSync_StopWriting(p);
-    p->exit = True;
-    if (p->needStart)
-      Event_Set(&p->canStart);
-    Thread_Wait(&p->thread);
-    Thread_Close(&p->thread);
-  }
-  if (p->csWasInitialized)
-  {
-    CriticalSection_Delete(&p->cs);
-    p->csWasInitialized = False;
-  }
-
-  Event_Close(&p->canStart);
-  Event_Close(&p->wasStarted);
-  Event_Close(&p->wasStopped);
-  Semaphore_Close(&p->freeSemaphore);
-  Semaphore_Close(&p->filledSemaphore);
-
-  p->wasCreated = False;
-}
-
-#define RINOK_THREAD(x) { if ((x) != 0) return SZ_ERROR_THREAD; }
-
-static SRes MtSync_Create2(CMtSync *p, unsigned (MY_STD_CALL *startAddress)(void *), void *obj, UInt32 numBlocks)
-{
-  if (p->wasCreated)
-    return SZ_OK;
-
-  RINOK_THREAD(CriticalSection_Init(&p->cs));
-  p->csWasInitialized = True;
-
-  RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->canStart));
-  RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->wasStarted));
-  RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->wasStopped));
-  
-  RINOK_THREAD(Semaphore_Create(&p->freeSemaphore, numBlocks, numBlocks));
-  RINOK_THREAD(Semaphore_Create(&p->filledSemaphore, 0, numBlocks));
-
-  p->needStart = True;
-  
-  RINOK_THREAD(Thread_Create(&p->thread, startAddress, obj));
-  p->wasCreated = True;
-  return SZ_OK;
-}
-
-static SRes MtSync_Create(CMtSync *p, unsigned (MY_STD_CALL *startAddress)(void *), void *obj, UInt32 numBlocks)
-{
-  SRes res = MtSync_Create2(p, startAddress, obj, numBlocks);
-  if (res != SZ_OK)
-    MtSync_Destruct(p);
-  return res;
-}
-
-void MtSync_Init(CMtSync *p) { p->needStart = True; }
-
-#define kMtMaxValForNormalize 0xFFFFFFFF
-
-#define DEF_GetHeads2(name, v, action) \
-static void GetHeads ## name(const Byte *p, UInt32 pos, \
-UInt32 *hash, UInt32 hashMask, UInt32 *heads, UInt32 numHeads, const UInt32 *crc) \
-{ action; for (; numHeads != 0; numHeads--) { \
-const UInt32 value = (v); p++; *heads++ = pos - hash[value]; hash[value] = pos++;  } }
-
-#define DEF_GetHeads(name, v) DEF_GetHeads2(name, v, ;)
-
-DEF_GetHeads2(2,  (p[0] | ((UInt32)p[1] << 8)), hashMask = hashMask; crc = crc; )
-DEF_GetHeads(3,  (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8)) & hashMask)
-DEF_GetHeads(4,  (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8) ^ (crc[p[3]] << 5)) & hashMask)
-DEF_GetHeads(4b, (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8) ^ ((UInt32)p[3] << 16)) & hashMask)
-DEF_GetHeads(5,  (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8) ^ (crc[p[3]] << 5) ^ (crc[p[4]] << 3)) & hashMask)
-
-void HashThreadFunc(CMatchFinderMt *mt)
-{
-  CMtSync *p = &mt->hashSync;
-  for (;;)
-  {
-    UInt32 numProcessedBlocks = 0;
-    Event_Wait(&p->canStart);
-    Event_Set(&p->wasStarted);
-    for (;;)
-    {
-      if (p->exit)
-        return;
-      if (p->stopWriting)
-      {
-        p->numProcessedBlocks = numProcessedBlocks;
-        Event_Set(&p->wasStopped);
-        break;
-      }
-
-      {
-        CMatchFinder *mf = mt->MatchFinder;
-        if (MatchFinder_NeedMove(mf))
-        {
-          CriticalSection_Enter(&mt->btSync.cs);
-          CriticalSection_Enter(&mt->hashSync.cs);
-          {
-            const Byte *beforePtr = MatchFinder_GetPointerToCurrentPos(mf);
-            const Byte *afterPtr;
-            MatchFinder_MoveBlock(mf);
-            afterPtr = MatchFinder_GetPointerToCurrentPos(mf);
-            mt->pointerToCurPos -= beforePtr - afterPtr;
-            mt->buffer -= beforePtr - afterPtr;
-          }
-          CriticalSection_Leave(&mt->btSync.cs);
-          CriticalSection_Leave(&mt->hashSync.cs);
-          continue;
-        }
-
-        Semaphore_Wait(&p->freeSemaphore);
-
-        MatchFinder_ReadIfRequired(mf);
-        if (mf->pos > (kMtMaxValForNormalize - kMtHashBlockSize))
-        {
-          UInt32 subValue = (mf->pos - mf->historySize - 1);
-          MatchFinder_ReduceOffsets(mf, subValue);
-          MatchFinder_Normalize3(subValue, mf->hash + mf->fixedHashSize, mf->hashMask + 1);
-        }
-        {
-          UInt32 *heads = mt->hashBuf + ((numProcessedBlocks++) & kMtHashNumBlocksMask) * kMtHashBlockSize;
-          UInt32 num = mf->streamPos - mf->pos;
-          heads[0] = 2;
-          heads[1] = num;
-          if (num >= mf->numHashBytes)
-          {
-            num = num - mf->numHashBytes + 1;
-            if (num > kMtHashBlockSize - 2)
-              num = kMtHashBlockSize - 2;
-            mt->GetHeadsFunc(mf->buffer, mf->pos, mf->hash + mf->fixedHashSize, mf->hashMask, heads + 2, num, mf->crc);
-            heads[0] += num;
-          }
-          mf->pos += num;
-          mf->buffer += num;
-        }
-      }
-
-      Semaphore_Release1(&p->filledSemaphore);
-    }
-  }
-}
-
-void MatchFinderMt_GetNextBlock_Hash(CMatchFinderMt *p)
-{
-  MtSync_GetNextBlock(&p->hashSync);
-  p->hashBufPosLimit = p->hashBufPos = ((p->hashSync.numProcessedBlocks - 1) & kMtHashNumBlocksMask) * kMtHashBlockSize;
-  p->hashBufPosLimit += p->hashBuf[p->hashBufPos++];
-  p->hashNumAvail = p->hashBuf[p->hashBufPos++];
-}
-
-#define kEmptyHashValue 0
-
-/* #define MFMT_GM_INLINE */
-
-#ifdef MFMT_GM_INLINE
-
-#define NO_INLINE MY_FAST_CALL
-
-Int32 NO_INLINE GetMatchesSpecN(UInt32 lenLimit, UInt32 pos, const Byte *cur, CLzRef *son,
-    UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
-    UInt32 *_distances, UInt32 _maxLen, const UInt32 *hash, Int32 limit, UInt32 size, UInt32 *posRes)
-{
-  do
-  {
-  UInt32 *distances = _distances + 1;
-  UInt32 curMatch = pos - *hash++;
-
-  CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
-  CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
-  UInt32 len0 = 0, len1 = 0;
-  UInt32 cutValue = _cutValue;
-  UInt32 maxLen = _maxLen;
-  for (;;)
-  {
-    UInt32 delta = pos - curMatch;
-    if (cutValue-- == 0 || delta >= _cyclicBufferSize)
-    {
-      *ptr0 = *ptr1 = kEmptyHashValue;
-      break;
-    }
-    {
-      CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
-      const Byte *pb = cur - delta;
-      UInt32 len = (len0 < len1 ? len0 : len1);
-      if (pb[len] == cur[len])
-      {
-        if (++len != lenLimit && pb[len] == cur[len])
-          while (++len != lenLimit)
-            if (pb[len] != cur[len])
-              break;
-        if (maxLen < len)
-        {
-          *distances++ = maxLen = len;
-          *distances++ = delta - 1;
-          if (len == lenLimit)
-          {
-            *ptr1 = pair[0];
-            *ptr0 = pair[1];
-            break;
-          }
-        }
-      }
-      if (pb[len] < cur[len])
-      {
-        *ptr1 = curMatch;
-        ptr1 = pair + 1;
-        curMatch = *ptr1;
-        len1 = len;
-      }
-      else
-      {
-        *ptr0 = curMatch;
-        ptr0 = pair;
-        curMatch = *ptr0;
-        len0 = len;
-      }
-    }
-  }
-  pos++;
-  _cyclicBufferPos++;
-  cur++;
-  {
-    UInt32 num = (UInt32)(distances - _distances);
-    *_distances = num - 1;
-    _distances += num;
-    limit -= num;
-  }
-  }
-  while (limit > 0 && --size != 0);
-  *posRes = pos;
-  return limit;
-}
-
-#endif
-
-void BtGetMatches(CMatchFinderMt *p, UInt32 *distances)
-{
-  UInt32 numProcessed = 0;
-  UInt32 curPos = 2;
-  UInt32 limit = kMtBtBlockSize - (p->matchMaxLen * 2);
-  distances[1] = p->hashNumAvail;
-  while (curPos < limit)
-  {
-    if (p->hashBufPos == p->hashBufPosLimit)
-    {
-      MatchFinderMt_GetNextBlock_Hash(p);
-      distances[1] = numProcessed + p->hashNumAvail;
-      if (p->hashNumAvail >= p->numHashBytes)
-        continue;
-      for (; p->hashNumAvail != 0; p->hashNumAvail--)
-        distances[curPos++] = 0;
-      break;
-    }
-    {
-      UInt32 size = p->hashBufPosLimit - p->hashBufPos;
-      UInt32 lenLimit = p->matchMaxLen;
-      UInt32 pos = p->pos;
-      UInt32 cyclicBufferPos = p->cyclicBufferPos;
-      if (lenLimit >= p->hashNumAvail)
-        lenLimit = p->hashNumAvail;
-      {
-        UInt32 size2 = p->hashNumAvail - lenLimit + 1;
-        if (size2 < size)
-          size = size2;
-        size2 = p->cyclicBufferSize - cyclicBufferPos;
-        if (size2 < size)
-          size = size2;
-      }
-      #ifndef MFMT_GM_INLINE
-      while (curPos < limit && size-- != 0)
-      {
-        UInt32 *startDistances = distances + curPos;
-        UInt32 num = (UInt32)(GetMatchesSpec1(lenLimit, pos - p->hashBuf[p->hashBufPos++],
-          pos, p->buffer, p->son, cyclicBufferPos, p->cyclicBufferSize, p->cutValue,
-          startDistances + 1, p->numHashBytes - 1) - startDistances);
-        *startDistances = num - 1;
-        curPos += num;
-        cyclicBufferPos++;
-        pos++;
-        p->buffer++;
-      }
-      #else
-      {
-        UInt32 posRes;
-        curPos = limit - GetMatchesSpecN(lenLimit, pos, p->buffer, p->son, cyclicBufferPos, p->cyclicBufferSize, p->cutValue,
-          distances + curPos, p->numHashBytes - 1, p->hashBuf + p->hashBufPos, (Int32)(limit - curPos) , size, &posRes);
-        p->hashBufPos += posRes - pos;
-        cyclicBufferPos += posRes - pos;
-        p->buffer += posRes - pos;
-        pos = posRes;
-      }
-      #endif
-
-      numProcessed += pos - p->pos;
-      p->hashNumAvail -= pos - p->pos;
-      p->pos = pos;
-      if (cyclicBufferPos == p->cyclicBufferSize)
-        cyclicBufferPos = 0;
-      p->cyclicBufferPos = cyclicBufferPos;
-    }
-  }
-  distances[0] = curPos;
-}
-
-void BtFillBlock(CMatchFinderMt *p, UInt32 globalBlockIndex)
-{
-  CMtSync *sync = &p->hashSync;
-  if (!sync->needStart)
-  {
-    CriticalSection_Enter(&sync->cs);
-    sync->csWasEntered = True;
-  }
-  
-  BtGetMatches(p, p->btBuf + (globalBlockIndex & kMtBtNumBlocksMask) * kMtBtBlockSize);
-
-  if (p->pos > kMtMaxValForNormalize - kMtBtBlockSize)
-  {
-    UInt32 subValue = p->pos - p->cyclicBufferSize;
-    MatchFinder_Normalize3(subValue, p->son, p->cyclicBufferSize * 2);
-    p->pos -= subValue;
-  }
-
-  if (!sync->needStart)
-  {
-    CriticalSection_Leave(&sync->cs);
-    sync->csWasEntered = False;
-  }
-}
-
-void BtThreadFunc(CMatchFinderMt *mt)
-{
-  CMtSync *p = &mt->btSync;
-  for (;;)
-  {
-    UInt32 blockIndex = 0;
-    Event_Wait(&p->canStart);
-    Event_Set(&p->wasStarted);
-    for (;;)
-    {
-      if (p->exit)
-        return;
-      if (p->stopWriting)
-      {
-        p->numProcessedBlocks = blockIndex;
-        MtSync_StopWriting(&mt->hashSync);
-        Event_Set(&p->wasStopped);
-        break;
-      }
-      Semaphore_Wait(&p->freeSemaphore);
-      BtFillBlock(mt, blockIndex++);
-      Semaphore_Release1(&p->filledSemaphore);
-    }
-  }
-}
-
-void MatchFinderMt_Construct(CMatchFinderMt *p)
-{
-  p->hashBuf = 0;
-  MtSync_Construct(&p->hashSync);
-  MtSync_Construct(&p->btSync);
-}
-
-void MatchFinderMt_FreeMem(CMatchFinderMt *p, ISzAlloc *alloc)
-{
-  alloc->Free(alloc, p->hashBuf);
-  p->hashBuf = 0;
-}
-
-void MatchFinderMt_Destruct(CMatchFinderMt *p, ISzAlloc *alloc)
-{
-  MtSync_Destruct(&p->hashSync);
-  MtSync_Destruct(&p->btSync);
-  MatchFinderMt_FreeMem(p, alloc);
-}
-
-#define kHashBufferSize (kMtHashBlockSize * kMtHashNumBlocks)
-#define kBtBufferSize (kMtBtBlockSize * kMtBtNumBlocks)
-
-static unsigned MY_STD_CALL HashThreadFunc2(void *p) { HashThreadFunc((CMatchFinderMt *)p);  return 0; }
-static unsigned MY_STD_CALL BtThreadFunc2(void *p)
-{
-  Byte allocaDummy[0x180];
-  int i = 0;
-  for (i = 0; i < 16; i++)
-    allocaDummy[i] = (Byte)i;
-  BtThreadFunc((CMatchFinderMt *)p);
-  return 0;
-}
-
-SRes MatchFinderMt_Create(CMatchFinderMt *p, UInt32 historySize, UInt32 keepAddBufferBefore,
-    UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ISzAlloc *alloc)
-{
-  CMatchFinder *mf = p->MatchFinder;
-  p->historySize = historySize;
-  if (kMtBtBlockSize <= matchMaxLen * 4)
-    return SZ_ERROR_PARAM;
-  if (p->hashBuf == 0)
-  {
-    p->hashBuf = (UInt32 *)alloc->Alloc(alloc, (kHashBufferSize + kBtBufferSize) * sizeof(UInt32));
-    if (p->hashBuf == 0)
-      return SZ_ERROR_MEM;
-    p->btBuf = p->hashBuf + kHashBufferSize;
-  }
-  keepAddBufferBefore += (kHashBufferSize + kBtBufferSize);
-  keepAddBufferAfter += kMtHashBlockSize;
-  if (!MatchFinder_Create(mf, historySize, keepAddBufferBefore, matchMaxLen, keepAddBufferAfter, alloc))
-    return SZ_ERROR_MEM;
-
-  RINOK(MtSync_Create(&p->hashSync, HashThreadFunc2, p, kMtHashNumBlocks));
-  RINOK(MtSync_Create(&p->btSync, BtThreadFunc2, p, kMtBtNumBlocks));
-  return SZ_OK;
-}
-
-/* Call it after ReleaseStream / SetStream */
-void MatchFinderMt_Init(CMatchFinderMt *p)
-{
-  CMatchFinder *mf = p->MatchFinder;
-  p->btBufPos = p->btBufPosLimit = 0;
-  p->hashBufPos = p->hashBufPosLimit = 0;
-  MatchFinder_Init(mf);
-  p->pointerToCurPos = MatchFinder_GetPointerToCurrentPos(mf);
-  p->btNumAvailBytes = 0;
-  p->lzPos = p->historySize + 1;
-
-  p->hash = mf->hash;
-  p->fixedHashSize = mf->fixedHashSize;
-  p->crc = mf->crc;
-
-  p->son = mf->son;
-  p->matchMaxLen = mf->matchMaxLen;
-  p->numHashBytes = mf->numHashBytes;
-  p->pos = mf->pos;
-  p->buffer = mf->buffer;
-  p->cyclicBufferPos = mf->cyclicBufferPos;
-  p->cyclicBufferSize = mf->cyclicBufferSize;
-  p->cutValue = mf->cutValue;
-}
-
-/* ReleaseStream is required to finish multithreading */
-void MatchFinderMt_ReleaseStream(CMatchFinderMt *p)
-{
-  MtSync_StopWriting(&p->btSync);
-  /* p->MatchFinder->ReleaseStream(); */
-}
-
-void MatchFinderMt_Normalize(CMatchFinderMt *p)
-{
-  MatchFinder_Normalize3(p->lzPos - p->historySize - 1, p->hash, p->fixedHashSize);
-  p->lzPos = p->historySize + 1;
-}
-
-void MatchFinderMt_GetNextBlock_Bt(CMatchFinderMt *p)
-{
-  UInt32 blockIndex;
-  MtSync_GetNextBlock(&p->btSync);
-  blockIndex = ((p->btSync.numProcessedBlocks - 1) & kMtBtNumBlocksMask);
-  p->btBufPosLimit = p->btBufPos = blockIndex * kMtBtBlockSize;
-  p->btBufPosLimit += p->btBuf[p->btBufPos++];
-  p->btNumAvailBytes = p->btBuf[p->btBufPos++];
-  if (p->lzPos >= kMtMaxValForNormalize - kMtBtBlockSize)
-    MatchFinderMt_Normalize(p);
-}
-
-const Byte * MatchFinderMt_GetPointerToCurrentPos(CMatchFinderMt *p)
-{
-  return p->pointerToCurPos;
-}
-
-#define GET_NEXT_BLOCK_IF_REQUIRED if (p->btBufPos == p->btBufPosLimit) MatchFinderMt_GetNextBlock_Bt(p);
-
-UInt32 MatchFinderMt_GetNumAvailableBytes(CMatchFinderMt *p)
-{
-  GET_NEXT_BLOCK_IF_REQUIRED;
-  return p->btNumAvailBytes;
-}
-
-Byte MatchFinderMt_GetIndexByte(CMatchFinderMt *p, Int32 index)
-{
-  return p->pointerToCurPos[index];
-}
-
-UInt32 * MixMatches2(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
-{
-  UInt32 hash2Value, curMatch2;
-  UInt32 *hash = p->hash;
-  const Byte *cur = p->pointerToCurPos;
-  UInt32 lzPos = p->lzPos;
-  MT_HASH2_CALC
-      
-  curMatch2 = hash[hash2Value];
-  hash[hash2Value] = lzPos;
-
-  if (curMatch2 >= matchMinPos)
-    if (cur[(ptrdiff_t)curMatch2 - lzPos] == cur[0])
-    {
-      *distances++ = 2;
-      *distances++ = lzPos - curMatch2 - 1;
-    }
-  return distances;
-}
-
-UInt32 * MixMatches3(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
-{
-  UInt32 hash2Value, hash3Value, curMatch2, curMatch3;
-  UInt32 *hash = p->hash;
-  const Byte *cur = p->pointerToCurPos;
-  UInt32 lzPos = p->lzPos;
-  MT_HASH3_CALC
-
-  curMatch2 = hash[                hash2Value];
-  curMatch3 = hash[kFix3HashSize + hash3Value];
-  
-  hash[                hash2Value] =
-  hash[kFix3HashSize + hash3Value] =
-    lzPos;
-
-  if (curMatch2 >= matchMinPos && cur[(ptrdiff_t)curMatch2 - lzPos] == cur[0])
-  {
-    distances[1] = lzPos - curMatch2 - 1;
-    if (cur[(ptrdiff_t)curMatch2 - lzPos + 2] == cur[2])
-    {
-      distances[0] = 3;
-      return distances + 2;
-    }
-    distances[0] = 2;
-    distances += 2;
-  }
-  if (curMatch3 >= matchMinPos && cur[(ptrdiff_t)curMatch3 - lzPos] == cur[0])
-  {
-    *distances++ = 3;
-    *distances++ = lzPos - curMatch3 - 1;
-  }
-  return distances;
-}
-
-/*
-UInt32 *MixMatches4(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
-{
-  UInt32 hash2Value, hash3Value, hash4Value, curMatch2, curMatch3, curMatch4;
-  UInt32 *hash = p->hash;
-  const Byte *cur = p->pointerToCurPos;
-  UInt32 lzPos = p->lzPos;
-  MT_HASH4_CALC
-      
-  curMatch2 = hash[                hash2Value];
-  curMatch3 = hash[kFix3HashSize + hash3Value];
-  curMatch4 = hash[kFix4HashSize + hash4Value];
-  
-  hash[                hash2Value] =
-  hash[kFix3HashSize + hash3Value] =
-  hash[kFix4HashSize + hash4Value] =
-    lzPos;
-
-  if (curMatch2 >= matchMinPos && cur[(ptrdiff_t)curMatch2 - lzPos] == cur[0])
-  {
-    distances[1] = lzPos - curMatch2 - 1;
-    if (cur[(ptrdiff_t)curMatch2 - lzPos + 2] == cur[2])
-    {
-      distances[0] =  (cur[(ptrdiff_t)curMatch2 - lzPos + 3] == cur[3]) ? 4 : 3;
-      return distances + 2;
-    }
-    distances[0] = 2;
-    distances += 2;
-  }
-  if (curMatch3 >= matchMinPos && cur[(ptrdiff_t)curMatch3 - lzPos] == cur[0])
-  {
-    distances[1] = lzPos - curMatch3 - 1;
-    if (cur[(ptrdiff_t)curMatch3 - lzPos + 3] == cur[3])
-    {
-      distances[0] = 4;
-      return distances + 2;
-    }
-    distances[0] = 3;
-    distances += 2;
-  }
-
-  if (curMatch4 >= matchMinPos)
-    if (
-      cur[(ptrdiff_t)curMatch4 - lzPos] == cur[0] &&
-      cur[(ptrdiff_t)curMatch4 - lzPos + 3] == cur[3]
-      )
-    {
-      *distances++ = 4;
-      *distances++ = lzPos - curMatch4 - 1;
-    }
-  return distances;
-}
-*/
-
-#define INCREASE_LZ_POS p->lzPos++; p->pointerToCurPos++;
-
-UInt32 MatchFinderMt2_GetMatches(CMatchFinderMt *p, UInt32 *distances)
-{
-  const UInt32 *btBuf = p->btBuf + p->btBufPos;
-  UInt32 len = *btBuf++;
-  p->btBufPos += 1 + len;
-  p->btNumAvailBytes--;
-  {
-    UInt32 i;
-    for (i = 0; i < len; i += 2)
-    {
-      *distances++ = *btBuf++;
-      *distances++ = *btBuf++;
-    }
-  }
-  INCREASE_LZ_POS
-  return len;
-}
-
-UInt32 MatchFinderMt_GetMatches(CMatchFinderMt *p, UInt32 *distances)
-{
-  const UInt32 *btBuf = p->btBuf + p->btBufPos;
-  UInt32 len = *btBuf++;
-  p->btBufPos += 1 + len;
-
-  if (len == 0)
-  {
-    if (p->btNumAvailBytes-- >= 4)
-      len = (UInt32)(p->MixMatchesFunc(p, p->lzPos - p->historySize, distances) - (distances));
-  }
-  else
-  {
-    /* Condition: there are matches in btBuf with length < p->numHashBytes */
-    UInt32 *distances2;
-    p->btNumAvailBytes--;
-    distances2 = p->MixMatchesFunc(p, p->lzPos - btBuf[1], distances);
-    do
-    {
-      *distances2++ = *btBuf++;
-      *distances2++ = *btBuf++;
-    }
-    while ((len -= 2) != 0);
-    len  = (UInt32)(distances2 - (distances));
-  }
-  INCREASE_LZ_POS
-  return len;
-}
-
-#define SKIP_HEADER2  do { GET_NEXT_BLOCK_IF_REQUIRED
-#define SKIP_HEADER(n) SKIP_HEADER2 if (p->btNumAvailBytes-- >= (n)) { const Byte *cur = p->pointerToCurPos; UInt32 *hash = p->hash;
-#define SKIP_FOOTER } INCREASE_LZ_POS p->btBufPos += p->btBuf[p->btBufPos] + 1; } while (--num != 0);
-
-void MatchFinderMt0_Skip(CMatchFinderMt *p, UInt32 num)
-{
-  SKIP_HEADER2 { p->btNumAvailBytes--;
-  SKIP_FOOTER
-}
-
-void MatchFinderMt2_Skip(CMatchFinderMt *p, UInt32 num)
-{
-  SKIP_HEADER(2)
-      UInt32 hash2Value;
-      MT_HASH2_CALC
-      hash[hash2Value] = p->lzPos;
-  SKIP_FOOTER
-}
-
-void MatchFinderMt3_Skip(CMatchFinderMt *p, UInt32 num)
-{
-  SKIP_HEADER(3)
-      UInt32 hash2Value, hash3Value;
-      MT_HASH3_CALC
-      hash[kFix3HashSize + hash3Value] =
-      hash[                hash2Value] =
-        p->lzPos;
-  SKIP_FOOTER
-}
-
-/*
-void MatchFinderMt4_Skip(CMatchFinderMt *p, UInt32 num)
-{
-  SKIP_HEADER(4)
-      UInt32 hash2Value, hash3Value, hash4Value;
-      MT_HASH4_CALC
-      hash[kFix4HashSize + hash4Value] =
-      hash[kFix3HashSize + hash3Value] =
-      hash[                hash2Value] =
-        p->lzPos;
-  SKIP_FOOTER
-}
-*/
-
-void MatchFinderMt_CreateVTable(CMatchFinderMt *p, IMatchFinder *vTable)
-{
-  vTable->Init = (Mf_Init_Func)MatchFinderMt_Init;
-  vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinderMt_GetIndexByte;
-  vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinderMt_GetNumAvailableBytes;
-  vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinderMt_GetPointerToCurrentPos;
-  vTable->GetMatches = (Mf_GetMatches_Func)MatchFinderMt_GetMatches;
-  switch(p->MatchFinder->numHashBytes)
-  {
-    case 2:
-      p->GetHeadsFunc = GetHeads2;
-      p->MixMatchesFunc = (Mf_Mix_Matches)0;
-      vTable->Skip = (Mf_Skip_Func)MatchFinderMt0_Skip;
-      vTable->GetMatches = (Mf_GetMatches_Func)MatchFinderMt2_GetMatches;
-      break;
-    case 3:
-      p->GetHeadsFunc = GetHeads3;
-      p->MixMatchesFunc = (Mf_Mix_Matches)MixMatches2;
-      vTable->Skip = (Mf_Skip_Func)MatchFinderMt2_Skip;
-      break;
-    default:
-    /* case 4: */
-      p->GetHeadsFunc = p->MatchFinder->bigHash ? GetHeads4b : GetHeads4;
-      /* p->GetHeadsFunc = GetHeads4; */
-      p->MixMatchesFunc = (Mf_Mix_Matches)MixMatches3;
-      vTable->Skip = (Mf_Skip_Func)MatchFinderMt3_Skip;
-      break;
-    /*
-    default:
-      p->GetHeadsFunc = GetHeads5;
-      p->MixMatchesFunc = (Mf_Mix_Matches)MixMatches4;
-      vTable->Skip = (Mf_Skip_Func)MatchFinderMt4_Skip;
-      break;
-    */
-  }
-}
diff --git a/third_party/lzma/v4_65/files/C/LzFindMt.h b/third_party/lzma/v4_65/files/C/LzFindMt.h
deleted file mode 100644
index 2c7e462..0000000
--- a/third_party/lzma/v4_65/files/C/LzFindMt.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* LzFindMt.h -- multithreaded Match finder for LZ algorithms
-2008-10-04 : Igor Pavlov : Public domain */
-
-#ifndef __LZFINDMT_H
-#define __LZFINDMT_H
-
-#include "Threads.h"
-#include "LzFind.h"
-
-#define kMtHashBlockSize (1 << 13)
-#define kMtHashNumBlocks (1 << 3)
-#define kMtHashNumBlocksMask (kMtHashNumBlocks - 1)
-
-#define kMtBtBlockSize (1 << 14)
-#define kMtBtNumBlocks (1 << 6)
-#define kMtBtNumBlocksMask (kMtBtNumBlocks - 1)
-
-typedef struct _CMtSync
-{
-  Bool wasCreated;
-  Bool needStart;
-  Bool exit;
-  Bool stopWriting;
-
-  CThread thread;
-  CAutoResetEvent canStart;
-  CAutoResetEvent wasStarted;
-  CAutoResetEvent wasStopped;
-  CSemaphore freeSemaphore;
-  CSemaphore filledSemaphore;
-  Bool csWasInitialized;
-  Bool csWasEntered;
-  CCriticalSection cs;
-  UInt32 numProcessedBlocks;
-} CMtSync;
-
-typedef UInt32 * (*Mf_Mix_Matches)(void *p, UInt32 matchMinPos, UInt32 *distances);
-
-/* kMtCacheLineDummy must be >= size_of_CPU_cache_line */
-#define kMtCacheLineDummy 128
-
-typedef void (*Mf_GetHeads)(const Byte *buffer, UInt32 pos,
-  UInt32 *hash, UInt32 hashMask, UInt32 *heads, UInt32 numHeads, const UInt32 *crc);
-
-typedef struct _CMatchFinderMt
-{
-  /* LZ */
-  const Byte *pointerToCurPos;
-  UInt32 *btBuf;
-  UInt32 btBufPos;
-  UInt32 btBufPosLimit;
-  UInt32 lzPos;
-  UInt32 btNumAvailBytes;
-
-  UInt32 *hash;
-  UInt32 fixedHashSize;
-  UInt32 historySize;
-  const UInt32 *crc;
-
-  Mf_Mix_Matches MixMatchesFunc;
-  
-  /* LZ + BT */
-  CMtSync btSync;
-  Byte btDummy[kMtCacheLineDummy];
-
-  /* BT */
-  UInt32 *hashBuf;
-  UInt32 hashBufPos;
-  UInt32 hashBufPosLimit;
-  UInt32 hashNumAvail;
-
-  CLzRef *son;
-  UInt32 matchMaxLen;
-  UInt32 numHashBytes;
-  UInt32 pos;
-  Byte *buffer;
-  UInt32 cyclicBufferPos;
-  UInt32 cyclicBufferSize; /* it must be historySize + 1 */
-  UInt32 cutValue;
-
-  /* BT + Hash */
-  CMtSync hashSync;
-  /* Byte hashDummy[kMtCacheLineDummy]; */
-  
-  /* Hash */
-  Mf_GetHeads GetHeadsFunc;
-  CMatchFinder *MatchFinder;
-} CMatchFinderMt;
-
-void MatchFinderMt_Construct(CMatchFinderMt *p);
-void MatchFinderMt_Destruct(CMatchFinderMt *p, ISzAlloc *alloc);
-SRes MatchFinderMt_Create(CMatchFinderMt *p, UInt32 historySize, UInt32 keepAddBufferBefore,
-    UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ISzAlloc *alloc);
-void MatchFinderMt_CreateVTable(CMatchFinderMt *p, IMatchFinder *vTable);
-void MatchFinderMt_ReleaseStream(CMatchFinderMt *p);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/C/LzHash.h b/third_party/lzma/v4_65/files/C/LzHash.h
deleted file mode 100644
index 9f4173e..0000000
--- a/third_party/lzma/v4_65/files/C/LzHash.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* LzHash.h -- HASH functions for LZ algorithms
-2008-10-04 : Igor Pavlov : Public domain */
-
-#ifndef __LZHASH_H
-#define __LZHASH_H
-
-#define kHash2Size (1 << 10)
-#define kHash3Size (1 << 16)
-#define kHash4Size (1 << 20)
-
-#define kFix3HashSize (kHash2Size)
-#define kFix4HashSize (kHash2Size + kHash3Size)
-#define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size)
-
-#define HASH2_CALC hashValue = cur[0] | ((UInt32)cur[1] << 8);
-
-#define HASH3_CALC { \
-  UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
-  hash2Value = temp & (kHash2Size - 1); \
-  hashValue = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; }
-
-#define HASH4_CALC { \
-  UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
-  hash2Value = temp & (kHash2Size - 1); \
-  hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
-  hashValue = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & p->hashMask; }
-
-#define HASH5_CALC { \
-  UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
-  hash2Value = temp & (kHash2Size - 1); \
-  hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
-  hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)); \
-  hashValue = (hash4Value ^ (p->crc[cur[4]] << 3)) & p->hashMask; \
-  hash4Value &= (kHash4Size - 1); }
-
-/* #define HASH_ZIP_CALC hashValue = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */
-#define HASH_ZIP_CALC hashValue = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF;
-
-
-#define MT_HASH2_CALC \
-  hash2Value = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1);
-
-#define MT_HASH3_CALC { \
-  UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
-  hash2Value = temp & (kHash2Size - 1); \
-  hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); }
-
-#define MT_HASH4_CALC { \
-  UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
-  hash2Value = temp & (kHash2Size - 1); \
-  hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
-  hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); }
-
-#endif
diff --git a/third_party/lzma/v4_65/files/C/LzmaDec.c b/third_party/lzma/v4_65/files/C/LzmaDec.c
deleted file mode 100644
index d87eb19..0000000
--- a/third_party/lzma/v4_65/files/C/LzmaDec.c
+++ /dev/null
@@ -1,1007 +0,0 @@
-/* LzmaDec.c -- LZMA Decoder
-2008-11-06 : Igor Pavlov : Public domain */
-
-#include "LzmaDec.h"
-
-#include <string.h>
-
-#define kNumTopBits 24
-#define kTopValue ((UInt32)1 << kNumTopBits)
-
-#define kNumBitModelTotalBits 11
-#define kBitModelTotal (1 << kNumBitModelTotalBits)
-#define kNumMoveBits 5
-
-#define RC_INIT_SIZE 5
-
-#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); }
-
-#define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
-#define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
-#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits));
-#define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \
-  { UPDATE_0(p); i = (i + i); A0; } else \
-  { UPDATE_1(p); i = (i + i) + 1; A1; }
-#define GET_BIT(p, i) GET_BIT2(p, i, ; , ;)
-
-#define TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); }
-#define TREE_DECODE(probs, limit, i) \
-  { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; }
-
-/* #define _LZMA_SIZE_OPT */
-
-#ifdef _LZMA_SIZE_OPT
-#define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i)
-#else
-#define TREE_6_DECODE(probs, i) \
-  { i = 1; \
-  TREE_GET_BIT(probs, i); \
-  TREE_GET_BIT(probs, i); \
-  TREE_GET_BIT(probs, i); \
-  TREE_GET_BIT(probs, i); \
-  TREE_GET_BIT(probs, i); \
-  TREE_GET_BIT(probs, i); \
-  i -= 0x40; }
-#endif
-
-#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); }
-
-#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
-#define UPDATE_0_CHECK range = bound;
-#define UPDATE_1_CHECK range -= bound; code -= bound;
-#define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \
-  { UPDATE_0_CHECK; i = (i + i); A0; } else \
-  { UPDATE_1_CHECK; i = (i + i) + 1; A1; }
-#define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;)
-#define TREE_DECODE_CHECK(probs, limit, i) \
-  { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; }
-
-
-#define kNumPosBitsMax 4
-#define kNumPosStatesMax (1 << kNumPosBitsMax)
-
-#define kLenNumLowBits 3
-#define kLenNumLowSymbols (1 << kLenNumLowBits)
-#define kLenNumMidBits 3
-#define kLenNumMidSymbols (1 << kLenNumMidBits)
-#define kLenNumHighBits 8
-#define kLenNumHighSymbols (1 << kLenNumHighBits)
-
-#define LenChoice 0
-#define LenChoice2 (LenChoice + 1)
-#define LenLow (LenChoice2 + 1)
-#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
-#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
-#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
-
-
-#define kNumStates 12
-#define kNumLitStates 7
-
-#define kStartPosModelIndex 4
-#define kEndPosModelIndex 14
-#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
-
-#define kNumPosSlotBits 6
-#define kNumLenToPosStates 4
-
-#define kNumAlignBits 4
-#define kAlignTableSize (1 << kNumAlignBits)
-
-#define kMatchMinLen 2
-#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols)
-
-#define IsMatch 0
-#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
-#define IsRepG0 (IsRep + kNumStates)
-#define IsRepG1 (IsRepG0 + kNumStates)
-#define IsRepG2 (IsRepG1 + kNumStates)
-#define IsRep0Long (IsRepG2 + kNumStates)
-#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
-#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
-#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
-#define LenCoder (Align + kAlignTableSize)
-#define RepLenCoder (LenCoder + kNumLenProbs)
-#define Literal (RepLenCoder + kNumLenProbs)
-
-#define LZMA_BASE_SIZE 1846
-#define LZMA_LIT_SIZE 768
-
-#define LzmaProps_GetNumProbs(p) ((UInt32)LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((p)->lc + (p)->lp)))
-
-#if Literal != LZMA_BASE_SIZE
-StopCompilingDueBUG
-#endif
-
-static const Byte kLiteralNextStates[kNumStates * 2] =
-{
-  0, 0, 0, 0, 1, 2, 3,  4,  5,  6,  4,  5,
-  7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10
-};
-
-#define LZMA_DIC_MIN (1 << 12)
-
-/* First LZMA-symbol is always decoded.
-And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization
-Out:
-  Result:
-    SZ_OK - OK
-    SZ_ERROR_DATA - Error
-  p->remainLen:
-    < kMatchSpecLenStart : normal remain
-    = kMatchSpecLenStart : finished
-    = kMatchSpecLenStart + 1 : Flush marker
-    = kMatchSpecLenStart + 2 : State Init Marker
-*/
-
-static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
-{
-  CLzmaProb *probs = p->probs;
-
-  unsigned state = p->state;
-  UInt32 rep0 = p->reps[0], rep1 = p->reps[1], rep2 = p->reps[2], rep3 = p->reps[3];
-  unsigned pbMask = ((unsigned)1 << (p->prop.pb)) - 1;
-  unsigned lpMask = ((unsigned)1 << (p->prop.lp)) - 1;
-  unsigned lc = p->prop.lc;
-
-  Byte *dic = p->dic;
-  SizeT dicBufSize = p->dicBufSize;
-  SizeT dicPos = p->dicPos;
-  
-  UInt32 processedPos = p->processedPos;
-  UInt32 checkDicSize = p->checkDicSize;
-  unsigned len = 0;
-
-  const Byte *buf = p->buf;
-  UInt32 range = p->range;
-  UInt32 code = p->code;
-
-  do
-  {
-    CLzmaProb *prob;
-    UInt32 bound;
-    unsigned ttt;
-    unsigned posState = processedPos & pbMask;
-
-    prob = probs + IsMatch + (state << kNumPosBitsMax) + posState;
-    IF_BIT_0(prob)
-    {
-      unsigned symbol;
-      UPDATE_0(prob);
-      prob = probs + Literal;
-      if (checkDicSize != 0 || processedPos != 0)
-        prob += (LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) +
-        (dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc))));
-
-      if (state < kNumLitStates)
-      {
-        symbol = 1;
-        do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100);
-      }
-      else
-      {
-        unsigned matchByte = p->dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
-        unsigned offs = 0x100;
-        symbol = 1;
-        do
-        {
-          unsigned bit;
-          CLzmaProb *probLit;
-          matchByte <<= 1;
-          bit = (matchByte & offs);
-          probLit = prob + offs + bit + symbol;
-          GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit)
-        }
-        while (symbol < 0x100);
-      }
-      dic[dicPos++] = (Byte)symbol;
-      processedPos++;
-
-      state = kLiteralNextStates[state];
-      /* if (state < 4) state = 0; else if (state < 10) state -= 3; else state -= 6; */
-      continue;
-    }
-    else
-    {
-      UPDATE_1(prob);
-      prob = probs + IsRep + state;
-      IF_BIT_0(prob)
-      {
-        UPDATE_0(prob);
-        state += kNumStates;
-        prob = probs + LenCoder;
-      }
-      else
-      {
-        UPDATE_1(prob);
-        if (checkDicSize == 0 && processedPos == 0)
-          return SZ_ERROR_DATA;
-        prob = probs + IsRepG0 + state;
-        IF_BIT_0(prob)
-        {
-          UPDATE_0(prob);
-          prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState;
-          IF_BIT_0(prob)
-          {
-            UPDATE_0(prob);
-            dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
-            dicPos++;
-            processedPos++;
-            state = state < kNumLitStates ? 9 : 11;
-            continue;
-          }
-          UPDATE_1(prob);
-        }
-        else
-        {
-          UInt32 distance;
-          UPDATE_1(prob);
-          prob = probs + IsRepG1 + state;
-          IF_BIT_0(prob)
-          {
-            UPDATE_0(prob);
-            distance = rep1;
-          }
-          else
-          {
-            UPDATE_1(prob);
-            prob = probs + IsRepG2 + state;
-            IF_BIT_0(prob)
-            {
-              UPDATE_0(prob);
-              distance = rep2;
-            }
-            else
-            {
-              UPDATE_1(prob);
-              distance = rep3;
-              rep3 = rep2;
-            }
-            rep2 = rep1;
-          }
-          rep1 = rep0;
-          rep0 = distance;
-        }
-        state = state < kNumLitStates ? 8 : 11;
-        prob = probs + RepLenCoder;
-      }
-      {
-        unsigned limit, offset;
-        CLzmaProb *probLen = prob + LenChoice;
-        IF_BIT_0(probLen)
-        {
-          UPDATE_0(probLen);
-          probLen = prob + LenLow + (posState << kLenNumLowBits);
-          offset = 0;
-          limit = (1 << kLenNumLowBits);
-        }
-        else
-        {
-          UPDATE_1(probLen);
-          probLen = prob + LenChoice2;
-          IF_BIT_0(probLen)
-          {
-            UPDATE_0(probLen);
-            probLen = prob + LenMid + (posState << kLenNumMidBits);
-            offset = kLenNumLowSymbols;
-            limit = (1 << kLenNumMidBits);
-          }
-          else
-          {
-            UPDATE_1(probLen);
-            probLen = prob + LenHigh;
-            offset = kLenNumLowSymbols + kLenNumMidSymbols;
-            limit = (1 << kLenNumHighBits);
-          }
-        }
-        TREE_DECODE(probLen, limit, len);
-        len += offset;
-      }
-
-      if (state >= kNumStates)
-      {
-        UInt32 distance;
-        prob = probs + PosSlot +
-            ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits);
-        TREE_6_DECODE(prob, distance);
-        if (distance >= kStartPosModelIndex)
-        {
-          unsigned posSlot = (unsigned)distance;
-          int numDirectBits = (int)(((distance >> 1) - 1));
-          distance = (2 | (distance & 1));
-          if (posSlot < kEndPosModelIndex)
-          {
-            distance <<= numDirectBits;
-            prob = probs + SpecPos + distance - posSlot - 1;
-            {
-              UInt32 mask = 1;
-              unsigned i = 1;
-              do
-              {
-                GET_BIT2(prob + i, i, ; , distance |= mask);
-                mask <<= 1;
-              }
-              while (--numDirectBits != 0);
-            }
-          }
-          else
-          {
-            numDirectBits -= kNumAlignBits;
-            do
-            {
-              NORMALIZE
-              range >>= 1;
-              
-              {
-                UInt32 t;
-                code -= range;
-                t = (0 - ((UInt32)code >> 31)); /* (UInt32)((Int32)code >> 31) */
-                distance = (distance << 1) + (t + 1);
-                code += range & t;
-              }
-              /*
-              distance <<= 1;
-              if (code >= range)
-              {
-                code -= range;
-                distance |= 1;
-              }
-              */
-            }
-            while (--numDirectBits != 0);
-            prob = probs + Align;
-            distance <<= kNumAlignBits;
-            {
-              unsigned i = 1;
-              GET_BIT2(prob + i, i, ; , distance |= 1);
-              GET_BIT2(prob + i, i, ; , distance |= 2);
-              GET_BIT2(prob + i, i, ; , distance |= 4);
-              GET_BIT2(prob + i, i, ; , distance |= 8);
-            }
-            if (distance == (UInt32)0xFFFFFFFF)
-            {
-              len += kMatchSpecLenStart;
-              state -= kNumStates;
-              break;
-            }
-          }
-        }
-        rep3 = rep2;
-        rep2 = rep1;
-        rep1 = rep0;
-        rep0 = distance + 1;
-        if (checkDicSize == 0)
-        {
-          if (distance >= processedPos)
-            return SZ_ERROR_DATA;
-        }
-        else if (distance >= checkDicSize)
-          return SZ_ERROR_DATA;
-        state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3;
-        /* state = kLiteralNextStates[state]; */
-      }
-
-      len += kMatchMinLen;
-
-      if (limit == dicPos)
-        return SZ_ERROR_DATA;
-      {
-        SizeT rem = limit - dicPos;
-        unsigned curLen = ((rem < len) ? (unsigned)rem : len);
-        SizeT pos = (dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0);
-
-        processedPos += curLen;
-
-        len -= curLen;
-        if (pos + curLen <= dicBufSize)
-        {
-          Byte *dest = dic + dicPos;
-          ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos;
-          const Byte *lim = dest + curLen;
-          dicPos += curLen;
-          do
-            *(dest) = (Byte)*(dest + src);
-          while (++dest != lim);
-        }
-        else
-        {
-          do
-          {
-            dic[dicPos++] = dic[pos];
-            if (++pos == dicBufSize)
-              pos = 0;
-          }
-          while (--curLen != 0);
-        }
-      }
-    }
-  }
-  while (dicPos < limit && buf < bufLimit);
-  NORMALIZE;
-  p->buf = buf;
-  p->range = range;
-  p->code = code;
-  p->remainLen = len;
-  p->dicPos = dicPos;
-  p->processedPos = processedPos;
-  p->reps[0] = rep0;
-  p->reps[1] = rep1;
-  p->reps[2] = rep2;
-  p->reps[3] = rep3;
-  p->state = state;
-
-  return SZ_OK;
-}
-
-static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit)
-{
-  if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart)
-  {
-    Byte *dic = p->dic;
-    SizeT dicPos = p->dicPos;
-    SizeT dicBufSize = p->dicBufSize;
-    unsigned len = p->remainLen;
-    UInt32 rep0 = p->reps[0];
-    if (limit - dicPos < len)
-      len = (unsigned)(limit - dicPos);
-
-    if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len)
-      p->checkDicSize = p->prop.dicSize;
-
-    p->processedPos += len;
-    p->remainLen -= len;
-    while (len-- != 0)
-    {
-      dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
-      dicPos++;
-    }
-    p->dicPos = dicPos;
-  }
-}
-
-static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
-{
-  do
-  {
-    SizeT limit2 = limit;
-    if (p->checkDicSize == 0)
-    {
-      UInt32 rem = p->prop.dicSize - p->processedPos;
-      if (limit - p->dicPos > rem)
-        limit2 = p->dicPos + rem;
-    }
-    RINOK(LzmaDec_DecodeReal(p, limit2, bufLimit));
-    if (p->processedPos >= p->prop.dicSize)
-      p->checkDicSize = p->prop.dicSize;
-    LzmaDec_WriteRem(p, limit);
-  }
-  while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart);
-
-  if (p->remainLen > kMatchSpecLenStart)
-  {
-    p->remainLen = kMatchSpecLenStart;
-  }
-  return 0;
-}
-
-typedef enum
-{
-  DUMMY_ERROR, /* unexpected end of input stream */
-  DUMMY_LIT,
-  DUMMY_MATCH,
-  DUMMY_REP
-} ELzmaDummy;
-
-static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inSize)
-{
-  UInt32 range = p->range;
-  UInt32 code = p->code;
-  const Byte *bufLimit = buf + inSize;
-  CLzmaProb *probs = p->probs;
-  unsigned state = p->state;
-  ELzmaDummy res;
-
-  {
-    CLzmaProb *prob;
-    UInt32 bound;
-    unsigned ttt;
-    unsigned posState = (p->processedPos) & ((1 << p->prop.pb) - 1);
-
-    prob = probs + IsMatch + (state << kNumPosBitsMax) + posState;
-    IF_BIT_0_CHECK(prob)
-    {
-      UPDATE_0_CHECK
-
-      /* if (bufLimit - buf >= 7) return DUMMY_LIT; */
-
-      prob = probs + Literal;
-      if (p->checkDicSize != 0 || p->processedPos != 0)
-        prob += (LZMA_LIT_SIZE *
-          ((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) +
-          (p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc))));
-
-      if (state < kNumLitStates)
-      {
-        unsigned symbol = 1;
-        do { GET_BIT_CHECK(prob + symbol, symbol) } while (symbol < 0x100);
-      }
-      else
-      {
-        unsigned matchByte = p->dic[p->dicPos - p->reps[0] +
-            ((p->dicPos < p->reps[0]) ? p->dicBufSize : 0)];
-        unsigned offs = 0x100;
-        unsigned symbol = 1;
-        do
-        {
-          unsigned bit;
-          CLzmaProb *probLit;
-          matchByte <<= 1;
-          bit = (matchByte & offs);
-          probLit = prob + offs + bit + symbol;
-          GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit)
-        }
-        while (symbol < 0x100);
-      }
-      res = DUMMY_LIT;
-    }
-    else
-    {
-      unsigned len;
-      UPDATE_1_CHECK;
-
-      prob = probs + IsRep + state;
-      IF_BIT_0_CHECK(prob)
-      {
-        UPDATE_0_CHECK;
-        state = 0;
-        prob = probs + LenCoder;
-        res = DUMMY_MATCH;
-      }
-      else
-      {
-        UPDATE_1_CHECK;
-        res = DUMMY_REP;
-        prob = probs + IsRepG0 + state;
-        IF_BIT_0_CHECK(prob)
-        {
-          UPDATE_0_CHECK;
-          prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState;
-          IF_BIT_0_CHECK(prob)
-          {
-            UPDATE_0_CHECK;
-            NORMALIZE_CHECK;
-            return DUMMY_REP;
-          }
-          else
-          {
-            UPDATE_1_CHECK;
-          }
-        }
-        else
-        {
-          UPDATE_1_CHECK;
-          prob = probs + IsRepG1 + state;
-          IF_BIT_0_CHECK(prob)
-          {
-            UPDATE_0_CHECK;
-          }
-          else
-          {
-            UPDATE_1_CHECK;
-            prob = probs + IsRepG2 + state;
-            IF_BIT_0_CHECK(prob)
-            {
-              UPDATE_0_CHECK;
-            }
-            else
-            {
-              UPDATE_1_CHECK;
-            }
-          }
-        }
-        state = kNumStates;
-        prob = probs + RepLenCoder;
-      }
-      {
-        unsigned limit, offset;
-        CLzmaProb *probLen = prob + LenChoice;
-        IF_BIT_0_CHECK(probLen)
-        {
-          UPDATE_0_CHECK;
-          probLen = prob + LenLow + (posState << kLenNumLowBits);
-          offset = 0;
-          limit = 1 << kLenNumLowBits;
-        }
-        else
-        {
-          UPDATE_1_CHECK;
-          probLen = prob + LenChoice2;
-          IF_BIT_0_CHECK(probLen)
-          {
-            UPDATE_0_CHECK;
-            probLen = prob + LenMid + (posState << kLenNumMidBits);
-            offset = kLenNumLowSymbols;
-            limit = 1 << kLenNumMidBits;
-          }
-          else
-          {
-            UPDATE_1_CHECK;
-            probLen = prob + LenHigh;
-            offset = kLenNumLowSymbols + kLenNumMidSymbols;
-            limit = 1 << kLenNumHighBits;
-          }
-        }
-        TREE_DECODE_CHECK(probLen, limit, len);
-        len += offset;
-      }
-
-      if (state < 4)
-      {
-        unsigned posSlot;
-        prob = probs + PosSlot +
-            ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
-            kNumPosSlotBits);
-        TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot);
-        if (posSlot >= kStartPosModelIndex)
-        {
-          int numDirectBits = ((posSlot >> 1) - 1);
-
-          /* if (bufLimit - buf >= 8) return DUMMY_MATCH; */
-
-          if (posSlot < kEndPosModelIndex)
-          {
-            prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits) - posSlot - 1;
-          }
-          else
-          {
-            numDirectBits -= kNumAlignBits;
-            do
-            {
-              NORMALIZE_CHECK
-              range >>= 1;
-              code -= range & (((code - range) >> 31) - 1);
-              /* if (code >= range) code -= range; */
-            }
-            while (--numDirectBits != 0);
-            prob = probs + Align;
-            numDirectBits = kNumAlignBits;
-          }
-          {
-            unsigned i = 1;
-            do
-            {
-              GET_BIT_CHECK(prob + i, i);
-            }
-            while (--numDirectBits != 0);
-          }
-        }
-      }
-    }
-  }
-  NORMALIZE_CHECK;
-  return res;
-}
-
-
-static void LzmaDec_InitRc(CLzmaDec *p, const Byte *data)
-{
-  p->code = ((UInt32)data[1] << 24) | ((UInt32)data[2] << 16) | ((UInt32)data[3] << 8) | ((UInt32)data[4]);
-  p->range = 0xFFFFFFFF;
-  p->needFlush = 0;
-}
-
-void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState)
-{
-  p->needFlush = 1;
-  p->remainLen = 0;
-  p->tempBufSize = 0;
-
-  if (initDic)
-  {
-    p->processedPos = 0;
-    p->checkDicSize = 0;
-    p->needInitState = 1;
-  }
-  if (initState)
-    p->needInitState = 1;
-}
-
-void LzmaDec_Init(CLzmaDec *p)
-{
-  p->dicPos = 0;
-  LzmaDec_InitDicAndState(p, True, True);
-}
-
-static void LzmaDec_InitStateReal(CLzmaDec *p)
-{
-  UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (p->prop.lc + p->prop.lp));
-  UInt32 i;
-  CLzmaProb *probs = p->probs;
-  for (i = 0; i < numProbs; i++)
-    probs[i] = kBitModelTotal >> 1;
-  p->reps[0] = p->reps[1] = p->reps[2] = p->reps[3] = 1;
-  p->state = 0;
-  p->needInitState = 0;
-}
-
-SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen,
-    ELzmaFinishMode finishMode, ELzmaStatus *status)
-{
-  SizeT inSize = *srcLen;
-  (*srcLen) = 0;
-  LzmaDec_WriteRem(p, dicLimit);
-  
-  *status = LZMA_STATUS_NOT_SPECIFIED;
-
-  while (p->remainLen != kMatchSpecLenStart)
-  {
-      int checkEndMarkNow;
-
-      if (p->needFlush != 0)
-      {
-        for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--)
-          p->tempBuf[p->tempBufSize++] = *src++;
-        if (p->tempBufSize < RC_INIT_SIZE)
-        {
-          *status = LZMA_STATUS_NEEDS_MORE_INPUT;
-          return SZ_OK;
-        }
-        if (p->tempBuf[0] != 0)
-          return SZ_ERROR_DATA;
-
-        LzmaDec_InitRc(p, p->tempBuf);
-        p->tempBufSize = 0;
-      }
-
-      checkEndMarkNow = 0;
-      if (p->dicPos >= dicLimit)
-      {
-        if (p->remainLen == 0 && p->code == 0)
-        {
-          *status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK;
-          return SZ_OK;
-        }
-        if (finishMode == LZMA_FINISH_ANY)
-        {
-          *status = LZMA_STATUS_NOT_FINISHED;
-          return SZ_OK;
-        }
-        if (p->remainLen != 0)
-        {
-          *status = LZMA_STATUS_NOT_FINISHED;
-          return SZ_ERROR_DATA;
-        }
-        checkEndMarkNow = 1;
-      }
-
-      if (p->needInitState)
-        LzmaDec_InitStateReal(p);
-  
-      if (p->tempBufSize == 0)
-      {
-        SizeT processed;
-        const Byte *bufLimit;
-        if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
-        {
-          int dummyRes = LzmaDec_TryDummy(p, src, inSize);
-          if (dummyRes == DUMMY_ERROR)
-          {
-            memcpy(p->tempBuf, src, inSize);
-            p->tempBufSize = (unsigned)inSize;
-            (*srcLen) += inSize;
-            *status = LZMA_STATUS_NEEDS_MORE_INPUT;
-            return SZ_OK;
-          }
-          if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
-          {
-            *status = LZMA_STATUS_NOT_FINISHED;
-            return SZ_ERROR_DATA;
-          }
-          bufLimit = src;
-        }
-        else
-          bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX;
-        p->buf = src;
-        if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0)
-          return SZ_ERROR_DATA;
-        processed = (SizeT)(p->buf - src);
-        (*srcLen) += processed;
-        src += processed;
-        inSize -= processed;
-      }
-      else
-      {
-        unsigned rem = p->tempBufSize, lookAhead = 0;
-        while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize)
-          p->tempBuf[rem++] = src[lookAhead++];
-        p->tempBufSize = rem;
-        if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
-        {
-          int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem);
-          if (dummyRes == DUMMY_ERROR)
-          {
-            (*srcLen) += lookAhead;
-            *status = LZMA_STATUS_NEEDS_MORE_INPUT;
-            return SZ_OK;
-          }
-          if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
-          {
-            *status = LZMA_STATUS_NOT_FINISHED;
-            return SZ_ERROR_DATA;
-          }
-        }
-        p->buf = p->tempBuf;
-        if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0)
-          return SZ_ERROR_DATA;
-        lookAhead -= (rem - (unsigned)(p->buf - p->tempBuf));
-        (*srcLen) += lookAhead;
-        src += lookAhead;
-        inSize -= lookAhead;
-        p->tempBufSize = 0;
-      }
-  }
-  if (p->code == 0)
-    *status = LZMA_STATUS_FINISHED_WITH_MARK;
-  return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA;
-}
-
-SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
-{
-  SizeT outSize = *destLen;
-  SizeT inSize = *srcLen;
-  *srcLen = *destLen = 0;
-  for (;;)
-  {
-    SizeT inSizeCur = inSize, outSizeCur, dicPos;
-    ELzmaFinishMode curFinishMode;
-    SRes res;
-    if (p->dicPos == p->dicBufSize)
-      p->dicPos = 0;
-    dicPos = p->dicPos;
-    if (outSize > p->dicBufSize - dicPos)
-    {
-      outSizeCur = p->dicBufSize;
-      curFinishMode = LZMA_FINISH_ANY;
-    }
-    else
-    {
-      outSizeCur = dicPos + outSize;
-      curFinishMode = finishMode;
-    }
-
-    res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status);
-    src += inSizeCur;
-    inSize -= inSizeCur;
-    *srcLen += inSizeCur;
-    outSizeCur = p->dicPos - dicPos;
-    memcpy(dest, p->dic + dicPos, outSizeCur);
-    dest += outSizeCur;
-    outSize -= outSizeCur;
-    *destLen += outSizeCur;
-    if (res != 0)
-      return res;
-    if (outSizeCur == 0 || outSize == 0)
-      return SZ_OK;
-  }
-}
-
-void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc)
-{
-  alloc->Free(alloc, p->probs);
-  p->probs = 0;
-}
-
-static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc)
-{
-  alloc->Free(alloc, p->dic);
-  p->dic = 0;
-}
-
-void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc)
-{
-  LzmaDec_FreeProbs(p, alloc);
-  LzmaDec_FreeDict(p, alloc);
-}
-
-SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size)
-{
-  UInt32 dicSize;
-  Byte d;
-  
-  if (size < LZMA_PROPS_SIZE)
-    return SZ_ERROR_UNSUPPORTED;
-  else
-    dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24);
- 
-  if (dicSize < LZMA_DIC_MIN)
-    dicSize = LZMA_DIC_MIN;
-  p->dicSize = dicSize;
-
-  d = data[0];
-  if (d >= (9 * 5 * 5))
-    return SZ_ERROR_UNSUPPORTED;
-
-  p->lc = d % 9;
-  d /= 9;
-  p->pb = d / 5;
-  p->lp = d % 5;
-
-  return SZ_OK;
-}
-
-static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc)
-{
-  UInt32 numProbs = LzmaProps_GetNumProbs(propNew);
-  if (p->probs == 0 || numProbs != p->numProbs)
-  {
-    LzmaDec_FreeProbs(p, alloc);
-    p->probs = (CLzmaProb *)alloc->Alloc(alloc, numProbs * sizeof(CLzmaProb));
-    p->numProbs = numProbs;
-    if (p->probs == 0)
-      return SZ_ERROR_MEM;
-  }
-  return SZ_OK;
-}
-
-SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
-{
-  CLzmaProps propNew;
-  RINOK(LzmaProps_Decode(&propNew, props, propsSize));
-  RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
-  p->prop = propNew;
-  return SZ_OK;
-}
-
-SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
-{
-  CLzmaProps propNew;
-  SizeT dicBufSize;
-  RINOK(LzmaProps_Decode(&propNew, props, propsSize));
-  RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
-  dicBufSize = propNew.dicSize;
-  if (p->dic == 0 || dicBufSize != p->dicBufSize)
-  {
-    LzmaDec_FreeDict(p, alloc);
-    p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize);
-    if (p->dic == 0)
-    {
-      LzmaDec_FreeProbs(p, alloc);
-      return SZ_ERROR_MEM;
-    }
-  }
-  p->dicBufSize = dicBufSize;
-  p->prop = propNew;
-  return SZ_OK;
-}
-
-SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
-    const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
-    ELzmaStatus *status, ISzAlloc *alloc)
-{
-  CLzmaDec p;
-  SRes res;
-  SizeT inSize = *srcLen;
-  SizeT outSize = *destLen;
-  *srcLen = *destLen = 0;
-  if (inSize < RC_INIT_SIZE)
-    return SZ_ERROR_INPUT_EOF;
-
-  LzmaDec_Construct(&p);
-  res = LzmaDec_AllocateProbs(&p, propData, propSize, alloc);
-  if (res != 0)
-    return res;
-  p.dic = dest;
-  p.dicBufSize = outSize;
-
-  LzmaDec_Init(&p);
-  
-  *srcLen = inSize;
-  res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status);
-
-  if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT)
-    res = SZ_ERROR_INPUT_EOF;
-
-  (*destLen) = p.dicPos;
-  LzmaDec_FreeProbs(&p, alloc);
-  return res;
-}
diff --git a/third_party/lzma/v4_65/files/C/LzmaDec.h b/third_party/lzma/v4_65/files/C/LzmaDec.h
deleted file mode 100644
index 98cdbe9..0000000
--- a/third_party/lzma/v4_65/files/C/LzmaDec.h
+++ /dev/null
@@ -1,223 +0,0 @@
-/* LzmaDec.h -- LZMA Decoder
-2008-10-04 : Igor Pavlov : Public domain */
-
-#ifndef __LZMADEC_H
-#define __LZMADEC_H
-
-#include "Types.h"
-
-/* #define _LZMA_PROB32 */
-/* _LZMA_PROB32 can increase the speed on some CPUs,
-   but memory usage for CLzmaDec::probs will be doubled in that case */
-
-#ifdef _LZMA_PROB32
-#define CLzmaProb UInt32
-#else
-#define CLzmaProb UInt16
-#endif
-
-
-/* ---------- LZMA Properties ---------- */
-
-#define LZMA_PROPS_SIZE 5
-
-typedef struct _CLzmaProps
-{
-  unsigned lc, lp, pb;
-  UInt32 dicSize;
-} CLzmaProps;
-
-/* LzmaProps_Decode - decodes properties
-Returns:
-  SZ_OK
-  SZ_ERROR_UNSUPPORTED - Unsupported properties
-*/
-
-SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size);
-
-
-/* ---------- LZMA Decoder state ---------- */
-
-/* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case.
-   Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */
-
-#define LZMA_REQUIRED_INPUT_MAX 20
-
-typedef struct
-{
-  CLzmaProps prop;
-  CLzmaProb *probs;
-  Byte *dic;
-  const Byte *buf;
-  UInt32 range, code;
-  SizeT dicPos;
-  SizeT dicBufSize;
-  UInt32 processedPos;
-  UInt32 checkDicSize;
-  unsigned state;
-  UInt32 reps[4];
-  unsigned remainLen;
-  int needFlush;
-  int needInitState;
-  UInt32 numProbs;
-  unsigned tempBufSize;
-  Byte tempBuf[LZMA_REQUIRED_INPUT_MAX];
-} CLzmaDec;
-
-#define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; }
-
-void LzmaDec_Init(CLzmaDec *p);
-
-/* There are two types of LZMA streams:
-     0) Stream with end mark. That end mark adds about 6 bytes to compressed size.
-     1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */
-
-typedef enum
-{
-  LZMA_FINISH_ANY,   /* finish at any point */
-  LZMA_FINISH_END    /* block must be finished at the end */
-} ELzmaFinishMode;
-
-/* ELzmaFinishMode has meaning only if the decoding reaches output limit !!!
-
-   You must use LZMA_FINISH_END, when you know that current output buffer
-   covers last bytes of block. In other cases you must use LZMA_FINISH_ANY.
-
-   If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK,
-   and output value of destLen will be less than output buffer size limit.
-   You can check status result also.
-
-   You can use multiple checks to test data integrity after full decompression:
-     1) Check Result and "status" variable.
-     2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize.
-     3) Check that output(srcLen) = compressedSize, if you know real compressedSize.
-        You must use correct finish mode in that case. */
-
-typedef enum
-{
-  LZMA_STATUS_NOT_SPECIFIED,               /* use main error code instead */
-  LZMA_STATUS_FINISHED_WITH_MARK,          /* stream was finished with end mark. */
-  LZMA_STATUS_NOT_FINISHED,                /* stream was not finished */
-  LZMA_STATUS_NEEDS_MORE_INPUT,            /* you must provide more input bytes */
-  LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK  /* there is probability that stream was finished without end mark */
-} ELzmaStatus;
-
-/* ELzmaStatus is used only as output value for function call */
-
-
-/* ---------- Interfaces ---------- */
-
-/* There are 3 levels of interfaces:
-     1) Dictionary Interface
-     2) Buffer Interface
-     3) One Call Interface
-   You can select any of these interfaces, but don't mix functions from different
-   groups for same object. */
-
-
-/* There are two variants to allocate state for Dictionary Interface:
-     1) LzmaDec_Allocate / LzmaDec_Free
-     2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs
-   You can use variant 2, if you set dictionary buffer manually.
-   For Buffer Interface you must always use variant 1.
-
-LzmaDec_Allocate* can return:
-  SZ_OK
-  SZ_ERROR_MEM         - Memory allocation error
-  SZ_ERROR_UNSUPPORTED - Unsupported properties
-*/
-   
-SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc);
-void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc);
-
-SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc);
-void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc);
-
-/* ---------- Dictionary Interface ---------- */
-
-/* You can use it, if you want to eliminate the overhead for data copying from
-   dictionary to some other external buffer.
-   You must work with CLzmaDec variables directly in this interface.
-
-   STEPS:
-     LzmaDec_Constr()
-     LzmaDec_Allocate()
-     for (each new stream)
-     {
-       LzmaDec_Init()
-       while (it needs more decompression)
-       {
-         LzmaDec_DecodeToDic()
-         use data from CLzmaDec::dic and update CLzmaDec::dicPos
-       }
-     }
-     LzmaDec_Free()
-*/
-
-/* LzmaDec_DecodeToDic
-   
-   The decoding to internal dictionary buffer (CLzmaDec::dic).
-   You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!!
-
-finishMode:
-  It has meaning only if the decoding reaches output limit (dicLimit).
-  LZMA_FINISH_ANY - Decode just dicLimit bytes.
-  LZMA_FINISH_END - Stream must be finished after dicLimit.
-
-Returns:
-  SZ_OK
-    status:
-      LZMA_STATUS_FINISHED_WITH_MARK
-      LZMA_STATUS_NOT_FINISHED
-      LZMA_STATUS_NEEDS_MORE_INPUT
-      LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
-  SZ_ERROR_DATA - Data error
-*/
-
-SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit,
-    const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
-
-
-/* ---------- Buffer Interface ---------- */
-
-/* It's zlib-like interface.
-   See LzmaDec_DecodeToDic description for information about STEPS and return results,
-   but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need
-   to work with CLzmaDec variables manually.
-
-finishMode:
-  It has meaning only if the decoding reaches output limit (*destLen).
-  LZMA_FINISH_ANY - Decode just destLen bytes.
-  LZMA_FINISH_END - Stream must be finished after (*destLen).
-*/
-
-SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen,
-    const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
-
-
-/* ---------- One Call Interface ---------- */
-
-/* LzmaDecode
-
-finishMode:
-  It has meaning only if the decoding reaches output limit (*destLen).
-  LZMA_FINISH_ANY - Decode just destLen bytes.
-  LZMA_FINISH_END - Stream must be finished after (*destLen).
-
-Returns:
-  SZ_OK
-    status:
-      LZMA_STATUS_FINISHED_WITH_MARK
-      LZMA_STATUS_NOT_FINISHED
-      LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
-  SZ_ERROR_DATA - Data error
-  SZ_ERROR_MEM  - Memory allocation error
-  SZ_ERROR_UNSUPPORTED - Unsupported properties
-  SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
-*/
-
-SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
-    const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
-    ELzmaStatus *status, ISzAlloc *alloc);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/C/LzmaEnc.c b/third_party/lzma/v4_65/files/C/LzmaEnc.c
deleted file mode 100644
index 9196c43..0000000
--- a/third_party/lzma/v4_65/files/C/LzmaEnc.c
+++ /dev/null
@@ -1,2281 +0,0 @@
-/* LzmaEnc.c -- LZMA Encoder
-2009-02-02 : Igor Pavlov : Public domain */
-
-#include <string.h>
-
-/* #define SHOW_STAT */
-/* #define SHOW_STAT2 */
-
-#if defined(SHOW_STAT) || defined(SHOW_STAT2)
-#include <stdio.h>
-#endif
-
-#include "LzmaEnc.h"
-
-#include "LzFind.h"
-#ifdef COMPRESS_MF_MT
-#include "LzFindMt.h"
-#endif
-
-#ifdef SHOW_STAT
-static int ttt = 0;
-#endif
-
-#define kBlockSizeMax ((1 << LZMA_NUM_BLOCK_SIZE_BITS) - 1)
-
-#define kBlockSize (9 << 10)
-#define kUnpackBlockSize (1 << 18)
-#define kMatchArraySize (1 << 21)
-#define kMatchRecordMaxSize ((LZMA_MATCH_LEN_MAX * 2 + 3) * LZMA_MATCH_LEN_MAX)
-
-#define kNumMaxDirectBits (31)
-
-#define kNumTopBits 24
-#define kTopValue ((UInt32)1 << kNumTopBits)
-
-#define kNumBitModelTotalBits 11
-#define kBitModelTotal (1 << kNumBitModelTotalBits)
-#define kNumMoveBits 5
-#define kProbInitValue (kBitModelTotal >> 1)
-
-#define kNumMoveReducingBits 4
-#define kNumBitPriceShiftBits 4
-#define kBitPrice (1 << kNumBitPriceShiftBits)
-
-void LzmaEncProps_Init(CLzmaEncProps *p)
-{
-  p->level = 5;
-  p->dictSize = p->mc = 0;
-  p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1;
-  p->writeEndMark = 0;
-}
-
-void LzmaEncProps_Normalize(CLzmaEncProps *p)
-{
-  int level = p->level;
-  if (level < 0) level = 5;
-  p->level = level;
-  if (p->dictSize == 0) p->dictSize = (level <= 5 ? (1 << (level * 2 + 14)) : (level == 6 ? (1 << 25) : (1 << 26)));
-  if (p->lc < 0) p->lc = 3;
-  if (p->lp < 0) p->lp = 0;
-  if (p->pb < 0) p->pb = 2;
-  if (p->algo < 0) p->algo = (level < 5 ? 0 : 1);
-  if (p->fb < 0) p->fb = (level < 7 ? 32 : 64);
-  if (p->btMode < 0) p->btMode = (p->algo == 0 ? 0 : 1);
-  if (p->numHashBytes < 0) p->numHashBytes = 4;
-  if (p->mc == 0)  p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1);
-  if (p->numThreads < 0)
-    p->numThreads =
-      #ifdef COMPRESS_MF_MT
-      ((p->btMode && p->algo) ? 2 : 1);
-      #else
-      1;
-      #endif
-}
-
-UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2)
-{
-  CLzmaEncProps props = *props2;
-  LzmaEncProps_Normalize(&props);
-  return props.dictSize;
-}
-
-/* #define LZMA_LOG_BSR */
-/* Define it for Intel's CPU */
-
-
-#ifdef LZMA_LOG_BSR
-
-#define kDicLogSizeMaxCompress 30
-
-#define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); }
-
-UInt32 GetPosSlot1(UInt32 pos)
-{
-  UInt32 res;
-  BSR2_RET(pos, res);
-  return res;
-}
-#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); }
-#define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res); }
-
-#else
-
-#define kNumLogBits (9 + (int)sizeof(size_t) / 2)
-#define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7)
-
-void LzmaEnc_FastPosInit(Byte *g_FastPos)
-{
-  int c = 2, slotFast;
-  g_FastPos[0] = 0;
-  g_FastPos[1] = 1;
-  
-  for (slotFast = 2; slotFast < kNumLogBits * 2; slotFast++)
-  {
-    UInt32 k = (1 << ((slotFast >> 1) - 1));
-    UInt32 j;
-    for (j = 0; j < k; j++, c++)
-      g_FastPos[c] = (Byte)slotFast;
-  }
-}
-
-#define BSR2_RET(pos, res) { UInt32 i = 6 + ((kNumLogBits - 1) & \
-  (0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \
-  res = p->g_FastPos[pos >> i] + (i * 2); }
-/*
-#define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \
-  p->g_FastPos[pos >> 6] + 12 : \
-  p->g_FastPos[pos >> (6 + kNumLogBits - 1)] + (6 + (kNumLogBits - 1)) * 2; }
-*/
-
-#define GetPosSlot1(pos) p->g_FastPos[pos]
-#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); }
-#define GetPosSlot(pos, res) { if (pos < kNumFullDistances) res = p->g_FastPos[pos]; else BSR2_RET(pos, res); }
-
-#endif
-
-
-#define LZMA_NUM_REPS 4
-
-typedef unsigned CState;
-
-typedef struct _COptimal
-{
-  UInt32 price;
-
-  CState state;
-  int prev1IsChar;
-  int prev2;
-
-  UInt32 posPrev2;
-  UInt32 backPrev2;
-
-  UInt32 posPrev;
-  UInt32 backPrev;
-  UInt32 backs[LZMA_NUM_REPS];
-} COptimal;
-
-#define kNumOpts (1 << 12)
-
-#define kNumLenToPosStates 4
-#define kNumPosSlotBits 6
-#define kDicLogSizeMin 0
-#define kDicLogSizeMax 32
-#define kDistTableSizeMax (kDicLogSizeMax * 2)
-
-
-#define kNumAlignBits 4
-#define kAlignTableSize (1 << kNumAlignBits)
-#define kAlignMask (kAlignTableSize - 1)
-
-#define kStartPosModelIndex 4
-#define kEndPosModelIndex 14
-#define kNumPosModels (kEndPosModelIndex - kStartPosModelIndex)
-
-#define kNumFullDistances (1 << (kEndPosModelIndex / 2))
-
-#ifdef _LZMA_PROB32
-#define CLzmaProb UInt32
-#else
-#define CLzmaProb UInt16
-#endif
-
-#define LZMA_PB_MAX 4
-#define LZMA_LC_MAX 8
-#define LZMA_LP_MAX 4
-
-#define LZMA_NUM_PB_STATES_MAX (1 << LZMA_PB_MAX)
-
-
-#define kLenNumLowBits 3
-#define kLenNumLowSymbols (1 << kLenNumLowBits)
-#define kLenNumMidBits 3
-#define kLenNumMidSymbols (1 << kLenNumMidBits)
-#define kLenNumHighBits 8
-#define kLenNumHighSymbols (1 << kLenNumHighBits)
-
-#define kLenNumSymbolsTotal (kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols)
-
-#define LZMA_MATCH_LEN_MIN 2
-#define LZMA_MATCH_LEN_MAX (LZMA_MATCH_LEN_MIN + kLenNumSymbolsTotal - 1)
-
-#define kNumStates 12
-
-typedef struct
-{
-  CLzmaProb choice;
-  CLzmaProb choice2;
-  CLzmaProb low[LZMA_NUM_PB_STATES_MAX << kLenNumLowBits];
-  CLzmaProb mid[LZMA_NUM_PB_STATES_MAX << kLenNumMidBits];
-  CLzmaProb high[kLenNumHighSymbols];
-} CLenEnc;
-
-typedef struct
-{
-  CLenEnc p;
-  UInt32 prices[LZMA_NUM_PB_STATES_MAX][kLenNumSymbolsTotal];
-  UInt32 tableSize;
-  UInt32 counters[LZMA_NUM_PB_STATES_MAX];
-} CLenPriceEnc;
-
-typedef struct _CRangeEnc
-{
-  UInt32 range;
-  Byte cache;
-  UInt64 low;
-  UInt64 cacheSize;
-  Byte *buf;
-  Byte *bufLim;
-  Byte *bufBase;
-  ISeqOutStream *outStream;
-  UInt64 processed;
-  SRes res;
-} CRangeEnc;
-
-typedef struct _CSeqInStreamBuf
-{
-  ISeqInStream funcTable;
-  const Byte *data;
-  SizeT rem;
-} CSeqInStreamBuf;
-
-static SRes MyRead(void *pp, void *data, size_t *size)
-{
-  size_t curSize = *size;
-  CSeqInStreamBuf *p = (CSeqInStreamBuf *)pp;
-  if (p->rem < curSize)
-    curSize = p->rem;
-  memcpy(data, p->data, curSize);
-  p->rem -= curSize;
-  p->data += curSize;
-  *size = curSize;
-  return SZ_OK;
-}
-
-typedef struct
-{
-  CLzmaProb *litProbs;
-
-  CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX];
-  CLzmaProb isRep[kNumStates];
-  CLzmaProb isRepG0[kNumStates];
-  CLzmaProb isRepG1[kNumStates];
-  CLzmaProb isRepG2[kNumStates];
-  CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX];
-
-  CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits];
-  CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex];
-  CLzmaProb posAlignEncoder[1 << kNumAlignBits];
-  
-  CLenPriceEnc lenEnc;
-  CLenPriceEnc repLenEnc;
-
-  UInt32 reps[LZMA_NUM_REPS];
-  UInt32 state;
-} CSaveState;
-
-typedef struct _CLzmaEnc
-{
-  IMatchFinder matchFinder;
-  void *matchFinderObj;
-
-  #ifdef COMPRESS_MF_MT
-  Bool mtMode;
-  CMatchFinderMt matchFinderMt;
-  #endif
-
-  CMatchFinder matchFinderBase;
-
-  #ifdef COMPRESS_MF_MT
-  Byte pad[128];
-  #endif
-  
-  UInt32 optimumEndIndex;
-  UInt32 optimumCurrentIndex;
-
-  UInt32 longestMatchLength;
-  UInt32 numPairs;
-  UInt32 numAvail;
-  COptimal opt[kNumOpts];
-  
-  #ifndef LZMA_LOG_BSR
-  Byte g_FastPos[1 << kNumLogBits];
-  #endif
-
-  UInt32 ProbPrices[kBitModelTotal >> kNumMoveReducingBits];
-  UInt32 matches[LZMA_MATCH_LEN_MAX * 2 + 2 + 1];
-  UInt32 numFastBytes;
-  UInt32 additionalOffset;
-  UInt32 reps[LZMA_NUM_REPS];
-  UInt32 state;
-
-  UInt32 posSlotPrices[kNumLenToPosStates][kDistTableSizeMax];
-  UInt32 distancesPrices[kNumLenToPosStates][kNumFullDistances];
-  UInt32 alignPrices[kAlignTableSize];
-  UInt32 alignPriceCount;
-
-  UInt32 distTableSize;
-
-  unsigned lc, lp, pb;
-  unsigned lpMask, pbMask;
-
-  CLzmaProb *litProbs;
-
-  CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX];
-  CLzmaProb isRep[kNumStates];
-  CLzmaProb isRepG0[kNumStates];
-  CLzmaProb isRepG1[kNumStates];
-  CLzmaProb isRepG2[kNumStates];
-  CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX];
-
-  CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits];
-  CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex];
-  CLzmaProb posAlignEncoder[1 << kNumAlignBits];
-  
-  CLenPriceEnc lenEnc;
-  CLenPriceEnc repLenEnc;
-
-  unsigned lclp;
-
-  Bool fastMode;
-  
-  CRangeEnc rc;
-
-  Bool writeEndMark;
-  UInt64 nowPos64;
-  UInt32 matchPriceCount;
-  Bool finished;
-  Bool multiThread;
-
-  SRes result;
-  UInt32 dictSize;
-  UInt32 matchFinderCycles;
-
-  ISeqInStream *inStream;
-  CSeqInStreamBuf seqBufInStream;
-
-  CSaveState saveState;
-} CLzmaEnc;
-
-void LzmaEnc_SaveState(CLzmaEncHandle pp)
-{
-  CLzmaEnc *p = (CLzmaEnc *)pp;
-  CSaveState *dest = &p->saveState;
-  int i;
-  dest->lenEnc = p->lenEnc;
-  dest->repLenEnc = p->repLenEnc;
-  dest->state = p->state;
-
-  for (i = 0; i < kNumStates; i++)
-  {
-    memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i]));
-    memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i]));
-  }
-  for (i = 0; i < kNumLenToPosStates; i++)
-    memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i]));
-  memcpy(dest->isRep, p->isRep, sizeof(p->isRep));
-  memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0));
-  memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1));
-  memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2));
-  memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders));
-  memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder));
-  memcpy(dest->reps, p->reps, sizeof(p->reps));
-  memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb));
-}
-
-void LzmaEnc_RestoreState(CLzmaEncHandle pp)
-{
-  CLzmaEnc *dest = (CLzmaEnc *)pp;
-  const CSaveState *p = &dest->saveState;
-  int i;
-  dest->lenEnc = p->lenEnc;
-  dest->repLenEnc = p->repLenEnc;
-  dest->state = p->state;
-
-  for (i = 0; i < kNumStates; i++)
-  {
-    memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i]));
-    memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i]));
-  }
-  for (i = 0; i < kNumLenToPosStates; i++)
-    memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i]));
-  memcpy(dest->isRep, p->isRep, sizeof(p->isRep));
-  memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0));
-  memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1));
-  memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2));
-  memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders));
-  memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder));
-  memcpy(dest->reps, p->reps, sizeof(p->reps));
-  memcpy(dest->litProbs, p->litProbs, (0x300 << dest->lclp) * sizeof(CLzmaProb));
-}
-
-SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2)
-{
-  CLzmaEnc *p = (CLzmaEnc *)pp;
-  CLzmaEncProps props = *props2;
-  LzmaEncProps_Normalize(&props);
-
-  if (props.lc > LZMA_LC_MAX || props.lp > LZMA_LP_MAX || props.pb > LZMA_PB_MAX ||
-      props.dictSize > (1 << kDicLogSizeMaxCompress) || props.dictSize > (1 << 30))
-    return SZ_ERROR_PARAM;
-  p->dictSize = props.dictSize;
-  p->matchFinderCycles = props.mc;
-  {
-    unsigned fb = props.fb;
-    if (fb < 5)
-      fb = 5;
-    if (fb > LZMA_MATCH_LEN_MAX)
-      fb = LZMA_MATCH_LEN_MAX;
-    p->numFastBytes = fb;
-  }
-  p->lc = props.lc;
-  p->lp = props.lp;
-  p->pb = props.pb;
-  p->fastMode = (props.algo == 0);
-  p->matchFinderBase.btMode = props.btMode;
-  {
-    UInt32 numHashBytes = 4;
-    if (props.btMode)
-    {
-      if (props.numHashBytes < 2)
-        numHashBytes = 2;
-      else if (props.numHashBytes < 4)
-        numHashBytes = props.numHashBytes;
-    }
-    p->matchFinderBase.numHashBytes = numHashBytes;
-  }
-
-  p->matchFinderBase.cutValue = props.mc;
-
-  p->writeEndMark = props.writeEndMark;
-
-  #ifdef COMPRESS_MF_MT
-  /*
-  if (newMultiThread != _multiThread)
-  {
-    ReleaseMatchFinder();
-    _multiThread = newMultiThread;
-  }
-  */
-  p->multiThread = (props.numThreads > 1);
-  #endif
-
-  return SZ_OK;
-}
-
-static const int kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4,  5,  6,   4, 5};
-static const int kMatchNextStates[kNumStates]   = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10};
-static const int kRepNextStates[kNumStates]     = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11};
-static const int kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11};
-
-#define IsCharState(s) ((s) < 7)
-
-#define GetLenToPosState(len) (((len) < kNumLenToPosStates + 1) ? (len) - 2 : kNumLenToPosStates - 1)
-
-#define kInfinityPrice (1 << 30)
-
-static void RangeEnc_Construct(CRangeEnc *p)
-{
-  p->outStream = 0;
-  p->bufBase = 0;
-}
-
-#define RangeEnc_GetProcessed(p) ((p)->processed + ((p)->buf - (p)->bufBase) + (p)->cacheSize)
-
-#define RC_BUF_SIZE (1 << 16)
-static int RangeEnc_Alloc(CRangeEnc *p, ISzAlloc *alloc)
-{
-  if (p->bufBase == 0)
-  {
-    p->bufBase = (Byte *)alloc->Alloc(alloc, RC_BUF_SIZE);
-    if (p->bufBase == 0)
-      return 0;
-    p->bufLim = p->bufBase + RC_BUF_SIZE;
-  }
-  return 1;
-}
-
-static void RangeEnc_Free(CRangeEnc *p, ISzAlloc *alloc)
-{
-  alloc->Free(alloc, p->bufBase);
-  p->bufBase = 0;
-}
-
-static void RangeEnc_Init(CRangeEnc *p)
-{
-  /* Stream.Init(); */
-  p->low = 0;
-  p->range = 0xFFFFFFFF;
-  p->cacheSize = 1;
-  p->cache = 0;
-
-  p->buf = p->bufBase;
-
-  p->processed = 0;
-  p->res = SZ_OK;
-}
-
-static void RangeEnc_FlushStream(CRangeEnc *p)
-{
-  size_t num;
-  if (p->res != SZ_OK)
-    return;
-  num = p->buf - p->bufBase;
-  if (num != p->outStream->Write(p->outStream, p->bufBase, num))
-    p->res = SZ_ERROR_WRITE;
-  p->processed += num;
-  p->buf = p->bufBase;
-}
-
-static void MY_FAST_CALL RangeEnc_ShiftLow(CRangeEnc *p)
-{
-  if ((UInt32)p->low < (UInt32)0xFF000000 || (int)(p->low >> 32) != 0)
-  {
-    Byte temp = p->cache;
-    do
-    {
-      Byte *buf = p->buf;
-      *buf++ = (Byte)(temp + (Byte)(p->low >> 32));
-      p->buf = buf;
-      if (buf == p->bufLim)
-        RangeEnc_FlushStream(p);
-      temp = 0xFF;
-    }
-    while (--p->cacheSize != 0);
-    p->cache = (Byte)((UInt32)p->low >> 24);
-  }
-  p->cacheSize++;
-  p->low = (UInt32)p->low << 8;
-}
-
-static void RangeEnc_FlushData(CRangeEnc *p)
-{
-  int i;
-  for (i = 0; i < 5; i++)
-    RangeEnc_ShiftLow(p);
-}
-
-static void RangeEnc_EncodeDirectBits(CRangeEnc *p, UInt32 value, int numBits)
-{
-  do
-  {
-    p->range >>= 1;
-    p->low += p->range & (0 - ((value >> --numBits) & 1));
-    if (p->range < kTopValue)
-    {
-      p->range <<= 8;
-      RangeEnc_ShiftLow(p);
-    }
-  }
-  while (numBits != 0);
-}
-
-static void RangeEnc_EncodeBit(CRangeEnc *p, CLzmaProb *prob, UInt32 symbol)
-{
-  UInt32 ttt = *prob;
-  UInt32 newBound = (p->range >> kNumBitModelTotalBits) * ttt;
-  if (symbol == 0)
-  {
-    p->range = newBound;
-    ttt += (kBitModelTotal - ttt) >> kNumMoveBits;
-  }
-  else
-  {
-    p->low += newBound;
-    p->range -= newBound;
-    ttt -= ttt >> kNumMoveBits;
-  }
-  *prob = (CLzmaProb)ttt;
-  if (p->range < kTopValue)
-  {
-    p->range <<= 8;
-    RangeEnc_ShiftLow(p);
-  }
-}
-
-static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol)
-{
-  symbol |= 0x100;
-  do
-  {
-    RangeEnc_EncodeBit(p, probs + (symbol >> 8), (symbol >> 7) & 1);
-    symbol <<= 1;
-  }
-  while (symbol < 0x10000);
-}
-
-static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol, UInt32 matchByte)
-{
-  UInt32 offs = 0x100;
-  symbol |= 0x100;
-  do
-  {
-    matchByte <<= 1;
-    RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + (symbol >> 8)), (symbol >> 7) & 1);
-    symbol <<= 1;
-    offs &= ~(matchByte ^ symbol);
-  }
-  while (symbol < 0x10000);
-}
-
-void LzmaEnc_InitPriceTables(UInt32 *ProbPrices)
-{
-  UInt32 i;
-  for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits))
-  {
-    const int kCyclesBits = kNumBitPriceShiftBits;
-    UInt32 w = i;
-    UInt32 bitCount = 0;
-    int j;
-    for (j = 0; j < kCyclesBits; j++)
-    {
-      w = w * w;
-      bitCount <<= 1;
-      while (w >= ((UInt32)1 << 16))
-      {
-        w >>= 1;
-        bitCount++;
-      }
-    }
-    ProbPrices[i >> kNumMoveReducingBits] = ((kNumBitModelTotalBits << kCyclesBits) - 15 - bitCount);
-  }
-}
-
-
-#define GET_PRICE(prob, symbol) \
-  p->ProbPrices[((prob) ^ (((-(int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits];
-
-#define GET_PRICEa(prob, symbol) \
-  ProbPrices[((prob) ^ ((-((int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits];
-
-#define GET_PRICE_0(prob) p->ProbPrices[(prob) >> kNumMoveReducingBits]
-#define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits]
-
-#define GET_PRICE_0a(prob) ProbPrices[(prob) >> kNumMoveReducingBits]
-#define GET_PRICE_1a(prob) ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits]
-
-static UInt32 LitEnc_GetPrice(const CLzmaProb *probs, UInt32 symbol, UInt32 *ProbPrices)
-{
-  UInt32 price = 0;
-  symbol |= 0x100;
-  do
-  {
-    price += GET_PRICEa(probs[symbol >> 8], (symbol >> 7) & 1);
-    symbol <<= 1;
-  }
-  while (symbol < 0x10000);
-  return price;
-}
-
-static UInt32 LitEnc_GetPriceMatched(const CLzmaProb *probs, UInt32 symbol, UInt32 matchByte, UInt32 *ProbPrices)
-{
-  UInt32 price = 0;
-  UInt32 offs = 0x100;
-  symbol |= 0x100;
-  do
-  {
-    matchByte <<= 1;
-    price += GET_PRICEa(probs[offs + (matchByte & offs) + (symbol >> 8)], (symbol >> 7) & 1);
-    symbol <<= 1;
-    offs &= ~(matchByte ^ symbol);
-  }
-  while (symbol < 0x10000);
-  return price;
-}
-
-
-static void RcTree_Encode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol)
-{
-  UInt32 m = 1;
-  int i;
-  for (i = numBitLevels; i != 0;)
-  {
-    UInt32 bit;
-    i--;
-    bit = (symbol >> i) & 1;
-    RangeEnc_EncodeBit(rc, probs + m, bit);
-    m = (m << 1) | bit;
-  }
-}
-
-static void RcTree_ReverseEncode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol)
-{
-  UInt32 m = 1;
-  int i;
-  for (i = 0; i < numBitLevels; i++)
-  {
-    UInt32 bit = symbol & 1;
-    RangeEnc_EncodeBit(rc, probs + m, bit);
-    m = (m << 1) | bit;
-    symbol >>= 1;
-  }
-}
-
-static UInt32 RcTree_GetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices)
-{
-  UInt32 price = 0;
-  symbol |= (1 << numBitLevels);
-  while (symbol != 1)
-  {
-    price += GET_PRICEa(probs[symbol >> 1], symbol & 1);
-    symbol >>= 1;
-  }
-  return price;
-}
-
-static UInt32 RcTree_ReverseGetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices)
-{
-  UInt32 price = 0;
-  UInt32 m = 1;
-  int i;
-  for (i = numBitLevels; i != 0; i--)
-  {
-    UInt32 bit = symbol & 1;
-    symbol >>= 1;
-    price += GET_PRICEa(probs[m], bit);
-    m = (m << 1) | bit;
-  }
-  return price;
-}
-
-
-static void LenEnc_Init(CLenEnc *p)
-{
-  unsigned i;
-  p->choice = p->choice2 = kProbInitValue;
-  for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumLowBits); i++)
-    p->low[i] = kProbInitValue;
-  for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumMidBits); i++)
-    p->mid[i] = kProbInitValue;
-  for (i = 0; i < kLenNumHighSymbols; i++)
-    p->high[i] = kProbInitValue;
-}
-
-static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState)
-{
-  if (symbol < kLenNumLowSymbols)
-  {
-    RangeEnc_EncodeBit(rc, &p->choice, 0);
-    RcTree_Encode(rc, p->low + (posState << kLenNumLowBits), kLenNumLowBits, symbol);
-  }
-  else
-  {
-    RangeEnc_EncodeBit(rc, &p->choice, 1);
-    if (symbol < kLenNumLowSymbols + kLenNumMidSymbols)
-    {
-      RangeEnc_EncodeBit(rc, &p->choice2, 0);
-      RcTree_Encode(rc, p->mid + (posState << kLenNumMidBits), kLenNumMidBits, symbol - kLenNumLowSymbols);
-    }
-    else
-    {
-      RangeEnc_EncodeBit(rc, &p->choice2, 1);
-      RcTree_Encode(rc, p->high, kLenNumHighBits, symbol - kLenNumLowSymbols - kLenNumMidSymbols);
-    }
-  }
-}
-
-static void LenEnc_SetPrices(CLenEnc *p, UInt32 posState, UInt32 numSymbols, UInt32 *prices, UInt32 *ProbPrices)
-{
-  UInt32 a0 = GET_PRICE_0a(p->choice);
-  UInt32 a1 = GET_PRICE_1a(p->choice);
-  UInt32 b0 = a1 + GET_PRICE_0a(p->choice2);
-  UInt32 b1 = a1 + GET_PRICE_1a(p->choice2);
-  UInt32 i = 0;
-  for (i = 0; i < kLenNumLowSymbols; i++)
-  {
-    if (i >= numSymbols)
-      return;
-    prices[i] = a0 + RcTree_GetPrice(p->low + (posState << kLenNumLowBits), kLenNumLowBits, i, ProbPrices);
-  }
-  for (; i < kLenNumLowSymbols + kLenNumMidSymbols; i++)
-  {
-    if (i >= numSymbols)
-      return;
-    prices[i] = b0 + RcTree_GetPrice(p->mid + (posState << kLenNumMidBits), kLenNumMidBits, i - kLenNumLowSymbols, ProbPrices);
-  }
-  for (; i < numSymbols; i++)
-    prices[i] = b1 + RcTree_GetPrice(p->high, kLenNumHighBits, i - kLenNumLowSymbols - kLenNumMidSymbols, ProbPrices);
-}
-
-static void MY_FAST_CALL LenPriceEnc_UpdateTable(CLenPriceEnc *p, UInt32 posState, UInt32 *ProbPrices)
-{
-  LenEnc_SetPrices(&p->p, posState, p->tableSize, p->prices[posState], ProbPrices);
-  p->counters[posState] = p->tableSize;
-}
-
-static void LenPriceEnc_UpdateTables(CLenPriceEnc *p, UInt32 numPosStates, UInt32 *ProbPrices)
-{
-  UInt32 posState;
-  for (posState = 0; posState < numPosStates; posState++)
-    LenPriceEnc_UpdateTable(p, posState, ProbPrices);
-}
-
-static void LenEnc_Encode2(CLenPriceEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState, Bool updatePrice, UInt32 *ProbPrices)
-{
-  LenEnc_Encode(&p->p, rc, symbol, posState);
-  if (updatePrice)
-    if (--p->counters[posState] == 0)
-      LenPriceEnc_UpdateTable(p, posState, ProbPrices);
-}
-
-
-
-
-static void MovePos(CLzmaEnc *p, UInt32 num)
-{
-  #ifdef SHOW_STAT
-  ttt += num;
-  printf("\n MovePos %d", num);
-  #endif
-  if (num != 0)
-  {
-    p->additionalOffset += num;
-    p->matchFinder.Skip(p->matchFinderObj, num);
-  }
-}
-
-static UInt32 ReadMatchDistances(CLzmaEnc *p, UInt32 *numDistancePairsRes)
-{
-  UInt32 lenRes = 0, numPairs;
-  p->numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
-  numPairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matches);
-  #ifdef SHOW_STAT
-  printf("\n i = %d numPairs = %d    ", ttt, numPairs / 2);
-  ttt++;
-  {
-    UInt32 i;
-    for (i = 0; i < numPairs; i += 2)
-      printf("%2d %6d   | ", p->matches[i], p->matches[i + 1]);
-  }
-  #endif
-  if (numPairs > 0)
-  {
-    lenRes = p->matches[numPairs - 2];
-    if (lenRes == p->numFastBytes)
-    {
-      const Byte *pby = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
-      UInt32 distance = p->matches[numPairs - 1] + 1;
-      UInt32 numAvail = p->numAvail;
-      if (numAvail > LZMA_MATCH_LEN_MAX)
-        numAvail = LZMA_MATCH_LEN_MAX;
-      {
-        const Byte *pby2 = pby - distance;
-        for (; lenRes < numAvail && pby[lenRes] == pby2[lenRes]; lenRes++);
-      }
-    }
-  }
-  p->additionalOffset++;
-  *numDistancePairsRes = numPairs;
-  return lenRes;
-}
-
-
-#define MakeAsChar(p) (p)->backPrev = (UInt32)(-1); (p)->prev1IsChar = False;
-#define MakeAsShortRep(p) (p)->backPrev = 0; (p)->prev1IsChar = False;
-#define IsShortRep(p) ((p)->backPrev == 0)
-
-static UInt32 GetRepLen1Price(CLzmaEnc *p, UInt32 state, UInt32 posState)
-{
-  return
-    GET_PRICE_0(p->isRepG0[state]) +
-    GET_PRICE_0(p->isRep0Long[state][posState]);
-}
-
-static UInt32 GetPureRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 state, UInt32 posState)
-{
-  UInt32 price;
-  if (repIndex == 0)
-  {
-    price = GET_PRICE_0(p->isRepG0[state]);
-    price += GET_PRICE_1(p->isRep0Long[state][posState]);
-  }
-  else
-  {
-    price = GET_PRICE_1(p->isRepG0[state]);
-    if (repIndex == 1)
-      price += GET_PRICE_0(p->isRepG1[state]);
-    else
-    {
-      price += GET_PRICE_1(p->isRepG1[state]);
-      price += GET_PRICE(p->isRepG2[state], repIndex - 2);
-    }
-  }
-  return price;
-}
-
-static UInt32 GetRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 len, UInt32 state, UInt32 posState)
-{
-  return p->repLenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN] +
-    GetPureRepPrice(p, repIndex, state, posState);
-}
-
-static UInt32 Backward(CLzmaEnc *p, UInt32 *backRes, UInt32 cur)
-{
-  UInt32 posMem = p->opt[cur].posPrev;
-  UInt32 backMem = p->opt[cur].backPrev;
-  p->optimumEndIndex = cur;
-  do
-  {
-    if (p->opt[cur].prev1IsChar)
-    {
-      MakeAsChar(&p->opt[posMem])
-      p->opt[posMem].posPrev = posMem - 1;
-      if (p->opt[cur].prev2)
-      {
-        p->opt[posMem - 1].prev1IsChar = False;
-        p->opt[posMem - 1].posPrev = p->opt[cur].posPrev2;
-        p->opt[posMem - 1].backPrev = p->opt[cur].backPrev2;
-      }
-    }
-    {
-      UInt32 posPrev = posMem;
-      UInt32 backCur = backMem;
-      
-      backMem = p->opt[posPrev].backPrev;
-      posMem = p->opt[posPrev].posPrev;
-      
-      p->opt[posPrev].backPrev = backCur;
-      p->opt[posPrev].posPrev = cur;
-      cur = posPrev;
-    }
-  }
-  while (cur != 0);
-  *backRes = p->opt[0].backPrev;
-  p->optimumCurrentIndex  = p->opt[0].posPrev;
-  return p->optimumCurrentIndex;
-}
-
-#define LIT_PROBS(pos, prevByte) (p->litProbs + ((((pos) & p->lpMask) << p->lc) + ((prevByte) >> (8 - p->lc))) * 0x300)
-
-static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
-{
-  UInt32 numAvail, mainLen, numPairs, repMaxIndex, i, posState, lenEnd, len, cur;
-  UInt32 matchPrice, repMatchPrice, normalMatchPrice;
-  UInt32 reps[LZMA_NUM_REPS], repLens[LZMA_NUM_REPS];
-  UInt32 *matches;
-  const Byte *data;
-  Byte curByte, matchByte;
-  if (p->optimumEndIndex != p->optimumCurrentIndex)
-  {
-    const COptimal *opt = &p->opt[p->optimumCurrentIndex];
-    UInt32 lenRes = opt->posPrev - p->optimumCurrentIndex;
-    *backRes = opt->backPrev;
-    p->optimumCurrentIndex = opt->posPrev;
-    return lenRes;
-  }
-  p->optimumCurrentIndex = p->optimumEndIndex = 0;
-  
-  if (p->additionalOffset == 0)
-    mainLen = ReadMatchDistances(p, &numPairs);
-  else
-  {
-    mainLen = p->longestMatchLength;
-    numPairs = p->numPairs;
-  }
-
-  numAvail = p->numAvail;
-  if (numAvail < 2)
-  {
-    *backRes = (UInt32)(-1);
-    return 1;
-  }
-  if (numAvail > LZMA_MATCH_LEN_MAX)
-    numAvail = LZMA_MATCH_LEN_MAX;
-
-  data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
-  repMaxIndex = 0;
-  for (i = 0; i < LZMA_NUM_REPS; i++)
-  {
-    UInt32 lenTest;
-    const Byte *data2;
-    reps[i] = p->reps[i];
-    data2 = data - (reps[i] + 1);
-    if (data[0] != data2[0] || data[1] != data2[1])
-    {
-      repLens[i] = 0;
-      continue;
-    }
-    for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++);
-    repLens[i] = lenTest;
-    if (lenTest > repLens[repMaxIndex])
-      repMaxIndex = i;
-  }
-  if (repLens[repMaxIndex] >= p->numFastBytes)
-  {
-    UInt32 lenRes;
-    *backRes = repMaxIndex;
-    lenRes = repLens[repMaxIndex];
-    MovePos(p, lenRes - 1);
-    return lenRes;
-  }
-
-  matches = p->matches;
-  if (mainLen >= p->numFastBytes)
-  {
-    *backRes = matches[numPairs - 1] + LZMA_NUM_REPS;
-    MovePos(p, mainLen - 1);
-    return mainLen;
-  }
-  curByte = *data;
-  matchByte = *(data - (reps[0] + 1));
-
-  if (mainLen < 2 && curByte != matchByte && repLens[repMaxIndex] < 2)
-  {
-    *backRes = (UInt32)-1;
-    return 1;
-  }
-
-  p->opt[0].state = (CState)p->state;
-
-  posState = (position & p->pbMask);
-
-  {
-    const CLzmaProb *probs = LIT_PROBS(position, *(data - 1));
-    p->opt[1].price = GET_PRICE_0(p->isMatch[p->state][posState]) +
-        (!IsCharState(p->state) ?
-          LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) :
-          LitEnc_GetPrice(probs, curByte, p->ProbPrices));
-  }
-
-  MakeAsChar(&p->opt[1]);
-
-  matchPrice = GET_PRICE_1(p->isMatch[p->state][posState]);
-  repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[p->state]);
-
-  if (matchByte == curByte)
-  {
-    UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, p->state, posState);
-    if (shortRepPrice < p->opt[1].price)
-    {
-      p->opt[1].price = shortRepPrice;
-      MakeAsShortRep(&p->opt[1]);
-    }
-  }
-  lenEnd = ((mainLen >= repLens[repMaxIndex]) ? mainLen : repLens[repMaxIndex]);
-
-  if (lenEnd < 2)
-  {
-    *backRes = p->opt[1].backPrev;
-    return 1;
-  }
-
-  p->opt[1].posPrev = 0;
-  for (i = 0; i < LZMA_NUM_REPS; i++)
-    p->opt[0].backs[i] = reps[i];
-
-  len = lenEnd;
-  do
-    p->opt[len--].price = kInfinityPrice;
-  while (len >= 2);
-
-  for (i = 0; i < LZMA_NUM_REPS; i++)
-  {
-    UInt32 repLen = repLens[i];
-    UInt32 price;
-    if (repLen < 2)
-      continue;
-    price = repMatchPrice + GetPureRepPrice(p, i, p->state, posState);
-    do
-    {
-      UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][repLen - 2];
-      COptimal *opt = &p->opt[repLen];
-      if (curAndLenPrice < opt->price)
-      {
-        opt->price = curAndLenPrice;
-        opt->posPrev = 0;
-        opt->backPrev = i;
-        opt->prev1IsChar = False;
-      }
-    }
-    while (--repLen >= 2);
-  }
-
-  normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[p->state]);
-
-  len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2);
-  if (len <= mainLen)
-  {
-    UInt32 offs = 0;
-    while (len > matches[offs])
-      offs += 2;
-    for (; ; len++)
-    {
-      COptimal *opt;
-      UInt32 distance = matches[offs + 1];
-
-      UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN];
-      UInt32 lenToPosState = GetLenToPosState(len);
-      if (distance < kNumFullDistances)
-        curAndLenPrice += p->distancesPrices[lenToPosState][distance];
-      else
-      {
-        UInt32 slot;
-        GetPosSlot2(distance, slot);
-        curAndLenPrice += p->alignPrices[distance & kAlignMask] + p->posSlotPrices[lenToPosState][slot];
-      }
-      opt = &p->opt[len];
-      if (curAndLenPrice < opt->price)
-      {
-        opt->price = curAndLenPrice;
-        opt->posPrev = 0;
-        opt->backPrev = distance + LZMA_NUM_REPS;
-        opt->prev1IsChar = False;
-      }
-      if (len == matches[offs])
-      {
-        offs += 2;
-        if (offs == numPairs)
-          break;
-      }
-    }
-  }
-
-  cur = 0;
-
-    #ifdef SHOW_STAT2
-    if (position >= 0)
-    {
-      unsigned i;
-      printf("\n pos = %4X", position);
-      for (i = cur; i <= lenEnd; i++)
-      printf("\nprice[%4X] = %d", position - cur + i, p->opt[i].price);
-    }
-    #endif
-
-  for (;;)
-  {
-    UInt32 numAvailFull, newLen, numPairs, posPrev, state, posState, startLen;
-    UInt32 curPrice, curAnd1Price, matchPrice, repMatchPrice;
-    Bool nextIsChar;
-    Byte curByte, matchByte;
-    const Byte *data;
-    COptimal *curOpt;
-    COptimal *nextOpt;
-
-    cur++;
-    if (cur == lenEnd)
-      return Backward(p, backRes, cur);
-
-    newLen = ReadMatchDistances(p, &numPairs);
-    if (newLen >= p->numFastBytes)
-    {
-      p->numPairs = numPairs;
-      p->longestMatchLength = newLen;
-      return Backward(p, backRes, cur);
-    }
-    position++;
-    curOpt = &p->opt[cur];
-    posPrev = curOpt->posPrev;
-    if (curOpt->prev1IsChar)
-    {
-      posPrev--;
-      if (curOpt->prev2)
-      {
-        state = p->opt[curOpt->posPrev2].state;
-        if (curOpt->backPrev2 < LZMA_NUM_REPS)
-          state = kRepNextStates[state];
-        else
-          state = kMatchNextStates[state];
-      }
-      else
-        state = p->opt[posPrev].state;
-      state = kLiteralNextStates[state];
-    }
-    else
-      state = p->opt[posPrev].state;
-    if (posPrev == cur - 1)
-    {
-      if (IsShortRep(curOpt))
-        state = kShortRepNextStates[state];
-      else
-        state = kLiteralNextStates[state];
-    }
-    else
-    {
-      UInt32 pos;
-      const COptimal *prevOpt;
-      if (curOpt->prev1IsChar && curOpt->prev2)
-      {
-        posPrev = curOpt->posPrev2;
-        pos = curOpt->backPrev2;
-        state = kRepNextStates[state];
-      }
-      else
-      {
-        pos = curOpt->backPrev;
-        if (pos < LZMA_NUM_REPS)
-          state = kRepNextStates[state];
-        else
-          state = kMatchNextStates[state];
-      }
-      prevOpt = &p->opt[posPrev];
-      if (pos < LZMA_NUM_REPS)
-      {
-        UInt32 i;
-        reps[0] = prevOpt->backs[pos];
-        for (i = 1; i <= pos; i++)
-          reps[i] = prevOpt->backs[i - 1];
-        for (; i < LZMA_NUM_REPS; i++)
-          reps[i] = prevOpt->backs[i];
-      }
-      else
-      {
-        UInt32 i;
-        reps[0] = (pos - LZMA_NUM_REPS);
-        for (i = 1; i < LZMA_NUM_REPS; i++)
-          reps[i] = prevOpt->backs[i - 1];
-      }
-    }
-    curOpt->state = (CState)state;
-
-    curOpt->backs[0] = reps[0];
-    curOpt->backs[1] = reps[1];
-    curOpt->backs[2] = reps[2];
-    curOpt->backs[3] = reps[3];
-
-    curPrice = curOpt->price;
-    nextIsChar = False;
-    data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
-    curByte = *data;
-    matchByte = *(data - (reps[0] + 1));
-
-    posState = (position & p->pbMask);
-
-    curAnd1Price = curPrice + GET_PRICE_0(p->isMatch[state][posState]);
-    {
-      const CLzmaProb *probs = LIT_PROBS(position, *(data - 1));
-      curAnd1Price +=
-        (!IsCharState(state) ?
-          LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) :
-          LitEnc_GetPrice(probs, curByte, p->ProbPrices));
-    }
-
-    nextOpt = &p->opt[cur + 1];
-
-    if (curAnd1Price < nextOpt->price)
-    {
-      nextOpt->price = curAnd1Price;
-      nextOpt->posPrev = cur;
-      MakeAsChar(nextOpt);
-      nextIsChar = True;
-    }
-
-    matchPrice = curPrice + GET_PRICE_1(p->isMatch[state][posState]);
-    repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[state]);
-    
-    if (matchByte == curByte && !(nextOpt->posPrev < cur && nextOpt->backPrev == 0))
-    {
-      UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, state, posState);
-      if (shortRepPrice <= nextOpt->price)
-      {
-        nextOpt->price = shortRepPrice;
-        nextOpt->posPrev = cur;
-        MakeAsShortRep(nextOpt);
-        nextIsChar = True;
-      }
-    }
-    numAvailFull = p->numAvail;
-    {
-      UInt32 temp = kNumOpts - 1 - cur;
-      if (temp < numAvailFull)
-        numAvailFull = temp;
-    }
-
-    if (numAvailFull < 2)
-      continue;
-    numAvail = (numAvailFull <= p->numFastBytes ? numAvailFull : p->numFastBytes);
-
-    if (!nextIsChar && matchByte != curByte) /* speed optimization */
-    {
-      /* try Literal + rep0 */
-      UInt32 temp;
-      UInt32 lenTest2;
-      const Byte *data2 = data - (reps[0] + 1);
-      UInt32 limit = p->numFastBytes + 1;
-      if (limit > numAvailFull)
-        limit = numAvailFull;
-
-      for (temp = 1; temp < limit && data[temp] == data2[temp]; temp++);
-      lenTest2 = temp - 1;
-      if (lenTest2 >= 2)
-      {
-        UInt32 state2 = kLiteralNextStates[state];
-        UInt32 posStateNext = (position + 1) & p->pbMask;
-        UInt32 nextRepMatchPrice = curAnd1Price +
-            GET_PRICE_1(p->isMatch[state2][posStateNext]) +
-            GET_PRICE_1(p->isRep[state2]);
-        /* for (; lenTest2 >= 2; lenTest2--) */
-        {
-          UInt32 curAndLenPrice;
-          COptimal *opt;
-          UInt32 offset = cur + 1 + lenTest2;
-          while (lenEnd < offset)
-            p->opt[++lenEnd].price = kInfinityPrice;
-          curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);
-          opt = &p->opt[offset];
-          if (curAndLenPrice < opt->price)
-          {
-            opt->price = curAndLenPrice;
-            opt->posPrev = cur + 1;
-            opt->backPrev = 0;
-            opt->prev1IsChar = True;
-            opt->prev2 = False;
-          }
-        }
-      }
-    }
-    
-    startLen = 2; /* speed optimization */
-    {
-    UInt32 repIndex;
-    for (repIndex = 0; repIndex < LZMA_NUM_REPS; repIndex++)
-    {
-      UInt32 lenTest;
-      UInt32 lenTestTemp;
-      UInt32 price;
-      const Byte *data2 = data - (reps[repIndex] + 1);
-      if (data[0] != data2[0] || data[1] != data2[1])
-        continue;
-      for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++);
-      while (lenEnd < cur + lenTest)
-        p->opt[++lenEnd].price = kInfinityPrice;
-      lenTestTemp = lenTest;
-      price = repMatchPrice + GetPureRepPrice(p, repIndex, state, posState);
-      do
-      {
-        UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][lenTest - 2];
-        COptimal *opt = &p->opt[cur + lenTest];
-        if (curAndLenPrice < opt->price)
-        {
-          opt->price = curAndLenPrice;
-          opt->posPrev = cur;
-          opt->backPrev = repIndex;
-          opt->prev1IsChar = False;
-        }
-      }
-      while (--lenTest >= 2);
-      lenTest = lenTestTemp;
-      
-      if (repIndex == 0)
-        startLen = lenTest + 1;
-        
-      /* if (_maxMode) */
-        {
-          UInt32 lenTest2 = lenTest + 1;
-          UInt32 limit = lenTest2 + p->numFastBytes;
-          UInt32 nextRepMatchPrice;
-          if (limit > numAvailFull)
-            limit = numAvailFull;
-          for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++);
-          lenTest2 -= lenTest + 1;
-          if (lenTest2 >= 2)
-          {
-            UInt32 state2 = kRepNextStates[state];
-            UInt32 posStateNext = (position + lenTest) & p->pbMask;
-            UInt32 curAndLenCharPrice =
-                price + p->repLenEnc.prices[posState][lenTest - 2] +
-                GET_PRICE_0(p->isMatch[state2][posStateNext]) +
-                LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]),
-                    data[lenTest], data2[lenTest], p->ProbPrices);
-            state2 = kLiteralNextStates[state2];
-            posStateNext = (position + lenTest + 1) & p->pbMask;
-            nextRepMatchPrice = curAndLenCharPrice +
-                GET_PRICE_1(p->isMatch[state2][posStateNext]) +
-                GET_PRICE_1(p->isRep[state2]);
-            
-            /* for (; lenTest2 >= 2; lenTest2--) */
-            {
-              UInt32 curAndLenPrice;
-              COptimal *opt;
-              UInt32 offset = cur + lenTest + 1 + lenTest2;
-              while (lenEnd < offset)
-                p->opt[++lenEnd].price = kInfinityPrice;
-              curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);
-              opt = &p->opt[offset];
-              if (curAndLenPrice < opt->price)
-              {
-                opt->price = curAndLenPrice;
-                opt->posPrev = cur + lenTest + 1;
-                opt->backPrev = 0;
-                opt->prev1IsChar = True;
-                opt->prev2 = True;
-                opt->posPrev2 = cur;
-                opt->backPrev2 = repIndex;
-              }
-            }
-          }
-        }
-    }
-    }
-    /* for (UInt32 lenTest = 2; lenTest <= newLen; lenTest++) */
-    if (newLen > numAvail)
-    {
-      newLen = numAvail;
-      for (numPairs = 0; newLen > matches[numPairs]; numPairs += 2);
-      matches[numPairs] = newLen;
-      numPairs += 2;
-    }
-    if (newLen >= startLen)
-    {
-      UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]);
-      UInt32 offs, curBack, posSlot;
-      UInt32 lenTest;
-      while (lenEnd < cur + newLen)
-        p->opt[++lenEnd].price = kInfinityPrice;
-
-      offs = 0;
-      while (startLen > matches[offs])
-        offs += 2;
-      curBack = matches[offs + 1];
-      GetPosSlot2(curBack, posSlot);
-      for (lenTest = /*2*/ startLen; ; lenTest++)
-      {
-        UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN];
-        UInt32 lenToPosState = GetLenToPosState(lenTest);
-        COptimal *opt;
-        if (curBack < kNumFullDistances)
-          curAndLenPrice += p->distancesPrices[lenToPosState][curBack];
-        else
-          curAndLenPrice += p->posSlotPrices[lenToPosState][posSlot] + p->alignPrices[curBack & kAlignMask];
-        
-        opt = &p->opt[cur + lenTest];
-        if (curAndLenPrice < opt->price)
-        {
-          opt->price = curAndLenPrice;
-          opt->posPrev = cur;
-          opt->backPrev = curBack + LZMA_NUM_REPS;
-          opt->prev1IsChar = False;
-        }
-
-        if (/*_maxMode && */lenTest == matches[offs])
-        {
-          /* Try Match + Literal + Rep0 */
-          const Byte *data2 = data - (curBack + 1);
-          UInt32 lenTest2 = lenTest + 1;
-          UInt32 limit = lenTest2 + p->numFastBytes;
-          UInt32 nextRepMatchPrice;
-          if (limit > numAvailFull)
-            limit = numAvailFull;
-          for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++);
-          lenTest2 -= lenTest + 1;
-          if (lenTest2 >= 2)
-          {
-            UInt32 state2 = kMatchNextStates[state];
-            UInt32 posStateNext = (position + lenTest) & p->pbMask;
-            UInt32 curAndLenCharPrice = curAndLenPrice +
-                GET_PRICE_0(p->isMatch[state2][posStateNext]) +
-                LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]),
-                    data[lenTest], data2[lenTest], p->ProbPrices);
-            state2 = kLiteralNextStates[state2];
-            posStateNext = (posStateNext + 1) & p->pbMask;
-            nextRepMatchPrice = curAndLenCharPrice +
-                GET_PRICE_1(p->isMatch[state2][posStateNext]) +
-                GET_PRICE_1(p->isRep[state2]);
-            
-            /* for (; lenTest2 >= 2; lenTest2--) */
-            {
-              UInt32 offset = cur + lenTest + 1 + lenTest2;
-              UInt32 curAndLenPrice;
-              COptimal *opt;
-              while (lenEnd < offset)
-                p->opt[++lenEnd].price = kInfinityPrice;
-              curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);
-              opt = &p->opt[offset];
-              if (curAndLenPrice < opt->price)
-              {
-                opt->price = curAndLenPrice;
-                opt->posPrev = cur + lenTest + 1;
-                opt->backPrev = 0;
-                opt->prev1IsChar = True;
-                opt->prev2 = True;
-                opt->posPrev2 = cur;
-                opt->backPrev2 = curBack + LZMA_NUM_REPS;
-              }
-            }
-          }
-          offs += 2;
-          if (offs == numPairs)
-            break;
-          curBack = matches[offs + 1];
-          if (curBack >= kNumFullDistances)
-            GetPosSlot2(curBack, posSlot);
-        }
-      }
-    }
-  }
-}
-
-#define ChangePair(smallDist, bigDist) (((bigDist) >> 7) > (smallDist))
-
-static UInt32 GetOptimumFast(CLzmaEnc *p, UInt32 *backRes)
-{
-  UInt32 numAvail, mainLen, mainDist, numPairs, repIndex, repLen, i;
-  const Byte *data;
-  const UInt32 *matches;
-
-  if (p->additionalOffset == 0)
-    mainLen = ReadMatchDistances(p, &numPairs);
-  else
-  {
-    mainLen = p->longestMatchLength;
-    numPairs = p->numPairs;
-  }
-
-  numAvail = p->numAvail;
-  *backRes = (UInt32)-1;
-  if (numAvail < 2)
-    return 1;
-  if (numAvail > LZMA_MATCH_LEN_MAX)
-    numAvail = LZMA_MATCH_LEN_MAX;
-  data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
-
-  repLen = repIndex = 0;
-  for (i = 0; i < LZMA_NUM_REPS; i++)
-  {
-    UInt32 len;
-    const Byte *data2 = data - (p->reps[i] + 1);
-    if (data[0] != data2[0] || data[1] != data2[1])
-      continue;
-    for (len = 2; len < numAvail && data[len] == data2[len]; len++);
-    if (len >= p->numFastBytes)
-    {
-      *backRes = i;
-      MovePos(p, len - 1);
-      return len;
-    }
-    if (len > repLen)
-    {
-      repIndex = i;
-      repLen = len;
-    }
-  }
-
-  matches = p->matches;
-  if (mainLen >= p->numFastBytes)
-  {
-    *backRes = matches[numPairs - 1] + LZMA_NUM_REPS;
-    MovePos(p, mainLen - 1);
-    return mainLen;
-  }
-
-  mainDist = 0; /* for GCC */
-  if (mainLen >= 2)
-  {
-    mainDist = matches[numPairs - 1];
-    while (numPairs > 2 && mainLen == matches[numPairs - 4] + 1)
-    {
-      if (!ChangePair(matches[numPairs - 3], mainDist))
-        break;
-      numPairs -= 2;
-      mainLen = matches[numPairs - 2];
-      mainDist = matches[numPairs - 1];
-    }
-    if (mainLen == 2 && mainDist >= 0x80)
-      mainLen = 1;
-  }
-
-  if (repLen >= 2 && (
-        (repLen + 1 >= mainLen) ||
-        (repLen + 2 >= mainLen && mainDist >= (1 << 9)) ||
-        (repLen + 3 >= mainLen && mainDist >= (1 << 15))))
-  {
-    *backRes = repIndex;
-    MovePos(p, repLen - 1);
-    return repLen;
-  }
-  
-  if (mainLen < 2 || numAvail <= 2)
-    return 1;
-
-  p->longestMatchLength = ReadMatchDistances(p, &p->numPairs);
-  if (p->longestMatchLength >= 2)
-  {
-    UInt32 newDistance = matches[p->numPairs - 1];
-    if ((p->longestMatchLength >= mainLen && newDistance < mainDist) ||
-        (p->longestMatchLength == mainLen + 1 && !ChangePair(mainDist, newDistance)) ||
-        (p->longestMatchLength > mainLen + 1) ||
-        (p->longestMatchLength + 1 >= mainLen && mainLen >= 3 && ChangePair(newDistance, mainDist)))
-      return 1;
-  }
-  
-  data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
-  for (i = 0; i < LZMA_NUM_REPS; i++)
-  {
-    UInt32 len, limit;
-    const Byte *data2 = data - (p->reps[i] + 1);
-    if (data[0] != data2[0] || data[1] != data2[1])
-      continue;
-    limit = mainLen - 1;
-    for (len = 2; len < limit && data[len] == data2[len]; len++);
-    if (len >= limit)
-      return 1;
-  }
-  *backRes = mainDist + LZMA_NUM_REPS;
-  MovePos(p, mainLen - 2);
-  return mainLen;
-}
-
-static void WriteEndMarker(CLzmaEnc *p, UInt32 posState)
-{
-  UInt32 len;
-  RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1);
-  RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0);
-  p->state = kMatchNextStates[p->state];
-  len = LZMA_MATCH_LEN_MIN;
-  LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices);
-  RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, (1 << kNumPosSlotBits) - 1);
-  RangeEnc_EncodeDirectBits(&p->rc, (((UInt32)1 << 30) - 1) >> kNumAlignBits, 30 - kNumAlignBits);
-  RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, kAlignMask);
-}
-
-static SRes CheckErrors(CLzmaEnc *p)
-{
-  if (p->result != SZ_OK)
-    return p->result;
-  if (p->rc.res != SZ_OK)
-    p->result = SZ_ERROR_WRITE;
-  if (p->matchFinderBase.result != SZ_OK)
-    p->result = SZ_ERROR_READ;
-  if (p->result != SZ_OK)
-    p->finished = True;
-  return p->result;
-}
-
-static SRes Flush(CLzmaEnc *p, UInt32 nowPos)
-{
-  /* ReleaseMFStream(); */
-  p->finished = True;
-  if (p->writeEndMark)
-    WriteEndMarker(p, nowPos & p->pbMask);
-  RangeEnc_FlushData(&p->rc);
-  RangeEnc_FlushStream(&p->rc);
-  return CheckErrors(p);
-}
-
-static void FillAlignPrices(CLzmaEnc *p)
-{
-  UInt32 i;
-  for (i = 0; i < kAlignTableSize; i++)
-    p->alignPrices[i] = RcTree_ReverseGetPrice(p->posAlignEncoder, kNumAlignBits, i, p->ProbPrices);
-  p->alignPriceCount = 0;
-}
-
-static void FillDistancesPrices(CLzmaEnc *p)
-{
-  UInt32 tempPrices[kNumFullDistances];
-  UInt32 i, lenToPosState;
-  for (i = kStartPosModelIndex; i < kNumFullDistances; i++)
-  {
-    UInt32 posSlot = GetPosSlot1(i);
-    UInt32 footerBits = ((posSlot >> 1) - 1);
-    UInt32 base = ((2 | (posSlot & 1)) << footerBits);
-    tempPrices[i] = RcTree_ReverseGetPrice(p->posEncoders + base - posSlot - 1, footerBits, i - base, p->ProbPrices);
-  }
-
-  for (lenToPosState = 0; lenToPosState < kNumLenToPosStates; lenToPosState++)
-  {
-    UInt32 posSlot;
-    const CLzmaProb *encoder = p->posSlotEncoder[lenToPosState];
-    UInt32 *posSlotPrices = p->posSlotPrices[lenToPosState];
-    for (posSlot = 0; posSlot < p->distTableSize; posSlot++)
-      posSlotPrices[posSlot] = RcTree_GetPrice(encoder, kNumPosSlotBits, posSlot, p->ProbPrices);
-    for (posSlot = kEndPosModelIndex; posSlot < p->distTableSize; posSlot++)
-      posSlotPrices[posSlot] += ((((posSlot >> 1) - 1) - kNumAlignBits) << kNumBitPriceShiftBits);
-
-    {
-      UInt32 *distancesPrices = p->distancesPrices[lenToPosState];
-      UInt32 i;
-      for (i = 0; i < kStartPosModelIndex; i++)
-        distancesPrices[i] = posSlotPrices[i];
-      for (; i < kNumFullDistances; i++)
-        distancesPrices[i] = posSlotPrices[GetPosSlot1(i)] + tempPrices[i];
-    }
-  }
-  p->matchPriceCount = 0;
-}
-
-void LzmaEnc_Construct(CLzmaEnc *p)
-{
-  RangeEnc_Construct(&p->rc);
-  MatchFinder_Construct(&p->matchFinderBase);
-  #ifdef COMPRESS_MF_MT
-  MatchFinderMt_Construct(&p->matchFinderMt);
-  p->matchFinderMt.MatchFinder = &p->matchFinderBase;
-  #endif
-
-  {
-    CLzmaEncProps props;
-    LzmaEncProps_Init(&props);
-    LzmaEnc_SetProps(p, &props);
-  }
-
-  #ifndef LZMA_LOG_BSR
-  LzmaEnc_FastPosInit(p->g_FastPos);
-  #endif
-
-  LzmaEnc_InitPriceTables(p->ProbPrices);
-  p->litProbs = 0;
-  p->saveState.litProbs = 0;
-}
-
-CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc)
-{
-  void *p;
-  p = alloc->Alloc(alloc, sizeof(CLzmaEnc));
-  if (p != 0)
-    LzmaEnc_Construct((CLzmaEnc *)p);
-  return p;
-}
-
-void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc)
-{
-  alloc->Free(alloc, p->litProbs);
-  alloc->Free(alloc, p->saveState.litProbs);
-  p->litProbs = 0;
-  p->saveState.litProbs = 0;
-}
-
-void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig)
-{
-  #ifdef COMPRESS_MF_MT
-  MatchFinderMt_Destruct(&p->matchFinderMt, allocBig);
-  #endif
-  MatchFinder_Free(&p->matchFinderBase, allocBig);
-  LzmaEnc_FreeLits(p, alloc);
-  RangeEnc_Free(&p->rc, alloc);
-}
-
-void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig)
-{
-  LzmaEnc_Destruct((CLzmaEnc *)p, alloc, allocBig);
-  alloc->Free(alloc, p);
-}
-
-static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize, UInt32 maxUnpackSize)
-{
-  UInt32 nowPos32, startPos32;
-  if (p->inStream != 0)
-  {
-    p->matchFinderBase.stream = p->inStream;
-    p->matchFinder.Init(p->matchFinderObj);
-    p->inStream = 0;
-  }
-
-  if (p->finished)
-    return p->result;
-  RINOK(CheckErrors(p));
-
-  nowPos32 = (UInt32)p->nowPos64;
-  startPos32 = nowPos32;
-
-  if (p->nowPos64 == 0)
-  {
-    UInt32 numPairs;
-    Byte curByte;
-    if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0)
-      return Flush(p, nowPos32);
-    ReadMatchDistances(p, &numPairs);
-    RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][0], 0);
-    p->state = kLiteralNextStates[p->state];
-    curByte = p->matchFinder.GetIndexByte(p->matchFinderObj, 0 - p->additionalOffset);
-    LitEnc_Encode(&p->rc, p->litProbs, curByte);
-    p->additionalOffset--;
-    nowPos32++;
-  }
-
-  if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) != 0)
-  for (;;)
-  {
-    UInt32 pos, len, posState;
-
-    if (p->fastMode)
-      len = GetOptimumFast(p, &pos);
-    else
-      len = GetOptimum(p, nowPos32, &pos);
-
-    #ifdef SHOW_STAT2
-    printf("\n pos = %4X,   len = %d   pos = %d", nowPos32, len, pos);
-    #endif
-
-    posState = nowPos32 & p->pbMask;
-    if (len == 1 && pos == (UInt32)-1)
-    {
-      Byte curByte;
-      CLzmaProb *probs;
-      const Byte *data;
-
-      RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 0);
-      data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
-      curByte = *data;
-      probs = LIT_PROBS(nowPos32, *(data - 1));
-      if (IsCharState(p->state))
-        LitEnc_Encode(&p->rc, probs, curByte);
-      else
-        LitEnc_EncodeMatched(&p->rc, probs, curByte, *(data - p->reps[0] - 1));
-      p->state = kLiteralNextStates[p->state];
-    }
-    else
-    {
-      RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1);
-      if (pos < LZMA_NUM_REPS)
-      {
-        RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 1);
-        if (pos == 0)
-        {
-          RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 0);
-          RangeEnc_EncodeBit(&p->rc, &p->isRep0Long[p->state][posState], ((len == 1) ? 0 : 1));
-        }
-        else
-        {
-          UInt32 distance = p->reps[pos];
-          RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 1);
-          if (pos == 1)
-            RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 0);
-          else
-          {
-            RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 1);
-            RangeEnc_EncodeBit(&p->rc, &p->isRepG2[p->state], pos - 2);
-            if (pos == 3)
-              p->reps[3] = p->reps[2];
-            p->reps[2] = p->reps[1];
-          }
-          p->reps[1] = p->reps[0];
-          p->reps[0] = distance;
-        }
-        if (len == 1)
-          p->state = kShortRepNextStates[p->state];
-        else
-        {
-          LenEnc_Encode2(&p->repLenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices);
-          p->state = kRepNextStates[p->state];
-        }
-      }
-      else
-      {
-        UInt32 posSlot;
-        RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0);
-        p->state = kMatchNextStates[p->state];
-        LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices);
-        pos -= LZMA_NUM_REPS;
-        GetPosSlot(pos, posSlot);
-        RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, posSlot);
-        
-        if (posSlot >= kStartPosModelIndex)
-        {
-          UInt32 footerBits = ((posSlot >> 1) - 1);
-          UInt32 base = ((2 | (posSlot & 1)) << footerBits);
-          UInt32 posReduced = pos - base;
-
-          if (posSlot < kEndPosModelIndex)
-            RcTree_ReverseEncode(&p->rc, p->posEncoders + base - posSlot - 1, footerBits, posReduced);
-          else
-          {
-            RangeEnc_EncodeDirectBits(&p->rc, posReduced >> kNumAlignBits, footerBits - kNumAlignBits);
-            RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, posReduced & kAlignMask);
-            p->alignPriceCount++;
-          }
-        }
-        p->reps[3] = p->reps[2];
-        p->reps[2] = p->reps[1];
-        p->reps[1] = p->reps[0];
-        p->reps[0] = pos;
-        p->matchPriceCount++;
-      }
-    }
-    p->additionalOffset -= len;
-    nowPos32 += len;
-    if (p->additionalOffset == 0)
-    {
-      UInt32 processed;
-      if (!p->fastMode)
-      {
-        if (p->matchPriceCount >= (1 << 7))
-          FillDistancesPrices(p);
-        if (p->alignPriceCount >= kAlignTableSize)
-          FillAlignPrices(p);
-      }
-      if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0)
-        break;
-      processed = nowPos32 - startPos32;
-      if (useLimits)
-      {
-        if (processed + kNumOpts + 300 >= maxUnpackSize ||
-            RangeEnc_GetProcessed(&p->rc) + kNumOpts * 2 >= maxPackSize)
-          break;
-      }
-      else if (processed >= (1 << 15))
-      {
-        p->nowPos64 += nowPos32 - startPos32;
-        return CheckErrors(p);
-      }
-    }
-  }
-  p->nowPos64 += nowPos32 - startPos32;
-  return Flush(p, nowPos32);
-}
-
-#define kBigHashDicLimit ((UInt32)1 << 24)
-
-static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)
-{
-  UInt32 beforeSize = kNumOpts;
-  Bool btMode;
-  if (!RangeEnc_Alloc(&p->rc, alloc))
-    return SZ_ERROR_MEM;
-  btMode = (p->matchFinderBase.btMode != 0);
-  #ifdef COMPRESS_MF_MT
-  p->mtMode = (p->multiThread && !p->fastMode && btMode);
-  #endif
-
-  {
-    unsigned lclp = p->lc + p->lp;
-    if (p->litProbs == 0 || p->saveState.litProbs == 0 || p->lclp != lclp)
-    {
-      LzmaEnc_FreeLits(p, alloc);
-      p->litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb));
-      p->saveState.litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb));
-      if (p->litProbs == 0 || p->saveState.litProbs == 0)
-      {
-        LzmaEnc_FreeLits(p, alloc);
-        return SZ_ERROR_MEM;
-      }
-      p->lclp = lclp;
-    }
-  }
-
-  p->matchFinderBase.bigHash = (p->dictSize > kBigHashDicLimit);
-
-  if (beforeSize + p->dictSize < keepWindowSize)
-    beforeSize = keepWindowSize - p->dictSize;
-
-  #ifdef COMPRESS_MF_MT
-  if (p->mtMode)
-  {
-    RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig));
-    p->matchFinderObj = &p->matchFinderMt;
-    MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder);
-  }
-  else
-  #endif
-  {
-    if (!MatchFinder_Create(&p->matchFinderBase, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig))
-      return SZ_ERROR_MEM;
-    p->matchFinderObj = &p->matchFinderBase;
-    MatchFinder_CreateVTable(&p->matchFinderBase, &p->matchFinder);
-  }
-  return SZ_OK;
-}
-
-void LzmaEnc_Init(CLzmaEnc *p)
-{
-  UInt32 i;
-  p->state = 0;
-  for (i = 0 ; i < LZMA_NUM_REPS; i++)
-    p->reps[i] = 0;
-
-  RangeEnc_Init(&p->rc);
-
-
-  for (i = 0; i < kNumStates; i++)
-  {
-    UInt32 j;
-    for (j = 0; j < LZMA_NUM_PB_STATES_MAX; j++)
-    {
-      p->isMatch[i][j] = kProbInitValue;
-      p->isRep0Long[i][j] = kProbInitValue;
-    }
-    p->isRep[i] = kProbInitValue;
-    p->isRepG0[i] = kProbInitValue;
-    p->isRepG1[i] = kProbInitValue;
-    p->isRepG2[i] = kProbInitValue;
-  }
-
-  {
-    UInt32 num = 0x300 << (p->lp + p->lc);
-    for (i = 0; i < num; i++)
-      p->litProbs[i] = kProbInitValue;
-  }
-
-  {
-    for (i = 0; i < kNumLenToPosStates; i++)
-    {
-      CLzmaProb *probs = p->posSlotEncoder[i];
-      UInt32 j;
-      for (j = 0; j < (1 << kNumPosSlotBits); j++)
-        probs[j] = kProbInitValue;
-    }
-  }
-  {
-    for (i = 0; i < kNumFullDistances - kEndPosModelIndex; i++)
-      p->posEncoders[i] = kProbInitValue;
-  }
-
-  LenEnc_Init(&p->lenEnc.p);
-  LenEnc_Init(&p->repLenEnc.p);
-
-  for (i = 0; i < (1 << kNumAlignBits); i++)
-    p->posAlignEncoder[i] = kProbInitValue;
-
-  p->optimumEndIndex = 0;
-  p->optimumCurrentIndex = 0;
-  p->additionalOffset = 0;
-
-  p->pbMask = (1 << p->pb) - 1;
-  p->lpMask = (1 << p->lp) - 1;
-}
-
-void LzmaEnc_InitPrices(CLzmaEnc *p)
-{
-  if (!p->fastMode)
-  {
-    FillDistancesPrices(p);
-    FillAlignPrices(p);
-  }
-
-  p->lenEnc.tableSize =
-  p->repLenEnc.tableSize =
-      p->numFastBytes + 1 - LZMA_MATCH_LEN_MIN;
-  LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, p->ProbPrices);
-  LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, p->ProbPrices);
-}
-
-static SRes LzmaEnc_AllocAndInit(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)
-{
-  UInt32 i;
-  for (i = 0; i < (UInt32)kDicLogSizeMaxCompress; i++)
-    if (p->dictSize <= ((UInt32)1 << i))
-      break;
-  p->distTableSize = i * 2;
-
-  p->finished = False;
-  p->result = SZ_OK;
-  RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig));
-  LzmaEnc_Init(p);
-  LzmaEnc_InitPrices(p);
-  p->nowPos64 = 0;
-  return SZ_OK;
-}
-
-static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqInStream *inStream, ISeqOutStream *outStream,
-    ISzAlloc *alloc, ISzAlloc *allocBig)
-{
-  CLzmaEnc *p = (CLzmaEnc *)pp;
-  p->inStream = inStream;
-  p->rc.outStream = outStream;
-  return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig);
-}
-
-SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp,
-    ISeqInStream *inStream, UInt32 keepWindowSize,
-    ISzAlloc *alloc, ISzAlloc *allocBig)
-{
-  CLzmaEnc *p = (CLzmaEnc *)pp;
-  p->inStream = inStream;
-  return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
-}
-
-static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen)
-{
-  p->seqBufInStream.funcTable.Read = MyRead;
-  p->seqBufInStream.data = src;
-  p->seqBufInStream.rem = srcLen;
-}
-
-SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen,
-    UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)
-{
-  CLzmaEnc *p = (CLzmaEnc *)pp;
-  LzmaEnc_SetInputBuf(p, src, srcLen);
-  p->inStream = &p->seqBufInStream.funcTable;
-  return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
-}
-
-void LzmaEnc_Finish(CLzmaEncHandle pp)
-{
-  #ifdef COMPRESS_MF_MT
-  CLzmaEnc *p = (CLzmaEnc *)pp;
-  if (p->mtMode)
-    MatchFinderMt_ReleaseStream(&p->matchFinderMt);
-  #else
-  pp = pp;
-  #endif
-}
-
-typedef struct _CSeqOutStreamBuf
-{
-  ISeqOutStream funcTable;
-  Byte *data;
-  SizeT rem;
-  Bool overflow;
-} CSeqOutStreamBuf;
-
-static size_t MyWrite(void *pp, const void *data, size_t size)
-{
-  CSeqOutStreamBuf *p = (CSeqOutStreamBuf *)pp;
-  if (p->rem < size)
-  {
-    size = p->rem;
-    p->overflow = True;
-  }
-  memcpy(p->data, data, size);
-  p->rem -= size;
-  p->data += size;
-  return size;
-}
-
-
-UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp)
-{
-  const CLzmaEnc *p = (CLzmaEnc *)pp;
-  return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
-}
-
-const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp)
-{
-  const CLzmaEnc *p = (CLzmaEnc *)pp;
-  return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
-}
-
-SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit,
-    Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize)
-{
-  CLzmaEnc *p = (CLzmaEnc *)pp;
-  UInt64 nowPos64;
-  SRes res;
-  CSeqOutStreamBuf outStream;
-
-  outStream.funcTable.Write = MyWrite;
-  outStream.data = dest;
-  outStream.rem = *destLen;
-  outStream.overflow = False;
-
-  p->writeEndMark = False;
-  p->finished = False;
-  p->result = SZ_OK;
-
-  if (reInit)
-    LzmaEnc_Init(p);
-  LzmaEnc_InitPrices(p);
-  nowPos64 = p->nowPos64;
-  RangeEnc_Init(&p->rc);
-  p->rc.outStream = &outStream.funcTable;
-
-  res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize);
-  
-  *unpackSize = (UInt32)(p->nowPos64 - nowPos64);
-  *destLen -= outStream.rem;
-  if (outStream.overflow)
-    return SZ_ERROR_OUTPUT_EOF;
-
-  return res;
-}
-
-SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress,
-    ISzAlloc *alloc, ISzAlloc *allocBig)
-{
-  CLzmaEnc *p = (CLzmaEnc *)pp;
-  SRes res = SZ_OK;
-
-  #ifdef COMPRESS_MF_MT
-  Byte allocaDummy[0x300];
-  int i = 0;
-  for (i = 0; i < 16; i++)
-    allocaDummy[i] = (Byte)i;
-  #endif
-
-  RINOK(LzmaEnc_Prepare(pp, inStream, outStream, alloc, allocBig));
-
-  for (;;)
-  {
-    res = LzmaEnc_CodeOneBlock(p, False, 0, 0);
-    if (res != SZ_OK || p->finished != 0)
-      break;
-    if (progress != 0)
-    {
-      res = progress->Progress(progress, p->nowPos64, RangeEnc_GetProcessed(&p->rc));
-      if (res != SZ_OK)
-      {
-        res = SZ_ERROR_PROGRESS;
-        break;
-      }
-    }
-  }
-  LzmaEnc_Finish(pp);
-  return res;
-}
-
-SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size)
-{
-  CLzmaEnc *p = (CLzmaEnc *)pp;
-  int i;
-  UInt32 dictSize = p->dictSize;
-  if (*size < LZMA_PROPS_SIZE)
-    return SZ_ERROR_PARAM;
-  *size = LZMA_PROPS_SIZE;
-  props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc);
-
-  for (i = 11; i <= 30; i++)
-  {
-    if (dictSize <= ((UInt32)2 << i))
-    {
-      dictSize = (2 << i);
-      break;
-    }
-    if (dictSize <= ((UInt32)3 << i))
-    {
-      dictSize = (3 << i);
-      break;
-    }
-  }
-
-  for (i = 0; i < 4; i++)
-    props[1 + i] = (Byte)(dictSize >> (8 * i));
-  return SZ_OK;
-}
-
-SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
-    int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig)
-{
-  SRes res;
-  CLzmaEnc *p = (CLzmaEnc *)pp;
-
-  CSeqOutStreamBuf outStream;
-
-  LzmaEnc_SetInputBuf(p, src, srcLen);
-
-  outStream.funcTable.Write = MyWrite;
-  outStream.data = dest;
-  outStream.rem = *destLen;
-  outStream.overflow = False;
-
-  p->writeEndMark = writeEndMark;
-  res = LzmaEnc_Encode(pp, &outStream.funcTable, &p->seqBufInStream.funcTable,
-      progress, alloc, allocBig);
-
-  *destLen -= outStream.rem;
-  if (outStream.overflow)
-    return SZ_ERROR_OUTPUT_EOF;
-  return res;
-}
-
-SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
-    const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
-    ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig)
-{
-  CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc);
-  SRes res;
-  if (p == 0)
-    return SZ_ERROR_MEM;
-
-  res = LzmaEnc_SetProps(p, props);
-  if (res == SZ_OK)
-  {
-    res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize);
-    if (res == SZ_OK)
-      res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen,
-          writeEndMark, progress, alloc, allocBig);
-  }
-
-  LzmaEnc_Destroy(p, alloc, allocBig);
-  return res;
-}
diff --git a/third_party/lzma/v4_65/files/C/LzmaEnc.h b/third_party/lzma/v4_65/files/C/LzmaEnc.h
deleted file mode 100644
index bfbc7d2..0000000
--- a/third_party/lzma/v4_65/files/C/LzmaEnc.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*  LzmaEnc.h -- LZMA Encoder
-2008-10-04 : Igor Pavlov : Public domain */
-
-#ifndef __LZMAENC_H
-#define __LZMAENC_H
-
-#include "Types.h"
-
-#define LZMA_PROPS_SIZE 5
-
-typedef struct _CLzmaEncProps
-{
-  int level;       /*  0 <= level <= 9 */
-  UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version
-                      (1 << 12) <= dictSize <= (1 << 30) for 64-bit version
-                       default = (1 << 24) */
-  int lc;          /* 0 <= lc <= 8, default = 3 */
-  int lp;          /* 0 <= lp <= 4, default = 0 */
-  int pb;          /* 0 <= pb <= 4, default = 2 */
-  int algo;        /* 0 - fast, 1 - normal, default = 1 */
-  int fb;          /* 5 <= fb <= 273, default = 32 */
-  int btMode;      /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */
-  int numHashBytes; /* 2, 3 or 4, default = 4 */
-  UInt32 mc;        /* 1 <= mc <= (1 << 30), default = 32 */
-  unsigned writeEndMark;  /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */
-  int numThreads;  /* 1 or 2, default = 2 */
-} CLzmaEncProps;
-
-void LzmaEncProps_Init(CLzmaEncProps *p);
-void LzmaEncProps_Normalize(CLzmaEncProps *p);
-UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2);
-
-
-/* ---------- CLzmaEncHandle Interface ---------- */
-
-/* LzmaEnc_* functions can return the following exit codes:
-Returns:
-  SZ_OK           - OK
-  SZ_ERROR_MEM    - Memory allocation error
-  SZ_ERROR_PARAM  - Incorrect paramater in props
-  SZ_ERROR_WRITE  - Write callback error.
-  SZ_ERROR_PROGRESS - some break from progress callback
-  SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
-*/
-
-typedef void * CLzmaEncHandle;
-
-CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc);
-void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig);
-SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props);
-SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size);
-SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream,
-    ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
-SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
-    int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
-
-/* ---------- One Call Interface ---------- */
-
-/* LzmaEncode
-Return code:
-  SZ_OK               - OK
-  SZ_ERROR_MEM        - Memory allocation error
-  SZ_ERROR_PARAM      - Incorrect paramater
-  SZ_ERROR_OUTPUT_EOF - output buffer overflow
-  SZ_ERROR_THREAD     - errors in multithreading functions (only for Mt version)
-*/
-
-SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
-    const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
-    ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/C/LzmaLib.c b/third_party/lzma/v4_65/files/C/LzmaLib.c
deleted file mode 100644
index 02a5118..0000000
--- a/third_party/lzma/v4_65/files/C/LzmaLib.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* LzmaLib.c -- LZMA library wrapper
-2008-08-05
-Igor Pavlov
-Public domain */
-
-#include "LzmaEnc.h"
-#include "LzmaDec.h"
-#include "Alloc.h"
-#include "LzmaLib.h"
-
-static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); }
-static void SzFree(void *p, void *address) { p = p; MyFree(address); }
-static ISzAlloc g_Alloc = { SzAlloc, SzFree };
-
-MY_STDAPI LzmaCompress(unsigned char *dest, size_t  *destLen, const unsigned char *src, size_t  srcLen,
-  unsigned char *outProps, size_t *outPropsSize,
-  int level, /* 0 <= level <= 9, default = 5 */
-  unsigned dictSize, /* use (1 << N) or (3 << N). 4 KB < dictSize <= 128 MB */
-  int lc, /* 0 <= lc <= 8, default = 3  */
-  int lp, /* 0 <= lp <= 4, default = 0  */
-  int pb, /* 0 <= pb <= 4, default = 2  */
-  int fb,  /* 5 <= fb <= 273, default = 32 */
-  int numThreads /* 1 or 2, default = 2 */
-)
-{
-  CLzmaEncProps props;
-  LzmaEncProps_Init(&props);
-  props.level = level;
-  props.dictSize = dictSize;
-  props.lc = lc;
-  props.lp = lp;
-  props.pb = pb;
-  props.fb = fb;
-  props.numThreads = numThreads;
-
-  return LzmaEncode(dest, destLen, src, srcLen, &props, outProps, outPropsSize, 0,
-      NULL, &g_Alloc, &g_Alloc);
-}
-
-
-MY_STDAPI LzmaUncompress(unsigned char *dest, size_t  *destLen, const unsigned char *src, size_t  *srcLen,
-  const unsigned char *props, size_t propsSize)
-{
-  ELzmaStatus status;
-  return LzmaDecode(dest, destLen, src, srcLen, props, (unsigned)propsSize, LZMA_FINISH_ANY, &status, &g_Alloc);
-}
diff --git a/third_party/lzma/v4_65/files/C/LzmaLib.h b/third_party/lzma/v4_65/files/C/LzmaLib.h
deleted file mode 100644
index 5c9eeec..0000000
--- a/third_party/lzma/v4_65/files/C/LzmaLib.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* LzmaLib.h -- LZMA library interface
-2008-08-05
-Igor Pavlov
-Public domain */
-
-#ifndef __LZMALIB_H
-#define __LZMALIB_H
-
-#include "Types.h"
-
-#ifdef __cplusplus
-  #define MY_EXTERN_C extern "C"
-#else
-  #define MY_EXTERN_C extern
-#endif
-
-#define MY_STDAPI MY_EXTERN_C int MY_STD_CALL
-
-#define LZMA_PROPS_SIZE 5
-
-/*
-RAM requirements for LZMA:
-  for compression:   (dictSize * 11.5 + 6 MB) + state_size
-  for decompression: dictSize + state_size
-    state_size = (4 + (1.5 << (lc + lp))) KB
-    by default (lc=3, lp=0), state_size = 16 KB.
-
-LZMA properties (5 bytes) format
-    Offset Size  Description
-      0     1    lc, lp and pb in encoded form.
-      1     4    dictSize (little endian).
-*/
-
-/*
-LzmaCompress
-------------
-
-outPropsSize -
-     In:  the pointer to the size of outProps buffer; *outPropsSize = LZMA_PROPS_SIZE = 5.
-     Out: the pointer to the size of written properties in outProps buffer; *outPropsSize = LZMA_PROPS_SIZE = 5.
-
-  LZMA Encoder will use defult values for any parameter, if it is
-  -1  for any from: level, loc, lp, pb, fb, numThreads
-   0  for dictSize
-  
-level - compression level: 0 <= level <= 9;
-
-  level dictSize algo  fb
-    0:    16 KB   0    32
-    1:    64 KB   0    32
-    2:   256 KB   0    32
-    3:     1 MB   0    32
-    4:     4 MB   0    32
-    5:    16 MB   1    32
-    6:    32 MB   1    32
-    7+:   64 MB   1    64
- 
-  The default value for "level" is 5.
-
-  algo = 0 means fast method
-  algo = 1 means normal method
-
-dictSize - The dictionary size in bytes. The maximum value is
-        128 MB = (1 << 27) bytes for 32-bit version
-          1 GB = (1 << 30) bytes for 64-bit version
-     The default value is 16 MB = (1 << 24) bytes.
-     It's recommended to use the dictionary that is larger than 4 KB and
-     that can be calculated as (1 << N) or (3 << N) sizes.
-
-lc - The number of literal context bits (high bits of previous literal).
-     It can be in the range from 0 to 8. The default value is 3.
-     Sometimes lc=4 gives the gain for big files.
-
-lp - The number of literal pos bits (low bits of current position for literals).
-     It can be in the range from 0 to 4. The default value is 0.
-     The lp switch is intended for periodical data when the period is equal to 2^lp.
-     For example, for 32-bit (4 bytes) periodical data you can use lp=2. Often it's
-     better to set lc=0, if you change lp switch.
-
-pb - The number of pos bits (low bits of current position).
-     It can be in the range from 0 to 4. The default value is 2.
-     The pb switch is intended for periodical data when the period is equal 2^pb.
-
-fb - Word size (the number of fast bytes).
-     It can be in the range from 5 to 273. The default value is 32.
-     Usually, a big number gives a little bit better compression ratio and
-     slower compression process.
-
-numThreads - The number of thereads. 1 or 2. The default value is 2.
-     Fast mode (algo = 0) can use only 1 thread.
-
-Out:
-  destLen  - processed output size
-Returns:
-  SZ_OK               - OK
-  SZ_ERROR_MEM        - Memory allocation error
-  SZ_ERROR_PARAM      - Incorrect paramater
-  SZ_ERROR_OUTPUT_EOF - output buffer overflow
-  SZ_ERROR_THREAD     - errors in multithreading functions (only for Mt version)
-*/
-
-MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
-  unsigned char *outProps, size_t *outPropsSize, /* *outPropsSize must be = 5 */
-  int level,      /* 0 <= level <= 9, default = 5 */
-  unsigned dictSize,  /* default = (1 << 24) */
-  int lc,        /* 0 <= lc <= 8, default = 3  */
-  int lp,        /* 0 <= lp <= 4, default = 0  */
-  int pb,        /* 0 <= pb <= 4, default = 2  */
-  int fb,        /* 5 <= fb <= 273, default = 32 */
-  int numThreads /* 1 or 2, default = 2 */
-  );
-
-/*
-LzmaUncompress
---------------
-In:
-  dest     - output data
-  destLen  - output data size
-  src      - input data
-  srcLen   - input data size
-Out:
-  destLen  - processed output size
-  srcLen   - processed input size
-Returns:
-  SZ_OK                - OK
-  SZ_ERROR_DATA        - Data error
-  SZ_ERROR_MEM         - Memory allocation arror
-  SZ_ERROR_UNSUPPORTED - Unsupported properties
-  SZ_ERROR_INPUT_EOF   - it needs more bytes in input buffer (src)
-*/
-
-MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, SizeT *srcLen,
-  const unsigned char *props, size_t propsSize);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/C/LzmaLib/LzmaLib.def b/third_party/lzma/v4_65/files/C/LzmaLib/LzmaLib.def
deleted file mode 100644
index 8bc6add..0000000
--- a/third_party/lzma/v4_65/files/C/LzmaLib/LzmaLib.def
+++ /dev/null
@@ -1,4 +0,0 @@
-EXPORTS
-  LzmaCompress
-  LzmaUncompress
-
diff --git a/third_party/lzma/v4_65/files/C/LzmaLib/LzmaLib.dsp b/third_party/lzma/v4_65/files/C/LzmaLib/LzmaLib.dsp
deleted file mode 100644
index 3ba6d25..0000000
--- a/third_party/lzma/v4_65/files/C/LzmaLib/LzmaLib.dsp
+++ /dev/null
@@ -1,178 +0,0 @@
-# Microsoft Developer Studio Project File - Name="LzmaLib" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=LzmaLib - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "LzmaLib.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "LzmaLib.mak" CFG="LzmaLib - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "LzmaLib - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "LzmaLib - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "LzmaLib - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMALIB_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /Gr /MT /W3 /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMALIB_EXPORTS" /D "COMPRESS_MF_MT" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x419 /d "NDEBUG"
-# ADD RSC /l 0x419 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Util\LZMA.dll" /opt:NOWIN98
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF  "$(CFG)" == "LzmaLib - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMALIB_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMALIB_EXPORTS" /D "COMPRESS_MF_MT" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x419 /d "_DEBUG"
-# ADD RSC /l 0x419 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Util\LZMA.dll" /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "LzmaLib - Win32 Release"
-# Name "LzmaLib - Win32 Debug"
-# Begin Group "Spec"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\LzmaLib.def
-# End Source File
-# Begin Source File
-
-SOURCE=.\LzmaLibExports.c
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=..\Alloc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\Alloc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\IStream.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzFind.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzFind.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzFindMt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzFindMt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzHash.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzmaDec.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzmaDec.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzmaEnc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzmaEnc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzmaLib.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzmaLib.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\resource.rc
-# End Source File
-# Begin Source File
-
-SOURCE=..\Threads.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\Threads.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\Types.h
-# End Source File
-# End Target
-# End Project
diff --git a/third_party/lzma/v4_65/files/C/LzmaLib/LzmaLib.dsw b/third_party/lzma/v4_65/files/C/LzmaLib/LzmaLib.dsw
deleted file mode 100644
index 6faf333..0000000
--- a/third_party/lzma/v4_65/files/C/LzmaLib/LzmaLib.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "LzmaLib"=.\LzmaLib.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/third_party/lzma/v4_65/files/C/LzmaLib/LzmaLibExports.c b/third_party/lzma/v4_65/files/C/LzmaLib/LzmaLibExports.c
deleted file mode 100644
index 845545d..0000000
--- a/third_party/lzma/v4_65/files/C/LzmaLib/LzmaLibExports.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/* LzmaLibExports.c -- LZMA library DLL Entry point
-2008-10-04 : Igor Pavlov : Public domain */
-
-#include <windows.h>
-
-BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
-{
-  hInstance = hInstance;
-  dwReason = dwReason;
-  lpReserved = lpReserved;
-  return TRUE;
-}
diff --git a/third_party/lzma/v4_65/files/C/LzmaLib/makefile b/third_party/lzma/v4_65/files/C/LzmaLib/makefile
deleted file mode 100644
index 1e6b40c..0000000
--- a/third_party/lzma/v4_65/files/C/LzmaLib/makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-MY_STATIC_LINK=1
-SLIB = sLZMA.lib
-PROG = LZMA.dll
-SLIBPATH = $O\$(SLIB)
-
-DEF_FILE = LzmaLib.def
-CFLAGS = $(CFLAGS) \
-  -DCOMPRESS_MF_MT \
-
-LIBS = $(LIBS) oleaut32.lib
-
-LIB_OBJS = \
-  $O\LzmaLibExports.obj \
-
-C_OBJS = \
-  $O\Alloc.obj \
-  $O\LzFind.obj \
-  $O\LzFindMt.obj \
-  $O\LzmaDec.obj \
-  $O\LzmaEnc.obj \
-  $O\LzmaLib.obj \
-  $O\Threads.obj \
-
-OBJS = \
-  $(LIB_OBJS) \
-  $(C_OBJS) \
-  $O\resource.res
-
-!include "../../CPP/Build.mak"
-
-$(SLIBPATH): $O $(OBJS)
-	lib -out:$(SLIBPATH) $(OBJS) $(LIBS)
-
-$(LIB_OBJS): $(*B).c
-	$(COMPL_O2)
-$(C_OBJS): ../$(*B).c
-	$(COMPL_O2)
diff --git a/third_party/lzma/v4_65/files/C/LzmaLib/resource.rc b/third_party/lzma/v4_65/files/C/LzmaLib/resource.rc
deleted file mode 100644
index 1e48916..0000000
--- a/third_party/lzma/v4_65/files/C/LzmaLib/resource.rc
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "../../CPP/7zip/MyVersionInfo.rc"
-
-MY_VERSION_INFO_DLL("LZMA library", "LZMA")
-
diff --git a/third_party/lzma/v4_65/files/C/LzmaUtil/Lzma86Dec.c b/third_party/lzma/v4_65/files/C/LzmaUtil/Lzma86Dec.c
deleted file mode 100644
index b801dd1..0000000
--- a/third_party/lzma/v4_65/files/C/LzmaUtil/Lzma86Dec.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Lzma86Dec.c -- LZMA + x86 (BCJ) Filter Decoder
-2008-04-07
-Igor Pavlov
-Public domain */
-
-#include "Lzma86Dec.h"
-
-#include "../Alloc.h"
-#include "../Bra.h"
-#include "../LzmaDec.h"
-
-#define LZMA86_SIZE_OFFSET (1 + LZMA_PROPS_SIZE)
-#define LZMA86_HEADER_SIZE (LZMA86_SIZE_OFFSET + 8)
-
-static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); }
-static void SzFree(void *p, void *address) { p = p; MyFree(address); }
-static ISzAlloc g_Alloc = { SzAlloc, SzFree };
-
-SRes Lzma86_GetUnpackSize(const Byte *src, SizeT srcLen, UInt64 *unpackSize)
-{
-  unsigned i;
-  if (srcLen < LZMA86_HEADER_SIZE)
-    return SZ_ERROR_INPUT_EOF;
-  *unpackSize = 0;
-  for (i = 0; i < sizeof(UInt64); i++)
-    *unpackSize += ((UInt64)src[LZMA86_SIZE_OFFSET + i]) << (8 * i);
-  return SZ_OK;
-}
-
-SRes Lzma86_Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen)
-{
-  SRes res;
-  int useFilter;
-  SizeT inSizePure;
-  ELzmaStatus status;
-
-  if (*srcLen < LZMA86_HEADER_SIZE)
-    return SZ_ERROR_INPUT_EOF;
-
-  useFilter = src[0];
-
-  if (useFilter > 1)
-  {
-    *destLen = 0;
-    return SZ_ERROR_UNSUPPORTED;
-  }
-
-  inSizePure = *srcLen - LZMA86_HEADER_SIZE;
-  res = LzmaDecode(dest, destLen, src + LZMA86_HEADER_SIZE, &inSizePure,
-      src + 1, LZMA_PROPS_SIZE, LZMA_FINISH_ANY, &status, &g_Alloc);
-  *srcLen = inSizePure + LZMA86_HEADER_SIZE;
-  if (res != SZ_OK)
-    return res;
-  if (useFilter == 1)
-  {
-    UInt32 x86State;
-    x86_Convert_Init(x86State);
-    x86_Convert(dest, *destLen, 0, &x86State, 0);
-  }
-  return SZ_OK;
-}
diff --git a/third_party/lzma/v4_65/files/C/LzmaUtil/Lzma86Dec.h b/third_party/lzma/v4_65/files/C/LzmaUtil/Lzma86Dec.h
deleted file mode 100644
index f711821..0000000
--- a/third_party/lzma/v4_65/files/C/LzmaUtil/Lzma86Dec.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Lzma86Dec.h -- LZMA + x86 (BCJ) Filter Decoder
-2008-08-05
-Igor Pavlov
-Public domain */
-
-#ifndef __LZMA86DEC_H
-#define __LZMA86DEC_H
-
-#include "../Types.h"
-
-/*
-Lzma86_GetUnpackSize:
-  In:
-    src      - input data
-    srcLen   - input data size
-  Out:
-    unpackSize - size of uncompressed stream
-  Return code:
-    SZ_OK               - OK
-    SZ_ERROR_INPUT_EOF  - Error in headers
-*/
-
-SRes Lzma86_GetUnpackSize(const Byte *src, SizeT srcLen, UInt64 *unpackSize);
-
-/*
-Lzma86_Decode:
-  In:
-    dest     - output data
-    destLen  - output data size
-    src      - input data
-    srcLen   - input data size
-  Out:
-    destLen  - processed output size
-    srcLen   - processed input size
-  Return code:
-    SZ_OK           - OK
-    SZ_ERROR_DATA  - Data error
-    SZ_ERROR_MEM   - Memory allocation error
-    SZ_ERROR_UNSUPPORTED - unsupported file
-    SZ_ERROR_INPUT_EOF - it needs more bytes in input buffer
-*/
-
-SRes Lzma86_Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/C/LzmaUtil/Lzma86Enc.c b/third_party/lzma/v4_65/files/C/LzmaUtil/Lzma86Enc.c
deleted file mode 100644
index efc81ea..0000000
--- a/third_party/lzma/v4_65/files/C/LzmaUtil/Lzma86Enc.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* Lzma86Enc.c -- LZMA + x86 (BCJ) Filter Encoder
-2008-08-05
-Igor Pavlov
-Public domain */
-
-#include <string.h>
-
-#include "Lzma86Enc.h"
-
-#include "../Alloc.h"
-#include "../Bra.h"
-#include "../LzmaEnc.h"
-
-#define SZE_OUT_OVERFLOW SZE_DATA_ERROR
-
-static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); }
-static void SzFree(void *p, void *address) { p = p; MyFree(address); }
-static ISzAlloc g_Alloc = { SzAlloc, SzFree };
-
-#define LZMA86_SIZE_OFFSET (1 + LZMA_PROPS_SIZE)
-#define LZMA86_HEADER_SIZE (LZMA86_SIZE_OFFSET + 8)
-
-int Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen,
-    int level, UInt32 dictSize, int filterMode)
-{
-  size_t outSize2 = *destLen;
-  Byte *filteredStream;
-  Bool useFilter;
-  int mainResult = SZ_ERROR_OUTPUT_EOF;
-  CLzmaEncProps props;
-  LzmaEncProps_Init(&props);
-  props.level = level;
-  props.dictSize = dictSize;
-  
-  *destLen = 0;
-  if (outSize2 < LZMA86_HEADER_SIZE)
-    return SZ_ERROR_OUTPUT_EOF;
-
-  {
-    int i;
-    UInt64 t = srcLen;
-    for (i = 0; i < 8; i++, t >>= 8)
-      dest[LZMA86_SIZE_OFFSET + i] = (Byte)t;
-  }
-
-  filteredStream = 0;
-  useFilter = (filterMode != SZ_FILTER_NO);
-  if (useFilter)
-  {
-    if (srcLen != 0)
-    {
-      filteredStream = (Byte *)MyAlloc(srcLen);
-      if (filteredStream == 0)
-        return SZ_ERROR_MEM;
-      memcpy(filteredStream, src, srcLen);
-    }
-    {
-      UInt32 x86State;
-      x86_Convert_Init(x86State);
-      x86_Convert(filteredStream, srcLen, 0, &x86State, 1);
-    }
-  }
-
-  {
-    size_t minSize = 0;
-    Bool bestIsFiltered = False;
-
-    /* passes for SZ_FILTER_AUTO:
-        0 - BCJ + LZMA
-        1 - LZMA
-        2 - BCJ + LZMA agaian, if pass 0 (BCJ + LZMA) is better.
-    */
-    int numPasses = (filterMode == SZ_FILTER_AUTO) ? 3 : 1;
-
-    int i;
-    for (i = 0; i < numPasses; i++)
-    {
-      size_t outSizeProcessed = outSize2 - LZMA86_HEADER_SIZE;
-      size_t outPropsSize = 5;
-      SRes curRes;
-      Bool curModeIsFiltered = (numPasses > 1 && i == numPasses - 1);
-      if (curModeIsFiltered && !bestIsFiltered)
-        break;
-      if (useFilter && i == 0)
-        curModeIsFiltered = True;
-      
-      curRes = LzmaEncode(dest + LZMA86_HEADER_SIZE, &outSizeProcessed,
-          curModeIsFiltered ? filteredStream : src, srcLen,
-          &props, dest + 1, &outPropsSize, 0,
-          NULL, &g_Alloc, &g_Alloc);
-      
-      if (curRes != SZ_ERROR_OUTPUT_EOF)
-      {
-        if (curRes != SZ_OK)
-        {
-          mainResult = curRes;
-          break;
-        }
-        if (outSizeProcessed <= minSize || mainResult != SZ_OK)
-        {
-          minSize = outSizeProcessed;
-          bestIsFiltered = curModeIsFiltered;
-          mainResult = SZ_OK;
-        }
-      }
-    }
-    dest[0] = (bestIsFiltered ? 1 : 0);
-    *destLen = LZMA86_HEADER_SIZE + minSize;
-  }
-  if (useFilter)
-    MyFree(filteredStream);
-  return mainResult;
-}
diff --git a/third_party/lzma/v4_65/files/C/LzmaUtil/Lzma86Enc.h b/third_party/lzma/v4_65/files/C/LzmaUtil/Lzma86Enc.h
deleted file mode 100644
index 10be1cd..0000000
--- a/third_party/lzma/v4_65/files/C/LzmaUtil/Lzma86Enc.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Lzma86Enc.h -- LZMA + x86 (BCJ) Filter Encoder
-2008-08-05
-Igor Pavlov
-Public domain */
-
-#ifndef __LZMA86ENC_H
-#define __LZMA86ENC_H
-
-#include "../Types.h"
-
-/*
-It's an example for LZMA + x86 Filter use.
-You can use .lzma86 extension, if you write that stream to file.
-.lzma86 header adds one additional byte to standard .lzma header.
-.lzma86 header (14 bytes):
-  Offset Size  Description
-    0     1    = 0 - no filter,
-               = 1 - x86 filter
-    1     1    lc, lp and pb in encoded form
-    2     4    dictSize (little endian)
-    6     8    uncompressed size (little endian)
-
-
-Lzma86_Encode
--------------
-level - compression level: 0 <= level <= 9, the default value for "level" is 5.
-
-
-dictSize - The dictionary size in bytes. The maximum value is
-        128 MB = (1 << 27) bytes for 32-bit version
-          1 GB = (1 << 30) bytes for 64-bit version
-     The default value is 16 MB = (1 << 24) bytes, for level = 5.
-     It's recommended to use the dictionary that is larger than 4 KB and
-     that can be calculated as (1 << N) or (3 << N) sizes.
-     For better compression ratio dictSize must be >= inSize.
-
-filterMode:
-    SZ_FILTER_NO   - no Filter
-    SZ_FILTER_YES  - x86 Filter
-    SZ_FILTER_AUTO - it tries both alternatives to select best.
-              Encoder will use 2 or 3 passes:
-              2 passes when FILTER_NO provides better compression.
-              3 passes when FILTER_YES provides better compression.
-
-Lzma86Encode allocates Data with MyAlloc functions.
-RAM Requirements for compressing:
-  RamSize = dictionarySize * 11.5 + 6MB + FilterBlockSize
-      filterMode     FilterBlockSize
-     SZ_FILTER_NO         0
-     SZ_FILTER_YES      inSize
-     SZ_FILTER_AUTO     inSize
-
-
-Return code:
-  SZ_OK               - OK
-  SZ_ERROR_MEM        - Memory allocation error
-  SZ_ERROR_PARAM      - Incorrect paramater
-  SZ_ERROR_OUTPUT_EOF - output buffer overflow
-  SZ_ERROR_THREAD     - errors in multithreading functions (only for Mt version)
-*/
-
-enum ESzFilterMode
-{
-  SZ_FILTER_NO,
-  SZ_FILTER_YES,
-  SZ_FILTER_AUTO
-};
-
-SRes Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen,
-    int level, UInt32 dictSize, int filterMode);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/C/LzmaUtil/LzmaUtil.c b/third_party/lzma/v4_65/files/C/LzmaUtil/LzmaUtil.c
deleted file mode 100644
index 016d7b0..0000000
--- a/third_party/lzma/v4_65/files/C/LzmaUtil/LzmaUtil.c
+++ /dev/null
@@ -1,254 +0,0 @@
-/* LzmaUtil.c -- Test application for LZMA compression
-2008-11-23 : Igor Pavlov : Public domain */
-
-#define _CRT_SECURE_NO_WARNINGS
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "../Alloc.h"
-#include "../7zFile.h"
-#include "../7zVersion.h"
-#include "../LzmaDec.h"
-#include "../LzmaEnc.h"
-
-const char *kCantReadMessage = "Can not read input file";
-const char *kCantWriteMessage = "Can not write output file";
-const char *kCantAllocateMessage = "Can not allocate memory";
-const char *kDataErrorMessage = "Data error";
-
-static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); }
-static void SzFree(void *p, void *address) { p = p; MyFree(address); }
-static ISzAlloc g_Alloc = { SzAlloc, SzFree };
-
-void PrintHelp(char *buffer)
-{
-  strcat(buffer, "\nLZMA Utility " MY_VERSION_COPYRIGHT_DATE "\n"
-      "\nUsage:  lzma <e|d> inputFile outputFile\n"
-             "  e: encode file\n"
-             "  d: decode file\n");
-}
-
-int PrintError(char *buffer, const char *message)
-{
-  strcat(buffer, "\nError: ");
-  strcat(buffer, message);
-  strcat(buffer, "\n");
-  return 1;
-}
-
-int PrintErrorNumber(char *buffer, SRes val)
-{
-  sprintf(buffer + strlen(buffer), "\nError code: %x\n", (unsigned)val);
-  return 1;
-}
-
-int PrintUserError(char *buffer)
-{
-  return PrintError(buffer, "Incorrect command");
-}
-
-#define IN_BUF_SIZE (1 << 16)
-#define OUT_BUF_SIZE (1 << 16)
-
-static SRes Decode2(CLzmaDec *state, ISeqOutStream *outStream, ISeqInStream *inStream,
-    UInt64 unpackSize)
-{
-  int thereIsSize = (unpackSize != (UInt64)(Int64)-1);
-  Byte inBuf[IN_BUF_SIZE];
-  Byte outBuf[OUT_BUF_SIZE];
-  size_t inPos = 0, inSize = 0, outPos = 0;
-  LzmaDec_Init(state);
-  for (;;)
-  {
-    if (inPos == inSize)
-    {
-      inSize = IN_BUF_SIZE;
-      RINOK(inStream->Read(inStream, inBuf, &inSize));
-      inPos = 0;
-    }
-    {
-      SRes res;
-      SizeT inProcessed = inSize - inPos;
-      SizeT outProcessed = OUT_BUF_SIZE - outPos;
-      ELzmaFinishMode finishMode = LZMA_FINISH_ANY;
-      ELzmaStatus status;
-      if (thereIsSize && outProcessed > unpackSize)
-      {
-        outProcessed = (SizeT)unpackSize;
-        finishMode = LZMA_FINISH_END;
-      }
-      
-      res = LzmaDec_DecodeToBuf(state, outBuf + outPos, &outProcessed,
-        inBuf + inPos, &inProcessed, finishMode, &status);
-      inPos += inProcessed;
-      outPos += outProcessed;
-      unpackSize -= outProcessed;
-      
-      if (outStream)
-        if (outStream->Write(outStream, outBuf, outPos) != outPos)
-          return SZ_ERROR_WRITE;
-        
-      outPos = 0;
-      
-      if (res != SZ_OK || thereIsSize && unpackSize == 0)
-        return res;
-      
-      if (inProcessed == 0 && outProcessed == 0)
-      {
-        if (thereIsSize || status != LZMA_STATUS_FINISHED_WITH_MARK)
-          return SZ_ERROR_DATA;
-        return res;
-      }
-    }
-  }
-}
-
-static SRes Decode(ISeqOutStream *outStream, ISeqInStream *inStream)
-{
-  UInt64 unpackSize;
-  int i;
-  SRes res = 0;
-
-  CLzmaDec state;
-
-  /* header: 5 bytes of LZMA properties and 8 bytes of uncompressed size */
-  unsigned char header[LZMA_PROPS_SIZE + 8];
-
-  /* Read and parse header */
-
-  RINOK(SeqInStream_Read(inStream, header, sizeof(header)));
-
-  unpackSize = 0;
-  for (i = 0; i < 8; i++)
-    unpackSize += (UInt64)header[LZMA_PROPS_SIZE + i] << (i * 8);
-
-  LzmaDec_Construct(&state);
-  RINOK(LzmaDec_Allocate(&state, header, LZMA_PROPS_SIZE, &g_Alloc));
-  res = Decode2(&state, outStream, inStream, unpackSize);
-  LzmaDec_Free(&state, &g_Alloc);
-  return res;
-}
-
-static SRes Encode(ISeqOutStream *outStream, ISeqInStream *inStream, UInt64 fileSize, char *rs)
-{
-  CLzmaEncHandle enc;
-  SRes res;
-  CLzmaEncProps props;
-
-  rs = rs;
-
-  enc = LzmaEnc_Create(&g_Alloc);
-  if (enc == 0)
-    return SZ_ERROR_MEM;
-
-  LzmaEncProps_Init(&props);
-  res = LzmaEnc_SetProps(enc, &props);
-
-  if (res == SZ_OK)
-  {
-    Byte header[LZMA_PROPS_SIZE + 8];
-    size_t headerSize = LZMA_PROPS_SIZE;
-    int i;
-
-    res = LzmaEnc_WriteProperties(enc, header, &headerSize);
-    for (i = 0; i < 8; i++)
-      header[headerSize++] = (Byte)(fileSize >> (8 * i));
-    if (outStream->Write(outStream, header, headerSize) != headerSize)
-      res = SZ_ERROR_WRITE;
-    else
-    {
-      if (res == SZ_OK)
-        res = LzmaEnc_Encode(enc, outStream, inStream, NULL, &g_Alloc, &g_Alloc);
-    }
-  }
-  LzmaEnc_Destroy(enc, &g_Alloc, &g_Alloc);
-  return res;
-}
-
-int main2(int numArgs, const char *args[], char *rs)
-{
-  CFileSeqInStream inStream;
-  CFileOutStream outStream;
-  char c;
-  int res;
-  int encodeMode;
-  Bool useOutFile = False;
-
-  FileSeqInStream_CreateVTable(&inStream);
-  File_Construct(&inStream.file);
-
-  FileOutStream_CreateVTable(&outStream);
-  File_Construct(&outStream.file);
-
-  if (numArgs == 1)
-  {
-    PrintHelp(rs);
-    return 0;
-  }
-
-  if (numArgs < 3 || numArgs > 4 || strlen(args[1]) != 1)
-    return PrintUserError(rs);
-
-  c = args[1][0];
-  encodeMode = (c == 'e' || c == 'E');
-  if (!encodeMode && c != 'd' && c != 'D')
-    return PrintUserError(rs);
-
-  {
-    size_t t4 = sizeof(UInt32);
-    size_t t8 = sizeof(UInt64);
-    if (t4 != 4 || t8 != 8)
-      return PrintError(rs, "Incorrect UInt32 or UInt64");
-  }
-
-  if (InFile_Open(&inStream.file, args[2]) != 0)
-    return PrintError(rs, "Can not open input file");
-
-  if (numArgs > 3)
-  {
-    useOutFile = True;
-    if (OutFile_Open(&outStream.file, args[3]) != 0)
-      return PrintError(rs, "Can not open output file");
-  }
-  else if (encodeMode)
-    PrintUserError(rs);
-
-  if (encodeMode)
-  {
-    UInt64 fileSize;
-    File_GetLength(&inStream.file, &fileSize);
-    res = Encode(&outStream.s, &inStream.s, fileSize, rs);
-  }
-  else
-  {
-    res = Decode(&outStream.s, useOutFile ? &inStream.s : NULL);
-  }
-
-  if (useOutFile)
-    File_Close(&outStream.file);
-  File_Close(&inStream.file);
-
-  if (res != SZ_OK)
-  {
-    if (res == SZ_ERROR_MEM)
-      return PrintError(rs, kCantAllocateMessage);
-    else if (res == SZ_ERROR_DATA)
-      return PrintError(rs, kDataErrorMessage);
-    else if (res == SZ_ERROR_WRITE)
-      return PrintError(rs, kCantWriteMessage);
-    else if (res == SZ_ERROR_READ)
-      return PrintError(rs, kCantReadMessage);
-    return PrintErrorNumber(rs, res);
-  }
-  return 0;
-}
-
-int MY_CDECL main(int numArgs, const char *args[])
-{
-  char rs[800] = { 0 };
-  int res = main2(numArgs, args, rs);
-  printf(rs);
-  return res;
-}
diff --git a/third_party/lzma/v4_65/files/C/LzmaUtil/LzmaUtil.dsp b/third_party/lzma/v4_65/files/C/LzmaUtil/LzmaUtil.dsp
deleted file mode 100644
index faac2e6..0000000
--- a/third_party/lzma/v4_65/files/C/LzmaUtil/LzmaUtil.dsp
+++ /dev/null
@@ -1,168 +0,0 @@
-# Microsoft Developer Studio Project File - Name="LzmaUtil" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=LzmaUtil - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "LzmaUtil.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "LzmaUtil.mak" CFG="LzmaUtil - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "LzmaUtil - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "LzmaUtil - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "LzmaUtil - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x419 /d "NDEBUG"
-# ADD RSC /l 0x419 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"c:\util\lzmac.exe"
-
-!ELSEIF  "$(CFG)" == "LzmaUtil - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x419 /d "_DEBUG"
-# ADD RSC /l 0x419 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"c:\util\lzmac.exe" /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "LzmaUtil - Win32 Release"
-# Name "LzmaUtil - Win32 Debug"
-# Begin Source File
-
-SOURCE=..\7zFile.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\7zFile.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\7zStream.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\7zVersion.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\Alloc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\Alloc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\CpuArch.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzFind.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzFind.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzFindMt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzFindMt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzHash.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzmaDec.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzmaDec.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzmaEnc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzmaEnc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\LzmaUtil.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\Threads.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\Threads.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\Types.h
-# End Source File
-# End Target
-# End Project
diff --git a/third_party/lzma/v4_65/files/C/LzmaUtil/LzmaUtil.dsw b/third_party/lzma/v4_65/files/C/LzmaUtil/LzmaUtil.dsw
deleted file mode 100644
index c52eaf6..0000000
--- a/third_party/lzma/v4_65/files/C/LzmaUtil/LzmaUtil.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "LzmaUtil"=.\LzmaUtil.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/third_party/lzma/v4_65/files/C/LzmaUtil/makefile b/third_party/lzma/v4_65/files/C/LzmaUtil/makefile
deleted file mode 100644
index fbb98b8..0000000
--- a/third_party/lzma/v4_65/files/C/LzmaUtil/makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-MY_STATIC_LINK=1
-PROG = LZMAc.exe
-
-CFLAGS = $(CFLAGS) \
-  -DCOMPRESS_MF_MT \
-
-LIB_OBJS = \
-  $O\LzmaUtil.obj \
-
-C_OBJS = \
-  $O\Alloc.obj \
-  $O\LzFind.obj \
-  $O\LzFindMt.obj \
-  $O\LzmaDec.obj \
-  $O\LzmaEnc.obj \
-  $O\7zFile.obj \
-  $O\7zStream.obj \
-  $O\Threads.obj \
-
-OBJS = \
-  $(LIB_OBJS) \
-  $(C_OBJS) \
-
-!include "../../CPP/Build.mak"
-
-$(LIB_OBJS): $(*B).c
-	$(COMPL_O2)
-$(C_OBJS): ../$(*B).c
-	$(COMPL_O2)
diff --git a/third_party/lzma/v4_65/files/C/LzmaUtil/makefile.gcc b/third_party/lzma/v4_65/files/C/LzmaUtil/makefile.gcc
deleted file mode 100644
index 9fcdead..0000000
--- a/third_party/lzma/v4_65/files/C/LzmaUtil/makefile.gcc
+++ /dev/null
@@ -1,44 +0,0 @@
-PROG = lzma
-CXX = g++
-LIB =
-RM = rm -f
-CFLAGS = -c -O2 -Wall
-
-OBJS = \
-  LzmaUtil.o \
-  Alloc.o \
-  LzFind.o \
-  LzmaDec.o \
-  LzmaEnc.o \
-  7zFile.o \
-  7zStream.o \
-
-
-all: $(PROG)
-
-$(PROG): $(OBJS)
-	$(CXX) -o $(PROG) $(LDFLAGS) $(OBJS) $(LIB) $(LIB2)
-
-LzmaUtil.o: LzmaUtil.c
-	$(CXX) $(CFLAGS) LzmaUtil.c
-
-Alloc.o: ../Alloc.c
-	$(CXX) $(CFLAGS) ../Alloc.c
-
-LzFind.o: ../LzFind.c
-	$(CXX) $(CFLAGS) ../LzFind.c
-
-LzmaDec.o: ../LzmaDec.c
-	$(CXX) $(CFLAGS) ../LzmaDec.c
-
-LzmaEnc.o: ../LzmaEnc.c
-	$(CXX) $(CFLAGS) ../LzmaEnc.c
-
-7zFile.o: ../7zFile.c
-	$(CXX) $(CFLAGS) ../7zFile.c
-
-7zStream.o: ../7zStream.c
-	$(CXX) $(CFLAGS) ../7zStream.c
-
-clean:
-	-$(RM) $(PROG) $(OBJS)
diff --git a/third_party/lzma/v4_65/files/C/Threads.c b/third_party/lzma/v4_65/files/C/Threads.c
deleted file mode 100644
index 4fdd69b..0000000
--- a/third_party/lzma/v4_65/files/C/Threads.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/* Threads.c -- multithreading library
-2008-08-05
-Igor Pavlov
-Public domain */
-
-#include "Threads.h"
-#include <process.h>
-
-static WRes GetError()
-{
-  DWORD res = GetLastError();
-  return (res) ? (WRes)(res) : 1;
-}
-
-WRes HandleToWRes(HANDLE h) { return (h != 0) ? 0 : GetError(); }
-WRes BOOLToWRes(BOOL v) { return v ? 0 : GetError(); }
-
-static WRes MyCloseHandle(HANDLE *h)
-{
-  if (*h != NULL)
-    if (!CloseHandle(*h))
-      return GetError();
-  *h = NULL;
-  return 0;
-}
-
-WRes Thread_Create(CThread *thread, THREAD_FUNC_RET_TYPE (THREAD_FUNC_CALL_TYPE *startAddress)(void *), LPVOID parameter)
-{
-  unsigned threadId; /* Windows Me/98/95: threadId parameter may not be NULL in _beginthreadex/CreateThread functions */
-  thread->handle =
-    /* CreateThread(0, 0, startAddress, parameter, 0, &threadId); */
-    (HANDLE)_beginthreadex(NULL, 0, startAddress, parameter, 0, &threadId);
-    /* maybe we must use errno here, but probably GetLastError() is also OK. */
-  return HandleToWRes(thread->handle);
-}
-
-WRes WaitObject(HANDLE h)
-{
-  return (WRes)WaitForSingleObject(h, INFINITE);
-}
-
-WRes Thread_Wait(CThread *thread)
-{
-  if (thread->handle == NULL)
-    return 1;
-  return WaitObject(thread->handle);
-}
-
-WRes Thread_Close(CThread *thread)
-{
-  return MyCloseHandle(&thread->handle);
-}
-
-WRes Event_Create(CEvent *p, BOOL manualReset, int initialSignaled)
-{
-  p->handle = CreateEvent(NULL, manualReset, (initialSignaled ? TRUE : FALSE), NULL);
-  return HandleToWRes(p->handle);
-}
-
-WRes ManualResetEvent_Create(CManualResetEvent *p, int initialSignaled)
-  { return Event_Create(p, TRUE, initialSignaled); }
-WRes ManualResetEvent_CreateNotSignaled(CManualResetEvent *p)
-  { return ManualResetEvent_Create(p, 0); }
-
-WRes AutoResetEvent_Create(CAutoResetEvent *p, int initialSignaled)
-  { return Event_Create(p, FALSE, initialSignaled); }
-WRes AutoResetEvent_CreateNotSignaled(CAutoResetEvent *p)
-  { return AutoResetEvent_Create(p, 0); }
-
-WRes Event_Set(CEvent *p) { return BOOLToWRes(SetEvent(p->handle)); }
-WRes Event_Reset(CEvent *p) { return BOOLToWRes(ResetEvent(p->handle)); }
-WRes Event_Wait(CEvent *p) { return WaitObject(p->handle); }
-WRes Event_Close(CEvent *p) { return MyCloseHandle(&p->handle); }
-
-
-WRes Semaphore_Create(CSemaphore *p, UInt32 initiallyCount, UInt32 maxCount)
-{
-  p->handle = CreateSemaphore(NULL, (LONG)initiallyCount, (LONG)maxCount, NULL);
-  return HandleToWRes(p->handle);
-}
-
-WRes Semaphore_Release(CSemaphore *p, LONG releaseCount, LONG *previousCount)
-{
-  return BOOLToWRes(ReleaseSemaphore(p->handle, releaseCount, previousCount));
-}
-WRes Semaphore_ReleaseN(CSemaphore *p, UInt32 releaseCount)
-{
-  return Semaphore_Release(p, (LONG)releaseCount, NULL);
-}
-WRes Semaphore_Release1(CSemaphore *p)
-{
-  return Semaphore_ReleaseN(p, 1);
-}
-
-WRes Semaphore_Wait(CSemaphore *p) { return WaitObject(p->handle); }
-WRes Semaphore_Close(CSemaphore *p) { return MyCloseHandle(&p->handle); }
-
-WRes CriticalSection_Init(CCriticalSection *p)
-{
-  /* InitializeCriticalSection can raise only STATUS_NO_MEMORY exception */
-  __try
-  {
-    InitializeCriticalSection(p);
-    /* InitializeCriticalSectionAndSpinCount(p, 0); */
-  }
-  __except (EXCEPTION_EXECUTE_HANDLER) { return 1; }
-  return 0;
-}
-
diff --git a/third_party/lzma/v4_65/files/C/Threads.h b/third_party/lzma/v4_65/files/C/Threads.h
deleted file mode 100644
index a823e57..0000000
--- a/third_party/lzma/v4_65/files/C/Threads.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Threads.h -- multithreading library
-2008-11-22 : Igor Pavlov : Public domain */
-
-#ifndef __7Z_THRESDS_H
-#define __7Z_THRESDS_H
-
-#include "Types.h"
-
-typedef struct _CThread
-{
-  HANDLE handle;
-} CThread;
-
-#define Thread_Construct(thread) (thread)->handle = NULL
-#define Thread_WasCreated(thread) ((thread)->handle != NULL)
- 
-typedef unsigned THREAD_FUNC_RET_TYPE;
-#define THREAD_FUNC_CALL_TYPE MY_STD_CALL
-#define THREAD_FUNC_DECL THREAD_FUNC_RET_TYPE THREAD_FUNC_CALL_TYPE
-
-WRes Thread_Create(CThread *thread, THREAD_FUNC_RET_TYPE (THREAD_FUNC_CALL_TYPE *startAddress)(void *), LPVOID parameter);
-WRes Thread_Wait(CThread *thread);
-WRes Thread_Close(CThread *thread);
-
-typedef struct _CEvent
-{
-  HANDLE handle;
-} CEvent;
-
-typedef CEvent CAutoResetEvent;
-typedef CEvent CManualResetEvent;
-
-#define Event_Construct(event) (event)->handle = NULL
-#define Event_IsCreated(event) ((event)->handle != NULL)
-
-WRes ManualResetEvent_Create(CManualResetEvent *event, int initialSignaled);
-WRes ManualResetEvent_CreateNotSignaled(CManualResetEvent *event);
-WRes AutoResetEvent_Create(CAutoResetEvent *event, int initialSignaled);
-WRes AutoResetEvent_CreateNotSignaled(CAutoResetEvent *event);
-WRes Event_Set(CEvent *event);
-WRes Event_Reset(CEvent *event);
-WRes Event_Wait(CEvent *event);
-WRes Event_Close(CEvent *event);
-
-
-typedef struct _CSemaphore
-{
-  HANDLE handle;
-} CSemaphore;
-
-#define Semaphore_Construct(p) (p)->handle = NULL
-
-WRes Semaphore_Create(CSemaphore *p, UInt32 initiallyCount, UInt32 maxCount);
-WRes Semaphore_ReleaseN(CSemaphore *p, UInt32 num);
-WRes Semaphore_Release1(CSemaphore *p);
-WRes Semaphore_Wait(CSemaphore *p);
-WRes Semaphore_Close(CSemaphore *p);
-
-
-typedef CRITICAL_SECTION CCriticalSection;
-
-WRes CriticalSection_Init(CCriticalSection *p);
-#define CriticalSection_Delete(p) DeleteCriticalSection(p)
-#define CriticalSection_Enter(p) EnterCriticalSection(p)
-#define CriticalSection_Leave(p) LeaveCriticalSection(p)
-
-#endif
-
diff --git a/third_party/lzma/v4_65/files/C/Types.h b/third_party/lzma/v4_65/files/C/Types.h
deleted file mode 100644
index 1af5cfc..0000000
--- a/third_party/lzma/v4_65/files/C/Types.h
+++ /dev/null
@@ -1,208 +0,0 @@
-/* Types.h -- Basic types
-2008-11-23 : Igor Pavlov : Public domain */
-
-#ifndef __7Z_TYPES_H
-#define __7Z_TYPES_H
-
-#include <stddef.h>
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-
-#define SZ_OK 0
-
-#define SZ_ERROR_DATA 1
-#define SZ_ERROR_MEM 2
-#define SZ_ERROR_CRC 3
-#define SZ_ERROR_UNSUPPORTED 4
-#define SZ_ERROR_PARAM 5
-#define SZ_ERROR_INPUT_EOF 6
-#define SZ_ERROR_OUTPUT_EOF 7
-#define SZ_ERROR_READ 8
-#define SZ_ERROR_WRITE 9
-#define SZ_ERROR_PROGRESS 10
-#define SZ_ERROR_FAIL 11
-#define SZ_ERROR_THREAD 12
-
-#define SZ_ERROR_ARCHIVE 16
-#define SZ_ERROR_NO_ARCHIVE 17
-
-typedef int SRes;
-
-#ifdef _WIN32
-typedef DWORD WRes;
-#else
-typedef int WRes;
-#endif
-
-#ifndef RINOK
-#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
-#endif
-
-typedef unsigned char Byte;
-typedef short Int16;
-typedef unsigned short UInt16;
-
-#ifdef _LZMA_UINT32_IS_ULONG
-typedef long Int32;
-typedef unsigned long UInt32;
-#else
-typedef int Int32;
-typedef unsigned int UInt32;
-#endif
-
-#ifdef _SZ_NO_INT_64
-
-/* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers.
-   NOTES: Some code will work incorrectly in that case! */
-
-typedef long Int64;
-typedef unsigned long UInt64;
-
-#else
-
-#if defined(_MSC_VER) || defined(__BORLANDC__)
-typedef __int64 Int64;
-typedef unsigned __int64 UInt64;
-#else
-typedef long long int Int64;
-typedef unsigned long long int UInt64;
-#endif
-
-#endif
-
-#ifdef _LZMA_NO_SYSTEM_SIZE_T
-typedef UInt32 SizeT;
-#else
-typedef size_t SizeT;
-#endif
-
-typedef int Bool;
-#define True 1
-#define False 0
-
-
-#ifdef _MSC_VER
-
-#if _MSC_VER >= 1300
-#define MY_NO_INLINE __declspec(noinline)
-#else
-#define MY_NO_INLINE
-#endif
-
-#define MY_CDECL __cdecl
-#define MY_STD_CALL __stdcall
-#define MY_FAST_CALL MY_NO_INLINE __fastcall
-
-#else
-
-#define MY_CDECL
-#define MY_STD_CALL
-#define MY_FAST_CALL
-
-#endif
-
-
-/* The following interfaces use first parameter as pointer to structure */
-
-typedef struct
-{
-  SRes (*Read)(void *p, void *buf, size_t *size);
-    /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
-       (output(*size) < input(*size)) is allowed */
-} ISeqInStream;
-
-/* it can return SZ_ERROR_INPUT_EOF */
-SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size);
-SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType);
-SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf);
-
-typedef struct
-{
-  size_t (*Write)(void *p, const void *buf, size_t size);
-    /* Returns: result - the number of actually written bytes.
-       (result < size) means error */
-} ISeqOutStream;
-
-typedef enum
-{
-  SZ_SEEK_SET = 0,
-  SZ_SEEK_CUR = 1,
-  SZ_SEEK_END = 2
-} ESzSeek;
-
-typedef struct
-{
-  SRes (*Read)(void *p, void *buf, size_t *size);  /* same as ISeqInStream::Read */
-  SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin);
-} ISeekInStream;
-
-typedef struct
-{
-  SRes (*Look)(void *p, void **buf, size_t *size);
-    /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
-       (output(*size) > input(*size)) is not allowed
-       (output(*size) < input(*size)) is allowed */
-  SRes (*Skip)(void *p, size_t offset);
-    /* offset must be <= output(*size) of Look */
-
-  SRes (*Read)(void *p, void *buf, size_t *size);
-    /* reads directly (without buffer). It's same as ISeqInStream::Read */
-  SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin);
-} ILookInStream;
-
-SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size);
-SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset);
-
-/* reads via ILookInStream::Read */
-SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType);
-SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size);
-
-#define LookToRead_BUF_SIZE (1 << 14)
-
-typedef struct
-{
-  ILookInStream s;
-  ISeekInStream *realStream;
-  size_t pos;
-  size_t size;
-  Byte buf[LookToRead_BUF_SIZE];
-} CLookToRead;
-
-void LookToRead_CreateVTable(CLookToRead *p, int lookahead);
-void LookToRead_Init(CLookToRead *p);
-
-typedef struct
-{
-  ISeqInStream s;
-  ILookInStream *realStream;
-} CSecToLook;
-
-void SecToLook_CreateVTable(CSecToLook *p);
-
-typedef struct
-{
-  ISeqInStream s;
-  ILookInStream *realStream;
-} CSecToRead;
-
-void SecToRead_CreateVTable(CSecToRead *p);
-
-typedef struct
-{
-  SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize);
-    /* Returns: result. (result != SZ_OK) means break.
-       Value (UInt64)(Int64)-1 for size means unknown value. */
-} ICompressProgress;
-
-typedef struct
-{
-  void *(*Alloc)(void *p, size_t size);
-  void (*Free)(void *p, void *address); /* address can be 0 */
-} ISzAlloc;
-
-#define IAlloc_Alloc(p, size) (p)->Alloc((p), size)
-#define IAlloc_Free(p, a) (p)->Free((p), a)
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zCompressionMode.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zCompressionMode.cpp
deleted file mode 100644
index 6774fc4..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zCompressionMode.cpp
+++ /dev/null
@@ -1,3 +0,0 @@
-// CompressionMethod.cpp
-
-#include "StdAfx.h"
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zCompressionMode.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zCompressionMode.h
deleted file mode 100644
index a7cf999..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zCompressionMode.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// 7zCompressionMode.h
-
-#ifndef __7Z_COMPRESSION_MODE_H
-#define __7Z_COMPRESSION_MODE_H
-
-#include "../../../Common/MyString.h"
-
-#include "../../../Windows/PropVariant.h"
-
-#include "../../Common/MethodProps.h"
-
-namespace NArchive {
-namespace N7z {
-
-struct CMethodFull: public CMethod
-{
-  UInt32 NumInStreams;
-  UInt32 NumOutStreams;
-  bool IsSimpleCoder() const { return (NumInStreams == 1) && (NumOutStreams == 1); }
-};
-
-struct CBind
-{
-  UInt32 InCoder;
-  UInt32 InStream;
-  UInt32 OutCoder;
-  UInt32 OutStream;
-};
-
-struct CCompressionMethodMode
-{
-  CObjectVector<CMethodFull> Methods;
-  CRecordVector<CBind> Binds;
-  #ifdef COMPRESS_MT
-  UInt32 NumThreads;
-  #endif
-  bool PasswordIsDefined;
-  UString Password;
-
-  bool IsEmpty() const { return (Methods.IsEmpty() && !PasswordIsDefined); }
-  CCompressionMethodMode(): PasswordIsDefined(false)
-      #ifdef COMPRESS_MT
-      , NumThreads(1)
-      #endif
-  {}
-};
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zDecode.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zDecode.cpp
deleted file mode 100644
index 2d25ff2..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zDecode.cpp
+++ /dev/null
@@ -1,332 +0,0 @@
-// 7zDecode.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/LimitedStreams.h"
-#include "../../Common/LockedStream.h"
-#include "../../Common/ProgressUtils.h"
-#include "../../Common/StreamObjects.h"
-
-#include "7zDecode.h"
-
-namespace NArchive {
-namespace N7z {
-
-static void ConvertFolderItemInfoToBindInfo(const CFolder &folder,
-    CBindInfoEx &bindInfo)
-{
-  bindInfo.Clear();
-  int i;
-  for (i = 0; i < folder.BindPairs.Size(); i++)
-  {
-    NCoderMixer::CBindPair bindPair;
-    bindPair.InIndex = (UInt32)folder.BindPairs[i].InIndex;
-    bindPair.OutIndex = (UInt32)folder.BindPairs[i].OutIndex;
-    bindInfo.BindPairs.Add(bindPair);
-  }
-  UInt32 outStreamIndex = 0;
-  for (i = 0; i < folder.Coders.Size(); i++)
-  {
-    NCoderMixer::CCoderStreamsInfo coderStreamsInfo;
-    const CCoderInfo &coderInfo = folder.Coders[i];
-    coderStreamsInfo.NumInStreams = (UInt32)coderInfo.NumInStreams;
-    coderStreamsInfo.NumOutStreams = (UInt32)coderInfo.NumOutStreams;
-    bindInfo.Coders.Add(coderStreamsInfo);
-    bindInfo.CoderMethodIDs.Add(coderInfo.MethodID);
-    for (UInt32 j = 0; j < coderStreamsInfo.NumOutStreams; j++, outStreamIndex++)
-      if (folder.FindBindPairForOutStream(outStreamIndex) < 0)
-        bindInfo.OutStreams.Add(outStreamIndex);
-  }
-  for (i = 0; i < folder.PackStreams.Size(); i++)
-    bindInfo.InStreams.Add((UInt32)folder.PackStreams[i]);
-}
-
-static bool AreCodersEqual(const NCoderMixer::CCoderStreamsInfo &a1,
-    const NCoderMixer::CCoderStreamsInfo &a2)
-{
-  return (a1.NumInStreams == a2.NumInStreams) &&
-    (a1.NumOutStreams == a2.NumOutStreams);
-}
-
-static bool AreBindPairsEqual(const NCoderMixer::CBindPair &a1, const NCoderMixer::CBindPair &a2)
-{
-  return (a1.InIndex == a2.InIndex) &&
-    (a1.OutIndex == a2.OutIndex);
-}
-
-static bool AreBindInfoExEqual(const CBindInfoEx &a1, const CBindInfoEx &a2)
-{
-  if (a1.Coders.Size() != a2.Coders.Size())
-    return false;
-  int i;
-  for (i = 0; i < a1.Coders.Size(); i++)
-    if (!AreCodersEqual(a1.Coders[i], a2.Coders[i]))
-      return false;
-  if (a1.BindPairs.Size() != a2.BindPairs.Size())
-    return false;
-  for (i = 0; i < a1.BindPairs.Size(); i++)
-    if (!AreBindPairsEqual(a1.BindPairs[i], a2.BindPairs[i]))
-      return false;
-  for (i = 0; i < a1.CoderMethodIDs.Size(); i++)
-    if (a1.CoderMethodIDs[i] != a2.CoderMethodIDs[i])
-      return false;
-  if (a1.InStreams.Size() != a2.InStreams.Size())
-    return false;
-  if (a1.OutStreams.Size() != a2.OutStreams.Size())
-    return false;
-  return true;
-}
-
-CDecoder::CDecoder(bool multiThread)
-{
-  #ifndef _ST_MODE
-  multiThread = true;
-  #endif
-  _multiThread = multiThread;
-  _bindInfoExPrevIsDefined = false;
-}
-
-HRESULT CDecoder::Decode(
-    DECL_EXTERNAL_CODECS_LOC_VARS
-    IInStream *inStream,
-    UInt64 startPos,
-    const UInt64 *packSizes,
-    const CFolder &folderInfo,
-    ISequentialOutStream *outStream,
-    ICompressProgressInfo *compressProgress
-    #ifndef _NO_CRYPTO
-    , ICryptoGetTextPassword *getTextPassword, bool &passwordIsDefined
-    #endif
-    #ifdef COMPRESS_MT
-    , bool mtMode, UInt32 numThreads
-    #endif
-    )
-{
-  if (!folderInfo.CheckStructure())
-    return E_NOTIMPL;
-  #ifndef _NO_CRYPTO
-  passwordIsDefined = false;
-  #endif
-  CObjectVector< CMyComPtr<ISequentialInStream> > inStreams;
-  
-  CLockedInStream lockedInStream;
-  lockedInStream.Init(inStream);
-  
-  for (int j = 0; j < folderInfo.PackStreams.Size(); j++)
-  {
-    CLockedSequentialInStreamImp *lockedStreamImpSpec = new
-        CLockedSequentialInStreamImp;
-    CMyComPtr<ISequentialInStream> lockedStreamImp = lockedStreamImpSpec;
-    lockedStreamImpSpec->Init(&lockedInStream, startPos);
-    startPos += packSizes[j];
-    
-    CLimitedSequentialInStream *streamSpec = new
-        CLimitedSequentialInStream;
-    CMyComPtr<ISequentialInStream> inStream = streamSpec;
-    streamSpec->SetStream(lockedStreamImp);
-    streamSpec->Init(packSizes[j]);
-    inStreams.Add(inStream);
-  }
-  
-  int numCoders = folderInfo.Coders.Size();
-  
-  CBindInfoEx bindInfo;
-  ConvertFolderItemInfoToBindInfo(folderInfo, bindInfo);
-  bool createNewCoders;
-  if (!_bindInfoExPrevIsDefined)
-    createNewCoders = true;
-  else
-    createNewCoders = !AreBindInfoExEqual(bindInfo, _bindInfoExPrev);
-  if (createNewCoders)
-  {
-    int i;
-    _decoders.Clear();
-    // _decoders2.Clear();
-    
-    _mixerCoder.Release();
-
-    if (_multiThread)
-    {
-      _mixerCoderMTSpec = new NCoderMixer::CCoderMixer2MT;
-      _mixerCoder = _mixerCoderMTSpec;
-      _mixerCoderCommon = _mixerCoderMTSpec;
-    }
-    else
-    {
-      #ifdef _ST_MODE
-      _mixerCoderSTSpec = new NCoderMixer::CCoderMixer2ST;
-      _mixerCoder = _mixerCoderSTSpec;
-      _mixerCoderCommon = _mixerCoderSTSpec;
-      #endif
-    }
-    RINOK(_mixerCoderCommon->SetBindInfo(bindInfo));
-    
-    for (i = 0; i < numCoders; i++)
-    {
-      const CCoderInfo &coderInfo = folderInfo.Coders[i];
-
-  
-      CMyComPtr<ICompressCoder> decoder;
-      CMyComPtr<ICompressCoder2> decoder2;
-      RINOK(CreateCoder(
-          EXTERNAL_CODECS_LOC_VARS
-          coderInfo.MethodID, decoder, decoder2, false));
-      CMyComPtr<IUnknown> decoderUnknown;
-      if (coderInfo.IsSimpleCoder())
-      {
-        if (decoder == 0)
-          return E_NOTIMPL;
-
-        decoderUnknown = (IUnknown *)decoder;
-        
-        if (_multiThread)
-          _mixerCoderMTSpec->AddCoder(decoder);
-        #ifdef _ST_MODE
-        else
-          _mixerCoderSTSpec->AddCoder(decoder, false);
-        #endif
-      }
-      else
-      {
-        if (decoder2 == 0)
-          return E_NOTIMPL;
-        decoderUnknown = (IUnknown *)decoder2;
-        if (_multiThread)
-          _mixerCoderMTSpec->AddCoder2(decoder2);
-        #ifdef _ST_MODE
-        else
-          _mixerCoderSTSpec->AddCoder2(decoder2, false);
-        #endif
-      }
-      _decoders.Add(decoderUnknown);
-      #ifdef EXTERNAL_CODECS
-      CMyComPtr<ISetCompressCodecsInfo> setCompressCodecsInfo;
-      decoderUnknown.QueryInterface(IID_ISetCompressCodecsInfo, (void **)&setCompressCodecsInfo);
-      if (setCompressCodecsInfo)
-      {
-        RINOK(setCompressCodecsInfo->SetCompressCodecsInfo(codecsInfo));
-      }
-      #endif
-    }
-    _bindInfoExPrev = bindInfo;
-    _bindInfoExPrevIsDefined = true;
-  }
-  int i;
-  _mixerCoderCommon->ReInit();
-  
-  UInt32 packStreamIndex = 0, unpackStreamIndex = 0;
-  UInt32 coderIndex = 0;
-  // UInt32 coder2Index = 0;
-  
-  for (i = 0; i < numCoders; i++)
-  {
-    const CCoderInfo &coderInfo = folderInfo.Coders[i];
-    CMyComPtr<IUnknown> &decoder = _decoders[coderIndex];
-    
-    {
-      CMyComPtr<ICompressSetDecoderProperties2> setDecoderProperties;
-      decoder.QueryInterface(IID_ICompressSetDecoderProperties2, &setDecoderProperties);
-      if (setDecoderProperties)
-      {
-        const CByteBuffer &props = coderInfo.Props;
-        size_t size = props.GetCapacity();
-        if (size > 0xFFFFFFFF)
-          return E_NOTIMPL;
-        if (size > 0)
-        {
-          RINOK(setDecoderProperties->SetDecoderProperties2((const Byte *)props, (UInt32)size));
-        }
-      }
-    }
-
-    #ifdef COMPRESS_MT
-    if (mtMode)
-    {
-      CMyComPtr<ICompressSetCoderMt> setCoderMt;
-      decoder.QueryInterface(IID_ICompressSetCoderMt, &setCoderMt);
-      if (setCoderMt)
-      {
-        RINOK(setCoderMt->SetNumberOfThreads(numThreads));
-      }
-    }
-    #endif
-
-    #ifndef _NO_CRYPTO
-    {
-      CMyComPtr<ICryptoSetPassword> cryptoSetPassword;
-      decoder.QueryInterface(IID_ICryptoSetPassword, &cryptoSetPassword);
-      if (cryptoSetPassword)
-      {
-        if (getTextPassword == 0)
-          return E_FAIL;
-        CMyComBSTR passwordBSTR;
-        RINOK(getTextPassword->CryptoGetTextPassword(&passwordBSTR));
-        CByteBuffer buffer;
-        passwordIsDefined = true;
-        const UString password(passwordBSTR);
-        const UInt32 sizeInBytes = password.Length() * 2;
-        buffer.SetCapacity(sizeInBytes);
-        for (int i = 0; i < password.Length(); i++)
-        {
-          wchar_t c = password[i];
-          ((Byte *)buffer)[i * 2] = (Byte)c;
-          ((Byte *)buffer)[i * 2 + 1] = (Byte)(c >> 8);
-        }
-        RINOK(cryptoSetPassword->CryptoSetPassword((const Byte *)buffer, sizeInBytes));
-      }
-    }
-    #endif
-
-    coderIndex++;
-    
-    UInt32 numInStreams = (UInt32)coderInfo.NumInStreams;
-    UInt32 numOutStreams = (UInt32)coderInfo.NumOutStreams;
-    CRecordVector<const UInt64 *> packSizesPointers;
-    CRecordVector<const UInt64 *> unpackSizesPointers;
-    packSizesPointers.Reserve(numInStreams);
-    unpackSizesPointers.Reserve(numOutStreams);
-    UInt32 j;
-    for (j = 0; j < numOutStreams; j++, unpackStreamIndex++)
-      unpackSizesPointers.Add(&folderInfo.UnpackSizes[unpackStreamIndex]);
-    
-    for (j = 0; j < numInStreams; j++, packStreamIndex++)
-    {
-      int bindPairIndex = folderInfo.FindBindPairForInStream(packStreamIndex);
-      if (bindPairIndex >= 0)
-        packSizesPointers.Add(
-        &folderInfo.UnpackSizes[(UInt32)folderInfo.BindPairs[bindPairIndex].OutIndex]);
-      else
-      {
-        int index = folderInfo.FindPackStreamArrayIndex(packStreamIndex);
-        if (index < 0)
-          return E_FAIL;
-        packSizesPointers.Add(&packSizes[index]);
-      }
-    }
-    
-    _mixerCoderCommon->SetCoderInfo(i,
-        &packSizesPointers.Front(),
-        &unpackSizesPointers.Front());
-  }
-  UInt32 mainCoder, temp;
-  bindInfo.FindOutStream(bindInfo.OutStreams[0], mainCoder, temp);
-
-  if (_multiThread)
-    _mixerCoderMTSpec->SetProgressCoderIndex(mainCoder);
-  /*
-  else
-    _mixerCoderSTSpec->SetProgressCoderIndex(mainCoder);;
-  */
-  
-  if (numCoders == 0)
-    return 0;
-  CRecordVector<ISequentialInStream *> inStreamPointers;
-  inStreamPointers.Reserve(inStreams.Size());
-  for (i = 0; i < inStreams.Size(); i++)
-    inStreamPointers.Add(inStreams[i]);
-  ISequentialOutStream *outStreamPointer = outStream;
-  return _mixerCoder->Code(&inStreamPointers.Front(), NULL,
-    inStreams.Size(), &outStreamPointer, NULL, 1, compressProgress);
-}
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zDecode.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zDecode.h
deleted file mode 100644
index 1057a52..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zDecode.h
+++ /dev/null
@@ -1,68 +0,0 @@
-// 7zDecode.h
-
-#ifndef __7Z_DECODE_H
-#define __7Z_DECODE_H
-
-#include "../../IStream.h"
-#include "../../IPassword.h"
-
-#include "../Common/CoderMixer2.h"
-#include "../Common/CoderMixer2MT.h"
-#ifdef _ST_MODE
-#include "../Common/CoderMixer2ST.h"
-#endif
-
-#include "../../Common/CreateCoder.h"
-
-#include "7zItem.h"
-
-namespace NArchive {
-namespace N7z {
-
-struct CBindInfoEx: public NCoderMixer::CBindInfo
-{
-  CRecordVector<CMethodId> CoderMethodIDs;
-  void Clear()
-  {
-    CBindInfo::Clear();
-    CoderMethodIDs.Clear();
-  }
-};
-
-class CDecoder
-{
-  bool _bindInfoExPrevIsDefined;
-  CBindInfoEx _bindInfoExPrev;
-  
-  bool _multiThread;
-  #ifdef _ST_MODE
-  NCoderMixer::CCoderMixer2ST *_mixerCoderSTSpec;
-  #endif
-  NCoderMixer::CCoderMixer2MT *_mixerCoderMTSpec;
-  NCoderMixer::CCoderMixer2 *_mixerCoderCommon;
-  
-  CMyComPtr<ICompressCoder2> _mixerCoder;
-  CObjectVector<CMyComPtr<IUnknown> > _decoders;
-  // CObjectVector<CMyComPtr<ICompressCoder2> > _decoders2;
-public:
-  CDecoder(bool multiThread);
-  HRESULT Decode(
-      DECL_EXTERNAL_CODECS_LOC_VARS
-      IInStream *inStream,
-      UInt64 startPos,
-      const UInt64 *packSizes,
-      const CFolder &folder,
-      ISequentialOutStream *outStream,
-      ICompressProgressInfo *compressProgress
-      #ifndef _NO_CRYPTO
-      , ICryptoGetTextPassword *getTextPasswordSpec, bool &passwordIsDefined
-      #endif
-      #ifdef COMPRESS_MT
-      , bool mtMode, UInt32 numThreads
-      #endif
-      );
-};
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zEncode.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zEncode.cpp
deleted file mode 100644
index 0180384..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zEncode.cpp
+++ /dev/null
@@ -1,453 +0,0 @@
-// Encode.cpp
-
-#include "StdAfx.h"
-
-#include "7zEncode.h"
-#include "7zSpecStream.h"
-
-#include "../../IPassword.h"
-#include "../../Common/ProgressUtils.h"
-#include "../../Common/LimitedStreams.h"
-#include "../../Common/InOutTempBuffer.h"
-#include "../../Common/StreamObjects.h"
-#include "../../Common/CreateCoder.h"
-#include "../../Common/FilterCoder.h"
-
-static const UInt64 k_AES = 0x06F10701;
-static const UInt64 k_BCJ  = 0x03030103;
-static const UInt64 k_BCJ2 = 0x0303011B;
-
-namespace NArchive {
-namespace N7z {
-
-static void ConvertBindInfoToFolderItemInfo(const NCoderMixer::CBindInfo &bindInfo,
-    const CRecordVector<CMethodId> decompressionMethods,
-    CFolder &folder)
-{
-  folder.Coders.Clear();
-  // bindInfo.CoderMethodIDs.Clear();
-  // folder.OutStreams.Clear();
-  folder.PackStreams.Clear();
-  folder.BindPairs.Clear();
-  int i;
-  for (i = 0; i < bindInfo.BindPairs.Size(); i++)
-  {
-    CBindPair bindPair;
-    bindPair.InIndex = bindInfo.BindPairs[i].InIndex;
-    bindPair.OutIndex = bindInfo.BindPairs[i].OutIndex;
-    folder.BindPairs.Add(bindPair);
-  }
-  for (i = 0; i < bindInfo.Coders.Size(); i++)
-  {
-    CCoderInfo coderInfo;
-    const NCoderMixer::CCoderStreamsInfo &coderStreamsInfo = bindInfo.Coders[i];
-    coderInfo.NumInStreams = coderStreamsInfo.NumInStreams;
-    coderInfo.NumOutStreams = coderStreamsInfo.NumOutStreams;
-    coderInfo.MethodID = decompressionMethods[i];
-    folder.Coders.Add(coderInfo);
-  }
-  for (i = 0; i < bindInfo.InStreams.Size(); i++)
-    folder.PackStreams.Add(bindInfo.InStreams[i]);
-}
-
-HRESULT CEncoder::CreateMixerCoder(
-    DECL_EXTERNAL_CODECS_LOC_VARS
-    const UInt64 *inSizeForReduce)
-{
-  _mixerCoderSpec = new NCoderMixer::CCoderMixer2MT;
-  _mixerCoder = _mixerCoderSpec;
-  RINOK(_mixerCoderSpec->SetBindInfo(_bindInfo));
-  for (int i = 0; i < _options.Methods.Size(); i++)
-  {
-    const CMethodFull &methodFull = _options.Methods[i];
-    _codersInfo.Add(CCoderInfo());
-    CCoderInfo &encodingInfo = _codersInfo.Back();
-    encodingInfo.MethodID = methodFull.Id;
-    CMyComPtr<ICompressCoder> encoder;
-    CMyComPtr<ICompressCoder2> encoder2;
-    
-
-    RINOK(CreateCoder(
-        EXTERNAL_CODECS_LOC_VARS
-        methodFull.Id, encoder, encoder2, true));
-
-    if (!encoder && !encoder2)
-      return E_FAIL;
-
-    CMyComPtr<IUnknown> encoderCommon = encoder ? (IUnknown *)encoder : (IUnknown *)encoder2;
-   
-    #ifdef COMPRESS_MT
-    {
-      CMyComPtr<ICompressSetCoderMt> setCoderMt;
-      encoderCommon.QueryInterface(IID_ICompressSetCoderMt, &setCoderMt);
-      if (setCoderMt)
-      {
-        RINOK(setCoderMt->SetNumberOfThreads(_options.NumThreads));
-      }
-    }
-    #endif
-        
-
-    RINOK(SetMethodProperties(methodFull, inSizeForReduce, encoderCommon));
-
-    /*
-    CMyComPtr<ICryptoResetSalt> resetSalt;
-    encoderCommon.QueryInterface(IID_ICryptoResetSalt, (void **)&resetSalt);
-    if (resetSalt != NULL)
-    {
-      resetSalt->ResetSalt();
-    }
-    */
-
-    #ifdef EXTERNAL_CODECS
-    CMyComPtr<ISetCompressCodecsInfo> setCompressCodecsInfo;
-    encoderCommon.QueryInterface(IID_ISetCompressCodecsInfo, (void **)&setCompressCodecsInfo);
-    if (setCompressCodecsInfo)
-    {
-      RINOK(setCompressCodecsInfo->SetCompressCodecsInfo(codecsInfo));
-    }
-    #endif
-    
-    CMyComPtr<ICryptoSetPassword> cryptoSetPassword;
-    encoderCommon.QueryInterface(IID_ICryptoSetPassword, &cryptoSetPassword);
-
-    if (cryptoSetPassword)
-    {
-      CByteBuffer buffer;
-      const UInt32 sizeInBytes = _options.Password.Length() * 2;
-      buffer.SetCapacity(sizeInBytes);
-      for (int i = 0; i < _options.Password.Length(); i++)
-      {
-        wchar_t c = _options.Password[i];
-        ((Byte *)buffer)[i * 2] = (Byte)c;
-        ((Byte *)buffer)[i * 2 + 1] = (Byte)(c >> 8);
-      }
-      RINOK(cryptoSetPassword->CryptoSetPassword((const Byte *)buffer, sizeInBytes));
-    }
-
-    if (encoder)
-      _mixerCoderSpec->AddCoder(encoder);
-    else
-      _mixerCoderSpec->AddCoder2(encoder2);
-  }
-  return S_OK;
-}
-
-HRESULT CEncoder::Encode(
-    DECL_EXTERNAL_CODECS_LOC_VARS
-    ISequentialInStream *inStream,
-    const UInt64 *inStreamSize, const UInt64 *inSizeForReduce,
-    CFolder &folderItem,
-    ISequentialOutStream *outStream,
-    CRecordVector<UInt64> &packSizes,
-    ICompressProgressInfo *compressProgress)
-{
-  RINOK(EncoderConstr());
-
-  if (_mixerCoderSpec == NULL)
-  {
-    RINOK(CreateMixerCoder(EXTERNAL_CODECS_LOC_VARS inSizeForReduce));
-  }
-  _mixerCoderSpec->ReInit();
-  // _mixerCoderSpec->SetCoderInfo(0, NULL, NULL, progress);
-
-  CObjectVector<CInOutTempBuffer> inOutTempBuffers;
-  CObjectVector<CSequentialOutTempBufferImp *> tempBufferSpecs;
-  CObjectVector<CMyComPtr<ISequentialOutStream> > tempBuffers;
-  int numMethods = _bindInfo.Coders.Size();
-  int i;
-  for (i = 1; i < _bindInfo.OutStreams.Size(); i++)
-  {
-    inOutTempBuffers.Add(CInOutTempBuffer());
-    inOutTempBuffers.Back().Create();
-    inOutTempBuffers.Back().InitWriting();
-  }
-  for (i = 1; i < _bindInfo.OutStreams.Size(); i++)
-  {
-    CSequentialOutTempBufferImp *tempBufferSpec =
-        new CSequentialOutTempBufferImp;
-    CMyComPtr<ISequentialOutStream> tempBuffer = tempBufferSpec;
-    tempBufferSpec->Init(&inOutTempBuffers[i - 1]);
-    tempBuffers.Add(tempBuffer);
-    tempBufferSpecs.Add(tempBufferSpec);
-  }
-
-  for (i = 0; i < numMethods; i++)
-    _mixerCoderSpec->SetCoderInfo(i, NULL, NULL);
-
-  if (_bindInfo.InStreams.IsEmpty())
-    return E_FAIL;
-  UInt32 mainCoderIndex, mainStreamIndex;
-  _bindInfo.FindInStream(_bindInfo.InStreams[0], mainCoderIndex, mainStreamIndex);
-  
-  if (inStreamSize != NULL)
-  {
-    CRecordVector<const UInt64 *> sizePointers;
-    for (UInt32 i = 0; i < _bindInfo.Coders[mainCoderIndex].NumInStreams; i++)
-      if (i == mainStreamIndex)
-        sizePointers.Add(inStreamSize);
-      else
-        sizePointers.Add(NULL);
-    _mixerCoderSpec->SetCoderInfo(mainCoderIndex, &sizePointers.Front(), NULL);
-  }
-
-  
-  // UInt64 outStreamStartPos;
-  // RINOK(stream->Seek(0, STREAM_SEEK_CUR, &outStreamStartPos));
-  
-  CSequentialInStreamSizeCount2 *inStreamSizeCountSpec =
-      new CSequentialInStreamSizeCount2;
-  CMyComPtr<ISequentialInStream> inStreamSizeCount = inStreamSizeCountSpec;
-  CSequentialOutStreamSizeCount *outStreamSizeCountSpec =
-      new CSequentialOutStreamSizeCount;
-  CMyComPtr<ISequentialOutStream> outStreamSizeCount = outStreamSizeCountSpec;
-
-  inStreamSizeCountSpec->Init(inStream);
-  outStreamSizeCountSpec->SetStream(outStream);
-  outStreamSizeCountSpec->Init();
-
-  CRecordVector<ISequentialInStream *> inStreamPointers;
-  CRecordVector<ISequentialOutStream *> outStreamPointers;
-  inStreamPointers.Add(inStreamSizeCount);
-  outStreamPointers.Add(outStreamSizeCount);
-  for (i = 1; i < _bindInfo.OutStreams.Size(); i++)
-    outStreamPointers.Add(tempBuffers[i - 1]);
-
-  for (i = 0; i < _codersInfo.Size(); i++)
-  {
-    CCoderInfo &encodingInfo = _codersInfo[i];
-    
-    CMyComPtr<ICryptoResetInitVector> resetInitVector;
-    _mixerCoderSpec->_coders[i].QueryInterface(IID_ICryptoResetInitVector, (void **)&resetInitVector);
-    if (resetInitVector != NULL)
-    {
-      resetInitVector->ResetInitVector();
-    }
-
-    CMyComPtr<ICompressWriteCoderProperties> writeCoderProperties;
-    _mixerCoderSpec->_coders[i].QueryInterface(IID_ICompressWriteCoderProperties, (void **)&writeCoderProperties);
-    if (writeCoderProperties != NULL)
-    {
-      CSequentialOutStreamImp *outStreamSpec = new CSequentialOutStreamImp;
-      CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
-      outStreamSpec->Init();
-      writeCoderProperties->WriteCoderProperties(outStream);
-      size_t size = outStreamSpec->GetSize();
-      encodingInfo.Props.SetCapacity(size);
-      memmove(encodingInfo.Props, outStreamSpec->GetBuffer(), size);
-    }
-  }
-
-  UInt32 progressIndex = mainCoderIndex;
-
-  for (i = 0; i < _codersInfo.Size(); i++)
-  {
-    const CCoderInfo &e = _codersInfo[i];
-    if ((e.MethodID == k_BCJ || e.MethodID == k_BCJ2) && i + 1 < _codersInfo.Size())
-      progressIndex = i + 1;
-  }
-
-  _mixerCoderSpec->SetProgressCoderIndex(progressIndex);
-  
-  RINOK(_mixerCoder->Code(&inStreamPointers.Front(), NULL, 1,
-    &outStreamPointers.Front(), NULL, outStreamPointers.Size(), compressProgress));
-  
-  ConvertBindInfoToFolderItemInfo(_decompressBindInfo, _decompressionMethods,
-      folderItem);
-  
-  packSizes.Add(outStreamSizeCountSpec->GetSize());
-  
-  for (i = 1; i < _bindInfo.OutStreams.Size(); i++)
-  {
-    CInOutTempBuffer &inOutTempBuffer = inOutTempBuffers[i - 1];
-    inOutTempBuffer.FlushWrite();
-    inOutTempBuffer.InitReading();
-    inOutTempBuffer.WriteToStream(outStream);
-    packSizes.Add(inOutTempBuffer.GetDataSize());
-  }
-  
-  for (i = 0; i < (int)_bindReverseConverter->NumSrcInStreams; i++)
-  {
-    int binder = _bindInfo.FindBinderForInStream(
-        _bindReverseConverter->DestOutToSrcInMap[i]);
-    UInt64 streamSize;
-    if (binder < 0)
-      streamSize = inStreamSizeCountSpec->GetSize();
-    else
-      streamSize = _mixerCoderSpec->GetWriteProcessedSize(binder);
-    folderItem.UnpackSizes.Add(streamSize);
-  }
-  for (i = numMethods - 1; i >= 0; i--)
-    folderItem.Coders[numMethods - 1 - i].Props = _codersInfo[i].Props;
-  return S_OK;
-}
-
-
-CEncoder::CEncoder(const CCompressionMethodMode &options):
-  _bindReverseConverter(0),
-  _constructed(false)
-{
-  if (options.IsEmpty())
-    throw 1;
-
-  _options = options;
-  _mixerCoderSpec = NULL;
-}
-
-HRESULT CEncoder::EncoderConstr()
-{
-  if (_constructed)
-    return S_OK;
-  if (_options.Methods.IsEmpty())
-  {
-    // it has only password method;
-    if (!_options.PasswordIsDefined)
-      throw 1;
-    if (!_options.Binds.IsEmpty())
-      throw 1;
-    NCoderMixer::CCoderStreamsInfo coderStreamsInfo;
-    CMethodFull method;
-    
-    method.NumInStreams = 1;
-    method.NumOutStreams = 1;
-    coderStreamsInfo.NumInStreams = 1;
-    coderStreamsInfo.NumOutStreams = 1;
-    method.Id = k_AES;
-    
-    _options.Methods.Add(method);
-    _bindInfo.Coders.Add(coderStreamsInfo);
-  
-    _bindInfo.InStreams.Add(0);
-    _bindInfo.OutStreams.Add(0);
-  }
-  else
-  {
-
-  UInt32 numInStreams = 0, numOutStreams = 0;
-  int i;
-  for (i = 0; i < _options.Methods.Size(); i++)
-  {
-    const CMethodFull &methodFull = _options.Methods[i];
-    NCoderMixer::CCoderStreamsInfo coderStreamsInfo;
-    coderStreamsInfo.NumInStreams = methodFull.NumOutStreams;
-    coderStreamsInfo.NumOutStreams = methodFull.NumInStreams;
-    if (_options.Binds.IsEmpty())
-    {
-      if (i < _options.Methods.Size() - 1)
-      {
-        NCoderMixer::CBindPair bindPair;
-        bindPair.InIndex = numInStreams + coderStreamsInfo.NumInStreams;
-        bindPair.OutIndex = numOutStreams;
-        _bindInfo.BindPairs.Add(bindPair);
-      }
-      else
-        _bindInfo.OutStreams.Insert(0, numOutStreams);
-      for (UInt32 j = 1; j < coderStreamsInfo.NumOutStreams; j++)
-        _bindInfo.OutStreams.Add(numOutStreams + j);
-    }
-    
-    numInStreams += coderStreamsInfo.NumInStreams;
-    numOutStreams += coderStreamsInfo.NumOutStreams;
-
-    _bindInfo.Coders.Add(coderStreamsInfo);
-  }
-
-  if (!_options.Binds.IsEmpty())
-  {
-    for (i = 0; i < _options.Binds.Size(); i++)
-    {
-      NCoderMixer::CBindPair bindPair;
-      const CBind &bind = _options.Binds[i];
-      bindPair.InIndex = _bindInfo.GetCoderInStreamIndex(bind.InCoder) + bind.InStream;
-      bindPair.OutIndex = _bindInfo.GetCoderOutStreamIndex(bind.OutCoder) + bind.OutStream;
-      _bindInfo.BindPairs.Add(bindPair);
-    }
-    for (i = 0; i < (int)numOutStreams; i++)
-      if (_bindInfo.FindBinderForOutStream(i) == -1)
-        _bindInfo.OutStreams.Add(i);
-  }
-
-  for (i = 0; i < (int)numInStreams; i++)
-    if (_bindInfo.FindBinderForInStream(i) == -1)
-      _bindInfo.InStreams.Add(i);
-
-  if (_bindInfo.InStreams.IsEmpty())
-    throw 1; // this is error
-
-  // Make main stream first in list
-  int inIndex = _bindInfo.InStreams[0];
-  for (;;)
-  {
-    UInt32 coderIndex, coderStreamIndex;
-    _bindInfo.FindInStream(inIndex, coderIndex, coderStreamIndex);
-    UInt32 outIndex = _bindInfo.GetCoderOutStreamIndex(coderIndex);
-    int binder = _bindInfo.FindBinderForOutStream(outIndex);
-    if (binder >= 0)
-    {
-      inIndex = _bindInfo.BindPairs[binder].InIndex;
-      continue;
-    }
-    for (i = 0; i < _bindInfo.OutStreams.Size(); i++)
-      if (_bindInfo.OutStreams[i] == outIndex)
-      {
-        _bindInfo.OutStreams.Delete(i);
-        _bindInfo.OutStreams.Insert(0, outIndex);
-        break;
-      }
-    break;
-  }
-
-  if (_options.PasswordIsDefined)
-  {
-    int numCryptoStreams = _bindInfo.OutStreams.Size();
-
-    for (i = 0; i < numCryptoStreams; i++)
-    {
-      NCoderMixer::CBindPair bindPair;
-      bindPair.InIndex = numInStreams + i;
-      bindPair.OutIndex = _bindInfo.OutStreams[i];
-      _bindInfo.BindPairs.Add(bindPair);
-    }
-    _bindInfo.OutStreams.Clear();
-
-    /*
-    if (numCryptoStreams == 0)
-      numCryptoStreams = 1;
-    */
-
-    for (i = 0; i < numCryptoStreams; i++)
-    {
-      NCoderMixer::CCoderStreamsInfo coderStreamsInfo;
-      CMethodFull method;
-      method.NumInStreams = 1;
-      method.NumOutStreams = 1;
-      coderStreamsInfo.NumInStreams = method.NumOutStreams;
-      coderStreamsInfo.NumOutStreams = method.NumInStreams;
-      method.Id = k_AES;
-
-      _options.Methods.Add(method);
-      _bindInfo.Coders.Add(coderStreamsInfo);
-      _bindInfo.OutStreams.Add(numOutStreams + i);
-    }
-  }
-
-  }
-
-  for (int i = _options.Methods.Size() - 1; i >= 0; i--)
-  {
-    const CMethodFull &methodFull = _options.Methods[i];
-    _decompressionMethods.Add(methodFull.Id);
-  }
-
-  _bindReverseConverter = new NCoderMixer::CBindReverseConverter(_bindInfo);
-  _bindReverseConverter->CreateReverseBindInfo(_decompressBindInfo);
-  _constructed = true;
-  return S_OK;
-}
-
-CEncoder::~CEncoder()
-{
-  delete _bindReverseConverter;
-}
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zEncode.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zEncode.h
deleted file mode 100644
index 4909a6e..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zEncode.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// 7zEncode.h
-
-#ifndef __7Z_ENCODE_H
-#define __7Z_ENCODE_H
-
-// #include "../../Common/StreamObjects.h"
-
-#include "7zCompressionMode.h"
-
-#include "../Common/CoderMixer2.h"
-#include "../Common/CoderMixer2MT.h"
-#ifdef _ST_MODE
-#include "../Common/CoderMixer2ST.h"
-#endif
-#include "7zItem.h"
-
-#include "../../Common/CreateCoder.h"
-
-namespace NArchive {
-namespace N7z {
-
-class CEncoder
-{
-  NCoderMixer::CCoderMixer2MT *_mixerCoderSpec;
-  CMyComPtr<ICompressCoder2> _mixerCoder;
-
-  CObjectVector<CCoderInfo> _codersInfo;
-
-  CCompressionMethodMode _options;
-  NCoderMixer::CBindInfo _bindInfo;
-  NCoderMixer::CBindInfo _decompressBindInfo;
-  NCoderMixer::CBindReverseConverter *_bindReverseConverter;
-  CRecordVector<CMethodId> _decompressionMethods;
-
-  HRESULT CreateMixerCoder(DECL_EXTERNAL_CODECS_LOC_VARS
-      const UInt64 *inSizeForReduce);
-
-  bool _constructed;
-public:
-  CEncoder(const CCompressionMethodMode &options);
-  ~CEncoder();
-  HRESULT EncoderConstr();
-  HRESULT Encode(
-      DECL_EXTERNAL_CODECS_LOC_VARS
-      ISequentialInStream *inStream,
-      const UInt64 *inStreamSize, const UInt64 *inSizeForReduce,
-      CFolder &folderItem,
-      ISequentialOutStream *outStream,
-      CRecordVector<UInt64> &packSizes,
-      ICompressProgressInfo *compressProgress);
-};
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zExtract.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zExtract.cpp
deleted file mode 100644
index 06e9ef9..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zExtract.cpp
+++ /dev/null
@@ -1,273 +0,0 @@
-// 7zExtract.cpp
-
-#include "StdAfx.h"
-
-#include "7zHandler.h"
-#include "7zFolderOutStream.h"
-#include "7zDecode.h"
-// #include "7z1Decode.h"
-
-#include "../../../Common/ComTry.h"
-#include "../../Common/StreamObjects.h"
-#include "../../Common/ProgressUtils.h"
-#include "../../Common/LimitedStreams.h"
-
-namespace NArchive {
-namespace N7z {
-
-struct CExtractFolderInfo
-{
-  #ifdef _7Z_VOL
-  int VolumeIndex;
-  #endif
-  CNum FileIndex;
-  CNum FolderIndex;
-  CBoolVector ExtractStatuses;
-  UInt64 UnpackSize;
-  CExtractFolderInfo(
-    #ifdef _7Z_VOL
-    int volumeIndex,
-    #endif
-    CNum fileIndex, CNum folderIndex):
-    #ifdef _7Z_VOL
-    VolumeIndex(volumeIndex),
-    #endif
-    FileIndex(fileIndex),
-    FolderIndex(folderIndex),
-    UnpackSize(0)
-  {
-    if (fileIndex != kNumNoIndex)
-    {
-      ExtractStatuses.Reserve(1);
-      ExtractStatuses.Add(true);
-    }
-  };
-};
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
-    Int32 testModeSpec, IArchiveExtractCallback *extractCallbackSpec)
-{
-  COM_TRY_BEGIN
-  bool testMode = (testModeSpec != 0);
-  CMyComPtr<IArchiveExtractCallback> extractCallback = extractCallbackSpec;
-  UInt64 importantTotalUnpacked = 0;
-
-  bool allFilesMode = (numItems == UInt32(-1));
-  if (allFilesMode)
-    numItems =
-    #ifdef _7Z_VOL
-    _refs.Size();
-    #else
-    _db.Files.Size();
-    #endif
-
-  if(numItems == 0)
-    return S_OK;
-
-  /*
-  if(_volumes.Size() != 1)
-    return E_FAIL;
-  const CVolume &volume = _volumes.Front();
-  const CArchiveDatabaseEx &_db = volume.Database;
-  IInStream *_inStream = volume.Stream;
-  */
-  
-  CObjectVector<CExtractFolderInfo> extractFolderInfoVector;
-  for(UInt32 ii = 0; ii < numItems; ii++)
-  {
-    // UInt32 fileIndex = allFilesMode ? indexIndex : indices[indexIndex];
-    UInt32 ref2Index = allFilesMode ? ii : indices[ii];
-    // const CRef2 &ref2 = _refs[ref2Index];
-
-    // for(UInt32 ri = 0; ri < ref2.Refs.Size(); ri++)
-    {
-      #ifdef _7Z_VOL
-      // const CRef &ref = ref2.Refs[ri];
-      const CRef &ref = _refs[ref2Index];
-
-      int volumeIndex = ref.VolumeIndex;
-      const CVolume &volume = _volumes[volumeIndex];
-      const CArchiveDatabaseEx &db = volume.Database;
-      UInt32 fileIndex = ref.ItemIndex;
-      #else
-      const CArchiveDatabaseEx &db = _db;
-      UInt32 fileIndex = ref2Index;
-      #endif
-
-      CNum folderIndex = db.FileIndexToFolderIndexMap[fileIndex];
-      if (folderIndex == kNumNoIndex)
-      {
-        extractFolderInfoVector.Add(CExtractFolderInfo(
-            #ifdef _7Z_VOL
-            volumeIndex,
-            #endif
-            fileIndex, kNumNoIndex));
-        continue;
-      }
-      if (extractFolderInfoVector.IsEmpty() ||
-        folderIndex != extractFolderInfoVector.Back().FolderIndex
-        #ifdef _7Z_VOL
-        || volumeIndex != extractFolderInfoVector.Back().VolumeIndex
-        #endif
-        )
-      {
-        extractFolderInfoVector.Add(CExtractFolderInfo(
-            #ifdef _7Z_VOL
-            volumeIndex,
-            #endif
-            kNumNoIndex, folderIndex));
-        const CFolder &folderInfo = db.Folders[folderIndex];
-        UInt64 unpackSize = folderInfo.GetUnpackSize();
-        importantTotalUnpacked += unpackSize;
-        extractFolderInfoVector.Back().UnpackSize = unpackSize;
-      }
-      
-      CExtractFolderInfo &efi = extractFolderInfoVector.Back();
-      
-      // const CFolderInfo &folderInfo = m_dam_Folders[folderIndex];
-      CNum startIndex = db.FolderStartFileIndex[folderIndex];
-      for (CNum index = efi.ExtractStatuses.Size();
-          index <= fileIndex - startIndex; index++)
-      {
-        // UInt64 unpackSize = _db.Files[startIndex + index].UnpackSize;
-        // Count partial_folder_size
-        // efi.UnpackSize += unpackSize;
-        // importantTotalUnpacked += unpackSize;
-        efi.ExtractStatuses.Add(index == fileIndex - startIndex);
-      }
-    }
-  }
-
-  extractCallback->SetTotal(importantTotalUnpacked);
-
-  CDecoder decoder(
-    #ifdef _ST_MODE
-    false
-    #else
-    true
-    #endif
-    );
-  // CDecoder1 decoder;
-
-  UInt64 currentTotalPacked = 0;
-  UInt64 currentTotalUnpacked = 0;
-  UInt64 totalFolderUnpacked;
-  UInt64 totalFolderPacked;
-
-  CLocalProgress *lps = new CLocalProgress;
-  CMyComPtr<ICompressProgressInfo> progress = lps;
-  lps->Init(extractCallback, false);
-
-  for(int i = 0; i < extractFolderInfoVector.Size(); i++,
-      currentTotalUnpacked += totalFolderUnpacked,
-      currentTotalPacked += totalFolderPacked)
-  {
-    lps->OutSize = currentTotalUnpacked;
-    lps->InSize = currentTotalPacked;
-    RINOK(lps->SetCur());
-    
-    const CExtractFolderInfo &efi = extractFolderInfoVector[i];
-    totalFolderUnpacked = efi.UnpackSize;
-
-    totalFolderPacked = 0;
-
-    CFolderOutStream *folderOutStream = new CFolderOutStream;
-    CMyComPtr<ISequentialOutStream> outStream(folderOutStream);
-
-    #ifdef _7Z_VOL
-    const CVolume &volume = _volumes[efi.VolumeIndex];
-    const CArchiveDatabaseEx &db = volume.Database;
-    #else
-    const CArchiveDatabaseEx &db = _db;
-    #endif
-
-    CNum startIndex;
-    if (efi.FileIndex != kNumNoIndex)
-      startIndex = efi.FileIndex;
-    else
-      startIndex = db.FolderStartFileIndex[efi.FolderIndex];
-
-
-    HRESULT result = folderOutStream->Init(&db,
-        #ifdef _7Z_VOL
-        volume.StartRef2Index,
-        #else
-        0,
-        #endif
-        startIndex,
-        &efi.ExtractStatuses, extractCallback, testMode, _crcSize != 0);
-
-    RINOK(result);
-
-    if (efi.FileIndex != kNumNoIndex)
-      continue;
-
-    CNum folderIndex = efi.FolderIndex;
-    const CFolder &folderInfo = db.Folders[folderIndex];
-
-    totalFolderPacked = _db.GetFolderFullPackSize(folderIndex);
-
-    CNum packStreamIndex = db.FolderStartPackStreamIndex[folderIndex];
-    UInt64 folderStartPackPos = db.GetFolderStreamPos(folderIndex, 0);
-
-    #ifndef _NO_CRYPTO
-    CMyComPtr<ICryptoGetTextPassword> getTextPassword;
-    if (extractCallback)
-      extractCallback.QueryInterface(IID_ICryptoGetTextPassword, &getTextPassword);
-    #endif
-
-    try
-    {
-      #ifndef _NO_CRYPTO
-      bool passwordIsDefined;
-      #endif
-
-      HRESULT result = decoder.Decode(
-          EXTERNAL_CODECS_VARS
-          #ifdef _7Z_VOL
-          volume.Stream,
-          #else
-          _inStream,
-          #endif
-          folderStartPackPos,
-          &db.PackSizes[packStreamIndex],
-          folderInfo,
-          outStream,
-          progress
-          #ifndef _NO_CRYPTO
-          , getTextPassword, passwordIsDefined
-          #endif
-          #ifdef COMPRESS_MT
-          , true, _numThreads
-          #endif
-          );
-
-      if (result == S_FALSE)
-      {
-        RINOK(folderOutStream->FlushCorrupted(NArchive::NExtract::NOperationResult::kDataError));
-        continue;
-      }
-      if (result == E_NOTIMPL)
-      {
-        RINOK(folderOutStream->FlushCorrupted(NArchive::NExtract::NOperationResult::kUnSupportedMethod));
-        continue;
-      }
-      if (result != S_OK)
-        return result;
-      if (folderOutStream->WasWritingFinished() != S_OK)
-      {
-        RINOK(folderOutStream->FlushCorrupted(NArchive::NExtract::NOperationResult::kDataError));
-        continue;
-      }
-    }
-    catch(...)
-    {
-      RINOK(folderOutStream->FlushCorrupted(NArchive::NExtract::NOperationResult::kDataError));
-      continue;
-    }
-  }
-  return S_OK;
-  COM_TRY_END
-}
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zFolderInStream.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zFolderInStream.cpp
deleted file mode 100644
index b029ae1..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zFolderInStream.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-// 7zFolderInStream.cpp
-
-#include "StdAfx.h"
-
-#include "7zFolderInStream.h"
-
-namespace NArchive {
-namespace N7z {
-
-CFolderInStream::CFolderInStream()
-{
-  _inStreamWithHashSpec = new CSequentialInStreamWithCRC;
-  _inStreamWithHash = _inStreamWithHashSpec;
-}
-
-void CFolderInStream::Init(IArchiveUpdateCallback *updateCallback,
-    const UInt32 *fileIndices, UInt32 numFiles)
-{
-  _updateCallback = updateCallback;
-  _numFiles = numFiles;
-  _fileIndex = 0;
-  _fileIndices = fileIndices;
-  Processed.Clear();
-  CRCs.Clear();
-  Sizes.Clear();
-  _fileIsOpen = false;
-  _currentSizeIsDefined = false;
-}
-
-HRESULT CFolderInStream::OpenStream()
-{
-  _filePos = 0;
-  while (_fileIndex < _numFiles)
-  {
-    _currentSizeIsDefined = false;
-    CMyComPtr<ISequentialInStream> stream;
-    HRESULT result = _updateCallback->GetStream(_fileIndices[_fileIndex], &stream);
-    if (result != S_OK && result != S_FALSE)
-      return result;
-    _fileIndex++;
-    _inStreamWithHashSpec->SetStream(stream);
-    _inStreamWithHashSpec->Init();
-    if (!stream)
-    {
-      RINOK(_updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK));
-      Sizes.Add(0);
-      Processed.Add(result == S_OK);
-      AddDigest();
-      continue;
-    }
-    CMyComPtr<IStreamGetSize> streamGetSize;
-    if (stream.QueryInterface(IID_IStreamGetSize, &streamGetSize) == S_OK)
-    {
-      if(streamGetSize)
-      {
-        _currentSizeIsDefined = true;
-        RINOK(streamGetSize->GetSize(&_currentSize));
-      }
-    }
-
-    _fileIsOpen = true;
-    return S_OK;
-  }
-  return S_OK;
-}
-
-void CFolderInStream::AddDigest()
-{
-  CRCs.Add(_inStreamWithHashSpec->GetCRC());
-}
-
-HRESULT CFolderInStream::CloseStream()
-{
-  RINOK(_updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK));
-  _inStreamWithHashSpec->ReleaseStream();
-  _fileIsOpen = false;
-  Processed.Add(true);
-  Sizes.Add(_filePos);
-  AddDigest();
-  return S_OK;
-}
-
-STDMETHODIMP CFolderInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
-  UInt32 realProcessedSize = 0;
-  while ((_fileIndex < _numFiles || _fileIsOpen) && size > 0)
-  {
-    if (_fileIsOpen)
-    {
-      UInt32 localProcessedSize;
-      RINOK(_inStreamWithHash->Read(
-          ((Byte *)data) + realProcessedSize, size, &localProcessedSize));
-      if (localProcessedSize == 0)
-      {
-        RINOK(CloseStream());
-        continue;
-      }
-      realProcessedSize += localProcessedSize;
-      _filePos += localProcessedSize;
-      size -= localProcessedSize;
-      break;
-    }
-    else
-    {
-      RINOK(OpenStream());
-    }
-  }
-  if (processedSize != 0)
-    *processedSize = realProcessedSize;
-  return S_OK;
-}
-
-STDMETHODIMP CFolderInStream::GetSubStreamSize(UInt64 subStream, UInt64 *value)
-{
-  *value = 0;
-  int subStreamIndex = (int)subStream;
-  if (subStreamIndex < 0 || subStream > Sizes.Size())
-    return E_FAIL;
-  if (subStreamIndex < Sizes.Size())
-  {
-    *value= Sizes[subStreamIndex];
-    return S_OK;
-  }
-  if (!_currentSizeIsDefined)
-    return S_FALSE;
-  *value = _currentSize;
-  return S_OK;
-}
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zFolderInStream.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zFolderInStream.h
deleted file mode 100644
index 68e2b27..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zFolderInStream.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// 7z/FolderInStream.h
-
-#ifndef __7Z_FOLDERINSTREAM_H
-#define __7Z_FOLDERINSTREAM_H
-
-#include "7zItem.h"
-#include "7zHeader.h"
-
-#include "../IArchive.h"
-#include "../Common/InStreamWithCRC.h"
-#include "../../IStream.h"
-#include "../../ICoder.h"
-
-namespace NArchive {
-namespace N7z {
-
-class CFolderInStream:
-  public ISequentialInStream,
-  public ICompressGetSubStreamSize,
-  public CMyUnknownImp
-{
-public:
-
-  MY_UNKNOWN_IMP1(ICompressGetSubStreamSize)
-
-  CFolderInStream();
-
-  STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-
-  STDMETHOD(GetSubStreamSize)(UInt64 subStream, UInt64 *value);
-private:
-  CSequentialInStreamWithCRC *_inStreamWithHashSpec;
-  CMyComPtr<ISequentialInStream> _inStreamWithHash;
-  CMyComPtr<IArchiveUpdateCallback> _updateCallback;
-
-  bool _currentSizeIsDefined;
-  UInt64 _currentSize;
-
-  bool _fileIsOpen;
-  UInt64 _filePos;
-
-  const UInt32 *_fileIndices;
-  UInt32 _numFiles;
-  UInt32 _fileIndex;
-
-  HRESULT OpenStream();
-  HRESULT CloseStream();
-  void AddDigest();
-public:
-  void Init(IArchiveUpdateCallback *updateCallback,
-      const UInt32 *fileIndices, UInt32 numFiles);
-  CRecordVector<bool> Processed;
-  CRecordVector<UInt32> CRCs;
-  CRecordVector<UInt64> Sizes;
-  UInt64 GetFullSize() const
-  {
-    UInt64 size = 0;
-    for (int i = 0; i < Sizes.Size(); i++)
-      size += Sizes[i];
-    return size;
-  }
-};
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zFolderOutStream.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zFolderOutStream.cpp
deleted file mode 100644
index 61b938d..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zFolderOutStream.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-// 7zFolderOutStream.cpp
-
-#include "StdAfx.h"
-
-#include "7zFolderOutStream.h"
-
-namespace NArchive {
-namespace N7z {
-
-CFolderOutStream::CFolderOutStream()
-{
-  _outStreamWithHashSpec = new COutStreamWithCRC;
-  _outStreamWithHash = _outStreamWithHashSpec;
-}
-
-HRESULT CFolderOutStream::Init(
-    const CArchiveDatabaseEx *archiveDatabase,
-    UInt32 ref2Offset,
-    UInt32 startIndex,
-    const CBoolVector *extractStatuses,
-    IArchiveExtractCallback *extractCallback,
-    bool testMode,
-    bool checkCrc)
-{
-  _archiveDatabase = archiveDatabase;
-  _ref2Offset = ref2Offset;
-  _startIndex = startIndex;
-
-  _extractStatuses = extractStatuses;
-  _extractCallback = extractCallback;
-  _testMode = testMode;
-
-  _checkCrc = checkCrc;
-
-  _currentIndex = 0;
-  _fileIsOpen = false;
-  return WriteEmptyFiles();
-}
-
-HRESULT CFolderOutStream::OpenFile()
-{
-  Int32 askMode;
-  if((*_extractStatuses)[_currentIndex])
-    askMode = _testMode ?
-        NArchive::NExtract::NAskMode::kTest :
-        NArchive::NExtract::NAskMode::kExtract;
-  else
-    askMode = NArchive::NExtract::NAskMode::kSkip;
-  CMyComPtr<ISequentialOutStream> realOutStream;
-
-  UInt32 index = _startIndex + _currentIndex;
-  RINOK(_extractCallback->GetStream(_ref2Offset + index, &realOutStream, askMode));
-
-  _outStreamWithHashSpec->SetStream(realOutStream);
-  _outStreamWithHashSpec->Init(_checkCrc);
-  if (askMode == NArchive::NExtract::NAskMode::kExtract &&
-      (!realOutStream))
-  {
-    const CFileItem &fi = _archiveDatabase->Files[index];
-    if (!_archiveDatabase->IsItemAnti(index) && !fi.IsDir)
-      askMode = NArchive::NExtract::NAskMode::kSkip;
-  }
-  return _extractCallback->PrepareOperation(askMode);
-}
-
-HRESULT CFolderOutStream::WriteEmptyFiles()
-{
-  for(;_currentIndex < _extractStatuses->Size(); _currentIndex++)
-  {
-    UInt32 index = _startIndex + _currentIndex;
-    const CFileItem &fi = _archiveDatabase->Files[index];
-    if (!_archiveDatabase->IsItemAnti(index) && !fi.IsDir && fi.Size != 0)
-      return S_OK;
-    RINOK(OpenFile());
-    RINOK(_extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
-    _outStreamWithHashSpec->ReleaseStream();
-  }
-  return S_OK;
-}
-
-STDMETHODIMP CFolderOutStream::Write(const void *data,
-    UInt32 size, UInt32 *processedSize)
-{
-  UInt32 realProcessedSize = 0;
-  while(_currentIndex < _extractStatuses->Size())
-  {
-    if (_fileIsOpen)
-    {
-      UInt32 index = _startIndex + _currentIndex;
-      const CFileItem &fi = _archiveDatabase->Files[index];
-      UInt64 fileSize = fi.Size;
-      
-      UInt32 numBytesToWrite = (UInt32)MyMin(fileSize - _filePos,
-          UInt64(size - realProcessedSize));
-      
-      UInt32 processedSizeLocal;
-      RINOK(_outStreamWithHash->Write((const Byte *)data + realProcessedSize,
-            numBytesToWrite, &processedSizeLocal));
-
-      _filePos += processedSizeLocal;
-      realProcessedSize += processedSizeLocal;
-      if (_filePos == fileSize)
-      {
-        bool digestsAreEqual;
-        if (fi.CrcDefined && _checkCrc)
-          digestsAreEqual = fi.Crc == _outStreamWithHashSpec->GetCRC();
-        else
-          digestsAreEqual = true;
-
-        RINOK(_extractCallback->SetOperationResult(
-            digestsAreEqual ?
-            NArchive::NExtract::NOperationResult::kOK :
-            NArchive::NExtract::NOperationResult::kCRCError));
-        _outStreamWithHashSpec->ReleaseStream();
-        _fileIsOpen = false;
-        _currentIndex++;
-      }
-      if (realProcessedSize == size)
-      {
-        if (processedSize != NULL)
-          *processedSize = realProcessedSize;
-        return WriteEmptyFiles();
-      }
-    }
-    else
-    {
-      RINOK(OpenFile());
-      _fileIsOpen = true;
-      _filePos = 0;
-    }
-  }
-  if (processedSize != NULL)
-    *processedSize = size;
-  return S_OK;
-}
-
-HRESULT CFolderOutStream::FlushCorrupted(Int32 resultEOperationResult)
-{
-  while(_currentIndex < _extractStatuses->Size())
-  {
-    if (_fileIsOpen)
-    {
-      RINOK(_extractCallback->SetOperationResult(resultEOperationResult));
-      _outStreamWithHashSpec->ReleaseStream();
-      _fileIsOpen = false;
-      _currentIndex++;
-    }
-    else
-    {
-      RINOK(OpenFile());
-      _fileIsOpen = true;
-    }
-  }
-  return S_OK;
-}
-
-HRESULT CFolderOutStream::WasWritingFinished()
-{
-  if (_currentIndex == _extractStatuses->Size())
-    return S_OK;
-  return E_FAIL;
-}
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zFolderOutStream.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zFolderOutStream.h
deleted file mode 100644
index f54fba3..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zFolderOutStream.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// 7zFolderOutStream.h
-
-#ifndef __7Z_FOLDEROUTSTREAM_H
-#define __7Z_FOLDEROUTSTREAM_H
-
-#include "7zIn.h"
-
-#include "../../IStream.h"
-#include "../IArchive.h"
-#include "../Common/OutStreamWithCRC.h"
-
-namespace NArchive {
-namespace N7z {
-
-class CFolderOutStream:
-  public ISequentialOutStream,
-  public CMyUnknownImp
-{
-public:
-  MY_UNKNOWN_IMP
-  
-  CFolderOutStream();
-
-  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-private:
-
-  COutStreamWithCRC *_outStreamWithHashSpec;
-  CMyComPtr<ISequentialOutStream> _outStreamWithHash;
-  const CArchiveDatabaseEx *_archiveDatabase;
-  const CBoolVector *_extractStatuses;
-  UInt32 _startIndex;
-  UInt32 _ref2Offset;
-  int _currentIndex;
-  // UInt64 _currentDataPos;
-  CMyComPtr<IArchiveExtractCallback> _extractCallback;
-  bool _testMode;
-
-  bool _fileIsOpen;
-
-  bool _checkCrc;
-  UInt64 _filePos;
-
-  HRESULT OpenFile();
-  HRESULT WriteEmptyFiles();
-public:
-  HRESULT Init(
-      const CArchiveDatabaseEx *archiveDatabase,
-      UInt32 ref2Offset,
-      UInt32 startIndex,
-      const CBoolVector *extractStatuses,
-      IArchiveExtractCallback *extractCallback,
-      bool testMode,
-      bool checkCrc);
-  HRESULT FlushCorrupted(Int32 resultEOperationResult);
-  HRESULT WasWritingFinished();
-};
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zHandler.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zHandler.cpp
deleted file mode 100644
index 44131fa..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zHandler.cpp
+++ /dev/null
@@ -1,503 +0,0 @@
-// 7zHandler.cpp
-
-#include "StdAfx.h"
-
-extern "C"
-{
-  #include "../../../../C/CpuArch.h"
-}
-
-#include "../../../Common/ComTry.h"
-#include "../../../Common/IntToString.h"
-
-#ifdef COMPRESS_MT
-#include "../../../Windows/System.h"
-#endif
-
-#include "../Common/ItemNameUtils.h"
-
-#include "7zHandler.h"
-#include "7zProperties.h"
-
-#ifdef __7Z_SET_PROPERTIES
-#ifdef EXTRACT_ONLY
-#include "../Common/ParseProperties.h"
-#endif
-#endif
-
-using namespace NWindows;
-
-extern UString ConvertMethodIdToString(UInt64 id);
-
-namespace NArchive {
-namespace N7z {
-
-CHandler::CHandler()
-{
-  _crcSize = 4;
-
-  #ifndef _NO_CRYPTO
-  _passwordIsDefined = false;
-  #endif
-
-  #ifdef EXTRACT_ONLY
-  #ifdef COMPRESS_MT
-  _numThreads = NSystem::GetNumberOfProcessors();
-  #endif
-  #else
-  Init();
-  #endif
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
-  *numItems = _db.Files.Size();
-  return S_OK;
-}
-
-#ifdef _SFX
-
-IMP_IInArchive_ArcProps_NO
-
-STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 * /* numProperties */)
-{
-  return E_NOTIMPL;
-}
-
-STDMETHODIMP CHandler::GetPropertyInfo(UInt32 /* index */,
-      BSTR * /* name */, PROPID * /* propID */, VARTYPE * /* varType */)
-{
-  return E_NOTIMPL;
-}
-
-
-#else
-
-STATPROPSTG kArcProps[] =
-{
-  { NULL, kpidMethod, VT_BSTR},
-  { NULL, kpidSolid, VT_BOOL},
-  { NULL, kpidNumBlocks, VT_UI4},
-  { NULL, kpidPhySize, VT_UI8},
-  { NULL, kpidHeadersSize, VT_UI8},
-  { NULL, kpidOffset, VT_UI8}
-};
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
-  COM_TRY_BEGIN
-  NCOM::CPropVariant prop;
-  switch(propID)
-  {
-    case kpidMethod:
-    {
-      UString resString;
-      CRecordVector<UInt64> ids;
-      int i;
-      for (i = 0; i < _db.Folders.Size(); i++)
-      {
-        const CFolder &f = _db.Folders[i];
-        for (int j = f.Coders.Size() - 1; j >= 0; j--)
-          ids.AddToUniqueSorted(f.Coders[j].MethodID);
-      }
-
-      for (i = 0; i < ids.Size(); i++)
-      {
-        UInt64 id = ids[i];
-        UString methodName;
-        /* bool methodIsKnown = */ FindMethod(EXTERNAL_CODECS_VARS id, methodName);
-        if (methodName.IsEmpty())
-          methodName = ConvertMethodIdToString(id);
-        if (!resString.IsEmpty())
-          resString += L' ';
-        resString += methodName;
-      }
-      prop = resString;
-      break;
-    }
-    case kpidSolid: prop = _db.IsSolid(); break;
-    case kpidNumBlocks: prop = (UInt32)_db.Folders.Size(); break;
-    case kpidHeadersSize:  prop = _db.HeadersSize; break;
-    case kpidPhySize:  prop = _db.PhySize; break;
-    case kpidOffset: if (_db.ArchiveInfo.StartPosition != 0) prop = _db.ArchiveInfo.StartPosition; break;
-  }
-  prop.Detach(value);
-  return S_OK;
-  COM_TRY_END
-}
-
-IMP_IInArchive_ArcProps
-
-#endif
-
-static void SetPropFromUInt64Def(CUInt64DefVector &v, int index, NCOM::CPropVariant &prop)
-{
-  UInt64 value;
-  if (v.GetItem(index, value))
-  {
-    FILETIME ft;
-    ft.dwLowDateTime = (DWORD)value;
-    ft.dwHighDateTime = (DWORD)(value >> 32);
-    prop = ft;
-  }
-}
-
-#ifndef _SFX
-
-static UString ConvertUInt32ToString(UInt32 value)
-{
-  wchar_t buffer[32];
-  ConvertUInt64ToString(value, buffer);
-  return buffer;
-}
-
-static UString GetStringForSizeValue(UInt32 value)
-{
-  for (int i = 31; i >= 0; i--)
-    if ((UInt32(1) << i) == value)
-      return ConvertUInt32ToString(i);
-  UString result;
-  if (value % (1 << 20) == 0)
-  {
-    result += ConvertUInt32ToString(value >> 20);
-    result += L"m";
-  }
-  else if (value % (1 << 10) == 0)
-  {
-    result += ConvertUInt32ToString(value >> 10);
-    result += L"k";
-  }
-  else
-  {
-    result += ConvertUInt32ToString(value);
-    result += L"b";
-  }
-  return result;
-}
-
-static const UInt64 k_Copy = 0x0;
-static const UInt64 k_LZMA  = 0x030101;
-static const UInt64 k_PPMD  = 0x030401;
-
-static wchar_t GetHex(Byte value)
-{
-  return (wchar_t)((value < 10) ? (L'0' + value) : (L'A' + (value - 10)));
-}
-static inline UString GetHex2(Byte value)
-{
-  UString result;
-  result += GetHex((Byte)(value >> 4));
-  result += GetHex((Byte)(value & 0xF));
-  return result;
-}
-
-#endif
-
-static const UInt64 k_AES  = 0x06F10701;
-
-bool CHandler::IsEncrypted(UInt32 index2) const
-{
-  CNum folderIndex = _db.FileIndexToFolderIndexMap[index2];
-  if (folderIndex != kNumNoIndex)
-  {
-    const CFolder &folderInfo = _db.Folders[folderIndex];
-    for (int i = folderInfo.Coders.Size() - 1; i >= 0; i--)
-      if (folderInfo.Coders[i].MethodID == k_AES)
-        return true;
-  }
-  return false;
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID,  PROPVARIANT *value)
-{
-  COM_TRY_BEGIN
-  NCOM::CPropVariant prop;
-  
-  /*
-  const CRef2 &ref2 = _refs[index];
-  if (ref2.Refs.IsEmpty())
-    return E_FAIL;
-  const CRef &ref = ref2.Refs.Front();
-  */
-  
-  const CFileItem &item = _db.Files[index];
-  UInt32 index2 = index;
-
-  switch(propID)
-  {
-    case kpidPath:
-      if (!item.Name.IsEmpty())
-        prop = NItemName::GetOSName(item.Name);
-      break;
-    case kpidIsDir:  prop = item.IsDir; break;
-    case kpidSize:
-    {
-      prop = item.Size;
-      // prop = ref2.Size;
-      break;
-    }
-    case kpidPackSize:
-    {
-      // prop = ref2.PackSize;
-      {
-        CNum folderIndex = _db.FileIndexToFolderIndexMap[index2];
-        if (folderIndex != kNumNoIndex)
-        {
-          if (_db.FolderStartFileIndex[folderIndex] == (CNum)index2)
-            prop = _db.GetFolderFullPackSize(folderIndex);
-          /*
-          else
-            prop = (UInt64)0;
-          */
-        }
-        else
-          prop = (UInt64)0;
-      }
-      break;
-    }
-    case kpidPosition:  { UInt64 v; if (_db.StartPos.GetItem(index2, v)) prop = v; break; }
-    case kpidCTime:  SetPropFromUInt64Def(_db.CTime, index2, prop); break;
-    case kpidATime:  SetPropFromUInt64Def(_db.ATime, index2, prop); break;
-    case kpidMTime:  SetPropFromUInt64Def(_db.MTime, index2, prop); break;
-    case kpidAttrib:  if (item.AttribDefined) prop = item.Attrib; break;
-    case kpidCRC:  if (item.CrcDefined) prop = item.Crc; break;
-    case kpidEncrypted:  prop = IsEncrypted(index2); break;
-    case kpidIsAnti:  prop = _db.IsItemAnti(index2); break;
-    #ifndef _SFX
-    case kpidMethod:
-      {
-        CNum folderIndex = _db.FileIndexToFolderIndexMap[index2];
-        if (folderIndex != kNumNoIndex)
-        {
-          const CFolder &folderInfo = _db.Folders[folderIndex];
-          UString methodsString;
-          for (int i = folderInfo.Coders.Size() - 1; i >= 0; i--)
-          {
-            const CCoderInfo &coderInfo = folderInfo.Coders[i];
-            if (!methodsString.IsEmpty())
-              methodsString += L' ';
-
-            {
-              UString methodName;
-              bool methodIsKnown = FindMethod(
-                  EXTERNAL_CODECS_VARS
-                  coderInfo.MethodID, methodName);
-
-              if (methodIsKnown)
-              {
-                methodsString += methodName;
-                if (coderInfo.MethodID == k_LZMA)
-                {
-                  if (coderInfo.Props.GetCapacity() >= 5)
-                  {
-                    methodsString += L":";
-                    UInt32 dicSize = GetUi32((const Byte *)coderInfo.Props + 1);
-                    methodsString += GetStringForSizeValue(dicSize);
-                  }
-                }
-                else if (coderInfo.MethodID == k_PPMD)
-                {
-                  if (coderInfo.Props.GetCapacity() >= 5)
-                  {
-                    Byte order = *(const Byte *)coderInfo.Props;
-                    methodsString += L":o";
-                    methodsString += ConvertUInt32ToString(order);
-                    methodsString += L":mem";
-                    UInt32 dicSize = GetUi32((const Byte *)coderInfo.Props + 1);
-                    methodsString += GetStringForSizeValue(dicSize);
-                  }
-                }
-                else if (coderInfo.MethodID == k_AES)
-                {
-                  if (coderInfo.Props.GetCapacity() >= 1)
-                  {
-                    methodsString += L":";
-                    const Byte *data = (const Byte *)coderInfo.Props;
-                    Byte firstByte = *data++;
-                    UInt32 numCyclesPower = firstByte & 0x3F;
-                    methodsString += ConvertUInt32ToString(numCyclesPower);
-                    /*
-                    if ((firstByte & 0xC0) != 0)
-                    {
-                      methodsString += L":";
-                      return S_OK;
-                      UInt32 saltSize = (firstByte >> 7) & 1;
-                      UInt32 ivSize = (firstByte >> 6) & 1;
-                      if (coderInfo.Props.GetCapacity() >= 2)
-                      {
-                        Byte secondByte = *data++;
-                        saltSize += (secondByte >> 4);
-                        ivSize += (secondByte & 0x0F);
-                      }
-                    }
-                    */
-                  }
-                }
-                else
-                {
-                  if (coderInfo.Props.GetCapacity() > 0)
-                  {
-                    methodsString += L":[";
-                    for (size_t bi = 0; bi < coderInfo.Props.GetCapacity(); bi++)
-                    {
-                      if (bi > 5 && bi + 1 < coderInfo.Props.GetCapacity())
-                      {
-                        methodsString += L"..";
-                        break;
-                      }
-                      else
-                        methodsString += GetHex2(coderInfo.Props[bi]);
-                    }
-                    methodsString += L"]";
-                  }
-                }
-              }
-              else
-              {
-                methodsString += ConvertMethodIdToString(coderInfo.MethodID);
-              }
-            }
-          }
-          prop = methodsString;
-        }
-      }
-      break;
-    case kpidBlock:
-      {
-        CNum folderIndex = _db.FileIndexToFolderIndexMap[index2];
-        if (folderIndex != kNumNoIndex)
-          prop = (UInt32)folderIndex;
-      }
-      break;
-    case kpidPackedSize0:
-    case kpidPackedSize1:
-    case kpidPackedSize2:
-    case kpidPackedSize3:
-    case kpidPackedSize4:
-      {
-        CNum folderIndex = _db.FileIndexToFolderIndexMap[index2];
-        if (folderIndex != kNumNoIndex)
-        {
-          const CFolder &folderInfo = _db.Folders[folderIndex];
-          if (_db.FolderStartFileIndex[folderIndex] == (CNum)index2 &&
-              folderInfo.PackStreams.Size() > (int)(propID - kpidPackedSize0))
-          {
-            prop = _db.GetFolderPackStreamSize(folderIndex, propID - kpidPackedSize0);
-          }
-          else
-            prop = (UInt64)0;
-        }
-        else
-          prop = (UInt64)0;
-      }
-      break;
-    #endif
-  }
-  prop.Detach(value);
-  return S_OK;
-  COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Open(IInStream *stream,
-    const UInt64 *maxCheckStartPosition,
-    IArchiveOpenCallback *openArchiveCallback)
-{
-  COM_TRY_BEGIN
-  Close();
-  #ifndef _SFX
-  _fileInfoPopIDs.Clear();
-  #endif
-  try
-  {
-    CMyComPtr<IArchiveOpenCallback> openArchiveCallbackTemp = openArchiveCallback;
-
-    #ifndef _NO_CRYPTO
-    CMyComPtr<ICryptoGetTextPassword> getTextPassword;
-    if (openArchiveCallback)
-    {
-      openArchiveCallbackTemp.QueryInterface(
-          IID_ICryptoGetTextPassword, &getTextPassword);
-    }
-    #endif
-    CInArchive archive;
-    RINOK(archive.Open(stream, maxCheckStartPosition));
-    #ifndef _NO_CRYPTO
-    _passwordIsDefined = false;
-    UString password;
-    #endif
-    HRESULT result = archive.ReadDatabase(
-      EXTERNAL_CODECS_VARS
-      _db
-      #ifndef _NO_CRYPTO
-      , getTextPassword, _passwordIsDefined
-      #endif
-      );
-    RINOK(result);
-    _db.Fill();
-    _inStream = stream;
-  }
-  catch(...)
-  {
-    Close();
-    return S_FALSE;
-  }
-  // _inStream = stream;
-  #ifndef _SFX
-  FillPopIDs();
-  #endif
-  return S_OK;
-  COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
-  COM_TRY_BEGIN
-  _inStream.Release();
-  _db.Clear();
-  return S_OK;
-  COM_TRY_END
-}
-
-#ifdef __7Z_SET_PROPERTIES
-#ifdef EXTRACT_ONLY
-
-STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties)
-{
-  COM_TRY_BEGIN
-  #ifdef COMPRESS_MT
-  const UInt32 numProcessors = NSystem::GetNumberOfProcessors();
-  _numThreads = numProcessors;
-  #endif
-
-  for (int i = 0; i < numProperties; i++)
-  {
-    UString name = names[i];
-    name.MakeUpper();
-    if (name.IsEmpty())
-      return E_INVALIDARG;
-    const PROPVARIANT &value = values[i];
-    UInt32 number;
-    int index = ParseStringToUInt32(name, number);
-    if (index == 0)
-    {
-      if(name.Left(2).CompareNoCase(L"MT") == 0)
-      {
-        #ifdef COMPRESS_MT
-        RINOK(ParseMtProp(name.Mid(2), value, numProcessors, _numThreads));
-        #endif
-        continue;
-      }
-      else
-        return E_INVALIDARG;
-    }
-  }
-  return S_OK;
-  COM_TRY_END
-}
-
-#endif
-#endif
-
-IMPL_ISetCompressCodecsInfo
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zHandler.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zHandler.h
deleted file mode 100644
index 9adf846..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zHandler.h
+++ /dev/null
@@ -1,121 +0,0 @@
-// 7z/Handler.h
-
-#ifndef __7Z_HANDLER_H
-#define __7Z_HANDLER_H
-
-#include "../../ICoder.h"
-#include "../IArchive.h"
-#include "7zIn.h"
-
-#include "7zCompressionMode.h"
-
-#include "../../Common/CreateCoder.h"
-
-#ifndef EXTRACT_ONLY
-#include "../Common/HandlerOut.h"
-#endif
-
-namespace NArchive {
-namespace N7z {
-
-#ifndef __7Z_SET_PROPERTIES
-
-#ifdef EXTRACT_ONLY
-#ifdef COMPRESS_MT
-#define __7Z_SET_PROPERTIES
-#endif
-#else
-#define __7Z_SET_PROPERTIES
-#endif
-
-#endif
-
-
-class CHandler:
-  #ifndef EXTRACT_ONLY
-  public NArchive::COutHandler,
-  #endif
-  public IInArchive,
-  #ifdef __7Z_SET_PROPERTIES
-  public ISetProperties,
-  #endif
-  #ifndef EXTRACT_ONLY
-  public IOutArchive,
-  #endif
-  PUBLIC_ISetCompressCodecsInfo
-  public CMyUnknownImp
-{
-public:
-  MY_QUERYINTERFACE_BEGIN2(IInArchive)
-  #ifdef __7Z_SET_PROPERTIES
-  MY_QUERYINTERFACE_ENTRY(ISetProperties)
-  #endif
-  #ifndef EXTRACT_ONLY
-  MY_QUERYINTERFACE_ENTRY(IOutArchive)
-  #endif
-  QUERY_ENTRY_ISetCompressCodecsInfo
-  MY_QUERYINTERFACE_END
-  MY_ADDREF_RELEASE
-
-  INTERFACE_IInArchive(;)
-
-  #ifdef __7Z_SET_PROPERTIES
-  STDMETHOD(SetProperties)(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties);
-  #endif
-
-  #ifndef EXTRACT_ONLY
-  INTERFACE_IOutArchive(;)
-  #endif
-
-  DECL_ISetCompressCodecsInfo
-
-  CHandler();
-
-private:
-  CMyComPtr<IInStream> _inStream;
-  NArchive::N7z::CArchiveDatabaseEx _db;
-  #ifndef _NO_CRYPTO
-  bool _passwordIsDefined;
-  #endif
-
-  #ifdef EXTRACT_ONLY
-  
-  #ifdef COMPRESS_MT
-  UInt32 _numThreads;
-  #endif
-
-  UInt32 _crcSize;
-
-  #else
-  
-  CRecordVector<CBind> _binds;
-
-  HRESULT SetPassword(CCompressionMethodMode &methodMode, IArchiveUpdateCallback *updateCallback);
-
-  HRESULT SetCompressionMethod(CCompressionMethodMode &method,
-      CObjectVector<COneMethodInfo> &methodsInfo
-      #ifdef COMPRESS_MT
-      , UInt32 numThreads
-      #endif
-      );
-
-  HRESULT SetCompressionMethod(
-      CCompressionMethodMode &method,
-      CCompressionMethodMode &headerMethod);
-
-  #endif
-
-  bool IsEncrypted(UInt32 index2) const;
-  #ifndef _SFX
-
-  CRecordVector<UInt64> _fileInfoPopIDs;
-  void FillPopIDs();
-
-  #endif
-
-  DECL_EXTERNAL_CODECS_VARS
-};
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zHandlerOut.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zHandlerOut.cpp
deleted file mode 100644
index 3e2591d..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zHandlerOut.cpp
+++ /dev/null
@@ -1,477 +0,0 @@
-// 7zHandlerOut.cpp
-
-#include "StdAfx.h"
-
-#include "../../../Windows/PropVariant.h"
-
-#include "../../../Common/ComTry.h"
-#include "../../../Common/StringToInt.h"
-
-#include "../../ICoder.h"
-
-#include "../Common/ItemNameUtils.h"
-#include "../Common/ParseProperties.h"
-
-#include "7zHandler.h"
-#include "7zOut.h"
-#include "7zUpdate.h"
-
-using namespace NWindows;
-
-namespace NArchive {
-namespace N7z {
-
-static const wchar_t *kLZMAMethodName = L"LZMA";
-static const wchar_t *kCopyMethod = L"Copy";
-static const wchar_t *kDefaultMethodName = kLZMAMethodName;
-
-static const UInt32 kLzmaAlgorithmX5 = 1;
-static const wchar_t *kLzmaMatchFinderForHeaders = L"BT2";
-static const UInt32 kDictionaryForHeaders = 1 << 20;
-static const UInt32 kNumFastBytesForHeaders = 273;
-static const UInt32 kAlgorithmForHeaders = kLzmaAlgorithmX5;
-
-static inline bool IsCopyMethod(const UString &methodName)
-  { return (methodName.CompareNoCase(kCopyMethod) == 0); }
-
-STDMETHODIMP CHandler::GetFileTimeType(UInt32 *type)
-{
-  *type = NFileTimeType::kWindows;
-  return S_OK;
-}
-
-HRESULT CHandler::SetPassword(CCompressionMethodMode &methodMode,
-    IArchiveUpdateCallback *updateCallback)
-{
-  CMyComPtr<ICryptoGetTextPassword2> getTextPassword;
-  if (!getTextPassword)
-  {
-    CMyComPtr<IArchiveUpdateCallback> udateCallback2(updateCallback);
-    udateCallback2.QueryInterface(IID_ICryptoGetTextPassword2, &getTextPassword);
-  }
-  
-  if (getTextPassword)
-  {
-    CMyComBSTR password;
-    Int32 passwordIsDefined;
-    RINOK(getTextPassword->CryptoGetTextPassword2(
-        &passwordIsDefined, &password));
-    methodMode.PasswordIsDefined = IntToBool(passwordIsDefined);
-    if (methodMode.PasswordIsDefined)
-      methodMode.Password = password;
-  }
-  else
-    methodMode.PasswordIsDefined = false;
-  return S_OK;
-}
-
-HRESULT CHandler::SetCompressionMethod(
-    CCompressionMethodMode &methodMode,
-    CCompressionMethodMode &headerMethod)
-{
-  HRESULT res = SetCompressionMethod(methodMode, _methods
-  #ifdef COMPRESS_MT
-  , _numThreads
-  #endif
-  );
-  RINOK(res);
-  methodMode.Binds = _binds;
-
-  if (_compressHeaders)
-  {
-    // headerMethod.Methods.Add(methodMode.Methods.Back());
-
-    CObjectVector<COneMethodInfo> headerMethodInfoVector;
-    COneMethodInfo oneMethodInfo;
-    oneMethodInfo.MethodName = kLZMAMethodName;
-    {
-      CProp prop;
-      prop.Id = NCoderPropID::kMatchFinder;
-      prop.Value = kLzmaMatchFinderForHeaders;
-      oneMethodInfo.Props.Add(prop);
-    }
-    {
-      CProp prop;
-      prop.Id = NCoderPropID::kAlgorithm;
-      prop.Value = kAlgorithmForHeaders;
-      oneMethodInfo.Props.Add(prop);
-    }
-    {
-      CProp prop;
-      prop.Id = NCoderPropID::kNumFastBytes;
-      prop.Value = (UInt32)kNumFastBytesForHeaders;
-      oneMethodInfo.Props.Add(prop);
-    }
-    {
-      CProp prop;
-      prop.Id = NCoderPropID::kDictionarySize;
-      prop.Value = (UInt32)kDictionaryForHeaders;
-      oneMethodInfo.Props.Add(prop);
-    }
-    headerMethodInfoVector.Add(oneMethodInfo);
-    HRESULT res = SetCompressionMethod(headerMethod, headerMethodInfoVector
-      #ifdef COMPRESS_MT
-      ,1
-      #endif
-    );
-    RINOK(res);
-  }
-  return S_OK;
-}
-
-HRESULT CHandler::SetCompressionMethod(
-    CCompressionMethodMode &methodMode,
-    CObjectVector<COneMethodInfo> &methodsInfo
-    #ifdef COMPRESS_MT
-    , UInt32 numThreads
-    #endif
-    )
-{
-  UInt32 level = _level;
-  
-  if (methodsInfo.IsEmpty())
-  {
-    COneMethodInfo oneMethodInfo;
-    oneMethodInfo.MethodName = ((level == 0) ? kCopyMethod : kDefaultMethodName);
-    methodsInfo.Add(oneMethodInfo);
-  }
-
-  bool needSolid = false;
-  for(int i = 0; i < methodsInfo.Size(); i++)
-  {
-    COneMethodInfo &oneMethodInfo = methodsInfo[i];
-    SetCompressionMethod2(oneMethodInfo
-      #ifdef COMPRESS_MT
-      , numThreads
-      #endif
-      );
-
-    if (!IsCopyMethod(oneMethodInfo.MethodName))
-      needSolid = true;
-
-    CMethodFull methodFull;
-
-    if (!FindMethod(
-        EXTERNAL_CODECS_VARS
-        oneMethodInfo.MethodName, methodFull.Id, methodFull.NumInStreams, methodFull.NumOutStreams))
-      return E_INVALIDARG;
-    methodFull.Props = oneMethodInfo.Props;
-    methodMode.Methods.Add(methodFull);
-
-    if (!_numSolidBytesDefined)
-    {
-      for (int j = 0; j < methodFull.Props.Size(); j++)
-      {
-        const CProp &prop = methodFull.Props[j];
-        if ((prop.Id == NCoderPropID::kDictionarySize ||
-             prop.Id == NCoderPropID::kUsedMemorySize) && prop.Value.vt == VT_UI4)
-        {
-          _numSolidBytes = ((UInt64)prop.Value.ulVal) << 7;
-          const UInt64 kMinSize = (1 << 24);
-          if (_numSolidBytes < kMinSize)
-            _numSolidBytes = kMinSize;
-          _numSolidBytesDefined = true;
-          break;
-        }
-      }
-    }
-  }
-
-  if (!needSolid && !_numSolidBytesDefined)
-  {
-    _numSolidBytesDefined = true;
-    _numSolidBytes  = 0;
-  }
-  return S_OK;
-}
-
-static HRESULT GetTime(IArchiveUpdateCallback *updateCallback, int index, bool writeTime, PROPID propID, UInt64 &ft, bool &ftDefined)
-{
-  ft = 0;
-  ftDefined = false;
-  if (!writeTime)
-    return S_OK;
-  NCOM::CPropVariant prop;
-  RINOK(updateCallback->GetProperty(index, propID, &prop));
-  if (prop.vt == VT_FILETIME)
-  {
-    ft = prop.filetime.dwLowDateTime | ((UInt64)prop.filetime.dwHighDateTime << 32);
-    ftDefined = true;
-  }
-  else if (prop.vt != VT_EMPTY)
-    return E_INVALIDARG;
-  return S_OK;
-}
-
-STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numItems,
-    IArchiveUpdateCallback *updateCallback)
-{
-  COM_TRY_BEGIN
-
-  const CArchiveDatabaseEx *db = 0;
-  #ifdef _7Z_VOL
-  if(_volumes.Size() > 1)
-    return E_FAIL;
-  const CVolume *volume = 0;
-  if (_volumes.Size() == 1)
-  {
-    volume = &_volumes.Front();
-    db = &volume->Database;
-  }
-  #else
-  if (_inStream != 0)
-    db = &_db;
-  #endif
-
-  CObjectVector<CUpdateItem> updateItems;
-  
-  for (UInt32 i = 0; i < numItems; i++)
-  {
-    Int32 newData;
-    Int32 newProperties;
-    UInt32 indexInArchive;
-    if (!updateCallback)
-      return E_FAIL;
-    RINOK(updateCallback->GetUpdateItemInfo(i, &newData, &newProperties, &indexInArchive));
-    CUpdateItem ui;
-    ui.NewProperties = IntToBool(newProperties);
-    ui.NewData = IntToBool(newData);
-    ui.IndexInArchive = indexInArchive;
-    ui.IndexInClient = i;
-    ui.IsAnti = false;
-    ui.Size = 0;
-
-    if (ui.IndexInArchive != -1)
-    {
-      const CFileItem &fi = db->Files[ui.IndexInArchive];
-      ui.Name = fi.Name;
-      ui.IsDir = fi.IsDir;
-      ui.Size = fi.Size;
-      ui.IsAnti = db->IsItemAnti(ui.IndexInArchive);
-      
-      ui.CTimeDefined = db->CTime.GetItem(ui.IndexInArchive, ui.CTime);
-      ui.ATimeDefined = db->ATime.GetItem(ui.IndexInArchive, ui.ATime);
-      ui.MTimeDefined = db->MTime.GetItem(ui.IndexInArchive, ui.MTime);
-    }
-
-    if (ui.NewProperties)
-    {
-      bool nameIsDefined;
-      bool folderStatusIsDefined;
-      {
-        NCOM::CPropVariant prop;
-        RINOK(updateCallback->GetProperty(i, kpidAttrib, &prop));
-        if (prop.vt == VT_EMPTY)
-          ui.AttribDefined = false;
-        else if (prop.vt != VT_UI4)
-          return E_INVALIDARG;
-        else
-        {
-          ui.Attrib = prop.ulVal;
-          ui.AttribDefined = true;
-        }
-      }
-      
-      // we need MTime to sort files.
-      RINOK(GetTime(updateCallback, i, WriteCTime, kpidCTime, ui.CTime, ui.CTimeDefined));
-      RINOK(GetTime(updateCallback, i, WriteATime, kpidATime, ui.ATime, ui.ATimeDefined));
-      RINOK(GetTime(updateCallback, i, true,       kpidMTime, ui.MTime, ui.MTimeDefined));
-
-      {
-        NCOM::CPropVariant prop;
-        RINOK(updateCallback->GetProperty(i, kpidPath, &prop));
-        if (prop.vt == VT_EMPTY)
-          nameIsDefined = false;
-        else if (prop.vt != VT_BSTR)
-          return E_INVALIDARG;
-        else
-        {
-          ui.Name = NItemName::MakeLegalName(prop.bstrVal);
-          nameIsDefined = true;
-        }
-      }
-      {
-        NCOM::CPropVariant prop;
-        RINOK(updateCallback->GetProperty(i, kpidIsDir, &prop));
-        if (prop.vt == VT_EMPTY)
-          folderStatusIsDefined = false;
-        else if (prop.vt != VT_BOOL)
-          return E_INVALIDARG;
-        else
-        {
-          ui.IsDir = (prop.boolVal != VARIANT_FALSE);
-          folderStatusIsDefined = true;
-        }
-      }
-
-      {
-        NCOM::CPropVariant prop;
-        RINOK(updateCallback->GetProperty(i, kpidIsAnti, &prop));
-        if (prop.vt == VT_EMPTY)
-          ui.IsAnti = false;
-        else if (prop.vt != VT_BOOL)
-          return E_INVALIDARG;
-        else
-          ui.IsAnti = (prop.boolVal != VARIANT_FALSE);
-      }
-
-      if (ui.IsAnti)
-      {
-        ui.AttribDefined = false;
-
-        ui.CTimeDefined = false;
-        ui.ATimeDefined = false;
-        ui.MTimeDefined = false;
-        
-        ui.Size = 0;
-      }
-
-      if (!folderStatusIsDefined && ui.AttribDefined)
-        ui.SetDirStatusFromAttrib();
-    }
-
-    if (ui.NewData)
-    {
-      NCOM::CPropVariant prop;
-      RINOK(updateCallback->GetProperty(i, kpidSize, &prop));
-      if (prop.vt != VT_UI8)
-        return E_INVALIDARG;
-      ui.Size = (UInt64)prop.uhVal.QuadPart;
-      if (ui.Size != 0 && ui.IsAnti)
-        return E_INVALIDARG;
-    }
-    updateItems.Add(ui);
-  }
-
-  CCompressionMethodMode methodMode, headerMethod;
-  RINOK(SetCompressionMethod(methodMode, headerMethod));
-  #ifdef COMPRESS_MT
-  methodMode.NumThreads = _numThreads;
-  headerMethod.NumThreads = 1;
-  #endif
-
-  RINOK(SetPassword(methodMode, updateCallback));
-
-  bool compressMainHeader = _compressHeaders;  // check it
-
-  bool encryptHeaders = false;
-
-  if (methodMode.PasswordIsDefined)
-  {
-    if (_encryptHeadersSpecified)
-      encryptHeaders = _encryptHeaders;
-    #ifndef _NO_CRYPTO
-    else
-      encryptHeaders = _passwordIsDefined;
-    #endif
-    compressMainHeader = true;
-    if(encryptHeaders)
-      RINOK(SetPassword(headerMethod, updateCallback));
-  }
-
-  if (numItems < 2)
-    compressMainHeader = false;
-
-  CUpdateOptions options;
-  options.Method = &methodMode;
-  options.HeaderMethod = (_compressHeaders || encryptHeaders) ? &headerMethod : 0;
-  options.UseFilters = _level != 0 && _autoFilter;
-  options.MaxFilter = _level >= 8;
-
-  options.HeaderOptions.CompressMainHeader = compressMainHeader;
-  options.HeaderOptions.WriteCTime = WriteCTime;
-  options.HeaderOptions.WriteATime = WriteATime;
-  options.HeaderOptions.WriteMTime = WriteMTime;
-  
-  options.NumSolidFiles = _numSolidFiles;
-  options.NumSolidBytes = _numSolidBytes;
-  options.SolidExtension = _solidExtension;
-  options.RemoveSfxBlock = _removeSfxBlock;
-  options.VolumeMode = _volumeMode;
-
-  COutArchive archive;
-  CArchiveDatabase newDatabase;
-  HRESULT res = Update(
-      EXTERNAL_CODECS_VARS
-      #ifdef _7Z_VOL
-      volume ? volume->Stream: 0,
-      volume ? db : 0,
-      #else
-      _inStream,
-      db,
-      #endif
-      updateItems,
-      archive, newDatabase, outStream, updateCallback, options);
-
-  RINOK(res);
-
-  updateItems.ClearAndFree();
-
-  return archive.WriteDatabase(EXTERNAL_CODECS_VARS
-      newDatabase, options.HeaderMethod, options.HeaderOptions);
-
-  COM_TRY_END
-}
-
-static HRESULT GetBindInfoPart(UString &srcString, UInt32 &coder, UInt32 &stream)
-{
-  stream = 0;
-  int index = ParseStringToUInt32(srcString, coder);
-  if (index == 0)
-    return E_INVALIDARG;
-  srcString.Delete(0, index);
-  if (srcString[0] == 'S')
-  {
-    srcString.Delete(0);
-    int index = ParseStringToUInt32(srcString, stream);
-    if (index == 0)
-      return E_INVALIDARG;
-    srcString.Delete(0, index);
-  }
-  return S_OK;
-}
-
-static HRESULT GetBindInfo(UString &srcString, CBind &bind)
-{
-  RINOK(GetBindInfoPart(srcString, bind.OutCoder, bind.OutStream));
-  if (srcString[0] != ':')
-    return E_INVALIDARG;
-  srcString.Delete(0);
-  RINOK(GetBindInfoPart(srcString, bind.InCoder, bind.InStream));
-  if (!srcString.IsEmpty())
-    return E_INVALIDARG;
-  return S_OK;
-}
-
-STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties)
-{
-  COM_TRY_BEGIN
-  _binds.Clear();
-  BeforeSetProperty();
-
-  for (int i = 0; i < numProperties; i++)
-  {
-    UString name = names[i];
-    name.MakeUpper();
-    if (name.IsEmpty())
-      return E_INVALIDARG;
-
-    const PROPVARIANT &value = values[i];
-
-    if (name[0] == 'B')
-    {
-      name.Delete(0);
-      CBind bind;
-      RINOK(GetBindInfo(name, bind));
-      _binds.Add(bind);
-      continue;
-    }
-
-    RINOK(SetProperty(name, value));
-  }
-
-  return S_OK;
-  COM_TRY_END
-}
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zHeader.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zHeader.cpp
deleted file mode 100644
index f232a23..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zHeader.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// 7z/Header.cpp
-
-#include "StdAfx.h"
-#include "7zHeader.h"
-
-namespace NArchive {
-namespace N7z {
-
-Byte kSignature[kSignatureSize] = {'7' + 1, 'z', 0xBC, 0xAF, 0x27, 0x1C};
-#ifdef _7Z_VOL
-Byte kFinishSignature[kSignatureSize] = {'7' + 1, 'z', 0xBC, 0xAF, 0x27, 0x1C + 1};
-#endif
-
-class SignatureInitializer
-{
-public:
-  SignatureInitializer()
-  {
-    kSignature[0]--;
-    #ifdef _7Z_VOL
-    kFinishSignature[0]--;
-    #endif
-  };
-} g_SignatureInitializer;
-
-}}
-
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zHeader.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zHeader.h
deleted file mode 100644
index 30622b9..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zHeader.h
+++ /dev/null
@@ -1,97 +0,0 @@
-// 7z/7zHeader.h
-
-#ifndef __7Z_HEADER_H
-#define __7Z_HEADER_H
-
-#include "../../../Common/Types.h"
-
-namespace NArchive {
-namespace N7z {
-
-const int kSignatureSize = 6;
-extern Byte kSignature[kSignatureSize];
-
-// #define _7Z_VOL
-// 7z-MultiVolume is not finished yet.
-// It can work already, but I still do not like some
-// things of that new multivolume format.
-// So please keep it commented.
-
-#ifdef _7Z_VOL
-extern Byte kFinishSignature[kSignatureSize];
-#endif
-
-struct CArchiveVersion
-{
-  Byte Major;
-  Byte Minor;
-};
-
-const Byte kMajorVersion = 0;
-
-struct CStartHeader
-{
-  UInt64 NextHeaderOffset;
-  UInt64 NextHeaderSize;
-  UInt32 NextHeaderCRC;
-};
-
-const UInt32 kStartHeaderSize = 20;
-
-#ifdef _7Z_VOL
-struct CFinishHeader: public CStartHeader
-{
-  UInt64 ArchiveStartOffset;  // data offset from end if that struct
-  UInt64 AdditionalStartBlockSize; // start  signature & start header size
-};
-
-const UInt32 kFinishHeaderSize = kStartHeaderSize + 16;
-#endif
-
-namespace NID
-{
-  enum EEnum
-  {
-    kEnd,
-
-    kHeader,
-
-    kArchiveProperties,
-    
-    kAdditionalStreamsInfo,
-    kMainStreamsInfo,
-    kFilesInfo,
-    
-    kPackInfo,
-    kUnpackInfo,
-    kSubStreamsInfo,
-
-    kSize,
-    kCRC,
-
-    kFolder,
-
-    kCodersUnpackSize,
-    kNumUnpackStream,
-
-    kEmptyStream,
-    kEmptyFile,
-    kAnti,
-
-    kName,
-    kCTime,
-    kATime,
-    kMTime,
-    kWinAttributes,
-    kComment,
-
-    kEncodedHeader,
-
-    kStartPos,
-    kDummy
-  };
-}
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zIn.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zIn.cpp
deleted file mode 100644
index ab78eea..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zIn.cpp
+++ /dev/null
@@ -1,1260 +0,0 @@
-// 7zIn.cpp
-
-#include "StdAfx.h"
-
-extern "C"
-{
-  #include "../../../../C/7zCrc.h"
-  #include "../../../../C/CpuArch.h"
-}
-
-#include "../../Common/StreamObjects.h"
-#include "../../Common/StreamUtils.h"
-
-#include "7zDecode.h"
-#include "7zIn.h"
-
-#define Get16(p) GetUi16(p)
-#define Get32(p) GetUi32(p)
-#define Get64(p) GetUi64(p)
-
-// define FORMAT_7Z_RECOVERY if you want to recover multivolume archives with empty StartHeader
-#ifndef _SFX
-#define FORMAT_7Z_RECOVERY
-#endif
-
-namespace NArchive {
-namespace N7z {
-
-static void BoolVector_Fill_False(CBoolVector &v, int size)
-{
-  v.Clear();
-  v.Reserve(size);
-  for (int i = 0; i < size; i++)
-    v.Add(false);
-}
-
-static bool BoolVector_GetAndSet(CBoolVector &v, UInt32 index)
-{
-  if (index >= (UInt32)v.Size())
-    return true;
-  bool res = v[index];
-  v[index] = true;
-  return res;
-}
-
-bool CFolder::CheckStructure() const
-{
-  const int kNumCodersMax = sizeof(UInt32) * 8; // don't change it
-  const int kMaskSize = sizeof(UInt32) * 8; // it must be >= kNumCodersMax
-  const int kNumBindsMax = 32;
-
-  if (Coders.Size() > kNumCodersMax || BindPairs.Size() > kNumBindsMax)
-    return false;
-
-  {
-    CBoolVector v;
-    BoolVector_Fill_False(v, BindPairs.Size() + PackStreams.Size());
-    
-    int i;
-    for (i = 0; i < BindPairs.Size(); i++)
-      if (BoolVector_GetAndSet(v, BindPairs[i].InIndex))
-        return false;
-    for (i = 0; i < PackStreams.Size(); i++)
-      if (BoolVector_GetAndSet(v, PackStreams[i]))
-        return false;
-    
-    BoolVector_Fill_False(v, UnpackSizes.Size());
-    for (i = 0; i < BindPairs.Size(); i++)
-      if (BoolVector_GetAndSet(v, BindPairs[i].OutIndex))
-        return false;
-  }
-  
-  UInt32 mask[kMaskSize];
-  int i;
-  for (i = 0; i < kMaskSize; i++)
-    mask[i] = 0;
-
-  {
-    CIntVector inStreamToCoder, outStreamToCoder;
-    for (i = 0; i < Coders.Size(); i++)
-    {
-      CNum j;
-      const CCoderInfo &coder = Coders[i];
-      for (j = 0; j < coder.NumInStreams; j++)
-        inStreamToCoder.Add(i);
-      for (j = 0; j < coder.NumOutStreams; j++)
-        outStreamToCoder.Add(i);
-    }
-    
-    for (i = 0; i < BindPairs.Size(); i++)
-    {
-      const CBindPair &bp = BindPairs[i];
-      mask[inStreamToCoder[bp.InIndex]] |= (1 << outStreamToCoder[bp.OutIndex]);
-    }
-  }
-  
-  for (i = 0; i < kMaskSize; i++)
-    for (int j = 0; j < kMaskSize; j++)
-      if (((1 << j) & mask[i]) != 0)
-        mask[i] |= mask[j];
-
-  for (i = 0; i < kMaskSize; i++)
-    if (((1 << i) & mask[i]) != 0)
-      return false;
-
-  return true;
-}
-
-class CInArchiveException {};
-
-static void ThrowException() { throw CInArchiveException(); }
-static inline void ThrowEndOfData()   { ThrowException(); }
-static inline void ThrowUnsupported() { ThrowException(); }
-static inline void ThrowIncorrect()   { ThrowException(); }
-static inline void ThrowUnsupportedVersion() { ThrowException(); }
-
-/*
-class CInArchiveException
-{
-public:
-  enum CCauseType
-  {
-    kUnsupportedVersion = 0,
-    kUnsupported,
-    kIncorrect,
-    kEndOfData,
-  } Cause;
-  CInArchiveException(CCauseType cause): Cause(cause) {};
-};
-
-static void ThrowException(CInArchiveException::CCauseType c) { throw CInArchiveException(c); }
-static void ThrowEndOfData()   { ThrowException(CInArchiveException::kEndOfData); }
-static void ThrowUnsupported() { ThrowException(CInArchiveException::kUnsupported); }
-static void ThrowIncorrect()   { ThrowException(CInArchiveException::kIncorrect); }
-static void ThrowUnsupportedVersion() { ThrowException(CInArchiveException::kUnsupportedVersion); }
-*/
-
-class CStreamSwitch
-{
-  CInArchive *_archive;
-  bool _needRemove;
-public:
-  CStreamSwitch(): _needRemove(false) {}
-  ~CStreamSwitch() { Remove(); }
-  void Remove();
-  void Set(CInArchive *archive, const Byte *data, size_t size);
-  void Set(CInArchive *archive, const CByteBuffer &byteBuffer);
-  void Set(CInArchive *archive, const CObjectVector<CByteBuffer> *dataVector);
-};
-
-void CStreamSwitch::Remove()
-{
-  if (_needRemove)
-  {
-    _archive->DeleteByteStream();
-    _needRemove = false;
-  }
-}
-
-void CStreamSwitch::Set(CInArchive *archive, const Byte *data, size_t size)
-{
-  Remove();
-  _archive = archive;
-  _archive->AddByteStream(data, size);
-  _needRemove = true;
-}
-
-void CStreamSwitch::Set(CInArchive *archive, const CByteBuffer &byteBuffer)
-{
-  Set(archive, byteBuffer, byteBuffer.GetCapacity());
-}
-
-void CStreamSwitch::Set(CInArchive *archive, const CObjectVector<CByteBuffer> *dataVector)
-{
-  Remove();
-  Byte external = archive->ReadByte();
-  if (external != 0)
-  {
-    int dataIndex = (int)archive->ReadNum();
-    if (dataIndex < 0 || dataIndex >= dataVector->Size())
-      ThrowIncorrect();
-    Set(archive, (*dataVector)[dataIndex]);
-  }
-}
-
-Byte CInByte2::ReadByte()
-{
-  if (_pos >= _size)
-    ThrowEndOfData();
-  return _buffer[_pos++];
-}
-
-void CInByte2::ReadBytes(Byte *data, size_t size)
-{
-  if (size > _size - _pos)
-    ThrowEndOfData();
-  for (size_t i = 0; i < size; i++)
-    data[i] = _buffer[_pos++];
-}
-
-void CInByte2::SkeepData(UInt64 size)
-{
-  if (size > _size - _pos)
-    ThrowEndOfData();
-  _pos += (size_t)size;
-}
-
-void CInByte2::SkeepData()
-{
-  SkeepData(ReadNumber());
-}
-
-UInt64 CInByte2::ReadNumber()
-{
-  if (_pos >= _size)
-    ThrowEndOfData();
-  Byte firstByte = _buffer[_pos++];
-  Byte mask = 0x80;
-  UInt64 value = 0;
-  for (int i = 0; i < 8; i++)
-  {
-    if ((firstByte & mask) == 0)
-    {
-      UInt64 highPart = firstByte & (mask - 1);
-      value += (highPart << (i * 8));
-      return value;
-    }
-    if (_pos >= _size)
-      ThrowEndOfData();
-    value |= ((UInt64)_buffer[_pos++] << (8 * i));
-    mask >>= 1;
-  }
-  return value;
-}
-
-CNum CInByte2::ReadNum()
-{
-  UInt64 value = ReadNumber();
-  if (value > kNumMax)
-    ThrowUnsupported();
-  return (CNum)value;
-}
-
-UInt32 CInByte2::ReadUInt32()
-{
-  if (_pos + 4 > _size)
-    ThrowEndOfData();
-  UInt32 res = Get32(_buffer + _pos);
-  _pos += 4;
-  return res;
-}
-
-UInt64 CInByte2::ReadUInt64()
-{
-  if (_pos + 8 > _size)
-    ThrowEndOfData();
-  UInt64 res = Get64(_buffer + _pos);
-  _pos += 8;
-  return res;
-}
-
-void CInByte2::ReadString(UString &s)
-{
-  const Byte *buf = _buffer + _pos;
-  size_t rem = (_size - _pos) / 2 * 2;
-  {
-    size_t i;
-    for (i = 0; i < rem; i += 2)
-      if (buf[i] == 0 && buf[i + 1] == 0)
-        break;
-    if (i == rem)
-      ThrowEndOfData();
-    rem = i;
-  }
-  int len = (int)(rem / 2);
-  if (len < 0 || (size_t)len * 2 != rem)
-    ThrowUnsupported();
-  wchar_t *p = s.GetBuffer(len);
-  int i;
-  for (i = 0; i < len; i++, buf += 2)
-    p[i] = (wchar_t)Get16(buf);
-  s.ReleaseBuffer(len);
-  _pos += rem + 2;
-}
-
-static inline bool TestSignatureCandidate(const Byte *p)
-{
-  for (int i = 0; i < kSignatureSize; i++)
-    if (p[i] != kSignature[i])
-      return false;
-  return (p[0x1A] == 0 && p[0x1B] == 0);
-}
-
-HRESULT CInArchive::FindAndReadSignature(IInStream *stream, const UInt64 *searchHeaderSizeLimit)
-{
-  RINOK(ReadStream_FALSE(stream, _header, kHeaderSize));
-
-  if (TestSignatureCandidate(_header))
-    return S_OK;
-
-  CByteBuffer byteBuffer;
-  const UInt32 kBufferSize = (1 << 16);
-  byteBuffer.SetCapacity(kBufferSize);
-  Byte *buffer = byteBuffer;
-  UInt32 numPrevBytes = kHeaderSize - 1;
-  memcpy(buffer, _header + 1, numPrevBytes);
-  UInt64 curTestPos = _arhiveBeginStreamPosition + 1;
-  for (;;)
-  {
-    if (searchHeaderSizeLimit != NULL)
-      if (curTestPos - _arhiveBeginStreamPosition > *searchHeaderSizeLimit)
-        break;
-    do
-    {
-      UInt32 numReadBytes = kBufferSize - numPrevBytes;
-      UInt32 processedSize;
-      RINOK(stream->Read(buffer + numPrevBytes, numReadBytes, &processedSize));
-      numPrevBytes += processedSize;
-      if (processedSize == 0)
-        return S_FALSE;
-    }
-    while (numPrevBytes < kHeaderSize);
-    UInt32 numTests = numPrevBytes - kHeaderSize + 1;
-    for (UInt32 pos = 0; pos < numTests; pos++)
-    {
-      for (; buffer[pos] != '7' && pos < numTests; pos++);
-      if (pos == numTests)
-        break;
-      if (TestSignatureCandidate(buffer + pos))
-      {
-        memcpy(_header, buffer + pos, kHeaderSize);
-        curTestPos += pos;
-        _arhiveBeginStreamPosition = curTestPos;
-        return stream->Seek(curTestPos + kHeaderSize, STREAM_SEEK_SET, NULL);
-      }
-    }
-    curTestPos += numTests;
-    numPrevBytes -= numTests;
-    memmove(buffer, buffer + numTests, numPrevBytes);
-  }
-  return S_FALSE;
-}
-
-// S_FALSE means that file is not archive
-HRESULT CInArchive::Open(IInStream *stream, const UInt64 *searchHeaderSizeLimit)
-{
-  HeadersSize = 0;
-  Close();
-  RINOK(stream->Seek(0, STREAM_SEEK_CUR, &_arhiveBeginStreamPosition))
-  RINOK(FindAndReadSignature(stream, searchHeaderSizeLimit));
-  _stream = stream;
-  return S_OK;
-}
-  
-void CInArchive::Close()
-{
-  _stream.Release();
-}
-
-void CInArchive::ReadArchiveProperties(CInArchiveInfo & /* archiveInfo */)
-{
-  for (;;)
-  {
-    if (ReadID() == NID::kEnd)
-      break;
-    SkeepData();
-  }
-}
-
-void CInArchive::GetNextFolderItem(CFolder &folder)
-{
-  CNum numCoders = ReadNum();
-
-  folder.Coders.Clear();
-  folder.Coders.Reserve((int)numCoders);
-  CNum numInStreams = 0;
-  CNum numOutStreams = 0;
-  CNum i;
-  for (i = 0; i < numCoders; i++)
-  {
-    folder.Coders.Add(CCoderInfo());
-    CCoderInfo &coder = folder.Coders.Back();
-
-    {
-      Byte mainByte = ReadByte();
-      int idSize = (mainByte & 0xF);
-      Byte longID[15];
-      ReadBytes(longID, idSize);
-      if (idSize > 8)
-        ThrowUnsupported();
-      UInt64 id = 0;
-      for (int j = 0; j < idSize; j++)
-        id |= (UInt64)longID[idSize - 1 - j] << (8 * j);
-      coder.MethodID = id;
-
-      if ((mainByte & 0x10) != 0)
-      {
-        coder.NumInStreams = ReadNum();
-        coder.NumOutStreams = ReadNum();
-      }
-      else
-      {
-        coder.NumInStreams = 1;
-        coder.NumOutStreams = 1;
-      }
-      if ((mainByte & 0x20) != 0)
-      {
-        CNum propsSize = ReadNum();
-        coder.Props.SetCapacity((size_t)propsSize);
-        ReadBytes((Byte *)coder.Props, (size_t)propsSize);
-      }
-      if ((mainByte & 0x80) != 0)
-        ThrowUnsupported();
-    }
-    numInStreams += coder.NumInStreams;
-    numOutStreams += coder.NumOutStreams;
-  }
-
-  CNum numBindPairs = numOutStreams - 1;
-  folder.BindPairs.Clear();
-  folder.BindPairs.Reserve(numBindPairs);
-  for (i = 0; i < numBindPairs; i++)
-  {
-    CBindPair bp;
-    bp.InIndex = ReadNum();
-    bp.OutIndex = ReadNum();
-    folder.BindPairs.Add(bp);
-  }
-
-  if (numInStreams < numBindPairs)
-    ThrowUnsupported();
-  CNum numPackStreams = numInStreams - numBindPairs;
-  folder.PackStreams.Reserve(numPackStreams);
-  if (numPackStreams == 1)
-  {
-    for (i = 0; i < numInStreams; i++)
-      if (folder.FindBindPairForInStream(i) < 0)
-      {
-        folder.PackStreams.Add(i);
-        break;
-      }
-    if (folder.PackStreams.Size() != 1)
-      ThrowUnsupported();
-  }
-  else
-    for (i = 0; i < numPackStreams; i++)
-      folder.PackStreams.Add(ReadNum());
-}
-
-void CInArchive::WaitAttribute(UInt64 attribute)
-{
-  for (;;)
-  {
-    UInt64 type = ReadID();
-    if (type == attribute)
-      return;
-    if (type == NID::kEnd)
-      ThrowIncorrect();
-    SkeepData();
-  }
-}
-
-void CInArchive::ReadHashDigests(int numItems,
-    CBoolVector &digestsDefined,
-    CRecordVector<UInt32> &digests)
-{
-  ReadBoolVector2(numItems, digestsDefined);
-  digests.Clear();
-  digests.Reserve(numItems);
-  for (int i = 0; i < numItems; i++)
-  {
-    UInt32 crc = 0;
-    if (digestsDefined[i])
-      crc = ReadUInt32();
-    digests.Add(crc);
-  }
-}
-
-void CInArchive::ReadPackInfo(
-    UInt64 &dataOffset,
-    CRecordVector<UInt64> &packSizes,
-    CBoolVector &packCRCsDefined,
-    CRecordVector<UInt32> &packCRCs)
-{
-  dataOffset = ReadNumber();
-  CNum numPackStreams = ReadNum();
-
-  WaitAttribute(NID::kSize);
-  packSizes.Clear();
-  packSizes.Reserve(numPackStreams);
-  for (CNum i = 0; i < numPackStreams; i++)
-    packSizes.Add(ReadNumber());
-
-  UInt64 type;
-  for (;;)
-  {
-    type = ReadID();
-    if (type == NID::kEnd)
-      break;
-    if (type == NID::kCRC)
-    {
-      ReadHashDigests(numPackStreams, packCRCsDefined, packCRCs);
-      continue;
-    }
-    SkeepData();
-  }
-  if (packCRCsDefined.IsEmpty())
-  {
-    BoolVector_Fill_False(packCRCsDefined, numPackStreams);
-    packCRCs.Reserve(numPackStreams);
-    packCRCs.Clear();
-    for (CNum i = 0; i < numPackStreams; i++)
-      packCRCs.Add(0);
-  }
-}
-
-void CInArchive::ReadUnpackInfo(
-    const CObjectVector<CByteBuffer> *dataVector,
-    CObjectVector<CFolder> &folders)
-{
-  WaitAttribute(NID::kFolder);
-  CNum numFolders = ReadNum();
-
-  {
-    CStreamSwitch streamSwitch;
-    streamSwitch.Set(this, dataVector);
-    folders.Clear();
-    folders.Reserve(numFolders);
-    for (CNum i = 0; i < numFolders; i++)
-    {
-      folders.Add(CFolder());
-      GetNextFolderItem(folders.Back());
-    }
-  }
-
-  WaitAttribute(NID::kCodersUnpackSize);
-
-  CNum i;
-  for (i = 0; i < numFolders; i++)
-  {
-    CFolder &folder = folders[i];
-    CNum numOutStreams = folder.GetNumOutStreams();
-    folder.UnpackSizes.Reserve(numOutStreams);
-    for (CNum j = 0; j < numOutStreams; j++)
-      folder.UnpackSizes.Add(ReadNumber());
-  }
-
-  for (;;)
-  {
-    UInt64 type = ReadID();
-    if (type == NID::kEnd)
-      return;
-    if (type == NID::kCRC)
-    {
-      CBoolVector crcsDefined;
-      CRecordVector<UInt32> crcs;
-      ReadHashDigests(numFolders, crcsDefined, crcs);
-      for (i = 0; i < numFolders; i++)
-      {
-        CFolder &folder = folders[i];
-        folder.UnpackCRCDefined = crcsDefined[i];
-        folder.UnpackCRC = crcs[i];
-      }
-      continue;
-    }
-    SkeepData();
-  }
-}
-
-void CInArchive::ReadSubStreamsInfo(
-    const CObjectVector<CFolder> &folders,
-    CRecordVector<CNum> &numUnpackStreamsInFolders,
-    CRecordVector<UInt64> &unpackSizes,
-    CBoolVector &digestsDefined,
-    CRecordVector<UInt32> &digests)
-{
-  numUnpackStreamsInFolders.Clear();
-  numUnpackStreamsInFolders.Reserve(folders.Size());
-  UInt64 type;
-  for (;;)
-  {
-    type = ReadID();
-    if (type == NID::kNumUnpackStream)
-    {
-      for (int i = 0; i < folders.Size(); i++)
-        numUnpackStreamsInFolders.Add(ReadNum());
-      continue;
-    }
-    if (type == NID::kCRC || type == NID::kSize)
-      break;
-    if (type == NID::kEnd)
-      break;
-    SkeepData();
-  }
-
-  if (numUnpackStreamsInFolders.IsEmpty())
-    for (int i = 0; i < folders.Size(); i++)
-      numUnpackStreamsInFolders.Add(1);
-
-  int i;
-  for (i = 0; i < numUnpackStreamsInFolders.Size(); i++)
-  {
-    // v3.13 incorrectly worked with empty folders
-    // v4.07: we check that folder is empty
-    CNum numSubstreams = numUnpackStreamsInFolders[i];
-    if (numSubstreams == 0)
-      continue;
-    UInt64 sum = 0;
-    for (CNum j = 1; j < numSubstreams; j++)
-      if (type == NID::kSize)
-      {
-        UInt64 size = ReadNumber();
-        unpackSizes.Add(size);
-        sum += size;
-      }
-    unpackSizes.Add(folders[i].GetUnpackSize() - sum);
-  }
-  if (type == NID::kSize)
-    type = ReadID();
-
-  int numDigests = 0;
-  int numDigestsTotal = 0;
-  for (i = 0; i < folders.Size(); i++)
-  {
-    CNum numSubstreams = numUnpackStreamsInFolders[i];
-    if (numSubstreams != 1 || !folders[i].UnpackCRCDefined)
-      numDigests += numSubstreams;
-    numDigestsTotal += numSubstreams;
-  }
-
-  for (;;)
-  {
-    if (type == NID::kCRC)
-    {
-      CBoolVector digestsDefined2;
-      CRecordVector<UInt32> digests2;
-      ReadHashDigests(numDigests, digestsDefined2, digests2);
-      int digestIndex = 0;
-      for (i = 0; i < folders.Size(); i++)
-      {
-        CNum numSubstreams = numUnpackStreamsInFolders[i];
-        const CFolder &folder = folders[i];
-        if (numSubstreams == 1 && folder.UnpackCRCDefined)
-        {
-          digestsDefined.Add(true);
-          digests.Add(folder.UnpackCRC);
-        }
-        else
-          for (CNum j = 0; j < numSubstreams; j++, digestIndex++)
-          {
-            digestsDefined.Add(digestsDefined2[digestIndex]);
-            digests.Add(digests2[digestIndex]);
-          }
-      }
-    }
-    else if (type == NID::kEnd)
-    {
-      if (digestsDefined.IsEmpty())
-      {
-        BoolVector_Fill_False(digestsDefined, numDigestsTotal);
-        digests.Clear();
-        for (int i = 0; i < numDigestsTotal; i++)
-          digests.Add(0);
-      }
-      return;
-    }
-    else
-      SkeepData();
-    type = ReadID();
-  }
-}
-
-void CInArchive::ReadStreamsInfo(
-    const CObjectVector<CByteBuffer> *dataVector,
-    UInt64 &dataOffset,
-    CRecordVector<UInt64> &packSizes,
-    CBoolVector &packCRCsDefined,
-    CRecordVector<UInt32> &packCRCs,
-    CObjectVector<CFolder> &folders,
-    CRecordVector<CNum> &numUnpackStreamsInFolders,
-    CRecordVector<UInt64> &unpackSizes,
-    CBoolVector &digestsDefined,
-    CRecordVector<UInt32> &digests)
-{
-  for (;;)
-  {
-    UInt64 type = ReadID();
-    if (type > ((UInt32)1 << 30))
-      ThrowIncorrect();
-    switch((UInt32)type)
-    {
-      case NID::kEnd:
-        return;
-      case NID::kPackInfo:
-      {
-        ReadPackInfo(dataOffset, packSizes, packCRCsDefined, packCRCs);
-        break;
-      }
-      case NID::kUnpackInfo:
-      {
-        ReadUnpackInfo(dataVector, folders);
-        break;
-      }
-      case NID::kSubStreamsInfo:
-      {
-        ReadSubStreamsInfo(folders, numUnpackStreamsInFolders,
-            unpackSizes, digestsDefined, digests);
-        break;
-      }
-      default:
-        ThrowIncorrect();
-    }
-  }
-}
-
-void CInArchive::ReadBoolVector(int numItems, CBoolVector &v)
-{
-  v.Clear();
-  v.Reserve(numItems);
-  Byte b = 0;
-  Byte mask = 0;
-  for (int i = 0; i < numItems; i++)
-  {
-    if (mask == 0)
-    {
-      b = ReadByte();
-      mask = 0x80;
-    }
-    v.Add((b & mask) != 0);
-    mask >>= 1;
-  }
-}
-
-void CInArchive::ReadBoolVector2(int numItems, CBoolVector &v)
-{
-  Byte allAreDefined = ReadByte();
-  if (allAreDefined == 0)
-  {
-    ReadBoolVector(numItems, v);
-    return;
-  }
-  v.Clear();
-  v.Reserve(numItems);
-  for (int i = 0; i < numItems; i++)
-    v.Add(true);
-}
-
-void CInArchive::ReadUInt64DefVector(const CObjectVector<CByteBuffer> &dataVector,
-    CUInt64DefVector &v, int numFiles)
-{
-  ReadBoolVector2(numFiles, v.Defined);
-
-  CStreamSwitch streamSwitch;
-  streamSwitch.Set(this, &dataVector);
-  v.Values.Reserve(numFiles);
-
-  for (int i = 0; i < numFiles; i++)
-  {
-    UInt64 t = 0;
-    if (v.Defined[i])
-      t = ReadUInt64();
-    v.Values.Add(t);
-  }
-}
-
-HRESULT CInArchive::ReadAndDecodePackedStreams(
-    DECL_EXTERNAL_CODECS_LOC_VARS
-    UInt64 baseOffset,
-    UInt64 &dataOffset, CObjectVector<CByteBuffer> &dataVector
-    #ifndef _NO_CRYPTO
-    , ICryptoGetTextPassword *getTextPassword, bool &passwordIsDefined
-    #endif
-    )
-{
-  CRecordVector<UInt64> packSizes;
-  CBoolVector packCRCsDefined;
-  CRecordVector<UInt32> packCRCs;
-  CObjectVector<CFolder> folders;
-  
-  CRecordVector<CNum> numUnpackStreamsInFolders;
-  CRecordVector<UInt64> unpackSizes;
-  CBoolVector digestsDefined;
-  CRecordVector<UInt32> digests;
-  
-  ReadStreamsInfo(NULL,
-    dataOffset,
-    packSizes,
-    packCRCsDefined,
-    packCRCs,
-    folders,
-    numUnpackStreamsInFolders,
-    unpackSizes,
-    digestsDefined,
-    digests);
-  
-  // db.ArchiveInfo.DataStartPosition2 += db.ArchiveInfo.StartPositionAfterHeader;
-  
-  CNum packIndex = 0;
-  CDecoder decoder(
-    #ifdef _ST_MODE
-    false
-    #else
-    true
-    #endif
-    );
-  UInt64 dataStartPos = baseOffset + dataOffset;
-  for (int i = 0; i < folders.Size(); i++)
-  {
-    const CFolder &folder = folders[i];
-    dataVector.Add(CByteBuffer());
-    CByteBuffer &data = dataVector.Back();
-    UInt64 unpackSize64 = folder.GetUnpackSize();
-    size_t unpackSize = (size_t)unpackSize64;
-    if (unpackSize != unpackSize64)
-      ThrowUnsupported();
-    data.SetCapacity(unpackSize);
-    
-    CSequentialOutStreamImp2 *outStreamSpec = new CSequentialOutStreamImp2;
-    CMyComPtr<ISequentialOutStream> outStream = outStreamSpec;
-    outStreamSpec->Init(data, unpackSize);
-    
-    HRESULT result = decoder.Decode(
-      EXTERNAL_CODECS_LOC_VARS
-      _stream, dataStartPos,
-      &packSizes[packIndex], folder, outStream, NULL
-      #ifndef _NO_CRYPTO
-      , getTextPassword, passwordIsDefined
-      #endif
-      #ifdef COMPRESS_MT
-      , false, 1
-      #endif
-      );
-    RINOK(result);
-    
-    if (folder.UnpackCRCDefined)
-      if (CrcCalc(data, unpackSize) != folder.UnpackCRC)
-        ThrowIncorrect();
-    for (int j = 0; j < folder.PackStreams.Size(); j++)
-    {
-      UInt64 packSize = packSizes[packIndex++];
-      dataStartPos += packSize;
-      HeadersSize += packSize;
-    }
-  }
-  return S_OK;
-}
-
-HRESULT CInArchive::ReadHeader(
-    DECL_EXTERNAL_CODECS_LOC_VARS
-    CArchiveDatabaseEx &db
-    #ifndef _NO_CRYPTO
-    , ICryptoGetTextPassword *getTextPassword, bool &passwordIsDefined
-    #endif
-    )
-{
-  UInt64 type = ReadID();
-
-  if (type == NID::kArchiveProperties)
-  {
-    ReadArchiveProperties(db.ArchiveInfo);
-    type = ReadID();
-  }
- 
-  CObjectVector<CByteBuffer> dataVector;
-  
-  if (type == NID::kAdditionalStreamsInfo)
-  {
-    HRESULT result = ReadAndDecodePackedStreams(
-        EXTERNAL_CODECS_LOC_VARS
-        db.ArchiveInfo.StartPositionAfterHeader,
-        db.ArchiveInfo.DataStartPosition2,
-        dataVector
-        #ifndef _NO_CRYPTO
-        , getTextPassword, passwordIsDefined
-        #endif
-        );
-    RINOK(result);
-    db.ArchiveInfo.DataStartPosition2 += db.ArchiveInfo.StartPositionAfterHeader;
-    type = ReadID();
-  }
-
-  CRecordVector<UInt64> unpackSizes;
-  CBoolVector digestsDefined;
-  CRecordVector<UInt32> digests;
-  
-  if (type == NID::kMainStreamsInfo)
-  {
-    ReadStreamsInfo(&dataVector,
-        db.ArchiveInfo.DataStartPosition,
-        db.PackSizes,
-        db.PackCRCsDefined,
-        db.PackCRCs,
-        db.Folders,
-        db.NumUnpackStreamsVector,
-        unpackSizes,
-        digestsDefined,
-        digests);
-    db.ArchiveInfo.DataStartPosition += db.ArchiveInfo.StartPositionAfterHeader;
-    type = ReadID();
-  }
-  else
-  {
-    for (int i = 0; i < db.Folders.Size(); i++)
-    {
-      db.NumUnpackStreamsVector.Add(1);
-      CFolder &folder = db.Folders[i];
-      unpackSizes.Add(folder.GetUnpackSize());
-      digestsDefined.Add(folder.UnpackCRCDefined);
-      digests.Add(folder.UnpackCRC);
-    }
-  }
-
-  db.Files.Clear();
-
-  if (type == NID::kEnd)
-    return S_OK;
-  if (type != NID::kFilesInfo)
-    ThrowIncorrect();
-  
-  CNum numFiles = ReadNum();
-  db.Files.Reserve(numFiles);
-  CNum i;
-  for (i = 0; i < numFiles; i++)
-    db.Files.Add(CFileItem());
-
-  db.ArchiveInfo.FileInfoPopIDs.Add(NID::kSize);
-  if (!db.PackSizes.IsEmpty())
-    db.ArchiveInfo.FileInfoPopIDs.Add(NID::kPackInfo);
-  if (numFiles > 0  && !digests.IsEmpty())
-    db.ArchiveInfo.FileInfoPopIDs.Add(NID::kCRC);
-
-  CBoolVector emptyStreamVector;
-  BoolVector_Fill_False(emptyStreamVector, (int)numFiles);
-  CBoolVector emptyFileVector;
-  CBoolVector antiFileVector;
-  CNum numEmptyStreams = 0;
-
-  for (;;)
-  {
-    UInt64 type = ReadID();
-    if (type == NID::kEnd)
-      break;
-    UInt64 size = ReadNumber();
-    size_t ppp = _inByteBack->_pos;
-    bool addPropIdToList = true;
-    bool isKnownType = true;
-    if (type > ((UInt32)1 << 30))
-      isKnownType = false;
-    else switch((UInt32)type)
-    {
-      case NID::kName:
-      {
-        CStreamSwitch streamSwitch;
-        streamSwitch.Set(this, &dataVector);
-        for (int i = 0; i < db.Files.Size(); i++)
-          _inByteBack->ReadString(db.Files[i].Name);
-        break;
-      }
-      case NID::kWinAttributes:
-      {
-        CBoolVector boolVector;
-        ReadBoolVector2(db.Files.Size(), boolVector);
-        CStreamSwitch streamSwitch;
-        streamSwitch.Set(this, &dataVector);
-        for (i = 0; i < numFiles; i++)
-        {
-          CFileItem &file = db.Files[i];
-          file.AttribDefined = boolVector[i];
-          if (file.AttribDefined)
-            file.Attrib = ReadUInt32();
-        }
-        break;
-      }
-      case NID::kEmptyStream:
-      {
-        ReadBoolVector(numFiles, emptyStreamVector);
-        for (i = 0; i < (CNum)emptyStreamVector.Size(); i++)
-          if (emptyStreamVector[i])
-            numEmptyStreams++;
-
-        BoolVector_Fill_False(emptyFileVector, numEmptyStreams);
-        BoolVector_Fill_False(antiFileVector, numEmptyStreams);
-
-        break;
-      }
-      case NID::kEmptyFile:  ReadBoolVector(numEmptyStreams, emptyFileVector); break;
-      case NID::kAnti:  ReadBoolVector(numEmptyStreams, antiFileVector); break;
-      case NID::kStartPos:  ReadUInt64DefVector(dataVector, db.StartPos, (int)numFiles); break;
-      case NID::kCTime:  ReadUInt64DefVector(dataVector, db.CTime, (int)numFiles); break;
-      case NID::kATime:  ReadUInt64DefVector(dataVector, db.ATime, (int)numFiles); break;
-      case NID::kMTime:  ReadUInt64DefVector(dataVector, db.MTime, (int)numFiles); break;
-      case NID::kDummy:
-      {
-        for (UInt64 j = 0; j < size; j++)
-          if (ReadByte() != 0)
-            ThrowIncorrect();
-        addPropIdToList = false;
-        break;
-      }
-      default:
-        addPropIdToList = isKnownType = false;
-    }
-    if (isKnownType)
-    {
-      if(addPropIdToList)
-        db.ArchiveInfo.FileInfoPopIDs.Add(type);
-    }
-    else
-      SkeepData(size);
-    bool checkRecordsSize = (db.ArchiveInfo.Version.Major > 0 ||
-        db.ArchiveInfo.Version.Minor > 2);
-    if (checkRecordsSize && _inByteBack->_pos - ppp != size)
-      ThrowIncorrect();
-  }
-
-  CNum emptyFileIndex = 0;
-  CNum sizeIndex = 0;
-
-  CNum numAntiItems = 0;
-  for (i = 0; i < numEmptyStreams; i++)
-    if (antiFileVector[i])
-      numAntiItems++;
-    
-  for (i = 0; i < numFiles; i++)
-  {
-    CFileItem &file = db.Files[i];
-    bool isAnti;
-    file.HasStream = !emptyStreamVector[i];
-    if (file.HasStream)
-    {
-      file.IsDir = false;
-      isAnti = false;
-      file.Size = unpackSizes[sizeIndex];
-      file.Crc = digests[sizeIndex];
-      file.CrcDefined = digestsDefined[sizeIndex];
-      sizeIndex++;
-    }
-    else
-    {
-      file.IsDir = !emptyFileVector[emptyFileIndex];
-      isAnti = antiFileVector[emptyFileIndex];
-      emptyFileIndex++;
-      file.Size = 0;
-      file.CrcDefined = false;
-    }
-    if (numAntiItems != 0)
-      db.IsAnti.Add(isAnti);
-  }
-  return S_OK;
-}
-
-
-void CArchiveDatabaseEx::FillFolderStartPackStream()
-{
-  FolderStartPackStreamIndex.Clear();
-  FolderStartPackStreamIndex.Reserve(Folders.Size());
-  CNum startPos = 0;
-  for (int i = 0; i < Folders.Size(); i++)
-  {
-    FolderStartPackStreamIndex.Add(startPos);
-    startPos += (CNum)Folders[i].PackStreams.Size();
-  }
-}
-
-void CArchiveDatabaseEx::FillStartPos()
-{
-  PackStreamStartPositions.Clear();
-  PackStreamStartPositions.Reserve(PackSizes.Size());
-  UInt64 startPos = 0;
-  for (int i = 0; i < PackSizes.Size(); i++)
-  {
-    PackStreamStartPositions.Add(startPos);
-    startPos += PackSizes[i];
-  }
-}
-
-void CArchiveDatabaseEx::FillFolderStartFileIndex()
-{
-  FolderStartFileIndex.Clear();
-  FolderStartFileIndex.Reserve(Folders.Size());
-  FileIndexToFolderIndexMap.Clear();
-  FileIndexToFolderIndexMap.Reserve(Files.Size());
-  
-  int folderIndex = 0;
-  CNum indexInFolder = 0;
-  for (int i = 0; i < Files.Size(); i++)
-  {
-    const CFileItem &file = Files[i];
-    bool emptyStream = !file.HasStream;
-    if (emptyStream && indexInFolder == 0)
-    {
-      FileIndexToFolderIndexMap.Add(kNumNoIndex);
-      continue;
-    }
-    if (indexInFolder == 0)
-    {
-      // v3.13 incorrectly worked with empty folders
-      // v4.07: Loop for skipping empty folders
-      for (;;)
-      {
-        if (folderIndex >= Folders.Size())
-          ThrowIncorrect();
-        FolderStartFileIndex.Add(i); // check it
-        if (NumUnpackStreamsVector[folderIndex] != 0)
-          break;
-        folderIndex++;
-      }
-    }
-    FileIndexToFolderIndexMap.Add(folderIndex);
-    if (emptyStream)
-      continue;
-    indexInFolder++;
-    if (indexInFolder >= NumUnpackStreamsVector[folderIndex])
-    {
-      folderIndex++;
-      indexInFolder = 0;
-    }
-  }
-}
-
-HRESULT CInArchive::ReadDatabase2(
-    DECL_EXTERNAL_CODECS_LOC_VARS
-    CArchiveDatabaseEx &db
-    #ifndef _NO_CRYPTO
-    , ICryptoGetTextPassword *getTextPassword, bool &passwordIsDefined
-    #endif
-    )
-{
-  db.Clear();
-  db.ArchiveInfo.StartPosition = _arhiveBeginStreamPosition;
-
-  db.ArchiveInfo.Version.Major = _header[6];
-  db.ArchiveInfo.Version.Minor = _header[7];
-
-  if (db.ArchiveInfo.Version.Major != kMajorVersion)
-    ThrowUnsupportedVersion();
-
-  UInt32 crcFromArchive = Get32(_header + 8);
-  UInt64 nextHeaderOffset = Get64(_header + 0xC);
-  UInt64 nextHeaderSize = Get64(_header + 0x14);
-  UInt32 nextHeaderCRC = Get32(_header + 0x1C);
-  UInt32 crc = CrcCalc(_header + 0xC, 20);
-
-  #ifdef FORMAT_7Z_RECOVERY
-  if (crcFromArchive == 0 && nextHeaderOffset == 0 && nextHeaderSize == 0 && nextHeaderCRC == 0)
-  {
-    UInt64 cur, cur2;
-    RINOK(_stream->Seek(0, STREAM_SEEK_CUR, &cur));
-    const int kCheckSize = 500;
-    Byte buf[kCheckSize];
-    RINOK(_stream->Seek(0, STREAM_SEEK_END, &cur2));
-    int checkSize = kCheckSize;
-    if (cur2 - cur < kCheckSize)
-      checkSize = (int)(cur2 - cur);
-    RINOK(_stream->Seek(-checkSize, STREAM_SEEK_END, &cur2));
-    
-    RINOK(ReadStream_FALSE(_stream, buf, (size_t)checkSize));
-
-    int i;
-    for (i = (int)checkSize - 2; i >= 0; i--)
-      if (buf[i] == 0x17 && buf[i + 1] == 0x6 || buf[i] == 0x01 && buf[i + 1] == 0x04)
-        break;
-    if (i < 0)
-      return S_FALSE;
-    nextHeaderSize = checkSize - i;
-    nextHeaderOffset = cur2 - cur + i;
-    nextHeaderCRC = CrcCalc(buf + i, (size_t)nextHeaderSize);
-    RINOK(_stream->Seek(cur, STREAM_SEEK_SET, NULL));
-  }
-  #endif
-
-  #ifdef FORMAT_7Z_RECOVERY
-  crcFromArchive = crc;
-  #endif
-
-  db.ArchiveInfo.StartPositionAfterHeader = _arhiveBeginStreamPosition + kHeaderSize;
-
-  if (crc != crcFromArchive)
-    ThrowIncorrect();
-
-  if (nextHeaderSize == 0)
-    return S_OK;
-
-  if (nextHeaderSize > (UInt64)0xFFFFFFFF)
-    return S_FALSE;
-
-  RINOK(_stream->Seek(nextHeaderOffset, STREAM_SEEK_CUR, NULL));
-
-  CByteBuffer buffer2;
-  buffer2.SetCapacity((size_t)nextHeaderSize);
-
-  RINOK(ReadStream_FALSE(_stream, buffer2, (size_t)nextHeaderSize));
-  HeadersSize += kHeaderSize + nextHeaderSize;
-  db.PhySize = kHeaderSize + nextHeaderOffset + nextHeaderSize;
-
-  if (CrcCalc(buffer2, (UInt32)nextHeaderSize) != nextHeaderCRC)
-    ThrowIncorrect();
-  
-  CStreamSwitch streamSwitch;
-  streamSwitch.Set(this, buffer2);
-  
-  CObjectVector<CByteBuffer> dataVector;
-  
-  UInt64 type = ReadID();
-  if (type != NID::kHeader)
-  {
-    if (type != NID::kEncodedHeader)
-      ThrowIncorrect();
-    HRESULT result = ReadAndDecodePackedStreams(
-        EXTERNAL_CODECS_LOC_VARS
-        db.ArchiveInfo.StartPositionAfterHeader,
-        db.ArchiveInfo.DataStartPosition2,
-        dataVector
-        #ifndef _NO_CRYPTO
-        , getTextPassword, passwordIsDefined
-        #endif
-        );
-    RINOK(result);
-    if (dataVector.Size() == 0)
-      return S_OK;
-    if (dataVector.Size() > 1)
-      ThrowIncorrect();
-    streamSwitch.Remove();
-    streamSwitch.Set(this, dataVector.Front());
-    if (ReadID() != NID::kHeader)
-      ThrowIncorrect();
-  }
-
-  db.HeadersSize = HeadersSize;
-
-  return ReadHeader(
-    EXTERNAL_CODECS_LOC_VARS
-    db
-    #ifndef _NO_CRYPTO
-    , getTextPassword, passwordIsDefined
-    #endif
-    );
-}
-
-HRESULT CInArchive::ReadDatabase(
-    DECL_EXTERNAL_CODECS_LOC_VARS
-    CArchiveDatabaseEx &db
-    #ifndef _NO_CRYPTO
-    , ICryptoGetTextPassword *getTextPassword, bool &passwordIsDefined
-    #endif
-    )
-{
-  try
-  {
-    return ReadDatabase2(
-      EXTERNAL_CODECS_LOC_VARS db
-      #ifndef _NO_CRYPTO
-      , getTextPassword, passwordIsDefined
-      #endif
-      );
-  }
-  catch(CInArchiveException &) { return S_FALSE; }
-}
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zIn.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zIn.h
deleted file mode 100644
index 09c5110..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zIn.h
+++ /dev/null
@@ -1,245 +0,0 @@
-// 7zIn.h
-
-#ifndef __7Z_IN_H
-#define __7Z_IN_H
-
-#include "../../../Common/MyCom.h"
-
-#include "../../IPassword.h"
-#include "../../IStream.h"
-
-#include "../../Common/CreateCoder.h"
-#include "../../Common/InBuffer.h"
-
-#include "7zItem.h"
- 
-namespace NArchive {
-namespace N7z {
-  
-struct CInArchiveInfo
-{
-  CArchiveVersion Version;
-  UInt64 StartPosition;
-  UInt64 StartPositionAfterHeader;
-  UInt64 DataStartPosition;
-  UInt64 DataStartPosition2;
-  CRecordVector<UInt64> FileInfoPopIDs;
-  void Clear()
-  {
-    FileInfoPopIDs.Clear();
-  }
-};
-
-struct CArchiveDatabaseEx: public CArchiveDatabase
-{
-  CInArchiveInfo ArchiveInfo;
-  CRecordVector<UInt64> PackStreamStartPositions;
-  CRecordVector<CNum> FolderStartPackStreamIndex;
-  CRecordVector<CNum> FolderStartFileIndex;
-  CRecordVector<CNum> FileIndexToFolderIndexMap;
-
-  UInt64 HeadersSize;
-  UInt64 PhySize;
-
-  void Clear()
-  {
-    CArchiveDatabase::Clear();
-    ArchiveInfo.Clear();
-    PackStreamStartPositions.Clear();
-    FolderStartPackStreamIndex.Clear();
-    FolderStartFileIndex.Clear();
-    FileIndexToFolderIndexMap.Clear();
-
-    HeadersSize = 0;
-    PhySize = 0;
-  }
-
-  void FillFolderStartPackStream();
-  void FillStartPos();
-  void FillFolderStartFileIndex();
-
-  void Fill()
-  {
-    FillFolderStartPackStream();
-    FillStartPos();
-    FillFolderStartFileIndex();
-  }
-  
-  UInt64 GetFolderStreamPos(int folderIndex, int indexInFolder) const
-  {
-    return ArchiveInfo.DataStartPosition +
-        PackStreamStartPositions[FolderStartPackStreamIndex[folderIndex] + indexInFolder];
-  }
-  
-  UInt64 GetFolderFullPackSize(int folderIndex) const
-  {
-    CNum packStreamIndex = FolderStartPackStreamIndex[folderIndex];
-    const CFolder &folder = Folders[folderIndex];
-    UInt64 size = 0;
-    for (int i = 0; i < folder.PackStreams.Size(); i++)
-      size += PackSizes[packStreamIndex + i];
-    return size;
-  }
-  
-  UInt64 GetFolderPackStreamSize(int folderIndex, int streamIndex) const
-  {
-    return PackSizes[FolderStartPackStreamIndex[folderIndex] + streamIndex];
-  }
-
-  UInt64 GetFilePackSize(CNum fileIndex) const
-  {
-    CNum folderIndex = FileIndexToFolderIndexMap[fileIndex];
-    if (folderIndex != kNumNoIndex)
-      if (FolderStartFileIndex[folderIndex] == fileIndex)
-        return GetFolderFullPackSize(folderIndex);
-    return 0;
-  }
-};
-
-class CInByte2
-{
-  const Byte *_buffer;
-  size_t _size;
-public:
-  size_t _pos;
-  void Init(const Byte *buffer, size_t size)
-  {
-    _buffer = buffer;
-    _size = size;
-    _pos = 0;
-  }
-  Byte ReadByte();
-  void ReadBytes(Byte *data, size_t size);
-  void SkeepData(UInt64 size);
-  void SkeepData();
-  UInt64 ReadNumber();
-  CNum ReadNum();
-  UInt32 ReadUInt32();
-  UInt64 ReadUInt64();
-  void ReadString(UString &s);
-};
-
-class CStreamSwitch;
-
-const UInt32 kHeaderSize = 32;
-
-class CInArchive
-{
-  friend class CStreamSwitch;
-
-  CMyComPtr<IInStream> _stream;
-
-  CObjectVector<CInByte2> _inByteVector;
-  CInByte2 *_inByteBack;
- 
-  UInt64 _arhiveBeginStreamPosition;
-
-  Byte _header[kHeaderSize];
-
-  UInt64 HeadersSize;
-
-  void AddByteStream(const Byte *buffer, size_t size)
-  {
-    _inByteVector.Add(CInByte2());
-    _inByteBack = &_inByteVector.Back();
-    _inByteBack->Init(buffer, size);
-  }
-  
-  void DeleteByteStream()
-  {
-    _inByteVector.DeleteBack();
-    if (!_inByteVector.IsEmpty())
-      _inByteBack = &_inByteVector.Back();
-  }
-
-private:
-  HRESULT FindAndReadSignature(IInStream *stream, const UInt64 *searchHeaderSizeLimit);
-  
-  void ReadBytes(Byte *data, size_t size) { _inByteBack->ReadBytes(data, size); }
-  Byte ReadByte() { return _inByteBack->ReadByte(); }
-  UInt64 ReadNumber() { return _inByteBack->ReadNumber(); }
-  CNum ReadNum() { return _inByteBack->ReadNum(); }
-  UInt64 ReadID() { return _inByteBack->ReadNumber(); }
-  UInt32 ReadUInt32() { return _inByteBack->ReadUInt32(); }
-  UInt64 ReadUInt64() { return _inByteBack->ReadUInt64(); }
-  void SkeepData(UInt64 size) { _inByteBack->SkeepData(size); }
-  void SkeepData() { _inByteBack->SkeepData(); }
-  void WaitAttribute(UInt64 attribute);
-
-  void ReadArchiveProperties(CInArchiveInfo &archiveInfo);
-  void GetNextFolderItem(CFolder &itemInfo);
-  void ReadHashDigests(int numItems,
-      CBoolVector &digestsDefined, CRecordVector<UInt32> &digests);
-  
-  void ReadPackInfo(
-      UInt64 &dataOffset,
-      CRecordVector<UInt64> &packSizes,
-      CBoolVector &packCRCsDefined,
-      CRecordVector<UInt32> &packCRCs);
-  
-  void ReadUnpackInfo(
-      const CObjectVector<CByteBuffer> *dataVector,
-      CObjectVector<CFolder> &folders);
-  
-  void ReadSubStreamsInfo(
-      const CObjectVector<CFolder> &folders,
-      CRecordVector<CNum> &numUnpackStreamsInFolders,
-      CRecordVector<UInt64> &unpackSizes,
-      CBoolVector &digestsDefined,
-      CRecordVector<UInt32> &digests);
-
-  void ReadStreamsInfo(
-      const CObjectVector<CByteBuffer> *dataVector,
-      UInt64 &dataOffset,
-      CRecordVector<UInt64> &packSizes,
-      CBoolVector &packCRCsDefined,
-      CRecordVector<UInt32> &packCRCs,
-      CObjectVector<CFolder> &folders,
-      CRecordVector<CNum> &numUnpackStreamsInFolders,
-      CRecordVector<UInt64> &unpackSizes,
-      CBoolVector &digestsDefined,
-      CRecordVector<UInt32> &digests);
-
-
-  void ReadBoolVector(int numItems, CBoolVector &v);
-  void ReadBoolVector2(int numItems, CBoolVector &v);
-  void ReadUInt64DefVector(const CObjectVector<CByteBuffer> &dataVector,
-      CUInt64DefVector &v, int numFiles);
-  HRESULT ReadAndDecodePackedStreams(
-      DECL_EXTERNAL_CODECS_LOC_VARS
-      UInt64 baseOffset, UInt64 &dataOffset,
-      CObjectVector<CByteBuffer> &dataVector
-      #ifndef _NO_CRYPTO
-      , ICryptoGetTextPassword *getTextPassword, bool &passwordIsDefined
-      #endif
-      );
-  HRESULT ReadHeader(
-      DECL_EXTERNAL_CODECS_LOC_VARS
-      CArchiveDatabaseEx &db
-      #ifndef _NO_CRYPTO
-      ,ICryptoGetTextPassword *getTextPassword, bool &passwordIsDefined
-      #endif
-      );
-  HRESULT ReadDatabase2(
-      DECL_EXTERNAL_CODECS_LOC_VARS
-      CArchiveDatabaseEx &db
-      #ifndef _NO_CRYPTO
-      ,ICryptoGetTextPassword *getTextPassword, bool &passwordIsDefined
-      #endif
-      );
-public:
-  HRESULT Open(IInStream *stream, const UInt64 *searchHeaderSizeLimit); // S_FALSE means is not archive
-  void Close();
-
-  HRESULT ReadDatabase(
-      DECL_EXTERNAL_CODECS_LOC_VARS
-      CArchiveDatabaseEx &db
-      #ifndef _NO_CRYPTO
-      ,ICryptoGetTextPassword *getTextPassword, bool &passwordIsDefined
-      #endif
-      );
-};
-  
-}}
-  
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zItem.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zItem.h
deleted file mode 100644
index 1c3068b..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zItem.h
+++ /dev/null
@@ -1,258 +0,0 @@
-// 7zItem.h
-
-#ifndef __7Z_ITEM_H
-#define __7Z_ITEM_H
-
-#include "../../../Common/Buffer.h"
-#include "../../../Common/MyString.h"
-
-#include "../../Common/MethodId.h"
-
-#include "7zHeader.h"
-
-namespace NArchive {
-namespace N7z {
-
-typedef UInt32 CNum;
-const CNum kNumMax     = 0x7FFFFFFF;
-const CNum kNumNoIndex = 0xFFFFFFFF;
-
-struct CCoderInfo
-{
-  CMethodId MethodID;
-  CByteBuffer Props;
-  CNum NumInStreams;
-  CNum NumOutStreams;
-  bool IsSimpleCoder() const { return (NumInStreams == 1) && (NumOutStreams == 1); }
-};
-
-struct CBindPair
-{
-  CNum InIndex;
-  CNum OutIndex;
-};
-
-struct CFolder
-{
-  CObjectVector<CCoderInfo> Coders;
-  CRecordVector<CBindPair> BindPairs;
-  CRecordVector<CNum> PackStreams;
-  CRecordVector<UInt64> UnpackSizes;
-  UInt32 UnpackCRC;
-  bool UnpackCRCDefined;
-
-  CFolder(): UnpackCRCDefined(false) {}
-
-  UInt64 GetUnpackSize() const // test it
-  {
-    if (UnpackSizes.IsEmpty())
-      return 0;
-    for (int i = UnpackSizes.Size() - 1; i >= 0; i--)
-      if (FindBindPairForOutStream(i) < 0)
-        return UnpackSizes[i];
-    throw 1;
-  }
-
-  CNum GetNumOutStreams() const
-  {
-    CNum result = 0;
-    for (int i = 0; i < Coders.Size(); i++)
-      result += Coders[i].NumOutStreams;
-    return result;
-  }
-
-  int FindBindPairForInStream(CNum inStreamIndex) const
-  {
-    for(int i = 0; i < BindPairs.Size(); i++)
-      if (BindPairs[i].InIndex == inStreamIndex)
-        return i;
-    return -1;
-  }
-  int FindBindPairForOutStream(CNum outStreamIndex) const
-  {
-    for(int i = 0; i < BindPairs.Size(); i++)
-      if (BindPairs[i].OutIndex == outStreamIndex)
-        return i;
-    return -1;
-  }
-  int FindPackStreamArrayIndex(CNum inStreamIndex) const
-  {
-    for(int i = 0; i < PackStreams.Size(); i++)
-      if (PackStreams[i] == inStreamIndex)
-        return i;
-    return -1;
-  }
-
-  bool CheckStructure() const;
-};
-
-struct CUInt64DefVector
-{
-  CRecordVector<UInt64> Values;
-  CRecordVector<bool> Defined;
-  
-  void Clear()
-  {
-    Values.Clear();
-    Defined.Clear();
-  }
-  
-  void ReserveDown()
-  {
-    Values.ReserveDown();
-    Values.ReserveDown();
-  }
-
-  bool GetItem(int index, UInt64 &value) const
-  {
-    if (index < Defined.Size() && Defined[index])
-    {
-      value = Values[index];
-      return true;
-    }
-    value = 0;
-    return false;
-  }
-  
-  void SetItem(int index, bool defined, UInt64 value)
-  {
-    while (index >= Defined.Size())
-      Defined.Add(false);
-    Defined[index] = defined;
-    if (!defined)
-      return;
-    while (index >= Values.Size())
-      Values.Add(0);
-    Values[index] = value;
-  }
-
-  bool CheckSize(int size) const { return Defined.Size() == size || Defined.Size() == 0; }
-};
-
-struct CFileItem
-{
-  UInt64 Size;
-  UInt32 Attrib;
-  UInt32 Crc;
-  UString Name;
-
-  bool HasStream; // Test it !!! it means that there is
-                  // stream in some folder. It can be empty stream
-  bool IsDir;
-  bool CrcDefined;
-  bool AttribDefined;
-
-  CFileItem():
-    HasStream(true),
-    IsDir(false),
-    CrcDefined(false),
-    AttribDefined(false)
-      {}
-  void SetAttrib(UInt32 attrib)
-  {
-    AttribDefined = true;
-    Attrib = attrib;
-  }
-};
-
-struct CFileItem2
-{
-  UInt64 CTime;
-  UInt64 ATime;
-  UInt64 MTime;
-  UInt64 StartPos;
-  bool CTimeDefined;
-  bool ATimeDefined;
-  bool MTimeDefined;
-  bool StartPosDefined;
-  bool IsAnti;
-};
-
-struct CArchiveDatabase
-{
-  CRecordVector<UInt64> PackSizes;
-  CRecordVector<bool> PackCRCsDefined;
-  CRecordVector<UInt32> PackCRCs;
-  CObjectVector<CFolder> Folders;
-  CRecordVector<CNum> NumUnpackStreamsVector;
-  CObjectVector<CFileItem> Files;
-
-  CUInt64DefVector CTime;
-  CUInt64DefVector ATime;
-  CUInt64DefVector MTime;
-  CUInt64DefVector StartPos;
-  CRecordVector<bool> IsAnti;
-
-  void Clear()
-  {
-    PackSizes.Clear();
-    PackCRCsDefined.Clear();
-    PackCRCs.Clear();
-    Folders.Clear();
-    NumUnpackStreamsVector.Clear();
-    Files.Clear();
-    CTime.Clear();
-    ATime.Clear();
-    MTime.Clear();
-    StartPos.Clear();
-    IsAnti.Clear();
-  }
-
-  void ReserveDown()
-  {
-    PackSizes.ReserveDown();
-    PackCRCsDefined.ReserveDown();
-    PackCRCs.ReserveDown();
-    Folders.ReserveDown();
-    NumUnpackStreamsVector.ReserveDown();
-    Files.ReserveDown();
-    CTime.ReserveDown();
-    ATime.ReserveDown();
-    MTime.ReserveDown();
-    StartPos.ReserveDown();
-    IsAnti.ReserveDown();
-  }
-
-  bool IsEmpty() const
-  {
-    return (PackSizes.IsEmpty() &&
-      PackCRCsDefined.IsEmpty() &&
-      PackCRCs.IsEmpty() &&
-      Folders.IsEmpty() &&
-      NumUnpackStreamsVector.IsEmpty() &&
-      Files.IsEmpty());
-  }
-
-  bool CheckNumFiles() const
-  {
-    int size = Files.Size();
-    return (
-      CTime.CheckSize(size) &&
-      ATime.CheckSize(size) &&
-      MTime.CheckSize(size) &&
-      StartPos.CheckSize(size) &&
-      (size == IsAnti.Size() || IsAnti.Size() == 0));
-  }
-
-  bool IsSolid() const
-  {
-    for (int i = 0; i < NumUnpackStreamsVector.Size(); i++)
-      if (NumUnpackStreamsVector[i] > 1)
-        return true;
-    return false;
-  }
-  bool IsItemAnti(int index) const { return (index < IsAnti.Size() && IsAnti[index]); }
-  void SetItemAnti(int index, bool isAnti)
-  {
-    while (index >= IsAnti.Size())
-      IsAnti.Add(false);
-    IsAnti[index] = isAnti;
-  }
-
-  void GetFile(int index, CFileItem &file, CFileItem2 &file2) const;
-  void AddFile(const CFileItem &file, const CFileItem2 &file2);
-};
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zOut.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zOut.cpp
deleted file mode 100644
index 7ac3c18..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zOut.cpp
+++ /dev/null
@@ -1,876 +0,0 @@
-// 7zOut.cpp
-
-#include "StdAfx.h"
-
-#include "../../../Common/AutoPtr.h"
-#include "../../Common/StreamObjects.h"
-
-#include "7zOut.h"
-
-extern "C"
-{
-#include "../../../../C/7zCrc.h"
-}
-
-static HRESULT WriteBytes(ISequentialOutStream *stream, const void *data, size_t size)
-{
-  while (size > 0)
-  {
-    UInt32 curSize = (UInt32)MyMin(size, (size_t)0xFFFFFFFF);
-    UInt32 processedSize;
-    RINOK(stream->Write(data, curSize, &processedSize));
-    if (processedSize == 0)
-      return E_FAIL;
-    data = (const void *)((const Byte *)data + processedSize);
-    size -= processedSize;
-  }
-  return S_OK;
-}
-
-namespace NArchive {
-namespace N7z {
-
-HRESULT COutArchive::WriteDirect(const void *data, UInt32 size)
-{
-  return ::WriteBytes(SeqStream, data, size);
-}
-
-HRESULT COutArchive::WriteSignature()
-{
-  Byte buf[8];
-  memcpy(buf, kSignature, kSignatureSize);
-  buf[kSignatureSize] = kMajorVersion;
-  buf[kSignatureSize + 1] = 3;
-  return WriteDirect(buf, 8);
-}
-
-#ifdef _7Z_VOL
-HRESULT COutArchive::WriteFinishSignature()
-{
-  RINOK(WriteDirect(kFinishSignature, kSignatureSize));
-  CArchiveVersion av;
-  av.Major = kMajorVersion;
-  av.Minor = 2;
-  RINOK(WriteDirectByte(av.Major));
-  return WriteDirectByte(av.Minor);
-}
-#endif
-
-static void SetUInt32(Byte *p, UInt32 d)
-{
-  for (int i = 0; i < 4; i++, d >>= 8)
-    p[i] = (Byte)d;
-}
-
-static void SetUInt64(Byte *p, UInt64 d)
-{
-  for (int i = 0; i < 8; i++, d >>= 8)
-    p[i] = (Byte)d;
-}
-
-HRESULT COutArchive::WriteStartHeader(const CStartHeader &h)
-{
-  Byte buf[24];
-  SetUInt64(buf + 4, h.NextHeaderOffset);
-  SetUInt64(buf + 12, h.NextHeaderSize);
-  SetUInt32(buf + 20, h.NextHeaderCRC);
-  SetUInt32(buf, CrcCalc(buf + 4, 20));
-  return WriteDirect(buf, 24);
-}
-
-#ifdef _7Z_VOL
-HRESULT COutArchive::WriteFinishHeader(const CFinishHeader &h)
-{
-  CCRC crc;
-  crc.UpdateUInt64(h.NextHeaderOffset);
-  crc.UpdateUInt64(h.NextHeaderSize);
-  crc.UpdateUInt32(h.NextHeaderCRC);
-  crc.UpdateUInt64(h.ArchiveStartOffset);
-  crc.UpdateUInt64(h.AdditionalStartBlockSize);
-  RINOK(WriteDirectUInt32(crc.GetDigest()));
-  RINOK(WriteDirectUInt64(h.NextHeaderOffset));
-  RINOK(WriteDirectUInt64(h.NextHeaderSize));
-  RINOK(WriteDirectUInt32(h.NextHeaderCRC));
-  RINOK(WriteDirectUInt64(h.ArchiveStartOffset));
-  return WriteDirectUInt64(h.AdditionalStartBlockSize);
-}
-#endif
-
-HRESULT COutArchive::Create(ISequentialOutStream *stream, bool endMarker)
-{
-  Close();
-  #ifdef _7Z_VOL
-  // endMarker = false;
-  _endMarker = endMarker;
-  #endif
-  SeqStream = stream;
-  if (!endMarker)
-  {
-    SeqStream.QueryInterface(IID_IOutStream, &Stream);
-    if (!Stream)
-    {
-      return E_NOTIMPL;
-      // endMarker = true;
-    }
-  }
-  #ifdef _7Z_VOL
-  if (endMarker)
-  {
-    /*
-    CStartHeader sh;
-    sh.NextHeaderOffset = (UInt32)(Int32)-1;
-    sh.NextHeaderSize = (UInt32)(Int32)-1;
-    sh.NextHeaderCRC = 0;
-    WriteStartHeader(sh);
-    */
-  }
-  else
-  #endif
-  {
-    if (!Stream)
-      return E_FAIL;
-    RINOK(WriteSignature());
-    RINOK(Stream->Seek(0, STREAM_SEEK_CUR, &_prefixHeaderPos));
-  }
-  return S_OK;
-}
-
-void COutArchive::Close()
-{
-  SeqStream.Release();
-  Stream.Release();
-}
-
-HRESULT COutArchive::SkeepPrefixArchiveHeader()
-{
-  #ifdef _7Z_VOL
-  if (_endMarker)
-    return S_OK;
-  #endif
-  return Stream->Seek(24, STREAM_SEEK_CUR, NULL);
-}
-
-UInt64 COutArchive::GetPos() const
-{
-  if (_countMode)
-    return _countSize;
-  if (_writeToStream)
-    return _outByte.GetProcessedSize();
-  return _outByte2.GetPos();
-}
-
-void COutArchive::WriteBytes(const void *data, size_t size)
-{
-  if (_countMode)
-    _countSize += size;
-  else if (_writeToStream)
-  {
-    _outByte.WriteBytes(data, size);
-    _crc = CrcUpdate(_crc, data, size);
-  }
-  else
-    _outByte2.WriteBytes(data, size);
-}
-
-void COutArchive::WriteByte(Byte b)
-{
-  if (_countMode)
-    _countSize++;
-  else if (_writeToStream)
-  {
-    _outByte.WriteByte(b);
-    _crc = CRC_UPDATE_BYTE(_crc, b);
-  }
-  else
-    _outByte2.WriteByte(b);
-}
-
-void COutArchive::WriteUInt32(UInt32 value)
-{
-  for (int i = 0; i < 4; i++)
-  {
-    WriteByte((Byte)value);
-    value >>= 8;
-  }
-}
-
-void COutArchive::WriteUInt64(UInt64 value)
-{
-  for (int i = 0; i < 8; i++)
-  {
-    WriteByte((Byte)value);
-    value >>= 8;
-  }
-}
-
-void COutArchive::WriteNumber(UInt64 value)
-{
-  Byte firstByte = 0;
-  Byte mask = 0x80;
-  int i;
-  for (i = 0; i < 8; i++)
-  {
-    if (value < ((UInt64(1) << ( 7  * (i + 1)))))
-    {
-      firstByte |= Byte(value >> (8 * i));
-      break;
-    }
-    firstByte |= mask;
-    mask >>= 1;
-  }
-  WriteByte(firstByte);
-  for (;i > 0; i--)
-  {
-    WriteByte((Byte)value);
-    value >>= 8;
-  }
-}
-
-static UInt32 GetBigNumberSize(UInt64 value)
-{
-  int i;
-  for (i = 1; i < 9; i++)
-    if (value < (((UInt64)1 << (i * 7))))
-      break;
-  return i;
-}
-
-#ifdef _7Z_VOL
-UInt32 COutArchive::GetVolHeadersSize(UInt64 dataSize, int nameLength, bool props)
-{
-  UInt32 result = GetBigNumberSize(dataSize) * 2 + 41;
-  if (nameLength != 0)
-  {
-    nameLength = (nameLength + 1) * 2;
-    result += nameLength + GetBigNumberSize(nameLength) + 2;
-  }
-  if (props)
-  {
-    result += 20;
-  }
-  if (result >= 128)
-    result++;
-  result += kSignatureSize + 2 + kFinishHeaderSize;
-  return result;
-}
-
-UInt64 COutArchive::GetVolPureSize(UInt64 volSize, int nameLength, bool props)
-{
-  UInt32 headersSizeBase = COutArchive::GetVolHeadersSize(1, nameLength, props);
-  int testSize;
-  if (volSize > headersSizeBase)
-    testSize = volSize - headersSizeBase;
-  else
-    testSize = 1;
-  UInt32 headersSize = COutArchive::GetVolHeadersSize(testSize, nameLength, props);
-  UInt64 pureSize = 1;
-  if (volSize > headersSize)
-    pureSize = volSize - headersSize;
-  return pureSize;
-}
-#endif
-
-void COutArchive::WriteFolder(const CFolder &folder)
-{
-  WriteNumber(folder.Coders.Size());
-  int i;
-  for (i = 0; i < folder.Coders.Size(); i++)
-  {
-    const CCoderInfo &coder = folder.Coders[i];
-    {
-      size_t propsSize = coder.Props.GetCapacity();
-      
-      UInt64 id = coder.MethodID;
-      int idSize;
-      for (idSize = 1; idSize < sizeof(id); idSize++)
-        if ((id >> (8 * idSize)) == 0)
-          break;
-      BYTE longID[15];
-      for (int t = idSize - 1; t >= 0 ; t--, id >>= 8)
-        longID[t] = (Byte)(id & 0xFF);
-      Byte b;
-      b = (Byte)(idSize & 0xF);
-      bool isComplex = !coder.IsSimpleCoder();
-      b |= (isComplex ? 0x10 : 0);
-      b |= ((propsSize != 0) ? 0x20 : 0 );
-      WriteByte(b);
-      WriteBytes(longID, idSize);
-      if (isComplex)
-      {
-        WriteNumber(coder.NumInStreams);
-        WriteNumber(coder.NumOutStreams);
-      }
-      if (propsSize == 0)
-        continue;
-      WriteNumber(propsSize);
-      WriteBytes(coder.Props, propsSize);
-    }
-  }
-  for (i = 0; i < folder.BindPairs.Size(); i++)
-  {
-    const CBindPair &bindPair = folder.BindPairs[i];
-    WriteNumber(bindPair.InIndex);
-    WriteNumber(bindPair.OutIndex);
-  }
-  if (folder.PackStreams.Size() > 1)
-    for (i = 0; i < folder.PackStreams.Size(); i++)
-    {
-      WriteNumber(folder.PackStreams[i]);
-    }
-}
-
-void COutArchive::WriteBoolVector(const CBoolVector &boolVector)
-{
-  Byte b = 0;
-  Byte mask = 0x80;
-  for (int i = 0; i < boolVector.Size(); i++)
-  {
-    if (boolVector[i])
-      b |= mask;
-    mask >>= 1;
-    if (mask == 0)
-    {
-      WriteByte(b);
-      mask = 0x80;
-      b = 0;
-    }
-  }
-  if (mask != 0x80)
-    WriteByte(b);
-}
-
-
-void COutArchive::WriteHashDigests(
-    const CRecordVector<bool> &digestsDefined,
-    const CRecordVector<UInt32> &digests)
-{
-  int numDefined = 0;
-  int i;
-  for (i = 0; i < digestsDefined.Size(); i++)
-    if (digestsDefined[i])
-      numDefined++;
-  if (numDefined == 0)
-    return;
-
-  WriteByte(NID::kCRC);
-  if (numDefined == digestsDefined.Size())
-    WriteByte(1);
-  else
-  {
-    WriteByte(0);
-    WriteBoolVector(digestsDefined);
-  }
-  for (i = 0; i < digests.Size(); i++)
-    if (digestsDefined[i])
-      WriteUInt32(digests[i]);
-}
-
-void COutArchive::WritePackInfo(
-    UInt64 dataOffset,
-    const CRecordVector<UInt64> &packSizes,
-    const CRecordVector<bool> &packCRCsDefined,
-    const CRecordVector<UInt32> &packCRCs)
-{
-  if (packSizes.IsEmpty())
-    return;
-  WriteByte(NID::kPackInfo);
-  WriteNumber(dataOffset);
-  WriteNumber(packSizes.Size());
-  WriteByte(NID::kSize);
-  for (int i = 0; i < packSizes.Size(); i++)
-    WriteNumber(packSizes[i]);
-
-  WriteHashDigests(packCRCsDefined, packCRCs);
-  
-  WriteByte(NID::kEnd);
-}
-
-void COutArchive::WriteUnpackInfo(const CObjectVector<CFolder> &folders)
-{
-  if (folders.IsEmpty())
-    return;
-
-  WriteByte(NID::kUnpackInfo);
-
-  WriteByte(NID::kFolder);
-  WriteNumber(folders.Size());
-  {
-    WriteByte(0);
-    for (int i = 0; i < folders.Size(); i++)
-      WriteFolder(folders[i]);
-  }
-  
-  WriteByte(NID::kCodersUnpackSize);
-  int i;
-  for (i = 0; i < folders.Size(); i++)
-  {
-    const CFolder &folder = folders[i];
-    for (int j = 0; j < folder.UnpackSizes.Size(); j++)
-      WriteNumber(folder.UnpackSizes[j]);
-  }
-
-  CRecordVector<bool> unpackCRCsDefined;
-  CRecordVector<UInt32> unpackCRCs;
-  for (i = 0; i < folders.Size(); i++)
-  {
-    const CFolder &folder = folders[i];
-    unpackCRCsDefined.Add(folder.UnpackCRCDefined);
-    unpackCRCs.Add(folder.UnpackCRC);
-  }
-  WriteHashDigests(unpackCRCsDefined, unpackCRCs);
-
-  WriteByte(NID::kEnd);
-}
-
-void COutArchive::WriteSubStreamsInfo(
-    const CObjectVector<CFolder> &folders,
-    const CRecordVector<CNum> &numUnpackStreamsInFolders,
-    const CRecordVector<UInt64> &unpackSizes,
-    const CRecordVector<bool> &digestsDefined,
-    const CRecordVector<UInt32> &digests)
-{
-  WriteByte(NID::kSubStreamsInfo);
-
-  int i;
-  for (i = 0; i < numUnpackStreamsInFolders.Size(); i++)
-  {
-    if (numUnpackStreamsInFolders[i] != 1)
-    {
-      WriteByte(NID::kNumUnpackStream);
-      for (i = 0; i < numUnpackStreamsInFolders.Size(); i++)
-        WriteNumber(numUnpackStreamsInFolders[i]);
-      break;
-    }
-  }
- 
-
-  bool needFlag = true;
-  CNum index = 0;
-  for (i = 0; i < numUnpackStreamsInFolders.Size(); i++)
-    for (CNum j = 0; j < numUnpackStreamsInFolders[i]; j++)
-    {
-      if (j + 1 != numUnpackStreamsInFolders[i])
-      {
-        if (needFlag)
-          WriteByte(NID::kSize);
-        needFlag = false;
-        WriteNumber(unpackSizes[index]);
-      }
-      index++;
-    }
-
-  CRecordVector<bool> digestsDefined2;
-  CRecordVector<UInt32> digests2;
-
-  int digestIndex = 0;
-  for (i = 0; i < folders.Size(); i++)
-  {
-    int numSubStreams = (int)numUnpackStreamsInFolders[i];
-    if (numSubStreams == 1 && folders[i].UnpackCRCDefined)
-      digestIndex++;
-    else
-      for (int j = 0; j < numSubStreams; j++, digestIndex++)
-      {
-        digestsDefined2.Add(digestsDefined[digestIndex]);
-        digests2.Add(digests[digestIndex]);
-      }
-  }
-  WriteHashDigests(digestsDefined2, digests2);
-  WriteByte(NID::kEnd);
-}
-
-void COutArchive::SkipAlign(unsigned /* pos */, unsigned /* alignSize */)
-{
-  return;
-}
-
-/*
-7-Zip 4.50 - 4.58 contain BUG, so they do not support .7z archives with Unknown field.
-
-void COutArchive::SkipAlign(unsigned pos, unsigned alignSize)
-{
-  pos += (unsigned)GetPos();
-  pos &= (alignSize - 1);
-  if (pos == 0)
-    return;
-  unsigned skip = alignSize - pos;
-  if (skip < 2)
-    skip += alignSize;
-  skip -= 2;
-  WriteByte(NID::kDummy);
-  WriteByte((Byte)skip);
-  for (unsigned i = 0; i < skip; i++)
-    WriteByte(0);
-}
-*/
-
-void COutArchive::WriteAlignedBoolHeader(const CBoolVector &v, int numDefined, Byte type, unsigned itemSize)
-{
-  const UInt64 bvSize = (numDefined == v.Size()) ? 0 : (v.Size() + 7) / 8;
-  const UInt64 dataSize = (UInt64)numDefined * itemSize + bvSize + 2;
-  SkipAlign(3 + (unsigned)bvSize + (unsigned)GetBigNumberSize(dataSize), itemSize);
-
-  WriteByte(type);
-  WriteNumber(dataSize);
-  if (numDefined == v.Size())
-    WriteByte(1);
-  else
-  {
-    WriteByte(0);
-    WriteBoolVector(v);
-  }
-  WriteByte(0);
-}
-
-void COutArchive::WriteUInt64DefVector(const CUInt64DefVector &v, Byte type)
-{
-  int numDefined = 0;
-
-  int i;
-  for (i = 0; i < v.Defined.Size(); i++)
-    if (v.Defined[i])
-      numDefined++;
-
-  if (numDefined == 0)
-    return;
-
-  WriteAlignedBoolHeader(v.Defined, numDefined, type, 8);
-  
-  for (i = 0; i < v.Defined.Size(); i++)
-    if (v.Defined[i])
-      WriteUInt64(v.Values[i]);
-}
-
-HRESULT COutArchive::EncodeStream(
-    DECL_EXTERNAL_CODECS_LOC_VARS
-    CEncoder &encoder, const Byte *data, size_t dataSize,
-    CRecordVector<UInt64> &packSizes, CObjectVector<CFolder> &folders)
-{
-  CSequentialInStreamImp *streamSpec = new CSequentialInStreamImp;
-  CMyComPtr<ISequentialInStream> stream = streamSpec;
-  streamSpec->Init(data, dataSize);
-  CFolder folderItem;
-  folderItem.UnpackCRCDefined = true;
-  folderItem.UnpackCRC = CrcCalc(data, dataSize);
-  UInt64 dataSize64 = dataSize;
-  RINOK(encoder.Encode(
-      EXTERNAL_CODECS_LOC_VARS
-      stream, NULL, &dataSize64, folderItem, SeqStream, packSizes, NULL))
-  folders.Add(folderItem);
-  return S_OK;
-}
-
-HRESULT COutArchive::EncodeStream(
-    DECL_EXTERNAL_CODECS_LOC_VARS
-    CEncoder &encoder, const CByteBuffer &data,
-    CRecordVector<UInt64> &packSizes, CObjectVector<CFolder> &folders)
-{
-  return EncodeStream(
-      EXTERNAL_CODECS_LOC_VARS
-      encoder, data, data.GetCapacity(), packSizes, folders);
-}
-
-void COutArchive::WriteHeader(
-    const CArchiveDatabase &db,
-    const CHeaderOptions &headerOptions,
-    UInt64 &headerOffset)
-{
-  int i;
-  
-  UInt64 packedSize = 0;
-  for (i = 0; i < db.PackSizes.Size(); i++)
-    packedSize += db.PackSizes[i];
-
-  headerOffset = packedSize;
-
-  WriteByte(NID::kHeader);
-
-  // Archive Properties
-
-  if (db.Folders.Size() > 0)
-  {
-    WriteByte(NID::kMainStreamsInfo);
-    WritePackInfo(0, db.PackSizes,
-        db.PackCRCsDefined,
-        db.PackCRCs);
-
-    WriteUnpackInfo(db.Folders);
-
-    CRecordVector<UInt64> unpackSizes;
-    CRecordVector<bool> digestsDefined;
-    CRecordVector<UInt32> digests;
-    for (i = 0; i < db.Files.Size(); i++)
-    {
-      const CFileItem &file = db.Files[i];
-      if (!file.HasStream)
-        continue;
-      unpackSizes.Add(file.Size);
-      digestsDefined.Add(file.CrcDefined);
-      digests.Add(file.Crc);
-    }
-
-    WriteSubStreamsInfo(
-        db.Folders,
-        db.NumUnpackStreamsVector,
-        unpackSizes,
-        digestsDefined,
-        digests);
-    WriteByte(NID::kEnd);
-  }
-
-  if (db.Files.IsEmpty())
-  {
-    WriteByte(NID::kEnd);
-    return;
-  }
-
-  WriteByte(NID::kFilesInfo);
-  WriteNumber(db.Files.Size());
-
-  {
-  /* ---------- Empty Streams ---------- */
-  CBoolVector emptyStreamVector;
-  emptyStreamVector.Reserve(db.Files.Size());
-  int numEmptyStreams = 0;
-  for (i = 0; i < db.Files.Size(); i++)
-    if (db.Files[i].HasStream)
-      emptyStreamVector.Add(false);
-    else
-    {
-      emptyStreamVector.Add(true);
-      numEmptyStreams++;
-    }
-  if (numEmptyStreams > 0)
-  {
-    WriteByte(NID::kEmptyStream);
-    WriteNumber((emptyStreamVector.Size() + 7) / 8);
-    WriteBoolVector(emptyStreamVector);
-
-    CBoolVector emptyFileVector, antiVector;
-    emptyFileVector.Reserve(numEmptyStreams);
-    antiVector.Reserve(numEmptyStreams);
-    CNum numEmptyFiles = 0, numAntiItems = 0;
-    for (i = 0; i < db.Files.Size(); i++)
-    {
-      const CFileItem &file = db.Files[i];
-      if (!file.HasStream)
-      {
-        emptyFileVector.Add(!file.IsDir);
-        if (!file.IsDir)
-          numEmptyFiles++;
-        bool isAnti = db.IsItemAnti(i);
-        antiVector.Add(isAnti);
-        if (isAnti)
-          numAntiItems++;
-      }
-    }
-
-    if (numEmptyFiles > 0)
-    {
-      WriteByte(NID::kEmptyFile);
-      WriteNumber((emptyFileVector.Size() + 7) / 8);
-      WriteBoolVector(emptyFileVector);
-    }
-
-    if (numAntiItems > 0)
-    {
-      WriteByte(NID::kAnti);
-      WriteNumber((antiVector.Size() + 7) / 8);
-      WriteBoolVector(antiVector);
-    }
-  }
-  }
-
-
-  {
-    /* ---------- Names ---------- */
-    
-    int numDefined = 0;
-    size_t namesDataSize = 0;
-    for (int i = 0; i < db.Files.Size(); i++)
-    {
-      const UString &name = db.Files[i].Name;
-      if (!name.IsEmpty())
-        numDefined++;
-      namesDataSize += (name.Length() + 1) * 2;
-    }
-    
-    if (numDefined > 0)
-    {
-      namesDataSize++;
-      SkipAlign(2 + GetBigNumberSize(namesDataSize), 2);
-
-      WriteByte(NID::kName);
-      WriteNumber(namesDataSize);
-      WriteByte(0);
-      for (int i = 0; i < db.Files.Size(); i++)
-      {
-        const UString &name = db.Files[i].Name;
-        for (int t = 0; t <= name.Length(); t++)
-        {
-          wchar_t c = name[t];
-          WriteByte((Byte)c);
-          WriteByte((Byte)(c >> 8));
-        }
-      }
-    }
-  }
-
-  if (headerOptions.WriteCTime) WriteUInt64DefVector(db.CTime, NID::kCTime);
-  if (headerOptions.WriteATime) WriteUInt64DefVector(db.ATime, NID::kATime);
-  if (headerOptions.WriteMTime) WriteUInt64DefVector(db.MTime, NID::kMTime);
-  WriteUInt64DefVector(db.StartPos, NID::kStartPos);
-  
-  {
-    /* ---------- Write Attrib ---------- */
-    CBoolVector boolVector;
-    boolVector.Reserve(db.Files.Size());
-    int numDefined = 0;
-    for (i = 0; i < db.Files.Size(); i++)
-    {
-      bool defined = db.Files[i].AttribDefined;
-      boolVector.Add(defined);
-      if (defined)
-        numDefined++;
-    }
-    if (numDefined > 0)
-    {
-      WriteAlignedBoolHeader(boolVector, numDefined, NID::kWinAttributes, 4);
-      for (i = 0; i < db.Files.Size(); i++)
-      {
-        const CFileItem &file = db.Files[i];
-        if (file.AttribDefined)
-          WriteUInt32(file.Attrib);
-      }
-    }
-  }
-
-  WriteByte(NID::kEnd); // for files
-  WriteByte(NID::kEnd); // for headers
-}
-
-HRESULT COutArchive::WriteDatabase(
-    DECL_EXTERNAL_CODECS_LOC_VARS
-    const CArchiveDatabase &db,
-    const CCompressionMethodMode *options,
-    const CHeaderOptions &headerOptions)
-{
-  if (!db.CheckNumFiles())
-    return E_FAIL;
-
-  UInt64 headerOffset;
-  UInt32 headerCRC;
-  UInt64 headerSize;
-  if (db.IsEmpty())
-  {
-    headerSize = 0;
-    headerOffset = 0;
-    headerCRC = CrcCalc(0, 0);
-  }
-  else
-  {
-    bool encodeHeaders = false;
-    if (options != 0)
-      if (options->IsEmpty())
-        options = 0;
-    if (options != 0)
-      if (options->PasswordIsDefined || headerOptions.CompressMainHeader)
-        encodeHeaders = true;
-
-    _outByte.SetStream(SeqStream);
-    _outByte.Init();
-    _crc = CRC_INIT_VAL;
-    _countMode = encodeHeaders;
-    _writeToStream = true;
-    _countSize = 0;
-    WriteHeader(db, headerOptions, headerOffset);
-
-    if (encodeHeaders)
-    {
-      CByteBuffer buf;
-      buf.SetCapacity(_countSize);
-      _outByte2.Init((Byte *)buf, _countSize);
-      
-      _countMode = false;
-      _writeToStream = false;
-      WriteHeader(db, headerOptions, headerOffset);
-      
-      if (_countSize != _outByte2.GetPos())
-        return E_FAIL;
-
-      CCompressionMethodMode encryptOptions;
-      encryptOptions.PasswordIsDefined = options->PasswordIsDefined;
-      encryptOptions.Password = options->Password;
-      CEncoder encoder(headerOptions.CompressMainHeader ? *options : encryptOptions);
-      CRecordVector<UInt64> packSizes;
-      CObjectVector<CFolder> folders;
-      RINOK(EncodeStream(
-          EXTERNAL_CODECS_LOC_VARS
-          encoder, (const Byte *)buf,
-          _countSize, packSizes, folders));
-
-      _writeToStream = true;
-      
-      if (folders.Size() == 0)
-        throw 1;
-
-      WriteID(NID::kEncodedHeader);
-      WritePackInfo(headerOffset, packSizes,
-        CRecordVector<bool>(), CRecordVector<UInt32>());
-      WriteUnpackInfo(folders);
-      WriteByte(NID::kEnd);
-      for (int i = 0; i < packSizes.Size(); i++)
-        headerOffset += packSizes[i];
-    }
-    RINOK(_outByte.Flush());
-    headerCRC = CRC_GET_DIGEST(_crc);
-    headerSize = _outByte.GetProcessedSize();
-  }
-  #ifdef _7Z_VOL
-  if (_endMarker)
-  {
-    CFinishHeader h;
-    h.NextHeaderSize = headerSize;
-    h.NextHeaderCRC = headerCRC;
-    h.NextHeaderOffset =
-        UInt64(0) - (headerSize +
-        4 + kFinishHeaderSize);
-    h.ArchiveStartOffset = h.NextHeaderOffset - headerOffset;
-    h.AdditionalStartBlockSize = 0;
-    RINOK(WriteFinishHeader(h));
-    return WriteFinishSignature();
-  }
-  else
-  #endif
-  {
-    CStartHeader h;
-    h.NextHeaderSize = headerSize;
-    h.NextHeaderCRC = headerCRC;
-    h.NextHeaderOffset = headerOffset;
-    RINOK(Stream->Seek(_prefixHeaderPos, STREAM_SEEK_SET, NULL));
-    return WriteStartHeader(h);
-  }
-}
-
-void CArchiveDatabase::GetFile(int index, CFileItem &file, CFileItem2 &file2) const
-{
-  file = Files[index];
-  file2.CTimeDefined = CTime.GetItem(index, file2.CTime);
-  file2.ATimeDefined = ATime.GetItem(index, file2.ATime);
-  file2.MTimeDefined = MTime.GetItem(index, file2.MTime);
-  file2.StartPosDefined = StartPos.GetItem(index, file2.StartPos);
-  file2.IsAnti = IsItemAnti(index);
-}
-
-void CArchiveDatabase::AddFile(const CFileItem &file, const CFileItem2 &file2)
-{
-  int index = Files.Size();
-  CTime.SetItem(index, file2.CTimeDefined, file2.CTime);
-  ATime.SetItem(index, file2.ATimeDefined, file2.ATime);
-  MTime.SetItem(index, file2.MTimeDefined, file2.MTime);
-  StartPos.SetItem(index, file2.StartPosDefined, file2.StartPos);
-  SetItemAnti(index, file2.IsAnti);
-  Files.Add(file);
-}
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zOut.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zOut.h
deleted file mode 100644
index bdd84ab..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zOut.h
+++ /dev/null
@@ -1,156 +0,0 @@
-// 7z/Out.h
-
-#ifndef __7Z_OUT_H
-#define __7Z_OUT_H
-
-#include "7zHeader.h"
-#include "7zItem.h"
-#include "7zCompressionMode.h"
-#include "7zEncode.h"
-
-#include "../../Common/OutBuffer.h"
-
-namespace NArchive {
-namespace N7z {
-
-class CWriteBufferLoc
-{
-  Byte *_data;
-  size_t _size;
-  size_t _pos;
-public:
-  CWriteBufferLoc(): _size(0), _pos(0) {}
-  void Init(Byte *data, size_t size)
-  {
-    _data = data;
-    _size = size;
-    _pos = 0;
-  }
-  void WriteBytes(const void *data, size_t size)
-  {
-    if (size > _size - _pos)
-      throw 1;
-    memcpy(_data + _pos, data, size);
-    _pos += size;
-  }
-  void WriteByte(Byte b)
-  {
-    if (_size == _pos)
-      throw 1;
-    _data[_pos++] = b;
-  }
-  size_t GetPos() const { return _pos; }
-};
-
-struct CHeaderOptions
-{
-  bool CompressMainHeader;
-  bool WriteCTime;
-  bool WriteATime;
-  bool WriteMTime;
-
-  CHeaderOptions():
-      CompressMainHeader(true),
-      WriteCTime(false),
-      WriteATime(false),
-      WriteMTime(true)
-      {}
-};
-
-class COutArchive
-{
-  UInt64 _prefixHeaderPos;
-
-  HRESULT WriteDirect(const void *data, UInt32 size);
-  
-  UInt64 GetPos() const;
-  void WriteBytes(const void *data, size_t size);
-  void WriteBytes(const CByteBuffer &data) { WriteBytes(data, data.GetCapacity()); }
-  void WriteByte(Byte b);
-  void WriteUInt32(UInt32 value);
-  void WriteUInt64(UInt64 value);
-  void WriteNumber(UInt64 value);
-  void WriteID(UInt64 value) { WriteNumber(value); }
-
-  void WriteFolder(const CFolder &folder);
-  HRESULT WriteFileHeader(const CFileItem &itemInfo);
-  void WriteBoolVector(const CBoolVector &boolVector);
-  void WriteHashDigests(
-      const CRecordVector<bool> &digestsDefined,
-      const CRecordVector<UInt32> &hashDigests);
-
-  void WritePackInfo(
-      UInt64 dataOffset,
-      const CRecordVector<UInt64> &packSizes,
-      const CRecordVector<bool> &packCRCsDefined,
-      const CRecordVector<UInt32> &packCRCs);
-
-  void WriteUnpackInfo(const CObjectVector<CFolder> &folders);
-
-  void WriteSubStreamsInfo(
-      const CObjectVector<CFolder> &folders,
-      const CRecordVector<CNum> &numUnpackStreamsInFolders,
-      const CRecordVector<UInt64> &unpackSizes,
-      const CRecordVector<bool> &digestsDefined,
-      const CRecordVector<UInt32> &hashDigests);
-
-  void SkipAlign(unsigned pos, unsigned alignSize);
-  void WriteAlignedBoolHeader(const CBoolVector &v, int numDefined, Byte type, unsigned itemSize);
-  void WriteUInt64DefVector(const CUInt64DefVector &v, Byte type);
-
-  HRESULT EncodeStream(
-      DECL_EXTERNAL_CODECS_LOC_VARS
-      CEncoder &encoder, const Byte *data, size_t dataSize,
-      CRecordVector<UInt64> &packSizes, CObjectVector<CFolder> &folders);
-  HRESULT EncodeStream(
-      DECL_EXTERNAL_CODECS_LOC_VARS
-      CEncoder &encoder, const CByteBuffer &data,
-      CRecordVector<UInt64> &packSizes, CObjectVector<CFolder> &folders);
-  void WriteHeader(
-      const CArchiveDatabase &db,
-      const CHeaderOptions &headerOptions,
-      UInt64 &headerOffset);
-  
-  bool _countMode;
-  bool _writeToStream;
-  size_t _countSize;
-  UInt32 _crc;
-  COutBuffer _outByte;
-  CWriteBufferLoc _outByte2;
-
-  #ifdef _7Z_VOL
-  bool _endMarker;
-  #endif
-
-  HRESULT WriteSignature();
-  #ifdef _7Z_VOL
-  HRESULT WriteFinishSignature();
-  #endif
-  HRESULT WriteStartHeader(const CStartHeader &h);
-  #ifdef _7Z_VOL
-  HRESULT WriteFinishHeader(const CFinishHeader &h);
-  #endif
-  CMyComPtr<IOutStream> Stream;
-public:
-
-  COutArchive() { _outByte.Create(1 << 16); }
-  CMyComPtr<ISequentialOutStream> SeqStream;
-  HRESULT Create(ISequentialOutStream *stream, bool endMarker);
-  void Close();
-  HRESULT SkeepPrefixArchiveHeader();
-  HRESULT WriteDatabase(
-      DECL_EXTERNAL_CODECS_LOC_VARS
-      const CArchiveDatabase &db,
-      const CCompressionMethodMode *options,
-      const CHeaderOptions &headerOptions);
-
-  #ifdef _7Z_VOL
-  static UInt32 GetVolHeadersSize(UInt64 dataSize, int nameLength = 0, bool props = false);
-  static UInt64 GetVolPureSize(UInt64 volSize, int nameLength = 0, bool props = false);
-  #endif
-
-};
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zProperties.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zProperties.cpp
deleted file mode 100644
index 66d9078..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zProperties.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-// 7zProperties.cpp
-
-#include "StdAfx.h"
-
-#include "7zProperties.h"
-#include "7zHeader.h"
-#include "7zHandler.h"
-
-// #define _MULTI_PACK
-
-namespace NArchive {
-namespace N7z {
-
-struct CPropMap
-{
-  UInt64 FilePropID;
-  STATPROPSTG StatPROPSTG;
-};
-
-CPropMap kPropMap[] =
-{
-  { NID::kName, NULL, kpidPath, VT_BSTR},
-  { NID::kSize, NULL, kpidSize, VT_UI8},
-  { NID::kPackInfo, NULL, kpidPackSize, VT_UI8},
-  
-  #ifdef _MULTI_PACK
-  { 100, L"Pack0", kpidPackedSize0, VT_UI8},
-  { 101, L"Pack1", kpidPackedSize1, VT_UI8},
-  { 102, L"Pack2", kpidPackedSize2, VT_UI8},
-  { 103, L"Pack3", kpidPackedSize3, VT_UI8},
-  { 104, L"Pack4", kpidPackedSize4, VT_UI8},
-  #endif
-
-  { NID::kCTime, NULL, kpidCTime, VT_FILETIME},
-  { NID::kMTime, NULL, kpidMTime, VT_FILETIME},
-  { NID::kATime, NULL, kpidATime, VT_FILETIME},
-  { NID::kWinAttributes, NULL, kpidAttrib, VT_UI4},
-  { NID::kStartPos, NULL, kpidPosition, VT_UI4},
-
-  { NID::kCRC, NULL, kpidCRC, VT_UI4},
-  
-  { NID::kAnti, NULL, kpidIsAnti, VT_BOOL},
-
-  #ifndef _SFX
-  { 97, NULL, kpidEncrypted, VT_BOOL},
-  { 98, NULL, kpidMethod, VT_BSTR},
-  { 99, NULL, kpidBlock, VT_UI4}
-  #endif
-};
-
-static const int kPropMapSize = sizeof(kPropMap) / sizeof(kPropMap[0]);
-
-static int FindPropInMap(UInt64 filePropID)
-{
-  for (int i = 0; i < kPropMapSize; i++)
-    if (kPropMap[i].FilePropID == filePropID)
-      return i;
-  return -1;
-}
-
-static void CopyOneItem(CRecordVector<UInt64> &src,
-    CRecordVector<UInt64> &dest, UInt32 item)
-{
-  for (int i = 0; i < src.Size(); i++)
-    if (src[i] == item)
-    {
-      dest.Add(item);
-      src.Delete(i);
-      return;
-    }
-}
-
-static void RemoveOneItem(CRecordVector<UInt64> &src, UInt32 item)
-{
-  for (int i = 0; i < src.Size(); i++)
-    if (src[i] == item)
-    {
-      src.Delete(i);
-      return;
-    }
-}
-
-static void InsertToHead(CRecordVector<UInt64> &dest, UInt32 item)
-{
-  for (int i = 0; i < dest.Size(); i++)
-    if (dest[i] == item)
-    {
-      dest.Delete(i);
-      break;
-    }
-  dest.Insert(0, item);
-}
-
-void CHandler::FillPopIDs()
-{
-  _fileInfoPopIDs.Clear();
-
-  #ifdef _7Z_VOL
-  if(_volumes.Size() < 1)
-    return;
-  const CVolume &volume = _volumes.Front();
-  const CArchiveDatabaseEx &_db = volume.Database;
-  #endif
-
-  CRecordVector<UInt64> fileInfoPopIDs = _db.ArchiveInfo.FileInfoPopIDs;
-
-  RemoveOneItem(fileInfoPopIDs, NID::kEmptyStream);
-  RemoveOneItem(fileInfoPopIDs, NID::kEmptyFile);
-
-  CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kName);
-  CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kAnti);
-  CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kSize);
-  CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kPackInfo);
-  CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kCTime);
-  CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kMTime);
-  CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kATime);
-  CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kWinAttributes);
-  CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kCRC);
-  CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kComment);
-  _fileInfoPopIDs += fileInfoPopIDs;
- 
-  #ifndef _SFX
-  _fileInfoPopIDs.Add(97);
-  _fileInfoPopIDs.Add(98);
-  _fileInfoPopIDs.Add(99);
-  #endif
-  #ifdef _MULTI_PACK
-  _fileInfoPopIDs.Add(100);
-  _fileInfoPopIDs.Add(101);
-  _fileInfoPopIDs.Add(102);
-  _fileInfoPopIDs.Add(103);
-  _fileInfoPopIDs.Add(104);
-  #endif
-
-  #ifndef _SFX
-  InsertToHead(_fileInfoPopIDs, NID::kMTime);
-  InsertToHead(_fileInfoPopIDs, NID::kPackInfo);
-  InsertToHead(_fileInfoPopIDs, NID::kSize);
-  InsertToHead(_fileInfoPopIDs, NID::kName);
-  #endif
-}
-
-STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties)
-{
-  *numProperties = _fileInfoPopIDs.Size();
-  return S_OK;
-}
-
-STDMETHODIMP CHandler::GetPropertyInfo(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType)
-{
-  if ((int)index >= _fileInfoPopIDs.Size())
-    return E_INVALIDARG;
-  int indexInMap = FindPropInMap(_fileInfoPopIDs[index]);
-  if (indexInMap == -1)
-    return E_INVALIDARG;
-  const STATPROPSTG &srcItem = kPropMap[indexInMap].StatPROPSTG;
-  *propID = srcItem.propid;
-  *varType = srcItem.vt;
-  *name = 0;
-  return S_OK;
-}
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zProperties.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zProperties.h
deleted file mode 100644
index 6618179..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zProperties.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// 7zProperties.h
-
-#ifndef __7Z_PROPERTIES_H
-#define __7Z_PROPERTIES_H
-
-#include "../../PropID.h"
-
-namespace NArchive {
-namespace N7z {
-
-enum
-{
-  kpidPackedSize0 = kpidUserDefined,
-  kpidPackedSize1,
-  kpidPackedSize2,
-  kpidPackedSize3,
-  kpidPackedSize4
-};
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zRegister.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zRegister.cpp
deleted file mode 100644
index e18c4d7..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zRegister.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-// 7zRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/RegisterArc.h"
-
-#include "7zHandler.h"
-static IInArchive *CreateArc() { return new NArchive::N7z::CHandler;  }
-#ifndef EXTRACT_ONLY
-static IOutArchive *CreateArcOut() { return new NArchive::N7z::CHandler;  }
-#else
-#define CreateArcOut 0
-#endif
-
-static CArcInfo g_ArcInfo =
-  { L"7z", L"7z", 0, 7, {'7' + 1 , 'z', 0xBC, 0xAF, 0x27, 0x1C}, 6, false, CreateArc, CreateArcOut };
-
-REGISTER_ARC_DEC_SIG(7z)
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zSpecStream.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zSpecStream.cpp
deleted file mode 100644
index 0696963..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zSpecStream.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// 7zSpecStream.cpp
-
-#include "StdAfx.h"
-
-#include "7zSpecStream.h"
-
-STDMETHODIMP CSequentialInStreamSizeCount2::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
-  UInt32 realProcessedSize;
-  HRESULT result = _stream->Read(data, size, &realProcessedSize);
-  _size += realProcessedSize;
-  if (processedSize != 0)
-    *processedSize = realProcessedSize;
-  return result;
-}
-
-STDMETHODIMP CSequentialInStreamSizeCount2::GetSubStreamSize(
-    UInt64 subStream, UInt64 *value)
-{
-  if (_getSubStreamSize == NULL)
-    return E_NOTIMPL;
-  return  _getSubStreamSize->GetSubStreamSize(subStream, value);
-}
-
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zSpecStream.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zSpecStream.h
deleted file mode 100644
index 2e26efd..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zSpecStream.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// 7zSpecStream.h
-
-#ifndef __7Z_SPEC_STREAM_H
-#define __7Z_SPEC_STREAM_H
-
-#include "../../IStream.h"
-#include "../../ICoder.h"
-#include "../../../Common/MyCom.h"
-
-class CSequentialInStreamSizeCount2:
-  public ISequentialInStream,
-  public ICompressGetSubStreamSize,
-  public CMyUnknownImp
-{
-  CMyComPtr<ISequentialInStream> _stream;
-  CMyComPtr<ICompressGetSubStreamSize> _getSubStreamSize;
-  UInt64 _size;
-public:
-  void Init(ISequentialInStream *stream)
-  {
-    _stream = stream;
-    _getSubStreamSize = 0;
-    _stream.QueryInterface(IID_ICompressGetSubStreamSize, &_getSubStreamSize);
-    _size = 0;
-  }
-  UInt64 GetSize() const { return _size; }
-
-  MY_UNKNOWN_IMP1(ICompressGetSubStreamSize)
-
-  STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-
-  STDMETHOD(GetSubStreamSize)(UInt64 subStream, UInt64 *value);
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zUpdate.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zUpdate.cpp
deleted file mode 100644
index 0285b18..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zUpdate.cpp
+++ /dev/null
@@ -1,820 +0,0 @@
-// 7zUpdate.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/LimitedStreams.h"
-#include "../../Common/ProgressUtils.h"
-
-#include "../../Compress/CopyCoder.h"
-
-#include "../Common/ItemNameUtils.h"
-
-#include "7zEncode.h"
-#include "7zFolderInStream.h"
-#include "7zHandler.h"
-#include "7zOut.h"
-#include "7zUpdate.h"
-
-namespace NArchive {
-namespace N7z {
-
-static const wchar_t *kMatchFinderForBCJ2_LZMA = L"BT2";
-static const UInt32 kDictionaryForBCJ2_LZMA = 1 << 20;
-static const UInt32 kAlgorithmForBCJ2_LZMA = 1;
-static const UInt32 kNumFastBytesForBCJ2_LZMA = 64;
-
-static HRESULT WriteRange(IInStream *inStream, ISequentialOutStream *outStream,
-    UInt64 position, UInt64 size, ICompressProgressInfo *progress)
-{
-  RINOK(inStream->Seek(position, STREAM_SEEK_SET, 0));
-  CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
-  CMyComPtr<CLimitedSequentialInStream> inStreamLimited(streamSpec);
-  streamSpec->SetStream(inStream);
-  streamSpec->Init(size);
-
-  NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder;
-  CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-  RINOK(copyCoder->Code(inStreamLimited, outStream, NULL, NULL, progress));
-  return (copyCoderSpec->TotalSize == size ? S_OK : E_FAIL);
-}
-
-static int GetReverseSlashPos(const UString &name)
-{
-  int slashPos = name.ReverseFind(L'/');
-  #ifdef _WIN32
-  int slash1Pos = name.ReverseFind(L'\\');
-  slashPos = MyMax(slashPos, slash1Pos);
-  #endif
-  return slashPos;
-}
-
-int CUpdateItem::GetExtensionPos() const
-{
-  int slashPos = GetReverseSlashPos(Name);
-  int dotPos = Name.ReverseFind(L'.');
-  if (dotPos < 0 || (dotPos < slashPos && slashPos >= 0))
-    return Name.Length();
-  return dotPos + 1;
-}
-
-UString CUpdateItem::GetExtension() const
-{
-  return Name.Mid(GetExtensionPos());
-}
-
-#define RINOZ(x) { int __tt = (x); if (__tt != 0) return __tt; }
-
-static int CompareBuffers(const CByteBuffer &a1, const CByteBuffer &a2)
-{
-  size_t c1 = a1.GetCapacity();
-  size_t c2 = a2.GetCapacity();
-  RINOZ(MyCompare(c1, c2));
-  for (size_t i = 0; i < c1; i++)
-    RINOZ(MyCompare(a1[i], a2[i]));
-  return 0;
-}
-
-static int CompareCoders(const CCoderInfo &c1, const CCoderInfo &c2)
-{
-  RINOZ(MyCompare(c1.NumInStreams, c2.NumInStreams));
-  RINOZ(MyCompare(c1.NumOutStreams, c2.NumOutStreams));
-  RINOZ(MyCompare(c1.MethodID, c2.MethodID));
-  return CompareBuffers(c1.Props, c2.Props);
-}
-
-static int CompareBindPairs(const CBindPair &b1, const CBindPair &b2)
-{
-  RINOZ(MyCompare(b1.InIndex, b2.InIndex));
-  return MyCompare(b1.OutIndex, b2.OutIndex);
-}
-
-static int CompareFolders(const CFolder &f1, const CFolder &f2)
-{
-  int s1 = f1.Coders.Size();
-  int s2 = f2.Coders.Size();
-  RINOZ(MyCompare(s1, s2));
-  int i;
-  for (i = 0; i < s1; i++)
-    RINOZ(CompareCoders(f1.Coders[i], f2.Coders[i]));
-  s1 = f1.BindPairs.Size();
-  s2 = f2.BindPairs.Size();
-  RINOZ(MyCompare(s1, s2));
-  for (i = 0; i < s1; i++)
-    RINOZ(CompareBindPairs(f1.BindPairs[i], f2.BindPairs[i]));
-  return 0;
-}
-
-static int CompareFiles(const CFileItem &f1, const CFileItem &f2)
-{
-  return MyStringCompareNoCase(f1.Name, f2.Name);
-}
-
-static int CompareFolderRefs(const int *p1, const int *p2, void *param)
-{
-  int i1 = *p1;
-  int i2 = *p2;
-  const CArchiveDatabaseEx &db = *(const CArchiveDatabaseEx *)param;
-  RINOZ(CompareFolders(
-      db.Folders[i1],
-      db.Folders[i2]));
-  RINOZ(MyCompare(
-      db.NumUnpackStreamsVector[i1],
-      db.NumUnpackStreamsVector[i2]));
-  if (db.NumUnpackStreamsVector[i1] == 0)
-    return 0;
-  return CompareFiles(
-      db.Files[db.FolderStartFileIndex[i1]],
-      db.Files[db.FolderStartFileIndex[i2]]);
-}
-
-////////////////////////////////////////////////////////////
-
-static int CompareEmptyItems(const int *p1, const int *p2, void *param)
-{
-  const CObjectVector<CUpdateItem> &updateItems = *(const CObjectVector<CUpdateItem> *)param;
-  const CUpdateItem &u1 = updateItems[*p1];
-  const CUpdateItem &u2 = updateItems[*p2];
-  if (u1.IsDir != u2.IsDir)
-    return (u1.IsDir) ? 1 : -1;
-  if (u1.IsDir)
-  {
-    if (u1.IsAnti != u2.IsAnti)
-      return (u1.IsAnti ? 1 : -1);
-    int n = MyStringCompareNoCase(u1.Name, u2.Name);
-    return -n;
-  }
-  if (u1.IsAnti != u2.IsAnti)
-    return (u1.IsAnti ? 1 : -1);
-  return MyStringCompareNoCase(u1.Name, u2.Name);
-}
-
-static const char *g_Exts =
-  " lzma 7z ace arc arj bz bz2 deb lzo lzx gz pak rpm sit tgz tbz tbz2 tgz cab ha lha lzh rar zoo"
-  " zip jar ear war msi"
-  " 3gp avi mov mpeg mpg mpe wmv"
-  " aac ape fla flac la mp3 m4a mp4 ofr ogg pac ra rm rka shn swa tta wv wma wav"
-  " swf "
-  " chm hxi hxs"
-  " gif jpeg jpg jp2 png tiff  bmp ico psd psp"
-  " awg ps eps cgm dxf svg vrml wmf emf ai md"
-  " cad dwg pps key sxi"
-  " max 3ds"
-  " iso bin nrg mdf img pdi tar cpio xpi"
-  " vfd vhd vud vmc vsv"
-  " vmdk dsk nvram vmem vmsd vmsn vmss vmtm"
-  " inl inc idl acf asa h hpp hxx c cpp cxx rc java cs pas bas vb cls ctl frm dlg def"
-  " f77 f f90 f95"
-  " asm sql manifest dep "
-  " mak clw csproj vcproj sln dsp dsw "
-  " class "
-  " bat cmd"
-  " xml xsd xsl xslt hxk hxc htm html xhtml xht mht mhtml htw asp aspx css cgi jsp shtml"
-  " awk sed hta js php php3 php4 php5 phptml pl pm py pyo rb sh tcl vbs"
-  " text txt tex ans asc srt reg ini doc docx mcw dot rtf hlp xls xlr xlt xlw ppt pdf"
-  " sxc sxd sxi sxg sxw stc sti stw stm odt ott odg otg odp otp ods ots odf"
-  " abw afp cwk lwp wpd wps wpt wrf wri"
-  " abf afm bdf fon mgf otf pcf pfa snf ttf"
-  " dbf mdb nsf ntf wdb db fdb gdb"
-  " exe dll ocx vbx sfx sys tlb awx com obj lib out o so "
-  " pdb pch idb ncb opt";
-
-int GetExtIndex(const char *ext)
-{
-  int extIndex = 1;
-  const char *p = g_Exts;
-  for (;;)
-  {
-    char c = *p++;
-    if (c == 0)
-      return extIndex;
-    if (c == ' ')
-      continue;
-    int pos = 0;
-    for (;;)
-    {
-      char c2 = ext[pos++];
-      if (c2 == 0 && (c == 0 || c == ' '))
-        return extIndex;
-      if (c != c2)
-        break;
-      c = *p++;
-    }
-    extIndex++;
-    for (;;)
-    {
-      if (c == 0)
-        return extIndex;
-      if (c == ' ')
-        break;
-      c = *p++;
-    }
-  }
-}
-
-struct CRefItem
-{
-  const CUpdateItem *UpdateItem;
-  UInt32 Index;
-  UInt32 ExtensionPos;
-  UInt32 NamePos;
-  int ExtensionIndex;
-  CRefItem(UInt32 index, const CUpdateItem &ui, bool sortByType):
-    UpdateItem(&ui),
-    Index(index),
-    ExtensionPos(0),
-    NamePos(0),
-    ExtensionIndex(0)
-  {
-    if (sortByType)
-    {
-      int slashPos = GetReverseSlashPos(ui.Name);
-      NamePos = ((slashPos >= 0) ? (slashPos + 1) : 0);
-      int dotPos = ui.Name.ReverseFind(L'.');
-      if (dotPos < 0 || (dotPos < slashPos && slashPos >= 0))
-        ExtensionPos = ui.Name.Length();
-      else
-      {
-        ExtensionPos = dotPos + 1;
-        UString us = ui.Name.Mid(ExtensionPos);
-        if (!us.IsEmpty())
-        {
-          us.MakeLower();
-          int i;
-          AString s;
-          for (i = 0; i < us.Length(); i++)
-          {
-            wchar_t c = us[i];
-            if (c >= 0x80)
-              break;
-            s += (char)c;
-          }
-          if (i == us.Length())
-            ExtensionIndex = GetExtIndex(s);
-          else
-            ExtensionIndex = 0;
-        }
-      }
-    }
-  }
-};
-
-static int CompareUpdateItems(const CRefItem *p1, const CRefItem *p2, void *param)
-{
-  const CRefItem &a1 = *p1;
-  const CRefItem &a2 = *p2;
-  const CUpdateItem &u1 = *a1.UpdateItem;
-  const CUpdateItem &u2 = *a2.UpdateItem;
-  int n;
-  if (u1.IsDir != u2.IsDir)
-    return (u1.IsDir) ? 1 : -1;
-  if (u1.IsDir)
-  {
-    if (u1.IsAnti != u2.IsAnti)
-      return (u1.IsAnti ? 1 : -1);
-    n = MyStringCompareNoCase(u1.Name, u2.Name);
-    return -n;
-  }
-  bool sortByType = *(bool *)param;
-  if (sortByType)
-  {
-    RINOZ(MyCompare(a1.ExtensionIndex, a2.ExtensionIndex))
-    RINOZ(MyStringCompareNoCase(u1.Name + a1.ExtensionPos, u2.Name + a2.ExtensionPos));
-    RINOZ(MyStringCompareNoCase(u1.Name + a1.NamePos, u2.Name + a2.NamePos));
-    if (!u1.MTimeDefined && u2.MTimeDefined) return 1;
-    if (u1.MTimeDefined && !u2.MTimeDefined) return -1;
-    if (u1.MTimeDefined && u2.MTimeDefined) RINOZ(MyCompare(u1.MTime, u2.MTime));
-    RINOZ(MyCompare(u1.Size, u2.Size))
-  }
-  return MyStringCompareNoCase(u1.Name, u2.Name);
-}
-
-struct CSolidGroup
-{
-  CCompressionMethodMode Method;
-  CRecordVector<UInt32> Indices;
-};
-
-static wchar_t *g_ExeExts[] =
-{
-  L"dll",
-  L"exe",
-  L"ocx",
-  L"sfx",
-  L"sys"
-};
-
-static bool IsExeFile(const UString &ext)
-{
-  for (int i = 0; i < sizeof(g_ExeExts) / sizeof(g_ExeExts[0]); i++)
-    if (ext.CompareNoCase(g_ExeExts[i]) == 0)
-      return true;
-  return false;
-}
-
-static const UInt64 k_LZMA  = 0x030101;
-static const UInt64 k_BCJ   = 0x03030103;
-static const UInt64 k_BCJ2  = 0x0303011B;
-
-static bool GetMethodFull(UInt64 methodID,
-    UInt32 numInStreams, CMethodFull &methodResult)
-{
-  methodResult.Id = methodID;
-  methodResult.NumInStreams = numInStreams;
-  methodResult.NumOutStreams = 1;
-  return true;
-}
-
-static bool MakeExeMethod(const CCompressionMethodMode &method,
-    bool bcj2Filter, CCompressionMethodMode &exeMethod)
-{
-  exeMethod = method;
-  if (bcj2Filter)
-  {
-    CMethodFull methodFull;
-    if (!GetMethodFull(k_BCJ2, 4, methodFull))
-      return false;
-    exeMethod.Methods.Insert(0, methodFull);
-    if (!GetMethodFull(k_LZMA, 1, methodFull))
-      return false;
-    {
-      CProp prop;
-      prop.Id = NCoderPropID::kAlgorithm;
-      prop.Value = kAlgorithmForBCJ2_LZMA;
-      methodFull.Props.Add(prop);
-    }
-    {
-      CProp prop;
-      prop.Id = NCoderPropID::kMatchFinder;
-      prop.Value = kMatchFinderForBCJ2_LZMA;
-      methodFull.Props.Add(prop);
-    }
-    {
-      CProp prop;
-      prop.Id = NCoderPropID::kDictionarySize;
-      prop.Value = kDictionaryForBCJ2_LZMA;
-      methodFull.Props.Add(prop);
-    }
-    {
-      CProp prop;
-      prop.Id = NCoderPropID::kNumFastBytes;
-      prop.Value = kNumFastBytesForBCJ2_LZMA;
-      methodFull.Props.Add(prop);
-    }
-
-    exeMethod.Methods.Add(methodFull);
-    exeMethod.Methods.Add(methodFull);
-    CBind bind;
-
-    bind.OutCoder = 0;
-    bind.InStream = 0;
-
-    bind.InCoder = 1;
-    bind.OutStream = 0;
-    exeMethod.Binds.Add(bind);
-
-    bind.InCoder = 2;
-    bind.OutStream = 1;
-    exeMethod.Binds.Add(bind);
-
-    bind.InCoder = 3;
-    bind.OutStream = 2;
-    exeMethod.Binds.Add(bind);
-  }
-  else
-  {
-    CMethodFull methodFull;
-    if (!GetMethodFull(k_BCJ, 1, methodFull))
-      return false;
-    exeMethod.Methods.Insert(0, methodFull);
-    CBind bind;
-    bind.OutCoder = 0;
-    bind.InStream = 0;
-    bind.InCoder = 1;
-    bind.OutStream = 0;
-    exeMethod.Binds.Add(bind);
-  }
-  return true;
-}
-
-static void SplitFilesToGroups(
-    const CCompressionMethodMode &method,
-    bool useFilters, bool maxFilter,
-    const CObjectVector<CUpdateItem> &updateItems,
-    CObjectVector<CSolidGroup> &groups)
-{
-  if (method.Methods.Size() != 1 || method.Binds.Size() != 0)
-    useFilters = false;
-  groups.Clear();
-  groups.Add(CSolidGroup());
-  groups.Add(CSolidGroup());
-  CSolidGroup &generalGroup = groups[0];
-  CSolidGroup &exeGroup = groups[1];
-  generalGroup.Method = method;
-  int i;
-  for (i = 0; i < updateItems.Size(); i++)
-  {
-    const CUpdateItem &ui = updateItems[i];
-    if (!ui.NewData)
-      continue;
-    if (!ui.HasStream())
-      continue;
-    if (useFilters)
-    {
-      const UString name = ui.Name;
-      int dotPos = name.ReverseFind(L'.');
-      if (dotPos >= 0)
-      {
-        UString ext = name.Mid(dotPos + 1);
-        if (IsExeFile(ext))
-        {
-          exeGroup.Indices.Add(i);
-          continue;
-        }
-      }
-    }
-    generalGroup.Indices.Add(i);
-  }
-  if (exeGroup.Indices.Size() > 0)
-    if (!MakeExeMethod(method, maxFilter, exeGroup.Method))
-      exeGroup.Method = method;
-  for (i = 0; i < groups.Size();)
-    if (groups[i].Indices.Size() == 0)
-      groups.Delete(i);
-    else
-      i++;
-}
-
-static void FromUpdateItemToFileItem(const CUpdateItem &ui,
-    CFileItem &file, CFileItem2 &file2)
-{
-  file.Name = NItemName::MakeLegalName(ui.Name);
-  if (ui.AttribDefined)
-    file.SetAttrib(ui.Attrib);
-  
-  file2.CTime = ui.CTime;  file2.CTimeDefined = ui.CTimeDefined;
-  file2.ATime = ui.ATime;  file2.ATimeDefined = ui.ATimeDefined;
-  file2.MTime = ui.MTime;  file2.MTimeDefined = ui.MTimeDefined;
-  file2.IsAnti = ui.IsAnti;
-  file2.StartPosDefined = false;
-
-  file.Size = ui.Size;
-  file.IsDir = ui.IsDir;
-  file.HasStream = ui.HasStream();
-}
-
-static HRESULT Update2(
-    DECL_EXTERNAL_CODECS_LOC_VARS
-    IInStream *inStream,
-    const CArchiveDatabaseEx *db,
-    const CObjectVector<CUpdateItem> &updateItems,
-    COutArchive &archive,
-    CArchiveDatabase &newDatabase,
-    ISequentialOutStream *seqOutStream,
-    IArchiveUpdateCallback *updateCallback,
-    const CUpdateOptions &options)
-{
-  UInt64 numSolidFiles = options.NumSolidFiles;
-  if (numSolidFiles == 0)
-    numSolidFiles = 1;
-  /*
-  CMyComPtr<IOutStream> outStream;
-  RINOK(seqOutStream->QueryInterface(IID_IOutStream, (void **)&outStream));
-  if (!outStream)
-    return E_NOTIMPL;
-  */
-
-  UInt64 startBlockSize = db != 0 ? db->ArchiveInfo.StartPosition: 0;
-  if (startBlockSize > 0 && !options.RemoveSfxBlock)
-  {
-    RINOK(WriteRange(inStream, seqOutStream, 0, startBlockSize, NULL));
-  }
-
-  CRecordVector<int> fileIndexToUpdateIndexMap;
-  if (db != 0)
-  {
-    fileIndexToUpdateIndexMap.Reserve(db->Files.Size());
-    for (int i = 0; i < db->Files.Size(); i++)
-      fileIndexToUpdateIndexMap.Add(-1);
-  }
-  int i;
-  for(i = 0; i < updateItems.Size(); i++)
-  {
-    int index = updateItems[i].IndexInArchive;
-    if (index != -1)
-      fileIndexToUpdateIndexMap[index] = i;
-  }
-
-  CRecordVector<int> folderRefs;
-  if (db != 0)
-  {
-    for(i = 0; i < db->Folders.Size(); i++)
-    {
-      CNum indexInFolder = 0;
-      CNum numCopyItems = 0;
-      CNum numUnpackStreams = db->NumUnpackStreamsVector[i];
-      for (CNum fileIndex = db->FolderStartFileIndex[i];
-      indexInFolder < numUnpackStreams; fileIndex++)
-      {
-        if (db->Files[fileIndex].HasStream)
-        {
-          indexInFolder++;
-          int updateIndex = fileIndexToUpdateIndexMap[fileIndex];
-          if (updateIndex >= 0)
-            if (!updateItems[updateIndex].NewData)
-              numCopyItems++;
-        }
-      }
-      if (numCopyItems != numUnpackStreams && numCopyItems != 0)
-        return E_NOTIMPL; // It needs repacking !!!
-      if (numCopyItems > 0)
-        folderRefs.Add(i);
-    }
-    folderRefs.Sort(CompareFolderRefs, (void *)db);
-  }
-
-  ////////////////////////////
-
-  RINOK(archive.Create(seqOutStream, false));
-  RINOK(archive.SkeepPrefixArchiveHeader());
-  UInt64 complexity = 0;
-  for(i = 0; i < folderRefs.Size(); i++)
-    complexity += db->GetFolderFullPackSize(folderRefs[i]);
-  UInt64 inSizeForReduce = 0;
-  for(i = 0; i < updateItems.Size(); i++)
-  {
-    const CUpdateItem &ui = updateItems[i];
-    if (ui.NewData)
-    {
-      complexity += ui.Size;
-      if (numSolidFiles == 1)
-      {
-        if (ui.Size > inSizeForReduce)
-          inSizeForReduce = ui.Size;
-      }
-      else
-        inSizeForReduce += ui.Size;
-    }
-  }
-  RINOK(updateCallback->SetTotal(complexity));
-  complexity = 0;
-  RINOK(updateCallback->SetCompleted(&complexity));
-
-
-  CLocalProgress *lps = new CLocalProgress;
-  CMyComPtr<ICompressProgressInfo> progress = lps;
-  lps->Init(updateCallback, true);
-
-  /////////////////////////////////////////
-  // Write Copy Items
-
-  for(i = 0; i < folderRefs.Size(); i++)
-  {
-    int folderIndex = folderRefs[i];
-    
-    lps->ProgressOffset = complexity;
-    UInt64 packSize = db->GetFolderFullPackSize(folderIndex);
-    RINOK(WriteRange(inStream, archive.SeqStream,
-        db->GetFolderStreamPos(folderIndex, 0), packSize, progress));
-    complexity += packSize;
-    
-    const CFolder &folder = db->Folders[folderIndex];
-    CNum startIndex = db->FolderStartPackStreamIndex[folderIndex];
-    for (int j = 0; j < folder.PackStreams.Size(); j++)
-    {
-      newDatabase.PackSizes.Add(db->PackSizes[startIndex + j]);
-      // newDatabase.PackCRCsDefined.Add(db.PackCRCsDefined[startIndex + j]);
-      // newDatabase.PackCRCs.Add(db.PackCRCs[startIndex + j]);
-    }
-    newDatabase.Folders.Add(folder);
-
-    CNum numUnpackStreams = db->NumUnpackStreamsVector[folderIndex];
-    newDatabase.NumUnpackStreamsVector.Add(numUnpackStreams);
-
-    CNum indexInFolder = 0;
-    for (CNum fi = db->FolderStartFileIndex[folderIndex];
-        indexInFolder < numUnpackStreams; fi++)
-    {
-      CFileItem file;
-      CFileItem2 file2;
-      db->GetFile(fi, file, file2);
-      if (file.HasStream)
-      {
-        indexInFolder++;
-        int updateIndex = fileIndexToUpdateIndexMap[fi];
-        if (updateIndex >= 0)
-        {
-          const CUpdateItem &ui = updateItems[updateIndex];
-          if (ui.NewProperties)
-          {
-            CFileItem uf;
-            FromUpdateItemToFileItem(ui, uf, file2);
-            uf.Size = file.Size;
-            uf.Crc = file.Crc;
-            uf.CrcDefined = file.CrcDefined;
-            uf.HasStream = file.HasStream;
-            file = uf;
-          }
-        }
-        newDatabase.AddFile(file, file2);
-      }
-    }
-  }
-
-  folderRefs.ClearAndFree();
-  fileIndexToUpdateIndexMap.ClearAndFree();
-
-  /////////////////////////////////////////
-  // Compress New Files
-
-  CObjectVector<CSolidGroup> groups;
-  SplitFilesToGroups(*options.Method, options.UseFilters, options.MaxFilter,
-      updateItems, groups);
-
-  const UInt32 kMinReduceSize = (1 << 16);
-  if (inSizeForReduce < kMinReduceSize)
-    inSizeForReduce = kMinReduceSize;
-
-  for (int groupIndex = 0; groupIndex < groups.Size(); groupIndex++)
-  {
-    const CSolidGroup &group = groups[groupIndex];
-    int numFiles = group.Indices.Size();
-    if (numFiles == 0)
-      continue;
-    CRecordVector<CRefItem> refItems;
-    refItems.Reserve(numFiles);
-    bool sortByType = (numSolidFiles > 1);
-    for (i = 0; i < numFiles; i++)
-      refItems.Add(CRefItem(group.Indices[i], updateItems[group.Indices[i]], sortByType));
-    refItems.Sort(CompareUpdateItems, (void *)&sortByType);
-    
-    CRecordVector<UInt32> indices;
-    indices.Reserve(numFiles);
-
-    for (i = 0; i < numFiles; i++)
-    {
-      UInt32 index = refItems[i].Index;
-      indices.Add(index);
-      /*
-      const CUpdateItem &ui = updateItems[index];
-      CFileItem file;
-      if (ui.NewProperties)
-        FromUpdateItemToFileItem(ui, file);
-      else
-        file = db.Files[ui.IndexInArchive];
-      if (file.IsAnti || file.IsDir)
-        return E_FAIL;
-      newDatabase.Files.Add(file);
-      */
-    }
-    
-    CEncoder encoder(group.Method);
-
-    for (i = 0; i < numFiles;)
-    {
-      UInt64 totalSize = 0;
-      int numSubFiles;
-      UString prevExtension;
-      for (numSubFiles = 0; i + numSubFiles < numFiles &&
-          numSubFiles < numSolidFiles; numSubFiles++)
-      {
-        const CUpdateItem &ui = updateItems[indices[i + numSubFiles]];
-        totalSize += ui.Size;
-        if (totalSize > options.NumSolidBytes)
-          break;
-        if (options.SolidExtension)
-        {
-          UString ext = ui.GetExtension();
-          if (numSubFiles == 0)
-            prevExtension = ext;
-          else
-            if (ext.CompareNoCase(prevExtension) != 0)
-              break;
-        }
-      }
-      if (numSubFiles < 1)
-        numSubFiles = 1;
-
-      CFolderInStream *inStreamSpec = new CFolderInStream;
-      CMyComPtr<ISequentialInStream> solidInStream(inStreamSpec);
-      inStreamSpec->Init(updateCallback, &indices[i], numSubFiles);
-      
-      CFolder folderItem;
-
-      int startPackIndex = newDatabase.PackSizes.Size();
-      RINOK(encoder.Encode(
-          EXTERNAL_CODECS_LOC_VARS
-          solidInStream, NULL, &inSizeForReduce, folderItem,
-          archive.SeqStream, newDatabase.PackSizes, progress));
-
-      for (; startPackIndex < newDatabase.PackSizes.Size(); startPackIndex++)
-        lps->OutSize += newDatabase.PackSizes[startPackIndex];
-
-      lps->InSize += folderItem.GetUnpackSize();
-      // for()
-      // newDatabase.PackCRCsDefined.Add(false);
-      // newDatabase.PackCRCs.Add(0);
-      
-      newDatabase.Folders.Add(folderItem);
-      
-      CNum numUnpackStreams = 0;
-      for (int subIndex = 0; subIndex < numSubFiles; subIndex++)
-      {
-        const CUpdateItem &ui = updateItems[indices[i + subIndex]];
-        CFileItem file;
-        CFileItem2 file2;
-        if (ui.NewProperties)
-          FromUpdateItemToFileItem(ui, file, file2);
-        else
-          db->GetFile(ui.IndexInArchive, file, file2);
-        if (file2.IsAnti || file.IsDir)
-          return E_FAIL;
-        
-        /*
-        CFileItem &file = newDatabase.Files[
-              startFileIndexInDatabase + i + subIndex];
-        */
-        if (!inStreamSpec->Processed[subIndex])
-        {
-          continue;
-          // file.Name += L".locked";
-        }
-
-        file.Crc = inStreamSpec->CRCs[subIndex];
-        file.Size = inStreamSpec->Sizes[subIndex];
-        if (file.Size != 0)
-        {
-          file.CrcDefined = true;
-          file.HasStream = true;
-          numUnpackStreams++;
-        }
-        else
-        {
-          file.CrcDefined = false;
-          file.HasStream = false;
-        }
-        newDatabase.AddFile(file, file2);
-      }
-      // numUnpackStreams = 0 is very bad case for locked files
-      // v3.13 doesn't understand it.
-      newDatabase.NumUnpackStreamsVector.Add(numUnpackStreams);
-      i += numSubFiles;
-    }
-  }
-
-  groups.ClearAndFree();
-
-  {
-    /////////////////////////////////////////
-    // Write Empty Files & Folders
-    
-    CRecordVector<int> emptyRefs;
-    for(i = 0; i < updateItems.Size(); i++)
-    {
-      const CUpdateItem &ui = updateItems[i];
-      if (ui.NewData)
-      {
-        if (ui.HasStream())
-          continue;
-      }
-      else
-        if (ui.IndexInArchive != -1)
-          if (db->Files[ui.IndexInArchive].HasStream)
-            continue;
-      emptyRefs.Add(i);
-    }
-    emptyRefs.Sort(CompareEmptyItems, (void *)&updateItems);
-    for (i = 0; i < emptyRefs.Size(); i++)
-    {
-      const CUpdateItem &ui = updateItems[emptyRefs[i]];
-      CFileItem file;
-      CFileItem2 file2;
-      if (ui.NewProperties)
-        FromUpdateItemToFileItem(ui, file, file2);
-      else
-        db->GetFile(ui.IndexInArchive, file, file2);
-      newDatabase.AddFile(file, file2);
-    }
-  }
-    
-  newDatabase.ReserveDown();
-  return S_OK;
-}
-
-HRESULT Update(
-    DECL_EXTERNAL_CODECS_LOC_VARS
-    IInStream *inStream,
-    const CArchiveDatabaseEx *db,
-    const CObjectVector<CUpdateItem> &updateItems,
-    COutArchive &archive,
-    CArchiveDatabase &newDatabase,
-    ISequentialOutStream *seqOutStream,
-    IArchiveUpdateCallback *updateCallback,
-    const CUpdateOptions &options)
-{
-  return Update2(
-        EXTERNAL_CODECS_LOC_VARS
-        inStream, db, updateItems,
-        archive, newDatabase, seqOutStream, updateCallback, options);
-}
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zUpdate.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zUpdate.h
deleted file mode 100644
index bcc7cef..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/7zUpdate.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// 7zUpdate.h
-
-#ifndef __7Z_UPDATE_H
-#define __7Z_UPDATE_H
-
-#include "7zIn.h"
-#include "7zOut.h"
-#include "7zCompressionMode.h"
-
-#include "../IArchive.h"
-
-namespace NArchive {
-namespace N7z {
-
-struct CUpdateItem
-{
-  int IndexInArchive;
-  int IndexInClient;
-  
-  UInt64 CTime;
-  UInt64 ATime;
-  UInt64 MTime;
-
-  UInt64 Size;
-  UString Name;
-
-  UInt32 Attrib;
-  
-  bool NewData;
-  bool NewProperties;
-
-  bool IsAnti;
-  bool IsDir;
-
-  bool AttribDefined;
-  bool CTimeDefined;
-  bool ATimeDefined;
-  bool MTimeDefined;
-
-  bool HasStream() const { return !IsDir && !IsAnti && Size != 0; }
-
-  CUpdateItem():
-      IsAnti(false),
-      IsDir(false),
-      AttribDefined(false),
-      CTimeDefined(false),
-      ATimeDefined(false),
-      MTimeDefined(false)
-      {}
-  void SetDirStatusFromAttrib() { IsDir = ((Attrib & FILE_ATTRIBUTE_DIRECTORY) != 0); };
-
-  int GetExtensionPos() const;
-  UString GetExtension() const;
-};
-
-struct CUpdateOptions
-{
-  const CCompressionMethodMode *Method;
-  const CCompressionMethodMode *HeaderMethod;
-  bool UseFilters;
-  bool MaxFilter;
-
-  CHeaderOptions HeaderOptions;
-
-  UInt64 NumSolidFiles;
-  UInt64 NumSolidBytes;
-  bool SolidExtension;
-  bool RemoveSfxBlock;
-  bool VolumeMode;
-};
-
-HRESULT Update(
-    DECL_EXTERNAL_CODECS_LOC_VARS
-    IInStream *inStream,
-    const CArchiveDatabaseEx *db,
-    const CObjectVector<CUpdateItem> &updateItems,
-    COutArchive &archive,
-    CArchiveDatabase &newDatabase,
-    ISequentialOutStream *seqOutStream,
-    IArchiveUpdateCallback *updateCallback,
-    const CUpdateOptions &options);
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/StdAfx.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/StdAfx.cpp
deleted file mode 100644
index d0feea8..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/StdAfx.cpp
+++ /dev/null
@@ -1,3 +0,0 @@
-// StdAfx.cpp
-
-#include "StdAfx.h"
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/StdAfx.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/StdAfx.h
deleted file mode 100644
index 2e4be10..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/7z/StdAfx.h
+++ /dev/null
@@ -1,9 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-#include "../../../Common/NewHandler.h"
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Archive.def b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Archive.def
deleted file mode 100644
index 55b530b..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Archive.def
+++ /dev/null
@@ -1,6 +0,0 @@
-EXPORTS
-  CreateObject PRIVATE
-  GetHandlerProperty PRIVATE
-  GetNumberOfFormats PRIVATE
-  GetHandlerProperty2 PRIVATE
-  CreateObject PRIVATE
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Archive2.def b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Archive2.def
deleted file mode 100644
index 885d39d..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Archive2.def
+++ /dev/null
@@ -1,9 +0,0 @@
-EXPORTS
-  CreateObject PRIVATE
-  GetHandlerProperty PRIVATE
-  GetNumberOfFormats PRIVATE
-  GetHandlerProperty2 PRIVATE
-  CreateObject PRIVATE
-  GetNumberOfMethods PRIVATE
-  GetMethodProperty PRIVATE
-  SetLargePageMode PRIVATE
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/ArchiveExports.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/ArchiveExports.cpp
deleted file mode 100644
index ae388d6..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/ArchiveExports.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-// ArchiveExports.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/ComTry.h"
-#include "../../Common/Types.h"
-#include "../../Windows/PropVariant.h"
-#include "../Common/RegisterArc.h"
-
-#include "IArchive.h"
-#include "../ICoder.h"
-#include "../IPassword.h"
-
-static const unsigned int kNumArcsMax = 32;
-static unsigned int g_NumArcs = 0;
-static const CArcInfo *g_Arcs[kNumArcsMax];
-void RegisterArc(const CArcInfo *arcInfo)
-{
-  if (g_NumArcs < kNumArcsMax)
-    g_Arcs[g_NumArcs++] = arcInfo;
-}
-
-DEFINE_GUID(CLSID_CArchiveHandler,
-0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x00);
-
-#define CLS_ARC_ID_ITEM(cls) ((cls).Data4[5])
-
-static inline HRESULT SetPropString(const char *s, unsigned int size, PROPVARIANT *value)
-{
-  if ((value->bstrVal = ::SysAllocStringByteLen(s, size)) != 0)
-    value->vt = VT_BSTR;
-  return S_OK;
-}
-
-static inline HRESULT SetPropGUID(const GUID &guid, PROPVARIANT *value)
-{
-  return SetPropString((const char *)&guid, sizeof(GUID), value);
-}
-
-int FindFormatCalssId(const GUID *clsID)
-{
-  GUID cls = *clsID;
-  CLS_ARC_ID_ITEM(cls) = 0;
-  if (cls != CLSID_CArchiveHandler)
-    return -1;
-  Byte id = CLS_ARC_ID_ITEM(*clsID);
-  for (unsigned i = 0; i < g_NumArcs; i++)
-    if (g_Arcs[i]->ClassId == id)
-      return (int)i;
-  return -1;
-}
-
-STDAPI CreateArchiver(const GUID *clsid, const GUID *iid, void **outObject)
-{
-  COM_TRY_BEGIN
-  {
-    int needIn = (*iid == IID_IInArchive);
-    int needOut = (*iid == IID_IOutArchive);
-    if (!needIn && !needOut)
-      return E_NOINTERFACE;
-    int formatIndex = FindFormatCalssId(clsid);
-    if (formatIndex < 0)
-      return CLASS_E_CLASSNOTAVAILABLE;
-    
-    const CArcInfo &arc = *g_Arcs[formatIndex];
-    if (needIn)
-    {
-      *outObject = arc.CreateInArchive();
-      ((IInArchive *)*outObject)->AddRef();
-    }
-    else
-    {
-      if (!arc.CreateOutArchive)
-        return CLASS_E_CLASSNOTAVAILABLE;
-      *outObject = arc.CreateOutArchive();
-      ((IOutArchive *)*outObject)->AddRef();
-    }
-  }
-  COM_TRY_END
-  return S_OK;
-}
-
-STDAPI GetHandlerProperty2(UInt32 formatIndex, PROPID propID, PROPVARIANT *value)
-{
-  if (formatIndex >= g_NumArcs)
-    return E_INVALIDARG;
-  const CArcInfo &arc = *g_Arcs[formatIndex];
-  NWindows::NCOM::CPropVariant prop;
-  switch(propID)
-  {
-    case NArchive::kName:
-      prop = arc.Name;
-      break;
-    case NArchive::kClassID:
-    {
-      GUID clsId = CLSID_CArchiveHandler;
-      CLS_ARC_ID_ITEM(clsId) = arc.ClassId;
-      return SetPropGUID(clsId, value);
-    }
-    case NArchive::kExtension:
-      if (arc.Ext != 0)
-        prop = arc.Ext;
-      break;
-    case NArchive::kAddExtension:
-      if (arc.AddExt != 0)
-        prop = arc.AddExt;
-      break;
-    case NArchive::kUpdate:
-      prop = (bool)(arc.CreateOutArchive != 0);
-      break;
-    case NArchive::kKeepName:
-      prop = arc.KeepName;
-      break;
-    case NArchive::kStartSignature:
-      return SetPropString((const char *)arc.Signature, arc.SignatureSize, value);
-  }
-  prop.Detach(value);
-  return S_OK;
-}
-
-STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value)
-{
-  return GetHandlerProperty2(0, propID, value);
-}
-
-STDAPI GetNumberOfFormats(UINT32 *numFormats)
-{
-  *numFormats = g_NumArcs;
-  return S_OK;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/CoderMixer2.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/CoderMixer2.cpp
deleted file mode 100644
index aed94f9..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/CoderMixer2.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-// CoderMixer2.cpp
-
-#include "StdAfx.h"
-
-#include "CoderMixer2.h"
-
-namespace NCoderMixer {
-
-CBindReverseConverter::CBindReverseConverter(const CBindInfo &srcBindInfo):
-  _srcBindInfo(srcBindInfo)
-{
-  srcBindInfo.GetNumStreams(NumSrcInStreams, _numSrcOutStreams);
-
-  UInt32  j;
-  for (j = 0; j < NumSrcInStreams; j++)
-  {
-    _srcInToDestOutMap.Add(0);
-    DestOutToSrcInMap.Add(0);
-  }
-  for (j = 0; j < _numSrcOutStreams; j++)
-  {
-    _srcOutToDestInMap.Add(0);
-    _destInToSrcOutMap.Add(0);
-  }
-
-  UInt32 destInOffset = 0;
-  UInt32 destOutOffset = 0;
-  UInt32 srcInOffset = NumSrcInStreams;
-  UInt32 srcOutOffset = _numSrcOutStreams;
-
-  for (int i = srcBindInfo.Coders.Size() - 1; i >= 0; i--)
-  {
-    const CCoderStreamsInfo &srcCoderInfo = srcBindInfo.Coders[i];
-
-    srcInOffset -= srcCoderInfo.NumInStreams;
-    srcOutOffset -= srcCoderInfo.NumOutStreams;
-    
-    UInt32 j;
-    for (j = 0; j < srcCoderInfo.NumInStreams; j++, destOutOffset++)
-    {
-      UInt32 index = srcInOffset + j;
-      _srcInToDestOutMap[index] = destOutOffset;
-      DestOutToSrcInMap[destOutOffset] = index;
-    }
-    for (j = 0; j < srcCoderInfo.NumOutStreams; j++, destInOffset++)
-    {
-      UInt32 index = srcOutOffset + j;
-      _srcOutToDestInMap[index] = destInOffset;
-      _destInToSrcOutMap[destInOffset] = index;
-    }
-  }
-}
-
-void CBindReverseConverter::CreateReverseBindInfo(CBindInfo &destBindInfo)
-{
-  destBindInfo.Coders.Clear();
-  destBindInfo.BindPairs.Clear();
-  destBindInfo.InStreams.Clear();
-  destBindInfo.OutStreams.Clear();
-
-  int i;
-  for (i = _srcBindInfo.Coders.Size() - 1; i >= 0; i--)
-  {
-    const CCoderStreamsInfo &srcCoderInfo = _srcBindInfo.Coders[i];
-    CCoderStreamsInfo destCoderInfo;
-    destCoderInfo.NumInStreams = srcCoderInfo.NumOutStreams;
-    destCoderInfo.NumOutStreams = srcCoderInfo.NumInStreams;
-    destBindInfo.Coders.Add(destCoderInfo);
-  }
-  for (i = _srcBindInfo.BindPairs.Size() - 1; i >= 0; i--)
-  {
-    const CBindPair &srcBindPair = _srcBindInfo.BindPairs[i];
-    CBindPair destBindPair;
-    destBindPair.InIndex = _srcOutToDestInMap[srcBindPair.OutIndex];
-    destBindPair.OutIndex = _srcInToDestOutMap[srcBindPair.InIndex];
-    destBindInfo.BindPairs.Add(destBindPair);
-  }
-  for (i = 0; i < _srcBindInfo.InStreams.Size(); i++)
-    destBindInfo.OutStreams.Add(_srcInToDestOutMap[_srcBindInfo.InStreams[i]]);
-  for (i = 0; i < _srcBindInfo.OutStreams.Size(); i++)
-    destBindInfo.InStreams.Add(_srcOutToDestInMap[_srcBindInfo.OutStreams[i]]);
-}
-
-CCoderInfo2::CCoderInfo2(UInt32 numInStreams, UInt32 numOutStreams):
-    NumInStreams(numInStreams),
-    NumOutStreams(numOutStreams)
-{
-  InSizes.Reserve(NumInStreams);
-  InSizePointers.Reserve(NumInStreams);
-  OutSizePointers.Reserve(NumOutStreams);
-  OutSizePointers.Reserve(NumOutStreams);
-}
-
-static void SetSizes(const UInt64 **srcSizes, CRecordVector<UInt64> &sizes,
-    CRecordVector<const UInt64 *> &sizePointers, UInt32 numItems)
-{
-  sizes.Clear();
-  sizePointers.Clear();
-  for(UInt32 i = 0; i < numItems; i++)
-  {
-    if (srcSizes == 0 || srcSizes[i] == NULL)
-    {
-      sizes.Add(0);
-      sizePointers.Add(NULL);
-    }
-    else
-    {
-      sizes.Add(*srcSizes[i]);
-      sizePointers.Add(&sizes.Back());
-    }
-  }
-}
-
-void CCoderInfo2::SetCoderInfo(const UInt64 **inSizes,
-      const UInt64 **outSizes)
-{
-  SetSizes(inSizes, InSizes, InSizePointers, NumInStreams);
-  SetSizes(outSizes, OutSizes, OutSizePointers, NumOutStreams);
-}
-
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/CoderMixer2.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/CoderMixer2.h
deleted file mode 100644
index a03722d..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/CoderMixer2.h
+++ /dev/null
@@ -1,174 +0,0 @@
-// CoderMixer2.h
-
-#ifndef __CODER_MIXER2_H
-#define __CODER_MIXER2_H
-
-#include "../../../Common/MyVector.h"
-#include "../../../Common/Types.h"
-#include "../../../Common/MyCom.h"
-#include "../../ICoder.h"
-
-namespace NCoderMixer {
-
-struct CBindPair
-{
-  UInt32 InIndex;
-  UInt32 OutIndex;
-};
-
-struct CCoderStreamsInfo
-{
-  UInt32 NumInStreams;
-  UInt32 NumOutStreams;
-};
-
-struct CBindInfo
-{
-  CRecordVector<CCoderStreamsInfo> Coders;
-  CRecordVector<CBindPair> BindPairs;
-  CRecordVector<UInt32> InStreams;
-  CRecordVector<UInt32> OutStreams;
-
-  void Clear()
-  {
-    Coders.Clear();
-    BindPairs.Clear();
-    InStreams.Clear();
-    OutStreams.Clear();
-  }
-
-  /*
-  UInt32 GetCoderStartOutStream(UInt32 coderIndex) const
-  {
-    UInt32 numOutStreams = 0;
-    for (UInt32 i = 0; i < coderIndex; i++)
-      numOutStreams += Coders[i].NumOutStreams;
-    return numOutStreams;
-  }
-  */
-
-
-  void GetNumStreams(UInt32 &numInStreams, UInt32 &numOutStreams) const
-  {
-    numInStreams = 0;
-    numOutStreams = 0;
-    for (int i = 0; i < Coders.Size(); i++)
-    {
-      const CCoderStreamsInfo &coderStreamsInfo = Coders[i];
-      numInStreams += coderStreamsInfo.NumInStreams;
-      numOutStreams += coderStreamsInfo.NumOutStreams;
-    }
-  }
-
-  int FindBinderForInStream(UInt32 inStream) const
-  {
-    for (int i = 0; i < BindPairs.Size(); i++)
-      if (BindPairs[i].InIndex == inStream)
-        return i;
-    return -1;
-  }
-  int FindBinderForOutStream(UInt32 outStream) const
-  {
-    for (int i = 0; i < BindPairs.Size(); i++)
-      if (BindPairs[i].OutIndex == outStream)
-        return i;
-    return -1;
-  }
-
-  UInt32 GetCoderInStreamIndex(UInt32 coderIndex) const
-  {
-    UInt32 streamIndex = 0;
-    for (UInt32 i = 0; i < coderIndex; i++)
-      streamIndex += Coders[i].NumInStreams;
-    return streamIndex;
-  }
-
-  UInt32 GetCoderOutStreamIndex(UInt32 coderIndex) const
-  {
-    UInt32 streamIndex = 0;
-    for (UInt32 i = 0; i < coderIndex; i++)
-      streamIndex += Coders[i].NumOutStreams;
-    return streamIndex;
-  }
-
-
-  void FindInStream(UInt32 streamIndex, UInt32 &coderIndex,
-      UInt32 &coderStreamIndex) const
-  {
-    for (coderIndex = 0; coderIndex < (UInt32)Coders.Size(); coderIndex++)
-    {
-      UInt32 curSize = Coders[coderIndex].NumInStreams;
-      if (streamIndex < curSize)
-      {
-        coderStreamIndex = streamIndex;
-        return;
-      }
-      streamIndex -= curSize;
-    }
-    throw 1;
-  }
-  void FindOutStream(UInt32 streamIndex, UInt32 &coderIndex,
-      UInt32 &coderStreamIndex) const
-  {
-    for (coderIndex = 0; coderIndex < (UInt32)Coders.Size(); coderIndex++)
-    {
-      UInt32 curSize = Coders[coderIndex].NumOutStreams;
-      if (streamIndex < curSize)
-      {
-        coderStreamIndex = streamIndex;
-        return;
-      }
-      streamIndex -= curSize;
-    }
-    throw 1;
-  }
-};
-
-class CBindReverseConverter
-{
-  UInt32 _numSrcOutStreams;
-  NCoderMixer::CBindInfo _srcBindInfo;
-  CRecordVector<UInt32> _srcInToDestOutMap;
-  CRecordVector<UInt32> _srcOutToDestInMap;
-  CRecordVector<UInt32> _destInToSrcOutMap;
-public:
-  UInt32 NumSrcInStreams;
-  CRecordVector<UInt32> DestOutToSrcInMap;
-
-  CBindReverseConverter(const NCoderMixer::CBindInfo &srcBindInfo);
-  void CreateReverseBindInfo(NCoderMixer::CBindInfo &destBindInfo);
-};
-
-struct CCoderInfo2
-{
-  CMyComPtr<ICompressCoder> Coder;
-  CMyComPtr<ICompressCoder2> Coder2;
-  UInt32 NumInStreams;
-  UInt32 NumOutStreams;
-
-  CRecordVector<UInt64> InSizes;
-  CRecordVector<UInt64> OutSizes;
-  CRecordVector<const UInt64 *> InSizePointers;
-  CRecordVector<const UInt64 *> OutSizePointers;
-
-  CCoderInfo2(UInt32 numInStreams, UInt32 numOutStreams);
-  void SetCoderInfo(const UInt64 **inSizes, const UInt64 **outSizes);
-
-  HRESULT QueryInterface(REFGUID iid, void** pp) const
-  {
-    IUnknown *p = Coder ? (IUnknown *)Coder : (IUnknown *)Coder2;
-    return p->QueryInterface(iid, pp);
-  }
-};
-
-class CCoderMixer2
-{
-public:
-  virtual HRESULT SetBindInfo(const CBindInfo &bindInfo) = 0;
-  virtual void ReInit() = 0;
-  virtual void SetCoderInfo(UInt32 coderIndex, const UInt64 **inSizes, const UInt64 **outSizes) = 0;
-};
-
-}
-#endif
-
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/CoderMixer2MT.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/CoderMixer2MT.cpp
deleted file mode 100644
index 1265dfc..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/CoderMixer2MT.cpp
+++ /dev/null
@@ -1,230 +0,0 @@
-// CoderMixer2MT.cpp
-
-#include "StdAfx.h"
-
-#include "CoderMixer2MT.h"
-
-namespace NCoderMixer {
-
-CCoder2::CCoder2(UInt32 numInStreams, UInt32 numOutStreams):
-    CCoderInfo2(numInStreams, numOutStreams)
-{
-  InStreams.Reserve(NumInStreams);
-  InStreamPointers.Reserve(NumInStreams);
-  OutStreams.Reserve(NumOutStreams);
-  OutStreamPointers.Reserve(NumOutStreams);
-}
-
-void CCoder2::Execute() { Code(NULL); }
-
-void CCoder2::Code(ICompressProgressInfo *progress)
-{
-  InStreamPointers.Clear();
-  OutStreamPointers.Clear();
-  UInt32 i;
-  for (i = 0; i < NumInStreams; i++)
-  {
-    if (InSizePointers[i] != NULL)
-      InSizePointers[i] = &InSizes[i];
-    InStreamPointers.Add((ISequentialInStream *)InStreams[i]);
-  }
-  for (i = 0; i < NumOutStreams; i++)
-  {
-    if (OutSizePointers[i] != NULL)
-      OutSizePointers[i] = &OutSizes[i];
-    OutStreamPointers.Add((ISequentialOutStream *)OutStreams[i]);
-  }
-  if (Coder)
-    Result = Coder->Code(InStreamPointers[0], OutStreamPointers[0],
-        InSizePointers[0], OutSizePointers[0], progress);
-  else
-    Result = Coder2->Code(&InStreamPointers.Front(), &InSizePointers.Front(), NumInStreams,
-      &OutStreamPointers.Front(), &OutSizePointers.Front(), NumOutStreams, progress);
-  {
-    int i;
-    for (i = 0; i < InStreams.Size(); i++)
-      InStreams[i].Release();
-    for (i = 0; i < OutStreams.Size(); i++)
-      OutStreams[i].Release();
-  }
-}
-
-static void SetSizes(const UInt64 **srcSizes, CRecordVector<UInt64> &sizes,
-    CRecordVector<const UInt64 *> &sizePointers, UInt32 numItems)
-{
-  sizes.Clear();
-  sizePointers.Clear();
-  for(UInt32 i = 0; i < numItems; i++)
-  {
-    if (srcSizes == 0 || srcSizes[i] == NULL)
-    {
-      sizes.Add(0);
-      sizePointers.Add(NULL);
-    }
-    else
-    {
-      sizes.Add(*srcSizes[i]);
-      sizePointers.Add(&sizes.Back());
-    }
-  }
-}
-
-
-void CCoder2::SetCoderInfo(const UInt64 **inSizes, const UInt64 **outSizes)
-{
-  SetSizes(inSizes, InSizes, InSizePointers, NumInStreams);
-  SetSizes(outSizes, OutSizes, OutSizePointers, NumOutStreams);
-}
-
-//////////////////////////////////////
-// CCoderMixer2MT
-
-HRESULT CCoderMixer2MT::SetBindInfo(const CBindInfo &bindInfo)
-{
-  _bindInfo = bindInfo;
-  _streamBinders.Clear();
-  for(int i = 0; i < _bindInfo.BindPairs.Size(); i++)
-  {
-    _streamBinders.Add(CStreamBinder());
-    RINOK(_streamBinders.Back().CreateEvents());
-  }
-  return S_OK;
-}
-
-void CCoderMixer2MT::AddCoderCommon()
-{
-  const CCoderStreamsInfo &c = _bindInfo.Coders[_coders.Size()];
-  CCoder2 threadCoderInfo(c.NumInStreams, c.NumOutStreams);
-  _coders.Add(threadCoderInfo);
-}
-
-void CCoderMixer2MT::AddCoder(ICompressCoder *coder)
-{
-  AddCoderCommon();
-  _coders.Back().Coder = coder;
-}
-
-void CCoderMixer2MT::AddCoder2(ICompressCoder2 *coder)
-{
-  AddCoderCommon();
-  _coders.Back().Coder2 = coder;
-}
-
-
-void CCoderMixer2MT::ReInit()
-{
-  for(int i = 0; i < _streamBinders.Size(); i++)
-    _streamBinders[i].ReInit();
-}
-
-
-HRESULT CCoderMixer2MT::Init(ISequentialInStream **inStreams, ISequentialOutStream **outStreams)
-{
-  /*
-  if (_coders.Size() != _bindInfo.Coders.Size())
-    throw 0;
-  */
-  int i;
-  for(i = 0; i < _coders.Size(); i++)
-  {
-    CCoder2 &coderInfo = _coders[i];
-    const CCoderStreamsInfo &coderStreamsInfo = _bindInfo.Coders[i];
-    coderInfo.InStreams.Clear();
-    UInt32 j;
-    for(j = 0; j < coderStreamsInfo.NumInStreams; j++)
-      coderInfo.InStreams.Add(NULL);
-    coderInfo.OutStreams.Clear();
-    for(j = 0; j < coderStreamsInfo.NumOutStreams; j++)
-      coderInfo.OutStreams.Add(NULL);
-  }
-
-  for(i = 0; i < _bindInfo.BindPairs.Size(); i++)
-  {
-    const CBindPair &bindPair = _bindInfo.BindPairs[i];
-    UInt32 inCoderIndex, inCoderStreamIndex;
-    UInt32 outCoderIndex, outCoderStreamIndex;
-    _bindInfo.FindInStream(bindPair.InIndex, inCoderIndex, inCoderStreamIndex);
-    _bindInfo.FindOutStream(bindPair.OutIndex, outCoderIndex, outCoderStreamIndex);
-
-    _streamBinders[i].CreateStreams(
-        &_coders[inCoderIndex].InStreams[inCoderStreamIndex],
-        &_coders[outCoderIndex].OutStreams[outCoderStreamIndex]);
-  }
-
-  for(i = 0; i < _bindInfo.InStreams.Size(); i++)
-  {
-    UInt32 inCoderIndex, inCoderStreamIndex;
-    _bindInfo.FindInStream(_bindInfo.InStreams[i], inCoderIndex, inCoderStreamIndex);
-    _coders[inCoderIndex].InStreams[inCoderStreamIndex] = inStreams[i];
-  }
-  
-  for(i = 0; i < _bindInfo.OutStreams.Size(); i++)
-  {
-    UInt32 outCoderIndex, outCoderStreamIndex;
-    _bindInfo.FindOutStream(_bindInfo.OutStreams[i], outCoderIndex, outCoderStreamIndex);
-    _coders[outCoderIndex].OutStreams[outCoderStreamIndex] = outStreams[i];
-  }
-  return S_OK;
-}
-
-HRESULT CCoderMixer2MT::ReturnIfError(HRESULT code)
-{
-  for (int i = 0; i < _coders.Size(); i++)
-    if (_coders[i].Result == code)
-      return code;
-  return S_OK;
-}
-
-STDMETHODIMP CCoderMixer2MT::Code(ISequentialInStream **inStreams,
-      const UInt64 ** /* inSizes */,
-      UInt32 numInStreams,
-      ISequentialOutStream **outStreams,
-      const UInt64 ** /* outSizes */,
-      UInt32 numOutStreams,
-      ICompressProgressInfo *progress)
-{
-  if (numInStreams != (UInt32)_bindInfo.InStreams.Size() ||
-      numOutStreams != (UInt32)_bindInfo.OutStreams.Size())
-    return E_INVALIDARG;
-
-  Init(inStreams, outStreams);
-
-  int i;
-  for (i = 0; i < _coders.Size(); i++)
-    if (i != _progressCoderIndex)
-    {
-      RINOK(_coders[i].Create());
-    }
-
-  for (i = 0; i < _coders.Size(); i++)
-    if (i != _progressCoderIndex)
-      _coders[i].Start();
-
-  _coders[_progressCoderIndex].Code(progress);
-
-  for (i = 0; i < _coders.Size(); i++)
-    if (i != _progressCoderIndex)
-      _coders[i].WaitFinish();
-
-  RINOK(ReturnIfError(E_ABORT));
-  RINOK(ReturnIfError(E_OUTOFMEMORY));
-
-  for (i = 0; i < _coders.Size(); i++)
-  {
-    HRESULT result = _coders[i].Result;
-    if (result != S_OK && result != E_FAIL && result != S_FALSE)
-      return result;
-  }
-
-  RINOK(ReturnIfError(S_FALSE));
-
-  for (i = 0; i < _coders.Size(); i++)
-  {
-    HRESULT result = _coders[i].Result;
-    if (result != S_OK)
-      return result;
-  }
-  return S_OK;
-}
-
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/CoderMixer2MT.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/CoderMixer2MT.h
deleted file mode 100644
index d1c7f4d..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/CoderMixer2MT.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// CoderMixer2MT.h
-
-#ifndef __CODER_MIXER2_MT_H
-#define __CODER_MIXER2_MT_H
-
-#include "CoderMixer2.h"
-#include "../../../Common/MyCom.h"
-#include "../../Common/StreamBinder.h"
-#include "../../Common/VirtThread.h"
-
-namespace NCoderMixer {
-
-struct CCoder2: public CCoderInfo2, public CVirtThread
-{
-  HRESULT Result;
-  CObjectVector< CMyComPtr<ISequentialInStream> > InStreams;
-  CObjectVector< CMyComPtr<ISequentialOutStream> > OutStreams;
-  CRecordVector<ISequentialInStream*> InStreamPointers;
-  CRecordVector<ISequentialOutStream*> OutStreamPointers;
-
-  CCoder2(UInt32 numInStreams, UInt32 numOutStreams);
-  void SetCoderInfo(const UInt64 **inSizes, const UInt64 **outSizes);
-  virtual void Execute();
-  void Code(ICompressProgressInfo *progress);
-};
-
-
-/*
-  SetBindInfo()
-  for each coder
-    AddCoder[2]()
-  SetProgressIndex(UInt32 coderIndex);
- 
-  for each file
-  {
-    ReInit()
-    for each coder
-      SetCoderInfo
-    Code
-  }
-*/
-
-class CCoderMixer2MT:
-  public ICompressCoder2,
-  public CCoderMixer2,
-  public CMyUnknownImp
-{
-  CBindInfo _bindInfo;
-  CObjectVector<CStreamBinder> _streamBinders;
-  int _progressCoderIndex;
-
-  void AddCoderCommon();
-  HRESULT Init(ISequentialInStream **inStreams, ISequentialOutStream **outStreams);
-  HRESULT ReturnIfError(HRESULT code);
-public:
-  CObjectVector<CCoder2> _coders;
-  MY_UNKNOWN_IMP
-
-  STDMETHOD(Code)(ISequentialInStream **inStreams,
-      const UInt64 **inSizes,
-      UInt32 numInStreams,
-      ISequentialOutStream **outStreams,
-      const UInt64 **outSizes,
-      UInt32 numOutStreams,
-      ICompressProgressInfo *progress);
-
-  HRESULT SetBindInfo(const CBindInfo &bindInfo);
-  void AddCoder(ICompressCoder *coder);
-  void AddCoder2(ICompressCoder2 *coder);
-  void SetProgressCoderIndex(int coderIndex) {  _progressCoderIndex = coderIndex; }
-
-  void ReInit();
-  void SetCoderInfo(UInt32 coderIndex, const UInt64 **inSizes, const UInt64 **outSizes)
-    {  _coders[coderIndex].SetCoderInfo(inSizes, outSizes); }
-  UInt64 GetWriteProcessedSize(UInt32 binderIndex) const
-    {  return _streamBinders[binderIndex].ProcessedSize; }
-};
-
-}
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/CrossThreadProgress.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/CrossThreadProgress.cpp
deleted file mode 100644
index a974b54..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/CrossThreadProgress.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-// CrossThreadProgress.cpp
-
-#include "StdAfx.h"
-
-#include "CrossThreadProgress.h"
-
-STDMETHODIMP CCrossThreadProgress::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
-{
-  InSize = inSize;
-  OutSize = outSize;
-  ProgressEvent.Set();
-  WaitEvent.Lock();
-  return Result;
-}
-
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/CrossThreadProgress.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/CrossThreadProgress.h
deleted file mode 100644
index 7e0b105..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/CrossThreadProgress.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// CrossThreadProgress.h
-
-#ifndef __CROSSTHREADPROGRESS_H
-#define __CROSSTHREADPROGRESS_H
-
-#include "../../ICoder.h"
-#include "../../../Windows/Synchronization.h"
-#include "../../../Common/MyCom.h"
-
-class CCrossThreadProgress:
-  public ICompressProgressInfo,
-  public CMyUnknownImp
-{
-public:
-  const UInt64 *InSize;
-  const UInt64 *OutSize;
-  HRESULT Result;
-  NWindows::NSynchronization::CAutoResetEvent ProgressEvent;
-  NWindows::NSynchronization::CAutoResetEvent WaitEvent;
-
-  HRes Create()
-  {
-    RINOK(ProgressEvent.CreateIfNotCreated());
-    return WaitEvent.CreateIfNotCreated();
-  }
-  void Init()
-  {
-    ProgressEvent.Reset();
-    WaitEvent.Reset();
-  }
-
-  MY_UNKNOWN_IMP
-
-  STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/DummyOutStream.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/DummyOutStream.cpp
deleted file mode 100644
index 54bcfec..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/DummyOutStream.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// DummyOutStream.cpp
-
-#include "StdAfx.h"
-
-#include "DummyOutStream.h"
-
-STDMETHODIMP CDummyOutStream::Write(const void *data,  UInt32 size, UInt32 *processedSize)
-{
-  UInt32 realProcessedSize;
-  HRESULT result;
-  if(!_stream)
-  {
-    realProcessedSize = size;
-    result = S_OK;
-  }
-  else
-    result = _stream->Write(data, size, &realProcessedSize);
-  _size += realProcessedSize;
-  if(processedSize != NULL)
-    *processedSize = realProcessedSize;
-  return result;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/DummyOutStream.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/DummyOutStream.h
deleted file mode 100644
index 13d5b62..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/DummyOutStream.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// DummyOutStream.h
-
-#ifndef __DUMMYOUTSTREAM_H
-#define __DUMMYOUTSTREAM_H
-
-#include "../../IStream.h"
-#include "Common/MyCom.h"
-
-class CDummyOutStream:
-  public ISequentialOutStream,
-  public CMyUnknownImp
-{
-  CMyComPtr<ISequentialOutStream> _stream;
-  UInt64 _size;
-public:
-  void SetStream(ISequentialOutStream *outStream) { _stream = outStream; }
-  void ReleaseStream() { _stream.Release(); }
-  void Init() { _size = 0; }
-  MY_UNKNOWN_IMP
-  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-  UInt64 GetSize() const { return _size; }
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/HandlerOut.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/HandlerOut.cpp
deleted file mode 100644
index 76739e9..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/HandlerOut.cpp
+++ /dev/null
@@ -1,620 +0,0 @@
-// HandlerOut.cpp
-
-#include "StdAfx.h"
-
-#include "../../../Common/StringToInt.h"
-
-#include "../../../Windows/PropVariant.h"
-
-#ifdef COMPRESS_MT
-#include "../../../Windows/System.h"
-#endif
-
-#include "../../ICoder.h"
-
-#include "../Common/ParseProperties.h"
-
-#include "HandlerOut.h"
-
-using namespace NWindows;
-
-namespace NArchive {
-
-static const wchar_t *kCopyMethod = L"Copy";
-static const wchar_t *kLZMAMethodName = L"LZMA";
-static const wchar_t *kLZMA2MethodName = L"LZMA2";
-static const wchar_t *kBZip2MethodName = L"BZip2";
-static const wchar_t *kPpmdMethodName = L"PPMd";
-static const wchar_t *kDeflateMethodName = L"Deflate";
-static const wchar_t *kDeflate64MethodName = L"Deflate64";
-
-static const wchar_t *kLzmaMatchFinderX1 = L"HC4";
-static const wchar_t *kLzmaMatchFinderX5 = L"BT4";
-
-static const UInt32 kLzmaAlgoX1 = 0;
-static const UInt32 kLzmaAlgoX5 = 1;
-
-static const UInt32 kLzmaDicSizeX1 = 1 << 16;
-static const UInt32 kLzmaDicSizeX3 = 1 << 20;
-static const UInt32 kLzmaDicSizeX5 = 1 << 24;
-static const UInt32 kLzmaDicSizeX7 = 1 << 25;
-static const UInt32 kLzmaDicSizeX9 = 1 << 26;
-
-static const UInt32 kLzmaFastBytesX1 = 32;
-static const UInt32 kLzmaFastBytesX7 = 64;
-
-static const UInt32 kPpmdMemSizeX1 = (1 << 22);
-static const UInt32 kPpmdMemSizeX5 = (1 << 24);
-static const UInt32 kPpmdMemSizeX7 = (1 << 26);
-static const UInt32 kPpmdMemSizeX9 = (192 << 20);
-
-static const UInt32 kPpmdOrderX1 = 4;
-static const UInt32 kPpmdOrderX5 = 6;
-static const UInt32 kPpmdOrderX7 = 16;
-static const UInt32 kPpmdOrderX9 = 32;
-
-static const UInt32 kDeflateAlgoX1 = 0;
-static const UInt32 kDeflateAlgoX5 = 1;
-
-static const UInt32 kDeflateFastBytesX1 = 32;
-static const UInt32 kDeflateFastBytesX7 = 64;
-static const UInt32 kDeflateFastBytesX9 = 128;
-
-static const UInt32 kDeflatePassesX1 = 1;
-static const UInt32 kDeflatePassesX7 = 3;
-static const UInt32 kDeflatePassesX9 = 10;
-
-static const UInt32 kBZip2NumPassesX1 = 1;
-static const UInt32 kBZip2NumPassesX7 = 2;
-static const UInt32 kBZip2NumPassesX9 = 7;
-
-static const UInt32 kBZip2DicSizeX1 = 100000;
-static const UInt32 kBZip2DicSizeX3 = 500000;
-static const UInt32 kBZip2DicSizeX5 = 900000;
-
-static const wchar_t *kDefaultMethodName = kLZMAMethodName;
-
-static const wchar_t *kLzmaMatchFinderForHeaders = L"BT2";
-static const UInt32 kDictionaryForHeaders = 1 << 20;
-static const UInt32 kNumFastBytesForHeaders = 273;
-static const UInt32 kAlgorithmForHeaders = kLzmaAlgoX5;
-
-static bool AreEqual(const UString &methodName, const wchar_t *s)
-  { return (methodName.CompareNoCase(s) == 0); }
-
-static inline bool IsLZMAMethod(const UString &methodName)
-{
-  return
-    AreEqual(methodName, kLZMAMethodName) ||
-    AreEqual(methodName, kLZMA2MethodName);
-}
-
-static inline bool IsBZip2Method(const UString &methodName)
-  { return AreEqual(methodName, kBZip2MethodName); }
-
-static inline bool IsPpmdMethod(const UString &methodName)
-  { return AreEqual(methodName, kPpmdMethodName); }
-
-static inline bool IsDeflateMethod(const UString &methodName)
-{
-  return
-    AreEqual(methodName, kDeflateMethodName) ||
-    AreEqual(methodName, kDeflate64MethodName);
-}
-
-struct CNameToPropID
-{
-  PROPID PropID;
-  VARTYPE VarType;
-  const wchar_t *Name;
-};
-
-CNameToPropID g_NameToPropID[] =
-{
-  { NCoderPropID::kOrder, VT_UI4, L"O" },
-  { NCoderPropID::kPosStateBits, VT_UI4, L"PB" },
-  { NCoderPropID::kLitContextBits, VT_UI4, L"LC" },
-  { NCoderPropID::kLitPosBits, VT_UI4, L"LP" },
-  { NCoderPropID::kEndMarker, VT_BOOL, L"eos" },
-
-  { NCoderPropID::kNumPasses, VT_UI4, L"Pass" },
-  { NCoderPropID::kNumFastBytes, VT_UI4, L"fb" },
-  { NCoderPropID::kMatchFinderCycles, VT_UI4, L"mc" },
-  { NCoderPropID::kAlgorithm, VT_UI4, L"a" },
-  { NCoderPropID::kMatchFinder, VT_BSTR, L"mf" },
-  { NCoderPropID::kNumThreads, VT_UI4, L"mt" }
-};
-
-static bool ConvertProperty(PROPVARIANT srcProp, VARTYPE varType, NCOM::CPropVariant &destProp)
-{
-  if (varType == srcProp.vt)
-  {
-    destProp = srcProp;
-    return true;
-  }
-  if (varType == VT_UI1)
-  {
-    if (srcProp.vt == VT_UI4)
-    {
-      UInt32 value = srcProp.ulVal;
-      if (value > 0xFF)
-        return false;
-      destProp = (Byte)value;
-      return true;
-    }
-  }
-  else if (varType == VT_BOOL)
-  {
-    bool res;
-    if (SetBoolProperty(res, srcProp) != S_OK)
-      return false;
-    destProp = res;
-    return true;
-  }
-  return false;
-}
-    
-static int FindPropIdFromStringName(const UString &name)
-{
-  for (int i = 0; i < sizeof(g_NameToPropID) / sizeof(g_NameToPropID[0]); i++)
-    if (name.CompareNoCase(g_NameToPropID[i].Name) == 0)
-      return i;
-  return -1;
-}
-
-static void SetOneMethodProp(COneMethodInfo &oneMethodInfo, PROPID propID,
-    const NWindows::NCOM::CPropVariant &value)
-{
-  for (int j = 0; j < oneMethodInfo.Props.Size(); j++)
-    if (oneMethodInfo.Props[j].Id == propID)
-      return;
-  CProp prop;
-  prop.Id = propID;
-  prop.Value = value;
-  oneMethodInfo.Props.Add(prop);
-}
-
-void COutHandler::SetCompressionMethod2(COneMethodInfo &oneMethodInfo
-    #ifdef COMPRESS_MT
-    , UInt32 numThreads
-    #endif
-    )
-{
-  UInt32 level = _level;
-  if (oneMethodInfo.MethodName.IsEmpty())
-    oneMethodInfo.MethodName = kDefaultMethodName;
-  
-  if (IsLZMAMethod(oneMethodInfo.MethodName))
-  {
-    UInt32 dicSize =
-      (level >= 9 ? kLzmaDicSizeX9 :
-      (level >= 7 ? kLzmaDicSizeX7 :
-      (level >= 5 ? kLzmaDicSizeX5 :
-      (level >= 3 ? kLzmaDicSizeX3 :
-                    kLzmaDicSizeX1))));
-    
-    UInt32 algo =
-      (level >= 5 ? kLzmaAlgoX5 :
-                    kLzmaAlgoX1);
-    
-    UInt32 fastBytes =
-      (level >= 7 ? kLzmaFastBytesX7 :
-                    kLzmaFastBytesX1);
-    
-    const wchar_t *matchFinder =
-      (level >= 5 ? kLzmaMatchFinderX5 :
-                    kLzmaMatchFinderX1);
-    
-    SetOneMethodProp(oneMethodInfo, NCoderPropID::kDictionarySize, dicSize);
-    SetOneMethodProp(oneMethodInfo, NCoderPropID::kAlgorithm, algo);
-    SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumFastBytes, fastBytes);
-    SetOneMethodProp(oneMethodInfo, NCoderPropID::kMatchFinder, matchFinder);
-    #ifdef COMPRESS_MT
-    SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumThreads, numThreads);
-    #endif
-  }
-  else if (IsDeflateMethod(oneMethodInfo.MethodName))
-  {
-    UInt32 fastBytes =
-      (level >= 9 ? kDeflateFastBytesX9 :
-      (level >= 7 ? kDeflateFastBytesX7 :
-                    kDeflateFastBytesX1));
-    
-    UInt32 numPasses =
-      (level >= 9 ? kDeflatePassesX9 :
-      (level >= 7 ? kDeflatePassesX7 :
-                    kDeflatePassesX1));
-    
-    UInt32 algo =
-      (level >= 5 ? kDeflateAlgoX5 :
-                    kDeflateAlgoX1);
-    
-    SetOneMethodProp(oneMethodInfo, NCoderPropID::kAlgorithm, algo);
-    SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumFastBytes, fastBytes);
-    SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumPasses, numPasses);
-  }
-  else if (IsBZip2Method(oneMethodInfo.MethodName))
-  {
-    UInt32 numPasses =
-      (level >= 9 ? kBZip2NumPassesX9 :
-      (level >= 7 ? kBZip2NumPassesX7 :
-                    kBZip2NumPassesX1));
-    
-    UInt32 dicSize =
-      (level >= 5 ? kBZip2DicSizeX5 :
-      (level >= 3 ? kBZip2DicSizeX3 :
-                    kBZip2DicSizeX1));
-    
-    SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumPasses, numPasses);
-    SetOneMethodProp(oneMethodInfo, NCoderPropID::kDictionarySize, dicSize);
-    #ifdef COMPRESS_MT
-    SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumThreads, numThreads);
-    #endif
-  }
-  else if (IsPpmdMethod(oneMethodInfo.MethodName))
-  {
-    UInt32 useMemSize =
-      (level >= 9 ? kPpmdMemSizeX9 :
-      (level >= 7 ? kPpmdMemSizeX7 :
-      (level >= 5 ? kPpmdMemSizeX5 :
-                    kPpmdMemSizeX1)));
-    
-    UInt32 order =
-      (level >= 9 ? kPpmdOrderX9 :
-      (level >= 7 ? kPpmdOrderX7 :
-      (level >= 5 ? kPpmdOrderX5 :
-                    kPpmdOrderX1)));
-    
-    SetOneMethodProp(oneMethodInfo, NCoderPropID::kUsedMemorySize, useMemSize);
-    SetOneMethodProp(oneMethodInfo, NCoderPropID::kOrder, order);
-  }
-}
-
-static void SplitParams(const UString &srcString, UStringVector &subStrings)
-{
-  subStrings.Clear();
-  UString name;
-  int len = srcString.Length();
-  if (len == 0)
-    return;
-  for (int i = 0; i < len; i++)
-  {
-    wchar_t c = srcString[i];
-    if (c == L':')
-    {
-      subStrings.Add(name);
-      name.Empty();
-    }
-    else
-      name += c;
-  }
-  subStrings.Add(name);
-}
-
-static void SplitParam(const UString &param, UString &name, UString &value)
-{
-  int eqPos = param.Find(L'=');
-  if (eqPos >= 0)
-  {
-    name = param.Left(eqPos);
-    value = param.Mid(eqPos + 1);
-    return;
-  }
-  for(int i = 0; i < param.Length(); i++)
-  {
-    wchar_t c = param[i];
-    if (c >= L'0' && c <= L'9')
-    {
-      name = param.Left(i);
-      value = param.Mid(i);
-      return;
-    }
-  }
-  name = param;
-}
-
-HRESULT COutHandler::SetParam(COneMethodInfo &oneMethodInfo, const UString &name, const UString &value)
-{
-  CProp prop;
-  if (name.CompareNoCase(L"D") == 0 ||
-      name.CompareNoCase(L"MEM") == 0)
-  {
-    UInt32 dicSize;
-    RINOK(ParsePropDictionaryValue(value, dicSize));
-    prop.Id = (name.CompareNoCase(L"D") == 0) ?
-        NCoderPropID::kDictionarySize :
-        NCoderPropID::kUsedMemorySize;
-    prop.Value = dicSize;
-  }
-  else
-  {
-    int index = FindPropIdFromStringName(name);
-    if (index < 0)
-      return E_INVALIDARG;
-    
-    const CNameToPropID &nameToPropID = g_NameToPropID[index];
-    prop.Id = nameToPropID.PropID;
-    
-    NCOM::CPropVariant propValue;
-    
-    if (nameToPropID.VarType == VT_BSTR)
-      propValue = value;
-    else if (nameToPropID.VarType == VT_BOOL)
-    {
-      bool res;
-      if (!StringToBool(value, res))
-        return E_INVALIDARG;
-      propValue = res;
-    }
-    else
-    {
-      UInt32 number;
-      if (ParseStringToUInt32(value, number) == value.Length())
-        propValue = number;
-      else
-        propValue = value;
-    }
-    
-    if (!ConvertProperty(propValue, nameToPropID.VarType, prop.Value))
-      return E_INVALIDARG;
-  }
-  oneMethodInfo.Props.Add(prop);
-  return S_OK;
-}
-
-HRESULT COutHandler::SetParams(COneMethodInfo &oneMethodInfo, const UString &srcString)
-{
-  UStringVector params;
-  SplitParams(srcString, params);
-  if (params.Size() > 0)
-    oneMethodInfo.MethodName = params[0];
-  for (int i = 1; i < params.Size(); i++)
-  {
-    const UString &param = params[i];
-    UString name, value;
-    SplitParam(param, name, value);
-    RINOK(SetParam(oneMethodInfo, name, value));
-  }
-  return S_OK;
-}
-
-HRESULT COutHandler::SetSolidSettings(const UString &s)
-{
-  UString s2 = s;
-  s2.MakeUpper();
-  for (int i = 0; i < s2.Length();)
-  {
-    const wchar_t *start = ((const wchar_t *)s2) + i;
-    const wchar_t *end;
-    UInt64 v = ConvertStringToUInt64(start, &end);
-    if (start == end)
-    {
-      if (s2[i++] != 'E')
-        return E_INVALIDARG;
-      _solidExtension = true;
-      continue;
-    }
-    i += (int)(end - start);
-    if (i == s2.Length())
-      return E_INVALIDARG;
-    wchar_t c = s2[i++];
-    switch(c)
-    {
-      case 'F':
-        if (v < 1)
-          v = 1;
-        _numSolidFiles = v;
-        break;
-      case 'B':
-        _numSolidBytes = v;
-        _numSolidBytesDefined = true;
-        break;
-      case 'K':
-        _numSolidBytes = (v << 10);
-        _numSolidBytesDefined = true;
-        break;
-      case 'M':
-        _numSolidBytes = (v << 20);
-        _numSolidBytesDefined = true;
-        break;
-      case 'G':
-        _numSolidBytes = (v << 30);
-        _numSolidBytesDefined = true;
-        break;
-      default:
-        return E_INVALIDARG;
-    }
-  }
-  return S_OK;
-}
-
-HRESULT COutHandler::SetSolidSettings(const PROPVARIANT &value)
-{
-  bool isSolid;
-  switch(value.vt)
-  {
-    case VT_EMPTY:
-      isSolid = true;
-      break;
-    case VT_BOOL:
-      isSolid = (value.boolVal != VARIANT_FALSE);
-      break;
-    case VT_BSTR:
-      if (StringToBool(value.bstrVal, isSolid))
-        break;
-      return SetSolidSettings(value.bstrVal);
-    default:
-      return E_INVALIDARG;
-  }
-  if (isSolid)
-    InitSolid();
-  else
-    _numSolidFiles = 1;
-  return S_OK;
-}
-
-void COutHandler::Init()
-{
-  _removeSfxBlock = false;
-  _compressHeaders = true;
-  _encryptHeadersSpecified = false;
-  _encryptHeaders = false;
-  
-  WriteCTime = false;
-  WriteATime = false;
-  WriteMTime = true;
-  
-  #ifdef COMPRESS_MT
-  _numThreads = NWindows::NSystem::GetNumberOfProcessors();
-  #endif
-  
-  _level = 5;
-  _autoFilter = true;
-  _volumeMode = false;
-  _crcSize = 4;
-  InitSolid();
-}
-
-void COutHandler::BeforeSetProperty()
-{
-  Init();
-  #ifdef COMPRESS_MT
-  numProcessors = NSystem::GetNumberOfProcessors();
-  #endif
-
-  mainDicSize = 0xFFFFFFFF;
-  mainDicMethodIndex = 0xFFFFFFFF;
-  minNumber = 0;
-  _crcSize = 4;
-}
-
-HRESULT COutHandler::SetProperty(const wchar_t *nameSpec, const PROPVARIANT &value)
-{
-  UString name = nameSpec;
-  name.MakeUpper();
-  if (name.IsEmpty())
-    return E_INVALIDARG;
-  
-  if (name[0] == 'X')
-  {
-    name.Delete(0);
-    _level = 9;
-    return ParsePropValue(name, value, _level);
-  }
-  
-  if (name[0] == L'S')
-  {
-    name.Delete(0);
-    if (name.IsEmpty())
-      return SetSolidSettings(value);
-    if (value.vt != VT_EMPTY)
-      return E_INVALIDARG;
-    return SetSolidSettings(name);
-  }
-  
-  if (name == L"CRC")
-  {
-    _crcSize = 4;
-    name.Delete(0, 3);
-    return ParsePropValue(name, value, _crcSize);
-  }
-  
-  UInt32 number;
-  int index = ParseStringToUInt32(name, number);
-  UString realName = name.Mid(index);
-  if (index == 0)
-  {
-    if(name.Left(2).CompareNoCase(L"MT") == 0)
-    {
-      #ifdef COMPRESS_MT
-      RINOK(ParseMtProp(name.Mid(2), value, numProcessors, _numThreads));
-      #endif
-      return S_OK;
-    }
-    if (name.CompareNoCase(L"RSFX") == 0)  return SetBoolProperty(_removeSfxBlock, value);
-    if (name.CompareNoCase(L"F") == 0) return SetBoolProperty(_autoFilter, value);
-    if (name.CompareNoCase(L"HC") == 0) return SetBoolProperty(_compressHeaders, value);
-    if (name.CompareNoCase(L"HCF") == 0)
-    {
-      bool compressHeadersFull = true;
-      RINOK(SetBoolProperty(compressHeadersFull, value));
-      if (!compressHeadersFull)
-        return E_INVALIDARG;
-      return S_OK;
-    }
-    if (name.CompareNoCase(L"HE") == 0)
-    {
-      RINOK(SetBoolProperty(_encryptHeaders, value));
-      _encryptHeadersSpecified = true;
-      return S_OK;
-    }
-    if (name.CompareNoCase(L"TC") == 0) return SetBoolProperty(WriteCTime, value);
-    if (name.CompareNoCase(L"TA") == 0) return SetBoolProperty(WriteATime, value);
-    if (name.CompareNoCase(L"TM") == 0) return SetBoolProperty(WriteMTime, value);
-    if (name.CompareNoCase(L"V") == 0) return SetBoolProperty(_volumeMode, value);
-    number = 0;
-  }
-  if (number > 10000)
-    return E_FAIL;
-  if (number < minNumber)
-    return E_INVALIDARG;
-  number -= minNumber;
-  for(int j = _methods.Size(); j <= (int)number; j++)
-  {
-    COneMethodInfo oneMethodInfo;
-    _methods.Add(oneMethodInfo);
-  }
-  
-  COneMethodInfo &oneMethodInfo = _methods[number];
-  
-  if (realName.Length() == 0)
-  {
-    if (value.vt != VT_BSTR)
-      return E_INVALIDARG;
-    
-    RINOK(SetParams(oneMethodInfo, value.bstrVal));
-  }
-  else
-  {
-    CProp prop;
-    if (realName.Left(1).CompareNoCase(L"D") == 0)
-    {
-      UInt32 dicSize;
-      RINOK(ParsePropDictionaryValue(realName.Mid(1), value, dicSize));
-      prop.Id = NCoderPropID::kDictionarySize;
-      prop.Value = dicSize;
-      if (number <= mainDicMethodIndex)
-        mainDicSize = dicSize;
-    }
-    else if (realName.Left(1).CompareNoCase(L"C") == 0)
-    {
-      UInt32 blockSize;
-      RINOK(ParsePropDictionaryValue(realName.Mid(1), value, blockSize));
-      prop.Id = NCoderPropID::kBlockSize;
-      prop.Value = blockSize;
-    }
-    else if (realName.Left(3).CompareNoCase(L"MEM") == 0)
-    {
-      UInt32 dicSize;
-      RINOK(ParsePropDictionaryValue(realName.Mid(3), value, dicSize));
-      prop.Id = NCoderPropID::kUsedMemorySize;
-      prop.Value = dicSize;
-      if (number <= mainDicMethodIndex)
-        mainDicSize = dicSize;
-    }
-    else
-    {
-      int index = FindPropIdFromStringName(realName);
-      if (index < 0)
-        return E_INVALIDARG;
-      const CNameToPropID &nameToPropID = g_NameToPropID[index];
-      prop.Id = nameToPropID.PropID;
-      if (!ConvertProperty(value, nameToPropID.VarType, prop.Value))
-        return E_INVALIDARG;
-    }
-    oneMethodInfo.Props.Add(prop);
-  }
-  return S_OK;
-}
-
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/HandlerOut.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/HandlerOut.h
deleted file mode 100644
index 89c81c1..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/HandlerOut.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// HandlerOut.h
-
-#ifndef __HANDLER_OUT_H
-#define __HANDLER_OUT_H
-
-#include "../../../Common/MyString.h"
-#include "../../Common/MethodProps.h"
-
-namespace NArchive {
-
-struct COneMethodInfo
-{
-  CObjectVector<CProp> Props;
-  UString MethodName;
-};
-
-class COutHandler
-{
-public:
-  HRESULT SetProperty(const wchar_t *name, const PROPVARIANT &value);
-  
-  HRESULT SetSolidSettings(const UString &s);
-  HRESULT SetSolidSettings(const PROPVARIANT &value);
-
-  #ifdef COMPRESS_MT
-  UInt32 _numThreads;
-  #endif
-
-  UInt32 _crcSize;
-
-  CObjectVector<COneMethodInfo> _methods;
-  bool _removeSfxBlock;
-  
-  UInt64 _numSolidFiles;
-  UInt64 _numSolidBytes;
-  bool _numSolidBytesDefined;
-  bool _solidExtension;
-
-  bool _compressHeaders;
-  bool _encryptHeadersSpecified;
-  bool _encryptHeaders;
-
-  bool WriteCTime;
-  bool WriteATime;
-  bool WriteMTime;
-
-  bool _autoFilter;
-  UInt32 _level;
-
-  bool _volumeMode;
-
-  HRESULT SetParam(COneMethodInfo &oneMethodInfo, const UString &name, const UString &value);
-  HRESULT SetParams(COneMethodInfo &oneMethodInfo, const UString &srcString);
-
-  void SetCompressionMethod2(COneMethodInfo &oneMethodInfo
-      #ifdef COMPRESS_MT
-      , UInt32 numThreads
-      #endif
-      );
-
-  void InitSolidFiles() { _numSolidFiles = (UInt64)(Int64)(-1); }
-  void InitSolidSize()  { _numSolidBytes = (UInt64)(Int64)(-1); }
-  void InitSolid()
-  {
-    InitSolidFiles();
-    InitSolidSize();
-    _solidExtension = false;
-    _numSolidBytesDefined = false;
-  }
-
-  void Init();
-
-  COutHandler() { Init(); }
-
-  void BeforeSetProperty();
-
-  UInt32 minNumber;
-  UInt32 numProcessors;
-  UInt32 mainDicSize;
-  UInt32 mainDicMethodIndex;
-};
-
-}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/InStreamWithCRC.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/InStreamWithCRC.cpp
deleted file mode 100644
index 1d9e555..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/InStreamWithCRC.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-// InStreamWithCRC.cpp
-
-#include "StdAfx.h"
-
-#include "InStreamWithCRC.h"
-
-STDMETHODIMP CSequentialInStreamWithCRC::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
-  UInt32 realProcessedSize;
-  HRESULT result = _stream->Read(data, size, &realProcessedSize);
-  _size += realProcessedSize;
-  if (size > 0 && realProcessedSize == 0)
-    _wasFinished = true;
-  _crc = CrcUpdate(_crc, data, realProcessedSize);
-  if(processedSize != NULL)
-    *processedSize = realProcessedSize;
-  return result;
-}
-
-STDMETHODIMP CInStreamWithCRC::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
-  UInt32 realProcessedSize;
-  HRESULT result = _stream->Read(data, size, &realProcessedSize);
-  if (size > 0 && realProcessedSize == 0)
-    _wasFinished = true;
-  _size += realProcessedSize;
-  _crc = CrcUpdate(_crc, data, realProcessedSize);
-  if(processedSize != NULL)
-    *processedSize = realProcessedSize;
-  return result;
-}
-
-STDMETHODIMP CInStreamWithCRC::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
-{
-  if (seekOrigin != STREAM_SEEK_SET || offset != 0)
-    return E_FAIL;
-  _size = 0;
-  _crc = CRC_INIT_VAL;
-  return _stream->Seek(offset, seekOrigin, newPosition);
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/InStreamWithCRC.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/InStreamWithCRC.h
deleted file mode 100644
index c5ada6f..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/InStreamWithCRC.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// InStreamWithCRC.h
-
-#ifndef __INSTREAMWITHCRC_H
-#define __INSTREAMWITHCRC_H
-
-#include "../../../Common/MyCom.h"
-#include "../../IStream.h"
-
-extern "C"
-{
-#include "../../../../C/7zCrc.h"
-}
-
-class CSequentialInStreamWithCRC:
-  public ISequentialInStream,
-  public CMyUnknownImp
-{
-public:
-  MY_UNKNOWN_IMP
-
-  STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-private:
-  CMyComPtr<ISequentialInStream> _stream;
-  UInt64 _size;
-  UInt32 _crc;
-  bool _wasFinished;
-public:
-  void SetStream(ISequentialInStream *stream) { _stream = stream;  }
-  void Init()
-  {
-    _size = 0;
-    _wasFinished = false;
-    _crc = CRC_INIT_VAL;
-  }
-  void ReleaseStream() { _stream.Release(); }
-  UInt32 GetCRC() const { return CRC_GET_DIGEST(_crc); }
-  UInt64 GetSize() const { return _size; }
-  bool WasFinished() const { return _wasFinished; }
-};
-
-class CInStreamWithCRC:
-  public IInStream,
-  public CMyUnknownImp
-{
-public:
-  MY_UNKNOWN_IMP1(IInStream)
-
-  STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-  STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
-private:
-  CMyComPtr<IInStream> _stream;
-  UInt64 _size;
-  UInt32 _crc;
-  bool _wasFinished;
-public:
-  void SetStream(IInStream *stream) { _stream = stream;  }
-  void Init()
-  {
-    _size = 0;
-    _wasFinished = false;
-    _crc = CRC_INIT_VAL;
-  }
-  void ReleaseStream() { _stream.Release(); }
-  UInt32 GetCRC() const { return CRC_GET_DIGEST(_crc); }
-  UInt64 GetSize() const { return _size; }
-  bool WasFinished() const { return _wasFinished; }
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/ItemNameUtils.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/ItemNameUtils.cpp
deleted file mode 100644
index 6dfaf98..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/ItemNameUtils.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-// Archive/Common/ItemNameUtils.cpp
-
-#include "StdAfx.h"
-
-#include "ItemNameUtils.h"
-
-namespace NArchive {
-namespace NItemName {
-
-static const wchar_t kOSDirDelimiter = WCHAR_PATH_SEPARATOR;
-static const wchar_t kDirDelimiter = L'/';
-
-UString MakeLegalName(const UString &name)
-{
-  UString zipName = name;
-  zipName.Replace(kOSDirDelimiter, kDirDelimiter);
-  return zipName;
-}
-
-UString GetOSName(const UString &name)
-{
-  UString newName = name;
-  newName.Replace(kDirDelimiter, kOSDirDelimiter);
-  return newName;
-}
-
-UString GetOSName2(const UString &name)
-{
-  if (name.IsEmpty())
-    return UString();
-  UString newName = GetOSName(name);
-  if (newName[newName.Length() - 1] == kOSDirDelimiter)
-    newName.Delete(newName.Length() - 1);
-  return newName;
-}
-
-bool HasTailSlash(const AString &name, UINT codePage)
-{
-  if (name.IsEmpty())
-    return false;
-  LPCSTR prev =
-  #ifdef _WIN32
-    CharPrevExA((WORD)codePage, name, &name[name.Length()], 0);
-  #else
-    (LPCSTR)(name) + (name.Length() - 1);
-  #endif
-  return (*prev == '/');
-}
-
-#ifndef _WIN32
-UString WinNameToOSName(const UString &name)
-{
-  UString newName = name;
-  newName.Replace(L'\\', kOSDirDelimiter);
-  return newName;
-}
-#endif
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/ItemNameUtils.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/ItemNameUtils.h
deleted file mode 100644
index 5eafacb..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/ItemNameUtils.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Archive/Common/ItemNameUtils.h
-
-#ifndef __ARCHIVE_ITEMNAMEUTILS_H
-#define __ARCHIVE_ITEMNAMEUTILS_H
-
-#include "../../../Common/MyString.h"
-
-namespace NArchive {
-namespace NItemName {
-
-  UString MakeLegalName(const UString &name);
-  UString GetOSName(const UString &name);
-  UString GetOSName2(const UString &name);
-  bool HasTailSlash(const AString &name, UINT codePage);
-
-  #ifdef _WIN32
-  inline UString WinNameToOSName(const UString &name)  { return name; }
-  #else
-  UString WinNameToOSName(const UString &name);
-  #endif
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/MultiStream.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/MultiStream.cpp
deleted file mode 100644
index cf7dc05..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/MultiStream.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-// MultiStream.cpp
-
-#include "StdAfx.h"
-
-#include "MultiStream.h"
-
-STDMETHODIMP CMultiStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
-  if(processedSize != NULL)
-    *processedSize = 0;
-  while(_streamIndex < Streams.Size() && size > 0)
-  {
-    CSubStreamInfo &s = Streams[_streamIndex];
-    if (_pos == s.Size)
-    {
-      _streamIndex++;
-      _pos = 0;
-      continue;
-    }
-    RINOK(s.Stream->Seek(s.Pos + _pos, STREAM_SEEK_SET, 0));
-    UInt32 sizeToRead = UInt32(MyMin((UInt64)size, s.Size - _pos));
-    UInt32 realProcessed;
-    HRESULT result = s.Stream->Read(data, sizeToRead, &realProcessed);
-    data = (void *)((Byte *)data + realProcessed);
-    size -= realProcessed;
-    if(processedSize != NULL)
-      *processedSize += realProcessed;
-    _pos += realProcessed;
-    _seekPos += realProcessed;
-    RINOK(result);
-    break;
-  }
-  return S_OK;
-}
-  
-STDMETHODIMP CMultiStream::Seek(Int64 offset, UInt32 seekOrigin,
-    UInt64 *newPosition)
-{
-  UInt64 newPos;
-  switch(seekOrigin)
-  {
-    case STREAM_SEEK_SET:
-      newPos = offset;
-      break;
-    case STREAM_SEEK_CUR:
-      newPos = _seekPos + offset;
-      break;
-    case STREAM_SEEK_END:
-      newPos = _totalLength + offset;
-      break;
-    default:
-      return STG_E_INVALIDFUNCTION;
-  }
-  _seekPos = 0;
-  for (_streamIndex = 0; _streamIndex < Streams.Size(); _streamIndex++)
-  {
-    UInt64 size = Streams[_streamIndex].Size;
-    if (newPos < _seekPos + size)
-    {
-      _pos = newPos - _seekPos;
-      _seekPos += _pos;
-      if (newPosition != 0)
-        *newPosition = newPos;
-      return S_OK;
-    }
-    _seekPos += size;
-  }
-  if (newPos == _seekPos)
-  {
-    if (newPosition != 0)
-      *newPosition = newPos;
-    return S_OK;
-  }
-  return E_FAIL;
-}
-
-
-/*
-class COutVolumeStream:
-  public ISequentialOutStream,
-  public CMyUnknownImp
-{
-  int _volIndex;
-  UInt64 _volSize;
-  UInt64 _curPos;
-  CMyComPtr<ISequentialOutStream> _volumeStream;
-  COutArchive _archive;
-  CCRC _crc;
-
-public:
-  MY_UNKNOWN_IMP
-
-  CFileItem _file;
-  CUpdateOptions _options;
-  CMyComPtr<IArchiveUpdateCallback2> VolumeCallback;
-  void Init(IArchiveUpdateCallback2 *volumeCallback,
-      const UString &name)
-  {
-    _file.Name = name;
-    _file.IsStartPosDefined = true;
-    _file.StartPos = 0;
-    
-    VolumeCallback = volumeCallback;
-    _volIndex = 0;
-    _volSize = 0;
-  }
-  
-  HRESULT Flush();
-  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-
-HRESULT COutVolumeStream::Flush()
-{
-  if (_volumeStream)
-  {
-    _file.UnPackSize = _curPos;
-    _file.FileCRC = _crc.GetDigest();
-    RINOK(WriteVolumeHeader(_archive, _file, _options));
-    _archive.Close();
-    _volumeStream.Release();
-    _file.StartPos += _file.UnPackSize;
-  }
-  return S_OK;
-}
-*/
-
-/*
-STDMETHODIMP COutMultiStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
-  if(processedSize != NULL)
-    *processedSize = 0;
-  while(size > 0)
-  {
-    if (_streamIndex >= Streams.Size())
-    {
-      CSubStreamInfo subStream;
-      RINOK(VolumeCallback->GetVolumeSize(Streams.Size(), &subStream.Size));
-      RINOK(VolumeCallback->GetVolumeStream(Streams.Size(), &subStream.Stream));
-      subStream.Pos = 0;
-      Streams.Add(subStream);
-      continue;
-    }
-    CSubStreamInfo &subStream = Streams[_streamIndex];
-    if (_offsetPos >= subStream.Size)
-    {
-      _offsetPos -= subStream.Size;
-      _streamIndex++;
-      continue;
-    }
-    if (_offsetPos != subStream.Pos)
-    {
-      CMyComPtr<IOutStream> outStream;
-      RINOK(subStream.Stream.QueryInterface(IID_IOutStream, &outStream));
-      RINOK(outStream->Seek(_offsetPos, STREAM_SEEK_SET, NULL));
-      subStream.Pos = _offsetPos;
-    }
-
-    UInt32 curSize = (UInt32)MyMin((UInt64)size, subStream.Size - subStream.Pos);
-    UInt32 realProcessed;
-    RINOK(subStream.Stream->Write(data, curSize, &realProcessed));
-    data = (void *)((Byte *)data + realProcessed);
-    size -= realProcessed;
-    subStream.Pos += realProcessed;
-    _offsetPos += realProcessed;
-    _absPos += realProcessed;
-    if (_absPos > _length)
-      _length = _absPos;
-    if(processedSize != NULL)
-      *processedSize += realProcessed;
-    if (subStream.Pos == subStream.Size)
-    {
-      _streamIndex++;
-      _offsetPos = 0;
-    }
-    if (realProcessed != curSize && realProcessed == 0)
-      return E_FAIL;
-  }
-  return S_OK;
-}
-
-STDMETHODIMP COutMultiStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
-{
-  if(seekOrigin >= 3)
-    return STG_E_INVALIDFUNCTION;
-  switch(seekOrigin)
-  {
-    case STREAM_SEEK_SET:
-      _absPos = offset;
-      break;
-    case STREAM_SEEK_CUR:
-      _absPos += offset;
-      break;
-    case STREAM_SEEK_END:
-      _absPos = _length + offset;
-      break;
-  }
-  _offsetPos = _absPos;
-  _streamIndex = 0;
-  return S_OK;
-}
-*/
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/MultiStream.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/MultiStream.h
deleted file mode 100644
index 137c940..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/MultiStream.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// MultiStream.h
-
-#ifndef __MULTISTREAM_H
-#define __MULTISTREAM_H
-
-#include "../../../Common/MyCom.h"
-#include "../../../Common/MyVector.h"
-#include "../../Archive/IArchive.h"
-
-class CMultiStream:
-  public IInStream,
-  public CMyUnknownImp
-{
-  int _streamIndex;
-  UInt64 _pos;
-  UInt64 _seekPos;
-  UInt64 _totalLength;
-public:
-  struct CSubStreamInfo
-  {
-    CMyComPtr<IInStream> Stream;
-    UInt64 Pos;
-    UInt64 Size;
-  };
-  CObjectVector<CSubStreamInfo> Streams;
-  void Init()
-  {
-    _streamIndex = 0;
-    _pos = 0;
-    _seekPos = 0;
-    _totalLength = 0;
-    for (int i = 0; i < Streams.Size(); i++)
-      _totalLength += Streams[i].Size;
-  }
-
-  MY_UNKNOWN_IMP1(IInStream)
-
-  STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-  STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
-};
-
-/*
-class COutMultiStream:
-  public IOutStream,
-  public CMyUnknownImp
-{
-  int _streamIndex; // required stream
-  UInt64 _offsetPos; // offset from start of _streamIndex index
-  UInt64 _absPos;
-  UInt64 _length;
-
-  struct CSubStreamInfo
-  {
-    CMyComPtr<ISequentialOutStream> Stream;
-    UInt64 Size;
-    UInt64 Pos;
- };
-  CObjectVector<CSubStreamInfo> Streams;
-public:
-  CMyComPtr<IArchiveUpdateCallback2> VolumeCallback;
-  void Init()
-  {
-    _streamIndex = 0;
-    _offsetPos = 0;
-    _absPos = 0;
-    _length = 0;
-  }
-
-  MY_UNKNOWN_IMP1(IOutStream)
-
-  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-  STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
-};
-*/
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp
deleted file mode 100644
index 2ab2da6..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// OutStreamWithCRC.cpp
-
-#include "StdAfx.h"
-
-#include "OutStreamWithCRC.h"
-
-STDMETHODIMP COutStreamWithCRC::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
-  UInt32 realProcessedSize;
-  HRESULT result;
-  if(!_stream)
-  {
-    realProcessedSize = size;
-    result = S_OK;
-  }
-  else
-    result = _stream->Write(data, size, &realProcessedSize);
-  if (_calculate)
-    _crc = CrcUpdate(_crc, data, realProcessedSize);
-  _size += realProcessedSize;
-  if(processedSize != NULL)
-    *processedSize = realProcessedSize;
-  return result;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/OutStreamWithCRC.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/OutStreamWithCRC.h
deleted file mode 100644
index a034ee9..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/OutStreamWithCRC.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// OutStreamWithCRC.h
-
-#ifndef __OUT_STREAM_WITH_CRC_H
-#define __OUT_STREAM_WITH_CRC_H
-
-#include "../../../Common/MyCom.h"
-#include "../../IStream.h"
-
-extern "C"
-{
-#include "../../../../C/7zCrc.h"
-}
-
-class COutStreamWithCRC:
-  public ISequentialOutStream,
-  public CMyUnknownImp
-{
-  CMyComPtr<ISequentialOutStream> _stream;
-  UInt64 _size;
-  UInt32 _crc;
-  bool _calculate;
-public:
-  MY_UNKNOWN_IMP
-  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-  void SetStream(ISequentialOutStream *stream) { _stream = stream; }
-  void ReleaseStream() { _stream.Release(); }
-  void Init(bool calculate = true)
-  {
-    _size = 0;
-    _calculate = calculate;
-    _crc = CRC_INIT_VAL;
-  }
-  void InitCRC() { _crc = CRC_INIT_VAL; }
-  UInt64 GetSize() const { return _size; }
-  UInt32 GetCRC() const { return CRC_GET_DIGEST(_crc); }
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/ParseProperties.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/ParseProperties.cpp
deleted file mode 100644
index 5cd849e..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/ParseProperties.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// ParseProperties.cpp
-
-#include "StdAfx.h"
-
-#include "ParseProperties.h"
-
-#include "Common/StringToInt.h"
-#include "Common/MyCom.h"
-
-HRESULT ParsePropValue(const UString &name, const PROPVARIANT &prop, UInt32 &resValue)
-{
-  if (prop.vt == VT_UI4)
-  {
-    if (!name.IsEmpty())
-      return E_INVALIDARG;
-    resValue = prop.ulVal;
-  }
-  else if (prop.vt == VT_EMPTY)
-  {
-    if(!name.IsEmpty())
-    {
-      const wchar_t *start = name;
-      const wchar_t *end;
-      UInt64 v = ConvertStringToUInt64(start, &end);
-      if (end - start != name.Length())
-        return E_INVALIDARG;
-      resValue = (UInt32)v;
-    }
-  }
-  else
-    return E_INVALIDARG;
-  return S_OK;
-}
-
-static const int kLogarithmicSizeLimit = 32;
-static const wchar_t kByteSymbol = L'B';
-static const wchar_t kKiloByteSymbol = L'K';
-static const wchar_t kMegaByteSymbol = L'M';
-
-HRESULT ParsePropDictionaryValue(const UString &srcStringSpec, UInt32 &dicSize)
-{
-  UString srcString = srcStringSpec;
-  srcString.MakeUpper();
-
-  const wchar_t *start = srcString;
-  const wchar_t *end;
-  UInt64 number = ConvertStringToUInt64(start, &end);
-  int numDigits = (int)(end - start);
-  if (numDigits == 0 || srcString.Length() > numDigits + 1)
-    return E_INVALIDARG;
-  if (srcString.Length() == numDigits)
-  {
-    if (number >= kLogarithmicSizeLimit)
-      return E_INVALIDARG;
-    dicSize = (UInt32)1 << (int)number;
-    return S_OK;
-  }
-  switch (srcString[numDigits])
-  {
-    case kByteSymbol:
-      if (number >= ((UInt64)1 << kLogarithmicSizeLimit))
-        return E_INVALIDARG;
-      dicSize = (UInt32)number;
-      break;
-    case kKiloByteSymbol:
-      if (number >= ((UInt64)1 << (kLogarithmicSizeLimit - 10)))
-        return E_INVALIDARG;
-      dicSize = (UInt32)(number << 10);
-      break;
-    case kMegaByteSymbol:
-      if (number >= ((UInt64)1 << (kLogarithmicSizeLimit - 20)))
-        return E_INVALIDARG;
-      dicSize = (UInt32)(number << 20);
-      break;
-    default:
-      return E_INVALIDARG;
-  }
-  return S_OK;
-}
-
-HRESULT ParsePropDictionaryValue(const UString &name, const PROPVARIANT &prop, UInt32 &resValue)
-{
-  if (name.IsEmpty())
-  {
-    if (prop.vt == VT_UI4)
-    {
-      UInt32 logDicSize = prop.ulVal;
-      if (logDicSize >= 32)
-        return E_INVALIDARG;
-      resValue = (UInt32)1 << logDicSize;
-      return S_OK;
-    }
-    if (prop.vt == VT_BSTR)
-      return ParsePropDictionaryValue(prop.bstrVal, resValue);
-    return E_INVALIDARG;
-  }
-  return ParsePropDictionaryValue(name, resValue);
-}
-
-bool StringToBool(const UString &s, bool &res)
-{
-  if (s.IsEmpty() || s.CompareNoCase(L"ON") == 0 || s.Compare(L"+") == 0)
-  {
-    res = true;
-    return true;
-  }
-  if (s.CompareNoCase(L"OFF") == 0 || s.Compare(L"-") == 0)
-  {
-    res = false;
-    return true;
-  }
-  return false;
-}
-
-HRESULT SetBoolProperty(bool &dest, const PROPVARIANT &value)
-{
-  switch(value.vt)
-  {
-    case VT_EMPTY:
-      dest = true;
-      return S_OK;
-    case VT_BOOL:
-      dest = (value.boolVal != VARIANT_FALSE);
-      return S_OK;
-    /*
-    case VT_UI4:
-      dest = (value.ulVal != 0);
-      break;
-    */
-    case VT_BSTR:
-      return StringToBool(value.bstrVal, dest) ?  S_OK : E_INVALIDARG;
-  }
-  return E_INVALIDARG;
-}
-
-int ParseStringToUInt32(const UString &srcString, UInt32 &number)
-{
-  const wchar_t *start = srcString;
-  const wchar_t *end;
-  UInt64 number64 = ConvertStringToUInt64(start, &end);
-  if (number64 > 0xFFFFFFFF)
-  {
-    number = 0;
-    return 0;
-  }
-  number = (UInt32)number64;
-  return (int)(end - start);
-}
-
-HRESULT ParseMtProp(const UString &name, const PROPVARIANT &prop, UInt32 defaultNumThreads, UInt32 &numThreads)
-{
-  if (name.IsEmpty())
-  {
-    switch(prop.vt)
-    {
-      case VT_UI4:
-        numThreads = prop.ulVal;
-        break;
-      default:
-      {
-        bool val;
-        RINOK(SetBoolProperty(val, prop));
-        numThreads = (val ? defaultNumThreads : 1);
-        break;
-      }
-    }
-  }
-  else
-  {
-    UInt32 number;
-    int index = ParseStringToUInt32(name, number);
-    if (index != name.Length())
-      return E_INVALIDARG;
-    numThreads = number;
-  }
-  return S_OK;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/ParseProperties.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/ParseProperties.h
deleted file mode 100644
index 6f80f63..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/ParseProperties.h
+++ /dev/null
@@ -1,18 +0,0 @@
-// ParseProperties.h
-
-#ifndef __PARSEPROPERTIES_H
-#define __PARSEPROPERTIES_H
-
-#include "Common/MyString.h"
-#include "Common/Types.h"
-
-HRESULT ParsePropValue(const UString &name, const PROPVARIANT &prop, UInt32 &resValue);
-HRESULT ParsePropDictionaryValue(const UString &srcStringSpec, UInt32 &dicSize);
-HRESULT ParsePropDictionaryValue(const UString &name, const PROPVARIANT &prop, UInt32 &resValue);
-
-bool StringToBool(const UString &s, bool &res);
-HRESULT SetBoolProperty(bool &dest, const PROPVARIANT &value);
-int ParseStringToUInt32(const UString &srcString, UInt32 &number);
-HRESULT ParseMtProp(const UString &name, const PROPVARIANT &prop, UInt32 defaultNumThreads, UInt32 &numThreads);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/StdAfx.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/StdAfx.h
deleted file mode 100644
index 2e4be10..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/StdAfx.h
+++ /dev/null
@@ -1,9 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-#include "../../../Common/NewHandler.h"
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/DllExports2.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/DllExports2.cpp
deleted file mode 100644
index 545fcbd..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/DllExports2.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-// DLLExports.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/MyInitGuid.h"
-#include "../../Common/ComTry.h"
-#include "../../Common/Types.h"
-#include "../../Windows/PropVariant.h"
-#if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
-extern "C"
-{
-#include "../../../C/Alloc.h"
-}
-#endif
-
-#include "IArchive.h"
-#include "../ICoder.h"
-#include "../IPassword.h"
-
-HINSTANCE g_hInstance;
-#ifndef _UNICODE
-#ifdef _WIN32
-bool g_IsNT = false;
-static bool IsItWindowsNT()
-{
-  OSVERSIONINFO versionInfo;
-  versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
-  if (!::GetVersionEx(&versionInfo))
-    return false;
-  return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
-}
-#endif
-#endif
-
-extern "C"
-BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
-{
-  if (dwReason == DLL_PROCESS_ATTACH)
-  {
-    g_hInstance = hInstance;
-    #ifndef _UNICODE
-    #ifdef _WIN32
-    g_IsNT = IsItWindowsNT();
-    #endif
-    #endif
-  }
-  return TRUE;
-}
-
-DEFINE_GUID(CLSID_CArchiveHandler,
-0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x00);
-
-static const UInt16 kDecodeId = 0x2790;
-
-DEFINE_GUID(CLSID_CCodec,
-0x23170F69, 0x40C1, kDecodeId, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
-
-STDAPI CreateCoder(const GUID *clsid, const GUID *iid, void **outObject);
-STDAPI CreateArchiver(const GUID *classID, const GUID *iid, void **outObject);
-
-STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
-{
-  // COM_TRY_BEGIN
-  *outObject = 0;
-  if (*iid == IID_ICompressCoder || *iid == IID_ICompressCoder2 || *iid == IID_ICompressFilter)
-  {
-    return CreateCoder(clsid, iid, outObject);
-  }
-  else
-  {
-    return CreateArchiver(clsid, iid, outObject);
-  }
-  // COM_TRY_END
-}
-
-STDAPI SetLargePageMode()
-{
-  #if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
-  SetLargePageSize();
-  #endif
-  return S_OK;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/IArchive.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/IArchive.h
deleted file mode 100644
index 88d6c40..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/IArchive.h
+++ /dev/null
@@ -1,228 +0,0 @@
-// IArchive.h
-
-#ifndef __IARCHIVE_H
-#define __IARCHIVE_H
-
-#include "../IStream.h"
-#include "../IProgress.h"
-#include "../PropID.h"
-
-#define ARCHIVE_INTERFACE_SUB(i, base, x) DECL_INTERFACE_SUB(i, base, 6, x)
-#define ARCHIVE_INTERFACE(i, x) ARCHIVE_INTERFACE_SUB(i, IUnknown, x)
-
-namespace NFileTimeType
-{
-  enum EEnum
-  {
-    kWindows,
-    kUnix,
-    kDOS
-  };
-}
-
-namespace NArchive
-{
-  enum
-  {
-    kName = 0,
-    kClassID,
-    kExtension,
-    kAddExtension,
-    kUpdate,
-    kKeepName,
-    kStartSignature,
-    kFinishSignature,
-    kAssociate
-  };
-
-  namespace NExtract
-  {
-    namespace NAskMode
-    {
-      enum
-      {
-        kExtract = 0,
-        kTest,
-        kSkip
-      };
-    }
-    namespace NOperationResult
-    {
-      enum
-      {
-        kOK = 0,
-        kUnSupportedMethod,
-        kDataError,
-        kCRCError
-      };
-    }
-  }
-  namespace NUpdate
-  {
-    namespace NOperationResult
-    {
-      enum
-      {
-        kOK = 0,
-        kError
-      };
-    }
-  }
-}
-
-#define INTERFACE_IArchiveOpenCallback(x) \
-  STDMETHOD(SetTotal)(const UInt64 *files, const UInt64 *bytes) x; \
-  STDMETHOD(SetCompleted)(const UInt64 *files, const UInt64 *bytes) x; \
-
-ARCHIVE_INTERFACE(IArchiveOpenCallback, 0x10)
-{
-  INTERFACE_IArchiveOpenCallback(PURE);
-};
-
-
-#define INTERFACE_IArchiveExtractCallback(x) \
-  INTERFACE_IProgress(x) \
-  /* GetStream OUT: S_OK - OK, S_FALSE - skeep this file */ \
-  STDMETHOD(GetStream)(UInt32 index, ISequentialOutStream **outStream,  Int32 askExtractMode) x; \
-  STDMETHOD(PrepareOperation)(Int32 askExtractMode) x; \
-  STDMETHOD(SetOperationResult)(Int32 resultEOperationResult) x; \
-
-ARCHIVE_INTERFACE_SUB(IArchiveExtractCallback, IProgress, 0x20)
-{
-  INTERFACE_IArchiveExtractCallback(PURE)
-};
-
-
-#define INTERFACE_IArchiveOpenVolumeCallback(x) \
-  STDMETHOD(GetProperty)(PROPID propID, PROPVARIANT *value) x; \
-  STDMETHOD(GetStream)(const wchar_t *name, IInStream **inStream) x; \
-
-ARCHIVE_INTERFACE(IArchiveOpenVolumeCallback, 0x30)
-{
-  INTERFACE_IArchiveOpenVolumeCallback(PURE);
-};
-
-
-ARCHIVE_INTERFACE(IInArchiveGetStream, 0x40)
-{
-  STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream) PURE;
-};
-
-
-ARCHIVE_INTERFACE(IArchiveOpenSetSubArchiveName, 0x50)
-{
-  STDMETHOD(SetSubArchiveName)(const wchar_t *name) PURE;
-};
-
-
-/*
-IInArchive::Extract:
-  indices must be sorted
-  numItems = 0xFFFFFFFF means "all files"
-  testMode != 0 means "test files without writing to outStream"
-*/
-
-#define INTERFACE_IInArchive(x) \
-  STDMETHOD(Open)(IInStream *stream, const UInt64 *maxCheckStartPosition, IArchiveOpenCallback *openArchiveCallback) x; \
-  STDMETHOD(Close)() x; \
-  STDMETHOD(GetNumberOfItems)(UInt32 *numItems) x; \
-  STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value) x; \
-  STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, Int32 testMode, IArchiveExtractCallback *extractCallback) x; \
-  STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value) x; \
-  STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties) x; \
-  STDMETHOD(GetPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) x; \
-  STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties) x; \
-  STDMETHOD(GetArchivePropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) x;
-
-ARCHIVE_INTERFACE(IInArchive, 0x60)
-{
-  INTERFACE_IInArchive(PURE)
-};
-
-
-#define INTERFACE_IArchiveUpdateCallback(x) \
-  INTERFACE_IProgress(x); \
-  STDMETHOD(GetUpdateItemInfo)(UInt32 index,  \
-      Int32 *newData, /*1 - new data, 0 - old data */ \
-      Int32 *newProperties, /* 1 - new properties, 0 - old properties */ \
-      UInt32 *indexInArchive /* -1 if there is no in archive, or if doesn't matter */ \
-      )  x; \
-  STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value) x; \
-  STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **inStream) x; \
-  STDMETHOD(SetOperationResult)(Int32 operationResult) x; \
-
-ARCHIVE_INTERFACE_SUB(IArchiveUpdateCallback, IProgress, 0x80)
-{
-  INTERFACE_IArchiveUpdateCallback(PURE);
-};
-
-#define INTERFACE_IArchiveUpdateCallback2(x) \
-  INTERFACE_IArchiveUpdateCallback(x) \
-  STDMETHOD(GetVolumeSize)(UInt32 index, UInt64 *size) x; \
-  STDMETHOD(GetVolumeStream)(UInt32 index, ISequentialOutStream **volumeStream) x; \
-
-ARCHIVE_INTERFACE_SUB(IArchiveUpdateCallback2, IArchiveUpdateCallback, 0x82)
-{
-  INTERFACE_IArchiveUpdateCallback2(PURE);
-};
-
-
-#define INTERFACE_IOutArchive(x) \
-  STDMETHOD(UpdateItems)(ISequentialOutStream *outStream, UInt32 numItems, IArchiveUpdateCallback *updateCallback) x; \
-  STDMETHOD(GetFileTimeType)(UInt32 *type) x;
-
-ARCHIVE_INTERFACE(IOutArchive, 0xA0)
-{
-  INTERFACE_IOutArchive(PURE)
-};
-
-
-ARCHIVE_INTERFACE(ISetProperties, 0x03)
-{
-  STDMETHOD(SetProperties)(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties) PURE;
-};
-
-
-#define IMP_IInArchive_GetProp(k) \
-  (UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) \
-    { if(index >= sizeof(k) / sizeof(k[0])) return E_INVALIDARG; \
-    const STATPROPSTG &srcItem = k[index]; \
-    *propID = srcItem.propid; *varType = srcItem.vt; *name = 0; return S_OK; } \
-
-#define IMP_IInArchive_GetProp_WITH_NAME(k) \
-  (UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) \
-    { if(index >= sizeof(k) / sizeof(k[0])) return E_INVALIDARG; \
-    const STATPROPSTG &srcItem = k[index]; \
-    *propID = srcItem.propid; *varType = srcItem.vt; \
-    if (srcItem.lpwstrName == 0) *name = 0; else *name = ::SysAllocString(srcItem.lpwstrName); return S_OK; } \
-
-#define IMP_IInArchive_Props \
-  STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) \
-    { *numProperties = sizeof(kProps) / sizeof(kProps[0]); return S_OK; } \
-  STDMETHODIMP CHandler::GetPropertyInfo IMP_IInArchive_GetProp(kProps)
-
-#define IMP_IInArchive_Props_WITH_NAME \
-  STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) \
-    { *numProperties = sizeof(kProps) / sizeof(kProps[0]); return S_OK; } \
-  STDMETHODIMP CHandler::GetPropertyInfo IMP_IInArchive_GetProp_WITH_NAME(kProps)
-
-
-#define IMP_IInArchive_ArcProps \
-  STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) \
-    { *numProperties = sizeof(kArcProps) / sizeof(kArcProps[0]); return S_OK; } \
-  STDMETHODIMP CHandler::GetArchivePropertyInfo IMP_IInArchive_GetProp(kArcProps)
-
-#define IMP_IInArchive_ArcProps_WITH_NAME \
-  STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) \
-    { *numProperties = sizeof(kArcProps) / sizeof(kArcProps[0]); return S_OK; } \
-  STDMETHODIMP CHandler::GetArchivePropertyInfo IMP_IInArchive_GetProp_WITH_NAME(kArcProps)
-
-#define IMP_IInArchive_ArcProps_NO \
-  STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) \
-    { *numProperties = 0; return S_OK; } \
-  STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32, BSTR *, PROPID *, VARTYPE *) \
-    { return E_NOTIMPL; } \
-  STDMETHODIMP CHandler::GetArchiveProperty(PROPID, PROPVARIANT *value) \
-    { value->vt = VT_EMPTY; return S_OK; }
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Icons/7z.ico b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Icons/7z.ico
deleted file mode 100644
index 319753a..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Icons/7z.ico
+++ /dev/null
Binary files differ
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaArcRegister.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaArcRegister.cpp
deleted file mode 100644
index bbeb177..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaArcRegister.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// LzmaArcRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/RegisterArc.h"
-
-#include "LzmaHandler.h"
-
-static IInArchive *CreateArc() { return new NArchive::NLzma::CHandler;  }
-
-static CArcInfo g_ArcInfo =
-  { L"Lzma", L"lzma lzma86", 0, 0xA, {0 }, 0, true, CreateArc, NULL };
-
-REGISTER_ARC(Lzma)
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaFiltersDecode.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaFiltersDecode.cpp
deleted file mode 100644
index 26c1092..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaFiltersDecode.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-// LzmaFiltersDecode.cpp
-
-#include "StdAfx.h"
-
-#include "LzmaFiltersDecode.h"
-
-namespace NArchive {
-namespace NLzma {
-
-static const UInt64 k_LZMA = 0x030101;
-static const UInt64 k_BCJ = 0x03030103;
-  
-HRESULT CDecoder::Code(
-    DECL_EXTERNAL_CODECS_LOC_VARS
-    const CHeader &block,
-    ISequentialInStream *inStream, ISequentialOutStream *outStream,
-    UInt64 *inProcessedSize, ICompressProgressInfo *progress)
-{
-  *inProcessedSize = (UInt64)(Int64)-1;
-
-  if (block.FilterMethod > 1)
-    return E_NOTIMPL;
-
-  if (!_lzmaDecoder)
-  {
-    RINOK(CreateCoder(EXTERNAL_CODECS_LOC_VARS k_LZMA, _lzmaDecoder, false));
-    if (_lzmaDecoder == 0)
-      return E_NOTIMPL;
-  }
-
-  {
-    CMyComPtr<ICompressSetDecoderProperties2> setDecoderProperties;
-    _lzmaDecoder.QueryInterface(IID_ICompressSetDecoderProperties2, &setDecoderProperties);
-    if (!setDecoderProperties)
-      return E_NOTIMPL;
-    RINOK(setDecoderProperties->SetDecoderProperties2(block.LzmaProps, 5));
-  }
-
-  bool filteredMode = (block.FilterMethod == 1);
-
-  CMyComPtr<ICompressSetOutStream> setOutStream;
-
-  if (filteredMode)
-  {
-    if (!_bcjStream)
-    {
-      CMyComPtr<ICompressCoder> coder;
-      RINOK(CreateCoder(EXTERNAL_CODECS_LOC_VARS k_BCJ, coder, false));
-      if (!coder)
-        return E_NOTIMPL;
-      coder.QueryInterface(IID_ISequentialOutStream, &_bcjStream);
-      if (!_bcjStream)
-        return E_NOTIMPL;
-    }
-
-    _bcjStream.QueryInterface(IID_ICompressSetOutStream, &setOutStream);
-    if (!setOutStream)
-      return E_NOTIMPL;
-    RINOK(setOutStream->SetOutStream(outStream));
-    outStream = _bcjStream;
-  }
-
-  const UInt64 *unpackSize = block.HasUnpackSize() ? &block.UnpackSize : NULL;
-  RINOK(_lzmaDecoder->Code(inStream, outStream, NULL, unpackSize, progress));
-
-  if (filteredMode)
-  {
-    CMyComPtr<IOutStreamFlush> flush;
-    _bcjStream.QueryInterface(IID_IOutStreamFlush, &flush);
-    if (flush)
-    {
-      RINOK(flush->Flush());
-    }
-    RINOK(setOutStream->ReleaseOutStream());
-  }
-
-  CMyComPtr<ICompressGetInStreamProcessedSize> getInStreamProcessedSize;
-  _lzmaDecoder.QueryInterface(IID_ICompressGetInStreamProcessedSize, &getInStreamProcessedSize);
-  if (getInStreamProcessedSize)
-  {
-    RINOK(getInStreamProcessedSize->GetInStreamProcessedSize(inProcessedSize));
-  }
-  return S_OK;
-}
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaFiltersDecode.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaFiltersDecode.h
deleted file mode 100644
index 36de496..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaFiltersDecode.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// LzmaFiltersDecode.h
-
-#ifndef __LZMA_FILTERS_DECODE_H
-#define __LZMA_FILTERS_DECODE_H
-
-#include "../../Common/CreateCoder.h"
-
-#include "LzmaItem.h"
-
-namespace NArchive {
-namespace NLzma {
-
-class CDecoder
-{
-  CMyComPtr<ICompressCoder> _lzmaDecoder;
-  CMyComPtr<ISequentialOutStream> _bcjStream;
-public:
-  HRESULT Code(DECL_EXTERNAL_CODECS_LOC_VARS
-      const CHeader &block,
-      ISequentialInStream *inStream, ISequentialOutStream *outStream,
-      UInt64 *inProcessedSize, ICompressProgressInfo *progress);
-};
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaHandler.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaHandler.cpp
deleted file mode 100644
index c434595..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaHandler.cpp
+++ /dev/null
@@ -1,243 +0,0 @@
-// LzmaHandler.cpp
-
-#include "StdAfx.h"
-
-#include "LzmaHandler.h"
-
-#include "Common/Defs.h"
-#include "Common/StringConvert.h"
-#include "Common/ComTry.h"
-#include "Common/IntToString.h"
-
-#include "Windows/PropVariant.h"
-
-#include "../../Common/ProgressUtils.h"
-#include "../../Common/StreamUtils.h"
-#include "../Common/DummyOutStream.h"
-
-#include "LzmaFiltersDecode.h"
-
-namespace NArchive {
-namespace NLzma {
-
-STATPROPSTG kProps[] =
-{
-  { NULL, kpidSize, VT_UI8},
-  { NULL, kpidPackSize, VT_UI8},
-  { NULL, kpidMethod, VT_UI1}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps_NO
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
-  *numItems = 1;
-  return S_OK;
-}
-
-static void ConvertUInt32ToString(UInt32 value, wchar_t *s)
-{
-  ConvertUInt64ToString(value, s + MyStringLen(s));
-}
-
-static void DictSizeToString(UInt32 value, wchar_t *s)
-{
-  for (int i = 0; i <= 31; i++)
-    if ((UInt32(1) << i) == value)
-    {
-      ConvertUInt32ToString(i, s);
-      return;
-    }
-  wchar_t c = L'b';
-  if ((value & ((1 << 20) - 1)) == 0)
-  {
-    value >>= 20;
-    c = L'm';
-  }
-  else if ((value & ((1 << 10) - 1)) == 0)
-  {
-    value >>= 10;
-    c = L'k';
-  }
-  ConvertUInt32ToString(value, s);
-  int p = MyStringLen(s);
-  s[p++] = c;
-  s[p++] = L'\0';
-}
-
-static void MyStrCat(wchar_t *d, const wchar_t *s)
-{
-  MyStringCopy(d + MyStringLen(d), s);
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID,  PROPVARIANT *value)
-{
-  if (index != 0)
-    return E_INVALIDARG;
-  NWindows::NCOM::CPropVariant propVariant;
-  switch(propID)
-  {
-    case kpidSize:
-      if (m_StreamInfo.HasUnpackSize())
-        propVariant = (UInt64)m_StreamInfo.UnpackSize;
-      break;
-    case kpidPackSize:
-      propVariant = (UInt64)m_PackSize;
-      break;
-    case kpidMethod:
-    {
-      wchar_t s[64];
-      s[0] = '\0';
-      if (m_StreamInfo.IsThereFilter)
-      {
-        const wchar_t *f;
-        if (m_StreamInfo.FilterMethod == 0)
-          f = L"Copy";
-        else if (m_StreamInfo.FilterMethod == 1)
-          f = L"BCJ";
-        else
-          f = L"Unknown";
-        MyStrCat(s, f);
-        MyStrCat(s, L" ");
-      }
-      MyStrCat(s, L"LZMA:");
-      DictSizeToString(m_StreamInfo.GetDicSize(), s);
-      propVariant = s;
-      break;
-    }
-  }
-  propVariant.Detach(value);
-  return S_OK;
-}
-
-STDMETHODIMP CHandler::Open(IInStream *inStream,
-    const UInt64 * /* maxCheckStartPosition */,
-    IArchiveOpenCallback * /* openArchiveCallback */)
-{
-  {
-    RINOK(inStream->Seek(0, STREAM_SEEK_CUR, &m_StreamStartPosition));
-
-    HRESULT res = ReadStreamHeader(inStream, m_StreamInfo);
-    if (res != S_OK)
-      return S_FALSE;
-    
-    Byte b;
-    RINOK(ReadStream_FALSE(inStream, &b, 1));
-    if (b != 0)
-      return S_FALSE;
-
-    UInt64 endPos;
-    RINOK(inStream->Seek(0, STREAM_SEEK_END, &endPos));
-    m_PackSize = endPos - m_StreamStartPosition - m_StreamInfo.GetHeaderSize();
-
-    m_Stream = inStream;
-  }
-  return S_OK;
-}
-
-STDMETHODIMP CHandler::Close()
-{
-  m_Stream.Release();
-  return S_OK;
-}
-
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
-    Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
-  COM_TRY_BEGIN
-  bool allFilesMode = (numItems == UInt32(-1));
-  if (!allFilesMode)
-  {
-    if (numItems == 0)
-      return S_OK;
-    if (numItems != 1)
-      return E_INVALIDARG;
-    if (indices[0] != 0)
-      return E_INVALIDARG;
-  }
-
-  bool testMode = (_aTestMode != 0);
-
-  RINOK(extractCallback->SetTotal(m_PackSize));
-    
-  UInt64 currentTotalPacked = 0;
-
-  CDummyOutStream *outStreamSpec = new CDummyOutStream;
-  CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
-
-  {
-    CMyComPtr<ISequentialOutStream> realOutStream;
-    Int32 askMode = testMode ?
-        NArchive::NExtract::NAskMode::kTest :
-        NArchive::NExtract::NAskMode::kExtract;
-    
-    RINOK(extractCallback->GetStream(0, &realOutStream, askMode));
-
-    outStreamSpec->SetStream(realOutStream);
-    outStreamSpec->Init();
-    if(!testMode && !realOutStream)
-      return S_OK;
-    extractCallback->PrepareOperation(askMode);
-  }
-  
-  CLocalProgress *lps = new CLocalProgress;
-  CMyComPtr<ICompressProgressInfo> progress = lps;
-  lps->Init(extractCallback, true);
-
-  CDecoder decoder;
-  RINOK(m_Stream->Seek(m_StreamStartPosition, STREAM_SEEK_SET, NULL));
-  UInt64 streamPos = m_StreamStartPosition;
-  Int32 opRes = NArchive::NExtract::NOperationResult::kOK;
-  bool firstItem = true;
-  for (;;)
-  {
-    CHeader st;
-    HRESULT result = ReadStreamHeader(m_Stream, st);
-    if (result != S_OK)
-    {
-      if (firstItem)
-        return E_FAIL;
-      break;
-    }
-    firstItem = false;
-
-    lps->OutSize = outStreamSpec->GetSize();
-    lps->InSize = currentTotalPacked;
-    RINOK(lps->SetCur());
-    
-    streamPos += st.GetHeaderSize();
-    UInt64 packProcessed;
-
-    {
-      result = decoder.Code(
-          EXTERNAL_CODECS_VARS
-          st, m_Stream, outStream, &packProcessed, progress);
-      if (result == E_NOTIMPL)
-      {
-        opRes = NArchive::NExtract::NOperationResult::kUnSupportedMethod;
-        break;
-      }
-      if (result == S_FALSE)
-      {
-        opRes = NArchive::NExtract::NOperationResult::kDataError;
-        break;
-      }
-      RINOK(result);
-    }
-
-    if (packProcessed == (UInt64)(Int64)-1)
-      break;
-    RINOK(m_Stream->Seek(streamPos + packProcessed, STREAM_SEEK_SET, NULL));
-    currentTotalPacked += packProcessed;
-    streamPos += packProcessed;
-  }
-  outStream.Release();
-  return extractCallback->SetOperationResult(opRes);
-  COM_TRY_END
-}
-
-IMPL_ISetCompressCodecsInfo
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaHandler.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaHandler.h
deleted file mode 100644
index e8fdced..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaHandler.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// Lzma/Handler.h
-
-#ifndef __GZIP_HANDLER_H
-#define __GZIP_HANDLER_H
-
-#include "Common/MyCom.h"
-
-#include "../IArchive.h"
-#include "../../Common/CreateCoder.h"
-
-#include "LzmaIn.h"
-
-namespace NArchive {
-namespace NLzma {
-
-// const UInt64 k_LZMA = 0x030101;
-
-class CHandler:
-  public IInArchive,
-  PUBLIC_ISetCompressCodecsInfo
-  public CMyUnknownImp
-{
-public:
-  MY_QUERYINTERFACE_BEGIN
-  MY_QUERYINTERFACE_ENTRY(IInArchive)
-  QUERY_ENTRY_ISetCompressCodecsInfo
-  MY_QUERYINTERFACE_END
-  MY_ADDREF_RELEASE
-
-  STDMETHOD(Open)(IInStream *inStream,
-      const UInt64 *maxCheckStartPosition,
-      IArchiveOpenCallback *openArchiveCallback);
-  STDMETHOD(Close)();
-  
-  STDMETHOD(GetNumberOfItems)(UInt32 *numItems);
-  STDMETHOD(GetProperty)(UInt32 index, PROPID propID,  PROPVARIANT *value);
-  STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems,
-      Int32 testMode, IArchiveExtractCallback *extractCallback);
-
-  STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value);
-
-  STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties);
-  STDMETHOD(GetPropertyInfo)(UInt32 index,
-      BSTR *name, PROPID *propID, VARTYPE *varType);
-
-  STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties);
-  STDMETHOD(GetArchivePropertyInfo)(UInt32 index,
-      BSTR *name, PROPID *propID, VARTYPE *varType);
-
-  UString GetMethodString();
-public:
-  CHandler() {  }
-
-private:
-  CHeader m_StreamInfo;
-  UInt64 m_StreamStartPosition;
-  UInt64 m_PackSize;
-
-  CMyComPtr<IInStream> m_Stream;
-
-  DECL_EXTERNAL_CODECS_VARS
-
-  DECL_ISetCompressCodecsInfo
-
-};
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaIn.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaIn.cpp
deleted file mode 100644
index 342b01e..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaIn.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-// Archive/LzmaIn.cpp
-
-#include "StdAfx.h"
-
-#include "LzmaIn.h"
-
-#include "../../Common/StreamUtils.h"
-
-namespace NArchive {
-namespace NLzma {
- 
-static bool CheckDictSize(const Byte *p)
-{
-  UInt32 dicSize = GetUi32(p);
-  int i;
-  for (i = 1; i <= 30; i++)
-    if (dicSize == ((UInt32)2 << i) || dicSize == ((UInt32)3 << i))
-      return true;
-  return false;
-}
-
-HRESULT ReadStreamHeader(ISequentialInStream *inStream, CHeader &block)
-{
-  Byte sig[5 + 9];
-  RINOK(ReadStream_FALSE(inStream, sig, 5 + 8));
-
-  const Byte kMaxProp0Val = 5 * 5 * 9 - 1;
-  if (sig[0] > kMaxProp0Val)
-    return S_FALSE;
-
-  for (int i = 0; i < 5; i++)
-    block.LzmaProps[i] = sig[i];
-  
-  block.IsThereFilter = false;
-  block.FilterMethod = 0;
-
-  if (!CheckDictSize(sig + 1))
-  {
-    if (sig[0] > 1 || sig[1] > kMaxProp0Val)
-      return S_FALSE;
-    block.IsThereFilter = true;
-    block.FilterMethod = sig[0];
-    for (int i = 0; i < 5; i++)
-      block.LzmaProps[i] = sig[i + 1];
-    if (!CheckDictSize(block.LzmaProps + 1))
-      return S_FALSE;
-    RINOK(ReadStream_FALSE(inStream, sig + 5 + 8, 1));
-  }
-  UInt32 unpOffset = 5 + (block.IsThereFilter ? 1 : 0);
-  block.UnpackSize = GetUi64(sig + unpOffset);
-  if (block.HasUnpackSize() && block.UnpackSize >= ((UInt64)1 << 56))
-    return S_FALSE;
-  return S_OK;
-}
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaIn.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaIn.h
deleted file mode 100644
index 6f237f2..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaIn.h
+++ /dev/null
@@ -1,16 +0,0 @@
-// Archive/LzmaIn.h
-
-#ifndef __ARCHIVE_LZMA_IN_H
-#define __ARCHIVE_LZMA_IN_H
-
-#include "LzmaItem.h"
-#include "../../IStream.h"
-
-namespace NArchive {
-namespace NLzma {
-
-HRESULT ReadStreamHeader(ISequentialInStream *inStream, CHeader &st);
-
-}}
-  
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaItem.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaItem.h
deleted file mode 100644
index 8fcae21..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/LzmaItem.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Archive/LzmaItem.h
-
-#ifndef __ARCHIVE_LZMA_ITEM_H
-#define __ARCHIVE_LZMA_ITEM_H
-
-#include "Common/Types.h"
-
-#include "../../../../C/CpuArch.h"
-
-namespace NArchive {
-namespace NLzma {
-
-struct CHeader
-{
-  UInt64 UnpackSize;
-  bool IsThereFilter;
-  Byte FilterMethod;
-  Byte LzmaProps[5];
-
-  UInt32 GetDicSize() const { return GetUi32(LzmaProps + 1); }
-  bool HasUnpackSize() const { return (UnpackSize != (UInt64)(Int64)-1);  }
-  unsigned GetHeaderSize() const { return 5 + 8 + (IsThereFilter ? 1 : 0); }
-};
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/StdAfx.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/StdAfx.h
deleted file mode 100644
index e7fb698..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Lzma/StdAfx.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Split/SplitHandler.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Split/SplitHandler.cpp
deleted file mode 100644
index 61b7f4a..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Split/SplitHandler.cpp
+++ /dev/null
@@ -1,357 +0,0 @@
-// SplitHandler.cpp
-
-#include "StdAfx.h"
-
-#include "Common/ComTry.h"
-#include "Common/Defs.h"
-#include "Common/NewHandler.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/PropVariant.h"
-#include "Windows/Time.h"
-
-#include "../../Common/ProgressUtils.h"
-
-#include "../../Compress/CopyCoder.h"
-
-#include "../Common/ItemNameUtils.h"
-#include "../Common/MultiStream.h"
-
-#include "SplitHandler.h"
-
-using namespace NWindows;
-using namespace NTime;
-
-namespace NArchive {
-namespace NSplit {
-
-STATPROPSTG kProps[] =
-{
-  { NULL, kpidPath, VT_BSTR},
-  { NULL, kpidSize, VT_UI8},
-  { NULL, kpidPackSize, VT_UI8},
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps_NO
-
-class CSeqName
-{
-public:
-  UString _unchangedPart;
-  UString _changedPart;
-  bool _splitStyle;
-  UString GetNextName()
-  {
-    UString newName;
-    if (_splitStyle)
-    {
-      int i;
-      int numLetters = _changedPart.Length();
-      for (i = numLetters - 1; i >= 0; i--)
-      {
-        wchar_t c = _changedPart[i];
-        if (c == 'z')
-        {
-          c = 'a';
-          newName = c + newName;
-          continue;
-        }
-        else if (c == 'Z')
-        {
-          c = 'A';
-          newName = c + newName;
-          continue;
-        }
-        c++;
-        if ((c == 'z' || c == 'Z') && i == 0)
-        {
-          _unchangedPart += c;
-          wchar_t newChar = (c == 'z') ? L'a' : L'A';
-          newName.Empty();
-          numLetters++;
-          for (int k = 0; k < numLetters; k++)
-            newName += newChar;
-          break;
-        }
-        newName = c + newName;
-        i--;
-        for (; i >= 0; i--)
-          newName = _changedPart[i] + newName;
-        break;
-      }
-    }
-    else
-    {
-      int i;
-      int numLetters = _changedPart.Length();
-      for (i = numLetters - 1; i >= 0; i--)
-      {
-        wchar_t c = _changedPart[i];
-        if (c == L'9')
-        {
-          c = L'0';
-          newName = c + newName;
-          if (i == 0)
-            newName = UString(L'1') + newName;
-          continue;
-        }
-        c++;
-        newName = c + newName;
-        i--;
-        for (; i >= 0; i--)
-          newName = _changedPart[i] + newName;
-        break;
-      }
-    }
-    _changedPart = newName;
-    return _unchangedPart + _changedPart;
-  }
-};
-
-STDMETHODIMP CHandler::Open(IInStream *stream,
-    const UInt64 * /* maxCheckStartPosition */,
-    IArchiveOpenCallback *openArchiveCallback)
-{
-  COM_TRY_BEGIN
-  Close();
-  if (openArchiveCallback == 0)
-    return S_FALSE;
-  // try
-  {
-    CMyComPtr<IArchiveOpenVolumeCallback> openVolumeCallback;
-    CMyComPtr<IArchiveOpenCallback> openArchiveCallbackWrap = openArchiveCallback;
-    if (openArchiveCallbackWrap.QueryInterface(IID_IArchiveOpenVolumeCallback,
-        &openVolumeCallback) != S_OK)
-      return S_FALSE;
-    
-    {
-      NCOM::CPropVariant prop;
-      RINOK(openVolumeCallback->GetProperty(kpidName, &prop));
-      if (prop.vt != VT_BSTR)
-        return S_FALSE;
-      _name = prop.bstrVal;
-    }
-    
-    int dotPos = _name.ReverseFind('.');
-    UString prefix, ext;
-    if (dotPos >= 0)
-    {
-      prefix = _name.Left(dotPos + 1);
-      ext = _name.Mid(dotPos + 1);
-    }
-    else
-      ext = _name;
-    UString extBig = ext;
-    extBig.MakeUpper();
-
-    CSeqName seqName;
-
-    int numLetters = 2;
-    bool splitStyle = false;
-    if (extBig.Right(2) == L"AA")
-    {
-      splitStyle = true;
-      while (numLetters < extBig.Length())
-      {
-        if (extBig[extBig.Length() - numLetters - 1] != 'A')
-          break;
-        numLetters++;
-      }
-    }
-    else if (ext.Right(2) == L"01")
-    {
-      while (numLetters < extBig.Length())
-      {
-        if (extBig[extBig.Length() - numLetters - 1] != '0')
-          break;
-        numLetters++;
-      }
-      if (numLetters != ext.Length())
-        return S_FALSE;
-    }
-    else
-      return S_FALSE;
-
-    _streams.Add(stream);
-
-    seqName._unchangedPart = prefix + ext.Left(extBig.Length() - numLetters);
-    seqName._changedPart = ext.Right(numLetters);
-    seqName._splitStyle = splitStyle;
-
-    if (prefix.Length() < 1)
-      _subName = L"file";
-    else
-      _subName = prefix.Left(prefix.Length() - 1);
-
-    _totalSize = 0;
-    UInt64 size;
-    {
-      NCOM::CPropVariant prop;
-      RINOK(openVolumeCallback->GetProperty(kpidSize, &prop));
-      if (prop.vt != VT_UI8)
-        return E_INVALIDARG;
-      size = prop.uhVal.QuadPart;
-    }
-    _totalSize += size;
-    _sizes.Add(size);
-    
-    if (openArchiveCallback != NULL)
-    {
-      UInt64 numFiles = _streams.Size();
-      RINOK(openArchiveCallback->SetCompleted(&numFiles, NULL));
-    }
-
-    for (;;)
-    {
-      UString fullName = seqName.GetNextName();
-      CMyComPtr<IInStream> nextStream;
-      HRESULT result = openVolumeCallback->GetStream(fullName, &nextStream);
-      if (result == S_FALSE)
-        break;
-      if (result != S_OK)
-        return result;
-      if (!stream)
-        break;
-      {
-        NCOM::CPropVariant prop;
-        RINOK(openVolumeCallback->GetProperty(kpidSize, &prop));
-        if (prop.vt != VT_UI8)
-          return E_INVALIDARG;
-        size = prop.uhVal.QuadPart;
-      }
-      _totalSize += size;
-      _sizes.Add(size);
-      _streams.Add(nextStream);
-      if (openArchiveCallback != NULL)
-      {
-        UInt64 numFiles = _streams.Size();
-        RINOK(openArchiveCallback->SetCompleted(&numFiles, NULL));
-      }
-    }
-  }
-  /*
-  catch(...)
-  {
-    return S_FALSE;
-  }
-  */
-  return S_OK;
-  COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
-  _sizes.Clear();
-  _streams.Clear();
-  return S_OK;
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
-  *numItems = _streams.IsEmpty() ? 0 : 1;
-  return S_OK;
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 /* index */, PROPID propID, PROPVARIANT *value)
-{
-  NWindows::NCOM::CPropVariant prop;
-  switch(propID)
-  {
-    case kpidPath:
-      prop = _subName;
-      break;
-    case kpidSize:
-    case kpidPackSize:
-      prop = _totalSize;
-      break;
-  }
-  prop.Detach(value);
-  return S_OK;
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
-    Int32 _aTestMode, IArchiveExtractCallback *_anExtractCallback)
-{
-  COM_TRY_BEGIN
-
-  if (numItems != UInt32(-1))
-  {
-    if (numItems != 1)
-      return E_INVALIDARG;
-    if (indices[0] != 0)
-      return E_INVALIDARG;
-  }
-  bool testMode = (_aTestMode != 0);
-  CMyComPtr<IArchiveExtractCallback> extractCallback = _anExtractCallback;
-  extractCallback->SetTotal(_totalSize);
-  
-  /*
-  CMyComPtr<IArchiveVolumeExtractCallback> volumeExtractCallback;
-  if (extractCallback.QueryInterface(&volumeExtractCallback) != S_OK)
-    return E_FAIL;
-  */
-
-  UInt64 currentTotalSize = 0;
-  UInt64 currentItemSize;
-
-  RINOK(extractCallback->SetCompleted(&currentTotalSize));
-  CMyComPtr<ISequentialOutStream> realOutStream;
-  Int32 askMode;
-  askMode = testMode ? NArchive::NExtract::NAskMode::kTest :
-  NArchive::NExtract::NAskMode::kExtract;
-  Int32 index = 0;
-  RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
-  
-  RINOK(extractCallback->PrepareOperation(askMode));
-  if (testMode)
-  {
-    RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
-    return S_OK;
-  }
-  
-  if (!testMode && (!realOutStream))
-    return S_OK;
-
-  NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder;
-  CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-
-  CLocalProgress *lps = new CLocalProgress;
-  CMyComPtr<ICompressProgressInfo> progress = lps;
-  lps->Init(extractCallback, false);
-
-  for (int i = 0; i < _streams.Size(); i++, currentTotalSize += currentItemSize)
-  {
-    lps->InSize = lps->OutSize = currentTotalSize;
-    RINOK(lps->SetCur());
-    IInStream *inStream = _streams[i];
-    RINOK(inStream->Seek(0, STREAM_SEEK_SET, NULL));
-    RINOK(copyCoder->Code(inStream, realOutStream, NULL, NULL, progress));
-    currentItemSize = copyCoderSpec->TotalSize;
-  }
-  realOutStream.Release();
-  return extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK);
-  COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
-{
-  if (index != 0)
-    return E_INVALIDARG;
-  *stream = 0;
-  CMultiStream *streamSpec = new CMultiStream;
-  CMyComPtr<ISequentialInStream> streamTemp = streamSpec;
-  for (int i = 0; i < _streams.Size(); i++)
-  {
-    CMultiStream::CSubStreamInfo subStreamInfo;
-    subStreamInfo.Stream = _streams[i];
-    subStreamInfo.Pos = 0;
-    subStreamInfo.Size = _sizes[i];
-    streamSpec->Streams.Add(subStreamInfo);
-  }
-  streamSpec->Init();
-  *stream = streamTemp.Detach();
-  return S_OK;
-}
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Split/SplitHandler.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Split/SplitHandler.h
deleted file mode 100644
index 9e02076..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Split/SplitHandler.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Split/Handler.h
-
-#ifndef __SPLIT_HANDLER_H
-#define __SPLIT_HANDLER_H
-
-#include "Common/MyCom.h"
-#include "Common/MyString.h"
-#include "../IArchive.h"
-
-namespace NArchive {
-namespace NSplit {
-
-class CHandler:
-  public IInArchive,
-  public IInArchiveGetStream,
-  // public IOutArchive,
-  public CMyUnknownImp
-{
-public:
-  MY_UNKNOWN_IMP2(IInArchive, IInArchiveGetStream)
-
-  INTERFACE_IInArchive(;)
-
-  STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream);
-
-private:
-  UString _subName;
-  UString _name;
-  CObjectVector<CMyComPtr<IInStream> > _streams;
-  CRecordVector<UInt64> _sizes;
-
-  UInt64 _totalSize;
-};
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Split/SplitHandlerOut.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Split/SplitHandlerOut.cpp
deleted file mode 100644
index 6edf86f..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Split/SplitHandlerOut.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-// Split/OutHandler.cpp
-
-#include "StdAfx.h"
-
-#include "SplitHandler.h"
-#include "../../../Windows/PropVariant.h"
-#include "../../../Common/ComTry.h"
-#include "../../../Common/StringToInt.h"
-
-using namespace NWindows;
-
-namespace NArchive {
-namespace NSplit {
-
-/*
-STDMETHODIMP CHandler::GetFileTimeType(UInt32 *type)
-{
-  *type = NFileTimeType::kWindows;
-  return S_OK;
-}
-
-STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numItems,
-    IArchiveUpdateCallback *updateCallback)
-{
-  COM_TRY_BEGIN
-
-  if (numItems != 1)
-    return E_INVALIDARG;
-
-  UInt64 volumeSize = 0;
-
-  CMyComPtr<IArchiveUpdateCallback2> callback2;
-  updateCallback->QueryInterface(IID_IArchiveUpdateCallback2,
-      (void **)&callback2);
-
-  RINOK(callback2->GetVolumeSize(0, &volumeSize));
-
-  Int32 newData;
-  Int32 newProperties;
-  UInt32 indexInArchive;
-  if (!updateCallback)
-    return E_FAIL;
-
-  UInt32 fileIndex = 0;
-  RINOK(updateCallback->GetUpdateItemInfo(fileIndex,
-    &newData, &newProperties, &indexInArchive));
-
-  if (newProperties != 0)
-  {
-    {
-      NCOM::CPropVariant prop;
-      RINOK(updateCallback->GetProperty(fileIndex, kpidIsFolder, &prop));
-      if (prop.vt == VT_EMPTY)
-      {
-      }
-      else if (prop.vt != VT_BOOL)
-        return E_INVALIDARG;
-      else
-      {
-        if (prop.boolVal != VARIANT_FALSE)
-          return E_INVALIDARG;
-      }
-    }
-    {
-      NCOM::CPropVariant prop;
-      RINOK(updateCallback->GetProperty(fileIndex, kpidIsAnti, &prop));
-      if (prop.vt == VT_EMPTY)
-      {
-      }
-      else if (prop.vt != VT_BOOL)
-        return E_INVALIDARG;
-      else
-      {
-        if (prop.boolVal != VARIANT_FALSE)
-          return E_INVALIDARG;
-      }
-    }
-  }
-  UInt64 newSize;
-  bool thereIsCopyData = false;
-  if (newData != 0)
-  {
-    NCOM::CPropVariant prop;
-    RINOK(updateCallback->GetProperty(fileIndex, kpidSize, &prop));
-    if (prop.vt != VT_UI8)
-      return E_INVALIDARG;
-    newSize = prop.uhVal.QuadPart;
-  }
-  else
-    thereIsCopyData = true;
-
-  UInt64 pos = 0;
-  while(pos < newSize)
-  {
-
-  }
-  return S_OK;
-  COM_TRY_END
-}
-*/
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Split/SplitRegister.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Split/SplitRegister.cpp
deleted file mode 100644
index 56ddba2..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Split/SplitRegister.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-// SplitRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/RegisterArc.h"
-
-#include "SplitHandler.h"
-static IInArchive *CreateArc() { return new NArchive::NSplit::CHandler;  }
-/*
-#ifndef EXTRACT_ONLY
-static IOutArchive *CreateArcOut() { return new NArchive::NSplit::CHandler;  }
-#else
-#define CreateArcOut 0
-#endif
-*/
-
-static CArcInfo g_ArcInfo =
-{ L"Split", L"001", 0, 0xEA, { 0 }, 0, false, CreateArc, 0 };
-
-REGISTER_ARC(Split)
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Split/StdAfx.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/Split/StdAfx.h
deleted file mode 100644
index e7fb698..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/Split/StdAfx.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Archive/StdAfx.h b/third_party/lzma/v4_65/files/CPP/7zip/Archive/StdAfx.h
deleted file mode 100644
index ef555ec..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Archive/StdAfx.h
+++ /dev/null
@@ -1,9 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../Common/MyWindows.h"
-#include "../../Common/NewHandler.h"
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Alone7z/Alone.dsp b/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Alone7z/Alone.dsp
deleted file mode 100644
index b435649..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Alone7z/Alone.dsp
+++ /dev/null
@@ -1,1361 +0,0 @@
-# Microsoft Developer Studio Project File - Name="Alone" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Alone - Win32 DebugU
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "Alone.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "Alone.mak" CFG="Alone - Win32 DebugU"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "Alone - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "Alone - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE "Alone - Win32 ReleaseU" (based on "Win32 (x86) Console Application")
-!MESSAGE "Alone - Win32 DebugU" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "Alone - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /Gz /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /D "_NO_CRYPTO" /D "BREAK_HANDLER" /D "BENCH_MT" /Yu"StdAfx.h" /FD /c
-# ADD BASE RSC /l 0x419 /d "NDEBUG"
-# ADD RSC /l 0x419 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"c:\UTIL\7zr.exe" /opt:NOWIN98
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF  "$(CFG)" == "Alone - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /D "_NO_CRYPTO" /D "BREAK_HANDLER" /D "BENCH_MT" /Yu"StdAfx.h" /FD /GZ /c
-# ADD BASE RSC /l 0x419 /d "_DEBUG"
-# ADD RSC /l 0x419 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"c:\UTIL\7zr.exe" /pdbtype:sept
-
-!ELSEIF  "$(CFG)" == "Alone - Win32 ReleaseU"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "ReleaseU"
-# PROP BASE Intermediate_Dir "ReleaseU"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "ReleaseU"
-# PROP Intermediate_Dir "ReleaseU"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_PAT" /D "COMPRESS_MF_BT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /Yu"StdAfx.h" /FD /c
-# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /D "_NO_CRYPTO" /D "BREAK_HANDLER" /D "BENCH_MT" /Yu"StdAfx.h" /FD /c
-# ADD BASE RSC /l 0x419 /d "NDEBUG"
-# ADD RSC /l 0x419 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"c:\UTIL\7za.exe" /opt:NOWIN98
-# SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"c:\UTIL\7zr.exe" /opt:NOWIN98
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF  "$(CFG)" == "Alone - Win32 DebugU"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "DebugU"
-# PROP BASE Intermediate_Dir "DebugU"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "DebugU"
-# PROP Intermediate_Dir "DebugU"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_PAT" /D "COMPRESS_MF_BT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /D "_MBCS" /Yu"StdAfx.h" /FD /GZ /c
-# ADD CPP /nologo /Gz /W4 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /D "_NO_CRYPTO" /D "BREAK_HANDLER" /D "BENCH_MT" /Yu"StdAfx.h" /FD /GZ /c
-# ADD BASE RSC /l 0x419 /d "_DEBUG"
-# ADD RSC /l 0x419 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"c:\UTIL\7za.exe" /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"c:\UTIL\7zr.exe" /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "Alone - Win32 Release"
-# Name "Alone - Win32 Debug"
-# Name "Alone - Win32 ReleaseU"
-# Name "Alone - Win32 DebugU"
-# Begin Group "Console"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\UI\Console\ArError.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Console\CompressionMode.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Console\ConsoleClose.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Console\ConsoleClose.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Console\ExtractCallbackConsole.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Console\ExtractCallbackConsole.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Console\List.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Console\List.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Console\Main.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Console\MainAr.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Console\OpenCallbackConsole.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Console\OpenCallbackConsole.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Console\PercentPrinter.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Console\PercentPrinter.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Console\UpdateCallbackConsole.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Console\UpdateCallbackConsole.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Console\UserInputUtils.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Console\UserInputUtils.h
-# End Source File
-# End Group
-# Begin Group "Spec"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\resource.rc
-# End Source File
-# Begin Source File
-
-SOURCE=.\StdAfx.cpp
-# ADD CPP /Yc"StdAfx.h"
-# End Source File
-# Begin Source File
-
-SOURCE=.\StdAfx.h
-# End Source File
-# End Group
-# Begin Group "Common"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\..\Common\AutoPtr.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\Buffer.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\CommandLineParser.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\CommandLineParser.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\ComTry.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\CRC.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\Defs.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\DynamicBuffer.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\IntToString.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\IntToString.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\ListFileUtils.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\ListFileUtils.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyCom.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyException.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyGuidDef.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyInitGuid.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyString.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyString.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyUnknown.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyVector.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyVector.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyWindows.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyWindows.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\NewHandler.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\NewHandler.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\Random.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\Random.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\StdInStream.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\StdInStream.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\StdOutStream.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\StdOutStream.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\StringConvert.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\StringConvert.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\StringToInt.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\StringToInt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\Types.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\UTFConvert.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\UTFConvert.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\Wildcard.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\Wildcard.h
-# End Source File
-# End Group
-# Begin Group "Windows"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\..\Windows\Defs.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\Device.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\DLL.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\DLL.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\Error.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\Error.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileDir.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileDir.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileFind.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileFind.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileIO.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileIO.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileName.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileName.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\Handle.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\MemoryLock.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\MemoryLock.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\PropVariant.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\PropVariant.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\PropVariantConversions.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\PropVariantConversions.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\Synchronization.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\Synchronization.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\System.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\System.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\Thread.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\Time.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\Time.h
-# End Source File
-# End Group
-# Begin Group "7zip Common"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Common\CreateCoder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\CreateCoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\CrossThreadProgress.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\CrossThreadProgress.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\FilePathAutoRename.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\FilePathAutoRename.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\FileStreams.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\FileStreams.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\FilterCoder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\FilterCoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\InBuffer.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\InBuffer.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\InOutTempBuffer.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\InOutTempBuffer.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\LimitedStreams.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\LimitedStreams.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\LockedStream.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\LockedStream.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\MethodId.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\MethodId.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\MethodProps.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\MethodProps.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\OffsetStream.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\OffsetStream.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\OutBuffer.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\OutBuffer.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\ProgressMt.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\ProgressMt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\ProgressUtils.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\ProgressUtils.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\RegisterArc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\RegisterCodec.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\StreamBinder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\StreamBinder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\StreamObjects.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\StreamObjects.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\StreamUtils.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\StreamUtils.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\VirtThread.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\VirtThread.h
-# End Source File
-# End Group
-# Begin Group "Compress"
-
-# PROP Default_Filter ""
-# Begin Group "LZMA_Alone"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Compress\LZMA_Alone\LzmaBench.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\LZMA_Alone\LzmaBench.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\LZMA_Alone\LzmaBenchCon.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\LZMA_Alone\LzmaBenchCon.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=..\..\Compress\Bcj2Coder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\Bcj2Coder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\Bcj2Register.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\BcjCoder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\BcjCoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\BcjRegister.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\BranchCoder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\BranchCoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\BranchMisc.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\BranchMisc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\BranchRegister.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\ByteSwap.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\ByteSwap.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\ByteSwapRegister.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\CopyCoder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\CopyCoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\CopyRegister.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\LzmaDecoder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\LzmaDecoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\LzmaEncoder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\LzmaEncoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\LzmaRegister.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\RangeCoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\RangeCoderBit.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\RangeCoderBitTree.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\RangeCoderOpt.h
-# End Source File
-# End Group
-# Begin Group "Archive"
-
-# PROP Default_Filter ""
-# Begin Group "7z"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zCompressionMode.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zCompressionMode.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zDecode.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zDecode.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zEncode.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zEncode.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zExtract.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zFolderInStream.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zFolderInStream.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zFolderOutStream.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zFolderOutStream.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zHandler.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zHandler.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zHandlerOut.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zHeader.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zHeader.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zIn.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zIn.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zItem.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zOut.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zOut.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zProperties.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zProperties.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zRegister.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zSpecStream.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zSpecStream.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zUpdate.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zUpdate.h
-# End Source File
-# End Group
-# Begin Group "Archive Common"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\CoderMixer2.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\CoderMixer2.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\CoderMixer2MT.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\CoderMixer2MT.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\DummyOutStream.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\DummyOutStream.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\HandlerOut.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\HandlerOut.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\InStreamWithCRC.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\InStreamWithCRC.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\ItemNameUtils.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\ItemNameUtils.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\MultiStream.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\MultiStream.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\OutStreamWithCRC.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\OutStreamWithCRC.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\ParseProperties.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\ParseProperties.h
-# End Source File
-# End Group
-# Begin Group "split"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Archive\Split\SplitHandler.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Split\SplitHandler.h
-# End Source File
-# End Group
-# Begin Group "LZM"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Archive\Lzma\LzmaArcRegister.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Lzma\LzmaFiltersDecode.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Lzma\LzmaFiltersDecode.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Lzma\LzmaHandler.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Lzma\LzmaHandler.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Lzma\LzmaIn.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Lzma\LzmaIn.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Lzma\LzmaItem.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "UI Common"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\UI\Common\ArchiveCommandLine.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\ArchiveCommandLine.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\ArchiveExtractCallback.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\ArchiveExtractCallback.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\ArchiveOpenCallback.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\ArchiveOpenCallback.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\DefaultName.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\DefaultName.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\EnumDirItems.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\EnumDirItems.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\Extract.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\Extract.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\ExtractingFilePath.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\ExtractingFilePath.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\LoadCodecs.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\LoadCodecs.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\OpenArchive.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\OpenArchive.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\Property.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\PropIDUtils.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\PropIDUtils.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\SetProperties.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\SetProperties.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\SortUtils.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\SortUtils.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\TempFiles.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\TempFiles.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\Update.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\Update.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\UpdateAction.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\UpdateAction.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\UpdateCallback.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\UpdateCallback.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\UpdatePair.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\UpdatePair.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\UpdateProduce.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\UpdateProduce.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\WorkDir.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\WorkDir.h
-# End Source File
-# End Group
-# Begin Group "7-zip"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\ICoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\IMyUnknown.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\IPassword.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\IProgress.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\IStream.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\PropID.h
-# End Source File
-# End Group
-# Begin Group "C"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\..\..\C\7zCrc.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\7zCrc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Alloc.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Alloc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Bra.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Bra.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Bra86.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\BraIA64.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\IStream.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzFind.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzFind.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzFindMt.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzFindMt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Compress\Lz\LzHash.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzHash.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzmaDec.c
-
-!IF  "$(CFG)" == "Alone - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF  "$(CFG)" == "Alone - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF  "$(CFG)" == "Alone - Win32 ReleaseU"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF  "$(CFG)" == "Alone - Win32 DebugU"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF 
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzmaDec.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzmaEnc.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzmaEnc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Threads.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Threads.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Types.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Alone7z/Alone.dsw b/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Alone7z/Alone.dsw
deleted file mode 100644
index 65eca43..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Alone7z/Alone.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "Alone"=.\Alone.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Alone7z/StdAfx.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Alone7z/StdAfx.cpp
deleted file mode 100644
index d0feea8..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Alone7z/StdAfx.cpp
+++ /dev/null
@@ -1,3 +0,0 @@
-// StdAfx.cpp
-
-#include "StdAfx.h"
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Alone7z/StdAfx.h b/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Alone7z/StdAfx.h
deleted file mode 100644
index 2e4be10..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Alone7z/StdAfx.h
+++ /dev/null
@@ -1,9 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-#include "../../../Common/NewHandler.h"
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Alone7z/makefile b/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Alone7z/makefile
deleted file mode 100644
index d255af7..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Alone7z/makefile
+++ /dev/null
@@ -1,212 +0,0 @@
-PROG = 7za.exe
-LIBS = $(LIBS) user32.lib oleaut32.lib Advapi32.lib
-
-CFLAGS = $(CFLAGS) -I ../../../ \
-  -D_NO_CRYPTO \
-  -DWIN_LONG_PATH \
-  -DCOMPRESS_MT \
-  -DCOMPRESS_MF_MT \
-  -D_NO_CRYPTO \
-  -DBREAK_HANDLER \
-  -DBENCH_MT \
-
-
-CONSOLE_OBJS = \
-  $O\ConsoleClose.obj \
-  $O\ExtractCallbackConsole.obj \
-  $O\List.obj \
-  $O\Main.obj \
-  $O\MainAr.obj \
-  $O\OpenCallbackConsole.obj \
-  $O\PercentPrinter.obj \
-  $O\UpdateCallbackConsole.obj \
-  $O\UserInputUtils.obj \
-
-COMMON_OBJS = \
-  $O\CommandLineParser.obj \
-  $O\CRC.obj \
-  $O\IntToString.obj \
-  $O\ListFileUtils.obj \
-  $O\NewHandler.obj \
-  $O\StdInStream.obj \
-  $O\StdOutStream.obj \
-  $O\MyString.obj \
-  $O\StringConvert.obj \
-  $O\StringToInt.obj \
-  $O\UTFConvert.obj \
-  $O\MyVector.obj \
-  $O\Wildcard.obj \
-
-WIN_OBJS = \
-  $O\DLL.obj \
-  $O\Error.obj \
-  $O\FileDir.obj \
-  $O\FileFind.obj \
-  $O\FileIO.obj \
-  $O\FileName.obj \
-  $O\MemoryLock.obj \
-  $O\PropVariant.obj \
-  $O\PropVariantConversions.obj \
-  $O\Synchronization.obj \
-  $O\System.obj \
-  $O\Time.obj \
-
-7ZIP_COMMON_OBJS = \
-  $O\CreateCoder.obj \
-  $O\FilePathAutoRename.obj \
-  $O\FileStreams.obj \
-  $O\InBuffer.obj \
-  $O\InOutTempBuffer.obj \
-  $O\FilterCoder.obj \
-  $O\LimitedStreams.obj \
-  $O\LockedStream.obj \
-  $O\MethodId.obj \
-  $O\MethodProps.obj \
-  $O\OffsetStream.obj \
-  $O\OutBuffer.obj \
-  $O\ProgressUtils.obj \
-  $O\StreamBinder.obj \
-  $O\StreamObjects.obj \
-  $O\StreamUtils.obj \
-  $O\VirtThread.obj \
-
-UI_COMMON_OBJS = \
-  $O\ArchiveCommandLine.obj \
-  $O\ArchiveExtractCallback.obj \
-  $O\ArchiveOpenCallback.obj \
-  $O\DefaultName.obj \
-  $O\EnumDirItems.obj \
-  $O\Extract.obj \
-  $O\ExtractingFilePath.obj \
-  $O\LoadCodecs.obj \
-  $O\OpenArchive.obj \
-  $O\PropIDUtils.obj \
-  $O\SetProperties.obj \
-  $O\SortUtils.obj \
-  $O\TempFiles.obj \
-  $O\Update.obj \
-  $O\UpdateAction.obj \
-  $O\UpdateCallback.obj \
-  $O\UpdatePair.obj \
-  $O\UpdateProduce.obj \
-  $O\WorkDir.obj \
-
-AR_COMMON_OBJS = \
-  $O\CoderMixer2.obj \
-  $O\CoderMixer2MT.obj \
-  $O\CrossThreadProgress.obj \
-  $O\DummyOutStream.obj \
-  $O\HandlerOut.obj \
-  $O\InStreamWithCRC.obj \
-  $O\ItemNameUtils.obj \
-  $O\MultiStream.obj \
-  $O\OutStreamWithCRC.obj \
-  $O\ParseProperties.obj \
-
-
-7Z_OBJS = \
-  $O\7zCompressionMode.obj \
-  $O\7zDecode.obj \
-  $O\7zEncode.obj \
-  $O\7zExtract.obj \
-  $O\7zFolderInStream.obj \
-  $O\7zFolderOutStream.obj \
-  $O\7zHandler.obj \
-  $O\7zHandlerOut.obj \
-  $O\7zHeader.obj \
-  $O\7zIn.obj \
-  $O\7zOut.obj \
-  $O\7zProperties.obj \
-  $O\7zRegister.obj \
-  $O\7zSpecStream.obj \
-  $O\7zUpdate.obj \
-
-LZM_OBJS = \
-  $O\LzmaArcRegister.obj \
-  $O\LzmaFiltersDecode.obj \
-  $O\LzmaHandler.obj \
-  $O\LzmaIn.obj \
-
-SPLIT_OBJS = \
-  $O\SplitHandler.obj \
-  $O\SplitHandlerOut.obj \
-  $O\SplitRegister.obj \
-
-COMPRESS_OBJS = \
-  $O\Bcj2Coder.obj \
-  $O\Bcj2Register.obj \
-  $O\BcjCoder.obj \
-  $O\BcjRegister.obj \
-  $O\BranchCoder.obj \
-  $O\BranchMisc.obj \
-  $O\BranchRegister.obj \
-  $O\ByteSwap.obj \
-  $O\ByteSwapRegister.obj \
-  $O\CopyCoder.obj \
-  $O\CopyRegister.obj \
-  $O\LzmaDecoder.obj \
-  $O\LzmaEncoder.obj \
-  $O\LzmaRegister.obj \
-
-LZMA_BENCH_OBJS = \
-  $O\LzmaBench.obj \
-  $O\LzmaBenchCon.obj \
-
-C_OBJS = \
-  $O\7zCrc.obj \
-  $O\Bra.obj \
-  $O\Bra86.obj \
-  $O\BraIA64.obj \
-  $O\Alloc.obj \
-  $O\LzmaDec.obj \
-  $O\LzmaEnc.obj \
-  $O\LzFind.obj \
-  $O\LzFindMt.obj \
-  $O\Threads.obj \
-
-OBJS = \
-  $O\StdAfx.obj \
-  $(CONSOLE_OBJS) \
-  $(COMMON_OBJS) \
-  $(WIN_OBJS) \
-  $(7ZIP_COMMON_OBJS) \
-  $(UI_COMMON_OBJS) \
-  $(AR_COMMON_OBJS) \
-  $(7Z_OBJS) \
-  $(LZM_OBJS) \
-  $(SPLIT_OBJS) \
-  $(COMPRESS_OBJS) \
-  $(LZMA_BENCH_OBJS) \
-  $(C_OBJS) \
-  $(CRC_OBJS) \
-  $O\resource.res
-
-
-!include "../../../Build.mak"
-
-$(CONSOLE_OBJS): ../../UI/Console/$(*B).cpp
-	$(COMPL)
-
-$(COMMON_OBJS): ../../../Common/$(*B).cpp
-	$(COMPL)
-$(WIN_OBJS): ../../../Windows/$(*B).cpp
-	$(COMPL)
-$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
-	$(COMPL)
-$(UI_COMMON_OBJS): ../../UI/Common/$(*B).cpp
-	$(COMPL)
-$(AR_COMMON_OBJS): ../../Archive/Common/$(*B).cpp
-	$(COMPL)
-
-$(7Z_OBJS): ../../Archive/7z/$(*B).cpp
-	$(COMPL)
-$(LZM_OBJS): ../../Archive/Lzma/$(*B).cpp
-	$(COMPL)
-$(SPLIT_OBJS): ../../Archive/Split/$(*B).cpp
-	$(COMPL)
-$(COMPRESS_OBJS): ../../Compress/$(*B).cpp
-	$(COMPL_O2)
-$(LZMA_BENCH_OBJS): ../../Compress/LZMA_Alone/$(*B).cpp
-	$(COMPL)
-$(C_OBJS): ../../../../C/$(*B).c
-	$(COMPL_O2)
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Alone7z/resource.rc b/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Alone7z/resource.rc
deleted file mode 100644
index fc9063c..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Alone7z/resource.rc
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "../../MyVersionInfo.rc"
-
-MY_VERSION_INFO_APP("7-Zip Standalone Console", "7za")
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zExtractR/StdAfx.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zExtractR/StdAfx.cpp
deleted file mode 100644
index d0feea8..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zExtractR/StdAfx.cpp
+++ /dev/null
@@ -1,3 +0,0 @@
-// StdAfx.cpp
-
-#include "StdAfx.h"
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zExtractR/StdAfx.h b/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zExtractR/StdAfx.h
deleted file mode 100644
index 2e4be10..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zExtractR/StdAfx.h
+++ /dev/null
@@ -1,9 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-#include "../../../Common/NewHandler.h"
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zExtractR/makefile b/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zExtractR/makefile
deleted file mode 100644
index f544083..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zExtractR/makefile
+++ /dev/null
@@ -1,128 +0,0 @@
-PROG = 7zxr.dll
-DEF_FILE = ../../Archive/Archive2.def
-LIBS = $(LIBS) user32.lib oleaut32.lib
-CFLAGS = $(CFLAGS) -I ../../../ \
-  -DEXTRACT_ONLY \
-  -DCOMPRESS_MT \
-  -D_NO_CRYPTO
-
-COMMON_OBJS = \
-  $O\CRC.obj \
-  $O\IntToString.obj \
-  $O\NewHandler.obj \
-  $O\MyString.obj \
-  $O\StringConvert.obj \
-  $O\StringToInt.obj \
-  $O\MyVector.obj \
-  $O\Wildcard.obj \
-
-WIN_OBJS = \
-  $O\FileDir.obj \
-  $O\FileFind.obj \
-  $O\FileIO.obj \
-  $O\PropVariant.obj \
-  $O\Synchronization.obj \
-  $O\System.obj \
-
-7ZIP_COMMON_OBJS = \
-  $O\CreateCoder.obj \
-  $O\InBuffer.obj \
-  $O\InOutTempBuffer.obj \
-  $O\FilterCoder.obj \
-  $O\LimitedStreams.obj \
-  $O\LockedStream.obj \
-  $O\MethodId.obj \
-  $O\MethodProps.obj \
-  $O\OutBuffer.obj \
-  $O\ProgressUtils.obj \
-  $O\StreamBinder.obj \
-  $O\StreamObjects.obj \
-  $O\StreamUtils.obj \
-  $O\VirtThread.obj \
-
-AR_OBJS = \
-  $O\ArchiveExports.obj \
-  $O\DllExports2.obj \
-
-AR_COMMON_OBJS = \
-  $O\CoderMixer2.obj \
-  $O\CoderMixer2MT.obj \
-  $O\CrossThreadProgress.obj \
-  $O\HandlerOut.obj \
-  $O\ItemNameUtils.obj \
-  $O\OutStreamWithCRC.obj \
-  $O\ParseProperties.obj \
-
-
-7Z_OBJS = \
-  $O\7zCompressionMode.obj \
-  $O\7zDecode.obj \
-  $O\7zExtract.obj \
-  $O\7zFolderOutStream.obj \
-  $O\7zHandler.obj \
-  $O\7zHeader.obj \
-  $O\7zIn.obj \
-  $O\7zProperties.obj \
-  $O\7zRegister.obj \
-
-
-COMPRESS_OBJS = \
-  $O\CodecExports.obj \
-  $O\Bcj2Coder.obj \
-  $O\Bcj2Register.obj \
-  $O\BcjCoder.obj \
-  $O\BcjRegister.obj \
-  $O\BranchCoder.obj \
-  $O\BranchMisc.obj \
-  $O\BranchRegister.obj \
-  $O\ByteSwap.obj \
-  $O\ByteSwapRegister.obj \
-  $O\CopyCoder.obj \
-  $O\CopyRegister.obj \
-  $O\LzmaDecoder.obj \
-  $O\LzmaRegister.obj \
-
-C_OBJS = \
-  $O\7zCrc.obj \
-  $O\Alloc.obj \
-  $O\Bra.obj \
-  $O\Bra86.obj \
-  $O\BraIA64.obj \
-  $O\LzmaDec.obj \
-  $O\Threads.obj \
-
-OBJS = \
-  $O\StdAfx.obj \
-  $(CONSOLE_OBJS) \
-  $(COMMON_OBJS) \
-  $(WIN_OBJS) \
-  $(7ZIP_COMMON_OBJS) \
-  $(AR_OBJS) \
-  $(AR_COMMON_OBJS) \
-  $(7Z_OBJS) \
-  $(COMPRESS_OBJS) \
-  $(C_OBJS) \
-  $O\resource.res
-
-
-!include "../../../Build.mak"
-
-$(COMMON_OBJS): ../../../Common/$(*B).cpp
-	$(COMPL)
-$(WIN_OBJS): ../../../Windows/$(*B).cpp
-	$(COMPL)
-$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
-	$(COMPL)
-$(AR_OBJS): ../../Archive/$(*B).cpp
-	$(COMPL)
-$(AR_COMMON_OBJS): ../../Archive/Common/$(*B).cpp
-	$(COMPL)
-
-$(7Z_OBJS): ../../Archive/7z/$(*B).cpp
-	$(COMPL)
-
-$(COMPRESS_OBJS): ../../Compress/$(*B).cpp
-	$(COMPL_O2)
-
-$(C_OBJS): ../../../../C/$(*B).c
-	$(COMPL_O2)
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zExtractR/resource.rc b/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zExtractR/resource.rc
deleted file mode 100644
index eb63698..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zExtractR/resource.rc
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "../../MyVersionInfo.rc"
-
-MY_VERSION_INFO_DLL("7z Standalone Extracting Plugin", "7zxr")
-
-101  ICON  "../../Archive/Icons/7z.ico"
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zR/StdAfx.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zR/StdAfx.cpp
deleted file mode 100644
index d0feea8..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zR/StdAfx.cpp
+++ /dev/null
@@ -1,3 +0,0 @@
-// StdAfx.cpp
-
-#include "StdAfx.h"
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zR/StdAfx.h b/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zR/StdAfx.h
deleted file mode 100644
index 2e4be10..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zR/StdAfx.h
+++ /dev/null
@@ -1,9 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-#include "../../../Common/NewHandler.h"
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zR/makefile b/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zR/makefile
deleted file mode 100644
index b103f2a..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zR/makefile
+++ /dev/null
@@ -1,139 +0,0 @@
-PROG = 7zra.dll
-DEF_FILE = ../../Archive/Archive2.def
-LIBS = $(LIBS) user32.lib oleaut32.lib
-CFLAGS = $(CFLAGS) -I ../../../ \
-  -DCOMPRESS_MT \
-  -DCOMPRESS_MF_MT \
-  -D_NO_CRYPTO
-
-COMMON_OBJS = \
-  $O\CRC.obj \
-  $O\IntToString.obj \
-  $O\NewHandler.obj \
-  $O\MyString.obj \
-  $O\StringConvert.obj \
-  $O\StringToInt.obj \
-  $O\MyVector.obj \
-  $O\Wildcard.obj \
-
-WIN_OBJS = \
-  $O\FileDir.obj \
-  $O\FileFind.obj \
-  $O\FileIO.obj \
-  $O\PropVariant.obj \
-  $O\Synchronization.obj \
-  $O\System.obj \
-
-7ZIP_COMMON_OBJS = \
-  $O\CreateCoder.obj \
-  $O\InBuffer.obj \
-  $O\InOutTempBuffer.obj \
-  $O\FilterCoder.obj \
-  $O\LimitedStreams.obj \
-  $O\LockedStream.obj \
-  $O\MethodId.obj \
-  $O\MethodProps.obj \
-  $O\OutBuffer.obj \
-  $O\ProgressUtils.obj \
-  $O\StreamBinder.obj \
-  $O\StreamObjects.obj \
-  $O\StreamUtils.obj \
-  $O\VirtThread.obj \
-
-AR_OBJS = \
-  $O\ArchiveExports.obj \
-  $O\DllExports2.obj \
-
-AR_COMMON_OBJS = \
-  $O\CoderMixer2.obj \
-  $O\CoderMixer2MT.obj \
-  $O\CrossThreadProgress.obj \
-  $O\HandlerOut.obj \
-  $O\InStreamWithCRC.obj \
-  $O\ItemNameUtils.obj \
-  $O\OutStreamWithCRC.obj \
-  $O\ParseProperties.obj \
-
-
-7Z_OBJS = \
-  $O\7zCompressionMode.obj \
-  $O\7zDecode.obj \
-  $O\7zEncode.obj \
-  $O\7zExtract.obj \
-  $O\7zFolderInStream.obj \
-  $O\7zFolderOutStream.obj \
-  $O\7zHandler.obj \
-  $O\7zHandlerOut.obj \
-  $O\7zHeader.obj \
-  $O\7zIn.obj \
-  $O\7zOut.obj \
-  $O\7zProperties.obj \
-  $O\7zSpecStream.obj \
-  $O\7zUpdate.obj \
-  $O\7zRegister.obj \
-
-
-COMPRESS_OBJS = \
-  $O\CodecExports.obj \
-  $O\Bcj2Coder.obj \
-  $O\Bcj2Register.obj \
-  $O\BcjCoder.obj \
-  $O\BcjRegister.obj \
-  $O\BranchCoder.obj \
-  $O\BranchMisc.obj \
-  $O\BranchRegister.obj \
-  $O\ByteSwap.obj \
-  $O\ByteSwapRegister.obj \
-  $O\CopyCoder.obj \
-  $O\CopyRegister.obj \
-  $O\LzmaDecoder.obj \
-  $O\LzmaEncoder.obj \
-  $O\LzmaRegister.obj \
-
-C_OBJS = \
-  $O\7zCrc.obj \
-  $O\Alloc.obj \
-  $O\Bra.obj \
-  $O\Bra86.obj \
-  $O\BraIA64.obj \
-  $O\LzFind.obj \
-  $O\LzFindMt.obj \
-  $O\LzmaDec.obj \
-  $O\LzmaEnc.obj \
-  $O\Threads.obj \
-
-OBJS = \
-  $O\StdAfx.obj \
-  $(CONSOLE_OBJS) \
-  $(COMMON_OBJS) \
-  $(WIN_OBJS) \
-  $(7ZIP_COMMON_OBJS) \
-  $(AR_OBJS) \
-  $(AR_COMMON_OBJS) \
-  $(7Z_OBJS) \
-  $(COMPRESS_OBJS) \
-  $(C_OBJS) \
-  $O\resource.res
-
-
-!include "../../../Build.mak"
-
-$(COMMON_OBJS): ../../../Common/$(*B).cpp
-	$(COMPL)
-$(WIN_OBJS): ../../../Windows/$(*B).cpp
-	$(COMPL)
-$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
-	$(COMPL)
-$(AR_OBJS): ../../Archive/$(*B).cpp
-	$(COMPL)
-$(AR_COMMON_OBJS): ../../Archive/Common/$(*B).cpp
-	$(COMPL)
-
-$(7Z_OBJS): ../../Archive/7z/$(*B).cpp
-	$(COMPL)
-
-$(COMPRESS_OBJS): ../../Compress/$(*B).cpp
-	$(COMPL_O2)
-
-$(C_OBJS): ../../../../C/$(*B).c
-	$(COMPL_O2)
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zR/resource.rc b/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zR/resource.rc
deleted file mode 100644
index f9c1768..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Bundles/Format7zR/resource.rc
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "../../MyVersionInfo.rc"
-
-MY_VERSION_INFO_DLL("7z Standalone Plugin", "7zr")
-
-101  ICON  "../../Archive/Icons/7z.ico"
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/CreateCoder.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Common/CreateCoder.cpp
deleted file mode 100644
index 2742495..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/CreateCoder.cpp
+++ /dev/null
@@ -1,292 +0,0 @@
-// CreateCoder.cpp
-
-#include "StdAfx.h"
-
-#include "CreateCoder.h"
-
-#include "../../Windows/PropVariant.h"
-#include "../../Windows/Defs.h"
-#include "FilterCoder.h"
-#include "RegisterCodec.h"
-
-static const unsigned int kNumCodecsMax = 64;
-unsigned int g_NumCodecs = 0;
-const CCodecInfo *g_Codecs[kNumCodecsMax];
-void RegisterCodec(const CCodecInfo *codecInfo)
-{
-  if (g_NumCodecs < kNumCodecsMax)
-    g_Codecs[g_NumCodecs++] = codecInfo;
-}
-
-#ifdef EXTERNAL_CODECS
-static HRESULT ReadNumberOfStreams(ICompressCodecsInfo *codecsInfo, UInt32 index, PROPID propID, UInt32 &res)
-{
-  NWindows::NCOM::CPropVariant prop;
-  RINOK(codecsInfo->GetProperty(index, propID, &prop));
-  if (prop.vt == VT_EMPTY)
-    res = 1;
-  else if (prop.vt == VT_UI4)
-    res = prop.ulVal;
-  else
-    return E_INVALIDARG;
-  return S_OK;
-}
-
-static HRESULT ReadIsAssignedProp(ICompressCodecsInfo *codecsInfo, UInt32 index, PROPID propID, bool &res)
-{
-  NWindows::NCOM::CPropVariant prop;
-  RINOK(codecsInfo->GetProperty(index, propID, &prop));
-  if (prop.vt == VT_EMPTY)
-    res = true;
-  else if (prop.vt == VT_BOOL)
-    res = VARIANT_BOOLToBool(prop.boolVal);
-  else
-    return E_INVALIDARG;
-  return S_OK;
-}
-
-HRESULT LoadExternalCodecs(ICompressCodecsInfo *codecsInfo, CObjectVector<CCodecInfoEx> &externalCodecs)
-{
-  UInt32 num;
-  RINOK(codecsInfo->GetNumberOfMethods(&num));
-  for (UInt32 i = 0; i < num; i++)
-  {
-    CCodecInfoEx info;
-    NWindows::NCOM::CPropVariant prop;
-    RINOK(codecsInfo->GetProperty(i, NMethodPropID::kID, &prop));
-    // if (prop.vt != VT_BSTR)
-    // info.Id.IDSize = (Byte)SysStringByteLen(prop.bstrVal);
-    // memmove(info.Id.ID, prop.bstrVal, info.Id.IDSize);
-    if (prop.vt != VT_UI8)
-    {
-      continue; // old Interface
-      // return E_INVALIDARG;
-    }
-    info.Id = prop.uhVal.QuadPart;
-    prop.Clear();
-    
-    RINOK(codecsInfo->GetProperty(i, NMethodPropID::kName, &prop));
-    if (prop.vt == VT_BSTR)
-      info.Name = prop.bstrVal;
-    else if (prop.vt != VT_EMPTY)
-      return E_INVALIDARG;;
-    
-    RINOK(ReadNumberOfStreams(codecsInfo, i, NMethodPropID::kInStreams, info.NumInStreams));
-    RINOK(ReadNumberOfStreams(codecsInfo, i, NMethodPropID::kOutStreams, info.NumOutStreams));
-    RINOK(ReadIsAssignedProp(codecsInfo, i, NMethodPropID::kEncoderIsAssigned, info.EncoderIsAssigned));
-    RINOK(ReadIsAssignedProp(codecsInfo, i, NMethodPropID::kDecoderIsAssigned, info.DecoderIsAssigned));
-    
-    externalCodecs.Add(info);
-  }
-  return S_OK;
-}
-
-#endif
-
-bool FindMethod(
-  #ifdef EXTERNAL_CODECS
-  ICompressCodecsInfo * /* codecsInfo */, const CObjectVector<CCodecInfoEx> *externalCodecs,
-  #endif
-  const UString &name,
-  CMethodId &methodId, UInt32 &numInStreams, UInt32 &numOutStreams)
-{
-  UInt32 i;
-  for (i = 0; i < g_NumCodecs; i++)
-  {
-    const CCodecInfo &codec = *g_Codecs[i];
-    if (name.CompareNoCase(codec.Name) == 0)
-    {
-      methodId = codec.Id;
-      numInStreams = codec.NumInStreams;
-      numOutStreams = 1;
-      return true;
-    }
-  }
-  #ifdef EXTERNAL_CODECS
-  if (externalCodecs)
-    for (i = 0; i < (UInt32)externalCodecs->Size(); i++)
-    {
-      const CCodecInfoEx &codec = (*externalCodecs)[i];
-      if (codec.Name.CompareNoCase(name) == 0)
-      {
-        methodId = codec.Id;
-        numInStreams = codec.NumInStreams;
-        numOutStreams = codec.NumOutStreams;
-        return true;
-      }
-    }
-  #endif
-  return false;
-}
-
-bool FindMethod(
-  #ifdef EXTERNAL_CODECS
-  ICompressCodecsInfo * /* codecsInfo */, const CObjectVector<CCodecInfoEx> *externalCodecs,
-  #endif
-  CMethodId methodId, UString &name)
-{
-  UInt32 i;
-  for (i = 0; i < g_NumCodecs; i++)
-  {
-    const CCodecInfo &codec = *g_Codecs[i];
-    if (methodId == codec.Id)
-    {
-      name = codec.Name;
-      return true;
-    }
-  }
-  #ifdef EXTERNAL_CODECS
-  if (externalCodecs)
-    for (i = 0; i < (UInt32)externalCodecs->Size(); i++)
-    {
-      const CCodecInfoEx &codec = (*externalCodecs)[i];
-      if (methodId == codec.Id)
-      {
-        name = codec.Name;
-        return true;
-      }
-    }
-  #endif
-  return false;
-}
-
-HRESULT CreateCoder(
-  DECL_EXTERNAL_CODECS_LOC_VARS
-  CMethodId methodId,
-  CMyComPtr<ICompressFilter> &filter,
-  CMyComPtr<ICompressCoder> &coder,
-  CMyComPtr<ICompressCoder2> &coder2,
-  bool encode, bool onlyCoder)
-{
-  bool created = false;
-  UInt32 i;
-  for (i = 0; i < g_NumCodecs; i++)
-  {
-    const CCodecInfo &codec = *g_Codecs[i];
-    if (codec.Id == methodId)
-    {
-      if (encode)
-      {
-        if (codec.CreateEncoder)
-        {
-          void *p = codec.CreateEncoder();
-          if (codec.IsFilter) filter = (ICompressFilter *)p;
-          else if (codec.NumInStreams == 1) coder = (ICompressCoder *)p;
-          else coder2 = (ICompressCoder2 *)p;
-          created = (p != 0);
-          break;
-        }
-      }
-      else
-        if (codec.CreateDecoder)
-        {
-          void *p = codec.CreateDecoder();
-          if (codec.IsFilter) filter = (ICompressFilter *)p;
-          else if (codec.NumInStreams == 1) coder = (ICompressCoder *)p;
-          else coder2 = (ICompressCoder2 *)p;
-          created = (p != 0);
-          break;
-        }
-    }
-  }
-
-  #ifdef EXTERNAL_CODECS
-  if (!created && externalCodecs)
-    for (i = 0; i < (UInt32)externalCodecs->Size(); i++)
-    {
-      const CCodecInfoEx &codec = (*externalCodecs)[i];
-      if (codec.Id == methodId)
-      {
-        if (encode)
-        {
-          if (codec.EncoderIsAssigned)
-          {
-            if (codec.IsSimpleCodec())
-            {
-              HRESULT result = codecsInfo->CreateEncoder(i, &IID_ICompressCoder, (void **)&coder);
-              if (result != S_OK && result != E_NOINTERFACE && result != CLASS_E_CLASSNOTAVAILABLE)
-                return result;
-              if (!coder)
-              {
-                RINOK(codecsInfo->CreateEncoder(i, &IID_ICompressFilter, (void **)&filter));
-              }
-            }
-            else
-            {
-              RINOK(codecsInfo->CreateEncoder(i, &IID_ICompressCoder2, (void **)&coder2));
-            }
-            break;
-          }
-        }
-        else
-          if (codec.DecoderIsAssigned)
-          {
-            if (codec.IsSimpleCodec())
-            {
-              HRESULT result = codecsInfo->CreateDecoder(i, &IID_ICompressCoder, (void **)&coder);
-              if (result != S_OK && result != E_NOINTERFACE && result != CLASS_E_CLASSNOTAVAILABLE)
-                return result;
-              if (!coder)
-              {
-                RINOK(codecsInfo->CreateDecoder(i, &IID_ICompressFilter, (void **)&filter));
-              }
-            }
-            else
-            {
-              RINOK(codecsInfo->CreateDecoder(i, &IID_ICompressCoder2, (void **)&coder2));
-            }
-            break;
-          }
-      }
-    }
-  #endif
-
-  if (onlyCoder && filter)
-  {
-    CFilterCoder *coderSpec = new CFilterCoder;
-    coder = coderSpec;
-    coderSpec->Filter = filter;
-  }
-  return S_OK;
-}
-
-HRESULT CreateCoder(
-  DECL_EXTERNAL_CODECS_LOC_VARS
-  CMethodId methodId,
-  CMyComPtr<ICompressCoder> &coder,
-  CMyComPtr<ICompressCoder2> &coder2,
-  bool encode)
-{
-  CMyComPtr<ICompressFilter> filter;
-  return CreateCoder(
-    EXTERNAL_CODECS_LOC_VARS
-    methodId,
-    filter, coder, coder2, encode, true);
-}
-
-HRESULT CreateCoder(
-  DECL_EXTERNAL_CODECS_LOC_VARS
-  CMethodId methodId,
-  CMyComPtr<ICompressCoder> &coder, bool encode)
-{
-  CMyComPtr<ICompressFilter> filter;
-  CMyComPtr<ICompressCoder2> coder2;
-  return CreateCoder(
-    EXTERNAL_CODECS_LOC_VARS
-    methodId,
-    coder, coder2, encode);
-}
-
-HRESULT CreateFilter(
-  DECL_EXTERNAL_CODECS_LOC_VARS
-  CMethodId methodId,
-  CMyComPtr<ICompressFilter> &filter,
-  bool encode)
-{
-  CMyComPtr<ICompressCoder> coder;
-  CMyComPtr<ICompressCoder2> coder2;
-  return CreateCoder(
-    EXTERNAL_CODECS_LOC_VARS
-    methodId,
-    filter, coder, coder2, encode, false);
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/CreateCoder.h b/third_party/lzma/v4_65/files/CPP/7zip/Common/CreateCoder.h
deleted file mode 100644
index 1fcc134..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/CreateCoder.h
+++ /dev/null
@@ -1,98 +0,0 @@
-// CreateCoder.h
-
-#ifndef __CREATECODER_H
-#define __CREATECODER_H
-
-#include "Common/MyCom.h"
-#include "Common/MyString.h"
-#include "../ICoder.h"
-
-#include "MethodId.h"
-
-#ifdef EXTERNAL_CODECS
-
-struct CCodecInfoEx
-{
-  UString Name;
-  CMethodId Id;
-  UInt32 NumInStreams;
-  UInt32 NumOutStreams;
-  bool EncoderIsAssigned;
-  bool DecoderIsAssigned;
-  bool IsSimpleCodec() const { return NumOutStreams == 1 && NumInStreams == 1; }
-  CCodecInfoEx(): EncoderIsAssigned(false), DecoderIsAssigned(false) {}
-};
-
-HRESULT LoadExternalCodecs(ICompressCodecsInfo *codecsInfo, CObjectVector<CCodecInfoEx> &externalCodecs);
-
-#define PUBLIC_ISetCompressCodecsInfo public ISetCompressCodecsInfo,
-#define QUERY_ENTRY_ISetCompressCodecsInfo MY_QUERYINTERFACE_ENTRY(ISetCompressCodecsInfo)
-#define DECL_ISetCompressCodecsInfo STDMETHOD(SetCompressCodecsInfo)(ICompressCodecsInfo *compressCodecsInfo);
-#define IMPL_ISetCompressCodecsInfo2(x) \
-STDMETHODIMP x::SetCompressCodecsInfo(ICompressCodecsInfo *compressCodecsInfo) { \
-  COM_TRY_BEGIN _codecsInfo = compressCodecsInfo;  return LoadExternalCodecs(_codecsInfo, _externalCodecs); COM_TRY_END }
-#define IMPL_ISetCompressCodecsInfo IMPL_ISetCompressCodecsInfo2(CHandler)
-
-#define EXTERNAL_CODECS_VARS2 _codecsInfo, &_externalCodecs
-
-#define DECL_EXTERNAL_CODECS_VARS CMyComPtr<ICompressCodecsInfo> _codecsInfo; CObjectVector<CCodecInfoEx> _externalCodecs;
-#define EXTERNAL_CODECS_VARS EXTERNAL_CODECS_VARS2,
-
-#define DECL_EXTERNAL_CODECS_LOC_VARS2 ICompressCodecsInfo *codecsInfo, const CObjectVector<CCodecInfoEx> *externalCodecs
-#define EXTERNAL_CODECS_LOC_VARS2 codecsInfo, externalCodecs
-
-#define DECL_EXTERNAL_CODECS_LOC_VARS DECL_EXTERNAL_CODECS_LOC_VARS2,
-#define EXTERNAL_CODECS_LOC_VARS EXTERNAL_CODECS_LOC_VARS2,
-
-#else
-
-#define PUBLIC_ISetCompressCodecsInfo
-#define QUERY_ENTRY_ISetCompressCodecsInfo
-#define DECL_ISetCompressCodecsInfo
-#define IMPL_ISetCompressCodecsInfo
-#define EXTERNAL_CODECS_VARS2
-#define DECL_EXTERNAL_CODECS_VARS
-#define EXTERNAL_CODECS_VARS EXTERNAL_CODECS_VARS2
-#define DECL_EXTERNAL_CODECS_LOC_VARS2
-#define EXTERNAL_CODECS_LOC_VARS2
-#define DECL_EXTERNAL_CODECS_LOC_VARS
-#define EXTERNAL_CODECS_LOC_VARS
-
-#endif
-
-bool FindMethod(
-  DECL_EXTERNAL_CODECS_LOC_VARS
-  const UString &name, CMethodId &methodId, UInt32 &numInStreams, UInt32 &numOutStreams);
-
-bool FindMethod(
-  DECL_EXTERNAL_CODECS_LOC_VARS
-  CMethodId methodId, UString &name);
-
-
-HRESULT CreateCoder(
-  DECL_EXTERNAL_CODECS_LOC_VARS
-  CMethodId methodId,
-  CMyComPtr<ICompressFilter> &filter,
-  CMyComPtr<ICompressCoder> &coder,
-  CMyComPtr<ICompressCoder2> &coder2,
-  bool encode, bool onlyCoder);
-
-HRESULT CreateCoder(
-  DECL_EXTERNAL_CODECS_LOC_VARS
-  CMethodId methodId,
-  CMyComPtr<ICompressCoder> &coder,
-  CMyComPtr<ICompressCoder2> &coder2,
-  bool encode);
-
-HRESULT CreateCoder(
-  DECL_EXTERNAL_CODECS_LOC_VARS
-  CMethodId methodId,
-  CMyComPtr<ICompressCoder> &coder, bool encode);
-
-HRESULT CreateFilter(
-  DECL_EXTERNAL_CODECS_LOC_VARS
-  CMethodId methodId,
-  CMyComPtr<ICompressFilter> &filter,
-  bool encode);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/FilePathAutoRename.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Common/FilePathAutoRename.cpp
deleted file mode 100644
index bf69fc7..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/FilePathAutoRename.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-// FilePathAutoRename.cpp
-
-#include "StdAfx.h"
-#include "FilePathAutoRename.h"
-
-#include "Common/Defs.h"
-#include "Common/IntToString.h"
-
-#include "Windows/FileName.h"
-#include "Windows/FileFind.h"
-
-using namespace NWindows;
-
-static bool MakeAutoName(const UString &name,
-    const UString &extension, int value, UString &path)
-{
-  wchar_t number[32];
-  ConvertUInt64ToString(value, number);
-  path = name;
-  path += number;
-  path += extension;
-  return NFile::NFind::DoesFileExist(path);
-}
-
-bool AutoRenamePath(UString &fullProcessedPath)
-{
-  UString path;
-  int dotPos = fullProcessedPath.ReverseFind(L'.');
-
-  int slashPos = fullProcessedPath.ReverseFind(L'/');
-  #ifdef _WIN32
-  int slash1Pos = fullProcessedPath.ReverseFind(L'\\');
-  slashPos = MyMax(slashPos, slash1Pos);
-  #endif
-
-  UString name, extension;
-  if (dotPos > slashPos &&  dotPos > 0)
-  {
-    name = fullProcessedPath.Left(dotPos);
-    extension = fullProcessedPath.Mid(dotPos);
-  }
-  else
-    name = fullProcessedPath;
-  name += L'_';
-  int indexLeft = 1, indexRight = (1 << 30);
-  while (indexLeft != indexRight)
-  {
-    int indexMid = (indexLeft + indexRight) / 2;
-    if (MakeAutoName(name, extension, indexMid, path))
-      indexLeft = indexMid + 1;
-    else
-      indexRight = indexMid;
-  }
-  if (MakeAutoName(name, extension, indexRight, fullProcessedPath))
-    return false;
-  return true;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/FilePathAutoRename.h b/third_party/lzma/v4_65/files/CPP/7zip/Common/FilePathAutoRename.h
deleted file mode 100644
index 3ef87f4..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/FilePathAutoRename.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// Util/FilePathAutoRename.h
-
-#ifndef __FILEPATHAUTORENAME_H
-#define __FILEPATHAUTORENAME_H
-
-#include "Common/MyString.h"
-
-bool AutoRenamePath(UString &fullProcessedPath);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/FileStreams.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Common/FileStreams.cpp
deleted file mode 100644
index eb7ad3a..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/FileStreams.cpp
+++ /dev/null
@@ -1,261 +0,0 @@
-// FileStreams.cpp
-
-#include "StdAfx.h"
-
-#ifndef _WIN32
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#endif
-
-#include "FileStreams.h"
-
-static inline HRESULT ConvertBoolToHRESULT(bool result)
-{
-  #ifdef _WIN32
-  if (result)
-    return S_OK;
-  DWORD lastError = ::GetLastError();
-  if (lastError == 0)
-    return E_FAIL;
-  return HRESULT_FROM_WIN32(lastError);
-  #else
-  return result ? S_OK: E_FAIL;
-  #endif
-}
-
-bool CInFileStream::Open(LPCTSTR fileName)
-{
-  return File.Open(fileName);
-}
-
-#ifdef USE_WIN_FILE
-#ifndef _UNICODE
-bool CInFileStream::Open(LPCWSTR fileName)
-{
-  return File.Open(fileName);
-}
-#endif
-#endif
-
-bool CInFileStream::OpenShared(LPCTSTR fileName, bool shareForWrite)
-{
-  return File.OpenShared(fileName, shareForWrite);
-}
-
-#ifdef USE_WIN_FILE
-#ifndef _UNICODE
-bool CInFileStream::OpenShared(LPCWSTR fileName, bool shareForWrite)
-{
-  return File.OpenShared(fileName, shareForWrite);
-}
-#endif
-#endif
-
-STDMETHODIMP CInFileStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
-  #ifdef USE_WIN_FILE
-  
-  UInt32 realProcessedSize;
-  bool result = File.ReadPart(data, size, realProcessedSize);
-  if(processedSize != NULL)
-    *processedSize = realProcessedSize;
-  return ConvertBoolToHRESULT(result);
-  
-  #else
-  
-  if(processedSize != NULL)
-    *processedSize = 0;
-  ssize_t res = File.Read(data, (size_t)size);
-  if (res == -1)
-    return E_FAIL;
-  if(processedSize != NULL)
-    *processedSize = (UInt32)res;
-  return S_OK;
-
-  #endif
-}
-
-#ifndef _WIN32_WCE
-STDMETHODIMP CStdInFileStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
-  #ifdef _WIN32
-  UInt32 realProcessedSize;
-  BOOL res = ::ReadFile(GetStdHandle(STD_INPUT_HANDLE),
-      data, size, (DWORD *)&realProcessedSize, NULL);
-  if(processedSize != NULL)
-    *processedSize = realProcessedSize;
-  if (res == FALSE && GetLastError() == ERROR_BROKEN_PIPE)
-    return S_OK;
-  return ConvertBoolToHRESULT(res != FALSE);
-  
-  #else
-
-  if(processedSize != NULL)
-    *processedSize = 0;
-  ssize_t res;
-  do
-  {
-    res = read(0, data, (size_t)size);
-  }
-  while (res < 0 && (errno == EINTR));
-  if (res == -1)
-    return E_FAIL;
-  if(processedSize != NULL)
-    *processedSize = (UInt32)res;
-  return S_OK;
-  
-  #endif
-}
-  
-#endif
-
-STDMETHODIMP CInFileStream::Seek(Int64 offset, UInt32 seekOrigin,
-    UInt64 *newPosition)
-{
-  if(seekOrigin >= 3)
-    return STG_E_INVALIDFUNCTION;
-
-  #ifdef USE_WIN_FILE
-
-  UInt64 realNewPosition;
-  bool result = File.Seek(offset, seekOrigin, realNewPosition);
-  if(newPosition != NULL)
-    *newPosition = realNewPosition;
-  return ConvertBoolToHRESULT(result);
-  
-  #else
-  
-  off_t res = File.Seek(offset, seekOrigin);
-  if (res == -1)
-    return E_FAIL;
-  if(newPosition != NULL)
-    *newPosition = (UInt64)res;
-  return S_OK;
-  
-  #endif
-}
-
-STDMETHODIMP CInFileStream::GetSize(UInt64 *size)
-{
-  return ConvertBoolToHRESULT(File.GetLength(*size));
-}
-
-
-//////////////////////////
-// COutFileStream
-
-HRESULT COutFileStream::Close()
-{
-  return ConvertBoolToHRESULT(File.Close());
-}
-
-STDMETHODIMP COutFileStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
-  #ifdef USE_WIN_FILE
-
-  UInt32 realProcessedSize;
-  bool result = File.WritePart(data, size, realProcessedSize);
-  ProcessedSize += realProcessedSize;
-  if(processedSize != NULL)
-    *processedSize = realProcessedSize;
-  return ConvertBoolToHRESULT(result);
-  
-  #else
-  
-  if(processedSize != NULL)
-    *processedSize = 0;
-  ssize_t res = File.Write(data, (size_t)size);
-  if (res == -1)
-    return E_FAIL;
-  if(processedSize != NULL)
-    *processedSize = (UInt32)res;
-  ProcessedSize += res;
-  return S_OK;
-  
-  #endif
-}
-  
-STDMETHODIMP COutFileStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
-{
-  if(seekOrigin >= 3)
-    return STG_E_INVALIDFUNCTION;
-  #ifdef USE_WIN_FILE
-
-  UInt64 realNewPosition;
-  bool result = File.Seek(offset, seekOrigin, realNewPosition);
-  if(newPosition != NULL)
-    *newPosition = realNewPosition;
-  return ConvertBoolToHRESULT(result);
-  
-  #else
-  
-  off_t res = File.Seek(offset, seekOrigin);
-  if (res == -1)
-    return E_FAIL;
-  if(newPosition != NULL)
-    *newPosition = (UInt64)res;
-  return S_OK;
-  
-  #endif
-}
-
-STDMETHODIMP COutFileStream::SetSize(Int64 newSize)
-{
-  #ifdef USE_WIN_FILE
-  UInt64 currentPos;
-  if(!File.Seek(0, FILE_CURRENT, currentPos))
-    return E_FAIL;
-  bool result = File.SetLength(newSize);
-  UInt64 currentPos2;
-  result = result && File.Seek(currentPos, currentPos2);
-  return result ? S_OK : E_FAIL;
-  #else
-  return E_FAIL;
-  #endif
-}
-
-#ifndef _WIN32_WCE
-STDMETHODIMP CStdOutFileStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
-  if(processedSize != NULL)
-    *processedSize = 0;
-
-  #ifdef _WIN32
-  UInt32 realProcessedSize;
-  BOOL res = TRUE;
-  if (size > 0)
-  {
-    // Seems that Windows doesn't like big amounts writing to stdout.
-    // So we limit portions by 32KB.
-    UInt32 sizeTemp = (1 << 15);
-    if (sizeTemp > size)
-      sizeTemp = size;
-    res = ::WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),
-        data, sizeTemp, (DWORD *)&realProcessedSize, NULL);
-    size -= realProcessedSize;
-    data = (const void *)((const Byte *)data + realProcessedSize);
-    if(processedSize != NULL)
-      *processedSize += realProcessedSize;
-  }
-  return ConvertBoolToHRESULT(res != FALSE);
-
-  #else
-  
-  ssize_t res;
-  do
-  {
-    res = write(1, data, (size_t)size);
-  }
-  while (res < 0 && (errno == EINTR));
-  if (res == -1)
-    return E_FAIL;
-  if(processedSize != NULL)
-    *processedSize = (UInt32)res;
-  return S_OK;
-  
-  return S_OK;
-  #endif
-}
-  
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/FileStreams.h b/third_party/lzma/v4_65/files/CPP/7zip/Common/FileStreams.h
deleted file mode 100644
index 361c219..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/FileStreams.h
+++ /dev/null
@@ -1,140 +0,0 @@
-// FileStreams.h
-
-#ifndef __FILESTREAMS_H
-#define __FILESTREAMS_H
-
-#ifdef _WIN32
-#define USE_WIN_FILE
-#endif
-
-#ifdef USE_WIN_FILE
-#include "../../Windows/FileIO.h"
-#else
-#include "../../Common/C_FileIO.h"
-#endif
-
-#include "../IStream.h"
-#include "../../Common/MyCom.h"
-
-class CInFileStream:
-  public IInStream,
-  public IStreamGetSize,
-  public CMyUnknownImp
-{
-public:
-  #ifdef USE_WIN_FILE
-  NWindows::NFile::NIO::CInFile File;
-  #else
-  NC::NFile::NIO::CInFile File;
-  #endif
-  CInFileStream() {}
-  virtual ~CInFileStream() {}
-
-  bool Open(LPCTSTR fileName);
-  #ifdef USE_WIN_FILE
-  #ifndef _UNICODE
-  bool Open(LPCWSTR fileName);
-  #endif
-  #endif
-
-  bool OpenShared(LPCTSTR fileName, bool shareForWrite);
-  #ifdef USE_WIN_FILE
-  #ifndef _UNICODE
-  bool OpenShared(LPCWSTR fileName, bool shareForWrite);
-  #endif
-  #endif
-
-  MY_UNKNOWN_IMP2(IInStream, IStreamGetSize)
-
-  STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-  STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
-
-  STDMETHOD(GetSize)(UInt64 *size);
-};
-
-#ifndef _WIN32_WCE
-class CStdInFileStream:
-  public ISequentialInStream,
-  public CMyUnknownImp
-{
-public:
-  // HANDLE File;
-  // CStdInFileStream() File(INVALID_HANDLE_VALUE): {}
-  // void Open() { File = GetStdHandle(STD_INPUT_HANDLE); };
-  MY_UNKNOWN_IMP
-
-  virtual ~CStdInFileStream() {}
-  STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-};
-#endif
-
-class COutFileStream:
-  public IOutStream,
-  public CMyUnknownImp
-{
-  #ifdef USE_WIN_FILE
-  NWindows::NFile::NIO::COutFile File;
-  #else
-  NC::NFile::NIO::COutFile File;
-  #endif
-public:
-  virtual ~COutFileStream() {}
-  bool Create(LPCTSTR fileName, bool createAlways)
-  {
-    ProcessedSize = 0;
-    return File.Create(fileName, createAlways);
-  }
-  bool Open(LPCTSTR fileName, DWORD creationDisposition)
-  {
-    ProcessedSize = 0;
-    return File.Open(fileName, creationDisposition);
-  }
-  #ifdef USE_WIN_FILE
-  #ifndef _UNICODE
-  bool Create(LPCWSTR fileName, bool createAlways)
-  {
-    ProcessedSize = 0;
-    return File.Create(fileName, createAlways);
-  }
-  bool Open(LPCWSTR fileName, DWORD creationDisposition)
-  {
-    ProcessedSize = 0;
-    return File.Open(fileName, creationDisposition);
-  }
-  #endif
-  #endif
-
-  HRESULT Close();
-  
-  UInt64 ProcessedSize;
-
-  #ifdef USE_WIN_FILE
-  bool SetTime(const FILETIME *cTime, const FILETIME *aTime, const FILETIME *mTime)
-  {
-    return File.SetTime(cTime, aTime, mTime);
-  }
-  bool SetMTime(const FILETIME *mTime) {  return File.SetMTime(mTime); }
-  #endif
-
-
-  MY_UNKNOWN_IMP1(IOutStream)
-
-  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-  STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
-  STDMETHOD(SetSize)(Int64 newSize);
-};
-
-#ifndef _WIN32_WCE
-class CStdOutFileStream:
-  public ISequentialOutStream,
-  public CMyUnknownImp
-{
-public:
-  MY_UNKNOWN_IMP
-
-  virtual ~CStdOutFileStream() {}
-  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-#endif
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/FilterCoder.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Common/FilterCoder.cpp
deleted file mode 100644
index 6b34260..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/FilterCoder.cpp
+++ /dev/null
@@ -1,256 +0,0 @@
-// FilterCoder.cpp
-
-#include "StdAfx.h"
-
-#include "FilterCoder.h"
-extern "C"
-{
-#include "../../../C/Alloc.h"
-}
-#include "../../Common/Defs.h"
-#include "StreamUtils.h"
-
-static const UInt32 kBufferSize = 1 << 17;
-
-CFilterCoder::CFilterCoder()
-{
-  _buffer = (Byte *)::MidAlloc(kBufferSize);
-}
-
-CFilterCoder::~CFilterCoder()
-{
-  ::MidFree(_buffer);
-}
-
-HRESULT CFilterCoder::WriteWithLimit(ISequentialOutStream *outStream, UInt32 size)
-{
-  if (_outSizeIsDefined)
-  {
-    UInt64 remSize = _outSize - _nowPos64;
-    if (size > remSize)
-      size = (UInt32)remSize;
-  }
-  RINOK(WriteStream(outStream, _buffer, size));
-  _nowPos64 += size;
-  return S_OK;
-}
-
-
-STDMETHODIMP CFilterCoder::Code(ISequentialInStream *inStream,
-      ISequentialOutStream *outStream, const UInt64 * /* inSize */, const UInt64 *outSize,
-      ICompressProgressInfo *progress)
-{
-  RINOK(Init());
-  UInt32 bufferPos = 0;
-  _outSizeIsDefined = (outSize != 0);
-  if (_outSizeIsDefined)
-    _outSize = *outSize;
-
-  while(NeedMore())
-  {
-    size_t processedSize = kBufferSize - bufferPos;
-    
-    // Change it: It can be optimized using ReadPart
-    RINOK(ReadStream(inStream, _buffer + bufferPos, &processedSize));
-    
-    UInt32 endPos = bufferPos + (UInt32)processedSize;
-
-    bufferPos = Filter->Filter(_buffer, endPos);
-    if (bufferPos > endPos)
-    {
-      for (; endPos< bufferPos; endPos++)
-        _buffer[endPos] = 0;
-      bufferPos = Filter->Filter(_buffer, endPos);
-    }
-
-    if (bufferPos == 0)
-    {
-      if (endPos > 0)
-        return WriteWithLimit(outStream, endPos);
-      return S_OK;
-    }
-    RINOK(WriteWithLimit(outStream, bufferPos));
-    if (progress != NULL)
-    {
-      RINOK(progress->SetRatioInfo(&_nowPos64, &_nowPos64));
-    }
-    UInt32 i = 0;
-    while(bufferPos < endPos)
-      _buffer[i++] = _buffer[bufferPos++];
-    bufferPos = i;
-  }
-  return S_OK;
-}
-
-// #ifdef _ST_MODE
-STDMETHODIMP CFilterCoder::SetOutStream(ISequentialOutStream *outStream)
-{
-  _bufferPos = 0;
-  _outStream = outStream;
-  return Init();
-}
-
-STDMETHODIMP CFilterCoder::ReleaseOutStream()
-{
-  _outStream.Release();
-  return S_OK;
-};
-
-
-STDMETHODIMP CFilterCoder::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
-  UInt32 processedSizeTotal = 0;
-  while(size > 0)
-  {
-    UInt32 sizeMax = kBufferSize - _bufferPos;
-    UInt32 sizeTemp = size;
-    if (sizeTemp > sizeMax)
-      sizeTemp = sizeMax;
-    memmove(_buffer + _bufferPos, data, sizeTemp);
-    size -= sizeTemp;
-    processedSizeTotal += sizeTemp;
-    data = (const Byte *)data + sizeTemp;
-    UInt32 endPos = _bufferPos + sizeTemp;
-    _bufferPos = Filter->Filter(_buffer, endPos);
-    if (_bufferPos == 0)
-    {
-      _bufferPos = endPos;
-      break;
-    }
-    if (_bufferPos > endPos)
-    {
-      if (size != 0)
-        return E_FAIL;
-      break;
-    }
-    RINOK(WriteWithLimit(_outStream, _bufferPos));
-    UInt32 i = 0;
-    while(_bufferPos < endPos)
-      _buffer[i++] = _buffer[_bufferPos++];
-    _bufferPos = i;
-  }
-  if (processedSize != NULL)
-    *processedSize = processedSizeTotal;
-  return S_OK;
-}
-
-STDMETHODIMP CFilterCoder::Flush()
-{
-  if (_bufferPos != 0)
-  {
-    UInt32 endPos = Filter->Filter(_buffer, _bufferPos);
-    if (endPos > _bufferPos)
-    {
-      for (; _bufferPos < endPos; _bufferPos++)
-        _buffer[_bufferPos] = 0;
-      if (Filter->Filter(_buffer, endPos) != endPos)
-        return E_FAIL;
-    }
-    RINOK(WriteStream(_outStream, _buffer, _bufferPos));
-    _bufferPos = 0;
-  }
-  CMyComPtr<IOutStreamFlush> flush;
-  _outStream.QueryInterface(IID_IOutStreamFlush, &flush);
-  if (flush)
-    return  flush->Flush();
-  return S_OK;
-}
-
-
-STDMETHODIMP CFilterCoder::SetInStream(ISequentialInStream *inStream)
-{
-  _convertedPosBegin = _convertedPosEnd = _bufferPos = 0;
-  _inStream = inStream;
-  return Init();
-}
-
-STDMETHODIMP CFilterCoder::ReleaseInStream()
-{
-  _inStream.Release();
-  return S_OK;
-};
-
-STDMETHODIMP CFilterCoder::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
-  UInt32 processedSizeTotal = 0;
-  while(size > 0)
-  {
-    if (_convertedPosBegin != _convertedPosEnd)
-    {
-      UInt32 sizeTemp = MyMin(size, _convertedPosEnd - _convertedPosBegin);
-      memmove(data, _buffer + _convertedPosBegin, sizeTemp);
-      _convertedPosBegin += sizeTemp;
-      data = (void *)((Byte *)data + sizeTemp);
-      size -= sizeTemp;
-      processedSizeTotal += sizeTemp;
-      break;
-    }
-    int i;
-    for (i = 0; _convertedPosEnd + i < _bufferPos; i++)
-      _buffer[i] = _buffer[i + _convertedPosEnd];
-    _bufferPos = i;
-    _convertedPosBegin = _convertedPosEnd = 0;
-    size_t processedSizeTemp = kBufferSize - _bufferPos;
-    RINOK(ReadStream(_inStream, _buffer + _bufferPos, &processedSizeTemp));
-    _bufferPos = _bufferPos + (UInt32)processedSizeTemp;
-    _convertedPosEnd = Filter->Filter(_buffer, _bufferPos);
-    if (_convertedPosEnd == 0)
-    {
-      if (_bufferPos == 0)
-        break;
-      else
-      {
-        _convertedPosEnd = _bufferPos; // check it
-        continue;
-      }
-    }
-    if (_convertedPosEnd > _bufferPos)
-    {
-      for (; _bufferPos < _convertedPosEnd; _bufferPos++)
-        _buffer[_bufferPos] = 0;
-      _convertedPosEnd = Filter->Filter(_buffer, _bufferPos);
-    }
-  }
-  if (processedSize != NULL)
-    *processedSize = processedSizeTotal;
-  return S_OK;
-}
-
-// #endif // _ST_MODE
-
-#ifndef _NO_CRYPTO
-STDMETHODIMP CFilterCoder::CryptoSetPassword(const Byte *data, UInt32 size)
-{
-  return _setPassword->CryptoSetPassword(data, size);
-}
-#endif
-
-#ifndef EXTRACT_ONLY
-STDMETHODIMP CFilterCoder::SetCoderProperties(const PROPID *propIDs,
-      const PROPVARIANT *properties, UInt32 numProperties)
-{
-  return _SetCoderProperties->SetCoderProperties(propIDs, properties, numProperties);
-}
-
-STDMETHODIMP CFilterCoder::WriteCoderProperties(ISequentialOutStream *outStream)
-{
-  return _writeCoderProperties->WriteCoderProperties(outStream);
-}
-
-/*
-STDMETHODIMP CFilterCoder::ResetSalt()
-{
-  return _CryptoResetSalt->ResetSalt();
-}
-*/
-
-STDMETHODIMP CFilterCoder::ResetInitVector()
-{
-  return _CryptoResetInitVector->ResetInitVector();
-}
-#endif
-
-STDMETHODIMP CFilterCoder::SetDecoderProperties2(const Byte *data, UInt32 size)
-{
-  return _setDecoderProperties->SetDecoderProperties2(data, size);
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/FilterCoder.h b/third_party/lzma/v4_65/files/CPP/7zip/Common/FilterCoder.h
deleted file mode 100644
index a0ec08c..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/FilterCoder.h
+++ /dev/null
@@ -1,143 +0,0 @@
-// FilterCoder.h
-
-#ifndef __FILTERCODER_H
-#define __FILTERCODER_H
-
-#include "../../Common/MyCom.h"
-#include "../ICoder.h"
-#include "../IPassword.h"
-
-#define MY_QUERYINTERFACE_ENTRY_AG(i, sub0, sub) if (iid == IID_ ## i) \
-{ if (!sub) RINOK(sub0->QueryInterface(IID_ ## i, (void **)&sub)) \
-*outObject = (void *)(i *)this; AddRef(); return S_OK; }
-
-class CFilterCoder:
-  public ICompressCoder,
-  // #ifdef _ST_MODE
-  public ICompressSetInStream,
-  public ISequentialInStream,
-  public ICompressSetOutStream,
-  public ISequentialOutStream,
-  public IOutStreamFlush,
-  // #endif
-
-  #ifndef _NO_CRYPTO
-  public ICryptoSetPassword,
-  #endif
-  #ifndef EXTRACT_ONLY
-  public ICompressSetCoderProperties,
-  public ICompressWriteCoderProperties,
-  // public ICryptoResetSalt,
-  public ICryptoResetInitVector,
-  #endif
-  public ICompressSetDecoderProperties2,
-  public CMyUnknownImp
-{
-protected:
-  Byte *_buffer;
-  // #ifdef _ST_MODE
-  CMyComPtr<ISequentialInStream> _inStream;
-  CMyComPtr<ISequentialOutStream> _outStream;
-  UInt32 _bufferPos;
-  UInt32 _convertedPosBegin;
-  UInt32 _convertedPosEnd;
-  // #endif
-  bool _outSizeIsDefined;
-  UInt64 _outSize;
-  UInt64 _nowPos64;
-
-  HRESULT Init()
-  {
-    _nowPos64 = 0;
-    _outSizeIsDefined = false;
-    return Filter->Init();
-  }
-
-  CMyComPtr<ICryptoSetPassword> _setPassword;
-  #ifndef EXTRACT_ONLY
-  CMyComPtr<ICompressSetCoderProperties> _SetCoderProperties;
-  CMyComPtr<ICompressWriteCoderProperties> _writeCoderProperties;
-  // CMyComPtr<ICryptoResetSalt> _CryptoResetSalt;
-  CMyComPtr<ICryptoResetInitVector> _CryptoResetInitVector;
-  #endif
-  CMyComPtr<ICompressSetDecoderProperties2> _setDecoderProperties;
-public:
-  CMyComPtr<ICompressFilter> Filter;
-
-  CFilterCoder();
-  ~CFilterCoder();
-  HRESULT WriteWithLimit(ISequentialOutStream *outStream, UInt32 size);
-  bool NeedMore() const
-    { return (!_outSizeIsDefined || (_nowPos64 < _outSize)); }
-
-public:
-  MY_QUERYINTERFACE_BEGIN
-    MY_QUERYINTERFACE_ENTRY(ICompressCoder)
-    // #ifdef _ST_MODE
-    MY_QUERYINTERFACE_ENTRY(ICompressSetInStream)
-    MY_QUERYINTERFACE_ENTRY(ISequentialInStream)
-
-    MY_QUERYINTERFACE_ENTRY(ICompressSetOutStream)
-    MY_QUERYINTERFACE_ENTRY(ISequentialOutStream)
-    MY_QUERYINTERFACE_ENTRY(IOutStreamFlush)
-    // #endif
-
-    #ifndef _NO_CRYPTO
-    MY_QUERYINTERFACE_ENTRY_AG(ICryptoSetPassword, Filter, _setPassword)
-    #endif
-
-    #ifndef EXTRACT_ONLY
-    MY_QUERYINTERFACE_ENTRY_AG(ICompressSetCoderProperties, Filter, _SetCoderProperties)
-    MY_QUERYINTERFACE_ENTRY_AG(ICompressWriteCoderProperties, Filter, _writeCoderProperties)
-    // MY_QUERYINTERFACE_ENTRY_AG(ICryptoResetSalt, Filter, _CryptoResetSalt)
-    MY_QUERYINTERFACE_ENTRY_AG(ICryptoResetInitVector, Filter, _CryptoResetInitVector)
-    #endif
-
-    MY_QUERYINTERFACE_ENTRY_AG(ICompressSetDecoderProperties2, Filter, _setDecoderProperties)
-  MY_QUERYINTERFACE_END
-  MY_ADDREF_RELEASE
-  STDMETHOD(Code)(ISequentialInStream *inStream,
-      ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
-      ICompressProgressInfo *progress);
-  // #ifdef _ST_MODE
-  STDMETHOD(ReleaseInStream)();
-  STDMETHOD(SetInStream)(ISequentialInStream *inStream);
-  STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); \
-  STDMETHOD(SetOutStream)(ISequentialOutStream *outStream);
-  STDMETHOD(ReleaseOutStream)();
-  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-  STDMETHOD(Flush)();
-  // #endif
-
-  #ifndef _NO_CRYPTO
-  STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size);
-  #endif
-  #ifndef EXTRACT_ONLY
-  STDMETHOD(SetCoderProperties)(const PROPID *propIDs,
-      const PROPVARIANT *properties, UInt32 numProperties);
-  STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream);
-  // STDMETHOD(ResetSalt)();
-  STDMETHOD(ResetInitVector)();
-  #endif
-  STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
-};
-
-// #ifdef _ST_MODE
-class CInStreamReleaser
-{
-public:
-  CFilterCoder *FilterCoder;
-  CInStreamReleaser(): FilterCoder(0) {}
-  ~CInStreamReleaser() { if (FilterCoder) FilterCoder->ReleaseInStream(); }
-};
-
-class COutStreamReleaser
-{
-public:
-  CFilterCoder *FilterCoder;
-  COutStreamReleaser(): FilterCoder(0) {}
-  ~COutStreamReleaser() { if (FilterCoder) FilterCoder->ReleaseOutStream(); }
-};
-// #endif
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/InBuffer.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Common/InBuffer.cpp
deleted file mode 100644
index 29e3ea1..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/InBuffer.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-// InBuffer.cpp
-
-#include "StdAfx.h"
-
-#include "InBuffer.h"
-
-extern "C"
-{
-  #include "../../../C/Alloc.h"
-}
-
-CInBuffer::CInBuffer():
-  _buffer(0),
-  _bufferLimit(0),
-  _bufferBase(0),
-  _stream(0),
-  _bufferSize(0)
-{}
-
-bool CInBuffer::Create(UInt32 bufferSize)
-{
-  const UInt32 kMinBlockSize = 1;
-  if (bufferSize < kMinBlockSize)
-    bufferSize = kMinBlockSize;
-  if (_bufferBase != 0 && _bufferSize == bufferSize)
-    return true;
-  Free();
-  _bufferSize = bufferSize;
-  _bufferBase = (Byte *)::MidAlloc(bufferSize);
-  return (_bufferBase != 0);
-}
-
-void CInBuffer::Free()
-{
-  ::MidFree(_bufferBase);
-  _bufferBase = 0;
-}
-
-void CInBuffer::SetStream(ISequentialInStream *stream)
-{
-  _stream = stream;
-}
-
-void CInBuffer::Init()
-{
-  _processedSize = 0;
-  _buffer = _bufferBase;
-  _bufferLimit = _buffer;
-  _wasFinished = false;
-  #ifdef _NO_EXCEPTIONS
-  ErrorCode = S_OK;
-  #endif
-}
-
-bool CInBuffer::ReadBlock()
-{
-  #ifdef _NO_EXCEPTIONS
-  if (ErrorCode != S_OK)
-    return false;
-  #endif
-  if (_wasFinished)
-    return false;
-  _processedSize += (_buffer - _bufferBase);
-  UInt32 numProcessedBytes;
-  HRESULT result = _stream->Read(_bufferBase, _bufferSize, &numProcessedBytes);
-  #ifdef _NO_EXCEPTIONS
-  ErrorCode = result;
-  #else
-  if (result != S_OK)
-    throw CInBufferException(result);
-  #endif
-  _buffer = _bufferBase;
-  _bufferLimit = _buffer + numProcessedBytes;
-  _wasFinished = (numProcessedBytes == 0);
-  return (!_wasFinished);
-}
-
-Byte CInBuffer::ReadBlock2()
-{
-  if(!ReadBlock())
-    return 0xFF;
-  return *_buffer++;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/InBuffer.h b/third_party/lzma/v4_65/files/CPP/7zip/Common/InBuffer.h
deleted file mode 100644
index 75625bf..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/InBuffer.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// InBuffer.h
-
-#ifndef __INBUFFER_H
-#define __INBUFFER_H
-
-#include "../IStream.h"
-#include "../../Common/MyCom.h"
-#include "../../Common/MyException.h"
-
-#ifndef _NO_EXCEPTIONS
-struct CInBufferException: public CSystemException
-{
-  CInBufferException(HRESULT errorCode): CSystemException(errorCode) {}
-};
-#endif
-
-class CInBuffer
-{
-  Byte *_buffer;
-  Byte *_bufferLimit;
-  Byte *_bufferBase;
-  CMyComPtr<ISequentialInStream> _stream;
-  UInt64 _processedSize;
-  UInt32 _bufferSize;
-  bool _wasFinished;
-
-  bool ReadBlock();
-  Byte ReadBlock2();
-
-public:
-  #ifdef _NO_EXCEPTIONS
-  HRESULT ErrorCode;
-  #endif
-
-  CInBuffer();
-  ~CInBuffer() { Free(); }
-
-  bool Create(UInt32 bufferSize);
-  void Free();
-  
-  void SetStream(ISequentialInStream *stream);
-  void Init();
-  void ReleaseStream() { _stream.Release(); }
-
-  bool ReadByte(Byte &b)
-  {
-    if (_buffer >= _bufferLimit)
-      if (!ReadBlock())
-        return false;
-    b = *_buffer++;
-    return true;
-  }
-  Byte ReadByte()
-  {
-    if (_buffer >= _bufferLimit)
-      return ReadBlock2();
-    return *_buffer++;
-  }
-  UInt32 ReadBytes(Byte *buf, UInt32 size)
-  {
-    if ((UInt32)(_bufferLimit - _buffer) >= size)
-    {
-      for (UInt32 i = 0; i < size; i++)
-        buf[i] = _buffer[i];
-      _buffer += size;
-      return size;
-    }
-    for (UInt32 i = 0; i < size; i++)
-    {
-      if (_buffer >= _bufferLimit)
-        if (!ReadBlock())
-          return i;
-      buf[i] = *_buffer++;
-    }
-    return size;
-  }
-  UInt64 GetProcessedSize() const { return _processedSize + (_buffer - _bufferBase); }
-  bool WasFinished() const { return _wasFinished; }
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/InOutTempBuffer.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Common/InOutTempBuffer.cpp
deleted file mode 100644
index 4cc0b2f..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/InOutTempBuffer.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-// InOutTempBuffer.cpp
-
-#include "StdAfx.h"
-
-#include "InOutTempBuffer.h"
-#include "../../Common/Defs.h"
-// #include "Windows/Defs.h"
-
-#include "StreamUtils.h"
-
-using namespace NWindows;
-using namespace NFile;
-using namespace NDirectory;
-
-static UInt32 kTmpBufferMemorySize = (1 << 20);
-
-static LPCTSTR kTempFilePrefixString = TEXT("iot");
-
-CInOutTempBuffer::CInOutTempBuffer():
-  _buffer(NULL)
-{
-}
-
-void CInOutTempBuffer::Create()
-{
-  _buffer = new Byte[kTmpBufferMemorySize];
-}
-
-CInOutTempBuffer::~CInOutTempBuffer()
-{
-  delete []_buffer;
-}
-void CInOutTempBuffer::InitWriting()
-{
-  _bufferPosition = 0;
-  _tmpFileCreated = false;
-  _fileSize = 0;
-}
-
-bool CInOutTempBuffer::WriteToFile(const void *data, UInt32 size)
-{
-  if (size == 0)
-    return true;
-  if(!_tmpFileCreated)
-  {
-    CSysString tempDirPath;
-    if(!MyGetTempPath(tempDirPath))
-      return false;
-    if (_tempFile.Create(tempDirPath, kTempFilePrefixString, _tmpFileName) == 0)
-      return false;
-    // _outFile.SetOpenCreationDispositionCreateAlways();
-    if(!_outFile.Create(_tmpFileName, true))
-      return false;
-    _tmpFileCreated = true;
-  }
-  UInt32 processedSize;
-  if(!_outFile.Write(data, size, processedSize))
-    return false;
-  _fileSize += processedSize;
-  return (processedSize == size);
-}
-
-bool CInOutTempBuffer::FlushWrite()
-{
-  return _outFile.Close();
-}
-
-bool CInOutTempBuffer::Write(const void *data, UInt32 size)
-{
-  if(_bufferPosition < kTmpBufferMemorySize)
-  {
-    UInt32 curSize = MyMin(kTmpBufferMemorySize - _bufferPosition, size);
-    memmove(_buffer + _bufferPosition, (const Byte *)data, curSize);
-    _bufferPosition += curSize;
-    size -= curSize;
-    data = ((const Byte *)data) + curSize;
-    _fileSize += curSize;
-  }
-  return WriteToFile(data, size);
-}
-
-bool CInOutTempBuffer::InitReading()
-{
-  _currentPositionInBuffer = 0;
-  if(_tmpFileCreated)
-    return _inFile.Open(_tmpFileName);
-  return true;
-}
-
-HRESULT CInOutTempBuffer::WriteToStream(ISequentialOutStream *stream)
-{
-  if (_currentPositionInBuffer < _bufferPosition)
-  {
-    UInt32 sizeToWrite = _bufferPosition - _currentPositionInBuffer;
-    RINOK(WriteStream(stream, _buffer + _currentPositionInBuffer, sizeToWrite));
-    _currentPositionInBuffer += sizeToWrite;
-  }
-  if (!_tmpFileCreated)
-    return true;
-  for (;;)
-  {
-    UInt32 localProcessedSize;
-    if (!_inFile.ReadPart(_buffer, kTmpBufferMemorySize, localProcessedSize))
-      return E_FAIL;
-    if (localProcessedSize == 0)
-      return S_OK;
-    RINOK(WriteStream(stream, _buffer, localProcessedSize));
-  }
-}
-
-STDMETHODIMP CSequentialOutTempBufferImp::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
-  if (!_buffer->Write(data, size))
-  {
-    if (processedSize != NULL)
-      *processedSize = 0;
-    return E_FAIL;
-  }
-  if (processedSize != NULL)
-    *processedSize = size;
-  return S_OK;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/InOutTempBuffer.h b/third_party/lzma/v4_65/files/CPP/7zip/Common/InOutTempBuffer.h
deleted file mode 100644
index e1e0e97..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/InOutTempBuffer.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// Util/InOutTempBuffer.h
-
-#ifndef __IN_OUT_TEMP_BUFFER_H
-#define __IN_OUT_TEMP_BUFFER_H
-
-#include "../../Windows/FileIO.h"
-#include "../../Windows/FileDir.h"
-#include "../../Common/MyCom.h"
-
-#include "../IStream.h"
-
-class CInOutTempBuffer
-{
-  NWindows::NFile::NDirectory::CTempFile _tempFile;
-  NWindows::NFile::NIO::COutFile _outFile;
-  NWindows::NFile::NIO::CInFile _inFile;
-  Byte *_buffer;
-  UInt32 _bufferPosition;
-  UInt32 _currentPositionInBuffer;
-  CSysString _tmpFileName;
-  bool _tmpFileCreated;
-
-  UInt64 _fileSize;
-
-  bool WriteToFile(const void *data, UInt32 size);
-public:
-  CInOutTempBuffer();
-  ~CInOutTempBuffer();
-  void Create();
-
-  void InitWriting();
-  bool Write(const void *data, UInt32 size);
-  UInt64 GetDataSize() const { return _fileSize; }
-  bool FlushWrite();
-  bool InitReading();
-  HRESULT WriteToStream(ISequentialOutStream *stream);
-};
-
-class CSequentialOutTempBufferImp:
-  public ISequentialOutStream,
-  public CMyUnknownImp
-{
-  CInOutTempBuffer *_buffer;
-public:
-  // CSequentialOutStreamImp(): _size(0) {}
-  // UInt32 _size;
-  void Init(CInOutTempBuffer *buffer)  { _buffer = buffer; }
-  // UInt32 GetSize() const { return _size; }
-
-  MY_UNKNOWN_IMP
-
-  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/LimitedStreams.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Common/LimitedStreams.cpp
deleted file mode 100644
index 490aa37..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/LimitedStreams.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-// LimitedStreams.cpp
-
-#include "StdAfx.h"
-
-#include "LimitedStreams.h"
-#include "../../Common/Defs.h"
-
-STDMETHODIMP CLimitedSequentialInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
-  UInt32 realProcessedSize = 0;
-  UInt32 sizeToRead = (UInt32)MyMin((_size - _pos), (UInt64)size);
-  HRESULT result = S_OK;
-  if (sizeToRead > 0)
-  {
-    result = _stream->Read(data, sizeToRead, &realProcessedSize);
-    _pos += realProcessedSize;
-    if (realProcessedSize == 0)
-      _wasFinished = true;
-  }
-  if(processedSize != NULL)
-    *processedSize = realProcessedSize;
-  return result;
-}
-
-STDMETHODIMP CLimitedSequentialOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
-  HRESULT result = S_OK;
-  if (processedSize != NULL)
-    *processedSize = 0;
-  if (size > _size)
-  {
-    size = (UInt32)_size;
-    if (size == 0)
-    {
-      _overflow = true;
-      return E_FAIL;
-    }
-  }
-  if (_stream)
-    result = _stream->Write(data, size, &size);
-  _size -= size;
-  if (processedSize != NULL)
-    *processedSize = size;
-  return result;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/LimitedStreams.h b/third_party/lzma/v4_65/files/CPP/7zip/Common/LimitedStreams.h
deleted file mode 100644
index 9bfdc8e..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/LimitedStreams.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// LimitedStreams.h
-
-#ifndef __LIMITEDSTREAMS_H
-#define __LIMITEDSTREAMS_H
-
-#include "../../Common/MyCom.h"
-#include "../IStream.h"
-
-class CLimitedSequentialInStream:
-  public ISequentialInStream,
-  public CMyUnknownImp
-{
-  CMyComPtr<ISequentialInStream> _stream;
-  UInt64 _size;
-  UInt64 _pos;
-  bool _wasFinished;
-public:
-  void SetStream(ISequentialInStream *stream) { _stream = stream; }
-  void Init(UInt64 streamSize)
-  {
-    _size = streamSize;
-    _pos = 0;
-    _wasFinished = false;
-  }
- 
-  MY_UNKNOWN_IMP
-
-  STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-  UInt64 GetSize() const { return _pos; }
-  bool WasFinished() const { return _wasFinished; }
-};
-
-class CLimitedSequentialOutStream:
-  public ISequentialOutStream,
-  public CMyUnknownImp
-{
-  CMyComPtr<ISequentialOutStream> _stream;
-  UInt64 _size;
-  bool _overflow;
-public:
-  MY_UNKNOWN_IMP
-  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-  void SetStream(ISequentialOutStream *stream) { _stream = stream; }
-  void ReleaseStream() { _stream.Release(); }
-  void Init(UInt64 size)
-  {
-    _size = size;
-    _overflow = false;
-  }
-  bool IsFinishedOK() const { return (_size == 0 && !_overflow); }
-  UInt64 GetRem() const { return _size; }
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/LockedStream.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Common/LockedStream.cpp
deleted file mode 100644
index f05601c..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/LockedStream.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-// LockedStream.cpp
-
-#include "StdAfx.h"
-
-#include "LockedStream.h"
-
-HRESULT CLockedInStream::Read(UInt64 startPos, void *data, UInt32 size,
-  UInt32 *processedSize)
-{
-  NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
-  RINOK(_stream->Seek(startPos, STREAM_SEEK_SET, NULL));
-  return _stream->Read(data, size, processedSize);
-}
-
-STDMETHODIMP CLockedSequentialInStreamImp::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
-  UInt32 realProcessedSize = 0;
-  HRESULT result = _lockedInStream->Read(_pos, data, size, &realProcessedSize);
-  _pos += realProcessedSize;
-  if (processedSize != NULL)
-    *processedSize = realProcessedSize;
-  return result;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/LockedStream.h b/third_party/lzma/v4_65/files/CPP/7zip/Common/LockedStream.h
deleted file mode 100644
index 486e422..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/LockedStream.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// LockedStream.h
-
-#ifndef __LOCKEDSTREAM_H
-#define __LOCKEDSTREAM_H
-
-#include "../../Windows/Synchronization.h"
-#include "../../Common/MyCom.h"
-#include "../IStream.h"
-
-class CLockedInStream
-{
-  CMyComPtr<IInStream> _stream;
-  NWindows::NSynchronization::CCriticalSection _criticalSection;
-public:
-  void Init(IInStream *stream)
-    { _stream = stream; }
-  HRESULT Read(UInt64 startPos, void *data, UInt32 size, UInt32 *processedSize);
-};
-
-class CLockedSequentialInStreamImp:
-  public ISequentialInStream,
-  public CMyUnknownImp
-{
-  CLockedInStream *_lockedInStream;
-  UInt64 _pos;
-public:
-  void Init(CLockedInStream *lockedInStream, UInt64 startPos)
-  {
-    _lockedInStream = lockedInStream;
-    _pos = startPos;
-  }
-
-  MY_UNKNOWN_IMP
-
-  STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/MethodId.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Common/MethodId.cpp
deleted file mode 100644
index b797b68..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/MethodId.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// MethodId.cpp
-
-#include "StdAfx.h"
-
-#include "MethodId.h"
-#include "../../Common/MyString.h"
-
-static inline wchar_t GetHex(Byte value)
-{
-  return (wchar_t)((value < 10) ? ('0' + value) : ('A' + (value - 10)));
-}
-
-UString ConvertMethodIdToString(UInt64 id)
-{
-  wchar_t s[32];
-  int len = 32;
-  s[--len] = 0;
-  do
-  {
-    s[--len] = GetHex((Byte)id & 0xF);
-    id >>= 4;
-    s[--len] = GetHex((Byte)id & 0xF);
-    id >>= 4;
-  }
-  while (id != 0);
-  return s + len;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/MethodId.h b/third_party/lzma/v4_65/files/CPP/7zip/Common/MethodId.h
deleted file mode 100644
index 54ebc9f..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/MethodId.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// MethodId.h
-
-#ifndef __7Z_METHOD_ID_H
-#define __7Z_METHOD_ID_H
-
-#include "../../Common/Types.h"
-
-typedef UInt64 CMethodId;
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/MethodProps.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Common/MethodProps.cpp
deleted file mode 100644
index 86adc6b..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/MethodProps.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-// MethodProps.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-#include "MethodProps.h"
-
-static UInt64 k_LZMA = 0x030101;
-// static UInt64 k_LZMA2 = 0x030102;
-
-HRESULT SetMethodProperties(const CMethod &method, const UInt64 *inSizeForReduce, IUnknown *coder)
-{
-  bool tryReduce = false;
-  UInt32 reducedDictionarySize = 1 << 10;
-  if (inSizeForReduce != 0 && (method.Id == k_LZMA /* || methodFull.MethodID == k_LZMA2 */))
-  {
-    for (;;)
-    {
-      const UInt32 step = (reducedDictionarySize >> 1);
-      if (reducedDictionarySize >= *inSizeForReduce)
-      {
-        tryReduce = true;
-        break;
-      }
-      reducedDictionarySize += step;
-      if (reducedDictionarySize >= *inSizeForReduce)
-      {
-        tryReduce = true;
-        break;
-      }
-      if (reducedDictionarySize >= ((UInt32)3 << 30))
-        break;
-      reducedDictionarySize += step;
-    }
-  }
-
-  {
-    int numProps = method.Props.Size();
-    CMyComPtr<ICompressSetCoderProperties> setCoderProperties;
-    coder->QueryInterface(IID_ICompressSetCoderProperties, (void **)&setCoderProperties);
-    if (setCoderProperties == NULL)
-    {
-      if (numProps != 0)
-        return E_INVALIDARG;
-    }
-    else
-    {
-      CRecordVector<PROPID> propIDs;
-      NWindows::NCOM::CPropVariant *values = new NWindows::NCOM::CPropVariant[numProps];
-      HRESULT res = S_OK;
-      try
-      {
-        for (int i = 0; i < numProps; i++)
-        {
-          const CProp &prop = method.Props[i];
-          propIDs.Add(prop.Id);
-          NWindows::NCOM::CPropVariant &value = values[i];
-          value = prop.Value;
-          // if (tryReduce && prop.Id == NCoderPropID::kDictionarySize && value.vt == VT_UI4 && reducedDictionarySize < value.ulVal)
-          if (tryReduce)
-            if (prop.Id == NCoderPropID::kDictionarySize)
-              if (value.vt == VT_UI4)
-                if (reducedDictionarySize < value.ulVal)
-            value.ulVal = reducedDictionarySize;
-        }
-        CMyComPtr<ICompressSetCoderProperties> setCoderProperties;
-        coder->QueryInterface(IID_ICompressSetCoderProperties, (void **)&setCoderProperties);
-        res = setCoderProperties->SetCoderProperties(&propIDs.Front(), values, numProps);
-      }
-      catch(...)
-      {
-        delete []values;
-        throw;
-      }
-      delete []values;
-      RINOK(res);
-    }
-  }
- 
-  /*
-  CMyComPtr<ICompressWriteCoderProperties> writeCoderProperties;
-  coder->QueryInterface(IID_ICompressWriteCoderProperties, (void **)&writeCoderProperties);
-  if (writeCoderProperties != NULL)
-  {
-    CSequentialOutStreamImp *outStreamSpec = new CSequentialOutStreamImp;
-    CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
-    outStreamSpec->Init();
-    RINOK(writeCoderProperties->WriteCoderProperties(outStream));
-    size_t size = outStreamSpec->GetSize();
-    filterProps.SetCapacity(size);
-    memmove(filterProps, outStreamSpec->GetBuffer(), size);
-  }
-  */
-  return S_OK;
-}
-
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/MethodProps.h b/third_party/lzma/v4_65/files/CPP/7zip/Common/MethodProps.h
deleted file mode 100644
index c0761c5..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/MethodProps.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// MethodProps.h
-
-#ifndef __7Z_METHOD_PROPS_H
-#define __7Z_METHOD_PROPS_H
-
-#include "../../Common/MyVector.h"
-
-#include "../../Windows/PropVariant.h"
-
-#include "MethodId.h"
-
-struct CProp
-{
-  PROPID Id;
-  NWindows::NCOM::CPropVariant Value;
-};
-
-struct CMethod
-{
-  CMethodId Id;
-  CObjectVector<CProp> Props;
-};
-
-struct CMethodsMode
-{
-  CObjectVector<CMethod> Methods;
-  #ifdef COMPRESS_MT
-  UInt32 NumThreads;
-  #endif
-
-  CMethodsMode()
-      #ifdef COMPRESS_MT
-      : NumThreads(1)
-      #endif
-  {}
-  bool IsEmpty() const { return Methods.IsEmpty() ; }
-};
-
-HRESULT SetMethodProperties(const CMethod &method, const UInt64 *inSizeForReduce, IUnknown *coder);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/OffsetStream.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Common/OffsetStream.cpp
deleted file mode 100644
index 24fcf16..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/OffsetStream.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-// OffsetStream.cpp
-
-#include "StdAfx.h"
-
-#include "Common/Defs.h"
-#include "OffsetStream.h"
-
-HRESULT COffsetOutStream::Init(IOutStream *stream, UInt64 offset)
-{
-  _offset = offset;
-  _stream = stream;
-  return _stream->Seek(offset, STREAM_SEEK_SET, NULL);
-}
-
-STDMETHODIMP COffsetOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
-  return _stream->Write(data, size, processedSize);
-}
-
-STDMETHODIMP COffsetOutStream::Seek(Int64 offset, UInt32 seekOrigin,
-    UInt64 *newPosition)
-{
-  UInt64 absoluteNewPosition;
-  if (seekOrigin == STREAM_SEEK_SET)
-    offset += _offset;
-  HRESULT result = _stream->Seek(offset, seekOrigin, &absoluteNewPosition);
-  if (newPosition != NULL)
-    *newPosition = absoluteNewPosition - _offset;
-  return result;
-}
-
-STDMETHODIMP COffsetOutStream::SetSize(Int64 newSize)
-{
-  return _stream->SetSize(_offset + newSize);
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/OffsetStream.h b/third_party/lzma/v4_65/files/CPP/7zip/Common/OffsetStream.h
deleted file mode 100644
index 5a69404..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/OffsetStream.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// OffsetStream.h
-
-#ifndef __OFFSETSTREAM_H
-#define __OFFSETSTREAM_H
-
-#include "Common/MyCom.h"
-#include "../IStream.h"
-
-class COffsetOutStream:
-  public IOutStream,
-  public CMyUnknownImp
-{
-  UInt64 _offset;
-  CMyComPtr<IOutStream> _stream;
-public:
-  HRESULT Init(IOutStream *stream, UInt64 offset);
-  
-  MY_UNKNOWN_IMP
-
-  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-  STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
-  STDMETHOD(SetSize)(Int64 newSize);
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/OutBuffer.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Common/OutBuffer.cpp
deleted file mode 100644
index 998525c..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/OutBuffer.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-// OutByte.cpp
-
-#include "StdAfx.h"
-
-#include "OutBuffer.h"
-
-extern "C"
-{
-  #include "../../../C/Alloc.h"
-}
-
-bool COutBuffer::Create(UInt32 bufferSize)
-{
-  const UInt32 kMinBlockSize = 1;
-  if (bufferSize < kMinBlockSize)
-    bufferSize = kMinBlockSize;
-  if (_buffer != 0 && _bufferSize == bufferSize)
-    return true;
-  Free();
-  _bufferSize = bufferSize;
-  _buffer = (Byte *)::MidAlloc(bufferSize);
-  return (_buffer != 0);
-}
-
-void COutBuffer::Free()
-{
-  ::MidFree(_buffer);
-  _buffer = 0;
-}
-
-void COutBuffer::SetStream(ISequentialOutStream *stream)
-{
-  _stream = stream;
-}
-
-void COutBuffer::Init()
-{
-  _streamPos = 0;
-  _limitPos = _bufferSize;
-  _pos = 0;
-  _processedSize = 0;
-  _overDict = false;
-  #ifdef _NO_EXCEPTIONS
-  ErrorCode = S_OK;
-  #endif
-}
-
-UInt64 COutBuffer::GetProcessedSize() const
-{
-  UInt64 res = _processedSize + _pos - _streamPos;
-  if (_streamPos > _pos)
-    res += _bufferSize;
-  return res;
-}
-
-
-HRESULT COutBuffer::FlushPart()
-{
-  // _streamPos < _bufferSize
-  UInt32 size = (_streamPos >= _pos) ? (_bufferSize - _streamPos) : (_pos - _streamPos);
-  HRESULT result = S_OK;
-  #ifdef _NO_EXCEPTIONS
-  result = ErrorCode;
-  #endif
-  if (_buffer2 != 0)
-  {
-    memmove(_buffer2, _buffer + _streamPos, size);
-    _buffer2 += size;
-  }
-
-  if (_stream != 0
-      #ifdef _NO_EXCEPTIONS
-      && (ErrorCode == S_OK)
-      #endif
-     )
-  {
-    UInt32 processedSize = 0;
-    result = _stream->Write(_buffer + _streamPos, size, &processedSize);
-    size = processedSize;
-  }
-  _streamPos += size;
-  if (_streamPos == _bufferSize)
-    _streamPos = 0;
-  if (_pos == _bufferSize)
-  {
-    _overDict = true;
-    _pos = 0;
-  }
-  _limitPos = (_streamPos > _pos) ? _streamPos : _bufferSize;
-  _processedSize += size;
-  return result;
-}
-
-HRESULT COutBuffer::Flush()
-{
-  #ifdef _NO_EXCEPTIONS
-  if (ErrorCode != S_OK)
-    return ErrorCode;
-  #endif
-
-  while(_streamPos != _pos)
-  {
-    HRESULT result = FlushPart();
-    if (result != S_OK)
-      return result;
-  }
-  return S_OK;
-}
-
-void COutBuffer::FlushWithCheck()
-{
-  HRESULT result = Flush();
-  #ifdef _NO_EXCEPTIONS
-  ErrorCode = result;
-  #else
-  if (result != S_OK)
-    throw COutBufferException(result);
-  #endif
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/OutBuffer.h b/third_party/lzma/v4_65/files/CPP/7zip/Common/OutBuffer.h
deleted file mode 100644
index 62e77ca..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/OutBuffer.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// OutBuffer.h
-
-#ifndef __OUTBUFFER_H
-#define __OUTBUFFER_H
-
-#include "../IStream.h"
-#include "../../Common/MyCom.h"
-#include "../../Common/MyException.h"
-
-#ifndef _NO_EXCEPTIONS
-struct COutBufferException: public CSystemException
-{
-  COutBufferException(HRESULT errorCode): CSystemException(errorCode) {}
-};
-#endif
-
-class COutBuffer
-{
-protected:
-  Byte *_buffer;
-  UInt32 _pos;
-  UInt32 _limitPos;
-  UInt32 _streamPos;
-  UInt32 _bufferSize;
-  CMyComPtr<ISequentialOutStream> _stream;
-  UInt64 _processedSize;
-  Byte  *_buffer2;
-  bool _overDict;
-
-  HRESULT FlushPart();
-public:
-  #ifdef _NO_EXCEPTIONS
-  HRESULT ErrorCode;
-  #endif
-
-  COutBuffer(): _buffer(0), _pos(0), _stream(0), _buffer2(0) {}
-  ~COutBuffer() { Free(); }
-  
-  bool Create(UInt32 bufferSize);
-  void Free();
-
-  void SetMemStream(Byte *buffer) { _buffer2 = buffer; }
-  void SetStream(ISequentialOutStream *stream);
-  void Init();
-  HRESULT Flush();
-  void FlushWithCheck();
-  void ReleaseStream() {  _stream.Release(); }
-
-  void WriteByte(Byte b)
-  {
-    _buffer[_pos++] = b;
-    if(_pos == _limitPos)
-      FlushWithCheck();
-  }
-  void WriteBytes(const void *data, size_t size)
-  {
-    for (size_t i = 0; i < size; i++)
-      WriteByte(((const Byte *)data)[i]);
-  }
-
-  UInt64 GetProcessedSize() const;
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/ProgressUtils.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Common/ProgressUtils.cpp
deleted file mode 100644
index f24ff6b..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/ProgressUtils.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-// ProgressUtils.h
-
-#include "StdAfx.h"
-
-#include "ProgressUtils.h"
-
-CLocalProgress::CLocalProgress()
-{
-  ProgressOffset = InSize = OutSize = 0;
-  SendRatio = SendProgress = true;
-}
-
-void CLocalProgress::Init(IProgress *progress, bool inSizeIsMain)
-{
-  _ratioProgress.Release();
-  _progress = progress;
-  _progress.QueryInterface(IID_ICompressProgressInfo, &_ratioProgress);
-  _inSizeIsMain = inSizeIsMain;
-}
-
-STDMETHODIMP CLocalProgress::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
-{
-  UInt64 inSizeNew = InSize, outSizeNew = OutSize;
-  if (inSize)
-    inSizeNew += (*inSize);
-  if (outSize)
-    outSizeNew += (*outSize);
-  if (SendRatio && _ratioProgress)
-  {
-    RINOK(_ratioProgress->SetRatioInfo(&inSizeNew, &outSizeNew));
-  }
-  inSizeNew += ProgressOffset;
-  outSizeNew += ProgressOffset;
-  if (SendProgress)
-    return _progress->SetCompleted(_inSizeIsMain ? &inSizeNew : &outSizeNew);
-  return S_OK;
-}
-
-HRESULT CLocalProgress::SetCur()
-{
-  return SetRatioInfo(NULL, NULL);
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/ProgressUtils.h b/third_party/lzma/v4_65/files/CPP/7zip/Common/ProgressUtils.h
deleted file mode 100644
index bae5395..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/ProgressUtils.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// ProgressUtils.h
-
-#ifndef __PROGRESSUTILS_H
-#define __PROGRESSUTILS_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-#include "../IProgress.h"
-
-class CLocalProgress:
-  public ICompressProgressInfo,
-  public CMyUnknownImp
-{
-  CMyComPtr<IProgress> _progress;
-  CMyComPtr<ICompressProgressInfo> _ratioProgress;
-  bool _inSizeIsMain;
-public:
-  UInt64 ProgressOffset;
-  UInt64 InSize;
-  UInt64 OutSize;
-  bool SendRatio;
-  bool SendProgress;
-
-  CLocalProgress();
-  void Init(IProgress *progress, bool inSizeIsMain);
-  HRESULT SetCur();
-
-  MY_UNKNOWN_IMP
-
-  STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/RegisterArc.h b/third_party/lzma/v4_65/files/CPP/7zip/Common/RegisterArc.h
deleted file mode 100644
index ba5ed7c..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/RegisterArc.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// RegisterArc.h
-
-#ifndef __REGISTERARC_H
-#define __REGISTERARC_H
-
-#include "../Archive/IArchive.h"
-
-typedef IInArchive * (*CreateInArchiveP)();
-typedef IOutArchive * (*CreateOutArchiveP)();
-
-struct CArcInfo
-{
-  const wchar_t *Name;
-  const wchar_t *Ext;
-  const wchar_t *AddExt;
-  Byte ClassId;
-  Byte Signature[16];
-  int SignatureSize;
-  bool KeepName;
-  CreateInArchiveP CreateInArchive;
-  CreateOutArchiveP CreateOutArchive;
-};
-
-void RegisterArc(const CArcInfo *arcInfo);
-
-#define REGISTER_ARC_NAME(x) CRegister ## x
-
-#define REGISTER_ARC_DEC_SIG(x) struct REGISTER_ARC_NAME(x) { \
-    REGISTER_ARC_NAME(x)() { g_ArcInfo.Signature[0]--; RegisterArc(&g_ArcInfo); }}; \
-    static REGISTER_ARC_NAME(x) g_RegisterArc;
-
-#define REGISTER_ARC(x) struct REGISTER_ARC_NAME(x) { \
-    REGISTER_ARC_NAME(x)() { RegisterArc(&g_ArcInfo); }}; \
-    static REGISTER_ARC_NAME(x) g_RegisterArc;
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/RegisterCodec.h b/third_party/lzma/v4_65/files/CPP/7zip/Common/RegisterCodec.h
deleted file mode 100644
index 786b4a4..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/RegisterCodec.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// RegisterCodec.h
-
-#ifndef __REGISTERCODEC_H
-#define __REGISTERCODEC_H
-
-#include "../Common/MethodId.h"
-
-typedef void * (*CreateCodecP)();
-struct CCodecInfo
-{
-  CreateCodecP CreateDecoder;
-  CreateCodecP CreateEncoder;
-  CMethodId Id;
-  const wchar_t *Name;
-  UInt32 NumInStreams;
-  bool IsFilter;
-};
-
-void RegisterCodec(const CCodecInfo *codecInfo);
-
-#define REGISTER_CODEC_NAME(x) CRegisterCodec ## x
-
-#define REGISTER_CODEC(x) struct REGISTER_CODEC_NAME(x) { \
-    REGISTER_CODEC_NAME(x)() { RegisterCodec(&g_CodecInfo); }}; \
-    static REGISTER_CODEC_NAME(x) g_RegisterCodec;
-
-#define REGISTER_CODECS_NAME(x) CRegisterCodecs ## x
-#define REGISTER_CODECS(x) struct REGISTER_CODECS_NAME(x) { \
-    REGISTER_CODECS_NAME(x)() { for (int i = 0; i < sizeof(g_CodecsInfo) / sizeof(g_CodecsInfo[0]); i++) \
-    RegisterCodec(&g_CodecsInfo[i]); }}; \
-    static REGISTER_CODECS_NAME(x) g_RegisterCodecs;
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/StdAfx.h b/third_party/lzma/v4_65/files/CPP/7zip/Common/StdAfx.h
deleted file mode 100644
index ef555ec..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/StdAfx.h
+++ /dev/null
@@ -1,9 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../Common/MyWindows.h"
-#include "../../Common/NewHandler.h"
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/StreamBinder.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Common/StreamBinder.cpp
deleted file mode 100644
index 03f8862..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/StreamBinder.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-// StreamBinder.cpp
-
-#include "StdAfx.h"
-
-#include "StreamBinder.h"
-#include "../../Common/Defs.h"
-#include "../../Common/MyCom.h"
-
-using namespace NWindows;
-using namespace NSynchronization;
-
-class CSequentialInStreamForBinder:
-  public ISequentialInStream,
-  public CMyUnknownImp
-{
-public:
-  MY_UNKNOWN_IMP
-
-  STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-private:
-  CStreamBinder *m_StreamBinder;
-public:
-  ~CSequentialInStreamForBinder() { m_StreamBinder->CloseRead(); }
-  void SetBinder(CStreamBinder *streamBinder) { m_StreamBinder = streamBinder; }
-};
-
-STDMETHODIMP CSequentialInStreamForBinder::Read(void *data, UInt32 size, UInt32 *processedSize)
-  { return m_StreamBinder->Read(data, size, processedSize); }
-
-class CSequentialOutStreamForBinder:
-  public ISequentialOutStream,
-  public CMyUnknownImp
-{
-public:
-  MY_UNKNOWN_IMP
-
-  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-
-private:
-  CStreamBinder *m_StreamBinder;
-public:
-  ~CSequentialOutStreamForBinder() {  m_StreamBinder->CloseWrite(); }
-  void SetBinder(CStreamBinder *streamBinder) { m_StreamBinder = streamBinder; }
-};
-
-STDMETHODIMP CSequentialOutStreamForBinder::Write(const void *data, UInt32 size, UInt32 *processedSize)
-  { return m_StreamBinder->Write(data, size, processedSize); }
-
-
-//////////////////////////
-// CStreamBinder
-// (_thereAreBytesToReadEvent && _bufferSize == 0) means that stream is finished.
-
-HRes CStreamBinder::CreateEvents()
-{
-  RINOK(_allBytesAreWritenEvent.Create(true));
-  RINOK(_thereAreBytesToReadEvent.Create());
-  return _readStreamIsClosedEvent.Create();
-}
-
-void CStreamBinder::ReInit()
-{
-  _thereAreBytesToReadEvent.Reset();
-  _readStreamIsClosedEvent.Reset();
-  ProcessedSize = 0;
-}
-
-
-  
-void CStreamBinder::CreateStreams(ISequentialInStream **inStream,
-      ISequentialOutStream **outStream)
-{
-  CSequentialInStreamForBinder *inStreamSpec = new
-      CSequentialInStreamForBinder;
-  CMyComPtr<ISequentialInStream> inStreamLoc(inStreamSpec);
-  inStreamSpec->SetBinder(this);
-  *inStream = inStreamLoc.Detach();
-
-  CSequentialOutStreamForBinder *outStreamSpec = new
-      CSequentialOutStreamForBinder;
-  CMyComPtr<ISequentialOutStream> outStreamLoc(outStreamSpec);
-  outStreamSpec->SetBinder(this);
-  *outStream = outStreamLoc.Detach();
-
-  _buffer = NULL;
-  _bufferSize= 0;
-  ProcessedSize = 0;
-}
-
-HRESULT CStreamBinder::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
-  UInt32 sizeToRead = size;
-  if (size > 0)
-  {
-    RINOK(_thereAreBytesToReadEvent.Lock());
-    sizeToRead = MyMin(_bufferSize, size);
-    if (_bufferSize > 0)
-    {
-      memcpy(data, _buffer, sizeToRead);
-      _buffer = ((const Byte *)_buffer) + sizeToRead;
-      _bufferSize -= sizeToRead;
-      if (_bufferSize == 0)
-      {
-        _thereAreBytesToReadEvent.Reset();
-        _allBytesAreWritenEvent.Set();
-      }
-    }
-  }
-  if (processedSize != NULL)
-    *processedSize = sizeToRead;
-  ProcessedSize += sizeToRead;
-  return S_OK;
-}
-
-void CStreamBinder::CloseRead()
-{
-  _readStreamIsClosedEvent.Set();
-}
-
-HRESULT CStreamBinder::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
-  if (size > 0)
-  {
-    _buffer = data;
-    _bufferSize = size;
-    _allBytesAreWritenEvent.Reset();
-    _thereAreBytesToReadEvent.Set();
-
-    HANDLE events[2];
-    events[0] = _allBytesAreWritenEvent;
-    events[1] = _readStreamIsClosedEvent;
-    DWORD waitResult = ::WaitForMultipleObjects(2, events, FALSE, INFINITE);
-    if (waitResult != WAIT_OBJECT_0 + 0)
-    {
-      // ReadingWasClosed = true;
-      return S_FALSE;
-    }
-    // if(!_allBytesAreWritenEvent.Lock())
-    //   return E_FAIL;
-  }
-  if (processedSize != NULL)
-    *processedSize = size;
-  return S_OK;
-}
-
-void CStreamBinder::CloseWrite()
-{
-  // _bufferSize must be = 0
-  _thereAreBytesToReadEvent.Set();
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/StreamBinder.h b/third_party/lzma/v4_65/files/CPP/7zip/Common/StreamBinder.h
deleted file mode 100644
index 48f68e6..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/StreamBinder.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// StreamBinder.h
-
-#ifndef __STREAMBINDER_H
-#define __STREAMBINDER_H
-
-#include "../IStream.h"
-#include "../../Windows/Synchronization.h"
-
-class CStreamBinder
-{
-  NWindows::NSynchronization::CManualResetEvent _allBytesAreWritenEvent;
-  NWindows::NSynchronization::CManualResetEvent _thereAreBytesToReadEvent;
-  NWindows::NSynchronization::CManualResetEvent _readStreamIsClosedEvent;
-  UInt32 _bufferSize;
-  const void *_buffer;
-public:
-  // bool ReadingWasClosed;
-  UInt64 ProcessedSize;
-  CStreamBinder() {}
-  HRes CreateEvents();
-
-  void CreateStreams(ISequentialInStream **inStream,
-      ISequentialOutStream **outStream);
-  HRESULT Read(void *data, UInt32 size, UInt32 *processedSize);
-  void CloseRead();
-
-  HRESULT Write(const void *data, UInt32 size, UInt32 *processedSize);
-  void CloseWrite();
-  void ReInit();
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/StreamObjects.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Common/StreamObjects.cpp
deleted file mode 100644
index e043e56..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/StreamObjects.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-// StreamObjects.cpp
-
-#include "StdAfx.h"
-
-#include "StreamObjects.h"
-#include "../../Common/Defs.h"
-
-
-STDMETHODIMP CSequentialInStreamImp::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
-  size_t rem = _size - _pos;
-  if (size < rem)
-    rem = (size_t)size;
-  memcpy(data, _dataPointer + _pos, rem);
-  _pos += rem;
-  if (processedSize != NULL)
-    *processedSize = (UInt32)rem;
-  return S_OK;
-}
-
-
-void CWriteBuffer::Write(const void *data, size_t size)
-{
-  size_t newCapacity = _size + size;
-  _buffer.EnsureCapacity(newCapacity);
-  memcpy(_buffer + _size, data, size);
-  _size += size;
-}
-
-STDMETHODIMP CSequentialOutStreamImp::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
-  _writeBuffer.Write(data, (size_t)size);
-  if(processedSize != NULL)
-    *processedSize = size;
-  return S_OK;
-}
-
-STDMETHODIMP CSequentialOutStreamImp2::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
-  size_t rem = _size - _pos;
-  if (size < rem)
-    rem = (size_t)size;
-  memcpy(_buffer + _pos, data, rem);
-  _pos += rem;
-  if (processedSize != NULL)
-    *processedSize = (UInt32)rem;
-  return (rem == size ? S_OK : E_FAIL);
-}
-
-STDMETHODIMP CSequentialInStreamSizeCount::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
-  UInt32 realProcessedSize;
-  HRESULT result = _stream->Read(data, size, &realProcessedSize);
-  _size += realProcessedSize;
-  if (processedSize != 0)
-    *processedSize = realProcessedSize;
-  return result;
-}
-
-STDMETHODIMP CSequentialOutStreamSizeCount::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
-  UInt32 realProcessedSize;
-  HRESULT result = _stream->Write(data, size, &realProcessedSize);
-  _size += realProcessedSize;
-  if (processedSize != 0)
-    *processedSize = realProcessedSize;
-  return result;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/StreamObjects.h b/third_party/lzma/v4_65/files/CPP/7zip/Common/StreamObjects.h
deleted file mode 100644
index a21089c..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/StreamObjects.h
+++ /dev/null
@@ -1,117 +0,0 @@
-// StreamObjects.h
-
-#ifndef __STREAMOBJECTS_H
-#define __STREAMOBJECTS_H
-
-#include "../../Common/DynamicBuffer.h"
-#include "../../Common/MyCom.h"
-#include "../IStream.h"
-
-class CSequentialInStreamImp:
-  public ISequentialInStream,
-  public CMyUnknownImp
-{
-  const Byte *_dataPointer;
-  size_t _size;
-  size_t _pos;
-
-public:
-  void Init(const Byte *dataPointer, size_t size)
-  {
-    _dataPointer = dataPointer;
-    _size = size;
-    _pos = 0;
-  }
-
-  MY_UNKNOWN_IMP
-
-  STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-};
-
-
-class CWriteBuffer
-{
-  CByteDynamicBuffer _buffer;
-  size_t _size;
-public:
-  CWriteBuffer(): _size(0) {}
-  void Init() { _size = 0;  }
-  void Write(const void *data, size_t size);
-  size_t GetSize() const { return _size; }
-  const CByteDynamicBuffer& GetBuffer() const { return _buffer; }
-};
-
-class CSequentialOutStreamImp:
-  public ISequentialOutStream,
-  public CMyUnknownImp
-{
-  CWriteBuffer _writeBuffer;
-public:
-  void Init() { _writeBuffer.Init(); }
-  size_t GetSize() const { return _writeBuffer.GetSize(); }
-  const CByteDynamicBuffer& GetBuffer() const { return _writeBuffer.GetBuffer(); }
-
-  MY_UNKNOWN_IMP
-
-  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-
-class CSequentialOutStreamImp2:
-  public ISequentialOutStream,
-  public CMyUnknownImp
-{
-  Byte *_buffer;
-  size_t _size;
-  size_t _pos;
-public:
-
-  void Init(Byte *buffer, size_t size)
-  {
-    _buffer = buffer;
-    _pos = 0;
-    _size = size;
-  }
-
-  size_t GetPos() const { return _pos; }
-
-  MY_UNKNOWN_IMP
-
-  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-
-class CSequentialInStreamSizeCount:
-  public ISequentialInStream,
-  public CMyUnknownImp
-{
-  CMyComPtr<ISequentialInStream> _stream;
-  UInt64 _size;
-public:
-  void Init(ISequentialInStream *stream)
-  {
-    _stream = stream;
-    _size = 0;
-  }
-  UInt64 GetSize() const { return _size; }
-
-  MY_UNKNOWN_IMP
-
-  STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-};
-
-class CSequentialOutStreamSizeCount:
-  public ISequentialOutStream,
-  public CMyUnknownImp
-{
-  CMyComPtr<ISequentialOutStream> _stream;
-  UInt64 _size;
-public:
-  void SetStream(ISequentialOutStream *stream) { _stream = stream; }
-  void Init() { _size = 0; }
-  UInt64 GetSize() const { return _size; }
-
-  MY_UNKNOWN_IMP
-
-  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/StreamUtils.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Common/StreamUtils.cpp
deleted file mode 100644
index 049e4aa..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/StreamUtils.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-// StreamUtils.cpp
-
-#include "StdAfx.h"
-
-#include "StreamUtils.h"
-
-static const UInt32 kBlockSize = ((UInt32)1 << 31);
-
-HRESULT ReadStream(ISequentialInStream *stream, void *data, size_t *processedSize)
-{
-  size_t size = *processedSize;
-  *processedSize = 0;
-  while (size != 0)
-  {
-    UInt32 curSize = (size < kBlockSize) ? (UInt32)size : kBlockSize;
-    UInt32 processedSizeLoc;
-    HRESULT res = stream->Read(data, curSize, &processedSizeLoc);
-    *processedSize += processedSizeLoc;
-    data = (void *)((Byte *)data + processedSizeLoc);
-    size -= processedSizeLoc;
-    RINOK(res);
-    if (processedSizeLoc == 0)
-      return S_OK;
-  }
-  return S_OK;
-}
-
-HRESULT ReadStream_FALSE(ISequentialInStream *stream, void *data, size_t size)
-{
-  size_t processedSize = size;
-  RINOK(ReadStream(stream, data, &processedSize));
-  return (size == processedSize) ? S_OK : S_FALSE;
-}
-
-HRESULT ReadStream_FAIL(ISequentialInStream *stream, void *data, size_t size)
-{
-  size_t processedSize = size;
-  RINOK(ReadStream(stream, data, &processedSize));
-  return (size == processedSize) ? S_OK : E_FAIL;
-}
-
-HRESULT WriteStream(ISequentialOutStream *stream, const void *data, size_t size)
-{
-  while (size != 0)
-  {
-    UInt32 curSize = (size < kBlockSize) ? (UInt32)size : kBlockSize;
-    UInt32 processedSizeLoc;
-    HRESULT res = stream->Write(data, curSize, &processedSizeLoc);
-    data = (const void *)((const Byte *)data + processedSizeLoc);
-    size -= processedSizeLoc;
-    RINOK(res);
-    if (processedSizeLoc == 0)
-      return E_FAIL;
-  }
-  return S_OK;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/StreamUtils.h b/third_party/lzma/v4_65/files/CPP/7zip/Common/StreamUtils.h
deleted file mode 100644
index f1cfd18..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/StreamUtils.h
+++ /dev/null
@@ -1,13 +0,0 @@
-// StreamUtils.h
-
-#ifndef __STREAMUTILS_H
-#define __STREAMUTILS_H
-
-#include "../IStream.h"
-
-HRESULT ReadStream(ISequentialInStream *stream, void *data, size_t *size);
-HRESULT ReadStream_FALSE(ISequentialInStream *stream, void *data, size_t size);
-HRESULT ReadStream_FAIL(ISequentialInStream *stream, void *data, size_t size);
-HRESULT WriteStream(ISequentialOutStream *stream, const void *data, size_t size);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/VirtThread.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Common/VirtThread.cpp
deleted file mode 100644
index f12581a..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/VirtThread.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-// VirtThread.cpp
-
-#include "StdAfx.h"
-
-#include "VirtThread.h"
-
-static THREAD_FUNC_DECL CoderThread(void *p)
-{
-  for (;;)
-  {
-    CVirtThread *t = (CVirtThread *)p;
-    t->StartEvent.Lock();
-    if (t->ExitEvent)
-      return 0;
-    t->Execute();
-    t->FinishedEvent.Set();
-  }
-}
-
-WRes CVirtThread::Create()
-{
-  RINOK(StartEvent.CreateIfNotCreated());
-  RINOK(FinishedEvent.CreateIfNotCreated());
-  StartEvent.Reset();
-  FinishedEvent.Reset();
-  ExitEvent = false;
-  if (Thread.IsCreated())
-    return S_OK;
-  return Thread.Create(CoderThread, this);
-}
-
-void CVirtThread::Start()
-{
-  ExitEvent = false;
-  StartEvent.Set();
-}
-
-CVirtThread::~CVirtThread()
-{
-  ExitEvent = true;
-  if (StartEvent.IsCreated())
-    StartEvent.Set();
-  Thread.Wait();
-}
-
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Common/VirtThread.h b/third_party/lzma/v4_65/files/CPP/7zip/Common/VirtThread.h
deleted file mode 100644
index f14a1f2..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Common/VirtThread.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// VirtThread.h
-
-#ifndef __VIRTTHREAD_H
-#define __VIRTTHREAD_H
-
-#include "../../Windows/Synchronization.h"
-#include "../../Windows/Thread.h"
-
-struct CVirtThread
-{
-  NWindows::NSynchronization::CAutoResetEvent StartEvent;
-  NWindows::NSynchronization::CAutoResetEvent FinishedEvent;
-  NWindows::CThread Thread;
-  bool ExitEvent;
-
-  ~CVirtThread();
-  WRes Create();
-  void Start();
-  void WaitFinish() { FinishedEvent.Lock(); }
-  virtual void Execute() = 0;
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/Bcj2Coder.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Compress/Bcj2Coder.cpp
deleted file mode 100644
index e1356ab..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/Bcj2Coder.cpp
+++ /dev/null
@@ -1,393 +0,0 @@
-// Bcj2Coder.cpp
-
-#include "StdAfx.h"
-
-extern "C"
-{
-#include "../../../C/Alloc.h"
-}
-
-#include "Bcj2Coder.h"
-
-namespace NCompress {
-namespace NBcj2 {
-
-inline bool IsJcc(Byte b0, Byte b1) { return (b0 == 0x0F && (b1 & 0xF0) == 0x80); }
-inline bool IsJ(Byte b0, Byte b1) { return ((b1 & 0xFE) == 0xE8 || IsJcc(b0, b1)); }
-inline unsigned GetIndex(Byte b0, Byte b1) { return ((b1 == 0xE8) ? b0 : ((b1 == 0xE9) ? 256 : 257)); }
-
-#ifndef EXTRACT_ONLY
-
-static const int kBufferSize = 1 << 17;
-
-static bool inline Test86MSByte(Byte b)
-{
-  return (b == 0 || b == 0xFF);
-}
-
-bool CEncoder::Create()
-{
-  if (!_mainStream.Create(1 << 16))
-    return false;
-  if (!_callStream.Create(1 << 20))
-    return false;
-  if (!_jumpStream.Create(1 << 20))
-    return false;
-  if (!_rangeEncoder.Create(1 << 20))
-    return false;
-  if (_buffer == 0)
-  {
-    _buffer = (Byte *)MidAlloc(kBufferSize);
-    if (_buffer == 0)
-      return false;
-  }
-  return true;
-}
-
-CEncoder::~CEncoder()
-{
-  ::MidFree(_buffer);
-}
-
-HRESULT CEncoder::Flush()
-{
-  RINOK(_mainStream.Flush());
-  RINOK(_callStream.Flush());
-  RINOK(_jumpStream.Flush());
-  _rangeEncoder.FlushData();
-  return _rangeEncoder.FlushStream();
-}
-
-const UInt32 kDefaultLimit = (1 << 24);
-
-HRESULT CEncoder::CodeReal(ISequentialInStream **inStreams,
-      const UInt64 **inSizes,
-      UInt32 numInStreams,
-      ISequentialOutStream **outStreams,
-      const UInt64 ** /* outSizes */,
-      UInt32 numOutStreams,
-      ICompressProgressInfo *progress)
-{
-  if (numInStreams != 1 || numOutStreams != 4)
-    return E_INVALIDARG;
-
-  if (!Create())
-    return E_OUTOFMEMORY;
-
-  bool sizeIsDefined = false;
-  UInt64 inSize = 0;
-  if (inSizes != NULL)
-    if (inSizes[0] != NULL)
-    {
-      inSize = *inSizes[0];
-      if (inSize <= kDefaultLimit)
-        sizeIsDefined = true;
-    }
-
-  ISequentialInStream *inStream = inStreams[0];
-
-  _mainStream.SetStream(outStreams[0]);
-  _mainStream.Init();
-  _callStream.SetStream(outStreams[1]);
-  _callStream.Init();
-  _jumpStream.SetStream(outStreams[2]);
-  _jumpStream.Init();
-  _rangeEncoder.SetStream(outStreams[3]);
-  _rangeEncoder.Init();
-  for (int i = 0; i < 256 + 2; i++)
-    _statusEncoder[i].Init();
-  CCoderReleaser releaser(this);
-
-  CMyComPtr<ICompressGetSubStreamSize> getSubStreamSize;
-  {
-    inStream->QueryInterface(IID_ICompressGetSubStreamSize, (void **)&getSubStreamSize);
-  }
-
-  UInt32 nowPos = 0;
-  UInt64 nowPos64 = 0;
-  UInt32 bufferPos = 0;
-
-  Byte prevByte = 0;
-
-  UInt64 subStreamIndex = 0;
-  UInt64 subStreamStartPos  = 0;
-  UInt64 subStreamEndPos = 0;
-
-  for (;;)
-  {
-    UInt32 processedSize = 0;
-    for (;;)
-    {
-      UInt32 size = kBufferSize - (bufferPos + processedSize);
-      UInt32 processedSizeLoc;
-      if (size == 0)
-        break;
-      RINOK(inStream->Read(_buffer + bufferPos + processedSize, size, &processedSizeLoc));
-      if (processedSizeLoc == 0)
-        break;
-      processedSize += processedSizeLoc;
-    }
-    UInt32 endPos = bufferPos + processedSize;
-    
-    if (endPos < 5)
-    {
-      // change it
-      for (bufferPos = 0; bufferPos < endPos; bufferPos++)
-      {
-        Byte b = _buffer[bufferPos];
-        _mainStream.WriteByte(b);
-        UInt32 index;
-        if (b == 0xE8)
-          index = prevByte;
-        else if (b == 0xE9)
-          index = 256;
-        else if (IsJcc(prevByte, b))
-          index = 257;
-        else
-        {
-          prevByte = b;
-          continue;
-        }
-        _statusEncoder[index].Encode(&_rangeEncoder, 0);
-        prevByte = b;
-      }
-      return Flush();
-    }
-
-    bufferPos = 0;
-
-    UInt32 limit = endPos - 5;
-    while(bufferPos <= limit)
-    {
-      Byte b = _buffer[bufferPos];
-      _mainStream.WriteByte(b);
-      if (!IsJ(prevByte, b))
-      {
-        bufferPos++;
-        prevByte = b;
-        continue;
-      }
-      Byte nextByte = _buffer[bufferPos + 4];
-      UInt32 src =
-        (UInt32(nextByte) << 24) |
-        (UInt32(_buffer[bufferPos + 3]) << 16) |
-        (UInt32(_buffer[bufferPos + 2]) << 8) |
-        (_buffer[bufferPos + 1]);
-      UInt32 dest = (nowPos + bufferPos + 5) + src;
-      // if (Test86MSByte(nextByte))
-      bool convert;
-      if (getSubStreamSize != NULL)
-      {
-        UInt64 currentPos = (nowPos64 + bufferPos);
-        while (subStreamEndPos < currentPos)
-        {
-          UInt64 subStreamSize;
-          HRESULT result = getSubStreamSize->GetSubStreamSize(subStreamIndex, &subStreamSize);
-          if (result == S_OK)
-          {
-            subStreamStartPos = subStreamEndPos;
-            subStreamEndPos += subStreamSize;
-            subStreamIndex++;
-          }
-          else if (result == S_FALSE || result == E_NOTIMPL)
-          {
-            getSubStreamSize.Release();
-            subStreamStartPos = 0;
-            subStreamEndPos = subStreamStartPos - 1;
-          }
-          else
-            return result;
-        }
-        if (getSubStreamSize == NULL)
-        {
-          if (sizeIsDefined)
-            convert = (dest < inSize);
-          else
-            convert = Test86MSByte(nextByte);
-        }
-        else if (subStreamEndPos - subStreamStartPos > kDefaultLimit)
-          convert = Test86MSByte(nextByte);
-        else
-        {
-          UInt64 dest64 = (currentPos + 5) + Int64(Int32(src));
-          convert = (dest64 >= subStreamStartPos && dest64 < subStreamEndPos);
-        }
-      }
-      else if (sizeIsDefined)
-        convert = (dest < inSize);
-      else
-        convert = Test86MSByte(nextByte);
-      unsigned index = GetIndex(prevByte, b);
-      if (convert)
-      {
-        _statusEncoder[index].Encode(&_rangeEncoder, 1);
-        bufferPos += 5;
-        COutBuffer &s = (b == 0xE8) ? _callStream : _jumpStream;
-        for (int i = 24; i >= 0; i -= 8)
-          s.WriteByte((Byte)(dest >> i));
-        prevByte = nextByte;
-      }
-      else
-      {
-        _statusEncoder[index].Encode(&_rangeEncoder, 0);
-        bufferPos++;
-        prevByte = b;
-      }
-    }
-    nowPos += bufferPos;
-    nowPos64 += bufferPos;
-
-    if (progress != NULL)
-    {
-      /*
-      const UInt64 compressedSize =
-        _mainStream.GetProcessedSize() +
-        _callStream.GetProcessedSize() +
-        _jumpStream.GetProcessedSize() +
-        _rangeEncoder.GetProcessedSize();
-      */
-      RINOK(progress->SetRatioInfo(&nowPos64, NULL));
-    }
- 
-    UInt32 i = 0;
-    while(bufferPos < endPos)
-      _buffer[i++] = _buffer[bufferPos++];
-    bufferPos = i;
-  }
-}
-
-STDMETHODIMP CEncoder::Code(ISequentialInStream **inStreams,
-      const UInt64 **inSizes,
-      UInt32 numInStreams,
-      ISequentialOutStream **outStreams,
-      const UInt64 **outSizes,
-      UInt32 numOutStreams,
-      ICompressProgressInfo *progress)
-{
-  try
-  {
-    return CodeReal(inStreams, inSizes, numInStreams,
-      outStreams, outSizes,numOutStreams, progress);
-  }
-  catch(const COutBufferException &e) { return e.ErrorCode; }
-  catch(...) { return S_FALSE; }
-}
-
-#endif
-
-HRESULT CDecoder::CodeReal(ISequentialInStream **inStreams,
-      const UInt64 ** /* inSizes */,
-      UInt32 numInStreams,
-      ISequentialOutStream **outStreams,
-      const UInt64 ** /* outSizes */,
-      UInt32 numOutStreams,
-      ICompressProgressInfo *progress)
-{
-  if (numInStreams != 4 || numOutStreams != 1)
-    return E_INVALIDARG;
-
-  if (!_mainInStream.Create(1 << 16))
-    return E_OUTOFMEMORY;
-  if (!_callStream.Create(1 << 20))
-    return E_OUTOFMEMORY;
-  if (!_jumpStream.Create(1 << 16))
-    return E_OUTOFMEMORY;
-  if (!_rangeDecoder.Create(1 << 20))
-    return E_OUTOFMEMORY;
-  if (!_outStream.Create(1 << 16))
-    return E_OUTOFMEMORY;
-
-  _mainInStream.SetStream(inStreams[0]);
-  _callStream.SetStream(inStreams[1]);
-  _jumpStream.SetStream(inStreams[2]);
-  _rangeDecoder.SetStream(inStreams[3]);
-  _outStream.SetStream(outStreams[0]);
-
-  _mainInStream.Init();
-  _callStream.Init();
-  _jumpStream.Init();
-  _rangeDecoder.Init();
-  _outStream.Init();
-
-  for (int i = 0; i < 256 + 2; i++)
-    _statusDecoder[i].Init();
-
-  CCoderReleaser releaser(this);
-
-  Byte prevByte = 0;
-  UInt32 processedBytes = 0;
-  for (;;)
-  {
-    if (processedBytes >= (1 << 20) && progress != NULL)
-    {
-      /*
-      const UInt64 compressedSize =
-        _mainInStream.GetProcessedSize() +
-        _callStream.GetProcessedSize() +
-        _jumpStream.GetProcessedSize() +
-        _rangeDecoder.GetProcessedSize();
-      */
-      const UInt64 nowPos64 = _outStream.GetProcessedSize();
-      RINOK(progress->SetRatioInfo(NULL, &nowPos64));
-      processedBytes = 0;
-    }
-    UInt32 i;
-    Byte b = 0;
-    const UInt32 kBurstSize = (1 << 18);
-    for (i = 0; i < kBurstSize; i++)
-    {
-      if (!_mainInStream.ReadByte(b))
-        return Flush();
-      _outStream.WriteByte(b);
-      if (IsJ(prevByte, b))
-        break;
-      prevByte = b;
-    }
-    processedBytes += i;
-    if (i == kBurstSize)
-      continue;
-    unsigned index = GetIndex(prevByte, b);
-    if (_statusDecoder[index].Decode(&_rangeDecoder) == 1)
-    {
-      UInt32 src = 0;
-      CInBuffer &s = (b == 0xE8) ? _callStream : _jumpStream;
-      for (int i = 0; i < 4; i++)
-      {
-        Byte b0;
-        if(!s.ReadByte(b0))
-          return S_FALSE;
-        src <<= 8;
-        src |= ((UInt32)b0);
-      }
-      UInt32 dest = src - (UInt32(_outStream.GetProcessedSize()) + 4) ;
-      _outStream.WriteByte((Byte)(dest));
-      _outStream.WriteByte((Byte)(dest >> 8));
-      _outStream.WriteByte((Byte)(dest >> 16));
-      _outStream.WriteByte((Byte)(dest >> 24));
-      prevByte = (Byte)(dest >> 24);
-      processedBytes += 4;
-    }
-    else
-      prevByte = b;
-  }
-}
-
-STDMETHODIMP CDecoder::Code(ISequentialInStream **inStreams,
-      const UInt64 **inSizes,
-      UInt32 numInStreams,
-      ISequentialOutStream **outStreams,
-      const UInt64 **outSizes,
-      UInt32 numOutStreams,
-      ICompressProgressInfo *progress)
-{
-  try
-  {
-    return CodeReal(inStreams, inSizes, numInStreams,
-        outStreams, outSizes,numOutStreams, progress);
-  }
-  catch(const CInBufferException &e) { return e.ErrorCode; }
-  catch(const COutBufferException &e) { return e.ErrorCode; }
-  catch(...) { return S_FALSE; }
-}
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/Bcj2Coder.h b/third_party/lzma/v4_65/files/CPP/7zip/Compress/Bcj2Coder.h
deleted file mode 100644
index b8b1e7a..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/Bcj2Coder.h
+++ /dev/null
@@ -1,125 +0,0 @@
-// Bcj2Coder.h
-
-#ifndef __COMPRESS_BCJ2_CODER_H
-#define __COMPRESS_BCJ2_CODER_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-#include "RangeCoderBit.h"
-
-namespace NCompress {
-namespace NBcj2 {
-
-const int kNumMoveBits = 5;
-
-#ifndef EXTRACT_ONLY
-
-class CEncoder:
-  public ICompressCoder2,
-  public CMyUnknownImp
-{
-  Byte *_buffer;
-public:
-  CEncoder(): _buffer(0) {};
-  ~CEncoder();
-  bool Create();
-
-  COutBuffer _mainStream;
-  COutBuffer _callStream;
-  COutBuffer _jumpStream;
-  NCompress::NRangeCoder::CEncoder _rangeEncoder;
-  NCompress::NRangeCoder::CBitEncoder<kNumMoveBits> _statusEncoder[256 + 2];
-
-  HRESULT Flush();
-  void ReleaseStreams()
-  {
-    _mainStream.ReleaseStream();
-    _callStream.ReleaseStream();
-    _jumpStream.ReleaseStream();
-    _rangeEncoder.ReleaseStream();
-  }
-
-  class CCoderReleaser
-  {
-    CEncoder *_coder;
-  public:
-    CCoderReleaser(CEncoder *coder): _coder(coder) {}
-    ~CCoderReleaser() {  _coder->ReleaseStreams(); }
-  };
-
-public:
-
-  MY_UNKNOWN_IMP
-
-  HRESULT CodeReal(ISequentialInStream **inStreams,
-      const UInt64 **inSizes,
-      UInt32 numInStreams,
-      ISequentialOutStream **outStreams,
-      const UInt64 **outSizes,
-      UInt32 numOutStreams,
-      ICompressProgressInfo *progress);
-  STDMETHOD(Code)(ISequentialInStream **inStreams,
-      const UInt64 **inSizes,
-      UInt32 numInStreams,
-      ISequentialOutStream **outStreams,
-      const UInt64 **outSizes,
-      UInt32 numOutStreams,
-      ICompressProgressInfo *progress);
-};
-
-#endif
-
-class CDecoder:
-  public ICompressCoder2,
-  public CMyUnknownImp
-{
-public:
-  CInBuffer _mainInStream;
-  CInBuffer _callStream;
-  CInBuffer _jumpStream;
-  NCompress::NRangeCoder::CDecoder _rangeDecoder;
-  NCompress::NRangeCoder::CBitDecoder<kNumMoveBits> _statusDecoder[256 + 2];
-
-  COutBuffer _outStream;
-
-  void ReleaseStreams()
-  {
-    _mainInStream.ReleaseStream();
-    _callStream.ReleaseStream();
-    _jumpStream.ReleaseStream();
-    _rangeDecoder.ReleaseStream();
-    _outStream.ReleaseStream();
-  }
-
-  HRESULT Flush() { return _outStream.Flush(); }
-  class CCoderReleaser
-  {
-    CDecoder *_coder;
-  public:
-    CCoderReleaser(CDecoder *coder): _coder(coder) {}
-    ~CCoderReleaser()  { _coder->ReleaseStreams(); }
-  };
-
-public:
-  MY_UNKNOWN_IMP
-  HRESULT CodeReal(ISequentialInStream **inStreams,
-      const UInt64 **inSizes,
-      UInt32 numInStreams,
-      ISequentialOutStream **outStreams,
-      const UInt64 **outSizes,
-      UInt32 numOutStreams,
-      ICompressProgressInfo *progress);
-  STDMETHOD(Code)(ISequentialInStream **inStreams,
-      const UInt64 **inSizes,
-      UInt32 numInStreams,
-      ISequentialOutStream **outStreams,
-      const UInt64 **outSizes,
-      UInt32 numOutStreams,
-      ICompressProgressInfo *progress);
-};
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/Bcj2Register.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Compress/Bcj2Register.cpp
deleted file mode 100644
index 8eb1e73..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/Bcj2Register.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-// Bcj2Register.cpp
-
-#include "StdAfx.h"
-
-#include "../Common/RegisterCodec.h"
-
-#include "Bcj2Coder.h"
-
-static void *CreateCodec() { return (void *)(ICompressCoder2 *)(new NCompress::NBcj2::CDecoder()); }
-#ifndef EXTRACT_ONLY
-static void *CreateCodecOut() { return (void *)(ICompressCoder2 *)(new NCompress::NBcj2::CEncoder());  }
-#else
-#define CreateCodecOut 0
-#endif
-
-static CCodecInfo g_CodecInfo =
-  { CreateCodec, CreateCodecOut, 0x0303011B, L"BCJ2", 4, false };
-
-REGISTER_CODEC(BCJ2)
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/BcjCoder.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Compress/BcjCoder.cpp
deleted file mode 100644
index 0e34ef4..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/BcjCoder.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-// BcjCoder.cpp
-
-#include "StdAfx.h"
-
-#include "BcjCoder.h"
-
-UInt32 CBCJ_x86_Encoder::SubFilter(Byte *data, UInt32 size)
-{
-  return (UInt32)::x86_Convert(data, size, _bufferPos, &_prevMask, 1);
-}
-
-UInt32 CBCJ_x86_Decoder::SubFilter(Byte *data, UInt32 size)
-{
-  return (UInt32)::x86_Convert(data, size, _bufferPos, &_prevMask, 0);
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/BcjCoder.h b/third_party/lzma/v4_65/files/CPP/7zip/Compress/BcjCoder.h
deleted file mode 100644
index 612bb54..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/BcjCoder.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// BcjCoder.h
-
-#ifndef __COMPRESS_BCJ_CODER_H
-#define __COMPRESS_BCJ_CODER_H
-
-extern "C"
-{
-#include "../../../C/Bra.h"
-}
-
-#include "BranchCoder.h"
-
-struct CBranch86
-{
-  UInt32 _prevMask;
-  void x86Init() { x86_Convert_Init(_prevMask); }
-};
-
-MyClassB(BCJ_x86, 0x01, 3, CBranch86 ,
-    virtual void SubInit() { x86Init(); })
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/BcjRegister.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Compress/BcjRegister.cpp
deleted file mode 100644
index 648ad8e..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/BcjRegister.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-// BcjRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../Common/RegisterCodec.h"
-
-#include "BcjCoder.h"
-
-static void *CreateCodec() { return (void *)(ICompressFilter *)(new CBCJ_x86_Decoder()); }
-#ifndef EXTRACT_ONLY
-static void *CreateCodecOut() { return (void *)(ICompressFilter *)(new CBCJ_x86_Encoder());  }
-#else
-#define CreateCodecOut 0
-#endif
-
-static CCodecInfo g_CodecInfo =
-  { CreateCodec, CreateCodecOut, 0x03030103, L"BCJ", 1, true };
-
-REGISTER_CODEC(BCJ)
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/BranchCoder.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Compress/BranchCoder.cpp
deleted file mode 100644
index 4317095..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/BranchCoder.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-// BranchCoder.cpp
-
-#include "StdAfx.h"
-
-#include "BranchCoder.h"
-
-STDMETHODIMP CBranchConverter::Init()
-{
-  _bufferPos = 0;
-  SubInit();
-  return S_OK;
-}
-
-STDMETHODIMP_(UInt32) CBranchConverter::Filter(Byte *data, UInt32 size)
-{
-  UInt32 processedSize = SubFilter(data, size);
-  _bufferPos += processedSize;
-  return processedSize;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/BranchCoder.h b/third_party/lzma/v4_65/files/CPP/7zip/Compress/BranchCoder.h
deleted file mode 100644
index 0e3a5c4..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/BranchCoder.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// BranchCoder.h
-
-#ifndef __COMPRESS_BRANCH_CODER_H
-#define __COMPRESS_BRANCH_CODER_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-class CBranchConverter:
-  public ICompressFilter,
-  public CMyUnknownImp
-{
-protected:
-  UInt32 _bufferPos;
-  virtual void SubInit() {}
-  virtual UInt32 SubFilter(Byte *data, UInt32 size) = 0;
-public:
-  MY_UNKNOWN_IMP;
-  STDMETHOD(Init)();
-  STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
-};
-
-#define MyClassEncoderA(Name) class C ## Name: public CBranchConverter \
-  { public: UInt32 SubFilter(Byte *data, UInt32 size); };
-
-#define MyClassDecoderA(Name) class C ## Name: public CBranchConverter \
-  { public: UInt32 SubFilter(Byte *data, UInt32 size); };
-
-#define MyClassEncoderB(Name, ADD_ITEMS, ADD_INIT) class C ## Name: public CBranchConverter, public ADD_ITEMS \
-  { public: UInt32 SubFilter(Byte *data, UInt32 size); ADD_INIT};
-
-#define MyClassDecoderB(Name, ADD_ITEMS, ADD_INIT) class C ## Name: public CBranchConverter, public ADD_ITEMS \
-  { public: UInt32 SubFilter(Byte *data, UInt32 size); ADD_INIT};
-
-#define MyClassA(Name, id, subId)  \
-MyClassEncoderA(Name ## _Encoder) \
-MyClassDecoderA(Name ## _Decoder)
-
-#define MyClassB(Name, id, subId, ADD_ITEMS, ADD_INIT)  \
-MyClassEncoderB(Name ## _Encoder, ADD_ITEMS, ADD_INIT) \
-MyClassDecoderB(Name ## _Decoder, ADD_ITEMS, ADD_INIT)
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/BranchMisc.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Compress/BranchMisc.cpp
deleted file mode 100644
index 5a19c44..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/BranchMisc.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-// BranchMisc.cpp
-
-#include "StdAfx.h"
-
-extern "C"
-{
-#include "../../../C/Bra.h"
-}
-
-#include "BranchMisc.h"
-
-UInt32 CBC_ARM_Encoder::SubFilter(Byte *data, UInt32 size)
-  { return (UInt32)::ARM_Convert(data, size, _bufferPos, 1); }
-
-UInt32 CBC_ARM_Decoder::SubFilter(Byte *data, UInt32 size)
-  { return (UInt32)::ARM_Convert(data, size, _bufferPos, 0); }
-
-UInt32 CBC_ARMT_Encoder::SubFilter(Byte *data, UInt32 size)
-  { return (UInt32)::ARMT_Convert(data, size, _bufferPos, 1); }
-
-UInt32 CBC_ARMT_Decoder::SubFilter(Byte *data, UInt32 size)
-  { return (UInt32)::ARMT_Convert(data, size, _bufferPos, 0); }
-
-UInt32 CBC_PPC_Encoder::SubFilter(Byte *data, UInt32 size)
-  { return (UInt32)::PPC_Convert(data, size, _bufferPos, 1); }
-
-UInt32 CBC_PPC_Decoder::SubFilter(Byte *data, UInt32 size)
-  { return (UInt32)::PPC_Convert(data, size, _bufferPos, 0); }
-
-UInt32 CBC_SPARC_Encoder::SubFilter(Byte *data, UInt32 size)
-  { return (UInt32)::SPARC_Convert(data, size, _bufferPos, 1); }
-
-UInt32 CBC_SPARC_Decoder::SubFilter(Byte *data, UInt32 size)
-  { return (UInt32)::SPARC_Convert(data, size, _bufferPos, 0); }
-
-UInt32 CBC_IA64_Encoder::SubFilter(Byte *data, UInt32 size)
-  { return (UInt32)::IA64_Convert(data, size, _bufferPos, 1); }
-
-UInt32 CBC_IA64_Decoder::SubFilter(Byte *data, UInt32 size)
-  {  return (UInt32)::IA64_Convert(data, size, _bufferPos, 0); }
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/BranchMisc.h b/third_party/lzma/v4_65/files/CPP/7zip/Compress/BranchMisc.h
deleted file mode 100644
index 81198b2..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/BranchMisc.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// BranchMisc.h
-
-#ifndef __COMPRESS_BRANCH_MISC_H
-#define __COMPRESS_BRANCH_MISC_H
-
-#include "BranchCoder.h"
-
-MyClassA(BC_ARM,   0x05, 1)
-MyClassA(BC_ARMT,  0x07, 1)
-MyClassA(BC_PPC,   0x02, 5)
-MyClassA(BC_SPARC, 0x08, 5)
-MyClassA(BC_IA64,  0x04, 1)
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/BranchRegister.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Compress/BranchRegister.cpp
deleted file mode 100644
index 380828c..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/BranchRegister.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-// BranchRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../Common/RegisterCodec.h"
-
-#include "BranchMisc.h"
-
-#define CREATE_CODEC(x) \
-  static void *CreateCodec ## x() { return (void *)(ICompressFilter *)(new C ## x ## _Decoder); } \
-  static void *CreateCodec ## x ## Out() { return (void *)(ICompressFilter *)(new C ## x ## _Encoder); }
-
-CREATE_CODEC(BC_PPC)
-CREATE_CODEC(BC_IA64)
-CREATE_CODEC(BC_ARM)
-CREATE_CODEC(BC_ARMT)
-CREATE_CODEC(BC_SPARC)
-
-#define METHOD_ITEM(x, id1, id2, name) { CreateCodec ## x, CreateCodec ## x ## Out, 0x03030000 + (id1 * 256) + id2, name, 1, true  }
-
-static CCodecInfo g_CodecsInfo[] =
-{
-  METHOD_ITEM(BC_PPC,   0x02, 0x05, L"PPC"),
-  METHOD_ITEM(BC_IA64,  0x04, 1, L"IA64"),
-  METHOD_ITEM(BC_ARM,   0x05, 1, L"ARM"),
-  METHOD_ITEM(BC_ARMT,  0x07, 1, L"ARMT"),
-  METHOD_ITEM(BC_SPARC, 0x08, 0x05, L"SPARC")
-};
-
-REGISTER_CODECS(Branch)
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/ByteSwap.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Compress/ByteSwap.cpp
deleted file mode 100644
index 3f252f2..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/ByteSwap.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-// ByteSwap.cpp
-
-#include "StdAfx.h"
-
-#include "ByteSwap.h"
-
-STDMETHODIMP CByteSwap2::Init() { return S_OK; }
-
-STDMETHODIMP_(UInt32) CByteSwap2::Filter(Byte *data, UInt32 size)
-{
-  const UInt32 kStep = 2;
-  UInt32 i;
-  for (i = 0; i + kStep <= size; i += kStep)
-  {
-    Byte b = data[i];
-    data[i] = data[i + 1];
-    data[i + 1] = b;
-  }
-  return i;
-}
-
-STDMETHODIMP CByteSwap4::Init() { return S_OK; }
-
-STDMETHODIMP_(UInt32) CByteSwap4::Filter(Byte *data, UInt32 size)
-{
-  const UInt32 kStep = 4;
-  UInt32 i;
-  for (i = 0; i + kStep <= size; i += kStep)
-  {
-    Byte b0 = data[i];
-    Byte b1 = data[i + 1];
-    data[i] = data[i + 3];
-    data[i + 1] = data[i + 2];
-    data[i + 2] = b1;
-    data[i + 3] = b0;
-  }
-  return i;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/ByteSwap.h b/third_party/lzma/v4_65/files/CPP/7zip/Compress/ByteSwap.h
deleted file mode 100644
index f13bec8..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/ByteSwap.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// ByteSwap.h
-
-#ifndef __COMPRESS_BYTE_SWAP_H
-#define __COMPRESS_BYTE_SWAP_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-class CByteSwap2:
-  public ICompressFilter,
-  public CMyUnknownImp
-{
-public:
-  MY_UNKNOWN_IMP
-  STDMETHOD(Init)();
-  STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
-};
-
-class CByteSwap4:
-  public ICompressFilter,
-  public CMyUnknownImp
-{
-public:
-  MY_UNKNOWN_IMP
-  STDMETHOD(Init)();
-  STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/ByteSwapRegister.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Compress/ByteSwapRegister.cpp
deleted file mode 100644
index e3405ca..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/ByteSwapRegister.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-// ByteSwapRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../Common/RegisterCodec.h"
-
-#include "ByteSwap.h"
-
-static void *CreateCodec2() { return (void *)(ICompressFilter *)(new CByteSwap2); }
-static void *CreateCodec4() { return (void *)(ICompressFilter *)(new CByteSwap4); }
-
-static CCodecInfo g_CodecsInfo[] =
-{
-  { CreateCodec2, CreateCodec4, 0x020302, L"Swap2", 1, true },
-  { CreateCodec4, CreateCodec4, 0x020304, L"Swap4", 1, true }
-};
-
-REGISTER_CODECS(ByteSwap)
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/CodecExports.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Compress/CodecExports.cpp
deleted file mode 100644
index cd7a209..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/CodecExports.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-// CodecExports.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/ComTry.h"
-#include "../../Windows/PropVariant.h"
-#include "../Common/RegisterCodec.h"
-#include "../ICoder.h"
-
-extern unsigned int g_NumCodecs;
-extern const CCodecInfo *g_Codecs[];
-
-static const UInt16 kDecodeId = 0x2790;
-
-DEFINE_GUID(CLSID_CCodec,
-0x23170F69, 0x40C1, kDecodeId, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
-
-static inline HRESULT SetPropString(const char *s, unsigned int size, PROPVARIANT *value)
-{
-  if ((value->bstrVal = ::SysAllocStringByteLen(s, size)) != 0)
-    value->vt = VT_BSTR;
-  return S_OK;
-}
-
-static inline HRESULT SetPropGUID(const GUID &guid, PROPVARIANT *value)
-{
-  return SetPropString((const char *)&guid, sizeof(GUID), value);
-}
-
-static HRESULT SetClassID(CMethodId id, bool encode, PROPVARIANT *value)
-{
-  GUID clsId = CLSID_CCodec;
-  for (int i = 0; i < sizeof(id); i++, id >>= 8)
-    clsId.Data4[i] = (Byte)(id & 0xFF);
-  if (encode)
-    clsId.Data3++;
-  return SetPropGUID(clsId, value);
-}
-
-static HRESULT FindCodecClassId(const GUID *clsID, UInt32 isCoder2, bool isFilter, bool &encode, int &index)
-{
-  index = -1;
-  if (clsID->Data1 != CLSID_CCodec.Data1 ||
-      clsID->Data2 != CLSID_CCodec.Data2 ||
-      (clsID->Data3 & ~1) != kDecodeId)
-    return S_OK;
-  encode = (clsID->Data3 != kDecodeId);
-  UInt64 id = 0;
-  for (int j = 0; j < 8; j++)
-    id |= ((UInt64)clsID->Data4[j]) << (8 * j);
-  for (unsigned i = 0; i < g_NumCodecs; i++)
-  {
-    const CCodecInfo &codec = *g_Codecs[i];
-    if (id != codec.Id || encode && !codec.CreateEncoder || !encode && !codec.CreateDecoder)
-      continue;
-    if (!isFilter && codec.IsFilter || isFilter && !codec.IsFilter ||
-        codec.NumInStreams != 1 && !isCoder2 || codec.NumInStreams == 1 && isCoder2)
-      return E_NOINTERFACE;
-    index = i;
-    return S_OK;
-  }
-  return S_OK;
-}
-
-STDAPI CreateCoder2(bool encode, UInt32 index, const GUID *iid, void **outObject)
-{
-  COM_TRY_BEGIN
-  *outObject = 0;
-  bool isCoder = (*iid == IID_ICompressCoder) != 0;
-  bool isCoder2 = (*iid == IID_ICompressCoder2) != 0;
-  bool isFilter = (*iid == IID_ICompressFilter) != 0;
-  const CCodecInfo &codec = *g_Codecs[index];
-  if (!isFilter && codec.IsFilter || isFilter && !codec.IsFilter ||
-      codec.NumInStreams != 1 && !isCoder2 || codec.NumInStreams == 1 && isCoder2)
-    return E_NOINTERFACE;
-  if (encode)
-  {
-    if (!codec.CreateEncoder)
-      return CLASS_E_CLASSNOTAVAILABLE;
-    *outObject = codec.CreateEncoder();
-  }
-  else
-  {
-    if (!codec.CreateDecoder)
-      return CLASS_E_CLASSNOTAVAILABLE;
-    *outObject = codec.CreateDecoder();
-  }
-  if (isCoder)
-    ((ICompressCoder *)*outObject)->AddRef();
-  else if (isCoder2)
-    ((ICompressCoder2 *)*outObject)->AddRef();
-  else
-    ((ICompressFilter *)*outObject)->AddRef();
-  return S_OK;
-  COM_TRY_END
-}
-
-STDAPI CreateCoder(const GUID *clsid, const GUID *iid, void **outObject)
-{
-  *outObject = 0;
-  bool isCoder = (*iid == IID_ICompressCoder) != 0;
-  bool isCoder2 = (*iid == IID_ICompressCoder2) != 0;
-  bool isFilter = (*iid == IID_ICompressFilter) != 0;
-  if (!isCoder && !isCoder2 && !isFilter)
-    return E_NOINTERFACE;
-  bool encode;
-  int codecIndex;
-  HRESULT res = FindCodecClassId(clsid, isCoder2, isFilter, encode, codecIndex);
-  if (res != S_OK)
-    return res;
-  if (codecIndex < 0)
-    return CLASS_E_CLASSNOTAVAILABLE;
-  return CreateCoder2(encode, codecIndex, iid, outObject);
-}
-
-STDAPI GetMethodProperty(UInt32 codecIndex, PROPID propID, PROPVARIANT *value)
-{
-  ::VariantClear((VARIANTARG *)value);
-  const CCodecInfo &codec = *g_Codecs[codecIndex];
-  switch(propID)
-  {
-    case NMethodPropID::kID:
-    {
-      value->uhVal.QuadPart = (UInt64)codec.Id;
-      value->vt = VT_UI8;
-      break;
-    }
-    case NMethodPropID::kName:
-      if ((value->bstrVal = ::SysAllocString(codec.Name)) != 0)
-        value->vt = VT_BSTR;
-      break;
-    case NMethodPropID::kDecoder:
-      if (codec.CreateDecoder)
-        return SetClassID(codec.Id, false, value);
-      break;
-    case NMethodPropID::kEncoder:
-      if (codec.CreateEncoder)
-        return SetClassID(codec.Id, true, value);
-      break;
-    case NMethodPropID::kInStreams:
-    {
-      if (codec.NumInStreams != 1)
-      {
-        value->vt = VT_UI4;
-        value->ulVal = (ULONG)codec.NumInStreams;
-      }
-      break;
-    }
-  }
-  return S_OK;
-}
-
-STDAPI GetNumberOfMethods(UINT32 *numCodecs)
-{
-  *numCodecs = g_NumCodecs;
-  return S_OK;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/CopyCoder.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Compress/CopyCoder.cpp
deleted file mode 100644
index 899ffa3..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/CopyCoder.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-// Compress/CopyCoder.cpp
-
-#include "StdAfx.h"
-
-extern "C"
-{
-#include "../../../C/Alloc.h"
-}
-
-#include "../Common/StreamUtils.h"
-
-#include "CopyCoder.h"
-
-namespace NCompress {
-
-static const UInt32 kBufferSize = 1 << 17;
-
-CCopyCoder::~CCopyCoder()
-{
-  ::MidFree(_buffer);
-}
-
-STDMETHODIMP CCopyCoder::Code(ISequentialInStream *inStream,
-    ISequentialOutStream *outStream,
-    const UInt64 * /* inSize */, const UInt64 *outSize,
-    ICompressProgressInfo *progress)
-{
-  if (_buffer == 0)
-  {
-    _buffer = (Byte *)::MidAlloc(kBufferSize);
-    if (_buffer == 0)
-      return E_OUTOFMEMORY;
-  }
-
-  TotalSize = 0;
-  for (;;)
-  {
-    UInt32 realProcessedSize;
-    UInt32 size = kBufferSize;
-    if (outSize != 0)
-      if (size > *outSize - TotalSize)
-        size = (UInt32)(*outSize - TotalSize);
-    RINOK(inStream->Read(_buffer, size, &realProcessedSize));
-    if (realProcessedSize == 0)
-      break;
-    RINOK(WriteStream(outStream, _buffer, realProcessedSize));
-    TotalSize += realProcessedSize;
-    if (progress != NULL)
-    {
-      RINOK(progress->SetRatioInfo(&TotalSize, &TotalSize));
-    }
-  }
-  return S_OK;
-}
-
-STDMETHODIMP CCopyCoder::GetInStreamProcessedSize(UInt64 *value)
-{
-  *value = TotalSize;
-  return S_OK;
-}
-
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/CopyCoder.h b/third_party/lzma/v4_65/files/CPP/7zip/Compress/CopyCoder.h
deleted file mode 100644
index c573678..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/CopyCoder.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// Compress/CopyCoder.h
-
-#ifndef __COMPRESS_COPY_CODER_H
-#define __COMPRESS_COPY_CODER_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-namespace NCompress {
-
-class CCopyCoder:
-  public ICompressCoder,
-  public ICompressGetInStreamProcessedSize,
-  public CMyUnknownImp
-{
-  Byte *_buffer;
-public:
-  UInt64 TotalSize;
-  CCopyCoder(): TotalSize(0) , _buffer(0) {};
-  ~CCopyCoder();
-
-  MY_UNKNOWN_IMP1(ICompressGetInStreamProcessedSize)
-
-  STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
-      const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-  STDMETHOD(GetInStreamProcessedSize)(UInt64 *value);
-};
-
-}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/CopyRegister.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Compress/CopyRegister.cpp
deleted file mode 100644
index efb9b9e..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/CopyRegister.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// CopyRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../Common/RegisterCodec.h"
-
-#include "CopyCoder.h"
-
-static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::CCopyCoder); }
-
-static CCodecInfo g_CodecInfo =
-{ CreateCodec, CreateCodec, 0x00, L"Copy", 1, false };
-
-REGISTER_CODEC(Copy)
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsp b/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsp
deleted file mode 100644
index 76fa7b8..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsp
+++ /dev/null
@@ -1,462 +0,0 @@
-# Microsoft Developer Studio Project File - Name="AloneLZMA" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=AloneLZMA - Win32 DebugU
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "AloneLZMA.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "AloneLZMA.mak" CFG="AloneLZMA - Win32 DebugU"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "AloneLZMA - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "AloneLZMA - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE "AloneLZMA - Win32 ReleaseU" (based on "Win32 (x86) Console Application")
-!MESSAGE "AloneLZMA - Win32 DebugU" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "AloneLZMA - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "BENCH_MT" /FAcs /Yu"StdAfx.h" /FD /c
-# ADD BASE RSC /l 0x419 /d "NDEBUG"
-# ADD RSC /l 0x419 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"c:\UTIL\lzma.exe" /opt:NOWIN98
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF  "$(CFG)" == "AloneLZMA - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "BENCH_MT" /Yu"StdAfx.h" /FD /GZ /c
-# ADD BASE RSC /l 0x419 /d "_DEBUG"
-# ADD RSC /l 0x419 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"c:\UTIL\lzma.exe" /pdbtype:sept
-
-!ELSEIF  "$(CFG)" == "AloneLZMA - Win32 ReleaseU"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "ReleaseU"
-# PROP BASE Intermediate_Dir "ReleaseU"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "ReleaseU"
-# PROP Intermediate_Dir "ReleaseU"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_PAT" /D "COMPRESS_MF_BT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /Yu"StdAfx.h" /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\\" /D "NDEBUG" /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "BENCH_MT" /Yu"StdAfx.h" /FD /c
-# ADD BASE RSC /l 0x419 /d "NDEBUG"
-# ADD RSC /l 0x419 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"c:\UTIL\7za2.exe" /opt:NOWIN98
-# SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"c:\UTIL\lzma.exe" /opt:NOWIN98
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF  "$(CFG)" == "AloneLZMA - Win32 DebugU"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "DebugU"
-# PROP BASE Intermediate_Dir "DebugU"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "DebugU"
-# PROP Intermediate_Dir "DebugU"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_PAT" /D "COMPRESS_MF_BT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /D "_MBCS" /Yu"StdAfx.h" /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "BENCH_MT" /Yu"StdAfx.h" /FD /GZ /c
-# ADD BASE RSC /l 0x419 /d "_DEBUG"
-# ADD RSC /l 0x419 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"c:\UTIL\7za2.exe" /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"c:\UTIL\lzma.exe" /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "AloneLZMA - Win32 Release"
-# Name "AloneLZMA - Win32 Debug"
-# Name "AloneLZMA - Win32 ReleaseU"
-# Name "AloneLZMA - Win32 DebugU"
-# Begin Group "Spec"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\StdAfx.cpp
-# ADD CPP /Yc"StdAfx.h"
-# End Source File
-# Begin Source File
-
-SOURCE=.\StdAfx.h
-# End Source File
-# End Group
-# Begin Group "Compress"
-
-# PROP Default_Filter ""
-# Begin Group "LZMA"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\LzmaDecoder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzmaDecoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzmaEncoder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\LzmaEncoder.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Windows"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileIO.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileIO.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\Synchronization.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\Synchronization.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\System.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\System.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\Thread.h
-# End Source File
-# End Group
-# Begin Group "Common"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\..\Common\CommandLineParser.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\CommandLineParser.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\CRC.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\Defs.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\Defs.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\IntToString.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\IntToString.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyCom.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyString.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyString.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyVector.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyVector.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyWindows.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\NewHandler.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\NewHandler.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\StringConvert.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\StringConvert.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\StringToInt.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\StringToInt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\Types.h
-# End Source File
-# End Group
-# Begin Group "7zip Common"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Common\FileStreams.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\FileStreams.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\InBuffer.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\InBuffer.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\OutBuffer.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\OutBuffer.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\StreamUtils.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\StreamUtils.h
-# End Source File
-# End Group
-# Begin Group "C"
-
-# PROP Default_Filter ""
-# Begin Group "LzmaUtil"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzmaUtil\Lzma86Dec.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzmaUtil\Lzma86Dec.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzmaUtil\Lzma86Enc.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzmaUtil\Lzma86Enc.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=..\..\..\..\C\7zCrc.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\7zCrc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Alloc.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Alloc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Bra.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Bra86.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzFind.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzFind.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzFindMt.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzFindMt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzHash.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzmaDec.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzmaDec.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzmaEnc.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzmaEnc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Threads.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Threads.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Types.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=..\..\ICoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\LzmaAlone.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\LzmaBench.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\LzmaBench.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\LzmaBenchCon.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\LzmaBenchCon.h
-# End Source File
-# End Target
-# End Project
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsw b/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsw
deleted file mode 100644
index d7482d8..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "AloneLZMA"=.\AloneLZMA.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp
deleted file mode 100644
index 4044c86..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp
+++ /dev/null
@@ -1,534 +0,0 @@
-// LzmaAlone.cpp
-
-#include "StdAfx.h"
-
-#include "../../../Common/MyWindows.h"
-#include "../../../Common/MyInitGuid.h"
-
-#include <stdio.h>
-
-#if defined(_WIN32) || defined(OS2) || defined(MSDOS)
-#include <fcntl.h>
-#include <io.h>
-#define MY_SET_BINARY_MODE(file) _setmode(_fileno(file), O_BINARY)
-#else
-#define MY_SET_BINARY_MODE(file)
-#endif
-
-#include "../../../Common/CommandLineParser.h"
-#include "../../../Common/StringConvert.h"
-#include "../../../Common/StringToInt.h"
-
-#include "../../Common/FileStreams.h"
-#include "../../Common/StreamUtils.h"
-
-#include "../LzmaDecoder.h"
-#include "../LzmaEncoder.h"
-
-#include "LzmaBenchCon.h"
-
-#ifdef COMPRESS_MF_MT
-#include "../../../Windows/System.h"
-#endif
-
-extern "C"
-{
-  #include "../../../../C/7zVersion.h"
-  #include "../../../../C/Alloc.h"
-  #include "../../../../C/LzmaUtil/Lzma86Dec.h"
-  #include "../../../../C/LzmaUtil/Lzma86Enc.h"
-}
-
-using namespace NCommandLineParser;
-
-#ifdef _WIN32
-bool g_IsNT = false;
-static inline bool IsItWindowsNT()
-{
-  OSVERSIONINFO versionInfo;
-  versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
-  if (!::GetVersionEx(&versionInfo))
-    return false;
-  return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
-}
-#endif
-
-static const char *kCantAllocate = "Can not allocate memory";
-static const char *kReadError = "Read error";
-static const char *kWriteError = "Write error";
-
-namespace NKey {
-enum Enum
-{
-  kHelp1 = 0,
-  kHelp2,
-  kAlgo,
-  kDict,
-  kFb,
-  kMc,
-  kLc,
-  kLp,
-  kPb,
-  kMatchFinder,
-  kMultiThread,
-  kEOS,
-  kStdIn,
-  kStdOut,
-  kFilter86
-};
-}
-
-static const CSwitchForm kSwitchForms[] =
-{
-  { L"?",  NSwitchType::kSimple, false },
-  { L"H",  NSwitchType::kSimple, false },
-  { L"A", NSwitchType::kUnLimitedPostString, false, 1 },
-  { L"D", NSwitchType::kUnLimitedPostString, false, 1 },
-  { L"FB", NSwitchType::kUnLimitedPostString, false, 1 },
-  { L"MC", NSwitchType::kUnLimitedPostString, false, 1 },
-  { L"LC", NSwitchType::kUnLimitedPostString, false, 1 },
-  { L"LP", NSwitchType::kUnLimitedPostString, false, 1 },
-  { L"PB", NSwitchType::kUnLimitedPostString, false, 1 },
-  { L"MF", NSwitchType::kUnLimitedPostString, false, 1 },
-  { L"MT", NSwitchType::kUnLimitedPostString, false, 0 },
-  { L"EOS", NSwitchType::kSimple, false },
-  { L"SI",  NSwitchType::kSimple, false },
-  { L"SO",  NSwitchType::kSimple, false },
-  { L"F86",  NSwitchType::kPostChar, false, 0, 0, L"+" }
-};
-
-static const int kNumSwitches = sizeof(kSwitchForms) / sizeof(kSwitchForms[0]);
-
-static void PrintHelp()
-{
-  fprintf(stderr, "\nUsage:  LZMA <e|d> inputFile outputFile [<switches>...]\n"
-             "  e: encode file\n"
-             "  d: decode file\n"
-             "  b: Benchmark\n"
-    "<Switches>\n"
-    "  -a{N}:  set compression mode - [0, 1], default: 1 (max)\n"
-    "  -d{N}:  set dictionary size - [12, 30], default: 23 (8MB)\n"
-    "  -fb{N}: set number of fast bytes - [5, 273], default: 128\n"
-    "  -mc{N}: set number of cycles for match finder\n"
-    "  -lc{N}: set number of literal context bits - [0, 8], default: 3\n"
-    "  -lp{N}: set number of literal pos bits - [0, 4], default: 0\n"
-    "  -pb{N}: set number of pos bits - [0, 4], default: 2\n"
-    "  -mf{MF_ID}: set Match Finder: [bt2, bt3, bt4, hc4], default: bt4\n"
-    "  -mt{N}: set number of CPU threads\n"
-    "  -eos:   write End Of Stream marker\n"
-    "  -si:    read data from stdin\n"
-    "  -so:    write data to stdout\n"
-    );
-}
-
-static void PrintHelpAndExit(const char *s)
-{
-  fprintf(stderr, "\nError: %s\n\n", s);
-  PrintHelp();
-  throw -1;
-}
-
-static void IncorrectCommand()
-{
-  PrintHelpAndExit("Incorrect command");
-}
-
-static void WriteArgumentsToStringList(int numArguments, const char *arguments[],
-    UStringVector &strings)
-{
-  for(int i = 1; i < numArguments; i++)
-    strings.Add(MultiByteToUnicodeString(arguments[i]));
-}
-
-static bool GetNumber(const wchar_t *s, UInt32 &value)
-{
-  value = 0;
-  if (MyStringLen(s) == 0)
-    return false;
-  const wchar_t *end;
-  UInt64 res = ConvertStringToUInt64(s, &end);
-  if (*end != L'\0')
-    return false;
-  if (res > 0xFFFFFFFF)
-    return false;
-  value = UInt32(res);
-  return true;
-}
-
-static void ParseUInt32(const CParser &parser, int index, UInt32 &res)
-{
-  if (parser[index].ThereIs)
-    if (!GetNumber(parser[index].PostStrings[0], res))
-      IncorrectCommand();
-}
-
-int main2(int n, const char *args[])
-{
-  #ifdef _WIN32
-  g_IsNT = IsItWindowsNT();
-  #endif
-
-  fprintf(stderr, "\nLZMA " MY_VERSION_COPYRIGHT_DATE "\n");
-
-  if (n == 1)
-  {
-    PrintHelp();
-    return 0;
-  }
-
-  bool unsupportedTypes = (sizeof(Byte) != 1 || sizeof(UInt32) < 4 || sizeof(UInt64) < 4);
-  if (unsupportedTypes)
-  {
-    fprintf(stderr, "Unsupported base types. Edit Common/Types.h and recompile");
-    return 1;
-  }
-
-  UStringVector commandStrings;
-  WriteArgumentsToStringList(n, args, commandStrings);
-  CParser parser(kNumSwitches);
-  try
-  {
-    parser.ParseStrings(kSwitchForms, commandStrings);
-  }
-  catch(...)
-  {
-    IncorrectCommand();
-  }
-
-  if(parser[NKey::kHelp1].ThereIs || parser[NKey::kHelp2].ThereIs)
-  {
-    PrintHelp();
-    return 0;
-  }
-  const UStringVector &nonSwitchStrings = parser.NonSwitchStrings;
-
-  int paramIndex = 0;
-  if (paramIndex >= nonSwitchStrings.Size())
-    IncorrectCommand();
-  const UString &command = nonSwitchStrings[paramIndex++];
-
-  bool dictDefined = false;
-  UInt32 dict = (UInt32)-1;
-  if(parser[NKey::kDict].ThereIs)
-  {
-    UInt32 dicLog;
-    if (!GetNumber(parser[NKey::kDict].PostStrings[0], dicLog))
-      IncorrectCommand();
-    dict = 1 << dicLog;
-    dictDefined = true;
-  }
-  UString mf = L"BT4";
-  if (parser[NKey::kMatchFinder].ThereIs)
-    mf = parser[NKey::kMatchFinder].PostStrings[0];
-
-  UInt32 numThreads = (UInt32)-1;
-
-  #ifdef COMPRESS_MF_MT
-  if (parser[NKey::kMultiThread].ThereIs)
-  {
-    UInt32 numCPUs = NWindows::NSystem::GetNumberOfProcessors();
-    const UString &s = parser[NKey::kMultiThread].PostStrings[0];
-    if (s.IsEmpty())
-      numThreads = numCPUs;
-    else
-      if (!GetNumber(s, numThreads))
-        IncorrectCommand();
-  }
-  #endif
-
-  if (command.CompareNoCase(L"b") == 0)
-  {
-    const UInt32 kNumDefaultItereations = 1;
-    UInt32 numIterations = kNumDefaultItereations;
-    {
-      if (paramIndex < nonSwitchStrings.Size())
-        if (!GetNumber(nonSwitchStrings[paramIndex++], numIterations))
-          numIterations = kNumDefaultItereations;
-    }
-    return LzmaBenchCon(stderr, numIterations, numThreads, dict);
-  }
-
-  if (numThreads == (UInt32)-1)
-    numThreads = 1;
-
-  bool encodeMode = false;
-  if (command.CompareNoCase(L"e") == 0)
-    encodeMode = true;
-  else if (command.CompareNoCase(L"d") == 0)
-    encodeMode = false;
-  else
-    IncorrectCommand();
-
-  bool stdInMode = parser[NKey::kStdIn].ThereIs;
-  bool stdOutMode = parser[NKey::kStdOut].ThereIs;
-
-  CMyComPtr<ISequentialInStream> inStream;
-  CInFileStream *inStreamSpec = 0;
-  if (stdInMode)
-  {
-    inStream = new CStdInFileStream;
-    MY_SET_BINARY_MODE(stdin);
-  }
-  else
-  {
-    if (paramIndex >= nonSwitchStrings.Size())
-      IncorrectCommand();
-    const UString &inputName = nonSwitchStrings[paramIndex++];
-    inStreamSpec = new CInFileStream;
-    inStream = inStreamSpec;
-    if (!inStreamSpec->Open(GetSystemString(inputName)))
-    {
-      fprintf(stderr, "\nError: can not open input file %s\n",
-          (const char *)GetOemString(inputName));
-      return 1;
-    }
-  }
-
-  CMyComPtr<ISequentialOutStream> outStream;
-  COutFileStream *outStreamSpec = NULL;
-  if (stdOutMode)
-  {
-    outStream = new CStdOutFileStream;
-    MY_SET_BINARY_MODE(stdout);
-  }
-  else
-  {
-    if (paramIndex >= nonSwitchStrings.Size())
-      IncorrectCommand();
-    const UString &outputName = nonSwitchStrings[paramIndex++];
-    outStreamSpec = new COutFileStream;
-    outStream = outStreamSpec;
-    if (!outStreamSpec->Create(GetSystemString(outputName), true))
-    {
-      fprintf(stderr, "\nError: can not open output file %s\n",
-        (const char *)GetOemString(outputName));
-      return 1;
-    }
-  }
-
-  if (parser[NKey::kFilter86].ThereIs)
-  {
-    // -f86 switch is for x86 filtered mode: BCJ + LZMA.
-    if (parser[NKey::kEOS].ThereIs || stdInMode)
-      throw "Can not use stdin in this mode";
-    UInt64 fileSize;
-    inStreamSpec->File.GetLength(fileSize);
-    if (fileSize > 0xF0000000)
-      throw "File is too big";
-    size_t inSize = (size_t)fileSize;
-    Byte *inBuffer = 0;
-    if (inSize != 0)
-    {
-      inBuffer = (Byte *)MyAlloc((size_t)inSize);
-      if (inBuffer == 0)
-        throw kCantAllocate;
-    }
-    
-    if (ReadStream_FAIL(inStream, inBuffer, inSize) != S_OK)
-      throw "Can not read";
-
-    Byte *outBuffer = 0;
-    size_t outSize;
-    if (encodeMode)
-    {
-      // we allocate 105% of original size for output buffer
-      outSize = (size_t)fileSize / 20 * 21 + (1 << 16);
-      if (outSize != 0)
-      {
-        outBuffer = (Byte *)MyAlloc((size_t)outSize);
-        if (outBuffer == 0)
-          throw kCantAllocate;
-      }
-      if (!dictDefined)
-        dict = 1 << 23;
-      int res = Lzma86_Encode(outBuffer, &outSize, inBuffer, inSize,
-          5, dict, parser[NKey::kFilter86].PostCharIndex == 0 ? SZ_FILTER_YES : SZ_FILTER_AUTO);
-      if (res != 0)
-      {
-        fprintf(stderr, "\nEncoder error = %d\n", (int)res);
-        return 1;
-      }
-    }
-    else
-    {
-      UInt64 outSize64;
-      if (Lzma86_GetUnpackSize(inBuffer, inSize, &outSize64) != 0)
-        throw "data error";
-      outSize = (size_t)outSize64;
-      if (outSize != outSize64)
-        throw "too big";
-      if (outSize != 0)
-      {
-        outBuffer = (Byte *)MyAlloc(outSize);
-        if (outBuffer == 0)
-          throw kCantAllocate;
-      }
-      int res = Lzma86_Decode(outBuffer, &outSize, inBuffer, &inSize);
-      if (inSize != (size_t)fileSize)
-        throw "incorrect processed size";
-      if (res != 0)
-        throw "LzmaDecoder error";
-    }
-    if (WriteStream(outStream, outBuffer, outSize) != S_OK)
-      throw kWriteError;
-    MyFree(outBuffer);
-    MyFree(inBuffer);
-    return 0;
-  }
-
-
-  UInt64 fileSize;
-  if (encodeMode)
-  {
-    NCompress::NLzma::CEncoder *encoderSpec = new NCompress::NLzma::CEncoder;
-    CMyComPtr<ICompressCoder> encoder = encoderSpec;
-
-    if (!dictDefined)
-      dict = 1 << 23;
-
-    UInt32 pb = 2;
-    UInt32 lc = 3; // = 0; for 32-bit data
-    UInt32 lp = 0; // = 2; for 32-bit data
-    UInt32 algo = 1;
-    UInt32 fb = 128;
-    UInt32 mc = 16 + fb / 2;
-    bool mcDefined = false;
-
-    bool eos = parser[NKey::kEOS].ThereIs || stdInMode;
- 
-    ParseUInt32(parser, NKey::kAlgo, algo);
-    ParseUInt32(parser, NKey::kFb, fb);
-    ParseUInt32(parser, NKey::kLc, lc);
-    ParseUInt32(parser, NKey::kLp, lp);
-    ParseUInt32(parser, NKey::kPb, pb);
-
-    mcDefined = parser[NKey::kMc].ThereIs;
-    if (mcDefined)
-      if (!GetNumber(parser[NKey::kMc].PostStrings[0], mc))
-        IncorrectCommand();
-    
-    PROPID propIDs[] =
-    {
-      NCoderPropID::kDictionarySize,
-      NCoderPropID::kPosStateBits,
-      NCoderPropID::kLitContextBits,
-      NCoderPropID::kLitPosBits,
-      NCoderPropID::kAlgorithm,
-      NCoderPropID::kNumFastBytes,
-      NCoderPropID::kMatchFinder,
-      NCoderPropID::kEndMarker,
-      NCoderPropID::kNumThreads,
-      NCoderPropID::kMatchFinderCycles,
-    };
-    const int kNumPropsMax = sizeof(propIDs) / sizeof(propIDs[0]);
-
-    PROPVARIANT props[kNumPropsMax];
-    for (int p = 0; p < 6; p++)
-      props[p].vt = VT_UI4;
-
-    props[0].ulVal = (UInt32)dict;
-    props[1].ulVal = (UInt32)pb;
-    props[2].ulVal = (UInt32)lc;
-    props[3].ulVal = (UInt32)lp;
-    props[4].ulVal = (UInt32)algo;
-    props[5].ulVal = (UInt32)fb;
-
-    props[6].vt = VT_BSTR;
-    props[6].bstrVal = (BSTR)(const wchar_t *)mf;
-
-    props[7].vt = VT_BOOL;
-    props[7].boolVal = eos ? VARIANT_TRUE : VARIANT_FALSE;
-
-    props[8].vt = VT_UI4;
-    props[8].ulVal = (UInt32)numThreads;
-
-    // it must be last in property list
-    props[9].vt = VT_UI4;
-    props[9].ulVal = (UInt32)mc;
-
-    int numProps = kNumPropsMax;
-    if (!mcDefined)
-      numProps--;
-
-    if (encoderSpec->SetCoderProperties(propIDs, props, numProps) != S_OK)
-      IncorrectCommand();
-    encoderSpec->WriteCoderProperties(outStream);
-
-    if (eos || stdInMode)
-      fileSize = (UInt64)(Int64)-1;
-    else
-      inStreamSpec->File.GetLength(fileSize);
-
-    for (int i = 0; i < 8; i++)
-    {
-      Byte b = Byte(fileSize >> (8 * i));
-      if (outStream->Write(&b, 1, 0) != S_OK)
-      {
-        fprintf(stderr, kWriteError);
-        return 1;
-      }
-    }
-    HRESULT result = encoder->Code(inStream, outStream, 0, 0, 0);
-    if (result == E_OUTOFMEMORY)
-    {
-      fprintf(stderr, "\nError: Can not allocate memory\n");
-      return 1;
-    }
-    else if (result != S_OK)
-    {
-      fprintf(stderr, "\nEncoder error = %X\n", (unsigned int)result);
-      return 1;
-    }
-  }
-  else
-  {
-    NCompress::NLzma::CDecoder *decoderSpec = new NCompress::NLzma::CDecoder;
-    CMyComPtr<ICompressCoder> decoder = decoderSpec;
-    decoderSpec->FinishStream = true;
-    const UInt32 kPropertiesSize = 5;
-    Byte header[kPropertiesSize + 8];
-    if (ReadStream_FALSE(inStream, header, kPropertiesSize + 8) != S_OK)
-    {
-      fprintf(stderr, kReadError);
-      return 1;
-    }
-    if (decoderSpec->SetDecoderProperties2(header, kPropertiesSize) != S_OK)
-    {
-      fprintf(stderr, "SetDecoderProperties error");
-      return 1;
-    }
-    fileSize = 0;
-    for (int i = 0; i < 8; i++)
-      fileSize |= ((UInt64)header[kPropertiesSize + i]) << (8 * i);
-
-    if (decoder->Code(inStream, outStream, 0, (fileSize == (UInt64)(Int64)-1) ? 0 : &fileSize, 0) != S_OK)
-    {
-      fprintf(stderr, "Decoder error");
-      return 1;
-    }
-  }
-  if (outStreamSpec != NULL)
-  {
-    if (outStreamSpec->Close() != S_OK)
-    {
-      fprintf(stderr, "File closing error");
-      return 1;
-    }
-  }
-  return 0;
-}
-
-int MY_CDECL main(int n, const char *args[])
-{
-  try { return main2(n, args); }
-  catch(const char *s)
-  {
-    fprintf(stderr, "\nError: %s\n", s);
-    return 1;
-  }
-  catch(...)
-  {
-    fprintf(stderr, "\nError\n");
-    return 1;
-  }
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp
deleted file mode 100644
index 2ad9a57..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp
+++ /dev/null
@@ -1,1021 +0,0 @@
-// LzmaBench.cpp
-
-#include "StdAfx.h"
-
-#include "LzmaBench.h"
-
-#ifndef _WIN32
-#define USE_POSIX_TIME
-#define USE_POSIX_TIME2
-#endif
-
-#ifdef USE_POSIX_TIME
-#include <time.h>
-#ifdef USE_POSIX_TIME2
-#include <sys/time.h>
-#endif
-#endif
-
-#ifdef _WIN32
-#define USE_ALLOCA
-#endif
-
-#ifdef USE_ALLOCA
-#ifdef _WIN32
-#include <malloc.h>
-#else
-#include <stdlib.h>
-#endif
-#endif
-
-extern "C"
-{
-#include "../../../../C/7zCrc.h"
-#include "../../../../C/Alloc.h"
-}
-
-#include "../../../Common/MyCom.h"
-
-#ifdef BENCH_MT
-#include "../../../Windows/Synchronization.h"
-#include "../../../Windows/Thread.h"
-#endif
-
-#ifdef EXTERNAL_LZMA
-#include "../../../Windows/PropVariant.h"
-#include "../../ICoder.h"
-#else
-#include "../LzmaDecoder.h"
-#include "../LzmaEncoder.h"
-#endif
-
-static const UInt32 kUncompressMinBlockSize = 1 << 26;
-static const UInt32 kAdditionalSize = (1 << 16);
-static const UInt32 kCompressedAdditionalSize = (1 << 10);
-static const UInt32 kMaxLzmaPropSize = 5;
-
-class CBaseRandomGenerator
-{
-  UInt32 A1;
-  UInt32 A2;
-public:
-  CBaseRandomGenerator() { Init(); }
-  void Init() { A1 = 362436069; A2 = 521288629;}
-  UInt32 GetRnd()
-  {
-    return
-      ((A1 = 36969 * (A1 & 0xffff) + (A1 >> 16)) << 16) +
-      ((A2 = 18000 * (A2 & 0xffff) + (A2 >> 16)) );
-  }
-};
-
-class CBenchBuffer
-{
-public:
-  size_t BufferSize;
-  Byte *Buffer;
-  CBenchBuffer(): Buffer(0) {}
-  virtual ~CBenchBuffer() { Free(); }
-  void Free()
-  {
-    ::MidFree(Buffer);
-    Buffer = 0;
-  }
-  bool Alloc(size_t bufferSize)
-  {
-    if (Buffer != 0 && BufferSize == bufferSize)
-      return true;
-    Free();
-    Buffer = (Byte *)::MidAlloc(bufferSize);
-    BufferSize = bufferSize;
-    return (Buffer != 0);
-  }
-};
-
-class CBenchRandomGenerator: public CBenchBuffer
-{
-  CBaseRandomGenerator *RG;
-public:
-  void Set(CBaseRandomGenerator *rg) { RG = rg; }
-  UInt32 GetVal(UInt32 &res, int numBits)
-  {
-    UInt32 val = res & (((UInt32)1 << numBits) - 1);
-    res >>= numBits;
-    return val;
-  }
-  UInt32 GetLen(UInt32 &res)
-  {
-    UInt32 len = GetVal(res, 2);
-    return GetVal(res, 1 + len);
-  }
-  void Generate()
-  {
-    UInt32 pos = 0;
-    UInt32 rep0 = 1;
-    while (pos < BufferSize)
-    {
-      UInt32 res = RG->GetRnd();
-      res >>= 1;
-      if (GetVal(res, 1) == 0 || pos < 1024)
-        Buffer[pos++] = (Byte)(res & 0xFF);
-      else
-      {
-        UInt32 len;
-        len = 1 + GetLen(res);
-        if (GetVal(res, 3) != 0)
-        {
-          len += GetLen(res);
-          do
-          {
-            UInt32 ppp = GetVal(res, 5) + 6;
-            res = RG->GetRnd();
-            if (ppp > 30)
-              continue;
-            rep0 = /* (1 << ppp) +*/  GetVal(res, ppp);
-            res = RG->GetRnd();
-          }
-          while (rep0 >= pos);
-          rep0++;
-        }
-
-        for (UInt32 i = 0; i < len && pos < BufferSize; i++, pos++)
-          Buffer[pos] = Buffer[pos - rep0];
-      }
-    }
-  }
-};
-
-
-class CBenchmarkInStream:
-  public ISequentialInStream,
-  public CMyUnknownImp
-{
-  const Byte *Data;
-  size_t Pos;
-  size_t Size;
-public:
-  MY_UNKNOWN_IMP
-  void Init(const Byte *data, size_t size)
-  {
-    Data = data;
-    Size = size;
-    Pos = 0;
-  }
-  STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-};
-
-STDMETHODIMP CBenchmarkInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
-  size_t remain = Size - Pos;
-  UInt32 kMaxBlockSize = (1 << 20);
-  if (size > kMaxBlockSize)
-    size = kMaxBlockSize;
-  if (size > remain)
-    size = (UInt32)remain;
-  for (UInt32 i = 0; i < size; i++)
-    ((Byte *)data)[i] = Data[Pos + i];
-  Pos += size;
-  if(processedSize != NULL)
-    *processedSize = size;
-  return S_OK;
-}
-  
-class CBenchmarkOutStream:
-  public ISequentialOutStream,
-  public CBenchBuffer,
-  public CMyUnknownImp
-{
-  // bool _overflow;
-public:
-  UInt32 Pos;
-  // CBenchmarkOutStream(): _overflow(false) {}
-  void Init()
-  {
-    // _overflow = false;
-    Pos = 0;
-  }
-  MY_UNKNOWN_IMP
-  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-
-STDMETHODIMP CBenchmarkOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
-  size_t curSize = BufferSize - Pos;
-  if (curSize > size)
-    curSize = size;
-  memcpy(Buffer + Pos, data, curSize);
-  Pos += (UInt32)curSize;
-  if(processedSize != NULL)
-    *processedSize = (UInt32)curSize;
-  if (curSize != size)
-  {
-    // _overflow = true;
-    return E_FAIL;
-  }
-  return S_OK;
-}
-  
-class CCrcOutStream:
-  public ISequentialOutStream,
-  public CMyUnknownImp
-{
-public:
-  UInt32 Crc;
-  MY_UNKNOWN_IMP
-  void Init() { Crc = CRC_INIT_VAL; }
-  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-
-STDMETHODIMP CCrcOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
-  Crc = CrcUpdate(Crc, data, size);
-  if (processedSize != NULL)
-    *processedSize = size;
-  return S_OK;
-}
-  
-static UInt64 GetTimeCount()
-{
-  #ifdef USE_POSIX_TIME
-  #ifdef USE_POSIX_TIME2
-  timeval v;
-  if (gettimeofday(&v, 0) == 0)
-    return (UInt64)(v.tv_sec) * 1000000 + v.tv_usec;
-  return (UInt64)time(NULL) * 1000000;
-  #else
-  return time(NULL);
-  #endif
-  #else
-  /*
-  LARGE_INTEGER value;
-  if (::QueryPerformanceCounter(&value))
-    return value.QuadPart;
-  */
-  return GetTickCount();
-  #endif
-}
-
-static UInt64 GetFreq()
-{
-  #ifdef USE_POSIX_TIME
-  #ifdef USE_POSIX_TIME2
-  return 1000000;
-  #else
-  return 1;
-  #endif
-  #else
-  /*
-  LARGE_INTEGER value;
-  if (::QueryPerformanceFrequency(&value))
-    return value.QuadPart;
-  */
-  return 1000;
-  #endif
-}
-
-#ifndef USE_POSIX_TIME
-static inline UInt64 GetTime64(const FILETIME &t) { return ((UInt64)t.dwHighDateTime << 32) | t.dwLowDateTime; }
-#endif
-static UInt64 GetUserTime()
-{
-  #ifdef USE_POSIX_TIME
-  return clock();
-  #else
-  FILETIME creationTime, exitTime, kernelTime, userTime;
-  if (::GetProcessTimes(::GetCurrentProcess(), &creationTime, &exitTime, &kernelTime, &userTime) != 0)
-    return GetTime64(userTime) + GetTime64(kernelTime);
-  return (UInt64)GetTickCount() * 10000;
-  #endif
-}
-
-static UInt64 GetUserFreq()
-{
-  #ifdef USE_POSIX_TIME
-  return CLOCKS_PER_SEC;
-  #else
-  return 10000000;
-  #endif
-}
-
-class CBenchProgressStatus
-{
-  #ifdef BENCH_MT
-  NWindows::NSynchronization::CCriticalSection CS;
-  #endif
-public:
-  HRESULT Res;
-  bool EncodeMode;
-  void SetResult(HRESULT res)
-  {
-    #ifdef BENCH_MT
-    NWindows::NSynchronization::CCriticalSectionLock lock(CS);
-    #endif
-    Res = res;
-  }
-  HRESULT GetResult()
-  {
-    #ifdef BENCH_MT
-    NWindows::NSynchronization::CCriticalSectionLock lock(CS);
-    #endif
-    return Res;
-  }
-};
-
-class CBenchProgressInfo:
-  public ICompressProgressInfo,
-  public CMyUnknownImp
-{
-public:
-  CBenchProgressStatus *Status;
-  CBenchInfo BenchInfo;
-  HRESULT Res;
-  IBenchCallback *callback;
-  CBenchProgressInfo(): callback(0) {}
-  MY_UNKNOWN_IMP
-  STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
-};
-
-void SetStartTime(CBenchInfo &bi)
-{
-  bi.GlobalFreq = GetFreq();
-  bi.UserFreq = GetUserFreq();
-  bi.GlobalTime = ::GetTimeCount();
-  bi.UserTime = ::GetUserTime();
-}
-
-void SetFinishTime(const CBenchInfo &biStart, CBenchInfo &dest)
-{
-  dest.GlobalFreq = GetFreq();
-  dest.UserFreq = GetUserFreq();
-  dest.GlobalTime = ::GetTimeCount() - biStart.GlobalTime;
-  dest.UserTime = ::GetUserTime() - biStart.UserTime;
-}
-
-STDMETHODIMP CBenchProgressInfo::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
-{
-  HRESULT res = Status->GetResult();
-  if (res != S_OK)
-    return res;
-  if (!callback)
-    return res;
-  CBenchInfo info = BenchInfo;
-  SetFinishTime(BenchInfo, info);
-  if (Status->EncodeMode)
-  {
-    info.UnpackSize = *inSize;
-    info.PackSize = *outSize;
-    res = callback->SetEncodeResult(info, false);
-  }
-  else
-  {
-    info.PackSize = BenchInfo.PackSize + *inSize;
-    info.UnpackSize = BenchInfo.UnpackSize + *outSize;
-    res = callback->SetDecodeResult(info, false);
-  }
-  if (res != S_OK)
-    Status->SetResult(res);
-  return res;
-}
-
-static const int kSubBits = 8;
-
-static UInt32 GetLogSize(UInt32 size)
-{
-  for (int i = kSubBits; i < 32; i++)
-    for (UInt32 j = 0; j < (1 << kSubBits); j++)
-      if (size <= (((UInt32)1) << i) + (j << (i - kSubBits)))
-        return (i << kSubBits) + j;
-  return (32 << kSubBits);
-}
-
-static void NormalizeVals(UInt64 &v1, UInt64 &v2)
-{
-  while (v1 > 1000000)
-  {
-    v1 >>= 1;
-    v2 >>= 1;
-  }
-}
-
-UInt64 GetUsage(const CBenchInfo &info)
-{
-  UInt64 userTime = info.UserTime;
-  UInt64 userFreq = info.UserFreq;
-  UInt64 globalTime = info.GlobalTime;
-  UInt64 globalFreq = info.GlobalFreq;
-  NormalizeVals(userTime, userFreq);
-  NormalizeVals(globalFreq, globalTime);
-  if (userFreq == 0)
-    userFreq = 1;
-  if (globalTime == 0)
-    globalTime = 1;
-  return userTime * globalFreq * 1000000 / userFreq / globalTime;
-}
-
-UInt64 GetRatingPerUsage(const CBenchInfo &info, UInt64 rating)
-{
-  UInt64 userTime = info.UserTime;
-  UInt64 userFreq = info.UserFreq;
-  UInt64 globalTime = info.GlobalTime;
-  UInt64 globalFreq = info.GlobalFreq;
-  NormalizeVals(userFreq, userTime);
-  NormalizeVals(globalTime, globalFreq);
-  if (globalFreq == 0)
-    globalFreq = 1;
-  if (userTime == 0)
-    userTime = 1;
-  return userFreq * globalTime / globalFreq *  rating / userTime;
-}
-
-static UInt64 MyMultDiv64(UInt64 value, UInt64 elapsedTime, UInt64 freq)
-{
-  UInt64 elTime = elapsedTime;
-  NormalizeVals(freq, elTime);
-  if (elTime == 0)
-    elTime = 1;
-  return value * freq / elTime;
-}
-
-UInt64 GetCompressRating(UInt32 dictionarySize, UInt64 elapsedTime, UInt64 freq, UInt64 size)
-{
-  UInt64 t = GetLogSize(dictionarySize) - (kBenchMinDicLogSize << kSubBits);
-  UInt64 numCommandsForOne = 870 + ((t * t * 5) >> (2 * kSubBits));
-  UInt64 numCommands = (UInt64)(size) * numCommandsForOne;
-  return MyMultDiv64(numCommands, elapsedTime, freq);
-}
-
-UInt64 GetDecompressRating(UInt64 elapsedTime, UInt64 freq, UInt64 outSize, UInt64 inSize, UInt32 numIterations)
-{
-  UInt64 numCommands = (inSize * 200 + outSize * 4) * numIterations;
-  return MyMultDiv64(numCommands, elapsedTime, freq);
-}
-
-#ifdef EXTERNAL_LZMA
-typedef UInt32 (WINAPI * CreateObjectPointer)(const GUID *clsID,
-    const GUID *interfaceID, void **outObject);
-#endif
-
-struct CEncoderInfo;
-
-struct CEncoderInfo
-{
-  #ifdef BENCH_MT
-  NWindows::CThread thread[2];
-  #endif
-  CMyComPtr<ICompressCoder> encoder;
-  CBenchProgressInfo *progressInfoSpec[2];
-  CMyComPtr<ICompressProgressInfo> progressInfo[2];
-  UInt32 NumIterations;
-  #ifdef USE_ALLOCA
-  size_t AllocaSize;
-  #endif
-
-  struct CDecoderInfo
-  {
-    CEncoderInfo *Encoder;
-    UInt32 DecoderIndex;
-    #ifdef USE_ALLOCA
-    size_t AllocaSize;
-    #endif
-    bool CallbackMode;
-  };
-  CDecoderInfo decodersInfo[2];
-
-  CMyComPtr<ICompressCoder> decoders[2];
-  HRESULT Results[2];
-  CBenchmarkOutStream *outStreamSpec;
-  CMyComPtr<ISequentialOutStream> outStream;
-  IBenchCallback *callback;
-  UInt32 crc;
-  UInt32 kBufferSize;
-  UInt32 compressedSize;
-  CBenchRandomGenerator rg;
-  CBenchmarkOutStream *propStreamSpec;
-  CMyComPtr<ISequentialOutStream> propStream;
-  HRESULT Init(UInt32 dictionarySize, UInt32 numThreads, CBaseRandomGenerator *rg);
-  HRESULT Encode();
-  HRESULT Decode(UInt32 decoderIndex);
-
-  CEncoderInfo(): outStreamSpec(0), callback(0), propStreamSpec(0) {}
-
-  #ifdef BENCH_MT
-  static THREAD_FUNC_DECL EncodeThreadFunction(void *param)
-  {
-    CEncoderInfo *encoder = (CEncoderInfo *)param;
-    #ifdef USE_ALLOCA
-    alloca(encoder->AllocaSize);
-    #endif
-    HRESULT res = encoder->Encode();
-    encoder->Results[0] = res;
-    if (res != S_OK)
-      encoder->progressInfoSpec[0]->Status->SetResult(res);
-
-    return 0;
-  }
-  static THREAD_FUNC_DECL DecodeThreadFunction(void *param)
-  {
-    CDecoderInfo *decoder = (CDecoderInfo *)param;
-    #ifdef USE_ALLOCA
-    alloca(decoder->AllocaSize);
-    #endif
-    CEncoderInfo *encoder = decoder->Encoder;
-    encoder->Results[decoder->DecoderIndex] = encoder->Decode(decoder->DecoderIndex);
-    return 0;
-  }
-
-  HRESULT CreateEncoderThread()
-  {
-    return thread[0].Create(EncodeThreadFunction, this);
-  }
-
-  HRESULT CreateDecoderThread(int index, bool callbackMode
-      #ifdef USE_ALLOCA
-      , size_t allocaSize
-      #endif
-      )
-  {
-    CDecoderInfo &decoder = decodersInfo[index];
-    decoder.DecoderIndex = index;
-    decoder.Encoder = this;
-    #ifdef USE_ALLOCA
-    decoder.AllocaSize = allocaSize;
-    #endif
-    decoder.CallbackMode = callbackMode;
-    return thread[index].Create(DecodeThreadFunction, &decoder);
-  }
-  #endif
-};
-
-HRESULT CEncoderInfo::Init(UInt32 dictionarySize, UInt32 numThreads, CBaseRandomGenerator *rgLoc)
-{
-  rg.Set(rgLoc);
-  kBufferSize = dictionarySize + kAdditionalSize;
-  UInt32 kCompressedBufferSize = (kBufferSize / 2) + kCompressedAdditionalSize;
-  if (!rg.Alloc(kBufferSize))
-    return E_OUTOFMEMORY;
-  rg.Generate();
-  crc = CrcCalc(rg.Buffer, rg.BufferSize);
-
-  outStreamSpec = new CBenchmarkOutStream;
-  if (!outStreamSpec->Alloc(kCompressedBufferSize))
-    return E_OUTOFMEMORY;
-
-  outStream = outStreamSpec;
-
-  propStreamSpec = 0;
-  if (!propStream)
-  {
-    propStreamSpec = new CBenchmarkOutStream;
-    propStream = propStreamSpec;
-  }
-  if (!propStreamSpec->Alloc(kMaxLzmaPropSize))
-    return E_OUTOFMEMORY;
-  propStreamSpec->Init();
-  
-  PROPID propIDs[] =
-  {
-    NCoderPropID::kDictionarySize,
-    NCoderPropID::kMultiThread
-  };
-  const int kNumProps = sizeof(propIDs) / sizeof(propIDs[0]);
-  PROPVARIANT properties[kNumProps];
-  properties[0].vt = VT_UI4;
-  properties[0].ulVal = (UInt32)dictionarySize;
-
-  properties[1].vt = VT_BOOL;
-  properties[1].boolVal = (numThreads > 1) ? VARIANT_TRUE : VARIANT_FALSE;
-
-  {
-    CMyComPtr<ICompressSetCoderProperties> setCoderProperties;
-    RINOK(encoder.QueryInterface(IID_ICompressSetCoderProperties, &setCoderProperties));
-    if (!setCoderProperties)
-      return E_FAIL;
-    RINOK(setCoderProperties->SetCoderProperties(propIDs, properties, kNumProps));
-
-    CMyComPtr<ICompressWriteCoderProperties> writeCoderProperties;
-    encoder.QueryInterface(IID_ICompressWriteCoderProperties, &writeCoderProperties);
-    if (writeCoderProperties)
-    {
-      RINOK(writeCoderProperties->WriteCoderProperties(propStream));
-    }
-  }
-  return S_OK;
-}
-
-HRESULT CEncoderInfo::Encode()
-{
-  CBenchmarkInStream *inStreamSpec = new CBenchmarkInStream;
-  CMyComPtr<ISequentialInStream> inStream = inStreamSpec;
-  inStreamSpec->Init(rg.Buffer, rg.BufferSize);
-  outStreamSpec->Init();
-
-  RINOK(encoder->Code(inStream, outStream, 0, 0, progressInfo[0]));
-  compressedSize = outStreamSpec->Pos;
-  encoder.Release();
-  return S_OK;
-}
-
-HRESULT CEncoderInfo::Decode(UInt32 decoderIndex)
-{
-  CBenchmarkInStream *inStreamSpec = new CBenchmarkInStream;
-  CMyComPtr<ISequentialInStream> inStream = inStreamSpec;
-  CMyComPtr<ICompressCoder> &decoder = decoders[decoderIndex];
-
-  CMyComPtr<ICompressSetDecoderProperties2> compressSetDecoderProperties;
-  decoder.QueryInterface(IID_ICompressSetDecoderProperties2, &compressSetDecoderProperties);
-  if (!compressSetDecoderProperties)
-    return E_FAIL;
-
-  CCrcOutStream *crcOutStreamSpec = new CCrcOutStream;
-  CMyComPtr<ISequentialOutStream> crcOutStream = crcOutStreamSpec;
-    
-  CBenchProgressInfo *pi = progressInfoSpec[decoderIndex];
-  pi->BenchInfo.UnpackSize = 0;
-  pi->BenchInfo.PackSize = 0;
-
-  for (UInt32 j = 0; j < NumIterations; j++)
-  {
-    inStreamSpec->Init(outStreamSpec->Buffer, compressedSize);
-    crcOutStreamSpec->Init();
-    
-    RINOK(compressSetDecoderProperties->SetDecoderProperties2(propStreamSpec->Buffer, propStreamSpec->Pos));
-    UInt64 outSize = kBufferSize;
-    RINOK(decoder->Code(inStream, crcOutStream, 0, &outSize, progressInfo[decoderIndex]));
-    if (CRC_GET_DIGEST(crcOutStreamSpec->Crc) != crc)
-      return S_FALSE;
-    pi->BenchInfo.UnpackSize += kBufferSize;
-    pi->BenchInfo.PackSize += compressedSize;
-  }
-  decoder.Release();
-  return S_OK;
-}
-
-static const UInt32 kNumThreadsMax = (1 << 16);
-
-struct CBenchEncoders
-{
-  CEncoderInfo *encoders;
-  CBenchEncoders(UInt32 num): encoders(0) { encoders = new CEncoderInfo[num]; }
-  ~CBenchEncoders() { delete []encoders; }
-};
-
-HRESULT LzmaBench(
-  #ifdef EXTERNAL_LZMA
-  CCodecs *codecs,
-  #endif
-  UInt32 numThreads, UInt32 dictionarySize, IBenchCallback *callback)
-{
-  UInt32 numEncoderThreads =
-    #ifdef BENCH_MT
-    (numThreads > 1 ? numThreads / 2 : 1);
-    #else
-    1;
-    #endif
-  UInt32 numSubDecoderThreads =
-    #ifdef BENCH_MT
-    (numThreads > 1 ? 2 : 1);
-    #else
-    1;
-    #endif
-  if (dictionarySize < (1 << kBenchMinDicLogSize) || numThreads < 1 || numEncoderThreads > kNumThreadsMax)
-  {
-    return E_INVALIDARG;
-  }
-
-  CBenchEncoders encodersSpec(numEncoderThreads);
-  CEncoderInfo *encoders = encodersSpec.encoders;
-
-  #ifdef EXTERNAL_LZMA
-  UString name = L"LZMA";
-  #endif
-
-  UInt32 i;
-  for (i = 0; i < numEncoderThreads; i++)
-  {
-    CEncoderInfo &encoder = encoders[i];
-    encoder.callback = (i == 0) ? callback : 0;
-
-    #ifdef EXTERNAL_LZMA
-    RINOK(codecs->CreateCoder(name, true, encoder.encoder));
-    #else
-    encoder.encoder = new NCompress::NLzma::CEncoder;
-    #endif
-    for (UInt32 j = 0; j < numSubDecoderThreads; j++)
-    {
-      #ifdef EXTERNAL_LZMA
-      RINOK(codecs->CreateCoder(name, false, encoder.decoders[j]));
-      #else
-      encoder.decoders[j] = new NCompress::NLzma::CDecoder;
-      #endif
-    }
-  }
-
-  CBaseRandomGenerator rg;
-  rg.Init();
-  for (i = 0; i < numEncoderThreads; i++)
-  {
-    RINOK(encoders[i].Init(dictionarySize, numThreads, &rg));
-  }
-
-  CBenchProgressStatus status;
-  status.Res = S_OK;
-  status.EncodeMode = true;
-
-  for (i = 0; i < numEncoderThreads; i++)
-  {
-    CEncoderInfo &encoder = encoders[i];
-    for (int j = 0; j < 2; j++)
-    {
-      encoder.progressInfo[j] = encoder.progressInfoSpec[j] = new CBenchProgressInfo;
-      encoder.progressInfoSpec[j]->Status = &status;
-    }
-    if (i == 0)
-    {
-      encoder.progressInfoSpec[0]->callback = callback;
-      encoder.progressInfoSpec[0]->BenchInfo.NumIterations = numEncoderThreads;
-      SetStartTime(encoder.progressInfoSpec[0]->BenchInfo);
-    }
-
-    #ifdef BENCH_MT
-    if (numEncoderThreads > 1)
-    {
-      #ifdef USE_ALLOCA
-      encoder.AllocaSize = (i * 16 * 21) & 0x7FF;
-      #endif
-      RINOK(encoder.CreateEncoderThread())
-    }
-    else
-    #endif
-    {
-      RINOK(encoder.Encode());
-    }
-  }
-  #ifdef BENCH_MT
-  if (numEncoderThreads > 1)
-    for (i = 0; i < numEncoderThreads; i++)
-      encoders[i].thread[0].Wait();
-  #endif
-
-  RINOK(status.Res);
-
-  CBenchInfo info;
-
-  SetFinishTime(encoders[0].progressInfoSpec[0]->BenchInfo, info);
-  info.UnpackSize = 0;
-  info.PackSize = 0;
-  info.NumIterations = 1; // progressInfoSpec->NumIterations;
-  for (i = 0; i < numEncoderThreads; i++)
-  {
-    CEncoderInfo &encoder = encoders[i];
-    info.UnpackSize += encoder.kBufferSize;
-    info.PackSize += encoder.compressedSize;
-  }
-  RINOK(callback->SetEncodeResult(info, true));
-
-
-  status.Res = S_OK;
-  status.EncodeMode = false;
-
-  UInt32 numDecoderThreads = numEncoderThreads * numSubDecoderThreads;
-  for (i = 0; i < numEncoderThreads; i++)
-  {
-    CEncoderInfo &encoder = encoders[i];
-    encoder.NumIterations = 2 + kUncompressMinBlockSize / encoder.kBufferSize;
-
-    if (i == 0)
-    {
-      encoder.progressInfoSpec[0]->callback = callback;
-      encoder.progressInfoSpec[0]->BenchInfo.NumIterations = numDecoderThreads;
-      SetStartTime(encoder.progressInfoSpec[0]->BenchInfo);
-    }
-
-    #ifdef BENCH_MT
-    if (numDecoderThreads > 1)
-    {
-      for (UInt32 j = 0; j < numSubDecoderThreads; j++)
-      {
-        HRESULT res = encoder.CreateDecoderThread(j, (i == 0 && j == 0)
-            #ifdef USE_ALLOCA
-            , ((i * numSubDecoderThreads + j) * 16 * 21) & 0x7FF
-            #endif
-            );
-        RINOK(res);
-      }
-    }
-    else
-    #endif
-    {
-      RINOK(encoder.Decode(0));
-    }
-  }
-  #ifdef BENCH_MT
-  HRESULT res = S_OK;
-  if (numDecoderThreads > 1)
-    for (i = 0; i < numEncoderThreads; i++)
-      for (UInt32 j = 0; j < numSubDecoderThreads; j++)
-      {
-        CEncoderInfo &encoder = encoders[i];
-        encoder.thread[j].Wait();
-        if (encoder.Results[j] != S_OK)
-          res = encoder.Results[j];
-      }
-  RINOK(res);
-  #endif
-  RINOK(status.Res);
-  SetFinishTime(encoders[0].progressInfoSpec[0]->BenchInfo, info);
-  info.UnpackSize = 0;
-  info.PackSize = 0;
-  info.NumIterations = numSubDecoderThreads * encoders[0].NumIterations;
-  for (i = 0; i < numEncoderThreads; i++)
-  {
-    CEncoderInfo &encoder = encoders[i];
-    info.UnpackSize += encoder.kBufferSize;
-    info.PackSize += encoder.compressedSize;
-  }
-  RINOK(callback->SetDecodeResult(info, false));
-  RINOK(callback->SetDecodeResult(info, true));
-  return S_OK;
-}
-
-
-inline UInt64 GetLZMAUsage(bool multiThread, UInt32 dictionary)
-{
-  UInt32 hs = dictionary - 1;
-  hs |= (hs >> 1);
-  hs |= (hs >> 2);
-  hs |= (hs >> 4);
-  hs |= (hs >> 8);
-  hs >>= 1;
-  hs |= 0xFFFF;
-  if (hs > (1 << 24))
-    hs >>= 1;
-  hs++;
-  return ((hs + (1 << 16)) + (UInt64)dictionary * 2) * 4 + (UInt64)dictionary * 3 / 2 +
-      (1 << 20) + (multiThread ? (6 << 20) : 0);
-}
-
-UInt64 GetBenchMemoryUsage(UInt32 numThreads, UInt32 dictionary)
-{
-  const UInt32 kBufferSize = dictionary;
-  const UInt32 kCompressedBufferSize = (kBufferSize / 2);
-  UInt32 numSubThreads = (numThreads > 1) ? 2 : 1;
-  UInt32 numBigThreads = numThreads / numSubThreads;
-  return (kBufferSize + kCompressedBufferSize +
-    GetLZMAUsage((numThreads > 1), dictionary) + (2 << 20)) * numBigThreads;
-}
-
-static bool CrcBig(const void *data, UInt32 size, UInt32 numCycles, UInt32 crcBase)
-{
-  for (UInt32 i = 0; i < numCycles; i++)
-    if (CrcCalc(data, size) != crcBase)
-      return false;
-  return true;
-}
-
-#ifdef BENCH_MT
-struct CCrcInfo
-{
-  NWindows::CThread Thread;
-  const Byte *Data;
-  UInt32 Size;
-  UInt32 NumCycles;
-  UInt32 Crc;
-  bool Res;
-  void Wait()
-  {
-    Thread.Wait();
-    Thread.Close();
-  }
-};
-
-static THREAD_FUNC_DECL CrcThreadFunction(void *param)
-{
-  CCrcInfo *p = (CCrcInfo *)param;
-  p->Res = CrcBig(p->Data, p->Size, p->NumCycles, p->Crc);
-  return 0;
-}
-
-struct CCrcThreads
-{
-  UInt32 NumThreads;
-  CCrcInfo *Items;
-  CCrcThreads(): Items(0), NumThreads(0) {}
-  void WaitAll()
-  {
-    for (UInt32 i = 0; i < NumThreads; i++)
-      Items[i].Wait();
-    NumThreads = 0;
-  }
-  ~CCrcThreads()
-  {
-    WaitAll();
-    delete []Items;
-  }
-};
-#endif
-
-static UInt32 CrcCalc1(const Byte *buf, UInt32 size)
-{
-  UInt32 crc = CRC_INIT_VAL;;
-  for (UInt32 i = 0; i < size; i++)
-    crc = CRC_UPDATE_BYTE(crc, buf[i]);
-  return CRC_GET_DIGEST(crc);
-}
-
-static void RandGen(Byte *buf, UInt32 size, CBaseRandomGenerator &RG)
-{
-  for (UInt32 i = 0; i < size; i++)
-    buf[i] = (Byte)RG.GetRnd();
-}
-
-static UInt32 RandGenCrc(Byte *buf, UInt32 size, CBaseRandomGenerator &RG)
-{
-  RandGen(buf, size, RG);
-  return CrcCalc1(buf, size);
-}
-
-bool CrcInternalTest()
-{
-  CBenchBuffer buffer;
-  const UInt32 kBufferSize0 = (1 << 8);
-  const UInt32 kBufferSize1 = (1 << 10);
-  const UInt32 kCheckSize = (1 << 5);
-  if (!buffer.Alloc(kBufferSize0 + kBufferSize1))
-    return false;
-  Byte *buf = buffer.Buffer;
-  UInt32 i;
-  for (i = 0; i < kBufferSize0; i++)
-    buf[i] = (Byte)i;
-  UInt32 crc1 = CrcCalc1(buf, kBufferSize0);
-  if (crc1 != 0x29058C73)
-    return false;
-  CBaseRandomGenerator RG;
-  RandGen(buf + kBufferSize0, kBufferSize1, RG);
-  for (i = 0; i < kBufferSize0 + kBufferSize1 - kCheckSize; i++)
-    for (UInt32 j = 0; j < kCheckSize; j++)
-      if (CrcCalc1(buf + i, j) != CrcCalc(buf + i, j))
-        return false;
-  return true;
-}
-
-HRESULT CrcBench(UInt32 numThreads, UInt32 bufferSize, UInt64 &speed)
-{
-  if (numThreads == 0)
-    numThreads = 1;
-
-  CBenchBuffer buffer;
-  size_t totalSize = (size_t)bufferSize * numThreads;
-  if (totalSize / numThreads != bufferSize)
-    return E_OUTOFMEMORY;
-  if (!buffer.Alloc(totalSize))
-    return E_OUTOFMEMORY;
-
-  Byte *buf = buffer.Buffer;
-  CBaseRandomGenerator RG;
-  UInt32 numCycles = ((UInt32)1 << 30) / ((bufferSize >> 2) + 1) + 1;
-
-  UInt64 timeVal;
-  #ifdef BENCH_MT
-  CCrcThreads threads;
-  if (numThreads > 1)
-  {
-    threads.Items = new CCrcInfo[numThreads];
-    UInt32 i;
-    for (i = 0; i < numThreads; i++)
-    {
-      CCrcInfo &info = threads.Items[i];
-      Byte *data = buf + (size_t)bufferSize * i;
-      info.Data = data;
-      info.NumCycles = numCycles;
-      info.Size = bufferSize;
-      info.Crc = RandGenCrc(data, bufferSize, RG);
-    }
-    timeVal = GetTimeCount();
-    for (i = 0; i < numThreads; i++)
-    {
-      CCrcInfo &info = threads.Items[i];
-      RINOK(info.Thread.Create(CrcThreadFunction, &info));
-      threads.NumThreads++;
-    }
-    threads.WaitAll();
-    for (i = 0; i < numThreads; i++)
-      if (!threads.Items[i].Res)
-        return S_FALSE;
-  }
-  else
-  #endif
-  {
-    UInt32 crc = RandGenCrc(buf, bufferSize, RG);
-    timeVal = GetTimeCount();
-    if (!CrcBig(buf, bufferSize, numCycles, crc))
-      return S_FALSE;
-  }
-  timeVal = GetTimeCount() - timeVal;
-  if (timeVal == 0)
-    timeVal = 1;
-
-  UInt64 size = (UInt64)numCycles * totalSize;
-  speed = MyMultDiv64(size, timeVal, GetFreq());
-  return S_OK;
-}
-
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/LzmaBench.h b/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/LzmaBench.h
deleted file mode 100644
index f8aeb6b..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/LzmaBench.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// LzmaBench.h
-
-#ifndef __LZMABENCH_H
-#define __LZMABENCH_H
-
-#include <stdio.h>
-#include "../../../Common/Types.h"
-#ifdef EXTERNAL_LZMA
-#include "../../UI/Common/LoadCodecs.h"
-#endif
-
-struct CBenchInfo
-{
-  UInt64 GlobalTime;
-  UInt64 GlobalFreq;
-  UInt64 UserTime;
-  UInt64 UserFreq;
-  UInt64 UnpackSize;
-  UInt64 PackSize;
-  UInt32 NumIterations;
-  CBenchInfo(): NumIterations(0) {}
-};
-
-struct IBenchCallback
-{
-  virtual HRESULT SetEncodeResult(const CBenchInfo &info, bool final) = 0;
-  virtual HRESULT SetDecodeResult(const CBenchInfo &info, bool final) = 0;
-};
-
-UInt64 GetUsage(const CBenchInfo &benchOnfo);
-UInt64 GetRatingPerUsage(const CBenchInfo &info, UInt64 rating);
-UInt64 GetCompressRating(UInt32 dictionarySize, UInt64 elapsedTime, UInt64 freq, UInt64 size);
-UInt64 GetDecompressRating(UInt64 elapsedTime, UInt64 freq, UInt64 outSize, UInt64 inSize, UInt32 numIterations);
-
-HRESULT LzmaBench(
-  #ifdef EXTERNAL_LZMA
-  CCodecs *codecs,
-  #endif
-  UInt32 numThreads, UInt32 dictionarySize, IBenchCallback *callback);
-
-const int kBenchMinDicLogSize = 18;
-
-UInt64 GetBenchMemoryUsage(UInt32 numThreads, UInt32 dictionary);
-
-bool CrcInternalTest();
-HRESULT CrcBench(UInt32 numThreads, UInt32 bufferSize, UInt64 &speed);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp
deleted file mode 100644
index b1c455e..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp
+++ /dev/null
@@ -1,311 +0,0 @@
-// LzmaBenchCon.cpp
-
-#include "StdAfx.h"
-
-#include <stdio.h>
-
-#include "LzmaBench.h"
-#include "LzmaBenchCon.h"
-#include "../../../Common/IntToString.h"
-
-#if defined(BENCH_MT) || defined(_WIN32)
-#include "../../../Windows/System.h"
-#endif
-
-#ifdef BREAK_HANDLER
-#include "../../UI/Console/ConsoleClose.h"
-#endif
-#include "../../../Common/MyCom.h"
-
-struct CTotalBenchRes
-{
-  UInt64 NumIterations;
-  UInt64 Rating;
-  UInt64 Usage;
-  UInt64 RPU;
-  void Init() { NumIterations = 0; Rating = 0; Usage = 0; RPU = 0; }
-  void Normalize()
-  {
-    if (NumIterations == 0)
-      return;
-    Rating /= NumIterations;
-    Usage /= NumIterations;
-    RPU /= NumIterations;
-    NumIterations = 1;
-  }
-  void SetMid(const CTotalBenchRes &r1, const CTotalBenchRes &r2)
-  {
-    Rating = (r1.Rating + r2.Rating) / 2;
-    Usage = (r1.Usage + r2.Usage) / 2;
-    RPU = (r1.RPU + r2.RPU) / 2;
-    NumIterations = (r1.NumIterations + r2.NumIterations) / 2;
-  }
-};
-
-struct CBenchCallback: public IBenchCallback
-{
-  CTotalBenchRes EncodeRes;
-  CTotalBenchRes DecodeRes;
-  FILE *f;
-  void Init() { EncodeRes.Init(); DecodeRes.Init(); }
-  void Normalize() { EncodeRes.Normalize(); DecodeRes.Normalize(); }
-  UInt32 dictionarySize;
-  HRESULT SetEncodeResult(const CBenchInfo &info, bool final);
-  HRESULT SetDecodeResult(const CBenchInfo &info, bool final);
-};
-
-static void NormalizeVals(UInt64 &v1, UInt64 &v2)
-{
-  while (v1 > 1000000)
-  {
-    v1 >>= 1;
-    v2 >>= 1;
-  }
-}
-
-static UInt64 MyMultDiv64(UInt64 value, UInt64 elapsedTime, UInt64 freq)
-{
-  UInt64 elTime = elapsedTime;
-  NormalizeVals(freq, elTime);
-  if (elTime == 0)
-    elTime = 1;
-  return value * freq / elTime;
-}
-
-static void PrintNumber(FILE *f, UInt64 value, int size)
-{
-  char s[32];
-  ConvertUInt64ToString(value, s);
-  fprintf(f, " ");
-  for (int len = (int)strlen(s); len < size; len++)
-    fprintf(f, " ");
-  fprintf(f, "%s", s);
-}
-
-static void PrintRating(FILE *f, UInt64 rating)
-{
-  PrintNumber(f, rating / 1000000, 6);
-}
-
-static void PrintResults(FILE *f, UInt64 usage, UInt64 rpu, UInt64 rating)
-{
-  PrintNumber(f, (usage + 5000) / 10000, 5);
-  PrintRating(f, rpu);
-  PrintRating(f, rating);
-}
-
-
-static void PrintResults(FILE *f, const CBenchInfo &info, UInt64 rating, CTotalBenchRes &res)
-{
-  UInt64 speed = MyMultDiv64(info.UnpackSize, info.GlobalTime, info.GlobalFreq);
-  PrintNumber(f, speed / 1024, 7);
-  UInt64 usage = GetUsage(info);
-  UInt64 rpu = GetRatingPerUsage(info, rating);
-  PrintResults(f, usage, rpu, rating);
-  res.NumIterations++;
-  res.RPU += rpu;
-  res.Rating += rating;
-  res.Usage += usage;
-}
-
-static void PrintTotals(FILE *f, const CTotalBenchRes &res)
-{
-  fprintf(f, "       ");
-  PrintResults(f, res.Usage, res.RPU, res.Rating);
-}
-
-
-HRESULT CBenchCallback::SetEncodeResult(const CBenchInfo &info, bool final)
-{
-  #ifdef BREAK_HANDLER
-  if (NConsoleClose::TestBreakSignal())
-    return E_ABORT;
-  #endif
-
-  if (final)
-  {
-    UInt64 rating = GetCompressRating(dictionarySize, info.GlobalTime, info.GlobalFreq, info.UnpackSize);
-    PrintResults(f, info, rating, EncodeRes);
-  }
-  return S_OK;
-}
-
-static const char *kSep = "  | ";
-
-
-HRESULT CBenchCallback::SetDecodeResult(const CBenchInfo &info, bool final)
-{
-  #ifdef BREAK_HANDLER
-  if (NConsoleClose::TestBreakSignal())
-    return E_ABORT;
-  #endif
-  if (final)
-  {
-    UInt64 rating = GetDecompressRating(info.GlobalTime, info.GlobalFreq, info.UnpackSize, info.PackSize, info.NumIterations);
-    fprintf(f, kSep);
-    CBenchInfo info2 = info;
-    info2.UnpackSize *= info2.NumIterations;
-    info2.PackSize *= info2.NumIterations;
-    info2.NumIterations = 1;
-    PrintResults(f, info2, rating, DecodeRes);
-  }
-  return S_OK;
-}
-
-static void PrintRequirements(FILE *f, const char *sizeString, UInt64 size, const char *threadsString, UInt32 numThreads)
-{
-  fprintf(f, "\nRAM %s ", sizeString);
-  PrintNumber(f, (size >> 20), 5);
-  fprintf(f, " MB,  # %s %3d", threadsString, (unsigned int)numThreads);
-}
-
-HRESULT LzmaBenchCon(
-  #ifdef EXTERNAL_LZMA
-  CCodecs *codecs,
-  #endif
-  FILE *f, UInt32 numIterations, UInt32 numThreads, UInt32 dictionary)
-{
-  if (!CrcInternalTest())
-    return S_FALSE;
-  #ifdef BENCH_MT
-  UInt64 ramSize = NWindows::NSystem::GetRamSize();  //
-  UInt32 numCPUs = NWindows::NSystem::GetNumberOfProcessors();
-  PrintRequirements(f, "size: ", ramSize, "CPU hardware threads:", numCPUs);
-  if (numThreads == (UInt32)-1)
-    numThreads = numCPUs;
-  if (numThreads > 1)
-    numThreads &= ~1;
-  if (dictionary == (UInt32)-1)
-  {
-    int dicSizeLog;
-    for (dicSizeLog = 25; dicSizeLog > kBenchMinDicLogSize; dicSizeLog--)
-      if (GetBenchMemoryUsage(numThreads, ((UInt32)1 << dicSizeLog)) + (8 << 20) <= ramSize)
-        break;
-    dictionary = (1 << dicSizeLog);
-  }
-  #else
-  if (dictionary == (UInt32)-1)
-    dictionary = (1 << 22);
-  numThreads = 1;
-  #endif
-
-  PrintRequirements(f, "usage:", GetBenchMemoryUsage(numThreads, dictionary), "Benchmark threads:   ", numThreads);
-
-  CBenchCallback callback;
-  callback.Init();
-  callback.f = f;
-  
-  fprintf(f, "\n\nDict        Compressing          |        Decompressing\n   ");
-  int j;
-  for (j = 0; j < 2; j++)
-  {
-    fprintf(f, "   Speed Usage    R/U Rating");
-    if (j == 0)
-      fprintf(f, kSep);
-  }
-  fprintf(f, "\n   ");
-  for (j = 0; j < 2; j++)
-  {
-    fprintf(f, "    KB/s     %%   MIPS   MIPS");
-    if (j == 0)
-      fprintf(f, kSep);
-  }
-  fprintf(f, "\n\n");
-  for (UInt32 i = 0; i < numIterations; i++)
-  {
-    const int kStartDicLog = 22;
-    int pow = (dictionary < ((UInt32)1 << kStartDicLog)) ? kBenchMinDicLogSize : kStartDicLog;
-    while (((UInt32)1 << pow) > dictionary)
-      pow--;
-    for (; ((UInt32)1 << pow) <= dictionary; pow++)
-    {
-      fprintf(f, "%2d:", pow);
-      callback.dictionarySize = (UInt32)1 << pow;
-      HRESULT res = LzmaBench(
-        #ifdef EXTERNAL_LZMA
-        codecs,
-        #endif
-        numThreads, callback.dictionarySize, &callback);
-      fprintf(f, "\n");
-      RINOK(res);
-    }
-  }
-  callback.Normalize();
-  fprintf(f, "----------------------------------------------------------------\nAvr:");
-  PrintTotals(f, callback.EncodeRes);
-  fprintf(f, "     ");
-  PrintTotals(f, callback.DecodeRes);
-  fprintf(f, "\nTot:");
-  CTotalBenchRes midRes;
-  midRes.SetMid(callback.EncodeRes, callback.DecodeRes);
-  PrintTotals(f, midRes);
-  fprintf(f, "\n");
-  return S_OK;
-}
-
-struct CTempValues
-{
-  UInt64 *Values;
-  CTempValues(UInt32 num) { Values = new UInt64[num]; }
-  ~CTempValues() { delete []Values; }
-};
-
-HRESULT CrcBenchCon(FILE *f, UInt32 numIterations, UInt32 numThreads, UInt32 dictionary)
-{
-  if (!CrcInternalTest())
-    return S_FALSE;
-
-  #ifdef BENCH_MT
-  UInt64 ramSize = NWindows::NSystem::GetRamSize();
-  UInt32 numCPUs = NWindows::NSystem::GetNumberOfProcessors();
-  PrintRequirements(f, "size: ", ramSize, "CPU hardware threads:", numCPUs);
-  if (numThreads == (UInt32)-1)
-    numThreads = numCPUs;
-  #else
-  numThreads = 1;
-  #endif
-  if (dictionary == (UInt32)-1)
-    dictionary = (1 << 24);
-
-  CTempValues speedTotals(numThreads);
-  fprintf(f, "\n\nSize");
-  for (UInt32 ti = 0; ti < numThreads; ti++)
-  {
-    fprintf(f, " %5d", ti + 1);
-    speedTotals.Values[ti] = 0;
-  }
-  fprintf(f, "\n\n");
-
-  UInt64 numSteps = 0;
-  for (UInt32 i = 0; i < numIterations; i++)
-  {
-    for (int pow = 10; pow < 32; pow++)
-    {
-      UInt32 bufSize = (UInt32)1 << pow;
-      if (bufSize > dictionary)
-        break;
-      fprintf(f, "%2d: ", pow);
-      UInt64 speed;
-      for (UInt32 ti = 0; ti < numThreads; ti++)
-      {
-        #ifdef BREAK_HANDLER
-        if (NConsoleClose::TestBreakSignal())
-          return E_ABORT;
-        #endif
-        RINOK(CrcBench(ti + 1, bufSize, speed));
-        PrintNumber(f, (speed >> 20), 5);
-        speedTotals.Values[ti] += speed;
-      }
-      fprintf(f, "\n");
-      numSteps++;
-    }
-  }
-  if (numSteps != 0)
-  {
-    fprintf(f, "\nAvg:");
-    for (UInt32 ti = 0; ti < numThreads; ti++)
-      PrintNumber(f, ((speedTotals.Values[ti] / numSteps) >> 20), 5);
-    fprintf(f, "\n");
-  }
-  return S_OK;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.h b/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.h
deleted file mode 100644
index ea8539d..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// LzmaBenchCon.h
-
-#ifndef __LZMABENCHCON_H
-#define __LZMABENCHCON_H
-
-#include <stdio.h>
-#include "../../../Common/Types.h"
-#ifdef EXTERNAL_LZMA
-#include "../../UI/Common/LoadCodecs.h"
-#endif
-HRESULT LzmaBenchCon(
-  #ifdef EXTERNAL_LZMA
-  CCodecs *codecs,
-  #endif
-  FILE *f, UInt32 numIterations, UInt32 numThreads, UInt32 dictionary);
-
-HRESULT CrcBenchCon(FILE *f, UInt32 numIterations, UInt32 numThreads, UInt32 dictionary);
-
-#endif
-
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/StdAfx.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/StdAfx.cpp
deleted file mode 100644
index d0feea8..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/StdAfx.cpp
+++ /dev/null
@@ -1,3 +0,0 @@
-// StdAfx.cpp
-
-#include "StdAfx.h"
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/StdAfx.h b/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/StdAfx.h
deleted file mode 100644
index e7fb698..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/StdAfx.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/makefile b/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/makefile
deleted file mode 100644
index 1c4baa0..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/makefile
+++ /dev/null
@@ -1,79 +0,0 @@
-PROG = lzma.exe
-LIBS = $(LIBS) user32.lib
-CFLAGS = $(CFLAGS) \
-  -DCOMPRESS_MF_MT \
-  -DBENCH_MT \
-
-LZMA_OBJS = \
-  $O\LzmaAlone.obj \
-  $O\LzmaBench.obj \
-  $O\LzmaBenchCon.obj \
-
-LZMA_OPT_OBJS = \
-  $O\LzmaDecoder.obj \
-  $O\LzmaEncoder.obj \
-
-COMMON_OBJS = \
-  $O\CommandLineParser.obj \
-  $O\CRC.obj \
-  $O\IntToString.obj \
-  $O\MyString.obj \
-  $O\StringConvert.obj \
-  $O\StringToInt.obj \
-  $O\MyVector.obj
-
-WIN_OBJS = \
-  $O\System.obj
-
-7ZIP_COMMON_OBJS = \
-  $O\InBuffer.obj \
-  $O\OutBuffer.obj \
-  $O\StreamUtils.obj \
-
-C_OBJS = \
-  $O\7zCrc.obj \
-  $O\Alloc.obj \
-  $O\Bra86.obj \
-  $O\LzFind.obj \
-  $O\LzFindMt.obj \
-  $O\LzmaDec.obj \
-  $O\LzmaEnc.obj \
-  $O\Threads.obj \
-
-C_LZMAUTIL_OBJS = \
-  $O\Lzma86Dec.obj \
-  $O\Lzma86Enc.obj \
-
-OBJS = \
-  $O\StdAfx.obj \
-  $(LZMA_OBJS) \
-  $(LZMA_OPT_OBJS) \
-  $(COMMON_OBJS) \
-  $(WIN_OBJS) \
-  $(7ZIP_COMMON_OBJS) \
-  $(C_OBJS) \
-  $(C_LZMAUTIL_OBJS) \
-  $O\FileStreams.obj \
-  $O\FileIO.obj \
-
-!include "../../../Build.mak"
-
-
-$(LZMA_OBJS): $(*B).cpp
-	$(COMPL)
-$(LZMA_OPT_OBJS): ../$(*B).cpp
-	$(COMPL_O2)
-$(COMMON_OBJS): ../../../Common/$(*B).cpp
-	$(COMPL)
-$(WIN_OBJS): ../../../Windows/$(*B).cpp
-	$(COMPL)
-$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
-	$(COMPL)
-$O\FileStreams.obj: ../../Common/FileStreams.cpp
-	$(COMPL)
-$O\FileIO.obj: ../../../Windows/FileIO.cpp
-	$(COMPL)
-$(C_OBJS): ../../../../C/$(*B).c
-	$(COMPL_O2)
-$(C_LZMAUTIL_OBJS): ../../../../C/LzmaUtil/$(*B).c
-	$(COMPL_O2)
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/makefile.gcc b/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/makefile.gcc
deleted file mode 100644
index 8d53437..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LZMA_Alone/makefile.gcc
+++ /dev/null
@@ -1,135 +0,0 @@
-PROG = lzma
-CXX = g++ -O2 -Wall
-CXX_C = gcc -O2 -Wall
-LIB = -lm
-RM = rm -f
-CFLAGS = -c
-
-ifdef SystemDrive
-IS_MINGW = 1
-endif
-
-ifdef IS_MINGW
-FILE_IO =FileIO
-FILE_IO_2 =Windows/$(FILE_IO)
-LIB2 = -luuid
-else
-FILE_IO =C_FileIO
-FILE_IO_2 =Common/$(FILE_IO)
-endif
-
-OBJS = \
-  LzmaAlone.o \
-  LzmaBench.o \
-  LzmaBenchCon.o \
-  LzmaDecoder.o \
-  LzmaEncoder.o \
-  InBuffer.o \
-  OutBuffer.o \
-  FileStreams.o \
-  StreamUtils.o \
-  $(FILE_IO).o \
-  CommandLineParser.o \
-  CRC.o \
-  IntToString.o \
-  MyString.o \
-  StringConvert.o \
-  StringToInt.o \
-  MyVector.o \
-  7zCrc.o \
-  Alloc.o \
-  Bra86.o \
-  LzFind.o \
-  LzmaDec.o \
-  LzmaEnc.o \
-  Lzma86Dec.o \
-  Lzma86Enc.o \
-
-
-all: $(PROG)
-
-$(PROG): $(OBJS)
-	$(CXX) -o $(PROG) $(LDFLAGS) $(OBJS) $(LIB) $(LIB2)
-
-LzmaAlone.o: LzmaAlone.cpp
-	$(CXX) $(CFLAGS) LzmaAlone.cpp
-
-LzmaBench.o: LzmaBench.cpp
-	$(CXX) $(CFLAGS) LzmaBench.cpp
-
-LzmaBenchCon.o: LzmaBenchCon.cpp
-	$(CXX) $(CFLAGS) LzmaBenchCon.cpp
-
-LzmaDecoder.o: ../LzmaDecoder.cpp
-	$(CXX) $(CFLAGS) ../LzmaDecoder.cpp
-
-LzmaEncoder.o: ../LzmaEncoder.cpp
-	$(CXX) $(CFLAGS) ../LzmaEncoder.cpp
-
-InBuffer.o: ../../Common/InBuffer.cpp
-	$(CXX) $(CFLAGS) ../../Common/InBuffer.cpp
-
-OutBuffer.o: ../../Common/OutBuffer.cpp
-	$(CXX) $(CFLAGS) ../../Common/OutBuffer.cpp
-
-FileStreams.o: ../../Common/FileStreams.cpp
-	$(CXX) $(CFLAGS) ../../Common/FileStreams.cpp
-
-StreamUtils.o: ../../Common/StreamUtils.cpp
-	$(CXX) $(CFLAGS) ../../Common/StreamUtils.cpp
-
-$(FILE_IO).o: ../../../$(FILE_IO_2).cpp
-	$(CXX) $(CFLAGS) ../../../$(FILE_IO_2).cpp
-
-
-CommandLineParser.o: ../../../Common/CommandLineParser.cpp
-	$(CXX) $(CFLAGS) ../../../Common/CommandLineParser.cpp
-
-CRC.o: ../../../Common/CRC.cpp
-	$(CXX) $(CFLAGS) ../../../Common/CRC.cpp
-
-MyWindows.o: ../../../Common/MyWindows.cpp
-	$(CXX) $(CFLAGS) ../../../Common/MyWindows.cpp
-
-IntToString.o: ../../../Common/IntToString.cpp
-	$(CXX) $(CFLAGS) ../../../Common/IntToString.cpp
-
-MyString.o: ../../../Common/MyString.cpp
-	$(CXX) $(CFLAGS) ../../../Common/MyString.cpp
-
-StringConvert.o: ../../../Common/StringConvert.cpp
-	$(CXX) $(CFLAGS) ../../../Common/StringConvert.cpp
-
-StringToInt.o: ../../../Common/StringToInt.cpp
-	$(CXX) $(CFLAGS) ../../../Common/StringToInt.cpp
-
-MyVector.o: ../../../Common/MyVector.cpp
-	$(CXX) $(CFLAGS) ../../../Common/MyVector.cpp
-
-7zCrc.o: ../../../../C/7zCrc.c
-	$(CXX_C) $(CFLAGS) ../../../../C/7zCrc.c
-
-Alloc.o: ../../../../C/Alloc.c
-	$(CXX_C) $(CFLAGS) ../../../../C/Alloc.c
-
-Bra86.o: ../../../../C/Bra86.c
-	$(CXX_C) $(CFLAGS) ../../../../C/Bra86.c
-
-LzFind.o: ../../../../C/LzFind.c
-	$(CXX_C) $(CFLAGS) ../../../../C/LzFind.c
-
-LzmaDec.o: ../../../../C/LzmaDec.c
-	$(CXX_C) $(CFLAGS) ../../../../C/LzmaDec.c
-
-LzmaEnc.o: ../../../../C/LzmaEnc.c
-	$(CXX_C) $(CFLAGS) ../../../../C/LzmaEnc.c
-
-Lzma86Dec.o: ../../../../C/LzmaUtil/Lzma86Dec.c
-	$(CXX_C) $(CFLAGS) ../../../../C/LzmaUtil/Lzma86Dec.c
-
-Lzma86Enc.o: ../../../../C/LzmaUtil/Lzma86Enc.c
-	$(CXX_C) $(CFLAGS) ../../../../C/LzmaUtil/Lzma86Enc.c
-
-clean:
-	-$(RM) $(PROG) $(OBJS)
-
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LzmaDecoder.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Compress/LzmaDecoder.cpp
deleted file mode 100644
index 5bfffe9..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LzmaDecoder.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-// LzmaDecoder.cpp
-
-#include "StdAfx.h"
-
-extern "C"
-{
-#include "../../../C/Alloc.h"
-}
-
-#include "../Common/StreamUtils.h"
-
-#include "LzmaDecoder.h"
-
-static HRESULT SResToHRESULT(SRes res)
-{
-  switch(res)
-  {
-    case SZ_OK: return S_OK;
-    case SZ_ERROR_MEM: return E_OUTOFMEMORY;
-    case SZ_ERROR_PARAM: return E_INVALIDARG;
-    case SZ_ERROR_UNSUPPORTED: return E_NOTIMPL;
-    // case SZ_ERROR_PROGRESS: return E_ABORT;
-    case SZ_ERROR_DATA: return S_FALSE;
-  }
-  return E_FAIL;
-}
-
-namespace NCompress {
-namespace NLzma {
-
-static const UInt32 kInBufSize = 1 << 20;
-
-CDecoder::CDecoder(): _inBuf(0), _outSizeDefined(false), FinishStream(false)
-{
-  LzmaDec_Construct(&_state);
-}
-
-static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); }
-static void SzFree(void *p, void *address) { p = p; MyFree(address); }
-static ISzAlloc g_Alloc = { SzAlloc, SzFree };
-
-CDecoder::~CDecoder()
-{
-  LzmaDec_Free(&_state, &g_Alloc);
-  MyFree(_inBuf);
-}
-
-STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *prop, UInt32 size)
-{
-  RINOK(SResToHRESULT(LzmaDec_Allocate(&_state, prop, size, &g_Alloc)));
-
-  if (_inBuf == 0)
-  {
-    _inBuf = (Byte *)MyAlloc(kInBufSize);
-    if (_inBuf == 0)
-      return E_OUTOFMEMORY;
-  }
-
-  return S_OK;
-}
-
-STDMETHODIMP CDecoder::GetInStreamProcessedSize(UInt64 *value) { *value = _inSizeProcessed; return S_OK; }
-STDMETHODIMP CDecoder::SetInStream(ISequentialInStream *inStream) { _inStream = inStream; return S_OK; }
-STDMETHODIMP CDecoder::ReleaseInStream() { _inStream.Release(); return S_OK; }
-
-STDMETHODIMP CDecoder::SetOutStreamSize(const UInt64 *outSize)
-{
-  _outSizeDefined = (outSize != NULL);
-  if (_outSizeDefined)
-    _outSize = *outSize;
-
-  LzmaDec_Init(&_state);
-  
-  _inPos = _inSize = 0;
-  _inSizeProcessed = _outSizeProcessed = 0;
-  return S_OK;
-}
-
-STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
-    const UInt64 * /* inSize */, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
-  if (_inBuf == 0)
-    return S_FALSE;
-  SetOutStreamSize(outSize);
-
-  for (;;)
-  {
-    if (_inPos == _inSize)
-    {
-      _inPos = _inSize = 0;
-      RINOK(inStream->Read(_inBuf, kInBufSize, &_inSize));
-    }
-
-    SizeT dicPos = _state.dicPos;
-    SizeT curSize = _state.dicBufSize - dicPos;
-    const UInt32 kStepSize = ((UInt32)1 << 22);
-    if (curSize > kStepSize)
-      curSize = (SizeT)kStepSize;
-    
-    ELzmaFinishMode finishMode = LZMA_FINISH_ANY;
-    if (_outSizeDefined)
-    {
-      const UInt64 rem = _outSize - _outSizeProcessed;
-      if (rem < curSize)
-      {
-        curSize = (SizeT)rem;
-        if (FinishStream)
-          finishMode = LZMA_FINISH_END;
-      }
-    }
-
-    SizeT inSizeProcessed = _inSize - _inPos;
-    ELzmaStatus status;
-    SRes res = LzmaDec_DecodeToDic(&_state, dicPos + curSize, _inBuf + _inPos, &inSizeProcessed, finishMode, &status);
-
-    _inPos += (UInt32)inSizeProcessed;
-    _inSizeProcessed += inSizeProcessed;
-    SizeT outSizeProcessed = _state.dicPos - dicPos;
-    _outSizeProcessed += outSizeProcessed;
-
-    bool finished = (inSizeProcessed == 0 && outSizeProcessed == 0);
-    bool stopDecoding = (_outSizeDefined && _outSizeProcessed >= _outSize);
-
-    if (res != 0 || _state.dicPos == _state.dicBufSize || finished || stopDecoding)
-    {
-      HRESULT res2 = WriteStream(outStream, _state.dic, _state.dicPos);
-      if (res != 0)
-        return S_FALSE;
-      RINOK(res2);
-      if (stopDecoding)
-        return S_OK;
-      if (finished)
-        return (status == LZMA_STATUS_FINISHED_WITH_MARK ? S_OK : S_FALSE);
-    }
-    if (_state.dicPos == _state.dicBufSize)
-      _state.dicPos = 0;
-
-    if (progress != NULL)
-    {
-      RINOK(progress->SetRatioInfo(&_inSizeProcessed, &_outSizeProcessed));
-    }
-  }
-}
-
-#ifndef NO_READ_FROM_CODER
-
-STDMETHODIMP CDecoder::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
-  if (processedSize)
-    *processedSize = 0;
-  do
-  {
-    if (_inPos == _inSize)
-    {
-      _inPos = _inSize = 0;
-      RINOK(_inStream->Read(_inBuf, kInBufSize, &_inSize));
-    }
-    {
-      SizeT inProcessed = _inSize - _inPos;
-
-      if (_outSizeDefined)
-      {
-        const UInt64 rem = _outSize - _outSizeProcessed;
-        if (rem < size)
-          size = (UInt32)rem;
-      }
-
-      SizeT outProcessed = size;
-      ELzmaStatus status;
-      SRes res = LzmaDec_DecodeToBuf(&_state, (Byte *)data, &outProcessed,
-          _inBuf + _inPos, &inProcessed, LZMA_FINISH_ANY, &status);
-      _inPos += (UInt32)inProcessed;
-      _inSizeProcessed += inProcessed;
-      _outSizeProcessed += outProcessed;
-      size -= (UInt32)outProcessed;
-      data = (Byte *)data + outProcessed;
-      if (processedSize)
-        *processedSize += (UInt32)outProcessed;
-      RINOK(SResToHRESULT(res));
-      if (inProcessed == 0 && outProcessed == 0)
-        return S_OK;
-    }
-  }
-  while (size != 0);
-  return S_OK;
-}
-
-#endif
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LzmaDecoder.h b/third_party/lzma/v4_65/files/CPP/7zip/Compress/LzmaDecoder.h
deleted file mode 100644
index e132d5c..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LzmaDecoder.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// LzmaDecoder.h
-
-#ifndef __LZMA_DECODER_H
-#define __LZMA_DECODER_H
-
-extern "C"
-{
-#include "../../../C/LzmaDec.h"
-}
-
-#include "../../Common/MyCom.h"
-#include "../ICoder.h"
-
-namespace NCompress {
-namespace NLzma {
-
-class CDecoder:
-  public ICompressCoder,
-  public ICompressSetDecoderProperties2,
-  public ICompressGetInStreamProcessedSize,
-  #ifndef NO_READ_FROM_CODER
-  public ICompressSetInStream,
-  public ICompressSetOutStreamSize,
-  public ISequentialInStream,
-  #endif
-  public CMyUnknownImp
-{
-  CMyComPtr<ISequentialInStream> _inStream;
-  Byte *_inBuf;
-  UInt32 _inPos;
-  UInt32 _inSize;
-  CLzmaDec _state;
-  bool _outSizeDefined;
-  UInt64 _outSize;
-  UInt64 _inSizeProcessed;
-  UInt64 _outSizeProcessed;
-public:
-
-  #ifndef NO_READ_FROM_CODER
-  MY_UNKNOWN_IMP5(
-      ICompressSetDecoderProperties2,
-      ICompressGetInStreamProcessedSize,
-      ICompressSetInStream,
-      ICompressSetOutStreamSize,
-      ISequentialInStream)
-  #else
-  MY_UNKNOWN_IMP2(
-      ICompressSetDecoderProperties2,
-      ICompressGetInStreamProcessedSize)
-  #endif
-
-  STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
-      const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-  STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
-  STDMETHOD(GetInStreamProcessedSize)(UInt64 *value);
-  STDMETHOD(SetInStream)(ISequentialInStream *inStream);
-  STDMETHOD(ReleaseInStream)();
-  STDMETHOD(SetOutStreamSize)(const UInt64 *outSize);
-
-  #ifndef NO_READ_FROM_CODER
-  STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-  #endif
-
-  bool FinishStream;
-
-  CDecoder();
-  virtual ~CDecoder();
-
-};
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LzmaEncoder.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Compress/LzmaEncoder.cpp
deleted file mode 100644
index 986e1ed..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LzmaEncoder.cpp
+++ /dev/null
@@ -1,211 +0,0 @@
-// LzmaEncoder.cpp
-
-#include "StdAfx.h"
-
-extern "C"
-{
-#include "../../../C/Alloc.h"
-}
-
-#include "../Common/StreamUtils.h"
-
-#include "LzmaEncoder.h"
-
-static HRESULT SResToHRESULT(SRes res)
-{
-  switch(res)
-  {
-    case SZ_OK: return S_OK;
-    case SZ_ERROR_MEM: return E_OUTOFMEMORY;
-    case SZ_ERROR_PARAM: return E_INVALIDARG;
-    // case SZ_ERROR_THREAD: return E_FAIL;
-  }
-  return E_FAIL;
-}
-
-namespace NCompress {
-namespace NLzma {
-
-static const UInt32 kStreamStepSize = (UInt32)1 << 31;
-
-static SRes MyRead(void *object, void *data, size_t *size)
-{
-  UInt32 curSize = ((*size < kStreamStepSize) ? (UInt32)*size : kStreamStepSize);
-  HRESULT res = ((CSeqInStream *)object)->RealStream->Read(data, curSize, &curSize);
-  *size = curSize;
-  return (SRes)res;
-}
-
-static size_t MyWrite(void *object, const void *data, size_t size)
-{
-  CSeqOutStream *p = (CSeqOutStream *)object;
-  p->Res = WriteStream(p->RealStream, data, size);
-  if (p->Res != 0)
-    return 0;
-  return size;
-}
-
-static void *SzBigAlloc(void *, size_t size) { return BigAlloc(size); }
-static void SzBigFree(void *, void *address) { BigFree(address); }
-static ISzAlloc g_BigAlloc = { SzBigAlloc, SzBigFree };
-
-static void *SzAlloc(void *, size_t size) { return MyAlloc(size); }
-static void SzFree(void *, void *address) { MyFree(address); }
-static ISzAlloc g_Alloc = { SzAlloc, SzFree };
-
-CEncoder::CEncoder()
-{
-  _seqInStream.SeqInStream.Read = MyRead;
-  _seqOutStream.SeqOutStream.Write = MyWrite;
-  _encoder = 0;
-  _encoder = LzmaEnc_Create(&g_Alloc);
-  if (_encoder == 0)
-    throw 1;
-}
-
-CEncoder::~CEncoder()
-{
-  if (_encoder != 0)
-    LzmaEnc_Destroy(_encoder, &g_Alloc, &g_BigAlloc);
-}
-
-inline wchar_t GetUpperChar(wchar_t c)
-{
-  if (c >= 'a' && c <= 'z')
-    c -= 0x20;
-  return c;
-}
-
-static int ParseMatchFinder(const wchar_t *s, int *btMode, int *numHashBytes)
-{
-  wchar_t c = GetUpperChar(*s++);
-  if (c == L'H')
-  {
-    if (GetUpperChar(*s++) != L'C')
-      return 0;
-    int numHashBytesLoc = (int)(*s++ - L'0');
-    if (numHashBytesLoc < 4 || numHashBytesLoc > 4)
-      return 0;
-    if (*s++ != 0)
-      return 0;
-    *btMode = 0;
-    *numHashBytes = numHashBytesLoc;
-    return 1;
-  }
-  if (c != L'B')
-    return 0;
-
-  if (GetUpperChar(*s++) != L'T')
-    return 0;
-  int numHashBytesLoc = (int)(*s++ - L'0');
-  if (numHashBytesLoc < 2 || numHashBytesLoc > 4)
-    return 0;
-  c = GetUpperChar(*s++);
-  if (c != L'\0')
-    return 0;
-  *btMode = 1;
-  *numHashBytes = numHashBytesLoc;
-  return 1;
-}
-
-STDMETHODIMP CEncoder::SetCoderProperties(const PROPID *propIDs,
-    const PROPVARIANT *coderProps, UInt32 numProps)
-{
-  CLzmaEncProps props;
-  LzmaEncProps_Init(&props);
-
-  for (UInt32 i = 0; i < numProps; i++)
-  {
-    const PROPVARIANT &prop = coderProps[i];
-    switch (propIDs[i])
-    {
-      case NCoderPropID::kNumFastBytes:
-        if (prop.vt != VT_UI4) return E_INVALIDARG; props.fb = prop.ulVal; break;
-      case NCoderPropID::kMatchFinderCycles:
-        if (prop.vt != VT_UI4) return E_INVALIDARG; props.mc = prop.ulVal; break;
-      case NCoderPropID::kAlgorithm:
-        if (prop.vt != VT_UI4) return E_INVALIDARG; props.algo = prop.ulVal; break;
-      case NCoderPropID::kDictionarySize:
-        if (prop.vt != VT_UI4) return E_INVALIDARG; props.dictSize = prop.ulVal; break;
-      case NCoderPropID::kPosStateBits:
-        if (prop.vt != VT_UI4) return E_INVALIDARG; props.pb = prop.ulVal; break;
-      case NCoderPropID::kLitPosBits:
-        if (prop.vt != VT_UI4) return E_INVALIDARG; props.lp = prop.ulVal; break;
-      case NCoderPropID::kLitContextBits:
-        if (prop.vt != VT_UI4) return E_INVALIDARG; props.lc = prop.ulVal; break;
-      case NCoderPropID::kNumThreads:
-        if (prop.vt != VT_UI4) return E_INVALIDARG; props.numThreads = prop.ulVal; break;
-      case NCoderPropID::kMultiThread:
-        if (prop.vt != VT_BOOL) return E_INVALIDARG; props.numThreads = ((prop.boolVal == VARIANT_TRUE) ? 2 : 1); break;
-      case NCoderPropID::kEndMarker:
-        if (prop.vt != VT_BOOL) return E_INVALIDARG; props.writeEndMark = (prop.boolVal == VARIANT_TRUE); break;
-      case NCoderPropID::kMatchFinder:
-        if (prop.vt != VT_BSTR) return E_INVALIDARG;
-        if (!ParseMatchFinder(prop.bstrVal, &props.btMode, &props.numHashBytes /* , &_matchFinderBase.skipModeBits */))
-          return E_INVALIDARG; break;
-      default:
-        return E_INVALIDARG;
-    }
-  }
-  return SResToHRESULT(LzmaEnc_SetProps(_encoder, &props));
-}
-
-STDMETHODIMP CEncoder::WriteCoderProperties(ISequentialOutStream *outStream)
-{
-  Byte props[LZMA_PROPS_SIZE];
-  size_t size = LZMA_PROPS_SIZE;
-  RINOK(LzmaEnc_WriteProperties(_encoder, props, &size));
-  return WriteStream(outStream, props, size);
-}
-
-STDMETHODIMP CEncoder::SetOutStream(ISequentialOutStream *outStream)
-{
-  _seqOutStream.RealStream = outStream;
-  _seqOutStream.Res = S_OK;
-  return S_OK;
-}
-
-STDMETHODIMP CEncoder::ReleaseOutStream()
-{
-  _seqOutStream.RealStream.Release();
-  return S_OK;
-}
-
-typedef struct _CCompressProgressImp
-{
-  ICompressProgress p;
-  ICompressProgressInfo *Progress;
-  HRESULT Res;
-} CCompressProgressImp;
-
-#define PROGRESS_UNKNOWN_VALUE ((UInt64)(Int64)-1)
-
-#define CONVERT_PR_VAL(x) (x == PROGRESS_UNKNOWN_VALUE ? NULL : &x)
-
-SRes CompressProgress(void *pp, UInt64 inSize, UInt64 outSize)
-{
-  CCompressProgressImp *p = (CCompressProgressImp *)pp;
-  p->Res = p->Progress->SetRatioInfo(CONVERT_PR_VAL(inSize), CONVERT_PR_VAL(outSize));
-  return (SRes)p->Res;
-}
-
-STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
-    const UInt64 * /* inSize */, const UInt64 * /* outSize */, ICompressProgressInfo *progress)
-{
-  CCompressProgressImp progressImp;
-  progressImp.p.Progress = CompressProgress;
-  progressImp.Progress = progress;
-  progressImp.Res = SZ_OK;
-
-  _seqInStream.RealStream = inStream;
-  SetOutStream(outStream);
-  SRes res = LzmaEnc_Encode(_encoder, &_seqOutStream.SeqOutStream, &_seqInStream.SeqInStream, progress ? &progressImp.p : NULL, &g_Alloc, &g_BigAlloc);
-  ReleaseOutStream();
-  if (res == SZ_ERROR_WRITE && _seqOutStream.Res != S_OK)
-    return _seqOutStream.Res;
-  if (res == SZ_ERROR_PROGRESS && progressImp.Res != S_OK)
-    return progressImp.Res;
-  return SResToHRESULT(res);
-}
-  
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LzmaEncoder.h b/third_party/lzma/v4_65/files/CPP/7zip/Compress/LzmaEncoder.h
deleted file mode 100644
index 4205d2b..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LzmaEncoder.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// LzmaEncoder.h
-
-#ifndef __LZMA_ENCODER_H
-#define __LZMA_ENCODER_H
-
-extern "C"
-{
-#include "../../../C/LzmaEnc.h"
-}
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-namespace NCompress {
-namespace NLzma {
-
-struct CSeqInStream
-{
-  ISeqInStream SeqInStream;
-  ISequentialInStream *RealStream;
-};
-
-struct CSeqOutStream
-{
-  ISeqOutStream SeqOutStream;
-  CMyComPtr<ISequentialOutStream> RealStream;
-  HRESULT Res;
-};
-
-class CEncoder :
-  public ICompressCoder,
-  public ICompressSetOutStream,
-  public ICompressSetCoderProperties,
-  public ICompressWriteCoderProperties,
-  public CMyUnknownImp
-{
-  CLzmaEncHandle _encoder;
- 
-  CSeqInStream _seqInStream;
-  CSeqOutStream _seqOutStream;
-
-public:
-  CEncoder();
-
-  MY_UNKNOWN_IMP3(
-      ICompressSetOutStream,
-      ICompressSetCoderProperties,
-      ICompressWriteCoderProperties
-      )
-    
-  STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
-      const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-  STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
-  STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream);
-  STDMETHOD(SetOutStream)(ISequentialOutStream *outStream);
-  STDMETHOD(ReleaseOutStream)();
-
-  virtual ~CEncoder();
-};
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LzmaRegister.cpp b/third_party/lzma/v4_65/files/CPP/7zip/Compress/LzmaRegister.cpp
deleted file mode 100644
index 96ed0ba..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/LzmaRegister.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-// LzmaRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../Common/RegisterCodec.h"
-
-#include "LzmaDecoder.h"
-
-static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::NLzma::CDecoder); }
-#ifndef EXTRACT_ONLY
-#include "LzmaEncoder.h"
-static void *CreateCodecOut() { return (void *)(ICompressCoder *)(new NCompress::NLzma::CEncoder);  }
-#else
-#define CreateCodecOut 0
-#endif
-
-static CCodecInfo g_CodecInfo =
-  { CreateCodec, CreateCodecOut, 0x030101, L"LZMA", 1, false };
-
-REGISTER_CODEC(LZMA)
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/RangeCoder.h b/third_party/lzma/v4_65/files/CPP/7zip/Compress/RangeCoder.h
deleted file mode 100644
index 1e14ac1..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/RangeCoder.h
+++ /dev/null
@@ -1,204 +0,0 @@
-// Compress/RangeCoder.h
-
-#ifndef __COMPRESS_RANGE_CODER_H
-#define __COMPRESS_RANGE_CODER_H
-
-#include "../Common/InBuffer.h"
-#include "../Common/OutBuffer.h"
-
-namespace NCompress {
-namespace NRangeCoder {
-
-const int kNumTopBits = 24;
-const UInt32 kTopValue = (1 << kNumTopBits);
-
-class CEncoder
-{
-  UInt32 _cacheSize;
-  Byte _cache;
-public:
-  UInt64 Low;
-  UInt32 Range;
-  COutBuffer Stream;
-  bool Create(UInt32 bufferSize) { return Stream.Create(bufferSize); }
-
-  void SetStream(ISequentialOutStream *stream) { Stream.SetStream(stream); }
-  void Init()
-  {
-    Stream.Init();
-    Low = 0;
-    Range = 0xFFFFFFFF;
-    _cacheSize = 1;
-    _cache = 0;
-  }
-
-  void FlushData()
-  {
-    // Low += 1;
-    for(int i = 0; i < 5; i++)
-      ShiftLow();
-  }
-
-  HRESULT FlushStream() { return Stream.Flush();  }
-
-  void ReleaseStream() { Stream.ReleaseStream(); }
-
-  void Encode(UInt32 start, UInt32 size, UInt32 total)
-  {
-    Low += start * (Range /= total);
-    Range *= size;
-    while (Range < kTopValue)
-    {
-      Range <<= 8;
-      ShiftLow();
-    }
-  }
-
-  void ShiftLow()
-  {
-    if ((UInt32)Low < (UInt32)0xFF000000 || (int)(Low >> 32) != 0)
-    {
-      Byte temp = _cache;
-      do
-      {
-        Stream.WriteByte((Byte)(temp + (Byte)(Low >> 32)));
-        temp = 0xFF;
-      }
-      while(--_cacheSize != 0);
-      _cache = (Byte)((UInt32)Low >> 24);
-    }
-    _cacheSize++;
-    Low = (UInt32)Low << 8;
-  }
-  
-  void EncodeDirectBits(UInt32 value, int numBits)
-  {
-    for (numBits--; numBits >= 0; numBits--)
-    {
-      Range >>= 1;
-      Low += Range & (0 - ((value >> numBits) & 1));
-      if (Range < kTopValue)
-      {
-        Range <<= 8;
-        ShiftLow();
-      }
-    }
-  }
-
-  void EncodeBit(UInt32 size0, UInt32 numTotalBits, UInt32 symbol)
-  {
-    UInt32 newBound = (Range >> numTotalBits) * size0;
-    if (symbol == 0)
-      Range = newBound;
-    else
-    {
-      Low += newBound;
-      Range -= newBound;
-    }
-    while (Range < kTopValue)
-    {
-      Range <<= 8;
-      ShiftLow();
-    }
-  }
-
-  UInt64 GetProcessedSize() {  return Stream.GetProcessedSize() + _cacheSize + 4; }
-};
-
-class CDecoder
-{
-public:
-  CInBuffer Stream;
-  UInt32 Range;
-  UInt32 Code;
-  bool Create(UInt32 bufferSize) { return Stream.Create(bufferSize); }
-
-  void Normalize()
-  {
-    while (Range < kTopValue)
-    {
-      Code = (Code << 8) | Stream.ReadByte();
-      Range <<= 8;
-    }
-  }
-  
-  void SetStream(ISequentialInStream *stream) { Stream.SetStream(stream); }
-  void Init()
-  {
-    Stream.Init();
-    Code = 0;
-    Range = 0xFFFFFFFF;
-    for(int i = 0; i < 5; i++)
-      Code = (Code << 8) | Stream.ReadByte();
-  }
-
-  void ReleaseStream() { Stream.ReleaseStream(); }
-
-  UInt32 GetThreshold(UInt32 total)
-  {
-    return (Code) / ( Range /= total);
-  }
-
-  void Decode(UInt32 start, UInt32 size)
-  {
-    Code -= start * Range;
-    Range *= size;
-    Normalize();
-  }
-
-  UInt32 DecodeDirectBits(int numTotalBits)
-  {
-    UInt32 range = Range;
-    UInt32 code = Code;
-    UInt32 result = 0;
-    for (int i = numTotalBits; i != 0; i--)
-    {
-      range >>= 1;
-      /*
-      result <<= 1;
-      if (code >= range)
-      {
-        code -= range;
-        result |= 1;
-      }
-      */
-      UInt32 t = (code - range) >> 31;
-      code -= range & (t - 1);
-      result = (result << 1) | (1 - t);
-
-      if (range < kTopValue)
-      {
-        code = (code << 8) | Stream.ReadByte();
-        range <<= 8;
-      }
-    }
-    Range = range;
-    Code = code;
-    return result;
-  }
-
-  UInt32 DecodeBit(UInt32 size0, UInt32 numTotalBits)
-  {
-    UInt32 newBound = (Range >> numTotalBits) * size0;
-    UInt32 symbol;
-    if (Code < newBound)
-    {
-      symbol = 0;
-      Range = newBound;
-    }
-    else
-    {
-      symbol = 1;
-      Code -= newBound;
-      Range -= newBound;
-    }
-    Normalize();
-    return symbol;
-  }
-
-  UInt64 GetProcessedSize() {return Stream.GetProcessedSize(); }
-};
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/RangeCoderBit.h b/third_party/lzma/v4_65/files/CPP/7zip/Compress/RangeCoderBit.h
deleted file mode 100644
index 566cdd4..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/RangeCoderBit.h
+++ /dev/null
@@ -1,113 +0,0 @@
-// Compress/RangeCoderBit.h
-
-#ifndef __COMPRESS_RANGE_CODER_BIT_H
-#define __COMPRESS_RANGE_CODER_BIT_H
-
-#include "RangeCoder.h"
-
-namespace NCompress {
-namespace NRangeCoder {
-
-const int kNumBitModelTotalBits  = 11;
-const UInt32 kBitModelTotal = (1 << kNumBitModelTotalBits);
-
-const int kNumMoveReducingBits = 4;
-
-const int kNumBitPriceShiftBits = 4;
-const UInt32 kBitPrice = 1 << kNumBitPriceShiftBits;
-
-extern UInt32 ProbPrices[kBitModelTotal >> kNumMoveReducingBits];
-
-template <int numMoveBits>
-class CBitModel
-{
-public:
-  UInt32 Prob;
-  void UpdateModel(UInt32 symbol)
-  {
-    /*
-    Prob -= (Prob + ((symbol - 1) & ((1 << numMoveBits) - 1))) >> numMoveBits;
-    Prob += (1 - symbol) << (kNumBitModelTotalBits - numMoveBits);
-    */
-    if (symbol == 0)
-      Prob += (kBitModelTotal - Prob) >> numMoveBits;
-    else
-      Prob -= (Prob) >> numMoveBits;
-  }
-public:
-  void Init() { Prob = kBitModelTotal / 2; }
-};
-
-template <int numMoveBits>
-class CBitEncoder: public CBitModel<numMoveBits>
-{
-public:
-  void Encode(CEncoder *encoder, UInt32 symbol)
-  {
-    /*
-    encoder->EncodeBit(this->Prob, kNumBitModelTotalBits, symbol);
-    this->UpdateModel(symbol);
-    */
-    UInt32 newBound = (encoder->Range >> kNumBitModelTotalBits) * this->Prob;
-    if (symbol == 0)
-    {
-      encoder->Range = newBound;
-      this->Prob += (kBitModelTotal - this->Prob) >> numMoveBits;
-    }
-    else
-    {
-      encoder->Low += newBound;
-      encoder->Range -= newBound;
-      this->Prob -= (this->Prob) >> numMoveBits;
-    }
-    if (encoder->Range < kTopValue)
-    {
-      encoder->Range <<= 8;
-      encoder->ShiftLow();
-    }
-  }
-  UInt32 GetPrice(UInt32 symbol) const
-  {
-    return ProbPrices[(this->Prob ^ ((-(int)symbol)) & (kBitModelTotal - 1)) >> kNumMoveReducingBits];
-  }
-  UInt32 GetPrice0() const { return ProbPrices[this->Prob >> kNumMoveReducingBits]; }
-  UInt32 GetPrice1() const { return ProbPrices[(this->Prob ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits]; }
-};
-
-
-template <int numMoveBits>
-class CBitDecoder: public CBitModel<numMoveBits>
-{
-public:
-  UInt32 Decode(CDecoder *decoder)
-  {
-    UInt32 newBound = (decoder->Range >> kNumBitModelTotalBits) * this->Prob;
-    if (decoder->Code < newBound)
-    {
-      decoder->Range = newBound;
-      this->Prob += (kBitModelTotal - this->Prob) >> numMoveBits;
-      if (decoder->Range < kTopValue)
-      {
-        decoder->Code = (decoder->Code << 8) | decoder->Stream.ReadByte();
-        decoder->Range <<= 8;
-      }
-      return 0;
-    }
-    else
-    {
-      decoder->Range -= newBound;
-      decoder->Code -= newBound;
-      this->Prob -= (this->Prob) >> numMoveBits;
-      if (decoder->Range < kTopValue)
-      {
-        decoder->Code = (decoder->Code << 8) | decoder->Stream.ReadByte();
-        decoder->Range <<= 8;
-      }
-      return 1;
-    }
-  }
-};
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/Compress/StdAfx.h b/third_party/lzma/v4_65/files/CPP/7zip/Compress/StdAfx.h
deleted file mode 100644
index 99a8aa4..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/Compress/StdAfx.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../Common/MyWindows.h"
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/ICoder.h b/third_party/lzma/v4_65/files/CPP/7zip/ICoder.h
deleted file mode 100644
index 262dfdb..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/ICoder.h
+++ /dev/null
@@ -1,186 +0,0 @@
-// ICoder.h
-
-#ifndef __ICODER_H
-#define __ICODER_H
-
-#include "IStream.h"
-
-#define CODER_INTERFACE(i, x) DECL_INTERFACE(i, 4, x)
-
-CODER_INTERFACE(ICompressProgressInfo, 0x04)
-{
-  STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize) PURE;
-};
-
-CODER_INTERFACE(ICompressCoder, 0x05)
-{
-  STDMETHOD(Code)(ISequentialInStream *inStream,
-      ISequentialOutStream *outStream,
-      const UInt64 *inSize,
-      const UInt64 *outSize,
-      ICompressProgressInfo *progress) PURE;
-};
-
-CODER_INTERFACE(ICompressCoder2, 0x18)
-{
-  STDMETHOD(Code)(ISequentialInStream **inStreams,
-      const UInt64 **inSizes,
-      UInt32 numInStreams,
-      ISequentialOutStream **outStreams,
-      const UInt64 **outSizes,
-      UInt32 numOutStreams,
-      ICompressProgressInfo *progress) PURE;
-};
-
-namespace NCoderPropID
-{
-  enum EEnum
-  {
-    kDictionarySize = 0x400,
-    kUsedMemorySize,
-    kOrder,
-    kBlockSize,
-    kPosStateBits = 0x440,
-    kLitContextBits,
-    kLitPosBits,
-    kNumFastBytes = 0x450,
-    kMatchFinder,
-    kMatchFinderCycles,
-    kNumPasses = 0x460,
-    kAlgorithm = 0x470,
-    kMultiThread = 0x480,
-    kNumThreads,
-    kEndMarker = 0x490
-  };
-}
-
-CODER_INTERFACE(ICompressSetCoderProperties, 0x20)
-{
-  STDMETHOD(SetCoderProperties)(const PROPID *propIDs,
-      const PROPVARIANT *properties, UInt32 numProperties) PURE;
-};
-
-/*
-CODER_INTERFACE(ICompressSetCoderProperties, 0x21)
-{
-  STDMETHOD(SetDecoderProperties)(ISequentialInStream *inStream) PURE;
-};
-*/
-
-CODER_INTERFACE(ICompressSetDecoderProperties2, 0x22)
-{
-  STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size) PURE;
-};
-
-CODER_INTERFACE(ICompressWriteCoderProperties, 0x23)
-{
-  STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStreams) PURE;
-};
-
-CODER_INTERFACE(ICompressGetInStreamProcessedSize, 0x24)
-{
-  STDMETHOD(GetInStreamProcessedSize)(UInt64 *value) PURE;
-};
-
-CODER_INTERFACE(ICompressSetCoderMt, 0x25)
-{
-  STDMETHOD(SetNumberOfThreads)(UInt32 numThreads) PURE;
-};
-
-CODER_INTERFACE(ICompressGetSubStreamSize, 0x30)
-{
-  STDMETHOD(GetSubStreamSize)(UInt64 subStream, UInt64 *value) PURE;
-};
-
-CODER_INTERFACE(ICompressSetInStream, 0x31)
-{
-  STDMETHOD(SetInStream)(ISequentialInStream *inStream) PURE;
-  STDMETHOD(ReleaseInStream)() PURE;
-};
-
-CODER_INTERFACE(ICompressSetOutStream, 0x32)
-{
-  STDMETHOD(SetOutStream)(ISequentialOutStream *outStream) PURE;
-  STDMETHOD(ReleaseOutStream)() PURE;
-};
-
-CODER_INTERFACE(ICompressSetInStreamSize, 0x33)
-{
-  STDMETHOD(SetInStreamSize)(const UInt64 *inSize) PURE;
-};
-
-CODER_INTERFACE(ICompressSetOutStreamSize, 0x34)
-{
-  STDMETHOD(SetOutStreamSize)(const UInt64 *outSize) PURE;
-};
-
-CODER_INTERFACE(ICompressFilter, 0x40)
-{
-  STDMETHOD(Init)() PURE;
-  STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size) PURE;
-  // Filter return outSize (UInt32)
-  // if (outSize <= size): Filter have converted outSize bytes
-  // if (outSize > size): Filter have not converted anything.
-  //      and it needs at least outSize bytes to convert one block
-  //      (it's for crypto block algorithms).
-};
-
-CODER_INTERFACE(ICompressCodecsInfo, 0x60)
-{
-  STDMETHOD(GetNumberOfMethods)(UInt32 *numMethods) PURE;
-  STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value) PURE;
-  STDMETHOD(CreateDecoder)(UInt32 index, const GUID *iid, void **coder) PURE;
-  STDMETHOD(CreateEncoder)(UInt32 index, const GUID *iid, void **coder) PURE;
-};
-CODER_INTERFACE(ISetCompressCodecsInfo, 0x61)
-{
-  STDMETHOD(SetCompressCodecsInfo)(ICompressCodecsInfo *compressCodecsInfo) PURE;
-};
-
-CODER_INTERFACE(ICryptoProperties, 0x80)
-{
-  STDMETHOD(SetKey)(const Byte *data, UInt32 size) PURE;
-  STDMETHOD(SetInitVector)(const Byte *data, UInt32 size) PURE;
-};
-
-/*
-CODER_INTERFACE(ICryptoResetSalt, 0x88)
-{
-  STDMETHOD(ResetSalt)() PURE;
-};
-*/
-
-CODER_INTERFACE(ICryptoResetInitVector, 0x8C)
-{
-  STDMETHOD(ResetInitVector)() PURE;
-};
-
-CODER_INTERFACE(ICryptoSetPassword, 0x90)
-{
-  STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size) PURE;
-};
-
-CODER_INTERFACE(ICryptoSetCRC, 0xA0)
-{
-  STDMETHOD(CryptoSetCRC)(UInt32 crc) PURE;
-};
-
-//////////////////////
-// It's for DLL file
-namespace NMethodPropID
-{
-  enum EEnum
-  {
-    kID,
-    kName,
-    kDecoder,
-    kEncoder,
-    kInStreams,
-    kOutStreams,
-    kDescription,
-    kDecoderIsAssigned,
-    kEncoderIsAssigned
-  };
-}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/IDecl.h b/third_party/lzma/v4_65/files/CPP/7zip/IDecl.h
deleted file mode 100644
index 8316eb3..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/IDecl.h
+++ /dev/null
@@ -1,15 +0,0 @@
-// IDecl.h
-
-#ifndef __IDECL_H
-#define __IDECL_H
-
-#include "../Common/MyUnknown.h"
-
-#define DECL_INTERFACE_SUB(i, base, groupId, subId) \
-DEFINE_GUID(IID_ ## i, \
-0x23170F69, 0x40C1, 0x278A, 0, 0, 0, (groupId), 0, (subId), 0, 0); \
-struct i: public base
-
-#define DECL_INTERFACE(i, groupId, subId) DECL_INTERFACE_SUB(i, IUnknown, groupId, subId)
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/IPassword.h b/third_party/lzma/v4_65/files/CPP/7zip/IPassword.h
deleted file mode 100644
index 3ca7b09..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/IPassword.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// IPassword.h
-
-#ifndef __IPASSWORD_H
-#define __IPASSWORD_H
-
-#include "../Common/MyUnknown.h"
-#include "../Common/Types.h"
-
-#include "IDecl.h"
-
-#define PASSWORD_INTERFACE(i, x) DECL_INTERFACE(i, 5, x)
-
-PASSWORD_INTERFACE(ICryptoGetTextPassword, 0x10)
-{
-  STDMETHOD(CryptoGetTextPassword)(BSTR *password) PURE;
-};
-
-PASSWORD_INTERFACE(ICryptoGetTextPassword2, 0x11)
-{
-  STDMETHOD(CryptoGetTextPassword2)(Int32 *passwordIsDefined, BSTR *password) PURE;
-};
-
-#endif
-
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/IProgress.h b/third_party/lzma/v4_65/files/CPP/7zip/IProgress.h
deleted file mode 100644
index d6093f1..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/IProgress.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Interface/IProgress.h
-
-#ifndef __IPROGRESS_H
-#define __IPROGRESS_H
-
-#include "../Common/MyUnknown.h"
-#include "../Common/Types.h"
-
-#include "IDecl.h"
-
-#define INTERFACE_IProgress(x) \
-  STDMETHOD(SetTotal)(UInt64 total) x; \
-  STDMETHOD(SetCompleted)(const UInt64 *completeValue) x; \
-
-DECL_INTERFACE(IProgress, 0, 5)
-{
-  INTERFACE_IProgress(PURE)
-};
-
-/*
-// {23170F69-40C1-278A-0000-000000050002}
-DEFINE_GUID(IID_IProgress2,
-0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x02);
-MIDL_INTERFACE("23170F69-40C1-278A-0000-000000050002")
-IProgress2: public IUnknown
-{
-public:
-  STDMETHOD(SetTotal)(const UInt64 *total) PURE;
-  STDMETHOD(SetCompleted)(const UInt64 *completeValue) PURE;
-};
-*/
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/IStream.h b/third_party/lzma/v4_65/files/CPP/7zip/IStream.h
deleted file mode 100644
index a177a9c..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/IStream.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// IStream.h
-
-#ifndef __ISTREAM_H
-#define __ISTREAM_H
-
-#include "../Common/MyUnknown.h"
-#include "../Common/Types.h"
-
-#include "IDecl.h"
-
-#define STREAM_INTERFACE_SUB(i, base, x) DECL_INTERFACE_SUB(i, base, 3, x)
-#define STREAM_INTERFACE(i, x) STREAM_INTERFACE_SUB(i, IUnknown, x)
-
-STREAM_INTERFACE(ISequentialInStream, 0x01)
-{
-  STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize) PURE;
-  /*
-  Out: if size != 0, return_value = S_OK and (*processedSize == 0),
-    then there are no more bytes in stream.
-  if (size > 0) && there are bytes in stream,
-  this function must read at least 1 byte.
-  This function is allowed to read less than number of remaining bytes in stream.
-  You must call Read function in loop, if you need exact amount of data
-  */
-};
-
-STREAM_INTERFACE(ISequentialOutStream, 0x02)
-{
-  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize) PURE;
-  /*
-  if (size > 0) this function must write at least 1 byte.
-  This function is allowed to write less than "size".
-  You must call Write function in loop, if you need to write exact amount of data
-  */
-};
-
-STREAM_INTERFACE_SUB(IInStream, ISequentialInStream, 0x03)
-{
-  STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) PURE;
-};
-
-STREAM_INTERFACE_SUB(IOutStream, ISequentialOutStream, 0x04)
-{
-  STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) PURE;
-  STDMETHOD(SetSize)(Int64 newSize) PURE;
-};
-
-STREAM_INTERFACE(IStreamGetSize, 0x06)
-{
-  STDMETHOD(GetSize)(UInt64 *size) PURE;
-};
-
-STREAM_INTERFACE(IOutStreamFlush, 0x07)
-{
-  STDMETHOD(Flush)() PURE;
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/MyVersion.h b/third_party/lzma/v4_65/files/CPP/7zip/MyVersion.h
deleted file mode 100644
index 68058ec..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/MyVersion.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#define MY_VER_MAJOR 4
-#define MY_VER_MINOR 65
-#define MY_VER_BUILD 0
-#define MY_VERSION "4.65"
-#define MY_7ZIP_VERSION "7-Zip 4.65"
-#define MY_DATE "2009-02-03"
-#define MY_COPYRIGHT "Copyright (c) 1999-2009 Igor Pavlov"
-#define MY_VERSION_COPYRIGHT_DATE MY_VERSION "  " MY_COPYRIGHT "  " MY_DATE
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/MyVersionInfo.rc b/third_party/lzma/v4_65/files/CPP/7zip/MyVersionInfo.rc
deleted file mode 100644
index c3712b1..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/MyVersionInfo.rc
+++ /dev/null
@@ -1,45 +0,0 @@
-#include <WinVer.h>
-#include "MyVersion.h"
-
-#define MY_VER MY_VER_MAJOR,MY_VER_MINOR,MY_VER_BUILD,0
-
-#ifdef DEBUG
-#define DBG_FL VS_FF_DEBUG
-#else
-#define DBG_FL 0
-#endif
-
-#define MY_VERSION_INFO(fileType, descr, intName, origName)  \
-LANGUAGE 9, 1 \
-1 VERSIONINFO \
-  FILEVERSION MY_VER \
-  PRODUCTVERSION MY_VER \
-  FILEFLAGSMASK VS_FFI_FILEFLAGSMASK \
-  FILEFLAGS DBG_FL \
-  FILEOS VOS_NT_WINDOWS32 \
-  FILETYPE fileType \
-  FILESUBTYPE 0x0L \
-BEGIN \
-    BLOCK "StringFileInfo" \
-    BEGIN  \
-        BLOCK "040904b0" \
-        BEGIN \
-            VALUE "CompanyName", "Igor Pavlov" \
-            VALUE "FileDescription", descr \
-            VALUE "FileVersion", MY_VERSION  \
-            VALUE "InternalName", intName \
-            VALUE "LegalCopyright", MY_COPYRIGHT \
-            VALUE "OriginalFilename", origName \
-            VALUE "ProductName", "7-Zip" \
-            VALUE "ProductVersion", MY_VERSION \
-        END \
-    END \
-    BLOCK "VarFileInfo" \
-    BEGIN \
-        VALUE "Translation", 0x409, 1200 \
-    END \
-END
-
-#define MY_VERSION_INFO_APP(descr, intName) MY_VERSION_INFO(VFT_APP, descr, intName, intName ".exe")
-
-#define MY_VERSION_INFO_DLL(descr, intName) MY_VERSION_INFO(VFT_DLL, descr, intName, intName ".dll")
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/PropID.h b/third_party/lzma/v4_65/files/CPP/7zip/PropID.h
deleted file mode 100644
index 9de487e..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/PropID.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// PropID.h
-
-#ifndef __7ZIP_PROPID_H
-#define __7ZIP_PROPID_H
-
-enum
-{
-  kpidNoProperty = 0,
-  
-  kpidHandlerItemIndex = 2,
-  kpidPath,
-  kpidName,
-  kpidExtension,
-  kpidIsDir,
-  kpidSize,
-  kpidPackSize,
-  kpidAttrib,
-  kpidCTime,
-  kpidATime,
-  kpidMTime,
-  kpidSolid,
-  kpidCommented,
-  kpidEncrypted,
-  kpidSplitBefore,
-  kpidSplitAfter,
-  kpidDictionarySize,
-  kpidCRC,
-  kpidType,
-  kpidIsAnti,
-  kpidMethod,
-  kpidHostOS,
-  kpidFileSystem,
-  kpidUser,
-  kpidGroup,
-  kpidBlock,
-  kpidComment,
-  kpidPosition,
-  kpidPrefix,
-  kpidNumSubDirs,
-  kpidNumSubFiles,
-  kpidUnpackVer,
-  kpidVolume,
-  kpidIsVolume,
-  kpidOffset,
-  kpidLinks,
-  kpidNumBlocks,
-  kpidNumVolumes,
-  kpidTimeType,
-  kpidBit64,
-  kpidBigEndian,
-  kpidCpu,
-  kpidPhySize,
-  kpidHeadersSize,
-  kpidChecksum,
-  kpidCharacts,
-  kpidVa,
-
-  kpidTotalSize = 0x1100,
-  kpidFreeSpace,
-  kpidClusterSize,
-  kpidVolumeName,
-
-  kpidLocalName = 0x1200,
-  kpidProvider,
-
-  kpidUserDefined = 0x10000
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Client7z/Client7z.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Client7z/Client7z.cpp
deleted file mode 100644
index a63144a..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Client7z/Client7z.cpp
+++ /dev/null
@@ -1,853 +0,0 @@
-// Client7z.cpp
-
-#include "StdAfx.h"
-
-#include "Common/IntToString.h"
-#include "Common/MyInitGuid.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/DLL.h"
-#include "Windows/FileDir.h"
-#include "Windows/FileFind.h"
-#include "Windows/FileName.h"
-#include "Windows/PropVariant.h"
-#include "Windows/PropVariantConversions.h"
-
-#include "../../Common/FileStreams.h"
-
-#include "../../Archive/IArchive.h"
-
-#include "../../IPassword.h"
-#include "../../MyVersion.h"
-
-// use another CLSIDs, if you want to support other formats (zip, rar, ...).
-// {23170F69-40C1-278A-1000-000110070000}
-DEFINE_GUID(CLSID_CFormat7z,
-  0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x07, 0x00, 0x00);
-
-using namespace NWindows;
-
-#define kDllName "7z.dll"
-
-static const char *kCopyrightString = MY_7ZIP_VERSION
-" ("  kDllName " client) "
-MY_COPYRIGHT " " MY_DATE;
-
-static const char *kHelpString =
-"Usage: Client7z.exe [a | l | x ] archive.7z [fileName ...]\n"
-"Examples:\n"
-"  Client7z.exe a archive.7z f1.txt f2.txt  : compress two files to archive.7z\n"
-"  Client7z.exe l archive.7z   : List contents of archive.7z\n"
-"  Client7z.exe x archive.7z   : eXtract files from archive.7z\n";
-
-
-typedef UINT32 (WINAPI * CreateObjectFunc)(
-    const GUID *clsID,
-    const GUID *interfaceID,
-    void **outObject);
-
-#ifdef _WIN32
-#ifndef _UNICODE
-bool g_IsNT = false;
-static inline bool IsItWindowsNT()
-{
-  OSVERSIONINFO versionInfo;
-  versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
-  if (!::GetVersionEx(&versionInfo))
-    return false;
-  return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
-}
-#endif
-#endif
-
-void PrintString(const UString &s)
-{
-  printf("%s", (LPCSTR)GetOemString(s));
-}
-
-void PrintString(const AString &s)
-{
-  printf("%s", (LPCSTR)s);
-}
-
-void PrintNewLine()
-{
-  PrintString("\n");
-}
-
-void PrintStringLn(const AString &s)
-{
-  PrintString(s);
-  PrintNewLine();
-}
-
-void PrintError(const AString &s)
-{
-  PrintNewLine();
-  PrintString(s);
-  PrintNewLine();
-}
-
-static HRESULT IsArchiveItemProp(IInArchive *archive, UInt32 index, PROPID propID, bool &result)
-{
-  NCOM::CPropVariant prop;
-  RINOK(archive->GetProperty(index, propID, &prop));
-  if (prop.vt == VT_BOOL)
-    result = VARIANT_BOOLToBool(prop.boolVal);
-  else if (prop.vt == VT_EMPTY)
-    result = false;
-  else
-    return E_FAIL;
-  return S_OK;
-}
-
-static HRESULT IsArchiveItemFolder(IInArchive *archive, UInt32 index, bool &result)
-{
-  return IsArchiveItemProp(archive, index, kpidIsDir, result);
-}
-
-
-static const wchar_t *kEmptyFileAlias = L"[Content]";
-
-
-//////////////////////////////////////////////////////////////
-// Archive Open callback class
-
-
-class CArchiveOpenCallback:
-  public IArchiveOpenCallback,
-  public ICryptoGetTextPassword,
-  public CMyUnknownImp
-{
-public:
-  MY_UNKNOWN_IMP1(ICryptoGetTextPassword)
-
-  STDMETHOD(SetTotal)(const UInt64 *files, const UInt64 *bytes);
-  STDMETHOD(SetCompleted)(const UInt64 *files, const UInt64 *bytes);
-
-  STDMETHOD(CryptoGetTextPassword)(BSTR *password);
-
-  bool PasswordIsDefined;
-  UString Password;
-
-  CArchiveOpenCallback() : PasswordIsDefined(false) {}
-};
-
-STDMETHODIMP CArchiveOpenCallback::SetTotal(const UInt64 * /* files */, const UInt64 * /* bytes */)
-{
-  return S_OK;
-}
-
-STDMETHODIMP CArchiveOpenCallback::SetCompleted(const UInt64 * /* files */, const UInt64 * /* bytes */)
-{
-  return S_OK;
-}
-  
-STDMETHODIMP CArchiveOpenCallback::CryptoGetTextPassword(BSTR *password)
-{
-  if (!PasswordIsDefined)
-  {
-    // You can ask real password here from user
-    // Password = GetPassword(OutStream);
-    // PasswordIsDefined = true;
-    PrintError("Password is not defined");
-    return E_ABORT;
-  }
-  return StringToBstr(Password, password);
-}
-
-
-//////////////////////////////////////////////////////////////
-// Archive Extracting callback class
-
-static const wchar_t *kCantDeleteOutputFile = L"ERROR: Can not delete output file ";
-
-static const char *kTestingString    =  "Testing     ";
-static const char *kExtractingString =  "Extracting  ";
-static const char *kSkippingString   =  "Skipping    ";
-
-static const char *kUnsupportedMethod = "Unsupported Method";
-static const char *kCRCFailed = "CRC Failed";
-static const char *kDataError = "Data Error";
-static const char *kUnknownError = "Unknown Error";
-
-class CArchiveExtractCallback:
-  public IArchiveExtractCallback,
-  public ICryptoGetTextPassword,
-  public CMyUnknownImp
-{
-public:
-  MY_UNKNOWN_IMP1(ICryptoGetTextPassword)
-
-  // IProgress
-  STDMETHOD(SetTotal)(UInt64 size);
-  STDMETHOD(SetCompleted)(const UInt64 *completeValue);
-
-  // IArchiveExtractCallback
-  STDMETHOD(GetStream)(UInt32 index, ISequentialOutStream **outStream, Int32 askExtractMode);
-  STDMETHOD(PrepareOperation)(Int32 askExtractMode);
-  STDMETHOD(SetOperationResult)(Int32 resultEOperationResult);
-
-  // ICryptoGetTextPassword
-  STDMETHOD(CryptoGetTextPassword)(BSTR *aPassword);
-
-private:
-  CMyComPtr<IInArchive> _archiveHandler;
-  UString _directoryPath;  // Output directory
-  UString _filePath;       // name inside arcvhive
-  UString _diskFilePath;   // full path to file on disk
-  bool _extractMode;
-  struct CProcessedFileInfo
-  {
-    FILETIME MTime;
-    UInt32 Attrib;
-    bool isDir;
-    bool AttribDefined;
-    bool MTimeDefined;
-  } _processedFileInfo;
-
-  COutFileStream *_outFileStreamSpec;
-  CMyComPtr<ISequentialOutStream> _outFileStream;
-
-public:
-  void Init(IInArchive *archiveHandler, const UString &directoryPath);
-
-  UInt64 NumErrors;
-  bool PasswordIsDefined;
-  UString Password;
-
-  CArchiveExtractCallback() : PasswordIsDefined(false) {}
-};
-
-void CArchiveExtractCallback::Init(IInArchive *archiveHandler, const UString &directoryPath)
-{
-  NumErrors = 0;
-  _archiveHandler = archiveHandler;
-  _directoryPath = directoryPath;
-  NFile::NName::NormalizeDirPathPrefix(_directoryPath);
-}
-
-STDMETHODIMP CArchiveExtractCallback::SetTotal(UInt64 /* size */)
-{
-  return S_OK;
-}
-
-STDMETHODIMP CArchiveExtractCallback::SetCompleted(const UInt64 * /* completeValue */)
-{
-  return S_OK;
-}
-
-STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index,
-    ISequentialOutStream **outStream, Int32 askExtractMode)
-{
-  *outStream = 0;
-  _outFileStream.Release();
-
-  {
-    // Get Name
-    NCOM::CPropVariant prop;
-    RINOK(_archiveHandler->GetProperty(index, kpidPath, &prop));
-    
-    UString fullPath;
-    if (prop.vt == VT_EMPTY)
-      fullPath = kEmptyFileAlias;
-    else
-    {
-      if (prop.vt != VT_BSTR)
-        return E_FAIL;
-      fullPath = prop.bstrVal;
-    }
-    _filePath = fullPath;
-  }
-
-  if (askExtractMode != NArchive::NExtract::NAskMode::kExtract)
-    return S_OK;
-
-  {
-    // Get Attrib
-    NCOM::CPropVariant prop;
-    RINOK(_archiveHandler->GetProperty(index, kpidAttrib, &prop));
-    if (prop.vt == VT_EMPTY)
-    {
-      _processedFileInfo.Attrib = 0;
-      _processedFileInfo.AttribDefined = false;
-    }
-    else
-    {
-      if (prop.vt != VT_UI4)
-        return E_FAIL;
-      _processedFileInfo.Attrib = prop.ulVal;
-      _processedFileInfo.AttribDefined = true;
-    }
-  }
-
-  RINOK(IsArchiveItemFolder(_archiveHandler, index, _processedFileInfo.isDir));
-
-  {
-    // Get Modified Time
-    NCOM::CPropVariant prop;
-    RINOK(_archiveHandler->GetProperty(index, kpidMTime, &prop));
-    _processedFileInfo.MTimeDefined = false;
-    switch(prop.vt)
-    {
-      case VT_EMPTY:
-        // _processedFileInfo.MTime = _utcMTimeDefault;
-        break;
-      case VT_FILETIME:
-        _processedFileInfo.MTime = prop.filetime;
-        _processedFileInfo.MTimeDefined = true;
-        break;
-      default:
-        return E_FAIL;
-    }
-
-  }
-  {
-    // Get Size
-    NCOM::CPropVariant prop;
-    RINOK(_archiveHandler->GetProperty(index, kpidSize, &prop));
-    bool newFileSizeDefined = (prop.vt != VT_EMPTY);
-    UInt64 newFileSize;
-    if (newFileSizeDefined)
-      newFileSize = ConvertPropVariantToUInt64(prop);
-  }
-
-  
-  {
-    // Create folders for file
-    int slashPos = _filePath.ReverseFind(WCHAR_PATH_SEPARATOR);
-    if (slashPos >= 0)
-      NFile::NDirectory::CreateComplexDirectory(_directoryPath + _filePath.Left(slashPos));
-  }
-
-  UString fullProcessedPath = _directoryPath + _filePath;
-  _diskFilePath = fullProcessedPath;
-
-  if (_processedFileInfo.isDir)
-  {
-    NFile::NDirectory::CreateComplexDirectory(fullProcessedPath);
-  }
-  else
-  {
-    NFile::NFind::CFileInfoW fi;
-    if (NFile::NFind::FindFile(fullProcessedPath, fi))
-    {
-      if (!NFile::NDirectory::DeleteFileAlways(fullProcessedPath))
-      {
-        PrintString(UString(kCantDeleteOutputFile) + fullProcessedPath);
-        return E_ABORT;
-      }
-    }
-    
-    _outFileStreamSpec = new COutFileStream;
-    CMyComPtr<ISequentialOutStream> outStreamLoc(_outFileStreamSpec);
-    if (!_outFileStreamSpec->Open(fullProcessedPath, CREATE_ALWAYS))
-    {
-      PrintString((UString)L"can not open output file " + fullProcessedPath);
-      return E_ABORT;
-    }
-    _outFileStream = outStreamLoc;
-    *outStream = outStreamLoc.Detach();
-  }
-  return S_OK;
-}
-
-STDMETHODIMP CArchiveExtractCallback::PrepareOperation(Int32 askExtractMode)
-{
-  _extractMode = false;
-  switch (askExtractMode)
-  {
-    case NArchive::NExtract::NAskMode::kExtract:  _extractMode = true; break;
-  };
-  switch (askExtractMode)
-  {
-    case NArchive::NExtract::NAskMode::kExtract:  PrintString(kExtractingString); break;
-    case NArchive::NExtract::NAskMode::kTest:  PrintString(kTestingString); break;
-    case NArchive::NExtract::NAskMode::kSkip:  PrintString(kSkippingString); break;
-  };
-  PrintString(_filePath);
-  return S_OK;
-}
-
-STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 operationResult)
-{
-  switch(operationResult)
-  {
-    case NArchive::NExtract::NOperationResult::kOK:
-      break;
-    default:
-    {
-      NumErrors++;
-      PrintString("     ");
-      switch(operationResult)
-      {
-        case NArchive::NExtract::NOperationResult::kUnSupportedMethod:
-          PrintString(kUnsupportedMethod);
-          break;
-        case NArchive::NExtract::NOperationResult::kCRCError:
-          PrintString(kCRCFailed);
-          break;
-        case NArchive::NExtract::NOperationResult::kDataError:
-          PrintString(kDataError);
-          break;
-        default:
-          PrintString(kUnknownError);
-      }
-    }
-  }
-
-  if (_outFileStream != NULL)
-  {
-    if (_processedFileInfo.MTimeDefined)
-      _outFileStreamSpec->SetMTime(&_processedFileInfo.MTime);
-    RINOK(_outFileStreamSpec->Close());
-  }
-  _outFileStream.Release();
-  if (_extractMode && _processedFileInfo.AttribDefined)
-    NFile::NDirectory::MySetFileAttributes(_diskFilePath, _processedFileInfo.Attrib);
-  PrintNewLine();
-  return S_OK;
-}
-
-
-STDMETHODIMP CArchiveExtractCallback::CryptoGetTextPassword(BSTR *password)
-{
-  if (!PasswordIsDefined)
-  {
-    // You can ask real password here from user
-    // Password = GetPassword(OutStream);
-    // PasswordIsDefined = true;
-    PrintError("Password is not defined");
-    return E_ABORT;
-  }
-  return StringToBstr(Password, password);
-}
-
-
-
-//////////////////////////////////////////////////////////////
-// Archive Creating callback class
-
-struct CDirItem
-{
-  UInt64 Size;
-  FILETIME CTime;
-  FILETIME ATime;
-  FILETIME MTime;
-  UString Name;
-  UString FullPath;
-  UInt32 Attrib;
-
-  bool isDir() const { return (Attrib & FILE_ATTRIBUTE_DIRECTORY) != 0 ; }
-};
-
-class CArchiveUpdateCallback:
-  public IArchiveUpdateCallback2,
-  public ICryptoGetTextPassword2,
-  public CMyUnknownImp
-{
-public:
-  MY_UNKNOWN_IMP2(IArchiveUpdateCallback2, ICryptoGetTextPassword2)
-
-  // IProgress
-  STDMETHOD(SetTotal)(UInt64 size);
-  STDMETHOD(SetCompleted)(const UInt64 *completeValue);
-
-  // IUpdateCallback2
-  STDMETHOD(EnumProperties)(IEnumSTATPROPSTG **enumerator);
-  STDMETHOD(GetUpdateItemInfo)(UInt32 index,
-      Int32 *newData, Int32 *newProperties, UInt32 *indexInArchive);
-  STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value);
-  STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **inStream);
-  STDMETHOD(SetOperationResult)(Int32 operationResult);
-  STDMETHOD(GetVolumeSize)(UInt32 index, UInt64 *size);
-  STDMETHOD(GetVolumeStream)(UInt32 index, ISequentialOutStream **volumeStream);
-
-  STDMETHOD(CryptoGetTextPassword2)(Int32 *passwordIsDefined, BSTR *password);
-
-public:
-  CRecordVector<UInt64> VolumesSizes;
-  UString VolName;
-  UString VolExt;
-
-  UString DirPrefix;
-  const CObjectVector<CDirItem> *DirItems;
-
-  bool PasswordIsDefined;
-  UString Password;
-  bool AskPassword;
-
-  bool m_NeedBeClosed;
-
-  UStringVector FailedFiles;
-  CRecordVector<HRESULT> FailedCodes;
-
-  CArchiveUpdateCallback(): PasswordIsDefined(false), AskPassword(false), DirItems(0) {};
-
-  ~CArchiveUpdateCallback() { Finilize(); }
-  HRESULT Finilize();
-
-  void Init(const CObjectVector<CDirItem> *dirItems)
-  {
-    DirItems = dirItems;
-    m_NeedBeClosed = false;
-    FailedFiles.Clear();
-    FailedCodes.Clear();
-  }
-};
-
-STDMETHODIMP CArchiveUpdateCallback::SetTotal(UInt64 /* size */)
-{
-  return S_OK;
-}
-
-STDMETHODIMP CArchiveUpdateCallback::SetCompleted(const UInt64 * /* completeValue */)
-{
-  return S_OK;
-}
-
-
-STDMETHODIMP CArchiveUpdateCallback::EnumProperties(IEnumSTATPROPSTG ** /* enumerator */)
-{
-  return E_NOTIMPL;
-}
-
-STDMETHODIMP CArchiveUpdateCallback::GetUpdateItemInfo(UInt32 /* index */,
-      Int32 *newData, Int32 *newProperties, UInt32 *indexInArchive)
-{
-  if (newData != NULL)
-    *newData = BoolToInt(true);
-  if (newProperties != NULL)
-    *newProperties = BoolToInt(true);
-  if (indexInArchive != NULL)
-    *indexInArchive = (UInt32)-1;
-  return S_OK;
-}
-
-STDMETHODIMP CArchiveUpdateCallback::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
-  NWindows::NCOM::CPropVariant prop;
-  
-  if (propID == kpidIsAnti)
-  {
-    prop = false;
-    prop.Detach(value);
-    return S_OK;
-  }
-
-  {
-    const CDirItem &dirItem = (*DirItems)[index];
-    switch(propID)
-    {
-      case kpidPath:  prop = dirItem.Name; break;
-      case kpidIsDir:  prop = dirItem.isDir(); break;
-      case kpidSize:  prop = dirItem.Size; break;
-      case kpidAttrib:  prop = dirItem.Attrib; break;
-      case kpidCTime:  prop = dirItem.CTime; break;
-      case kpidATime:  prop = dirItem.ATime; break;
-      case kpidMTime:  prop = dirItem.MTime; break;
-    }
-  }
-  prop.Detach(value);
-  return S_OK;
-}
-
-HRESULT CArchiveUpdateCallback::Finilize()
-{
-  if (m_NeedBeClosed)
-  {
-    PrintNewLine();
-    m_NeedBeClosed = false;
-  }
-  return S_OK;
-}
-
-static void GetStream2(const wchar_t *name)
-{
-  PrintString("Compressing  ");
-  if (name[0] == 0)
-    name = kEmptyFileAlias;
-  PrintString(name);
-}
-
-STDMETHODIMP CArchiveUpdateCallback::GetStream(UInt32 index, ISequentialInStream **inStream)
-{
-  RINOK(Finilize());
-
-  const CDirItem &dirItem = (*DirItems)[index];
-  GetStream2(dirItem.Name);
- 
-  if (dirItem.isDir())
-    return S_OK;
-
-  {
-    CInFileStream *inStreamSpec = new CInFileStream;
-    CMyComPtr<ISequentialInStream> inStreamLoc(inStreamSpec);
-    UString path = DirPrefix + dirItem.FullPath;
-    if (!inStreamSpec->Open(path))
-    {
-      DWORD sysError = ::GetLastError();
-      FailedCodes.Add(sysError);
-      FailedFiles.Add(path);
-      // if (systemError == ERROR_SHARING_VIOLATION)
-      {
-        PrintNewLine();
-        PrintError("WARNING: can't open file");
-        // PrintString(NError::MyFormatMessageW(systemError));
-        return S_FALSE;
-      }
-      // return sysError;
-    }
-    *inStream = inStreamLoc.Detach();
-  }
-  return S_OK;
-}
-
-STDMETHODIMP CArchiveUpdateCallback::SetOperationResult(Int32 /* operationResult */)
-{
-  m_NeedBeClosed = true;
-  return S_OK;
-}
-
-STDMETHODIMP CArchiveUpdateCallback::GetVolumeSize(UInt32 index, UInt64 *size)
-{
-  if (VolumesSizes.Size() == 0)
-    return S_FALSE;
-  if (index >= (UInt32)VolumesSizes.Size())
-    index = VolumesSizes.Size() - 1;
-  *size = VolumesSizes[index];
-  return S_OK;
-}
-
-STDMETHODIMP CArchiveUpdateCallback::GetVolumeStream(UInt32 index, ISequentialOutStream **volumeStream)
-{
-  wchar_t temp[32];
-  ConvertUInt64ToString(index + 1, temp);
-  UString res = temp;
-  while (res.Length() < 2)
-    res = UString(L'0') + res;
-  UString fileName = VolName;
-  fileName += L'.';
-  fileName += res;
-  fileName += VolExt;
-  COutFileStream *streamSpec = new COutFileStream;
-  CMyComPtr<ISequentialOutStream> streamLoc(streamSpec);
-  if (!streamSpec->Create(fileName, false))
-    return ::GetLastError();
-  *volumeStream = streamLoc.Detach();
-  return S_OK;
-}
-
-STDMETHODIMP CArchiveUpdateCallback::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
-{
-  if (!PasswordIsDefined)
-  {
-    if (AskPassword)
-    {
-      // You can ask real password here from user
-      // Password = GetPassword(OutStream);
-      // PasswordIsDefined = true;
-      PrintError("Password is not defined");
-      return E_ABORT;
-    }
-  }
-  *passwordIsDefined = BoolToInt(PasswordIsDefined);
-  return StringToBstr(Password, password);
-}
-
-
-
-//////////////////////////////////////////////////////////////////////////
-// Main function
-
-int MY_CDECL main(int argc, char* argv[])
-{
-  #ifdef _WIN32
-  #ifndef _UNICODE
-  g_IsNT = IsItWindowsNT();
-  #endif
-  #endif
-
-  PrintStringLn(kCopyrightString);
-
-  if (argc < 3)
-  {
-    PrintStringLn(kHelpString);
-    return 1;
-  }
-  NWindows::NDLL::CLibrary library;
-  if (!library.Load(TEXT(kDllName)))
-  {
-    PrintError("Can not load library");
-    return 1;
-  }
-  CreateObjectFunc createObjectFunc = (CreateObjectFunc)library.GetProcAddress("CreateObject");
-  if (createObjectFunc == 0)
-  {
-    PrintError("Can not get CreateObject");
-    return 1;
-  }
-
-  AString command = argv[1];
-  command.MakeLower();
-  UString archiveName = GetUnicodeString(argv[2], CP_OEMCP);
-  if (command.Compare("a") == 0)
-  {
-    // create archive command
-    if (argc < 4)
-    {
-      PrintStringLn(kHelpString);
-      return 1;
-    }
-    CObjectVector<CDirItem> dirItems;
-    int i;
-    for (i = 3; i < argc; i++)
-    {
-      CDirItem di;
-      UString name = GetUnicodeString(argv[i], CP_OEMCP);
-      
-      NFile::NFind::CFileInfoW fi;
-      if (!NFile::NFind::FindFile(name, fi))
-      {
-        PrintString(UString(L"Can't find file") + name);
-        return 1;
-      }
-
-      di.Attrib = fi.Attrib;
-      di.Size = fi.Size;
-      di.CTime = fi.CTime;
-      di.ATime = fi.ATime;
-      di.MTime = fi.MTime;
-      di.Name = name;
-      di.FullPath = name;
-      dirItems.Add(di);
-    }
-    COutFileStream *outFileStreamSpec = new COutFileStream;
-    CMyComPtr<IOutStream> outFileStream = outFileStreamSpec;
-    if (!outFileStreamSpec->Create(archiveName, false))
-    {
-      PrintError("can't create archive file");
-      return 1;
-    }
-
-    CMyComPtr<IOutArchive> outArchive;
-    if (createObjectFunc(&CLSID_CFormat7z, &IID_IOutArchive, (void **)&outArchive) != S_OK)
-    {
-      PrintError("Can not get class object");
-      return 1;
-    }
-
-    CArchiveUpdateCallback *updateCallbackSpec = new CArchiveUpdateCallback;
-    CMyComPtr<IArchiveUpdateCallback2> updateCallback(updateCallbackSpec);
-    updateCallbackSpec->Init(&dirItems);
-    // updateCallbackSpec->PasswordIsDefined = true;
-    // updateCallbackSpec->Password = L"1";
-
-    HRESULT result = outArchive->UpdateItems(outFileStream, dirItems.Size(), updateCallback);
-    updateCallbackSpec->Finilize();
-    if (result != S_OK)
-    {
-      PrintError("Update Error");
-      return 1;
-    }
-    for (i = 0; i < updateCallbackSpec->FailedFiles.Size(); i++)
-    {
-      PrintNewLine();
-      PrintString((UString)L"Error for file: " + updateCallbackSpec->FailedFiles[i]);
-    }
-    if (updateCallbackSpec->FailedFiles.Size() != 0)
-      return 1;
-  }
-  else
-  {
-    if (argc != 3)
-    {
-      PrintStringLn(kHelpString);
-      return 1;
-    }
-
-    bool listCommand;
-    if (command.Compare("l") == 0)
-      listCommand = true;
-    else if (command.Compare("x") == 0)
-      listCommand = false;
-    else
-    {
-      PrintError("incorrect command");
-      return 1;
-    }
-  
-    CMyComPtr<IInArchive> archive;
-    if (createObjectFunc(&CLSID_CFormat7z, &IID_IInArchive, (void **)&archive) != S_OK)
-    {
-      PrintError("Can not get class object");
-      return 1;
-    }
-    
-    CInFileStream *fileSpec = new CInFileStream;
-    CMyComPtr<IInStream> file = fileSpec;
-    
-    if (!fileSpec->Open(archiveName))
-    {
-      PrintError("Can not open archive file");
-      return 1;
-    }
-
-    {
-      CArchiveOpenCallback *openCallbackSpec = new CArchiveOpenCallback;
-      CMyComPtr<IArchiveOpenCallback> openCallback(openCallbackSpec);
-      openCallbackSpec->PasswordIsDefined = false;
-      // openCallbackSpec->PasswordIsDefined = true;
-      // openCallbackSpec->Password = L"1";
-      
-      if (archive->Open(file, 0, openCallback) != S_OK)
-      {
-        PrintError("Can not open archive");
-        return 1;
-      }
-    }
-    
-    if (listCommand)
-    {
-      // List command
-      UInt32 numItems = 0;
-      archive->GetNumberOfItems(&numItems);
-      for (UInt32 i = 0; i < numItems; i++)
-      {
-        {
-          // Get uncompressed size of file
-          NWindows::NCOM::CPropVariant prop;
-          archive->GetProperty(i, kpidSize, &prop);
-          UString s = ConvertPropVariantToString(prop);
-          PrintString(s);
-          PrintString("  ");
-        }
-        {
-          // Get name of file
-          NWindows::NCOM::CPropVariant prop;
-          archive->GetProperty(i, kpidPath, &prop);
-          UString s = ConvertPropVariantToString(prop);
-          PrintString(s);
-        }
-        PrintString("\n");
-      }
-    }
-    else
-    {
-      // Extract command
-      CArchiveExtractCallback *extractCallbackSpec = new CArchiveExtractCallback;
-      CMyComPtr<IArchiveExtractCallback> extractCallback(extractCallbackSpec);
-      extractCallbackSpec->Init(archive, L""); // second parameter is output folder path
-      extractCallbackSpec->PasswordIsDefined = false;
-      // extractCallbackSpec->PasswordIsDefined = true;
-      // extractCallbackSpec->Password = L"1";
-      HRESULT result = archive->Extract(NULL, (UInt32)(Int32)(-1), false, extractCallback);
-      if (result != S_OK)
-      {
-        PrintError("Extract Error");
-        return 1;
-      }
-    }
-  }
-  return 0;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Client7z/Client7z.dsp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Client7z/Client7z.dsp
deleted file mode 100644
index 542e285..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Client7z/Client7z.dsp
+++ /dev/null
@@ -1,226 +0,0 @@
-# Microsoft Developer Studio Project File - Name="Client7z" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Client7z - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "Client7z.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "Client7z.mak" CFG="Client7z - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "Client7z - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "Client7z - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "Client7z - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
-# ADD BASE RSC /l 0x419 /d "NDEBUG"
-# ADD RSC /l 0x419 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF  "$(CFG)" == "Client7z - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
-# ADD BASE RSC /l 0x419 /d "_DEBUG"
-# ADD RSC /l 0x419 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "Client7z - Win32 Release"
-# Name "Client7z - Win32 Debug"
-# Begin Group "Spec"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\StdAfx.cpp
-# ADD CPP /Yc"stdafx.h"
-# End Source File
-# Begin Source File
-
-SOURCE=.\StdAfx.h
-# End Source File
-# End Group
-# Begin Group "Windows"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\..\Windows\DLL.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\DLL.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileDir.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileDir.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileFind.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileFind.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileIO.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileIO.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileName.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileName.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\PropVariant.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\PropVariant.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\PropVariantConversions.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\PropVariantConversions.h
-# End Source File
-# End Group
-# Begin Group "Common"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\..\Common\IntToString.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\IntToString.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyString.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyString.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyVector.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyVector.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\NewHandler.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\NewHandler.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\StringConvert.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\StringConvert.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\Wildcard.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\Wildcard.h
-# End Source File
-# End Group
-# Begin Group "7zip Common"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Common\FileStreams.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\FileStreams.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\Client7z.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Client7z/Client7z.dsw b/third_party/lzma/v4_65/files/CPP/7zip/UI/Client7z/Client7z.dsw
deleted file mode 100644
index 598a6d3..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Client7z/Client7z.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "Client7z"=.\Client7z.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Client7z/StdAfx.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Client7z/StdAfx.cpp
deleted file mode 100644
index d0feea8..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Client7z/StdAfx.cpp
+++ /dev/null
@@ -1,3 +0,0 @@
-// StdAfx.cpp
-
-#include "StdAfx.h"
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Client7z/StdAfx.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Client7z/StdAfx.h
deleted file mode 100644
index b23436e..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Client7z/StdAfx.h
+++ /dev/null
@@ -1,9 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include <windows.h>
-#include <stdio.h>
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Client7z/makefile b/third_party/lzma/v4_65/files/CPP/7zip/UI/Client7z/makefile
deleted file mode 100644
index 226c36a..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Client7z/makefile
+++ /dev/null
@@ -1,45 +0,0 @@
-PROG = 7z.exe
-LIBS = $(LIBS) user32.lib oleaut32.lib advapi32.lib
-CFLAGS = $(CFLAGS) -I ../../../
-
-CONSOLE_OBJS = \
-  $O\Client7z.obj \
-
-COMMON_OBJS = \
-  $O\IntToString.obj \
-  $O\NewHandler.obj \
-  $O\MyString.obj \
-  $O\StringConvert.obj \
-  $O\StringToInt.obj \
-  $O\MyVector.obj \
-  $O\Wildcard.obj \
-
-WIN_OBJS = \
-  $O\DLL.obj \
-  $O\FileDir.obj \
-  $O\FileFind.obj \
-  $O\FileIO.obj \
-  $O\FileName.obj \
-  $O\PropVariant.obj \
-  $O\PropVariantConversions.obj \
-
-7ZIP_COMMON_OBJS = \
-  $O\FileStreams.obj \
-
-OBJS = \
-  $O\StdAfx.obj \
-  $(CONSOLE_OBJS) \
-  $(COMMON_OBJS) \
-  $(WIN_OBJS) \
-  $(7ZIP_COMMON_OBJS) \
-
-!include "../../../Build.mak"
-
-$(CONSOLE_OBJS): $(*B).cpp
-	$(COMPL)
-$(COMMON_OBJS): ../../../Common/$(*B).cpp
-	$(COMPL)
-$(WIN_OBJS): ../../../Windows/$(*B).cpp
-	$(COMPL)
-$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
-	$(COMPL)
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveCommandLine.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveCommandLine.cpp
deleted file mode 100644
index 46e8a2a..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveCommandLine.cpp
+++ /dev/null
@@ -1,1011 +0,0 @@
-// ArchiveCommandLine.cpp
-
-#include "StdAfx.h"
-
-#ifdef _WIN32
-#include <io.h>
-#endif
-#include <stdio.h>
-
-#include "Common/ListFileUtils.h"
-#include "Common/StringConvert.h"
-#include "Common/StringToInt.h"
-
-#include "Windows/FileName.h"
-#include "Windows/FileDir.h"
-#ifdef _WIN32
-#include "Windows/FileMapping.h"
-#include "Windows/Synchronization.h"
-#endif
-
-#include "ArchiveCommandLine.h"
-#include "UpdateAction.h"
-#include "Update.h"
-#include "SortUtils.h"
-#include "EnumDirItems.h"
-
-extern bool g_CaseSensitive;
-
-#if _MSC_VER >= 1400
-#define MY_isatty_fileno(x) _isatty(_fileno(x))
-#else
-#define MY_isatty_fileno(x) isatty(fileno(x))
-#endif
-
-#define MY_IS_TERMINAL(x) (MY_isatty_fileno(x) != 0);
-
-using namespace NCommandLineParser;
-using namespace NWindows;
-using namespace NFile;
-
-namespace NKey {
-enum Enum
-{
-  kHelp1 = 0,
-  kHelp2,
-  kHelp3,
-  kDisableHeaders,
-  kDisablePercents,
-  kArchiveType,
-  kYes,
-  #ifndef _NO_CRYPTO
-  kPassword,
-  #endif
-  kProperty,
-  kOutputDir,
-  kWorkingDir,
-  kInclude,
-  kExclude,
-  kArInclude,
-  kArExclude,
-  kNoArName,
-  kUpdate,
-  kVolume,
-  kRecursed,
-  kSfx,
-  kStdIn,
-  kStdOut,
-  kOverwrite,
-  kEmail,
-  kShowDialog,
-  kLargePages,
-  kCharSet,
-  kTechMode,
-  kShareForWrite,
-  kCaseSensitive
-};
-
-}
-
-
-static const wchar_t kRecursedIDChar = 'R';
-static const wchar_t *kRecursedPostCharSet = L"0-";
-
-namespace NRecursedPostCharIndex {
-  enum EEnum
-  {
-    kWildCardRecursionOnly = 0,
-    kNoRecursion = 1
-  };
-}
-
-static const char kImmediateNameID = '!';
-static const char kMapNameID = '#';
-static const char kFileListID = '@';
-
-static const char kSomeCludePostStringMinSize = 2; // at least <@|!><N>ame must be
-static const char kSomeCludeAfterRecursedPostStringMinSize = 2; // at least <@|!><N>ame must be
-
-static const wchar_t *kOverwritePostCharSet = L"asut";
-
-NExtract::NOverwriteMode::EEnum k_OverwriteModes[] =
-{
-  NExtract::NOverwriteMode::kWithoutPrompt,
-  NExtract::NOverwriteMode::kSkipExisting,
-  NExtract::NOverwriteMode::kAutoRename,
-  NExtract::NOverwriteMode::kAutoRenameExisting
-};
-
-static const CSwitchForm kSwitchForms[] =
-  {
-    { L"?",  NSwitchType::kSimple, false },
-    { L"H",  NSwitchType::kSimple, false },
-    { L"-HELP",  NSwitchType::kSimple, false },
-    { L"BA", NSwitchType::kSimple, false },
-    { L"BD", NSwitchType::kSimple, false },
-    { L"T",  NSwitchType::kUnLimitedPostString, false, 1 },
-    { L"Y",  NSwitchType::kSimple, false },
-    #ifndef _NO_CRYPTO
-    { L"P",  NSwitchType::kUnLimitedPostString, false, 0 },
-    #endif
-    { L"M",  NSwitchType::kUnLimitedPostString, true, 1 },
-    { L"O",  NSwitchType::kUnLimitedPostString, false, 1 },
-    { L"W",  NSwitchType::kUnLimitedPostString, false, 0 },
-    { L"I",  NSwitchType::kUnLimitedPostString, true, kSomeCludePostStringMinSize},
-    { L"X",  NSwitchType::kUnLimitedPostString, true, kSomeCludePostStringMinSize},
-    { L"AI", NSwitchType::kUnLimitedPostString, true, kSomeCludePostStringMinSize},
-    { L"AX", NSwitchType::kUnLimitedPostString, true, kSomeCludePostStringMinSize},
-    { L"AN", NSwitchType::kSimple, false },
-    { L"U",  NSwitchType::kUnLimitedPostString, true, 1},
-    { L"V",  NSwitchType::kUnLimitedPostString, true, 1},
-    { L"R",  NSwitchType::kPostChar, false, 0, 0, kRecursedPostCharSet },
-    { L"SFX", NSwitchType::kUnLimitedPostString, false, 0 },
-    { L"SI", NSwitchType::kUnLimitedPostString, false, 0 },
-    { L"SO", NSwitchType::kSimple, false, 0 },
-    { L"AO", NSwitchType::kPostChar, false, 1, 1, kOverwritePostCharSet},
-    { L"SEML", NSwitchType::kUnLimitedPostString, false, 0},
-    { L"AD",  NSwitchType::kSimple, false },
-    { L"SLP", NSwitchType::kUnLimitedPostString, false, 0},
-    { L"SCS", NSwitchType::kUnLimitedPostString, false, 0},
-    { L"SLT", NSwitchType::kSimple, false },
-    { L"SSW", NSwitchType::kSimple, false },
-    { L"SSC", NSwitchType::kPostChar, false, 0, 0, L"-" }
-  };
-
-static const CCommandForm g_CommandForms[] =
-{
-  { L"A", false },
-  { L"U", false },
-  { L"D", false },
-  { L"T", false },
-  { L"E", false },
-  { L"X", false },
-  { L"L", false },
-  { L"B", false },
-  { L"I", false }
-};
-
-static const int kNumCommandForms = sizeof(g_CommandForms) /  sizeof(g_CommandForms[0]);
-
-static const wchar_t *kUniversalWildcard = L"*";
-static const int kMinNonSwitchWords = 1;
-static const int kCommandIndex = 0;
-
-// ---------------------------
-// exception messages
-
-static const char *kUserErrorMessage  = "Incorrect command line";
-static const char *kIncorrectListFile = "Incorrect item in listfile.\nCheck charset encoding and -scs switch.";
-static const char *kIncorrectWildCardInListFile = "Incorrect wildcard in listfile";
-static const char *kIncorrectWildCardInCommandLine  = "Incorrect wildcard in command line";
-static const char *kTerminalOutError = "I won't write compressed data to a terminal";
-static const char *kSameTerminalError = "I won't write data and program's messages to same terminal";
-
-static void ThrowException(const char *errorMessage)
-{
-  throw CArchiveCommandLineException(errorMessage);
-};
-
-static void ThrowUserErrorException()
-{
-  ThrowException(kUserErrorMessage);
-};
-
-// ---------------------------
-
-bool CArchiveCommand::IsFromExtractGroup() const
-{
-  switch(CommandType)
-  {
-    case NCommandType::kTest:
-    case NCommandType::kExtract:
-    case NCommandType::kFullExtract:
-      return true;
-    default:
-      return false;
-  }
-}
-
-NExtract::NPathMode::EEnum CArchiveCommand::GetPathMode() const
-{
-  switch(CommandType)
-  {
-    case NCommandType::kTest:
-    case NCommandType::kFullExtract:
-      return NExtract::NPathMode::kFullPathnames;
-    default:
-      return NExtract::NPathMode::kNoPathnames;
-  }
-}
-
-bool CArchiveCommand::IsFromUpdateGroup() const
-{
-  return (CommandType == NCommandType::kAdd ||
-    CommandType == NCommandType::kUpdate ||
-    CommandType == NCommandType::kDelete);
-}
-
-static NRecursedType::EEnum GetRecursedTypeFromIndex(int index)
-{
-  switch (index)
-  {
-    case NRecursedPostCharIndex::kWildCardRecursionOnly:
-      return NRecursedType::kWildCardOnlyRecursed;
-    case NRecursedPostCharIndex::kNoRecursion:
-      return NRecursedType::kNonRecursed;
-    default:
-      return NRecursedType::kRecursed;
-  }
-}
-
-static bool ParseArchiveCommand(const UString &commandString, CArchiveCommand &command)
-{
-  UString commandStringUpper = commandString;
-  commandStringUpper.MakeUpper();
-  UString postString;
-  int commandIndex = ParseCommand(kNumCommandForms, g_CommandForms, commandStringUpper,
-      postString) ;
-  if (commandIndex < 0)
-    return false;
-  command.CommandType = (NCommandType::EEnum)commandIndex;
-  return true;
-}
-
-// ------------------------------------------------------------------
-// filenames functions
-
-static bool AddNameToCensor(NWildcard::CCensor &wildcardCensor,
-    const UString &name, bool include, NRecursedType::EEnum type)
-{
-  bool isWildCard = DoesNameContainWildCard(name);
-  bool recursed = false;
-
-  switch (type)
-  {
-    case NRecursedType::kWildCardOnlyRecursed:
-      recursed = isWildCard;
-      break;
-    case NRecursedType::kRecursed:
-      recursed = true;
-      break;
-    case NRecursedType::kNonRecursed:
-      recursed = false;
-      break;
-  }
-  wildcardCensor.AddItem(include, name, recursed);
-  return true;
-}
-
-static void AddToCensorFromListFile(NWildcard::CCensor &wildcardCensor,
-    LPCWSTR fileName, bool include, NRecursedType::EEnum type, UINT codePage)
-{
-  UStringVector names;
-  if (!ReadNamesFromListFile(fileName, names, codePage))
-    throw kIncorrectListFile;
-  for (int i = 0; i < names.Size(); i++)
-    if (!AddNameToCensor(wildcardCensor, names[i], include, type))
-      throw kIncorrectWildCardInListFile;
-}
-
-static void AddCommandLineWildCardToCensr(NWildcard::CCensor &wildcardCensor,
-    const UString &name, bool include, NRecursedType::EEnum recursedType)
-{
-  if (!AddNameToCensor(wildcardCensor, name, include, recursedType))
-    throw kIncorrectWildCardInCommandLine;
-}
-
-static void AddToCensorFromNonSwitchesStrings(
-    int startIndex,
-    NWildcard::CCensor &wildcardCensor,
-    const UStringVector &nonSwitchStrings, NRecursedType::EEnum type,
-    bool thereAreSwitchIncludes, UINT codePage)
-{
-  if (nonSwitchStrings.Size() == startIndex && (!thereAreSwitchIncludes))
-    AddCommandLineWildCardToCensr(wildcardCensor, kUniversalWildcard, true, type);
-  for (int i = startIndex; i < nonSwitchStrings.Size(); i++)
-  {
-    const UString &s = nonSwitchStrings[i];
-    if (s[0] == kFileListID)
-      AddToCensorFromListFile(wildcardCensor, s.Mid(1), true, type, codePage);
-    else
-      AddCommandLineWildCardToCensr(wildcardCensor, s, true, type);
-  }
-}
-
-#ifdef _WIN32
-static void ParseMapWithPaths(NWildcard::CCensor &wildcardCensor,
-    const UString &switchParam, bool include,
-    NRecursedType::EEnum commonRecursedType)
-{
-  int splitPos = switchParam.Find(L':');
-  if (splitPos < 0)
-    ThrowUserErrorException();
-  UString mappingName = switchParam.Left(splitPos);
-  
-  UString switchParam2 = switchParam.Mid(splitPos + 1);
-  splitPos = switchParam2.Find(L':');
-  if (splitPos < 0)
-    ThrowUserErrorException();
-  
-  UString mappingSize = switchParam2.Left(splitPos);
-  UString eventName = switchParam2.Mid(splitPos + 1);
-  
-  UInt64 dataSize64 = ConvertStringToUInt64(mappingSize, NULL);
-  UInt32 dataSize = (UInt32)dataSize64;
-  {
-    CFileMapping fileMapping;
-    if (!fileMapping.Open(FILE_MAP_READ, false, GetSystemString(mappingName)))
-      ThrowException("Can not open mapping");
-    LPVOID data = fileMapping.MapViewOfFile(FILE_MAP_READ, 0, dataSize);
-    if (data == NULL)
-      ThrowException("MapViewOfFile error");
-    try
-    {
-      const wchar_t *curData = (const wchar_t *)data;
-      if (*curData != 0)
-        ThrowException("Incorrect mapping data");
-      UInt32 numChars = dataSize / sizeof(wchar_t);
-      UString name;
-      for (UInt32 i = 1; i < numChars; i++)
-      {
-        wchar_t c = curData[i];
-        if (c == L'\0')
-        {
-          AddCommandLineWildCardToCensr(wildcardCensor,
-              name, include, commonRecursedType);
-          name.Empty();
-        }
-        else
-          name += c;
-      }
-      if (!name.IsEmpty())
-        ThrowException("data error");
-    }
-    catch(...)
-    {
-      UnmapViewOfFile(data);
-      throw;
-    }
-    UnmapViewOfFile(data);
-  }
-  
-  {
-    NSynchronization::CManualResetEvent event;
-    if (event.Open(EVENT_MODIFY_STATE, false, GetSystemString(eventName)) == S_OK)
-      event.Set();
-  }
-}
-#endif
-
-static void AddSwitchWildCardsToCensor(NWildcard::CCensor &wildcardCensor,
-    const UStringVector &strings, bool include,
-    NRecursedType::EEnum commonRecursedType, UINT codePage)
-{
-  for (int i = 0; i < strings.Size(); i++)
-  {
-    const UString &name = strings[i];
-    NRecursedType::EEnum recursedType;
-    int pos = 0;
-    if (name.Length() < kSomeCludePostStringMinSize)
-      ThrowUserErrorException();
-    if (::MyCharUpper(name[pos]) == kRecursedIDChar)
-    {
-      pos++;
-      int index = UString(kRecursedPostCharSet).Find(name[pos]);
-      recursedType = GetRecursedTypeFromIndex(index);
-      if (index >= 0)
-        pos++;
-    }
-    else
-      recursedType = commonRecursedType;
-    if (name.Length() < pos + kSomeCludeAfterRecursedPostStringMinSize)
-      ThrowUserErrorException();
-    UString tail = name.Mid(pos + 1);
-    if (name[pos] == kImmediateNameID)
-      AddCommandLineWildCardToCensr(wildcardCensor, tail, include, recursedType);
-    else if (name[pos] == kFileListID)
-      AddToCensorFromListFile(wildcardCensor, tail, include, recursedType, codePage);
-    #ifdef _WIN32
-    else if (name[pos] == kMapNameID)
-      ParseMapWithPaths(wildcardCensor, tail, include, recursedType);
-    #endif
-    else
-      ThrowUserErrorException();
-  }
-}
-
-#ifdef _WIN32
-
-// This code converts all short file names to long file names.
-
-static void ConvertToLongName(const UString &prefix, UString &name)
-{
-  if (name.IsEmpty() || DoesNameContainWildCard(name))
-    return;
-  NFind::CFileInfoW fileInfo;
-  if (NFind::FindFile(prefix + name, fileInfo))
-    name = fileInfo.Name;
-}
-
-static void ConvertToLongNames(const UString &prefix, CObjectVector<NWildcard::CItem> &items)
-{
-  for (int i = 0; i < items.Size(); i++)
-  {
-    NWildcard::CItem &item = items[i];
-    if (item.Recursive || item.PathParts.Size() != 1)
-      continue;
-    ConvertToLongName(prefix, item.PathParts.Front());
-  }
-}
-
-static void ConvertToLongNames(const UString &prefix, NWildcard::CCensorNode &node)
-{
-  ConvertToLongNames(prefix, node.IncludeItems);
-  ConvertToLongNames(prefix, node.ExcludeItems);
-  int i;
-  for (i = 0; i < node.SubNodes.Size(); i++)
-    ConvertToLongName(prefix, node.SubNodes[i].Name);
-  // mix folders with same name
-  for (i = 0; i < node.SubNodes.Size(); i++)
-  {
-    NWildcard::CCensorNode &nextNode1 = node.SubNodes[i];
-    for (int j = i + 1; j < node.SubNodes.Size();)
-    {
-      const NWildcard::CCensorNode &nextNode2 = node.SubNodes[j];
-      if (nextNode1.Name.CompareNoCase(nextNode2.Name) == 0)
-      {
-        nextNode1.IncludeItems += nextNode2.IncludeItems;
-        nextNode1.ExcludeItems += nextNode2.ExcludeItems;
-        node.SubNodes.Delete(j);
-      }
-      else
-        j++;
-    }
-  }
-  for (i = 0; i < node.SubNodes.Size(); i++)
-  {
-    NWildcard::CCensorNode &nextNode = node.SubNodes[i];
-    ConvertToLongNames(prefix + nextNode.Name + wchar_t(NFile::NName::kDirDelimiter), nextNode);
-  }
-}
-
-static void ConvertToLongNames(NWildcard::CCensor &censor)
-{
-  for (int i = 0; i < censor.Pairs.Size(); i++)
-  {
-    NWildcard::CPair &pair = censor.Pairs[i];
-    ConvertToLongNames(pair.Prefix, pair.Head);
-  }
-}
-
-#endif
-
-static NUpdateArchive::NPairAction::EEnum GetUpdatePairActionType(int i)
-{
-  switch(i)
-  {
-    case NUpdateArchive::NPairAction::kIgnore: return NUpdateArchive::NPairAction::kIgnore;
-    case NUpdateArchive::NPairAction::kCopy: return NUpdateArchive::NPairAction::kCopy;
-    case NUpdateArchive::NPairAction::kCompress: return NUpdateArchive::NPairAction::kCompress;
-    case NUpdateArchive::NPairAction::kCompressAsAnti: return NUpdateArchive::NPairAction::kCompressAsAnti;
-  }
-  throw 98111603;
-}
-
-const UString kUpdatePairStateIDSet = L"PQRXYZW";
-const int kUpdatePairStateNotSupportedActions[] = {2, 2, 1, -1, -1, -1, -1};
-
-const UString kUpdatePairActionIDSet = L"0123"; //Ignore, Copy, Compress, Create Anti
-
-const wchar_t *kUpdateIgnoreItselfPostStringID = L"-";
-const wchar_t kUpdateNewArchivePostCharID = '!';
-
-
-static bool ParseUpdateCommandString2(const UString &command,
-    NUpdateArchive::CActionSet &actionSet, UString &postString)
-{
-  for (int i = 0; i < command.Length();)
-  {
-    wchar_t c = MyCharUpper(command[i]);
-    int statePos = kUpdatePairStateIDSet.Find(c);
-    if (statePos < 0)
-    {
-      postString = command.Mid(i);
-      return true;
-    }
-    i++;
-    if (i >= command.Length())
-      return false;
-    int actionPos = kUpdatePairActionIDSet.Find(::MyCharUpper(command[i]));
-    if (actionPos < 0)
-      return false;
-    actionSet.StateActions[statePos] = GetUpdatePairActionType(actionPos);
-    if (kUpdatePairStateNotSupportedActions[statePos] == actionPos)
-      return false;
-    i++;
-  }
-  postString.Empty();
-  return true;
-}
-
-static void ParseUpdateCommandString(CUpdateOptions &options,
-    const UStringVector &updatePostStrings,
-    const NUpdateArchive::CActionSet &defaultActionSet)
-{
-  for (int i = 0; i < updatePostStrings.Size(); i++)
-  {
-    const UString &updateString = updatePostStrings[i];
-    if (updateString.CompareNoCase(kUpdateIgnoreItselfPostStringID) == 0)
-    {
-      if (options.UpdateArchiveItself)
-      {
-        options.UpdateArchiveItself = false;
-        options.Commands.Delete(0);
-      }
-    }
-    else
-    {
-      NUpdateArchive::CActionSet actionSet = defaultActionSet;
-
-      UString postString;
-      if (!ParseUpdateCommandString2(updateString, actionSet, postString))
-        ThrowUserErrorException();
-      if (postString.IsEmpty())
-      {
-        if (options.UpdateArchiveItself)
-          options.Commands[0].ActionSet = actionSet;
-      }
-      else
-      {
-        if (MyCharUpper(postString[0]) != kUpdateNewArchivePostCharID)
-          ThrowUserErrorException();
-        CUpdateArchiveCommand uc;
-        UString archivePath = postString.Mid(1);
-        if (archivePath.IsEmpty())
-          ThrowUserErrorException();
-        uc.UserArchivePath = archivePath;
-        uc.ActionSet = actionSet;
-        options.Commands.Add(uc);
-      }
-    }
-  }
-}
-
-static const char kByteSymbol = 'B';
-static const char kKiloSymbol = 'K';
-static const char kMegaSymbol = 'M';
-static const char kGigaSymbol = 'G';
-
-static bool ParseComplexSize(const UString &src, UInt64 &result)
-{
-  UString s = src;
-  s.MakeUpper();
-
-  const wchar_t *start = s;
-  const wchar_t *end;
-  UInt64 number = ConvertStringToUInt64(start, &end);
-  int numDigits = (int)(end - start);
-  if (numDigits == 0 || s.Length() > numDigits + 1)
-    return false;
-  if (s.Length() == numDigits)
-  {
-    result = number;
-    return true;
-  }
-  int numBits;
-  switch (s[numDigits])
-  {
-    case kByteSymbol:
-      result = number;
-      return true;
-    case kKiloSymbol:
-      numBits = 10;
-      break;
-    case kMegaSymbol:
-      numBits = 20;
-      break;
-    case kGigaSymbol:
-      numBits = 30;
-      break;
-    default:
-      return false;
-  }
-  if (number >= ((UInt64)1 << (64 - numBits)))
-    return false;
-  result = number << numBits;
-  return true;
-}
-
-static void SetAddCommandOptions(
-    NCommandType::EEnum commandType,
-    const CParser &parser,
-    CUpdateOptions &options)
-{
-  NUpdateArchive::CActionSet defaultActionSet;
-  switch(commandType)
-  {
-    case NCommandType::kAdd:
-      defaultActionSet = NUpdateArchive::kAddActionSet;
-      break;
-    case NCommandType::kDelete:
-      defaultActionSet = NUpdateArchive::kDeleteActionSet;
-      break;
-    default:
-      defaultActionSet = NUpdateArchive::kUpdateActionSet;
-  }
-  
-  options.UpdateArchiveItself = true;
-  
-  options.Commands.Clear();
-  CUpdateArchiveCommand updateMainCommand;
-  updateMainCommand.ActionSet = defaultActionSet;
-  options.Commands.Add(updateMainCommand);
-  if (parser[NKey::kUpdate].ThereIs)
-    ParseUpdateCommandString(options, parser[NKey::kUpdate].PostStrings,
-        defaultActionSet);
-  if (parser[NKey::kWorkingDir].ThereIs)
-  {
-    const UString &postString = parser[NKey::kWorkingDir].PostStrings[0];
-    if (postString.IsEmpty())
-      NDirectory::MyGetTempPath(options.WorkingDir);
-    else
-      options.WorkingDir = postString;
-  }
-  options.SfxMode = parser[NKey::kSfx].ThereIs;
-  if (options.SfxMode)
-    options.SfxModule = parser[NKey::kSfx].PostStrings[0];
-
-  if (parser[NKey::kVolume].ThereIs)
-  {
-    const UStringVector &sv = parser[NKey::kVolume].PostStrings;
-    for (int i = 0; i < sv.Size(); i++)
-    {
-      UInt64 size;
-      if (!ParseComplexSize(sv[i], size))
-        ThrowException("Incorrect volume size");
-      options.VolumesSizes.Add(size);
-    }
-  }
-}
-
-static void SetMethodOptions(const CParser &parser, CObjectVector<CProperty> &properties)
-{
-  if (parser[NKey::kProperty].ThereIs)
-  {
-    // options.MethodMode.Properties.Clear();
-    for (int i = 0; i < parser[NKey::kProperty].PostStrings.Size(); i++)
-    {
-      CProperty property;
-      const UString &postString = parser[NKey::kProperty].PostStrings[i];
-      int index = postString.Find(L'=');
-      if (index < 0)
-        property.Name = postString;
-      else
-      {
-        property.Name = postString.Left(index);
-        property.Value = postString.Mid(index + 1);
-      }
-      properties.Add(property);
-    }
-  }
-}
-
-CArchiveCommandLineParser::CArchiveCommandLineParser():
-  parser(sizeof(kSwitchForms) / sizeof(kSwitchForms[0])) {}
-
-void CArchiveCommandLineParser::Parse1(const UStringVector &commandStrings,
-    CArchiveCommandLineOptions &options)
-{
-  try
-  {
-    parser.ParseStrings(kSwitchForms, commandStrings);
-  }
-  catch(...)
-  {
-    ThrowUserErrorException();
-  }
-
-  options.IsInTerminal = MY_IS_TERMINAL(stdin);
-  options.IsStdOutTerminal = MY_IS_TERMINAL(stdout);
-  options.IsStdErrTerminal = MY_IS_TERMINAL(stderr);
-  options.StdOutMode = parser[NKey::kStdOut].ThereIs;
-  options.EnableHeaders = !parser[NKey::kDisableHeaders].ThereIs;
-  options.HelpMode = parser[NKey::kHelp1].ThereIs || parser[NKey::kHelp2].ThereIs  || parser[NKey::kHelp3].ThereIs;
-
-  #ifdef _WIN32
-  options.LargePages = false;
-  if (parser[NKey::kLargePages].ThereIs)
-  {
-    const UString &postString = parser[NKey::kLargePages].PostStrings.Front();
-    if (postString.IsEmpty())
-      options.LargePages = true;
-  }
-  #endif
-}
-
-struct CCodePagePair
-{
-  const wchar_t *Name;
-  UINT CodePage;
-};
-
-static CCodePagePair g_CodePagePairs[] =
-{
-  { L"UTF-8", CP_UTF8 },
-  { L"WIN",   CP_ACP },
-  { L"DOS",   CP_OEMCP }
-};
-
-static const int kNumCodePages = sizeof(g_CodePagePairs) / sizeof(g_CodePagePairs[0]);
-
-static bool ConvertStringToUInt32(const wchar_t *s, UInt32 &v)
-{
-  const wchar_t *end;
-  UInt64 number = ConvertStringToUInt64(s, &end);
-  if (*end != 0)
-    return false;
-  if (number > (UInt32)0xFFFFFFFF)
-    return false;
-  v = (UInt32)number;
-  return true;
-}
-
-void CArchiveCommandLineParser::Parse2(CArchiveCommandLineOptions &options)
-{
-  const UStringVector &nonSwitchStrings = parser.NonSwitchStrings;
-  int numNonSwitchStrings = nonSwitchStrings.Size();
-  if (numNonSwitchStrings < kMinNonSwitchWords)
-    ThrowUserErrorException();
-
-  if (!ParseArchiveCommand(nonSwitchStrings[kCommandIndex], options.Command))
-    ThrowUserErrorException();
-
-  options.TechMode = parser[NKey::kTechMode].ThereIs;
-
-  if (parser[NKey::kCaseSensitive].ThereIs)
-    g_CaseSensitive = (parser[NKey::kCaseSensitive].PostCharIndex < 0);
-
-  NRecursedType::EEnum recursedType;
-  if (parser[NKey::kRecursed].ThereIs)
-    recursedType = GetRecursedTypeFromIndex(parser[NKey::kRecursed].PostCharIndex);
-  else
-    recursedType = NRecursedType::kNonRecursed;
-
-  UINT codePage = CP_UTF8;
-  if (parser[NKey::kCharSet].ThereIs)
-  {
-    UString name = parser[NKey::kCharSet].PostStrings.Front();
-    name.MakeUpper();
-    int i;
-    for (i = 0; i < kNumCodePages; i++)
-    {
-      const CCodePagePair &pair = g_CodePagePairs[i];
-      if (name.Compare(pair.Name) == 0)
-      {
-        codePage = pair.CodePage;
-        break;
-      }
-    }
-    if (i >= kNumCodePages)
-      ThrowUserErrorException();
-  }
-
-  bool thereAreSwitchIncludes = false;
-  if (parser[NKey::kInclude].ThereIs)
-  {
-    thereAreSwitchIncludes = true;
-    AddSwitchWildCardsToCensor(options.WildcardCensor,
-        parser[NKey::kInclude].PostStrings, true, recursedType, codePage);
-  }
-  if (parser[NKey::kExclude].ThereIs)
-    AddSwitchWildCardsToCensor(options.WildcardCensor,
-        parser[NKey::kExclude].PostStrings, false, recursedType, codePage);
- 
-  int curCommandIndex = kCommandIndex + 1;
-  bool thereIsArchiveName = !parser[NKey::kNoArName].ThereIs &&
-      options.Command.CommandType != NCommandType::kBenchmark &&
-      options.Command.CommandType != NCommandType::kInfo;
-  if (thereIsArchiveName)
-  {
-    if (curCommandIndex >= numNonSwitchStrings)
-      ThrowUserErrorException();
-    options.ArchiveName = nonSwitchStrings[curCommandIndex++];
-  }
-
-  AddToCensorFromNonSwitchesStrings(
-      curCommandIndex, options.WildcardCensor,
-      nonSwitchStrings, recursedType, thereAreSwitchIncludes, codePage);
-
-  options.YesToAll = parser[NKey::kYes].ThereIs;
-
-  bool isExtractGroupCommand = options.Command.IsFromExtractGroup();
-
-  #ifndef _NO_CRYPTO
-  options.PasswordEnabled = parser[NKey::kPassword].ThereIs;
-  if (options.PasswordEnabled)
-    options.Password = parser[NKey::kPassword].PostStrings[0];
-  #endif
-
-  options.StdInMode = parser[NKey::kStdIn].ThereIs;
-  options.ShowDialog = parser[NKey::kShowDialog].ThereIs;
-
-  if (parser[NKey::kArchiveType].ThereIs)
-    options.ArcType = parser[NKey::kArchiveType].PostStrings[0];
-
-  if (isExtractGroupCommand || options.Command.CommandType == NCommandType::kList)
-  {
-    if (options.StdInMode)
-      ThrowException("Reading archives from stdin is not implemented");
-    if (!options.WildcardCensor.AllAreRelative())
-      ThrowException("Cannot use absolute pathnames for this command");
-
-    NWildcard::CCensor archiveWildcardCensor;
-
-    if (parser[NKey::kArInclude].ThereIs)
-    {
-      AddSwitchWildCardsToCensor(archiveWildcardCensor,
-        parser[NKey::kArInclude].PostStrings, true, NRecursedType::kNonRecursed, codePage);
-    }
-    if (parser[NKey::kArExclude].ThereIs)
-      AddSwitchWildCardsToCensor(archiveWildcardCensor,
-      parser[NKey::kArExclude].PostStrings, false, NRecursedType::kNonRecursed, codePage);
-
-    if (thereIsArchiveName)
-      AddCommandLineWildCardToCensr(archiveWildcardCensor, options.ArchiveName, true, NRecursedType::kNonRecursed);
-
-    #ifdef _WIN32
-    ConvertToLongNames(archiveWildcardCensor);
-    #endif
-
-    archiveWildcardCensor.ExtendExclude();
-
-    UStringVector archivePaths;
-
-    {
-      CDirItems dirItems;
-      {
-        UStringVector errorPaths;
-        CRecordVector<DWORD> errorCodes;
-        HRESULT res = EnumerateItems(archiveWildcardCensor, dirItems, NULL, errorPaths, errorCodes);
-        if (res != S_OK || errorPaths.Size() > 0)
-          throw "cannot find archive";
-      }
-      for (int i = 0; i < dirItems.Items.Size(); i++)
-      {
-        const CDirItem &dirItem = dirItems.Items[i];
-        if (!dirItem.IsDir())
-          archivePaths.Add(dirItems.GetPhyPath(i));
-      }
-    }
-
-    if (archivePaths.Size() == 0)
-      throw "there is no such archive";
-
-    UStringVector archivePathsFull;
-
-    int i;
-    for (i = 0; i < archivePaths.Size(); i++)
-    {
-      UString fullPath;
-      NFile::NDirectory::MyGetFullPathName(archivePaths[i], fullPath);
-      archivePathsFull.Add(fullPath);
-    }
-    CIntVector indices;
-    SortFileNames(archivePathsFull, indices);
-    options.ArchivePathsSorted.Reserve(indices.Size());
-    options.ArchivePathsFullSorted.Reserve(indices.Size());
-    for (i = 0; i < indices.Size(); i++)
-    {
-      options.ArchivePathsSorted.Add(archivePaths[indices[i]]);
-      options.ArchivePathsFullSorted.Add(archivePathsFull[indices[i]]);
-    }
-
-    if (isExtractGroupCommand)
-    {
-      SetMethodOptions(parser, options.ExtractProperties);
-      if (options.StdOutMode && options.IsStdOutTerminal && options.IsStdErrTerminal)
-        throw kSameTerminalError;
-      if (parser[NKey::kOutputDir].ThereIs)
-      {
-        options.OutputDir = parser[NKey::kOutputDir].PostStrings[0];
-        NFile::NName::NormalizeDirPathPrefix(options.OutputDir);
-      }
-
-      options.OverwriteMode = NExtract::NOverwriteMode::kAskBefore;
-      if (parser[NKey::kOverwrite].ThereIs)
-        options.OverwriteMode =
-            k_OverwriteModes[parser[NKey::kOverwrite].PostCharIndex];
-      else if (options.YesToAll)
-        options.OverwriteMode = NExtract::NOverwriteMode::kWithoutPrompt;
-    }
-  }
-  else if (options.Command.IsFromUpdateGroup())
-  {
-    CUpdateOptions &updateOptions = options.UpdateOptions;
-
-    SetAddCommandOptions(options.Command.CommandType, parser, updateOptions);
-    
-    SetMethodOptions(parser, updateOptions.MethodMode.Properties);
-
-    if (parser[NKey::kShareForWrite].ThereIs)
-      updateOptions.OpenShareForWrite = true;
-
-    options.EnablePercents = !parser[NKey::kDisablePercents].ThereIs;
-
-    if (options.EnablePercents)
-    {
-      if ((options.StdOutMode && !options.IsStdErrTerminal) ||
-         (!options.StdOutMode && !options.IsStdOutTerminal))
-        options.EnablePercents = false;
-    }
-
-    updateOptions.EMailMode = parser[NKey::kEmail].ThereIs;
-    if (updateOptions.EMailMode)
-    {
-      updateOptions.EMailAddress = parser[NKey::kEmail].PostStrings.Front();
-      if (updateOptions.EMailAddress.Length() > 0)
-        if (updateOptions.EMailAddress[0] == L'.')
-        {
-          updateOptions.EMailRemoveAfter = true;
-          updateOptions.EMailAddress.Delete(0);
-        }
-    }
-
-    updateOptions.StdOutMode = options.StdOutMode;
-    updateOptions.StdInMode = options.StdInMode;
-
-    if (updateOptions.StdOutMode && updateOptions.EMailMode)
-      throw "stdout mode and email mode cannot be combined";
-    if (updateOptions.StdOutMode && options.IsStdOutTerminal)
-      throw kTerminalOutError;
-    if (updateOptions.StdInMode)
-      updateOptions.StdInFileName = parser[NKey::kStdIn].PostStrings.Front();
-
-    #ifdef _WIN32
-    ConvertToLongNames(options.WildcardCensor);
-    #endif
-  }
-  else if (options.Command.CommandType == NCommandType::kBenchmark)
-  {
-    options.NumThreads = (UInt32)-1;
-    options.DictionarySize = (UInt32)-1;
-    options.NumIterations = 1;
-    if (curCommandIndex < numNonSwitchStrings)
-    {
-      if (!ConvertStringToUInt32(nonSwitchStrings[curCommandIndex++], options.NumIterations))
-        ThrowUserErrorException();
-    }
-    for (int i = 0; i < parser[NKey::kProperty].PostStrings.Size(); i++)
-    {
-      UString postString = parser[NKey::kProperty].PostStrings[i];
-      postString.MakeUpper();
-      if (postString.Length() < 2)
-        ThrowUserErrorException();
-      if (postString[0] == 'D')
-      {
-        int pos = 1;
-        if (postString[pos] == '=')
-          pos++;
-        UInt32 logSize;
-        if (!ConvertStringToUInt32((const wchar_t *)postString + pos, logSize))
-          ThrowUserErrorException();
-        if (logSize > 31)
-          ThrowUserErrorException();
-        options.DictionarySize = 1 << logSize;
-      }
-      else if (postString[0] == 'M' && postString[1] == 'T' )
-      {
-        int pos = 2;
-        if (postString[pos] == '=')
-          pos++;
-        if (postString[pos] != 0)
-          if (!ConvertStringToUInt32((const wchar_t *)postString + pos, options.NumThreads))
-            ThrowUserErrorException();
-      }
-      else if (postString[0] == 'M' && postString[1] == '=' )
-      {
-        int pos = 2;
-        if (postString[pos] != 0)
-          options.Method = postString.Mid(2);
-      }
-      else
-        ThrowUserErrorException();
-    }
-  }
-  else if (options.Command.CommandType == NCommandType::kInfo)
-  {
-  }
-  else
-    ThrowUserErrorException();
-  options.WildcardCensor.ExtendExclude();
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveCommandLine.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveCommandLine.h
deleted file mode 100644
index 9c37f33..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveCommandLine.h
+++ /dev/null
@@ -1,106 +0,0 @@
-// ArchiveCommandLine.h
-
-#ifndef __ARCHIVECOMMANDLINE_H
-#define __ARCHIVECOMMANDLINE_H
-
-#include "Common/Wildcard.h"
-#include "Common/CommandLineParser.h"
-
-#include "Extract.h"
-#include "Update.h"
-
-struct CArchiveCommandLineException: public AString
-{
-  CArchiveCommandLineException(const char *errorMessage): AString(errorMessage) {}
-};
-
-namespace NCommandType { enum EEnum
-{
-  kAdd = 0,
-  kUpdate,
-  kDelete,
-  kTest,
-  kExtract,
-  kFullExtract,
-  kList,
-  kBenchmark,
-  kInfo
-};}
-
-namespace NRecursedType { enum EEnum
-{
-  kRecursed,
-  kWildCardOnlyRecursed,
-  kNonRecursed
-};}
-
-struct CArchiveCommand
-{
-  NCommandType::EEnum CommandType;
-  bool IsFromExtractGroup() const;
-  bool IsFromUpdateGroup() const;
-  bool IsTestMode() const { return CommandType == NCommandType::kTest; }
-  NExtract::NPathMode::EEnum GetPathMode() const;
-};
-
-struct CArchiveCommandLineOptions
-{
-  bool HelpMode;
-
-  #ifdef _WIN32
-  bool LargePages;
-  #endif
-
-  bool IsInTerminal;
-  bool IsStdOutTerminal;
-  bool IsStdErrTerminal;
-  bool StdInMode;
-  bool StdOutMode;
-  bool EnableHeaders;
-
-  bool YesToAll;
-  bool ShowDialog;
-  // NWildcard::CCensor ArchiveWildcardCensor;
-  NWildcard::CCensor WildcardCensor;
-
-  CArchiveCommand Command;
-  UString ArchiveName;
-
-  #ifndef _NO_CRYPTO
-  bool PasswordEnabled;
-  UString Password;
-  #endif
-
-  bool TechMode;
-  // Extract
-  bool AppendName;
-  UString OutputDir;
-  NExtract::NOverwriteMode::EEnum OverwriteMode;
-  UStringVector ArchivePathsSorted;
-  UStringVector ArchivePathsFullSorted;
-  CObjectVector<CProperty> ExtractProperties;
-
-  CUpdateOptions UpdateOptions;
-  UString ArcType;
-  bool EnablePercents;
-
-  // Benchmark
-  UInt32 NumIterations;
-  UInt32 NumThreads;
-  UInt32 DictionarySize;
-  UString Method;
-
-
-  CArchiveCommandLineOptions(): StdInMode(false), StdOutMode(false) {};
-};
-
-class CArchiveCommandLineParser
-{
-  NCommandLineParser::CParser parser;
-public:
-  CArchiveCommandLineParser();
-  void Parse1(const UStringVector &commandStrings, CArchiveCommandLineOptions &options);
-  void Parse2(CArchiveCommandLineOptions &options);
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
deleted file mode 100644
index 5af5286..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
+++ /dev/null
@@ -1,476 +0,0 @@
-// ArchiveExtractCallback.cpp
-
-#include "StdAfx.h"
-
-#include "ArchiveExtractCallback.h"
-
-#include "Common/Wildcard.h"
-#include "Common/StringConvert.h"
-#include "Common/ComTry.h"
-
-#include "Windows/FileDir.h"
-#include "Windows/FileFind.h"
-#include "Windows/Time.h"
-#include "Windows/Defs.h"
-#include "Windows/PropVariant.h"
-
-#include "Windows/PropVariantConversions.h"
-
-#include "../../Common/FilePathAutoRename.h"
-
-#include "../Common/ExtractingFilePath.h"
-#include "OpenArchive.h"
-
-using namespace NWindows;
-
-static const wchar_t *kCantAutoRename = L"ERROR: Can not create file with auto name";
-static const wchar_t *kCantRenameFile = L"ERROR: Can not rename existing file ";
-static const wchar_t *kCantDeleteOutputFile = L"ERROR: Can not delete output file ";
-
-
-void CArchiveExtractCallback::Init(
-    IInArchive *archiveHandler,
-    IFolderArchiveExtractCallback *extractCallback2,
-    bool stdOutMode,
-    const UString &directoryPath,
-    const UStringVector &removePathParts,
-    const UString &itemDefaultName,
-    const FILETIME &utcMTimeDefault,
-    UInt32 attributesDefault,
-    UInt64 packSize)
-{
-  _stdOutMode = stdOutMode;
-  _numErrors = 0;
-  _unpTotal = 1;
-  _packTotal = packSize;
-
-  _extractCallback2 = extractCallback2;
-  _compressProgress.Release();
-  _extractCallback2.QueryInterface(IID_ICompressProgressInfo, &_compressProgress);
-
-  LocalProgressSpec->Init(extractCallback2, true);
-  LocalProgressSpec->SendProgress = false;
-
-  _itemDefaultName = itemDefaultName;
-  _utcMTimeDefault = utcMTimeDefault;
-  _attributesDefault = attributesDefault;
-  _removePathParts = removePathParts;
-  _archiveHandler = archiveHandler;
-  _directoryPath = directoryPath;
-  NFile::NName::NormalizeDirPathPrefix(_directoryPath);
-}
-
-STDMETHODIMP CArchiveExtractCallback::SetTotal(UInt64 size)
-{
-  COM_TRY_BEGIN
-  _unpTotal = size;
-  if (!_multiArchives && _extractCallback2)
-    return _extractCallback2->SetTotal(size);
-  return S_OK;
-  COM_TRY_END
-}
-
-static void NormalizeVals(UInt64 &v1, UInt64 &v2)
-{
-  const UInt64 kMax = (UInt64)1 << 31;
-  while (v1 > kMax)
-  {
-    v1 >>= 1;
-    v2 >>= 1;
-  }
-}
-
-static UInt64 MyMultDiv64(UInt64 unpCur, UInt64 unpTotal, UInt64 packTotal)
-{
-  NormalizeVals(packTotal, unpTotal);
-  NormalizeVals(unpCur, unpTotal);
-  if (unpTotal == 0)
-    unpTotal = 1;
-  return unpCur * packTotal / unpTotal;
-}
-
-STDMETHODIMP CArchiveExtractCallback::SetCompleted(const UInt64 *completeValue)
-{
-  COM_TRY_BEGIN
-  if (!_extractCallback2)
-    return S_OK;
-
-  if (_multiArchives)
-  {
-    if (completeValue != NULL)
-    {
-      UInt64 packCur = LocalProgressSpec->InSize + MyMultDiv64(*completeValue, _unpTotal, _packTotal);
-      return _extractCallback2->SetCompleted(&packCur);
-    }
-  }
-  return _extractCallback2->SetCompleted(completeValue);
-  COM_TRY_END
-}
-
-STDMETHODIMP CArchiveExtractCallback::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
-{
-  COM_TRY_BEGIN
-  return _localProgress->SetRatioInfo(inSize, outSize);
-  COM_TRY_END
-}
-
-void CArchiveExtractCallback::CreateComplexDirectory(const UStringVector &dirPathParts, UString &fullPath)
-{
-  fullPath = _directoryPath;
-  for(int i = 0; i < dirPathParts.Size(); i++)
-  {
-    if (i > 0)
-      fullPath += wchar_t(NFile::NName::kDirDelimiter);
-    fullPath += dirPathParts[i];
-    NFile::NDirectory::MyCreateDirectory(fullPath);
-  }
-}
-
-static UString MakePathNameFromParts(const UStringVector &parts)
-{
-  UString result;
-  for(int i = 0; i < parts.Size(); i++)
-  {
-    if(i != 0)
-      result += wchar_t(NFile::NName::kDirDelimiter);
-    result += parts[i];
-  }
-  return result;
-}
-
-
-HRESULT CArchiveExtractCallback::GetTime(int index, PROPID propID, FILETIME &filetime, bool &filetimeIsDefined)
-{
-  filetimeIsDefined = false;
-  NCOM::CPropVariant prop;
-  RINOK(_archiveHandler->GetProperty(index, propID, &prop));
-  if (prop.vt == VT_FILETIME)
-  {
-    filetime = prop.filetime;
-    filetimeIsDefined = (filetime.dwHighDateTime != 0 || filetime.dwLowDateTime != 0);
-  }
-  else if (prop.vt != VT_EMPTY)
-    return E_FAIL;
-  return S_OK;
-}
-
-STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStream **outStream, Int32 askExtractMode)
-{
-  COM_TRY_BEGIN
-  *outStream = 0;
-  _outFileStream.Release();
-
-  _encrypted = false;
-  _isSplit = false;
-  _curSize = 0;
-
-  UString fullPath;
-
-  RINOK(GetArchiveItemPath(_archiveHandler, index, _itemDefaultName, fullPath));
-  RINOK(IsArchiveItemFolder(_archiveHandler, index, _processedFileInfo.IsDir));
-
-  _filePath = fullPath;
-
-  {
-    NCOM::CPropVariant prop;
-    RINOK(_archiveHandler->GetProperty(index, kpidPosition, &prop));
-    if (prop.vt != VT_EMPTY)
-    {
-      if (prop.vt != VT_UI8)
-        return E_FAIL;
-      _position = prop.uhVal.QuadPart;
-      _isSplit = true;
-    }
-  }
-    
-  RINOK(IsArchiveItemProp(_archiveHandler, index, kpidEncrypted, _encrypted));
-
-  bool newFileSizeDefined;
-  UInt64 newFileSize;
-  {
-    NCOM::CPropVariant prop;
-    RINOK(_archiveHandler->GetProperty(index, kpidSize, &prop));
-    newFileSizeDefined = (prop.vt != VT_EMPTY);
-    if (newFileSizeDefined)
-    {
-      newFileSize = ConvertPropVariantToUInt64(prop);
-      _curSize = newFileSize;
-    }
-  }
-
-  if(askExtractMode == NArchive::NExtract::NAskMode::kExtract)
-  {
-    if (_stdOutMode)
-    {
-      CMyComPtr<ISequentialOutStream> outStreamLoc = new CStdOutFileStream;
-      *outStream = outStreamLoc.Detach();
-      return S_OK;
-    }
-
-    {
-      NCOM::CPropVariant prop;
-      RINOK(_archiveHandler->GetProperty(index, kpidAttrib, &prop));
-      if (prop.vt == VT_EMPTY)
-      {
-        _processedFileInfo.Attributes = _attributesDefault;
-        _processedFileInfo.AttributesAreDefined = false;
-      }
-      else
-      {
-        if (prop.vt != VT_UI4)
-          return E_FAIL;
-        _processedFileInfo.Attributes = prop.ulVal;
-        _processedFileInfo.AttributesAreDefined = true;
-      }
-    }
-
-    RINOK(GetTime(index, kpidCTime, _processedFileInfo.CTime, _processedFileInfo.CTimeDefined));
-    RINOK(GetTime(index, kpidATime, _processedFileInfo.ATime, _processedFileInfo.ATimeDefined));
-    RINOK(GetTime(index, kpidMTime, _processedFileInfo.MTime, _processedFileInfo.MTimeDefined));
-
-    bool isAnti = false;
-    RINOK(IsArchiveItemProp(_archiveHandler, index, kpidIsAnti, isAnti));
-
-    UStringVector pathParts;
-    SplitPathToParts(fullPath, pathParts);
-    
-    if(pathParts.IsEmpty())
-      return E_FAIL;
-    int numRemovePathParts = 0;
-    switch(_pathMode)
-    {
-      case NExtract::NPathMode::kFullPathnames:
-        break;
-      case NExtract::NPathMode::kCurrentPathnames:
-      {
-        numRemovePathParts = _removePathParts.Size();
-        if (pathParts.Size() <= numRemovePathParts)
-          return E_FAIL;
-        for (int i = 0; i < numRemovePathParts; i++)
-          if (_removePathParts[i].CompareNoCase(pathParts[i]) != 0)
-            return E_FAIL;
-        break;
-      }
-      case NExtract::NPathMode::kNoPathnames:
-      {
-        numRemovePathParts = pathParts.Size() - 1;
-        break;
-      }
-    }
-    pathParts.Delete(0, numRemovePathParts);
-    MakeCorrectPath(pathParts);
-    UString processedPath = MakePathNameFromParts(pathParts);
-    if (!isAnti)
-    {
-      if (!_processedFileInfo.IsDir)
-      {
-        if (!pathParts.IsEmpty())
-          pathParts.DeleteBack();
-      }
-    
-      if (!pathParts.IsEmpty())
-      {
-        UString fullPathNew;
-        CreateComplexDirectory(pathParts, fullPathNew);
-        if (_processedFileInfo.IsDir)
-          NFile::NDirectory::SetDirTime(fullPathNew,
-            (WriteCTime && _processedFileInfo.CTimeDefined) ? &_processedFileInfo.CTime : NULL,
-            (WriteATime && _processedFileInfo.ATimeDefined) ? &_processedFileInfo.ATime : NULL,
-            (WriteMTime && _processedFileInfo.MTimeDefined) ? &_processedFileInfo.MTime : &_utcMTimeDefault);
-      }
-    }
-
-
-    UString fullProcessedPath = _directoryPath + processedPath;
-
-    if(_processedFileInfo.IsDir)
-    {
-      _diskFilePath = fullProcessedPath;
-      if (isAnti)
-        NFile::NDirectory::MyRemoveDirectory(_diskFilePath);
-      return S_OK;
-    }
-
-    if (!_isSplit)
-    {
-    NFile::NFind::CFileInfoW fileInfo;
-    if(NFile::NFind::FindFile(fullProcessedPath, fileInfo))
-    {
-      switch(_overwriteMode)
-      {
-        case NExtract::NOverwriteMode::kSkipExisting:
-          return S_OK;
-        case NExtract::NOverwriteMode::kAskBefore:
-        {
-          Int32 overwiteResult;
-          RINOK(_extractCallback2->AskOverwrite(
-              fullProcessedPath, &fileInfo.MTime, &fileInfo.Size, fullPath,
-              _processedFileInfo.MTimeDefined ? &_processedFileInfo.MTime : NULL,
-              newFileSizeDefined ? &newFileSize : NULL,
-              &overwiteResult))
-
-          switch(overwiteResult)
-          {
-            case NOverwriteAnswer::kCancel:
-              return E_ABORT;
-            case NOverwriteAnswer::kNo:
-              return S_OK;
-            case NOverwriteAnswer::kNoToAll:
-              _overwriteMode = NExtract::NOverwriteMode::kSkipExisting;
-              return S_OK;
-            case NOverwriteAnswer::kYesToAll:
-              _overwriteMode = NExtract::NOverwriteMode::kWithoutPrompt;
-              break;
-            case NOverwriteAnswer::kYes:
-              break;
-            case NOverwriteAnswer::kAutoRename:
-              _overwriteMode = NExtract::NOverwriteMode::kAutoRename;
-              break;
-            default:
-              return E_FAIL;
-          }
-        }
-      }
-      if (_overwriteMode == NExtract::NOverwriteMode::kAutoRename)
-      {
-        if (!AutoRenamePath(fullProcessedPath))
-        {
-          UString message = UString(kCantAutoRename) + fullProcessedPath;
-          RINOK(_extractCallback2->MessageError(message));
-          return E_FAIL;
-        }
-      }
-      else if (_overwriteMode == NExtract::NOverwriteMode::kAutoRenameExisting)
-      {
-        UString existPath = fullProcessedPath;
-        if (!AutoRenamePath(existPath))
-        {
-          UString message = kCantAutoRename + fullProcessedPath;
-          RINOK(_extractCallback2->MessageError(message));
-          return E_FAIL;
-        }
-        if(!NFile::NDirectory::MyMoveFile(fullProcessedPath, existPath))
-        {
-          UString message = UString(kCantRenameFile) + fullProcessedPath;
-          RINOK(_extractCallback2->MessageError(message));
-          return E_FAIL;
-        }
-      }
-      else
-        if (!NFile::NDirectory::DeleteFileAlways(fullProcessedPath))
-        {
-          UString message = UString(kCantDeleteOutputFile) +  fullProcessedPath;
-          RINOK(_extractCallback2->MessageError(message));
-          return S_OK;
-          // return E_FAIL;
-        }
-    }
-    }
-    if (!isAnti)
-    {
-      _outFileStreamSpec = new COutFileStream;
-      CMyComPtr<ISequentialOutStream> outStreamLoc(_outFileStreamSpec);
-      if (!_outFileStreamSpec->Open(fullProcessedPath, _isSplit ? OPEN_ALWAYS: CREATE_ALWAYS))
-      {
-        // if (::GetLastError() != ERROR_FILE_EXISTS || !isSplit)
-        {
-          UString message = L"can not open output file " + fullProcessedPath;
-          RINOK(_extractCallback2->MessageError(message));
-          return S_OK;
-        }
-      }
-      if (_isSplit)
-      {
-        RINOK(_outFileStreamSpec->Seek(_position, STREAM_SEEK_SET, NULL));
-      }
-      _outFileStream = outStreamLoc;
-      *outStream = outStreamLoc.Detach();
-    }
-    _diskFilePath = fullProcessedPath;
-  }
-  else
-  {
-    *outStream = NULL;
-  }
-  return S_OK;
-  COM_TRY_END
-}
-
-STDMETHODIMP CArchiveExtractCallback::PrepareOperation(Int32 askExtractMode)
-{
-  COM_TRY_BEGIN
-  _extractMode = false;
-  switch (askExtractMode)
-  {
-    case NArchive::NExtract::NAskMode::kExtract:
-      _extractMode = true;
-  };
-  return _extractCallback2->PrepareOperation(_filePath, _processedFileInfo.IsDir,
-      askExtractMode, _isSplit ? &_position: 0);
-  COM_TRY_END
-}
-
-STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 operationResult)
-{
-  COM_TRY_BEGIN
-  switch(operationResult)
-  {
-    case NArchive::NExtract::NOperationResult::kOK:
-    case NArchive::NExtract::NOperationResult::kUnSupportedMethod:
-    case NArchive::NExtract::NOperationResult::kCRCError:
-    case NArchive::NExtract::NOperationResult::kDataError:
-      break;
-    default:
-      _outFileStream.Release();
-      return E_FAIL;
-  }
-  if (_outFileStream != NULL)
-  {
-    _outFileStreamSpec->SetTime(
-        (WriteCTime && _processedFileInfo.CTimeDefined) ? &_processedFileInfo.CTime : NULL,
-        (WriteATime && _processedFileInfo.ATimeDefined) ? &_processedFileInfo.ATime : NULL,
-        (WriteMTime && _processedFileInfo.MTimeDefined) ? &_processedFileInfo.MTime : &_utcMTimeDefault);
-    _curSize = _outFileStreamSpec->ProcessedSize;
-    RINOK(_outFileStreamSpec->Close());
-    _outFileStream.Release();
-  }
-  UnpackSize += _curSize;
-  if (_processedFileInfo.IsDir)
-    NumFolders++;
-  else
-    NumFiles++;
-
-  if (_extractMode && _processedFileInfo.AttributesAreDefined)
-    NFile::NDirectory::MySetFileAttributes(_diskFilePath, _processedFileInfo.Attributes);
-  RINOK(_extractCallback2->SetOperationResult(operationResult, _encrypted));
-  return S_OK;
-  COM_TRY_END
-}
-
-/*
-STDMETHODIMP CArchiveExtractCallback::GetInStream(
-    const wchar_t *name, ISequentialInStream **inStream)
-{
-  COM_TRY_BEGIN
-  CInFileStream *inFile = new CInFileStream;
-  CMyComPtr<ISequentialInStream> inStreamTemp = inFile;
-  if (!inFile->Open(_srcDirectoryPrefix + name))
-    return ::GetLastError();
-  *inStream = inStreamTemp.Detach();
-  return S_OK;
-  COM_TRY_END
-}
-*/
-
-STDMETHODIMP CArchiveExtractCallback::CryptoGetTextPassword(BSTR *password)
-{
-  COM_TRY_BEGIN
-  if (!_cryptoGetTextPassword)
-  {
-    RINOK(_extractCallback2.QueryInterface(IID_ICryptoGetTextPassword,
-        &_cryptoGetTextPassword));
-  }
-  return _cryptoGetTextPassword->CryptoGetTextPassword(password);
-  COM_TRY_END
-}
-
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveExtractCallback.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveExtractCallback.h
deleted file mode 100644
index e895c54..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveExtractCallback.h
+++ /dev/null
@@ -1,133 +0,0 @@
-// ArchiveExtractCallback.h
-
-#ifndef __ARCHIVEEXTRACTCALLBACK_H
-#define __ARCHIVEEXTRACTCALLBACK_H
-
-#include "../../Archive/IArchive.h"
-#include "IFileExtractCallback.h"
-
-#include "Common/MyString.h"
-#include "Common/MyCom.h"
-
-#include "../../Common/FileStreams.h"
-#include "../../Common/ProgressUtils.h"
-#include "../../IPassword.h"
-
-#include "ExtractMode.h"
-
-class CArchiveExtractCallback:
-  public IArchiveExtractCallback,
-  // public IArchiveVolumeExtractCallback,
-  public ICryptoGetTextPassword,
-  public ICompressProgressInfo,
-  public CMyUnknownImp
-{
-public:
-  MY_UNKNOWN_IMP2(ICryptoGetTextPassword, ICompressProgressInfo)
-  // COM_INTERFACE_ENTRY(IArchiveVolumeExtractCallback)
-
-  INTERFACE_IArchiveExtractCallback(;)
-
-  STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
-
-  // IArchiveVolumeExtractCallback
-  // STDMETHOD(GetInStream)(const wchar_t *name, ISequentialInStream **inStream);
-
-  // ICryptoGetTextPassword
-  STDMETHOD(CryptoGetTextPassword)(BSTR *aPassword);
-
-private:
-  CMyComPtr<IInArchive> _archiveHandler;
-  CMyComPtr<IFolderArchiveExtractCallback> _extractCallback2;
-  CMyComPtr<ICompressProgressInfo> _compressProgress;
-  CMyComPtr<ICryptoGetTextPassword> _cryptoGetTextPassword;
-  UString _directoryPath;
-  NExtract::NPathMode::EEnum _pathMode;
-  NExtract::NOverwriteMode::EEnum _overwriteMode;
-
-  UString _filePath;
-  UInt64 _position;
-  bool _isSplit;
-
-  UString _diskFilePath;
-
-  bool _extractMode;
-
-  bool WriteCTime;
-  bool WriteATime;
-  bool WriteMTime;
-
-  bool _encrypted;
-
-  struct CProcessedFileInfo
-  {
-    FILETIME CTime;
-    FILETIME ATime;
-    FILETIME MTime;
-    UInt32 Attributes;
-  
-    bool CTimeDefined;
-    bool ATimeDefined;
-    bool MTimeDefined;
-
-    bool IsDir;
-    bool AttributesAreDefined;
-  } _processedFileInfo;
-
-  UInt64 _curSize;
-  COutFileStream *_outFileStreamSpec;
-  CMyComPtr<ISequentialOutStream> _outFileStream;
-  UStringVector _removePathParts;
-
-  UString _itemDefaultName;
-  FILETIME _utcMTimeDefault;
-  UInt32 _attributesDefault;
-  bool _stdOutMode;
-
-  void CreateComplexDirectory(const UStringVector &dirPathParts, UString &fullPath);
-  HRESULT GetTime(int index, PROPID propID, FILETIME &filetime, bool &filetimeIsDefined);
-public:
-  CArchiveExtractCallback():
-      WriteCTime(true),
-      WriteATime(true),
-      WriteMTime(true),
-      _multiArchives(false)
-  {
-    LocalProgressSpec = new CLocalProgress();
-    _localProgress = LocalProgressSpec;
-  }
-
-  CLocalProgress *LocalProgressSpec;
-  CMyComPtr<ICompressProgressInfo> _localProgress;
-  UInt64 _packTotal;
-  UInt64 _unpTotal;
-
-  bool _multiArchives;
-  UInt64 NumFolders;
-  UInt64 NumFiles;
-  UInt64 UnpackSize;
-  
-  void InitForMulti(bool multiArchives,
-      NExtract::NPathMode::EEnum pathMode,
-      NExtract::NOverwriteMode::EEnum overwriteMode)
-  {
-    _multiArchives = multiArchives; NumFolders = NumFiles = UnpackSize = 0;
-    _pathMode = pathMode;
-    _overwriteMode = overwriteMode;
-  }
-
-  void Init(
-      IInArchive *archiveHandler,
-      IFolderArchiveExtractCallback *extractCallback2,
-      bool stdOutMode,
-      const UString &directoryPath,
-      const UStringVector &removePathParts,
-      const UString &itemDefaultName,
-      const FILETIME &utcMTimeDefault,
-      UInt32 attributesDefault,
-      UInt64 packSize);
-
-  UInt64 _numErrors;
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveName.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveName.cpp
deleted file mode 100644
index 9b9a4fe..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveName.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-// ArchiveName.cpp
-
-#include "StdAfx.h"
-
-#include "Windows/FileFind.h"
-#include "Windows/FileDir.h"
-
-using namespace NWindows;
-
-UString CreateArchiveName(const UString &srcName, bool fromPrev, bool keepName)
-{
-  UString resultName = L"Archive";
-  if (fromPrev)
-  {
-    UString dirPrefix;
-    if (NFile::NDirectory::GetOnlyDirPrefix(srcName, dirPrefix))
-    {
-      if (dirPrefix.Length() > 0)
-        if (dirPrefix[dirPrefix.Length() - 1] == WCHAR_PATH_SEPARATOR)
-        {
-          dirPrefix.Delete(dirPrefix.Length() - 1);
-          NFile::NFind::CFileInfoW fileInfo;
-          if (NFile::NFind::FindFile(dirPrefix, fileInfo))
-            resultName = fileInfo.Name;
-        }
-    }
-  }
-  else
-  {
-    NFile::NFind::CFileInfoW fileInfo;
-    if (!NFile::NFind::FindFile(srcName, fileInfo))
-      return resultName;
-    resultName = fileInfo.Name;
-    if (!fileInfo.IsDir() && !keepName)
-    {
-      int dotPos = resultName.ReverseFind('.');
-      if (dotPos > 0)
-      {
-        UString archiveName2 = resultName.Left(dotPos);
-        if (archiveName2.ReverseFind('.') < 0)
-          resultName = archiveName2;
-      }
-    }
-  }
-  return resultName;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveName.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveName.h
deleted file mode 100644
index 9513fb2..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveName.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// ArchiveName.h
-
-#ifndef __ARCHIVENAME_H
-#define __ARCHIVENAME_H
-
-#include "Common/MyString.h"
-
-UString CreateArchiveName(const UString &srcName, bool fromPrev, bool keepName);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp
deleted file mode 100644
index 8f289d1..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-// ArchiveOpenCallback.cpp
-
-#include "StdAfx.h"
-
-#include "ArchiveOpenCallback.h"
-
-#include "Common/StringConvert.h"
-#include "Common/ComTry.h"
-#include "Windows/PropVariant.h"
-
-#include "../../Common/FileStreams.h"
-
-using namespace NWindows;
-
-STDMETHODIMP COpenCallbackImp::SetTotal(const UInt64 *files, const UInt64 *bytes)
-{
-  COM_TRY_BEGIN
-  if (ReOpenCallback)
-    return ReOpenCallback->SetTotal(files, bytes);
-  if (!Callback)
-    return S_OK;
-  return Callback->Open_SetTotal(files, bytes);
-  COM_TRY_END
-}
-
-STDMETHODIMP COpenCallbackImp::SetCompleted(const UInt64 *files, const UInt64 *bytes)
-{
-  COM_TRY_BEGIN
-  if (ReOpenCallback)
-    return ReOpenCallback->SetCompleted(files, bytes);
-  if (!Callback)
-    return S_OK;
-  return Callback->Open_SetCompleted(files, bytes);
-  COM_TRY_END
-}
-  
-STDMETHODIMP COpenCallbackImp::GetProperty(PROPID propID, PROPVARIANT *value)
-{
-  COM_TRY_BEGIN
-  NCOM::CPropVariant prop;
-  if (_subArchiveMode)
-    switch(propID)
-    {
-      case kpidName: prop = _subArchiveName; break;
-    }
-  else
-    switch(propID)
-    {
-      case kpidName:  prop = _fileInfo.Name; break;
-      case kpidIsDir:  prop = _fileInfo.IsDir(); break;
-      case kpidSize:  prop = _fileInfo.Size; break;
-      case kpidAttrib:  prop = (UInt32)_fileInfo.Attrib; break;
-      case kpidCTime:  prop = _fileInfo.CTime; break;
-      case kpidATime:  prop = _fileInfo.ATime; break;
-      case kpidMTime:  prop = _fileInfo.MTime; break;
-    }
-  prop.Detach(value);
-  return S_OK;
-  COM_TRY_END
-}
-
-int COpenCallbackImp::FindName(const UString &name)
-{
-  for (int i = 0; i < FileNames.Size(); i++)
-    if (name.CompareNoCase(FileNames[i]) == 0)
-      return i;
-  return -1;
-}
-
-struct CInFileStreamVol: public CInFileStream
-{
-  UString Name;
-  COpenCallbackImp *OpenCallbackImp;
-  CMyComPtr<IArchiveOpenCallback> OpenCallbackRef;
-  ~CInFileStreamVol()
-  {
-    int index = OpenCallbackImp->FindName(Name);
-    if (index >= 0)
-      OpenCallbackImp->FileNames.Delete(index);
-  }
-};
-
-STDMETHODIMP COpenCallbackImp::GetStream(const wchar_t *name, IInStream **inStream)
-{
-  COM_TRY_BEGIN
-  if (_subArchiveMode)
-    return S_FALSE;
-  if (Callback)
-  {
-    RINOK(Callback->Open_CheckBreak());
-  }
-  *inStream = NULL;
-  UString fullPath = _folderPrefix + name;
-  if (!NFile::NFind::FindFile(fullPath, _fileInfo))
-    return S_FALSE;
-  if (_fileInfo.IsDir())
-    return S_FALSE;
-  CInFileStreamVol *inFile = new CInFileStreamVol;
-  CMyComPtr<IInStream> inStreamTemp = inFile;
-  if (!inFile->Open(fullPath))
-    return ::GetLastError();
-  *inStream = inStreamTemp.Detach();
-  inFile->Name = name;
-  inFile->OpenCallbackImp = this;
-  inFile->OpenCallbackRef = this;
-  FileNames.Add(name);
-  TotalSize += _fileInfo.Size;
-  return S_OK;
-  COM_TRY_END
-}
-
-#ifndef _NO_CRYPTO
-STDMETHODIMP COpenCallbackImp::CryptoGetTextPassword(BSTR *password)
-{
-  COM_TRY_BEGIN
-  if (ReOpenCallback)
-  {
-    CMyComPtr<ICryptoGetTextPassword> getTextPassword;
-    ReOpenCallback.QueryInterface(IID_ICryptoGetTextPassword, &getTextPassword);
-    if (getTextPassword)
-      return getTextPassword->CryptoGetTextPassword(password);
-  }
-  if (!Callback)
-    return E_NOTIMPL;
-  return Callback->Open_CryptoGetTextPassword(password);
-  COM_TRY_END
-}
-#endif
-  
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveOpenCallback.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveOpenCallback.h
deleted file mode 100644
index ca44597..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveOpenCallback.h
+++ /dev/null
@@ -1,101 +0,0 @@
-// ArchiveOpenCallback.h
-
-#ifndef __ARCHIVE_OPEN_CALLBACK_H
-#define __ARCHIVE_OPEN_CALLBACK_H
-
-#include "Common/MyString.h"
-#include "Common/MyCom.h"
-#include "Windows/FileFind.h"
-
-#ifndef _NO_CRYPTO
-#include "../../IPassword.h"
-#endif
-#include "../../Archive/IArchive.h"
-
-#ifdef _NO_CRYPTO
-
-#define INTERFACE_IOpenCallbackUI_Crypto(x)
-
-#else
-
-#define INTERFACE_IOpenCallbackUI_Crypto(x) \
-  virtual HRESULT Open_CryptoGetTextPassword(BSTR *password) x; \
-  virtual HRESULT Open_GetPasswordIfAny(UString &password) x; \
-  virtual bool Open_WasPasswordAsked() x; \
-  virtual void Open_ClearPasswordWasAskedFlag() x; \
-  
-#endif
-
-#define INTERFACE_IOpenCallbackUI(x) \
-  virtual HRESULT Open_CheckBreak() x; \
-  virtual HRESULT Open_SetTotal(const UInt64 *files, const UInt64 *bytes) x; \
-  virtual HRESULT Open_SetCompleted(const UInt64 *files, const UInt64 *bytes) x; \
-  INTERFACE_IOpenCallbackUI_Crypto(x)
-
-struct IOpenCallbackUI
-{
-  INTERFACE_IOpenCallbackUI(=0)
-};
-
-class COpenCallbackImp:
-  public IArchiveOpenCallback,
-  public IArchiveOpenVolumeCallback,
-  public IArchiveOpenSetSubArchiveName,
-  #ifndef _NO_CRYPTO
-  public ICryptoGetTextPassword,
-  #endif
-  public CMyUnknownImp
-{
-public:
-  #ifndef _NO_CRYPTO
-  MY_UNKNOWN_IMP3(
-      IArchiveOpenVolumeCallback,
-      ICryptoGetTextPassword,
-      IArchiveOpenSetSubArchiveName
-      )
-  #else
-  MY_UNKNOWN_IMP2(
-      IArchiveOpenVolumeCallback,
-      IArchiveOpenSetSubArchiveName
-      )
-  #endif
-
-  INTERFACE_IArchiveOpenCallback(;)
-  INTERFACE_IArchiveOpenVolumeCallback(;)
-
-  #ifndef _NO_CRYPTO
-  STDMETHOD(CryptoGetTextPassword)(BSTR *password);
-  #endif
-
-  STDMETHOD(SetSubArchiveName(const wchar_t *name))
-  {
-    _subArchiveMode = true;
-    _subArchiveName = name;
-    return  S_OK;
-  }
-
-private:
-  UString _folderPrefix;
-  NWindows::NFile::NFind::CFileInfoW _fileInfo;
-  bool _subArchiveMode;
-  UString _subArchiveName;
-public:
-  UStringVector FileNames;
-  IOpenCallbackUI *Callback;
-  CMyComPtr<IArchiveOpenCallback> ReOpenCallback;
-  UInt64 TotalSize;
-
-  COpenCallbackImp(): Callback(NULL) {}
-  void Init(const UString &folderPrefix,  const UString &fileName)
-  {
-    _folderPrefix = folderPrefix;
-    if (!NWindows::NFile::NFind::FindFile(_folderPrefix + fileName, _fileInfo))
-      throw 1;
-    FileNames.Clear();
-    _subArchiveMode = false;
-    TotalSize = 0;
-  }
-  int FindName(const UString &name);
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/DefaultName.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/DefaultName.cpp
deleted file mode 100644
index 4335e27..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/DefaultName.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-// DefaultName.cpp
-
-#include "StdAfx.h"
-
-#include "DefaultName.h"
-
-static UString GetDefaultName3(const UString &fileName,
-    const UString &extension, const UString &addSubExtension)
-{
-  int extLength = extension.Length();
-  int fileNameLength = fileName.Length();
-  if (fileNameLength > extLength + 1)
-  {
-    int dotPos = fileNameLength - (extLength + 1);
-    if (fileName[dotPos] == '.')
-      if (extension.CompareNoCase(fileName.Mid(dotPos + 1)) == 0)
-        return fileName.Left(dotPos) + addSubExtension;
-  }
-  int dotPos = fileName.ReverseFind(L'.');
-  if (dotPos > 0)
-    return fileName.Left(dotPos) + addSubExtension;
-
-  if (addSubExtension.IsEmpty())
-    return fileName + L"~";
-  else
-    return fileName + addSubExtension;
-}
-
-UString GetDefaultName2(const UString &fileName,
-    const UString &extension, const UString &addSubExtension)
-{
-  UString name = GetDefaultName3(fileName, extension, addSubExtension);
-  name.TrimRight();
-  return name;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/DefaultName.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/DefaultName.h
deleted file mode 100644
index 9764ff8..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/DefaultName.h
+++ /dev/null
@@ -1,11 +0,0 @@
-// DefaultName.h
-
-#ifndef __DEFAULTNAME_H
-#define __DEFAULTNAME_H
-
-#include "Common/MyString.h"
-
-UString GetDefaultName2(const UString &fileName,
-    const UString &extension, const UString &addSubExtension);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/DirItem.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/DirItem.h
deleted file mode 100644
index 0f28948..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/DirItem.h
+++ /dev/null
@@ -1,68 +0,0 @@
-// DirItem.h
-
-#ifndef __DIR_ITEM_H
-#define __DIR_ITEM_H
-
-#include "Common/MyString.h"
-#include "Common/Types.h"
-#include "../../Archive/IArchive.h"
-
-struct CDirItem
-{
-  UInt64 Size;
-  FILETIME CTime;
-  FILETIME ATime;
-  FILETIME MTime;
-  UString Name;
-  UInt32 Attrib;
-  int PhyParent;
-  int LogParent;
-  
-  CDirItem(): PhyParent(-1), LogParent(-1) {}
-  bool IsDir() const { return (Attrib & FILE_ATTRIBUTE_DIRECTORY) != 0 ; }
-};
-
-class CDirItems
-{
-  UStringVector Prefixes;
-  CIntVector PhyParents;
-  CIntVector LogParents;
-
-  UString GetPrefixesPath(const CIntVector &parents, int index, const UString &name) const;
-public:
-  CObjectVector<CDirItem> Items;
-
-  int GetNumFolders() const { return Prefixes.Size(); }
-  UString GetPhyPath(int index) const;
-  UString GetLogPath(int index) const;
-
-  int AddPrefix(int phyParent, int logParent, const UString &prefix);
-  void DeleteLastPrefix();
-
-  void EnumerateDirectory(int phyParent, int logParent, const UString &phyPrefix,
-    UStringVector &errorPaths, CRecordVector<DWORD> &errorCodes);
-
-  void EnumerateDirItems2(
-    const UString &phyPrefix,
-    const UString &logPrefix,
-    const UStringVector &filePaths,
-    UStringVector &errorPaths, CRecordVector<DWORD> &errorCodes);
-
-  void ReserveDown();
-};
-
-struct CArcItem
-{
-  UInt64 Size;
-  FILETIME MTime;
-  UString Name;
-  bool IsDir;
-  bool SizeDefined;
-  bool Censored;
-  UInt32 IndexInServer;
-  int TimeType;
-  
-  CArcItem(): IsDir(false), SizeDefined(false), Censored(false), TimeType(-1) {}
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/EnumDirItems.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/EnumDirItems.cpp
deleted file mode 100644
index b83edf2..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/EnumDirItems.cpp
+++ /dev/null
@@ -1,367 +0,0 @@
-// EnumDirItems.cpp
-
-#include "StdAfx.h"
-
-#include <stdio.h>
-
-#include "Common/StringConvert.h"
-#include "Common/Wildcard.h"
-#include "Common/MyCom.h"
-
-#include "EnumDirItems.h"
-
-using namespace NWindows;
-using namespace NFile;
-using namespace NName;
-
-void AddDirFileInfo(int phyParent, int logParent,
-    const NFind::CFileInfoW &fi, CObjectVector<CDirItem> &dirItems)
-{
-  CDirItem di;
-  di.Size = fi.Size;
-  di.CTime = fi.CTime;
-  di.ATime = fi.ATime;
-  di.MTime = fi.MTime;
-  di.Attrib = fi.Attrib;
-  di.PhyParent = phyParent;
-  di.LogParent = logParent;
-  di.Name = fi.Name;
-  dirItems.Add(di);
-}
-
-UString CDirItems::GetPrefixesPath(const CIntVector &parents, int index, const UString &name) const
-{
-  UString path;
-  int len = name.Length();
-  int i;
-  for (i = index; i >= 0; i = parents[i])
-    len += Prefixes[i].Length();
-  int totalLen = len;
-  wchar_t *p = path.GetBuffer(len);
-  p[len] = 0;
-  len -= name.Length();
-  memcpy(p + len, (const wchar_t *)name, name.Length() * sizeof(wchar_t));
-  for (i = index; i >= 0; i = parents[i])
-  {
-    const UString &s = Prefixes[i];
-    len -= s.Length();
-    memcpy(p + len, (const wchar_t *)s, s.Length() * sizeof(wchar_t));
-  }
-  path.ReleaseBuffer(totalLen);
-  return path;
-}
-
-UString CDirItems::GetPhyPath(int index) const
-{
-  const CDirItem &di = Items[index];
-  return GetPrefixesPath(PhyParents, di.PhyParent, di.Name);
-}
-
-UString CDirItems::GetLogPath(int index) const
-{
-  const CDirItem &di = Items[index];
-  return GetPrefixesPath(LogParents, di.LogParent, di.Name);
-}
-
-void CDirItems::ReserveDown()
-{
-  Prefixes.ReserveDown();
-  PhyParents.ReserveDown();
-  LogParents.ReserveDown();
-  Items.ReserveDown();
-}
-
-int CDirItems::AddPrefix(int phyParent, int logParent, const UString &prefix)
-{
-  PhyParents.Add(phyParent);
-  LogParents.Add(logParent);
-  return Prefixes.Add(prefix);
-}
-
-void CDirItems::DeleteLastPrefix()
-{
-  PhyParents.DeleteBack();
-  LogParents.DeleteBack();
-  Prefixes.DeleteBack();
-}
-
-void CDirItems::EnumerateDirectory(int phyParent, int logParent, const UString &phyPrefix,
-    UStringVector &errorPaths, CRecordVector<DWORD> &errorCodes)
-{
-  NFind::CEnumeratorW enumerator(phyPrefix + (wchar_t)kAnyStringWildcard);
-  for (;;)
-  {
-    NFind::CFileInfoW fi;
-    bool found;
-    if (!enumerator.Next(fi, found))
-    {
-      errorCodes.Add(::GetLastError());
-      errorPaths.Add(phyPrefix);
-      return;
-    }
-    if (!found)
-      break;
-    AddDirFileInfo(phyParent, logParent, fi, Items);
-    if (fi.IsDir())
-    {
-      const UString name2 = fi.Name + (wchar_t)kDirDelimiter;
-      int parent = AddPrefix(phyParent, logParent, name2);
-      EnumerateDirectory(parent, parent, phyPrefix + name2, errorPaths, errorCodes);
-    }
-  }
-}
-
-void CDirItems::EnumerateDirItems2(const UString &phyPrefix, const UString &logPrefix,
-    const UStringVector &filePaths, UStringVector &errorPaths, CRecordVector<DWORD> &errorCodes)
-{
-  int phyParent = phyPrefix.IsEmpty() ? -1 : AddPrefix(-1, -1, phyPrefix);
-  int logParent = logPrefix.IsEmpty() ? -1 : AddPrefix(-1, -1, logPrefix);
-
-  for (int i = 0; i < filePaths.Size(); i++)
-  {
-    const UString &filePath = filePaths[i];
-    NFind::CFileInfoW fi;
-    const UString phyPath = phyPrefix + filePath;
-    if (!NFind::FindFile(phyPath, fi))
-    {
-      errorCodes.Add(::GetLastError());
-      errorPaths.Add(phyPath);
-      continue;
-    }
-    int delimiter = filePath.ReverseFind((wchar_t)kDirDelimiter);
-    UString phyPrefixCur;
-    int phyParentCur = phyParent;
-    if (delimiter >= 0)
-    {
-      phyPrefixCur = filePath.Left(delimiter + 1);
-      phyParentCur = AddPrefix(phyParent, logParent, phyPrefixCur);
-    }
-    AddDirFileInfo(phyParentCur, logParent, fi, Items);
-    if (fi.IsDir())
-    {
-      const UString name2 = fi.Name + (wchar_t)kDirDelimiter;
-      int parent = AddPrefix(phyParentCur, logParent, name2);
-      EnumerateDirectory(parent, parent, phyPrefix + phyPrefixCur + name2, errorPaths, errorCodes);
-    }
-  }
-  ReserveDown();
-}
-
-static HRESULT EnumerateDirItems(const NWildcard::CCensorNode &curNode,
-    int phyParent, int logParent, const UString &phyPrefix,
-    const UStringVector &addArchivePrefix,
-    CDirItems &dirItems,
-    bool enterToSubFolders,
-    IEnumDirItemCallback *callback,
-    UStringVector &errorPaths,
-    CRecordVector<DWORD> &errorCodes);
-
-static HRESULT EnumerateDirItems_Spec(const NWildcard::CCensorNode &curNode,
-    int phyParent, int logParent, const UString &curFolderName,
-    const UString &phyPrefix,
-    const UStringVector &addArchivePrefix,
-    CDirItems &dirItems,
-    bool enterToSubFolders,
-    IEnumDirItemCallback *callback,
-    UStringVector &errorPaths,
-    CRecordVector<DWORD> &errorCodes)
-  
-{
-  const UString name2 = curFolderName + (wchar_t)kDirDelimiter;
-  int parent = dirItems.AddPrefix(phyParent, logParent, name2);
-  int numItems = dirItems.Items.Size();
-  HRESULT res = EnumerateDirItems(curNode, parent, parent, phyPrefix + name2,
-    addArchivePrefix, dirItems, enterToSubFolders, callback, errorPaths, errorCodes);
-  if (numItems == dirItems.Items.Size())
-    dirItems.DeleteLastPrefix();
-  return res;
-}
-
-
-static HRESULT EnumerateDirItems(const NWildcard::CCensorNode &curNode,
-    int phyParent, int logParent, const UString &phyPrefix,
-    const UStringVector &addArchivePrefix,  // prefix from curNode
-    CDirItems &dirItems,
-    bool enterToSubFolders,
-    IEnumDirItemCallback *callback,
-    UStringVector &errorPaths,
-    CRecordVector<DWORD> &errorCodes)
-{
-  if (!enterToSubFolders)
-    if (curNode.NeedCheckSubDirs())
-      enterToSubFolders = true;
-  if (callback)
-    RINOK(callback->ScanProgress(dirItems.GetNumFolders(), dirItems.Items.Size(), phyPrefix));
-
-  // try direct_names case at first
-  if (addArchivePrefix.IsEmpty() && !enterToSubFolders)
-  {
-    // check that all names are direct
-    int i;
-    for (i = 0; i < curNode.IncludeItems.Size(); i++)
-    {
-      const NWildcard::CItem &item = curNode.IncludeItems[i];
-      if (item.Recursive || item.PathParts.Size() != 1)
-        break;
-      const UString &name = item.PathParts.Front();
-      if (name.IsEmpty() || DoesNameContainWildCard(name))
-        break;
-    }
-    if (i == curNode.IncludeItems.Size())
-    {
-      // all names are direct (no wildcards)
-      // so we don't need file_system's dir enumerator
-      CRecordVector<bool> needEnterVector;
-      for (i = 0; i < curNode.IncludeItems.Size(); i++)
-      {
-        const NWildcard::CItem &item = curNode.IncludeItems[i];
-        const UString &name = item.PathParts.Front();
-        const UString fullPath = phyPrefix + name;
-        NFind::CFileInfoW fi;
-        if (!NFind::FindFile(fullPath, fi))
-        {
-          errorCodes.Add(::GetLastError());
-          errorPaths.Add(fullPath);
-          continue;
-        }
-        bool isDir = fi.IsDir();
-        if (isDir && !item.ForDir || !isDir && !item.ForFile)
-        {
-          errorCodes.Add((DWORD)E_FAIL);
-          errorPaths.Add(fullPath);
-          continue;
-        }
-        {
-          UStringVector pathParts;
-          pathParts.Add(fi.Name);
-          if (curNode.CheckPathToRoot(false, pathParts, !isDir))
-            continue;
-        }
-        AddDirFileInfo(phyParent, logParent, fi, dirItems.Items);
-        if (!isDir)
-          continue;
-        
-        UStringVector addArchivePrefixNew;
-        const NWildcard::CCensorNode *nextNode = 0;
-        int index = curNode.FindSubNode(name);
-        if (index >= 0)
-        {
-          for (int t = needEnterVector.Size(); t <= index; t++)
-            needEnterVector.Add(true);
-          needEnterVector[index] = false;
-          nextNode = &curNode.SubNodes[index];
-        }
-        else
-        {
-          nextNode = &curNode;
-          addArchivePrefixNew.Add(name); // don't change it to fi.Name. It's for shortnames support
-        }
-
-        RINOK(EnumerateDirItems_Spec(*nextNode, phyParent, logParent, fi.Name, phyPrefix,
-            addArchivePrefixNew, dirItems, true, callback, errorPaths, errorCodes));
-      }
-      for (i = 0; i < curNode.SubNodes.Size(); i++)
-      {
-        if (i < needEnterVector.Size())
-          if (!needEnterVector[i])
-            continue;
-        const NWildcard::CCensorNode &nextNode = curNode.SubNodes[i];
-        const UString fullPath = phyPrefix + nextNode.Name;
-        NFind::CFileInfoW fi;
-        if (!NFind::FindFile(fullPath, fi))
-        {
-          if (!nextNode.AreThereIncludeItems())
-            continue;
-          errorCodes.Add(::GetLastError());
-          errorPaths.Add(fullPath);
-          continue;
-        }
-        if (!fi.IsDir())
-        {
-          errorCodes.Add((DWORD)E_FAIL);
-          errorPaths.Add(fullPath);
-          continue;
-        }
-
-        RINOK(EnumerateDirItems_Spec(nextNode, phyParent, logParent, fi.Name, phyPrefix,
-            UStringVector(), dirItems, false, callback, errorPaths, errorCodes));
-      }
-      return S_OK;
-    }
-  }
-
-
-  NFind::CEnumeratorW enumerator(phyPrefix + wchar_t(kAnyStringWildcard));
-  for (int ttt = 0; ; ttt++)
-  {
-    NFind::CFileInfoW fi;
-    bool found;
-    if (!enumerator.Next(fi, found))
-    {
-      errorCodes.Add(::GetLastError());
-      errorPaths.Add(phyPrefix);
-      break;
-    }
-    if (!found)
-      break;
-
-    if (callback && (ttt & 0xFF) == 0xFF)
-      RINOK(callback->ScanProgress(dirItems.GetNumFolders(), dirItems.Items.Size(), phyPrefix));
-    const UString &name = fi.Name;
-    bool enterToSubFolders2 = enterToSubFolders;
-    UStringVector addArchivePrefixNew = addArchivePrefix;
-    addArchivePrefixNew.Add(name);
-    {
-      UStringVector addArchivePrefixNewTemp(addArchivePrefixNew);
-      if (curNode.CheckPathToRoot(false, addArchivePrefixNewTemp, !fi.IsDir()))
-        continue;
-    }
-    if (curNode.CheckPathToRoot(true, addArchivePrefixNew, !fi.IsDir()))
-    {
-      AddDirFileInfo(phyParent, logParent, fi, dirItems.Items);
-      if (fi.IsDir())
-        enterToSubFolders2 = true;
-    }
-    if (!fi.IsDir())
-      continue;
-
-    const NWildcard::CCensorNode *nextNode = 0;
-    if (addArchivePrefix.IsEmpty())
-    {
-      int index = curNode.FindSubNode(name);
-      if (index >= 0)
-        nextNode = &curNode.SubNodes[index];
-    }
-    if (!enterToSubFolders2 && nextNode == 0)
-      continue;
-
-    addArchivePrefixNew = addArchivePrefix;
-    if (nextNode == 0)
-    {
-      nextNode = &curNode;
-      addArchivePrefixNew.Add(name);
-    }
-
-    RINOK(EnumerateDirItems_Spec(*nextNode, phyParent, logParent, name, phyPrefix,
-        addArchivePrefixNew, dirItems, enterToSubFolders2, callback, errorPaths, errorCodes));
-  }
-  return S_OK;
-}
-
-HRESULT EnumerateItems(
-    const NWildcard::CCensor &censor,
-    CDirItems &dirItems,
-    IEnumDirItemCallback *callback,
-    UStringVector &errorPaths,
-    CRecordVector<DWORD> &errorCodes)
-{
-  for (int i = 0; i < censor.Pairs.Size(); i++)
-  {
-    const NWildcard::CPair &pair = censor.Pairs[i];
-    int phyParent = pair.Prefix.IsEmpty() ? -1 : dirItems.AddPrefix(-1, -1, pair.Prefix);
-    RINOK(EnumerateDirItems(pair.Head, phyParent, -1, pair.Prefix, UStringVector(), dirItems, false,
-        callback, errorPaths, errorCodes));
-  }
-  dirItems.ReserveDown();
-  return S_OK;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/EnumDirItems.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/EnumDirItems.h
deleted file mode 100644
index d0ce950..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/EnumDirItems.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// EnumDirItems.h
-
-#ifndef __ENUM_DIR_ITEMS_H
-#define __ENUM_DIR_ITEMS_H
-
-#include "Common/Wildcard.h"
-#include "Windows/FileFind.h"
-#include "DirItem.h"
-
-void AddDirFileInfo(int phyParent, int logParent,
-    const NWindows::NFile::NFind::CFileInfoW &fi, CObjectVector<CDirItem> &dirItems);
-
-struct IEnumDirItemCallback
-{
-  virtual HRESULT ScanProgress(UInt64 numFolders, UInt64 numFiles, const wchar_t *path) = 0;
-};
-
-HRESULT EnumerateItems(
-    const NWildcard::CCensor &censor,
-    CDirItems &dirItems,
-    IEnumDirItemCallback *callback,
-    UStringVector &errorPaths,
-    CRecordVector<DWORD> &errorCodes);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ExitCode.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ExitCode.h
deleted file mode 100644
index b6d7d4d..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ExitCode.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// ExitCode.h
-
-#ifndef __EXIT_CODE_H
-#define __EXIT_CODE_H
-
-namespace NExitCode {
-
-enum EEnum {
-
-  kSuccess       = 0,     // Successful operation
-  kWarning       = 1,     // Non fatal error(s) occurred
-  kFatalError    = 2,     // A fatal error occurred
-  // kCRCError      = 3,     // A CRC error occurred when unpacking
-  // kLockedArchive = 4,     // Attempt to modify an archive previously locked
-  // kWriteError    = 5,     // Write to disk error
-  // kOpenError     = 6,     // Open file error
-  kUserError     = 7,     // Command line option error
-  kMemoryError   = 8,     // Not enough memory for operation
-  // kCreateFileError = 9,     // Create file error
-  
-  kUserBreak     = 255   // User stopped the process
-
-};
-
-}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/Extract.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/Extract.cpp
deleted file mode 100644
index 3ac497f..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/Extract.cpp
+++ /dev/null
@@ -1,218 +0,0 @@
-// Extract.cpp
-
-#include "StdAfx.h"
-
-#include "Extract.h"
-
-#include "Windows/Defs.h"
-#include "Windows/FileDir.h"
-
-#include "OpenArchive.h"
-#include "SetProperties.h"
-
-using namespace NWindows;
-
-static HRESULT DecompressArchive(
-    IInArchive *archive,
-    UInt64 packSize,
-    const NWildcard::CCensorNode &wildcardCensor,
-    const CExtractOptions &options,
-    IExtractCallbackUI *callback,
-    CArchiveExtractCallback *extractCallbackSpec,
-    UString &errorMessage)
-{
-  CRecordVector<UInt32> realIndices;
-  UInt32 numItems;
-  RINOK(archive->GetNumberOfItems(&numItems));
-
-  for(UInt32 i = 0; i < numItems; i++)
-  {
-    UString filePath;
-    RINOK(GetArchiveItemPath(archive, i, options.DefaultItemName, filePath));
-    bool isFolder;
-    RINOK(IsArchiveItemFolder(archive, i, isFolder));
-    if (!wildcardCensor.CheckPath(filePath, !isFolder))
-      continue;
-    realIndices.Add(i);
-  }
-  if (realIndices.Size() == 0)
-  {
-    callback->ThereAreNoFiles();
-    return S_OK;
-  }
-
-  UStringVector removePathParts;
-
-  UString outDir = options.OutputDir;
-  outDir.Replace(L"*", options.DefaultItemName);
-  #ifdef _WIN32
-  outDir.TrimRight();
-  #endif
-
-  if(!outDir.IsEmpty())
-    if(!NFile::NDirectory::CreateComplexDirectory(outDir))
-    {
-      HRESULT res = ::GetLastError();
-      if (res == S_OK)
-        res = E_FAIL;
-      errorMessage = ((UString)L"Can not create output directory ") + outDir;
-      return res;
-    }
-
-  extractCallbackSpec->Init(
-      archive,
-      callback,
-      options.StdOutMode,
-      outDir,
-      removePathParts,
-      options.DefaultItemName,
-      options.ArchiveFileInfo.MTime,
-      options.ArchiveFileInfo.Attrib,
-      packSize);
-
-  #ifdef COMPRESS_MT
-  RINOK(SetProperties(archive, options.Properties));
-  #endif
-
-  HRESULT result = archive->Extract(&realIndices.Front(),
-    realIndices.Size(), options.TestMode? 1: 0, extractCallbackSpec);
-
-  return callback->ExtractResult(result);
-}
-
-HRESULT DecompressArchives(
-    CCodecs *codecs, const CIntVector &formatIndices,
-    UStringVector &archivePaths, UStringVector &archivePathsFull,
-    const NWildcard::CCensorNode &wildcardCensor,
-    const CExtractOptions &optionsSpec,
-    IOpenCallbackUI *openCallback,
-    IExtractCallbackUI *extractCallback,
-    UString &errorMessage,
-    CDecompressStat &stat)
-{
-  stat.Clear();
-  CExtractOptions options = optionsSpec;
-  int i;
-  UInt64 totalPackSize = 0;
-  CRecordVector<UInt64> archiveSizes;
-  for (i = 0; i < archivePaths.Size(); i++)
-  {
-    const UString &archivePath = archivePaths[i];
-    NFile::NFind::CFileInfoW fi;
-    if (!NFile::NFind::FindFile(archivePath, fi))
-      throw "there is no such archive";
-    if (fi.IsDir())
-      throw "can't decompress folder";
-    archiveSizes.Add(fi.Size);
-    totalPackSize += fi.Size;
-  }
-  CArchiveExtractCallback *extractCallbackSpec = new CArchiveExtractCallback;
-  CMyComPtr<IArchiveExtractCallback> ec(extractCallbackSpec);
-  bool multi = (archivePaths.Size() > 1);
-  extractCallbackSpec->InitForMulti(multi, options.PathMode, options.OverwriteMode);
-  if (multi)
-  {
-    RINOK(extractCallback->SetTotal(totalPackSize));
-  }
-  for (i = 0; i < archivePaths.Size(); i++)
-  {
-    const UString &archivePath = archivePaths[i];
-    NFile::NFind::CFileInfoW fi;
-    if (!NFile::NFind::FindFile(archivePath, fi))
-      throw "there is no such archive";
-
-    if (fi.IsDir())
-      throw "there is no such archive";
-
-    options.ArchiveFileInfo = fi;
-
-    #ifndef _NO_CRYPTO
-    openCallback->Open_ClearPasswordWasAskedFlag();
-    #endif
-
-    RINOK(extractCallback->BeforeOpen(archivePath));
-    CArchiveLink archiveLink;
-
-    CIntVector formatIndices2 = formatIndices;
-    #ifndef _SFX
-    if (formatIndices.IsEmpty())
-    {
-      int pos = archivePath.ReverseFind(L'.');
-      if (pos >= 0)
-      {
-        UString s = archivePath.Mid(pos + 1);
-        int index = codecs->FindFormatForExtension(s);
-        if (index >= 0 && s == L"001")
-        {
-          s = archivePath.Left(pos);
-          pos = s.ReverseFind(L'.');
-          if (pos >= 0)
-          {
-            int index2 = codecs->FindFormatForExtension(s.Mid(pos + 1));
-            if (index2 >= 0 && s.CompareNoCase(L"rar") != 0)
-            {
-              formatIndices2.Add(index2);
-              formatIndices2.Add(index);
-            }
-          }
-        }
-      }
-    }
-    #endif
-    HRESULT result = MyOpenArchive(codecs, formatIndices2, archivePath, archiveLink, openCallback);
-    if (result == E_ABORT)
-      return result;
-
-    bool crypted = false;
-    #ifndef _NO_CRYPTO
-    crypted = openCallback->Open_WasPasswordAsked();
-    #endif
-
-    RINOK(extractCallback->OpenResult(archivePath, result, crypted));
-    if (result != S_OK)
-      continue;
-
-    for (int v = 0; v < archiveLink.VolumePaths.Size(); v++)
-    {
-      int index = archivePathsFull.FindInSorted(archiveLink.VolumePaths[v]);
-      if (index >= 0 && index > i)
-      {
-        archivePaths.Delete(index);
-        archivePathsFull.Delete(index);
-        totalPackSize -= archiveSizes[index];
-        archiveSizes.Delete(index);
-      }
-    }
-    if (archiveLink.VolumePaths.Size() != 0)
-    {
-      totalPackSize += archiveLink.VolumesSize;
-      RINOK(extractCallback->SetTotal(totalPackSize));
-    }
-
-    #ifndef _NO_CRYPTO
-    UString password;
-    RINOK(openCallback->Open_GetPasswordIfAny(password));
-    if (!password.IsEmpty())
-    {
-      RINOK(extractCallback->SetPassword(password));
-    }
-    #endif
-
-    options.DefaultItemName = archiveLink.GetDefaultItemName();
-    RINOK(DecompressArchive(
-        archiveLink.GetArchive(),
-        fi.Size + archiveLink.VolumesSize,
-        wildcardCensor, options, extractCallback, extractCallbackSpec, errorMessage));
-    extractCallbackSpec->LocalProgressSpec->InSize += fi.Size +
-        archiveLink.VolumesSize;
-    extractCallbackSpec->LocalProgressSpec->OutSize = extractCallbackSpec->UnpackSize;
-    if (!errorMessage.IsEmpty())
-      return E_FAIL;
-  }
-  stat.NumFolders = extractCallbackSpec->NumFolders;
-  stat.NumFiles = extractCallbackSpec->NumFiles;
-  stat.UnpackSize = extractCallbackSpec->UnpackSize;
-  stat.NumArchives = archivePaths.Size();
-  stat.PackSize = extractCallbackSpec->LocalProgressSpec->InSize;
-  return S_OK;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/Extract.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/Extract.h
deleted file mode 100644
index 37add18..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/Extract.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// Extract.h
-
-#ifndef __EXTRACT_H
-#define __EXTRACT_H
-
-#include "Common/Wildcard.h"
-#include "Windows/FileFind.h"
-
-#include "../../Archive/IArchive.h"
-
-#include "ArchiveExtractCallback.h"
-#include "ArchiveOpenCallback.h"
-#include "ExtractMode.h"
-#include "Property.h"
-
-#include "../Common/LoadCodecs.h"
-
-class CExtractOptions
-{
-public:
-  bool StdOutMode;
-  bool TestMode;
-  NExtract::NPathMode::EEnum PathMode;
-
-  UString OutputDir;
-  bool YesToAll;
-  UString DefaultItemName;
-  NWindows::NFile::NFind::CFileInfoW ArchiveFileInfo;
-  
-  // bool ShowDialog;
-  // bool PasswordEnabled;
-  // UString Password;
-  #ifdef COMPRESS_MT
-  CObjectVector<CProperty> Properties;
-  #endif
-
-  NExtract::NOverwriteMode::EEnum OverwriteMode;
-
-  #ifdef EXTERNAL_CODECS
-  CCodecs *Codecs;
-  #endif
-
-  CExtractOptions():
-      StdOutMode(false),
-      YesToAll(false),
-      TestMode(false),
-      PathMode(NExtract::NPathMode::kFullPathnames),
-      OverwriteMode(NExtract::NOverwriteMode::kAskBefore)
-      {}
-
-  /*
-    bool FullPathMode() const { return (ExtractMode == NExtractMode::kTest) ||
-    (ExtractMode == NExtractMode::kFullPath); }
-  */
-};
-
-struct CDecompressStat
-{
-  UInt64 NumArchives;
-  UInt64 UnpackSize;
-  UInt64 PackSize;
-  UInt64 NumFolders;
-  UInt64 NumFiles;
-  void Clear() { NumArchives = PackSize = UnpackSize = NumFolders = NumFiles = 0; }
-};
-
-HRESULT DecompressArchives(
-    CCodecs *codecs, const CIntVector &formatIndices,
-    UStringVector &archivePaths, UStringVector &archivePathsFull,
-    const NWildcard::CCensorNode &wildcardCensor,
-    const CExtractOptions &options,
-    IOpenCallbackUI *openCallback,
-    IExtractCallbackUI *extractCallback,
-    UString &errorMessage,
-    CDecompressStat &stat);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ExtractMode.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ExtractMode.h
deleted file mode 100644
index b448fb3..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ExtractMode.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// ExtractMode.h
-
-#ifndef __EXTRACT_MODE_H
-#define __EXTRACT_MODE_H
-
-namespace NExtract {
-  
-  namespace NPathMode
-  {
-    enum EEnum
-    {
-      kFullPathnames,
-      kCurrentPathnames,
-      kNoPathnames
-    };
-  }
-  
-  namespace NOverwriteMode
-  {
-    enum EEnum
-    {
-      kAskBefore,
-      kWithoutPrompt,
-      kSkipExisting,
-      kAutoRename,
-      kAutoRenameExisting
-    };
-  }
-}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ExtractingFilePath.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ExtractingFilePath.cpp
deleted file mode 100644
index 5de388d..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ExtractingFilePath.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-// ExtractingFilePath.cpp
-
-#include "StdAfx.h"
-#include "ExtractingFilePath.h"
-
-static UString ReplaceIncorrectChars(const UString &s)
-{
-  #ifdef _WIN32
-  UString res;
-  for (int i = 0; i < s.Length(); i++)
-  {
-    wchar_t c = s[i];
-    if (c < 0x20 || c == '*' || c == '?' || c == '<' || c == '>'  || c == '|' || c == ':' || c == '"')
-      c = '_';
-    res += c;
-  }
-  res.TrimRight();
-  return res;
-  #else
-  return s;
-  #endif
-}
-
-#ifdef _WIN32
-static const wchar_t *g_ReservedNames[] =
-{
-  L"CON", L"PRN", L"AUX", L"NUL"
-};
-
-static bool CheckTail(const UString &name, int len)
-{
-  int dotPos = name.Find(L'.');
-  if (dotPos < 0)
-    dotPos = name.Length();
-  UString s = name.Left(dotPos);
-  s.TrimRight();
-  return (s.Length() != len);
-}
-
-static bool CheckNameNum(const UString &name, const wchar_t *reservedName)
-{
-  int len = MyStringLen(reservedName);
-  if (name.Length() <= len)
-    return true;
-  if (name.Left(len).CompareNoCase(reservedName) != 0)
-    return true;
-  wchar_t c = name[len];
-  if (c < L'0' || c > L'9')
-    return true;
-  return CheckTail(name, len + 1);
-}
-
-static bool IsSupportedName(const UString &name)
-{
-  for (int i = 0; i < sizeof(g_ReservedNames) / sizeof(g_ReservedNames[0]); i++)
-  {
-    const wchar_t *reservedName = g_ReservedNames[i];
-    int len = MyStringLen(reservedName);
-    if (name.Length() < len)
-      continue;
-    if (name.Left(len).CompareNoCase(reservedName) != 0)
-      continue;
-    if (!CheckTail(name, len))
-      return false;
-  }
-  if (!CheckNameNum(name, L"COM"))
-    return false;
-  return CheckNameNum(name, L"LPT");
-}
-#endif
-
-static UString GetCorrectFileName(const UString &path)
-{
-  if (path == L".." || path == L".")
-    return UString();
-  return ReplaceIncorrectChars(path);
-}
-
-void MakeCorrectPath(UStringVector &pathParts)
-{
-  for (int i = 0; i < pathParts.Size();)
-  {
-    UString &s = pathParts[i];
-    s = GetCorrectFileName(s);
-    if (s.IsEmpty())
-      pathParts.Delete(i);
-    else
-    {
-      #ifdef _WIN32
-      if (!IsSupportedName(s))
-        s = (UString)L"_" + s;
-      #endif
-      i++;
-    }
-  }
-}
-
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ExtractingFilePath.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ExtractingFilePath.h
deleted file mode 100644
index a86a6a9..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ExtractingFilePath.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// ExtractingFilePath.h
-
-#ifndef __EXTRACTINGFILEPATH_H
-#define __EXTRACTINGFILEPATH_H
-
-#include "Common/MyString.h"
-
-void MakeCorrectPath(UStringVector &pathParts);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/IFileExtractCallback.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/IFileExtractCallback.h
deleted file mode 100644
index e8dcdce..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/IFileExtractCallback.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// IFileExtractCallback.h
-
-#ifndef __IFILEEXTRACTCALLBACK_H
-#define __IFILEEXTRACTCALLBACK_H
-
-#include "Common/MyString.h"
-#include "../../IDecl.h"
-
-namespace NOverwriteAnswer
-{
-  enum EEnum
-  {
-    kYes,
-    kYesToAll,
-    kNo,
-    kNoToAll,
-    kAutoRename,
-    kCancel
-  };
-}
-
-DECL_INTERFACE_SUB(IFolderArchiveExtractCallback, IProgress, 0x01, 0x07)
-{
-public:
-  STDMETHOD(AskOverwrite)(
-      const wchar_t *existName, const FILETIME *existTime, const UInt64 *existSize,
-      const wchar_t *newName, const FILETIME *newTime, const UInt64 *newSize,
-      Int32 *answer) PURE;
-  STDMETHOD(PrepareOperation)(const wchar_t *name, bool isFolder, Int32 askExtractMode, const UInt64 *position) PURE;
-  STDMETHOD(MessageError)(const wchar_t *message) PURE;
-  STDMETHOD(SetOperationResult)(Int32 operationResult, bool encrypted) PURE;
-};
-
-struct IExtractCallbackUI: IFolderArchiveExtractCallback
-{
-  virtual HRESULT BeforeOpen(const wchar_t *name) = 0;
-  virtual HRESULT OpenResult(const wchar_t *name, HRESULT result, bool encrypted) = 0;
-  virtual HRESULT ThereAreNoFiles() = 0;
-  virtual HRESULT ExtractResult(HRESULT result) = 0;
-
-  #ifndef _NO_CRYPTO
-  virtual HRESULT SetPassword(const UString &password) = 0;
-  #endif
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/LoadCodecs.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/LoadCodecs.cpp
deleted file mode 100644
index 4b5639e..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/LoadCodecs.cpp
+++ /dev/null
@@ -1,674 +0,0 @@
-// LoadCodecs.cpp
-
-#include "StdAfx.h"
-
-#include "LoadCodecs.h"
-
-#include "../../../Common/MyCom.h"
-#ifdef NEW_FOLDER_INTERFACE
-#include "../../../Common/StringToInt.h"
-#endif
-#include "../../../Windows/PropVariant.h"
-
-#include "../../ICoder.h"
-#include "../../Common/RegisterArc.h"
-
-#ifdef EXTERNAL_CODECS
-#include "../../../Windows/FileFind.h"
-#include "../../../Windows/DLL.h"
-#ifdef NEW_FOLDER_INTERFACE
-#include "../../../Windows/ResourceString.h"
-static const UINT kIconTypesResId = 100;
-#endif
-
-#ifdef _WIN32
-#include "Windows/Registry.h"
-#endif
-
-using namespace NWindows;
-using namespace NFile;
-
-#ifdef _WIN32
-extern HINSTANCE g_hInstance;
-#endif
-
-static CSysString GetLibraryFolderPrefix()
-{
-  #ifdef _WIN32
-  TCHAR fullPath[MAX_PATH + 1];
-  ::GetModuleFileName(g_hInstance, fullPath, MAX_PATH);
-  CSysString path = fullPath;
-  int pos = path.ReverseFind(TEXT(CHAR_PATH_SEPARATOR));
-  return path.Left(pos + 1);
-  #else
-  return CSysString(); // FIX IT
-  #endif
-}
-
-#define kCodecsFolderName TEXT("Codecs")
-#define kFormatsFolderName TEXT("Formats")
-static const TCHAR *kMainDll = TEXT("7z.dll");
-
-#ifdef _WIN32
-static LPCTSTR kRegistryPath = TEXT("Software") TEXT(STRING_PATH_SEPARATOR) TEXT("7-zip");
-static LPCTSTR kProgramPathValue = TEXT("Path");
-static bool ReadPathFromRegistry(HKEY baseKey, CSysString &path)
-{
-  NRegistry::CKey key;
-  if(key.Open(baseKey, kRegistryPath, KEY_READ) == ERROR_SUCCESS)
-    if (key.QueryValue(kProgramPathValue, path) == ERROR_SUCCESS)
-    {
-      NName::NormalizeDirPathPrefix(path);
-      return true;
-    }
-  return false;
-}
-
-#endif
-
-CSysString GetBaseFolderPrefixFromRegistry()
-{
-  CSysString moduleFolderPrefix = GetLibraryFolderPrefix();
-  NFind::CFileInfo fi;
-  if (NFind::FindFile(moduleFolderPrefix + kMainDll, fi))
-    if (!fi.IsDir())
-      return moduleFolderPrefix;
-  if (NFind::FindFile(moduleFolderPrefix + kCodecsFolderName, fi))
-    if (fi.IsDir())
-      return moduleFolderPrefix;
-  if (NFind::FindFile(moduleFolderPrefix + kFormatsFolderName, fi))
-    if (fi.IsDir())
-      return moduleFolderPrefix;
-  #ifdef _WIN32
-  CSysString path;
-  if (ReadPathFromRegistry(HKEY_CURRENT_USER, path))
-    return path;
-  if (ReadPathFromRegistry(HKEY_LOCAL_MACHINE, path))
-    return path;
-  #endif
-  return moduleFolderPrefix;
-}
-
-typedef UInt32 (WINAPI *GetNumberOfMethodsFunc)(UInt32 *numMethods);
-typedef UInt32 (WINAPI *GetNumberOfFormatsFunc)(UInt32 *numFormats);
-typedef UInt32 (WINAPI *GetHandlerPropertyFunc)(PROPID propID, PROPVARIANT *value);
-typedef UInt32 (WINAPI *GetHandlerPropertyFunc2)(UInt32 index, PROPID propID, PROPVARIANT *value);
-typedef UInt32 (WINAPI *CreateObjectFunc)(const GUID *clsID, const GUID *iid, void **outObject);
-typedef UInt32 (WINAPI *SetLargePageModeFunc)();
-
-
-static HRESULT GetCoderClass(GetMethodPropertyFunc getMethodProperty, UInt32 index,
-    PROPID propId, CLSID &clsId, bool &isAssigned)
-{
-  NWindows::NCOM::CPropVariant prop;
-  isAssigned = false;
-  RINOK(getMethodProperty(index, propId, &prop));
-  if (prop.vt == VT_BSTR)
-  {
-    isAssigned = true;
-    clsId = *(const GUID *)prop.bstrVal;
-  }
-  else if (prop.vt != VT_EMPTY)
-    return E_FAIL;
-  return S_OK;
-}
-
-HRESULT CCodecs::LoadCodecs()
-{
-  CCodecLib &lib = Libs.Back();
-  lib.GetMethodProperty = (GetMethodPropertyFunc)lib.Lib.GetProcAddress("GetMethodProperty");
-  if (lib.GetMethodProperty == NULL)
-    return S_OK;
-
-  UInt32 numMethods = 1;
-  GetNumberOfMethodsFunc getNumberOfMethodsFunc = (GetNumberOfMethodsFunc)lib.Lib.GetProcAddress("GetNumberOfMethods");
-  if (getNumberOfMethodsFunc != NULL)
-  {
-    RINOK(getNumberOfMethodsFunc(&numMethods));
-  }
-
-  for(UInt32 i = 0; i < numMethods; i++)
-  {
-    CDllCodecInfo info;
-    info.LibIndex = Libs.Size() - 1;
-    info.CodecIndex = i;
-
-    RINOK(GetCoderClass(lib.GetMethodProperty, i, NMethodPropID::kEncoder, info.Encoder, info.EncoderIsAssigned));
-    RINOK(GetCoderClass(lib.GetMethodProperty, i, NMethodPropID::kDecoder, info.Decoder, info.DecoderIsAssigned));
-
-    Codecs.Add(info);
-  }
-  return S_OK;
-}
-
-static HRESULT ReadProp(
-    GetHandlerPropertyFunc getProp,
-    GetHandlerPropertyFunc2 getProp2,
-    UInt32 index, PROPID propID, NCOM::CPropVariant &prop)
-{
-  if (getProp2)
-    return getProp2(index, propID, &prop);;
-  return getProp(propID, &prop);
-}
-
-static HRESULT ReadBoolProp(
-    GetHandlerPropertyFunc getProp,
-    GetHandlerPropertyFunc2 getProp2,
-    UInt32 index, PROPID propID, bool &res)
-{
-  NCOM::CPropVariant prop;
-  RINOK(ReadProp(getProp, getProp2, index, propID, prop));
-  if (prop.vt == VT_BOOL)
-    res = VARIANT_BOOLToBool(prop.boolVal);
-  else if (prop.vt != VT_EMPTY)
-    return E_FAIL;
-  return S_OK;
-}
-
-static HRESULT ReadStringProp(
-    GetHandlerPropertyFunc getProp,
-    GetHandlerPropertyFunc2 getProp2,
-    UInt32 index, PROPID propID, UString &res)
-{
-  NCOM::CPropVariant prop;
-  RINOK(ReadProp(getProp, getProp2, index, propID, prop));
-  if (prop.vt == VT_BSTR)
-    res = prop.bstrVal;
-  else if (prop.vt != VT_EMPTY)
-    return E_FAIL;
-  return S_OK;
-}
-
-#endif
-
-static const unsigned int kNumArcsMax = 32;
-static unsigned int g_NumArcs = 0;
-static const CArcInfo *g_Arcs[kNumArcsMax];
-void RegisterArc(const CArcInfo *arcInfo)
-{
-  if (g_NumArcs < kNumArcsMax)
-    g_Arcs[g_NumArcs++] = arcInfo;
-}
-
-static void SplitString(const UString &srcString, UStringVector &destStrings)
-{
-  destStrings.Clear();
-  UString s;
-  int len = srcString.Length();
-  if (len == 0)
-    return;
-  for (int i = 0; i < len; i++)
-  {
-    wchar_t c = srcString[i];
-    if (c == L' ')
-    {
-      if (!s.IsEmpty())
-      {
-        destStrings.Add(s);
-        s.Empty();
-      }
-    }
-    else
-      s += c;
-  }
-  if (!s.IsEmpty())
-    destStrings.Add(s);
-}
-
-void CArcInfoEx::AddExts(const wchar_t* ext, const wchar_t* addExt)
-{
-  UStringVector exts, addExts;
-  SplitString(ext, exts);
-  if (addExt != 0)
-    SplitString(addExt, addExts);
-  for (int i = 0; i < exts.Size(); i++)
-  {
-    CArcExtInfo extInfo;
-    extInfo.Ext = exts[i];
-    if (i < addExts.Size())
-    {
-      extInfo.AddExt = addExts[i];
-      if (extInfo.AddExt == L"*")
-        extInfo.AddExt.Empty();
-    }
-    Exts.Add(extInfo);
-  }
-}
-
-#ifdef EXTERNAL_CODECS
-
-HRESULT CCodecs::LoadFormats()
-{
-  const NDLL::CLibrary &lib = Libs.Back().Lib;
-  GetHandlerPropertyFunc getProp = 0;
-  GetHandlerPropertyFunc2 getProp2 = (GetHandlerPropertyFunc2)
-      lib.GetProcAddress("GetHandlerProperty2");
-  if (getProp2 == NULL)
-  {
-    getProp = (GetHandlerPropertyFunc)
-        lib.GetProcAddress("GetHandlerProperty");
-    if (getProp == NULL)
-      return S_OK;
-  }
-
-  UInt32 numFormats = 1;
-  GetNumberOfFormatsFunc getNumberOfFormats = (GetNumberOfFormatsFunc)
-    lib.GetProcAddress("GetNumberOfFormats");
-  if (getNumberOfFormats != NULL)
-  {
-    RINOK(getNumberOfFormats(&numFormats));
-  }
-  if (getProp2 == NULL)
-    numFormats = 1;
-
-  for(UInt32 i = 0; i < numFormats; i++)
-  {
-    CArcInfoEx item;
-    item.LibIndex = Libs.Size() - 1;
-    item.FormatIndex = i;
-
-    RINOK(ReadStringProp(getProp, getProp2, i, NArchive::kName, item.Name));
-
-    NCOM::CPropVariant prop;
-    if (ReadProp(getProp, getProp2, i, NArchive::kClassID, prop) != S_OK)
-      continue;
-    if (prop.vt != VT_BSTR)
-      continue;
-    item.ClassID = *(const GUID *)prop.bstrVal;
-    prop.Clear();
-
-    UString ext, addExt;
-    RINOK(ReadStringProp(getProp, getProp2, i, NArchive::kExtension, ext));
-    RINOK(ReadStringProp(getProp, getProp2, i, NArchive::kAddExtension, addExt));
-    item.AddExts(ext, addExt);
-
-    ReadBoolProp(getProp, getProp2, i, NArchive::kUpdate, item.UpdateEnabled);
-    if (item.UpdateEnabled)
-      ReadBoolProp(getProp, getProp2, i, NArchive::kKeepName, item.KeepName);
-    
-    if (ReadProp(getProp, getProp2, i, NArchive::kStartSignature, prop) == S_OK)
-      if (prop.vt == VT_BSTR)
-      {
-        UINT len = ::SysStringByteLen(prop.bstrVal);
-        item.StartSignature.SetCapacity(len);
-        memmove(item.StartSignature, prop.bstrVal, len);
-      }
-    Formats.Add(item);
-  }
-  return S_OK;
-}
-
-#ifdef NEW_FOLDER_INTERFACE
-void CCodecLib::LoadIcons()
-{
-  UString iconTypes = MyLoadStringW((HMODULE)Lib, kIconTypesResId);
-  UStringVector pairs;
-  SplitString(iconTypes, pairs);
-  for (int i = 0; i < pairs.Size(); i++)
-  {
-    const UString &s = pairs[i];
-    int pos = s.Find(L':');
-    if (pos < 0)
-      continue;
-    CIconPair iconPair;
-    const wchar_t *end;
-    UString num = s.Mid(pos + 1);
-    iconPair.IconIndex = (UInt32)ConvertStringToUInt64(num, &end);
-    if (*end != L'\0')
-      continue;
-    iconPair.Ext = s.Left(pos);
-    IconPairs.Add(iconPair);
-  }
-}
-
-int CCodecLib::FindIconIndex(const UString &ext) const
-{
-  for (int i = 0; i < IconPairs.Size(); i++)
-  {
-    const CIconPair &pair = IconPairs[i];
-    if (ext.CompareNoCase(pair.Ext) == 0)
-      return pair.IconIndex;
-  }
-  return -1;
-}
-#endif
-
-#ifdef _7ZIP_LARGE_PAGES
-extern "C"
-{
-  extern SIZE_T g_LargePageSize;
-}
-#endif
-
-HRESULT CCodecs::LoadDll(const CSysString &dllPath)
-{
-  {
-    NDLL::CLibrary library;
-    if (!library.LoadEx(dllPath, LOAD_LIBRARY_AS_DATAFILE))
-      return S_OK;
-  }
-  Libs.Add(CCodecLib());
-  CCodecLib &lib = Libs.Back();
-  #ifdef NEW_FOLDER_INTERFACE
-  lib.Path = dllPath;
-  #endif
-  bool used = false;
-  HRESULT res = S_OK;
-  if (lib.Lib.Load(dllPath))
-  {
-    #ifdef NEW_FOLDER_INTERFACE
-    lib.LoadIcons();
-    #endif
-
-    #ifdef _7ZIP_LARGE_PAGES
-    if (g_LargePageSize != 0)
-    {
-      SetLargePageModeFunc setLargePageMode = (SetLargePageModeFunc)lib.Lib.GetProcAddress("SetLargePageMode");
-      if (setLargePageMode != 0)
-        setLargePageMode();
-    }
-    #endif
-
-    lib.CreateObject = (CreateObjectFunc)lib.Lib.GetProcAddress("CreateObject");
-    if (lib.CreateObject != 0)
-    {
-      int startSize = Codecs.Size();
-      res = LoadCodecs();
-      used = (Codecs.Size() != startSize);
-      if (res == S_OK)
-      {
-        startSize = Formats.Size();
-        res = LoadFormats();
-        used = used || (Formats.Size() != startSize);
-      }
-    }
-  }
-  if (!used)
-    Libs.DeleteBack();
-  return res;
-}
-
-HRESULT CCodecs::LoadDllsFromFolder(const CSysString &folderPrefix)
-{
-  NFile::NFind::CEnumerator enumerator(folderPrefix + CSysString(TEXT("*")));
-  NFile::NFind::CFileInfo fi;
-  while (enumerator.Next(fi))
-  {
-    if (fi.IsDir())
-      continue;
-    RINOK(LoadDll(folderPrefix + fi.Name));
-  }
-  return S_OK;
-}
-
-#endif
-
-#ifndef _SFX
-static inline void SetBuffer(CByteBuffer &bb, const Byte *data, int size)
-{
-  bb.SetCapacity(size);
-  memmove((Byte *)bb, data, size);
-}
-#endif
-
-HRESULT CCodecs::Load()
-{
-  Formats.Clear();
-  #ifdef EXTERNAL_CODECS
-  Codecs.Clear();
-  #endif
-  for (UInt32 i = 0; i < g_NumArcs; i++)
-  {
-    const CArcInfo &arc = *g_Arcs[i];
-    CArcInfoEx item;
-    item.Name = arc.Name;
-    item.CreateInArchive = arc.CreateInArchive;
-    item.CreateOutArchive = arc.CreateOutArchive;
-    item.AddExts(arc.Ext, arc.AddExt);
-    item.UpdateEnabled = (arc.CreateOutArchive != 0);
-    item.KeepName = arc.KeepName;
-
-    #ifndef _SFX
-    SetBuffer(item.StartSignature, arc.Signature, arc.SignatureSize);
-    #endif
-    Formats.Add(item);
-  }
-  #ifdef EXTERNAL_CODECS
-  const CSysString baseFolder = GetBaseFolderPrefixFromRegistry();
-  RINOK(LoadDll(baseFolder + kMainDll));
-  RINOK(LoadDllsFromFolder(baseFolder + kCodecsFolderName TEXT(STRING_PATH_SEPARATOR)));
-  RINOK(LoadDllsFromFolder(baseFolder + kFormatsFolderName TEXT(STRING_PATH_SEPARATOR)));
-  #endif
-  return S_OK;
-}
-
-#ifndef _SFX
-
-int CCodecs::FindFormatForArchiveName(const UString &arcPath) const
-{
-  int slashPos1 = arcPath.ReverseFind(WCHAR_PATH_SEPARATOR);
-  int slashPos2 = arcPath.ReverseFind(L'.');
-  int dotPos = arcPath.ReverseFind(L'.');
-  if (dotPos < 0 || dotPos < slashPos1 || dotPos < slashPos2)
-    return -1;
-  UString ext = arcPath.Mid(dotPos + 1);
-  for (int i = 0; i < Formats.Size(); i++)
-  {
-    const CArcInfoEx &arc = Formats[i];
-    if (!arc.UpdateEnabled)
-      continue;
-    // if (arc.FindExtension(ext) >= 0)
-    UString mainExt = arc.GetMainExt();
-    if (!mainExt.IsEmpty() && ext.CompareNoCase(mainExt) == 0)
-      return i;
-  }
-  return -1;
-}
-
-int CCodecs::FindFormatForExtension(const UString &ext) const
-{
-  if (ext.IsEmpty())
-    return -1;
-  for (int i = 0; i < Formats.Size(); i++)
-    if (Formats[i].FindExtension(ext) >= 0)
-      return i;
-  return -1;
-}
-
-int CCodecs::FindFormatForArchiveType(const UString &arcType) const
-{
-  for (int i = 0; i < Formats.Size(); i++)
-    if (Formats[i].Name.CompareNoCase(arcType) == 0)
-      return i;
-  return -1;
-}
-
-bool CCodecs::FindFormatForArchiveType(const UString &arcType, CIntVector &formatIndices) const
-{
-  formatIndices.Clear();
-  for (int pos = 0; pos < arcType.Length();)
-  {
-    int pos2 = arcType.Find('.', pos);
-    if (pos2 < 0)
-      pos2 = arcType.Length();
-    const UString name = arcType.Mid(pos, pos2 - pos);
-    int index = FindFormatForArchiveType(name);
-    if (index < 0 && name != L"*")
-    {
-      formatIndices.Clear();
-      return false;
-    }
-    formatIndices.Add(index);
-    pos = pos2 + 1;
-  }
-  return true;
-}
-
-#endif
-
-#ifdef EXTERNAL_CODECS
-
-#ifdef EXPORT_CODECS
-extern unsigned int g_NumCodecs;
-STDAPI CreateCoder2(bool encode, UInt32 index, const GUID *iid, void **outObject);
-STDAPI GetMethodProperty(UInt32 codecIndex, PROPID propID, PROPVARIANT *value);
-// STDAPI GetNumberOfMethods(UInt32 *numCodecs);
-#endif
-
-STDMETHODIMP CCodecs::GetNumberOfMethods(UInt32 *numMethods)
-{
-  *numMethods =
-      #ifdef EXPORT_CODECS
-      g_NumCodecs +
-      #endif
-      Codecs.Size();
-  return S_OK;
-}
-
-STDMETHODIMP CCodecs::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
-  #ifdef EXPORT_CODECS
-  if (index < g_NumCodecs)
-    return GetMethodProperty(index, propID, value);
-  #endif
-
-  const CDllCodecInfo &ci = Codecs[index
-      #ifdef EXPORT_CODECS
-      - g_NumCodecs
-      #endif
-      ];
-
-  if (propID == NMethodPropID::kDecoderIsAssigned)
-  {
-    NWindows::NCOM::CPropVariant propVariant;
-    propVariant = ci.DecoderIsAssigned;
-    propVariant.Detach(value);
-    return S_OK;
-  }
-  if (propID == NMethodPropID::kEncoderIsAssigned)
-  {
-    NWindows::NCOM::CPropVariant propVariant;
-    propVariant = ci.EncoderIsAssigned;
-    propVariant.Detach(value);
-    return S_OK;
-  }
-  return Libs[ci.LibIndex].GetMethodProperty(ci.CodecIndex, propID, value);
-}
-
-STDMETHODIMP CCodecs::CreateDecoder(UInt32 index, const GUID *iid, void **coder)
-{
-  #ifdef EXPORT_CODECS
-  if (index < g_NumCodecs)
-    return CreateCoder2(false, index, iid, coder);
-  #endif
-  const CDllCodecInfo &ci = Codecs[index
-      #ifdef EXPORT_CODECS
-      - g_NumCodecs
-      #endif
-      ];
-  if (ci.DecoderIsAssigned)
-    return Libs[ci.LibIndex].CreateObject(&ci.Decoder, iid, (void **)coder);
-  return S_OK;
-}
-
-STDMETHODIMP CCodecs::CreateEncoder(UInt32 index, const GUID *iid, void **coder)
-{
-  #ifdef EXPORT_CODECS
-  if (index < g_NumCodecs)
-    return CreateCoder2(true, index, iid, coder);
-  #endif
-  const CDllCodecInfo &ci = Codecs[index
-      #ifdef EXPORT_CODECS
-      - g_NumCodecs
-      #endif
-      ];
-  if (ci.EncoderIsAssigned)
-    return Libs[ci.LibIndex].CreateObject(&ci.Encoder, iid, (void **)coder);
-  return S_OK;
-}
-
-HRESULT CCodecs::CreateCoder(const UString &name, bool encode, CMyComPtr<ICompressCoder> &coder) const
-{
-  for (int i = 0; i < Codecs.Size(); i++)
-  {
-    const CDllCodecInfo &codec = Codecs[i];
-    if (encode && !codec.EncoderIsAssigned || !encode && !codec.DecoderIsAssigned)
-      continue;
-    const CCodecLib &lib = Libs[codec.LibIndex];
-    UString res;
-    NWindows::NCOM::CPropVariant prop;
-    RINOK(lib.GetMethodProperty(codec.CodecIndex, NMethodPropID::kName, &prop));
-    if (prop.vt == VT_BSTR)
-      res = prop.bstrVal;
-    else if (prop.vt != VT_EMPTY)
-      continue;
-    if (name.CompareNoCase(res) == 0)
-      return lib.CreateObject(encode ? &codec.Encoder : &codec.Decoder, &IID_ICompressCoder, (void **)&coder);
-  }
-  return CLASS_E_CLASSNOTAVAILABLE;
-}
-
-int CCodecs::GetCodecLibIndex(UInt32 index)
-{
-  #ifdef EXPORT_CODECS
-  if (index < g_NumCodecs)
-    return -1;
-  #endif
-  #ifdef EXTERNAL_CODECS
-  const CDllCodecInfo &ci = Codecs[index
-      #ifdef EXPORT_CODECS
-      - g_NumCodecs
-      #endif
-      ];
-  return ci.LibIndex;
-  #else
-  return -1;
-  #endif
-}
-
-bool CCodecs::GetCodecEncoderIsAssigned(UInt32 index)
-{
-  #ifdef EXPORT_CODECS
-  if (index < g_NumCodecs)
-  {
-    NWindows::NCOM::CPropVariant prop;
-    if (GetProperty(index, NMethodPropID::kEncoder, &prop) == S_OK)
-      if (prop.vt != VT_EMPTY)
-        return true;
-    return false;
-  }
-  #endif
-  #ifdef EXTERNAL_CODECS
-  const CDllCodecInfo &ci = Codecs[index
-      #ifdef EXPORT_CODECS
-      - g_NumCodecs
-      #endif
-      ];
-  return ci.EncoderIsAssigned;
-  #else
-  return false;
-  #endif
-}
-
-HRESULT CCodecs::GetCodecId(UInt32 index, UInt64 &id)
-{
-  UString s;
-  NWindows::NCOM::CPropVariant prop;
-  RINOK(GetProperty(index, NMethodPropID::kID, &prop));
-  if (prop.vt != VT_UI8)
-    return E_INVALIDARG;
-  id = prop.uhVal.QuadPart;
-  return S_OK;
-}
-
-UString CCodecs::GetCodecName(UInt32 index)
-{
-  UString s;
-  NWindows::NCOM::CPropVariant prop;
-  if (GetProperty(index, NMethodPropID::kName, &prop) == S_OK)
-    if (prop.vt == VT_BSTR)
-      s = prop.bstrVal;
-  return s;
-}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/LoadCodecs.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/LoadCodecs.h
deleted file mode 100644
index 71de2ff..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/LoadCodecs.h
+++ /dev/null
@@ -1,220 +0,0 @@
-// LoadCodecs.h
-
-#ifndef __LOADCODECS_H
-#define __LOADCODECS_H
-
-#include "../../../Common/Types.h"
-#include "../../../Common/MyCom.h"
-#include "../../../Common/MyString.h"
-#include "../../../Common/Buffer.h"
-#include "../../ICoder.h"
-
-#ifdef EXTERNAL_CODECS
-#include "../../../Windows/DLL.h"
-#endif
-
-struct CDllCodecInfo
-{
-  CLSID Encoder;
-  CLSID Decoder;
-  bool EncoderIsAssigned;
-  bool DecoderIsAssigned;
-  int LibIndex;
-  UInt32 CodecIndex;
-};
-
-#include "../../Archive/IArchive.h"
-
-typedef IInArchive * (*CreateInArchiveP)();
-typedef IOutArchive * (*CreateOutArchiveP)();
-
-struct CArcExtInfo
-{
-  UString Ext;
-  UString AddExt;
-  CArcExtInfo() {}
-  CArcExtInfo(const UString &ext): Ext(ext) {}
-  CArcExtInfo(const UString &ext, const UString &addExt): Ext(ext), AddExt(addExt) {}
-};
-
-
-struct CArcInfoEx
-{
-  #ifdef EXTERNAL_CODECS
-  int LibIndex;
-  UInt32 FormatIndex;
-  CLSID ClassID;
-  #endif
-  bool UpdateEnabled;
-  CreateInArchiveP CreateInArchive;
-  CreateOutArchiveP CreateOutArchive;
-  UString Name;
-  CObjectVector<CArcExtInfo> Exts;
-  #ifndef _SFX
-  CByteBuffer StartSignature;
-  // CByteBuffer FinishSignature;
-  #ifdef NEW_FOLDER_INTERFACE
-  UStringVector AssociateExts;
-  #endif
-  #endif
-  bool KeepName;
-  UString GetMainExt() const
-  {
-    if (Exts.IsEmpty())
-      return UString();
-    return Exts[0].Ext;
-  }
-  int FindExtension(const UString &ext) const
-  {
-    for (int i = 0; i < Exts.Size(); i++)
-      if (ext.CompareNoCase(Exts[i].Ext) == 0)
-        return i;
-    return -1;
-  }
-  UString GetAllExtensions() const
-  {
-    UString s;
-    for (int i = 0; i < Exts.Size(); i++)
-    {
-      if (i > 0)
-        s += ' ';
-      s += Exts[i].Ext;
-    }
-    return s;
-  }
-
-  void AddExts(const wchar_t* ext, const wchar_t* addExt);
-
-  CArcInfoEx():
-    #ifdef EXTERNAL_CODECS
-    LibIndex(-1),
-    #endif
-    UpdateEnabled(false),
-    CreateInArchive(0), CreateOutArchive(0),
-    KeepName(false)
-    #ifndef _SFX
-    #endif
-  {}
-};
-
-#ifdef EXTERNAL_CODECS
-typedef UInt32 (WINAPI *GetMethodPropertyFunc)(UInt32 index, PROPID propID, PROPVARIANT *value);
-typedef UInt32 (WINAPI *CreateObjectFunc)(const GUID *clsID, const GUID *interfaceID, void **outObject);
-
-
-struct CCodecLib
-{
-  NWindows::NDLL::CLibrary Lib;
-  GetMethodPropertyFunc GetMethodProperty;
-  CreateObjectFunc CreateObject;
-  #ifdef NEW_FOLDER_INTERFACE
-  struct CIconPair
-  {
-    UString Ext;
-    UInt32 IconIndex;
-  };
-  CSysString Path;
-  CObjectVector<CIconPair> IconPairs;
-  void LoadIcons();
-  int FindIconIndex(const UString &ext) const;
-  #endif
-  CCodecLib(): GetMethodProperty(0) {}
-};
-#endif
-
-class CCodecs:
-  #ifdef EXTERNAL_CODECS
-  public ICompressCodecsInfo,
-  #else
-  public IUnknown,
-  #endif
-  public CMyUnknownImp
-{
-public:
-  #ifdef EXTERNAL_CODECS
-  CObjectVector<CCodecLib> Libs;
-  CObjectVector<CDllCodecInfo> Codecs;
-  HRESULT LoadCodecs();
-  HRESULT LoadFormats();
-  HRESULT LoadDll(const CSysString &path);
-  HRESULT LoadDllsFromFolder(const CSysString &folderPrefix);
-
-  HRESULT CreateArchiveHandler(const CArcInfoEx &ai, void **archive, bool outHandler) const
-  {
-    return Libs[ai.LibIndex].CreateObject(&ai.ClassID, outHandler ? &IID_IOutArchive : &IID_IInArchive, (void **)archive);
-  }
-  #endif
-
-public:
-  CObjectVector<CArcInfoEx> Formats;
-  HRESULT Load();
-  
-  #ifndef _SFX
-  int FindFormatForArchiveName(const UString &arcPath) const;
-  int FindFormatForExtension(const UString &ext) const;
-  int FindFormatForArchiveType(const UString &arcType) const;
-  bool FindFormatForArchiveType(const UString &arcType, CIntVector &formatIndices) const;
-  #endif
-
-  MY_UNKNOWN_IMP
-
-  #ifdef EXTERNAL_CODECS
-  STDMETHOD(GetNumberOfMethods)(UInt32 *numMethods);
-  STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value);
-  STDMETHOD(CreateDecoder)(UInt32 index, const GUID *interfaceID, void **coder);
-  STDMETHOD(CreateEncoder)(UInt32 index, const GUID *interfaceID, void **coder);
-  #endif
-
-  int GetCodecLibIndex(UInt32 index);
-  bool GetCodecEncoderIsAssigned(UInt32 index);
-  HRESULT GetCodecId(UInt32 index, UInt64 &id);
-  UString GetCodecName(UInt32 index);
-
-  HRESULT CreateInArchive(int formatIndex, CMyComPtr<IInArchive> &archive) const
-  {
-    const CArcInfoEx &ai = Formats[formatIndex];
-    #ifdef EXTERNAL_CODECS
-    if (ai.LibIndex < 0)
-    #endif
-    {
-      archive = ai.CreateInArchive();
-      return S_OK;
-    }
-    #ifdef EXTERNAL_CODECS
-    return CreateArchiveHandler(ai, (void **)&archive, false);
-    #endif
-  }
-  HRESULT CreateOutArchive(int formatIndex, CMyComPtr<IOutArchive> &archive) const
-  {
-    const CArcInfoEx &ai = Formats[formatIndex];
-    #ifdef EXTERNAL_CODECS
-    if (ai.LibIndex < 0)
-    #endif
-    {
-      archive = ai.CreateOutArchive();
-      return S_OK;
-    }
-    #ifdef EXTERNAL_CODECS
-    return CreateArchiveHandler(ai, (void **)&archive, true);
-    #endif
-  }
-  int FindOutFormatFromName(const UString &name) const
-  {
-    for (int i = 0; i < Formats.Size(); i++)
-    {
-      const CArcInfoEx &arc = Formats[i];
-      if (!arc.UpdateEnabled)
-        continue;
-      if (arc.Name.CompareNoCase(name) == 0)
-        return i;
-    }
-    return -1;
-  }
-
-  #ifdef EXTERNAL_CODECS
-  HRESULT CreateCoder(const UString &name, bool encode, CMyComPtr<ICompressCoder> &coder) const;
-  #endif
-
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/OpenArchive.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/OpenArchive.cpp
deleted file mode 100644
index 364ddff..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/OpenArchive.cpp
+++ /dev/null
@@ -1,550 +0,0 @@
-// OpenArchive.cpp
-
-#include "StdAfx.h"
-
-#include "OpenArchive.h"
-
-#include "Common/Wildcard.h"
-
-#include "Windows/FileName.h"
-#include "Windows/FileDir.h"
-#include "Windows/Defs.h"
-#include "Windows/PropVariant.h"
-
-#include "../../Common/FileStreams.h"
-#include "../../Common/StreamUtils.h"
-
-#include "Common/StringConvert.h"
-
-#include "DefaultName.h"
-
-using namespace NWindows;
-
-HRESULT GetArchiveItemPath(IInArchive *archive, UInt32 index, UString &result)
-{
-  NCOM::CPropVariant prop;
-  RINOK(archive->GetProperty(index, kpidPath, &prop));
-  if(prop.vt == VT_BSTR)
-    result = prop.bstrVal;
-  else if (prop.vt == VT_EMPTY)
-    result.Empty();
-  else
-    return E_FAIL;
-  return S_OK;
-}
-
-HRESULT GetArchiveItemPath(IInArchive *archive, UInt32 index, const UString &defaultName, UString &result)
-{
-  RINOK(GetArchiveItemPath(archive, index, result));
-  if (result.IsEmpty())
-  {
-    result = defaultName;
-    NCOM::CPropVariant prop;
-    RINOK(archive->GetProperty(index, kpidExtension, &prop));
-    if (prop.vt == VT_BSTR)
-    {
-      result += L'.';
-      result += prop.bstrVal;
-    }
-    else if (prop.vt != VT_EMPTY)
-      return E_FAIL;
-  }
-  return S_OK;
-}
-
-HRESULT GetArchiveItemFileTime(IInArchive *archive, UInt32 index,
-    const FILETIME &defaultFileTime, FILETIME &fileTime)
-{
-  NCOM::CPropVariant prop;
-  RINOK(archive->GetProperty(index, kpidMTime, &prop));
-  if (prop.vt == VT_FILETIME)
-    fileTime = prop.filetime;
-  else if (prop.vt == VT_EMPTY)
-    fileTime = defaultFileTime;
-  else
-    return E_FAIL;
-  return S_OK;
-}
-
-HRESULT IsArchiveItemProp(IInArchive *archive, UInt32 index, PROPID propID, bool &result)
-{
-  NCOM::CPropVariant prop;
-  RINOK(archive->GetProperty(index, propID, &prop));
-  if(prop.vt == VT_BOOL)
-    result = VARIANT_BOOLToBool(prop.boolVal);
-  else if (prop.vt == VT_EMPTY)
-    result = false;
-  else
-    return E_FAIL;
-  return S_OK;
-}
-
-HRESULT IsArchiveItemFolder(IInArchive *archive, UInt32 index, bool &result)
-{
-  return IsArchiveItemProp(archive, index, kpidIsDir, result);
-}
-
-HRESULT IsArchiveItemAnti(IInArchive *archive, UInt32 index, bool &result)
-{
-  return IsArchiveItemProp(archive, index, kpidIsAnti, result);
-}
-
-// Static-SFX (for Linux) can be big.
-const UInt64 kMaxCheckStartPosition = 1 << 22;
-
-HRESULT ReOpenArchive(IInArchive *archive, const UString &fileName, IArchiveOpenCallback *openArchiveCallback)
-{
-  CInFileStream *inStreamSpec = new CInFileStream;
-  CMyComPtr<IInStream> inStream(inStreamSpec);
-  inStreamSpec->Open(fileName);
-  return archive->Open(inStream, &kMaxCheckStartPosition, openArchiveCallback);
-}
-
-#ifndef _SFX
-static inline bool TestSignature(const Byte *p1, const Byte *p2, size_t size)
-{
-  for (size_t i = 0; i < size; i++)
-    if (p1[i] != p2[i])
-      return false;
-  return true;
-}
-#endif
-
-HRESULT OpenArchive(
-    CCodecs *codecs,
-    int arcTypeIndex,
-    IInStream *inStream,
-    const UString &fileName,
-    IInArchive **archiveResult,
-    int &formatIndex,
-    UString &defaultItemName,
-    IArchiveOpenCallback *openArchiveCallback)
-{
-  *archiveResult = NULL;
-  UString extension;
-  {
-    int dotPos = fileName.ReverseFind(L'.');
-    if (dotPos >= 0)
-      extension = fileName.Mid(dotPos + 1);
-  }
-  CIntVector orderIndices;
-  if (arcTypeIndex >= 0)
-    orderIndices.Add(arcTypeIndex);
-  else
-  {
-
-  int i;
-  int numFinded = 0;
-  for (i = 0; i < codecs->Formats.Size(); i++)
-    if (codecs->Formats[i].FindExtension(extension) >= 0)
-      orderIndices.Insert(numFinded++, i);
-    else
-      orderIndices.Add(i);
-  
-  #ifndef _SFX
-  if (numFinded != 1)
-  {
-    CIntVector orderIndices2;
-    CByteBuffer byteBuffer;
-    const size_t kBufferSize = (1 << 21);
-    byteBuffer.SetCapacity(kBufferSize);
-    RINOK(inStream->Seek(0, STREAM_SEEK_SET, NULL));
-    size_t processedSize = kBufferSize;
-    RINOK(ReadStream(inStream, byteBuffer, &processedSize));
-    if (processedSize == 0)
-      return S_FALSE;
-
-    const Byte *buf = byteBuffer;
-    Byte hash[1 << 16];
-    memset(hash, 0xFF, 1 << 16);
-    Byte prevs[256];
-    if (orderIndices.Size() > 255)
-      return S_FALSE;
-    int i;
-    for (i = 0; i < orderIndices.Size(); i++)
-    {
-      const CArcInfoEx &ai = codecs->Formats[orderIndices[i]];
-      const CByteBuffer &sig = ai.StartSignature;
-      if (sig.GetCapacity() < 2)
-        continue;
-      UInt32 v = sig[0] | ((UInt32)sig[1] << 8);
-      prevs[i] = hash[v];
-      hash[v] = (Byte)i;
-    }
-
-    processedSize--;
-    for (UInt32 pos = 0; pos < processedSize; pos++)
-    {
-      for (; pos < processedSize && hash[buf[pos] | ((UInt32)buf[pos + 1] << 8)] == 0xFF; pos++);
-      if (pos == processedSize)
-        break;
-      UInt32 v = buf[pos] | ((UInt32)buf[pos + 1] << 8);
-      Byte *ptr = &hash[v];
-      int i = *ptr;
-      do
-      {
-        int index = orderIndices[i];
-        const CArcInfoEx &ai = codecs->Formats[index];
-        const CByteBuffer &sig = ai.StartSignature;
-        if (sig.GetCapacity() != 0 && pos + sig.GetCapacity() <= processedSize + 1)
-          if (TestSignature(buf + pos, sig, sig.GetCapacity()))
-          {
-            orderIndices2.Add(index);
-            orderIndices[i] = 0xFF;
-            *ptr = prevs[i];
-          }
-        ptr = &prevs[i];
-        i = *ptr;
-      }
-      while (i != 0xFF);
-    }
-    
-    for (i = 0; i < orderIndices.Size(); i++)
-    {
-      int val = orderIndices[i];
-      if (val != 0xFF)
-        orderIndices2.Add(val);
-    }
-    orderIndices = orderIndices2;
-
-    if (orderIndices.Size() >= 2)
-    {
-      int isoIndex = codecs->FindFormatForArchiveType(L"iso");
-      int udfIndex = codecs->FindFormatForArchiveType(L"udf");
-      int iIso = -1;
-      int iUdf = -1;
-      for (int i = 0; i < orderIndices.Size(); i++)
-      {
-        if (orderIndices[i] == isoIndex) iIso = i;
-        if (orderIndices[i] == udfIndex) iUdf = i;
-      }
-      if (iUdf == iIso + 1)
-      {
-        orderIndices[iUdf] = isoIndex;
-        orderIndices[iIso] = udfIndex;
-      }
-    }
-  }
-  else if (extension == L"000" || extension == L"001")
-  {
-    CByteBuffer byteBuffer;
-    const size_t kBufferSize = (1 << 10);
-    byteBuffer.SetCapacity(kBufferSize);
-    Byte *buffer = byteBuffer;
-    RINOK(inStream->Seek(0, STREAM_SEEK_SET, NULL));
-    size_t processedSize = kBufferSize;
-    RINOK(ReadStream(inStream, buffer, &processedSize));
-    if (processedSize >= 16)
-    {
-      Byte kRarHeader[] = {0x52 , 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00};
-      if (TestSignature(buffer, kRarHeader, 7) && buffer[9] == 0x73 && (buffer[10] & 1) != 0)
-      {
-        for (int i = 0; i < orderIndices.Size(); i++)
-        {
-          int index = orderIndices[i];
-          const CArcInfoEx &ai = codecs->Formats[index];
-          if (ai.Name.CompareNoCase(L"rar") != 0)
-            continue;
-          orderIndices.Delete(i--);
-          orderIndices.Insert(0, index);
-          break;
-        }
-      }
-    }
-  }
-  #endif
-  }
-
-  for(int i = 0; i < orderIndices.Size(); i++)
-  {
-    inStream->Seek(0, STREAM_SEEK_SET, NULL);
-
-    CMyComPtr<IInArchive> archive;
-
-    formatIndex = orderIndices[i];
-    RINOK(codecs->CreateInArchive(formatIndex, archive));
-    if (!archive)
-      continue;
-
-    #ifdef EXTERNAL_CODECS
-    {
-      CMyComPtr<ISetCompressCodecsInfo> setCompressCodecsInfo;
-      archive.QueryInterface(IID_ISetCompressCodecsInfo, (void **)&setCompressCodecsInfo);
-      if (setCompressCodecsInfo)
-      {
-        RINOK(setCompressCodecsInfo->SetCompressCodecsInfo(codecs));
-      }
-    }
-    #endif
-
-    HRESULT result = archive->Open(inStream, &kMaxCheckStartPosition, openArchiveCallback);
-    if (result == S_FALSE)
-      continue;
-    RINOK(result);
-    *archiveResult = archive.Detach();
-    const CArcInfoEx &format = codecs->Formats[formatIndex];
-    if (format.Exts.Size() == 0)
-    {
-      defaultItemName = GetDefaultName2(fileName, L"", L"");
-    }
-    else
-    {
-      int subExtIndex = format.FindExtension(extension);
-      if (subExtIndex < 0)
-        subExtIndex = 0;
-      defaultItemName = GetDefaultName2(fileName,
-          format.Exts[subExtIndex].Ext,
-          format.Exts[subExtIndex].AddExt);
-    }
-    return S_OK;
-  }
-  return S_FALSE;
-}
-
-HRESULT OpenArchive(
-    CCodecs *codecs,
-    int arcTypeIndex,
-    const UString &filePath,
-    IInArchive **archiveResult,
-    int &formatIndex,
-    UString &defaultItemName,
-    IArchiveOpenCallback *openArchiveCallback)
-{
-  CInFileStream *inStreamSpec = new CInFileStream;
-  CMyComPtr<IInStream> inStream(inStreamSpec);
-  if (!inStreamSpec->Open(filePath))
-    return GetLastError();
-  return OpenArchive(codecs, arcTypeIndex, inStream, ExtractFileNameFromPath(filePath),
-    archiveResult, formatIndex,
-    defaultItemName, openArchiveCallback);
-}
-
-static void MakeDefaultName(UString &name)
-{
-  int dotPos = name.ReverseFind(L'.');
-  if (dotPos < 0)
-    return;
-  UString ext = name.Mid(dotPos + 1);
-  if (ext.IsEmpty())
-    return;
-  for (int pos = 0; pos < ext.Length(); pos++)
-    if (ext[pos] < L'0' || ext[pos] > L'9')
-      return;
-  name = name.Left(dotPos);
-}
-
-HRESULT OpenArchive(
-    CCodecs *codecs,
-    const CIntVector &formatIndices,
-    const UString &fileName,
-    IInArchive **archive0,
-    IInArchive **archive1,
-    int &formatIndex0,
-    int &formatIndex1,
-    UString &defaultItemName0,
-    UString &defaultItemName1,
-    IArchiveOpenCallback *openArchiveCallback)
-{
-  if (formatIndices.Size() >= 3)
-    return E_NOTIMPL;
-  
-  int arcTypeIndex = -1;
-  if (formatIndices.Size() >= 1)
-    arcTypeIndex = formatIndices[formatIndices.Size() - 1];
-  
-  HRESULT result = OpenArchive(codecs, arcTypeIndex, fileName,
-    archive0, formatIndex0, defaultItemName0, openArchiveCallback);
-  RINOK(result);
-
-  if (formatIndices.Size() == 1)
-    return S_OK;
-  arcTypeIndex = -1;
-  if (formatIndices.Size() >= 2)
-    arcTypeIndex = formatIndices[formatIndices.Size() - 2];
-
-  HRESULT resSpec = (formatIndices.Size() == 0 ? S_OK : E_NOTIMPL);
-
-  CMyComPtr<IInArchiveGetStream> getStream;
-  result = (*archive0)->QueryInterface(IID_IInArchiveGetStream, (void **)&getStream);
-  if (result != S_OK || !getStream)
-    return resSpec;
-
-  CMyComPtr<ISequentialInStream> subSeqStream;
-  result = getStream->GetStream(0, &subSeqStream);
-  if (result != S_OK || !subSeqStream)
-    return resSpec;
-
-  CMyComPtr<IInStream> subStream;
-  result = subSeqStream.QueryInterface(IID_IInStream, &subStream);
-  if (result != S_OK || !subStream)
-    return resSpec;
-
-  UInt32 numItems;
-  RINOK((*archive0)->GetNumberOfItems(&numItems));
-  if (numItems < 1)
-    return resSpec;
-
-  UString subPath;
-  RINOK(GetArchiveItemPath(*archive0, 0, subPath))
-  if (subPath.IsEmpty())
-  {
-    MakeDefaultName(defaultItemName0);
-    subPath = defaultItemName0;
-    const CArcInfoEx &format = codecs->Formats[formatIndex0];
-    if (format.Name.CompareNoCase(L"7z") == 0)
-    {
-      if (subPath.Right(3).CompareNoCase(L".7z") != 0)
-        subPath += L".7z";
-    }
-  }
-  else
-    subPath = ExtractFileNameFromPath(subPath);
-
-  CMyComPtr<IArchiveOpenSetSubArchiveName> setSubArchiveName;
-  openArchiveCallback->QueryInterface(IID_IArchiveOpenSetSubArchiveName, (void **)&setSubArchiveName);
-  if (setSubArchiveName)
-    setSubArchiveName->SetSubArchiveName(subPath);
-
-  result = OpenArchive(codecs, arcTypeIndex, subStream, subPath,
-      archive1, formatIndex1, defaultItemName1, openArchiveCallback);
-  resSpec = (formatIndices.Size() == 0 ? S_OK : S_FALSE);
-  if (result != S_OK)
-    return resSpec;
-  return S_OK;
-}
-
-static void SetCallback(const UString &archiveName,
-    IOpenCallbackUI *openCallbackUI,
-    IArchiveOpenCallback *reOpenCallback,
-    CMyComPtr<IArchiveOpenCallback> &openCallback)
-{
-  COpenCallbackImp *openCallbackSpec = new COpenCallbackImp;
-  openCallback = openCallbackSpec;
-  openCallbackSpec->Callback = openCallbackUI;
-  openCallbackSpec->ReOpenCallback = reOpenCallback;
-
-  UString fullName;
-  int fileNamePartStartIndex;
-  NFile::NDirectory::MyGetFullPathName(archiveName, fullName, fileNamePartStartIndex);
-  openCallbackSpec->Init(
-      fullName.Left(fileNamePartStartIndex),
-      fullName.Mid(fileNamePartStartIndex));
-}
-
-HRESULT MyOpenArchive(
-    CCodecs *codecs,
-    int arcTypeIndex,
-    const UString &archiveName,
-    IInArchive **archive, UString &defaultItemName, IOpenCallbackUI *openCallbackUI)
-{
-  CMyComPtr<IArchiveOpenCallback> openCallback;
-  SetCallback(archiveName, openCallbackUI, NULL, openCallback);
-  int formatInfo;
-  return OpenArchive(codecs, arcTypeIndex, archiveName, archive, formatInfo, defaultItemName, openCallback);
-}
-
-HRESULT MyOpenArchive(
-    CCodecs *codecs,
-    const CIntVector &formatIndices,
-    const UString &archiveName,
-    IInArchive **archive0,
-    IInArchive **archive1,
-    UString &defaultItemName0,
-    UString &defaultItemName1,
-    UStringVector &volumePaths,
-    UInt64 &volumesSize,
-    IOpenCallbackUI *openCallbackUI)
-{
-  volumesSize = 0;
-  COpenCallbackImp *openCallbackSpec = new COpenCallbackImp;
-  CMyComPtr<IArchiveOpenCallback> openCallback = openCallbackSpec;
-  openCallbackSpec->Callback = openCallbackUI;
-
-  UString fullName;
-  int fileNamePartStartIndex;
-  NFile::NDirectory::MyGetFullPathName(archiveName, fullName, fileNamePartStartIndex);
-  UString prefix = fullName.Left(fileNamePartStartIndex);
-  UString name = fullName.Mid(fileNamePartStartIndex);
-  openCallbackSpec->Init(prefix, name);
-
-  int formatIndex0, formatIndex1;
-  RINOK(OpenArchive(codecs, formatIndices, archiveName,
-      archive0,
-      archive1,
-      formatIndex0,
-      formatIndex1,
-      defaultItemName0,
-      defaultItemName1,
-      openCallback));
-  volumePaths.Add(prefix + name);
-  for (int i = 0; i < openCallbackSpec->FileNames.Size(); i++)
-    volumePaths.Add(prefix + openCallbackSpec->FileNames[i]);
-  volumesSize = openCallbackSpec->TotalSize;
-  return S_OK;
-}
-
-HRESULT CArchiveLink::Close()
-{
-  if (Archive1 != 0)
-    RINOK(Archive1->Close());
-  if (Archive0 != 0)
-    RINOK(Archive0->Close());
-  IsOpen = false;
-  return S_OK;
-}
-
-void CArchiveLink::Release()
-{
-  IsOpen = false;
-  Archive1.Release();
-  Archive0.Release();
-}
-
-HRESULT OpenArchive(
-    CCodecs *codecs,
-    const CIntVector &formatIndices,
-    const UString &archiveName,
-    CArchiveLink &archiveLink,
-    IArchiveOpenCallback *openCallback)
-{
-  HRESULT res = OpenArchive(codecs, formatIndices, archiveName,
-    &archiveLink.Archive0, &archiveLink.Archive1,
-    archiveLink.FormatIndex0, archiveLink.FormatIndex1,
-    archiveLink.DefaultItemName0, archiveLink.DefaultItemName1,
-    openCallback);
-  archiveLink.IsOpen = (res == S_OK);
-  return res;
-}
-
-HRESULT MyOpenArchive(CCodecs *codecs,
-    const CIntVector &formatIndices,
-    const UString &archiveName,
-    CArchiveLink &archiveLink,
-    IOpenCallbackUI *openCallbackUI)
-{
-  HRESULT res = MyOpenArchive(codecs, formatIndices, archiveName,
-    &archiveLink.Archive0, &archiveLink.Archive1,
-    archiveLink.DefaultItemName0, archiveLink.DefaultItemName1,
-    archiveLink.VolumePaths,
-    archiveLink.VolumesSize,
-    openCallbackUI);
-  archiveLink.IsOpen = (res == S_OK);
-  return res;
-}
-
-HRESULT ReOpenArchive(CCodecs *codecs, CArchiveLink &archiveLink, const UString &fileName,
-    IArchiveOpenCallback *openCallback)
-{
-  if (archiveLink.GetNumLevels() > 1)
-    return E_NOTIMPL;
-
-  if (archiveLink.GetNumLevels() == 0)
-    return MyOpenArchive(codecs, CIntVector(), fileName, archiveLink, 0);
-
-  CMyComPtr<IArchiveOpenCallback> openCallbackNew;
-  SetCallback(fileName, NULL, openCallback, openCallbackNew);
-
-  HRESULT res = ReOpenArchive(archiveLink.GetArchive(), fileName, openCallbackNew);
-  archiveLink.IsOpen = (res == S_OK);
-  return res;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/OpenArchive.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/OpenArchive.h
deleted file mode 100644
index f1b4fda..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/OpenArchive.h
+++ /dev/null
@@ -1,117 +0,0 @@
-// OpenArchive.h
-
-#ifndef __OPENARCHIVE_H
-#define __OPENARCHIVE_H
-
-#include "Common/MyString.h"
-#include "Windows/FileFind.h"
-
-#include "../../Archive/IArchive.h"
-#include "LoadCodecs.h"
-#include "ArchiveOpenCallback.h"
-
-HRESULT GetArchiveItemPath(IInArchive *archive, UInt32 index, UString &result);
-HRESULT GetArchiveItemPath(IInArchive *archive, UInt32 index, const UString &defaultName, UString &result);
-HRESULT GetArchiveItemFileTime(IInArchive *archive, UInt32 index,
-    const FILETIME &defaultFileTime, FILETIME &fileTime);
-HRESULT IsArchiveItemProp(IInArchive *archive, UInt32 index, PROPID propID, bool &result);
-HRESULT IsArchiveItemFolder(IInArchive *archive, UInt32 index, bool &result);
-HRESULT IsArchiveItemAnti(IInArchive *archive, UInt32 index, bool &result);
-
-struct ISetSubArchiveName
-{
-  virtual void SetSubArchiveName(const wchar_t *name) = 0;
-};
-
-HRESULT OpenArchive(
-    CCodecs *codecs,
-    int arcTypeIndex,
-    IInStream *inStream,
-    const UString &fileName,
-    IInArchive **archiveResult,
-    int &formatIndex,
-    UString &defaultItemName,
-    IArchiveOpenCallback *openArchiveCallback);
-
-HRESULT OpenArchive(
-    CCodecs *codecs,
-    int arcTypeIndex,
-    const UString &filePath,
-    IInArchive **archive,
-    int &formatIndex,
-    UString &defaultItemName,
-    IArchiveOpenCallback *openArchiveCallback);
-
-HRESULT OpenArchive(
-    CCodecs *codecs,
-    const CIntVector &formatIndices,
-    const UString &filePath,
-    IInArchive **archive0,
-    IInArchive **archive1,
-    int &formatIndex0,
-    int &formatIndex1,
-    UString &defaultItemName0,
-    UString &defaultItemName1,
-    IArchiveOpenCallback *openArchiveCallback);
-
-
-HRESULT ReOpenArchive(IInArchive *archive, const UString &fileName, IArchiveOpenCallback *openArchiveCallback);
-
-struct CArchiveLink
-{
-  CMyComPtr<IInArchive> Archive0;
-  CMyComPtr<IInArchive> Archive1;
-  UString DefaultItemName0;
-  UString DefaultItemName1;
-
-  int FormatIndex0;
-  int FormatIndex1;
-  
-  UStringVector VolumePaths;
-
-  bool IsOpen;
-  UInt64 VolumesSize;
-
-  int GetNumLevels() const
-  {
-    int result = 0;
-    if (Archive0)
-    {
-      result++;
-      if (Archive1)
-        result++;
-    }
-    return result;
-  }
-
-  CArchiveLink(): IsOpen(false), VolumesSize(0) {};
-
-  IInArchive *GetArchive() { return Archive1 != 0 ? Archive1: Archive0; }
-  UString GetDefaultItemName()  { return Archive1 != 0 ? DefaultItemName1: DefaultItemName0; }
-  int GetArchiverIndex() const { return Archive1 != 0 ? FormatIndex1: FormatIndex0; }
-  HRESULT Close();
-  void Release();
-};
-
-HRESULT OpenArchive(
-    CCodecs *codecs,
-    const CIntVector &formatIndices,
-    const UString &archiveName,
-    CArchiveLink &archiveLink,
-    IArchiveOpenCallback *openCallback);
-
-HRESULT MyOpenArchive(
-    CCodecs *codecs,
-    const CIntVector &formatIndices,
-    const UString &archiveName,
-    CArchiveLink &archiveLink,
-    IOpenCallbackUI *openCallbackUI);
-
-HRESULT ReOpenArchive(
-    CCodecs *codecs,
-    CArchiveLink &archiveLink,
-    const UString &fileName,
-    IArchiveOpenCallback *openCallback);
-
-#endif
-
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/PropIDUtils.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/PropIDUtils.cpp
deleted file mode 100644
index bf11ea1..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/PropIDUtils.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-// PropIDUtils.cpp
-
-#include "StdAfx.h"
-
-#include "PropIDUtils.h"
-
-#include "Common/IntToString.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/FileFind.h"
-#include "Windows/PropVariantConversions.h"
-
-#include "../../PropID.h"
-
-using namespace NWindows;
-
-static UString ConvertUInt32ToString(UInt32 value)
-{
-  wchar_t buffer[32];
-  ConvertUInt64ToString(value, buffer);
-  return buffer;
-}
-
-static void ConvertUInt32ToHex(UInt32 value, wchar_t *s)
-{
-  for (int i = 0; i < 8; i++)
-  {
-    int t = value & 0xF;
-    value >>= 4;
-    s[7 - i] = (wchar_t)((t < 10) ? (L'0' + t) : (L'A' + (t - 10)));
-  }
-  s[8] = L'\0';
-}
-
-UString ConvertPropertyToString(const PROPVARIANT &propVariant, PROPID propID, bool full)
-{
-  switch(propID)
-  {
-    case kpidCTime:
-    case kpidATime:
-    case kpidMTime:
-    {
-      if (propVariant.vt != VT_FILETIME)
-        return UString(); // It is error;
-      FILETIME localFileTime;
-      if (propVariant.filetime.dwHighDateTime == 0 &&
-          propVariant.filetime.dwLowDateTime == 0)
-        return UString();
-      if (!::FileTimeToLocalFileTime(&propVariant.filetime, &localFileTime))
-        return UString(); // It is error;
-      return ConvertFileTimeToString(localFileTime, true, full);
-    }
-    case kpidCRC:
-    {
-      if(propVariant.vt != VT_UI4)
-        break;
-      wchar_t temp[12];
-      ConvertUInt32ToHex(propVariant.ulVal, temp);
-      return temp;
-    }
-    case kpidAttrib:
-    {
-      if(propVariant.vt != VT_UI4)
-        break;
-      UString result;
-      UInt32 attributes = propVariant.ulVal;
-      if (NFile::NFind::NAttributes::IsReadOnly(attributes)) result += L'R';
-      if (NFile::NFind::NAttributes::IsHidden(attributes)) result += L'H';
-      if (NFile::NFind::NAttributes::IsSystem(attributes)) result += L'S';
-      if (NFile::NFind::NAttributes::IsDir(attributes)) result += L'D';
-      if (NFile::NFind::NAttributes::IsArchived(attributes)) result += L'A';
-      if (NFile::NFind::NAttributes::IsCompressed(attributes)) result += L'C';
-      if (NFile::NFind::NAttributes::IsEncrypted(attributes)) result += L'E';
-      return result;
-    }
-    case kpidDictionarySize:
-    {
-      if(propVariant.vt != VT_UI4)
-        break;
-      UInt32 size = propVariant.ulVal;
-      if (size % (1 << 20) == 0)
-        return ConvertUInt32ToString(size >> 20) + L"MB";
-      if (size % (1 << 10) == 0)
-        return ConvertUInt32ToString(size >> 10) + L"KB";
-      return ConvertUInt32ToString(size);
-    }
-  }
-  return ConvertPropVariantToString(propVariant);
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/PropIDUtils.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/PropIDUtils.h
deleted file mode 100644
index 1d82097..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/PropIDUtils.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// PropIDUtils.h
-
-#ifndef __PROPIDUTILS_H
-#define __PROPIDUTILS_H
-
-#include "Common/MyString.h"
-
-UString ConvertPropertyToString(const PROPVARIANT &propVariant, PROPID propID, bool full = true);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/Property.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/Property.h
deleted file mode 100644
index 9fd340c..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/Property.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// Property.h
-
-#ifndef __PROPERTY_H
-#define __PROPERTY_H
-
-#include "Common/MyString.h"
-
-struct CProperty
-{
-  UString Name;
-  UString Value;
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/SetProperties.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/SetProperties.cpp
deleted file mode 100644
index 4827f2a..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/SetProperties.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-// SetProperties.cpp
-
-#include "StdAfx.h"
-
-#include "SetProperties.h"
-
-#include "Windows/PropVariant.h"
-#include "Common/MyString.h"
-#include "Common/StringToInt.h"
-#include "Common/MyCom.h"
-
-#include "../../Archive/IArchive.h"
-
-using namespace NWindows;
-using namespace NCOM;
-
-static void ParseNumberString(const UString &s, NCOM::CPropVariant &prop)
-{
-  const wchar_t *endPtr;
-  UInt64 result = ConvertStringToUInt64(s, &endPtr);
-  if (endPtr - (const wchar_t *)s != s.Length())
-    prop = s;
-  else if (result <= 0xFFFFFFFF)
-    prop = (UInt32)result;
-  else
-    prop = result;
-}
-
-HRESULT SetProperties(IUnknown *unknown, const CObjectVector<CProperty> &properties)
-{
-  if (properties.IsEmpty())
-    return S_OK;
-  CMyComPtr<ISetProperties> setProperties;
-  unknown->QueryInterface(IID_ISetProperties, (void **)&setProperties);
-  if (!setProperties)
-    return S_OK;
-
-  UStringVector realNames;
-  CPropVariant *values = new CPropVariant[properties.Size()];
-  try
-  {
-    int i;
-    for(i = 0; i < properties.Size(); i++)
-    {
-      const CProperty &property = properties[i];
-      NCOM::CPropVariant propVariant;
-      UString name = property.Name;
-      if (property.Value.IsEmpty())
-      {
-        if (!name.IsEmpty())
-        {
-          wchar_t c = name[name.Length() - 1];
-          if (c == L'-')
-            propVariant = false;
-          else if (c == L'+')
-            propVariant = true;
-          if (propVariant.vt != VT_EMPTY)
-            name = name.Left(name.Length() - 1);
-        }
-      }
-      else
-        ParseNumberString(property.Value, propVariant);
-      realNames.Add(name);
-      values[i] = propVariant;
-    }
-    CRecordVector<const wchar_t *> names;
-    for(i = 0; i < realNames.Size(); i++)
-      names.Add((const wchar_t *)realNames[i]);
-    
-    RINOK(setProperties->SetProperties(&names.Front(), values, names.Size()));
-  }
-  catch(...)
-  {
-    delete []values;
-    throw;
-  }
-  delete []values;
-  return S_OK;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/SetProperties.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/SetProperties.h
deleted file mode 100644
index 892f1a2..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/SetProperties.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// SetProperties.h
-
-#ifndef __SETPROPERTIES_H
-#define __SETPROPERTIES_H
-
-#include "Property.h"
-
-HRESULT SetProperties(IUnknown *unknown, const CObjectVector<CProperty> &properties);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/SortUtils.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/SortUtils.cpp
deleted file mode 100644
index 061e777..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/SortUtils.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// SortUtils.cpp
-
-#include "StdAfx.h"
-
-#include "SortUtils.h"
-#include "Common/Wildcard.h"
-
-static int CompareStrings(const int *p1, const int *p2, void *param)
-{
-  const UStringVector &strings = *(const UStringVector *)param;
-  return CompareFileNames(strings[*p1], strings[*p2]);
-}
-
-void SortFileNames(const UStringVector &strings, CIntVector &indices)
-{
-  indices.Clear();
-  int numItems = strings.Size();
-  indices.Reserve(numItems);
-  for(int i = 0; i < numItems; i++)
-    indices.Add(i);
-  indices.Sort(CompareStrings, (void *)&strings);
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/SortUtils.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/SortUtils.h
deleted file mode 100644
index e152246..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/SortUtils.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// SortUtils.h
-
-#ifndef __SORTUTLS_H
-#define __SORTUTLS_H
-
-#include "Common/MyString.h"
-
-void SortFileNames(const UStringVector &strings, CIntVector &indices);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/StdAfx.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/StdAfx.h
deleted file mode 100644
index 9a8e7d2..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/StdAfx.h
+++ /dev/null
@@ -1,9 +0,0 @@
-// stdafx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-#include "../../../Common/NewHandler.h"
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/TempFiles.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/TempFiles.cpp
deleted file mode 100644
index eeaec18..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/TempFiles.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// TempFiles.cpp
-
-#include "StdAfx.h"
-
-#include "TempFiles.h"
-
-#include "Windows/FileDir.h"
-#include "Windows/FileIO.h"
-
-using namespace NWindows;
-using namespace NFile;
-
-void CTempFiles::Clear()
-{
-  while(!Paths.IsEmpty())
-  {
-    NDirectory::DeleteFileAlways((LPCWSTR)Paths.Back());
-    Paths.DeleteBack();
-  }
-}
-
-
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/TempFiles.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/TempFiles.h
deleted file mode 100644
index eb474a7..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/TempFiles.h
+++ /dev/null
@@ -1,16 +0,0 @@
-// TempFiles.h
-
-#ifndef __TEMPFILES_H
-#define __TEMPFILES_H
-
-#include "Common/MyString.h"
-
-class CTempFiles
-{
-  void Clear();
-public:
-  UStringVector Paths;
-  ~CTempFiles() { Clear(); }
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/Update.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/Update.cpp
deleted file mode 100644
index d8fee28..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/Update.cpp
+++ /dev/null
@@ -1,911 +0,0 @@
-// Update.cpp
-
-#include "StdAfx.h"
-
-#include "Update.h"
-
-#include "Common/IntToString.h"
-#include "Common/StringConvert.h"
-
-#ifdef _WIN32
-#include "Windows/DLL.h"
-#endif
-
-#include "Windows/FileDir.h"
-#include "Windows/FileFind.h"
-#include "Windows/FileName.h"
-#include "Windows/PropVariant.h"
-#include "Windows/PropVariantConversions.h"
-#include "Windows/Time.h"
-
-#include "../../Common/FileStreams.h"
-
-#include "../../Compress/CopyCoder.h"
-
-#include "../Common/DirItem.h"
-#include "../Common/EnumDirItems.h"
-#include "../Common/OpenArchive.h"
-#include "../Common/UpdateProduce.h"
-
-#include "EnumDirItems.h"
-#include "SetProperties.h"
-#include "TempFiles.h"
-#include "UpdateCallback.h"
-
-static const char *kUpdateIsNotSupoorted =
-  "update operations are not supported for this archive";
-
-using namespace NWindows;
-using namespace NCOM;
-using namespace NFile;
-using namespace NName;
-
-static const wchar_t *kTempFolderPrefix = L"7zE";
-
-using namespace NUpdateArchive;
-
-static HRESULT CopyBlock(ISequentialInStream *inStream, ISequentialOutStream *outStream)
-{
-  CMyComPtr<ICompressCoder> copyCoder = new NCompress::CCopyCoder;
-  return copyCoder->Code(inStream, outStream, NULL, NULL, NULL);
-}
-
-class COutMultiVolStream:
-  public IOutStream,
-  public CMyUnknownImp
-{
-  int _streamIndex; // required stream
-  UInt64 _offsetPos; // offset from start of _streamIndex index
-  UInt64 _absPos;
-  UInt64 _length;
-
-  struct CSubStreamInfo
-  {
-    COutFileStream *StreamSpec;
-    CMyComPtr<IOutStream> Stream;
-    UString Name;
-    UInt64 Pos;
-    UInt64 RealSize;
-  };
-  CObjectVector<CSubStreamInfo> Streams;
-public:
-  // CMyComPtr<IArchiveUpdateCallback2> VolumeCallback;
-  CRecordVector<UInt64> Sizes;
-  UString Prefix;
-  CTempFiles *TempFiles;
-
-  void Init()
-  {
-    _streamIndex = 0;
-    _offsetPos = 0;
-    _absPos = 0;
-    _length = 0;
-  }
-
-  HRESULT Close();
-
-  MY_UNKNOWN_IMP1(IOutStream)
-
-  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-  STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
-  STDMETHOD(SetSize)(Int64 newSize);
-};
-
-// static NSynchronization::CCriticalSection g_TempPathsCS;
-
-HRESULT COutMultiVolStream::Close()
-{
-  HRESULT res = S_OK;
-  for (int i = 0; i < Streams.Size(); i++)
-  {
-    CSubStreamInfo &s = Streams[i];
-    if (s.StreamSpec)
-    {
-      HRESULT res2 = s.StreamSpec->Close();
-      if (res2 != S_OK)
-        res = res2;
-    }
-  }
-  return res;
-}
-
-STDMETHODIMP COutMultiVolStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
-  if(processedSize != NULL)
-    *processedSize = 0;
-  while(size > 0)
-  {
-    if (_streamIndex >= Streams.Size())
-    {
-      CSubStreamInfo subStream;
-
-      wchar_t temp[32];
-      ConvertUInt64ToString(_streamIndex + 1, temp);
-      UString res = temp;
-      while (res.Length() < 3)
-        res = UString(L'0') + res;
-      UString name = Prefix + res;
-      subStream.StreamSpec = new COutFileStream;
-      subStream.Stream = subStream.StreamSpec;
-      if(!subStream.StreamSpec->Create(name, false))
-        return ::GetLastError();
-      {
-        // NSynchronization::CCriticalSectionLock lock(g_TempPathsCS);
-        TempFiles->Paths.Add(name);
-      }
-
-      subStream.Pos = 0;
-      subStream.RealSize = 0;
-      subStream.Name = name;
-      Streams.Add(subStream);
-      continue;
-    }
-    CSubStreamInfo &subStream = Streams[_streamIndex];
-
-    int index = _streamIndex;
-    if (index >= Sizes.Size())
-      index = Sizes.Size() - 1;
-    UInt64 volSize = Sizes[index];
-
-    if (_offsetPos >= volSize)
-    {
-      _offsetPos -= volSize;
-      _streamIndex++;
-      continue;
-    }
-    if (_offsetPos != subStream.Pos)
-    {
-      // CMyComPtr<IOutStream> outStream;
-      // RINOK(subStream.Stream.QueryInterface(IID_IOutStream, &outStream));
-      RINOK(subStream.Stream->Seek(_offsetPos, STREAM_SEEK_SET, NULL));
-      subStream.Pos = _offsetPos;
-    }
-
-    UInt32 curSize = (UInt32)MyMin((UInt64)size, volSize - subStream.Pos);
-    UInt32 realProcessed;
-    RINOK(subStream.Stream->Write(data, curSize, &realProcessed));
-    data = (void *)((Byte *)data + realProcessed);
-    size -= realProcessed;
-    subStream.Pos += realProcessed;
-    _offsetPos += realProcessed;
-    _absPos += realProcessed;
-    if (_absPos > _length)
-      _length = _absPos;
-    if (_offsetPos > subStream.RealSize)
-      subStream.RealSize = _offsetPos;
-    if(processedSize != NULL)
-      *processedSize += realProcessed;
-    if (subStream.Pos == volSize)
-    {
-      _streamIndex++;
-      _offsetPos = 0;
-    }
-    if (realProcessed == 0 && curSize != 0)
-      return E_FAIL;
-    break;
-  }
-  return S_OK;
-}
-
-STDMETHODIMP COutMultiVolStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
-{
-  if(seekOrigin >= 3)
-    return STG_E_INVALIDFUNCTION;
-  switch(seekOrigin)
-  {
-    case STREAM_SEEK_SET:
-      _absPos = offset;
-      break;
-    case STREAM_SEEK_CUR:
-      _absPos += offset;
-      break;
-    case STREAM_SEEK_END:
-      _absPos = _length + offset;
-      break;
-  }
-  _offsetPos = _absPos;
-  if (newPosition != NULL)
-    *newPosition = _absPos;
-  _streamIndex = 0;
-  return S_OK;
-}
-
-STDMETHODIMP COutMultiVolStream::SetSize(Int64 newSize)
-{
-  if (newSize < 0)
-    return E_INVALIDARG;
-  int i = 0;
-  while (i < Streams.Size())
-  {
-    CSubStreamInfo &subStream = Streams[i++];
-    if ((UInt64)newSize < subStream.RealSize)
-    {
-      RINOK(subStream.Stream->SetSize(newSize));
-      subStream.RealSize = newSize;
-      break;
-    }
-    newSize -= subStream.RealSize;
-  }
-  while (i < Streams.Size())
-  {
-    {
-      CSubStreamInfo &subStream = Streams.Back();
-      subStream.Stream.Release();
-      NDirectory::DeleteFileAlways(subStream.Name);
-    }
-    Streams.DeleteBack();
-  }
-  _offsetPos = _absPos;
-  _streamIndex = 0;
-  _length = newSize;
-  return S_OK;
-}
-
-static const wchar_t *kDefaultArchiveType = L"7z";
-static const wchar_t *kSFXExtension =
-  #ifdef _WIN32
-    L"exe";
-  #else
-    L"";
-  #endif
-
-bool CUpdateOptions::Init(const CCodecs *codecs, const CIntVector &formatIndices, const UString &arcPath)
-{
-  if (formatIndices.Size() > 1)
-    return false;
-  int arcTypeIndex = -1;
-  if (formatIndices.Size() != 0)
-    arcTypeIndex = formatIndices[0];
-  if (arcTypeIndex >= 0)
-    MethodMode.FormatIndex = arcTypeIndex;
-  else
-  {
-    MethodMode.FormatIndex = codecs->FindFormatForArchiveName(arcPath);
-    if (MethodMode.FormatIndex < 0)
-      MethodMode.FormatIndex = codecs->FindFormatForArchiveType(kDefaultArchiveType);
-  }
-  if (MethodMode.FormatIndex < 0)
-    return false;
-  const CArcInfoEx &arcInfo = codecs->Formats[MethodMode.FormatIndex];
-  if (!arcInfo.UpdateEnabled)
-    return false;
-  UString typeExt = arcInfo.GetMainExt();
-  UString ext = typeExt;
-  if (SfxMode)
-    ext = kSFXExtension;
-  ArchivePath.BaseExtension = ext;
-  ArchivePath.VolExtension = typeExt;
-  ArchivePath.ParseFromPath(arcPath);
-  for (int i = 0; i < Commands.Size(); i++)
-  {
-    CUpdateArchiveCommand &uc = Commands[i];
-    uc.ArchivePath.BaseExtension = ext;
-    uc.ArchivePath.VolExtension = typeExt;
-    uc.ArchivePath.ParseFromPath(uc.UserArchivePath);
-  }
-  return true;
-}
-
-/*
-struct CUpdateProduceCallbackImp: public IUpdateProduceCallback
-{
-  const CObjectVector<CArcItem> *_arcItems;
-  IUpdateCallbackUI *_callback;
-  
-  CUpdateProduceCallbackImp(const CObjectVector<CArcItem> *a, 
-      IUpdateCallbackUI *callback): _arcItems(a), _callback(callback) {}
-  virtual HRESULT ShowDeleteFile(int arcIndex);
-};
-
-HRESULT CUpdateProduceCallbackImp::ShowDeleteFile(int arcIndex)
-{
-  return _callback->ShowDeleteFile((*_arcItems)[arcIndex].Name);
-}
-*/
-
-static HRESULT Compress(
-    CCodecs *codecs,
-    const CActionSet &actionSet,
-    IInArchive *archive,
-    const CCompressionMethodMode &compressionMethod,
-    CArchivePath &archivePath,
-    const CObjectVector<CArcItem> &arcItems,
-    bool shareForWrite,
-    bool stdInMode,
-    /* const UString & stdInFileName, */
-    bool stdOutMode,
-    const CDirItems &dirItems,
-    bool sfxMode,
-    const UString &sfxModule,
-    const CRecordVector<UInt64> &volumesSizes,
-    CTempFiles &tempFiles,
-    CUpdateErrorInfo &errorInfo,
-    IUpdateCallbackUI *callback)
-{
-  CMyComPtr<IOutArchive> outArchive;
-  if(archive != NULL)
-  {
-    CMyComPtr<IInArchive> archive2 = archive;
-    HRESULT result = archive2.QueryInterface(IID_IOutArchive, &outArchive);
-    if(result != S_OK)
-      throw kUpdateIsNotSupoorted;
-  }
-  else
-  {
-    RINOK(codecs->CreateOutArchive(compressionMethod.FormatIndex, outArchive));
-
-    #ifdef EXTERNAL_CODECS
-    {
-      CMyComPtr<ISetCompressCodecsInfo> setCompressCodecsInfo;
-      outArchive.QueryInterface(IID_ISetCompressCodecsInfo, (void **)&setCompressCodecsInfo);
-      if (setCompressCodecsInfo)
-      {
-        RINOK(setCompressCodecsInfo->SetCompressCodecsInfo(codecs));
-      }
-    }
-    #endif
-  }
-  if (outArchive == 0)
-    throw kUpdateIsNotSupoorted;
-  
-  NFileTimeType::EEnum fileTimeType;
-  UInt32 value;
-  RINOK(outArchive->GetFileTimeType(&value));
-
-  switch(value)
-  {
-    case NFileTimeType::kWindows:
-    case NFileTimeType::kUnix:
-    case NFileTimeType::kDOS:
-      fileTimeType = (NFileTimeType::EEnum)value;
-      break;
-    default:
-      return E_FAIL;
-  }
-
-  CRecordVector<CUpdatePair2> updatePairs2;
-
-  {
-    CRecordVector<CUpdatePair> updatePairs;
-    GetUpdatePairInfoList(dirItems, arcItems, fileTimeType, updatePairs); // must be done only once!!!
-    // CUpdateProduceCallbackImp upCallback(&arcItems, callback);
-    UpdateProduce(updatePairs, actionSet, updatePairs2, NULL /* &upCallback */);
-  }
-
-  UInt32 numFiles = 0;
-  for (int i = 0; i < updatePairs2.Size(); i++)
-    if (updatePairs2[i].NewData)
-      numFiles++;
-  
-  RINOK(callback->SetNumFiles(numFiles));
-
-  
-  CArchiveUpdateCallback *updateCallbackSpec = new CArchiveUpdateCallback;
-  CMyComPtr<IArchiveUpdateCallback> updateCallback(updateCallbackSpec);
-  
-  updateCallbackSpec->ShareForWrite = shareForWrite;
-  updateCallbackSpec->StdInMode = stdInMode;
-  updateCallbackSpec->Callback = callback;
-  updateCallbackSpec->DirItems = &dirItems;
-  updateCallbackSpec->ArcItems = &arcItems;
-  updateCallbackSpec->UpdatePairs = &updatePairs2;
-
-  CMyComPtr<ISequentialOutStream> outStream;
-
-  const UString &archiveName = archivePath.GetFinalPath();
-  if (!stdOutMode)
-  {
-    UString resultPath;
-    int pos;
-    if(!NFile::NDirectory::MyGetFullPathName(archiveName, resultPath, pos))
-      throw 1417161;
-    NFile::NDirectory::CreateComplexDirectory(resultPath.Left(pos));
-  }
-
-  COutFileStream *outStreamSpec = NULL;
-  COutMultiVolStream *volStreamSpec = NULL;
-
-  if (volumesSizes.Size() == 0)
-  {
-    if (stdOutMode)
-      outStream = new CStdOutFileStream;
-    else
-    {
-      outStreamSpec = new COutFileStream;
-      outStream = outStreamSpec;
-      bool isOK = false;
-      UString realPath;
-      for (int i = 0; i < (1 << 16); i++)
-      {
-        if (archivePath.Temp)
-        {
-          if (i > 0)
-          {
-            wchar_t s[32];
-            ConvertUInt64ToString(i, s);
-            archivePath.TempPostfix = s;
-          }
-          realPath = archivePath.GetTempPath();
-        }
-        else
-          realPath = archivePath.GetFinalPath();
-        if (outStreamSpec->Create(realPath, false))
-        {
-          tempFiles.Paths.Add(realPath);
-          isOK = true;
-          break;
-        }
-        if (::GetLastError() != ERROR_FILE_EXISTS)
-          break;
-        if (!archivePath.Temp)
-          break;
-      }
-      if (!isOK)
-      {
-        errorInfo.SystemError = ::GetLastError();
-        errorInfo.FileName = realPath;
-        errorInfo.Message = L"Can not open file";
-        return E_FAIL;
-      }
-    }
-  }
-  else
-  {
-    if (stdOutMode)
-      return E_FAIL;
-    volStreamSpec = new COutMultiVolStream;
-    outStream = volStreamSpec;
-    volStreamSpec->Sizes = volumesSizes;
-    volStreamSpec->Prefix = archivePath.GetFinalPath() + UString(L".");
-    volStreamSpec->TempFiles = &tempFiles;
-    volStreamSpec->Init();
-
-    /*
-    updateCallbackSpec->VolumesSizes = volumesSizes;
-    updateCallbackSpec->VolName = archivePath.Prefix + archivePath.Name;
-    if (!archivePath.VolExtension.IsEmpty())
-      updateCallbackSpec->VolExt = UString(L'.') + archivePath.VolExtension;
-    */
-  }
-
-  RINOK(SetProperties(outArchive, compressionMethod.Properties));
-
-  if (sfxMode)
-  {
-    CInFileStream *sfxStreamSpec = new CInFileStream;
-    CMyComPtr<IInStream> sfxStream(sfxStreamSpec);
-    if (!sfxStreamSpec->Open(sfxModule))
-    {
-      errorInfo.SystemError = ::GetLastError();
-      errorInfo.Message = L"Can't open sfx module";
-      errorInfo.FileName = sfxModule;
-      return E_FAIL;
-    }
-
-    CMyComPtr<ISequentialOutStream> sfxOutStream;
-    COutFileStream *outStreamSpec = NULL;
-    if (volumesSizes.Size() == 0)
-      sfxOutStream = outStream;
-    else
-    {
-      outStreamSpec = new COutFileStream;
-      sfxOutStream = outStreamSpec;
-      UString realPath = archivePath.GetFinalPath();
-      if (!outStreamSpec->Create(realPath, false))
-      {
-        errorInfo.SystemError = ::GetLastError();
-        errorInfo.FileName = realPath;
-        errorInfo.Message = L"Can not open file";
-        return E_FAIL;
-      }
-    }
-    RINOK(CopyBlock(sfxStream, sfxOutStream));
-    if (outStreamSpec)
-    {
-      RINOK(outStreamSpec->Close());
-    }
-  }
-
-  HRESULT result = outArchive->UpdateItems(outStream, updatePairs2.Size(), updateCallback);
-  callback->Finilize();
-  RINOK(result);
-  if (outStreamSpec)
-    result = outStreamSpec->Close();
-  else if (volStreamSpec)
-    result = volStreamSpec->Close();
-  return result;
-}
-
-HRESULT EnumerateInArchiveItems(const NWildcard::CCensor &censor,
-    IInArchive *archive,
-    const UString &defaultItemName,
-    const NWindows::NFile::NFind::CFileInfoW &archiveFileInfo,
-    CObjectVector<CArcItem> &arcItems)
-{
-  arcItems.Clear();
-  UInt32 numItems;
-  RINOK(archive->GetNumberOfItems(&numItems));
-  arcItems.Reserve(numItems);
-  for (UInt32 i = 0; i < numItems; i++)
-  {
-    CArcItem ai;
-
-    RINOK(GetArchiveItemPath(archive, i, ai.Name));
-    // check it: defaultItemName !!!
-    if (ai.Name.IsEmpty())
-      ai.Name = defaultItemName;
-    RINOK(IsArchiveItemFolder(archive, i, ai.IsDir));
-    ai.Censored = censor.CheckPath(ai.Name, !ai.IsDir);
-    RINOK(GetArchiveItemFileTime(archive, i, archiveFileInfo.MTime, ai.MTime));
-
-    {
-      CPropVariant prop;
-      RINOK(archive->GetProperty(i, kpidSize, &prop));
-      ai.SizeDefined = (prop.vt != VT_EMPTY);
-      if (ai.SizeDefined)
-        ai.Size = ConvertPropVariantToUInt64(prop);
-    }
-
-    {
-      CPropVariant prop;
-      RINOK(archive->GetProperty(i, kpidTimeType, &prop));
-      if (prop.vt == VT_UI4)
-      {
-        ai.TimeType = (int)(NFileTimeType::EEnum)prop.ulVal;
-        switch(ai.TimeType)
-        {
-          case NFileTimeType::kWindows:
-          case NFileTimeType::kUnix:
-          case NFileTimeType::kDOS:
-            break;
-          default:
-            return E_FAIL;
-        }
-      }
-    }
-
-    ai.IndexInServer = i;
-    arcItems.Add(ai);
-  }
-  return S_OK;
-}
-
-
-static HRESULT UpdateWithItemLists(
-    CCodecs *codecs,
-    CUpdateOptions &options,
-    IInArchive *archive,
-    const CObjectVector<CArcItem> &arcItems,
-    CDirItems &dirItems,
-    CTempFiles &tempFiles,
-    CUpdateErrorInfo &errorInfo,
-    IUpdateCallbackUI2 *callback)
-{
-  for(int i = 0; i < options.Commands.Size(); i++)
-  {
-    CUpdateArchiveCommand &command = options.Commands[i];
-    if (options.StdOutMode)
-    {
-      RINOK(callback->StartArchive(0, archive != 0));
-    }
-    else
-    {
-      RINOK(callback->StartArchive(command.ArchivePath.GetFinalPath(),
-          i == 0 && options.UpdateArchiveItself && archive != 0));
-    }
-
-    RINOK(Compress(
-        codecs,
-        command.ActionSet, archive,
-        options.MethodMode,
-        command.ArchivePath,
-        arcItems,
-        options.OpenShareForWrite,
-        options.StdInMode,
-        /* options.StdInFileName, */
-        options.StdOutMode,
-        dirItems,
-        options.SfxMode, options.SfxModule,
-        options.VolumesSizes,
-        tempFiles,
-        errorInfo, callback));
-
-    RINOK(callback->FinishArchive());
-  }
-  return S_OK;
-}
-
-#ifdef _WIN32
-class CCurrentDirRestorer
-{
-  UString m_CurrentDirectory;
-public:
-  CCurrentDirRestorer()
-    { NFile::NDirectory::MyGetCurrentDirectory(m_CurrentDirectory); }
-  ~CCurrentDirRestorer()
-    { RestoreDirectory();}
-  bool RestoreDirectory()
-    { return BOOLToBool(NFile::NDirectory::MySetCurrentDirectory(m_CurrentDirectory)); }
-};
-#endif
-
-struct CEnumDirItemUpdateCallback: public IEnumDirItemCallback
-{
-  IUpdateCallbackUI2 *Callback;
-  HRESULT ScanProgress(UInt64 numFolders, UInt64 numFiles, const wchar_t *path)
-  {
-    return Callback->ScanProgress(numFolders, numFiles, path);
-  }
-};
-
-#ifdef _WIN32
-typedef ULONG (FAR PASCAL MY_MAPISENDDOCUMENTS)(
-  ULONG_PTR ulUIParam,
-  LPSTR lpszDelimChar,
-  LPSTR lpszFilePaths,
-  LPSTR lpszFileNames,
-  ULONG ulReserved
-);
-typedef MY_MAPISENDDOCUMENTS FAR *MY_LPMAPISENDDOCUMENTS;
-#endif
-
-HRESULT UpdateArchive(
-    CCodecs *codecs,
-    const NWildcard::CCensor &censor,
-    CUpdateOptions &options,
-    CUpdateErrorInfo &errorInfo,
-    IOpenCallbackUI *openCallback,
-    IUpdateCallbackUI2 *callback)
-{
-  if (options.StdOutMode && options.EMailMode)
-    return E_FAIL;
-
-  if (options.VolumesSizes.Size() > 0 && (options.EMailMode || options.SfxMode))
-    return E_NOTIMPL;
-
-  if (options.SfxMode)
-  {
-    CProperty property;
-    property.Name = L"rsfx";
-    property.Value = L"on";
-    options.MethodMode.Properties.Add(property);
-    if (options.SfxModule.IsEmpty())
-    {
-      errorInfo.Message = L"sfx file is not specified";
-      return E_FAIL;
-    }
-    UString name = options.SfxModule;
-    if (!NDirectory::MySearchPath(NULL, name, NULL, options.SfxModule))
-    {
-      errorInfo.Message = L"can't find specified sfx module";
-      return E_FAIL;
-    }
-  }
-
-  const UString archiveName = options.ArchivePath.GetFinalPath();
-
-  UString defaultItemName;
-  NFind::CFileInfoW archiveFileInfo;
-
-  CArchiveLink archiveLink;
-  IInArchive *archive = 0;
-  if (NFind::FindFile(archiveName, archiveFileInfo))
-  {
-    if (archiveFileInfo.IsDir())
-      throw "there is no such archive";
-    if (options.VolumesSizes.Size() > 0)
-      return E_NOTIMPL;
-    CIntVector formatIndices;
-    if (options.MethodMode.FormatIndex >= 0)
-      formatIndices.Add(options.MethodMode.FormatIndex);
-    HRESULT result = MyOpenArchive(codecs, formatIndices, archiveName, archiveLink, openCallback);
-    if (result == E_ABORT)
-      return result;
-    RINOK(callback->OpenResult(archiveName, result));
-    RINOK(result);
-    if (archiveLink.VolumePaths.Size() > 1)
-    {
-      errorInfo.SystemError = (DWORD)E_NOTIMPL;
-      errorInfo.Message = L"Updating for multivolume archives is not implemented";
-      return E_NOTIMPL;
-    }
-    archive = archiveLink.GetArchive();
-    defaultItemName = archiveLink.GetDefaultItemName();
-  }
-  else
-  {
-    /*
-    if (archiveType.IsEmpty())
-      throw "type of archive is not specified";
-    */
-  }
-
-  CDirItems dirItems;
-  if (options.StdInMode)
-  {
-    CDirItem di;
-    di.Name = options.StdInFileName;
-    di.Size = (UInt64)(Int64)-1;
-    di.Attrib = 0;
-    NTime::GetCurUtcFileTime(di.MTime);
-    di.CTime = di.ATime = di.MTime;
-    dirItems.Items.Add(di);
-  }
-  else
-  {
-    bool needScanning = false;
-    for(int i = 0; i < options.Commands.Size(); i++)
-      if (options.Commands[i].ActionSet.NeedScanning())
-        needScanning = true;
-    if (needScanning)
-    {
-      CEnumDirItemUpdateCallback enumCallback;
-      enumCallback.Callback = callback;
-      RINOK(callback->StartScanning());
-      UStringVector errorPaths;
-      CRecordVector<DWORD> errorCodes;
-      HRESULT res = EnumerateItems(censor, dirItems, &enumCallback, errorPaths, errorCodes);
-      for (int i = 0; i < errorPaths.Size(); i++)
-      {
-        RINOK(callback->CanNotFindError(errorPaths[i], errorCodes[i]));
-      }
-      if (res != S_OK)
-      {
-        if (res != E_ABORT)
-          errorInfo.Message = L"Scanning error";
-        // errorInfo.FileName = errorPath;
-        return res;
-      }
-      RINOK(callback->FinishScanning());
-    }
-  }
-
-  UString tempDirPrefix;
-  bool usesTempDir = false;
-  
-  #ifdef _WIN32
-  NDirectory::CTempDirectoryW tempDirectory;
-  if (options.EMailMode && options.EMailRemoveAfter)
-  {
-    tempDirectory.Create(kTempFolderPrefix);
-    tempDirPrefix = tempDirectory.GetPath();
-    NormalizeDirPathPrefix(tempDirPrefix);
-    usesTempDir = true;
-  }
-  #endif
-
-  CTempFiles tempFiles;
-
-  bool createTempFile = false;
-  if(!options.StdOutMode && options.UpdateArchiveItself)
-  {
-    CArchivePath &ap = options.Commands[0].ArchivePath;
-    ap = options.ArchivePath;
-    // if ((archive != 0 && !usesTempDir) || !options.WorkingDir.IsEmpty())
-    if ((archive != 0 || !options.WorkingDir.IsEmpty()) && !usesTempDir && options.VolumesSizes.Size() == 0)
-    {
-      createTempFile = true;
-      ap.Temp = true;
-      if (!options.WorkingDir.IsEmpty())
-      {
-        ap.TempPrefix = options.WorkingDir;
-        NormalizeDirPathPrefix(ap.TempPrefix);
-      }
-    }
-  }
-
-  for(int i = 0; i < options.Commands.Size(); i++)
-  {
-    CArchivePath &ap = options.Commands[i].ArchivePath;
-    if (usesTempDir)
-    {
-      // Check it
-      ap.Prefix = tempDirPrefix;
-      // ap.Temp = true;
-      // ap.TempPrefix = tempDirPrefix;
-    }
-    if (i > 0 || !createTempFile)
-    {
-      const UString &path = ap.GetFinalPath();
-      if (NFind::DoesFileExist(path))
-      {
-        errorInfo.SystemError = 0;
-        errorInfo.Message = L"File already exists";
-        errorInfo.FileName = path;
-        return E_FAIL;
-      }
-    }
-  }
-
-  CObjectVector<CArcItem> arcItems;
-  if (archive != NULL)
-  {
-    RINOK(EnumerateInArchiveItems(censor,
-        archive, defaultItemName, archiveFileInfo, arcItems));
-  }
-
-  RINOK(UpdateWithItemLists(codecs, options, archive, arcItems, dirItems,
-      tempFiles, errorInfo, callback));
-
-  if (archive != NULL)
-  {
-    RINOK(archiveLink.Close());
-    archiveLink.Release();
-  }
-
-  tempFiles.Paths.Clear();
-  if(createTempFile)
-  {
-    try
-    {
-      CArchivePath &ap = options.Commands[0].ArchivePath;
-      const UString &tempPath = ap.GetTempPath();
-      if (archive != NULL)
-        if (!NDirectory::DeleteFileAlways(archiveName))
-        {
-          errorInfo.SystemError = ::GetLastError();
-          errorInfo.Message = L"delete file error";
-          errorInfo.FileName = archiveName;
-          return E_FAIL;
-        }
-      if (!NDirectory::MyMoveFile(tempPath, archiveName))
-      {
-        errorInfo.SystemError = ::GetLastError();
-        errorInfo.Message = L"move file error";
-        errorInfo.FileName = tempPath;
-        errorInfo.FileName2 = archiveName;
-        return E_FAIL;
-      }
-    }
-    catch(...)
-    {
-      throw;
-    }
-  }
-
-  #ifdef _WIN32
-  if (options.EMailMode)
-  {
-    NDLL::CLibrary mapiLib;
-    if (!mapiLib.Load(TEXT("Mapi32.dll")))
-    {
-      errorInfo.SystemError = ::GetLastError();
-      errorInfo.Message = L"can not load Mapi32.dll";
-      return E_FAIL;
-    }
-    MY_LPMAPISENDDOCUMENTS fnSend = (MY_LPMAPISENDDOCUMENTS)
-        mapiLib.GetProcAddress("MAPISendDocuments");
-    if (fnSend == 0)
-    {
-      errorInfo.SystemError = ::GetLastError();
-      errorInfo.Message = L"can not find MAPISendDocuments function";
-      return E_FAIL;
-    }
-    UStringVector fullPaths;
-    int i;
-    for(i = 0; i < options.Commands.Size(); i++)
-    {
-      CArchivePath &ap = options.Commands[i].ArchivePath;
-      UString arcPath;
-      if(!NFile::NDirectory::MyGetFullPathName(ap.GetFinalPath(), arcPath))
-      {
-        errorInfo.SystemError = ::GetLastError();
-        return E_FAIL;
-      }
-      fullPaths.Add(arcPath);
-    }
-    CCurrentDirRestorer curDirRestorer;
-    for(i = 0; i < fullPaths.Size(); i++)
-    {
-      UString arcPath = fullPaths[i];
-      UString fileName = ExtractFileNameFromPath(arcPath);
-      AString path = GetAnsiString(arcPath);
-      AString name = GetAnsiString(fileName);
-      // Warning!!! MAPISendDocuments function changes Current directory
-      fnSend(0, ";", (LPSTR)(LPCSTR)path, (LPSTR)(LPCSTR)name, 0);
-    }
-  }
-  #endif
-  return S_OK;
-}
-
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/Update.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/Update.h
deleted file mode 100644
index 46547bf..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/Update.h
+++ /dev/null
@@ -1,166 +0,0 @@
-// Update.h
-
-#ifndef __UPDATE_H
-#define __UPDATE_H
-
-#include "Common/Wildcard.h"
-#include "Windows/FileFind.h"
-#include "../../Archive/IArchive.h"
-
-#include "UpdateAction.h"
-#include "ArchiveOpenCallback.h"
-#include "UpdateCallback.h"
-#include "Property.h"
-#include "LoadCodecs.h"
-
-struct CArchivePath
-{
-  UString Prefix;   // path(folder) prefix including slash
-  UString Name; // base name
-  UString BaseExtension; // archive type extension or "exe" extension
-  UString VolExtension;  // archive type extension for volumes
-
-  bool Temp;
-  UString TempPrefix;  // path(folder) for temp location
-  UString TempPostfix;
-
-  CArchivePath(): Temp(false) {};
-  
-  void ParseFromPath(const UString &path)
-  {
-    SplitPathToParts(path, Prefix, Name);
-    if (Name.IsEmpty())
-      return;
-    int dotPos = Name.ReverseFind(L'.');
-    if (dotPos <= 0)
-      return;
-    if (dotPos == Name.Length() - 1)
-    {
-      Name = Name.Left(dotPos);
-      BaseExtension.Empty();
-      return;
-    }
-    if (BaseExtension.CompareNoCase(Name.Mid(dotPos + 1)) == 0)
-    {
-      BaseExtension = Name.Mid(dotPos + 1);
-      Name = Name.Left(dotPos);
-    }
-    else
-      BaseExtension.Empty();
-  }
-
-  UString GetPathWithoutExt() const
-  {
-    return Prefix + Name;
-  }
-
-  UString GetFinalPath() const
-  {
-    UString path = GetPathWithoutExt();
-    if (!BaseExtension.IsEmpty())
-      path += UString(L'.') + BaseExtension;
-    return path;
-  }
-
-  
-  UString GetTempPath() const
-  {
-    UString path = TempPrefix + Name;
-    if (!BaseExtension.IsEmpty())
-      path += UString(L'.') + BaseExtension;
-    path += L".tmp";
-    path += TempPostfix;
-    return path;
-  }
-};
-
-struct CUpdateArchiveCommand
-{
-  UString UserArchivePath;
-  CArchivePath ArchivePath;
-  NUpdateArchive::CActionSet ActionSet;
-};
-
-struct CCompressionMethodMode
-{
-  int FormatIndex;
-  CObjectVector<CProperty> Properties;
-  CCompressionMethodMode(): FormatIndex(-1) {}
-};
-
-struct CUpdateOptions
-{
-  CCompressionMethodMode MethodMode;
-
-  CObjectVector<CUpdateArchiveCommand> Commands;
-  bool UpdateArchiveItself;
-  CArchivePath ArchivePath;
-  
-  bool SfxMode;
-  UString SfxModule;
-  
-  bool OpenShareForWrite;
-
-  bool StdInMode;
-  UString StdInFileName;
-  bool StdOutMode;
-  
-  bool EMailMode;
-  bool EMailRemoveAfter;
-  UString EMailAddress;
-
-  UString WorkingDir;
-
-  bool Init(const CCodecs *codecs, const CIntVector &formatIndices, const UString &arcPath);
-
-  CUpdateOptions():
-    UpdateArchiveItself(true),
-    SfxMode(false),
-    StdInMode(false),
-    StdOutMode(false),
-    EMailMode(false),
-    EMailRemoveAfter(false),
-    OpenShareForWrite(false)
-      {};
-  CRecordVector<UInt64> VolumesSizes;
-};
-
-struct CErrorInfo
-{
-  DWORD SystemError;
-  UString FileName;
-  UString FileName2;
-  UString Message;
-  // UStringVector ErrorPaths;
-  // CRecordVector<DWORD> ErrorCodes;
-  CErrorInfo(): SystemError(0) {};
-};
-
-struct CUpdateErrorInfo: public CErrorInfo
-{
-};
-
-#define INTERFACE_IUpdateCallbackUI2(x) \
-  INTERFACE_IUpdateCallbackUI(x) \
-  virtual HRESULT OpenResult(const wchar_t *name, HRESULT result) x; \
-  virtual HRESULT StartScanning() x; \
-  virtual HRESULT ScanProgress(UInt64 numFolders, UInt64 numFiles, const wchar_t *path) x; \
-  virtual HRESULT CanNotFindError(const wchar_t *name, DWORD systemError) x; \
-  virtual HRESULT FinishScanning() x; \
-  virtual HRESULT StartArchive(const wchar_t *name, bool updating) x; \
-  virtual HRESULT FinishArchive() x; \
-
-struct IUpdateCallbackUI2: public IUpdateCallbackUI
-{
-  INTERFACE_IUpdateCallbackUI2(=0)
-};
-
-HRESULT UpdateArchive(
-    CCodecs *codecs,
-    const NWildcard::CCensor &censor,
-    CUpdateOptions &options,
-    CUpdateErrorInfo &errorInfo,
-    IOpenCallbackUI *openCallback,
-    IUpdateCallbackUI2 *callback);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdateAction.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdateAction.cpp
deleted file mode 100644
index 845384f..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdateAction.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-// UpdateAction.cpp
-
-#include "StdAfx.h"
-
-#include "UpdateAction.h"
-
-namespace NUpdateArchive {
-
-const CActionSet kAddActionSet =
-{
-  NPairAction::kCopy,
-  NPairAction::kCopy,
-  NPairAction::kCompress,
-  NPairAction::kCompress,
-  NPairAction::kCompress,
-  NPairAction::kCompress,
-  NPairAction::kCompress
-};
-
-const CActionSet kUpdateActionSet =
-{
-  NPairAction::kCopy,
-  NPairAction::kCopy,
-  NPairAction::kCompress,
-  NPairAction::kCopy,
-  NPairAction::kCompress,
-  NPairAction::kCopy,
-  NPairAction::kCompress
-};
-
-const CActionSet kFreshActionSet =
-{
-  NPairAction::kCopy,
-  NPairAction::kCopy,
-  NPairAction::kIgnore,
-  NPairAction::kCopy,
-  NPairAction::kCompress,
-  NPairAction::kCopy,
-  NPairAction::kCompress
-};
-
-const CActionSet kSynchronizeActionSet =
-{
-  NPairAction::kCopy,
-  NPairAction::kIgnore,
-  NPairAction::kCompress,
-  NPairAction::kCopy,
-  NPairAction::kCompress,
-  NPairAction::kCopy,
-  NPairAction::kCompress,
-};
-
-const CActionSet kDeleteActionSet =
-{
-  NPairAction::kCopy,
-  NPairAction::kIgnore,
-  NPairAction::kIgnore,
-  NPairAction::kIgnore,
-  NPairAction::kIgnore,
-  NPairAction::kIgnore,
-  NPairAction::kIgnore
-};
-
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdateAction.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdateAction.h
deleted file mode 100644
index 7da5ff2..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdateAction.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// UpdateAction.h
-
-#ifndef __UPDATE_ACTION_H
-#define __UPDATE_ACTION_H
-
-namespace NUpdateArchive {
-
-  namespace NPairState
-  {
-    const int kNumValues = 7;
-    enum EEnum
-    {
-      kNotMasked = 0,
-      kOnlyInArchive,
-      kOnlyOnDisk,
-      kNewInArchive,
-      kOldInArchive,
-      kSameFiles,
-      kUnknowNewerFiles
-    };
-  }
-  namespace NPairAction
-  {
-    enum EEnum
-    {
-      kIgnore = 0,
-      kCopy,
-      kCompress,
-      kCompressAsAnti
-    };
-  }
-  struct CActionSet
-  {
-    NPairAction::EEnum StateActions[NPairState::kNumValues];
-    bool NeedScanning() const
-    {
-      int i;
-      for (i = 0; i < NPairState::kNumValues; i++)
-        if (StateActions[i] == NPairAction::kCompress)
-          return true;
-      for (i = 1; i < NPairState::kNumValues; i++)
-        if (StateActions[i] != NPairAction::kIgnore)
-          return true;
-      return false;
-    }
-  };
-  extern const CActionSet kAddActionSet;
-  extern const CActionSet kUpdateActionSet;
-  extern const CActionSet kFreshActionSet;
-  extern const CActionSet kSynchronizeActionSet;
-  extern const CActionSet kDeleteActionSet;
-};
-
-
-#endif
-
-
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdateCallback.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdateCallback.cpp
deleted file mode 100644
index dcca2a1..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdateCallback.cpp
+++ /dev/null
@@ -1,242 +0,0 @@
-// UpdateCallback.cpp
-
-#include "StdAfx.h"
-
-#include "UpdateCallback.h"
-
-#include "Common/StringConvert.h"
-#include "Common/IntToString.h"
-#include "Common/Defs.h"
-#include "Common/ComTry.h"
-
-#include "Windows/PropVariant.h"
-
-#include "../../Common/FileStreams.h"
-
-using namespace NWindows;
-
-CArchiveUpdateCallback::CArchiveUpdateCallback():
-  Callback(0),
-  ShareForWrite(false),
-  StdInMode(false),
-  DirItems(0),
-  ArcItems(0),
-  UpdatePairs(0),
-  NewNames(0)
-  {}
-
-
-STDMETHODIMP CArchiveUpdateCallback::SetTotal(UInt64 size)
-{
-  COM_TRY_BEGIN
-  return Callback->SetTotal(size);
-  COM_TRY_END
-}
-
-STDMETHODIMP CArchiveUpdateCallback::SetCompleted(const UInt64 *completeValue)
-{
-  COM_TRY_BEGIN
-  return Callback->SetCompleted(completeValue);
-  COM_TRY_END
-}
-
-STDMETHODIMP CArchiveUpdateCallback::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
-{
-  COM_TRY_BEGIN
-  return Callback->SetRatioInfo(inSize, outSize);
-  COM_TRY_END
-}
-
-
-/*
-STATPROPSTG kProperties[] =
-{
-  { NULL, kpidPath, VT_BSTR},
-  { NULL, kpidIsDir, VT_BOOL},
-  { NULL, kpidSize, VT_UI8},
-  { NULL, kpidCTime, VT_FILETIME},
-  { NULL, kpidATime, VT_FILETIME},
-  { NULL, kpidMTime, VT_FILETIME},
-  { NULL, kpidAttrib, VT_UI4},
-  { NULL, kpidIsAnti, VT_BOOL}
-};
-
-STDMETHODIMP CArchiveUpdateCallback::EnumProperties(IEnumSTATPROPSTG **)
-{
-  return CStatPropEnumerator::CreateEnumerator(kProperties, sizeof(kProperties) / sizeof(kProperties[0]), enumerator);
-}
-*/
-
-STDMETHODIMP CArchiveUpdateCallback::GetUpdateItemInfo(UInt32 index,
-      Int32 *newData, Int32 *newProps, UInt32 *indexInArchive)
-{
-  COM_TRY_BEGIN
-  RINOK(Callback->CheckBreak());
-  const CUpdatePair2 &up = (*UpdatePairs)[index];
-  if (newData != NULL) *newData = BoolToInt(up.NewData);
-  if (newProps != NULL) *newProps = BoolToInt(up.NewProps);
-  if (indexInArchive != NULL)
-  {
-    *indexInArchive = (UInt32)-1;
-    if (up.ExistInArchive())
-      *indexInArchive = (ArcItems == 0) ? up.ArcIndex : (*ArcItems)[up.ArcIndex].IndexInServer;
-  }
-  return S_OK;
-  COM_TRY_END
-}
-
-STDMETHODIMP CArchiveUpdateCallback::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
-  COM_TRY_BEGIN
-  const CUpdatePair2 &up = (*UpdatePairs)[index];
-  NWindows::NCOM::CPropVariant prop;
-  
-  if (propID == kpidIsAnti)
-  {
-    prop = up.IsAnti;
-    prop.Detach(value);
-    return S_OK;
-  }
-
-  if (up.IsAnti)
-  {
-    switch(propID)
-    {
-      case kpidIsDir:
-      case kpidPath:
-        break;
-      case kpidSize:
-        prop = (UInt64)0;
-        prop.Detach(value);
-        return S_OK;
-      default:
-        prop.Detach(value);
-        return S_OK;
-    }
-  }
-  
-  if (up.ExistOnDisk())
-  {
-    const CDirItem &di = DirItems->Items[up.DirIndex];
-    switch(propID)
-    {
-      case kpidPath:  prop = DirItems->GetLogPath(up.DirIndex); break;
-      case kpidIsDir:  prop = di.IsDir(); break;
-      case kpidSize:  prop = di.Size; break;
-      case kpidAttrib:  prop = di.Attrib; break;
-      case kpidCTime:  prop = di.CTime; break;
-      case kpidATime:  prop = di.ATime; break;
-      case kpidMTime:  prop = di.MTime; break;
-    }
-  }
-  else
-  {
-    if (propID == kpidPath)
-    {
-      if (up.NewNameIndex >= 0)
-      {
-        prop = (*NewNames)[up.NewNameIndex];
-        prop.Detach(value);
-        return S_OK;
-      }
-    }
-    if (up.ExistInArchive() && Archive)
-    {
-      UInt32 indexInArchive;
-      if (ArcItems == 0)
-        indexInArchive = up.ArcIndex;
-      else
-        indexInArchive = (*ArcItems)[up.ArcIndex].IndexInServer;
-      return Archive->GetProperty(indexInArchive, propID, value);
-    }
-  }
-  prop.Detach(value);
-  return S_OK;
-  COM_TRY_END
-}
-
-STDMETHODIMP CArchiveUpdateCallback::GetStream(UInt32 index, ISequentialInStream **inStream)
-{
-  COM_TRY_BEGIN
-  const CUpdatePair2 &up = (*UpdatePairs)[index];
-  if (!up.NewData)
-    return E_FAIL;
-  
-  RINOK(Callback->CheckBreak());
-  RINOK(Callback->Finilize());
-
-  if (up.IsAnti)
-  {
-    return Callback->GetStream((*ArcItems)[up.ArcIndex].Name, true);
-  }
-  const CDirItem &di = DirItems->Items[up.DirIndex];
-  RINOK(Callback->GetStream(DirItems->GetLogPath(up.DirIndex), false));
- 
-  if (di.IsDir())
-    return S_OK;
-
-  if (StdInMode)
-  {
-    CStdInFileStream *inStreamSpec = new CStdInFileStream;
-    CMyComPtr<ISequentialInStream> inStreamLoc(inStreamSpec);
-    *inStream = inStreamLoc.Detach();
-  }
-  else
-  {
-    CInFileStream *inStreamSpec = new CInFileStream;
-    CMyComPtr<ISequentialInStream> inStreamLoc(inStreamSpec);
-    const UString path = DirItems->GetPhyPath(up.DirIndex);
-    if (!inStreamSpec->OpenShared(path, ShareForWrite))
-    {
-      return Callback->OpenFileError(path, ::GetLastError());
-    }
-    *inStream = inStreamLoc.Detach();
-  }
-  return S_OK;
-  COM_TRY_END
-}
-
-STDMETHODIMP CArchiveUpdateCallback::SetOperationResult(Int32 operationResult)
-{
-  COM_TRY_BEGIN
-  return Callback->SetOperationResult(operationResult);
-  COM_TRY_END
-}
-
-STDMETHODIMP CArchiveUpdateCallback::GetVolumeSize(UInt32 index, UInt64 *size)
-{
-  if (VolumesSizes.Size() == 0)
-    return S_FALSE;
-  if (index >= (UInt32)VolumesSizes.Size())
-    index = VolumesSizes.Size() - 1;
-  *size = VolumesSizes[index];
-  return S_OK;
-}
-
-STDMETHODIMP CArchiveUpdateCallback::GetVolumeStream(UInt32 index, ISequentialOutStream **volumeStream)
-{
-  COM_TRY_BEGIN
-  wchar_t temp[32];
-  ConvertUInt64ToString(index + 1, temp);
-  UString res = temp;
-  while (res.Length() < 2)
-    res = UString(L'0') + res;
-  UString fileName = VolName;
-  fileName += L'.';
-  fileName += res;
-  fileName += VolExt;
-  COutFileStream *streamSpec = new COutFileStream;
-  CMyComPtr<ISequentialOutStream> streamLoc(streamSpec);
-  if (!streamSpec->Create(fileName, false))
-    return ::GetLastError();
-  *volumeStream = streamLoc.Detach();
-  return S_OK;
-  COM_TRY_END
-}
-
-STDMETHODIMP CArchiveUpdateCallback::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
-{
-  COM_TRY_BEGIN
-  return Callback->CryptoGetTextPassword2(passwordIsDefined, password);
-  COM_TRY_END
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdateCallback.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdateCallback.h
deleted file mode 100644
index 2a814b3..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdateCallback.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// UpdateCallback.h
-
-#ifndef __UPDATECALLBACK_H
-#define __UPDATECALLBACK_H
-
-#include "Common/MyCom.h"
-#include "Common/MyString.h"
-
-#include "../../IPassword.h"
-#include "../../ICoder.h"
-
-#include "../Common/UpdatePair.h"
-#include "../Common/UpdateProduce.h"
-
-#define INTERFACE_IUpdateCallbackUI(x) \
-  virtual HRESULT SetTotal(UInt64 size) x; \
-  virtual HRESULT SetCompleted(const UInt64 *completeValue) x; \
-  virtual HRESULT SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize) x; \
-  virtual HRESULT CheckBreak() x; \
-  virtual HRESULT Finilize() x; \
-  virtual HRESULT SetNumFiles(UInt64 numFiles) x; \
-  virtual HRESULT GetStream(const wchar_t *name, bool isAnti) x; \
-  virtual HRESULT OpenFileError(const wchar_t *name, DWORD systemError) x; \
-  virtual HRESULT SetOperationResult(Int32 operationResult) x; \
-  virtual HRESULT CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password) x; \
-  // virtual HRESULT ShowDeleteFile(const wchar_t *name) x; \
-  // virtual HRESULT CloseProgress() { return S_OK; };
-
-struct IUpdateCallbackUI
-{
-  INTERFACE_IUpdateCallbackUI(=0)
-};
-
-class CArchiveUpdateCallback:
-  public IArchiveUpdateCallback2,
-  public ICryptoGetTextPassword2,
-  public ICompressProgressInfo,
-  public CMyUnknownImp
-{
-public:
-  MY_UNKNOWN_IMP3(
-      IArchiveUpdateCallback2,
-      ICryptoGetTextPassword2,
-      ICompressProgressInfo)
-
-  STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
-
-  INTERFACE_IArchiveUpdateCallback2(;)
-
-  STDMETHOD(CryptoGetTextPassword2)(Int32 *passwordIsDefined, BSTR *password);
-
-public:
-  CRecordVector<UInt64> VolumesSizes;
-  UString VolName;
-  UString VolExt;
-
-  IUpdateCallbackUI *Callback;
-
-  bool ShareForWrite;
-  bool StdInMode;
-  const CDirItems *DirItems;
-  const CObjectVector<CArcItem> *ArcItems;
-  const CRecordVector<CUpdatePair2> *UpdatePairs;
-  const UStringVector *NewNames;
-  CMyComPtr<IInArchive> Archive;
-
-  CArchiveUpdateCallback();
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdatePair.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdatePair.cpp
deleted file mode 100644
index f6727cb..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdatePair.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-// UpdatePair.cpp
-
-#include "StdAfx.h"
-
-#include <time.h>
-
-#include "Common/Defs.h"
-#include "Common/Wildcard.h"
-#include "Windows/Time.h"
-
-#include "UpdatePair.h"
-#include "SortUtils.h"
-
-using namespace NWindows;
-using namespace NTime;
-
-static int MyCompareTime(NFileTimeType::EEnum fileTimeType, const FILETIME &time1, const FILETIME &time2)
-{
-  switch(fileTimeType)
-  {
-    case NFileTimeType::kWindows:
-      return ::CompareFileTime(&time1, &time2);
-    case NFileTimeType::kUnix:
-      {
-        UInt32 unixTime1, unixTime2;
-        FileTimeToUnixTime(time1, unixTime1);
-        FileTimeToUnixTime(time2, unixTime2);
-        return MyCompare(unixTime1, unixTime2);
-      }
-    case NFileTimeType::kDOS:
-      {
-        UInt32 dosTime1, dosTime2;
-        FileTimeToDosTime(time1, dosTime1);
-        FileTimeToDosTime(time2, dosTime2);
-        return MyCompare(dosTime1, dosTime2);
-      }
-  }
-  throw 4191618;
-}
-
-static const wchar_t *kDuplicateFileNameMessage = L"Duplicate filename:";
-static const wchar_t *kNotCensoredCollisionMessaged = L"Internal file name collision (file on disk, file in archive):";
-
-static void ThrowError(const UString &message, const UString &s1, const UString &s2)
-{
-  UString m = message;
-  m += L'\n';
-  m += s1;
-  m += L'\n';
-  m += s2;
-  throw m;
-}
-
-static void TestDuplicateString(const UStringVector &strings, const CIntVector &indices)
-{
-  for(int i = 0; i + 1 < indices.Size(); i++)
-    if (CompareFileNames(strings[indices[i]], strings[indices[i + 1]]) == 0)
-      ThrowError(kDuplicateFileNameMessage, strings[indices[i]], strings[indices[i + 1]]);
-}
-
-void GetUpdatePairInfoList(
-    const CDirItems &dirItems,
-    const CObjectVector<CArcItem> &arcItems,
-    NFileTimeType::EEnum fileTimeType,
-    CRecordVector<CUpdatePair> &updatePairs)
-{
-  CIntVector dirIndices, arcIndices;
-  
-  int numDirItems = dirItems.Items.Size();
-  int numArcItems = arcItems.Size();
-  
-  
-  {
-    UStringVector arcNames;
-    arcNames.Reserve(numArcItems);
-    for (int i = 0; i < numArcItems; i++)
-      arcNames.Add(arcItems[i].Name);
-    SortFileNames(arcNames, arcIndices);
-    TestDuplicateString(arcNames, arcIndices);
-  }
-
-  UStringVector dirNames;
-  {
-    dirNames.Reserve(numDirItems);
-    for (int i = 0; i < numDirItems; i++)
-      dirNames.Add(dirItems.GetLogPath(i));
-    SortFileNames(dirNames, dirIndices);
-    TestDuplicateString(dirNames, dirIndices);
-  }
-  
-  int dirIndex = 0, arcIndex = 0;
-  while (dirIndex < numDirItems && arcIndex < numArcItems)
-  {
-    CUpdatePair pair;
-    int dirIndex2 = dirIndices[dirIndex];
-    int arcIndex2 = arcIndices[arcIndex];
-    const CDirItem &di = dirItems.Items[dirIndex2];
-    const CArcItem &ai = arcItems[arcIndex2];
-    int compareResult = CompareFileNames(dirNames[dirIndex2], ai.Name);
-    if (compareResult < 0)
-    {
-      pair.State = NUpdateArchive::NPairState::kOnlyOnDisk;
-      pair.DirIndex = dirIndex2;
-      dirIndex++;
-    }
-    else if (compareResult > 0)
-    {
-      pair.State = ai.Censored ?
-          NUpdateArchive::NPairState::kOnlyInArchive:
-          NUpdateArchive::NPairState::kNotMasked;
-      pair.ArcIndex = arcIndex2;
-      arcIndex++;
-    }
-    else
-    {
-      if (!ai.Censored)
-        ThrowError(kNotCensoredCollisionMessaged, dirNames[dirIndex2], ai.Name);
-      pair.DirIndex = dirIndex2;
-      pair.ArcIndex = arcIndex2;
-      switch (MyCompareTime(
-          ai.TimeType != - 1 ? (NFileTimeType::EEnum)ai.TimeType : fileTimeType,
-          di.MTime, ai.MTime))
-      {
-        case -1: pair.State = NUpdateArchive::NPairState::kNewInArchive; break;
-        case 1:  pair.State = NUpdateArchive::NPairState::kOldInArchive; break;
-        default:
-          if (ai.SizeDefined)
-            if (di.Size != ai.Size)
-              pair.State = NUpdateArchive::NPairState::kUnknowNewerFiles;
-            else
-              pair.State = NUpdateArchive::NPairState::kSameFiles;
-          else
-              pair.State = NUpdateArchive::NPairState::kUnknowNewerFiles;
-      }
-      dirIndex++;
-      arcIndex++;
-    }
-    updatePairs.Add(pair);
-  }
-
-  for (; dirIndex < numDirItems; dirIndex++)
-  {
-    CUpdatePair pair;
-    pair.State = NUpdateArchive::NPairState::kOnlyOnDisk;
-    pair.DirIndex = dirIndices[dirIndex];
-    updatePairs.Add(pair);
-  }
-  
-  for (; arcIndex < numArcItems; arcIndex++)
-  {
-    CUpdatePair pair;
-    int arcIndex2 = arcIndices[arcIndex];
-    pair.State = arcItems[arcIndex2].Censored ?
-        NUpdateArchive::NPairState::kOnlyInArchive:
-        NUpdateArchive::NPairState::kNotMasked;
-    pair.ArcIndex = arcIndex2;
-    updatePairs.Add(pair);
-  }
-
-  updatePairs.ReserveDown();
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdatePair.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdatePair.h
deleted file mode 100644
index 3a33264..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdatePair.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// UpdatePair.h
-
-#ifndef __UPDATE_PAIR_H
-#define __UPDATE_PAIR_H
-
-#include "DirItem.h"
-#include "UpdateAction.h"
-
-#include "../../Archive/IArchive.h"
-
-struct CUpdatePair
-{
-  NUpdateArchive::NPairState::EEnum State;
-  int ArcIndex;
-  int DirIndex;
-  CUpdatePair(): ArcIndex(-1), DirIndex(-1) {}
-};
-
-void GetUpdatePairInfoList(
-    const CDirItems &dirItems,
-    const CObjectVector<CArcItem> &arcItems,
-    NFileTimeType::EEnum fileTimeType,
-    CRecordVector<CUpdatePair> &updatePairs);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdateProduce.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdateProduce.cpp
deleted file mode 100644
index c21db3b..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdateProduce.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-// UpdateProduce.cpp
-
-#include "StdAfx.h"
-
-#include "UpdateProduce.h"
-
-using namespace NUpdateArchive;
-
-static const char *kUpdateActionSetCollision = "Internal collision in update action set";
-
-void UpdateProduce(
-    const CRecordVector<CUpdatePair> &updatePairs,
-    const CActionSet &actionSet,
-    CRecordVector<CUpdatePair2> &operationChain,
-    IUpdateProduceCallback *callback)
-{
-  for (int i = 0; i < updatePairs.Size(); i++)
-  {
-    const CUpdatePair &pair = updatePairs[i];
-
-    CUpdatePair2 up2;
-    up2.IsAnti = false;
-    up2.DirIndex = pair.DirIndex;
-    up2.ArcIndex = pair.ArcIndex;
-    up2.NewData = up2.NewProps = true;
-    
-    switch(actionSet.StateActions[pair.State])
-    {
-      case NPairAction::kIgnore:
-        /*
-        if (pair.State != NPairState::kOnlyOnDisk)
-          IgnoreArchiveItem(m_ArchiveItems[pair.ArcIndex]);
-        // cout << "deleting";
-        */
-        if (callback)
-          callback->ShowDeleteFile(pair.ArcIndex);
-        continue;
-
-      case NPairAction::kCopy:
-        if (pair.State == NPairState::kOnlyOnDisk)
-          throw kUpdateActionSetCollision;
-        up2.NewData = up2.NewProps = false;
-        break;
-      
-      case NPairAction::kCompress:
-        if (pair.State == NPairState::kOnlyInArchive ||
-            pair.State == NPairState::kNotMasked)
-          throw kUpdateActionSetCollision;
-        break;
-      
-      case NPairAction::kCompressAsAnti:
-        up2.IsAnti = true;
-        break;
-    }
-    operationChain.Add(up2);
-  }
-  operationChain.ReserveDown();
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdateProduce.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdateProduce.h
deleted file mode 100644
index e18648c..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/UpdateProduce.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// UpdateProduce.h
-
-#ifndef __UPDATE_PRODUCE_H
-#define __UPDATE_PRODUCE_H
-
-#include "UpdatePair.h"
-
-struct CUpdatePair2
-{
-  bool NewData;
-  bool NewProps;
-  bool IsAnti;
-  
-  int DirIndex;
-  int ArcIndex;
-  int NewNameIndex;
-
-  bool ExistOnDisk() const { return DirIndex != -1; }
-  bool ExistInArchive() const { return ArcIndex != -1; }
-
-  CUpdatePair2(): IsAnti(false), DirIndex(-1), ArcIndex(-1), NewNameIndex(-1) {}
-};
-
-struct IUpdateProduceCallback
-{
-  virtual HRESULT ShowDeleteFile(int arcIndex) = 0;
-};
-
-void UpdateProduce(
-    const CRecordVector<CUpdatePair> &updatePairs,
-    const NUpdateArchive::CActionSet &actionSet,
-    CRecordVector<CUpdatePair2> &operationChain,
-    IUpdateProduceCallback *callback);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/WorkDir.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/WorkDir.cpp
deleted file mode 100644
index e97275b..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/WorkDir.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-// WorkDir.cpp
-
-#include "StdAfx.h"
-
-#include "WorkDir.h"
-
-#include "Common/StringConvert.h"
-#include "Common/Wildcard.h"
-
-#include "Windows/FileName.h"
-#include "Windows/FileDir.h"
-
-static inline UINT GetCurrentCodePage()
-  { return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
-
-using namespace NWindows;
-using namespace NFile;
-using namespace NName;
-
-UString GetWorkDir(const NWorkDir::CInfo &workDirInfo, const UString &path)
-{
-  NWorkDir::NMode::EEnum mode = workDirInfo.Mode;
-  if (workDirInfo.ForRemovableOnly)
-  {
-    mode = NWorkDir::NMode::kCurrent;
-    UString prefix = path.Left(3);
-    if (prefix[1] == L':' && prefix[2] == L'\\')
-    {
-      UINT driveType = GetDriveType(GetSystemString(prefix, GetCurrentCodePage()));
-      if (driveType == DRIVE_CDROM || driveType == DRIVE_REMOVABLE)
-        mode = workDirInfo.Mode;
-    }
-    /*
-    CParsedPath parsedPath;
-    parsedPath.ParsePath(archiveName);
-    UINT driveType = GetDriveType(parsedPath.Prefix);
-    if ((driveType != DRIVE_CDROM) && (driveType != DRIVE_REMOVABLE))
-      mode = NZipSettings::NWorkDir::NMode::kCurrent;
-    */
-  }
-  switch(mode)
-  {
-    case NWorkDir::NMode::kCurrent:
-    {
-      return ExtractDirPrefixFromPath(path);
-    }
-    case NWorkDir::NMode::kSpecified:
-    {
-      UString tempDir = workDirInfo.Path;
-      NormalizeDirPathPrefix(tempDir);
-      return tempDir;
-    }
-    default:
-    {
-      UString tempDir;
-      if(!NFile::NDirectory::MyGetTempPath(tempDir))
-        throw 141717;
-      return tempDir;
-    }
-  }
-}
-
-
-
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/WorkDir.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/WorkDir.h
deleted file mode 100644
index 0643d67..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/WorkDir.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// WorkDir.h
-
-#ifndef __WORKDIR_H
-#define __WORKDIR_H
-
-#include "ZipRegistry.h"
-
-UString GetWorkDir(const NWorkDir::CInfo &workDirInfo, const UString &path);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ZipRegistry.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ZipRegistry.h
deleted file mode 100644
index 30be8d8..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ZipRegistry.h
+++ /dev/null
@@ -1,98 +0,0 @@
-// ZipRegistry.h
-
-#ifndef __ZIPREGISTRY_H
-#define __ZIPREGISTRY_H
-
-#include "Common/MyString.h"
-#include "Common/Types.h"
-#include "ExtractMode.h"
-
-namespace NExtract
-{
-  struct CInfo
-  {
-    NPathMode::EEnum PathMode;
-    NOverwriteMode::EEnum OverwriteMode;
-    UStringVector Paths;
-    bool ShowPassword;
-  };
-}
-
-namespace NCompression {
-  
-  struct CFormatOptions
-  {
-    CSysString FormatID;
-    UString Options;
-    UString Method;
-    UString EncryptionMethod;
-    UInt32 Level;
-    UInt32 Dictionary;
-    UInt32 Order;
-    UInt32 BlockLogSize;
-    UInt32 NumThreads;
-    void ResetForLevelChange()
-    {
-      BlockLogSize = NumThreads = Level = Dictionary = Order = UInt32(-1);
-      Method.Empty();
-      // EncryptionMethod.Empty();
-      // Options.Empty();
-    }
-    CFormatOptions() { ResetForLevelChange(); }
-  };
-
-  struct CInfo
-  {
-    UStringVector HistoryArchives;
-    UInt32 Level;
-    UString ArchiveType;
-
-    CObjectVector<CFormatOptions> FormatOptionsVector;
-
-    bool ShowPassword;
-    bool EncryptHeaders;
-  };
-}
-
-namespace NWorkDir{
-  
-  namespace NMode
-  {
-    enum EEnum
-    {
-      kSystem,
-      kCurrent,
-      kSpecified
-    };
-  }
-  struct CInfo
-  {
-    NMode::EEnum Mode;
-    UString Path;
-    bool ForRemovableOnly;
-    void SetForRemovableOnlyDefault() { ForRemovableOnly = true; }
-    void SetDefault()
-    {
-      Mode = NMode::kSystem;
-      Path.Empty();
-      SetForRemovableOnlyDefault();
-    }
-  };
-}
-
-void SaveExtractionInfo(const NExtract::CInfo &info);
-void ReadExtractionInfo(NExtract::CInfo &info);
-
-void SaveCompressionInfo(const NCompression::CInfo &info);
-void ReadCompressionInfo(NCompression::CInfo &info);
-
-void SaveWorkDirInfo(const NWorkDir::CInfo &info);
-void ReadWorkDirInfo(NWorkDir::CInfo &info);
-
-void SaveCascadedMenu(bool enabled);
-bool ReadCascadedMenu();
-
-void SaveContextMenuStatus(UInt32 value);
-bool ReadContextMenuStatus(UInt32 &value);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/ConsoleClose.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/ConsoleClose.cpp
deleted file mode 100644
index d18b39e..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/ConsoleClose.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-// ConsoleClose.cpp
-
-#include "StdAfx.h"
-
-#include "ConsoleClose.h"
-
-static int g_BreakCounter = 0;
-static const int kBreakAbortThreshold = 2;
-
-namespace NConsoleClose {
-
-static BOOL WINAPI HandlerRoutine(DWORD ctrlType)
-{
-  if (ctrlType == CTRL_LOGOFF_EVENT)
-  {
-    // printf("\nCTRL_LOGOFF_EVENT\n");
-    return TRUE;
-  }
-
-  g_BreakCounter++;
-  if (g_BreakCounter < kBreakAbortThreshold)
-    return TRUE;
-  return FALSE;
-  /*
-  switch(ctrlType)
-  {
-    case CTRL_C_EVENT:
-    case CTRL_BREAK_EVENT:
-      if (g_BreakCounter < kBreakAbortThreshold)
-      return TRUE;
-  }
-  return FALSE;
-  */
-}
-
-bool TestBreakSignal()
-{
-  /*
-  if (g_BreakCounter > 0)
-    return true;
-  */
-  return (g_BreakCounter > 0);
-}
-
-void CheckCtrlBreak()
-{
-  if (TestBreakSignal())
-    throw CCtrlBreakException();
-}
-
-CCtrlHandlerSetter::CCtrlHandlerSetter()
-{
-  if(!SetConsoleCtrlHandler(HandlerRoutine, TRUE))
-    throw "SetConsoleCtrlHandler fails";
-}
-
-CCtrlHandlerSetter::~CCtrlHandlerSetter()
-{
-  if(!SetConsoleCtrlHandler(HandlerRoutine, FALSE))
-    throw "SetConsoleCtrlHandler fails";
-}
-
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/ConsoleClose.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/ConsoleClose.h
deleted file mode 100644
index 9019c4c..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/ConsoleClose.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// ConsoleCloseUtils.h
-
-#ifndef __CONSOLECLOSEUTILS_H
-#define __CONSOLECLOSEUTILS_H
-
-namespace NConsoleClose {
-
-bool TestBreakSignal();
-
-class CCtrlHandlerSetter
-{
-public:
-  CCtrlHandlerSetter();
-  virtual ~CCtrlHandlerSetter();
-};
-
-class CCtrlBreakException
-{};
-
-void CheckCtrlBreak();
-
-}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp
deleted file mode 100644
index af65739..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp
+++ /dev/null
@@ -1,228 +0,0 @@
-// ExtractCallbackConsole.h
-
-#include "StdAfx.h"
-
-#include "ExtractCallbackConsole.h"
-#include "UserInputUtils.h"
-#include "ConsoleClose.h"
-
-#include "Common/Wildcard.h"
-
-#include "Windows/FileDir.h"
-#include "Windows/FileFind.h"
-#include "Windows/Time.h"
-#include "Windows/Defs.h"
-#include "Windows/PropVariant.h"
-#include "Windows/Error.h"
-#include "Windows/PropVariantConversions.h"
-
-#include "../../Common/FilePathAutoRename.h"
-
-#include "../Common/ExtractingFilePath.h"
-
-using namespace NWindows;
-using namespace NFile;
-using namespace NDirectory;
-
-static const char *kTestString    =  "Testing     ";
-static const char *kExtractString =  "Extracting  ";
-static const char *kSkipString   =  "Skipping    ";
-
-// static const char *kCantAutoRename = "can not create file with auto name\n";
-// static const char *kCantRenameFile = "can not rename existing file\n";
-// static const char *kCantDeleteOutputFile = "can not delete output file ";
-static const char *kError = "ERROR: ";
-static const char *kMemoryExceptionMessage = "Can't allocate required memory!";
-
-static const char *kProcessing = "Processing archive: ";
-static const char *kEverythingIsOk = "Everything is Ok";
-static const char *kNoFiles = "No files to process";
-
-static const char *kUnsupportedMethod = "Unsupported Method";
-static const char *kCrcFailed = "CRC Failed";
-static const char *kCrcFailedEncrypted = "CRC Failed in encrypted file. Wrong password?";
-static const char *kDataError = "Data Error";
-static const char *kDataErrorEncrypted = "Data Error in encrypted file. Wrong password?";
-static const char *kUnknownError = "Unknown Error";
-
-STDMETHODIMP CExtractCallbackConsole::SetTotal(UInt64)
-{
-  if (NConsoleClose::TestBreakSignal())
-    return E_ABORT;
-  return S_OK;
-}
-
-STDMETHODIMP CExtractCallbackConsole::SetCompleted(const UInt64 *)
-{
-  if (NConsoleClose::TestBreakSignal())
-    return E_ABORT;
-  return S_OK;
-}
-
-STDMETHODIMP CExtractCallbackConsole::AskOverwrite(
-    const wchar_t *existName, const FILETIME *, const UInt64 *,
-    const wchar_t *newName, const FILETIME *, const UInt64 *,
-    Int32 *answer)
-{
-  (*OutStream) << "file " << existName <<
-    "\nalready exists. Overwrite with " << endl;
-  (*OutStream) << newName;
-  
-  NUserAnswerMode::EEnum overwriteAnswer = ScanUserYesNoAllQuit(OutStream);
-  
-  switch(overwriteAnswer)
-  {
-    case NUserAnswerMode::kQuit:  return E_ABORT;
-    case NUserAnswerMode::kNo:     *answer = NOverwriteAnswer::kNo; break;
-    case NUserAnswerMode::kNoAll:  *answer = NOverwriteAnswer::kNoToAll; break;
-    case NUserAnswerMode::kYesAll: *answer = NOverwriteAnswer::kYesToAll; break;
-    case NUserAnswerMode::kYes:    *answer = NOverwriteAnswer::kYes; break;
-    case NUserAnswerMode::kAutoRenameAll: *answer = NOverwriteAnswer::kAutoRename; break;
-    default: return E_FAIL;
-  }
-  return S_OK;
-}
-
-STDMETHODIMP CExtractCallbackConsole::PrepareOperation(const wchar_t *name, bool /* isFolder */, Int32 askExtractMode, const UInt64 *position)
-{
-  switch (askExtractMode)
-  {
-    case NArchive::NExtract::NAskMode::kExtract: (*OutStream) << kExtractString; break;
-    case NArchive::NExtract::NAskMode::kTest:    (*OutStream) << kTestString; break;
-    case NArchive::NExtract::NAskMode::kSkip:    (*OutStream) << kSkipString; break;
-  };
-  (*OutStream) << name;
-  if (position != 0)
-    (*OutStream) << " <" << *position << ">";
-  return S_OK;
-}
-
-STDMETHODIMP CExtractCallbackConsole::MessageError(const wchar_t *message)
-{
-  (*OutStream) << message << endl;
-  NumFileErrorsInCurrentArchive++;
-  NumFileErrors++;
-  return S_OK;
-}
-
-STDMETHODIMP CExtractCallbackConsole::SetOperationResult(Int32 operationResult, bool encrypted)
-{
-  switch(operationResult)
-  {
-    case NArchive::NExtract::NOperationResult::kOK:
-      break;
-    default:
-    {
-      NumFileErrorsInCurrentArchive++;
-      NumFileErrors++;
-      (*OutStream) << "     ";
-      switch(operationResult)
-      {
-        case NArchive::NExtract::NOperationResult::kUnSupportedMethod:
-          (*OutStream) << kUnsupportedMethod;
-          break;
-        case NArchive::NExtract::NOperationResult::kCRCError:
-          (*OutStream) << (encrypted ? kCrcFailedEncrypted: kCrcFailed);
-          break;
-        case NArchive::NExtract::NOperationResult::kDataError:
-          (*OutStream) << (encrypted ? kDataErrorEncrypted : kDataError);
-          break;
-        default:
-          (*OutStream) << kUnknownError;
-      }
-    }
-  }
-  (*OutStream) << endl;
-  return S_OK;
-}
-
-#ifndef _NO_CRYPTO
-
-HRESULT CExtractCallbackConsole::SetPassword(const UString &password)
-{
-  PasswordIsDefined = true;
-  Password = password;
-  return S_OK;
-}
-
-STDMETHODIMP CExtractCallbackConsole::CryptoGetTextPassword(BSTR *password)
-{
-  if (!PasswordIsDefined)
-  {
-    Password = GetPassword(OutStream);
-    PasswordIsDefined = true;
-  }
-  return StringToBstr(Password, password);
-}
-
-#endif
-
-HRESULT CExtractCallbackConsole::BeforeOpen(const wchar_t *name)
-{
-  NumArchives++;
-  NumFileErrorsInCurrentArchive = 0;
-  (*OutStream) << endl << kProcessing << name << endl;
-  return S_OK;
-}
-
-HRESULT CExtractCallbackConsole::OpenResult(const wchar_t * /* name */, HRESULT result, bool encrypted)
-{
-  (*OutStream) << endl;
-  if (result != S_OK)
-  {
-    (*OutStream) << "Error: ";
-    if (result == S_FALSE)
-    {
-      (*OutStream) << (encrypted ?
-        "Can not open encrypted archive. Wrong password?" :
-        "Can not open file as archive");
-    }
-    else
-    {
-      if (result == E_OUTOFMEMORY)
-        (*OutStream) << "Can't allocate required memory";
-      else
-        (*OutStream) << NError::MyFormatMessage(result);
-    }
-    (*OutStream) << endl;
-    NumArchiveErrors++;
-  }
-  return S_OK;
-}
-  
-HRESULT CExtractCallbackConsole::ThereAreNoFiles()
-{
-  (*OutStream) << endl << kNoFiles << endl;
-  return S_OK;
-}
-
-HRESULT CExtractCallbackConsole::ExtractResult(HRESULT result)
-{
-  if (result == S_OK)
-  {
-    (*OutStream) << endl;
-    if (NumFileErrorsInCurrentArchive == 0)
-      (*OutStream) << kEverythingIsOk << endl;
-    else
-    {
-      NumArchiveErrors++;
-      (*OutStream) << "Sub items Errors: " << NumFileErrorsInCurrentArchive << endl;
-    }
-  }
-  if (result == S_OK)
-    return result;
-  NumArchiveErrors++;
-  if (result == E_ABORT || result == ERROR_DISK_FULL)
-    return result;
-  (*OutStream) << endl << kError;
-  if (result == E_OUTOFMEMORY)
-    (*OutStream) << kMemoryExceptionMessage;
-  else
-  {
-    UString message;
-    NError::MyFormatMessage(result, message);
-    (*OutStream) << message;
-  }
-  (*OutStream) << endl;
-  return S_OK;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/ExtractCallbackConsole.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/ExtractCallbackConsole.h
deleted file mode 100644
index e42ca6f..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/ExtractCallbackConsole.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// ExtractCallbackConsole.h
-
-#ifndef __EXTRACTCALLBACKCONSOLE_H
-#define __EXTRACTCALLBACKCONSOLE_H
-
-#include "Common/MyString.h"
-#include "Common/StdOutStream.h"
-#include "../../Common/FileStreams.h"
-#include "../../IPassword.h"
-#include "../../Archive/IArchive.h"
-#include "../Common/ArchiveExtractCallback.h"
-
-class CExtractCallbackConsole:
-  public IExtractCallbackUI,
-  #ifndef _NO_CRYPTO
-  public ICryptoGetTextPassword,
-  #endif
-  public CMyUnknownImp
-{
-public:
-  MY_QUERYINTERFACE_BEGIN2(IFolderArchiveExtractCallback)
-  #ifndef _NO_CRYPTO
-  MY_QUERYINTERFACE_ENTRY(ICryptoGetTextPassword)
-  #endif
-  MY_QUERYINTERFACE_END
-  MY_ADDREF_RELEASE
-
-  STDMETHOD(SetTotal)(UInt64 total);
-  STDMETHOD(SetCompleted)(const UInt64 *completeValue);
-
-  // IFolderArchiveExtractCallback
-  STDMETHOD(AskOverwrite)(
-      const wchar_t *existName, const FILETIME *existTime, const UInt64 *existSize,
-      const wchar_t *newName, const FILETIME *newTime, const UInt64 *newSize,
-      Int32 *answer);
-  STDMETHOD (PrepareOperation)(const wchar_t *name, bool isFolder, Int32 askExtractMode, const UInt64 *position);
-
-  STDMETHOD(MessageError)(const wchar_t *message);
-  STDMETHOD(SetOperationResult)(Int32 operationResult, bool encrypted);
-
-  HRESULT BeforeOpen(const wchar_t *name);
-  HRESULT OpenResult(const wchar_t *name, HRESULT result, bool encrypted);
-  HRESULT ThereAreNoFiles();
-  HRESULT ExtractResult(HRESULT result);
-
- 
-  #ifndef _NO_CRYPTO
-  HRESULT SetPassword(const UString &password);
-  STDMETHOD(CryptoGetTextPassword)(BSTR *password);
-
-  bool PasswordIsDefined;
-  UString Password;
-
-  #endif
-  
-  UInt64 NumArchives;
-  UInt64 NumArchiveErrors;
-  UInt64 NumFileErrors;
-  UInt64 NumFileErrorsInCurrentArchive;
-
-  CStdOutStream *OutStream;
-
-  void Init()
-  {
-    NumArchives = 0;
-    NumArchiveErrors = 0;
-    NumFileErrors = 0;
-    NumFileErrorsInCurrentArchive = 0;
-  }
-
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/List.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/List.cpp
deleted file mode 100644
index 82a08f2..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/List.cpp
+++ /dev/null
@@ -1,596 +0,0 @@
-// List.cpp
-
-#include "StdAfx.h"
-
-#include "List.h"
-#include "ConsoleClose.h"
-
-#include "Common/StringConvert.h"
-#include "Common/StdOutStream.h"
-#include "Common/IntToString.h"
-#include "Common/MyCom.h"
-
-#include "Windows/PropVariant.h"
-#include "Windows/Defs.h"
-#include "Windows/PropVariantConversions.h"
-#include "Windows/FileDir.h"
-#include "Windows/Error.h"
-
-#include "../../Archive/IArchive.h"
-
-#include "../Common/PropIDUtils.h"
-#include "../Common/OpenArchive.h"
-
-#include "OpenCallbackConsole.h"
-
-using namespace NWindows;
-
-struct CPropIdToName
-{
-  PROPID PropID;
-  const wchar_t *Name;
-};
-
-static CPropIdToName kPropIdToName[] =
-{
-  { kpidPath, L"Path" },
-  { kpidName, L"Name" },
-  { kpidIsDir, L"Folder" },
-  { kpidSize, L"Size" },
-  { kpidPackSize, L"Packed Size" },
-  { kpidAttrib, L"Attributes" },
-  { kpidCTime, L"Created" },
-  { kpidATime, L"Accessed" },
-  { kpidMTime, L"Modified" },
-  { kpidSolid, L"Solid" },
-  { kpidCommented, L"Commented" },
-  { kpidEncrypted, L"Encrypted" },
-  { kpidSplitBefore, L"Split Before" },
-  { kpidSplitAfter, L"Split After" },
-  { kpidDictionarySize, L"Dictionary Size" },
-  { kpidCRC, L"CRC" },
-  { kpidType, L"Type" },
-  { kpidIsAnti, L"Anti" },
-  { kpidMethod, L"Method" },
-  { kpidHostOS, L"Host OS" },
-  { kpidFileSystem, L"File System" },
-  { kpidUser, L"User" },
-  { kpidGroup, L"Group" },
-  { kpidBlock, L"Block" },
-  { kpidComment, L"Comment" },
-  { kpidPosition, L"Position" },
-  { kpidPrefix, L"Prefix" },
-  { kpidNumSubDirs, L"Folders" },
-  { kpidNumSubFiles, L"Files" },
-  { kpidUnpackVer, L"Version" },
-  { kpidVolume, L"Volume" },
-  { kpidIsVolume, L"Multivolume" },
-  { kpidOffset, L"Offset" },
-  { kpidLinks, L"Links" },
-  { kpidNumBlocks, L"Blocks" },
-  { kpidNumVolumes, L"Volumes" },
-
-  { kpidBit64, L"64-bit" },
-  { kpidBigEndian, L"Big-endian" },
-  { kpidCpu, L"CPU" },
-  { kpidPhySize, L"Physical Size" },
-  { kpidHeadersSize, L"Headers Size" },
-  { kpidChecksum, L"Checksum" },
-  { kpidCharacts, L"Characteristics" },
-  { kpidVa, L"Virtual Address" },
-  { kpidFreeSpace, L"Free Space" },
-  { kpidClusterSize, L"Cluster Size" }
-};
-
-static const char kEmptyAttribChar = '.';
-
-static const char *kListing = "Listing archive: ";
-static const wchar_t *kFilesMessage = L"files";
-static const wchar_t *kDirsMessage = L"folders";
-
-static void GetAttribString(DWORD wa, bool isDir, char *s)
-{
-  s[0] = ((wa & FILE_ATTRIBUTE_DIRECTORY) != 0 || isDir) ? 'D' : kEmptyAttribChar;
-  s[1] = ((wa & FILE_ATTRIBUTE_READONLY) != 0) ? 'R': kEmptyAttribChar;
-  s[2] = ((wa & FILE_ATTRIBUTE_HIDDEN) != 0) ? 'H': kEmptyAttribChar;
-  s[3] = ((wa & FILE_ATTRIBUTE_SYSTEM) != 0) ? 'S': kEmptyAttribChar;
-  s[4] = ((wa & FILE_ATTRIBUTE_ARCHIVE) != 0) ? 'A': kEmptyAttribChar;
-  s[5] = '\0';
-}
-
-enum EAdjustment
-{
-  kLeft,
-  kCenter,
-  kRight
-};
-
-struct CFieldInfo
-{
-  PROPID PropID;
-  UString Name;
-  EAdjustment TitleAdjustment;
-  EAdjustment TextAdjustment;
-  int PrefixSpacesWidth;
-  int Width;
-};
-
-struct CFieldInfoInit
-{
-  PROPID PropID;
-  const wchar_t *Name;
-  EAdjustment TitleAdjustment;
-  EAdjustment TextAdjustment;
-  int PrefixSpacesWidth;
-  int Width;
-};
-
-CFieldInfoInit kStandardFieldTable[] =
-{
-  { kpidMTime, L"   Date      Time", kLeft, kLeft, 0, 19 },
-  { kpidAttrib, L"Attr", kRight, kCenter, 1, 5 },
-  { kpidSize, L"Size", kRight, kRight, 1, 12 },
-  { kpidPackSize, L"Compressed", kRight, kRight, 1, 12 },
-  { kpidPath, L"Name", kLeft, kLeft, 2, 24 }
-};
-
-void PrintSpaces(int numSpaces)
-{
-  for (int i = 0; i < numSpaces; i++)
-    g_StdOut << ' ';
-}
-
-void PrintString(EAdjustment adjustment, int width, const UString &textString)
-{
-  const int numSpaces = width - textString.Length();
-  int numLeftSpaces = 0;
-  switch (adjustment)
-  {
-    case kLeft:
-      numLeftSpaces = 0;
-      break;
-    case kCenter:
-      numLeftSpaces = numSpaces / 2;
-      break;
-    case kRight:
-      numLeftSpaces = numSpaces;
-      break;
-  }
-  PrintSpaces(numLeftSpaces);
-  g_StdOut << textString;
-  PrintSpaces(numSpaces - numLeftSpaces);
-}
-
-class CFieldPrinter
-{
-  CObjectVector<CFieldInfo> _fields;
-public:
-  void Clear() { _fields.Clear(); }
-  void Init(const CFieldInfoInit *standardFieldTable, int numItems);
-  HRESULT Init(IInArchive *archive);
-  void PrintTitle();
-  void PrintTitleLines();
-  HRESULT PrintItemInfo(IInArchive *archive,
-      const UString &defaultItemName,
-      UInt32 index,
-      bool techMode);
-  HRESULT PrintSummaryInfo(UInt64 numFiles, UInt64 numDirs,
-      const UInt64 *size, const UInt64 *compressedSize);
-};
-
-void CFieldPrinter::Init(const CFieldInfoInit *standardFieldTable, int numItems)
-{
-  Clear();
-  for (int i = 0; i < numItems; i++)
-  {
-    CFieldInfo fieldInfo;
-    const CFieldInfoInit &fieldInfoInit = standardFieldTable[i];
-    fieldInfo.PropID = fieldInfoInit.PropID;
-    fieldInfo.Name = fieldInfoInit.Name;
-    fieldInfo.TitleAdjustment = fieldInfoInit.TitleAdjustment;
-    fieldInfo.TextAdjustment = fieldInfoInit.TextAdjustment;
-    fieldInfo.PrefixSpacesWidth = fieldInfoInit.PrefixSpacesWidth;
-    fieldInfo.Width = fieldInfoInit.Width;
-    _fields.Add(fieldInfo);
-  }
-}
-
-static UString GetPropName(PROPID propID, BSTR name)
-{
-  for (int i = 0; i < sizeof(kPropIdToName) / sizeof(kPropIdToName[0]); i++)
-  {
-    const CPropIdToName &propIdToName = kPropIdToName[i];
-    if (propIdToName.PropID == propID)
-      return propIdToName.Name;
-  }
-  if (name)
-    return name;
-  wchar_t s[32];
-  ConvertUInt64ToString(propID, s);
-  return s;
-}
-
-HRESULT CFieldPrinter::Init(IInArchive *archive)
-{
-  Clear();
-  UInt32 numProps;
-  RINOK(archive->GetNumberOfProperties(&numProps));
-  for (UInt32 i = 0; i < numProps; i++)
-  {
-    CMyComBSTR name;
-    PROPID propID;
-    VARTYPE vt;
-    RINOK(archive->GetPropertyInfo(i, &name, &propID, &vt));
-    CFieldInfo fieldInfo;
-    fieldInfo.PropID = propID;
-    fieldInfo.Name = GetPropName(propID, name);
-    _fields.Add(fieldInfo);
-  }
-  return S_OK;
-}
-
-void CFieldPrinter::PrintTitle()
-{
-  for (int i = 0; i < _fields.Size(); i++)
-  {
-    const CFieldInfo &fieldInfo = _fields[i];
-    PrintSpaces(fieldInfo.PrefixSpacesWidth);
-    PrintString(fieldInfo.TitleAdjustment,
-      ((fieldInfo.PropID == kpidPath) ? 0: fieldInfo.Width), fieldInfo.Name);
-  }
-}
-
-void CFieldPrinter::PrintTitleLines()
-{
-  for (int i = 0; i < _fields.Size(); i++)
-  {
-    const CFieldInfo &fieldInfo = _fields[i];
-    PrintSpaces(fieldInfo.PrefixSpacesWidth);
-    for (int i = 0; i < fieldInfo.Width; i++)
-      g_StdOut << '-';
-  }
-}
-
-
-BOOL IsFileTimeZero(CONST FILETIME *lpFileTime)
-{
-  return (lpFileTime->dwLowDateTime == 0) && (lpFileTime->dwHighDateTime == 0);
-}
-
-static const char *kEmptyTimeString = "                   ";
-void PrintTime(const NCOM::CPropVariant &prop)
-{
-  if (prop.vt != VT_FILETIME)
-    throw "incorrect item";
-  if (IsFileTimeZero(&prop.filetime))
-    g_StdOut << kEmptyTimeString;
-  else
-  {
-    FILETIME localFileTime;
-    if (!FileTimeToLocalFileTime(&prop.filetime, &localFileTime))
-      throw "FileTimeToLocalFileTime error";
-    char s[32];
-    if (ConvertFileTimeToString(localFileTime, s, true, true))
-      g_StdOut << s;
-    else
-      g_StdOut << kEmptyTimeString;
-  }
-}
-
-HRESULT CFieldPrinter::PrintItemInfo(IInArchive *archive,
-    const UString &defaultItemName,
-    UInt32 index,
-    bool techMode)
-{
-  /*
-  if (techMode)
-  {
-    g_StdOut << "Index = ";
-    g_StdOut << (UInt64)index;
-    g_StdOut << endl;
-  }
-  */
-  for (int i = 0; i < _fields.Size(); i++)
-  {
-    const CFieldInfo &fieldInfo = _fields[i];
-    if (!techMode)
-      PrintSpaces(fieldInfo.PrefixSpacesWidth);
-
-    NCOM::CPropVariant prop;
-    if (fieldInfo.PropID == kpidPath)
-    {
-      UString s;
-      RINOK(GetArchiveItemPath(archive, index, defaultItemName, s));
-      prop = s;
-    }
-    else
-    {
-      RINOK(archive->GetProperty(index, fieldInfo.PropID, &prop));
-    }
-    if (techMode)
-    {
-      g_StdOut << fieldInfo.Name << " = ";
-    }
-    int width = (fieldInfo.PropID == kpidPath) ? 0: fieldInfo.Width;
-    if (prop.vt == VT_EMPTY)
-    {
-      switch(fieldInfo.PropID)
-      {
-        case kpidPath:  prop = defaultItemName; break;
-        default:
-          if (techMode)
-            g_StdOut << endl;
-          else
-            PrintSpaces(width);
-          continue;
-      }
-    }
-    if (fieldInfo.PropID == kpidMTime)
-    {
-      PrintTime(prop);
-    }
-    else if (fieldInfo.PropID == kpidAttrib)
-    {
-      if (prop.vt != VT_UI4)
-        throw "incorrect item";
-      UInt32 attributes = prop.ulVal;
-      bool isFolder;
-      RINOK(IsArchiveItemFolder(archive, index, isFolder));
-      char s[8];
-      GetAttribString(attributes, isFolder, s);
-      g_StdOut << s;
-    }
-    else if (prop.vt == VT_BSTR)
-    {
-      if (techMode)
-        g_StdOut << prop.bstrVal;
-      else
-        PrintString(fieldInfo.TextAdjustment, width, prop.bstrVal);
-    }
-    else
-    {
-      UString s = ConvertPropertyToString(prop, fieldInfo.PropID);
-      s.Replace(wchar_t(0xA), L' ');
-      s.Replace(wchar_t(0xD), L' ');
-
-      if (techMode)
-        g_StdOut << s;
-      else
-        PrintString(fieldInfo.TextAdjustment, width, s);
-    }
-    if (techMode)
-      g_StdOut << endl;
-  }
-  return S_OK;
-}
-
-void PrintNumberString(EAdjustment adjustment, int width, const UInt64 *value)
-{
-  wchar_t textString[32] = { 0 };
-  if (value != NULL)
-    ConvertUInt64ToString(*value, textString);
-  PrintString(adjustment, width, textString);
-}
-
-
-HRESULT CFieldPrinter::PrintSummaryInfo(UInt64 numFiles, UInt64 numDirs,
-    const UInt64 *size, const UInt64 *compressedSize)
-{
-  for (int i = 0; i < _fields.Size(); i++)
-  {
-    const CFieldInfo &fieldInfo = _fields[i];
-    PrintSpaces(fieldInfo.PrefixSpacesWidth);
-    NCOM::CPropVariant prop;
-    if (fieldInfo.PropID == kpidSize)
-      PrintNumberString(fieldInfo.TextAdjustment, fieldInfo.Width, size);
-    else if (fieldInfo.PropID == kpidPackSize)
-      PrintNumberString(fieldInfo.TextAdjustment, fieldInfo.Width, compressedSize);
-    else if (fieldInfo.PropID == kpidPath)
-    {
-      wchar_t textString[32];
-      ConvertUInt64ToString(numFiles, textString);
-      UString temp = textString;
-      temp += L" ";
-      temp += kFilesMessage;
-      temp += L", ";
-      ConvertUInt64ToString(numDirs, textString);
-      temp += textString;
-      temp += L" ";
-      temp += kDirsMessage;
-      PrintString(fieldInfo.TextAdjustment, 0, temp);
-    }
-    else
-      PrintString(fieldInfo.TextAdjustment, fieldInfo.Width, L"");
-  }
-  return S_OK;
-}
-
-bool GetUInt64Value(IInArchive *archive, UInt32 index, PROPID propID, UInt64 &value)
-{
-  NCOM::CPropVariant prop;
-  if (archive->GetProperty(index, propID, &prop) != S_OK)
-    throw "GetPropertyValue error";
-  if (prop.vt == VT_EMPTY)
-    return false;
-  value = ConvertPropVariantToUInt64(prop);
-  return true;
-}
-
-HRESULT ListArchives(CCodecs *codecs, const CIntVector &formatIndices,
-    UStringVector &archivePaths, UStringVector &archivePathsFull,
-    const NWildcard::CCensorNode &wildcardCensor,
-    bool enableHeaders, bool techMode,
-    #ifndef _NO_CRYPTO
-    bool &passwordEnabled, UString &password,
-    #endif
-    UInt64 &numErrors)
-{
-  numErrors = 0;
-  CFieldPrinter fieldPrinter;
-  if (!techMode)
-    fieldPrinter.Init(kStandardFieldTable, sizeof(kStandardFieldTable) / sizeof(kStandardFieldTable[0]));
-
-  UInt64 numFiles2 = 0, numDirs2 = 0, totalPackSize2 = 0, totalUnPackSize2 = 0;
-  UInt64 *totalPackSizePointer2 = 0, *totalUnPackSizePointer2 = 0;
-  for (int i = 0; i < archivePaths.Size(); i++)
-  {
-    const UString &archiveName = archivePaths[i];
-    NFile::NFind::CFileInfoW fi;
-    if (!NFile::NFind::FindFile(archiveName, fi) || fi.IsDir())
-    {
-      g_StdOut << endl << "Error: " << archiveName << " is not file" << endl;
-      numErrors++;
-      continue;
-    }
-
-    CArchiveLink archiveLink;
-
-    COpenCallbackConsole openCallback;
-    openCallback.OutStream = &g_StdOut;
-
-    #ifndef _NO_CRYPTO
-
-    openCallback.PasswordIsDefined = passwordEnabled;
-    openCallback.Password = password;
-
-    #endif
-
-    HRESULT result = MyOpenArchive(codecs, formatIndices, archiveName, archiveLink, &openCallback);
-    if (result != S_OK)
-    {
-      if (result == E_ABORT)
-        return result;
-      g_StdOut << endl << "Error: " << archiveName << ": ";
-      if (result == S_FALSE)
-        g_StdOut << "is not supported archive";
-      else if (result == E_OUTOFMEMORY)
-        g_StdOut << "Can't allocate required memory";
-      else
-        g_StdOut << NError::MyFormatMessage(result);
-      g_StdOut << endl;
-      numErrors++;
-      continue;
-    }
-
-    for (int v = 0; v < archiveLink.VolumePaths.Size(); v++)
-    {
-      int index = archivePathsFull.FindInSorted(archiveLink.VolumePaths[v]);
-      if (index >= 0 && index > i)
-      {
-        archivePaths.Delete(index);
-        archivePathsFull.Delete(index);
-      }
-    }
-
-    IInArchive *archive = archiveLink.GetArchive();
-    const UString defaultItemName = archiveLink.GetDefaultItemName();
-
-    if (enableHeaders)
-    {
-      g_StdOut << endl << kListing << archiveName << endl << endl;
-
-      UInt32 numProps;
-      if (archive->GetNumberOfArchiveProperties(&numProps) == S_OK)
-      {
-        for (UInt32 i = 0; i < numProps; i++)
-        {
-          CMyComBSTR name;
-          PROPID propID;
-          VARTYPE vt;
-          if (archive->GetArchivePropertyInfo(i, &name, &propID, &vt) != S_OK)
-            continue;
-          NCOM::CPropVariant prop;
-          if (archive->GetArchiveProperty(propID, &prop) != S_OK)
-            continue;
-          UString s = ConvertPropertyToString(prop, propID);
-          if (!s.IsEmpty())
-            g_StdOut << GetPropName(propID, name) << " = " << s << endl;
-        }
-      }
-      if (techMode)
-        g_StdOut << "----------\n";
-      if (numProps > 0)
-        g_StdOut << endl;
-    }
-
-    if (enableHeaders && !techMode)
-    {
-      fieldPrinter.PrintTitle();
-      g_StdOut << endl;
-      fieldPrinter.PrintTitleLines();
-      g_StdOut << endl;
-    }
-
-    if (techMode)
-    {
-      RINOK(fieldPrinter.Init(archive));
-    }
-    UInt64 numFiles = 0, numDirs = 0, totalPackSize = 0, totalUnPackSize = 0;
-    UInt64 *totalPackSizePointer = 0, *totalUnPackSizePointer = 0;
-    UInt32 numItems;
-    RINOK(archive->GetNumberOfItems(&numItems));
-    for(UInt32 i = 0; i < numItems; i++)
-    {
-      if (NConsoleClose::TestBreakSignal())
-        return E_ABORT;
-
-      UString filePath;
-      RINOK(GetArchiveItemPath(archive, i, defaultItemName, filePath));
-
-      bool isFolder;
-      RINOK(IsArchiveItemFolder(archive, i, isFolder));
-      if (!wildcardCensor.CheckPath(filePath, !isFolder))
-        continue;
-      
-      fieldPrinter.PrintItemInfo(archive, defaultItemName, i, techMode);
-      
-      UInt64 packSize, unpackSize;
-      if (!GetUInt64Value(archive, i, kpidSize, unpackSize))
-        unpackSize = 0;
-      else
-        totalUnPackSizePointer = &totalUnPackSize;
-      if (!GetUInt64Value(archive, i, kpidPackSize, packSize))
-        packSize = 0;
-      else
-        totalPackSizePointer = &totalPackSize;
-      
-      g_StdOut << endl;
-
-      if (isFolder)
-        numDirs++;
-      else
-        numFiles++;
-      totalPackSize += packSize;
-      totalUnPackSize += unpackSize;
-    }
-    if (enableHeaders && !techMode)
-    {
-      fieldPrinter.PrintTitleLines();
-      g_StdOut << endl;
-      fieldPrinter.PrintSummaryInfo(numFiles, numDirs, totalUnPackSizePointer, totalPackSizePointer);
-      g_StdOut << endl;
-    }
-    if (totalPackSizePointer != 0)
-    {
-      totalPackSizePointer2 = &totalPackSize2;
-      totalPackSize2 += totalPackSize;
-    }
-    if (totalUnPackSizePointer != 0)
-    {
-      totalUnPackSizePointer2 = &totalUnPackSize2;
-      totalUnPackSize2 += totalUnPackSize;
-    }
-    numFiles2 += numFiles;
-    numDirs2 += numDirs;
-  }
-  if (enableHeaders && !techMode && archivePaths.Size() > 1)
-  {
-    g_StdOut << endl;
-    fieldPrinter.PrintTitleLines();
-    g_StdOut << endl;
-    fieldPrinter.PrintSummaryInfo(numFiles2, numDirs2, totalUnPackSizePointer2, totalPackSizePointer2);
-    g_StdOut << endl;
-    g_StdOut << "Archives: " << archivePaths.Size() << endl;
-  }
-  return S_OK;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/List.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/List.h
deleted file mode 100644
index bb4287e..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/List.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// List.h
-
-#ifndef __LIST_H
-#define __LIST_H
-
-#include "Common/Wildcard.h"
-#include "../Common/LoadCodecs.h"
-
-HRESULT ListArchives(CCodecs *codecs, const CIntVector &formatIndices,
-    UStringVector &archivePaths, UStringVector &archivePathsFull,
-    const NWildcard::CCensorNode &wildcardCensor,
-    bool enableHeaders, bool techMode,
-    #ifndef _NO_CRYPTO
-    bool &passwordEnabled, UString &password,
-    #endif
-    UInt64 &errors);
-
-#endif
-
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/Main.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/Main.cpp
deleted file mode 100644
index 87d48e9..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/Main.cpp
+++ /dev/null
@@ -1,596 +0,0 @@
-// Main.cpp
-
-#include "StdAfx.h"
-
-#include "Common/MyInitGuid.h"
-
-#include "Common/CommandLineParser.h"
-#include "Common/MyException.h"
-#include "Common/IntToString.h"
-#include "Common/StdOutStream.h"
-#include "Common/StringConvert.h"
-#include "Common/StringToInt.h"
-
-#include "Windows/FileDir.h"
-#include "Windows/FileName.h"
-#include "Windows/Defs.h"
-#include "Windows/Error.h"
-#ifdef _WIN32
-#include "Windows/MemoryLock.h"
-#endif
-
-#include "../../IPassword.h"
-#include "../../ICoder.h"
-#include "../Common/UpdateAction.h"
-#include "../Common/Update.h"
-#include "../Common/Extract.h"
-#include "../Common/ArchiveCommandLine.h"
-#include "../Common/ExitCode.h"
-#ifdef EXTERNAL_CODECS
-#include "../Common/LoadCodecs.h"
-#endif
-
-#include "../../Compress/LZMA_Alone/LzmaBenchCon.h"
-
-#include "List.h"
-#include "OpenCallbackConsole.h"
-#include "ExtractCallbackConsole.h"
-#include "UpdateCallbackConsole.h"
-
-#include "../../MyVersion.h"
-
-#if defined( _WIN32) && defined( _7ZIP_LARGE_PAGES)
-extern "C"
-{
-#include "../../../../C/Alloc.h"
-}
-#endif
-
-using namespace NWindows;
-using namespace NFile;
-using namespace NCommandLineParser;
-
-HINSTANCE g_hInstance = 0;
-extern CStdOutStream *g_StdStream;
-
-static const char *kCopyrightString = "\n7-Zip"
-#ifndef EXTERNAL_CODECS
-" (A)"
-#endif
-
-#ifdef _WIN64
-" [64]"
-#endif
-
-" " MY_VERSION_COPYRIGHT_DATE "\n";
-
-static const char *kHelpString =
-    "\nUsage: 7z"
-#ifdef _NO_CRYPTO
-    "r"
-#else
-#ifndef EXTERNAL_CODECS
-    "a"
-#endif
-#endif
-    " <command> [<switches>...] <archive_name> [<file_names>...]\n"
-    "       [<@listfiles...>]\n"
-    "\n"
-    "<Commands>\n"
-    "  a: Add files to archive\n"
-    "  b: Benchmark\n"
-    "  d: Delete files from archive\n"
-    "  e: Extract files from archive (without using directory names)\n"
-    "  l: List contents of archive\n"
-//    "  l[a|t][f]: List contents of archive\n"
-//    "    a - with Additional fields\n"
-//    "    t - with all fields\n"
-//    "    f - with Full pathnames\n"
-    "  t: Test integrity of archive\n"
-    "  u: Update files to archive\n"
-    "  x: eXtract files with full paths\n"
-    "<Switches>\n"
-    "  -ai[r[-|0]]{@listfile|!wildcard}: Include archives\n"
-    "  -ax[r[-|0]]{@listfile|!wildcard}: eXclude archives\n"
-    "  -bd: Disable percentage indicator\n"
-    "  -i[r[-|0]]{@listfile|!wildcard}: Include filenames\n"
-    "  -m{Parameters}: set compression Method\n"
-    "  -o{Directory}: set Output directory\n"
-    #ifndef _NO_CRYPTO
-    "  -p{Password}: set Password\n"
-    #endif
-    "  -r[-|0]: Recurse subdirectories\n"
-    "  -scs{UTF-8 | WIN | DOS}: set charset for list files\n"
-    "  -sfx[{name}]: Create SFX archive\n"
-    "  -si[{name}]: read data from stdin\n"
-    "  -slt: show technical information for l (List) command\n"
-    "  -so: write data to stdout\n"
-    "  -ssc[-]: set sensitive case mode\n"
-    "  -ssw: compress shared files\n"
-    "  -t{Type}: Set type of archive\n"
-    "  -v{Size}[b|k|m|g]: Create volumes\n"
-    "  -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options\n"
-    "  -w[{path}]: assign Work directory. Empty path means a temporary directory\n"
-    "  -x[r[-|0]]]{@listfile|!wildcard}: eXclude filenames\n"
-    "  -y: assume Yes on all queries\n";
-
-// ---------------------------
-// exception messages
-
-static const char *kEverythingIsOk = "Everything is Ok";
-static const char *kUserErrorMessage  = "Incorrect command line"; // NExitCode::kUserError
-static const char *kNoFormats = "7-Zip cannot find the code that works with archives.";
-
-static const wchar_t *kDefaultSfxModule = L"7zCon.sfx";
-
-static void ShowMessageAndThrowException(CStdOutStream &s, LPCSTR message, NExitCode::EEnum code)
-{
-  s << message << endl;
-  throw code;
-}
-
-static void PrintHelpAndExit(CStdOutStream &s) // yyy
-{
-  s << kHelpString;
-  ShowMessageAndThrowException(s, kUserErrorMessage, NExitCode::kUserError);
-}
-
-#ifndef _WIN32
-static void GetArguments(int numArguments, const char *arguments[], UStringVector &parts)
-{
-  parts.Clear();
-  for(int i = 0; i < numArguments; i++)
-  {
-    UString s = MultiByteToUnicodeString(arguments[i]);
-    parts.Add(s);
-  }
-}
-#endif
-
-static void ShowCopyrightAndHelp(CStdOutStream &s, bool needHelp)
-{
-  s << kCopyrightString;
-  // s << "# CPUs: " << (UInt64)NWindows::NSystem::GetNumberOfProcessors() << "\n";
-  if (needHelp)
-    s << kHelpString;
-}
-
-#ifdef EXTERNAL_CODECS
-static void PrintString(CStdOutStream &stdStream, const AString &s, int size)
-{
-  int len = s.Length();
-  stdStream << s;
-  for (int i = len; i < size; i++)
-    stdStream << ' ';
-}
-#endif
-
-static void PrintString(CStdOutStream &stdStream, const UString &s, int size)
-{
-  int len = s.Length();
-  stdStream << s;
-  for (int i = len; i < size; i++)
-    stdStream << ' ';
-}
-
-static inline char GetHex(Byte value)
-{
-  return (char)((value < 10) ? ('0' + value) : ('A' + (value - 10)));
-}
-
-const char *kUnsupportedArcTypeMessage = "Unsupported archive type";
-
-int Main2(
-  #ifndef _WIN32
-  int numArguments, const char *arguments[]
-  #endif
-)
-{
-  #ifdef _WIN32
-  SetFileApisToOEM();
-  #endif
-  
-  UStringVector commandStrings;
-  #ifdef _WIN32
-  NCommandLineParser::SplitCommandLine(GetCommandLineW(), commandStrings);
-  #else
-  GetArguments(numArguments, arguments, commandStrings);
-  #endif
-
-  if(commandStrings.Size() == 1)
-  {
-    ShowCopyrightAndHelp(g_StdOut, true);
-    return 0;
-  }
-  commandStrings.Delete(0);
-
-  CArchiveCommandLineOptions options;
-
-  CArchiveCommandLineParser parser;
-
-  parser.Parse1(commandStrings, options);
-
-  if(options.HelpMode)
-  {
-    ShowCopyrightAndHelp(g_StdOut, true);
-    return 0;
-  }
-
-  #if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
-  if (options.LargePages)
-  {
-    SetLargePageSize();
-    NSecurity::EnableLockMemoryPrivilege();
-  }
-  #endif
-
-  CStdOutStream &stdStream = options.StdOutMode ? g_StdErr : g_StdOut;
-  g_StdStream = &stdStream;
-
-  if (options.EnableHeaders)
-    ShowCopyrightAndHelp(stdStream, false);
-
-  parser.Parse2(options);
-
-  CCodecs *codecs = new CCodecs;
-  CMyComPtr<
-    #ifdef EXTERNAL_CODECS
-    ICompressCodecsInfo
-    #else
-    IUnknown
-    #endif
-    > compressCodecsInfo = codecs;
-  HRESULT result = codecs->Load();
-  if (result != S_OK)
-    throw CSystemException(result);
-
-  bool isExtractGroupCommand = options.Command.IsFromExtractGroup();
-
-  if (codecs->Formats.Size() == 0 &&
-        (isExtractGroupCommand ||
-        options.Command.CommandType == NCommandType::kList ||
-        options.Command.IsFromUpdateGroup()))
-    throw kNoFormats;
-
-  CIntVector formatIndices;
-  if (!codecs->FindFormatForArchiveType(options.ArcType, formatIndices))
-    throw kUnsupportedArcTypeMessage;
-
-  if (options.Command.CommandType == NCommandType::kInfo)
-  {
-    stdStream << endl << "Formats:" << endl;
-    int i;
-    for (i = 0; i < codecs->Formats.Size(); i++)
-    {
-      const CArcInfoEx &arc = codecs->Formats[i];
-      #ifdef EXTERNAL_CODECS
-      if (arc.LibIndex >= 0)
-      {
-        char s[32];
-        ConvertUInt64ToString(arc.LibIndex, s);
-        PrintString(stdStream, s, 2);
-      }
-      else
-      #endif
-        stdStream << "  ";
-      stdStream << ' ';
-      stdStream << (char)(arc.UpdateEnabled ? 'C' : ' ');
-      stdStream << (char)(arc.KeepName ? 'K' : ' ');
-      stdStream << "  ";
-      PrintString(stdStream, arc.Name, 6);
-      stdStream << "  ";
-      UString s;
-      for (int t = 0; t < arc.Exts.Size(); t++)
-      {
-        const CArcExtInfo &ext = arc.Exts[t];
-        s += ext.Ext;
-        if (!ext.AddExt.IsEmpty())
-        {
-          s += L" (";
-          s += ext.AddExt;
-          s += L')';
-        }
-        s += L' ';
-      }
-      PrintString(stdStream, s, 14);
-      stdStream << "  ";
-      const CByteBuffer &sig = arc.StartSignature;
-      for (size_t j = 0; j < sig.GetCapacity(); j++)
-      {
-        Byte b = sig[j];
-        if (b > 0x20 && b < 0x80)
-        {
-          stdStream << (char)b;
-        }
-        else
-        {
-          stdStream << GetHex((Byte)((b >> 4) & 0xF));
-          stdStream << GetHex((Byte)(b & 0xF));
-        }
-        stdStream << ' ';
-      }
-      stdStream << endl;
-    }
-    stdStream << endl << "Codecs:" << endl;
-
-    #ifdef EXTERNAL_CODECS
-    UInt32 numMethods;
-    if (codecs->GetNumberOfMethods(&numMethods) == S_OK)
-    for (UInt32 j = 0; j < numMethods; j++)
-    {
-      int libIndex = codecs->GetCodecLibIndex(j);
-      if (libIndex >= 0)
-      {
-        char s[32];
-        ConvertUInt64ToString(libIndex, s);
-        PrintString(stdStream, s, 2);
-      }
-      else
-        stdStream << "  ";
-      stdStream << ' ';
-      stdStream << (char)(codecs->GetCodecEncoderIsAssigned(j) ? 'C' : ' ');
-      UInt64 id;
-      stdStream << "  ";
-      HRESULT res = codecs->GetCodecId(j, id);
-      if (res != S_OK)
-        id = (UInt64)(Int64)-1;
-      char s[32];
-      ConvertUInt64ToString(id, s, 16);
-      PrintString(stdStream, s, 8);
-      stdStream << "  ";
-      PrintString(stdStream, codecs->GetCodecName(j), 11);
-      stdStream << endl;
-      /*
-      if (res != S_OK)
-        throw "incorrect Codec ID";
-      */
-    }
-    #endif
-    return S_OK;
-  }
-  else if (options.Command.CommandType == NCommandType::kBenchmark)
-  {
-    if (options.Method.CompareNoCase(L"CRC") == 0)
-    {
-      HRESULT res = CrcBenchCon((FILE *)stdStream, options.NumIterations, options.NumThreads, options.DictionarySize);
-      if (res != S_OK)
-      {
-        if (res == S_FALSE)
-        {
-          stdStream << "\nCRC Error\n";
-          return NExitCode::kFatalError;
-        }
-        throw CSystemException(res);
-      }
-    }
-    else
-    {
-      HRESULT res = LzmaBenchCon(
-        #ifdef EXTERNAL_LZMA
-        codecs,
-        #endif
-        (FILE *)stdStream, options.NumIterations, options.NumThreads, options.DictionarySize);
-      if (res != S_OK)
-      {
-        if (res == S_FALSE)
-        {
-          stdStream << "\nDecoding Error\n";
-          return NExitCode::kFatalError;
-        }
-        throw CSystemException(res);
-      }
-    }
-  }
-  else if (isExtractGroupCommand || options.Command.CommandType == NCommandType::kList)
-  {
-    if(isExtractGroupCommand)
-    {
-      CExtractCallbackConsole *ecs = new CExtractCallbackConsole;
-      CMyComPtr<IFolderArchiveExtractCallback> extractCallback = ecs;
-
-      ecs->OutStream = &stdStream;
-
-      #ifndef _NO_CRYPTO
-      ecs->PasswordIsDefined = options.PasswordEnabled;
-      ecs->Password = options.Password;
-      #endif
-
-      ecs->Init();
-
-      COpenCallbackConsole openCallback;
-      openCallback.OutStream = &stdStream;
-
-      #ifndef _NO_CRYPTO
-      openCallback.PasswordIsDefined = options.PasswordEnabled;
-      openCallback.Password = options.Password;
-      #endif
-
-      CExtractOptions eo;
-      eo.StdOutMode = options.StdOutMode;
-      eo.PathMode = options.Command.GetPathMode();
-      eo.TestMode = options.Command.IsTestMode();
-      eo.OverwriteMode = options.OverwriteMode;
-      eo.OutputDir = options.OutputDir;
-      eo.YesToAll = options.YesToAll;
-      #ifdef COMPRESS_MT
-      eo.Properties = options.ExtractProperties;
-      #endif
-      UString errorMessage;
-      CDecompressStat stat;
-      HRESULT result = DecompressArchives(
-          codecs,
-          formatIndices,
-          options.ArchivePathsSorted,
-          options.ArchivePathsFullSorted,
-          options.WildcardCensor.Pairs.Front().Head,
-          eo, &openCallback, ecs, errorMessage, stat);
-      if (!errorMessage.IsEmpty())
-      {
-        stdStream << endl << "Error: " << errorMessage;
-        if (result == S_OK)
-          result = E_FAIL;
-      }
-
-      stdStream << endl;
-      if (ecs->NumArchives > 1)
-        stdStream << "Archives: " << ecs->NumArchives << endl;
-      if (ecs->NumArchiveErrors != 0 || ecs->NumFileErrors != 0)
-      {
-        if (ecs->NumArchives > 1)
-        {
-          stdStream << endl;
-          if (ecs->NumArchiveErrors != 0)
-            stdStream << "Archive Errors: " << ecs->NumArchiveErrors << endl;
-          if (ecs->NumFileErrors != 0)
-            stdStream << "Sub items Errors: " << ecs->NumFileErrors << endl;
-        }
-        if (result != S_OK)
-          throw CSystemException(result);
-        return NExitCode::kFatalError;
-      }
-      if (result != S_OK)
-        throw CSystemException(result);
-      if (stat.NumFolders != 0)
-        stdStream << "Folders: " << stat.NumFolders << endl;
-      if (stat.NumFiles != 1 || stat.NumFolders != 0)
-          stdStream << "Files: " << stat.NumFiles << endl;
-      stdStream
-           << "Size:       " << stat.UnpackSize << endl
-           << "Compressed: " << stat.PackSize << endl;
-    }
-    else
-    {
-      UInt64 numErrors = 0;
-      HRESULT result = ListArchives(
-          codecs,
-          formatIndices,
-          options.ArchivePathsSorted,
-          options.ArchivePathsFullSorted,
-          options.WildcardCensor.Pairs.Front().Head,
-          options.EnableHeaders,
-          options.TechMode,
-          #ifndef _NO_CRYPTO
-          options.PasswordEnabled,
-          options.Password,
-          #endif
-          numErrors);
-      if (numErrors > 0)
-      {
-        g_StdOut << endl << "Errors: " << numErrors;
-        return NExitCode::kFatalError;
-      }
-      if (result != S_OK)
-        throw CSystemException(result);
-    }
-  }
-  else if(options.Command.IsFromUpdateGroup())
-  {
-    UString workingDir;
-
-    CUpdateOptions &uo = options.UpdateOptions;
-    if (uo.SfxMode && uo.SfxModule.IsEmpty())
-      uo.SfxModule = kDefaultSfxModule;
-
-    COpenCallbackConsole openCallback;
-    openCallback.OutStream = &stdStream;
-
-    #ifndef _NO_CRYPTO
-    bool passwordIsDefined =
-        options.PasswordEnabled && !options.Password.IsEmpty();
-    openCallback.PasswordIsDefined = passwordIsDefined;
-    openCallback.Password = options.Password;
-    #endif
-
-    CUpdateCallbackConsole callback;
-    callback.EnablePercents = options.EnablePercents;
-
-    #ifndef _NO_CRYPTO
-    callback.PasswordIsDefined = passwordIsDefined;
-    callback.AskPassword = options.PasswordEnabled && options.Password.IsEmpty();
-    callback.Password = options.Password;
-    #endif
-    callback.StdOutMode = uo.StdOutMode;
-    callback.Init(&stdStream);
-
-    CUpdateErrorInfo errorInfo;
-
-    if (!uo.Init(codecs, formatIndices, options.ArchiveName))
-      throw kUnsupportedArcTypeMessage;
-    HRESULT result = UpdateArchive(codecs,
-        options.WildcardCensor, uo,
-        errorInfo, &openCallback, &callback);
-
-    int exitCode = NExitCode::kSuccess;
-    if (callback.CantFindFiles.Size() > 0)
-    {
-      stdStream << endl;
-      stdStream << "WARNINGS for files:" << endl << endl;
-      int numErrors = callback.CantFindFiles.Size();
-      for (int i = 0; i < numErrors; i++)
-      {
-        stdStream << callback.CantFindFiles[i] << " : ";
-        stdStream << NError::MyFormatMessageW(callback.CantFindCodes[i]) << endl;
-      }
-      stdStream << "----------------" << endl;
-      stdStream << "WARNING: Cannot find " << numErrors << " file";
-      if (numErrors > 1)
-        stdStream << "s";
-      stdStream << endl;
-      exitCode = NExitCode::kWarning;
-    }
-
-    if (result != S_OK)
-    {
-      UString message;
-      if (!errorInfo.Message.IsEmpty())
-      {
-        message += errorInfo.Message;
-        message += L"\n";
-      }
-      if (!errorInfo.FileName.IsEmpty())
-      {
-        message += errorInfo.FileName;
-        message += L"\n";
-      }
-      if (!errorInfo.FileName2.IsEmpty())
-      {
-        message += errorInfo.FileName2;
-        message += L"\n";
-      }
-      if (errorInfo.SystemError != 0)
-      {
-        message += NError::MyFormatMessageW(errorInfo.SystemError);
-        message += L"\n";
-      }
-      if (!message.IsEmpty())
-        stdStream << L"\nError:\n" << message;
-      throw CSystemException(result);
-    }
-    int numErrors = callback.FailedFiles.Size();
-    if (numErrors == 0)
-    {
-      if (callback.CantFindFiles.Size() == 0)
-        stdStream << kEverythingIsOk << endl;
-    }
-    else
-    {
-      stdStream << endl;
-      stdStream << "WARNINGS for files:" << endl << endl;
-      for (int i = 0; i < numErrors; i++)
-      {
-        stdStream << callback.FailedFiles[i] << " : ";
-        stdStream << NError::MyFormatMessageW(callback.FailedCodes[i]) << endl;
-      }
-      stdStream << "----------------" << endl;
-      stdStream << "WARNING: Cannot open " << numErrors << " file";
-      if (numErrors > 1)
-        stdStream << "s";
-      stdStream << endl;
-      exitCode = NExitCode::kWarning;
-    }
-    return exitCode;
-  }
-  else
-    PrintHelpAndExit(stdStream);
-  return 0;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/MainAr.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/MainAr.cpp
deleted file mode 100644
index 02918d7..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/MainAr.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-// MainAr.cpp
-
-#include "StdAfx.h"
-
-// #include <locale.h>
-
-#include "Windows/Error.h"
-
-#include "Common/StdOutStream.h"
-#include "Common/NewHandler.h"
-#include "Common/MyException.h"
-#include "Common/StringConvert.h"
-
-#include "../Common/ExitCode.h"
-#include "../Common/ArchiveCommandLine.h"
-#include "ConsoleClose.h"
-
-using namespace NWindows;
-
-CStdOutStream *g_StdStream = 0;
-
-#ifdef _WIN32
-#ifndef _UNICODE
-bool g_IsNT = false;
-#endif
-#if !defined(_UNICODE) || !defined(_WIN64)
-static inline bool IsItWindowsNT()
-{
-  OSVERSIONINFO versionInfo;
-  versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
-  if (!::GetVersionEx(&versionInfo))
-    return false;
-  return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
-}
-#endif
-#endif
-
-extern int Main2(
-  #ifndef _WIN32
-  int numArguments, const char *arguments[]
-  #endif
-);
-
-static const char *kExceptionErrorMessage = "\n\nError:\n";
-static const char *kUserBreak  = "\nBreak signaled\n";
-
-static const char *kMemoryExceptionMessage = "\n\nERROR: Can't allocate required memory!\n";
-static const char *kUnknownExceptionMessage = "\n\nUnknown Error\n";
-static const char *kInternalExceptionMessage = "\n\nInternal Error #";
-
-int MY_CDECL main
-(
-#ifndef _WIN32
-int numArguments, const char *arguments[]
-#endif
-)
-{
-  g_StdStream = &g_StdOut;
-  #ifdef _WIN32
-  
-  #ifdef _UNICODE
-  #ifndef _WIN64
-  if (!IsItWindowsNT())
-  {
-    (*g_StdStream) << "This program requires Windows NT/2000/2003/2008/XP/Vista";
-    return NExitCode::kFatalError;
-  }
-  #endif
-  #else
-  g_IsNT = IsItWindowsNT();
-  #endif
-  
-  #endif
-
-  // setlocale(LC_COLLATE, ".OCP");
-  NConsoleClose::CCtrlHandlerSetter ctrlHandlerSetter;
-  int res = 0;
-  try
-  {
-    res = Main2(
-#ifndef _WIN32
-      numArguments, arguments
-#endif
-    );
-  }
-  catch(const CNewException &)
-  {
-    (*g_StdStream) << kMemoryExceptionMessage;
-    return (NExitCode::kMemoryError);
-  }
-  catch(const NConsoleClose::CCtrlBreakException &)
-  {
-    (*g_StdStream) << endl << kUserBreak;
-    return (NExitCode::kUserBreak);
-  }
-  catch(const CArchiveCommandLineException &e)
-  {
-    (*g_StdStream) << kExceptionErrorMessage << e << endl;
-    return (NExitCode::kUserError);
-  }
-  catch(const CSystemException &systemError)
-  {
-    if (systemError.ErrorCode == E_OUTOFMEMORY)
-    {
-      (*g_StdStream) << kMemoryExceptionMessage;
-      return (NExitCode::kMemoryError);
-    }
-    if (systemError.ErrorCode == E_ABORT)
-    {
-      (*g_StdStream) << endl << kUserBreak;
-      return (NExitCode::kUserBreak);
-    }
-    UString message;
-    NError::MyFormatMessage(systemError.ErrorCode, message);
-    (*g_StdStream) << endl << endl << "System error:" << endl <<
-        message << endl;
-    return (NExitCode::kFatalError);
-  }
-  catch(NExitCode::EEnum &exitCode)
-  {
-    (*g_StdStream) << kInternalExceptionMessage << exitCode << endl;
-    return (exitCode);
-  }
-  /*
-  catch(const NExitCode::CMultipleErrors &multipleErrors)
-  {
-    (*g_StdStream) << endl << multipleErrors.NumErrors << " errors" << endl;
-    return (NExitCode::kFatalError);
-  }
-  */
-  catch(const UString &s)
-  {
-    (*g_StdStream) << kExceptionErrorMessage << s << endl;
-    return (NExitCode::kFatalError);
-  }
-  catch(const AString &s)
-  {
-    (*g_StdStream) << kExceptionErrorMessage << s << endl;
-    return (NExitCode::kFatalError);
-  }
-  catch(const char *s)
-  {
-    (*g_StdStream) << kExceptionErrorMessage << s << endl;
-    return (NExitCode::kFatalError);
-  }
-  catch(int t)
-  {
-    (*g_StdStream) << kInternalExceptionMessage << t << endl;
-    return (NExitCode::kFatalError);
-  }
-  catch(...)
-  {
-    (*g_StdStream) << kUnknownExceptionMessage;
-    return (NExitCode::kFatalError);
-  }
-  return  res;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/OpenCallbackConsole.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/OpenCallbackConsole.cpp
deleted file mode 100644
index 7dba2ad..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/OpenCallbackConsole.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-// OpenCallbackConsole.cpp
-
-#include "StdAfx.h"
-
-#include "OpenCallbackConsole.h"
-
-#include "ConsoleClose.h"
-#include "UserInputUtils.h"
-
-HRESULT COpenCallbackConsole::Open_CheckBreak()
-{
-  if (NConsoleClose::TestBreakSignal())
-    return E_ABORT;
-  return S_OK;
-}
-
-HRESULT COpenCallbackConsole::Open_SetTotal(const UInt64 *, const UInt64 *)
-{
-  return Open_CheckBreak();
-}
-
-HRESULT COpenCallbackConsole::Open_SetCompleted(const UInt64 *, const UInt64 *)
-{
-  return Open_CheckBreak();
-}
- 
-#ifndef _NO_CRYPTO
-
-HRESULT COpenCallbackConsole::Open_CryptoGetTextPassword(BSTR *password)
-{
-  PasswordWasAsked = true;
-  RINOK(Open_CheckBreak());
-  if (!PasswordIsDefined)
-  {
-    Password = GetPassword(OutStream);
-    PasswordIsDefined = true;
-  }
-  return StringToBstr(Password, password);
-}
-
-HRESULT COpenCallbackConsole::Open_GetPasswordIfAny(UString &password)
-{
-  if (PasswordIsDefined)
-    password = Password;
-  return S_OK;
-}
-
-bool COpenCallbackConsole::Open_WasPasswordAsked()
-{
-  return PasswordWasAsked;
-}
-
-void COpenCallbackConsole::Open_ClearPasswordWasAskedFlag()
-{
-  PasswordWasAsked = false;
-}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/OpenCallbackConsole.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/OpenCallbackConsole.h
deleted file mode 100644
index c002e6a..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/OpenCallbackConsole.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// OpenCallbackConsole.h
-
-#ifndef __OPENCALLBACKCONSOLE_H
-#define __OPENCALLBACKCONSOLE_H
-
-#include "Common/StdOutStream.h"
-#include "../Common/ArchiveOpenCallback.h"
-
-class COpenCallbackConsole: public IOpenCallbackUI
-{
-public:
-  INTERFACE_IOpenCallbackUI(;)
-  
-  CStdOutStream *OutStream;
-
-  #ifndef _NO_CRYPTO
-  bool PasswordIsDefined;
-  bool PasswordWasAsked;
-  UString Password;
-  COpenCallbackConsole(): PasswordIsDefined(false), PasswordWasAsked(false) {}
-  #endif
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/PercentPrinter.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/PercentPrinter.cpp
deleted file mode 100644
index 28452b1..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/PercentPrinter.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-// PercentPrinter.cpp
-
-#include "StdAfx.h"
-
-#include "Common/IntToString.h"
-#include "Common/MyString.h"
-
-#include "PercentPrinter.h"
-
-const int kPaddingSize = 2;
-const int kPercentsSize = 4;
-const int kMaxExtraSize = kPaddingSize + 32 + kPercentsSize;
-
-static void ClearPrev(char *p, int num)
-{
-  int i;
-  for (i = 0; i < num; i++) *p++ = '\b';
-  for (i = 0; i < num; i++) *p++ = ' ';
-  for (i = 0; i < num; i++) *p++ = '\b';
-  *p = '\0';
-}
-
-void CPercentPrinter::ClosePrint()
-{
-  if (m_NumExtraChars == 0)
-    return;
-  char s[kMaxExtraSize * 3 + 1];
-  ClearPrev(s, m_NumExtraChars);
-  (*OutStream) << s;
-  m_NumExtraChars = 0;
-}
-
-void CPercentPrinter::PrintString(const char *s)
-{
-  ClosePrint();
-  (*OutStream) << s;
-}
-
-void CPercentPrinter::PrintString(const wchar_t *s)
-{
-  ClosePrint();
-  (*OutStream) << s;
-}
-
-void CPercentPrinter::PrintNewLine()
-{
-  ClosePrint();
-  (*OutStream) << "\n";
-}
-
-void CPercentPrinter::RePrintRatio()
-{
-  char s[32];
-  ConvertUInt64ToString(((m_Total == 0) ? 0 : (m_CurValue * 100 / m_Total)), s);
-  int size = (int)strlen(s);
-  s[size++] = '%';
-  s[size] = '\0';
-
-  int extraSize = kPaddingSize + MyMax(size, kPercentsSize);
-  if (extraSize < m_NumExtraChars)
-    extraSize = m_NumExtraChars;
-
-  char fullString[kMaxExtraSize * 3];
-  char *p = fullString;
-  int i;
-  if (m_NumExtraChars == 0)
-  {
-    for (i = 0; i < extraSize; i++)
-      *p++ = ' ';
-    m_NumExtraChars = extraSize;
-  }
-
-  for (i = 0; i < m_NumExtraChars; i++)
-    *p++ = '\b';
-  m_NumExtraChars = extraSize;
-  for (; size < m_NumExtraChars; size++)
-    *p++ = ' ';
-  MyStringCopy(p, s);
-  (*OutStream) << fullString;
-  OutStream->Flush();
-  m_PrevValue = m_CurValue;
-}
-
-void CPercentPrinter::PrintRatio()
-{
-  if (m_CurValue < m_PrevValue + m_MinStepSize &&
-      m_CurValue + m_MinStepSize > m_PrevValue && m_NumExtraChars != 0)
-    return;
-  RePrintRatio();
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/PercentPrinter.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/PercentPrinter.h
deleted file mode 100644
index 97f2e6a..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/PercentPrinter.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// PercentPrinter.h
-
-#ifndef __PERCENTPRINTER_H
-#define __PERCENTPRINTER_H
-
-#include "Common/Types.h"
-#include "Common/StdOutStream.h"
-
-class CPercentPrinter
-{
-  UInt64 m_MinStepSize;
-  UInt64 m_PrevValue;
-  UInt64 m_CurValue;
-  UInt64 m_Total;
-  int m_NumExtraChars;
-public:
-  CStdOutStream *OutStream;
-
-  CPercentPrinter(UInt64 minStepSize = 1): m_MinStepSize(minStepSize),
-      m_PrevValue(0), m_CurValue(0), m_Total(1), m_NumExtraChars(0) {}
-  void SetTotal(UInt64 total) { m_Total = total; m_PrevValue = 0; }
-  void SetRatio(UInt64 doneValue) { m_CurValue = doneValue; }
-  void PrintString(const char *s);
-  void PrintString(const wchar_t *s);
-  void PrintNewLine();
-  void ClosePrint();
-  void RePrintRatio();
-  void PrintRatio();
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/StdAfx.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/StdAfx.cpp
deleted file mode 100644
index d0feea8..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/StdAfx.cpp
+++ /dev/null
@@ -1,3 +0,0 @@
-// StdAfx.cpp
-
-#include "StdAfx.h"
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/StdAfx.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/StdAfx.h
deleted file mode 100644
index 2e4be10..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/StdAfx.h
+++ /dev/null
@@ -1,9 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-#include "../../../Common/NewHandler.h"
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp
deleted file mode 100644
index bf22d34..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp
+++ /dev/null
@@ -1,238 +0,0 @@
-// UpdateCallbackConsole.cpp
-
-#include "StdAfx.h"
-
-#include "UpdateCallbackConsole.h"
-
-#include "Windows/Error.h"
-#ifdef COMPRESS_MT
-#include "Windows/Synchronization.h"
-#endif
-
-#include "ConsoleClose.h"
-#include "UserInputUtils.h"
-
-using namespace NWindows;
-
-#ifdef COMPRESS_MT
-static NSynchronization::CCriticalSection g_CriticalSection;
-#define MT_LOCK NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
-#else
-#define MT_LOCK
-#endif
-
-static const wchar_t *kEmptyFileAlias = L"[Content]";
-
-static const char *kCreatingArchiveMessage = "Creating archive ";
-static const char *kUpdatingArchiveMessage = "Updating archive ";
-static const char *kScanningMessage = "Scanning";
-
-
-HRESULT CUpdateCallbackConsole::OpenResult(const wchar_t *name, HRESULT result)
-{
-  (*OutStream) << endl;
-  if (result != S_OK)
-    (*OutStream) << "Error: " << name << " is not supported archive" << endl;
-  return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::StartScanning()
-{
-  (*OutStream) << kScanningMessage;
-  return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::ScanProgress(UInt64 /* numFolders */, UInt64 /* numFiles */, const wchar_t * /* path */)
-{
-  return CheckBreak();
-}
-
-HRESULT CUpdateCallbackConsole::CanNotFindError(const wchar_t *name, DWORD systemError)
-{
-  CantFindFiles.Add(name);
-  CantFindCodes.Add(systemError);
-  // m_PercentPrinter.ClosePrint();
-  if (!m_WarningsMode)
-  {
-    (*OutStream) << endl << endl;
-    m_PercentPrinter.PrintNewLine();
-    m_WarningsMode = true;
-  }
-  m_PercentPrinter.PrintString(name);
-  m_PercentPrinter.PrintString(":  WARNING: ");
-  m_PercentPrinter.PrintString(NError::MyFormatMessageW(systemError));
-  m_PercentPrinter.PrintNewLine();
-  return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::FinishScanning()
-{
-  (*OutStream) << endl << endl;
-  return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::StartArchive(const wchar_t *name, bool updating)
-{
-  if(updating)
-    (*OutStream) << kUpdatingArchiveMessage;
-  else
-    (*OutStream) << kCreatingArchiveMessage;
-  if (name != 0)
-    (*OutStream) << name;
-  else
-    (*OutStream) << "StdOut";
-  (*OutStream) << endl << endl;
-  return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::FinishArchive()
-{
-  (*OutStream) << endl;
-  return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::CheckBreak()
-{
-  if (NConsoleClose::TestBreakSignal())
-    return E_ABORT;
-  return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::Finilize()
-{
-  MT_LOCK
-  if (m_NeedBeClosed)
-  {
-    if (EnablePercents)
-    {
-      m_PercentPrinter.ClosePrint();
-    }
-    if (!StdOutMode && m_NeedNewLine)
-    {
-      m_PercentPrinter.PrintNewLine();
-      m_NeedNewLine = false;
-    }
-    m_NeedBeClosed = false;
-  }
-  return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::SetNumFiles(UInt64 /* numFiles */)
-{
-  return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::SetTotal(UInt64 size)
-{
-  MT_LOCK
-  if (EnablePercents)
-    m_PercentPrinter.SetTotal(size);
-  return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::SetCompleted(const UInt64 *completeValue)
-{
-  MT_LOCK
-  if (completeValue != NULL)
-  {
-    if (EnablePercents)
-    {
-      m_PercentPrinter.SetRatio(*completeValue);
-      m_PercentPrinter.PrintRatio();
-      m_NeedBeClosed = true;
-    }
-  }
-  if (NConsoleClose::TestBreakSignal())
-    return E_ABORT;
-  return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::SetRatioInfo(const UInt64 * /* inSize */, const UInt64 * /* outSize */)
-{
-  if (NConsoleClose::TestBreakSignal())
-    return E_ABORT;
-  return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::GetStream(const wchar_t *name, bool isAnti)
-{
-  MT_LOCK
-  if (StdOutMode)
-    return S_OK;
-  if(isAnti)
-    m_PercentPrinter.PrintString("Anti item    ");
-  else
-    m_PercentPrinter.PrintString("Compressing  ");
-  if (name[0] == 0)
-    name = kEmptyFileAlias;
-  m_PercentPrinter.PrintString(name);
-  if (EnablePercents)
-    m_PercentPrinter.RePrintRatio();
-  return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::OpenFileError(const wchar_t *name, DWORD systemError)
-{
-  MT_LOCK
-  FailedCodes.Add(systemError);
-  FailedFiles.Add(name);
-  // if (systemError == ERROR_SHARING_VIOLATION)
-  {
-    m_PercentPrinter.ClosePrint();
-    m_PercentPrinter.PrintNewLine();
-    m_PercentPrinter.PrintString("WARNING: ");
-    m_PercentPrinter.PrintString(NError::MyFormatMessageW(systemError));
-    return S_FALSE;
-  }
-  // return systemError;
-}
-
-HRESULT CUpdateCallbackConsole::SetOperationResult(Int32 )
-{
-  m_NeedBeClosed = true;
-  m_NeedNewLine = true;
-  return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
-{
-  #ifdef _NO_CRYPTO
-
-  *passwordIsDefined = false;
-  return StringToBstr(L"", password);
-  
-  #else
-  
-  if (!PasswordIsDefined)
-  {
-    if (AskPassword)
-    {
-      Password = GetPassword(OutStream);
-      PasswordIsDefined = true;
-    }
-  }
-  *passwordIsDefined = BoolToInt(PasswordIsDefined);
-  return StringToBstr(Password, password);
-  
-  #endif
-  
-}
-
-/*
-HRESULT CUpdateCallbackConsole::ShowDeleteFile(const wchar_t *name)
-{
-  // MT_LOCK
-  if (StdOutMode)
-    return S_OK;
-  RINOK(Finilize());
-  m_PercentPrinter.PrintString("Deleting  ");
-  if (name[0] == 0)
-    name = kEmptyFileAlias;
-  m_PercentPrinter.PrintString(name);
-  if (EnablePercents)
-    m_PercentPrinter.RePrintRatio();
-  m_NeedBeClosed = true;
-  m_NeedNewLine = true;
-  return S_OK;
-}
-*/
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/UpdateCallbackConsole.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/UpdateCallbackConsole.h
deleted file mode 100644
index da8d8cc..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/UpdateCallbackConsole.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// UpdateCallbackConsole.h
-
-#ifndef __UPDATECALLBACKCONSOLE_H
-#define __UPDATECALLBACKCONSOLE_H
-
-#include "Common/MyString.h"
-#include "Common/StdOutStream.h"
-#include "PercentPrinter.h"
-#include "../Common/Update.h"
-
-class CUpdateCallbackConsole: public IUpdateCallbackUI2
-{
-  CPercentPrinter m_PercentPrinter;
-  bool m_NeedBeClosed;
-  bool m_NeedNewLine;
-
-  bool m_WarningsMode;
-
-  CStdOutStream *OutStream;
-public:
-  bool EnablePercents;
-  bool StdOutMode;
-
-  #ifndef _NO_CRYPTO
-  bool PasswordIsDefined;
-  UString Password;
-  bool AskPassword;
-  #endif
-
-  CUpdateCallbackConsole():
-      m_PercentPrinter(1 << 16),
-      #ifndef _NO_CRYPTO
-      PasswordIsDefined(false),
-      AskPassword(false),
-      #endif
-      StdOutMode(false),
-      EnablePercents(true),
-      m_WarningsMode(false)
-      {}
-  
-  ~CUpdateCallbackConsole() { Finilize(); }
-  void Init(CStdOutStream *outStream)
-  {
-    m_NeedBeClosed = false;
-    m_NeedNewLine = false;
-    FailedFiles.Clear();
-    FailedCodes.Clear();
-    OutStream = outStream;
-    m_PercentPrinter.OutStream = outStream;
-  }
-
-  INTERFACE_IUpdateCallbackUI2(;)
-
-  UStringVector FailedFiles;
-  CRecordVector<HRESULT> FailedCodes;
-
-  UStringVector CantFindFiles;
-  CRecordVector<HRESULT> CantFindCodes;
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/UserInputUtils.cpp b/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/UserInputUtils.cpp
deleted file mode 100644
index b85cd59..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/UserInputUtils.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-// UserInputUtils.cpp
-
-#include "StdAfx.h"
-
-#include "Common/StdInStream.h"
-#include "Common/StringConvert.h"
-
-#include "UserInputUtils.h"
-
-static const char kYes = 'Y';
-static const char kNo = 'N';
-static const char kYesAll = 'A';
-static const char kNoAll = 'S';
-static const char kAutoRenameAll = 'U';
-static const char kQuit = 'Q';
-
-static const char *kFirstQuestionMessage = "?\n";
-static const char *kHelpQuestionMessage =
-  "(Y)es / (N)o / (A)lways / (S)kip all / A(u)to rename all / (Q)uit? ";
-
-// return true if pressed Quite;
-
-NUserAnswerMode::EEnum ScanUserYesNoAllQuit(CStdOutStream *outStream)
-{
-  (*outStream) << kFirstQuestionMessage;
-  for(;;)
-  {
-    (*outStream) << kHelpQuestionMessage;
-    AString scannedString = g_StdIn.ScanStringUntilNewLine();
-    scannedString.Trim();
-    if(!scannedString.IsEmpty())
-      switch(::MyCharUpper(scannedString[0]))
-      {
-        case kYes:
-          return NUserAnswerMode::kYes;
-        case kNo:
-          return NUserAnswerMode::kNo;
-        case kYesAll:
-          return NUserAnswerMode::kYesAll;
-        case kNoAll:
-          return NUserAnswerMode::kNoAll;
-        case kAutoRenameAll:
-          return NUserAnswerMode::kAutoRenameAll;
-        case kQuit:
-          return NUserAnswerMode::kQuit;
-      }
-  }
-}
-
-UString GetPassword(CStdOutStream *outStream)
-{
-  (*outStream) << "\nEnter password:";
-  outStream->Flush();
-  AString oemPassword = g_StdIn.ScanStringUntilNewLine();
-  return MultiByteToUnicodeString(oemPassword, CP_OEMCP);
-}
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/UserInputUtils.h b/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/UserInputUtils.h
deleted file mode 100644
index 8b5232b..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/UserInputUtils.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// UserInputUtils.h
-
-#ifndef __USERINPUTUTILS_H
-#define __USERINPUTUTILS_H
-
-#include "Common/StdOutStream.h"
-
-namespace NUserAnswerMode {
-
-enum EEnum
-{
-  kYes,
-  kNo,
-  kYesAll,
-  kNoAll,
-  kAutoRenameAll,
-  kQuit
-};
-}
-
-NUserAnswerMode::EEnum ScanUserYesNoAllQuit(CStdOutStream *outStream);
-UString GetPassword(CStdOutStream *outStream);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/makefile b/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/makefile
deleted file mode 100644
index 01682e9..0000000
--- a/third_party/lzma/v4_65/files/CPP/7zip/UI/Console/makefile
+++ /dev/null
@@ -1,120 +0,0 @@
-PROG = 7z.exe
-LIBS = $(LIBS) user32.lib oleaut32.lib advapi32.lib
-CFLAGS = $(CFLAGS) -I ../../../  \
-  -DCOMPRESS_MT \
-  -DWIN_LONG_PATH \
-  -DEXTERNAL_LZMA \
-  -DEXTERNAL_CODECS \
-  -DBREAK_HANDLER \
-  -DBENCH_MT \
-  -D_7ZIP_LARGE_PAGES \
-
-CONSOLE_OBJS = \
-  $O\ConsoleClose.obj \
-  $O\ExtractCallbackConsole.obj \
-  $O\List.obj \
-  $O\Main.obj \
-  $O\MainAr.obj \
-  $O\OpenCallbackConsole.obj \
-  $O\PercentPrinter.obj \
-  $O\UpdateCallbackConsole.obj \
-  $O\UserInputUtils.obj \
-
-COMMON_OBJS = \
-  $O\CommandLineParser.obj \
-  $O\CRC.obj \
-  $O\IntToString.obj \
-  $O\ListFileUtils.obj \
-  $O\NewHandler.obj \
-  $O\StdInStream.obj \
-  $O\StdOutStream.obj \
-  $O\MyString.obj \
-  $O\StringConvert.obj \
-  $O\StringToInt.obj \
-  $O\UTFConvert.obj \
-  $O\MyVector.obj \
-  $O\Wildcard.obj \
-
-WIN_OBJS = \
-  $O\DLL.obj \
-  $O\Error.obj \
-  $O\FileDir.obj \
-  $O\FileFind.obj \
-  $O\FileIO.obj \
-  $O\FileName.obj \
-  $O\MemoryLock.obj \
-  $O\PropVariant.obj \
-  $O\PropVariantConversions.obj \
-  $O\Registry.obj \
-  $O\System.obj \
-  $O\Time.obj \
-
-7ZIP_COMMON_OBJS = \
-  $O\FilePathAutoRename.obj \
-  $O\FileStreams.obj \
-  $O\ProgressUtils.obj \
-  $O\StreamUtils.obj \
-
-UI_COMMON_OBJS = \
-  $O\ArchiveCommandLine.obj \
-  $O\ArchiveExtractCallback.obj \
-  $O\ArchiveOpenCallback.obj \
-  $O\DefaultName.obj \
-  $O\EnumDirItems.obj \
-  $O\Extract.obj \
-  $O\ExtractingFilePath.obj \
-  $O\LoadCodecs.obj \
-  $O\OpenArchive.obj \
-  $O\PropIDUtils.obj \
-  $O\SetProperties.obj \
-  $O\SortUtils.obj \
-  $O\TempFiles.obj \
-  $O\Update.obj \
-  $O\UpdateAction.obj \
-  $O\UpdateCallback.obj \
-  $O\UpdatePair.obj \
-  $O\UpdateProduce.obj \
-  $O\WorkDir.obj \
-
-LZMA_BENCH_OBJS = \
-  $O\LzmaBench.obj \
-  $O\LzmaBenchCon.obj \
-
-C_OBJS = \
-  $O\Alloc.obj \
-  $O\Threads.obj \
-
-!include "../../Crc2.mak"
-
-OBJS = \
-  $O\StdAfx.obj \
-  $(CONSOLE_OBJS) \
-  $(COMMON_OBJS) \
-  $(WIN_OBJS) \
-  $(7ZIP_COMMON_OBJS) \
-  $(UI_COMMON_OBJS) \
-  $O\CopyCoder.obj \
-  $(LZMA_BENCH_OBJS) \
-  $(C_OBJS) \
-  $(CRC_OBJS) \
-  $O\resource.res
-
-!include "../../../Build.mak"
-
-$(CONSOLE_OBJS): $(*B).cpp
-	$(COMPL)
-$(COMMON_OBJS): ../../../Common/$(*B).cpp
-	$(COMPL)
-$(WIN_OBJS): ../../../Windows/$(*B).cpp
-	$(COMPL)
-$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
-	$(COMPL)
-$(UI_COMMON_OBJS): ../Common/$(*B).cpp
-	$(COMPL)
-$O\CopyCoder.obj: ../../Compress/$(*B).cpp
-	$(COMPL)
-$(LZMA_BENCH_OBJS): ../../Compress/LZMA_Alone/$(*B).cpp
-	$(COMPL)
-$(C_OBJS): ../../../../C/$(*B).c
-	$(COMPL_O2)
-!include "../../Crc.mak"
diff --git a/third_party/lzma/v4_65/files/CPP/Build.mak b/third_party/lzma/v4_65/files/CPP/Build.mak
deleted file mode 100644
index 9d4ac52..0000000
--- a/third_party/lzma/v4_65/files/CPP/Build.mak
+++ /dev/null
@@ -1,71 +0,0 @@
-!IFDEF CPU
-!IFNDEF NO_BUFFEROVERFLOWU
-LIBS = $(LIBS) bufferoverflowU.lib
-!ENDIF
-!ENDIF
-
-
-!IFNDEF O
-!IFDEF CPU
-O=$(CPU)
-!ELSE
-O=O
-!ENDIF
-!ENDIF
-
-!IF "$(CPU)" != "IA64"
-!IF "$(CPU)" != "AMD64"
-MY_ML = ml
-!ELSE
-MY_ML = ml64
-!ENDIF
-!ENDIF
-
-COMPL_ASM = $(MY_ML) -c -Fo$O/ $**
-
-CFLAGS = $(CFLAGS) -nologo -c -Fo$O/ -WX -EHsc -Gr -Gy -GR-
-
-!IFDEF MY_STATIC_LINK
-!IFNDEF MY_SINGLE_THREAD
-CFLAGS = $(CFLAGS) -MT
-!ENDIF
-!ELSE
-CFLAGS = $(CFLAGS) -MD
-!ENDIF
-
-!IFDEF NEW_COMPILER
-CFLAGS = $(CFLAGS) -W4 -GS- -Zc:forScope
-!ELSE
-CFLAGS = $(CFLAGS) -W3
-!ENDIF
-
-CFLAGS_O1 = $(CFLAGS) -O1
-CFLAGS_O2 = $(CFLAGS) -O2
-
-LFLAGS = $(LFLAGS) -nologo -OPT:NOWIN98 -OPT:REF -OPT:ICF
-
-!IFDEF DEF_FILE
-LFLAGS = $(LFLAGS) -DLL -DEF:$(DEF_FILE)
-!ENDIF
-
-PROGPATH = $O\$(PROG)
-
-COMPL_O1   = $(CPP) $(CFLAGS_O1) $**
-COMPL_O2   = $(CPP) $(CFLAGS_O2) $**
-COMPL_PCH  = $(CPP) $(CFLAGS_O1) -Yc"StdAfx.h" -Fp$O/a.pch $**
-COMPL      = $(CPP) $(CFLAGS_O1) -Yu"StdAfx.h" -Fp$O/a.pch $**
-
-all: $(PROGPATH)
-
-clean:
-	-del /Q $(PROGPATH) $O\*.exe $O\*.dll $O\*.obj $O\*.lib $O\*.exp $O\*.res $O\*.pch
-
-$O:
-	if not exist "$O" mkdir "$O"
-
-$(PROGPATH): $O $(OBJS) $(DEF_FILE)
-	link $(LFLAGS) -out:$(PROGPATH) $(OBJS) $(LIBS)
-$O\resource.res: $(*B).rc
-	rc -fo$@ $**
-$O\StdAfx.obj: $(*B).cpp
-	$(COMPL_PCH)
diff --git a/third_party/lzma/v4_65/files/CPP/Common/AutoPtr.h b/third_party/lzma/v4_65/files/CPP/Common/AutoPtr.h
deleted file mode 100644
index 006d315..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/AutoPtr.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Common/AutoPtr.h
-
-#ifndef __COMMON_AUTOPTR_H
-#define __COMMON_AUTOPTR_H
-
-template<class T> class CMyAutoPtr
-{
-  T *_p;
-public:
-  CMyAutoPtr(T *p = 0) : _p(p) {}
-  CMyAutoPtr(CMyAutoPtr<T>& p): _p(p.release()) {}
-  CMyAutoPtr<T>& operator=(CMyAutoPtr<T>& p)
-  {
-    reset(p.release());
-    return (*this);
-  }
-  ~CMyAutoPtr() { delete _p; }
-  T& operator*() const { return *_p; }
-  // T* operator->() const { return (&**this); }
-  T* get() const { return _p; }
-  T* release()
-  {
-    T *tmp = _p;
-    _p = 0;
-    return tmp;
-  }
-  void reset(T* p = 0)
-  {
-    if (p != _p)
-      delete _p;
-    _p = p;
-  }
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/Buffer.h b/third_party/lzma/v4_65/files/CPP/Common/Buffer.h
deleted file mode 100644
index b6960fa..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/Buffer.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// Common/Buffer.h
-
-#ifndef __COMMON_BUFFER_H
-#define __COMMON_BUFFER_H
-
-#include "Defs.h"
-
-template <class T> class CBuffer
-{
-protected:
-  size_t _capacity;
-  T *_items;
-public:
-  void Free()
-  {
-    delete []_items;
-    _items = 0;
-    _capacity = 0;
-  }
-  CBuffer(): _capacity(0), _items(0) {};
-  CBuffer(const CBuffer &buffer): _capacity(0), _items(0) { *this = buffer; }
-  CBuffer(size_t size): _items(0),  _capacity(0) {  SetCapacity(size); }
-  virtual ~CBuffer() { delete []_items; }
-  operator T *() { return _items; };
-  operator const T *() const { return _items; };
-  size_t GetCapacity() const { return  _capacity; }
-  void SetCapacity(size_t newCapacity)
-  {
-    if (newCapacity == _capacity)
-      return;
-    T *newBuffer;
-    if (newCapacity > 0)
-    {
-      newBuffer = new T[newCapacity];
-      if (_capacity > 0)
-        memmove(newBuffer, _items, MyMin(_capacity, newCapacity) * sizeof(T));
-    }
-    else
-      newBuffer = 0;
-    delete []_items;
-    _items = newBuffer;
-    _capacity = newCapacity;
-  }
-  CBuffer& operator=(const CBuffer &buffer)
-  {
-    Free();
-    if (buffer._capacity > 0)
-    {
-      SetCapacity(buffer._capacity);
-      memmove(_items, buffer._items, buffer._capacity * sizeof(T));
-    }
-    return *this;
-  }
-};
-
-template <class T>
-bool operator==(const CBuffer<T>& b1, const CBuffer<T>& b2)
-{
-  if (b1.GetCapacity() != b2.GetCapacity())
-    return false;
-  for (size_t i = 0; i < b1.GetCapacity(); i++)
-    if (b1[i] != b2[i])
-      return false;
-  return true;
-}
-
-template <class T>
-bool operator!=(const CBuffer<T>& b1, const CBuffer<T>& b2)
-{
-  return !(b1 == b2);
-}
-
-typedef CBuffer<char> CCharBuffer;
-typedef CBuffer<wchar_t> CWCharBuffer;
-typedef CBuffer<unsigned char> CByteBuffer;
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/CRC.cpp b/third_party/lzma/v4_65/files/CPP/Common/CRC.cpp
deleted file mode 100644
index a1e54ec..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/CRC.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-// Common/CRC.cpp
-
-#include "StdAfx.h"
-
-extern "C"
-{
-#include "../../C/7zCrc.h"
-}
-
-struct CCRCTableInit { CCRCTableInit() { CrcGenerateTable(); } } g_CRCTableInit;
diff --git a/third_party/lzma/v4_65/files/CPP/Common/C_FileIO.cpp b/third_party/lzma/v4_65/files/CPP/Common/C_FileIO.cpp
deleted file mode 100644
index b4893d6..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/C_FileIO.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-// Common/C_FileIO.h
-
-#include "C_FileIO.h"
-
-#include <fcntl.h>
-#include <unistd.h>
-
-namespace NC {
-namespace NFile {
-namespace NIO {
-
-bool CFileBase::OpenBinary(const char *name, int flags)
-{
-  #ifdef O_BINARY
-  flags |= O_BINARY;
-  #endif
-  Close();
-  _handle = ::open(name, flags, 0666);
-  return _handle != -1;
-}
-
-bool CFileBase::Close()
-{
-  if (_handle == -1)
-    return true;
-  if (close(_handle) != 0)
-    return false;
-  _handle = -1;
-  return true;
-}
-
-bool CFileBase::GetLength(UInt64 &length) const
-{
-  off_t curPos = Seek(0, SEEK_CUR);
-  off_t lengthTemp = Seek(0, SEEK_END);
-  Seek(curPos, SEEK_SET);
-  length = (UInt64)lengthTemp;
-  return true;
-}
-
-off_t CFileBase::Seek(off_t distanceToMove, int moveMethod) const
-{
-  return ::lseek(_handle, distanceToMove, moveMethod);
-}
-
-/////////////////////////
-// CInFile
-
-bool CInFile::Open(const char *name)
-{
-  return CFileBase::OpenBinary(name, O_RDONLY);
-}
-
-bool CInFile::OpenShared(const char *name, bool)
-{
-  return Open(name);
-}
-
-ssize_t CInFile::Read(void *data, size_t size)
-{
-  return read(_handle, data, size);
-}
-
-/////////////////////////
-// COutFile
-
-bool COutFile::Create(const char *name, bool createAlways)
-{
-  if (createAlways)
-  {
-    Close();
-    _handle = ::creat(name, 0666);
-    return _handle != -1;
-  }
-  return OpenBinary(name, O_CREAT | O_EXCL | O_WRONLY);
-}
-
-bool COutFile::Open(const char *name, DWORD creationDisposition)
-{
-  return Create(name, false);
-}
-
-ssize_t COutFile::Write(const void *data, size_t size)
-{
-  return write(_handle, data, size);
-}
-
-}}}
diff --git a/third_party/lzma/v4_65/files/CPP/Common/C_FileIO.h b/third_party/lzma/v4_65/files/CPP/Common/C_FileIO.h
deleted file mode 100644
index 27aa568..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/C_FileIO.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Common/C_FileIO.h
-
-#ifndef __COMMON_C_FILEIO_H
-#define __COMMON_C_FILEIO_H
-
-#include <stdio.h>
-#include <sys/types.h>
-
-#include "Types.h"
-#include "MyWindows.h"
-
-namespace NC {
-namespace NFile {
-namespace NIO {
-
-class CFileBase
-{
-protected:
-  int _handle;
-  bool OpenBinary(const char *name, int flags);
-public:
-  CFileBase(): _handle(-1) {};
-  ~CFileBase() { Close(); }
-  bool Close();
-  bool GetLength(UInt64 &length) const;
-  off_t Seek(off_t distanceToMove, int moveMethod) const;
-};
-
-class CInFile: public CFileBase
-{
-public:
-  bool Open(const char *name);
-  bool OpenShared(const char *name, bool shareForWrite);
-  ssize_t Read(void *data, size_t size);
-};
-
-class COutFile: public CFileBase
-{
-public:
-  bool Create(const char *name, bool createAlways);
-  bool Open(const char *name, DWORD creationDisposition);
-  ssize_t Write(const void *data, size_t size);
-};
-
-}}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/ComTry.h b/third_party/lzma/v4_65/files/CPP/Common/ComTry.h
deleted file mode 100644
index 5153362..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/ComTry.h
+++ /dev/null
@@ -1,17 +0,0 @@
-// ComTry.h
-
-#ifndef __COM_TRY_H
-#define __COM_TRY_H
-
-#include "MyWindows.h"
-// #include "Exception.h"
-// #include "NewHandler.h"
-
-#define COM_TRY_BEGIN try {
-#define COM_TRY_END } catch(...) { return E_OUTOFMEMORY; }
-  
-  // catch(const CNewException &) { return E_OUTOFMEMORY; }\
-  // catch(const CSystemException &e) { return e.ErrorCode; }\
-  // catch(...) { return E_FAIL; }
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/CommandLineParser.cpp b/third_party/lzma/v4_65/files/CPP/Common/CommandLineParser.cpp
deleted file mode 100644
index 6de5e63..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/CommandLineParser.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-// CommandLineParser.cpp
-
-#include "StdAfx.h"
-
-#include "CommandLineParser.h"
-
-namespace NCommandLineParser {
-
-void SplitCommandLine(const UString &src, UString &dest1, UString &dest2)
-{
-  dest1.Empty();
-  dest2.Empty();
-  bool quoteMode = false;
-  int i;
-  for (i = 0; i < src.Length(); i++)
-  {
-    wchar_t c = src[i];
-    if (c == L'\"')
-      quoteMode = !quoteMode;
-    else if (c == L' ' && !quoteMode)
-    {
-      i++;
-      break;
-    }
-    else
-      dest1 += c;
-  }
-  dest2 = src.Mid(i);
-}
-
-void SplitCommandLine(const UString &s, UStringVector &parts)
-{
-  UString sTemp = s;
-  sTemp.Trim();
-  parts.Clear();
-  for (;;)
-  {
-    UString s1, s2;
-    SplitCommandLine(sTemp, s1, s2);
-    // s1.Trim();
-    // s2.Trim();
-    if (!s1.IsEmpty())
-      parts.Add(s1);
-    if (s2.IsEmpty())
-      break;
-    sTemp = s2;
-  }
-}
-
-
-static const wchar_t kSwitchID1 = '-';
-// static const wchar_t kSwitchID2 = '/';
-
-static const wchar_t kSwitchMinus = '-';
-static const wchar_t *kStopSwitchParsing = L"--";
-
-static bool IsItSwitchChar(wchar_t c)
-{
-  return (c == kSwitchID1 /*|| c == kSwitchID2 */);
-}
-
-CParser::CParser(int numSwitches):
-  _numSwitches(numSwitches)
-{
-  _switches = new CSwitchResult[_numSwitches];
-}
-
-CParser::~CParser()
-{
-  delete []_switches;
-}
-
-void CParser::ParseStrings(const CSwitchForm *switchForms,
-  const UStringVector &commandStrings)
-{
-  int numCommandStrings = commandStrings.Size();
-  bool stopSwitch = false;
-  for (int i = 0; i < numCommandStrings; i++)
-  {
-    const UString &s = commandStrings[i];
-    if (stopSwitch)
-      NonSwitchStrings.Add(s);
-    else
-      if (s == kStopSwitchParsing)
-        stopSwitch = true;
-      else
-        if (!ParseString(s, switchForms))
-          NonSwitchStrings.Add(s);
-  }
-}
-
-// if string contains switch then function updates switch structures
-// out: (string is a switch)
-bool CParser::ParseString(const UString &s, const CSwitchForm *switchForms)
-{
-  int len = s.Length();
-  if (len == 0)
-    return false;
-  int pos = 0;
-  if (!IsItSwitchChar(s[pos]))
-    return false;
-  while (pos < len)
-  {
-    if (IsItSwitchChar(s[pos]))
-      pos++;
-    const int kNoLen = -1;
-    int matchedSwitchIndex = 0; // GCC Warning
-    int maxLen = kNoLen;
-    for (int switchIndex = 0; switchIndex < _numSwitches; switchIndex++)
-    {
-      int switchLen = MyStringLen(switchForms[switchIndex].IDString);
-      if (switchLen <= maxLen || pos + switchLen > len)
-        continue;
-
-      UString temp = s + pos;
-      temp = temp.Left(switchLen);
-      if (temp.CompareNoCase(switchForms[switchIndex].IDString) == 0)
-      // if (_strnicmp(switchForms[switchIndex].IDString, LPCSTR(s) + pos, switchLen) == 0)
-      {
-        matchedSwitchIndex = switchIndex;
-        maxLen = switchLen;
-      }
-    }
-    if (maxLen == kNoLen)
-      throw "maxLen == kNoLen";
-    CSwitchResult &matchedSwitch = _switches[matchedSwitchIndex];
-    const CSwitchForm &switchForm = switchForms[matchedSwitchIndex];
-    if ((!switchForm.Multi) && matchedSwitch.ThereIs)
-      throw "switch must be single";
-    matchedSwitch.ThereIs = true;
-    pos += maxLen;
-    int tailSize = len - pos;
-    NSwitchType::EEnum type = switchForm.Type;
-    switch(type)
-    {
-      case NSwitchType::kPostMinus:
-        {
-          if (tailSize == 0)
-            matchedSwitch.WithMinus = false;
-          else
-          {
-            matchedSwitch.WithMinus = (s[pos] == kSwitchMinus);
-            if (matchedSwitch.WithMinus)
-              pos++;
-          }
-          break;
-        }
-      case NSwitchType::kPostChar:
-        {
-          if (tailSize < switchForm.MinLen)
-            throw "switch is not full";
-          UString set = switchForm.PostCharSet;
-          const int kEmptyCharValue = -1;
-          if (tailSize == 0)
-            matchedSwitch.PostCharIndex = kEmptyCharValue;
-          else
-          {
-            int index = set.Find(s[pos]);
-            if (index < 0)
-              matchedSwitch.PostCharIndex =  kEmptyCharValue;
-            else
-            {
-              matchedSwitch.PostCharIndex = index;
-              pos++;
-            }
-          }
-          break;
-        }
-      case NSwitchType::kLimitedPostString:
-      case NSwitchType::kUnLimitedPostString:
-        {
-          int minLen = switchForm.MinLen;
-          if (tailSize < minLen)
-            throw "switch is not full";
-          if (type == NSwitchType::kUnLimitedPostString)
-          {
-            matchedSwitch.PostStrings.Add(s.Mid(pos));
-            return true;
-          }
-          int maxLen = switchForm.MaxLen;
-          UString stringSwitch = s.Mid(pos, minLen);
-          pos += minLen;
-          for (int i = minLen; i < maxLen && pos < len; i++, pos++)
-          {
-            wchar_t c = s[pos];
-            if (IsItSwitchChar(c))
-              break;
-            stringSwitch += c;
-          }
-          matchedSwitch.PostStrings.Add(stringSwitch);
-          break;
-        }
-      case NSwitchType::kSimple:
-          break;
-    }
-  }
-  return true;
-}
-
-const CSwitchResult& CParser::operator[](size_t index) const
-{
-  return _switches[index];
-}
-
-/////////////////////////////////
-// Command parsing procedures
-
-int ParseCommand(int numCommandForms, const CCommandForm *commandForms,
-    const UString &commandString, UString &postString)
-{
-  for (int i = 0; i < numCommandForms; i++)
-  {
-    const UString id = commandForms[i].IDString;
-    if (commandForms[i].PostStringMode)
-    {
-      if (commandString.Find(id) == 0)
-      {
-        postString = commandString.Mid(id.Length());
-        return i;
-      }
-    }
-    else
-      if (commandString == id)
-      {
-        postString.Empty();
-        return i;
-      }
-  }
-  return -1;
-}
-   
-}
diff --git a/third_party/lzma/v4_65/files/CPP/Common/CommandLineParser.h b/third_party/lzma/v4_65/files/CPP/Common/CommandLineParser.h
deleted file mode 100644
index 6c7226a..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/CommandLineParser.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// Common/CommandLineParser.h
-
-#ifndef __COMMON_COMMANDLINEPARSER_H
-#define __COMMON_COMMANDLINEPARSER_H
-
-#include "MyString.h"
-
-namespace NCommandLineParser {
-
-void SplitCommandLine(const UString &src, UString &dest1, UString &dest2);
-void SplitCommandLine(const UString &s, UStringVector &parts);
-
-namespace NSwitchType {
-  enum EEnum
-  {
-    kSimple,
-    kPostMinus,
-    kLimitedPostString,
-    kUnLimitedPostString,
-    kPostChar
-  };
-}
-
-struct CSwitchForm
-{
-  const wchar_t *IDString;
-  NSwitchType::EEnum Type;
-  bool Multi;
-  int MinLen;
-  int MaxLen;
-  const wchar_t *PostCharSet;
-};
-
-struct CSwitchResult
-{
-  bool ThereIs;
-  bool WithMinus;
-  UStringVector PostStrings;
-  int PostCharIndex;
-  CSwitchResult(): ThereIs(false) {};
-};
-  
-class CParser
-{
-  int _numSwitches;
-  CSwitchResult *_switches;
-  bool ParseString(const UString &s, const CSwitchForm *switchForms);
-public:
-  UStringVector NonSwitchStrings;
-  CParser(int numSwitches);
-  ~CParser();
-  void ParseStrings(const CSwitchForm *switchForms,
-    const UStringVector &commandStrings);
-  const CSwitchResult& operator[](size_t index) const;
-};
-
-/////////////////////////////////
-// Command parsing procedures
-
-struct CCommandForm
-{
-  wchar_t *IDString;
-  bool PostStringMode;
-};
-
-// Returns: Index of form and postString; -1, if there is no match
-int ParseCommand(int numCommandForms, const CCommandForm *commandForms,
-    const UString &commandString, UString &postString);
-
-}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/Defs.h b/third_party/lzma/v4_65/files/CPP/Common/Defs.h
deleted file mode 100644
index dad3ae8..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/Defs.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// Common/Defs.h
-
-#ifndef __COMMON_DEFS_H
-#define __COMMON_DEFS_H
-
-template <class T> inline T MyMin(T a, T b)
-  {  return a < b ? a : b; }
-template <class T> inline T MyMax(T a, T b)
-  {  return a > b ? a : b; }
-
-template <class T> inline int MyCompare(T a, T b)
-  {  return a < b ? -1 : (a == b ? 0 : 1); }
-
-inline int BoolToInt(bool value)
-  { return (value ? 1: 0); }
-
-inline bool IntToBool(int value)
-  { return (value != 0); }
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/DynamicBuffer.h b/third_party/lzma/v4_65/files/CPP/Common/DynamicBuffer.h
deleted file mode 100644
index fd33cec..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/DynamicBuffer.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Common/DynamicBuffer.h
-
-#ifndef __COMMON_DYNAMICBUFFER_H
-#define __COMMON_DYNAMICBUFFER_H
-
-#include "Buffer.h"
-
-template <class T> class CDynamicBuffer: public CBuffer<T>
-{
-  void GrowLength(size_t size)
-  {
-    size_t delta;
-    if (this->_capacity > 64)
-      delta = this->_capacity / 4;
-    else if (this->_capacity > 8)
-      delta = 16;
-    else
-      delta = 4;
-    delta = MyMax(delta, size);
-    SetCapacity(this->_capacity + delta);
-  }
-public:
-  CDynamicBuffer(): CBuffer<T>() {};
-  CDynamicBuffer(const CDynamicBuffer &buffer): CBuffer<T>(buffer) {};
-  CDynamicBuffer(size_t size): CBuffer<T>(size) {};
-  CDynamicBuffer& operator=(const CDynamicBuffer &buffer)
-  {
-    this->Free();
-    if (buffer._capacity > 0)
-    {
-      SetCapacity(buffer._capacity);
-      memmove(this->_items, buffer._items, buffer._capacity * sizeof(T));
-    }
-    return *this;
-  }
-  void EnsureCapacity(size_t capacity)
-  {
-    if (this->_capacity < capacity)
-      GrowLength(capacity - this->_capacity);
-  }
-};
-
-typedef CDynamicBuffer<char> CCharDynamicBuffer;
-typedef CDynamicBuffer<wchar_t> CWCharDynamicBuffer;
-typedef CDynamicBuffer<unsigned char> CByteDynamicBuffer;
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/IntToString.cpp b/third_party/lzma/v4_65/files/CPP/Common/IntToString.cpp
deleted file mode 100644
index beda203..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/IntToString.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-// Common/IntToString.cpp
-
-#include "StdAfx.h"
-
-#include "IntToString.h"
-
-void ConvertUInt64ToString(UInt64 value, char *s, UInt32 base)
-{
-  if (base < 2 || base > 36)
-  {
-    *s = '\0';
-    return;
-  }
-  char temp[72];
-  int pos = 0;
-  do
-  {
-    int delta = (int)(value % base);
-    temp[pos++] = (char)((delta < 10) ? ('0' + delta) : ('a' + (delta - 10)));
-    value /= base;
-  }
-  while (value != 0);
-  do
-    *s++ = temp[--pos];
-  while (pos > 0);
-  *s = '\0';
-}
-
-void ConvertUInt64ToString(UInt64 value, wchar_t *s)
-{
-  wchar_t temp[32];
-  int pos = 0;
-  do
-  {
-    temp[pos++] = (wchar_t)(L'0' + (int)(value % 10));
-    value /= 10;
-  }
-  while (value != 0);
-  do
-    *s++ = temp[--pos];
-  while (pos > 0);
-  *s = L'\0';
-}
-
-void ConvertInt64ToString(Int64 value, char *s)
-{
-  if (value < 0)
-  {
-    *s++ = '-';
-    value = -value;
-  }
-  ConvertUInt64ToString(value, s);
-}
-
-void ConvertInt64ToString(Int64 value, wchar_t *s)
-{
-  if (value < 0)
-  {
-    *s++ = L'-';
-    value = -value;
-  }
-  ConvertUInt64ToString(value, s);
-}
diff --git a/third_party/lzma/v4_65/files/CPP/Common/IntToString.h b/third_party/lzma/v4_65/files/CPP/Common/IntToString.h
deleted file mode 100644
index cf86090..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/IntToString.h
+++ /dev/null
@@ -1,15 +0,0 @@
-// Common/IntToString.h
-
-#ifndef __COMMON_INTTOSTRING_H
-#define __COMMON_INTTOSTRING_H
-
-#include <stddef.h>
-#include "Types.h"
-
-void ConvertUInt64ToString(UInt64 value, char *s, UInt32 base = 10);
-void ConvertUInt64ToString(UInt64 value, wchar_t *s);
-
-void ConvertInt64ToString(Int64 value, char *s);
-void ConvertInt64ToString(Int64 value, wchar_t *s);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/ListFileUtils.cpp b/third_party/lzma/v4_65/files/CPP/Common/ListFileUtils.cpp
deleted file mode 100644
index c1c682a..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/ListFileUtils.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-// Common/ListFileUtils.cpp
-
-#include "StdAfx.h"
-
-#include "MyWindows.h"
-#include "../Windows/FileIO.h"
-
-#include "ListFileUtils.h"
-#include "StringConvert.h"
-#include "UTFConvert.h"
-
-static const char kQuoteChar     = '\"';
-static void RemoveQuote(UString &s)
-{
-  if (s.Length() >= 2)
-    if (s[0] == kQuoteChar && s[s.Length() - 1] == kQuoteChar)
-      s = s.Mid(1, s.Length() - 2);
-}
-
-bool ReadNamesFromListFile(LPCWSTR fileName, UStringVector &resultStrings, UINT codePage)
-{
-  NWindows::NFile::NIO::CInFile file;
-  if (!file.Open(fileName))
-    return false;
-  UInt64 length;
-  if (!file.GetLength(length))
-    return false;
-  if (length > ((UInt32)1 << 31))
-    return false;
-  AString s;
-  char *p = s.GetBuffer((int)length + 1);
-  UInt32 processed;
-  if (!file.Read(p, (UInt32)length, processed))
-    return false;
-  p[(UInt32)length] = 0;
-  s.ReleaseBuffer();
-  file.Close();
-
-  UString u;
-  #ifdef CP_UTF8
-  if (codePage == CP_UTF8)
-  {
-    if (!ConvertUTF8ToUnicode(s, u))
-      return false;
-  }
-  else
-  #endif
-    u = MultiByteToUnicodeString(s, codePage);
-  if (!u.IsEmpty())
-  {
-    if (u[0] == 0xFEFF)
-      u.Delete(0);
-  }
-
-  UString t;
-  for (int i = 0; i < u.Length(); i++)
-  {
-    wchar_t c = u[i];
-    if (c == L'\n' || c == 0xD)
-    {
-      t.Trim();
-      RemoveQuote(t);
-      if (!t.IsEmpty())
-        resultStrings.Add(t);
-      t.Empty();
-    }
-    else
-      t += c;
-  }
-  t.Trim();
-  RemoveQuote(t);
-  if (!t.IsEmpty())
-    resultStrings.Add(t);
-  return true;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/Common/ListFileUtils.h b/third_party/lzma/v4_65/files/CPP/Common/ListFileUtils.h
deleted file mode 100644
index c58a8bd..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/ListFileUtils.h
+++ /dev/null
@@ -1,11 +0,0 @@
-// Common/ListFileUtils.h
-
-#ifndef __COMMON_LISTFILEUTILS_H
-#define __COMMON_LISTFILEUTILS_H
-
-#include "MyString.h"
-#include "Types.h"
-
-bool ReadNamesFromListFile(LPCWSTR fileName, UStringVector &strings, UINT codePage = CP_OEMCP);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/MyCom.h b/third_party/lzma/v4_65/files/CPP/Common/MyCom.h
deleted file mode 100644
index 2f00c25..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/MyCom.h
+++ /dev/null
@@ -1,225 +0,0 @@
-// MyCom.h
-
-#ifndef __MYCOM_H
-#define __MYCOM_H
-
-#include "MyWindows.h"
-
-#ifndef RINOK
-#define RINOK(x) { HRESULT __result_ = (x); if (__result_ != S_OK) return __result_; }
-#endif
-
-template <class T>
-class CMyComPtr
-{
-  T* _p;
-public:
-  // typedef T _PtrClass;
-  CMyComPtr() { _p = NULL;}
-  CMyComPtr(T* p) {if ((_p = p) != NULL) p->AddRef(); }
-  CMyComPtr(const CMyComPtr<T>& lp)
-  {
-    if ((_p = lp._p) != NULL)
-      _p->AddRef();
-  }
-  ~CMyComPtr() { if (_p) _p->Release(); }
-  void Release() { if (_p) { _p->Release(); _p = NULL; } }
-  operator T*() const {  return (T*)_p;  }
-  // T& operator*() const {  return *_p; }
-  T** operator&() { return &_p; }
-  T* operator->() const { return _p; }
-  T* operator=(T* p)
-  {
-    if (p != 0)
-      p->AddRef();
-    if (_p)
-      _p->Release();
-    _p = p;
-    return p;
-  }
-  T* operator=(const CMyComPtr<T>& lp) { return (*this = lp._p); }
-  bool operator!() const { return (_p == NULL); }
-  // bool operator==(T* pT) const {  return _p == pT; }
-  // Compare two objects for equivalence
-  void Attach(T* p2)
-  {
-    Release();
-    _p = p2;
-  }
-  T* Detach()
-  {
-    T* pt = _p;
-    _p = NULL;
-    return pt;
-  }
-  #ifdef _WIN32
-  HRESULT CoCreateInstance(REFCLSID rclsid, REFIID iid, LPUNKNOWN pUnkOuter = NULL, DWORD dwClsContext = CLSCTX_ALL)
-  {
-    return ::CoCreateInstance(rclsid, pUnkOuter, dwClsContext, iid, (void**)&_p);
-  }
-  #endif
-  /*
-  HRESULT CoCreateInstance(LPCOLESTR szProgID, LPUNKNOWN pUnkOuter = NULL, DWORD dwClsContext = CLSCTX_ALL)
-  {
-    CLSID clsid;
-    HRESULT hr = CLSIDFromProgID(szProgID, &clsid);
-    ATLASSERT(_p == NULL);
-    if (SUCCEEDED(hr))
-      hr = ::CoCreateInstance(clsid, pUnkOuter, dwClsContext, __uuidof(T), (void**)&_p);
-    return hr;
-  }
-  */
-  template <class Q>
-  HRESULT QueryInterface(REFGUID iid, Q** pp) const
-  {
-    return _p->QueryInterface(iid, (void**)pp);
-  }
-};
-
-//////////////////////////////////////////////////////////
-
-inline HRESULT StringToBstr(LPCOLESTR src, BSTR *bstr)
-{
-  *bstr = ::SysAllocString(src);
-  return (*bstr != 0) ? S_OK : E_OUTOFMEMORY;
-}
-
-class CMyComBSTR
-{
-public:
-  BSTR m_str;
-  CMyComBSTR(): m_str(NULL) {}
-  CMyComBSTR(LPCOLESTR src) { m_str = ::SysAllocString(src); }
-  // CMyComBSTR(int nSize) { m_str = ::SysAllocStringLen(NULL, nSize); }
-  // CMyComBSTR(int nSize, LPCOLESTR sz) { m_str = ::SysAllocStringLen(sz, nSize);  }
-  CMyComBSTR(const CMyComBSTR& src) { m_str = src.MyCopy(); }
-  /*
-  CMyComBSTR(REFGUID src)
-  {
-    LPOLESTR szGuid;
-    StringFromCLSID(src, &szGuid);
-    m_str = ::SysAllocString(szGuid);
-    CoTaskMemFree(szGuid);
-  }
-  */
-  ~CMyComBSTR() { ::SysFreeString(m_str); }
-  CMyComBSTR& operator=(const CMyComBSTR& src)
-  {
-    if (m_str != src.m_str)
-    {
-      if (m_str)
-        ::SysFreeString(m_str);
-      m_str = src.MyCopy();
-    }
-    return *this;
-  }
-  CMyComBSTR& operator=(LPCOLESTR src)
-  {
-    ::SysFreeString(m_str);
-    m_str = ::SysAllocString(src);
-    return *this;
-  }
-  unsigned int Length() const { return ::SysStringLen(m_str); }
-  operator BSTR() const { return m_str; }
-  BSTR* operator&() { return &m_str; }
-  BSTR MyCopy() const
-  {
-    int byteLen = ::SysStringByteLen(m_str);
-    BSTR res = ::SysAllocStringByteLen(NULL, byteLen);
-    memcpy(res, m_str, byteLen);
-    return res;
-  }
-  /*
-  void Attach(BSTR src) { m_str = src; }
-  BSTR Detach()
-  {
-    BSTR s = m_str;
-    m_str = NULL;
-    return s;
-  }
-  */
-  void Empty()
-  {
-    ::SysFreeString(m_str);
-    m_str = NULL;
-  }
-  bool operator!() const {  return (m_str == NULL); }
-};
-
-//////////////////////////////////////////////////////////
-
-class CMyUnknownImp
-{
-public:
-  ULONG __m_RefCount;
-  CMyUnknownImp(): __m_RefCount(0) {}
-};
-
-#define MY_QUERYINTERFACE_BEGIN STDMETHOD(QueryInterface) \
-    (REFGUID iid, void **outObject) {
-
-#define MY_QUERYINTERFACE_ENTRY(i) if (iid == IID_ ## i) \
-    { *outObject = (void *)(i *)this; AddRef(); return S_OK; }
-
-#define MY_QUERYINTERFACE_ENTRY_UNKNOWN(i) if (iid == IID_IUnknown) \
-    { *outObject = (void *)(IUnknown *)(i *)this; AddRef(); return S_OK; }
-
-#define MY_QUERYINTERFACE_BEGIN2(i) MY_QUERYINTERFACE_BEGIN \
-    MY_QUERYINTERFACE_ENTRY_UNKNOWN(i) \
-    MY_QUERYINTERFACE_ENTRY(i)
-
-#define MY_QUERYINTERFACE_END return E_NOINTERFACE; }
-
-#define MY_ADDREF_RELEASE \
-STDMETHOD_(ULONG, AddRef)() { return ++__m_RefCount; } \
-STDMETHOD_(ULONG, Release)() { if (--__m_RefCount != 0)  \
-  return __m_RefCount; delete this; return 0; }
-
-#define MY_UNKNOWN_IMP_SPEC(i) \
-  MY_QUERYINTERFACE_BEGIN \
-  i \
-  MY_QUERYINTERFACE_END \
-  MY_ADDREF_RELEASE
-
-
-#define MY_UNKNOWN_IMP MY_QUERYINTERFACE_BEGIN \
-  MY_QUERYINTERFACE_ENTRY_UNKNOWN(IUnknown) \
-  MY_QUERYINTERFACE_END \
-  MY_ADDREF_RELEASE
-
-#define MY_UNKNOWN_IMP1(i) MY_UNKNOWN_IMP_SPEC( \
-  MY_QUERYINTERFACE_ENTRY_UNKNOWN(i) \
-  MY_QUERYINTERFACE_ENTRY(i) \
-  )
-
-#define MY_UNKNOWN_IMP2(i1, i2) MY_UNKNOWN_IMP_SPEC( \
-  MY_QUERYINTERFACE_ENTRY_UNKNOWN(i1) \
-  MY_QUERYINTERFACE_ENTRY(i1) \
-  MY_QUERYINTERFACE_ENTRY(i2) \
-  )
-
-#define MY_UNKNOWN_IMP3(i1, i2, i3) MY_UNKNOWN_IMP_SPEC( \
-  MY_QUERYINTERFACE_ENTRY_UNKNOWN(i1) \
-  MY_QUERYINTERFACE_ENTRY(i1) \
-  MY_QUERYINTERFACE_ENTRY(i2) \
-  MY_QUERYINTERFACE_ENTRY(i3) \
-  )
-
-#define MY_UNKNOWN_IMP4(i1, i2, i3, i4) MY_UNKNOWN_IMP_SPEC( \
-  MY_QUERYINTERFACE_ENTRY_UNKNOWN(i1) \
-  MY_QUERYINTERFACE_ENTRY(i1) \
-  MY_QUERYINTERFACE_ENTRY(i2) \
-  MY_QUERYINTERFACE_ENTRY(i3) \
-  MY_QUERYINTERFACE_ENTRY(i4) \
-  )
-
-#define MY_UNKNOWN_IMP5(i1, i2, i3, i4, i5) MY_UNKNOWN_IMP_SPEC( \
-  MY_QUERYINTERFACE_ENTRY_UNKNOWN(i1) \
-  MY_QUERYINTERFACE_ENTRY(i1) \
-  MY_QUERYINTERFACE_ENTRY(i2) \
-  MY_QUERYINTERFACE_ENTRY(i3) \
-  MY_QUERYINTERFACE_ENTRY(i4) \
-  MY_QUERYINTERFACE_ENTRY(i5) \
-  )
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/MyException.h b/third_party/lzma/v4_65/files/CPP/Common/MyException.h
deleted file mode 100644
index f0ad111..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/MyException.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// Common/Exception.h
-
-#ifndef __COMMON_EXCEPTION_H
-#define __COMMON_EXCEPTION_H
-
-#include "MyWindows.h"
-
-struct CSystemException
-{
-  HRESULT ErrorCode;
-  CSystemException(HRESULT errorCode): ErrorCode(errorCode) {}
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/MyGuidDef.h b/third_party/lzma/v4_65/files/CPP/Common/MyGuidDef.h
deleted file mode 100644
index 7cfaba0..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/MyGuidDef.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Common/MyGuidDef.h
-
-#ifndef GUID_DEFINED
-#define GUID_DEFINED
-
-#include "Types.h"
-
-typedef struct {
-  UInt32 Data1;
-  UInt16 Data2;
-  UInt16 Data3;
-  unsigned char Data4[8];
-} GUID;
-
-#ifdef __cplusplus
-#define REFGUID const GUID &
-#else
-#define REFGUID const GUID *
-#endif
-
-#define REFCLSID REFGUID
-#define REFIID REFGUID
-
-#ifdef __cplusplus
-inline int operator==(REFGUID g1, REFGUID g2)
-{
-  for (int i = 0; i < (int)sizeof(g1); i++)
-    if (((unsigned char *)&g1)[i] != ((unsigned char *)&g2)[i])
-      return 0;
-  return 1;
-}
-inline int operator!=(REFGUID g1, REFGUID g2) { return !(g1 == g2); }
-#endif
-
-#ifdef __cplusplus
-  #define MY_EXTERN_C extern "C"
-#else
-  #define MY_EXTERN_C extern
-#endif
-
-#endif // GUID_DEFINED
-
-
-#ifdef DEFINE_GUID
-#undef DEFINE_GUID
-#endif
-
-#ifdef INITGUID
-  #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
-    MY_EXTERN_C const GUID name = { l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }
-#else
-  #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
-    MY_EXTERN_C const GUID name
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/MyInitGuid.h b/third_party/lzma/v4_65/files/CPP/Common/MyInitGuid.h
deleted file mode 100644
index 4fc1556..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/MyInitGuid.h
+++ /dev/null
@@ -1,15 +0,0 @@
-// Common/MyInitGuid.h
-
-#ifndef __COMMON_MYINITGUID_H
-#define __COMMON_MYINITGUID_H
-
-#ifdef _WIN32
-#include <initguid.h>
-#else
-#define INITGUID
-#include "MyGuidDef.h"
-DEFINE_GUID(IID_IUnknown,
-0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
-#endif
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/MyString.cpp b/third_party/lzma/v4_65/files/CPP/Common/MyString.cpp
deleted file mode 100644
index 2c02e82..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/MyString.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-// Common/MyString.cpp
-
-#include "StdAfx.h"
-
-#ifndef _WIN32
-#include <ctype.h>
-#endif
-
-#ifndef _UNICODE
-#include "StringConvert.h"
-#endif
-
-#include "MyString.h"
-
-
-#ifdef _WIN32
-
-#ifndef _UNICODE
-
-wchar_t MyCharUpper(wchar_t c)
-{
-  if (c == 0)
-    return 0;
-  wchar_t *res = CharUpperW((LPWSTR)(UINT_PTR)(unsigned int)c);
-  if (res != 0 || ::GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
-    return (wchar_t)(unsigned int)(UINT_PTR)res;
-  const int kBufferSize = 4;
-  char s[kBufferSize + 1];
-  int numChars = ::WideCharToMultiByte(CP_ACP, 0, &c, 1, s, kBufferSize, 0, 0);
-  if (numChars == 0 || numChars > kBufferSize)
-    return c;
-  s[numChars] = 0;
-  ::CharUpperA(s);
-  ::MultiByteToWideChar(CP_ACP, 0, s, numChars, &c, 1);
-  return c;
-}
-
-wchar_t MyCharLower(wchar_t c)
-{
-  if (c == 0)
-    return 0;
-  wchar_t *res = CharLowerW((LPWSTR)(UINT_PTR)(unsigned int)c);
-  if (res != 0 || ::GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
-    return (wchar_t)(unsigned int)(UINT_PTR)res;
-  const int kBufferSize = 4;
-  char s[kBufferSize + 1];
-  int numChars = ::WideCharToMultiByte(CP_ACP, 0, &c, 1, s, kBufferSize, 0, 0);
-  if (numChars == 0 || numChars > kBufferSize)
-    return c;
-  s[numChars] = 0;
-  ::CharLowerA(s);
-  ::MultiByteToWideChar(CP_ACP, 0, s, numChars, &c, 1);
-  return c;
-}
-
-wchar_t * MyStringUpper(wchar_t *s)
-{
-  if (s == 0)
-    return 0;
-  wchar_t *res = CharUpperW(s);
-  if (res != 0 || ::GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
-    return res;
-  AString a = UnicodeStringToMultiByte(s);
-  a.MakeUpper();
-  return MyStringCopy(s, (const wchar_t *)MultiByteToUnicodeString(a));
-}
-
-wchar_t * MyStringLower(wchar_t *s)
-{
-  if (s == 0)
-    return 0;
-  wchar_t *res = CharLowerW(s);
-  if (res != 0 || ::GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
-    return res;
-  AString a = UnicodeStringToMultiByte(s);
-  a.MakeLower();
-  return MyStringCopy(s, (const wchar_t *)MultiByteToUnicodeString(a));
-}
-
-#endif
-
-/*
-inline int ConvertCompareResult(int r) { return r - 2; }
-
-int MyStringCollate(const wchar_t *s1, const wchar_t *s2)
-{
-  int res = CompareStringW(
-        LOCALE_USER_DEFAULT, SORT_STRINGSORT, s1, -1, s2, -1);
-  #ifdef _UNICODE
-  return ConvertCompareResult(res);
-  #else
-  if (res != 0 || ::GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
-    return ConvertCompareResult(res);
-  return MyStringCollate(UnicodeStringToMultiByte(s1),
-        UnicodeStringToMultiByte(s2));
-  #endif
-}
-
-#ifndef _WIN32_WCE
-int MyStringCollate(const char *s1, const char *s2)
-{
-  return ConvertCompareResult(CompareStringA(
-    LOCALE_USER_DEFAULT, SORT_STRINGSORT, s1, -1, s2, -1));
-}
-
-int MyStringCollateNoCase(const char *s1, const char *s2)
-{
-  return ConvertCompareResult(CompareStringA(
-    LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT, s1, -1, s2, -1));
-}
-#endif
-
-int MyStringCollateNoCase(const wchar_t *s1, const wchar_t *s2)
-{
-  int res = CompareStringW(
-        LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT, s1, -1, s2, -1);
-  #ifdef _UNICODE
-  return ConvertCompareResult(res);
-  #else
-  if (res != 0 || ::GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
-    return ConvertCompareResult(res);
-  return MyStringCollateNoCase(UnicodeStringToMultiByte(s1),
-      UnicodeStringToMultiByte(s2));
-  #endif
-}
-*/
-
-#else
-
-wchar_t MyCharUpper(wchar_t c)
-{
-  return toupper(c);
-}
-
-/*
-int MyStringCollateNoCase(const wchar_t *s1, const wchar_t *s2)
-{
-  for (;;)
-  {
-    wchar_t c1 = *s1++;
-    wchar_t c2 = *s2++;
-    wchar_t u1 = MyCharUpper(c1);
-    wchar_t u2 = MyCharUpper(c2);
-
-    if (u1 < u2) return -1;
-    if (u1 > u2) return 1;
-    if (u1 == 0) return 0;
-  }
-}
-*/
-
-#endif
-
-int MyStringCompare(const char *s1, const char *s2)
-{
-  for (;;)
-  {
-    unsigned char c1 = (unsigned char)*s1++;
-    unsigned char c2 = (unsigned char)*s2++;
-    if (c1 < c2) return -1;
-    if (c1 > c2) return 1;
-    if (c1 == 0) return 0;
-  }
-}
-
-int MyStringCompare(const wchar_t *s1, const wchar_t *s2)
-{
-  for (;;)
-  {
-    wchar_t c1 = *s1++;
-    wchar_t c2 = *s2++;
-    if (c1 < c2) return -1;
-    if (c1 > c2) return 1;
-    if (c1 == 0) return 0;
-  }
-}
-
-int MyStringCompareNoCase(const wchar_t *s1, const wchar_t *s2)
-{
-  for (;;)
-  {
-    wchar_t c1 = *s1++;
-    wchar_t c2 = *s2++;
-    if (c1 != c2)
-    {
-      wchar_t u1 = MyCharUpper(c1);
-      wchar_t u2 = MyCharUpper(c2);
-      if (u1 < u2) return -1;
-      if (u1 > u2) return 1;
-    }
-    if (c1 == 0) return 0;
-  }
-}
-
-/*
-int MyStringCompareNoCase(const char *s1, const char *s2)
-{
-  return MyStringCompareNoCase(MultiByteToUnicodeString(s1), MultiByteToUnicodeString(s2));
-}
-*/
diff --git a/third_party/lzma/v4_65/files/CPP/Common/MyString.h b/third_party/lzma/v4_65/files/CPP/Common/MyString.h
deleted file mode 100644
index bae239d..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/MyString.h
+++ /dev/null
@@ -1,628 +0,0 @@
-// Common/String.h
-
-#ifndef __COMMON_STRING_H
-#define __COMMON_STRING_H
-
-#include <string.h>
-// #include <wchar.h>
-
-#include "MyVector.h"
-
-#ifdef _WIN32
-#include "MyWindows.h"
-#endif
-
-template <class T>
-inline int MyStringLen(const T *s)
-{
-  int i;
-  for (i = 0; s[i] != '\0'; i++);
-  return i;
-}
-
-template <class T>
-inline T * MyStringCopy(T *dest, const T *src)
-{
-  T *destStart = dest;
-  while ((*dest++ = *src++) != 0);
-  return destStart;
-}
-
-inline wchar_t* MyStringGetNextCharPointer(wchar_t *p)
-  { return (p + 1); }
-inline const wchar_t* MyStringGetNextCharPointer(const wchar_t *p)
-  { return (p + 1); }
-inline wchar_t* MyStringGetPrevCharPointer(const wchar_t *, wchar_t *p)
-  { return (p - 1); }
-inline const wchar_t* MyStringGetPrevCharPointer(const wchar_t *, const wchar_t *p)
-  { return (p - 1); }
-
-#ifdef _WIN32
-
-inline char* MyStringGetNextCharPointer(char *p)
-  { return CharNextA(p); }
-inline const char* MyStringGetNextCharPointer(const char *p)
-  { return CharNextA(p); }
-
-inline char* MyStringGetPrevCharPointer(char *base, char *p)
-  { return CharPrevA(base, p); }
-inline const char* MyStringGetPrevCharPointer(const char *base, const char *p)
-  { return CharPrevA(base, p); }
-
-inline char MyCharUpper(char c)
-  { return (char)(unsigned int)(UINT_PTR)CharUpperA((LPSTR)(UINT_PTR)(unsigned int)(unsigned char)c); }
-#ifdef _UNICODE
-inline wchar_t MyCharUpper(wchar_t c)
-  { return (wchar_t)(unsigned int)(UINT_PTR)CharUpperW((LPWSTR)(UINT_PTR)(unsigned int)c); }
-#else
-wchar_t MyCharUpper(wchar_t c);
-#endif
-
-inline char MyCharLower(char c)
-  { return (char)(unsigned int)(UINT_PTR)CharLowerA((LPSTR)(UINT_PTR)(unsigned int)(unsigned char)c); }
-#ifdef _UNICODE
-inline wchar_t MyCharLower(wchar_t c)
-  { return (wchar_t)(unsigned int)(UINT_PTR)CharLowerW((LPWSTR)(UINT_PTR)(unsigned int)c); }
-#else
-wchar_t MyCharLower(wchar_t c);
-#endif
-
-inline char * MyStringUpper(char *s) { return CharUpperA(s); }
-#ifdef _UNICODE
-inline wchar_t * MyStringUpper(wchar_t *s) { return CharUpperW(s); }
-#else
-wchar_t * MyStringUpper(wchar_t *s);
-#endif
-
-inline char * MyStringLower(char *s) { return CharLowerA(s); }
-#ifdef _UNICODE
-inline wchar_t * MyStringLower(wchar_t *s) { return CharLowerW(s); }
-#else
-wchar_t * MyStringLower(wchar_t *s);
-#endif
-
-#else // Standard-C
-wchar_t MyCharUpper(wchar_t c);
-#endif
-
-//////////////////////////////////////
-// Compare
-
-/*
-#ifndef _WIN32_WCE
-int MyStringCollate(const char *s1, const char *s2);
-int MyStringCollateNoCase(const char *s1, const char *s2);
-#endif
-int MyStringCollate(const wchar_t *s1, const wchar_t *s2);
-int MyStringCollateNoCase(const wchar_t *s1, const wchar_t *s2);
-*/
-
-int MyStringCompare(const char *s1, const char  *s2);
-int MyStringCompare(const wchar_t *s1, const wchar_t *s2);
-
-// int MyStringCompareNoCase(const char *s1, const char  *s2);
-int MyStringCompareNoCase(const wchar_t *s1, const wchar_t *s2);
-
-template <class T>
-class CStringBase
-{
-  void TrimLeftWithCharSet(const CStringBase &charSet)
-  {
-    const T *p = _chars;
-    while (charSet.Find(*p) >= 0 && (*p != 0))
-      p = GetNextCharPointer(p);
-    Delete(0, (int)(p - _chars));
-  }
-  void TrimRightWithCharSet(const CStringBase &charSet)
-  {
-    const T *p = _chars;
-    const T *pLast = NULL;
-    while (*p != 0)
-    {
-      if (charSet.Find(*p) >= 0)
-      {
-        if (pLast == NULL)
-          pLast = p;
-      }
-      else
-        pLast = NULL;
-      p = GetNextCharPointer(p);
-    }
-    if (pLast != NULL)
-    {
-      int i = (int)(pLast - _chars);
-      Delete(i, _length - i);
-    }
-
-  }
-  void MoveItems(int destIndex, int srcIndex)
-  {
-    memmove(_chars + destIndex, _chars + srcIndex,
-        sizeof(T) * (_length - srcIndex + 1));
-  }
-  
-  void InsertSpace(int &index, int size)
-  {
-    CorrectIndex(index);
-    GrowLength(size);
-    MoveItems(index + size, index);
-  }
-
-  static T *GetNextCharPointer(T *p)
-    { return MyStringGetNextCharPointer(p); }
-  static const T *GetNextCharPointer(const T *p)
-    { return MyStringGetNextCharPointer(p); }
-  static T *GetPrevCharPointer(T *base, T *p)
-    { return MyStringGetPrevCharPointer(base, p); }
-  static const T *GetPrevCharPointer(const T *base, const T *p)
-    { return MyStringGetPrevCharPointer(base, p); }
-protected:
-  T *_chars;
-  int _length;
-  int _capacity;
-  
-  void SetCapacity(int newCapacity)
-  {
-    int realCapacity = newCapacity + 1;
-    if (realCapacity == _capacity)
-      return;
-    /*
-    const int kMaxStringSize = 0x20000000;
-    #ifndef _WIN32_WCE
-    if (newCapacity > kMaxStringSize || newCapacity < _length)
-      throw 1052337;
-    #endif
-    */
-    T *newBuffer = new T[realCapacity];
-    if (_capacity > 0)
-    {
-      for (int i = 0; i < _length; i++)
-        newBuffer[i] = _chars[i];
-      delete []_chars;
-    }
-    _chars = newBuffer;
-    _chars[_length] = 0;
-    _capacity = realCapacity;
-  }
-
-  void GrowLength(int n)
-  {
-    int freeSize = _capacity - _length - 1;
-    if (n <= freeSize)
-      return;
-    int delta;
-    if (_capacity > 64)
-      delta = _capacity / 2;
-    else if (_capacity > 8)
-      delta = 16;
-    else
-      delta = 4;
-    if (freeSize + delta < n)
-      delta = n - freeSize;
-    SetCapacity(_capacity + delta);
-  }
-
-  void CorrectIndex(int &index) const
-  {
-    if (index > _length)
-      index = _length;
-  }
-
-public:
-  CStringBase(): _chars(0), _length(0), _capacity(0) { SetCapacity(3); }
-  CStringBase(T c):  _chars(0), _length(0), _capacity(0)
-  {
-    SetCapacity(1);
-    _chars[0] = c;
-    _chars[1] = 0;
-    _length = 1;
-  }
-  CStringBase(const T *chars): _chars(0), _length(0), _capacity(0)
-  {
-    int length = MyStringLen(chars);
-    SetCapacity(length);
-    MyStringCopy(_chars, chars); // can be optimized by memove()
-    _length = length;
-  }
-  CStringBase(const CStringBase &s):  _chars(0), _length(0), _capacity(0)
-  {
-    SetCapacity(s._length);
-    MyStringCopy(_chars, s._chars);
-    _length = s._length;
-  }
-  ~CStringBase() {  delete []_chars; }
-
-  operator const T*() const { return _chars;}
-
-  // The minimum size of the character buffer in characters.
-  // This value does not include space for a null terminator.
-  T* GetBuffer(int minBufLength)
-  {
-    if (minBufLength >= _capacity)
-      SetCapacity(minBufLength);
-    return _chars;
-  }
-  void ReleaseBuffer() { ReleaseBuffer(MyStringLen(_chars)); }
-  void ReleaseBuffer(int newLength)
-  {
-    /*
-    #ifndef _WIN32_WCE
-    if (newLength >= _capacity)
-      throw 282217;
-    #endif
-    */
-    _chars[newLength] = 0;
-    _length = newLength;
-  }
-
-  CStringBase& operator=(T c)
-  {
-    Empty();
-    SetCapacity(1);
-    _chars[0] = c;
-    _chars[1] = 0;
-    _length = 1;
-    return *this;
-  }
-  CStringBase& operator=(const T *chars)
-  {
-    Empty();
-    int length = MyStringLen(chars);
-    SetCapacity(length);
-    MyStringCopy(_chars, chars);
-    _length = length;
-    return *this;
-  }
-  CStringBase& operator=(const CStringBase& s)
-  {
-    if (&s == this)
-      return *this;
-    Empty();
-    SetCapacity(s._length);
-    MyStringCopy(_chars, s._chars);
-    _length = s._length;
-    return *this;
-  }
-  
-  CStringBase& operator+=(T c)
-  {
-    GrowLength(1);
-    _chars[_length] = c;
-    _chars[++_length] = 0;
-    return *this;
-  }
-  CStringBase& operator+=(const T *s)
-  {
-    int len = MyStringLen(s);
-    GrowLength(len);
-    MyStringCopy(_chars + _length, s);
-    _length += len;
-    return *this;
-  }
-  CStringBase& operator+=(const CStringBase &s)
-  {
-    GrowLength(s._length);
-    MyStringCopy(_chars + _length, s._chars);
-    _length += s._length;
-    return *this;
-  }
-  void Empty()
-  {
-    _length = 0;
-    _chars[0] = 0;
-  }
-  int Length() const { return _length; }
-  bool IsEmpty() const { return (_length == 0); }
-
-  CStringBase Mid(int startIndex) const
-    { return Mid(startIndex, _length - startIndex); }
-  CStringBase Mid(int startIndex, int count ) const
-  {
-    if (startIndex + count > _length)
-      count = _length - startIndex;
-    
-    if (startIndex == 0 && startIndex + count == _length)
-      return *this;
-    
-    CStringBase<T> result;
-    result.SetCapacity(count);
-    // MyStringNCopy(result._chars, _chars + startIndex, count);
-    for (int i = 0; i < count; i++)
-      result._chars[i] = _chars[startIndex + i];
-    result._chars[count] = 0;
-    result._length = count;
-    return result;
-  }
-  CStringBase Left(int count) const
-    { return Mid(0, count); }
-  CStringBase Right(int count) const
-  {
-    if (count > _length)
-      count = _length;
-    return Mid(_length - count, count);
-  }
-
-  void MakeUpper()
-    { MyStringUpper(_chars); }
-  void MakeLower()
-    { MyStringLower(_chars); }
-
-  int Compare(const CStringBase& s) const
-    { return MyStringCompare(_chars, s._chars); }
-
-  int Compare(const T *s) const
-    { return MyStringCompare(_chars, s); }
-
-  int CompareNoCase(const CStringBase& s) const
-    { return MyStringCompareNoCase(_chars, s._chars); }
-
-  int CompareNoCase(const T *s) const
-    { return MyStringCompareNoCase(_chars, s); }
-
-  /*
-  int Collate(const CStringBase& s) const
-    { return MyStringCollate(_chars, s._chars); }
-  int CollateNoCase(const CStringBase& s) const
-    { return MyStringCollateNoCase(_chars, s._chars); }
-  */
-
-  int Find(T c) const { return Find(c, 0); }
-  int Find(T c, int startIndex) const
-  {
-    T *p = _chars + startIndex;
-    for (;;)
-    {
-      if (*p == c)
-        return (int)(p - _chars);
-      if (*p == 0)
-        return -1;
-      p = GetNextCharPointer(p);
-    }
-  }
-  int Find(const CStringBase &s) const { return Find(s, 0); }
-  int Find(const CStringBase &s, int startIndex) const
-  {
-    if (s.IsEmpty())
-      return startIndex;
-    for (; startIndex < _length; startIndex++)
-    {
-      int j;
-      for (j = 0; j < s._length && startIndex + j < _length; j++)
-        if (_chars[startIndex+j] != s._chars[j])
-          break;
-      if (j == s._length)
-        return startIndex;
-    }
-    return -1;
-  }
-  int ReverseFind(T c) const
-  {
-    if (_length == 0)
-      return -1;
-    T *p = _chars + _length - 1;
-    for (;;)
-    {
-      if (*p == c)
-        return (int)(p - _chars);
-      if (p == _chars)
-        return -1;
-      p = GetPrevCharPointer(_chars, p);
-    }
-  }
-  int FindOneOf(const CStringBase &s) const
-  {
-    for (int i = 0; i < _length; i++)
-      if (s.Find(_chars[i]) >= 0)
-        return i;
-      return -1;
-  }
-
-  void TrimLeft(T c)
-  {
-    const T *p = _chars;
-    while (c == *p)
-      p = GetNextCharPointer(p);
-    Delete(0, p - _chars);
-  }
-  private:
-  CStringBase GetTrimDefaultCharSet()
-  {
-    CStringBase<T> charSet;
-    charSet += (T)' ';
-    charSet += (T)'\n';
-    charSet += (T)'\t';
-    return charSet;
-  }
-  public:
-
-  void TrimLeft()
-  {
-    TrimLeftWithCharSet(GetTrimDefaultCharSet());
-  }
-  void TrimRight()
-  {
-    TrimRightWithCharSet(GetTrimDefaultCharSet());
-  }
-  void TrimRight(T c)
-  {
-    const T *p = _chars;
-    const T *pLast = NULL;
-    while (*p != 0)
-    {
-      if (*p == c)
-      {
-        if (pLast == NULL)
-          pLast = p;
-      }
-      else
-        pLast = NULL;
-      p = GetNextCharPointer(p);
-    }
-    if (pLast != NULL)
-    {
-      int i = pLast - _chars;
-      Delete(i, _length - i);
-    }
-  }
-  void Trim()
-  {
-    TrimRight();
-    TrimLeft();
-  }
-
-  int Insert(int index, T c)
-  {
-    InsertSpace(index, 1);
-    _chars[index] = c;
-    _length++;
-    return _length;
-  }
-  int Insert(int index, const CStringBase &s)
-  {
-    CorrectIndex(index);
-    if (s.IsEmpty())
-      return _length;
-    int numInsertChars = s.Length();
-    InsertSpace(index, numInsertChars);
-    for (int i = 0; i < numInsertChars; i++)
-      _chars[index + i] = s[i];
-    _length += numInsertChars;
-    return _length;
-  }
-
-  // !!!!!!!!!!!!!!! test it if newChar = '\0'
-  int Replace(T oldChar, T newChar)
-  {
-    if (oldChar == newChar)
-      return 0;
-    int number  = 0;
-    int pos  = 0;
-    while (pos < Length())
-    {
-      pos = Find(oldChar, pos);
-      if (pos < 0)
-        break;
-      _chars[pos] = newChar;
-      pos++;
-      number++;
-    }
-    return number;
-  }
-  int Replace(const CStringBase &oldString, const CStringBase &newString)
-  {
-    if (oldString.IsEmpty())
-      return 0;
-    if (oldString == newString)
-      return 0;
-    int oldStringLength = oldString.Length();
-    int newStringLength = newString.Length();
-    int number  = 0;
-    int pos  = 0;
-    while (pos < _length)
-    {
-      pos = Find(oldString, pos);
-      if (pos < 0)
-        break;
-      Delete(pos, oldStringLength);
-      Insert(pos, newString);
-      pos += newStringLength;
-      number++;
-    }
-    return number;
-  }
-  int Delete(int index, int count = 1 )
-  {
-    if (index + count > _length)
-      count = _length - index;
-    if (count > 0)
-    {
-      MoveItems(index, index + count);
-      _length -= count;
-    }
-    return _length;
-  }
-};
-
-template <class T>
-CStringBase<T> operator+(const CStringBase<T>& s1, const CStringBase<T>& s2)
-{
-  CStringBase<T> result(s1);
-  result += s2;
-  return result;
-}
-
-template <class T>
-CStringBase<T> operator+(const CStringBase<T>& s, T c)
-{
-  CStringBase<T> result(s);
-  result += c;
-  return result;
-}
-
-template <class T>
-CStringBase<T> operator+(T c, const CStringBase<T>& s)
-{
-  CStringBase<T> result(c);
-  result += s;
-  return result;
-}
-
-template <class T>
-CStringBase<T> operator+(const CStringBase<T>& s, const T * chars)
-{
-  CStringBase<T> result(s);
-  result += chars;
-  return result;
-}
-
-template <class T>
-CStringBase<T> operator+(const T * chars, const CStringBase<T>& s)
-{
-  CStringBase<T> result(chars);
-  result += s;
-  return result;
-}
-
-template <class T>
-bool operator==(const CStringBase<T>& s1, const CStringBase<T>& s2)
-  { return (s1.Compare(s2) == 0); }
-
-template <class T>
-bool operator<(const CStringBase<T>& s1, const CStringBase<T>& s2)
-  { return (s1.Compare(s2) < 0); }
-
-template <class T>
-bool operator==(const T *s1, const CStringBase<T>& s2)
-  { return (s2.Compare(s1) == 0); }
-
-template <class T>
-bool operator==(const CStringBase<T>& s1, const T *s2)
-  { return (s1.Compare(s2) == 0); }
-
-template <class T>
-bool operator!=(const CStringBase<T>& s1, const CStringBase<T>& s2)
-  { return (s1.Compare(s2) != 0); }
-
-template <class T>
-bool operator!=(const T *s1, const CStringBase<T>& s2)
-  { return (s2.Compare(s1) != 0); }
-
-template <class T>
-bool operator!=(const CStringBase<T>& s1, const T *s2)
-  { return (s1.Compare(s2) != 0); }
-
-typedef CStringBase<char> AString;
-typedef CStringBase<wchar_t> UString;
-
-typedef CObjectVector<AString> AStringVector;
-typedef CObjectVector<UString> UStringVector;
-
-#ifdef _UNICODE
-  typedef UString CSysString;
-#else
-  typedef AString CSysString;
-#endif
-
-typedef CObjectVector<CSysString> CSysStringVector;
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/MyUnknown.h b/third_party/lzma/v4_65/files/CPP/Common/MyUnknown.h
deleted file mode 100644
index 136145a..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/MyUnknown.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// MyUnknown.h
-
-#ifndef __MYUNKNOWN_H
-#define __MYUNKNOWN_H
-
-#ifdef _WIN32
-
-#ifdef _WIN32_WCE
-#if (_WIN32_WCE > 300)
-#include <basetyps.h>
-#else
-#define MIDL_INTERFACE(x) struct
-#endif
-#else
-#include <basetyps.h>
-#endif
-
-#include <unknwn.h>
-
-#else
-#include "MyWindows.h"
-#endif
-  
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/MyVector.cpp b/third_party/lzma/v4_65/files/CPP/Common/MyVector.cpp
deleted file mode 100644
index 88d9993..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/MyVector.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-// Common/MyVector.cpp
-
-#include "StdAfx.h"
-
-#include <string.h>
-
-#include "MyVector.h"
-
-CBaseRecordVector::~CBaseRecordVector() { ClearAndFree(); }
-
-void CBaseRecordVector::ClearAndFree()
-{
-  Clear();
-  delete []((unsigned char *)_items);
-  _capacity = 0;
-  _size = 0;
-  _items = 0;
-}
-
-void CBaseRecordVector::Clear() { DeleteFrom(0); }
-void CBaseRecordVector::DeleteBack() { Delete(_size - 1); }
-void CBaseRecordVector::DeleteFrom(int index) { Delete(index, _size - index); }
-
-void CBaseRecordVector::ReserveOnePosition()
-{
-  if (_size != _capacity)
-    return;
-  int delta = 1;
-  if (_capacity >= 64)
-    delta = _capacity / 4;
-  else if (_capacity >= 8)
-    delta = 8;
-  Reserve(_capacity + delta);
-}
-
-void CBaseRecordVector::Reserve(int newCapacity)
-{
-  // if (newCapacity <= _capacity)
-  if (newCapacity == _capacity)
-    return;
-  if ((unsigned)newCapacity >= ((unsigned)1 << (sizeof(unsigned) * 8 - 1)))
-    throw 1052353;
-  size_t newSize = (size_t)(unsigned)newCapacity * _itemSize;
-  if (newSize / _itemSize != (size_t)(unsigned)newCapacity)
-    throw 1052354;
-  unsigned char *p = NULL;
-  if (newSize > 0)
-  {
-    p = new unsigned char[newSize];
-    if (p == 0)
-      throw 1052355;
-    int numRecordsToMove = (_size < newCapacity ? _size : newCapacity);
-    memcpy(p, _items, _itemSize * numRecordsToMove);
-  }
-  delete [](unsigned char *)_items;
-  _items = p;
-  _capacity = newCapacity;
-}
-
-void CBaseRecordVector::ReserveDown()
-{
-  Reserve(_size);
-}
-
-void CBaseRecordVector::MoveItems(int destIndex, int srcIndex)
-{
-  memmove(((unsigned char *)_items) + destIndex * _itemSize,
-    ((unsigned char  *)_items) + srcIndex * _itemSize,
-    _itemSize * (_size - srcIndex));
-}
-
-void CBaseRecordVector::InsertOneItem(int index)
-{
-  ReserveOnePosition();
-  MoveItems(index + 1, index);
-  _size++;
-}
-
-void CBaseRecordVector::Delete(int index, int num)
-{
-  TestIndexAndCorrectNum(index, num);
-  if (num > 0)
-  {
-    MoveItems(index, index + num);
-    _size -= num;
-  }
-}
diff --git a/third_party/lzma/v4_65/files/CPP/Common/MyVector.h b/third_party/lzma/v4_65/files/CPP/Common/MyVector.h
deleted file mode 100644
index 079e8ae..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/MyVector.h
+++ /dev/null
@@ -1,250 +0,0 @@
-// Common/Vector.h
-
-#ifndef __COMMON_VECTOR_H
-#define __COMMON_VECTOR_H
-
-#include "Defs.h"
-
-class CBaseRecordVector
-{
-  void MoveItems(int destIndex, int srcIndex);
-protected:
-  int _capacity;
-  int _size;
-  void *_items;
-  size_t _itemSize;
-  
-  void ReserveOnePosition();
-  void InsertOneItem(int index);
-  void TestIndexAndCorrectNum(int index, int &num) const
-    { if (index + num > _size) num = _size - index; }
-public:
-  CBaseRecordVector(size_t itemSize): _capacity(0), _size(0), _items(0), _itemSize(itemSize) {}
-  virtual ~CBaseRecordVector();
-  void ClearAndFree();
-  int Size() const { return _size; }
-  bool IsEmpty() const { return (_size == 0); }
-  void Reserve(int newCapacity);
-  void ReserveDown();
-  virtual void Delete(int index, int num = 1);
-  void Clear();
-  void DeleteFrom(int index);
-  void DeleteBack();
-};
-
-template <class T>
-class CRecordVector: public CBaseRecordVector
-{
-public:
-  CRecordVector(): CBaseRecordVector(sizeof(T)){};
-  CRecordVector(const CRecordVector &v): CBaseRecordVector(sizeof(T)) { *this = v; }
-  CRecordVector& operator=(const CRecordVector &v)
-  {
-    Clear();
-    return (*this += v);
-  }
-  CRecordVector& operator+=(const CRecordVector &v)
-  {
-    int size = v.Size();
-    Reserve(Size() + size);
-    for (int i = 0; i < size; i++)
-      Add(v[i]);
-    return *this;
-  }
-  int Add(T item)
-  {
-    ReserveOnePosition();
-    ((T *)_items)[_size] = item;
-    return _size++;
-  }
-  void Insert(int index, T item)
-  {
-    InsertOneItem(index);
-    ((T *)_items)[index] = item;
-  }
-  // T* GetPointer() const { return (T*)_items; }
-  // operator const T *() const { return _items; };
-  const T& operator[](int index) const { return ((T *)_items)[index]; }
-  T& operator[](int index) { return ((T *)_items)[index]; }
-  const T& Front() const { return operator[](0); }
-  T& Front() { return operator[](0); }
-  const T& Back() const { return operator[](_size - 1); }
-  T& Back() { return operator[](_size - 1); }
-
-  void Swap(int i, int j)
-  {
-    T temp = operator[](i);
-    operator[](i) = operator[](j);
-    operator[](j) = temp;
-  }
-
-  int FindInSorted(const T& item) const
-  {
-    int left = 0, right = Size();
-    while (left != right)
-    {
-      int mid = (left + right) / 2;
-      const T& midValue = (*this)[mid];
-      if (item == midValue)
-        return mid;
-      if (item < midValue)
-        right = mid;
-      else
-        left = mid + 1;
-    }
-    return -1;
-  }
-
-  int AddToUniqueSorted(const T& item)
-  {
-    int left = 0, right = Size();
-    while (left != right)
-    {
-      int mid = (left + right) / 2;
-      const T& midValue = (*this)[mid];
-      if (item == midValue)
-        return mid;
-      if (item < midValue)
-        right = mid;
-      else
-        left = mid + 1;
-    }
-    Insert(right, item);
-    return right;
-  }
-
-  static void SortRefDown(T* p, int k, int size, int (*compare)(const T*, const T*, void *), void *param)
-  {
-    T temp = p[k];
-    for (;;)
-    {
-      int s = (k << 1);
-      if (s > size)
-        break;
-      if (s < size && compare(p + s + 1, p + s, param) > 0)
-        s++;
-      if (compare(&temp, p + s, param) >= 0)
-        break;
-      p[k] = p[s];
-      k = s;
-    }
-    p[k] = temp;
-  }
-
-  void Sort(int (*compare)(const T*, const T*, void *), void *param)
-  {
-    int size = _size;
-    if (size <= 1)
-      return;
-    T* p = (&Front()) - 1;
-    {
-      int i = size / 2;
-      do
-        SortRefDown(p, i, size, compare, param);
-      while (--i != 0);
-    }
-    do
-    {
-      T temp = p[size];
-      p[size--] = p[1];
-      p[1] = temp;
-      SortRefDown(p, 1, size, compare, param);
-    }
-    while (size > 1);
-  }
-};
-
-typedef CRecordVector<int> CIntVector;
-typedef CRecordVector<unsigned int> CUIntVector;
-typedef CRecordVector<bool> CBoolVector;
-typedef CRecordVector<unsigned char> CByteVector;
-typedef CRecordVector<void *> CPointerVector;
-
-template <class T>
-class CObjectVector: public CPointerVector
-{
-public:
-  CObjectVector() {};
-  ~CObjectVector() { Clear(); };
-  CObjectVector(const CObjectVector &v) { *this = v; }
-  CObjectVector& operator=(const CObjectVector &v)
-  {
-    Clear();
-    return (*this += v);
-  }
-  CObjectVector& operator+=(const CObjectVector &v)
-  {
-    int size = v.Size();
-    Reserve(Size() + size);
-    for (int i = 0; i < size; i++)
-      Add(v[i]);
-    return *this;
-  }
-  const T& operator[](int index) const { return *((T *)CPointerVector::operator[](index)); }
-  T& operator[](int index) { return *((T *)CPointerVector::operator[](index)); }
-  T& Front() { return operator[](0); }
-  const T& Front() const { return operator[](0); }
-  T& Back() { return operator[](_size - 1); }
-  const T& Back() const { return operator[](_size - 1); }
-  int Add(const T& item) { return CPointerVector::Add(new T(item)); }
-  void Insert(int index, const T& item) { CPointerVector::Insert(index, new T(item)); }
-  virtual void Delete(int index, int num = 1)
-  {
-    TestIndexAndCorrectNum(index, num);
-    for (int i = 0; i < num; i++)
-      delete (T *)(((void **)_items)[index + i]);
-    CPointerVector::Delete(index, num);
-  }
-  int Find(const T& item) const
-  {
-    for (int i = 0; i < Size(); i++)
-      if (item == (*this)[i])
-        return i;
-    return -1;
-  }
-  int FindInSorted(const T& item) const
-  {
-    int left = 0, right = Size();
-    while (left != right)
-    {
-      int mid = (left + right) / 2;
-      const T& midValue = (*this)[mid];
-      if (item == midValue)
-        return mid;
-      if (item < midValue)
-        right = mid;
-      else
-        left = mid + 1;
-    }
-    return -1;
-  }
-  int AddToSorted(const T& item)
-  {
-    int left = 0, right = Size();
-    while (left != right)
-    {
-      int mid = (left + right) / 2;
-      const T& midValue = (*this)[mid];
-      if (item == midValue)
-      {
-        right = mid + 1;
-        break;
-      }
-      if (item < midValue)
-        right = mid;
-      else
-        left = mid + 1;
-    }
-    Insert(right, item);
-    return right;
-  }
-
-  void Sort(int (*compare)(void *const *, void *const *, void *), void *param)
-    { CPointerVector::Sort(compare, param); }
-
-  static int CompareObjectItems(void *const *a1, void *const *a2, void * /* param */)
-    { return MyCompare(*(*((const T **)a1)), *(*((const T **)a2))); }
-  void Sort() { CPointerVector::Sort(CompareObjectItems, 0); }
-};
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/MyWindows.h b/third_party/lzma/v4_65/files/CPP/Common/MyWindows.h
deleted file mode 100644
index 2861ba0..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/MyWindows.h
+++ /dev/null
@@ -1,214 +0,0 @@
-// MyWindows.h
-
-#ifndef __MYWINDOWS_H
-#define __MYWINDOWS_H
-
-#ifdef _WIN32
-
-#include <windows.h>
-
-#define CHAR_PATH_SEPARATOR '\\'
-#define WCHAR_PATH_SEPARATOR L'\\'
-#define STRING_PATH_SEPARATOR "\\"
-#define WSTRING_PATH_SEPARATOR L"\\"
-
-#else
-
-#define CHAR_PATH_SEPARATOR '/'
-#define WCHAR_PATH_SEPARATOR L'/'
-#define STRING_PATH_SEPARATOR "/"
-#define WSTRING_PATH_SEPARATOR L"/"
-
-#include <stddef.h> // for wchar_t
-#include <string.h>
-
-#include "MyGuidDef.h"
-
-typedef char CHAR;
-typedef unsigned char UCHAR;
-
-#undef BYTE
-typedef unsigned char BYTE;
-
-typedef short SHORT;
-typedef unsigned short USHORT;
-
-#undef WORD
-typedef unsigned short WORD;
-typedef short VARIANT_BOOL;
-
-typedef int INT;
-typedef Int32 INT32;
-typedef unsigned int UINT;
-typedef UInt32 UINT32;
-typedef INT32 LONG;   // LONG, ULONG and DWORD must be 32-bit
-typedef UINT32 ULONG;
-
-#undef DWORD
-typedef UINT32 DWORD;
-
-typedef Int64 LONGLONG;
-typedef UInt64 ULONGLONG;
-
-typedef struct LARGE_INTEGER { LONGLONG QuadPart; }LARGE_INTEGER;
-typedef struct _ULARGE_INTEGER { ULONGLONG QuadPart;} ULARGE_INTEGER;
-
-typedef const CHAR *LPCSTR;
-typedef CHAR TCHAR;
-typedef const TCHAR *LPCTSTR;
-typedef wchar_t WCHAR;
-typedef WCHAR OLECHAR;
-typedef const WCHAR *LPCWSTR;
-typedef OLECHAR *BSTR;
-typedef const OLECHAR *LPCOLESTR;
-typedef OLECHAR *LPOLESTR;
-
-typedef struct _FILETIME
-{
-  DWORD dwLowDateTime;
-  DWORD dwHighDateTime;
-}FILETIME;
-
-#define HRESULT LONG
-#define FAILED(Status) ((HRESULT)(Status)<0)
-typedef ULONG PROPID;
-typedef LONG SCODE;
-
-#define S_OK    ((HRESULT)0x00000000L)
-#define S_FALSE ((HRESULT)0x00000001L)
-#define E_NOTIMPL ((HRESULT)0x80004001L)
-#define E_NOINTERFACE ((HRESULT)0x80004002L)
-#define E_ABORT ((HRESULT)0x80004004L)
-#define E_FAIL ((HRESULT)0x80004005L)
-#define STG_E_INVALIDFUNCTION ((HRESULT)0x80030001L)
-#define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
-#define E_INVALIDARG ((HRESULT)0x80070057L)
-
-#ifdef _MSC_VER
-#define STDMETHODCALLTYPE __stdcall
-#else
-#define STDMETHODCALLTYPE
-#endif
-
-#define STDMETHOD_(t, f) virtual t STDMETHODCALLTYPE f
-#define STDMETHOD(f) STDMETHOD_(HRESULT, f)
-#define STDMETHODIMP_(type) type STDMETHODCALLTYPE
-#define STDMETHODIMP STDMETHODIMP_(HRESULT)
-
-#define PURE = 0
-
-#define MIDL_INTERFACE(x) struct
-
-#ifdef __cplusplus
-
-DEFINE_GUID(IID_IUnknown,
-0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
-struct IUnknown
-{
-  STDMETHOD(QueryInterface) (REFIID iid, void **outObject) PURE;
-  STDMETHOD_(ULONG, AddRef)() PURE;
-  STDMETHOD_(ULONG, Release)() PURE;
-  #ifndef _WIN32
-  virtual ~IUnknown() {}
-  #endif
-};
-
-typedef IUnknown *LPUNKNOWN;
-
-#endif
-
-#define VARIANT_TRUE ((VARIANT_BOOL)-1)
-#define VARIANT_FALSE ((VARIANT_BOOL)0)
-
-enum VARENUM
-{
-  VT_EMPTY = 0,
-  VT_NULL = 1,
-  VT_I2 = 2,
-  VT_I4 = 3,
-  VT_R4 = 4,
-  VT_R8 = 5,
-  VT_CY = 6,
-  VT_DATE = 7,
-  VT_BSTR = 8,
-  VT_DISPATCH = 9,
-  VT_ERROR = 10,
-  VT_BOOL = 11,
-  VT_VARIANT = 12,
-  VT_UNKNOWN = 13,
-  VT_DECIMAL = 14,
-  VT_I1 = 16,
-  VT_UI1 = 17,
-  VT_UI2 = 18,
-  VT_UI4 = 19,
-  VT_I8 = 20,
-  VT_UI8 = 21,
-  VT_INT = 22,
-  VT_UINT = 23,
-  VT_VOID = 24,
-  VT_HRESULT = 25,
-  VT_FILETIME = 64
-};
-
-typedef unsigned short VARTYPE;
-typedef WORD PROPVAR_PAD1;
-typedef WORD PROPVAR_PAD2;
-typedef WORD PROPVAR_PAD3;
-
-#ifdef __cplusplus
-
-typedef struct tagPROPVARIANT
-{
-  VARTYPE vt;
-  PROPVAR_PAD1 wReserved1;
-  PROPVAR_PAD2 wReserved2;
-  PROPVAR_PAD3 wReserved3;
-  union
-  {
-    CHAR cVal;
-    UCHAR bVal;
-    SHORT iVal;
-    USHORT uiVal;
-    LONG lVal;
-    ULONG ulVal;
-    INT intVal;
-    UINT uintVal;
-    LARGE_INTEGER hVal;
-    ULARGE_INTEGER uhVal;
-    VARIANT_BOOL boolVal;
-    SCODE scode;
-    FILETIME filetime;
-    BSTR bstrVal;
-  };
-} PROPVARIANT;
-
-typedef PROPVARIANT tagVARIANT;
-typedef tagVARIANT VARIANT;
-typedef VARIANT VARIANTARG;
-
-MY_EXTERN_C HRESULT VariantClear(VARIANTARG *prop);
-MY_EXTERN_C HRESULT VariantCopy(VARIANTARG *dest, VARIANTARG *src);
-
-#endif
-
-MY_EXTERN_C BSTR SysAllocStringByteLen(LPCSTR psz, UINT len);
-MY_EXTERN_C BSTR SysAllocString(const OLECHAR *sz);
-MY_EXTERN_C void SysFreeString(BSTR bstr);
-MY_EXTERN_C UINT SysStringByteLen(BSTR bstr);
-MY_EXTERN_C UINT SysStringLen(BSTR bstr);
-
-MY_EXTERN_C DWORD GetLastError();
-MY_EXTERN_C LONG CompareFileTime(const FILETIME* ft1, const FILETIME* ft2);
-
-#define CP_ACP    0
-#define CP_OEMCP  1
-
-typedef enum tagSTREAM_SEEK
-{
-  STREAM_SEEK_SET = 0,
-  STREAM_SEEK_CUR = 1,
-  STREAM_SEEK_END = 2
-} STREAM_SEEK;
-
-#endif
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/NewHandler.cpp b/third_party/lzma/v4_65/files/CPP/Common/NewHandler.cpp
deleted file mode 100644
index aad6e7d..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/NewHandler.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-// NewHandler.cpp
- 
-#include "StdAfx.h"
-
-#include <stdlib.h>
-
-#include "NewHandler.h"
-
-// #define DEBUG_MEMORY_LEAK
-
-#ifndef DEBUG_MEMORY_LEAK
-
-#ifdef _WIN32
-void *
-#ifdef _MSC_VER
-__cdecl
-#endif
-operator new(size_t size)
-{
-  // void *p = ::HeapAlloc(::GetProcessHeap(), 0, size);
-  void *p = ::malloc(size);
-  if (p == 0)
-    throw CNewException();
-  return p;
-}
-
-void
-#ifdef _MSC_VER
-__cdecl
-#endif
-operator delete(void *p) throw()
-{
-  /*
-  if (p == 0)
-    return;
-  ::HeapFree(::GetProcessHeap(), 0, p);
-  */
-  ::free(p);
-}
-#endif
-
-#else
-
-#pragma init_seg(lib)
-const int kDebugSize = 1000000;
-static void *a[kDebugSize];
-static int index = 0;
-
-static int numAllocs = 0;
-void * __cdecl operator new(size_t size)
-{
-  numAllocs++;
-  void *p = HeapAlloc(GetProcessHeap(), 0, size);
-  if (index == 40)
-  {
-    int t = 1;
-  }
-  if (index < kDebugSize)
-  {
-    a[index] = p;
-    index++;
-  }
-  if (p == 0)
-    throw CNewException();
-  printf("Alloc %6d, size = %8d\n", numAllocs, size);
-  return p;
-}
-
-class CC
-{
-public:
-  CC()
-  {
-    for (int i = 0; i < kDebugSize; i++)
-      a[i] = 0;
-  }
-  ~CC()
-  {
-    for (int i = 0; i < kDebugSize; i++)
-      if (a[i] != 0)
-        return;
-  }
-} g_CC;
-
-
-void __cdecl operator delete(void *p)
-{
-  if (p == 0)
-    return;
-  /*
-  for (int i = 0; i < index; i++)
-    if (a[i] == p)
-      a[i] = 0;
-  */
-  HeapFree(GetProcessHeap(), 0, p);
-  numAllocs--;
-  printf("Free %d\n", numAllocs);
-}
-
-#endif
-
-/*
-int MemErrorVC(size_t)
-{
-  throw CNewException();
-  // return 1;
-}
-CNewHandlerSetter::CNewHandlerSetter()
-{
-  // MemErrorOldVCFunction = _set_new_handler(MemErrorVC);
-}
-CNewHandlerSetter::~CNewHandlerSetter()
-{
-  // _set_new_handler(MemErrorOldVCFunction);
-}
-*/
diff --git a/third_party/lzma/v4_65/files/CPP/Common/NewHandler.h b/third_party/lzma/v4_65/files/CPP/Common/NewHandler.h
deleted file mode 100644
index 215ba05..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/NewHandler.h
+++ /dev/null
@@ -1,16 +0,0 @@
-// Common/NewHandler.h
-
-#ifndef __COMMON_NEWHANDLER_H
-#define __COMMON_NEWHANDLER_H
-
-class CNewException {};
-
-#ifdef _WIN32
-void
-#ifdef _MSC_VER
-__cdecl
-#endif
-operator delete(void *p) throw();
-#endif
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/StdAfx.h b/third_party/lzma/v4_65/files/CPP/Common/StdAfx.h
deleted file mode 100644
index b8ba1d5..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/StdAfx.h
+++ /dev/null
@@ -1,9 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-// #include "MyWindows.h"
-#include "NewHandler.h"
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/StdInStream.cpp b/third_party/lzma/v4_65/files/CPP/Common/StdInStream.cpp
deleted file mode 100644
index b3d0092..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/StdInStream.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-// Common/StdInStream.cpp
-
-#include "StdAfx.h"
-
-#include <tchar.h>
-#include "StdInStream.h"
-
-#ifdef _MSC_VER
-// "was declared deprecated" disabling
-#pragma warning(disable : 4996 )
-#endif
-
-static const char kIllegalChar = '\0';
-static const char kNewLineChar = '\n';
-
-static const char *kEOFMessage = "Unexpected end of input stream";
-static const char *kReadErrorMessage  ="Error reading input stream";
-static const char *kIllegalCharMessage = "Illegal character in input stream";
-
-static LPCTSTR kFileOpenMode = TEXT("r");
-
-CStdInStream g_StdIn(stdin);
-
-bool CStdInStream::Open(LPCTSTR fileName)
-{
-  Close();
-  _stream = _tfopen(fileName, kFileOpenMode);
-  _streamIsOpen = (_stream != 0);
-  return _streamIsOpen;
-}
-
-bool CStdInStream::Close()
-{
-  if (!_streamIsOpen)
-    return true;
-  _streamIsOpen = (fclose(_stream) != 0);
-  return !_streamIsOpen;
-}
-
-CStdInStream::~CStdInStream()
-{
-  Close();
-}
-
-AString CStdInStream::ScanStringUntilNewLine()
-{
-  AString s;
-  for (;;)
-  {
-    int intChar = GetChar();
-    if (intChar == EOF)
-      throw kEOFMessage;
-    char c = char(intChar);
-    if (c == kIllegalChar)
-      throw kIllegalCharMessage;
-    if (c == kNewLineChar)
-      break;
-    s += c;
-  }
-  return s;
-}
-
-void CStdInStream::ReadToString(AString &resultString)
-{
-  resultString.Empty();
-  int c;
-  while ((c = GetChar()) != EOF)
-    resultString += char(c);
-}
-
-bool CStdInStream::Eof()
-{
-  return (feof(_stream) != 0);
-}
-
-int CStdInStream::GetChar()
-{
-  int c = fgetc(_stream); // getc() doesn't work in BeOS?
-  if (c == EOF && !Eof())
-    throw kReadErrorMessage;
-  return c;
-}
-
-
diff --git a/third_party/lzma/v4_65/files/CPP/Common/StdInStream.h b/third_party/lzma/v4_65/files/CPP/Common/StdInStream.h
deleted file mode 100644
index 4b08c7c..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/StdInStream.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Common/StdInStream.h
-
-#ifndef __COMMON_STDINSTREAM_H
-#define __COMMON_STDINSTREAM_H
-
-#include <stdio.h>
-
-#include "MyString.h"
-#include "Types.h"
-
-class CStdInStream
-{
-  bool _streamIsOpen;
-  FILE *_stream;
-public:
-  CStdInStream(): _streamIsOpen(false) {};
-  CStdInStream(FILE *stream): _streamIsOpen(false), _stream(stream) {};
-  ~CStdInStream();
-  bool Open(LPCTSTR fileName);
-  bool Close();
-
-  AString ScanStringUntilNewLine();
-  void ReadToString(AString &resultString);
-
-  bool Eof();
-  int GetChar();
-};
-
-extern CStdInStream g_StdIn;
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/StdOutStream.cpp b/third_party/lzma/v4_65/files/CPP/Common/StdOutStream.cpp
deleted file mode 100644
index b93e255..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/StdOutStream.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-// Common/StdOutStream.cpp
-
-#include "StdAfx.h"
-
-#include <tchar.h>
-
-#include "StdOutStream.h"
-#include "IntToString.h"
-#include "StringConvert.h"
-
-#ifdef _MSC_VER
-// "was declared deprecated" disabling
-#pragma warning(disable : 4996 )
-#endif
-
-static const char kNewLineChar =  '\n';
-
-static const char *kFileOpenMode = "wt";
-
-CStdOutStream  g_StdOut(stdout);
-CStdOutStream  g_StdErr(stderr);
-
-bool CStdOutStream::Open(const char *fileName)
-{
-  Close();
-  _stream = fopen(fileName, kFileOpenMode);
-  _streamIsOpen = (_stream != 0);
-  return _streamIsOpen;
-}
-
-bool CStdOutStream::Close()
-{
-  if (!_streamIsOpen)
-    return true;
-  if (fclose(_stream) != 0)
-    return false;
-  _stream = 0;
-  _streamIsOpen = false;
-  return true;
-}
-
-bool CStdOutStream::Flush()
-{
-  return (fflush(_stream) == 0);
-}
-
-CStdOutStream::~CStdOutStream ()
-{
-  Close();
-}
-
-CStdOutStream & CStdOutStream::operator<<(CStdOutStream & (*aFunction)(CStdOutStream  &))
-{
-  (*aFunction)(*this);
-  return *this;
-}
-
-CStdOutStream & endl(CStdOutStream & outStream)
-{
-  return outStream << kNewLineChar;
-}
-
-CStdOutStream & CStdOutStream::operator<<(const char *string)
-{
-  fputs(string, _stream);
-  return *this;
-}
-
-CStdOutStream & CStdOutStream::operator<<(const wchar_t *string)
-{
-  *this << (const char *)UnicodeStringToMultiByte(string, CP_OEMCP);
-  return *this;
-}
-
-CStdOutStream & CStdOutStream::operator<<(char c)
-{
-  fputc(c, _stream);
-  return *this;
-}
-
-CStdOutStream & CStdOutStream::operator<<(int number)
-{
-  char textString[32];
-  ConvertInt64ToString(number, textString);
-  return operator<<(textString);
-}
-
-CStdOutStream & CStdOutStream::operator<<(UInt64 number)
-{
-  char textString[32];
-  ConvertUInt64ToString(number, textString);
-  return operator<<(textString);
-}
diff --git a/third_party/lzma/v4_65/files/CPP/Common/StdOutStream.h b/third_party/lzma/v4_65/files/CPP/Common/StdOutStream.h
deleted file mode 100644
index b0b2c61..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/StdOutStream.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Common/StdOutStream.h
-
-#ifndef __COMMON_STDOUTSTREAM_H
-#define __COMMON_STDOUTSTREAM_H
-
-#include <stdio.h>
-
-#include "Types.h"
-
-class CStdOutStream
-{
-  bool _streamIsOpen;
-  FILE *_stream;
-public:
-  CStdOutStream (): _streamIsOpen(false), _stream(0) {};
-  CStdOutStream (FILE *stream): _streamIsOpen(false), _stream(stream) {};
-  ~CStdOutStream ();
-  operator FILE *() { return _stream; }
-  bool Open(const char *fileName);
-  bool Close();
-  bool Flush();
-  CStdOutStream & operator<<(CStdOutStream & (* aFunction)(CStdOutStream  &));
-  CStdOutStream & operator<<(const char *string);
-  CStdOutStream & operator<<(const wchar_t *string);
-  CStdOutStream & operator<<(char c);
-  CStdOutStream & operator<<(int number);
-  CStdOutStream & operator<<(UInt64 number);
-};
-
-CStdOutStream & endl(CStdOutStream & outStream);
-
-extern CStdOutStream g_StdOut;
-extern CStdOutStream g_StdErr;
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/StringConvert.cpp b/third_party/lzma/v4_65/files/CPP/Common/StringConvert.cpp
deleted file mode 100644
index 9bd47de..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/StringConvert.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-// Common/StringConvert.cpp
-
-#include "StdAfx.h"
-
-#include "StringConvert.h"
-
-#ifndef _WIN32
-#include <stdlib.h>
-#endif
-
-#ifdef _WIN32
-UString MultiByteToUnicodeString(const AString &srcString, UINT codePage)
-{
-  UString resultString;
-  if (!srcString.IsEmpty())
-  {
-    int numChars = MultiByteToWideChar(codePage, 0, srcString,
-      srcString.Length(), resultString.GetBuffer(srcString.Length()),
-      srcString.Length() + 1);
-    #ifndef _WIN32_WCE
-    if (numChars == 0)
-      throw 282228;
-    #endif
-    resultString.ReleaseBuffer(numChars);
-  }
-  return resultString;
-}
-
-AString UnicodeStringToMultiByte(const UString &s, UINT codePage, char defaultChar, bool &defaultCharWasUsed)
-{
-  AString dest;
-  defaultCharWasUsed = false;
-  if (!s.IsEmpty())
-  {
-    int numRequiredBytes = s.Length() * 2;
-    BOOL defUsed;
-    int numChars = WideCharToMultiByte(codePage, 0, s, s.Length(),
-        dest.GetBuffer(numRequiredBytes), numRequiredBytes + 1,
-        &defaultChar, &defUsed);
-    defaultCharWasUsed = (defUsed != FALSE);
-    #ifndef _WIN32_WCE
-    if (numChars == 0)
-      throw 282229;
-    #endif
-    dest.ReleaseBuffer(numChars);
-  }
-  return dest;
-}
-
-AString UnicodeStringToMultiByte(const UString &srcString, UINT codePage)
-{
-  bool defaultCharWasUsed;
-  return UnicodeStringToMultiByte(srcString, codePage, '_', defaultCharWasUsed);
-}
-
-#ifndef _WIN32_WCE
-AString SystemStringToOemString(const CSysString &srcString)
-{
-  AString result;
-  CharToOem(srcString, result.GetBuffer(srcString.Length() * 2));
-  result.ReleaseBuffer();
-  return result;
-}
-#endif
-
-#else
-
-UString MultiByteToUnicodeString(const AString &srcString, UINT codePage)
-{
-  UString resultString;
-  for (int i = 0; i < srcString.Length(); i++)
-    resultString += wchar_t(srcString[i]);
-  /*
-  if (!srcString.IsEmpty())
-  {
-    int numChars = mbstowcs(resultString.GetBuffer(srcString.Length()), srcString, srcString.Length() + 1);
-    if (numChars < 0) throw "Your environment does not support UNICODE";
-    resultString.ReleaseBuffer(numChars);
-  }
-  */
-  return resultString;
-}
-
-AString UnicodeStringToMultiByte(const UString &srcString, UINT codePage)
-{
-  AString resultString;
-  for (int i = 0; i < srcString.Length(); i++)
-    resultString += char(srcString[i]);
-  /*
-  if (!srcString.IsEmpty())
-  {
-    int numRequiredBytes = srcString.Length() * 6 + 1;
-    int numChars = wcstombs(resultString.GetBuffer(numRequiredBytes), srcString, numRequiredBytes);
-    if (numChars < 0) throw "Your environment does not support UNICODE";
-    resultString.ReleaseBuffer(numChars);
-  }
-  */
-  return resultString;
-}
-
-#endif
-
diff --git a/third_party/lzma/v4_65/files/CPP/Common/StringConvert.h b/third_party/lzma/v4_65/files/CPP/Common/StringConvert.h
deleted file mode 100644
index 0c37eb0..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/StringConvert.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// Common/StringConvert.h
-
-#ifndef __COMMON_STRINGCONVERT_H
-#define __COMMON_STRINGCONVERT_H
-
-#include "MyWindows.h"
-#include "MyString.h"
-#include "Types.h"
-
-UString MultiByteToUnicodeString(const AString &srcString, UINT codePage = CP_ACP);
-AString UnicodeStringToMultiByte(const UString &srcString, UINT codePage, char defaultChar, bool &defaultCharWasUsed);
-AString UnicodeStringToMultiByte(const UString &srcString, UINT codePage = CP_ACP);
-
-
-inline const wchar_t* GetUnicodeString(const wchar_t* unicodeString)
-  { return unicodeString; }
-inline const UString& GetUnicodeString(const UString &unicodeString)
-  { return unicodeString; }
-inline UString GetUnicodeString(const AString &ansiString)
-  { return MultiByteToUnicodeString(ansiString); }
-inline UString GetUnicodeString(const AString &multiByteString, UINT codePage)
-  { return MultiByteToUnicodeString(multiByteString, codePage); }
-inline const wchar_t* GetUnicodeString(const wchar_t* unicodeString, UINT)
-  { return unicodeString; }
-inline const UString& GetUnicodeString(const UString &unicodeString, UINT)
-  { return unicodeString; }
-
-inline const char* GetAnsiString(const char* ansiString)
-  { return ansiString; }
-inline const AString& GetAnsiString(const AString &ansiString)
-  { return ansiString; }
-inline AString GetAnsiString(const UString &unicodeString)
-  { return UnicodeStringToMultiByte(unicodeString); }
-
-inline const char* GetOemString(const char* oemString)
-  { return oemString; }
-inline const AString& GetOemString(const AString &oemString)
-  { return oemString; }
-inline AString GetOemString(const UString &unicodeString)
-  { return UnicodeStringToMultiByte(unicodeString, CP_OEMCP); }
-
-
-#ifdef _UNICODE
-  inline const wchar_t* GetSystemString(const wchar_t* unicodeString)
-    { return unicodeString;}
-  inline const UString& GetSystemString(const UString &unicodeString)
-    { return unicodeString;}
-  inline const wchar_t* GetSystemString(const wchar_t* unicodeString, UINT /* codePage */)
-    { return unicodeString;}
-  inline const UString& GetSystemString(const UString &unicodeString, UINT /* codePage */)
-    { return unicodeString;}
-  inline UString GetSystemString(const AString &multiByteString, UINT codePage)
-    { return MultiByteToUnicodeString(multiByteString, codePage);}
-  inline UString GetSystemString(const AString &multiByteString)
-    { return MultiByteToUnicodeString(multiByteString);}
-#else
-  inline const char* GetSystemString(const char *ansiString)
-    { return ansiString; }
-  inline const AString& GetSystemString(const AString &multiByteString, UINT)
-    { return multiByteString; }
-  inline const char * GetSystemString(const char *multiByteString, UINT)
-    { return multiByteString; }
-  inline AString GetSystemString(const UString &unicodeString)
-    { return UnicodeStringToMultiByte(unicodeString); }
-  inline AString GetSystemString(const UString &unicodeString, UINT codePage)
-    { return UnicodeStringToMultiByte(unicodeString, codePage); }
-#endif
-
-#ifndef _WIN32_WCE
-AString SystemStringToOemString(const CSysString &srcString);
-#endif
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/StringToInt.cpp b/third_party/lzma/v4_65/files/CPP/Common/StringToInt.cpp
deleted file mode 100644
index 9473766..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/StringToInt.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-// Common/StringToInt.cpp
-
-#include "StdAfx.h"
-
-#include "StringToInt.h"
-
-UInt64 ConvertStringToUInt64(const char *s, const char **end)
-{
-  UInt64 result = 0;
-  for (;;)
-  {
-    char c = *s;
-    if (c < '0' || c > '9')
-    {
-      if (end != NULL)
-        *end = s;
-      return result;
-    }
-    result *= 10;
-    result += (c - '0');
-    s++;
-  }
-}
-
-UInt64 ConvertOctStringToUInt64(const char *s, const char **end)
-{
-  UInt64 result = 0;
-  for (;;)
-  {
-    char c = *s;
-    if (c < '0' || c > '7')
-    {
-      if (end != NULL)
-        *end = s;
-      return result;
-    }
-    result <<= 3;
-    result += (c - '0');
-    s++;
-  }
-}
-
-UInt64 ConvertHexStringToUInt64(const char *s, const char **end)
-{
-  UInt64 result = 0;
-  for (;;)
-  {
-    char c = *s;
-    UInt32 v;
-    if (c >= '0' && c <= '9') v = (c - '0');
-    else if (c >= 'A' && c <= 'F') v = 10 + (c - 'A');
-    else if (c >= 'a' && c <= 'f') v = 10 + (c - 'a');
-    else
-    {
-      if (end != NULL)
-        *end = s;
-      return result;
-    }
-    result <<= 4;
-    result |= v;
-    s++;
-  }
-}
-
-
-UInt64 ConvertStringToUInt64(const wchar_t *s, const wchar_t **end)
-{
-  UInt64 result = 0;
-  for (;;)
-  {
-    wchar_t c = *s;
-    if (c < '0' || c > '9')
-    {
-      if (end != NULL)
-        *end = s;
-      return result;
-    }
-    result *= 10;
-    result += (c - '0');
-    s++;
-  }
-}
-
-
-Int64 ConvertStringToInt64(const char *s, const char **end)
-{
-  if (*s == '-')
-    return -(Int64)ConvertStringToUInt64(s + 1, end);
-  return ConvertStringToUInt64(s, end);
-}
diff --git a/third_party/lzma/v4_65/files/CPP/Common/StringToInt.h b/third_party/lzma/v4_65/files/CPP/Common/StringToInt.h
deleted file mode 100644
index c0d860e..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/StringToInt.h
+++ /dev/null
@@ -1,18 +0,0 @@
-// Common/StringToInt.h
-
-#ifndef __COMMON_STRINGTOINT_H
-#define __COMMON_STRINGTOINT_H
-
-#include <string.h>
-#include "Types.h"
-
-UInt64 ConvertStringToUInt64(const char *s, const char **end);
-UInt64 ConvertOctStringToUInt64(const char *s, const char **end);
-UInt64 ConvertHexStringToUInt64(const char *s, const char **end);
-UInt64 ConvertStringToUInt64(const wchar_t *s, const wchar_t **end);
-
-Int64 ConvertStringToInt64(const char *s, const char **end);
-
-#endif
-
-
diff --git a/third_party/lzma/v4_65/files/CPP/Common/Types.h b/third_party/lzma/v4_65/files/CPP/Common/Types.h
deleted file mode 100644
index 4bb8541..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/Types.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// Common/Types.h
-
-#ifndef __COMMON_TYPES_H
-#define __COMMON_TYPES_H
-
-extern "C"
-{
-#include "../../C/Types.h"
-}
-
-typedef int HRes;
-
-#endif
-
diff --git a/third_party/lzma/v4_65/files/CPP/Common/UTFConvert.cpp b/third_party/lzma/v4_65/files/CPP/Common/UTFConvert.cpp
deleted file mode 100644
index 9d1fd00..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/UTFConvert.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-// UTFConvert.cpp
-
-#include "StdAfx.h"
-
-#include "UTFConvert.h"
-#include "Types.h"
-
-static const Byte kUtf8Limits[5] = { 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
-
-static Bool Utf8_To_Utf16(wchar_t *dest, size_t *destLen, const char *src, size_t srcLen)
-{
-  size_t destPos = 0, srcPos = 0;
-  for (;;)
-  {
-    Byte c;
-    int numAdds;
-    if (srcPos == srcLen)
-    {
-      *destLen = destPos;
-      return True;
-    }
-    c = (Byte)src[srcPos++];
-
-    if (c < 0x80)
-    {
-      if (dest)
-        dest[destPos] = (wchar_t)c;
-      destPos++;
-      continue;
-    }
-    if (c < 0xC0)
-      break;
-    for (numAdds = 1; numAdds < 5; numAdds++)
-      if (c < kUtf8Limits[numAdds])
-        break;
-    UInt32 value = (c - kUtf8Limits[numAdds - 1]);
-
-    do
-    {
-      Byte c2;
-      if (srcPos == srcLen)
-        break;
-      c2 = (Byte)src[srcPos++];
-      if (c2 < 0x80 || c2 >= 0xC0)
-        break;
-      value <<= 6;
-      value |= (c2 - 0x80);
-    }
-    while (--numAdds != 0);
-    
-    if (value < 0x10000)
-    {
-      if (dest)
-        dest[destPos] = (wchar_t)value;
-      destPos++;
-    }
-    else
-    {
-      value -= 0x10000;
-      if (value >= 0x100000)
-        break;
-      if (dest)
-      {
-        dest[destPos + 0] = (wchar_t)(0xD800 + (value >> 10));
-        dest[destPos + 1] = (wchar_t)(0xDC00 + (value & 0x3FF));
-      }
-      destPos += 2;
-    }
-  }
-  *destLen = destPos;
-  return False;
-}
-
-static Bool Utf16_To_Utf8(char *dest, size_t *destLen, const wchar_t *src, size_t srcLen)
-{
-  size_t destPos = 0, srcPos = 0;
-  for (;;)
-  {
-    unsigned numAdds;
-    UInt32 value;
-    if (srcPos == srcLen)
-    {
-      *destLen = destPos;
-      return True;
-    }
-    value = src[srcPos++];
-    if (value < 0x80)
-    {
-      if (dest)
-        dest[destPos] = (char)value;
-      destPos++;
-      continue;
-    }
-    if (value >= 0xD800 && value < 0xE000)
-    {
-      UInt32 c2;
-      if (value >= 0xDC00 || srcPos == srcLen)
-        break;
-      c2 = src[srcPos++];
-      if (c2 < 0xDC00 || c2 >= 0xE000)
-        break;
-      value = ((value - 0xD800) << 10) | (c2 - 0xDC00);
-    }
-    for (numAdds = 1; numAdds < 5; numAdds++)
-      if (value < (((UInt32)1) << (numAdds * 5 + 6)))
-        break;
-    if (dest)
-      dest[destPos] = (char)(kUtf8Limits[numAdds - 1] + (value >> (6 * numAdds)));
-    destPos++;
-    do
-    {
-      numAdds--;
-      if (dest)
-        dest[destPos] = (char)(0x80 + ((value >> (6 * numAdds)) & 0x3F));
-      destPos++;
-    }
-    while (numAdds != 0);
-  }
-  *destLen = destPos;
-  return False;
-}
-
-bool ConvertUTF8ToUnicode(const AString &src, UString &dest)
-{
-  dest.Empty();
-  size_t destLen = 0;
-  Utf8_To_Utf16(NULL, &destLen, src, src.Length());
-  wchar_t *p = dest.GetBuffer((int)destLen);
-  Bool res = Utf8_To_Utf16(p, &destLen, src, src.Length());
-  p[destLen] = 0;
-  dest.ReleaseBuffer();
-  return res ? true : false;
-}
-
-bool ConvertUnicodeToUTF8(const UString &src, AString &dest)
-{
-  dest.Empty();
-  size_t destLen = 0;
-  Utf16_To_Utf8(NULL, &destLen, src, src.Length());
-  char *p = dest.GetBuffer((int)destLen);
-  Bool res = Utf16_To_Utf8(p, &destLen, src, src.Length());
-  p[destLen] = 0;
-  dest.ReleaseBuffer();
-  return res ? true : false;
-}
diff --git a/third_party/lzma/v4_65/files/CPP/Common/UTFConvert.h b/third_party/lzma/v4_65/files/CPP/Common/UTFConvert.h
deleted file mode 100644
index 2a14600..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/UTFConvert.h
+++ /dev/null
@@ -1,11 +0,0 @@
-// Common/UTFConvert.h
-
-#ifndef __COMMON_UTFCONVERT_H
-#define __COMMON_UTFCONVERT_H
-
-#include "MyString.h"
-
-bool ConvertUTF8ToUnicode(const AString &utfString, UString &resultString);
-bool ConvertUnicodeToUTF8(const UString &unicodeString, AString &resultString);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Common/Wildcard.cpp b/third_party/lzma/v4_65/files/CPP/Common/Wildcard.cpp
deleted file mode 100644
index 141c5dd..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/Wildcard.cpp
+++ /dev/null
@@ -1,458 +0,0 @@
-// Common/Wildcard.cpp
-
-#include "StdAfx.h"
-
-#include "Wildcard.h"
-
-bool g_CaseSensitive =
-  #ifdef _WIN32
-    false;
-  #else
-    true;
-  #endif
-
-static const wchar_t kAnyCharsChar = L'*';
-static const wchar_t kAnyCharChar = L'?';
-
-#ifdef _WIN32
-static const wchar_t kDirDelimiter1 = L'\\';
-#endif
-static const wchar_t kDirDelimiter2 = L'/';
-
-static const UString kWildCardCharSet = L"?*";
-
-static const UString kIllegalWildCardFileNameChars=
-  L"\x1\x2\x3\x4\x5\x6\x7\x8\x9\xA\xB\xC\xD\xE\xF"
-  L"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"
-  L"\"/:<>\\|";
-
-
-static inline bool IsCharDirLimiter(wchar_t c)
-{
-  return (
-    #ifdef _WIN32
-    c == kDirDelimiter1 ||
-    #endif
-    c == kDirDelimiter2);
-}
-
-int CompareFileNames(const UString &s1, const UString &s2)
-{
-  if (g_CaseSensitive)
-    return s1.Compare(s2);
-  return s1.CompareNoCase(s2);
-}
-
-// -----------------------------------------
-// this function compares name with mask
-// ? - any char
-// * - any char or empty
-
-static bool EnhancedMaskTest(const wchar_t *mask, const wchar_t *name)
-{
-  for (;;)
-  {
-    wchar_t m = *mask;
-    wchar_t c = *name;
-    if (m == 0)
-      return (c == 0);
-    if (m == kAnyCharsChar)
-    {
-      if (EnhancedMaskTest(mask + 1, name))
-        return true;
-      if (c == 0)
-        return false;
-    }
-    else
-    {
-      if (m == kAnyCharChar)
-      {
-        if (c == 0)
-          return false;
-      }
-      else if (m != c)
-        if (g_CaseSensitive || MyCharUpper(m) != MyCharUpper(c))
-          return false;
-      mask++;
-    }
-    name++;
-  }
-}
-
-// --------------------------------------------------
-// Splits path to strings
-
-void SplitPathToParts(const UString &path, UStringVector &pathParts)
-{
-  pathParts.Clear();
-  UString name;
-  int len = path.Length();
-  if (len == 0)
-    return;
-  for (int i = 0; i < len; i++)
-  {
-    wchar_t c = path[i];
-    if (IsCharDirLimiter(c))
-    {
-      pathParts.Add(name);
-      name.Empty();
-    }
-    else
-      name += c;
-  }
-  pathParts.Add(name);
-}
-
-void SplitPathToParts(const UString &path, UString &dirPrefix, UString &name)
-{
-  int i;
-  for (i = path.Length() - 1; i >= 0; i--)
-    if (IsCharDirLimiter(path[i]))
-      break;
-  dirPrefix = path.Left(i + 1);
-  name = path.Mid(i + 1);
-}
-
-UString ExtractDirPrefixFromPath(const UString &path)
-{
-  int i;
-  for (i = path.Length() - 1; i >= 0; i--)
-    if (IsCharDirLimiter(path[i]))
-      break;
-  return path.Left(i + 1);
-}
-
-UString ExtractFileNameFromPath(const UString &path)
-{
-  int i;
-  for (i = path.Length() - 1; i >= 0; i--)
-    if (IsCharDirLimiter(path[i]))
-      break;
-  return path.Mid(i + 1);
-}
-
-
-bool CompareWildCardWithName(const UString &mask, const UString &name)
-{
-  return EnhancedMaskTest(mask, name);
-}
-
-bool DoesNameContainWildCard(const UString &path)
-{
-  return (path.FindOneOf(kWildCardCharSet) >= 0);
-}
-
-
-// ----------------------------------------------------------'
-// NWildcard
-
-namespace NWildcard {
-
-
-/*
-M = MaskParts.Size();
-N = TestNameParts.Size();
-
-                           File                          Dir
-ForFile     req   M<=N  [N-M, N)                          -
-         nonreq   M=N   [0, M)                            -
- 
-ForDir      req   M<N   [0, M) ... [N-M-1, N-1)  same as ForBoth-File
-         nonreq         [0, M)                   same as ForBoth-File
-
-ForBoth     req   m<=N  [0, M) ... [N-M, N)      same as ForBoth-File
-         nonreq         [0, M)                   same as ForBoth-File
-
-*/
-
-bool CItem::CheckPath(const UStringVector &pathParts, bool isFile) const
-{
-  if (!isFile && !ForDir)
-    return false;
-  int delta = (int)pathParts.Size() - (int)PathParts.Size();
-  if (delta < 0)
-    return false;
-  int start = 0;
-  int finish = 0;
-  if (isFile)
-  {
-    if (!ForDir && !Recursive && delta !=0)
-      return false;
-    if (!ForFile && delta == 0)
-      return false;
-    if (!ForDir && Recursive)
-      start = delta;
-  }
-  if (Recursive)
-  {
-    finish = delta;
-    if (isFile && !ForFile)
-      finish = delta - 1;
-  }
-  for (int d = start; d <= finish; d++)
-  {
-    int i;
-    for (i = 0; i < PathParts.Size(); i++)
-      if (!CompareWildCardWithName(PathParts[i], pathParts[i + d]))
-        break;
-    if (i == PathParts.Size())
-      return true;
-  }
-  return false;
-}
-
-int CCensorNode::FindSubNode(const UString &name) const
-{
-  for (int i = 0; i < SubNodes.Size(); i++)
-    if (CompareFileNames(SubNodes[i].Name, name) == 0)
-      return i;
-  return -1;
-}
-
-void CCensorNode::AddItemSimple(bool include, CItem &item)
-{
-  if (include)
-    IncludeItems.Add(item);
-  else
-    ExcludeItems.Add(item);
-}
-
-void CCensorNode::AddItem(bool include, CItem &item)
-{
-  if (item.PathParts.Size() <= 1)
-  {
-    AddItemSimple(include, item);
-    return;
-  }
-  const UString &front = item.PathParts.Front();
-  if (DoesNameContainWildCard(front))
-  {
-    AddItemSimple(include, item);
-    return;
-  }
-  int index = FindSubNode(front);
-  if (index < 0)
-    index = SubNodes.Add(CCensorNode(front, this));
-  item.PathParts.Delete(0);
-  SubNodes[index].AddItem(include, item);
-}
-
-void CCensorNode::AddItem(bool include, const UString &path, bool recursive, bool forFile, bool forDir)
-{
-  CItem item;
-  SplitPathToParts(path, item.PathParts);
-  item.Recursive = recursive;
-  item.ForFile = forFile;
-  item.ForDir = forDir;
-  AddItem(include, item);
-}
-
-bool CCensorNode::NeedCheckSubDirs() const
-{
-  for (int i = 0; i < IncludeItems.Size(); i++)
-  {
-    const CItem &item = IncludeItems[i];
-    if (item.Recursive || item.PathParts.Size() > 1)
-      return true;
-  }
-  return false;
-}
-
-bool CCensorNode::AreThereIncludeItems() const
-{
-  if (IncludeItems.Size() > 0)
-    return true;
-  for (int i = 0; i < SubNodes.Size(); i++)
-    if (SubNodes[i].AreThereIncludeItems())
-      return true;
-  return false;
-}
-
-bool CCensorNode::CheckPathCurrent(bool include, const UStringVector &pathParts, bool isFile) const
-{
-  const CObjectVector<CItem> &items = include ? IncludeItems : ExcludeItems;
-  for (int i = 0; i < items.Size(); i++)
-    if (items[i].CheckPath(pathParts, isFile))
-      return true;
-  return false;
-}
-
-bool CCensorNode::CheckPath(UStringVector &pathParts, bool isFile, bool &include) const
-{
-  if (CheckPathCurrent(false, pathParts, isFile))
-  {
-    include = false;
-    return true;
-  }
-  include = true;
-  bool finded = CheckPathCurrent(true, pathParts, isFile);
-  if (pathParts.Size() == 1)
-    return finded;
-  int index = FindSubNode(pathParts.Front());
-  if (index >= 0)
-  {
-    UStringVector pathParts2 = pathParts;
-    pathParts2.Delete(0);
-    if (SubNodes[index].CheckPath(pathParts2, isFile, include))
-      return true;
-  }
-  return finded;
-}
-
-bool CCensorNode::CheckPath(const UString &path, bool isFile, bool &include) const
-{
-  UStringVector pathParts;
-  SplitPathToParts(path, pathParts);
-  return CheckPath(pathParts, isFile, include);
-}
-
-bool CCensorNode::CheckPath(const UString &path, bool isFile) const
-{
-  bool include;
-  if (CheckPath(path, isFile, include))
-    return include;
-  return false;
-}
-
-bool CCensorNode::CheckPathToRoot(bool include, UStringVector &pathParts, bool isFile) const
-{
-  if (CheckPathCurrent(include, pathParts, isFile))
-    return true;
-  if (Parent == 0)
-    return false;
-  pathParts.Insert(0, Name);
-  return Parent->CheckPathToRoot(include, pathParts, isFile);
-}
-
-/*
-bool CCensorNode::CheckPathToRoot(bool include, const UString &path, bool isFile) const
-{
-  UStringVector pathParts;
-  SplitPathToParts(path, pathParts);
-  return CheckPathToRoot(include, pathParts, isFile);
-}
-*/
-
-void CCensorNode::AddItem2(bool include, const UString &path, bool recursive)
-{
-  if (path.IsEmpty())
-    return;
-  bool forFile = true;
-  bool forFolder = true;
-  UString path2 = path;
-  if (IsCharDirLimiter(path[path.Length() - 1]))
-  {
-    path2.Delete(path.Length() - 1);
-    forFile = false;
-  }
-  AddItem(include, path2, recursive, forFile, forFolder);
-}
-
-void CCensorNode::ExtendExclude(const CCensorNode &fromNodes)
-{
-  ExcludeItems += fromNodes.ExcludeItems;
-  for (int i = 0; i < fromNodes.SubNodes.Size(); i++)
-  {
-    const CCensorNode &node = fromNodes.SubNodes[i];
-    int subNodeIndex = FindSubNode(node.Name);
-    if (subNodeIndex < 0)
-      subNodeIndex = SubNodes.Add(CCensorNode(node.Name, this));
-    SubNodes[subNodeIndex].ExtendExclude(node);
-  }
-}
-
-int CCensor::FindPrefix(const UString &prefix) const
-{
-  for (int i = 0; i < Pairs.Size(); i++)
-    if (CompareFileNames(Pairs[i].Prefix, prefix) == 0)
-      return i;
-  return -1;
-}
-
-void CCensor::AddItem(bool include, const UString &path, bool recursive)
-{
-  UStringVector pathParts;
-  SplitPathToParts(path, pathParts);
-  bool forFile = true;
-  if (pathParts.Back().IsEmpty())
-  {
-    forFile = false;
-    pathParts.DeleteBack();
-  }
-  const UString &front = pathParts.Front();
-  bool isAbs = false;
-  if (front.IsEmpty())
-    isAbs = true;
-  else if (front.Length() == 2 && front[1] == L':')
-    isAbs = true;
-  else
-  {
-    for (int i = 0; i < pathParts.Size(); i++)
-    {
-      const UString &part = pathParts[i];
-      if (part == L".." || part == L".")
-      {
-        isAbs = true;
-        break;
-      }
-    }
-  }
-  int numAbsParts = 0;
-  if (isAbs)
-    if (pathParts.Size() > 1)
-      numAbsParts = pathParts.Size() - 1;
-    else
-      numAbsParts = 1;
-  UString prefix;
-  for (int i = 0; i < numAbsParts; i++)
-  {
-    const UString &front = pathParts.Front();
-    if (DoesNameContainWildCard(front))
-      break;
-    prefix += front;
-    prefix += WCHAR_PATH_SEPARATOR;
-    pathParts.Delete(0);
-  }
-  int index = FindPrefix(prefix);
-  if (index < 0)
-    index = Pairs.Add(CPair(prefix));
-
-  CItem item;
-  item.PathParts = pathParts;
-  item.ForDir = true;
-  item.ForFile = forFile;
-  item.Recursive = recursive;
-  Pairs[index].Head.AddItem(include, item);
-}
-
-bool CCensor::CheckPath(const UString &path, bool isFile) const
-{
-  bool finded = false;
-  for (int i = 0; i < Pairs.Size(); i++)
-  {
-    bool include;
-    if (Pairs[i].Head.CheckPath(path, isFile, include))
-    {
-      if (!include)
-        return false;
-      finded = true;
-    }
-  }
-  return finded;
-}
-
-void CCensor::ExtendExclude()
-{
-  int i;
-  for (i = 0; i < Pairs.Size(); i++)
-    if (Pairs[i].Prefix.IsEmpty())
-      break;
-  if (i == Pairs.Size())
-    return;
-  int index = i;
-  for (i = 0; i < Pairs.Size(); i++)
-    if (index != i)
-      Pairs[i].Head.ExtendExclude(Pairs[index].Head);
-}
-
-}
diff --git a/third_party/lzma/v4_65/files/CPP/Common/Wildcard.h b/third_party/lzma/v4_65/files/CPP/Common/Wildcard.h
deleted file mode 100644
index 6d4cbce..0000000
--- a/third_party/lzma/v4_65/files/CPP/Common/Wildcard.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// Common/Wildcard.h
-
-#ifndef __COMMON_WILDCARD_H
-#define __COMMON_WILDCARD_H
-
-#include "MyString.h"
-
-int CompareFileNames(const UString &s1, const UString &s2);
-
-void SplitPathToParts(const UString &path, UStringVector &pathParts);
-void SplitPathToParts(const UString &path, UString &dirPrefix, UString &name);
-UString ExtractDirPrefixFromPath(const UString &path);
-UString ExtractFileNameFromPath(const UString &path);
-bool DoesNameContainWildCard(const UString &path);
-bool CompareWildCardWithName(const UString &mask, const UString &name);
-
-namespace NWildcard {
-
-struct CItem
-{
-  UStringVector PathParts;
-  bool Recursive;
-  bool ForFile;
-  bool ForDir;
-  bool CheckPath(const UStringVector &pathParts, bool isFile) const;
-};
-
-class CCensorNode
-{
-  CCensorNode *Parent;
-  bool CheckPathCurrent(bool include, const UStringVector &pathParts, bool isFile) const;
-  void AddItemSimple(bool include, CItem &item);
-  bool CheckPath(UStringVector &pathParts, bool isFile, bool &include) const;
-public:
-  CCensorNode(): Parent(0) { };
-  CCensorNode(const UString &name, CCensorNode *parent): Name(name), Parent(parent) { };
-  UString Name;
-  CObjectVector<CCensorNode> SubNodes;
-  CObjectVector<CItem> IncludeItems;
-  CObjectVector<CItem> ExcludeItems;
-
-  int FindSubNode(const UString &path) const;
-
-  void AddItem(bool include, CItem &item);
-  void AddItem(bool include, const UString &path, bool recursive, bool forFile, bool forDir);
-  void AddItem2(bool include, const UString &path, bool recursive);
-
-  bool NeedCheckSubDirs() const;
-  bool AreThereIncludeItems() const;
-
-  bool CheckPath(const UString &path, bool isFile, bool &include) const;
-  bool CheckPath(const UString &path, bool isFile) const;
-
-  bool CheckPathToRoot(bool include, UStringVector &pathParts, bool isFile) const;
-  // bool CheckPathToRoot(const UString &path, bool isFile, bool include) const;
-  void ExtendExclude(const CCensorNode &fromNodes);
-};
-
-struct CPair
-{
-  UString Prefix;
-  CCensorNode Head;
-  CPair(const UString &prefix): Prefix(prefix) { };
-};
-
-class CCensor
-{
-  int FindPrefix(const UString &prefix) const;
-public:
-  CObjectVector<CPair> Pairs;
-  bool AllAreRelative() const
-    { return (Pairs.Size() == 1 && Pairs.Front().Prefix.IsEmpty()); }
-  void AddItem(bool include, const UString &path, bool recursive);
-  bool CheckPath(const UString &path, bool isFile) const;
-  void ExtendExclude();
-};
-
-}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/DLL.cpp b/third_party/lzma/v4_65/files/CPP/Windows/DLL.cpp
deleted file mode 100644
index 8a95a25..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/DLL.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-// Windows/DLL.cpp
-
-#include "StdAfx.h"
-
-#include "DLL.h"
-#include "Defs.h"
-#ifndef _UNICODE
-#include "../Common/StringConvert.h"
-#endif
-
-#ifndef _UNICODE
-extern bool g_IsNT;
-#endif
-
-namespace NWindows {
-namespace NDLL {
-
-CLibrary::~CLibrary()
-{
-  Free();
-}
-
-bool CLibrary::Free()
-{
-  if (_module == 0)
-    return true;
-  // MessageBox(0, TEXT(""), TEXT("Free"), 0);
-  // Sleep(5000);
-  if (!::FreeLibrary(_module))
-    return false;
-  _module = 0;
-  return true;
-}
-
-bool CLibrary::LoadOperations(HMODULE newModule)
-{
-  if (newModule == NULL)
-    return false;
-  if (!Free())
-    return false;
-  _module = newModule;
-  return true;
-}
-
-bool CLibrary::LoadEx(LPCTSTR fileName, DWORD flags)
-{
-  // MessageBox(0, fileName, TEXT("LoadEx"), 0);
-  return LoadOperations(::LoadLibraryEx(fileName, NULL, flags));
-}
-
-bool CLibrary::Load(LPCTSTR fileName)
-{
-  // MessageBox(0, fileName, TEXT("Load"), 0);
-  // Sleep(5000);
-  // OutputDebugString(fileName);
-  // OutputDebugString(TEXT("\n"));
-  return LoadOperations(::LoadLibrary(fileName));
-}
-
-#ifndef _UNICODE
-static inline UINT GetCurrentCodePage() { return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
-CSysString GetSysPath(LPCWSTR sysPath)
-  { return UnicodeStringToMultiByte(sysPath, GetCurrentCodePage()); }
-
-bool CLibrary::LoadEx(LPCWSTR fileName, DWORD flags)
-{
-  if (g_IsNT)
-    return LoadOperations(::LoadLibraryExW(fileName, NULL, flags));
-  return LoadEx(GetSysPath(fileName), flags);
-}
-bool CLibrary::Load(LPCWSTR fileName)
-{
-  if (g_IsNT)
-    return LoadOperations(::LoadLibraryW(fileName));
-  return Load(GetSysPath(fileName));
-}
-#endif
-
-bool MyGetModuleFileName(HMODULE hModule, CSysString &result)
-{
-  result.Empty();
-  TCHAR fullPath[MAX_PATH + 2];
-  DWORD size = ::GetModuleFileName(hModule, fullPath, MAX_PATH + 1);
-  if (size <= MAX_PATH && size != 0)
-  {
-    result = fullPath;
-    return true;
-  }
-  return false;
-}
-
-#ifndef _UNICODE
-bool MyGetModuleFileName(HMODULE hModule, UString &result)
-{
-  result.Empty();
-  if (g_IsNT)
-  {
-    wchar_t fullPath[MAX_PATH + 2];
-    DWORD size = ::GetModuleFileNameW(hModule, fullPath, MAX_PATH + 1);
-    if (size <= MAX_PATH && size != 0)
-    {
-      result = fullPath;
-      return true;
-    }
-    return false;
-  }
-  CSysString resultSys;
-  if (!MyGetModuleFileName(hModule, resultSys))
-    return false;
-  result = MultiByteToUnicodeString(resultSys, GetCurrentCodePage());
-  return true;
-}
-#endif
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/DLL.h b/third_party/lzma/v4_65/files/CPP/Windows/DLL.h
deleted file mode 100644
index 4c2ffa2..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/DLL.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Windows/DLL.h
-
-#ifndef __WINDOWS_DLL_H
-#define __WINDOWS_DLL_H
-
-#include "../Common/MyString.h"
-
-namespace NWindows {
-namespace NDLL {
-
-class CLibrary
-{
-  bool LoadOperations(HMODULE newModule);
-protected:
-  HMODULE _module;
-public:
-  operator HMODULE() const { return _module; }
-  HMODULE* operator&() { return &_module; }
-
-  CLibrary():_module(NULL) {};
-  ~CLibrary();
-  void Attach(HMODULE m)
-  {
-    Free();
-    _module = m;
-  }
-  HMODULE Detach()
-  {
-    HMODULE m = _module;
-    _module = NULL;
-    return m;
-  }
-
-  // operator HMODULE() const { return _module; };
-  bool IsLoaded() const { return (_module != NULL); };
-  bool Free();
-  bool LoadEx(LPCTSTR fileName, DWORD flags = LOAD_LIBRARY_AS_DATAFILE);
-  bool Load(LPCTSTR fileName);
-  #ifndef _UNICODE
-  bool LoadEx(LPCWSTR fileName, DWORD flags = LOAD_LIBRARY_AS_DATAFILE);
-  bool Load(LPCWSTR fileName);
-  #endif
-  FARPROC GetProcAddress(LPCSTR procName) const
-    { return ::GetProcAddress(_module, procName); }
-};
-
-bool MyGetModuleFileName(HMODULE hModule, CSysString &result);
-#ifndef _UNICODE
-bool MyGetModuleFileName(HMODULE hModule, UString &result);
-#endif
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/Defs.h b/third_party/lzma/v4_65/files/CPP/Windows/Defs.h
deleted file mode 100644
index 898be8d..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/Defs.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// Windows/Defs.h
-
-#ifndef __WINDOWS_DEFS_H
-#define __WINDOWS_DEFS_H
-
-inline bool BOOLToBool(BOOL value)
-  { return (value != FALSE); }
-
-#ifdef _WIN32
-inline bool LRESULTToBool(LRESULT value)
-  { return (value != FALSE); }
-#endif
-
-inline BOOL BoolToBOOL(bool value)
-  { return (value ? TRUE: FALSE); }
-
-inline VARIANT_BOOL BoolToVARIANT_BOOL(bool value)
-  { return (value ? VARIANT_TRUE: VARIANT_FALSE); }
-
-inline bool VARIANT_BOOLToBool(VARIANT_BOOL value)
-  { return (value != VARIANT_FALSE); }
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/Error.cpp b/third_party/lzma/v4_65/files/CPP/Windows/Error.cpp
deleted file mode 100644
index 7b18c29..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/Error.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// Windows/Error.h
-
-#include "StdAfx.h"
-
-#include "Windows/Error.h"
-#ifndef _UNICODE
-#include "Common/StringConvert.h"
-#endif
-
-#ifndef _UNICODE
-extern bool g_IsNT;
-#endif
-
-namespace NWindows {
-namespace NError {
-
-bool MyFormatMessage(DWORD messageID, CSysString &message)
-{
-  LPVOID msgBuf;
-  if (::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
-      FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
-      NULL,messageID, 0, (LPTSTR) &msgBuf,0, NULL) == 0)
-    return false;
-  message = (LPCTSTR)msgBuf;
-  ::LocalFree(msgBuf);
-  return true;
-}
-
-#ifndef _UNICODE
-bool MyFormatMessage(DWORD messageID, UString &message)
-{
-  if (g_IsNT)
-  {
-    LPVOID msgBuf;
-    if (::FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
-        FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
-        NULL, messageID, 0, (LPWSTR) &msgBuf, 0, NULL) == 0)
-      return false;
-    message = (LPCWSTR)msgBuf;
-    ::LocalFree(msgBuf);
-    return true;
-  }
-  CSysString messageSys;
-  bool result = MyFormatMessage(messageID, messageSys);
-  message = GetUnicodeString(messageSys);
-  return result;
-}
-#endif
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/Error.h b/third_party/lzma/v4_65/files/CPP/Windows/Error.h
deleted file mode 100644
index 05b5cd0..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/Error.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Windows/Error.h
-
-#ifndef __WINDOWS_ERROR_H
-#define __WINDOWS_ERROR_H
-
-#include "Common/MyString.h"
-
-namespace NWindows {
-namespace NError {
-
-bool MyFormatMessage(DWORD messageID, CSysString &message);
-inline CSysString MyFormatMessage(DWORD messageID)
-{
-  CSysString message;
-  MyFormatMessage(messageID, message);
-  return message;
-}
-#ifdef _UNICODE
-inline UString MyFormatMessageW(DWORD messageID)
-  { return MyFormatMessage(messageID); }
-#else
-bool MyFormatMessage(DWORD messageID, UString &message);
-inline UString MyFormatMessageW(DWORD messageID)
-{
-  UString message;
-  MyFormatMessage(messageID, message);
-  return message;
-}
-#endif
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/FileDir.cpp b/third_party/lzma/v4_65/files/CPP/Windows/FileDir.cpp
deleted file mode 100644
index 4224d6f..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/FileDir.cpp
+++ /dev/null
@@ -1,841 +0,0 @@
-// Windows/FileDir.cpp
-
-#include "StdAfx.h"
-
-#include "FileDir.h"
-#include "FileName.h"
-#include "FileFind.h"
-#include "Defs.h"
-#ifndef _UNICODE
-#include "../Common/StringConvert.h"
-#endif
-
-#ifndef _UNICODE
-extern bool g_IsNT;
-#endif
-
-namespace NWindows {
-namespace NFile {
-
-#if defined(WIN_LONG_PATH) && defined(_UNICODE)
-#define WIN_LONG_PATH2
-#endif
-
-// SetCurrentDirectory doesn't support \\?\ prefix
-
-#ifdef WIN_LONG_PATH
-bool GetLongPathBase(LPCWSTR fileName, UString &res);
-bool GetLongPath(LPCWSTR fileName, UString &res);
-#endif
-
-namespace NDirectory {
-
-#ifndef _UNICODE
-static inline UINT GetCurrentCodePage() { return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
-static UString GetUnicodePath(const CSysString &sysPath)
-  { return MultiByteToUnicodeString(sysPath, GetCurrentCodePage()); }
-static CSysString GetSysPath(LPCWSTR sysPath)
-  { return UnicodeStringToMultiByte(sysPath, GetCurrentCodePage()); }
-#endif
-
-bool MyGetWindowsDirectory(CSysString &path)
-{
-  UINT needLength = ::GetWindowsDirectory(path.GetBuffer(MAX_PATH + 1), MAX_PATH + 1);
-  path.ReleaseBuffer();
-  return (needLength > 0 && needLength <= MAX_PATH);
-}
-
-bool MyGetSystemDirectory(CSysString &path)
-{
-  UINT needLength = ::GetSystemDirectory(path.GetBuffer(MAX_PATH + 1), MAX_PATH + 1);
-  path.ReleaseBuffer();
-  return (needLength > 0 && needLength <= MAX_PATH);
-}
-
-#ifndef _UNICODE
-bool MyGetWindowsDirectory(UString &path)
-{
-  if (g_IsNT)
-  {
-    UINT needLength = ::GetWindowsDirectoryW(path.GetBuffer(MAX_PATH + 1), MAX_PATH + 1);
-    path.ReleaseBuffer();
-    return (needLength > 0 && needLength <= MAX_PATH);
-  }
-  CSysString sysPath;
-  if (!MyGetWindowsDirectory(sysPath))
-    return false;
-  path = GetUnicodePath(sysPath);
-  return true;
-}
-
-bool MyGetSystemDirectory(UString &path)
-{
-  if (g_IsNT)
-  {
-    UINT needLength = ::GetSystemDirectoryW(path.GetBuffer(MAX_PATH + 1), MAX_PATH + 1);
-    path.ReleaseBuffer();
-    return (needLength > 0 && needLength <= MAX_PATH);
-  }
-  CSysString sysPath;
-  if (!MyGetSystemDirectory(sysPath))
-    return false;
-  path = GetUnicodePath(sysPath);
-  return true;
-}
-#endif
-
-bool SetDirTime(LPCWSTR fileName, const FILETIME *cTime, const FILETIME *aTime, const FILETIME *mTime)
-{
-  #ifndef _UNICODE
-  if (!g_IsNT)
-  {
-    ::SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return false;
-  }
-  #endif
-  HANDLE hDir = ::CreateFileW(fileName, GENERIC_WRITE,
-      FILE_SHARE_READ | FILE_SHARE_WRITE,
-      NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
-  #ifdef WIN_LONG_PATH
-  if (hDir == INVALID_HANDLE_VALUE)
-  {
-    UString longPath;
-    if (GetLongPath(fileName, longPath))
-      hDir = ::CreateFileW(longPath, GENERIC_WRITE,
-        FILE_SHARE_READ | FILE_SHARE_WRITE,
-        NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
-  }
-  #endif
-
-  bool res = false;
-  if (hDir != INVALID_HANDLE_VALUE)
-  {
-    res = BOOLToBool(::SetFileTime(hDir, cTime, aTime, mTime));
-    ::CloseHandle(hDir);
-  }
-  return res;
-}
-
-bool MySetFileAttributes(LPCTSTR fileName, DWORD fileAttributes)
-{
-  if (::SetFileAttributes(fileName, fileAttributes))
-    return true;
-  #ifdef WIN_LONG_PATH2
-  UString longPath;
-  if (GetLongPath(fileName, longPath))
-    return BOOLToBool(::SetFileAttributesW(longPath, fileAttributes));
-  #endif
-  return false;
-}
-
-bool MyRemoveDirectory(LPCTSTR pathName)
-{
-  if (::RemoveDirectory(pathName))
-    return true;
-  #ifdef WIN_LONG_PATH2
-  UString longPath;
-  if (GetLongPath(pathName, longPath))
-    return BOOLToBool(::RemoveDirectoryW(longPath));
-  #endif
-  return false;
-}
-
-#ifdef WIN_LONG_PATH
-bool GetLongPaths(LPCWSTR s1, LPCWSTR s2, UString &d1, UString &d2)
-{
-  if (!GetLongPathBase(s1, d1) || !GetLongPathBase(s2, d2))
-    return false;
-  if (d1.IsEmpty() && d2.IsEmpty()) return false;
-  if (d1.IsEmpty()) d1 = s1;
-  if (d2.IsEmpty()) d2 = s2;
-  return true;
-}
-#endif
-
-bool MyMoveFile(LPCTSTR existFileName, LPCTSTR newFileName)
-{
-  if (::MoveFile(existFileName, newFileName))
-    return true;
-  #ifdef WIN_LONG_PATH2
-  UString d1, d2;
-  if (GetLongPaths(existFileName, newFileName, d1, d2))
-    return BOOLToBool(::MoveFileW(d1, d2));
-  #endif
-  return false;
-}
-
-#ifndef _UNICODE
-bool MySetFileAttributes(LPCWSTR fileName, DWORD fileAttributes)
-{
-  if (!g_IsNT)
-    return MySetFileAttributes(GetSysPath(fileName), fileAttributes);
-  if (::SetFileAttributesW(fileName, fileAttributes))
-    return true;
-  #ifdef WIN_LONG_PATH
-  UString longPath;
-  if (GetLongPath(fileName, longPath))
-    return BOOLToBool(::SetFileAttributesW(longPath, fileAttributes));
-  #endif
-  return false;
-}
-
-
-bool MyRemoveDirectory(LPCWSTR pathName)
-{
-  if (!g_IsNT)
-    return MyRemoveDirectory(GetSysPath(pathName));
-  if (::RemoveDirectoryW(pathName))
-    return true;
-  #ifdef WIN_LONG_PATH
-  UString longPath;
-  if (GetLongPath(pathName, longPath))
-    return BOOLToBool(::RemoveDirectoryW(longPath));
-  #endif
-  return false;
-}
-
-bool MyMoveFile(LPCWSTR existFileName, LPCWSTR newFileName)
-{
-  if (!g_IsNT)
-    return MyMoveFile(GetSysPath(existFileName), GetSysPath(newFileName));
-  if (::MoveFileW(existFileName, newFileName))
-    return true;
-  #ifdef WIN_LONG_PATH
-  UString d1, d2;
-  if (GetLongPaths(existFileName, newFileName, d1, d2))
-    return BOOLToBool(::MoveFileW(d1, d2));
-  #endif
-  return false;
-}
-#endif
-
-bool MyCreateDirectory(LPCTSTR pathName)
-{
-  if (::CreateDirectory(pathName, NULL))
-    return true;
-  #ifdef WIN_LONG_PATH2
-  if (::GetLastError() != ERROR_ALREADY_EXISTS)
-  {
-    UString longPath;
-    if (GetLongPath(pathName, longPath))
-      return BOOLToBool(::CreateDirectoryW(longPath, NULL));
-  }
-  #endif
-  return false;
-}
-
-#ifndef _UNICODE
-bool MyCreateDirectory(LPCWSTR pathName)
-{
-  if (!g_IsNT)
-    return MyCreateDirectory(GetSysPath(pathName));
-  if (::CreateDirectoryW(pathName, NULL))
-    return true;
-  #ifdef WIN_LONG_PATH
-  if (::GetLastError() != ERROR_ALREADY_EXISTS)
-  {
-    UString longPath;
-    if (GetLongPath(pathName, longPath))
-      return BOOLToBool(::CreateDirectoryW(longPath, NULL));
-  }
-  #endif
-  return false;
-}
-#endif
-
-/*
-bool CreateComplexDirectory(LPCTSTR pathName)
-{
-  NName::CParsedPath path;
-  path.ParsePath(pathName);
-  CSysString fullPath = path.Prefix;
-  DWORD errorCode = ERROR_SUCCESS;
-  for (int i = 0; i < path.PathParts.Size(); i++)
-  {
-    const CSysString &string = path.PathParts[i];
-    if (string.IsEmpty())
-    {
-      if (i != path.PathParts.Size() - 1)
-        return false;
-      return true;
-    }
-    fullPath += path.PathParts[i];
-    if (!MyCreateDirectory(fullPath))
-    {
-      DWORD errorCode = GetLastError();
-      if (errorCode != ERROR_ALREADY_EXISTS)
-        return false;
-    }
-    fullPath += NName::kDirDelimiter;
-  }
-  return true;
-}
-*/
-
-bool CreateComplexDirectory(LPCTSTR _aPathName)
-{
-  CSysString pathName = _aPathName;
-  int pos = pathName.ReverseFind(TEXT(CHAR_PATH_SEPARATOR));
-  if (pos > 0 && pos == pathName.Length() - 1)
-  {
-    if (pathName.Length() == 3 && pathName[1] == ':')
-      return true; // Disk folder;
-    pathName.Delete(pos);
-  }
-  CSysString pathName2 = pathName;
-  pos = pathName.Length();
-  for (;;)
-  {
-    if (MyCreateDirectory(pathName))
-      break;
-    if (::GetLastError() == ERROR_ALREADY_EXISTS)
-    {
-      NFind::CFileInfo fileInfo;
-      if (!NFind::FindFile(pathName, fileInfo)) // For network folders
-        return true;
-      if (!fileInfo.IsDir())
-        return false;
-      break;
-    }
-    pos = pathName.ReverseFind(TEXT(CHAR_PATH_SEPARATOR));
-    if (pos < 0 || pos == 0)
-      return false;
-    if (pathName[pos - 1] == ':')
-      return false;
-    pathName = pathName.Left(pos);
-  }
-  pathName = pathName2;
-  while (pos < pathName.Length())
-  {
-    pos = pathName.Find(TEXT(CHAR_PATH_SEPARATOR), pos + 1);
-    if (pos < 0)
-      pos = pathName.Length();
-    if (!MyCreateDirectory(pathName.Left(pos)))
-      return false;
-  }
-  return true;
-}
-
-#ifndef _UNICODE
-
-bool CreateComplexDirectory(LPCWSTR _aPathName)
-{
-  UString pathName = _aPathName;
-  int pos = pathName.ReverseFind(WCHAR_PATH_SEPARATOR);
-  if (pos > 0 && pos == pathName.Length() - 1)
-  {
-    if (pathName.Length() == 3 && pathName[1] == L':')
-      return true; // Disk folder;
-    pathName.Delete(pos);
-  }
-  UString pathName2 = pathName;
-  pos = pathName.Length();
-  for (;;)
-  {
-    if (MyCreateDirectory(pathName))
-      break;
-    if (::GetLastError() == ERROR_ALREADY_EXISTS)
-    {
-      NFind::CFileInfoW fileInfo;
-      if (!NFind::FindFile(pathName, fileInfo)) // For network folders
-        return true;
-      if (!fileInfo.IsDir())
-        return false;
-      break;
-    }
-    pos = pathName.ReverseFind(WCHAR_PATH_SEPARATOR);
-    if (pos < 0 || pos == 0)
-      return false;
-    if (pathName[pos - 1] == L':')
-      return false;
-    pathName = pathName.Left(pos);
-  }
-  pathName = pathName2;
-  while (pos < pathName.Length())
-  {
-    pos = pathName.Find(WCHAR_PATH_SEPARATOR, pos + 1);
-    if (pos < 0)
-      pos = pathName.Length();
-    if (!MyCreateDirectory(pathName.Left(pos)))
-      return false;
-  }
-  return true;
-}
-
-#endif
-
-bool DeleteFileAlways(LPCTSTR name)
-{
-  if (!MySetFileAttributes(name, 0))
-    return false;
-  if (::DeleteFile(name))
-    return true;
-  #ifdef WIN_LONG_PATH2
-  UString longPath;
-  if (GetLongPath(name, longPath))
-    return BOOLToBool(::DeleteFileW(longPath));
-  #endif
-  return false;
-}
-
-#ifndef _UNICODE
-bool DeleteFileAlways(LPCWSTR name)
-{
-  if (!g_IsNT)
-    return DeleteFileAlways(GetSysPath(name));
-  if (!MySetFileAttributes(name, 0))
-    return false;
-  if (::DeleteFileW(name))
-    return true;
-  #ifdef WIN_LONG_PATH
-  UString longPath;
-  if (GetLongPath(name, longPath))
-    return BOOLToBool(::DeleteFileW(longPath));
-  #endif
-  return false;
-}
-#endif
-
-static bool RemoveDirectorySubItems2(const CSysString pathPrefix, const NFind::CFileInfo &fileInfo)
-{
-  if (fileInfo.IsDir())
-    return RemoveDirectoryWithSubItems(pathPrefix + fileInfo.Name);
-  return DeleteFileAlways(pathPrefix + fileInfo.Name);
-}
-
-bool RemoveDirectoryWithSubItems(const CSysString &path)
-{
-  NFind::CFileInfo fileInfo;
-  CSysString pathPrefix = path + NName::kDirDelimiter;
-  {
-    NFind::CEnumerator enumerator(pathPrefix + TCHAR(NName::kAnyStringWildcard));
-    while (enumerator.Next(fileInfo))
-      if (!RemoveDirectorySubItems2(pathPrefix, fileInfo))
-        return false;
-  }
-  if (!MySetFileAttributes(path, 0))
-    return false;
-  return MyRemoveDirectory(path);
-}
-
-#ifndef _UNICODE
-static bool RemoveDirectorySubItems2(const UString pathPrefix, const NFind::CFileInfoW &fileInfo)
-{
-  if (fileInfo.IsDir())
-    return RemoveDirectoryWithSubItems(pathPrefix + fileInfo.Name);
-  return DeleteFileAlways(pathPrefix + fileInfo.Name);
-}
-bool RemoveDirectoryWithSubItems(const UString &path)
-{
-  NFind::CFileInfoW fileInfo;
-  UString pathPrefix = path + UString(NName::kDirDelimiter);
-  {
-    NFind::CEnumeratorW enumerator(pathPrefix + UString(NName::kAnyStringWildcard));
-    while (enumerator.Next(fileInfo))
-      if (!RemoveDirectorySubItems2(pathPrefix, fileInfo))
-        return false;
-  }
-  if (!MySetFileAttributes(path, 0))
-    return false;
-  return MyRemoveDirectory(path);
-}
-#endif
-
-#ifndef _WIN32_WCE
-
-bool MyGetShortPathName(LPCTSTR longPath, CSysString &shortPath)
-{
-  DWORD needLength = ::GetShortPathName(longPath, shortPath.GetBuffer(MAX_PATH + 1), MAX_PATH + 1);
-  shortPath.ReleaseBuffer();
-  return (needLength > 0 && needLength < MAX_PATH);
-}
-
-bool MyGetFullPathName(LPCTSTR fileName, CSysString &resultPath, int &fileNamePartStartIndex)
-{
-  resultPath.Empty();
-  LPTSTR fileNamePointer = 0;
-  LPTSTR buffer = resultPath.GetBuffer(MAX_PATH);
-  DWORD needLength = ::GetFullPathName(fileName, MAX_PATH + 1, buffer, &fileNamePointer);
-  resultPath.ReleaseBuffer();
-  if (needLength == 0)
-    return false;
-  if (needLength >= MAX_PATH)
-  {
-    #ifdef WIN_LONG_PATH2
-    needLength++;
-    buffer = resultPath.GetBuffer(needLength + 1);
-    DWORD needLength2 = ::GetFullPathNameW(fileName, needLength, buffer, &fileNamePointer);
-    resultPath.ReleaseBuffer();
-    if (needLength2 == 0 || needLength2 > needLength)
-    #endif
-      return false;
-  }
-  if (fileNamePointer == 0)
-    fileNamePartStartIndex = lstrlen(fileName);
-  else
-    fileNamePartStartIndex = (int)(fileNamePointer - buffer);
-  return true;
-}
-
-#ifndef _UNICODE
-bool MyGetFullPathName(LPCWSTR fileName, UString &resultPath, int &fileNamePartStartIndex)
-{
-  resultPath.Empty();
-  if (g_IsNT)
-  {
-    LPWSTR fileNamePointer = 0;
-    LPWSTR buffer = resultPath.GetBuffer(MAX_PATH);
-    DWORD needLength = ::GetFullPathNameW(fileName, MAX_PATH + 1, buffer, &fileNamePointer);
-    resultPath.ReleaseBuffer();
-    if (needLength == 0)
-      return false;
-    if (needLength >= MAX_PATH)
-    {
-      #ifdef WIN_LONG_PATH
-      needLength++;
-      buffer = resultPath.GetBuffer(needLength + 1);
-      DWORD needLength2 = ::GetFullPathNameW(fileName, needLength, buffer, &fileNamePointer);
-      resultPath.ReleaseBuffer();
-      if (needLength2 == 0 || needLength2 > needLength)
-      #endif
-        return false;
-    }
-    if (fileNamePointer == 0)
-      fileNamePartStartIndex = MyStringLen(fileName);
-    else
-      fileNamePartStartIndex = (int)(fileNamePointer - buffer);
-  }
-  else
-  {
-    CSysString sysPath;
-    if (!MyGetFullPathName(GetSysPath(fileName), sysPath, fileNamePartStartIndex))
-      return false;
-    UString resultPath1 = GetUnicodePath(sysPath.Left(fileNamePartStartIndex));
-    UString resultPath2 = GetUnicodePath(sysPath.Mid(fileNamePartStartIndex));
-    fileNamePartStartIndex = resultPath1.Length();
-    resultPath = resultPath1 + resultPath2;
-  }
-  return true;
-}
-#endif
-
-
-bool MyGetFullPathName(LPCTSTR fileName, CSysString &path)
-{
-  int index;
-  return MyGetFullPathName(fileName, path, index);
-}
-
-#ifndef _UNICODE
-bool MyGetFullPathName(LPCWSTR fileName, UString &path)
-{
-  int index;
-  return MyGetFullPathName(fileName, path, index);
-}
-#endif
-
-bool GetOnlyName(LPCTSTR fileName, CSysString &resultName)
-{
-  int index;
-  if (!MyGetFullPathName(fileName, resultName, index))
-    return false;
-  resultName = resultName.Mid(index);
-  return true;
-}
-
-#ifndef _UNICODE
-bool GetOnlyName(LPCWSTR fileName, UString &resultName)
-{
-  int index;
-  if (!MyGetFullPathName(fileName, resultName, index))
-    return false;
-  resultName = resultName.Mid(index);
-  return true;
-}
-#endif
-
-bool GetOnlyDirPrefix(LPCTSTR fileName, CSysString &resultName)
-{
-  int index;
-  if (!MyGetFullPathName(fileName, resultName, index))
-    return false;
-  resultName = resultName.Left(index);
-  return true;
-}
-
-#ifndef _UNICODE
-bool GetOnlyDirPrefix(LPCWSTR fileName, UString &resultName)
-{
-  int index;
-  if (!MyGetFullPathName(fileName, resultName, index))
-    return false;
-  resultName = resultName.Left(index);
-  return true;
-}
-#endif
-
-bool MyGetCurrentDirectory(CSysString &path)
-{
-  DWORD needLength = ::GetCurrentDirectory(MAX_PATH + 1, path.GetBuffer(MAX_PATH + 1));
-  path.ReleaseBuffer();
-  return (needLength > 0 && needLength <= MAX_PATH);
-}
-
-#ifndef _UNICODE
-bool MySetCurrentDirectory(LPCWSTR path)
-{
-  if (g_IsNT)
-    return BOOLToBool(::SetCurrentDirectoryW(path));
-  return MySetCurrentDirectory(GetSysPath(path));
-}
-bool MyGetCurrentDirectory(UString &path)
-{
-  if (g_IsNT)
-  {
-    DWORD needLength = ::GetCurrentDirectoryW(MAX_PATH + 1, path.GetBuffer(MAX_PATH + 1));
-    path.ReleaseBuffer();
-    return (needLength > 0 && needLength <= MAX_PATH);
-  }
-  CSysString sysPath;
-  if (!MyGetCurrentDirectory(sysPath))
-    return false;
-  path = GetUnicodePath(sysPath);
-  return true;
-}
-#endif
-#endif
-
-bool MySearchPath(LPCTSTR path, LPCTSTR fileName, LPCTSTR extension,
-  CSysString &resultPath, UINT32 &filePart)
-{
-  LPTSTR filePartPointer;
-  DWORD value = ::SearchPath(path, fileName, extension,
-    MAX_PATH, resultPath.GetBuffer(MAX_PATH + 1), &filePartPointer);
-  filePart = (UINT32)(filePartPointer - (LPCTSTR)resultPath);
-  resultPath.ReleaseBuffer();
-  return (value > 0 && value <= MAX_PATH);
-}
-
-#ifndef _UNICODE
-bool MySearchPath(LPCWSTR path, LPCWSTR fileName, LPCWSTR extension,
-  UString &resultPath, UINT32 &filePart)
-{
-  if (g_IsNT)
-  {
-    LPWSTR filePartPointer = 0;
-    DWORD value = ::SearchPathW(path, fileName, extension,
-        MAX_PATH, resultPath.GetBuffer(MAX_PATH + 1), &filePartPointer);
-    filePart = (UINT32)(filePartPointer - (LPCWSTR)resultPath);
-    resultPath.ReleaseBuffer();
-    return (value > 0 && value <= MAX_PATH);
-  }
-  
-  CSysString sysPath;
-  if (!MySearchPath(
-      path != 0 ? (LPCTSTR)GetSysPath(path): 0,
-      fileName != 0 ? (LPCTSTR)GetSysPath(fileName): 0,
-      extension != 0 ? (LPCTSTR)GetSysPath(extension): 0,
-      sysPath, filePart))
-    return false;
-  UString resultPath1 = GetUnicodePath(sysPath.Left(filePart));
-  UString resultPath2 = GetUnicodePath(sysPath.Mid(filePart));
-  filePart = resultPath1.Length();
-  resultPath = resultPath1 + resultPath2;
-  return true;
-}
-#endif
-
-bool MyGetTempPath(CSysString &path)
-{
-  DWORD needLength = ::GetTempPath(MAX_PATH + 1, path.GetBuffer(MAX_PATH + 1));
-  path.ReleaseBuffer();
-  return (needLength > 0 && needLength <= MAX_PATH);
-}
-
-#ifndef _UNICODE
-bool MyGetTempPath(UString &path)
-{
-  path.Empty();
-  if (g_IsNT)
-  {
-    DWORD needLength = ::GetTempPathW(MAX_PATH + 1, path.GetBuffer(MAX_PATH + 1));
-    path.ReleaseBuffer();
-    return (needLength > 0 && needLength <= MAX_PATH);
-  }
-  CSysString sysPath;
-  if (!MyGetTempPath(sysPath))
-    return false;
-  path = GetUnicodePath(sysPath);
-  return true;
-}
-#endif
-
-UINT MyGetTempFileName(LPCTSTR dirPath, LPCTSTR prefix, CSysString &path)
-{
-  UINT number = ::GetTempFileName(dirPath, prefix, 0, path.GetBuffer(MAX_PATH + 1));
-  path.ReleaseBuffer();
-  return number;
-}
-
-#ifndef _UNICODE
-UINT MyGetTempFileName(LPCWSTR dirPath, LPCWSTR prefix, UString &path)
-{
-  if (g_IsNT)
-  {
-    UINT number = ::GetTempFileNameW(dirPath, prefix, 0, path.GetBuffer(MAX_PATH));
-    path.ReleaseBuffer();
-    return number;
-  }
-  CSysString sysPath;
-  UINT number = MyGetTempFileName(
-      dirPath ? (LPCTSTR)GetSysPath(dirPath): 0,
-      prefix ? (LPCTSTR)GetSysPath(prefix): 0,
-      sysPath);
-  path = GetUnicodePath(sysPath);
-  return number;
-}
-#endif
-
-UINT CTempFile::Create(LPCTSTR dirPath, LPCTSTR prefix, CSysString &resultPath)
-{
-  Remove();
-  UINT number = MyGetTempFileName(dirPath, prefix, resultPath);
-  if (number != 0)
-  {
-    _fileName = resultPath;
-    _mustBeDeleted = true;
-  }
-  return number;
-}
-
-bool CTempFile::Create(LPCTSTR prefix, CSysString &resultPath)
-{
-  CSysString tempPath;
-  if (!MyGetTempPath(tempPath))
-    return false;
-  if (Create(tempPath, prefix, resultPath) != 0)
-    return true;
-  if (!MyGetWindowsDirectory(tempPath))
-    return false;
-  return (Create(tempPath, prefix, resultPath) != 0);
-}
-
-bool CTempFile::Remove()
-{
-  if (!_mustBeDeleted)
-    return true;
-  _mustBeDeleted = !DeleteFileAlways(_fileName);
-  return !_mustBeDeleted;
-}
-
-#ifndef _UNICODE
-
-UINT CTempFileW::Create(LPCWSTR dirPath, LPCWSTR prefix, UString &resultPath)
-{
-  Remove();
-  UINT number = MyGetTempFileName(dirPath, prefix, resultPath);
-  if (number != 0)
-  {
-    _fileName = resultPath;
-    _mustBeDeleted = true;
-  }
-  return number;
-}
-
-bool CTempFileW::Create(LPCWSTR prefix, UString &resultPath)
-{
-  UString tempPath;
-  if (!MyGetTempPath(tempPath))
-    return false;
-  if (Create(tempPath, prefix, resultPath) != 0)
-    return true;
-  if (!MyGetWindowsDirectory(tempPath))
-    return false;
-  return (Create(tempPath, prefix, resultPath) != 0);
-}
-
-bool CTempFileW::Remove()
-{
-  if (!_mustBeDeleted)
-    return true;
-  _mustBeDeleted = !DeleteFileAlways(_fileName);
-  return !_mustBeDeleted;
-}
-
-#endif
-
-bool CreateTempDirectory(LPCTSTR prefix, CSysString &dirName)
-{
-  /*
-  CSysString prefix = tempPath + prefixChars;
-  CRandom random;
-  random.Init();
-  */
-  for (;;)
-  {
-    CTempFile tempFile;
-    if (!tempFile.Create(prefix, dirName))
-      return false;
-    if (!::DeleteFile(dirName))
-      return false;
-    /*
-    UINT32 randomNumber = random.Generate();
-    TCHAR randomNumberString[32];
-    _stprintf(randomNumberString, _T("%04X"), randomNumber);
-    dirName = prefix + randomNumberString;
-    */
-    if (NFind::DoesFileExist(dirName))
-      continue;
-    if (MyCreateDirectory(dirName))
-      return true;
-    if (::GetLastError() != ERROR_ALREADY_EXISTS)
-      return false;
-  }
-}
-
-bool CTempDirectory::Create(LPCTSTR prefix)
-{
-  Remove();
-  return (_mustBeDeleted = CreateTempDirectory(prefix, _tempDir));
-}
-
-#ifndef _UNICODE
-
-bool CreateTempDirectory(LPCWSTR prefix, UString &dirName)
-{
-  /*
-  CSysString prefix = tempPath + prefixChars;
-  CRandom random;
-  random.Init();
-  */
-  for (;;)
-  {
-    CTempFileW tempFile;
-    if (!tempFile.Create(prefix, dirName))
-      return false;
-    if (!DeleteFileAlways(dirName))
-      return false;
-    /*
-    UINT32 randomNumber = random.Generate();
-    TCHAR randomNumberString[32];
-    _stprintf(randomNumberString, _T("%04X"), randomNumber);
-    dirName = prefix + randomNumberString;
-    */
-    if (NFind::DoesFileExist(dirName))
-      continue;
-    if (MyCreateDirectory(dirName))
-      return true;
-    if (::GetLastError() != ERROR_ALREADY_EXISTS)
-      return false;
-  }
-}
-
-bool CTempDirectoryW::Create(LPCWSTR prefix)
-{
-  Remove();
-  return (_mustBeDeleted = CreateTempDirectory(prefix, _tempDir));
-}
-
-#endif
-
-}}}
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/FileDir.h b/third_party/lzma/v4_65/files/CPP/Windows/FileDir.h
deleted file mode 100644
index 279ccdc..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/FileDir.h
+++ /dev/null
@@ -1,178 +0,0 @@
-// Windows/FileDir.h
-
-#ifndef __WINDOWS_FILEDIR_H
-#define __WINDOWS_FILEDIR_H
-
-#include "../Common/MyString.h"
-#include "Defs.h"
-
-namespace NWindows {
-namespace NFile {
-namespace NDirectory {
-
-#ifdef WIN_LONG_PATH
-bool GetLongPaths(LPCWSTR s1, LPCWSTR s2, UString &d1, UString &d2);
-#endif
-
-bool MyGetWindowsDirectory(CSysString &path);
-bool MyGetSystemDirectory(CSysString &path);
-#ifndef _UNICODE
-bool MyGetWindowsDirectory(UString &path);
-bool MyGetSystemDirectory(UString &path);
-#endif
-
-bool SetDirTime(LPCWSTR fileName, const FILETIME *cTime, const FILETIME *aTime, const FILETIME *mTime);
-
-bool MySetFileAttributes(LPCTSTR fileName, DWORD fileAttributes);
-bool MyMoveFile(LPCTSTR existFileName, LPCTSTR newFileName);
-bool MyRemoveDirectory(LPCTSTR pathName);
-bool MyCreateDirectory(LPCTSTR pathName);
-bool CreateComplexDirectory(LPCTSTR pathName);
-bool DeleteFileAlways(LPCTSTR name);
-bool RemoveDirectoryWithSubItems(const CSysString &path);
-
-#ifndef _UNICODE
-bool MySetFileAttributes(LPCWSTR fileName, DWORD fileAttributes);
-bool MyMoveFile(LPCWSTR existFileName, LPCWSTR newFileName);
-bool MyRemoveDirectory(LPCWSTR pathName);
-bool MyCreateDirectory(LPCWSTR pathName);
-bool CreateComplexDirectory(LPCWSTR pathName);
-bool DeleteFileAlways(LPCWSTR name);
-bool RemoveDirectoryWithSubItems(const UString &path);
-#endif
-
-#ifndef _WIN32_WCE
-bool MyGetShortPathName(LPCTSTR longPath, CSysString &shortPath);
-
-bool MyGetFullPathName(LPCTSTR fileName, CSysString &resultPath,
-    int &fileNamePartStartIndex);
-bool MyGetFullPathName(LPCTSTR fileName, CSysString &resultPath);
-bool GetOnlyName(LPCTSTR fileName, CSysString &resultName);
-bool GetOnlyDirPrefix(LPCTSTR fileName, CSysString &resultName);
-#ifndef _UNICODE
-bool MyGetFullPathName(LPCWSTR fileName, UString &resultPath,
-    int &fileNamePartStartIndex);
-bool MyGetFullPathName(LPCWSTR fileName, UString &resultPath);
-bool GetOnlyName(LPCWSTR fileName, UString &resultName);
-bool GetOnlyDirPrefix(LPCWSTR fileName, UString &resultName);
-#endif
-
-inline bool MySetCurrentDirectory(LPCTSTR path)
-  { return BOOLToBool(::SetCurrentDirectory(path)); }
-bool MyGetCurrentDirectory(CSysString &resultPath);
-#ifndef _UNICODE
-bool MySetCurrentDirectory(LPCWSTR path);
-bool MyGetCurrentDirectory(UString &resultPath);
-#endif
-#endif
-
-bool MySearchPath(LPCTSTR path, LPCTSTR fileName, LPCTSTR extension,
-  CSysString &resultPath, UINT32 &filePart);
-#ifndef _UNICODE
-bool MySearchPath(LPCWSTR path, LPCWSTR fileName, LPCWSTR extension,
-  UString &resultPath, UINT32 &filePart);
-#endif
-
-inline bool MySearchPath(LPCTSTR path, LPCTSTR fileName, LPCTSTR extension,
-  CSysString &resultPath)
-{
-  UINT32 value;
-  return MySearchPath(path, fileName, extension, resultPath, value);
-}
-
-#ifndef _UNICODE
-inline bool MySearchPath(LPCWSTR path, LPCWSTR fileName, LPCWSTR extension,
-  UString &resultPath)
-{
-  UINT32 value;
-  return MySearchPath(path, fileName, extension, resultPath, value);
-}
-#endif
-
-bool MyGetTempPath(CSysString &resultPath);
-#ifndef _UNICODE
-bool MyGetTempPath(UString &resultPath);
-#endif
-
-UINT MyGetTempFileName(LPCTSTR dirPath, LPCTSTR prefix, CSysString &resultPath);
-#ifndef _UNICODE
-UINT MyGetTempFileName(LPCWSTR dirPath, LPCWSTR prefix, UString &resultPath);
-#endif
-
-class CTempFile
-{
-  bool _mustBeDeleted;
-  CSysString _fileName;
-public:
-  CTempFile(): _mustBeDeleted(false) {}
-  ~CTempFile() { Remove(); }
-  void DisableDeleting() { _mustBeDeleted = false; }
-  UINT Create(LPCTSTR dirPath, LPCTSTR prefix, CSysString &resultPath);
-  bool Create(LPCTSTR prefix, CSysString &resultPath);
-  bool Remove();
-};
-
-#ifdef _UNICODE
-typedef CTempFile CTempFileW;
-#else
-class CTempFileW
-{
-  bool _mustBeDeleted;
-  UString _fileName;
-public:
-  CTempFileW(): _mustBeDeleted(false) {}
-  ~CTempFileW() { Remove(); }
-  void DisableDeleting() { _mustBeDeleted = false; }
-  UINT Create(LPCWSTR dirPath, LPCWSTR prefix, UString &resultPath);
-  bool Create(LPCWSTR prefix, UString &resultPath);
-  bool Remove();
-};
-#endif
-
-bool CreateTempDirectory(LPCTSTR prefixChars, CSysString &dirName);
-
-class CTempDirectory
-{
-  bool _mustBeDeleted;
-  CSysString _tempDir;
-public:
-  const CSysString &GetPath() const { return _tempDir; }
-  CTempDirectory(): _mustBeDeleted(false) {}
-  ~CTempDirectory() { Remove();  }
-  bool Create(LPCTSTR prefix) ;
-  bool Remove()
-  {
-    if (!_mustBeDeleted)
-      return true;
-    _mustBeDeleted = !RemoveDirectoryWithSubItems(_tempDir);
-    return (!_mustBeDeleted);
-  }
-  void DisableDeleting() { _mustBeDeleted = false; }
-};
-
-#ifdef _UNICODE
-typedef CTempDirectory CTempDirectoryW;
-#else
-class CTempDirectoryW
-{
-  bool _mustBeDeleted;
-  UString _tempDir;
-public:
-  const UString &GetPath() const { return _tempDir; }
-  CTempDirectoryW(): _mustBeDeleted(false) {}
-  ~CTempDirectoryW() { Remove();  }
-  bool Create(LPCWSTR prefix) ;
-  bool Remove()
-  {
-    if (!_mustBeDeleted)
-      return true;
-    _mustBeDeleted = !RemoveDirectoryWithSubItems(_tempDir);
-    return (!_mustBeDeleted);
-  }
-  void DisableDeleting() { _mustBeDeleted = false; }
-};
-#endif
-
-}}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/FileFind.cpp b/third_party/lzma/v4_65/files/CPP/Windows/FileFind.cpp
deleted file mode 100644
index f33ec96..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/FileFind.cpp
+++ /dev/null
@@ -1,402 +0,0 @@
-// Windows/FileFind.cpp
-
-#include "StdAfx.h"
-
-#include "FileFind.h"
-#ifndef _UNICODE
-#include "../Common/StringConvert.h"
-#endif
-
-#ifndef _UNICODE
-extern bool g_IsNT;
-#endif
-
-namespace NWindows {
-namespace NFile {
-
-#if defined(WIN_LONG_PATH) && defined(_UNICODE)
-#define WIN_LONG_PATH2
-#endif
-
-bool GetLongPath(LPCWSTR fileName, UString &res);
-
-namespace NFind {
-
-static const TCHAR kDot = TEXT('.');
-
-bool CFileInfo::IsDots() const
-{
-  if (!IsDir() || Name.IsEmpty())
-    return false;
-  if (Name[0] != kDot)
-    return false;
-  return Name.Length() == 1 || (Name[1] == kDot && Name.Length() == 2);
-}
-
-#ifndef _UNICODE
-bool CFileInfoW::IsDots() const
-{
-  if (!IsDir() || Name.IsEmpty())
-    return false;
-  if (Name[0] != kDot)
-    return false;
-  return Name.Length() == 1 || (Name[1] == kDot && Name.Length() == 2);
-}
-#endif
-
-static void ConvertWIN32_FIND_DATA_To_FileInfo(const WIN32_FIND_DATA &fd, CFileInfo &fi)
-{
-  fi.Attrib = fd.dwFileAttributes;
-  fi.CTime = fd.ftCreationTime;
-  fi.ATime = fd.ftLastAccessTime;
-  fi.MTime = fd.ftLastWriteTime;
-  fi.Size  = (((UInt64)fd.nFileSizeHigh) << 32) + fd.nFileSizeLow;
-  fi.Name = fd.cFileName;
-  #ifndef _WIN32_WCE
-  fi.ReparseTag = fd.dwReserved0;
-  #else
-  fi.ObjectID = fd.dwOID;
-  #endif
-}
-
-#ifndef _UNICODE
-
-static inline UINT GetCurrentCodePage() { return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
-
-static void ConvertWIN32_FIND_DATA_To_FileInfo(const WIN32_FIND_DATAW &fd, CFileInfoW &fi)
-{
-  fi.Attrib = fd.dwFileAttributes;
-  fi.CTime = fd.ftCreationTime;
-  fi.ATime = fd.ftLastAccessTime;
-  fi.MTime = fd.ftLastWriteTime;
-  fi.Size  = (((UInt64)fd.nFileSizeHigh) << 32) + fd.nFileSizeLow;
-  fi.Name = fd.cFileName;
-  #ifndef _WIN32_WCE
-  fi.ReparseTag = fd.dwReserved0;
-  #else
-  fi.ObjectID = fd.dwOID;
-  #endif
-}
-
-static void ConvertWIN32_FIND_DATA_To_FileInfo(const WIN32_FIND_DATA &fd, CFileInfoW &fi)
-{
-  fi.Attrib = fd.dwFileAttributes;
-  fi.CTime = fd.ftCreationTime;
-  fi.ATime = fd.ftLastAccessTime;
-  fi.MTime = fd.ftLastWriteTime;
-  fi.Size  = (((UInt64)fd.nFileSizeHigh) << 32) + fd.nFileSizeLow;
-  fi.Name = GetUnicodeString(fd.cFileName, GetCurrentCodePage());
-  #ifndef _WIN32_WCE
-  fi.ReparseTag = fd.dwReserved0;
-  #else
-  fi.ObjectID = fd.dwOID;
-  #endif
-}
-#endif
-  
-////////////////////////////////
-// CFindFile
-
-bool CFindFile::Close()
-{
-  if (_handle == INVALID_HANDLE_VALUE)
-    return true;
-  if (!::FindClose(_handle))
-    return false;
-  _handle = INVALID_HANDLE_VALUE;
-  return true;
-}
-
-          
-bool CFindFile::FindFirst(LPCTSTR wildcard, CFileInfo &fileInfo)
-{
-  if (!Close())
-    return false;
-  WIN32_FIND_DATA fd;
-  _handle = ::FindFirstFile(wildcard, &fd);
-  #ifdef WIN_LONG_PATH2
-  if (_handle == INVALID_HANDLE_VALUE)
-  {
-    UString longPath;
-    if (GetLongPath(wildcard, longPath))
-      _handle = ::FindFirstFileW(longPath, &fd);
-  }
-  #endif
-  if (_handle == INVALID_HANDLE_VALUE)
-    return false;
-  ConvertWIN32_FIND_DATA_To_FileInfo(fd, fileInfo);
-  return true;
-}
-
-#ifndef _UNICODE
-bool CFindFile::FindFirst(LPCWSTR wildcard, CFileInfoW &fileInfo)
-{
-  if (!Close())
-    return false;
-  if (g_IsNT)
-  {
-    WIN32_FIND_DATAW fd;
-    _handle = ::FindFirstFileW(wildcard, &fd);
-    #ifdef WIN_LONG_PATH
-    if (_handle == INVALID_HANDLE_VALUE)
-    {
-      UString longPath;
-      if (GetLongPath(wildcard, longPath))
-        _handle = ::FindFirstFileW(longPath, &fd);
-    }
-    #endif
-    if (_handle != INVALID_HANDLE_VALUE)
-      ConvertWIN32_FIND_DATA_To_FileInfo(fd, fileInfo);
-  }
-  else
-  {
-    WIN32_FIND_DATAA fd;
-    _handle = ::FindFirstFileA(UnicodeStringToMultiByte(wildcard,
-        GetCurrentCodePage()), &fd);
-    if (_handle != INVALID_HANDLE_VALUE)
-      ConvertWIN32_FIND_DATA_To_FileInfo(fd, fileInfo);
-  }
-  return (_handle != INVALID_HANDLE_VALUE);
-}
-#endif
-
-bool CFindFile::FindNext(CFileInfo &fileInfo)
-{
-  WIN32_FIND_DATA fd;
-  bool result = BOOLToBool(::FindNextFile(_handle, &fd));
-  if (result)
-    ConvertWIN32_FIND_DATA_To_FileInfo(fd, fileInfo);
-  return result;
-}
-
-#ifndef _UNICODE
-bool CFindFile::FindNext(CFileInfoW &fileInfo)
-{
-  if (g_IsNT)
-  {
-    WIN32_FIND_DATAW fd;
-    if (!::FindNextFileW(_handle, &fd))
-      return false;
-    ConvertWIN32_FIND_DATA_To_FileInfo(fd, fileInfo);
-  }
-  else
-  {
-    WIN32_FIND_DATAA fd;
-    if (!::FindNextFileA(_handle, &fd))
-      return false;
-    ConvertWIN32_FIND_DATA_To_FileInfo(fd, fileInfo);
-  }
-  return true;
-}
-#endif
-
-bool FindFile(LPCTSTR wildcard, CFileInfo &fileInfo)
-{
-  CFindFile finder;
-  return finder.FindFirst(wildcard, fileInfo);
-}
-
-#ifndef _UNICODE
-bool FindFile(LPCWSTR wildcard, CFileInfoW &fileInfo)
-{
-  CFindFile finder;
-  return finder.FindFirst(wildcard, fileInfo);
-}
-#endif
-
-bool DoesFileExist(LPCTSTR name)
-{
-  CFileInfo fileInfo;
-  return FindFile(name, fileInfo);
-}
-
-#ifndef _UNICODE
-bool DoesFileExist(LPCWSTR name)
-{
-  CFileInfoW fileInfo;
-  return FindFile(name, fileInfo);
-}
-#endif
-
-/////////////////////////////////////
-// CEnumerator
-
-bool CEnumerator::NextAny(CFileInfo &fileInfo)
-{
-  if (_findFile.IsHandleAllocated())
-    return _findFile.FindNext(fileInfo);
-  else
-    return _findFile.FindFirst(_wildcard, fileInfo);
-}
-
-bool CEnumerator::Next(CFileInfo &fileInfo)
-{
-  for (;;)
-  {
-    if (!NextAny(fileInfo))
-      return false;
-    if (!fileInfo.IsDots())
-      return true;
-  }
-}
-
-bool CEnumerator::Next(CFileInfo &fileInfo, bool &found)
-{
-  if (Next(fileInfo))
-  {
-    found = true;
-    return true;
-  }
-  found = false;
-  return (::GetLastError() == ERROR_NO_MORE_FILES);
-}
-
-#ifndef _UNICODE
-bool CEnumeratorW::NextAny(CFileInfoW &fileInfo)
-{
-  if (_findFile.IsHandleAllocated())
-    return _findFile.FindNext(fileInfo);
-  else
-    return _findFile.FindFirst(_wildcard, fileInfo);
-}
-
-bool CEnumeratorW::Next(CFileInfoW &fileInfo)
-{
-  for (;;)
-  {
-    if (!NextAny(fileInfo))
-      return false;
-    if (!fileInfo.IsDots())
-      return true;
-  }
-}
-
-bool CEnumeratorW::Next(CFileInfoW &fileInfo, bool &found)
-{
-  if (Next(fileInfo))
-  {
-    found = true;
-    return true;
-  }
-  found = false;
-  return (::GetLastError() == ERROR_NO_MORE_FILES);
-}
-
-#endif
-
-////////////////////////////////
-// CFindChangeNotification
-// FindFirstChangeNotification can return 0. MSDN doesn't tell about it.
-
-bool CFindChangeNotification::Close()
-{
-  if (!IsHandleAllocated())
-    return true;
-  if (!::FindCloseChangeNotification(_handle))
-    return false;
-  _handle = INVALID_HANDLE_VALUE;
-  return true;
-}
-           
-HANDLE CFindChangeNotification::FindFirst(LPCTSTR pathName, bool watchSubtree, DWORD notifyFilter)
-{
-  _handle = ::FindFirstChangeNotification(pathName, BoolToBOOL(watchSubtree), notifyFilter);
-  #ifdef WIN_LONG_PATH2
-  if (!IsHandleAllocated())
-  {
-    UString longPath;
-    if (GetLongPath(pathName, longPath))
-      _handle = ::FindFirstChangeNotificationW(longPath, BoolToBOOL(watchSubtree), notifyFilter);
-  }
-  #endif
-  return _handle;
-}
-
-#ifndef _UNICODE
-HANDLE CFindChangeNotification::FindFirst(LPCWSTR pathName, bool watchSubtree, DWORD notifyFilter)
-{
-  if (!g_IsNT)
-    return FindFirst(UnicodeStringToMultiByte(pathName, GetCurrentCodePage()), watchSubtree, notifyFilter);
-  _handle = ::FindFirstChangeNotificationW(pathName, BoolToBOOL(watchSubtree), notifyFilter);
-  #ifdef WIN_LONG_PATH
-  if (!IsHandleAllocated())
-  {
-    UString longPath;
-    if (GetLongPath(pathName, longPath))
-      _handle = ::FindFirstChangeNotificationW(longPath, BoolToBOOL(watchSubtree), notifyFilter);
-  }
-  #endif
-  return _handle;
-}
-#endif
-
-#ifndef _WIN32_WCE
-bool MyGetLogicalDriveStrings(CSysStringVector &driveStrings)
-{
-  driveStrings.Clear();
-  UINT32 size = GetLogicalDriveStrings(0, NULL);
-  if (size == 0)
-    return false;
-  CSysString buffer;
-  UINT32 newSize = GetLogicalDriveStrings(size, buffer.GetBuffer(size));
-  if (newSize == 0)
-    return false;
-  if (newSize > size)
-    return false;
-  CSysString string;
-  for (UINT32 i = 0; i < newSize; i++)
-  {
-    TCHAR c = buffer[i];
-    if (c == TEXT('\0'))
-    {
-      driveStrings.Add(string);
-      string.Empty();
-    }
-    else
-      string += c;
-  }
-  if (!string.IsEmpty())
-    return false;
-  return true;
-}
-
-#ifndef _UNICODE
-bool MyGetLogicalDriveStrings(UStringVector &driveStrings)
-{
-  driveStrings.Clear();
-  if (g_IsNT)
-  {
-    UINT32 size = GetLogicalDriveStringsW(0, NULL);
-    if (size == 0)
-      return false;
-    UString buffer;
-    UINT32 newSize = GetLogicalDriveStringsW(size, buffer.GetBuffer(size));
-    if (newSize == 0)
-      return false;
-    if (newSize > size)
-      return false;
-    UString string;
-    for (UINT32 i = 0; i < newSize; i++)
-    {
-      WCHAR c = buffer[i];
-      if (c == L'\0')
-      {
-        driveStrings.Add(string);
-        string.Empty();
-      }
-      else
-        string += c;
-    }
-    return string.IsEmpty();
-  }
-  CSysStringVector driveStringsA;
-  bool res = MyGetLogicalDriveStrings(driveStringsA);
-  for (int i = 0; i < driveStringsA.Size(); i++)
-    driveStrings.Add(GetUnicodeString(driveStringsA[i]));
-  return res;
-}
-#endif
-
-#endif
-
-}}}
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/FileFind.h b/third_party/lzma/v4_65/files/CPP/Windows/FileFind.h
deleted file mode 100644
index 09b9924..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/FileFind.h
+++ /dev/null
@@ -1,153 +0,0 @@
-// Windows/FileFind.h
-
-#ifndef __WINDOWS_FILEFIND_H
-#define __WINDOWS_FILEFIND_H
-
-#include "../Common/MyString.h"
-#include "../Common/Types.h"
-#include "FileName.h"
-#include "Defs.h"
-
-namespace NWindows {
-namespace NFile {
-namespace NFind {
-
-namespace NAttributes
-{
-  inline bool IsReadOnly(DWORD attrib) { return (attrib & FILE_ATTRIBUTE_READONLY) != 0; }
-  inline bool IsHidden(DWORD attrib) { return (attrib & FILE_ATTRIBUTE_HIDDEN) != 0; }
-  inline bool IsSystem(DWORD attrib) { return (attrib & FILE_ATTRIBUTE_SYSTEM) != 0; }
-  inline bool IsDir(DWORD attrib) { return (attrib & FILE_ATTRIBUTE_DIRECTORY) != 0; }
-  inline bool IsArchived(DWORD attrib) { return (attrib & FILE_ATTRIBUTE_ARCHIVE) != 0; }
-  inline bool IsCompressed(DWORD attrib) { return (attrib & FILE_ATTRIBUTE_COMPRESSED) != 0; }
-  inline bool IsEncrypted(DWORD attrib) { return (attrib & FILE_ATTRIBUTE_ENCRYPTED) != 0; }
-}
-
-class CFileInfoBase
-{
-  bool MatchesMask(UINT32 mask) const { return ((Attrib & mask) != 0); }
-public:
-  UInt64 Size;
-  FILETIME CTime;
-  FILETIME ATime;
-  FILETIME MTime;
-  DWORD Attrib;
-  
-  #ifndef _WIN32_WCE
-  UINT32 ReparseTag;
-  #else
-  DWORD ObjectID;
-  #endif
-
-  bool IsArchived() const { return MatchesMask(FILE_ATTRIBUTE_ARCHIVE); }
-  bool IsCompressed() const { return MatchesMask(FILE_ATTRIBUTE_COMPRESSED); }
-  bool IsDir() const { return MatchesMask(FILE_ATTRIBUTE_DIRECTORY); }
-  bool IsEncrypted() const { return MatchesMask(FILE_ATTRIBUTE_ENCRYPTED); }
-  bool IsHidden() const { return MatchesMask(FILE_ATTRIBUTE_HIDDEN); }
-  bool IsNormal() const { return MatchesMask(FILE_ATTRIBUTE_NORMAL); }
-  bool IsOffline() const { return MatchesMask(FILE_ATTRIBUTE_OFFLINE); }
-  bool IsReadOnly() const { return MatchesMask(FILE_ATTRIBUTE_READONLY); }
-  bool HasReparsePoint() const { return MatchesMask(FILE_ATTRIBUTE_REPARSE_POINT); }
-  bool IsSparse() const { return MatchesMask(FILE_ATTRIBUTE_SPARSE_FILE); }
-  bool IsSystem() const { return MatchesMask(FILE_ATTRIBUTE_SYSTEM); }
-  bool IsTemporary() const { return MatchesMask(FILE_ATTRIBUTE_TEMPORARY); }
-};
-
-class CFileInfo: public CFileInfoBase
-{
-public:
-  CSysString Name;
-  bool IsDots() const;
-};
-
-#ifdef _UNICODE
-typedef CFileInfo CFileInfoW;
-#else
-class CFileInfoW: public CFileInfoBase
-{
-public:
-  UString Name;
-  bool IsDots() const;
-};
-#endif
-
-class CFindFile
-{
-  friend class CEnumerator;
-  HANDLE _handle;
-public:
-  bool IsHandleAllocated() const { return _handle != INVALID_HANDLE_VALUE; }
-  CFindFile(): _handle(INVALID_HANDLE_VALUE) {}
-  ~CFindFile() {  Close(); }
-  bool FindFirst(LPCTSTR wildcard, CFileInfo &fileInfo);
-  bool FindNext(CFileInfo &fileInfo);
-  #ifndef _UNICODE
-  bool FindFirst(LPCWSTR wildcard, CFileInfoW &fileInfo);
-  bool FindNext(CFileInfoW &fileInfo);
-  #endif
-  bool Close();
-};
-
-bool FindFile(LPCTSTR wildcard, CFileInfo &fileInfo);
-
-bool DoesFileExist(LPCTSTR name);
-#ifndef _UNICODE
-bool FindFile(LPCWSTR wildcard, CFileInfoW &fileInfo);
-bool DoesFileExist(LPCWSTR name);
-#endif
-
-class CEnumerator
-{
-  CFindFile _findFile;
-  CSysString _wildcard;
-  bool NextAny(CFileInfo &fileInfo);
-public:
-  CEnumerator(): _wildcard(NName::kAnyStringWildcard) {}
-  CEnumerator(const CSysString &wildcard): _wildcard(wildcard) {}
-  bool Next(CFileInfo &fileInfo);
-  bool Next(CFileInfo &fileInfo, bool &found);
-};
-
-#ifdef _UNICODE
-typedef CEnumerator CEnumeratorW;
-#else
-class CEnumeratorW
-{
-  CFindFile _findFile;
-  UString _wildcard;
-  bool NextAny(CFileInfoW &fileInfo);
-public:
-  CEnumeratorW(): _wildcard(NName::kAnyStringWildcard) {}
-  CEnumeratorW(const UString &wildcard): _wildcard(wildcard) {}
-  bool Next(CFileInfoW &fileInfo);
-  bool Next(CFileInfoW &fileInfo, bool &found);
-};
-#endif
-
-class CFindChangeNotification
-{
-  HANDLE _handle;
-public:
-  operator HANDLE () { return _handle; }
-  bool IsHandleAllocated() const { return _handle != INVALID_HANDLE_VALUE && _handle != 0; }
-  CFindChangeNotification(): _handle(INVALID_HANDLE_VALUE) {}
-  ~CFindChangeNotification() { Close(); }
-  bool Close();
-  HANDLE FindFirst(LPCTSTR pathName, bool watchSubtree, DWORD notifyFilter);
-  #ifndef _UNICODE
-  HANDLE FindFirst(LPCWSTR pathName, bool watchSubtree, DWORD notifyFilter);
-  #endif
-  bool FindNext() { return BOOLToBool(::FindNextChangeNotification(_handle)); }
-};
-
-#ifndef _WIN32_WCE
-bool MyGetLogicalDriveStrings(CSysStringVector &driveStrings);
-#ifndef _UNICODE
-bool MyGetLogicalDriveStrings(UStringVector &driveStrings);
-#endif
-#endif
-
-}}}
-
-#endif
-
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/FileIO.cpp b/third_party/lzma/v4_65/files/CPP/Windows/FileIO.cpp
deleted file mode 100644
index 5646d0a..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/FileIO.cpp
+++ /dev/null
@@ -1,317 +0,0 @@
-// Windows/FileIO.cpp
-
-#include "StdAfx.h"
-
-#include "FileIO.h"
-#include "Defs.h"
-#ifdef WIN_LONG_PATH
-#include "../Common/MyString.h"
-#endif
-#ifndef _UNICODE
-#include "../Common/StringConvert.h"
-#endif
-
-#ifndef _UNICODE
-extern bool g_IsNT;
-#endif
-
-namespace NWindows {
-namespace NFile {
-
-#if defined(WIN_LONG_PATH) && defined(_UNICODE)
-#define WIN_LONG_PATH2
-#endif
-
-#ifdef WIN_LONG_PATH
-bool GetLongPathBase(LPCWSTR s, UString &res)
-{
-  res.Empty();
-  int len = MyStringLen(s);
-  wchar_t c = s[0];
-  if (len < 1 || c == L'\\' || c == L'.' && (len == 1 || len == 2 && s[1] == L'.'))
-    return true;
-  UString curDir;
-  bool isAbs = false;
-  if (len > 3)
-    isAbs = (s[1] == L':' && s[2] == L'\\' && (c >= L'a' && c <= L'z' || c >= L'A' && c <= L'Z'));
-
-  if (!isAbs)
-    {
-      DWORD needLength = ::GetCurrentDirectoryW(MAX_PATH + 1, curDir.GetBuffer(MAX_PATH + 1));
-      curDir.ReleaseBuffer();
-      if (needLength == 0 || needLength > MAX_PATH)
-        return false;
-      if (curDir[curDir.Length() - 1] != L'\\')
-        curDir += L'\\';
-    }
-  res = UString(L"\\\\?\\") + curDir + s;
-  return true;
-}
-
-bool GetLongPath(LPCWSTR path, UString &longPath)
-{
-  if (GetLongPathBase(path, longPath))
-    return !longPath.IsEmpty();
-  return false;
-}
-#endif
-
-namespace NIO {
-
-CFileBase::~CFileBase() { Close(); }
-
-bool CFileBase::Create(LPCTSTR fileName, DWORD desiredAccess,
-    DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes)
-{
-  if (!Close())
-    return false;
-  _handle = ::CreateFile(fileName, desiredAccess, shareMode,
-      (LPSECURITY_ATTRIBUTES)NULL, creationDisposition,
-      flagsAndAttributes, (HANDLE)NULL);
-  #ifdef WIN_LONG_PATH2
-  if (_handle == INVALID_HANDLE_VALUE)
-  {
-    UString longPath;
-    if (GetLongPath(fileName, longPath))
-      _handle = ::CreateFileW(longPath, desiredAccess, shareMode,
-        (LPSECURITY_ATTRIBUTES)NULL, creationDisposition,
-        flagsAndAttributes, (HANDLE)NULL);
-  }
-  #endif
-  return (_handle != INVALID_HANDLE_VALUE);
-}
-
-#ifndef _UNICODE
-bool CFileBase::Create(LPCWSTR fileName, DWORD desiredAccess,
-    DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes)
-{
-  if (!g_IsNT)
-    return Create(UnicodeStringToMultiByte(fileName, ::AreFileApisANSI() ? CP_ACP : CP_OEMCP),
-      desiredAccess, shareMode, creationDisposition, flagsAndAttributes);
-  if (!Close())
-    return false;
-  _handle = ::CreateFileW(fileName, desiredAccess, shareMode,
-    (LPSECURITY_ATTRIBUTES)NULL, creationDisposition,
-    flagsAndAttributes, (HANDLE)NULL);
-  #ifdef WIN_LONG_PATH
-  if (_handle == INVALID_HANDLE_VALUE)
-  {
-    UString longPath;
-    if (GetLongPath(fileName, longPath))
-      _handle = ::CreateFileW(longPath, desiredAccess, shareMode,
-        (LPSECURITY_ATTRIBUTES)NULL, creationDisposition,
-        flagsAndAttributes, (HANDLE)NULL);
-  }
-  #endif
-  return (_handle != INVALID_HANDLE_VALUE);
-}
-#endif
-
-bool CFileBase::Close()
-{
-  if (_handle == INVALID_HANDLE_VALUE)
-    return true;
-  if (!::CloseHandle(_handle))
-    return false;
-  _handle = INVALID_HANDLE_VALUE;
-  return true;
-}
-
-bool CFileBase::GetPosition(UInt64 &position) const
-{
-  return Seek(0, FILE_CURRENT, position);
-}
-
-bool CFileBase::GetLength(UInt64 &length) const
-{
-  DWORD sizeHigh;
-  DWORD sizeLow = ::GetFileSize(_handle, &sizeHigh);
-  if (sizeLow == 0xFFFFFFFF)
-    if (::GetLastError() != NO_ERROR)
-      return false;
-  length = (((UInt64)sizeHigh) << 32) + sizeLow;
-  return true;
-}
-
-bool CFileBase::Seek(Int64 distanceToMove, DWORD moveMethod, UInt64 &newPosition) const
-{
-  LARGE_INTEGER value;
-  value.QuadPart = distanceToMove;
-  value.LowPart = ::SetFilePointer(_handle, value.LowPart, &value.HighPart, moveMethod);
-  if (value.LowPart == 0xFFFFFFFF)
-    if (::GetLastError() != NO_ERROR)
-      return false;
-  newPosition = value.QuadPart;
-  return true;
-}
-
-bool CFileBase::Seek(UInt64 position, UInt64 &newPosition)
-{
-  return Seek(position, FILE_BEGIN, newPosition);
-}
-
-bool CFileBase::SeekToBegin()
-{
-  UInt64 newPosition;
-  return Seek(0, newPosition);
-}
-
-bool CFileBase::SeekToEnd(UInt64 &newPosition)
-{
-  return Seek(0, FILE_END, newPosition);
-}
-
-bool CFileBase::GetFileInformation(CByHandleFileInfo &fileInfo) const
-{
-  BY_HANDLE_FILE_INFORMATION winFileInfo;
-  if (!::GetFileInformationByHandle(_handle, &winFileInfo))
-    return false;
-  fileInfo.Attributes = winFileInfo.dwFileAttributes;
-  fileInfo.CTime = winFileInfo.ftCreationTime;
-  fileInfo.ATime = winFileInfo.ftLastAccessTime;
-  fileInfo.MTime = winFileInfo.ftLastWriteTime;
-  fileInfo.VolumeSerialNumber = winFileInfo.dwFileAttributes;
-  fileInfo.Size = (((UInt64)winFileInfo.nFileSizeHigh) << 32) +  winFileInfo.nFileSizeLow;
-  fileInfo.NumberOfLinks = winFileInfo.nNumberOfLinks;
-  fileInfo.FileIndex = (((UInt64)winFileInfo.nFileIndexHigh) << 32) + winFileInfo.nFileIndexLow;
-  return true;
-}
-
-/////////////////////////
-// CInFile
-
-bool CInFile::Open(LPCTSTR fileName, DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes)
-  { return Create(fileName, GENERIC_READ, shareMode, creationDisposition, flagsAndAttributes); }
-
-bool CInFile::OpenShared(LPCTSTR fileName, bool shareForWrite)
-{ return Open(fileName, FILE_SHARE_READ | (shareForWrite ? FILE_SHARE_WRITE : 0), OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL); }
-
-bool CInFile::Open(LPCTSTR fileName)
-  { return OpenShared(fileName, false); }
-
-#ifndef _UNICODE
-bool CInFile::Open(LPCWSTR fileName, DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes)
-  { return Create(fileName, GENERIC_READ, shareMode, creationDisposition, flagsAndAttributes); }
-
-bool CInFile::OpenShared(LPCWSTR fileName, bool shareForWrite)
-{ return Open(fileName, FILE_SHARE_READ | (shareForWrite ? FILE_SHARE_WRITE : 0), OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL); }
-
-bool CInFile::Open(LPCWSTR fileName)
-  { return OpenShared(fileName, false); }
-#endif
-
-// ReadFile and WriteFile functions in Windows have BUG:
-// If you Read or Write 64MB or more (probably min_failure_size = 64MB - 32KB + 1)
-// from/to Network file, it returns ERROR_NO_SYSTEM_RESOURCES
-// (Insufficient system resources exist to complete the requested service).
-
-// Probably in some version of Windows there are problems with other sizes:
-// for 32 MB (maybe also for 16 MB).
-// And message can be "Network connection was lost"
-
-static UInt32 kChunkSizeMax = (1 << 22);
-
-bool CInFile::ReadPart(void *data, UInt32 size, UInt32 &processedSize)
-{
-  if (size > kChunkSizeMax)
-    size = kChunkSizeMax;
-  DWORD processedLoc = 0;
-  bool res = BOOLToBool(::ReadFile(_handle, data, size, &processedLoc, NULL));
-  processedSize = (UInt32)processedLoc;
-  return res;
-}
-
-bool CInFile::Read(void *data, UInt32 size, UInt32 &processedSize)
-{
-  processedSize = 0;
-  do
-  {
-    UInt32 processedLoc = 0;
-    bool res = ReadPart(data, size, processedLoc);
-    processedSize += processedLoc;
-    if (!res)
-      return false;
-    if (processedLoc == 0)
-      return true;
-    data = (void *)((unsigned char *)data + processedLoc);
-    size -= processedLoc;
-  }
-  while (size > 0);
-  return true;
-}
-
-/////////////////////////
-// COutFile
-
-bool COutFile::Open(LPCTSTR fileName, DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes)
-  { return CFileBase::Create(fileName, GENERIC_WRITE, shareMode, creationDisposition, flagsAndAttributes); }
-
-static inline DWORD GetCreationDisposition(bool createAlways)
-  { return createAlways? CREATE_ALWAYS: CREATE_NEW; }
-
-bool COutFile::Open(LPCTSTR fileName, DWORD creationDisposition)
-  { return Open(fileName, FILE_SHARE_READ, creationDisposition, FILE_ATTRIBUTE_NORMAL); }
-
-bool COutFile::Create(LPCTSTR fileName, bool createAlways)
-  { return Open(fileName, GetCreationDisposition(createAlways)); }
-
-#ifndef _UNICODE
-
-bool COutFile::Open(LPCWSTR fileName, DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes)
-  { return CFileBase::Create(fileName, GENERIC_WRITE, shareMode,      creationDisposition, flagsAndAttributes); }
-
-bool COutFile::Open(LPCWSTR fileName, DWORD creationDisposition)
-  { return Open(fileName, FILE_SHARE_READ,  creationDisposition, FILE_ATTRIBUTE_NORMAL); }
-
-bool COutFile::Create(LPCWSTR fileName, bool createAlways)
-  { return Open(fileName, GetCreationDisposition(createAlways)); }
-
-#endif
-
-bool COutFile::SetTime(const FILETIME *cTime, const FILETIME *aTime, const FILETIME *mTime)
-  { return BOOLToBool(::SetFileTime(_handle, cTime, aTime, mTime)); }
-
-bool COutFile::SetMTime(const FILETIME *mTime) {  return SetTime(NULL, NULL, mTime); }
-
-bool COutFile::WritePart(const void *data, UInt32 size, UInt32 &processedSize)
-{
-  if (size > kChunkSizeMax)
-    size = kChunkSizeMax;
-  DWORD processedLoc = 0;
-  bool res = BOOLToBool(::WriteFile(_handle, data, size, &processedLoc, NULL));
-  processedSize = (UInt32)processedLoc;
-  return res;
-}
-
-bool COutFile::Write(const void *data, UInt32 size, UInt32 &processedSize)
-{
-  processedSize = 0;
-  do
-  {
-    UInt32 processedLoc = 0;
-    bool res = WritePart(data, size, processedLoc);
-    processedSize += processedLoc;
-    if (!res)
-      return false;
-    if (processedLoc == 0)
-      return true;
-    data = (const void *)((const unsigned char *)data + processedLoc);
-    size -= processedLoc;
-  }
-  while (size > 0);
-  return true;
-}
-
-bool COutFile::SetEndOfFile() { return BOOLToBool(::SetEndOfFile(_handle)); }
-
-bool COutFile::SetLength(UInt64 length)
-{
-  UInt64 newPosition;
-  if (!Seek(length, newPosition))
-    return false;
-  if (newPosition != length)
-    return false;
-  return SetEndOfFile();
-}
-
-}}}
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/FileIO.h b/third_party/lzma/v4_65/files/CPP/Windows/FileIO.h
deleted file mode 100644
index f1e600e..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/FileIO.h
+++ /dev/null
@@ -1,99 +0,0 @@
-// Windows/FileIO.h
-
-#ifndef __WINDOWS_FILEIO_H
-#define __WINDOWS_FILEIO_H
-
-#include "../Common/Types.h"
-
-namespace NWindows {
-namespace NFile {
-namespace NIO {
-
-struct CByHandleFileInfo
-{
-  DWORD    Attributes;
-  FILETIME CTime;
-  FILETIME ATime;
-  FILETIME MTime;
-  DWORD    VolumeSerialNumber;
-  UInt64   Size;
-  DWORD    NumberOfLinks;
-  UInt64   FileIndex;
-};
-
-class CFileBase
-{
-protected:
-  HANDLE _handle;
-  bool Create(LPCTSTR fileName, DWORD desiredAccess,
-      DWORD shareMode, DWORD creationDisposition,  DWORD flagsAndAttributes);
-  #ifndef _UNICODE
-  bool Create(LPCWSTR fileName, DWORD desiredAccess,
-      DWORD shareMode, DWORD creationDisposition,  DWORD flagsAndAttributes);
-  #endif
-
-public:
-  CFileBase(): _handle(INVALID_HANDLE_VALUE){};
-  ~CFileBase();
-
-  bool Close();
-
-  bool GetPosition(UInt64 &position) const;
-  bool GetLength(UInt64 &length) const;
-
-  bool Seek(Int64 distanceToMove, DWORD moveMethod, UInt64 &newPosition) const;
-  bool Seek(UInt64 position, UInt64 &newPosition);
-  bool SeekToBegin();
-  bool SeekToEnd(UInt64 &newPosition);
-  
-  bool GetFileInformation(CByHandleFileInfo &fileInfo) const;
-};
-
-class CInFile: public CFileBase
-{
-public:
-  bool Open(LPCTSTR fileName, DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes);
-  bool OpenShared(LPCTSTR fileName, bool shareForWrite);
-  bool Open(LPCTSTR fileName);
-  #ifndef _UNICODE
-  bool Open(LPCWSTR fileName, DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes);
-  bool OpenShared(LPCWSTR fileName, bool shareForWrite);
-  bool Open(LPCWSTR fileName);
-  #endif
-  bool ReadPart(void *data, UInt32 size, UInt32 &processedSize);
-  bool Read(void *data, UInt32 size, UInt32 &processedSize);
-};
-
-class COutFile: public CFileBase
-{
-  // DWORD m_CreationDisposition;
-public:
-  // COutFile(): m_CreationDisposition(CREATE_NEW){};
-  bool Open(LPCTSTR fileName, DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes);
-  bool Open(LPCTSTR fileName, DWORD creationDisposition);
-  bool Create(LPCTSTR fileName, bool createAlways);
-
-  #ifndef _UNICODE
-  bool Open(LPCWSTR fileName, DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes);
-  bool Open(LPCWSTR fileName, DWORD creationDisposition);
-  bool Create(LPCWSTR fileName, bool createAlways);
-  #endif
-
-  /*
-  void SetOpenCreationDisposition(DWORD creationDisposition)
-    { m_CreationDisposition = creationDisposition; }
-  void SetOpenCreationDispositionCreateAlways()
-    { m_CreationDisposition = CREATE_ALWAYS; }
-  */
-
-  bool SetTime(const FILETIME *cTime, const FILETIME *aTime, const FILETIME *mTime);
-  bool SetMTime(const FILETIME *mTime);
-  bool WritePart(const void *data, UInt32 size, UInt32 &processedSize);
-  bool Write(const void *data, UInt32 size, UInt32 &processedSize);
-  bool SetEndOfFile();
-  bool SetLength(UInt64 length);
-};
-
-}}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/FileMapping.cpp b/third_party/lzma/v4_65/files/CPP/Windows/FileMapping.cpp
deleted file mode 100644
index d884afb..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/FileMapping.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// Windows/FileMapping.cpp
-
-#include "StdAfx.h"
-
-#include "Windows/FileMapping.h"
-
-namespace NWindows {
-namespace NFile {
-namespace NMapping {
-
-
-
-
-}}}
\ No newline at end of file
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/FileMapping.h b/third_party/lzma/v4_65/files/CPP/Windows/FileMapping.h
deleted file mode 100644
index 25f5a51..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/FileMapping.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// Windows/FileMapping.h
-
-#ifndef __WINDOWS_FILEMAPPING_H
-#define __WINDOWS_FILEMAPPING_H
-
-#include "Windows/Handle.h"
-#include "Windows/Defs.h"
-
-namespace NWindows {
-// namespace NFile {
-// namespace NMapping {
-
-class CFileMapping: public CHandle
-{
-public:
-  bool Create(HANDLE file, LPSECURITY_ATTRIBUTES attributes,
-    DWORD protect, UINT64 maximumSize, LPCTSTR name)
-  {
-    _handle = ::CreateFileMapping(file, attributes,
-      protect, DWORD(maximumSize >> 32), DWORD(maximumSize), name);
-    return (_handle != NULL);
-  }
-
-  bool Open(DWORD desiredAccess, bool inheritHandle, LPCTSTR name)
-  {
-    _handle = ::OpenFileMapping(desiredAccess, BoolToBOOL(inheritHandle), name);
-    return (_handle != NULL);
-  }
-
-  LPVOID MapViewOfFile(DWORD desiredAccess, UINT64 fileOffset,
-      SIZE_T numberOfBytesToMap)
-  {
-    return ::MapViewOfFile(_handle, desiredAccess,
-        DWORD(fileOffset >> 32), DWORD(fileOffset), numberOfBytesToMap);
-  }
-
-  LPVOID MapViewOfFileEx(DWORD desiredAccess, UINT64 fileOffset,
-      SIZE_T numberOfBytesToMap, LPVOID baseAddress)
-  {
-    return ::MapViewOfFileEx(_handle, desiredAccess,
-      DWORD(fileOffset >> 32), DWORD(fileOffset),
-      numberOfBytesToMap, baseAddress);
-  }
-  
-
-};
-
-}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/FileName.cpp b/third_party/lzma/v4_65/files/CPP/Windows/FileName.cpp
deleted file mode 100644
index 8443a4a..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/FileName.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// Windows/FileName.cpp
-
-#include "StdAfx.h"
-
-#include "Windows/FileName.h"
-#include "Common/Wildcard.h"
-
-namespace NWindows {
-namespace NFile {
-namespace NName {
-
-void NormalizeDirPathPrefix(CSysString &dirPath)
-{
-  if (dirPath.IsEmpty())
-    return;
-  if (dirPath.ReverseFind(kDirDelimiter) != dirPath.Length() - 1)
-    dirPath += kDirDelimiter;
-}
-
-#ifndef _UNICODE
-void NormalizeDirPathPrefix(UString &dirPath)
-{
-  if (dirPath.IsEmpty())
-    return;
-  if (dirPath.ReverseFind(wchar_t(kDirDelimiter)) != dirPath.Length() - 1)
-    dirPath += wchar_t(kDirDelimiter);
-}
-#endif
-
-const wchar_t kExtensionDelimiter = L'.';
-
-void SplitNameToPureNameAndExtension(const UString &fullName,
-    UString &pureName, UString &extensionDelimiter, UString &extension)
-{
-  int index = fullName.ReverseFind(kExtensionDelimiter);
-  if (index < 0)
-  {
-    pureName = fullName;
-    extensionDelimiter.Empty();
-    extension.Empty();
-  }
-  else
-  {
-    pureName = fullName.Left(index);
-    extensionDelimiter = kExtensionDelimiter;
-    extension = fullName.Mid(index + 1);
-  }
-}
-
-}}}
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/FileName.h b/third_party/lzma/v4_65/files/CPP/Windows/FileName.h
deleted file mode 100644
index 20786e0..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/FileName.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Windows/FileName.h
-
-#ifndef __WINDOWS_FILENAME_H
-#define __WINDOWS_FILENAME_H
-
-#include "../Common/MyString.h"
-
-namespace NWindows {
-namespace NFile {
-namespace NName {
-
-const TCHAR kDirDelimiter = CHAR_PATH_SEPARATOR;
-const TCHAR kAnyStringWildcard = '*';
-
-void NormalizeDirPathPrefix(CSysString &dirPath); // ensures that it ended with '\\'
-#ifndef _UNICODE
-void NormalizeDirPathPrefix(UString &dirPath); // ensures that it ended with '\\'
-#endif
-
-void SplitNameToPureNameAndExtension(const UString &fullName,
-    UString &pureName, UString &extensionDelimiter, UString &extension);
-
-}}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/Handle.h b/third_party/lzma/v4_65/files/CPP/Windows/Handle.h
deleted file mode 100644
index 0791b4a..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/Handle.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Windows/Handle.h
-
-#ifndef __WINDOWS_HANDLE_H
-#define __WINDOWS_HANDLE_H
-
-namespace NWindows {
-
-class CHandle
-{
-protected:
-  HANDLE _handle;
-public:
-  operator HANDLE() { return _handle; }
-  CHandle(): _handle(NULL) {}
-  ~CHandle() { Close(); }
-  bool Close()
-  {
-    if (_handle == NULL)
-      return true;
-    if (!::CloseHandle(_handle))
-      return false;
-    _handle = NULL;
-    return true;
-  }
-  void Attach(HANDLE handle)
-    { _handle = handle; }
-  HANDLE Detach()
-  {
-    HANDLE handle = _handle;
-    _handle = NULL;
-    return handle;
-  }
-};
-
-}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/MemoryLock.cpp b/third_party/lzma/v4_65/files/CPP/Windows/MemoryLock.cpp
deleted file mode 100644
index 284c832..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/MemoryLock.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-// Common/MemoryLock.cpp
-
-#include "StdAfx.h"
-
-namespace NWindows {
-namespace NSecurity {
-
-#ifndef _UNICODE
-typedef BOOL (WINAPI * OpenProcessTokenP)(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle);
-typedef BOOL (WINAPI * LookupPrivilegeValueP)(LPCTSTR lpSystemName, LPCTSTR lpName, PLUID  lpLuid);
-typedef BOOL (WINAPI * AdjustTokenPrivilegesP)(HANDLE TokenHandle, BOOL DisableAllPrivileges,
-    PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState,PDWORD ReturnLength);
-#endif
-
-#ifdef _UNICODE
-bool EnableLockMemoryPrivilege(
-#else
-static bool EnableLockMemoryPrivilege2(HMODULE hModule,
-#endif
-bool enable)
-{
-  #ifndef _UNICODE
-  if (hModule == NULL)
-    return false;
-  OpenProcessTokenP openProcessToken = (OpenProcessTokenP)GetProcAddress(hModule, "OpenProcessToken");
-  LookupPrivilegeValueP lookupPrivilegeValue = (LookupPrivilegeValueP)GetProcAddress(hModule, "LookupPrivilegeValueA" );
-  AdjustTokenPrivilegesP adjustTokenPrivileges = (AdjustTokenPrivilegesP)GetProcAddress(hModule, "AdjustTokenPrivileges");
-  if (openProcessToken == NULL || adjustTokenPrivileges == NULL || lookupPrivilegeValue == NULL)
-    return false;
-  #endif
-
-  HANDLE token;
-  if (!
-    #ifdef _UNICODE
-    ::OpenProcessToken
-    #else
-    openProcessToken
-    #endif
-    (::GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &token))
-    return false;
-  TOKEN_PRIVILEGES tp;
-  bool res = false;
-  if (
-    #ifdef _UNICODE
-    ::LookupPrivilegeValue
-    #else
-    lookupPrivilegeValue
-    #endif
-    (NULL, SE_LOCK_MEMORY_NAME, &(tp.Privileges[0].Luid)))
-  {
-    tp.PrivilegeCount = 1;
-    tp.Privileges[0].Attributes = enable ? SE_PRIVILEGE_ENABLED: 0;
-    if (
-      #ifdef _UNICODE
-      ::AdjustTokenPrivileges
-      #else
-      adjustTokenPrivileges
-      #endif
-      (token, FALSE, &tp, 0, NULL, NULL))
-      res = (GetLastError() == ERROR_SUCCESS);
-  }
-  ::CloseHandle(token);
-  return res;
-}
-
-#ifndef _UNICODE
-bool EnableLockMemoryPrivilege(bool enable)
-{
-  HMODULE hModule = LoadLibrary(TEXT("Advapi32.dll"));
-  if (hModule == NULL)
-    return false;
-  bool res = EnableLockMemoryPrivilege2(hModule, enable);
-  ::FreeLibrary(hModule);
-  return res;
-}
-#endif
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/MemoryLock.h b/third_party/lzma/v4_65/files/CPP/Windows/MemoryLock.h
deleted file mode 100644
index 321024b..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/MemoryLock.h
+++ /dev/null
@@ -1,13 +0,0 @@
-// Windows/MemoryLock.h
-
-#ifndef __WINDOWS_MEMORYLOCK_H
-#define __WINDOWS_MEMORYLOCK_H
-
-namespace NWindows {
-namespace NSecurity {
-
-bool EnableLockMemoryPrivilege(bool enable = true);
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/PropVariant.cpp b/third_party/lzma/v4_65/files/CPP/Windows/PropVariant.cpp
deleted file mode 100644
index ae2e6cd..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/PropVariant.cpp
+++ /dev/null
@@ -1,312 +0,0 @@
-// Windows/PropVariant.cpp
-
-#include "StdAfx.h"
-
-#include "PropVariant.h"
-
-#include "../Common/Defs.h"
-
-namespace NWindows {
-namespace NCOM {
-
-CPropVariant::CPropVariant(const PROPVARIANT& varSrc)
-{
-  vt = VT_EMPTY;
-  InternalCopy(&varSrc);
-}
-
-CPropVariant::CPropVariant(const CPropVariant& varSrc)
-{
-  vt = VT_EMPTY;
-  InternalCopy(&varSrc);
-}
-
-CPropVariant::CPropVariant(BSTR bstrSrc)
-{
-  vt = VT_EMPTY;
-  *this = bstrSrc;
-}
-
-CPropVariant::CPropVariant(LPCOLESTR lpszSrc)
-{
-  vt = VT_EMPTY;
-  *this = lpszSrc;
-}
-
-CPropVariant& CPropVariant::operator=(const CPropVariant& varSrc)
-{
-  InternalCopy(&varSrc);
-  return *this;
-}
-CPropVariant& CPropVariant::operator=(const PROPVARIANT& varSrc)
-{
-  InternalCopy(&varSrc);
-  return *this;
-}
-
-CPropVariant& CPropVariant::operator=(BSTR bstrSrc)
-{
-  *this = (LPCOLESTR)bstrSrc;
-  return *this;
-}
-
-CPropVariant& CPropVariant::operator=(LPCOLESTR lpszSrc)
-{
-  InternalClear();
-  vt = VT_BSTR;
-  wReserved1 = 0;
-  bstrVal = ::SysAllocString(lpszSrc);
-  if (bstrVal == NULL && lpszSrc != NULL)
-  {
-    vt = VT_ERROR;
-    scode = E_OUTOFMEMORY;
-  }
-  return *this;
-}
-
-
-CPropVariant& CPropVariant::operator=(bool bSrc)
-{
-  if (vt != VT_BOOL)
-  {
-    InternalClear();
-    vt = VT_BOOL;
-  }
-  boolVal = bSrc ? VARIANT_TRUE : VARIANT_FALSE;
-  return *this;
-}
-
-CPropVariant& CPropVariant::operator=(UInt32 value)
-{
-  if (vt != VT_UI4)
-  {
-    InternalClear();
-    vt = VT_UI4;
-  }
-  ulVal = value;
-  return *this;
-}
-
-CPropVariant& CPropVariant::operator=(UInt64 value)
-{
-  if (vt != VT_UI8)
-  {
-    InternalClear();
-    vt = VT_UI8;
-  }
-  uhVal.QuadPart = value;
-  return *this;
-}
-
-CPropVariant& CPropVariant::operator=(const FILETIME &value)
-{
-  if (vt != VT_FILETIME)
-  {
-    InternalClear();
-    vt = VT_FILETIME;
-  }
-  filetime = value;
-  return *this;
-}
-
-CPropVariant& CPropVariant::operator=(Int32 value)
-{
-  if (vt != VT_I4)
-  {
-    InternalClear();
-    vt = VT_I4;
-  }
-  lVal = value;
-  
-  return *this;
-}
-
-CPropVariant& CPropVariant::operator=(Byte value)
-{
-  if (vt != VT_UI1)
-  {
-    InternalClear();
-    vt = VT_UI1;
-  }
-  bVal = value;
-  return *this;
-}
-
-CPropVariant& CPropVariant::operator=(Int16 value)
-{
-  if (vt != VT_I2)
-  {
-    InternalClear();
-    vt = VT_I2;
-  }
-  iVal = value;
-  return *this;
-}
-
-/*
-CPropVariant& CPropVariant::operator=(LONG value)
-{
-  if (vt != VT_I4)
-  {
-    InternalClear();
-    vt = VT_I4;
-  }
-  lVal = value;
-  return *this;
-}
-*/
-
-static HRESULT MyPropVariantClear(PROPVARIANT *propVariant)
-{
-  switch(propVariant->vt)
-  {
-    case VT_UI1:
-    case VT_I1:
-    case VT_I2:
-    case VT_UI2:
-    case VT_BOOL:
-    case VT_I4:
-    case VT_UI4:
-    case VT_R4:
-    case VT_INT:
-    case VT_UINT:
-    case VT_ERROR:
-    case VT_FILETIME:
-    case VT_UI8:
-    case VT_R8:
-    case VT_CY:
-    case VT_DATE:
-      propVariant->vt = VT_EMPTY;
-      propVariant->wReserved1 = 0;
-      return S_OK;
-  }
-  return ::VariantClear((VARIANTARG *)propVariant);
-}
-
-HRESULT CPropVariant::Clear()
-{
-  return MyPropVariantClear(this);
-}
-
-HRESULT CPropVariant::Copy(const PROPVARIANT* pSrc)
-{
-  ::VariantClear((tagVARIANT *)this);
-  switch(pSrc->vt)
-  {
-    case VT_UI1:
-    case VT_I1:
-    case VT_I2:
-    case VT_UI2:
-    case VT_BOOL:
-    case VT_I4:
-    case VT_UI4:
-    case VT_R4:
-    case VT_INT:
-    case VT_UINT:
-    case VT_ERROR:
-    case VT_FILETIME:
-    case VT_UI8:
-    case VT_R8:
-    case VT_CY:
-    case VT_DATE:
-      memmove((PROPVARIANT*)this, pSrc, sizeof(PROPVARIANT));
-      return S_OK;
-  }
-  return ::VariantCopy((tagVARIANT *)this, (tagVARIANT *)(pSrc));
-}
-
-
-HRESULT CPropVariant::Attach(PROPVARIANT* pSrc)
-{
-  HRESULT hr = Clear();
-  if (FAILED(hr))
-    return hr;
-  memcpy(this, pSrc, sizeof(PROPVARIANT));
-  pSrc->vt = VT_EMPTY;
-  return S_OK;
-}
-
-HRESULT CPropVariant::Detach(PROPVARIANT* pDest)
-{
-  HRESULT hr = MyPropVariantClear(pDest);
-  if (FAILED(hr))
-    return hr;
-  memcpy(pDest, this, sizeof(PROPVARIANT));
-  vt = VT_EMPTY;
-  return S_OK;
-}
-
-HRESULT CPropVariant::InternalClear()
-{
-  HRESULT hr = Clear();
-  if (FAILED(hr))
-  {
-    vt = VT_ERROR;
-    scode = hr;
-  }
-  return hr;
-}
-
-void CPropVariant::InternalCopy(const PROPVARIANT* pSrc)
-{
-  HRESULT hr = Copy(pSrc);
-  if (FAILED(hr))
-  {
-    vt = VT_ERROR;
-    scode = hr;
-  }
-}
-
-int CPropVariant::Compare(const CPropVariant &a)
-{
-  if (vt != a.vt)
-    return 0; // it's mean some bug
-  switch (vt)
-  {
-    case VT_EMPTY:
-      return 0;
-    
-    /*
-    case VT_I1:
-      return MyCompare(cVal, a.cVal);
-    */
-    case VT_UI1:
-      return MyCompare(bVal, a.bVal);
-
-    case VT_I2:
-      return MyCompare(iVal, a.iVal);
-    case VT_UI2:
-      return MyCompare(uiVal, a.uiVal);
-    
-    case VT_I4:
-      return MyCompare(lVal, a.lVal);
-    /*
-    case VT_INT:
-      return MyCompare(intVal, a.intVal);
-    */
-    case VT_UI4:
-      return MyCompare(ulVal, a.ulVal);
-    /*
-    case VT_UINT:
-      return MyCompare(uintVal, a.uintVal);
-    */
-    case VT_I8:
-      return MyCompare(hVal.QuadPart, a.hVal.QuadPart);
-    case VT_UI8:
-      return MyCompare(uhVal.QuadPart, a.uhVal.QuadPart);
-
-    case VT_BOOL:
-      return -MyCompare(boolVal, a.boolVal);
-
-    case VT_FILETIME:
-      return ::CompareFileTime(&filetime, &a.filetime);
-    case VT_BSTR:
-      return 0; // Not implemented
-      // return MyCompare(aPropVarint.cVal);
-
-    default:
-      return 0;
-  }
-}
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/PropVariant.h b/third_party/lzma/v4_65/files/CPP/Windows/PropVariant.h
deleted file mode 100644
index d44215f..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/PropVariant.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Windows/PropVariant.h
-
-#ifndef __WINDOWS_PROPVARIANT_H
-#define __WINDOWS_PROPVARIANT_H
-
-#include "../Common/MyWindows.h"
-#include "../Common/Types.h"
-
-namespace NWindows {
-namespace NCOM {
-
-class CPropVariant : public tagPROPVARIANT
-{
-public:
-  CPropVariant() { vt = VT_EMPTY; wReserved1 = 0; }
-  ~CPropVariant() { Clear(); }
-  CPropVariant(const PROPVARIANT& varSrc);
-  CPropVariant(const CPropVariant& varSrc);
-  CPropVariant(BSTR bstrSrc);
-  CPropVariant(LPCOLESTR lpszSrc);
-  CPropVariant(bool bSrc) { vt = VT_BOOL; wReserved1 = 0; boolVal = (bSrc ? VARIANT_TRUE : VARIANT_FALSE); };
-  CPropVariant(UInt32 value) { vt = VT_UI4; wReserved1 = 0; ulVal = value; }
-  CPropVariant(UInt64 value) { vt = VT_UI8; wReserved1 = 0; uhVal = *(ULARGE_INTEGER*)&value; }
-  CPropVariant(const FILETIME &value) { vt = VT_FILETIME; wReserved1 = 0; filetime = value; }
-  CPropVariant(Int32 value) { vt = VT_I4; wReserved1 = 0; lVal = value; }
-  CPropVariant(Byte value) { vt = VT_UI1; wReserved1 = 0; bVal = value; }
-  CPropVariant(Int16 value) { vt = VT_I2; wReserved1 = 0; iVal = value; }
-  // CPropVariant(LONG value, VARTYPE vtSrc = VT_I4) { vt = vtSrc; lVal = value; }
-
-  CPropVariant& operator=(const CPropVariant& varSrc);
-  CPropVariant& operator=(const PROPVARIANT& varSrc);
-  CPropVariant& operator=(BSTR bstrSrc);
-  CPropVariant& operator=(LPCOLESTR lpszSrc);
-  CPropVariant& operator=(bool bSrc);
-  CPropVariant& operator=(UInt32 value);
-  CPropVariant& operator=(UInt64 value);
-  CPropVariant& operator=(const FILETIME &value);
-
-  CPropVariant& operator=(Int32 value);
-  CPropVariant& operator=(Byte value);
-  CPropVariant& operator=(Int16 value);
-  // CPropVariant& operator=(LONG  value);
-
-  HRESULT Clear();
-  HRESULT Copy(const PROPVARIANT* pSrc);
-  HRESULT Attach(PROPVARIANT* pSrc);
-  HRESULT Detach(PROPVARIANT* pDest);
-
-  HRESULT InternalClear();
-  void InternalCopy(const PROPVARIANT* pSrc);
-
-  int Compare(const CPropVariant &a1);
-};
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/PropVariantConversions.cpp b/third_party/lzma/v4_65/files/CPP/Windows/PropVariantConversions.cpp
deleted file mode 100644
index df8abfb..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/PropVariantConversions.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-// PropVariantConversions.cpp
-
-#include "StdAfx.h"
-
-#include "PropVariantConversions.h"
-
-#include "Windows/Defs.h"
-
-#include "Common/StringConvert.h"
-#include "Common/IntToString.h"
-
-static UString ConvertUInt64ToString(UInt64 value)
-{
-  wchar_t buffer[32];
-  ConvertUInt64ToString(value, buffer);
-  return buffer;
-}
-
-static UString ConvertInt64ToString(Int64 value)
-{
-  wchar_t buffer[32];
-  ConvertInt64ToString(value, buffer);
-  return buffer;
-}
-
-static char *UIntToStringSpec(char c, UInt32 value, char *s, int numPos)
-{
-  if (c != 0)
-    *s++ = c;
-  char temp[16];
-  int pos = 0;
-  do
-  {
-    temp[pos++] = (char)('0' + value % 10);
-    value /= 10;
-  }
-  while (value != 0);
-  int i;
-  for (i = 0; i < numPos - pos; i++)
-    *s++ = '0';
-  do
-    *s++ = temp[--pos];
-  while (pos > 0);
-  *s = '\0';
-  return s;
-}
-
-bool ConvertFileTimeToString(const FILETIME &ft, char *s, bool includeTime, bool includeSeconds)
-{
-  s[0] = '\0';
-  SYSTEMTIME st;
-  if (!BOOLToBool(FileTimeToSystemTime(&ft, &st)))
-    return false;
-  s = UIntToStringSpec(0, st.wYear, s, 4);
-  s = UIntToStringSpec('-', st.wMonth, s, 2);
-  s = UIntToStringSpec('-', st.wDay, s, 2);
-  if (includeTime)
-  {
-    s = UIntToStringSpec(' ', st.wHour, s, 2);
-    s = UIntToStringSpec(':', st.wMinute, s, 2);
-    if (includeSeconds)
-      UIntToStringSpec(':', st.wSecond, s, 2);
-  }
-  return true;
-}
-
-UString ConvertFileTimeToString(const FILETIME &fileTime, bool includeTime, bool includeSeconds)
-{
-  char s[32];
-  ConvertFileTimeToString(fileTime, s,  includeTime, includeSeconds);
-  return GetUnicodeString(s);
-}
- 
-
-UString ConvertPropVariantToString(const PROPVARIANT &prop)
-{
-  switch (prop.vt)
-  {
-    case VT_EMPTY: return UString();
-    case VT_BSTR: return prop.bstrVal;
-    case VT_UI1: return ConvertUInt64ToString(prop.bVal);
-    case VT_UI2: return ConvertUInt64ToString(prop.uiVal);
-    case VT_UI4: return ConvertUInt64ToString(prop.ulVal);
-    case VT_UI8: return ConvertUInt64ToString(prop.uhVal.QuadPart);
-    case VT_FILETIME: return ConvertFileTimeToString(prop.filetime, true, true);
-    // case VT_I1: return ConvertInt64ToString(prop.cVal);
-    case VT_I2: return ConvertInt64ToString(prop.iVal);
-    case VT_I4: return ConvertInt64ToString(prop.lVal);
-    case VT_I8: return ConvertInt64ToString(prop.hVal.QuadPart);
-    case VT_BOOL: return VARIANT_BOOLToBool(prop.boolVal) ? L"+" : L"-";
-    default:
-      #ifndef _WIN32_WCE
-      throw 150245;
-      #else
-      return UString();
-      #endif
-  }
-}
-
-UInt64 ConvertPropVariantToUInt64(const PROPVARIANT &prop)
-{
-  switch (prop.vt)
-  {
-    case VT_UI1: return prop.bVal;
-    case VT_UI2: return prop.uiVal;
-    case VT_UI4: return prop.ulVal;
-    case VT_UI8: return (UInt64)prop.uhVal.QuadPart;
-    default:
-      #ifndef _WIN32_WCE
-      throw 151199;
-      #else
-      return 0;
-      #endif
-  }
-}
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/PropVariantConversions.h b/third_party/lzma/v4_65/files/CPP/Windows/PropVariantConversions.h
deleted file mode 100644
index 68ad961..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/PropVariantConversions.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// Windows/PropVariantConversions.h
-
-#ifndef __PROPVARIANTCONVERSIONS_H
-#define __PROPVARIANTCONVERSIONS_H
-
-#include "Common/Types.h"
-#include "Common/MyString.h"
-
-bool ConvertFileTimeToString(const FILETIME &ft, char *s, bool includeTime = true, bool includeSeconds = true);
-UString ConvertFileTimeToString(const FILETIME &ft, bool includeTime = true, bool includeSeconds = true);
-UString ConvertPropVariantToString(const PROPVARIANT &propVariant);
-UInt64 ConvertPropVariantToUInt64(const PROPVARIANT &propVariant);
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/StdAfx.h b/third_party/lzma/v4_65/files/CPP/Windows/StdAfx.h
deleted file mode 100644
index 8b383c5..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/StdAfx.h
+++ /dev/null
@@ -1,9 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../Common/MyWindows.h"
-#include "../Common/NewHandler.h"
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/Synchronization.cpp b/third_party/lzma/v4_65/files/CPP/Windows/Synchronization.cpp
deleted file mode 100644
index 5f86d1e..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/Synchronization.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-// Windows/Synchronization.cpp
-
-#include "StdAfx.h"
-
-#include "Synchronization.h"
-
-namespace NWindows {
-namespace NSynchronization {
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/Synchronization.h b/third_party/lzma/v4_65/files/CPP/Windows/Synchronization.h
deleted file mode 100644
index 8d34ae9..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/Synchronization.h
+++ /dev/null
@@ -1,168 +0,0 @@
-// Windows/Synchronization.h
-
-#ifndef __WINDOWS_SYNCHRONIZATION_H
-#define __WINDOWS_SYNCHRONIZATION_H
-
-#include "Defs.h"
-
-extern "C"
-{
-#include "../../C/Threads.h"
-}
-
-#ifdef _WIN32
-#include "Handle.h"
-#endif
-
-namespace NWindows {
-namespace NSynchronization {
-
-class CBaseEvent
-{
-protected:
-  ::CEvent _object;
-public:
-  bool IsCreated() { return Event_IsCreated(&_object) != 0; }
-  operator HANDLE() { return _object.handle; }
-  CBaseEvent() { Event_Construct(&_object); }
-  ~CBaseEvent() { Close(); }
-  WRes Close() { return Event_Close(&_object); }
-  #ifdef _WIN32
-  WRes Create(bool manualReset, bool initiallyOwn, LPCTSTR name = NULL,
-      LPSECURITY_ATTRIBUTES securityAttributes = NULL)
-  {
-    _object.handle = ::CreateEvent(securityAttributes, BoolToBOOL(manualReset),
-        BoolToBOOL(initiallyOwn), name);
-    if (_object.handle != 0)
-      return 0;
-    return ::GetLastError();
-  }
-  WRes Open(DWORD desiredAccess, bool inheritHandle, LPCTSTR name)
-  {
-    _object.handle = ::OpenEvent(desiredAccess, BoolToBOOL(inheritHandle), name);
-    if (_object.handle != 0)
-      return 0;
-    return ::GetLastError();
-  }
-  #endif
-
-  WRes Set() { return Event_Set(&_object); }
-  // bool Pulse() { return BOOLToBool(::PulseEvent(_handle)); }
-  WRes Reset() { return Event_Reset(&_object); }
-  WRes Lock() { return Event_Wait(&_object); }
-};
-
-class CManualResetEvent: public CBaseEvent
-{
-public:
-  WRes Create(bool initiallyOwn = false)
-  {
-    return ManualResetEvent_Create(&_object, initiallyOwn ? 1: 0);
-  }
-  WRes CreateIfNotCreated()
-  {
-    if (IsCreated())
-      return 0;
-    return ManualResetEvent_CreateNotSignaled(&_object);
-  }
-  #ifdef _WIN32
-  WRes CreateWithName(bool initiallyOwn, LPCTSTR name)
-  {
-    return CBaseEvent::Create(true, initiallyOwn, name);
-  }
-  #endif
-};
-
-class CAutoResetEvent: public CBaseEvent
-{
-public:
-  WRes Create()
-  {
-    return AutoResetEvent_CreateNotSignaled(&_object);
-  }
-  WRes CreateIfNotCreated()
-  {
-    if (IsCreated())
-      return 0;
-    return AutoResetEvent_CreateNotSignaled(&_object);
-  }
-};
-
-#ifdef _WIN32
-class CObject: public CHandle
-{
-public:
-  WRes Lock(DWORD timeoutInterval = INFINITE)
-    { return (::WaitForSingleObject(_handle, timeoutInterval) == WAIT_OBJECT_0 ? 0 : ::GetLastError()); }
-};
-class CMutex: public CObject
-{
-public:
-  WRes Create(bool initiallyOwn, LPCTSTR name = NULL,
-      LPSECURITY_ATTRIBUTES securityAttributes = NULL)
-  {
-    _handle = ::CreateMutex(securityAttributes, BoolToBOOL(initiallyOwn), name);
-    if (_handle != 0)
-      return 0;
-    return ::GetLastError();
-  }
-  WRes Open(DWORD desiredAccess, bool inheritHandle, LPCTSTR name)
-  {
-    _handle = ::OpenMutex(desiredAccess, BoolToBOOL(inheritHandle), name);
-    if (_handle != 0)
-      return 0;
-    return ::GetLastError();
-  }
-  WRes Release()
-  {
-    return ::ReleaseMutex(_handle) ? 0 : ::GetLastError();
-  }
-};
-class CMutexLock
-{
-  CMutex *_object;
-public:
-  CMutexLock(CMutex &object): _object(&object) { _object->Lock(); }
-  ~CMutexLock() { _object->Release(); }
-};
-#endif
-
-class CSemaphore
-{
-  ::CSemaphore _object;
-public:
-  CSemaphore() { Semaphore_Construct(&_object); }
-  ~CSemaphore() { Close(); }
-  WRes Close() {  return Semaphore_Close(&_object); }
-  operator HANDLE() { return _object.handle; }
-  WRes Create(UInt32 initiallyCount, UInt32 maxCount)
-  {
-    return Semaphore_Create(&_object, initiallyCount, maxCount);
-  }
-  WRes Release() { return Semaphore_Release1(&_object); }
-  WRes Release(UInt32 releaseCount) { return Semaphore_ReleaseN(&_object, releaseCount); }
-  WRes Lock() { return Semaphore_Wait(&_object); }
-};
-
-class CCriticalSection
-{
-  ::CCriticalSection _object;
-public:
-  CCriticalSection() { CriticalSection_Init(&_object); }
-  ~CCriticalSection() { CriticalSection_Delete(&_object); }
-  void Enter() { CriticalSection_Enter(&_object); }
-  void Leave() { CriticalSection_Leave(&_object); }
-};
-
-class CCriticalSectionLock
-{
-  CCriticalSection *_object;
-  void Unlock()  { _object->Leave(); }
-public:
-  CCriticalSectionLock(CCriticalSection &object): _object(&object) {_object->Enter(); }
-  ~CCriticalSectionLock() { Unlock(); }
-};
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/System.cpp b/third_party/lzma/v4_65/files/CPP/Windows/System.cpp
deleted file mode 100644
index 8e4069c..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/System.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-// Windows/System.cpp
-
-#include "StdAfx.h"
-
-#include "System.h"
-
-namespace NWindows {
-namespace NSystem {
-
-UInt32 GetNumberOfProcessors()
-{
-  SYSTEM_INFO systemInfo;
-  GetSystemInfo(&systemInfo);
-  return (UInt32)systemInfo.dwNumberOfProcessors;
-}
-
-#if !defined(_WIN64) && defined(__GNUC__)
-
-typedef struct _MY_MEMORYSTATUSEX {
-  DWORD dwLength;
-  DWORD dwMemoryLoad;
-  DWORDLONG ullTotalPhys;
-  DWORDLONG ullAvailPhys;
-  DWORDLONG ullTotalPageFile;
-  DWORDLONG ullAvailPageFile;
-  DWORDLONG ullTotalVirtual;
-  DWORDLONG ullAvailVirtual;
-  DWORDLONG ullAvailExtendedVirtual;
-} MY_MEMORYSTATUSEX, *MY_LPMEMORYSTATUSEX;
-
-#else
-
-#define MY_MEMORYSTATUSEX MEMORYSTATUSEX
-#define MY_LPMEMORYSTATUSEX LPMEMORYSTATUSEX
-
-#endif
-
-typedef BOOL (WINAPI *GlobalMemoryStatusExP)(MY_LPMEMORYSTATUSEX lpBuffer);
-
-UInt64 GetRamSize()
-{
-  MY_MEMORYSTATUSEX stat;
-  stat.dwLength = sizeof(stat);
-  #ifdef _WIN64
-  if (!::GlobalMemoryStatusEx(&stat))
-    return 0;
-  return stat.ullTotalPhys;
-  #else
-  GlobalMemoryStatusExP globalMemoryStatusEx = (GlobalMemoryStatusExP)
-        ::GetProcAddress(::GetModuleHandle(TEXT("kernel32.dll")),
-        "GlobalMemoryStatusEx");
-  if (globalMemoryStatusEx != 0)
-    if (globalMemoryStatusEx(&stat))
-      return stat.ullTotalPhys;
-  {
-    MEMORYSTATUS stat;
-    stat.dwLength = sizeof(stat);
-    GlobalMemoryStatus(&stat);
-    return stat.dwTotalPhys;
-  }
-  #endif
-}
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/System.h b/third_party/lzma/v4_65/files/CPP/Windows/System.h
deleted file mode 100644
index e006715..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/System.h
+++ /dev/null
@@ -1,16 +0,0 @@
-// Windows/System.h
-
-#ifndef __WINDOWS_SYSTEM_H
-#define __WINDOWS_SYSTEM_H
-
-#include "../Common/Types.h"
-
-namespace NWindows {
-namespace NSystem {
-
-UInt32 GetNumberOfProcessors();
-UInt64 GetRamSize();
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/Thread.h b/third_party/lzma/v4_65/files/CPP/Windows/Thread.h
deleted file mode 100644
index 39104f4..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/Thread.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Windows/Thread.h
-
-#ifndef __WINDOWS_THREAD_H
-#define __WINDOWS_THREAD_H
-
-#include "Defs.h"
-
-extern "C"
-{
-#include "../../C/Threads.h"
-}
-
-namespace NWindows {
-
-class CThread
-{
-  ::CThread thread;
-public:
-  CThread() { Thread_Construct(&thread); }
-  ~CThread() { Close(); }
-  bool IsCreated() { return Thread_WasCreated(&thread) != 0; }
-  WRes Close()  { return Thread_Close(&thread); }
-  WRes Create(THREAD_FUNC_RET_TYPE (THREAD_FUNC_CALL_TYPE *startAddress)(void *), LPVOID parameter)
-    { return Thread_Create(&thread, startAddress, parameter); }
-  WRes Wait() { return Thread_Wait(&thread); }
-  
-  #ifdef _WIN32
-  operator HANDLE() { return thread.handle; }
-  void Attach(HANDLE handle) { thread.handle = handle; }
-  HANDLE Detach() { HANDLE h = thread.handle; thread.handle = NULL; return h; }
-  DWORD Resume() { return ::ResumeThread(thread.handle); }
-  DWORD Suspend() { return ::SuspendThread(thread.handle); }
-  bool Terminate(DWORD exitCode) { return BOOLToBool(::TerminateThread(thread.handle, exitCode)); }
-  int GetPriority() { return ::GetThreadPriority(thread.handle); }
-  bool SetPriority(int priority) { return BOOLToBool(::SetThreadPriority(thread.handle, priority)); }
-  #endif
-};
-
-}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/Time.cpp b/third_party/lzma/v4_65/files/CPP/Windows/Time.cpp
deleted file mode 100644
index 810dcbe..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/Time.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-// Windows/Time.cpp
-
-#include "StdAfx.h"
-
-#include "Time.h"
-#include "Windows/Defs.h"
-
-namespace NWindows {
-namespace NTime {
-
-bool DosTimeToFileTime(UInt32 dosTime, FILETIME &fileTime)
-{
-  return BOOLToBool(::DosDateTimeToFileTime((UInt16)(dosTime >> 16), (UInt16)(dosTime & 0xFFFF), &fileTime));
-}
-
-static const UInt32 kHighDosTime = 0xFF9FBF7D;
-static const UInt32 kLowDosTime = 0x210000;
-
-bool FileTimeToDosTime(const FILETIME &fileTime, UInt32 &dosTime)
-{
-  WORD datePart, timePart;
-  if (!::FileTimeToDosDateTime(&fileTime, &datePart, &timePart))
-  {
-    dosTime = (fileTime.dwHighDateTime >= 0x01C00000) ? kHighDosTime : kLowDosTime;
-    return false;
-  }
-  dosTime = (((UInt32)datePart) << 16) + timePart;
-  return true;
-}
-
-static const UInt32 kNumTimeQuantumsInSecond = 10000000;
-static const UInt64 kUnixTimeStartValue = ((UInt64)kNumTimeQuantumsInSecond) * 60 * 60 * 24 * 134774;
-
-void UnixTimeToFileTime(UInt32 unixTime, FILETIME &fileTime)
-{
-  UInt64 v = kUnixTimeStartValue + ((UInt64)unixTime) * kNumTimeQuantumsInSecond;
-  fileTime.dwLowDateTime = (DWORD)v;
-  fileTime.dwHighDateTime = (DWORD)(v >> 32);
-}
-
-bool FileTimeToUnixTime(const FILETIME &fileTime, UInt32 &unixTime)
-{
-  UInt64 winTime = (((UInt64)fileTime.dwHighDateTime) << 32) + fileTime.dwLowDateTime;
-  if (winTime < kUnixTimeStartValue)
-  {
-    unixTime = 0;
-    return false;
-  }
-  winTime = (winTime - kUnixTimeStartValue) / kNumTimeQuantumsInSecond;
-  if (winTime > 0xFFFFFFFF)
-  {
-    unixTime = 0xFFFFFFFF;
-    return false;
-  }
-  unixTime = (UInt32)winTime;
-  return true;
-}
-
-bool GetSecondsSince1601(unsigned year, unsigned month, unsigned day,
-  unsigned hour, unsigned min, unsigned sec, UInt64 &resSeconds)
-{
-  resSeconds = 0;
-  if (year < 1601 || year >= 10000 || month < 1 || month > 12 ||
-      day < 1 || day > 31 || hour > 23 || min > 59 || sec > 59)
-    return false;
-  UInt32 numYears = year - 1601;
-  UInt32 numDays = numYears * 365 + numYears / 4 - numYears / 100 + numYears / 400;
-  Byte ms[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
-  if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))
-    ms[1] = 29;
-  month--;
-  for (unsigned i = 0; i < month; i++)
-    numDays += ms[i];
-  numDays += day - 1;
-  resSeconds = ((UInt64)(numDays * 24 + hour) * 60 + min) * 60 + sec;
-  return true;
-}
-
-void GetCurUtcFileTime(FILETIME &ft)
-{
-  SYSTEMTIME st;
-  GetSystemTime(&st);
-  SystemTimeToFileTime(&st, &ft);
-}
-
-}}
diff --git a/third_party/lzma/v4_65/files/CPP/Windows/Time.h b/third_party/lzma/v4_65/files/CPP/Windows/Time.h
deleted file mode 100644
index 6f510b2..0000000
--- a/third_party/lzma/v4_65/files/CPP/Windows/Time.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Windows/Time.h
-
-#ifndef __WINDOWS_TIME_H
-#define __WINDOWS_TIME_H
-
-#include "Common/Types.h"
-
-namespace NWindows {
-namespace NTime {
-
-bool DosTimeToFileTime(UInt32 dosTime, FILETIME &fileTime);
-bool FileTimeToDosTime(const FILETIME &fileTime, UInt32 &dosTime);
-void UnixTimeToFileTime(UInt32 unixTime, FILETIME &fileTime);
-bool FileTimeToUnixTime(const FILETIME &fileTime, UInt32 &unixTime);
-bool GetSecondsSince1601(unsigned year, unsigned month, unsigned day,
-  unsigned hour, unsigned min, unsigned sec, UInt64 &resSeconds);
-void GetCurUtcFileTime(FILETIME &ft);
-
-}}
-
-#endif
diff --git a/third_party/lzma/v4_65/files/CS/7zip/Common/CRC.cs b/third_party/lzma/v4_65/files/CS/7zip/Common/CRC.cs
deleted file mode 100644
index 82cc857..0000000
--- a/third_party/lzma/v4_65/files/CS/7zip/Common/CRC.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-// Common/CRC.cs
-
-namespace SevenZip
-{
-	class CRC
-	{
-		public static readonly uint[] Table;
-
-		static CRC()
-		{
-			Table = new uint[256];
-			const uint kPoly = 0xEDB88320;
-			for (uint i = 0; i < 256; i++)
-			{
-				uint r = i;
-				for (int j = 0; j < 8; j++)
-					if ((r & 1) != 0)
-						r = (r >> 1) ^ kPoly;
-					else
-						r >>= 1;
-				Table[i] = r;
-			}
-		}
-
-		uint _value = 0xFFFFFFFF;
-
-		public void Init() { _value = 0xFFFFFFFF; }
-
-		public void UpdateByte(byte b)
-		{
-			_value = Table[(((byte)(_value)) ^ b)] ^ (_value >> 8);
-		}
-
-		public void Update(byte[] data, uint offset, uint size)
-		{
-			for (uint i = 0; i < size; i++)
-				_value = Table[(((byte)(_value)) ^ data[offset + i])] ^ (_value >> 8);
-		}
-
-		public uint GetDigest() { return _value ^ 0xFFFFFFFF; }
-
-		static uint CalculateDigest(byte[] data, uint offset, uint size)
-		{
-			CRC crc = new CRC();
-			// crc.Init();
-			crc.Update(data, offset, size);
-			return crc.GetDigest();
-		}
-
-		static bool VerifyDigest(uint digest, byte[] data, uint offset, uint size)
-		{
-			return (CalculateDigest(data, offset, size) == digest);
-		}
-	}
-}
diff --git a/third_party/lzma/v4_65/files/CS/7zip/Common/CommandLineParser.cs b/third_party/lzma/v4_65/files/CS/7zip/Common/CommandLineParser.cs
deleted file mode 100644
index 8eabf59..0000000
--- a/third_party/lzma/v4_65/files/CS/7zip/Common/CommandLineParser.cs
+++ /dev/null
@@ -1,274 +0,0 @@
-// CommandLineParser.cs
-
-using System;
-using System.Collections;
-
-namespace SevenZip.CommandLineParser
-{
-	public enum SwitchType
-	{
-		Simple,
-		PostMinus,
-		LimitedPostString,
-		UnLimitedPostString,
-		PostChar
-	}
-
-	public class SwitchForm
-	{
-		public string IDString;
-		public SwitchType Type;
-		public bool Multi;
-		public int MinLen;
-		public int MaxLen;
-		public string PostCharSet;
-
-		public SwitchForm(string idString, SwitchType type, bool multi,
-			int minLen, int maxLen, string postCharSet)
-		{
-			IDString = idString;
-			Type = type;
-			Multi = multi;
-			MinLen = minLen;
-			MaxLen = maxLen;
-			PostCharSet = postCharSet;
-		}
-		public SwitchForm(string idString, SwitchType type, bool multi, int minLen):
-			this(idString, type, multi, minLen, 0, "")
-		{
-		}
-		public SwitchForm(string idString, SwitchType type, bool multi):
-			this(idString, type, multi, 0)
-		{
-		}
-	}
-
-	public class SwitchResult
-	{
-		public bool ThereIs;
-		public bool WithMinus;
-		public ArrayList PostStrings = new ArrayList();
-		public int PostCharIndex;
-		public SwitchResult()
-		{
-			ThereIs = false;
-		}
-	}
-
-	public class Parser
-	{
-		public ArrayList NonSwitchStrings = new ArrayList();
-		SwitchResult[] _switches;
-
-		public Parser(int numSwitches)
-		{
-			_switches = new SwitchResult[numSwitches];
-			for (int i = 0; i < numSwitches; i++)
-				_switches[i] = new SwitchResult();
-		}
-
-		bool ParseString(string srcString, SwitchForm[] switchForms)
-		{
-			int len = srcString.Length;
-			if (len == 0)
-				return false;
-			int pos = 0;
-			if (!IsItSwitchChar(srcString[pos]))
-				return false;
-			while (pos < len)
-			{
-				if (IsItSwitchChar(srcString[pos]))
-					pos++;
-				const int kNoLen = -1;
-				int matchedSwitchIndex = 0;
-				int maxLen = kNoLen;
-				for (int switchIndex = 0; switchIndex < _switches.Length; switchIndex++)
-				{
-					int switchLen = switchForms[switchIndex].IDString.Length;
-					if (switchLen <= maxLen || pos + switchLen > len)
-						continue;
-					if (String.Compare(switchForms[switchIndex].IDString, 0,
-							srcString, pos, switchLen, true) == 0)
-					{
-						matchedSwitchIndex = switchIndex;
-						maxLen = switchLen;
-					}
-				}
-				if (maxLen == kNoLen)
-					throw new Exception("maxLen == kNoLen");
-				SwitchResult matchedSwitch = _switches[matchedSwitchIndex];
-				SwitchForm switchForm = switchForms[matchedSwitchIndex];
-				if ((!switchForm.Multi) && matchedSwitch.ThereIs)
-					throw new Exception("switch must be single");
-				matchedSwitch.ThereIs = true;
-				pos += maxLen;
-				int tailSize = len - pos;
-				SwitchType type = switchForm.Type;
-				switch (type)
-				{
-					case SwitchType.PostMinus:
-						{
-							if (tailSize == 0)
-								matchedSwitch.WithMinus = false;
-							else
-							{
-								matchedSwitch.WithMinus = (srcString[pos] == kSwitchMinus);
-								if (matchedSwitch.WithMinus)
-									pos++;
-							}
-							break;
-						}
-					case SwitchType.PostChar:
-						{
-							if (tailSize < switchForm.MinLen)
-								throw new Exception("switch is not full");
-							string charSet = switchForm.PostCharSet;
-							const int kEmptyCharValue = -1;
-							if (tailSize == 0)
-								matchedSwitch.PostCharIndex = kEmptyCharValue;
-							else
-							{
-								int index = charSet.IndexOf(srcString[pos]);
-								if (index < 0)
-									matchedSwitch.PostCharIndex = kEmptyCharValue;
-								else
-								{
-									matchedSwitch.PostCharIndex = index;
-									pos++;
-								}
-							}
-							break;
-						}
-					case SwitchType.LimitedPostString:
-					case SwitchType.UnLimitedPostString:
-						{
-							int minLen = switchForm.MinLen;
-							if (tailSize < minLen)
-								throw new Exception("switch is not full");
-							if (type == SwitchType.UnLimitedPostString)
-							{
-								matchedSwitch.PostStrings.Add(srcString.Substring(pos));
-								return true;
-							}
-							String stringSwitch = srcString.Substring(pos, minLen);
-							pos += minLen;
-							for (int i = minLen; i < switchForm.MaxLen && pos < len; i++, pos++)
-							{
-								char c = srcString[pos];
-								if (IsItSwitchChar(c))
-									break;
-								stringSwitch += c;
-							}
-							matchedSwitch.PostStrings.Add(stringSwitch);
-							break;
-						}
-				}
-			}
-			return true;
-
-		}
-
-		public void ParseStrings(SwitchForm[] switchForms, string[] commandStrings)
-		{
-			int numCommandStrings = commandStrings.Length;
-			bool stopSwitch = false;
-			for (int i = 0; i < numCommandStrings; i++)
-			{
-				string s = commandStrings[i];
-				if (stopSwitch)
-					NonSwitchStrings.Add(s);
-				else
-					if (s == kStopSwitchParsing)
-					stopSwitch = true;
-				else
-					if (!ParseString(s, switchForms))
-					NonSwitchStrings.Add(s);
-			}
-		}
-
-		public SwitchResult this[int index] { get { return _switches[index]; } }
-
-		public static int ParseCommand(CommandForm[] commandForms, string commandString,
-			out string postString)
-		{
-			for (int i = 0; i < commandForms.Length; i++)
-			{
-				string id = commandForms[i].IDString;
-				if (commandForms[i].PostStringMode)
-				{
-					if (commandString.IndexOf(id) == 0)
-					{
-						postString = commandString.Substring(id.Length);
-						return i;
-					}
-				}
-				else
-					if (commandString == id)
-				{
-					postString = "";
-					return i;
-				}
-			}
-			postString = "";
-			return -1;
-		}
-
-		static bool ParseSubCharsCommand(int numForms, CommandSubCharsSet[] forms,
-			string commandString, ArrayList indices)
-		{
-			indices.Clear();
-			int numUsedChars = 0;
-			for (int i = 0; i < numForms; i++)
-			{
-				CommandSubCharsSet charsSet = forms[i];
-				int currentIndex = -1;
-				int len = charsSet.Chars.Length;
-				for (int j = 0; j < len; j++)
-				{
-					char c = charsSet.Chars[j];
-					int newIndex = commandString.IndexOf(c);
-					if (newIndex >= 0)
-					{
-						if (currentIndex >= 0)
-							return false;
-						if (commandString.IndexOf(c, newIndex + 1) >= 0)
-							return false;
-						currentIndex = j;
-						numUsedChars++;
-					}
-				}
-				if (currentIndex == -1 && !charsSet.EmptyAllowed)
-					return false;
-				indices.Add(currentIndex);
-			}
-			return (numUsedChars == commandString.Length);
-		}
-		const char kSwitchID1 = '-';
-		const char kSwitchID2 = '/';
-
-		const char kSwitchMinus = '-';
-		const string kStopSwitchParsing = "--";
-
-		static bool IsItSwitchChar(char c)
-		{
-			return (c == kSwitchID1 || c == kSwitchID2);
-		}
-	}
-
-	public class CommandForm
-	{
-		public string IDString = "";
-		public bool PostStringMode = false;
-		public CommandForm(string idString, bool postStringMode)
-		{
-			IDString = idString;
-			PostStringMode = postStringMode;
-		}
-	}
-
-	class CommandSubCharsSet
-	{
-		public string Chars = "";
-		public bool EmptyAllowed = false;
-	}
-}
diff --git a/third_party/lzma/v4_65/files/CS/7zip/Common/InBuffer.cs b/third_party/lzma/v4_65/files/CS/7zip/Common/InBuffer.cs
deleted file mode 100644
index 7c51f0b..0000000
--- a/third_party/lzma/v4_65/files/CS/7zip/Common/InBuffer.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-// InBuffer.cs
-
-namespace SevenZip.Buffer
-{
-	public class InBuffer
-	{
-		byte[] m_Buffer;
-		uint m_Pos;
-		uint m_Limit;
-		uint m_BufferSize;
-		System.IO.Stream m_Stream;
-		bool m_StreamWasExhausted;
-		ulong m_ProcessedSize;
-
-		public InBuffer(uint bufferSize)
-		{
-			m_Buffer = new byte[bufferSize];
-			m_BufferSize = bufferSize;
-		}
-
-		public void Init(System.IO.Stream stream)
-		{
-			m_Stream = stream;
-			m_ProcessedSize = 0;
-			m_Limit = 0;
-			m_Pos = 0;
-			m_StreamWasExhausted = false;
-		}
-
-		public bool ReadBlock()
-		{
-			if (m_StreamWasExhausted)
-				return false;
-			m_ProcessedSize += m_Pos;
-			int aNumProcessedBytes = m_Stream.Read(m_Buffer, 0, (int)m_BufferSize);
-			m_Pos = 0;
-			m_Limit = (uint)aNumProcessedBytes;
-			m_StreamWasExhausted = (aNumProcessedBytes == 0);
-			return (!m_StreamWasExhausted);
-		}
-
-
-		public void ReleaseStream()
-		{
-			// m_Stream.Close(); 
-			m_Stream = null;
-		}
-
-		public bool ReadByte(byte b) // check it
-		{
-			if (m_Pos >= m_Limit)
-				if (!ReadBlock())
-					return false;
-			b = m_Buffer[m_Pos++];
-			return true;
-		}
-
-		public byte ReadByte()
-		{
-			// return (byte)m_Stream.ReadByte();
-			if (m_Pos >= m_Limit)
-				if (!ReadBlock())
-					return 0xFF;
-			return m_Buffer[m_Pos++];
-		}
-
-		public ulong GetProcessedSize()
-		{
-			return m_ProcessedSize + m_Pos;
-		}
-	}
-}
diff --git a/third_party/lzma/v4_65/files/CS/7zip/Common/OutBuffer.cs b/third_party/lzma/v4_65/files/CS/7zip/Common/OutBuffer.cs
deleted file mode 100644
index 2da16e1..0000000
--- a/third_party/lzma/v4_65/files/CS/7zip/Common/OutBuffer.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-// OutBuffer.cs
-
-namespace SevenZip.Buffer
-{
-	public class OutBuffer
-	{
-		byte[] m_Buffer;
-		uint m_Pos;
-		uint m_BufferSize;
-		System.IO.Stream m_Stream;
-		ulong m_ProcessedSize;
-
-		public OutBuffer(uint bufferSize)
-		{
-			m_Buffer = new byte[bufferSize];
-			m_BufferSize = bufferSize;
-		}
-
-		public void SetStream(System.IO.Stream stream) { m_Stream = stream; }
-		public void FlushStream() { m_Stream.Flush(); }
-		public void CloseStream() { m_Stream.Close(); }
-		public void ReleaseStream() { m_Stream = null; }
-
-		public void Init()
-		{
-			m_ProcessedSize = 0;
-			m_Pos = 0;
-		}
-
-		public void WriteByte(byte b)
-		{
-			m_Buffer[m_Pos++] = b;
-			if (m_Pos >= m_BufferSize)
-				FlushData();
-		}
-
-		public void FlushData()
-		{
-			if (m_Pos == 0)
-				return;
-			m_Stream.Write(m_Buffer, 0, (int)m_Pos);
-			m_Pos = 0;
-		}
-
-		public ulong GetProcessedSize() { return m_ProcessedSize + m_Pos; }
-	}
-}
diff --git a/third_party/lzma/v4_65/files/CS/7zip/Compress/LZ/IMatchFinder.cs b/third_party/lzma/v4_65/files/CS/7zip/Compress/LZ/IMatchFinder.cs
deleted file mode 100644
index 10ca2b3..0000000
--- a/third_party/lzma/v4_65/files/CS/7zip/Compress/LZ/IMatchFinder.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-// IMatchFinder.cs
-
-using System;
-
-namespace SevenZip.Compression.LZ
-{
-	interface IInWindowStream
-	{
-		void SetStream(System.IO.Stream inStream);
-		void Init();
-		void ReleaseStream();
-		Byte GetIndexByte(Int32 index);
-		UInt32 GetMatchLen(Int32 index, UInt32 distance, UInt32 limit);
-		UInt32 GetNumAvailableBytes();
-	}
-
-	interface IMatchFinder : IInWindowStream
-	{
-		void Create(UInt32 historySize, UInt32 keepAddBufferBefore,
-				UInt32 matchMaxLen, UInt32 keepAddBufferAfter);
-		UInt32 GetMatches(UInt32[] distances);
-		void Skip(UInt32 num);
-	}
-}
diff --git a/third_party/lzma/v4_65/files/CS/7zip/Compress/LZ/LzBinTree.cs b/third_party/lzma/v4_65/files/CS/7zip/Compress/LZ/LzBinTree.cs
deleted file mode 100644
index c1c006b..0000000
--- a/third_party/lzma/v4_65/files/CS/7zip/Compress/LZ/LzBinTree.cs
+++ /dev/null
@@ -1,367 +0,0 @@
-// LzBinTree.cs
-
-using System;
-
-namespace SevenZip.Compression.LZ
-{
-	public class BinTree : InWindow, IMatchFinder
-	{
-		UInt32 _cyclicBufferPos;
-		UInt32 _cyclicBufferSize = 0;
-		UInt32 _matchMaxLen;
-
-		UInt32[] _son;
-		UInt32[] _hash;
-
-		UInt32 _cutValue = 0xFF;
-		UInt32 _hashMask;
-		UInt32 _hashSizeSum = 0;
-
-		bool HASH_ARRAY = true;
-
-		const UInt32 kHash2Size = 1 << 10;
-		const UInt32 kHash3Size = 1 << 16;
-		const UInt32 kBT2HashSize = 1 << 16;
-		const UInt32 kStartMaxLen = 1;
-		const UInt32 kHash3Offset = kHash2Size;
-		const UInt32 kEmptyHashValue = 0;
-		const UInt32 kMaxValForNormalize = ((UInt32)1 << 31) - 1;
-	
-		UInt32 kNumHashDirectBytes = 0;
-		UInt32 kMinMatchCheck = 4;
-		UInt32 kFixHashSize = kHash2Size + kHash3Size;
-		
-		public void SetType(int numHashBytes)
-		{
-			HASH_ARRAY = (numHashBytes > 2);
-			if (HASH_ARRAY)
-			{
-				kNumHashDirectBytes = 0;
-				kMinMatchCheck = 4;
-				kFixHashSize = kHash2Size + kHash3Size;
-			}
-			else
-			{
-				kNumHashDirectBytes = 2;
-				kMinMatchCheck = 2 + 1;
-				kFixHashSize = 0;
-			}
-		}
-
-		public new void SetStream(System.IO.Stream stream) { base.SetStream(stream); }
-		public new void ReleaseStream() { base.ReleaseStream(); }
-		
-		public new void Init()
-		{
-			base.Init();
-			for (UInt32 i = 0; i < _hashSizeSum; i++)
-				_hash[i] = kEmptyHashValue;
-			_cyclicBufferPos = 0;
-			ReduceOffsets(-1);
-		}
-
-		public new void MovePos()
-		{
-			if (++_cyclicBufferPos >= _cyclicBufferSize)
-				_cyclicBufferPos = 0;
-			base.MovePos();
-			if (_pos == kMaxValForNormalize)
-				Normalize();
-		}
-
-		public new Byte GetIndexByte(Int32 index) { return base.GetIndexByte(index); }
-
-		public new UInt32 GetMatchLen(Int32 index, UInt32 distance, UInt32 limit)
-		{ return base.GetMatchLen(index, distance, limit); }
-
-		public new UInt32 GetNumAvailableBytes() { return base.GetNumAvailableBytes(); }
-
-		public void Create(UInt32 historySize, UInt32 keepAddBufferBefore,
-				UInt32 matchMaxLen, UInt32 keepAddBufferAfter)
-		{
-			if (historySize > kMaxValForNormalize - 256)
-				throw new Exception();
-			_cutValue = 16 + (matchMaxLen >> 1);
-				
-			UInt32 windowReservSize = (historySize + keepAddBufferBefore +
-					matchMaxLen + keepAddBufferAfter) / 2 + 256;
-
-			base.Create(historySize + keepAddBufferBefore, matchMaxLen + keepAddBufferAfter, windowReservSize);
-
-			_matchMaxLen = matchMaxLen;
-
-			UInt32 cyclicBufferSize = historySize + 1;
-			if (_cyclicBufferSize != cyclicBufferSize)
-				_son = new UInt32[(_cyclicBufferSize = cyclicBufferSize) * 2];
-
-			UInt32 hs = kBT2HashSize;
-
-			if (HASH_ARRAY)
-			{
-				hs = historySize - 1;
-				hs |= (hs >> 1);
-				hs |= (hs >> 2);
-				hs |= (hs >> 4);
-				hs |= (hs >> 8);
-				hs >>= 1;
-				hs |= 0xFFFF;
-				if (hs > (1 << 24))
-					hs >>= 1;
-				_hashMask = hs;
-				hs++;
-				hs += kFixHashSize;
-			}
-			if (hs != _hashSizeSum)
-				_hash = new UInt32[_hashSizeSum = hs];
-		}
-
-		public UInt32 GetMatches(UInt32[] distances)
-		{
-			UInt32 lenLimit;
-			if (_pos + _matchMaxLen <= _streamPos)
-				lenLimit = _matchMaxLen;
-			else
-			{
-				lenLimit = _streamPos - _pos;
-				if (lenLimit < kMinMatchCheck)
-				{
-					MovePos();
-					return 0;
-				}
-			}
-
-			UInt32 offset = 0;
-			UInt32 matchMinPos = (_pos > _cyclicBufferSize) ? (_pos - _cyclicBufferSize) : 0;
-			UInt32 cur = _bufferOffset + _pos;
-			UInt32 maxLen = kStartMaxLen; // to avoid items for len < hashSize;
-			UInt32 hashValue, hash2Value = 0, hash3Value = 0;
-
-			if (HASH_ARRAY)
-			{
-				UInt32 temp = CRC.Table[_bufferBase[cur]] ^ _bufferBase[cur + 1];
-				hash2Value = temp & (kHash2Size - 1);
-				temp ^= ((UInt32)(_bufferBase[cur + 2]) << 8);
-				hash3Value = temp & (kHash3Size - 1);
-				hashValue = (temp ^ (CRC.Table[_bufferBase[cur + 3]] << 5)) & _hashMask;
-			}
-			else
-				hashValue = _bufferBase[cur] ^ ((UInt32)(_bufferBase[cur + 1]) << 8);
-
-			UInt32 curMatch = _hash[kFixHashSize + hashValue];
-			if (HASH_ARRAY)
-			{
-				UInt32 curMatch2 = _hash[hash2Value];
-				UInt32 curMatch3 = _hash[kHash3Offset + hash3Value];
-				_hash[hash2Value] = _pos;
-				_hash[kHash3Offset + hash3Value] = _pos;
-				if (curMatch2 > matchMinPos)
-					if (_bufferBase[_bufferOffset + curMatch2] == _bufferBase[cur])
-					{
-						distances[offset++] = maxLen = 2;
-						distances[offset++] = _pos - curMatch2 - 1;
-					}
-				if (curMatch3 > matchMinPos)
-					if (_bufferBase[_bufferOffset + curMatch3] == _bufferBase[cur])
-					{
-						if (curMatch3 == curMatch2)
-							offset -= 2;
-						distances[offset++] = maxLen = 3;
-						distances[offset++] = _pos - curMatch3 - 1;
-						curMatch2 = curMatch3;
-					}
-				if (offset != 0 && curMatch2 == curMatch)
-				{
-					offset -= 2;
-					maxLen = kStartMaxLen;
-				}
-			}
-
-			_hash[kFixHashSize + hashValue] = _pos;
-
-			UInt32 ptr0 = (_cyclicBufferPos << 1) + 1;
-			UInt32 ptr1 = (_cyclicBufferPos << 1);
-
-			UInt32 len0, len1;
-			len0 = len1 = kNumHashDirectBytes;
-			
-			if (kNumHashDirectBytes != 0)
-			{
-				if (curMatch > matchMinPos)
-				{
-					if (_bufferBase[_bufferOffset + curMatch + kNumHashDirectBytes] !=
-							_bufferBase[cur + kNumHashDirectBytes])
-					{
-						distances[offset++] = maxLen = kNumHashDirectBytes;
-						distances[offset++] = _pos - curMatch - 1;
-					}
-				}
-			}
-			
-			UInt32 count = _cutValue;
-			
-			while(true)
-			{
-				if(curMatch <= matchMinPos || count-- == 0)
-				{
-					_son[ptr0] = _son[ptr1] = kEmptyHashValue;
-					break;
-				}
-				UInt32 delta = _pos - curMatch;
-				UInt32 cyclicPos = ((delta <= _cyclicBufferPos) ?
-							(_cyclicBufferPos - delta) :
-							(_cyclicBufferPos - delta + _cyclicBufferSize)) << 1;
-
-				UInt32 pby1 = _bufferOffset + curMatch;
-				UInt32 len = Math.Min(len0, len1);
-				if (_bufferBase[pby1 + len] == _bufferBase[cur + len])
-				{
-					while(++len != lenLimit)
-						if (_bufferBase[pby1 + len] != _bufferBase[cur + len])
-							break;
-					if (maxLen < len)
-					{
-						distances[offset++] = maxLen = len;
-						distances[offset++] = delta - 1;
-						if (len == lenLimit)
-						{
-							_son[ptr1] = _son[cyclicPos];
-							_son[ptr0] = _son[cyclicPos + 1];
-							break;
-						}
-					}
-				}
-				if (_bufferBase[pby1 + len] < _bufferBase[cur + len])
-				{
-					_son[ptr1] = curMatch;
-					ptr1 = cyclicPos + 1;
-					curMatch = _son[ptr1];
-					len1 = len;
-				}
-				else
-				{
-					_son[ptr0] = curMatch;
-					ptr0 = cyclicPos;
-					curMatch = _son[ptr0];
-					len0 = len;
-				}
-			}
-			MovePos();
-			return offset;
-		}
-
-		public void Skip(UInt32 num)
-		{
-			do
-			{
-				UInt32 lenLimit;
-				if (_pos + _matchMaxLen <= _streamPos)
-					lenLimit = _matchMaxLen;
-				else
-				{
-					lenLimit = _streamPos - _pos;
-					if (lenLimit < kMinMatchCheck)
-					{
-						MovePos();
-						continue;
-					}
-				}
-
-				UInt32 matchMinPos = (_pos > _cyclicBufferSize) ? (_pos - _cyclicBufferSize) : 0;
-				UInt32 cur = _bufferOffset + _pos;
-
-				UInt32 hashValue;
-
-				if (HASH_ARRAY)
-				{
-					UInt32 temp = CRC.Table[_bufferBase[cur]] ^ _bufferBase[cur + 1];
-					UInt32 hash2Value = temp & (kHash2Size - 1);
-					_hash[hash2Value] = _pos;
-					temp ^= ((UInt32)(_bufferBase[cur + 2]) << 8);
-					UInt32 hash3Value = temp & (kHash3Size - 1);
-					_hash[kHash3Offset + hash3Value] = _pos;
-					hashValue = (temp ^ (CRC.Table[_bufferBase[cur + 3]] << 5)) & _hashMask;
-				}
-				else
-					hashValue = _bufferBase[cur] ^ ((UInt32)(_bufferBase[cur + 1]) << 8);
-
-				UInt32 curMatch = _hash[kFixHashSize + hashValue];
-				_hash[kFixHashSize + hashValue] = _pos;
-
-				UInt32 ptr0 = (_cyclicBufferPos << 1) + 1;
-				UInt32 ptr1 = (_cyclicBufferPos << 1);
-
-				UInt32 len0, len1;
-				len0 = len1 = kNumHashDirectBytes;
-
-				UInt32 count = _cutValue;
-				while (true)
-				{
-					if (curMatch <= matchMinPos || count-- == 0)
-					{
-						_son[ptr0] = _son[ptr1] = kEmptyHashValue;
-						break;
-					}
-
-					UInt32 delta = _pos - curMatch;
-					UInt32 cyclicPos = ((delta <= _cyclicBufferPos) ?
-								(_cyclicBufferPos - delta) :
-								(_cyclicBufferPos - delta + _cyclicBufferSize)) << 1;
-
-					UInt32 pby1 = _bufferOffset + curMatch;
-					UInt32 len = Math.Min(len0, len1);
-					if (_bufferBase[pby1 + len] == _bufferBase[cur + len])
-					{
-						while (++len != lenLimit)
-							if (_bufferBase[pby1 + len] != _bufferBase[cur + len])
-								break;
-						if (len == lenLimit)
-						{
-							_son[ptr1] = _son[cyclicPos];
-							_son[ptr0] = _son[cyclicPos + 1];
-							break;
-						}
-					}
-					if (_bufferBase[pby1 + len] < _bufferBase[cur + len])
-					{
-						_son[ptr1] = curMatch;
-						ptr1 = cyclicPos + 1;
-						curMatch = _son[ptr1];
-						len1 = len;
-					}
-					else
-					{
-						_son[ptr0] = curMatch;
-						ptr0 = cyclicPos;
-						curMatch = _son[ptr0];
-						len0 = len;
-					}
-				}
-				MovePos();
-			}
-			while (--num != 0);
-		}
-
-		void NormalizeLinks(UInt32[] items, UInt32 numItems, UInt32 subValue)
-		{
-			for (UInt32 i = 0; i < numItems; i++)
-			{
-				UInt32 value = items[i];
-				if (value <= subValue)
-					value = kEmptyHashValue;
-				else
-					value -= subValue;
-				items[i] = value;
-			}
-		}
-
-		void Normalize()
-		{
-			UInt32 subValue = _pos - _cyclicBufferSize;
-			NormalizeLinks(_son, _cyclicBufferSize * 2, subValue);
-			NormalizeLinks(_hash, _hashSizeSum, subValue);
-			ReduceOffsets((Int32)subValue);
-		}
-
-		public void SetCutValue(UInt32 cutValue) { _cutValue = cutValue; }
-	}
-}
diff --git a/third_party/lzma/v4_65/files/CS/7zip/Compress/LZ/LzInWindow.cs b/third_party/lzma/v4_65/files/CS/7zip/Compress/LZ/LzInWindow.cs
deleted file mode 100644
index 52d23ce..0000000
--- a/third_party/lzma/v4_65/files/CS/7zip/Compress/LZ/LzInWindow.cs
+++ /dev/null
@@ -1,132 +0,0 @@
-// LzInWindow.cs
-
-using System;
-
-namespace SevenZip.Compression.LZ
-{
-	public class InWindow
-	{
-		public Byte[] _bufferBase = null; // pointer to buffer with data
-		System.IO.Stream _stream;
-		UInt32 _posLimit; // offset (from _buffer) of first byte when new block reading must be done
-		bool _streamEndWasReached; // if (true) then _streamPos shows real end of stream
-
-		UInt32 _pointerToLastSafePosition;
-
-		public UInt32 _bufferOffset;
-
-		public UInt32 _blockSize; // Size of Allocated memory block
-		public UInt32 _pos; // offset (from _buffer) of curent byte
-		UInt32 _keepSizeBefore; // how many BYTEs must be kept in buffer before _pos
-		UInt32 _keepSizeAfter; // how many BYTEs must be kept buffer after _pos
-		public UInt32 _streamPos; // offset (from _buffer) of first not read byte from Stream
-
-		public void MoveBlock()
-		{
-			UInt32 offset = (UInt32)(_bufferOffset) + _pos - _keepSizeBefore;
-			// we need one additional byte, since MovePos moves on 1 byte.
-			if (offset > 0)
-				offset--;
-			
-			UInt32 numBytes = (UInt32)(_bufferOffset) + _streamPos - offset;
-
-			// check negative offset ????
-			for (UInt32 i = 0; i < numBytes; i++)
-				_bufferBase[i] = _bufferBase[offset + i];
-			_bufferOffset -= offset;
-		}
-
-		public virtual void ReadBlock()
-		{
-			if (_streamEndWasReached)
-				return;
-			while (true)
-			{
-				int size = (int)((0 - _bufferOffset) + _blockSize - _streamPos);
-				if (size == 0)
-					return;
-				int numReadBytes = _stream.Read(_bufferBase, (int)(_bufferOffset + _streamPos), size);
-				if (numReadBytes == 0)
-				{
-					_posLimit = _streamPos;
-					UInt32 pointerToPostion = _bufferOffset + _posLimit;
-					if (pointerToPostion > _pointerToLastSafePosition)
-						_posLimit = (UInt32)(_pointerToLastSafePosition - _bufferOffset);
-
-					_streamEndWasReached = true;
-					return;
-				}
-				_streamPos += (UInt32)numReadBytes;
-				if (_streamPos >= _pos + _keepSizeAfter)
-					_posLimit = _streamPos - _keepSizeAfter;
-			}
-		}
-
-		void Free() { _bufferBase = null; }
-
-		public void Create(UInt32 keepSizeBefore, UInt32 keepSizeAfter, UInt32 keepSizeReserv)
-		{
-			_keepSizeBefore = keepSizeBefore;
-			_keepSizeAfter = keepSizeAfter;
-			UInt32 blockSize = keepSizeBefore + keepSizeAfter + keepSizeReserv;
-			if (_bufferBase == null || _blockSize != blockSize)
-			{
-				Free();
-				_blockSize = blockSize;
-				_bufferBase = new Byte[_blockSize];
-			}
-			_pointerToLastSafePosition = _blockSize - keepSizeAfter;
-		}
-
-		public void SetStream(System.IO.Stream stream) { _stream = stream; }
-		public void ReleaseStream() { _stream = null; }
-
-		public void Init()
-		{
-			_bufferOffset = 0;
-			_pos = 0;
-			_streamPos = 0;
-			_streamEndWasReached = false;
-			ReadBlock();
-		}
-
-		public void MovePos()
-		{
-			_pos++;
-			if (_pos > _posLimit)
-			{
-				UInt32 pointerToPostion = _bufferOffset + _pos;
-				if (pointerToPostion > _pointerToLastSafePosition)
-					MoveBlock();
-				ReadBlock();
-			}
-		}
-
-		public Byte GetIndexByte(Int32 index) { return _bufferBase[_bufferOffset + _pos + index]; }
-
-		// index + limit have not to exceed _keepSizeAfter;
-		public UInt32 GetMatchLen(Int32 index, UInt32 distance, UInt32 limit)
-		{
-			if (_streamEndWasReached)
-				if ((_pos + index) + limit > _streamPos)
-					limit = _streamPos - (UInt32)(_pos + index);
-			distance++;
-			// Byte *pby = _buffer + (size_t)_pos + index;
-			UInt32 pby = _bufferOffset + _pos + (UInt32)index;
-
-			UInt32 i;
-			for (i = 0; i < limit && _bufferBase[pby + i] == _bufferBase[pby + i - distance]; i++);
-			return i;
-		}
-
-		public UInt32 GetNumAvailableBytes() { return _streamPos - _pos; }
-
-		public void ReduceOffsets(Int32 subValue)
-		{
-			_bufferOffset += (UInt32)subValue;
-			_posLimit -= (UInt32)subValue;
-			_pos -= (UInt32)subValue;
-			_streamPos -= (UInt32)subValue;
-		}
-	}
-}
diff --git a/third_party/lzma/v4_65/files/CS/7zip/Compress/LZ/LzOutWindow.cs b/third_party/lzma/v4_65/files/CS/7zip/Compress/LZ/LzOutWindow.cs
deleted file mode 100644
index c998584..0000000
--- a/third_party/lzma/v4_65/files/CS/7zip/Compress/LZ/LzOutWindow.cs
+++ /dev/null
@@ -1,110 +0,0 @@
-// LzOutWindow.cs
-
-namespace SevenZip.Compression.LZ
-{
-	public class OutWindow
-	{
-		byte[] _buffer = null;
-		uint _pos;
-		uint _windowSize = 0;
-		uint _streamPos;
-		System.IO.Stream _stream;
-
-		public uint TrainSize = 0;
-
-		public void Create(uint windowSize)
-		{
-			if (_windowSize != windowSize)
-			{
-				// System.GC.Collect();
-				_buffer = new byte[windowSize];
-			}
-			_windowSize = windowSize;
-			_pos = 0;
-			_streamPos = 0;
-		}
-
-		public void Init(System.IO.Stream stream, bool solid)
-		{
-			ReleaseStream();
-			_stream = stream;
-			if (!solid)
-			{
-				_streamPos = 0;
-				_pos = 0;
-				TrainSize = 0;
-			}
-		}
-	
-		public bool Train(System.IO.Stream stream)
-		{
-			long len = stream.Length;
-			uint size = (len < _windowSize) ? (uint)len : _windowSize;
-			TrainSize = size;
-			stream.Position = len - size;
-			_streamPos = _pos = 0;
-			while (size > 0)
-			{
-				uint curSize = _windowSize - _pos;
-				if (size < curSize)
-					curSize = size;
-				int numReadBytes = stream.Read(_buffer, (int)_pos, (int)curSize);
-				if (numReadBytes == 0)
-					return false;
-				size -= (uint)numReadBytes;
-				_pos += (uint)numReadBytes;
-				_streamPos += (uint)numReadBytes;
-				if (_pos == _windowSize)
-					_streamPos = _pos = 0;
-			}
-			return true;
-		}
-
-		public void ReleaseStream()
-		{
-			Flush();
-			_stream = null;
-		}
-
-		public void Flush()
-		{
-			uint size = _pos - _streamPos;
-			if (size == 0)
-				return;
-			_stream.Write(_buffer, (int)_streamPos, (int)size);
-			if (_pos >= _windowSize)
-				_pos = 0;
-			_streamPos = _pos;
-		}
-
-		public void CopyBlock(uint distance, uint len)
-		{
-			uint pos = _pos - distance - 1;
-			if (pos >= _windowSize)
-				pos += _windowSize;
-			for (; len > 0; len--)
-			{
-				if (pos >= _windowSize)
-					pos = 0;
-				_buffer[_pos++] = _buffer[pos++];
-				if (_pos >= _windowSize)
-					Flush();
-			}
-		}
-
-		public void PutByte(byte b)
-		{
-			_buffer[_pos++] = b;
-			if (_pos >= _windowSize)
-				Flush();
-		}
-
-		public byte GetByte(uint distance)
-		{
-			uint pos = _pos - distance - 1;
-			if (pos >= _windowSize)
-				pos += _windowSize;
-			return _buffer[pos];
-		}
-	}
-}
diff --git a/third_party/lzma/v4_65/files/CS/7zip/Compress/LZMA/LzmaBase.cs b/third_party/lzma/v4_65/files/CS/7zip/Compress/LZMA/LzmaBase.cs
deleted file mode 100644
index c7bca86..0000000
--- a/third_party/lzma/v4_65/files/CS/7zip/Compress/LZMA/LzmaBase.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-// LzmaBase.cs
-
-namespace SevenZip.Compression.LZMA
-{
-	internal abstract class Base
-	{
-		public const uint kNumRepDistances = 4;
-		public const uint kNumStates = 12;
-
-		// static byte []kLiteralNextStates  = {0, 0, 0, 0, 1, 2, 3, 4,  5,  6,   4, 5};
-		// static byte []kMatchNextStates    = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10};
-		// static byte []kRepNextStates      = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11};
-		// static byte []kShortRepNextStates = {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11};
-
-		public struct State
-		{
-			public uint Index;
-			public void Init() { Index = 0; }
-			public void UpdateChar()
-			{
-				if (Index < 4) Index = 0;
-				else if (Index < 10) Index -= 3;
-				else Index -= 6;
-			}
-			public void UpdateMatch() { Index = (uint)(Index < 7 ? 7 : 10); }
-			public void UpdateRep() { Index = (uint)(Index < 7 ? 8 : 11); }
-			public void UpdateShortRep() { Index = (uint)(Index < 7 ? 9 : 11); }
-			public bool IsCharState() { return Index < 7; }
-		}
-
-		public const int kNumPosSlotBits = 6;
-		public const int kDicLogSizeMin = 0;
-		// public const int kDicLogSizeMax = 30;
-		// public const uint kDistTableSizeMax = kDicLogSizeMax * 2;
-
-		public const int kNumLenToPosStatesBits = 2; // it's for speed optimization
-		public const uint kNumLenToPosStates = 1 << kNumLenToPosStatesBits;
-
-		public const uint kMatchMinLen = 2;
-
-		public static uint GetLenToPosState(uint len)
-		{
-			len -= kMatchMinLen;
-			if (len < kNumLenToPosStates)
-				return len;
-			return (uint)(kNumLenToPosStates - 1);
-		}
-
-		public const int kNumAlignBits = 4;
-		public const uint kAlignTableSize = 1 << kNumAlignBits;
-		public const uint kAlignMask = (kAlignTableSize - 1);
-
-		public const uint kStartPosModelIndex = 4;
-		public const uint kEndPosModelIndex = 14;
-		public const uint kNumPosModels = kEndPosModelIndex - kStartPosModelIndex;
-
-		public const uint kNumFullDistances = 1 << ((int)kEndPosModelIndex / 2);
-
-		public const uint kNumLitPosStatesBitsEncodingMax = 4;
-		public const uint kNumLitContextBitsMax = 8;
-
-		public const int kNumPosStatesBitsMax = 4;
-		public const uint kNumPosStatesMax = (1 << kNumPosStatesBitsMax);
-		public const int kNumPosStatesBitsEncodingMax = 4;
-		public const uint kNumPosStatesEncodingMax = (1 << kNumPosStatesBitsEncodingMax);
-
-		public const int kNumLowLenBits = 3;
-		public const int kNumMidLenBits = 3;
-		public const int kNumHighLenBits = 8;
-		public const uint kNumLowLenSymbols = 1 << kNumLowLenBits;
-		public const uint kNumMidLenSymbols = 1 << kNumMidLenBits;
-		public const uint kNumLenSymbols = kNumLowLenSymbols + kNumMidLenSymbols +
-				(1 << kNumHighLenBits);
-		public const uint kMatchMaxLen = kMatchMinLen + kNumLenSymbols - 1;
-	}
-}
diff --git a/third_party/lzma/v4_65/files/CS/7zip/Compress/LZMA/LzmaDecoder.cs b/third_party/lzma/v4_65/files/CS/7zip/Compress/LZMA/LzmaDecoder.cs
deleted file mode 100644
index a9be39f..0000000
--- a/third_party/lzma/v4_65/files/CS/7zip/Compress/LZMA/LzmaDecoder.cs
+++ /dev/null
@@ -1,398 +0,0 @@
-// LzmaDecoder.cs
-
-using System;
-
-namespace SevenZip.Compression.LZMA
-{
-	using RangeCoder;
-
-	public class Decoder : ICoder, ISetDecoderProperties // ,System.IO.Stream
-	{
-		class LenDecoder
-		{
-			BitDecoder m_Choice = new BitDecoder();
-			BitDecoder m_Choice2 = new BitDecoder();
-			BitTreeDecoder[] m_LowCoder = new BitTreeDecoder[Base.kNumPosStatesMax];
-			BitTreeDecoder[] m_MidCoder = new BitTreeDecoder[Base.kNumPosStatesMax];
-			BitTreeDecoder m_HighCoder = new BitTreeDecoder(Base.kNumHighLenBits);
-			uint m_NumPosStates = 0;
-
-			public void Create(uint numPosStates)
-			{
-				for (uint posState = m_NumPosStates; posState < numPosStates; posState++)
-				{
-					m_LowCoder[posState] = new BitTreeDecoder(Base.kNumLowLenBits);
-					m_MidCoder[posState] = new BitTreeDecoder(Base.kNumMidLenBits);
-				}
-				m_NumPosStates = numPosStates;
-			}
-
-			public void Init()
-			{
-				m_Choice.Init();
-				for (uint posState = 0; posState < m_NumPosStates; posState++)
-				{
-					m_LowCoder[posState].Init();
-					m_MidCoder[posState].Init();
-				}
-				m_Choice2.Init();
-				m_HighCoder.Init();
-			}
-
-			public uint Decode(RangeCoder.Decoder rangeDecoder, uint posState)
-			{
-				if (m_Choice.Decode(rangeDecoder) == 0)
-					return m_LowCoder[posState].Decode(rangeDecoder);
-				else
-				{
-					uint symbol = Base.kNumLowLenSymbols;
-					if (m_Choice2.Decode(rangeDecoder) == 0)
-						symbol += m_MidCoder[posState].Decode(rangeDecoder);
-					else
-					{
-						symbol += Base.kNumMidLenSymbols;
-						symbol += m_HighCoder.Decode(rangeDecoder);
-					}
-					return symbol;
-				}
-			}
-		}
-
-		class LiteralDecoder
-		{
-			struct Decoder2
-			{
-				BitDecoder[] m_Decoders;
-				public void Create() { m_Decoders = new BitDecoder[0x300]; }
-				public void Init() { for (int i = 0; i < 0x300; i++) m_Decoders[i].Init(); }
-
-				public byte DecodeNormal(RangeCoder.Decoder rangeDecoder)
-				{
-					uint symbol = 1;
-					do
-						symbol = (symbol << 1) | m_Decoders[symbol].Decode(rangeDecoder);
-					while (symbol < 0x100);
-					return (byte)symbol;
-				}
-
-				public byte DecodeWithMatchByte(RangeCoder.Decoder rangeDecoder, byte matchByte)
-				{
-					uint symbol = 1;
-					do
-					{
-						uint matchBit = (uint)(matchByte >> 7) & 1;
-						matchByte <<= 1;
-						uint bit = m_Decoders[((1 + matchBit) << 8) + symbol].Decode(rangeDecoder);
-						symbol = (symbol << 1) | bit;
-						if (matchBit != bit)
-						{
-							while (symbol < 0x100)
-								symbol = (symbol << 1) | m_Decoders[symbol].Decode(rangeDecoder);
-							break;
-						}
-					}
-					while (symbol < 0x100);
-					return (byte)symbol;
-				}
-			}
-
-			Decoder2[] m_Coders;
-			int m_NumPrevBits;
-			int m_NumPosBits;
-			uint m_PosMask;
-
-			public void Create(int numPosBits, int numPrevBits)
-			{
-				if (m_Coders != null && m_NumPrevBits == numPrevBits &&
-					m_NumPosBits == numPosBits)
-					return;
-				m_NumPosBits = numPosBits;
-				m_PosMask = ((uint)1 << numPosBits) - 1;
-				m_NumPrevBits = numPrevBits;
-				uint numStates = (uint)1 << (m_NumPrevBits + m_NumPosBits);
-				m_Coders = new Decoder2[numStates];
-				for (uint i = 0; i < numStates; i++)
-					m_Coders[i].Create();
-			}
-
-			public void Init()
-			{
-				uint numStates = (uint)1 << (m_NumPrevBits + m_NumPosBits);
-				for (uint i = 0; i < numStates; i++)
-					m_Coders[i].Init();
-			}
-
-			uint GetState(uint pos, byte prevByte)
-			{ return ((pos & m_PosMask) << m_NumPrevBits) + (uint)(prevByte >> (8 - m_NumPrevBits)); }
-
-			public byte DecodeNormal(RangeCoder.Decoder rangeDecoder, uint pos, byte prevByte)
-			{ return m_Coders[GetState(pos, prevByte)].DecodeNormal(rangeDecoder); }
-
-			public byte DecodeWithMatchByte(RangeCoder.Decoder rangeDecoder, uint pos, byte prevByte, byte matchByte)
-			{ return m_Coders[GetState(pos, prevByte)].DecodeWithMatchByte(rangeDecoder, matchByte); }
-		};
-
-		LZ.OutWindow m_OutWindow = new LZ.OutWindow();
-		RangeCoder.Decoder m_RangeDecoder = new RangeCoder.Decoder();
-
-		BitDecoder[] m_IsMatchDecoders = new BitDecoder[Base.kNumStates << Base.kNumPosStatesBitsMax];
-		BitDecoder[] m_IsRepDecoders = new BitDecoder[Base.kNumStates];
-		BitDecoder[] m_IsRepG0Decoders = new BitDecoder[Base.kNumStates];
-		BitDecoder[] m_IsRepG1Decoders = new BitDecoder[Base.kNumStates];
-		BitDecoder[] m_IsRepG2Decoders = new BitDecoder[Base.kNumStates];
-		BitDecoder[] m_IsRep0LongDecoders = new BitDecoder[Base.kNumStates << Base.kNumPosStatesBitsMax];
-
-		BitTreeDecoder[] m_PosSlotDecoder = new BitTreeDecoder[Base.kNumLenToPosStates];
-		BitDecoder[] m_PosDecoders = new BitDecoder[Base.kNumFullDistances - Base.kEndPosModelIndex];
-
-		BitTreeDecoder m_PosAlignDecoder = new BitTreeDecoder(Base.kNumAlignBits);
-
-		LenDecoder m_LenDecoder = new LenDecoder();
-		LenDecoder m_RepLenDecoder = new LenDecoder();
-
-		LiteralDecoder m_LiteralDecoder = new LiteralDecoder();
-
-		uint m_DictionarySize;
-		uint m_DictionarySizeCheck;
-
-		uint m_PosStateMask;
-
-		public Decoder()
-		{
-			m_DictionarySize = 0xFFFFFFFF;
-			for (int i = 0; i < Base.kNumLenToPosStates; i++)
-				m_PosSlotDecoder[i] = new BitTreeDecoder(Base.kNumPosSlotBits);
-		}
-
-		void SetDictionarySize(uint dictionarySize)
-		{
-			if (m_DictionarySize != dictionarySize)
-			{
-				m_DictionarySize = dictionarySize;
-				m_DictionarySizeCheck = Math.Max(m_DictionarySize, 1);
-				uint blockSize = Math.Max(m_DictionarySizeCheck, (1 << 12));
-				m_OutWindow.Create(blockSize);
-			}
-		}
-
-		void SetLiteralProperties(int lp, int lc)
-		{
-			if (lp > 8)
-				throw new InvalidParamException();
-			if (lc > 8)
-				throw new InvalidParamException();
-			m_LiteralDecoder.Create(lp, lc);
-		}
-
-		void SetPosBitsProperties(int pb)
-		{
-			if (pb > Base.kNumPosStatesBitsMax)
-				throw new InvalidParamException();
-			uint numPosStates = (uint)1 << pb;
-			m_LenDecoder.Create(numPosStates);
-			m_RepLenDecoder.Create(numPosStates);
-			m_PosStateMask = numPosStates - 1;
-		}
-
-		bool _solid = false;
-		void Init(System.IO.Stream inStream, System.IO.Stream outStream)
-		{
-			m_RangeDecoder.Init(inStream);
-			m_OutWindow.Init(outStream, _solid);
-
-			uint i;
-			for (i = 0; i < Base.kNumStates; i++)
-			{
-				for (uint j = 0; j <= m_PosStateMask; j++)
-				{
-					uint index = (i << Base.kNumPosStatesBitsMax) + j;
-					m_IsMatchDecoders[index].Init();
-					m_IsRep0LongDecoders[index].Init();
-				}
-				m_IsRepDecoders[i].Init();
-				m_IsRepG0Decoders[i].Init();
-				m_IsRepG1Decoders[i].Init();
-				m_IsRepG2Decoders[i].Init();
-			}
-
-			m_LiteralDecoder.Init();
-			for (i = 0; i < Base.kNumLenToPosStates; i++)
-				m_PosSlotDecoder[i].Init();
-			// m_PosSpecDecoder.Init();
-			for (i = 0; i < Base.kNumFullDistances - Base.kEndPosModelIndex; i++)
-				m_PosDecoders[i].Init();
-
-			m_LenDecoder.Init();
-			m_RepLenDecoder.Init();
-			m_PosAlignDecoder.Init();
-		}
-
-		public void Code(System.IO.Stream inStream, System.IO.Stream outStream,
-			Int64 inSize, Int64 outSize, ICodeProgress progress)
-		{
-			Init(inStream, outStream);
-
-			Base.State state = new Base.State();
-			state.Init();
-			uint rep0 = 0, rep1 = 0, rep2 = 0, rep3 = 0;
-
-			UInt64 nowPos64 = 0;
-			UInt64 outSize64 = (UInt64)outSize;
-			if (nowPos64 < outSize64)
-			{
-				if (m_IsMatchDecoders[state.Index << Base.kNumPosStatesBitsMax].Decode(m_RangeDecoder) != 0)
-					throw new DataErrorException();
-				state.UpdateChar();
-				byte b = m_LiteralDecoder.DecodeNormal(m_RangeDecoder, 0, 0);
-				m_OutWindow.PutByte(b);
-				nowPos64++;
-			}
-			while (nowPos64 < outSize64)
-			{
-				// UInt64 next = Math.Min(nowPos64 + (1 << 18), outSize64);
-					// while(nowPos64 < next)
-				{
-					uint posState = (uint)nowPos64 & m_PosStateMask;
-					if (m_IsMatchDecoders[(state.Index << Base.kNumPosStatesBitsMax) + posState].Decode(m_RangeDecoder) == 0)
-					{
-						byte b;
-						byte prevByte = m_OutWindow.GetByte(0);
-						if (!state.IsCharState())
-							b = m_LiteralDecoder.DecodeWithMatchByte(m_RangeDecoder,
-								(uint)nowPos64, prevByte, m_OutWindow.GetByte(rep0));
-						else
-							b = m_LiteralDecoder.DecodeNormal(m_RangeDecoder, (uint)nowPos64, prevByte);
-						m_OutWindow.PutByte(b);
-						state.UpdateChar();
-						nowPos64++;
-					}
-					else
-					{
-						uint len;
-						if (m_IsRepDecoders[state.Index].Decode(m_RangeDecoder) == 1)
-						{
-							if (m_IsRepG0Decoders[state.Index].Decode(m_RangeDecoder) == 0)
-							{
-								if (m_IsRep0LongDecoders[(state.Index << Base.kNumPosStatesBitsMax) + posState].Decode(m_RangeDecoder) == 0)
-								{
-									state.UpdateShortRep();
-									m_OutWindow.PutByte(m_OutWindow.GetByte(rep0));
-									nowPos64++;
-									continue;
-								}
-							}
-							else
-							{
-								UInt32 distance;
-								if (m_IsRepG1Decoders[state.Index].Decode(m_RangeDecoder) == 0)
-								{
-									distance = rep1;
-								}
-								else
-								{
-									if (m_IsRepG2Decoders[state.Index].Decode(m_RangeDecoder) == 0)
-										distance = rep2;
-									else
-									{
-										distance = rep3;
-										rep3 = rep2;
-									}
-									rep2 = rep1;
-								}
-								rep1 = rep0;
-								rep0 = distance;
-							}
-							len = m_RepLenDecoder.Decode(m_RangeDecoder, posState) + Base.kMatchMinLen;
-							state.UpdateRep();
-						}
-						else
-						{
-							rep3 = rep2;
-							rep2 = rep1;
-							rep1 = rep0;
-							len = Base.kMatchMinLen + m_LenDecoder.Decode(m_RangeDecoder, posState);
-							state.UpdateMatch();
-							uint posSlot = m_PosSlotDecoder[Base.GetLenToPosState(len)].Decode(m_RangeDecoder);
-							if (posSlot >= Base.kStartPosModelIndex)
-							{
-								int numDirectBits = (int)((posSlot >> 1) - 1);
-								rep0 = ((2 | (posSlot & 1)) << numDirectBits);
-								if (posSlot < Base.kEndPosModelIndex)
-									rep0 += BitTreeDecoder.ReverseDecode(m_PosDecoders,
-											rep0 - posSlot - 1, m_RangeDecoder, numDirectBits);
-								else
-								{
-									rep0 += (m_RangeDecoder.DecodeDirectBits(
-										numDirectBits - Base.kNumAlignBits) << Base.kNumAlignBits);
-									rep0 += m_PosAlignDecoder.ReverseDecode(m_RangeDecoder);
-								}
-							}
-							else
-								rep0 = posSlot;
-						}
-						if (rep0 >= m_OutWindow.TrainSize + nowPos64 || rep0 >= m_DictionarySizeCheck)
-						{
-							if (rep0 == 0xFFFFFFFF)
-								break;
-							throw new DataErrorException();
-						}
-						m_OutWindow.CopyBlock(rep0, len);
-						nowPos64 += len;
-					}
-				}
-			}
-			m_OutWindow.Flush();
-			m_OutWindow.ReleaseStream();
-			m_RangeDecoder.ReleaseStream();
-		}
-
-		public void SetDecoderProperties(byte[] properties)
-		{
-			if (properties.Length < 5)
-				throw new InvalidParamException();
-			int lc = properties[0] % 9;
-			int remainder = properties[0] / 9;
-			int lp = remainder % 5;
-			int pb = remainder / 5;
-			if (pb > Base.kNumPosStatesBitsMax)
-				throw new InvalidParamException();
-			UInt32 dictionarySize = 0;
-			for (int i = 0; i < 4; i++)
-				dictionarySize += ((UInt32)(properties[1 + i])) << (i * 8);
-			SetDictionarySize(dictionarySize);
-			SetLiteralProperties(lp, lc);
-			SetPosBitsProperties(pb);
-		}
-
-		public bool Train(System.IO.Stream stream)
-		{
-			_solid = true;
-			return m_OutWindow.Train(stream);
-		}
-
-		/*
-		public override bool CanRead { get { return true; }}
-		public override bool CanWrite { get { return true; }}
-		public override bool CanSeek { get { return true; }}
-		public override long Length { get { return 0; }}
-		public override long Position
-		{
-			get { return 0;	}
-			set { }
-		}
-		public override void Flush() { }
-		public override int Read(byte[] buffer, int offset, int count) 
-		{
-			return 0;
-		}
-		public override void Write(byte[] buffer, int offset, int count)
-		{
-		}
-		public override long Seek(long offset, System.IO.SeekOrigin origin)
-		{
-			return 0;
-		}
-		public override void SetLength(long value) {}
-		*/
-	}
-}
diff --git a/third_party/lzma/v4_65/files/CS/7zip/Compress/LZMA/LzmaEncoder.cs b/third_party/lzma/v4_65/files/CS/7zip/Compress/LZMA/LzmaEncoder.cs
deleted file mode 100644
index a8d6723..0000000
--- a/third_party/lzma/v4_65/files/CS/7zip/Compress/LZMA/LzmaEncoder.cs
+++ /dev/null
@@ -1,1480 +0,0 @@
-// LzmaEncoder.cs
-
-using System;
-
-namespace SevenZip.Compression.LZMA
-{
-	using RangeCoder;
-
-	public class Encoder : ICoder, ISetCoderProperties, IWriteCoderProperties
-	{
-		enum EMatchFinderType
-		{
-			BT2,
-			BT4,
-		};
-
-		const UInt32 kIfinityPrice = 0xFFFFFFF;
-
-		static Byte[] g_FastPos = new Byte[1 << 11];
-
-		static Encoder()
-		{
-			const Byte kFastSlots = 22;
-			int c = 2;
-			g_FastPos[0] = 0;
-			g_FastPos[1] = 1;
-			for (Byte slotFast = 2; slotFast < kFastSlots; slotFast++)
-			{
-				UInt32 k = ((UInt32)1 << ((slotFast >> 1) - 1));
-				for (UInt32 j = 0; j < k; j++, c++)
-					g_FastPos[c] = slotFast;
-			}
-		}
-
-		static UInt32 GetPosSlot(UInt32 pos)
-		{
-			if (pos < (1 << 11))
-				return g_FastPos[pos];
-			if (pos < (1 << 21))
-				return (UInt32)(g_FastPos[pos >> 10] + 20);
-			return (UInt32)(g_FastPos[pos >> 20] + 40);
-		}
-
-		static UInt32 GetPosSlot2(UInt32 pos)
-		{
-			if (pos < (1 << 17))
-				return (UInt32)(g_FastPos[pos >> 6] + 12);
-			if (pos < (1 << 27))
-				return (UInt32)(g_FastPos[pos >> 16] + 32);
-			return (UInt32)(g_FastPos[pos >> 26] + 52);
-		}
-
-		Base.State _state = new Base.State();
-		Byte _previousByte;
-		UInt32[] _repDistances = new UInt32[Base.kNumRepDistances];
-
-		void BaseInit()
-		{
-			_state.Init();
-			_previousByte = 0;
-			for (UInt32 i = 0; i < Base.kNumRepDistances; i++)
-				_repDistances[i] = 0;
-		}
-
-		const int kDefaultDictionaryLogSize = 22;
-		const UInt32 kNumFastBytesDefault = 0x20;
-
-		class LiteralEncoder
-		{
-			public struct Encoder2
-			{
-				BitEncoder[] m_Encoders;
-
-				public void Create() { m_Encoders = new BitEncoder[0x300]; }
-
-				public void Init() { for (int i = 0; i < 0x300; i++) m_Encoders[i].Init(); }
-
-				public void Encode(RangeCoder.Encoder rangeEncoder, byte symbol)
-				{
-					uint context = 1;
-					for (int i = 7; i >= 0; i--)
-					{
-						uint bit = (uint)((symbol >> i) & 1);
-						m_Encoders[context].Encode(rangeEncoder, bit);
-						context = (context << 1) | bit;
-					}
-				}
-
-				public void EncodeMatched(RangeCoder.Encoder rangeEncoder, byte matchByte, byte symbol)
-				{
-					uint context = 1;
-					bool same = true;
-					for (int i = 7; i >= 0; i--)
-					{
-						uint bit = (uint)((symbol >> i) & 1);
-						uint state = context;
-						if (same)
-						{
-							uint matchBit = (uint)((matchByte >> i) & 1);
-							state += ((1 + matchBit) << 8);
-							same = (matchBit == bit);
-						}
-						m_Encoders[state].Encode(rangeEncoder, bit);
-						context = (context << 1) | bit;
-					}
-				}
-
-				public uint GetPrice(bool matchMode, byte matchByte, byte symbol)
-				{
-					uint price = 0;
-					uint context = 1;
-					int i = 7;
-					if (matchMode)
-					{
-						for (; i >= 0; i--)
-						{
-							uint matchBit = (uint)(matchByte >> i) & 1;
-							uint bit = (uint)(symbol >> i) & 1;
-							price += m_Encoders[((1 + matchBit) << 8) + context].GetPrice(bit);
-							context = (context << 1) | bit;
-							if (matchBit != bit)
-							{
-								i--;
-								break;
-							}
-						}
-					}
-					for (; i >= 0; i--)
-					{
-						uint bit = (uint)(symbol >> i) & 1;
-						price += m_Encoders[context].GetPrice(bit);
-						context = (context << 1) | bit;
-					}
-					return price;
-				}
-			}
-
-			Encoder2[] m_Coders;
-			int m_NumPrevBits;
-			int m_NumPosBits;
-			uint m_PosMask;
-
-			public void Create(int numPosBits, int numPrevBits)
-			{
-				if (m_Coders != null && m_NumPrevBits == numPrevBits && m_NumPosBits == numPosBits)
-					return;
-				m_NumPosBits = numPosBits;
-				m_PosMask = ((uint)1 << numPosBits) - 1;
-				m_NumPrevBits = numPrevBits;
-				uint numStates = (uint)1 << (m_NumPrevBits + m_NumPosBits);
-				m_Coders = new Encoder2[numStates];
-				for (uint i = 0; i < numStates; i++)
-					m_Coders[i].Create();
-			}
-
-			public void Init()
-			{
-				uint numStates = (uint)1 << (m_NumPrevBits + m_NumPosBits);
-				for (uint i = 0; i < numStates; i++)
-					m_Coders[i].Init();
-			}
-
-			public Encoder2 GetSubCoder(UInt32 pos, Byte prevByte)
-			{ return m_Coders[((pos & m_PosMask) << m_NumPrevBits) + (uint)(prevByte >> (8 - m_NumPrevBits))]; }
-		}
-
-		class LenEncoder
-		{
-			RangeCoder.BitEncoder _choice = new RangeCoder.BitEncoder();
-			RangeCoder.BitEncoder _choice2 = new RangeCoder.BitEncoder();
-			RangeCoder.BitTreeEncoder[] _lowCoder = new RangeCoder.BitTreeEncoder[Base.kNumPosStatesEncodingMax];
-			RangeCoder.BitTreeEncoder[] _midCoder = new RangeCoder.BitTreeEncoder[Base.kNumPosStatesEncodingMax];
-			RangeCoder.BitTreeEncoder _highCoder = new RangeCoder.BitTreeEncoder(Base.kNumHighLenBits);
-
-			public LenEncoder()
-			{
-				for (UInt32 posState = 0; posState < Base.kNumPosStatesEncodingMax; posState++)
-				{
-					_lowCoder[posState] = new RangeCoder.BitTreeEncoder(Base.kNumLowLenBits);
-					_midCoder[posState] = new RangeCoder.BitTreeEncoder(Base.kNumMidLenBits);
-				}
-			}
-
-			public void Init(UInt32 numPosStates)
-			{
-				_choice.Init();
-				_choice2.Init();
-				for (UInt32 posState = 0; posState < numPosStates; posState++)
-				{
-					_lowCoder[posState].Init();
-					_midCoder[posState].Init();
-				}
-				_highCoder.Init();
-			}
-
-			public void Encode(RangeCoder.Encoder rangeEncoder, UInt32 symbol, UInt32 posState)
-			{
-				if (symbol < Base.kNumLowLenSymbols)
-				{
-					_choice.Encode(rangeEncoder, 0);
-					_lowCoder[posState].Encode(rangeEncoder, symbol);
-				}
-				else
-				{
-					symbol -= Base.kNumLowLenSymbols;
-					_choice.Encode(rangeEncoder, 1);
-					if (symbol < Base.kNumMidLenSymbols)
-					{
-						_choice2.Encode(rangeEncoder, 0);
-						_midCoder[posState].Encode(rangeEncoder, symbol);
-					}
-					else
-					{
-						_choice2.Encode(rangeEncoder, 1);
-						_highCoder.Encode(rangeEncoder, symbol - Base.kNumMidLenSymbols);
-					}
-				}
-			}
-
-			public void SetPrices(UInt32 posState, UInt32 numSymbols, UInt32[] prices, UInt32 st)
-			{
-				UInt32 a0 = _choice.GetPrice0();
-				UInt32 a1 = _choice.GetPrice1();
-				UInt32 b0 = a1 + _choice2.GetPrice0();
-				UInt32 b1 = a1 + _choice2.GetPrice1();
-				UInt32 i = 0;
-				for (i = 0; i < Base.kNumLowLenSymbols; i++)
-				{
-					if (i >= numSymbols)
-						return;
-					prices[st + i] = a0 + _lowCoder[posState].GetPrice(i);
-				}
-				for (; i < Base.kNumLowLenSymbols + Base.kNumMidLenSymbols; i++)
-				{
-					if (i >= numSymbols)
-						return;
-					prices[st + i] = b0 + _midCoder[posState].GetPrice(i - Base.kNumLowLenSymbols);
-				}
-				for (; i < numSymbols; i++)
-					prices[st + i] = b1 + _highCoder.GetPrice(i - Base.kNumLowLenSymbols - Base.kNumMidLenSymbols);
-			}
-		};
-
-		const UInt32 kNumLenSpecSymbols = Base.kNumLowLenSymbols + Base.kNumMidLenSymbols;
-
-		class LenPriceTableEncoder : LenEncoder
-		{
-			UInt32[] _prices = new UInt32[Base.kNumLenSymbols << Base.kNumPosStatesBitsEncodingMax];
-			UInt32 _tableSize;
-			UInt32[] _counters = new UInt32[Base.kNumPosStatesEncodingMax];
-
-			public void SetTableSize(UInt32 tableSize) { _tableSize = tableSize; }
-
-			public UInt32 GetPrice(UInt32 symbol, UInt32 posState)
-			{
-				return _prices[posState * Base.kNumLenSymbols + symbol];
-			}
-
-			void UpdateTable(UInt32 posState)
-			{
-				SetPrices(posState, _tableSize, _prices, posState * Base.kNumLenSymbols);
-				_counters[posState] = _tableSize;
-			}
-
-			public void UpdateTables(UInt32 numPosStates)
-			{
-				for (UInt32 posState = 0; posState < numPosStates; posState++)
-					UpdateTable(posState);
-			}
-
-			public new void Encode(RangeCoder.Encoder rangeEncoder, UInt32 symbol, UInt32 posState)
-			{
-				base.Encode(rangeEncoder, symbol, posState);
-				if (--_counters[posState] == 0)
-					UpdateTable(posState);
-			}
-		}
-
-		const UInt32 kNumOpts = 1 << 12;
-		class Optimal
-		{
-			public Base.State State;
-
-			public bool Prev1IsChar;
-			public bool Prev2;
-
-			public UInt32 PosPrev2;
-			public UInt32 BackPrev2;
-
-			public UInt32 Price;
-			public UInt32 PosPrev;
-			public UInt32 BackPrev;
-
-			public UInt32 Backs0;
-			public UInt32 Backs1;
-			public UInt32 Backs2;
-			public UInt32 Backs3;
-
-			public void MakeAsChar() { BackPrev = 0xFFFFFFFF; Prev1IsChar = false; }
-			public void MakeAsShortRep() { BackPrev = 0; ; Prev1IsChar = false; }
-			public bool IsShortRep() { return (BackPrev == 0); }
-		};
-		Optimal[] _optimum = new Optimal[kNumOpts];
-		LZ.IMatchFinder _matchFinder = null;
-		RangeCoder.Encoder _rangeEncoder = new RangeCoder.Encoder();
-
-		RangeCoder.BitEncoder[] _isMatch = new RangeCoder.BitEncoder[Base.kNumStates << Base.kNumPosStatesBitsMax];
-		RangeCoder.BitEncoder[] _isRep = new RangeCoder.BitEncoder[Base.kNumStates];
-		RangeCoder.BitEncoder[] _isRepG0 = new RangeCoder.BitEncoder[Base.kNumStates];
-		RangeCoder.BitEncoder[] _isRepG1 = new RangeCoder.BitEncoder[Base.kNumStates];
-		RangeCoder.BitEncoder[] _isRepG2 = new RangeCoder.BitEncoder[Base.kNumStates];
-		RangeCoder.BitEncoder[] _isRep0Long = new RangeCoder.BitEncoder[Base.kNumStates << Base.kNumPosStatesBitsMax];
-
-		RangeCoder.BitTreeEncoder[] _posSlotEncoder = new RangeCoder.BitTreeEncoder[Base.kNumLenToPosStates];
-		
-		RangeCoder.BitEncoder[] _posEncoders = new RangeCoder.BitEncoder[Base.kNumFullDistances - Base.kEndPosModelIndex];
-		RangeCoder.BitTreeEncoder _posAlignEncoder = new RangeCoder.BitTreeEncoder(Base.kNumAlignBits);
-
-		LenPriceTableEncoder _lenEncoder = new LenPriceTableEncoder();
-		LenPriceTableEncoder _repMatchLenEncoder = new LenPriceTableEncoder();
-
-		LiteralEncoder _literalEncoder = new LiteralEncoder();
-
-		UInt32[] _matchDistances = new UInt32[Base.kMatchMaxLen * 2 + 2];
-		
-		UInt32 _numFastBytes = kNumFastBytesDefault;
-		UInt32 _longestMatchLength;
-		UInt32 _numDistancePairs;
-
-		UInt32 _additionalOffset;
-
-		UInt32 _optimumEndIndex;
-		UInt32 _optimumCurrentIndex;
-
-		bool _longestMatchWasFound;
-
-		UInt32[] _posSlotPrices = new UInt32[1 << (Base.kNumPosSlotBits + Base.kNumLenToPosStatesBits)];
-		UInt32[] _distancesPrices = new UInt32[Base.kNumFullDistances << Base.kNumLenToPosStatesBits];
-		UInt32[] _alignPrices = new UInt32[Base.kAlignTableSize];
-		UInt32 _alignPriceCount;
-
-		UInt32 _distTableSize = (kDefaultDictionaryLogSize * 2);
-
-		int _posStateBits = 2;
-		UInt32 _posStateMask = (4 - 1);
-		int _numLiteralPosStateBits = 0;
-		int _numLiteralContextBits = 3;
-
-		UInt32 _dictionarySize = (1 << kDefaultDictionaryLogSize);
-		UInt32 _dictionarySizePrev = 0xFFFFFFFF;
-		UInt32 _numFastBytesPrev = 0xFFFFFFFF;
-
-		Int64 nowPos64;
-		bool _finished;
-		System.IO.Stream _inStream;
-
-		EMatchFinderType _matchFinderType = EMatchFinderType.BT4;
-		bool _writeEndMark = false;
-		
-		bool _needReleaseMFStream;
-
-		void Create()
-		{
-			if (_matchFinder == null)
-			{
-				LZ.BinTree bt = new LZ.BinTree();
-				int numHashBytes = 4;
-				if (_matchFinderType == EMatchFinderType.BT2)
-					numHashBytes = 2;
-				bt.SetType(numHashBytes);
-				_matchFinder = bt;
-			}
-			_literalEncoder.Create(_numLiteralPosStateBits, _numLiteralContextBits);
-
-			if (_dictionarySize == _dictionarySizePrev && _numFastBytesPrev == _numFastBytes)
-				return;
-			_matchFinder.Create(_dictionarySize, kNumOpts, _numFastBytes, Base.kMatchMaxLen + 1);
-			_dictionarySizePrev = _dictionarySize;
-			_numFastBytesPrev = _numFastBytes;
-		}
-
-		public Encoder()
-		{
-			for (int i = 0; i < kNumOpts; i++)
-				_optimum[i] = new Optimal();
-			for (int i = 0; i < Base.kNumLenToPosStates; i++)
-				_posSlotEncoder[i] = new RangeCoder.BitTreeEncoder(Base.kNumPosSlotBits);
-		}
-
-		void SetWriteEndMarkerMode(bool writeEndMarker)
-		{
-			_writeEndMark = writeEndMarker;
-		}
-
-		void Init()
-		{
-			BaseInit();
-			_rangeEncoder.Init();
-
-			uint i;
-			for (i = 0; i < Base.kNumStates; i++)
-			{
-				for (uint j = 0; j <= _posStateMask; j++)
-				{
-					uint complexState = (i << Base.kNumPosStatesBitsMax) + j;
-					_isMatch[complexState].Init();
-					_isRep0Long[complexState].Init();
-				}
-				_isRep[i].Init();
-				_isRepG0[i].Init();
-				_isRepG1[i].Init();
-				_isRepG2[i].Init();
-			}
-			_literalEncoder.Init();
-			for (i = 0; i < Base.kNumLenToPosStates; i++)
-				_posSlotEncoder[i].Init();
-			for (i = 0; i < Base.kNumFullDistances - Base.kEndPosModelIndex; i++)
-				_posEncoders[i].Init();
-
-			_lenEncoder.Init((UInt32)1 << _posStateBits);
-			_repMatchLenEncoder.Init((UInt32)1 << _posStateBits);
-
-			_posAlignEncoder.Init();
-
-			_longestMatchWasFound = false;
-			_optimumEndIndex = 0;
-			_optimumCurrentIndex = 0;
-			_additionalOffset = 0;
-		}
-
-		void ReadMatchDistances(out UInt32 lenRes, out UInt32 numDistancePairs)
-		{
-			lenRes = 0;
-			numDistancePairs = _matchFinder.GetMatches(_matchDistances);
-			if (numDistancePairs > 0)
-			{
-				lenRes = _matchDistances[numDistancePairs - 2];
-				if (lenRes == _numFastBytes)
-					lenRes += _matchFinder.GetMatchLen((int)lenRes - 1, _matchDistances[numDistancePairs - 1],
-						Base.kMatchMaxLen - lenRes);
-			}
-			_additionalOffset++;
-		}
-
-
-		void MovePos(UInt32 num)
-		{
-			if (num > 0)
-			{
-				_matchFinder.Skip(num);
-				_additionalOffset += num;
-			}
-		}
-
-		UInt32 GetRepLen1Price(Base.State state, UInt32 posState)
-		{
-			return _isRepG0[state.Index].GetPrice0() +
-					_isRep0Long[(state.Index << Base.kNumPosStatesBitsMax) + posState].GetPrice0();
-		}
-
-		UInt32 GetPureRepPrice(UInt32 repIndex, Base.State state, UInt32 posState)
-		{
-			UInt32 price;
-			if (repIndex == 0)
-			{
-				price = _isRepG0[state.Index].GetPrice0();
-				price += _isRep0Long[(state.Index << Base.kNumPosStatesBitsMax) + posState].GetPrice1();
-			}
-			else
-			{
-				price = _isRepG0[state.Index].GetPrice1();
-				if (repIndex == 1)
-					price += _isRepG1[state.Index].GetPrice0();
-				else
-				{
-					price += _isRepG1[state.Index].GetPrice1();
-					price += _isRepG2[state.Index].GetPrice(repIndex - 2);
-				}
-			}
-			return price;
-		}
-
-		UInt32 GetRepPrice(UInt32 repIndex, UInt32 len, Base.State state, UInt32 posState)
-		{
-			UInt32 price = _repMatchLenEncoder.GetPrice(len - Base.kMatchMinLen, posState);
-			return price + GetPureRepPrice(repIndex, state, posState);
-		}
-	
-		UInt32 GetPosLenPrice(UInt32 pos, UInt32 len, UInt32 posState)
-		{
-			UInt32 price;
-			UInt32 lenToPosState = Base.GetLenToPosState(len);
-			if (pos < Base.kNumFullDistances)
-				price = _distancesPrices[(lenToPosState * Base.kNumFullDistances) + pos];
-			else
-				price = _posSlotPrices[(lenToPosState << Base.kNumPosSlotBits) + GetPosSlot2(pos)] +
-					_alignPrices[pos & Base.kAlignMask];
-			return price + _lenEncoder.GetPrice(len - Base.kMatchMinLen, posState);
-		}
-
-		UInt32 Backward(out UInt32 backRes, UInt32 cur)
-		{
-			_optimumEndIndex = cur;
-			UInt32 posMem = _optimum[cur].PosPrev;
-			UInt32 backMem = _optimum[cur].BackPrev;
-			do
-			{
-				if (_optimum[cur].Prev1IsChar)
-				{
-					_optimum[posMem].MakeAsChar();
-					_optimum[posMem].PosPrev = posMem - 1;
-					if (_optimum[cur].Prev2)
-					{
-						_optimum[posMem - 1].Prev1IsChar = false;
-						_optimum[posMem - 1].PosPrev = _optimum[cur].PosPrev2;
-						_optimum[posMem - 1].BackPrev = _optimum[cur].BackPrev2;
-					}
-				}
-				UInt32 posPrev = posMem;
-				UInt32 backCur = backMem;
-
-				backMem = _optimum[posPrev].BackPrev;
-				posMem = _optimum[posPrev].PosPrev;
-
-				_optimum[posPrev].BackPrev = backCur;
-				_optimum[posPrev].PosPrev = cur;
-				cur = posPrev;
-			}
-			while (cur > 0);
-			backRes = _optimum[0].BackPrev;
-			_optimumCurrentIndex = _optimum[0].PosPrev;
-			return _optimumCurrentIndex;
-		}
-
-		UInt32[] reps = new UInt32[Base.kNumRepDistances];
-		UInt32[] repLens = new UInt32[Base.kNumRepDistances];
-
-
-		UInt32 GetOptimum(UInt32 position, out UInt32 backRes)
-		{
-			if (_optimumEndIndex != _optimumCurrentIndex)
-			{
-				UInt32 lenRes = _optimum[_optimumCurrentIndex].PosPrev - _optimumCurrentIndex;
-				backRes = _optimum[_optimumCurrentIndex].BackPrev;
-				_optimumCurrentIndex = _optimum[_optimumCurrentIndex].PosPrev;
-				return lenRes;
-			}
-			_optimumCurrentIndex = _optimumEndIndex = 0;
-
-			UInt32 lenMain, numDistancePairs;
-			if (!_longestMatchWasFound)
-			{
-				ReadMatchDistances(out lenMain, out numDistancePairs);
-			}
-			else
-			{
-				lenMain = _longestMatchLength;
-				numDistancePairs = _numDistancePairs;
-				_longestMatchWasFound = false;
-			}
-
-			UInt32 numAvailableBytes = _matchFinder.GetNumAvailableBytes() + 1;
-			if (numAvailableBytes < 2)
-			{
-				backRes = 0xFFFFFFFF;
-				return 1;
-			}
-			if (numAvailableBytes > Base.kMatchMaxLen)
-				numAvailableBytes = Base.kMatchMaxLen;
-
-			UInt32 repMaxIndex = 0;
-			UInt32 i;			
-			for (i = 0; i < Base.kNumRepDistances; i++)
-			{
-				reps[i] = _repDistances[i];
-				repLens[i] = _matchFinder.GetMatchLen(0 - 1, reps[i], Base.kMatchMaxLen);
-				if (repLens[i] > repLens[repMaxIndex])
-					repMaxIndex = i;
-			}
-			if (repLens[repMaxIndex] >= _numFastBytes)
-			{
-				backRes = repMaxIndex;
-				UInt32 lenRes = repLens[repMaxIndex];
-				MovePos(lenRes - 1);
-				return lenRes;
-			}
-
-			if (lenMain >= _numFastBytes)
-			{
-				backRes = _matchDistances[numDistancePairs - 1] + Base.kNumRepDistances;
-				MovePos(lenMain - 1);
-				return lenMain;
-			}
-			
-			Byte currentByte = _matchFinder.GetIndexByte(0 - 1);
-			Byte matchByte = _matchFinder.GetIndexByte((Int32)(0 - _repDistances[0] - 1 - 1));
-
-			if (lenMain < 2 && currentByte != matchByte && repLens[repMaxIndex] < 2)
-			{
-				backRes = (UInt32)0xFFFFFFFF;
-				return 1;
-			}
-
-			_optimum[0].State = _state;
-
-			UInt32 posState = (position & _posStateMask);
-
-			_optimum[1].Price = _isMatch[(_state.Index << Base.kNumPosStatesBitsMax) + posState].GetPrice0() +
-					_literalEncoder.GetSubCoder(position, _previousByte).GetPrice(!_state.IsCharState(), matchByte, currentByte);
-			_optimum[1].MakeAsChar();
-
-			UInt32 matchPrice = _isMatch[(_state.Index << Base.kNumPosStatesBitsMax) + posState].GetPrice1();
-			UInt32 repMatchPrice = matchPrice + _isRep[_state.Index].GetPrice1();
-
-			if (matchByte == currentByte)
-			{
-				UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(_state, posState);
-				if (shortRepPrice < _optimum[1].Price)
-				{
-					_optimum[1].Price = shortRepPrice;
-					_optimum[1].MakeAsShortRep();
-				}
-			}
-
-			UInt32 lenEnd = ((lenMain >= repLens[repMaxIndex]) ? lenMain : repLens[repMaxIndex]);
-
-			if(lenEnd < 2)
-			{
-				backRes = _optimum[1].BackPrev;
-				return 1;
-			}
-			
-			_optimum[1].PosPrev = 0;
-
-			_optimum[0].Backs0 = reps[0];
-			_optimum[0].Backs1 = reps[1];
-			_optimum[0].Backs2 = reps[2];
-			_optimum[0].Backs3 = reps[3];
-
-			UInt32 len = lenEnd;
-			do
-				_optimum[len--].Price = kIfinityPrice;
-			while (len >= 2);
-
-			for (i = 0; i < Base.kNumRepDistances; i++)
-			{
-				UInt32 repLen = repLens[i];
-				if (repLen < 2)
-					continue;
-				UInt32 price = repMatchPrice + GetPureRepPrice(i, _state, posState);
-				do
-				{
-					UInt32 curAndLenPrice = price + _repMatchLenEncoder.GetPrice(repLen - 2, posState);
-					Optimal optimum = _optimum[repLen];
-					if (curAndLenPrice < optimum.Price)
-					{
-						optimum.Price = curAndLenPrice;
-						optimum.PosPrev = 0;
-						optimum.BackPrev = i;
-						optimum.Prev1IsChar = false;
-					}
-				}
-				while (--repLen >= 2);
-			}
-
-			UInt32 normalMatchPrice = matchPrice + _isRep[_state.Index].GetPrice0();
-			
-			len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2);
-			if (len <= lenMain)
-			{
-				UInt32 offs = 0;
-				while (len > _matchDistances[offs])
-					offs += 2;
-				for (; ; len++)
-				{
-					UInt32 distance = _matchDistances[offs + 1];
-					UInt32 curAndLenPrice = normalMatchPrice + GetPosLenPrice(distance, len, posState);
-					Optimal optimum = _optimum[len];
-					if (curAndLenPrice < optimum.Price)
-					{
-						optimum.Price = curAndLenPrice;
-						optimum.PosPrev = 0;
-						optimum.BackPrev = distance + Base.kNumRepDistances;
-						optimum.Prev1IsChar = false;
-					}
-					if (len == _matchDistances[offs])
-					{
-						offs += 2;
-						if (offs == numDistancePairs)
-							break;
-					}
-				}
-			}
-
-			UInt32 cur = 0;
-
-			while (true)
-			{
-				cur++;
-				if (cur == lenEnd)
-					return Backward(out backRes, cur);
-				UInt32 newLen;
-				ReadMatchDistances(out newLen, out numDistancePairs);
-				if (newLen >= _numFastBytes)
-				{
-					_numDistancePairs = numDistancePairs;
-					_longestMatchLength = newLen;
-					_longestMatchWasFound = true;
-					return Backward(out backRes, cur);
-				}
-				position++;
-				UInt32 posPrev = _optimum[cur].PosPrev;
-				Base.State state;
-				if (_optimum[cur].Prev1IsChar)
-				{
-					posPrev--;
-					if (_optimum[cur].Prev2)
-					{
-						state = _optimum[_optimum[cur].PosPrev2].State;
-						if (_optimum[cur].BackPrev2 < Base.kNumRepDistances)
-							state.UpdateRep();
-						else
-							state.UpdateMatch();
-					}
-					else
-						state = _optimum[posPrev].State;
-					state.UpdateChar();
-				}
-				else
-					state = _optimum[posPrev].State;
-				if (posPrev == cur - 1)
-				{
-					if (_optimum[cur].IsShortRep())
-						state.UpdateShortRep();
-					else
-						state.UpdateChar();
-				}
-				else
-				{
-					UInt32 pos;
-					if (_optimum[cur].Prev1IsChar && _optimum[cur].Prev2)
-					{
-						posPrev = _optimum[cur].PosPrev2;
-						pos = _optimum[cur].BackPrev2;
-						state.UpdateRep();
-					}
-					else
-					{
-						pos = _optimum[cur].BackPrev;
-						if (pos < Base.kNumRepDistances)
-							state.UpdateRep();
-						else
-							state.UpdateMatch();
-					}
-					Optimal opt = _optimum[posPrev];
-					if (pos < Base.kNumRepDistances)
-					{
-						if (pos == 0)
-						{
-							reps[0] = opt.Backs0;
-							reps[1] = opt.Backs1;
-							reps[2] = opt.Backs2;
-							reps[3] = opt.Backs3;
-						}
-						else if (pos == 1)
-						{
-							reps[0] = opt.Backs1;
-							reps[1] = opt.Backs0;
-							reps[2] = opt.Backs2;
-							reps[3] = opt.Backs3;
-						}
-						else if (pos == 2)
-						{
-							reps[0] = opt.Backs2;
-							reps[1] = opt.Backs0;
-							reps[2] = opt.Backs1;
-							reps[3] = opt.Backs3;
-						}
-						else
-						{
-							reps[0] = opt.Backs3;
-							reps[1] = opt.Backs0;
-							reps[2] = opt.Backs1;
-							reps[3] = opt.Backs2;
-						}
-					}
-					else
-					{
-						reps[0] = (pos - Base.kNumRepDistances);
-						reps[1] = opt.Backs0;
-						reps[2] = opt.Backs1;
-						reps[3] = opt.Backs2;
-					}
-				}
-				_optimum[cur].State = state;
-				_optimum[cur].Backs0 = reps[0];
-				_optimum[cur].Backs1 = reps[1];
-				_optimum[cur].Backs2 = reps[2];
-				_optimum[cur].Backs3 = reps[3];
-				UInt32 curPrice = _optimum[cur].Price;
-
-				currentByte = _matchFinder.GetIndexByte(0 - 1);
-				matchByte = _matchFinder.GetIndexByte((Int32)(0 - reps[0] - 1 - 1));
-
-				posState = (position & _posStateMask);
-
-				UInt32 curAnd1Price = curPrice +
-					_isMatch[(state.Index << Base.kNumPosStatesBitsMax) + posState].GetPrice0() +
-					_literalEncoder.GetSubCoder(position, _matchFinder.GetIndexByte(0 - 2)).
-					GetPrice(!state.IsCharState(), matchByte, currentByte);
-
-				Optimal nextOptimum = _optimum[cur + 1];
-
-				bool nextIsChar = false;
-				if (curAnd1Price < nextOptimum.Price)
-				{
-					nextOptimum.Price = curAnd1Price;
-					nextOptimum.PosPrev = cur;
-					nextOptimum.MakeAsChar();
-					nextIsChar = true;
-				}
-
-				matchPrice = curPrice + _isMatch[(state.Index << Base.kNumPosStatesBitsMax) + posState].GetPrice1();
-				repMatchPrice = matchPrice + _isRep[state.Index].GetPrice1();
-
-				if (matchByte == currentByte &&
-					!(nextOptimum.PosPrev < cur && nextOptimum.BackPrev == 0))
-				{
-					UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(state, posState);
-					if (shortRepPrice <= nextOptimum.Price)
-					{
-						nextOptimum.Price = shortRepPrice;
-						nextOptimum.PosPrev = cur;
-						nextOptimum.MakeAsShortRep();
-						nextIsChar = true;
-					}
-				}
-
-				UInt32 numAvailableBytesFull = _matchFinder.GetNumAvailableBytes() + 1;
-				numAvailableBytesFull = Math.Min(kNumOpts - 1 - cur, numAvailableBytesFull);
-				numAvailableBytes = numAvailableBytesFull;
-
-				if (numAvailableBytes < 2)
-					continue;
-				if (numAvailableBytes > _numFastBytes)
-					numAvailableBytes = _numFastBytes;
-				if (!nextIsChar && matchByte != currentByte)
-				{
-					// try Literal + rep0
-					UInt32 t = Math.Min(numAvailableBytesFull - 1, _numFastBytes);
-					UInt32 lenTest2 = _matchFinder.GetMatchLen(0, reps[0], t);
-					if (lenTest2 >= 2)
-					{
-						Base.State state2 = state;
-						state2.UpdateChar();
-						UInt32 posStateNext = (position + 1) & _posStateMask;
-						UInt32 nextRepMatchPrice = curAnd1Price +
-							_isMatch[(state2.Index << Base.kNumPosStatesBitsMax) + posStateNext].GetPrice1() +
-							_isRep[state2.Index].GetPrice1();
-						{
-							UInt32 offset = cur + 1 + lenTest2;
-							while (lenEnd < offset)
-								_optimum[++lenEnd].Price = kIfinityPrice;
-							UInt32 curAndLenPrice = nextRepMatchPrice + GetRepPrice(
-								0, lenTest2, state2, posStateNext);
-							Optimal optimum = _optimum[offset];
-							if (curAndLenPrice < optimum.Price)
-							{
-								optimum.Price = curAndLenPrice;
-								optimum.PosPrev = cur + 1;
-								optimum.BackPrev = 0;
-								optimum.Prev1IsChar = true;
-								optimum.Prev2 = false;
-							}
-						}
-					}
-				}
-
-				UInt32 startLen = 2; // speed optimization 
-
-				for (UInt32 repIndex = 0; repIndex < Base.kNumRepDistances; repIndex++)
-				{
-					UInt32 lenTest = _matchFinder.GetMatchLen(0 - 1, reps[repIndex], numAvailableBytes);
-					if (lenTest < 2)
-						continue;
-					UInt32 lenTestTemp = lenTest;
-					do
-					{
-						while (lenEnd < cur + lenTest)
-							_optimum[++lenEnd].Price = kIfinityPrice;
-						UInt32 curAndLenPrice = repMatchPrice + GetRepPrice(repIndex, lenTest, state, posState);
-						Optimal optimum = _optimum[cur + lenTest];
-						if (curAndLenPrice < optimum.Price)
-						{
-							optimum.Price = curAndLenPrice;
-							optimum.PosPrev = cur;
-							optimum.BackPrev = repIndex;
-							optimum.Prev1IsChar = false;
-						}
-					}
-					while(--lenTest >= 2);
-					lenTest = lenTestTemp;
-
-					if (repIndex == 0)
-						startLen = lenTest + 1;
-
-					// if (_maxMode)
-					if (lenTest < numAvailableBytesFull)
-					{
-						UInt32 t = Math.Min(numAvailableBytesFull - 1 - lenTest, _numFastBytes);
-						UInt32 lenTest2 = _matchFinder.GetMatchLen((Int32)lenTest, reps[repIndex], t);
-						if (lenTest2 >= 2)
-						{
-							Base.State state2 = state;
-							state2.UpdateRep();
-							UInt32 posStateNext = (position + lenTest) & _posStateMask;
-							UInt32 curAndLenCharPrice = 
-									repMatchPrice + GetRepPrice(repIndex, lenTest, state, posState) + 
-									_isMatch[(state2.Index << Base.kNumPosStatesBitsMax) + posStateNext].GetPrice0() +
-									_literalEncoder.GetSubCoder(position + lenTest, 
-									_matchFinder.GetIndexByte((Int32)lenTest - 1 - 1)).GetPrice(true,
-									_matchFinder.GetIndexByte((Int32)((Int32)lenTest - 1 - (Int32)(reps[repIndex] + 1))), 
-									_matchFinder.GetIndexByte((Int32)lenTest - 1));
-							state2.UpdateChar();
-							posStateNext = (position + lenTest + 1) & _posStateMask;
-							UInt32 nextMatchPrice = curAndLenCharPrice + _isMatch[(state2.Index << Base.kNumPosStatesBitsMax) + posStateNext].GetPrice1();
-							UInt32 nextRepMatchPrice = nextMatchPrice + _isRep[state2.Index].GetPrice1();
-							
-							// for(; lenTest2 >= 2; lenTest2--)
-							{
-								UInt32 offset = lenTest + 1 + lenTest2;
-								while(lenEnd < cur + offset)
-									_optimum[++lenEnd].Price = kIfinityPrice;
-								UInt32 curAndLenPrice = nextRepMatchPrice + GetRepPrice(0, lenTest2, state2, posStateNext);
-								Optimal optimum = _optimum[cur + offset];
-								if (curAndLenPrice < optimum.Price) 
-								{
-									optimum.Price = curAndLenPrice;
-									optimum.PosPrev = cur + lenTest + 1;
-									optimum.BackPrev = 0;
-									optimum.Prev1IsChar = true;
-									optimum.Prev2 = true;
-									optimum.PosPrev2 = cur;
-									optimum.BackPrev2 = repIndex;
-								}
-							}
-						}
-					}
-				}
-
-				if (newLen > numAvailableBytes)
-				{
-					newLen = numAvailableBytes;
-					for (numDistancePairs = 0; newLen > _matchDistances[numDistancePairs]; numDistancePairs += 2) ;
-					_matchDistances[numDistancePairs] = newLen;
-					numDistancePairs += 2;
-				}
-				if (newLen >= startLen)
-				{
-					normalMatchPrice = matchPrice + _isRep[state.Index].GetPrice0();
-					while (lenEnd < cur + newLen)
-						_optimum[++lenEnd].Price = kIfinityPrice;
-
-					UInt32 offs = 0;
-					while (startLen > _matchDistances[offs])
-						offs += 2;
-
-					for (UInt32 lenTest = startLen; ; lenTest++)
-					{
-						UInt32 curBack = _matchDistances[offs + 1];
-						UInt32 curAndLenPrice = normalMatchPrice + GetPosLenPrice(curBack, lenTest, posState);
-						Optimal optimum = _optimum[cur + lenTest];
-						if (curAndLenPrice < optimum.Price)
-						{
-							optimum.Price = curAndLenPrice;
-							optimum.PosPrev = cur;
-							optimum.BackPrev = curBack + Base.kNumRepDistances;
-							optimum.Prev1IsChar = false;
-						}
-
-						if (lenTest == _matchDistances[offs])
-						{
-							if (lenTest < numAvailableBytesFull)
-							{
-								UInt32 t = Math.Min(numAvailableBytesFull - 1 - lenTest, _numFastBytes);
-								UInt32 lenTest2 = _matchFinder.GetMatchLen((Int32)lenTest, curBack, t);
-								if (lenTest2 >= 2)
-								{
-									Base.State state2 = state;
-									state2.UpdateMatch();
-									UInt32 posStateNext = (position + lenTest) & _posStateMask;
-									UInt32 curAndLenCharPrice = curAndLenPrice +
-										_isMatch[(state2.Index << Base.kNumPosStatesBitsMax) + posStateNext].GetPrice0() +
-										_literalEncoder.GetSubCoder(position + lenTest,
-										_matchFinder.GetIndexByte((Int32)lenTest - 1 - 1)).
-										GetPrice(true,
-										_matchFinder.GetIndexByte((Int32)lenTest - (Int32)(curBack + 1) - 1),
-										_matchFinder.GetIndexByte((Int32)lenTest - 1));
-									state2.UpdateChar();
-									posStateNext = (position + lenTest + 1) & _posStateMask;
-									UInt32 nextMatchPrice = curAndLenCharPrice + _isMatch[(state2.Index << Base.kNumPosStatesBitsMax) + posStateNext].GetPrice1();
-									UInt32 nextRepMatchPrice = nextMatchPrice + _isRep[state2.Index].GetPrice1();
-
-									UInt32 offset = lenTest + 1 + lenTest2;
-									while (lenEnd < cur + offset)
-										_optimum[++lenEnd].Price = kIfinityPrice;
-									curAndLenPrice = nextRepMatchPrice + GetRepPrice(0, lenTest2, state2, posStateNext);
-									optimum = _optimum[cur + offset];
-									if (curAndLenPrice < optimum.Price)
-									{
-										optimum.Price = curAndLenPrice;
-										optimum.PosPrev = cur + lenTest + 1;
-										optimum.BackPrev = 0;
-										optimum.Prev1IsChar = true;
-										optimum.Prev2 = true;
-										optimum.PosPrev2 = cur;
-										optimum.BackPrev2 = curBack + Base.kNumRepDistances;
-									}
-								}
-							}
-							offs += 2;
-							if (offs == numDistancePairs)
-								break;
-						}
-					}
-				}
-			}
-		}
-
-		bool ChangePair(UInt32 smallDist, UInt32 bigDist)
-		{
-			const int kDif = 7;
-			return (smallDist < ((UInt32)(1) << (32 - kDif)) && bigDist >= (smallDist << kDif));
-		}
-
-		void WriteEndMarker(UInt32 posState)
-		{
-			if (!_writeEndMark)
-				return;
-
-			_isMatch[(_state.Index << Base.kNumPosStatesBitsMax) + posState].Encode(_rangeEncoder, 1);
-			_isRep[_state.Index].Encode(_rangeEncoder, 0);
-			_state.UpdateMatch();
-			UInt32 len = Base.kMatchMinLen;
-			_lenEncoder.Encode(_rangeEncoder, len - Base.kMatchMinLen, posState);
-			UInt32 posSlot = (1 << Base.kNumPosSlotBits) - 1;
-			UInt32 lenToPosState = Base.GetLenToPosState(len);
-			_posSlotEncoder[lenToPosState].Encode(_rangeEncoder, posSlot);
-			int footerBits = 30;
-			UInt32 posReduced = (((UInt32)1) << footerBits) - 1;
-			_rangeEncoder.EncodeDirectBits(posReduced >> Base.kNumAlignBits, footerBits - Base.kNumAlignBits);
-			_posAlignEncoder.ReverseEncode(_rangeEncoder, posReduced & Base.kAlignMask);
-		}
-
-		void Flush(UInt32 nowPos)
-		{
-			ReleaseMFStream();
-			WriteEndMarker(nowPos & _posStateMask);
-			_rangeEncoder.FlushData();
-			_rangeEncoder.FlushStream();
-		}
-
-		public void CodeOneBlock(out Int64 inSize, out Int64 outSize, out bool finished)
-		{
-			inSize = 0;
-			outSize = 0;
-			finished = true;
-
-			if (_inStream != null)
-			{
-				_matchFinder.SetStream(_inStream);
-				_matchFinder.Init();
-				_needReleaseMFStream = true;
-				_inStream = null;
-				if (_trainSize > 0)
-					_matchFinder.Skip(_trainSize);
-			}
-
-			if (_finished)
-				return;
-			_finished = true;
-
-
-			Int64 progressPosValuePrev = nowPos64;
-			if (nowPos64 == 0)
-			{
-				if (_matchFinder.GetNumAvailableBytes() == 0)
-				{
-					Flush((UInt32)nowPos64);
-					return;
-				}
-				UInt32 len, numDistancePairs; // it's not used
-				ReadMatchDistances(out len, out numDistancePairs);
-				UInt32 posState = (UInt32)(nowPos64) & _posStateMask;
-				_isMatch[(_state.Index << Base.kNumPosStatesBitsMax) + posState].Encode(_rangeEncoder, 0);
-				_state.UpdateChar();
-				Byte curByte = _matchFinder.GetIndexByte((Int32)(0 - _additionalOffset));
-				_literalEncoder.GetSubCoder((UInt32)(nowPos64), _previousByte).Encode(_rangeEncoder, curByte);
-				_previousByte = curByte;
-				_additionalOffset--;
-				nowPos64++;
-			}
-			if (_matchFinder.GetNumAvailableBytes() == 0)
-			{
-				Flush((UInt32)nowPos64);
-				return;
-			}
-			while (true)
-			{
-				UInt32 pos;
-				UInt32 len = GetOptimum((UInt32)nowPos64, out pos);
-				
-				UInt32 posState = ((UInt32)nowPos64) & _posStateMask;
-				UInt32 complexState = (_state.Index << Base.kNumPosStatesBitsMax) + posState;
-				if (len == 1 && pos == 0xFFFFFFFF)
-				{
-					_isMatch[complexState].Encode(_rangeEncoder, 0);
-					Byte curByte = _matchFinder.GetIndexByte((Int32)(0 - _additionalOffset));
-					LiteralEncoder.Encoder2 subCoder = _literalEncoder.GetSubCoder((UInt32)nowPos64, _previousByte);
-					if (!_state.IsCharState())
-					{
-						Byte matchByte = _matchFinder.GetIndexByte((Int32)(0 - _repDistances[0] - 1 - _additionalOffset));
-						subCoder.EncodeMatched(_rangeEncoder, matchByte, curByte);
-					}
-					else
-						subCoder.Encode(_rangeEncoder, curByte);
-					_previousByte = curByte;
-					_state.UpdateChar();
-				}
-				else
-				{
-					_isMatch[complexState].Encode(_rangeEncoder, 1);
-					if (pos < Base.kNumRepDistances)
-					{
-						_isRep[_state.Index].Encode(_rangeEncoder, 1);
-						if (pos == 0)
-						{
-							_isRepG0[_state.Index].Encode(_rangeEncoder, 0);
-							if (len == 1)
-								_isRep0Long[complexState].Encode(_rangeEncoder, 0);
-							else
-								_isRep0Long[complexState].Encode(_rangeEncoder, 1);
-						}
-						else
-						{
-							_isRepG0[_state.Index].Encode(_rangeEncoder, 1);
-							if (pos == 1)
-								_isRepG1[_state.Index].Encode(_rangeEncoder, 0);
-							else
-							{
-								_isRepG1[_state.Index].Encode(_rangeEncoder, 1);
-								_isRepG2[_state.Index].Encode(_rangeEncoder, pos - 2);
-							}
-						}
-						if (len == 1)
-							_state.UpdateShortRep();
-						else
-						{
-							_repMatchLenEncoder.Encode(_rangeEncoder, len - Base.kMatchMinLen, posState);
-							_state.UpdateRep();
-						}
-						UInt32 distance = _repDistances[pos];
-						if (pos != 0)
-						{
-							for (UInt32 i = pos; i >= 1; i--)
-								_repDistances[i] = _repDistances[i - 1];
-							_repDistances[0] = distance;
-						}
-					}
-					else
-					{
-						_isRep[_state.Index].Encode(_rangeEncoder, 0);
-						_state.UpdateMatch();
-						_lenEncoder.Encode(_rangeEncoder, len - Base.kMatchMinLen, posState);
-						pos -= Base.kNumRepDistances;
-						UInt32 posSlot = GetPosSlot(pos);
-						UInt32 lenToPosState = Base.GetLenToPosState(len);
-						_posSlotEncoder[lenToPosState].Encode(_rangeEncoder, posSlot);
-
-						if (posSlot >= Base.kStartPosModelIndex)
-						{
-							int footerBits = (int)((posSlot >> 1) - 1);
-							UInt32 baseVal = ((2 | (posSlot & 1)) << footerBits);
-							UInt32 posReduced = pos - baseVal;
-
-							if (posSlot < Base.kEndPosModelIndex)
-								RangeCoder.BitTreeEncoder.ReverseEncode(_posEncoders,
-										baseVal - posSlot - 1, _rangeEncoder, footerBits, posReduced);
-							else
-							{
-								_rangeEncoder.EncodeDirectBits(posReduced >> Base.kNumAlignBits, footerBits - Base.kNumAlignBits);
-								_posAlignEncoder.ReverseEncode(_rangeEncoder, posReduced & Base.kAlignMask);
-								_alignPriceCount++;
-							}
-						}
-						UInt32 distance = pos;
-						for (UInt32 i = Base.kNumRepDistances - 1; i >= 1; i--)
-							_repDistances[i] = _repDistances[i - 1];
-						_repDistances[0] = distance;
-						_matchPriceCount++;
-					}
-					_previousByte = _matchFinder.GetIndexByte((Int32)(len - 1 - _additionalOffset));
-				}
-				_additionalOffset -= len;
-				nowPos64 += len;
-				if (_additionalOffset == 0)
-				{
-					// if (!_fastMode)
-					if (_matchPriceCount >= (1 << 7))
-						FillDistancesPrices();
-					if (_alignPriceCount >= Base.kAlignTableSize)
-						FillAlignPrices();
-					inSize = nowPos64;
-					outSize = _rangeEncoder.GetProcessedSizeAdd();
-					if (_matchFinder.GetNumAvailableBytes() == 0)
-					{
-						Flush((UInt32)nowPos64);
-						return;
-					}
-
-					if (nowPos64 - progressPosValuePrev >= (1 << 12))
-					{
-						_finished = false;
-						finished = false;
-						return;
-					}
-				}
-			}
-		}
-
-		void ReleaseMFStream()
-		{
-			if (_matchFinder != null && _needReleaseMFStream)
-			{
-				_matchFinder.ReleaseStream();
-				_needReleaseMFStream = false;
-			}
-		}
-
-		void SetOutStream(System.IO.Stream outStream) { _rangeEncoder.SetStream(outStream); }
-		void ReleaseOutStream() { _rangeEncoder.ReleaseStream(); }
-
-		void ReleaseStreams()
-		{
-			ReleaseMFStream();
-			ReleaseOutStream();
-		}
-
-		void SetStreams(System.IO.Stream inStream, System.IO.Stream outStream,
-				Int64 inSize, Int64 outSize)
-		{
-			_inStream = inStream;
-			_finished = false;
-			Create();
-			SetOutStream(outStream);
-			Init();
-
-			// if (!_fastMode)
-			{
-				FillDistancesPrices();
-				FillAlignPrices();
-			}
-
-			_lenEncoder.SetTableSize(_numFastBytes + 1 - Base.kMatchMinLen);
-			_lenEncoder.UpdateTables((UInt32)1 << _posStateBits);
-			_repMatchLenEncoder.SetTableSize(_numFastBytes + 1 - Base.kMatchMinLen);
-			_repMatchLenEncoder.UpdateTables((UInt32)1 << _posStateBits);
-
-			nowPos64 = 0;
-		}
-
-
-		public void Code(System.IO.Stream inStream, System.IO.Stream outStream,
-			Int64 inSize, Int64 outSize, ICodeProgress progress)
-		{
-			_needReleaseMFStream = false;
-			try
-			{
-				SetStreams(inStream, outStream, inSize, outSize);
-				while (true)
-				{
-					Int64 processedInSize;
-					Int64 processedOutSize;
-					bool finished;
-					CodeOneBlock(out processedInSize, out processedOutSize, out finished);
-					if (finished)
-						return;
-					if (progress != null)
-					{
-						progress.SetProgress(processedInSize, processedOutSize);
-					}
-				}
-			}
-			finally
-			{
-				ReleaseStreams();
-			}
-		}
-
-		const int kPropSize = 5;
-		Byte[] properties = new Byte[kPropSize];
-
-		public void WriteCoderProperties(System.IO.Stream outStream)
-		{
-			properties[0] = (Byte)((_posStateBits * 5 + _numLiteralPosStateBits) * 9 + _numLiteralContextBits);
-			for (int i = 0; i < 4; i++)
-				properties[1 + i] = (Byte)(_dictionarySize >> (8 * i));
-			outStream.Write(properties, 0, kPropSize);
-		}
-		
-		UInt32[] tempPrices = new UInt32[Base.kNumFullDistances];
-		UInt32 _matchPriceCount;
-
-		void FillDistancesPrices()
-		{
-			for (UInt32 i = Base.kStartPosModelIndex; i < Base.kNumFullDistances; i++)
-			{ 
-				UInt32 posSlot = GetPosSlot(i);
-				int footerBits = (int)((posSlot >> 1) - 1);
-				UInt32 baseVal = ((2 | (posSlot & 1)) << footerBits);
-				tempPrices[i] = BitTreeEncoder.ReverseGetPrice(_posEncoders, 
-					baseVal - posSlot - 1, footerBits, i - baseVal);
-			}
-
-			for (UInt32 lenToPosState = 0; lenToPosState < Base.kNumLenToPosStates; lenToPosState++)
-			{
-				UInt32 posSlot;
-				RangeCoder.BitTreeEncoder encoder = _posSlotEncoder[lenToPosState];
-			
-				UInt32 st = (lenToPosState << Base.kNumPosSlotBits);
-				for (posSlot = 0; posSlot < _distTableSize; posSlot++)
-					_posSlotPrices[st + posSlot] = encoder.GetPrice(posSlot);
-				for (posSlot = Base.kEndPosModelIndex; posSlot < _distTableSize; posSlot++)
-					_posSlotPrices[st + posSlot] += ((((posSlot >> 1) - 1) - Base.kNumAlignBits) << RangeCoder.BitEncoder.kNumBitPriceShiftBits);
-
-				UInt32 st2 = lenToPosState * Base.kNumFullDistances;
-				UInt32 i;
-				for (i = 0; i < Base.kStartPosModelIndex; i++)
-					_distancesPrices[st2 + i] = _posSlotPrices[st + i];
-				for (; i < Base.kNumFullDistances; i++)
-					_distancesPrices[st2 + i] = _posSlotPrices[st + GetPosSlot(i)] + tempPrices[i];
-			}
-			_matchPriceCount = 0;
-		}
-
-		void FillAlignPrices()
-		{
-			for (UInt32 i = 0; i < Base.kAlignTableSize; i++)
-				_alignPrices[i] = _posAlignEncoder.ReverseGetPrice(i);
-			_alignPriceCount = 0;
-		}
-
-
-		static string[] kMatchFinderIDs = 
-		{
-			"BT2",
-			"BT4",
-		};
-
-		static int FindMatchFinder(string s)
-		{
-			for (int m = 0; m < kMatchFinderIDs.Length; m++)
-				if (s == kMatchFinderIDs[m])
-					return m;
-			return -1;
-		}
-	
-		public void SetCoderProperties(CoderPropID[] propIDs, object[] properties)
-		{
-			for (UInt32 i = 0; i < properties.Length; i++)
-			{
-				object prop = properties[i];
-				switch (propIDs[i])
-				{
-					case CoderPropID.NumFastBytes:
-					{
-						if (!(prop is Int32))
-							throw new InvalidParamException();
-						Int32 numFastBytes = (Int32)prop;
-						if (numFastBytes < 5 || numFastBytes > Base.kMatchMaxLen)
-							throw new InvalidParamException();
-						_numFastBytes = (UInt32)numFastBytes;
-						break;
-					}
-					case CoderPropID.Algorithm:
-					{
-						/*
-						if (!(prop is Int32))
-							throw new InvalidParamException();
-						Int32 maximize = (Int32)prop;
-						_fastMode = (maximize == 0);
-						_maxMode = (maximize >= 2);
-						*/
-						break;
-					}
-					case CoderPropID.MatchFinder:
-					{
-						if (!(prop is String))
-							throw new InvalidParamException();
-						EMatchFinderType matchFinderIndexPrev = _matchFinderType;
-						int m = FindMatchFinder(((string)prop).ToUpper());
-						if (m < 0)
-							throw new InvalidParamException();
-						_matchFinderType = (EMatchFinderType)m;
-						if (_matchFinder != null && matchFinderIndexPrev != _matchFinderType)
-							{
-							_dictionarySizePrev = 0xFFFFFFFF;
-							_matchFinder = null;
-							}
-						break;
-					}
-					case CoderPropID.DictionarySize:
-					{
-						const int kDicLogSizeMaxCompress = 30;
-						if (!(prop is Int32))
-							throw new InvalidParamException(); ;
-						Int32 dictionarySize = (Int32)prop;
-						if (dictionarySize < (UInt32)(1 << Base.kDicLogSizeMin) ||
-							dictionarySize > (UInt32)(1 << kDicLogSizeMaxCompress))
-							throw new InvalidParamException();
-						_dictionarySize = (UInt32)dictionarySize;
-						int dicLogSize;
-						for (dicLogSize = 0; dicLogSize < (UInt32)kDicLogSizeMaxCompress; dicLogSize++)
-							if (dictionarySize <= ((UInt32)(1) << dicLogSize))
-								break;
-						_distTableSize = (UInt32)dicLogSize * 2;
-						break;
-					}
-					case CoderPropID.PosStateBits:
-					{
-						if (!(prop is Int32))
-							throw new InvalidParamException();
-						Int32 v = (Int32)prop;
-						if (v < 0 || v > (UInt32)Base.kNumPosStatesBitsEncodingMax)
-							throw new InvalidParamException();
-						_posStateBits = (int)v;
-						_posStateMask = (((UInt32)1) << (int)_posStateBits) - 1;
-						break;
-					}
-					case CoderPropID.LitPosBits:
-					{
-						if (!(prop is Int32))
-							throw new InvalidParamException();
-						Int32 v = (Int32)prop;
-						if (v < 0 || v > (UInt32)Base.kNumLitPosStatesBitsEncodingMax)
-							throw new InvalidParamException();
-						_numLiteralPosStateBits = (int)v;
-						break;
-					}
-					case CoderPropID.LitContextBits:
-					{
-						if (!(prop is Int32))
-							throw new InvalidParamException();
-						Int32 v = (Int32)prop;
-						if (v < 0 || v > (UInt32)Base.kNumLitContextBitsMax)
-							throw new InvalidParamException(); ;
-						_numLiteralContextBits = (int)v;
-						break;
-					}
-					case CoderPropID.EndMarker:
-					{
-						if (!(prop is Boolean))
-							throw new InvalidParamException();
-						SetWriteEndMarkerMode((Boolean)prop);
-						break;
-					}
-					default:
-						throw new InvalidParamException();
-				}
-			}
-		}
-
-		uint _trainSize = 0;
-		public void SetTrainSize(uint trainSize)
-		{
-			_trainSize = trainSize;
-		}
-		
-	}
-}
diff --git a/third_party/lzma/v4_65/files/CS/7zip/Compress/LzmaAlone/LzmaAlone.cs b/third_party/lzma/v4_65/files/CS/7zip/Compress/LzmaAlone/LzmaAlone.cs
deleted file mode 100644
index 7e22450..0000000
--- a/third_party/lzma/v4_65/files/CS/7zip/Compress/LzmaAlone/LzmaAlone.cs
+++ /dev/null
@@ -1,364 +0,0 @@
-using System;
-using System.IO;
-namespace SevenZip
-{
-	using CommandLineParser;
-	
-	public class CDoubleStream: Stream
-	{
-		public System.IO.Stream s1;
-		public System.IO.Stream s2;
-		public int fileIndex;
-		public long skipSize;
-		
-		public override bool CanRead { get { return true; }}
-		public override bool CanWrite { get { return false; }}
-		public override bool CanSeek { get { return false; }}
-		public override long Length { get { return s1.Length + s2.Length - skipSize; } }
-		public override long Position
-		{
-			get { return 0;	}
-			set { }
-		}
-		public override void Flush() { }
-		public override int Read(byte[] buffer, int offset, int count) 
-		{
-			int numTotal = 0;
-			while (count > 0)
-			{
-				if (fileIndex == 0)
-				{
-					int num = s1.Read(buffer, offset, count);
-					offset += num;
-					count -= num;
-					numTotal += num;
-					if (num == 0)
-						fileIndex++;
-				}
-				if (fileIndex == 1)
-				{
-					numTotal += s2.Read(buffer, offset, count);
-					return numTotal;
-				}
-			}
-			return numTotal;
-		}
-		public override void Write(byte[] buffer, int offset, int count)
-		{
-			throw (new Exception("can't Write"));
-		}
-		public override long Seek(long offset, System.IO.SeekOrigin origin)
-		{
-			throw (new Exception("can't Seek"));
-		}
-		public override void SetLength(long value)
-		{
-			throw (new Exception("can't SetLength"));
-		}
-	}
-	
-	class LzmaAlone
-	{
-		enum Key
-		{
-			Help1 = 0,
-			Help2,
-			Mode,
-			Dictionary,
-			FastBytes,
-			LitContext,
-			LitPos,
-			PosBits,
-			MatchFinder,
-			EOS,
-			StdIn,
-			StdOut,
-			Train
-		};
-
-		static void PrintHelp()
-		{
-			System.Console.WriteLine("\nUsage:  LZMA <e|d> [<switches>...] inputFile outputFile\n" +
-				"  e: encode file\n" +
-				"  d: decode file\n" +
-				"  b: Benchmark\n" +
-				"<Switches>\n" +
-				// "  -a{N}:  set compression mode - [0, 1], default: 1 (max)\n" +
-				"  -d{N}:  set dictionary - [0, 29], default: 23 (8MB)\n" +
-				"  -fb{N}: set number of fast bytes - [5, 273], default: 128\n" +
-				"  -lc{N}: set number of literal context bits - [0, 8], default: 3\n" +
-				"  -lp{N}: set number of literal pos bits - [0, 4], default: 0\n" +
-				"  -pb{N}: set number of pos bits - [0, 4], default: 2\n" +
-				"  -mf{MF_ID}: set Match Finder: [bt2, bt4], default: bt4\n" +
-				"  -eos:   write End Of Stream marker\n"
-				// + "  -si:    read data from stdin\n"
-				// + "  -so:    write data to stdout\n"
-				);
-		}
-
-		static bool GetNumber(string s, out Int32 v)
-		{
-			v = 0;
-			for (int i = 0; i < s.Length; i++)
-			{
-				char c = s[i];
-				if (c < '0' || c > '9')
-					return false;
-				v *= 10;
-				v += (Int32)(c - '0');
-			}
-			return true;
-		}
-
-		static int IncorrectCommand()
-		{
-			throw (new Exception("Command line error"));
-			// System.Console.WriteLine("\nCommand line error\n");
-			// return 1;
-		}
-		static int Main2(string[] args)
-		{
-			System.Console.WriteLine("\nLZMA# 4.61  2008-11-23\n");
-
-			if (args.Length == 0)
-			{
-				PrintHelp();
-				return 0;
-			}
-
-			SwitchForm[] kSwitchForms = new SwitchForm[13];
-			int sw = 0;
-			kSwitchForms[sw++] = new SwitchForm("?", SwitchType.Simple, false);
-			kSwitchForms[sw++] = new SwitchForm("H", SwitchType.Simple, false);
-			kSwitchForms[sw++] = new SwitchForm("A", SwitchType.UnLimitedPostString, false, 1);
-			kSwitchForms[sw++] = new SwitchForm("D", SwitchType.UnLimitedPostString, false, 1);
-			kSwitchForms[sw++] = new SwitchForm("FB", SwitchType.UnLimitedPostString, false, 1);
-			kSwitchForms[sw++] = new SwitchForm("LC", SwitchType.UnLimitedPostString, false, 1);
-			kSwitchForms[sw++] = new SwitchForm("LP", SwitchType.UnLimitedPostString, false, 1);
-			kSwitchForms[sw++] = new SwitchForm("PB", SwitchType.UnLimitedPostString, false, 1);
-			kSwitchForms[sw++] = new SwitchForm("MF", SwitchType.UnLimitedPostString, false, 1);
-			kSwitchForms[sw++] = new SwitchForm("EOS", SwitchType.Simple, false);
-			kSwitchForms[sw++] = new SwitchForm("SI", SwitchType.Simple, false);
-			kSwitchForms[sw++] = new SwitchForm("SO", SwitchType.Simple, false);
-			kSwitchForms[sw++] = new SwitchForm("T", SwitchType.UnLimitedPostString, false, 1);
-
-
-			Parser parser = new Parser(sw);
-			try
-			{
-				parser.ParseStrings(kSwitchForms, args);
-			}
-			catch
-			{
-				return IncorrectCommand();
-			}
-
-			if (parser[(int)Key.Help1].ThereIs || parser[(int)Key.Help2].ThereIs)
-			{
-				PrintHelp();
-				return 0;
-			}
-
-			System.Collections.ArrayList nonSwitchStrings = parser.NonSwitchStrings;
-
-			int paramIndex = 0;
-			if (paramIndex >= nonSwitchStrings.Count)
-				return IncorrectCommand();
-			string command = (string)nonSwitchStrings[paramIndex++];
-			command = command.ToLower();
-
-			bool dictionaryIsDefined = false;
-			Int32 dictionary = 1 << 21;
-			if (parser[(int)Key.Dictionary].ThereIs)
-			{
-				Int32 dicLog;
-				if (!GetNumber((string)parser[(int)Key.Dictionary].PostStrings[0], out dicLog))
-					IncorrectCommand();
-				dictionary = (Int32)1 << dicLog;
-				dictionaryIsDefined = true;
-			}
-			string mf = "bt4";
-			if (parser[(int)Key.MatchFinder].ThereIs)
-				mf = (string)parser[(int)Key.MatchFinder].PostStrings[0];
-			mf = mf.ToLower();
-
-			if (command == "b")
-			{
-				const Int32 kNumDefaultItereations = 10;
-				Int32 numIterations = kNumDefaultItereations;
-				if (paramIndex < nonSwitchStrings.Count)
-					if (!GetNumber((string)nonSwitchStrings[paramIndex++], out numIterations))
-						numIterations = kNumDefaultItereations;
-				return LzmaBench.LzmaBenchmark(numIterations, (UInt32)dictionary);
-			}
-
-			string train = "";
-			if (parser[(int)Key.Train].ThereIs)
-				train = (string)parser[(int)Key.Train].PostStrings[0];
-
-			bool encodeMode = false;
-			if (command == "e")
-				encodeMode = true;
-			else if (command == "d")
-				encodeMode = false;
-			else
-				IncorrectCommand();
-
-			bool stdInMode = parser[(int)Key.StdIn].ThereIs;
-			bool stdOutMode = parser[(int)Key.StdOut].ThereIs;
-
-			Stream inStream = null;
-			if (stdInMode)
-			{
-				throw (new Exception("Not implemeted"));
-			}
-			else
-			{
-				if (paramIndex >= nonSwitchStrings.Count)
-					IncorrectCommand();
-				string inputName = (string)nonSwitchStrings[paramIndex++];
-				inStream = new FileStream(inputName, FileMode.Open, FileAccess.Read);
-			}
-
-			FileStream outStream = null;
-			if (stdOutMode)
-			{
-				throw (new Exception("Not implemeted"));
-			}
-			else
-			{
-				if (paramIndex >= nonSwitchStrings.Count)
-					IncorrectCommand();
-				string outputName = (string)nonSwitchStrings[paramIndex++];
-				outStream = new FileStream(outputName, FileMode.Create, FileAccess.Write);
-			}
-
-			FileStream trainStream = null;
-			if (train.Length != 0)
-				trainStream = new FileStream(train, FileMode.Open, FileAccess.Read);
-
-			if (encodeMode)
-			{
-				if (!dictionaryIsDefined)
-					dictionary = 1 << 23;
-
-				Int32 posStateBits = 2;
-				Int32 litContextBits = 3; // for normal files
-				// UInt32 litContextBits = 0; // for 32-bit data
-				Int32 litPosBits = 0;
-				// UInt32 litPosBits = 2; // for 32-bit data
-				Int32 algorithm = 2;
-				Int32 numFastBytes = 128;
-
-				bool eos = parser[(int)Key.EOS].ThereIs || stdInMode;
-
-				if (parser[(int)Key.Mode].ThereIs)
-					if (!GetNumber((string)parser[(int)Key.Mode].PostStrings[0], out algorithm))
-						IncorrectCommand();
-
-				if (parser[(int)Key.FastBytes].ThereIs)
-					if (!GetNumber((string)parser[(int)Key.FastBytes].PostStrings[0], out numFastBytes))
-						IncorrectCommand();
-				if (parser[(int)Key.LitContext].ThereIs)
-					if (!GetNumber((string)parser[(int)Key.LitContext].PostStrings[0], out litContextBits))
-						IncorrectCommand();
-				if (parser[(int)Key.LitPos].ThereIs)
-					if (!GetNumber((string)parser[(int)Key.LitPos].PostStrings[0], out litPosBits))
-						IncorrectCommand();
-				if (parser[(int)Key.PosBits].ThereIs)
-					if (!GetNumber((string)parser[(int)Key.PosBits].PostStrings[0], out posStateBits))
-						IncorrectCommand();
-
-				CoderPropID[] propIDs = 
-				{
-					CoderPropID.DictionarySize,
-					CoderPropID.PosStateBits,
-					CoderPropID.LitContextBits,
-					CoderPropID.LitPosBits,
-					CoderPropID.Algorithm,
-					CoderPropID.NumFastBytes,
-					CoderPropID.MatchFinder,
-					CoderPropID.EndMarker
-				};
-				object[] properties = 
-				{
-					(Int32)(dictionary),
-					(Int32)(posStateBits),
-					(Int32)(litContextBits),
-					(Int32)(litPosBits),
-					(Int32)(algorithm),
-					(Int32)(numFastBytes),
-					mf,
-					eos
-				};
-
-				Compression.LZMA.Encoder encoder = new Compression.LZMA.Encoder();
-				encoder.SetCoderProperties(propIDs, properties);
-				encoder.WriteCoderProperties(outStream);
-				Int64 fileSize;
-				if (eos || stdInMode)
-					fileSize = -1;
-				else
-					fileSize = inStream.Length;
-				for (int i = 0; i < 8; i++)
-					outStream.WriteByte((Byte)(fileSize >> (8 * i)));
-				if (trainStream != null)
-				{
-					CDoubleStream doubleStream = new CDoubleStream();
-					doubleStream.s1 = trainStream;
-					doubleStream.s2 = inStream;
-					doubleStream.fileIndex = 0;
-					inStream = doubleStream;
-					long trainFileSize = trainStream.Length;
-					doubleStream.skipSize = 0;
-					if (trainFileSize > dictionary)
-						doubleStream.skipSize = trainFileSize - dictionary;
-					trainStream.Seek(doubleStream.skipSize, SeekOrigin.Begin);
-					encoder.SetTrainSize((uint)(trainFileSize - doubleStream.skipSize));
-				}
-				encoder.Code(inStream, outStream, -1, -1, null);
-			}
-			else if (command == "d")
-			{
-				byte[] properties = new byte[5];
-				if (inStream.Read(properties, 0, 5) != 5)
-					throw (new Exception("input .lzma is too short"));
-				Compression.LZMA.Decoder decoder = new Compression.LZMA.Decoder();
-				decoder.SetDecoderProperties(properties);
-				if (trainStream != null)
-				{
-					if (!decoder.Train(trainStream))
-						throw (new Exception("can't train"));
-				}
-				long outSize = 0;
-				for (int i = 0; i < 8; i++)
-				{
-					int v = inStream.ReadByte();
-					if (v < 0)
-						throw (new Exception("Can't Read 1"));
-					outSize |= ((long)(byte)v) << (8 * i);
-				}
-				long compressedSize = inStream.Length - inStream.Position;
-				decoder.Code(inStream, outStream, compressedSize, outSize, null);
-			}
-			else
-				throw (new Exception("Command Error"));
-			return 0;
-		}
-
-		[STAThread]
-		static int Main(string[] args)
-		{
-			try
-			{
-				return Main2(args);
-			}
-			catch (Exception e)
-			{
-				Console.WriteLine("{0} Caught exception #1.", e);
-				// throw e;
-				return 1;
-			}
-		}
-	}
-}
diff --git a/third_party/lzma/v4_65/files/CS/7zip/Compress/LzmaAlone/LzmaAlone.csproj b/third_party/lzma/v4_65/files/CS/7zip/Compress/LzmaAlone/LzmaAlone.csproj
deleted file mode 100644
index 6d87b61..0000000
--- a/third_party/lzma/v4_65/files/CS/7zip/Compress/LzmaAlone/LzmaAlone.csproj
+++ /dev/null
@@ -1,90 +0,0 @@
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>8.0.50727</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{CE33DF18-F9C8-4D6F-9057-DBB4DB96E973}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <RootNamespace>LzmaAlone</RootNamespace>
-    <AssemblyName>Lzma#</AssemblyName>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>.\bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugSymbols>false</DebugSymbols>
-    <Optimize>true</Optimize>
-    <OutputPath>.\bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <PlatformTarget>AnyCPU</PlatformTarget>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="..\..\Common\CommandLineParser.cs">
-      <Link>Common\CommandLineParser.cs</Link>
-    </Compile>
-    <Compile Include="..\..\Common\CRC.cs">
-      <Link>Common\CRC.cs</Link>
-    </Compile>
-    <Compile Include="..\..\ICoder.cs">
-      <Link>ICoder.cs</Link>
-    </Compile>
-    <Compile Include="..\LZ\IMatchFinder.cs">
-      <Link>LZ\IMatchFinder.cs</Link>
-    </Compile>
-    <Compile Include="..\LZ\LzBinTree.cs">
-      <Link>LZ\LzBinTree.cs</Link>
-    </Compile>
-    <Compile Include="..\LZ\LzInWindow.cs">
-      <Link>LZ\LzInWindow.cs</Link>
-    </Compile>
-    <Compile Include="..\LZ\LzOutWindow.cs">
-      <Link>LZ\LzOutWindow.cs</Link>
-    </Compile>
-    <Compile Include="..\LZMA\LzmaBase.cs">
-      <Link>LZMA\LzmaBase.cs</Link>
-    </Compile>
-    <Compile Include="..\LZMA\LzmaDecoder.cs">
-      <Link>LZMA\LzmaDecoder.cs</Link>
-    </Compile>
-    <Compile Include="..\LZMA\LzmaEncoder.cs">
-      <Link>LZMA\LzmaEncoder.cs</Link>
-    </Compile>
-    <Compile Include="..\RangeCoder\RangeCoder.cs">
-      <Link>RangeCoder\RangeCoder.cs</Link>
-    </Compile>
-    <Compile Include="..\RangeCoder\RangeCoderBit.cs">
-      <Link>RangeCoder\RangeCoderBit.cs</Link>
-    </Compile>
-    <Compile Include="..\RangeCoder\RangeCoderBitTree.cs">
-      <Link>RangeCoder\RangeCoderBitTree.cs</Link>
-    </Compile>
-    <Compile Include="LzmaAlone.cs">
-      <SubType>Code</SubType>
-    </Compile>
-    <Compile Include="LzmaBench.cs">
-      <SubType>Code</SubType>
-    </Compile>
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="Properties\Settings.cs">
-      <AutoGen>True</AutoGen>
-      <DependentUpon>Settings.settings</DependentUpon>
-    </Compile>
-    <None Include="Properties\Settings.settings">
-      <Generator>SettingsSingleFileGenerator</Generator>
-      <LastGenOutput>Settings.cs</LastGenOutput>
-    </None>
-    <AppDesigner Include="Properties\" />
-  </ItemGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
-</Project>
\ No newline at end of file
diff --git a/third_party/lzma/v4_65/files/CS/7zip/Compress/LzmaAlone/LzmaAlone.sln b/third_party/lzma/v4_65/files/CS/7zip/Compress/LzmaAlone/LzmaAlone.sln
deleted file mode 100644
index 376cd27..0000000
--- a/third_party/lzma/v4_65/files/CS/7zip/Compress/LzmaAlone/LzmaAlone.sln
+++ /dev/null
@@ -1,20 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual C# Express 2005
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LzmaAlone", "LzmaAlone.csproj", "{CE33DF18-F9C8-4D6F-9057-DBB4DB96E973}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Any CPU = Debug|Any CPU
-		Release|Any CPU = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{CE33DF18-F9C8-4D6F-9057-DBB4DB96E973}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{CE33DF18-F9C8-4D6F-9057-DBB4DB96E973}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{CE33DF18-F9C8-4D6F-9057-DBB4DB96E973}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{CE33DF18-F9C8-4D6F-9057-DBB4DB96E973}.Release|Any CPU.Build.0 = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-EndGlobal
diff --git a/third_party/lzma/v4_65/files/CS/7zip/Compress/LzmaAlone/LzmaBench.cs b/third_party/lzma/v4_65/files/CS/7zip/Compress/LzmaAlone/LzmaBench.cs
deleted file mode 100644
index f7b6bd0..0000000
--- a/third_party/lzma/v4_65/files/CS/7zip/Compress/LzmaAlone/LzmaBench.cs
+++ /dev/null
@@ -1,340 +0,0 @@
-// LzmaBench.cs
-
-using System;
-using System.IO;
-
-namespace SevenZip
-{
-	/// <summary>
-	/// LZMA Benchmark
-	/// </summary>
-	internal abstract class LzmaBench
-	{
-		const UInt32 kAdditionalSize = (6 << 20);
-		const UInt32 kCompressedAdditionalSize = (1 << 10);
-		const UInt32 kMaxLzmaPropSize = 10;
-
-		class CRandomGenerator
-		{
-			UInt32 A1;
-			UInt32 A2;
-			public CRandomGenerator() { Init(); }
-			public void Init() { A1 = 362436069; A2 = 521288629; }
-			public UInt32 GetRnd()
-			{
-				return
-					((A1 = 36969 * (A1 & 0xffff) + (A1 >> 16)) << 16) ^
-					((A2 = 18000 * (A2 & 0xffff) + (A2 >> 16)));
-			}
-		};
-
-		class CBitRandomGenerator
-		{
-			CRandomGenerator RG = new CRandomGenerator();
-			UInt32 Value;
-			int NumBits;
-			public void Init()
-			{
-				Value = 0;
-				NumBits = 0;
-			}
-			public UInt32 GetRnd(int numBits)
-			{
-				UInt32 result;
-				if (NumBits > numBits)
-				{
-					result = Value & (((UInt32)1 << numBits) - 1);
-					Value >>= numBits;
-					NumBits -= numBits;
-					return result;
-				}
-				numBits -= NumBits;
-				result = (Value << numBits);
-				Value = RG.GetRnd();
-				result |= Value & (((UInt32)1 << numBits) - 1);
-				Value >>= numBits;
-				NumBits = 32 - numBits;
-				return result;
-			}
-		};
-
-		class CBenchRandomGenerator
-		{
-			CBitRandomGenerator RG = new CBitRandomGenerator();
-			UInt32 Pos;
-			UInt32 Rep0;
-			
-			public UInt32 BufferSize;
-			public Byte[] Buffer = null;
-
-			public CBenchRandomGenerator() { }
-
-			public void Set(UInt32 bufferSize)
-			{
-				Buffer = new Byte[bufferSize];
-				Pos = 0;
-				BufferSize = bufferSize;
-			}
-			UInt32 GetRndBit() { return RG.GetRnd(1); }
-			UInt32 GetLogRandBits(int numBits)
-			{
-				UInt32 len = RG.GetRnd(numBits);
-				return RG.GetRnd((int)len);
-			}
-			UInt32 GetOffset()
-			{
-				if (GetRndBit() == 0)
-					return GetLogRandBits(4);
-				return (GetLogRandBits(4) << 10) | RG.GetRnd(10);
-			}
-			UInt32 GetLen1() { return RG.GetRnd(1 + (int)RG.GetRnd(2)); }
-			UInt32 GetLen2() { return RG.GetRnd(2 + (int)RG.GetRnd(2)); }
-			public void Generate()
-			{
-				RG.Init();
-				Rep0 = 1;
-				while (Pos < BufferSize)
-				{
-					if (GetRndBit() == 0 || Pos < 1)
-						Buffer[Pos++] = (Byte)RG.GetRnd(8);
-					else
-					{
-						UInt32 len;
-						if (RG.GetRnd(3) == 0)
-							len = 1 + GetLen1();
-						else
-						{
-							do
-								Rep0 = GetOffset();
-							while (Rep0 >= Pos);
-							Rep0++;
-							len = 2 + GetLen2();
-						}
-						for (UInt32 i = 0; i < len && Pos < BufferSize; i++, Pos++)
-							Buffer[Pos] = Buffer[Pos - Rep0];
-					}
-				}
-			}
-		};
-
-		class CrcOutStream : System.IO.Stream
-		{
-			public CRC CRC = new CRC();
-			public void Init() { CRC.Init(); }
-			public UInt32 GetDigest() { return CRC.GetDigest(); }
-
-			public override bool CanRead { get { return false; } }
-			public override bool CanSeek { get { return false; } }
-			public override bool CanWrite { get { return true; } }
-			public override Int64 Length { get { return 0; } }
-			public override Int64 Position { get { return 0; } set { } }
-			public override void Flush() { }
-			public override long Seek(long offset, SeekOrigin origin) { return 0; }
-			public override void SetLength(long value) { }
-			public override int Read(byte[] buffer, int offset, int count) { return 0; }
-
-			public override void WriteByte(byte b)
-			{
-				CRC.UpdateByte(b);
-			}
-			public override void Write(byte[] buffer, int offset, int count)
-			{
-				CRC.Update(buffer, (uint)offset, (uint)count);
-			}
-		};
-
-		class CProgressInfo : ICodeProgress
-		{
-			public Int64 ApprovedStart;
-			public Int64 InSize;
-			public System.DateTime Time;
-			public void Init() { InSize = 0; }
-			public void SetProgress(Int64 inSize, Int64 outSize)
-			{
-				if (inSize >= ApprovedStart && InSize == 0)
-				{
-					Time = DateTime.UtcNow;
-					InSize = inSize;
-				}
-			}
-		}
-		const int kSubBits = 8;
-
-		static UInt32 GetLogSize(UInt32 size)
-		{
-			for (int i = kSubBits; i < 32; i++)
-				for (UInt32 j = 0; j < (1 << kSubBits); j++)
-					if (size <= (((UInt32)1) << i) + (j << (i - kSubBits)))
-						return (UInt32)(i << kSubBits) + j;
-			return (32 << kSubBits);
-		}
-
-		static UInt64 MyMultDiv64(UInt64 value, UInt64 elapsedTime)
-		{
-			UInt64 freq = TimeSpan.TicksPerSecond;
-			UInt64 elTime = elapsedTime;
-			while (freq > 1000000)
-			{
-				freq >>= 1;
-				elTime >>= 1;
-			}
-			if (elTime == 0)
-				elTime = 1;
-			return value * freq / elTime;
-		}
-
-		static UInt64 GetCompressRating(UInt32 dictionarySize, UInt64 elapsedTime, UInt64 size)
-		{
-			UInt64 t = GetLogSize(dictionarySize) - (18 << kSubBits);
-			UInt64 numCommandsForOne = 1060 + ((t * t * 10) >> (2 * kSubBits));
-			UInt64 numCommands = (UInt64)(size) * numCommandsForOne;
-			return MyMultDiv64(numCommands, elapsedTime);
-		}
-
-		static UInt64 GetDecompressRating(UInt64 elapsedTime, UInt64 outSize, UInt64 inSize)
-		{
-			UInt64 numCommands = inSize * 220 + outSize * 20;
-			return MyMultDiv64(numCommands, elapsedTime);
-		}
-
-		static UInt64 GetTotalRating(
-			UInt32 dictionarySize,
-			UInt64 elapsedTimeEn, UInt64 sizeEn,
-			UInt64 elapsedTimeDe,
-			UInt64 inSizeDe, UInt64 outSizeDe)
-		{
-			return (GetCompressRating(dictionarySize, elapsedTimeEn, sizeEn) +
-				GetDecompressRating(elapsedTimeDe, inSizeDe, outSizeDe)) / 2;
-		}
-
-		static void PrintValue(UInt64 v)
-		{
-			string s = v.ToString();
-			for (int i = 0; i + s.Length < 6; i++)
-				System.Console.Write(" ");
-			System.Console.Write(s);
-		}
-
-		static void PrintRating(UInt64 rating)
-		{
-			PrintValue(rating / 1000000);
-			System.Console.Write(" MIPS");
-		}
-
-		static void PrintResults(
-			UInt32 dictionarySize,
-			UInt64 elapsedTime,
-			UInt64 size,
-			bool decompressMode, UInt64 secondSize)
-		{
-			UInt64 speed = MyMultDiv64(size, elapsedTime);
-			PrintValue(speed / 1024);
-			System.Console.Write(" KB/s  ");
-			UInt64 rating;
-			if (decompressMode)
-				rating = GetDecompressRating(elapsedTime, size, secondSize);
-			else
-				rating = GetCompressRating(dictionarySize, elapsedTime, size);
-			PrintRating(rating);
-		}
-
-		static public int LzmaBenchmark(Int32 numIterations, UInt32 dictionarySize)
-		{
-			if (numIterations <= 0)
-				return 0;
-			if (dictionarySize < (1 << 18))
-			{
-				System.Console.WriteLine("\nError: dictionary size for benchmark must be >= 19 (512 KB)");
-				return 1;
-			}
-			System.Console.Write("\n       Compressing                Decompressing\n\n");
-
-			Compression.LZMA.Encoder encoder = new Compression.LZMA.Encoder();
-			Compression.LZMA.Decoder decoder = new Compression.LZMA.Decoder();
-
-
-			CoderPropID[] propIDs = 
-			{ 
-				CoderPropID.DictionarySize,
-			};
-			object[] properties = 
-			{
-				(Int32)(dictionarySize),
-			};
-
-			UInt32 kBufferSize = dictionarySize + kAdditionalSize;
-			UInt32 kCompressedBufferSize = (kBufferSize / 2) + kCompressedAdditionalSize;
-
-			encoder.SetCoderProperties(propIDs, properties);
-			System.IO.MemoryStream propStream = new System.IO.MemoryStream();
-			encoder.WriteCoderProperties(propStream);
-			byte[] propArray = propStream.ToArray();
-
-			CBenchRandomGenerator rg = new CBenchRandomGenerator();
-
-			rg.Set(kBufferSize);
-			rg.Generate();
-			CRC crc = new CRC();
-			crc.Init();
-			crc.Update(rg.Buffer, 0, rg.BufferSize);
-
-			CProgressInfo progressInfo = new CProgressInfo();
-			progressInfo.ApprovedStart = dictionarySize;
-
-			UInt64 totalBenchSize = 0;
-			UInt64 totalEncodeTime = 0;
-			UInt64 totalDecodeTime = 0;
-			UInt64 totalCompressedSize = 0;
-
-			MemoryStream inStream = new MemoryStream(rg.Buffer, 0, (int)rg.BufferSize);
-			MemoryStream compressedStream = new MemoryStream((int)kCompressedBufferSize);
-			CrcOutStream crcOutStream = new CrcOutStream();
-			for (Int32 i = 0; i < numIterations; i++)
-			{
-				progressInfo.Init();
-				inStream.Seek(0, SeekOrigin.Begin);
-				compressedStream.Seek(0, SeekOrigin.Begin);
-				encoder.Code(inStream, compressedStream, -1, -1, progressInfo);
-				TimeSpan sp2 = DateTime.UtcNow - progressInfo.Time;
-				UInt64 encodeTime = (UInt64)sp2.Ticks;
-
-				long compressedSize = compressedStream.Position;
-				if (progressInfo.InSize == 0)
-					throw (new Exception("Internal ERROR 1282"));
-
-				UInt64 decodeTime = 0;
-				for (int j = 0; j < 2; j++)
-				{
-					compressedStream.Seek(0, SeekOrigin.Begin);
-					crcOutStream.Init();
-
-					decoder.SetDecoderProperties(propArray);
-					UInt64 outSize = kBufferSize;
-					System.DateTime startTime = DateTime.UtcNow;
-					decoder.Code(compressedStream, crcOutStream, 0, (Int64)outSize, null);
-					TimeSpan sp = (DateTime.UtcNow - startTime);
-					decodeTime = (ulong)sp.Ticks;
-					if (crcOutStream.GetDigest() != crc.GetDigest())
-						throw (new Exception("CRC Error"));
-				}
-				UInt64 benchSize = kBufferSize - (UInt64)progressInfo.InSize;
-				PrintResults(dictionarySize, encodeTime, benchSize, false, 0);
-				System.Console.Write("     ");
-				PrintResults(dictionarySize, decodeTime, kBufferSize, true, (ulong)compressedSize);
-				System.Console.WriteLine();
-
-				totalBenchSize += benchSize;
-				totalEncodeTime += encodeTime;
-				totalDecodeTime += decodeTime;
-				totalCompressedSize += (ulong)compressedSize;
-			}
-			System.Console.WriteLine("---------------------------------------------------");
-			PrintResults(dictionarySize, totalEncodeTime, totalBenchSize, false, 0);
-			System.Console.Write("     ");
-			PrintResults(dictionarySize, totalDecodeTime,
-					kBufferSize * (UInt64)numIterations, true, totalCompressedSize);
-			System.Console.WriteLine("    Average");
-			return 0;
-		}
-	}
-}
diff --git a/third_party/lzma/v4_65/files/CS/7zip/Compress/LzmaAlone/Properties/AssemblyInfo.cs b/third_party/lzma/v4_65/files/CS/7zip/Compress/LzmaAlone/Properties/AssemblyInfo.cs
deleted file mode 100644
index 9614884..0000000
--- a/third_party/lzma/v4_65/files/CS/7zip/Compress/LzmaAlone/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-#region Using directives
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-#endregion
-
-// General Information about an assembly is controlled through the following 
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("LZMA#")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Igor Pavlov")]
-[assembly: AssemblyProduct("LZMA# SDK")]
-[assembly: AssemblyCopyright("Copyright @ Igor Pavlov 1999-2004")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Version information for an assembly consists of the following four values:
-//
-//      Major Version
-//      Minor Version 
-//      Build Number
-//      Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers 
-// by using the '*' as shown below:
-[assembly: AssemblyVersion("4.12.*")]
diff --git a/third_party/lzma/v4_65/files/CS/7zip/Compress/LzmaAlone/Properties/Resources.cs b/third_party/lzma/v4_65/files/CS/7zip/Compress/LzmaAlone/Properties/Resources.cs
deleted file mode 100644
index 1170cf1..0000000
--- a/third_party/lzma/v4_65/files/CS/7zip/Compress/LzmaAlone/Properties/Resources.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-//------------------------------------------------------------------------------
-// <autogenerated>
-//     This code was generated by a tool.
-//     Runtime Version:2.0.40607.42
-//
-//     Changes to this file may cause incorrect behavior and will be lost if
-//     the code is regenerated.
-// </autogenerated>
-//------------------------------------------------------------------------------
-
-namespace LzmaAlone.Properties
-{
-	using System;
-	using System.IO;
-	using System.Resources;
-
-	/// <summary>
-	///    A strongly-typed resource class, for looking up localized strings, etc.
-	/// </summary>
-	// This class was auto-generated by the Strongly Typed Resource Builder
-	// class via a tool like ResGen or Visual Studio.NET.
-	// To add or remove a member, edit your .ResX file then rerun ResGen
-	// with the /str option, or rebuild your VS project.
-	class Resources
-	{
-
-		private static System.Resources.ResourceManager _resMgr;
-
-		private static System.Globalization.CultureInfo _resCulture;
-
-		/*FamANDAssem*/
-		internal Resources()
-		{
-		}
-
-		/// <summary>
-		///    Returns the cached ResourceManager instance used by this class.
-		/// </summary>
-		[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
-		public static System.Resources.ResourceManager ResourceManager
-		{
-			get
-			{
-				if ((_resMgr == null))
-				{
-					System.Resources.ResourceManager temp = new System.Resources.ResourceManager("Resources", typeof(Resources).Assembly);
-					_resMgr = temp;
-				}
-				return _resMgr;
-			}
-		}
-
-		/// <summary>
-		///    Overrides the current thread's CurrentUICulture property for all
-		///    resource lookups using this strongly typed resource class.
-		/// </summary>
-		[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
-		public static System.Globalization.CultureInfo Culture
-		{
-			get
-			{
-				return _resCulture;
-			}
-			set
-			{
-				_resCulture = value;
-			}
-		}
-	}
-}
diff --git a/third_party/lzma/v4_65/files/CS/7zip/Compress/LzmaAlone/Properties/Settings.cs b/third_party/lzma/v4_65/files/CS/7zip/Compress/LzmaAlone/Properties/Settings.cs
deleted file mode 100644
index ccfed77..0000000
--- a/third_party/lzma/v4_65/files/CS/7zip/Compress/LzmaAlone/Properties/Settings.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-//------------------------------------------------------------------------------
-// <autogenerated>
-//     This code was generated by a tool.
-//     Runtime Version:2.0.40607.42
-//
-//     Changes to this file may cause incorrect behavior and will be lost if
-//     the code is regenerated.
-// </autogenerated>
-//------------------------------------------------------------------------------
-
-namespace LzmaAlone.Properties
-{
-	public partial class Settings : System.Configuration.ApplicationSettingsBase
-	{
-		private static Settings m_Value;
-
-		private static object m_SyncObject = new object();
-
-		public static Settings Value
-		{
-			get
-			{
-				if ((Settings.m_Value == null))
-				{
-					System.Threading.Monitor.Enter(Settings.m_SyncObject);
-					if ((Settings.m_Value == null))
-					{
-						try
-						{
-							Settings.m_Value = new Settings();
-						}
-						finally
-						{
-							System.Threading.Monitor.Exit(Settings.m_SyncObject);
-						}
-					}
-				}
-				return Settings.m_Value;
-			}
-		}
-	}
-}
diff --git a/third_party/lzma/v4_65/files/CS/7zip/Compress/RangeCoder/RangeCoder.cs b/third_party/lzma/v4_65/files/CS/7zip/Compress/RangeCoder/RangeCoder.cs
deleted file mode 100644
index 949c6bb..0000000
--- a/third_party/lzma/v4_65/files/CS/7zip/Compress/RangeCoder/RangeCoder.cs
+++ /dev/null
@@ -1,234 +0,0 @@
-using System;
-
-namespace SevenZip.Compression.RangeCoder
-{
-	class Encoder
-	{
-		public const uint kTopValue = (1 << 24);
-
-		System.IO.Stream Stream;
-
-		public UInt64 Low;
-		public uint Range;
-		uint _cacheSize;
-		byte _cache;
-
-		long StartPosition;
-
-		public void SetStream(System.IO.Stream stream)
-		{
-			Stream = stream;
-		}
-
-		public void ReleaseStream()
-		{
-			Stream = null;
-		}
-
-		public void Init()
-		{
-			StartPosition = Stream.Position;
-
-			Low = 0;
-			Range = 0xFFFFFFFF;
-			_cacheSize = 1;
-			_cache = 0;
-		}
-
-		public void FlushData()
-		{
-			for (int i = 0; i < 5; i++)
-				ShiftLow();
-		}
-
-		public void FlushStream()
-		{
-			Stream.Flush();
-		}
-
-		public void CloseStream()
-		{
-			Stream.Close();
-		}
-
-		public void Encode(uint start, uint size, uint total)
-		{
-			Low += start * (Range /= total);
-			Range *= size;
-			while (Range < kTopValue)
-			{
-				Range <<= 8;
-				ShiftLow();
-			}
-		}
-
-		public void ShiftLow()
-		{
-			if ((uint)Low < (uint)0xFF000000 || (uint)(Low >> 32) == 1)
-			{
-				byte temp = _cache;
-				do
-				{
-					Stream.WriteByte((byte)(temp + (Low >> 32)));
-					temp = 0xFF;
-				}
-				while (--_cacheSize != 0);
-				_cache = (byte)(((uint)Low) >> 24);
-			}
-			_cacheSize++;
-			Low = ((uint)Low) << 8;
-		}
-
-		public void EncodeDirectBits(uint v, int numTotalBits)
-		{
-			for (int i = numTotalBits - 1; i >= 0; i--)
-			{
-				Range >>= 1;
-				if (((v >> i) & 1) == 1)
-					Low += Range;
-				if (Range < kTopValue)
-				{
-					Range <<= 8;
-					ShiftLow();
-				}
-			}
-		}
-
-		public void EncodeBit(uint size0, int numTotalBits, uint symbol)
-		{
-			uint newBound = (Range >> numTotalBits) * size0;
-			if (symbol == 0)
-				Range = newBound;
-			else
-			{
-				Low += newBound;
-				Range -= newBound;
-			}
-			while (Range < kTopValue)
-			{
-				Range <<= 8;
-				ShiftLow();
-			}
-		}
-
-		public long GetProcessedSizeAdd()
-		{
-			return _cacheSize +
-				Stream.Position - StartPosition + 4;
-			// (long)Stream.GetProcessedSize();
-		}
-	}
-
-	class Decoder
-	{
-		public const uint kTopValue = (1 << 24);
-		public uint Range;
-		public uint Code;
-		// public Buffer.InBuffer Stream = new Buffer.InBuffer(1 << 16);
-		public System.IO.Stream Stream;
-
-		public void Init(System.IO.Stream stream)
-		{
-			// Stream.Init(stream);
-			Stream = stream;
-
-			Code = 0;
-			Range = 0xFFFFFFFF;
-			for (int i = 0; i < 5; i++)
-				Code = (Code << 8) | (byte)Stream.ReadByte();
-		}
-
-		public void ReleaseStream()
-		{
-			// Stream.ReleaseStream();
-			Stream = null;
-		}
-
-		public void CloseStream()
-		{
-			Stream.Close();
-		}
-
-		public void Normalize()
-		{
-			while (Range < kTopValue)
-			{
-				Code = (Code << 8) | (byte)Stream.ReadByte();
-				Range <<= 8;
-			}
-		}
-
-		public void Normalize2()
-		{
-			if (Range < kTopValue)
-			{
-				Code = (Code << 8) | (byte)Stream.ReadByte();
-				Range <<= 8;
-			}
-		}
-
-		public uint GetThreshold(uint total)
-		{
-			return Code / (Range /= total);
-		}
-
-		public void Decode(uint start, uint size, uint total)
-		{
-			Code -= start * Range;
-			Range *= size;
-			Normalize();
-		}
-
-		public uint DecodeDirectBits(int numTotalBits)
-		{
-			uint range = Range;
-			uint code = Code;
-			uint result = 0;
-			for (int i = numTotalBits; i > 0; i--)
-			{
-				range >>= 1;
-				/*
-				result <<= 1;
-				if (code >= range)
-				{
-					code -= range;
-					result |= 1;
-				}
-				*/
-				uint t = (code - range) >> 31;
-				code -= range & (t - 1);
-				result = (result << 1) | (1 - t);
-
-				if (range < kTopValue)
-				{
-					code = (code << 8) | (byte)Stream.ReadByte();
-					range <<= 8;
-				}
-			}
-			Range = range;
-			Code = code;
-			return result;
-		}
-
-		public uint DecodeBit(uint size0, int numTotalBits)
-		{
-			uint newBound = (Range >> numTotalBits) * size0;
-			uint symbol;
-			if (Code < newBound)
-			{
-				symbol = 0;
-				Range = newBound;
-			}
-			else
-			{
-				symbol = 1;
-				Code -= newBound;
-				Range -= newBound;
-			}
-			Normalize();
-			return symbol;
-		}
-
-		// ulong GetProcessedSize() {return Stream.GetProcessedSize(); }
-	}
-}
diff --git a/third_party/lzma/v4_65/files/CS/7zip/Compress/RangeCoder/RangeCoderBit.cs b/third_party/lzma/v4_65/files/CS/7zip/Compress/RangeCoder/RangeCoderBit.cs
deleted file mode 100644
index 4f0346d..0000000
--- a/third_party/lzma/v4_65/files/CS/7zip/Compress/RangeCoder/RangeCoderBit.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-using System;
-
-namespace SevenZip.Compression.RangeCoder
-{
-	struct BitEncoder
-	{
-		public const int kNumBitModelTotalBits = 11;
-		public const uint kBitModelTotal = (1 << kNumBitModelTotalBits);
-		const int kNumMoveBits = 5;
-		const int kNumMoveReducingBits = 2;
-		public const int kNumBitPriceShiftBits = 6;
-
-		uint Prob;
-
-		public void Init() { Prob = kBitModelTotal >> 1; }
-
-		public void UpdateModel(uint symbol)
-		{
-			if (symbol == 0)
-				Prob += (kBitModelTotal - Prob) >> kNumMoveBits;
-			else
-				Prob -= (Prob) >> kNumMoveBits;
-		}
-
-		public void Encode(Encoder encoder, uint symbol)
-		{
-			// encoder.EncodeBit(Prob, kNumBitModelTotalBits, symbol);
-			// UpdateModel(symbol);
-			uint newBound = (encoder.Range >> kNumBitModelTotalBits) * Prob;
-			if (symbol == 0)
-			{
-				encoder.Range = newBound;
-				Prob += (kBitModelTotal - Prob) >> kNumMoveBits;
-			}
-			else
-			{
-				encoder.Low += newBound;
-				encoder.Range -= newBound;
-				Prob -= (Prob) >> kNumMoveBits;
-			}
-			if (encoder.Range < Encoder.kTopValue)
-			{
-				encoder.Range <<= 8;
-				encoder.ShiftLow();
-			}
-		}
-
-		private static UInt32[] ProbPrices = new UInt32[kBitModelTotal >> kNumMoveReducingBits];
-
-		static BitEncoder()
-		{
-			const int kNumBits = (kNumBitModelTotalBits - kNumMoveReducingBits);
-			for (int i = kNumBits - 1; i >= 0; i--)
-			{
-				UInt32 start = (UInt32)1 << (kNumBits - i - 1);
-				UInt32 end = (UInt32)1 << (kNumBits - i);
-				for (UInt32 j = start; j < end; j++)
-					ProbPrices[j] = ((UInt32)i << kNumBitPriceShiftBits) +
-						(((end - j) << kNumBitPriceShiftBits) >> (kNumBits - i - 1));
-			}
-		}
-
-		public uint GetPrice(uint symbol)
-		{
-			return ProbPrices[(((Prob - symbol) ^ ((-(int)symbol))) & (kBitModelTotal - 1)) >> kNumMoveReducingBits];
-		}
-	  public uint GetPrice0() { return ProbPrices[Prob >> kNumMoveReducingBits]; }
-		public uint GetPrice1() { return ProbPrices[(kBitModelTotal - Prob) >> kNumMoveReducingBits]; }
-	}
-
-	struct BitDecoder
-	{
-		public const int kNumBitModelTotalBits = 11;
-		public const uint kBitModelTotal = (1 << kNumBitModelTotalBits);
-		const int kNumMoveBits = 5;
-
-		uint Prob;
-
-		public void UpdateModel(int numMoveBits, uint symbol)
-		{
-			if (symbol == 0)
-				Prob += (kBitModelTotal - Prob) >> numMoveBits;
-			else
-				Prob -= (Prob) >> numMoveBits;
-		}
-
-		public void Init() { Prob = kBitModelTotal >> 1; }
-
-		public uint Decode(RangeCoder.Decoder rangeDecoder)
-		{
-			uint newBound = (uint)(rangeDecoder.Range >> kNumBitModelTotalBits) * (uint)Prob;
-			if (rangeDecoder.Code < newBound)
-			{
-				rangeDecoder.Range = newBound;
-				Prob += (kBitModelTotal - Prob) >> kNumMoveBits;
-				if (rangeDecoder.Range < Decoder.kTopValue)
-				{
-					rangeDecoder.Code = (rangeDecoder.Code << 8) | (byte)rangeDecoder.Stream.ReadByte();
-					rangeDecoder.Range <<= 8;
-				}
-				return 0;
-			}
-			else
-			{
-				rangeDecoder.Range -= newBound;
-				rangeDecoder.Code -= newBound;
-				Prob -= (Prob) >> kNumMoveBits;
-				if (rangeDecoder.Range < Decoder.kTopValue)
-				{
-					rangeDecoder.Code = (rangeDecoder.Code << 8) | (byte)rangeDecoder.Stream.ReadByte();
-					rangeDecoder.Range <<= 8;
-				}
-				return 1;
-			}
-		}
-	}
-}
diff --git a/third_party/lzma/v4_65/files/CS/7zip/Compress/RangeCoder/RangeCoderBitTree.cs b/third_party/lzma/v4_65/files/CS/7zip/Compress/RangeCoder/RangeCoderBitTree.cs
deleted file mode 100644
index 4b4506f..0000000
--- a/third_party/lzma/v4_65/files/CS/7zip/Compress/RangeCoder/RangeCoderBitTree.cs
+++ /dev/null
@@ -1,157 +0,0 @@
-using System;
-
-namespace SevenZip.Compression.RangeCoder
-{
-	struct BitTreeEncoder
-	{
-		BitEncoder[] Models;
-		int NumBitLevels;
-
-		public BitTreeEncoder(int numBitLevels)
-		{
-			NumBitLevels = numBitLevels;
-			Models = new BitEncoder[1 << numBitLevels];
-		}
-
-		public void Init()
-		{
-			for (uint i = 1; i < (1 << NumBitLevels); i++)
-				Models[i].Init();
-		}
-
-		public void Encode(Encoder rangeEncoder, UInt32 symbol)
-		{
-			UInt32 m = 1;
-			for (int bitIndex = NumBitLevels; bitIndex > 0; )
-			{
-				bitIndex--;
-				UInt32 bit = (symbol >> bitIndex) & 1;
-				Models[m].Encode(rangeEncoder, bit);
-				m = (m << 1) | bit;
-			}
-		}
-
-		public void ReverseEncode(Encoder rangeEncoder, UInt32 symbol)
-		{
-			UInt32 m = 1;
-			for (UInt32 i = 0; i < NumBitLevels; i++)
-			{
-				UInt32 bit = symbol & 1;
-				Models[m].Encode(rangeEncoder, bit);
-				m = (m << 1) | bit;
-				symbol >>= 1;
-			}
-		}
-
-		public UInt32 GetPrice(UInt32 symbol)
-		{
-			UInt32 price = 0;
-			UInt32 m = 1;
-			for (int bitIndex = NumBitLevels; bitIndex > 0; )
-			{
-				bitIndex--;
-				UInt32 bit = (symbol >> bitIndex) & 1;
-				price += Models[m].GetPrice(bit);
-				m = (m << 1) + bit;
-			}
-			return price;
-		}
-
-		public UInt32 ReverseGetPrice(UInt32 symbol)
-		{
-			UInt32 price = 0;
-			UInt32 m = 1;
-			for (int i = NumBitLevels; i > 0; i--)
-			{
-				UInt32 bit = symbol & 1;
-				symbol >>= 1;
-				price += Models[m].GetPrice(bit);
-				m = (m << 1) | bit;
-			}
-			return price;
-		}
-
-		public static UInt32 ReverseGetPrice(BitEncoder[] Models, UInt32 startIndex,
-			int NumBitLevels, UInt32 symbol)
-		{
-			UInt32 price = 0;
-			UInt32 m = 1;
-			for (int i = NumBitLevels; i > 0; i--)
-			{
-				UInt32 bit = symbol & 1;
-				symbol >>= 1;
-				price += Models[startIndex + m].GetPrice(bit);
-				m = (m << 1) | bit;
-			}
-			return price;
-		}
-
-		public static void ReverseEncode(BitEncoder[] Models, UInt32 startIndex,
-			Encoder rangeEncoder, int NumBitLevels, UInt32 symbol)
-		{
-			UInt32 m = 1;
-			for (int i = 0; i < NumBitLevels; i++)
-			{
-				UInt32 bit = symbol & 1;
-				Models[startIndex + m].Encode(rangeEncoder, bit);
-				m = (m << 1) | bit;
-				symbol >>= 1;
-			}
-		}
-	}
-
-	struct BitTreeDecoder
-	{
-		BitDecoder[] Models;
-		int NumBitLevels;
-
-		public BitTreeDecoder(int numBitLevels)
-		{
-			NumBitLevels = numBitLevels;
-			Models = new BitDecoder[1 << numBitLevels];
-		}
-
-		public void Init()
-		{
-			for (uint i = 1; i < (1 << NumBitLevels); i++)
-				Models[i].Init();
-		}
-
-		public uint Decode(RangeCoder.Decoder rangeDecoder)
-		{
-			uint m = 1;
-			for (int bitIndex = NumBitLevels; bitIndex > 0; bitIndex--)
-				m = (m << 1) + Models[m].Decode(rangeDecoder);
-			return m - ((uint)1 << NumBitLevels);
-		}
-
-		public uint ReverseDecode(RangeCoder.Decoder rangeDecoder)
-		{
-			uint m = 1;
-			uint symbol = 0;
-			for (int bitIndex = 0; bitIndex < NumBitLevels; bitIndex++)
-			{
-				uint bit = Models[m].Decode(rangeDecoder);
-				m <<= 1;
-				m += bit;
-				symbol |= (bit << bitIndex);
-			}
-			return symbol;
-		}
-
-		public static uint ReverseDecode(BitDecoder[] Models, UInt32 startIndex,
-			RangeCoder.Decoder rangeDecoder, int NumBitLevels)
-		{
-			uint m = 1;
-			uint symbol = 0;
-			for (int bitIndex = 0; bitIndex < NumBitLevels; bitIndex++)
-			{
-				uint bit = Models[startIndex + m].Decode(rangeDecoder);
-				m <<= 1;
-				m += bit;
-				symbol |= (bit << bitIndex);
-			}
-			return symbol;
-		}
-	}
-}
diff --git a/third_party/lzma/v4_65/files/CS/7zip/ICoder.cs b/third_party/lzma/v4_65/files/CS/7zip/ICoder.cs
deleted file mode 100644
index 85bf531..0000000
--- a/third_party/lzma/v4_65/files/CS/7zip/ICoder.cs
+++ /dev/null
@@ -1,145 +0,0 @@
-// ICoder.h
-
-using System;
-
-namespace SevenZip
-{
-	/// <summary>
-	/// The exception that is thrown when an error in input stream occurs during decoding.
-	/// </summary>
-	class DataErrorException : ApplicationException
-	{
-		public DataErrorException(): base("Data Error") { }
-	}
-
-	/// <summary>
-	/// The exception that is thrown when the value of an argument is outside the allowable range.
-	/// </summary>
-	class InvalidParamException : ApplicationException
-	{
-		public InvalidParamException(): base("Invalid Parameter") { }
-	}
-
-	public interface ICodeProgress
-	{
-		/// <summary>
-		/// Callback progress.
-		/// </summary>
-		/// <param name="inSize">
-		/// input size. -1 if unknown.
-		/// </param>
-		/// <param name="outSize">
-		/// output size. -1 if unknown.
-		/// </param>
-		void SetProgress(Int64 inSize, Int64 outSize);
-	};
-
-	public interface ICoder
-	{
-		/// <summary>
-		/// Codes streams.
-		/// </summary>
-		/// <param name="inStream">
-		/// input Stream.
-		/// </param>
-		/// <param name="outStream">
-		/// output Stream.
-		/// </param>
-		/// <param name="inSize">
-		/// input Size. -1 if unknown.
-		/// </param>
-		/// <param name="outSize">
-		/// output Size. -1 if unknown.
-		/// </param>
-		/// <param name="progress">
-		/// callback progress reference.
-		/// </param>
-		/// <exception cref="SevenZip.DataErrorException">
-		/// if input stream is not valid
-		/// </exception>
-		void Code(System.IO.Stream inStream, System.IO.Stream outStream,
-			Int64 inSize, Int64 outSize, ICodeProgress progress);
-	};
-
-	/*
-	public interface ICoder2
-	{
-		 void Code(ISequentialInStream []inStreams,
-				const UInt64 []inSizes, 
-				ISequentialOutStream []outStreams, 
-				UInt64 []outSizes,
-				ICodeProgress progress);
-	};
-  */
-
-	/// <summary>
-	/// Provides the fields that represent properties idenitifiers for compressing.
-	/// </summary>
-	public enum CoderPropID
-	{
-		/// <summary>
-		/// Specifies size of dictionary.
-		/// </summary>
-		DictionarySize = 0x400,
-		/// <summary>
-		/// Specifies size of memory for PPM*.
-		/// </summary>
-		UsedMemorySize,
-		/// <summary>
-		/// Specifies order for PPM methods.
-		/// </summary>
-		Order,
-		/// <summary>
-		/// Specifies number of postion state bits for LZMA (0 <= x <= 4).
-		/// </summary>
-		PosStateBits = 0x440,
-		/// <summary>
-		/// Specifies number of literal context bits for LZMA (0 <= x <= 8).
-		/// </summary>
-		LitContextBits,
-		/// <summary>
-		/// Specifies number of literal position bits for LZMA (0 <= x <= 4).
-		/// </summary>
-		LitPosBits,
-		/// <summary>
-		/// Specifies number of fast bytes for LZ*.
-		/// </summary>
-		NumFastBytes = 0x450,
-		/// <summary>
-		/// Specifies match finder. LZMA: "BT2", "BT4" or "BT4B".
-		/// </summary>
-		MatchFinder,
-		/// <summary>
-		/// Specifies number of passes.
-		/// </summary>
-		NumPasses = 0x460,
-		/// <summary>
-		/// Specifies number of algorithm.
-		/// </summary>
-		Algorithm = 0x470,
-		/// <summary>
-		/// Specifies multithread mode.
-		/// </summary>
-		MultiThread = 0x480,
-		/// <summary>
-		/// Specifies mode with end marker.
-		/// </summary>
-		EndMarker = 0x490
-	};
-
-
-	public interface ISetCoderProperties
-	{
-		void SetCoderProperties(CoderPropID[] propIDs, object[] properties);
-	};
-
-	public interface IWriteCoderProperties
-	{
-		void WriteCoderProperties(System.IO.Stream outStream);
-	}
-
-	public interface ISetDecoderProperties
-	{
-		void SetDecoderProperties(byte[] properties);
-	}
-}
diff --git a/third_party/lzma/v4_65/files/Java/SevenZip/CRC.java b/third_party/lzma/v4_65/files/Java/SevenZip/CRC.java
deleted file mode 100644
index c55e33c..0000000
--- a/third_party/lzma/v4_65/files/Java/SevenZip/CRC.java
+++ /dev/null
@@ -1,52 +0,0 @@
-// SevenZip/CRC.java
-
-package SevenZip;
-
-public class CRC
-{
-	static public int[] Table = new int[256];
-	
-	static
-	{
-		for (int i = 0; i < 256; i++)
-		{
-			int r = i;
-			for (int j = 0; j < 8; j++)
-				if ((r & 1) != 0)
-					r = (r >>> 1) ^ 0xEDB88320;
-				else
-					r >>>= 1;
-			Table[i] = r;
-		}
-	}
-	
-	int _value = -1;
-	
-	public void Init()
-	{
-		_value = -1;
-	}
-	
-	public void Update(byte[] data, int offset, int size)
-	{
-		for (int i = 0; i < size; i++)
-			_value = Table[(_value ^ data[offset + i]) & 0xFF] ^ (_value >>> 8);
-	}
-	
-	public void Update(byte[] data)
-	{
-		int size = data.length;
-		for (int i = 0; i < size; i++)
-			_value = Table[(_value ^ data[i]) & 0xFF] ^ (_value >>> 8);
-	}
-	
-	public void UpdateByte(int b)
-	{
-		_value = Table[(_value ^ b) & 0xFF] ^ (_value >>> 8);
-	}
-	
-	public int GetDigest()
-	{
-		return _value ^ (-1);
-	}
-}
diff --git a/third_party/lzma/v4_65/files/Java/SevenZip/Compression/LZ/BinTree.java b/third_party/lzma/v4_65/files/Java/SevenZip/Compression/LZ/BinTree.java
deleted file mode 100644
index e2074e9..0000000
--- a/third_party/lzma/v4_65/files/Java/SevenZip/Compression/LZ/BinTree.java
+++ /dev/null
@@ -1,382 +0,0 @@
-// LZ.BinTree
-
-package SevenZip.Compression.LZ;
-import java.io.IOException;
-
-
-public class BinTree extends InWindow
-{
-	int _cyclicBufferPos;
-	int _cyclicBufferSize = 0;
-	int _matchMaxLen;
-	
-	int[] _son;
-	int[] _hash;
-	
-	int _cutValue = 0xFF;
-	int _hashMask;
-	int _hashSizeSum = 0;
-	
-	boolean HASH_ARRAY = true;
-
-	static final int kHash2Size = 1 << 10;
-	static final int kHash3Size = 1 << 16;
-	static final int kBT2HashSize = 1 << 16;
-	static final int kStartMaxLen = 1;
-	static final int kHash3Offset = kHash2Size;
-	static final int kEmptyHashValue = 0;
-	static final int kMaxValForNormalize = (1 << 30) - 1;
-	
-	int kNumHashDirectBytes = 0;
-	int kMinMatchCheck = 4;
-	int kFixHashSize = kHash2Size + kHash3Size;
-
-	public void SetType(int numHashBytes)
-	{
-		HASH_ARRAY = (numHashBytes > 2);
-		if (HASH_ARRAY)
-		{
-			kNumHashDirectBytes = 0;
-			kMinMatchCheck = 4;
-			kFixHashSize = kHash2Size + kHash3Size;
-		}
-		else
-		{
-			kNumHashDirectBytes = 2;
-			kMinMatchCheck = 2 + 1;
-			kFixHashSize = 0;
-		}
-	}
-	
-
-	
-
-	public void Init() throws IOException
-	{
-		super.Init();
-		for (int i = 0; i < _hashSizeSum; i++)
-			_hash[i] = kEmptyHashValue;
-		_cyclicBufferPos = 0;
-		ReduceOffsets(-1);
-	}
-	
-	public void MovePos() throws IOException
-	{
-		if (++_cyclicBufferPos >= _cyclicBufferSize)
-			_cyclicBufferPos = 0;
-		super.MovePos();
-		if (_pos == kMaxValForNormalize)
-			Normalize();
-	}
-	
-
-	
-	
-	
-	
-	
-	
-	public boolean Create(int historySize, int keepAddBufferBefore,
-			int matchMaxLen, int keepAddBufferAfter)
-	{
-		if (historySize > kMaxValForNormalize - 256)
-			return false;
-		_cutValue = 16 + (matchMaxLen >> 1);
-
-		int windowReservSize = (historySize + keepAddBufferBefore +
-				matchMaxLen + keepAddBufferAfter) / 2 + 256;
-		
-		super.Create(historySize + keepAddBufferBefore, matchMaxLen + keepAddBufferAfter, windowReservSize);
-		
-		_matchMaxLen = matchMaxLen;
-
-		int cyclicBufferSize = historySize + 1;
-		if (_cyclicBufferSize != cyclicBufferSize)
-			_son = new int[(_cyclicBufferSize = cyclicBufferSize) * 2];
-
-		int hs = kBT2HashSize;
-
-		if (HASH_ARRAY)
-		{
-			hs = historySize - 1;
-			hs |= (hs >> 1);
-			hs |= (hs >> 2);
-			hs |= (hs >> 4);
-			hs |= (hs >> 8);
-			hs >>= 1;
-			hs |= 0xFFFF;
-			if (hs > (1 << 24))
-				hs >>= 1;
-			_hashMask = hs;
-			hs++;
-			hs += kFixHashSize;
-		}
-		if (hs != _hashSizeSum)
-			_hash = new int [_hashSizeSum = hs];
-		return true;
-	}
-	public int GetMatches(int[] distances) throws IOException
-	{
-		int lenLimit;
-		if (_pos + _matchMaxLen <= _streamPos)
-			lenLimit = _matchMaxLen;
-		else
-		{
-			lenLimit = _streamPos - _pos;
-			if (lenLimit < kMinMatchCheck)
-			{
-				MovePos();
-				return 0;
-			}
-		}
-
-		int offset = 0;
-		int matchMinPos = (_pos > _cyclicBufferSize) ? (_pos - _cyclicBufferSize) : 0;
-		int cur = _bufferOffset + _pos;
-		int maxLen = kStartMaxLen; // to avoid items for len < hashSize;
-		int hashValue, hash2Value = 0, hash3Value = 0;
-		
-		if (HASH_ARRAY)
-		{
-			int temp = CrcTable[_bufferBase[cur] & 0xFF] ^ (_bufferBase[cur + 1] & 0xFF);
-			hash2Value = temp & (kHash2Size - 1);
-			temp ^= ((int)(_bufferBase[cur + 2] & 0xFF) << 8);
-			hash3Value = temp & (kHash3Size - 1);
-			hashValue = (temp ^ (CrcTable[_bufferBase[cur + 3] & 0xFF] << 5)) & _hashMask;
-		}
-		else
-			hashValue = ((_bufferBase[cur] & 0xFF) ^ ((int)(_bufferBase[cur + 1] & 0xFF) << 8));
-
-		int curMatch = _hash[kFixHashSize + hashValue];
-		if (HASH_ARRAY)
-		{
-			int curMatch2 = _hash[hash2Value];
-			int curMatch3 = _hash[kHash3Offset + hash3Value];
-			_hash[hash2Value] = _pos;
-			_hash[kHash3Offset + hash3Value] = _pos;
-			if (curMatch2 > matchMinPos)
-				if (_bufferBase[_bufferOffset + curMatch2] == _bufferBase[cur])
-				{
-					distances[offset++] = maxLen = 2;
-					distances[offset++] = _pos - curMatch2 - 1;
-				}
-			if (curMatch3 > matchMinPos)
-				if (_bufferBase[_bufferOffset + curMatch3] == _bufferBase[cur])
-				{
-					if (curMatch3 == curMatch2)
-						offset -= 2;
-					distances[offset++] = maxLen = 3;
-					distances[offset++] = _pos - curMatch3 - 1;
-					curMatch2 = curMatch3;
-				}
-			if (offset != 0 && curMatch2 == curMatch)
-			{
-				offset -= 2;
-				maxLen = kStartMaxLen;
-			}
-		}
-
-		_hash[kFixHashSize + hashValue] = _pos;
-
-		int ptr0 = (_cyclicBufferPos << 1) + 1;
-		int ptr1 = (_cyclicBufferPos << 1);
-
-		int len0, len1;
-		len0 = len1 = kNumHashDirectBytes;
-
-		if (kNumHashDirectBytes != 0)
-		{
-			if (curMatch > matchMinPos)
-			{
-				if (_bufferBase[_bufferOffset + curMatch + kNumHashDirectBytes] !=
-						_bufferBase[cur + kNumHashDirectBytes])
-				{
-					distances[offset++] = maxLen = kNumHashDirectBytes;
-					distances[offset++] = _pos - curMatch - 1;
-				}
-			}
-		}
-
-		int count = _cutValue;
-
-		while (true)
-		{
-			if (curMatch <= matchMinPos || count-- == 0)
-			{
-				_son[ptr0] = _son[ptr1] = kEmptyHashValue;
-				break;
-			}
-			int delta = _pos - curMatch;
-			int cyclicPos = ((delta <= _cyclicBufferPos) ?
-				(_cyclicBufferPos - delta) :
-				(_cyclicBufferPos - delta + _cyclicBufferSize)) << 1;
-
-			int pby1 = _bufferOffset + curMatch;
-			int len = Math.min(len0, len1);
-			if (_bufferBase[pby1 + len] == _bufferBase[cur + len])
-			{
-				while(++len != lenLimit)
-					if (_bufferBase[pby1 + len] != _bufferBase[cur + len])
-						break;
-				if (maxLen < len)
-				{
-					distances[offset++] = maxLen = len;
-					distances[offset++] = delta - 1;
-					if (len == lenLimit)
-					{
-						_son[ptr1] = _son[cyclicPos];
-						_son[ptr0] = _son[cyclicPos + 1];
-						break;
-					}
-				}
-			}
-			if ((_bufferBase[pby1 + len] & 0xFF) < (_bufferBase[cur + len] & 0xFF))
-			{
-				_son[ptr1] = curMatch;
-				ptr1 = cyclicPos + 1;
-				curMatch = _son[ptr1];
-				len1 = len;
-			}
-			else
-			{
-				_son[ptr0] = curMatch;
-				ptr0 = cyclicPos;
-				curMatch = _son[ptr0];
-				len0 = len;
-			}
-		}
-		MovePos();
-		return offset;
-	}
-
-	public void Skip(int num) throws IOException
-	{
-		do
-		{
-			int lenLimit;
-			if (_pos + _matchMaxLen <= _streamPos)
-			lenLimit = _matchMaxLen;
-			else
-			{
-				lenLimit = _streamPos - _pos;
-				if (lenLimit < kMinMatchCheck)
-				{
-					MovePos();
-					continue;
-				}
-			}
-
-			int matchMinPos = (_pos > _cyclicBufferSize) ? (_pos - _cyclicBufferSize) : 0;
-			int cur = _bufferOffset + _pos;
-			
-			int hashValue;
-
-			if (HASH_ARRAY)
-			{
-				int temp = CrcTable[_bufferBase[cur] & 0xFF] ^ (_bufferBase[cur + 1] & 0xFF);
-				int hash2Value = temp & (kHash2Size - 1);
-				_hash[hash2Value] = _pos;
-				temp ^= ((int)(_bufferBase[cur + 2] & 0xFF) << 8);
-				int hash3Value = temp & (kHash3Size - 1);
-				_hash[kHash3Offset + hash3Value] = _pos;
-				hashValue = (temp ^ (CrcTable[_bufferBase[cur + 3] & 0xFF] << 5)) & _hashMask;
-			}
-			else
-				hashValue = ((_bufferBase[cur] & 0xFF) ^ ((int)(_bufferBase[cur + 1] & 0xFF) << 8));
-
-			int curMatch = _hash[kFixHashSize + hashValue];
-			_hash[kFixHashSize + hashValue] = _pos;
-
-			int ptr0 = (_cyclicBufferPos << 1) + 1;
-			int ptr1 = (_cyclicBufferPos << 1);
-
-			int len0, len1;
-			len0 = len1 = kNumHashDirectBytes;
-
-			int count = _cutValue;
-			while (true)
-			{
-				if (curMatch <= matchMinPos || count-- == 0)
-				{
-					_son[ptr0] = _son[ptr1] = kEmptyHashValue;
-					break;
-				}
-
-				int delta = _pos - curMatch;
-				int cyclicPos = ((delta <= _cyclicBufferPos) ?
-					(_cyclicBufferPos - delta) :
-					(_cyclicBufferPos - delta + _cyclicBufferSize)) << 1;
-
-				int pby1 = _bufferOffset + curMatch;
-				int len = Math.min(len0, len1);
-				if (_bufferBase[pby1 + len] == _bufferBase[cur + len])
-				{
-					while (++len != lenLimit)
-						if (_bufferBase[pby1 + len] != _bufferBase[cur + len])
-							break;
-					if (len == lenLimit)
-					{
-						_son[ptr1] = _son[cyclicPos];
-						_son[ptr0] = _son[cyclicPos + 1];
-						break;
-					}
-				}
-				if ((_bufferBase[pby1 + len] & 0xFF) < (_bufferBase[cur + len] & 0xFF))
-				{
-					_son[ptr1] = curMatch;
-					ptr1 = cyclicPos + 1;
-					curMatch = _son[ptr1];
-					len1 = len;
-				}
-				else
-				{
-					_son[ptr0] = curMatch;
-					ptr0 = cyclicPos;
-					curMatch = _son[ptr0];
-					len0 = len;
-				}
-			}
-			MovePos();
-		}
-		while (--num != 0);
-	}
-	
-	void NormalizeLinks(int[] items, int numItems, int subValue)
-	{
-		for (int i = 0; i < numItems; i++)
-		{
-			int value = items[i];
-			if (value <= subValue)
-				value = kEmptyHashValue;
-			else
-				value -= subValue;
-			items[i] = value;
-		}
-	}
-	
-	void Normalize()
-	{
-		int subValue = _pos - _cyclicBufferSize;
-		NormalizeLinks(_son, _cyclicBufferSize * 2, subValue);
-		NormalizeLinks(_hash, _hashSizeSum, subValue);
-		ReduceOffsets(subValue);
-	}
-	
-	public void SetCutValue(int cutValue) { _cutValue = cutValue; }
-
-	private static final int[] CrcTable = new int[256];
-
-	static
-	{
-		for (int i = 0; i < 256; i++)
-		{
-			int r = i;
-			for (int j = 0; j < 8; j++)
-				if ((r & 1) != 0)
-					r = (r >>> 1) ^ 0xEDB88320;
-				else
-					r >>>= 1;
-			CrcTable[i] = r;
-		}
-	}
-}
diff --git a/third_party/lzma/v4_65/files/Java/SevenZip/Compression/LZ/InWindow.java b/third_party/lzma/v4_65/files/Java/SevenZip/Compression/LZ/InWindow.java
deleted file mode 100644
index c9efe60..0000000
--- a/third_party/lzma/v4_65/files/Java/SevenZip/Compression/LZ/InWindow.java
+++ /dev/null
@@ -1,131 +0,0 @@
-// LZ.InWindow
-
-package SevenZip.Compression.LZ;
-
-import java.io.IOException;
-
-public class InWindow
-{
-	public byte[] _bufferBase; // pointer to buffer with data
-	java.io.InputStream _stream;
-	int _posLimit;  // offset (from _buffer) of first byte when new block reading must be done
-	boolean _streamEndWasReached; // if (true) then _streamPos shows real end of stream
-	
-	int _pointerToLastSafePosition;
-	
-	public int _bufferOffset;
-	
-	public int _blockSize;  // Size of Allocated memory block
-	public int _pos;             // offset (from _buffer) of curent byte
-	int _keepSizeBefore;  // how many BYTEs must be kept in buffer before _pos
-	int _keepSizeAfter;   // how many BYTEs must be kept buffer after _pos
-	public int _streamPos;   // offset (from _buffer) of first not read byte from Stream
-	
-	public void MoveBlock()
-	{
-		int offset = _bufferOffset + _pos - _keepSizeBefore;
-		// we need one additional byte, since MovePos moves on 1 byte.
-		if (offset > 0)
-			offset--;
-
-		int numBytes = _bufferOffset + _streamPos - offset;
-		
-		// check negative offset ????
-		for (int i = 0; i < numBytes; i++)
-			_bufferBase[i] = _bufferBase[offset + i];
-		_bufferOffset -= offset;
-	}
-	
-	public void ReadBlock() throws IOException
-	{
-		if (_streamEndWasReached)
-			return;
-		while (true)
-		{
-			int size = (0 - _bufferOffset) + _blockSize - _streamPos;
-			if (size == 0)
-				return;
-			int numReadBytes = _stream.read(_bufferBase, _bufferOffset + _streamPos, size);
-			if (numReadBytes == -1)
-			{
-				_posLimit = _streamPos;
-				int pointerToPostion = _bufferOffset + _posLimit;
-				if (pointerToPostion > _pointerToLastSafePosition)
-					_posLimit = _pointerToLastSafePosition - _bufferOffset;
-				
-				_streamEndWasReached = true;
-				return;
-			}
-			_streamPos += numReadBytes;
-			if (_streamPos >= _pos + _keepSizeAfter)
-				_posLimit = _streamPos - _keepSizeAfter;
-		}
-	}
-	
-	void Free() { _bufferBase = null; }
-	
-	public void Create(int keepSizeBefore, int keepSizeAfter, int keepSizeReserv)
-	{
-		_keepSizeBefore = keepSizeBefore;
-		_keepSizeAfter = keepSizeAfter;
-		int blockSize = keepSizeBefore + keepSizeAfter + keepSizeReserv;
-		if (_bufferBase == null || _blockSize != blockSize)
-		{
-			Free();
-			_blockSize = blockSize;
-			_bufferBase = new byte[_blockSize];
-		}
-		_pointerToLastSafePosition = _blockSize - keepSizeAfter;
-	}
-	
-	public void SetStream(java.io.InputStream stream) { _stream = stream; 	}
-	public void ReleaseStream() { _stream = null; }
-
-	public void Init() throws IOException
-	{
-		_bufferOffset = 0;
-		_pos = 0;
-		_streamPos = 0;
-		_streamEndWasReached = false;
-		ReadBlock();
-	}
-	
-	public void MovePos() throws IOException
-	{
-		_pos++;
-		if (_pos > _posLimit)
-		{
-			int pointerToPostion = _bufferOffset + _pos;
-			if (pointerToPostion > _pointerToLastSafePosition)
-				MoveBlock();
-			ReadBlock();
-		}
-	}
-	
-	public byte GetIndexByte(int index)	{ return _bufferBase[_bufferOffset + _pos + index]; }
-	
-	// index + limit have not to exceed _keepSizeAfter;
-	public int GetMatchLen(int index, int distance, int limit)
-	{
-		if (_streamEndWasReached)
-			if ((_pos + index) + limit > _streamPos)
-				limit = _streamPos - (_pos + index);
-		distance++;
-		// Byte *pby = _buffer + (size_t)_pos + index;
-		int pby = _bufferOffset + _pos + index;
-		
-		int i;
-		for (i = 0; i < limit && _bufferBase[pby + i] == _bufferBase[pby + i - distance]; i++);
-		return i;
-	}
-	
-	public int GetNumAvailableBytes()	{ return _streamPos - _pos; }
-	
-	public void ReduceOffsets(int subValue)
-	{
-		_bufferOffset += subValue;
-		_posLimit -= subValue;
-		_pos -= subValue;
-		_streamPos -= subValue;
-	}
-}
diff --git a/third_party/lzma/v4_65/files/Java/SevenZip/Compression/LZ/OutWindow.java b/third_party/lzma/v4_65/files/Java/SevenZip/Compression/LZ/OutWindow.java
deleted file mode 100644
index 2fd2832..0000000
--- a/third_party/lzma/v4_65/files/Java/SevenZip/Compression/LZ/OutWindow.java
+++ /dev/null
@@ -1,85 +0,0 @@
-// LZ.OutWindow
-
-package SevenZip.Compression.LZ;
-
-import java.io.IOException;
-
-public class OutWindow
-{
-	byte[] _buffer;
-	int _pos;
-	int _windowSize = 0;
-	int _streamPos;
-	java.io.OutputStream _stream;
-	
-	public void Create(int windowSize)
-	{
-		if (_buffer == null || _windowSize != windowSize)
-			_buffer = new byte[windowSize];
-		_windowSize = windowSize;
-		_pos = 0;
-		_streamPos = 0;
-	}
-	
-	public void SetStream(java.io.OutputStream stream) throws IOException
-	{
-		ReleaseStream();
-		_stream = stream;
-	}
-	
-	public void ReleaseStream() throws IOException
-	{
-		Flush();
-		_stream = null;
-	}
-	
-	public void Init(boolean solid)
-	{
-		if (!solid)
-		{
-			_streamPos = 0;
-			_pos = 0;
-		}
-	}
-	
-	public void Flush() throws IOException
-	{
-		int size = _pos - _streamPos;
-		if (size == 0)
-			return;
-		_stream.write(_buffer, _streamPos, size);
-		if (_pos >= _windowSize)
-			_pos = 0;
-		_streamPos = _pos;
-	}
-	
-	public void CopyBlock(int distance, int len) throws IOException
-	{
-		int pos = _pos - distance - 1;
-		if (pos < 0)
-			pos += _windowSize;
-		for (; len != 0; len--)
-		{
-			if (pos >= _windowSize)
-				pos = 0;
-			_buffer[_pos++] = _buffer[pos++];
-			if (_pos >= _windowSize)
-				Flush();
-		}
-	}
-	
-	public void PutByte(byte b) throws IOException
-	{
-		_buffer[_pos++] = b;
-		if (_pos >= _windowSize)
-			Flush();
-	}
-	
-	public byte GetByte(int distance)
-	{
-		int pos = _pos - distance - 1;
-		if (pos < 0)
-			pos += _windowSize;
-		return _buffer[pos];
-	}
-}
diff --git a/third_party/lzma/v4_65/files/Java/SevenZip/Compression/LZMA/Base.java b/third_party/lzma/v4_65/files/Java/SevenZip/Compression/LZMA/Base.java
deleted file mode 100644
index b4f2fb5..0000000
--- a/third_party/lzma/v4_65/files/Java/SevenZip/Compression/LZMA/Base.java
+++ /dev/null
@@ -1,88 +0,0 @@
-// Base.java
-
-package SevenZip.Compression.LZMA;
-
-public class Base
-{
-	public static final int kNumRepDistances = 4;
-	public static final int kNumStates = 12;
-	
-	public static final int StateInit()
-	{
-		return 0;
-	}
-	
-	public static final int StateUpdateChar(int index)
-	{
-		if (index < 4) 
-			return 0;
-		if (index < 10) 
-			return index - 3;
-		return index - 6;
-	}
-	
-	public static final int StateUpdateMatch(int index)
-	{
-		return (index < 7 ? 7 : 10); 
-	}
-
-	public static final int StateUpdateRep(int index)
-	{ 
-		return (index < 7 ? 8 : 11); 
-	}
-	
-	public static final int StateUpdateShortRep(int index)
-	{ 
-		return (index < 7 ? 9 : 11); 
-	}
-
-	public static final boolean StateIsCharState(int index)
-	{ 
-		return index < 7; 
-	}
-	
-	public static final int kNumPosSlotBits = 6;
-	public static final int kDicLogSizeMin = 0;
-	// public static final int kDicLogSizeMax = 28;
-	// public static final int kDistTableSizeMax = kDicLogSizeMax * 2;
-	
-	public static final int kNumLenToPosStatesBits = 2; // it's for speed optimization
-	public static final int kNumLenToPosStates = 1 << kNumLenToPosStatesBits;
-	
-	public static final int kMatchMinLen = 2;
-	
-	public static final int GetLenToPosState(int len)
-	{
-		len -= kMatchMinLen;
-		if (len < kNumLenToPosStates)
-			return len;
-		return (int)(kNumLenToPosStates - 1);
-	}
-	
-	public static final int kNumAlignBits = 4;
-	public static final int kAlignTableSize = 1 << kNumAlignBits;
-	public static final int kAlignMask = (kAlignTableSize - 1);
-	
-	public static final int kStartPosModelIndex = 4;
-	public static final int kEndPosModelIndex = 14;
-	public static final int kNumPosModels = kEndPosModelIndex - kStartPosModelIndex;
-	
-	public static final  int kNumFullDistances = 1 << (kEndPosModelIndex / 2);
-	
-	public static final  int kNumLitPosStatesBitsEncodingMax = 4;
-	public static final  int kNumLitContextBitsMax = 8;
-	
-	public static final  int kNumPosStatesBitsMax = 4;
-	public static final  int kNumPosStatesMax = (1 << kNumPosStatesBitsMax);
-	public static final  int kNumPosStatesBitsEncodingMax = 4;
-	public static final  int kNumPosStatesEncodingMax = (1 << kNumPosStatesBitsEncodingMax);
-	
-	public static final  int kNumLowLenBits = 3;
-	public static final  int kNumMidLenBits = 3;
-	public static final  int kNumHighLenBits = 8;
-	public static final  int kNumLowLenSymbols = 1 << kNumLowLenBits;
-	public static final  int kNumMidLenSymbols = 1 << kNumMidLenBits;
-	public static final  int kNumLenSymbols = kNumLowLenSymbols + kNumMidLenSymbols +
-			(1 << kNumHighLenBits);
-	public static final  int kMatchMaxLen = kMatchMinLen + kNumLenSymbols - 1;
-}
diff --git a/third_party/lzma/v4_65/files/Java/SevenZip/Compression/LZMA/Decoder.java b/third_party/lzma/v4_65/files/Java/SevenZip/Compression/LZMA/Decoder.java
deleted file mode 100644
index 16ee249..0000000
--- a/third_party/lzma/v4_65/files/Java/SevenZip/Compression/LZMA/Decoder.java
+++ /dev/null
@@ -1,329 +0,0 @@
-package SevenZip.Compression.LZMA;
-
-import SevenZip.Compression.RangeCoder.BitTreeDecoder;
-import SevenZip.Compression.LZMA.Base;
-import SevenZip.Compression.LZ.OutWindow;
-import java.io.IOException;
-
-public class Decoder
-{
-	class LenDecoder
-	{
-		short[] m_Choice = new short[2];
-		BitTreeDecoder[] m_LowCoder = new BitTreeDecoder[Base.kNumPosStatesMax];
-		BitTreeDecoder[] m_MidCoder = new BitTreeDecoder[Base.kNumPosStatesMax];
-		BitTreeDecoder m_HighCoder = new BitTreeDecoder(Base.kNumHighLenBits);
-		int m_NumPosStates = 0;
-		
-		public void Create(int numPosStates)
-		{
-			for (; m_NumPosStates < numPosStates; m_NumPosStates++)
-			{
-				m_LowCoder[m_NumPosStates] = new BitTreeDecoder(Base.kNumLowLenBits);
-				m_MidCoder[m_NumPosStates] = new BitTreeDecoder(Base.kNumMidLenBits);
-			}
-		}
-		
-		public void Init()
-		{
-			SevenZip.Compression.RangeCoder.Decoder.InitBitModels(m_Choice);
-			for (int posState = 0; posState < m_NumPosStates; posState++)
-			{
-				m_LowCoder[posState].Init();
-				m_MidCoder[posState].Init();
-			}
-			m_HighCoder.Init();
-		}
-		
-		public int Decode(SevenZip.Compression.RangeCoder.Decoder rangeDecoder, int posState) throws IOException
-		{
-			if (rangeDecoder.DecodeBit(m_Choice, 0) == 0)
-				return m_LowCoder[posState].Decode(rangeDecoder);
-			int symbol = Base.kNumLowLenSymbols;
-			if (rangeDecoder.DecodeBit(m_Choice, 1) == 0)
-				symbol += m_MidCoder[posState].Decode(rangeDecoder);
-			else
-				symbol += Base.kNumMidLenSymbols + m_HighCoder.Decode(rangeDecoder);
-			return symbol;
-		}
-	}
-	
-	class LiteralDecoder
-	{
-		class Decoder2
-		{
-			short[] m_Decoders = new short[0x300];
-			
-			public void Init()
-			{
-				SevenZip.Compression.RangeCoder.Decoder.InitBitModels(m_Decoders);
-			}
-			
-			public byte DecodeNormal(SevenZip.Compression.RangeCoder.Decoder rangeDecoder) throws IOException
-			{
-				int symbol = 1;
-				do
-					symbol = (symbol << 1) | rangeDecoder.DecodeBit(m_Decoders, symbol);
-				while (symbol < 0x100);
-				return (byte)symbol;
-			}
-			
-			public byte DecodeWithMatchByte(SevenZip.Compression.RangeCoder.Decoder rangeDecoder, byte matchByte) throws IOException
-			{
-				int symbol = 1;
-				do
-				{
-					int matchBit = (matchByte >> 7) & 1;
-					matchByte <<= 1;
-					int bit = rangeDecoder.DecodeBit(m_Decoders, ((1 + matchBit) << 8) + symbol);
-					symbol = (symbol << 1) | bit;
-					if (matchBit != bit)
-					{
-						while (symbol < 0x100)
-							symbol = (symbol << 1) | rangeDecoder.DecodeBit(m_Decoders, symbol);
-						break;
-					}
-				}
-				while (symbol < 0x100);
-				return (byte)symbol;
-			}
-		}
-		
-		Decoder2[] m_Coders;
-		int m_NumPrevBits;
-		int m_NumPosBits;
-		int m_PosMask;
-		
-		public void Create(int numPosBits, int numPrevBits)
-		{
-			if (m_Coders != null && m_NumPrevBits == numPrevBits && m_NumPosBits == numPosBits)
-				return;
-			m_NumPosBits = numPosBits;
-			m_PosMask = (1 << numPosBits) - 1;
-			m_NumPrevBits = numPrevBits;
-			int numStates = 1 << (m_NumPrevBits + m_NumPosBits);
-			m_Coders = new Decoder2[numStates];
-			for (int i = 0; i < numStates; i++)
-				m_Coders[i] = new Decoder2();
-		}
-		
-		public void Init()
-		{
-			int numStates = 1 << (m_NumPrevBits + m_NumPosBits);
-			for (int i = 0; i < numStates; i++)
-				m_Coders[i].Init();
-		}
-		
-		Decoder2 GetDecoder(int pos, byte prevByte)
-		{
-			return m_Coders[((pos & m_PosMask) << m_NumPrevBits) + ((prevByte & 0xFF) >>> (8 - m_NumPrevBits))];
-		}
-	}
-	
-	OutWindow m_OutWindow = new OutWindow();
-	SevenZip.Compression.RangeCoder.Decoder m_RangeDecoder = new SevenZip.Compression.RangeCoder.Decoder();
-	
-	short[] m_IsMatchDecoders = new short[Base.kNumStates << Base.kNumPosStatesBitsMax];
-	short[] m_IsRepDecoders = new short[Base.kNumStates];
-	short[] m_IsRepG0Decoders = new short[Base.kNumStates];
-	short[] m_IsRepG1Decoders = new short[Base.kNumStates];
-	short[] m_IsRepG2Decoders = new short[Base.kNumStates];
-	short[] m_IsRep0LongDecoders = new short[Base.kNumStates << Base.kNumPosStatesBitsMax];
-	
-	BitTreeDecoder[] m_PosSlotDecoder = new BitTreeDecoder[Base.kNumLenToPosStates];
-	short[] m_PosDecoders = new short[Base.kNumFullDistances - Base.kEndPosModelIndex];
-	
-	BitTreeDecoder m_PosAlignDecoder = new BitTreeDecoder(Base.kNumAlignBits);
-	
-	LenDecoder m_LenDecoder = new LenDecoder();
-	LenDecoder m_RepLenDecoder = new LenDecoder();
-	
-	LiteralDecoder m_LiteralDecoder = new LiteralDecoder();
-	
-	int m_DictionarySize = -1;
-	int m_DictionarySizeCheck =  -1;
-	
-	int m_PosStateMask;
-	
-	public Decoder()
-	{
-		for (int i = 0; i < Base.kNumLenToPosStates; i++)
-			m_PosSlotDecoder[i] = new BitTreeDecoder(Base.kNumPosSlotBits);
-	}
-	
-	boolean SetDictionarySize(int dictionarySize)
-	{
-		if (dictionarySize < 0)
-			return false;
-		if (m_DictionarySize != dictionarySize)
-		{
-			m_DictionarySize = dictionarySize;
-			m_DictionarySizeCheck = Math.max(m_DictionarySize, 1);
-			m_OutWindow.Create(Math.max(m_DictionarySizeCheck, (1 << 12)));
-		}
-		return true;
-	}
-	
-	boolean SetLcLpPb(int lc, int lp, int pb)
-	{
-		if (lc > Base.kNumLitContextBitsMax || lp > 4 || pb > Base.kNumPosStatesBitsMax)
-			return false;
-		m_LiteralDecoder.Create(lp, lc);
-		int numPosStates = 1 << pb;
-		m_LenDecoder.Create(numPosStates);
-		m_RepLenDecoder.Create(numPosStates);
-		m_PosStateMask = numPosStates - 1;
-		return true;
-	}
-	
-	void Init() throws IOException
-	{
-		m_OutWindow.Init(false);
-		
-		SevenZip.Compression.RangeCoder.Decoder.InitBitModels(m_IsMatchDecoders);
-		SevenZip.Compression.RangeCoder.Decoder.InitBitModels(m_IsRep0LongDecoders);
-		SevenZip.Compression.RangeCoder.Decoder.InitBitModels(m_IsRepDecoders);
-		SevenZip.Compression.RangeCoder.Decoder.InitBitModels(m_IsRepG0Decoders);
-		SevenZip.Compression.RangeCoder.Decoder.InitBitModels(m_IsRepG1Decoders);
-		SevenZip.Compression.RangeCoder.Decoder.InitBitModels(m_IsRepG2Decoders);
-		SevenZip.Compression.RangeCoder.Decoder.InitBitModels(m_PosDecoders);
-		
-		m_LiteralDecoder.Init();
-		int i;
-		for (i = 0; i < Base.kNumLenToPosStates; i++)
-			m_PosSlotDecoder[i].Init();
-		m_LenDecoder.Init();
-		m_RepLenDecoder.Init();
-		m_PosAlignDecoder.Init();
-		m_RangeDecoder.Init();
-	}
-	
-	public boolean Code(java.io.InputStream inStream, java.io.OutputStream outStream,
-			long outSize) throws IOException
-	{
-		m_RangeDecoder.SetStream(inStream);
-		m_OutWindow.SetStream(outStream);
-		Init();
-		
-		int state = Base.StateInit();
-		int rep0 = 0, rep1 = 0, rep2 = 0, rep3 = 0;
-		
-		long nowPos64 = 0;
-		byte prevByte = 0;
-		while (outSize < 0 || nowPos64 < outSize)
-		{
-			int posState = (int)nowPos64 & m_PosStateMask;
-			if (m_RangeDecoder.DecodeBit(m_IsMatchDecoders, (state << Base.kNumPosStatesBitsMax) + posState) == 0)
-			{
-				LiteralDecoder.Decoder2 decoder2 = m_LiteralDecoder.GetDecoder((int)nowPos64, prevByte);
-				if (!Base.StateIsCharState(state))
-					prevByte = decoder2.DecodeWithMatchByte(m_RangeDecoder, m_OutWindow.GetByte(rep0));
-				else
-					prevByte = decoder2.DecodeNormal(m_RangeDecoder);
-				m_OutWindow.PutByte(prevByte);
-				state = Base.StateUpdateChar(state);
-				nowPos64++;
-			}
-			else
-			{
-				int len;
-				if (m_RangeDecoder.DecodeBit(m_IsRepDecoders, state) == 1)
-				{
-					len = 0;
-					if (m_RangeDecoder.DecodeBit(m_IsRepG0Decoders, state) == 0)
-					{
-						if (m_RangeDecoder.DecodeBit(m_IsRep0LongDecoders, (state << Base.kNumPosStatesBitsMax) + posState) == 0)
-						{
-							state = Base.StateUpdateShortRep(state);
-							len = 1;
-						}
-					}
-					else
-					{
-						int distance;
-						if (m_RangeDecoder.DecodeBit(m_IsRepG1Decoders, state) == 0)
-							distance = rep1;
-						else
-						{
-							if (m_RangeDecoder.DecodeBit(m_IsRepG2Decoders, state) == 0)
-								distance = rep2;
-							else
-							{
-								distance = rep3;
-								rep3 = rep2;
-							}
-							rep2 = rep1;
-						}
-						rep1 = rep0;
-						rep0 = distance;
-					}
-					if (len == 0)
-					{
-						len = m_RepLenDecoder.Decode(m_RangeDecoder, posState) + Base.kMatchMinLen;
-						state = Base.StateUpdateRep(state);
-					}
-				}
-				else
-				{
-					rep3 = rep2;
-					rep2 = rep1;
-					rep1 = rep0;
-					len = Base.kMatchMinLen + m_LenDecoder.Decode(m_RangeDecoder, posState);
-					state = Base.StateUpdateMatch(state);
-					int posSlot = m_PosSlotDecoder[Base.GetLenToPosState(len)].Decode(m_RangeDecoder);
-					if (posSlot >= Base.kStartPosModelIndex)
-					{
-						int numDirectBits = (posSlot >> 1) - 1;
-						rep0 = ((2 | (posSlot & 1)) << numDirectBits);
-						if (posSlot < Base.kEndPosModelIndex)
-							rep0 += BitTreeDecoder.ReverseDecode(m_PosDecoders,
-									rep0 - posSlot - 1, m_RangeDecoder, numDirectBits);
-						else
-						{
-							rep0 += (m_RangeDecoder.DecodeDirectBits(
-									numDirectBits - Base.kNumAlignBits) << Base.kNumAlignBits);
-							rep0 += m_PosAlignDecoder.ReverseDecode(m_RangeDecoder);
-							if (rep0 < 0)
-							{
-								if (rep0 == -1)
-									break;
-								return false;
-							}
-						}
-					}
-					else
-						rep0 = posSlot;
-				}
-				if (rep0 >= nowPos64 || rep0 >= m_DictionarySizeCheck)
-				{
-					// m_OutWindow.Flush();
-					return false;
-				}
-				m_OutWindow.CopyBlock(rep0, len);
-				nowPos64 += len;
-				prevByte = m_OutWindow.GetByte(0);
-			}
-		}
-		m_OutWindow.Flush();
-		m_OutWindow.ReleaseStream();
-		m_RangeDecoder.ReleaseStream();
-		return true;
-	}
-	
-	public boolean SetDecoderProperties(byte[] properties)
-	{
-		if (properties.length < 5)
-			return false;
-		int val = properties[0] & 0xFF;
-		int lc = val % 9;
-		int remainder = val / 9;
-		int lp = remainder % 5;
-		int pb = remainder / 5;
-		int dictionarySize = 0;
-		for (int i = 0; i < 4; i++)
-			dictionarySize += ((int)(properties[1 + i]) & 0xFF) << (i * 8);
-		if (!SetLcLpPb(lc, lp, pb))
-			return false;
-		return SetDictionarySize(dictionarySize);
-	}
-}
diff --git a/third_party/lzma/v4_65/files/Java/SevenZip/Compression/LZMA/Encoder.java b/third_party/lzma/v4_65/files/Java/SevenZip/Compression/LZMA/Encoder.java
deleted file mode 100644
index e421810..0000000
--- a/third_party/lzma/v4_65/files/Java/SevenZip/Compression/LZMA/Encoder.java
+++ /dev/null
@@ -1,1416 +0,0 @@
-package SevenZip.Compression.LZMA;
-
-import SevenZip.Compression.RangeCoder.BitTreeEncoder;
-import SevenZip.Compression.LZMA.Base;
-import SevenZip.Compression.LZ.BinTree;
-import SevenZip.ICodeProgress;
-import java.io.IOException;
-
-public class Encoder
-{
-	public static final int EMatchFinderTypeBT2 = 0;
-	public static final int EMatchFinderTypeBT4 = 1;
-
-
-
-
-	static final int kIfinityPrice = 0xFFFFFFF;
-
-	static byte[] g_FastPos = new byte[1 << 11];
-
-	static
-	{
-		int kFastSlots = 22;
-		int c = 2;
-		g_FastPos[0] = 0;
-		g_FastPos[1] = 1;
-		for (int slotFast = 2; slotFast < kFastSlots; slotFast++)
-		{
-			int k = (1 << ((slotFast >> 1) - 1));
-			for (int j = 0; j < k; j++, c++)
-				g_FastPos[c] = (byte)slotFast;
-		}
-	}
-
-	static int GetPosSlot(int pos)
-	{
-		if (pos < (1 << 11))
-			return g_FastPos[pos];
-		if (pos < (1 << 21))
-			return (g_FastPos[pos >> 10] + 20);
-		return (g_FastPos[pos >> 20] + 40);
-	}
-
-	static int GetPosSlot2(int pos)
-	{
-		if (pos < (1 << 17))
-			return (g_FastPos[pos >> 6] + 12);
-		if (pos < (1 << 27))
-			return (g_FastPos[pos >> 16] + 32);
-		return (g_FastPos[pos >> 26] + 52);
-	}
-
-	int _state = Base.StateInit();
-	byte _previousByte;
-	int[] _repDistances = new int[Base.kNumRepDistances];
-
-	void BaseInit()
-	{
-		_state = Base.StateInit();
-		_previousByte = 0;
-		for (int i = 0; i < Base.kNumRepDistances; i++)
-			_repDistances[i] = 0;
-	}
-
-	static final int kDefaultDictionaryLogSize = 22;
-	static final int kNumFastBytesDefault = 0x20;
-
-	class LiteralEncoder
-	{
-		class Encoder2
-		{
-			short[] m_Encoders = new short[0x300];
-
-			public void Init() { SevenZip.Compression.RangeCoder.Encoder.InitBitModels(m_Encoders); }
-
-
-
-			public void Encode(SevenZip.Compression.RangeCoder.Encoder rangeEncoder, byte symbol) throws IOException
-			{
-				int context = 1;
-				for (int i = 7; i >= 0; i--)
-				{
-					int bit = ((symbol >> i) & 1);
-					rangeEncoder.Encode(m_Encoders, context, bit);
-					context = (context << 1) | bit;
-				}
-			}
-
-			public void EncodeMatched(SevenZip.Compression.RangeCoder.Encoder rangeEncoder, byte matchByte, byte symbol) throws IOException
-			{
-				int context = 1;
-				boolean same = true;
-				for (int i = 7; i >= 0; i--)
-				{
-					int bit = ((symbol >> i) & 1);
-					int state = context;
-					if (same)
-					{
-						int matchBit = ((matchByte >> i) & 1);
-						state += ((1 + matchBit) << 8);
-						same = (matchBit == bit);
-					}
-					rangeEncoder.Encode(m_Encoders, state, bit);
-					context = (context << 1) | bit;
-				}
-			}
-
-			public int GetPrice(boolean matchMode, byte matchByte, byte symbol)
-			{
-				int price = 0;
-				int context = 1;
-				int i = 7;
-				if (matchMode)
-				{
-					for (; i >= 0; i--)
-					{
-						int matchBit = (matchByte >> i) & 1;
-						int bit = (symbol >> i) & 1;
-						price += SevenZip.Compression.RangeCoder.Encoder.GetPrice(m_Encoders[((1 + matchBit) << 8) + context], bit);
-						context = (context << 1) | bit;
-						if (matchBit != bit)
-						{
-							i--;
-							break;
-						}
-					}
-				}
-				for (; i >= 0; i--)
-				{
-					int bit = (symbol >> i) & 1;
-					price += SevenZip.Compression.RangeCoder.Encoder.GetPrice(m_Encoders[context], bit);
-					context = (context << 1) | bit;
-				}
-				return price;
-			}
-		}
-
-		Encoder2[] m_Coders;
-		int m_NumPrevBits;
-		int m_NumPosBits;
-		int m_PosMask;
-
-		public void Create(int numPosBits, int numPrevBits)
-		{
-			if (m_Coders != null && m_NumPrevBits == numPrevBits && m_NumPosBits == numPosBits)
-				return;
-			m_NumPosBits = numPosBits;
-			m_PosMask = (1 << numPosBits) - 1;
-			m_NumPrevBits = numPrevBits;
-			int numStates = 1 << (m_NumPrevBits + m_NumPosBits);
-			m_Coders = new Encoder2[numStates];
-			for (int i = 0; i < numStates; i++)
-				m_Coders[i] = new Encoder2();
-		}
-
-		public void Init()
-		{
-			int numStates = 1 << (m_NumPrevBits + m_NumPosBits);
-			for (int i = 0; i < numStates; i++)
-				m_Coders[i].Init();
-		}
-
-		public Encoder2 GetSubCoder(int pos, byte prevByte)
-		{ return m_Coders[((pos & m_PosMask) << m_NumPrevBits) + ((prevByte & 0xFF) >>> (8 - m_NumPrevBits))]; }
-	}
-
-	class LenEncoder
-	{
-		short[] _choice = new short[2];
-		BitTreeEncoder[] _lowCoder = new BitTreeEncoder[Base.kNumPosStatesEncodingMax];
-		BitTreeEncoder[] _midCoder = new BitTreeEncoder[Base.kNumPosStatesEncodingMax];
-		BitTreeEncoder _highCoder = new BitTreeEncoder(Base.kNumHighLenBits);
-
-
-		public LenEncoder()
-		{
-			for (int posState = 0; posState < Base.kNumPosStatesEncodingMax; posState++)
-			{
-				_lowCoder[posState] = new BitTreeEncoder(Base.kNumLowLenBits);
-				_midCoder[posState] = new BitTreeEncoder(Base.kNumMidLenBits);
-			}
-		}
-
-		public void Init(int numPosStates)
-		{
-			SevenZip.Compression.RangeCoder.Encoder.InitBitModels(_choice);
-
-			for (int posState = 0; posState < numPosStates; posState++)
-			{
-				_lowCoder[posState].Init();
-				_midCoder[posState].Init();
-			}
-			_highCoder.Init();
-		}
-
-		public void Encode(SevenZip.Compression.RangeCoder.Encoder rangeEncoder, int symbol, int posState) throws IOException
-		{
-			if (symbol < Base.kNumLowLenSymbols)
-			{
-				rangeEncoder.Encode(_choice, 0, 0);
-				_lowCoder[posState].Encode(rangeEncoder, symbol);
-			}
-			else
-			{
-				symbol -= Base.kNumLowLenSymbols;
-				rangeEncoder.Encode(_choice, 0, 1);
-				if (symbol < Base.kNumMidLenSymbols)
-				{
-					rangeEncoder.Encode(_choice, 1, 0);
-					_midCoder[posState].Encode(rangeEncoder, symbol);
-				}
-				else
-				{
-					rangeEncoder.Encode(_choice, 1, 1);
-					_highCoder.Encode(rangeEncoder, symbol - Base.kNumMidLenSymbols);
-				}
-			}
-		}
-
-		public void SetPrices(int posState, int numSymbols, int[] prices, int st)
-		{
-			int a0 = SevenZip.Compression.RangeCoder.Encoder.GetPrice0(_choice[0]);
-			int a1 = SevenZip.Compression.RangeCoder.Encoder.GetPrice1(_choice[0]);
-			int b0 = a1 + SevenZip.Compression.RangeCoder.Encoder.GetPrice0(_choice[1]);
-			int b1 = a1 + SevenZip.Compression.RangeCoder.Encoder.GetPrice1(_choice[1]);
-			int i = 0;
-			for (i = 0; i < Base.kNumLowLenSymbols; i++)
-			{
-				if (i >= numSymbols)
-					return;
-				prices[st + i] = a0 + _lowCoder[posState].GetPrice(i);
-			}
-			for (; i < Base.kNumLowLenSymbols + Base.kNumMidLenSymbols; i++)
-			{
-				if (i >= numSymbols)
-					return;
-				prices[st + i] = b0 + _midCoder[posState].GetPrice(i - Base.kNumLowLenSymbols);
-			}
-			for (; i < numSymbols; i++)
-				prices[st + i] = b1 + _highCoder.GetPrice(i - Base.kNumLowLenSymbols - Base.kNumMidLenSymbols);
-		}
-	};
-
-	public static final int kNumLenSpecSymbols = Base.kNumLowLenSymbols + Base.kNumMidLenSymbols;
-
-	class LenPriceTableEncoder extends LenEncoder
-	{
-		int[] _prices = new int[Base.kNumLenSymbols<<Base.kNumPosStatesBitsEncodingMax];
-		int _tableSize;
-		int[] _counters = new int[Base.kNumPosStatesEncodingMax];
-
-		public void SetTableSize(int tableSize) { _tableSize = tableSize; }
-
-		public int GetPrice(int symbol, int posState)
-		{
-			return _prices[posState * Base.kNumLenSymbols + symbol];
-		}
-
-		void UpdateTable(int posState)
-		{
-			SetPrices(posState, _tableSize, _prices, posState * Base.kNumLenSymbols);
-			_counters[posState] = _tableSize;
-		}
-
-		public void UpdateTables(int numPosStates)
-		{
-			for (int posState = 0; posState < numPosStates; posState++)
-				UpdateTable(posState);
-		}
-
-		public void Encode(SevenZip.Compression.RangeCoder.Encoder rangeEncoder, int symbol, int posState) throws IOException
-		{
-			super.Encode(rangeEncoder, symbol, posState);
-			if (--_counters[posState] == 0)
-				UpdateTable(posState);
-		}
-	}
-
-	static final int kNumOpts = 1 << 12;
-	class Optimal
-	{
-		public int State;
-
-		public boolean Prev1IsChar;
-		public boolean Prev2;
-
-		public int PosPrev2;
-		public int BackPrev2;
-
-		public int Price;
-		public int PosPrev;
-		public int BackPrev;
-
-		public int Backs0;
-		public int Backs1;
-		public int Backs2;
-		public int Backs3;
-
-		public void MakeAsChar() { BackPrev = -1; Prev1IsChar = false; }
-		public void MakeAsShortRep() { BackPrev = 0; ; Prev1IsChar = false; }
-		public boolean IsShortRep() { return (BackPrev == 0); }
-	};
-	Optimal[] _optimum = new Optimal[kNumOpts];
-	SevenZip.Compression.LZ.BinTree _matchFinder = null;
-	SevenZip.Compression.RangeCoder.Encoder _rangeEncoder = new SevenZip.Compression.RangeCoder.Encoder();
-
-	short[] _isMatch = new short[Base.kNumStates<<Base.kNumPosStatesBitsMax];
-	short[] _isRep = new short[Base.kNumStates];
-	short[] _isRepG0 = new short[Base.kNumStates];
-	short[] _isRepG1 = new short[Base.kNumStates];
-	short[] _isRepG2 = new short[Base.kNumStates];
-	short[] _isRep0Long = new short[Base.kNumStates<<Base.kNumPosStatesBitsMax];
-
-	BitTreeEncoder[] _posSlotEncoder = new BitTreeEncoder[Base.kNumLenToPosStates]; // kNumPosSlotBits
-
-	short[] _posEncoders = new short[Base.kNumFullDistances-Base.kEndPosModelIndex];
-	BitTreeEncoder _posAlignEncoder = new BitTreeEncoder(Base.kNumAlignBits);
-
-	LenPriceTableEncoder _lenEncoder = new LenPriceTableEncoder();
-	LenPriceTableEncoder _repMatchLenEncoder = new LenPriceTableEncoder();
-
-	LiteralEncoder _literalEncoder = new LiteralEncoder();
-
-	int[] _matchDistances = new int[Base.kMatchMaxLen*2+2];
-
-	int _numFastBytes = kNumFastBytesDefault;
-	int _longestMatchLength;
-	int _numDistancePairs;
-
-	int _additionalOffset;
-
-	int _optimumEndIndex;
-	int _optimumCurrentIndex;
-
-	boolean _longestMatchWasFound;
-
-	int[] _posSlotPrices = new int[1<<(Base.kNumPosSlotBits+Base.kNumLenToPosStatesBits)];
-	int[] _distancesPrices = new int[Base.kNumFullDistances<<Base.kNumLenToPosStatesBits];
-	int[] _alignPrices = new int[Base.kAlignTableSize];
-	int _alignPriceCount;
-
-	int _distTableSize = (kDefaultDictionaryLogSize * 2);
-
-	int _posStateBits = 2;
-	int _posStateMask = (4 - 1);
-	int _numLiteralPosStateBits = 0;
-	int _numLiteralContextBits = 3;
-
-	int _dictionarySize = (1 << kDefaultDictionaryLogSize);
-	int _dictionarySizePrev = -1;
-	int _numFastBytesPrev = -1;
-
-	long nowPos64;
-	boolean _finished;
-	java.io.InputStream _inStream;
-
-	int _matchFinderType = EMatchFinderTypeBT4;
-	boolean _writeEndMark = false;
-
-	boolean _needReleaseMFStream = false;
-
-	void Create()
-	{
-		if (_matchFinder == null)
-		{
-			SevenZip.Compression.LZ.BinTree bt = new SevenZip.Compression.LZ.BinTree();
-			int numHashBytes = 4;
-			if (_matchFinderType == EMatchFinderTypeBT2)
-				numHashBytes = 2;
-			bt.SetType(numHashBytes);
-			_matchFinder = bt;
-		}
-		_literalEncoder.Create(_numLiteralPosStateBits, _numLiteralContextBits);
-
-		if (_dictionarySize == _dictionarySizePrev && _numFastBytesPrev == _numFastBytes)
-			return;
-		_matchFinder.Create(_dictionarySize, kNumOpts, _numFastBytes, Base.kMatchMaxLen + 1);
-		_dictionarySizePrev = _dictionarySize;
-		_numFastBytesPrev = _numFastBytes;
-	}
-
-	public Encoder()
-	{
-		for (int i = 0; i < kNumOpts; i++)
-			_optimum[i] = new Optimal();
-		for (int i = 0; i < Base.kNumLenToPosStates; i++)
-			_posSlotEncoder[i] = new BitTreeEncoder(Base.kNumPosSlotBits);
-	}
-
-	void SetWriteEndMarkerMode(boolean writeEndMarker)
-	{
-		_writeEndMark = writeEndMarker;
-	}
-
-	void Init()
-	{
-		BaseInit();
-		_rangeEncoder.Init();
-
-		SevenZip.Compression.RangeCoder.Encoder.InitBitModels(_isMatch);
-		SevenZip.Compression.RangeCoder.Encoder.InitBitModels(_isRep0Long);
-		SevenZip.Compression.RangeCoder.Encoder.InitBitModels(_isRep);
-		SevenZip.Compression.RangeCoder.Encoder.InitBitModels(_isRepG0);
-		SevenZip.Compression.RangeCoder.Encoder.InitBitModels(_isRepG1);
-		SevenZip.Compression.RangeCoder.Encoder.InitBitModels(_isRepG2);
-		SevenZip.Compression.RangeCoder.Encoder.InitBitModels(_posEncoders);
-
-
-
-
-
-
-
-		_literalEncoder.Init();
-		for (int i = 0; i < Base.kNumLenToPosStates; i++)
-			_posSlotEncoder[i].Init();
-
-
-
-		_lenEncoder.Init(1 << _posStateBits);
-		_repMatchLenEncoder.Init(1 << _posStateBits);
-
-		_posAlignEncoder.Init();
-
-		_longestMatchWasFound = false;
-		_optimumEndIndex = 0;
-		_optimumCurrentIndex = 0;
-		_additionalOffset = 0;
-	}
-
-	int ReadMatchDistances() throws java.io.IOException
-	{
-		int lenRes = 0;
-		_numDistancePairs = _matchFinder.GetMatches(_matchDistances);
-		if (_numDistancePairs > 0)
-		{
-			lenRes = _matchDistances[_numDistancePairs - 2];
-			if (lenRes == _numFastBytes)
-				lenRes += _matchFinder.GetMatchLen((int)lenRes - 1, _matchDistances[_numDistancePairs - 1],
-					Base.kMatchMaxLen - lenRes);
-		}
-		_additionalOffset++;
-		return lenRes;
-	}
-
-	void MovePos(int num) throws java.io.IOException
-	{
-		if (num > 0)
-		{
-			_matchFinder.Skip(num);
-			_additionalOffset += num;
-		}
-	}
-
-	int GetRepLen1Price(int state, int posState)
-	{
-		return SevenZip.Compression.RangeCoder.Encoder.GetPrice0(_isRepG0[state]) +
-				SevenZip.Compression.RangeCoder.Encoder.GetPrice0(_isRep0Long[(state << Base.kNumPosStatesBitsMax) + posState]);
-	}
-
-	int GetPureRepPrice(int repIndex, int state, int posState)
-	{
-		int price;
-		if (repIndex == 0)
-		{
-			price = SevenZip.Compression.RangeCoder.Encoder.GetPrice0(_isRepG0[state]);
-			price += SevenZip.Compression.RangeCoder.Encoder.GetPrice1(_isRep0Long[(state << Base.kNumPosStatesBitsMax) + posState]);
-		}
-		else
-		{
-			price = SevenZip.Compression.RangeCoder.Encoder.GetPrice1(_isRepG0[state]);
-			if (repIndex == 1)
-				price += SevenZip.Compression.RangeCoder.Encoder.GetPrice0(_isRepG1[state]);
-			else
-			{
-				price += SevenZip.Compression.RangeCoder.Encoder.GetPrice1(_isRepG1[state]);
-				price += SevenZip.Compression.RangeCoder.Encoder.GetPrice(_isRepG2[state], repIndex - 2);
-			}
-		}
-		return price;
-	}
-
-	int GetRepPrice(int repIndex, int len, int state, int posState)
-	{
-		int price = _repMatchLenEncoder.GetPrice(len - Base.kMatchMinLen, posState);
-		return price + GetPureRepPrice(repIndex, state, posState);
-	}
-
-	int GetPosLenPrice(int pos, int len, int posState)
-	{
-		int price;
-		int lenToPosState = Base.GetLenToPosState(len);
-		if (pos < Base.kNumFullDistances)
-			price = _distancesPrices[(lenToPosState * Base.kNumFullDistances) + pos];
-		else
-			price = _posSlotPrices[(lenToPosState << Base.kNumPosSlotBits) + GetPosSlot2(pos)] +
-				_alignPrices[pos & Base.kAlignMask];
-		return price + _lenEncoder.GetPrice(len - Base.kMatchMinLen, posState);
-	}
-
-	int Backward(int cur)
-	{
-		_optimumEndIndex = cur;
-		int posMem = _optimum[cur].PosPrev;
-		int backMem = _optimum[cur].BackPrev;
-		do
-		{
-			if (_optimum[cur].Prev1IsChar)
-			{
-				_optimum[posMem].MakeAsChar();
-				_optimum[posMem].PosPrev = posMem - 1;
-				if (_optimum[cur].Prev2)
-				{
-					_optimum[posMem - 1].Prev1IsChar = false;
-					_optimum[posMem - 1].PosPrev = _optimum[cur].PosPrev2;
-					_optimum[posMem - 1].BackPrev = _optimum[cur].BackPrev2;
-				}
-			}
-			int posPrev = posMem;
-			int backCur = backMem;
-
-			backMem = _optimum[posPrev].BackPrev;
-			posMem = _optimum[posPrev].PosPrev;
-
-			_optimum[posPrev].BackPrev = backCur;
-			_optimum[posPrev].PosPrev = cur;
-			cur = posPrev;
-		}
-		while (cur > 0);
-		backRes = _optimum[0].BackPrev;
-		_optimumCurrentIndex = _optimum[0].PosPrev;
-		return _optimumCurrentIndex;
-	}
-
-	int[] reps = new int[Base.kNumRepDistances];
-	int[] repLens = new int[Base.kNumRepDistances];
-	int backRes;
-
-	int GetOptimum(int position) throws IOException
-	{
-		if (_optimumEndIndex != _optimumCurrentIndex)
-		{
-			int lenRes = _optimum[_optimumCurrentIndex].PosPrev - _optimumCurrentIndex;
-			backRes = _optimum[_optimumCurrentIndex].BackPrev;
-			_optimumCurrentIndex = _optimum[_optimumCurrentIndex].PosPrev;
-			return lenRes;
-		}
-		_optimumCurrentIndex = _optimumEndIndex = 0;
-
-		int lenMain, numDistancePairs;
-		if (!_longestMatchWasFound)
-		{
-			lenMain = ReadMatchDistances();
-		}
-		else
-		{
-			lenMain = _longestMatchLength;
-			_longestMatchWasFound = false;
-		}
-		numDistancePairs = _numDistancePairs;
-
-		int numAvailableBytes = _matchFinder.GetNumAvailableBytes() + 1;
-		if (numAvailableBytes < 2)
-		{
-			backRes = -1;
-			return 1;
-		}
-		if (numAvailableBytes > Base.kMatchMaxLen)
-			numAvailableBytes = Base.kMatchMaxLen;
-
-		int repMaxIndex = 0;
-		int i;
-		for (i = 0; i < Base.kNumRepDistances; i++)
-		{
-			reps[i] = _repDistances[i];
-			repLens[i] = _matchFinder.GetMatchLen(0 - 1, reps[i], Base.kMatchMaxLen);
-			if (repLens[i] > repLens[repMaxIndex])
-				repMaxIndex = i;
-		}
-		if (repLens[repMaxIndex] >= _numFastBytes)
-		{
-			backRes = repMaxIndex;
-			int lenRes = repLens[repMaxIndex];
-			MovePos(lenRes - 1);
-			return lenRes;
-		}
-
-		if (lenMain >= _numFastBytes)
-		{
-			backRes = _matchDistances[numDistancePairs - 1] + Base.kNumRepDistances;
-			MovePos(lenMain - 1);
-			return lenMain;
-		}
-
-		byte currentByte = _matchFinder.GetIndexByte(0 - 1);
-		byte matchByte = _matchFinder.GetIndexByte(0 - _repDistances[0] - 1 - 1);
-
-		if (lenMain < 2 && currentByte != matchByte && repLens[repMaxIndex] < 2)
-		{
-			backRes = -1;
-			return 1;
-		}
-
-		_optimum[0].State = _state;
-
-		int posState = (position & _posStateMask);
-
-		_optimum[1].Price = SevenZip.Compression.RangeCoder.Encoder.GetPrice0(_isMatch[(_state << Base.kNumPosStatesBitsMax) + posState]) +
-				_literalEncoder.GetSubCoder(position, _previousByte).GetPrice(!Base.StateIsCharState(_state), matchByte, currentByte);
-		_optimum[1].MakeAsChar();
-
-		int matchPrice = SevenZip.Compression.RangeCoder.Encoder.GetPrice1(_isMatch[(_state << Base.kNumPosStatesBitsMax) + posState]);
-		int repMatchPrice = matchPrice + SevenZip.Compression.RangeCoder.Encoder.GetPrice1(_isRep[_state]);
-
-		if (matchByte == currentByte)
-		{
-			int shortRepPrice = repMatchPrice + GetRepLen1Price(_state, posState);
-			if (shortRepPrice < _optimum[1].Price)
-			{
-				_optimum[1].Price = shortRepPrice;
-				_optimum[1].MakeAsShortRep();
-			}
-		}
-
-		int lenEnd = ((lenMain >= repLens[repMaxIndex]) ? lenMain : repLens[repMaxIndex]);
-
-		if (lenEnd < 2)
-		{
-			backRes = _optimum[1].BackPrev;
-			return 1;
-		}
-
-		_optimum[1].PosPrev = 0;
-
-		_optimum[0].Backs0 = reps[0];
-		_optimum[0].Backs1 = reps[1];
-		_optimum[0].Backs2 = reps[2];
-		_optimum[0].Backs3 = reps[3];
-
-		int len = lenEnd;
-		do
-			_optimum[len--].Price = kIfinityPrice;
-		while (len >= 2);
-
-		for (i = 0; i < Base.kNumRepDistances; i++)
-		{
-			int repLen = repLens[i];
-			if (repLen < 2)
-				continue;
-			int price = repMatchPrice + GetPureRepPrice(i, _state, posState);
-			do
-			{
-				int curAndLenPrice = price + _repMatchLenEncoder.GetPrice(repLen - 2, posState);
-				Optimal optimum = _optimum[repLen];
-				if (curAndLenPrice < optimum.Price)
-				{
-					optimum.Price = curAndLenPrice;
-					optimum.PosPrev = 0;
-					optimum.BackPrev = i;
-					optimum.Prev1IsChar = false;
-				}
-			}
-			while (--repLen >= 2);
-		}
-
-		int normalMatchPrice = matchPrice + SevenZip.Compression.RangeCoder.Encoder.GetPrice0(_isRep[_state]);
-
-		len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2);
-		if (len <= lenMain)
-		{
-			int offs = 0;
-			while (len > _matchDistances[offs])
-				offs += 2;
-			for (; ; len++)
-			{
-				int distance = _matchDistances[offs + 1];
-				int curAndLenPrice = normalMatchPrice + GetPosLenPrice(distance, len, posState);
-				Optimal optimum = _optimum[len];
-				if (curAndLenPrice < optimum.Price)
-				{
-					optimum.Price = curAndLenPrice;
-					optimum.PosPrev = 0;
-					optimum.BackPrev = distance + Base.kNumRepDistances;
-					optimum.Prev1IsChar = false;
-				}
-				if (len == _matchDistances[offs])
-				{
-					offs += 2;
-					if (offs == numDistancePairs)
-						break;
-				}
-			}
-		}
-
-		int cur = 0;
-
-		while (true)
-		{
-			cur++;
-			if (cur == lenEnd)
-				return Backward(cur);
-			int newLen = ReadMatchDistances();
-			numDistancePairs = _numDistancePairs;
-			if (newLen >= _numFastBytes)
-			{
-
-				_longestMatchLength = newLen;
-				_longestMatchWasFound = true;
-				return Backward(cur);
-			}
-			position++;
-			int posPrev = _optimum[cur].PosPrev;
-			int state;
-			if (_optimum[cur].Prev1IsChar)
-			{
-				posPrev--;
-				if (_optimum[cur].Prev2)
-				{
-					state = _optimum[_optimum[cur].PosPrev2].State;
-					if (_optimum[cur].BackPrev2 < Base.kNumRepDistances)
-						state = Base.StateUpdateRep(state);
-					else
-						state = Base.StateUpdateMatch(state);
-				}
-				else
-					state = _optimum[posPrev].State;
-				state = Base.StateUpdateChar(state);
-			}
-			else
-				state = _optimum[posPrev].State;
-			if (posPrev == cur - 1)
-			{
-				if (_optimum[cur].IsShortRep())
-					state = Base.StateUpdateShortRep(state);
-				else
-					state = Base.StateUpdateChar(state);
-			}
-			else
-			{
-				int pos;
-				if (_optimum[cur].Prev1IsChar && _optimum[cur].Prev2)
-				{
-					posPrev = _optimum[cur].PosPrev2;
-					pos = _optimum[cur].BackPrev2;
-					state = Base.StateUpdateRep(state);
-				}
-				else
-				{
-					pos = _optimum[cur].BackPrev;
-					if (pos < Base.kNumRepDistances)
-						state = Base.StateUpdateRep(state);
-					else
-						state = Base.StateUpdateMatch(state);
-				}
-				Optimal opt = _optimum[posPrev];
-				if (pos < Base.kNumRepDistances)
-				{
-					if (pos == 0)
-					{
-						reps[0] = opt.Backs0;
-						reps[1] = opt.Backs1;
-						reps[2] = opt.Backs2;
-						reps[3] = opt.Backs3;
-					}
-					else if (pos == 1)
-					{
-						reps[0] = opt.Backs1;
-						reps[1] = opt.Backs0;
-						reps[2] = opt.Backs2;
-						reps[3] = opt.Backs3;
-					}
-					else if (pos == 2)
-					{
-						reps[0] = opt.Backs2;
-						reps[1] = opt.Backs0;
-						reps[2] = opt.Backs1;
-						reps[3] = opt.Backs3;
-					}
-					else
-					{
-						reps[0] = opt.Backs3;
-						reps[1] = opt.Backs0;
-						reps[2] = opt.Backs1;
-						reps[3] = opt.Backs2;
-					}
-				}
-				else
-				{
-					reps[0] = (pos - Base.kNumRepDistances);
-					reps[1] = opt.Backs0;
-					reps[2] = opt.Backs1;
-					reps[3] = opt.Backs2;
-				}
-			}
-			_optimum[cur].State = state;
-			_optimum[cur].Backs0 = reps[0];
-			_optimum[cur].Backs1 = reps[1];
-			_optimum[cur].Backs2 = reps[2];
-			_optimum[cur].Backs3 = reps[3];
-			int curPrice = _optimum[cur].Price;
-
-			currentByte = _matchFinder.GetIndexByte(0 - 1);
-			matchByte = _matchFinder.GetIndexByte(0 - reps[0] - 1 - 1);
-
-			posState = (position & _posStateMask);
-
-			int curAnd1Price = curPrice +
-				SevenZip.Compression.RangeCoder.Encoder.GetPrice0(_isMatch[(state << Base.kNumPosStatesBitsMax) + posState]) +
-				_literalEncoder.GetSubCoder(position, _matchFinder.GetIndexByte(0 - 2)).
-				GetPrice(!Base.StateIsCharState(state), matchByte, currentByte);
-
-			Optimal nextOptimum = _optimum[cur + 1];
-
-			boolean nextIsChar = false;
-			if (curAnd1Price < nextOptimum.Price)
-			{
-				nextOptimum.Price = curAnd1Price;
-				nextOptimum.PosPrev = cur;
-				nextOptimum.MakeAsChar();
-				nextIsChar = true;
-			}
-
-			matchPrice = curPrice + SevenZip.Compression.RangeCoder.Encoder.GetPrice1(_isMatch[(state << Base.kNumPosStatesBitsMax) + posState]);
-			repMatchPrice = matchPrice + SevenZip.Compression.RangeCoder.Encoder.GetPrice1(_isRep[state]);
-
-			if (matchByte == currentByte &&
-				!(nextOptimum.PosPrev < cur && nextOptimum.BackPrev == 0))
-			{
-				int shortRepPrice = repMatchPrice + GetRepLen1Price(state, posState);
-				if (shortRepPrice <= nextOptimum.Price)
-				{
-					nextOptimum.Price = shortRepPrice;
-					nextOptimum.PosPrev = cur;
-					nextOptimum.MakeAsShortRep();
-					nextIsChar = true;
-				}
-			}
-
-			int numAvailableBytesFull = _matchFinder.GetNumAvailableBytes() + 1;
-			numAvailableBytesFull = Math.min(kNumOpts - 1 - cur, numAvailableBytesFull);
-			numAvailableBytes = numAvailableBytesFull;
-
-			if (numAvailableBytes < 2)
-				continue;
-			if (numAvailableBytes > _numFastBytes)
-				numAvailableBytes = _numFastBytes;
-			if (!nextIsChar && matchByte != currentByte)
-			{
-				// try Literal + rep0
-				int t = Math.min(numAvailableBytesFull - 1, _numFastBytes);
-				int lenTest2 = _matchFinder.GetMatchLen(0, reps[0], t);
-				if (lenTest2 >= 2)
-				{
-					int state2 = Base.StateUpdateChar(state);
-
-					int posStateNext = (position + 1) & _posStateMask;
-					int nextRepMatchPrice = curAnd1Price +
-						SevenZip.Compression.RangeCoder.Encoder.GetPrice1(_isMatch[(state2 << Base.kNumPosStatesBitsMax) + posStateNext]) +
-						SevenZip.Compression.RangeCoder.Encoder.GetPrice1(_isRep[state2]);
-					{
-						int offset = cur + 1 + lenTest2;
-						while (lenEnd < offset)
-							_optimum[++lenEnd].Price = kIfinityPrice;
-						int curAndLenPrice = nextRepMatchPrice + GetRepPrice(
-								0, lenTest2, state2, posStateNext);
-						Optimal optimum = _optimum[offset];
-						if (curAndLenPrice < optimum.Price)
-						{
-							optimum.Price = curAndLenPrice;
-							optimum.PosPrev = cur + 1;
-							optimum.BackPrev = 0;
-							optimum.Prev1IsChar = true;
-							optimum.Prev2 = false;
-						}
-					}
-				}
-			}
-
-			int startLen = 2; // speed optimization 
-
-			for (int repIndex = 0; repIndex < Base.kNumRepDistances; repIndex++)
-			{
-				int lenTest = _matchFinder.GetMatchLen(0 - 1, reps[repIndex], numAvailableBytes);
-				if (lenTest < 2)
-					continue;
-				int lenTestTemp = lenTest;
-				do
-				{
-					while (lenEnd < cur + lenTest)
-						_optimum[++lenEnd].Price = kIfinityPrice;
-					int curAndLenPrice = repMatchPrice + GetRepPrice(repIndex, lenTest, state, posState);
-					Optimal optimum = _optimum[cur + lenTest];
-					if (curAndLenPrice < optimum.Price)
-					{
-						optimum.Price = curAndLenPrice;
-						optimum.PosPrev = cur;
-						optimum.BackPrev = repIndex;
-						optimum.Prev1IsChar = false;
-					}
-				}
-				while (--lenTest >= 2);
-				lenTest = lenTestTemp;
-
-				if (repIndex == 0)
-					startLen = lenTest + 1;
-
-				// if (_maxMode)
-				if (lenTest < numAvailableBytesFull)
-				{
-					int t = Math.min(numAvailableBytesFull - 1 - lenTest, _numFastBytes);
-					int lenTest2 = _matchFinder.GetMatchLen(lenTest, reps[repIndex], t);
-					if (lenTest2 >= 2)
-					{
-						int state2 = Base.StateUpdateRep(state);
-
-						int posStateNext = (position + lenTest) & _posStateMask;
-						int curAndLenCharPrice =
-								repMatchPrice + GetRepPrice(repIndex, lenTest, state, posState) +
-								SevenZip.Compression.RangeCoder.Encoder.GetPrice0(_isMatch[(state2 << Base.kNumPosStatesBitsMax) + posStateNext]) +
-								_literalEncoder.GetSubCoder(position + lenTest,
-								_matchFinder.GetIndexByte(lenTest - 1 - 1)).GetPrice(true,
-								_matchFinder.GetIndexByte(lenTest - 1 - (reps[repIndex] + 1)),
-								_matchFinder.GetIndexByte(lenTest - 1));
-						state2 = Base.StateUpdateChar(state2);
-						posStateNext = (position + lenTest + 1) & _posStateMask;
-						int nextMatchPrice = curAndLenCharPrice + SevenZip.Compression.RangeCoder.Encoder.GetPrice1(_isMatch[(state2 << Base.kNumPosStatesBitsMax) + posStateNext]);
-						int nextRepMatchPrice = nextMatchPrice + SevenZip.Compression.RangeCoder.Encoder.GetPrice1(_isRep[state2]);
-
-						// for(; lenTest2 >= 2; lenTest2--)
-						{
-							int offset = lenTest + 1 + lenTest2;
-							while (lenEnd < cur + offset)
-								_optimum[++lenEnd].Price = kIfinityPrice;
-							int curAndLenPrice = nextRepMatchPrice + GetRepPrice(0, lenTest2, state2, posStateNext);
-							Optimal optimum = _optimum[cur + offset];
-							if (curAndLenPrice < optimum.Price)
-							{
-								optimum.Price = curAndLenPrice;
-								optimum.PosPrev = cur + lenTest + 1;
-								optimum.BackPrev = 0;
-								optimum.Prev1IsChar = true;
-								optimum.Prev2 = true;
-								optimum.PosPrev2 = cur;
-								optimum.BackPrev2 = repIndex;
-							}
-						}
-					}
-				}
-			}
-
-			if (newLen > numAvailableBytes)
-			{
-				newLen = numAvailableBytes;
-				for (numDistancePairs = 0; newLen > _matchDistances[numDistancePairs]; numDistancePairs += 2) ;
-				_matchDistances[numDistancePairs] = newLen;
-				numDistancePairs += 2;
-			}
-			if (newLen >= startLen)
-			{
-				normalMatchPrice = matchPrice + SevenZip.Compression.RangeCoder.Encoder.GetPrice0(_isRep[state]);
-				while (lenEnd < cur + newLen)
-					_optimum[++lenEnd].Price = kIfinityPrice;
-
-				int offs = 0;
-				while (startLen > _matchDistances[offs])
-					offs += 2;
-
-				for (int lenTest = startLen; ; lenTest++)
-				{
-					int curBack = _matchDistances[offs + 1];
-					int curAndLenPrice = normalMatchPrice + GetPosLenPrice(curBack, lenTest, posState);
-					Optimal optimum = _optimum[cur + lenTest];
-					if (curAndLenPrice < optimum.Price)
-					{
-						optimum.Price = curAndLenPrice;
-						optimum.PosPrev = cur;
-						optimum.BackPrev = curBack + Base.kNumRepDistances;
-						optimum.Prev1IsChar = false;
-					}
-
-					if (lenTest == _matchDistances[offs])
-					{
-						if (lenTest < numAvailableBytesFull)
-						{
-							int t = Math.min(numAvailableBytesFull - 1 - lenTest, _numFastBytes);
-							int lenTest2 = _matchFinder.GetMatchLen(lenTest, curBack, t);
-							if (lenTest2 >= 2)
-							{
-								int state2 = Base.StateUpdateMatch(state);
-
-								int posStateNext = (position + lenTest) & _posStateMask;
-								int curAndLenCharPrice = curAndLenPrice +
-									SevenZip.Compression.RangeCoder.Encoder.GetPrice0(_isMatch[(state2 << Base.kNumPosStatesBitsMax) + posStateNext]) +
-									_literalEncoder.GetSubCoder(position + lenTest,
-									_matchFinder.GetIndexByte(lenTest - 1 - 1)).
-									GetPrice(true,
-									_matchFinder.GetIndexByte(lenTest - (curBack + 1) - 1),
-									_matchFinder.GetIndexByte(lenTest - 1));
-								state2 = Base.StateUpdateChar(state2);
-								posStateNext = (position + lenTest + 1) & _posStateMask;
-								int nextMatchPrice = curAndLenCharPrice + SevenZip.Compression.RangeCoder.Encoder.GetPrice1(_isMatch[(state2 << Base.kNumPosStatesBitsMax) + posStateNext]);
-								int nextRepMatchPrice = nextMatchPrice + SevenZip.Compression.RangeCoder.Encoder.GetPrice1(_isRep[state2]);
-
-								int offset = lenTest + 1 + lenTest2;
-								while (lenEnd < cur + offset)
-									_optimum[++lenEnd].Price = kIfinityPrice;
-								curAndLenPrice = nextRepMatchPrice + GetRepPrice(0, lenTest2, state2, posStateNext);
-								optimum = _optimum[cur + offset];
-								if (curAndLenPrice < optimum.Price)
-								{
-									optimum.Price = curAndLenPrice;
-									optimum.PosPrev = cur + lenTest + 1;
-									optimum.BackPrev = 0;
-									optimum.Prev1IsChar = true;
-									optimum.Prev2 = true;
-									optimum.PosPrev2 = cur;
-									optimum.BackPrev2 = curBack + Base.kNumRepDistances;
-								}
-							}
-						}
-						offs += 2;
-						if (offs == numDistancePairs)
-							break;
-					}
-				}
-			}
-		}
-	}
-
-	boolean ChangePair(int smallDist, int bigDist)
-	{
-		int kDif = 7;
-		return (smallDist < (1 << (32 - kDif)) && bigDist >= (smallDist << kDif));
-	}
-
-	void WriteEndMarker(int posState) throws IOException
-	{
-		if (!_writeEndMark)
-			return;
-
-		_rangeEncoder.Encode(_isMatch, (_state << Base.kNumPosStatesBitsMax) + posState, 1);
-		_rangeEncoder.Encode(_isRep, _state, 0);
-		_state = Base.StateUpdateMatch(_state);
-		int len = Base.kMatchMinLen;
-		_lenEncoder.Encode(_rangeEncoder, len - Base.kMatchMinLen, posState);
-		int posSlot = (1 << Base.kNumPosSlotBits) - 1;
-		int lenToPosState = Base.GetLenToPosState(len);
-		_posSlotEncoder[lenToPosState].Encode(_rangeEncoder, posSlot);
-		int footerBits = 30;
-		int posReduced = (1 << footerBits) - 1;
-		_rangeEncoder.EncodeDirectBits(posReduced >> Base.kNumAlignBits, footerBits - Base.kNumAlignBits);
-		_posAlignEncoder.ReverseEncode(_rangeEncoder, posReduced & Base.kAlignMask);
-	}
-
-	void Flush(int nowPos) throws IOException
-	{
-		ReleaseMFStream();
-		WriteEndMarker(nowPos & _posStateMask);
-		_rangeEncoder.FlushData();
-		_rangeEncoder.FlushStream();
-	}
-
-	public void CodeOneBlock(long[] inSize, long[] outSize, boolean[] finished) throws IOException
-	{
-		inSize[0] = 0;
-		outSize[0] = 0;
-		finished[0] = true;
-
-		if (_inStream != null)
-		{
-			_matchFinder.SetStream(_inStream);
-			_matchFinder.Init();
-			_needReleaseMFStream = true;
-			_inStream = null;
-		}
-
-		if (_finished)
-			return;
-		_finished = true;
-
-
-		long progressPosValuePrev = nowPos64;
-		if (nowPos64 == 0)
-		{
-			if (_matchFinder.GetNumAvailableBytes() == 0)
-			{
-				Flush((int)nowPos64);
-				return;
-			}
-
-			ReadMatchDistances();
-			int posState = (int)(nowPos64) & _posStateMask;
-			_rangeEncoder.Encode(_isMatch, (_state << Base.kNumPosStatesBitsMax) + posState, 0);
-			_state = Base.StateUpdateChar(_state);
-			byte curByte = _matchFinder.GetIndexByte(0 - _additionalOffset);
-			_literalEncoder.GetSubCoder((int)(nowPos64), _previousByte).Encode(_rangeEncoder, curByte);
-			_previousByte = curByte;
-			_additionalOffset--;
-			nowPos64++;
-		}
-		if (_matchFinder.GetNumAvailableBytes() == 0)
-		{
-			Flush((int)nowPos64);
-			return;
-		}
-		while (true)
-		{
-
-			int len = GetOptimum((int)nowPos64);
-			int pos = backRes;
-			int posState = ((int)nowPos64) & _posStateMask;
-			int complexState = (_state << Base.kNumPosStatesBitsMax) + posState;
-			if (len == 1 && pos == -1)
-			{
-				_rangeEncoder.Encode(_isMatch, complexState, 0);
-				byte curByte = _matchFinder.GetIndexByte((int)(0 - _additionalOffset));
-				LiteralEncoder.Encoder2 subCoder = _literalEncoder.GetSubCoder((int)nowPos64, _previousByte);
-				if (!Base.StateIsCharState(_state))
-				{
-					byte matchByte = _matchFinder.GetIndexByte((int)(0 - _repDistances[0] - 1 - _additionalOffset));
-					subCoder.EncodeMatched(_rangeEncoder, matchByte, curByte);
-				}
-				else
-					subCoder.Encode(_rangeEncoder, curByte);
-				_previousByte = curByte;
-				_state = Base.StateUpdateChar(_state);
-			}
-			else
-			{
-				_rangeEncoder.Encode(_isMatch, complexState, 1);
-				if (pos < Base.kNumRepDistances)
-				{
-					_rangeEncoder.Encode(_isRep, _state, 1);
-					if (pos == 0)
-					{
-						_rangeEncoder.Encode(_isRepG0, _state, 0);
-						if (len == 1)
-							_rangeEncoder.Encode(_isRep0Long, complexState, 0);
-						else
-							_rangeEncoder.Encode(_isRep0Long, complexState, 1);
-					}
-					else
-					{
-						_rangeEncoder.Encode(_isRepG0, _state, 1);
-						if (pos == 1)
-							_rangeEncoder.Encode(_isRepG1, _state, 0);
-						else
-						{
-							_rangeEncoder.Encode(_isRepG1, _state, 1);
-							_rangeEncoder.Encode(_isRepG2, _state, pos - 2);
-						}
-					}
-					if (len == 1)
-						_state = Base.StateUpdateShortRep(_state);
-					else
-					{
-						_repMatchLenEncoder.Encode(_rangeEncoder, len - Base.kMatchMinLen, posState);
-						_state = Base.StateUpdateRep(_state);
-					}
-					int distance = _repDistances[pos];
-					if (pos != 0)
-					{
-						for (int i = pos; i >= 1; i--)
-							_repDistances[i] = _repDistances[i - 1];
-						_repDistances[0] = distance;
-					}
-				}
-				else
-				{
-					_rangeEncoder.Encode(_isRep, _state, 0);
-					_state = Base.StateUpdateMatch(_state);
-					_lenEncoder.Encode(_rangeEncoder, len - Base.kMatchMinLen, posState);
-					pos -= Base.kNumRepDistances;
-					int posSlot = GetPosSlot(pos);
-					int lenToPosState = Base.GetLenToPosState(len);
-					_posSlotEncoder[lenToPosState].Encode(_rangeEncoder, posSlot);
-
-					if (posSlot >= Base.kStartPosModelIndex)
-					{
-						int footerBits = (int)((posSlot >> 1) - 1);
-						int baseVal = ((2 | (posSlot & 1)) << footerBits);
-						int posReduced = pos - baseVal;
-
-						if (posSlot < Base.kEndPosModelIndex)
-							BitTreeEncoder.ReverseEncode(_posEncoders,
-									baseVal - posSlot - 1, _rangeEncoder, footerBits, posReduced);
-						else
-						{
-							_rangeEncoder.EncodeDirectBits(posReduced >> Base.kNumAlignBits, footerBits - Base.kNumAlignBits);
-							_posAlignEncoder.ReverseEncode(_rangeEncoder, posReduced & Base.kAlignMask);
-							_alignPriceCount++;
-						}
-					}
-					int distance = pos;
-					for (int i = Base.kNumRepDistances - 1; i >= 1; i--)
-						_repDistances[i] = _repDistances[i - 1];
-					_repDistances[0] = distance;
-					_matchPriceCount++;
-				}
-				_previousByte = _matchFinder.GetIndexByte(len - 1 - _additionalOffset);
-			}
-			_additionalOffset -= len;
-			nowPos64 += len;
-			if (_additionalOffset == 0)
-			{
-				// if (!_fastMode)
-				if (_matchPriceCount >= (1 << 7))
-					FillDistancesPrices();
-				if (_alignPriceCount >= Base.kAlignTableSize)
-					FillAlignPrices();
-				inSize[0] = nowPos64;
-				outSize[0] = _rangeEncoder.GetProcessedSizeAdd();
-				if (_matchFinder.GetNumAvailableBytes() == 0)
-				{
-					Flush((int)nowPos64);
-					return;
-				}
-
-				if (nowPos64 - progressPosValuePrev >= (1 << 12))
-				{
-					_finished = false;
-					finished[0] = false;
-					return;
-				}
-			}
-		}
-	}
-
-	void ReleaseMFStream()
-	{
-		if (_matchFinder != null && _needReleaseMFStream)
-		{
-			_matchFinder.ReleaseStream();
-			_needReleaseMFStream = false;
-		}
-	}
-
-	void SetOutStream(java.io.OutputStream outStream)
-	{ _rangeEncoder.SetStream(outStream); }
-	void ReleaseOutStream()
-	{ _rangeEncoder.ReleaseStream(); }
-
-	void ReleaseStreams()
-	{
-		ReleaseMFStream();
-		ReleaseOutStream();
-	}
-
-	void SetStreams(java.io.InputStream inStream, java.io.OutputStream outStream,
-			long inSize, long outSize)
-	{
-		_inStream = inStream;
-		_finished = false;
-		Create();
-		SetOutStream(outStream);
-		Init();
-
-		// if (!_fastMode)
-		{
-			FillDistancesPrices();
-			FillAlignPrices();
-		}
-
-		_lenEncoder.SetTableSize(_numFastBytes + 1 - Base.kMatchMinLen);
-		_lenEncoder.UpdateTables(1 << _posStateBits);
-		_repMatchLenEncoder.SetTableSize(_numFastBytes + 1 - Base.kMatchMinLen);
-		_repMatchLenEncoder.UpdateTables(1 << _posStateBits);
-
-		nowPos64 = 0;
-	}
-
-	long[] processedInSize = new long[1]; long[] processedOutSize = new long[1]; boolean[] finished = new boolean[1];
-	public void Code(java.io.InputStream inStream, java.io.OutputStream outStream,
-			long inSize, long outSize, ICodeProgress progress) throws IOException
-	{
-		_needReleaseMFStream = false;
-		try
-		{
-			SetStreams(inStream, outStream, inSize, outSize);
-			while (true)
-			{
-
-
-
-				CodeOneBlock(processedInSize, processedOutSize, finished);
-				if (finished[0])
-					return;
-				if (progress != null)
-				{
-					progress.SetProgress(processedInSize[0], processedOutSize[0]);
-				}
-			}
-		}
-		finally
-		{
-			ReleaseStreams();
-		}
-	}
-
-	public static final int kPropSize = 5;
-	byte[] properties = new byte[kPropSize];
-
-	public void WriteCoderProperties(java.io.OutputStream outStream) throws IOException
-	{
-		properties[0] = (byte)((_posStateBits * 5 + _numLiteralPosStateBits) * 9 + _numLiteralContextBits);
-		for (int i = 0; i < 4; i++)
-			properties[1 + i] = (byte)(_dictionarySize >> (8 * i));
-		outStream.write(properties, 0, kPropSize);
-	}
-
-	int[] tempPrices = new int[Base.kNumFullDistances];
-	int _matchPriceCount;
-
-	void FillDistancesPrices()
-	{
-		for (int i = Base.kStartPosModelIndex; i < Base.kNumFullDistances; i++)
-		{
-			int posSlot = GetPosSlot(i);
-			int footerBits = (int)((posSlot >> 1) - 1);
-			int baseVal = ((2 | (posSlot & 1)) << footerBits);
-			tempPrices[i] = BitTreeEncoder.ReverseGetPrice(_posEncoders,
-				baseVal - posSlot - 1, footerBits, i - baseVal);
-		}
-
-		for (int lenToPosState = 0; lenToPosState < Base.kNumLenToPosStates; lenToPosState++)
-		{
-			int posSlot;
-			BitTreeEncoder encoder = _posSlotEncoder[lenToPosState];
-
-			int st = (lenToPosState << Base.kNumPosSlotBits);
-			for (posSlot = 0; posSlot < _distTableSize; posSlot++)
-				_posSlotPrices[st + posSlot] = encoder.GetPrice(posSlot);
-			for (posSlot = Base.kEndPosModelIndex; posSlot < _distTableSize; posSlot++)
-				_posSlotPrices[st + posSlot] += ((((posSlot >> 1) - 1) - Base.kNumAlignBits) << SevenZip.Compression.RangeCoder.Encoder.kNumBitPriceShiftBits);
-
-			int st2 = lenToPosState * Base.kNumFullDistances;
-			int i;
-			for (i = 0; i < Base.kStartPosModelIndex; i++)
-				_distancesPrices[st2 + i] = _posSlotPrices[st + i];
-			for (; i < Base.kNumFullDistances; i++)
-				_distancesPrices[st2 + i] = _posSlotPrices[st + GetPosSlot(i)] + tempPrices[i];
-		}
-		_matchPriceCount = 0;
-	}
-
-	void FillAlignPrices()
-	{
-		for (int i = 0; i < Base.kAlignTableSize; i++)
-			_alignPrices[i] = _posAlignEncoder.ReverseGetPrice(i);
-		_alignPriceCount = 0;
-	}
-
-
-	public boolean SetAlgorithm(int algorithm)
-	{
-		/*
-		_fastMode = (algorithm == 0);
-		_maxMode = (algorithm >= 2);
-		*/
-		return true;
-	}
-
-	public boolean SetDictionarySize(int dictionarySize)
-	{
-		int kDicLogSizeMaxCompress = 29;
-		if (dictionarySize < (1 << Base.kDicLogSizeMin) || dictionarySize > (1 << kDicLogSizeMaxCompress))
-			return false;
-		_dictionarySize = dictionarySize;
-		int dicLogSize;
-		for (dicLogSize = 0; dictionarySize > (1 << dicLogSize); dicLogSize++) ;
-		_distTableSize = dicLogSize * 2;
-		return true;
-	}
-
-	public boolean SetNumFastBytes(int numFastBytes)
-	{
-		if (numFastBytes < 5 || numFastBytes > Base.kMatchMaxLen)
-			return false;
-		_numFastBytes = numFastBytes;
-		return true;
-	}
-
-	public boolean SetMatchFinder(int matchFinderIndex)
-	{
-		if (matchFinderIndex < 0 || matchFinderIndex > 2)
-			return false;
-		int matchFinderIndexPrev = _matchFinderType;
-		_matchFinderType = matchFinderIndex;
-		if (_matchFinder != null && matchFinderIndexPrev != _matchFinderType)
-		{
-			_dictionarySizePrev = -1;
-			_matchFinder = null;
-		}
-		return true;
-	}
-
-	public boolean SetLcLpPb(int lc, int lp, int pb)
-	{
-		if (
-				lp < 0 || lp > Base.kNumLitPosStatesBitsEncodingMax ||
-				lc < 0 || lc > Base.kNumLitContextBitsMax ||
-				pb < 0 || pb > Base.kNumPosStatesBitsEncodingMax)
-			return false;
-		_numLiteralPosStateBits = lp;
-		_numLiteralContextBits = lc;
-		_posStateBits = pb;
-		_posStateMask = ((1) << _posStateBits) - 1;
-		return true;
-	}
-
-	public void SetEndMarkerMode(boolean endMarkerMode)
-	{
-		_writeEndMark = endMarkerMode;
-	}
-}
-
diff --git a/third_party/lzma/v4_65/files/Java/SevenZip/Compression/RangeCoder/BitTreeDecoder.java b/third_party/lzma/v4_65/files/Java/SevenZip/Compression/RangeCoder/BitTreeDecoder.java
deleted file mode 100644
index 7698581..0000000
--- a/third_party/lzma/v4_65/files/Java/SevenZip/Compression/RangeCoder/BitTreeDecoder.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package SevenZip.Compression.RangeCoder;
-
-public class BitTreeDecoder
-{
-	short[] Models;
-	int NumBitLevels;
-	
-	public BitTreeDecoder(int numBitLevels)
-	{
-		NumBitLevels = numBitLevels;
-		Models = new short[1 << numBitLevels];
-	}
-	
-	public void Init()
-	{
-		Decoder.InitBitModels(Models);
-	}
-	
-	public int Decode(Decoder rangeDecoder) throws java.io.IOException
-	{
-		int m = 1;
-		for (int bitIndex = NumBitLevels; bitIndex != 0; bitIndex--)
-			m = (m << 1) + rangeDecoder.DecodeBit(Models, m);
-		return m - (1 << NumBitLevels);
-	}
-	
-	public int ReverseDecode(Decoder rangeDecoder) throws java.io.IOException
-	{
-		int m = 1;
-		int symbol = 0;
-		for (int bitIndex = 0; bitIndex < NumBitLevels; bitIndex++)
-		{
-			int bit = rangeDecoder.DecodeBit(Models, m);
-			m <<= 1;
-			m += bit;
-			symbol |= (bit << bitIndex);
-		}
-		return symbol;
-	}
-	
-	public static int ReverseDecode(short[] Models, int startIndex,
-			Decoder rangeDecoder, int NumBitLevels) throws java.io.IOException
-	{
-		int m = 1;
-		int symbol = 0;
-		for (int bitIndex = 0; bitIndex < NumBitLevels; bitIndex++)
-		{
-			int bit = rangeDecoder.DecodeBit(Models, startIndex + m);
-			m <<= 1;
-			m += bit;
-			symbol |= (bit << bitIndex);
-		}
-		return symbol;
-	}
-}
diff --git a/third_party/lzma/v4_65/files/Java/SevenZip/Compression/RangeCoder/BitTreeEncoder.java b/third_party/lzma/v4_65/files/Java/SevenZip/Compression/RangeCoder/BitTreeEncoder.java
deleted file mode 100644
index f9e97db..0000000
--- a/third_party/lzma/v4_65/files/Java/SevenZip/Compression/RangeCoder/BitTreeEncoder.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package SevenZip.Compression.RangeCoder;
-import java.io.IOException;
-
-public class BitTreeEncoder
-{
-	short[] Models;
-	int NumBitLevels;
-	
-	public BitTreeEncoder(int numBitLevels)
-	{
-		NumBitLevels = numBitLevels;
-		Models = new short[1 << numBitLevels];
-	}
-	
-	public void Init()
-	{
-		Decoder.InitBitModels(Models);
-	}
-	
-	public void Encode(Encoder rangeEncoder, int symbol) throws IOException
-	{
-		int m = 1;
-		for (int bitIndex = NumBitLevels; bitIndex != 0; )
-		{
-			bitIndex--;
-			int bit = (symbol >>> bitIndex) & 1;
-			rangeEncoder.Encode(Models, m, bit);
-			m = (m << 1) | bit;
-		}
-	}
-	
-	public void ReverseEncode(Encoder rangeEncoder, int symbol) throws IOException
-	{
-		int m = 1;
-		for (int  i = 0; i < NumBitLevels; i++)
-		{
-			int bit = symbol & 1;
-			rangeEncoder.Encode(Models, m, bit);
-			m = (m << 1) | bit;
-			symbol >>= 1;
-		}
-	}
-	
-	public int GetPrice(int symbol)
-	{
-		int price = 0;
-		int m = 1;
-		for (int bitIndex = NumBitLevels; bitIndex != 0; )
-		{
-			bitIndex--;
-			int bit = (symbol >>> bitIndex) & 1;
-			price += Encoder.GetPrice(Models[m], bit);
-			m = (m << 1) + bit;
-		}
-		return price;
-	}
-	
-	public int ReverseGetPrice(int symbol)
-	{
-		int price = 0;
-		int m = 1;
-		for (int i = NumBitLevels; i != 0; i--)
-		{
-			int bit = symbol & 1;
-			symbol >>>= 1;
-			price += Encoder.GetPrice(Models[m], bit);
-			m = (m << 1) | bit;
-		}
-		return price;
-	}
-	
-	public static int ReverseGetPrice(short[] Models, int startIndex,
-			int NumBitLevels, int symbol)
-	{
-		int price = 0;
-		int m = 1;
-		for (int i = NumBitLevels; i != 0; i--)
-		{
-			int bit = symbol & 1;
-			symbol >>>= 1;
-			price += Encoder.GetPrice(Models[startIndex + m], bit);
-			m = (m << 1) | bit;
-		}
-		return price;
-	}
-	
-	public static void ReverseEncode(short[] Models, int startIndex,
-			Encoder rangeEncoder, int NumBitLevels, int symbol) throws IOException
-	{
-		int m = 1;
-		for (int i = 0; i < NumBitLevels; i++)
-		{
-			int bit = symbol & 1;
-			rangeEncoder.Encode(Models, startIndex + m, bit);
-			m = (m << 1) | bit;
-			symbol >>= 1;
-		}
-	}
-}
diff --git a/third_party/lzma/v4_65/files/Java/SevenZip/Compression/RangeCoder/Decoder.java b/third_party/lzma/v4_65/files/Java/SevenZip/Compression/RangeCoder/Decoder.java
deleted file mode 100644
index 85b3150..0000000
--- a/third_party/lzma/v4_65/files/Java/SevenZip/Compression/RangeCoder/Decoder.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package SevenZip.Compression.RangeCoder;
-import java.io.IOException;
-
-public class Decoder
-{
-	static final int kTopMask = ~((1 << 24) - 1);
-	
-	static final int kNumBitModelTotalBits = 11;
-	static final int kBitModelTotal = (1 << kNumBitModelTotalBits);
-	static final int kNumMoveBits = 5;
-	
-	int Range;
-	int Code;
-
-	java.io.InputStream Stream;
-	
-	public final void SetStream(java.io.InputStream stream)
-	{ 
-		Stream = stream; 
-	}
-	
-	public final void ReleaseStream()
-	{ 
-		Stream = null; 
-	}
-	
-	public final void Init() throws IOException
-	{
-		Code = 0;
-		Range = -1;
-		for (int i = 0; i < 5; i++)
-			Code = (Code << 8) | Stream.read();
-	}
-	
-	public final int DecodeDirectBits(int numTotalBits) throws IOException
-	{
-		int result = 0;
-		for (int i = numTotalBits; i != 0; i--)
-		{
-			Range >>>= 1;
-			int t = ((Code - Range) >>> 31);
-			Code -= Range & (t - 1);
-			result = (result << 1) | (1 - t);
-			
-			if ((Range & kTopMask) == 0)
-			{
-				Code = (Code << 8) | Stream.read();
-				Range <<= 8;
-			}
-		}
-		return result;
-	}
-	
-	public int DecodeBit(short []probs, int index) throws IOException
-	{
-		int prob = probs[index];
-		int newBound = (Range >>> kNumBitModelTotalBits) * prob;
-		if ((Code ^ 0x80000000) < (newBound ^ 0x80000000))
-		{
-			Range = newBound;
-			probs[index] = (short)(prob + ((kBitModelTotal - prob) >>> kNumMoveBits));
-			if ((Range & kTopMask) == 0)
-			{
-				Code = (Code << 8) | Stream.read();
-				Range <<= 8;
-			}
-			return 0;
-		}
-		else
-		{
-			Range -= newBound;
-			Code -= newBound;
-			probs[index] = (short)(prob - ((prob) >>> kNumMoveBits));
-			if ((Range & kTopMask) == 0)
-			{
-				Code = (Code << 8) | Stream.read();
-				Range <<= 8;
-			}
-			return 1;
-		}
-	}
-	
-	public static void InitBitModels(short []probs)
-	{
-		for (int i = 0; i < probs.length; i++)
-			probs[i] = (kBitModelTotal >>> 1);
-	}
-}
diff --git a/third_party/lzma/v4_65/files/Java/SevenZip/Compression/RangeCoder/Encoder.java b/third_party/lzma/v4_65/files/Java/SevenZip/Compression/RangeCoder/Encoder.java
deleted file mode 100644
index d21b983..0000000
--- a/third_party/lzma/v4_65/files/Java/SevenZip/Compression/RangeCoder/Encoder.java
+++ /dev/null
@@ -1,151 +0,0 @@
-package SevenZip.Compression.RangeCoder;
-import java.io.IOException;
-
-public class Encoder
-{
-	static final int kTopMask = ~((1 << 24) - 1);
-	
-	static final int kNumBitModelTotalBits = 11;
-	static final int kBitModelTotal = (1 << kNumBitModelTotalBits);
-	static final int kNumMoveBits = 5;
-	
-	java.io.OutputStream Stream;
-
-	long Low;
-	int Range;
-	int _cacheSize;
-	int _cache;
-	
-	long _position;
-	
-	public void SetStream(java.io.OutputStream stream)
-	{
-		Stream = stream;
-	}
-	
-	public void ReleaseStream()
-	{
-		Stream = null;
-	}
-	
-	public void Init()
-	{
-		_position = 0;
-		Low = 0;
-		Range = -1;
-		_cacheSize = 1;
-		_cache = 0;
-	}
-	
-	public void FlushData() throws IOException
-	{
-		for (int i = 0; i < 5; i++)
-			ShiftLow();
-	}
-	
-	public void FlushStream() throws IOException
-	{
-		Stream.flush();
-	}
-	
-	public void ShiftLow() throws IOException
-	{
-		int LowHi = (int)(Low >>> 32);
-		if (LowHi != 0 || Low < 0xFF000000L)
-		{
-			_position += _cacheSize;
-			int temp = _cache;
-			do
-			{
-				Stream.write(temp + LowHi);
-				temp = 0xFF;
-			}
-			while(--_cacheSize != 0);
-			_cache = (((int)Low) >>> 24);
-		}
-		_cacheSize++;
-		Low = (Low & 0xFFFFFF) << 8;
-	}
-	
-	public void EncodeDirectBits(int v, int numTotalBits) throws IOException
-	{
-		for (int i = numTotalBits - 1; i >= 0; i--)
-		{
-			Range >>>= 1;
-			if (((v >>> i) & 1) == 1)
-				Low += Range;
-			if ((Range & Encoder.kTopMask) == 0)
-			{
-				Range <<= 8;
-				ShiftLow();
-			}
-		}
-	}
-	
-	
-	public long GetProcessedSizeAdd()
-	{
-		return _cacheSize + _position + 4;
-	}
-	
-	
-	
-	static final int kNumMoveReducingBits = 2;
-	public static final int kNumBitPriceShiftBits = 6;
-	
-	public static void InitBitModels(short []probs)
-	{
-		for (int i = 0; i < probs.length; i++)
-			probs[i] = (kBitModelTotal >>> 1);
-	}
-	
-	public void Encode(short []probs, int index, int symbol) throws IOException
-	{
-		int prob = probs[index];
-		int newBound = (Range >>> kNumBitModelTotalBits) * prob;
-		if (symbol == 0)
-		{
-			Range = newBound;
-			probs[index] = (short)(prob + ((kBitModelTotal - prob) >>> kNumMoveBits));
-		}
-		else
-		{
-			Low += (newBound & 0xFFFFFFFFL);
-			Range -= newBound;
-			probs[index] = (short)(prob - ((prob) >>> kNumMoveBits));
-		}
-		if ((Range & kTopMask) == 0)
-		{
-			Range <<= 8;
-			ShiftLow();
-		}
-	}
-	
-	private static int[] ProbPrices = new int[kBitModelTotal >>> kNumMoveReducingBits];
-	
-	static
-	{
-		int kNumBits = (kNumBitModelTotalBits - kNumMoveReducingBits);
-		for (int i = kNumBits - 1; i >= 0; i--)
-		{
-			int start = 1 << (kNumBits - i - 1);
-			int end = 1 << (kNumBits - i);
-			for (int j = start; j < end; j++)
-				ProbPrices[j] = (i << kNumBitPriceShiftBits) +
-						(((end - j) << kNumBitPriceShiftBits) >>> (kNumBits - i - 1));
-		}
-	}
-	
-	static public int GetPrice(int Prob, int symbol)
-	{
-		return ProbPrices[(((Prob - symbol) ^ ((-symbol))) & (kBitModelTotal - 1)) >>> kNumMoveReducingBits];
-	}
-	static public int GetPrice0(int Prob)
-	{ 
-		return ProbPrices[Prob >>> kNumMoveReducingBits]; 
-	}
-	static public int GetPrice1(int Prob)
-	{ 
-		return ProbPrices[(kBitModelTotal - Prob) >>> kNumMoveReducingBits]; 
-	}
-}
diff --git a/third_party/lzma/v4_65/files/Java/SevenZip/ICodeProgress.java b/third_party/lzma/v4_65/files/Java/SevenZip/ICodeProgress.java
deleted file mode 100644
index 4cb8d1b..0000000
--- a/third_party/lzma/v4_65/files/Java/SevenZip/ICodeProgress.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package SevenZip;
-
-public interface ICodeProgress
-{
-	public void SetProgress(long inSize, long outSize);
-}
diff --git a/third_party/lzma/v4_65/files/Java/SevenZip/LzmaAlone.java b/third_party/lzma/v4_65/files/Java/SevenZip/LzmaAlone.java
deleted file mode 100644
index d1d27f9..0000000
--- a/third_party/lzma/v4_65/files/Java/SevenZip/LzmaAlone.java
+++ /dev/null
@@ -1,253 +0,0 @@
-package SevenZip;
-
-public class LzmaAlone
-{
-	static public class CommandLine
-	{
-		public static final int kEncode = 0;
-		public static final int kDecode = 1;
-		public static final int kBenchmak = 2;
-		
-		public int Command = -1;
-		public int NumBenchmarkPasses = 10;
-		
-		public int DictionarySize = 1 << 23;
-		public boolean DictionarySizeIsDefined = false;
-		
-		public int Lc = 3;
-		public int Lp = 0;
-		public int Pb = 2;
-		
-		public int Fb = 128;
-		public boolean FbIsDefined = false;
-		
-		public boolean Eos = false;
-		
-		public int Algorithm = 2;
-		public int MatchFinder = 1;
-		
-		public String InFile;
-		public String OutFile;
-		
-		boolean ParseSwitch(String s)
-		{
-			if (s.startsWith("d"))
-			{
-				DictionarySize = 1 << Integer.parseInt(s.substring(1));
-				DictionarySizeIsDefined = true;
-			}
-			else if (s.startsWith("fb"))
-			{
-				Fb = Integer.parseInt(s.substring(2));
-				FbIsDefined = true;
-			}
-			else if (s.startsWith("a"))
-				Algorithm = Integer.parseInt(s.substring(1));
-			else if (s.startsWith("lc"))
-				Lc = Integer.parseInt(s.substring(2));
-			else if (s.startsWith("lp"))
-				Lp = Integer.parseInt(s.substring(2));
-			else if (s.startsWith("pb"))
-				Pb = Integer.parseInt(s.substring(2));
-			else if (s.startsWith("eos"))
-				Eos = true;
-			else if (s.startsWith("mf"))
-			{
-				String mfs = s.substring(2);
-				if (mfs.equals("bt2"))
-					MatchFinder = 0;
-				else if (mfs.equals("bt4"))
-					MatchFinder = 1;
-				else if (mfs.equals("bt4b"))
-					MatchFinder = 2;
-				else
-					return false;
-			}
-			else
-				return false;
-			return true;
-		}
-		
-		public boolean Parse(String[] args) throws Exception
-		{
-			int pos = 0;
-			boolean switchMode = true;
-			for (int i = 0; i < args.length; i++)
-			{
-				String s = args[i];
-				if (s.length() == 0)
-					return false;
-				if (switchMode)
-				{
-					if (s.compareTo("--") == 0)
-					{
-						switchMode = false;
-						continue;
-					}
-					if (s.charAt(0) == '-')
-					{
-						String sw = s.substring(1).toLowerCase();
-						if (sw.length() == 0)
-							return false;
-						try
-						{
-							if (!ParseSwitch(sw))
-								return false;
-						}
-						catch (NumberFormatException e)
-						{
-							return false;
-						}
-						continue;
-					}
-				}
-				if (pos == 0)
-				{
-					if (s.equalsIgnoreCase("e"))
-						Command = kEncode;
-					else if (s.equalsIgnoreCase("d"))
-						Command = kDecode;
-					else if (s.equalsIgnoreCase("b"))
-						Command = kBenchmak;
-					else
-						return false;
-				}
-				else if(pos == 1)
-				{
-					if (Command == kBenchmak)
-					{
-						try
-						{
-							NumBenchmarkPasses = Integer.parseInt(s);
-							if (NumBenchmarkPasses < 1)
-								return false;
-						}
-						catch (NumberFormatException e)
-						{
-							return false;
-						}
-					}
-					else
-						InFile = s;
-				}
-				else if(pos == 2)
-					OutFile = s;
-				else
-					return false;
-				pos++;
-				continue;
-			}
-			return true;
-		}
-	}
-	
-	
-	static void PrintHelp()
-	{
-		System.out.println(
-				"\nUsage:  LZMA <e|d> [<switches>...] inputFile outputFile\n" +
-				"  e: encode file\n" +
-				"  d: decode file\n" +
-				"  b: Benchmark\n" +
-				"<Switches>\n" +
-				// "  -a{N}:  set compression mode - [0, 1], default: 1 (max)\n" +
-				"  -d{N}:  set dictionary - [0,28], default: 23 (8MB)\n" +
-				"  -fb{N}: set number of fast bytes - [5, 273], default: 128\n" +
-				"  -lc{N}: set number of literal context bits - [0, 8], default: 3\n" +
-				"  -lp{N}: set number of literal pos bits - [0, 4], default: 0\n" +
-				"  -pb{N}: set number of pos bits - [0, 4], default: 2\n" +
-				"  -mf{MF_ID}: set Match Finder: [bt2, bt4], default: bt4\n" +
-				"  -eos:   write End Of Stream marker\n"
-				);
-	}
-	
-	public static void main(String[] args) throws Exception
-	{
-		System.out.println("\nLZMA (Java) 4.61  2008-11-23\n");
-		
-		if (args.length < 1)
-		{
-			PrintHelp();
-			return;
-		}
-		
-		CommandLine params = new CommandLine();
-		if (!params.Parse(args))
-		{
-			System.out.println("\nIncorrect command");
-			return;
-		}
-		
-		if (params.Command == CommandLine.kBenchmak)
-		{
-			int dictionary = (1 << 21);
-			if (params.DictionarySizeIsDefined)
-				dictionary = params.DictionarySize;
-			if (params.MatchFinder > 1)
-				throw new Exception("Unsupported match finder");
-			SevenZip.LzmaBench.LzmaBenchmark(params.NumBenchmarkPasses, dictionary);
-		}
-		else if (params.Command == CommandLine.kEncode || params.Command == CommandLine.kDecode)
-		{
-			java.io.File inFile = new java.io.File(params.InFile);
-			java.io.File outFile = new java.io.File(params.OutFile);
-			
-			java.io.BufferedInputStream inStream  = new java.io.BufferedInputStream(new java.io.FileInputStream(inFile));
-			java.io.BufferedOutputStream outStream = new java.io.BufferedOutputStream(new java.io.FileOutputStream(outFile));
-			
-			boolean eos = false;
-			if (params.Eos)
-				eos = true;
-			if (params.Command == CommandLine.kEncode)
-			{
-				SevenZip.Compression.LZMA.Encoder encoder = new SevenZip.Compression.LZMA.Encoder();
-				if (!encoder.SetAlgorithm(params.Algorithm))
-					throw new Exception("Incorrect compression mode");
-				if (!encoder.SetDictionarySize(params.DictionarySize))
-					throw new Exception("Incorrect dictionary size");
-				if (!encoder.SetNumFastBytes(params.Fb))
-					throw new Exception("Incorrect -fb value");
-				if (!encoder.SetMatchFinder(params.MatchFinder))
-					throw new Exception("Incorrect -mf value");
-				if (!encoder.SetLcLpPb(params.Lc, params.Lp, params.Pb))
-					throw new Exception("Incorrect -lc or -lp or -pb value");
-				encoder.SetEndMarkerMode(eos);
-				encoder.WriteCoderProperties(outStream);
-				long fileSize;
-				if (eos)
-					fileSize = -1;
-				else
-					fileSize = inFile.length();
-				for (int i = 0; i < 8; i++)
-					outStream.write((int)(fileSize >>> (8 * i)) & 0xFF);
-				encoder.Code(inStream, outStream, -1, -1, null);
-			}
-			else
-			{
-				int propertiesSize = 5;
-				byte[] properties = new byte[propertiesSize];
-				if (inStream.read(properties, 0, propertiesSize) != propertiesSize)
-					throw new Exception("input .lzma file is too short");
-				SevenZip.Compression.LZMA.Decoder decoder = new SevenZip.Compression.LZMA.Decoder();
-				if (!decoder.SetDecoderProperties(properties))
-					throw new Exception("Incorrect stream properties");
-				long outSize = 0;
-				for (int i = 0; i < 8; i++)
-				{
-					int v = inStream.read();
-					if (v < 0)
-						throw new Exception("Can't read stream size");
-					outSize |= ((long)v) << (8 * i);
-				}
-				if (!decoder.Code(inStream, outStream, outSize))
-					throw new Exception("Error in data stream");
-			}
-			outStream.flush();
-			outStream.close();
-			inStream.close();
-		}
-		else
-			throw new Exception("Incorrect command");
-		return;
-	}
-}
diff --git a/third_party/lzma/v4_65/files/Java/SevenZip/LzmaBench.java b/third_party/lzma/v4_65/files/Java/SevenZip/LzmaBench.java
deleted file mode 100644
index 397e7af..0000000
--- a/third_party/lzma/v4_65/files/Java/SevenZip/LzmaBench.java
+++ /dev/null
@@ -1,392 +0,0 @@
-package SevenZip;
-
-import java.io.ByteArrayOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-
-public class LzmaBench
-{
-	static final int kAdditionalSize = (1 << 21);
-	static final int kCompressedAdditionalSize = (1 << 10);
-	
-	static class CRandomGenerator
-	{
-		int A1;
-		int A2;
-		public CRandomGenerator() { Init(); }
-		public void Init() { A1 = 362436069; A2 = 521288629; }
-		public int GetRnd()
-		{
-			return
-				((A1 = 36969 * (A1 & 0xffff) + (A1 >>> 16)) << 16) ^
-				((A2 = 18000 * (A2 & 0xffff) + (A2 >>> 16)));
-		}
-	};
-	
-	static class CBitRandomGenerator
-	{
-		CRandomGenerator RG = new CRandomGenerator();
-		int Value;
-		int NumBits;
-		public void Init()
-		{
-			Value = 0;
-			NumBits = 0;
-		}
-		public int GetRnd(int numBits)
-		{
-			int result;
-			if (NumBits > numBits)
-			{
-				result = Value & ((1 << numBits) - 1);
-				Value >>>= numBits;
-				NumBits -= numBits;
-				return result;
-			}
-			numBits -= NumBits;
-			result = (Value << numBits);
-			Value = RG.GetRnd();
-			result |= Value & (((int)1 << numBits) - 1);
-			Value >>>= numBits;
-			NumBits = 32 - numBits;
-			return result;
-		}
-	};
-	
-	static class CBenchRandomGenerator
-	{
-		CBitRandomGenerator RG = new CBitRandomGenerator();
-		int Pos;
-		int Rep0;
-
-		public int BufferSize;
-		public byte[] Buffer = null;
-
-		public CBenchRandomGenerator() { }
-		public void Set(int bufferSize)
-		{
-			Buffer = new byte[bufferSize];
-			Pos = 0;
-			BufferSize = bufferSize;
-		}
-		int GetRndBit() { return RG.GetRnd(1); }
-		int GetLogRandBits(int numBits)
-		{
-			int len = RG.GetRnd(numBits);
-			return RG.GetRnd((int)len);
-		}
-		int GetOffset()
-		{
-			if (GetRndBit() == 0)
-				return GetLogRandBits(4);
-			return (GetLogRandBits(4) << 10) | RG.GetRnd(10);
-		}
-		int GetLen1() { return RG.GetRnd(1 + (int)RG.GetRnd(2)); }
-		int GetLen2() { return RG.GetRnd(2 + (int)RG.GetRnd(2)); }
-		public void Generate()
-		{
-			RG.Init();
-			Rep0 = 1;
-			while (Pos < BufferSize)
-			{
-				if (GetRndBit() == 0 || Pos < 1)
-					Buffer[Pos++] = (byte)(RG.GetRnd(8));
-				else
-				{
-					int len;
-					if (RG.GetRnd(3) == 0)
-						len = 1 + GetLen1();
-					else
-					{
-						do
-							Rep0 = GetOffset();
-						while (Rep0 >= Pos);
-						Rep0++;
-						len = 2 + GetLen2();
-					}
-					for (int i = 0; i < len && Pos < BufferSize; i++, Pos++)
-						Buffer[Pos] = Buffer[Pos - Rep0];
-				}
-			}
-		}
-	};
-	
-	static class CrcOutStream extends java.io.OutputStream
-	{
-		public CRC CRC = new CRC();
-		
-		public void Init()
-		{ 
-			CRC.Init(); 
-		}
-		public int GetDigest()
-		{ 
-			return CRC.GetDigest(); 
-		}
-		public void write(byte[] b)
-		{
-			CRC.Update(b);
-		}
-		public void write(byte[] b, int off, int len)
-		{
-			CRC.Update(b, off, len);
-		}
-		public void write(int b)
-		{
-			CRC.UpdateByte(b);
-		}
-	};
-
-	static class MyOutputStream extends java.io.OutputStream
-	{
-		byte[] _buffer;
-		int _size;
-		int _pos;
-		
-		public MyOutputStream(byte[] buffer)
-		{
-			_buffer = buffer;
-			_size = _buffer.length;
-		}
-		
-		public void reset()
-		{ 
-			_pos = 0; 
-		}
-		
-		public void write(int b) throws IOException
-		{
-			if (_pos >= _size)
-				throw new IOException("Error");
-			_buffer[_pos++] = (byte)b;
-		}
-		
-		public int size()
-		{
-			return _pos;
-		}
-	};
-
-	static class MyInputStream extends java.io.InputStream
-	{
-		byte[] _buffer;
-		int _size;
-		int _pos;
-		
-		public MyInputStream(byte[] buffer, int size)
-		{
-			_buffer = buffer;
-			_size = size;
-		}
-		
-		public void reset()
-		{ 
-			_pos = 0; 
-		}
-		
-		public int read()
-		{
-			if (_pos >= _size)
-				return -1;
-			return _buffer[_pos++] & 0xFF;
-		}
-	};
-	
-	static class CProgressInfo implements ICodeProgress
-	{
-		public long ApprovedStart;
-		public long InSize;
-		public long Time;
-		public void Init()
-		{ InSize = 0; }
-		public void SetProgress(long inSize, long outSize)
-		{
-			if (inSize >= ApprovedStart && InSize == 0)
-			{
-				Time = System.currentTimeMillis();
-				InSize = inSize;
-			}
-		}
-	}
-	static final int kSubBits = 8;
-	
-	static int GetLogSize(int size)
-	{
-		for (int i = kSubBits; i < 32; i++)
-			for (int j = 0; j < (1 << kSubBits); j++)
-				if (size <= ((1) << i) + (j << (i - kSubBits)))
-					return (i << kSubBits) + j;
-		return (32 << kSubBits);
-	}
-	
-	static long MyMultDiv64(long value, long elapsedTime)
-	{
-		long freq = 1000; // ms
-		long elTime = elapsedTime;
-		while (freq > 1000000)
-		{
-			freq >>>= 1;
-			elTime >>>= 1;
-		}
-		if (elTime == 0)
-			elTime = 1;
-		return value * freq / elTime;
-	}
-	
-	static long GetCompressRating(int dictionarySize, long elapsedTime, long size)
-	{
-		long t = GetLogSize(dictionarySize) - (18 << kSubBits);
-		long numCommandsForOne = 1060 + ((t * t * 10) >> (2 * kSubBits));
-		long numCommands = (long)(size) * numCommandsForOne;
-		return MyMultDiv64(numCommands, elapsedTime);
-	}
-	
-	static long GetDecompressRating(long elapsedTime, long outSize, long inSize)
-	{
-		long numCommands = inSize * 220 + outSize * 20;
-		return MyMultDiv64(numCommands, elapsedTime);
-	}
-	
-	static long GetTotalRating(
-			int dictionarySize,
-			long elapsedTimeEn, long sizeEn,
-			long elapsedTimeDe,
-			long inSizeDe, long outSizeDe)
-	{
-		return (GetCompressRating(dictionarySize, elapsedTimeEn, sizeEn) +
-				GetDecompressRating(elapsedTimeDe, inSizeDe, outSizeDe)) / 2;
-	}
-	
-	static void PrintValue(long v)
-	{
-		String s = "";
-		s += v;
-		for (int i = 0; i + s.length() < 6; i++)
-			System.out.print(" ");
-		System.out.print(s);
-	}
-	
-	static void PrintRating(long rating)
-	{
-		PrintValue(rating / 1000000);
-		System.out.print(" MIPS");
-	}
-	
-	static void PrintResults(
-			int dictionarySize,
-			long elapsedTime,
-			long size,
-			boolean decompressMode, long secondSize)
-	{
-		long speed = MyMultDiv64(size, elapsedTime);
-		PrintValue(speed / 1024);
-		System.out.print(" KB/s  ");
-		long rating;
-		if (decompressMode)
-			rating = GetDecompressRating(elapsedTime, size, secondSize);
-		else
-			rating = GetCompressRating(dictionarySize, elapsedTime, size);
-		PrintRating(rating);
-	}
-	
-	static public int LzmaBenchmark(int numIterations, int dictionarySize) throws Exception
-	{
-		if (numIterations <= 0)
-			return 0;
-		if (dictionarySize < (1 << 18))
-		{
-			System.out.println("\nError: dictionary size for benchmark must be >= 18 (256 KB)");
-			return 1;
-		}
-		System.out.print("\n       Compressing                Decompressing\n\n");
-		
-		SevenZip.Compression.LZMA.Encoder encoder = new SevenZip.Compression.LZMA.Encoder();
-		SevenZip.Compression.LZMA.Decoder decoder = new SevenZip.Compression.LZMA.Decoder();
-		
-		if (!encoder.SetDictionarySize(dictionarySize))
-			throw new Exception("Incorrect dictionary size");
-		
-		int kBufferSize = dictionarySize + kAdditionalSize;
-		int kCompressedBufferSize = (kBufferSize / 2) + kCompressedAdditionalSize;
-		
-		ByteArrayOutputStream propStream = new ByteArrayOutputStream();
-		encoder.WriteCoderProperties(propStream);
-		byte[] propArray = propStream.toByteArray();
-		decoder.SetDecoderProperties(propArray);
-		
-		CBenchRandomGenerator rg = new CBenchRandomGenerator();
-
-		rg.Set(kBufferSize);
-		rg.Generate();
-		CRC crc = new CRC();
-		crc.Init();
-		crc.Update(rg.Buffer, 0, rg.BufferSize);
-		
-		CProgressInfo progressInfo = new CProgressInfo();
-		progressInfo.ApprovedStart = dictionarySize;
-		
-		long totalBenchSize = 0;
-		long totalEncodeTime = 0;
-		long totalDecodeTime = 0;
-		long totalCompressedSize = 0;
-		
-		MyInputStream inStream = new MyInputStream(rg.Buffer, rg.BufferSize);
-
-		byte[] compressedBuffer = new byte[kCompressedBufferSize];
-		MyOutputStream compressedStream = new MyOutputStream(compressedBuffer);
-		CrcOutStream crcOutStream = new CrcOutStream();
-		MyInputStream inputCompressedStream = null;
-		int compressedSize = 0;
-		for (int i = 0; i < numIterations; i++)
-		{
-			progressInfo.Init();
-			inStream.reset();
-			compressedStream.reset();
-			encoder.Code(inStream, compressedStream, -1, -1, progressInfo);
-			long encodeTime = System.currentTimeMillis() - progressInfo.Time;
-			
-			if (i == 0)
-			{
-				compressedSize = compressedStream.size();
-				inputCompressedStream = new MyInputStream(compressedBuffer, compressedSize);
-			}
-			else if (compressedSize != compressedStream.size())
-				throw (new Exception("Encoding error"));
-				
-			if (progressInfo.InSize == 0)
-				throw (new Exception("Internal ERROR 1282"));
-
-			long decodeTime = 0;
-			for (int j = 0; j < 2; j++)
-			{
-				inputCompressedStream.reset();
-				crcOutStream.Init();
-				
-				long outSize = kBufferSize;
-				long startTime = System.currentTimeMillis();
-				if (!decoder.Code(inputCompressedStream, crcOutStream, outSize))
-					throw (new Exception("Decoding Error"));;
-				decodeTime = System.currentTimeMillis() - startTime;
-				if (crcOutStream.GetDigest() != crc.GetDigest())
-					throw (new Exception("CRC Error"));
-			}
-			long benchSize = kBufferSize - (long)progressInfo.InSize;
-			PrintResults(dictionarySize, encodeTime, benchSize, false, 0);
-			System.out.print("     ");
-			PrintResults(dictionarySize, decodeTime, kBufferSize, true, compressedSize);
-			System.out.println();
-			
-			totalBenchSize += benchSize;
-			totalEncodeTime += encodeTime;
-			totalDecodeTime += decodeTime;
-			totalCompressedSize += compressedSize;
-		}
-		System.out.println("---------------------------------------------------");
-		PrintResults(dictionarySize, totalEncodeTime, totalBenchSize, false, 0);
-		System.out.print("     ");
-		PrintResults(dictionarySize, totalDecodeTime,
-				kBufferSize * (long)numIterations, true, totalCompressedSize);
-		System.out.println("    Average");
-		return 0;
-	}
-}
diff --git a/third_party/lzma/v4_65/files/Methods.txt b/third_party/lzma/v4_65/files/Methods.txt
deleted file mode 100644
index 5b5cb93..0000000
--- a/third_party/lzma/v4_65/files/Methods.txt
+++ /dev/null
@@ -1,137 +0,0 @@
-7-Zip method IDs (4.65)
------------------------
-
-Each compression or crypto method in 7z has unique binary value (ID).
-The length of ID in bytes is arbitrary but it can not exceed 63 bits (8 bytes).
-
-If you want to add some new ID, you have two ways:
-1) Write request for allocating IDs to 7-zip developers.
-2) Generate 8-bytes ID:
-
-    3F ZZ ZZ ZZ ZZ ZZ MM MM 
-
-    3F              - Prefix for random IDs (1 byte)
-    ZZ ZZ ZZ ZZ ZZ  - Developer ID (5 bytes). Use real random bytes. 
-                      
-    MM MM           - Method ID (2 bytes)
-
-    You can notify 7-Zip developers about your Developer ID / Method ID.
-
-    Note: Use new ID only if old codec can not decode data encoded with new version.
-
-
-List of defined IDs
--------------------
-      
-00 - Copy
-
-02 - Common
-   03 Swap
-      - 2 Swap2
-      - 4 Swap4
-
-03 - 7z
-   01 - LZMA
-      01 - Version
-  
-   03 - Branch
-      01 - x86
-         03  - BCJ
-         1B  - BCJ2
-      02 - PPC
-         05 - PPC (Big Endian)
-      03 - Alpha
-         01 - Alpha
-      04 - IA64
-         01 - IA64
-      05 - ARM
-         01 - ARM
-      06 - M68
-         05 - M68 (Big Endian)
-      07 - ARM Thumb
-         01 - ARMT
-      08 - SPARC
-         05 - SPARC
-
-   04 - PPMD
-      01 - Version
-
-   7F -
-      01 - experimental methods.
-
-
-04 - Misc
-   00 - Reserved
-   01 - Zip
-      00 - Copy (not used). Use {00} instead
-      01 - Shrink
-      06 - Implode
-      08 - Deflate
-      09 - Deflate64
-      12 - BZip2 (not used). Use {04 02 02} instead
-   02 - BZip
-      02 - BZip2
-   03 - Rar
-      01 - Rar15
-      02 - Rar20
-      03 - Rar29
-   04 - Arj
-      01 - Arj (1,2,3)
-      02 - Arj 4
-   05 - Z
-   06 - Lzh
-   07 - Reserved for 7z
-   08 - Cab
-   09 - NSIS
-      01 - DeflateNSIS
-      02 - BZip2NSIS
-
-
-06 - Crypto 
-   00 - 
-   01 - AES
-      0x - AES-128
-      4x - AES-192
-      8x - AES-256
-      Cx - AES
-
-      x0 - ECB
-      x1 - CBC
-      x2 - CFB
-      x3 - OFB
-
-   07 - Reserved
-   0F - Reserved
-
-   F0 - Misc Ciphers (Real Ciphers without hashing algo)
-
-   F1 - Misc Ciphers (Combine)
-      01 - Zip
-         01 - Main Zip crypto algo
-      03 - RAR
-         02 - 
-         03 - Rar29 AES-128 + (modified SHA-1)
-      07 - 7z
-         01 - AES-256 + SHA-256
-
-07 - Hash (subject to change)
-   00 - 
-   01 - CRC
-   02 - SHA-1
-   03 - SHA-256
-   04 - SHA-384
-   05 - SHA-512
-
-   F0 - Misc Hash
-
-   F1 - Misc
-      03 - RAR
-         03 - Rar29 Password Hashing (modified SHA1)
-      07 - 7z 
-         01 - SHA-256 Password Hashing
-    
-   
-
-
----
-End of document
diff --git a/third_party/lzma/v4_65/files/history.txt b/third_party/lzma/v4_65/files/history.txt
deleted file mode 100644
index 0141867..0000000
--- a/third_party/lzma/v4_65/files/history.txt
+++ /dev/null
@@ -1,236 +0,0 @@
-HISTORY of the LZMA SDK
------------------------
-
-4.65           2009-02-03
--------------------------
-- Some minor fixes
-
-
-4.63           2008-12-31
--------------------------
-- Some minor fixes
-
-
-4.61 beta      2008-11-23
--------------------------
-- The bug in ANSI-C LZMA Decoder was fixed:
-    If encoded stream was corrupted, decoder could access memory 
-    outside of allocated range.
-- Some changes in ANSI-C 7z Decoder interfaces.
-- LZMA SDK is placed in the public domain.
-
-
-4.60 beta      2008-08-19
--------------------------
-- Some minor fixes.
-
-
-4.59 beta      2008-08-13
--------------------------
-- The bug was fixed:
-    LZMA Encoder in fast compression mode could access memory outside of 
-    allocated range in some rare cases.
-
-
-4.58 beta      2008-05-05
--------------------------
-- ANSI-C LZMA Decoder was rewritten for speed optimizations.
-- ANSI-C LZMA Encoder was included to LZMA SDK.
-- C++ LZMA code now is just wrapper over ANSI-C code.
-
-
-4.57           2007-12-12
--------------------------
-- Speed optimizations in Ñ++ LZMA Decoder. 
-- Small changes for more compatibility with some C/C++ compilers.
-
-
-4.49 beta      2007-07-05
--------------------------
-- .7z ANSI-C Decoder:
-     - now it supports BCJ and BCJ2 filters
-     - now it supports files larger than 4 GB.
-     - now it supports "Last Write Time" field for files.
-- C++ code for .7z archives compressing/decompressing from 7-zip 
-  was included to LZMA SDK.
-  
-
-4.43           2006-06-04
--------------------------
-- Small changes for more compatibility with some C/C++ compilers.
-  
-
-4.42           2006-05-15
--------------------------
-- Small changes in .h files in ANSI-C version.
-  
-
-4.39 beta      2006-04-14
--------------------------
-- The bug in versions 4.33b:4.38b was fixed:
-  C++ version of LZMA encoder could not correctly compress 
-  files larger than 2 GB with HC4 match finder (-mfhc4).
-  
-
-4.37 beta      2005-04-06
--------------------------
-- Fixes in C++ code: code could no be compiled if _NO_EXCEPTIONS was defined. 
-
-
-4.35 beta      2005-03-02
--------------------------
-- The bug was fixed in C++ version of LZMA Decoder:
-    If encoded stream was corrupted, decoder could access memory 
-    outside of allocated range.
-
-
-4.34 beta      2006-02-27
--------------------------
-- Compressing speed and memory requirements for compressing were increased
-- LZMA now can use only these match finders: HC4, BT2, BT3, BT4
-
-
-4.32           2005-12-09
--------------------------
-- Java version of LZMA SDK was included
-
-
-4.30           2005-11-20
--------------------------
-- Compression ratio was improved in -a2 mode
-- Speed optimizations for compressing in -a2 mode
-- -fb switch now supports values up to 273
-- The bug in 7z_C (7zIn.c) was fixed:
-  It used Alloc/Free functions from different memory pools.
-  So if program used two memory pools, it worked incorrectly.
-- 7z_C: .7z format supporting was improved
-- LZMA# SDK (C#.NET version) was included
-
-
-4.27 (Updated) 2005-09-21
--------------------------
-- Some GUIDs/interfaces in C++ were changed.
- IStream.h:
-   ISequentialInStream::Read now works as old ReadPart
-   ISequentialOutStream::Write now works as old WritePart
-
-
-4.27           2005-08-07
--------------------------
-- The bug in LzmaDecodeSize.c was fixed:
-   if _LZMA_IN_CB and _LZMA_OUT_READ were defined,
-   decompressing worked incorrectly.
-
-
-4.26           2005-08-05
--------------------------
-- Fixes in 7z_C code and LzmaTest.c:
-  previous versions could work incorrectly,
-  if malloc(0) returns 0
-
-
-4.23           2005-06-29
--------------------------
-- Small fixes in C++ code
-
-
-4.22           2005-06-10
--------------------------
-- Small fixes
-
-
-4.21           2005-06-08
--------------------------
-- Interfaces for ANSI-C LZMA Decoder (LzmaDecode.c) were changed
-- New additional version of ANSI-C LZMA Decoder with zlib-like interface:
-    - LzmaStateDecode.h
-    - LzmaStateDecode.c
-    - LzmaStateTest.c
-- ANSI-C LZMA Decoder now can decompress files larger than 4 GB
-
-
-4.17           2005-04-18
--------------------------
-- New example for RAM->RAM compressing/decompressing: 
-  LZMA + BCJ (filter for x86 code):
-    - LzmaRam.h
-    - LzmaRam.cpp
-    - LzmaRamDecode.h
-    - LzmaRamDecode.c
-    - -f86 switch for lzma.exe
-
-
-4.16           2005-03-29
--------------------------
-- The bug was fixed in LzmaDecode.c (ANSI-C LZMA Decoder): 
-   If _LZMA_OUT_READ was defined, and if encoded stream was corrupted,
-   decoder could access memory outside of allocated range.
-- Speed optimization of ANSI-C LZMA Decoder (now it's about 20% faster).
-  Old version of LZMA Decoder now is in file LzmaDecodeSize.c. 
-  LzmaDecodeSize.c can provide slightly smaller code than LzmaDecode.c
-- Small speed optimization in LZMA C++ code
-- filter for SPARC's code was added
-- Simplified version of .7z ANSI-C Decoder was included
-
-
-4.06           2004-09-05
--------------------------
-- The bug in v4.05 was fixed:
-    LZMA-Encoder didn't release output stream in some cases.
-
-
-4.05           2004-08-25
--------------------------
-- Source code of filters for x86, IA-64, ARM, ARM-Thumb 
-  and PowerPC code was included to SDK
-- Some internal minor changes
-
-
-4.04           2004-07-28
--------------------------
-- More compatibility with some C++ compilers
-
-
-4.03           2004-06-18
--------------------------
-- "Benchmark" command was added. It measures compressing 
-  and decompressing speed and shows rating values. 
-  Also it checks hardware errors.
-
-
-4.02           2004-06-10
--------------------------
-- C++ LZMA Encoder/Decoder code now is more portable
-  and it can be compiled by GCC on Linux.
-
-
-4.01           2004-02-15
--------------------------
-- Some detection of data corruption was enabled.
-    LzmaDecode.c / RangeDecoderReadByte
-    .....
-    {
-      rd->ExtraBytes = 1;
-      return 0xFF;
-    }
-
-
-4.00           2004-02-13
--------------------------
-- Original version of LZMA SDK
-
-
-
-HISTORY of the LZMA
--------------------
-  2001-2008:  Improvements to LZMA compressing/decompressing code, 
-              keeping compatibility with original LZMA format
-  1996-2001:  Development of LZMA compression format
-
-  Some milestones:
-
-  2001-08-30: LZMA compression was added to 7-Zip
-  1999-01-02: First version of 7-Zip was released
-  
-
-End of document
diff --git a/third_party/lzma/v4_65/files/lzma.exe b/third_party/lzma/v4_65/files/lzma.exe
deleted file mode 100644
index 1000f23..0000000
--- a/third_party/lzma/v4_65/files/lzma.exe
+++ /dev/null
Binary files differ
diff --git a/third_party/lzma/v4_65/files/lzma.txt b/third_party/lzma/v4_65/files/lzma.txt
deleted file mode 100644
index 715792d..0000000
--- a/third_party/lzma/v4_65/files/lzma.txt
+++ /dev/null
@@ -1,594 +0,0 @@
-LZMA SDK 4.65
--------------
-
-LZMA SDK provides the documentation, samples, header files, libraries, 
-and tools you need to develop applications that use LZMA compression.
-
-LZMA is default and general compression method of 7z format
-in 7-Zip compression program (www.7-zip.org). LZMA provides high 
-compression ratio and very fast decompression.
-
-LZMA is an improved version of famous LZ77 compression algorithm. 
-It was improved in way of maximum increasing of compression ratio,
-keeping high decompression speed and low memory requirements for 
-decompressing.
-
-
-
-LICENSE
--------
-
-LZMA SDK is written and placed in the public domain by Igor Pavlov.
-
-
-LZMA SDK Contents
------------------
-
-LZMA SDK includes:
-
-  - ANSI-C/C++/C#/Java source code for LZMA compressing and decompressing
-  - Compiled file->file LZMA compressing/decompressing program for Windows system
-
-
-UNIX/Linux version 
-------------------
-To compile C++ version of file->file LZMA encoding, go to directory
-C++/7zip/Compress/LZMA_Alone 
-and call make to recompile it:
-  make -f makefile.gcc clean all
-
-In some UNIX/Linux versions you must compile LZMA with static libraries.
-To compile with static libraries, you can use 
-LIB = -lm -static
-
-
-Files
----------------------
-lzma.txt     - LZMA SDK description (this file)
-7zFormat.txt - 7z Format description
-7zC.txt      - 7z ANSI-C Decoder description
-methods.txt  - Compression method IDs for .7z
-lzma.exe     - Compiled file->file LZMA encoder/decoder for Windows
-history.txt  - history of the LZMA SDK
-
-
-Source code structure
----------------------
-
-C/  - C files
-        7zCrc*.*   - CRC code
-        Alloc.*    - Memory allocation functions
-        Bra*.*     - Filters for x86, IA-64, ARM, ARM-Thumb, PowerPC and SPARC code
-        LzFind.*   - Match finder for LZ (LZMA) encoders 
-        LzFindMt.* - Match finder for LZ (LZMA) encoders for multithreading encoding
-        LzHash.h   - Additional file for LZ match finder
-        LzmaDec.*  - LZMA decoding
-        LzmaEnc.*  - LZMA encoding
-        LzmaLib.*  - LZMA Library for DLL calling
-        Types.h    - Basic types for another .c files
-	Threads.*  - The code for multithreading.
-
-    LzmaLib  - LZMA Library (.DLL for Windows)
-    
-    LzmaUtil - LZMA Utility (file->file LZMA encoder/decoder).
-
-    Archive - files related to archiving
-      7z     - 7z ANSI-C Decoder
-
-CPP/ -- CPP files
-
-  Common  - common files for C++ projects
-  Windows - common files for Windows related code
-
-  7zip    - files related to 7-Zip Project
-
-    Common   - common files for 7-Zip
-
-    Compress - files related to compression/decompression
-
-      Copy         - Copy coder
-      RangeCoder   - Range Coder (special code of compression/decompression)
-      LZMA         - LZMA compression/decompression on C++
-      LZMA_Alone   - file->file LZMA compression/decompression
-      Branch       - Filters for x86, IA-64, ARM, ARM-Thumb, PowerPC and SPARC code
-
-    Archive - files related to archiving
-
-      Common   - common files for archive handling
-      7z       - 7z C++ Encoder/Decoder
-
-    Bundles    - Modules that are bundles of other modules
-  
-      Alone7z           - 7zr.exe: Standalone version of 7z.exe that supports only 7z/LZMA/BCJ/BCJ2
-      Format7zR         - 7zr.dll: Reduced version of 7za.dll: extracting/compressing to 7z/LZMA/BCJ/BCJ2
-      Format7zExtractR  - 7zxr.dll: Reduced version of 7zxa.dll: extracting from 7z/LZMA/BCJ/BCJ2.
-
-    UI        - User Interface files
-         
-      Client7z - Test application for 7za.dll,  7zr.dll, 7zxr.dll
-      Common   - Common UI files
-      Console  - Code for console archiver
-
-
-
-CS/ - C# files
-  7zip
-    Common   - some common files for 7-Zip
-    Compress - files related to compression/decompression
-      LZ     - files related to LZ (Lempel-Ziv) compression algorithm
-      LZMA         - LZMA compression/decompression
-      LzmaAlone    - file->file LZMA compression/decompression
-      RangeCoder   - Range Coder (special code of compression/decompression)
-
-Java/  - Java files
-  SevenZip
-    Compression    - files related to compression/decompression
-      LZ           - files related to LZ (Lempel-Ziv) compression algorithm
-      LZMA         - LZMA compression/decompression
-      RangeCoder   - Range Coder (special code of compression/decompression)
-
-
-C/C++ source code of LZMA SDK is part of 7-Zip project.
-7-Zip source code can be downloaded from 7-Zip's SourceForge page:
-
-  http://sourceforge.net/projects/sevenzip/
-
-
-
-LZMA features
--------------
-  - Variable dictionary size (up to 1 GB)
-  - Estimated compressing speed: about 2 MB/s on 2 GHz CPU
-  - Estimated decompressing speed: 
-      - 20-30 MB/s on 2 GHz Core 2 or AMD Athlon 64
-      - 1-2 MB/s on 200 MHz ARM, MIPS, PowerPC or other simple RISC
-  - Small memory requirements for decompressing (16 KB + DictionarySize)
-  - Small code size for decompressing: 5-8 KB
-
-LZMA decoder uses only integer operations and can be 
-implemented in any modern 32-bit CPU (or on 16-bit CPU with some conditions).
-
-Some critical operations that affect the speed of LZMA decompression:
-  1) 32*16 bit integer multiply
-  2) Misspredicted branches (penalty mostly depends from pipeline length)
-  3) 32-bit shift and arithmetic operations
-
-The speed of LZMA decompressing mostly depends from CPU speed.
-Memory speed has no big meaning. But if your CPU has small data cache, 
-overall weight of memory speed will slightly increase.
-
-
-How To Use
-----------
-
-Using LZMA encoder/decoder executable
---------------------------------------
-
-Usage:  LZMA <e|d> inputFile outputFile [<switches>...]
-
-  e: encode file
-
-  d: decode file
-
-  b: Benchmark. There are two tests: compressing and decompressing 
-     with LZMA method. Benchmark shows rating in MIPS (million 
-     instructions per second). Rating value is calculated from 
-     measured speed and it is normalized with Intel's Core 2 results.
-     Also Benchmark checks possible hardware errors (RAM 
-     errors in most cases). Benchmark uses these settings:
-     (-a1, -d21, -fb32, -mfbt4). You can change only -d parameter. 
-     Also you can change the number of iterations. Example for 30 iterations:
-       LZMA b 30
-     Default number of iterations is 10.
-
-<Switches>
-  
-
-  -a{N}:  set compression mode 0 = fast, 1 = normal
-          default: 1 (normal)
-
-  d{N}:   Sets Dictionary size - [0, 30], default: 23 (8MB)
-          The maximum value for dictionary size is 1 GB = 2^30 bytes.
-          Dictionary size is calculated as DictionarySize = 2^N bytes. 
-          For decompressing file compressed by LZMA method with dictionary 
-          size D = 2^N you need about D bytes of memory (RAM).
-
-  -fb{N}: set number of fast bytes - [5, 273], default: 128
-          Usually big number gives a little bit better compression ratio 
-          and slower compression process.
-
-  -lc{N}: set number of literal context bits - [0, 8], default: 3
-          Sometimes lc=4 gives gain for big files.
-
-  -lp{N}: set number of literal pos bits - [0, 4], default: 0
-          lp switch is intended for periodical data when period is 
-          equal 2^N. For example, for 32-bit (4 bytes) 
-          periodical data you can use lp=2. Often it's better to set lc0, 
-          if you change lp switch.
-
-  -pb{N}: set number of pos bits - [0, 4], default: 2
-          pb switch is intended for periodical data 
-          when period is equal 2^N.
-
-  -mf{MF_ID}: set Match Finder. Default: bt4. 
-              Algorithms from hc* group doesn't provide good compression 
-              ratio, but they often works pretty fast in combination with 
-              fast mode (-a0).
-
-              Memory requirements depend from dictionary size 
-              (parameter "d" in table below). 
-
-               MF_ID     Memory                   Description
-
-                bt2    d *  9.5 + 4MB  Binary Tree with 2 bytes hashing.
-                bt3    d * 11.5 + 4MB  Binary Tree with 3 bytes hashing.
-                bt4    d * 11.5 + 4MB  Binary Tree with 4 bytes hashing.
-                hc4    d *  7.5 + 4MB  Hash Chain with 4 bytes hashing.
-
-  -eos:   write End Of Stream marker. By default LZMA doesn't write 
-          eos marker, since LZMA decoder knows uncompressed size 
-          stored in .lzma file header.
-
-  -si:    Read data from stdin (it will write End Of Stream marker).
-  -so:    Write data to stdout
-
-
-Examples:
-
-1) LZMA e file.bin file.lzma -d16 -lc0 
-
-compresses file.bin to file.lzma with 64 KB dictionary (2^16=64K)  
-and 0 literal context bits. -lc0 allows to reduce memory requirements 
-for decompression.
-
-
-2) LZMA e file.bin file.lzma -lc0 -lp2
-
-compresses file.bin to file.lzma with settings suitable 
-for 32-bit periodical data (for example, ARM or MIPS code).
-
-3) LZMA d file.lzma file.bin
-
-decompresses file.lzma to file.bin.
-
-
-Compression ratio hints
------------------------
-
-Recommendations
----------------
-
-To increase the compression ratio for LZMA compressing it's desirable 
-to have aligned data (if it's possible) and also it's desirable to locate
-data in such order, where code is grouped in one place and data is 
-grouped in other place (it's better than such mixing: code, data, code,
-data, ...).
-
-
-Filters
--------
-You can increase the compression ratio for some data types, using
-special filters before compressing. For example, it's possible to 
-increase the compression ratio on 5-10% for code for those CPU ISAs: 
-x86, IA-64, ARM, ARM-Thumb, PowerPC, SPARC.
-
-You can find C source code of such filters in C/Bra*.* files
-
-You can check the compression ratio gain of these filters with such 
-7-Zip commands (example for ARM code):
-No filter:
-  7z a a1.7z a.bin -m0=lzma
-
-With filter for little-endian ARM code:
-  7z a a2.7z a.bin -m0=arm -m1=lzma        
-
-It works in such manner:
-Compressing    = Filter_encoding + LZMA_encoding
-Decompressing  = LZMA_decoding + Filter_decoding
-
-Compressing and decompressing speed of such filters is very high,
-so it will not increase decompressing time too much.
-Moreover, it reduces decompression time for LZMA_decoding, 
-since compression ratio with filtering is higher.
-
-These filters convert CALL (calling procedure) instructions 
-from relative offsets to absolute addresses, so such data becomes more 
-compressible.
-
-For some ISAs (for example, for MIPS) it's impossible to get gain from such filter.
-
-
-LZMA compressed file format
----------------------------
-Offset Size Description
-  0     1   Special LZMA properties (lc,lp, pb in encoded form)
-  1     4   Dictionary size (little endian)
-  5     8   Uncompressed size (little endian). -1 means unknown size
- 13         Compressed data
-
-
-ANSI-C LZMA Decoder
-~~~~~~~~~~~~~~~~~~~
-
-Please note that interfaces for ANSI-C code were changed in LZMA SDK 4.58.
-If you want to use old interfaces you can download previous version of LZMA SDK
-from sourceforge.net site.
-
-To use ANSI-C LZMA Decoder you need the following files:
-1) LzmaDec.h + LzmaDec.c + Types.h
-LzmaUtil/LzmaUtil.c is example application that uses these files.
-
-
-Memory requirements for LZMA decoding
--------------------------------------
-
-Stack usage of LZMA decoding function for local variables is not 
-larger than 200-400 bytes.
-
-LZMA Decoder uses dictionary buffer and internal state structure.
-Internal state structure consumes
-  state_size = (4 + (1.5 << (lc + lp))) KB
-by default (lc=3, lp=0), state_size = 16 KB.
-
-
-How To decompress data
-----------------------
-
-LZMA Decoder (ANSI-C version) now supports 2 interfaces:
-1) Single-call Decompressing
-2) Multi-call State Decompressing (zlib-like interface)
-
-You must use external allocator:
-Example:
-void *SzAlloc(void *p, size_t size) { p = p; return malloc(size); }
-void SzFree(void *p, void *address) { p = p; free(address); }
-ISzAlloc alloc = { SzAlloc, SzFree };
-
-You can use p = p; operator to disable compiler warnings.
-
-
-Single-call Decompressing
--------------------------
-When to use: RAM->RAM decompressing
-Compile files: LzmaDec.h + LzmaDec.c + Types.h
-Compile defines: no defines
-Memory Requirements:
-  - Input buffer: compressed size
-  - Output buffer: uncompressed size
-  - LZMA Internal Structures: state_size (16 KB for default settings) 
-
-Interface:
-  int LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
-      const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, 
-      ELzmaStatus *status, ISzAlloc *alloc);
-  In: 
-    dest     - output data
-    destLen  - output data size
-    src      - input data
-    srcLen   - input data size
-    propData - LZMA properties  (5 bytes)
-    propSize - size of propData buffer (5 bytes)
-    finishMode - It has meaning only if the decoding reaches output limit (*destLen).
-	 LZMA_FINISH_ANY - Decode just destLen bytes.
-	 LZMA_FINISH_END - Stream must be finished after (*destLen).
-                           You can use LZMA_FINISH_END, when you know that 
-                           current output buffer covers last bytes of stream. 
-    alloc    - Memory allocator.
-
-  Out: 
-    destLen  - processed output size 
-    srcLen   - processed input size 
-
-  Output:
-    SZ_OK
-      status:
-        LZMA_STATUS_FINISHED_WITH_MARK
-        LZMA_STATUS_NOT_FINISHED 
-        LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
-    SZ_ERROR_DATA - Data error
-    SZ_ERROR_MEM  - Memory allocation error
-    SZ_ERROR_UNSUPPORTED - Unsupported properties
-    SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
-
-  If LZMA decoder sees end_marker before reaching output limit, it returns OK result,
-  and output value of destLen will be less than output buffer size limit.
-
-  You can use multiple checks to test data integrity after full decompression:
-    1) Check Result and "status" variable.
-    2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize.
-    3) Check that output(srcLen) = compressedSize, if you know real compressedSize. 
-       You must use correct finish mode in that case. */ 
-
-
-Multi-call State Decompressing (zlib-like interface)
-----------------------------------------------------
-
-When to use: file->file decompressing 
-Compile files: LzmaDec.h + LzmaDec.c + Types.h
-
-Memory Requirements:
- - Buffer for input stream: any size (for example, 16 KB)
- - Buffer for output stream: any size (for example, 16 KB)
- - LZMA Internal Structures: state_size (16 KB for default settings) 
- - LZMA dictionary (dictionary size is encoded in LZMA properties header)
-
-1) read LZMA properties (5 bytes) and uncompressed size (8 bytes, little-endian) to header:
-   unsigned char header[LZMA_PROPS_SIZE + 8];
-   ReadFile(inFile, header, sizeof(header)
-
-2) Allocate CLzmaDec structures (state + dictionary) using LZMA properties
-
-  CLzmaDec state;
-  LzmaDec_Constr(&state);
-  res = LzmaDec_Allocate(&state, header, LZMA_PROPS_SIZE, &g_Alloc);
-  if (res != SZ_OK)
-    return res;
-
-3) Init LzmaDec structure before any new LZMA stream. And call LzmaDec_DecodeToBuf in loop
-
-  LzmaDec_Init(&state);
-  for (;;)
-  {
-    ... 
-    int res = LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, 
-    	const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode);
-    ...
-  }
-
-
-4) Free all allocated structures
-  LzmaDec_Free(&state, &g_Alloc);
-
-For full code example, look at C/LzmaUtil/LzmaUtil.c code.
-
-
-How To compress data
---------------------
-
-Compile files: LzmaEnc.h + LzmaEnc.c + Types.h +
-LzFind.c + LzFind.h + LzFindMt.c + LzFindMt.h + LzHash.h
-
-Memory Requirements:
-  - (dictSize * 11.5 + 6 MB) + state_size
-
-Lzma Encoder can use two memory allocators:
-1) alloc - for small arrays.
-2) allocBig - for big arrays.
-
-For example, you can use Large RAM Pages (2 MB) in allocBig allocator for 
-better compression speed. Note that Windows has bad implementation for 
-Large RAM Pages. 
-It's OK to use same allocator for alloc and allocBig.
-
-
-Single-call Compression with callbacks
---------------------------------------
-
-Check C/LzmaUtil/LzmaUtil.c as example, 
-
-When to use: file->file decompressing 
-
-1) you must implement callback structures for interfaces:
-ISeqInStream
-ISeqOutStream
-ICompressProgress
-ISzAlloc
-
-static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); }
-static void SzFree(void *p, void *address) {  p = p; MyFree(address); }
-static ISzAlloc g_Alloc = { SzAlloc, SzFree };
-
-  CFileSeqInStream inStream;
-  CFileSeqOutStream outStream;
-
-  inStream.funcTable.Read = MyRead;
-  inStream.file = inFile;
-  outStream.funcTable.Write = MyWrite;
-  outStream.file = outFile;
-
-
-2) Create CLzmaEncHandle object;
-
-  CLzmaEncHandle enc;
-
-  enc = LzmaEnc_Create(&g_Alloc);
-  if (enc == 0)
-    return SZ_ERROR_MEM;
-
-
-3) initialize CLzmaEncProps properties;
-
-  LzmaEncProps_Init(&props);
-
-  Then you can change some properties in that structure.
-
-4) Send LZMA properties to LZMA Encoder
-
-  res = LzmaEnc_SetProps(enc, &props);
-
-5) Write encoded properties to header
-
-    Byte header[LZMA_PROPS_SIZE + 8];
-    size_t headerSize = LZMA_PROPS_SIZE;
-    UInt64 fileSize;
-    int i;
-
-    res = LzmaEnc_WriteProperties(enc, header, &headerSize);
-    fileSize = MyGetFileLength(inFile);
-    for (i = 0; i < 8; i++)
-      header[headerSize++] = (Byte)(fileSize >> (8 * i));
-    MyWriteFileAndCheck(outFile, header, headerSize)
-
-6) Call encoding function:
-      res = LzmaEnc_Encode(enc, &outStream.funcTable, &inStream.funcTable, 
-        NULL, &g_Alloc, &g_Alloc);
-
-7) Destroy LZMA Encoder Object
-  LzmaEnc_Destroy(enc, &g_Alloc, &g_Alloc);
-
-
-If callback function return some error code, LzmaEnc_Encode also returns that code.
-
-
-Single-call RAM->RAM Compression
---------------------------------
-
-Single-call RAM->RAM Compression is similar to Compression with callbacks,
-but you provide pointers to buffers instead of pointers to stream callbacks:
-
-HRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
-    CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, 
-    ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
-
-Return code:
-  SZ_OK               - OK
-  SZ_ERROR_MEM        - Memory allocation error 
-  SZ_ERROR_PARAM      - Incorrect paramater
-  SZ_ERROR_OUTPUT_EOF - output buffer overflow
-  SZ_ERROR_THREAD     - errors in multithreading functions (only for Mt version)
-
-
-
-LZMA Defines
-------------
-
-_LZMA_SIZE_OPT - Enable some optimizations in LZMA Decoder to get smaller executable code.
-
-_LZMA_PROB32   - It can increase the speed on some 32-bit CPUs, but memory usage for 
-                 some structures will be doubled in that case.
-
-_LZMA_UINT32_IS_ULONG  - Define it if int is 16-bit on your compiler and long is 32-bit.
-
-_LZMA_NO_SYSTEM_SIZE_T  - Define it if you don't want to use size_t type.
-
-
-C++ LZMA Encoder/Decoder 
-~~~~~~~~~~~~~~~~~~~~~~~~
-C++ LZMA code use COM-like interfaces. So if you want to use it, 
-you can study basics of COM/OLE.
-C++ LZMA code is just wrapper over ANSI-C code.
-
-
-C++ Notes
-~~~~~~~~~~~~~~~~~~~~~~~~
-If you use some C++ code folders in 7-Zip (for example, C++ code for .7z handling),
-you must check that you correctly work with "new" operator.
-7-Zip can be compiled with MSVC 6.0 that doesn't throw "exception" from "new" operator.
-So 7-Zip uses "CPP\Common\NewHandler.cpp" that redefines "new" operator:
-operator new(size_t size)
-{
-  void *p = ::malloc(size);
-  if (p == 0)
-    throw CNewException();
-  return p;
-}
-If you use MSCV that throws exception for "new" operator, you can compile without 
-"NewHandler.cpp". So standard exception will be used. Actually some code of 
-7-Zip catches any exception in internal code and converts it to HRESULT code.
-So you don't need to catch CNewException, if you call COM interfaces of 7-Zip.
-
----
-
-http://www.7-zip.org
-http://www.7-zip.org/sdk.html
-http://www.7-zip.org/support.html
diff --git a/third_party/minicrt/_hello.cc b/third_party/minicrt/_hello.cc
deleted file mode 100644
index df522ca..0000000
--- a/third_party/minicrt/_hello.cc
+++ /dev/null
@@ -1,11 +0,0 @@
-//==========================================
-// LIBCTINY - Matt Pietrek 2001
-// MSDN Magazine, January 2001
-//==========================================
-#include <stdio.h>
-
-void main() {
-// SKIP_LOC_BEGIN
-  printf("Hello World!\n" );
-// SKIP_LOC_END
-}
diff --git a/third_party/minicrt/_libctiny.mak b/third_party/minicrt/_libctiny.mak
deleted file mode 100644
index b1ef935..0000000
--- a/third_party/minicrt/_libctiny.mak
+++ /dev/null
@@ -1,34 +0,0 @@
-#==================================================
-# LIBCTINY - Matt Pietrek 1996
-# Microsoft Systems Journal, October 1996
-# FILE: LIBCTINY.MAK - Makefile for Microsoft version
-#==================================================
-CC = CL
-CC_OPTIONS = /c /W3 /DWIN32_LEAN_AND_MEAN /Gy /GR- /GX- /GF
-
-S=.
-!ifdef DEBUG
-CC_OPTIONS = $(CC_OPTIONS) /Zi
-O=Debug
-!else
-CC_OPTIONS = $(CC_OPTIONS) /Zi /Ogisyb2
-O=Release
-!endif
-
-PROJ = LIBCTINY
-
-OBJS =  $O\CRT0TCON.OBJ $O\CRT0TWIN.OBJ $O\DLLCRT0.OBJ $O\ARGCARGV.OBJ $O\PRINTF.OBJ \
-        $O\SPRINTF.OBJ $O\PUTS.OBJ $O\ALLOC.OBJ $O\ALLOC2.OBJ $O\ALLOCSUP.OBJ $O\STRUPLWR.OBJ \
-        $O\ISCTYPE.OBJ $O\ATOL.OBJ $O\STRICMP.OBJ $O\NEWDEL.OBJ $O\INITTERM.OBJ
-
-all: $O $O\$(PROJ).LIB
-
-$O: ; mkdir $O
-
-$O\$(PROJ).LIB: {$O}$(OBJS)
-    LIB /OUT:$O\$(PROJ).LIB $(OBJS)
-
-{$S}.CPP{$O}.OBJ::
-    $(CC) $(CC_OPTIONS) -Fo$O\ -Fd$O\ $<
-    
-{$O}$(OBJS):
diff --git a/third_party/minicrt/alloc.cc b/third_party/minicrt/alloc.cc
deleted file mode 100644
index a90271f..0000000
--- a/third_party/minicrt/alloc.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-//==========================================
-// LIBCTINY - Matt Pietrek 2001
-// MSDN Magazine, January 2001
-//==========================================
-#include "libctiny.h"
-#include <windows.h>
-#include <malloc.h>
-
-extern "C"
-#if _MSC_VER >= 1400
-__declspec(noalias restrict)
-#endif
-void * __cdecl malloc(size_t size) {
-    return HeapAlloc( GetProcessHeap(), 0, size );
-}
-
-extern "C"
-#if _MSC_VER >= 1400
-__declspec(noalias)
-#endif
-void __cdecl free(void * p) {
-    HeapFree( GetProcessHeap(), 0, p );
-}
diff --git a/third_party/minicrt/alloc2.cc b/third_party/minicrt/alloc2.cc
deleted file mode 100644
index 92c954e..0000000
--- a/third_party/minicrt/alloc2.cc
+++ /dev/null
@@ -1,35 +0,0 @@
-//==========================================
-// LIBCTINY - Matt Pietrek 2001
-// MSDN Magazine, January 2001
-//==========================================
-#include "libctiny.h"
-#include <windows.h>
-#include <malloc.h>
-
-extern "C"
-#if _MSC_VER >= 1400
-__declspec(noalias restrict)
-#endif
-void * __cdecl realloc(void * p, size_t size) {
-    if (p)
-        return HeapReAlloc( GetProcessHeap(), 0, p, size );
-    else    // 'p' is 0, and HeapReAlloc doesn't act like realloc() here
-        return HeapAlloc( GetProcessHeap(), 0, size );
-}
-
-extern "C"
-#if _MSC_VER >= 1400
-__declspec(noalias restrict)
-#endif
-void * __cdecl calloc(size_t nitems, size_t size) {
-    return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, nitems * size );
-}
-
-extern "C"
-#if _MSC_VER >= 1400
-  __declspec(noalias restrict)
-#endif
-void * __cdecl _recalloc(void * p, size_t nitems, size_t size) {
-    return realloc(p, nitems * size);
-}
-
diff --git a/third_party/minicrt/alloca16.obj b/third_party/minicrt/alloca16.obj
deleted file mode 100644
index 73f042b..0000000
--- a/third_party/minicrt/alloca16.obj
+++ /dev/null
Binary files differ
diff --git a/third_party/minicrt/allocsup.cc b/third_party/minicrt/allocsup.cc
deleted file mode 100644
index ca03268..0000000
--- a/third_party/minicrt/allocsup.cc
+++ /dev/null
@@ -1,15 +0,0 @@
-//==========================================
-// LIBCTINY - Matt Pietrek 2001
-// MSDN Magazine, January 2001
-//==========================================
-#include "libctiny.h"
-#include <windows.h>
-#include <malloc.h>
-
-extern "C" void * __cdecl _nh_malloc(size_t size, int) {
-    return HeapAlloc( GetProcessHeap(), 0, size );
-}
-
-extern "C" size_t __cdecl _msize(void * p) {
-    return HeapSize( GetProcessHeap(), 0, p );
-}
diff --git a/third_party/minicrt/argcargv.cc b/third_party/minicrt/argcargv.cc
deleted file mode 100644
index 851f8cb..0000000
--- a/third_party/minicrt/argcargv.cc
+++ /dev/null
@@ -1,112 +0,0 @@
-//==========================================
-// LIBCTINY - Matt Pietrek 2001
-// MSDN Magazine, January 2001
-//==========================================
-#include "libctiny.h"
-#include <windows.h>
-#include "argcargv.h"
-
-#define _MAX_CMD_LINE_ARGS  128
-
-char * _ppszArgv[_MAX_CMD_LINE_ARGS+1];
-
-int __cdecl _ConvertCommandLineToArgcArgv() {
-    int cbCmdLine;
-    int argc;
-    PSTR pszSysCmdLine, pszCmdLine;
-    
-    // Set to no argv elements, in case we have to bail out
-    _ppszArgv[0] = 0;
-
-    // First get a pointer to the system's version of the command line, and
-    // figure out how long it is.
-    pszSysCmdLine = GetCommandLine();
-    cbCmdLine = lstrlen( pszSysCmdLine );
-
-    // Allocate memory to store a copy of the command line.  We'll modify
-    // this copy, rather than the original command line.  Yes, this memory
-    // currently doesn't explicitly get freed, but it goes away when the
-    // process terminates.
-    pszCmdLine = (PSTR)HeapAlloc( GetProcessHeap(), 0, cbCmdLine+1 );
-    if (!pszCmdLine)
-        return 0;
-
-    // Copy the system version of the command line into our copy
-    lstrcpyn( pszCmdLine, pszSysCmdLine , cbCmdLine+1);
-
-    if ('"' == *pszCmdLine)   // If command line starts with a quote ("),
-    {                           // it's a quoted filename.  Skip to next quote.
-        pszCmdLine++;
-    
-        _ppszArgv[0] = pszCmdLine;  // argv[0] == executable name
-    
-        while (*pszCmdLine && (*pszCmdLine != '"'))
-            pszCmdLine++;
-
-        if (*pszCmdLine)      // Did we see a non-NULL ending?
-            *pszCmdLine++ = 0;  // Null terminate and advance to next char
-        else
-            return 0;           // Oops!  We didn't see the end quote
-    }
-    else    // A regular (non-quoted) filename
-    {
-        _ppszArgv[0] = pszCmdLine;  // argv[0] == executable name
-
-        while (*pszCmdLine && (' ' != *pszCmdLine) && ('\t' != *pszCmdLine))
-            pszCmdLine++;
-
-        if (*pszCmdLine)
-            *pszCmdLine++ = 0;  // Null terminate and advance to next char
-    }
-
-    // Done processing argv[0] (i.e., the executable name).  Now do th
-    // actual arguments
-
-    argc = 1;
-
-    while (1)
-    {
-        // Skip over any whitespace
-        while (*pszCmdLine && (' ' == *pszCmdLine) || ('\t' == *pszCmdLine))
-            pszCmdLine++;
-
-        if (0 == *pszCmdLine) // End of command line???
-            return argc;
-
-        if ('"' == *pszCmdLine)   // Argument starting with a quote???
-        {
-            pszCmdLine++;   // Advance past quote character
-
-            _ppszArgv[ argc++ ] = pszCmdLine;
-            _ppszArgv[ argc ] = 0;
-
-            // Scan to end quote, or NULL terminator
-            while (*pszCmdLine && (*pszCmdLine != '"'))
-                pszCmdLine++;
-                
-            if (0 == *pszCmdLine)
-                return argc;
-            
-            if (*pszCmdLine)
-                *pszCmdLine++ = 0;  // Null terminate and advance to next char
-        }
-        else                        // Non-quoted argument
-        {
-            _ppszArgv[ argc++ ] = pszCmdLine;
-            _ppszArgv[ argc ] = 0;
-
-            // Skip till whitespace or NULL terminator
-            while (*pszCmdLine && (' '!=*pszCmdLine) && ('\t'!=*pszCmdLine))
-                pszCmdLine++;
-            
-            if (0 == *pszCmdLine)
-                return argc;
-            
-            if (*pszCmdLine)
-                *pszCmdLine++ = 0;  // Null terminate and advance to next char
-        }
-
-        if (argc >= (_MAX_CMD_LINE_ARGS))
-            return argc;
-    }
-}
diff --git a/third_party/minicrt/argcargv.h b/third_party/minicrt/argcargv.h
deleted file mode 100644
index f62930b..0000000
--- a/third_party/minicrt/argcargv.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef TR_COMMON_MINICRT_ARGCARGV_H_
-#define TR_COMMON_MINICRT_ARGCARGV_H_
-
-#include "libctiny.h"
-
-extern char * _ppszArgv[];
-
-int __cdecl _ConvertCommandLineToArgcArgv();
-
-#endif  // TR_COMMON_MINICRT_ARGCARGV_H_
diff --git a/third_party/minicrt/bsearch.c b/third_party/minicrt/bsearch.c
deleted file mode 100644
index 1f80d8c..0000000
--- a/third_party/minicrt/bsearch.c
+++ /dev/null
@@ -1,80 +0,0 @@
-#include "libctiny.h"
-#include <windows.h>
-
-/***
-*bsearch.c - do a binary search
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       defines bsearch() - do a binary search an an array
-*
-*******************************************************************************/
-
-// #include <cruntime.h>
-// #include <stdlib.h>
-// #include <search.h>
-
-/***
-*char *bsearch() - do a binary search on an array
-*
-*Purpose:
-*       Does a binary search of a sorted array for a key.
-*
-*Entry:
-*       const char *key    - key to search for
-*       const char *base   - base of sorted array to search
-*       unsigned int num   - number of elements in array
-*       unsigned int width - number of bytes per element
-*       int (*compare)()   - pointer to function that compares two array
-*               elements, returning neg when #1 < #2, pos when #1 > #2, and
-*               0 when they are equal. Function is passed pointers to two
-*               array elements.
-*
-*Exit:
-*       if key is found:
-*               returns pointer to occurrence of key in array
-*       if key is not found:
-*               returns NULL
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-void * __cdecl bsearch (
-        const void *key,
-        const void *base,
-        size_t num,
-        size_t width,
-        int (__cdecl *compare)(const void *, const void *)
-        )
-{
-        register char *lo = (char *)base;
-        register char *hi = (char *)base + (num - 1) * width;
-        register char *mid;
-        size_t half;
-        int result;
-
-        while (lo <= hi)
-                if (half = num / 2)
-                {
-                        mid = lo + (num & 1 ? half : (half - 1)) * width;
-                        if (!(result = (*compare)(key,mid)))
-                                return(mid);
-                        else if (result < 0)
-                        {
-                                hi = mid - width;
-                                num = num & 1 ? half : half-1;
-                        }
-                        else    {
-                                lo = mid + width;
-                                num = half;
-                        }
-                }
-                else if (num)
-                        return((*compare)(key,lo) ? NULL : lo);
-                else
-                        break;
-
-        return(NULL);
-}
diff --git a/third_party/minicrt/build.scons b/third_party/minicrt/build.scons
deleted file mode 100644
index 0415b71..0000000
--- a/third_party/minicrt/build.scons
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-
-local_env = env.Clone()
-local_env.Append(
-    CCFLAGS = [
-        '/wd4287',  # unsigned/negative constant mismatch
-        '/wd4706',  # assignment within conditional expression
-        ],
-    CPPDEFINES = [
-        '_MBCS'
-        ],
-)
-
-# Disable runtime error checking.
-local_env.FilterOut(CCFLAGS = ['/RTC1'])
-
-_inputs = [
-    'alloc.cc',
-    'alloc2.cc',
-    #'allocsup.cc',
-    #'argcargv.cc',
-    #'bsearch.c',
-    #'charmax.c',
-    #'crt0tcon.cc',
-    'crt0twin.cc',
-    #'dllcrt0.cc',
-    #'fullpath.cc',
-    'initterm.cc',
-    #'isctype.cc',
-    'memory.cc',
-    'newdel.cc',
-    'pesect.c',
-    #'puts.cc',
-    'resetstk.c',
-    'security.cc',
-    #'stricmp.cc',
-    'string.c',
-    #'struplwr.cc',
-
-    'alloca16.obj',
-    'chandler4.obj',
-
-    # Structured exception handling.
-    'sehprolg.obj',
-    'sehprolg4.obj',
-    'sehprolg4gs.obj',
-
-    # Exception handlers.
-    'exsup4.obj',
-    'exsup3.obj',
-    'exsup.obj',
-    'eh3valid.obj',
-    'ulldiv.obj',
-    'llmul.obj',
-    'ftol2.obj',
-    'chkstk.obj',
-    'dllsupp.obj',
-    'ullshr.obj',
-    'lldvrm.obj',
-    'ulldvrm.obj',
-    'llshl.obj',
-    'ullrem.obj',
-    'lldiv.obj',
-    'llrem.obj',
-    'llshr.obj',
-    ]
-
-# Build these into a static library.
-local_env.ComponentLibrary('minicrt', _inputs)
diff --git a/third_party/minicrt/chandler4.obj b/third_party/minicrt/chandler4.obj
deleted file mode 100644
index 42960dd..0000000
--- a/third_party/minicrt/chandler4.obj
+++ /dev/null
Binary files differ
diff --git a/third_party/minicrt/charmax.c b/third_party/minicrt/charmax.c
deleted file mode 100644
index f725280..0000000
--- a/third_party/minicrt/charmax.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/***
-*charmax.c - definition of _charmax variable
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       defines _charmax
-*
-*       According to ANSI, certain elements of the lconv structure must be
-*       initialized to CHAR_MAX and the value of CHAR_MAX changes when
-*       the user compiles -J.  To reflect this change in the lconv structure,
-*       we initialize the structure to SCHAR_MAX, and when any of the users
-*       modules are compiled -J, the structure is updated.
-*
-*       Note that this is not done for DLLs linked to the CRT DLL, because
-*       we do not want such DLLs to override the -J setting for an EXE
-*       linked to the CRT DLL.  See comments in crtexe.c.
-*
-*       Files involved:
-*
-*       locale.h - if -J, generates an unresolved external to _charmax
-*       charmax.c - defines _charmax and sets to UCHAR_MAX (255), places
-*               _lconv_init in startup initializer table if pulled in by -J
-*       lconv.c - initializes lconv structure to SCHAR_MAX (127),
-*               since libraries built without -J
-*       lcnvinit.c - sets lconv members to 25.
-**
-*******************************************************************************/
-
-#ifdef _MSC_VER
-
-//#include <sect_attribs.h>
-//#include <internal.h>
-
-//int __lconv_init(void);
-
-int _charmax = 255;
-
-//_CRTALLOC(".CRT$XIC") static _PIFV pinit = __lconv_init;
-
-#endif  /* _MSC_VER */
diff --git a/third_party/minicrt/chkstk.obj b/third_party/minicrt/chkstk.obj
deleted file mode 100644
index e9956a6..0000000
--- a/third_party/minicrt/chkstk.obj
+++ /dev/null
Binary files differ
diff --git a/third_party/minicrt/crt0tcon.cc b/third_party/minicrt/crt0tcon.cc
deleted file mode 100644
index a7cd842..0000000
--- a/third_party/minicrt/crt0tcon.cc
+++ /dev/null
@@ -1,45 +0,0 @@
-//==========================================
-// LIBCTINY - Matt Pietrek 2001
-// MSDN Magazine, January 2001
-// FILE: CRT0TCON.CPP
-//==========================================
-#include "libctiny.h"
-#include <windows.h>
-#include "argcargv.h"
-#include "initterm.h"
-
-// Force the linker to include KERNEL32.LIB
-#pragma comment(linker, "/defaultlib:kernel32.lib")
-
-//#pragma comment(linker, "/nodefaultlib:libc.lib")
-//#pragma comment(linker, "/nodefaultlib:libcmt.lib")
-
-extern "C" int __cdecl main(int, char **, char **);    // In user's code
-
-extern "C" void DoInitialization();
-extern "C" void DoCleanup();
-
-//
-// Modified version of the Visual C++ startup code.  Simplified to
-// make it easier to read.  Only supports ANSI programs.
-//
-extern "C" void __cdecl mainCRTStartup() {
-    int mainret, argc;
-
-    argc = _ConvertCommandLineToArgcArgv( );
-
-    // set up our minimal cheezy atexit table
-    _atexit_init();
-
-    // Call C++ constructors
-    _initterm( __xc_a, __xc_z );
-
-    // DoInitialization();
-
-    mainret = main( argc, _ppszArgv, 0 );
-
-    _DoExit();
-    // DoCleanup();
-
-    ExitProcess(mainret);
-}
diff --git a/third_party/minicrt/crt0twin.cc b/third_party/minicrt/crt0twin.cc
deleted file mode 100644
index 068be70..0000000
--- a/third_party/minicrt/crt0twin.cc
+++ /dev/null
@@ -1,75 +0,0 @@
-//==========================================
-// LIBCTINY - Matt Pietrek 2001
-// MSDN Magazine, January 2001
-// FILE: CRT0TWIN.CPP
-//==========================================
-#include "libctiny.h"
-#include <windows.h>
-#include "initterm.h"
-
-// Force the linker to include KERNEL32.LIB
-#pragma comment(linker, "/defaultlib:kernel32.lib")
-
-#pragma comment(linker, "/nodefaultlib:libc.lib")
-#pragma comment(linker, "/nodefaultlib:libcmt.lib")
-
-// Modified version of the Visual C++ startup code.  Simplified to
-// make it easier to read.
-
-extern int WINAPI WinMain(HINSTANCE hinstExe, HINSTANCE hinstPrev,
-                   LPSTR pszCmdLine, int nCmdShow);
-
-extern "C" void __cdecl WinMainCRTStartup() {
-    int mainret;
-    char *lpszCommandLine;
-    STARTUPINFO StartupInfo;
-
-    lpszCommandLine = GetCommandLine();
-
-    // Skip past program name (first token in command line).
-
-    if (*lpszCommandLine == '"')  // Check for and handle quoted program name
-    {
-        lpszCommandLine++;  // Get past the first quote
-
-        // Now, scan, and skip over, subsequent characters until  another
-        // double-quote or a null is encountered
-        while (*lpszCommandLine && (*lpszCommandLine != '"'))
-            lpszCommandLine++;
-
-        // If we stopped on a double-quote (usual case), skip over it.
-
-        if (*lpszCommandLine == '"')
-            lpszCommandLine++;
-    }
-    else    // First token wasn't a quote
-    {
-        while (*lpszCommandLine > ' ')
-            lpszCommandLine++;
-    }
-
-    // Skip past any white space preceeding the second token.
-
-    while (*lpszCommandLine && (*lpszCommandLine <= ' '))
-        lpszCommandLine++;
-
-    StartupInfo.dwFlags = 0;
-    GetStartupInfo( &StartupInfo );
-
-    // set up our minimal cheezy atexit table
-    _atexit_init();
-
-    // Call C++ constructors
-    _initterm( __xc_a, __xc_z );
-
-    mainret = WinMain( GetModuleHandle(NULL),
-                       NULL,
-                       lpszCommandLine,
-                       StartupInfo.dwFlags & STARTF_USESHOWWINDOW
-                            ? StartupInfo.wShowWindow : SW_SHOWDEFAULT );
-
-    _DoExit();
-
-    ExitProcess(mainret);
-}
-
diff --git a/third_party/minicrt/dllcrt0.cc b/third_party/minicrt/dllcrt0.cc
deleted file mode 100644
index 6c5f140..0000000
--- a/third_party/minicrt/dllcrt0.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-//==========================================
-// LIBCTINY - Matt Pietrek 2001
-// MSDN Magazine, January 2001
-// FILE: DLLCRT0.CPP
-//==========================================
-#include "libctiny.h"
-#include <windows.h>
-#include "initterm.h"
-
-// Force the linker to include KERNEL32.LIB
-#pragma comment(linker, "/defaultlib:kernel32.lib")
-
-// #pragma comment(linker, "/nodefaultlib:libc.lib")
-// #pragma comment(linker, "/nodefaultlib:libcmt.lib")
-
-// User routine DllMain is called on all notifications
-
-extern BOOL WINAPI DllMain(
-        HANDLE  hDllHandle,
-        DWORD   dwReason,
-        LPVOID  lpreserved
-        ) ;
-
-extern "C" void DoInitialization();
-extern "C" void DoCleanup();
-
-//
-// Modified version of the Visual C++ startup code.  Simplified to
-// make it easier to read.  Only supports ANSI programs.
-//
-extern "C"
-BOOL WINAPI _DllMainCRTStartup(
-        HANDLE  hDllHandle,
-        DWORD   dwReason,
-        LPVOID  lpreserved
-        ) {
-    if (dwReason == DLL_PROCESS_ATTACH)
-    {
-        // set up our minimal cheezy atexit table
-        _atexit_init();
-
-        // Call C++ constructors
-        _initterm( __xc_a, __xc_z );
-
-        // DoInitialization();
-    }
-
-    BOOL retcode = DllMain(hDllHandle, dwReason, lpreserved);
-
-    if (dwReason == DLL_PROCESS_DETACH)
-    {
-        _DoExit();
-        // DoCleanup();
-    }
-
-    return retcode ;
-}
diff --git a/third_party/minicrt/dllsupp.obj b/third_party/minicrt/dllsupp.obj
deleted file mode 100644
index 0dd0c35..0000000
--- a/third_party/minicrt/dllsupp.obj
+++ /dev/null
Binary files differ
diff --git a/third_party/minicrt/eh3valid.obj b/third_party/minicrt/eh3valid.obj
deleted file mode 100644
index 3b473bf..0000000
--- a/third_party/minicrt/eh3valid.obj
+++ /dev/null
Binary files differ
diff --git a/third_party/minicrt/exsup.obj b/third_party/minicrt/exsup.obj
deleted file mode 100644
index b39ed68..0000000
--- a/third_party/minicrt/exsup.obj
+++ /dev/null
Binary files differ
diff --git a/third_party/minicrt/exsup3.obj b/third_party/minicrt/exsup3.obj
deleted file mode 100644
index 41cf4f9..0000000
--- a/third_party/minicrt/exsup3.obj
+++ /dev/null
Binary files differ
diff --git a/third_party/minicrt/exsup4.obj b/third_party/minicrt/exsup4.obj
deleted file mode 100644
index 1a99d6c..0000000
--- a/third_party/minicrt/exsup4.obj
+++ /dev/null
Binary files differ
diff --git a/third_party/minicrt/ftol2.obj b/third_party/minicrt/ftol2.obj
deleted file mode 100644
index ab6304e..0000000
--- a/third_party/minicrt/ftol2.obj
+++ /dev/null
Binary files differ
diff --git a/third_party/minicrt/fullpath.cc b/third_party/minicrt/fullpath.cc
deleted file mode 100644
index 1672492..0000000
--- a/third_party/minicrt/fullpath.cc
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*_TSCHAR *_fullpath( _TSCHAR *buf, const _TSCHAR *path, maxlen );
-*
-*Purpose:
-*
-*       _fullpath - combines the current directory with path to form
-*       an absolute path. i.e. _fullpath takes care of .\ and ..\
-*       in the path.
-*
-*       The result is placed in buf. If the length of the result
-*       is greater than maxlen NULL is returned, otherwise
-*       the address of buf is returned.
-*
-*       If buf is NULL then a buffer is malloc'ed and maxlen is
-*       ignored. If there are no errors then the address of this
-*       buffer is returned.
-*
-*       If path specifies a drive, the curent directory of this
-*       drive is combined with path. If the drive is not valid
-*       and _fullpath needs the current directory of this drive
-*       then NULL is returned.  If the current directory of this
-*       non existant drive is not needed then a proper value is
-*       returned.
-*       For example:  path = "z:\\pop" does not need z:'s current
-*       directory but path = "z:pop" does.
-*
-*
-*
-*Entry:
-*       _TSCHAR *buf  - pointer to a buffer maintained by the user;
-*       _TSCHAR *path - path to "add" to the current directory
-*       int maxlen - length of the buffer pointed to by buf
-*
-*Exit:
-*       Returns pointer to the buffer containing the absolute path
-*       (same as buf if non-NULL; otherwise, malloc is
-*       used to allocate a buffer)
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-#include <tchar.h>
-#include <malloc.h>
-#include <stdlib.h>
-#include <windows.h>
-
-
-_TSCHAR * __cdecl _tfullpath(_TSCHAR *UserBuf, const _TSCHAR *path, size_t maxlen) {
-        _TSCHAR *buf;
-        _TSCHAR *pfname;
-        unsigned long count;
-
-        // don't handle this case to reduce dependancies, add this later if required
-        if (!path || !*path)  /* no work to do */
-            // return( _tgetcwd( UserBuf, (int)maxlen ) );
-            return( NULL );
-
-        /* allocate buffer if necessary */
-
-        if (!UserBuf)
-            if (!(buf = reinterpret_cast<_TSCHAR*>(malloc(_MAX_PATH * sizeof(_TSCHAR))))) {
-                // errno = ENOMEM;
-                return( NULL );
-            }
-            else
-                maxlen = _MAX_PATH;
-        else
-            buf = UserBuf;
-
-        count = GetFullPathName( path,
-                                  (int)maxlen,
-                                  buf,
-                                  &pfname );
-
-        if (count >= maxlen) {
-            if (!UserBuf)
-                free(buf);
-            // errno = ERANGE;
-            return( NULL );
-        }
-        else if (count == 0) {
-            if (!UserBuf)
-                free(buf);
-            // _dosmaperr( GetLastError() );
-            return( NULL );
-        }
-
-        return( buf );
-
-}
diff --git a/third_party/minicrt/initterm.cc b/third_party/minicrt/initterm.cc
deleted file mode 100644
index 9cb2250..0000000
--- a/third_party/minicrt/initterm.cc
+++ /dev/null
@@ -1,230 +0,0 @@
-//==========================================
-// LIBCTINY - Matt Pietrek 2001
-// MSDN Magazine, January 2001
-// ==========================================
-
-#include "libctiny.h"
-#include <windows.h>
-#include <malloc.h>
-#include "initterm.h"
-
-#pragma data_seg(".CRT$XCA")
-_PVFV __xc_a[] = { NULL };
-#pragma data_seg(".CRT$XCZ")
-_PVFV __xc_z[] = { NULL };
-
-/*
-#pragma data_seg(".CRT$XIA")
-_PVFV __xi_a[] = { NULL };
-#pragma data_seg(".CRT$XIZ")
-_PVFV __xi_z[] = { NULL };
-
-#pragma data_seg(".CRT$XTA")
-_PVFV __xt_a[] = { NULL };
-#pragma data_seg(".CRT$XTZ")
-_PVFV __xt_z[] = { NULL };
-
-#pragma data_seg(".CRT$XPA")
-_PVFV __xp_a[] = { NULL };
-#pragma data_seg(".CRT$XPZ")
-_PVFV __xp_z[] = { NULL };
-*/
-
-#pragma data_seg()  /* reset */
-
-#pragma comment(linker, "/merge:.CRT=.data")
-
-typedef void (__cdecl *_PVFV)();
-
-void __cdecl _initterm(
-        _PVFV * pfbegin,
-        _PVFV * pfend
-        ) {
-    // walk the table of function pointers from the bottom up, until
-    // the end is encountered.  Do not skip the first entry.  The initial
-    // value of pfbegin points to the first valid entry.  Do not try to
-    // execute what pfend points to.  Only entries before pfend are valid.
-    while (pfbegin < pfend)
-    {
-        // if current table entry is non-NULL, call thru it.
-        if (*pfbegin != NULL)
-            (**pfbegin)();
-        ++pfbegin;
-    }
-}
-
-static _PVFV * pf_atexitlist = 0;
-static unsigned max_atexitlist_entries = 0;
-static unsigned cur_atexitlist_entries = 0;
-
-void __cdecl _atexit_init() {
-    max_atexitlist_entries = 32;
-    pf_atexitlist = (_PVFV *)calloc( max_atexitlist_entries,
-                                     sizeof(_PVFV*) );
-}
-
-int __cdecl atexit(_PVFV func ) {
-    if (cur_atexitlist_entries < max_atexitlist_entries)
-    {
-        pf_atexitlist[cur_atexitlist_entries++] = func; 
-        return 0;
-    }
-
-    return -1;
-}
-
-void __cdecl _DoExit() {
-    if (cur_atexitlist_entries)
-    {
-        _initterm(  pf_atexitlist,
-                    // Use ptr math to find the end of the array
-                    pf_atexitlist + cur_atexitlist_entries );
-    }
-}
-
-// -----------------------------------------------------
-
-/*
-static HANDLE g_hProcessHeap = NULL;
-
-extern "C" _PVFV* __onexitbegin = NULL;
-extern "C" _PVFV* __onexitend = NULL;
-
-extern "C" _PVFV __xi_a[], __xi_z[];    // C initializers 
-extern "C" _PVFV __xc_a[], __xc_z[];    // C++ initializers 
-extern "C" _PVFV __xp_a[], __xp_z[];    // C pre-terminators 
-extern "C" _PVFV __xt_a[], __xt_z[];    // C terminators 
-
-// Critical section to protect initialization/exit code
-static CRITICAL_SECTION g_csInit;
-
-extern "C" void DoInitialization() {
-  _PVFV* pf;
-
-  // memset(&osi, 0, sizeof(OSVERSIONINFO));
-  // osi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-  // GetVersionEx(&osi);
-  // _osplatform = osi.dwPlatformId;
-
-  InitializeCriticalSection( &g_csInit );
-
-  EnterCriticalSection( &g_csInit );
-
-  __try
-  {
-    g_hProcessHeap = GetProcessHeap();
-
-    // Call initialization routines (contructors for globals, etc.)
-    for (pf = __xi_a; pf < __xi_z; pf++)
-    {
-      if (*pf != NULL)
-      {
-        (**pf)();
-      }
-    }
-
-    for (pf = __xc_a; pf < __xc_z; pf++)
-    {
-      if (*pf != NULL)
-      {
-        (**pf)();
-      }
-    }
-  }
-  __finally
-  {
-    LeaveCriticalSection(&g_csInit);
-  }
-}
-
-extern "C" void DoCleanup() {
-  _PVFV* pf;
-
-  EnterCriticalSection(&g_csInit);  // Protect access to the atexit table
-
-  __try
-  {
-    // Call routines registered with atexit() from most recently registered
-    // to least recently registered
-    if (__onexitbegin != NULL)
-    {
-      for (pf = __onexitend-1; pf >= __onexitbegin; pf--)
-      {
-        if (*pf != NULL)
-          (**pf)();
-      }
-    }
-
-    free(__onexitbegin);
-    __onexitbegin = NULL;
-    __onexitend = NULL;
-
-    for (pf = __xp_a; pf < __xp_z; pf++)
-    {
-      if (*pf != NULL)
-      {
-        (**pf)();
-      }
-    }
-
-    for (pf = __xt_a; pf < __xt_z; pf++)
-    {
-      if (*pf != NULL)
-      {
-        (**pf)();
-      }
-    }
-  }
-  __finally
-  {
-    LeaveCriticalSection(&g_csInit);
-    DeleteCriticalSection(&g_csInit);    
-  }
-}
-
-int __cdecl atexit(_PVFV pf) {
-  size_t nCurrentSize;
-  int nRet = 0;  
-
-  EnterCriticalSection(&g_csInit);
-
-  __try
-  {
-    if (__onexitbegin == NULL)
-    {
-      __onexitbegin = (_PVFV*)malloc(16*sizeof(_PVFV));
-      if (__onexitbegin == NULL)
-      {
-        LeaveCriticalSection(&g_csInit);
-        return(-1);
-      }
-      __onexitend = __onexitbegin;
-    }
-
-    nCurrentSize = _msize(__onexitbegin);
-    if ((nCurrentSize+sizeof(_PVFV)) < ULONG(((const byte*)__onexitend-
-      (const byte*)__onexitbegin)))
-    {
-      _PVFV* pNew;
-
-      pNew = (_PVFV*)realloc(__onexitbegin, 2*nCurrentSize);
-      if (pNew == NULL)
-      {
-        LeaveCriticalSection(&g_csInit);    
-        return(-1);
-      }
-    }
-
-    *__onexitend = pf;
-    __onexitend++;
-  }
-  __except (1)
-  {
-    nRet = -1;
-  }
-
-  LeaveCriticalSection(&g_csInit);  
-
-  return(nRet);
-}
-*/
diff --git a/third_party/minicrt/initterm.h b/third_party/minicrt/initterm.h
deleted file mode 100644
index f36543a..0000000
--- a/third_party/minicrt/initterm.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef TR_COMMON_MINICRT_INITTERM_H_
-#define TR_COMMON_MINICRT_INITTERM_H_
-
-#include "libctiny.h"
-
-typedef void (__cdecl *_PVFV)();
-extern _PVFV __xc_a[], __xc_z[];    /* C++ initializers */
-
-void __cdecl _initterm(_PVFV * pfbegin, _PVFV * pfend);
-void __cdecl _atexit_init();
-void __cdecl _DoExit();
-
-#endif  // TR_COMMON_MINICRT_INITTERM_H_
diff --git a/third_party/minicrt/isctype.cc b/third_party/minicrt/isctype.cc
deleted file mode 100644
index 07166e6..0000000
--- a/third_party/minicrt/isctype.cc
+++ /dev/null
@@ -1,16 +0,0 @@
-//==========================================
-// LIBCTINY - Matt Pietrek 2001
-// MSDN Magazine, January 2001
-//==========================================
-#include "libctiny.h"
-#include <ctype.h>
-
-extern "C" int __cdecl _isctype( int c , int mask ) {
-    /* c valid between -1 and 255 */
-    if (((unsigned)(c + 1)) <= 256)
-    {
-        return ( _pctype[c] & mask ) ;
-    }
-    else
-        return 0;
-}
diff --git a/third_party/minicrt/libctiny.h b/third_party/minicrt/libctiny.h
deleted file mode 100644
index 15546af..0000000
--- a/third_party/minicrt/libctiny.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// 
-// Custom include file that I've added to all libctiny source code.
-// Here we handle global settings/overrides (e.g. ensuring Unicode is not defined).
-// 
-
-#ifndef TOTAL_RECALL_COMMON_MINICRT_LIBCTINY_H__
-#define TOTAL_RECALL_COMMON_MINICRT_LIBCTINY_H__
-
-// Make sure WIN32_LEAN_AND_MEAN is defined
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-
-// Make sure Unicode is not defined
-#ifdef UNICODE
-#undef UNICODE
-#endif
-
-#ifdef _UNICODE
-#undef _UNICODE
-#endif
-
-#endif  // TOTAL_RECALL_COMMON_MINICRT_LIBCTINY_H__
diff --git a/third_party/minicrt/lldiv.obj b/third_party/minicrt/lldiv.obj
deleted file mode 100644
index 749941a..0000000
--- a/third_party/minicrt/lldiv.obj
+++ /dev/null
Binary files differ
diff --git a/third_party/minicrt/lldvrm.obj b/third_party/minicrt/lldvrm.obj
deleted file mode 100644
index a25ed75..0000000
--- a/third_party/minicrt/lldvrm.obj
+++ /dev/null
Binary files differ
diff --git a/third_party/minicrt/llmul.obj b/third_party/minicrt/llmul.obj
deleted file mode 100644
index ad73957..0000000
--- a/third_party/minicrt/llmul.obj
+++ /dev/null
Binary files differ
diff --git a/third_party/minicrt/llrem.obj b/third_party/minicrt/llrem.obj
deleted file mode 100644
index b8f6f06..0000000
--- a/third_party/minicrt/llrem.obj
+++ /dev/null
Binary files differ
diff --git a/third_party/minicrt/llshl.obj b/third_party/minicrt/llshl.obj
deleted file mode 100644
index 478eec3..0000000
--- a/third_party/minicrt/llshl.obj
+++ /dev/null
Binary files differ
diff --git a/third_party/minicrt/llshr.obj b/third_party/minicrt/llshr.obj
deleted file mode 100644
index 4572e9d..0000000
--- a/third_party/minicrt/llshr.obj
+++ /dev/null
Binary files differ
diff --git a/third_party/minicrt/memory.cc b/third_party/minicrt/memory.cc
deleted file mode 100644
index 5509bcd..0000000
--- a/third_party/minicrt/memory.cc
+++ /dev/null
@@ -1,100 +0,0 @@
-
-#include "libctiny.h"
-#include <windows.h>
-#include <errno.h>
-#include "memory.h"
-
-// memmove is defined first so it will use the intrinsic memcpy
-void * __cdecl memmove(void * dst, const void * src, size_t count) {
-  void * ret = dst;
-
-  if (dst <= src || (char *)dst >= ((char *)src + count)) {
-    // Non-Overlapping Buffers - copy from lower addresses to higher addresses
-    // saves 500 bytes of 1.4MB in uncompressed setup.exe, worth it?
-    memcpy(dst, src, count);
-    // while (count--) {
-    //     *(char *)dst = *(char *)src;
-    //     dst = (char *)dst + 1;
-    //     src = (char *)src + 1;
-    // }
-  }
-  else {
-    // Overlapping Buffers - copy from higher addresses to lower addresses
-    dst = (char *)dst + count - 1;
-    src = (char *)src + count - 1;
-
-    while (count--) {
-      *(char *)dst = *(char *)src;
-      dst = (char *)dst - 1;
-      src = (char *)src - 1;
-    }
-  }
-
-  return(ret);
-}
-
-// Turn off compiler intrinsics so that we can define these functions
-#pragma function(memcmp, memcpy, memset)
-
-int __cdecl memcmp(const void * buf1, const void * buf2, size_t count) {
-  if (!count)
-    return(0);
-  while (--count && *(char *)buf1 == *(char *)buf2) {
-    buf1 = (char *)buf1 + 1;
-    buf2 = (char *)buf2 + 1;
-  }
-  return( *((unsigned char *)buf1) - *((unsigned char *)buf2) );
-}
-
-void * __cdecl memcpy(void * dst, const void * src, size_t count) {
-  void * ret = dst;
-  // copy from lower addresses to higher addresses
-  while (count--) {
-    *(char *)dst = *(char *)src;
-    dst = (char *)dst + 1;
-    src = (char *)src + 1;
-  }
-  return(ret);
-}
-
-void * __cdecl memset(void *dst, int val, size_t count) {
-  void *start = dst;
-  while (count--) {
-    *(char *)dst = (char)val;
-    dst = (char *)dst + 1;
-  }
-  return(start);
-}
-
-errno_t __cdecl memmove_s(void* dst,
-                          size_t size_in_bytes,
-                          const void* src,
-                          size_t count) {
-  if (count == 0) {
-      return 0;
-  }
-
-  if (!dst) return EINVAL;
-  if (!src) return EINVAL;
-  if (size_in_bytes < count) return ERANGE;
-
-  memmove(dst, src, count);
-  return 0;
-}
-
-errno_t __cdecl memcpy_s(void *dst,
-                         size_t size_in_bytes,
-                         const void *src,
-                         size_t count) {
-  if (count == 0) {
-        return 0;
-  }
-
-  if (!dst) return EINVAL;
-  if (!src) return EINVAL;
-  if (size_in_bytes < count) return ERANGE;
-
-  memcpy(dst, src, count);
-  return 0;
-}
-
diff --git a/third_party/minicrt/memory.h b/third_party/minicrt/memory.h
deleted file mode 100644
index 0284dab..0000000
--- a/third_party/minicrt/memory.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef TR_COMMON_MINICRT_MEMORY_H_
-#define TR_COMMON_MINICRT_MEMORY_H_
-
-int __cdecl memcmp(const void * buf1, const void * buf2, size_t count);
-void * __cdecl memcpy(void * dst, const void * src, size_t count);
-void * __cdecl memset(void *dst, int val, size_t count);
-
-#endif  // TR_COMMON_MINICRT_MEMORY_H_
diff --git a/third_party/minicrt/misc.cc b/third_party/minicrt/misc.cc
deleted file mode 100644
index 7819f62..0000000
--- a/third_party/minicrt/misc.cc
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "libctiny.h"
-#include <windows.h>
-
-//  extern "C" int __cdecl abs (
-//          int number
-//          )
-//  {
-//          return( number>=0 ? number : -number );
-//  }
-//  extern "C" __int64 __cdecl _abs64(
-//          __int64 num
-//          )
-//  {
-//          return (num >=0 ? num : -num);
-//  }
diff --git a/third_party/minicrt/newdel.cc b/third_party/minicrt/newdel.cc
deleted file mode 100644
index cfcfd2e..0000000
--- a/third_party/minicrt/newdel.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-//==========================================
-// LIBCTINY - Matt Pietrek 2001
-// MSDN Magazine, January 2001
-//==========================================
-#include "libctiny.h"
-#include <windows.h>
-
-void * __cdecl operator new(unsigned int s) {
-  return HeapAlloc( GetProcessHeap(), 0, s );
-}
-
-void __cdecl operator delete(void* p) {
-  if (p)
-    HeapFree( GetProcessHeap(), 0, p ); 
-}
-
-void* __cdecl operator new[](size_t n) {
-  return operator new(n);
-}
-
-void __cdecl operator delete[](void* p) {
-  operator delete(p);
-}
diff --git a/third_party/minicrt/pesect.c b/third_party/minicrt/pesect.c
deleted file mode 100644
index e331ea8..0000000
--- a/third_party/minicrt/pesect.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/***
-*pesect.c - PE image header routines
-*
-*       Copyright (c) Microsoft Corporation.  All rights reserved.
-*
-*Purpose:
-*       Defines routines that query info from a PE image header.  Because
-*       one of these queries the current PE image, via the linker-defined
-*       variable __ImageBase, this object must be a static-link component
-*       of any C Runtime library.
-*
-*******************************************************************************/
-
-#include <windows.h>
-
-#if defined (_WIN64) && defined (_M_IA64)
-#pragma section(".base", long, read)
-__declspec(allocate(".base"))
-extern IMAGE_DOS_HEADER __ImageBase;
-#else  /* defined (_WIN64) && defined (_M_IA64) */
-extern IMAGE_DOS_HEADER __ImageBase;
-#endif  /* defined (_WIN64) && defined (_M_IA64) */
-
-#pragma optimize("t", on)   // optimize for speed, not space
-
-/***
-*BOOL _ValidateImageBase
-*
-*Purpose:
-*       Check if a PE image is located at a potential image base address.
-*
-*Entry:
-*       pImageBase - pointer to potential PE image in memory
-*
-*Return:
-*       TRUE    PE image validated at pImageBase
-*       FALSE   PE image not found
-*
-*******************************************************************************/
-
-BOOL __cdecl _ValidateImageBase(
-    PBYTE pImageBase
-    )
-{
-    PIMAGE_DOS_HEADER      pDOSHeader;
-    PIMAGE_NT_HEADERS      pNTHeader;
-    PIMAGE_OPTIONAL_HEADER pOptHeader;
-
-    pDOSHeader = (PIMAGE_DOS_HEADER)pImageBase;
-    if (pDOSHeader->e_magic != IMAGE_DOS_SIGNATURE)
-    {
-        return FALSE;
-    }
-
-    pNTHeader = (PIMAGE_NT_HEADERS)((PBYTE)pDOSHeader + pDOSHeader->e_lfanew);
-    if (pNTHeader->Signature != IMAGE_NT_SIGNATURE)
-    {
-        return FALSE;
-    }
-
-    pOptHeader = (PIMAGE_OPTIONAL_HEADER)&pNTHeader->OptionalHeader;
-    if (pOptHeader->Magic != IMAGE_NT_OPTIONAL_HDR_MAGIC)
-    {
-        return FALSE;
-    }
-
-    return TRUE;
-}
-
-/***
-*PIMAGE_SECTION_HEADER _FindPESection
-*
-*Purpose:
-*       Given an RVA (Relative Virtual Address, the offset from the Image Base
-*       for a PE image), determine which PE section, if any, includes that RVA.
-*
-*Entry:
-*       pImageBase - pointer to PE image in memory
-*       rva - RVA whose enclosing section is to be found
-*
-*Return:
-*       NULL     RVA is not part by any section in the PE image
-*       non-NULL Pointer to IMAGE_SECTION_HEADER describing the section holding
-*                the RVA
-*
-*******************************************************************************/
-
-PIMAGE_SECTION_HEADER __cdecl _FindPESection(
-    PBYTE     pImageBase,
-    DWORD_PTR rva
-    )
-{
-    PIMAGE_NT_HEADERS     pNTHeader;
-    PIMAGE_SECTION_HEADER pSection;
-    unsigned int          iSection;
-
-    pNTHeader =
-        (PIMAGE_NT_HEADERS)
-            (pImageBase + ((PIMAGE_DOS_HEADER)pImageBase)->e_lfanew);
-
-    //
-    // Find the section holding the desired address.  We make no assumptions
-    // here about the sort order of the section descriptors (though they
-    // always appear to be sorted by ascending section RVA).
-    //
-    for (iSection = 0, pSection = IMAGE_FIRST_SECTION(pNTHeader);
-         iSection < pNTHeader->FileHeader.NumberOfSections;
-         ++iSection, ++pSection)
-    {
-        if (rva >= pSection->VirtualAddress &&
-            rva <  pSection->VirtualAddress + pSection->Misc.VirtualSize)
-        {
-            //
-            // Section found
-            //
-            return pSection;
-        }
-    }
-
-    //
-    // Section not found
-    //
-    return NULL;
-}
-
-/***
-*BOOL _IsNonwritableInCurrentImage
-*
-*Purpose:
-*       Check if an address is located within the current PE image (the one
-*       starting at __ImageBase), that it is in a proper section of the image,
-*       and that section is not marked writable.  This routine must be
-*       statically linked, not imported from the CRT DLL, so the correct
-*       __ImageBase is found.
-*
-*Entry:
-*       pTarget - address to check
-*
-*Return:
-*       0        Address is either not in current image, not in a section, or
-*                in a writable section.
-*       non-0    Address is in a non-writable section of the current image.
-*
-*******************************************************************************/
-
-BOOL __cdecl _IsNonwritableInCurrentImage(
-    PBYTE pTarget
-    )
-{
-    PBYTE                 pImageBase;
-    DWORD_PTR             rvaTarget;
-    PIMAGE_SECTION_HEADER pSection;
-
-    pImageBase = (PBYTE)&__ImageBase;
-
-    __try {
-        //
-        // Make sure __ImageBase does address a PE image.  This is likely an
-        // unnecessary check, since we should be running from a normal image,
-        // but it is fast, this routine is rarely called, and the normal call
-        // is for security purposes.  If we don't have a PE image, return
-        // failure.
-        //
-        if (!_ValidateImageBase(pImageBase))
-        {
-            return FALSE;
-        }
-
-        //
-        // Convert the targetaddress to a Relative Virtual Address (RVA) within
-        // the image, and find the corresponding PE section.  Return failure if
-        // the target address is not found within the current image.
-        //
-        rvaTarget = pTarget - pImageBase;
-        pSection = _FindPESection(pImageBase, rvaTarget);
-        if (pSection == NULL)
-        {
-            return FALSE;
-        }
-
-        //
-        // Check the section characteristics to see if the target address is
-        // located within a writable section, returning a failure if yes.
-        //
-        return (pSection->Characteristics & IMAGE_SCN_MEM_WRITE) == 0;
-    }
-    __except (GetExceptionCode() == STATUS_ACCESS_VIOLATION)
-    {
-        //
-        // Just return failure if the PE image is corrupted in any way that
-        // triggers an AV.
-        //
-        return FALSE;
-    }
-}
diff --git a/third_party/minicrt/puts.cc b/third_party/minicrt/puts.cc
deleted file mode 100644
index 82e0f71..0000000
--- a/third_party/minicrt/puts.cc
+++ /dev/null
@@ -1,17 +0,0 @@
-//==========================================
-// LIBCTINY - Matt Pietrek 2001
-// MSDN Magazine, January 2001
-//==========================================
-#include "libctiny.h"
-#include <windows.h>
-#include <stdio.h>
-
-extern "C" int __cdecl puts(const char * s) {
-    DWORD cbWritten;
-    HANDLE hStdOut = GetStdHandle( STD_OUTPUT_HANDLE );
-
-    WriteFile( hStdOut, s, lstrlen(s), &cbWritten, 0 );
-    WriteFile( hStdOut, "\r\n", 2, &cbWritten, 0 );
-
-    return (int)(cbWritten ? cbWritten : EOF);
-}
diff --git a/third_party/minicrt/readme.txt b/third_party/minicrt/readme.txt
deleted file mode 100644
index a704afc..0000000
--- a/third_party/minicrt/readme.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-//==========================================
-// LIBCTINY - Matt Pietrek 2001
-// MSDN Magazine, January 2001
-//==========================================
-
-libctiny plus some additions
-
-obj files from:
-
-C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\crt\src\intel\dll_lib
diff --git a/third_party/minicrt/resetstk.c b/third_party/minicrt/resetstk.c
deleted file mode 100644
index c09e005..0000000
--- a/third_party/minicrt/resetstk.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/***
-*resetstk.c - Recover from Stack overflow.
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       Defines the _resetstkoflw() function.
-*
-*******************************************************************************/
-
-#include <stdlib.h>
-#include <malloc.h>
-#include <windows.h>
-
-#define MIN_STACK_REQ_WIN9X 17
-#define MIN_STACK_REQ_WINNT 2
-
-#define _osplatform VER_PLATFORM_WIN32_NT
-
-/***
-* void _resetstkoflw() - Recovers from Stack Overflow
-*
-* Purpose:
-*       Sets the guard page to its position before the stack overflow.
-*
-* Exit:
-*       Returns nonzero on success, zero on failure
-*
-*******************************************************************************/
-
-int _resetstkoflw()
-{
-    LPBYTE pStack, pGuard, pStackBase, pMaxGuard, pMinGuard;
-    MEMORY_BASIC_INFORMATION mbi;
-    SYSTEM_INFO si;
-    DWORD PageSize;
-    DWORD flNewProtect;
-    DWORD flOldProtect;
-
-    // Use _alloca() to get the current stack pointer
-
-    pStack = _alloca(1);
-
-    // Find the base of the stack.
-
-    if (VirtualQuery(pStack, &mbi, sizeof mbi) == 0)
-        return 0;
-    pStackBase = mbi.AllocationBase;
-
-    // Find the page just below where the stack pointer currently points.
-    // This is the highest potential guard page.
-
-    GetSystemInfo(&si);
-    PageSize = si.dwPageSize;
-
-    pMaxGuard = (LPBYTE) (((DWORD_PTR)pStack & ~(DWORD_PTR)(PageSize - 1))
-                       - PageSize);
-
-    // If the potential guard page is too close to the start of the stack
-    // region, abandon the reset effort for lack of space.  Win9x has a
-    // larger reserved stack requirement.
-
-    pMinGuard = pStackBase + ((_osplatform == VER_PLATFORM_WIN32_WINDOWS)
-                              ? MIN_STACK_REQ_WIN9X
-                              : MIN_STACK_REQ_WINNT) * PageSize;
-
-    if (pMaxGuard < pMinGuard)
-        return 0;
-
-    // On a non-Win9x system, do nothing if a guard page is already present,
-    // else set up the guard page to the bottom of the committed range,
-    // allowing for the reserved stack requirement.
-    // For Win9x, just set guard page below the current stack page.
-
-    if (_osplatform != VER_PLATFORM_WIN32_WINDOWS) {
-
-        // Find first block of committed memory in the stack region
-
-        pGuard = pStackBase;
-        do {
-            if (VirtualQuery(pGuard, &mbi, sizeof mbi) == 0)
-                return 0;
-            pGuard = pGuard + mbi.RegionSize;
-        } while ((mbi.State & MEM_COMMIT) == 0);
-        pGuard = mbi.BaseAddress;
-
-        // If first committed block is already marked as a guard page,
-        // there is nothing that needs to be done, so return success.
-
-        if (mbi.Protect & PAGE_GUARD)
-            return 1;
-
-        // Fail if the first committed block is above the highest potential
-        // guard page.  Should never happen.
-
-        if (pMaxGuard < pGuard)
-            return 0;
-
-        // Make sure to leave enough room so the next overflow will have
-        // the proper reserved stack requirement available.
-
-        if (pGuard < pMinGuard)
-            pGuard = pMinGuard;
-
-        VirtualAlloc(pGuard, PageSize, MEM_COMMIT, PAGE_READWRITE);
-    }
-    else {
-        pGuard = pMaxGuard;
-    }
-
-    // Enable the new guard page.
-
-    flNewProtect = _osplatform == VER_PLATFORM_WIN32_WINDOWS
-                   ? PAGE_NOACCESS
-                   : PAGE_READWRITE | PAGE_GUARD;
-
-    return VirtualProtect(pGuard, PageSize, flNewProtect, &flOldProtect);
-}
diff --git a/third_party/minicrt/security.cc b/third_party/minicrt/security.cc
deleted file mode 100644
index 7762424..0000000
--- a/third_party/minicrt/security.cc
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "libctiny.h"
-#include <windows.h>
-
-extern "C" {
-
-#ifdef _WIN64
-#define kDefaultSecurityCookie 0x2B992DDFA23249D6
-#else  /* _WIN64 */
-#define kDefaultSecurityCookie 0xBB40E64E
-#endif  /* _WIN64 */
-
-DWORD_PTR __security_cookie = kDefaultSecurityCookie;
-
-void __fastcall __security_check_cookie(DWORD_PTR) {
-    return;
-
-    /* Immediately return if the local cookie is OK. */
-    // if (cookie == __security_cookie)
-    //    return;
-
-    /* Report the failure */
-    // report_failure();
-}
-
-};  // extern "C"
diff --git a/third_party/minicrt/sehprolg.obj b/third_party/minicrt/sehprolg.obj
deleted file mode 100644
index 96051b6..0000000
--- a/third_party/minicrt/sehprolg.obj
+++ /dev/null
Binary files differ
diff --git a/third_party/minicrt/sehprolg4.obj b/third_party/minicrt/sehprolg4.obj
deleted file mode 100644
index 5f5123b..0000000
--- a/third_party/minicrt/sehprolg4.obj
+++ /dev/null
Binary files differ
diff --git a/third_party/minicrt/sehprolg4gs.obj b/third_party/minicrt/sehprolg4gs.obj
deleted file mode 100644
index 1850c7f..0000000
--- a/third_party/minicrt/sehprolg4gs.obj
+++ /dev/null
Binary files differ
diff --git a/third_party/minicrt/stricmp.cc b/third_party/minicrt/stricmp.cc
deleted file mode 100644
index a1f87c0..0000000
--- a/third_party/minicrt/stricmp.cc
+++ /dev/null
@@ -1,15 +0,0 @@
-//==========================================
-// LIBCTINY - Matt Pietrek 2001
-// MSDN Magazine, January 2001
-//==========================================
-#include "libctiny.h"
-#include <windows.h>
-#include <string.h>
-
-extern "C" int __cdecl _strcmpi(const char *s1, const char *s2) {
-    return lstrcmpi( s1, s2 );
-}
-
-extern "C" int __cdecl _stricmp(const char *s1, const char *s2) {
-    return lstrcmpi( s1, s2 );
-}
diff --git a/third_party/minicrt/string.c b/third_party/minicrt/string.c
deleted file mode 100644
index 4447880..0000000
--- a/third_party/minicrt/string.c
+++ /dev/null
@@ -1,1095 +0,0 @@
-#include <windows.h>
-#include <limits.h>
-#include <stdlib.h>
-
-#include "libctiny.h"
-
-#ifndef _CONST_RETURN
-#define _CONST_RETURN
-#endif
-
-/***
-*wcsstr.c - search for one wide-character string inside another
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       defines wcsstr() - search for one wchar_t string inside another
-*
-*******************************************************************************/
-
-/***
-*wchar_t *wcsstr(string1, string2) - search for string2 in string1
-*       (wide strings)
-*
-*Purpose:
-*       finds the first occurrence of string2 in string1 (wide strings)
-*
-*Entry:
-*       wchar_t *string1 - string to search in
-*       wchar_t *string2 - string to search for
-*
-*Exit:
-*       returns a pointer to the first occurrence of string2 in
-*       string1, or NULL if string2 does not occur in string1
-*
-*Uses:
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-_CONST_RETURN wchar_t * __cdecl wcsstr(const wchar_t * wcs1,
-                                       const wchar_t * wcs2) {
-        wchar_t *cp = (wchar_t *) wcs1;
-        wchar_t *s1, *s2;
-
-        if (!*wcs2)
-            return (wchar_t *)wcs1;
-
-        while (*cp)
-        {
-                s1 = cp;
-                s2 = (wchar_t *) wcs2;
-
-                while (*s1 && *s2 && !(*s1-*s2))
-                        s1++, s2++;
-
-                if (!*s2)
-                        return(cp);
-
-                cp++;
-        }
-
-        return(NULL);
-}
-
-/***
-*wcsrchr.c - find last occurrence of wchar_t character in wide string
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       defines wcsrchr() - find the last occurrence of a given character
-*       in a string (wide-characters).
-*
-*******************************************************************************/
-
-/***
-*wchar_t *wcsrchr(string, ch) - find last occurrence of ch in wide string
-*
-*Purpose:
-*       Finds the last occurrence of ch in string.  The terminating
-*       null character is used as part of the search (wide-characters).
-*
-*Entry:
-*       wchar_t *string - string to search in
-*       wchar_t ch - character to search for
-*
-*Exit:
-*       returns a pointer to the last occurrence of ch in the given
-*       string
-*       returns NULL if ch does not occurr in the string
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-_CONST_RETURN wchar_t * __cdecl wcsrchr(const wchar_t * string, wchar_t ch) {
-        wchar_t *start = (wchar_t *)string;
-
-        while (*string++)                       /* find end of string */
-                ;
-                                                /* search towards front */
-        while (--string != start && *string != (wchar_t)ch)
-                ;
-
-        if (*string == (wchar_t)ch)             /* wchar_t found ? */
-                return( (wchar_t *)string );
-
-        return(NULL);
-}
-
-/***
-*wcschr.c - search a wchar_t string for a given wchar_t character
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       defines wcschr() - search a wchar_t string for a wchar_t character
-*
-*******************************************************************************/
-
-/***
-*wchar_t *wcschr(string, c) - search a string for a wchar_t character
-*
-*Purpose:
-*       Searches a wchar_t string for a given wchar_t character,
-*       which may be the null character L'\0'.
-*
-*Entry:
-*       wchar_t *string - wchar_t string to search in
-*       wchar_t c - wchar_t character to search for
-*
-*Exit:
-*       returns pointer to the first occurence of c in string
-*       returns NULL if c does not occur in string
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-_CONST_RETURN wchar_t * __cdecl wcschr(const wchar_t * string, wchar_t ch) {
-        while (*string && *string != (wchar_t)ch)
-                string++;
-
-        if (*string == (wchar_t)ch)
-                return((wchar_t *)string);
-        return(NULL);
-}
-
-/***
-*xtoa.c - convert integers/longs to ASCII string
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       The module has code to convert integers/longs to ASCII strings.  See
-*
-*******************************************************************************/
-
-/***
-*char *_itoa, *_ltoa, *_ultoa(val, buf, radix) - convert binary int to ASCII
-*       string
-*
-*Purpose:
-*       Converts an int to a character string.
-*
-*Entry:
-*       val - number to be converted (int, long or unsigned long)
-*       int radix - base to convert into
-*       char *buf - ptr to buffer to place result
-*
-*Exit:
-*       fills in space pointed to by buf with string result
-*       returns a pointer to this buffer
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-/* helper routine that does the main job. */
-
-static void __cdecl xtoa(unsigned long val, char *buf, unsigned radix, int is_neg) {
-        char *p;                /* pointer to traverse string */
-        char *firstdig;         /* pointer to first digit */
-        char temp;              /* temp char */
-        unsigned digval;        /* value of digit */
-
-        p = buf;
-
-        if (is_neg) {
-            /* negative, so output '-' and negate */
-            *p++ = '-';
-            val = (unsigned long)(-(long)val);
-        }
-
-        firstdig = p;           /* save pointer to first digit */
-
-        do {
-            digval = (unsigned) (val % radix);
-            val /= radix;       /* get next digit */
-
-            /* convert to ascii and store */
-            if (digval > 9)
-                *p++ = (char) (digval - 10 + 'a');  /* a letter */
-            else
-                *p++ = (char) (digval + '0');       /* a digit */
-        } while (val > 0);
-
-        /* We now have the digit of the number in the buffer, but in reverse
-           order.  Thus we reverse them now. */
-
-        *p-- = '\0';            /* terminate string; p points to last digit */
-
-        do {
-            temp = *p;
-            *p = *firstdig;
-            *firstdig = temp;   /* swap *p and *firstdig */
-            --p;
-            ++firstdig;         /* advance to next two digits */
-        } while (firstdig < p); /* repeat until halfway */
-}
-
-/* Actual functions just call conversion helper with neg flag set correctly,
-   and return pointer to buffer. */
-
- char * __cdecl _itoa(int val, char *buf, int radix) {
-    if (radix == 10 && val < 0)
-        xtoa((unsigned long)val, buf, radix, 1);
-    else
-        xtoa((unsigned long)(unsigned int)val, buf, radix, 0);
-    return buf;
-}
-
-/***
-*strlen.c - contains strlen() routine
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       strlen returns the length of a null-terminated string,
-*       not including the null byte itself.
-*
-*******************************************************************************/
-
-#ifdef _MSC_VER
-#pragma function(strlen)
-#endif  /* _MSC_VER */
-
-/***
-*strlen - return the length of a null-terminated string
-*
-*Purpose:
-*       Finds the length in bytes of the given string, not including
-*       the final null character.
-*
-*Entry:
-*       const char * str - string whose length is to be computed
-*
-*Exit:
-*       length of the string "str", exclusive of the final null byte
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-size_t __cdecl strlen(const char * str) {
-        const char *eos = str;
-
-        while (*eos++) ;
-
-        return( (int)(eos - str - 1) );
-}
-
-size_t __cdecl strnlen(const char *str, size_t maxsize) {
-  return strlen(str);
-}
-
-/***
-*wcsncpy.c - copy at most n characters of wide-character string
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       defines wcsncpy() - copy at most n characters of wchar_t string
-*
-*******************************************************************************/
-
-/***
-*wchar_t *wcsncpy(dest, source, count) - copy at most n wide characters
-*
-*Purpose:
-*       Copies count characters from the source string to the
-*       destination.  If count is less than the length of source,
-*       NO NULL CHARACTER is put onto the end of the copied string.
-*       If count is greater than the length of sources, dest is padded
-*       with null characters to length count (wide-characters).
-*
-*
-*Entry:
-*       wchar_t *dest - pointer to destination
-*       wchar_t *source - source string for copy
-*       size_t count - max number of characters to copy
-*
-*Exit:
-*       returns dest
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-wchar_t * __cdecl wcsncpy(wchar_t * dest, const wchar_t * source, size_t count) {
-        wchar_t *start = dest;
-
-        while (count && (*dest++ = *source++))    /* copy string */
-                count--;
-
-        if (count)                              /* pad out with zeroes */
-                while (--count)
-                        *dest++ = L'\0';
-
-        return(start);
-}
-
-/***
-*wcscmp.c - routine to compare two wchar_t strings (for equal, less, or greater)
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       Compares two wide-character strings, determining their lexical order.
-*
-*******************************************************************************/
-
-/***
-*wcscmp - compare two wchar_t strings,
-*        returning less than, equal to, or greater than
-*
-*Purpose:
-*       wcscmp compares two wide-character strings and returns an integer
-*       to indicate whether the first is less than the second, the two are
-*       equal, or whether the first is greater than the second.
-*
-*       Comparison is done wchar_t by wchar_t on an UNSIGNED basis, which is to
-*       say that Null wchar_t(0) is less than any other character.
-*
-*Entry:
-*       const wchar_t * src - string for left-hand side of comparison
-*       const wchar_t * dst - string for right-hand side of comparison
-*
-*Exit:
-*       returns -1 if src <  dst
-*       returns  0 if src == dst
-*       returns +1 if src >  dst
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-int __cdecl wcscmp(const wchar_t * src, const wchar_t * dst) {
-        int ret = 0 ;
-
-        while (! (ret = (int)(*src - *dst)) && *dst)
-                ++src, ++dst;
-
-        if (ret < 0)
-                ret = -1 ;
-        else if (ret > 0)
-                ret = 1 ;
-
-        return( ret );
-}
-
-/***
-*wcslen.c - contains wcslen() routine
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       wcslen returns the length of a null-terminated wide-character string,
-*       not including the null wchar_t itself.
-*
-*******************************************************************************/
-
-/***
-*wcslen - return the length of a null-terminated wide-character string
-*
-*Purpose:
-*       Finds the length in wchar_t's of the given string, not including
-*       the final null wchar_t (wide-characters).
-*
-*Entry:
-*       const wchar_t * wcs - string whose length is to be computed
-*
-*Exit:
-*       length of the string "wcs", exclusive of the final null wchar_t
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-size_t __cdecl wcslen(
-        const wchar_t * wcs
-        ) {
-        const wchar_t *eos = wcs;
-
-        while (*eos++) ;
-
-        return( (size_t)(eos - wcs - 1) );
-}
-
-/***
-*strstr.c - search for one string inside another
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       defines strstr() - search for one string inside another
-*
-*******************************************************************************/
-
-/***
-*char *strstr(string1, string2) - search for string2 in string1
-*
-*Purpose:
-*       finds the first occurrence of string2 in string1
-*
-*Entry:
-*       char *string1 - string to search in
-*       char *string2 - string to search for
-*
-*Exit:
-*       returns a pointer to the first occurrence of string2 in
-*       string1, or NULL if string2 does not occur in string1
-*
-*Uses:
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-_CONST_RETURN char * __cdecl strstr(
-        const char * str1,
-        const char * str2
-        ) {
-        char *cp = (char *) str1;
-        char *s1, *s2;
-
-        if (!*str2)
-            return((char *)str1);
-
-        while (*cp)
-        {
-                s1 = cp;
-                s2 = (char *) str2;
-
-                while (*s1 && *s2 && !(*s1-*s2))
-                        s1++, s2++;
-
-                if (!*s2)
-                        return(cp);
-
-                cp++;
-        }
-
-        return(NULL);
-
-}
-
-/***
-*strcmp.c - routine to compare two strings (for equal, less, or greater)
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       Compares two string, determining their lexical order.
-*
-*******************************************************************************/
-
-#ifdef _MSC_VER
-#pragma function(strcmp)
-#endif  /* _MSC_VER */
-
-/***
-*strcmp - compare two strings, returning less than, equal to, or greater than
-*
-*Purpose:
-*       STRCMP compares two strings and returns an integer
-*       to indicate whether the first is less than the second, the two are
-*       equal, or whether the first is greater than the second.
-*
-*       Comparison is done byte by byte on an UNSIGNED basis, which is to
-*       say that Null (0) is less than any other character (1-255).
-*
-*Entry:
-*       const char * src - string for left-hand side of comparison
-*       const char * dst - string for right-hand side of comparison
-*
-*Exit:
-*       returns -1 if src <  dst
-*       returns  0 if src == dst
-*       returns +1 if src >  dst
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-int __cdecl strcmp(
-        const char * src,
-        const char * dst
-        ) {
-        int ret = 0 ;
-
-        while (! (ret = *(unsigned char *)src - *(unsigned char *)dst) && *dst)
-                ++src, ++dst;
-
-        if (ret < 0)
-                ret = -1 ;
-        else if (ret > 0)
-                ret = 1 ;
-
-        return( ret );
-}
-
-#ifndef _MBSCAT
-#ifdef _MSC_VER
-#pragma function(strcpy)
-#endif  /* _MSC_VER */
-#endif  /* _MBSCAT */
-
-/***
-*char *strcpy(dst, src) - copy one string over another
-*
-*Purpose:
-*       Copies the string src into the spot specified by
-*       dest; assumes enough room.
-*
-*Entry:
-*       char * dst - string over which "src" is to be copied
-*       const char * src - string to be copied over "dst"
-*
-*Exit:
-*       The address of "dst"
-*
-*Exceptions:
-*******************************************************************************/
-
-char * __cdecl strcpy(char * dst, const char * src) {
-        char * cp = dst;
-
-        while (*cp++ = *src++)
-                ;               /* Copy src over dst */
-
-        return( dst );
-}
-
-errno_t __cdecl strcpy_s(char * dst, size_t num_bytes, const char * src) {
-#pragma warning(push)
-#pragma warning(disable : 4996)
-// 4996: 'function' was declared deprecated
-
-  strcpy(dst, src);
-#pragma warning(pop)
-
-  return 0;
-}
-
-/***
-*strncmp.c - compare first n characters of two strings
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       defines strncmp() - compare first n characters of two strings
-*       for lexical order.
-*
-*******************************************************************************/
-
-/***
-*int strncmp(first, last, count) - compare first count chars of strings
-*
-*Purpose:
-*       Compares two strings for lexical order.  The comparison stops
-*       after: (1) a difference between the strings is found, (2) the end
-*       of the strings is reached, or (3) count characters have been
-*       compared.
-*
-*Entry:
-*       char *first, *last - strings to compare
-*       unsigned count - maximum number of characters to compare
-*
-*Exit:
-*       returns <0 if first < last
-*       returns  0 if first == last
-*       returns >0 if first > last
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-int __cdecl strncmp(
-        const char * first,
-        const char * last,
-        size_t count
-        ) {
-        if (!count)
-                return(0);
-
-        while (--count && *first && *first == *last)
-        {
-                first++;
-                last++;
-        }
-
-        return( *(unsigned char *)first - *(unsigned char *)last );
-}
-
-/***
-*strchr.c - search a string for a given character
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       defines strchr() - search a string for a character
-*
-*******************************************************************************/
-
-/***
-*char *strchr(string, c) - search a string for a character
-*
-*Purpose:
-*       Searches a string for a given character, which may be the
-*       null character '\0'.
-*
-*Entry:
-*       char *string - string to search in
-*       char c - character to search for
-*
-*Exit:
-*       returns pointer to the first occurence of c in string
-*       returns NULL if c does not occur in string
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-_CONST_RETURN char * __cdecl strchr(
-        const char * string,
-        int ch
-        ) {
-        while (*string && *string != (char)ch)
-                string++;
-
-        if (*string == (char)ch)
-                return((char *)string);
-        return(NULL);
-}
-
-/***
-*wcsncmp.c - compare first n characters of two wide-character strings
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       defines wcsncmp() - compare first n characters of two wchar_t strings
-*       for lexical order.
-*
-*******************************************************************************/
-
-/***
-*int wcsncmp(first, last, count) - compare first count chars of wchar_t strings
-*
-*Purpose:
-*       Compares two strings for lexical order.  The comparison stops
-*       after: (1) a difference between the strings is found, (2) the end
-*       of the strings is reached, or (3) count characters have been
-*       compared (wide-character strings).
-*
-*Entry:
-*       wchar_t *first, *last - strings to compare
-*       size_t count - maximum number of characters to compare
-*
-*Exit:
-*       returns <0 if first < last
-*       returns  0 if first == last
-*       returns >0 if first > last
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-int __cdecl wcsncmp(
-        const wchar_t * first,
-        const wchar_t * last,
-        size_t count
-        ) {
-        if (!count)
-                return(0);
-
-        while (--count && *first && *first == *last)
-        {
-                first++;
-                last++;
-        }
-
-        return((int)(*first - *last));
-}
-
-/***
-*wcsspn.c - find length of initial substring of chars from a control string
-*       (wide-character strings)
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       defines wcsspn() - finds the length of the initial substring of
-*       a string consisting entirely of characters from a control string
-*       (wide-character strings).
-*
-*******************************************************************************/
-
-/***
-*int wcsspn(string, control) - find init substring of control chars
-*
-*Purpose:
-*       Finds the index of the first character in string that does belong
-*       to the set of characters specified by control.  This is
-*       equivalent to the length of the initial substring of string that
-*       consists entirely of characters from control.  The L'\0' character
-*       that terminates control is not considered in the matching process
-*       (wide-character strings).
-*
-*Entry:
-*       wchar_t *string - string to search
-*       wchar_t *control - string containing characters not to search for
-*
-*Exit:
-*       returns index of first wchar_t in string not in control
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-size_t __cdecl wcsspn(
-        const wchar_t * string,
-        const wchar_t * control
-        ) {
-        wchar_t *str = (wchar_t *) string;
-        wchar_t *ctl;
-
-        /* 1st char not in control string stops search */
-        while (*str) {
-            for (ctl = (wchar_t *)control; *ctl != *str; ctl++) {
-                if (*ctl == (wchar_t)0) {
-                    /*
-                     * reached end of control string without finding a match
-                     */
-                    return (size_t)(str - string);
-                }
-            }
-            str++;
-        }
-        /*
-         * The whole string consisted of characters from control
-         */
-        return (size_t)(str - string);
-}
-
-/***
-*wcscspn.c - find length of initial substring of wide characters
-*        not in a control string
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       defines wcscspn()- finds the length of the initial substring of
-*       a string consisting entirely of characters not in a control string
-*       (wide-character strings).
-*
-*******************************************************************************/
-
-/***
-*size_t wcscspn(string, control) - search for init substring w/o control wchars
-*
-*Purpose:
-*       returns the index of the first character in string that belongs
-*       to the set of characters specified by control.  This is equivalent
-*       to the length of the length of the initial substring of string
-*       composed entirely of characters not in control.  Null chars not
-*       considered (wide-character strings).
-*
-*Entry:
-*       wchar_t *string - string to search
-*       wchar_t *control - set of characters not allowed in init substring
-*
-*Exit:
-*       returns the index of the first wchar_t in string
-*       that is in the set of characters specified by control.
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-size_t __cdecl wcscspn(
-        const wchar_t * string,
-        const wchar_t * control
-        ) {
-        wchar_t *str = (wchar_t *) string;
-        wchar_t *wcset;
-
-        /* 1st char in control string stops search */
-        while (*str) {
-            for (wcset = (wchar_t *)control; *wcset; wcset++) {
-                if (*wcset == *str) {
-                    return (size_t)(str - string);
-                }
-            }
-            str++;
-        }
-        return (size_t)(str - string);
-}
-
-/***
-*wchar_t *wcscpy(dst, src) - copy one wchar_t string over another
-*
-*Purpose:
-*       Copies the wchar_t string src into the spot specified by
-*       dest; assumes enough room.
-*
-*Entry:
-*       wchar_t * dst - wchar_t string over which "src" is to be copied
-*       const wchar_t * src - wchar_t string to be copied over "dst"
-*
-*Exit:
-*       The address of "dst"
-*
-*Exceptions:
-*******************************************************************************/
-
-wchar_t * __cdecl wcscpy(wchar_t * dst, const wchar_t * src)
-{
-        wchar_t * cp = dst;
-
-        while( *cp++ = *src++ )
-                ;               /* Copy src over dst */
-
-        return( dst );
-}
-
-/***
-*strtol, strtoul(nptr,endptr,ibase) - Convert ascii string to long un/signed
-*       int.
-*
-*Purpose:
-*       Convert an ascii string to a long 32-bit value.  The base
-*       used for the caculations is supplied by the caller.  The base
-*       must be in the range 0, 2-36.  If a base of 0 is supplied, the
-*       ascii string must be examined to determine the base of the
-*       number:
-*               (a) First char = '0', second char = 'x' or 'X',
-*                   use base 16.
-*               (b) First char = '0', use base 8
-*               (c) First char in range '1' - '9', use base 10.
-*
-*       If the 'endptr' value is non-NULL, then strtol/strtoul places
-*       a pointer to the terminating character in this value.
-*       See ANSI standard for details
-*
-*Entry:
-*       nptr == NEAR/FAR pointer to the start of string.
-*       endptr == NEAR/FAR pointer to the end of the string.
-*       ibase == integer base to use for the calculations.
-*
-*       string format: [whitespace] [sign] [0] [x] [digits/letters]
-*
-*Exit:
-*       Good return:
-*               result
-*
-*       Overflow return:
-*               strtol -- LONG_MAX or LONG_MIN
-*               strtoul -- ULONG_MAX
-*               strtol/strtoul -- errno == ERANGE
-*
-*       No digits or bad base return:
-*               0
-*               endptr = nptr*
-*
-*Exceptions:
-*       None.
-*******************************************************************************/
-
-/* flag values */
-#define FL_UNSIGNED   1       /* strtoul called */
-#define FL_NEG        2       /* negative sign found */
-#define FL_OVERFLOW   4       /* overflow occured */
-#define FL_READDIGIT  8       /* we've read at least one correct digit */
-
-// __ascii_isdigit returns a non-zero value if c is a decimal digit (0 – 9).
-int __ascii_isdigit(int c)
-{
-  return (c >= '0' && c <= '9');
-}
-
-// __ascii_isalpha returns a nonzero value if c is within
-// the ranges A – Z or a – z.
-int __ascii_isalpha(int c)
-{
-  return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'));
-}
-
-// __ascii_toupper converts lowercase character to uppercase.
-int __ascii_toupper(int c)
-{
-  if (c >= 'a' && c <= 'z') return (c - ('a' - 'A'));
-  return c;
-}
-
-int isspace(int c)
-{
-  static unsigned char spaces[256] =
-  {
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 1,  // 0-9
-    1, 1, 1, 1, 0, 0, 0, 0, 0, 0,  // 10-19
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 20-29
-    0, 0, 1, 0, 0, 0, 0, 0, 0, 0,  // 30-39
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 40-49
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 50-59
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 60-69
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 70-79
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 80-89
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 90-99
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 100-109
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 110-119
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 120-129
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 130-139
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 140-149
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 150-159
-    1, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 160-169
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 170-179
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 180-189
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 190-199
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 200-209
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 210-219
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 220-229
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 230-239
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 240-249
-    0, 0, 0, 0, 0, 1,              // 250-255
-  };
-
-  return spaces[(unsigned char)c] == 1;
-}
-
-static unsigned long __cdecl strtoxl (
-        const char *nptr,
-        const char **endptr,
-        int ibase,
-        int flags
-        )
-{
-        const char *p;
-        char c;
-        unsigned long number;
-        unsigned digval;
-        unsigned long maxval;
-
-        p = nptr;                       /* p is our scanning pointer */
-        number = 0;                     /* start with zero */
-
-        c = *p++;                       /* read char */
-        while ( isspace((int)(unsigned char)c) )
-                c = *p++;               /* skip whitespace */
-
-        if (c == '-') {
-                flags |= FL_NEG;        /* remember minus sign */
-                c = *p++;
-        }
-        else if (c == '+')
-                c = *p++;               /* skip sign */
-
-        if (ibase < 0 || ibase == 1 || ibase > 36) {
-                /* bad base! */
-                if (endptr)
-                        /* store beginning of string in endptr */
-                        *endptr = nptr;
-                return 0L;              /* return 0 */
-        }
-        else if (ibase == 0) {
-                /* determine base free-lance, based on first two chars of
-                   string */
-                if (c != '0')
-                        ibase = 10;
-                else if (*p == 'x' || *p == 'X')
-                        ibase = 16;
-                else
-                        ibase = 8;
-        }
-
-        if (ibase == 16) {
-                /* we might have 0x in front of number; remove if there */
-                if (c == '0' && (*p == 'x' || *p == 'X')) {
-                        ++p;
-                        c = *p++;       /* advance past prefix */
-                }
-        }
-
-        /* if our number exceeds this, we will overflow on multiply */
-        maxval = ULONG_MAX / ibase;
-
-
-        for (;;) {      /* exit in middle of loop */
-                /* convert c to value */
-                if ( __ascii_isdigit((int)(unsigned char)c) )
-                        digval = c - '0';
-                else if ( __ascii_isalpha((int)(unsigned char)c) )
-                        digval = __ascii_toupper(c) - 'A' + 10;
-                else
-                        break;
-                if (digval >= (unsigned)ibase)
-                        break;          /* exit loop if bad digit found */
-
-                /* record the fact we have read one digit */
-                flags |= FL_READDIGIT;
-
-                /* we now need to compute number = number * base + digval,
-                   but we need to know if overflow occured.  This requires
-                   a tricky pre-check. */
-
-                if (number < maxval || (number == maxval &&
-                (unsigned long)digval <= ULONG_MAX % ibase)) {
-                        /* we won't overflow, go ahead and multiply */
-                        number = number * ibase + digval;
-                }
-                else {
-                        /* we would have overflowed -- set the overflow flag */
-                        flags |= FL_OVERFLOW;
-                }
-
-                c = *p++;               /* read next digit */
-        }
-
-        --p;                            /* point to place that stopped scan */
-
-        if (!(flags & FL_READDIGIT)) {
-                /* no number there; return 0 and point to beginning of
-                   string */
-                if (endptr)
-                        /* store beginning of string in endptr later on */
-                        p = nptr;
-                number = 0L;            /* return 0 */
-        }
-        else if ( (flags & FL_OVERFLOW) ||
-                  ( !(flags & FL_UNSIGNED) &&
-                    ( ( (flags & FL_NEG) && (number > -LONG_MIN) ) ||
-                      ( !(flags & FL_NEG) && (number > LONG_MAX) ) ) ) )
-        {
-                /* overflow or signed overflow occurred */
-                // errno = ERANGE;
-                if ( flags & FL_UNSIGNED )
-                        number = ULONG_MAX;
-                else if ( flags & FL_NEG )
-                        number = (unsigned long)(-LONG_MIN);
-                else
-                        number = LONG_MAX;
-        }
-
-        if (endptr != NULL)
-                /* store pointer to char that stopped the scan */
-                *endptr = p;
-
-        if (flags & FL_NEG)
-                /* negate result if there was a neg sign */
-                number = (unsigned long)(-(long)number);
-
-        return number;                  /* done. */
-}
-
-long __cdecl strtol (
-        const char *nptr,
-        char **endptr,
-        int ibase
-        )
-{
-        return (long) strtoxl(nptr, (const char**)endptr, ibase, 0);
-}
-
-unsigned long __cdecl strtoul (
-        const char *nptr,
-        char **endptr,
-        int ibase
-        )
-{
-        return strtoxl(nptr, (const char**)endptr, ibase, FL_UNSIGNED);
-}
-
diff --git a/third_party/minicrt/string.cc b/third_party/minicrt/string.cc
deleted file mode 100644
index 9c2ad0d..0000000
--- a/third_party/minicrt/string.cc
+++ /dev/null
@@ -1,1080 +0,0 @@
-#include <windows.h>
-#include <limits.h>
-#include <stdlib.h>
-
-#include "libctiny.h"
-
-#ifndef _CONST_RETURN
-#define _CONST_RETURN
-#endif
-
-/***
-*wcsstr.c - search for one wide-character string inside another
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       defines wcsstr() - search for one wchar_t string inside another
-*
-*******************************************************************************/
-
-/***
-*wchar_t *wcsstr(string1, string2) - search for string2 in string1
-*       (wide strings)
-*
-*Purpose:
-*       finds the first occurrence of string2 in string1 (wide strings)
-*
-*Entry:
-*       wchar_t *string1 - string to search in
-*       wchar_t *string2 - string to search for
-*
-*Exit:
-*       returns a pointer to the first occurrence of string2 in
-*       string1, or NULL if string2 does not occur in string1
-*
-*Uses:
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-_CONST_RETURN wchar_t * __cdecl wcsstr(const wchar_t * wcs1,
-                                       const wchar_t * wcs2) {
-        wchar_t *cp = (wchar_t *) wcs1;
-        wchar_t *s1, *s2;
-
-        if (!*wcs2)
-            return (wchar_t *)wcs1;
-
-        while (*cp)
-        {
-                s1 = cp;
-                s2 = (wchar_t *) wcs2;
-
-                while (*s1 && *s2 && !(*s1-*s2))
-                        s1++, s2++;
-
-                if (!*s2)
-                        return(cp);
-
-                cp++;
-        }
-
-        return(NULL);
-}
-
-/***
-*wcsrchr.c - find last occurrence of wchar_t character in wide string
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       defines wcsrchr() - find the last occurrence of a given character
-*       in a string (wide-characters).
-*
-*******************************************************************************/
-
-/***
-*wchar_t *wcsrchr(string, ch) - find last occurrence of ch in wide string
-*
-*Purpose:
-*       Finds the last occurrence of ch in string.  The terminating
-*       null character is used as part of the search (wide-characters).
-*
-*Entry:
-*       wchar_t *string - string to search in
-*       wchar_t ch - character to search for
-*
-*Exit:
-*       returns a pointer to the last occurrence of ch in the given
-*       string
-*       returns NULL if ch does not occurr in the string
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-_CONST_RETURN wchar_t * __cdecl wcsrchr(const wchar_t * string, wchar_t ch) {
-        wchar_t *start = (wchar_t *)string;
-
-        while (*string++)                       /* find end of string */
-                ;
-                                                /* search towards front */
-        while (--string != start && *string != (wchar_t)ch)
-                ;
-
-        if (*string == (wchar_t)ch)             /* wchar_t found ? */
-                return( (wchar_t *)string );
-
-        return(NULL);
-}
-
-/***
-*wcschr.c - search a wchar_t string for a given wchar_t character
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       defines wcschr() - search a wchar_t string for a wchar_t character
-*
-*******************************************************************************/
-
-/***
-*wchar_t *wcschr(string, c) - search a string for a wchar_t character
-*
-*Purpose:
-*       Searches a wchar_t string for a given wchar_t character,
-*       which may be the null character L'\0'.
-*
-*Entry:
-*       wchar_t *string - wchar_t string to search in
-*       wchar_t c - wchar_t character to search for
-*
-*Exit:
-*       returns pointer to the first occurence of c in string
-*       returns NULL if c does not occur in string
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-_CONST_RETURN wchar_t * __cdecl wcschr(const wchar_t * string, wchar_t ch) {
-        while (*string && *string != (wchar_t)ch)
-                string++;
-
-        if (*string == (wchar_t)ch)
-                return((wchar_t *)string);
-        return(NULL);
-}
-
-/***
-*xtoa.c - convert integers/longs to ASCII string
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       The module has code to convert integers/longs to ASCII strings.  See
-*
-*******************************************************************************/
-
-/***
-*char *_itoa, *_ltoa, *_ultoa(val, buf, radix) - convert binary int to ASCII
-*       string
-*
-*Purpose:
-*       Converts an int to a character string.
-*
-*Entry:
-*       val - number to be converted (int, long or unsigned long)
-*       int radix - base to convert into
-*       char *buf - ptr to buffer to place result
-*
-*Exit:
-*       fills in space pointed to by buf with string result
-*       returns a pointer to this buffer
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-/* helper routine that does the main job. */
-
-static void __cdecl xtoa(unsigned long val, char *buf, unsigned radix, int is_neg) {
-        char *p;                /* pointer to traverse string */
-        char *firstdig;         /* pointer to first digit */
-        char temp;              /* temp char */
-        unsigned digval;        /* value of digit */
-
-        p = buf;
-
-        if (is_neg) {
-            /* negative, so output '-' and negate */
-            *p++ = '-';
-            val = (unsigned long)(-(long)val);
-        }
-
-        firstdig = p;           /* save pointer to first digit */
-
-        do {
-            digval = (unsigned) (val % radix);
-            val /= radix;       /* get next digit */
-
-            /* convert to ascii and store */
-            if (digval > 9)
-                *p++ = (char) (digval - 10 + 'a');  /* a letter */
-            else
-                *p++ = (char) (digval + '0');       /* a digit */
-        } while (val > 0);
-
-        /* We now have the digit of the number in the buffer, but in reverse
-           order.  Thus we reverse them now. */
-
-        *p-- = '\0';            /* terminate string; p points to last digit */
-
-        do {
-            temp = *p;
-            *p = *firstdig;
-            *firstdig = temp;   /* swap *p and *firstdig */
-            --p;
-            ++firstdig;         /* advance to next two digits */
-        } while (firstdig < p); /* repeat until halfway */
-}
-
-/* Actual functions just call conversion helper with neg flag set correctly,
-   and return pointer to buffer. */
-
-extern "C" char * __cdecl _itoa(int val, char *buf, int radix) {
-    if (radix == 10 && val < 0)
-        xtoa((unsigned long)val, buf, radix, 1);
-    else
-        xtoa((unsigned long)(unsigned int)val, buf, radix, 0);
-    return buf;
-}
-
-/***
-*strlen.c - contains strlen() routine
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       strlen returns the length of a null-terminated string,
-*       not including the null byte itself.
-*
-*******************************************************************************/
-
-#ifdef _MSC_VER
-#pragma function(strlen)
-#endif  /* _MSC_VER */
-
-/***
-*strlen - return the length of a null-terminated string
-*
-*Purpose:
-*       Finds the length in bytes of the given string, not including
-*       the final null character.
-*
-*Entry:
-*       const char * str - string whose length is to be computed
-*
-*Exit:
-*       length of the string "str", exclusive of the final null byte
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-size_t __cdecl strlen(const char * str) {
-        const char *eos = str;
-
-        while (*eos++) ;
-
-        return( (int)(eos - str - 1) );
-}
-
-/***
-*wcsncpy.c - copy at most n characters of wide-character string
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       defines wcsncpy() - copy at most n characters of wchar_t string
-*
-*******************************************************************************/
-
-/***
-*wchar_t *wcsncpy(dest, source, count) - copy at most n wide characters
-*
-*Purpose:
-*       Copies count characters from the source string to the
-*       destination.  If count is less than the length of source,
-*       NO NULL CHARACTER is put onto the end of the copied string.
-*       If count is greater than the length of sources, dest is padded
-*       with null characters to length count (wide-characters).
-*
-*
-*Entry:
-*       wchar_t *dest - pointer to destination
-*       wchar_t *source - source string for copy
-*       size_t count - max number of characters to copy
-*
-*Exit:
-*       returns dest
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-wchar_t * __cdecl wcsncpy(wchar_t * dest, const wchar_t * source, size_t count) {
-        wchar_t *start = dest;
-
-        while (count && (*dest++ = *source++))    /* copy string */
-                count--;
-
-        if (count)                              /* pad out with zeroes */
-                while (--count)
-                        *dest++ = L'\0';
-
-        return(start);
-}
-
-/***
-*wcscmp.c - routine to compare two wchar_t strings (for equal, less, or greater)
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       Compares two wide-character strings, determining their lexical order.
-*
-*******************************************************************************/
-
-/***
-*wcscmp - compare two wchar_t strings,
-*        returning less than, equal to, or greater than
-*
-*Purpose:
-*       wcscmp compares two wide-character strings and returns an integer
-*       to indicate whether the first is less than the second, the two are
-*       equal, or whether the first is greater than the second.
-*
-*       Comparison is done wchar_t by wchar_t on an UNSIGNED basis, which is to
-*       say that Null wchar_t(0) is less than any other character.
-*
-*Entry:
-*       const wchar_t * src - string for left-hand side of comparison
-*       const wchar_t * dst - string for right-hand side of comparison
-*
-*Exit:
-*       returns -1 if src <  dst
-*       returns  0 if src == dst
-*       returns +1 if src >  dst
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-int __cdecl wcscmp(const wchar_t * src, const wchar_t * dst) {
-        int ret = 0 ;
-
-        while (! (ret = (int)(*src - *dst)) && *dst)
-                ++src, ++dst;
-
-        if (ret < 0)
-                ret = -1 ;
-        else if (ret > 0)
-                ret = 1 ;
-
-        return( ret );
-}
-
-/***
-*wcslen.c - contains wcslen() routine
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       wcslen returns the length of a null-terminated wide-character string,
-*       not including the null wchar_t itself.
-*
-*******************************************************************************/
-
-/***
-*wcslen - return the length of a null-terminated wide-character string
-*
-*Purpose:
-*       Finds the length in wchar_t's of the given string, not including
-*       the final null wchar_t (wide-characters).
-*
-*Entry:
-*       const wchar_t * wcs - string whose length is to be computed
-*
-*Exit:
-*       length of the string "wcs", exclusive of the final null wchar_t
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-size_t __cdecl wcslen(
-        const wchar_t * wcs
-        ) {
-        const wchar_t *eos = wcs;
-
-        while (*eos++) ;
-
-        return( (size_t)(eos - wcs - 1) );
-}
-
-/***
-*strstr.c - search for one string inside another
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       defines strstr() - search for one string inside another
-*
-*******************************************************************************/
-
-/***
-*char *strstr(string1, string2) - search for string2 in string1
-*
-*Purpose:
-*       finds the first occurrence of string2 in string1
-*
-*Entry:
-*       char *string1 - string to search in
-*       char *string2 - string to search for
-*
-*Exit:
-*       returns a pointer to the first occurrence of string2 in
-*       string1, or NULL if string2 does not occur in string1
-*
-*Uses:
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-_CONST_RETURN char * __cdecl strstr(
-        const char * str1,
-        const char * str2
-        ) {
-        char *cp = (char *) str1;
-        char *s1, *s2;
-
-        if (!*str2)
-            return((char *)str1);
-
-        while (*cp)
-        {
-                s1 = cp;
-                s2 = (char *) str2;
-
-                while (*s1 && *s2 && !(*s1-*s2))
-                        s1++, s2++;
-
-                if (!*s2)
-                        return(cp);
-
-                cp++;
-        }
-
-        return(NULL);
-
-}
-
-/***
-*strcmp.c - routine to compare two strings (for equal, less, or greater)
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       Compares two string, determining their lexical order.
-*
-*******************************************************************************/
-
-#ifdef _MSC_VER
-#pragma function(strcmp)
-#endif  /* _MSC_VER */
-
-/***
-*strcmp - compare two strings, returning less than, equal to, or greater than
-*
-*Purpose:
-*       STRCMP compares two strings and returns an integer
-*       to indicate whether the first is less than the second, the two are
-*       equal, or whether the first is greater than the second.
-*
-*       Comparison is done byte by byte on an UNSIGNED basis, which is to
-*       say that Null (0) is less than any other character (1-255).
-*
-*Entry:
-*       const char * src - string for left-hand side of comparison
-*       const char * dst - string for right-hand side of comparison
-*
-*Exit:
-*       returns -1 if src <  dst
-*       returns  0 if src == dst
-*       returns +1 if src >  dst
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-int __cdecl strcmp(
-        const char * src,
-        const char * dst
-        ) {
-        int ret = 0 ;
-
-        while (! (ret = *(unsigned char *)src - *(unsigned char *)dst) && *dst)
-                ++src, ++dst;
-
-        if (ret < 0)
-                ret = -1 ;
-        else if (ret > 0)
-                ret = 1 ;
-
-        return( ret );
-}
-
-#ifndef _MBSCAT
-#ifdef _MSC_VER
-#pragma function(strcpy)
-#endif  /* _MSC_VER */
-#endif  /* _MBSCAT */
-
-/***
-*char *strcpy(dst, src) - copy one string over another
-*
-*Purpose:
-*       Copies the string src into the spot specified by
-*       dest; assumes enough room.
-*
-*Entry:
-*       char * dst - string over which "src" is to be copied
-*       const char * src - string to be copied over "dst"
-*
-*Exit:
-*       The address of "dst"
-*
-*Exceptions:
-*******************************************************************************/
-
-char * __cdecl strcpy(char * dst, const char * src) {
-        char * cp = dst;
-
-        while (*cp++ = *src++)
-                ;               /* Copy src over dst */
-
-        return( dst );
-}
-
-/***
-*strncmp.c - compare first n characters of two strings
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       defines strncmp() - compare first n characters of two strings
-*       for lexical order.
-*
-*******************************************************************************/
-
-/***
-*int strncmp(first, last, count) - compare first count chars of strings
-*
-*Purpose:
-*       Compares two strings for lexical order.  The comparison stops
-*       after: (1) a difference between the strings is found, (2) the end
-*       of the strings is reached, or (3) count characters have been
-*       compared.
-*
-*Entry:
-*       char *first, *last - strings to compare
-*       unsigned count - maximum number of characters to compare
-*
-*Exit:
-*       returns <0 if first < last
-*       returns  0 if first == last
-*       returns >0 if first > last
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-int __cdecl strncmp(
-        const char * first,
-        const char * last,
-        size_t count
-        ) {
-        if (!count)
-                return(0);
-
-        while (--count && *first && *first == *last)
-        {
-                first++;
-                last++;
-        }
-
-        return( *(unsigned char *)first - *(unsigned char *)last );
-}
-
-/***
-*strchr.c - search a string for a given character
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       defines strchr() - search a string for a character
-*
-*******************************************************************************/
-
-/***
-*char *strchr(string, c) - search a string for a character
-*
-*Purpose:
-*       Searches a string for a given character, which may be the
-*       null character '\0'.
-*
-*Entry:
-*       char *string - string to search in
-*       char c - character to search for
-*
-*Exit:
-*       returns pointer to the first occurence of c in string
-*       returns NULL if c does not occur in string
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-_CONST_RETURN char * __cdecl strchr(
-        const char * string,
-        int ch
-        ) {
-        while (*string && *string != (char)ch)
-                string++;
-
-        if (*string == (char)ch)
-                return((char *)string);
-        return(NULL);
-}
-
-/***
-*wcsncmp.c - compare first n characters of two wide-character strings
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       defines wcsncmp() - compare first n characters of two wchar_t strings
-*       for lexical order.
-*
-*******************************************************************************/
-
-/***
-*int wcsncmp(first, last, count) - compare first count chars of wchar_t strings
-*
-*Purpose:
-*       Compares two strings for lexical order.  The comparison stops
-*       after: (1) a difference between the strings is found, (2) the end
-*       of the strings is reached, or (3) count characters have been
-*       compared (wide-character strings).
-*
-*Entry:
-*       wchar_t *first, *last - strings to compare
-*       size_t count - maximum number of characters to compare
-*
-*Exit:
-*       returns <0 if first < last
-*       returns  0 if first == last
-*       returns >0 if first > last
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-int __cdecl wcsncmp(
-        const wchar_t * first,
-        const wchar_t * last,
-        size_t count
-        ) {
-        if (!count)
-                return(0);
-
-        while (--count && *first && *first == *last)
-        {
-                first++;
-                last++;
-        }
-
-        return((int)(*first - *last));
-}
-
-/***
-*wcsspn.c - find length of initial substring of chars from a control string
-*       (wide-character strings)
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       defines wcsspn() - finds the length of the initial substring of
-*       a string consisting entirely of characters from a control string
-*       (wide-character strings).
-*
-*******************************************************************************/
-
-/***
-*int wcsspn(string, control) - find init substring of control chars
-*
-*Purpose:
-*       Finds the index of the first character in string that does belong
-*       to the set of characters specified by control.  This is
-*       equivalent to the length of the initial substring of string that
-*       consists entirely of characters from control.  The L'\0' character
-*       that terminates control is not considered in the matching process
-*       (wide-character strings).
-*
-*Entry:
-*       wchar_t *string - string to search
-*       wchar_t *control - string containing characters not to search for
-*
-*Exit:
-*       returns index of first wchar_t in string not in control
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-size_t __cdecl wcsspn(
-        const wchar_t * string,
-        const wchar_t * control
-        ) {
-        wchar_t *str = (wchar_t *) string;
-        wchar_t *ctl;
-
-        /* 1st char not in control string stops search */
-        while (*str) {
-            for (ctl = (wchar_t *)control; *ctl != *str; ctl++) {
-                if (*ctl == (wchar_t)0) {
-                    /*
-                     * reached end of control string without finding a match
-                     */
-                    return (size_t)(str - string);
-                }
-            }
-            str++;
-        }
-        /*
-         * The whole string consisted of characters from control
-         */
-        return (size_t)(str - string);
-}
-
-/***
-*wcscspn.c - find length of initial substring of wide characters
-*        not in a control string
-*
-*       Copyright (c) Microsoft Corporation. All rights reserved.
-*
-*Purpose:
-*       defines wcscspn()- finds the length of the initial substring of
-*       a string consisting entirely of characters not in a control string
-*       (wide-character strings).
-*
-*******************************************************************************/
-
-/***
-*size_t wcscspn(string, control) - search for init substring w/o control wchars
-*
-*Purpose:
-*       returns the index of the first character in string that belongs
-*       to the set of characters specified by control.  This is equivalent
-*       to the length of the length of the initial substring of string
-*       composed entirely of characters not in control.  Null chars not
-*       considered (wide-character strings).
-*
-*Entry:
-*       wchar_t *string - string to search
-*       wchar_t *control - set of characters not allowed in init substring
-*
-*Exit:
-*       returns the index of the first wchar_t in string
-*       that is in the set of characters specified by control.
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-size_t __cdecl wcscspn(
-        const wchar_t * string,
-        const wchar_t * control
-        ) {
-        wchar_t *str = (wchar_t *) string;
-        wchar_t *wcset;
-
-        /* 1st char in control string stops search */
-        while (*str) {
-            for (wcset = (wchar_t *)control; *wcset; wcset++) {
-                if (*wcset == *str) {
-                    return (size_t)(str - string);
-                }
-            }
-            str++;
-        }
-        return (size_t)(str - string);
-}
-
-/***
-*wchar_t *wcscpy(dst, src) - copy one wchar_t string over another
-*
-*Purpose:
-*       Copies the wchar_t string src into the spot specified by
-*       dest; assumes enough room.
-*
-*Entry:
-*       wchar_t * dst - wchar_t string over which "src" is to be copied
-*       const wchar_t * src - wchar_t string to be copied over "dst"
-*
-*Exit:
-*       The address of "dst"
-*
-*Exceptions:
-*******************************************************************************/
-
-wchar_t * __cdecl wcscpy(wchar_t * dst, const wchar_t * src)
-{
-        wchar_t * cp = dst;
-
-        while( *cp++ = *src++ )
-                ;               /* Copy src over dst */
-
-        return( dst );
-}
-
-/***
-*strtol, strtoul(nptr,endptr,ibase) - Convert ascii string to long un/signed
-*       int.
-*
-*Purpose:
-*       Convert an ascii string to a long 32-bit value.  The base
-*       used for the caculations is supplied by the caller.  The base
-*       must be in the range 0, 2-36.  If a base of 0 is supplied, the
-*       ascii string must be examined to determine the base of the
-*       number:
-*               (a) First char = '0', second char = 'x' or 'X',
-*                   use base 16.
-*               (b) First char = '0', use base 8
-*               (c) First char in range '1' - '9', use base 10.
-*
-*       If the 'endptr' value is non-NULL, then strtol/strtoul places
-*       a pointer to the terminating character in this value.
-*       See ANSI standard for details
-*
-*Entry:
-*       nptr == NEAR/FAR pointer to the start of string.
-*       endptr == NEAR/FAR pointer to the end of the string.
-*       ibase == integer base to use for the calculations.
-*
-*       string format: [whitespace] [sign] [0] [x] [digits/letters]
-*
-*Exit:
-*       Good return:
-*               result
-*
-*       Overflow return:
-*               strtol -- LONG_MAX or LONG_MIN
-*               strtoul -- ULONG_MAX
-*               strtol/strtoul -- errno == ERANGE
-*
-*       No digits or bad base return:
-*               0
-*               endptr = nptr*
-*
-*Exceptions:
-*       None.
-*******************************************************************************/
-
-/* flag values */
-#define FL_UNSIGNED   1       /* strtoul called */
-#define FL_NEG        2       /* negative sign found */
-#define FL_OVERFLOW   4       /* overflow occured */
-#define FL_READDIGIT  8       /* we've read at least one correct digit */
-
-// __ascii_isdigit returns a non-zero value if c is a decimal digit (0 – 9).
-int __ascii_isdigit(int c)
-{
-  return (c >= '0' && c <= '9');
-}
-
-// __ascii_isalpha returns a nonzero value if c is within
-// the ranges A – Z or a – z.
-int __ascii_isalpha(int c)
-{
-  return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'));
-}
-
-// __ascii_toupper converts lowercase character to uppercase.
-int __ascii_toupper(int c)
-{
-  if (c >= 'a' && c <= 'z') return (c - ('a' - 'A'));
-  return c;
-}
-
-int isspace(int c)
-{
-  static bool spaces[256] =
-  {
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 1,  // 0-9
-    1, 1, 1, 1, 0, 0, 0, 0, 0, 0,  // 10-19
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 20-29
-    0, 0, 1, 0, 0, 0, 0, 0, 0, 0,  // 30-39
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 40-49
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 50-59
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 60-69
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 70-79
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 80-89
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 90-99
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 100-109
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 110-119
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 120-129
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 130-139
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 140-149
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 150-159
-    1, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 160-169
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 170-179
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 180-189
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 190-199
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 200-209
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 210-219
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 220-229
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 230-239
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 240-249
-    0, 0, 0, 0, 0, 1,              // 250-255
-  };
-
-  return spaces[static_cast<unsigned char>(c)] == 1;
-}
-
-static unsigned long __cdecl strtoxl (
-        const char *nptr,
-        const char **endptr,
-        int ibase,
-        int flags
-        )
-{
-        const char *p;
-        char c;
-        unsigned long number;
-        unsigned digval;
-        unsigned long maxval;
-
-        p = nptr;                       /* p is our scanning pointer */
-        number = 0;                     /* start with zero */
-
-        c = *p++;                       /* read char */
-        while ( isspace((int)(unsigned char)c) )
-                c = *p++;               /* skip whitespace */
-
-        if (c == '-') {
-                flags |= FL_NEG;        /* remember minus sign */
-                c = *p++;
-        }
-        else if (c == '+')
-                c = *p++;               /* skip sign */
-
-        if (ibase < 0 || ibase == 1 || ibase > 36) {
-                /* bad base! */
-                if (endptr)
-                        /* store beginning of string in endptr */
-                        *endptr = nptr;
-                return 0L;              /* return 0 */
-        }
-        else if (ibase == 0) {
-                /* determine base free-lance, based on first two chars of
-                   string */
-                if (c != '0')
-                        ibase = 10;
-                else if (*p == 'x' || *p == 'X')
-                        ibase = 16;
-                else
-                        ibase = 8;
-        }
-
-        if (ibase == 16) {
-                /* we might have 0x in front of number; remove if there */
-                if (c == '0' && (*p == 'x' || *p == 'X')) {
-                        ++p;
-                        c = *p++;       /* advance past prefix */
-                }
-        }
-
-        /* if our number exceeds this, we will overflow on multiply */
-        maxval = ULONG_MAX / ibase;
-
-
-        for (;;) {      /* exit in middle of loop */
-                /* convert c to value */
-                if ( __ascii_isdigit((int)(unsigned char)c) )
-                        digval = c - '0';
-                else if ( __ascii_isalpha((int)(unsigned char)c) )
-                        digval = __ascii_toupper(c) - 'A' + 10;
-                else
-                        break;
-                if (digval >= (unsigned)ibase)
-                        break;          /* exit loop if bad digit found */
-
-                /* record the fact we have read one digit */
-                flags |= FL_READDIGIT;
-
-                /* we now need to compute number = number * base + digval,
-                   but we need to know if overflow occured.  This requires
-                   a tricky pre-check. */
-
-                if (number < maxval || (number == maxval &&
-                (unsigned long)digval <= ULONG_MAX % ibase)) {
-                        /* we won't overflow, go ahead and multiply */
-                        number = number * ibase + digval;
-                }
-                else {
-                        /* we would have overflowed -- set the overflow flag */
-                        flags |= FL_OVERFLOW;
-                }
-
-                c = *p++;               /* read next digit */
-        }
-
-        --p;                            /* point to place that stopped scan */
-
-        if (!(flags & FL_READDIGIT)) {
-                /* no number there; return 0 and point to beginning of
-                   string */
-                if (endptr)
-                        /* store beginning of string in endptr later on */
-                        p = nptr;
-                number = 0L;            /* return 0 */
-        }
-        else if ( (flags & FL_OVERFLOW) ||
-                  ( !(flags & FL_UNSIGNED) &&
-                    ( ( (flags & FL_NEG) && (number > -LONG_MIN) ) ||
-                      ( !(flags & FL_NEG) && (number > LONG_MAX) ) ) ) )
-        {
-                /* overflow or signed overflow occurred */
-                // errno = ERANGE;
-                if ( flags & FL_UNSIGNED )
-                        number = ULONG_MAX;
-                else if ( flags & FL_NEG )
-                        number = (unsigned long)(-LONG_MIN);
-                else
-                        number = LONG_MAX;
-        }
-
-        if (endptr != NULL)
-                /* store pointer to char that stopped the scan */
-                *endptr = p;
-
-        if (flags & FL_NEG)
-                /* negate result if there was a neg sign */
-                number = (unsigned long)(-(long)number);
-
-        return number;                  /* done. */
-}
-
-long __cdecl strtol (
-        const char *nptr,
-        char **endptr,
-        int ibase
-        )
-{
-        return (long) strtoxl(nptr, (const char**)endptr, ibase, 0);
-}
-
-unsigned long __cdecl strtoul (
-        const char *nptr,
-        char **endptr,
-        int ibase
-        )
-{
-        return strtoxl(nptr, (const char**)endptr, ibase, FL_UNSIGNED);
-}
-
diff --git a/third_party/minicrt/struplwr.cc b/third_party/minicrt/struplwr.cc
deleted file mode 100644
index 311f7ab..0000000
--- a/third_party/minicrt/struplwr.cc
+++ /dev/null
@@ -1,20 +0,0 @@
-//==========================================
-// LIBCTINY - Matt Pietrek 2001
-// MSDN Magazine, January 2001
-//==========================================
-#include "libctiny.h"
-#include <windows.h>
-#include <string.h>
-
-// Force the linker to include USER32.LIB
-#pragma comment(linker, "/defaultlib:user32.lib")
-
-extern "C" char *  __cdecl strupr(char *s) {
-    CharUpperBuff( s, lstrlen(s) );
-    return s;
-}
-
-extern "C" char *  __cdecl strlwr(char *s) {
-    CharLowerBuff( s, lstrlen(s) );
-    return s;
-}
diff --git a/third_party/minicrt/ulldiv.obj b/third_party/minicrt/ulldiv.obj
deleted file mode 100644
index 57c49b3..0000000
--- a/third_party/minicrt/ulldiv.obj
+++ /dev/null
Binary files differ
diff --git a/third_party/minicrt/ulldvrm.obj b/third_party/minicrt/ulldvrm.obj
deleted file mode 100644
index 9fc4907..0000000
--- a/third_party/minicrt/ulldvrm.obj
+++ /dev/null
Binary files differ
diff --git a/third_party/minicrt/ullrem.obj b/third_party/minicrt/ullrem.obj
deleted file mode 100644
index 4104f24..0000000
--- a/third_party/minicrt/ullrem.obj
+++ /dev/null
Binary files differ
diff --git a/third_party/minicrt/ullshr.obj b/third_party/minicrt/ullshr.obj
deleted file mode 100644
index 0aefd89..0000000
--- a/third_party/minicrt/ullshr.obj
+++ /dev/null
Binary files differ
diff --git a/third_party/smartany/auto_any.h b/third_party/smartany/auto_any.h
deleted file mode 100644
index 7b75726..0000000
--- a/third_party/smartany/auto_any.h
+++ /dev/null
@@ -1,315 +0,0 @@
-//+---------------------------------------------------------------------------
-//
-//  Copyright ( C ) Microsoft, 2002.
-//
-//  File:       auto_any.h
-//
-//  Contents:   automatic resource management, a-la std::auto_ptr
-//
-//  Classes:    auto_any<> and various typedefs
-//
-//  Functions:  get
-//              reset
-//              release
-//              valid
-//              address
-//
-//  Author:     Eric Niebler ( ericne@microsoft.com )
-//
-//----------------------------------------------------------------------------
-
-#ifndef AUTO_ANY
-#define AUTO_ANY
-#include <cassert>
-#include "smart_any_fwd.h"
-
-#pragma warning(push)
-
-// 4284 warning for operator-> returning non-pointer;
-//      compiler issues it even if -> is not used for the specific instance
-#pragma warning(disable: 4284) 
-
-namespace detail
-{
-    // friend function definitions go in auto_any_helper
-    template<typename T,class close_policy,class invalid_value,int unique>
-    struct auto_any_helper;
-}
-
-// proxy reference for auto_any copying
-template<typename T,class close_policy,class invalid_value,int unique>
-struct auto_any_ref
-{
-    // construct from compatible auto_any
-    auto_any_ref( auto_any<T,close_policy,invalid_value,unique> & that )
-        : m_that( that )
-    {
-    }
-
-    // reference to constructor argument
-    auto_any<T,close_policy,invalid_value,unique> & m_that;
-
-private:
-    auto_any_ref * operator=( auto_any_ref const & );
-};
-
-// wrap a resource to enforce strict ownership and ensure proper cleanup
-template<typename T,class close_policy,class invalid_value,int unique>
-class auto_any
-{
-    typedef detail::safe_types<T,close_policy>  safe_types;
-
-    // disallow comparison of auto_any's
-    bool operator==( detail::safe_bool ) const;
-    bool operator!=( detail::safe_bool ) const;
-
-public:
-    typedef typename detail::holder<T>::type    element_type;
-    typedef close_policy                        close_policy_type;
-    typedef typename safe_types::pointer_type   pointer_type;
-    typedef typename safe_types::reference_type reference_type;
-
-    // Fix-up the invalid_value type on older compilers
-    typedef typename detail::fixup_invalid_value<invalid_value>::
-        template rebind<T>::type invalid_value_type;
-
-    friend struct detail::auto_any_helper<T,close_policy,invalid_value,unique>;
-
-    // construct from object pointer
-    explicit auto_any( T t = invalid_value_type() )
-        : m_t( t )
-    {
-    }
-
-    // construct by assuming pointer from right auto_any
-    auto_any( auto_any<T,close_policy,invalid_value,unique> & right )
-        : m_t( release( right ) )
-    {
-    }
-
-    // construct by assuming pointer from right auto_any_ref
-    auto_any( auto_any_ref<T,close_policy,invalid_value,unique> right )
-        : m_t( release( right.m_that ) )
-    {
-    }
-
-    // convert to compatible auto_any_ref
-    operator auto_any_ref<T,close_policy,invalid_value,unique>()
-    {
-        return auto_any_ref<T,close_policy,invalid_value,unique>( *this );
-    }
-
-    // assign compatible right
-    auto_any<T,close_policy,invalid_value,unique> & operator=( 
-        auto_any<T,close_policy,invalid_value,unique> & right )
-    {
-        reset( *this, release( right ) );
-        return *this;
-    }
-
-    // assign compatible right.ref
-    auto_any<T,close_policy,invalid_value,unique> & operator=( 
-        auto_any_ref<T,close_policy,invalid_value,unique> & right )
-    {
-        reset( *this, release( right.m_that ) );
-        return *this;
-    }
-
-    // destroy the object
-    ~auto_any()
-    {
-        if( valid() )
-        {
-            close_policy::close( m_t );
-        }
-    }
-
-    // return pointer to class object (assume pointer)
-    pointer_type operator->() const
-    {
-        #ifdef SMART_ANY_PTS
-        // You better not be applying operator-> to a handle!
-        static detail::static_assert<!detail::is_handle<T>::value> const cannot_dereference_a_handle;
-        #endif
-        assert( valid() );
-        return safe_types::to_pointer( m_t );
-    }
-
-    // for use when auto_any appears in a conditional
-    operator detail::safe_bool() const
-    {
-        return valid() ? detail::safe_true : detail::safe_false;
-    }
-
-    // for use when auto_any appears in a conditional
-    bool operator!() const
-    {
-        return ! valid();
-    }
-
-    #ifdef SMART_ANY_PTS
-    // if this auto_any is managing an array, we can use operator[] to index it
-    typename detail::deref<T>::type operator[]( int i ) const
-    {
-        static detail::static_assert<!detail::is_handle<T>::value> const cannot_dereference_a_handle;
-        static detail::static_assert<!detail::is_delete<close_policy>::value> const accessed_like_an_array_but_not_deleted_like_an_array;
-        assert( valid() );
-        return m_t[ i ];
-    }
-
-    // unary operator* lets you write code like:
-    // auto_any<foo*,close_delete> pfoo( new foo );
-    // foo & f = *pfoo;
-    reference_type operator*() const
-    {
-        static detail::static_assert<!detail::is_handle<T>::value> const cannot_dereference_a_handle;
-        assert( valid() );
-        return safe_types::to_reference( m_t );
-    }
-    #endif
-
-private:
-
-    bool valid() const
-    {
-        // see if the managed resource is in the invalid state.
-        return m_t != static_cast<T>( invalid_value_type() );
-    }
-
-    // the wrapped object
-    element_type m_t;
-};
-
-namespace detail
-{
-    // friend function definitions go in auto_any_helper
-    template<typename T,class close_policy,class invalid_value,int unique>
-    struct auto_any_helper
-    {
-        // return wrapped pointer
-        static T get( auto_any<T,close_policy,invalid_value,unique> const & t )
-        {
-            return t.m_t;
-        }
-
-        // return wrapped pointer and give up ownership
-        static T release( auto_any<T,close_policy,invalid_value,unique> & t )
-        {
-            // Fix-up the invalid_value type on older compilers
-            typedef typename detail::fixup_invalid_value<invalid_value>::
-                template rebind<T>::type invalid_value_type;
-
-            T tmpT = t.m_t;
-            t.m_t = static_cast<T>( invalid_value_type() );
-            return tmpT;
-        }
-
-        // destroy designated object and store new pointer
-        static void reset( auto_any<T,close_policy,invalid_value,unique> & t, T newT )
-        {
-            if( t.m_t != newT )
-            {
-                if( t.valid() )
-                {
-                    close_policy::close( t.m_t );
-                }
-                t.m_t = newT;
-            }
-        }
-
-        typedef typename auto_any<T,close_policy,invalid_value,unique>::element_type element_type;
-
-        // return the address of the wrapped pointer
-        static element_type* address( auto_any<T,close_policy,invalid_value,unique> & t )
-        {
-            // check to make sure the wrapped object is in the invalid state
-            assert( !t.valid() );
-            return address_of( t.m_t );
-        }
-    };
-}
-
-// return wrapped resource
-template<typename T,class close_policy,class invalid_value,int unique>
-inline T get( auto_any<T,close_policy,invalid_value,unique> const & t )
-{
-    return detail::auto_any_helper<T,close_policy,invalid_value,unique>::get( t );
-}
-
-// return true if the auto_any contains a currently valid resource
-template<typename T,class close_policy,class invalid_value,int unique>
-inline bool valid( auto_any<T,close_policy,invalid_value,unique> const & t )
-{
-    return t;
-}
-
-// return wrapped resource and give up ownership
-template<typename T,class close_policy,class invalid_value,int unique>
-inline T release( auto_any<T,close_policy,invalid_value,unique> & t )
-{
-    return detail::auto_any_helper<T,close_policy,invalid_value,unique>::release( t );
-}
-
-// destroy designated object and store new resource
-template<typename T,class close_policy,class invalid_value,int unique>
-inline void reset( auto_any<T,close_policy,invalid_value,unique> & t )
-{
-    typedef typename detail::fixup_invalid_value<invalid_value>::
-        template rebind<T>::type invalid_value_type;
-    detail::auto_any_helper<T,close_policy,invalid_value,unique>::reset( t, invalid_value_type() );
-}
-
-// destroy designated object and store new resource
-template<typename T,class close_policy,class invalid_value,int unique,typename U>
-inline void reset( auto_any<T,close_policy,invalid_value,unique> & t, U newT )
-{
-    detail::auto_any_helper<T,close_policy,invalid_value,unique>::reset( t, newT );
-}
-
-// swap the contents of two shared_any objects
-template<typename T,class close_policy,class invalid_value,int unique>
-void swap( auto_any<T,close_policy,invalid_value,unique> & left, 
-           auto_any<T,close_policy,invalid_value,unique> & right )
-{
-    auto_any<T,close_policy,invalid_value,unique> tmp( left );
-    left = right;
-    right = tmp;
-}
-
-// return the address of the wrapped resource
-// WARNING: this will assert if the value of the resource is
-// anything other than invalid_value.
-template<typename T,class close_policy,class invalid_value,int unique>
-inline typename auto_any<T,close_policy,invalid_value,unique>::element_type* 
-    address( auto_any<T,close_policy,invalid_value,unique> & t )
-{
-    return detail::auto_any_helper<T,close_policy,invalid_value,unique>::address( t );
-}
-
-#pragma warning(pop)
-
-#endif
-
-// This causes the auto_* typedefs to be defined
-DECLARE_SMART_ANY_TYPEDEFS(auto)
-
-#if defined(_OBJBASE_H_) & !defined(AUTO_ANY_CO_INIT)
-# define AUTO_ANY_CO_INIT
-  typedef auto_any<HRESULT,close_co,co_not_init>                            auto_co_close;
-
-  // Helper class for balancing calls to CoInitialize and CoUninitialize
-  struct auto_co_init
-  {
-      explicit auto_co_init( DWORD dwCoInit = COINIT_APARTMENTTHREADED )
-          : m_hr( smart_co_init_helper( dwCoInit ) )
-      {
-      }
-      HRESULT hresult() const
-      {
-          return get(m_hr);
-      }
-      auto_co_close const m_hr;
-  private:
-      auto_co_init & operator=( auto_co_init const & );
-  };
-#endif
diff --git a/third_party/smartany/scoped_any.h b/third_party/smartany/scoped_any.h
deleted file mode 100644
index 829f7ed..0000000
--- a/third_party/smartany/scoped_any.h
+++ /dev/null
@@ -1,257 +0,0 @@
-//+---------------------------------------------------------------------------
-//
-//  Copyright ( C ) Microsoft, 2002.
-//
-//  File:       scoped_any.h
-//
-//  Contents:   automatic resource management, a-la std::scoped_ptr
-//
-//  Classes:    scoped_any<> and various typedefs
-//
-//  Functions:  get
-//              reset
-//              release
-//              valid
-//              address
-//
-//  Author:     Eric Niebler ( ericne@microsoft.com )
-//
-//----------------------------------------------------------------------------
-
-#ifndef SCOPED_ANY
-#define SCOPED_ANY
-#include <cassert>
-#include "smart_any_fwd.h"
-
-#pragma warning(push)
-
-// 4284 warning for operator-> returning non-pointer;
-//      compiler issues it even if -> is not used for the specific instance
-#pragma warning(disable: 4284) 
-
-namespace detail
-{
-    // friend function definitions go in scoped_any_helper
-    template<typename T,class close_policy,class invalid_value,int unique>
-    struct scoped_any_helper;
-}
-
-// wrap a resource to enforce strict ownership and ensure proper cleanup
-template<typename T,class close_policy,class invalid_value,int unique>
-class scoped_any
-{
-    // disallow copy and assignment
-    scoped_any( scoped_any<T,close_policy,invalid_value,unique> const & );
-    scoped_any<T,close_policy,invalid_value,unique> & operator=( 
-        scoped_any<T,close_policy,invalid_value,unique> const & );
-
-    // disallow comparison of scoped_any's
-    bool operator==( detail::safe_bool ) const;
-    bool operator!=( detail::safe_bool ) const;
-
-    typedef detail::safe_types<T,close_policy>  safe_types;
-
-public:
-    typedef typename detail::holder<T>::type    element_type;
-    typedef close_policy                        close_policy_type;
-    typedef typename safe_types::pointer_type   pointer_type;
-    typedef typename safe_types::reference_type reference_type;
-
-    // Fix-up the invalid_value type on older compilers
-    typedef typename detail::fixup_invalid_value<invalid_value>::
-        template rebind<T>::type invalid_value_type;
-
-    friend struct detail::scoped_any_helper<T,close_policy,invalid_value,unique>;
-
-    // construct from object pointer
-    explicit scoped_any( T t = invalid_value_type() )
-        : m_t( t )
-    {
-    }
-
-    // destroy the object
-    ~scoped_any()
-    {
-        if( valid() )
-        {
-            close_policy::close( m_t );
-        }
-    }
-
-    // return pointer to class object (assume pointer)
-    pointer_type operator->() const
-    {
-        #ifdef SMART_ANY_PTS
-        // You better not be applying operator-> to a handle!
-        static detail::static_assert<!detail::is_handle<T>::value> const cannot_dereference_a_handle;
-        #endif
-        assert( valid() );
-        return safe_types::to_pointer( m_t );
-    }
-
-    // for use when scoped_any appears in a conditional
-    operator detail::safe_bool() const
-    {
-        return valid() ? detail::safe_true : detail::safe_false;
-    }
-
-    // for use when scoped_any appears in a conditional
-    bool operator!() const
-    {
-        return ! valid();
-    }
-
-    #ifdef SMART_ANY_PTS
-    // if this scoped_any is managing an array, we can use operator[] to index it
-    typename detail::deref<T>::type operator[]( int i ) const
-    {
-        static detail::static_assert<!detail::is_handle<T>::value> const cannot_dereference_a_handle;
-        static detail::static_assert<!detail::is_delete<close_policy>::value> const accessed_like_an_array_but_not_deleted_like_an_array;
-        assert( valid() );
-        return m_t[ i ];
-    }
-
-    // unary operator* lets you write code like:
-    // scoped_any<foo*,close_delete> pfoo( new foo );
-    // foo & f = *pfoo;
-    reference_type operator*() const
-    {
-        static detail::static_assert<!detail::is_handle<T>::value> const cannot_dereference_a_handle;
-        assert( valid() );
-        return smart_types::to_reference( m_t );
-    }
-    #endif
-
-private:
-
-    bool valid() const
-    {
-        // see if the managed resource is in the invalid state.
-        return m_t != static_cast<T>( invalid_value_type() );
-    }
-
-    // the wrapped object
-    element_type m_t;
-};
-
-namespace detail
-{
-    // friend function definitions go in scoped_any_helper
-    template<typename T,class close_policy,class invalid_value,int unique>
-    struct scoped_any_helper
-    {
-        // return wrapped pointer
-        static T get( scoped_any<T,close_policy,invalid_value,unique> const & t )
-        {
-            return t.m_t;
-        }
-
-        // return wrapped pointer and give up ownership
-        static T release( scoped_any<T,close_policy,invalid_value,unique> & t )
-        {
-            // Fix-up the invalid_value type on older compilers
-            typedef typename detail::fixup_invalid_value<invalid_value>::
-                template rebind<T>::type invalid_value_type;
-
-            T tmpT = t.m_t;
-            t.m_t = static_cast<T>( invalid_value_type() );
-            return tmpT;
-        }
-
-        // destroy designated object and store new pointer
-        static void reset( scoped_any<T,close_policy,invalid_value,unique> & t, T newT )
-        {
-            if( t.m_t != newT )
-            {
-                if( t.valid() )
-                {
-                    close_policy::close( t.m_t );
-                }
-                t.m_t = newT;
-            }
-        }
-
-        typedef typename scoped_any<T,close_policy,invalid_value,unique>::element_type element_type;
-
-        // return the address of the wrapped pointer
-        static element_type* address( scoped_any<T,close_policy,invalid_value,unique> & t )
-        {
-            // check to make sure the wrapped object is in the invalid state
-            assert( !t.valid() );
-            return address_of( t.m_t );
-        }
-    };
-}
-
-// return wrapped resource
-template<typename T,class close_policy,class invalid_value,int unique>
-inline T get( scoped_any<T,close_policy,invalid_value,unique> const & t )
-{
-    return detail::scoped_any_helper<T,close_policy,invalid_value,unique>::get( t );
-}
-
-// return true if the scoped_any contains a currently valid resource
-template<typename T,class close_policy,class invalid_value,int unique>
-inline bool valid( scoped_any<T,close_policy,invalid_value,unique> const & t )
-{
-    return t;
-}
-
-// return wrapped resource and give up ownership
-template<typename T,class close_policy,class invalid_value,int unique>
-inline T release( scoped_any<T,close_policy,invalid_value,unique> & t )
-{
-    return detail::scoped_any_helper<T,close_policy,invalid_value,unique>::release( t );
-}
-
-// destroy designated object and store new resource
-template<typename T,class close_policy,class invalid_value,int unique>
-inline void reset( scoped_any<T,close_policy,invalid_value,unique> & t )
-{
-    typedef typename detail::fixup_invalid_value<invalid_value>::
-        template rebind<T>::type invalid_value_type;
-    detail::scoped_any_helper<T,close_policy,invalid_value,unique>::reset( t, invalid_value_type() );
-}
-
-// destroy designated object and store new resource
-template<typename T,class close_policy,class invalid_value,int unique,typename U>
-inline void reset( scoped_any<T,close_policy,invalid_value,unique> & t, U newT )
-{
-    detail::scoped_any_helper<T,close_policy,invalid_value,unique>::reset( t, newT );
-}
-
-// return the address of the wrapped resource
-// WARNING: this will assert if the value of the resource is
-// anything other than invalid_value.
-template<typename T,class close_policy,class invalid_value,int unique>
-inline typename scoped_any<T,close_policy,invalid_value,unique>::element_type* 
-    address( scoped_any<T,close_policy,invalid_value,unique> & t )
-{
-    return detail::scoped_any_helper<T,close_policy,invalid_value,unique>::address( t );
-}
-
-#pragma warning(pop)
-
-#endif
-
-// This causes the scoped_* typedefs to be defined
-DECLARE_SMART_ANY_TYPEDEFS(scoped)
-
-#if defined(_OBJBASE_H_) & !defined(SCOPED_ANY_CO_INIT)
-# define SCOPED_ANY_CO_INIT
-  typedef scoped_any<HRESULT,close_co,co_not_init>                            scoped_co_close;
-
-  // Helper class for balancing calls to CoInitialize and CoUninitialize
-  struct scoped_co_init
-  {
-      explicit scoped_co_init( DWORD dwCoInit = COINIT_APARTMENTTHREADED )
-          : m_hr( smart_co_init_helper( dwCoInit ) )
-      {
-      }
-      HRESULT hresult() const
-      {
-          return get(m_hr);
-      }
-      scoped_co_close const m_hr;
-  };
-#endif
diff --git a/third_party/smartany/shared_any.cc b/third_party/smartany/shared_any.cc
deleted file mode 100644
index 064001d..0000000
--- a/third_party/smartany/shared_any.cc
+++ /dev/null
@@ -1,246 +0,0 @@
-//+---------------------------------------------------------------------------
-//
-//  Copyright ( C ) Microsoft, 2002.
-//
-//  File:       shared_any.cpp
-//
-//  Contents:   pool allocator for reference counts
-//
-//  Classes:    ref_count_allocator and helpers
-//
-//  Functions:
-//
-//  Author:     Eric Niebler ( ericne@microsoft.com )
-//
-//----------------------------------------------------------------------------
-
-#ifdef _MT
-# ifndef _WIN32_WINNT
-#  define _WIN32_WINNT 0x0403
-# endif
-# include <windows.h>
-# include <unknwn.h>
-#endif
-
-#include <cassert>
-#include <functional>  // for std::less
-#include <algorithm>   // for std::swap
-
-#pragma warning(push)
-// C4640: construction of local static object is not thread-safe
-#pragma warning(disable : 4640)
-#include "shared_any.h"
-#include "scoped_any.h"
-#pragma warning(pop)
-
-namespace detail
-{
-    struct critsec
-    {
-#ifdef _MT
-        CRITICAL_SECTION m_cs;
-
-        critsec()
-        {
-            InitializeCriticalSectionAndSpinCount( &m_cs, 4000 );
-        }
-        ~critsec()
-        {
-            DeleteCriticalSection( &m_cs );
-        }
-        void enter()
-        {
-            EnterCriticalSection( &m_cs );
-        }
-        void leave()
-        {
-            LeaveCriticalSection( &m_cs );
-        }
-#endif
-    };
-
-    namespace
-    {
-        critsec g_critsec;
-    }
-
-    struct lock
-    {
-#ifdef _MT
-        critsec & m_cs;
-
-        explicit lock( critsec & cs )
-            : m_cs(cs)
-        {
-            m_cs.enter();
-        }
-        ~lock()
-        {
-            m_cs.leave();
-        }
-#else
-        explicit lock( critsec & )
-        {
-        }
-#endif
-    private:
-        lock( lock const & );
-        lock & operator=( lock const & );
-    };
-
-    struct ref_count_block
-    {
-        static long const s_sizeBlock = 256;
-
-        short m_free_list; // offset to start of freelist
-        short m_available; // count of refcounts in this block that are available
-        long  m_refcounts[ s_sizeBlock ];
-
-        ref_count_block()
-          : m_free_list(0), m_available(s_sizeBlock)
-        {
-            for( long l=0; l<s_sizeBlock; ++l )
-                m_refcounts[l] = l+1;
-        }
-
-        bool empty() const // throw()
-        {
-            return s_sizeBlock == m_available;
-        }
-
-        bool full() const // throw()
-        {
-            return 0 == m_available;
-        }
-
-        long volatile *alloc( lock & )
-        {
-            assert( 0 != m_available );
-            long *refcount = m_refcounts + m_free_list;
-            m_free_list = static_cast<short>( *refcount );
-            --m_available;
-            return refcount;
-        }
-
-        void free( long volatile *refcount, lock & ) // throw()
-        {
-            assert( owns( refcount ) );
-            *refcount = m_free_list;
-            m_free_list = static_cast<short>( refcount - m_refcounts );
-            ++m_available;
-        }
-
-        bool owns( long volatile *refcount ) const // throw()
-        {
-            return ! std::less<void*>()( const_cast<long*>( refcount ), const_cast<long*>( m_refcounts ) ) &&
-                    std::less<void*>()( const_cast<long*>( refcount ), const_cast<long*>( m_refcounts ) + s_sizeBlock );
-        }
-    };
-
-
-    struct ref_count_allocator::node
-    {
-        node           *m_next;
-        node           *m_prev;
-        ref_count_block m_block;
-        explicit node( node *next=0, node *prev=0 )
-        : m_next(next), m_prev(prev), m_block()
-        {
-            if( m_next )
-                m_next->m_prev = this;
-            if( m_prev )
-                m_prev->m_next = this;
-        }
-    };
-
-
-    ref_count_allocator::ref_count_allocator()
-      : m_list_blocks(0), m_last_alloc(0), m_last_free(0)
-    {
-    }
-
-    ref_count_allocator::~ref_count_allocator()
-    {
-        // Just leak the blocks. It's ok, really.
-        // If you need to clean up the blocks and
-        // you are certain that no refcounts are
-        // outstanding, you can use the finalize()
-        // method to force deallocation
-    }
-
-    void ref_count_allocator::finalize()
-    {
-        lock l( g_critsec );
-        for( node *next; m_list_blocks; m_list_blocks=next )
-        {
-            next = m_list_blocks->m_next;
-            delete m_list_blocks;
-        }
-        m_last_alloc = 0;
-        m_last_free = 0;
-    }
-
-    long volatile *ref_count_allocator::alloc()
-    {
-        lock l( g_critsec );
-        if( ! m_last_alloc || m_last_alloc->m_block.full() )
-        {
-            for( m_last_alloc = m_list_blocks;
-                m_last_alloc && m_last_alloc->m_block.full();
-                m_last_alloc = m_last_alloc->m_next );
-            if( ! m_last_alloc )
-            {
-                m_last_alloc = new( std::nothrow ) node( m_list_blocks );
-                if( ! m_last_alloc )
-                    return 0;
-                m_list_blocks = m_last_alloc;
-            }
-        }
-        return m_last_alloc->m_block.alloc( l );
-    }
-
-    long volatile *ref_count_allocator::alloc( long val )
-    {
-        long volatile *refcount = alloc();
-        *refcount = val;
-        return refcount;
-    }
-
-    void ref_count_allocator::free( long volatile *refcount ) // throw()
-    {
-        // don't rearrange the order of these locals!
-        scoped_any<node*,close_delete> scoped_last_free;
-        lock l( g_critsec );
-
-        if( ! m_last_free || ! m_last_free->m_block.owns( refcount ) )
-        {
-            for( m_last_free = m_list_blocks;
-                m_last_free && ! m_last_free->m_block.owns( refcount );
-                m_last_free = m_last_free->m_next );
-        }
-
-        assert( m_last_free && m_last_free->m_block.owns( refcount ) );
-        m_last_free->m_block.free( refcount, l );
-
-        if( m_last_free != m_list_blocks && m_last_free->m_block.empty() )
-        {
-            if( 0 != ( m_last_free->m_prev->m_next = m_last_free->m_next ) )
-                m_last_free->m_next->m_prev = m_last_free->m_prev;
-
-            if( ! m_list_blocks->m_block.empty() )
-            {
-                m_last_free->m_next = m_list_blocks;
-                m_last_free->m_prev = 0;
-                m_list_blocks->m_prev = m_last_free;
-                m_list_blocks = m_last_free;
-            }
-            else
-                reset( scoped_last_free, m_last_free ); // deleted after critsec is released
-
-            m_last_free = 0;
-        }
-    }
-
-    // Here is the global reference count allocator.
-    ref_count_allocator ref_count_allocator::instance;
-}
diff --git a/third_party/smartany/shared_any.h b/third_party/smartany/shared_any.h
deleted file mode 100644
index a6a42f4..0000000
--- a/third_party/smartany/shared_any.h
+++ /dev/null
@@ -1,412 +0,0 @@
-//+---------------------------------------------------------------------------
-//
-//  Copyright ( C ) Microsoft, 2002.
-//
-//  File:       shared_any.h
-//
-//  Contents:   automatic resource management
-//
-//  Classes:    shared_any<> and various typedefs
-//
-//  Functions:  get
-//              reset
-//              valid
-//
-//  Author:     Eric Niebler ( ericne@microsoft.com )
-//
-//----------------------------------------------------------------------------
-
-
-#ifndef SHARED_ANY
-#define SHARED_ANY
-
-#include <cassert>
-#include <functional>  // for std::less
-#include <algorithm>   // for std::swap
-#include "smart_any_fwd.h"
-
-namespace detail
-{
-    class ref_count_allocator
-    {
-        struct  node;
-        node   *m_list_blocks;
-        node   *m_last_alloc;
-        node   *m_last_free;
-        
-        ref_count_allocator();
-        ~ref_count_allocator();
-    public:
-        void finalize();
-        long volatile *alloc();
-        long volatile *alloc( long val );
-        void free( long volatile *refcount );
-
-        static ref_count_allocator instance;
-    };
-
-    template<typename T,class close_policy,class invalid_value,int unique>
-    struct shared_any_helper;
-
-    template<typename Super>
-    struct shared_holder : Super
-    {
-        explicit shared_holder( typename Super::type t )
-            : Super( t )
-        {
-        }
-
-        shared_holder( shared_holder const & that )
-            : Super( that )
-        {
-            if( Super::valid() )
-            {
-                Super::inc_ref();
-            }
-        }
-
-        ~shared_holder()
-        {
-            if( Super::valid() )
-            {
-                Super::dec_ref();
-            }
-        }
-    };
-
-    template<typename T,class invalid_value_type>
-    struct intrusive
-    {
-        typedef T type;
-
-        explicit intrusive( T t )
-            : m_t( t )
-        {
-        }
-
-        bool valid() const
-        {
-            return m_t != static_cast<T>( invalid_value_type() );
-        }
-        
-        void inc_ref()
-        {
-            m_t->AddRef();
-        }
-        
-        void dec_ref()
-        {
-            if( 0 == m_t->Release() )
-            {
-                m_t = static_cast<T>( invalid_value_type() );
-            }
-        }
-        
-        T m_t;
-    };
-    
-    template<typename T,class close_policy,class invalid_value_type>
-    struct nonintrusive
-    {
-        typedef T type;
-        
-        explicit nonintrusive( T t )
-            : m_t( t ),
-              m_ref( 0 )
-        {
-            if( valid() )
-            {
-                m_ref = ref_count_allocator::instance.alloc(1L);
-                if( ! m_ref )
-                {
-                    m_t = static_cast<T>( invalid_value_type() );
-                    throw std::bad_alloc();
-                }
-            }
-        }
-        
-        bool valid() const
-        {
-            return m_t != static_cast<T>( invalid_value_type() );
-        }
-        
-        void inc_ref()
-        {
-            ::InterlockedIncrement( m_ref );
-        }
-        
-        void dec_ref()
-        {
-            if( 0L == ::InterlockedDecrement( m_ref ) )
-            {
-                ref_count_allocator::instance.free( m_ref );
-                m_ref = 0;
-                close_policy::close( m_t );
-                m_t = static_cast<T>( invalid_value_type() );
-            }
-        }
-        
-        typename holder<T>::type    m_t;
-        long volatile              *m_ref;
-    };
-
-    template<class close_policy>
-    struct is_close_release_com
-    {
-        static bool const value = false;
-    };
-    template<>
-    struct is_close_release_com<close_release_com>
-    {
-        static bool const value = true;
-    };
-
-    // credit Rani Sharoni for showing me how to implement
-    // is_com_ptr on VC7. This is deeply magical code.
-    template<typename T>
-    struct is_com_ptr
-    {
-    private:
-        struct maybe
-        {
-            operator IUnknown*() const;
-            operator T();
-        };
-
-        template<typename U>
-        static yes    check(T, U);    
-        static no     check(IUnknown*, int);
-        static maybe  get();
-    public:
-        static bool const value = sizeof(check(get(),0)) == sizeof(yes);
-    };
-
-    template<>
-    struct is_com_ptr<IUnknown*>
-    {
-        static bool const value = true;
-    };
-}
-
-template<typename T,class close_policy,class invalid_value,int unique>
-class shared_any
-{
-    typedef detail::safe_types<T,close_policy>  safe_types;
-
-    // disallow comparison of shared_any's
-    bool operator==( detail::safe_bool ) const;
-    bool operator!=( detail::safe_bool ) const;
-
-public:
-    typedef typename detail::holder<T>::type    element_type;
-    typedef close_policy                        close_policy_type;
-    typedef typename safe_types::pointer_type   pointer_type;
-    typedef typename safe_types::reference_type reference_type;
-
-    // Fix-up the invalid_value type on older compilers
-    typedef typename detail::fixup_invalid_value<invalid_value>::
-        template rebind<T>::type invalid_value_type;
-
-    friend struct detail::shared_any_helper<T,close_policy,invalid_value,unique>;
-
-    // default construct
-    shared_any()
-        : m_held( static_cast<T>( invalid_value_type() ) )
-    {
-    }
-
-    // construct from object. If we fail to allocate a reference count,
-    // then the T object is closed, and a bad_alloc exception is thrown.
-    explicit shared_any( T t )
-    try : m_held( t )
-    {
-    }
-    catch( std::bad_alloc & )
-    {
-        close_policy::close( t );
-        throw;
-    }
-
-    // construct from another shared_any, incrementing ref count.
-    // Only throws if T's copy-c'tor throws, in which case, ref-count
-    // is unchanged.
-    shared_any( shared_any<T,close_policy,invalid_value,unique> const & right )
-        : m_held( right.m_held )
-    {
-    }
-
-    // construct from an auto_any, taking ownership. If allocation
-    // fails, auto_any retains ownership.
-    shared_any( auto_any<T,close_policy,invalid_value,unique> & right )
-        : m_held( get( right ) )
-    {
-        release( right );
-    }
-
-    // assign from another shared_any
-    shared_any<T,close_policy,invalid_value,unique> & operator=(
-        shared_any<T,close_policy,invalid_value,unique> const & right )
-    {
-        shared_any<T,close_policy,invalid_value,unique>( right ).swap( *this );
-        return *this;
-    }
-
-    // assign from an auto_any
-    shared_any<T,close_policy,invalid_value,unique> & operator=(
-        auto_any<T,close_policy,invalid_value,unique> & right )
-    {
-        shared_any<T,close_policy,invalid_value,unique>( right ).swap( *this );
-        return *this;
-    }
-
-    operator detail::safe_bool() const
-    {
-        return m_held.valid() ? detail::safe_true : detail::safe_false;
-    }
-
-    bool operator!() const
-    {
-        return ! m_held.valid();
-    }
-
-    // return pointer to class object (assume pointer)
-    pointer_type operator->() const
-    {
-        #ifdef SMART_ANY_PTS
-        // You better not be applying operator-> to a handle!
-        static detail::static_assert<!detail::is_handle<T>::value> const cannot_dereference_a_handle;
-        #endif
-        assert( m_held.valid() );
-        return safe_types::to_pointer( m_held.m_t );
-    }
-
-    #ifdef SMART_ANY_PTS
-    // if this shared_any is managing an array, we can use operator[] to index it
-    typename detail::deref<T>::type operator[]( int i ) const
-    {
-        static detail::static_assert<!detail::is_handle<T>::value> const cannot_dereference_a_handle;
-        static detail::static_assert<!detail::is_delete<close_policy>::value> const accessed_like_an_array_but_not_deleted_like_an_array;
-        assert( m_held.valid() );
-        return m_held.m_t[ i ];
-    }
-
-    // unary operator* lets you write code like:
-    // shared_any<foo*,close_delete> pfoo( new foo );
-    // foo & f = *pfoo;
-    reference_type operator*() const
-    {
-        static detail::static_assert<!detail::is_handle<T>::value> const cannot_dereference_a_handle;
-        assert( m_held.valid() );
-        return safe_types::to_reference( m_held.m_t );
-    }
-    #endif
-
-private:
-
-    void swap( shared_any<T,close_policy,invalid_value,unique> & right )
-    {
-        using std::swap;
-        swap( m_held, right.m_held );
-    }
-
-    // if we are wrapping a COM object, then use COM's reference counting.
-    // otherwise, use our own reference counting.
-    typedef typename detail::select<
-        detail::is_com_ptr<T>::value && detail::is_close_release_com<close_policy>::value,
-        detail::intrusive<T,invalid_value_type>,
-        detail::nonintrusive<T,close_policy,invalid_value_type> >::type holder_policy;
-
-    detail::shared_holder<holder_policy> m_held;
-};
-
-namespace detail
-{
-    template<typename T,class close_policy,class invalid_value,int unique>
-    struct shared_any_helper
-    {
-        static T get( shared_any<T,close_policy,invalid_value,unique> const & t )
-        {
-            return t.m_held.m_t;
-        }
-
-        static void reset( shared_any<T,close_policy,invalid_value,unique> & t, T newT )
-        {
-            shared_any<T,close_policy,invalid_value,unique>( newT ).swap( t );
-        }
-
-        static void swap( shared_any<T,close_policy,invalid_value,unique> & left,
-                          shared_any<T,close_policy,invalid_value,unique> & right )
-        {
-            left.swap( right );
-        }
-    };
-}
-
-// return wrapped resource
-template<typename T,class close_policy,class invalid_value,int unique>
-inline T get( shared_any<T,close_policy,invalid_value,unique> const & t )
-{
-    return detail::shared_any_helper<T,close_policy,invalid_value,unique>::get( t );
-}
-
-// return true if the shared_any contains a currently valid resource
-template<typename T,class close_policy,class invalid_value,int unique>
-inline bool valid( shared_any<T,close_policy,invalid_value,unique> const & t )
-{
-    return t;
-}
-
-// destroy designated object
-template<typename T,class close_policy,class invalid_value,int unique>
-inline void reset( shared_any<T,close_policy,invalid_value,unique> & t )
-{
-    typedef typename detail::fixup_invalid_value<invalid_value>::
-        template rebind<T>::type invalid_value_type;
-    detail::shared_any_helper<T,close_policy,invalid_value,unique>::reset( t, invalid_value_type() );
-}
-
-// destroy designated object and store new resource
-template<typename T,class close_policy,class invalid_value,int unique,typename U>
-inline void reset( shared_any<T,close_policy,invalid_value,unique> & t, U newT )
-{
-    detail::shared_any_helper<T,close_policy,invalid_value,unique>::reset( t, newT );
-}
-
-// swap the contents of two shared_any objects
-template<typename T,class close_policy,class invalid_value,int unique>
-inline void swap( shared_any<T,close_policy,invalid_value,unique> & left, 
-                  shared_any<T,close_policy,invalid_value,unique> & right )
-{
-    detail::shared_any_helper<T,close_policy,invalid_value,unique>::swap( left, right );
-}
-
-// Define some relational operators on shared_* types so they
-// can be used in hashes and maps
-template<typename T,class close_policy,class invalid_value,int unique>
-inline bool operator==(
-    shared_any<T,close_policy,invalid_value,unique> const & left, 
-    shared_any<T,close_policy,invalid_value,unique> const & right )
-{
-    return get( left ) == get( right );
-}
-
-template<typename T,class close_policy,class invalid_value,int unique>
-inline bool operator!=(
-    shared_any<T,close_policy,invalid_value,unique> const & left, 
-    shared_any<T,close_policy,invalid_value,unique> const & right )
-{
-    return get( left ) != get( right );
-}
-
-template<typename T,class close_policy,class invalid_value,int unique>
-inline bool operator<(
-    shared_any<T,close_policy,invalid_value,unique> const & left, 
-    shared_any<T,close_policy,invalid_value,unique> const & right )
-{
-    return std::less<T>( get( left ), get( right ) );
-}
-
-#endif // SHARED_ANY
-
-// This causes the shared_* typedefs to be defined
-DECLARE_SMART_ANY_TYPEDEFS(shared)
diff --git a/third_party/smartany/smart_any_fwd.h b/third_party/smartany/smart_any_fwd.h
deleted file mode 100644
index 17e2571..0000000
--- a/third_party/smartany/smart_any_fwd.h
+++ /dev/null
@@ -1,1053 +0,0 @@
-//+---------------------------------------------------------------------------
-//
-//  Copyright ( C ) Microsoft, 2002.
-//
-//  File:       smart_any_fwd.h
-//
-//  Contents:   automatic resource management
-//
-//  Classes:    auto_any, scoped_any and shared_any
-//
-//  Functions:  get
-//              reset
-//              release
-//              valid
-//              address
-//
-//  Author:     Eric Niebler ( ericne@microsoft.com )
-//
-//----------------------------------------------------------------------------
-
-#ifndef SMART_ANY_FWD
-#define SMART_ANY_FWD
-
-#ifdef _MANAGED
-#pragma warning( push )
-#pragma warning( disable : 4244 )
-#include <vcclr.h>
-#pragma warning( pop )
-#endif
-
-// Check to see if partial template specialization is available
-#if _MSC_VER >= 1310
-#define SMART_ANY_PTS
-#endif
-
-// forward declare some invalid_value policy classes
-struct null_t;
-
-template<typename T,T value = T(0)>
-struct value_const;
-
-struct close_release_com;
-
-//
-// TEMPLATE CLASS auto_any
-//
-template<typename T,class close_policy,class invalid_value = null_t,int unique = 0>
-class auto_any;
-
-// return wrapped resource
-template<typename T,class close_policy,class invalid_value,int unique>
-T  get( auto_any<T,close_policy,invalid_value,unique> const & t );
-
-// return true if the auto_any contains a currently valid resource
-template<typename T,class close_policy,class invalid_value,int unique>
-bool valid( auto_any<T,close_policy,invalid_value,unique> const & t );
-
-// return wrapped resource and give up ownership
-template<typename T,class close_policy,class invalid_value,int unique>
-T release( auto_any<T,close_policy,invalid_value, unique> & t );
-
-// destroy designated object
-template<typename T,class close_policy,class invalid_value,int unique>
-void reset( auto_any<T,close_policy,invalid_value,unique> & t );
-
-// destroy designated object and store new resource
-template<typename T,class close_policy,class invalid_value,int unique,typename U>
-void reset( auto_any<T,close_policy,invalid_value,unique> & t, U newT );
-
-// swap the contents of two shared_any objects
-template<typename T,class close_policy,class invalid_value,int unique>
-void swap( auto_any<T,close_policy,invalid_value,unique> & left,
-           auto_any<T,close_policy,invalid_value,unique> & right );
-
-// return the address of the wrapped resource
-// WARNING: this will assert if the value of the resource is
-// anything other than invalid_value.
-//template<typename T,class close_policy,class invalid_value,int unique>
-//T* address( auto_any<T,close_policy,invalid_value,unique> & t );
-
-//
-// TEMPLATE CLASS shared_any
-//
-template<typename T,class close_policy,class invalid_value = null_t,int unique = 0>
-class shared_any;
-
-// return wrapped resource
-template<typename T,class close_policy,class invalid_value,int unique>
-T  get( shared_any<T,close_policy,invalid_value,unique> const & t );
-
-// return true if the auto_any contains a currently valid resource
-template<typename T,class close_policy,class invalid_value,int unique>
-bool valid( shared_any<T,close_policy,invalid_value,unique> const & t );
-
-// destroy designated object
-template<typename T,class close_policy,class invalid_value,int unique>
-void reset( shared_any<T,close_policy,invalid_value,unique> & t );
-
-// destroy designated object and store new resource
-template<typename T,class close_policy,class invalid_value,int unique,typename U>
-void reset( shared_any<T,close_policy,invalid_value,unique> & t, U newT );
-
-// swap the contents of two shared_any objects
-template<typename T,class close_policy,class invalid_value,int unique>
-void swap( shared_any<T,close_policy,invalid_value,unique> & left,
-           shared_any<T,close_policy,invalid_value,unique> & right );
-
-
-//
-// TEMPLATE CLASS scoped_any
-//
-template<typename T,class close_policy,class invalid_value = null_t,int unique = 0>
-class scoped_any;
-
-// return wrapped resource
-template<typename T,class close_policy,class invalid_value,int unique>
-T  get( scoped_any<T,close_policy,invalid_value,unique> const & t );
-
-// return true if the auto_any contains a currently valid resource
-template<typename T,class close_policy,class invalid_value,int unique>
-bool valid( scoped_any<T,close_policy,invalid_value,unique> const & t );
-
-// return wrapped resource and give up ownership
-template<typename T,class close_policy,class invalid_value,int unique>
-T release( scoped_any<T,close_policy,invalid_value, unique> & t );
-
-// destroy designated object
-template<typename T,class close_policy,class invalid_value,int unique>
-void reset( scoped_any<T,close_policy,invalid_value,unique> & t );
-
-// destroy designated object and store new resource
-template<typename T,class close_policy,class invalid_value,int unique,typename U>
-void reset( scoped_any<T,close_policy,invalid_value,unique> & t, U newT );
-
-// return the address of the wrapped resource
-// WARNING: this will assert if the value of the resource is
-// anything other than invalid_value.
-//template<typename T,class close_policy,class invalid_value,int unique>
-//T* address( scoped_any<T,close_policy,invalid_value,unique> & t );
-
-// close policy for objects allocated with new
-struct close_delete;
-
-namespace detail
-{
-    typedef char (&yes)[1];
-    typedef char (&no) [2];
-
-    struct dummy_struct
-    {
-        void dummy_method() {}
-    };
-
-    typedef void (dummy_struct::*safe_bool)();
-    safe_bool const safe_true  = &dummy_struct::dummy_method;
-    safe_bool const safe_false = 0;
-
-    // Because of older compilers, we can't always use
-    // null_t when we would like to.
-    template<class invalid_value>
-    struct fixup_invalid_value
-    {
-        template<typename> struct rebind { typedef invalid_value type; };
-    };
-
-    // for compile-time assertions
-    template<bool>
-    struct static_assert;
-
-    template<>
-    struct static_assert<true>
-    {
-        static_assert() {}
-    };
-
-    template<typename T>
-    struct static_init
-    {
-        static T const value;
-    };
-
-    template<typename T>
-    T const static_init<T>::value = T();
-
-    template<bool>
-    struct null_helper // unmanaged
-    {
-        template<typename T>
-        struct inner
-        {
-            static T const get()
-            {
-                return static_init<T>::value;
-            }
-        };
-    };
-
-    template<>
-    struct null_helper<true> // managed
-    {
-        template<typename T>
-        struct inner
-        {
-            static T const get()
-            {
-                return 0;
-            }
-        };
-    };
-
-    typedef char (&yes_t)[1];
-    typedef char (& no_t)[2];
-
-    template<bool>
-    struct select_helper
-    {
-        template<typename T,typename>
-        struct inner { typedef T type; };
-    };
-
-    template<>
-    struct select_helper<false>
-    {
-        template<typename,typename U>
-        struct inner { typedef U type; };
-    };
-
-    template<bool F,typename T,typename U>
-    struct select
-    {
-        typedef typename select_helper<F>::template inner<T,U>::type type;
-    };
-
-
-    template< bool >
-    struct holder_helper
-    {
-        template<typename T>
-        struct inner
-        {
-            typedef T type;
-        };
-    };
-
-    template< typename T >
-    struct remove_ref
-    {
-        typedef T type;
-    };
-
-    #ifdef SMART_ANY_PTS
-    template< typename T >
-    struct remove_ref<T&>
-    {
-        typedef T type;
-    };
-    #endif
-
-    template<typename T>
-    T* address_of( T & v )
-    {
-        return reinterpret_cast<T*>(
-            &const_cast<char&>(
-                reinterpret_cast<char const volatile &>(v)));
-    }
-
-    #ifndef _MANAGED
-
-    template<typename T>
-    struct is_managed
-    {
-        static bool const value = false;
-    };
-
-    #else
-
-    struct managed_convertible
-    {
-        managed_convertible( System::Object const volatile __gc* );
-        managed_convertible( System::Enum const volatile __gc* );
-        managed_convertible( System::ValueType const volatile __gc* );
-        managed_convertible( System::Delegate const volatile __gc* );
-    };
-
-    template<typename T>
-    struct is_managed
-    {
-    private:
-        static yes_t check( managed_convertible );
-        static no_t __cdecl check( ... );
-        static typename remove_ref<T>::type & make();
-    public:
-        static bool const value = sizeof( yes_t ) == sizeof( check( make() ) );
-    };
-
-    #ifdef SMART_ANY_PTS
-    template<typename T>
-    struct is_managed<T __gc&>
-    {
-        static bool const value = true;
-    };
-    template<typename T>
-    struct is_managed<T __gc*>
-    {
-        static bool const value = true;
-    };
-    template<typename T>
-    struct is_managed<T __gc*const>
-    {
-        static bool const value = is_managed<T __gc*>::value;
-    };
-    template<typename T>
-    struct is_managed<T __gc*volatile>
-    {
-        static bool const value = is_managed<T __gc*>::value;
-    };
-    template<typename T>
-    struct is_managed<T __gc*const volatile>
-    {
-        static bool const value = is_managed<T __gc*>::value;
-    };
-    #endif
-    template<>
-    struct is_managed<System::Void __gc*>
-    {
-        static bool const value = true;
-    };
-    template<>
-    struct is_managed<System::Void const __gc*>
-    {
-        static bool const value = true;
-    };
-    template<>
-    struct is_managed<System::Void volatile __gc*>
-    {
-        static bool const value = true;
-    };
-    template<>
-    struct is_managed<System::Void const volatile __gc*>
-    {
-        static bool const value = true;
-    };
-
-    template<>
-    struct holder_helper<true>
-    {
-        template<typename T>
-        struct inner
-        {
-            typedef gcroot<T> type;
-        };
-    };
-    #endif
-
-    template<typename T>
-    struct holder
-    {
-        typedef typename holder_helper<is_managed<T>::value>::template inner<T>::type type;
-    };
-
-    template<typename T>
-    struct is_delete
-    {
-        static bool const value = false;
-    };
-
-    template<>
-    struct is_delete<close_delete>
-    {
-        static bool const value = true;
-    };
-
-    // dummy type, don't define
-    struct smart_any_cannot_dereference;
-
-    // For use in implementing unary operator*
-    template<typename T>
-    struct deref
-    {
-        typedef smart_any_cannot_dereference type; // will cause a compile error by default
-    };
-
-    #ifndef SMART_ANY_PTS
-
-    // Old compiler needs extra help
-    template<>
-    struct fixup_invalid_value<null_t>
-    {
-        template<typename T> struct rebind { typedef value_const<T> type; };
-    };
-
-    #else
-
-    template<typename T,typename U>
-    struct same_type
-    {
-        static const bool value = false;
-    };
-
-    template<typename T>
-    struct same_type<T,T>
-    {
-        static const bool value = true;
-    };
-
-    // Handle reference types
-    template<typename T>
-    struct deref<T&>
-    {
-        typedef typename deref<T>::type type;
-    };
-
-    // Partially specialize for pointer types
-    template<typename T>
-    struct deref<T*>
-    {
-        typedef T& type; // The result of dereferencing a T*
-    };
-
-    // Partially specialize for pointer types
-    template<typename T>
-    struct deref<T*const>
-    {
-        typedef typename deref<T*>::type type; // The result of dereferencing a T*
-    };
-
-    // Partially specialize for pointer types
-    template<typename T>
-    struct deref<T*volatile>
-    {
-        typedef typename deref<T*>::type type; // The result of dereferencing a T*
-    };
-
-    // Partially specialize for pointer types
-    template<typename T>
-    struct deref<T*const volatile>
-    {
-        typedef typename deref<T*>::type type; // The result of dereferencing a T*
-    };
-
-    // Fully specialize for void*
-    template<>
-    struct deref<void*>
-    {
-        typedef smart_any_cannot_dereference type; // cannot dereference a void*
-    };
-
-    // Fully specialize for void const*
-    template<>
-    struct deref<void const*>
-    {
-        typedef smart_any_cannot_dereference type; // cannot dereference a void*
-    };
-
-    // Fully specialize for void volatile*
-    template<>
-    struct deref<void volatile*>
-    {
-        typedef smart_any_cannot_dereference type; // cannot dereference a void*
-    };
-
-    // Fully specialize for void const volatile*
-    template<>
-    struct deref<void const volatile*>
-    {
-        typedef smart_any_cannot_dereference type; // cannot dereference a void*
-    };
-
-    #ifdef _MANAGED
-    // Handle reference types
-    template<typename T>
-    struct deref<T __gc&>
-    {
-        typedef typename deref<T>::type type;
-    };
-
-    // Partially specialize for pointer types
-    template<typename T>
-    struct deref<T __gc*>
-    {
-        typedef T __gc& type; // The result of dereferencing a T __gc*
-    };
-
-    // Partially specialize for pointer types
-    template<typename T>
-    struct deref<T __gc*const>
-    {
-        typedef typename deref<T __gc*>::type type; // The result of dereferencing a T __gc*
-    };
-
-    // Partially specialize for pointer types
-    template<typename T>
-    struct deref<T __gc*volatile>
-    {
-        typedef typename deref<T __gc*>::type type; // The result of dereferencing a T __gc*
-    };
-
-    // Partially specialize for pointer types
-    template<typename T>
-    struct deref<T __gc*const volatile>
-    {
-        typedef typename deref<T __gc*>::type type; // The result of dereferencing a T __gc*
-    };
-
-    // Fully specialize for void*
-    template<>
-    struct deref<System::Void __gc*>
-    {
-        typedef smart_any_cannot_dereference type; // cannot dereference a System::Void __gc*
-    };
-
-    // Fully specialize for void const*
-    template<>
-    struct deref<System::Void const __gc*>
-    {
-        typedef smart_any_cannot_dereference type; // cannot dereference a System::Void __gc*
-    };
-
-    // Fully specialize for void volatile*
-    template<>
-    struct deref<System::Void volatile __gc*>
-    {
-        typedef smart_any_cannot_dereference type; // cannot dereference a System::Void __gc*
-    };
-
-    // Fully specialize for void const volatile*
-    template<>
-    struct deref<System::Void const volatile __gc*>
-    {
-        typedef smart_any_cannot_dereference type; // cannot dereference a System::Void __gc*
-    };
-    #endif
-
-    // The DECLARE_HANDLE macro in winnt.h defines a handle to be a pointer
-    // to a struct containing one member named "unused" of type int. We can
-    // use that information to make auto_any safer by disallowing actions like
-    // dereferencing a handle or calling delete on a handle.
-    template<typename T>
-    struct has_unused
-    {
-    private:
-        template<class U,int U::*> struct wrap_t;
-        template<typename U> static yes_t check( wrap_t<U,&U::unused>* );
-        template<typename U> static no_t  __cdecl check( ... );
-    public:
-        static bool const value = ( sizeof(check<T>(0)) == sizeof(yes_t) );
-    };
-
-    template<typename T>
-    struct is_handle_helper
-    {
-        static bool const value = ( sizeof(T)==sizeof(int) && has_unused<T>::value );
-    };
-
-    #ifdef _MANAGED
-    template<typename T>
-    struct is_handle_helper<T __gc&>
-    {
-        static bool const value = false;
-    };
-    #endif
-
-    template<>
-    struct is_handle_helper<smart_any_cannot_dereference>
-    {
-        static bool const value = false;
-    };
-
-    // used to see whether a given type T is a handle type or not.
-    template<typename T>
-    struct is_handle
-    {
-    private:
-        typedef typename remove_ref<typename deref<T>::type>::type deref_t;
-    public:
-        static bool const value =
-            ( same_type<T,void*>::value || is_handle_helper<deref_t>::value );
-    };
-    #endif
-
-    template<typename T,class close_policy>
-    struct safe_types
-    {
-        typedef T pointer_type;
-        typedef typename deref<T>::type reference_type;
-
-        static pointer_type to_pointer( T t )
-        {
-            return t;
-        }
-        static reference_type to_reference( T t )
-        {
-            return *t;
-        }
-    };
-
-    #ifdef SMART_ANY_PTS
-    template<typename T>
-    class no_addref_release : public T
-    {
-        unsigned long __stdcall AddRef();
-        unsigned long __stdcall Release();
-    };
-
-    // shouldn't be able to call AddRef or Release
-    // through a smart COM wrapper
-    template<typename T>
-    struct safe_types<T*,close_release_com>
-    {
-        typedef no_addref_release<T>* pointer_type;
-        typedef no_addref_release<T>& reference_type;
-
-        static pointer_type to_pointer( T* t )
-        {
-            return static_cast<pointer_type>( t );
-        }
-        static reference_type to_reference( T* t )
-        {
-            return *static_cast<pointer_type>( t );
-        }
-    };
-    #endif
-}
-
-// a generic close policy that uses a ptr to a function
-template<typename Fn, Fn Pfn>
-struct close_fun
-{
-    template<typename T>
-    static void close( T t )
-    {
-        Pfn( t );
-    }
-};
-
-// free an object allocated with new by calling delete
-struct close_delete
-{
-    template<typename T>
-    static void close( T * p )
-    {
-        // This will fail only if T is an incomplete type.
-        static detail::static_assert<0 != sizeof( T )> const cannot_delete_an_incomplete_type;
-
-        #ifdef SMART_ANY_PTS
-        // This checks to make sure we're not calling delete on a HANDLE
-        static detail::static_assert<!detail::is_handle<T*>::value> const cannot_delete_a_handle;
-        #endif
-
-        delete p;
-    }
-
-    #ifdef _MANAGED
-    template<typename T>
-    static void close( gcroot<T __gc*> const & p )
-    {
-        delete static_cast<T __gc*>( p );
-    }
-    #endif
-};
-
-// free an array allocated with new[] by calling delete[]
-struct close_delete_array
-{
-    template<typename T>
-    static void close( T * p )
-    {
-        // This will fail only if T is an incomplete type.
-        static detail::static_assert<0 != sizeof( T )> const cannot_delete_an_incomplete_type;
-
-        #ifdef SMART_ANY_PTS
-        // This checks to make sure we're not calling delete on a HANDLE
-        static detail::static_assert<!detail::is_handle<T*>::value> const cannot_delete_a_handle;
-        #endif
-
-        delete [] p;
-    }
-
-    //#ifdef _MANAGED
-    // This is broken because of compiler bugs
-    //template<typename T>
-    //static void close( gcroot<T __gc* __gc[]> const & p )
-    //{
-    //    delete [] static_cast<T __gc* __gc[]>( p );
-    //}
-    //#endif
-};
-
-// for releasing a COM object
-struct close_release_com
-{
-    template<typename T>
-    static void close( T p )
-    {
-        p->Release();
-    }
-};
-
-// for releasing a __gc IDisposable object
-struct close_dispose
-{
-    template<typename T>
-    static void close( T p )
-    {
-        p->Dispose();
-    }
-};
-
-// some generic invalid_value policies
-
-struct null_t
-{
-    template<typename T>
-    operator T const() const
-    {
-        return detail::null_helper<detail::is_managed<T>::value>::template inner<T>::get();
-    }
-};
-
-template<typename T,T value>
-struct value_const
-{
-    operator T const() const
-    {
-        return value;
-    }
-};
-
-template<typename T,T const* value_ptr>
-struct value_const_ptr
-{
-    operator T const&() const
-    {
-        return *value_ptr;
-    }
-};
-
-#ifdef SMART_ANY_PTS
-template<typename T, T const& value>
-struct value_ref
-{
-    operator T const&() const
-    {
-        return value;
-    }
-};
-#endif
-
-#endif // SMART_ANY_FWD
-
-
-//
-// Define some other useful close polcies
-//
-
-#if defined(_INC_STDLIB) | defined(_INC_MALLOC)
-typedef void (__cdecl *pfn_free_t)( void* );
-typedef close_fun<pfn_free_t,static_cast<pfn_free_t>(&free)>                close_free;
-#endif
-
-#if defined(_INC_STDIO) & !defined(SMART_CLOSE_FILE_PTR)
-# define SMART_CLOSE_FILE_PTR
-  // don't close a FILE* if it is stdin, stdout or stderr
-  struct close_file_ptr
-  {
-      static void close( FILE * pfile )
-      {
-          if( pfile != stdin && pfile != stdout && pfile != stderr )
-          {
-              fclose( pfile );
-          }
-      }
-  };
-#endif
-
-#ifdef _WINDOWS_
-
-# ifndef SMART_VIRTUAL_FREE
-# define SMART_VIRTUAL_FREE
-  // free memory allocated with VirtualAlloc
-  struct close_virtual_free
-  {
-      static void close( void * p )
-      {
-          ::VirtualFree( p, 0, MEM_RELEASE );
-      }
-  };
-# endif
-
-  typedef close_fun<BOOL (__stdcall *)( HANDLE ),CloseHandle>               close_handle;
-  typedef close_fun<BOOL (__stdcall *)( HANDLE ),FindClose>                 close_find;
-  typedef close_fun<BOOL (__stdcall *)( HANDLE ),FindCloseChangeNotification> close_find_change_notification;
-  typedef close_fun<BOOL (__stdcall *)( HINSTANCE ),FreeLibrary>            close_library;
-  typedef close_fun<LONG (__stdcall *)( HKEY ),RegCloseKey>                 close_regkey;
-  typedef close_fun<BOOL (__stdcall *)( LPCVOID ),UnmapViewOfFile>          close_file_view;
-  typedef close_fun<BOOL (__stdcall *)( HICON ),DestroyIcon>                close_hicon;
-  typedef close_fun<BOOL (__stdcall *)( HGDIOBJ ),DeleteObject>             close_hgdiobj;
-  typedef close_fun<BOOL (__stdcall *)( HACCEL ),DestroyAcceleratorTable>   close_haccel;
-  typedef close_fun<BOOL (__stdcall *)( HDC ),DeleteDC>                     close_hdc;
-  typedef close_fun<BOOL (__stdcall *)( HMENU ),DestroyMenu>                close_hmenu;
-  typedef close_fun<BOOL (__stdcall *)( HCURSOR ),DestroyCursor>            close_hcursor;
-  typedef close_fun<BOOL (__stdcall *)( HWND ),DestroyWindow>               close_window;
-  typedef close_fun<BOOL (__stdcall *)( HANDLE ),HeapDestroy>               close_heap_destroy;
-  typedef close_fun<HLOCAL (__stdcall *)( HLOCAL ),LocalFree>               close_local_free;
-  typedef close_fun<BOOL (__stdcall *)( HDESK ),CloseDesktop>               close_hdesk;
-  typedef close_fun<BOOL (__stdcall *)( HHOOK ),UnhookWindowsHookEx>        close_hhook;
-  typedef close_fun<BOOL (__stdcall *)( HWINSTA ),CloseWindowStation>       close_hwinsta;
-  typedef close_fun<BOOL (__stdcall *)( HANDLE ),DeregisterEventSource>     close_event_source;
-  typedef close_fun<HGLOBAL (__stdcall *)( HGLOBAL ),GlobalFree>            close_global_free;
-
-  typedef value_const<HANDLE,INVALID_HANDLE_VALUE>                          invalid_handle_t;
-#endif
-
-#ifdef _OLEAUTO_H_
-  typedef close_fun<void (__stdcall *)(BSTR),SysFreeString>                 close_bstr;
-#endif
-
-#ifdef __MSGQUEUE_H__
-  typedef close_fun<BOOL (__stdcall *)(HANDLE),CloseMsgQueue>               close_msg_queue;
-#endif
-
-#if defined(_WININET_) | defined(_DUBINET_)
-  typedef close_fun<BOOL (__stdcall *)(HINTERNET),InternetCloseHandle>      close_hinternet;
-#endif
-
-#ifdef _RAS_H_
-  typedef close_fun<DWORD (__stdcall *)( HRASCONN ),RasHangUp>              close_hrasconn;
-#endif
-
-#if defined(__RPCDCE_H__) & !defined(SMART_ANY_RPC)
-# define SMART_ANY_RPC
-  // for releaseing an rpc binding
-  struct close_rpc_binding
-  {
-      static void close( RPC_BINDING_HANDLE & h )
-      {
-          ::RpcBindingFree( &h );
-      }
-  };
-  // for releaseing an rpc binding vector
-  struct close_rpc_vector
-  {
-      static void close( RPC_BINDING_VECTOR __RPC_FAR * & p )
-      {
-          ::RpcBindingVectorFree( &p );
-      }
-  };
-  // for releasing a RPC string
-  struct close_rpc_string
-  {
-      static void close( unsigned char __RPC_FAR * & p )
-      {
-          ::RpcStringFreeA(&p);
-      }
-      static void close( unsigned short __RPC_FAR * & p )
-      {
-          ::RpcStringFreeW(&p);
-      }
-  };
-#endif
-
-#ifdef _WINSVC_
-  typedef close_fun<BOOL (__stdcall *)( SC_HANDLE ),CloseServiceHandle>     close_service;
-  typedef close_fun<BOOL (__stdcall *)( SC_LOCK ),UnlockServiceDatabase>    unlock_service;
-#endif
-
-#ifdef _WINSOCKAPI_
-  typedef int (__stdcall *pfn_closock_t)( SOCKET );
-  typedef close_fun<pfn_closock_t,static_cast<pfn_closock_t>(&closesocket)> close_socket;
-  typedef value_const<SOCKET,INVALID_SOCKET>                                invalid_socket_t;
-#endif
-
-#ifdef _OBJBASE_H_
-  // For use when releasing memory allocated with CoTaskMemAlloc
-  typedef close_fun<void (__stdcall*)( LPVOID ),CoTaskMemFree>              close_co_task_free;
-#endif
-
-
-//
-// Below are useful smart typedefs for some common Windows/CRT resource types.
-//
-
-#undef DECLARE_SMART_ANY_TYPEDEFS_STDIO
-#undef DECLARE_SMART_ANY_TYPEDEFS_WINDOWS
-#undef DECLARE_SMART_ANY_TYPEDEFS_OLEAUTO
-#undef DECLARE_SMART_ANY_TYPEDEFS_MSGQUEUE
-#undef DECLARE_SMART_ANY_TYPEDEFS_WININET
-#undef DECLARE_SMART_ANY_TYPEDEFS_RAS
-#undef DECLARE_SMART_ANY_TYPEDEFS_RPCDCE
-#undef DECLARE_SMART_ANY_TYPEDEFS_WINSVC
-#undef DECLARE_SMART_ANY_TYPEDEFS_WINSOCKAPI
-#undef DECLARE_SMART_ANY_TYPEDEFS_OBJBASE
-
-#define DECLARE_SMART_ANY_TYPEDEFS_STDIO(prefix)
-#define DECLARE_SMART_ANY_TYPEDEFS_WINDOWS(prefix)
-#define DECLARE_SMART_ANY_TYPEDEFS_OLEAUTO(prefix)
-#define DECLARE_SMART_ANY_TYPEDEFS_MSGQUEUE(prefix)
-#define DECLARE_SMART_ANY_TYPEDEFS_WININET(prefix)
-#define DECLARE_SMART_ANY_TYPEDEFS_RAS(prefix)
-#define DECLARE_SMART_ANY_TYPEDEFS_RPCDCE(prefix)
-#define DECLARE_SMART_ANY_TYPEDEFS_WINSVC(prefix)
-#define DECLARE_SMART_ANY_TYPEDEFS_WINSOCKAPI(prefix)
-#define DECLARE_SMART_ANY_TYPEDEFS_OBJBASE(prefix)
-
-#ifdef _INC_STDIO
-# undef  DECLARE_SMART_ANY_TYPEDEFS_STDIO
-# define DECLARE_SMART_ANY_TYPEDEFS_STDIO(prefix)                                                                       \
-  typedef prefix ## _any<FILE*,close_file_ptr>                                    prefix ## _file_ptr;
-#endif
-
-#ifdef _WINDOWS_
-# undef  DECLARE_SMART_ANY_TYPEDEFS_WINDOWS
-# define DECLARE_SMART_ANY_TYPEDEFS_WINDOWS(prefix)                                                                     \
-  typedef prefix ## _any<HKEY,close_regkey>                                       prefix ## _hkey;                      \
-  typedef prefix ## _any<HANDLE,close_find,invalid_handle_t>                      prefix ## _hfind;                     \
-  typedef prefix ## _any<HANDLE,close_find_change_notification,invalid_handle_t>  prefix ## _hfind_change_notification; \
-  typedef prefix ## _any<HANDLE,close_handle,invalid_handle_t>                    prefix ## _hfile;                     \
-  typedef prefix ## _any<HANDLE,close_handle,invalid_handle_t,1>                  prefix ## _communications_device;     \
-  typedef prefix ## _any<HANDLE,close_handle,invalid_handle_t,2>                  prefix ## _console_input;             \
-  typedef prefix ## _any<HANDLE,close_handle,invalid_handle_t,3>                  prefix ## _console_input_buffer;      \
-  typedef prefix ## _any<HANDLE,close_handle,invalid_handle_t,4>                  prefix ## _console_output;            \
-  typedef prefix ## _any<HANDLE,close_handle,invalid_handle_t,5>                  prefix ## _mailslot;                  \
-  typedef prefix ## _any<HANDLE,close_handle,invalid_handle_t,6>                  prefix ## _pipe;                      \
-  typedef prefix ## _any<HANDLE,close_handle>                                     prefix ## _handle;                    \
-  typedef prefix ## _any<HANDLE,close_handle,null_t,1>                            prefix ## _access_token;              \
-  typedef prefix ## _any<HANDLE,close_handle,null_t,2>                            prefix ## _event;                     \
-  typedef prefix ## _any<HANDLE,close_handle,null_t,3>                            prefix ## _file_mapping;              \
-  typedef prefix ## _any<HANDLE,close_handle,null_t,4>                            prefix ## _job;                       \
-  typedef prefix ## _any<HANDLE,close_handle,null_t,5>                            prefix ## _mutex;                     \
-  typedef prefix ## _any<HANDLE,close_handle,null_t,6>                            prefix ## _process;                   \
-  typedef prefix ## _any<HANDLE,close_handle,null_t,7>                            prefix ## _semaphore;                 \
-  typedef prefix ## _any<HANDLE,close_handle,null_t,8>                            prefix ## _thread;                    \
-  typedef prefix ## _any<HANDLE,close_handle,null_t,9>                            prefix ## _timer;                     \
-  typedef prefix ## _any<HANDLE,close_handle,null_t,10>                           prefix ## _completion_port;           \
-  typedef prefix ## _any<HDC,close_hdc>                                           prefix ## _hdc;                       \
-  typedef prefix ## _any<HICON,close_hicon>                                       prefix ## _hicon;                     \
-  typedef prefix ## _any<HMENU,close_hmenu>                                       prefix ## _hmenu;                     \
-  typedef prefix ## _any<HCURSOR,close_hcursor>                                   prefix ## _hcursor;                   \
-  typedef prefix ## _any<HPEN,close_hgdiobj,null_t,1>                             prefix ## _hpen;                      \
-  typedef prefix ## _any<HRGN,close_hgdiobj,null_t,2>                             prefix ## _hrgn;                      \
-  typedef prefix ## _any<HFONT,close_hgdiobj,null_t,3>                            prefix ## _hfont;                     \
-  typedef prefix ## _any<HBRUSH,close_hgdiobj,null_t,4>                           prefix ## _hbrush;                    \
-  typedef prefix ## _any<HBITMAP,close_hgdiobj,null_t,5>                          prefix ## _hbitmap;                   \
-  typedef prefix ## _any<HPALETTE,close_hgdiobj,null_t,6>                         prefix ## _hpalette;                  \
-  typedef prefix ## _any<HACCEL,close_haccel>                                     prefix ## _haccel;                    \
-  typedef prefix ## _any<HWND,close_window>                                       prefix ## _window;                    \
-  typedef prefix ## _any<HINSTANCE,close_library>                                 prefix ## _library;                   \
-  typedef prefix ## _any<LPVOID,close_file_view>                                  prefix ## _file_view;                 \
-  typedef prefix ## _any<LPVOID,close_virtual_free>                               prefix ## _virtual_ptr;               \
-  typedef prefix ## _any<HANDLE,close_heap_destroy>                               prefix ## _heap;                      \
-  typedef prefix ## _any<HLOCAL,close_local_free>                                 prefix ## _hlocal;                    \
-  typedef prefix ## _any<HDESK,close_hdesk>                                       prefix ## _hdesk;                     \
-  typedef prefix ## _any<HHOOK,close_hhook>                                       prefix ## _hhook;                     \
-  typedef prefix ## _any<HWINSTA,close_hwinsta>                                   prefix ## _hwinsta;                   \
-  typedef prefix ## _any<HANDLE,close_event_source>                               prefix ## _event_source;              \
-  typedef prefix ## _any<HGLOBAL,close_global_free>                               prefix ## _hglobal;
-#endif
-
-//
-// Define some other useful typedefs
-//
-
-#ifdef _OLEAUTO_H_
-# undef  DECLARE_SMART_ANY_TYPEDEFS_OLEAUTO
-# define DECLARE_SMART_ANY_TYPEDEFS_OLEAUTO(prefix)                                                                     \
-  typedef prefix ## _any<BSTR,close_bstr>                                         prefix ## _bstr;
-#endif
-
-#ifdef __MSGQUEUE_H__
-# undef  DECLARE_SMART_ANY_TYPEDEFS_MSGQUEUE
-# define DECLARE_SMART_ANY_TYPEDEFS_MSGQUEUE(prefix)                                                                    \
-  typedef prefix ## _any<HANDLE,close_msg_queue>                                  prefix ## _msg_queue;
-#endif
-
-#if defined(_WININET_) | defined(_DUBINET_)
-# undef  DECLARE_SMART_ANY_TYPEDEFS_WININET
-# define DECLARE_SMART_ANY_TYPEDEFS_WININET(prefix)                                                                     \
-  typedef prefix ## _any<HINTERNET,close_hinternet>                               prefix ## _hinternet;
-#endif
-
-#ifdef _RAS_H_
-# undef  DECLARE_SMART_ANY_TYPEDEFS_RAS
-# define DECLARE_SMART_ANY_TYPEDEFS_RAS(prefix)                                                                         \
-  typedef prefix ## _any<HRASCONN,close_hrasconn>                                 prefix ## _hrasconn;
-#endif
-
-#ifdef __RPCDCE_H__
-# undef DECLARE_SMART_ANY_TYPEDEFS_RPCDCE
-# ifdef UNICODE
-#   define DECLARE_SMART_ANY_TYPEDEFS_RPCDCE(prefix)                                                                    \
-    typedef prefix ## _any<RPC_BINDING_HANDLE,close_rpc_binding>                  prefix ## _rpc_binding;               \
-    typedef prefix ## _any<RPC_BINDING_VECTOR __RPC_FAR*,close_rpc_vector>        prefix ## _rpc_binding_vector;        \
-    typedef prefix ## _any<unsigned char __RPC_FAR*,close_rpc_string>             prefix ## _rpc_string_A;              \
-    typedef prefix ## _any<unsigned short __RPC_FAR*,close_rpc_string>            prefix ## _rpc_string_W;              \
-    typedef prefix ## _rpc_string_W                                               prefix ## _rpc_string;
-# else
-#   define DECLARE_SMART_ANY_TYPEDEFS_RPCDCE(prefix)                                                                    \
-    typedef prefix ## _any<RPC_BINDING_HANDLE,close_rpc_binding>                  prefix ## _rpc_binding;               \
-    typedef prefix ## _any<RPC_BINDING_VECTOR __RPC_FAR*,close_rpc_vector>        prefix ## _rpc_binding_vector;        \
-    typedef prefix ## _any<unsigned char __RPC_FAR*,close_rpc_string>             prefix ## _rpc_string_A;              \
-    typedef prefix ## _any<unsigned short __RPC_FAR*,close_rpc_string>            prefix ## _rpc_string_W;              \
-    typedef prefix ## _rpc_string_A                                               prefix ## _rpc_string;
-# endif
-#endif
-
-#ifdef _WINSVC_
-# undef  DECLARE_SMART_ANY_TYPEDEFS_WINSVC
-# define DECLARE_SMART_ANY_TYPEDEFS_WINSVC(prefix)                                                                      \
-  typedef prefix ## _any<SC_HANDLE,close_service>                                 prefix ## _service;                   \
-  typedef prefix ## _any<SC_LOCK,unlock_service>                                  prefix ## _service_lock;
-#endif
-
-#ifdef _WINSOCKAPI_
-# undef  DECLARE_SMART_ANY_TYPEDEFS_WINSOCKAPI
-# define DECLARE_SMART_ANY_TYPEDEFS_WINSOCKAPI(prefix)                                                                  \
-  typedef prefix ## _any<SOCKET,close_socket,invalid_socket_t>                    prefix ## _socket;
-#endif
-
-#if defined(_OBJBASE_H_) & !defined(SMART_ANY_CO_INIT)
-# define SMART_ANY_CO_INIT
-  inline HRESULT smart_co_init_helper( DWORD dwCoInit )
-  {
-      (void) dwCoInit;
-#     if (_WIN32_WINNT >= 0x0400 ) | defined(_WIN32_DCOM)
-          return ::CoInitializeEx(0,dwCoInit);
-#     else
-          return ::CoInitialize(0);
-#     endif
-  }
-  inline void smart_co_uninit_helper( HRESULT hr )
-  {
-      if (SUCCEEDED(hr))
-          ::CoUninitialize();
-  }
-  typedef close_fun<void(*)(HRESULT),smart_co_uninit_helper>                      close_co;
-  typedef value_const<HRESULT,CO_E_NOTINITIALIZED>                                co_not_init;
-# undef  DECLARE_SMART_ANY_TYPEDEFS_OBJBASE
-# define DECLARE_SMART_ANY_TYPEDEFS_OBJBASE(prefix)                                                                     \
-  typedef prefix ## _any<LPVOID,close_co_task_free>                               prefix ## _co_task_ptr;
-#endif
-
-
-#define DECLARE_SMART_ANY_TYPEDEFS(prefix)                                                                              \
-    DECLARE_SMART_ANY_TYPEDEFS_STDIO(prefix)                                                                            \
-    DECLARE_SMART_ANY_TYPEDEFS_WINDOWS(prefix)                                                                          \
-    DECLARE_SMART_ANY_TYPEDEFS_OLEAUTO(prefix)                                                                          \
-    DECLARE_SMART_ANY_TYPEDEFS_MSGQUEUE(prefix)                                                                         \
-    DECLARE_SMART_ANY_TYPEDEFS_WININET(prefix)                                                                          \
-    DECLARE_SMART_ANY_TYPEDEFS_RAS(prefix)                                                                              \
-    DECLARE_SMART_ANY_TYPEDEFS_RPCDCE(prefix)                                                                           \
-    DECLARE_SMART_ANY_TYPEDEFS_WINSVC(prefix)                                                                           \
-    DECLARE_SMART_ANY_TYPEDEFS_WINSOCKAPI(prefix)                                                                       \
-    DECLARE_SMART_ANY_TYPEDEFS_OBJBASE(prefix)
diff --git a/tools/ApplyTag/apply_tag_tool.cc b/tools/ApplyTag/apply_tag_tool.cc
deleted file mode 100644
index bdea398..0000000
--- a/tools/ApplyTag/apply_tag_tool.cc
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// The main file for a simple tool to apply a tag to a signed file.
-#include <Windows.h>
-#include <TCHAR.h>
-#include "omaha/base/apply_tag.h"
-#include "omaha/base/file.h"
-#include "omaha/base/path.h"
-#include "omaha/base/utils.h"
-
-using omaha::CreateDir;
-using omaha::ConcatenatePath;
-using omaha::File;
-using omaha::GetCurrentDir;
-using omaha::GetDirectoryFromPath;
-using omaha::GetFileFromPath;
-
-int _tmain(int argc, TCHAR* argv[]) {
-  if (argc != 4 && argc != 5) {
-    _tprintf(_T("Incorrect number of arguments!\n"));
-    _tprintf(_T("Usage: ApplyTag <signed_file> <outputfile> <tag> [append]\n"));
-    return -1;
-  }
-
-  const TCHAR* file = argv[1];
-  if (!File::Exists(file)) {
-    _tprintf(_T("File \"%s\" not found!\n"), file);
-    return -1;
-  }
-
-  bool append = false;
-  if (argc == 5 && _tcsicmp(argv[4], _T("append")) == 0) {
-    append = true;
-  }
-
-  CString dir = GetDirectoryFromPath(argv[2]);
-  CString path = ConcatenatePath(GetCurrentDir(), dir);
-  ASSERT1(!path.IsEmpty());
-  if (!File::Exists(path)) {
-    HRESULT hr = CreateDir(path, NULL);
-    if (FAILED(hr)) {
-      _tprintf(_T("Could not create dir %s\n"), path);
-      return hr;
-    }
-  }
-
-  CString file_name = GetFileFromPath(argv[2]);
-  CString out_path = ConcatenatePath(path, file_name);
-  ASSERT1(!out_path.IsEmpty());
-  ASSERT1(File::Exists(path));
-  omaha::ApplyTag tag;
-  HRESULT hr = tag.Init(argv[1],
-                        CT2CA(argv[3]),
-                        lstrlenA(CT2CA(argv[3])),
-                        out_path,
-                        append);
-  if (hr == E_INVALIDARG) {
-    _tprintf(_T("The tag_string %s contains invalid characters."), argv[3]);
-    _tprintf(_T("  We accept the following ATL RegEx '[-%{}/\a&=._]*'\n"));
-    return hr;
-  }
-
-  if (FAILED(hr)) {
-    _tprintf(_T("Tag.Init Failed hr = %x\n"), hr);
-    return hr;
-  }
-
-  hr = tag.EmbedTagString();
-  if (hr == APPLYTAG_E_ALREADY_TAGGED) {
-    _tprintf(_T("The binary %s is already tagged."), argv[1]);
-    _tprintf(_T(" In order to append the tag string, use the append flag.\n"));
-    _tprintf(_T("Usage: ApplyTag <signed_file> <outputfile> <tag> [append]\n"));
-  }
-
-  return 0;
-}
diff --git a/tools/ApplyTag/build.scons b/tools/ApplyTag/build.scons
deleted file mode 100644
index 149c2df..0000000
--- a/tools/ApplyTag/build.scons
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-
-Import('env')
-
-
-local_env = env.Clone()
-local_env.Append(
-    LIBS = [
-        ('atls.lib', 'atlsd.lib')[local_env.Bit('debug')],
-        ('libcmt.lib', 'libcmtd.lib')[local_env.Bit('debug')],
-        ('libcpmt.lib', 'libcpmtd.lib')[local_env.Bit('debug')],
-        'netapi32.lib',
-        'psapi.lib',
-        'rasapi32.lib',
-        'shlwapi.lib',
-        'userenv.lib',
-        'version.lib',
-        'wtsapi32.lib',
-        '$LIB_DIR/base.lib',
-        ],
-    CPPDEFINES = [
-        'UNICODE',
-        '_UNICODE'
-        ],
-)
-
-# ApplyTag.exe is a console application
-local_env.FilterOut(LINKFLAGS = ['/SUBSYSTEM:WINDOWS'])
-local_env['LINKFLAGS'] += ['/SUBSYSTEM:CONSOLE']
-
-local_env.Dir('.').addRepository(local_env.Dir('$MAIN_DIR/base'))
-
-target_name = 'ApplyTag'
-
-inputs = [
-    'apply_tag.cc',  # Comes from $MAIN_DIR/base
-    'apply_tag_tool.cc',
-    ]
-if env.Bit('use_precompiled_headers'):
-  inputs += local_env.EnablePrecompile(target_name)
-
-local_env.ComponentTestProgram(
-    prog_name=target_name,
-    source=inputs,
-    COMPONENT_TEST_RUNNABLE=False
-)
diff --git a/tools/CrashProcess/build.scons b/tools/CrashProcess/build.scons
deleted file mode 100644
index 552b07b..0000000
--- a/tools/CrashProcess/build.scons
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/python2.4
-# Copyright 2009-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-local_env = env.Clone()
-local_env.FilterOut(CPPDEFINES=['_ATL_DEBUG_INTERFACES'])
-
-local_env.Append(
-    LIBS = [
-        ('libcmt.lib', 'libcmtd.lib')[local_env.Bit('debug')],
-        ('libcpmt.lib', 'libcpmtd.lib')[local_env.Bit('debug')],
-        'psapi.lib',
-        ],
-    CPPDEFINES = [
-        'UNICODE',
-        '_UNICODE'
-        ],
-)
-
-local_env.FilterOut(LINKFLAGS = ['/SUBSYSTEM:WINDOWS'])
-local_env['LINKFLAGS'] += ['/SUBSYSTEM:CONSOLE']
-
-target_name = 'CrashProcess'
-
-inputs = [
-    'crash_process.cc',
-    ]
-if local_env.Bit('use_precompiled_headers'):
-  inputs += local_env.EnablePrecompile(target_name)
-
-local_env.ComponentTestProgram(
-    prog_name=target_name,
-    source=inputs,
-    COMPONENT_TEST_RUNNABLE=False
-)
-
diff --git a/tools/CrashProcess/crash_process.cc b/tools/CrashProcess/crash_process.cc
deleted file mode 100644
index cb72e79..0000000
--- a/tools/CrashProcess/crash_process.cc
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright 2004-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Tool to crash the specified process.
-// Injects a remote thread into the named process and causes
-// this thread to crash.
-// Options:
-// 1. Crash by injecting a thread that tries to execute a non-existent code
-//    location.
-// 2. Crash by Raising a specific exception.
-// TODO(omaha): Figure out a way to implement:
-// 3. Crash another thread of the process.
-// 4. Crash another thread when it enters a particular function.
-// 5. Crash another thread when it leaves a particular function.
-//
-// For now the process name and the address of the crash are hard coded.
-
-#include <windows.h>
-#include <wtypes.h>
-#include <tchar.h>
-#include <psapi.h>
-
-const int kMaxProcesses = 1024;
-
-int _tmain(int argc, TCHAR* argv[]) {
-  if (2 != argc) {
-    wprintf(_T("Incorrect syntax. The single required argument is the ")
-            _T("executable to crash.\n"));
-    return -1;
-  }
-
-  const TCHAR* target_process_name = argv[1];
-
-  DWORD num_processes = 0;
-  DWORD process_ids[kMaxProcesses] = {0};
-  if (!::EnumProcesses(process_ids, kMaxProcesses, &num_processes)) {
-    wprintf(_T("EnumProcesses failed.\n"));
-    return -1;
-  }
-
-  wprintf(_T("Found %u processes.\n"), num_processes);
-  bool found = false;
-  for (size_t i = 0; i < num_processes && !found; ++i) {
-    const DWORD access_rights = PROCESS_CREATE_THREAD |
-                                PROCESS_QUERY_INFORMATION |
-                                PROCESS_VM_OPERATION |
-                                PROCESS_VM_WRITE |
-                                PROCESS_VM_READ;
-    HANDLE process_handle = ::OpenProcess(access_rights,
-                                          FALSE,
-                                          process_ids[i]);
-    if (process_handle) {
-      TCHAR process_name[1024] = {0};
-      if (::GetProcessImageFileName(process_handle, process_name, 1024) != 0) {
-        size_t len = wcslen(target_process_name);
-        size_t total_len = wcslen(process_name);
-        int offset = total_len - len;
-        if (offset >= 0 &&
-            _wcsicmp(&(process_name[offset]), target_process_name) == 0) {
-          found = true;
-          wprintf(_T("Found %s %u. Injecting a crash.\n"),
-                  target_process_name, process_ids[i]);
-          DWORD thread_id = 0;
-          LPTHREAD_START_ROUTINE func =
-              reinterpret_cast<LPTHREAD_START_ROUTINE>(0x12345678);
-          void* addr_of_param = reinterpret_cast<void*>(0x2491ed8);
-          HANDLE thread_handle = ::CreateRemoteThread(process_handle,
-                                                      NULL,
-                                                      0,
-                                                      func,
-                                                      addr_of_param,
-                                                      CREATE_SUSPENDED,
-                                                      &thread_id);
-          if (!thread_handle) {
-            HRESULT hr = HRESULT_FROM_WIN32(::GetLastError());
-            wprintf(_T("CreateRemoteThread failed.\n"));
-          }
-          if (::ResumeThread(thread_handle) == -1) {
-            wprintf(_T("Resume thread failed.\n"));
-          } else {
-            wprintf(_T("Waiting for process to quit.\n"));
-            ::WaitForSingleObject(thread_handle, 2000);
-          }
-        }
-      }
-
-      ::CloseHandle(process_handle);
-    }
-  }
-
-  if (!found) {
-    wprintf(_T("No %s processes found.\n"), target_process_name);
-  } else {
-    wprintf(_T("Done.\n"));
-  }
-
-  return 0;
-}
-
diff --git a/tools/OmahaCompatibility/HttpServer/Request.h b/tools/OmahaCompatibility/HttpServer/Request.h
deleted file mode 100644
index d76559c..0000000
--- a/tools/OmahaCompatibility/HttpServer/Request.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_HTTPSERVER_REQUEST_H_
-#define OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_HTTPSERVER_REQUEST_H_
-
-#include <http.h>
-#include <winhttp.h>
-
-namespace omaha {
-
-// Represents the HttpRequest received by the server.
-class HttpRequest {
- public:
-  HTTP_VERB http_verb() const { return verb_; }
-  void set_http_verb(HTTP_VERB verb) { verb_ = verb; }
-
-  CString path() const { return path_; }
-  void set_path(const CString& path) { path_ = path; }
-
-  CString content() const { return content_; }
-  void set_content(const CString& content) { content_ = content; }
-
-  HTTP_REQUEST http_request() const { return http_request_; }
-  void set_http_request(const HTTP_REQUEST& request) {
-    http_request_ = request;
-  }
-
-  CString query_str() const { return query_str_; }
-  void set_query_str(const CString& query_str) {
-    query_str_ = query_str;
-  }
-
- private:
-  HTTP_REQUEST http_request_;
-  HTTP_VERB verb_;
-  CString path_;
-  CString content_;
-  CString query_str_;
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_HTTPSERVER_REQUEST_H_
diff --git a/tools/OmahaCompatibility/HttpServer/download_handler.cc b/tools/OmahaCompatibility/HttpServer/download_handler.cc
deleted file mode 100644
index eab5eb5..0000000
--- a/tools/OmahaCompatibility/HttpServer/download_handler.cc
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/tools/omahacompatibility/httpserver/download_handler.h"
-#include "omaha/common/debug.h"
-#include "omaha/common/logging.h"
-#include "omaha/common/path.h"
-
-namespace omaha {
-
-HRESULT DownloadHandler::HandleRequest(const HttpRequest& request,
-                                       HttpResponse* response) {
-  CORE_LOG(L1, (_T("[DownloadHandler::HandleRequest]")));
-  ASSERT1(response);
-
-  for (size_t i = 0; i < responses_.size(); ++i) {
-    CString requested_file = GetFileFromPath(request.path());
-    if (GetFileFromPath(responses_[i].local_file_name) == requested_file) {
-      // We know about the file that was asked for.
-      response->set_size(responses_[i].size);
-      response->set_file_name(responses_[i].local_file_name);
-      return S_OK;
-    }
-  }
-
-  return S_OK;
-}
-
-HRESULT DownloadHandler::AddDownloadFile(const ConfigResponse& response) {
-  CORE_LOG(L1, (_T("[DownloadHandler::AddDownloadFile]")));
-  responses_.push_back(response);
-  return S_OK;
-}
-
-}  // namespace omaha
diff --git a/tools/OmahaCompatibility/HttpServer/download_handler.h b/tools/OmahaCompatibility/HttpServer/download_handler.h
deleted file mode 100644
index 03626a8..0000000
--- a/tools/OmahaCompatibility/HttpServer/download_handler.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_HTTPSERVER_DOWNLOAD_HANDLER_H_
-#define OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_HTTPSERVER_DOWNLOAD_HANDLER_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include "omaha/tools/omahacompatibility/common/config.h"
-#include "omaha/tools/omahacompatibility/httpserver/request.h"
-#include "omaha/tools/omahacompatibility/httpserver/response.h"
-#include "omaha/tools/omahacompatibility/httpserver/url_handler.h"
-
-namespace omaha {
-
-// Handler for the download path on the server. Returns the size and the
-// local path of the file to be returned for the request.
-class DownloadHandler : public UrlHandler {
- public:
-  explicit DownloadHandler(const CString& url_path) : UrlHandler(url_path) {}
-  virtual ~DownloadHandler() {}
-  HRESULT AddDownloadFile(const ConfigResponse& response);
-  virtual HRESULT HandleRequest(const HttpRequest& request,
-                                HttpResponse* response);
- private:
-  ConfigResponses responses_;
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_HTTPSERVER_DOWNLOAD_HANDLER_H_
diff --git a/tools/OmahaCompatibility/HttpServer/http_server.cc b/tools/OmahaCompatibility/HttpServer/http_server.cc
deleted file mode 100644
index 0370eac..0000000
--- a/tools/OmahaCompatibility/HttpServer/http_server.cc
+++ /dev/null
@@ -1,347 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/tools/omahacompatibility/httpserver/http_server.h"
-
-#include <Windows.h>
-#include <http.h>
-#include <winhttp.h>
-#include "omaha/common/error.h"
-#include "omaha/common/debug.h"
-#include "omaha/common/logging.h"
-#include "omaha/common/string.h"
-#include "omaha/common/utils.h"
-#include "omaha/common/reg_key.h"
-
-namespace omaha {
-
-#define MAX_BUFFER_SIZE 4048
-#define INTERNET_MAX_PATH_LENGTH 2048
-
-HttpServer::HttpServer(const CString& host, int port)
-    : host_(host),
-      port_(port) {
-  CORE_LOG(L1, (_T("[HttpServer]")));
-  url_prefix_.Format(_T("http://%s:%d"), host, port);
-}
-
-HttpServer::~HttpServer() {
-  CORE_LOG(L1, (_T("[~HttpServer]")));
-  ::HttpTerminate(HTTP_INITIALIZE_SERVER, NULL);
-
-  std::map<CString, UrlHandler*>::iterator iter = handlers_.begin();
-  for (; iter != handlers_.end(); ++iter) {
-    std::pair<CString, UrlHandler*> pair = *iter;
-    VERIFY1(::HttpRemoveUrl(get(request_handle_),
-                            pair.first) != NO_ERROR);
-    delete pair.second;
-  }
-
-  handlers_.clear();
-}
-
-HRESULT HttpServer::Initialize() {
-  CORE_LOG(L1, (_T("[Initialize]")));
-  HTTPAPI_VERSION version = HTTPAPI_VERSION_1;
-  int ret = ::HttpInitialize(version,
-                             HTTP_INITIALIZE_SERVER,
-                             NULL);
-  if (ret != NO_ERROR) {
-    return HRESULT_FROM_WIN32(ret);
-  }
-
-  ret = ::HttpCreateHttpHandle(address(request_handle_), NULL);
-  if (ret != NO_ERROR) {
-    return HRESULT_FROM_WIN32(ret);
-  }
-  ASSERT1(get(request_handle_));
-
-  return S_OK;
-}
-
-HRESULT HttpServer::AddUrlHandler(UrlHandler* handler) {
-  CORE_LOG(L1, (_T("[AddUrlHandler]")));
-  ASSERT1(handler);
-
-  CString full_url = url_prefix_ + handler->get_url_path();
-  int ret = ::HttpAddUrl(get(request_handle_),
-                         full_url, NULL);
-  if (ret != NO_ERROR) {
-    return HRESULT_FROM_WIN32(ret);
-  }
-
-  ASSERT1(handlers_.find(handler->get_url_path()) == handlers_.end());
-  handlers_[handler->get_url_path()] = handler;
-  return S_OK;
-}
-
-UrlHandler* HttpServer::GetHandler(const HttpRequest& req) {
-  std::map<CString, UrlHandler*>::const_iterator iter = handlers_.begin();
-  for (; iter != handlers_.end(); ++iter) {
-    UrlHandler* handler = (*iter).second;
-
-    // Determine if the handler starts with the path that is specified
-    // in the request.
-    if (req.path().Find(handler->get_url_path()) == 0) {
-      return handler;
-    }
-  }
-
-  ASSERT1(false);
-  return NULL;
-}
-
-HRESULT HttpServer::ReadRequest(HttpRequest* request) {
-  ASSERT1(request);
-
-  TCHAR buffer[MAX_BUFFER_SIZE] = {0};
-  HTTP_REQUEST* req = reinterpret_cast<HTTP_REQUEST*>(buffer);
-  int ret = ::HttpReceiveHttpRequest(get(request_handle_),
-    HTTP_NULL_ID,
-    HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY,
-    req,
-    MAX_BUFFER_SIZE,
-    NULL,
-    NULL);
-
-  if (ret != NO_ERROR) {
-    HRESULT hr =  HRESULT_FROM_WIN32(ret);
-    CORE_LOG(L1, (_T("[Failed to read request.][0x%08x]"), hr));
-    return hr;
-  }
-
-  // Figure out the query string and the path.
-  CString url_path(req->pRawUrl);
-  int idx = url_path.ReverseFind(_T('?'));
-  CString query_str;
-  CString path;
-  if (idx != -1) {
-    query_str = url_path.Right(url_path.GetLength() - idx - 1);
-    path = url_path.Left(idx);
-  } else {
-    path = url_path;
-  }
-
-  // Set the values on the request.
-  request->set_http_verb(req->Verb);
-  request->set_path(path);
-  request->set_http_request(*req);
-  request->set_query_str(query_str);
-
-  if (req->Verb == HttpVerbPOST) {
-    DWORD bytes_received = 0;
-    char output_buffer[MAX_BUFFER_SIZE] = {0};
-    ret = ::HttpReceiveRequestEntityBody(get(request_handle_),
-      req->RequestId,
-      0,
-      output_buffer,
-      MAX_BUFFER_SIZE,
-      &bytes_received,
-      NULL);
-
-    if (ret != NO_ERROR) {
-      HRESULT hr =  HRESULT_FROM_WIN32(ret);
-      CORE_LOG(L1, (_T("[Failed to read request.][0x%08x]"), hr));
-      return hr;
-    }
-    CString content = Utf8ToWideChar(output_buffer, bytes_received);
-    request->set_content(content);
-  }
-
-  return S_OK;
-}
-
-HRESULT HttpServer::SetHeader(HTTP_RESPONSE* http_response,
-                              HTTP_HEADER_ID header_id,
-                              const char* value) {
-  ASSERT1(http_response);
-
-  http_response->Headers.KnownHeaders[header_id].pRawValue = value;
-  http_response->Headers.KnownHeaders[header_id].RawValueLength =
-        static_cast<USHORT>(strlen(value));
-  return S_OK;
-}
-
-HRESULT HttpServer::SendResponse(const HttpResponse& response) {
-  const HttpRequest& request = response.request();
-  const char* const kOk = "OK";
-
-  HTTP_RESPONSE http_response = {0};
-  http_response.StatusCode = 200;
-
-  // Send back an ok.
-  http_response.pReason = kOk;
-  http_response.ReasonLength = static_cast<USHORT>(strlen(kOk));
-
-  // No special headers for now.
-  HTTP_RESPONSE_HEADERS headers = {0};
-  headers.UnknownHeaderCount = 0;
-  headers.TrailerCount = 0;
-  http_response.Headers = headers;
-
-  scoped_hfile handle;
-  CStringA request_body_utf8;
-  CStringA content_range_header;
-  int http_response_flag = 0;
-
-  HTTP_DATA_CHUNK chunk;
-  memset(&chunk, 0, sizeof(HTTP_DATA_CHUNK));
-
-  // Based on the verb build a response.
-  if (request.http_verb() == HttpVerbPOST) {
-    // Add a known header of content type.
-    SetHeader(&http_response, HttpHeaderContentType, "text/xml; charset=UTF-8");
-
-    // Send back the content.
-    chunk.DataChunkType = HttpDataChunkFromMemory;
-    CString response_str = response.response_str();
-    request_body_utf8 = CT2A(response_str, CP_UTF8);
-
-    chunk.FromMemory.pBuffer = request_body_utf8.GetBuffer();
-    chunk.FromMemory.BufferLength = request_body_utf8.GetLength();
-
-    http_response.EntityChunkCount = 1;
-    http_response.pEntityChunks = &chunk;
-
-  } else if (request.http_verb() == HttpVerbHEAD) {
-    // Add the content length, type, and content range headers.
-    SetHeader(&http_response, HttpHeaderContentType,
-              "application/octet-stream");
-    char size_str[MAX_PATH] = {0};
-    _itoa(response.size(), size_str, 10);
-    SetHeader(&http_response, HttpHeaderContentLength, size_str);
-    SetHeader(&http_response, HttpHeaderAcceptRanges, "bytes");
-
-  } else if (request.http_verb() == HttpVerbGET) {
-    SetHeader(&http_response, HttpHeaderContentType,
-              "application/octet-stream");
-    char size_str[MAX_PATH] = {0};
-    _itoa(response.size(), size_str, 10);
-    SetHeader(&http_response, HttpHeaderAcceptRanges, "bytes");
-
-    reset(handle, ::CreateFile(response.file_name(), GENERIC_READ,
-                               FILE_SHARE_READ, NULL, OPEN_EXISTING,
-                               FILE_ATTRIBUTE_NORMAL, NULL));
-    if (!handle) {
-      return HRESULTFromLastError();
-    }
-
-    chunk.DataChunkType = HttpDataChunkFromFileHandle;
-
-    // Determine the file portion to send back to the client.
-    // If the client has sent a range request, honor that.
-    int start_file_pos = 0;
-    int end_file_pos = 0;
-    HTTP_REQUEST tmp_request = request.http_request();
-    if (tmp_request.Headers.KnownHeaders[HttpHeaderRange].RawValueLength != 0) {
-      // The client send a content length header. We need to honor this.
-      CStringA content_range(
-          tmp_request.Headers.KnownHeaders[HttpHeaderRange].pRawValue);
-
-      int idx = content_range.Find('-');
-      ASSERT1(idx != -1);
-      end_file_pos = atoi(content_range.Right(
-            content_range.GetLength() - idx - 1));
-      int st_idx = content_range.Find('=');
-      ASSERT1(st_idx != -1);
-      start_file_pos = atoi(content_range.Mid(st_idx + 1, idx));
-
-      // Set the Content-range header in the response.
-      content_range_header.Format("bytes %d-%d/%d",
-                                  start_file_pos,
-                                  end_file_pos, response.size());
-      SetHeader(&http_response, HttpHeaderContentRange, content_range_header);
-
-      // Since this is a range request, we set the http response code to
-      // partial response.
-      http_response.StatusCode = 206;
-
-      // Set the value of the human readable text to partial-content.
-      const char* const kPartialContent = "Partial Content";
-      http_response.pReason = kPartialContent;
-      http_response.ReasonLength = static_cast<USHORT>(strlen(kPartialContent));
-    }
-
-    // Send back the entire file or part of it.
-    HTTP_BYTE_RANGE byte_range = {0};
-    byte_range.StartingOffset.HighPart = 0;
-    byte_range.StartingOffset.LowPart = start_file_pos;
-    if (end_file_pos == 0) {
-      byte_range.Length.QuadPart = HTTP_BYTE_RANGE_TO_EOF;
-    } else {
-      byte_range.Length.QuadPart = end_file_pos - start_file_pos + 1;
-    }
-
-    chunk.FromFileHandle.ByteRange = byte_range;
-    chunk.FromFileHandle.FileHandle = get(handle);
-
-    http_response.EntityChunkCount = 1;
-    http_response.pEntityChunks = &chunk;
-  }
-
-  DWORD bytes_sent = 0;
-  int ret = ::HttpSendHttpResponse(
-      get(request_handle_),
-      request.http_request().RequestId,
-      http_response_flag,
-      &http_response,
-      NULL,
-      &bytes_sent,
-      NULL,
-      0,
-      NULL,
-      NULL);
-  if (ret != NO_ERROR) {
-    return HRESULT_FROM_WIN32(ret);
-  }
-
-  return S_OK;
-}
-
-HRESULT HttpServer::Start() {
-  CORE_LOG(L1, (_T("[Start]")));
-
-  while (true) {
-    HttpRequest request;
-    HRESULT hr = ReadRequest(&request);
-    if (FAILED(hr)) {
-      CORE_LOG(L1, (_T("[ReadRequest failed.][0x%08x]"), hr));
-      continue;
-    }
-
-    HttpResponse response(request);
-    UrlHandler* handler = GetHandler(request);
-    if (handler == NULL) {
-      continue;
-    }
-
-    hr = handler->HandleRequest(request, &response);
-    if (FAILED(hr)) {
-      CORE_LOG(L1, (_T("[HandlerRequest failed.][0x%08x]"), hr));
-      continue;
-    }
-
-    hr = SendResponse(response);
-    if (FAILED(hr)) {
-      CORE_LOG(L1, (_T("[SendRequest failed.][0x%08x]"), hr));
-      continue;
-    }
-  }
-
-  return S_OK;
-}
-
-}  // namespace omaha
diff --git a/tools/OmahaCompatibility/HttpServer/http_server.h b/tools/OmahaCompatibility/HttpServer/http_server.h
deleted file mode 100644
index 2807cce..0000000
--- a/tools/OmahaCompatibility/HttpServer/http_server.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_HTTPSERVER_HTTP_SERVER_H_
-#define OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_HTTPSERVER_HTTP_SERVER_H_
-
-#include <windows.h>
-#include <map>
-#include "omaha/common/scoped_any.h"
-#include "omaha/tools/omahacompatibility/httpserver/url_handler.h"
-#include "omaha/tools/omahacompatibility/httpserver/request.h"
-
-namespace omaha {
-
-// The base http server, it takes in a bunch of handlers for
-// the appropriate paths and invokes them based on the requests
-// that are sent to the server. This is NOT a general purpose
-// server, and handles only the requests necessary to enable
-// omaha client to function correctly.
-class HttpServer {
- public:
-  HttpServer(const CString& host, int port);
-  ~HttpServer();
-  HRESULT Initialize();
-  HRESULT AddUrlHandler(UrlHandler* handler);
-  HRESULT Start();
-
- private:
-  HRESULT Terminate();
-  UrlHandler* GetHandler(const HttpRequest& url);
-  HRESULT ReadRequest(HttpRequest* request);
-  HRESULT SendResponse(const HttpResponse& response);
-  HRESULT SetHeader(HTTP_RESPONSE* http_response,
-                    HTTP_HEADER_ID header_id,
-                    const char* value);
-
-  scoped_handle request_handle_;
-  std::map<CString, UrlHandler*> handlers_;
-  CString host_;
-  CString url_prefix_;
-  int port_;
-};
-
-}  // namespace omaha
-
-#endif  //  OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_HTTPSERVER_HTTP_SERVER_H_
diff --git a/tools/OmahaCompatibility/HttpServer/response.h b/tools/OmahaCompatibility/HttpServer/response.h
deleted file mode 100644
index 5fa81e8..0000000
--- a/tools/OmahaCompatibility/HttpServer/response.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_HTTPSERVER_RESPONSE_H_
-#define OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_HTTPSERVER_RESPONSE_H_
-
-#include <http.h>
-#include <winhttp.h>
-#include "omaha/tools/omahacompatibility/httpserver/request.h"
-
-namespace omaha {
-
-// This class contains the result of the processing.
-// For update responses it contains the response to the post in the
-// string and for downloads it contains the filename and the size.
-// TODO(omaha): Remove the size and filename from here and make this,
-// class derivable. This will allow the http_server to not deal with
-// the specifics of either a download or update check response.
-class HttpResponse {
- public:
-  explicit HttpResponse(const HttpRequest& request) : request_(request) {}
-  ~HttpResponse() {}
-
-  CString response_str() const { return response_str_; }
-  void set_response_str(const CString& response_str) {
-    response_str_  = response_str;
-  }
-  const HttpRequest& request() const { return request_; }
-
-  int size() const { return size_; }
-  void set_size(int size) { size_ = size; }
-
-  CString file_name() const { return file_name_; }
-  void set_file_name(const CString& filename) { file_name_ = filename; }
-
- private:
-  HttpRequest request_;
-  CString response_str_;
-
-  // This is used for the download responses.
-  int size_;
-  CString file_name_;
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_HTTPSERVER_RESPONSE_H_
diff --git a/tools/OmahaCompatibility/HttpServer/update_check_handler.cc b/tools/OmahaCompatibility/HttpServer/update_check_handler.cc
deleted file mode 100644
index 2e41947..0000000
--- a/tools/OmahaCompatibility/HttpServer/update_check_handler.cc
+++ /dev/null
@@ -1,157 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/tools/omahacompatibility/httpserver/update_check_handler.h"
-#include <windows.h>
-#include "omaha/common/debug.h"
-#include "omaha/common/logging.h"
-#include "omaha/goopdate/goopdate_utils.h"
-#include "omaha/tools/omahacompatibility/common/error.h"
-#include "omaha/tools/omahacompatibility/httpserver/request.h"
-#include "omaha/tools/omahacompatibility/httpserver/xml_parser.h"
-
-namespace omaha {
-
-UpdateCheckHandler::UpdateCheckHandler(const CString& url_path,
-                                       PingObserver* observer)
-    : UrlHandler(url_path),
-      ping_observer_(observer) {
-  CORE_LOG(L1, (_T("[UpdateCheckHandler]")));
-}
-
-// Private method that goes over the request, i.e. the update checks or
-// the pings for each application and constructs an appropriate response.
-// For pings we dont do anything, and for update checks we construct the
-// update response based on the config information.
-HRESULT UpdateCheckHandler::BuildResponse(const AppRequestDataVector& request,
-                                          ServerResponses* responses) {
-  ASSERT1(responses);
-
-  for (size_t i = 0; i < request.size(); ++i) {
-    AppData app_data = request[i].app_data();
-    ServerResponse response;
-    response.guid = GuidToString(app_data.app_guid());
-
-    if (request[i].num_ping_events() > 0) {
-      // This is a ping request. We only handle the ping and nothing else.
-      response.is_ping = true;
-      if (ping_observer_) {
-        ping_observer_->Observe(request[i]);
-      }
-    } else {
-      // We assume this is an update check and send back an appropriate
-      // response.
-      ConfigResponse config_app_response;
-      HRESULT hr = FindResponse(app_data.app_guid(),
-                                app_data.version(),
-                                app_data.ap(),
-                                &config_app_response);
-      if (SUCCEEDED(hr)) {
-        response.is_update_response = true;
-        response.response_data.set_url(config_app_response.url);
-        response.response_data.set_hash(config_app_response.hash);
-        response.response_data.set_needs_admin(config_app_response.needs_admin ?
-                                               omaha::NEEDS_ADMIN_YES :
-                                               omaha::NEEDS_ADMIN_NO);
-        response.response_data.set_size(config_app_response.size);
-      }
-      // Continuing here in the failed case will cause the
-      // is_update_response to be false,
-      // causing the server to respond with no-update.
-    }
-    responses->push_back(response);
-  }
-
-  return S_OK;
-}
-
-HRESULT UpdateCheckHandler::HandleRequest(const HttpRequest& http_request,
-                                          HttpResponse* response) {
-  CORE_LOG(L1, (_T("[UpdateCheckHandler::HandleRequest]")));
-  ASSERT1(response);
-  ASSERT1(http_request.http_verb() == HttpVerbPOST);
-
-  // Parse the request.
-  CORE_LOG(L1, (_T("[Request %s]"), http_request.content()));
-  AppRequestDataVector request;
-  HRESULT hr = ParseUpdateCheck(http_request.content(), &request);
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[ParseUpdateCheck failed]")));
-    return hr;
-  }
-
-  // Map the request to a response.
-  ServerResponses responses;
-  hr = BuildResponse(request, &responses);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Convert the response into the response string.
-  CString update_response_str;
-  hr = BuildUpdateResponse(responses, &update_response_str);
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[BuildUpdateResponse failed]")));
-    return hr;
-  }
-
-  CORE_LOG(L1, (_T("[Response %s]"), update_response_str));
-  response->set_response_str(update_response_str);
-
-  return S_OK;
-}
-
-HRESULT UpdateCheckHandler::AddAppVersionResponse(
-    const ConfigResponse& response) {
-  CORE_LOG(L1, (_T("[UpdateCheckHandler::AddAppVersionResponse]")));
-  // TODO(omaha): Add duplicate checking.
-
-  config_responses_.push_back(response);
-  return S_OK;
-}
-
-HRESULT UpdateCheckHandler::FindResponse(GUID guid,
-                                         const CString& version,
-                                         const CString& ap,
-                                         ConfigResponse* response) {
-  CORE_LOG(L1, (_T("[UpdateCheckHandler::FindResponse]")));
-  ASSERT1(response);
-
-  // The idea here is that we go over the config responses, for a request
-  // that contains 0.0.0.0 in the request, or empty we return the initial
-  // response, i.e. the first installer we read.
-  // If the version is not empty, then we match it with the previous config
-  // version, i.e. the version that should have been installed,
-  // and return a response if there is a match.
-  if (version.IsEmpty() || version == _T("0.0.0.0")) {
-    // This is the initial response.
-    *response = config_responses_[0];
-    return S_OK;
-  }
-
-  for (size_t i = 1; i < config_responses_.size(); ++i) {
-    if (::IsEqualGUID(config_responses_[i].guid, guid) &&
-        _T("update_app") == ap &&
-        version == config_responses_[i - 1].version) {
-      // This is the second response.
-      *response = config_responses_[i];
-      return S_OK;
-    }
-  }
-
-  return E_FAIL;
-}
-
-}  // namespace omaha
diff --git a/tools/OmahaCompatibility/HttpServer/update_check_handler.h b/tools/OmahaCompatibility/HttpServer/update_check_handler.h
deleted file mode 100644
index 06f3a84..0000000
--- a/tools/OmahaCompatibility/HttpServer/update_check_handler.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_HTTPSERVER_UPDATE_CHECK_HANDLER_H_
-#define OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_HTTPSERVER_UPDATE_CHECK_HANDLER_H_
-
-#include <windows.h>
-#include <vector>
-#include <atlstr.h>
-#include "omaha/goopdate/request.h"
-#include "omaha/tools/omahacompatibility/common/config.h"
-#include "omaha/tools/omahacompatibility/common/ping_observer.h"
-#include "omaha/tools/omahacompatibility/httpserver/request.h"
-#include "omaha/tools/omahacompatibility/httpserver/response.h"
-#include "omaha/tools/omahacompatibility/httpserver/url_handler.h"
-#include "omaha/tools/omahacompatibility/httpserver/xml_parser.h"
-
-namespace omaha {
-
-// Handles the update check requests.
-// Initially the configuration information that is used to respond
-// to the requests is simple and only contains a few fields: guid and version.
-//
-// Future: Implement reading the server ascii protocol buffers, and use
-// that as the configuration information.
-class UpdateCheckHandler : public UrlHandler {
- public:
-  UpdateCheckHandler(const CString& url_path, PingObserver* observer);
-  virtual ~UpdateCheckHandler() {}
-
-  HRESULT AddAppVersionResponse(const ConfigResponse& response);
-  virtual HRESULT HandleRequest(const HttpRequest& request,
-                                HttpResponse* response);
- private:
-  // Returns the response structure that matches the guid and version
-  // specified.
-  HRESULT FindResponse(GUID guid,
-                       const CString& version,
-                       const CString& ap,
-                       ConfigResponse* response);
-  HRESULT BuildResponse(const AppRequestDataVector& request,
-                        ServerResponses* responses);
-  std::vector<ConfigResponse> config_responses_;
-  PingObserver* ping_observer_;
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_HTTPSERVER_UPDATE_CHECK_HANDLER_H_
diff --git a/tools/OmahaCompatibility/HttpServer/url_handler.h b/tools/OmahaCompatibility/HttpServer/url_handler.h
deleted file mode 100644
index 7e685ae..0000000
--- a/tools/OmahaCompatibility/HttpServer/url_handler.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#ifndef OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_HTTPSERVER_URL_HANDLER_H_
-#define OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_HTTPSERVER_URL_HANDLER_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include <vector>
-#include "omaha/tools/omahacompatibility/httpserver/request.h"
-#include "omaha/tools/omahacompatibility/httpserver/response.h"
-
-namespace omaha {
-
-// Base class that represents a handler for a path to the HttpServer.
-class UrlHandler {
- public:
-  explicit UrlHandler(const CString& url_path) : url_path_(url_path) {
-    url_path_.MakeLower();
-  }
-  virtual ~UrlHandler() {}
-  CString get_url_path() const { return url_path_; }
-  virtual HRESULT HandleRequest(const HttpRequest& request,
-                                HttpResponse* response) = 0;
-
- private:
-  CString url_path_;
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_HTTPSERVER_URL_HANDLER_H_
diff --git a/tools/OmahaCompatibility/HttpServer/xml_parser.cc b/tools/OmahaCompatibility/HttpServer/xml_parser.cc
deleted file mode 100644
index 1f5ba90..0000000
--- a/tools/OmahaCompatibility/HttpServer/xml_parser.cc
+++ /dev/null
@@ -1,396 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/tools/omahacompatibility/httpserver/xml_parser.h"
-#include <msxml2.h>
-#include "omaha/common/string.h"
-#include "omaha/common/xml_utils.h"
-#include "omaha/goopdate/goopdate_xml_parser.h"
-
-namespace omaha {
-
-// Constant strings to form the server responses.
-const TCHAR* const kResponseXmlHeader = _T("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");  // NOLINT
-const TCHAR* const kResponseXmlGupdateHeader = _T("<gupdate xmlns=\"http://www.google.com/update2/response\" protocol=\"2.0\">"); // NOLINT
-const TCHAR* const kResponseAppEvent = _T("<app appid=\"%s\" status=\"ok\"><event status=\"ok\"/></app>"); // NOLINT
-const TCHAR* const kResponseAppNoUpdate = _T("<app appid=\"%s\" status=\"ok\"><event status=\"no-update\"/></app>"); // NOLINT
-const TCHAR* const kResponseAppUpdate = _T("<app appid=\"%s\" status=\"ok\"><updatecheck codebase=\"%s\" hash=\"%s\" needsadmin=\"%s\" size=\"%d\" status=\"ok\"/></app>"); // NOLINT
-const TCHAR* const kResponseGupdateEndTag = _T("</gupdate>");
-
-// Constants for creating the xml request.
-namespace Xml {
-  const TCHAR* const kHeaderText =
-    _T("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
-  const TCHAR* const kProcessingText =
-    _T("version=\"1.0\" encoding=\"UTF-8\"");
-
-  namespace Namespace {
-    const TCHAR* const kRequest = _T("http://www.google.com/update2/request");
-    const TCHAR* const kResponse = _T("http://www.google.com/update2/response");
-    const TCHAR* const kSeed = _T("http://www.google.com/update2/install");
-  }  // Namespace.
-
-  namespace Element {
-    const TCHAR* const kXml = _T("xml");
-    const TCHAR* const kRequests = _T("gupdate");
-    const TCHAR* const kOmahaVersion = _T("updaterversion");
-    const TCHAR* const kOs = _T("os");
-    const TCHAR* const kApp = _T("app");
-    const TCHAR* const kUpdateCheck = _T("updatecheck");
-    const TCHAR* const kPing = _T("ping");
-    const TCHAR* const kEvent = _T("event");
-    const TCHAR* const kComponents = _T("components");
-    const TCHAR* const kComponent = _T("component");
-
-    const TCHAR* const kResponses = _T("gupdate");
-  }  // namespace Element.
-
-  namespace Attribute {
-    const TCHAR* const kActive = _T("active");
-    const TCHAR* const kAdditionalParameter = _T("ap");
-    const TCHAR* const kAppGuid = _T("appguid");
-    const TCHAR* const kApplicationName = _T("appname");
-    const TCHAR* const kAppId = _T("appid");
-    const TCHAR* const kArguments = _T("arguments");
-    const TCHAR* const kBrandCode = _T("brand");
-    const TCHAR* const kBrowserType = _T("browser");
-    const TCHAR* const kClientId = _T("client");
-    const TCHAR* const kCodebase = _T("codebase");
-    const TCHAR* const kCountry = _T("country");
-    const TCHAR* const kErrorCode = _T("errorcode");
-    const TCHAR* const kEventResult = _T("eventresult");
-    const TCHAR* const kEventType = _T("eventtype");
-    const TCHAR* const kExtraCode1 = _T("extracode1");
-    const TCHAR* const kHash = _T("hash");
-    const TCHAR* const kIsMachine = _T("ismachine");
-    const TCHAR* const kInstallationId = _T("iid");
-    const TCHAR* const kInstallSource = _T("installsource");
-    const TCHAR* const kLang = _T("lang");
-    const TCHAR* const kNeedsAdmin = _T("needsadmin");
-    const TCHAR* const kParameter = _T("parameter");
-    const TCHAR* const kPlatform = _T("platform");
-    const TCHAR* const kPreviousVersion = _T("previousversion");
-    const TCHAR* const kProtocol = _T("protocol");
-    const TCHAR* const kServicePack = _T("sp");
-    const TCHAR* const kSessionId = _T("sessionid");
-    const TCHAR* const kSignature = _T("signature");
-    const TCHAR* const kSize = _T("size");
-    const TCHAR* const kStatus = _T("status");
-    const TCHAR* const kSuccessAction = _T("onsuccess");
-    const TCHAR* const kSuccessUrl = _T("successurl");
-    const TCHAR* const kTag = _T("tag");
-    const TCHAR* const kTestSource = _T("testsource");
-    const TCHAR* const kTerminateAllBrowsers = _T("terminateallbrowsers");
-    const TCHAR* const kVersion = _T("version");
-    const TCHAR* const kXmlns = _T("xmlns");
-    const TCHAR* const kTTToken = _T("tttoken");
-  }  // namespace Attribute.
-
-  namespace Value {
-    const TCHAR* const kRequestType = _T("UpdateRequest");
-    const TCHAR* const kProtocol = _T("2.0");
-    const TCHAR* const kVersion2 = _T("2.0");
-    const TCHAR* const kVersion3 = _T("3.0");
-    const TCHAR* const kTrue = _T("true");
-    const TCHAR* const kFalse = _T("false");
-    const TCHAR* const kStatusError = _T("error");
-    const TCHAR* const kSuccessActionDefault = _T("default");
-    const TCHAR* const kSuccessActionExitSilently = _T("exitsilently");
-    const TCHAR* const kWinPlatform = _T("win");
-
-    const TCHAR* const kStatusOk = kResponseStatusOkValue;
-  }  //  namespace value.
-}  // namespace xml.
-
-HRESULT ReadAttribute(IXMLDOMNode* node,
-                      const TCHAR* attr_name,
-                      BSTR* value) {
-  ASSERT1(node != NULL);
-  ASSERT1(attr_name != NULL);
-  ASSERT1(value != NULL);
-
-  // First read the attributes.
-  CComPtr<IXMLDOMNamedNodeMap> attributes;
-  HRESULT hr = node->get_attributes(&attributes);
-  if (FAILED(hr)) { return hr; }
-  if (!attributes) { return E_FAIL; }  // Protect against msxml S_FALSE return.
-
-  CComPtr<IXMLDOMNode> attribute_node;
-  CComVariant node_value;
-  CComBSTR temp_attr_name(attr_name);
-
-  // Get the attribute using a named node.
-  hr = attributes->getNamedItem(static_cast<BSTR>(temp_attr_name),
-                                &attribute_node);
-  if (FAILED(hr)) { return hr; }
-  if (!attribute_node) { return E_FAIL; }  // Protect against msxml S_FALSE
-                                           // return.
-
-  hr = attribute_node->get_nodeValue(&node_value);
-  if (FAILED(hr)) { return hr; }
-  if (node_value.vt == VT_EMPTY) { return E_FAIL; }
-
-  // Extract the variant into a BSTR.
-  node_value.CopyTo(value);
-
-  return S_OK;
-}
-
-HRESULT ReadIntAttribute(IXMLDOMNode* node,
-                         const TCHAR* attr_name,
-                         int* value) {
-  ASSERT1(node != NULL);
-  ASSERT1(attr_name != NULL);
-  ASSERT1(value != NULL);
-
-  CComBSTR node_value;
-  HRESULT hr = ReadAttribute(node, attr_name, &node_value);
-  if (FAILED(hr)) { return hr; }
-  if (!String_StringToDecimalIntChecked(
-          static_cast<const TCHAR*>(node_value), value)) {
-          return E_FAIL;
-  }
-  return S_OK;
-}
-
-HRESULT ReadGuidAttribute(IXMLDOMNode* node,
-                          const TCHAR* attr_name,
-                          GUID* value) {
-  ASSERT1(node != NULL);
-  ASSERT1(attr_name != NULL);
-  ASSERT1(value != NULL);
-
-  CComBSTR node_value;
-  HRESULT hr = ReadAttribute(node, attr_name, &node_value);
-  if (FAILED(hr)) { return hr; }
-  hr = ::CLSIDFromString(static_cast<TCHAR*>(node_value), value);
-  if (FAILED(hr)) { return hr; }
-
-  return S_OK;
-}
-
-HRESULT ReadStringAttribute(IXMLDOMNode* node,
-                            const TCHAR* attr_name,
-                            CString* value) {
-  ASSERT1(node != NULL);
-  ASSERT1(attr_name != NULL);
-  ASSERT1(value != NULL);
-
-  CComBSTR node_value;
-  HRESULT hr = ReadAttribute(node, attr_name, &node_value);
-  if (FAILED(hr)) { return hr; }
-
-  // Will extract the underlying string.
-  *value = static_cast<TCHAR*>(node_value);
-
-  return S_OK;
-}
-
-HRESULT ParseAppUpdateCheckNode(IXMLDOMNode* node, AppData* request) {
-  ASSERT1(node);
-  ASSERT1(request);
-
-  // Read the tag value.
-  CString str;
-  ReadStringAttribute(node, Xml::Attribute::kTag, &str);
-  request->set_ap(str);
-
-  return S_OK;
-}
-
-HRESULT ParseAppPingNode(IXMLDOMNode* node, AppRequestData* request) {
-  ASSERT1(node);
-  ASSERT1(request);
-
-  // Read the event type.
-  int event_type = 0;
-  HRESULT hr = ReadIntAttribute(node, Xml::Attribute::kEventType, &event_type);
-  if (FAILED(hr)) { return hr; }
-
-  // Read the event result.
-  int event_result = 0;
-  hr = ReadIntAttribute(node, Xml::Attribute::kEventResult, &event_result);
-  if (FAILED(hr)) { return hr; }
-
-  // Read the errorcode.
-  int error_code = 0;
-  hr = ReadIntAttribute(node, Xml::Attribute::kErrorCode, &error_code);
-  if (FAILED(hr)) { return hr; }
-
-  // Read the extracode1.
-  int extra_code = 0;
-  hr = ReadIntAttribute(node, Xml::Attribute::kExtraCode1, &extra_code);
-  if (FAILED(hr)) { return hr; }
-
-  PingEvent ping_event(static_cast<PingEvent::Types>(event_type),
-                       static_cast<PingEvent::Results>(event_result),
-                       error_code,
-                       extra_code,
-                       CString());
-  request->AddPingEvent(ping_event);
-
-  return S_OK;
-}
-
-HRESULT ParseAppNode(IXMLDOMNode* node, AppRequestDataVector* request) {
-  ASSERT1(node);
-  ASSERT1(request);
-
-  AppRequest app_request;
-  AppData app_data;
-  AppRequestData app_request_data;
-
-  // Read the app guid.
-  GUID guid = {0};
-  HRESULT hr = ReadGuidAttribute(node, Xml::Attribute::kAppId, &guid);
-  if (FAILED(hr)) { return hr; }
-  app_data.set_app_guid(guid);
-
-  // Read the app version.
-  CString str;
-  hr = ReadStringAttribute(node, Xml::Attribute::kVersion, &str);
-  if (FAILED(hr)) { return hr; }
-  app_data.set_version(str);
-
-  // Read the app language.
-  hr = ReadStringAttribute(node, Xml::Attribute::kLang, &str);
-  if (FAILED(hr)) { return hr; }
-  app_data.set_language(str);
-
-  CComPtr<IXMLDOMNodeList> child_nodes;
-  // Get all the children of the Node.
-  hr = node->get_childNodes(&child_nodes);
-  if (FAILED(hr)) { return hr; }
-  if (!child_nodes) { return E_FAIL; }  // Protect against msxml S_FALSE return.
-
-  // Go Over all the children and read each of them. we will ignore ones that
-  // we dont understand.
-  hr = child_nodes->reset();
-  if (FAILED(hr)) { return hr; }
-
-  CComPtr<IXMLDOMNode> child_node;
-  while (child_nodes->nextNode(&child_node) != S_FALSE) {
-    XMLFQName child_node_name;
-    hr = GetXMLFQName(child_node, &child_node_name);
-    if (FAILED(hr)) { return hr; }
-
-    if (child_node_name.base == Xml::Element::kUpdateCheck) {
-      // Read in the update check request.
-      hr = ParseAppUpdateCheckNode(child_node, &app_data);
-      if (FAILED(hr)) { return hr; }
-    } else if (child_node_name.base == Xml::Element::kEvent) {
-      // Read in the ping request.
-      hr = ParseAppPingNode(child_node, &app_request_data);
-    }
-
-    child_node = NULL;
-  }
-
-  app_request_data.set_app_data(app_data);
-  request->push_back(app_request_data);
-  return S_OK;
-}
-
-HRESULT ParseGupdateNode(IXMLDOMNode* node, AppRequestDataVector* request) {
-  ASSERT1(node);
-  ASSERT1(request);
-
-  CComPtr<IXMLDOMNodeList> child_nodes;
-  // Get all the children of the Node.
-  HRESULT hr = node->get_childNodes(&child_nodes);
-  if (FAILED(hr)) { return hr; }
-  if (!child_nodes) { return E_FAIL; }  // Protect against msxml S_FALSE return.
-
-  // Go Over all the children and read each of them. we will ignore ones that
-  // we dont understand.
-  hr = child_nodes->reset();
-  if (FAILED(hr)) { return hr; }
-
-  CComPtr<IXMLDOMNode> child_node;
-  while (child_nodes->nextNode(&child_node) != S_FALSE) {
-    XMLFQName child_node_name;
-    hr = GetXMLFQName(child_node, &child_node_name);
-    if (FAILED(hr)) { return hr; }
-
-    if (child_node_name.base == Xml::Element::kApp) {
-      // we got a response we should read that in.
-      hr = ParseAppNode(child_node, request);
-      if (FAILED(hr)) { return hr; }
-    }
-    child_node = NULL;
-  }
-  return S_OK;
-}
-
-HRESULT ParseUpdateCheck(const CString& request_str,
-                         AppRequestDataVector* request) {
-  ASSERT1(request);
-
-  CComPtr<IXMLDOMDocument> document;
-  HRESULT hr = LoadXMLFromMemory(request_str, false, &document);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  CComPtr<IXMLDOMElement> document_element;
-  hr = document->get_documentElement(&document_element);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  if (!document_element) {  // Protect against msxml S_FALSE return.
-    return E_FAIL;
-  }
-
-  return ParseGupdateNode(document_element, request);
-}
-
-HRESULT BuildUpdateResponse(const ServerResponses& responses,
-                            CString* response) {
-  ASSERT1(response);
-
-  CString response_str(kResponseXmlHeader);
-  response_str.Append(kResponseXmlGupdateHeader);
-
-  for (size_t i = 0; i < responses.size(); ++i) {
-    CString guid = responses[i].guid;
-
-    if (responses[i].is_ping) {
-      // If the response is to a ping event, then we just add the ok to the
-      // response. The reason this works is because we either have a ping
-      // request or a update check, never both. If this changes, then we need
-      // to change this code.
-      response_str.AppendFormat(kResponseAppEvent, guid);
-    } else if (responses[i].is_update_response) {
-      // respond with the value of the updates.
-      UpdateResponseData data = responses[i].response_data;
-      response_str.AppendFormat(kResponseAppUpdate,
-                                guid,
-                                data.url(),
-                                data.hash(),
-                                data.needs_admin() ? _T("true") : _T("false"),
-                                data.size());
-    } else {
-      // respond with a no-update.
-      response_str.AppendFormat(kResponseAppNoUpdate, guid);
-    }
-  }
-
-  response_str.Append(kResponseGupdateEndTag);
-  *response = response_str;
-  return S_OK;
-}
-
-}  // namespace omaha
diff --git a/tools/OmahaCompatibility/HttpServer/xml_parser.h b/tools/OmahaCompatibility/HttpServer/xml_parser.h
deleted file mode 100644
index b5da2b9..0000000
--- a/tools/OmahaCompatibility/HttpServer/xml_parser.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_HTTPSERVER_XML_PARSER_H_
-#define OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_HTTPSERVER_XML_PARSER_H_
-
-#include <vector>
-#include "omaha/goopdate/request.h"
-#include "omaha/goopdate/update_response_data.h"
-#include "omaha/goopdate/update_response.h"
-#include "omaha/worker/app_request.h"
-
-namespace omaha {
-
-// Represents the server response to a get, if the request is a ping,
-// the server just responds with a ok. For now we only support
-// responses for update checks with update or no-update. Later on
-// extend the is_update_response to be a enum
-struct ServerResponse {
-  ServerResponse()
-    : is_ping(false),
-      is_update_response(false) {}
-
-  bool is_ping;
-  bool is_update_response;
-  CString guid;
-  UpdateResponseData response_data;
-};
-
-typedef std::vector<ServerResponse> ServerResponses;
-
-HRESULT ParseUpdateCheck(const CString& post_string,
-                         AppRequestDataVector* request);
-
-HRESULT BuildUpdateResponse(const ServerResponses& update_response,
-                            CString* response);
-
-}  // namespace omaha
-
-#endif  // OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_HTTPSERVER_XML_PARSER_H_
diff --git a/tools/OmahaCompatibility/build.scons b/tools/OmahaCompatibility/build.scons
deleted file mode 100644
index 40b17a2..0000000
--- a/tools/OmahaCompatibility/build.scons
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-
-Import('env')
-
-
-local_env = env.Clone()
-local_env.Append(
-    LIBS = [
-        ('atls.lib', 'atlsd.lib')[local_env.Bit('debug')],
-        ('libcmt.lib', 'libcmtd.lib')[local_env.Bit('debug')],
-        ('libcpmt.lib', 'libcpmtd.lib')[local_env.Bit('debug')],
-        'comctl32.lib',
-        'crypt32.lib',
-        'delayimp.lib',
-        'httpapi.lib',
-        'iphlpapi.lib',
-        'netapi32.lib',
-        'msi.lib',
-        'mstask.lib',
-        'psapi.lib',
-        'rasapi32.lib',
-        'rpcns4.lib',
-        'rpcrt4.lib',
-        'shlwapi.lib',
-        'version.lib',
-        'userenv.lib',
-        'wininet.lib',
-        'winhttp.lib',
-        'wintrust.lib',
-        'ws2_32.lib',
-        'wtsapi32.lib',
-
-        '$LIB_DIR/breakpad.lib',
-        '$LIB_DIR/common.lib',
-        '$LIB_DIR/core.lib',
-        '$LIB_DIR/goopdate_dll.lib',
-        '$LIB_DIR/google_update_ps.lib',
-        '$LIB_DIR/google_update_recovery.lib',
-        '$LIB_DIR/logging.lib',
-        '$LIB_DIR/net.lib',
-        '$LIB_DIR/repair_goopdate.lib',
-        '$LIB_DIR/security.lib',
-        '$LIB_DIR/service.lib',
-        '$LIB_DIR/setup.lib',
-        '$LIB_DIR/statsreport.lib',
-        '$LIB_DIR/worker.lib',
-        ],
-    CPPDEFINES = [
-        'UNICODE',
-        '_UNICODE'
-        ],
-)
-
-local_env.FilterOut(LINKFLAGS = ['/SUBSYSTEM:WINDOWS'])
-local_env['LINKFLAGS'] += ['/SUBSYSTEM:CONSOLE']
-
-# Avoid conflict over common/apply_tag.obj
-local_env.Dir('.').addRepository(local_env.Dir('$MAIN_DIR/common'))
-
-target_name = 'gucompat'
-
-inputs = [
-    'main.cc',
-    'console_writer.cc',
-    'compatibility_test.cc',
-    'common/config.cc',
-    'HttpServer/http_server.cc',
-    'HttpServer/download_handler.cc',
-    'HttpServer/update_check_handler.cc',
-    'HttpServer/xml_parser.cc',
-    'apply_tag.cc',  # Comes from $MAIN_DIR/common
-    ]
-if env.Bit('use_precompiled_headers'):
-  inputs += local_env.EnablePrecompile(target_name)
-
-local_env.ComponentTestProgram(
-    prog_name=target_name,
-    source=inputs,
-    COMPONENT_TEST_RUNNABLE=False
-)
diff --git a/tools/OmahaCompatibility/common/config.cc b/tools/OmahaCompatibility/common/config.cc
deleted file mode 100644
index d5539c1..0000000
--- a/tools/OmahaCompatibility/common/config.cc
+++ /dev/null
@@ -1,188 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/tools/omahacompatibility/common/config.h"
-#include <windows.h>
-#include <wincrypt.h>
-#include "base/scoped_ptr.h"
-#include "omaha/common/constants.h"
-#include "omaha/common/debug.h"
-#include "omaha/common/file.h"
-#include "omaha/common/logging.h"
-#include "omaha/common/scope_guard.h"
-#include "omaha/common/signatures.h"
-#include "omaha/common/path.h"
-#include "omaha/common/utils.h"
-
-namespace omaha {
-
-const TCHAR* const kConfigApplicationProfile = _T("Application");
-const TCHAR* const kConfigAppName = _T("AppName");
-const TCHAR* const kConfigAppGuid = _T("AppGuid");
-const TCHAR* const kConfigAppNeedsAdmin = _T("NeedsAdmin");
-const TCHAR* const kConfigAppLanguage = _T("Language");
-const TCHAR* const kConfigAppVersion1 = _T("Version1");
-const TCHAR* const kConfigAppInstaller1 = _T("Installer1");
-const TCHAR* const kConfigAppVersion2 = _T("Version2");
-const TCHAR* const kConfigAppInstaller2 = _T("Installer2");
-
-bool ComputeSHA(const CString& file_name, ConfigResponse* response) {
-  ASSERT1(response);
-
-  std::vector<CString> files;
-  std::vector<byte> hash_vector;
-  files.push_back(file_name);
-
-  // Check if the file exists
-  WIN32_FILE_ATTRIBUTE_DATA attrs;
-  BOOL success = GetFileAttributesEx(file_name, GetFileExInfoStandard, &attrs);
-  if (!success) {
-    return false;
-  }
-
-  // Calculate the hash
-  CryptoHash crypto;
-  crypto.Compute(files, 512000000L, &hash_vector);
-  CString encoded;
-  Base64::Encode(hash_vector, &encoded);
-  response->hash = encoded;
-  response->size = attrs.nFileSizeLow;
-
-  return true;
-}
-
-HRESULT ReadProfileString(const CString& file_name,
-                          const CString& key_name,
-                          CString* value) {
-  CString val;
-  DWORD ret = ::GetPrivateProfileString(kConfigApplicationProfile,
-                                        key_name,
-                                        _T(""),
-                                        CStrBuf(val, MAX_PATH),
-                                        MAX_PATH,
-                                        file_name);
-  if (ret == MAX_PATH - 1) {
-    return E_FAIL;
-  }
-  *value = val;
-
-  return S_OK;
-}
-
-HRESULT ReadConfigFile(const CString& file_name,
-                       const CString& download_url_prefix,
-                       ConfigResponses* config_responses) {
-  ASSERT1(config_responses);
-
-  ConfigResponse config_response;
-
-  CString app_name;
-  HRESULT hr = ReadProfileString(file_name, kConfigAppName, &app_name);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  config_response.app_name = app_name;
-
-  CString app_guid;
-  hr = ReadProfileString(file_name, kConfigAppGuid, &app_guid);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  config_response.guid = StringToGuid(app_guid);
-
-  CString needs_admin;
-  hr = ReadProfileString(file_name, kConfigAppNeedsAdmin, &needs_admin);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  const TCHAR* const kFalse = _T("false");
-  if (_wcsnicmp(kFalse, needs_admin, wcslen(kFalse)) == 0) {
-    config_response.needs_admin = false;
-  } else {
-    config_response.needs_admin = true;
-  }
-
-  CString language;
-  hr = ReadProfileString(file_name, kConfigAppLanguage, &language);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  config_response.language = language;
-
-
-  // Read the first config.
-  ConfigResponse config_response1 = config_response;
-  CString installer1;
-  hr = ReadProfileString(file_name, kConfigAppInstaller1, &installer1);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  if (!File::Exists(installer1)) {
-    printf("Error: Could not open file %s\n", installer1);
-    printf("Make sure you specify an absolute path to the file\n");
-    return E_FAIL;
-  }
-
-  if (!ComputeSHA(installer1, &config_response1)) {
-    return E_FAIL;
-  }
-
-  CString version1;
-  hr = ReadProfileString(file_name, kConfigAppVersion1, &version1);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  config_response1.version = version1;
-  config_response1.local_file_name = installer1;
-  config_response1.url = download_url_prefix + _T("/") +
-                         GetFileFromPath(installer1);
-
-  // Read the second config.
-  ConfigResponse config_response2 = config_response;
-  CString installer2;
-  hr = ReadProfileString(file_name, kConfigAppInstaller2, &installer2);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  if (!File::Exists(installer2)) {
-    printf("Error: Could not open file %s\n", installer1);
-    printf("Make sure you specify an absolute path to the file\n");
-    return E_FAIL;
-  }
-  if (!ComputeSHA(installer2, &config_response2)) {
-    return E_FAIL;
-  }
-
-  CString version2;
-  hr = ReadProfileString(file_name, kConfigAppVersion2, &version2);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  config_response2.version = version2;
-  config_response2.local_file_name = installer2;
-  config_response2.url = download_url_prefix + _T("/") +
-                         GetFileFromPath(installer2);
-
-  // Return the results.
-  config_responses->push_back(config_response1);
-  config_responses->push_back(config_response2);
-
-  return S_OK;
-}
-
-}  // namespace omaha
-
diff --git a/tools/OmahaCompatibility/common/config.h b/tools/OmahaCompatibility/common/config.h
deleted file mode 100644
index 935be80..0000000
--- a/tools/OmahaCompatibility/common/config.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_COMMON_CONFIG_H_
-#define OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_COMMON_CONFIG_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include <vector>
-
-namespace omaha {
-
-// This struct is used to hold the responses to give to a particular
-// application. It holds only the very basic information that is needed
-// to accomplish this. The real ascii protocol buffer used by the server
-// contains a lot more fields.
-struct ConfigResponse {
-  ConfigResponse(GUID g, const CString& v, const CString& u,
-                 const CString& h, int s, bool b)
-      : guid(g),
-        version(v),
-        url(u),
-        hash(h),
-        size(s),
-        needs_admin(b) {}
-
-  // The information to match the request against.
-  ConfigResponse() {}
-  CString app_name;
-  GUID guid;
-  CString version;
-  CString language;
-
-  // Response values.
-  CString local_file_name;
-  CString url;
-  CString hash;
-  int size;
-  bool needs_admin;
-};
-
-typedef std::vector<ConfigResponse> ConfigResponses;
-
-
-// Reads a config file that contains the specification
-// of the update responses of the server.
-// For an example of this file see example_config.txt.
-HRESULT ReadConfigFile(const CString& file_name,
-                       const CString& download_url_prefix,
-                       ConfigResponses* config_response);
-
-}  // namespace omaha
-
-#endif  // OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_COMMON_CONFIG_H_
diff --git a/tools/OmahaCompatibility/common/error.h b/tools/OmahaCompatibility/common/error.h
deleted file mode 100644
index 49e99dc..0000000
--- a/tools/OmahaCompatibility/common/error.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_COMMON_ERROR_H_
-#define OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_COMMON_ERROR_H_
-
-#include <windows.h>
-
-namespace omaha {
-
-// TODO(omaha): For now not using these, need to start using custom error codes.
-#define COMPATTEST_E_HANDLER_ALREADY_PRESENT            \
-  MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x100)
-
-#define COMPATTEST_E_RESPONSE_NOT_FOUND                 \
-  MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x101)
-
-}  // namespace omaha
-
-#endif  // OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_COMMON_ERROR_H_
diff --git a/tools/OmahaCompatibility/common/example_config.txt b/tools/OmahaCompatibility/common/example_config.txt
deleted file mode 100644
index 65970d9..0000000
--- a/tools/OmahaCompatibility/common/example_config.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-; NOTE TO ALL COPYING THIS FILE FOR MODIFICATIONS.
-; 1. Please do not add spaces in the AppName. This tool does not support
-;    it although omaha itself does.
-; 2. For now we only support one application and two versions.
-; 3. Please note that for now we only support this exact format
-;    and nothing else. ONLY change the values below i.e. the 
-;    value part of key=value.
-; 4. The AppName, Appguid, NeedsAdmin, and Language are self explanatory,
-;    Version1, and Version2 indicate the versions that the installers 
-;    pointed by Installer1 and Installer2 Install.
-
-[Application]
-AppName=YouTubeUploader
-AppGuid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}
-NeedsAdmin=False
-Language=en
-
-Version1=1.0.24.0
-Installer1=c:\Builds\youtubeuploader.msi
-
-Version2=2.0.0.0
-Installer2=c:\Builds\youtubeuploader.msi
\ No newline at end of file
diff --git a/tools/OmahaCompatibility/common/ping_observer.h b/tools/OmahaCompatibility/common/ping_observer.h
deleted file mode 100644
index fbe17f0..0000000
--- a/tools/OmahaCompatibility/common/ping_observer.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_COMMON_PING_OBSERVER_H_
-#define OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_COMMON_PING_OBSERVER_H_
-
-#include "omaha/worker/app_request_data.h"
-
-namespace omaha {
-
-// Interface for receiving ping events from the http server.
-class PingObserver {
- public:
-  virtual ~PingObserver() {}
-  virtual void Observe(const AppRequestData& data) = 0;
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_COMMON_PING_OBSERVER_H_
diff --git a/tools/OmahaCompatibility/compatibility_test.cc b/tools/OmahaCompatibility/compatibility_test.cc
deleted file mode 100644
index 573b77b..0000000
--- a/tools/OmahaCompatibility/compatibility_test.cc
+++ /dev/null
@@ -1,479 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/tools/omahacompatibility/compatibility_test.h"
-#include <Windows.h>
-#include <tchar.h>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/common/apply_tag.h"
-#include "omaha/common/constants.h"
-#include "omaha/common/debug.h"
-#include "omaha/common/error.h"
-#include "omaha/common/file.h"
-#include "omaha/common/logging.h"
-#include "omaha/common/path.h"
-#include "omaha/common/reg_key.h"
-#include "omaha/common/scope_guard.h"
-#include "omaha/common/system.h"
-#include "omaha/common/utils.h"
-#include "omaha/goopdate/config_manager.h"
-#include "omaha/goopdate/const_goopdate.h"
-#include "omaha/tools/omahacompatibility/common/ping_observer.h"
-#include "omaha/tools/omahacompatibility/httpserver/http_server.h"
-#include "omaha/tools/omahacompatibility/httpserver/update_check_handler.h"
-#include "omaha/tools/omahacompatibility/httpserver/download_handler.h"
-
-namespace omaha {
-
-const TCHAR* const kUpdateCheckUrlPath = _T("/service/update2");
-const TCHAR* const kDownloadUrlPath = _T("/download");
-const DWORD kAuCheckPeriodMs = 5 * 60 * 1000;
-const TCHAR* const kHost = _T("localhost");
-const TCHAR* const kUrl = _T("http://localhost:8001/");
-const TCHAR* const kDownloadUrl = _T("http://localhost:8001/download");
-const TCHAR* const kUpdateCheckUrl =
-    _T("http://localhost:8001/service/update2");
-const int kPort = 8001;
-
-int CompatibilityTest::Main(bool test_omaha) {
-  CORE_LOG(L1, (_T("[Main]")));
-
-  if (IsOmahaInstalled()) {
-    printf("\nOmaha is already installed on this machine.\n");
-    printf("The test may not work correctly.\n");
-    printf("Ensure that the version of omaha being pointed to\n");
-    printf("is atleast >= the registered versions reported above.\n");
-    printf("Are you sure you want to run this test (Y/N)?");
-
-    int response = getchar();
-    if (response == 'n' || response == 'N') {
-      return -1;
-    }
-  }
-
-  // Read the config file.
-  HRESULT hr = ReadConfigFile(config_file_,
-                              kDownloadUrl,
-                              &config_responses_);
-  if (FAILED(hr)) {
-    return -1;
-  }
-
-  // Create the observer with the guid.
-  console_writer_.reset(new ConsoleWriter(
-      GuidToString(config_responses_[0].guid)));
-
-  // Setup the registry to make omaha talk to the local server.
-  // TODO(omaha): Warn user about changing user settings.
-  hr = SetupRegistry(config_responses_[0].needs_admin);
-  if (FAILED(hr)) {
-    return -1;
-  }
-  ON_SCOPE_EXIT(&CompatibilityTest::RestoreRegistry);
-
-  printf("\nStarting the local http server.\n");
-  hr = StartHttpServer();
-  if (FAILED(hr)) {
-    printf("\nLocal Http server start failed.\n");
-    return -1;
-  }
-
-  if (test_omaha) {
-    printf("\nStarting Googleupdate to install application.");
-    printf("Please wait .....\n");
-    printf("Omaha UI should show up in a sec.");
-    printf("If it does not, please kill this process and restart test.\n");
-
-    hr = StartGoogleUpdate();
-    if (FAILED(hr)) {
-      // TODO(omaha): Maybe report a verbose error message indicating
-      // what could be wrong.
-      printf("\nThe installation failed.\n");
-      printf("Please refer to the omaha integration documentation\n");
-      printf("for more information, it is possible that when you rerun\n");
-      printf("you get a warning about omaha already running,\n");
-      printf("please choose to continue in this case\n");
-      return -1;
-    }
-
-    // TODO(omaha): Add a wait on the UI process, instead of depending on
-    // the user correctly dismissing the UI.
-    printf("\nThe installation completed successfully.\n");
-    printf("Please dismiss the installer UI.\n");
-    printf("Continue update test (Y/N)?");
-    fflush(stdin);
-    int response = getchar();
-    if (response =='n' || response == 'N') {
-      return -1;
-    }
-
-    hr = StartApplicationUpdate();
-    if (FAILED(hr)) {
-      printf("\nThe update failed.\n");
-      printf("Please take a look at the omaha integration documentation\n");
-      printf("and rerun the test. It is possible that when you rerun\n");
-      printf("you might get a warning about omaha already running,\n");
-      printf("please choose to continue in this case\n");
-      return -1;
-    }
-
-    printf("\nUpdate succeeded. Wee.\n");
-    printf("Congratulations on a successful install and update.\n");
-    printf("Your friendly compatibility assistant will take your leave now.\n");
-    printf("Bye\n");
-  } else {
-    while (true) {
-      ::SleepEx(10000, false);
-    }
-  }
-
-  return 0;
-}
-
-bool CompatibilityTest::IsOmahaInstalled() {
-  bool is_omaha_installed = false;
-  CString goopdate_key_name =
-      ConfigManager::Instance()->registry_clients_goopdate(true);
-  CString machine_version;
-  HRESULT hr = RegKey::GetValue(goopdate_key_name, kRegValueProductVersion,
-                                &machine_version);
-  if (SUCCEEDED(hr)) {
-    is_omaha_installed = true;
-  }
-
-  goopdate_key_name =
-      ConfigManager::Instance()->registry_clients_goopdate(false);
-  CString user_version;
-  hr = RegKey::GetValue(goopdate_key_name,
-                        kRegValueProductVersion,
-                        &user_version);
-  if (SUCCEEDED(hr)) {
-    is_omaha_installed = true;
-  }
-
-  if (is_omaha_installed) {
-    printf("\nOmaha Installed on machine!\n");
-    if (!machine_version.IsEmpty()) {
-      printf("Machine Omaha version: %s\n", CT2A(machine_version));
-    }
-
-    if (!user_version.IsEmpty()) {
-      printf("User Omaha version: %s\n", CT2A(user_version));
-    }
-  }
-
-  return is_omaha_installed;
-}
-
-// Starts the http server on a different thread.
-HRESULT CompatibilityTest::StartHttpServer() {
-  CORE_LOG(L1, (_T("[StartHttpServer]")));
-
-  reset(thread_,
-        ::CreateThread(NULL, 0,
-                       &CompatibilityTest::StartStartHttpServerInternal,
-                       this, 0, &thread_id_));
-  return S_OK;
-}
-
-DWORD WINAPI CompatibilityTest::StartStartHttpServerInternal(
-    void* param) {
-  CompatibilityTest* omaha_compat =
-      static_cast<CompatibilityTest*>(param);
-  omaha_compat->RunHttpServerInternal();
-  return 0;
-}
-
-HRESULT CompatibilityTest::RunHttpServerInternal() {
-  CORE_LOG(L1, (_T("Starting local http server")));
-
-  scoped_co_init init_com_apt(COINIT_MULTITHREADED);
-  HRESULT hr = init_com_apt.hresult();
-  if (FAILED(hr)) {
-    CORE_LOG(L1, (_T("[CoInitialize Failed.][0x%08x]"), hr));
-    return hr;
-  }
-
-  HttpServer server(kHost, kPort);
-  hr = server.Initialize();
-  if (FAILED(hr)) {
-    CORE_LOG(L1, (_T("[HttpServer Initialize failed.][0x%08x]"), hr));
-    return hr;
-  }
-
-  scoped_ptr<UpdateCheckHandler> update_handler(
-      new UpdateCheckHandler(kUpdateCheckUrlPath, console_writer_.get()));
-  hr = server.AddUrlHandler(update_handler.get());
-  if (FAILED(hr)) {
-    CORE_LOG(L1, (_T("[Failed to add update handler.][0x%08x]"), hr));
-    return hr;
-  }
-
-  scoped_ptr<DownloadHandler> download_handler(
-      new DownloadHandler(kDownloadUrlPath));
-  hr = server.AddUrlHandler(download_handler.get());
-  if (FAILED(hr)) {
-    CORE_LOG(L1, (_T("[Failed to add download handler.][0x%08x]"), hr));
-    return hr;
-  }
-
-  for (size_t i = 0; i < config_responses_.size(); ++i) {
-    update_handler->AddAppVersionResponse(config_responses_[i]);
-    download_handler->AddDownloadFile(config_responses_[i]);
-  }
-
-  update_handler.release();
-  download_handler.release();
-  server.Start();
-  return S_OK;
-}
-
-HRESULT CompatibilityTest::RestoreRegistry(void) {
-  CORE_LOG(L1, (_T("[RestoreRegistry]")));
-  HRESULT hr = RegKey::DeleteValue(MACHINE_REG_UPDATE_DEV,
-                                   kRegValueMonitorLastChecked);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = RegKey::DeleteValue(MACHINE_REG_UPDATE_DEV,
-                           kRegValueNamePingUrl);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = RegKey::DeleteValue(MACHINE_REG_UPDATE_DEV,
-                           kRegValueNameUrl);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = RegKey::DeleteValue(MACHINE_REG_UPDATE_DEV,
-                           kRegValueAuCheckPeriodMs);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  hr = RegKey::DeleteValue(MACHINE_REG_UPDATE_DEV,
-                           kRegValueNameOverInstall);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return S_OK;
-}
-
-HRESULT CompatibilityTest::SetupRegistry(bool needs_admin) {
-  CORE_LOG(L1, (_T("[SetupRegistry]")));
-
-  // Override the url, pingurl, AuCheckPeriod, overinstall.
-  // Create the lastchecked value monitor.
-  // Also create the last checked key, to allow a /ua launch
-  // on deletion.
-  HRESULT hr = RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                                kRegValueMonitorLastChecked,
-                                static_cast<DWORD>(1));
-  if (FAILED(hr)) {
-    CORE_LOG(L1, (_T("[SetValue failed.][0x%08x]"), hr));
-    return hr;
-  }
-
-  hr = RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                        kRegValueNamePingUrl,
-                        kUpdateCheckUrl);
-  if (FAILED(hr)) {
-    CORE_LOG(L1, (_T("[SetValue failed.][0x%08x]"), hr));
-    return hr;
-  }
-
-  hr = RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                        kRegValueNameUrl,
-                        kUpdateCheckUrl);
-  if (FAILED(hr)) {
-    CORE_LOG(L1, (_T("[SetValue failed.][0x%08x]"), hr));
-    return hr;
-  }
-
-  hr = RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                        kRegValueAuCheckPeriodMs,
-                        kAuCheckPeriodMs);
-  if (FAILED(hr)) {
-    CORE_LOG(L1, (_T("[SetValue failed.][0x%08x]"), hr));
-    return hr;
-  }
-
-  hr = RegKey::SetValue(MACHINE_REG_UPDATE_DEV,
-                        kRegValueNameOverInstall,
-                        static_cast<DWORD>(1));
-  if (FAILED(hr)) {
-    CORE_LOG(L1, (_T("[SetValue failed.][0x%08x]"), hr));
-    return hr;
-  }
-
-  CString update_key_name =
-      ConfigManager::Instance()->registry_update(needs_admin);
-  hr = RegKey::SetValue(update_key_name,
-                        kRegValueLastChecked,
-                        static_cast<DWORD>(0));
-  if (FAILED(hr)) {
-    CORE_LOG(L1, (_T("[SetValue failed.][0x%08x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// Builds the googleupdate file name to be run.
-HRESULT CompatibilityTest::BuildTaggedGoogleUpdatePath() {
-  CORE_LOG(L1, (_T("[BuildTaggedGoogleUpdatePath]")));
-
-  GUID guid(GUID_NULL);
-  HRESULT hr = ::CoCreateGuid(&guid);
-  if (FAILED(hr)) {
-    CORE_LOG(L1, (_T("[CoCreateGuid failed 0x%08x]"), hr));
-    return hr;
-  }
-
-  CString unique_exe(GuidToString(guid));
-  unique_exe += _T(".exe");
-
-  TCHAR temp_path[MAX_PATH] = {0};
-  if (!::GetTempPath(MAX_PATH, temp_path)) {
-    CORE_LOG(L1, (_T("[GetTempPath failed.]")));
-    return HRESULTFromLastError();
-  }
-
-  tagged_google_update_path_ = ConcatenatePath(temp_path, unique_exe);
-  return S_OK;
-}
-
-// Sets up the correct ap value to cause the server to send back
-// an update response.
-HRESULT CompatibilityTest::StartApplicationUpdate() {
-  CORE_LOG(L1, (_T("[StartApplicationUpdate]")));
-
-  // Set the ap value to "update_app".
-  bool needs_admin = config_responses_[0].needs_admin;
-  CString reg_key_name =
-      ConfigManager::Instance()->registry_client_state(needs_admin);
-  CString app_client_state_key_name = AppendRegKeyPath(
-      reg_key_name,
-      GuidToString(config_responses_[0].guid));
-  HRESULT hr = RegKey::SetValue(app_client_state_key_name,
-                                kRegValueAdditionalParams,
-                                _T("update_app"));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  // Delete the last checked value to force an update check.
-  CString update_key_name =
-      ConfigManager::Instance()->registry_update(needs_admin);
-  hr = RegKey::DeleteValue(update_key_name, kRegValueLastChecked);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  printf("\nSignaled Googleupdate to start application update.");
-  printf("Waiting for events...\n");
-  while (true) {
-    ::SleepEx(1000, false);
-    if (console_writer_->update_completed()) {
-      PingEvent::Results result = console_writer_->update_result();
-      if (result == PingEvent::EVENT_RESULT_SUCCESS) {
-        CORE_LOG(L1, (_T("[Successfully completed update]")));
-        return S_OK;
-      } else {
-        CORE_LOG(L1, (_T("[Update failed %d]"), result));
-        return E_FAIL;
-      }
-    }
-  }
-
-  return S_OK;
-}
-
-// Stamps googleupdatesetup with the information from the config and
-// runs it.
-HRESULT CompatibilityTest::StartGoogleUpdate() {
-  CORE_LOG(L1, (_T("[StartGoogleUpdate]")));
-
-  // Stamp the googleupdatesetupe.exe with the information from
-  // the config.
-  HRESULT hr = BuildTaggedGoogleUpdatePath();
-  if (FAILED(hr)) {
-    CORE_LOG(L1, (_T("[BuildTaggedGoogleUpdatePath failed 0x%08x]"), hr));
-    return hr;
-  }
-
-  // For now we only read the information from the first config and use
-  // that to stamp the binary.
-  CString tag_str;
-  tag_str.Format(
-      _T("appguid=%s&appname=%s&needsadmin=%s&lang=%s"),
-      GuidToString(config_responses_[0].guid),
-      config_responses_[0].app_name,
-      config_responses_[0].needs_admin ? _T("True") : _T("False"),
-      config_responses_[0].language);
-
-  ApplyTag tag;
-  hr = tag.Init(googleupdate_setup_path_,
-                CT2CA(tag_str),
-                lstrlenA(CT2CA(tag_str)),
-                tagged_google_update_path_,
-                false);
-  if (FAILED(hr)) {
-    CORE_LOG(L1, (_T("[ApplyTag.Init failed 0x%08x]"), hr));
-    return hr;
-  }
-
-  hr = tag.EmbedTagString();
-  if (FAILED(hr)) {
-    CORE_LOG(L1, (_T("[ApplyTag.EmbedTagString failed 0x%08x]"), hr));
-    return hr;
-  }
-
-  // Start omaha to install the application.
-  hr = System::ShellExecuteProcess(tagged_google_update_path_,
-                                   NULL,
-                                   NULL,
-                                   NULL);
-  if (FAILED(hr)) {
-    CORE_LOG(L1, (_T("[Start installer failed 0x%08x]"), hr));
-    return hr;
-  }
-
-  // Now wait for the install to complete. We poll the
-  // observer for a install complete event.
-  while (true) {
-    ::SleepEx(1000, false);
-    if (console_writer_->install_completed()) {
-      PingEvent::Results result = console_writer_->install_result();
-      if (result == PingEvent::EVENT_RESULT_SUCCESS) {
-        CORE_LOG(L1, (_T("[Successfully completed install]")));
-        return S_OK;
-      } else {
-        CORE_LOG(L1, (_T("[Start installer failed %d]"), result));
-        return E_FAIL;
-      }
-    }
-  }
-
-  return S_OK;
-}
-
-}  // namespace omaha
-
diff --git a/tools/OmahaCompatibility/compatibility_test.h b/tools/OmahaCompatibility/compatibility_test.h
deleted file mode 100644
index d529a2c..0000000
--- a/tools/OmahaCompatibility/compatibility_test.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_COMPATIBILITY_TEST_H_
-#define OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_COMPATIBILITY_TEST_H_
-
-#include <Windows.h>
-#include <tchar.h>
-#include "base/scoped_ptr.h"
-#include "omaha/common/scope_guard.h"
-#include "omaha/common/apply_tag.h"
-#include "omaha/common/constants.h"
-#include "omaha/common/debug.h"
-#include "omaha/common/error.h"
-#include "omaha/common/file.h"
-#include "omaha/common/logging.h"
-#include "omaha/common/path.h"
-#include "omaha/common/reg_key.h"
-#include "omaha/common/utils.h"
-#include "omaha/tools/omahacompatibility/console_writer.h"
-#include "omaha/tools/omahacompatibility/HttpServer/http_server.h"
-#include "omaha/tools/omahacompatibility/HttpServer/update_check_handler.h"
-#include "omaha/tools/omahacompatibility/HttpServer/download_handler.h"
-
-namespace omaha {
-
-// This is the main class the starts the HttpServer and stamps GoogleUpdate
-// appropriately and runs the installer.
-class CompatibilityTest {
- public:
-  CompatibilityTest() : thread_id_(0) {}
-  int Main(bool test_omaha);
-  void set_config_file(const CString& config_file) {
-    config_file_ = config_file;
-  }
-  void set_googleupdate_setup_path(const CString& path) {
-    googleupdate_setup_path_ = path;
-  }
-  HRESULT RunHttpServerInternal();
-
- private:
-  static DWORD WINAPI StartStartHttpServerInternal(void* omaha);
-
-  // Returns true of omaha is installer for user or machine.
-  bool IsOmahaInstalled();
-
-  // Starts running the HttpServer.
-  HRESULT StartHttpServer();
-
-  // Overrides the url, pingurl, aucheckperiod, overinstall values.
-  static HRESULT SetupRegistry(bool needs_admin);
-
-  // Restores the values of the registry.
-  static HRESULT RestoreRegistry();
-
-  // Builds a unique path to run the installer from.
-  HRESULT BuildTaggedGoogleUpdatePath();
-
-  // Stamps googleupdate with the correct values and runs the it.
-  HRESULT StartGoogleUpdate();
-
-  // Signals omaha to update the application.
-  HRESULT StartApplicationUpdate();
-
-  scoped_thread thread_;
-  DWORD thread_id_;
-  CString config_file_;
-  CString googleupdate_setup_path_;
-  ConfigResponses config_responses_;
-  CString tagged_google_update_path_;
-  scoped_ptr<ConsoleWriter> console_writer_;
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_COMPATIBILITY_TEST_H_
diff --git a/tools/OmahaCompatibility/console_writer.cc b/tools/OmahaCompatibility/console_writer.cc
deleted file mode 100644
index bdcd184..0000000
--- a/tools/OmahaCompatibility/console_writer.cc
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/tools/omahacompatibility/console_writer.h"
-#include <Windows.h>
-#include <tchar.h>
-#include "omaha/common/debug.h"
-#include "omaha/common/logging.h"
-#include "omaha/common/utils.h"
-#include "omaha/tools/omahacompatibility/common/ping_observer.h"
-
-namespace omaha {
-
-CString ConsoleWriter::PingTypeToString(PingEvent::Types type)  {
-  switch (type) {
-    case PingEvent::EVENT_UNKNOWN:
-      return _T("EVENT_UNKNOWN");
-    case PingEvent::EVENT_INSTALL_DOWNLOAD_FINISH:
-      return _T("EVENT_INSTALL_DOWNLOAD_FINISH");
-    case PingEvent::EVENT_INSTALL_COMPLETE:
-      return _T("EVENT_INSTALL_COMPLETE");
-    case PingEvent::EVENT_UPDATE_COMPLETE:
-      return _T("EVENT_UPDATE_COMPLETE");
-    case PingEvent::EVENT_UNINSTALL:
-      return _T("EVENT_UNINSTALL");
-    case PingEvent::EVENT_INSTALL_DOWNLOAD_START:
-      return _T("EVENT_INSTALL_DOWNLOAD_START");
-    case PingEvent::EVENT_INSTALL_INSTALLER_START:
-      return _T("EVENT_INSTALL_INSTALLER_START");
-    case PingEvent::EVENT_INSTALL_APPLICATION_BEGIN:
-      return _T("EVENT_INSTALL_APPLICATION_BEGIN");
-
-    // Install Setup events.
-    case PingEvent::EVENT_SETUP_INSTALL_BEGIN:
-      return _T("EVENT_SETUP_INSTALL_BEGIN");
-    case PingEvent::EVENT_SETUP_INSTALL_COMPLETE:
-      return _T("EVENT_SETUP_INSTALL_COMPLETE");
-
-    // Register Product Events.
-    case PingEvent::EVENT_REGISTER_PRODUCT_COMPLETE:
-      return _T("EVENT_REGISTER_PRODUCT_COMPLETE");
-
-    // Update Events.
-    case PingEvent::EVENT_UPDATE_APPLICATION_BEGIN:
-      return _T("EVENT_UPDATE_APPLICATION_BEGIN");
-    case PingEvent::EVENT_UPDATE_DOWNLOAD_START:
-      return _T("EVENT_UPDATE_DOWNLOAD_START");
-    case PingEvent::EVENT_UPDATE_DOWNLOAD_FINISH:
-      return _T("EVENT_UPDATE_DOWNLOAD_FINISH");
-    case PingEvent::EVENT_UPDATE_INSTALLER_START:
-      return _T("EVENT_UPDATE_INSTALLER_START");
-
-    // Self-update Setup events.
-    case PingEvent::EVENT_SETUP_UPDATE_BEGIN:
-      return _T("EVENT_SETUP_UPDATE_BEGIN");
-    case PingEvent::EVENT_SETUP_UPDATE_COMPLETE:
-      return _T("EVENT_SETUP_UPDATE_COMPLETE");
-
-    // Other events.
-    case PingEvent::EVENT_INSTALL_OEM_FIRST_CHECK:
-      return _T("EVENT_INSTALL_OEM_FIRST_CHECK");
-    case PingEvent::EVENT_APP_COMMAND_BEGIN:
-      return _T("EVENT_APP_COMMAND_BEGIN");
-    case PingEvent::EVENT_APP_COMMAND_COMPLETE:
-      return _T("EVENT_APP_COMMAND_COMPLETE");
-
-    // Failure report events - not part of the normal flow.
-    case PingEvent::EVENT_SETUP_INSTALL_FAILURE:
-      return _T("EVENT_SETUP_INSTALL_FAILURE");
-    case PingEvent::EVENT_SETUP_COM_SERVER_FAILURE:
-      return _T("EVENT_SETUP_COM_SERVER_FAILURE");
-    case PingEvent::EVENT_SETUP_UPDATE_FAILURE:
-      return _T("EVENT_SETUP_UPDATE_FAILURE");
-    default:
-      return _T("Unknown");
-  }
-}
-
-CString ConsoleWriter::PingResultToString(PingEvent::Results result)  {
-  switch (result) {
-    case PingEvent::EVENT_RESULT_ERROR:
-      return _T("EVENT_RESULT_ERROR");
-    case PingEvent::EVENT_RESULT_SUCCESS:
-      return _T("EVENT_RESULT_SUCCESS");
-    case PingEvent::EVENT_RESULT_SUCCESS_REBOOT:
-      return _T("EVENT_RESULT_SUCCESS_REBOOT");
-    case PingEvent::EVENT_RESULT_CANCELLED:
-      return _T("EVENT_RESULT_CANCELLED");
-    case PingEvent::EVENT_RESULT_INSTALLER_ERROR_MSI:
-      return _T("EVENT_RESULT_INSTALLER_ERROR_MSI");
-    case PingEvent::EVENT_RESULT_INSTALLER_ERROR_OTHER:
-      return _T("EVENT_RESULT_INSTALLER_ERROR_OTHER");
-    case PingEvent::EVENT_RESULT_NOUPDATE:
-      return _T("EVENT_RESULT_NOUPDATE");
-    case PingEvent::EVENT_RESULT_INSTALLER_ERROR_SYSTEM:
-      return _T("EVENT_RESULT_INSTALLER_ERROR_SYSTEM");
-    case PingEvent::EVENT_RESULT_UPDATE_DEFERRED:
-      return _T("EVENT_RESULT_UPDATE_DEFERRED");
-    default:
-      return _T("unknown result");
-  }
-}
-
-bool ConsoleWriter::IsUpdateCompletedEvent(const CString& app_guid,
-                                           const PingEvent& ping) {
-  return app_guid == app_guid_ &&
-         ping.event_type() == PingEvent::EVENT_UPDATE_COMPLETE;
-}
-
-bool ConsoleWriter::IsInstallCompletedEvent(const CString& app_guid,
-                                            const PingEvent& ping) {
-  return app_guid == app_guid_ &&
-         ping.event_type() == PingEvent::EVENT_INSTALL_COMPLETE;
-}
-
-void ConsoleWriter::Observe(const AppRequestData& data) {
-  PingEventVector::const_iterator iter = data.ping_events_begin();
-  for (; iter != data.ping_events_end(); ++iter) {
-    PingEvent ping = *iter;
-    CString msg;
-    msg.Format(_T("\nPing App = %s, Type = %s, Result = %s, Error = %d\n"),
-               GuidToString(data.app_data().app_guid()),
-               PingTypeToString(ping.event_type()),
-               PingResultToString(ping.event_result()),
-               ping.error_code());
-    printf("%S", msg);
-    CORE_LOG(L1, (msg));
-
-    if (IsInstallCompletedEvent(GuidToString(data.app_data().app_guid()),
-                                ping)) {
-      __mutexScope(lock_);
-      install_result_ = ping.event_result();
-      install_completed_ = true;
-    } else if (IsUpdateCompletedEvent(GuidToString(data.app_data().app_guid()),
-                                      ping)) {
-      __mutexScope(lock_);
-      update_result_ = ping.event_result();
-      update_completed_ = true;
-    }
-  }
-}
-
-}  // namespace omaha
diff --git a/tools/OmahaCompatibility/console_writer.h b/tools/OmahaCompatibility/console_writer.h
deleted file mode 100644
index 21b9342..0000000
--- a/tools/OmahaCompatibility/console_writer.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_CONSOLE_WRITER_H_
-#define OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_CONSOLE_WRITER_H_
-
-#include <Windows.h>
-#include <tchar.h>
-#include "omaha/common/synchronized.h"
-#include "omaha/common/debug.h"
-#include "omaha/common/logging.h"
-#include "omaha/worker/ping_event.h"
-#include "omaha/tools/omahacompatibility/common/ping_observer.h"
-
-namespace omaha {
-
-// Observer that writes to the console. It also remembers
-// the result for install and update completed event.
-class ConsoleWriter : public PingObserver {
- public:
-  explicit ConsoleWriter(const CString& app_guid)
-      : app_guid_(app_guid),
-        install_completed_(false),
-        install_result_(PingEvent::EVENT_RESULT_ERROR),
-        update_completed_(false),
-        update_result_(PingEvent::EVENT_RESULT_ERROR) {}
-  virtual ~ConsoleWriter() {}
-  virtual void Observe(const AppRequestData& data);
-
-  // Indicates if a install complete event has been received.
-  bool install_completed() const {
-    return install_completed_;
-  }
-  PingEvent::Results install_result() const {
-    return install_result_;
-  }
-
-  // Indicates if a update complete event has been received.
-  bool update_completed() const {
-    return update_completed_;
-  }
-  PingEvent::Results update_result() const {
-    return update_result_;
-  }
-
- private:
-  bool IsInstallCompletedEvent(const CString& app_guid,
-                               const PingEvent& ping);
-  bool IsUpdateCompletedEvent(const CString& app_guid,
-                              const PingEvent& ping);
-  CString PingResultToString(PingEvent::Results result);
-  CString PingTypeToString(PingEvent::Types type);
-
-  CString app_guid_;
-  LLock lock_;
-  PingEvent::Results install_result_;
-  bool install_completed_;
-  PingEvent::Results update_result_;
-  bool update_completed_;
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_TOOLS_SRC_OMAHACOMPATIBILITY_CONSOLE_WRITER_H_
diff --git a/tools/OmahaCompatibility/main.cc b/tools/OmahaCompatibility/main.cc
deleted file mode 100644
index 18f1d6a..0000000
--- a/tools/OmahaCompatibility/main.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Invoke with:
-// omaha_comtibility_test.exe <path>\example_config.txt
-//                            <path>\GoogleUpdateSetup.exe
-// or if you only want to run the httpserver that reads the config and responds
-// appropriately use
-// OmahaCompatibility.exe <path>\example_config.txt
-//
-
-#include <Windows.h>
-#include <tchar.h>
-#include "omaha/common/vistautil.h"
-#include "omaha/tools/omahacompatibility/compatibility_test.h"
-
-void PrintUsage() {
-  wprintf(_T("Incorrect arguments\n")
-          _T("Usage:\n")
-          _T("OmahaCompatibility <Full path to config file>")
-          _T("                   <Full path to googleupdatesetup.exe>\n")
-          _T("\nor:\n")
-          _T("OmahaCompatibility <Full path to config file>")
-          _T("Note: The debug version of googleupdatesetup is needed.\n")
-          _T("You need to be admin on the machine to run this program,\n")
-          _T("although omaha itself does not need admin to run."));
-}
-
-// Set the appropriate update dev registry keys. Url, AuCheckPeriodMs
-// Start the http server.
-// Launch googleupdate.
-int _tmain(int argc, TCHAR* argv[]) {
-  if (argc < 2 || argc > 3) {
-    PrintUsage();
-    return -1;
-  }
-
-  // TODO(omaha): Remove this requirement. This is needed for now, since we
-  // need permissions to write the updatedev key to override the url that omaha
-  // talks to.
-  if (!omaha::vista_util::IsUserAdmin()) {
-    PrintUsage();
-    return -1;
-  }
-
-  omaha::CompatibilityTest compat_test;
-  compat_test.set_config_file(argv[1]);
-
-  bool test_omaha = false;
-  if (argc == 3) {
-    compat_test.set_googleupdate_setup_path(argv[2]);
-    test_omaha = true;
-  }
-  return compat_test.Main(test_omaha);
-}
-
diff --git a/tools/ReadTag/build.scons b/tools/ReadTag/build.scons
deleted file mode 100644
index 038d363..0000000
--- a/tools/ReadTag/build.scons
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-
-Import('env')
-
-
-local_env = env.Clone()
-local_env.Append(
-    LIBS = [
-        ('atls.lib', 'atlsd.lib')[local_env.Bit('debug')],
-        ('libcmt.lib', 'libcmtd.lib')[local_env.Bit('debug')],
-        ('libcpmt.lib', 'libcpmtd.lib')[local_env.Bit('debug')],
-        'netapi32.lib',
-        'psapi.lib',
-        'rasapi32.lib',
-        'shlwapi.lib',
-        'userenv.lib',
-        'version.lib',
-        'wtsapi32.lib',
-
-        '$LIB_DIR/common.lib',
-        ],
-    CPPDEFINES = [
-        'UNICODE',
-        '_UNICODE'
-        ],
-)
-
-local_env.FilterOut(LINKFLAGS = ['/SUBSYSTEM:WINDOWS'])
-local_env['LINKFLAGS'] += ['/SUBSYSTEM:CONSOLE']
-
-target_name = 'ReadTag'
-
-inputs = [
-    'read_tag.cc',
-    ]
-if env.Bit('use_precompiled_headers'):
-  inputs += local_env.EnablePrecompile(target_name)
-
-local_env.ComponentTestProgram(
-    prog_name=target_name,
-    source=inputs,
-    COMPONENT_TEST_RUNNABLE=False
-)
diff --git a/tools/ReadTag/read_tag.cc b/tools/ReadTag/read_tag.cc
deleted file mode 100644
index 39ccdea..0000000
--- a/tools/ReadTag/read_tag.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Simple tool to read the stamped tag inside a binary.
-
-#include <Windows.h>
-#include <stdio.h>
-#include "base/scoped_ptr.h"
-#include "omaha/common/file.h"
-#include "omaha/common/extractor.h"
-
-int _tmain(int argc, TCHAR* argv[]) {
-  if (argc != 2) {
-    _tprintf(_T("Incorrect number of arguments!\n"));
-    _tprintf(_T("Usage: ReadTag <tagged_file>\n"));
-    return -1;
-  }
-
-  const TCHAR* file = argv[1];
-  if (!omaha::File::Exists(file)) {
-    _tprintf(_T("File \"%s\" not found"), file);
-    return -1;
-  }
-
-  omaha::TagExtractor ext;
-  if (!ext.OpenFile(file)) {
-    _tprintf(_T("Could not open file \"%s\""), file);
-    return -1;
-  }
-
-  int len = 0;
-  if (!ext.ExtractTag(NULL, &len)) {
-    _tprintf(_T("Extract tag failed."));
-    return -1;
-  }
-
-  scoped_array<char> buffer(new char[len]);
-  if (!ext.ExtractTag(buffer.get(), &len)) {
-    _tprintf(_T("Extract tag failed."));
-    return -1;
-  }
-
-  printf("Tag = '%s'", buffer);
-  return 0;
-}
diff --git a/tools/SetShutDownEvent/build.scons b/tools/SetShutDownEvent/build.scons
deleted file mode 100644
index 44e6312..0000000
--- a/tools/SetShutDownEvent/build.scons
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-
-Import('env')
-
-
-local_env = env.Clone()
-local_env.Append(
-    LIBS = [
-        ('atls.lib', 'atlsd.lib')[local_env.Bit('debug')],
-        ('libcmt.lib', 'libcmtd.lib')[local_env.Bit('debug')],
-        ('libcpmt.lib', 'libcpmtd.lib')[local_env.Bit('debug')],
-        'netapi32.lib',
-        'psapi.lib',
-        'rasapi32.lib',
-        'shlwapi.lib',
-        'userenv.lib',
-        'version.lib',
-        'wtsapi32.lib',
-
-        '$LIB_DIR/common.lib',
-        ],
-    CPPDEFINES = [
-        'UNICODE',
-        '_UNICODE'
-        ],
-)
-
-local_env.FilterOut(LINKFLAGS = ['/SUBSYSTEM:WINDOWS'])
-local_env['LINKFLAGS'] += ['/SUBSYSTEM:CONSOLE']
-
-target_name = 'SetShutDownEvent'
-
-inputs = [
-    'signal_shutdown.cc',
-    ]
-if env.Bit('use_precompiled_headers'):
-  inputs += local_env.EnablePrecompile(target_name)
-
-
-local_env.ComponentTestProgram(
-    prog_name=target_name,
-    source=inputs,
-    COMPONENT_TEST_RUNNABLE=False
-)
diff --git a/tools/SetShutDownEvent/signal_shutdown.cc b/tools/SetShutDownEvent/signal_shutdown.cc
deleted file mode 100644
index f7d5f68..0000000
--- a/tools/SetShutDownEvent/signal_shutdown.cc
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Simple tool to signal the shutdownevent.
-
-#include <Windows.h>
-#include <stdio.h>
-
-#include "omaha/common/const_object_names.h"
-#include "omaha/common/scoped_any.h"
-#include "omaha/common/utils.h"
-
-int _tmain(int argc, TCHAR* argv[]) {
-  if (argc != 2) {
-    _tprintf(_T("Tool to set the Goopdate ShutdownEvent.\n"));
-    _tprintf(_T("Usage: SetShutDownEvent <true>\n"));
-    _tprintf(_T("If arg=true the machine shutdown event is signalled.\n"));
-    return -1;
-  }
-
-  bool is_machine = false;
-  if (_tcsncmp(_T("true"), argv[1], ARRAYSIZE(_T("true"))) == 0) {
-    is_machine = true;
-  }
-
-  omaha::NamedObjectAttributes attr;
-  GetNamedObjectAttributes(omaha::kShutdownEvent, is_machine, &attr);
-  // Manual reset=true and signaled=false
-  scoped_handle shutdown_event(::CreateEvent(&attr.sa,
-                                             true,
-                                             false,
-                                             attr.name));
-  if (!shutdown_event) {
-    DWORD error = GetLastError();
-    _tprintf(_T("CreateEvent failed. error = %d\n"), error);
-    return error;
-  }
-
-  if (!::SetEvent(get(shutdown_event))) {
-    DWORD error = GetLastError();
-    _tprintf(_T("SetEvent failed. error = %d\n"), error);
-    return error;
-  }
-  _tprintf(_T("Done\n"));
-  return 0;
-}
diff --git a/tools/build.scons b/tools/build.scons
deleted file mode 100644
index 96d8ae6..0000000
--- a/tools/build.scons
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright 2008-2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-subdirs = []
-
-if not env.Bit('min'):
-  subdirs += [
-      'ApplyTag',
-      'CrashProcess',
-      ]
-
-for dir in subdirs:
-  env.BuildSConscript(dir)
diff --git a/tools/generate_omaha3_idl.py b/tools/generate_omaha3_idl.py
deleted file mode 100644
index 7e0445d..0000000
--- a/tools/generate_omaha3_idl.py
+++ /dev/null
@@ -1,116 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2011 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-"""Generates IDL file Omaha3 internfaces."""
-
-import commands
-import getopt
-import os
-import sys
-
-
-def _GetStatusOutput(cmd):
-  """Return (status, output) of executing cmd in a shell."""
-  if os.name == "nt":
-    pipe = os.popen(cmd + " 2>&1", "r")
-    text = pipe.read()
-    sts = pipe.close()
-    if sts is None: sts = 0
-    if text[-1:] == "\n": text = text[:-1]
-    return sts, text
-  else:
-    return commands.getstatusoutput(cmd)
-
-
-def _GenerateGuid():
-  (status, guid) = _GetStatusOutput("uuidgen.exe /c")
-  if status != 0:
-    raise SystemError("Failed to get GUID: %s" % guid)
-  return guid
-
-
-def _GenerateIDLText(idl_template):
-  guid_placehold_marker = "___AUTO_GENERATED_GUID___"
-  while guid_placehold_marker in idl_template:
-    idl_template = idl_template.replace(guid_placehold_marker,
-                                        _GenerateGuid(),
-                                        1)
-  return idl_template
-
-
-def _GenerateIDLFile(idl_template_filename, idl_output_filename):
-  f_in = open(idl_template_filename, "r")
-  idl_template = f_in.read()
-  f_in.close()
-
-  idl_output = _GenerateIDLText(idl_template)
-
-  f_out = open(idl_output_filename, "w")
-  f_out.write("// *** AUTOGENERATED FILE. DO NOT HAND-EDIT ***\n\n")
-  f_out.write(idl_output)
-  f_out.close()
-
-
-def _Usage():
-  """Prints out script usage information."""
-  print """
-generate_omaha3_idl.py: Write out the given IDL file.
-
-Usage:
-  generate_omaha3_idl.py [--help
-                          | --idl_template_file filename
-                            --idl_output_file filename]
-
-Options:
-  --help                        Show this information.
-  --idl_output_file filename    Path/name of output IDL filename.
-  --idl_template_file filename  Path/name of input IDL template.
-"""
-
-
-def _Main():
-  """Generates IDL file."""
-  # use getopt to parse the option and argument list; this may raise, but
-  # don't catch it
-  argument_list = ["help", "idl_template_file=", "idl_output_file="]
-  (opts, unused_args) = getopt.getopt(sys.argv[1:], "", argument_list)
-  if not opts or ("--help", "") in opts:
-    _Usage()
-    sys.exit()
-
-  idl_template_filename = ""
-  idl_output_filename = ""
-
-  for (o, v) in opts:
-    if o == "--idl_template_file":
-      idl_template_filename = v
-    if o == "--idl_output_file":
-      idl_output_filename = v
-
-  # make sure we have work to do
-  if not idl_template_filename:
-    raise StandardError("no idl_template_filename specified")
-  if not idl_output_filename:
-    raise StandardError("no idl_output_filename specified")
-
-  _GenerateIDLFile(idl_template_filename, idl_output_filename)
-  sys.exit()
-
-
-if __name__ == "__main__":
-  _Main()
-
diff --git a/tools/goopdump/build.scons b/tools/goopdump/build.scons
deleted file mode 100644
index 7ce4e74..0000000
--- a/tools/goopdump/build.scons
+++ /dev/null
@@ -1,139 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-# Builds goopdump.exe which is a utility for dumping config info for
-# googleupdate.
-
-
-Import('env')
-
-#
-# Build Goopdump.lib
-#
-lib_env = env.Clone()
-
-target_name = 'goopdump.lib'
-
-lib_inputs = [
-    'data_dumper.cc',
-    'data_dumper_app_manager.cc',
-    'data_dumper_goopdate.cc',
-    'data_dumper_network.cc',
-    'data_dumper_oneclick.cc',
-    'data_dumper_osdata.cc',
-    'dump_log.cc',
-    'goopdump.cc',
-    'goopdump_cmd_line_parser.cc',
-    'process_commandline.cc',
-    'process_monitor.cc',
-    ]
-if env.Bit('use_precompiled_headers'):
-  lib_inputs += lib_env.EnablePrecompile(target_name)
-
-lib_env.ComponentLibrary(
-    lib_name=target_name,
-    source=lib_inputs
-)
-
-
-#
-# Build Goopdump.exe
-#
-exe_env = env.Clone()
-
-omaha_version_info = exe_env['omaha_versions_info'][0]
-
-exe_env.Append(
-    RCFLAGS = [
-        '/DVERSION_MAJOR=%d' % omaha_version_info.version_major,
-        '/DVERSION_MINOR=%d' % omaha_version_info.version_minor,
-        '/DVERSION_BUILD=%d' % omaha_version_info.version_build,
-        '/DVERSION_PATCH=%d' % omaha_version_info.version_patch,
-        '/DVERSION_NUMBER_STRING=\\"%s\\"' % (
-            omaha_version_info.GetVersionString()),
-        '/DLANGAUGE_STRING=\\"en\\"',
-        ],
-
-    LIBS = [
-        'delayimp.lib',
-        'kernel32.lib',
-        'pdh.lib',
-        '$LIB_DIR/common.lib',
-        '$LIB_DIR/goopdate_dll.lib',
-        '$LIB_DIR/logging.lib',
-        '$LIB_DIR/net.lib',
-        '$LIB_DIR/statsreport.lib',
-        '$LIB_DIR/goopdump.lib',
-        '$LIB_DIR/worker.lib',
-        ('atls.lib', 'atlsd.lib')[exe_env.Bit('debug')],
-        ('libcmt.lib', 'libcmtd.lib')[exe_env.Bit('debug')],
-        ('libcpmt.lib', 'libcpmtd.lib')[exe_env.Bit('debug')],
-        'advapi32.lib',
-        'comctl32.lib',
-        'crypt32.lib',
-        'delayimp.lib',
-        'Iphlpapi.lib',
-        'msi.lib',
-        'mstask.lib',
-        'netapi32.lib',
-        'ole32.lib',
-        'oleaut32.lib',
-        'psapi.lib',
-        'rasapi32.lib',
-        'secur32.lib',
-        'shell32.lib',
-        'shlwapi.lib',
-        'user32.lib',
-        'version.lib',
-        'urlmon.lib',
-        'userenv.lib',
-        'uuid.lib',
-        'wininet.lib',
-        'wintrust.lib',
-        'wtsapi32.lib',
-        ],
-
-    LINKFLAGS = [
-        '/DELAYLOAD:ole32.dll',
-        '/DELAYLOAD:oleaut32.dll',
-        '/DELAYLOAD:psapi.dll',
-        '/DELAYLOAD:rasapi32.dll',
-        '/DELAYLOAD:shell32.dll',
-        '/DELAYLOAD:shlwapi.dll',
-        '/DELAYLOAD:userenv.dll',
-        '/DELAYLOAD:version.dll',
-        '/DELAYLOAD:wtsapi32.dll',
-        ],
-)
-
-exe_env.FilterOut(LINKFLAGS = ['/SUBSYSTEM:WINDOWS'])
-exe_env['LINKFLAGS'] += ['/SUBSYSTEM:CONSOLE']
-
-target_name = 'goopdump'
-
-exe_inputs = [
-    'goopdump_main.cc',
-    exe_env.RES('resource.rc'),
-    ]
-if env.Bit('use_precompiled_headers'):
-  exe_inputs += exe_env.EnablePrecompile(target_name)
-
-exe_env.ComponentTestProgram(
-    prog_name=target_name,
-    source=exe_inputs,
-    COMPONENT_TEST_RUNNABLE=False,
-)
diff --git a/tools/goopdump/data_dumper.cc b/tools/goopdump/data_dumper.cc
deleted file mode 100644
index 6ee6169..0000000
--- a/tools/goopdump/data_dumper.cc
+++ /dev/null
@@ -1,146 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/tools/goopdump/data_dumper.h"
-
-#include "omaha/common/reg_key.h"
-#include "omaha/tools/goopdump/dump_log.h"
-
-namespace omaha {
-
-DataDumper::DataDumper() {
-}
-
-DataDumper::~DataDumper() {
-}
-
-void DataDumper::DumpRegValueStr(const DumpLog& dump_log,
-                                 const TCHAR* full_key_name,
-                                 const TCHAR* value_name) {
-  DumpRegValueStrRet(dump_log, full_key_name, value_name, NULL);
-}
-
-void DataDumper::DumpRegValueStrRet(const DumpLog& dump_log,
-                                    const TCHAR* full_key_name,
-                                    const TCHAR* value_name,
-                                    CString* str) {
-  CString val;
-  CString key = full_key_name;
-  HRESULT hr = RegKey::GetValue(key, value_name, &val);
-
-  CString value_name_str = value_name ? value_name : _T("default");
-
-  if (SUCCEEDED(hr)) {
-    dump_log.WriteLine(_T("%s[%s] = %s"), key, value_name_str, val);
-  } else {
-    dump_log.WriteLine(_T("%s HAS NO VALUE"), key);
-  }
-
-  if (str) {
-    *str = val;
-  }
-}
-
-DumpHeader::DumpHeader(const DumpLog& dump_log, const TCHAR* header_name)
-    : dump_log_(dump_log) {
-  dump_log_.WriteLine(_T(""));
-  dump_log_.WriteLine(_T("--------------------------------------------------"));
-  dump_log_.WriteLine(header_name);
-  dump_log_.WriteLine(_T("--------------------------------------------------"));
-}
-
-DumpHeader::~DumpHeader() {
-  dump_log_.WriteLine(_T("--------------------------------------------------"));
-  dump_log_.WriteLine(_T(""));
-}
-
-void DataDumper::RecursiveDumpRegistryKey(const DumpLog& dump_log,
-                                          RegKey* key,
-                                          const int indent) {
-  ASSERT1(key);
-  CString indent_string;
-  for (int i = 0; i < indent; ++i) {
-    indent_string.Append(_T(" "));
-  }
-  uint32 value_count = key->GetValueCount();
-  for (uint32 idx = 0; idx < value_count; ++idx) {
-    CString value_name;
-    DWORD value_type = 0;
-    key->GetValueNameAt(idx, &value_name, &value_type);
-    CString value_name_disp =
-        value_name.IsEmpty() ? _T("[default]") : value_name;
-    switch (value_type) {
-      case REG_SZ: {
-        CString value;
-        key->GetValue(value_name, &value);
-        dump_log.WriteLine(_T("%s%s: (REG_SZ): %s"),
-                           indent_string,
-                           value_name_disp,
-                           value);
-        break;
-      }
-      case REG_DWORD: {
-        DWORD value = 0;
-        key->GetValue(value_name, &value);
-        dump_log.WriteLine(_T("%s%s: (REG_DWORD): %d (0x%x)"),
-                           indent_string,
-                           value_name_disp,
-                           value,
-                           value);
-        break;
-      }
-      case REG_BINARY:
-        dump_log.WriteLine(_T("%s%s: (REG_BINARY)"),
-                           indent_string,
-                           value_name_disp);
-        break;
-      case REG_MULTI_SZ:
-        dump_log.WriteLine(_T("%s%s: (REG_MULTI_SZ)"),
-                           indent_string,
-                           value_name_disp);
-        break;
-      default:
-        dump_log.WriteLine(_T("%s%s: (TYPE: %d)"),
-                           indent_string,
-                           value_name_disp,
-                           value_type);
-        break;
-    }
-  }
-
-  uint32 subkey_count = key->GetSubkeyCount();
-  for (uint32 idx = 0; idx < subkey_count; ++idx) {
-    CString subkey_name;
-    key->GetSubkeyNameAt(idx, &subkey_name);
-    RegKey subkey;
-    subkey.Open(key->Key(), subkey_name, KEY_READ);
-    dump_log.WriteLine(_T("%sSUBKEY: %s"), indent_string, subkey_name);
-    RecursiveDumpRegistryKey(dump_log, &subkey, indent+1);
-  }
-}
-
-void DataDumper::DumpRegistryKeyData(const DumpLog& dump_log,
-                                     const CString& key_name) {
-  RegKey key_root;
-  if (FAILED(key_root.Open(key_name, KEY_READ))) {
-    dump_log.WriteLine(_T("Key (%s) could not be opened"), key_name);
-    return;
-  }
-  dump_log.WriteLine(_T("ROOT KEY: %s"), key_name);
-  RecursiveDumpRegistryKey(dump_log, &key_root, 1);
-}
-
-}  // namespace omaha
-
diff --git a/tools/goopdump/data_dumper.h b/tools/goopdump/data_dumper.h
deleted file mode 100644
index 886ed93..0000000
--- a/tools/goopdump/data_dumper.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_TOOLS_SRC_GOOPDUMP_DATA_DUMPER_H__
-#define OMAHA_TOOLS_SRC_GOOPDUMP_DATA_DUMPER_H__
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-class RegKey;
-
-class DumpLog;
-struct GoopdumpCmdLineArgs;
-
-class DataDumper {
- public:
-  DataDumper();
-  virtual ~DataDumper();
-
-  virtual HRESULT Process(const DumpLog& dump_log,
-                          const GoopdumpCmdLineArgs& args) = 0;
-
- protected:
-  void DumpRegValueStr(const DumpLog& dump_log,
-                       const TCHAR* full_key_name,
-                       const TCHAR* value_name);
-
-  void DumpRegValueStrRet(const DumpLog& dump_log,
-                          const TCHAR* full_key_name,
-                          const TCHAR* value_name,
-                          CString* str);
-
-  void DumpRegistryKeyData(const DumpLog& dump_log,
-                           const CString& key_name);
-
- private:
-  void RecursiveDumpRegistryKey(const DumpLog& dump_log,
-                                RegKey* key,
-                                const int indent);
-
-  DISALLOW_EVIL_CONSTRUCTORS(DataDumper);
-};
-
-class DumpHeader {
- public:
-  DumpHeader(const DumpLog& dump_log, const TCHAR* header_name);
-  ~DumpHeader();
-
- private:
-  const DumpLog& dump_log_;
-  DISALLOW_EVIL_CONSTRUCTORS(DumpHeader);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_TOOLS_SRC_GOOPDUMP_DATA_DUMPER_H__
-
diff --git a/tools/goopdump/data_dumper_app_manager.cc b/tools/goopdump/data_dumper_app_manager.cc
deleted file mode 100644
index a07c818..0000000
--- a/tools/goopdump/data_dumper_app_manager.cc
+++ /dev/null
@@ -1,181 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/tools/goopdump/data_dumper_app_manager.h"
-
-#include <vector>
-
-#include "omaha/common/reg_key.h"
-#include "omaha/common/utils.h"
-#include "omaha/goopdate/config_manager.h"
-#include "omaha/worker/application_data.h"
-#include "omaha/worker/application_manager.h"
-#include "omaha/tools/goopdump/dump_log.h"
-#include "omaha/tools/goopdump/goopdump_cmd_line_parser.h"
-
-namespace omaha {
-
-namespace {
-
-CString ActiveStateToString(omaha::AppData::ActiveStates state) {
-  CString str = _T("UNDEFINED");
-  switch (state) {
-    case omaha::AppData::ACTIVE_NOTRUN:
-      str = _T("NOT RUN");
-      break;
-    case omaha::AppData::ACTIVE_RUN:
-      str = _T("RUN");
-      break;
-    case omaha::AppData::ACTIVE_UNKNOWN:
-      str = _T("UNKNOWN");
-      break;
-    default:
-      ASSERT1(false);
-      break;
-  }
-  return str;
-}
-
-CString BoolToString(bool val) {
-  return val ? _T("TRUE") : _T("FALSE");
-}
-
-// TODO(omaha): This should use display_name if available. Only Omaha needs to
-// be hard-coded. Maybe write its name during Setup instead.
-CString GuidToFriendlyAppName(const GUID& guid) {
-  struct MapGuidToName {
-    const TCHAR* guid;
-    const TCHAR* name;
-  };
-
-  // IMPORTANT: Only put released products in this list since this tool will go
-  // to customers.
-  MapGuidToName guid_to_name[] = {
-    {_T("{283EAF47-8817-4c2b-A801-AD1FADFB7BAA}"), _T("Gears")},
-    {_T("{430FD4D0-B729-4F61-AA34-91526481799D}"), _T("Google Update")},
-    {_T("{8A69D345-D564-463C-AFF1-A69D9E530F96}"), _T("Chrome")},
-  };
-
-  CString str = _T("unknown");
-
-  for (int i = 0; i < arraysize(guid_to_name); ++i) {
-    if (::IsEqualGUID(guid, StringToGuid(guid_to_name[i].guid))) {
-      str = guid_to_name[i].name;
-      break;
-    }
-  }
-
-  return str;
-}
-
-}  // namespace
-
-DataDumperAppManager::DataDumperAppManager() {
-}
-
-DataDumperAppManager::~DataDumperAppManager() {
-}
-
-HRESULT DataDumperAppManager::Process(const DumpLog& dump_log,
-                                      const GoopdumpCmdLineArgs& args) {
-  UNREFERENCED_PARAMETER(args);
-
-  DumpHeader header(dump_log, _T("AppManager Data"));
-
-  if (args.is_machine) {
-    dump_log.WriteLine(_T("--- MACHINE APPMANAGER DATA ---"));
-    AppManager app_manager(true);
-    DumpAppManagerData(dump_log, app_manager);
-    DumpRawRegistryData(dump_log, true);
-  }
-
-  if (args.is_user) {
-    dump_log.WriteLine(_T("--- USER APPMANAGER DATA ---"));
-    AppManager app_manager(false);
-    DumpAppManagerData(dump_log, app_manager);
-    DumpRawRegistryData(dump_log, false);
-  }
-
-  return S_OK;
-}
-
-void DataDumperAppManager::DumpAppManagerData(const DumpLog& dump_log,
-                                              const AppManager& app_manager) {
-  ProductDataVector products;
-  HRESULT hr = app_manager.GetRegisteredProducts(&products);
-  if (FAILED(hr)) {
-    dump_log.WriteLine(_T("Failed GetRegisteredProducts() hr=0x%x"), hr);
-    return;
-  }
-
-  for (size_t i = 0; i < products.size(); ++i) {
-    const ProductData& product_data = products[i];
-    const AppData& data = product_data.app_data();
-
-    dump_log.WriteLine(_T("---------- APP ----------"));
-    dump_log.WriteLine(_T("app name:\t%s"),
-                       GuidToFriendlyAppName(data.app_guid()));
-    dump_log.WriteLine(_T("guid:\t\t%s"), GuidToString(data.app_guid()));
-    // parent_app_guid is not displayed.
-    dump_log.WriteLine(_T("is_machine_app:\t%s"),
-                       BoolToString(data.is_machine_app()));
-    dump_log.WriteLine(_T("version:\t%s"), data.version());
-    dump_log.WriteLine(_T("prev_version:\t%s"), data.previous_version());
-    dump_log.WriteLine(_T("language:\t%s"), data.language());
-    dump_log.WriteLine(_T("ap:\t\t%s"), data.ap());
-    dump_log.WriteLine(_T("ttt:\t\t%s"), data.tt_token());
-    dump_log.WriteLine(_T("iid:\t\t%s"), GuidToString(data.iid()));
-    dump_log.WriteLine(_T("brand:\t\t%s"), data.brand_code());
-    dump_log.WriteLine(_T("client:\t\t%s"), data.client_id());
-    dump_log.WriteLine(_T("referral:\t\t%s"), data.referral_id());
-    dump_log.WriteLine(_T("install_time_diff_sec:\t%u"),
-                       data.install_time_diff_sec());
-    dump_log.WriteLine(_T("is_oem_install:\t%s"),
-                       BoolToString(data.is_oem_install()));
-    dump_log.WriteLine(_T("is_eula_accepted:\t%s"),
-                       BoolToString(data.is_eula_accepted()));
-    // TODO(omaha): Use display_name above and note its use on this line.
-    dump_log.WriteLine(_T("browser_type:\t\t%u"), data.browser_type());
-
-    // The following are not saved and thus should always have default values.
-    dump_log.WriteLine(_T("install_source:\t\t%s"), data.install_source());
-    dump_log.WriteLine(_T("encoded_installer_data:\t\t%s"),
-                       data.encoded_installer_data());
-    dump_log.WriteLine(_T("install_data_index:\t\t%s"),
-                       data.install_data_index());
-
-    dump_log.WriteLine(_T("usage_stats_enable:\t\t%u"),
-                       data.usage_stats_enable());
-    dump_log.WriteLine(_T("did_run:\t%s"),
-                       ActiveStateToString(data.did_run()));
-
-    // The following are not saved and thus should always have default values.
-    dump_log.WriteLine(_T("is_uninstalled:\t%s"),
-                       BoolToString(data.is_uninstalled()));
-    dump_log.WriteLine(_T("is_update_disabled:\t%s"),
-                       BoolToString(data.is_update_disabled()));
-    dump_log.WriteLine(_T(""));
-  }
-}
-
-void DataDumperAppManager::DumpRawRegistryData(const DumpLog& dump_log,
-                                               bool is_machine) {
-  dump_log.WriteLine(_T("--- RAW REGISTRY DATA ---"));
-  CString key_name = ConfigManager::Instance()->registry_clients(is_machine);
-  DumpRegistryKeyData(dump_log, key_name);
-}
-
-}  // namespace omaha
-
diff --git a/tools/goopdump/data_dumper_app_manager.h b/tools/goopdump/data_dumper_app_manager.h
deleted file mode 100644
index 1f7f842..0000000
--- a/tools/goopdump/data_dumper_app_manager.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_TOOLS_SRC_GOOPDUMP_DATA_DUMPER_APP_MANAGER_H__
-#define OMAHA_TOOLS_SRC_GOOPDUMP_DATA_DUMPER_APP_MANAGER_H__
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-
-#include "omaha/tools/goopdump/data_dumper.h"
-
-namespace omaha {
-
-class AppManager;
-
-class DataDumperAppManager : public DataDumper {
- public:
-  DataDumperAppManager();
-  virtual ~DataDumperAppManager();
-
-  virtual HRESULT Process(const DumpLog& dump_log,
-                          const GoopdumpCmdLineArgs& args);
-
- private:
-  void DumpAppManagerData(const DumpLog& dump_log,
-                          const AppManager& app_manager);
-  void DumpRawRegistryData(const DumpLog& dump_log, bool is_machine);
-
-  DISALLOW_EVIL_CONSTRUCTORS(DataDumperAppManager);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_TOOLS_SRC_GOOPDUMP_DATA_DUMPER_APP_MANAGER_H__
-
diff --git a/tools/goopdump/data_dumper_goopdate.cc b/tools/goopdump/data_dumper_goopdate.cc
deleted file mode 100644
index 30fde1c..0000000
--- a/tools/goopdump/data_dumper_goopdate.cc
+++ /dev/null
@@ -1,607 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/tools/goopdump/data_dumper_goopdate.h"
-
-#include <atltime.h>
-#include <mstask.h>
-#include <psapi.h>
-#include <regstr.h>
-#include <tlhelp32.h>
-
-#include <list>
-
-#include "omaha/common/constants.h"
-#include "omaha/common/error.h"
-#include "omaha/common/file.h"
-#include "omaha/common/file_reader.h"
-#include "omaha/common/reg_key.h"
-#include "omaha/common/scoped_ptr_cotask.h"
-#include "omaha/common/service_utils.h"
-#include "omaha/common/time.h"
-#include "omaha/goopdate/config_manager.h"
-#include "omaha/goopdate/const_goopdate.h"
-#include "omaha/goopdate/event_logger.h"
-#include "omaha/goopdate/goopdate_utils.h"
-#include "omaha/tools/goopdump/dump_log.h"
-#include "omaha/tools/goopdump/goopdump_cmd_line_parser.h"
-#include "omaha/tools/goopdump/process_commandline.h"
-
-namespace {
-
-CString FormatRunTimeString(SYSTEMTIME* system_time) {
-  SYSTEMTIME local_time = {0};
-  ::SystemTimeToTzSpecificLocalTime(NULL, system_time, &local_time);
-  CString str;
-  str.Format(_T("%02d/%02d/%04d %02d:%02d:%02d"),
-             local_time.wMonth,
-             local_time.wDay,
-             local_time.wYear,
-             local_time.wHour,
-             local_time.wMinute,
-             local_time.wSecond);
-  return str;
-}
-
-}  // namespace
-
-namespace omaha {
-
-DataDumperGoopdate::DataDumperGoopdate() {
-}
-
-DataDumperGoopdate::~DataDumperGoopdate() {
-}
-
-HRESULT DataDumperGoopdate::Process(const DumpLog& dump_log,
-                                    const GoopdumpCmdLineArgs& args) {
-  UNREFERENCED_PARAMETER(args);
-
-  DumpHeader header(dump_log, _T("Goopdate Data"));
-
-  dump_log.WriteLine(_T(""));
-  dump_log.WriteLine(_T("-- GENERAL / GLOBAL DATA --"));
-  DumpHostsFile(dump_log);
-  DumpGoogleUpdateIniFile(dump_log);
-  DumpUpdateDevKeys(dump_log);
-  DumpLogFile(dump_log);
-  DumpEventLog(dump_log);
-  DumpGoogleUpdateProcessInfo(dump_log);
-
-  if (args.is_machine) {
-    dump_log.WriteLine(_T(""));
-    dump_log.WriteLine(_T("-- PER-MACHINE DATA --"));
-    DumpDirContents(dump_log, true);
-    DumpServiceInfo(dump_log);
-  }
-
-  if (args.is_user) {
-    dump_log.WriteLine(_T(""));
-    dump_log.WriteLine(_T("-- PER-USER DATA --"));
-    DumpDirContents(dump_log, false);
-    DumpRunKeys(dump_log);
-  }
-
-  DumpScheduledTaskInfo(dump_log, args.is_machine);
-
-  return S_OK;
-}
-
-void DataDumperGoopdate::DumpDirContents(const DumpLog& dump_log,
-                                         bool is_machine) {
-  DumpHeader header(dump_log, _T("Directory Contents"));
-
-  CString registered_version;
-  if (FAILED(GetRegisteredVersion(is_machine, &registered_version))) {
-    dump_log.WriteLine(_T("Failed to get registered version."));
-    return;
-  }
-
-  CString dll_dir;
-  if (FAILED(GetDllDir(is_machine, &dll_dir))) {
-    dump_log.WriteLine(_T("Failed to get dlldir."));
-    return;
-  }
-
-  dump_log.WriteLine(_T("Version:\t%s"), registered_version);
-  dump_log.WriteLine(_T("Dll Dir:\t%s"), dll_dir);
-
-  // Enumerate all files in the DllPath and log them.
-  std::vector<CString> matching_paths;
-  HRESULT hr = File::GetWildcards(dll_dir, _T("*.*"), &matching_paths);
-  if (SUCCEEDED(hr)) {
-    dump_log.WriteLine(_T(""));
-    dump_log.WriteLine(_T("Files in DllDir:"));
-    for (size_t i = 0; i < matching_paths.size(); ++i) {
-      dump_log.WriteLine(matching_paths[i]);
-    }
-    dump_log.WriteLine(_T(""));
-  } else {
-    dump_log.WriteLine(_T("Failure getting files in DllDir (0x%x)."), hr);
-  }
-}
-
-HRESULT DataDumperGoopdate::GetRegisteredVersion(bool is_machine,
-                                                 CString* version) {
-  HKEY key = NULL;
-  LONG res = ::RegOpenKeyEx(is_machine ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,
-                            GOOPDATE_REG_RELATIVE_CLIENTS GOOPDATE_APP_ID,
-                            0,
-                            KEY_READ,
-                            &key);
-  if (ERROR_SUCCESS != res) {
-    return HRESULT_FROM_WIN32(res);
-  }
-
-  DWORD type = 0;
-  DWORD version_length = 50;
-  res = ::SHQueryValueEx(key,
-                         omaha::kRegValueProductVersion,
-                         NULL,
-                         &type,
-                         CStrBuf(*version, version_length),
-                         &version_length);
-  if (ERROR_SUCCESS != res) {
-    return HRESULT_FROM_WIN32(res);
-  }
-
-  if (REG_SZ != type) {
-    return E_UNEXPECTED;
-  }
-
-  return S_OK;
-}
-
-HRESULT DataDumperGoopdate::GetDllDir(bool is_machine, CString* dll_path) {
-  TCHAR path[MAX_PATH] = {0};
-
-  CString base_path = goopdate_utils::BuildGoogleUpdateExeDir(is_machine);
-
-  // Try the side-by-side DLL first.
-  _tcscpy_s(path, arraysize(path), base_path);
-  if (!::PathAppend(path, omaha::kGoopdateDllName)) {
-    return HRESULTFromLastError();
-  }
-  if (File::Exists(path)) {
-    *dll_path = base_path;
-    return S_OK;
-  }
-
-  // Try the version subdirectory.
-  _tcscpy_s(path, arraysize(path), base_path);
-  CString version;
-  HRESULT hr = GetRegisteredVersion(is_machine, &version);
-  if (FAILED(hr)) {
-    return hr;
-  }
-  if (!::PathAppend(path, version)) {
-    return HRESULTFromLastError();
-  }
-  base_path = path;
-  if (!::PathAppend(path, omaha::kGoopdateDllName)) {
-    return HRESULTFromLastError();
-  }
-  if (!File::Exists(path)) {
-    return GOOGLEUPDATE_E_DLL_NOT_FOUND;
-  }
-
-  *dll_path = base_path;
-  return S_OK;
-}
-
-void DataDumperGoopdate::DumpGoogleUpdateIniFile(const DumpLog& dump_log) {
-  DumpHeader header(dump_log, _T("GoogleUpdate.ini File Contents"));
-  DumpFileContents(dump_log, _T("c:\\googleupdate.ini"), 0);
-}
-
-void DataDumperGoopdate::DumpHostsFile(const DumpLog& dump_log) {
-  DumpHeader header(dump_log, _T("Hosts File Contents"));
-  TCHAR system_path[MAX_PATH] = {0};
-  HRESULT hr = ::SHGetFolderPath(NULL,
-                                 CSIDL_SYSTEM,
-                                 NULL,
-                                 SHGFP_TYPE_CURRENT,
-                                 system_path);
-  if (FAILED(hr)) {
-    dump_log.WriteLine(_T("Can't get System folder: 0x%x"), hr);
-    return;
-  }
-
-  CPath full_path = system_path;
-  full_path.Append(_T("drivers\\etc\\hosts"));
-  DumpFileContents(dump_log, full_path, 0);
-}
-
-void DataDumperGoopdate::DumpUpdateDevKeys(const DumpLog& dump_log) {
-  DumpHeader header(dump_log, _T("UpdateDev Keys"));
-
-  DumpRegistryKeyData(dump_log, _T("HKLM\\Software\\Google\\UpdateDev"));
-}
-
-void DataDumperGoopdate::DumpLogFile(const DumpLog& dump_log) {
-  DumpHeader header(dump_log, _T("Debug Log File Contents"));
-
-  Logging logger;
-  CString log_file_path(logger.GetLogFilePath());
-  DumpFileContents(dump_log, log_file_path, 500);
-}
-
-CString EventLogTypeToString(WORD event_log_type) {
-  CString str = _T("Unknown");
-  switch (event_log_type) {
-    case EVENTLOG_ERROR_TYPE:
-      str = _T("ERROR");
-      break;
-    case EVENTLOG_WARNING_TYPE:
-      str = _T("WARNING");
-      break;
-    case EVENTLOG_INFORMATION_TYPE:
-      str = _T("INFORMATION");
-      break;
-    case EVENTLOG_AUDIT_SUCCESS:
-      str = _T("AUDIT_SUCCESS");
-      break;
-    case EVENTLOG_AUDIT_FAILURE:
-      str = _T("AUDIT_FAILURE");
-      break;
-    default:
-      str = _T("Unknown");
-      break;
-  }
-
-  return str;
-}
-
-void DataDumperGoopdate::DumpEventLog(const DumpLog& dump_log) {
-  DumpHeader header(dump_log, _T("Google Update Event Log Entries"));
-
-  HANDLE handle_event_log = ::OpenEventLog(NULL, _T("Application"));
-  if (handle_event_log == NULL) {
-    return;
-  }
-
-  const int kInitialBufferSize = 8192;
-  int buffer_size = kInitialBufferSize;
-  scoped_array<TCHAR> buffer(new TCHAR[buffer_size]);
-
-  while (1) {
-    EVENTLOGRECORD* record = reinterpret_cast<EVENTLOGRECORD*>(buffer.get());
-    DWORD num_bytes_read = 0;
-    DWORD bytes_needed = 0;
-    if (!::ReadEventLog(handle_event_log,
-                        EVENTLOG_FORWARDS_READ | EVENTLOG_SEQUENTIAL_READ,
-                        0,
-                        record,
-                        buffer_size,
-                        &num_bytes_read,
-                        &bytes_needed)) {
-      const int err = ::GetLastError();
-      if (ERROR_INSUFFICIENT_BUFFER == err) {
-        buffer_size = bytes_needed;
-        buffer.reset(new TCHAR[buffer_size]);
-        continue;
-      } else {
-        if (ERROR_HANDLE_EOF != err) {
-          dump_log.WriteLine(_T("ReadEventLog failed: %d"), err);
-        }
-        break;
-      }
-    }
-
-    while (num_bytes_read > 0) {
-      const TCHAR* source_name = reinterpret_cast<const TCHAR*>(
-          reinterpret_cast<BYTE*>(record) + sizeof(*record));
-
-      if (_tcscmp(source_name, EventLogger::kSourceName) == 0) {
-        CString event_log_type = EventLogTypeToString(record->EventType);
-
-        const TCHAR* message_data_buffer = reinterpret_cast<const TCHAR*>(
-            reinterpret_cast<BYTE*>(record) + record->StringOffset);
-
-        CString message_data(message_data_buffer);
-
-        FILETIME filetime = {0};
-        TimeTToFileTime(record->TimeWritten, &filetime);
-        SYSTEMTIME systemtime = {0};
-        ::FileTimeToSystemTime(&filetime, &systemtime);
-
-        CString message_line;
-        message_line.Format(_T("[%s] (%d)|(%s) %s"),
-                            FormatRunTimeString(&systemtime),
-                            record->EventID,
-                            event_log_type,
-                            message_data);
-        dump_log.WriteLine(message_line);
-      }
-
-      num_bytes_read -= record->Length;
-      record = reinterpret_cast<EVENTLOGRECORD*>(
-          reinterpret_cast<BYTE*>(record) + record->Length);
-    }
-
-    record = reinterpret_cast<EVENTLOGRECORD*>(&buffer);
-  }
-
-  ::CloseEventLog(handle_event_log);
-}
-
-void DataDumperGoopdate::DumpGoogleUpdateProcessInfo(const DumpLog& dump_log) {
-  DumpHeader header(dump_log, _T("GoogleUpdate.exe Process Info"));
-
-  EnableDebugPrivilege();
-
-  scoped_handle handle_snap;
-  reset(handle_snap,
-        ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD, 0));
-  if (!valid(handle_snap)) {
-    return;
-  }
-
-  PROCESSENTRY32 process_entry32 = {0};
-  process_entry32.dwSize = sizeof(PROCESSENTRY32);
-
-  if (!::Process32First(get(handle_snap), &process_entry32)) {
-    return;
-  }
-
-  bool first = true;
-
-  do {
-    CString exe_file_name = process_entry32.szExeFile;
-    exe_file_name.MakeLower();
-
-    if (exe_file_name.Find(_T("googleupdate.exe")) >= 0) {
-      if (first) {
-        first = false;
-      } else {
-        dump_log.WriteLine(_T("-------------------"));
-      }
-      dump_log.WriteLine(_T("Process ID: %d"), process_entry32.th32ProcessID);
-      scoped_handle process_handle;
-      reset(process_handle, ::OpenProcess(PROCESS_ALL_ACCESS,
-                                          FALSE,
-                                          process_entry32.th32ProcessID));
-      if (get(process_handle)) {
-        CString command_line;
-        if (SUCCEEDED(GetProcessCommandLine(process_entry32.th32ProcessID,
-                                            &command_line))) {
-          dump_log.WriteLine(_T("Command Line: %s"), command_line);
-        } else {
-          dump_log.WriteLine(_T("Command Line: Failed to retrieve"));
-        }
-
-        PROCESS_MEMORY_COUNTERS memory_counters = {0};
-        memory_counters.cb = sizeof(memory_counters);
-        if (GetProcessMemoryInfo(get(process_handle),
-                                 &memory_counters,
-                                 sizeof(memory_counters))) {
-          dump_log.WriteLine(_T("Page Fault Count:      %d"),
-                             memory_counters.PageFaultCount);
-          dump_log.WriteLine(_T("Peak Working Set Size: %d"),
-                             memory_counters.PeakWorkingSetSize);
-          dump_log.WriteLine(_T("Working Set Size:      %d"),
-                             memory_counters.WorkingSetSize);
-          dump_log.WriteLine(_T("Page File Usage:       %d"),
-                             memory_counters.PagefileUsage);
-          dump_log.WriteLine(_T("Peak Page File Usage:  %d"),
-                             memory_counters.PeakPagefileUsage);
-        } else {
-          dump_log.WriteLine(_T("Unable to get process memory info"));
-        }
-
-        THREADENTRY32 thread_entry = {0};
-        thread_entry.dwSize = sizeof(thread_entry);
-        int thread_count = 0;
-        if (Thread32First(get(handle_snap), &thread_entry)) {
-          do {
-            if (thread_entry.th32OwnerProcessID ==
-                process_entry32.th32ProcessID) {
-              ++thread_count;
-            }
-          } while (::Thread32Next(get(handle_snap), &thread_entry));
-        }
-
-        dump_log.WriteLine(_T("Thread Count:          %d"), thread_count);
-
-        FILETIME creation_time = {0};
-        FILETIME exit_time = {0};
-        FILETIME kernel_time = {0};
-        FILETIME user_time = {0};
-        if (::GetProcessTimes(get(process_handle),
-                              &creation_time,
-                              &exit_time,
-                              &kernel_time,
-                              &user_time)) {
-          SYSTEMTIME creation_system_time = {0};
-          FileTimeToSystemTime(&creation_time, &creation_system_time);
-          CString creation_str = FormatRunTimeString(&creation_system_time);
-          dump_log.WriteLine(_T("Process Start Time:    %s"), creation_str);
-
-          CTime time_creation(creation_time);
-          CTime time_now = CTime::GetCurrentTime();
-          CTimeSpan time_span = time_now - time_creation;
-          CString time_span_format =
-              time_span.Format(_T("%D days, %H hours, %M minutes, %S seconds"));
-          dump_log.WriteLine(_T("Process Uptime:        %s"), time_span_format);
-        } else {
-          dump_log.WriteLine(_T("Unable to get Process Times"));
-        }
-      }
-    }
-  } while (::Process32Next(get(handle_snap), &process_entry32));
-}
-
-void DataDumperGoopdate::DumpServiceInfo(const DumpLog& dump_log) {
-  DumpHeader header(dump_log, _T("Google Update Service Info"));
-
-  CString current_service_name = ConfigManager::GetCurrentServiceName();
-  bool is_service_installed =
-      ServiceInstall::IsServiceInstalled(current_service_name);
-
-  dump_log.WriteLine(_T("Service Name: %s"), current_service_name);
-  dump_log.WriteLine(_T("Is Installed: %s"),
-                     is_service_installed ? _T("YES") : _T("NO"));
-}
-
-void DataDumperGoopdate::DumpScheduledTaskInfo(const DumpLog& dump_log,
-                                               bool is_machine) {
-  DumpHeader header(dump_log, _T("Scheduled Task Info"));
-
-  CComPtr<ITaskScheduler> scheduler;
-  HRESULT hr = scheduler.CoCreateInstance(CLSID_CTaskScheduler,
-                                          NULL,
-                                          CLSCTX_INPROC_SERVER);
-  if (FAILED(hr)) {
-    dump_log.WriteLine(_T("ITaskScheduler.CoCreateInstance failed: 0x%x"),
-                       hr);
-    return;
-  }
-
-  CComPtr<ITask> task;
-  hr = scheduler->Activate(ConfigManager::GetCurrentTaskNameCore(is_machine),
-                           __uuidof(ITask),
-                           reinterpret_cast<IUnknown**>(&task));
-
-  if (FAILED(hr)) {
-    dump_log.WriteLine(_T("ITaskScheduler.Activate failed: 0x%x"), hr);
-    return;
-  }
-
-  scoped_ptr_cotask<TCHAR> app_name;
-  hr = task->GetApplicationName(address(app_name));
-  dump_log.WriteLine(_T("ApplicationName: %s"),
-                     SUCCEEDED(hr) ? app_name.get() : _T("Not Found"));
-
-  scoped_ptr_cotask<TCHAR> creator;
-  hr = task->GetCreator(address(creator));
-  dump_log.WriteLine(_T("Creator: %s"),
-                     SUCCEEDED(hr) ? creator.get() : _T("Not Found"));
-
-  scoped_ptr_cotask<TCHAR> parameters;
-  hr = task->GetParameters(address(parameters));
-  dump_log.WriteLine(_T("Parameters: %s"),
-                     SUCCEEDED(hr) ? parameters.get() : _T("Not Found"));
-
-  scoped_ptr_cotask<TCHAR> comment;
-  hr = task->GetComment(address(comment));
-  dump_log.WriteLine(_T("Comment: %s"),
-                     SUCCEEDED(hr) ? comment.get() : _T("Not Found"));
-
-  scoped_ptr_cotask<TCHAR> working_dir;
-  hr = task->GetWorkingDirectory(address(working_dir));
-  dump_log.WriteLine(_T("Working Directory: %s"),
-                     SUCCEEDED(hr) ? working_dir.get() : _T("Not Found"));
-
-  scoped_ptr_cotask<TCHAR> account_info;
-  hr = task->GetAccountInformation(address(account_info));
-  dump_log.WriteLine(_T("Account Info: %s"),
-                     SUCCEEDED(hr) ? account_info.get() : _T("Not Found"));
-
-  dump_log.WriteLine(_T("Triggers:"));
-  WORD trigger_count = 0;
-  hr = task->GetTriggerCount(&trigger_count);
-  if (SUCCEEDED(hr)) {
-    for (WORD i = 0; i < trigger_count; ++i) {
-      CComPtr<ITaskTrigger> trigger;
-      if (SUCCEEDED(task->GetTrigger(i, &trigger))) {
-        scoped_ptr_cotask<TCHAR> trigger_string;
-        if (SUCCEEDED(trigger->GetTriggerString(address(trigger_string)))) {
-          dump_log.WriteLine(_T("   %s"), trigger_string.get());
-        }
-      }
-    }
-  }
-
-  SYSTEMTIME next_run_time = {0};
-  hr = task->GetNextRunTime(&next_run_time);
-  if (SUCCEEDED(hr)) {
-    dump_log.WriteLine(_T("Next Run Time: %s"),
-                       FormatRunTimeString(&next_run_time));
-  } else {
-    dump_log.WriteLine(_T("Next Run Time: Not Found"));
-  }
-
-  SYSTEMTIME recent_run_time = {0};
-  hr = task->GetMostRecentRunTime(&recent_run_time);
-  if (SUCCEEDED(hr)) {
-    dump_log.WriteLine(_T("Most Recent Run Time: %s"),
-                       FormatRunTimeString(&recent_run_time));
-  } else {
-    dump_log.WriteLine(_T("Most Recent Run Time: Not Found"));
-  }
-
-  DWORD max_run_time = 0;
-  hr = task->GetMaxRunTime(&max_run_time);
-  if (SUCCEEDED(hr)) {
-    dump_log.WriteLine(_T("Max Run Time: %d ms"), max_run_time);
-  } else {
-    dump_log.WriteLine(_T("Max Run Time: [Not Available]"));
-  }
-}
-
-void DataDumperGoopdate::DumpRunKeys(const DumpLog& dump_log) {
-  DumpHeader header(dump_log, _T("Google Update Run Keys"));
-
-  CString key_path = AppendRegKeyPath(USER_KEY_NAME, REGSTR_PATH_RUN);
-  DumpRegValueStr(dump_log, key_path, kRunValueName);
-}
-
-void DataDumperGoopdate::DumpFileContents(const DumpLog& dump_log,
-                                          const CString& file_path,
-                                          int num_tail_lines) {
-  if (num_tail_lines > 0) {
-    dump_log.WriteLine(_T("Tailing last %d lines of file"), num_tail_lines);
-  }
-  dump_log.WriteLine(_T("-------------------------------------"));
-  if (File::Exists(file_path)) {
-    FileReader reader;
-    HRESULT hr = reader.Init(file_path, 2048);
-    if (FAILED(hr)) {
-      dump_log.WriteLine(_T("Unable to open %s: 0x%x."), file_path, hr);
-      return;
-    }
-
-    CString current_line;
-    std::list<CString> tail_lines;
-
-    while (SUCCEEDED(reader.ReadLineString(&current_line))) {
-      if (num_tail_lines == 0) {
-        // We're not doing a tail, so just print the entire file.
-        dump_log.WriteLine(current_line);
-      } else {
-        // Collect the lines in a queue until we're done.
-        tail_lines.push_back(current_line);
-        if (tail_lines.size() > static_cast<size_t>(num_tail_lines)) {
-          tail_lines.pop_front();
-        }
-      }
-    }
-
-    // Print out the tail lines collected from the file, if they exist.
-    if (num_tail_lines > 0) {
-      for (std::list<CString>::const_iterator it = tail_lines.begin();
-           it != tail_lines.end();
-           ++it) {
-        dump_log.WriteLine(*it);
-      }
-    }
-  } else {
-    dump_log.WriteLine(_T("File does not exist."));
-  }
-}
-
-}  // namespace omaha
-
diff --git a/tools/goopdump/data_dumper_goopdate.h b/tools/goopdump/data_dumper_goopdate.h
deleted file mode 100644
index 55f5ad5..0000000
--- a/tools/goopdump/data_dumper_goopdate.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_TOOLS_SRC_GOOPDUMP_DATA_DUMPER_GOOPDATE_H_
-#define OMAHA_TOOLS_SRC_GOOPDUMP_DATA_DUMPER_GOOPDATE_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-
-#include "omaha/tools/goopdump/data_dumper.h"
-
-namespace omaha {
-
-class DataDumperGoopdate : public DataDumper {
- public:
-  DataDumperGoopdate();
-  virtual ~DataDumperGoopdate();
-
-  virtual HRESULT Process(const DumpLog& dump_log,
-                          const GoopdumpCmdLineArgs& args);
-
- private:
-  void DumpGoogleUpdateIniFile(const DumpLog& dump_log);
-  void DumpHostsFile(const DumpLog& dump_log);
-  void DumpUpdateDevKeys(const DumpLog& dump_log);
-  void DumpLogFile(const DumpLog& dump_log);
-  void DumpEventLog(const DumpLog& dump_log);
-  void DumpGoogleUpdateProcessInfo(const DumpLog& dump_log);
-  void DumpDirContents(const DumpLog& dump_log, bool is_machine);
-  void DumpServiceInfo(const DumpLog& dump_log);
-  void DumpRunKeys(const DumpLog& dump_log);
-  void DumpScheduledTaskInfo(const DumpLog& dump_log, bool is_machine);
-
-  HRESULT GetRegisteredVersion(bool is_machine, CString* version);
-  HRESULT GetDllDir(bool is_machine, CString* dll_path);
-
-  void DumpFileContents(const DumpLog& dump_log,
-                        const CString& file_path,
-                        int num_tail_lines);
-
-
-  DISALLOW_EVIL_CONSTRUCTORS(DataDumperGoopdate);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_TOOLS_SRC_GOOPDUMP_DATA_DUMPER_GOOPDATE_H_
-
diff --git a/tools/goopdump/data_dumper_network.cc b/tools/goopdump/data_dumper_network.cc
deleted file mode 100644
index 6b342ad..0000000
--- a/tools/goopdump/data_dumper_network.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/tools/goopdump/data_dumper_network.h"
-#include "omaha/common/vistautil.h"
-#include "omaha/goopdate/goopdate_utils.h"
-#include "omaha/net/network_config.h"
-#include "omaha/tools/goopdump/data_dumper.h"
-#include "omaha/tools/goopdump/dump_log.h"
-#include "omaha/tools/goopdump/goopdump_cmd_line_parser.h"
-
-namespace omaha {
-
-DataDumperNetwork::DataDumperNetwork() {
-}
-
-DataDumperNetwork::~DataDumperNetwork() {
-}
-
-void DataDumperNetwork::DumpNetworkConfig(const DumpLog& dump_log) {
-  NetworkConfig& network_config(NetworkConfig::Instance());
-  HRESULT hr = network_config.Detect();
-  if (FAILED(hr)) {
-    dump_log.WriteLine(_T("Can't detect the network configuration."));
-  }
-  std::vector<Config> configs(network_config.GetConfigurations());
-  dump_log.WriteLine(_T("Detected configurations:\r\n"));
-  dump_log.WriteLine(NetworkConfig::ToString(configs));
-}
-
-HRESULT DataDumperNetwork::Process(const DumpLog& dump_log,
-                                   const GoopdumpCmdLineArgs& args) {
-  UNREFERENCED_PARAMETER(args);
-  DumpHeader header(dump_log, _T("Network"));
-
-  const bool is_machine = vista_util::IsUserAdmin();
-  HRESULT hr = omaha::goopdate_utils::ConfigureNetwork(is_machine, false);
-  if (FAILED(hr)) {
-    dump_log.WriteLine(_T("Can't configure the network."));
-  }
-
-  DumpNetworkConfig(dump_log);
-  return S_OK;
-}
-
-}  // namespace omaha
-
-// Register the WinHttp client with the class factory for http clients.
-#pragma comment(linker, "/INCLUDE:_kRegisterWinHttp")
-
diff --git a/tools/goopdump/data_dumper_network.h b/tools/goopdump/data_dumper_network.h
deleted file mode 100644
index 8477598..0000000
--- a/tools/goopdump/data_dumper_network.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_TOOLS_SRC_GOOPDUMP_DATA_DUMPER_NETWORK_H__
-#define OMAHA_TOOLS_SRC_GOOPDUMP_DATA_DUMPER_NETWORK_H__
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-
-#include "omaha/tools/goopdump/data_dumper.h"
-
-namespace omaha {
-
-class DataDumperNetwork : public DataDumper {
- public:
-  DataDumperNetwork();
-  virtual ~DataDumperNetwork();
-
-  virtual HRESULT Process(const DumpLog& dump_log,
-                          const GoopdumpCmdLineArgs& args);
-
- private:
-  void DumpNetworkConfig(const DumpLog& dump_log);
-
-  DISALLOW_EVIL_CONSTRUCTORS(DataDumperNetwork);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_TOOLS_SRC_GOOPDUMP_DATA_DUMPER_NETWORK_H__
-
diff --git a/tools/goopdump/data_dumper_oneclick.cc b/tools/goopdump/data_dumper_oneclick.cc
deleted file mode 100644
index 0af6a5c..0000000
--- a/tools/goopdump/data_dumper_oneclick.cc
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/tools/goopdump/data_dumper_oneclick.h"
-
-#include "omaha/common/reg_key.h"
-#include "omaha/tools/goopdump/dump_log.h"
-#include "omaha/tools/goopdump/goopdump_cmd_line_parser.h"
-
-namespace omaha {
-
-DataDumperOneClick::DataDumperOneClick() {
-}
-
-DataDumperOneClick::~DataDumperOneClick() {
-}
-
-void DataDumperOneClick::DumpOneClickDataForVersion(const DumpLog& dump_log,
-                                                    int plugin_version) {
-
-  dump_log.WriteLine(_T("Trying Plugin Version: %d"), plugin_version);
-
-  CString oneclick_name;
-  oneclick_name.Format(_T("Google.OneClickCtrl.%d"), plugin_version);
-
-  CString reg_str;
-  reg_str.Format(_T("HKCR\\%s"), oneclick_name);
-  DumpRegValueStr(dump_log, reg_str, NULL);
-
-  CString clsid;
-  reg_str.Append(_T("\\CLSID"));
-  DumpRegValueStrRet(dump_log, reg_str, NULL, &clsid);
-
-  reg_str.Format(_T("HKCR\\MIME\\DataBase\\Content Type\\application/%s"),
-                 oneclick_name);
-  DumpRegValueStr(dump_log, reg_str, _T("CLSID"));
-
-  CString key;
-  key.Format(_T("HKCR\\CLSID\\%s"), clsid);
-
-  if (!clsid.IsEmpty()) {
-    DumpRegistryKeyData(dump_log, key);
-  }
-
-  CString typelib;
-  CString key2 = key;
-  key2.Append(_T("\\TypeLib"));
-  if (SUCCEEDED(RegKey::GetValue(key2, NULL, &typelib))) {
-    if (!typelib.IsEmpty()) {
-      key.Format(_T("HKCR\\Typelib\\%s\\1.0\\0\\win32"), typelib);
-      DumpRegistryKeyData(dump_log, key);
-    }
-  }
-
-  dump_log.WriteLine(_T(""));
-}
-
-HRESULT DataDumperOneClick::Process(const DumpLog& dump_log,
-                                    const GoopdumpCmdLineArgs& args) {
-  UNREFERENCED_PARAMETER(args);
-
-  DumpHeader header(dump_log, _T("OneClick Data"));
-
-  CString activex_version_str(ACTIVEX_VERSION_ANSI);
-  int activex_version = _ttoi(activex_version_str);
-
-  for (int i = 1; i <= activex_version; ++i) {
-    DumpOneClickDataForVersion(dump_log, i);
-  }
-
-  return S_OK;
-}
-
-}  // namespace omaha
-
diff --git a/tools/goopdump/data_dumper_oneclick.h b/tools/goopdump/data_dumper_oneclick.h
deleted file mode 100644
index 66aceb0..0000000
--- a/tools/goopdump/data_dumper_oneclick.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#ifndef OMAHA_TOOLS_SRC_GOOPDUMP_DATA_DUMPER_ONECLICK_H__
-#define OMAHA_TOOLS_SRC_GOOPDUMP_DATA_DUMPER_ONECLICK_H__
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-
-#include "omaha/tools/goopdump/data_dumper.h"
-
-namespace omaha {
-
-class DataDumperOneClick : public DataDumper {
- public:
-  DataDumperOneClick();
-  virtual ~DataDumperOneClick();
-
-  virtual HRESULT Process(const DumpLog& dump_log,
-                          const GoopdumpCmdLineArgs& args);
-
- private:
-  void DumpOneClickDataForVersion(const DumpLog& dump_log, int plugin_version);
-
-  DISALLOW_EVIL_CONSTRUCTORS(DataDumperOneClick);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_TOOLS_SRC_GOOPDUMP_DATA_DUMPER_ONECLICK_H__
-
diff --git a/tools/goopdump/data_dumper_osdata.cc b/tools/goopdump/data_dumper_osdata.cc
deleted file mode 100644
index 029ced4..0000000
--- a/tools/goopdump/data_dumper_osdata.cc
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/tools/goopdump/data_dumper_osdata.h"
-
-#include <atltime.h>
-#include <pdh.h>
-#include <psapi.h>
-#include <security.h>
-#include "omaha/common/reg_key.h"
-#include "omaha/common/scope_guard.h"
-#include "omaha/common/time.h"
-#include "omaha/goopdate/goopdate_utils.h"
-#include "omaha/tools/goopdump/dump_log.h"
-#include "omaha/tools/goopdump/goopdump_cmd_line_parser.h"
-
-namespace omaha {
-
-DataDumperOSData::DataDumperOSData() {
-}
-
-DataDumperOSData::~DataDumperOSData() {
-}
-
-HRESULT DataDumperOSData::Process(const DumpLog& dump_log,
-                                    const GoopdumpCmdLineArgs& args) {
-  UNREFERENCED_PARAMETER(args);
-
-  DumpHeader header(dump_log, _T("Operating System Data"));
-
-  CString os_version;
-  CString service_pack;
-  goopdate_utils::GetOSInfo(&os_version, &service_pack);
-  dump_log.WriteLine(_T("OS Version:\t%s"), os_version);
-  dump_log.WriteLine(_T("Service Pack:\t%s"), service_pack);
-
-  TCHAR computer_name[MAX_PATH] = {0};
-  ULONG computer_name_size = arraysize(computer_name);
-  ::GetComputerNameEx(ComputerNameDnsFullyQualified,
-                      computer_name,
-                      &computer_name_size);
-  dump_log.WriteLine(_T("Computer Name:\t%s"), computer_name);
-
-  TCHAR user_name[MAX_PATH] = {0};
-  ULONG user_name_size = arraysize(user_name);
-  ::GetUserNameEx(NameSamCompatible, user_name, &user_name_size);
-  dump_log.WriteLine(_T("User Name:\t%s"), user_name);
-
-  TCHAR user_friendly_name[MAX_PATH] = {0};
-  ULONG user_friendly_name_size = arraysize(user_friendly_name);
-  ::GetUserNameEx(NameDisplay, user_friendly_name, &user_friendly_name_size);
-  dump_log.WriteLine(_T("Friendly Name:\t%s"), user_friendly_name);
-
-  CString system_uptime;
-  if (SUCCEEDED(GetSystemUptime(&system_uptime))) {
-    dump_log.WriteLine(_T("System Uptime:\t%s"), system_uptime);
-  } else {
-    dump_log.WriteLine(_T("System Uptime:\tNot Available"));
-  }
-
-  PERFORMANCE_INFORMATION perf_info = {0};
-  perf_info.cb = sizeof(perf_info);
-  if (::GetPerformanceInfo(&perf_info, sizeof(perf_info))) {
-    dump_log.WriteLine(_T("Process Count: %d"), perf_info.ProcessCount);
-    dump_log.WriteLine(_T("Handle Count:  %d"), perf_info.HandleCount);
-    dump_log.WriteLine(_T("Thread Count:  %d"), perf_info.ThreadCount);
-
-    size_t page_size = perf_info.PageSize;
-    size_t mb = 1024 * 1024;
-
-    dump_log.WriteLine(_T("Commit Total(MB):     %ld"),
-                       perf_info.CommitTotal * page_size / mb);
-    dump_log.WriteLine(_T("Commit Limit(MB):     %ld"),
-                       perf_info.CommitLimit * page_size / mb);
-    dump_log.WriteLine(_T("Commit Peak(MB):      %ld"),
-                       perf_info.CommitPeak * page_size / mb);
-    dump_log.WriteLine(_T("Kernel Total(MB):     %ld"),
-                       perf_info.KernelTotal * page_size / mb);
-    dump_log.WriteLine(_T("Kernel Paged(MB):     %ld"),
-                       perf_info.KernelPaged * page_size / mb);
-    dump_log.WriteLine(_T("Kernel NonPaged(MB):  %ld"),
-                       perf_info.KernelNonpaged * page_size / mb);
-    dump_log.WriteLine(_T("Page Size (KB):       %ld"),
-                       perf_info.PageSize / 1024);
-    dump_log.WriteLine(_T("Physical Avail(MB):   %ld"),
-                       perf_info.PhysicalAvailable * page_size / mb);
-    dump_log.WriteLine(_T("Physical Total(MB):   %ld"),
-                       perf_info.PhysicalTotal * page_size / mb);
-    dump_log.WriteLine(_T("System Cache(MB):     %ld"),
-                       perf_info.SystemCache * page_size / mb);
-  } else {
-    dump_log.WriteLine(_T("Unable to Get Performance Info"));
-  }
-
-  return S_OK;
-}
-
-HRESULT DataDumperOSData::GetSystemUptime(CString* uptime) {
-  ASSERT1(uptime);
-
-  const TCHAR* kUptimeCounterPath = _T("\\\\.\\System\\System Up Time");
-
-  HRESULT hr = S_OK;
-
-  PDH_HQUERY perf_query = NULL;
-  PDH_STATUS status = ::PdhOpenQuery(NULL, 0, &perf_query);
-  if (status != ERROR_SUCCESS) {
-    return HRESULT_FROM_WIN32(status);
-  }
-
-  ScopeGuard guard = MakeGuard(::PdhCloseQuery, perf_query);
-
-  PDH_HCOUNTER uptime_counter = NULL;
-  status = ::PdhAddCounter(perf_query,
-                           kUptimeCounterPath,
-                           0,
-                           &uptime_counter);
-  if (status != ERROR_SUCCESS) {
-    return HRESULT_FROM_WIN32(status);
-  }
-
-  status = ::PdhCollectQueryData(perf_query);
-  if (status != ERROR_SUCCESS) {
-    return HRESULT_FROM_WIN32(status);
-  }
-
-  PDH_FMT_COUNTERVALUE uptime_value = {0};
-  status = ::PdhGetFormattedCounterValue(uptime_counter,
-                                         PDH_FMT_LARGE,
-                                         NULL,
-                                         &uptime_value);
-  if (status != ERROR_SUCCESS) {
-    return HRESULT_FROM_WIN32(status);
-  }
-
-  CTimeSpan uptime_span(uptime_value.largeValue);
-  *uptime = uptime_span.Format(_T("%D days, %H hours, %M minutes, %S seconds"));
-
-  return S_OK;
-}
-
-}  // namespace omaha
-
diff --git a/tools/goopdump/data_dumper_osdata.h b/tools/goopdump/data_dumper_osdata.h
deleted file mode 100644
index 03bee91..0000000
--- a/tools/goopdump/data_dumper_osdata.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_TOOLS_SRC_GOOPDUMP_DATA_DUMPER_OSDATA_H_
-#define OMAHA_TOOLS_SRC_GOOPDUMP_DATA_DUMPER_OSDATA_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-
-#include "omaha/tools/goopdump/data_dumper.h"
-
-namespace omaha {
-
-class DataDumperOSData : public DataDumper {
- public:
-  DataDumperOSData();
-  virtual ~DataDumperOSData();
-
-  virtual HRESULT Process(const DumpLog& dump_log,
-                          const GoopdumpCmdLineArgs& args);
-
- private:
-  HRESULT GetSystemUptime(CString* uptime);
-  DISALLOW_EVIL_CONSTRUCTORS(DataDumperOSData);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_TOOLS_SRC_GOOPDUMP_DATA_DUMPER_OSDATA_H_
-
diff --git a/tools/goopdump/dump_log.cc b/tools/goopdump/dump_log.cc
deleted file mode 100644
index 878dfb7..0000000
--- a/tools/goopdump/dump_log.cc
+++ /dev/null
@@ -1,162 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/tools/goopdump/dump_log.h"
-
-#include <vector>
-
-#include "omaha/common/debug.h"
-#include "omaha/common/file.h"
-
-namespace omaha {
-
-DumpLogHandler::DumpLogHandler() {
-}
-
-DumpLogHandler::~DumpLogHandler() {
-}
-
-
-ConsoleDumpLogHandler::ConsoleDumpLogHandler() {
-}
-
-ConsoleDumpLogHandler::~ConsoleDumpLogHandler() {
-}
-
-void ConsoleDumpLogHandler::WriteLine(const TCHAR* line) {
-  _tprintf(_T("%s"), line);
-}
-
-
-DebugDumpLogHandler::DebugDumpLogHandler() {
-}
-
-DebugDumpLogHandler::~DebugDumpLogHandler() {
-}
-
-void DebugDumpLogHandler::WriteLine(const TCHAR* line) {
-  ::OutputDebugString(line);
-}
-
-
-FileDumpLogHandler::FileDumpLogHandler() {
-}
-
-FileDumpLogHandler::~FileDumpLogHandler() {
-}
-
-void FileDumpLogHandler::set_filename(const TCHAR* filename) {
-  filename_ = filename;
-  if (File::Exists(filename_)) {
-    File::Remove(filename_);
-
-    // Write the UNICODE file marker at the beginning.
-    char buf[2] = {0xff, 0xfe};
-    WriteBufToFile(buf, 2);
-  }
-}
-
-void FileDumpLogHandler::WriteLine(const TCHAR* line) {
-  if (filename_.IsEmpty()) {
-    return;
-  }
-
-  WriteBufToFile(line, _tcslen(line) * sizeof(TCHAR));
-}
-
-void FileDumpLogHandler::WriteBufToFile(const void* buf,
-                                        DWORD num_bytes_to_write) {
-  HANDLE h = ::CreateFile(filename_,
-                          GENERIC_WRITE,
-                          FILE_SHARE_READ,
-                          NULL,
-                          OPEN_ALWAYS,
-                          FILE_ATTRIBUTE_NORMAL,
-                          NULL);
-  if (h == INVALID_HANDLE_VALUE) {
-    return;
-  }
-
-  ::SetFilePointer(h, NULL, NULL, FILE_END);
-  DWORD bytes_written = 0;
-  ::WriteFile(h, buf, num_bytes_to_write, &bytes_written, NULL);
-  ::CloseHandle(h);
-}
-
-
-DumpLog::DumpLog() {
-}
-
-DumpLog::~DumpLog() {
-}
-
-void DumpLog::EnableConsole(bool enable) {
-  if (enable) {
-    AddLogHandler(&console_handler_);
-  } else {
-    RemoveLogHandler(&console_handler_);
-  }
-}
-
-void DumpLog::EnableDebug(bool enable) {
-  if (enable) {
-    AddLogHandler(&debug_handler_);
-  } else {
-    RemoveLogHandler(&debug_handler_);
-  }
-}
-
-void DumpLog::AddLogHandler(DumpLogHandler* log_handler) {
-  ASSERT1(log_handler);
-  std::vector<DumpLogHandler*>::iterator it = log_handlers_.begin();
-  for (; it != log_handlers_.end(); ++it) {
-    DumpLogHandler* handler = *it;
-    if (handler == log_handler) {
-      return;
-    }
-  }
-
-  log_handlers_.push_back(log_handler);
-}
-
-void DumpLog::RemoveLogHandler(DumpLogHandler* log_handler) {
-  ASSERT1(log_handler);
-  std::vector<DumpLogHandler*>::iterator it = log_handlers_.begin();
-  for (; it != log_handlers_.end(); ++it) {
-    DumpLogHandler* handler = *it;
-    if (handler == log_handler) {
-      log_handlers_.erase(it);
-      return;
-    }
-  }
-}
-
-void DumpLog::WriteLine(const TCHAR* format, ...) const {
-  va_list arg_list;
-  va_start(arg_list, format);
-
-  CString line;
-  line.FormatV(format, arg_list);
-  line.Append(_T("\r\n"));
-
-  std::vector<DumpLogHandler*>::const_iterator it = log_handlers_.begin();
-  for (; it != log_handlers_.end(); ++it) {
-    DumpLogHandler* handler = *it;
-    handler->WriteLine(line);
-  }
-}
-
-}  // namespace omaha
-
diff --git a/tools/goopdump/dump_log.h b/tools/goopdump/dump_log.h
deleted file mode 100644
index 1e1ce7c..0000000
--- a/tools/goopdump/dump_log.h
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_TOOLS_SRC_GOOPDUMP_DUMP_LOG_H_
-#define OMAHA_TOOLS_SRC_GOOPDUMP_DUMP_LOG_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-
-// TODO(omaha):  Can we use the other Omaha logging classes for this?
-
-namespace omaha {
-
-class DumpLogHandler {
- public:
-  DumpLogHandler();
-  virtual ~DumpLogHandler();
-
-  virtual void WriteLine(const TCHAR* line) = 0;
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(DumpLogHandler);
-};
-
-class ConsoleDumpLogHandler : public DumpLogHandler {
- public:
-  ConsoleDumpLogHandler();
-  virtual ~ConsoleDumpLogHandler();
-
-  virtual void WriteLine(const TCHAR* line);
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(ConsoleDumpLogHandler);
-};
-
-class DebugDumpLogHandler : public DumpLogHandler {
- public:
-  DebugDumpLogHandler();
-  virtual ~DebugDumpLogHandler();
-
-  virtual void WriteLine(const TCHAR* line);
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(DebugDumpLogHandler);
-};
-
-class FileDumpLogHandler : public DumpLogHandler {
- public:
-  FileDumpLogHandler();
-  virtual ~FileDumpLogHandler();
-
-  void set_filename(const TCHAR* filename);
-  virtual void WriteLine(const TCHAR* line);
-
- private:
-  void WriteBufToFile(const void* buf, DWORD num_bytes_to_write);
-
-  CString filename_;
-  DISALLOW_EVIL_CONSTRUCTORS(FileDumpLogHandler);
-};
-
-
-class DumpLog {
- public:
-  DumpLog();
-  ~DumpLog();
-
-  // Enables output to the console.
-  void EnableConsole(bool enable);
-
-  // Enables output to OutputDebugString().
-  void EnableDebug(bool enable);
-
-  // Adds a log handler to pipe content to.
-  // Not needed for console or debug, those are done separately.
-  // The class does not assume ownership of the pointer and the pointer must
-  // live until this class is destroyed.
-  void AddLogHandler(DumpLogHandler* log_handler);
-
-  // Removes the log handler.  Removal is done based on pointer equality.
-  void RemoveLogHandler(DumpLogHandler* log_handler);
-
-  // Writes a line to each of the connected log handlers.
-  void WriteLine(const TCHAR* format, ...) const;
-
- private:
-  std::vector<DumpLogHandler*> log_handlers_;
-
-  ConsoleDumpLogHandler console_handler_;
-  DebugDumpLogHandler debug_handler_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(DumpLog);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_TOOLS_SRC_GOOPDUMP_DUMP_LOG_H_
-
diff --git a/tools/goopdump/goopdump.cc b/tools/goopdump/goopdump.cc
deleted file mode 100644
index 5b4ac18..0000000
--- a/tools/goopdump/goopdump.cc
+++ /dev/null
@@ -1,165 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/tools/goopdump/goopdump.h"
-
-#include <stdio.h>
-
-#include <vector>
-
-#include "omaha/common/debug.h"
-#include "omaha/goopdate/config_manager.h"
-#include "omaha/tools/goopdump/data_dumper.h"
-#include "omaha/tools/goopdump/data_dumper_app_manager.h"
-#include "omaha/tools/goopdump/data_dumper_goopdate.h"
-#include "omaha/tools/goopdump/data_dumper_network.h"
-#include "omaha/tools/goopdump/data_dumper_oneclick.h"
-#include "omaha/tools/goopdump/data_dumper_osdata.h"
-#include "omaha/tools/goopdump/process_commandline.h"
-#include "omaha/tools/goopdump/process_monitor.h"
-
-namespace omaha {
-
-class GoopdateProcessMonitorCallback : public ProcessMonitorCallbackInterface {
- public:
-  explicit GoopdateProcessMonitorCallback(const DumpLog& dump_log)
-      : dump_log_(dump_log) {
-  }
-  virtual ~GoopdateProcessMonitorCallback() {}
-
-  virtual void OnProcessAdded(DWORD process_id,
-                              const CString& process_pattern) {
-    CString cmd_line;
-    GetProcessCommandLine(process_id, &cmd_line);
-    dump_log_.WriteLine(_T("Process Added.    ProcessId(%d)  Pattern(%s)  ")
-                        _T("cmd_line(%s)"),
-                        process_id, process_pattern, cmd_line);
-  }
-
-  virtual void OnProcessRemoved(DWORD process_id) {
-    dump_log_.WriteLine(_T("Process Removed.  ProcessId(%d)"), process_id);
-  }
-
- private:
-  const DumpLog& dump_log_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(GoopdateProcessMonitorCallback);
-};
-
-
-Goopdump::Goopdump() {
-}
-
-Goopdump::~Goopdump() {
-}
-
-HRESULT Goopdump::Main(const TCHAR* cmd_line, int argc, TCHAR** argv) {
-  SetNewHandler();
-  dump_log_.EnableConsole(true);
-  FileDumpLogHandler file_dumplog_handler;
-
-  ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
-
-  cmd_line_ = cmd_line;
-
-  PrintProgramHeader();
-  dump_log_.WriteLine(_T("cmd_line_: %s"), cmd_line_);
-
-  if (FAILED(ParseGoopdumpCmdLine(argc, argv, &args_))) {
-    PrintUsage();
-    return E_FAIL;
-  }
-
-  if (args_.is_write_to_file) {
-    file_dumplog_handler.set_filename(args_.log_filename);
-    dump_log_.AddLogHandler(&file_dumplog_handler);
-  }
-
-  // Dump out any requested data.
-  std::vector<DataDumper*> data_dumpers;
-
-  if (args_.is_dump_general) {
-    data_dumpers.push_back(new DataDumperOSData());
-    data_dumpers.push_back(new DataDumperNetwork());
-    data_dumpers.push_back(new DataDumperGoopdate());
-  }
-
-  if (args_.is_dump_oneclick) {
-    data_dumpers.push_back(new DataDumperOneClick());
-  }
-
-  if (args_.is_dump_app_manager) {
-    data_dumpers.push_back(new DataDumperAppManager());
-  }
-
-  std::vector<DataDumper*>::iterator it = data_dumpers.begin();
-  for (; it != data_dumpers.end(); ++it) {
-    DataDumper* dumper = *it;
-
-    dumper->Process(dump_log_, args_);
-    delete dumper;
-  }
-  data_dumpers.clear();
-
-  if (args_.is_monitor) {
-    // We want to monitor activity from GoogleUpdate.exe.
-    // Examples include:
-    // * Process start with arguments
-    // * Process exit
-    // * Others?
-    ProcessMonitor process_monitor;
-    GoopdateProcessMonitorCallback callback(dump_log_);
-    std::vector<CString> patterns;
-    patterns.push_back(CString(_T("googleupdate.exe")));
-    patterns.push_back(CString(_T("notepad.exe")));
-    process_monitor.StartWithPatterns(&callback, patterns);
-    getchar();
-    process_monitor.Stop();
-  }
-
-  ::CoUninitialize();
-
-  return S_OK;
-}
-
-void Goopdump::PrintProgramHeader() {
-  dump_log_.WriteLine(_T(""));
-  dump_log_.WriteLine(_T("Goopdump.exe -- Debug Utility for Google Update"));
-  dump_log_.WriteLine(_T("(c) Google, Inc."));
-  dump_log_.WriteLine(_T(""));
-}
-
-void Goopdump::PrintUsage() {
-  dump_log_.WriteLine(_T("Usage:"));
-  dump_log_.WriteLine(_T(""));
-}
-
-void Goopdump::SetNewHandler() {
-  VERIFY1(set_new_handler(&Goopdump::OutOfMemoryHandler) == 0);
-}
-
-void Goopdump::OutOfMemoryHandler() {
-  ::RaiseException(EXCEPTION_ACCESS_VIOLATION,
-                   EXCEPTION_NONCONTINUABLE,
-                   0,
-                   NULL);
-}
-
-CString Goopdump::cmd_line() const {
-  return cmd_line_;
-}
-
-}  // namespace omaha
-
diff --git a/tools/goopdump/goopdump.h b/tools/goopdump/goopdump.h
deleted file mode 100644
index 8a34351..0000000
--- a/tools/goopdump/goopdump.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_TOOLS_SRC_GOOPDUMP_GOOPDUMP_H__
-#define OMAHA_TOOLS_SRC_GOOPDUMP_GOOPDUMP_H__
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-
-#include "omaha/tools/goopdump/dump_log.h"
-#include "omaha/tools/goopdump/goopdump_cmd_line_parser.h"
-
-namespace omaha {
-
-class ConfigManager;
-
-class Goopdump {
- public:
-  // Constructor / Destructor
-  Goopdump();
-  ~Goopdump();
-
-  HRESULT Main(const TCHAR* cmd_line, int argc, TCHAR** argv);
-
-  ConfigManager* config_manager() const;
-  CString cmd_line() const;
-
-  GoopdumpCmdLineArgs& cmd_line_args() const;
-
- private:
-  // Installs a user function that is to be called when operator new fails
-  // to allocate memory.
-  static void SetNewHandler();
-
-  // Called by operator new or operator new[] when they cannot satisfy
-  // a request for additional storage.
-  static void OutOfMemoryHandler();
-
-  void PrintProgramHeader();
-  void PrintUsage();
-
-  CString cmd_line_;            // Command line, as provided by the OS.
-  GoopdumpCmdLineArgs args_;
-  DumpLog dump_log_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(Goopdump);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_TOOLS_SRC_GOOPDUMP_GOOPDUMP_H__
-
diff --git a/tools/goopdump/goopdump_cmd_line_parser.cc b/tools/goopdump/goopdump_cmd_line_parser.cc
deleted file mode 100644
index 12048d5..0000000
--- a/tools/goopdump/goopdump_cmd_line_parser.cc
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/tools/goopdump/goopdump_cmd_line_parser.h"
-
-#include "omaha/common/debug.h"
-#include "omaha/goopdate/command_line_parser.h"
-
-namespace omaha {
-
-HRESULT ParseGoopdumpCmdLine(int argc,
-                             TCHAR** argv,
-                             GoopdumpCmdLineArgs* args) {
-  ASSERT1(argc >= 1);
-  ASSERT1(argv);
-
-  UNREFERENCED_PARAMETER(argc);
-  UNREFERENCED_PARAMETER(argv);
-
-  CommandLineParser parser;
-  HRESULT hr = parser.ParseFromArgv(argc, argv);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  std::vector<CString> valid_params;
-  valid_params.push_back(_T("dumpapps"));
-  valid_params.push_back(_T("oneclick"));
-  valid_params.push_back(_T("monitor"));
-  valid_params.push_back(_T("file"));
-
-  for (int i = 0; i < parser.GetSwitchCount(); ++i) {
-    CString switch_name;
-    parser.GetSwitchNameAtIndex(i, &switch_name);
-    bool found = false;
-    for (size_t i = 0; i < valid_params.size(); ++i) {
-      const CString& valid_param = valid_params[i];
-      if (valid_param.Compare(switch_name) == 0) {
-        found = true;
-      }
-    }
-    if (!found) {
-      return E_INVALIDARG;
-    }
-  }
-
-  if (parser.HasSwitch(_T("file"))) {
-    int arg_count = 0;
-    parser.GetSwitchArgumentCount(_T("file"), &arg_count);
-    if (arg_count != 1) {
-      return E_INVALIDARG;
-    }
-    args->is_write_to_file = true;
-    parser.GetSwitchArgumentValue(_T("file"), 0, &(args->log_filename));
-  }
-
-  if (parser.GetSwitchCount() == 0 ||
-      (parser.HasSwitch(_T("file")) && parser.GetSwitchCount() == 1)) {
-    // If you don't pass anything, give them everything except monitoring.
-    args->is_dump_general = true;
-    args->is_dump_app_manager = true;
-    args->is_dump_oneclick = true;
-    args->is_machine = true;
-    args->is_user = true;
-  }
-
-  if (parser.HasSwitch(_T("dumpapps"))) {
-    args->is_dump_general = true;
-    args->is_dump_app_manager = true;
-    args->is_machine = true;
-    args->is_user = true;
-  }
-
-  if (parser.HasSwitch(_T("oneclick"))) {
-    args->is_dump_general = true;
-    args->is_dump_oneclick = true;
-    args->is_machine = true;
-    args->is_user = true;
-  }
-
-  if (parser.HasSwitch(_T("monitor"))) {
-    args->is_monitor = true;
-  }
-
-  return S_OK;
-}
-
-}  // namespace omaha
-
diff --git a/tools/goopdump/goopdump_cmd_line_parser.h b/tools/goopdump/goopdump_cmd_line_parser.h
deleted file mode 100644
index 9610506..0000000
--- a/tools/goopdump/goopdump_cmd_line_parser.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#ifndef OMAHA_TOOLS_SRC_GOOPDUMP_GOOPDUMP_CMD_LINE_PARSER_H_
-#define OMAHA_TOOLS_SRC_GOOPDUMP_GOOPDUMP_CMD_LINE_PARSER_H_
-
-#include <windows.h>
-#include <atlstr.h>
-#include "base/basictypes.h"
-
-namespace omaha {
-
-struct GoopdumpCmdLineArgs {
-  GoopdumpCmdLineArgs()
-      : is_machine(false),
-        is_user(false),
-        is_monitor(false),
-        is_dump_app_manager(false),
-        is_dump_oneclick(false),
-        is_dump_general(false),
-        is_write_to_file(false) {}
-  bool is_machine;            // Display per-machine data.
-  bool is_user;               // Display per-user data (for current user only).
-  bool is_monitor;            // Is monitor mode (monitors real time activity).
-  bool is_dump_app_manager;   // Dump AppManager data.
-  bool is_dump_oneclick;      // Dump OneClick data.
-  bool is_dump_general;       // Dump general OS and Omaha data.
-  bool is_write_to_file;      // Dump data to file.
-  CString log_filename;       // Filename of log to write to.
-};
-
-HRESULT ParseGoopdumpCmdLine(int argc, TCHAR** argv, GoopdumpCmdLineArgs* args);
-
-}  // namespace omaha
-
-#endif  // OMAHA_TOOLS_SRC_GOOPDUMP_GOOPDUMP_CMD_LINE_PARSER_H_
-
diff --git a/tools/goopdump/goopdump_main.cc b/tools/goopdump/goopdump_main.cc
deleted file mode 100644
index 46ef78a..0000000
--- a/tools/goopdump/goopdump_main.cc
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/tools/goopdump/goopdump.h"
-
-int _tmain(int argc, TCHAR** argv) {
-  UNREFERENCED_PARAMETER(argc);
-  UNREFERENCED_PARAMETER(argv);
-  return static_cast<int>(omaha::Goopdump().Main(::GetCommandLine(),
-                                                 argc,
-                                                 argv));
-}
-
diff --git a/tools/goopdump/process_commandline.cc b/tools/goopdump/process_commandline.cc
deleted file mode 100644
index 62976f6..0000000
--- a/tools/goopdump/process_commandline.cc
+++ /dev/null
@@ -1,278 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/tools/goopdump/process_commandline.h"
-
-#include "omaha/common/debug.h"
-#include "omaha/common/error.h"
-#include "omaha/common/scoped_any.h"
-#include "omaha/common/utils.h"
-
-namespace omaha {
-
-namespace {
-
-typedef const wchar_t* (__stdcall *GetCommandLineWFunc)();
-
-const DWORD kMaxInjectSize = 4096;
-const DWORD kCmdLineBufferSize = 2000;
-
-struct SharedBlock {
-  DWORD last_error;  // Last error from remote thread.
-  GetCommandLineWFunc get_commandline_w_ptr;  // Address of GetCommandLineW().
-  wchar_t cmd_line_buffer[kCmdLineBufferSize];  // The command line buffer.
-};
-
-// A number of assumptions are made:
-// * The target process is a Win32 process.
-// * Kernel32.dll is loaded at same address in each process (safe).
-// * InjectFunction() is shorter than kMaxInjectSize
-// * InjectFunction() does not rely on the C/C++ runtime.
-// * Compiler option /GZ is not used. (If it is, the compiler generates calls to
-//   functions which are not injected into the target.  The runtime_checks()
-//   pragma below removes this for debug builds which will have /GZ enabled by
-//   default.
-
-#pragma runtime_checks("", off)
-
-DWORD __stdcall InjectFunction(SharedBlock* shared_block) {
-  const wchar_t* source = shared_block->get_commandline_w_ptr();
-  wchar_t* target = &shared_block->cmd_line_buffer[0];
-  wchar_t* end = &shared_block->cmd_line_buffer[
-      arraysize(shared_block->cmd_line_buffer) - 1];
-  if (source == 0 || target == 0 || end == 0) {
-    shared_block->last_error = ERROR_INVALID_DATA;
-    return 0;
-  }
-
-  // This is effectively a wcscpy but we can't use library functions since this
-  // code will be injected into the target process space and we can't make
-  // assumptions about what's linked into that process.
-  for (; *source != 0 && target < end; ++source, ++target) {
-    *target = *source;
-  }
-
-  *target = 0;
-  shared_block->last_error = 0;
-
-  return 0;
-}
-
-#pragma runtime_checks("", restore)
-
-// Internal helper function to deal with the logic of injecting the
-// function/data into the process without the memory alloc/free since we don't
-// have smart pointers to handle VirtualAllocEx.
-HRESULT GetCommandLineFromHandleWithMemory(HANDLE process_handle,
-                                           void* function_memory,
-                                           SharedBlock* shared_block,
-                                           CString* command_line) {
-  ASSERT1(process_handle);
-  ASSERT1(function_memory);
-  ASSERT1(shared_block);
-
-  // Copy function into other process.
-  if (!::WriteProcessMemory(process_handle,
-                            function_memory,
-                            &InjectFunction,
-                            kMaxInjectSize,
-                            0)) {
-    return HRESULTFromLastError();
-  }
-
-  // Initialize data area for remote process.
-  scoped_library hmodule_kernel32(::LoadLibrary(L"kernel32.dll"));
-  if (!hmodule_kernel32) {
-    return HRESULTFromLastError();
-  }
-
-  SharedBlock shared_block_local;
-  shared_block_local.last_error = 0;
-  if (!GPA(get(hmodule_kernel32),
-           "GetCommandLineW",
-           &shared_block_local.get_commandline_w_ptr)) {
-    return HRESULTFromLastError();
-  }
-
-  shared_block_local.cmd_line_buffer[0] = L'\0';
-
-  if (!::WriteProcessMemory(process_handle,
-                            shared_block,
-                            &shared_block_local,
-                            sizeof(shared_block_local),
-                            0)) {
-    return HRESULTFromLastError();
-  }
-
-  // Create the remote thread.
-  scoped_handle remote_thread;
-  reset(remote_thread, ::CreateRemoteThread(
-      process_handle,
-      0,
-      0,
-      reinterpret_cast<LPTHREAD_START_ROUTINE>(function_memory),
-      shared_block,
-      0,
-      NULL));
-  if (!remote_thread) {
-    return HRESULTFromLastError();
-  }
-
-  const DWORD kWaitTimeoutMs = 3000;
-  DWORD wait_result = ::WaitForSingleObject(get(remote_thread), kWaitTimeoutMs);
-  switch (wait_result) {
-    case WAIT_TIMEOUT:
-      return HRESULT_FROM_WIN32(ERROR_TIMEOUT);
-    case WAIT_FAILED:
-      return HRESULTFromLastError();
-    case WAIT_OBJECT_0:
-      // This might just have worked, pick up the result.
-      if (!::ReadProcessMemory(process_handle,
-                               shared_block,
-                               &shared_block_local,
-                               sizeof(shared_block_local),
-                               0)) {
-        return HRESULTFromLastError();
-      }
-      if (shared_block_local.last_error == 0) {
-        *command_line = shared_block_local.cmd_line_buffer;
-      } else {
-        return HRESULT_FROM_WIN32(shared_block_local.last_error);
-      }
-      break;
-    default:
-      return HRESULTFromLastError();
-  }
-
-  return S_OK;
-}
-
-// Allocates memory in a remote process given the process handle.
-// Returns a block of memory for the function that will be injected and a block
-// of memory to store results in that we copy back out.
-HRESULT AllocateProcessMemory(HANDLE process_handle,
-                              void** function_memory,
-                              void** shared_block) {
-  ASSERT1(process_handle);
-  ASSERT1(function_memory);
-  ASSERT1(shared_block);
-
-  *function_memory = ::VirtualAllocEx(process_handle,
-                                      0,
-                                      kMaxInjectSize,
-                                      MEM_COMMIT,
-                                      PAGE_EXECUTE_READWRITE);
-  if (!(*function_memory)) {
-    return HRESULTFromLastError();
-  }
-
-  *shared_block = ::VirtualAllocEx(process_handle,
-                                  0,
-                                  sizeof(SharedBlock),
-                                  MEM_COMMIT,
-                                  PAGE_READWRITE);
-  if (!(*shared_block)) {
-    ::VirtualFreeEx(process_handle, *function_memory, 0, MEM_RELEASE);
-    *function_memory = NULL;
-    return HRESULTFromLastError();
-  }
-
-  return S_OK;
-}
-
-HRESULT GetCommandLineFromHandle(HANDLE process_handle, CString* command_line) {
-  ASSERT1(command_line);
-  ASSERT1(process_handle != NULL);
-
-  void* function_memory = NULL;
-  void* shared_block = NULL;
-
-  HRESULT hr = AllocateProcessMemory(process_handle,
-                                     &function_memory,
-                                     &shared_block);
-
-  if (SUCCEEDED(hr) && function_memory && shared_block) {
-    hr = GetCommandLineFromHandleWithMemory(
-        process_handle,
-        function_memory,
-        reinterpret_cast<SharedBlock*>(shared_block),
-        command_line);
-  }
-
-  if (function_memory) {
-    ::VirtualFreeEx(process_handle, function_memory, 0, MEM_RELEASE);
-    function_memory = NULL;
-  }
-
-  if (shared_block) {
-    ::VirtualFreeEx(process_handle, shared_block, 0, MEM_RELEASE);
-    shared_block = NULL;
-  }
-
-  return hr;
-}
-
-}  // namespace
-
-HRESULT GetProcessCommandLine(DWORD process_id, CString* command_line) {
-  ASSERT1(command_line);
-
-  EnableDebugPrivilege();
-  scoped_handle process_handle;
-  reset(process_handle, ::OpenProcess(PROCESS_CREATE_THREAD |
-                                      PROCESS_VM_OPERATION |
-                                      PROCESS_VM_WRITE |
-                                      PROCESS_VM_READ,
-                                      FALSE,
-                                      process_id));
-  if (!valid(process_handle)) {
-    return HRESULTFromLastError();
-  }
-  return GetCommandLineFromHandle(get(process_handle), command_line);
-}
-
-bool EnableDebugPrivilege() {
-  scoped_handle token;
-
-  if (!::OpenProcessToken(::GetCurrentProcess(),
-                          TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
-                          address(token))) {
-    return false;
-  }
-
-  LUID se_debug_name_value = {0};
-  if (!::LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &se_debug_name_value)) {
-    return false;
-  }
-
-  TOKEN_PRIVILEGES token_privs = {0};
-  token_privs.PrivilegeCount = 1;
-  token_privs.Privileges[0].Luid = se_debug_name_value;
-  token_privs.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
-
-  if (!::AdjustTokenPrivileges(get(token),
-                               FALSE,
-                               &token_privs,
-                               sizeof(token_privs),
-                               NULL,
-                               NULL)) {
-    return false;
-  }
-
-  return true;
-}
-
-}  // namespace omaha
-
diff --git a/tools/goopdump/process_commandline.h b/tools/goopdump/process_commandline.h
deleted file mode 100644
index 6bcb63e..0000000
--- a/tools/goopdump/process_commandline.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Provides functionality to get the command line of a Win32 process given the
-// process ID.
-
-#ifndef OMAHA_TOOLS_SRC_GOOPDUMP_PROCESS_COMMANDLINE_H__
-#define OMAHA_TOOLS_SRC_GOOPDUMP_PROCESS_COMMANDLINE_H__
-
-#include <windows.h>
-#include <atlstr.h>
-
-namespace omaha {
-
-// Given a Win32 process ID, returns the command line for that process.
-HRESULT GetProcessCommandLine(DWORD process_id, CString* command_line);
-
-// Enables SE_DEBUG_NAME privilege for the process.
-bool EnableDebugPrivilege();
-
-}  // namespace omaha
-
-#endif  // OMAHA_TOOLS_SRC_GOOPDUMP_PROCESS_COMMANDLINE_H__
-
diff --git a/tools/goopdump/process_commandline_unittest.cc b/tools/goopdump/process_commandline_unittest.cc
deleted file mode 100644
index e605d38..0000000
--- a/tools/goopdump/process_commandline_unittest.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/tools/goopdump/process_commandline.h"
-
-#include "omaha/common/scoped_any.h"
-#include "omaha/common/system.h"
-#include "omaha/testing/unit_test.h"
-
-namespace omaha {
-
-TEST(GoopdumpProcessCommandLineTest, TestRunNotepad) {
-  // TODO(omaha): Can we use Process::GetCommandLine() instead of
-  // GetProcessCommandLine? Should be safer than injecting a thread and can
-  // be used in coverage builds.
-#ifdef COVERAGE_ENABLED
-  std::wcout << _T("\tTest does not run in coverage builds because the ")
-             << _T("instrumentation of InjectFunction results in references ")
-             << _T("to invalid memory locations in Notepad.exe.")
-             << std::endl;
-#else
-  TCHAR notepad_path[MAX_PATH] = {0};
-  TCHAR system_directory[MAX_PATH] = {0};
-  ::GetSystemDirectory(system_directory, arraysize(system_directory));
-  _stprintf_s(notepad_path,
-            arraysize(notepad_path),
-            _T("%s\\notepad.exe %s\\loadfix.com"),
-            system_directory, system_directory);
-
-  PROCESS_INFORMATION pi = {0};
-  EXPECT_SUCCEEDED(System::StartProcess(NULL, notepad_path, &pi));
-  ::CloseHandle(pi.hThread);
-  scoped_process process_handle(pi.hProcess);
-
-  CString command_line;
-  EXPECT_SUCCEEDED(GetProcessCommandLine(pi.dwProcessId, &command_line));
-
-  ::TerminateProcess(get(process_handle), 0);
-
-  EXPECT_STREQ(notepad_path, command_line);
-#endif
-}
-
-}  // namespace omaha
-
diff --git a/tools/goopdump/process_monitor.cc b/tools/goopdump/process_monitor.cc
deleted file mode 100644
index 031dc3d..0000000
--- a/tools/goopdump/process_monitor.cc
+++ /dev/null
@@ -1,234 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/tools/goopdump/process_monitor.h"
-
-#include <tlhelp32.h>
-#include <map>
-#include <vector>
-
-#include "omaha/common/debug.h"
-#include "omaha/common/error.h"
-#include "omaha/common/logging.h"
-#include "omaha/tools/goopdump/process_commandline.h"
-
-namespace omaha {
-
-ProcessMonitor::ProcessMonitor() : is_running_(false), callback_(NULL) {
-}
-
-ProcessMonitor::~ProcessMonitor() {
-}
-
-HRESULT ProcessMonitor::Start(ProcessMonitorCallbackInterface* callback,
-                              const TCHAR* process_name_pattern) {
-  std::vector<CString> patterns;
-  patterns.push_back(CString(process_name_pattern));
-  return StartWithPatterns(callback, patterns);
-}
-
-HRESULT ProcessMonitor::StartWithPatterns(
-    ProcessMonitorCallbackInterface* callback,
-    const std::vector<CString>& process_name_patterns) {
-  SingleLock lock(&lock_);
-
-  if (is_running_) {
-    return E_UNEXPECTED;
-  }
-
-  EnableDebugPrivilege();
-
-  std::vector<CString>::const_iterator it = process_name_patterns.begin();
-  for (; it != process_name_patterns.end(); ++it) {
-    CString pattern = *it;
-    pattern.MakeLower();
-    process_name_patterns_.push_back(pattern);
-  }
-
-  callback_ = callback;
-
-  reset(event_thread_exit_, ::CreateEvent(NULL, FALSE, FALSE, NULL));
-  if (!valid(event_thread_exit_)) {
-    return HRESULTFromLastError();
-  }
-
-  reset(monitor_thread_, ::CreateThread(NULL,
-                                        0,
-                                        &ProcessMonitor::MonitorThreadProc,
-                                        this,
-                                        0,
-                                        NULL));
-  if (!valid(monitor_thread_)) {
-    return HRESULTFromLastError();
-  }
-
-  is_running_ = true;
-  return S_OK;
-}
-
-HRESULT ProcessMonitor::Stop() {
-  SingleLock lock(&lock_);
-
-  if (!is_running_) {
-    return E_UNEXPECTED;
-  }
-
-  ::SetEvent(get(event_thread_exit_));
-  ::WaitForSingleObject(get(monitor_thread_), INFINITE);
-
-  is_running_ = false;
-  return S_OK;
-}
-
-DWORD ProcessMonitor::MonitorThreadProc(void* param) {
-  ProcessMonitor* monitor = static_cast<ProcessMonitor*>(param);
-  if (monitor) {
-    return monitor->MonitorProc();
-  }
-  return 1;
-}
-
-DWORD ProcessMonitor::MonitorProc() {
-  // 200ms idle between polling for process creation.
-  const DWORD kWaitTimeoutMs = 200;
-
-  MapHandleToDword map_handle_pid;
-  bool keep_running = true;
-
-  do {
-    size_t map_count = map_handle_pid.size();
-    size_t pids_to_monitor = (map_count < MAXIMUM_WAIT_OBJECTS) ?
-        map_count : MAXIMUM_WAIT_OBJECTS;
-
-    std::vector<HANDLE> handles;
-    handles.push_back(get(event_thread_exit_));
-
-    MapHandleToDwordIterator iter = map_handle_pid.begin();
-    for (; (iter != map_handle_pid.end()) && (handles.size() < pids_to_monitor);
-         ++iter) {
-      handles.push_back(iter->first);
-    }
-
-    DWORD wait_result = ::WaitForMultipleObjects(handles.size(),
-                                                 &handles.front(),
-                                                 FALSE,
-                                                 kWaitTimeoutMs);
-    if (wait_result < (WAIT_OBJECT_0 + handles.size())) {
-      HANDLE signalled = handles[wait_result - WAIT_OBJECT_0];
-
-      if (signalled == get(event_thread_exit_)) {
-        // We've been signalled to exit.
-        keep_running = false;
-      } else {
-        // One of the PIDs exited.
-        MapHandleToDwordIterator iter = map_handle_pid.begin();
-        for (; iter != map_handle_pid.end(); ++iter) {
-          if (iter->first == signalled) {
-            OnProcessRemoved(iter->second);
-            ::CloseHandle(iter->first);
-            map_handle_pid.erase(iter);
-            break;
-          }
-        }
-      }
-    } else if (wait_result == WAIT_TIMEOUT) {
-      // Our polling time is up.  Go look for running instances of the
-      // process we're monitoring and look for differences in the list of PIDs.
-      UpdateProcessList(&map_handle_pid);
-    } else {
-      // Some type of failure occurred.
-      keep_running = false;
-    }
-  } while (keep_running);
-
-  return 0;
-}
-
-void ProcessMonitor::CleanupHandleMap(MapHandleToDword* map_handle_pid) {
-  ASSERT1(map_handle_pid);
-  MapHandleToDwordIterator iter = map_handle_pid->begin();
-  for (; iter != map_handle_pid->end(); ++iter) {
-    ::CloseHandle(iter->first);
-  }
-  map_handle_pid->clear();
-}
-
-bool ProcessMonitor::UpdateProcessList(MapHandleToDword* map_handle_pid) {
-  ASSERT1(map_handle_pid);
-  scoped_handle process_snap;
-  reset(process_snap, ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0));
-  if (!valid(process_snap)) {
-    return false;
-  }
-
-  PROCESSENTRY32 process_entry32 = {0};
-  process_entry32.dwSize = sizeof(PROCESSENTRY32);
-
-  if (!::Process32First(get(process_snap), &process_entry32)) {
-    return false;
-  }
-
-  do {
-    CString exe_file_name = process_entry32.szExeFile;
-    exe_file_name.MakeLower();
-
-    typedef std::vector<CString>::iterator VectorIterator;
-    VectorIterator pattern_iter = process_name_patterns_.begin();
-    for (; pattern_iter != process_name_patterns_.end(); ++pattern_iter) {
-      CString process_pattern = *pattern_iter;
-      if (exe_file_name.Find(process_pattern) >= 0) {
-        // We've found a match.  See if this ProcessID is already in our list
-        bool is_found = false;
-        MapHandleToDwordIterator iter = map_handle_pid->begin();
-        for (; iter != map_handle_pid->end(); ++iter) {
-          if (iter->second == process_entry32.th32ProcessID) {
-            is_found = true;
-            break;
-          }
-        }
-
-        if (!is_found) {
-          // Opening this handle and we'll give ownership of this HANDLE to
-          // map_handle_pid.
-          HANDLE process_handle = ::OpenProcess(PROCESS_ALL_ACCESS,
-                                                FALSE,
-                                                process_entry32.th32ProcessID);
-          if (process_handle) {
-            (*map_handle_pid)[process_handle] = process_entry32.th32ProcessID;
-            OnProcessAdded(process_entry32.th32ProcessID, process_pattern);
-          }
-        }
-      }
-    }
-  } while (::Process32Next(get(process_snap), &process_entry32));
-
-  return true;
-}
-
-void ProcessMonitor::OnProcessAdded(DWORD process_id,
-                                    const CString& process_pattern) {
-  if (callback_) {
-    callback_->OnProcessAdded(process_id, process_pattern);
-  }
-}
-
-void ProcessMonitor::OnProcessRemoved(DWORD process_id) {
-  if (callback_) {
-    callback_->OnProcessRemoved(process_id);
-  }
-}
-
-}  // namespace omaha
-
diff --git a/tools/goopdump/process_monitor.h b/tools/goopdump/process_monitor.h
deleted file mode 100644
index 154a4e7..0000000
--- a/tools/goopdump/process_monitor.h
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Provides a class (ProcessMonitor) to watch for Win32 process names and fire
-// callback events (via the ProcessMonitorCallbackInterface) when processes are
-// created/exited.
-
-#ifndef OMAHA_TOOLS_SRC_GOOPDUMP_PROCESS_MONITOR_H__
-#define OMAHA_TOOLS_SRC_GOOPDUMP_PROCESS_MONITOR_H__
-
-#include <windows.h>
-#include <atlstr.h>
-#include <map>
-#include <vector>
-
-#include "omaha/common/scoped_any.h"
-#include "omaha/common/synchronized.h"
-
-namespace omaha {
-
-// Interface for users of the ProcessMonitor class to receive events when a
-// process matching their desired pattern is created or exits.
-class ProcessMonitorCallbackInterface {
- public:
-  ProcessMonitorCallbackInterface() {}
-  virtual ~ProcessMonitorCallbackInterface() {}
-
-  // Called when a new process is found that matches the pattern.  The pattern
-  // that matched is passed in as process_pattern.
-  virtual void OnProcessAdded(DWORD process_id,
-                              const CString& process_pattern) = 0;
-
-  // Called when a process that was previously found has exited.
-  virtual void OnProcessRemoved(DWORD process_id) = 0;
-
- private:
-  DISALLOW_EVIL_CONSTRUCTORS(ProcessMonitorCallbackInterface);
-};
-
-// This class creates a thread to monitor running processes for particular
-// process names.  Fires events via ProcessMonitorCallbackInterface when a new
-// process is detected that matches a name pattern and also when those processes
-// exit.
-// This class uses polling to look for the processes since the only way to get
-// event notification of process creation is to create a driver.
-class ProcessMonitor {
- public:
-  typedef std::map<HANDLE, DWORD> MapHandleToDword;
-  typedef MapHandleToDword::iterator MapHandleToDwordIterator;
-
-  ProcessMonitor();
-  ~ProcessMonitor();
-
-  // Starts the monitoring process to look for processes that match
-  // process_name_pattern and fire events via the callback.
-  HRESULT Start(ProcessMonitorCallbackInterface* callback,
-                const TCHAR* process_name_pattern);
-
-  // Starts the monitoring process with multiple patterns.
-  HRESULT StartWithPatterns(ProcessMonitorCallbackInterface* callback,
-                            const std::vector<CString>& process_name_patterns);
-
-  // Stops the monitoring process and cleans up.
-  HRESULT Stop();
-
- private:
-  // Thread procedure for monitoring the processes in the background.
-  static DWORD WINAPI MonitorThreadProc(void* param);
-  DWORD MonitorProc();
-
-  // Called when a process matching the process is found.
-  void OnProcessAdded(DWORD process_id, const CString& process_pattern);
-
-  // Called when a previously added process exits.
-  void OnProcessRemoved(DWORD process_id);
-
-  // Walks the active process list to look for matches against the pattern.  If
-  // a process is found to match that's not in the list, it's added to the map
-  // and OnProcessAdded() is called.
-  bool UpdateProcessList(MapHandleToDword* map_handle_pid);
-
-  // Walks through the map and calls CloseHandle() on each handle in the list.
-  void CleanupHandleMap(MapHandleToDword* map_handle_pid);
-
-  bool is_running_;   // Set to true while the process monitoring is running.
-  ProcessMonitorCallbackInterface* callback_;   // Event callback interface.
-  std::vector<CString> process_name_patterns_;  // List of patterns to match.
-  CriticalSection lock_;              // Protects is_running_ flag.
-  scoped_handle event_thread_exit_;   // Signal to exit monitor_thread_.
-  scoped_handle monitor_thread_;      // Handle to the monitoring thread.
-
-  DISALLOW_EVIL_CONSTRUCTORS(ProcessMonitor);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_TOOLS_SRC_GOOPDUMP_PROCESS_MONITOR_H__
-
diff --git a/tools/goopdump/process_monitor_unittest.cc b/tools/goopdump/process_monitor_unittest.cc
deleted file mode 100644
index 6f99bc4..0000000
--- a/tools/goopdump/process_monitor_unittest.cc
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <vector>
-
-#include "omaha/common/system.h"
-#include "omaha/testing/unit_test.h"
-#include "omaha/tools/goopdump/process_monitor.h"
-
-namespace omaha {
-
-// TODO(omaha): use gMock.
-class MockProcessMonitorCallback : public ProcessMonitorCallbackInterface {
- public:
-  MockProcessMonitorCallback()
-    : num_times_onprocessadded_called_(0),
-      num_times_onprocessremoved_called_(0) {}
-  virtual ~MockProcessMonitorCallback() {}
-
-  virtual void OnProcessAdded(DWORD process_id,
-                              const CString& process_pattern) {
-    ++num_times_onprocessadded_called_;
-    process_ids_added_.push_back(process_id);
-    process_patterns_added_.push_back(process_pattern);
-  }
-
-  virtual void OnProcessRemoved(DWORD process_id) {
-    ++num_times_onprocessremoved_called_;
-    process_ids_removed_.push_back(process_id);
-  }
-
-  int num_times_onprocessadded_called() const {
-    return num_times_onprocessadded_called_;
-  }
-
-  int num_times_onprocessremoved_called() const {
-    return num_times_onprocessremoved_called_;
-  }
-
- private:
-  int num_times_onprocessadded_called_;
-  int num_times_onprocessremoved_called_;
-
-  std::vector<CString> process_patterns_added_;
-  std::vector<DWORD> process_ids_added_;
-  std::vector<DWORD> process_ids_removed_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(MockProcessMonitorCallback);
-};
-
-TEST(GoopdumpProcessMonitorTest, TestStartStopNoop) {
-  ProcessMonitor process_monitor;
-  EXPECT_SUCCEEDED(process_monitor.Start(NULL, _T("some_noop_process.exe")));
-  EXPECT_SUCCEEDED(process_monitor.Stop());
-}
-
-TEST(GoopdumpProcessMonitorTest, TestStartStopNoopPatterns) {
-  ProcessMonitor process_monitor;
-  std::vector<CString> patterns;
-  patterns.push_back(CString(_T("some_noop_process")));
-  patterns.push_back(CString(_T("this_process")));
-  patterns.push_back(CString(_T("that_process")));
-  EXPECT_SUCCEEDED(process_monitor.StartWithPatterns(NULL, patterns));
-  EXPECT_SUCCEEDED(process_monitor.Stop());
-}
-
-TEST(GoopdumpProcessMonitorTest, TestStartStopNoopWithCallback) {
-  ProcessMonitor process_monitor;
-  MockProcessMonitorCallback callback;
-  EXPECT_SUCCEEDED(process_monitor.Start(&callback,
-                                         _T("some_noop_process.exe")));
-  EXPECT_SUCCEEDED(process_monitor.Stop());
-
-  EXPECT_EQ(0, callback.num_times_onprocessadded_called());
-  EXPECT_EQ(0, callback.num_times_onprocessremoved_called());
-}
-
-TEST(GoopdumpProcessMonitorTest, TestStartStopNotepadWithCallback) {
-  ProcessMonitor process_monitor;
-  MockProcessMonitorCallback callback;
-  EXPECT_SUCCEEDED(process_monitor.Start(&callback,
-                                         _T("notepad.exe")));
-  TCHAR notepad_path[MAX_PATH] = {0};
-  TCHAR system_directory[MAX_PATH] = {0};
-  ::GetSystemDirectory(system_directory, arraysize(system_directory));
-  _stprintf(notepad_path,
-            arraysize(notepad_path),
-            _T("%s\\notepad.exe"),
-            system_directory);
-
-  PROCESS_INFORMATION pi = {0};
-  System::StartProcess(NULL, notepad_path, &pi);
-  ::CloseHandle(pi.hThread);
-  scoped_process process_handle(pi.hProcess);
-
-  // Have to sleep since we're polling for process start/exit.
-  // In order to get notified of process start we have to write a driver.
-  ::Sleep(500);
-
-  ::TerminateProcess(get(process_handle), 0);
-
-  ::Sleep(500);
-
-  EXPECT_SUCCEEDED(process_monitor.Stop());
-
-  EXPECT_EQ(1, callback.num_times_onprocessadded_called());
-  EXPECT_EQ(1, callback.num_times_onprocessremoved_called());
-}
-
-}  // namespace omaha
-
diff --git a/tools/goopdump/resource.h b/tools/goopdump/resource.h
deleted file mode 100644
index f2e91f0..0000000
--- a/tools/goopdump/resource.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Symbol definitions for the Goopdump EXE resources.
-
-#ifndef OMAHA_TOOLS_SRC_GOOPDUMP_RESOURCE_H__
-#define OMAHA_TOOLS_SRC_GOOPDUMP_RESOURCE_H__
-
-#endif  // OMAHA_TOOLS_SRC_GOOPDUMP_RESOURCE_H__
-
diff --git a/tools/goopdump/resource.rc b/tools/goopdump/resource.rc
deleted file mode 100644
index c7ce0a2..0000000
--- a/tools/goopdump/resource.rc
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <afxres.h>
-
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_BUILD,VERSION_PATCH
- PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_BUILD,VERSION_PATCH
- FILEFLAGSMASK 0x3FL
- FILEFLAGS 0x0L
- FILEOS 0x4L
- FILETYPE 0x0L
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "040904e4"
-        BEGIN
-            VALUE "CompanyName", "Google Inc."
-            VALUE "FileDescription", "Goopdump"
-            VALUE "FileVersion", VERSION_NUMBER_STRING
-            VALUE "InternalName", "Goopdump"
-            VALUE "LegalCopyright", "Copyright 2008-2010 Google Inc."
-            VALUE "OriginalFilename", "Goopdump"
-            VALUE "ProductName", "Goopdump"
-            VALUE "ProductVersion", VERSION_NUMBER_STRING
-#ifdef _DEBUG
-            VALUE "Debug", ""
-#endif
-#if !OFFICIAL_BUILD
-            VALUE "Privatebuild", ""
-#endif
-
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x409, 1252
-    END
-END
-
-
-
diff --git a/tools/longrunning/build.scons b/tools/longrunning/build.scons
deleted file mode 100644
index f6df753..0000000
--- a/tools/longrunning/build.scons
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/usr/bin/python2.4
-# Copyright 2009-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-# Builds two versions of LongRunning. LongRunning.exe is a console app and will
-# result in a console windows when run. LongRunningSilent.exe uses the Windows
-# subsystem so that it does not throw up windows. It is useful for unit tests.
-# There is a resource file, so that we can include a manifest that tells Windows
-# Vista not to elevate this file. We need this when it is renamed to
-# GoogleUpdate.exe for unit tests.
-
-Import('env')
-
-inputs = [
-    'long_running.cc',
-    env.RES('run_as_invoker.res', '$MAIN_DIR/common/run_as_invoker.rc'),
-    ]
-
-base_env = env.Clone()
-
-base_env.Append(
-    LIBS = [
-        ('libcmt.lib', 'libcmtd.lib')[base_env.Bit('debug')],
-        ],
-    CPPDEFINES = [
-        'UNICODE',
-        '_UNICODE'
-        ],
-)
-
-if base_env.Bit('debug'):
-  base_env.FilterOut(CCFLAGS=['/MTd'])
-else:
-  base_env.FilterOut(CCFLAGS=['/MT'])
-
-# Duplicate the common settings then set the unique settings for each build.
-silent_env = base_env.Clone()
-
-# Use different subdirectory to avoid having 2 obj files with the same name.
-silent_env['OBJPREFIX'] = 'silent/' + silent_env['OBJPREFIX']
-
-silent_env.ComponentTestProgram(
-    prog_name='LongRunningSilent',
-    source=inputs,
-    COMPONENT_TEST_RUNNABLE=False
-)
-
-
-base_env.FilterOut(LINKFLAGS = ['/SUBSYSTEM:WINDOWS'])
-base_env['LINKFLAGS'] += [
-    '/SUBSYSTEM:CONSOLE',
-    '/ENTRY:WinMain',
-    ]
-
-base_env.ComponentTestProgram(
-    prog_name='LongRunning',
-    source=inputs,
-    COMPONENT_TEST_RUNNABLE=False
-)
diff --git a/tools/longrunning/long_running.cc b/tools/longrunning/long_running.cc
deleted file mode 100644
index cd13dec..0000000
--- a/tools/longrunning/long_running.cc
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// Do nothing executable. Sleeps infinitely.
-
-#pragma check_stack(off)
-#pragma runtime_checks("", off)
-#include <windows.h>
-
-int __stdcall WinMain(HINSTANCE,
-                      HINSTANCE,
-                      LPSTR,
-                      int) {
-  ::SleepEx(INFINITE, FALSE);
-  return 0;
-}
diff --git a/tools/performondemand/build.scons b/tools/performondemand/build.scons
deleted file mode 100644
index 88b6d49..0000000
--- a/tools/performondemand/build.scons
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2009-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-
-Import('env')
-
-
-local_env = env.Clone()
-local_env.Append(
-    CPPDEFINES = [
-        'UNICODE',
-        '_UNICODE'
-        ],
-    CPPPATH = [
-        '$OBJ_ROOT',
-        ],
-    LIBS = [
-        ('atls.lib', 'atlsd.lib')[local_env.Bit('debug')],
-        ('libcmt.lib', 'libcmtd.lib')[local_env.Bit('debug')],
-        ('libcpmt.lib', 'libcpmtd.lib')[local_env.Bit('debug')],
-        'comctl32.lib',
-        'crypt32.lib',
-        'Iphlpapi.lib',
-        'mstask.lib',
-        'netapi32.lib',
-        'psapi.lib',
-        'rasapi32.lib',
-        'shlwapi.lib',
-        'urlmon.lib',
-        'userenv.lib',
-        'version.lib',
-        'wininet.lib',
-        'wtsapi32.lib',
-
-        '$LIB_DIR/common.lib',
-        '$LIB_DIR/goopdate_dll.lib',
-        '$LIB_DIR/logging.lib',
-        '$LIB_DIR/net.lib',
-        '$LIB_DIR/statsreport.lib',
-        ],
-)
-
-local_env.FilterOut(LINKFLAGS = ['/SUBSYSTEM:WINDOWS'])
-local_env['LINKFLAGS'] += ['/SUBSYSTEM:CONSOLE']
-
-no_precomp_env = local_env.Clone()
-idl_obj = no_precomp_env.ComponentObject(
-    source='$OBJ_ROOT/goopdate/google_update_idl_i.c')
-
-target_name = 'performondemand'
-
-inputs = [
-    'performondemand.cc',
-    idl_obj,
-    ]
-if env.Bit('use_precompiled_headers'):
-  inputs += local_env.EnablePrecompile(target_name)
-
-local_env.ComponentTestProgram(
-    prog_name=target_name,
-    source=inputs,
-    COMPONENT_TEST_RUNNABLE=False
-)
diff --git a/tools/performondemand/performondemand.cc b/tools/performondemand/performondemand.cc
deleted file mode 100644
index ea40bfe..0000000
--- a/tools/performondemand/performondemand.cc
+++ /dev/null
@@ -1,384 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// A simple tool for performing and interacting with on demand updates.
-#include "omaha/tools/performondemand/performondemand.h"
-#include <windows.h>
-#include <sddl.h>
-#include <shlobj.h>
-#include <atltime.h>
-#include <tchar.h>
-#include "omaha/common/system.h"
-#include "omaha/common/system_info.h"
-#include "omaha/common/utils.h"
-#include "omaha/common/vistautil.h"
-
-namespace omaha {
-
-bool ParseParams(int argc, TCHAR* argv[], CString* guid, bool* is_machine,
-                 bool* is_update_check_only, int* timeout) {
-  ASSERT1(argv);
-  ASSERT1(guid);
-  ASSERT1(is_machine);
-  ASSERT1(is_update_check_only);
-  ASSERT1(timeout);
-  if (argc < 3 || argc > 5) {
-    return false;
-  }
-  *guid = argv[1];
-
-  // Verify that the guid is valid.
-  GUID parsed = StringToGuid(*guid);
-  if (parsed == GUID_NULL) {
-    return false;
-  }
-
-  *is_machine = !!_ttoi(argv[2]);
-
-  if (argc >= 4) {
-    *is_update_check_only = !!_ttoi(argv[3]);
-  } else {
-    *is_update_check_only = false;
-  }
-
-  if (argc >= 5) {
-    *timeout = _ttoi(argv[4]);
-    if (*timeout == 0) {
-      return false;
-    }
-  } else {
-    *timeout = 60;
-  }
-
-  return true;
-}
-
-
-DWORD SetTokenIntegrityLevelMedium(HANDLE token) {
-  PSID medium_sid = NULL;
-  if (!::ConvertStringSidToSid(SDDL_ML_MEDIUM, &medium_sid)) {
-    return ::GetLastError();
-  }
-
-  TOKEN_MANDATORY_LABEL label = {0};
-  label.Label.Attributes = SE_GROUP_INTEGRITY;
-  label.Label.Sid = medium_sid;
-
-  size_t size = sizeof(TOKEN_MANDATORY_LABEL) + ::GetLengthSid(medium_sid);
-  BOOL success = ::SetTokenInformation(token, TokenIntegrityLevel, &label,
-                                      size);
-  DWORD result = success ? ERROR_SUCCESS : ::GetLastError();
-  ::LocalFree(medium_sid);
-  return result;
-}
-
-// Reads the Proxy information for the given interface from HKCU, and registers
-// it with COM.
-HRESULT RegisterHKCUPSClsid(IID iid,
-                            HMODULE* proxy_module,
-                            DWORD* revoke_cookie) {
-  ASSERT1(proxy_module);
-  ASSERT1(revoke_cookie);
-  *proxy_module = NULL;
-  *revoke_cookie = 0;
-
-  const TCHAR* const hkcu_classes_key = _T("HKCU\\Software\\Classes\\");
-
-  // Get the registered proxy for the interface.
-  CString interface_proxy_clsid_key;
-  interface_proxy_clsid_key.Format(_T("%sInterface\\%s\\ProxyStubClsid32"),
-                                   hkcu_classes_key, GuidToString(iid));
-  CString proxy_clsid32_value;
-  HRESULT hr = RegKey::GetValue(interface_proxy_clsid_key,
-                        NULL,
-                        &proxy_clsid32_value);
-  if (FAILED(hr)) {
-    wprintf(_T("RegKey::GetValue failed [%s][0x%x]\n"),
-            interface_proxy_clsid_key, hr);
-    return hr;
-  }
-
-  // Get the location of the proxy/stub DLL.
-  CString proxy_server32_entry;
-  proxy_server32_entry.Format(_T("%sClsid\\%s\\InprocServer32"),
-                              hkcu_classes_key, proxy_clsid32_value);
-  CString hkcu_proxy_dll_path;
-  hr = RegKey::GetValue(proxy_server32_entry,
-                        NULL,
-                        &hkcu_proxy_dll_path);
-  if (FAILED(hr)) {
-    wprintf(_T("RegKey::GetValue failed [%s][0x%x]\n"),
-            proxy_server32_entry, hr);
-    return hr;
-  }
-
-  // Get the proxy/stub class object.
-  typedef HRESULT (STDAPICALLTYPE *DllGetClassObjectTypedef)(REFCLSID clsid,
-                                                             REFIID iid,
-                                                             void** ptr);
-  *proxy_module = ::LoadLibrary(hkcu_proxy_dll_path);
-  DllGetClassObjectTypedef fn = NULL;
-  if (!GPA(*proxy_module, "DllGetClassObject", &fn)) {
-    hr = HRESULT_FROM_WIN32(::GetLastError());
-    wprintf(_T("GetProcAddress DllGetClassObject failed [0x%x]\n"), hr);
-    return hr;
-  }
-  CComPtr<IPSFactoryBuffer> fb;
-  CLSID proxy_clsid = StringToGuid(proxy_clsid32_value);
-  hr = (*fn)(proxy_clsid, IID_IPSFactoryBuffer, reinterpret_cast<void**>(&fb));
-  if (FAILED(hr)) {
-    wprintf(_T("DllGetClassObject failed [0x%x]\n"), hr);
-    return hr;
-  }
-
-  // Register the proxy/stub class object.
-  hr = ::CoRegisterClassObject(proxy_clsid, fb, CLSCTX_INPROC_SERVER,
-                               REGCLS_MULTIPLEUSE, revoke_cookie);
-  if (FAILED(hr)) {
-    wprintf(_T("CoRegisterClassObject failed [0x%x]\n"), hr);
-    return hr;
-  }
-
-  // Relate the interface with the proxy/stub, so COM does not do a lookup when
-  // unmarshaling the interface.
-  hr = ::CoRegisterPSClsid(iid, proxy_clsid);
-  if (FAILED(hr)) {
-    wprintf(_T("CoRegisterPSClsid failed [0x%x]\n"), hr);
-    return hr;
-  }
-
-  return S_OK;
-}
-
-// A helper class for clients of the Omaha on-demand out-of-proc COM server.
-// An instance of this class is typically created on the stack. The class does
-// nothing for cases where the OS is not Vista RTM with UAC off.
-// This class does the following:
-// * Calls CoInitializeSecurity with cloaking set to dynamic. This makes COM
-//   use the thread token instead of the process token.
-// * Impersonates and sets the thread token to medium integrity. This allows for
-//   out-of-proc HKCU COM server activation.
-// * Reads and registers per-user proxies for the interfaces that on-demand
-//   exposes.
-class VistaProxyRegistrar {
- public:
-  VistaProxyRegistrar()
-      : googleupdate_cookie_(0),
-        jobobserver_cookie_(0),
-        progresswndevents_cookie_(0),
-        is_impersonated(false) {
-    HRESULT hr = VistaProxyRegistrarImpl();
-    if (FAILED(hr)) {
-      wprintf(_T("VistaProxyRegistrarImpl failed [0x%x]\n"), hr);
-    }
-  }
-
-  ~VistaProxyRegistrar() {
-    if (googleupdate_cookie_) {
-      VERIFY1(SUCCEEDED(::CoRevokeClassObject(googleupdate_cookie_)));
-    }
-
-    if (jobobserver_cookie_) {
-      VERIFY1(SUCCEEDED(::CoRevokeClassObject(jobobserver_cookie_)));
-    }
-
-    if (progresswndevents_cookie_) {
-      VERIFY1(SUCCEEDED(::CoRevokeClassObject(progresswndevents_cookie_)));
-    }
-
-    if (is_impersonated) {
-      VERIFY1(::RevertToSelf());
-    }
-  }
-
- private:
-  HRESULT VistaProxyRegistrarImpl() {
-    if (!SystemInfo::IsRunningOnVistaRTM() || !::IsUserAnAdmin()) {
-      return S_OK;
-    }
-
-    bool is_split_token = false;
-    HRESULT hr = vista_util::IsUserRunningSplitToken(&is_split_token);
-    if (FAILED(hr)) {
-      return hr;
-    }
-    if (is_split_token) {
-      return S_OK;
-    }
-
-    // Needs to be called very early on in a process.
-    // Turn on dynamic cloaking so COM picks up the impersonated thread token.
-    hr = ::CoInitializeSecurity(
-        NULL,
-        -1,
-        NULL,
-        NULL,
-        RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
-        RPC_C_IMP_LEVEL_IDENTIFY,
-        NULL,
-        EOAC_DYNAMIC_CLOAKING,
-        NULL);
-    if (FAILED(hr)) {
-      wprintf(_T("[CoInitializeSecurity failed][0x%x]"), hr);
-      return hr;
-    }
-
-    is_impersonated = !!::ImpersonateSelf(SecurityImpersonation);
-    if (!is_impersonated) {
-      hr = HRESULT_FROM_WIN32(::GetLastError());
-      wprintf(_T("[main: ImpersonateSelf failed][0x%x]"), hr);
-      return hr;
-    }
-
-    scoped_handle thread_token;
-    if (!::OpenThreadToken(::GetCurrentThread(),
-                           TOKEN_ALL_ACCESS,
-                           false,
-                           address(thread_token))) {
-      hr = HRESULT_FROM_WIN32(::GetLastError());
-      wprintf(_T("[main: OpenThreadToken failed][0x%x]"), hr);
-      return hr;
-    }
-
-    DWORD result = SetTokenIntegrityLevelMedium(get(thread_token));
-    if (result != ERROR_SUCCESS) {
-      wprintf(_T("[main: SetTokenIntegrityLevelMedium failed][0x%x]"), result);
-      return HRESULT_FROM_WIN32(result);
-    }
-
-    hr = RegisterHKCUPSClsid(__uuidof(IGoogleUpdate),
-                             address(googleupdate_library_),
-                             &googleupdate_cookie_);
-    if (FAILED(hr)) {
-      wprintf(_T("RegisterHKCUPSClsid for IGoogleUpdate failed [0x%x]\n"), hr);
-      return hr;
-    }
-
-    hr = RegisterHKCUPSClsid(__uuidof(IJobObserver),
-                             address(jobobserver_library_),
-                             &jobobserver_cookie_);
-    if (FAILED(hr)) {
-      wprintf(_T("RegisterHKCUPSClsid for IJobObserver failed [0x%x]\n"), hr);
-      return hr;
-    }
-
-    hr = RegisterHKCUPSClsid(__uuidof(IProgressWndEvents),
-                             address(progresswndevents_library_),
-                             &progresswndevents_cookie_);
-    if (FAILED(hr)) {
-      wprintf(_T("RegisterHKCUPSClsid for IProgressWndEvents failed [0x%x]\n"),
-              hr);
-      return hr;
-    }
-
-    return S_OK;
-  }
-
- private:
-  scoped_library googleupdate_library_;
-  scoped_library jobobserver_library_;
-  scoped_library progresswndevents_library_;
-
-  DWORD googleupdate_cookie_;
-  DWORD jobobserver_cookie_;
-  DWORD progresswndevents_cookie_;
-  bool is_impersonated;
-};
-
-int DoMain(int argc, TCHAR* argv[]) {
-  CString guid;
-  bool is_machine = false;
-  bool is_update_check_only = false;
-  int timeout = 60;
-  if (!ParseParams(argc, argv, &guid, &is_machine,
-                   &is_update_check_only, &timeout)) {
-    wprintf(_T("Usage: performondemand.exe {GUID} {is_machine: 0|1} ")
-            _T("[is_update_check_only=0] [timeout=60]\n"));
-    return -1;
-  }
-  wprintf(_T("GUID: %s\n"), guid);
-  CComModule module;
-  scoped_co_init com_apt;
-  VistaProxyRegistrar registrar;
-
-  CComObject<JobObserver>* job_observer;
-  HRESULT hr = CComObject<JobObserver>::CreateInstance(&job_observer);
-  if (!SUCCEEDED(hr)) {
-    wprintf(_T("CComObject<JobObserver>::CreateInstance failed [0x%x]\n"), hr);
-    return -1;
-  }
-  CComPtr<IJobObserver> job_holder(job_observer);
-
-  CComPtr<IGoogleUpdate> on_demand;
-  if (is_machine && !is_update_check_only) {
-    hr = System::CoCreateInstanceAsAdmin(NULL,
-                                         __uuidof(OnDemandMachineAppsClass),
-                                         __uuidof(on_demand),
-                                         reinterpret_cast<void**>(&on_demand));
-  } else {
-    hr = on_demand.CoCreateInstance(is_machine ?
-                                    __uuidof(OnDemandMachineAppsClass) :
-                                    __uuidof(OnDemandUserAppsClass));
-  }
-
-  if (!SUCCEEDED(hr)) {
-    wprintf(_T("Could not create COM instance [0x%x]\n"), hr);
-    return -1;
-  }
-
-  if (is_update_check_only) {
-    hr = on_demand->CheckForUpdate(guid, job_observer);
-  } else {
-    hr = on_demand->Update(guid, job_observer);
-  }
-
-  if (!SUCCEEDED(hr)) {
-    wprintf(_T("on_demand->%sUpdate failed [0x%x]\n"),
-            is_update_check_only ? _T("CheckFor") : _T(""), hr);
-    return -1;
-  }
-
-  // Main message loop:
-  MSG msg;
-  SYSTEMTIME start_system_time = {0};
-  SYSTEMTIME current_system_time = {0};
-  ::GetSystemTime(&start_system_time);
-  CTime start_time(start_system_time);
-  CTimeSpan timeout_period(0, 0, 0, timeout);
-
-  while (::GetMessage(&msg, NULL, 0, 0)) {
-    ::TranslateMessage(&msg);
-    ::DispatchMessage(&msg);
-    ::GetSystemTime(&current_system_time);
-    CTime current_time(current_system_time);
-    CTimeSpan elapsed_time = current_time - start_time;
-    if (timeout_period < elapsed_time) {
-      wprintf(_T("Timed out.\n"));
-      // TODO(omaha): Right now the timeout does correctly break, but then
-      // the COM interactions continue on to completion.
-      break;
-    }
-  }
-  int ret_val = job_observer->observed;
-
-  return ret_val;
-}
-
-}  // namespace omaha
-
-int _tmain(int argc, TCHAR* argv[]) {
-  return omaha::DoMain(argc, argv);
-}
-
diff --git a/tools/performondemand/performondemand.h b/tools/performondemand/performondemand.h
deleted file mode 100644
index 595d83f..0000000
--- a/tools/performondemand/performondemand.h
+++ /dev/null
@@ -1,189 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#ifndef OMAHA_TOOLS_SRC_PERFORMONDEMAND_PERFORMONDEMAND_H_
-#define OMAHA_TOOLS_SRC_PERFORMONDEMAND_PERFORMONDEMAND_H_
-
-#pragma once
-#include <windows.h>
-#include <atlbase.h>
-#include <atlcom.h>
-#include "goopdate\google_update_idl.h"  // NOLINT
-
-// Keep this list syncronized with qa\client\lib\on_demand_lib.py
-#define ON_COMPLETE_SUCCESS                           0x00000001
-#define ON_COMPLETE_SUCCESS_CLOSE_UI                  0x00000002
-#define ON_COMPLETE_ERROR                             0x00000004
-#define ON_COMPLETE_RESTART_ALL_BROWSERS              0x00000008
-#define ON_COMPLETE_REBOOT                            0x00000010
-#define ON_SHOW                                       0x00000020
-#define ON_CHECKING_FOR_UPDATES                       0x00000040
-#define ON_UPDATE_AVAILABLE                           0x00000080
-#define ON_WAITING_TO_DOWNLOAD                        0x00000100
-#define ON_DOWNLOADING                                0x00000200
-#define ON_WAITING_TO_INSTALL                         0x00000400
-#define ON_INSTALLING                                 0x00000800
-#define ON_PAUSE                                      0x00001000
-#define SET_EVENT_SINK                                0x00002000
-#define ON_COMPLETE_RESTART_BROWSER                   0x00004000
-#define ON_COMPLETE_RESTART_ALL_BROWSERS_NOTICE_ONLY  0x00008000
-#define ON_COMPLETE_REBOOT_NOTICE_ONLY                0x00010000
-#define ON_COMPLETE_RESTART_BROWSER_NOTICE_ONLY       0x00020000
-#define ON_COMPLETE_RUN_COMMAND                       0x00040000
-
-class JobObserver
-  : public CComObjectRootEx<CComSingleThreadModel>,
-    public IJobObserver {
- public:
-  BEGIN_COM_MAP(JobObserver)
-    COM_INTERFACE_ENTRY(IJobObserver)
-  END_COM_MAP()
-
-  // Each interaction enables a bit in observed, which is eventually returned as
-  // a return code.
-  int observed;
-
-  // Similar to observed, misbehave_modes_ and close_modes_ take on bits from
-  // the list of all events.  For example, if close_modes_ | ON_DOWNLOADING
-  // is true, then when ON_DOWNLOADING is called, DoClose will be called.
-  int misbehave_modes_;
-  int close_modes_;
-  bool do_closed_called;
-
-  JobObserver()
-    : observed(0), misbehave_modes_(0), close_modes_(0),
-      do_closed_called(false) {
-    wprintf(L"JobObserver\n");
-  }
-  virtual ~JobObserver() {
-    wprintf(L"~JobObserver\n");
-  }
-
-  void Reset() {
-    observed = 0;
-    misbehave_modes_ = 0;
-    close_modes_ = 0;
-    do_closed_called = false;
-  }
-
-  void AddMisbehaveMode(int event_code) {
-    misbehave_modes_ |= event_code;
-  }
-
-  void AddCloseMode(int event_code) {
-    close_modes_ |= event_code;
-  }
-
-  HRESULT HandleEvent(int event_code) {
-    observed |= event_code;
-
-    if ((event_code & close_modes_) && !do_closed_called) {
-      wprintf(L"Calling DoClose()\n");
-      do_closed_called = true;
-      event_sink_->DoClose();
-    }
-
-    if (event_code & misbehave_modes_) {
-      wprintf(L"Misbehaving\n");
-      return E_FAIL;
-    } else {
-      return S_OK;
-    }
-  }
-
-  // JobObserver implementation.
-  STDMETHOD(OnShow)() {
-    wprintf(L"OnShow\n");
-    return HandleEvent(ON_SHOW);
-  }
-  STDMETHOD(OnCheckingForUpdate)() {
-    wprintf(L"OnCheckingForUpdate\n");
-    return HandleEvent(ON_CHECKING_FOR_UPDATES);
-  }
-  STDMETHOD(OnUpdateAvailable)(const TCHAR* version_string) {
-    wprintf(L"OnUpdateAvailable [%s]\n", version_string);
-    return HandleEvent(ON_UPDATE_AVAILABLE);
-  }
-  STDMETHOD(OnWaitingToDownload)() {
-    wprintf(L"OnWaitingToDownload\n");
-    return HandleEvent(ON_WAITING_TO_INSTALL);
-  }
-  STDMETHOD(OnDownloading)(int time_remaining_ms, int pos) {
-    wprintf(L"OnDownloading [%d][%d]\n", time_remaining_ms, pos);
-    return HandleEvent(ON_DOWNLOADING);
-  }
-  STDMETHOD(OnWaitingToInstall)() {
-    wprintf(L"OnWaitingToInstall\n");
-    return HandleEvent(ON_WAITING_TO_INSTALL);
-  }
-  STDMETHOD(OnInstalling)() {
-    wprintf(L"OnInstalling\n");
-    return HandleEvent(ON_INSTALLING);
-  }
-  STDMETHOD(OnPause)() {
-    wprintf(L"OnPause\n");
-    return HandleEvent(ON_PAUSE);
-  }
-  STDMETHOD(OnComplete)(CompletionCodes code, const TCHAR* text) {
-    wprintf(L"OnComplete [%d][%s]\n", code, text);
-    int event_code = 0;
-    switch (code) {
-      case COMPLETION_CODE_SUCCESS:
-        event_code |= ON_COMPLETE_SUCCESS;
-        break;
-      case COMPLETION_CODE_SUCCESS_CLOSE_UI:
-        event_code |= ON_COMPLETE_SUCCESS_CLOSE_UI;
-        break;
-      case COMPLETION_CODE_ERROR:
-        event_code |= ON_COMPLETE_ERROR;
-        break;
-      case COMPLETION_CODE_RESTART_ALL_BROWSERS:
-        event_code |= ON_COMPLETE_RESTART_ALL_BROWSERS;
-        break;
-      case COMPLETION_CODE_REBOOT:
-        event_code |= ON_COMPLETE_REBOOT;
-        break;
-      case COMPLETION_CODE_RESTART_BROWSER:
-        event_code |= ON_COMPLETE_RESTART_BROWSER;
-        break;
-      case COMPLETION_CODE_RESTART_ALL_BROWSERS_NOTICE_ONLY:
-        event_code |= ON_COMPLETE_RESTART_ALL_BROWSERS_NOTICE_ONLY;
-        break;
-      case COMPLETION_CODE_REBOOT_NOTICE_ONLY:
-        event_code |= ON_COMPLETE_REBOOT_NOTICE_ONLY;
-        break;
-      case COMPLETION_CODE_RESTART_BROWSER_NOTICE_ONLY:
-        event_code |= ON_COMPLETE_RESTART_BROWSER_NOTICE_ONLY;
-        break;
-      case COMPLETION_CODE_RUN_COMMAND:
-        event_code |= ON_COMPLETE_RUN_COMMAND;
-        break;
-      default:
-        break;
-    }
-    ::PostThreadMessage(::GetCurrentThreadId(), WM_QUIT, 0, 0);
-    return HandleEvent(event_code);
-  }
-  STDMETHOD(SetEventSink)(IProgressWndEvents* event_sink) {
-    wprintf(L"SetEventSink [%d]\n", event_sink);
-    event_sink_ = event_sink;
-    return HandleEvent(SET_EVENT_SINK);
-  }
-
-  CComPtr<IProgressWndEvents> event_sink_;
-};
-
-#endif  // OMAHA_TOOLS_SRC_PERFORMONDEMAND_PERFORMONDEMAND_H_
diff --git a/tools/proxy_clsid_utils.py b/tools/proxy_clsid_utils.py
deleted file mode 100644
index 827a914..0000000
--- a/tools/proxy_clsid_utils.py
+++ /dev/null
@@ -1,152 +0,0 @@
-#!/usr/bin/python2.4
-#
-# Copyright 2011 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-"""Generates Omaha build file and Omaha customization unit test file."""
-
-import commands
-import os
-
-
-omaha_project_path = os.path.dirname(__file__) + "\\.."
-proxy_clsid_file_name = omaha_project_path + "\\proxy_clsids.txt"
-customization_ut_file_name = (omaha_project_path +
-                              "\\common\\omaha_customization_proxy_clsid.h")
-
-
-def _GetStatusOutput(cmd):
-  """Return (status, output) of executing cmd in a shell."""
-  if os.name == "nt":
-    pipe = os.popen(cmd + " 2>&1", "r")
-    text = pipe.read()
-    sts = pipe.close()
-    if sts is None: sts = 0
-    if text[-1:] == "\n": text = text[:-1]
-    return sts, text
-  else:
-    return commands.getstatusoutput(cmd)
-
-
-def _GenerateGuid():
-  (status, guid) = _GetStatusOutput("uuidgen.exe /c")
-  if status != 0:
-    raise SystemError("Failed to get GUID: %s" % guid)
-  return guid
-
-
-def _GuidToCStructFormat(guid):
-  return ("{0x%s, 0x%s, 0x%s, "
-          "{0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s}}") % (
-              guid[0:8], guid[9:13], guid[14:18],
-              guid[19:21], guid[21:23], guid[24:26], guid[26:28],
-              guid[28:30], guid[30:32], guid[32:34], guid[34:36])
-
-
-def _GenerateProxySconsText(machine_proxy_clsid,
-                            user_proxy_clsid):
-  proxy_clsid_text_format = ("PROXY_CLSID_IS_MACHINE=%s\n"
-                             "PROXY_CLSID_IS_USER=%s\n")
-  return proxy_clsid_text_format % (_GuidToCStructFormat(machine_proxy_clsid),
-                                    _GuidToCStructFormat(user_proxy_clsid))
-
-
-def _GenerateCustomizationUTText(machine_proxy_clsid, user_proxy_clsid):
-  customization_ut_template = (
-      "//\n"
-      "// !!! AUTOGENERATED FILE. DO NOT HAND-EDIT !!!\n"
-      "//\n\n"
-      "namespace omaha {\n\n"
-      "%s\n%s\n}  // namespace omaha\n")
-  customization_ut_machine_proxy_clsid_string = (
-      "// PROXY_CLSID_IS_MACHINE = {%s}\n"
-      "const GUID kProxyClsidIsMachineGuid =\n"
-      "    %s;\n") % (machine_proxy_clsid,
-                      _GuidToCStructFormat(machine_proxy_clsid))
-
-  customization_ut_user_proxy_clsid_string = (
-      "// PROXY_CLSID_IS_USER = {%s}\n"
-      "const GUID kProxyClsidIsUserGuid =\n"
-      "    %s;\n") % (user_proxy_clsid,
-                      _GuidToCStructFormat(user_proxy_clsid))
-
-  return customization_ut_template % (
-      customization_ut_machine_proxy_clsid_string,
-      customization_ut_user_proxy_clsid_string)
-
-
-def _GenerateProxyClsidFile(machine_proxy_clsid,
-                            user_proxy_clsid):
-  proxy_clsid_output = _GenerateProxySconsText(machine_proxy_clsid,
-                                               user_proxy_clsid)
-  f_out = open(proxy_clsid_file_name, "w")
-  f_out.write(proxy_clsid_output)
-  f_out.close()
-
-
-def _GenerateCustomizationUnitTestFile(machine_proxy_clsid,
-                                       user_proxy_clsid):
-  customization_ut_output = _GenerateCustomizationUTText(machine_proxy_clsid,
-                                                         user_proxy_clsid)
-  f_out = open(customization_ut_file_name, "w")
-  f_out.write(customization_ut_output)
-  f_out.close()
-
-
-def _GenerateProxyClsidsFiles():
-  if (os.path.isfile(proxy_clsid_file_name) and
-      os.path.isfile(customization_ut_file_name)):
-    return
-
-  machine_proxy_clsid = _GenerateGuid()
-  user_proxy_clsid = _GenerateGuid()
-
-  _GenerateProxyClsidFile(machine_proxy_clsid, user_proxy_clsid)
-  _GenerateCustomizationUnitTestFile(machine_proxy_clsid,
-                                     user_proxy_clsid)
-
-
-def _GetProxyClsidsFromFile(target_proxy_clsid):
-  proxy_clsid = ""
-  f = open(proxy_clsid_file_name, "r")
-  for line in f:
-    if not line.startswith("#") and target_proxy_clsid in line:
-      proxy_clsid = line[len(target_proxy_clsid):].rstrip()
-      break
-  f.close()
-
-  if not proxy_clsid:
-    raise StandardError("Failed to get auto-generated proxy CLSID")
-
-  return proxy_clsid
-
-
-def GetMachineProxyClsid():
-  """Loads machine proxy CLSID from the generated file."""
-  return _GetProxyClsidsFromFile("PROXY_CLSID_IS_MACHINE=")
-
-
-def GetUserProxyClsid():
-  """Loads user proxy CLSID from the generated file."""
-  return _GetProxyClsidsFromFile("PROXY_CLSID_IS_USER=")
-
-
-def _Main():
-  """Generates proxy_clsids.txt and customization unit test file."""
-  _GenerateProxyClsidsFiles()
-
-
-if __name__ == "__main__":
-  _Main()
diff --git a/tools/resmerge.exe b/tools/resmerge.exe
deleted file mode 100644
index 849b781..0000000
--- a/tools/resmerge.exe
+++ /dev/null
Binary files differ
diff --git a/ui/build.scons b/ui/build.scons
deleted file mode 100644
index dc5d16e..0000000
--- a/ui/build.scons
+++ /dev/null
@@ -1,72 +0,0 @@
-# Copyright 2008-2010 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ========================================================================
-
-Import('env')
-
-local_env = env.Clone()
-
-inputs = [
-    'complete_wnd.cc',
-    'yes_no_dialog.cc',
-    'progress_wnd.cc',
-    'splash_screen.cc',
-    'ui.cc',
-    'ui_displayed_event.cc',
-    'ui_metrics.cc',
-
-    'uilib/node_state.cc',
-    'uilib/static_ex.cc',
-    'uilib/static_line.cc',
-    ]
-
-# Need to look in output dir to find .h files generated by midl compiler.
-# This also allows Hammer to understand dependencies between this subdir
-# and the .idl files in the goopdate folder.
-local_env['CPPPATH'] += ['$OBJ_ROOT']
-
-
-# Build these into a static library.
-local_env.ComponentStaticLibrary('ui', inputs)
-
-ui_test_env = env.Clone()
-ui_test_env.Append(
-    CPPPATH = [
-        # Need to look in output dir to find .h files generated by midl compiler.
-        # This also allows Hammer to understand dependencies between this subdir
-        # and the .idl files in the goopdate folder.
-        '$OBJ_ROOT',
-        ],
-)
-
-ui_test_env.OmahaUnittest(
-    name='omaha_ui_unittest',
-    source=[
-        'splash_screen_test.cc',
-        'progress_wnd_unittest.cc',
-        'yes_no_dialog_unittest.cc',
-    ],
-    LIBS=[
-        '$LIB_DIR/client.lib',
-        '$LIB_DIR/common.lib',       # Required by client.
-        '$LIB_DIR/goopdate_lib.lib', # Required by splashscreen UT.
-        '$LIB_DIR/logging.lib',      # Required by statsreport.
-        '$LIB_DIR/omaha3_idl.lib',
-        '$LIB_DIR/statsreport.lib',  # Required by client.
-        '$LIB_DIR/ui.lib',
-    ],
-    all_in_one=False,
-    COMPONENT_TEST_SIZE='small',
-    is_small_tests_using_resources=True,
-)
diff --git a/ui/complete_wnd.cc b/ui/complete_wnd.cc
deleted file mode 100644
index 724e31e..0000000
--- a/ui/complete_wnd.cc
+++ /dev/null
@@ -1,224 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/ui/complete_wnd.h"
-#include "omaha/base/const_addresses.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/safe_format.h"
-#include "omaha/base/omaha_version.h"
-#include "omaha/base/vistautil.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/ui/ui_metrics.h"
-
-namespace omaha {
-
-CompleteWnd::CompleteWnd(CMessageLoop* message_loop, HWND parent)
-    : OmahaWnd(IDD_PROGRESS, message_loop, parent),
-      events_sink_(NULL),
-      control_classes_(ICC_STANDARD_CLASSES) {
-  CORE_LOG(L3, (_T("[CompleteWnd::CompleteWnd]")));
-}
-
-// dialog_id specifies the dialog resource to use.
-// control_classes specifies the control classes required for dialog_id.
-CompleteWnd::CompleteWnd(int dialog_id,
-                         DWORD control_classes,
-                         CMessageLoop* message_loop,
-                         HWND parent)
-    : OmahaWnd(dialog_id, message_loop, parent),
-      events_sink_(NULL),
-      control_classes_(control_classes | ICC_STANDARD_CLASSES) {
-  CORE_LOG(L3, (_T("[CompleteWnd::CompleteWnd]")));
-}
-
-HRESULT CompleteWnd::Initialize() {
-  CORE_LOG(L3, (_T("[CompleteWnd::Initialize]")));
-
-  HRESULT hr = InitializeCommonControls(control_classes_);
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  return OmahaWnd::Initialize();
-}
-
-void CompleteWnd::SetEventSink(CompleteWndEvents* ev) {
-  events_sink_ = ev;
-  OmahaWnd::SetEventSink(events_sink_);
-}
-
-LRESULT CompleteWnd::OnInitDialog(UINT message,
-                                  WPARAM w_param,
-                                  LPARAM l_param,
-                                  BOOL& handled) {  // NOLINT
-  CORE_LOG(L3, (_T("[CompleteWnd::OnInitDialog]")));
-  UNREFERENCED_PARAMETER(message);
-  UNREFERENCED_PARAMETER(w_param);
-  UNREFERENCED_PARAMETER(l_param);
-  handled = true;
-
-  InitializeDialog();
-
-  SetControlAttributes(IDC_COMPLETE_TEXT, kDisabledNonButtonAttributes);
-  SetControlAttributes(IDC_ERROR_TEXT, kDisabledNonButtonAttributes);
-  SetControlAttributes(IDC_IMAGE, kDisabledNonButtonAttributes);
-  SetControlAttributes(IDC_GET_HELP_TEXT, kDisabledNonButtonAttributes);
-  SetControlAttributes(IDC_CLOSE, kDefaultActiveButtonAttributes);
-
-  return 1;  // Let the system set the focus.
-}
-
-LRESULT CompleteWnd::OnClickedButton(WORD notify_code,
-                                     WORD id,
-                                     HWND wnd_ctl,
-                                     BOOL& handled) {  // NOLINT
-  CORE_LOG(L3, (_T("[CompleteWnd::OnClickedButton]")));
-  UNREFERENCED_PARAMETER(id);
-  UNREFERENCED_PARAMETER(notify_code);
-  UNREFERENCED_PARAMETER(wnd_ctl);
-  ASSERT1(id == IDC_CLOSE);
-  ASSERT1(is_complete());
-  handled = true;
-
-  VERIFY1(SUCCEEDED(CloseWindow()));
-
-  return 0;
-}
-
-LRESULT CompleteWnd::OnUrlClicked(int, LPNMHDR params, BOOL& handled) {  // NOLINT
-  CORE_LOG(L3, (_T("[CompleteWnd::OnUrlClicked]")));
-  ASSERT1(params);
-
-  if (IDC_GET_HELP_TEXT == params->idFrom) {
-    ++metric_worker_ui_get_help_click;
-  }
-
-  NMSTATICEX* notification = reinterpret_cast<NMSTATICEX*>(params);
-  ASSERT1(events_sink_);
-  if (events_sink_) {
-    bool is_launched = events_sink_->DoLaunchBrowser(notification->action);
-    // Assert that the launch succeeded because this code should not be called
-    // if the launch mechanism (i.e. IProcessLauncher when running elevated) is
-    // not in place. This could also fail if the default browser has been
-    // uninstalled, but that is unlikely.
-    ASSERT1(is_launched);
-    // TODO(omaha): Consider doing something if the browser launch failed.
-    // Could display a message in English saying it failed for some reason,
-    // please CTRL-C this dialog, get the URL and paste it into a browser.
-  }
-
-  handled = true;
-  return 1;
-}
-
-bool CompleteWnd::MaybeCloseWindow() {
-  VERIFY1(SUCCEEDED(CloseWindow()));
-  return true;
-}
-
-void CompleteWnd::DisplayCompletionDialog(bool is_success,
-                                          const CString& text,
-                                          const CString& help_url) {
-  CORE_LOG(L3, (_T("[CompleteWnd::DisplayCompletionDialog]")
-                _T("[success=%d][text=%s]"), is_success, text));
-  ASSERT1(!text.IsEmpty());
-
-  // FormatMessage() converts all LFs to CRLFs, which display as boxes in UI.
-  // We have also observed some BITS error messages with boxes that may have
-  // been caused by CRLFs.
-  // To avoid boxes, convert all CRLFs to LFs, which result in line breaks.
-  CString display_text = text;
-  display_text.Replace(_T("\r\n"), _T("\n"));
-
-  if (!OmahaWnd::OnComplete()) {
-    return;
-  }
-
-  // It is possible for the OnComplete callback to be called multiple times.
-  // Subclassing the control multiple times results in a crash, therefore
-  // unsubclass the control if the control has been created and subclassed
-  // before.
-  if (complete_text_ != NULL) {
-    // TODO(omaha3): I'm not sure this can happen in the polling model.
-    ASSERT1(false);
-
-    complete_text_->UnsubclassWindow(true);
-    complete_text_.reset(NULL);
-  }
-
-  CString s;
-  if (is_success) {
-    VERIFY1(s.LoadString(IDS_CLOSE));
-    VERIFY1(::SetWindowText(GetDlgItem(IDC_CLOSE), s));
-    complete_text_.reset(new StaticEx);
-    complete_text_->SubclassWindow(GetDlgItem(IDC_COMPLETE_TEXT));
-    VERIFY1(::SetWindowText(GetDlgItem(IDC_COMPLETE_TEXT), text));
-  } else {
-    VERIFY1(s.LoadString(IDS_CLOSE));
-    VERIFY1(::SetWindowText(GetDlgItem(IDC_CLOSE), s));
-    complete_text_.reset(new StaticEx);
-    complete_text_->SubclassWindow(GetDlgItem(IDC_ERROR_TEXT));
-    VERIFY1(::SetWindowText(GetDlgItem(IDC_ERROR_TEXT), display_text));
-    VERIFY1(SUCCEEDED(ShowGetHelpLink(help_url)));
-  }
-
-  VERIFY1(SUCCEEDED(SetControlState(is_success)));
-
-  return;
-}
-
-
-HRESULT CompleteWnd::SetControlState(bool is_success) {
-  SetControlAttributes(is_success ? IDC_COMPLETE_TEXT : IDC_ERROR_TEXT,
-                       kVisibleTextAttributes);
-  if (is_success) {
-    SetControlAttributes(IDC_IMAGE, kVisibleImageAttributes);
-  } else {
-    SetControlAttributes(IDC_GET_HELP_TEXT, kVisibleTextAttributes);
-  }
-  SetControlAttributes(IDC_CLOSE, kDefaultActiveButtonAttributes);
-
-  return S_OK;
-}
-
-// If help_url is empty, no link will be displayed.
-HRESULT CompleteWnd::ShowGetHelpLink(const CString& help_url) {
-  // If there is no event sink, clicking the URL will fail.
-  ASSERT1(events_sink_);
-
-  if (help_url.IsEmpty()) {
-    return S_OK;
-  }
-  ASSERT1(0 == help_url.Find(_T("http://")));
-
-  const TCHAR* const kLinkFormat = _T("<b><a=%s>%s</a></b>");
-  CString display_text;
-  VERIFY1(display_text.LoadString(IDS_GET_HELP_TEXT));
-  CString link_string;
-  SafeCStringFormat(&link_string, kLinkFormat, help_url, display_text);
-
-  get_help_text_.reset(new StaticEx);
-  get_help_text_->SubclassWindow(GetDlgItem(IDC_GET_HELP_TEXT));
-  VERIFY1(::SetWindowText(GetDlgItem(IDC_GET_HELP_TEXT), link_string));
-
-  ++metric_worker_ui_get_help_displayed;
-  return S_OK;
-}
-
-}  // namespace omaha
-
diff --git a/ui/complete_wnd.h b/ui/complete_wnd.h
deleted file mode 100644
index 16b0c5b..0000000
--- a/ui/complete_wnd.h
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_UI_COMPLETE_WND_H_
-#define OMAHA_UI_COMPLETE_WND_H_
-
-#include "base/scoped_ptr.h"
-#include "omaha/ui/ui.h"
-#include "omaha/ui/uilib/static_ex.h"
-
-namespace omaha {
-
-class CompleteWndEvents : public OmahaWndEvents {
- public:
-  // Launches the browser non-privileged and returns whether the browser was
-  // successfully launched.
-  virtual bool DoLaunchBrowser(const CString& url) = 0;
-};
-
-class CompleteWnd : public OmahaWnd {
- public:
-  CompleteWnd(CMessageLoop* message_loop, HWND parent);
-
-  virtual HRESULT Initialize();
-
-  void SetEventSink(CompleteWndEvents* ev);
-
-  void DisplayCompletionDialog(bool is_success,
-                               const CString& text,
-                               const CString& help_url);
-
-  BEGIN_MSG_MAP(ErrorWnd)
-    MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
-    NOTIFY_CODE_HANDLER(NM_STATICEX, OnUrlClicked)
-    COMMAND_HANDLER(IDC_CLOSE, BN_CLICKED, OnClickedButton)
-    CHAIN_MSG_MAP(OmahaWnd)
-  END_MSG_MAP()
-
- protected:
-  // Constructor to override the default dialog resource ID and control classes.
-  CompleteWnd(int dialog_id,
-              DWORD control_classes,
-              CMessageLoop* message_loop,
-              HWND parent);
-
-  // Message and command handlers.
-  LRESULT OnInitDialog(UINT msg,
-                       WPARAM wparam,
-                       LPARAM lparam,
-                       BOOL& handled);  // NOLINT
-  LRESULT OnClickedButton(WORD notify_code,
-                          WORD id,
-                          HWND wnd_ctl,
-                          BOOL& handled);   // NOLINT
-  LRESULT OnUrlClicked(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);   // NOLINT
-
- private:
-  // Handles requests to close the window. Returns true if the window is closed.
-  virtual bool MaybeCloseWindow();
-
-  HRESULT SetControlState(bool is_success);
-
-  HRESULT ShowGetHelpLink(const CString& help_url);
-
-  // Due to a repaint issue in StaticEx we prefer to manage their lifetime
-  // very aggressively so we contain them by reference instead of value.
-  scoped_ptr<StaticEx> complete_text_;
-  scoped_ptr<StaticEx> get_help_text_;
-
-  CompleteWndEvents* events_sink_;
-  const DWORD control_classes_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(CompleteWnd);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_UI_COMPLETE_WND_H_
-
diff --git a/ui/progress_wnd.cc b/ui/progress_wnd.cc
deleted file mode 100644
index 59852cd..0000000
--- a/ui/progress_wnd.cc
+++ /dev/null
@@ -1,840 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/ui/progress_wnd.h"
-#include "base/basictypes.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/system_info.h"
-#include "omaha/base/utils.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/ui/ui_ctls.h"
-#include "omaha/ui/ui_metrics.h"
-
-namespace omaha {
-
-namespace {
-
-// The current UI is only able to show one completion type. If apps in the
-// bundle have different completion type, then we need to decide which
-// one should be shown to the user. The following array lists the types
-// from low priority to high priority. The completion type with highest
-// priority will be shown to the user.
-const CompletionCodes kCompletionCodesActionPriority[] = {
-  COMPLETION_CODE_EXIT_SILENTLY,
-  COMPLETION_CODE_EXIT_SILENTLY_ON_LAUNCH_COMMAND,
-  COMPLETION_CODE_SUCCESS,
-  COMPLETION_CODE_LAUNCH_COMMAND,
-  COMPLETION_CODE_RESTART_BROWSER_NOTICE_ONLY,
-  COMPLETION_CODE_RESTART_ALL_BROWSERS_NOTICE_ONLY,
-  COMPLETION_CODE_RESTART_BROWSER,
-  COMPLETION_CODE_RESTART_ALL_BROWSERS,
-  COMPLETION_CODE_REBOOT_NOTICE_ONLY,
-  COMPLETION_CODE_REBOOT,
-  COMPLETION_CODE_ERROR,
-  COMPLETION_CODE_INSTALL_FINISHED_BEFORE_CANCEL,
-};
-
-// kCompletionCodesActionPriority should have all the values in enumeration
-// CompletionCodes. The enumeration value starts from 1 so the array size
-// should match the last value in the enumeration.
-COMPILE_ASSERT(arraysize(kCompletionCodesActionPriority) ==
-    COMPLETION_CODE_INSTALL_FINISHED_BEFORE_CANCEL,
-    CompletionCodesActionPriority_missing_completion_code);
-
-int GetActionPriority(CompletionCodes code) {
-  for (int i = 0; i < arraysize(kCompletionCodesActionPriority); ++i) {
-    if (kCompletionCodesActionPriority[i] == code) {
-      return i;
-    }
-  }
-
-  ASSERT1(false);
-  return -1;
-}
-
-bool AreAllAppsCanceled(const std::vector<AppCompletionInfo>& apps_info) {
-  for (size_t i = 0; i < apps_info.size(); ++i) {
-    if (!apps_info[i].is_canceled) {
-      return false;
-    }
-  }
-
-  return true;
-}
-
-}   // namespace
-
-InstallStoppedWnd::InstallStoppedWnd(CMessageLoop* message_loop, HWND parent)
-    : message_loop_(message_loop),
-      parent_(parent) {
-  CORE_LOG(L3, (_T("[InstallStoppedWnd::InstallStoppedWnd]")));
-  ASSERT1(message_loop);
-  ASSERT1(::IsWindow(parent));
-}
-
-InstallStoppedWnd::~InstallStoppedWnd() {
-  CORE_LOG(L3, (_T("[InstallStoppedWnd::~InstallStoppedWnd]")));
-  if (IsWindow()) {
-    VERIFY1(SUCCEEDED(CloseWindow()));
-  }
-}
-
-// Enables the parent window and destroys this window.
-// Enabling the parent window before destroying this one causes the parent
-// window to get the focus and avoids a visible momentary lack of focus if we
-// instead call SetFocus for the parent after the window is destroyed.
-HRESULT InstallStoppedWnd::CloseWindow() {
-  ASSERT1(IsWindow());
-  VERIFY1(::EnableWindow(parent_, true));
-
-  return DestroyWindow() ? S_OK : HRESULTFromLastError();
-}
-
-// Disables the parent window.
-LRESULT InstallStoppedWnd::OnInitDialog(UINT,
-                                        WPARAM,
-                                        LPARAM,
-                                        BOOL& handled) {    // NOLINT
-  VERIFY1(!::EnableWindow(parent_, false));
-  VERIFY1(message_loop_->AddMessageFilter(this));
-  handled = true;
-  return 1;
-}
-
-// By letting the parent destroy this window, the parent to manage the entire
-// lifetime of this window and avoid creating a synchronization problem by
-// changing the value of IsInstallStoppedWindowPresent() during the middle of
-// one of the parent's methods.
-LRESULT InstallStoppedWnd::OnClickButton(WORD,
-                                         WORD id,
-                                         HWND,
-                                         BOOL& handled) {   // NOLINT
-  CORE_LOG(L3, (_T("[InstallStoppedWnd::OnClickButton]")));
-  ASSERT1(id == IDOK || id == IDCANCEL);
-  VERIFY1(::PostMessage(parent_, WM_INSTALL_STOPPED, id, 0));
-  handled = true;
-  return 0;
-}
-
-LRESULT InstallStoppedWnd::OnDestroy(UINT,
-                                     WPARAM,
-                                     LPARAM,
-                                     BOOL& handled) {  // NOLINT
-  VERIFY1(message_loop_->RemoveMessageFilter(this));
-  handled = true;
-  return 0;
-}
-
-ProgressWnd::ProgressWnd(CMessageLoop* message_loop, HWND parent)
-    : CompleteWnd(IDD_PROGRESS,
-                  ICC_STANDARD_CLASSES | ICC_PROGRESS_CLASS,
-                  message_loop,
-                  parent),
-      cur_state_(STATE_INIT),
-      events_sink_(NULL),
-      is_canceled_(false) {
-  CORE_LOG(L3, (_T("[ProgressWnd::ProgressWnd]")));
-}
-
-ProgressWnd::~ProgressWnd() {
-  CORE_LOG(L3, (_T("[ProgressWnd::~ProgressWnd]")));
-  ASSERT1(!IsWindow());
-  cur_state_ = STATE_END;
-}
-
-void ProgressWnd::SetEventSink(ProgressWndEvents* ev) {
-  events_sink_ = ev;
-  CompleteWnd::SetEventSink(events_sink_);
-}
-
-LRESULT ProgressWnd::OnInitDialog(UINT message,
-                                  WPARAM w_param,
-                                  LPARAM l_param,
-                                  BOOL& handled) {  // NOLINT
-  CORE_LOG(L3, (_T("[ProgressWnd::OnInitDialog]")));
-  UNREFERENCED_PARAMETER(message);
-  UNREFERENCED_PARAMETER(w_param);
-  UNREFERENCED_PARAMETER(l_param);
-  UNREFERENCED_PARAMETER(handled);
-
-  InitializeDialog();
-
-  pause_resume_text_.reset(new StaticEx);
-  pause_resume_text_->SubclassWindow(GetDlgItem(IDC_PAUSE_RESUME_TEXT));
-
-  CString state_text;
-  VERIFY1(state_text.LoadString(IDS_INITIALIZING));
-  VERIFY1(::SetWindowText(GetDlgItem(IDC_INSTALLER_STATE_TEXT), state_text));
-  VERIFY1(SUCCEEDED(SetMarqueeMode(true)));
-  VERIFY1(SUCCEEDED(ChangeControlState()));
-
-  metrics_timer_.reset(new HighresTimer);
-
-  return 1;  // Let the system set the focus.
-}
-
-// If closing is disabled, does not close the window.
-// If in a completion state, the window is closed.
-// Otherwise, the InstallStoppedWnd is displayed and the window is closed only
-// if the user decides to cancel.
-bool ProgressWnd::MaybeCloseWindow() {
-  if (!is_close_enabled()) {
-    return false;
-  }
-
-  if (cur_state_ != STATE_COMPLETE_SUCCESS &&
-      cur_state_ != STATE_COMPLETE_ERROR &&
-      cur_state_ != STATE_COMPLETE_RESTART_BROWSER &&
-      cur_state_ != STATE_COMPLETE_RESTART_ALL_BROWSERS &&
-      cur_state_ != STATE_COMPLETE_REBOOT) {
-    // The UI is not in final state: ask the user to proceed with closing it.
-    // A modal dialog opens and sends a message back to this window to
-    // communicate the user decision.
-    install_stopped_wnd_.reset(new InstallStoppedWnd(message_loop(), *this));
-    HWND hwnd = install_stopped_wnd_->Create(*this);
-    ASSERT1(hwnd);
-    if (hwnd) {
-      CString title;
-      VERIFY1(title.LoadString(IDS_INSTALLATION_STOPPED_WINDOW_TITLE));
-      VERIFY1(install_stopped_wnd_->SetWindowText(title));
-
-      CString button_text;
-      VERIFY1(button_text.LoadString(IDS_RESUME_INSTALLATION));
-      VERIFY1(::SetWindowText(
-          install_stopped_wnd_->GetDlgItem(IDOK), button_text));
-
-      VERIFY1(button_text.LoadString(IDS_CANCEL_INSTALLATION));
-      VERIFY1(::SetWindowText(
-          install_stopped_wnd_->GetDlgItem(IDCANCEL), button_text));
-
-      CString s;
-      s.FormatMessage(IDS_INSTALL_STOPPED, bundle_name());
-      VERIFY1(::SetWindowText(
-          install_stopped_wnd_->GetDlgItem(IDC_INSTALL_STOPPED_TEXT), s));
-
-      VERIFY1(install_stopped_wnd_->CenterWindow(*this));
-      VERIFY1(!install_stopped_wnd_->ShowWindow(SW_SHOWDEFAULT));
-      return false;
-    }
-  }
-
-  VERIFY1(SUCCEEDED(CloseWindow()));
-  return true;
-}
-
-LRESULT ProgressWnd::OnClickedButton(WORD notify_code,
-                                     WORD id,
-                                     HWND wnd_ctl,
-                                     BOOL& handled) {   // NOLINT
-  CORE_LOG(L3, (_T("[ProgressWnd::OnClickedButton]")));
-  ASSERT1(id == IDC_BUTTON1 || id == IDC_BUTTON2 || id == IDC_CLOSE);
-  ASSERT1(events_sink_);
-
-#pragma warning(push)
-// C4061: enumerator 'xxx' in switch of enum 'yyy' is not explicitly handled by
-// a case label.
-#pragma warning(disable : 4061)
-
-  switch (id) {
-    case IDC_BUTTON1:
-      // TODO(omaha): Consider doing something if the callbacks fail.
-      switch (cur_state_) {
-        case STATE_COMPLETE_RESTART_BROWSER:
-          ++metric_worker_ui_restart_browser_now_click;
-          VERIFY1(events_sink_->DoRestartBrowser(false, post_install_urls_));
-          break;
-        case STATE_COMPLETE_RESTART_ALL_BROWSERS:
-          ++metric_worker_ui_restart_all_browsers_now_click;
-          VERIFY1(events_sink_->DoRestartBrowser(true, post_install_urls_));
-          break;
-        case STATE_COMPLETE_REBOOT:
-          ++metric_worker_ui_reboot_now_click;
-          VERIFY1(events_sink_->DoReboot());
-          break;
-        default:
-          ASSERT1(false);
-      }
-      break;
-    case IDC_BUTTON2:
-      switch (cur_state_) {
-        case STATE_COMPLETE_RESTART_BROWSER:
-        case STATE_COMPLETE_RESTART_ALL_BROWSERS:
-        case STATE_COMPLETE_REBOOT:
-          break;
-        default:
-          ASSERT1(false);
-      }
-      break;
-    case IDC_CLOSE:
-      switch (cur_state_) {
-        case STATE_COMPLETE_SUCCESS:
-        case STATE_COMPLETE_ERROR:
-          return CompleteWnd::OnClickedButton(notify_code,
-                                              id,
-                                              wnd_ctl,
-                                              handled);
-          break;
-        default:
-          ASSERT1(false);
-      }
-      break;
-    default:
-      ASSERT1(false);
-  }
-#pragma warning(pop)
-
-  // TODO(omaha3): In closing the Window here, we assume that none of the above
-  // code does anything that might delay the UI response. This should be true
-  // since we won't actually be restarting browsers, etc. from the UI.
-  handled = true;
-  VERIFY1(SUCCEEDED(CloseWindow()));
-
-  return 0;
-}
-
-LRESULT ProgressWnd::OnInstallStopped(UINT msg,
-                                      WPARAM wparam,
-                                      LPARAM,
-                                      BOOL& handled) {  // NOLINT
-  CORE_LOG(L3, (_T("[ProgressWnd::OnInstallStopped]")));
-  UNREFERENCED_PARAMETER(msg);
-
-  install_stopped_wnd_.reset();
-
-  ASSERT1(msg == WM_INSTALL_STOPPED);
-  ASSERT1(wparam == IDOK || wparam == IDCANCEL);
-  // TODO(omaha): Swap the meaning of IDOK and IDCANCEL. IDCANCEL gets passed
-  // when the user hits the esc key. Successive esc presses result in the window
-  // disappearing. Instead, we would like the default (set in the .rc files) and
-  // esc key option to both resume. Changing this requires swapping all uses
-  // in this file as well as in the IDD_INSTALL_STOPPED definition.
-  // Maybe use different constants internally too since these values are used
-  // by different classes and ProgressWnd should not need to know how
-  // InstallStoppedWnd is implemented.
-  // It's possible this will also fix arrow key problem (http://b/1338787).
-  switch (wparam) {
-    case IDOK:
-      // TODO(omaha): Implement "Resume" here.
-      break;
-    case IDCANCEL:
-      HandleCancelRequest();
-      break;
-    default:
-      ASSERT1(false);
-      break;
-  }
-
-  handled = true;
-  return 0;
-}
-
-void ProgressWnd::HandleCancelRequest() {
-  CString s;
-  VERIFY1(s.LoadString(IDS_CANCELING));
-  VERIFY1(::SetWindowText(GetDlgItem(IDC_INSTALLER_STATE_TEXT), s));
-
-  if (is_canceled_) {
-    return;
-  }
-  is_canceled_ = true;
-
-  // The user has decided to cancel.
-  metric_worker_ui_cancel_ms.AddSample(metrics_timer_->GetElapsedMs());
-  ++metric_worker_ui_cancels;
-
-  if (events_sink_) {
-    events_sink_->DoCancel();
-  }
-}
-
-void ProgressWnd::OnCheckingForUpdate() {
-  CORE_LOG(L3, (_T("[ProgressWnd::OnCheckingForUpdate]")));
-  ASSERT1(thread_id() == ::GetCurrentThreadId());
-  if (!IsWindow()) {
-    return;
-  }
-
-  cur_state_ = STATE_CHECKING_FOR_UPDATE;
-
-  CString s;
-  VERIFY1(s.LoadString(IDS_WAITING_TO_CONNECT));
-  VERIFY1(::SetWindowText(GetDlgItem(IDC_INSTALLER_STATE_TEXT), s));
-
-  VERIFY1(SUCCEEDED(SetMarqueeMode(true)));
-  VERIFY1(SUCCEEDED(ChangeControlState()));
-}
-
-void ProgressWnd::OnUpdateAvailable(const CString& app_name,
-                                    const CString& version_string) {
-  CORE_LOG(L3, (_T("[ProgressWnd::OnUpdateAvailable][%s][%s]"),
-                app_name, version_string));
-  UNREFERENCED_PARAMETER(app_name);
-  UNREFERENCED_PARAMETER(version_string);
-
-  ASSERT1(thread_id() == ::GetCurrentThreadId());
-  if (!IsWindow()) {
-    return;
-  }
-}
-
-void ProgressWnd::OnWaitingToDownload(const CString& app_name) {
-  CORE_LOG(L3, (_T("[ProgressWnd::OnWaitingToDownload][%s]"), app_name));
-  ASSERT1(thread_id() == ::GetCurrentThreadId());
-  if (!IsWindow()) {
-    return;
-  }
-
-  cur_state_ = STATE_WAITING_TO_DOWNLOAD;
-
-  CString s;
-  s.FormatMessage(IDS_WAITING_TO_DOWNLOAD, app_name);
-  VERIFY1(::SetWindowText(GetDlgItem(IDC_INSTALLER_STATE_TEXT), s));
-
-  VERIFY1(SUCCEEDED(SetMarqueeMode(true)));
-  VERIFY1(SUCCEEDED(ChangeControlState()));
-}
-
-// May be called repeatedly during download.
-void ProgressWnd::OnDownloading(const CString& app_name,
-                                int time_remaining_ms,
-                                int pos) {
-  CORE_LOG(L5, (_T("[ProgressWnd::OnDownloading][%s][remaining ms=%d][pos=%d]"),
-                app_name, time_remaining_ms, pos));
-  ASSERT1(thread_id() == ::GetCurrentThreadId());
-  if (!IsWindow()) {
-    return;
-  }
-
-  ASSERT1(0 <= pos && pos <= 100);
-
-  cur_state_ = STATE_DOWNLOADING;
-
-// This resource is not included in the resource files since it's not used.
-#if 0
-    VERIFY1(s.LoadString(IDS_PAUSE));
-    VERIFY1(::SetWindowText(GetDlgItem(IDC_PAUSE_RESUME_TEXT), s));
-#endif
-
-  CString s;
-
-  int time_remaining_sec = CeilingDivide(time_remaining_ms, kMsPerSec);
-  if (time_remaining_ms < 0) {
-    s.FormatMessage(IDS_WAITING_TO_DOWNLOAD, app_name);
-  } else if (time_remaining_ms == 0) {
-    s.FormatMessage(IDS_DOWNLOADING_COMPLETED, app_name);
-  } else if (time_remaining_sec < kSecPerMin) {
-    // Less than one minute remaining.
-    s.FormatMessage(IDS_DOWNLOADING_SHORT, app_name, time_remaining_sec);
-  } else if (time_remaining_sec < kSecondsPerHour) {
-    // Less than one hour remaining.
-    int time_remaining_minute = CeilingDivide(time_remaining_sec, kSecPerMin);
-    s.FormatMessage(IDS_DOWNLOADING_LONG, app_name, time_remaining_minute);
-  } else {
-    int time_remaining_hour = CeilingDivide(time_remaining_sec,
-                                            kSecondsPerHour);
-    s.FormatMessage(IDS_DOWNLOADING_VERY_LONG, app_name, time_remaining_hour);
-  }
-
-  VERIFY1(::SetWindowText(GetDlgItem(IDC_INSTALLER_STATE_TEXT), s));
-  VERIFY1(SUCCEEDED(ChangeControlState()));
-
-  // When the network is connecting keep the marquee moving, otherwise
-  // the user has no indication something is still going on.
-  // TODO(omaha): when resuming an incomplete download this will not work.
-  VERIFY1(SUCCEEDED(SetMarqueeMode(pos == 0)));
-  ::SendMessage(GetDlgItem(IDC_PROGRESS), PBM_SETPOS, pos, 0);
-}
-
-void ProgressWnd::OnWaitingRetryDownload(const CString& app_name,
-                                         time64 next_retry_time) {
-  CORE_LOG(L5, (_T("[ProgressWnd::OnWaitingRetryDownload][%s][retry at:%llu]"),
-                app_name, next_retry_time));
-  ASSERT1(thread_id() == ::GetCurrentThreadId());
-  if (!IsWindow()) {
-    return;
-  }
-
-  time64 now = GetCurrent100NSTime();
-  if (now < next_retry_time) {
-    CString s;
-    int retry_time_in_sec =
-        static_cast<int>(CeilingDivide(next_retry_time - now, kSecsTo100ns));
-    s.FormatMessage(IDS_DOWNLOAD_RETRY, app_name, retry_time_in_sec);
-    VERIFY1(::SetWindowText(GetDlgItem(IDC_INSTALLER_STATE_TEXT), s));
-    VERIFY1(SUCCEEDED(ChangeControlState()));
-  }
-}
-
-void ProgressWnd::OnWaitingToInstall(const CString& app_name,
-                                     bool* can_start_install) {
-  CORE_LOG(L3, (_T("[ProgressWnd::OnWaitingToInstall][%s]"), app_name));
-  ASSERT1(thread_id() == ::GetCurrentThreadId());
-  ASSERT1(can_start_install);
-  if (!IsWindow()) {
-    return;
-  }
-
-  if (STATE_WAITING_TO_INSTALL != cur_state_) {
-    cur_state_ = STATE_WAITING_TO_INSTALL;
-
-    CString s;
-    s.FormatMessage(IDS_WAITING_TO_INSTALL, app_name);
-    VERIFY1(::SetWindowText(GetDlgItem(IDC_INSTALLER_STATE_TEXT), s));
-
-    VERIFY1(SUCCEEDED(SetMarqueeMode(true)));
-    VERIFY1(SUCCEEDED(ChangeControlState()));
-  }
-
-  // If we want to instead close the window and start install, call
-  // CloseInstallStoppedWindow() and return *can_start_install = true.
-  *can_start_install = !IsInstallStoppedWindowPresent();
-}
-
-// May be called repeatedly during install.
-void ProgressWnd::OnInstalling(const CString& app_name) {
-  CORE_LOG(L5, (_T("[ProgressWnd::OnInstalling][%s]"), app_name));
-  ASSERT1(thread_id() == ::GetCurrentThreadId());
-  if (!IsWindow()) {
-    return;
-  }
-
-  // TODO(omaha3): This can now occur because installs are not gated.
-  // ASSERT1(!IsInstallStoppedWindowPresent());
-
-  if (STATE_INSTALLING != cur_state_) {
-    cur_state_ = STATE_INSTALLING;
-
-    CString s;
-    s.FormatMessage(IDS_INSTALLING, app_name);
-    VERIFY1(::SetWindowText(GetDlgItem(IDC_INSTALLER_STATE_TEXT), s));
-
-    VERIFY1(SUCCEEDED(SetMarqueeMode(true)));
-    VERIFY1(SUCCEEDED(ChangeControlState()));
-  }
-}
-
-// TODO(omaha): Should this message display the app name or bundle name? Is the
-// entire bundle paused?
-void ProgressWnd::OnPause() {
-  CORE_LOG(L3, (_T("[ProgressWnd::OnPause]")));
-  ASSERT(false, (_T("These strings are not in the .rc files.")));
-  ASSERT1(thread_id() == ::GetCurrentThreadId());
-  if (!IsWindow()) {
-    return;
-  }
-
-  cur_state_ = STATE_PAUSED;
-
-// These resources are not included in resource files since they are not used.
-#if 0
-  CString s;
-  s.FormatMessage(IDS_DOWNLOAD_PAUSED, bundle_name());
-  VERIFY1(::SetWindowText(GetDlgItem(IDC_INSTALLER_STATE_TEXT), s));
-
-  VERIFY1(s.LoadString(IDS_RESUME));
-  VERIFY1(::SetWindowText(GetDlgItem(IDC_PAUSE_RESUME_TEXT), s));
-#endif
-
-  // TODO(omaha): implement time left.
-
-  VERIFY1(SUCCEEDED(ChangeControlState()));
-}
-
-void ProgressWnd::DeterminePostInstallUrls(const ObserverCompletionInfo& info) {
-  ASSERT1(post_install_urls_.empty());
-  post_install_urls_.clear();
-
-  for (size_t i = 0; i < info.apps_info.size(); ++i) {
-    const AppCompletionInfo& app_info = info.apps_info[i];
-    if (!app_info.post_install_url.IsEmpty() &&
-        (app_info.completion_code == COMPLETION_CODE_RESTART_ALL_BROWSERS ||
-         app_info.completion_code == COMPLETION_CODE_RESTART_BROWSER)) {
-      post_install_urls_.push_back(app_info.post_install_url);
-    }
-  }
-  ASSERT1(!post_install_urls_.empty());
-}
-
-// TODO(omaha): We can eliminate this function is we have a better UI that can
-// show compeltion status for each app in the bundle.
-//
-// Overall completion code is determined by apps' completion codes and bundle
-// completion code. If bundle installation fails or installation completed after
-// a cancel is attempted, returns bundle completion code.
-// Otherwise the app's completion code that has the greatest priority is
-// returned.
-CompletionCodes ProgressWnd::GetBundleOverallCompletionCode(
-    const ObserverCompletionInfo& info) const {
-  if (info.completion_code == COMPLETION_CODE_ERROR ||
-      info.completion_code == COMPLETION_CODE_INSTALL_FINISHED_BEFORE_CANCEL) {
-    return info.completion_code;
-  }
-
-  ASSERT1(info.completion_code == COMPLETION_CODE_SUCCESS);
-
-  CompletionCodes overall_completion_code =
-      kCompletionCodesActionPriority[0];
-  for (size_t i = 0; i < info.apps_info.size(); ++i) {
-    if (GetActionPriority(overall_completion_code) <
-        GetActionPriority(info.apps_info[i].completion_code)) {
-      overall_completion_code = info.apps_info[i].completion_code;
-    }
-  }
-
-  return overall_completion_code;
-}
-
-// TODO(omaha3): How should we display the restart browser and reboot messages
-// when multiple apps are being installed, some of which may have failed? Should
-// we use the app name or bundle name?
-void ProgressWnd::OnComplete(const ObserverCompletionInfo& observer_info) {
-  CORE_LOG(L3, (_T("[ProgressWnd::OnComplete][%s]"), observer_info.ToString()));
-  ASSERT1(thread_id() == ::GetCurrentThreadId());
-
-  if (!CompleteWnd::OnComplete()) {
-    return;
-  }
-
-  // Close the 'Install Stop' window if it is on the screen.
-  // TODO(omaha3): This had been before all main dialog UI. Make sure looks OK.
-  CloseInstallStoppedWindow();
-
-  // TODO(omaha3): Do we want to avoid launching commands during an interactive
-  // /ua update? If so, we'll need to handle that somehow. Using the observer
-  // handles the silent update and install cases as well as the OnDemand case.
-  bool launch_commands_succeeded = LaunchCmdLines(observer_info);
-
-  CString s;
-  CompletionCodes overall_completion_code =
-      GetBundleOverallCompletionCode(observer_info);
-  CORE_LOG(L3, (_T("[overall completion code: %d]"), overall_completion_code));
-  switch (overall_completion_code) {
-    case COMPLETION_CODE_SUCCESS:
-    case COMPLETION_CODE_LAUNCH_COMMAND:
-    case COMPLETION_CODE_INSTALL_FINISHED_BEFORE_CANCEL:
-      cur_state_ = STATE_COMPLETE_SUCCESS;
-
-      // TODO(omaha): Do not inherit from CompleteWnd once we have the new
-      // bundle-supporting UI. Among other things, calling
-      // DisplayCompletionDialog causes second call to OmahaWnd::OnComplete().
-      CompleteWnd::DisplayCompletionDialog(true,
-                                           observer_info.completion_text,
-                                           observer_info.help_url);
-      break;
-    case COMPLETION_CODE_ERROR:
-      // If all apps are canceled, no need to display any dialog.
-      if (AreAllAppsCanceled(observer_info.apps_info)) {
-        VERIFY1(SUCCEEDED(CloseWindow()));
-        return;
-      } else {
-        cur_state_ = STATE_COMPLETE_ERROR;
-        CompleteWnd::DisplayCompletionDialog(false,
-                                             observer_info.completion_text,
-                                             observer_info.help_url);
-      }
-      break;
-    case COMPLETION_CODE_RESTART_ALL_BROWSERS:
-      cur_state_ = STATE_COMPLETE_RESTART_ALL_BROWSERS;
-      VERIFY1(s.LoadString(IDS_RESTART_NOW));
-      VERIFY1(::SetWindowText(GetDlgItem(IDC_BUTTON1), s));
-      VERIFY1(s.LoadString(IDS_RESTART_LATER));
-      VERIFY1(::SetWindowText(GetDlgItem(IDC_BUTTON2), s));
-      s.FormatMessage(IDS_TEXT_RESTART_ALL_BROWSERS, bundle_name());
-      VERIFY1(::SetWindowText(GetDlgItem(IDC_COMPLETE_TEXT), s));
-      DeterminePostInstallUrls(observer_info);
-      ++metric_worker_ui_restart_all_browsers_buttons_displayed;
-      break;
-    case COMPLETION_CODE_RESTART_BROWSER:
-      cur_state_ = STATE_COMPLETE_RESTART_BROWSER;
-      VERIFY1(s.LoadString(IDS_RESTART_NOW));
-      VERIFY1(::SetWindowText(GetDlgItem(IDC_BUTTON1), s));
-      VERIFY1(s.LoadString(IDS_RESTART_LATER));
-      VERIFY1(::SetWindowText(GetDlgItem(IDC_BUTTON2), s));
-      s.FormatMessage(IDS_TEXT_RESTART_BROWSER, bundle_name());
-      VERIFY1(::SetWindowText(GetDlgItem(IDC_COMPLETE_TEXT), s));
-      DeterminePostInstallUrls(observer_info);
-      ++metric_worker_ui_restart_browser_buttons_displayed;
-      break;
-    case COMPLETION_CODE_REBOOT:
-      ASSERT(false, (_T("The button actions are not implemented.")));
-      cur_state_ = STATE_COMPLETE_REBOOT;
-      VERIFY1(s.LoadString(IDS_RESTART_NOW));
-      VERIFY1(::SetWindowText(GetDlgItem(IDC_BUTTON1), s));
-      VERIFY1(s.LoadString(IDS_RESTART_LATER));
-      VERIFY1(::SetWindowText(GetDlgItem(IDC_BUTTON2), s));
-      s.FormatMessage(IDS_TEXT_RESTART_COMPUTER, bundle_name());
-      VERIFY1(::SetWindowText(GetDlgItem(IDC_COMPLETE_TEXT), s));
-      ++metric_worker_ui_reboot_buttons_displayed;
-      break;
-    // TODO(omaha3): We may be able to eliminate these by having the caller
-    // specify the appropriate success text. That is the only difference from
-    // the COMPLETION_CODE_SUCCESS case. Alternatively, we can make a decision
-    // in this class based on, for example, whether the browser is supported.
-    case COMPLETION_CODE_RESTART_ALL_BROWSERS_NOTICE_ONLY:
-      cur_state_ = STATE_COMPLETE_SUCCESS;
-      s.FormatMessage(IDS_TEXT_RESTART_ALL_BROWSERS, bundle_name());
-      CompleteWnd::DisplayCompletionDialog(true, s, observer_info.help_url);
-      break;
-    case COMPLETION_CODE_REBOOT_NOTICE_ONLY:
-      cur_state_ = STATE_COMPLETE_SUCCESS;
-      s.FormatMessage(IDS_TEXT_RESTART_COMPUTER, bundle_name());
-      CompleteWnd::DisplayCompletionDialog(true, s, observer_info.help_url);
-      break;
-    case COMPLETION_CODE_RESTART_BROWSER_NOTICE_ONLY:
-      cur_state_ = STATE_COMPLETE_SUCCESS;
-      s.FormatMessage(IDS_TEXT_RESTART_BROWSER, bundle_name());
-      CompleteWnd::DisplayCompletionDialog(true, s, observer_info.help_url);
-      break;
-    case COMPLETION_CODE_EXIT_SILENTLY_ON_LAUNCH_COMMAND:
-      cur_state_ = STATE_COMPLETE_SUCCESS;
-      if (launch_commands_succeeded) {
-        VERIFY1(SUCCEEDED(CloseWindow()));
-        return;
-      }
-
-      CompleteWnd::DisplayCompletionDialog(true,
-                                           observer_info.completion_text,
-                                           observer_info.help_url);
-      break;
-    case COMPLETION_CODE_EXIT_SILENTLY:
-      cur_state_ = STATE_COMPLETE_SUCCESS;
-      VERIFY1(SUCCEEDED(CloseWindow()));
-      return;
-    default:
-      ASSERT1(false);
-      break;
-  }
-
-  VERIFY1(SUCCEEDED(ChangeControlState()));
-}
-
-HRESULT ProgressWnd::LaunchCmdLine(const AppCompletionInfo& app_info) {
-  CORE_LOG(L3, (_T("[ProgressWnd::LaunchCmdLine][%s]"),
-                app_info.post_install_launch_command_line));
-  if (app_info.post_install_launch_command_line.IsEmpty()) {
-    return S_OK;
-  }
-
-  if (app_info.completion_code != COMPLETION_CODE_LAUNCH_COMMAND &&
-      app_info.completion_code !=
-          COMPLETION_CODE_EXIT_SILENTLY_ON_LAUNCH_COMMAND) {
-    CORE_LOG(LW, (_T("Launch command line [%s] is not empty but completion ")
-                  _T("code [%d] doesn't require a launch"),
-                  app_info.post_install_launch_command_line.GetString(),
-                  app_info.completion_code));
-    return S_OK;
-  }
-
-  ASSERT1(SUCCEEDED(app_info.error_code));
-  ASSERT1(!app_info.is_noupdate);
-
-  HRESULT hr = goopdate_utils::LaunchCmdLine(
-      is_machine(), app_info.post_install_launch_command_line);
-  if (FAILED(hr)) {
-    CORE_LOG(LE, (_T("[goopdate_utils::LaunchCmdLine failed][0x%x]"), hr));
-    return hr;
-  }
-
-  return S_OK;
-}
-
-bool ProgressWnd::LaunchCmdLines(const ObserverCompletionInfo& info) {
-  bool  result = true;
-
-  CORE_LOG(L3, (_T("[ProgressWnd::LaunchCmdLines]")));
-  for (size_t i = 0; i < info.apps_info.size(); ++i) {
-    const AppCompletionInfo& app_info = info.apps_info[i];
-    if (FAILED(app_info.error_code)) {
-      continue;
-    }
-    result &= SUCCEEDED(LaunchCmdLine(app_info));
-    VERIFY1(result);
-  }
-
-  return result;
-}
-
-HRESULT ProgressWnd::ChangeControlState() {
-  for (size_t i = 0; i != arraysize(ctls_); ++i) {
-    const ControlState& ctl_state = ctls_[i];
-    SetControlAttributes(ctl_state.id_, ctl_state.attr_[cur_state_]);
-  }
-  return S_OK;
-}
-
-HRESULT ProgressWnd::SetMarqueeMode(bool is_marquee) {
-  if (!SystemInfo::IsRunningOnXPOrLater()) {
-    // Marquee is not supported on OSes below XP.
-    return S_OK;
-  }
-
-  HWND progress_bar = GetDlgItem(IDC_PROGRESS);
-  if (!progress_bar) {
-    return GOOPDATE_E_UI_INTERNAL_ERROR;
-  }
-
-  LONG style = ::GetWindowLong(progress_bar, GWL_STYLE);
-  if (!style) {
-    return HRESULTFromLastError();
-  }
-
-  if (is_marquee) {
-    if (style & PBS_MARQUEE) {
-      return S_OK;
-    }
-
-    style |= PBS_MARQUEE;
-    style = ::SetWindowLong(progress_bar, GWL_STYLE, style);
-    if (!style) {
-      return HRESULTFromLastError();
-    }
-
-    bool result = ::SendMessage(progress_bar, PBM_SETMARQUEE,
-                                is_marquee, kMarqueeModeUpdatesMs) != 0;
-    return result ? S_OK : GOOPDATE_E_UI_INTERNAL_ERROR;
-  } else {
-    if (!(style & PBS_MARQUEE)) {
-      return S_OK;
-    }
-
-    style &= ~PBS_MARQUEE;
-    style = ::SetWindowLong(progress_bar, GWL_STYLE, style);
-    if (!style) {
-      return HRESULTFromLastError();
-    }
-    return S_OK;
-  }
-}
-
-bool ProgressWnd::IsInstallStoppedWindowPresent() {
-  return install_stopped_wnd_.get() && install_stopped_wnd_->IsWindow();
-}
-
-bool ProgressWnd::CloseInstallStoppedWindow() {
-  if (IsInstallStoppedWindowPresent()) {
-    VERIFY1(SUCCEEDED(install_stopped_wnd_->CloseWindow()));
-    install_stopped_wnd_.reset();
-    return true;
-  } else {
-    return false;
-  }
-}
-
-}  // namespace omaha
-
diff --git a/ui/progress_wnd.h b/ui/progress_wnd.h
deleted file mode 100644
index 145bc63..0000000
--- a/ui/progress_wnd.h
+++ /dev/null
@@ -1,233 +0,0 @@
-// Copyright 2008-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_UI_PROGRESS_WND_H_
-#define OMAHA_UI_PROGRESS_WND_H_
-
-#include <atlbase.h>
-#include <vector>
-#include "base/scoped_ptr.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/time.h"
-#include "omaha/base/wtl_atlapp_wrapper.h"
-#include "omaha/client/install_progress_observer.h"
-#include "omaha/ui/complete_wnd.h"
-#include "omaha/ui/uilib/static_ex.h"
-
-namespace omaha {
-
-class HighresTimer;
-
-// The message is used to communicate between InstallStoppedWnd and
-// ProgressWnd.
-const DWORD WM_INSTALL_STOPPED = WM_APP;
-
-class ProgressWndEvents : public CompleteWndEvents {
- public:
-  // Restarts the browser(s) and returns whether the browser was successfully
-  // restarted.
-  // If restart_all_browsers is true, all known browsers will be shutdown.
-  // Otherwise only one type of browser will be shutdown. The concrete class
-  // is expected to know which browser to shutdown in that case.
-  // After that, only one type of browser will be restarted with the given URLs.
-  //
-  // Major browsers that support multi-tab differ how to open multiple URLs:
-  // IExplorer (8.0): opens each URL in a separate window.
-  // Firefox (3.6): by default if there is Firefox instance running, the URLs
-  //          will be opened in tabs in the same window. Otherwise each URL will
-  //          have its own window. Since we shutdown browser(s) first, it is
-  //          more likely to result in multiple windows.
-  // Chrome (5.0): opens each URL in a separate tab in the same window.
-  virtual bool DoRestartBrowser(bool restart_all_browsers,
-                                const std::vector<CString>& urls) = 0;
-
-  // Initiates a reboot and returns whether it was iniated successfully.
-  virtual bool DoReboot() = 0;
-
-  // Indicates that current operation is canceled.
-  virtual void DoCancel() = 0;
-};
-
-// Implements the "Installation Stopped" window. InstallStoppedWnd is
-// modal relative to its parent. When InstallStoppedWnd is closed it sends
-// a user message to its parent to notify which button the user has clicked on.
-class InstallStoppedWnd
-    : public CAxDialogImpl<InstallStoppedWnd>,
-      public CMessageFilter {
-  typedef CAxDialogImpl<InstallStoppedWnd> Base;
- public:
-  static const int IDD = IDD_INSTALL_STOPPED;
-
-  InstallStoppedWnd(CMessageLoop* message_loop, HWND parent);
-  ~InstallStoppedWnd();
-
-  // Closes the window, handling transition back to the parent window.
-  HRESULT CloseWindow();
-
-  BOOL PreTranslateMessage(MSG* msg) {
-    return CWindow::IsDialogMessage(msg);
-  }
-
-  BEGIN_MSG_MAP(InstallStoppedWnd)
-    MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
-    MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
-    COMMAND_ID_HANDLER(IDOK, OnClickButton)
-    COMMAND_ID_HANDLER(IDCANCEL, OnClickButton)
-    CHAIN_MSG_MAP(Base)
-  END_MSG_MAP()
-
- private:
-  // Message and command handlers.
-  LRESULT OnInitDialog(UINT msg, WPARAM wparam, LPARAM lparam, BOOL& handled);    // NOLINT
-  LRESULT OnClickButton(WORD notify_code, WORD id, HWND wnd_ctl, BOOL& handled);  // NOLINT
-  LRESULT OnDestroy(UINT msg, WPARAM wparam, LPARAM lparam, BOOL& handled);       // NOLINT
-
-  CMessageLoop* message_loop_;
-  HWND parent_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(InstallStoppedWnd);
-};
-
-
-// Implements the UI progress window.
-class ProgressWnd
-    : public CompleteWnd,
-      public InstallProgressObserver {
- public:
-  ProgressWnd(CMessageLoop* message_loop, HWND parent);
-  virtual ~ProgressWnd();
-
-  void SetEventSink(ProgressWndEvents* ev);
-
-  // InstallProgressObserver methods.
-  // TODO(omaha3): Update this comment.
-  // These methods are called by the job to transition the UI from
-  // one state to another. The methods are always executed by the thread
-  // that created this window.
-  virtual void OnCheckingForUpdate();
-  virtual void OnUpdateAvailable(const CString& app_name,
-                                 const CString& version_string);
-  virtual void OnWaitingToDownload(const CString& app_name);
-  virtual void OnDownloading(const CString& app_name,
-                             int time_remaining_ms,
-                             int pos);
-  virtual void OnWaitingRetryDownload(const CString& app_name,
-                                      time64 next_retry_time);
-  virtual void OnWaitingToInstall(const CString& app_name,
-                                  bool* can_start_install);
-  virtual void OnInstalling(const CString& app_name);
-  virtual void OnPause();
-  virtual void OnComplete(const ObserverCompletionInfo& observer_info);
-
-  BEGIN_MSG_MAP(ProgressWnd)
-    MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
-    MESSAGE_HANDLER(WM_INSTALL_STOPPED, OnInstallStopped)
-    COMMAND_HANDLER(IDC_BUTTON1, BN_CLICKED, OnClickedButton)
-    COMMAND_HANDLER(IDC_BUTTON2, BN_CLICKED, OnClickedButton)
-    COMMAND_HANDLER(IDC_CLOSE,   BN_CLICKED, OnClickedButton)
-    CHAIN_MSG_MAP(CompleteWnd)
-  END_MSG_MAP()
-
- private:
-  // Message and command handlers.
-  LRESULT OnInitDialog(UINT msg, WPARAM wparam, LPARAM lparam, BOOL& handled);  // NOLINT
-  LRESULT OnInstallStopped(UINT msg,
-                           WPARAM wparam,
-                           LPARAM lparam,
-                           BOOL& handled);  // NOLINT
-  LRESULT OnClickedButton(WORD notify_code,
-                          WORD id,
-                          HWND wnd_ctl,
-                          BOOL& handled);   // NOLINT
-
-  // Handles requests to close the window. Returns true if the window is closed.
-  virtual bool MaybeCloseWindow();
-
-  // Helpers.
-  HRESULT LaunchCmdLine(const AppCompletionInfo& app_info);
-  bool LaunchCmdLines(const ObserverCompletionInfo& info);
-  HRESULT ChangeControlState();
-  HRESULT SetMarqueeMode(bool is_marquee);
-
-  bool IsInstallStoppedWindowPresent();
-
-  void HandleCancelRequest();
-
-  // Closes the Installation Stopped window if present. Returns true if closed.
-  bool CloseInstallStoppedWindow();
-
-  void DeterminePostInstallUrls(const ObserverCompletionInfo& info);
-  CompletionCodes GetBundleOverallCompletionCode(
-      const ObserverCompletionInfo& info) const;
-
-  // TODO(omaha3): These states are used to control the UI elements. Otherwise,
-  // we could have just a single "complete" state and track restart/reboot state
-  // separately.
-  // The states are used as indexes in zero-based arrays so they should
-  // start at 0.
-  enum States {
-    STATE_INIT = 0,
-    STATE_CHECKING_FOR_UPDATE,
-    STATE_WAITING_TO_DOWNLOAD,
-    STATE_DOWNLOADING,
-    STATE_WAITING_TO_INSTALL,
-    STATE_INSTALLING,
-    STATE_PAUSED,
-    STATE_COMPLETE_SUCCESS,
-    STATE_COMPLETE_ERROR,
-    // TODO(omaha): Collapse these two into one state. Controls are the same.
-    // Add another variable to remember what to do in this state.
-    STATE_COMPLETE_RESTART_BROWSER,
-    STATE_COMPLETE_RESTART_ALL_BROWSERS,
-    STATE_COMPLETE_REBOOT,
-    STATE_END,
-  };
-
-  scoped_ptr<HighresTimer> metrics_timer_;
-
-  // Due to a repaint issue in StaticEx we prefer to manage their lifetime
-  // very aggressively so we contain them by reference instead of value.
-  scoped_ptr<StaticEx> pause_resume_text_;
-
-  States cur_state_;
-
-  scoped_ptr<InstallStoppedWnd> install_stopped_wnd_;
-
-  ProgressWndEvents* events_sink_;
-  std::vector<CString> post_install_urls_;
-  bool is_canceled_;
-
-#pragma warning(disable : 4510 4610)
-// C4510: default constructor could not be generated
-// C4610: struct can never be instantiated - user defined constructor required
-  struct ControlState {
-    const int id_;
-    const ControlAttributes attr_[ProgressWnd::STATE_END + 1];
-  };
-#pragma warning(default : 4510 4610)
-
-  static const ControlState ctls_[];
-
-  // The speed by which the progress bar moves in marquee mode.
-  static const int kMarqueeModeUpdatesMs = 75;
-
-  friend class UITest;
-  DISALLOW_EVIL_CONSTRUCTORS(ProgressWnd);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_UI_PROGRESS_WND_H_
-
diff --git a/ui/progress_wnd_unittest.cc b/ui/progress_wnd_unittest.cc
deleted file mode 100644
index ed3f1d2..0000000
--- a/ui/progress_wnd_unittest.cc
+++ /dev/null
@@ -1,318 +0,0 @@
-// Copyright 2007-2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// This unit test is driving the UI through its states so that we can
-// visually inspect all the controls are there in their right state and
-// position. To go from state to state, simply close the window on the screen.
-//
-// The unit test is useful for debugging UI states so different tests are
-// enabled/disabled at compile time, depending what needs to be tested.
-
-#include <windows.h>
-#include "omaha/base/utils.h"
-#include "omaha/client/install_progress_observer.h"
-#include "omaha/testing/unit_test.h"
-#include "omaha/ui/ui.h"
-#include "omaha/ui/progress_wnd.h"
-
-namespace omaha {
-
-class UITest : public testing::Test,
-               public ProgressWndEvents,
-               public WaitCallbackInterface {
- protected:
-  UITest() : progress_wnd_(&progress_wnd_message_loop_, NULL) {
-  }
-
-  static void SetUpTestCase() {
-    message_loop_.set_message_handler(&message_handler_);
-    reset(ev_, ::CreateEvent(NULL, false, false, NULL));
-  }
-
-  virtual void SetUp() {
-    ASSERT_TRUE(::ResetEvent(get(ev_)));
-    ASSERT_TRUE(message_loop_.RegisterWaitForSingleObject(get(ev_), this));
-    /*
-    progress_wnd_.SetEventSink(this);
-    progress_wnd_.set_bundle_name(_T("FooBar"));
-    EXPECT_SUCCEEDED(progress_wnd_.Initialize());
-    EXPECT_TRUE(progress_wnd_.CenterWindow(NULL));
-    progress_wnd_.SetVisible(true);
-    */
-  }
-
-  virtual void TearDown() {
-    message_loop_.UnregisterWait(get(ev_));
-  }
-
-  //
-  // ProgressWndEvents
-  //
-  virtual void DoPause() {
-  }
-
-  virtual void DoResume() {
-  }
-
-  virtual void DoClose() {
-    ASSERT_TRUE(::SetEvent(get(ev_)));
-  }
-
-  virtual void DoExit() {
-    ASSERT_TRUE(::SetEvent(get(ev_)));
-  }
-
-  virtual void DoCancel() {
-    ASSERT_TRUE(::SetEvent(get(ev_)));
-  }
-
-  virtual bool DoRestartBrowser(bool restart_all_browsers,
-                                const std::vector<CString>& urls) {
-    UNREFERENCED_PARAMETER(restart_all_browsers);
-    UNREFERENCED_PARAMETER(urls);
-
-    EXPECT_TRUE(::SetEvent(get(ev_)));
-    return true;
-  }
-
-  virtual bool DoReboot() {
-    EXPECT_TRUE(::SetEvent(get(ev_)));
-    return true;
-  }
-
-  virtual bool DoLaunchBrowser(const CString&) {
-    return true;
-  }
-
-  //
-  // WaitCallbackInterface
-  //
-  virtual bool HandleSignaled(HANDLE) {
-    // Makes the message pump stop.
-    return false;
-  }
-
-  void FormatWindowTitle(const TCHAR* text) {
-    CString title;
-    progress_wnd_.GetWindowText(CStrBuf(title, 256), 256);
-    CString new_title;
-    new_title.Format(_T("%s - %s"), title, text);
-    progress_wnd_.SetWindowText(new_title);
-  }
-
-  CompletionCodes GetBundleOverallCompletionCode(
-      const ObserverCompletionInfo& observer_info) {
-    return progress_wnd_.GetBundleOverallCompletionCode(observer_info);
-  }
-
-  static BasicMessageHandler message_handler_;
-  static MessageLoopWithWait message_loop_;
-  ProgressWnd progress_wnd_;
-  CMessageLoop progress_wnd_message_loop_;
-  static scoped_event ev_;
-};
-
-BasicMessageHandler UITest::message_handler_;
-MessageLoopWithWait UITest::message_loop_;
-scoped_event UITest::ev_;
-
-const CompletionCodes kCompletionCodesPriority[] = {
-  COMPLETION_CODE_EXIT_SILENTLY,
-  COMPLETION_CODE_EXIT_SILENTLY_ON_LAUNCH_COMMAND,
-  COMPLETION_CODE_SUCCESS,
-  COMPLETION_CODE_LAUNCH_COMMAND,
-  COMPLETION_CODE_RESTART_BROWSER_NOTICE_ONLY,
-  COMPLETION_CODE_RESTART_ALL_BROWSERS_NOTICE_ONLY,
-  COMPLETION_CODE_RESTART_BROWSER,
-  COMPLETION_CODE_RESTART_ALL_BROWSERS,
-  COMPLETION_CODE_REBOOT_NOTICE_ONLY,
-  COMPLETION_CODE_REBOOT,
-  COMPLETION_CODE_ERROR,
-};
-
-TEST_F(UITest, GetBundleOverallCompletionCode_BundleFailed) {
-  ObserverCompletionInfo observer_info(COMPLETION_CODE_ERROR);
-  AppCompletionInfo app_info;
-
-  for (int i = 0; i < arraysize(kCompletionCodesPriority); ++i) {
-    app_info.completion_code = kCompletionCodesPriority[i];
-    observer_info.apps_info.push_back(app_info);
-  }
-
-  EXPECT_EQ(COMPLETION_CODE_ERROR,
-            GetBundleOverallCompletionCode(observer_info));
-}
-
-TEST_F(UITest, GetBundleOverallCompletionCode_BundleSucceeded) {
-  for (int i = 0; i < arraysize(kCompletionCodesPriority); ++i) {
-    ObserverCompletionInfo observer_info(COMPLETION_CODE_SUCCESS);
-    AppCompletionInfo app_info;
-
-    for (int j = 0; j <= i; ++j) {
-      app_info.completion_code = kCompletionCodesPriority[i];
-      observer_info.apps_info.push_back(app_info);
-    }
-
-    EXPECT_EQ(kCompletionCodesPriority[i],
-              GetBundleOverallCompletionCode(observer_info));
-  }
-}
-
-/*
-TEST_F(UITest, Initialize) {
-  FormatWindowTitle(_T("Initialize"));
-  message_loop_.Process();
-}
-
-TEST_F(UITest, OnWaitingToDownload) {
-  FormatWindowTitle(_T("Waiting to download"));
-  progress_wnd_.OnWaitingToDownload();
-  message_loop_.Process();
-}
-
-TEST_F(UITest, OnDownloading1) {
-  FormatWindowTitle(_T("Downloading"));
-  progress_wnd_.OnDownloading(10000, 0);
-  message_loop_.Process();
-}
-
-TEST_F(UITest, OnDownloading2) {
-  FormatWindowTitle(_T("Downloading"));
-  progress_wnd_.OnDownloading(5000, 50);
-  message_loop_.Process();
-}
-
-TEST_F(UITest, OnDownloading3) {
-  FormatWindowTitle(_T("Downloading"));
-  progress_wnd_.OnDownloading(0, 100);
-  message_loop_.Process();
-}
-
-TEST_F(UITest, OnWaitingToInstall) {
-  FormatWindowTitle(_T("Waiting to install"));
-  progress_wnd_.OnWaitingToInstall();
-  message_loop_.Process();
-}
-
-TEST_F(UITest, OnInstall) {
-  FormatWindowTitle(_T("Installing"));
-  progress_wnd_.OnInstalling();
-  message_loop_.Process();
-}
-
-TEST_F(UITest, OnPause) {
-  FormatWindowTitle(_T("Paused"));
-  progress_wnd_.OnPause();
-  message_loop_.Process();
-}
-
-TEST_F(UITest, OnCompleteSuccess) {
-  FormatWindowTitle(_T("Complete success"));
-  progress_wnd_.OnComplete(
-      COMPLETION_CODE_SUCCESS,
-      _T("Thanks for installing Gears. For more information on using ")
-      _T("Gears visit the ")
-      _T("<a=http://www.google.com/gears/>Gears</a> web site."),
-      0);
-  message_loop_.Process();
-}
-
-TEST_F(UITest, OnCompleteError) {
-  FormatWindowTitle(_T("Complete error"));
-  progress_wnd_.OnComplete(
-      COMPLETION_CODE_ERROR,
-      _T("An error occured while installing Gears: an existing copy of ")
-      _T("Gears is currently running. Please exit the software and ")
-      _T("retry installation. For more information visit the ")
-      _T("<a=http://www.google.com/gears/>Gears</a> web site."),
-      11);
-  message_loop_.Process();
-}
-
-TEST_F(UITest, OnCompleteRestartAllBrowsers) {
-  FormatWindowTitle(_T("Restart browsers"));
-  progress_wnd_.OnComplete(COMPLETION_CODE_RESTART_ALL_BROWSERS, NULL, 0);
-  message_loop_.Process();
-}
-
-TEST_F(UITest, OnCompleteReboot) {
-  FormatWindowTitle(_T("Reboot"));
-  progress_wnd_.OnComplete(COMPLETION_CODE_REBOOT, NULL, 0);
-  message_loop_.Process();
-}
-
-TEST_F(UITest, OnCompleteRestartBrowser) {
-  FormatWindowTitle(_T("Restart browser"));
-  progress_wnd_.OnComplete(COMPLETION_CODE_RESTART_BROWSER, NULL, 0);
-  message_loop_.Process();
-}
-
-TEST_F(UITest, OnCompleteRestartAllBrowsersNoticeOnly) {
-  FormatWindowTitle(_T("Restart browsers"));
-  progress_wnd_.OnComplete(COMPLETION_CODE_RESTART_ALL_BROWSERS_NOTICE_ONLY,
-                           NULL,
-                           0);
-  message_loop_.Process();
-}
-
-TEST_F(UITest, OnCompleteRebootNoticeOnly) {
-  FormatWindowTitle(_T("Reboot"));
-  progress_wnd_.OnComplete(COMPLETION_CODE_REBOOT_NOTICE_ONLY, NULL, 0);
-  message_loop_.Process();
-}
-
-TEST_F(UITest, OnCompleteRestartBrowserNoticeOnly) {
-  FormatWindowTitle(_T("Restart browser"));
-  progress_wnd_.OnComplete(COMPLETION_CODE_RESTART_BROWSER_NOTICE_ONLY,
-                           NULL,
-                           0);
-  message_loop_.Process();
-}
-
-// Test the OnComplete can be called multiple times.
-TEST_F(UITest, OnMultipleCompletes) {
-  FormatWindowTitle(_T("Complete success"));
-  progress_wnd_.OnComplete(
-      COMPLETION_CODE_SUCCESS,
-      _T("Thanks for installing Gears. For more information on using ")
-      _T("Gears visit the ")
-      _T("<a=http://www.google.com/gears/>Gears</a> web site."),
-      0);
-
-  FormatWindowTitle(_T("Complete error"));
-  progress_wnd_.OnComplete(
-      COMPLETION_CODE_ERROR,
-      _T("An error occured while installing Gears: an existing copy of ")
-      _T("Gears is currently running. Please exit the software and ")
-      _T("retry installation. For more information visit the ")
-      _T("<a=http://www.google.com/gears/>Gears</a> web site."),
-      0);
-
-  progress_wnd_.OnComplete(
-      COMPLETION_CODE_ERROR,
-      _T("An error occured while installing Gears: an existing copy of ")
-      _T("Gears is currently running. Please exit the software and ")
-      _T("retry installation. For more information visit the ")
-      _T("<a=http://www.google.com/gears/>Gears</a> web site."),
-      0);
-
-  FormatWindowTitle(_T("Restart browsers"));
-  progress_wnd_.OnComplete(COMPLETION_CODE_RESTART_ALL_BROWSERS, NULL, 0);
-  message_loop_.Process();
-}
-*/
-
-}   // namespace omaha
-
diff --git a/ui/scoped_gdi.h b/ui/scoped_gdi.h
deleted file mode 100644
index bdceeed..0000000
--- a/ui/scoped_gdi.h
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// The scoped_* classes in this file help to make GDI settings easier. The
-// constructors of these classes sets/selects provided new value into the
-// context (HDC) and stores the original value in a class member. The
-// destructors restore the context to its original state by setting the stored
-// value back.
-//
-// Example usage:
-// {
-//   // Selects the font into hdc.
-//   scoped_select_object select_font(hdc, ::GetStockObject(DEFAULT_GUI_FONT));
-//
-//   // Changes the bk mode in hdc.
-//   scoped_set_bk_mode set_bk_mode(hdc, TRANSPARENT);
-//
-//   // Changes the bk color in hdc.
-//   scoped_set_bk_color set_bk_color(hdc, kBackgroundColor);
-//
-//   /* Do painting operations with hdc here */
-//   ...
-//
-// }  // scoped_* goes out of scope, restoring hdc back to its original state.
-//
-
-#ifndef OMAHA_UI_SCOPED_GDI_H_
-#define OMAHA_UI_SCOPED_GDI_H_
-
-#include <wingdi.h>
-#include "omaha/base/scoped_any.h"
-
-namespace omaha {
-
-template<typename C, typename T, class set_policy, class invalid_type>
-class scoped_context_set {
- public:
-  scoped_context_set(C context, T new_value) : context_(context) {
-    original_value_ = set_policy::set(context, new_value);
-  }
-
-  ~scoped_context_set() {
-    invalid_type invalid_value;
-    if (original_value_ != invalid_value) {
-      set_policy::set(context_, original_value_);
-    }
-  }
-
- private:
-  T original_value_;
-  C context_;
-};
-
-template<typename Fn, Fn Pfn>
-class set_function {
- public:
-  template<typename C, typename T>
-  static T set(C context, T value) {
-    return Pfn(context, value);
-  }
-};
-
-typedef set_function<HGDIOBJ (__stdcall *)(HDC hdc, HGDIOBJ gdiobj),  // NOLINT
-    ::SelectObject> select_object;
-typedef set_function<int (__stdcall *)(HDC hdc, int mode),            // NOLINT
-    ::SetBkMode> set_bk_mode;
-typedef set_function<COLORREF (__stdcall *)(HDC hdc, COLORREF mode),  // NOLINT
-    ::SetBkColor> set_bk_color;
-
-typedef value_const<HGDIOBJ, NULL> invalid_gdi_obj_value;
-typedef value_const<int, 0> invalid_bk_mode_value;
-typedef value_const<COLORREF, CLR_INVALID> invalid_bk_color_value;
-
-typedef scoped_context_set<HDC,
-                           HGDIOBJ,
-                           select_object,
-                           invalid_gdi_obj_value> ScopedSelectObject;
-typedef scoped_context_set<HDC,
-                           int,
-                           set_bk_mode,
-                           invalid_bk_mode_value> ScopedSetBkMode;
-typedef scoped_context_set<HDC,
-                           COLORREF,
-                           set_bk_color,
-                           invalid_bk_color_value> ScopedSetBkColor;
-
-}  // namespace omaha
-
-#endif  // OMAHA_UI_SCOPED_GDI_H_
diff --git a/ui/splash_screen.cc b/ui/splash_screen.cc
deleted file mode 100644
index e106857..0000000
--- a/ui/splash_screen.cc
+++ /dev/null
@@ -1,285 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/ui/splash_screen.h"
-#include "base/basictypes.h"
-#include "omaha/base/app_util.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/smart_handle.h"
-#include "omaha/base/utils.h"
-#include "omaha/base/window_utils.h"
-#include "omaha/client/client_utils.h"
-#include "omaha/client/resource.h"
-#include "omaha/common/lang.h"
-#include "omaha/google_update/resource.h"   // For the IDI_APP
-#include "omaha/ui/scoped_gdi.h"
-
-namespace {
-
-const int kClosingTimerID = 1;
-// Frequency that the window changes alpah blending value during fading stage.
-const int kTimerInterval = 100;
-
-// Alpha blending values for the fading effect.
-const int kDefaultAlphaScale = 100;
-const int kAlphaScales[] = { 0, 30, 47, 62, 75, 85, 93, kDefaultAlphaScale };
-
-uint8 AlphaScaleToAlphaValue(int alpha_scale) {
-  ASSERT1(alpha_scale >= 0 && alpha_scale <= 100);
-  return static_cast<uint8>(alpha_scale * 255 / 100);
-}
-
-}  // namespace
-
-namespace omaha {
-
-SplashScreen::SplashScreen(const CString& bundle_name)
-    : IDD(IDD_PROGRESS),
-      alpha_index_(0),
-      timer_created_(false) {
-  CORE_LOG(L3, (_T("[SplashScreen::SplashScreen]")));
-  caption_ = client_utils::GetInstallerDisplayName(bundle_name);
-  text_.FormatMessage(IDS_SPLASH_SCREEN_MESSAGE, caption_);
-
-  SwitchToState(STATE_CREATED);
-}
-
-SplashScreen::~SplashScreen() {
-  CORE_LOG(L3, (_T("[SplashScreen::~SplashScreen]")));
-
-  const int kWaitTimeoutInMillisecond = 60000;
-
-  // Before the object goes out of scope, waits the thread to exit to avoid
-  // it accessing the object after that.
-  if (thread_.Running() && !thread_.WaitTillExit(kWaitTimeoutInMillisecond)) {
-    CORE_LOG(LW, (_T("[SplashScreen: thread failed to exit gracefully]")));
-    return;
-  }
-
-  ASSERT1(state_ == STATE_CREATED || state_ == STATE_CLOSED);
-}
-
-void SplashScreen::Show() {
-  AutoSync get_lock(lock_);
-
-  if (state_ == STATE_CREATED) {
-    thread_.Start(this);
-  } else {
-    ASSERT1(false);
-  }
-}
-
-void SplashScreen::Dismiss() {
-  AutoSync get_lock(lock_);
-
-  switch (state_) {
-    case STATE_CREATED:
-      SwitchToState(STATE_CLOSED);
-      break;
-
-    case STATE_SHOW_NORMAL:
-      SwitchToState(STATE_FADING);
-      break;
-
-    case STATE_CLOSED:
-    case STATE_FADING:
-    case STATE_INITIALIZED:
-      break;
-
-    default:
-      ASSERT1(false);
-      break;
-  }
-}
-
-HRESULT SplashScreen::Initialize() {
-  CORE_LOG(L3, (_T("[SplashScreen::Initialize]")));
-
-  ASSERT1(!IsWindow());
-  ASSERT1(state_ == STATE_CREATED);
-
-  if (!Create(NULL)) {
-    return GOOPDATE_E_UI_INTERNAL_ERROR;
-  }
-
-  VERIFY1(SetWindowText(caption_));
-
-  EnableSystemButtons(false);
-  GetDlgItem(IDC_IMAGE).ShowWindow(SW_HIDE);
-
-  CWindow text_wnd = GetDlgItem(IDC_INSTALLER_STATE_TEXT);
-  text_wnd.ShowWindow(SW_SHOWNORMAL);
-  text_wnd.SetWindowText(text_);
-
-  InitProgressBar();
-
-  ::SetLayeredWindowAttributes(
-      m_hWnd,
-      0,
-      AlphaScaleToAlphaValue(kDefaultAlphaScale),
-      LWA_ALPHA);
-
-  VERIFY1(CenterWindow(NULL));
-  HRESULT hr = WindowUtils::SetWindowIcon(m_hWnd, IDI_APP, address(hicon_));
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[SetWindowIcon failed][0x%08x]"), hr));
-  }
-  SwitchToState(STATE_INITIALIZED);
-  return S_OK;
-}
-
-void SplashScreen::EnableSystemButtons(bool enable) {
-  const LONG kSysStyleMask = WS_MINIMIZEBOX | WS_SYSMENU | WS_MAXIMIZEBOX;
-
-  if (enable) {
-    SetWindowLong(GWL_STYLE, GetWindowLong(GWL_STYLE) | kSysStyleMask);
-  } else {
-    SetWindowLong(GWL_STYLE, GetWindowLong(GWL_STYLE) & ~kSysStyleMask);
-  }
-}
-
-void SplashScreen::InitProgressBar() {
-  const LONG kStyle = WS_CHILD | WS_VISIBLE | PBS_MARQUEE | PBS_SMOOTH;
-
-  CWindow progress_bar = GetDlgItem(IDC_PROGRESS);
-  LONG style = progress_bar.GetWindowLong(GWL_STYLE) | kStyle;
-  progress_bar.SetWindowLong(GWL_STYLE, style);
-  progress_bar.SendMessage(PBM_SETMARQUEE, TRUE, 60);
-}
-
-LRESULT SplashScreen::OnTimer(UINT message,
-                              WPARAM wparam,
-                              LPARAM lparam,
-                              BOOL& handled) {
-  UNREFERENCED_PARAMETER(message);
-  UNREFERENCED_PARAMETER(wparam);
-  UNREFERENCED_PARAMETER(lparam);
-
-  ASSERT1(state_ == STATE_FADING);
-  ASSERT1(alpha_index_ > 0);
-  if (--alpha_index_) {
-    ::SetLayeredWindowAttributes(
-        m_hWnd,
-        0,
-        AlphaScaleToAlphaValue(kAlphaScales[alpha_index_]),
-        LWA_ALPHA);
-  } else {
-    Close();
-  }
-
-  handled = TRUE;
-  return 0;
-}
-
-LRESULT SplashScreen::OnClose(UINT message,
-                              WPARAM wparam,
-                              LPARAM lparam,
-                              BOOL& handled) {
-  UNREFERENCED_PARAMETER(message);
-  UNREFERENCED_PARAMETER(wparam);
-  UNREFERENCED_PARAMETER(lparam);
-
-  DestroyWindow();
-  handled = TRUE;
-  return 0;
-}
-
-LRESULT SplashScreen::OnDestroy(UINT message,
-                                WPARAM wparam,
-                                LPARAM lparam,
-                                BOOL& handled) {
-  UNREFERENCED_PARAMETER(message);
-  UNREFERENCED_PARAMETER(wparam);
-  UNREFERENCED_PARAMETER(lparam);
-
-  if (timer_created_) {
-    ASSERT1(IsWindow());
-    KillTimer(kClosingTimerID);
-  }
-
-  ::PostQuitMessage(0);
-
-  handled = TRUE;
-  return 0;
-}
-
-void SplashScreen::SwitchToState(WindowState new_state) {
-  AutoSync get_lock(lock_);
-
-  state_ = new_state;
-  switch (new_state) {
-    case STATE_CREATED:
-    case STATE_INITIALIZED:
-      break;
-    case STATE_SHOW_NORMAL:
-      alpha_index_ = arraysize(kAlphaScales) - 1;
-      break;
-    case STATE_FADING:
-      ASSERT1(IsWindow());
-      timer_created_ = (SetTimer(kClosingTimerID, kTimerInterval, NULL) != 0);
-      if (!timer_created_) {
-        CORE_LOG(LW,
-                 (_T("[SetTimer failed, closing window directly.][0x%08x]"),
-                  HRESULTFromLastError()));
-        Close();
-      }
-      break;
-    case STATE_CLOSED:
-      break;
-    default:
-      ASSERT1(false);
-      break;
-  }
-}
-
-void SplashScreen::Run() {
-  {
-    AutoSync get_lock(lock_);
-
-    if (state_ != STATE_CREATED) {
-      return;
-    }
-
-    // Initialize() has to be called in this thread so that it is the owner of
-    // the window and window messages can be correctly routed by the message
-    // loop.
-    if (FAILED(Initialize())) {
-      return;
-    }
-
-    ASSERT1(IsWindow());
-    ShowWindow(SW_SHOWNORMAL);
-    SwitchToState(STATE_SHOW_NORMAL);
-  }
-
-  CMessageLoop message_loop;
-  message_loop.Run();
-
-  SwitchToState(STATE_CLOSED);
-}
-
-void SplashScreen::Close() {
-  AutoSync get_lock(lock_);
-
-  if (state_ != STATE_CLOSED && IsWindow()) {
-    PostMessage(WM_CLOSE, 0, 0);
-  }
-}
-
-}  // namespace omaha
diff --git a/ui/splash_screen.h b/ui/splash_screen.h
deleted file mode 100644
index 564d56d..0000000
--- a/ui/splash_screen.h
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_UI_SPLASH_SCREEN_H_
-#define OMAHA_UI_SPLASH_SCREEN_H_
-
-#include "base/scoped_ptr.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/synchronized.h"
-#include "omaha/base/thread.h"
-#include "omaha/base/wtl_atlapp_wrapper.h"
-
-namespace omaha {
-
-// Displays a splash screen while lengthy operations occur. Before the lengthy
-// operation, the caller creates an instance of this class and calls Show()
-// function on it. The Show() function then creates a thread to display the
-// splash screen. The caller must call Dismiss() function to hide and destroy
-// the splash screen once the lengthy operation is done.
-class SplashScreen
-    : public CAxDialogImpl<SplashScreen>,
-      public Runnable {
- public:
-  explicit SplashScreen(const CString& bundle_name);
-
-  // The desctructor waits up to 60 seconds for the message loop thread to exit
-  // if it is running.
-  virtual ~SplashScreen();
-
-  // The dialog resource ID as required by CAxDialogImpl.
-  const int IDD;
-
-  // Spawns a thread which creates and shows the window.
-  void Show();
-
-  // Closes the window gradually if the window is visible.
-  void Dismiss();
-
-  // Runnable interface method.
-  virtual void Run();
-
-  BEGIN_MSG_MAP(SplashScreen)
-    MESSAGE_HANDLER(WM_TIMER, OnTimer)
-    MESSAGE_HANDLER(WM_CLOSE, OnClose)
-    MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
-  END_MSG_MAP()
-
- private:
-  friend class SplashScreenTest;
-
-  // States that help to determine the splash screen life cycle and
-  // allowed operations at each stage.
-  enum WindowState {
-    STATE_CREATED,
-    STATE_INITIALIZED,
-    STATE_SHOW_NORMAL,
-    STATE_FADING,
-    STATE_CLOSED,
-  };
-
-  // Creates the window and adjusts its size and apperance.
-  HRESULT Initialize();
-
-  void InitProgressBar();
-  void EnableSystemButtons(bool enable);
-
-  void SwitchToState(WindowState new_state);
-
-  // Posts a WM_CLOSE message to close the window if the window is valid.
-  void Close();
-
-  // Message and command handlers.
-  LRESULT OnTimer(UINT msg,
-                  WPARAM wparam,
-                  LPARAM lparam,
-                  BOOL& handled);     // NOLINT(runtime/references)
-  LRESULT OnClose(UINT msg,
-                  WPARAM wparam,
-                  LPARAM lparam,
-                  BOOL& handled);     // NOLINT(runtime/references)
-  LRESULT OnDestroy(UINT msg,
-                    WPARAM wparam,
-                    LPARAM lparam,
-                    BOOL& handled);   // NOLINT(runtime/references)
-
-  LLock lock_;    // Lock for access synchronization of this object.
-  Thread thread_;  // Thread that creats the window and runs the message loop.
-  WindowState state_;   // State of the object.
-
-  // Indicates whether timer for fading effect has been created.
-  bool timer_created_;
-
-  int alpha_index_;   // Array index of current alpha blending value.
-
-  CString text_;  // Message text shows on the window.
-  CString caption_;  // Dialog title.
-
-  // Handle to large icon to show when ALT-TAB
-  scoped_hicon hicon_;
-
-  DISALLOW_COPY_AND_ASSIGN(SplashScreen);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_UI_SPLASH_SCREEN_H_
-
diff --git a/ui/splash_screen_test.cc b/ui/splash_screen_test.cc
deleted file mode 100644
index ac1fe39..0000000
--- a/ui/splash_screen_test.cc
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// This unit test is driving the UI through its states so that we can
-// visually inspect all the controls are there in their right state and
-// position. To go from state to state, simply close the window on the screen.
-//
-// The unit test is useful for debugging UI states so different tests are
-// enabled/disabled at compile time, depending what needs to be tested.
-
-#include <windows.h>
-#include "omaha/base/app_util.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/utils.h"
-#include "omaha/goopdate/resource_manager.h"
-#include "omaha/testing/unit_test.h"
-#include "omaha/ui/splash_screen.h"
-
-namespace omaha {
-
-class SplashScreenTest : public testing::Test {
- protected:
-  SplashScreenTest() {}
-
-  static void SetUpTestCase() {
-    CString resource_dir = app_util::GetModuleDirectory(NULL);
-    EXPECT_HRESULT_SUCCEEDED(
-        ResourceManager::Create(false, resource_dir, _T("en")));
-  }
-  static void TearDownTestCase() {
-    ResourceManager::Delete();
-  }
-
-  static void PostCloseMessage(const SplashScreen& splash_screen) {
-    ASSERT_TRUE(splash_screen.IsWindow());
-    ::PostMessage(splash_screen.m_hWnd, WM_CLOSE, 0, 0);
-  }
-};
-
-TEST_F(SplashScreenTest, SplashScreen) {
-  SplashScreen splash_screen(NULL);
-  splash_screen.Show();
-  ::Sleep(200);
-  splash_screen.Dismiss();
-}
-
-TEST_F(SplashScreenTest, SplashScreen_QuickRelease) {
-  SplashScreen splash_screen(_T("Sample bundle"));
-  splash_screen.Show();
-  splash_screen.Dismiss();
-}
-
-TEST_F(SplashScreenTest, SplashScreen_NoShow) {
-  SplashScreen splash_screen(_T("You Should Not See This"));
-}
-
-TEST_F(SplashScreenTest, SplashScreen_PostCloseMessage) {
-  SplashScreen splash_screen(NULL);
-  splash_screen.Show();
-  ::Sleep(100);
-  SplashScreenTest::PostCloseMessage(splash_screen);
-  ::Sleep(100);
-  splash_screen.Dismiss();
-}
-
-}   // namespace omaha
-
diff --git a/ui/ui.cc b/ui/ui.cc
deleted file mode 100644
index b1eb836..0000000
--- a/ui/ui.cc
+++ /dev/null
@@ -1,234 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/ui/ui.h"
-#include "base/basictypes.h"
-#include "omaha/base/constants.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/system_info.h"
-#include "omaha/base/window_utils.h"
-#include "omaha/client/client_utils.h"
-#include "omaha/google_update/resource.h"   // For the IDI_APP
-#include "omaha/ui/ui_displayed_event.h"
-#include "omaha/ui/ui_metrics.h"
-
-namespace omaha {
-
-const OmahaWnd::ControlAttributes OmahaWnd::kVisibleTextAttributes =
-    { true,  true,  false, false };
-const OmahaWnd::ControlAttributes OmahaWnd::kDefaultActiveButtonAttributes =
-    { true,  true,  true,  true  };
-const OmahaWnd::ControlAttributes OmahaWnd::kNonDefaultActiveButtonAttributes =
-    { true,  true,  true,  false };
-const OmahaWnd::ControlAttributes OmahaWnd::kVisibleImageAttributes =
-    { true,  false, false, false };
-const OmahaWnd::ControlAttributes OmahaWnd::kDisabledNonButtonAttributes =
-    { false, false, false, false };
-
-OmahaWnd::OmahaWnd(int dialog_id, CMessageLoop* message_loop, HWND parent)
-    : IDD(dialog_id),
-      message_loop_(message_loop),
-      parent_(parent),
-      thread_id_(::GetCurrentThreadId()),
-      is_complete_(false),
-      is_close_enabled_(true),
-      events_sink_(NULL),
-      is_machine_(false) {
-  ASSERT1(message_loop);
-  CORE_LOG(L3, (_T("[OmahaWnd::OmahaWnd]")));
-}
-
-OmahaWnd::~OmahaWnd() {
-  CORE_LOG(L3, (_T("[OmahaWnd::~OmahaWnd]")));
-  ASSERT1(thread_id_ == ::GetCurrentThreadId());
-  ASSERT1(!IsWindow());
-}
-
-HRESULT OmahaWnd::Initialize() {
-  CORE_LOG(L3, (_T("[OmahaWnd::Initialize]")));
-  ASSERT1(thread_id_ == ::GetCurrentThreadId());
-
-  if (!Create(parent_)) {
-    CORE_LOG(LEVEL_ERROR, (_T("[Failed to create the window]")));
-    return GOOPDATE_E_UI_INTERNAL_ERROR;
-  }
-  VERIFY1(message_loop_->AddMessageFilter(this));
-
-  return S_OK;
-}
-
-void OmahaWnd::InitializeDialog() {    // NOLINT
-  CORE_LOG(L3, (_T("[OmahaWnd::InitializeDialog]")));
-
-  VERIFY1(SetWindowText(client_utils::GetInstallerDisplayName(bundle_name_)));
-
-  VERIFY1(CenterWindow(NULL));
-  VERIFY1(SUCCEEDED(WindowUtils::SetWindowIcon(m_hWnd,
-                                               IDI_APP,
-                                               address(hicon_))));
-}
-
-LRESULT OmahaWnd::OnClose(UINT,
-                          WPARAM,
-                          LPARAM,
-                          BOOL& handled) {         // NOLINT
-  CORE_LOG(L3, (_T("[OmahaWnd::OnClose]")));
-
-  ++metric_worker_ui_click_x;
-
-  MaybeCloseWindow();
-  handled = true;
-  return 0;
-}
-
-HRESULT OmahaWnd::CloseWindow() {
-  HRESULT hr = DestroyWindow() ? S_OK : HRESULTFromLastError();
-  if (events_sink_) {
-    events_sink_->DoClose();
-  }
-  return hr;
-}
-
-void OmahaWnd::MaybeRequestExitProcess() {
-  CORE_LOG(L3, (_T("[OmahaWnd::MaybeRequestExitProcess]")));
-  if (!is_complete_) {
-    return;
-  }
-
-  RequestExitProcess();
-}
-
-void OmahaWnd::RequestExitProcess() {
-  CORE_LOG(L3, (_T("[OmahaWnd::RequestExitProcess]")));
-
-  if (events_sink_) {
-    events_sink_->DoExit();
-  }
-}
-
-LRESULT OmahaWnd::OnNCDestroy(UINT, WPARAM, LPARAM, BOOL& handled) {  // NOLINT
-  CORE_LOG(L3, (_T("[OmahaWnd::OnNCDestroy]")));
-  VERIFY1(message_loop_->RemoveMessageFilter(this));
-  MaybeRequestExitProcess();
-  handled = false;  // Let ATL default processing handle the WM_NCDESTROY.
-  return 0;
-}
-
-// Called when esc key is hit.
-// If close is disabled, does nothing because we don't want the window to close.
-LRESULT OmahaWnd::OnCancel(WORD, WORD id, HWND, BOOL& handled) {  // NOLINT
-  VERIFY1(id == IDCANCEL);
-
-  if (!is_close_enabled_) {
-    return 0;
-  }
-
-  ++metric_worker_ui_esc_key_total;
-  MaybeCloseWindow();
-  handled = true;
-  return 0;
-}
-
-void OmahaWnd::Show() {
-  CORE_LOG(L3, (_T("[OmahaWnd::Show]")));
-  ASSERT1(thread_id_ == ::GetCurrentThreadId());
-  if (!IsWindow() || IsWindowVisible()) {
-    return;
-  }
-
-  CenterWindow(NULL);
-  SetVisible(true);
-
-  if (!::SetForegroundWindow(*this)) {
-    CORE_LOG(LW, (_T("[::SetForegroundWindow failed %d]"), ::GetLastError()));
-  }
-
-  UIDisplayedEventManager::SignalEvent(is_machine_);
-}
-
-bool OmahaWnd::OnComplete() {
-  CORE_LOG(L3, (_T("[OmahaWnd::OnComplete]")));
-  ASSERT1(thread_id_ == ::GetCurrentThreadId());
-
-  if (!IsWindow()) {
-    RequestExitProcess();
-    return false;
-  }
-
-  is_complete_ = true;
-
-  VERIFY1(SUCCEEDED(EnableClose(true)));
-
-  return true;
-}
-
-void OmahaWnd::SetControlAttributes(int control_id,
-                                    const ControlAttributes& attributes) {
-  HWND hwnd = GetDlgItem(control_id);
-  ASSERT1(hwnd);
-  ::ShowWindow(hwnd, attributes.is_visible_ ? SW_SHOW : SW_HIDE);
-  ::EnableWindow(hwnd, attributes.is_enabled_ ? true : false);
-  if (attributes.is_button_ && attributes.is_default_) {
-    // We ask the dialog manager to give the default push button the focus, so
-    // for instance the <Enter> key works as expected.
-    GotoDlgCtrl(hwnd);
-    LONG style = ::GetWindowLong(hwnd, GWL_STYLE);
-    if (style) {
-      style |= BS_DEFPUSHBUTTON;
-      ::SetWindowLong(hwnd, GWL_STYLE, style);
-    }
-  }
-}
-
-HRESULT OmahaWnd::EnableClose(bool enable) {
-  is_close_enabled_ = enable;
-  return EnableSystemCloseButton(is_close_enabled_);
-}
-
-HRESULT OmahaWnd::EnableSystemCloseButton(bool enable) {
-  HMENU menu = ::GetSystemMenu(*this, false);
-  ASSERT1(menu);
-  uint32 flags = MF_BYCOMMAND;
-  flags |= enable ? MF_ENABLED : MF_GRAYED;
-  VERIFY1(::EnableMenuItem(menu, SC_CLOSE, flags) != -1);
-  return S_OK;
-}
-
-// For the InitCommonControlsEx call to succeed on XP, a manifest is needed to
-// declare "Microsoft.Windows.Common-Controls" as a dependent assembly.
-// Further work may be needed to ensure W2K compatibility.
-HRESULT InitializeCommonControls(DWORD control_classes) {
-  INITCOMMONCONTROLSEX init_ctrls = { sizeof(INITCOMMONCONTROLSEX), 0 };
-  ASSERT1(init_ctrls.dwSize == sizeof(init_ctrls));
-  init_ctrls.dwICC = control_classes;
-  if (!::InitCommonControlsEx(&init_ctrls)) {
-    // In the case of XP RTM and XP SP1, InitCommonControlsEx is failing but
-    // the UI initializes fine and works correctly. Because of this we only log
-    // the failure and do not error out.
-    const DWORD error = ::GetLastError();
-    CORE_LOG(LEVEL_ERROR, (_T("[InitCommonControlsEx failed][%u]"), error));
-    ASSERT1(ERROR_CLASS_ALREADY_EXISTS == error);
-    if (ERROR_CLASS_ALREADY_EXISTS != error) {
-      return HRESULT_FROM_WIN32(error);
-    }
-  }
-
-  return S_OK;
-}
-
-}  // namespace omaha
diff --git a/ui/ui.h b/ui/ui.h
deleted file mode 100644
index 68eedbf..0000000
--- a/ui/ui.h
+++ /dev/null
@@ -1,166 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_UI_UI_H_
-#define OMAHA_UI_UI_H_
-
-#include <atlbase.h>
-#include <atlstr.h>
-#include <vector>
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/wtl_atlapp_wrapper.h"
-// TODO(omaha3): Depending on how separate the UI is, we may want to separate
-// the UI-specific resources, especially the dialogs. Can we handle bidi
-// independent of languages? This would allow simple replacement of Omaha's
-// UI without impacting the core or error messages.
-#include "omaha/client/resource.h"
-
-namespace omaha {
-
-class HighresTimer;
-
-class OmahaWndEvents {
- public:
-  virtual ~OmahaWndEvents() {}
-  virtual void DoClose() = 0;
-  virtual void DoExit() = 0;
-};
-
-// Implements the UI progress window.
-class OmahaWnd
-    : public CAxDialogImpl<OmahaWnd>,
-      public CMessageFilter {
-  typedef CAxDialogImpl<OmahaWnd> Base;
- public:
-  virtual ~OmahaWnd();
-
-  // The dialog resource ID as required by CAxDialogImpl.
-  const int IDD;
-
-  virtual HRESULT Initialize();
-
-  // CMessageFilter interface method.
-  BOOL PreTranslateMessage(MSG* msg) {
-    return CWindow::IsDialogMessage(msg);
-  }
-
-  void SetEventSink(OmahaWndEvents* ev) { events_sink_ = ev; }
-
-  // TODO(omaha3): Move these to constructor. They are fundamental to the UI.
-  // TODO(omaha3): Move is_machine_ to CompleteWnd if we do not use UI displayed
-  // events. There it will be used to create the URL if we do not move that too.
-  void set_is_machine(bool is_machine) { is_machine_ = is_machine; }
-  void set_bundle_name(const CString& name) { bundle_name_ = name; }
-
-  virtual void Show();
-
-  BEGIN_MSG_MAP(OmahaWnd)
-    MESSAGE_HANDLER(WM_CLOSE, OnClose)
-    MESSAGE_HANDLER(WM_NCDESTROY, OnNCDestroy)
-    COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
-    CHAIN_MSG_MAP(Base)
-  END_MSG_MAP()
-
- protected:
-#pragma warning(disable : 4510 4610)
-// C4510: default constructor could not be generated
-// C4610: struct can never be instantiated - user defined constructor required
-  struct ControlAttributes {
-    const bool is_visible_;
-    const bool is_enabled_;
-    const bool is_button_;
-    const bool is_default_;
-  };
-#pragma warning(default : 4510 4610)
-
-  OmahaWnd(int dialog_id, CMessageLoop* message_loop, HWND parent);
-
-  // Message and command handlers.
-  LRESULT OnClose(UINT msg, WPARAM wparam, LPARAM lparam, BOOL& handled);       // NOLINT
-  LRESULT OnNCDestroy(UINT msg, WPARAM wparam, LPARAM lparam, BOOL& handled);   // NOLINT
-  LRESULT OnCancel(WORD notify_code, WORD id, HWND wnd_ctl, BOOL& handled);     // NOLINT
-
-  // Handles requests to close the window. Returns true if the window is closed.
-  virtual bool MaybeCloseWindow() = 0;
-
-  // Handles entering the completion mode.
-  // Returns whether to continue with OnComplete operations.
-  bool OnComplete();
-
-  // TODO(omaha3): May need to be public to implement
-  // COMPLETION_CODE_SUCCESS_CLOSE_UI outside the UI.
-  // Closes the window.
-  HRESULT CloseWindow();
-  void InitializeDialog();
-
-  HRESULT EnableClose(bool enable);
-  HRESULT EnableSystemCloseButton(bool enable);
-
-  void SetControlAttributes(int control_id,
-                            const ControlAttributes& attributes);
-
-  void SetVisible(bool visible) {
-    ShowWindow(visible ? SW_SHOWNORMAL : SW_HIDE);
-  }
-
-  DWORD thread_id() { return thread_id_; }
-  CMessageLoop* message_loop() { return message_loop_; }
-  bool is_complete() { return is_complete_; }
-  bool is_close_enabled() { return is_close_enabled_; }
-  bool is_machine() { return is_machine_; }
-  const CString& bundle_name() { return bundle_name_; }
-
-  static const ControlAttributes kVisibleTextAttributes;
-  static const ControlAttributes kDefaultActiveButtonAttributes;
-  static const ControlAttributes kNonDefaultActiveButtonAttributes;
-  static const ControlAttributes kVisibleImageAttributes;
-  static const ControlAttributes kDisabledNonButtonAttributes;
-
- private:
-  HRESULT SetWindowIcon();
-
-  void MaybeRequestExitProcess();
-  void RequestExitProcess();
-
-  CMessageLoop* message_loop_;
-  HWND parent_;
-  DWORD thread_id_;
-
-  bool is_complete_;
-  bool is_close_enabled_;
-
-  OmahaWndEvents* events_sink_;
-
-  bool is_machine_;
-  CString bundle_name_;
-
-
-  // Handle to large icon to show when ALT-TAB
-  scoped_hicon hicon_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(OmahaWnd);
-};
-
-// Registers the specified common control classes from the common control DLL.
-// Calls are cumulative, meaning control_classes are added to existing classes.
-// UIs that use common controls should call this method to ensure that the UI
-// supports visual styles.
-HRESULT InitializeCommonControls(DWORD control_classes);
-
-}  // namespace omaha
-
-#endif  // OMAHA_UI_UI_H_
diff --git a/ui/ui_ctls.h b/ui/ui_ctls.h
deleted file mode 100644
index c1f9e8d..0000000
--- a/ui/ui_ctls.h
+++ /dev/null
@@ -1,211 +0,0 @@
-// Copyright 2007-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// This is a description on UI elements for different states of the UI.
-// We have only one dialog which changes between different UI states. Some
-// controls are hidded, some controls are disabled, etc...
-
-#ifndef OMAHA_UI_UI_CTLS_H__
-#define OMAHA_UI_UI_CTLS_H__
-
-#include "omaha/ui/progress_wnd.h"
-
-namespace omaha {
-
-const ProgressWnd::ControlState ProgressWnd::ctls_[] = {
-    // The struct values are:
-    // is_visible, is_enabled, is_button, is_default
-  { IDC_PROGRESS,
-    { { true,  true,  false, false },     // STATE_INIT
-      { true,  true,  false, false },     // STATE_CHECKING_FOR_UPDATE
-      { true,  true,  false, false },     // STATE_WAITING_TO_DOWNLOAD
-      { true,  true,  false, false },     // STATE_DOWNLOADING
-      { true,  true,  false, false },     // STATE_WAITING_TO_INSTALL
-      { true,  true,  false, false },     // STATE_INSTALLING
-      { true,  true,  false, false },     // STATE_PAUSED
-      { false, false, false, false },     // STATE_COMPLETE_SUCCESS
-      { false, false, false, false },     // STATE_COMPLETE_ERROR
-      { false, false, false, false },     // STATE_COMPLETE_RESTART_BROWSER
-      { false, false, false, false },     // STATE_COMPLETE_RESTART_ALL_BROWSERS
-      { false, false, false, false },     // STATE_COMPLETE_REBOOT
-      { false, false, false, false },     // STATE_END
-    },
-  },
-  { IDC_PAUSE_RESUME_TEXT,
-    { { false, false, false, false },     // STATE_INIT
-      { false, false, false, false },     // STATE_CHECKING_FOR_UPDATE
-      { false, false, false, false },     // STATE_WAITING_TO_DOWNLOAD
-      { false,  true, false, false },     // STATE_DOWNLOADING
-      { false, false, false, false },     // STATE_WAITING_TO_INSTALL
-      { false, false, false, false },     // STATE_INSTALLING
-      { false,  true, false, false },     // STATE_PAUSED
-      { false, false, false, false },     // STATE_COMPLETE_SUCCESS
-      { false, false, false, false },     // STATE_COMPLETE_ERROR
-      { false, false, false, false },     // STATE_COMPLETE_RESTART_BROWSER
-      { false, false, false, false },     // STATE_COMPLETE_RESTART_ALL_BROWSERS
-      { false, false, false, false },     // STATE_COMPLETE_REBOOT
-      { false, false, false, false },     // STATE_END
-    },
-  },
-  { IDC_INFO_TEXT,
-    { { false, false, false, false },     // STATE_INIT
-      { false, false, false, false },     // STATE_CHECKING_FOR_UPDATE
-      { false, false, false, false },     // STATE_WAITING_TO_DOWNLOAD
-      { false, true,  false, false },     // STATE_DOWNLOADING
-      { false, false, false, false },     // STATE_WAITING_TO_INSTALL
-      { false, false, false, false },     // STATE_INSTALLING
-      { false, false, false, false },     // STATE_PAUSED
-      { false, false, false, false },     // STATE_COMPLETE_SUCCESS
-      { false, false, false, false },     // STATE_COMPLETE_ERROR
-      { false, false, false, false },     // STATE_COMPLETE_RESTART_BROWSER
-      { false, false, false, false },     // STATE_COMPLETE_RESTART_ALL_BROWSERS
-      { false, false, false, false },     // STATE_COMPLETE_REBOOT
-      { false, false, false, false },     // STATE_END
-    },
-  },
-  { IDC_INSTALLER_STATE_TEXT,
-    { { true,  true,  false, false },     // STATE_INIT
-      { true,  true,  false, false },     // STATE_CHECKING_FOR_UPDATE
-      { true,  true,  false, false },     // STATE_WAITING_TO_DOWNLOAD
-      { true,  true,  false, false },     // STATE_DOWNLOADING
-      { true,  true,  false, false },     // STATE_WAITING_TO_INSTALL
-      { true,  true,  false, false },     // STATE_INSTALLING
-      { true,  true,  false, false },     // STATE_PAUSED
-      { false, false, false, false },     // STATE_COMPLETE_SUCCESS
-      { false, false, false, false },     // STATE_COMPLETE_ERROR
-      { false, false, false, false },     // STATE_COMPLETE_RESTART_BROWSER
-      { false, false, false, false },     // STATE_COMPLETE_RESTART_ALL_BROWSERS
-      { false, false, false, false },     // STATE_COMPLETE_REBOOT
-      { false, false, false, false },     // STATE_END
-    },
-  },
-  { IDC_COMPLETE_TEXT,
-    { { false, false, false, false },     // STATE_INIT
-      { false, false, false, false },     // STATE_CHECKING_FOR_UPDATE
-      { false, false, false, false },     // STATE_WAITING_TO_DOWNLOAD
-      { false, false, false, false },     // STATE_DOWNLOADING
-      { false, false, false, false },     // STATE_WAITING_TO_INSTALL
-      { false, false, false, false },     // STATE_INSTALLING
-      { false, false, false, false },     // STATE_PAUSED
-      { true,  true,  false, false },     // STATE_COMPLETE_SUCCESS
-      { false, false, false, false },     // STATE_COMPLETE_ERROR
-      { true,  true,  false, false },     // STATE_COMPLETE_RESTART_BROWSER
-      { true,  true,  false, false },     // STATE_COMPLETE_RESTART_ALL_BROWSERS
-      { true,  true,  false, false },     // STATE_COMPLETE_REBOOT
-      { false, false, false, false },     // STATE_END
-    },
-  },
-  { IDC_ERROR_TEXT,
-    { { false, false, false, false },     // STATE_INIT
-      { false, false, false, false },     // STATE_CHECKING_FOR_UPDATE
-      { false, false, false, false },     // STATE_WAITING_TO_DOWNLOAD
-      { false, false, false, false },     // STATE_DOWNLOADING
-      { false, false, false, false },     // STATE_WAITING_TO_INSTALL
-      { false, false, false, false },     // STATE_INSTALLING
-      { false, false, false, false },     // STATE_PAUSED
-      { false, false, false, false },     // STATE_COMPLETE_SUCCESS
-      { true,  true,  false, false },     // STATE_COMPLETE_ERROR
-      { false, false, false, false },     // STATE_COMPLETE_RESTART_BROWSER
-      { false, false, false, false },     // STATE_COMPLETE_RESTART_ALL_BROWSERS
-      { false, false, false, false },     // STATE_COMPLETE_REBOOT
-      { false, false, false, false },     // STATE_END
-    },
-  },
-  { IDC_GET_HELP_TEXT,
-    { { false, false, false, false },     // STATE_INIT
-      { false, false, false, false },     // STATE_CHECKING_FOR_UPDATE
-      { false, false, false, false },     // STATE_WAITING_TO_DOWNLOAD
-      { false, false, false, false },     // STATE_DOWNLOADING
-      { false, false, false, false },     // STATE_WAITING_TO_INSTALL
-      { false, false, false, false },     // STATE_INSTALLING
-      { false, false, false, false },     // STATE_PAUSED
-      { false, false, false, false },     // STATE_COMPLETE_SUCCESS
-      { true,  true,  false, false },     // STATE_COMPLETE_ERROR
-      { false, false, false, false },     // STATE_COMPLETE_RESTART_BROWSER
-      { false, false, false, false },     // STATE_COMPLETE_RESTART_ALL_BROWSERS
-      { false, false, false, false },     // STATE_COMPLETE_REBOOT
-      { false, false, false, false },     // STATE_END
-    },
-  },
-  { IDC_BUTTON1,
-    { { false, false, true, false },     // STATE_INIT
-      { false, false, true, false },     // STATE_CHECKING_FOR_UPDATE
-      { false, false, true, false },     // STATE_WAITING_TO_DOWNLOAD
-      { false, false, true, false },     // STATE_DOWNLOADING
-      { false, false, true, false },     // STATE_WAITING_TO_INSTALL
-      { false, false, true, false },     // STATE_INSTALLING
-      { false, false, true, false },     // STATE_PAUSED
-      { false, false, true, false },     // STATE_COMPLETE_SUCCESS
-      { false, false, true, false },     // STATE_COMPLETE_ERROR
-      { true,  true,  true, true  },     // STATE_COMPLETE_RESTART_BROWSER
-      { true,  true,  true, true  },     // STATE_COMPLETE_RESTART_ALL_BROWSERS
-      { true,  true,  true, true  },     // STATE_COMPLETE_REBOOT
-      { false, false, true, false },     // STATE_END
-    },
-  },
-  { IDC_BUTTON2,
-    { { false, false, true, false },     // STATE_INIT
-      { false, false, true, false },     // STATE_CHECKING_FOR_UPDATE
-      { false, false, true, false },     // STATE_WAITING_TO_DOWNLOAD
-      { false, false, true, false },     // STATE_DOWNLOADING
-      { false, false, true, false },     // STATE_WAITING_TO_INSTALL
-      { false, false, true, false },     // STATE_INSTALLING
-      { false, false, true, false },     // STATE_PAUSED
-      { false, false, true, false },     // STATE_COMPLETE_SUCCESS
-      { false, false, true, false },     // STATE_COMPLETE_ERROR
-      { true,  true,  true, false },     // STATE_COMPLETE_RESTART_BROWSER
-      { true,  true,  true, false },     // STATE_COMPLETE_RESTART_ALL_BROWSERS
-      { true,  true,  true, false },     // STATE_COMPLETE_REBOOT
-      { false, false, true, false },     // STATE_END
-    },
-  },
-  { IDC_CLOSE,
-    { { false, false, true, false },     // STATE_INIT
-      { false, false, true, false },     // STATE_CHECKING_FOR_UPDATE
-      { false, false, true, false },     // STATE_WAITING_TO_DOWNLOAD
-      { false, false, true, false },     // STATE_DOWNLOADING
-      { false, false, true, false },     // STATE_WAITING_TO_INSTALL
-      { false, false, true, false },     // STATE_INSTALLING
-      { false, false, true, false },     // STATE_PAUSED
-      { true,  true,  true, true  },     // STATE_COMPLETE_SUCCESS
-      { true,  true,  true, true  },     // STATE_COMPLETE_ERROR
-      { false, false, true, false },     // STATE_COMPLETE_RESTART_BROWSER
-      { false, false, true, false },     // STATE_COMPLETE_RESTART_ALL_BROWSERS
-      { false, false, true, false },     // STATE_COMPLETE_REBOOT
-      { false, false, true, false },     // STATE_END
-    },
-  },
-  { IDC_IMAGE,
-    { { false, false, false, false },     // STATE_INIT
-      { false, false, false, false },     // STATE_CHECKING_FOR_UPDATE
-      { false, false, false, false },     // STATE_WAITING_TO_DOWNLOAD
-      { false, false, false, false },     // STATE_DOWNLOADING
-      { false, false, false, false },     // STATE_WAITING_TO_INSTALL
-      { false, false, false, false },     // STATE_INSTALLING
-      { false, false, false, false },     // STATE_PAUSED
-      { true,  false, false, false },     // STATE_COMPLETE_SUCCESS
-      { false, false, false, false },     // STATE_COMPLETE_ERROR
-      { true,  false, false, false },     // STATE_COMPLETE_RESTART_BROWSER
-      { true,  false, false, false },     // STATE_COMPLETE_RESTART_ALL_BROWSERS
-      { true,  false, false, false },     // STATE_COMPLETE_REBOOT
-      { false, false, false, false },     // STATE_END
-    },
-  },
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_UI_UI_CTLS_H__
-
diff --git a/ui/ui_displayed_event.cc b/ui/ui_displayed_event.cc
deleted file mode 100644
index 4130a75..0000000
--- a/ui/ui_displayed_event.cc
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/const_object_names.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/logging.h"
-#include "omaha/common/goopdate_utils.h"
-#include "omaha/ui/ui_displayed_event.h"
-
-namespace omaha {
-
-HRESULT UIDisplayedEventManager::CreateEvent(bool is_machine) {
-  ASSERT1(!IsEventHandleInitialized());
-  return goopdate_utils::CreateUniqueEventInEnvironment(
-        kLegacyUiDisplayedEventEnvironmentVariableName,
-        is_machine,
-        address(ui_displayed_event_));
-}
-
-// Caller does not own the event handle and must not close it.
-// There is a single event handle for each process. The handle is closed when
-// the process exits.
-HRESULT UIDisplayedEventManager::GetEvent(bool is_machine,
-                                          HANDLE* ui_displayed_event) {
-  ASSERT1(ui_displayed_event);
-  *ui_displayed_event = NULL;
-  if (IsEventHandleInitialized()) {
-    *ui_displayed_event = get(ui_displayed_event_);
-    return S_OK;
-  }
-
-  HRESULT hr = goopdate_utils::OpenUniqueEventFromEnvironment(
-      kLegacyUiDisplayedEventEnvironmentVariableName,
-      is_machine,
-      address(ui_displayed_event_));
-  if (FAILED(hr)) {
-    return hr;
-  }
-
-  *ui_displayed_event = get(ui_displayed_event_);
-  return S_OK;
-}
-
-// Creates the event if it does not already exist in the environment.
-void UIDisplayedEventManager::SignalEvent(bool is_machine) {
-  CORE_LOG(L2, (_T("[SignalEvent]")));
-
-  if (!IsEventHandleInitialized()) {
-    HRESULT hr = GetEvent(is_machine, address(ui_displayed_event_));
-    if (HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND) == hr) {
-      // The event was not created by an earlier process. This can happen when
-      // developers run the /handoff process directly.
-      hr = CreateEvent(is_machine);
-    }
-    if (FAILED(hr)) {
-      reset(ui_displayed_event_);
-      // We may display two UIs.
-      return;
-    }
-  }
-
-  ASSERT1(IsEventHandleInitialized());
-  VERIFY1(::SetEvent(get(ui_displayed_event_)));
-}
-
-bool UIDisplayedEventManager::IsEventHandleInitialized() {
-  return valid(ui_displayed_event_);
-}
-
-scoped_handle UIDisplayedEventManager::ui_displayed_event_;
-
-}  // namespace omaha
diff --git a/ui/ui_displayed_event.h b/ui/ui_displayed_event.h
deleted file mode 100644
index 50fe728..0000000
--- a/ui/ui_displayed_event.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-// This is for Omaha2 backwards compatibility.
-// The installed Omaha3 handoff process sets an event to tell an Omaha2 setup
-// worker running from the temp directory that a UI has been displayed so that
-// the Omaha2 worker will not display a second UI on error. The event's name is
-// passed in an environment variable name by the Omaha2 worker.
-
-#ifndef OMAHA_UI_UI_DISPLAYED_EVENT_H_
-#define OMAHA_UI_UI_DISPLAYED_EVENT_H_
-
-#include <windows.h>
-#include "omaha/base/scoped_any.h"
-
-namespace omaha {
-
-// Manages the UI Displayed Event, which is used to communicate whether a UI
-// has been displayed between processes.
-// This class is not thread safe.
-class UIDisplayedEventManager {
- public:
-  // Signals the event. Creates it if its name does not already exist in the
-  // environment variable.
-  static void SignalEvent(bool is_machine);
-
- private:
-   // Creates the event and sets its name in the environment variable.
-   static HRESULT CreateEvent(bool is_machine);
-
-   // Gets the event from the name in the environment variable.
-   static HRESULT GetEvent(bool is_machine, HANDLE* ui_displayed_event);
-
-  // Returns whether this process's event handle has been initialized.
-  static bool IsEventHandleInitialized();
-
-  // A single instance of the UI Displayed Event handle to be used for the
-  // lifetime of this process.
-  static scoped_handle ui_displayed_event_;
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_UI_UI_DISPLAYED_EVENT_H_
diff --git a/ui/ui_metrics.cc b/ui/ui_metrics.cc
deleted file mode 100644
index 377c9f2..0000000
--- a/ui/ui_metrics.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-
-#include "omaha/ui/ui_metrics.h"
-
-namespace omaha {
-
-DEFINE_METRIC_timing(worker_ui_cancel_ms);
-DEFINE_METRIC_count(worker_ui_cancels);
-
-DEFINE_METRIC_count(worker_ui_click_x);
-
-DEFINE_METRIC_count(worker_ui_esc_key_total);
-
-DEFINE_METRIC_count(worker_ui_restart_browser_buttons_displayed);
-DEFINE_METRIC_count(worker_ui_restart_browser_now_click);
-DEFINE_METRIC_count(worker_ui_restart_all_browsers_buttons_displayed);
-DEFINE_METRIC_count(worker_ui_restart_all_browsers_now_click);
-DEFINE_METRIC_count(worker_ui_reboot_buttons_displayed);
-DEFINE_METRIC_count(worker_ui_reboot_now_click);
-
-DEFINE_METRIC_count(worker_ui_get_help_displayed);
-DEFINE_METRIC_count(worker_ui_get_help_click);
-
-
-}  // namespace omaha
diff --git a/ui/ui_metrics.h b/ui/ui_metrics.h
deleted file mode 100644
index bb459ee..0000000
--- a/ui/ui_metrics.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2008-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-// Declares the usage metrics used by the worker module.
-
-#ifndef OMAHA_UI_UI_METRICS_H__
-#define OMAHA_UI_UI_METRICS_H__
-
-#include "omaha/statsreport/metrics.h"
-
-namespace omaha {
-
-// Time (ms) until the user canceled.
-DECLARE_METRIC_timing(worker_ui_cancel_ms);
-// How many times the user canceled. Only includes confirmed cancels.
-DECLARE_METRIC_count(worker_ui_cancels);
-
-// How many times the user has clicked on the x button of the UI.
-DECLARE_METRIC_count(worker_ui_click_x);
-
-// How many times the user has hit the esc key.
-DECLARE_METRIC_count(worker_ui_esc_key_total);
-
-// How many times the "Restart Browser Now/Later" buttons were displayed.
-DECLARE_METRIC_count(worker_ui_restart_browser_buttons_displayed);
-// How many times the user clicked "Restart Browser Now".
-DECLARE_METRIC_count(worker_ui_restart_browser_now_click);
-// How many times the "Restart Browsers Now/Later" buttons were displayed.
-DECLARE_METRIC_count(worker_ui_restart_all_browsers_buttons_displayed);
-// How many times the user clicked "Restart Browsers Now".
-DECLARE_METRIC_count(worker_ui_restart_all_browsers_now_click);
-// How many times the "Restart Now/Later" (reboot) buttons were displayed.
-DECLARE_METRIC_count(worker_ui_reboot_buttons_displayed);
-// How many times the user clicked "Restart Now" (reboot).
-DECLARE_METRIC_count(worker_ui_reboot_now_click);
-
-// How many times the user was offered the "Help Me Fix This" link.
-DECLARE_METRIC_count(worker_ui_get_help_displayed);
-// How many times the user clicked the "Help Me Fix This" link.
-DECLARE_METRIC_count(worker_ui_get_help_click);
-
-}  // namespace omaha
-
-#endif  // OMAHA_UI_UI_METRICS_H__
diff --git a/ui/uilib/node.h b/ui/uilib/node.h
deleted file mode 100644
index af00810..0000000
--- a/ui/uilib/node.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// node.h : Declaration of the Node
-
-#ifndef OMAHA_UI_UILIB_NODE_H_
-#define OMAHA_UI_UILIB_NODE_H_
-
-#include "omaha/ui/uilib/node_state.h"
-
-class Node {
- public:
-
-  explicit Node(HWND window) : node_state_(window) {}
-  virtual ~Node() {}
-
-  CString node_text() const { return node_text_; }
-  void AddText(const TCHAR* text) { node_text_ += text; }
-
-  void set_node_state(const NodeState& node_state) { node_state_ = node_state; }
-  const NodeState& node_state() const { return node_state_; }
-
- private:
-  CString       node_text_;
-  NodeState     node_state_;
-};
-
-#endif  // OMAHA_UI_UILIB_NODE_H_
diff --git a/ui/uilib/node_state.cc b/ui/uilib/node_state.cc
deleted file mode 100644
index c4d9c89..0000000
--- a/ui/uilib/node_state.cc
+++ /dev/null
@@ -1,237 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-//
-
-#include "omaha/ui/uilib/node_state.h"
-
-// Add a list item tag
-NodeState::Tags NodeState::tags_[] = {
-// name_to_match        length_name_to_match       action      no_parameters;
-  { _T("<b>"),       static_cast<int>(_tcslen(_T("<b>"))),      BOLD_ON,        true  },  // NOLINT
-  { _T("</b>"),      static_cast<int>(_tcslen(_T("</b>"))),     BOLD_OFF,       true  },  // NOLINT
-  { _T("<i>"),       static_cast<int>(_tcslen(_T("<i>"))),      ITALIC_ON,      true  },  // NOLINT
-  { _T("</i>"),      static_cast<int>(_tcslen(_T("</i>"))),     ITALIC_OFF,     true  },  // NOLINT
-  { _T("<u>"),       static_cast<int>(_tcslen(_T("<u>"))),      UNDERLINE_ON,   true  },  // NOLINT
-  { _T("</u>"),      static_cast<int>(_tcslen(_T("</u>"))),     UNDERLINE_OFF,  true  },  // NOLINT
-  { _T("<color="),   static_cast<int>(_tcslen(_T("<color="))),  TEXTCOLOR_ON,   false },  // NOLINT
-  { _T("</color>"),  static_cast<int>(_tcslen(_T("</color>"))), TEXTCOLOR_OFF,  true  },  // NOLINT
-  { _T("<size="),    static_cast<int>(_tcslen(_T("<size="))),   TEXTSIZE_ON,    false },  // NOLINT
-  { _T("</size>"),   static_cast<int>(_tcslen(_T("</size>"))),  TEXTSIZE_OFF,   true  },  // NOLINT
-  { _T("<a="),       static_cast<int>(_tcslen(_T("<a="))),      URL_ON,         false },  // NOLINT
-  { _T("</a>"),      static_cast<int>(_tcslen(_T("</a>"))),     URL_OFF,        true  },  // NOLINT
-};
-
-NodeState::NodeState(HWND window)
-    : default_font_(NULL),
-      font_(NULL),
-      bold_(false),
-      italic_(false),
-      underline_(false),
-      text_color_(0),
-      text_size_(8),
-      owner_window_(window) {
-}
-
-NodeState::~NodeState() {
-}
-
-
-void NodeState::SetStdFont(HFONT font) {
-  default_font_ = font;
-}
-
-
-HFONT NodeState::GetFont() const {
-  if (IsDefaultFont())
-    return default_font_;
-
-  if (font_)
-    return font_;
-
-  if (default_font_) {
-    HDC dc = GetDC(owner_window_);
-
-    LOGFONT log_font;
-    GetObject(default_font_, sizeof(LOGFONT), &log_font);
-    log_font.lfWeight    = bold_ ? FW_BOLD : FW_NORMAL;
-    log_font.lfItalic    = italic_;
-    log_font.lfUnderline = underline_;
-    log_font.lfHeight    =
-        -MulDiv(text_size_, GetDeviceCaps(dc, LOGPIXELSY), 72);
-    font_ = CreateFontIndirect(&log_font);
-  }
-
-  return font_;
-}
-
-
-bool NodeState::IsDefaultFont() const {
-    if (bold_ || italic_ || underline_)
-        return false;
-
-    if (text_size_ != 8)
-        return false;
-
-    return true;
-}
-
-
-int NodeState::ConsumeTag(const TCHAR* string) {
-  int size = sizeof(tags_) / sizeof(tags_[0]);
-  for (int i = 0; i < size; i++) {
-    if (_tcsnicmp(string, tags_[i].name_to_match,
-                  tags_[i].length_name_to_match) == 0) {
-      if (tags_[i].no_parameters) {
-        ApplyAction(tags_[i].action, NULL);
-        return tags_[i].length_name_to_match;
-      } else {
-        return tags_[i].length_name_to_match +
-               ApplyAction(tags_[i].action, string +
-                           tags_[i].length_name_to_match) + 1;
-      }
-    }
-  }
-
-  return 0;
-}
-
-
-int NodeState::ApplyAction(Actions action, const TCHAR* string/*=NULL*/) {
-  int read = 0;
-  switch (action) {
-  case BOLD_ON :
-    bold_ = true;
-    break;
-
-  case BOLD_OFF :
-    bold_ = false;
-    break;
-
-  case ITALIC_ON :
-    italic_ = true;
-    break;
-
-  case ITALIC_OFF :
-    italic_ = false;
-    break;
-
-  case UNDERLINE_ON :
-    underline_ = true;
-    break;
-
-  case UNDERLINE_OFF :
-    underline_ = false;
-    break;
-
-  case TEXTCOLOR_ON :
-    ATLASSERT(string);
-    if (string) {
-      int nParam = 0;
-      read = ReadColorRef(string, &nParam);
-      text_color_ = nParam;
-    }
-    break;
-
-  case TEXTCOLOR_OFF :
-    text_color_ = 0;
-    break;
-
-  case TEXTSIZE_ON :
-    ATLASSERT(string);
-    if (string)
-      read = ReadNumParameter(string, &text_size_);
-    break;
-
-  case TEXTSIZE_OFF :
-    text_size_ = 8;
-    break;
-
-  case URL_ON :
-    underline_ = true;
-    text_color_ = RGB(0, 0, 0xff);
-    ATLASSERT(string);
-    if (string)
-      read = ReadString(string, &url_);
-    break;
-
-  case URL_OFF :
-    underline_ = false;
-    text_color_ = 0;
-    url_ = _T("");
-    break;
-
-  case UNKNOWN:
-    // fall thru
-
-  default:
-    ATLASSERT(false);
-  }
-  return read;
-}
-
-int NodeState::ReadNumParameter(const TCHAR* string, int* param) {
-  if (!param)
-    return 0;
-
-  *param = 0;
-  const TCHAR* current_pos = string;
-  while (current_pos && _istdigit(*current_pos)) {
-    *param *= 10;
-    *param += *current_pos - _T('0');
-    current_pos++;
-  }
-  return static_cast<int>(current_pos - string);
-}
-
-int NodeState::ReadHexParameter(const TCHAR* string, int* param) {
-  if (!param)
-    return 0;
-
-  *param = 0;
-  const TCHAR* current_pos = string;
-  while (current_pos && _istxdigit(*current_pos)) {
-    *param = ((*param) << 4);
-    if (_istdigit(*current_pos))
-      *param += *current_pos - _T('0');
-    else
-      *param += (*current_pos | 0x20) - _T('a') + 10;
-    current_pos++;
-  }
-  return static_cast<int>(current_pos - string);
-}
-
-int NodeState::ReadColorRef(const TCHAR* string, int* param) {
-  if (!param)
-    return 0;
-
-  int read = ReadHexParameter(string, param);
-  *param = RGB((*param) >> 16, ((*param) >> 8) & 0xff, (*param) & 0xff);
-  return read;
-}
-
-int NodeState::ReadString(const TCHAR* string, CString* string_out) {
-  if (!string_out)
-    return 0;
-
-  int length = 0;
-  int position = _tcscspn(string, _T(" >"));
-  if (position >= 0) {
-    *string_out = CString(string, position);
-    length = position;
-  }
-
-  return length;
-}
diff --git a/ui/uilib/node_state.h b/ui/uilib/node_state.h
deleted file mode 100644
index 77ce30a..0000000
--- a/ui/uilib/node_state.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-
-#ifndef OMAHA_UI_UILIB_NODE_STATE_H_
-#define OMAHA_UI_UILIB_NODE_STATE_H_
-
-#include <atlstr.h>
-
-class NodeState {
- public:
-  explicit NodeState(HWND window);
-  virtual ~NodeState();
-
-  void SetStdFont(HFONT font);
-  HFONT GetFont() const;
-  COLORREF text_color() const { return text_color_; }
-  bool IsURL() const { return !url_.IsEmpty(); }
-  CString url() const { return url_; }
-
-  int ConsumeTag(const TCHAR* string);
-
- private:
-  enum Actions {
-    UNKNOWN,
-    BOLD_ON,
-    BOLD_OFF,
-    ITALIC_ON,
-    ITALIC_OFF,
-    UNDERLINE_ON,
-    UNDERLINE_OFF,
-    TEXTCOLOR_ON,
-    TEXTCOLOR_OFF,
-    TEXTSIZE_ON,
-    TEXTSIZE_OFF,
-    URL_ON,
-    URL_OFF,
-  };
-
-  struct Tags {
-    const TCHAR*  name_to_match;
-    int           length_name_to_match;
-    Actions       action;
-    bool          no_parameters;
-  };
-
-  int ApplyAction(Actions action, const TCHAR* string);
-  int ReadNumParameter(const TCHAR* string, int* param);
-  int ReadHexParameter(const TCHAR* szString, int* param);
-  int ReadColorRef(const TCHAR* string, int* param);
-  int ReadString(const TCHAR* string, CString* string_out);
-  bool IsDefaultFont() const;
-
-  // Data
-  static Tags    tags_[];
-
-  HWND           owner_window_;
-  HFONT          default_font_;
-  mutable HFONT  font_;
-
-  bool           bold_;
-  bool           italic_;
-  bool           underline_;
-  COLORREF       text_color_;
-  int            text_size_;
-  CString        url_;
-};
-
-#endif  // OMAHA_UI_UILIB_NODE_STATE_H_
diff --git a/ui/uilib/static_ex.cc b/ui/uilib/static_ex.cc
deleted file mode 100644
index c038f65..0000000
--- a/ui/uilib/static_ex.cc
+++ /dev/null
@@ -1,586 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-
-// TODO(omaha): need to handle WM_GETTEXT
-// TODO(omaha): need to handle WM_SIZE
-// TODO(omaha): nice to have transparent mode
-
-#include "omaha/ui/uilib/static_ex.h"
-
-#include <shellapi.h>
-#include <strsafe.h>
-#include "omaha/ui/uilib/node_state.h"
-
-const int StaticEx::kBorderNone    = 0;
-const int StaticEx::kBorderLeft    = 1;
-const int StaticEx::kBorderTop     = 2;
-const int StaticEx::kBorderRight   = 4;
-const int StaticEx::kBorderBottom  = 8;
-const int StaticEx::kBorderAll     = kBorderLeft | kBorderTop | kBorderRight |
-                                     kBorderBottom;
-
-HCURSOR StaticEx::hand_cursor_ = NULL;
-
-StaticEx::StaticEx()
-    : margins_(1, 0, 1, 0),  // see comment in h file
-      background_color_(0xffffff),
-      use_background_color_(false),
-      ellipsis_(0),
-      border_(kBorderNone),
-      border_color_(0),
-      default_font_(NULL) {
-}
-
-StaticEx::~StaticEx() {
-  EraseNodes();
-  EraseLines(&lines_);
-}
-
-void StaticEx::Reset() {
-  text_.Empty();
-  EraseNodes();
-  EraseLines(&lines_);
-  default_font_ = NULL;
-}
-
-BOOL StaticEx::SubclassWindow(HWND window) {
-  Reset();
-  // first get text from exising control
-  unsigned length = ::SendMessage(window, WM_GETTEXTLENGTH, 0, 0);
-  CString text;
-  if (length > 0) {
-    TCHAR* buffer = text.GetBufferSetLength(length);
-    ::SendMessage(window,
-                  WM_GETTEXT,
-                  length + 1,
-                  reinterpret_cast<LPARAM>(buffer));
-    text.ReleaseBuffer(-1);
-  }
-
-  // then subclass
-  BOOL result = CWindowImpl<StaticEx>::SubclassWindow(window);
-
-  // set text back (it will parse it and replace text in subclassed control
-  // with readble text)
-  if (result && length > 0) {
-    SetWindowText(text);
-  }
-
-  return result;
-}
-
-HWND StaticEx::UnsubclassWindow(BOOL force /*= FALSE*/) {
-  Reset();  // clean up an old state
-  return CWindowImpl<StaticEx>::UnsubclassWindow(force);
-}
-
-LRESULT StaticEx::OnSetText(UINT msg, WPARAM wparam, LPARAM lparam,
-                            BOOL& handled) {
-  // parse text first, because we will need to get "readable" text
-  text_ = reinterpret_cast<const TCHAR*>(lparam);
-  ParseText();
-
-  // set readable text to subclassed control, this text will be return by
-  // GetWindowText() or WM_GETTEXT. (when GetWindowText is called from another
-  // process it doesn't send WM_GETTEXT but reads text directly from contol)
-  // so we need to set text to it.
-  // Disable redraw, without it calling DefWindowProc would redraw control
-  // immediately without sending WM_PAINT message
-  SetRedraw(FALSE);
-  DefWindowProc(msg, wparam,
-      reinterpret_cast<LPARAM>(static_cast<const TCHAR*>(GetReadableText())));
-  SetRedraw(TRUE);
-
-  // now invalidate to display new text
-  Invalidate();
-
-  handled = TRUE;
-  return 1;
-}
-
-LRESULT StaticEx::OnGetText(UINT, WPARAM wparam, LPARAM lparam, BOOL& handled) {  // NOLINT
-  if (!lparam) return 0;
-  unsigned size = static_cast<unsigned>(wparam);
-  TCHAR* buffer = reinterpret_cast<TCHAR*>(lparam);
-
-  handled = TRUE;
-  unsigned my_size = text_.GetLength();
-  if (my_size < size) {
-    StringCchCopy(buffer, size, text_);
-    return my_size;
-  }
-
-  StringCchCopyN(buffer, size, text_, size - 1);
-  buffer[size - 1] = 0;
-
-  return size - 1;
-}
-
-LRESULT StaticEx::OnGetTextLength(UINT, WPARAM, LPARAM, BOOL& handled) {  // NOLINT
-  handled = TRUE;
-  return text_.GetLength();
-}
-
-void StaticEx::set_background_color(COLORREF back_color) {
-  background_color_ = back_color;
-  use_background_color_ = true;
-  Invalidate();
-}
-
-void StaticEx::set_margins(const RECT& rect) {
-  margins_ = rect;
-  Invalidate();
-}
-
-void StaticEx::set_margins(int left, int top, int right, int bottom) {
-  margins_.SetRect(left, top, right, bottom);
-  Invalidate();
-}
-
-
-LRESULT StaticEx::OnLButtonUp(UINT, WPARAM, LPARAM lparam, BOOL&) {
-  CPoint point(LOWORD(lparam), HIWORD(lparam));
-
-  int height = margins_.top + (border_ & kBorderTop) ? 1 : 0;
-  size_t size = lines_.size();
-  for (size_t i = 0; i < size; i++) {
-    height += lines_[i]->height();
-    if (point.y < height) {
-      CString action;
-      if (lines_[i]->IsUrlUnderMouse(point, &action) && !action.IsEmpty()) {
-        // Notify the parent window to handle the click.
-        LRESULT handled = 0;
-        NMSTATICEX notification = {0};
-        notification.header.hwndFrom = m_hWnd;
-        notification.header.idFrom = GetDlgCtrlID();
-        notification.header.code = NM_STATICEX;
-        notification.action = action;
-
-        HWND parent = GetParent();
-        if (parent) {
-          handled = ::SendMessage(parent, WM_NOTIFY, notification.header.idFrom,
-                                  reinterpret_cast<LPARAM>(&notification));
-          ATLASSERT(handled);
-        }
-      }
-      break;
-    }
-  }
-  return 0;
-}
-
-
-LRESULT StaticEx::OnSetCursor(UINT, WPARAM, LPARAM lparam, BOOL& handled) {  // NOLINT
-  int hit_test = LOWORD(lparam);
-  handled = FALSE;
-  if (hit_test != HTCLIENT) {
-    return 0;
-  }
-
-  POINT position;
-  if (!GetCursorPos(&position))
-    return 0;
-
-  ScreenToClient(&position);
-
-  int offset = margins_.top + (border_ & kBorderTop) ? 1 : 0;
-  size_t size = lines_.size();
-  for (size_t i = 0; i < size; i++) {
-    offset += lines_[i]->height();
-    if (position.y < offset) {
-      if (lines_[i]->IsUrlUnderMouse(position, NULL)) {
-        ::SetCursor(GetHandCursor());
-        handled = TRUE;
-      }
-      break;
-    }
-  }
-
-  return 0;
-}
-
-void StaticEx::set_ellipsis(int ellipsis) {
-  if (ellipsis == DT_END_ELLIPSIS  ||
-      ellipsis == DT_WORD_ELLIPSIS ||
-      ellipsis == DT_PATH_ELLIPSIS ||
-      ellipsis == 0) {
-    ellipsis_ = ellipsis;
-    if (ellipsis != 0)
-      ModifyStyle(0, SS_LEFTNOWORDWRAP);
-    Invalidate();
-  }
-}
-
-void StaticEx::set_border(int border) {
-  border_ = border;
-  Invalidate();
-}
-
-void StaticEx::set_border_color(COLORREF border_color) {
-  border_color_ = border_color;
-  Invalidate();
-}
-
-void StaticEx::ParseText() {
-  EraseNodes();
-  EraseLines(&lines_);
-
-  if (text_.IsEmpty())
-    return;
-
-  if (!default_font_)
-    default_font_ = GetFont();
-
-  NodeState node_state(m_hWnd);
-  node_state.SetStdFont(default_font_);
-
-  const TCHAR* current_string = text_;
-  int current_offset = 0;
-  bool had_good_tag = true;
-  while (*current_string) {
-    current_offset = 0;
-
-    if (had_good_tag) {
-      // if it was a good tag we consumed it and need to start with a new node
-      Node* node = new Node(m_hWnd);
-      nodes_.push_back(node);
-
-      // -1 if there is no Open Bracket "<"
-      current_offset = FindOpenBracket(current_string);
-
-      if (current_offset < 0) {
-        // no tags left, just plain text
-        node->AddText(current_string);
-        node->set_node_state(node_state);
-        break;
-      }
-
-      if (*current_string != _T('<')) {
-        // has some text before the tag
-        node->AddText(CString(current_string, current_offset));
-        node->set_node_state(node_state);
-        current_string += current_offset;
-        continue;
-      }
-
-      int next_offset = node_state.ConsumeTag(current_string + current_offset);
-
-      if (next_offset > 0) {
-        // it was a known tag
-        had_good_tag = true;
-        current_string += current_offset + next_offset;
-      }  else  {
-        // unknown tag, will keep looking
-        had_good_tag = false;
-        node->AddText(CString(current_string, current_offset + 1));
-        node->set_node_state(node_state);
-        current_string += current_offset + 1;
-        continue;
-      }
-    } else {
-      had_good_tag = true;
-    }
-    delete nodes_.back();
-    nodes_.pop_back();
-  }
-}
-
-CString StaticEx::GetReadableText() {
-  CString text;
-  for (size_t i = 0; i < nodes_.size(); i++) {
-    text += nodes_[i]->node_text();
-  }
-  return text;
-}
-
-void StaticEx::EraseNodes() {
-  for (size_t i = 0; i < nodes_.size(); ++i) {
-    delete nodes_[i];
-  }
-  nodes_.clear();
-}
-
-void StaticEx::EraseLines(std::vector<StaticLine*>* lines) {
-  size_t size = lines->size();
-  for (size_t i = 0; i < size; i++) {
-    delete (*lines)[i];
-  }
-  lines->clear();
-}
-
-int StaticEx::FindOpenBracket(const TCHAR* string) {
-  const TCHAR* left_bracket = _tcschr(string, _T('<'));
-
-  if (left_bracket == NULL)
-    return -1;
-
-  return static_cast<int>(left_bracket - string);
-}
-
-LRESULT StaticEx::OnPaint(UINT, WPARAM, LPARAM, BOOL&) {
-  PAINTSTRUCT paint_struct;
-  HDC hdc = BeginPaint(&paint_struct);
-
-  CRect client_rect;
-  GetClientRect(&client_rect);
-
-  CRect working_rect(client_rect);
-
-  working_rect.DeflateRect(margins_);
-  working_rect.DeflateRect((border_ & kBorderLeft)   ? 1 : 0,
-                           (border_ & kBorderTop)    ? 1 : 0,
-                           (border_ & kBorderRight)  ? 1 : 0,
-                           (border_ & kBorderBottom) ? 1 : 0);
-
-  DWORD style = GetStyle();
-
-  EraseLines(&lines_);
-  PrePaint(hdc, &lines_, nodes_, working_rect, style, ellipsis_);
-
-  if (use_background_color_) {
-    FillRect(hdc, &client_rect, CreateSolidBrush(background_color_));
-  } else {
-    HBRUSH brush = reinterpret_cast<HBRUSH>(::SendMessage(GetParent(),
-        WM_CTLCOLORSTATIC, reinterpret_cast<WPARAM>(hdc),
-        reinterpret_cast<LPARAM>(m_hWnd)));
-    if (brush) {
-      ::FillRect(hdc, &client_rect, brush);
-    }
-  }
-
-  if (border_ != kBorderNone)
-    DrawBorder(hdc, client_rect);
-
-  Paint(hdc, lines_, working_rect, style, ellipsis_);
-
-  EndPaint(&paint_struct);
-  return 0;
-}
-
-void StaticEx::PrePaint(HDC hdc, std::vector<StaticLine*>* lines,
-                        const std::vector<Node*>& nodes, RECT rect, DWORD style,
-                        int ellipsis) {
-  if (nodes.empty())
-    return;
-
-  int x = 0;
-  int width = rect.right - rect.left;
-  StaticLine* line = new StaticLine;
-  lines->push_back(line);
-  bool done = false;
-  size_t size = nodes.size();
-  for (size_t i = 0; i < size; ++i) {
-    Node* node = nodes[i];
-    const NodeState& node_state = node->node_state();
-    CString text = node->node_text();
-    int string_len = text.GetLength();
-
-    HFONT font = node_state.GetFont();
-    if (!font)
-      return;
-
-    HFONT old_font = static_cast<HFONT>(SelectObject(hdc, font));
-
-    TEXTMETRIC text_metrics;
-    GetTextMetrics(hdc, &text_metrics);
-
-    int height    = text_metrics.tmHeight + text_metrics.tmExternalLeading;
-    int base_line = text_metrics.tmHeight + text_metrics.tmExternalLeading -
-                    text_metrics.tmDescent;
-    line->AdjustHeight(height);
-    line->AdjustBaseLine(base_line);
-
-    bool single_line = (style & SS_LEFTNOWORDWRAP) != 0;
-
-    int  current_pos = 0;
-    bool more_left   = false;
-    while (true) {
-      int current_length = string_len - current_pos;
-
-      // find LF if any
-      int lf_position = text.Find(_T('\n'), current_pos);
-      if (lf_position == current_pos) {
-        if (single_line) {
-          if (ellipsis)
-            line->AddEllipses();
-          break;
-        }
-        line = new StaticLine;
-        lines->push_back(line);
-        line->AdjustHeight(height);
-        line->AdjustBaseLine(base_line);
-        x = 0;
-
-        current_pos++;
-
-        continue;
-      } else if (lf_position > 0) {
-        current_length = lf_position - current_pos;
-        more_left = true;
-      }
-
-      // check if it will fit in one line
-      int fit  = 0;
-      SIZE string_size;
-      GetTextExtentExPoint(hdc, static_cast<const TCHAR*>(text) + current_pos,
-                           current_length, width - x, &fit, NULL, &string_size);
-
-      if (fit < current_length) {
-        // string doesn't fit, need to move to the next line
-        // find last space
-        int fit_saved = fit;
-        for (; fit > 0; fit--) {
-          if (text.GetAt(current_pos + fit) == _T(' ')) {
-            break;
-          }
-        }
-
-        // if a first word of a node doesn't fit and it starts in a first half
-        // of control then wrap the word on a last char that fits
-        // otherwise move whole node to the next line
-        if ((fit <= 0) && (x < width / 2))
-          fit = fit_saved;
-
-        if (fit > 0) {
-          line->AddNode(node, current_pos, fit, height, base_line, width - x);
-        }
-
-        if (single_line) {
-          if (ellipsis)
-            line->AddEllipses();
-          done = true;
-          break;
-        }
-        line = new StaticLine;
-        lines->push_back(line);
-        line->AdjustHeight(height);
-        line->AdjustBaseLine(base_line);
-        x = 0;
-
-        current_pos += fit;
-        // skip spaces
-        while (text.GetAt(current_pos) == _T(' '))
-          current_pos++;
-        continue;
-      } else {
-        line->AddNode(node, current_pos, fit, height, base_line,
-                      string_size.cx);
-      }
-
-      // done, it fits
-      x += string_size.cx;
-      if (!more_left)
-        break;
-
-      current_pos += current_length;
-      more_left = false;
-    }
-
-    if (old_font)
-      SelectObject(hdc, old_font);
-
-    if (done)
-      break;
-  }
-}
-
-
-void StaticEx::Paint(HDC hdc, const std::vector<StaticLine*>& lines, RECT rect,
-                     DWORD style, int ellipsis) {
-  if ((style & SS_LEFTNOWORDWRAP) == 0) {
-    ellipsis = 0;
-  }
-
-  size_t size = lines.size();
-  int y = rect.top;
-  for (size_t i = 0; i < size; i++) {
-    int height = lines[i]->Paint(hdc, rect.left, rect.right, y, style,
-                                 ellipsis);
-    y += height;
-  }
-}
-
-LRESULT StaticEx::OnEraseBkgnd(UINT /*msg*/, WPARAM /*wparam*/,
-                               LPARAM /*lparam*/, BOOL& handled) {
-  handled = TRUE;
-  return 0;
-}
-
-void StaticEx::DrawBorder(HDC hdc, const CRect& rect) {
-  HGDIOBJ old_object = SelectObject(hdc, GetStockObject(DC_PEN));
-  SetDCPenColor(hdc, border_color_);
-  if (border_ & kBorderLeft) {
-    MoveToEx(hdc, rect.left, rect.top, NULL);
-    LineTo(hdc, rect.left, rect.bottom);
-  }
-  if (border_ & kBorderTop) {
-    MoveToEx(hdc, rect.left, rect.top, NULL);
-    LineTo(hdc, rect.right, rect.top);
-  }
-  if (border_ & kBorderRight) {
-    MoveToEx(hdc, rect.right - 1, rect.top, NULL);
-    LineTo(hdc, rect.right - 1, rect.bottom);
-  }
-  if (border_ & kBorderBottom) {
-    MoveToEx(hdc, rect.left, rect.bottom - 1, NULL);
-    LineTo(hdc, rect.right, rect.bottom - 1);
-  }
-  SelectObject(hdc, old_object);
-}
-
-int StaticEx::GetMinimumHeight(int width) {
-  HDC device_context = CreateCompatibleDC(NULL);
-
-  CRect client_rect;
-  if (width <= 0)
-    GetClientRect(&client_rect);
-  else
-    client_rect.SetRect(0, 0, width, 100);  // last value is not used
-
-  CRect working_rect(client_rect);
-
-  working_rect.DeflateRect(margins_);
-  working_rect.DeflateRect((border_ & kBorderLeft)   ? 1 : 0,
-                           (border_ & kBorderTop)    ? 1 : 0,
-                           (border_ & kBorderRight)  ? 1 : 0,
-                           (border_ & kBorderBottom) ? 1 : 0);
-
-  DWORD style = GetStyle();
-
-  std::vector<StaticLine*> lines;
-  PrePaint(device_context, &lines, nodes_, working_rect, style, ellipsis_);
-
-  DeleteDC(device_context);
-
-  int height = 0;
-  for (unsigned i = 0; i < lines.size(); i++) {
-    height += lines[i]->height();
-  }
-  height += margins_.top + margins_.bottom;
-  height += (border_ & kBorderTop) ? 1 : 0;
-  height += (border_ & kBorderBottom) ? 1 : 0;
-
-  return height;
-}
-
-
-HCURSOR StaticEx::GetHandCursor() {
-  if (hand_cursor_ == NULL) {
-    // Load cursor resource
-    hand_cursor_ = (HCURSOR)LoadCursor(NULL, IDC_HAND);  // doesn't work on NT4!
-  }
-  return hand_cursor_;
-}
diff --git a/ui/uilib/static_ex.h b/ui/uilib/static_ex.h
deleted file mode 100644
index f11d7ea..0000000
--- a/ui/uilib/static_ex.h
+++ /dev/null
@@ -1,159 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-// static_ex.h : This class extends static control functionality to display
-// formatted text and hyper-links
-//
-// Currently it supports the following formatting options:
-//   bold         - <b>bold</b>
-//   italic       - <i>italic</i>
-//   underscore   - <u>underlined</u>
-//   color        - <color=ff0000>red</color>
-//   size         - <size=14>14 points text</size>
-//   hyperlink    - <a=http://www.google.com>click here</a>
-// formatting options could be nested (except hyperlink)
-//
-// Some fonts (including Tahoma) often overhang one pixel (for example in "W")
-// so StaticEx is created with default 1 pixel margin on the left and right,
-// use set_margins() to overwrite default values if you need to.
-
-
-#ifndef OMAHA_UI_UILIB_STATIC_EX_H_
-#define OMAHA_UI_UILIB_STATIC_EX_H_
-
-#include <windows.h>
-#include <atlbase.h>
-#include <atlwin.h>
-#include <string>
-#include <vector>
-#include "omaha/ui/uilib/node.h"
-#include "omaha/ui/uilib/static_line.h"
-
-
-// Windows control notification codes are all negative, so any positive number
-// should do here. http://goo.gl/NPaBF.
-const UINT NM_STATICEX = NM_FIRST + 0x400;
-
-// extension of NMHDR to provide StaticEx specific info in notification message
-struct NMSTATICEX {
-  NMHDR header;
-  const TCHAR* action;
-};
-
-class StaticEx : public CWindowImpl<StaticEx> {
- public:
-  DECLARE_WND_SUPERCLASS(NULL, _T("STATIC"))
-
-  StaticEx();
-  virtual ~StaticEx();
-
-  void set_margins(const RECT& rect);
-  void set_margins(int left, int top, int right, int bottom);
-  RECT margins() const { return margins_; }
-
-  void set_background_color(COLORREF back_color);
-  COLORREF background_color() const { return background_color_; }
-  void ResetBackgroundColor() { use_background_color_ = false; }
-
-  // set ellipsis style (DT_END_ELLIPSIS | DT_WORD_ELLIPSIS |DT_PATH_ELLIPSIS)
-  // elipsis are supported only in a single line control, calling this function
-  // with not 0 argument will set control style to SS_LEFTNOWORDWRAP
-  void set_ellipsis(int ellipsis);
-  int ellipsis() const { return ellipsis_; }
-
-  static const int kBorderNone;
-  static const int kBorderLeft;
-  static const int kBorderTop;
-  static const int kBorderRight;
-  static const int kBorderBottom;
-  static const int kBorderAll;
-
-  // use constants above to set border, you can combine them using "|"
-  void set_border(int border);
-  int border() const { return border_; }
-
-  void set_border_color(COLORREF border_color);
-  COLORREF border_color() const { return border_color_; }
-
-  // this function doesn't change how control is shown
-  // it just calculates minimum control height to fit the text given
-  // the control width. if width is 0 it will use current control width
-  int GetMinimumHeight(int width);
-
-  BEGIN_MSG_MAP(StaticEx)
-    MESSAGE_HANDLER(WM_SETTEXT, OnSetText)
-    MESSAGE_HANDLER(kGetTextMessage, OnGetText)
-    MESSAGE_HANDLER(kGetTextLengthMessage, OnGetTextLength)
-    MESSAGE_HANDLER(WM_PAINT, OnPaint)
-    MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd)
-    MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp)
-    MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
-  END_MSG_MAP()
-
-  LRESULT OnSetText(UINT msg, WPARAM wparam, LPARAM lparam, BOOL& handled);         // NOLINT
-  // OnGetText and OnGetTextLength work with full text including formatting tags
-  // to get readable text (without formatting info) call GetWindowText or
-  // send WM_GETTEXT
-  LRESULT OnGetText(UINT msg, WPARAM wparam, LPARAM lparam, BOOL& handled);         // NOLINT
-  LRESULT OnGetTextLength(UINT msg, WPARAM wparam, LPARAM lparam, BOOL& handled);   // NOLINT
-
-  LRESULT OnPaint(UINT msg, WPARAM wparam, LPARAM lparam, BOOL& handled);           // NOLINT
-  LRESULT OnEraseBkgnd(UINT msg, WPARAM wparam, LPARAM lparam, BOOL& handled);      // NOLINT
-  LRESULT OnLButtonUp(UINT msg, WPARAM wparam, LPARAM lparam, BOOL& handled);       // NOLINT
-  LRESULT OnSetCursor(UINT msg, WPARAM wparam, LPARAM lparam, BOOL& handled);       // NOLINT
-
-  BOOL SubclassWindow(HWND hWnd);
-  HWND UnsubclassWindow(BOOL bForce = FALSE);
-
- private:
-  void Reset();
-  void ParseText();
-  CString GetReadableText();
-  int FindOpenBracket(const TCHAR* string);
-  void EraseNodes();
-  void EraseLines(std::vector<StaticLine*>* lines);
-  HFONT default_font() const { return default_font_; }
-
-  void PrePaint(HDC dc, std::vector<StaticLine*>* lines,
-                const std::vector<Node*>& nodes, RECT rect, DWORD style,
-                int ellipsis);
-  void Paint(HDC hdc, const std::vector<StaticLine*>& lines, RECT rect,
-             DWORD style, int ellipsis);
-  void DrawBorder(HDC hdc, const CRect& rect);
-  HCURSOR GetHandCursor();
-
-  CString               text_;
-
-  CRect                 margins_;
-  COLORREF              background_color_;
-  bool                  use_background_color_;
-  int                   ellipsis_;
-  int                   border_;
-  COLORREF              border_color_;
-
-  std::vector<Node*>         nodes_;
-  std::vector<StaticLine*>   lines_;
-
-  HFONT                 default_font_;
-
-  static HCURSOR hand_cursor_;
-
-  static const UINT kGetTextMessage       = WM_APP + 1;
-  static const UINT kGetTextLengthMessage = WM_APP + 2;
-
-  DISALLOW_EVIL_CONSTRUCTORS(StaticEx);
-};
-
-#endif  // OMAHA_UI_UILIB_STATIC_EX_H_
diff --git a/ui/uilib/static_line.cc b/ui/uilib/static_line.cc
deleted file mode 100644
index 717e2dc..0000000
--- a/ui/uilib/static_line.cc
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-//
-
-#include "omaha/ui/uilib/static_line.h"
-#include "omaha/ui/uilib/node.h"
-#include "omaha/ui/uilib/static_ex.h"
-
-
-StaticLine::StaticLine()
-    : base_line_(0),
-      height_(0),
-      elipses_(false) {
-}
-
-
-StaticLine::~StaticLine() {
-}
-
-
-int StaticLine::AdjustHeight(int height) {
-  height_ = std::max(height_, height);
-  return height_;
-}
-
-
-int StaticLine::AdjustBaseLine(int base_line) {
-  base_line_ = std::max(base_line_, base_line);
-  return base_line_;
-}
-
-
-void StaticLine::AddNode(Node* node, int start, int length, int height,
-                         int base_line, int width) {
-  nodes_.push_back(Nodes(node, start, length, height, base_line, width));
-  AdjustHeight(height);
-  AdjustBaseLine(base_line);
-}
-
-
-int StaticLine::Paint(HDC hdc, int left, int right, int y, DWORD window_style,
-                      int ellipsis) {
-  int old_bk_mode = SetBkMode(hdc, TRANSPARENT);
-  bool single_line = (window_style & SS_LEFTNOWORDWRAP) != 0;
-
-  size_t size = nodes_.size();
-  for (size_t i = 0; i < size; i++) {
-    Node* node    = nodes_[i].node;
-    int start     = nodes_[i].start;
-    int length    = nodes_[i].length;
-    int base_line = nodes_[i].base_line;
-    int width     = nodes_[i].width;
-
-    CString text(static_cast<LPCTSTR>(node->node_text()) + start, length);
-    if (elipses_ && (i == (size - 1)))
-      text += "...";
-
-    CRect rect(left, y + base_line_ - base_line, left + width, y + height_);
-    if (single_line)
-      rect.right = right;
-
-    nodes_[i].rect = rect;
-
-    const NodeState& nodeState = node->node_state();
-    HFONT font = nodeState.GetFont();
-    if (!font)
-      return height_;
-
-    HFONT old_font = static_cast<HFONT>(SelectObject(hdc, font));
-    COLORREF old_text_color = SetTextColor(hdc, nodeState.text_color());
-
-    DWORD draw_style = 0;
-    draw_style = DT_LEFT | DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE;
-    if (ellipsis && (i == (size - 1)))
-      draw_style = draw_style | ellipsis;
-
-    DrawText(hdc, text, text.GetLength(), rect, draw_style);
-    left += width;
-
-    SetTextColor(hdc, old_text_color);
-    if (old_font)
-      SelectObject(hdc, old_font);
-  }
-
-  SetBkMode(hdc, old_bk_mode);
-  return height_;
-}
-
-
-int StaticLine::HitTest(CPoint point) {
-  size_t size = nodes_.size();
-  for (size_t i = 0; i < size; i++) {
-    if (nodes_[i].node->node_state().IsURL()) {
-      if (nodes_[i].rect.PtInRect(point)) {
-        return static_cast<int>(i);
-      }
-    }
-  }
-
-  return -1;
-}
-
-
-bool StaticLine::IsUrlUnderMouse(CPoint point, CString* action) {
-  int index = HitTest(point);
-  if (index >= 0 && action) {
-    *action = nodes_[index].node->node_state().url();
-  }
-  return (index >= 0);
-}
diff --git a/ui/uilib/static_line.h b/ui/uilib/static_line.h
deleted file mode 100644
index 4802dca..0000000
--- a/ui/uilib/static_line.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2006-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-//
-// static_line.h
-
-#ifndef OMAHA_UI_UILIB_STATIC_LINE_H_
-#define OMAHA_UI_UILIB_STATIC_LINE_H_
-
-#include <atlstr.h>
-#include <atltypes.h>
-#include <vector>
-#include "base/basictypes.h"
-
-class Node;
-
-class StaticLine {
- public:
-  StaticLine();
-  virtual ~StaticLine();
-
-  int AdjustBaseLine(int base_line);
-  int AdjustHeight(int height);
-
-  int base_line() const { return base_line_; }
-  int height() const { return height_; }
-
-  void AddNode(Node* node, int start, int end, int height, int base_line,
-               int width);
-  void AddEllipses() { elipses_ = true; }
-
-  bool IsUrlUnderMouse(CPoint point, CString* action);
-
-  int  Paint(HDC hdc, int left, int right, int y, DWORD window_style,
-             int ellipsis);
-
- protected:
-  int     HitTest(CPoint point);
-
-  int   base_line_;
-  int   height_;
-
-  struct Nodes {
-    Node*   node;
-    int     start;     // first char to output
-    int     length;    // number of chars
-    int     height;
-    int     base_line;
-    int     width;
-    CRect   rect;
-
-    Nodes(Node* node, int start, int length, int height, int base_line,
-          int width)
-        : node(node), start(start), length(length), height(height),
-          base_line(base_line), width(width), rect(0, 0, 0, 0) {}
-  };
-
-  std::vector<Nodes>   nodes_;
-  bool            elipses_;
-
-  DISALLOW_EVIL_CONSTRUCTORS(StaticLine);
-};
-
-#endif  // OMAHA_UI_UILIB_STATIC_LINE_H_
diff --git a/ui/yes_no_dialog.cc b/ui/yes_no_dialog.cc
deleted file mode 100644
index 393a91d..0000000
--- a/ui/yes_no_dialog.cc
+++ /dev/null
@@ -1,149 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/ui/yes_no_dialog.h"
-#include "base/basictypes.h"
-#include "omaha/base/debug.h"
-#include "omaha/base/error.h"
-#include "omaha/base/logging.h"
-#include "omaha/base/window_utils.h"
-#include "omaha/google_update/resource.h"
-
-namespace omaha {
-
-YesNoDialog::YesNoDialog(CMessageLoop* message_loop, HWND parent)
-    :  message_loop_(message_loop),
-       parent_(parent),
-       yes_clicked_(false) {
-  ASSERT1(message_loop);
-  CORE_LOG(L3, (_T("[YesNoDialog::YesNoDialog]")));
-}
-
-
-YesNoDialog::~YesNoDialog() {
-  CORE_LOG(L3, (_T("[YesNoDialog::~YesNoDialog]")));
-  ASSERT1(!IsWindow());
-}
-
-HRESULT YesNoDialog::Initialize(const CString& yes_no_title,
-                                const CString& yes_no_text) {
-  ASSERT1(!IsWindow());
-
-  if (!Create(parent_)) {
-    CORE_LOG(LE, (_T("[Failed to create YesNoDialog]")));
-    return GOOPDATE_E_UI_INTERNAL_ERROR;
-  }
-
-  VERIFY1(message_loop_->AddMessageFilter(this));
-
-  VERIFY1(SetWindowText(yes_no_title));
-  VERIFY1(::SetWindowText(GetDlgItem(IDC_YES_NO_TEXT), yes_no_text));
-
-  CString yes;
-  VERIFY1(yes.LoadString(IDS_YES));
-  CString no;
-  VERIFY1(no.LoadString(IDS_NO));
-
-  VERIFY1(::SetWindowText(GetDlgItem(IDOK), yes));
-  VERIFY1(::SetWindowText(GetDlgItem(IDCANCEL), no));
-
-  HRESULT hr = WindowUtils::SetWindowIcon(m_hWnd, IDI_APP, address(hicon_));
-  if (FAILED(hr)) {
-    CORE_LOG(LW, (_T("[Failed to SetWindowIcon][0x%x]"), hr));
-  }
-
-  return S_OK;
-}
-
-HRESULT YesNoDialog::Show() {
-  ASSERT1(IsWindow());
-  ASSERT1(!IsWindowVisible());
-
-  VERIFY1(CenterWindow(NULL));
-  ShowWindow(SW_SHOWNORMAL);
-
-  return S_OK;
-}
-
-LRESULT YesNoDialog::OnClickedButton(WORD notify_code,
-                                     WORD id,
-                                     HWND wnd_ctl,
-                                     BOOL& handled) {   // NOLINT
-  UNREFERENCED_PARAMETER(notify_code);
-  UNREFERENCED_PARAMETER(wnd_ctl);
-
-  CORE_LOG(L3, (_T("[YesNoDialog::OnClickedButton]")));
-  ASSERT1(id == IDOK || id == IDCANCEL);
-
-  #pragma warning(push)
-  // C4061: enumerator 'xxx' in switch of enum 'yyy' is not explicitly handled
-  // by a case label.
-  #pragma warning(disable : 4061)
-
-  switch (id) {
-    case IDOK:
-      yes_clicked_ = true;
-      break;
-
-    case IDCANCEL:
-      yes_clicked_ = false;
-      break;
-
-    default:
-      ASSERT1(false);
-      yes_clicked_ = false;
-      break;
-  }
-  #pragma warning(pop)
-
-  handled = true;
-  SendMessage(WM_CLOSE, 0, 0);
-
-  return 0;
-}
-
-LRESULT YesNoDialog::OnClose(UINT message,
-                              WPARAM wparam,
-                              LPARAM lparam,
-                              BOOL& handled) {
-  UNREFERENCED_PARAMETER(message);
-  UNREFERENCED_PARAMETER(wparam);
-  UNREFERENCED_PARAMETER(lparam);
-
-  DestroyWindow();
-
-  handled = TRUE;
-  return 0;
-}
-
-LRESULT YesNoDialog::OnNCDestroy(UINT message,
-                                 WPARAM wparam,
-                                 LPARAM lparam,
-                                 BOOL& handled) {
-  UNREFERENCED_PARAMETER(message);
-  UNREFERENCED_PARAMETER(wparam);
-  UNREFERENCED_PARAMETER(lparam);
-
-  CORE_LOG(L3, (_T("[YesNoDialog::OnNCDestroy]")));
-  VERIFY1(message_loop_->RemoveMessageFilter(this));
-
-  ::PostQuitMessage(0);
-
-  handled = FALSE;  // Let ATL default processing handle the WM_NCDESTROY.
-  return 0;
-}
-
-}  // namespace omaha
-
diff --git a/ui/yes_no_dialog.h b/ui/yes_no_dialog.h
deleted file mode 100644
index 97214d9..0000000
--- a/ui/yes_no_dialog.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2011 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_UI_YES_NO_DIALOG_H_
-#define OMAHA_UI_YES_NO_DIALOG_H_
-
-#include "omaha/base/scoped_any.h"
-#include "omaha/base/wtl_atlapp_wrapper.h"
-#include "omaha/client/resource.h"
-
-namespace omaha {
-
-class YesNoDialog
-    : public CAxDialogImpl<YesNoDialog>,
-      public CMessageFilter {
-  typedef CAxDialogImpl<YesNoDialog> Base;
-
- public:
-  static const int IDD = IDD_YES_NO;
-
-  YesNoDialog(CMessageLoop* message_loop, HWND parent);
-  ~YesNoDialog();
-
-  HRESULT Initialize(const CString& yes_no_title,
-                     const CString& yes_no_text);
-  HRESULT Show();
-
-  bool yes_clicked() const {
-    return yes_clicked_;
-  }
-
-  // CMessageFilter interface method.
-  BOOL PreTranslateMessage(MSG* msg) {
-    return CWindow::IsDialogMessage(msg);
-  }
-
-  BEGIN_MSG_MAP(YesNoDialog)
-    COMMAND_HANDLER(IDOK, BN_CLICKED, OnClickedButton)
-    COMMAND_ID_HANDLER(IDCANCEL, OnClickedButton)
-    MESSAGE_HANDLER(WM_CLOSE, OnClose)
-    MESSAGE_HANDLER(WM_NCDESTROY, OnNCDestroy)
-    CHAIN_MSG_MAP(Base)
-  END_MSG_MAP()
-
- private:
-  // Message and command handlers.
-  LRESULT OnClickedButton(WORD notify_code,
-                          WORD id,
-                          HWND wnd_ctl,
-                          BOOL& handled);  // NOLINT(runtime/references)
-  LRESULT OnClose(UINT msg,
-                  WPARAM wparam,
-                  LPARAM lparam,
-                  BOOL& handled);  // NOLINT(runtime/references)
-  LRESULT OnNCDestroy(UINT msg,
-                      WPARAM wparam,
-                      LPARAM lparam,
-                      BOOL& handled);  // NOLINT(runtime/references)
-
-  CMessageLoop* message_loop_;
-  HWND parent_;
-  bool yes_clicked_;
-
-  // Handle to large icon to show when ALT-TAB.
-  scoped_hicon hicon_;
-
-  DISALLOW_COPY_AND_ASSIGN(YesNoDialog);
-};
-
-}  // namespace omaha
-
-#endif  // OMAHA_UI_YES_NO_DIALOG_H_
-
diff --git a/ui/yes_no_dialog_unittest.cc b/ui/yes_no_dialog_unittest.cc
deleted file mode 100644
index 3acd7f4..0000000
--- a/ui/yes_no_dialog_unittest.cc
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2010 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include <windows.h>
-#include "omaha/base/app_util.h"
-#include "omaha/goopdate/resource_manager.h"
-#include "omaha/testing/unit_test.h"
-#include "omaha/ui/yes_no_dialog.h"
-
-namespace omaha {
-
-class YesNoDialogTest : public testing::Test {
- protected:
-  YesNoDialogTest() {}
-
-  static void SetUpTestCase() {
-    CString resource_dir = app_util::GetModuleDirectory(NULL);
-    EXPECT_HRESULT_SUCCEEDED(
-        ResourceManager::Create(false, resource_dir, _T("en")));
-  }
-
-  static void TearDownTestCase() {
-    ResourceManager::Delete();
-  }
-
-  static void SendCloseMessage(const YesNoDialog& yes_no_dialog) {
-    EXPECT_TRUE(yes_no_dialog.IsWindow());
-    ::SendMessage(yes_no_dialog.m_hWnd, WM_CLOSE, 0, 0);
-  }
-};
-
-TEST_F(YesNoDialogTest, YesNoDialog) {
-  CString title(_T("YesNoDialog"));
-  CString text(_T("This is a test. Continue?"));
-
-  CMessageLoop message_loop;
-  YesNoDialog yes_no_dialog(&message_loop, NULL);
-  EXPECT_SUCCEEDED(yes_no_dialog.Initialize(title, text));
-  EXPECT_SUCCEEDED(yes_no_dialog.Show());
-  YesNoDialogTest::SendCloseMessage(yes_no_dialog);
-}
-
-}   // namespace omaha
-